mitra-interactions-sdk 1.0.64-rc.7 → 1.0.64
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.d.mts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +5 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +5 -3
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -590,6 +590,8 @@ interface GetAgentTaskCreateOptions {
|
|
|
590
590
|
interface GetAgentTaskOpenOptions {
|
|
591
591
|
/** Abre chat existente. Detecta automático se stream está ativo. */
|
|
592
592
|
taskId: string;
|
|
593
|
+
/** Sobrescreve o projectId configurado globalmente. */
|
|
594
|
+
projectId?: number;
|
|
593
595
|
}
|
|
594
596
|
type GetAgentTaskOptions = GetAgentTaskCreateOptions | GetAgentTaskOpenOptions;
|
|
595
597
|
type AgentTaskStatus = 'opening' | 'idle' | 'uploading' | 'streaming' | 'cancelled' | 'error' | 'closed';
|
package/dist/index.d.ts
CHANGED
|
@@ -590,6 +590,8 @@ interface GetAgentTaskCreateOptions {
|
|
|
590
590
|
interface GetAgentTaskOpenOptions {
|
|
591
591
|
/** Abre chat existente. Detecta automático se stream está ativo. */
|
|
592
592
|
taskId: string;
|
|
593
|
+
/** Sobrescreve o projectId configurado globalmente. */
|
|
594
|
+
projectId?: number;
|
|
593
595
|
}
|
|
594
596
|
type GetAgentTaskOptions = GetAgentTaskCreateOptions | GetAgentTaskOpenOptions;
|
|
595
597
|
type AgentTaskStatus = 'opening' | 'idle' | 'uploading' | 'streaming' | 'cancelled' | 'error' | 'closed';
|
package/dist/index.js
CHANGED
|
@@ -942,8 +942,8 @@ var AgentTaskSession = class {
|
|
|
942
942
|
this._transport = transport2;
|
|
943
943
|
this._sessionId = `sess-${++sessionCounter}-${Date.now()}`;
|
|
944
944
|
this._isNew = init.kind === "new";
|
|
945
|
+
this._projectId = init.projectId;
|
|
945
946
|
if (init.kind === "new") {
|
|
946
|
-
this._projectId = init.projectId;
|
|
947
947
|
this._agentType = init.agentType;
|
|
948
948
|
this._modelId = init.modelId;
|
|
949
949
|
this._initialName = init.name;
|
|
@@ -1415,7 +1415,9 @@ function openSocket() {
|
|
|
1415
1415
|
const baseUrl = getWsUrl();
|
|
1416
1416
|
const token = getRawToken();
|
|
1417
1417
|
const separator = baseUrl.includes("?") ? "&" : "?";
|
|
1418
|
-
const
|
|
1418
|
+
const projectId = inferProjectId();
|
|
1419
|
+
const escopo = projectId != null ? `&projectId=${encodeURIComponent(projectId)}` : "";
|
|
1420
|
+
const url = `${baseUrl}${separator}token=${encodeURIComponent(token)}${escopo}`;
|
|
1419
1421
|
return new Promise((resolve, reject) => {
|
|
1420
1422
|
const socket = new WebSocket(url);
|
|
1421
1423
|
let opened = false;
|
|
@@ -1641,7 +1643,7 @@ function getAgentTaskMitra(options) {
|
|
|
1641
1643
|
const cached = sessionsByTaskId.get(options.taskId);
|
|
1642
1644
|
if (cached) return cached;
|
|
1643
1645
|
return new AgentTaskSession(
|
|
1644
|
-
{ kind: "existing", taskId: options.taskId },
|
|
1646
|
+
{ kind: "existing", taskId: options.taskId, projectId: inferProjectId(options.projectId) },
|
|
1645
1647
|
transport
|
|
1646
1648
|
);
|
|
1647
1649
|
}
|