@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.cjs
CHANGED
|
@@ -3514,19 +3514,21 @@ function apiErrorDetail(apiError) {
|
|
|
3514
3514
|
return detailText(body.detail) || (typeof body.message === "string" ? body.message : void 0);
|
|
3515
3515
|
}
|
|
3516
3516
|
var ArbiApiError = class extends ArbiError {
|
|
3517
|
+
status;
|
|
3517
3518
|
apiError;
|
|
3518
3519
|
/** Why the server refused, in its words (e.g. "run_at must be in the future"), when it said. */
|
|
3519
3520
|
detail;
|
|
3520
|
-
constructor(message, apiError) {
|
|
3521
|
+
constructor(message, apiError, status) {
|
|
3521
3522
|
super(message);
|
|
3522
3523
|
this.name = "ArbiApiError";
|
|
3523
3524
|
this.apiError = apiError;
|
|
3525
|
+
this.status = status;
|
|
3524
3526
|
this.detail = apiErrorDetail(apiError);
|
|
3525
3527
|
}
|
|
3526
3528
|
};
|
|
3527
3529
|
function requireData(result, message) {
|
|
3528
3530
|
if (result.error || !result.data) {
|
|
3529
|
-
throw new ArbiApiError(message, result.error);
|
|
3531
|
+
throw new ArbiApiError(message, result.error, result.response?.status);
|
|
3530
3532
|
}
|
|
3531
3533
|
return result.data;
|
|
3532
3534
|
}
|
|
@@ -5422,6 +5424,7 @@ __export(assistant_exports, {
|
|
|
5422
5424
|
buildRetrievalChunkTool: () => buildRetrievalChunkTool,
|
|
5423
5425
|
buildRetrievalFullContextTool: () => buildRetrievalFullContextTool,
|
|
5424
5426
|
buildRetrievalTocTool: () => buildRetrievalTocTool,
|
|
5427
|
+
cancelAssistantRun: () => cancelAssistantRun,
|
|
5425
5428
|
filterSkills: () => filterSkills,
|
|
5426
5429
|
listCommands: () => listCommands,
|
|
5427
5430
|
listSkills: () => listSkills,
|
|
@@ -5492,18 +5495,35 @@ async function retrieve(options) {
|
|
|
5492
5495
|
return data;
|
|
5493
5496
|
}
|
|
5494
5497
|
async function queryAssistant(options) {
|
|
5495
|
-
const {
|
|
5498
|
+
const {
|
|
5499
|
+
workspaceId,
|
|
5500
|
+
question,
|
|
5501
|
+
docIds,
|
|
5502
|
+
previousResponseId,
|
|
5503
|
+
conversationId,
|
|
5504
|
+
assistantMode,
|
|
5505
|
+
agentId,
|
|
5506
|
+
model,
|
|
5507
|
+
mentions,
|
|
5508
|
+
signal,
|
|
5509
|
+
activeArtifactExtId,
|
|
5510
|
+
...auth
|
|
5511
|
+
} = options;
|
|
5496
5512
|
const body = {
|
|
5497
5513
|
input: question,
|
|
5514
|
+
...activeArtifactExtId ? { active_artifact_ext_id: activeArtifactExtId } : {},
|
|
5498
5515
|
workspace_ext_id: workspaceId,
|
|
5516
|
+
...agentId ? { agent_ext_id: agentId } : {},
|
|
5499
5517
|
stream: true,
|
|
5500
5518
|
background: false,
|
|
5501
5519
|
store: true,
|
|
5502
|
-
tools: {
|
|
5520
|
+
tools: agentId ? {} : {
|
|
5503
5521
|
retrieval_chunk: buildRetrievalChunkTool(docIds),
|
|
5504
5522
|
retrieval_full_context: buildRetrievalFullContextTool([])
|
|
5505
5523
|
},
|
|
5506
5524
|
...previousResponseId ? { previous_response_id: previousResponseId } : {},
|
|
5525
|
+
...conversationId ? { conversation_ext_id: conversationId } : {},
|
|
5526
|
+
...assistantMode ? { assistant_mode: assistantMode } : {},
|
|
5507
5527
|
...model ? { model } : {},
|
|
5508
5528
|
...mentions && mentions.length > 0 ? { mentions } : {}
|
|
5509
5529
|
};
|
|
@@ -5565,6 +5585,91 @@ function filterSkills(items, query, pinned = []) {
|
|
|
5565
5585
|
});
|
|
5566
5586
|
return matched;
|
|
5567
5587
|
}
|
|
5588
|
+
async function cancelAssistantRun(auth, responseId) {
|
|
5589
|
+
await authenticatedFetch({
|
|
5590
|
+
...auth,
|
|
5591
|
+
path: `/v1/assistant/run/${encodeURIComponent(responseId)}/cancel`,
|
|
5592
|
+
method: "POST"
|
|
5593
|
+
});
|
|
5594
|
+
}
|
|
5595
|
+
|
|
5596
|
+
// src/operations/responses.ts
|
|
5597
|
+
var responses_exports = {};
|
|
5598
|
+
__export(responses_exports, {
|
|
5599
|
+
extractResponseText: () => extractResponseText,
|
|
5600
|
+
getResponse: () => getResponse,
|
|
5601
|
+
submitBackgroundQuery: () => submitBackgroundQuery
|
|
5602
|
+
});
|
|
5603
|
+
async function submitBackgroundQuery(options) {
|
|
5604
|
+
const {
|
|
5605
|
+
workspaceId,
|
|
5606
|
+
question,
|
|
5607
|
+
docIds,
|
|
5608
|
+
previousResponseId,
|
|
5609
|
+
model,
|
|
5610
|
+
task,
|
|
5611
|
+
conversationId,
|
|
5612
|
+
mentions,
|
|
5613
|
+
activeArtifactExtId,
|
|
5614
|
+
...auth
|
|
5615
|
+
} = options;
|
|
5616
|
+
const tools = {};
|
|
5617
|
+
if (docIds.length > 0) {
|
|
5618
|
+
tools.retrieval_chunk = {
|
|
5619
|
+
name: "retrieval_chunk",
|
|
5620
|
+
description: "retrieval chunk",
|
|
5621
|
+
tool_args: { doc_ext_ids: docIds },
|
|
5622
|
+
tool_responses: {}
|
|
5623
|
+
};
|
|
5624
|
+
tools.retrieval_full_context = {
|
|
5625
|
+
name: "retrieval_full_context",
|
|
5626
|
+
description: "retrieval full context",
|
|
5627
|
+
tool_args: { doc_ext_ids: docIds },
|
|
5628
|
+
tool_responses: {}
|
|
5629
|
+
};
|
|
5630
|
+
}
|
|
5631
|
+
const body = {
|
|
5632
|
+
input: question,
|
|
5633
|
+
workspace_ext_id: workspaceId,
|
|
5634
|
+
stream: false,
|
|
5635
|
+
background: true,
|
|
5636
|
+
store: true,
|
|
5637
|
+
tools,
|
|
5638
|
+
...task !== void 0 ? { task } : {},
|
|
5639
|
+
...conversationId ? { conversation_ext_id: conversationId } : {},
|
|
5640
|
+
...mentions !== void 0 ? { mentions } : {},
|
|
5641
|
+
...activeArtifactExtId ? { active_artifact_ext_id: activeArtifactExtId } : {},
|
|
5642
|
+
...previousResponseId ? { previous_response_id: previousResponseId } : {},
|
|
5643
|
+
...model ? { model } : {}
|
|
5644
|
+
};
|
|
5645
|
+
const res = await authenticatedFetch({
|
|
5646
|
+
...auth,
|
|
5647
|
+
path: "/v1/responses",
|
|
5648
|
+
method: "POST",
|
|
5649
|
+
body: JSON.stringify(body),
|
|
5650
|
+
headers: { "Content-Type": "application/json" }
|
|
5651
|
+
});
|
|
5652
|
+
return await res.json();
|
|
5653
|
+
}
|
|
5654
|
+
async function getResponse(auth, responseId) {
|
|
5655
|
+
const res = await authenticatedFetch({
|
|
5656
|
+
...auth,
|
|
5657
|
+
path: `/v1/responses/${responseId}`,
|
|
5658
|
+
method: "GET"
|
|
5659
|
+
});
|
|
5660
|
+
return await res.json();
|
|
5661
|
+
}
|
|
5662
|
+
function extractResponseText(response) {
|
|
5663
|
+
const parts = [];
|
|
5664
|
+
for (const msg of response.output) {
|
|
5665
|
+
for (const item of msg.content) {
|
|
5666
|
+
if ("type" in item && item.type === "output_text" && "text" in item) {
|
|
5667
|
+
parts.push(item.text);
|
|
5668
|
+
}
|
|
5669
|
+
}
|
|
5670
|
+
}
|
|
5671
|
+
return parts.join("");
|
|
5672
|
+
}
|
|
5568
5673
|
|
|
5569
5674
|
// src/operations/tags.ts
|
|
5570
5675
|
var tags_exports = {};
|
|
@@ -5709,12 +5814,17 @@ __export(dm_exports, {
|
|
|
5709
5814
|
var agents_exports = {};
|
|
5710
5815
|
__export(agents_exports, {
|
|
5711
5816
|
authorizeAgent: () => authorizeAgent,
|
|
5817
|
+
closeAgentSession: () => closeAgentSession,
|
|
5712
5818
|
createAgent: () => createAgent,
|
|
5713
5819
|
deleteAgents: () => deleteAgents,
|
|
5714
5820
|
getAgentConfig: () => getAgentConfig,
|
|
5821
|
+
getAgentSession: () => getAgentSession,
|
|
5715
5822
|
getAuthorizeLimits: () => getAuthorizeLimits,
|
|
5823
|
+
listAgentChats: () => listAgentChats,
|
|
5716
5824
|
listAgentWorkspaces: () => listAgentWorkspaces,
|
|
5717
|
-
listAgents: () => listAgents
|
|
5825
|
+
listAgents: () => listAgents,
|
|
5826
|
+
stageAgentFile: () => stageAgentFile,
|
|
5827
|
+
startAgentSession: () => startAgentSession
|
|
5718
5828
|
});
|
|
5719
5829
|
async function listAgents(arbi) {
|
|
5720
5830
|
return requireData(await arbi.fetch.GET("/v1/agents"), "Failed to fetch agents");
|
|
@@ -5762,6 +5872,48 @@ async function getAuthorizeLimits(arbi) {
|
|
|
5762
5872
|
"Failed to fetch authorize limits"
|
|
5763
5873
|
);
|
|
5764
5874
|
}
|
|
5875
|
+
async function getAgentSession(arbi, agentId) {
|
|
5876
|
+
return requireData(
|
|
5877
|
+
await arbi.fetch.GET("/v1/agents/{agent_ext_id}/session", {
|
|
5878
|
+
params: { path: { agent_ext_id: agentId } }
|
|
5879
|
+
}),
|
|
5880
|
+
"Failed to read agent session"
|
|
5881
|
+
);
|
|
5882
|
+
}
|
|
5883
|
+
async function startAgentSession(arbi, agentId, workspaceId) {
|
|
5884
|
+
return requireData(
|
|
5885
|
+
await arbi.fetch.POST("/v1/agents/{agent_ext_id}/session", {
|
|
5886
|
+
params: { path: { agent_ext_id: agentId } },
|
|
5887
|
+
body: { workspace_ext_id: workspaceId ?? null }
|
|
5888
|
+
}),
|
|
5889
|
+
"Failed to start agent session"
|
|
5890
|
+
);
|
|
5891
|
+
}
|
|
5892
|
+
async function closeAgentSession(arbi, agentId) {
|
|
5893
|
+
const { error } = await arbi.fetch.DELETE("/v1/agents/{agent_ext_id}/session", {
|
|
5894
|
+
params: { path: { agent_ext_id: agentId } }
|
|
5895
|
+
});
|
|
5896
|
+
if (error) throw new Error("Failed to close agent session");
|
|
5897
|
+
}
|
|
5898
|
+
async function listAgentChats(arbi, agentId) {
|
|
5899
|
+
return requireData(
|
|
5900
|
+
await arbi.fetch.GET("/v1/agents/{agent_ext_id}/chats", {
|
|
5901
|
+
params: { path: { agent_ext_id: agentId } }
|
|
5902
|
+
}),
|
|
5903
|
+
"Failed to read agent chats"
|
|
5904
|
+
);
|
|
5905
|
+
}
|
|
5906
|
+
async function stageAgentFile(auth, agentId, file, name) {
|
|
5907
|
+
const body = new FormData();
|
|
5908
|
+
body.append("file", file, name);
|
|
5909
|
+
const response = await authenticatedFetch({
|
|
5910
|
+
...auth,
|
|
5911
|
+
path: `/v1/agents/${encodeURIComponent(agentId)}/files`,
|
|
5912
|
+
method: "POST",
|
|
5913
|
+
body
|
|
5914
|
+
});
|
|
5915
|
+
return response.json();
|
|
5916
|
+
}
|
|
5765
5917
|
|
|
5766
5918
|
// src/operations/dm.ts
|
|
5767
5919
|
function createDmCryptoContext(arbi, signingPrivateKeyBytes, userExtId) {
|
|
@@ -5871,7 +6023,9 @@ async function sendEncryptedDM(arbi, messages, crypto) {
|
|
|
5871
6023
|
}))
|
|
5872
6024
|
);
|
|
5873
6025
|
const created = requireData(
|
|
5874
|
-
await arbi.fetch.POST("/v1/notifications/", {
|
|
6026
|
+
await arbi.fetch.POST("/v1/notifications/", {
|
|
6027
|
+
body: { messages: encrypted, context_only: false }
|
|
6028
|
+
}),
|
|
5875
6029
|
"Failed to send message"
|
|
5876
6030
|
);
|
|
5877
6031
|
return created.map((n2) => ({
|
|
@@ -5904,7 +6058,7 @@ async function requestWorkspaceAccess(arbi, params, crypto) {
|
|
|
5904
6058
|
async function sendDM(arbi, messages) {
|
|
5905
6059
|
return requireData(
|
|
5906
6060
|
await arbi.fetch.POST("/v1/notifications/", {
|
|
5907
|
-
body: { messages }
|
|
6061
|
+
body: { messages, context_only: false }
|
|
5908
6062
|
}),
|
|
5909
6063
|
"Failed to send message"
|
|
5910
6064
|
);
|
|
@@ -6469,6 +6623,18 @@ var Arbi = class {
|
|
|
6469
6623
|
this.loginResult = await client.auth.loginWithKey({ email, signingPrivateKey });
|
|
6470
6624
|
this.userProfile = this.loginResult.profile ?? null;
|
|
6471
6625
|
}
|
|
6626
|
+
/** Recover browser authentication using the encrypted signing key already in IndexedDB. */
|
|
6627
|
+
async restoreSession(email) {
|
|
6628
|
+
const client = await this.init();
|
|
6629
|
+
const saved = await client.storage.getSession();
|
|
6630
|
+
if (!saved?.signingPrivateKey) return false;
|
|
6631
|
+
this.loginResult = await client.auth.loginWithKey({
|
|
6632
|
+
email,
|
|
6633
|
+
signingPrivateKey: saved.signingPrivateKey
|
|
6634
|
+
});
|
|
6635
|
+
this.userProfile = this.loginResult.profile ?? null;
|
|
6636
|
+
return true;
|
|
6637
|
+
}
|
|
6472
6638
|
/** A workspace's key, sealed to the caller's own session (what `/open` and `POST /workspace/users` take). */
|
|
6473
6639
|
async sealWorkspaceKey(workspaceId) {
|
|
6474
6640
|
const client = this.requireClient();
|
|
@@ -6880,22 +7046,76 @@ var Arbi = class {
|
|
|
6880
7046
|
assistantMode
|
|
6881
7047
|
)
|
|
6882
7048
|
};
|
|
7049
|
+
/** Persisted notifications also arrive on the normal workspace WebSocket. */
|
|
7050
|
+
notifications = {
|
|
7051
|
+
list: async (type) => {
|
|
7052
|
+
const { data, error } = await this.requireClient().fetch.GET("/v1/notifications/", {
|
|
7053
|
+
params: { query: { ...type ? { type } : {}, limit: 100 } }
|
|
7054
|
+
});
|
|
7055
|
+
if (error) throw new ArbiError("Could not load notifications");
|
|
7056
|
+
return data || [];
|
|
7057
|
+
},
|
|
7058
|
+
markRead: async (ids) => {
|
|
7059
|
+
if (!ids.length) return;
|
|
7060
|
+
const { error } = await this.requireClient().fetch.PATCH("/v1/notifications/", {
|
|
7061
|
+
body: { updates: ids.map((external_id) => ({ external_id, read: true })) }
|
|
7062
|
+
});
|
|
7063
|
+
if (error) throw new ArbiError("Could not mark notifications read");
|
|
7064
|
+
}
|
|
7065
|
+
};
|
|
7066
|
+
/** Authenticated native Word transport, with normal session recovery. */
|
|
7067
|
+
editor = {
|
|
7068
|
+
request: (path3, options = {}) => this.recovering(async () => {
|
|
7069
|
+
const { baseUrl, accessToken } = this.getAuthHeaders();
|
|
7070
|
+
const headers = new Headers(options.headers);
|
|
7071
|
+
headers.set("Authorization", `Bearer ${accessToken}`);
|
|
7072
|
+
const response = await fetch(`${baseUrl}/v1/editor${path3}`, { ...options, headers });
|
|
7073
|
+
if (!response.ok) {
|
|
7074
|
+
const body = await response.json().catch(() => null);
|
|
7075
|
+
throw new ArbiApiError(body?.detail || `Document request failed (${response.status})`, {
|
|
7076
|
+
status: response.status,
|
|
7077
|
+
statusText: response.statusText
|
|
7078
|
+
});
|
|
7079
|
+
}
|
|
7080
|
+
return response;
|
|
7081
|
+
})
|
|
7082
|
+
};
|
|
6883
7083
|
// ── Assistant ─────────────────────────────────────────────────────────
|
|
6884
7084
|
assistant = {
|
|
7085
|
+
cancelRun: (responseId) => this.recovering(() => cancelAssistantRun(this.getAuthHeaders(), responseId)),
|
|
7086
|
+
/** Start a durable background turn; task options make its thread a reviewable work item. */
|
|
7087
|
+
submit: (question, options) => {
|
|
7088
|
+
const workspaceId = this.requireWorkspace();
|
|
7089
|
+
return this.recovering(
|
|
7090
|
+
() => submitBackgroundQuery({
|
|
7091
|
+
...this.getAuthHeaders(),
|
|
7092
|
+
...options,
|
|
7093
|
+
workspaceId,
|
|
7094
|
+
question
|
|
7095
|
+
})
|
|
7096
|
+
);
|
|
7097
|
+
},
|
|
7098
|
+
/** Read the status of a background turn. */
|
|
7099
|
+
getResponse: (id) => this.recovering(() => getResponse(this.getAuthHeaders(), id)),
|
|
6885
7100
|
/**
|
|
6886
7101
|
* Send a question to the RAG assistant with streaming support.
|
|
6887
7102
|
* Returns the accumulated result after the stream completes.
|
|
6888
7103
|
*/
|
|
6889
7104
|
query: async (question, options) => {
|
|
6890
|
-
const workspaceId = this.requireWorkspace();
|
|
7105
|
+
const workspaceId = options.workspaceId ?? this.requireWorkspace();
|
|
6891
7106
|
const response = await this.recovering(
|
|
6892
7107
|
() => queryAssistant({
|
|
6893
7108
|
...this.getAuthHeaders(),
|
|
6894
7109
|
workspaceId,
|
|
6895
7110
|
question,
|
|
7111
|
+
agentId: options.agentId,
|
|
6896
7112
|
docIds: options.docIds,
|
|
6897
7113
|
previousResponseId: options.previousResponseId,
|
|
7114
|
+
conversationId: options.conversationId,
|
|
7115
|
+
assistantMode: options.assistantMode,
|
|
7116
|
+
mentions: options.mentions,
|
|
6898
7117
|
model: options.model,
|
|
7118
|
+
activeArtifactExtId: options.activeArtifactExtId,
|
|
6899
7119
|
signal: options.signal
|
|
6900
7120
|
})
|
|
6901
7121
|
);
|
|
@@ -7071,6 +7291,11 @@ var Arbi = class {
|
|
|
7071
7291
|
};
|
|
7072
7292
|
// ── Agents ──────────────────────────────────────────────────────────
|
|
7073
7293
|
agents = {
|
|
7294
|
+
getSession: (agentId) => getAgentSession(this.requireClient(), agentId),
|
|
7295
|
+
startSession: (agentId, workspaceId) => startAgentSession(this.requireClient(), agentId, workspaceId),
|
|
7296
|
+
closeSession: (agentId) => closeAgentSession(this.requireClient(), agentId),
|
|
7297
|
+
listChats: (agentId) => listAgentChats(this.requireClient(), agentId),
|
|
7298
|
+
stageFile: (agentId, file, name) => this.recovering(() => stageAgentFile(this.getAuthHeaders(), agentId, file, name)),
|
|
7074
7299
|
list: () => listAgents(this.requireClient()),
|
|
7075
7300
|
create: (name) => createAgent(this.requireClient(), name),
|
|
7076
7301
|
getConfig: (agentExtId) => getAgentConfig(this.requireClient(), agentExtId),
|
|
@@ -7902,69 +8127,6 @@ async function uploadArchive(auth, archivePath, options) {
|
|
|
7902
8127
|
}
|
|
7903
8128
|
}
|
|
7904
8129
|
|
|
7905
|
-
// src/operations/responses.ts
|
|
7906
|
-
var responses_exports = {};
|
|
7907
|
-
__export(responses_exports, {
|
|
7908
|
-
extractResponseText: () => extractResponseText,
|
|
7909
|
-
getResponse: () => getResponse,
|
|
7910
|
-
submitBackgroundQuery: () => submitBackgroundQuery
|
|
7911
|
-
});
|
|
7912
|
-
async function submitBackgroundQuery(options) {
|
|
7913
|
-
const { workspaceId, question, docIds, previousResponseId, model, ...auth } = options;
|
|
7914
|
-
const tools = {};
|
|
7915
|
-
if (docIds.length > 0) {
|
|
7916
|
-
tools.retrieval_chunk = {
|
|
7917
|
-
name: "retrieval_chunk",
|
|
7918
|
-
description: "retrieval chunk",
|
|
7919
|
-
tool_args: { doc_ext_ids: docIds },
|
|
7920
|
-
tool_responses: {}
|
|
7921
|
-
};
|
|
7922
|
-
tools.retrieval_full_context = {
|
|
7923
|
-
name: "retrieval_full_context",
|
|
7924
|
-
description: "retrieval full context",
|
|
7925
|
-
tool_args: { doc_ext_ids: [] },
|
|
7926
|
-
tool_responses: {}
|
|
7927
|
-
};
|
|
7928
|
-
}
|
|
7929
|
-
const body = {
|
|
7930
|
-
input: question,
|
|
7931
|
-
workspace_ext_id: workspaceId,
|
|
7932
|
-
stream: false,
|
|
7933
|
-
background: true,
|
|
7934
|
-
store: true,
|
|
7935
|
-
tools,
|
|
7936
|
-
...previousResponseId ? { previous_response_id: previousResponseId } : {},
|
|
7937
|
-
...model ? { model } : {}
|
|
7938
|
-
};
|
|
7939
|
-
const res = await authenticatedFetch({
|
|
7940
|
-
...auth,
|
|
7941
|
-
path: "/v1/responses",
|
|
7942
|
-
method: "POST",
|
|
7943
|
-
body: JSON.stringify(body),
|
|
7944
|
-
headers: { "Content-Type": "application/json" }
|
|
7945
|
-
});
|
|
7946
|
-
return await res.json();
|
|
7947
|
-
}
|
|
7948
|
-
async function getResponse(auth, responseId) {
|
|
7949
|
-
const res = await authenticatedFetch({
|
|
7950
|
-
...auth,
|
|
7951
|
-
path: `/v1/responses/${responseId}`,
|
|
7952
|
-
method: "GET"
|
|
7953
|
-
});
|
|
7954
|
-
return await res.json();
|
|
7955
|
-
}
|
|
7956
|
-
function extractResponseText(response) {
|
|
7957
|
-
const parts = [];
|
|
7958
|
-
for (const msg of response.output) {
|
|
7959
|
-
for (const item of msg.content) {
|
|
7960
|
-
if ("type" in item && item.type === "output_text" && "text" in item) {
|
|
7961
|
-
parts.push(item.text);
|
|
7962
|
-
}
|
|
7963
|
-
}
|
|
7964
|
-
}
|
|
7965
|
-
return parts.join("");
|
|
7966
|
-
}
|
|
7967
|
-
|
|
7968
8130
|
// src/listen/index.ts
|
|
7969
8131
|
var listen_exports = {};
|
|
7970
8132
|
__export(listen_exports, {
|