@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,8 +1,8 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-BKpuH2hG.js";
|
|
2
2
|
import { s as skillRoots } from "./package-discovery-BI6T_RkD.js";
|
|
3
|
-
import { h as logWarn } from "./logging-
|
|
4
|
-
import {
|
|
5
|
-
import { G as mapBounded } from "./transcript-
|
|
3
|
+
import { h as logWarn } from "./logging-B8KEJegM.js";
|
|
4
|
+
import { jr as pluginCatalogRuntime } from "./db-DhzvUY23.js";
|
|
5
|
+
import { G as mapBounded } from "./transcript-CCi7323k.js";
|
|
6
6
|
import * as z from "zod";
|
|
7
7
|
import path from "node:path";
|
|
8
8
|
import fs from "node:fs/promises";
|
package/dist/{slack-conversation-unfurl-Dhe3lB1U.js → slack-conversation-unfurl-Dq71EkhM.js}
RENAMED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-BKpuH2hG.js";
|
|
2
|
-
import { Af as
|
|
3
|
-
import { E as withSpan } from "./logging-
|
|
4
|
-
import { r as checkSlackChannelReadAccess, t as runWithSlackInstallation } from "./adapter-context-
|
|
5
|
-
import { a as isMovableToSlack, i as continueConversationInSlack, n as alreadyContinuesInSlackMessage, t as BUSY } from "./continue-in-slack-
|
|
6
|
-
import {
|
|
7
|
-
import { G as mapBounded } from "./transcript-
|
|
2
|
+
import { Af as slackUserIdSchema, Cf as parseSlackChannelId, Df as slackBotIdSchema, Ef as parseSlackUserId, Fd as getWorkspaceTeamId, I as escapeSlackMrkdwnText, L as formatSlackLink, Nf as slackMessageTsSchema, O as getConversationIdByProviderConversation, Of as slackChannelIdSchema, Pf as botConfig, Sa as lookupSlackUserProfile, Tf as parseSlackTeamId, Tl as readConversationAccessFromSql, a as getDb, df as createSlackActor, hf as parseActorUserId, i as getConversationStore, io as unfurlSlackLinks, ip as createCache, kf as slackTeamIdSchema, ko as parseDashboardConversationLink, o as getSqlExecutor, qc as readActorIdentity, to as postSlackEphemeralMessage, xa as lookupSlackBot } from "./db-DhzvUY23.js";
|
|
3
|
+
import { E as withSpan } from "./logging-B8KEJegM.js";
|
|
4
|
+
import { r as checkSlackChannelReadAccess, t as runWithSlackInstallation } from "./adapter-context-Bref7aPI.js";
|
|
5
|
+
import { a as isMovableToSlack, i as continueConversationInSlack, n as alreadyContinuesInSlackMessage, t as BUSY } from "./continue-in-slack-DbQUFe_F.js";
|
|
6
|
+
import { si as deferConversationMove } from "./session-stop-DponjDUZ.js";
|
|
7
|
+
import { G as mapBounded } from "./transcript-CCi7323k.js";
|
|
8
8
|
import * as z from "zod";
|
|
9
9
|
// src/chat/ingress/workspace-membership.ts
|
|
10
10
|
const MEMBER_TTL_MS = 3e5;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-BKpuH2hG.js";
|
|
2
|
-
import { R as actorFromRun,
|
|
3
|
-
import {
|
|
4
|
-
import { t as readConversationLineage } from "./lineage-
|
|
5
|
-
import { n as spawnChildAgent } from "./create-
|
|
2
|
+
import { R as actorFromRun, nt as AgentDepthLimitError } from "./agent-runner-Cr5Fhjf-.js";
|
|
3
|
+
import { Pf as botConfig } from "./db-DhzvUY23.js";
|
|
4
|
+
import { t as readConversationLineage } from "./lineage-D3AZAJVe.js";
|
|
5
|
+
import { n as spawnChildAgent } from "./create-DUJBXr6E.js";
|
|
6
6
|
// src/chat/agent-invocations/spawn.ts
|
|
7
7
|
var spawn_exports = /* @__PURE__ */ __exportAll({ bindSpawnAgent: () => bindSpawnAgent });
|
|
8
8
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { $i as getVercelConversationWorkQueue,
|
|
2
|
-
import { A as fileFields, B as zodToolDefinition, H as juniorToolOutputSchema, L as AttachmentSourceUnavailableError, h as webActorFromUser, o as readLeadSpace, p as createConversationId, u as appendAndEnqueueWebMessage, z as zodTool } from "./turn-session-routing-
|
|
1
|
+
import { $i as getVercelConversationWorkQueue, Ad as readPrivateSlackFile, Bl as conversationDetailTouch, Cu as juniorAttachments, Ju as agentWatch, Md as streamPrivateSlackFile, Wt as isPersonInput, Zd as ToolInputError, bo as getDashboardConversationLink, xd as SlackActionError } from "./db-DhzvUY23.js";
|
|
2
|
+
import { A as fileFields, B as zodToolDefinition, H as juniorToolOutputSchema, L as AttachmentSourceUnavailableError, h as webActorFromUser, o as readLeadSpace, p as createConversationId, u as appendAndEnqueueWebMessage, z as zodTool } from "./turn-session-routing-D15orfwy.js";
|
|
3
3
|
import * as z from "zod";
|
|
4
4
|
import { subscribableResourceSchema } from "@sentry/junior-plugin-api";
|
|
5
5
|
import { and, eq, inArray, isNull, sql } from "drizzle-orm";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-BKpuH2hG.js";
|
|
2
|
-
import { C as toPromptContributionContext, D as SANDBOX_DATA_ROOT, I as createPluginLogger, M as SANDBOX_WORKSPACE_ROOT, N as sandboxSkillDir, S as PLUGIN_PROMPT_CONTRIBUTION_TOTAL_MAX_CHARS, b as SESSION_CONTEXT_SECTION_TAG, f as isToolResultError, l as isAssistantMessage, m as normalizeToolNameFromResult, n as extractAssistantText, p as isToolResultMessage, v as CAPABILITY_SECTION_TAG, w as runPluginHooksAtOnce, x as TURN_CONTEXT_TAG, y as REQUEST_CONTEXT_SECTION_TAG } from "./transcript-
|
|
2
|
+
import { C as toPromptContributionContext, D as SANDBOX_DATA_ROOT, I as createPluginLogger, M as SANDBOX_WORKSPACE_ROOT, N as sandboxSkillDir, S as PLUGIN_PROMPT_CONTRIBUTION_TOTAL_MAX_CHARS, b as SESSION_CONTEXT_SECTION_TAG, f as isToolResultError, l as isAssistantMessage, m as normalizeToolNameFromResult, n as extractAssistantText, p as isToolResultMessage, v as CAPABILITY_SECTION_TAG, w as runPluginHooksAtOnce, x as TURN_CONTEXT_TAG, y as REQUEST_CONTEXT_SECTION_TAG } from "./transcript-CCi7323k.js";
|
|
3
3
|
import { a as listReferenceFiles, c as soulPathCandidates, l as worldPathCandidates } from "./package-discovery-BI6T_RkD.js";
|
|
4
|
-
import { h as logWarn, m as logInfo } from "./logging-
|
|
4
|
+
import { h as logWarn, m as logInfo } from "./logging-B8KEJegM.js";
|
|
5
5
|
import * as z from "zod";
|
|
6
6
|
import path from "node:path";
|
|
7
7
|
import { escapeClosingTag, escapeTagText, escapeTagTextAndQuotes, indentTagLines, markdownNodes, parseMarkdown, promptMessageSchema, renderInlineTag, renderTag } from "@sentry/junior-plugin-api";
|
|
@@ -309,7 +309,8 @@ function senderAttributes({ sender }) {
|
|
|
309
309
|
const TASK_EXECUTION_RULES = [
|
|
310
310
|
"- Work as a trusted colleague who owns the task. Make the reasonable small decisions yourself and take the next appropriate step. Do not ask the user to confirm each step.",
|
|
311
311
|
"- Continue until done, genuinely blocked, or waiting on child agents you started. Do not finish with a plan, promise, or offer to check next when an available tool or source can move the request forward.",
|
|
312
|
-
"- Ask the user a question only when they can give what is missing: access that they control, or a decision that is truly theirs and blocks safe progress. Ask it with `addInboxItem`, never in plain text. When only part of the work is blocked, deliver the rest in this Turn and ask about the blocked part with `addInboxItem`. When nobody in the Conversation can give what is missing, such as data that only someone outside the Conversation controls, say in one line what is missing and add no item. A scope choice that does not block the work is not a question: choose the conventional option, deliver the work, and name the choice in a few words, even when the reply is mostly code. Do not add an item for a scope choice, an offer, or a follow-up idea."
|
|
312
|
+
"- Ask the user a question only when they can give what is missing: access that they control, or a decision that is truly theirs and blocks safe progress. Ask it with `addInboxItem`, never in plain text. When only part of the work is blocked, deliver the rest in this Turn and ask about the blocked part with `addInboxItem`. When nobody in the Conversation can give what is missing, such as data that only someone outside the Conversation controls, say in one line what is missing and add no item. A scope choice that does not block the work is not a question: choose the conventional option, deliver the work, and name the choice in a few words, even when the reply is mostly code. Do not add an item for a scope choice, an offer, or a follow-up idea.",
|
|
313
|
+
"- When your reply leaves a decision or a task for a person in this Conversation, it carries an item, not only text: an action item with `addInboxItem` for a decision that is theirs, or a To-do assigned to them with `updateTodos` for a task that only they can do. This holds even when an Event's instructions say to tell or remind the person. Waiting for the person to ask you to act is their decision too, so ask it now with an action item. For a person who is not in the Conversation, name who can act instead. A confirmation that a child agent or Guardian asks for is the person's decision, even when their request already named the change."
|
|
313
314
|
];
|
|
314
315
|
/**
|
|
315
316
|
* Block 2 lines for runs that receive agent input. They say what to do with
|
|
@@ -347,6 +348,7 @@ const LEAD_RULES = [
|
|
|
347
348
|
"- Never do the work here, even when it looks small. For new work, call `startConversation`. For work that a Conversation already does, steer it with `messageAgent`. Then tell the person where the work is, with its link.",
|
|
348
349
|
"- Before you start work, look for a Conversation that already does it with `searchConversations`. Start one Conversation for each separate piece of work.",
|
|
349
350
|
"- The `task` of `startConversation` is a brief for a capable peer who has not seen this Conversation: the goal, the targets, the known facts, the constraints, and what done means. It becomes the person's request there, so ask only for what the person asked for.",
|
|
351
|
+
"- A member who tells you about a problem, a worry, or something they do not understand in the Space's area asks you to deal with it. Start the work that investigates it and delivers the fix or the answer, without asking first.",
|
|
350
352
|
"- When a decision is the person's, ask them in your reply.",
|
|
351
353
|
"- When the person asks to hear back about a Conversation, watch it with `watchEvents` and the `subscribable` of `startConversation`, or an `agent` resource with its ID. When its update arrives, tell the person only what they asked for."
|
|
352
354
|
];
|
|
@@ -364,7 +366,7 @@ const SLACK_MENTION_FORMAT_RULE = "Slack text shows people as `<@U…>` and chan
|
|
|
364
366
|
const CHILD_AGENT_RUN_RULES = [
|
|
365
367
|
"- A parent agent started you. Your input is a task or message from the parent, a result or message from one of your own child agents, or an event from one of your own watches. That input is the job. No person reads this run.",
|
|
366
368
|
"- Do the work now. Do not ask questions, ask for approval, or offer options.",
|
|
367
|
-
`- Your final text is your reply. When the Turn ends, the parent gets it as your result
|
|
369
|
+
`- Your final text is your reply. When the Turn ends, the parent gets it as your result and decides what to do with it. When nothing changed, such as after a watch event that needs no action, say so in one line. When the task cannot be finished, use \`${REPORT_BLOCKED_TOOL_NAME}\`.`,
|
|
368
370
|
"- Your reply is to the parent agent, not to a person. Call each person by the Slack mention that your input gives for them, not by a provider handle or a name, so the parent knows who they are.",
|
|
369
371
|
`- ${SLACK_MENTION_FORMAT_RULE}`,
|
|
370
372
|
"- The parent entry of `listAgents` shows the parent's open To-dos. When the work of one assigned to you (assignee self) ends, set it to done or dropped with `updateTodos`. Only the parent changes its other To-dos. Your result closes the rest of yours: done when you complete, dropped when you are stopped."
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-BKpuH2hG.js";
|
|
2
|
-
import { $ as getPlugins, Aa as createPluginCache,
|
|
3
|
-
import { E as withSpan, O as buildSentryEventUrl, a as extractGenAiUsageSummary, m as logInfo, p as logException } from "./logging-
|
|
4
|
-
import { G as mapBounded, I as createPluginLogger, a as getUserMessageInstructionText, c as instructionTextForProjection, f as isToolResultError, g as stripRuntimeTurnContext, m as normalizeToolNameFromResult, p as isToolResultMessage, r as getPiMessageRole } from "./transcript-
|
|
5
|
-
import {
|
|
6
|
-
import { i as savedTurnMessages, t as resolveConversationRouting } from "./turn-session-routing-
|
|
7
|
-
import { Ft as inboxItemChangeRecordSchema, Kt as readMessageAttachments, X as conversationReportEventSchema, Z as conversationReportMessageEventSchema, xt as sameActorIdentity, zt as readMessageCardRefs } from "./media-
|
|
8
|
-
import { i as matchSlackAttachments, n as startConversationToolDefinition } from "./start-conversation-
|
|
2
|
+
import { $ as getPlugins, Aa as createPluginCache, An as createPluginState, Ci as createPluginEmbedder, Di as createPluginConversationEvents, Ei as createPluginTurnEventReader, Ii as storeConversationEmbedding, Ji as renderJuniorNativeConversationEvent, K as createPluginEventPublisher, Mi as writeConversationMetadata, Oi as renderPluginConversationEvent, Pf as botConfig, Pi as createConversationEmbedder, Qi as createPluginInboxItems, Ri as completeObject, Rl as resolveRootVisibility, Sn as createPluginCodeChanges, Ti as createPluginModelCostRecorder, Tu as juniorConversations, Ut as hasConversationMetadata, Xi as createPluginConversationChanges, Yc as readIdentityById, _n as pluginTaskId, a as getDb, bu as juniorCodeChanges, cp as withLock, d as eventFromRow, et as getRegistrations, hn as startedTaskDefinition, hu as juniorConversationEvents, i as getConversationStore, jf as parseSlackMessageTs, ji as readConversationMetadata, la as createPluginAnnotations, mn as createPluginTaskStarter, nf as getStateAdapter, o as getSqlExecutor, ps as hasAgentTurnUsage, qc as readActorIdentity, ua as listConversationAnnotations, vn as pluginTaskParamsSchema, wi as createPluginModel, x as createSqlStore, xu as juniorCodeRepositories, za as getDispatchRecord } from "./db-DhzvUY23.js";
|
|
3
|
+
import { E as withSpan, O as buildSentryEventUrl, a as extractGenAiUsageSummary, m as logInfo, p as logException } from "./logging-B8KEJegM.js";
|
|
4
|
+
import { G as mapBounded, I as createPluginLogger, a as getUserMessageInstructionText, c as instructionTextForProjection, f as isToolResultError, g as stripRuntimeTurnContext, m as normalizeToolNameFromResult, p as isToolResultMessage, r as getPiMessageRole } from "./transcript-CCi7323k.js";
|
|
5
|
+
import { Ar as isEventAuthorId, C as isParentMessageAuthor, F as isInheritedForkHistory, fr as hydrateConversationMessages, ot as coerceThreadConversationState, rt as getPersistedThreadState, ti as getTurnRecord, wi as loadTurnStart } from "./session-stop-DponjDUZ.js";
|
|
6
|
+
import { i as savedTurnMessages, t as resolveConversationRouting } from "./turn-session-routing-D15orfwy.js";
|
|
7
|
+
import { Ft as inboxItemChangeRecordSchema, Kt as readMessageAttachments, X as conversationReportEventSchema, Z as conversationReportMessageEventSchema, xt as sameActorIdentity, zt as readMessageCardRefs } from "./media-BebquhET.js";
|
|
8
|
+
import { i as matchSlackAttachments, n as startConversationToolDefinition } from "./start-conversation-B-LIqqNi.js";
|
|
9
9
|
import { h as startSpan } from "./sentry-CPbZjomA.js";
|
|
10
10
|
import * as z from "zod";
|
|
11
11
|
import { objectTypeSchema, pluginRunContextSchema, renderTag, tagJson } from "@sentry/junior-plugin-api";
|
|
@@ -1208,12 +1208,23 @@ function startedTaskContext(plugin, name, payload, options) {
|
|
|
1208
1208
|
}),
|
|
1209
1209
|
db: getDb(),
|
|
1210
1210
|
events: createPluginEventPublisher(plugin, options.events),
|
|
1211
|
+
inboxItems: { forConversation: (conversationId) => createPluginInboxItems({
|
|
1212
|
+
conversationId,
|
|
1213
|
+
plugin: pluginName,
|
|
1214
|
+
show: options.showInboxItem ?? (async () => {})
|
|
1215
|
+
}) },
|
|
1211
1216
|
lastDelivery: (options.deliveryCount ?? 0) >= 5,
|
|
1212
1217
|
log: createPluginLogger(pluginName),
|
|
1213
1218
|
name,
|
|
1214
1219
|
payload,
|
|
1215
1220
|
plugin: { name: pluginName },
|
|
1216
|
-
state: createPluginState(pluginName)
|
|
1221
|
+
state: createPluginState(pluginName),
|
|
1222
|
+
tasks: createPluginTaskStarter({
|
|
1223
|
+
plugin: pluginName,
|
|
1224
|
+
send: options.sendPluginTask,
|
|
1225
|
+
tasks: plugin.tasks
|
|
1226
|
+
}),
|
|
1227
|
+
users: { readIdentity: readIdentityById }
|
|
1217
1228
|
};
|
|
1218
1229
|
}
|
|
1219
1230
|
/** Run one delivery of a started task. */
|
|
@@ -1511,11 +1522,12 @@ async function scheduleSessionCompletedPluginTasks(params, send) {
|
|
|
1511
1522
|
*/
|
|
1512
1523
|
async function processPluginTask(message, options = {}) {
|
|
1513
1524
|
if ("payload" in message) {
|
|
1514
|
-
const { events } = options;
|
|
1515
|
-
if (!events) throw new Error("A started plugin task needs the app event publisher");
|
|
1525
|
+
const { events, sendPluginTask } = options;
|
|
1526
|
+
if (!events || !sendPluginTask) throw new Error("A started plugin task needs the app event publisher and task sender");
|
|
1516
1527
|
await processStartedPluginTask(message, {
|
|
1517
1528
|
...options,
|
|
1518
|
-
events
|
|
1529
|
+
events,
|
|
1530
|
+
sendPluginTask
|
|
1519
1531
|
});
|
|
1520
1532
|
return;
|
|
1521
1533
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { a as getDb, n as getConversationEventStore, ua as listConversationAnnotations } from "./db-
|
|
2
|
-
import { G as mapBounded } from "./transcript-
|
|
3
|
-
import { b as setSpanAttributes } from "./logging-
|
|
4
|
-
import { Bt as removedCardSchema, Vt as resolveMessageCards, zt as readMessageCardRefs } from "./media-
|
|
5
|
-
import {
|
|
1
|
+
import { a as getDb, n as getConversationEventStore, ua as listConversationAnnotations } from "./db-DhzvUY23.js";
|
|
2
|
+
import { G as mapBounded } from "./transcript-CCi7323k.js";
|
|
3
|
+
import { b as setSpanAttributes } from "./logging-B8KEJegM.js";
|
|
4
|
+
import { Bt as removedCardSchema, Vt as resolveMessageCards, zt as readMessageCardRefs } from "./media-BebquhET.js";
|
|
5
|
+
import { Gr as clearPendingAuth, R as getTurnUserMessageId, Sr as markConversationMessage, X as markTurnCompleted, Xt as getConversationWorkState, Y as markTurnClosed, _r as buildConversationContext, at as persistThreadStateById, fr as hydrateConversationMessages, ot as coerceThreadConversationState, rt as getPersistedThreadState } from "./session-stop-DponjDUZ.js";
|
|
6
6
|
import { n as listChildMessages } from "./child-message--2G3Ft26.js";
|
|
7
7
|
// src/chat/conversations/pending-cards.ts
|
|
8
8
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { h as logWarn, m as logInfo, p as logException } from "./logging-
|
|
1
|
+
import { h as logWarn, m as logInfo, p as logException } from "./logging-B8KEJegM.js";
|
|
2
2
|
import pLimit from "p-limit";
|
|
3
3
|
import { escapeClosingTags, escapeTagText, escapeTagTextAndQuotes, findTag, openingTag, readTag, renderTag, startsWithTag, stripTags, unescapeClosingTags, unescapeTagText } from "@sentry/junior-plugin-api";
|
|
4
4
|
/**
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { G as mapBounded } from "./transcript-
|
|
3
|
-
import { o as getActiveTraceContext } from "./logging-
|
|
4
|
-
import { i as isVisionImageMediaType, r as detectImageMediaType } from "./media-
|
|
5
|
-
import {
|
|
1
|
+
import { Bl as conversationDetailTouch, Bn as isPostgresErrorCode, Cu as juniorAttachments, Du as juniorSpaceMembers, Gt as isThread, Hl as touchConversationDetail, Ia as getDispatchConversationId, Kt as isTopLevel, Mu as juniorUsers, Ou as juniorSpaces, Sf as sameDestination, Su as juniorAttachmentUploads, Tu as juniorConversations, Vl as nextDetailVersion, Zd as ToolInputError, a as getDb, cl as resolveActorIdentityId, i as getConversationStore, il as readUserAvatarUrls, kp as bufferBody, o as getSqlExecutor, qt as messagesNeedSpaceMembership, wu as juniorMessageAttachments, za as getDispatchRecord } from "./db-DhzvUY23.js";
|
|
2
|
+
import { G as mapBounded } from "./transcript-CCi7323k.js";
|
|
3
|
+
import { o as getActiveTraceContext } from "./logging-B8KEJegM.js";
|
|
4
|
+
import { i as isVisionImageMediaType, r as detectImageMediaType } from "./media-BebquhET.js";
|
|
5
|
+
import { Ft as appendAndEnqueueInboundMessage, Pt as appendAndEnqueueExclusiveInboundMessage, et as buildDeterministicTurnId } from "./session-stop-DponjDUZ.js";
|
|
6
6
|
import { t as webMessageId } from "./web-message-id-C6P83ans.js";
|
|
7
7
|
import * as z from "zod";
|
|
8
8
|
import { createHash, randomUUID } from "node:crypto";
|
|
@@ -966,7 +966,7 @@ function storedActorFromWeb(actor) {
|
|
|
966
966
|
* Conversation: a dashboard Conversation, a Slack thread, or a Thread.
|
|
967
967
|
*/
|
|
968
968
|
function acceptsWebMessages(conversation) {
|
|
969
|
-
if (!isTopLevel(conversation)) return conversation
|
|
969
|
+
if (!isTopLevel(conversation)) return isThread(conversation);
|
|
970
970
|
const { conversationId, destination } = conversation;
|
|
971
971
|
if (destination?.platform === "slack") return true;
|
|
972
972
|
return destination?.platform === "local" && conversationId.startsWith("local:web:");
|
|
@@ -1248,7 +1248,7 @@ function slackSourceForDestination(args) {
|
|
|
1248
1248
|
* Reads parent Conversations when this Conversation has no Destination.
|
|
1249
1249
|
*/
|
|
1250
1250
|
async function resolveConversationRouting(args) {
|
|
1251
|
-
const conversationStore = args.conversationStore ?? (await import("./db-
|
|
1251
|
+
const conversationStore = args.conversationStore ?? (await import("./db-DhzvUY23.js").then((n) => n.t)).getConversationStore();
|
|
1252
1252
|
const chain = await loadConversationChain(args.conversationId, conversationStore);
|
|
1253
1253
|
let destination;
|
|
1254
1254
|
let source;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { $i as getVercelConversationWorkQueue,
|
|
2
|
-
import {
|
|
3
|
-
import { n as resolveTurnResumeRouting } from "./turn-session-routing-
|
|
4
|
-
import { p as logException } from "./logging-
|
|
1
|
+
import { $i as getVercelConversationWorkQueue, Kt as isTopLevel, i as getConversationStore, n as getConversationEventStore, za as getDispatchRecord } from "./db-DhzvUY23.js";
|
|
2
|
+
import { Jr as loadTurnCheckpoint, Jt as ensureConversationWake, ei as failTurnRecord, ri as recordTurnSummary, rn as requestConversationWork, ti as getTurnRecord } from "./session-stop-DponjDUZ.js";
|
|
3
|
+
import { n as resolveTurnResumeRouting } from "./turn-session-routing-D15orfwy.js";
|
|
4
|
+
import { p as logException } from "./logging-B8KEJegM.js";
|
|
5
5
|
import * as z from "zod";
|
|
6
6
|
// src/chat/task-execution/authorized-turn.ts
|
|
7
7
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-BKpuH2hG.js";
|
|
2
|
-
import {
|
|
2
|
+
import { jr as pluginCatalogRuntime } from "./db-DhzvUY23.js";
|
|
3
3
|
import { isDeepStrictEqual } from "node:util";
|
|
4
4
|
// src/chat/plugins/validation.ts
|
|
5
5
|
var validation_exports = /* @__PURE__ */ __exportAll({
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// package.json
|
|
2
|
-
var version = "0.
|
|
2
|
+
var version = "0.316.0";
|
|
3
3
|
// src/version.ts
|
|
4
4
|
/** Installed Junior package version, or `unknown` when package metadata is unavailable. */
|
|
5
5
|
const JUNIOR_VERSION = typeof version === "string" && version.trim() ? version : "unknown";
|
package/dist/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { t as JUNIOR_VERSION } from "./version-
|
|
1
|
+
export { t as JUNIOR_VERSION } from "./version-CBQoanXb.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-BKpuH2hG.js";
|
|
2
|
-
import {
|
|
3
|
-
import { T as withLogContext, b as setSpanAttributes, h as logWarn, m as logInfo, p as logException } from "./logging-
|
|
4
|
-
import { $t as
|
|
2
|
+
import { Dp as isProviderRetryError, Ff as getChatConfig, ia as nudgeIdempotencyKey, ta as ConversationQueueMessageRejectedError, xn as getTurnRequestDeadline } from "./db-DhzvUY23.js";
|
|
3
|
+
import { T as withLogContext, b as setSpanAttributes, h as logWarn, m as logInfo, p as logException } from "./logging-B8KEJegM.js";
|
|
4
|
+
import { $t as recordAttemptFailure, Gt as deadLetterAttempt, It as beginConversationResume, Jt as ensureConversationWake, Kt as drainConversationMailbox, Nt as ackMessages, Rt as checkInConversationWork, Ut as completeConversationStop, Vt as clearConsumedConversationWake, Wt as completeConversationWork, Xt as getConversationWorkState, bi as selectAttemptMessages, ci as hasConversationStop, di as isInvalidConversationRecordError, en as recordConversationRetry, i as saveHeldInput, in as startConversationWork, n as getConversationStoppedAtMs, nn as requestAnotherSlice, oi as countPendingConversationMessages, tn as releaseConversationWork, ui as isFinalAttempt, yi as isAttemptInterrupt, zt as claimConversationAttempt } from "./session-stop-DponjDUZ.js";
|
|
5
5
|
// src/chat/task-execution/lost-lease.ts
|
|
6
6
|
/**
|
|
7
7
|
* Count a slice that lost its Conversation Lease as a failed attempt, then
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
ALTER TABLE "junior_conversations" ADD COLUMN "visibility" text;--> statement-breakpoint
|
|
2
|
+
-- The column is new, so every row is null and passes the constraint. NOT
|
|
3
|
+
-- VALID skips the scan under lock and still checks every new write.
|
|
4
|
+
ALTER TABLE "junior_conversations" ADD CONSTRAINT "junior_conversations_visibility_check" CHECK ("visibility" is null or "visibility" in ('public', 'private')) NOT VALID;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
{
|
|
2
|
+
"type": "diff",
|
|
3
|
+
"version": "10",
|
|
4
|
+
"dialect": "postgres",
|
|
5
|
+
"id": "7bbde9ec-c4d7-4543-9c2d-fe4a569cff2a",
|
|
6
|
+
"prevIds": ["453e2def-765a-4fb8-8b61-982131badb8b"],
|
|
7
|
+
"footprints": [
|
|
8
|
+
{
|
|
9
|
+
"statementType": "add_column",
|
|
10
|
+
"statementTarget": [
|
|
11
|
+
"column",
|
|
12
|
+
"public",
|
|
13
|
+
"junior_conversations",
|
|
14
|
+
"visibility"
|
|
15
|
+
],
|
|
16
|
+
"writes": [
|
|
17
|
+
"s|col|public.junior_conversations.visibility",
|
|
18
|
+
"n|col|public.junior_conversations.visibility",
|
|
19
|
+
"e|col|public.junior_conversations.visibility"
|
|
20
|
+
],
|
|
21
|
+
"reads": ["n|tbl|public.junior_conversations", "n|sch|public"]
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"statementType": "add_check",
|
|
25
|
+
"statementTarget": ["table", "public", "junior_conversations"],
|
|
26
|
+
"writes": [
|
|
27
|
+
"s|ck|public.junior_conversations.junior_conversations_visibility_check",
|
|
28
|
+
"n|ck|public.junior_conversations.junior_conversations_visibility_check",
|
|
29
|
+
"e|ck|public.junior_conversations.junior_conversations_visibility_check",
|
|
30
|
+
"n|con|public.junior_conversations.junior_conversations_visibility_check"
|
|
31
|
+
],
|
|
32
|
+
"reads": [
|
|
33
|
+
"n|tbl|public.junior_conversations",
|
|
34
|
+
"n|sch|public",
|
|
35
|
+
"n|col|public.junior_conversations.visibility"
|
|
36
|
+
]
|
|
37
|
+
}
|
|
38
|
+
],
|
|
39
|
+
"deltas": [
|
|
40
|
+
{
|
|
41
|
+
"op": "create",
|
|
42
|
+
"row": {
|
|
43
|
+
"schema": "public",
|
|
44
|
+
"table": "junior_conversations",
|
|
45
|
+
"name": "visibility",
|
|
46
|
+
"type": "text",
|
|
47
|
+
"typeSchema": null,
|
|
48
|
+
"notNull": false,
|
|
49
|
+
"dimensions": 0,
|
|
50
|
+
"default": null,
|
|
51
|
+
"generated": null,
|
|
52
|
+
"identity": null,
|
|
53
|
+
"entityType": "columns"
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
"op": "create",
|
|
58
|
+
"row": {
|
|
59
|
+
"schema": "public",
|
|
60
|
+
"table": "junior_conversations",
|
|
61
|
+
"name": "junior_conversations_visibility_check",
|
|
62
|
+
"value": "\"visibility\" is null or \"visibility\" in ('public', 'private')",
|
|
63
|
+
"entityType": "checks"
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
]
|
|
67
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
-- Access now reads visibility from each Conversation row instead of its
|
|
2
|
+
-- root's Destination. Copy the Destination value to each root, then the
|
|
3
|
+
-- root value to each child. Direct and private Destinations are private. A
|
|
4
|
+
-- root with no Destination, or one whose visibility is unknown, stays null,
|
|
5
|
+
-- which reads as private. This runs in its own transaction, after the one
|
|
6
|
+
-- that adds the column, so it holds no table lock that blocks reads.
|
|
7
|
+
-- junior:bounded-backfill: runs once and sets only the new column of each row once. Most Conversations are idle.
|
|
8
|
+
UPDATE "junior_conversations" AS "conversations"
|
|
9
|
+
SET "visibility" = CASE
|
|
10
|
+
WHEN "destinations"."visibility" = 'public' THEN 'public'
|
|
11
|
+
ELSE 'private'
|
|
12
|
+
END
|
|
13
|
+
FROM "junior_destinations" AS "destinations"
|
|
14
|
+
WHERE "destinations"."id" = "conversations"."destination_id"
|
|
15
|
+
AND "conversations"."parent_conversation_id" IS NULL
|
|
16
|
+
AND "destinations"."visibility" <> 'unknown'
|
|
17
|
+
AND "conversations"."visibility" IS NULL;--> statement-breakpoint
|
|
18
|
+
-- junior:bounded-backfill: runs once and sets only the new column of each child once, from its root.
|
|
19
|
+
UPDATE "junior_conversations" AS "children"
|
|
20
|
+
SET "visibility" = "roots"."visibility"
|
|
21
|
+
FROM "junior_conversations" AS "roots"
|
|
22
|
+
WHERE "roots"."conversation_id" = "children"."root_conversation_id"
|
|
23
|
+
AND "children"."parent_conversation_id" IS NOT NULL
|
|
24
|
+
AND "roots"."visibility" IS NOT NULL
|
|
25
|
+
AND "children"."visibility" IS NULL;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
-- Drop the `junior_notify_versions` triggers and function from
|
|
2
|
+
-- 20261125124506_versions_notify. Only the dashboard versions stream listened
|
|
3
|
+
-- to them, and only release 0.315.0 shipped it. The release after 0.315.0
|
|
4
|
+
-- removes the stream. Code in 0.315.0 still works without them: an open
|
|
5
|
+
-- stream gets no change, and the client reads fresh tokens when the stream
|
|
6
|
+
-- reconnects or the poll runs.
|
|
7
|
+
DROP TRIGGER IF EXISTS "junior_notify_versions" ON "junior_conversations";--> statement-breakpoint
|
|
8
|
+
DROP TRIGGER IF EXISTS "junior_notify_versions" ON "junior_conversation_participants";--> statement-breakpoint
|
|
9
|
+
DROP TRIGGER IF EXISTS "junior_notify_versions" ON "junior_conversation_annotations";--> statement-breakpoint
|
|
10
|
+
DROP TRIGGER IF EXISTS "junior_notify_versions" ON "junior_inbox_items";--> statement-breakpoint
|
|
11
|
+
DROP TRIGGER IF EXISTS "junior_notify_versions" ON "junior_conversation_metrics";--> statement-breakpoint
|
|
12
|
+
DROP TRIGGER IF EXISTS "junior_notify_versions" ON "junior_attachments";--> statement-breakpoint
|
|
13
|
+
DROP TRIGGER IF EXISTS "junior_notify_versions" ON "junior_identities";--> statement-breakpoint
|
|
14
|
+
DROP TRIGGER IF EXISTS "junior_notify_versions" ON "junior_users";--> statement-breakpoint
|
|
15
|
+
DROP TRIGGER IF EXISTS "junior_notify_versions" ON "junior_destinations";--> statement-breakpoint
|
|
16
|
+
DROP TRIGGER IF EXISTS "junior_notify_versions" ON "junior_inbox_snoozes";--> statement-breakpoint
|
|
17
|
+
DROP TRIGGER IF EXISTS "junior_notify_versions" ON "junior_conversation_events";--> statement-breakpoint
|
|
18
|
+
-- squawk-ignore ban-drop-function -- unused since 0.315.0
|
|
19
|
+
DROP FUNCTION IF EXISTS "junior_notify_versions"();
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
-- The `root` kind is now `thread`, and a `thread` may have a parent. A
|
|
2
|
+
-- writer of the previous deploy still writes `root`, so this trigger stores
|
|
3
|
+
-- it as `thread`, and both checks accept both values until every writer
|
|
4
|
+
-- stores `thread`. NOT VALID skips the scan under lock, and every new write
|
|
5
|
+
-- is checked. The next migration moves the stored `root` rows to `thread`.
|
|
6
|
+
-- Each new check accepts every value that the dropped one accepted, so the
|
|
7
|
+
-- release that is live during the deploy keeps writing.
|
|
8
|
+
-- squawk-ignore ban-drop-constraint -- unused since 0.315.0
|
|
9
|
+
ALTER TABLE "junior_conversations" DROP CONSTRAINT "junior_conversations_kind_check";--> statement-breakpoint
|
|
10
|
+
-- squawk-ignore ban-drop-constraint -- unused since 0.315.0
|
|
11
|
+
ALTER TABLE "junior_conversations" DROP CONSTRAINT "junior_conversations_kind_parent_check";--> statement-breakpoint
|
|
12
|
+
ALTER TABLE "junior_conversations" ADD CONSTRAINT "junior_conversations_kind_check" CHECK ("kind" in ('root', 'thread', 'automation', 'lead', 'task')) NOT VALID;--> statement-breakpoint
|
|
13
|
+
ALTER TABLE "junior_conversations" ADD CONSTRAINT "junior_conversations_kind_parent_check" CHECK ("kind" is null or "kind" in ('root', 'thread') or (("kind" in ('automation', 'lead')) = ("parent_conversation_id" is null))) NOT VALID;--> statement-breakpoint
|
|
14
|
+
CREATE OR REPLACE FUNCTION "junior_conversations_kind_root_to_thread"()
|
|
15
|
+
RETURNS trigger
|
|
16
|
+
LANGUAGE plpgsql
|
|
17
|
+
AS $function$
|
|
18
|
+
BEGIN
|
|
19
|
+
NEW."kind" := 'thread';
|
|
20
|
+
RETURN NEW;
|
|
21
|
+
END
|
|
22
|
+
$function$;--> statement-breakpoint
|
|
23
|
+
CREATE TRIGGER "junior_conversations_kind_root_to_thread" BEFORE INSERT OR UPDATE ON "junior_conversations" FOR EACH ROW WHEN (NEW."kind" = 'root') EXECUTE FUNCTION "junior_conversations_kind_root_to_thread"();
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
{
|
|
2
|
+
"type": "diff",
|
|
3
|
+
"version": "10",
|
|
4
|
+
"dialect": "postgres",
|
|
5
|
+
"id": "ce981d67-12ad-415c-bc30-6066fbccc4ef",
|
|
6
|
+
"prevIds": ["df7b3240-6223-4c94-ab4c-da5347b0d335"],
|
|
7
|
+
"footprints": [
|
|
8
|
+
{
|
|
9
|
+
"statementType": "alter_check",
|
|
10
|
+
"statementTarget": ["table", "public", "junior_conversations"],
|
|
11
|
+
"writes": [
|
|
12
|
+
"s|ck|public.junior_conversations.junior_conversations_kind_check"
|
|
13
|
+
],
|
|
14
|
+
"reads": [
|
|
15
|
+
"n|tbl|public.junior_conversations",
|
|
16
|
+
"n|sch|public",
|
|
17
|
+
"n|col|public.junior_conversations.kind",
|
|
18
|
+
"e|col|public.junior_conversations.kind"
|
|
19
|
+
],
|
|
20
|
+
"sqlHash": "345e5044564ea1db"
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"statementType": "alter_check",
|
|
24
|
+
"statementTarget": ["table", "public", "junior_conversations"],
|
|
25
|
+
"writes": [
|
|
26
|
+
"s|ck|public.junior_conversations.junior_conversations_kind_parent_check"
|
|
27
|
+
],
|
|
28
|
+
"reads": [
|
|
29
|
+
"n|tbl|public.junior_conversations",
|
|
30
|
+
"n|sch|public",
|
|
31
|
+
"n|col|public.junior_conversations.kind",
|
|
32
|
+
"n|col|public.junior_conversations.parent_conversation_id",
|
|
33
|
+
"e|col|public.junior_conversations.kind",
|
|
34
|
+
"e|col|public.junior_conversations.parent_conversation_id"
|
|
35
|
+
],
|
|
36
|
+
"sqlHash": "d3fa5107402d76be"
|
|
37
|
+
}
|
|
38
|
+
],
|
|
39
|
+
"deltas": [
|
|
40
|
+
{
|
|
41
|
+
"op": "alter",
|
|
42
|
+
"key": "checks\u0000[\"public\",\"junior_conversations\",\"junior_conversations_kind_check\"]",
|
|
43
|
+
"set": {
|
|
44
|
+
"value": "\"kind\" in ('root', 'thread', 'automation', 'lead', 'task')"
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
"op": "alter",
|
|
49
|
+
"key": "checks\u0000[\"public\",\"junior_conversations\",\"junior_conversations_kind_parent_check\"]",
|
|
50
|
+
"set": {
|
|
51
|
+
"value": "\"kind\" is null or \"kind\" in ('root', 'thread') or ((\"kind\" in ('automation', 'lead')) = (\"parent_conversation_id\" is null))"
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
]
|
|
55
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
-- The `root` kind is now `thread`. This runs in its own transaction, after
|
|
2
|
+
-- the one that changes the checks, so it holds no table lock that blocks
|
|
3
|
+
-- reads.
|
|
4
|
+
-- junior:bounded-backfill: runs once and sets only the kind of each `root` row once. Most Conversations are idle.
|
|
5
|
+
UPDATE "junior_conversations"
|
|
6
|
+
SET "kind" = 'thread'
|
|
7
|
+
WHERE "kind" = 'root';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
CREATE INDEX CONCURRENTLY IF NOT EXISTS "junior_conversation_events_message_role_seq_idx" ON "junior_conversation_events" ("conversation_id",("payload"->>'role'),"seq") WHERE "type" = 'message';
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
{
|
|
2
|
+
"type": "diff",
|
|
3
|
+
"version": "10",
|
|
4
|
+
"dialect": "postgres",
|
|
5
|
+
"id": "d643f037-e1f1-41fd-a368-e705f2818a34",
|
|
6
|
+
"prevIds": ["df7b3240-6223-4c94-ab4c-da5347b0d335"],
|
|
7
|
+
"footprints": [
|
|
8
|
+
{
|
|
9
|
+
"statementType": "create_index",
|
|
10
|
+
"statementTarget": [
|
|
11
|
+
"index",
|
|
12
|
+
"public",
|
|
13
|
+
"junior_conversation_events",
|
|
14
|
+
"junior_conversation_events_message_role_seq_idx"
|
|
15
|
+
],
|
|
16
|
+
"writes": [
|
|
17
|
+
"s|idx|public.junior_conversation_events_message_role_seq_idx",
|
|
18
|
+
"n|idx|public.junior_conversation_events_message_role_seq_idx",
|
|
19
|
+
"e|idx|public.junior_conversation_events_message_role_seq_idx",
|
|
20
|
+
"n|rel|public.junior_conversation_events_message_role_seq_idx"
|
|
21
|
+
],
|
|
22
|
+
"reads": [
|
|
23
|
+
"n|tbl|public.junior_conversation_events",
|
|
24
|
+
"n|sch|public",
|
|
25
|
+
"n|col|public.junior_conversation_events.conversation_id",
|
|
26
|
+
"n|col|public.junior_conversation_events.seq"
|
|
27
|
+
]
|
|
28
|
+
}
|
|
29
|
+
],
|
|
30
|
+
"deltas": [
|
|
31
|
+
{
|
|
32
|
+
"op": "create",
|
|
33
|
+
"row": {
|
|
34
|
+
"schema": "public",
|
|
35
|
+
"table": "junior_conversation_events",
|
|
36
|
+
"name": "junior_conversation_events_message_role_seq_idx",
|
|
37
|
+
"nameExplicit": true,
|
|
38
|
+
"columns": [
|
|
39
|
+
{
|
|
40
|
+
"value": "conversation_id",
|
|
41
|
+
"isExpression": false,
|
|
42
|
+
"asc": true,
|
|
43
|
+
"nullsFirst": false,
|
|
44
|
+
"opclass": null
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
"value": "(\"payload\"->>'role')",
|
|
48
|
+
"isExpression": true,
|
|
49
|
+
"asc": true,
|
|
50
|
+
"nullsFirst": false,
|
|
51
|
+
"opclass": null
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
"value": "seq",
|
|
55
|
+
"isExpression": false,
|
|
56
|
+
"asc": true,
|
|
57
|
+
"nullsFirst": false,
|
|
58
|
+
"opclass": null
|
|
59
|
+
}
|
|
60
|
+
],
|
|
61
|
+
"isUnique": false,
|
|
62
|
+
"where": "\"type\" = 'message'",
|
|
63
|
+
"with": "",
|
|
64
|
+
"method": "btree",
|
|
65
|
+
"entityType": "indexes"
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
]
|
|
69
|
+
}
|