@sentry/junior 0.254.0 → 0.255.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.
Files changed (60) hide show
  1. package/dist/{admin-D7kYbu5l.js → admin-CeJh4SuR.js} +1 -1
  2. package/dist/{agent-hooks-DfPubHYm.js → agent-hooks-CDVx26Uu.js} +8 -8
  3. package/dist/{agent-runner-BWmnJ0dD.js → agent-runner-Caiof09f.js} +24 -21
  4. package/dist/api/schema.d.ts +0 -8
  5. package/dist/api/schema.js +2 -2
  6. package/dist/api.js +60 -70
  7. package/dist/app.js +36 -36
  8. package/dist/{assistant-reply-B3J6ogAM.js → assistant-reply-BddmM66R.js} +1 -1
  9. package/dist/{automation-gznOMaQ2.js → automation-CHdlHVZP.js} +3 -4
  10. package/dist/{briefs-B_fgUFD2.js → briefs-iVq_8-ft.js} +2 -2
  11. package/dist/{catalog-runtime-TG5WF66H.js → catalog-runtime-hKmI-iZa.js} +1 -1
  12. package/dist/cli/chat.js +15 -15
  13. package/dist/cli/check.js +3 -3
  14. package/dist/cli/main.js +2 -2
  15. package/dist/cli/plugins.js +4 -4
  16. package/dist/cli/snapshot-create.js +3 -3
  17. package/dist/cli/upgrade.js +3 -3
  18. package/dist/{client-oBgOmQV6.js → client-Clj7onnT.js} +2 -2
  19. package/dist/{config-CRlLncIj.js → config-BDAfLTI9.js} +2 -2
  20. package/dist/{connections-BZAuDnYm.js → connections-BC0RTejT.js} +9 -9
  21. package/dist/{conversation-privacy-Dui3hTO-.js → conversation-privacy-1ERtieuM.js} +1 -1
  22. package/dist/{credential-sync-9HiSpphh.js → credential-sync-BZuqqIHk.js} +14 -14
  23. package/dist/{executor-B88oEqok.js → executor-Dh4Ofsnx.js} +5 -6
  24. package/dist/{images-k8HewSp_.js → images-C-WOnTc_.js} +2 -2
  25. package/dist/instrumentation.js +2 -2
  26. package/dist/{job-queue-B6KaQXY6.js → job-queue-BaCL36FY.js} +1 -1
  27. package/dist/{logging-B3nJLXT7.js → logging-D3aYP0aG.js} +1 -1
  28. package/dist/{message-C9Wx3Rxx.js → message-B9xqD2BP.js} +3 -3
  29. package/dist/nitro.js +3 -3
  30. package/dist/{oauth-callback-server-CetsCZng.js → oauth-callback-server-i5qdAou6.js} +2 -2
  31. package/dist/{pending-auth-m8aJlwP_.js → pending-auth-D2t1Moxf.js} +2 -2
  32. package/dist/{profile-Dh73O6lZ.js → profile-DnkX3e2S.js} +4 -4
  33. package/dist/{registry-C-jns0Be.js → registry-CmKmKHpp.js} +1 -1
  34. package/dist/{resolve-CDYCpS_U.js → resolve-jfNHtEBx.js} +2 -2
  35. package/dist/{result-sih-x_yN.js → result-Df5nEDX2.js} +6 -6
  36. package/dist/{runner-CA43p74t.js → runner-CmzoXEI4.js} +9 -9
  37. package/dist/{sandbox-egress-signals-CxHHTu8e.js → sandbox-egress-signals-DjMNKLZz.js} +1 -1
  38. package/dist/{schema-C-a9U34c.js → schema-BBgv0MNf.js} +1 -1
  39. package/dist/{session-stop-DenN1GuJ.js → session-stop-BEBfE97J.js} +10 -10
  40. package/dist/{skills-D_XDFkSx.js → skills-Dc-AMYi4.js} +2 -2
  41. package/dist/{spawn-CcWYt3Tl.js → spawn-OgTwBUj0.js} +2 -2
  42. package/dist/{store-CIs0Tr31.js → store-BashBewg.js} +6 -6
  43. package/dist/{task-queue-DAY-aQLX.js → task-queue-VvIKqlQ4.js} +3 -3
  44. package/dist/{task-runner-BE6Jgt2u.js → task-runner-D2CpD6GN.js} +10 -10
  45. package/dist/{tasks-DO9VM9cu.js → tasks-dJooqiip.js} +16 -26
  46. package/dist/{thread-state-FreaCOZD.js → thread-state-CsMC-ob0.js} +6 -6
  47. package/dist/{turn-failure-response-CJSt2ZSf.js → turn-failure-response-zB364t7_.js} +7 -7
  48. package/dist/{turn-lifecycle-BXclEcfZ.js → turn-lifecycle-BfodfmiY.js} +1 -1
  49. package/dist/{turn-session-routing-CItfUsjQ.js → turn-session-routing-BAh_qsBJ.js} +1 -1
  50. package/dist/{validation-MW8dmhF9.js → validation-LzIilOb6.js} +1 -1
  51. package/dist/{version-DcWD8xpq.js → version-CDM8Rq6E.js} +1 -1
  52. package/dist/version.js +1 -1
  53. package/dist/{viewer-CGZiUVMU.js → viewer-Rnim7alE.js} +3 -3
  54. package/dist/{web-input-Dpqh0oBt.js → web-input-Dc1VwcT4.js} +74 -75
  55. package/dist/{work-DbA9xNO1.js → work-BAn43SsN.js} +9 -9
  56. package/dist/{worker-DuCs9-3G.js → worker-mBXq4_zg.js} +5 -5
  57. package/migrations/0058_automation_creator_identity.sql +45 -0
  58. package/migrations/meta/0058_snapshot.json +3598 -0
  59. package/migrations/meta/_journal.json +7 -0
  60. package/package.json +5 -5
@@ -1,6 +1,6 @@
1
1
  import { r as AGENT_INVOCATION_STATUSES, u as juniorDestinationKindSchema } from "./agent-invocations-BY60iNw-.js";
2
2
  import { D as conversationUsageSchema, E as conversationSummaryReportSchema, M as conversationChildAgentTotalsSchema, l as conversationAuxiliaryCostsSchema, n as actorIdentitySchema, w as conversationStatsItemSchema } from "./conversation-T18Xlkx9.js";
3
- import "./automation-gznOMaQ2.js";
3
+ import "./automation-CHdlHVZP.js";
4
4
  import { a as fillUtcHours, c as sumUtcHoursIntoSixHours, i as fillUtcDays } from "./web-message-id-xPI_EFSC.js";
5
5
  import { z } from "zod";
6
6
  import { codeChangeStateSchema } from "@sentry/junior-plugin-api";
@@ -1,16 +1,16 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-B4FMCO8f.js";
2
- import { d as logException, f as logInfo, p as logWarn } from "./logging-B3nJLXT7.js";
3
- import { n as botConfig } from "./config-CRlLncIj.js";
4
- import { f as getSqlExecutor, u as getConversationStore } from "./viewer-CGZiUVMU.js";
2
+ import { d as logException, f as logInfo, p as logWarn } from "./logging-D3aYP0aG.js";
3
+ import { n as botConfig } from "./config-BDAfLTI9.js";
4
+ import { f as getSqlExecutor, u as getConversationStore } from "./viewer-Rnim7alE.js";
5
5
  import { s as juniorConversations } from "./agent-invocations-BY60iNw-.js";
6
- import "./executor-B88oEqok.js";
7
- import { p as credentialSubjectSchema } from "./registry-C-jns0Be.js";
8
- import { V as postSlackMessage, _t as isToolResultError, ht as isAssistantMessage, vt as isToolResultMessage, wt as ToolInputError, yt as normalizeToolNameFromResult } from "./tasks-DO9VM9cu.js";
9
- import { it as JUNIOR_THREAD_STATE_TTL_MS, rt as verifyTimerWatchCredentialSubject, u as getPlugins } from "./agent-hooks-DfPubHYm.js";
10
- import { w as getStateAdapter } from "./profile-Dh73O6lZ.js";
11
- import { r as sanitizeAssistantText } from "./assistant-reply-B3J6ogAM.js";
6
+ import "./executor-Dh4Ofsnx.js";
7
+ import { p as credentialSubjectSchema } from "./registry-CmKmKHpp.js";
8
+ import { St as ToolInputError, _t as normalizeToolNameFromResult, gt as isToolResultMessage, ht as isToolResultError, pt as isAssistantMessage, z as postSlackMessage } from "./tasks-dJooqiip.js";
9
+ import { it as JUNIOR_THREAD_STATE_TTL_MS, rt as verifyTimerWatchCredentialSubject, u as getPlugins } from "./agent-hooks-CDVx26Uu.js";
10
+ import { w as getStateAdapter } from "./profile-DnkX3e2S.js";
11
+ import { r as sanitizeAssistantText } from "./assistant-reply-BddmM66R.js";
12
12
  import { r as EVENT_AUTHOR_ID } from "./prompt-C04mP1hu.js";
13
- import { r as appendAndEnqueueInboundMessage } from "./store-CIs0Tr31.js";
13
+ import { r as appendAndEnqueueInboundMessage } from "./store-BashBewg.js";
14
14
  import { z } from "zod";
15
15
  import { eq, inArray } from "drizzle-orm";
16
16
  import { eventMatchSchema, normalizeEventIdentifier, objectTypeSchema } from "@sentry/junior-plugin-api";
@@ -1,7 +1,7 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-B4FMCO8f.js";
2
- import { p as logWarn } from "./logging-B3nJLXT7.js";
2
+ import { p as logWarn } from "./logging-D3aYP0aG.js";
3
3
  import { s as skillRoots } from "./package-discovery-BVvSnQBB.js";
4
- import { n as pluginCatalogRuntime } from "./catalog-runtime-TG5WF66H.js";
4
+ import { n as pluginCatalogRuntime } from "./catalog-runtime-hKmI-iZa.js";
5
5
  import path from "node:path";
6
6
  import { z } from "zod";
7
7
  import fs from "node:fs/promises";
@@ -1,6 +1,6 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-B4FMCO8f.js";
2
- import { Ht as toolInvocationDestination, Vt as actorFromRun } from "./agent-runner-BWmnJ0dD.js";
3
- import { n as createAndEnqueueAgentInvocation } from "./work-DbA9xNO1.js";
2
+ import { Ht as toolInvocationDestination, Vt as actorFromRun } from "./agent-runner-Caiof09f.js";
3
+ import { n as createAndEnqueueAgentInvocation } from "./work-BAn43SsN.js";
4
4
  //#region src/chat/agent-invocations/spawn.ts
5
5
  var spawn_exports = /* @__PURE__ */ __exportAll({ bindSpawnAgent: () => bindSpawnAgent });
6
6
  /** Bind a Run's Actor and credentials to new Agent invocations. */
@@ -1,10 +1,10 @@
1
- import { I as isRecord, L as toOptionalNumber, R as toOptionalString } from "./logging-B3nJLXT7.js";
2
- import { i as getChatConfig } from "./config-CRlLncIj.js";
1
+ import { I as isRecord, L as toOptionalNumber, R as toOptionalString } from "./logging-D3aYP0aG.js";
2
+ import { i as getChatConfig } from "./config-BDAfLTI9.js";
3
3
  import { s as parseStoredSlackActor } from "./actor-BTtLaeWy.js";
4
- import { F as sameDestination, N as parseDestination, u as getConversationStore } from "./viewer-CGZiUVMU.js";
5
- import { it as JUNIOR_THREAD_STATE_TTL_MS } from "./agent-hooks-DfPubHYm.js";
6
- import { C as getDefaultRedisStateAdapterFor, w as getStateAdapter } from "./profile-Dh73O6lZ.js";
7
- import "./job-queue-B6KaQXY6.js";
4
+ import { F as sameDestination, N as parseDestination, u as getConversationStore } from "./viewer-Rnim7alE.js";
5
+ import { it as JUNIOR_THREAD_STATE_TTL_MS } from "./agent-hooks-CDVx26Uu.js";
6
+ import { C as getDefaultRedisStateAdapterFor, w as getStateAdapter } from "./profile-DnkX3e2S.js";
7
+ import "./job-queue-BaCL36FY.js";
8
8
  import { z } from "zod";
9
9
  import { randomUUID } from "node:crypto";
10
10
  import { destinationSchema } from "@sentry/junior-plugin-api";
@@ -1,5 +1,5 @@
1
- import { p as logWarn } from "./logging-B3nJLXT7.js";
2
- import { c as QUEUE_SIGNATURE_MAX_AGE_MS, d as createVercelQueueClient, l as signQueueMessage, p as runWithTurnRequestDeadline, u as verifyQueueMessage } from "./job-queue-B6KaQXY6.js";
1
+ import { p as logWarn } from "./logging-D3aYP0aG.js";
2
+ import { c as QUEUE_SIGNATURE_MAX_AGE_MS, d as createVercelQueueClient, l as signQueueMessage, p as runWithTurnRequestDeadline, u as verifyQueueMessage } from "./job-queue-BaCL36FY.js";
3
3
  import { z } from "zod";
4
4
  import { createHash } from "node:crypto";
5
5
  import { handleCallback, registerDevConsumer } from "@vercel/queue";
@@ -115,7 +115,7 @@ function pluginTaskCallback() {
115
115
  maxDeliveries: PLUGIN_TASK_MAX_DELIVERIES,
116
116
  onRejected: logPluginTaskQueueMessageRejected,
117
117
  run: async (message) => {
118
- const { processPluginTask } = await import("./task-runner-BE6Jgt2u.js").then((n) => n.r);
118
+ const { processPluginTask } = await import("./task-runner-D2CpD6GN.js").then((n) => n.r);
119
119
  await processPluginTask(message);
120
120
  },
121
121
  topic: PLUGIN_TASK_QUEUE_TOPIC,
@@ -1,17 +1,17 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-B4FMCO8f.js";
2
- import { h as runBestEffort, p as logWarn } from "./logging-B3nJLXT7.js";
2
+ import { h as runBestEffort, p as logWarn } from "./logging-D3aYP0aG.js";
3
3
  import { g as parseSlackMessageTs } from "./actor-BTtLaeWy.js";
4
- import { C as agentTurnTotalTokens, S as agentTurnCostUsd, d as getDb, r as readActorIdentity, u as getConversationStore } from "./viewer-CGZiUVMU.js";
4
+ import { C as agentTurnTotalTokens, S as agentTurnCostUsd, d as getDb, r as readActorIdentity, u as getConversationStore } from "./viewer-Rnim7alE.js";
5
5
  import { s as juniorConversations } from "./agent-invocations-BY60iNw-.js";
6
- import { o as juniorAutomationRuns, s as juniorAutomations } from "./executor-B88oEqok.js";
6
+ import { o as juniorAutomationRuns, s as juniorAutomations } from "./executor-Dh4Ofsnx.js";
7
7
  import { m as sameActorIdentity } from "./history-9pO1Zd4Y.js";
8
- import { p as credentialSubjectSchema } from "./registry-C-jns0Be.js";
9
- import { Gt as hydrateConversationMessages, M as formatSlackLink, Q as getTurnRecord, V as postSlackMessage, Zt as fallbackShortTitle, _t as isToolResultError, a as readScheduledAutomation, g as getEventAutomation, j as escapeSlackMrkdwnText, mt as instructionTextForProjection, u as blockEventAutomation, ut as getPiMessageRole, vt as isToolResultMessage, xt as stripRuntimeTurnContext, yt as normalizeToolNameFromResult, z as openSlackDirectMessage } from "./tasks-DO9VM9cu.js";
10
- import { St as createPluginConversationEvents, dt as createPluginModel, ft as createPluginLogger, it as JUNIOR_THREAD_STATE_TTL_MS, lt as createPluginState, p as coreTaskRegistrations, st as getDashboardTaskLink, u as getPlugins, ut as createPluginEmbedder } from "./agent-hooks-DfPubHYm.js";
11
- import { w as getStateAdapter } from "./profile-Dh73O6lZ.js";
12
- import { r as getPersistedThreadState, s as coerceThreadConversationState } from "./thread-state-FreaCOZD.js";
13
- import { t as resolveConversationRouting } from "./turn-session-routing-CItfUsjQ.js";
14
- import { i as pluginTaskParamsSchema, o as sendVercelPluginTask, r as pluginTaskId } from "./task-queue-DAY-aQLX.js";
8
+ import { p as credentialSubjectSchema } from "./registry-CmKmKHpp.js";
9
+ import { A as formatSlackLink, L as openSlackDirectMessage, Ut as hydrateConversationMessages, X as getTurnRecord, Yt as fallbackShortTitle, _t as normalizeToolNameFromResult, ct as getPiMessageRole, ft as instructionTextForProjection, gt as isToolResultMessage, ht as isToolResultError, i as readScheduledAutomation, k as escapeSlackMrkdwnText, l as blockEventAutomation, m as getEventAutomation, yt as stripRuntimeTurnContext, z as postSlackMessage } from "./tasks-dJooqiip.js";
10
+ import { St as createPluginConversationEvents, dt as createPluginModel, ft as createPluginLogger, it as JUNIOR_THREAD_STATE_TTL_MS, lt as createPluginState, p as coreTaskRegistrations, st as getDashboardTaskLink, u as getPlugins, ut as createPluginEmbedder } from "./agent-hooks-CDVx26Uu.js";
11
+ import { w as getStateAdapter } from "./profile-DnkX3e2S.js";
12
+ import { r as getPersistedThreadState, s as coerceThreadConversationState } from "./thread-state-CsMC-ob0.js";
13
+ import { t as resolveConversationRouting } from "./turn-session-routing-BAh_qsBJ.js";
14
+ import { i as pluginTaskParamsSchema, o as sendVercelPluginTask, r as pluginTaskId } from "./task-queue-VvIKqlQ4.js";
15
15
  import { z } from "zod";
16
16
  import { createHash } from "node:crypto";
17
17
  import { and, asc, count, desc, eq, gte, inArray, isNotNull, lte, max, sql } from "drizzle-orm";
@@ -1,16 +1,16 @@
1
- import { d as unwrapCurrentInstruction, f as escapeXml, i as completeText, o as resolveGatewayModel } from "./client-oBgOmQV6.js";
2
- import { d as logException, o as getActiveTraceId, p as logWarn, s as getLogContextAttributes, t as buildTurnFailureResponse, v as setSpanAttributes } from "./logging-B3nJLXT7.js";
1
+ import { d as unwrapCurrentInstruction, f as escapeXml, i as completeText, o as resolveGatewayModel } from "./client-Clj7onnT.js";
2
+ import { d as logException, o as getActiveTraceId, p as logWarn, s as getLogContextAttributes, t as buildTurnFailureResponse, v as setSpanAttributes } from "./logging-D3aYP0aG.js";
3
3
  import { n as captureMessage } from "./sentry-CgWZM_kV.js";
4
- import { n as botConfig, v as normalizeSlackEmojiName } from "./config-CRlLncIj.js";
4
+ import { n as botConfig, v as normalizeSlackEmojiName } from "./config-BDAfLTI9.js";
5
5
  import { c as toStoredSlackActor, f as parseSlackUserId, g as parseSlackMessageTs } from "./actor-BTtLaeWy.js";
6
- import { c as getConversationEventStore, f as getSqlExecutor, m as withConversationEventLock, p as createSqlConversationEventStore, u as getConversationStore, v as startLocationThread, x as addAgentTurnUsage, y as bindProviderConversation } from "./viewer-CGZiUVMU.js";
7
- import { a as juniorAutomationVersions, o as juniorAutomationRuns, s as juniorAutomations } from "./executor-B88oEqok.js";
6
+ import { c as getConversationEventStore, f as getSqlExecutor, m as withConversationEventLock, p as createSqlConversationEventStore, u as getConversationStore, v as startLocationThread, x as addAgentTurnUsage, y as bindProviderConversation } from "./viewer-Rnim7alE.js";
7
+ import { a as juniorAutomationVersions, o as juniorAutomationRuns, s as juniorAutomations } from "./executor-Dh4Ofsnx.js";
8
8
  import { d as contextProvenance, f as instructionActors, n as agentHistoryItemSchema, p as instructionProvenanceFor } from "./history-9pO1Zd4Y.js";
9
- import { p as credentialSubjectSchema } from "./registry-C-jns0Be.js";
10
- import { $t as authenticationUnlinkedEvent, Gt as normalizeSlackConversationId, Ht as getSlackClient, Qt as authenticationLinkedEvent, Rt as SlackActionError, Xt as JUNIOR_NATIVE_EVENT_NAMESPACE, Zt as agentsInstructionsUpdatedEvent, n as applyPluginFormatMarkdown, qt as withSlackRetries } from "./agent-hooks-DfPubHYm.js";
9
+ import { p as credentialSubjectSchema } from "./registry-CmKmKHpp.js";
10
+ import { $t as authenticationUnlinkedEvent, Gt as normalizeSlackConversationId, Ht as getSlackClient, Qt as authenticationLinkedEvent, Rt as SlackActionError, Xt as JUNIOR_NATIVE_EVENT_NAMESPACE, Zt as agentsInstructionsUpdatedEvent, n as applyPluginFormatMarkdown, qt as withSlackRetries } from "./agent-hooks-CDVx26Uu.js";
11
11
  import { G as messageCardRef } from "./conversation-T18Xlkx9.js";
12
- import { D as fenceLock, O as withLock, T as MUTATION_LOCK_TTL_MS, k as sleep, w as getStateAdapter } from "./profile-Dh73O6lZ.js";
13
- import { A as eventAutomationSchema, E as scheduledAutomationSchema, S as automationVersionSchema } from "./automation-gznOMaQ2.js";
12
+ import { D as fenceLock, O as withLock, T as MUTATION_LOCK_TTL_MS, k as sleep, w as getStateAdapter } from "./profile-DnkX3e2S.js";
13
+ import { A as eventAutomationSchema, E as scheduledAutomationSchema, S as automationVersionSchema } from "./automation-CHdlHVZP.js";
14
14
  import { isDeepStrictEqual } from "node:util";
15
15
  import { z } from "zod";
16
16
  import { createHash } from "node:crypto";
@@ -2971,9 +2971,10 @@ async function clearEventAutomationRuns(automationId, state = getStateAdapter())
2971
2971
  */
2972
2972
  function eventAutomationColumns(task) {
2973
2973
  const { status: _status, statusReason: _statusReason, title, ...definition } = task;
2974
- const { createdAtMs: _createdAtMs, id: _id, ...record } = eventAutomationSchema.parse(definition);
2974
+ const { createdAtMs: _createdAtMs, creatorIdentityId, id: _id, ...record } = eventAutomationSchema.parse(definition);
2975
2975
  return {
2976
2976
  channelId: record.destination.channelId,
2977
+ creatorIdentityId,
2977
2978
  creatorSlackUserId: record.createdBy.slackUserId,
2978
2979
  identifier: record.trigger.identifier,
2979
2980
  instruction: record.task.text,
@@ -2988,6 +2989,7 @@ function parseEventAutomationRow(row) {
2988
2989
  const task = eventAutomationSchema.parse({
2989
2990
  ...row.record,
2990
2991
  createdAtMs: row.createdAtMs,
2992
+ creatorIdentityId: row.creatorIdentityId,
2991
2993
  id: row.id
2992
2994
  });
2993
2995
  const title = row.title?.trim();
@@ -3065,22 +3067,14 @@ async function deleteEventAutomation(db, id) {
3065
3067
  async function listEventAutomationsForTeam(db, teamId) {
3066
3068
  return (await db.select().from(juniorAutomations).where(and(eq(juniorAutomations.teamId, teamId), activeEventAutomationWhere())).orderBy(asc(juniorAutomations.createdAtMs), asc(juniorAutomations.id))).map(parseEventAutomationRow);
3067
3069
  }
3068
- function viewerSlackIdentities(user) {
3069
- return user.identities.filter((identity) => identity.provider === "slack" && Boolean(identity.providerTenantId) && Boolean(identity.providerSubjectId));
3070
- }
3071
- /** Return whether one event automation was created by a viewer-linked Slack identity. */
3072
- function eventAutomationBelongsToUser(task, user) {
3073
- return viewerSlackIdentities(user).some((identity) => identity.providerTenantId === task.destination.teamId && identity.providerSubjectId === task.createdBy.slackUserId);
3074
- }
3075
3070
  /**
3076
3071
  * List deleted event automations created by one user, newest first.
3077
3072
  * Used only to keep historical runs after the live automation list drops the row.
3078
3073
  */
3079
3074
  async function listDeletedEventAutomationsCreatedBy(db, user, limit) {
3080
- const identities = viewerSlackIdentities(user);
3081
- const ownership = or(...identities.map((identity) => and(eq(juniorAutomations.teamId, identity.providerTenantId), eq(juniorAutomations.creatorSlackUserId, identity.providerSubjectId))));
3082
- if (!ownership) return [];
3083
- return (await db.select().from(juniorAutomations).where(and(ownership, eq(juniorAutomations.kind, "event"), eq(juniorAutomations.status, "deleted"))).orderBy(desc(juniorAutomations.createdAtMs), desc(juniorAutomations.id)).limit(limit)).map(parseEventAutomationRow);
3075
+ const identityIds = user.identities.map((identity) => identity.id);
3076
+ if (identityIds.length === 0) return [];
3077
+ return (await db.select().from(juniorAutomations).where(and(inArray(juniorAutomations.creatorIdentityId, identityIds), eq(juniorAutomations.kind, "event"), eq(juniorAutomations.status, "deleted"))).orderBy(desc(juniorAutomations.createdAtMs), desc(juniorAutomations.id)).limit(limit)).map(parseEventAutomationRow);
3084
3078
  }
3085
3079
  /**
3086
3080
  * Collect match keys from live event automations for these identifiers and event types.
@@ -3231,10 +3225,6 @@ async function readScheduledAutomation(db, taskId) {
3231
3225
  async function readListedScheduledAutomations(db, teamId) {
3232
3226
  return (await db.select().from(juniorAutomations).where(and(eq(juniorAutomations.kind, "scheduled"), ne(juniorAutomations.status, "deleted"), teamId === void 0 ? void 0 : eq(juniorAutomations.teamId, teamId))).orderBy(asc(juniorAutomations.createdAtMs), asc(juniorAutomations.id))).map(parseScheduledAutomationRow).filter(isListedScheduledAutomation);
3233
3227
  }
3234
- /** List decoded scheduled automations in stable creation order. */
3235
- async function listScheduledAutomations(db) {
3236
- return await readListedScheduledAutomations(db);
3237
- }
3238
3228
  /** List decoded scheduled automations for one team in stable creation order. */
3239
3229
  async function listScheduledAutomationsForTeam(db, teamId) {
3240
3230
  return await readListedScheduledAutomations(db, teamId);
@@ -3280,4 +3270,4 @@ async function saveScheduledAutomationInLock(db, task, current) {
3280
3270
  await writeScheduledAutomation(db, requireStoredTask(task), current);
3281
3271
  }
3282
3272
  //#endregion
3283
- export { listTurnSummaries as $, appendThreadContextMessages as $t, requireAutomationRevision as A, loadProjection as At, postSlackEphemeralMessage as B, recordMcpProviderConnected as Bt, eventAutomationRunLimitReason as C, TURN_CONTEXT_TAG as Ct, sameDefinitionValue as D, loadConnectedMcpProviders as Dt, readAutomationVersion as E, commitMessages as Et, slackMention as F, recordAttachmentsDelivered as Ft, slackExternalRefIdSchema as G, hydrateConversationMessages as Gt, removeReactionFromMessage as H, recordToolExecutionStarted as Ht, truncateStatusText as I, recordAuthenticationLinked as It, saveTurnCheckpoint as J, persistConversationMessageSummaries as Jt, continuableMessages as K, persistConversationMessages as Kt, addReactionToMessage as L, recordAuthorizationCompleted as Lt, formatSlackLink as M, loadTurnRoute as Mt, normalizeSlackReplyMarkdown as N, openConversationProjection as Nt, AutomationConflictError as O, loadConversationProjection as Ot, normalizeSlackStatusText as P, recordAgentsInstructionsUpdated as Pt, getTurnRecord as Q, resolveTaskTitle as Qt, getSlackMessagePermalink as R, recordAuthorizationRequested as Rt, admitEventAutomationRun as S, trimTrailingAssistantMessages as St, listAutomationVersions as T, commitAcceptedReply as Tt, uploadFilesToConversation as U, recordTurnRoute as Ut, postSlackMessage as V, recordSubscribedReplyRoute as Vt, slackEntitySchema as W, appendConversationMessages as Wt, completeTurnRecord as X, settleConversationTitleWork as Xt, abandonTurnRecord as Y, resolveConversationTitle as Yt, failTurnRecord as Z, fallbackShortTitle as Zt, listDeletedEventAutomationsCreatedBy as _, isToolResultError as _t, readScheduledAutomation as a, markConversationMessage as an, TurnToolCallLimitExceededError as at, saveEventAutomation as b, retainRuntimeTurnContext as bt, scheduledRunId as c, turnHasReply as cn, isTurnExecutionLimitExceededError as ct, collectEventAutomationMatchKeys as d, getAgentContextCompactionTriggerTokens as dn, getTerminalAssistantMessages as dt, buildConversationContext as en, recordTurnSummary as et, createEventAutomation as f, getAgentContextInputLimitTokens as fn, getUserMessageInstructionText as ft, getEventAutomation as g, isContinuablePiBoundary as gt, findMatchingEventAutomations as h, isAssistantMessage as ht, parseScheduledAutomationRow as i, isHumanConversationMessage as in, TurnSliceLimitExceededError as it, escapeSlackMrkdwnText as j, loadTurnProjection as jt, automationRevision as k, loadLastModelProfile as kt, withScheduledAutomationLock as l, upsertConversationMessage as ln, extractAssistantText as lt, eventAutomationBelongsToUser as m, piMessageFromHistoryItem as mn, instructionTextForProjection as mt, listScheduledAutomations as n, estimateConversationContextTokens as nn, TURN_LIMIT_DISABLED_REASON as nt, saveScheduledAutomation as o, normalizeConversationText as on, buildTurnErrorResponse as ot, deleteEventAutomation as p, historyItemFromPiMessage as pn, hasRuntimeTurnContext as pt, loadTurnCheckpoint as q, projectConversationMessages as qt, listScheduledAutomationsForTeam as r, getConversationMessageSlackTs as rn, TurnBudgetExceededError as rt, saveScheduledAutomationInLock as s, recordDeliveredAssistantMessage as sn, createTurnLimitGate as st, createScheduledAutomation as t, createConversationMemoryService as tn, persistWithRetry as tt, blockEventAutomation as u, estimateTextTokens as un, getPiMessageRole as ut, listEventAutomationsForTeam as v, isToolResultMessage as vt, automationDefinition as w, ToolInputError as wt, setEventAutomationStatus as x, stripRuntimeTurnContext as xt, parseEventAutomationRow as y, normalizeToolNameFromResult as yt, openSlackDirectMessage as z, recordGuardianActionReviewed as zt };
3273
+ export { persistWithRetry as $, createConversationMemoryService as $t, formatSlackLink as A, loadTurnRoute as At, removeReactionFromMessage as B, recordToolExecutionStarted as Bt, listAutomationVersions as C, commitAcceptedReply as Ct, automationRevision as D, loadLastModelProfile as Dt, AutomationConflictError as E, loadConversationProjection as Et, addReactionToMessage as F, recordAuthorizationCompleted as Ft, loadTurnCheckpoint as G, projectConversationMessages as Gt, slackEntitySchema as H, appendConversationMessages as Ht, getSlackMessagePermalink as I, recordAuthorizationRequested as It, completeTurnRecord as J, settleConversationTitleWork as Jt, saveTurnCheckpoint as K, persistConversationMessageSummaries as Kt, openSlackDirectMessage as L, recordGuardianActionReviewed as Lt, normalizeSlackStatusText as M, recordAgentsInstructionsUpdated as Mt, slackMention as N, recordAttachmentsDelivered as Nt, requireAutomationRevision as O, loadProjection as Ot, truncateStatusText as P, recordAuthenticationLinked as Pt, recordTurnSummary as Q, buildConversationContext as Qt, postSlackEphemeralMessage as R, recordMcpProviderConnected as Rt, automationDefinition as S, ToolInputError as St, sameDefinitionValue as T, loadConnectedMcpProviders as Tt, slackExternalRefIdSchema as U, hydrateConversationMessages as Ut, uploadFilesToConversation as V, recordTurnRoute as Vt, continuableMessages as W, persistConversationMessages as Wt, getTurnRecord as X, resolveTaskTitle as Xt, failTurnRecord as Y, fallbackShortTitle as Yt, listTurnSummaries as Z, appendThreadContextMessages as Zt, parseEventAutomationRow as _, normalizeToolNameFromResult as _t, saveScheduledAutomation as a, recordDeliveredAssistantMessage as an, createTurnLimitGate as at, admitEventAutomationRun as b, trimTrailingAssistantMessages as bt, withScheduledAutomationLock as c, estimateTextTokens as cn, getPiMessageRole as ct, createEventAutomation as d, historyItemFromPiMessage as dn, hasRuntimeTurnContext as dt, estimateConversationContextTokens as en, TURN_LIMIT_DISABLED_REASON as et, deleteEventAutomation as f, piMessageFromHistoryItem as fn, instructionTextForProjection as ft, listEventAutomationsForTeam as g, isToolResultMessage as gt, listDeletedEventAutomationsCreatedBy as h, isToolResultError as ht, readScheduledAutomation as i, normalizeConversationText as in, buildTurnErrorResponse as it, normalizeSlackReplyMarkdown as j, openConversationProjection as jt, escapeSlackMrkdwnText as k, loadTurnProjection as kt, blockEventAutomation as l, getAgentContextCompactionTriggerTokens as ln, getTerminalAssistantMessages as lt, getEventAutomation as m, isContinuablePiBoundary as mt, listScheduledAutomationsForTeam as n, isHumanConversationMessage as nn, TurnSliceLimitExceededError as nt, saveScheduledAutomationInLock as o, turnHasReply as on, isTurnExecutionLimitExceededError as ot, findMatchingEventAutomations as p, isAssistantMessage as pt, abandonTurnRecord as q, resolveConversationTitle as qt, parseScheduledAutomationRow as r, markConversationMessage as rn, TurnToolCallLimitExceededError as rt, scheduledRunId as s, upsertConversationMessage as sn, extractAssistantText as st, createScheduledAutomation as t, getConversationMessageSlackTs as tn, TurnBudgetExceededError as tt, collectEventAutomationMatchKeys as u, getAgentContextInputLimitTokens as un, getUserMessageInstructionText as ut, saveEventAutomation as v, retainRuntimeTurnContext as vt, readAutomationVersion as w, commitMessages as wt, eventAutomationRunLimitReason as x, TURN_CONTEXT_TAG as xt, setEventAutomationStatus as y, stripRuntimeTurnContext as yt, postSlackMessage as z, recordSubscribedReplyRoute as zt };
@@ -1,10 +1,10 @@
1
- import { I as isRecord, L as toOptionalNumber, R as toOptionalString } from "./logging-B3nJLXT7.js";
2
- import { d as getDb } from "./viewer-CGZiUVMU.js";
1
+ import { I as isRecord, L as toOptionalNumber, R as toOptionalString } from "./logging-D3aYP0aG.js";
2
+ import { d as getDb } from "./viewer-Rnim7alE.js";
3
3
  import { d as juniorDestinations } from "./agent-invocations-BY60iNw-.js";
4
- import { l as juniorLocationConfigurations } from "./executor-B88oEqok.js";
5
- import { Kt as persistConversationMessages } from "./tasks-DO9VM9cu.js";
6
- import { it as JUNIOR_THREAD_STATE_TTL_MS } from "./agent-hooks-DfPubHYm.js";
7
- import { w as getStateAdapter } from "./profile-Dh73O6lZ.js";
4
+ import { l as juniorLocationConfigurations } from "./executor-Dh4Ofsnx.js";
5
+ import { Wt as persistConversationMessages } from "./tasks-dJooqiip.js";
6
+ import { it as JUNIOR_THREAD_STATE_TTL_MS } from "./agent-hooks-CDVx26Uu.js";
7
+ import { w as getStateAdapter } from "./profile-DnkX3e2S.js";
8
8
  import { z } from "zod";
9
9
  import { randomUUID } from "node:crypto";
10
10
  import { and, eq, sql } from "drizzle-orm";
@@ -1,13 +1,13 @@
1
- import { _ as getProviderErrorUserMessage, g as getProviderErrorAttributes, h as findProviderError, p as ProviderError } from "./client-oBgOmQV6.js";
2
- import { I as isRecord, t as buildTurnFailureResponse } from "./logging-B3nJLXT7.js";
1
+ import { _ as getProviderErrorUserMessage, g as getProviderErrorAttributes, h as findProviderError, p as ProviderError } from "./client-Clj7onnT.js";
2
+ import { I as isRecord, t as buildTurnFailureResponse } from "./logging-D3aYP0aG.js";
3
3
  import { g as parseSlackMessageTs } from "./actor-BTtLaeWy.js";
4
- import { c as getConversationEventStore, d as getDb } from "./viewer-CGZiUVMU.js";
5
- import { Gt as hydrateConversationMessages, an as markConversationMessage } from "./tasks-DO9VM9cu.js";
6
- import { Nt as listConversationAnnotations } from "./agent-hooks-DfPubHYm.js";
4
+ import { c as getConversationEventStore, d as getDb } from "./viewer-Rnim7alE.js";
5
+ import { Ut as hydrateConversationMessages, rn as markConversationMessage } from "./tasks-dJooqiip.js";
6
+ import { Nt as listConversationAnnotations } from "./agent-hooks-CDVx26Uu.js";
7
7
  import { J as removedCardSchema, Y as resolveMessageCards, q as readMessageCardRefs } from "./conversation-T18Xlkx9.js";
8
- import { r as clearPendingAuth, u as buildDeterministicTurnId } from "./pending-auth-m8aJlwP_.js";
8
+ import { r as clearPendingAuth, u as buildDeterministicTurnId } from "./pending-auth-D2t1Moxf.js";
9
9
  import { d as markTurnCompleted, u as markTurnClosed } from "./oauth-authorization-BA4Dt6a7.js";
10
- import { o as persistThreadStateById, r as getPersistedThreadState, s as coerceThreadConversationState } from "./thread-state-FreaCOZD.js";
10
+ import { o as persistThreadStateById, r as getPersistedThreadState, s as coerceThreadConversationState } from "./thread-state-CsMC-ob0.js";
11
11
  //#region src/chat/conversations/pending-cards.ts
12
12
  /** Select undelivered cards and load their latest saved facts. */
13
13
  async function loadPendingMessageCards(conversationId) {
@@ -1,4 +1,4 @@
1
- import { c as getConversationEventStore } from "./viewer-CGZiUVMU.js";
1
+ import { c as getConversationEventStore } from "./viewer-Rnim7alE.js";
2
2
  //#region src/chat/conversations/turn-lifecycle.ts
3
3
  /** Persist correlated turn lifecycle facts with retry-safe terminal exclusion. */
4
4
  var ConversationTurnLifecycleService = class {
@@ -34,7 +34,7 @@ function slackSourceForDestination(args) {
34
34
  * Reads parent Conversations when this Conversation has no Destination.
35
35
  */
36
36
  async function resolveConversationRouting(args) {
37
- const conversationStore = args.conversationStore ?? (await import("./viewer-CGZiUVMU.js").then((n) => n.s)).getConversationStore();
37
+ const conversationStore = args.conversationStore ?? (await import("./viewer-Rnim7alE.js").then((n) => n.s)).getConversationStore();
38
38
  const chain = await loadConversationChain(args.conversationId, conversationStore);
39
39
  let destination;
40
40
  let source;
@@ -1,5 +1,5 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-B4FMCO8f.js";
2
- import { n as pluginCatalogRuntime } from "./catalog-runtime-TG5WF66H.js";
2
+ import { n as pluginCatalogRuntime } from "./catalog-runtime-hKmI-iZa.js";
3
3
  import { isDeepStrictEqual } from "node:util";
4
4
  //#region src/chat/plugins/validation.ts
5
5
  var validation_exports = /* @__PURE__ */ __exportAll({
@@ -1,5 +1,5 @@
1
1
  //#region package.json
2
- var version = "0.254.0";
2
+ var version = "0.255.0";
3
3
  //#endregion
4
4
  //#region src/version.ts
5
5
  /** Installed Junior package version, or `unknown` when package metadata is unavailable. */
package/dist/version.js CHANGED
@@ -1,2 +1,2 @@
1
- import { t as JUNIOR_VERSION } from "./version-DcWD8xpq.js";
1
+ import { t as JUNIOR_VERSION } from "./version-CDM8Rq6E.js";
2
2
  export { JUNIOR_VERSION };
@@ -1,9 +1,9 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-B4FMCO8f.js";
2
- import { F as normalizeIdentityEmail } from "./logging-B3nJLXT7.js";
3
- import { i as getChatConfig } from "./config-CRlLncIj.js";
2
+ import { F as normalizeIdentityEmail } from "./logging-D3aYP0aG.js";
3
+ import { i as getChatConfig } from "./config-BDAfLTI9.js";
4
4
  import { d as parseSlackTeamId, o as parseActorUserId, u as parseSlackChannelReferenceId } from "./actor-BTtLaeWy.js";
5
5
  import { c as juniorIdentities, d as juniorDestinations, l as juniorUsers, o as conversationReadColumns, s as juniorConversations } from "./agent-invocations-BY60iNw-.js";
6
- import { _ as juniorConversationAnnotations, d as juniorConversationBindings, h as juniorConversationEvents, m as juniorConversationMetrics, p as CONVERSATION_METRICS, t as createJuniorSqlExecutor, u as juniorConversationParticipants } from "./executor-B88oEqok.js";
6
+ import { _ as juniorConversationAnnotations, d as juniorConversationBindings, h as juniorConversationEvents, m as juniorConversationMetrics, p as CONVERSATION_METRICS, t as createJuniorSqlExecutor, u as juniorConversationParticipants } from "./executor-Dh4Ofsnx.js";
7
7
  import { c as newConversationEventSchema, h as usageSchema, l as encodeHistoryPayload, o as decodeStoredConversationEvent, r as conversationEventDataSchema, s as historyReplacementSchema } from "./history-9pO1Zd4Y.js";
8
8
  import { randomUUID } from "node:crypto";
9
9
  import { and, asc, desc, eq, gt, gte, inArray, isNull, lt, lte, ne, or, sql } from "drizzle-orm";