@sentry/junior 0.313.0 → 0.314.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-CYAvJzZS.js → adapter-JARQvoLw.js} +1 -2
- package/dist/{adapter-context-CVsHoVSf.js → adapter-context-B4BrJZuS.js} +2 -2
- package/dist/{admin-Cyhb4TwZ.js → admin-BXGAySz0.js} +1 -1
- package/dist/{agent-runner-B5y9MsT-.js → agent-runner-qZU5TR8i.js} +797 -118
- package/dist/agent-update-cS7Z9mnG.js +26 -0
- package/dist/agent-update-delivery-CZ5M8RDa.js +85 -0
- package/dist/api/schema.d.ts +2 -2
- package/dist/api/schema.js +6 -6
- package/dist/api.d.ts +1 -1
- package/dist/api.js +334 -100
- package/dist/{app-DA8-hCMj.d.ts → app-D7tKnw9a.d.ts} +4 -21
- package/dist/app.d.ts +2 -2
- package/dist/app.js +80 -169
- package/dist/{background-compaction-queue-iZXadLV3.js → background-compaction-queue-C_uIBUvS.js} +6 -67
- package/dist/callback-C8SdXCwr.js +68 -0
- package/dist/{catalog-runtime-kkE3hvCX.js → catalog-runtime-BLKtnUL3.js} +1 -1
- package/dist/{channel-access-mt7K6dPh.js → channel-access-BOL29BG3.js} +6 -6
- package/dist/child-message--2G3Ft26.js +19 -0
- package/dist/cli/chat.js +18 -21
- package/dist/cli/check.js +4 -4
- package/dist/cli/main.js +2 -2
- package/dist/cli/plugins.js +5 -5
- package/dist/cli/snapshot-create.js +5 -5
- package/dist/cli/upgrade.d.ts +1 -1
- package/dist/cli/upgrade.js +23 -4
- package/dist/{config-CWbwKj0j.js → config-BIfHKNXN.js} +40 -35
- package/dist/{continue-in-slack-CxyFzdlF.js → continue-in-slack-fnmD2Ifb.js} +5 -7
- package/dist/{conversation-feed-BEXLD3Me.js → conversation-feed-DdFQuQDR.js} +1 -1
- package/dist/{logging-DNt-qOIO.js → conversation-privacy-DtZhI91r.js} +188 -2
- package/dist/{conversation-turn-B35eu0uz.js → conversation-turn-DScuDYmN.js} +418 -33
- package/dist/create-CrNt4Ewu.js +212 -0
- package/dist/{credential-sync-DWTOEQrm.js → credential-sync-CtqsGjj1.js} +14 -17
- package/dist/{credentialed-Dyv8b-lu.js → credentialed-dWRA3-oJ.js} +910 -426
- package/dist/{db-PwSRzWWn.js → db-BTmLKZrp.js} +2235 -38
- package/dist/{db-DYGcXYl3.d.ts → db-DcmzbA55.d.ts} +2 -2
- package/dist/{history-CYstOMKX.js → history-CneKY7_V.js} +19 -1
- package/dist/{html-DidUcRhI.js → html-B8rBt7F4.js} +5 -7
- package/dist/{install-2urLLXNt.js → install-OtFboxOM.js} +2 -2
- package/dist/instrumentation.js +2 -2
- package/dist/{lineage-BXplQAVH.js → lineage-EULJkGO1.js} +1 -2
- package/dist/{list-DyIyReSV.js → list-C5400AlJ.js} +235 -77
- package/dist/{turn-membership-DTR3SaKD.js → mailbox-turn-DL3Lvsm0.js} +4698 -587
- package/dist/markers-DUP8aBOp.js +323 -0
- package/dist/{media-B0pZJ0bG.js → media-FYM-Bl3H.js} +33 -8
- package/dist/{message-Z5YKC-Af.js → message-DuDelZFr.js} +16 -29
- package/dist/{model-input-BhPJYdSV.js → model-input-0osF3pBS.js} +3 -3
- package/dist/nitro.d.ts +2 -4
- package/dist/nitro.js +340 -13
- package/dist/{oauth-callback-server-ByvDdcdY.js → oauth-callback-server-DX2fQ7Nq.js} +2 -2
- package/dist/{oauth-relay-D-kK0yoN.js → oauth-relay-PwPMdZJv.js} +1 -1
- package/dist/{plugins-Bkk0XRo2.js → plugins-BXMdNdyA.js} +1 -1
- package/dist/{registry-POH4bZC4.js → registry-D6kS6xYH.js} +1402 -64
- package/dist/{resolve-CWtBNSKP.js → resolve-D8CPJcNK.js} +3 -3
- package/dist/result-D090hxr5.js +402 -0
- package/dist/{runner-CsZ_VRxp.js → runner-BU7fgrm-.js} +7 -8
- package/dist/{sandbox-egress-signals-FbCk1FkN.js → sandbox-egress-signals-BUmVrsoG.js} +1 -1
- package/dist/{schema-DojR2uCL.js → schema-7gW9vBpJ.js} +90 -9
- package/dist/{schema-DBf18QPS.d.ts → schema-BB6E0wyV.d.ts} +138 -5
- package/dist/{service-account-CDYb9hfX.js → service-account-plA-uzIB.js} +6 -5
- package/dist/{skills-B0jP4whm.js → skills-CIosT6bS.js} +3 -3
- package/dist/{slack-conversation-unfurl-D26t9kBC.js → slack-conversation-unfurl-CBgZqth6.js} +8 -10
- package/dist/{spawn-BjljgExZ.js → spawn-DRjdzh3R.js} +9 -17
- package/dist/{start-conversation-DbVujrwO.js → start-conversation-a4NXH4X9.js} +12 -15
- package/dist/{store-CjXrp-Up.js → store-BuhF1QDm.js} +2 -4
- package/dist/{task-queue-Cwlatjz3.js → task-queue-CrRjFzOh.js} +5 -16
- package/dist/{task-runner--Ke8KSMf.js → task-runner-C-pXsgHM.js} +104 -50
- package/dist/{thread-context-B8exINEe.js → thread-context-CDX4dSZd.js} +8 -9
- package/dist/turn-session-routing-CZTRU8IY.js +116 -0
- package/dist/turn-wake-Bzq1Efrm.js +154 -0
- package/dist/user-customization-B27StpVQ.js +9 -0
- package/dist/{validation-Ce0qbMlT.js → validation-bTq88sya.js} +1 -1
- package/dist/{vercel-queue-q4z8w5QO.js → vercel-queue-nL0Hq3hr.js} +32 -147
- package/dist/{version-DFh4n9nr.js → version-DGUa1dZK.js} +1 -1
- package/dist/version.js +1 -1
- package/dist/{warmup-D5hzqTcp.js → warmup-CCOuIwAS.js} +639 -137
- package/dist/{worker-CDg9Lbpg.js → worker-AkZg7Dg1.js} +5 -6
- package/migrations/0160_money_micro_usd_repair.sql +99 -0
- package/migrations/0161_agent_config_backfill.sql +34 -0
- package/migrations/0162_inbox_item_deliveries.sql +15 -0
- package/migrations/0163_pg_trgm.sql +2 -0
- package/migrations/0164_search_indexes.sql +4 -0
- package/migrations/0165_drop_legacy_archive_columns.sql +4 -0
- package/migrations/0166_memory_prefix_index.sql +1 -0
- package/migrations/0167_todo_search_indexes.sql +2 -0
- package/migrations/0168_todo_inbox_items.sql +4 -0
- package/migrations/0169_drop_code_urls.sql +2 -0
- package/migrations/meta/0160_snapshot.json +6515 -0
- package/migrations/meta/0161_snapshot.json +6278 -0
- package/migrations/meta/0162_snapshot.json +6404 -0
- package/migrations/meta/0163_snapshot.json +6404 -0
- package/migrations/meta/0164_snapshot.json +6466 -0
- package/migrations/meta/0165_snapshot.json +6466 -0
- package/migrations/meta/0166_snapshot.json +6494 -0
- package/migrations/meta/0167_snapshot.json +6525 -0
- package/migrations/meta/0168_snapshot.json +6525 -0
- package/migrations/meta/0169_snapshot.json +6513 -0
- package/migrations/meta/_journal.json +70 -0
- package/package.json +9 -18
- package/skills/design-automation-skill/SKILL.md +2 -3
- package/dist/actor-BsBdxDXQ.js +0 -208
- package/dist/conversation-privacy-BrMiDN61.js +0 -189
- package/dist/executor-CgWyWfYz.js +0 -1858
- package/dist/fan-out-Cod-yEHG.js +0 -10
- package/dist/ingest-B0AggUEC.js +0 -7931
- package/dist/request-deadline-BUiRYQYj.js +0 -24
- package/dist/service-account-o15pZWcJ.js +0 -931
- package/dist/state-BTawTCme.js +0 -161
- package/dist/statuses-BKwqCPhj.js +0 -69
|
@@ -0,0 +1,323 @@
|
|
|
1
|
+
import { g as TURN_REASONING_LEVELS, gt as mapBounded } from "./config-BIfHKNXN.js";
|
|
2
|
+
import { Ar as juniorConversationEvents, Br as juniorConversations, L as isPersonInput, Sr as juniorAgentBindings, ct as conversationTurnFailedSql, i as getConversationStore, n as getConversationEventStore, o as getSqlExecutor } from "./db-BTmLKZrp.js";
|
|
3
|
+
import { q as credentialContextSchema } from "./registry-D6kS6xYH.js";
|
|
4
|
+
import { An as conversationSubtreeColumns, Bt as getConversationWorkState, E as isPersonStopTurnId, K as getConversationStoppedAtMs, On as buildDeterministicTurnId, P as isEventMailboxMetadata, Vt as getConversationWorkStates, _ as readChildOfStoredParent, b as readAgentConfig, bi as readParentMessage, hi as readInboundMessageSender, i as listActiveMailboxTurns, kn as conversationSubtree, r as listActiveMailboxTurnSources } from "./mailbox-turn-DL3Lvsm0.js";
|
|
5
|
+
import { sn as isAgentUpdateEventType, ut as agentTypeSchema } from "./media-FYM-Bl3H.js";
|
|
6
|
+
import * as z from "zod";
|
|
7
|
+
import pLimit from "p-limit";
|
|
8
|
+
import { actorSchema } from "@sentry/junior-plugin-api";
|
|
9
|
+
import { and, desc, eq, inArray, isNotNull, ne, sql } from "drizzle-orm";
|
|
10
|
+
import { alias } from "drizzle-orm/pg-core";
|
|
11
|
+
// src/chat/agent-invocations/child-input.ts
|
|
12
|
+
/** Read the child that one reply or message Event names. */
|
|
13
|
+
function childAgentInput(message) {
|
|
14
|
+
const metadata = message.input.metadata;
|
|
15
|
+
if (!isEventMailboxMetadata(metadata) || metadata.event.namespace !== "junior") return;
|
|
16
|
+
if (metadata.event.eventType === "agent.message") return {
|
|
17
|
+
kind: "message",
|
|
18
|
+
senderId: metadata.event.identifier
|
|
19
|
+
};
|
|
20
|
+
return isAgentUpdateEventType(metadata.event.eventType) && metadata.event.subscriptionId === void 0 ? {
|
|
21
|
+
kind: "reply",
|
|
22
|
+
senderId: metadata.event.identifier
|
|
23
|
+
} : void 0;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Return whether a Conversation drops one input, so it starts no work.
|
|
27
|
+
* Routing, the stop skips, and the child agent status all read this, so they
|
|
28
|
+
* agree on which input starts work.
|
|
29
|
+
*
|
|
30
|
+
* A parent message is dropped when it does not come from the stored parent,
|
|
31
|
+
* or when it was sent before the child's stop. A child reply that a stop
|
|
32
|
+
* skips is dropped too. A stopped Conversation never reads other automated
|
|
33
|
+
* input: `enqueueAutomatedInput` and the stop hold it first.
|
|
34
|
+
*/
|
|
35
|
+
async function isDroppedChildInput(message) {
|
|
36
|
+
if (isPersonInput(message.source)) return false;
|
|
37
|
+
const parentMessage = readParentMessage(message);
|
|
38
|
+
if (parentMessage) {
|
|
39
|
+
const child = await readChildOfStoredParent(message, parentMessage);
|
|
40
|
+
if (!child) return true;
|
|
41
|
+
const stoppedAtMs = child.stoppedAt?.getTime();
|
|
42
|
+
return stoppedAtMs !== void 0 && message.receivedAtMs <= stoppedAtMs;
|
|
43
|
+
}
|
|
44
|
+
return childAgentInput(message)?.kind === "reply" && await isSkippedReply(message);
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Return whether a stop skipped this reply. A stop drops a child's unread
|
|
48
|
+
* replies from the parent's mailbox. One sent before the stop can reach the
|
|
49
|
+
* mailbox after that drop, so while the sending child is stopped, a reply
|
|
50
|
+
* that it sent after the stop is dropped too, except the `stopped` result
|
|
51
|
+
* that a person's stop sends. A message that a child sent is still
|
|
52
|
+
* delivered.
|
|
53
|
+
*/
|
|
54
|
+
async function isSkippedReply(message) {
|
|
55
|
+
const sender = readInboundMessageSender(message);
|
|
56
|
+
if (!sender || isPersonStopTurnId(sender.turnId)) return false;
|
|
57
|
+
const senderStoppedAtMs = await getConversationStoppedAtMs(sender.conversationId);
|
|
58
|
+
return senderStoppedAtMs !== void 0 && message.createdAtMs >= senderStoppedAtMs;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Read the sender of one child Conversation from its parent edge and its
|
|
62
|
+
* binding. A Conversation without a parent has none.
|
|
63
|
+
*/
|
|
64
|
+
async function readChildConversationSender(childConversationId) {
|
|
65
|
+
const parent = alias(juniorConversations, "parent");
|
|
66
|
+
const [row] = await getSqlExecutor().db().select({
|
|
67
|
+
agentName: juniorAgentBindings.name,
|
|
68
|
+
parentConversationId: parent.conversationId,
|
|
69
|
+
title: juniorConversations.title
|
|
70
|
+
}).from(juniorConversations).innerJoin(parent, eq(parent.conversationId, juniorConversations.parentConversationId)).leftJoin(juniorAgentBindings, eq(juniorAgentBindings.childConversationId, juniorConversations.conversationId)).where(eq(juniorConversations.conversationId, childConversationId));
|
|
71
|
+
return row ? {
|
|
72
|
+
...row.agentName ? { agentName: row.agentName } : void 0,
|
|
73
|
+
childConversationId,
|
|
74
|
+
parentConversationId: row.parentConversationId,
|
|
75
|
+
...row.title ? { title: row.title } : void 0
|
|
76
|
+
} : void 0;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Read the sender of one reply or message, when it is a child of the
|
|
80
|
+
* Conversation that received it. Otherwise the input has no child sender,
|
|
81
|
+
* such as one that an Agent invocation of an earlier release sent.
|
|
82
|
+
*/
|
|
83
|
+
async function getChildAgentInputSender(message, input) {
|
|
84
|
+
const sender = await readChildConversationSender(input.senderId);
|
|
85
|
+
return sender?.parentConversationId === message.conversationId ? sender : void 0;
|
|
86
|
+
}
|
|
87
|
+
// src/chat/agent-invocations/types.ts
|
|
88
|
+
const exactStringSchema = z.string().min(1).refine((value) => value === value.trim());
|
|
89
|
+
const agentNameSchema = exactStringSchema.max(64);
|
|
90
|
+
/**
|
|
91
|
+
* Kind of a new child Conversation. A Thread is a child that people can
|
|
92
|
+
* message; a Task is one that only its parent messages.
|
|
93
|
+
*/
|
|
94
|
+
const CHILD_AGENT_KINDS = ["thread", "task"];
|
|
95
|
+
/** `messageAgent` target for the parent of a child agent. */
|
|
96
|
+
const PARENT_AGENT_TARGET = "parent";
|
|
97
|
+
const agentBindingSchema = z.object({
|
|
98
|
+
childConversationId: exactStringSchema,
|
|
99
|
+
name: agentNameSchema,
|
|
100
|
+
parentConversationId: exactStringSchema
|
|
101
|
+
}).strict();
|
|
102
|
+
/** Input of one `spawnAgent` call. */
|
|
103
|
+
const spawnChildAgentInputSchema = z.object({
|
|
104
|
+
actor: actorSchema,
|
|
105
|
+
agentName: agentNameSchema.optional(),
|
|
106
|
+
credentialContext: credentialContextSchema.optional(),
|
|
107
|
+
idempotencyKey: exactStringSchema,
|
|
108
|
+
input: exactStringSchema,
|
|
109
|
+
kind: z.enum(CHILD_AGENT_KINDS).default("task"),
|
|
110
|
+
parentConversationId: exactStringSchema,
|
|
111
|
+
parentToolCallId: exactStringSchema,
|
|
112
|
+
agentType: agentTypeSchema.optional(),
|
|
113
|
+
fork: z.literal(true).optional(),
|
|
114
|
+
reasoningLevel: z.enum(TURN_REASONING_LEVELS).optional(),
|
|
115
|
+
title: exactStringSchema.optional()
|
|
116
|
+
}).strict();
|
|
117
|
+
/** How a finished task of a child agent ended. A stop is not a result. */
|
|
118
|
+
const CHILD_AGENT_RESULTS = [
|
|
119
|
+
"completed",
|
|
120
|
+
"blocked",
|
|
121
|
+
"failed"
|
|
122
|
+
];
|
|
123
|
+
// src/chat/agent-invocations/list.ts
|
|
124
|
+
const childAgentKindSchema = z.enum(CHILD_AGENT_KINDS);
|
|
125
|
+
/** Bound the child agents that one listing reads. */
|
|
126
|
+
const CHILD_AGENT_LIST_LIMIT = 200;
|
|
127
|
+
/**
|
|
128
|
+
* List the direct child agents of one parent Conversation, with the newest
|
|
129
|
+
* activity first. The state comes from each child's Turns and mailbox, not
|
|
130
|
+
* from model output. Each child agent stores its agent config, so older
|
|
131
|
+
* children of a parent, such as ones that a removed feature created, are not
|
|
132
|
+
* listed. A child is `running` while a Turn or mailbox input that answers its
|
|
133
|
+
* parent is open, and is `failed` when its last Turn failed, also when the
|
|
134
|
+
* Turn ended with a model error and execution went back to idle. Turns do
|
|
135
|
+
* not store a blocked result, so only a failure sets `lastResult`.
|
|
136
|
+
*/
|
|
137
|
+
async function listChildAgents(parentConversationId) {
|
|
138
|
+
const rows = await getSqlExecutor().db().select({
|
|
139
|
+
agentName: juniorAgentBindings.name,
|
|
140
|
+
archivedAt: juniorConversations.archivedAt,
|
|
141
|
+
conversationId: juniorConversations.conversationId,
|
|
142
|
+
executionUpdatedAt: juniorConversations.executionUpdatedAt,
|
|
143
|
+
kind: juniorConversations.kind,
|
|
144
|
+
stoppedAt: juniorConversations.stoppedAt,
|
|
145
|
+
title: juniorConversations.title,
|
|
146
|
+
turnFailed: conversationTurnFailedSql(juniorConversations),
|
|
147
|
+
updatedAt: juniorConversations.updatedAt
|
|
148
|
+
}).from(juniorConversations).leftJoin(juniorAgentBindings, eq(juniorAgentBindings.childConversationId, juniorConversations.conversationId)).where(and(eq(juniorConversations.parentConversationId, parentConversationId), isNotNull(juniorConversations.agentConfig))).orderBy(desc(sql`coalesce(${juniorConversations.executionUpdatedAt}, ${juniorConversations.updatedAt})`)).limit(CHILD_AGENT_LIST_LIMIT);
|
|
149
|
+
const ids = rows.map((row) => row.conversationId);
|
|
150
|
+
const [workStates, mailboxTurnSources] = await Promise.all([getConversationWorkStates(ids), listActiveMailboxTurnSources(ids)]);
|
|
151
|
+
const limit = pLimit(8);
|
|
152
|
+
return (await Promise.all(rows.map(async (row) => {
|
|
153
|
+
const kind = childAgentKindSchema.parse(row.kind);
|
|
154
|
+
const stoppedAtMs = row.stoppedAt?.getTime();
|
|
155
|
+
const running = stoppedAtMs === void 0 && await limit(() => runsOnConversationLoop(workStates.get(row.conversationId)?.execution.pendingMessages ?? [], mailboxTurnSources.get(row.conversationId) ?? []));
|
|
156
|
+
return {
|
|
157
|
+
...row.agentName ? { agentName: row.agentName } : void 0,
|
|
158
|
+
...row.archivedAt ? { archivedAtMs: row.archivedAt.getTime() } : void 0,
|
|
159
|
+
childConversationId: row.conversationId,
|
|
160
|
+
kind,
|
|
161
|
+
...row.turnFailed && !running ? { lastResult: "failed" } : void 0,
|
|
162
|
+
status: stoppedAtMs !== void 0 ? "stopped" : running ? "running" : row.turnFailed ? "failed" : "completed",
|
|
163
|
+
task: row.title ?? "",
|
|
164
|
+
...row.title ? { title: row.title } : void 0,
|
|
165
|
+
updatedAtMs: (row.executionUpdatedAt ?? row.updatedAt).getTime()
|
|
166
|
+
};
|
|
167
|
+
}))).sort((left, right) => right.updatedAtMs - left.updatedAtMs);
|
|
168
|
+
}
|
|
169
|
+
/** List the ids of the child agents of one parent that have open work. */
|
|
170
|
+
async function listOpenChildAgents(parentConversationId) {
|
|
171
|
+
return (await listChildAgents(parentConversationId)).filter((child) => child.status === "running").map((child) => child.childConversationId);
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* Return whether a child has work that will answer its parent: `pending`
|
|
175
|
+
* input that waits in the mailbox until its Turn commits it, such as a Watch
|
|
176
|
+
* Event in its debounce window, or an open mailbox Turn. Every Turn of a
|
|
177
|
+
* child answers its parent, whoever started it.
|
|
178
|
+
*/
|
|
179
|
+
async function runsOnConversationLoop(pending, mailboxTurnSources) {
|
|
180
|
+
if (mailboxTurnSources.length > 0) return true;
|
|
181
|
+
for (const message of pending) if (!await isDroppedChildInput(message)) return true;
|
|
182
|
+
return false;
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* Return whether input waits in a child's mailbox that will run a later Turn
|
|
186
|
+
* that answers its parent, such as a fired Timer whose Watch is already gone.
|
|
187
|
+
* The input that the running attempt took belongs to its own Turn, which
|
|
188
|
+
* can ack it as late as its end.
|
|
189
|
+
*/
|
|
190
|
+
async function hasWaitingParentWork(conversationId) {
|
|
191
|
+
const work = await getConversationWorkState({ conversationId });
|
|
192
|
+
const running = new Set(work?.runningInboundMessageIds);
|
|
193
|
+
return await runsOnConversationLoop((work?.messages ?? []).filter((message) => !running.has(message.inboundMessageId)), []);
|
|
194
|
+
}
|
|
195
|
+
/**
|
|
196
|
+
* List the ids of a child's open Turns on the Conversation loop. A Turn keeps
|
|
197
|
+
* its input in the mailbox until it commits it, so before its first
|
|
198
|
+
* checkpoint its id comes from its first input. Attempt selection can take
|
|
199
|
+
* any pending input first, so each one gives a candidate id.
|
|
200
|
+
*/
|
|
201
|
+
async function listOpenLoopTurnIds(conversationId) {
|
|
202
|
+
const [turns, work] = await Promise.all([listActiveMailboxTurns(conversationId), getConversationWorkState({ conversationId })]);
|
|
203
|
+
return [...turns.map((turn) => turn.turnId), ...(work?.execution.pendingMessages ?? []).map((message) => buildDeterministicTurnId(message.inboundMessageId))];
|
|
204
|
+
}
|
|
205
|
+
async function listAnsweredLoopChildren(children, parentMessages) {
|
|
206
|
+
if (children.length === 0 || parentMessages.length === 0) return [];
|
|
207
|
+
return (await mapBounded(children, async ({ childConversationId }) => {
|
|
208
|
+
const turnIds = await listOpenLoopTurnIds(childConversationId);
|
|
209
|
+
return parentMessages.some(({ sender }) => sender.conversationId === childConversationId && turnIds.includes(sender.turnId)) ? childConversationId : void 0;
|
|
210
|
+
})).filter((id) => id !== void 0);
|
|
211
|
+
}
|
|
212
|
+
/**
|
|
213
|
+
* List the other child agents of one parent that still run and have not
|
|
214
|
+
* answered. A running child whose open Turn's `reply` is already among
|
|
215
|
+
* `parentMessages`, the child replies and results that reached the parent's
|
|
216
|
+
* mailbox, has answered, so it does not count.
|
|
217
|
+
*/
|
|
218
|
+
async function listUnreportedSiblingAgents(parentConversationId, childConversationId, parentMessages) {
|
|
219
|
+
const running = (await listChildAgents(parentConversationId)).filter((child) => child.childConversationId !== childConversationId && child.status === "running");
|
|
220
|
+
const answered = new Set(await listAnsweredLoopChildren(running, parentMessages));
|
|
221
|
+
return running.filter((child) => !answered.has(child.childConversationId));
|
|
222
|
+
}
|
|
223
|
+
/**
|
|
224
|
+
* List every child agent below one Conversation, at any depth. A parent owns
|
|
225
|
+
* the work of its child agents and of their child agents. The list never has
|
|
226
|
+
* the Conversation itself, its parent, or a sibling.
|
|
227
|
+
*/
|
|
228
|
+
async function listDescendantAgents(conversationId) {
|
|
229
|
+
return (await getSqlExecutor().db().select({
|
|
230
|
+
conversationId: juniorConversations.conversationId,
|
|
231
|
+
name: juniorAgentBindings.name
|
|
232
|
+
}).from(juniorConversations).innerJoin(conversationSubtree([conversationId]), eq(conversationSubtreeColumns.conversationId, juniorConversations.conversationId)).leftJoin(juniorAgentBindings, eq(juniorAgentBindings.childConversationId, juniorConversations.conversationId)).where(ne(juniorConversations.conversationId, conversationId)).orderBy(juniorConversations.conversationId)).map((row) => ({
|
|
233
|
+
conversationId: row.conversationId,
|
|
234
|
+
...row.name ? { name: row.name } : void 0
|
|
235
|
+
}));
|
|
236
|
+
}
|
|
237
|
+
/**
|
|
238
|
+
* List the agents that one Conversation can see. A root Conversation sees
|
|
239
|
+
* only its child agents. A child agent also sees itself, its parent, and the
|
|
240
|
+
* other child agents of its parent.
|
|
241
|
+
*/
|
|
242
|
+
async function listAgentRelatives(input) {
|
|
243
|
+
const { conversationId, parentConversationId } = input;
|
|
244
|
+
const [children, family, parent] = await Promise.all([
|
|
245
|
+
listChildAgents(conversationId),
|
|
246
|
+
parentConversationId ? listChildAgents(parentConversationId) : [],
|
|
247
|
+
parentConversationId ? getConversationStore().get({ conversationId: parentConversationId }) : void 0
|
|
248
|
+
]);
|
|
249
|
+
const self = family.find((agent) => agent.childConversationId === conversationId);
|
|
250
|
+
return {
|
|
251
|
+
children,
|
|
252
|
+
...parent ? { parent: {
|
|
253
|
+
conversationId: parent.conversationId,
|
|
254
|
+
status: parent.execution.status,
|
|
255
|
+
updatedAtMs: parent.execution.updatedAtMs ?? parent.updatedAtMs
|
|
256
|
+
} } : void 0,
|
|
257
|
+
...self ? { self } : void 0,
|
|
258
|
+
siblings: family.filter((agent) => agent.childConversationId !== conversationId)
|
|
259
|
+
};
|
|
260
|
+
}
|
|
261
|
+
// src/chat/agent-invocations/markers.ts
|
|
262
|
+
const SUBAGENT_KIND = "agent";
|
|
263
|
+
const SUBAGENT_STARTED_KEY_PREFIX = "subagent_started:";
|
|
264
|
+
const SUBAGENT_ENDED_KEY_PREFIX = "subagent_ended:";
|
|
265
|
+
/**
|
|
266
|
+
* Record in the parent Conversation that a child agent got one task or
|
|
267
|
+
* message. Write it before the input reaches the child's mailbox, so the
|
|
268
|
+
* child cannot end first.
|
|
269
|
+
*/
|
|
270
|
+
async function recordSubagentStartedMarker(start) {
|
|
271
|
+
await getConversationEventStore().append(start.parentConversationId, [{
|
|
272
|
+
idempotencyKey: `${SUBAGENT_STARTED_KEY_PREFIX}${start.markerId}`,
|
|
273
|
+
data: {
|
|
274
|
+
type: "subagent_started",
|
|
275
|
+
subagentInvocationId: start.markerId,
|
|
276
|
+
subagentKind: SUBAGENT_KIND,
|
|
277
|
+
childConversationId: start.childConversationId,
|
|
278
|
+
...start.agentName ? { agentName: start.agentName } : void 0,
|
|
279
|
+
parentToolCallId: start.parentToolCallId,
|
|
280
|
+
task: start.input,
|
|
281
|
+
...start.title ? { title: start.title } : void 0,
|
|
282
|
+
...start.reasoningLevel ? { reasoningLevel: start.reasoningLevel } : void 0
|
|
283
|
+
},
|
|
284
|
+
createdAtMs: start.createdAtMs
|
|
285
|
+
}]);
|
|
286
|
+
}
|
|
287
|
+
/**
|
|
288
|
+
* Record in the parent Conversation how the work of a child agent ended.
|
|
289
|
+
* Each parent message has its own `subagent_started` marker, named by the
|
|
290
|
+
* message id, and each one that the child already took ends with `outcome`.
|
|
291
|
+
* A parent message that still waits in the child's mailbox stays open,
|
|
292
|
+
* because later work reads it, unless `includeWaiting` is set, as for a stop
|
|
293
|
+
* that skips it. Write it before the child's result reaches the parent.
|
|
294
|
+
*/
|
|
295
|
+
async function recordChildAgentEnded(childConversationId, outcome, options = {}) {
|
|
296
|
+
if (!await readAgentConfig(childConversationId)) return;
|
|
297
|
+
const work = await getConversationWorkState({
|
|
298
|
+
conversationId: childConversationId,
|
|
299
|
+
state: options.state
|
|
300
|
+
});
|
|
301
|
+
const running = new Set(work?.runningInboundMessageIds);
|
|
302
|
+
const waiting = new Set(options.includeWaiting ? [] : (work?.messages ?? []).map((message) => message.inboundMessageId).filter((id) => !running.has(id)));
|
|
303
|
+
const taken = (work?.execution.inboundMessageIds ?? []).filter((id) => !waiting.has(id));
|
|
304
|
+
if (taken.length === 0) return;
|
|
305
|
+
const sender = await readChildConversationSender(childConversationId);
|
|
306
|
+
if (!sender) return;
|
|
307
|
+
const keys = await getSqlExecutor().db().select({ idempotencyKey: juniorConversationEvents.idempotencyKey }).from(juniorConversationEvents).where(and(eq(juniorConversationEvents.conversationId, sender.parentConversationId), inArray(juniorConversationEvents.idempotencyKey, taken.flatMap((id) => [`${SUBAGENT_STARTED_KEY_PREFIX}${id}`, `${SUBAGENT_ENDED_KEY_PREFIX}${id}`]))));
|
|
308
|
+
const found = new Set(keys.map((row) => row.idempotencyKey));
|
|
309
|
+
const open = taken.filter((id) => found.has(`${SUBAGENT_STARTED_KEY_PREFIX}${id}`) && !found.has(`${SUBAGENT_ENDED_KEY_PREFIX}${id}`));
|
|
310
|
+
if (open.length > 0) await appendSubagentEnded(sender.parentConversationId, open, outcome, options.nowMs ?? Date.now());
|
|
311
|
+
}
|
|
312
|
+
async function appendSubagentEnded(parentConversationId, markerIds, outcome, createdAtMs) {
|
|
313
|
+
await getConversationEventStore().append(parentConversationId, markerIds.map((id) => ({
|
|
314
|
+
idempotencyKey: `${SUBAGENT_ENDED_KEY_PREFIX}${id}`,
|
|
315
|
+
data: {
|
|
316
|
+
type: "subagent_ended",
|
|
317
|
+
subagentInvocationId: id,
|
|
318
|
+
outcome
|
|
319
|
+
},
|
|
320
|
+
createdAtMs
|
|
321
|
+
})));
|
|
322
|
+
}
|
|
323
|
+
export { isDroppedChildInput as _, listChildAgents as a, listUnreportedSiblingAgents as c, PARENT_AGENT_TARGET as d, agentBindingSchema as f, getChildAgentInputSender as g, childAgentInput as h, listAgentRelatives as i, CHILD_AGENT_KINDS as l, spawnChildAgentInputSchema as m, recordSubagentStartedMarker as n, listDescendantAgents as o, agentNameSchema as p, hasWaitingParentWork as r, listOpenChildAgents as s, recordChildAgentEnded as t, CHILD_AGENT_RESULTS as u, readChildConversationSender as v };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as conversationTurnFailureReasonSchema,
|
|
1
|
+
import { a as conversationTurnFailureReasonSchema, b as usageSchema, i as conversationTurnFailureCodeSchema } from "./history-CneKY7_V.js";
|
|
2
2
|
import * as z from "zod";
|
|
3
3
|
import { actorUserIdSchema, conversationAnnotationInputSchema, conversationEventPresentationSchema, conversationSidebarAnnotationSchema, destinationVisibilitySchema, eventMatchFieldsSchema, eventMatchSchema, eventReachSchema, eventTypeSchema, objectFactFields, objectTypeSchema, pluginEventTypeSchema, slackDestinationSchema, taskOutcomeSchema } from "@sentry/junior-plugin-api";
|
|
4
4
|
// src/chat/automations/task.ts
|
|
@@ -43,6 +43,27 @@ function automationTaskColumns(task) {
|
|
|
43
43
|
skill: task.skill
|
|
44
44
|
};
|
|
45
45
|
}
|
|
46
|
+
// src/chat/agent-invocations/result-event-type.ts
|
|
47
|
+
/** Event namespace of the messages between a parent and its child agents. */
|
|
48
|
+
const AGENT_INVOCATION_EVENT_NAMESPACE = "junior";
|
|
49
|
+
const AGENT_INVOCATION_RESULT_EVENT_TYPE_PREFIX = "agent_invocation.";
|
|
50
|
+
/** True when an Event type names an agent invocation result. */
|
|
51
|
+
function isAgentInvocationResultEventType(eventType) {
|
|
52
|
+
return eventType.startsWith(AGENT_INVOCATION_RESULT_EVENT_TYPE_PREFIX);
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Event type of an agent update: what a Conversation reports when a Turn
|
|
56
|
+
* ends, it waits on a person, or it stops. A parent gets it from its child
|
|
57
|
+
* agents, and a Watch on the Conversation gets the same Event.
|
|
58
|
+
*/
|
|
59
|
+
const AGENT_UPDATE_EVENT_TYPE = "agent.update";
|
|
60
|
+
const LEGACY_AGENT_REPLY_EVENT_TYPE = "agent.reply";
|
|
61
|
+
/** True when an Event type names an agent update. */
|
|
62
|
+
function isAgentUpdateEventType(eventType) {
|
|
63
|
+
return eventType === "agent.update" || eventType === LEGACY_AGENT_REPLY_EVENT_TYPE;
|
|
64
|
+
}
|
|
65
|
+
/** Event type of a message that a child agent sends to its parent. */
|
|
66
|
+
const AGENT_MESSAGE_EVENT_TYPE = "agent.message";
|
|
46
67
|
// src/chat/inbox-items/user-input-request.ts
|
|
47
68
|
const USER_INPUT_LIMITS = {
|
|
48
69
|
maxButtonOptions: 5,
|
|
@@ -691,8 +712,8 @@ function compileScheduleIntent(args) {
|
|
|
691
712
|
time: parseLocalTime(args.intent.timing.time),
|
|
692
713
|
timezone
|
|
693
714
|
});
|
|
694
|
-
if (nextRunAtMs === void 0) throw new ScheduleIntentError("The requested local date or time does not exist in that timezone.");
|
|
695
|
-
if (nextRunAtMs <= args.nowMs) throw new ScheduleIntentError("The requested one-off schedule must be in the future.");
|
|
715
|
+
if (nextRunAtMs === void 0) throw new ScheduleIntentError("The requested local date or time does not exist in that timezone. Choose another local time.");
|
|
716
|
+
if (nextRunAtMs <= args.nowMs) throw new ScheduleIntentError("The requested one-off schedule must be in the future. Set a time after now.");
|
|
696
717
|
return {
|
|
697
718
|
nextRunAtMs,
|
|
698
719
|
schedule: {
|
|
@@ -720,7 +741,7 @@ function compileScheduleIntent(args) {
|
|
|
720
741
|
recurrence: searchRecurrence,
|
|
721
742
|
timezone
|
|
722
743
|
});
|
|
723
|
-
if (nextRunAtMs === void 0) throw new ScheduleIntentError("The recurring schedule has no valid future occurrence.");
|
|
744
|
+
if (nextRunAtMs === void 0) throw new ScheduleIntentError("The recurring schedule has no valid future occurrence. Change the schedule so that it runs at least once after now.");
|
|
724
745
|
const materializedRecurrence = args.intent.startDate ? recurrence : {
|
|
725
746
|
...recurrence,
|
|
726
747
|
startDate: localDateAt(nextRunAtMs, timezone)
|
|
@@ -1062,9 +1083,9 @@ const conversationTreeStateSchema = z.enum([
|
|
|
1062
1083
|
* reads with its task. Runtime code reads only these fields, never a type
|
|
1063
1084
|
* name, so types can later come from configuration. Types do not limit tools:
|
|
1064
1085
|
* Guardian reviews each child action against the root user's messages, as for
|
|
1065
|
-
* any child. A child keeps its type for later
|
|
1086
|
+
* any child. A child keeps its type for every later task. How a child
|
|
1066
1087
|
* starts, fresh or forked from its parent's history, is not a type: see
|
|
1067
|
-
* `fork`
|
|
1088
|
+
* `fork` in its agent config.
|
|
1068
1089
|
*/
|
|
1069
1090
|
const AGENT_TYPES = ["explore", "reviewer"];
|
|
1070
1091
|
/**
|
|
@@ -1381,7 +1402,7 @@ const conversationReportMessageEventDataSchema = z.object({
|
|
|
1381
1402
|
actorIdentity: actorIdentitySchema.optional(),
|
|
1382
1403
|
/** Identity id of the author. Detail `authors` maps it to the person. */
|
|
1383
1404
|
actorIdentityId: z.string().min(1).optional(),
|
|
1384
|
-
/**
|
|
1405
|
+
/** Set on input that an earlier release's agent wrote, not a person. */
|
|
1385
1406
|
agentInvocationId: z.string().min(1).optional(),
|
|
1386
1407
|
eventType: z.string().min(1).optional(),
|
|
1387
1408
|
/** Namespace of the first Event, such as `github`. */
|
|
@@ -1392,6 +1413,10 @@ const conversationReportMessageEventDataSchema = z.object({
|
|
|
1392
1413
|
*/
|
|
1393
1414
|
eventIdentifier: z.string().min(1).optional(),
|
|
1394
1415
|
eventObjectType: objectTypeSchema.optional(),
|
|
1416
|
+
/** What the first Event says happened, when it is an agent update. */
|
|
1417
|
+
eventStatus: z.string().min(1).optional(),
|
|
1418
|
+
/** Watch that delivered the first Event. */
|
|
1419
|
+
eventWatchId: z.string().min(1).optional(),
|
|
1395
1420
|
explicitMention: z.boolean().optional(),
|
|
1396
1421
|
quiet: z.literal(true).optional(),
|
|
1397
1422
|
trustedSummary: z.string().min(1).optional(),
|
|
@@ -2356,4 +2381,4 @@ function isVisionImageMediaType(mediaType) {
|
|
|
2356
2381
|
const normalized = mediaType.split(";", 1)[0]?.trim().toLowerCase();
|
|
2357
2382
|
return normalized ? INPUT_IMAGE_TYPES.some((type) => type === normalized) : false;
|
|
2358
2383
|
}
|
|
2359
|
-
export { conversationReportStatusSchema as $, formatUserInputAnswer as $t, automationVersionActivateSchema as A, automationContextToolSchema as At, conversationActivityPreviewSchema as B, toolScheduleIntentSchema as Bt, automationRunListSchema as C, removedCardSchema as Ct, automationSchedulePreviewSchema as D, inputFileSchema as Dt, automationScheduleIntentSchema as E, MAX_INPUT_ATTACHMENTS as Et, scheduledAutomationSummarySchema as F, scheduledAutomationSchema as Ft, conversationDetailReportSchema as G, isValidTimeZone as Gt, conversationAttachmentQuerySchema as H, getFirstRunAtMs as Ht, CONVERSATION_DETAIL_VERSION_HEADER as I, scheduledRunSchema as It, conversationEventsQuerySchema as J, inboxItemRequestSchema as Jt, conversationEventHistorySchema as K, eventAutomationSchema as Kt, CONVERSATION_VERSION_HEADER as L, ScheduleIntentError as Lt, automationVersionParamsSchema as M, automationTitleSchema as Mt, automationVersionSchema as N, taskOutcomeInputSchema as Nt, automationSummarySchema as O, messageAttachmentSchema as Ot, eventAutomationSummarySchema as P, SCHEDULED_AUTOMATION_SYSTEM_ACTOR as Pt, conversationReportMessageEventSchema as Q, buttonUserInputField as Qt, acceptedConversationMessageSchema as R, compileScheduleIntent as Rt, automationParamsSchema as S, readMessageCardRefs as St, automationRunWindowsSchema as T, MAX_ATTACHMENT_BYTES as Tt, conversationAuxiliaryCostsSchema as U, getNextRunAtMs as Ut, conversationAttachmentParamsSchema as V, weekdaySchema as Vt, conversationDetailQuerySchema as W, getZonedDateTimeParts as Wt, conversationReportEventDataSchema as X, USER_INPUT_NOTE as Xt, conversationParamsSchema as Y, USER_INPUT_LIMITS as Yt, conversationReportEventSchema as Z, answeredChoices as Zt, automationLifecycleSchema as _, conversationReadPositionSchema as _t, DEFAULT_NOTIFICATION_SCHEDULE as a,
|
|
2384
|
+
export { conversationReportStatusSchema as $, formatUserInputAnswer as $t, automationVersionActivateSchema as A, automationContextToolSchema as At, conversationActivityPreviewSchema as B, toolScheduleIntentSchema as Bt, automationRunListSchema as C, removedCardSchema as Ct, automationSchedulePreviewSchema as D, inputFileSchema as Dt, automationScheduleIntentSchema as E, MAX_INPUT_ATTACHMENTS as Et, scheduledAutomationSummarySchema as F, scheduledAutomationSchema as Ft, conversationDetailReportSchema as G, isValidTimeZone as Gt, conversationAttachmentQuerySchema as H, getFirstRunAtMs as Ht, CONVERSATION_DETAIL_VERSION_HEADER as I, scheduledRunSchema as It, conversationEventsQuerySchema as J, inboxItemRequestSchema as Jt, conversationEventHistorySchema as K, eventAutomationSchema as Kt, CONVERSATION_VERSION_HEADER as L, ScheduleIntentError as Lt, automationVersionParamsSchema as M, automationTitleSchema as Mt, automationVersionSchema as N, taskOutcomeInputSchema as Nt, automationSummarySchema as O, messageAttachmentSchema as Ot, eventAutomationSummarySchema as P, SCHEDULED_AUTOMATION_SYSTEM_ACTOR as Pt, conversationReportMessageEventSchema as Q, buttonUserInputField as Qt, acceptedConversationMessageSchema as R, compileScheduleIntent as Rt, automationParamsSchema as S, readMessageCardRefs as St, automationRunWindowsSchema as T, MAX_ATTACHMENT_BYTES as Tt, conversationAuxiliaryCostsSchema as U, getNextRunAtMs as Ut, conversationAttachmentParamsSchema as V, weekdaySchema as Vt, conversationDetailQuerySchema as W, getZonedDateTimeParts as Wt, conversationReportEventDataSchema as X, USER_INPUT_NOTE as Xt, conversationParamsSchema as Y, USER_INPUT_LIMITS as Yt, conversationReportEventSchema as Z, answeredChoices as Zt, automationLifecycleSchema as _, conversationReadPositionSchema as _t, DEFAULT_NOTIFICATION_SCHEDULE as a, AGENT_UPDATE_EVENT_TYPE as an, idempotencyKeySchema as at, automationListQuerySchema as b, messageCardRef as bt, CONTENT_VERSION_HEADER as c, automationSkillNameSchema as cn, AGENT_TYPES as ct, automationEditSchema as d, automationTaskSchema as dn, formatAgentTypes as dt, isEmptyUserInputAnswer as en, conversationSummaryReportSchema as et, automationEventCatalogSchema as f, automationTaskText as fn, conversationTreeStateSchema as ft, automationExecutionStatusSchema as g, renameConversationResponseSchema as gt, automationExecutionStatusDaySchema as h, renameConversationBodySchema as ht, isVisionImageMediaType as i, AGENT_MESSAGE_EVENT_TYPE as in, createConversationMessageBodySchema as it, automationVersionListSchema as j, automationInstructionToolSchema as jt, automationUpdateSchema as k, readMessageAttachments as kt, apiErrorSchema as l, automationTaskColumns as ln, agentTypeInstructions as lt, automationExecutionSchema as m, conversationTitleSchema as mt, INPUT_IMAGE_TYPES as n, userInputRequestSchema as nn, conversationUsageSchema as nt, isWithinNotificationSchedule as o, isAgentInvocationResultEventType as on, activityPreviewText as ot, automationExecutionListSchema as p, CONVERSATION_TITLE_MAX_LENGTH as pt, conversationEventPageSchema as q, eventAutomationTriggerSchema as qt, detectImageMediaType as r, AGENT_INVOCATION_EVENT_NAMESPACE as rn, createConversationBodySchema as rt, notificationScheduleSchema as s, isAgentUpdateEventType as sn, conversationChildAgentTotalsSchema as st, INLINE_VIDEO_TYPES as t, normalizeUserInputAnswer as tn, conversationSurfaceSchema as tt, automationEditErrorSchema as u, automationTaskDescription as un, agentTypeSchema as ut, automationListItemSchema as v, inboxItemChangeRecordSchema as vt, automationRunSchema as w, resolveMessageCards as wt, automationListSchema as x, messageCardText as xt, automationListPageSchema as y, annotationCard as yt, actorIdentitySchema as z, scheduleIntentFromTool as zt };
|
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-BKpuH2hG.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
2
|
+
import { R as actorFromRun } from "./agent-runner-qZU5TR8i.js";
|
|
3
|
+
import { _t as AgentMessageTargetError, et as findChildAgentConversationId } from "./warmup-CCOuIwAS.js";
|
|
4
|
+
import { d as PARENT_AGENT_TARGET, v as readChildConversationSender } from "./markers-DUP8aBOp.js";
|
|
5
|
+
import { i as enqueueAgentMessageToParent } from "./result-D090hxr5.js";
|
|
6
|
+
import { t as messageChildAgent } from "./create-CrNt4Ewu.js";
|
|
7
|
+
import { Dn as canAccessConversation, Mn as readConversationAccessFromSql, a as getDb, dn as SYSTEM_IDENTITY_ID, i as getConversationStore } from "./db-BTmLKZrp.js";
|
|
8
|
+
import { G as enqueueAutomatedInput, k as EVENT_WAIT_MS } from "./mailbox-turn-DL3Lvsm0.js";
|
|
9
|
+
import { nt as renderDataTag } from "./config-BIfHKNXN.js";
|
|
10
|
+
import { i as leadPersonParticipates } from "./start-conversation-a4NXH4X9.js";
|
|
7
11
|
// src/chat/agent-invocations/top-level-message.ts
|
|
8
12
|
const AGENT_MESSAGE_EVENT_NAMESPACE = "junior";
|
|
9
13
|
/** Event type of a message from another top-level agent. */
|
|
@@ -38,7 +42,7 @@ async function requireTopLevelAgentAccess(args) {
|
|
|
38
42
|
})) throw new AgentMessageTargetError(`"${args.to}" is a public conversation and this conversation is private. A private conversation can message only conversations in its own channel or DM`);
|
|
39
43
|
}
|
|
40
44
|
function renderTopLevelMessageInput(args) {
|
|
41
|
-
return
|
|
45
|
+
return renderDataTag("agent-message", {
|
|
42
46
|
conversation_id: args.senderConversationId,
|
|
43
47
|
source: "top_level_agent"
|
|
44
48
|
}, "Another top-level agent", args.text.trim());
|
|
@@ -103,7 +107,7 @@ function bindMessageAgent(run, options) {
|
|
|
103
107
|
call.signal?.throwIfAborted();
|
|
104
108
|
const queue = typeof options.queue === "function" ? options.queue() : options.queue;
|
|
105
109
|
if (input.to === "parent") {
|
|
106
|
-
const sender = await
|
|
110
|
+
const sender = await readChildConversationSender(run.conversationId);
|
|
107
111
|
if (!sender) throw new AgentMessageTargetError("This conversation has no parent agent");
|
|
108
112
|
await enqueueAgentMessageToParent({
|
|
109
113
|
actor,
|
|
@@ -136,39 +140,22 @@ function bindMessageAgent(run, options) {
|
|
|
136
140
|
delivery: "queued"
|
|
137
141
|
};
|
|
138
142
|
}
|
|
139
|
-
const
|
|
143
|
+
const { delivery } = await messageChildAgent({
|
|
140
144
|
actor,
|
|
141
145
|
childConversationId,
|
|
142
146
|
...run.credentialContext ? { credentialContext: run.credentialContext } : void 0,
|
|
143
147
|
idempotencyKey: `${run.turnId}:${call.toolCallId}`,
|
|
144
148
|
input: input.text,
|
|
145
149
|
parentConversationId: run.conversationId,
|
|
146
|
-
parentToolCallId: call.toolCallId
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
const { delivery } = await messageChildAgent({
|
|
150
|
-
...message,
|
|
151
|
-
parentTurnId: run.turnId
|
|
152
|
-
}, {
|
|
153
|
-
...options,
|
|
154
|
-
queue
|
|
155
|
-
});
|
|
156
|
-
return {
|
|
157
|
-
conversationId: childConversationId,
|
|
158
|
-
delivery
|
|
159
|
-
};
|
|
160
|
-
}
|
|
161
|
-
const { invocation, queued } = await createAgentInvocationForMessage({
|
|
162
|
-
...message,
|
|
163
|
-
destination: toolInvocationDestination(run)
|
|
164
|
-
});
|
|
165
|
-
await enqueueAgentInvocation(invocation, {
|
|
150
|
+
parentToolCallId: call.toolCallId,
|
|
151
|
+
parentTurnId: run.turnId
|
|
152
|
+
}, {
|
|
166
153
|
...options,
|
|
167
154
|
queue
|
|
168
155
|
});
|
|
169
156
|
return {
|
|
170
157
|
conversationId: childConversationId,
|
|
171
|
-
delivery
|
|
158
|
+
delivery
|
|
172
159
|
};
|
|
173
160
|
};
|
|
174
161
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-BKpuH2hG.js";
|
|
2
|
-
import {
|
|
3
|
-
import { i as isVisionImageMediaType, r as detectImageMediaType } from "./media-
|
|
4
|
-
import { i as readLiveAttachment } from "./store-
|
|
2
|
+
import { o as getSqlExecutor } from "./db-BTmLKZrp.js";
|
|
3
|
+
import { i as isVisionImageMediaType, r as detectImageMediaType } from "./media-FYM-Bl3H.js";
|
|
4
|
+
import { i as readLiveAttachment } from "./store-BuhF1QDm.js";
|
|
5
5
|
import { escapeTagText, renderTag } from "@sentry/junior-plugin-api";
|
|
6
6
|
// src/chat/attachments/model-input.ts
|
|
7
7
|
var model_input_exports = /* @__PURE__ */ __exportAll({ loadInputAttachments: () => loadInputAttachments });
|
package/dist/nitro.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { n as JuniorPluginSet } from "./plugins-fBrz8PCV.js";
|
|
2
|
-
import {
|
|
2
|
+
import { r as JuniorDashboardOptions } from "./app-D7tKnw9a.js";
|
|
3
3
|
import { withSentryConfig as withSentryConfig$1 } from "@sentry/nitro";
|
|
4
4
|
type SentryNitroConfig = Parameters<typeof withSentryConfig$1>[0];
|
|
5
5
|
type SentryNitroOptions = NonNullable<Parameters<typeof withSentryConfig$1>[1]>;
|
|
@@ -27,8 +27,6 @@ export interface JuniorNitroOptions {
|
|
|
27
27
|
/** Authenticated dashboard configuration injected for createApp(). */
|
|
28
28
|
dashboard?: JuniorNitroDashboardOptions;
|
|
29
29
|
maxDuration?: number;
|
|
30
|
-
/** Vercel Queue topic for durable conversation work. Must match the runtime queue producer topic. */
|
|
31
|
-
conversationWorkQueueTopic?: string;
|
|
32
30
|
/** Plugin catalog set or runtime-safe plugin module. Direct sets must not include runtime code. */
|
|
33
31
|
plugins?: JuniorNitroPluginSource;
|
|
34
32
|
/**
|
|
@@ -42,7 +40,7 @@ export interface JuniorNitroOptions {
|
|
|
42
40
|
/** Nitro module that configures deployment wiring and copies app/plugin content into the Vercel build output. */
|
|
43
41
|
export declare function juniorNitro(options?: JuniorNitroOptions): {
|
|
44
42
|
nitro: {
|
|
45
|
-
setup(nitro: unknown): void
|
|
43
|
+
setup(nitro: unknown): void | Promise<void>;
|
|
46
44
|
};
|
|
47
45
|
};
|
|
48
46
|
export {};
|