@sentry/junior 0.316.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-QYiDMnsu.js → admin-CAugg87B.js} +1 -1
- package/dist/{agent-runner-Cr5Fhjf-.js → agent-runner-AjrEV6Qe.js} +13438 -13149
- package/dist/{reporting-window-C4dbzDiR.js → agent-status-BA5x3Xtp.js} +33 -1
- package/dist/{agent-update-delivery-BY13DPSD.js → agent-update-delivery-B_YIZcgf.js} +5 -5
- package/dist/api/schema.d.ts +558 -102
- package/dist/api/schema.js +6 -6
- package/dist/api.js +230 -213
- package/dist/{app-BhvzRD__.d.ts → app-MoNAsVV5.d.ts} +34 -14
- package/dist/app.d.ts +1 -1
- package/dist/app.js +167 -122
- 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-Bref7aPI.js → channel-access-j-YAVYK4.js} +2 -42
- package/dist/{chat-core-engine-3dtlMku3.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 +5 -3
- package/dist/config-CHQ8X251.js +2422 -0
- package/dist/{continue-in-slack-DbQUFe_F.js → continue-in-slack-D-FZ8Fin.js} +2 -3
- package/dist/{conversation-feed-B84pMjHo.js → conversation-feed--9S0_PXL.js} +3 -3
- package/dist/{proxy-path-BTmXDjfx.js → conversation-privacy-B1uXn5sf.js} +2 -16
- package/dist/{conversation-turn-DzEpTIaf.js → conversation-turn-BUE_7xaN.js} +99 -76
- package/dist/{create-DUJBXr6E.js → create-DoDIYgtZ.js} +12 -9
- package/dist/{credential-sync-JH_K9Adg.js → credential-sync-BJOqGnjV.js} +17 -12
- package/dist/{db-DhzvUY23.js → db-BFmyYZtJ.js} +20265 -27551
- package/dist/{deployment-BhvrhQeh.js → deployment-DXq9ZLU4.js} +17 -15
- package/dist/{engine-context-C9Nal48K.js → engine-context-CgQ7mlHt.js} +264 -47
- package/dist/{html-B_12WjKT.js → html-B3VKTGbJ.js} +6 -2
- package/dist/instrumentation.js +15 -7
- package/dist/{job-runner-DO8nslyY.js → job-runner-A1lCkybD.js} +391 -24
- package/dist/{lineage-D3AZAJVe.js → lineage-Bktb0UcV.js} +1 -1
- package/dist/{list-B0zsb5Cp.js → list-Bxvg5wXf.js} +224 -544
- package/dist/{logging-B8KEJegM.js → logging--smS7XRK.js} +2 -2
- package/dist/{session-stop-DponjDUZ.js → mailbox-turn-uSXhUFc9.js} +4747 -7039
- package/dist/{message-B5fKDYzz.js → message-BNenhsmB.js} +12 -22
- package/dist/{model-input-CuMWy37l.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-B3Vvlydo.js → oauth-callback-server-CE4soEIY.js} +2 -2
- package/dist/{oauth-relay-6ERrGPbA.js → oauth-relay-C36gX1gH.js} +2 -2
- package/dist/{package-discovery-BI6T_RkD.js → package-discovery-DD9vencX.js} +1 -50
- package/dist/{list-mkB_GU8R.js → parent-result-Ck1rFYRQ.js} +107 -92
- package/dist/{plugins-BXMdNdyA.js → plugins-D_Ru4CWc.js} +1 -1
- package/dist/profile-BQ-iBDsZ.js +4657 -0
- package/dist/{transcript-CCi7323k.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-D5JVvv6A.js → resolve-tony4ibz.js} +9 -29
- package/dist/{result-CS_7mo8a.js → result-Bta_dlWa.js} +25 -116
- package/dist/run-conversation-DL6ru7iW.js +336 -0
- package/dist/{runner-BzAES5W3.js → runner-BstDRbD9.js} +7 -7
- package/dist/{sandbox-egress-signals-Dwhk2Q5F.js → sandbox-egress-signals-oSJMJOnn.js} +1 -1
- package/dist/{schema-z5-wA6N4.js → schema-DfqrHACA.js} +48 -86
- package/dist/sender-actors-CPglLd5R.js +83 -0
- package/dist/{service-account-D6AsAtc1.js → service-account-CTV_jaNu.js} +3 -1
- package/dist/{skills-DgJ9GBPR.js → skills-BCEU41zM.js} +4 -4
- package/dist/{slack-conversation-unfurl-Dq71EkhM.js → slack-conversation-unfurl-DxVmhbGP.js} +7 -6
- package/dist/{spawn-BJWpdwhQ.js → spawn-frczVPIr.js} +11 -8
- package/dist/{system-prompt-table-iIgpmslr.js → system-prompt-table-CiXy0eNR.js} +88 -69
- package/dist/{task-runner-BJae4JwE.js → task-runner-C9Yc2_ae.js} +20 -46
- package/dist/{thread-context-fiMNylbg.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-BjDW7x-5.js → turn-wake-BhloiI2h.js} +4 -5
- package/dist/{media-BebquhET.js → types-C4iC-IMC.js} +801 -771
- package/dist/user-customization-CvfuY9Eo.js +93 -0
- package/dist/users-ByG5RCEJ.js +181 -0
- package/dist/{validation-D5WmmmhX.js → validation-8gjfR91V.js} +1 -1
- package/dist/{version-CBQoanXb.js → version-BeZhWWBE.js} +1 -1
- package/dist/version.js +1 -1
- package/dist/{worker-Cyb4kF17.js → worker-BqMQQNRk.js} +5 -4
- 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/dist/people-CUtFApfL.js +0 -81
- package/dist/start-conversation-B-LIqqNi.js +0 -162
- package/dist/turn-session-routing-D15orfwy.js +0 -1309
- package/dist/user-customization-B27StpVQ.js +0 -9
- package/dist/web-message-id-C6P83ans.js +0 -10
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { fi as moveIdleConversationDestination } from "./session-stop-DponjDUZ.js";
|
|
1
|
+
import { A as setFirstConversationLocation, Cl as getDashboardConversationLink, Cn as moveIdleConversationDestination, Ei as formatSlackLink, Ku as getStateAdapter, N as claimProviderConversation, O as withConversationMutationLock, P as getConversationIdByProviderConversation, Ti as escapeSlackMrkdwnText, a as getDb, cd as parseSlackChannelId, gd as parseSlackMessageTs, gf as juniorDestinations, i as getConversationStore, mi as getSlackMessagePermalink, o as getSqlExecutor, pi as deleteSlackMessage, vi as postSlackMessage } from "./db-BFmyYZtJ.js";
|
|
2
|
+
import { n as joinPublicChannelForRead, t as checkSlackChannelReadAccess } from "./channel-access-j-YAVYK4.js";
|
|
4
3
|
import { and, eq } from "drizzle-orm";
|
|
5
4
|
// src/chat/slack/continue-in-slack.ts
|
|
6
5
|
/** Refusal for a move that cannot wait for the active Run. */
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { F as actorIdentitySchema, Nt as spaceRefSchema, V as conversationDetailReportSchema, X as conversationSummaryReportSchema, Yt as messageAttachmentSchema, zt as inboxItemChangeRecordSchema } from "./types-C4iC-IMC.js";
|
|
2
2
|
import * as z from "zod";
|
|
3
3
|
// src/api/objects/cards.ts
|
|
4
4
|
const MAX_LABEL_CHARS = 256;
|
|
@@ -345,8 +345,8 @@ const conversationSubscriptionResponseSchema = z.object({
|
|
|
345
345
|
* was the last subscriber, so leaving archived it for everyone.
|
|
346
346
|
*/
|
|
347
347
|
const conversationLeaveResponseSchema = z.object({ archivedAt: z.string().datetime().nullable().describe("Set when the conversation is archived for everyone.") }).strict();
|
|
348
|
-
/** Invite one
|
|
349
|
-
const conversationInviteBodySchema = z.object({
|
|
348
|
+
/** Invite one User, by the id that user search returns, to a Conversation. */
|
|
349
|
+
const conversationInviteBodySchema = z.object({ userId: z.string().min(1).max(64) }).strict();
|
|
350
350
|
/** `added` is false when the person was already a Participant. */
|
|
351
351
|
const conversationInviteResponseSchema = z.object({ added: z.boolean() }).strict();
|
|
352
352
|
// src/api/schema/conversation-stop.ts
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { h as logWarn } from "./logging
|
|
1
|
+
import { h as logWarn } from "./logging--smS7XRK.js";
|
|
2
2
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
3
3
|
import { renderSystemMessageUpdate } from "@earendil-works/pi-ai";
|
|
4
4
|
// src/chat/conversation-privacy.ts
|
|
@@ -186,18 +186,4 @@ function toGenAiMessagesTraceAttributes(prefix, messages) {
|
|
|
186
186
|
...partTypes.size > 0 ? { [`${prefix}.part_types`]: [...partTypes] } : void 0
|
|
187
187
|
};
|
|
188
188
|
}
|
|
189
|
-
|
|
190
|
-
const SANDBOX_EGRESS_PROXY_PATH = "/api/internal/sandbox-egress";
|
|
191
|
-
const PROXY_PATH_PREFIX = `${SANDBOX_EGRESS_PROXY_PATH}/`;
|
|
192
|
-
const SIGNALS_SEGMENT = "signals";
|
|
193
|
-
/**
|
|
194
|
-
* Replace the credential token and everything after it in a sandbox egress
|
|
195
|
-
* proxy path or URL. Other values are returned unchanged.
|
|
196
|
-
*/
|
|
197
|
-
function redactSandboxEgressProxyPath(value) {
|
|
198
|
-
const index = value.indexOf(PROXY_PATH_PREFIX);
|
|
199
|
-
if (index === -1) return value;
|
|
200
|
-
if (value.slice(index + PROXY_PATH_PREFIX.length).split(/[/?#]/, 1)[0] === SIGNALS_SEGMENT) return value;
|
|
201
|
-
return `${value.slice(0, index)}${PROXY_PATH_PREFIX}<token>`;
|
|
202
|
-
}
|
|
203
|
-
export { resolveConversationPrivacy as a, toCanonicalOutputMessage as c, toGenAiPayloadTraceAttributes as d, getCurrentConversationPrivacy as i, toGenAiMessagesTraceAttributes as l, redactSandboxEgressProxyPath as n, runWithConversationPrivacy as o, canExposeConversationPayload as r, toCanonicalInputMessage as s, SANDBOX_EGRESS_PROXY_PATH as t, toGenAiPayloadMetadata as u };
|
|
189
|
+
export { toCanonicalInputMessage as a, toGenAiPayloadMetadata as c, runWithConversationPrivacy as i, toGenAiPayloadTraceAttributes as l, getCurrentConversationPrivacy as n, toCanonicalOutputMessage as o, resolveConversationPrivacy as r, toGenAiMessagesTraceAttributes as s, canExposeConversationPayload as t };
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-BKpuH2hG.js";
|
|
2
|
-
import { $
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { a as buildDeliveredTurnStatePatch, o as loadPendingMessageCards, r as completeAuthPauseTurn, t as buildTurnThreadContext } from "./thread-context-
|
|
7
|
-
import {
|
|
8
|
-
import { d as isChildAgentEvent,
|
|
2
|
+
import { $r as getDispatchIdForConversation, Bo as credentialContextForActor, Io as verifyTimerWatchCredentialSubject, Ku as getStateAdapter, Mn as readParentMessage, On as canJoinTurn, Pn as isEventMailboxMetadata, Qo as isConversationDeliveryPaused, Ro as JUNIOR_THREAD_STATE_TTL_MS, Xi as blockScheduledAutomation, Xn as sendSlackReply, Yn as resolveSlackReplyTarget, a as getDb, di as notifyAutomationBlocked, hu as indexEndedTurnEvents, i as getConversationStore, iu as isTopLevel, n as getConversationEventStore, nu as isPersonInput, oa as blockEventAutomation, ou as ownsLocation, rn as getConversationWorkState, uu as turnBehavior, yf as resolveConversationDestination } from "./db-BFmyYZtJ.js";
|
|
3
|
+
import { Lt as readConversationAutomationRun, M as measureTurnCompactionWait, q as stopConversationAndChildAgents } from "./agent-runner-AjrEV6Qe.js";
|
|
4
|
+
import { E as withSpan, S as setTags, h as logWarn, p as logException } from "./logging--smS7XRK.js";
|
|
5
|
+
import { Xt as readMessageAttachments, wt as instructionProvenanceFor } from "./types-C4iC-IMC.js";
|
|
6
|
+
import { a as buildDeliveredTurnStatePatch, o as loadPendingMessageCards, r as completeAuthPauseTurn, t as buildTurnThreadContext } from "./thread-context-CqZDKErp.js";
|
|
7
|
+
import { At as turnRequestText, Dt as instructionActorFor, Er as getTurnLifecycle, Et as buildSteeringPiMessage, Fn as persistConversationMessages, Gn as recordDeliveredAssistantMessage, Hn as latestConversationMessageSeq, Jn as upsertConversationMessage, M as eventBatchMessageMeta, N as renderEventBatchInputs, Nn as hydrateConversationMessages, Ot as instructionForInputs, P as timerWatchCredentialSubject, Qn as isEventConversationMessage, Rr as finalizeFailedTurnReplyWithEvent, Rt as buildDeterministicTurnId, Sr as getTurnRecord, St as loadInboxItemInput, Tr as ConversationTurnLifecycleService, Un as markConversationMessage, Wn as normalizeConversationText, X as getTurnUserMessage, Y as completeCancelledConversationTurn, _t as coerceThreadConversationState, c as legacyWebMailboxMetadataSchema, ct as markTurnClosed, d as childAgentTurnOptions, dt as startActiveTurn, f as commitParentMessageFork, gn as commitAcceptedReply, gt as persistThreadStateById, i as listActiveMailboxTurns, it as getConversationTurnBoundaryError, jt as withoutSavedSteeringMessages, m as isParentMessageAuthor, mt as getPersistedThreadState, n as getEventBatchDelayMs, nt as TurnInputCommitLostError, o as sourceFromTurnInput, ot as isTurnInputCommitLostError, pt as getPersistedSandboxState, s as turnInputFactsFromConversationMessage, ti as persistWithRetry, ut as markTurnFailed, vr as saveTurnCheckpoint, vt as createWebAuthorization, xr as failTurnRecord, xt as eventInboxItemInputs, yn as loadConversationProjection, yr as abandonTurnRecord, yt as deleteWebAuthorization } from "./mailbox-turn-uSXhUFc9.js";
|
|
8
|
+
import { d as isChildAgentEvent, t as parentResultActor } from "./parent-result-Ck1rFYRQ.js";
|
|
9
9
|
import { i as getActiveSpan, r as continueTrace } from "./sentry-CPbZjomA.js";
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import { n as
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import { t as readConversationLineage } from "./lineage-
|
|
10
|
+
import { h as getAssistantReplyText } from "./system-prompt-table-CiXy0eNR.js";
|
|
11
|
+
import { t as botConfig } from "./config-CHQ8X251.js";
|
|
12
|
+
import { i as CONVERSATION_METADATA_TASK, n as scheduleSessionCompletedPluginTasks, t as processPluginTask } from "./task-runner-C9Yc2_ae.js";
|
|
13
|
+
import { n as getPausedTurnRequest } from "./turn-wake-BhloiI2h.js";
|
|
14
|
+
import { L as mapBounded } from "./prompt-Dv7gkpD6.js";
|
|
15
|
+
import { t as readConversationLineage } from "./lineage-Bktb0UcV.js";
|
|
16
16
|
import * as z from "zod";
|
|
17
17
|
import { isDeepStrictEqual } from "node:util";
|
|
18
18
|
import { createHash } from "node:crypto";
|
|
@@ -449,6 +449,81 @@ async function runTurnEndTasks(args) {
|
|
|
449
449
|
params
|
|
450
450
|
}, conversationId, turnId);
|
|
451
451
|
}
|
|
452
|
+
// src/chat/task-execution/turn-failure.ts
|
|
453
|
+
function captureConversationTurnFailure(args) {
|
|
454
|
+
const eventId = logException(args.error, `conversation.turn.${args.failureCode}`, {
|
|
455
|
+
conversationId: args.conversationId,
|
|
456
|
+
...args.runId ? { runId: args.runId } : void 0,
|
|
457
|
+
turnId: args.turnId
|
|
458
|
+
});
|
|
459
|
+
return typeof eventId === "string" ? eventId : void 0;
|
|
460
|
+
}
|
|
461
|
+
/**
|
|
462
|
+
* Record a final-attempt failure on the Turn record, the Conversation, and
|
|
463
|
+
* the Turn lifecycle, so the Turn ends failed and its update reaches the
|
|
464
|
+
* starter and Watches. The caller still acknowledges the input.
|
|
465
|
+
*/
|
|
466
|
+
async function failConversationTurn(args) {
|
|
467
|
+
const { conversation, conversationId, failure, failureCode, runId, turnId, userMessageId } = args;
|
|
468
|
+
const failureEventId = args.modelFailureCaptureAttempted && failureCode === "agent_run_failed" ? args.modelFailureEventId : captureConversationTurnFailure({
|
|
469
|
+
conversationId,
|
|
470
|
+
error: failure,
|
|
471
|
+
failureCode,
|
|
472
|
+
runId,
|
|
473
|
+
turnId
|
|
474
|
+
});
|
|
475
|
+
try {
|
|
476
|
+
const latest = await getTurnRecord(conversationId, turnId);
|
|
477
|
+
if (latest) await failTurnRecord({
|
|
478
|
+
conversationId,
|
|
479
|
+
errorMessage: failure instanceof Error ? failure.message : String(failure),
|
|
480
|
+
expectedVersion: latest.version,
|
|
481
|
+
turnId
|
|
482
|
+
});
|
|
483
|
+
} catch (turnRecordError) {
|
|
484
|
+
captureConversationTurnFailure({
|
|
485
|
+
conversationId,
|
|
486
|
+
error: turnRecordError,
|
|
487
|
+
failureCode: "persistence_failed",
|
|
488
|
+
runId,
|
|
489
|
+
turnId
|
|
490
|
+
});
|
|
491
|
+
}
|
|
492
|
+
try {
|
|
493
|
+
markTurnFailed({
|
|
494
|
+
conversation,
|
|
495
|
+
nowMs: Date.now(),
|
|
496
|
+
sessionId: turnId,
|
|
497
|
+
userMessageId,
|
|
498
|
+
markConversationMessage
|
|
499
|
+
});
|
|
500
|
+
await persistThreadStateById(conversationId, {
|
|
501
|
+
conversation,
|
|
502
|
+
sandboxRef: args.sandboxRef ?? null
|
|
503
|
+
});
|
|
504
|
+
} catch (persistenceError) {
|
|
505
|
+
captureConversationTurnFailure({
|
|
506
|
+
conversationId,
|
|
507
|
+
error: persistenceError,
|
|
508
|
+
failureCode: "persistence_failed",
|
|
509
|
+
runId,
|
|
510
|
+
turnId
|
|
511
|
+
});
|
|
512
|
+
}
|
|
513
|
+
await args.lifecycle.fail({
|
|
514
|
+
conversationId,
|
|
515
|
+
createdAtMs: Date.now(),
|
|
516
|
+
...failureEventId ? { eventId: failureEventId } : void 0,
|
|
517
|
+
failureCode,
|
|
518
|
+
failureText: failure instanceof Error ? failure.message : String(failure),
|
|
519
|
+
reportAs: args.reportAs,
|
|
520
|
+
turnId
|
|
521
|
+
});
|
|
522
|
+
await indexEndedTurnEvents({
|
|
523
|
+
conversationId,
|
|
524
|
+
turnId
|
|
525
|
+
});
|
|
526
|
+
}
|
|
452
527
|
// src/chat/task-execution/mailbox-input.ts
|
|
453
528
|
/**
|
|
454
529
|
* Return the Turn inputs of web Messages, one per non-empty Message, in
|
|
@@ -619,14 +694,6 @@ var conversation_turn_exports = /* @__PURE__ */ __exportAll({ createConversation
|
|
|
619
694
|
function stableHex(...parts) {
|
|
620
695
|
return createHash("sha256").update(parts.join("\0")).digest("hex").slice(0, 24);
|
|
621
696
|
}
|
|
622
|
-
function captureConversationTurnFailure(args) {
|
|
623
|
-
const eventId = logException(args.error, `conversation.turn.${args.failureCode}`, {
|
|
624
|
-
conversationId: args.conversationId,
|
|
625
|
-
...args.runId ? { runId: args.runId } : void 0,
|
|
626
|
-
turnId: args.turnId
|
|
627
|
-
});
|
|
628
|
-
return typeof eventId === "string" ? eventId : void 0;
|
|
629
|
-
}
|
|
630
697
|
function hasLostTurnInputCommit(error) {
|
|
631
698
|
const cause = getConversationTurnBoundaryError(error)?.cause ?? error;
|
|
632
699
|
return isTurnInputCommitLostError(error) || isTurnInputCommitLostError(cause);
|
|
@@ -766,7 +833,7 @@ function createConversationTurnWorker(agentRunner, deliverMessage, updates) {
|
|
|
766
833
|
const webActor = actor.platform === "web" ? actor : void 0;
|
|
767
834
|
const signInActor = behavior.waitsForSignIn ? webActor : void 0;
|
|
768
835
|
const disabledFeatures = signInActor ? [] : ["interactive-auth"];
|
|
769
|
-
const deliverToProvider = postsToProvider && behavior.delivery === "location";
|
|
836
|
+
const deliverToProvider = postsToProvider && (behavior.delivery === "location" || !behavior.gated && storedConversation !== void 0 && ownsLocation(storedConversation));
|
|
770
837
|
const surface = postsToProvider ? "slack" : "api";
|
|
771
838
|
const inputTelemetry = resolved.kind === "mailbox" ? turnInputTelemetry(resolved.batch.map((entry) => entry.message)) : void 0;
|
|
772
839
|
const turnTrace = inputTelemetry ?? (savedTurn?.traceContext ? { traceContexts: [savedTurn.traceContext] } : void 0);
|
|
@@ -1067,63 +1134,19 @@ function createConversationTurnWorker(agentRunner, deliverMessage, updates) {
|
|
|
1067
1134
|
if (hasLostTurnInputCommit(failure)) return { status: "lost_lease" };
|
|
1068
1135
|
if (stopSignal?.aborted) return await completeCancelledTurn();
|
|
1069
1136
|
if (!context.attempt.isFinalAttempt) throw failure;
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
error: failure,
|
|
1073
|
-
failureCode,
|
|
1074
|
-
runId: currentRunId,
|
|
1075
|
-
turnId
|
|
1076
|
-
});
|
|
1077
|
-
try {
|
|
1078
|
-
const latest = await getTurnRecord(context.conversationId, turnId);
|
|
1079
|
-
if (latest) await failTurnRecord({
|
|
1080
|
-
conversationId: context.conversationId,
|
|
1081
|
-
errorMessage: failure instanceof Error ? failure.message : String(failure),
|
|
1082
|
-
expectedVersion: latest.version,
|
|
1083
|
-
turnId
|
|
1084
|
-
});
|
|
1085
|
-
} catch (turnRecordError) {
|
|
1086
|
-
captureConversationTurnFailure({
|
|
1087
|
-
conversationId: context.conversationId,
|
|
1088
|
-
error: turnRecordError,
|
|
1089
|
-
failureCode: "persistence_failed",
|
|
1090
|
-
runId: currentRunId,
|
|
1091
|
-
turnId
|
|
1092
|
-
});
|
|
1093
|
-
}
|
|
1094
|
-
try {
|
|
1095
|
-
markTurnFailed({
|
|
1096
|
-
conversation,
|
|
1097
|
-
nowMs: Date.now(),
|
|
1098
|
-
sessionId: turnId,
|
|
1099
|
-
userMessageId,
|
|
1100
|
-
markConversationMessage
|
|
1101
|
-
});
|
|
1102
|
-
await persistThreadStateById(context.conversationId, {
|
|
1103
|
-
conversation,
|
|
1104
|
-
sandboxRef: initialSandboxRef ?? null
|
|
1105
|
-
});
|
|
1106
|
-
} catch (persistenceError) {
|
|
1107
|
-
captureConversationTurnFailure({
|
|
1108
|
-
conversationId: context.conversationId,
|
|
1109
|
-
error: persistenceError,
|
|
1110
|
-
failureCode: "persistence_failed",
|
|
1111
|
-
runId: currentRunId,
|
|
1112
|
-
turnId
|
|
1113
|
-
});
|
|
1114
|
-
}
|
|
1115
|
-
await lifecycle.fail({
|
|
1137
|
+
await failConversationTurn({
|
|
1138
|
+
conversation,
|
|
1116
1139
|
conversationId: context.conversationId,
|
|
1117
|
-
|
|
1118
|
-
...failureEventId ? { eventId: failureEventId } : void 0,
|
|
1140
|
+
failure,
|
|
1119
1141
|
failureCode,
|
|
1120
|
-
|
|
1142
|
+
lifecycle,
|
|
1143
|
+
modelFailureCaptureAttempted,
|
|
1144
|
+
modelFailureEventId,
|
|
1121
1145
|
reportAs: parentResultActor(actor, source.kind),
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
turnId
|
|
1146
|
+
runId: currentRunId,
|
|
1147
|
+
sandboxRef: initialSandboxRef,
|
|
1148
|
+
turnId,
|
|
1149
|
+
userMessageId
|
|
1127
1150
|
});
|
|
1128
1151
|
await acknowledge();
|
|
1129
1152
|
return { status: "completed" };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import { Gd as juniorAgentBindings, It as spawnChildAgentInputSchema, Mt as getAgentBinding, Zl as capsActiveChildren, i as getConversationStore, lf as juniorConversations, o as getSqlExecutor, rd as nextDetailVersion, rn as getConversationWorkState, tn as ensureConversationWake, yn as hasConversationStop } from "./db-BFmyYZtJ.js";
|
|
2
|
+
import { C as getChildAgentLockName, Dr as loadTurnStart, It as addConversationNote, T as getSpawnedChildConversationId, W as getConversationStoppedAtMs, b as readAgentConfig, l as appendParentMessage, u as buildParentMessage, y as agentConfigSchema } from "./mailbox-turn-uSXhUFc9.js";
|
|
3
|
+
import { m as readChildConversationSender, r as recordSubagentStartedMarker, s as listOpenChildAgents } from "./parent-result-Ck1rFYRQ.js";
|
|
4
|
+
import { I as AgentNameInUseError, L as AgentStoppedError, R as ChildAgentLimitError } from "./agent-runner-AjrEV6Qe.js";
|
|
5
5
|
import { randomUUID } from "node:crypto";
|
|
6
6
|
import { eq } from "drizzle-orm";
|
|
7
7
|
/**
|
|
@@ -14,14 +14,17 @@ async function assertCanGiveChildWork(parentConversationId) {
|
|
|
14
14
|
}
|
|
15
15
|
/**
|
|
16
16
|
* Throw when giving work to one child agent would put its parent over
|
|
17
|
-
* `
|
|
17
|
+
* `MAX_ACTIVE_CHILD_AGENTS`, unless the parent is a Lead. A child agent is active while
|
|
18
18
|
* its listing shows open work, so a busy child already counts and messages
|
|
19
19
|
* queued for it do not count again. A new or idle child becomes active. This
|
|
20
20
|
* is the only place the rule for which child agents count lives. `active` is
|
|
21
21
|
* the parent's active children from `listOpenChildAgents`.
|
|
22
22
|
*/
|
|
23
|
-
function assertChildAgentCapacity(active, childConversationId) {
|
|
24
|
-
if (
|
|
23
|
+
async function assertChildAgentCapacity(parentConversationId, active, childConversationId) {
|
|
24
|
+
if (active.includes(childConversationId) || active.length < 8) return;
|
|
25
|
+
const parent = await getConversationStore().get({ conversationId: parentConversationId });
|
|
26
|
+
if (parent && !capsActiveChildren(parent.kind)) return;
|
|
27
|
+
throw new ChildAgentLimitError(8);
|
|
25
28
|
}
|
|
26
29
|
/**
|
|
27
30
|
* Create the Conversation of one new child agent and bind its name, after
|
|
@@ -35,7 +38,7 @@ async function createChildAgentConversation(input, childConversationId, nowMs) {
|
|
|
35
38
|
name: input.agentName,
|
|
36
39
|
parentConversationId: input.parentConversationId
|
|
37
40
|
})) throw new AgentNameInUseError(input.agentName);
|
|
38
|
-
assertChildAgentCapacity(await listOpenChildAgents(input.parentConversationId), childConversationId);
|
|
41
|
+
await assertChildAgentCapacity(input.parentConversationId, await listOpenChildAgents(input.parentConversationId), childConversationId);
|
|
39
42
|
await getConversationStore().createChild({
|
|
40
43
|
childConversationId,
|
|
41
44
|
kind: input.kind,
|
|
@@ -202,7 +205,7 @@ async function messageChildAgent(input, options, nowMs = Date.now()) {
|
|
|
202
205
|
}
|
|
203
206
|
await assertCanGiveChildWork(input.parentConversationId);
|
|
204
207
|
const active = await listOpenChildAgents(input.parentConversationId);
|
|
205
|
-
assertChildAgentCapacity(active, input.childConversationId);
|
|
208
|
+
await assertChildAgentCapacity(input.parentConversationId, active, input.childConversationId);
|
|
206
209
|
return {
|
|
207
210
|
delivery: "message",
|
|
208
211
|
value: active.includes(input.childConversationId) ? "queued" : "started"
|
|
@@ -1,13 +1,18 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { i as finalizeMcpAuthorization } from "./agent-runner-
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import { n as
|
|
1
|
+
import { Ku as getStateAdapter, dd as parseSlackUserId, hc as upsertLinkedIdentity, o as getSqlExecutor, pc as findUserByVerifiedEmails, sc as resolveActorIdentityId, tc as readIdentityById, vi as postSlackMessage, zs as getSlackClient } from "./db-BFmyYZtJ.js";
|
|
2
|
+
import { M as acquireActiveLock, n as getChatConfig, r as getRuntimeMetadata, t as botConfig } from "./config-CHQ8X251.js";
|
|
3
|
+
import { M as isNativeIdentityProvider, _ as runBestEffort, h as logWarn, p as logException } from "./logging--smS7XRK.js";
|
|
4
|
+
import { L as mapBounded } from "./prompt-Dv7gkpD6.js";
|
|
5
|
+
import { Sr as getTurnRecord, Tn as recordAuthorizationCompleted, _t as coerceThreadConversationState, ii as parseOAuthStatePayload, mt as getPersistedThreadState, or as authorizationId, pr as getConversationPendingAuth, ri as formatProviderLabel, wn as recordAuthenticationLinked, yt as deleteWebAuthorization } from "./mailbox-turn-uSXhUFc9.js";
|
|
6
|
+
import { i as finalizeMcpAuthorization } from "./agent-runner-AjrEV6Qe.js";
|
|
7
|
+
import { i as homeDir } from "./package-discovery-DD9vencX.js";
|
|
8
|
+
import { t as discoverSkills } from "./skills-BCEU41zM.js";
|
|
9
|
+
import { C as getMcpAuthSession, H as getMcpProviderErrorAttributes, T as getMcpStoredOAuthCredentials, f as buildOAuthTokenRequest, k as putMcpStoredOAuthCredentials, m as hasRequiredOAuthScope, p as parseOAuthTokenResponse, y as deleteMcpAuthSession } from "./registry-iXMT5Jmh.js";
|
|
10
|
+
import { n as pluginCatalogRuntime } from "./catalog-runtime-DfSpJZdY.js";
|
|
11
|
+
import { A as createUserTokenStore, I as resolvePluginOAuthAccount } from "./profile-BQ-iBDsZ.js";
|
|
12
|
+
import { i as lookupSlackUserProfile } from "./users-ByG5RCEJ.js";
|
|
13
|
+
import { a as wakePausedTurn, i as wakeAuthorizedTurn } from "./turn-wake-BhloiI2h.js";
|
|
14
|
+
import { s as readConnectedOAuthTokens, t as escapeHtml, u as htmlCallbackResponse } from "./html-B3VKTGbJ.js";
|
|
15
|
+
import { n as relayLocalOAuthCallback } from "./oauth-relay-C36gX1gH.js";
|
|
11
16
|
import * as z from "zod";
|
|
12
17
|
import path from "node:path";
|
|
13
18
|
import { createHmac, createSecretKey, timingSafeEqual } from "node:crypto";
|
|
@@ -495,7 +500,7 @@ async function GET(request, provider, waitUntil, options) {
|
|
|
495
500
|
const clientId = process.env[providerConfig.clientIdEnv]?.trim();
|
|
496
501
|
const clientSecret = process.env[providerConfig.clientSecretEnv]?.trim();
|
|
497
502
|
if (!clientId || !clientSecret) return htmlErrorResponse("Configuration error", "OAuth client credentials are not configured on the server.", 500);
|
|
498
|
-
const baseUrl =
|
|
503
|
+
const baseUrl = getChatConfig().deployment.baseUrl;
|
|
499
504
|
if (!baseUrl) return htmlErrorResponse("Configuration error", "The server cannot determine its base URL.", 500);
|
|
500
505
|
const redirectUri = `${baseUrl}${providerConfig.callbackPath}`;
|
|
501
506
|
const requestedScope = stored.scope ?? providerConfig.scope;
|
|
@@ -639,7 +644,7 @@ const localCredentialSyncSchema = z.object({
|
|
|
639
644
|
tokens: pluginStoredTokensSchema
|
|
640
645
|
}).strict();
|
|
641
646
|
function syncSecret() {
|
|
642
|
-
const secret =
|
|
647
|
+
const secret = getChatConfig().secrets.juniorSecret;
|
|
643
648
|
if (!secret) throw new Error("Local credential sync requires JUNIOR_SECRET");
|
|
644
649
|
return secret;
|
|
645
650
|
}
|