@sentry/junior 0.312.0 → 0.313.0
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/{adapter-iIq7ihf7.js → adapter-CYAvJzZS.js} +1 -1
- package/dist/{adapter-context-BRjEWRy1.js → adapter-context-CVsHoVSf.js} +2 -2
- package/dist/{admin-DhInw5K9.js → admin-Cyhb4TwZ.js} +1 -1
- package/dist/{agent-runner-C9iDurwX.js → agent-runner-B5y9MsT-.js} +93 -45
- package/dist/api/schema.d.ts +1 -1
- package/dist/api/schema.js +4 -4
- package/dist/api.d.ts +1 -1
- package/dist/api.js +40 -40
- package/dist/{app-DRFrC8Mw.d.ts → app-DA8-hCMj.d.ts} +2 -2
- package/dist/app.d.ts +1 -1
- package/dist/app.js +31 -33
- package/dist/{background-compaction-queue-DrKi7w3d.js → background-compaction-queue-iZXadLV3.js} +56 -6
- package/dist/{catalog-runtime-D7xapBAX.js → catalog-runtime-kkE3hvCX.js} +1 -1
- package/dist/{channel-access-CJGfNTdn.js → channel-access-mt7K6dPh.js} +2 -2
- package/dist/cli/chat.js +16 -16
- package/dist/cli/check.js +3 -3
- package/dist/cli/main.js +2 -2
- package/dist/cli/plugins.js +4 -4
- package/dist/cli/snapshot-create.js +5 -5
- package/dist/cli/upgrade.d.ts +1 -1
- package/dist/cli/upgrade.js +3 -3
- package/dist/{config-kXB2Y5tl.js → config-CWbwKj0j.js} +3 -3
- package/dist/{continue-in-slack-O6pV5004.js → continue-in-slack-CxyFzdlF.js} +6 -6
- package/dist/{conversation-feed-uNOv_x68.js → conversation-feed-BEXLD3Me.js} +13 -2
- package/dist/{conversation-privacy-L4ja1_W6.js → conversation-privacy-BrMiDN61.js} +1 -1
- package/dist/{conversation-turn-CeLbHqdw.js → conversation-turn-B35eu0uz.js} +63 -45
- package/dist/{credential-sync-I8VBGk05.js → credential-sync-DWTOEQrm.js} +15 -16
- package/dist/{credentialed-Cb6E2phL.js → credentialed-Dyv8b-lu.js} +12 -14
- package/dist/{db-BbC5stfa.d.ts → db-DYGcXYl3.d.ts} +1 -1
- package/dist/{db-LAyyX8tk.js → db-PwSRzWWn.js} +17 -19
- package/dist/{executor-SCub-fAq.js → executor-CgWyWfYz.js} +2 -4
- package/dist/{html-BCZ3Xtb_.js → html-DidUcRhI.js} +6 -6
- package/dist/ingest-B0AggUEC.js +7931 -0
- package/dist/{install-DCFJFkC0.js → install-2urLLXNt.js} +2 -2
- package/dist/instrumentation.js +2 -2
- package/dist/{lineage-B_m-4TJw.js → lineage-BXplQAVH.js} +2 -2
- package/dist/{list-CN2QA2R9.js → list-DyIyReSV.js} +82 -69
- package/dist/{logging-dQ9ZRGQ8.js → logging-DNt-qOIO.js} +1 -1
- package/dist/{media-CYm1QD8T.js → media-B0pZJ0bG.js} +9 -6
- package/dist/{message-DSXGj1hM.js → message-Z5YKC-Af.js} +23 -9
- package/dist/{model-input--TrP9hYV.js → model-input-BhPJYdSV.js} +3 -3
- package/dist/nitro.d.ts +1 -1
- package/dist/nitro.js +4 -4
- package/dist/{oauth-callback-server-DHCZC6B4.js → oauth-callback-server-ByvDdcdY.js} +2 -2
- package/dist/{oauth-relay-pPMGnDZt.js → oauth-relay-D-kK0yoN.js} +1 -1
- package/dist/{registry-CZOzddwu.js → registry-POH4bZC4.js} +1 -1
- package/dist/{statuses-_cRJHXK7.js → reporting-window-C4dbzDiR.js} +1 -27
- package/dist/request-deadline-BUiRYQYj.js +24 -0
- package/dist/{resolve-cKOQ14Dh.js → resolve-CWtBNSKP.js} +3 -3
- package/dist/{runner-DBfUW44l.js → runner-CsZ_VRxp.js} +8 -8
- package/dist/{sandbox-egress-signals-BVF_xAm1.js → sandbox-egress-signals-FbCk1FkN.js} +1 -1
- package/dist/{schema-BEHKxr4I.d.ts → schema-DBf18QPS.d.ts} +131 -912
- package/dist/{schema-Bk9Nm2E8.js → schema-DojR2uCL.js} +4 -4
- package/dist/{service-account-CVYsFjty.js → service-account-CDYb9hfX.js} +3 -3
- package/dist/{service-account-Ts4ulcrV.js → service-account-o15pZWcJ.js} +5 -5
- package/dist/{skills-VTnhAJWm.js → skills-B0jP4whm.js} +2 -2
- package/dist/{slack-conversation-unfurl-fuLnF1jE.js → slack-conversation-unfurl-D26t9kBC.js} +8 -8
- package/dist/{spawn-vxAarlX5.js → spawn-BjljgExZ.js} +14 -33
- package/dist/{start-conversation-CEn2KH1A.js → start-conversation-DbVujrwO.js} +10 -196
- package/dist/{state-C1P3_Ywk.js → state-BTawTCme.js} +4 -4
- package/dist/{result-event-type-BdIJuZxg.js → statuses-BKwqCPhj.js} +25 -4
- package/dist/{store-DFZaN-Ix.js → store-CjXrp-Up.js} +3 -3
- package/dist/{task-queue-Cx4Lmjyk.js → task-queue-Cwlatjz3.js} +4 -4
- package/dist/{task-runner-CbTwFA6k.js → task-runner--Ke8KSMf.js} +11 -11
- package/dist/{thread-context-BkAZDTX2.js → thread-context-B8exINEe.js} +6 -7
- package/dist/{thread-state-DhPndWi1.js → turn-membership-DTR3SaKD.js} +251 -17
- package/dist/{validation-nIzMtAVJ.js → validation-Ce0qbMlT.js} +1 -1
- package/dist/{vercel-queue-hW90XzbG.js → vercel-queue-q4z8w5QO.js} +2 -2
- package/dist/{version-Brbtz4Qf.js → version-DFh4n9nr.js} +1 -1
- package/dist/version.js +1 -1
- package/dist/{warmup-BDA5myRK.js → warmup-D5hzqTcp.js} +44 -2969
- package/dist/{worker-D63RcaVD.js → worker-CDg9Lbpg.js} +6 -6
- package/migrations/0158_keep_legacy_archive_columns.sql +5 -0
- package/migrations/0159_conversation_embeddings_fk_validate.sql +5 -0
- package/migrations/meta/0158_snapshot.json +6515 -0
- package/migrations/meta/0159_snapshot.json +6515 -0
- package/migrations/meta/_journal.json +14 -0
- package/package.json +5 -5
- package/dist/callback-mFlTUWWx.js +0 -75
- package/dist/child-message-DcsritGf.js +0 -179
- package/dist/ingest-BDf3D50j.js +0 -3836
- package/dist/result-DcvEOe1r.js +0 -574
|
@@ -1107,6 +1107,20 @@
|
|
|
1107
1107
|
"when": 1795315499375,
|
|
1108
1108
|
"tag": "0157_conversation_lead_actor_index",
|
|
1109
1109
|
"breakpoints": true
|
|
1110
|
+
},
|
|
1111
|
+
{
|
|
1112
|
+
"idx": 158,
|
|
1113
|
+
"version": "7",
|
|
1114
|
+
"when": 1795331749525,
|
|
1115
|
+
"tag": "0158_keep_legacy_archive_columns",
|
|
1116
|
+
"breakpoints": true
|
|
1117
|
+
},
|
|
1118
|
+
{
|
|
1119
|
+
"idx": 159,
|
|
1120
|
+
"version": "7",
|
|
1121
|
+
"when": 1795374840076,
|
|
1122
|
+
"tag": "0159_conversation_embeddings_fk_validate",
|
|
1123
|
+
"breakpoints": true
|
|
1110
1124
|
}
|
|
1111
1125
|
]
|
|
1112
1126
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sentry/junior",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.313.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
"@modelcontextprotocol/sdk": "1.32.0",
|
|
66
66
|
"@neondatabase/serverless": "^1.1.0",
|
|
67
67
|
"@sentry/api": "2.16.0",
|
|
68
|
-
"@sentry/junior-plugin-api": "0.
|
|
68
|
+
"@sentry/junior-plugin-api": "0.313.0",
|
|
69
69
|
"@sentry/nitro": "11.14.0",
|
|
70
70
|
"@sentry/node": "11.14.0",
|
|
71
71
|
"@sentry/server-utils": "11.14.0",
|
|
@@ -116,9 +116,9 @@
|
|
|
116
116
|
"@emnapi/core": "^1.10.0",
|
|
117
117
|
"@emnapi/runtime": "^1.10.0",
|
|
118
118
|
"@hono/node-server": "2.1.3",
|
|
119
|
-
"@sentry/junior-github": "0.
|
|
120
|
-
"@sentry/junior-notion": "0.
|
|
121
|
-
"@sentry/junior-sentry": "0.
|
|
119
|
+
"@sentry/junior-github": "0.313.0",
|
|
120
|
+
"@sentry/junior-notion": "0.313.0",
|
|
121
|
+
"@sentry/junior-sentry": "0.313.0",
|
|
122
122
|
"@sentry/junior-testing": "0.0.0",
|
|
123
123
|
"@types/node": "^24.19.2",
|
|
124
124
|
"@types/pg": "^8.15.6",
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
import { d as getQueueProvider } from "./vercel-queue-hW90XzbG.js";
|
|
2
|
-
import { r as getChatConfig } from "./config-kXB2Y5tl.js";
|
|
3
|
-
import { AsyncLocalStorage } from "node:async_hooks";
|
|
4
|
-
// src/chat/runtime/request-deadline.ts
|
|
5
|
-
const requestDeadlineStorage = new AsyncLocalStorage();
|
|
6
|
-
function createTurnRequestDeadline(startedAtMs) {
|
|
7
|
-
return {
|
|
8
|
-
startedAtMs,
|
|
9
|
-
deadlineAtMs: startedAtMs + Math.max(1, getChatConfig().functionMaxDurationSeconds * 1e3 - 2e4)
|
|
10
|
-
};
|
|
11
|
-
}
|
|
12
|
-
/** Return the host request deadline inherited by the current async turn. */
|
|
13
|
-
function getTurnRequestDeadline() {
|
|
14
|
-
return requestDeadlineStorage.getStore();
|
|
15
|
-
}
|
|
16
|
-
/** Run work under the current host request deadline, or start one. */
|
|
17
|
-
function runWithTurnRequestDeadline(callback, startedAtMs = Date.now()) {
|
|
18
|
-
if (requestDeadlineStorage.getStore()) return callback();
|
|
19
|
-
return runWithNewTurnRequestDeadline(callback, startedAtMs);
|
|
20
|
-
}
|
|
21
|
-
/** Run work that a new host request owns, even inside another request. */
|
|
22
|
-
function runWithNewTurnRequestDeadline(callback, startedAtMs = Date.now()) {
|
|
23
|
-
return requestDeadlineStorage.run(createTurnRequestDeadline(startedAtMs), callback);
|
|
24
|
-
}
|
|
25
|
-
// src/chat/queue/callback.ts
|
|
26
|
-
/** Shared queue callback wiring for signed messages. */
|
|
27
|
-
/** Build the HTTP callback and local-dev consumer for one signed queue. */
|
|
28
|
-
function queueCallback(options) {
|
|
29
|
-
const consume = async (message, metadata) => {
|
|
30
|
-
if (options.skip?.(metadata)) return;
|
|
31
|
-
try {
|
|
32
|
-
await runWithTurnRequestDeadline(() => options.run(message, metadata));
|
|
33
|
-
} catch (error) {
|
|
34
|
-
const reason = options.permanentError?.(error);
|
|
35
|
-
if (!reason) throw error;
|
|
36
|
-
options.onRejected(reason, metadata, error);
|
|
37
|
-
}
|
|
38
|
-
};
|
|
39
|
-
const handler = async (value, metadata) => {
|
|
40
|
-
if (options.skip?.(metadata)) return;
|
|
41
|
-
const checked = options.verify(value);
|
|
42
|
-
if (checked.status === "rejected") {
|
|
43
|
-
options.onRejected(checked.reason, metadata);
|
|
44
|
-
return;
|
|
45
|
-
}
|
|
46
|
-
if (checked.status === "unavailable") throw new Error(`Queue message verification unavailable: ${checked.reason}`);
|
|
47
|
-
await runWithNewTurnRequestDeadline(() => consume(checked.message, metadata));
|
|
48
|
-
};
|
|
49
|
-
const retry = (error, metadata) => {
|
|
50
|
-
const reason = options.permanentError?.(error);
|
|
51
|
-
if (reason) {
|
|
52
|
-
options.onRejected(reason, metadata, error);
|
|
53
|
-
return { acknowledge: true };
|
|
54
|
-
}
|
|
55
|
-
if (options.maxDeliveries !== null && metadata.deliveryCount >= options.maxDeliveries) return { acknowledge: true };
|
|
56
|
-
};
|
|
57
|
-
const consumer = {
|
|
58
|
-
consumerGroup: options.consumerGroup,
|
|
59
|
-
handler,
|
|
60
|
-
retry,
|
|
61
|
-
topic: options.topic,
|
|
62
|
-
visibilityTimeoutSeconds: options.visibilityTimeoutSeconds
|
|
63
|
-
};
|
|
64
|
-
return {
|
|
65
|
-
/** Run a message that an in-process queue already trusts. */
|
|
66
|
-
consume,
|
|
67
|
-
consumer,
|
|
68
|
-
create: () => getQueueProvider().createCallback(consumer),
|
|
69
|
-
registerDev: () => {
|
|
70
|
-
if (process.env["NODE_ENV"] !== "development") return;
|
|
71
|
-
return getQueueProvider().registerDevConsumer?.(consumer);
|
|
72
|
-
}
|
|
73
|
-
};
|
|
74
|
-
}
|
|
75
|
-
export { getTurnRequestDeadline as n, queueCallback as t };
|
|
@@ -1,179 +0,0 @@
|
|
|
1
|
-
import { s as getSqlExecutor } from "./db-LAyyX8tk.js";
|
|
2
|
-
import { un as readInboundMessageSender } from "./thread-state-DhPndWi1.js";
|
|
3
|
-
import { x as juniorAgentInvocations } from "./executor-SCub-fAq.js";
|
|
4
|
-
import { createHash } from "node:crypto";
|
|
5
|
-
import { inArray } from "drizzle-orm";
|
|
6
|
-
// src/chat/agent-invocations/ids.ts
|
|
7
|
-
const CREATE_LOCK_PREFIX = "junior:agent_invocation:create";
|
|
8
|
-
/**
|
|
9
|
-
* Return the SQL lock that one parent Conversation takes to start, message,
|
|
10
|
-
* or stop its child agents.
|
|
11
|
-
*/
|
|
12
|
-
function getChildAgentLockName(parentConversationId) {
|
|
13
|
-
return `${CREATE_LOCK_PREFIX}:${parentConversationId}`;
|
|
14
|
-
}
|
|
15
|
-
function stableId(prefix, ...parts) {
|
|
16
|
-
return `${prefix}:${createHash("sha256").update(parts.join("\0")).digest("hex").slice(0, 32)}`;
|
|
17
|
-
}
|
|
18
|
-
/** Return the stable identity for one retry-safe delegated task. */
|
|
19
|
-
function getAgentInvocationId(parentConversationId, idempotencyKey) {
|
|
20
|
-
return stableId("agent-invocation", parentConversationId, idempotencyKey);
|
|
21
|
-
}
|
|
22
|
-
/** Return the stable child identity for one invocation without a named binding. */
|
|
23
|
-
function getUnnamedAgentConversationId(invocationId) {
|
|
24
|
-
return stableId("agent", invocationId);
|
|
25
|
-
}
|
|
26
|
-
/** Return the stable child identity for one named binding. */
|
|
27
|
-
function getNamedAgentConversationId(parentConversationId, name) {
|
|
28
|
-
return stableId("agent", parentConversationId, name);
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* Return the stable identity of the agent invocation that gives one child
|
|
32
|
-
* agent result to the child Conversation that started that child agent.
|
|
33
|
-
*/
|
|
34
|
-
function getAgentInvocationIdForResult(resultInvocationId) {
|
|
35
|
-
return stableId("agent-invocation", "result", resultInvocationId);
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
* Return the stable identity of the agent invocation that gives one message
|
|
39
|
-
* from a child agent to the child Conversation that started that child agent.
|
|
40
|
-
*/
|
|
41
|
-
function getAgentInvocationIdForMessage(messageId) {
|
|
42
|
-
return stableId("agent-invocation", "message", messageId);
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* Return the stable identity of the agent invocation that gives one batch of
|
|
46
|
-
* watch events to a child Conversation. The first message of the batch names
|
|
47
|
-
* it.
|
|
48
|
-
*/
|
|
49
|
-
function getAgentInvocationIdForEvents(messageId) {
|
|
50
|
-
return stableId("agent-invocation", "events", messageId);
|
|
51
|
-
}
|
|
52
|
-
/** Return the stable turn identity advanced by one agent invocation. */
|
|
53
|
-
function getAgentInvocationTurnId(invocationId) {
|
|
54
|
-
return `agent-invocation:${invocationId}`;
|
|
55
|
-
}
|
|
56
|
-
/** Return the stable mailbox identity for one agent invocation. */
|
|
57
|
-
function getAgentInvocationMessageId(invocationId) {
|
|
58
|
-
return `agent-invocation:${invocationId}:input`;
|
|
59
|
-
}
|
|
60
|
-
const REPLY_MESSAGE_PREFIX = "agent-reply:";
|
|
61
|
-
/**
|
|
62
|
-
* Return the parent mailbox identity of one child agent `reply` call.
|
|
63
|
-
* `senderId` is the Agent invocation that sent it, or the child Conversation
|
|
64
|
-
* when no Agent invocation names the child.
|
|
65
|
-
*/
|
|
66
|
-
function getAgentReplyMessageId(senderId, toolCallId) {
|
|
67
|
-
return `${REPLY_MESSAGE_PREFIX}${senderId}:${toolCallId}`;
|
|
68
|
-
}
|
|
69
|
-
/**
|
|
70
|
-
* Return the key of the `reply` of one Turn on a child's Conversation loop.
|
|
71
|
-
* Readers take the sender from the message's sender fields, not this key.
|
|
72
|
-
*/
|
|
73
|
-
function getTurnReplyKey(turnId, toolCallId) {
|
|
74
|
-
return `${turnId}:${toolCallId}`;
|
|
75
|
-
}
|
|
76
|
-
/** Return the stable parent mailbox identity for one terminal result. */
|
|
77
|
-
function getAgentInvocationResultMessageId(invocationId) {
|
|
78
|
-
return `agent-invocation:${invocationId}:result`;
|
|
79
|
-
}
|
|
80
|
-
// src/chat/agent-invocations/child-message.ts
|
|
81
|
-
/** Mailbox metadata that stores who sent one child reply or result. */
|
|
82
|
-
function childMessageSenderMetadata(sender) {
|
|
83
|
-
return { sender };
|
|
84
|
-
}
|
|
85
|
-
/** Read who sent one child reply or result in a parent's mailbox. */
|
|
86
|
-
async function readChildMessageSender(message) {
|
|
87
|
-
return readInboundMessageSender(message) ?? (await readLegacyChildMessageSenders([message.inboundMessageId])).get(message.inboundMessageId);
|
|
88
|
-
}
|
|
89
|
-
/**
|
|
90
|
-
* Read who sent each child reply or result, in message order. Messages
|
|
91
|
-
* without stored sender fields share one legacy read.
|
|
92
|
-
*/
|
|
93
|
-
async function readChildMessageSenders(messages) {
|
|
94
|
-
const stored = messages.map((message) => readInboundMessageSender(message));
|
|
95
|
-
const legacy = await readLegacyChildMessageSenders(messages.flatMap((message, index) => stored[index] ? [] : [message.inboundMessageId]));
|
|
96
|
-
return messages.map((message, index) => stored[index] ?? legacy.get(message.inboundMessageId));
|
|
97
|
-
}
|
|
98
|
-
/**
|
|
99
|
-
* List the child replies and results among the ids that reached one
|
|
100
|
-
* mailbox, oldest first, with the sender fields that the mailbox keeps.
|
|
101
|
-
*/
|
|
102
|
-
async function listChildMessages(inboundMessageIds, messageSenders) {
|
|
103
|
-
const legacy = await readLegacyChildMessageSenders(inboundMessageIds.filter((id) => !messageSenders[id]));
|
|
104
|
-
return inboundMessageIds.flatMap((inboundMessageId) => {
|
|
105
|
-
const sender = messageSenders[inboundMessageId] ?? legacy.get(inboundMessageId);
|
|
106
|
-
return sender ? [{
|
|
107
|
-
inboundMessageId,
|
|
108
|
-
sender
|
|
109
|
-
}] : [];
|
|
110
|
-
});
|
|
111
|
-
}
|
|
112
|
-
/**
|
|
113
|
-
* Return the Agent invocation whose own Turn sent the message. A Turn on the
|
|
114
|
-
* child's Conversation loop has none, even when the message names the
|
|
115
|
-
* child's newest Agent invocation.
|
|
116
|
-
*
|
|
117
|
-
* TODO(dcramer): Remove with Agent invocation rows (#3060 step 7).
|
|
118
|
-
*/
|
|
119
|
-
function ownAgentInvocation(sender) {
|
|
120
|
-
const { agentInvocationId } = sender;
|
|
121
|
-
return agentInvocationId && sender.turnId === getAgentInvocationTurnId(agentInvocationId) ? agentInvocationId : void 0;
|
|
122
|
-
}
|
|
123
|
-
/** Return whether the message is the result of an Agent invocation. */
|
|
124
|
-
function isAgentInvocationResult(message) {
|
|
125
|
-
const agentInvocationId = ownAgentInvocation(message.sender);
|
|
126
|
-
return agentInvocationId !== void 0 && message.inboundMessageId === getAgentInvocationResultMessageId(agentInvocationId);
|
|
127
|
-
}
|
|
128
|
-
/**
|
|
129
|
-
* Return whether one Agent invocation sent a reply to its parent: a message
|
|
130
|
-
* names it as sender and is not its own result.
|
|
131
|
-
*/
|
|
132
|
-
function hasAgentInvocationReply(messages, agentInvocationId) {
|
|
133
|
-
return messages.some((message) => message.sender.agentInvocationId === agentInvocationId && !isAgentInvocationResult(message));
|
|
134
|
-
}
|
|
135
|
-
const LEGACY_REPLY_ID = /^agent-reply:(agent(?:-invocation)?:[0-9a-f]{32}):(?:(turn_[A-Za-z0-9_-]+)(?::|$))?/;
|
|
136
|
-
const LEGACY_RESULT_ID = /^agent-invocation:(agent-invocation:[0-9a-f]{32}):result$/;
|
|
137
|
-
/**
|
|
138
|
-
* Read the sender of child messages that reached a mailbox before senders
|
|
139
|
-
* stored their fields, from their ids.
|
|
140
|
-
*
|
|
141
|
-
* TODO: remove one release after this ships. Step 7 of #3060 deletes it and
|
|
142
|
-
* makes the id a plain generated key.
|
|
143
|
-
*/
|
|
144
|
-
async function readLegacyChildMessageSenders(inboundMessageIds) {
|
|
145
|
-
const senders = /* @__PURE__ */ new Map();
|
|
146
|
-
const byAgentInvocation = /* @__PURE__ */ new Map();
|
|
147
|
-
for (const id of inboundMessageIds) {
|
|
148
|
-
const result = LEGACY_RESULT_ID.exec(id);
|
|
149
|
-
const reply = result ? void 0 : LEGACY_REPLY_ID.exec(id);
|
|
150
|
-
const senderId = result?.[1] ?? reply?.[1];
|
|
151
|
-
if (!senderId) continue;
|
|
152
|
-
const turnId = reply?.[2];
|
|
153
|
-
if (senderId.startsWith("agent-invocation:")) byAgentInvocation.set(id, {
|
|
154
|
-
agentInvocationId: senderId,
|
|
155
|
-
turnId
|
|
156
|
-
});
|
|
157
|
-
else if (turnId) senders.set(id, {
|
|
158
|
-
conversationId: senderId,
|
|
159
|
-
turnId
|
|
160
|
-
});
|
|
161
|
-
}
|
|
162
|
-
if (byAgentInvocation.size === 0) return senders;
|
|
163
|
-
const rows = await getSqlExecutor().db().select({
|
|
164
|
-
childConversationId: juniorAgentInvocations.childConversationId,
|
|
165
|
-
invocationId: juniorAgentInvocations.invocationId
|
|
166
|
-
}).from(juniorAgentInvocations).where(inArray(juniorAgentInvocations.invocationId, [...new Set([...byAgentInvocation.values()].map((s) => s.agentInvocationId))]));
|
|
167
|
-
const childOf = new Map(rows.map((row) => [row.invocationId, row.childConversationId]));
|
|
168
|
-
for (const [id, { agentInvocationId, turnId }] of byAgentInvocation) {
|
|
169
|
-
const conversationId = childOf.get(agentInvocationId);
|
|
170
|
-
if (!conversationId) continue;
|
|
171
|
-
senders.set(id, {
|
|
172
|
-
agentInvocationId,
|
|
173
|
-
conversationId,
|
|
174
|
-
turnId: turnId ?? getAgentInvocationTurnId(agentInvocationId)
|
|
175
|
-
});
|
|
176
|
-
}
|
|
177
|
-
return senders;
|
|
178
|
-
}
|
|
179
|
-
export { getNamedAgentConversationId as _, ownAgentInvocation as a, getAgentInvocationId as c, getAgentInvocationIdForResult as d, getAgentInvocationMessageId as f, getChildAgentLockName as g, getAgentReplyMessageId as h, listChildMessages as i, getAgentInvocationIdForEvents as l, getAgentInvocationTurnId as m, hasAgentInvocationReply as n, readChildMessageSender as o, getAgentInvocationResultMessageId as p, isAgentInvocationResult as r, readChildMessageSenders as s, childMessageSenderMetadata as t, getAgentInvocationIdForMessage as u, getTurnReplyKey as v, getUnnamedAgentConversationId as y };
|