@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.cjs
CHANGED
|
@@ -687,15 +687,19 @@ var ExecutionStreamControllerImpl = class {
|
|
|
687
687
|
*/
|
|
688
688
|
async connectSSE() {
|
|
689
689
|
const url = `${this.options.baseUrl}/agents/runs/${this.options.executionId}/stream`;
|
|
690
|
+
let authToken = this.options.apiKey;
|
|
691
|
+
if (!authToken && this.options.tokenProvider) {
|
|
692
|
+
authToken = await this.options.tokenProvider();
|
|
693
|
+
}
|
|
690
694
|
console.log("[SDK:StreamController] Connecting to SSE");
|
|
691
695
|
console.log("[SDK:StreamController] URL:", url);
|
|
692
696
|
console.log("[SDK:StreamController] baseUrl:", this.options.baseUrl);
|
|
693
697
|
console.log("[SDK:StreamController] executionId:", this.options.executionId);
|
|
694
698
|
console.log("[SDK:StreamController] orgId:", this.options.orgId);
|
|
695
|
-
console.log("[SDK:StreamController] apiKey:",
|
|
699
|
+
console.log("[SDK:StreamController] apiKey:", authToken ? `${authToken.substring(0, 20)}...` : "MISSING");
|
|
696
700
|
this.sseClient = new SSEClient({
|
|
697
701
|
url,
|
|
698
|
-
authHeader: `Bearer ${
|
|
702
|
+
authHeader: `Bearer ${authToken}`,
|
|
699
703
|
orgId: this.options.orgId,
|
|
700
704
|
onEvent: (event) => this.handleEvent(event),
|
|
701
705
|
onError: (error) => {
|
|
@@ -1096,13 +1100,11 @@ var AgentsAPI = class extends BaseResourceAPI {
|
|
|
1096
1100
|
return this.httpPost(
|
|
1097
1101
|
`/${uuid}/execute`,
|
|
1098
1102
|
{
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
},
|
|
1105
|
-
options: input.options
|
|
1103
|
+
task: input.task,
|
|
1104
|
+
context: input.context ?? {},
|
|
1105
|
+
attachmentIds: input.attachmentIds,
|
|
1106
|
+
options: input.options,
|
|
1107
|
+
...input.teamUuid ? { teamUuid: input.teamUuid } : {}
|
|
1106
1108
|
},
|
|
1107
1109
|
{ idempotencyKey }
|
|
1108
1110
|
);
|
|
@@ -1166,6 +1168,7 @@ var AgentsAPI = class extends BaseResourceAPI {
|
|
|
1166
1168
|
sessionId,
|
|
1167
1169
|
baseUrl: config.baseUrl,
|
|
1168
1170
|
apiKey: config.apiKey,
|
|
1171
|
+
tokenProvider: config.tokenProvider,
|
|
1169
1172
|
orgId: config.orgId,
|
|
1170
1173
|
getExecution: (id) => this.getExecution(id)
|
|
1171
1174
|
});
|
|
@@ -1211,6 +1214,7 @@ var AgentsAPI = class extends BaseResourceAPI {
|
|
|
1211
1214
|
sessionId,
|
|
1212
1215
|
baseUrl: config.baseUrl,
|
|
1213
1216
|
apiKey: config.apiKey,
|
|
1217
|
+
tokenProvider: config.tokenProvider,
|
|
1214
1218
|
orgId: config.orgId,
|
|
1215
1219
|
getExecution: (id) => this.getExecution(id)
|
|
1216
1220
|
});
|
|
@@ -2107,6 +2111,7 @@ var AISaaSClient = class {
|
|
|
2107
2111
|
baseUrl: this.config.baseUrl,
|
|
2108
2112
|
apiKey: this.config.apiKey,
|
|
2109
2113
|
token: this.config.token,
|
|
2114
|
+
tokenProvider: this.config.tokenProvider,
|
|
2110
2115
|
orgId: this.config.orgId
|
|
2111
2116
|
});
|
|
2112
2117
|
this.agents = new AgentsAPI(this.httpClient, getStreamConfig);
|