@sentry/junior 0.315.0 → 0.317.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/{admin-5jUYY46p.js → admin-CAugg87B.js} +1 -1
- package/dist/{agent-runner-C7GNLRB6.js → agent-runner-AjrEV6Qe.js} +13532 -12811
- package/dist/{reporting-window-C4dbzDiR.js → agent-status-BA5x3Xtp.js} +33 -1
- package/dist/{agent-update-delivery-BNEYQsAf.js → agent-update-delivery-B_YIZcgf.js} +10 -37
- package/dist/api/schema.d.ts +609 -104
- package/dist/api/schema.js +6 -6
- package/dist/api.js +373 -469
- package/dist/{app-D_bAXRDe.d.ts → app-MoNAsVV5.d.ts} +52 -28
- package/dist/app.d.ts +1 -1
- package/dist/app.js +177 -132
- package/dist/catalog-runtime-DfSpJZdY.js +6 -0
- package/dist/{change-record-Bqsa5ZXE.d.ts → change-record-BzJgLsv7.d.ts} +60 -1
- package/dist/{adapter-context-BlSGE44V.js → channel-access-j-YAVYK4.js} +2 -42
- package/dist/{chat-core-engine-CxkwRpn9.js → chat-core-engine-aH85nEHv.js} +4 -3
- package/dist/{child-message--2G3Ft26.js → child-message-DHjQLEd1.js} +1 -1
- package/dist/cli/chat.js +23 -23
- package/dist/cli/check.js +5 -5
- package/dist/cli/main.js +2 -2
- package/dist/cli/plugins.js +5 -4
- package/dist/cli/snapshot-create.js +5 -2
- package/dist/cli/upgrade.js +27 -5
- package/dist/config-CHQ8X251.js +2422 -0
- package/dist/{continue-in-slack-BGKjIdFp.js → continue-in-slack-D-FZ8Fin.js} +2 -3
- package/dist/{conversation-feed-Sl8lKKmR.js → conversation-feed--9S0_PXL.js} +9 -4
- package/dist/{proxy-path-Dc-0jXGi.js → conversation-privacy-B1uXn5sf.js} +2 -16
- package/dist/{conversation-turn-BoLK9i6g.js → conversation-turn-BUE_7xaN.js} +102 -172
- package/dist/{create-BOycVH9h.js → create-DoDIYgtZ.js} +12 -10
- package/dist/{credential-sync-Mn4OdkEh.js → credential-sync-BJOqGnjV.js} +17 -12
- package/dist/{db-DXTOYRzR.js → db-BFmyYZtJ.js} +20276 -27398
- package/dist/{deployment-CG3TchWh.js → deployment-DXq9ZLU4.js} +17 -15
- package/dist/{engine-context-dyWlfNdD.js → engine-context-CgQ7mlHt.js} +264 -50
- package/dist/{html-CfXEwl_h.js → html-B3VKTGbJ.js} +6 -2
- package/dist/instrumentation.js +15 -7
- package/dist/{job-runner-CySgpi9v.js → job-runner-A1lCkybD.js} +397 -22
- package/dist/{lineage-tRTOcrsL.js → lineage-Bktb0UcV.js} +1 -1
- package/dist/{list-DXBz8SYL.js → list-Bxvg5wXf.js} +260 -698
- package/dist/{logging-czs0nqLC.js → logging--smS7XRK.js} +2 -2
- package/dist/{mailbox-turn-79Nv1JXv.js → mailbox-turn-uSXhUFc9.js} +648 -2957
- package/dist/{message-BTox2Cmb.js → message-BNenhsmB.js} +12 -22
- package/dist/{model-input-IRGa98V7.js → model-input-BReSnwHp.js} +3 -3
- package/dist/nitro.d.ts +1 -1
- package/dist/nitro.js +20 -6
- package/dist/{oauth-callback-server-NXK7AlBp.js → oauth-callback-server-CE4soEIY.js} +2 -2
- package/dist/{oauth-relay-6NBPSpFE.js → oauth-relay-C36gX1gH.js} +2 -2
- package/dist/{package-discovery-BI6T_RkD.js → package-discovery-DD9vencX.js} +1 -50
- package/dist/{parent-result-Dg6P6roR.js → parent-result-Ck1rFYRQ.js} +93 -106
- package/dist/{plugins-BXMdNdyA.js → plugins-D_Ru4CWc.js} +1 -1
- package/dist/profile-BQ-iBDsZ.js +4657 -0
- package/dist/{transcript-BHhJVY0P.js → prompt-Dv7gkpD6.js} +97 -103
- package/dist/proxy-path-BHYoKZdq.js +15 -0
- package/dist/registry-iXMT5Jmh.js +3279 -0
- package/dist/reports-WKHfGTsU.js +195 -0
- package/dist/{resolve-BUFkmxkT.js → resolve-tony4ibz.js} +9 -29
- package/dist/{result-DfATzX77.js → result-Bta_dlWa.js} +42 -117
- package/dist/run-conversation-DL6ru7iW.js +336 -0
- package/dist/{runner-CmKP3inb.js → runner-BstDRbD9.js} +7 -7
- package/dist/{sandbox-egress-signals-DYo5BsM7.js → sandbox-egress-signals-oSJMJOnn.js} +1 -1
- package/dist/{schema-DrBMdPmv.js → schema-DfqrHACA.js} +67 -84
- package/dist/sender-actors-CPglLd5R.js +83 -0
- package/dist/{service-account-CxTX7nnR.js → service-account-CTV_jaNu.js} +3 -1
- package/dist/{skills-BlHUDj7k.js → skills-BCEU41zM.js} +4 -4
- package/dist/{slack-conversation-unfurl-Dhe3lB1U.js → slack-conversation-unfurl-DxVmhbGP.js} +7 -6
- package/dist/{spawn-CfvlFdfz.js → spawn-frczVPIr.js} +11 -8
- package/dist/{system-prompt-table-CDCYVwqN.js → system-prompt-table-CiXy0eNR.js} +91 -70
- package/dist/{task-runner-DcdQJd9e.js → task-runner-C9Yc2_ae.js} +35 -49
- package/dist/{thread-context-DF5uDcWN.js → thread-context-CqZDKErp.js} +6 -6
- package/dist/topics-SRN7IVX-.js +24 -0
- package/dist/turn-membership-CENFf3kI.js +856 -0
- package/dist/{turn-wake-um5Ubd4m.js → turn-wake-BhloiI2h.js} +4 -5
- package/dist/{media-Cr9pGkzr.js → types-C4iC-IMC.js} +819 -777
- package/dist/user-customization-CvfuY9Eo.js +93 -0
- package/dist/users-ByG5RCEJ.js +181 -0
- package/dist/{validation-CJyuOPD2.js → validation-8gjfR91V.js} +1 -1
- package/dist/{version-Bhe7RPIe.js → version-BeZhWWBE.js} +1 -1
- package/dist/version.js +1 -1
- package/dist/{worker-D8PRgUqr.js → worker-BqMQQNRk.js} +5 -4
- package/migrations/20261125171254_conversation_visibility/migration.sql +4 -0
- package/migrations/20261125171254_conversation_visibility/snapshot.json +67 -0
- package/migrations/20261125171257_conversation_visibility_backfill/migration.sql +25 -0
- package/migrations/20261125171257_conversation_visibility_backfill/snapshot.json +9 -0
- package/migrations/20261125213232_drop_versions_notify/migration.sql +19 -0
- package/migrations/20261125213232_drop_versions_notify/snapshot.json +9 -0
- package/migrations/20261125225138_conversation_kind_root_thread/migration.sql +23 -0
- package/migrations/20261125225138_conversation_kind_root_thread/snapshot.json +55 -0
- package/migrations/20261125225142_conversation_kind_root_thread_backfill/migration.sql +7 -0
- package/migrations/20261125225142_conversation_kind_root_thread_backfill/snapshot.json +9 -0
- package/migrations/20261126000151_conversation_event_message_role_seq_index/migration.sql +1 -0
- package/migrations/20261126000151_conversation_event_message_role_seq_index/snapshot.json +69 -0
- package/migrations/20261126012917_merge_leaves/migration.sql +2 -0
- package/migrations/20261126012917_merge_leaves/snapshot.json +12 -0
- package/migrations/20261126025226_drop_agent_invocations/migration.sql +6 -0
- package/migrations/20261126025226_drop_agent_invocations/snapshot.json +9 -0
- package/migrations/20261126033000_space_conversations_lead_children/migration.sql +155 -0
- package/migrations/20261126033000_space_conversations_lead_children/snapshot.json +9 -0
- package/migrations/20261126144620_drop_user_message_time_index/migration.sql +1 -0
- package/migrations/20261126144620_drop_user_message_time_index/snapshot.json +38 -0
- package/migrations/20261126153100_inbox_item_subjects/migration.sql +140 -0
- package/migrations/20261126153100_inbox_item_subjects/snapshot.json +9 -0
- package/migrations/20261126153103_inbox_item_subjects_not_null/migration.sql +12 -0
- package/migrations/20261126153103_inbox_item_subjects_not_null/snapshot.json +9 -0
- package/migrations/20261126153105_inbox_item_subject_indexes/migration.sql +1 -0
- package/migrations/20261126153105_inbox_item_subject_indexes/snapshot.json +9 -0
- package/migrations/20261126153108_automation_run_conversation_index/migration.sql +1 -0
- package/migrations/20261126153108_automation_run_conversation_index/snapshot.json +9 -0
- package/migrations/20261126153159_inbox_item_subjects_schema/migration.sql +4 -0
- package/migrations/20261126153159_inbox_item_subjects_schema/snapshot.json +437 -0
- package/migrations/20261126153259_inbox_questions/migration.sql +76 -0
- package/migrations/20261126153259_inbox_questions/snapshot.json +9 -0
- package/migrations/20261126153301_inbox_questions_valid/migration.sql +3 -0
- package/migrations/20261126153301_inbox_questions_valid/snapshot.json +9 -0
- package/migrations/20261126153343_inbox_questions_schema/migration.sql +5 -0
- package/migrations/20261126153343_inbox_questions_schema/snapshot.json +407 -0
- package/migrations/20261126154025_inbox_item_owners/migration.sql +74 -0
- package/migrations/20261126154025_inbox_item_owners/snapshot.json +9 -0
- package/migrations/20261126154048_inbox_item_open_subject_key_index/migration.sql +1 -0
- package/migrations/20261126154048_inbox_item_open_subject_key_index/snapshot.json +9 -0
- package/migrations/20261126154051_drop_inbox_item_owner_indexes/migration.sql +7 -0
- package/migrations/20261126154051_drop_inbox_item_owner_indexes/snapshot.json +9 -0
- package/migrations/20261126154121_inbox_item_owners_schema/migration.sql +8 -0
- package/migrations/20261126154121_inbox_item_owners_schema/snapshot.json +311 -0
- package/migrations/20261126175601_conversation_event_turn/migration.sql +5 -0
- package/migrations/20261126175601_conversation_event_turn/snapshot.json +103 -0
- package/migrations/20261126175614_conversation_event_turn_index/migration.sql +1 -0
- package/migrations/20261126175614_conversation_event_turn_index/snapshot.json +62 -0
- package/migrations/20261126230028_merge_leaves/migration.sql +2 -0
- package/migrations/20261126230028_merge_leaves/snapshot.json +12 -0
- package/migrations/20261126231932_space_lead_holds_name/migration.sql +46 -0
- package/migrations/20261126231932_space_lead_holds_name/snapshot.json +58 -0
- package/migrations/20261127001022_merge_leaves/migration.sql +2 -0
- package/migrations/20261127001022_merge_leaves/snapshot.json +12 -0
- package/package.json +5 -5
- package/skills/jr-rpc/SKILL.md +3 -5
- package/dist/direct-url-BYgYfuIy.js +0 -22
- package/dist/markers-CE0HMXWT.js +0 -67
- package/dist/people-Cegp1Iwq.js +0 -81
- package/dist/start-conversation-Uh8Sk1EF.js +0 -162
- package/dist/turn-session-routing-GtetHsdO.js +0 -1309
- package/dist/user-customization-B27StpVQ.js +0 -9
- package/dist/web-message-id-C6P83ans.js +0 -10
|
@@ -0,0 +1,336 @@
|
|
|
1
|
+
import { t as __exportAll } from "./rolldown-runtime-BKpuH2hG.js";
|
|
2
|
+
import { $r as getDispatchIdForConversation, Bo as credentialContextForActor, Oa as linkAutomationRunConversation, Qr as getDispatchConversationId, Vt as appendAndEnqueueInboundMessage, Xr as confirmDispatchMailboxAppend, Yr as claimDispatchMailboxAppend, ci as markDispatchCompleted, ei as getDispatchInputMessageId, hu as indexEndedTurnEvents, i as getConversationStore, ii as isTerminalDispatchStatus, li as markDispatchFailed, ni as getDispatchTurnId, o as getSqlExecutor, oi as markDispatchAwaitingResume, sc as resolveActorIdentityId, si as markDispatchBlocked, ti as getDispatchRecord, ui as markDispatchRunning } from "./db-BFmyYZtJ.js";
|
|
3
|
+
import { h as logWarn } from "./logging--smS7XRK.js";
|
|
4
|
+
import { Cr as listTurnSummaries, Sr as getTurnRecord, a as resolveMailboxTurnWork, at as isCooperativeTurnYieldError, cr as AuthorizationFlowDisabledError, ir as PluginCredentialFailureError, it as getConversationTurnBoundaryError, nt as TurnInputCommitLostError, ot as isTurnInputCommitLostError, wr as recordTurnSummary } from "./mailbox-turn-uSXhUFc9.js";
|
|
5
|
+
import { n as recordChildAgentEnded } from "./parent-result-Ck1rFYRQ.js";
|
|
6
|
+
import { n as withSenderActors } from "./sender-actors-CPglLd5R.js";
|
|
7
|
+
import * as z from "zod";
|
|
8
|
+
// src/chat/agent-dispatch/work.ts
|
|
9
|
+
const agentDispatchMailboxMetadataSchema = z.object({
|
|
10
|
+
dispatchId: z.string().min(1),
|
|
11
|
+
kind: z.literal("agent_dispatch")
|
|
12
|
+
}).strict();
|
|
13
|
+
const AGENT_DISPATCH_MAX_AGE_MS = 864e5;
|
|
14
|
+
/** Return whether a dispatch is a Scheduled or Event automation run. */
|
|
15
|
+
function isAutomationRun(dispatch) {
|
|
16
|
+
return dispatch.source.kind === "scheduled_automation" || dispatch.source.kind === "event_automation";
|
|
17
|
+
}
|
|
18
|
+
/** Restore the exact actor, credential, and dispatch routing for every slice. */
|
|
19
|
+
function buildDispatchRoutingContext(dispatch) {
|
|
20
|
+
return {
|
|
21
|
+
actor: dispatch.actor,
|
|
22
|
+
credentialContext: credentialContextForActor(dispatch.actor, dispatch.credentialSubject),
|
|
23
|
+
dispatch: {
|
|
24
|
+
actor: dispatch.actor,
|
|
25
|
+
id: dispatch.id,
|
|
26
|
+
metadata: dispatch.metadata,
|
|
27
|
+
plugin: dispatch.plugin,
|
|
28
|
+
replyAttribution: dispatch.replyAttribution,
|
|
29
|
+
outcomes: dispatch.outcomes,
|
|
30
|
+
...dispatch.skill ? { skill: dispatch.skill } : void 0,
|
|
31
|
+
...isAutomationRun(dispatch) ? { declaresResult: true } : void 0
|
|
32
|
+
},
|
|
33
|
+
surface: "api"
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
/** Build the stable mailbox work item for one agent dispatch. */
|
|
37
|
+
function buildAgentDispatchInboundMessage(dispatch, nowMs = Date.now(), authorIdentityId) {
|
|
38
|
+
return {
|
|
39
|
+
conversationId: getDispatchConversationId(dispatch),
|
|
40
|
+
createdAtMs: dispatch.createdAtMs,
|
|
41
|
+
delivery: "defer",
|
|
42
|
+
destination: dispatch.destination,
|
|
43
|
+
inboundMessageId: getDispatchInputMessageId(dispatch.id),
|
|
44
|
+
input: {
|
|
45
|
+
text: "[plugin dispatch]",
|
|
46
|
+
...authorIdentityId ? { authorIdentityId } : void 0,
|
|
47
|
+
metadata: {
|
|
48
|
+
dispatchId: dispatch.id,
|
|
49
|
+
kind: "agent_dispatch"
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
receivedAtMs: nowMs,
|
|
53
|
+
source: "plugin"
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
/** Persist dispatch mailbox work before sending its conversation wake-up. */
|
|
57
|
+
async function enqueueAgentDispatch(dispatch, options) {
|
|
58
|
+
const nowMs = options.nowMs ?? Date.now();
|
|
59
|
+
const claimedDispatch = await claimDispatchMailboxAppend(dispatch.id);
|
|
60
|
+
if (!claimedDispatch) return;
|
|
61
|
+
const conversationStore = options.conversationStore ?? getConversationStore();
|
|
62
|
+
const conversationId = getDispatchConversationId(claimedDispatch);
|
|
63
|
+
const destination = claimedDispatch.destination;
|
|
64
|
+
await conversationStore.recordActivity({
|
|
65
|
+
activityAtMs: claimedDispatch.createdAtMs,
|
|
66
|
+
conversationId,
|
|
67
|
+
destination,
|
|
68
|
+
kind: isAutomationRun(claimedDispatch) ? "automation" : "thread",
|
|
69
|
+
nowMs,
|
|
70
|
+
source: "plugin",
|
|
71
|
+
sessionSource: claimedDispatch.source,
|
|
72
|
+
...claimedDispatch.title ? { title: claimedDispatch.title } : void 0
|
|
73
|
+
});
|
|
74
|
+
const source = claimedDispatch.source;
|
|
75
|
+
if ((source.kind === "scheduled_automation" || source.kind === "event_automation") && source.automationRunId) await linkAutomationRunConversation({
|
|
76
|
+
conversationId,
|
|
77
|
+
runId: source.automationRunId
|
|
78
|
+
});
|
|
79
|
+
if (destination.platform === "slack" && destination.threadTs) await conversationStore.claimProviderConversation({
|
|
80
|
+
atMs: nowMs,
|
|
81
|
+
conversationId,
|
|
82
|
+
provider: "slack",
|
|
83
|
+
providerDestinationId: destination.channelId,
|
|
84
|
+
providerTenantId: destination.teamId,
|
|
85
|
+
providerConversationId: destination.threadTs
|
|
86
|
+
});
|
|
87
|
+
await appendAndEnqueueInboundMessage({
|
|
88
|
+
message: buildAgentDispatchInboundMessage(claimedDispatch, nowMs, await resolveActorIdentityId(getSqlExecutor(), claimedDispatch.actor)),
|
|
89
|
+
conversationStore: options.conversationStore,
|
|
90
|
+
nowMs,
|
|
91
|
+
queue: options.queue,
|
|
92
|
+
state: options.state
|
|
93
|
+
});
|
|
94
|
+
await confirmDispatchMailboxAppend(claimedDispatch.id);
|
|
95
|
+
}
|
|
96
|
+
/** Parse dispatch routing metadata from a durable mailbox message. */
|
|
97
|
+
function dispatchIdFromMessages(messages) {
|
|
98
|
+
if (messages.length === 0) return;
|
|
99
|
+
const parsed = messages.map((message) => agentDispatchMailboxMetadataSchema.safeParse(message.input.metadata));
|
|
100
|
+
if (parsed.every((result) => !result.success)) return;
|
|
101
|
+
if (parsed.some((result) => !result.success)) throw new Error("Conversation mailbox mixes dispatch and provider input");
|
|
102
|
+
const ids = new Set(parsed.map((result) => {
|
|
103
|
+
if (!result.success) throw new Error("Dispatch mailbox metadata failed validation");
|
|
104
|
+
return result.data.dispatchId;
|
|
105
|
+
}));
|
|
106
|
+
if (ids.size !== 1) throw new Error("Conversation mailbox contains multiple dispatches");
|
|
107
|
+
return ids.values().next().value;
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Resolve a dispatch from concrete mailbox metadata or the active turn.
|
|
111
|
+
*
|
|
112
|
+
* Provider source and conversation-id conventions are deliberately not
|
|
113
|
+
* execution routing authority.
|
|
114
|
+
*/
|
|
115
|
+
async function resolveAgentDispatchId(context) {
|
|
116
|
+
const mailboxDispatchId = dispatchIdFromMessages(context.attempt.messages);
|
|
117
|
+
if (mailboxDispatchId) return mailboxDispatchId;
|
|
118
|
+
if (context.attempt.messages.length > 0) return;
|
|
119
|
+
const summaries = await listTurnSummaries(context.conversationId);
|
|
120
|
+
const activeDispatchIds = new Set(summaries.filter((summary) => (summary.state === "paused" || summary.state === "running") && Boolean(summary.dispatchId)).map((summary) => summary.dispatchId).filter((id) => Boolean(id)));
|
|
121
|
+
if (activeDispatchIds.size > 1) throw new Error(`Conversation ${context.conversationId} has multiple active dispatches`);
|
|
122
|
+
const activeDispatchId = activeDispatchIds.values().next().value;
|
|
123
|
+
if (activeDispatchId) return activeDispatchId;
|
|
124
|
+
const durableDispatchIds = new Set(summaries.map((summary) => summary.dispatchId).filter((id) => Boolean(id)));
|
|
125
|
+
if (durableDispatchIds.size > 1) throw new Error(`Conversation ${context.conversationId} has multiple dispatch sessions`);
|
|
126
|
+
const durableDispatchId = durableDispatchIds.values().next().value;
|
|
127
|
+
if (!durableDispatchId) return;
|
|
128
|
+
const dispatch = await getDispatchRecord(durableDispatchId);
|
|
129
|
+
return dispatch && !isTerminalDispatchStatus(dispatch.status) ? durableDispatchId : void 0;
|
|
130
|
+
}
|
|
131
|
+
async function readDispatchTurnResult(dispatch) {
|
|
132
|
+
const conversationId = getDispatchConversationId(dispatch);
|
|
133
|
+
const turnId = getDispatchTurnId(dispatch.id);
|
|
134
|
+
const storedSession = await getTurnRecord(conversationId, turnId);
|
|
135
|
+
const summary = (await listTurnSummaries(conversationId)).find((candidate) => candidate.turnId === turnId);
|
|
136
|
+
const session = storedSession ?? summary;
|
|
137
|
+
const dispatchOutcome = summary?.dispatchOutcome ?? storedSession?.dispatchOutcome;
|
|
138
|
+
const resultMessageTs = summary?.resultMessageId ?? storedSession?.resultMessageId;
|
|
139
|
+
const errorMessage = storedSession?.errorMessage;
|
|
140
|
+
if (dispatchOutcome) return {
|
|
141
|
+
...errorMessage ? { errorMessage } : void 0,
|
|
142
|
+
outcome: dispatchOutcome,
|
|
143
|
+
...resultMessageTs ? { resultMessageTs } : void 0
|
|
144
|
+
};
|
|
145
|
+
if (resultMessageTs) return {
|
|
146
|
+
outcome: "completed",
|
|
147
|
+
resultMessageTs
|
|
148
|
+
};
|
|
149
|
+
if (!session) return { outcome: "not_started" };
|
|
150
|
+
switch (session.state) {
|
|
151
|
+
case "paused": return { outcome: "awaiting_resume" };
|
|
152
|
+
case "running": return { outcome: "still_running" };
|
|
153
|
+
case "completed": return { outcome: "completed" };
|
|
154
|
+
case "abandoned":
|
|
155
|
+
case "failed": return {
|
|
156
|
+
...errorMessage ? { errorMessage } : void 0,
|
|
157
|
+
outcome: "retryable"
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
async function projectDispatchTurnResult(dispatchId, result) {
|
|
162
|
+
switch (result.outcome) {
|
|
163
|
+
case "awaiting_resume":
|
|
164
|
+
await markDispatchAwaitingResume(dispatchId);
|
|
165
|
+
break;
|
|
166
|
+
case "blocked":
|
|
167
|
+
await markDispatchBlocked(dispatchId, result.errorMessage ?? "Dispatch requires authorization that is unavailable for background work", result.resultMessageTs);
|
|
168
|
+
break;
|
|
169
|
+
case "failed":
|
|
170
|
+
await markDispatchFailed(dispatchId, result.errorMessage ?? "Agent turn failed", result.resultMessageTs);
|
|
171
|
+
break;
|
|
172
|
+
case "completed":
|
|
173
|
+
await markDispatchCompleted(dispatchId, result.resultMessageTs);
|
|
174
|
+
break;
|
|
175
|
+
case "not_started": await markDispatchFailed(dispatchId, "Dispatch turn record is missing");
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
function getDispatchBlockingError(error) {
|
|
179
|
+
const cause = getConversationTurnBoundaryError(error)?.cause ?? error;
|
|
180
|
+
return cause instanceof AuthorizationFlowDisabledError || cause instanceof PluginCredentialFailureError ? cause : void 0;
|
|
181
|
+
}
|
|
182
|
+
function missingAuthorizationReason(dispatch, provider) {
|
|
183
|
+
return dispatch.credentialSubject ? `This run needs a connected ${provider} account.` : `This run uses system credentials, which have no ${provider} access. Switch it to creator credentials and connect a ${provider} account.`;
|
|
184
|
+
}
|
|
185
|
+
async function persistBlockedDispatchTurn(dispatch, error) {
|
|
186
|
+
const conversationId = getDispatchConversationId(dispatch);
|
|
187
|
+
const sessionId = getDispatchTurnId(dispatch.id);
|
|
188
|
+
const session = await getTurnRecord(conversationId, sessionId);
|
|
189
|
+
await recordTurnSummary({
|
|
190
|
+
actor: dispatch.actor,
|
|
191
|
+
conversationId,
|
|
192
|
+
destination: dispatch.destination,
|
|
193
|
+
dispatchId: dispatch.id,
|
|
194
|
+
dispatchOutcome: "blocked",
|
|
195
|
+
turnId: sessionId,
|
|
196
|
+
sliceId: session?.sliceId ?? 1,
|
|
197
|
+
source: dispatch.source,
|
|
198
|
+
state: "failed",
|
|
199
|
+
surface: "api"
|
|
200
|
+
});
|
|
201
|
+
await markDispatchBlocked(dispatch.id, error instanceof AuthorizationFlowDisabledError ? missingAuthorizationReason(dispatch, error.provider) : error.message);
|
|
202
|
+
}
|
|
203
|
+
/** Run one dispatch start or resume under the owning conversation lease. */
|
|
204
|
+
function createAgentDispatchConversationWorker(options) {
|
|
205
|
+
return async (context, dispatchId) => {
|
|
206
|
+
const dispatch = await getDispatchRecord(dispatchId);
|
|
207
|
+
if (!dispatch) throw new Error(`Dispatch record is missing for ${dispatchId}`);
|
|
208
|
+
const expectedConversationId = getDispatchConversationId(dispatch);
|
|
209
|
+
if (context.conversationId !== expectedConversationId) throw new Error(`Dispatch ${dispatch.id} belongs to ${expectedConversationId}, not ${context.conversationId}`);
|
|
210
|
+
if (!context.destination || context.destination.platform !== dispatch.destination.platform || context.destination.teamId !== dispatch.destination.teamId || context.destination.channelId !== dispatch.destination.channelId) throw new Error(`Dispatch ${dispatch.id} destination does not match its conversation lease`);
|
|
211
|
+
let acknowledged = context.attempt.messages.length === 0;
|
|
212
|
+
const acknowledge = async () => {
|
|
213
|
+
if (acknowledged) return;
|
|
214
|
+
try {
|
|
215
|
+
await context.attempt.ack();
|
|
216
|
+
} catch {
|
|
217
|
+
throw new TurnInputCommitLostError(`Conversation work lease lost before dispatch inbox ack for ${context.conversationId}`);
|
|
218
|
+
}
|
|
219
|
+
acknowledged = true;
|
|
220
|
+
};
|
|
221
|
+
if (isTerminalDispatchStatus(dispatch.status)) {
|
|
222
|
+
await acknowledge();
|
|
223
|
+
return { status: "completed" };
|
|
224
|
+
}
|
|
225
|
+
const durableResult = await readDispatchTurnResult(dispatch);
|
|
226
|
+
if (durableResult.outcome === "blocked" || durableResult.outcome === "completed" || durableResult.outcome === "failed") {
|
|
227
|
+
await projectDispatchTurnResult(dispatch.id, durableResult);
|
|
228
|
+
await acknowledge();
|
|
229
|
+
return { status: "completed" };
|
|
230
|
+
}
|
|
231
|
+
if (Date.now() - dispatch.createdAtMs > 864e5) {
|
|
232
|
+
await markDispatchFailed(dispatch.id, "Dispatch exceeded its maximum processing age");
|
|
233
|
+
await acknowledge();
|
|
234
|
+
return { status: "completed" };
|
|
235
|
+
}
|
|
236
|
+
const runningDispatch = await markDispatchRunning(dispatch.id);
|
|
237
|
+
if (!runningDispatch) throw new Error(`Dispatch record disappeared for ${dispatch.id}`);
|
|
238
|
+
if (isTerminalDispatchStatus(runningDispatch.status)) {
|
|
239
|
+
await acknowledge();
|
|
240
|
+
return { status: "completed" };
|
|
241
|
+
}
|
|
242
|
+
try {
|
|
243
|
+
const resumesDurableTurn = durableResult.outcome === "awaiting_resume" || durableResult.outcome === "still_running";
|
|
244
|
+
if (resumesDurableTurn && context.attempt.messages.length > 0) await acknowledge();
|
|
245
|
+
let result;
|
|
246
|
+
if (resumesDurableTurn) {
|
|
247
|
+
await options.resumeTurn(dispatch, {
|
|
248
|
+
shouldYield: context.shouldYield,
|
|
249
|
+
checkIn: context.checkIn
|
|
250
|
+
});
|
|
251
|
+
result = await readDispatchTurnResult(dispatch);
|
|
252
|
+
} else result = await options.runTurn(dispatch, {
|
|
253
|
+
ack: acknowledge,
|
|
254
|
+
shouldYield: context.shouldYield,
|
|
255
|
+
checkIn: context.checkIn
|
|
256
|
+
}) ?? await readDispatchTurnResult(dispatch);
|
|
257
|
+
if (result.outcome === "still_running") throw new Error(`Dispatch turn ${dispatch.id} is still running after its attempt`);
|
|
258
|
+
if (result.outcome === "retryable") throw new Error(result.errorMessage ?? `Dispatch turn ${dispatch.id} failed`);
|
|
259
|
+
await projectDispatchTurnResult(dispatch.id, result);
|
|
260
|
+
if (!acknowledged) await acknowledge();
|
|
261
|
+
return result.outcome === "awaiting_resume" && context.shouldYield() ? { status: "yielded" } : { status: "completed" };
|
|
262
|
+
} catch (error) {
|
|
263
|
+
if (isCooperativeTurnYieldError(error)) {
|
|
264
|
+
await markDispatchAwaitingResume(dispatch.id);
|
|
265
|
+
return { status: "yielded" };
|
|
266
|
+
}
|
|
267
|
+
if (isTurnInputCommitLostError(error)) {
|
|
268
|
+
logWarn("agent.dispatch.lost_lease", {
|
|
269
|
+
"app.dispatch.id": dispatch.id,
|
|
270
|
+
"error.type": error.name,
|
|
271
|
+
"exception.message": error.message
|
|
272
|
+
});
|
|
273
|
+
return { status: "lost_lease" };
|
|
274
|
+
}
|
|
275
|
+
const blockingError = getDispatchBlockingError(error);
|
|
276
|
+
if (blockingError) {
|
|
277
|
+
await persistBlockedDispatchTurn(dispatch, blockingError);
|
|
278
|
+
await indexEndedTurnEvents({
|
|
279
|
+
conversationId: context.conversationId,
|
|
280
|
+
turnId: getDispatchTurnId(dispatch.id)
|
|
281
|
+
});
|
|
282
|
+
await acknowledge();
|
|
283
|
+
return { status: "completed" };
|
|
284
|
+
}
|
|
285
|
+
if (!context.attempt.isFinalAttempt) throw error;
|
|
286
|
+
await markDispatchFailed(dispatch.id, error instanceof Error ? error.message : "Dispatch turn failed");
|
|
287
|
+
await indexEndedTurnEvents({
|
|
288
|
+
conversationId: context.conversationId,
|
|
289
|
+
turnId: getDispatchTurnId(dispatch.id)
|
|
290
|
+
});
|
|
291
|
+
await acknowledge();
|
|
292
|
+
return { status: "completed" };
|
|
293
|
+
}
|
|
294
|
+
};
|
|
295
|
+
}
|
|
296
|
+
/**
|
|
297
|
+
* Fail the dispatch of stopped Conversation work, so the Automation run that
|
|
298
|
+
* waits on it settles instead of blocking later runs.
|
|
299
|
+
*/
|
|
300
|
+
async function failStoppedDispatch(conversationId) {
|
|
301
|
+
const dispatchId = getDispatchIdForConversation(conversationId);
|
|
302
|
+
if (dispatchId) await markDispatchFailed(dispatchId, "Dispatch work stopped after repeated failed attempts.");
|
|
303
|
+
}
|
|
304
|
+
// src/chat/task-execution/run-conversation.ts
|
|
305
|
+
var run_conversation_exports = /* @__PURE__ */ __exportAll({ runConversation: () => runConversation });
|
|
306
|
+
/**
|
|
307
|
+
* Run one attempt of any Conversation, root or child: its mailbox Turn,
|
|
308
|
+
* then its dispatch, then its Destination work. An attempt with none of
|
|
309
|
+
* them, such as an empty wake after a stop, completes.
|
|
310
|
+
*/
|
|
311
|
+
async function runConversation(context, workers) {
|
|
312
|
+
const mailboxTurn = await resolveMailboxTurnWork(context);
|
|
313
|
+
if (mailboxTurn) {
|
|
314
|
+
const work = await withSenderActors(mailboxTurn);
|
|
315
|
+
if (!work) {
|
|
316
|
+
await context.attempt.ack();
|
|
317
|
+
return { status: "completed" };
|
|
318
|
+
}
|
|
319
|
+
const result = await workers.runTurn(context, work);
|
|
320
|
+
if (result.status === "completed") await recordChildAgentEnded(context.conversationId, "success", { state: workers.state });
|
|
321
|
+
return result;
|
|
322
|
+
}
|
|
323
|
+
if (workers.runDispatch) {
|
|
324
|
+
const dispatchId = await resolveAgentDispatchId(context);
|
|
325
|
+
if (dispatchId) return await workers.runDispatch(context, dispatchId);
|
|
326
|
+
}
|
|
327
|
+
const destination = context.destination;
|
|
328
|
+
if (!destination) {
|
|
329
|
+
await context.attempt.ack();
|
|
330
|
+
return { status: "completed" };
|
|
331
|
+
}
|
|
332
|
+
const runDestination = workers.destinations?.[destination.platform];
|
|
333
|
+
if (!runDestination) throw new Error(`Conversation ${context.conversationId} has a ${destination.platform} destination but no matching conversation worker`);
|
|
334
|
+
return await runDestination(context);
|
|
335
|
+
}
|
|
336
|
+
export { createAgentDispatchConversationWorker as a, buildDispatchRoutingContext as i, run_conversation_exports as n, enqueueAgentDispatch as o, AGENT_DISPATCH_MAX_AGE_MS as r, failStoppedDispatch as s, runConversation as t };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { a as buildDeliveredTurnStatePatch, o as loadPendingMessageCards, r as completeAuthPauseTurn, t as buildTurnThreadContext } from "./thread-context-
|
|
3
|
-
import {
|
|
4
|
-
import { S as setTags, T as withLogContext, p as logException } from "./logging
|
|
5
|
-
import { n as scheduleSessionCompletedPluginTasks, t as processPluginTask } from "./task-runner-
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
1
|
+
import { Ht as messageCardText } from "./types-C4iC-IMC.js";
|
|
2
|
+
import { a as buildDeliveredTurnStatePatch, o as loadPendingMessageCards, r as completeAuthPauseTurn, t as buildTurnThreadContext } from "./thread-context-CqZDKErp.js";
|
|
3
|
+
import { h as getAssistantReplyText } from "./system-prompt-table-CiXy0eNR.js";
|
|
4
|
+
import { S as setTags, T as withLogContext, p as logException } from "./logging--smS7XRK.js";
|
|
5
|
+
import { n as scheduleSessionCompletedPluginTasks, t as processPluginTask } from "./task-runner-C9Yc2_ae.js";
|
|
6
|
+
import { Er as getTurnLifecycle, Fn as persistConversationMessages, Gn as recordDeliveredAssistantMessage, Hn as latestConversationMessageSeq, Jn as upsertConversationMessage, Nn as hydrateConversationMessages, Rr as finalizeFailedTurnReplyWithEvent, Tn as recordAuthorizationCompleted, Un as markConversationMessage, Wn as normalizeConversationText, _t as coerceThreadConversationState, dt as startActiveTurn, gn as commitAcceptedReply, gt as persistThreadStateById, mt as getPersistedThreadState, or as authorizationId, pt as getPersistedSandboxState, ti as persistWithRetry, ut as markTurnFailed, vr as saveTurnCheckpoint, yn as loadConversationProjection } from "./mailbox-turn-uSXhUFc9.js";
|
|
7
|
+
import { Bo as credentialContextForActor, i as getConversationStore, oc as SYSTEM_IDENTITY_ID } from "./db-BFmyYZtJ.js";
|
|
8
8
|
import { randomUUID } from "node:crypto";
|
|
9
9
|
import { createLocalSource, localDestinationSchema } from "@sentry/junior-plugin-api";
|
|
10
10
|
// src/chat/local/runner.ts
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { k as sandboxEgressSignalsResponseSchema } from "./profile-BQ-iBDsZ.js";
|
|
2
2
|
// src/chat/local/sandbox-egress-signals.ts
|
|
3
3
|
const SANDBOX_EGRESS_SIGNALS_PATH = "/api/internal/sandbox-egress/signals";
|
|
4
4
|
const LOCAL_DEV_SERVER_TIMEOUT_MS = 1e3;
|
|
@@ -1,20 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import "./user-customization-CvfuY9Eo.js";
|
|
2
|
+
import { F as actorIdentitySchema, G as conversationParamsSchema, Jt as inputFileSchema, Lt as conversationTreeStateSchema, Q as conversationUsageSchema, Rn as notificationScheduleSchema, X as conversationSummaryReportSchema, dn as inboxItemNoticeRequestSchema, et as conversationChildAgentTotalsSchema, i as TODO_STATUSES, pn as inboxItemRequestSchema, z as conversationAuxiliaryCostsSchema } from "./types-C4iC-IMC.js";
|
|
3
|
+
import { a as fillUtcDays, l as sumUtcHoursIntoSixHours, m as CHILD_AGENT_RESULTS, o as fillUtcHours, t as AGENT_STATUSES } from "./agent-status-BA5x3Xtp.js";
|
|
4
|
+
import { f as conversationTitleSchema } from "./conversation-feed--9S0_PXL.js";
|
|
4
5
|
import { t as isPushServiceEndpoint } from "./push-endpoint-CO-nomUd.js";
|
|
5
|
-
import "./user-customization-B27StpVQ.js";
|
|
6
6
|
import * as z from "zod";
|
|
7
7
|
import { codeChangeStateSchema, eventMatchSchema, objectTypeSchema, ownedObjectAnnotationSchema } from "@sentry/junior-plugin-api";
|
|
8
|
-
// src/chat/agent-invocations/statuses.ts
|
|
9
|
-
const AGENT_INVOCATION_STATUSES = [
|
|
10
|
-
"pending",
|
|
11
|
-
"running",
|
|
12
|
-
"paused",
|
|
13
|
-
"blocked",
|
|
14
|
-
"completed",
|
|
15
|
-
"failed",
|
|
16
|
-
"stopped"
|
|
17
|
-
];
|
|
18
8
|
// src/api/schema/conversation-fork.ts
|
|
19
9
|
/** Body of a request to fork a Conversation at one assistant reply. */
|
|
20
10
|
const forkConversationBodySchema = z.object({
|
|
@@ -107,8 +97,8 @@ const conversationOutlineSchema = z.object({ items: z.array(z.object({
|
|
|
107
97
|
createdAt: z.string().datetime(),
|
|
108
98
|
/** Identity id of the author. Detail `authors` maps it to the person. */
|
|
109
99
|
actorIdentityId: z.string().min(1).optional(),
|
|
110
|
-
/** Set on input that
|
|
111
|
-
|
|
100
|
+
/** Set on input that a parent agent wrote, not a person. */
|
|
101
|
+
fromParentAgent: z.literal(true).optional(),
|
|
112
102
|
text: z.string().min(1),
|
|
113
103
|
/** The last Junior text before the next item. */
|
|
114
104
|
reply: z.string().min(1).optional(),
|
|
@@ -215,9 +205,10 @@ const continueConversationInSlackResponseSchema = z.object({
|
|
|
215
205
|
* One direct child agent of a Conversation, from its stored agent config.
|
|
216
206
|
*
|
|
217
207
|
* Viewers who cannot see private content get the status, time, and usage, but
|
|
218
|
-
* not the name
|
|
219
|
-
*
|
|
220
|
-
*
|
|
208
|
+
* not the name or title. A visible child always has a title, null when its
|
|
209
|
+
* spawn gave none. Usage covers the child Conversation and all its own child
|
|
210
|
+
* agents, like the detail of that child Conversation. Archived children stay
|
|
211
|
+
* in the report.
|
|
221
212
|
*/
|
|
222
213
|
const conversationChildAgentSchema = z.object({
|
|
223
214
|
auxiliaryCosts: conversationAuxiliaryCostsSchema.optional(),
|
|
@@ -227,22 +218,26 @@ const conversationChildAgentSchema = z.object({
|
|
|
227
218
|
conversationId: z.string().min(1),
|
|
228
219
|
cumulativeDurationMs: z.number(),
|
|
229
220
|
cumulativeUsage: conversationUsageSchema.optional(),
|
|
230
|
-
error: z.string().min(1).optional(),
|
|
231
221
|
kind: z.enum(["thread", "task"]),
|
|
222
|
+
/** How its newest finished Turn that was not stopped ended. */
|
|
223
|
+
lastResult: z.enum(CHILD_AGENT_RESULTS).optional(),
|
|
232
224
|
name: z.string().min(1).optional(),
|
|
233
225
|
redacted: z.literal(true).optional(),
|
|
234
|
-
status: z.enum(
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
226
|
+
status: z.enum(AGENT_STATUSES),
|
|
227
|
+
title: z.string().min(1).nullable().optional(),
|
|
228
|
+
/** What the child and its own children wait on, for the viewer. */
|
|
229
|
+
treeState: conversationTreeStateSchema,
|
|
230
|
+
updatedAt: z.string().datetime(),
|
|
231
|
+
/** The child or one of its own children watches for an Event or Timer. */
|
|
232
|
+
watching: z.boolean()
|
|
238
233
|
}).strict().superRefine((data, context) => {
|
|
239
|
-
if (data.
|
|
234
|
+
if (data.title === void 0 === (data.redacted !== true)) context.addIssue({
|
|
240
235
|
code: "custom",
|
|
241
|
-
message: "child agent
|
|
236
|
+
message: "child agent title must be set or explicitly redacted"
|
|
242
237
|
});
|
|
243
|
-
if (data.redacted &&
|
|
238
|
+
if (data.redacted && data.name) context.addIssue({
|
|
244
239
|
code: "custom",
|
|
245
|
-
message: "redacted child agents must not expose a name
|
|
240
|
+
message: "redacted child agents must not expose a name"
|
|
246
241
|
});
|
|
247
242
|
});
|
|
248
243
|
/** Direct child agents of one Conversation, newest activity first. */
|
|
@@ -633,35 +628,6 @@ const spaceConfigEntrySchema = z.object({
|
|
|
633
628
|
}).strict();
|
|
634
629
|
/** A Space's configuration, by key. */
|
|
635
630
|
const spaceConfigurationSchema = z.object({ entries: z.array(spaceConfigEntrySchema) }).strict();
|
|
636
|
-
// src/api/schema/lead.ts
|
|
637
|
-
/**
|
|
638
|
-
* The Lead of a Space. Members send it messages with the Conversation
|
|
639
|
-
* message route.
|
|
640
|
-
*/
|
|
641
|
-
const leadSchema = z.object({
|
|
642
|
-
conversationId: z.string().min(1),
|
|
643
|
-
/**
|
|
644
|
-
* The Lead's newest event seq, read before its Watches, or -1 before its
|
|
645
|
-
* first event. Watches change only in the Lead's Turns, so a transcript
|
|
646
|
-
* event past this seq means the Watches may be out of date.
|
|
647
|
-
*/
|
|
648
|
-
lastSeq: z.number().int().min(-1),
|
|
649
|
-
/** The Conversations that the Lead has an active Watch on. */
|
|
650
|
-
watchedConversationIds: z.array(z.string().min(1))
|
|
651
|
-
}).strict();
|
|
652
|
-
// src/api/schema/space-member.ts
|
|
653
|
-
/** One member of a Space. */
|
|
654
|
-
const spaceMemberSchema = z.object({
|
|
655
|
-
userId: z.string().min(1),
|
|
656
|
-
email: z.string(),
|
|
657
|
-
displayName: z.string().nullable(),
|
|
658
|
-
/** Junior API path of the member's profile photo. */
|
|
659
|
-
avatarUrl: z.string().nullable(),
|
|
660
|
-
joinedAt: z.iso.datetime()
|
|
661
|
-
}).strict();
|
|
662
|
-
const spaceMemberListSchema = z.object({ members: z.array(spaceMemberSchema) }).strict();
|
|
663
|
-
/** Add one person to a Space by the primary email of their User. */
|
|
664
|
-
const addSpaceMemberBodySchema = z.object({ email: z.string().trim().min(1).max(320) }).strict();
|
|
665
631
|
// src/api/schema/person.ts
|
|
666
632
|
const personParamsSchema = z.object({ email: z.string().trim().min(1) }).strict();
|
|
667
633
|
/**
|
|
@@ -787,6 +753,30 @@ const personCardReportSchema = z.object({
|
|
|
787
753
|
/** The same code changes as the People profile, newest merge first. */
|
|
788
754
|
mergedChanges: z.array(codeChangeSummaryReportSchema).max(3)
|
|
789
755
|
}).strict();
|
|
756
|
+
// src/api/schema/user-search.ts
|
|
757
|
+
/** Users a search returns when the request sets no limit. */
|
|
758
|
+
const USER_SEARCH_DEFAULT_LIMIT = 10;
|
|
759
|
+
/** The most Users one search returns. */
|
|
760
|
+
const USER_SEARCH_MAX_LIMIT = 25;
|
|
761
|
+
/** A search for Users to add to one Conversation that the viewer can read. */
|
|
762
|
+
const userSearchQuerySchema = z.object({
|
|
763
|
+
conversationId: z.string().min(1).max(500),
|
|
764
|
+
limit: z.coerce.number().int().min(1).max(25).default(10),
|
|
765
|
+
q: z.string().trim().min(1).max(100)
|
|
766
|
+
}).strict();
|
|
767
|
+
/**
|
|
768
|
+
* One User that the people picker shows. `isMember` is true when they are
|
|
769
|
+
* already a Participant of the Conversation. Invite names them by `userId`.
|
|
770
|
+
*/
|
|
771
|
+
const userSearchResultSchema = z.object({
|
|
772
|
+
avatarUrl: z.string().optional(),
|
|
773
|
+
email: z.string().min(1),
|
|
774
|
+
fullName: z.string().optional(),
|
|
775
|
+
isMember: z.literal(true).optional(),
|
|
776
|
+
slackUserName: z.string().optional(),
|
|
777
|
+
userId: z.string().min(1)
|
|
778
|
+
}).strict();
|
|
779
|
+
const userSearchReportSchema = z.object({ users: z.array(userSearchResultSchema) }).strict();
|
|
790
780
|
// src/api/schema/personal-token.ts
|
|
791
781
|
const personalTokenMetadataSchema = z.object({
|
|
792
782
|
id: z.string().uuid(),
|
|
@@ -1179,11 +1169,10 @@ const inboxItemSchema = z.object({
|
|
|
1179
1169
|
}).strict())
|
|
1180
1170
|
}).strict().optional(),
|
|
1181
1171
|
/**
|
|
1182
|
-
*
|
|
1183
|
-
*
|
|
1172
|
+
* The question and its related links. A notice has only the related
|
|
1173
|
+
* links, which say what it is about.
|
|
1184
1174
|
*/
|
|
1185
|
-
|
|
1186
|
-
request: inboxItemRequestSchema.optional(),
|
|
1175
|
+
request: z.union([inboxItemRequestSchema, inboxItemNoticeRequestSchema]).optional(),
|
|
1187
1176
|
/**
|
|
1188
1177
|
* The top of the owner Conversation's tree that the viewer can see, at
|
|
1189
1178
|
* any depth: the owner when it is a root, or when the viewer cannot see
|
|
@@ -1196,8 +1185,22 @@ const inboxItemSchema = z.object({
|
|
|
1196
1185
|
"done",
|
|
1197
1186
|
"dismissed"
|
|
1198
1187
|
]),
|
|
1188
|
+
/**
|
|
1189
|
+
* What the item is about. `kind` says what the item asks, such as
|
|
1190
|
+
* `github:pull_request_review`. The rest comes from the subject when
|
|
1191
|
+
* Junior reads the item, never from a copy in the item.
|
|
1192
|
+
*/
|
|
1199
1193
|
subject: z.object({
|
|
1200
1194
|
id: z.string().min(1),
|
|
1195
|
+
kind: z.string().min(1),
|
|
1196
|
+
/** The name of a plugin kind's ask, such as `Review requested`. */
|
|
1197
|
+
label: z.string().min(1).optional(),
|
|
1198
|
+
/**
|
|
1199
|
+
* The viewer's card of `url`, such as a pull request with its title
|
|
1200
|
+
* and state. Unset when no link type claims `url`, the viewer
|
|
1201
|
+
* cannot see it, or its provider read failed.
|
|
1202
|
+
*/
|
|
1203
|
+
object: ownedObjectAnnotationSchema.optional(),
|
|
1201
1204
|
/**
|
|
1202
1205
|
* The object type of the link type that claims `url`, such as
|
|
1203
1206
|
* `code_change` for a pull request. Unset when none claims it.
|
|
@@ -1209,19 +1212,9 @@ const inboxItemSchema = z.object({
|
|
|
1209
1212
|
* Unset when no Event source claims it.
|
|
1210
1213
|
*/
|
|
1211
1214
|
resource: inboxSnoozeResourceSchema.optional(),
|
|
1212
|
-
|
|
1213
|
-
/**
|
|
1214
|
-
* A code change title split by Conventional Commits, as the plugin
|
|
1215
|
-
* that owns the code change parsed it.
|
|
1216
|
-
*/
|
|
1217
|
-
titleParts: z.object({
|
|
1218
|
-
breaking: z.boolean().optional(),
|
|
1219
|
-
scope: z.string().min(1).optional(),
|
|
1220
|
-
text: z.string().min(1),
|
|
1221
|
-
type: z.string().min(1).optional()
|
|
1222
|
-
}).strict().optional(),
|
|
1215
|
+
/** The web link of `id`, when `id` is one. */
|
|
1223
1216
|
url: z.string().min(1).optional()
|
|
1224
|
-
}).strict()
|
|
1217
|
+
}).strict(),
|
|
1225
1218
|
title: z.string().min(1),
|
|
1226
1219
|
/**
|
|
1227
1220
|
* The id of the To-do that the item shows, for a To-do assigned to the
|
|
@@ -1417,16 +1410,6 @@ const statsReportSchema = z.object({
|
|
|
1417
1410
|
// src/api/schema/versions.ts
|
|
1418
1411
|
/** The most Conversations that one versions read gives tokens for. */
|
|
1419
1412
|
const VERSIONS_CONVERSATION_LIMIT = 50;
|
|
1420
|
-
/**
|
|
1421
|
-
* `GET /api/versions` sets this header when `GET /api/versions/stream` can
|
|
1422
|
-
* push the same tokens, so a dashboard opens the stream only when it works.
|
|
1423
|
-
*/
|
|
1424
|
-
const VERSIONS_STREAM_HEADER = "x-junior-versions-stream";
|
|
1425
|
-
/**
|
|
1426
|
-
* The SSE event that the versions stream sends while no token moves. A
|
|
1427
|
-
* `Versions` object comes as a plain `message` event.
|
|
1428
|
-
*/
|
|
1429
|
-
const VERSIONS_STREAM_KEEPALIVE_EVENT = "keepalive";
|
|
1430
1413
|
const versionsQuerySchema = z.object({
|
|
1431
1414
|
/**
|
|
1432
1415
|
* The Conversations on screen, comma separated. Their tokens come back
|
|
@@ -1456,4 +1439,4 @@ const versionsSchema = z.object({
|
|
|
1456
1439
|
/** The viewer's rolling model spend. */
|
|
1457
1440
|
spend: z.string().min(1)
|
|
1458
1441
|
}).strict();
|
|
1459
|
-
export {
|
|
1442
|
+
export { userSearchQuerySchema as $, conversationChildAgentsReportSchema as $t, cacheHealthQuerySchema as A, startConnectionResponseSchema as At, serviceAccountParamsSchema as B, codeRepositoryQuerySchema as Bt, inboxSnoozeResourceQuerySchema as C, pushSubscriptionBodySchema as Ct, inboxSnoozeWakesClearSchema as D, connectionParamsSchema as Dt, inboxSnoozeSubjectSchema as E, connectionListSchema as Et, cacheWarmingSavingsRefillResponseSchema as F, codeChangeSummaryReportSchema as Ft, createPersonalTokenBodySchema as G, conversationTodoSchema as Gt, startServiceAccountSignInResponseSchema as H, codeRepositorySummarySchema as Ht, cacheWarmingSavingsReportSchema as I, codeChangeSummarySchema as It, personalTokenMetadataSchema as J, todoStatusBodySchema as Jt, createdPersonalTokenSchema as K, conversationTodosReportSchema as Kt, closeCacheWarmingBreakerResponseSchema as L, codeOverviewReportSchema as Lt, cacheWarmingBreakerListSchema as M, codeActivityDaySchema as Mt, cacheWarmingBreakerParamsSchema as N, codeChangeSearchQuerySchema as Nt, gatewayProvidersSchema as O, connectionSchema as Ot, cacheWarmingSavingsQuerySchema as P, codeChangeSearchReportSchema as Pt, USER_SEARCH_MAX_LIMIT as Q, conversationChildAgentSchema as Qt, disconnectServiceAccountResponseSchema as R, codePersonReportSchema as Rt, inboxSnoozeCreateSchema as S, notificationSettingsSchema as St, inboxSnoozeSchema as T, testNotificationResponseSchema as Tt, searchQuerySchema as U, mentionableCodeChangeSchema as Ut, serviceAccountSchema as V, codeRepositoryReportSchema as Vt, searchReportSchema as W, personCodeQuerySchema as Wt, revokePersonalTokenResponseSchema as X, conversationWatchesReportSchema as Xt, personalTokenParamsSchema as Y, conversationWatchSchema as Yt, USER_SEARCH_DEFAULT_LIMIT as Z, watchParamsSchema as Zt, inboxItemListSchema as _, acceptedConversationMessageSchema as _n, locationParamsSchema as _t, statsReportSchema as a, objectLinksQuerySchema as an, avatarParamsSchema as at, inboxItemWaitingConversationsSchema as b, forkConversationBodySchema as bn, activitySixHours as bt, workspaceBodySchema as c, CONVERSATION_OUTLINE_TEXT_LENGTH as cn, peopleSearchReportSchema as ct, workspaceRepoSchema as d, conversationDeliveryResponseSchema as dn, personalSpendReportSchema as dt, continueConversationInSlackBodySchema as en, userSearchReportSchema as et, workspaceSchema as f, conversationCatchUpBodySchema as fn, spaceConfigEntrySchema as ft, inboxItemListQuerySchema as g, createAttachmentUploadBodySchema as gn, locationDirectoryReportSchema as gt, inboxItemCountSchema as h, attachmentUploadSchema as hn, locationDetailReportSchema as ht, statSchema as i, attachObjectLinkResponseSchema as in, actorProfileReportSchema as it, cacheHealthReportSchema as j, IDLE_CHANGE_DAYS as jt, updateGatewayProvidersBodySchema as k, disconnectConnectionResponseSchema as kt, workspaceListSchema as l, conversationOutlineSchema as ln, personCardReportSchema as lt, inboxItemCountQuerySchema as m, attachmentUploadParamsSchema as mn, locationActivityDayReportSchema as mt, versionsQuerySchema as n, MAX_OBJECT_LINKS as nn, PERSON_CARD_RECENT_LIMIT as nt, baselineSnapshotSchema as o, objectLinksReportSchema as on, mentionablePersonSchema as ot, inboxItemActionSchema as p, conversationCatchUpSchema as pn, spaceConfigurationSchema as pt, personalTokenListSchema as q, todoParamsSchema as qt, versionsSchema as r, attachObjectLinkBodySchema as rn, actorDirectoryReportSchema as rt, deleteWorkspaceResponseSchema as s, conversationStatsReportSchema as sn, peopleSearchQuerySchema as st, VERSIONS_CONVERSATION_LIMIT as t, continueConversationInSlackResponseSchema as tn, userSearchResultSchema as tt, workspaceParamsSchema as u, conversationDeliveryBodySchema as un, personParamsSchema as ut, inboxItemParamsSchema as v, createConversationBodySchema as vn, activityDays as vt, inboxSnoozeResourceSchema as w, pushSubscriptionDeleteBodySchema as wt, INBOX_SNOOZE_MAX_TRIGGERS as x, forkConversationResponseSchema as xn, dailyConversationActivitySchema as xt, inboxItemSchema as y, createConversationMessageBodySchema as yn, activityHours as yt, serviceAccountListSchema as z, codeRepositoryParamsSchema as zt };
|