@sentry/junior 0.320.0 → 0.322.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-DlLLoJKj.js → adapter-CKtEUuWD.js} +23 -2
- package/dist/{admin-BzRXDVfh.js → admin-BGOiUGwR.js} +1 -1
- package/dist/{agent-DxZ7nHfD.js → agent-OUkEw6Bv.js} +276 -1648
- package/dist/{agent-status-Bq_AIpyp.js → agent-status-C_HHxO_d.js} +1 -10
- package/dist/{agent-update-delivery-CO4FU5Gg.js → agent-update-delivery-H6mnPI4q.js} +4 -4
- package/dist/api/schema.d.ts +98 -16
- package/dist/api/schema.js +6 -6
- package/dist/api.js +81 -36
- package/dist/{app-CHCFIIDu.d.ts → app-BK_vhZIq.d.ts} +1 -1
- package/dist/app.d.ts +1 -1
- package/dist/app.js +85 -48
- package/dist/{change-record-K-KsqNhT.d.ts → change-record-DdrJxahk.d.ts} +26 -15
- package/dist/{channel-access-BghWqlXx.js → channel-access-DRhVJIuQ.js} +1 -1
- package/dist/{chat-core-engine-BgfSLrDu.js → chat-core-engine-El308gYr.js} +5 -10
- package/dist/cli/chat.js +16 -16
- package/dist/cli/check.js +4 -4
- package/dist/cli/main.js +2 -2
- package/dist/cli/plugins.js +3 -3
- package/dist/cli/snapshot-create.js +4 -4
- package/dist/cli/upgrade.js +2 -2
- package/dist/{continue-in-slack-DBlQP4PC.js → continue-in-slack-DYl631oM.js} +3 -3
- package/dist/{conversation-feed-DEUdD7mb.js → conversation-feed-BUaMmSLi.js} +2 -12
- package/dist/{conversation-privacy-qoh95v90.js → conversation-privacy-DR_j5Tqf.js} +1 -1
- package/dist/{create-jZSaDrCR.js → create-ZkI-_JAs.js} +2 -2
- package/dist/{credential-sync-Bj9-UlNE.js → credential-sync-Bo6_FtCI.js} +12 -12
- package/dist/{db-BacvswT0.js → db-RDpWIeRK.js} +1744 -216
- package/dist/{deployment-BoJkRPDt.js → deployment-CeKaP0ZJ.js} +1 -1
- package/dist/{html-DW0pw5Pr.js → html-BMv4fAPu.js} +5 -5
- package/dist/instrumentation.js +2 -2
- package/dist/{list-Dz3CdP3g.js → list-CuLf7Ob2.js} +39 -70
- package/dist/{logging-DsTnMqyi.js → logging-BQsfrLHl.js} +1 -1
- package/dist/{markers-C33gNYNE.js → markers-Bh0vqJ5k.js} +3186 -1754
- package/dist/nitro.d.ts +1 -1
- package/dist/nitro.js +3 -4
- package/dist/{oauth-callback-server-C-pEhAQK.js → oauth-callback-server-BxuN0Jqz.js} +2 -2
- package/dist/{oauth-relay-DIXdH-io.js → oauth-relay-vyG2gOwY.js} +1 -1
- package/dist/{profile-v9vA3RvH.js → profile-DiAB4QfT.js} +39 -8
- package/dist/{prompt-C5CW2wKO.js → prompt-5PDkRQ1K.js} +2 -1
- package/dist/{reports-eBgrhPXS.js → reports-CbqB7unq.js} +2 -2
- package/dist/{resolve-HVXmbeCr.js → resolve-C7e0pwuP.js} +5 -5
- package/dist/{result-BPNzgeTl.js → result-D_D-2Adp.js} +7 -7
- package/dist/{runner-aNSDTST6.js → runner-CCVTdp0x.js} +7 -7
- package/dist/{sandbox-egress-signals-nzp9Ykf7.js → sandbox-egress-signals-D4OKOFgy.js} +1 -1
- package/dist/{schema-BlTO5M1d.js → schema-CmPO8BfI.js} +50 -12
- package/dist/{service-account-DWIf1t6p.js → service-account-CeWsFrBi.js} +2 -2
- package/dist/{skills-50izzzdK.js → skills-DfbOjWxl.js} +5 -5
- package/dist/{slack-conversation-unfurl-C6jXhVYg.js → slack-conversation-unfurl-BxF0Yb3-.js} +10 -9
- package/dist/{system-prompt-table-CIR1B44Z.js → system-prompt-table-DySHMtu0.js} +17 -17
- package/dist/{topics-DxuKurCX.js → topic-ChZe9WPj.js} +6 -1
- package/dist/{engine-context-Bi3Ync5t.js → turn-ended-DQ10G3in.js} +11 -845
- package/dist/{types-BNHkJrOP.js → types-BWAgOJtR.js} +95 -78
- package/dist/{user-customization-CvfuY9Eo.js → user-customization-DNzu_r1x.js} +10 -1
- package/dist/{users-DOVo9sdU.js → users-BmZlg_ci.js} +13 -7
- package/dist/{validation-CK0vuEHB.js → validation-BU4tXvH3.js} +1 -1
- package/dist/{version-BuLVNlxB.js → version-D9yLYOBu.js} +1 -1
- package/dist/version.js +1 -1
- package/dist/{worker-C82kHU1R.js → worker-C7EDSL3d.js} +4 -4
- package/migrations/20261127184420_question_answerer/migration.sql +36 -0
- package/migrations/20261127184420_question_answerer/snapshot.json +108 -0
- package/migrations/20261127224730_inbox_item_close_action/migration.sql +1 -0
- package/migrations/20261127224730_inbox_item_close_action/snapshot.json +42 -0
- package/package.json +6 -6
- package/skills/design-automation-skill/SKILL.md +1 -1
- package/dist/storage-BtCxXiNt.js +0 -273
- package/dist/topic-B2EWKKBT.js +0 -6
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { L as botConfig } from "./adapter-
|
|
2
|
-
import {
|
|
3
|
-
import { G as mapBounded } from "./prompt-
|
|
4
|
-
import {
|
|
1
|
+
import { L as botConfig } from "./adapter-CKtEUuWD.js";
|
|
2
|
+
import { $f as deleteMcpServerSessionId, Kf as hasRequiredOAuthScope, Qf as deleteMcpAuthSessionsForUserProvider, ep as deleteMcpStoredOAuthCredentials, hl as deleteProviderIdentityForUser, jf as getAppContext, ml as deleteProviderIdentityForSlackUser, o as getSqlExecutor } from "./db-RDpWIeRK.js";
|
|
3
|
+
import { G as mapBounded } from "./prompt-5PDkRQ1K.js";
|
|
4
|
+
import { zi as startOAuthFlow } from "./markers-Bh0vqJ5k.js";
|
|
5
5
|
import { randomBytes } from "node:crypto";
|
|
6
6
|
// src/handlers/oauth-html.ts
|
|
7
7
|
/** Build pre-escaped callback HTML with the shared response security policy. */
|
|
@@ -361,7 +361,7 @@ function renderHtmlPage(page) {
|
|
|
361
361
|
<meta charset="utf-8" />
|
|
362
362
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
363
363
|
<title>${escapeHtml(page.title)}</title>
|
|
364
|
-
<style>${PAGE_STYLE}</style>
|
|
364
|
+
${page.headHtml ? `${page.headHtml}\n` : ""} <style>${PAGE_STYLE}</style>
|
|
365
365
|
</head>
|
|
366
366
|
<body>
|
|
367
367
|
<main>
|
package/dist/instrumentation.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { a as getClient, c as init, i as getActiveSpan, o as getGlobalScope, p as spanToJSON, s as getTraceData, u as sentry_exports } from "./sentry-CPbZjomA.js";
|
|
2
|
-
import { n as getCurrentConversationPrivacy } from "./conversation-privacy-
|
|
2
|
+
import { n as getCurrentConversationPrivacy } from "./conversation-privacy-DR_j5Tqf.js";
|
|
3
3
|
import { n as isPushServiceHost } from "./push-endpoint-CO-nomUd.js";
|
|
4
4
|
import { n as redactSandboxEgressProxyPath } from "./proxy-path-BHYoKZdq.js";
|
|
5
5
|
import { n as promoteHttpRouteName, r as routeNameMiddleware, t as nameRequestRoute } from "./sentry-route-name-C6EIzAGP.js";
|
|
6
6
|
import { t as consumePrivateTraceResultMarker } from "./private-trace-result-CE7_lEdq.js";
|
|
7
|
-
import { _ as getDeploymentTelemetryAttributes, g as getDeploymentServiceVersion } from "./deployment-
|
|
7
|
+
import { _ as getDeploymentTelemetryAttributes, g as getDeploymentServiceVersion } from "./deployment-CeKaP0ZJ.js";
|
|
8
8
|
import { performance } from "node:perf_hooks";
|
|
9
9
|
import { subscribe, unsubscribe } from "node:diagnostics_channel";
|
|
10
10
|
// src/chat/pi/gateway-request-timing.ts
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { $ as resolveGatewayModel, L as botConfig, R as getChatConfig, a as getStateValues, i as getStateAdapter, o as setStateValues } from "./adapter-
|
|
2
|
-
import { $ as
|
|
3
|
-
import { $ as activityPreviewText,
|
|
4
|
-
import { T as withSpan, f as logException, m as logWarn, p as logInfo, y as setSpanAttributes } from "./logging-
|
|
1
|
+
import { $ as resolveGatewayModel, L as botConfig, R as getChatConfig, a as getStateValues, i as getStateAdapter, o as setStateValues } from "./adapter-CKtEUuWD.js";
|
|
2
|
+
import { $ as conversationOwnsInboxItem, $a as createPluginCache, $i as buildDispatchId, $l as identityAvatarUrl, $t as getConversation, Ai as rootVisibleToViewer, Al as closeInboxItem, As as listConversationsWithWatches, Bp as nextDetailVersion, Bs as verifySlackDirectCredentialSubject, Cc as isPublicConversation, Ci as readConversationAccessFromSql, Co as eventAutomationRunLimitReason, Cs as collectEventMatchKeys, Di as conversationIsNotUnsubscribedRoot, Dl as closeHandledReplyNotices, Ds as findMatchingWatches, Ei as conversationIsMemberRoot, El as waitingConversationIdsQuery, Eu as parseDashboardConversationLink, F as conversationCostOf, Fa as wrapBareSlackUserIds, Fl as listReplyActionItems, Fm as juniorMessageAttachments, Fp as hasAgentTurnUsage, Fs as bindScheduledAutomationCredentialSubject, Ft as setTodoStatusByUser, G as conversationKindFromRow, H as conversationTurnFailedSql, Hl as itemQuestion, Hm as juniorUsers, Ho as readAutomationTitlesByConversationId, Hs as updateTimerIndex, Ia as applyPluginFormatMarkdown, Il as ownerConversationId, Im as juniorConversations, Is as bindSlackDirectCredentialSubject, J as treeAwaitsAuthorization, Jp as listedConversation, Jr as createPluginEventPublisher, K as awaitsAuthorizationFrom, Ka as basePluginContext, Kc as isDmChannel, Lp as resolveRootConversationId, Mc as lookupSlackUserNames, Mi as getVercelConversationWorkQueue, Ml as getInboxItem, Na as slackMention, No as existingConversationId, Oi as conversationPinnedForUser, Om as juniorConversationAnnotations, Pa as slackMentionedUserIds, Pm as juniorAttachments, Pp as agentTurnUsageSchema, Ps as bindEventAutomationCredentialSubject, Q as canUserReadInboxItem, Ql as hasUserPhoto, Qu as isTopLevel, Rd as storedMessageJson, Rl as takeInboxItem, Rs as verifyEventAutomationCredentialSubject, Si as leaveEndsAccess, So as admitEventAutomationRun, Sr as pushInboxSnoozeWakes, Tm as juniorConversationEvents, To as automationVersionOf, U as conversationWaitsOnUserSql, Ui as buildSentryConversationUrl, Ul as INBOX_SUBJECT_KINDS, Um as juniorDestinations, Uo as recordAutomationExecution, Ur as safeLinkUrl, V as conversationStatusSql, Va as createPluginEmbedder, Vt as cancelHumanFacingPendingMessages, Wd as completeDecision, Ws as canPauseConversationDelivery, Xo as AUTOMATION_ALERT_STEP_FIELD_ID, Xs as resolveAnnotationFilter, Y as canActOnInboxItem, Yo as AUTOMATION_ALERT_STEPS, Ys as annotationMatches, Z as canAnswerInboxItem, Zl as subjectTodo, Zr as createPluginTaskStarter, Zu as isThread, _ as readConversationTrees, _c as conversationSubtree, _i as canAddConversationMessages, _t as inboxItemOwnedByThroughSubject, a as getDb, am as juniorQuestions, as as getEventCatalog, au as SNOOZE_TIMER_EVENT_TYPE, b as loadConversationSlackTenantIds, bc as conversationSearchVector, bi as conversationAccessFromRows, bm as juniorConversationParticipants, br as createInboxItemShow, bt as getPlugins, ca as getPluginDispatchProjection, ci as createPluginConversationChanges, cm as juniorAutomationRuns, ct as isAutomationAlertItem, dc as createPluginConversationAnnotations, dd as CORE_EVENT_NAMESPACE, di as dismissPluginInboxItem, dm as juniorAutomations, dp as webActorUserIds, dt as isPluginInboxItem, ec as subjectKey, en as getConversationWorkState, fc as listConversationAnnotations, fi as hasAssigneeRoles, fo as blockEventAutomation, fu as settleInboxSnoozes, ga as notifyAutomationBlocked, gc as conversationAncestorsOrSelf, gm as juniorInboxItems, go as findMatchingEventAutomations, gr as withConversationEventLock, h as conversationAncestors, hi as createPluginCodeChanges, i as getConversationStore, it as inboxItemPlugin, iu as userAvatarUrlsFromJoinedPhotos, jc as lookupSlackUser, ji as viewerMarksFromParticipant, jl as dismissOpenInboxItems, jm as juniorCodeChanges, jp as addAgentTurnUsage, ki as readMemberParticipants, la as isTerminalDispatchStatus, li as createPluginInboxItems, ls as slackChannelMessageReplyThreadTs, lt as isInboxItemForEveryone, md as eventGuidance, mi as takeOverPluginClose, n as getConversationEventStore, na as createOrGetDispatch, nm as juniorTodos, nt as inboxItemForUser, o as getSqlExecutor, oa as getDispatchRecord, p as copyMessageLinks, pc as listConversationAnnotationsById, pi as leavePluginInboxItem, po as collectEventAutomationMatchKeys, pr as legacyWebMailboxMetadataSchema, q as hasUnexpiredAuthorizationRequest, ql as subjectKindActions, qp as spaceLeadIds, qu as feedRowShowsThreads, ra as getDispatchConversationId, rd as turnBehavior, rt as inboxItemNeedsInput, tl as createPluginUsers, tt as inboxItemAddedByAutomation, u as isPostgresErrorCode, ui as legacyChoiceAction, us as slackChannelMessageRunsAutomation, ut as isOnlyAssignee, uu as listFiringInboxSnoozeTriggers, v as setArchivedAt, vc as conversationSubtreeColumns, vi as canInviteToConversation, vu as getDashboardConversationLink, wf as JUNIOR_NATIVE_EVENT_NAMESPACE, wi as readConversationAccessRows, x as lastMessageAtSql, xi as createConversationAccessReader, y as conversationSlackTenantId, z as conversationIsActiveSql, za as createPluginState, zm as juniorIdentities, zs as verifyScheduledAutomationCredentialSubject } from "./db-RDpWIeRK.js";
|
|
3
|
+
import { $ as activityPreviewText, An as automationTaskText, Cn as isEmptyUserInputAnswer, Lt as conversationTreeStateSchema, Qt as readMessageAttachments, St as contextProvenance, Tn as userInputQuestionText, Y as conversationReportStatusSchema, Z as conversationSurfaceSchema, _n as inboxItemQuestion, at as KNOWN_CONVERSATION_EVENT_TYPES, t as OPEN_TODO_STATUSES, wn as normalizeUserInputAnswer, yt as piMessageFromHistoryItem } from "./types-BWAgOJtR.js";
|
|
4
|
+
import { T as withSpan, f as logException, m as logWarn, p as logInfo, y as setSpanAttributes } from "./logging-BQsfrLHl.js";
|
|
5
5
|
import { h as startSpan, n as captureMessage } from "./sentry-CPbZjomA.js";
|
|
6
|
-
import { t as JUNIOR_VERSION } from "./version-
|
|
7
|
-
import { G as mapBounded, h as createPluginLogger } from "./prompt-
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import { a as getChildAgentLabel } from "./result-
|
|
12
|
-
import { C as cancelConversationPendingMessagesBodySchema, D as conversationPendingMessageDeliverySchema, N as healthReportSchema, S as conversationAutoArchiveSchema, b as archiveConversationResponseSchema, c as conversationSubscriptionResponseSchema, g as pinConversationResponseSchema, h as pinConversationBodySchema, l as setConversationSpaceBodySchema, m as renameConversationResponseSchema, o as conversationLeaveResponseSchema, p as renameConversationBodySchema, r as stopConversationTurnResponseSchema, s as conversationSubscriptionBodySchema, u as setConversationSpaceResponseSchema, w as cancelConversationPendingMessagesResponseSchema, x as archiveDoneConversationsResponseSchema, y as archiveConversationBodySchema } from "./conversation-feed-
|
|
13
|
-
import { r as canContinueInSlack } from "./continue-in-slack-
|
|
6
|
+
import { t as JUNIOR_VERSION } from "./version-D9yLYOBu.js";
|
|
7
|
+
import { G as mapBounded, h as createPluginLogger } from "./prompt-5PDkRQ1K.js";
|
|
8
|
+
import { $t as recordWebConversationActivity, C as resolveBotSlackTeamId, Ft as notInheritedByForkChild, J as getWebAuthorization, Jt as acceptsWebMessages, Qt as createConversationId, S as resolveEventAuthor, Yt as appendAndEnqueueWebMessage, Zt as createAndEnqueueConversation, _ as eventAuthorText, an as AttachmentUploadError, cn as verifyAttachmentUploads, en as webActorFromUser, fn as isFileAttachment, mt as renderTaskInput, tr as loadTurnProjection } from "./markers-Bh0vqJ5k.js";
|
|
9
|
+
import { $n as replaceHistorySavings, B as setConversationSpaceForViewer, Bt as conversationRecordJoins, Ct as readLiveAnnotationsById, F as markConversationRead, Fn as ViewerTaskNotFoundError, Ft as resolveSlackTeamDomains, Gn as missingAutomationSkillReason, Gt as readConversationAuthors, Ht as selectConversationRecords, K as getProductionSlackAdapter, Kn as effectiveTaskOutcomes, Kt as readConversationParticipants, L as deliverInboxItemChange, Ln as readConversationSourceTask, Lt as conversationFromRecordRow, Nn as takeViewerAutomationAlertStep, On as createPluginConversationWatches, P as conversationReadPositionQuery, Qn as historyPeriodSavings, Qt as imagePath, Rt as conversationRecordColumns, Sn as throwApiError, St as readLiveAnnotations, T as ingestEvent, U as getSpaceLead, Un as AutomationEditError, Ut as conversationEventHistory, V as readSpaceRefs, Vt as readConversationRecordFromSql, Wn as findAutomationSkill, Wt as conversationSummaryFromStoredConversation, X as clearSlackPendingReactions, Xn as addHistoryWarmupCost, Yn as addHistoryPeriod, Zn as firstLiveSavingsDate, _ as listConversationWork, ar as connectedState, cn as parseContent, cr as MINUTE_MS, d as ANSWER_TOOL_ENDINGS, dr as gapSegment, dt as readConversationEventPageAround, f as CONVERSATION_STATE_TTL_MS, g as isConversationWorkDone, gn as setConversationTitle, gt as stopConversation, h as segmentGapsKey, j as archiveConversation, lt as readConversationEventPage, m as GLOBAL_GAPS_TTL_MS, or as providerCacheTtlMs, p as GLOBAL_GAPS_MAX, qt as readFirstHumanMessageTexts, rt as enqueueAgentDispatch, tn as readConversationLineage, ur as NO_REPLY_GAP_MS, ut as readConversationEventPageAfter, v as readLastUserMessageAtByConversation, vn as leaveConversation, wn as slackAttachmentsVersionQuery, wt as resolveObjectCards, xn as jsonResponse, yn as setConversationSubscription, z as requireSpaceForWork, zt as conversationRecordFromRow } from "./agent-OUkEw6Bv.js";
|
|
10
|
+
import { i as webMessageId } from "./user-customization-DNzu_r1x.js";
|
|
11
|
+
import { a as getChildAgentLabel } from "./result-D_D-2Adp.js";
|
|
12
|
+
import { C as cancelConversationPendingMessagesBodySchema, D as conversationPendingMessageDeliverySchema, N as healthReportSchema, S as conversationAutoArchiveSchema, b as archiveConversationResponseSchema, c as conversationSubscriptionResponseSchema, g as pinConversationResponseSchema, h as pinConversationBodySchema, l as setConversationSpaceBodySchema, m as renameConversationResponseSchema, o as conversationLeaveResponseSchema, p as renameConversationBodySchema, r as stopConversationTurnResponseSchema, s as conversationSubscriptionBodySchema, u as setConversationSpaceResponseSchema, w as cancelConversationPendingMessagesResponseSchema, x as archiveDoneConversationsResponseSchema, y as archiveConversationBodySchema } from "./conversation-feed-BUaMmSLi.js";
|
|
13
|
+
import { r as canContinueInSlack } from "./continue-in-slack-DYl631oM.js";
|
|
14
14
|
import * as z from "zod";
|
|
15
15
|
import { and, asc, count, desc, eq, gt, gte, inArray, isNotNull, isNull, lt, lte, min, ne, not, notInArray, or, sql } from "drizzle-orm";
|
|
16
16
|
import { alias } from "drizzle-orm/pg-core";
|
|
@@ -1484,25 +1484,24 @@ function createEventAppPublisher(args) {
|
|
|
1484
1484
|
}
|
|
1485
1485
|
};
|
|
1486
1486
|
}
|
|
1487
|
-
// src/chat/inbox-items/plugin-
|
|
1487
|
+
// src/chat/inbox-items/plugin-action.ts
|
|
1488
1488
|
/**
|
|
1489
|
-
* Give
|
|
1490
|
-
* so the plugin does the work. The
|
|
1491
|
-
* plugin fails, so the person can retry the same
|
|
1489
|
+
* Give a kind action that a person ran on a plugin item to the plugin that
|
|
1490
|
+
* added it, so the plugin does the work. The action starts no Turn. Throws
|
|
1491
|
+
* when the plugin fails, so the person can retry the same action.
|
|
1492
1492
|
*/
|
|
1493
|
-
async function
|
|
1493
|
+
async function runPluginInboxItemAction(args) {
|
|
1494
1494
|
const { item } = args;
|
|
1495
1495
|
const pluginName = inboxItemPlugin(item);
|
|
1496
|
-
const choice = item.answer?.values[PLUGIN_CHOICE_FIELD_ID]?.[0];
|
|
1497
1496
|
const conversationId = ownerConversationId(item);
|
|
1498
|
-
if (!pluginName || !
|
|
1497
|
+
if (!pluginName || !conversationId) return;
|
|
1499
1498
|
const plugin = getPlugins().find((p) => p.manifest.name === pluginName);
|
|
1500
|
-
const hook = plugin?.hooks?.
|
|
1499
|
+
const hook = plugin?.hooks?.inboxItemAction;
|
|
1501
1500
|
if (!plugin || !hook) return;
|
|
1502
1501
|
const events = createEventAppPublisher({ conversationWork: () => ({ queue: args.delivery.queue }) });
|
|
1503
1502
|
await hook({
|
|
1504
1503
|
...basePluginContext(plugin),
|
|
1505
|
-
|
|
1504
|
+
action: args.action,
|
|
1506
1505
|
codeChanges: createPluginCodeChanges(pluginName),
|
|
1507
1506
|
conversationId,
|
|
1508
1507
|
subject: {
|
|
@@ -1531,7 +1530,7 @@ function describeItem(item) {
|
|
|
1531
1530
|
return [
|
|
1532
1531
|
`Title: ${item.title}`,
|
|
1533
1532
|
`Details: ${item.body}`,
|
|
1534
|
-
...request ? [`Question: ${request
|
|
1533
|
+
...request ? [`Question: ${userInputQuestionText(request)}`] : [],
|
|
1535
1534
|
...fields.length ? ["Fields:", ...fields] : []
|
|
1536
1535
|
].join("\n");
|
|
1537
1536
|
}
|
|
@@ -1623,8 +1622,8 @@ function reviewItemChange(action, user) {
|
|
|
1623
1622
|
* Return whether a closed item is the result of this same action. An item
|
|
1624
1623
|
* that a person's message closed never matches a card or Inbox action.
|
|
1625
1624
|
*/
|
|
1626
|
-
function isSameClose(item, action, user) {
|
|
1627
|
-
return item.closeReason !== "Replied in thread" && item.closedBy?.userId === user.id && item.status === closedStatus(action) && action === "submit" === Boolean(item.answer);
|
|
1625
|
+
function isSameClose(item, action, user, kindAction) {
|
|
1626
|
+
return item.closeReason !== "Replied in thread" && (action === "submit" ? item.answeredBy : item.closedBy)?.userId === user.id && item.status === closedStatus(action) && action === "submit" === Boolean(item.answer) && item.closeAction === kindAction;
|
|
1628
1627
|
}
|
|
1629
1628
|
function submittedAnswer(item, answer) {
|
|
1630
1629
|
const question = inboxItemQuestion(item.request);
|
|
@@ -1658,7 +1657,8 @@ async function actOnInboxItem(args) {
|
|
|
1658
1657
|
});
|
|
1659
1658
|
return closed;
|
|
1660
1659
|
}
|
|
1661
|
-
|
|
1660
|
+
const kindAction = action === "done" ? args.kindAction : void 0;
|
|
1661
|
+
if (action === "done" && !subjectKindActions(item.subject.kind, getPlugins()).some((registered) => registered.id === kindAction)) throw new InboxItemActionError("invalid", "This item has no such action.");
|
|
1662
1662
|
if (action === "take") {
|
|
1663
1663
|
if (item.status !== "open") throw new InboxItemActionError("conflict", "Inbox item is closed.");
|
|
1664
1664
|
if (!canActOnInboxItem(item, user.id)) throw new InboxItemActionError("forbidden", "Only an assignee can take this item.");
|
|
@@ -1695,24 +1695,27 @@ async function actOnInboxItem(args) {
|
|
|
1695
1695
|
}
|
|
1696
1696
|
}
|
|
1697
1697
|
if (!closedNow && item.status === "open") {
|
|
1698
|
-
if (!
|
|
1698
|
+
if (!canAnswerInboxItem(item, user.id)) throw new InboxItemActionError("forbidden", "Only an assignee can act on this item.");
|
|
1699
1699
|
const answer = action === "submit" ? submittedAnswer(item, args.answer) : void 0;
|
|
1700
1700
|
closedNow = await closeInboxItem(db, {
|
|
1701
1701
|
closedByUserId: user.id,
|
|
1702
1702
|
id: item.id,
|
|
1703
1703
|
nowMs,
|
|
1704
1704
|
status: closedStatus(action),
|
|
1705
|
-
...answer ? { answer } : void 0
|
|
1705
|
+
...answer ? { answer } : void 0,
|
|
1706
|
+
...kindAction ? { action: kindAction } : void 0
|
|
1706
1707
|
});
|
|
1707
1708
|
closed = await readInboxItemForUser(user, item.id);
|
|
1708
1709
|
}
|
|
1709
|
-
if (args.firstCloseOnly ? !closedNow : !isSameClose(closed, action, user)) throw new InboxItemActionError("conflict", "Inbox item is closed.");
|
|
1710
|
+
if (args.firstCloseOnly ? !closedNow : !isSameClose(closed, action, user, kindAction)) throw new InboxItemActionError("conflict", "Inbox item is closed.");
|
|
1710
1711
|
await closeHandledReplyNotices(db, {
|
|
1711
1712
|
item: closed,
|
|
1712
1713
|
nowMs,
|
|
1713
1714
|
userId: user.id
|
|
1714
1715
|
});
|
|
1715
|
-
|
|
1716
|
+
const pluginAction = kindAction ?? (action === "submit" && isPluginInboxItem(closed) ? legacyChoiceAction(closed) : void 0);
|
|
1717
|
+
if (pluginAction) await runPluginInboxItemAction({
|
|
1718
|
+
action: pluginAction,
|
|
1716
1719
|
delivery: args.delivery,
|
|
1717
1720
|
item: closed,
|
|
1718
1721
|
nowMs
|
|
@@ -4126,7 +4129,7 @@ const WATCH_LOOKUP_LIMIT = 50;
|
|
|
4126
4129
|
* a Turn waits on the User to sign in.
|
|
4127
4130
|
*/
|
|
4128
4131
|
function needsUserSql(userId) {
|
|
4129
|
-
return sql`(${conversationOwnsInboxItem(juniorConversations.conversationId, and(inboxItemNeedsInput(), inboxItemForUser(userId)))} or ${awaitsAuthorizationFrom(juniorConversations.conversationId, userId)})`;
|
|
4132
|
+
return sql`(${conversationOwnsInboxItem(juniorConversations.conversationId, and(inboxItemNeedsInput(), inboxItemForUser(userId, ["open"])))} or ${awaitsAuthorizationFrom(juniorConversations.conversationId, userId)})`;
|
|
4130
4133
|
}
|
|
4131
4134
|
/**
|
|
4132
4135
|
* Read the tree state of each Conversation for one viewer, over its whole
|
|
@@ -4245,7 +4248,7 @@ async function readConversationDetailFromSql(conversationId, options) {
|
|
|
4245
4248
|
conversationId,
|
|
4246
4249
|
...record.conversation.parentConversationId ? { parentConversationId: record.conversation.parentConversationId } : void 0
|
|
4247
4250
|
}, readAccess),
|
|
4248
|
-
(canExposePayload ? listConversationAnnotations(getDb(), conversationId).then((saved) => readLiveAnnotations(options.viewer, saved)) : Promise.resolve([])).then((live) => live.map((annotation) => {
|
|
4251
|
+
(canExposePayload ? listConversationAnnotations(getDb(), conversationId).then((saved) => readLiveAnnotations(options.viewer, saved, "title", { cacheOnly: true })) : Promise.resolve([])).then((live) => live.map((annotation) => {
|
|
4249
4252
|
const previewImages = objectPreviewImages(annotation);
|
|
4250
4253
|
return previewImages ? {
|
|
4251
4254
|
...annotation,
|
|
@@ -4366,8 +4369,8 @@ async function readConversationDetail(conversationId, options = {}) {
|
|
|
4366
4369
|
* has only its link: the Inbox then shows the item's own title and the
|
|
4367
4370
|
* label of its kind.
|
|
4368
4371
|
*/
|
|
4369
|
-
async function resolveInboxItemSubjects(viewer, items) {
|
|
4370
|
-
const views = await resolveObjectCards(viewer, items.map(({ subject }) => ({ subject })));
|
|
4372
|
+
async function resolveInboxItemSubjects(viewer, items, mode = {}) {
|
|
4373
|
+
const views = await resolveObjectCards(viewer, items.map(({ subject }) => ({ subject })), mode);
|
|
4371
4374
|
return new Map(items.flatMap((item, index) => {
|
|
4372
4375
|
const view = views[index];
|
|
4373
4376
|
return view ? [[subjectKey(item.subject), view]] : [];
|
|
@@ -4609,37 +4612,6 @@ function feedMediaSql(db) {
|
|
|
4609
4612
|
const files = db.select({ files: sql`jsonb_agg(jsonb_build_object('contentType', ${recentFiles.contentType}, 'filename', ${recentFiles.filename}, 'id', ${recentFiles.id}) order by ${recentFiles.createdAt} desc, ${recentFiles.id} desc)` }).from(recentFiles);
|
|
4610
4613
|
return sql`(${files})`;
|
|
4611
4614
|
}
|
|
4612
|
-
// src/api/conversations/feed-answer.ts
|
|
4613
|
-
/**
|
|
4614
|
-
* A feed row column with the viewer's newest answered Inbox item of its
|
|
4615
|
-
* Conversation, or null. It is a scalar subquery on the row read, so the
|
|
4616
|
-
* answer costs no round trip of its own, however many items the viewer
|
|
4617
|
-
* closed since.
|
|
4618
|
-
*/
|
|
4619
|
-
function feedViewerAnswerSql(db, userId) {
|
|
4620
|
-
const answered = db.select({
|
|
4621
|
-
answer: sql`jsonb_build_object('answer', ${inboxItemAnswer}, 'closedAt', ${juniorInboxItems.closedAt}, 'request', ${inboxItemRequest})`.as("answer"),
|
|
4622
|
-
closedAt: juniorInboxItems.closedAt,
|
|
4623
|
-
id: juniorInboxItems.id,
|
|
4624
|
-
ownerId: inboxItemOwnerConversationId().as("owner_id")
|
|
4625
|
-
}).from(juniorInboxItems).leftJoin(juniorQuestions, itemQuestion).where(and(eq(juniorInboxItems.closedByUserId, userId), isNotNull(inboxItemAnswer), isNotNull(inboxItemRequest))).as("viewer_answered");
|
|
4626
|
-
const answers = db.selectDistinctOn([answered.ownerId], {
|
|
4627
|
-
answer: answered.answer,
|
|
4628
|
-
ownerId: answered.ownerId
|
|
4629
|
-
}).from(answered).where(isNotNull(answered.ownerId)).orderBy(answered.ownerId, desc(answered.closedAt), desc(answered.id)).as("viewer_answers");
|
|
4630
|
-
return sql`((select jsonb_object_agg(${answers.ownerId}, ${answers.answer}) from ${answers}) -> ${juniorConversations.conversationId})`;
|
|
4631
|
-
}
|
|
4632
|
-
/**
|
|
4633
|
-
* Keep only what a row says about the answer: when it closed and the
|
|
4634
|
-
* options that the viewer picked. Text answers have no choices.
|
|
4635
|
-
*/
|
|
4636
|
-
function feedViewerAnswer(stored) {
|
|
4637
|
-
if (!stored) return void 0;
|
|
4638
|
-
return {
|
|
4639
|
-
choices: answeredChoices(stored.request, stored.answer),
|
|
4640
|
-
closedAt: new Date(stored.closedAt).toISOString()
|
|
4641
|
-
};
|
|
4642
|
-
}
|
|
4643
4615
|
// src/api/page-cursor.ts
|
|
4644
4616
|
/**
|
|
4645
4617
|
* Encode the position after the last row of a page as an opaque `cursor`
|
|
@@ -4711,9 +4683,8 @@ async function conversationRows(db, { codeRepository, conversationIds, cursor, f
|
|
|
4711
4683
|
awaitingAuthorization: treeAwaitsAuthorization(juniorConversations.conversationId),
|
|
4712
4684
|
latestTurnFailed: conversationTurnFailedSql(juniorConversations),
|
|
4713
4685
|
links: include.includes("links") ? feedLinksSql(db) : sql`null`,
|
|
4714
|
-
media: include.includes("media") ? feedMediaSql(db) : sql`null
|
|
4715
|
-
|
|
4716
|
-
}).from(juniorConversations).leftJoin(juniorDestinations, conversationRecordJoins.location).leftJoin(juniorIdentities, conversationRecordJoins.identity).leftJoin(juniorUsers, conversationRecordJoins.user).where(and(space ? conversationSpaceFilter(space.id, status, space.viewerUserId) : and(listedConversation(), conversationFeedMembershipFilter(status, filter)), conversationIds ? inArray(juniorConversations.conversationId, conversationIds) : void 0, waitingForUserId ? inArray(juniorConversations.conversationId, waitingConversationIdsQuery(db, waitingForUserId)) : void 0, pinnedForUserId ? pinnedForUserId.pinned ? conversationPinnedForUser(pinnedForUserId.userId) : not(conversationPinnedForUser(pinnedForUserId.userId)) : void 0, cursor ? sql`(${juniorConversations.lastActivityAt} < ${cursor.at}::timestamptz or (${juniorConversations.lastActivityAt} = ${cursor.at}::timestamptz and ${juniorConversations.conversationId} > ${cursor.conversationId}))` : void 0, codeRepository ? conversationCodeRepositoryFilter(codeRepository.id, codeRepository.viewerUserId) : void 0, query ? or(sql`strpos(lower(coalesce(${juniorConversations.title}, '')), ${query}) > 0`, and(includePrivateMatches ? void 0 : isPublicConversation(juniorConversations), sql`${conversationSearchVector} @@ websearch_to_tsquery('english', ${query})`), annotationMatch(db, {
|
|
4686
|
+
media: include.includes("media") ? feedMediaSql(db) : sql`null`
|
|
4687
|
+
}).from(juniorConversations).leftJoin(juniorDestinations, conversationRecordJoins.location).leftJoin(juniorIdentities, conversationRecordJoins.identity).leftJoin(juniorUsers, conversationRecordJoins.user).where(and(space ? conversationSpaceFilter(space.id, status, space.viewerUserId) : and(query && filter ? or(listedConversation(), eq(juniorConversations.kind, "lead")) : listedConversation(), conversationFeedMembershipFilter(status, filter)), conversationIds ? inArray(juniorConversations.conversationId, conversationIds) : void 0, waitingForUserId ? inArray(juniorConversations.conversationId, waitingConversationIdsQuery(db, waitingForUserId)) : void 0, pinnedForUserId ? pinnedForUserId.pinned ? conversationPinnedForUser(pinnedForUserId.userId) : not(conversationPinnedForUser(pinnedForUserId.userId)) : void 0, cursor ? sql`(${juniorConversations.lastActivityAt} < ${cursor.at}::timestamptz or (${juniorConversations.lastActivityAt} = ${cursor.at}::timestamptz and ${juniorConversations.conversationId} > ${cursor.conversationId}))` : void 0, codeRepository ? conversationCodeRepositoryFilter(codeRepository.id, codeRepository.viewerUserId) : void 0, query ? or(sql`strpos(lower(coalesce(${juniorConversations.title}, '')), ${query}) > 0`, and(includePrivateMatches ? void 0 : isPublicConversation(juniorConversations), sql`${conversationSearchVector} @@ websearch_to_tsquery('english', ${query})`), annotationMatch(db, {
|
|
4717
4688
|
includePrivate: includePrivateMatches,
|
|
4718
4689
|
query,
|
|
4719
4690
|
subjects: querySubjects
|
|
@@ -4919,7 +4890,7 @@ async function readConversationFeedFromSql(options = {}) {
|
|
|
4919
4890
|
readAutomationTitlesByConversationId(conversations),
|
|
4920
4891
|
readFirstHumanMessageTexts(db, conversations),
|
|
4921
4892
|
readConversationTreeStates(db, conversationIds, options.viewer?.id),
|
|
4922
|
-
readFeedThreadRecords(db, conversations.filter((conversation) => conversation.archivedAtMs === void 0).map(({ conversationId }) => conversationId), options.viewer?.id),
|
|
4893
|
+
readFeedThreadRecords(db, conversations.filter((conversation) => conversation.archivedAtMs === void 0 && feedRowShowsThreads(conversation.kind)).map(({ conversationId }) => conversationId), options.viewer?.id),
|
|
4923
4894
|
readSpaceRefs(db, conversations.flatMap(({ spaceId }) => spaceId ? [spaceId] : []))
|
|
4924
4895
|
]);
|
|
4925
4896
|
const accessByConversation = conversationAccessFromRows(accessRows, options.viewer ? new Set(participantsByRoot.keys()) : /* @__PURE__ */ new Set());
|
|
@@ -4970,7 +4941,6 @@ async function readConversationFeedFromSql(options = {}) {
|
|
|
4970
4941
|
const links = access?.canViewPrivateContent && row.links ? pickFeedLinks(conversation.conversationId, row.links, annotationUrls(visibleAnnotationsByConversation.get(conversation.conversationId))) : [];
|
|
4971
4942
|
const lastMessageAt = row.lastMessageAt?.toISOString();
|
|
4972
4943
|
const treeRead = treeStateByConversation.get(conversation.conversationId);
|
|
4973
|
-
const viewerAnswer = access?.canViewPrivateContent ? feedViewerAnswer(row.viewerAnswer) : void 0;
|
|
4974
4944
|
return {
|
|
4975
4945
|
...summary,
|
|
4976
4946
|
...work,
|
|
@@ -4982,7 +4952,6 @@ async function readConversationFeedFromSql(options = {}) {
|
|
|
4982
4952
|
...threads?.omittedThreadCount ? { omittedThreadCount: threads.omittedThreadCount } : void 0,
|
|
4983
4953
|
...participants && participants.length > 0 ? { participants } : void 0,
|
|
4984
4954
|
...activityPreview ? { activityPreview } : void 0,
|
|
4985
|
-
...viewerAnswer ? { viewerAnswer } : void 0,
|
|
4986
4955
|
...media?.length ? { media } : void 0,
|
|
4987
4956
|
...links.length > 0 ? { links } : void 0,
|
|
4988
4957
|
...sidebarAnnotationsByConversation[conversation.conversationId] ? { sidebarAnnotations: sidebarAnnotationsByConversation[conversation.conversationId] } : void 0,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { _ as withScope, d as setTag, f as setUser, h as startSpan, i as getActiveSpan, l as logger, n as captureMessage, p as spanToJSON, s as getTraceData, t as captureException } from "./sentry-CPbZjomA.js";
|
|
2
|
-
import { _ as getDeploymentTelemetryAttributes } from "./deployment-
|
|
2
|
+
import { _ as getDeploymentTelemetryAttributes } from "./deployment-CeKaP0ZJ.js";
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import { styleText } from "node:util";
|
|
5
5
|
import { ConfigError, configureSync, getConfig, getLogger } from "@logtape/logtape";
|