@arbidocs/sdk 0.4.20 → 0.4.29
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/{browser-DY8mQOdF.d.cts → browser-AwN8DBBO.d.cts} +556 -45
- package/dist/{browser-DY8mQOdF.d.ts → browser-AwN8DBBO.d.ts} +556 -45
- package/dist/browser.cjs +227 -70
- package/dist/browser.cjs.map +1 -1
- package/dist/browser.d.cts +1 -1
- package/dist/browser.d.ts +1 -1
- package/dist/browser.js +227 -70
- package/dist/browser.js.map +1 -1
- package/dist/index.cjs +233 -71
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -335
- package/dist/index.d.ts +4 -335
- package/dist/index.js +233 -71
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -3505,19 +3505,21 @@ function apiErrorDetail(apiError) {
|
|
|
3505
3505
|
return detailText(body.detail) || (typeof body.message === "string" ? body.message : void 0);
|
|
3506
3506
|
}
|
|
3507
3507
|
var ArbiApiError = class extends ArbiError {
|
|
3508
|
+
status;
|
|
3508
3509
|
apiError;
|
|
3509
3510
|
/** Why the server refused, in its words (e.g. "run_at must be in the future"), when it said. */
|
|
3510
3511
|
detail;
|
|
3511
|
-
constructor(message, apiError) {
|
|
3512
|
+
constructor(message, apiError, status) {
|
|
3512
3513
|
super(message);
|
|
3513
3514
|
this.name = "ArbiApiError";
|
|
3514
3515
|
this.apiError = apiError;
|
|
3516
|
+
this.status = status;
|
|
3515
3517
|
this.detail = apiErrorDetail(apiError);
|
|
3516
3518
|
}
|
|
3517
3519
|
};
|
|
3518
3520
|
function requireData(result, message) {
|
|
3519
3521
|
if (result.error || !result.data) {
|
|
3520
|
-
throw new ArbiApiError(message, result.error);
|
|
3522
|
+
throw new ArbiApiError(message, result.error, result.response?.status);
|
|
3521
3523
|
}
|
|
3522
3524
|
return result.data;
|
|
3523
3525
|
}
|
|
@@ -5413,6 +5415,7 @@ __export(assistant_exports, {
|
|
|
5413
5415
|
buildRetrievalChunkTool: () => buildRetrievalChunkTool,
|
|
5414
5416
|
buildRetrievalFullContextTool: () => buildRetrievalFullContextTool,
|
|
5415
5417
|
buildRetrievalTocTool: () => buildRetrievalTocTool,
|
|
5418
|
+
cancelAssistantRun: () => cancelAssistantRun,
|
|
5416
5419
|
filterSkills: () => filterSkills,
|
|
5417
5420
|
listCommands: () => listCommands,
|
|
5418
5421
|
listSkills: () => listSkills,
|
|
@@ -5483,18 +5486,35 @@ async function retrieve(options) {
|
|
|
5483
5486
|
return data;
|
|
5484
5487
|
}
|
|
5485
5488
|
async function queryAssistant(options) {
|
|
5486
|
-
const {
|
|
5489
|
+
const {
|
|
5490
|
+
workspaceId,
|
|
5491
|
+
question,
|
|
5492
|
+
docIds,
|
|
5493
|
+
previousResponseId,
|
|
5494
|
+
conversationId,
|
|
5495
|
+
assistantMode,
|
|
5496
|
+
agentId,
|
|
5497
|
+
model,
|
|
5498
|
+
mentions,
|
|
5499
|
+
signal,
|
|
5500
|
+
activeArtifactExtId,
|
|
5501
|
+
...auth
|
|
5502
|
+
} = options;
|
|
5487
5503
|
const body = {
|
|
5488
5504
|
input: question,
|
|
5505
|
+
...activeArtifactExtId ? { active_artifact_ext_id: activeArtifactExtId } : {},
|
|
5489
5506
|
workspace_ext_id: workspaceId,
|
|
5507
|
+
...agentId ? { agent_ext_id: agentId } : {},
|
|
5490
5508
|
stream: true,
|
|
5491
5509
|
background: false,
|
|
5492
5510
|
store: true,
|
|
5493
|
-
tools: {
|
|
5511
|
+
tools: agentId ? {} : {
|
|
5494
5512
|
retrieval_chunk: buildRetrievalChunkTool(docIds),
|
|
5495
5513
|
retrieval_full_context: buildRetrievalFullContextTool([])
|
|
5496
5514
|
},
|
|
5497
5515
|
...previousResponseId ? { previous_response_id: previousResponseId } : {},
|
|
5516
|
+
...conversationId ? { conversation_ext_id: conversationId } : {},
|
|
5517
|
+
...assistantMode ? { assistant_mode: assistantMode } : {},
|
|
5498
5518
|
...model ? { model } : {},
|
|
5499
5519
|
...mentions && mentions.length > 0 ? { mentions } : {}
|
|
5500
5520
|
};
|
|
@@ -5556,6 +5576,91 @@ function filterSkills(items, query, pinned = []) {
|
|
|
5556
5576
|
});
|
|
5557
5577
|
return matched;
|
|
5558
5578
|
}
|
|
5579
|
+
async function cancelAssistantRun(auth, responseId) {
|
|
5580
|
+
await authenticatedFetch({
|
|
5581
|
+
...auth,
|
|
5582
|
+
path: `/v1/assistant/run/${encodeURIComponent(responseId)}/cancel`,
|
|
5583
|
+
method: "POST"
|
|
5584
|
+
});
|
|
5585
|
+
}
|
|
5586
|
+
|
|
5587
|
+
// src/operations/responses.ts
|
|
5588
|
+
var responses_exports = {};
|
|
5589
|
+
__export(responses_exports, {
|
|
5590
|
+
extractResponseText: () => extractResponseText,
|
|
5591
|
+
getResponse: () => getResponse,
|
|
5592
|
+
submitBackgroundQuery: () => submitBackgroundQuery
|
|
5593
|
+
});
|
|
5594
|
+
async function submitBackgroundQuery(options) {
|
|
5595
|
+
const {
|
|
5596
|
+
workspaceId,
|
|
5597
|
+
question,
|
|
5598
|
+
docIds,
|
|
5599
|
+
previousResponseId,
|
|
5600
|
+
model,
|
|
5601
|
+
task,
|
|
5602
|
+
conversationId,
|
|
5603
|
+
mentions,
|
|
5604
|
+
activeArtifactExtId,
|
|
5605
|
+
...auth
|
|
5606
|
+
} = options;
|
|
5607
|
+
const tools = {};
|
|
5608
|
+
if (docIds.length > 0) {
|
|
5609
|
+
tools.retrieval_chunk = {
|
|
5610
|
+
name: "retrieval_chunk",
|
|
5611
|
+
description: "retrieval chunk",
|
|
5612
|
+
tool_args: { doc_ext_ids: docIds },
|
|
5613
|
+
tool_responses: {}
|
|
5614
|
+
};
|
|
5615
|
+
tools.retrieval_full_context = {
|
|
5616
|
+
name: "retrieval_full_context",
|
|
5617
|
+
description: "retrieval full context",
|
|
5618
|
+
tool_args: { doc_ext_ids: docIds },
|
|
5619
|
+
tool_responses: {}
|
|
5620
|
+
};
|
|
5621
|
+
}
|
|
5622
|
+
const body = {
|
|
5623
|
+
input: question,
|
|
5624
|
+
workspace_ext_id: workspaceId,
|
|
5625
|
+
stream: false,
|
|
5626
|
+
background: true,
|
|
5627
|
+
store: true,
|
|
5628
|
+
tools,
|
|
5629
|
+
...task !== void 0 ? { task } : {},
|
|
5630
|
+
...conversationId ? { conversation_ext_id: conversationId } : {},
|
|
5631
|
+
...mentions !== void 0 ? { mentions } : {},
|
|
5632
|
+
...activeArtifactExtId ? { active_artifact_ext_id: activeArtifactExtId } : {},
|
|
5633
|
+
...previousResponseId ? { previous_response_id: previousResponseId } : {},
|
|
5634
|
+
...model ? { model } : {}
|
|
5635
|
+
};
|
|
5636
|
+
const res = await authenticatedFetch({
|
|
5637
|
+
...auth,
|
|
5638
|
+
path: "/v1/responses",
|
|
5639
|
+
method: "POST",
|
|
5640
|
+
body: JSON.stringify(body),
|
|
5641
|
+
headers: { "Content-Type": "application/json" }
|
|
5642
|
+
});
|
|
5643
|
+
return await res.json();
|
|
5644
|
+
}
|
|
5645
|
+
async function getResponse(auth, responseId) {
|
|
5646
|
+
const res = await authenticatedFetch({
|
|
5647
|
+
...auth,
|
|
5648
|
+
path: `/v1/responses/${responseId}`,
|
|
5649
|
+
method: "GET"
|
|
5650
|
+
});
|
|
5651
|
+
return await res.json();
|
|
5652
|
+
}
|
|
5653
|
+
function extractResponseText(response) {
|
|
5654
|
+
const parts = [];
|
|
5655
|
+
for (const msg of response.output) {
|
|
5656
|
+
for (const item of msg.content) {
|
|
5657
|
+
if ("type" in item && item.type === "output_text" && "text" in item) {
|
|
5658
|
+
parts.push(item.text);
|
|
5659
|
+
}
|
|
5660
|
+
}
|
|
5661
|
+
}
|
|
5662
|
+
return parts.join("");
|
|
5663
|
+
}
|
|
5559
5664
|
|
|
5560
5665
|
// src/operations/tags.ts
|
|
5561
5666
|
var tags_exports = {};
|
|
@@ -5700,12 +5805,17 @@ __export(dm_exports, {
|
|
|
5700
5805
|
var agents_exports = {};
|
|
5701
5806
|
__export(agents_exports, {
|
|
5702
5807
|
authorizeAgent: () => authorizeAgent,
|
|
5808
|
+
closeAgentSession: () => closeAgentSession,
|
|
5703
5809
|
createAgent: () => createAgent,
|
|
5704
5810
|
deleteAgents: () => deleteAgents,
|
|
5705
5811
|
getAgentConfig: () => getAgentConfig,
|
|
5812
|
+
getAgentSession: () => getAgentSession,
|
|
5706
5813
|
getAuthorizeLimits: () => getAuthorizeLimits,
|
|
5814
|
+
listAgentChats: () => listAgentChats,
|
|
5707
5815
|
listAgentWorkspaces: () => listAgentWorkspaces,
|
|
5708
|
-
listAgents: () => listAgents
|
|
5816
|
+
listAgents: () => listAgents,
|
|
5817
|
+
stageAgentFile: () => stageAgentFile,
|
|
5818
|
+
startAgentSession: () => startAgentSession
|
|
5709
5819
|
});
|
|
5710
5820
|
async function listAgents(arbi) {
|
|
5711
5821
|
return requireData(await arbi.fetch.GET("/v1/agents"), "Failed to fetch agents");
|
|
@@ -5753,6 +5863,48 @@ async function getAuthorizeLimits(arbi) {
|
|
|
5753
5863
|
"Failed to fetch authorize limits"
|
|
5754
5864
|
);
|
|
5755
5865
|
}
|
|
5866
|
+
async function getAgentSession(arbi, agentId) {
|
|
5867
|
+
return requireData(
|
|
5868
|
+
await arbi.fetch.GET("/v1/agents/{agent_ext_id}/session", {
|
|
5869
|
+
params: { path: { agent_ext_id: agentId } }
|
|
5870
|
+
}),
|
|
5871
|
+
"Failed to read agent session"
|
|
5872
|
+
);
|
|
5873
|
+
}
|
|
5874
|
+
async function startAgentSession(arbi, agentId, workspaceId) {
|
|
5875
|
+
return requireData(
|
|
5876
|
+
await arbi.fetch.POST("/v1/agents/{agent_ext_id}/session", {
|
|
5877
|
+
params: { path: { agent_ext_id: agentId } },
|
|
5878
|
+
body: { workspace_ext_id: workspaceId ?? null }
|
|
5879
|
+
}),
|
|
5880
|
+
"Failed to start agent session"
|
|
5881
|
+
);
|
|
5882
|
+
}
|
|
5883
|
+
async function closeAgentSession(arbi, agentId) {
|
|
5884
|
+
const { error } = await arbi.fetch.DELETE("/v1/agents/{agent_ext_id}/session", {
|
|
5885
|
+
params: { path: { agent_ext_id: agentId } }
|
|
5886
|
+
});
|
|
5887
|
+
if (error) throw new Error("Failed to close agent session");
|
|
5888
|
+
}
|
|
5889
|
+
async function listAgentChats(arbi, agentId) {
|
|
5890
|
+
return requireData(
|
|
5891
|
+
await arbi.fetch.GET("/v1/agents/{agent_ext_id}/chats", {
|
|
5892
|
+
params: { path: { agent_ext_id: agentId } }
|
|
5893
|
+
}),
|
|
5894
|
+
"Failed to read agent chats"
|
|
5895
|
+
);
|
|
5896
|
+
}
|
|
5897
|
+
async function stageAgentFile(auth, agentId, file, name) {
|
|
5898
|
+
const body = new FormData();
|
|
5899
|
+
body.append("file", file, name);
|
|
5900
|
+
const response = await authenticatedFetch({
|
|
5901
|
+
...auth,
|
|
5902
|
+
path: `/v1/agents/${encodeURIComponent(agentId)}/files`,
|
|
5903
|
+
method: "POST",
|
|
5904
|
+
body
|
|
5905
|
+
});
|
|
5906
|
+
return response.json();
|
|
5907
|
+
}
|
|
5756
5908
|
|
|
5757
5909
|
// src/operations/dm.ts
|
|
5758
5910
|
function createDmCryptoContext(arbi, signingPrivateKeyBytes, userExtId) {
|
|
@@ -5862,7 +6014,9 @@ async function sendEncryptedDM(arbi, messages, crypto) {
|
|
|
5862
6014
|
}))
|
|
5863
6015
|
);
|
|
5864
6016
|
const created = requireData(
|
|
5865
|
-
await arbi.fetch.POST("/v1/notifications/", {
|
|
6017
|
+
await arbi.fetch.POST("/v1/notifications/", {
|
|
6018
|
+
body: { messages: encrypted, context_only: false }
|
|
6019
|
+
}),
|
|
5866
6020
|
"Failed to send message"
|
|
5867
6021
|
);
|
|
5868
6022
|
return created.map((n2) => ({
|
|
@@ -5895,7 +6049,7 @@ async function requestWorkspaceAccess(arbi, params, crypto) {
|
|
|
5895
6049
|
async function sendDM(arbi, messages) {
|
|
5896
6050
|
return requireData(
|
|
5897
6051
|
await arbi.fetch.POST("/v1/notifications/", {
|
|
5898
|
-
body: { messages }
|
|
6052
|
+
body: { messages, context_only: false }
|
|
5899
6053
|
}),
|
|
5900
6054
|
"Failed to send message"
|
|
5901
6055
|
);
|
|
@@ -6460,6 +6614,18 @@ var Arbi = class {
|
|
|
6460
6614
|
this.loginResult = await client.auth.loginWithKey({ email, signingPrivateKey });
|
|
6461
6615
|
this.userProfile = this.loginResult.profile ?? null;
|
|
6462
6616
|
}
|
|
6617
|
+
/** Recover browser authentication using the encrypted signing key already in IndexedDB. */
|
|
6618
|
+
async restoreSession(email) {
|
|
6619
|
+
const client = await this.init();
|
|
6620
|
+
const saved = await client.storage.getSession();
|
|
6621
|
+
if (!saved?.signingPrivateKey) return false;
|
|
6622
|
+
this.loginResult = await client.auth.loginWithKey({
|
|
6623
|
+
email,
|
|
6624
|
+
signingPrivateKey: saved.signingPrivateKey
|
|
6625
|
+
});
|
|
6626
|
+
this.userProfile = this.loginResult.profile ?? null;
|
|
6627
|
+
return true;
|
|
6628
|
+
}
|
|
6463
6629
|
/** A workspace's key, sealed to the caller's own session (what `/open` and `POST /workspace/users` take). */
|
|
6464
6630
|
async sealWorkspaceKey(workspaceId) {
|
|
6465
6631
|
const client = this.requireClient();
|
|
@@ -6871,22 +7037,76 @@ var Arbi = class {
|
|
|
6871
7037
|
assistantMode
|
|
6872
7038
|
)
|
|
6873
7039
|
};
|
|
7040
|
+
/** Persisted notifications also arrive on the normal workspace WebSocket. */
|
|
7041
|
+
notifications = {
|
|
7042
|
+
list: async (type) => {
|
|
7043
|
+
const { data, error } = await this.requireClient().fetch.GET("/v1/notifications/", {
|
|
7044
|
+
params: { query: { ...type ? { type } : {}, limit: 100 } }
|
|
7045
|
+
});
|
|
7046
|
+
if (error) throw new ArbiError("Could not load notifications");
|
|
7047
|
+
return data || [];
|
|
7048
|
+
},
|
|
7049
|
+
markRead: async (ids) => {
|
|
7050
|
+
if (!ids.length) return;
|
|
7051
|
+
const { error } = await this.requireClient().fetch.PATCH("/v1/notifications/", {
|
|
7052
|
+
body: { updates: ids.map((external_id) => ({ external_id, read: true })) }
|
|
7053
|
+
});
|
|
7054
|
+
if (error) throw new ArbiError("Could not mark notifications read");
|
|
7055
|
+
}
|
|
7056
|
+
};
|
|
7057
|
+
/** Authenticated native Word transport, with normal session recovery. */
|
|
7058
|
+
editor = {
|
|
7059
|
+
request: (path3, options = {}) => this.recovering(async () => {
|
|
7060
|
+
const { baseUrl, accessToken } = this.getAuthHeaders();
|
|
7061
|
+
const headers = new Headers(options.headers);
|
|
7062
|
+
headers.set("Authorization", `Bearer ${accessToken}`);
|
|
7063
|
+
const response = await fetch(`${baseUrl}/v1/editor${path3}`, { ...options, headers });
|
|
7064
|
+
if (!response.ok) {
|
|
7065
|
+
const body = await response.json().catch(() => null);
|
|
7066
|
+
throw new ArbiApiError(body?.detail || `Document request failed (${response.status})`, {
|
|
7067
|
+
status: response.status,
|
|
7068
|
+
statusText: response.statusText
|
|
7069
|
+
});
|
|
7070
|
+
}
|
|
7071
|
+
return response;
|
|
7072
|
+
})
|
|
7073
|
+
};
|
|
6874
7074
|
// ── Assistant ─────────────────────────────────────────────────────────
|
|
6875
7075
|
assistant = {
|
|
7076
|
+
cancelRun: (responseId) => this.recovering(() => cancelAssistantRun(this.getAuthHeaders(), responseId)),
|
|
7077
|
+
/** Start a durable background turn; task options make its thread a reviewable work item. */
|
|
7078
|
+
submit: (question, options) => {
|
|
7079
|
+
const workspaceId = this.requireWorkspace();
|
|
7080
|
+
return this.recovering(
|
|
7081
|
+
() => submitBackgroundQuery({
|
|
7082
|
+
...this.getAuthHeaders(),
|
|
7083
|
+
...options,
|
|
7084
|
+
workspaceId,
|
|
7085
|
+
question
|
|
7086
|
+
})
|
|
7087
|
+
);
|
|
7088
|
+
},
|
|
7089
|
+
/** Read the status of a background turn. */
|
|
7090
|
+
getResponse: (id) => this.recovering(() => getResponse(this.getAuthHeaders(), id)),
|
|
6876
7091
|
/**
|
|
6877
7092
|
* Send a question to the RAG assistant with streaming support.
|
|
6878
7093
|
* Returns the accumulated result after the stream completes.
|
|
6879
7094
|
*/
|
|
6880
7095
|
query: async (question, options) => {
|
|
6881
|
-
const workspaceId = this.requireWorkspace();
|
|
7096
|
+
const workspaceId = options.workspaceId ?? this.requireWorkspace();
|
|
6882
7097
|
const response = await this.recovering(
|
|
6883
7098
|
() => queryAssistant({
|
|
6884
7099
|
...this.getAuthHeaders(),
|
|
6885
7100
|
workspaceId,
|
|
6886
7101
|
question,
|
|
7102
|
+
agentId: options.agentId,
|
|
6887
7103
|
docIds: options.docIds,
|
|
6888
7104
|
previousResponseId: options.previousResponseId,
|
|
7105
|
+
conversationId: options.conversationId,
|
|
7106
|
+
assistantMode: options.assistantMode,
|
|
7107
|
+
mentions: options.mentions,
|
|
6889
7108
|
model: options.model,
|
|
7109
|
+
activeArtifactExtId: options.activeArtifactExtId,
|
|
6890
7110
|
signal: options.signal
|
|
6891
7111
|
})
|
|
6892
7112
|
);
|
|
@@ -7062,6 +7282,11 @@ var Arbi = class {
|
|
|
7062
7282
|
};
|
|
7063
7283
|
// ── Agents ──────────────────────────────────────────────────────────
|
|
7064
7284
|
agents = {
|
|
7285
|
+
getSession: (agentId) => getAgentSession(this.requireClient(), agentId),
|
|
7286
|
+
startSession: (agentId, workspaceId) => startAgentSession(this.requireClient(), agentId, workspaceId),
|
|
7287
|
+
closeSession: (agentId) => closeAgentSession(this.requireClient(), agentId),
|
|
7288
|
+
listChats: (agentId) => listAgentChats(this.requireClient(), agentId),
|
|
7289
|
+
stageFile: (agentId, file, name) => this.recovering(() => stageAgentFile(this.getAuthHeaders(), agentId, file, name)),
|
|
7065
7290
|
list: () => listAgents(this.requireClient()),
|
|
7066
7291
|
create: (name) => createAgent(this.requireClient(), name),
|
|
7067
7292
|
getConfig: (agentExtId) => getAgentConfig(this.requireClient(), agentExtId),
|
|
@@ -7893,69 +8118,6 @@ async function uploadArchive(auth, archivePath, options) {
|
|
|
7893
8118
|
}
|
|
7894
8119
|
}
|
|
7895
8120
|
|
|
7896
|
-
// src/operations/responses.ts
|
|
7897
|
-
var responses_exports = {};
|
|
7898
|
-
__export(responses_exports, {
|
|
7899
|
-
extractResponseText: () => extractResponseText,
|
|
7900
|
-
getResponse: () => getResponse,
|
|
7901
|
-
submitBackgroundQuery: () => submitBackgroundQuery
|
|
7902
|
-
});
|
|
7903
|
-
async function submitBackgroundQuery(options) {
|
|
7904
|
-
const { workspaceId, question, docIds, previousResponseId, model, ...auth } = options;
|
|
7905
|
-
const tools = {};
|
|
7906
|
-
if (docIds.length > 0) {
|
|
7907
|
-
tools.retrieval_chunk = {
|
|
7908
|
-
name: "retrieval_chunk",
|
|
7909
|
-
description: "retrieval chunk",
|
|
7910
|
-
tool_args: { doc_ext_ids: docIds },
|
|
7911
|
-
tool_responses: {}
|
|
7912
|
-
};
|
|
7913
|
-
tools.retrieval_full_context = {
|
|
7914
|
-
name: "retrieval_full_context",
|
|
7915
|
-
description: "retrieval full context",
|
|
7916
|
-
tool_args: { doc_ext_ids: [] },
|
|
7917
|
-
tool_responses: {}
|
|
7918
|
-
};
|
|
7919
|
-
}
|
|
7920
|
-
const body = {
|
|
7921
|
-
input: question,
|
|
7922
|
-
workspace_ext_id: workspaceId,
|
|
7923
|
-
stream: false,
|
|
7924
|
-
background: true,
|
|
7925
|
-
store: true,
|
|
7926
|
-
tools,
|
|
7927
|
-
...previousResponseId ? { previous_response_id: previousResponseId } : {},
|
|
7928
|
-
...model ? { model } : {}
|
|
7929
|
-
};
|
|
7930
|
-
const res = await authenticatedFetch({
|
|
7931
|
-
...auth,
|
|
7932
|
-
path: "/v1/responses",
|
|
7933
|
-
method: "POST",
|
|
7934
|
-
body: JSON.stringify(body),
|
|
7935
|
-
headers: { "Content-Type": "application/json" }
|
|
7936
|
-
});
|
|
7937
|
-
return await res.json();
|
|
7938
|
-
}
|
|
7939
|
-
async function getResponse(auth, responseId) {
|
|
7940
|
-
const res = await authenticatedFetch({
|
|
7941
|
-
...auth,
|
|
7942
|
-
path: `/v1/responses/${responseId}`,
|
|
7943
|
-
method: "GET"
|
|
7944
|
-
});
|
|
7945
|
-
return await res.json();
|
|
7946
|
-
}
|
|
7947
|
-
function extractResponseText(response) {
|
|
7948
|
-
const parts = [];
|
|
7949
|
-
for (const msg of response.output) {
|
|
7950
|
-
for (const item of msg.content) {
|
|
7951
|
-
if ("type" in item && item.type === "output_text" && "text" in item) {
|
|
7952
|
-
parts.push(item.text);
|
|
7953
|
-
}
|
|
7954
|
-
}
|
|
7955
|
-
}
|
|
7956
|
-
return parts.join("");
|
|
7957
|
-
}
|
|
7958
|
-
|
|
7959
8121
|
// src/listen/index.ts
|
|
7960
8122
|
var listen_exports = {};
|
|
7961
8123
|
__export(listen_exports, {
|