@cadraos/sdk 0.1.3 → 0.1.4
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/dist/chat/index.cjs +2874 -102
- package/dist/chat/index.cjs.map +1 -1
- package/dist/chat/index.d.cts +2616 -478
- package/dist/chat/index.d.ts +2616 -478
- package/dist/chat/index.js +2874 -102
- package/dist/chat/index.js.map +1 -1
- package/dist/index.cjs +14 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +5 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +14 -9
- package/dist/index.js.map +1 -1
- package/package.json +10 -6
package/dist/index.d.cts
CHANGED
|
@@ -178,6 +178,8 @@ interface ExecuteInput {
|
|
|
178
178
|
context?: Record<string, unknown>;
|
|
179
179
|
/** Attachment UUIDs to include with the message (for images, documents, etc.) */
|
|
180
180
|
attachmentIds?: string[];
|
|
181
|
+
/** Team UUID for team-based execution (routes to team's lead orchestrator) */
|
|
182
|
+
teamUuid?: string;
|
|
181
183
|
/** Execution options */
|
|
182
184
|
options?: ExecuteOptions;
|
|
183
185
|
}
|
|
@@ -1073,6 +1075,8 @@ interface ExecutionStreamControllerOptions {
|
|
|
1073
1075
|
baseUrl: string;
|
|
1074
1076
|
/** API key or token */
|
|
1075
1077
|
apiKey?: string;
|
|
1078
|
+
/** Token provider callback for dynamic auth */
|
|
1079
|
+
tokenProvider?: () => Promise<string>;
|
|
1076
1080
|
/** Organization ID */
|
|
1077
1081
|
orgId: number;
|
|
1078
1082
|
/** Function to get execution status (for polling fallback) */
|
|
@@ -1298,6 +1302,7 @@ interface StreamConfig {
|
|
|
1298
1302
|
baseUrl: string;
|
|
1299
1303
|
apiKey?: string;
|
|
1300
1304
|
token?: string;
|
|
1305
|
+
tokenProvider?: () => Promise<string>;
|
|
1301
1306
|
orgId: number;
|
|
1302
1307
|
}
|
|
1303
1308
|
|
package/dist/index.d.ts
CHANGED
|
@@ -178,6 +178,8 @@ interface ExecuteInput {
|
|
|
178
178
|
context?: Record<string, unknown>;
|
|
179
179
|
/** Attachment UUIDs to include with the message (for images, documents, etc.) */
|
|
180
180
|
attachmentIds?: string[];
|
|
181
|
+
/** Team UUID for team-based execution (routes to team's lead orchestrator) */
|
|
182
|
+
teamUuid?: string;
|
|
181
183
|
/** Execution options */
|
|
182
184
|
options?: ExecuteOptions;
|
|
183
185
|
}
|
|
@@ -1073,6 +1075,8 @@ interface ExecutionStreamControllerOptions {
|
|
|
1073
1075
|
baseUrl: string;
|
|
1074
1076
|
/** API key or token */
|
|
1075
1077
|
apiKey?: string;
|
|
1078
|
+
/** Token provider callback for dynamic auth */
|
|
1079
|
+
tokenProvider?: () => Promise<string>;
|
|
1076
1080
|
/** Organization ID */
|
|
1077
1081
|
orgId: number;
|
|
1078
1082
|
/** Function to get execution status (for polling fallback) */
|
|
@@ -1298,6 +1302,7 @@ interface StreamConfig {
|
|
|
1298
1302
|
baseUrl: string;
|
|
1299
1303
|
apiKey?: string;
|
|
1300
1304
|
token?: string;
|
|
1305
|
+
tokenProvider?: () => Promise<string>;
|
|
1301
1306
|
orgId: number;
|
|
1302
1307
|
}
|
|
1303
1308
|
|
package/dist/index.js
CHANGED
|
@@ -685,15 +685,19 @@ var ExecutionStreamControllerImpl = class {
|
|
|
685
685
|
*/
|
|
686
686
|
async connectSSE() {
|
|
687
687
|
const url = `${this.options.baseUrl}/agents/runs/${this.options.executionId}/stream`;
|
|
688
|
+
let authToken = this.options.apiKey;
|
|
689
|
+
if (!authToken && this.options.tokenProvider) {
|
|
690
|
+
authToken = await this.options.tokenProvider();
|
|
691
|
+
}
|
|
688
692
|
console.log("[SDK:StreamController] Connecting to SSE");
|
|
689
693
|
console.log("[SDK:StreamController] URL:", url);
|
|
690
694
|
console.log("[SDK:StreamController] baseUrl:", this.options.baseUrl);
|
|
691
695
|
console.log("[SDK:StreamController] executionId:", this.options.executionId);
|
|
692
696
|
console.log("[SDK:StreamController] orgId:", this.options.orgId);
|
|
693
|
-
console.log("[SDK:StreamController] apiKey:",
|
|
697
|
+
console.log("[SDK:StreamController] apiKey:", authToken ? `${authToken.substring(0, 20)}...` : "MISSING");
|
|
694
698
|
this.sseClient = new SSEClient({
|
|
695
699
|
url,
|
|
696
|
-
authHeader: `Bearer ${
|
|
700
|
+
authHeader: `Bearer ${authToken}`,
|
|
697
701
|
orgId: this.options.orgId,
|
|
698
702
|
onEvent: (event) => this.handleEvent(event),
|
|
699
703
|
onError: (error) => {
|
|
@@ -1094,13 +1098,11 @@ var AgentsAPI = class extends BaseResourceAPI {
|
|
|
1094
1098
|
return this.httpPost(
|
|
1095
1099
|
`/${uuid}/execute`,
|
|
1096
1100
|
{
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
},
|
|
1103
|
-
options: input.options
|
|
1101
|
+
task: input.task,
|
|
1102
|
+
context: input.context ?? {},
|
|
1103
|
+
attachmentIds: input.attachmentIds,
|
|
1104
|
+
options: input.options,
|
|
1105
|
+
...input.teamUuid ? { teamUuid: input.teamUuid } : {}
|
|
1104
1106
|
},
|
|
1105
1107
|
{ idempotencyKey }
|
|
1106
1108
|
);
|
|
@@ -1164,6 +1166,7 @@ var AgentsAPI = class extends BaseResourceAPI {
|
|
|
1164
1166
|
sessionId,
|
|
1165
1167
|
baseUrl: config.baseUrl,
|
|
1166
1168
|
apiKey: config.apiKey,
|
|
1169
|
+
tokenProvider: config.tokenProvider,
|
|
1167
1170
|
orgId: config.orgId,
|
|
1168
1171
|
getExecution: (id) => this.getExecution(id)
|
|
1169
1172
|
});
|
|
@@ -1209,6 +1212,7 @@ var AgentsAPI = class extends BaseResourceAPI {
|
|
|
1209
1212
|
sessionId,
|
|
1210
1213
|
baseUrl: config.baseUrl,
|
|
1211
1214
|
apiKey: config.apiKey,
|
|
1215
|
+
tokenProvider: config.tokenProvider,
|
|
1212
1216
|
orgId: config.orgId,
|
|
1213
1217
|
getExecution: (id) => this.getExecution(id)
|
|
1214
1218
|
});
|
|
@@ -2105,6 +2109,7 @@ var AISaaSClient = class {
|
|
|
2105
2109
|
baseUrl: this.config.baseUrl,
|
|
2106
2110
|
apiKey: this.config.apiKey,
|
|
2107
2111
|
token: this.config.token,
|
|
2112
|
+
tokenProvider: this.config.tokenProvider,
|
|
2108
2113
|
orgId: this.config.orgId
|
|
2109
2114
|
});
|
|
2110
2115
|
this.agents = new AgentsAPI(this.httpClient, getStreamConfig);
|