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