@sentry/junior 0.315.0 → 0.316.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-context-BlSGE44V.js → adapter-context-Bref7aPI.js} +1 -1
- package/dist/{admin-5jUYY46p.js → admin-QYiDMnsu.js} +1 -1
- package/dist/{agent-runner-C7GNLRB6.js → agent-runner-Cr5Fhjf-.js} +2298 -1866
- package/dist/{agent-update-delivery-BNEYQsAf.js → agent-update-delivery-BY13DPSD.js} +10 -37
- package/dist/api/schema.d.ts +69 -20
- package/dist/api/schema.js +4 -4
- package/dist/api.js +202 -315
- package/dist/{app-D_bAXRDe.d.ts → app-BhvzRD__.d.ts} +18 -14
- package/dist/app.d.ts +1 -1
- package/dist/app.js +34 -34
- package/dist/{chat-core-engine-CxkwRpn9.js → chat-core-engine-3dtlMku3.js} +3 -3
- package/dist/cli/chat.js +17 -17
- 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 +2 -2
- package/dist/cli/upgrade.js +23 -3
- package/dist/{continue-in-slack-BGKjIdFp.js → continue-in-slack-DbQUFe_F.js} +3 -3
- package/dist/{conversation-feed-Sl8lKKmR.js → conversation-feed-B84pMjHo.js} +8 -3
- package/dist/{conversation-turn-BoLK9i6g.js → conversation-turn-DzEpTIaf.js} +16 -109
- package/dist/{create-BOycVH9h.js → create-DUJBXr6E.js} +4 -5
- package/dist/{credential-sync-Mn4OdkEh.js → credential-sync-JH_K9Adg.js} +9 -9
- package/dist/{db-DXTOYRzR.js → db-DhzvUY23.js} +343 -179
- package/dist/{deployment-CG3TchWh.js → deployment-BhvrhQeh.js} +1 -1
- package/dist/{engine-context-dyWlfNdD.js → engine-context-C9Nal48K.js} +9 -12
- package/dist/{html-CfXEwl_h.js → html-B_12WjKT.js} +2 -2
- package/dist/instrumentation.js +2 -2
- package/dist/{job-runner-CySgpi9v.js → job-runner-DO8nslyY.js} +17 -9
- package/dist/{lineage-tRTOcrsL.js → lineage-D3AZAJVe.js} +1 -1
- package/dist/{list-DXBz8SYL.js → list-B0zsb5Cp.js} +64 -182
- package/dist/{parent-result-Dg6P6roR.js → list-mkB_GU8R.js} +80 -108
- package/dist/{logging-czs0nqLC.js → logging-B8KEJegM.js} +1 -1
- package/dist/{media-Cr9pGkzr.js → media-BebquhET.js} +15 -3
- package/dist/{message-BTox2Cmb.js → message-B5fKDYzz.js} +8 -8
- package/dist/{model-input-IRGa98V7.js → model-input-CuMWy37l.js} +3 -3
- package/dist/nitro.d.ts +1 -1
- package/dist/nitro.js +2 -2
- package/dist/{oauth-callback-server-NXK7AlBp.js → oauth-callback-server-B3Vvlydo.js} +2 -2
- package/dist/{oauth-relay-6NBPSpFE.js → oauth-relay-6ERrGPbA.js} +1 -1
- package/dist/{people-Cegp1Iwq.js → people-CUtFApfL.js} +2 -2
- package/dist/{proxy-path-Dc-0jXGi.js → proxy-path-BTmXDjfx.js} +1 -1
- package/dist/{resolve-BUFkmxkT.js → resolve-D5JVvv6A.js} +3 -3
- package/dist/{result-DfATzX77.js → result-CS_7mo8a.js} +30 -14
- package/dist/{runner-CmKP3inb.js → runner-BzAES5W3.js} +7 -7
- package/dist/{sandbox-egress-signals-DYo5BsM7.js → sandbox-egress-signals-Dwhk2Q5F.js} +1 -1
- package/dist/{schema-DrBMdPmv.js → schema-z5-wA6N4.js} +34 -13
- package/dist/{service-account-CxTX7nnR.js → service-account-D6AsAtc1.js} +1 -1
- package/dist/{mailbox-turn-79Nv1JXv.js → session-stop-DponjDUZ.js} +3075 -3092
- package/dist/{skills-BlHUDj7k.js → skills-DgJ9GBPR.js} +3 -3
- package/dist/{slack-conversation-unfurl-Dhe3lB1U.js → slack-conversation-unfurl-Dq71EkhM.js} +6 -6
- package/dist/{spawn-CfvlFdfz.js → spawn-BJWpdwhQ.js} +4 -4
- package/dist/{start-conversation-Uh8Sk1EF.js → start-conversation-B-LIqqNi.js} +2 -2
- package/dist/{system-prompt-table-CDCYVwqN.js → system-prompt-table-iIgpmslr.js} +6 -4
- package/dist/{task-runner-DcdQJd9e.js → task-runner-BJae4JwE.js} +23 -11
- package/dist/{thread-context-DF5uDcWN.js → thread-context-fiMNylbg.js} +5 -5
- package/dist/{transcript-BHhJVY0P.js → transcript-CCi7323k.js} +1 -1
- package/dist/{turn-session-routing-GtetHsdO.js → turn-session-routing-D15orfwy.js} +7 -7
- package/dist/{turn-wake-um5Ubd4m.js → turn-wake-BjDW7x-5.js} +4 -4
- package/dist/{validation-CJyuOPD2.js → validation-D5WmmmhX.js} +1 -1
- package/dist/{version-Bhe7RPIe.js → version-CBQoanXb.js} +1 -1
- package/dist/version.js +1 -1
- package/dist/{worker-D8PRgUqr.js → worker-Cyb4kF17.js} +3 -3
- 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/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
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-BKpuH2hG.js";
|
|
2
2
|
import { _ as readQueueConfig, g as resolveConversationWorkQueueTopic, m as PLUGIN_TASK_QUEUE_TOPIC, n as normalizePluginPackageNames, o as pluginRoots, t as discoverInstalledPluginPackageContent, v as resolveBotName, y as toOptionalTrimmed } from "./package-discovery-BI6T_RkD.js";
|
|
3
|
-
import { C as toPromptContributionContext, G as mapBounded, I as createPluginLogger, M as SANDBOX_WORKSPACE_ROOT, O as SANDBOX_JUNIOR_ROOT, R as unwrapCurrentInstruction, t as RUNTIME_CONTEXT_TEXT_STARTS, w as runPluginHooksAtOnce } from "./transcript-
|
|
4
|
-
import { E as withSpan, N as normalizeIdentityEmail, _ as runBestEffort, a as extractGenAiUsageSummary, b as setSpanAttributes, c as getLogContextAttributes, d as logAudit, h as logWarn, i as extractGenAiUsageAttributes, j as GOOGLE_IDENTITY_PROVIDER, m as logInfo, p as logException, v as serializeGenAiAttribute, x as setSpanStatus, y as setSentryUser } from "./logging-
|
|
5
|
-
import { c as toCanonicalOutputMessage, i as getCurrentConversationPrivacy, l as toGenAiMessagesTraceAttributes, n as redactSandboxEgressProxyPath, r as canExposeConversationPayload, s as toCanonicalInputMessage, t as SANDBOX_EGRESS_PROXY_PATH } from "./proxy-path-
|
|
6
|
-
import { In as gatewayOnlyProviders, Mn as automationTaskColumns, N as automationVersionSchema, Nn as automationTaskDescription, On as AGENT_UPDATE_EVENT_TYPE, Pn as automationTaskSchema, Qt as scheduledAutomationSchema, _n as inboxItemRequestSchema, a as DEFAULT_NOTIFICATION_SCHEDULE, c as CONTENT_VERSION_HEADER, cn as isValidTimeZone, gn as eventAutomationTriggerSchema, gt as encodeHistoryPayload, hn as eventAutomationSchema, ht as newConversationEventSchema, jn as automationSkillNameSchema, ln as usageSchema, mt as historyReplacementSchema, o as isWithinNotificationSchedule, pn as UPDATE_TODOS_TOOL_NAME, pt as decodeStoredConversationEvent, r as detectImageMediaType, s as notificationScheduleSchema, ut as conversationEventDataSchema, vn as USER_INPUT_LIMITS } from "./media-
|
|
3
|
+
import { C as toPromptContributionContext, G as mapBounded, I as createPluginLogger, M as SANDBOX_WORKSPACE_ROOT, O as SANDBOX_JUNIOR_ROOT, R as unwrapCurrentInstruction, t as RUNTIME_CONTEXT_TEXT_STARTS, w as runPluginHooksAtOnce } from "./transcript-CCi7323k.js";
|
|
4
|
+
import { E as withSpan, N as normalizeIdentityEmail, _ as runBestEffort, a as extractGenAiUsageSummary, b as setSpanAttributes, c as getLogContextAttributes, d as logAudit, h as logWarn, i as extractGenAiUsageAttributes, j as GOOGLE_IDENTITY_PROVIDER, m as logInfo, p as logException, v as serializeGenAiAttribute, x as setSpanStatus, y as setSentryUser } from "./logging-B8KEJegM.js";
|
|
5
|
+
import { c as toCanonicalOutputMessage, i as getCurrentConversationPrivacy, l as toGenAiMessagesTraceAttributes, n as redactSandboxEgressProxyPath, r as canExposeConversationPayload, s as toCanonicalInputMessage, t as SANDBOX_EGRESS_PROXY_PATH } from "./proxy-path-BTmXDjfx.js";
|
|
6
|
+
import { In as gatewayOnlyProviders, Mn as automationTaskColumns, N as automationVersionSchema, Nn as automationTaskDescription, On as AGENT_UPDATE_EVENT_TYPE, Pn as automationTaskSchema, Qt as scheduledAutomationSchema, _n as inboxItemRequestSchema, a as DEFAULT_NOTIFICATION_SCHEDULE, c as CONTENT_VERSION_HEADER, cn as isValidTimeZone, gn as eventAutomationTriggerSchema, gt as encodeHistoryPayload, hn as eventAutomationSchema, ht as newConversationEventSchema, jn as automationSkillNameSchema, ln as usageSchema, mt as historyReplacementSchema, o as isWithinNotificationSchedule, pn as UPDATE_TODOS_TOOL_NAME, pt as decodeStoredConversationEvent, r as detectImageMediaType, s as notificationScheduleSchema, ut as conversationEventDataSchema, vn as USER_INPUT_LIMITS } from "./media-BebquhET.js";
|
|
7
7
|
import { _ as withScope, n as captureMessage, r as continueTrace } from "./sentry-CPbZjomA.js";
|
|
8
8
|
import { AwsClient } from "aws4fetch";
|
|
9
9
|
import { del, get, issueSignedToken, presignUrl, put } from "@vercel/blob";
|
|
@@ -935,6 +935,13 @@ function claudeResizedImageSize(width, height, limits) {
|
|
|
935
935
|
return [low, shortEdge(low)];
|
|
936
936
|
}
|
|
937
937
|
/**
|
|
938
|
+
* The largest size that any Claude model reads an image at. Claude scales a
|
|
939
|
+
* larger image down to this size, so an image at this size loses no detail.
|
|
940
|
+
*/
|
|
941
|
+
function claudeMaxImageSize(width, height) {
|
|
942
|
+
return claudeResizedImageSize(width, height, CLAUDE_HIGH_RES_IMAGE);
|
|
943
|
+
}
|
|
944
|
+
/**
|
|
938
945
|
* Estimate one image for a model with the rule that `estimateMessagesTokens`
|
|
939
946
|
* uses. `sized` is false when the image used the flat per-image value.
|
|
940
947
|
*/
|
|
@@ -2041,10 +2048,9 @@ function parseOptionalPositiveInteger(envName, rawValue) {
|
|
|
2041
2048
|
if (!Number.isSafeInteger(value) || value <= 0 || String(value) !== trimmed) throw new Error(`${envName} must be a positive integer`);
|
|
2042
2049
|
return value;
|
|
2043
2050
|
}
|
|
2044
|
-
function parseKillSwitch(name, rawValue
|
|
2051
|
+
function parseKillSwitch(name, rawValue) {
|
|
2045
2052
|
const value = toOptionalTrimmed(rawValue)?.toLowerCase();
|
|
2046
|
-
if (value === void 0) return
|
|
2047
|
-
if (value === "true") return true;
|
|
2053
|
+
if (value === void 0 || value === "true") return true;
|
|
2048
2054
|
if (value === "false") return false;
|
|
2049
2055
|
throw new Error(`${name} must be true or false`);
|
|
2050
2056
|
}
|
|
@@ -2154,7 +2160,6 @@ function readChatConfig(env = process.env, functionMaxDurationSeconds = DEFAULT_
|
|
|
2154
2160
|
idleCompactionEnabled: parseKillSwitch("JUNIOR_IDLE_COMPACTION_ENABLED", env["JUNIOR_IDLE_COMPACTION_ENABLED"]),
|
|
2155
2161
|
conversationWorkEnabled: parseKillSwitch("JUNIOR_CONVERSATION_WORK_ENABLED", env["JUNIOR_CONVERSATION_WORK_ENABLED"]),
|
|
2156
2162
|
conversationWorkSoftYieldAfterMs: resolveConversationWorkSoftYieldAfterMs(resolvedFunctionMaxDurationSeconds),
|
|
2157
|
-
versionsStreamEnabled: parseKillSwitch("JUNIOR_VERSIONS_STREAM_ENABLED", env["JUNIOR_VERSIONS_STREAM_ENABLED"]),
|
|
2158
2163
|
encryption: readEncryptionKeyring(env),
|
|
2159
2164
|
sql: {
|
|
2160
2165
|
databaseUrl,
|
|
@@ -4250,13 +4255,12 @@ async function publishAgentUpdate(conversationId, key, options) {
|
|
|
4250
4255
|
const eventKey = updateEventKey(conversationId, key);
|
|
4251
4256
|
let update;
|
|
4252
4257
|
const readUpdate = () => update ??= options.update();
|
|
4253
|
-
const delivery = () => import("./agent-update-delivery-
|
|
4258
|
+
const delivery = () => import("./agent-update-delivery-BY13DPSD.js");
|
|
4254
4259
|
if (options.starter !== false) {
|
|
4255
4260
|
const { deliverToStarter } = await delivery();
|
|
4256
4261
|
await deliverToStarter({
|
|
4257
4262
|
actor: options.starter,
|
|
4258
4263
|
conversationId,
|
|
4259
|
-
eventKey,
|
|
4260
4264
|
key,
|
|
4261
4265
|
nowMs,
|
|
4262
4266
|
queue: options.queue,
|
|
@@ -5026,6 +5030,7 @@ const juniorConversations = pgTable("junior_conversations", {
|
|
|
5026
5030
|
quickQuestionAt: timestamptz("quick_question_at"),
|
|
5027
5031
|
rootConversationId: text$1("root_conversation_id").references(() => juniorConversations.conversationId),
|
|
5028
5032
|
spaceId: text$1("space_id").references(() => juniorSpaces.id),
|
|
5033
|
+
visibility: text$1("visibility").$type(),
|
|
5029
5034
|
transcriptPurgedAt: timestamptz("transcript_purged_at"),
|
|
5030
5035
|
/**
|
|
5031
5036
|
* Set while the Conversation is stopped. Its Watch Events are then saved
|
|
@@ -5045,9 +5050,10 @@ const juniorConversations = pgTable("junior_conversations", {
|
|
|
5045
5050
|
metricRunId: text$1("metric_run_id"),
|
|
5046
5051
|
detailVersion: integer$1("detail_version").notNull().default(0)
|
|
5047
5052
|
}, (table) => [
|
|
5048
|
-
check("junior_conversations_kind_check", sql`${table.kind} in ('root', '
|
|
5049
|
-
check("junior_conversations_kind_parent_check", sql`${table.kind} is null or
|
|
5053
|
+
check("junior_conversations_kind_check", sql`${table.kind} in ('root', 'thread', 'automation', 'lead', 'task')`),
|
|
5054
|
+
check("junior_conversations_kind_parent_check", sql`${table.kind} is null or ${table.kind} in ('root', 'thread') or ((${table.kind} in ('automation', 'lead')) = (${table.parentConversationId} is null))`),
|
|
5050
5055
|
check("junior_conversations_space_root_check", sql`${table.spaceId} is null or ${table.parentConversationId} is null`),
|
|
5056
|
+
check("junior_conversations_visibility_check", sql`${table.visibility} is null or ${table.visibility} in ('public', 'private')`),
|
|
5051
5057
|
index("junior_conversations_last_activity_idx").on(table.lastActivityAt.desc(), table.conversationId),
|
|
5052
5058
|
index("junior_conversations_active_idx").using("btree", sql`coalesce(${table.executionUpdatedAt}, ${table.updatedAt})`, table.conversationId).where(sql`${table.executionStatus} <> 'idle'`),
|
|
5053
5059
|
index("junior_conversations_destination_activity_idx").on(table.destinationId, table.lastActivityAt.desc()),
|
|
@@ -5274,6 +5280,7 @@ const juniorConversationEvents = pgTable("junior_conversation_events", {
|
|
|
5274
5280
|
index("junior_conversation_events_actor_identity_idx").on(table.actorIdentityId, table.conversationId, table.seq),
|
|
5275
5281
|
index("junior_conversation_events_author_idx").on(table.conversationId, table.actorIdentityId, table.seq).where(sql`${table.actorIdentityId} is not null`),
|
|
5276
5282
|
index("junior_conversation_events_message_role_idx").on(table.conversationId, sql`(${table.payload}->>'role')`, table.createdAt, table.seq).where(sql`${table.type} = 'message'`),
|
|
5283
|
+
index("junior_conversation_events_message_role_seq_idx").on(table.conversationId, sql`(${table.payload}->>'role')`, table.seq).where(sql`${table.type} = 'message'`),
|
|
5277
5284
|
index("junior_conversation_events_user_message_time_idx").on(table.conversationId, table.createdAt, table.seq).where(sql`${table.type} = 'user_message' and ${isUserInstruction(table.payload)}`),
|
|
5278
5285
|
index("junior_conversation_events_message_search_idx").using("gin", sql`to_tsvector('english', ${table.payload}->>'text')`).where(sql`${table.type} = 'message'`),
|
|
5279
5286
|
uniqueIndex("junior_conversation_events_idempotency_idx").on(table.conversationId, table.idempotencyKey)
|
|
@@ -6017,6 +6024,119 @@ const juniorTurnOutbox = pgTable("junior_turn_outbox", {
|
|
|
6017
6024
|
uniqueIndex("junior_turn_outbox_event_idx").on(table.conversationId, table.eventSeq),
|
|
6018
6025
|
index("junior_turn_outbox_pending_idx").on(table.createdAt).where(sql`${table.state} = 'pending'`)
|
|
6019
6026
|
]);
|
|
6027
|
+
// src/chat/conversations/sql/detail-version.ts
|
|
6028
|
+
/** SQL that advances `detail_version` inside a `juniorConversations` set. */
|
|
6029
|
+
const nextDetailVersion = sql`${juniorConversations.detailVersion} + 1`;
|
|
6030
|
+
function bumpDetailVersion(db, conversationIds) {
|
|
6031
|
+
return db.update(juniorConversations).set({ detailVersion: nextDetailVersion }).where(inArray(juniorConversations.conversationId, [...conversationIds]));
|
|
6032
|
+
}
|
|
6033
|
+
/**
|
|
6034
|
+
* Return a CTE that marks the detail report of each Conversation as changed,
|
|
6035
|
+
* in the same statement as the write that it covers:
|
|
6036
|
+
* `db.with(conversationDetailTouch(db, ids)).insert(table)`.
|
|
6037
|
+
* Postgres runs a data-modifying CTE even when the statement does not read it,
|
|
6038
|
+
* and both changes commit together.
|
|
6039
|
+
*/
|
|
6040
|
+
function conversationDetailTouch(db, conversationIds) {
|
|
6041
|
+
return db.$with("conversation_detail_touch").as(bumpDetailVersion(db, conversationIds).returning({ conversationId: juniorConversations.conversationId }));
|
|
6042
|
+
}
|
|
6043
|
+
/**
|
|
6044
|
+
* Mark the detail report of each Conversation as changed, for a write that
|
|
6045
|
+
* cannot carry `conversationDetailTouch`. Call it after that write, in the same
|
|
6046
|
+
* transaction when there is one. A bump before the write lets a detail read
|
|
6047
|
+
* store old content under the new version.
|
|
6048
|
+
*/
|
|
6049
|
+
async function touchConversationDetail(db, conversationIds) {
|
|
6050
|
+
if (conversationIds.length === 0) return;
|
|
6051
|
+
await bumpDetailVersion(db, conversationIds);
|
|
6052
|
+
}
|
|
6053
|
+
// src/chat/conversations/sql/privacy.ts
|
|
6054
|
+
const privacyRoot = alias(juniorConversations, "privacy_root");
|
|
6055
|
+
/** Accept only a structurally valid persisted root as privacy authority. */
|
|
6056
|
+
async function readRoot(executor, conversationId) {
|
|
6057
|
+
const row = (await executor.db().select({
|
|
6058
|
+
requestedConversationId: juniorConversations.conversationId,
|
|
6059
|
+
requestedParentConversationId: juniorConversations.parentConversationId,
|
|
6060
|
+
requestedRootConversationId: juniorConversations.rootConversationId,
|
|
6061
|
+
rootConversationId: privacyRoot.conversationId,
|
|
6062
|
+
rootDestinationId: privacyRoot.destinationId,
|
|
6063
|
+
rootParentConversationId: privacyRoot.parentConversationId,
|
|
6064
|
+
rootRootConversationId: privacyRoot.rootConversationId
|
|
6065
|
+
}).from(juniorConversations).leftJoin(privacyRoot, eq(privacyRoot.conversationId, juniorConversations.rootConversationId)).where(eq(juniorConversations.conversationId, conversationId)))[0];
|
|
6066
|
+
return row !== void 0 && row.requestedRootConversationId !== null && (row.requestedParentConversationId !== null || row.requestedRootConversationId === row.requestedConversationId) && row.rootConversationId === row.requestedRootConversationId && row.rootRootConversationId === row.rootConversationId && row.rootParentConversationId === null ? {
|
|
6067
|
+
destinationId: row.rootDestinationId,
|
|
6068
|
+
rootConversationId: row.rootConversationId
|
|
6069
|
+
} : void 0;
|
|
6070
|
+
}
|
|
6071
|
+
/**
|
|
6072
|
+
* Resolve a conversation's privacy authority from its persisted root.
|
|
6073
|
+
*
|
|
6074
|
+
* Missing or structurally invalid root metadata fails closed. The share
|
|
6075
|
+
* lock from `lockRootDestination` gives callers that keep the transaction
|
|
6076
|
+
* open a stable decision. Locking the root row instead would deadlock two child writes that
|
|
6077
|
+
* both update the root later in their transactions.
|
|
6078
|
+
*/
|
|
6079
|
+
async function resolveRootVisibility(executor, conversationId) {
|
|
6080
|
+
const root = await readRoot(executor, conversationId);
|
|
6081
|
+
if (!root) return {
|
|
6082
|
+
rootConversationId: conversationId,
|
|
6083
|
+
visibility: null
|
|
6084
|
+
};
|
|
6085
|
+
await lockRootDestination(executor, root.destinationId, "share");
|
|
6086
|
+
const [locked] = await executor.db().select({ visibility: juniorConversations.visibility }).from(juniorConversations).where(eq(juniorConversations.conversationId, root.rootConversationId));
|
|
6087
|
+
return {
|
|
6088
|
+
rootConversationId: root.rootConversationId,
|
|
6089
|
+
visibility: locked?.visibility ?? null
|
|
6090
|
+
};
|
|
6091
|
+
}
|
|
6092
|
+
/**
|
|
6093
|
+
* True when the Conversation row of `table` is public. Every row of a tree
|
|
6094
|
+
* stores its root's visibility, so a query checks the row it reads. Missing
|
|
6095
|
+
* visibility is private. Use this instead of comparing the column.
|
|
6096
|
+
*/
|
|
6097
|
+
function isPublicConversation(table) {
|
|
6098
|
+
return eq(table.visibility, "public");
|
|
6099
|
+
}
|
|
6100
|
+
/**
|
|
6101
|
+
* Make a root Conversation and its whole tree public or private
|
|
6102
|
+
* (`policies/conversation-access.md`). Every row of the tree stores the
|
|
6103
|
+
* value, and one statement changes them all. A Slack channel that changes
|
|
6104
|
+
* does not call this. Returns false when no root has the id.
|
|
6105
|
+
*/
|
|
6106
|
+
async function setConversationVisibility(executor, rootConversationId, visibility) {
|
|
6107
|
+
const db = executor.db();
|
|
6108
|
+
const [root] = await db.select({ destinationId: juniorConversations.destinationId }).from(juniorConversations).where(and(eq(juniorConversations.conversationId, rootConversationId), isNull(juniorConversations.parentConversationId)));
|
|
6109
|
+
if (!root) return false;
|
|
6110
|
+
await lockRootDestination(executor, root.destinationId, "update");
|
|
6111
|
+
await db.update(juniorConversations).set({
|
|
6112
|
+
visibility,
|
|
6113
|
+
detailVersion: nextDetailVersion
|
|
6114
|
+
}).where(eq(juniorConversations.rootConversationId, rootConversationId));
|
|
6115
|
+
return true;
|
|
6116
|
+
}
|
|
6117
|
+
/**
|
|
6118
|
+
* Give the rows of a tree that have no visibility yet the root's value,
|
|
6119
|
+
* once the root first gets one. Rows that have a value keep it.
|
|
6120
|
+
*/
|
|
6121
|
+
async function fillMissingTreeVisibility(executor, rootConversationId, visibility) {
|
|
6122
|
+
const db = executor.db();
|
|
6123
|
+
const [root] = await db.select({ destinationId: juniorConversations.destinationId }).from(juniorConversations).where(eq(juniorConversations.conversationId, rootConversationId));
|
|
6124
|
+
await lockRootDestination(executor, root?.destinationId ?? null, "update");
|
|
6125
|
+
await db.update(juniorConversations).set({
|
|
6126
|
+
visibility,
|
|
6127
|
+
detailVersion: nextDetailVersion
|
|
6128
|
+
}).where(and(eq(juniorConversations.rootConversationId, rootConversationId), isNull(juniorConversations.visibility)));
|
|
6129
|
+
}
|
|
6130
|
+
/**
|
|
6131
|
+
* Lock the root's Destination row. A new child copies its root's
|
|
6132
|
+
* visibility under the share lock, and every write to a tree's visibility
|
|
6133
|
+
* takes the update lock, so no child copies a value that a concurrent
|
|
6134
|
+
* write replaces. A root with no Destination has no row to lock.
|
|
6135
|
+
*/
|
|
6136
|
+
async function lockRootDestination(executor, destinationId, strength) {
|
|
6137
|
+
if (!destinationId) return;
|
|
6138
|
+
await executor.db().select({ id: juniorDestinations.id }).from(juniorDestinations).where(eq(juniorDestinations.id, destinationId)).for(strength);
|
|
6139
|
+
}
|
|
6020
6140
|
// src/api/conversations/membership.ts
|
|
6021
6141
|
/**
|
|
6022
6142
|
* Select the person's participant row on the outer `juniorConversations`
|
|
@@ -6050,12 +6170,11 @@ function rootSpaceReadableBy(member) {
|
|
|
6050
6170
|
}
|
|
6051
6171
|
/**
|
|
6052
6172
|
* True when the viewer may find the outer root conversation by a link to
|
|
6053
|
-
* it:
|
|
6054
|
-
*
|
|
6055
|
-
* Space's members, and to all of them.
|
|
6173
|
+
* it: the root is public, or the viewer is a Participant. A root in a
|
|
6174
|
+
* private Space is visible only to the Space's members, and to all of them.
|
|
6056
6175
|
*/
|
|
6057
6176
|
function rootVisibleToViewer(viewerUserId) {
|
|
6058
|
-
return or(and(or(isNull(juniorConversations.spaceId), notInArray(juniorConversations.spaceId, privateSpaceIds())), or(
|
|
6177
|
+
return or(and(or(isNull(juniorConversations.spaceId), notInArray(juniorConversations.spaceId, privateSpaceIds())), or(isPublicConversation(juniorConversations), viewerUserId ? conversationHasParticipantUser(viewerUserId) : void 0)), viewerUserId ? inArray(juniorConversations.spaceId, memberPrivateSpaceIds({ userId: viewerUserId })) : void 0);
|
|
6059
6178
|
}
|
|
6060
6179
|
/**
|
|
6061
6180
|
* True when the person is a Participant of the conversation. Feeds filter
|
|
@@ -6134,9 +6253,9 @@ async function readPrivateSpaceMemberships(db, rows, viewerUserId) {
|
|
|
6134
6253
|
return new Set(members.map((member) => member.spaceId));
|
|
6135
6254
|
}
|
|
6136
6255
|
/**
|
|
6137
|
-
* Read the stored tree and root Destination of each
|
|
6138
|
-
* that reads the viewer's participant rows itself
|
|
6139
|
-
* `conversationAccessFromRows`.
|
|
6256
|
+
* Read the stored tree, visibility, and root Destination of each
|
|
6257
|
+
* conversation. A caller that reads the viewer's participant rows itself
|
|
6258
|
+
* passes these rows to `conversationAccessFromRows`.
|
|
6140
6259
|
*/
|
|
6141
6260
|
async function readConversationAccessRows(db, conversationIds) {
|
|
6142
6261
|
if (conversationIds.length === 0) return [];
|
|
@@ -6148,7 +6267,7 @@ async function readConversationAccessRows(db, conversationIds) {
|
|
|
6148
6267
|
rootParentConversationId: rootConversation.parentConversationId,
|
|
6149
6268
|
rootRootConversationId: rootConversation.rootConversationId,
|
|
6150
6269
|
destinationId: rootDestination.id,
|
|
6151
|
-
visibility:
|
|
6270
|
+
visibility: juniorConversations.visibility,
|
|
6152
6271
|
provider: rootDestination.provider,
|
|
6153
6272
|
providerTenantId: rootDestination.providerTenantId,
|
|
6154
6273
|
spaceId: rootSpace.id,
|
|
@@ -6195,6 +6314,31 @@ function canAddConversationMessages(access) {
|
|
|
6195
6314
|
return Boolean(access?.isParticipant || access?.visibility === "public");
|
|
6196
6315
|
}
|
|
6197
6316
|
/**
|
|
6317
|
+
* Whether the viewer may add a person to a Conversation's Participants. In a
|
|
6318
|
+
* public one, anyone who can post may Invite; it grants no access. In a
|
|
6319
|
+
* private one, only a Participant may, and it shares the Conversation. A
|
|
6320
|
+
* private Space owns its audience, and a Slack-backed private Conversation
|
|
6321
|
+
* follows its Slack channel, so neither takes Invites.
|
|
6322
|
+
*/
|
|
6323
|
+
function canInviteToConversation(access) {
|
|
6324
|
+
if (!access?.rootConversationId || access.privateSpaceId) return false;
|
|
6325
|
+
if (access.visibility === "public") return true;
|
|
6326
|
+
return access.isParticipant && !isSlackBacked(access);
|
|
6327
|
+
}
|
|
6328
|
+
/**
|
|
6329
|
+
* Whether Leave ends the viewer's access: it removes their own Participant
|
|
6330
|
+
* row. Only a private Conversation with an explicit Participant list has
|
|
6331
|
+
* one. Elsewhere Leave only takes it out of their feed, because the
|
|
6332
|
+
* Conversation is public, or a private Space or Slack channel decides who
|
|
6333
|
+
* reads it.
|
|
6334
|
+
*/
|
|
6335
|
+
function leaveEndsAccess(access) {
|
|
6336
|
+
return Boolean(access?.rootConversationId && access.visibility !== "public" && !access.privateSpaceId && access.isParticipant && !isSlackBacked(access));
|
|
6337
|
+
}
|
|
6338
|
+
function isSlackBacked(access) {
|
|
6339
|
+
return access.tenant?.provider === "slack";
|
|
6340
|
+
}
|
|
6341
|
+
/**
|
|
6198
6342
|
* The Slack workspace of a Conversation that the viewer can read. A mention
|
|
6199
6343
|
* in it must name a Slack user of that workspace.
|
|
6200
6344
|
*/
|
|
@@ -7044,7 +7188,6 @@ function inboxItemOwnedByConversation(conversationId) {
|
|
|
7044
7188
|
}
|
|
7045
7189
|
const todoOwner = alias(juniorConversations, "todo_owner");
|
|
7046
7190
|
const todoRoot = alias(juniorConversations, "todo_root");
|
|
7047
|
-
const todoDestination = alias(juniorDestinations, "todo_destination");
|
|
7048
7191
|
/** SQL: the User is a Participant of this root Conversation. */
|
|
7049
7192
|
function participantOf(userId, rootConversationId) {
|
|
7050
7193
|
return exists(getDb().select({ one: sql`1` }).from(juniorConversationParticipants).where(and(eq(juniorConversationParticipants.rootConversationId, rootConversationId), eq(juniorConversationParticipants.userId, userId))));
|
|
@@ -7057,7 +7200,7 @@ function participantOf(userId, rootConversationId) {
|
|
|
7057
7200
|
* or whose Participants include the User.
|
|
7058
7201
|
*/
|
|
7059
7202
|
function ownerConversationOpenTo(userId) {
|
|
7060
|
-
return exists(getDb().select({ one: sql`1` }).from(todoOwner).leftJoin(todoRoot, and(eq(todoRoot.conversationId, todoOwner.rootConversationId), eq(todoRoot.rootConversationId, todoRoot.conversationId), isNull(todoRoot.parentConversationId), or(isNotNull(todoOwner.parentConversationId), eq(todoOwner.rootConversationId, todoOwner.conversationId)))).
|
|
7203
|
+
return exists(getDb().select({ one: sql`1` }).from(todoOwner).leftJoin(todoRoot, and(eq(todoRoot.conversationId, todoOwner.rootConversationId), eq(todoRoot.rootConversationId, todoRoot.conversationId), isNull(todoRoot.parentConversationId), or(isNotNull(todoOwner.parentConversationId), eq(todoOwner.rootConversationId, todoOwner.conversationId)))).where(and(eq(todoOwner.conversationId, juniorInboxItems.ownerId), or(and(isNull(todoOwner.parentConversationId), participantOf(userId, todoOwner.conversationId)), and(isNotNull(todoRoot.conversationId), or(eq(todoRoot.visibility, "public"), participantOf(userId, todoRoot.conversationId)))))));
|
|
7061
7204
|
}
|
|
7062
7205
|
/**
|
|
7063
7206
|
* SQL: the Inbox item has this assigned User. A To-do's item counts only
|
|
@@ -7163,13 +7306,16 @@ async function inboxItemReaderForUserInConversation(user, conversationId) {
|
|
|
7163
7306
|
* the Inbox, not let an agent read it into another Conversation.
|
|
7164
7307
|
*/
|
|
7165
7308
|
async function readInboxItemAgentScope(context) {
|
|
7166
|
-
const
|
|
7309
|
+
const resolved = await context.resolveActorIdentity?.();
|
|
7310
|
+
const actor = context.actorIsApp ? void 0 : resolved;
|
|
7311
|
+
const appUserId = context.actorIsApp ? resolved?.user?.id : void 0;
|
|
7167
7312
|
const user = actor?.user;
|
|
7168
7313
|
const automationId = context.source.kind === "scheduled_automation" || context.source.kind === "event_automation" ? context.source.automationId : void 0;
|
|
7169
7314
|
const current = (await readConversationAccessFromSql(getDb(), [context.conversationId], user)).get(context.conversationId);
|
|
7170
7315
|
const tenant = current?.tenant;
|
|
7171
7316
|
return {
|
|
7172
7317
|
actorIsPerson: actor !== void 0,
|
|
7318
|
+
...appUserId ? { appUserId } : void 0,
|
|
7173
7319
|
inPrivateConversation: current?.visibility !== "public",
|
|
7174
7320
|
reader: {
|
|
7175
7321
|
conversationId: context.conversationId,
|
|
@@ -7351,32 +7497,6 @@ function itemNeedsUser(item, userId) {
|
|
|
7351
7497
|
function isOnlyAssignee(item, userId) {
|
|
7352
7498
|
return !item.assignedToEveryone && item.assignees.length === 1 && item.assignees[0]?.userId === userId;
|
|
7353
7499
|
}
|
|
7354
|
-
// src/chat/conversations/sql/detail-version.ts
|
|
7355
|
-
/** SQL that advances `detail_version` inside a `juniorConversations` set. */
|
|
7356
|
-
const nextDetailVersion = sql`${juniorConversations.detailVersion} + 1`;
|
|
7357
|
-
function bumpDetailVersion(db, conversationIds) {
|
|
7358
|
-
return db.update(juniorConversations).set({ detailVersion: nextDetailVersion }).where(inArray(juniorConversations.conversationId, [...conversationIds]));
|
|
7359
|
-
}
|
|
7360
|
-
/**
|
|
7361
|
-
* Return a CTE that marks the detail report of each Conversation as changed,
|
|
7362
|
-
* in the same statement as the write that it covers:
|
|
7363
|
-
* `db.with(conversationDetailTouch(db, ids)).insert(table)`.
|
|
7364
|
-
* Postgres runs a data-modifying CTE even when the statement does not read it,
|
|
7365
|
-
* and both changes commit together.
|
|
7366
|
-
*/
|
|
7367
|
-
function conversationDetailTouch(db, conversationIds) {
|
|
7368
|
-
return db.$with("conversation_detail_touch").as(bumpDetailVersion(db, conversationIds).returning({ conversationId: juniorConversations.conversationId }));
|
|
7369
|
-
}
|
|
7370
|
-
/**
|
|
7371
|
-
* Mark the detail report of each Conversation as changed, for a write that
|
|
7372
|
-
* cannot carry `conversationDetailTouch`. Call it after that write, in the same
|
|
7373
|
-
* transaction when there is one. A bump before the write lets a detail read
|
|
7374
|
-
* store old content under the new version.
|
|
7375
|
-
*/
|
|
7376
|
-
async function touchConversationDetail(db, conversationIds) {
|
|
7377
|
-
if (conversationIds.length === 0) return;
|
|
7378
|
-
await bumpDetailVersion(db, conversationIds);
|
|
7379
|
-
}
|
|
7380
7500
|
// src/chat/inbox-snoozes/store.ts
|
|
7381
7501
|
/** A snooze that woke or was cancelled is deleted this long after it was made. */
|
|
7382
7502
|
const SNOOZE_RETENTION_MS = 2592e6;
|
|
@@ -8280,19 +8400,19 @@ async function syncAutomationAlerts(db, nowMs) {
|
|
|
8280
8400
|
*/
|
|
8281
8401
|
const AUTHORIZATION_WAIT_MS = 864e5;
|
|
8282
8402
|
/**
|
|
8283
|
-
* The
|
|
8403
|
+
* The events that end a request's wait: the person connected, or a
|
|
8284
8404
|
* Turn started or ended after the request. A stop or new input ends the
|
|
8285
8405
|
* parked Turn with `turn_completed`. A child agent's Turn on a parent message
|
|
8286
8406
|
* that needs a connection abandons its Turn and ends it as `blocked`, so nothing resumes
|
|
8287
8407
|
* it and its parent gets the result instead.
|
|
8288
8408
|
*/
|
|
8289
|
-
const
|
|
8290
|
-
"authorization_requested",
|
|
8409
|
+
const AUTHORIZATION_WAIT_END_TYPES = [
|
|
8291
8410
|
"authorization_completed",
|
|
8292
8411
|
"turn_started",
|
|
8293
8412
|
"turn_completed",
|
|
8294
8413
|
"turn_failed"
|
|
8295
8414
|
];
|
|
8415
|
+
const waitEnd = alias(juniorConversationEvents, "authorization_wait_end");
|
|
8296
8416
|
/** The oldest request that still waits, on the app clock. */
|
|
8297
8417
|
function authorizationWaitStart() {
|
|
8298
8418
|
return (/* @__PURE__ */ new Date(Date.now() - AUTHORIZATION_WAIT_MS)).toISOString();
|
|
@@ -8325,17 +8445,25 @@ function hasUnexpiredAuthorizationRequest(conversationId) {
|
|
|
8325
8445
|
const events = juniorConversationEvents;
|
|
8326
8446
|
return sql`coalesce((select true from ${events} where ${events.conversationId} = ${conversationId} and ${events.type} = 'authorization_requested' and ${events.createdAt} > ${authorizationWaitStart()}::timestamptz limit 1), false)`;
|
|
8327
8447
|
}
|
|
8328
|
-
/**
|
|
8448
|
+
/**
|
|
8449
|
+
* SQL: the newest request is live, `requester` matches it, and no event
|
|
8450
|
+
* that ends a wait follows it.
|
|
8451
|
+
*/
|
|
8329
8452
|
function authorizationWait(conversationId, requester) {
|
|
8330
8453
|
const events = juniorConversationEvents;
|
|
8331
8454
|
const start = authorizationWaitStart();
|
|
8332
8455
|
return sql`(${hasUnexpiredAuthorizationRequest(conversationId)} and coalesce((
|
|
8333
|
-
select ${events.
|
|
8334
|
-
and ${events.createdAt} > ${start}::timestamptz
|
|
8456
|
+
select ${events.createdAt} > ${start}::timestamptz
|
|
8335
8457
|
and ${requester}
|
|
8458
|
+
and not exists (
|
|
8459
|
+
select 1 from ${juniorConversationEvents} as ${waitEnd}
|
|
8460
|
+
where ${waitEnd.conversationId} = ${events.conversationId}
|
|
8461
|
+
and ${waitEnd.type} in (${sql.join(AUTHORIZATION_WAIT_END_TYPES.map((type) => sql`${type}`), sql`, `)})
|
|
8462
|
+
and ${waitEnd.seq} > ${events.seq}
|
|
8463
|
+
)
|
|
8336
8464
|
from ${events}
|
|
8337
8465
|
where ${events.conversationId} = ${conversationId}
|
|
8338
|
-
and ${events.type}
|
|
8466
|
+
and ${events.type} = 'authorization_requested'
|
|
8339
8467
|
order by ${events.seq} desc
|
|
8340
8468
|
limit 1
|
|
8341
8469
|
), false))`;
|
|
@@ -8375,7 +8503,7 @@ async function ensureConversationRow(executor, conversationId, atMs, options = {
|
|
|
8375
8503
|
lastActivityAt: at,
|
|
8376
8504
|
updatedAt: at,
|
|
8377
8505
|
executionStatus: "idle",
|
|
8378
|
-
kind: "
|
|
8506
|
+
kind: "thread"
|
|
8379
8507
|
});
|
|
8380
8508
|
if (options.activity === "preserve") {
|
|
8381
8509
|
await insert.onConflictDoNothing({ target: juniorConversations.conversationId });
|
|
@@ -8392,21 +8520,20 @@ async function ensureConversationRow(executor, conversationId, atMs, options = {
|
|
|
8392
8520
|
});
|
|
8393
8521
|
}
|
|
8394
8522
|
const CONVERSATION_KINDS = /* @__PURE__ */ new Set([
|
|
8395
|
-
"
|
|
8523
|
+
"thread",
|
|
8396
8524
|
"automation",
|
|
8397
8525
|
"lead",
|
|
8398
|
-
"thread",
|
|
8399
8526
|
"task"
|
|
8400
8527
|
]);
|
|
8401
8528
|
/** Decode a stored kind. A null kind comes from a writer of an older deploy. */
|
|
8402
8529
|
function conversationKindFromRow(row) {
|
|
8403
|
-
const kind = row.kind ?? (row.parentConversationId ? "task" : "
|
|
8530
|
+
const kind = row.kind ?? (row.parentConversationId ? "task" : "thread");
|
|
8404
8531
|
if (!CONVERSATION_KINDS.has(kind)) throw new Error("Conversation record kind is invalid");
|
|
8405
8532
|
return kind;
|
|
8406
8533
|
}
|
|
8407
8534
|
/** SQL for the kind of a row, with the same null fallback as `conversationKindFromRow`. */
|
|
8408
8535
|
function conversationKindSql(conversation) {
|
|
8409
|
-
return sql`coalesce(${conversation.kind}, case when ${conversation.parentConversationId} is null then '
|
|
8536
|
+
return sql`coalesce(${conversation.kind}, case when ${conversation.parentConversationId} is null then 'thread' else 'task' end)`;
|
|
8410
8537
|
}
|
|
8411
8538
|
// src/chat/conversations/sql/status.ts
|
|
8412
8539
|
const ACTIVE_EXECUTION_STATUSES = [
|
|
@@ -8427,6 +8554,7 @@ function conversationIsActiveSql(conversation) {
|
|
|
8427
8554
|
function executionIsActive(executionStatus) {
|
|
8428
8555
|
return ACTIVE_EXECUTION_STATUSES.includes(executionStatus);
|
|
8429
8556
|
}
|
|
8557
|
+
const turnAfterFailure = alias(juniorConversationEvents, "status_turn_after_failure");
|
|
8430
8558
|
/**
|
|
8431
8559
|
* SQL: the latest Turn of the Conversation failed with no newer input.
|
|
8432
8560
|
* Execution is `failed`, or the newest Turn lifecycle Event is
|
|
@@ -8434,8 +8562,18 @@ function executionIsActive(executionStatus) {
|
|
|
8434
8562
|
* count it; the status reads it as input that the starter needs to give.
|
|
8435
8563
|
*/
|
|
8436
8564
|
function conversationTurnFailedSql(conversation) {
|
|
8437
|
-
|
|
8438
|
-
|
|
8565
|
+
return sql`(${conversation.executionStatus} = 'failed' or coalesce((
|
|
8566
|
+
select not exists (
|
|
8567
|
+
select 1 from ${juniorConversationEvents} as ${turnAfterFailure}
|
|
8568
|
+
where ${turnAfterFailure.conversationId} = ${juniorConversationEvents.conversationId}
|
|
8569
|
+
and ${turnAfterFailure.type} in ('turn_started', 'turn_completed')
|
|
8570
|
+
and ${turnAfterFailure.seq} > ${juniorConversationEvents.seq}
|
|
8571
|
+
)
|
|
8572
|
+
from ${juniorConversationEvents}
|
|
8573
|
+
where ${and(eq(juniorConversationEvents.conversationId, conversation.conversationId), eq(juniorConversationEvents.type, "turn_failed"))}
|
|
8574
|
+
order by ${desc(juniorConversationEvents.seq)}
|
|
8575
|
+
limit 1
|
|
8576
|
+
), false))`;
|
|
8439
8577
|
}
|
|
8440
8578
|
const DELIVERY_PAUSE_START = sql.raw(`'2026-11-10T02:48:39Z'::timestamptz`);
|
|
8441
8579
|
const starterRoot = alias(juniorConversations, "status_starter_root");
|
|
@@ -8466,7 +8604,7 @@ function conversationWaitsOnStarterSql(conversation) {
|
|
|
8466
8604
|
const starterUserId = sql`${starter}.user_id`;
|
|
8467
8605
|
const replySeq = sql`${reply}.seq`;
|
|
8468
8606
|
const replyInSlack = sql`${reply}.in_slack`;
|
|
8469
|
-
const latestReply = sql`(select ${juniorConversationEvents.seq} as seq, coalesce(${juniorConversationEvents.payload}->'meta'->>'source' = 'slack', ${juniorConversationEvents.createdAt} < ${DELIVERY_PAUSE_START}) as in_slack from ${juniorConversationEvents} where ${and(eq(juniorConversationEvents.conversationId, id),
|
|
8607
|
+
const latestReply = sql`(select ${juniorConversationEvents.seq} as seq, coalesce(${juniorConversationEvents.payload}->'meta'->>'source' = 'slack', ${juniorConversationEvents.createdAt} < ${DELIVERY_PAUSE_START}) as in_slack from ${juniorConversationEvents} where ${and(eq(juniorConversationEvents.conversationId, id), sql`${juniorConversationEvents.type} = 'message'`, sql`${juniorConversationEvents.payload}->>'role' = 'assistant'`)} order by ${desc(juniorConversationEvents.seq)} limit 1)`;
|
|
8470
8608
|
const readByStarter = or(and(sql`${conversation.parentConversationId} is null`, sql`${conversation.location} is not null`, sql`coalesce(${replyInSlack}, false)`), sql`exists (select 1 from ${juniorConversationEvents} join ${juniorIdentities} as ${replyReader} on ${eq(replyReader.id, juniorConversationEvents.actorIdentityId)} where ${and(eq(juniorConversationEvents.conversationId, id), eq(juniorConversationEvents.type, "message"), gt(juniorConversationEvents.seq, replySeq), eq(replyReader.userId, starterUserId))})`, sql`exists (select 1 from ${juniorConversationReadPositions} where ${and(eq(juniorConversationReadPositions.conversationId, id), eq(juniorConversationReadPositions.userId, starterUserId), gte(juniorConversationReadPositions.lastReadSeq, replySeq))})`);
|
|
8471
8609
|
const waitsOnFacts = sql`(select ${replySeq} is not null and ${starterUserId} is not null and not (${readByStarter})
|
|
8472
8610
|
from (select ${conversationStarterUserIdSql(conversation)} as user_id offset 0) as ${starter}
|
|
@@ -8562,6 +8700,7 @@ function conversationAggregateColumns(sources) {
|
|
|
8562
8700
|
const metrics = sources?.metrics ?? juniorConversations;
|
|
8563
8701
|
const roots = sources?.roots ?? juniorConversations;
|
|
8564
8702
|
const conversationCount = sources ? sql`COUNT(DISTINCT ${roots.conversationId})` : sql`COUNT(*)`;
|
|
8703
|
+
const rootRow = sources ? sql`${metrics.conversationId} = ${roots.conversationId} AND ` : sql``;
|
|
8565
8704
|
return {
|
|
8566
8705
|
active: sql`${conversationCount} FILTER (
|
|
8567
8706
|
WHERE ${conversationIsActiveSql(roots)}
|
|
@@ -8572,7 +8711,7 @@ function conversationAggregateColumns(sources) {
|
|
|
8572
8711
|
costUsd: sql`SUM(${costValue(metrics)})::double precision`,
|
|
8573
8712
|
durationMs: sql`COALESCE(SUM(${metrics.durationMs}), 0)::double precision`,
|
|
8574
8713
|
failed: sql`${conversationCount} FILTER (
|
|
8575
|
-
WHERE ${
|
|
8714
|
+
WHERE ${rootRow}${roots.stoppedAt} IS NULL AND ${conversationTurnFailedSql(roots)}
|
|
8576
8715
|
)::integer`,
|
|
8577
8716
|
inputTokens: sql`SUM(${usageTokenValue(metrics, "inputTokens")})::double precision`,
|
|
8578
8717
|
tokens: sql`SUM(${tokenValue(metrics)})::double precision`
|
|
@@ -10878,6 +11017,7 @@ async function selectPluginGrant(input) {
|
|
|
10878
11017
|
...basePluginContext$1(plugin),
|
|
10879
11018
|
request: {
|
|
10880
11019
|
...input.bodyText !== void 0 ? { bodyText: input.bodyText } : void 0,
|
|
11020
|
+
...input.conversationId ? { conversationId: input.conversationId } : void 0,
|
|
10881
11021
|
...input.gitPush ? { gitPush: input.gitPush } : void 0,
|
|
10882
11022
|
...input.graphql ? { graphql: input.graphql } : void 0,
|
|
10883
11023
|
method: input.method,
|
|
@@ -10903,6 +11043,7 @@ async function onPluginEgressResponse(input) {
|
|
|
10903
11043
|
permissionDenied = { message: trimmed };
|
|
10904
11044
|
},
|
|
10905
11045
|
request: {
|
|
11046
|
+
...input.conversationId ? { conversationId: input.conversationId } : void 0,
|
|
10906
11047
|
method: input.method,
|
|
10907
11048
|
...input.operation ? { operation: input.operation } : void 0,
|
|
10908
11049
|
url: input.upstreamUrl.toString()
|
|
@@ -12808,46 +12949,6 @@ function conversationSimilarity(query) {
|
|
|
12808
12949
|
});
|
|
12809
12950
|
return sql`CASE WHEN ${table.provider} = ${query.provider} AND ${table.model} = ${query.model} THEN 1 - ${distance} END`;
|
|
12810
12951
|
}
|
|
12811
|
-
// src/chat/conversations/sql/privacy.ts
|
|
12812
|
-
const privacyRoot = alias(juniorConversations, "privacy_root");
|
|
12813
|
-
/** Accept only a structurally valid persisted root as privacy authority. */
|
|
12814
|
-
async function readRootCandidate(executor, conversationId) {
|
|
12815
|
-
const row = (await executor.db().select({
|
|
12816
|
-
requestedConversationId: juniorConversations.conversationId,
|
|
12817
|
-
requestedParentConversationId: juniorConversations.parentConversationId,
|
|
12818
|
-
requestedRootConversationId: juniorConversations.rootConversationId,
|
|
12819
|
-
rootConversationId: privacyRoot.conversationId,
|
|
12820
|
-
rootDestinationId: privacyRoot.destinationId,
|
|
12821
|
-
rootParentConversationId: privacyRoot.parentConversationId,
|
|
12822
|
-
rootRootConversationId: privacyRoot.rootConversationId
|
|
12823
|
-
}).from(juniorConversations).leftJoin(privacyRoot, eq(privacyRoot.conversationId, juniorConversations.rootConversationId)).where(eq(juniorConversations.conversationId, conversationId)))[0];
|
|
12824
|
-
return row !== void 0 && row.requestedRootConversationId !== null && (row.requestedParentConversationId !== null || row.requestedRootConversationId === row.requestedConversationId) && row.rootConversationId === row.requestedRootConversationId && row.rootRootConversationId === row.rootConversationId && row.rootParentConversationId === null && row.rootDestinationId !== null ? {
|
|
12825
|
-
destinationId: row.rootDestinationId,
|
|
12826
|
-
rootConversationId: row.rootConversationId
|
|
12827
|
-
} : void 0;
|
|
12828
|
-
}
|
|
12829
|
-
async function readCandidateVisibility(executor, candidate) {
|
|
12830
|
-
const destinations = await executor.db().select({ visibility: juniorDestinations.visibility }).from(juniorDestinations).where(eq(juniorDestinations.id, candidate.destinationId)).for("share");
|
|
12831
|
-
return {
|
|
12832
|
-
rootConversationId: candidate.rootConversationId,
|
|
12833
|
-
visibility: destinations[0]?.visibility ?? null
|
|
12834
|
-
};
|
|
12835
|
-
}
|
|
12836
|
-
/**
|
|
12837
|
-
* Resolve a conversation's privacy authority from its persisted root.
|
|
12838
|
-
*
|
|
12839
|
-
* Missing or structurally invalid root metadata fails closed. The root
|
|
12840
|
-
* destination is locked so callers that keep the transaction open receive a
|
|
12841
|
-
* stable visibility decision.
|
|
12842
|
-
*/
|
|
12843
|
-
async function resolveRootVisibility(executor, conversationId) {
|
|
12844
|
-
const candidate = await readRootCandidate(executor, conversationId);
|
|
12845
|
-
if (!candidate) return {
|
|
12846
|
-
rootConversationId: conversationId,
|
|
12847
|
-
visibility: null
|
|
12848
|
-
};
|
|
12849
|
-
return readCandidateVisibility(executor, candidate);
|
|
12850
|
-
}
|
|
12851
12952
|
// src/chat/conversations/metadata/store.ts
|
|
12852
12953
|
/**
|
|
12853
12954
|
* The word-search vector of a Conversation's title and summary. It matches
|
|
@@ -12962,7 +13063,7 @@ async function searchConversations(db, args) {
|
|
|
12962
13063
|
isNull(conversations.quickQuestionAt),
|
|
12963
13064
|
search.rootsOnly ? or(eq(conversations.conversationId, conversations.rootConversationId), team ? ownTree : void 0) : void 0,
|
|
12964
13065
|
team ? ne(conversations.conversationId, requesterConversationId) : ne(conversations.rootConversationId, requesterRootId),
|
|
12965
|
-
or(
|
|
13066
|
+
or(isPublicConversation(conversations), eq(roots.destinationId, db.select({ destinationId: requesterRoot.destinationId }).from(requesterRoot).where(eq(requesterRoot.conversationId, requesterRootId))), eq(roots.spaceId, db.select({ id: juniorSpaces.id }).from(requesterRoot).innerJoin(juniorSpaces, and(eq(juniorSpaces.id, requesterRoot.spaceId), eq(juniorSpaces.visibility, "private"))).where(eq(requesterRoot.conversationId, requesterRootId)))),
|
|
12966
13067
|
search.annotation ? or(search.annotationOnSelf ? void 0 : treeHasAnnotationKey(conversations.conversationId, search.annotation), hasAnnotationKey(conversations.conversationId, search.annotation)) : void 0,
|
|
12967
13068
|
search.statuses ? inArray(conversations.executionStatus, [...search.statuses]) : void 0,
|
|
12968
13069
|
search.participantUserId ? participates(search.participantUserId) : void 0,
|
|
@@ -18253,7 +18354,10 @@ const credentialSignalKindSchema = z.enum(["auth_required", "unavailable"]);
|
|
|
18253
18354
|
const sandboxEgressGrantSchema = pluginGrantSchema;
|
|
18254
18355
|
const sandboxEgressCredentialContextSchema = z.object({
|
|
18255
18356
|
credentials: credentialContextSchema,
|
|
18256
|
-
/**
|
|
18357
|
+
/**
|
|
18358
|
+
* Conversation that the credentials act for. Telemetry and per-Conversation
|
|
18359
|
+
* limits only; it grants nothing.
|
|
18360
|
+
*/
|
|
18257
18361
|
conversationId: z.string().min(1).optional(),
|
|
18258
18362
|
egressId: z.string().min(1),
|
|
18259
18363
|
expiresAtMs: finiteNumberSchema,
|
|
@@ -18624,6 +18728,7 @@ async function selectSandboxEgressGrant(input) {
|
|
|
18624
18728
|
const pluginGrant = await selectPluginGrant({
|
|
18625
18729
|
...input.withoutCredential ? { withoutCredential: true } : void 0,
|
|
18626
18730
|
...input.bodyText !== void 0 ? { bodyText: input.bodyText } : void 0,
|
|
18731
|
+
...input.conversationId ? { conversationId: input.conversationId } : void 0,
|
|
18627
18732
|
...input.gitPush ? { gitPush: input.gitPush } : void 0,
|
|
18628
18733
|
...input.graphql ? { graphql: input.graphql } : void 0,
|
|
18629
18734
|
...input.operation ? { operation: input.operation } : void 0,
|
|
@@ -19084,6 +19189,7 @@ async function executeCredentialedEgressRequest(input) {
|
|
|
19084
19189
|
requestMethod: request.method,
|
|
19085
19190
|
upstreamUrl
|
|
19086
19191
|
}) ? { bodyText: grantSelectionBodyText(body) } : void 0,
|
|
19192
|
+
...credentialContext.conversationId ? { conversationId: credentialContext.conversationId } : void 0,
|
|
19087
19193
|
...isGitReceivePack(request.method, upstreamUrl) ? { gitPush: readGitPush(body) } : void 0,
|
|
19088
19194
|
...isGraphqlPost(request.method, upstreamUrl) ? { graphql: await readGraphqlRequest(body) } : void 0,
|
|
19089
19195
|
...operation ? { operation } : void 0,
|
|
@@ -19205,6 +19311,7 @@ async function executeCredentialedEgressRequest(input) {
|
|
|
19205
19311
|
let pluginPermissionDenied;
|
|
19206
19312
|
try {
|
|
19207
19313
|
pluginPermissionDenied = (await onPluginEgressResponse({
|
|
19314
|
+
...credentialContext.conversationId ? { conversationId: credentialContext.conversationId } : void 0,
|
|
19208
19315
|
provider,
|
|
19209
19316
|
grant: lease.grant,
|
|
19210
19317
|
method: request.method,
|
|
@@ -22258,7 +22365,7 @@ function pluginTaskCallback(options) {
|
|
|
22258
22365
|
onRejected: logPluginTaskQueueMessageRejected,
|
|
22259
22366
|
retryDelaySeconds: pluginTaskRetryDelaySeconds,
|
|
22260
22367
|
run: async (message, metadata) => {
|
|
22261
|
-
const { processPluginTask } = await import("./task-runner-
|
|
22368
|
+
const { processPluginTask } = await import("./task-runner-BJae4JwE.js").then((n) => n.r);
|
|
22262
22369
|
await processPluginTask(message, {
|
|
22263
22370
|
...options,
|
|
22264
22371
|
deliveryCount: metadata.deliveryCount
|
|
@@ -22618,7 +22725,7 @@ const ROOT = {
|
|
|
22618
22725
|
inbox: true,
|
|
22619
22726
|
subscriptions: true,
|
|
22620
22727
|
userCustomization: true,
|
|
22621
|
-
|
|
22728
|
+
settings: true,
|
|
22622
22729
|
reply: false,
|
|
22623
22730
|
reportBlocked: "none",
|
|
22624
22731
|
noReply: true
|
|
@@ -22629,7 +22736,7 @@ const ROOT_RUNTIME_TURN = {
|
|
|
22629
22736
|
relatedConversations: false,
|
|
22630
22737
|
tools: {
|
|
22631
22738
|
...ROOT.tools,
|
|
22632
|
-
|
|
22739
|
+
settings: false
|
|
22633
22740
|
}
|
|
22634
22741
|
};
|
|
22635
22742
|
const PERSON_IN_THREAD = {
|
|
@@ -22657,10 +22764,10 @@ const CHILD_AGENT_TURN = {
|
|
|
22657
22764
|
inbox: false,
|
|
22658
22765
|
subscriptions: false,
|
|
22659
22766
|
userCustomization: false,
|
|
22660
|
-
|
|
22767
|
+
settings: false,
|
|
22661
22768
|
reply: false,
|
|
22662
22769
|
reportBlocked: "parent",
|
|
22663
|
-
noReply:
|
|
22770
|
+
noReply: false
|
|
22664
22771
|
}
|
|
22665
22772
|
};
|
|
22666
22773
|
const AGENT_IN_THREAD = {
|
|
@@ -22674,7 +22781,8 @@ const THREAD_TOOLS = {
|
|
|
22674
22781
|
inbox: PERSON_IN_THREAD.tools.inbox,
|
|
22675
22782
|
subscriptions: PERSON_IN_THREAD.tools.subscriptions,
|
|
22676
22783
|
userCustomization: PERSON_IN_THREAD.tools.userCustomization,
|
|
22677
|
-
|
|
22784
|
+
settings: PERSON_IN_THREAD.tools.settings,
|
|
22785
|
+
noReply: PERSON_IN_THREAD.tools.noReply
|
|
22678
22786
|
};
|
|
22679
22787
|
const AUTOMATION_RUN = {
|
|
22680
22788
|
delivery: "conversation",
|
|
@@ -22688,7 +22796,7 @@ const AUTOMATION_RUN = {
|
|
|
22688
22796
|
relatedConversations: false,
|
|
22689
22797
|
tools: {
|
|
22690
22798
|
...ROOT.tools,
|
|
22691
|
-
|
|
22799
|
+
settings: false,
|
|
22692
22800
|
reply: true,
|
|
22693
22801
|
reportBlocked: "automation"
|
|
22694
22802
|
}
|
|
@@ -22699,10 +22807,6 @@ const PERSON_IN_AUTOMATION = {
|
|
|
22699
22807
|
sender: "person",
|
|
22700
22808
|
relatedConversations: false
|
|
22701
22809
|
};
|
|
22702
|
-
const AUTOMATION_TOOLS = {
|
|
22703
|
-
...AUTOMATION_RUN.tools,
|
|
22704
|
-
spaces: PERSON_IN_AUTOMATION.tools.spaces
|
|
22705
|
-
};
|
|
22706
22810
|
const LEAD_TOOLS = [
|
|
22707
22811
|
"startConversation",
|
|
22708
22812
|
"messageAgent",
|
|
@@ -22717,7 +22821,7 @@ const LEAD_TOOLS = [
|
|
|
22717
22821
|
"stopWatchingResources",
|
|
22718
22822
|
"systemTime",
|
|
22719
22823
|
"updateUserCustomization",
|
|
22720
|
-
"
|
|
22824
|
+
"setConfiguration",
|
|
22721
22825
|
"noReply"
|
|
22722
22826
|
];
|
|
22723
22827
|
const LEAD_DIRECT_TOOLS = [
|
|
@@ -22728,7 +22832,7 @@ const LEAD_DIRECT_TOOLS = [
|
|
|
22728
22832
|
"searchEventTypes",
|
|
22729
22833
|
"listWatches",
|
|
22730
22834
|
"stopWatchingResources",
|
|
22731
|
-
"
|
|
22835
|
+
"setConfiguration"
|
|
22732
22836
|
];
|
|
22733
22837
|
const LEAD = {
|
|
22734
22838
|
...ROOT,
|
|
@@ -22743,12 +22847,16 @@ const LEAD = {
|
|
|
22743
22847
|
direct: LEAD_DIRECT_TOOLS
|
|
22744
22848
|
}
|
|
22745
22849
|
};
|
|
22746
|
-
/**
|
|
22850
|
+
/**
|
|
22851
|
+
* Return the behavior of one Turn. A `thread` with a parent runs like a
|
|
22852
|
+
* top-level `thread`, and also reports to its parent.
|
|
22853
|
+
*/
|
|
22747
22854
|
function turnBehavior(args) {
|
|
22748
22855
|
switch (args.kind) {
|
|
22749
|
-
case "
|
|
22856
|
+
case "thread":
|
|
22857
|
+
if (args.hasParent) return args.personInput ? PERSON_IN_THREAD : AGENT_IN_THREAD;
|
|
22858
|
+
return args.personInput ? ROOT : ROOT_RUNTIME_TURN;
|
|
22750
22859
|
case "automation": return args.personInput ? PERSON_IN_AUTOMATION : AUTOMATION_RUN;
|
|
22751
|
-
case "thread": return args.personInput ? PERSON_IN_THREAD : AGENT_IN_THREAD;
|
|
22752
22860
|
case "task":
|
|
22753
22861
|
if (!args.personInput) return CHILD_AGENT_TURN;
|
|
22754
22862
|
throw new Error("A task Conversation cannot have a person's input");
|
|
@@ -22762,7 +22870,7 @@ function turnBehavior(args) {
|
|
|
22762
22870
|
*/
|
|
22763
22871
|
function promptModeTurnTools(mode) {
|
|
22764
22872
|
switch (mode) {
|
|
22765
|
-
case "automation": return
|
|
22873
|
+
case "automation": return AUTOMATION_RUN.tools;
|
|
22766
22874
|
case "child_agent": return CHILD_AGENT_TURN.tools;
|
|
22767
22875
|
case "thread": return THREAD_TOOLS;
|
|
22768
22876
|
case "conversation": return ROOT.tools;
|
|
@@ -22784,6 +22892,13 @@ function canMoveToSpace(conversation) {
|
|
|
22784
22892
|
return isTopLevel(conversation) && conversation.kind !== "lead";
|
|
22785
22893
|
}
|
|
22786
22894
|
/**
|
|
22895
|
+
* Return whether a Conversation copies its root's visibility: it has a
|
|
22896
|
+
* parent. A root takes the visibility of its Destination or Space.
|
|
22897
|
+
*/
|
|
22898
|
+
function copiesRootVisibility(conversation) {
|
|
22899
|
+
return !isTopLevel(conversation);
|
|
22900
|
+
}
|
|
22901
|
+
/**
|
|
22787
22902
|
* Return whether only members of the Conversation's Space can send it a
|
|
22788
22903
|
* Message. A Space's Lead talks only to its members.
|
|
22789
22904
|
*/
|
|
@@ -22794,9 +22909,22 @@ function messagesNeedSpaceMembership(kind) {
|
|
|
22794
22909
|
function isTopLevel(conversation) {
|
|
22795
22910
|
return !conversation.parentConversationId;
|
|
22796
22911
|
}
|
|
22797
|
-
/**
|
|
22798
|
-
|
|
22799
|
-
|
|
22912
|
+
/**
|
|
22913
|
+
* Return whether a Conversation of this kind may have this parent edge. A
|
|
22914
|
+
* `thread` may have a parent, a Task must, and an Automation run or a Lead
|
|
22915
|
+
* never does.
|
|
22916
|
+
*/
|
|
22917
|
+
function kindAllowsParent(kind, hasParent) {
|
|
22918
|
+
switch (kind) {
|
|
22919
|
+
case "thread": return true;
|
|
22920
|
+
case "task": return hasParent;
|
|
22921
|
+
case "automation":
|
|
22922
|
+
case "lead": return !hasParent;
|
|
22923
|
+
}
|
|
22924
|
+
}
|
|
22925
|
+
/** Return whether a Conversation is a child Thread: a `thread` with a parent. */
|
|
22926
|
+
function isThread(conversation) {
|
|
22927
|
+
return conversation.kind === "thread" && !isTopLevel(conversation);
|
|
22800
22928
|
}
|
|
22801
22929
|
/**
|
|
22802
22930
|
* Return whether the watcher started this Conversation, so it already has
|
|
@@ -27254,6 +27382,7 @@ async function isFirstRequest(ctx, conversationId) {
|
|
|
27254
27382
|
const conversation = await getConversationStore().get({ conversationId });
|
|
27255
27383
|
if (!conversation || !turnBehavior({
|
|
27256
27384
|
kind: conversation.kind,
|
|
27385
|
+
hasParent: !isTopLevel(conversation),
|
|
27257
27386
|
personInput: isPersonInput(ctx.source.kind)
|
|
27258
27387
|
}).relatedConversations) return false;
|
|
27259
27388
|
const { events } = await getConversationEventStore().query(conversationId, {
|
|
@@ -29266,6 +29395,58 @@ function destinationUpsertFromDestination(args) {
|
|
|
29266
29395
|
metadata: { platform: "local" }
|
|
29267
29396
|
};
|
|
29268
29397
|
}
|
|
29398
|
+
/**
|
|
29399
|
+
* Insert or refresh a Destination row. Returns its id and the visibility that
|
|
29400
|
+
* a new root there takes, or null while the Destination's visibility is
|
|
29401
|
+
* unknown. A root keeps the first visibility that it gets, so a later change
|
|
29402
|
+
* here changes no root.
|
|
29403
|
+
*/
|
|
29404
|
+
async function upsertDestination(executor, destination, nowMs) {
|
|
29405
|
+
if (!destination) return;
|
|
29406
|
+
const visibilityUpdate = destination.refreshVisibility ? sql`excluded.visibility` : juniorDestinations.visibility;
|
|
29407
|
+
const row = (await executor.db().insert(juniorDestinations).values({
|
|
29408
|
+
id: randomUUID(),
|
|
29409
|
+
provider: destination.provider,
|
|
29410
|
+
providerTenantId: destination.providerTenantId ?? "",
|
|
29411
|
+
providerDestinationId: destination.providerDestinationId,
|
|
29412
|
+
kind: destination.kind,
|
|
29413
|
+
parentDestinationId: null,
|
|
29414
|
+
displayName: destination.displayName ?? null,
|
|
29415
|
+
visibility: destination.visibility,
|
|
29416
|
+
metadata: destination.metadata ?? null,
|
|
29417
|
+
createdAt: new Date(nowMs),
|
|
29418
|
+
updatedAt: new Date(nowMs)
|
|
29419
|
+
}).onConflictDoUpdate({
|
|
29420
|
+
target: [
|
|
29421
|
+
juniorDestinations.provider,
|
|
29422
|
+
juniorDestinations.providerTenantId,
|
|
29423
|
+
juniorDestinations.providerDestinationId
|
|
29424
|
+
],
|
|
29425
|
+
set: {
|
|
29426
|
+
kind: sql`excluded.kind`,
|
|
29427
|
+
displayName: sql`coalesce(excluded.display_name, ${juniorDestinations.displayName})`,
|
|
29428
|
+
visibility: visibilityUpdate,
|
|
29429
|
+
metadata: sql`coalesce(excluded.metadata_json, ${juniorDestinations.metadata})`,
|
|
29430
|
+
updatedAt: sql`excluded.updated_at`
|
|
29431
|
+
}
|
|
29432
|
+
}).returning({
|
|
29433
|
+
id: juniorDestinations.id,
|
|
29434
|
+
visibility: juniorDestinations.visibility
|
|
29435
|
+
}))[0];
|
|
29436
|
+
if (!row) return;
|
|
29437
|
+
return {
|
|
29438
|
+
id: row.id,
|
|
29439
|
+
visibility: destinationVisibility(row.visibility)
|
|
29440
|
+
};
|
|
29441
|
+
}
|
|
29442
|
+
/**
|
|
29443
|
+
* The visibility that a root at a Destination takes: public stays public,
|
|
29444
|
+
* direct and private are private, and unknown or missing is null.
|
|
29445
|
+
*/
|
|
29446
|
+
function destinationVisibility(visibility) {
|
|
29447
|
+
if (visibility === void 0 || visibility === "unknown") return null;
|
|
29448
|
+
return visibility === "public" ? "public" : "private";
|
|
29449
|
+
}
|
|
29269
29450
|
// src/chat/conversations/sql/bindings.ts
|
|
29270
29451
|
/** Resolve the durable conversation bound to provider-owned coordinates. */
|
|
29271
29452
|
async function getConversationIdByProviderConversation(executor, args) {
|
|
@@ -29440,25 +29621,25 @@ function locationFromRow(value, row, sessionSource) {
|
|
|
29440
29621
|
...slackSource?.threadTs ? { threadTs: slackSource.threadTs } : void 0
|
|
29441
29622
|
});
|
|
29442
29623
|
}
|
|
29443
|
-
/** Read confirmed visibility from one linked Location row. */
|
|
29444
|
-
function visibilityFromLocationRow(row) {
|
|
29445
|
-
if (!row) return;
|
|
29446
|
-
if (row.visibility === "public" || row.visibility === "private") return row.visibility;
|
|
29447
|
-
}
|
|
29448
29624
|
/**
|
|
29449
29625
|
* Give a root Conversation with no Location its first one, in the caller's
|
|
29450
|
-
* SQL scope. The Location row becomes the Conversation Destination,
|
|
29451
|
-
* visibility
|
|
29626
|
+
* SQL scope. The Location row becomes the Conversation Destination, and a
|
|
29627
|
+
* tree with no visibility yet takes its visibility. Returns false when the
|
|
29452
29628
|
* Conversation already has a Location.
|
|
29453
29629
|
*/
|
|
29454
29630
|
async function setFirstConversationLocation(executor, args) {
|
|
29455
29631
|
const location = locationSchema.parse(args.location);
|
|
29456
|
-
|
|
29632
|
+
const db = executor.db();
|
|
29633
|
+
if ((await db.update(juniorConversations).set({
|
|
29457
29634
|
location,
|
|
29458
29635
|
destinationId: location.id,
|
|
29459
29636
|
...args.channelName ? { channelName: args.channelName } : void 0,
|
|
29460
29637
|
detailVersion: nextDetailVersion
|
|
29461
|
-
}).where(and(eq(juniorConversations.conversationId, args.conversationId), isNull(juniorConversations.parentConversationId), isNull(juniorConversations.location))).returning({ conversationId: juniorConversations.conversationId })).length
|
|
29638
|
+
}).where(and(eq(juniorConversations.conversationId, args.conversationId), isNull(juniorConversations.parentConversationId), isNull(juniorConversations.location))).returning({ conversationId: juniorConversations.conversationId })).length === 0) return false;
|
|
29639
|
+
const [destination] = await db.select({ visibility: juniorDestinations.visibility }).from(juniorDestinations).where(eq(juniorDestinations.id, location.id));
|
|
29640
|
+
const visibility = destinationVisibility(destination?.visibility);
|
|
29641
|
+
if (visibility) await fillMissingTreeVisibility(executor, args.conversationId, visibility);
|
|
29642
|
+
return true;
|
|
29462
29643
|
}
|
|
29463
29644
|
/** Store a channel-level Location's first bound post as its thread. */
|
|
29464
29645
|
async function startLocationThread(executor, binding) {
|
|
@@ -29512,7 +29693,7 @@ function destinationFromRow(destination) {
|
|
|
29512
29693
|
/** Decode one SQL row and reject invalid durable conversation records. */
|
|
29513
29694
|
function conversationFromRow(readRow) {
|
|
29514
29695
|
const row = readRow.conversation;
|
|
29515
|
-
const visibility =
|
|
29696
|
+
const visibility = row.visibility ?? void 0;
|
|
29516
29697
|
if (row.schemaVersion !== 1) throw new Error("Conversation record schema version is invalid");
|
|
29517
29698
|
if (row.destination !== null && readRow.destination === null) throw new Error("Conversation legacy destination is not migrated");
|
|
29518
29699
|
if (row.actor !== null && readRow.actorIdentity === null) throw new Error("Conversation legacy actor is not migrated");
|
|
@@ -29567,7 +29748,7 @@ function emptyConversation(args) {
|
|
|
29567
29748
|
schemaVersion: 1,
|
|
29568
29749
|
conversationId: args.conversationId,
|
|
29569
29750
|
createdAtMs: args.nowMs,
|
|
29570
|
-
kind: args.kind ?? "
|
|
29751
|
+
kind: args.kind ?? "thread",
|
|
29571
29752
|
lastActivityAtMs: args.nowMs,
|
|
29572
29753
|
updatedAtMs: args.nowMs,
|
|
29573
29754
|
...args.destination ? { destination: args.destination } : void 0,
|
|
@@ -29699,7 +29880,7 @@ var SqlStore = class {
|
|
|
29699
29880
|
schemaVersion: 1,
|
|
29700
29881
|
conversationId: args.conversationId,
|
|
29701
29882
|
createdAtMs: args.createdAtMs,
|
|
29702
|
-
kind: existing?.kind ?? "
|
|
29883
|
+
kind: existing?.kind ?? "thread",
|
|
29703
29884
|
lastActivityAtMs: args.lastActivityAtMs,
|
|
29704
29885
|
updatedAtMs: args.updatedAtMs,
|
|
29705
29886
|
...existing?.parentConversationId ? { parentConversationId: existing.parentConversationId } : void 0,
|
|
@@ -29747,7 +29928,7 @@ var SqlStore = class {
|
|
|
29747
29928
|
if (row.visibility === "public" || row.visibility === "private") return row.visibility;
|
|
29748
29929
|
}
|
|
29749
29930
|
async recordDestinationVisibility(args) {
|
|
29750
|
-
await this.
|
|
29931
|
+
await upsertDestination(this.executor, destinationUpsertFromDestination(args), args.nowMs ?? Date.now());
|
|
29751
29932
|
}
|
|
29752
29933
|
async findSlackDestinationByName(args) {
|
|
29753
29934
|
const normalized = args.channelName.trim().replace(/^#/, "").toLowerCase();
|
|
@@ -29779,19 +29960,21 @@ var SqlStore = class {
|
|
|
29779
29960
|
/** Upsert the conversation row while preserving previously discovered nullable metadata fields. */
|
|
29780
29961
|
async upsertConversation(args) {
|
|
29781
29962
|
const { conversation } = args;
|
|
29782
|
-
if (
|
|
29963
|
+
if (!kindAllowsParent(conversation.kind, !!conversation.parentConversationId)) throw new Error(`Conversation ${conversation.conversationId} kind does not match its parent`);
|
|
29783
29964
|
if (!conversation.parentConversationId && !conversation.destination) {
|
|
29784
29965
|
if (!await this.get({ conversationId: conversation.conversationId })) throw new Error(`Conversation ${conversation.conversationId} requires a destination at create`);
|
|
29785
29966
|
}
|
|
29786
29967
|
const incomingExecutionVersion = sql`coalesce(excluded.execution_updated_at, excluded.updated_at)`;
|
|
29787
29968
|
const currentExecutionVersion = sql`coalesce(${juniorConversations.executionUpdatedAt}, ${juniorConversations.updatedAt})`;
|
|
29788
29969
|
const incomingExecutionIsFresh = sql`${incomingExecutionVersion} >= ${currentExecutionVersion}`;
|
|
29789
|
-
const
|
|
29970
|
+
const upsertedDestination = await upsertDestination(this.executor, destinationUpsertFromDestination({
|
|
29790
29971
|
channelName: conversation.channelName,
|
|
29791
29972
|
conversationId: conversation.conversationId,
|
|
29792
29973
|
destination: conversation.destination,
|
|
29793
29974
|
...conversation.visibility ? { visibility: conversation.visibility } : void 0
|
|
29794
|
-
}), conversation.updatedAtMs)
|
|
29975
|
+
}), conversation.updatedAtMs);
|
|
29976
|
+
const destinationId = upsertedDestination?.id ?? args.destinationId;
|
|
29977
|
+
const visibility = copiesRootVisibility(conversation) ? (await resolveRootVisibility(this.executor, conversation.parentConversationId ?? conversation.conversationId)).visibility : upsertedDestination?.visibility ?? null;
|
|
29795
29978
|
const location = locationForWrite({
|
|
29796
29979
|
destination: conversation.destination,
|
|
29797
29980
|
destinationId,
|
|
@@ -29804,7 +29987,12 @@ var SqlStore = class {
|
|
|
29804
29987
|
from junior_conversations parent
|
|
29805
29988
|
where parent.conversation_id = ${conversation.parentConversationId}
|
|
29806
29989
|
)` : conversation.conversationId;
|
|
29807
|
-
const
|
|
29990
|
+
const db = this.executor.db();
|
|
29991
|
+
const prior = db.$with("prior_conversation").as(db.select({
|
|
29992
|
+
actorIdentityId: juniorConversations.actorIdentityId,
|
|
29993
|
+
visibility: juniorConversations.visibility
|
|
29994
|
+
}).from(juniorConversations).where(eq(juniorConversations.conversationId, conversation.conversationId)));
|
|
29995
|
+
const row = (await db.with(prior).insert(juniorConversations).values({
|
|
29808
29996
|
conversationId: conversation.conversationId,
|
|
29809
29997
|
schemaVersion: 1,
|
|
29810
29998
|
source: conversation.source ?? null,
|
|
@@ -29829,7 +30017,8 @@ var SqlStore = class {
|
|
|
29829
30017
|
parentConversationId: conversation.parentConversationId ?? null,
|
|
29830
30018
|
kind: conversation.kind,
|
|
29831
30019
|
rootConversationId,
|
|
29832
|
-
spaceId: conversation.spaceId ?? null
|
|
30020
|
+
spaceId: conversation.spaceId ?? null,
|
|
30021
|
+
visibility
|
|
29833
30022
|
}).onConflictDoUpdate({
|
|
29834
30023
|
target: juniorConversations.conversationId,
|
|
29835
30024
|
set: {
|
|
@@ -29853,51 +30042,26 @@ var SqlStore = class {
|
|
|
29853
30042
|
rootConversationId: sql`coalesce(${juniorConversations.rootConversationId}, excluded.root_conversation_id)`,
|
|
29854
30043
|
kind: sql`coalesce(${juniorConversations.kind}, excluded.kind)`,
|
|
29855
30044
|
spaceId: sql`coalesce(${juniorConversations.spaceId}, excluded.space_id)`,
|
|
30045
|
+
visibility: sql`coalesce(${juniorConversations.visibility}, excluded.visibility)`,
|
|
29856
30046
|
detailVersion: nextDetailVersion
|
|
29857
30047
|
}
|
|
29858
30048
|
}).returning({
|
|
29859
30049
|
actorIdentityId: juniorConversations.actorIdentityId,
|
|
29860
30050
|
parentConversationId: juniorConversations.parentConversationId,
|
|
29861
|
-
rootConversationId: juniorConversations.rootConversationId
|
|
30051
|
+
rootConversationId: juniorConversations.rootConversationId,
|
|
30052
|
+
visibility: juniorConversations.visibility,
|
|
30053
|
+
filledVisibility: sql`exists (select 1 from ${prior} where ${prior.visibility} is null)`,
|
|
30054
|
+
setActor: sql`not exists (select 1 from ${prior} where ${prior.actorIdentityId} is not null)`
|
|
29862
30055
|
}))[0];
|
|
29863
30056
|
if (!row?.rootConversationId) throw new Error("Conversation parent is missing its persisted root");
|
|
30057
|
+
if (!copiesRootVisibility(conversation) && row.visibility && row.filledVisibility) await fillMissingTreeVisibility(this.executor, row.rootConversationId, row.visibility);
|
|
29864
30058
|
if (row.parentConversationId !== (conversation.parentConversationId ?? null)) throw new Error(`Conversation parent changed for ${conversation.conversationId}`);
|
|
29865
|
-
if (row.actorIdentityId && row.parentConversationId === null) await recordConversationParticipant(this.executor, {
|
|
30059
|
+
if (row.actorIdentityId && row.setActor && row.parentConversationId === null) await recordConversationParticipant(this.executor, {
|
|
29866
30060
|
actorIdentityId: row.actorIdentityId,
|
|
29867
30061
|
conversationId: conversation.conversationId,
|
|
29868
30062
|
atMs: conversation.lastActivityAtMs
|
|
29869
30063
|
});
|
|
29870
30064
|
}
|
|
29871
|
-
async upsertDestination(destination, nowMs) {
|
|
29872
|
-
if (!destination) return;
|
|
29873
|
-
const visibilityUpdate = destination.refreshVisibility ? sql`excluded.visibility` : juniorDestinations.visibility;
|
|
29874
|
-
return (await this.executor.db().insert(juniorDestinations).values({
|
|
29875
|
-
id: randomUUID(),
|
|
29876
|
-
provider: destination.provider,
|
|
29877
|
-
providerTenantId: tenantId(destination.providerTenantId),
|
|
29878
|
-
providerDestinationId: destination.providerDestinationId,
|
|
29879
|
-
kind: destination.kind,
|
|
29880
|
-
parentDestinationId: null,
|
|
29881
|
-
displayName: destination.displayName ?? null,
|
|
29882
|
-
visibility: destination.visibility,
|
|
29883
|
-
metadata: destination.metadata ?? null,
|
|
29884
|
-
createdAt: dateFromMs(nowMs),
|
|
29885
|
-
updatedAt: dateFromMs(nowMs)
|
|
29886
|
-
}).onConflictDoUpdate({
|
|
29887
|
-
target: [
|
|
29888
|
-
juniorDestinations.provider,
|
|
29889
|
-
juniorDestinations.providerTenantId,
|
|
29890
|
-
juniorDestinations.providerDestinationId
|
|
29891
|
-
],
|
|
29892
|
-
set: {
|
|
29893
|
-
kind: sql`excluded.kind`,
|
|
29894
|
-
displayName: sql`coalesce(excluded.display_name, ${juniorDestinations.displayName})`,
|
|
29895
|
-
visibility: visibilityUpdate,
|
|
29896
|
-
metadata: sql`coalesce(excluded.metadata_json, ${juniorDestinations.metadata})`,
|
|
29897
|
-
updatedAt: sql`excluded.updated_at`
|
|
29898
|
-
}
|
|
29899
|
-
}).returning({ id: juniorDestinations.id }))[0]?.id;
|
|
29900
|
-
}
|
|
29901
30065
|
};
|
|
29902
30066
|
/** Create a SQL-backed conversation store. */
|
|
29903
30067
|
function createSqlStore(executor) {
|
|
@@ -30530,7 +30694,7 @@ var SqlConversationMessageSearchStore = class {
|
|
|
30530
30694
|
isNull(juniorConversations.parentConversationId),
|
|
30531
30695
|
isNull(juniorConversations.transcriptPurgedAt),
|
|
30532
30696
|
ne(juniorConversations.conversationId, args.currentConversationId),
|
|
30533
|
-
|
|
30697
|
+
isPublicConversation(juniorConversations),
|
|
30534
30698
|
eq(juniorConversationEvents.type, "message"),
|
|
30535
30699
|
sql`${role} in ('user', 'assistant')`
|
|
30536
30700
|
];
|
|
@@ -31191,4 +31355,4 @@ async function closeDb() {
|
|
|
31191
31355
|
current = void 0;
|
|
31192
31356
|
await previous?.db.close();
|
|
31193
31357
|
}
|
|
31194
|
-
export { getPlugins as $, openSlackDirectMessage as $a, readViewerAvatarUrl as $c, getStateValues as $d, cacheKeyPrefix as $f, getVercelConversationWorkQueue as $i, automationSearchDocument as $l, deliverOAuthAuthorization as $n, existingConversationId as $o, patchMcpAuthSession as $r, clearInboxItemDeliveries as $s, eventIndexLockKey as $t, deliverWatch as $u, resolveRootConversationId as A, createPluginCache as Aa, inboxItemPlugin as Ac, sleep$1 as Ad, botConfig as Af, readConversationMetadata as Ai, conversationIdsWithParticipantUser as Al, renderToolResultNudge as An, parseDashboardPersonLink as Ao, pluginCatalogRuntime as Ar, treeAwaitsAuthorization as As, memoryDb as At, juniorArtifacts as Au, normalizeSlackStatusText as B, getDispatchTurnId as Ba, readInboxItemAgentScope as Bc, hasEventCatalogEntries as Bd, setBotName as Bf, generateImages as Bi, juniorTurns as Bl, invalidateReadySnapshot as Bn, saveEventAutomation as Bo, parseOAuthTokenResponse as Br, dismissOpenInboxItems as Bs, canMoveToSpace as Bt, workspaceSnapshotFinishedEvent as Bu, locationFromRow as C, userLookupIdentityProviders as Ca, canAgentChangeInboxItem as Cc, isDmChannel as Cd, slackBotIdSchema as Cf, createPluginModel as Ci, canReadConversation as Cl, getSlackToolContext as Cn, getDashboardLinkFilter as Co, bufferBody as Cp, createUserTokenStore as Cr, conversationStatusSql as Cs, closeReadReplyNotice as Ct, juniorSpaces as Cu, claimProviderConversation as D, buildNonInteractiveShellScript as Da, inboxItemForUser as Dc, runWithSlackInstallationToken as Dd, parseSlackMessageTs as Df, renderPluginConversationEvent as Di, readConversationAccessRows as Dl, RESOURCE_WATCH_TOOL_SOURCE as Dn, getDashboardTaskLink as Do, resolveSandboxCommandEnvironment as Dr, conversationKindFromRow as Ds, contentVersion as Dt, juniorUsers as Du, locationSchema as E, buildCommandScript as Ea, canUserReadInboxItem as Ec, readPrivateSlackFile as Ed, slackUserIdSchema as Ef, createPluginConversationEvents as Ei, readConversationAccessFromSql as El, RESOURCE_SUBSCRIPTION_MAX_TTL_MS as En, getDashboardSettingsLink as Eo, setConfigDefaults as Ep, buildSandboxEgressNetworkPolicy as Er, executionIsActive as Es, REVALIDATED_READ_PATHS as Et, slackPersonSearchDocument as Eu, SLACK_USER_MENTION_RE as F, createOrGetDispatch as Fa, isAutomationAlertItem as Fc, automationEventCatalog as Fd, getSlackClientSecret as Ff, embedConversationQuery as Fi, rootSpaceReadableBy as Fl, listWorkspaces as Fn, deleteEventAutomation as Fo, serviceAccountAllows as Fr, generateShortTitle as Fs, prefixMatch as Ft, slackChannelMessageReplyThreadTs as Fu, applyPluginFormatMarkdown as G, markDispatchBlocked as Ga, automationCreatorUserId as Gc, requireEventIdentifier as Gd, toPiReasoningLevel as Gf, agentsInstructionsUpdatedEvent as Gi, juniorStats as Gl, hash as Gn, automationVersionOf as Go, PluginMcpClient as Gr, insertInboxItem as Gs, isTopLevel as Gt, publishAgentUpdate as Gu, slackMentionedUserIds as H, isTerminalDispatchStatus as Ha, requireInboxItemLinks as Hc, registeredEventTriggerProblems as Hd, setSlackReactionConfig as Hf, transcribeFromUrl as Hi, juniorTodos as Hl, setWorkspaceSnapshot as Hn, admitEventAutomationRun as Ho, createMcpServiceAccountClientProvider as Hr, getOpenInboxItemByDedupeKey as Hs, dispatchInstructionsInvokeSkills as Ht, AGENT_RESOURCE_TYPE as Hu, escapeSlackMrkdwnText as I, getDispatchConversationId as Ia, isInboxItemForEveryone as Ic, describeRegisteredEventTrigger as Id, getSlackSigningSecret as If, storeConversationEmbedding as Ii, rootVisibleToViewer as Il, listWorkspacesByRepository as In, findMatchingEventAutomations as Io, serviceAccountOnly as Ir, resolveTaskTitle as Is, prefixRank as It, slackChannelMessageRunsAutomation as Iu, getPluginApiRoutes as J, markDispatchRunning as Ja, findUserByEmail as Jc, isToolInputError as Jd, GEN_AI_SERVER_ADDRESS as Jf, renderJuniorNativeConversationEvent as Ji, juniorInboxItemAssignees as Jl, ensureDockerDaemon as Jn, sameDefinitionValue as Jo, deleteMcpServerSessionId as Jr, ownerConversationId as Js, promptModeTurnTools as Jt, cancelSubscriptions as Ju, createPluginEventPublisher as K, markDispatchCompleted as Ka, resolveAssignee as Kc, requireValidEventTrigger as Kd, normalizeSlackEmojiName as Kf, authenticationLinkedEvent as Ki, inboxItemFuzzyTitle as Kl, isStale as Kn, listAutomationVersions as Ko, deleteMcpAuthSession as Kr, isInboxItemOpen as Ks, messagesNeedSpaceMembership as Kt, starterWatchId as Ku, formatSlackLink as L, getDispatchIdForConversation as La, isOnlyAssignee as Lc, eventGuidance as Ld, resetRuntimeConfig as Lf, completeDecision as Li, viewerMarksFromParticipant as Ll, updateWorkspace as Ln, getEventAutomation as Lo, serviceAccountPlugins as Lr, INBOX_ITEM_REPLIED_REASON as Ls, rankSearchMatches as Lt, slackChannelMessageTrigger as Lu, conversationSlackTenantId as M, buildDispatchId as Ma, inboxItemReaderForUserInConversation as Mc, runWithWorkspaceTeamId as Md, getRuntimeMetadata as Mf, resolveRootVisibility as Mi, conversationIsNotUnsubscribedRoot as Ml, deleteWorkspace as Mn, blockEventAutomation as Mo, disconnectServiceAccount as Mr, AUTOMATION_ALERT_STEP_FIELD_ID as Ms, parseTypedQuery as Mt, SLACK_EVENT_NAMESPACE as Mu, loadConversationSlackTenantIds as N, claimDispatchMailboxAppend as Na, inboxItemTodo as Nc, updateTimerIndex as Nd, getSlackBotToken as Nf, backfillConversationEmbeddings as Ni, conversationPinnedForUser as Nl, getWorkspace as Nn, collectEventAutomationMatchKeys as No, finishServiceAccountSignIn as Nr, syncAutomationAlerts as Ns, fuzzyMatch as Nt, requireSlackChannelMessageScope as Nu, getConversationIdByProviderConversation as O, runNonInteractiveCommand as Oa, inboxItemNeedsInput as Oc, streamPrivateSlackFile as Od, slackMessageTsFromMs as Of, searchConversations as Oi, readPrivateSpaceMemberships as Ol, STOP_WATCHING_TOOL_NAME as On, isDashboardLink as Oo, resolveSandboxEgressProviderForHost as Or, awaitsAuthorizationFrom as Os, contentVersionHeaders as Ot, juniorDestinations as Ou, parseSessionSource as P, confirmDispatchMailboxAppend as Pa, inboxItemVisibleTo as Pc, CORE_EVENT_NAMESPACE as Pd, getSlackClientId as Pf, createConversationEmbedder as Pi, readMemberParticipants as Pl, getWorkspaceByName as Pn, createEventAutomation as Po, getServiceAccountStatus as Pr, fallbackShortTitle as Ps, fuzzyRank as Pt, slackChannelMessageEvent as Pu, getPluginUserPromptContributions as Q, getSlackMessagePermalink as Qa, readIdentityById as Qc, getStateAdapter as Qd, saveEnabledProviders as Qf, createPluginInboxItems as Qi, automationFuzzyTitle as Ql, proxyVercelSandboxEgressRequest as Qn, emptyAutomationRunWindows as Qo, getMcpStoredOAuthCredentials as Qr, claimInboxItemPush as Qs, embedConversationEvents as Qt, createWatch as Qu, isTableRow as R, getDispatchInputMessageId as Ra, isPluginInboxItem as Rc, eventNamespaceSchema as Rd, restoreRuntimeConfig as Rf, completeObject as Ri, juniorTurnOutbox as Rl, WorkspaceValidationError as Rn, listDeletedEventAutomationsCreatedBy as Ro, startServiceAccountSignIn as Rr, closeInboxItem as Rs, scoredSearchMatches as Rt, WORKSPACE_SNAPSHOT_FAILED_EVENT as Ru, withConversationMutationLock as S, lookupSlackUserProfile as Sa, canActOnInboxItem as Sc, isConversationScopedChannel as Sd, parseSlackUserId as Sf, createPluginEmbedder as Si, canAddConversationMessages as Sl, resolveChannelCapabilities as Sn, getDashboardInboxItemSnoozeLink as So, getGatewayApiKey as Sp, sandboxEgressSignalsResponseSchema as Sr, conversationIsActiveSql as Ss, isPausedBySlack as St, juniorSpaceMembers as Su, startLocationThread as T, pluginConfigValues as Ta, canReadInboxItem as Tc, normalizeSlackConversationId as Td, slackTeamIdSchema as Tf, createPluginTurnEventReader as Ti, createConversationAccessReader as Tl, RESOURCE_SUBSCRIPTION_DEFAULT_TTL_MS as Tn, getDashboardPersonLink as To, getConfigDefaults as Tp, credentialAuditSource as Tr, conversationWaitsOnUserSql as Ts, setMemoryConfig as Tt, slackPersonPredicate as Tu, wrapBareSlackUserIds as U, listPendingDispatchMailboxAppends as Ua, EVERYONE_ASSIGNEE as Uc, registeredEventTypeSchema as Ud, snapshotRuntimeConfig as Uf, NoAudioError as Ui, todoFuzzyTitle as Ul, setWorkspaceSnapshotBuild as Un, eventAutomationRunLimitReason as Uo, getMcpServiceAccountCredentials as Ur, inboxItemNeedsUserNow as Us, hasConversationMetadata as Ut, agentWatch as Uu, slackMention as V, getPluginDispatchProjection as Va, requireInboxItemAssignees as Vc, registeredEventMatchSchema as Vd, setRuntimeLimits as Vf, searchWeb as Vi, juniorTodoVersionSeq as Vl, loadSnapshotsForProfile as Vn, setEventAutomationStatus as Vo, hasRequiredOAuthScope as Vr, getInboxItem as Vs, deliversFinalText as Vt, workspaceSnapshotWatch as Vu, agent_hooks_exports as W, markDispatchAwaitingResume as Wa, activeParticipantUserIds as Wc, registeredResourceTypeSchema as Wd, TURN_REASONING_LEVELS as Wf, JUNIOR_NATIVE_EVENT_NAMESPACE as Wi, todoSearchDocument as Wl, create as Wn, automationDefinition as Wo, McpAuthorizationRequiredError as Wr, inboxItemsNeedingUserVersionQuery as Ws, isPersonInput as Wt, isAgentResourceType as Wu, getPluginSlackConversationLink as X, addReactionToMessage as Xa, readActorIdentity as Xc, disconnectStateAdapter as Xd, readEnabledProviders as Xf, createPluginConversationChanges as Xi, juniorInboxItemSlackCards as Xl, isRetryableSandboxFailure as Xn, automationRevision as Xo, getMcpAuthSession as Xr, takeInboxItem as Xs, watcherStartedConversation as Xt, collectEventMatchKeys as Xu, getPluginRoutes as Y, notifyAutomationBlocked as Ya, listAdminUsersFromSql as Yc, JUNIOR_THREAD_STATE_TTL_MS as Yd, resolveGatewayModel as Yf, saveObjectAnnotations as Yi, juniorInboxItemConversations as Yl, getSandboxProvider as Yn, AutomationConflictError as Yo, deleteMcpStoredOAuthCredentials as Yr, searchInboxItems as Ys, turnBehavior as Yt, cancelWatch as Yu, getPluginTools as Z, deleteSlackMessage as Za, readActorIdentityFromSql as Zc, getDefaultRedisStateAdapterFor as Zd, readServedProviders as Zf, PLUGIN_CHOICE_FIELD_ID as Zi, juniorInboxItems as Zl, isVercelSandboxEgressRequest as Zn, requireAutomationRevision as Zo, getMcpServerSessionId as Zr, updateInboxItemContent as Zs, EVENT_INDEX_LOCK_TTL_MS as Zt, createTimerWatch as Zu, readConversationTrees as _, isSlackUserNotFound as _a, touchConversationDetail as _c, SlackActionError as _d, requireSlackDestination as _f, normalizeSandboxEgressTracePropagationDomains as _i, findUserByVerifiedEmails as _l, pluginTaskParamsSchema as _n, saveScheduledAutomationInLock as _o, findProviderError as _p, consumeSandboxEgressAuthRequiredSignal as _r, usdToMicroUsd as _s, listPushSubscriptions as _t, juniorAttachmentUploads as _u, getDb as a, QUEUE_SIGNATURE_MAX_AGE_MS as aa, clearInboxWakeReasons as ac, takeDueTimerWatches as ad, credentialUserSubjectId as af, McpProviderError as ai, parseAvatarUrl as al, SEARCHABLE_EVENT_TYPES as an, updateSlackMessage as ao, requestPrefixAttributes as ap, findInErrorChain as ar, readAutomationRowStats as as, publishImage as at, juniorConversationParticipants as au, userMessageQueries as b, lookupActiveSlackWorkspaceMember as ba, RESERVED_INBOX_ITEM_KEY_PREFIXES as bc, getHeaderString as bd, parseSlackChannelReferenceId as bf, workspaceRepoCheckoutPath as bi, readCachedUserByEmail as bl, getTurnRequestDeadline as bn, getDashboardConversationLink as bo, isProviderRefusal as bp, parseSandboxEgressCredentialToken as br, conversationRangeColumns as bs, savePushSubscription as bt, juniorConversations as bu, pendingMigrations as c, getQueueProvider as ca, inboxItemSnoozedBy as cc, bindScheduledAutomationCredentialSubject as cd, createSlackResumeActor as cf, getMcpAwareErrorType as ci, userAvatarUrlsFromIdentities as cl, excerptTerms as cn, slackEntitySchema as co, estimateTextTokens as cp, throwSandboxOperationError as cr, recordAutomationExecution as cs, unpublishedArtifactHeaders as ct, juniorConversationEmbeddings as cu, eventFromRow as d, listConversationAnnotationsById as da, settleInboxSnoozes as dc, verifyScheduledAutomationCredentialSubject as dd, parseActorUserId as df, toMcpProviderError as di, resolveActorIdentityId as dl, isEventEmbeddingsEnabled as dn, createScheduledAutomation as do, COMPACTION_SUMMARY_PREFIX as dp, getWorkspaceSnapshotNotReadyError as dr, agentTurnCostUsd as ds, readWebPushConfig as dt, juniorApiTokens as du, verifyConversationQueueMessage as ea, deleteInboxItemDeliveries as ec, findMatchingWatches as ed, setStateValues as ef, putMcpAuthSession as ei, resolveViewerUser as el, indexEndedTurnEvents as en, openSlackModal as eo, createCache as ep, formatProviderLabel as er, readAutomationExecutionByConversationId as es, getRegistrations as et, juniorAutomations as eu, copyMessageLinks as f, defaultTimezone as fa, snoozeInboxItems as fc, verifySlackDirectCredentialSubject as fd, parseStoredSlackActor as ff, OAuthProviderError as fi, saveActorAvatar as fl, setEventEmbeddingsConfig as fn, deleteScheduledAutomation as fo, hasCompactedConversationContext as fp, isWorkspaceSnapshotNotReadyError as fr, agentTurnUsageSchema as fs, sendPushNotificationToUser as ft, juniorConversationAnnotations as fu, conversationDescendants as g, lookupSlackUserNames as ga, nextDetailVersion as gc, readSignInSecret as gd, parseDestination as gf, parsePluginManifest as gi, findSlackUserByPrimaryEmail as gl, pluginTaskId as gn, saveScheduledAutomation as go, createProviderError as gp, clearSandboxEgressSignals as gr, microUsdToUsd as gs, deletePushSubscription as gt, juniorCodeRepositories as gu, conversationAncestors as h, lookupSlackUser as ha, conversationDetailTouch as hc, readSchedulerSecret as hd, createSlackDestination as hf, parseInlinePluginManifest as hi, findLinkedSlackUser as hl, createVercelPluginTaskCallback as hn, readScheduledAutomation as ho, createAssistantProviderError as hp, SANDBOX_EGRESS_AUTH_REQUIRED_MARKER as hr, microUsdSql as hs, resolveNotificationTimezone as ht, juniorCodeChanges as hu, getConversationStore as i, nudgeIdempotencyKey as ia, SNOOZE_TIMER_EVENT_TYPE as ic, listWatches as id, credentialSubjectSchema as if, resolvePluginHeaderEnvRefs as ii, identityAvatarUrl as il, storeConversationEventLexemes as in, unfurlSlackLinks as io, withLock as ip, SandboxCallTimeoutError as ir, readAutomationExecutions as is, publicArtifactHeaders as it, juniorConversationReadPositions as iu, rootConversationIsArchived as j, readConversationAutomationRun as ja, inboxItemReaderForUser as jc, getWorkspaceTeamId as jd, getChatConfig as jf, writeConversationMetadata as ji, conversationIsMemberRoot as jl, createWorkspace as jn, setDashboardConversationLinkOptions as jo, createPluginCatalogRuntime as jr, AUTOMATION_ALERT_STEPS as js, searchTypedMemories as jt, getEventCatalog as ju, readMentionedUserIds as k, resolvePluginOAuthAccount as ka, inboxItemOwnedByConversation as kc, withSlackRetries as kd, slackMessageTsSchema as kf, conversationSearchVector as ki, readableSlackTeamId as kl, createPluginState as kn, parseDashboardConversationLink as ko, catalog_runtime_exports as kr, hasUnexpiredAuthorizationRequest as ks, revalidateContent as kt, guardedCosineDistance as ku, readMigrationRecords as l, createPluginAnnotations as la, listFiringInboxSnoozeTriggers as lc, bindSlackDirectCredentialSubject as ld, isActorUserId as lf, getMcpAwareTelemetryMessage as li, userAvatarUrlsFromJoinedPhotos as ll, storedMessageJson as ln, slackExternalRefIdSchema as lo, textCharsForTokens as lp, wrapSandboxSetupError as lr, refreshAutomationLastRun as ls, apiRoutePrefix as lt, juniorConversationMetrics as lu, withConversationEventLock as m, resolveUserTimezone as ma, unsnoozeInboxRow as mc, readJuniorSecret as md, truncateStatusText as mf, getOAuthProviderErrorAttributes as mi, deleteProviderIdentityForUser as ml, startedTaskDefinition as mn, parseScheduledAutomationRow as mo, ProviderError as mp, executeCredentialedEgressRequest as mr, conversationCostOf as ms, readNotificationPause as mt, codeRepositorySearchDocument as mu, getConversationEventStore as n, conversationQueueMessageSchema as na, recordInboxItemSlackCard as nc, isQuietEvent as nd, credentialContextForActor as nf, putMcpStoredOAuthCredentials as ni, updateViewerDisplayName as nl, searchedEventTextSql as nn, postSlackMessage as no, acquireActiveLock as np, resolveBaseUrl as nr, readAutomationExecutionStatusHours as ns, setPlugins as nt, juniorLocationConfigurations as nu, getSqlExecutor as o, signQueueMessage as oa, deleteExpiredInboxSnoozes as oc, turnEvents as od, createActor as of, McpServiceAccountRequiredError as oi, readAvatarFetch as ol, callsToolSql as on, uploadFilesToConversation as oo, estimateMessagesTokens as op, isAbortError as or, readAutomationRuns as os, readPublicArtifact as ot, juniorConversationEventLexemes as ou, deleteMessageLinks as p, findActorTimezone as pa, snoozeTimerTrigger as pc, verifyTimerWatchCredentialSubject as pd, toStoredSlackActor as pf, fetchWithBoundedOAuthErrorBodies as pi, deleteProviderIdentityForSlackUser as pl, createPluginTaskStarter as pn, listScheduledAutomationsForTeam as po, isCompactionSummaryText as pp, workspaceSnapshotNotReadyUserMessage as pr, hasAgentTurnUsage as ps, notificationPreview as pt, codeChangeSearchDocument as pu, createPluginHookRunner as q, markDispatchFailed as qa, resolveAssignees as qc, ToolInputError as qd, GEN_AI_PROVIDER_NAME as qf, conversationNoteEvent as qi, inboxItemSearchDocument as ql, CURL_DOWNLOAD_ARGS as qn, readAutomationVersion as qo, deleteMcpAuthSessionsForUserProvider as qr, listReplyActionItems as qs, postsRunNotices as qt, updateEventKey as qu, getConversationMessageSearchStore as r, isConversationQueueMessageRejectedError as ra, recordRepeatInboxItemPush as rc, listConversationsWithWatches as rd, credentialContextSchema as rf, webActorUserIds as ri, hasUserPhoto as rl, seqIn as rn, removeReactionFromMessage as ro, fenceLock as rp, startOAuthFlow as rr, readAutomationExecutionSummaries as rs, validatePlugins as rt, juniorAgentBindings as ru, createJuniorSqlExecutor as s, verifyQueueMessage as sa, inboxItemInRow as sc, bindEventAutomationCredentialSubject as sd, createSlackActor as sf, McpToolError as si, readUserAvatarUrls as sl, eventExcerpt as sn, fitsSlackMetadataLimit as so, estimateRequestOverheadTokens as sp, isAlreadyExistsError as sr, readAutomationTitlesByConversationId as ss, unpublishArtifact as st, juniorConversationEventEmbeddings as su, db_exports as t, ConversationQueueMessageRejectedError as ta, listInboxItemPushUserIds as tc, getWatch as td, actorLogContext as tf, putMcpServerSessionId as ti, setUserAdminFromSql as tl, lexemesSql as tn, postSlackEphemeralMessage as to, MUTATION_LOCK_TTL_MS as tp, parseOAuthStatePayload as tr, readAutomationExecutionStatusDays as ts, getStaticPluginToolDefinitions as tt, juniorAutomationRuns as tu, createSqlConversationEventStore as u, listConversationAnnotations as ua, readViewerInboxSnoozes as uc, verifyEventAutomationCredentialSubject as ud, isUserActor as uf, getMcpProviderErrorAttributes as ui, SYSTEM_IDENTITY_ID as ul, event_embedding_config_exports as un, blockScheduledAutomation as uo, gatewayRoutingAttributes as up, WorkspaceSnapshotNotReadyError as ur, addAgentTurnUsage as us, coreRegistrations as ut, juniorConversationEvents as uu, setArchivedAt as v, looksLikeEmail as va, PLUGIN_INBOX_ITEM_KEY_PREFIX as vc, downloadPrivateSlackFile as vd, sameDestination as vf, SANDBOX_RUNTIME as vi, recordGoogleSignIn as vl, sendVercelPluginTask as vn, scheduledRunId as vo, getProviderErrorAttributes as vp, consumeSandboxEgressPermissionDeniedSignal as vr, usdToMicroUsdUnbiased as vs, readNotificationSchedule as vt, juniorAttachments as vu, setFirstConversationLocation as w, basePluginContext as wa, canAnswerInboxItem as wc, isSlackRequestTimeout as wd, slackChannelIdSchema as wf, createPluginModelCostRecorder as wi, conversationAccessFromRows as wl, createPluginConversationWatches as wn, getDashboardObjectIconLink as wo, getAttachmentStorage as wp, credentialAuditAttributes as wr, conversationTurnFailedSql as ws, projectConversationMessages as wt, juniorIdentities as wu, createSqlStore as x, lookupSlackBot as xa, TODO_INBOX_ITEM_KEY_PREFIX as xc, getSlackClient as xd, parseSlackTeamId as xf, PluginToolDeniedError as xi, canAccessConversation as xl, createPluginCodeChanges as xn, getDashboardInboxItemLink as xo, isProviderRetryError as xp, parseSandboxEgressAuthRequiredSignal as xr, conversationUsageCostExpr as xs, isActiveInSlack as xt, juniorSpaceConfigurations as xu, lastMessageAtSql as y, lookupUsers as ya, REPLY_NOTICE_KEY_PREFIX as yc, getFilePermalink as yd, parseSlackChannelId as yf, tryWorkspaceRepoCheckoutPath as yi, upsertLinkedIdentity as yl, queueCallback as yn, withScheduledAutomationLock as yo, getProviderErrorUserMessage as yp, createSandboxEgressCredentialToken as yr, conversationAggregateColumns as ys, saveNotificationSchedule as yt, juniorMessageAttachments as yu, normalizeSlackReplyMarkdown as z, getDispatchRecord as za, itemNeedsUser as zc, eventWatchUnavailable as zd, setBotModelConfig as zf, completeText as zi, juniorTurnInbox as zl, isPostgresErrorCode as zn, parseEventAutomationRow as zo, buildOAuthTokenRequest as zr, countInboxItemsNeedingUserBySubject as zs, fuseRankedLists as zt, WORKSPACE_SNAPSHOT_READY_EVENT as zu };
|
|
31358
|
+
export { getPlugins as $, openSlackDirectMessage as $a, updateViewerDisplayName as $c, JUNIOR_THREAD_STATE_TTL_MS as $d, resolveGatewayModel as $f, getVercelConversationWorkQueue as $i, juniorInboxItemAssignees as $l, proxyVercelSandboxEgressRequest as $n, existingConversationId as $o, getMcpStoredOAuthCredentials as $r, clearInboxItemDeliveries as $s, embedConversationEvents as $t, cancelWatch as $u, resolveRootConversationId as A, createPluginCache as Aa, inboxItemTodo as Ac, readPrivateSlackFile as Ad, slackUserIdSchema as Af, conversationSearchVector as Ai, conversationIsMemberRoot as Al, createPluginState as An, parseDashboardPersonLink as Ao, getAttachmentStorage as Ap, catalog_runtime_exports as Ar, treeAwaitsAuthorization as As, memoryDb as At, slackPersonPredicate as Au, normalizeSlackStatusText as B, getDispatchTurnId as Ba, EVERYONE_ASSIGNEE as Bc, describeRegisteredEventTrigger as Bd, getSlackSigningSecret as Bf, generateImages as Bi, conversationDetailTouch as Bl, isPostgresErrorCode as Bn, saveEventAutomation as Bo, buildOAuthTokenRequest as Br, dismissOpenInboxItems as Bs, canMoveToSpace as Bt, slackChannelMessageReplyThreadTs as Bu, locationFromRow as C, userLookupIdentityProviders as Ca, canUserReadInboxItem as Cc, getFilePermalink as Cd, parseSlackChannelId as Cf, createPluginEmbedder as Ci, createConversationAccessReader as Cl, resolveChannelCapabilities as Cn, getDashboardLinkFilter as Co, findProviderError as Cp, sandboxEgressSignalsResponseSchema as Cr, conversationStatusSql as Cs, closeReadReplyNotice as Ct, juniorAttachments as Cu, claimProviderConversation as D, buildNonInteractiveShellScript as Da, inboxItemPlugin as Dc, isDmChannel as Dd, slackBotIdSchema as Df, createPluginConversationEvents as Di, readPrivateSpaceMemberships as Dl, RESOURCE_SUBSCRIPTION_MAX_TTL_MS as Dn, getDashboardTaskLink as Do, isProviderRetryError as Dp, buildSandboxEgressNetworkPolicy as Dr, conversationKindFromRow as Ds, contentVersion as Dt, juniorSpaceMembers as Du, locationSchema as E, buildCommandScript as Ea, inboxItemOwnedByConversation as Ec, isConversationScopedChannel as Ed, parseSlackUserId as Ef, createPluginTurnEventReader as Ei, readConversationAccessRows as El, RESOURCE_SUBSCRIPTION_DEFAULT_TTL_MS as En, getDashboardSettingsLink as Eo, isProviderRefusal as Ep, credentialAuditSource as Er, executionIsActive as Es, REVALIDATED_READ_PATHS as Et, juniorSpaceConfigurations as Eu, SLACK_USER_MENTION_RE as F, createOrGetDispatch as Fa, isPluginInboxItem as Fc, getWorkspaceTeamId as Fd, getChatConfig as Ff, embedConversationQuery as Fi, rootVisibleToViewer as Fl, getWorkspaceByName as Fn, deleteEventAutomation as Fo, getServiceAccountStatus as Fr, generateShortTitle as Fs, prefixMatch as Ft, juniorArtifacts as Fu, applyPluginFormatMarkdown as G, markDispatchBlocked as Ga, findUserByEmail as Gc, registeredEventMatchSchema as Gd, setRuntimeLimits as Gf, agentsInstructionsUpdatedEvent as Gi, juniorTurns as Gl, create as Gn, automationVersionOf as Go, McpAuthorizationRequiredError as Gr, insertInboxItem as Gs, isThread as Gt, workspaceSnapshotFinishedEvent as Gu, slackMentionedUserIds as H, isTerminalDispatchStatus as Ha, automationCreatorUserId as Hc, eventNamespaceSchema as Hd, restoreRuntimeConfig as Hf, transcribeFromUrl as Hi, touchConversationDetail as Hl, loadSnapshotsForProfile as Hn, admitEventAutomationRun as Ho, hasRequiredOAuthScope as Hr, getOpenInboxItemByDedupeKey as Hs, dispatchInstructionsInvokeSkills as Ht, slackChannelMessageTrigger as Hu, escapeSlackMrkdwnText as I, getDispatchConversationId as Ia, itemNeedsUser as Ic, runWithWorkspaceTeamId as Id, getRuntimeMetadata as If, storeConversationEmbedding as Ii, viewerMarksFromParticipant as Il, listWorkspaces as In, findMatchingEventAutomations as Io, serviceAccountAllows as Ir, resolveTaskTitle as Is, prefixRank as It, getEventCatalog as Iu, getPluginApiRoutes as J, markDispatchRunning as Ja, readActorIdentityFromSql as Jc, registeredResourceTypeSchema as Jd, TURN_REASONING_LEVELS as Jf, renderJuniorNativeConversationEvent as Ji, todoFuzzyTitle as Jl, CURL_DOWNLOAD_ARGS as Jn, sameDefinitionValue as Jo, deleteMcpAuthSessionsForUserProvider as Jr, ownerConversationId as Js, postsRunNotices as Jt, agentWatch as Ju, createPluginEventPublisher as K, markDispatchCompleted as Ka, listAdminUsersFromSql as Kc, registeredEventTriggerProblems as Kd, setSlackReactionConfig as Kf, authenticationLinkedEvent as Ki, juniorTodoVersionSeq as Kl, hash as Kn, listAutomationVersions as Ko, PluginMcpClient as Kr, isInboxItemOpen as Ks, isTopLevel as Kt, workspaceSnapshotWatch as Ku, formatSlackLink as L, getDispatchIdForConversation as La, readInboxItemAgentScope as Lc, updateTimerIndex as Ld, getSlackBotToken as Lf, completeDecision as Li, isPublicConversation as Ll, listWorkspacesByRepository as Ln, getEventAutomation as Lo, serviceAccountOnly as Lr, INBOX_ITEM_REPLIED_REASON as Ls, rankSearchMatches as Lt, SLACK_EVENT_NAMESPACE as Lu, conversationSlackTenantId as M, buildDispatchId as Ma, isAutomationAlertItem as Mc, streamPrivateSlackFile as Md, slackMessageTsFromMs as Mf, writeConversationMetadata as Mi, conversationPinnedForUser as Ml, createWorkspace as Mn, blockEventAutomation as Mo, setConfigDefaults as Mp, createPluginCatalogRuntime as Mr, AUTOMATION_ALERT_STEP_FIELD_ID as Ms, parseTypedQuery as Mt, juniorUsers as Mu, loadConversationSlackTenantIds as N, claimDispatchMailboxAppend as Na, isInboxItemForEveryone as Nc, withSlackRetries as Nd, slackMessageTsSchema as Nf, backfillConversationEmbeddings as Ni, readMemberParticipants as Nl, deleteWorkspace as Nn, collectEventAutomationMatchKeys as No, disconnectServiceAccount as Nr, syncAutomationAlerts as Ns, fuzzyMatch as Nt, juniorDestinations as Nu, getConversationIdByProviderConversation as O, runNonInteractiveCommand as Oa, inboxItemReaderForUser as Oc, isSlackRequestTimeout as Od, slackChannelIdSchema as Of, renderPluginConversationEvent as Oi, readableSlackTeamId as Ol, RESOURCE_WATCH_TOOL_SOURCE as On, isDashboardLink as Oo, getGatewayApiKey as Op, resolveSandboxCommandEnvironment as Or, awaitsAuthorizationFrom as Os, contentVersionHeaders as Ot, juniorSpaces as Ou, parseSessionSource as P, confirmDispatchMailboxAppend as Pa, isOnlyAssignee as Pc, sleep$1 as Pd, botConfig as Pf, createConversationEmbedder as Pi, rootSpaceReadableBy as Pl, getWorkspace as Pn, createEventAutomation as Po, finishServiceAccountSignIn as Pr, fallbackShortTitle as Ps, fuzzyRank as Pt, guardedCosineDistance as Pu, getPluginUserPromptContributions as Q, getSlackMessagePermalink as Qa, setUserAdminFromSql as Qc, isToolInputError as Qd, GEN_AI_SERVER_ADDRESS as Qf, createPluginInboxItems as Qi, inboxItemSearchDocument as Ql, isVercelSandboxEgressRequest as Qn, emptyAutomationRunWindows as Qo, getMcpServerSessionId as Qr, claimInboxItemPush as Qs, EVENT_INDEX_LOCK_TTL_MS as Qt, cancelSubscriptions as Qu, isTableRow as R, getDispatchInputMessageId as Ra, requireInboxItemAssignees as Rc, CORE_EVENT_NAMESPACE as Rd, getSlackClientId as Rf, completeObject as Ri, resolveRootVisibility as Rl, updateWorkspace as Rn, listDeletedEventAutomationsCreatedBy as Ro, serviceAccountPlugins as Rr, closeInboxItem as Rs, scoredSearchMatches as Rt, requireSlackChannelMessageScope as Ru, withConversationMutationLock as S, lookupSlackUserProfile as Sa, canReadInboxItem as Sc, downloadPrivateSlackFile as Sd, sameDestination as Sf, PluginToolDeniedError as Si, conversationAccessFromRows as Sl, createPluginCodeChanges as Sn, getDashboardInboxItemSnoozeLink as So, createProviderError as Sp, parseSandboxEgressAuthRequiredSignal as Sr, conversationIsActiveSql as Ss, isPausedBySlack as St, juniorAttachmentUploads as Su, startLocationThread as T, pluginConfigValues as Ta, inboxItemNeedsInput as Tc, getSlackClient as Td, parseSlackTeamId as Tf, createPluginModelCostRecorder as Ti, readConversationAccessFromSql as Tl, createPluginConversationWatches as Tn, getDashboardPersonLink as To, getProviderErrorUserMessage as Tp, credentialAuditAttributes as Tr, conversationWaitsOnUserSql as Ts, setMemoryConfig as Tt, juniorConversations as Tu, wrapBareSlackUserIds as U, listPendingDispatchMailboxAppends as Ua, resolveAssignee as Uc, eventWatchUnavailable as Ud, setBotModelConfig as Uf, NoAudioError as Ui, juniorTurnOutbox as Ul, setWorkspaceSnapshot as Un, eventAutomationRunLimitReason as Uo, createMcpServiceAccountClientProvider as Ur, inboxItemNeedsUserNow as Us, hasConversationMetadata as Ut, WORKSPACE_SNAPSHOT_FAILED_EVENT as Uu, slackMention as V, getPluginDispatchProjection as Va, activeParticipantUserIds as Vc, eventGuidance as Vd, resetRuntimeConfig as Vf, searchWeb as Vi, nextDetailVersion as Vl, invalidateReadySnapshot as Vn, setEventAutomationStatus as Vo, parseOAuthTokenResponse as Vr, getInboxItem as Vs, deliversFinalText as Vt, slackChannelMessageRunsAutomation as Vu, agent_hooks_exports as W, markDispatchAwaitingResume as Wa, resolveAssignees as Wc, hasEventCatalogEntries as Wd, setBotName as Wf, JUNIOR_NATIVE_EVENT_NAMESPACE as Wi, juniorTurnInbox as Wl, setWorkspaceSnapshotBuild as Wn, automationDefinition as Wo, getMcpServiceAccountCredentials as Wr, inboxItemsNeedingUserVersionQuery as Ws, isPersonInput as Wt, WORKSPACE_SNAPSHOT_READY_EVENT as Wu, getPluginSlackConversationLink as X, addReactionToMessage as Xa, readViewerAvatarUrl as Xc, requireValidEventTrigger as Xd, normalizeSlackEmojiName as Xf, createPluginConversationChanges as Xi, juniorStats as Xl, getSandboxProvider as Xn, automationRevision as Xo, deleteMcpStoredOAuthCredentials as Xr, takeInboxItem as Xs, turnBehavior as Xt, publishAgentUpdate as Xu, getPluginRoutes as Y, notifyAutomationBlocked as Ya, readIdentityById as Yc, requireEventIdentifier as Yd, toPiReasoningLevel as Yf, saveObjectAnnotations as Yi, todoSearchDocument as Yl, ensureDockerDaemon as Yn, AutomationConflictError as Yo, deleteMcpServerSessionId as Yr, searchInboxItems as Ys, promptModeTurnTools as Yt, isAgentResourceType as Yu, getPluginTools as Z, deleteSlackMessage as Za, resolveViewerUser as Zc, ToolInputError as Zd, GEN_AI_PROVIDER_NAME as Zf, PLUGIN_CHOICE_FIELD_ID as Zi, inboxItemFuzzyTitle as Zl, isRetryableSandboxFailure as Zn, requireAutomationRevision as Zo, getMcpAuthSession as Zr, updateInboxItemContent as Zs, watcherStartedConversation as Zt, starterWatchId as Zu, readConversationTrees as _, isSlackUserNotFound as _a, RESERVED_INBOX_ITEM_KEY_PREFIXES as _c, verifyTimerWatchCredentialSubject as _d, toStoredSlackActor as _f, parsePluginManifest as _i, readCachedUserByEmail as _l, pluginTaskId as _n, saveScheduledAutomationInLock as _o, COMPACTION_SUMMARY_PREFIX as _p, clearSandboxEgressSignals as _r, usdToMicroUsd as _s, listPushSubscriptions as _t, juniorConversationAnnotations as _u, getDb as a, QUEUE_SIGNATURE_MAX_AGE_MS as aa, clearInboxWakeReasons as ac, getWatch as ad, actorLogContext as af, resolvePluginHeaderEnvRefs as ai, userAvatarUrlsFromIdentities as al, storeConversationEventLexemes as an, updateSlackMessage as ao, MUTATION_LOCK_TTL_MS as ap, SandboxCallTimeoutError as ar, readAutomationRowStats as as, publishImage as at, juniorAutomations as au, userMessageQueries as b, lookupActiveSlackWorkspaceMember as ba, canAgentChangeInboxItem as bc, readSignInSecret as bd, parseDestination as bf, tryWorkspaceRepoCheckoutPath as bi, canInviteToConversation as bl, queueCallback as bn, getDashboardConversationLink as bo, ProviderError as bp, createSandboxEgressCredentialToken as br, conversationRangeColumns as bs, savePushSubscription as bt, juniorCodeChanges as bu, pendingMigrations as c, getQueueProvider as ca, inboxItemSnoozedBy as cc, listWatches as cd, credentialSubjectSchema as cf, McpToolError as ci, resolveActorIdentityId as cl, eventExcerpt as cn, slackEntitySchema as co, withLock as cp, isAlreadyExistsError as cr, recordAutomationExecution as cs, unpublishedArtifactHeaders as ct, juniorAgentBindings as cu, eventFromRow as d, listConversationAnnotationsById as da, settleInboxSnoozes as dc, bindEventAutomationCredentialSubject as dd, createSlackActor as df, getMcpProviderErrorAttributes as di, deleteProviderIdentityForUser as dl, event_embedding_config_exports as dn, createScheduledAutomation as do, estimateMessagesTokens as dp, WorkspaceSnapshotNotReadyError as dr, agentTurnCostUsd as ds, readWebPushConfig as dt, juniorConversationEventLexemes as du, verifyConversationQueueMessage as ea, deleteInboxItemDeliveries as ec, collectEventMatchKeys as ed, disconnectStateAdapter as ef, patchMcpAuthSession as ei, hasUserPhoto as el, eventIndexLockKey as en, openSlackModal as eo, readEnabledProviders as ep, deliverOAuthAuthorization as er, readAutomationExecutionByConversationId as es, getRegistrations as et, juniorInboxItemConversations as eu, copyMessageLinks as f, defaultTimezone as fa, snoozeInboxItems as fc, bindScheduledAutomationCredentialSubject as fd, createSlackResumeActor as ff, toMcpProviderError as fi, findLinkedSlackUser as fl, isEventEmbeddingsEnabled as fn, deleteScheduledAutomation as fo, estimateRequestOverheadTokens as fp, getWorkspaceSnapshotNotReadyError as fr, agentTurnUsageSchema as fs, sendPushNotificationToUser as ft, juniorConversationEventEmbeddings as fu, conversationDescendants as g, lookupSlackUserNames as ga, REPLY_NOTICE_KEY_PREFIX as gc, verifySlackDirectCredentialSubject as gd, parseStoredSlackActor as gf, parseInlinePluginManifest as gi, upsertLinkedIdentity as gl, createVercelPluginTaskCallback as gn, saveScheduledAutomation as go, gatewayRoutingAttributes as gp, SANDBOX_EGRESS_AUTH_REQUIRED_MARKER as gr, microUsdToUsd as gs, deletePushSubscription as gt, juniorApiTokens as gu, conversationAncestors as h, lookupSlackUser as ha, PLUGIN_INBOX_ITEM_KEY_PREFIX as hc, verifyScheduledAutomationCredentialSubject as hd, parseActorUserId as hf, getOAuthProviderErrorAttributes as hi, recordGoogleSignIn as hl, startedTaskDefinition as hn, readScheduledAutomation as ho, readImageDimensions as hp, executeCredentialedEgressRequest as hr, microUsdSql as hs, resolveNotificationTimezone as ht, juniorConversationEvents as hu, getConversationStore as i, nudgeIdempotencyKey as ia, SNOOZE_TIMER_EVENT_TYPE as ic, findMatchingWatches as id, setStateValues as if, webActorUserIds as ii, readUserAvatarUrls as il, seqIn as in, unfurlSlackLinks as io, createCache as ip, startOAuthFlow as ir, readAutomationExecutions as is, publicArtifactHeaders as it, automationSearchDocument as iu, rootConversationIsArchived as j, readConversationAutomationRun as ja, inboxItemVisibleTo as jc, runWithSlackInstallationToken as jd, parseSlackMessageTs as jf, readConversationMetadata as ji, conversationIsNotUnsubscribedRoot as jl, renderToolResultNudge as jn, setDashboardConversationLinkOptions as jo, getConfigDefaults as jp, pluginCatalogRuntime as jr, AUTOMATION_ALERT_STEPS as js, searchTypedMemories as jt, slackPersonSearchDocument as ju, readMentionedUserIds as k, resolvePluginOAuthAccount as ka, inboxItemReaderForUserInConversation as kc, normalizeSlackConversationId as kd, slackTeamIdSchema as kf, searchConversations as ki, conversationIdsWithParticipantUser as kl, STOP_WATCHING_TOOL_NAME as kn, parseDashboardConversationLink as ko, bufferBody as kp, resolveSandboxEgressProviderForHost as kr, hasUnexpiredAuthorizationRequest as ks, revalidateContent as kt, juniorIdentities as ku, readMigrationRecords as l, createPluginAnnotations as la, listFiringInboxSnoozeTriggers as lc, takeDueTimerWatches as ld, credentialUserSubjectId as lf, getMcpAwareErrorType as li, saveActorAvatar as ll, excerptTerms as ln, slackExternalRefIdSchema as lo, requestPrefixAttributes as lp, throwSandboxOperationError as lr, refreshAutomationLastRun as ls, apiRoutePrefix as lt, juniorConversationReadPositions as lu, withConversationEventLock as m, resolveUserTimezone as ma, unsnoozeInboxRow as mc, verifyEventAutomationCredentialSubject as md, isUserActor as mf, fetchWithBoundedOAuthErrorBodies as mi, findUserByVerifiedEmails as ml, createPluginTaskStarter as mn, parseScheduledAutomationRow as mo, textCharsForTokens as mp, workspaceSnapshotNotReadyUserMessage as mr, conversationCostOf as ms, readNotificationPause as mt, juniorConversationMetrics as mu, getConversationEventStore as n, conversationQueueMessageSchema as na, recordInboxItemSlackCard as nc, createWatch as nd, getStateAdapter as nf, putMcpServerSessionId as ni, parseAvatarUrl as nl, lexemesSql as nn, postSlackMessage as no, saveEnabledProviders as np, parseOAuthStatePayload as nr, readAutomationExecutionStatusHours as ns, setPlugins as nt, juniorInboxItems as nu, getSqlExecutor as o, signQueueMessage as oa, deleteExpiredInboxSnoozes as oc, isQuietEvent as od, credentialContextForActor as of, McpProviderError as oi, userAvatarUrlsFromJoinedPhotos as ol, SEARCHABLE_EVENT_TYPES as on, uploadFilesToConversation as oo, acquireActiveLock as op, findInErrorChain as or, readAutomationRuns as os, readPublicArtifact as ot, juniorAutomationRuns as ou, deleteMessageLinks as p, findActorTimezone as pa, snoozeTimerTrigger as pc, bindSlackDirectCredentialSubject as pd, isActorUserId as pf, OAuthProviderError as pi, findSlackUserByPrimaryEmail as pl, setEventEmbeddingsConfig as pn, listScheduledAutomationsForTeam as po, estimateTextTokens as pp, isWorkspaceSnapshotNotReadyError as pr, hasAgentTurnUsage as ps, notificationPreview as pt, juniorConversationEmbeddings as pu, createPluginHookRunner as q, markDispatchFailed as qa, readActorIdentity as qc, registeredEventTypeSchema as qd, snapshotRuntimeConfig as qf, conversationNoteEvent as qi, juniorTodos as ql, isStale as qn, readAutomationVersion as qo, deleteMcpAuthSession as qr, listReplyActionItems as qs, messagesNeedSpaceMembership as qt, AGENT_RESOURCE_TYPE as qu, getConversationMessageSearchStore as r, isConversationQueueMessageRejectedError as ra, recordRepeatInboxItemPush as rc, deliverWatch as rd, getStateValues as rf, putMcpStoredOAuthCredentials as ri, readAvatarFetch as rl, searchedEventTextSql as rn, removeReactionFromMessage as ro, cacheKeyPrefix as rp, resolveBaseUrl as rr, readAutomationExecutionSummaries as rs, validatePlugins as rt, automationFuzzyTitle as ru, createJuniorSqlExecutor as s, verifyQueueMessage as sa, inboxItemInRow as sc, listConversationsWithWatches as sd, credentialContextSchema as sf, McpServiceAccountRequiredError as si, SYSTEM_IDENTITY_ID as sl, callsToolSql as sn, fitsSlackMetadataLimit as so, fenceLock as sp, isAbortError as sr, readAutomationTitlesByConversationId as ss, unpublishArtifact as st, juniorLocationConfigurations as su, db_exports as t, ConversationQueueMessageRejectedError as ta, listInboxItemPushUserIds as tc, createTimerWatch as td, getDefaultRedisStateAdapterFor as tf, putMcpAuthSession as ti, identityAvatarUrl as tl, indexEndedTurnEvents as tn, postSlackEphemeralMessage as to, readServedProviders as tp, formatProviderLabel as tr, readAutomationExecutionStatusDays as ts, getStaticPluginToolDefinitions as tt, juniorInboxItemSlackCards as tu, createSqlConversationEventStore as u, listConversationAnnotations as ua, readViewerInboxSnoozes as uc, turnEvents as ud, createActor as uf, getMcpAwareTelemetryMessage as ui, deleteProviderIdentityForSlackUser as ul, storedMessageJson as un, blockScheduledAutomation as uo, claudeMaxImageSize as up, wrapSandboxSetupError as ur, addAgentTurnUsage as us, coreRegistrations as ut, juniorConversationParticipants as uu, setArchivedAt as v, looksLikeEmail as va, TODO_INBOX_ITEM_KEY_PREFIX as vc, readJuniorSecret as vd, truncateStatusText as vf, normalizeSandboxEgressTracePropagationDomains as vi, canAccessConversation as vl, pluginTaskParamsSchema as vn, scheduledRunId as vo, hasCompactedConversationContext as vp, consumeSandboxEgressAuthRequiredSignal as vr, usdToMicroUsdUnbiased as vs, readNotificationSchedule as vt, codeChangeSearchDocument as vu, setFirstConversationLocation as w, basePluginContext as wa, inboxItemForUser as wc, getHeaderString as wd, parseSlackChannelReferenceId as wf, createPluginModel as wi, leaveEndsAccess as wl, getSlackToolContext as wn, getDashboardObjectIconLink as wo, getProviderErrorAttributes as wp, createUserTokenStore as wr, conversationTurnFailedSql as ws, projectConversationMessages as wt, juniorMessageAttachments as wu, createSqlStore as x, lookupSlackBot as xa, canAnswerInboxItem as xc, SlackActionError as xd, requireSlackDestination as xf, workspaceRepoCheckoutPath as xi, canReadConversation as xl, getTurnRequestDeadline as xn, getDashboardInboxItemLink as xo, createAssistantProviderError as xp, parseSandboxEgressCredentialToken as xr, conversationUsageCostExpr as xs, isActiveInSlack as xt, juniorCodeRepositories as xu, lastMessageAtSql as y, lookupUsers as ya, canActOnInboxItem as yc, readSchedulerSecret as yd, createSlackDestination as yf, SANDBOX_RUNTIME as yi, canAddConversationMessages as yl, sendVercelPluginTask as yn, withScheduledAutomationLock as yo, isCompactionSummaryText as yp, consumeSandboxEgressPermissionDeniedSignal as yr, conversationAggregateColumns as ys, saveNotificationSchedule as yt, codeRepositorySearchDocument as yu, normalizeSlackReplyMarkdown as z, getDispatchRecord as za, requireInboxItemLinks as zc, automationEventCatalog as zd, getSlackClientSecret as zf, completeText as zi, setConversationVisibility as zl, WorkspaceValidationError as zn, parseEventAutomationRow as zo, startServiceAccountSignIn as zr, countInboxItemsNeedingUserBySubject as zs, fuseRankedLists as zt, slackChannelMessageEvent as zu };
|