mitra-interactions-sdk 1.0.60-beta.36 → 1.0.60-beta.38
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/index.js +11 -12
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +11 -12
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -868,6 +868,7 @@ var AgentTaskSession = class {
|
|
|
868
868
|
// ── Eventos do stream (WsOutboundMessage { type, payload, timestamp }) ──
|
|
869
869
|
_handleWsEvent(msg) {
|
|
870
870
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
871
|
+
if (!msg || typeof msg.type !== "string" || !msg.type) return;
|
|
871
872
|
const { type, payload } = msg;
|
|
872
873
|
switch (type) {
|
|
873
874
|
case "textDelta": {
|
|
@@ -1148,8 +1149,6 @@ function providerParam(target) {
|
|
|
1148
1149
|
async function manageAgentCredentialMitra(options) {
|
|
1149
1150
|
var _a, _b, _c;
|
|
1150
1151
|
const projectId = resolveProjectId(options.projectId);
|
|
1151
|
-
const connectionId = options.connectionId;
|
|
1152
|
-
const withConn = (body) => connectionId ? { ...body, connectionId } : body;
|
|
1153
1152
|
const target = options.target;
|
|
1154
1153
|
if ((options.action === "auth" || options.action === "connect") && target !== "anthropic") {
|
|
1155
1154
|
throw new Error(`manageAgentCredentialMitra(${options.action}): OAuth \xE9 exclusivo do provider 'anthropic'. Pra OpenAI use o device flow (device_auth/device_poll).`);
|
|
@@ -1168,11 +1167,11 @@ async function manageAgentCredentialMitra(options) {
|
|
|
1168
1167
|
}
|
|
1169
1168
|
case "save": {
|
|
1170
1169
|
if (!((_c = options.key) == null ? void 0 : _c.trim())) throw new Error("manageAgentCredentialMitra(save): key obrigat\xF3ria.");
|
|
1171
|
-
await http.post("/agentAiShortcut/saveCredential",
|
|
1170
|
+
await http.post("/agentAiShortcut/saveCredential", {
|
|
1172
1171
|
projectId,
|
|
1173
1172
|
provider: providerParam(options.target),
|
|
1174
1173
|
key: options.key
|
|
1175
|
-
})
|
|
1174
|
+
});
|
|
1176
1175
|
return;
|
|
1177
1176
|
}
|
|
1178
1177
|
case "remove": {
|
|
@@ -1183,40 +1182,40 @@ async function manageAgentCredentialMitra(options) {
|
|
|
1183
1182
|
return;
|
|
1184
1183
|
}
|
|
1185
1184
|
case "auth": {
|
|
1186
|
-
const env = await http.post("/agentAiShortcut/oauthStart",
|
|
1185
|
+
const env = await http.post("/agentAiShortcut/oauthStart", {
|
|
1187
1186
|
projectId,
|
|
1188
1187
|
provider: providerParam(options.target)
|
|
1189
|
-
})
|
|
1188
|
+
});
|
|
1190
1189
|
return env.result;
|
|
1191
1190
|
}
|
|
1192
1191
|
case "connect": {
|
|
1193
1192
|
if (!options.code || !options.state) {
|
|
1194
1193
|
throw new Error("manageAgentCredentialMitra(connect): code e state obrigat\xF3rios.");
|
|
1195
1194
|
}
|
|
1196
|
-
const env = await http.post("/agentAiShortcut/oauthExchange",
|
|
1195
|
+
const env = await http.post("/agentAiShortcut/oauthExchange", {
|
|
1197
1196
|
projectId,
|
|
1198
1197
|
provider: providerParam(options.target),
|
|
1199
1198
|
code: options.code,
|
|
1200
1199
|
state: options.state
|
|
1201
|
-
})
|
|
1200
|
+
});
|
|
1202
1201
|
return env.result;
|
|
1203
1202
|
}
|
|
1204
1203
|
case "device_auth": {
|
|
1205
|
-
const env = await http.post("/agentAiShortcut/deviceStart",
|
|
1204
|
+
const env = await http.post("/agentAiShortcut/deviceStart", {
|
|
1206
1205
|
projectId,
|
|
1207
1206
|
provider: providerParam(options.target)
|
|
1208
|
-
})
|
|
1207
|
+
});
|
|
1209
1208
|
return env.result;
|
|
1210
1209
|
}
|
|
1211
1210
|
case "device_poll": {
|
|
1212
1211
|
if (!options.deviceAuthId) {
|
|
1213
1212
|
throw new Error("manageAgentCredentialMitra(device_poll): deviceAuthId obrigat\xF3rio.");
|
|
1214
1213
|
}
|
|
1215
|
-
const env = await http.post("/agentAiShortcut/devicePoll",
|
|
1214
|
+
const env = await http.post("/agentAiShortcut/devicePoll", {
|
|
1216
1215
|
projectId,
|
|
1217
1216
|
provider: providerParam(options.target),
|
|
1218
1217
|
deviceAuthId: options.deviceAuthId
|
|
1219
|
-
})
|
|
1218
|
+
});
|
|
1220
1219
|
return env.result;
|
|
1221
1220
|
}
|
|
1222
1221
|
default:
|