@corti/sdk 1.0.0-rc.5 → 1.0.0-rc.7

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.
Files changed (71) hide show
  1. package/dist/cjs/BaseClient.js +2 -2
  2. package/dist/cjs/api/resources/stream/client/Socket.d.ts +1 -1
  3. package/dist/cjs/api/resources/transcribe/client/Socket.d.ts +1 -1
  4. package/dist/cjs/api/types/StreamConfigStatusMessageType.d.ts +0 -1
  5. package/dist/cjs/api/types/StreamConfigStatusMessageType.js +0 -1
  6. package/dist/cjs/api/types/StreamDeltaUsageMessage.d.ts +5 -0
  7. package/dist/cjs/api/types/StreamDeltaUsageMessage.js +3 -0
  8. package/dist/cjs/api/types/TranscribeConfigStatusMessageType.d.ts +2 -0
  9. package/dist/cjs/api/types/TranscribeConfigStatusMessageType.js +2 -0
  10. package/dist/cjs/api/types/TranscribeDeltaUsageMessage.d.ts +5 -0
  11. package/dist/cjs/api/types/TranscribeDeltaUsageMessage.js +3 -0
  12. package/dist/cjs/api/types/index.d.ts +2 -0
  13. package/dist/cjs/api/types/index.js +2 -0
  14. package/dist/cjs/custom/CortiClient.d.ts +20 -0
  15. package/dist/cjs/custom/CortiClient.js +69 -0
  16. package/dist/cjs/custom/agents/CustomAgents.d.ts +20 -0
  17. package/dist/cjs/custom/agents/CustomAgents.js +73 -0
  18. package/dist/cjs/custom/stream/CustomStream.js +5 -3
  19. package/dist/cjs/custom/transcribe/CustomTranscribe.js +6 -2
  20. package/dist/cjs/serialization/resources/stream/client/socket/StreamSocketResponse.d.ts +3 -2
  21. package/dist/cjs/serialization/resources/stream/client/socket/StreamSocketResponse.js +2 -0
  22. package/dist/cjs/serialization/resources/transcribe/client/socket/TranscribeSocketResponse.d.ts +3 -2
  23. package/dist/cjs/serialization/resources/transcribe/client/socket/TranscribeSocketResponse.js +2 -0
  24. package/dist/cjs/serialization/types/StreamConfigStatusMessageType.d.ts +1 -1
  25. package/dist/cjs/serialization/types/StreamConfigStatusMessageType.js +0 -1
  26. package/dist/cjs/serialization/types/StreamDeltaUsageMessage.d.ts +10 -0
  27. package/dist/cjs/serialization/types/StreamDeltaUsageMessage.js +42 -0
  28. package/dist/cjs/serialization/types/TranscribeConfigStatusMessageType.d.ts +1 -1
  29. package/dist/cjs/serialization/types/TranscribeConfigStatusMessageType.js +7 -1
  30. package/dist/cjs/serialization/types/TranscribeDeltaUsageMessage.d.ts +10 -0
  31. package/dist/cjs/serialization/types/TranscribeDeltaUsageMessage.js +42 -0
  32. package/dist/cjs/serialization/types/index.d.ts +2 -0
  33. package/dist/cjs/serialization/types/index.js +2 -0
  34. package/dist/cjs/version.d.ts +1 -1
  35. package/dist/cjs/version.js +1 -1
  36. package/dist/esm/BaseClient.mjs +2 -2
  37. package/dist/esm/api/resources/stream/client/Socket.d.mts +1 -1
  38. package/dist/esm/api/resources/transcribe/client/Socket.d.mts +1 -1
  39. package/dist/esm/api/types/StreamConfigStatusMessageType.d.mts +0 -1
  40. package/dist/esm/api/types/StreamConfigStatusMessageType.mjs +0 -1
  41. package/dist/esm/api/types/StreamDeltaUsageMessage.d.mts +5 -0
  42. package/dist/esm/api/types/StreamDeltaUsageMessage.mjs +2 -0
  43. package/dist/esm/api/types/TranscribeConfigStatusMessageType.d.mts +2 -0
  44. package/dist/esm/api/types/TranscribeConfigStatusMessageType.mjs +2 -0
  45. package/dist/esm/api/types/TranscribeDeltaUsageMessage.d.mts +5 -0
  46. package/dist/esm/api/types/TranscribeDeltaUsageMessage.mjs +2 -0
  47. package/dist/esm/api/types/index.d.mts +2 -0
  48. package/dist/esm/api/types/index.mjs +2 -0
  49. package/dist/esm/custom/CortiClient.d.mts +20 -0
  50. package/dist/esm/custom/CortiClient.mjs +36 -0
  51. package/dist/esm/custom/agents/CustomAgents.d.mts +20 -0
  52. package/dist/esm/custom/agents/CustomAgents.mjs +36 -0
  53. package/dist/esm/custom/stream/CustomStream.mjs +5 -3
  54. package/dist/esm/custom/transcribe/CustomTranscribe.mjs +6 -2
  55. package/dist/esm/serialization/resources/stream/client/socket/StreamSocketResponse.d.mts +3 -2
  56. package/dist/esm/serialization/resources/stream/client/socket/StreamSocketResponse.mjs +2 -0
  57. package/dist/esm/serialization/resources/transcribe/client/socket/TranscribeSocketResponse.d.mts +3 -2
  58. package/dist/esm/serialization/resources/transcribe/client/socket/TranscribeSocketResponse.mjs +2 -0
  59. package/dist/esm/serialization/types/StreamConfigStatusMessageType.d.mts +1 -1
  60. package/dist/esm/serialization/types/StreamConfigStatusMessageType.mjs +0 -1
  61. package/dist/esm/serialization/types/StreamDeltaUsageMessage.d.mts +10 -0
  62. package/dist/esm/serialization/types/StreamDeltaUsageMessage.mjs +6 -0
  63. package/dist/esm/serialization/types/TranscribeConfigStatusMessageType.d.mts +1 -1
  64. package/dist/esm/serialization/types/TranscribeConfigStatusMessageType.mjs +7 -1
  65. package/dist/esm/serialization/types/TranscribeDeltaUsageMessage.d.mts +10 -0
  66. package/dist/esm/serialization/types/TranscribeDeltaUsageMessage.mjs +6 -0
  67. package/dist/esm/serialization/types/index.d.mts +2 -0
  68. package/dist/esm/serialization/types/index.mjs +2 -0
  69. package/dist/esm/version.d.mts +1 -1
  70. package/dist/esm/version.mjs +1 -1
  71. package/package.json +1 -1
@@ -43,8 +43,8 @@ function normalizeClientOptions(options) {
43
43
  const headers = (0, headers_js_1.mergeHeaders)({
44
44
  "X-Fern-Language": "JavaScript",
45
45
  "X-Fern-SDK-Name": "@corti/sdk",
46
- "X-Fern-SDK-Version": "1.0.0-rc.5",
47
- "User-Agent": "@corti/sdk/1.0.0-rc.5",
46
+ "X-Fern-SDK-Version": "1.0.0-rc.7",
47
+ "User-Agent": "@corti/sdk/1.0.0-rc.7",
48
48
  "X-Fern-Runtime": core.RUNTIME.type,
49
49
  "X-Fern-Runtime-Version": core.RUNTIME.version,
50
50
  "Tenant-Name": options === null || options === void 0 ? void 0 : options.tenantName,
@@ -4,7 +4,7 @@ export declare namespace StreamSocket {
4
4
  interface Args {
5
5
  socket: core.ReconnectingWebSocket;
6
6
  }
7
- type Response = Corti.StreamTranscriptMessage | Corti.StreamFactsMessage | Corti.StreamFlushedMessage | Corti.StreamEndedMessage | Corti.StreamUsageMessage | Corti.StreamErrorMessage | Corti.StreamConfigStatusMessage;
7
+ type Response = Corti.StreamTranscriptMessage | Corti.StreamFactsMessage | Corti.StreamFlushedMessage | Corti.StreamDeltaUsageMessage | Corti.StreamEndedMessage | Corti.StreamUsageMessage | Corti.StreamErrorMessage | Corti.StreamConfigStatusMessage;
8
8
  type EventHandlers = {
9
9
  open?: () => void;
10
10
  message?: (message: Response) => void;
@@ -4,7 +4,7 @@ export declare namespace TranscribeSocket {
4
4
  interface Args {
5
5
  socket: core.ReconnectingWebSocket;
6
6
  }
7
- type Response = Corti.TranscribeUsageMessage | Corti.TranscribeFlushedMessage | Corti.TranscribeEndedMessage | Corti.TranscribeErrorMessage | Corti.TranscribeTranscriptMessage | Corti.TranscribeCommandMessage | Corti.TranscribeConfigStatusMessage;
7
+ type Response = Corti.TranscribeUsageMessage | Corti.TranscribeFlushedMessage | Corti.TranscribeDeltaUsageMessage | Corti.TranscribeEndedMessage | Corti.TranscribeErrorMessage | Corti.TranscribeTranscriptMessage | Corti.TranscribeCommandMessage | Corti.TranscribeConfigStatusMessage;
8
8
  type EventHandlers = {
9
9
  open?: () => void;
10
10
  message?: (message: Response) => void;
@@ -5,6 +5,5 @@ export declare const StreamConfigStatusMessageType: {
5
5
  readonly ConfigMissing: "CONFIG_MISSING";
6
6
  readonly ConfigNotProvided: "CONFIG_NOT_PROVIDED";
7
7
  readonly ConfigAlreadyReceived: "CONFIG_ALREADY_RECEIVED";
8
- readonly ConfigTimeout: "CONFIG_TIMEOUT";
9
8
  };
10
9
  export type StreamConfigStatusMessageType = (typeof StreamConfigStatusMessageType)[keyof typeof StreamConfigStatusMessageType];
@@ -9,5 +9,4 @@ exports.StreamConfigStatusMessageType = {
9
9
  ConfigMissing: "CONFIG_MISSING",
10
10
  ConfigNotProvided: "CONFIG_NOT_PROVIDED",
11
11
  ConfigAlreadyReceived: "CONFIG_ALREADY_RECEIVED",
12
- ConfigTimeout: "CONFIG_TIMEOUT",
13
12
  };
@@ -0,0 +1,5 @@
1
+ export interface StreamDeltaUsageMessage {
2
+ type: "delta_usage";
3
+ /** Approximate credits consumed since recording started. */
4
+ credits: number;
5
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -3,5 +3,7 @@ export declare const TranscribeConfigStatusMessageType: {
3
3
  readonly ConfigAccepted: "CONFIG_ACCEPTED";
4
4
  readonly ConfigDenied: "CONFIG_DENIED";
5
5
  readonly ConfigTimeout: "CONFIG_TIMEOUT";
6
+ readonly ConfigAlreadyReceived: "CONFIG_ALREADY_RECEIVED";
7
+ readonly ConfigMissing: "CONFIG_MISSING";
6
8
  };
7
9
  export type TranscribeConfigStatusMessageType = (typeof TranscribeConfigStatusMessageType)[keyof typeof TranscribeConfigStatusMessageType];
@@ -7,4 +7,6 @@ exports.TranscribeConfigStatusMessageType = {
7
7
  ConfigAccepted: "CONFIG_ACCEPTED",
8
8
  ConfigDenied: "CONFIG_DENIED",
9
9
  ConfigTimeout: "CONFIG_TIMEOUT",
10
+ ConfigAlreadyReceived: "CONFIG_ALREADY_RECEIVED",
11
+ ConfigMissing: "CONFIG_MISSING",
10
12
  };
@@ -0,0 +1,5 @@
1
+ export interface TranscribeDeltaUsageMessage {
2
+ type: "delta_usage";
3
+ /** Approximate credits consumed since recording started. */
4
+ credits: number;
5
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -136,6 +136,7 @@ export * from "./StreamConfigStatusMessage.js";
136
136
  export * from "./StreamConfigStatusMessageType.js";
137
137
  export * from "./StreamConfigTranscription.js";
138
138
  export * from "./StreamConfigXCortiRetentionPolicy.js";
139
+ export * from "./StreamDeltaUsageMessage.js";
139
140
  export * from "./StreamEndedMessage.js";
140
141
  export * from "./StreamEndMessage.js";
141
142
  export * from "./StreamErrorDetail.js";
@@ -168,6 +169,7 @@ export * from "./TranscribeConfig.js";
168
169
  export * from "./TranscribeConfigMessage.js";
169
170
  export * from "./TranscribeConfigStatusMessage.js";
170
171
  export * from "./TranscribeConfigStatusMessageType.js";
172
+ export * from "./TranscribeDeltaUsageMessage.js";
171
173
  export * from "./TranscribeEndedMessage.js";
172
174
  export * from "./TranscribeEndMessage.js";
173
175
  export * from "./TranscribeErrorMessage.js";
@@ -152,6 +152,7 @@ __exportStar(require("./StreamConfigStatusMessage.js"), exports);
152
152
  __exportStar(require("./StreamConfigStatusMessageType.js"), exports);
153
153
  __exportStar(require("./StreamConfigTranscription.js"), exports);
154
154
  __exportStar(require("./StreamConfigXCortiRetentionPolicy.js"), exports);
155
+ __exportStar(require("./StreamDeltaUsageMessage.js"), exports);
155
156
  __exportStar(require("./StreamEndedMessage.js"), exports);
156
157
  __exportStar(require("./StreamEndMessage.js"), exports);
157
158
  __exportStar(require("./StreamErrorDetail.js"), exports);
@@ -184,6 +185,7 @@ __exportStar(require("./TranscribeConfig.js"), exports);
184
185
  __exportStar(require("./TranscribeConfigMessage.js"), exports);
185
186
  __exportStar(require("./TranscribeConfigStatusMessage.js"), exports);
186
187
  __exportStar(require("./TranscribeConfigStatusMessageType.js"), exports);
188
+ __exportStar(require("./TranscribeDeltaUsageMessage.js"), exports);
187
189
  __exportStar(require("./TranscribeEndedMessage.js"), exports);
188
190
  __exportStar(require("./TranscribeEndMessage.js"), exports);
189
191
  __exportStar(require("./TranscribeErrorMessage.js"), exports);
@@ -1,5 +1,6 @@
1
1
  import { CortiClient as BaseCortiClient } from "../Client.js";
2
2
  import type * as environments from "../environments.js";
3
+ import { CustomAgents } from "./agents/CustomAgents.js";
3
4
  import { CortiAuth } from "./auth/CortiAuth.js";
4
5
  import { CustomStream } from "./stream/CustomStream.js";
5
6
  import { CustomTranscribe } from "./transcribe/CustomTranscribe.js";
@@ -40,10 +41,29 @@ export declare class CortiClient extends BaseCortiClient {
40
41
  protected _auth: CortiAuth | undefined;
41
42
  protected _stream: CustomStream | undefined;
42
43
  protected _transcribe: CustomTranscribe | undefined;
44
+ protected _agents: CustomAgents | undefined;
43
45
  private readonly _encodeHeadersAsWsProtocols;
44
46
  constructor(options: CortiClient.Options);
45
47
  get auth(): CortiAuth;
46
48
  get stream(): CustomStream;
47
49
  get transcribe(): CustomTranscribe;
50
+ get agents(): CustomAgents;
51
+ /**
52
+ * Retrieves authentication headers for API requests.
53
+ *
54
+ * This method returns a Headers object containing the Authorization header with a valid
55
+ * bearer token and the Tenant-Name header. The token is automatically refreshed if needed.
56
+ *
57
+ * @returns A Promise that resolves to a Headers object with Authorization and Tenant-Name headers
58
+ *
59
+ * @example
60
+ * ```typescript
61
+ * const client = new CortiClient({ ... });
62
+ * const headers = await client.getAuthHeaders();
63
+ * console.log(headers.get("Authorization")); // "Bearer ..."
64
+ * console.log(headers.get("Tenant-Name")); // "your-tenant"
65
+ * ```
66
+ */
67
+ getAuthHeaders: () => Promise<Headers>;
48
68
  }
49
69
  export {};
@@ -1,7 +1,51 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
36
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
37
+ return new (P || (P = Promise))(function (resolve, reject) {
38
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
39
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
40
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
41
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
42
+ });
43
+ };
2
44
  Object.defineProperty(exports, "__esModule", { value: true });
3
45
  exports.CortiClient = void 0;
4
46
  const Client_js_1 = require("../Client.js");
47
+ const core = __importStar(require("../core/index.js"));
48
+ const CustomAgents_js_1 = require("./agents/CustomAgents.js");
5
49
  const CortiAuth_js_1 = require("./auth/CortiAuth.js");
6
50
  const CustomStream_js_1 = require("./stream/CustomStream.js");
7
51
  const CustomTranscribe_js_1 = require("./transcribe/CustomTranscribe.js");
@@ -15,6 +59,27 @@ class CortiClient extends Client_js_1.CortiClient {
15
59
  const ctx = (0, resolveClientOptions_js_1.resolveClientOptions)(options);
16
60
  const restOptions = Object.assign(Object.assign(Object.assign({}, opts), { tenantName: ctx.tenantName, environment: (0, environment_js_1.getEnvironment)(ctx.environment) }), (ctx.initialTokenResponse != null ? { initialTokenResponse: ctx.initialTokenResponse } : {}));
17
61
  super((0, authToBaseOptions_js_1.authToBaseOptions)(opts.auth, restOptions));
62
+ /**
63
+ * Retrieves authentication headers for API requests.
64
+ *
65
+ * This method returns a Headers object containing the Authorization header with a valid
66
+ * bearer token and the Tenant-Name header. The token is automatically refreshed if needed.
67
+ *
68
+ * @returns A Promise that resolves to a Headers object with Authorization and Tenant-Name headers
69
+ *
70
+ * @example
71
+ * ```typescript
72
+ * const client = new CortiClient({ ... });
73
+ * const headers = await client.getAuthHeaders();
74
+ * console.log(headers.get("Authorization")); // "Bearer ..."
75
+ * console.log(headers.get("Tenant-Name")); // "your-tenant"
76
+ * ```
77
+ */
78
+ this.getAuthHeaders = () => __awaiter(this, void 0, void 0, function* () {
79
+ var _a;
80
+ const req = yield this._options.authProvider.getAuthRequest();
81
+ return new Headers(Object.assign(Object.assign({}, ((_a = req.headers) !== null && _a !== void 0 ? _a : {})), { "Tenant-Name": yield core.Supplier.get(this._options.tenantName) }));
82
+ });
18
83
  (0, withCredentialsConfig_js_1.setDefaultWithCredentials)(options.withCredentials);
19
84
  this._encodeHeadersAsWsProtocols = options.encodeHeadersAsWsProtocols;
20
85
  }
@@ -30,5 +95,9 @@ class CortiClient extends Client_js_1.CortiClient {
30
95
  var _a;
31
96
  return ((_a = this._transcribe) !== null && _a !== void 0 ? _a : (this._transcribe = new CustomTranscribe_js_1.CustomTranscribe(Object.assign(Object.assign({}, this._options), { encodeHeadersAsWsProtocols: this._encodeHeadersAsWsProtocols }))));
32
97
  }
98
+ get agents() {
99
+ var _a;
100
+ return ((_a = this._agents) !== null && _a !== void 0 ? _a : (this._agents = new CustomAgents_js_1.CustomAgents(this._options)));
101
+ }
33
102
  }
34
103
  exports.CortiClient = CortiClient;
@@ -0,0 +1,20 @@
1
+ /**
2
+ * This file is the custom implementation of the Agents client (src/api/resources/agents/client/Client.ts)
3
+ *
4
+ * It extends the auto-generated Agents class and adds custom helper methods.
5
+ *
6
+ * All the patches marked with `// Patch: ...` comments.
7
+ */
8
+ import { AgentsClient } from "../../api/resources/agents/client/Client.js";
9
+ export declare class CustomAgents extends AgentsClient {
10
+ /**
11
+ * Returns the URL for the agent card JSON file.
12
+ *
13
+ * @param {string} agentId - The ID of the agent
14
+ * @returns {Promise<URL>} A Promise that resolves to the URL for the agent card
15
+ *
16
+ * @example
17
+ * const url = await client.agents.getAgentCardUrl("agent-123");
18
+ */
19
+ getCardUrl: (agentId: string) => Promise<URL>;
20
+ }
@@ -0,0 +1,73 @@
1
+ "use strict";
2
+ /**
3
+ * This file is the custom implementation of the Agents client (src/api/resources/agents/client/Client.ts)
4
+ *
5
+ * It extends the auto-generated Agents class and adds custom helper methods.
6
+ *
7
+ * All the patches marked with `// Patch: ...` comments.
8
+ */
9
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ var desc = Object.getOwnPropertyDescriptor(m, k);
12
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
13
+ desc = { enumerable: true, get: function() { return m[k]; } };
14
+ }
15
+ Object.defineProperty(o, k2, desc);
16
+ }) : (function(o, m, k, k2) {
17
+ if (k2 === undefined) k2 = k;
18
+ o[k2] = m[k];
19
+ }));
20
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
21
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
22
+ }) : function(o, v) {
23
+ o["default"] = v;
24
+ });
25
+ var __importStar = (this && this.__importStar) || (function () {
26
+ var ownKeys = function(o) {
27
+ ownKeys = Object.getOwnPropertyNames || function (o) {
28
+ var ar = [];
29
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
30
+ return ar;
31
+ };
32
+ return ownKeys(o);
33
+ };
34
+ return function (mod) {
35
+ if (mod && mod.__esModule) return mod;
36
+ var result = {};
37
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
38
+ __setModuleDefault(result, mod);
39
+ return result;
40
+ };
41
+ })();
42
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
43
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
44
+ return new (P || (P = Promise))(function (resolve, reject) {
45
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
46
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
47
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
48
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
49
+ });
50
+ };
51
+ Object.defineProperty(exports, "__esModule", { value: true });
52
+ exports.CustomAgents = void 0;
53
+ const Client_js_1 = require("../../api/resources/agents/client/Client.js");
54
+ const core = __importStar(require("../../core/index.js"));
55
+ class CustomAgents extends Client_js_1.AgentsClient {
56
+ constructor() {
57
+ super(...arguments);
58
+ /**
59
+ * Returns the URL for the agent card JSON file.
60
+ *
61
+ * @param {string} agentId - The ID of the agent
62
+ * @returns {Promise<URL>} A Promise that resolves to the URL for the agent card
63
+ *
64
+ * @example
65
+ * const url = await client.agents.getAgentCardUrl("agent-123");
66
+ */
67
+ this.getCardUrl = (agentId) => __awaiter(this, void 0, void 0, function* () {
68
+ const encodedAgentId = encodeURIComponent(agentId);
69
+ return new URL(`/agents/${encodedAgentId}/agent-card.json`, (yield core.Supplier.get(this._options.environment)).agents);
70
+ });
71
+ }
72
+ }
73
+ exports.CustomAgents = CustomAgents;
@@ -64,7 +64,6 @@ const parseStreamResponseType_js_1 = require("./parseStreamResponseType.js");
64
64
  const STREAM_CONFIG_REJECTION_TYPES = [
65
65
  Corti.StreamConfigStatusMessageType.ConfigDenied,
66
66
  Corti.StreamConfigStatusMessageType.ConfigMissing,
67
- Corti.StreamConfigStatusMessageType.ConfigTimeout,
68
67
  Corti.StreamConfigStatusMessageType.ConfigNotProvided,
69
68
  ];
70
69
  class CustomStream extends Client_js_1.StreamClient {
@@ -134,7 +133,9 @@ class CustomStream extends Client_js_1.StreamClient {
134
133
  });
135
134
  socket.socket.addEventListener("message", (event) => {
136
135
  const type = (0, parseStreamResponseType_js_1.parseStreamResponseType)(event.data);
137
- if (type == null || type === Corti.StreamConfigStatusMessageType.ConfigAccepted) {
136
+ if (type == null ||
137
+ type === Corti.StreamConfigStatusMessageType.ConfigAccepted ||
138
+ type === Corti.StreamConfigStatusMessageType.ConfigAlreadyReceived) {
138
139
  return;
139
140
  }
140
141
  if (STREAM_CONFIG_REJECTION_TYPES.includes(type) || type === "error") {
@@ -162,7 +163,8 @@ class CustomStream extends Client_js_1.StreamClient {
162
163
  const type = (0, parseStreamResponseType_js_1.parseStreamResponseType)(event.data);
163
164
  if (type == null)
164
165
  return;
165
- if (type === Corti.StreamConfigStatusMessageType.ConfigAccepted) {
166
+ if (type === Corti.StreamConfigStatusMessageType.ConfigAccepted ||
167
+ type === Corti.StreamConfigStatusMessageType.ConfigAlreadyReceived) {
166
168
  cleanup();
167
169
  resolve();
168
170
  }
@@ -64,6 +64,7 @@ const parseTranscribeResponseType_js_1 = require("./parseTranscribeResponseType.
64
64
  const TRANSCRIBE_CONFIG_REJECTION_TYPES = [
65
65
  Corti.TranscribeConfigStatusMessageType.ConfigDenied,
66
66
  Corti.TranscribeConfigStatusMessageType.ConfigTimeout,
67
+ Corti.TranscribeConfigStatusMessageType.ConfigMissing,
67
68
  ];
68
69
  class CustomTranscribe extends Client_js_1.TranscribeClient {
69
70
  constructor(options) {
@@ -132,7 +133,9 @@ class CustomTranscribe extends Client_js_1.TranscribeClient {
132
133
  });
133
134
  socket.socket.addEventListener("message", (event) => {
134
135
  const type = (0, parseTranscribeResponseType_js_1.parseTranscribeResponseType)(event.data);
135
- if (type == null || type === Corti.TranscribeConfigStatusMessageType.ConfigAccepted) {
136
+ if (type == null ||
137
+ type === Corti.TranscribeConfigStatusMessageType.ConfigAccepted ||
138
+ type === Corti.TranscribeConfigStatusMessageType.ConfigAlreadyReceived) {
136
139
  return;
137
140
  }
138
141
  if (TRANSCRIBE_CONFIG_REJECTION_TYPES.includes(type) || type === "error") {
@@ -160,7 +163,8 @@ class CustomTranscribe extends Client_js_1.TranscribeClient {
160
163
  const type = (0, parseTranscribeResponseType_js_1.parseTranscribeResponseType)(event.data);
161
164
  if (type == null)
162
165
  return;
163
- if (type === Corti.TranscribeConfigStatusMessageType.ConfigAccepted) {
166
+ if (type === Corti.TranscribeConfigStatusMessageType.ConfigAccepted ||
167
+ type === Corti.TranscribeConfigStatusMessageType.ConfigAlreadyReceived) {
164
168
  cleanup();
165
169
  resolve();
166
170
  }
@@ -2,13 +2,14 @@ import type * as Corti from "../../../../../api/index.js";
2
2
  import * as core from "../../../../../core/index.js";
3
3
  import type * as serializers from "../../../../index.js";
4
4
  import { StreamConfigStatusMessage } from "../../../../types/StreamConfigStatusMessage.js";
5
+ import { StreamDeltaUsageMessage } from "../../../../types/StreamDeltaUsageMessage.js";
5
6
  import { StreamEndedMessage } from "../../../../types/StreamEndedMessage.js";
6
7
  import { StreamErrorMessage } from "../../../../types/StreamErrorMessage.js";
7
8
  import { StreamFactsMessage } from "../../../../types/StreamFactsMessage.js";
8
9
  import { StreamFlushedMessage } from "../../../../types/StreamFlushedMessage.js";
9
10
  import { StreamTranscriptMessage } from "../../../../types/StreamTranscriptMessage.js";
10
11
  import { StreamUsageMessage } from "../../../../types/StreamUsageMessage.js";
11
- export declare const StreamSocketResponse: core.serialization.Schema<serializers.StreamSocketResponse.Raw, Corti.StreamTranscriptMessage | Corti.StreamFactsMessage | Corti.StreamFlushedMessage | Corti.StreamEndedMessage | Corti.StreamUsageMessage | Corti.StreamErrorMessage | Corti.StreamConfigStatusMessage>;
12
+ export declare const StreamSocketResponse: core.serialization.Schema<serializers.StreamSocketResponse.Raw, Corti.StreamTranscriptMessage | Corti.StreamFactsMessage | Corti.StreamFlushedMessage | Corti.StreamDeltaUsageMessage | Corti.StreamEndedMessage | Corti.StreamUsageMessage | Corti.StreamErrorMessage | Corti.StreamConfigStatusMessage>;
12
13
  export declare namespace StreamSocketResponse {
13
- type Raw = StreamTranscriptMessage.Raw | StreamFactsMessage.Raw | StreamFlushedMessage.Raw | StreamEndedMessage.Raw | StreamUsageMessage.Raw | StreamErrorMessage.Raw | StreamConfigStatusMessage.Raw;
14
+ type Raw = StreamTranscriptMessage.Raw | StreamFactsMessage.Raw | StreamFlushedMessage.Raw | StreamDeltaUsageMessage.Raw | StreamEndedMessage.Raw | StreamUsageMessage.Raw | StreamErrorMessage.Raw | StreamConfigStatusMessage.Raw;
14
15
  }
@@ -37,6 +37,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
37
37
  exports.StreamSocketResponse = void 0;
38
38
  const core = __importStar(require("../../../../../core/index.js"));
39
39
  const StreamConfigStatusMessage_js_1 = require("../../../../types/StreamConfigStatusMessage.js");
40
+ const StreamDeltaUsageMessage_js_1 = require("../../../../types/StreamDeltaUsageMessage.js");
40
41
  const StreamEndedMessage_js_1 = require("../../../../types/StreamEndedMessage.js");
41
42
  const StreamErrorMessage_js_1 = require("../../../../types/StreamErrorMessage.js");
42
43
  const StreamFactsMessage_js_1 = require("../../../../types/StreamFactsMessage.js");
@@ -47,6 +48,7 @@ exports.StreamSocketResponse = core.serialization.undiscriminatedUnion([
47
48
  StreamTranscriptMessage_js_1.StreamTranscriptMessage,
48
49
  StreamFactsMessage_js_1.StreamFactsMessage,
49
50
  StreamFlushedMessage_js_1.StreamFlushedMessage,
51
+ StreamDeltaUsageMessage_js_1.StreamDeltaUsageMessage,
50
52
  StreamEndedMessage_js_1.StreamEndedMessage,
51
53
  StreamUsageMessage_js_1.StreamUsageMessage,
52
54
  StreamErrorMessage_js_1.StreamErrorMessage,
@@ -3,12 +3,13 @@ import * as core from "../../../../../core/index.js";
3
3
  import type * as serializers from "../../../../index.js";
4
4
  import { TranscribeCommandMessage } from "../../../../types/TranscribeCommandMessage.js";
5
5
  import { TranscribeConfigStatusMessage } from "../../../../types/TranscribeConfigStatusMessage.js";
6
+ import { TranscribeDeltaUsageMessage } from "../../../../types/TranscribeDeltaUsageMessage.js";
6
7
  import { TranscribeEndedMessage } from "../../../../types/TranscribeEndedMessage.js";
7
8
  import { TranscribeErrorMessage } from "../../../../types/TranscribeErrorMessage.js";
8
9
  import { TranscribeFlushedMessage } from "../../../../types/TranscribeFlushedMessage.js";
9
10
  import { TranscribeTranscriptMessage } from "../../../../types/TranscribeTranscriptMessage.js";
10
11
  import { TranscribeUsageMessage } from "../../../../types/TranscribeUsageMessage.js";
11
- export declare const TranscribeSocketResponse: core.serialization.Schema<serializers.TranscribeSocketResponse.Raw, Corti.TranscribeUsageMessage | Corti.TranscribeFlushedMessage | Corti.TranscribeEndedMessage | Corti.TranscribeErrorMessage | Corti.TranscribeTranscriptMessage | Corti.TranscribeCommandMessage | Corti.TranscribeConfigStatusMessage>;
12
+ export declare const TranscribeSocketResponse: core.serialization.Schema<serializers.TranscribeSocketResponse.Raw, Corti.TranscribeUsageMessage | Corti.TranscribeFlushedMessage | Corti.TranscribeDeltaUsageMessage | Corti.TranscribeEndedMessage | Corti.TranscribeErrorMessage | Corti.TranscribeTranscriptMessage | Corti.TranscribeCommandMessage | Corti.TranscribeConfigStatusMessage>;
12
13
  export declare namespace TranscribeSocketResponse {
13
- type Raw = TranscribeUsageMessage.Raw | TranscribeFlushedMessage.Raw | TranscribeEndedMessage.Raw | TranscribeErrorMessage.Raw | TranscribeTranscriptMessage.Raw | TranscribeCommandMessage.Raw | TranscribeConfigStatusMessage.Raw;
14
+ type Raw = TranscribeUsageMessage.Raw | TranscribeFlushedMessage.Raw | TranscribeDeltaUsageMessage.Raw | TranscribeEndedMessage.Raw | TranscribeErrorMessage.Raw | TranscribeTranscriptMessage.Raw | TranscribeCommandMessage.Raw | TranscribeConfigStatusMessage.Raw;
14
15
  }
@@ -38,6 +38,7 @@ exports.TranscribeSocketResponse = void 0;
38
38
  const core = __importStar(require("../../../../../core/index.js"));
39
39
  const TranscribeCommandMessage_js_1 = require("../../../../types/TranscribeCommandMessage.js");
40
40
  const TranscribeConfigStatusMessage_js_1 = require("../../../../types/TranscribeConfigStatusMessage.js");
41
+ const TranscribeDeltaUsageMessage_js_1 = require("../../../../types/TranscribeDeltaUsageMessage.js");
41
42
  const TranscribeEndedMessage_js_1 = require("../../../../types/TranscribeEndedMessage.js");
42
43
  const TranscribeErrorMessage_js_1 = require("../../../../types/TranscribeErrorMessage.js");
43
44
  const TranscribeFlushedMessage_js_1 = require("../../../../types/TranscribeFlushedMessage.js");
@@ -46,6 +47,7 @@ const TranscribeUsageMessage_js_1 = require("../../../../types/TranscribeUsageMe
46
47
  exports.TranscribeSocketResponse = core.serialization.undiscriminatedUnion([
47
48
  TranscribeUsageMessage_js_1.TranscribeUsageMessage,
48
49
  TranscribeFlushedMessage_js_1.TranscribeFlushedMessage,
50
+ TranscribeDeltaUsageMessage_js_1.TranscribeDeltaUsageMessage,
49
51
  TranscribeEndedMessage_js_1.TranscribeEndedMessage,
50
52
  TranscribeErrorMessage_js_1.TranscribeErrorMessage,
51
53
  TranscribeTranscriptMessage_js_1.TranscribeTranscriptMessage,
@@ -3,5 +3,5 @@ import * as core from "../../core/index.js";
3
3
  import type * as serializers from "../index.js";
4
4
  export declare const StreamConfigStatusMessageType: core.serialization.Schema<serializers.StreamConfigStatusMessageType.Raw, Corti.StreamConfigStatusMessageType>;
5
5
  export declare namespace StreamConfigStatusMessageType {
6
- type Raw = "CONFIG_ACCEPTED" | "CONFIG_DENIED" | "CONFIG_MISSING" | "CONFIG_NOT_PROVIDED" | "CONFIG_ALREADY_RECEIVED" | "CONFIG_TIMEOUT";
6
+ type Raw = "CONFIG_ACCEPTED" | "CONFIG_DENIED" | "CONFIG_MISSING" | "CONFIG_NOT_PROVIDED" | "CONFIG_ALREADY_RECEIVED";
7
7
  }
@@ -42,5 +42,4 @@ exports.StreamConfigStatusMessageType = core.serialization.enum_([
42
42
  "CONFIG_MISSING",
43
43
  "CONFIG_NOT_PROVIDED",
44
44
  "CONFIG_ALREADY_RECEIVED",
45
- "CONFIG_TIMEOUT",
46
45
  ]);
@@ -0,0 +1,10 @@
1
+ import type * as Corti from "../../api/index.js";
2
+ import * as core from "../../core/index.js";
3
+ import type * as serializers from "../index.js";
4
+ export declare const StreamDeltaUsageMessage: core.serialization.ObjectSchema<serializers.StreamDeltaUsageMessage.Raw, Corti.StreamDeltaUsageMessage>;
5
+ export declare namespace StreamDeltaUsageMessage {
6
+ interface Raw {
7
+ type: "delta_usage";
8
+ credits: number;
9
+ }
10
+ }
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
+ if (k2 === undefined) k2 = k;
5
+ var desc = Object.getOwnPropertyDescriptor(m, k);
6
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
7
+ desc = { enumerable: true, get: function() { return m[k]; } };
8
+ }
9
+ Object.defineProperty(o, k2, desc);
10
+ }) : (function(o, m, k, k2) {
11
+ if (k2 === undefined) k2 = k;
12
+ o[k2] = m[k];
13
+ }));
14
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
15
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
16
+ }) : function(o, v) {
17
+ o["default"] = v;
18
+ });
19
+ var __importStar = (this && this.__importStar) || (function () {
20
+ var ownKeys = function(o) {
21
+ ownKeys = Object.getOwnPropertyNames || function (o) {
22
+ var ar = [];
23
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
24
+ return ar;
25
+ };
26
+ return ownKeys(o);
27
+ };
28
+ return function (mod) {
29
+ if (mod && mod.__esModule) return mod;
30
+ var result = {};
31
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
32
+ __setModuleDefault(result, mod);
33
+ return result;
34
+ };
35
+ })();
36
+ Object.defineProperty(exports, "__esModule", { value: true });
37
+ exports.StreamDeltaUsageMessage = void 0;
38
+ const core = __importStar(require("../../core/index.js"));
39
+ exports.StreamDeltaUsageMessage = core.serialization.object({
40
+ type: core.serialization.stringLiteral("delta_usage"),
41
+ credits: core.serialization.number(),
42
+ });
@@ -3,5 +3,5 @@ import * as core from "../../core/index.js";
3
3
  import type * as serializers from "../index.js";
4
4
  export declare const TranscribeConfigStatusMessageType: core.serialization.Schema<serializers.TranscribeConfigStatusMessageType.Raw, Corti.TranscribeConfigStatusMessageType>;
5
5
  export declare namespace TranscribeConfigStatusMessageType {
6
- type Raw = "CONFIG_ACCEPTED" | "CONFIG_DENIED" | "CONFIG_TIMEOUT";
6
+ type Raw = "CONFIG_ACCEPTED" | "CONFIG_DENIED" | "CONFIG_TIMEOUT" | "CONFIG_ALREADY_RECEIVED" | "CONFIG_MISSING";
7
7
  }
@@ -36,4 +36,10 @@ var __importStar = (this && this.__importStar) || (function () {
36
36
  Object.defineProperty(exports, "__esModule", { value: true });
37
37
  exports.TranscribeConfigStatusMessageType = void 0;
38
38
  const core = __importStar(require("../../core/index.js"));
39
- exports.TranscribeConfigStatusMessageType = core.serialization.enum_(["CONFIG_ACCEPTED", "CONFIG_DENIED", "CONFIG_TIMEOUT"]);
39
+ exports.TranscribeConfigStatusMessageType = core.serialization.enum_([
40
+ "CONFIG_ACCEPTED",
41
+ "CONFIG_DENIED",
42
+ "CONFIG_TIMEOUT",
43
+ "CONFIG_ALREADY_RECEIVED",
44
+ "CONFIG_MISSING",
45
+ ]);
@@ -0,0 +1,10 @@
1
+ import type * as Corti from "../../api/index.js";
2
+ import * as core from "../../core/index.js";
3
+ import type * as serializers from "../index.js";
4
+ export declare const TranscribeDeltaUsageMessage: core.serialization.ObjectSchema<serializers.TranscribeDeltaUsageMessage.Raw, Corti.TranscribeDeltaUsageMessage>;
5
+ export declare namespace TranscribeDeltaUsageMessage {
6
+ interface Raw {
7
+ type: "delta_usage";
8
+ credits: number;
9
+ }
10
+ }
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
+ if (k2 === undefined) k2 = k;
5
+ var desc = Object.getOwnPropertyDescriptor(m, k);
6
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
7
+ desc = { enumerable: true, get: function() { return m[k]; } };
8
+ }
9
+ Object.defineProperty(o, k2, desc);
10
+ }) : (function(o, m, k, k2) {
11
+ if (k2 === undefined) k2 = k;
12
+ o[k2] = m[k];
13
+ }));
14
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
15
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
16
+ }) : function(o, v) {
17
+ o["default"] = v;
18
+ });
19
+ var __importStar = (this && this.__importStar) || (function () {
20
+ var ownKeys = function(o) {
21
+ ownKeys = Object.getOwnPropertyNames || function (o) {
22
+ var ar = [];
23
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
24
+ return ar;
25
+ };
26
+ return ownKeys(o);
27
+ };
28
+ return function (mod) {
29
+ if (mod && mod.__esModule) return mod;
30
+ var result = {};
31
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
32
+ __setModuleDefault(result, mod);
33
+ return result;
34
+ };
35
+ })();
36
+ Object.defineProperty(exports, "__esModule", { value: true });
37
+ exports.TranscribeDeltaUsageMessage = void 0;
38
+ const core = __importStar(require("../../core/index.js"));
39
+ exports.TranscribeDeltaUsageMessage = core.serialization.object({
40
+ type: core.serialization.stringLiteral("delta_usage"),
41
+ credits: core.serialization.number(),
42
+ });