@sentry/junior 0.317.0 → 0.318.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 (74) hide show
  1. package/dist/{admin-CAugg87B.js → admin-UOHix_5P.js} +1 -1
  2. package/dist/{agent-runner-AjrEV6Qe.js → agent-runner-DeYymwh2.js} +183 -113
  3. package/dist/{agent-update-delivery-B_YIZcgf.js → agent-update-delivery-DH8bx7jU.js} +5 -5
  4. package/dist/api/schema.d.ts +42 -28
  5. package/dist/api/schema.js +3 -3
  6. package/dist/api.js +38 -41
  7. package/dist/{app-MoNAsVV5.d.ts → app-DKAOuaoC.d.ts} +4 -9
  8. package/dist/app.d.ts +1 -1
  9. package/dist/app.js +62 -91
  10. package/dist/{thread-context-CqZDKErp.js → auth-pause-state-f9hJM_zO.js} +6 -59
  11. package/dist/{catalog-runtime-DfSpJZdY.js → catalog-runtime-BfdAnztW.js} +1 -1
  12. package/dist/{channel-access-j-YAVYK4.js → channel-access-A0de5lRv.js} +1 -1
  13. package/dist/{chat-core-engine-aH85nEHv.js → chat-core-engine-D3Wd7f5n.js} +6 -6
  14. package/dist/{child-message-DHjQLEd1.js → child-message-peFWLcCZ.js} +1 -5
  15. package/dist/cli/chat.js +32 -24
  16. package/dist/cli/check.js +4 -4
  17. package/dist/cli/main.js +2 -2
  18. package/dist/cli/plugins.js +4 -4
  19. package/dist/cli/snapshot-create.js +4 -5
  20. package/dist/cli/upgrade.js +3 -3
  21. package/dist/context-BKF_5zzI.js +1833 -0
  22. package/dist/{continue-in-slack-D-FZ8Fin.js → continue-in-slack-YxwMQVeR.js} +3 -2
  23. package/dist/{conversation-feed--9S0_PXL.js → conversation-feed-Cj7IuBtM.js} +1 -1
  24. package/dist/{conversation-privacy-B1uXn5sf.js → conversation-privacy-Cr_dNW1p.js} +1 -1
  25. package/dist/{conversation-turn-BUE_7xaN.js → conversation-turn-Bru4w_FD.js} +111 -18
  26. package/dist/{create-DoDIYgtZ.js → create-Btl1y1rq.js} +13 -15
  27. package/dist/{credential-sync-BJOqGnjV.js → credential-sync-DTarZ63K.js} +17 -17
  28. package/dist/{db-BFmyYZtJ.js → db-of6e3sGt.js} +1943 -1189
  29. package/dist/{deployment-DXq9ZLU4.js → deployment-C0qXa0FD.js} +1 -1
  30. package/dist/{engine-context-CgQ7mlHt.js → engine-context-C_QL_bMQ.js} +52 -21
  31. package/dist/{html-B3VKTGbJ.js → html-9_pS9SjY.js} +6 -6
  32. package/dist/instrumentation.js +2 -2
  33. package/dist/{job-runner-A1lCkybD.js → job-runner-B2XEvpif.js} +11 -12
  34. package/dist/{lineage-Bktb0UcV.js → lineage-nh4z9iQN.js} +1 -1
  35. package/dist/{list-Bxvg5wXf.js → list-HRP3TIRl.js} +45 -37
  36. package/dist/{logging--smS7XRK.js → logging-BnOG0qz2.js} +3 -49
  37. package/dist/{mailbox-turn-uSXhUFc9.js → mailbox-turn-Byrry9o1.js} +220 -223
  38. package/dist/{parent-result-Ck1rFYRQ.js → markers-CTTtJqYn.js} +84 -52
  39. package/dist/{message-BNenhsmB.js → message-BRUuLgrY.js} +9 -10
  40. package/dist/{model-input-BReSnwHp.js → model-input-CFC62mf-.js} +2 -2
  41. package/dist/nitro.d.ts +1 -1
  42. package/dist/nitro.js +4 -4
  43. package/dist/{oauth-callback-server-CE4soEIY.js → oauth-callback-server-CjnnUr4o.js} +2 -2
  44. package/dist/{oauth-relay-C36gX1gH.js → oauth-relay-BvHFH0fV.js} +1 -1
  45. package/dist/{profile-BQ-iBDsZ.js → profile-iHw1uu32.js} +7 -7
  46. package/dist/{prompt-Dv7gkpD6.js → prompt-DEkStuxG.js} +10 -10
  47. package/dist/{registry-iXMT5Jmh.js → registry-Cl7Labpe.js} +7 -7
  48. package/dist/{reports-WKHfGTsU.js → reports-C1d9azyV.js} +2 -2
  49. package/dist/{resolve-tony4ibz.js → resolve-DC6zBuDV.js} +5 -5
  50. package/dist/{result-Bta_dlWa.js → result-DxewDuXb.js} +12 -12
  51. package/dist/{run-conversation-DL6ru7iW.js → run-conversation-Cz2ubZK-.js} +6 -5
  52. package/dist/{runner-BstDRbD9.js → runner-99YxVN_r.js} +10 -18
  53. package/dist/{sandbox-egress-signals-oSJMJOnn.js → sandbox-egress-signals-CgoX5CTI.js} +1 -1
  54. package/dist/{schema-DfqrHACA.js → schema-BTojNBr5.js} +2 -2
  55. package/dist/{sender-actors-CPglLd5R.js → sender-actors-77zTQbSG.js} +7 -6
  56. package/dist/{service-account-CTV_jaNu.js → service-account-YDCPSByj.js} +3 -3
  57. package/dist/{skills-BCEU41zM.js → skills-CleC0Hze.js} +5 -4
  58. package/dist/{slack-conversation-unfurl-DxVmhbGP.js → slack-conversation-unfurl-BNQLC12R.js} +7 -7
  59. package/dist/{spawn-frczVPIr.js → spawn-DuZfodPa.js} +7 -10
  60. package/dist/{system-prompt-table-CiXy0eNR.js → system-prompt-table-Ci6Ck4gk.js} +2 -2
  61. package/dist/{task-runner-C9Yc2_ae.js → task-runner-BJ9Up3bG.js} +18 -15
  62. package/dist/{topics-SRN7IVX-.js → topics-BoCkoPJJ.js} +2 -5
  63. package/dist/{turn-membership-CENFf3kI.js → turn-membership-VT7XZh-L.js} +4 -4
  64. package/dist/{turn-wake-BhloiI2h.js → turn-wake-C7HeLHAM.js} +4 -4
  65. package/dist/{types-C4iC-IMC.js → types-DCzTAA63.js} +55 -49
  66. package/dist/{users-ByG5RCEJ.js → users-Cb9c1k9q.js} +1 -1
  67. package/dist/{validation-8gjfR91V.js → validation-BiUmWPhy.js} +1 -1
  68. package/dist/{version-BeZhWWBE.js → version-VEXiEcZu.js} +1 -1
  69. package/dist/version.js +1 -1
  70. package/dist/{worker-BqMQQNRk.js → worker-ChWYQdhm.js} +5 -5
  71. package/migrations/20261127002500_turn_discarded_usage/migration.sql +2 -0
  72. package/migrations/20261127002500_turn_discarded_usage/snapshot.json +73 -0
  73. package/package.json +5 -5
  74. package/dist/config-CHQ8X251.js +0 -2422
@@ -1,8 +1,9 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-BKpuH2hG.js";
2
+ import { R as getChatConfig } from "./context-BKF_5zzI.js";
2
3
  import { s as skillRoots } from "./package-discovery-DD9vencX.js";
3
- import { h as logWarn } from "./logging--smS7XRK.js";
4
- import { n as pluginCatalogRuntime } from "./catalog-runtime-DfSpJZdY.js";
5
- import { L as mapBounded } from "./prompt-Dv7gkpD6.js";
4
+ import { m as logWarn } from "./logging-BnOG0qz2.js";
5
+ import { n as pluginCatalogRuntime } from "./catalog-runtime-BfdAnztW.js";
6
+ import { G as mapBounded } from "./prompt-DEkStuxG.js";
6
7
  import * as z from "zod";
7
8
  import path from "node:path";
8
9
  import fs from "node:fs/promises";
@@ -177,7 +178,7 @@ const SKILL_CACHE_TTL_MS = 5e3;
177
178
  let skillCache = null;
178
179
  function resolveSkillRoots(options) {
179
180
  const additionalRoots = options?.additionalRoots ?? [];
180
- const envRoots = process.env["SKILL_DIRS"]?.split(path.delimiter).filter(Boolean) ?? [];
181
+ const envRoots = getChatConfig().skills.dirs;
181
182
  const defaults = skillRoots();
182
183
  const pluginRoots = pluginCatalogRuntime.getSkillRoots();
183
184
  const seen = /* @__PURE__ */ new Set();
@@ -1,11 +1,11 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-BKpuH2hG.js";
2
- import { Cs as createSlackActor, Ds as parseActorUserId, Ei as formatSlackLink, P as getConversationIdByProviderConversation, Sr as readConversationAccessFromSql, Ti as escapeSlackMrkdwnText, Wr as runWithSlackInstallation, Ys as getWorkspaceTeamId, _i as postSlackEphemeralMessage, a as getDb, bi as unfurlSlackLinks, cd as parseSlackChannelId, dd as parseSlackUserId, ec as readActorIdentity, fd as slackBotIdSchema, hd as slackUserIdSchema, i as getConversationStore, jl as parseDashboardConversationLink, md as slackTeamIdSchema, o as getSqlExecutor, pd as slackChannelIdSchema, ud as parseSlackTeamId, vd as slackMessageTsSchema, vn as deferConversationMove } from "./db-BFmyYZtJ.js";
3
- import { i as lookupSlackUserProfile, n as lookupSlackBot } from "./users-ByG5RCEJ.js";
4
- import { k as createCache, t as botConfig } from "./config-CHQ8X251.js";
5
- import { E as withSpan } from "./logging--smS7XRK.js";
6
- import { a as isMovableToSlack, i as continueConversationInSlack, n as alreadyContinuesInSlackMessage, t as BUSY } from "./continue-in-slack-D-FZ8Fin.js";
7
- import { t as checkSlackChannelReadAccess } from "./channel-access-j-YAVYK4.js";
8
- import { L as mapBounded } from "./prompt-Dv7gkpD6.js";
2
+ import { Ci as postSlackEphemeralMessage, Ei as unfurlSlackLinks, Hs as getWorkspaceTeamId, Mi as formatSlackLink, P as getConversationIdByProviderConversation, Ru as createCache, Xr as runWithSlackInstallation, a as getDb, bn as deferConversationMove, i as getConversationStore, ji as escapeSlackMrkdwnText, ll as parseDashboardConversationLink, o as getSqlExecutor, qs as readActorIdentity, wr as readConversationAccessFromSql } from "./db-of6e3sGt.js";
3
+ import { A as slackBotIdSchema, E as parseSlackChannelId, I as slackMessageTsSchema, L as botConfig, M as slackTeamIdSchema, N as slackUserIdSchema, O as parseSlackTeamId, c as createSlackActor, j as slackChannelIdSchema, k as parseSlackUserId, p as parseActorUserId } from "./context-BKF_5zzI.js";
4
+ import { i as lookupSlackUserProfile, n as lookupSlackBot } from "./users-Cb9c1k9q.js";
5
+ import { T as withSpan } from "./logging-BnOG0qz2.js";
6
+ import { a as isMovableToSlack, i as continueConversationInSlack, n as alreadyContinuesInSlackMessage, t as BUSY } from "./continue-in-slack-YxwMQVeR.js";
7
+ import { t as checkSlackChannelReadAccess } from "./channel-access-A0de5lRv.js";
8
+ import { G as mapBounded } from "./prompt-DEkStuxG.js";
9
9
  import * as z from "zod";
10
10
  // src/chat/ingress/workspace-membership.ts
11
11
  const MEMBER_TTL_MS = 3e5;
@@ -1,21 +1,18 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-BKpuH2hG.js";
2
- import { Ql as childrenAreTopLevel } from "./db-BFmyYZtJ.js";
3
- import { P as AgentDepthLimitError, b as actorFromRun } from "./agent-runner-AjrEV6Qe.js";
4
- import { t as botConfig } from "./config-CHQ8X251.js";
5
- import { t as readConversationLineage } from "./lineage-Bktb0UcV.js";
6
- import { n as spawnChildAgent } from "./create-DoDIYgtZ.js";
2
+ import { P as AgentDepthLimitError, b as actorFromRun } from "./agent-runner-DeYymwh2.js";
3
+ import { L as botConfig } from "./context-BKF_5zzI.js";
4
+ import { t as readConversationLineage } from "./lineage-nh4z9iQN.js";
5
+ import { n as spawnChildAgent } from "./create-Btl1y1rq.js";
7
6
  // src/chat/child-agents/spawn.ts
8
7
  var spawn_exports = /* @__PURE__ */ __exportAll({ bindSpawnAgent: () => bindSpawnAgent });
9
8
  /**
10
- * Count the parents of the Conversation that starts a child agent. A Lead's
11
- * children count as roots, so the Lead adds no level. A chain that does not
12
- * end at a root, such as a cycle, cannot start one.
9
+ * Count the parents of the Conversation that starts a child agent. A chain
10
+ * that does not end at a root, such as a cycle, cannot start one.
13
11
  */
14
12
  async function assertCanStartChildAgent(conversationId, maxAgentDepth) {
15
13
  const lineage = await readConversationLineage(conversationId);
16
14
  const root = lineage[0];
17
- const levels = lineage.length - (root && childrenAreTopLevel(root.kind) ? 2 : 1);
18
- if (!root || root.parentConversationId || levels > maxAgentDepth) throw new AgentDepthLimitError(maxAgentDepth);
15
+ if (!root || root.parentConversationId || lineage.length - 1 > maxAgentDepth) throw new AgentDepthLimitError(maxAgentDepth);
19
16
  }
20
17
  /** Bind a Run's Actor and credentials to new child agents. */
21
18
  function bindSpawnAgent(run, options) {
@@ -1,7 +1,7 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-BKpuH2hG.js";
2
- import { D as isToolResultError, F as SESSION_CONTEXT_SECTION_TAG, I as TURN_CONTEXT_TAG, N as CAPABILITY_SECTION_TAG, O as isToolResultMessage, P as REQUEST_CONTEXT_SECTION_TAG, _ as extractAssistantText, d as SANDBOX_WORKSPACE_ROOT, f as sandboxSkillDir, h as createPluginLogger, k as normalizeToolNameFromResult, n as toPromptContributionContext, o as SANDBOX_DATA_ROOT, r as runPluginHooksAtOnce, t as PLUGIN_PROMPT_CONTRIBUTION_TOTAL_MAX_CHARS, w as isAssistantMessage } from "./prompt-Dv7gkpD6.js";
2
+ import { D as isToolResultError, F as SESSION_CONTEXT_SECTION_TAG, I as TURN_CONTEXT_TAG, N as CAPABILITY_SECTION_TAG, O as isToolResultMessage, P as REQUEST_CONTEXT_SECTION_TAG, _ as extractAssistantText, d as SANDBOX_WORKSPACE_ROOT, f as sandboxSkillDir, h as createPluginLogger, k as normalizeToolNameFromResult, n as toPromptContributionContext, o as SANDBOX_DATA_ROOT, r as runPluginHooksAtOnce, t as PLUGIN_PROMPT_CONTRIBUTION_TOTAL_MAX_CHARS, w as isAssistantMessage } from "./prompt-DEkStuxG.js";
3
3
  import { a as listReferenceFiles, c as soulPathCandidates, l as worldPathCandidates } from "./package-discovery-DD9vencX.js";
4
- import { h as logWarn, m as logInfo } from "./logging--smS7XRK.js";
4
+ import { m as logWarn, p as logInfo } from "./logging-BnOG0qz2.js";
5
5
  import * as z from "zod";
6
6
  import path from "node:path";
7
7
  import { escapeClosingTag, escapeTagText, escapeTagTextAndQuotes, findTags, indentTagLines, markdownNodes, openingTag, parseMarkdown, promptMessageSchema, renderInlineTag, renderTag, unescapeTagText } from "@sentry/junior-plugin-api";
@@ -1,16 +1,16 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-BKpuH2hG.js";
2
- import { Bi as renderPluginConversationEvent, D as createSqlStore, Ii as createPluginEmbedder, Ji as createPluginCache, Jo as codeChangeUrl, Kr as resolveConversationRouting, Ku as getStateAdapter, Li as createPluginModel, Nu as completeObject, Pi as createPluginState, Qd as juniorConversationEvents, Qn as createPluginEventPublisher, Qu as hasAgentTurnUsage, Ri as createPluginModelCostRecorder, St as getRegistrations, Uu as renderJuniorNativeConversationEvent, Zs as createPluginUsers, a as getDb, af as juniorCodeRepositories, ar as pluginTaskParamsSchema, dr as createPluginTurnEventReader, ec as readActorIdentity, f as eventFromRow, fr as createPluginConversationChanges, gd as parseSlackMessageTs, i as getConversationStore, if as juniorCodeChanges, ir as pluginTaskId, ju as storeConversationEmbedding, ku as createConversationEmbedder, lf as juniorConversations, lr as createPluginCodeChanges, ls as resolveRootVisibility, mr as createPluginInboxItems, nr as startedTaskDefinition, ns as createPluginAnnotations, o as getSqlExecutor, os as readConversationMetadata, rs as listConversationAnnotations, ss as writeConversationMetadata, ti as getDispatchRecord, tr as createPluginTaskStarter, tu as hasConversationMetadata, zi as createPluginConversationEvents } from "./db-BFmyYZtJ.js";
3
- import { E as withSpan, O as buildSentryEventUrl, a as extractGenAiUsageSummary, m as logInfo, p as logException } from "./logging--smS7XRK.js";
4
- import { C as instructionTextForProjection, D as isToolResultError, L as mapBounded, O as isToolResultMessage, b as getUserMessageInstructionText, h as createPluginLogger, j as stripRuntimeTurnContext, k as normalizeToolNameFromResult, v as getPiMessageRole } from "./prompt-Dv7gkpD6.js";
5
- import { Dr as loadTurnStart, E as isInheritedForkHistory, Nn as hydrateConversationMessages, Sr as getTurnRecord, Zn as isEventAuthorId, _t as coerceThreadConversationState, m as isParentMessageAuthor, mt as getPersistedThreadState } from "./mailbox-turn-uSXhUFc9.js";
6
- import { J as conversationReportMessageEventSchema, Tt as sameActorIdentity, Ut as readMessageCardRefs, Xt as readMessageAttachments, q as conversationReportEventSchema, zt as inboxItemChangeRecordSchema } from "./types-C4iC-IMC.js";
7
- import { P as withLock, t as botConfig } from "./config-CHQ8X251.js";
8
- import { i as matchSlackAttachments, n as savedTurnMessages } from "./turn-membership-CENFf3kI.js";
2
+ import { Bi as createPluginState, D as createSqlStore, Eu as completeObject, Gi as createPluginConversationEvents, Gr as buildSentryEventUrl, Hi as createPluginEmbedder, Ki as renderPluginConversationEvent, Qr as resolveConversationRouting, Su as createConversationEmbedder, Ui as createPluginModel, Wi as createPluginModelCostRecorder, Wl as isEventAuthorId, Ws as createPluginUsers, Yo as codeChangeUrl, a as getDb, df as juniorCodeRepositories, dr as createPluginCodeChanges, ds as writeConversationMetadata, ea as createPluginCache, er as createPluginEventPublisher, f as eventFromRow, gr as createPluginInboxItems, hf as juniorConversations, i as getConversationStore, if as juniorConversationEvents, ir as startedTaskDefinition, is as listConversationAnnotations, kl as hasConversationMetadata, ld as renderJuniorNativeConversationEvent, md as hasAgentTurnUsage, mr as createPluginConversationChanges, o as getSqlExecutor, or as pluginTaskId, pr as createPluginTurnEventReader, ps as resolveRootVisibility, qs as readActorIdentity, rr as createPluginTaskStarter, rs as createPluginAnnotations, si as getDispatchRecord, sr as pluginTaskParamsSchema, uf as juniorCodeChanges, us as readConversationMetadata, wt as getRegistrations, wu as storeConversationEmbedding } from "./db-of6e3sGt.js";
3
+ import { T as withSpan, f as logException, i as extractGenAiUsageSummary, p as logInfo } from "./logging-BnOG0qz2.js";
4
+ import { C as instructionTextForProjection, D as isToolResultError, G as mapBounded, O as isToolResultMessage, b as getUserMessageInstructionText, h as createPluginLogger, j as stripRuntimeTurnContext, k as normalizeToolNameFromResult, v as getPiMessageRole } from "./prompt-DEkStuxG.js";
5
+ import { E as isInheritedForkHistory, Pn as hydrateConversationMessages, Tr as loadTurnStart, br as getTurnRecord, gt as coerceThreadConversationState, h as isParentMessageAuthor, pt as getPersistedThreadState } from "./mailbox-turn-Byrry9o1.js";
6
+ import { L as botConfig, P as parseSlackMessageTs, T as withLock, y as getStateAdapter } from "./context-BKF_5zzI.js";
7
+ import { J as conversationReportMessageEventSchema, Tt as sameActorIdentity, Ut as readMessageCardRefs, Xt as readMessageAttachments, q as conversationReportEventSchema, zt as inboxItemChangeRecordSchema } from "./types-DCzTAA63.js";
8
+ import { i as matchSlackAttachments, n as savedTurnMessages } from "./turn-membership-VT7XZh-L.js";
9
9
  import { h as startSpan } from "./sentry-CPbZjomA.js";
10
10
  import * as z from "zod";
11
- import { objectTypeSchema, pluginRunContextSchema, renderTag, tagJson } from "@sentry/junior-plugin-api";
12
11
  import { and, arrayContains, asc, desc, eq, getTableColumns, gt, inArray, lt, max, sql } from "drizzle-orm";
13
12
  import { alias } from "drizzle-orm/pg-core";
13
+ import { objectTypeSchema, pluginRunContextSchema, renderTag, tagJson } from "@sentry/junior-plugin-api";
14
14
  // src/chat/conversations/metadata/generate.ts
15
15
  const MAX_INPUT_CHARS = 6e4;
16
16
  const MAX_MESSAGE_TEXT_CHARS = 4e3;
@@ -403,6 +403,10 @@ function reportEventData(args) {
403
403
  switch (data.type) {
404
404
  case "message": {
405
405
  const actorIdentity = args.canExposePayload ? reportMessageActorIdentity(data) : void 0;
406
+ const parentInput = reportParentAgentInput({
407
+ agentInvocationId: data.meta?.["agentInvocationId"],
408
+ authorUserId: reportingMessageAuthorSchema.safeParse(data.meta?.["author"]).data?.userId
409
+ });
406
410
  return {
407
411
  type: "message",
408
412
  messageId: data.messageId,
@@ -410,10 +414,7 @@ function reportEventData(args) {
410
414
  ...data.meta?.["source"] === "web" || data.meta?.["source"] === "slack" ? { source: data.meta["source"] } : void 0,
411
415
  ...actorIdentity ? { actorIdentity } : void 0,
412
416
  ...args.canExposePayload && data.role === "user" && data.authorIdentityId && data.authorIdentityId !== "system" ? { actorIdentityId: data.authorIdentityId } : void 0,
413
- ...reportParentAgentInput({
414
- agentInvocationId: data.meta?.["agentInvocationId"],
415
- authorUserId: reportingMessageAuthorSchema.safeParse(data.meta?.["author"]).data?.userId
416
- }),
417
+ ...parentInput,
417
418
  ...args.canExposePayload ? reportInboxItemChanges(data.meta) : void 0,
418
419
  eventObjectType: objectTypeSchema.safeParse(data.meta?.["eventObjectType"]).data,
419
420
  ...typeof data.meta?.["eventType"] === "string" ? { eventType: data.meta["eventType"] } : void 0,
@@ -427,7 +428,7 @@ function reportEventData(args) {
427
428
  ...args.canExposePayload ? reportMessageEvents(data.meta) : void 0,
428
429
  ...args.canExposePayload && (data.meta?.["cards"] || data.meta?.["objectCards"]) ? { cards: readMessageCardRefs(data.meta) } : void 0,
429
430
  ...args.canExposePayload ? {
430
- text: data.text,
431
+ text: parentInput && typeof data.meta?.["requestText"] === "string" ? data.meta["requestText"] : data.text,
431
432
  ...data.meta?.["attachments"] ? { attachments: readMessageAttachments(data.meta["attachments"]) } : void 0
432
433
  } : { redacted: true }
433
434
  };
@@ -472,8 +473,10 @@ function reportEventData(args) {
472
473
  toolCallId: data.toolCallId,
473
474
  toolName: data.toolName,
474
475
  decision: data.decision,
475
- riskLevel: data.riskLevel,
476
- userAuthorization: data.userAuthorization
476
+ ...data.rule ? { rule: data.rule } : void 0,
477
+ ...data.reason ? { reason: data.reason } : void 0,
478
+ ...data.riskLevel ? { riskLevel: data.riskLevel } : void 0,
479
+ ...data.userAuthorization ? { userAuthorization: data.userAuthorization } : void 0
477
480
  };
478
481
  case "turn_completed": return {
479
482
  type: "turn_lifecycle",
@@ -17,8 +17,5 @@ const CACHE_WARMUP_QUEUE_TOPIC = "junior_cache_warmups";
17
17
  const PLUGIN_TASK_QUEUE_TOPIC = "junior_plugin_tasks";
18
18
  const WORKSPACE_SNAPSHOT_JOB_QUEUE_TOPIC = "junior_workspace_snapshots";
19
19
  const BACKGROUND_COMPACTION_QUEUE_TOPIC = "junior_context_compaction";
20
- /** Resolve the Vercel Queue topic used for conversation wake-up nudges. */
21
- function resolveConversationWorkQueueTopic(options = {}) {
22
- return options.topic?.trim() || process.env["JUNIOR_CONVERSATION_WORK_QUEUE_TOPIC"]?.trim() || "junior_conversation_work";
23
- }
24
- export { resolveConversationWorkQueueTopic as a, WORKSPACE_SNAPSHOT_JOB_QUEUE_TOPIC as i, CACHE_WARMUP_QUEUE_TOPIC as n, toOptionalTrimmed as o, PLUGIN_TASK_QUEUE_TOPIC as r, BACKGROUND_COMPACTION_QUEUE_TOPIC as t };
20
+ const DEFAULT_CONVERSATION_WORK_QUEUE_TOPIC = "junior_conversation_work";
21
+ export { WORKSPACE_SNAPSHOT_JOB_QUEUE_TOPIC as a, PLUGIN_TASK_QUEUE_TOPIC as i, CACHE_WARMUP_QUEUE_TOPIC as n, toOptionalTrimmed as o, DEFAULT_CONVERSATION_WORK_QUEUE_TOPIC as r, BACKGROUND_COMPACTION_QUEUE_TOPIC as t };
@@ -1,9 +1,9 @@
1
- import { Fs as SlackActionError, Gs as readPrivateSlackFile, Ks as streamPrivateSlackFile, cf as juniorMessageAttachments, id as touchConversationDetail, lf as juniorConversations, nd as conversationDetailTouch, sf as juniorAttachments } from "./db-BFmyYZtJ.js";
2
- import { n as getChatConfig } from "./config-CHQ8X251.js";
3
- import { L as mapBounded } from "./prompt-Dv7gkpD6.js";
1
+ import { R as getChatConfig } from "./context-BKF_5zzI.js";
2
+ import { Os as SlackActionError, Rs as readPrivateSlackFile, bd as touchConversationDetail, hf as juniorConversations, mf as juniorMessageAttachments, pf as juniorAttachments, vd as conversationDetailTouch, zs as streamPrivateSlackFile } from "./db-of6e3sGt.js";
3
+ import { G as mapBounded } from "./prompt-DEkStuxG.js";
4
4
  import * as z from "zod";
5
- import { createHash, randomUUID } from "node:crypto";
6
5
  import { and, asc, eq, inArray, isNotNull, isNull, lte, notExists, or, sql } from "drizzle-orm";
6
+ import { createHash, randomUUID } from "node:crypto";
7
7
  import { AwsClient } from "aws4fetch";
8
8
  import { del, get, issueSignedToken, presignUrl, put } from "@vercel/blob";
9
9
  // src/chat/attachments/memory.ts
@@ -1,6 +1,6 @@
1
- import { i as getConversationStore, jr as getVercelConversationWorkQueue, n as getConversationEventStore, ou as ownsLocation, qr as resolveTurnResumeRouting, ti as getDispatchRecord, tn as ensureConversationWake, un as requestConversationWork } from "./db-BFmyYZtJ.js";
2
- import { Sr as getTurnRecord, hr as loadTurnCheckpoint, wr as recordTurnSummary, xr as failTurnRecord } from "./mailbox-turn-uSXhUFc9.js";
3
- import { p as logException } from "./logging--smS7XRK.js";
1
+ import { $r as resolveTurnResumeRouting, Nl as isTopLevel, Nr as getVercelConversationWorkQueue, fn as requestConversationWork, i as getConversationStore, n as getConversationEventStore, rn as ensureConversationWake, si as getDispatchRecord } from "./db-of6e3sGt.js";
2
+ import { Sr as recordTurnSummary, br as getTurnRecord, pr as loadTurnCheckpoint, yr as failTurnRecord } from "./mailbox-turn-Byrry9o1.js";
3
+ import { f as logException } from "./logging-BnOG0qz2.js";
4
4
  import * as z from "zod";
5
5
  // src/chat/task-execution/authorized-turn.ts
6
6
  /**
@@ -114,7 +114,7 @@ async function wakePausedTurn(request, options = {}) {
114
114
  const conversation = await (options.conversationStore ?? getConversationStore()).get({ conversationId: request.conversationId });
115
115
  await requestConversationWork({
116
116
  conversationId: request.conversationId,
117
- destination: conversation && !ownsLocation(conversation) ? void 0 : request.destination,
117
+ destination: conversation && !isTopLevel(conversation) ? void 0 : request.destination,
118
118
  nowMs,
119
119
  state: options.state
120
120
  });
@@ -1,5 +1,24 @@
1
1
  import * as z from "zod";
2
2
  import { actorSchema, actorUserIdSchema, conversationAnnotationInputSchema, conversationEventPresentationSchema, conversationSidebarAnnotationSchema, destinationVisibilitySchema, eventMatchFieldsSchema, eventMatchSchema, eventReachSchema, eventTypeSchema, objectFactFields, objectTypeSchema, pluginEventTypeSchema, slackDestinationSchema, taskOutcomeSchema } from "@sentry/junior-plugin-api";
3
+ // src/usage-schema.ts
4
+ const usageCostSchema = z.object({
5
+ input: z.number().finite().nonnegative().optional(),
6
+ output: z.number().finite().nonnegative().optional(),
7
+ cacheRead: z.number().finite().nonnegative().optional(),
8
+ cacheWrite: z.number().finite().nonnegative().optional(),
9
+ total: z.number().finite().nonnegative().optional()
10
+ }).strict();
11
+ const usageSchema = z.object({
12
+ inputTokens: z.number().int().nonnegative().optional(),
13
+ outputTokens: z.number().int().nonnegative().optional(),
14
+ cachedInputTokens: z.number().int().nonnegative().optional(),
15
+ cacheCreationTokens: z.number().int().nonnegative().optional(),
16
+ reasoningTokens: z.number().int().nonnegative().optional(),
17
+ totalTokens: z.number().int().nonnegative().optional(),
18
+ cost: usageCostSchema.optional()
19
+ }).strict();
20
+ /** The token counts of a usage record, without its cost. */
21
+ const usageTokensSchema = usageSchema.omit({ cost: true });
3
22
  // src/chat/gateway-providers/rule.ts
4
23
  /**
5
24
  * The routing rule of the "Enabled providers" admin setting.
@@ -19,23 +38,31 @@ function gatewayOnlyProviders(enabled, served) {
19
38
  const only = served.filter((provider) => enabled.includes(provider));
20
39
  return only.length > 0 && only.length < served.length ? only : void 0;
21
40
  }
22
- // src/usage-schema.ts
23
- const usageCostSchema = z.object({
24
- input: z.number().finite().nonnegative().optional(),
25
- output: z.number().finite().nonnegative().optional(),
26
- cacheRead: z.number().finite().nonnegative().optional(),
27
- cacheWrite: z.number().finite().nonnegative().optional(),
28
- total: z.number().finite().nonnegative().optional()
29
- }).strict();
30
- const usageSchema = z.object({
31
- inputTokens: z.number().int().nonnegative().optional(),
32
- outputTokens: z.number().int().nonnegative().optional(),
33
- cachedInputTokens: z.number().int().nonnegative().optional(),
34
- cacheCreationTokens: z.number().int().nonnegative().optional(),
35
- reasoningTokens: z.number().int().nonnegative().optional(),
36
- totalTokens: z.number().int().nonnegative().optional(),
37
- cost: usageCostSchema.optional()
38
- }).strict();
41
+ // src/chat/child-agents/result-event-type.ts
42
+ const LEGACY_RESULT_EVENT_TYPE_PREFIX = "agent_invocation.";
43
+ /** True when an Event type names a child result that an earlier release wrote. */
44
+ function isLegacyResultEventType(eventType) {
45
+ return eventType.startsWith(LEGACY_RESULT_EVENT_TYPE_PREFIX);
46
+ }
47
+ /**
48
+ * Event type of an agent update: what a Conversation reports when a Turn
49
+ * ends, it waits on a person, or it stops. A parent gets it from its child
50
+ * agents, and a Watch on the Conversation gets the same Event.
51
+ */
52
+ const AGENT_UPDATE_EVENT_TYPE = "agent.update";
53
+ const LEGACY_AGENT_REPLY_EVENT_TYPE = "agent.reply";
54
+ /** True when an Event type names an agent update. */
55
+ function isAgentUpdateEventType(eventType) {
56
+ return eventType === "agent.update" || eventType === LEGACY_AGENT_REPLY_EVENT_TYPE;
57
+ }
58
+ /** Event type of a message that a child agent sends to its parent. */
59
+ const AGENT_MESSAGE_EVENT_TYPE = "agent.message";
60
+ /** Event type of a message from another top-level agent. */
61
+ const TOP_LEVEL_AGENT_MESSAGE_EVENT_TYPE = "agent.top_level_message";
62
+ /** True when an Event type names a message that another agent sent. */
63
+ function isAgentMessageEventType(eventType) {
64
+ return eventType === "agent.message" || eventType === "agent.top_level_message";
65
+ }
39
66
  // src/api/schema/response.ts
40
67
  /** Stable error body returned by Junior-owned REST endpoints. */
41
68
  const apiErrorSchema = z.object({ error: z.string().min(1) }).strict();
@@ -437,33 +464,6 @@ function automationTaskColumns(task) {
437
464
  skill: task.skill
438
465
  };
439
466
  }
440
- // src/chat/child-agents/result-event-type.ts
441
- /** Event namespace of the messages between a parent and its child agents. */
442
- const AGENT_EVENT_NAMESPACE = "junior";
443
- const LEGACY_RESULT_EVENT_TYPE_PREFIX = "agent_invocation.";
444
- /** True when an Event type names a child result that an earlier release wrote. */
445
- function isLegacyResultEventType(eventType) {
446
- return eventType.startsWith(LEGACY_RESULT_EVENT_TYPE_PREFIX);
447
- }
448
- /**
449
- * Event type of an agent update: what a Conversation reports when a Turn
450
- * ends, it waits on a person, or it stops. A parent gets it from its child
451
- * agents, and a Watch on the Conversation gets the same Event.
452
- */
453
- const AGENT_UPDATE_EVENT_TYPE = "agent.update";
454
- const LEGACY_AGENT_REPLY_EVENT_TYPE = "agent.reply";
455
- /** True when an Event type names an agent update. */
456
- function isAgentUpdateEventType(eventType) {
457
- return eventType === "agent.update" || eventType === LEGACY_AGENT_REPLY_EVENT_TYPE;
458
- }
459
- /** Event type of a message that a child agent sends to its parent. */
460
- const AGENT_MESSAGE_EVENT_TYPE = "agent.message";
461
- /** Event type of a message from another top-level agent. */
462
- const TOP_LEVEL_AGENT_MESSAGE_EVENT_TYPE = "agent.top_level_message";
463
- /** True when an Event type names a message that another agent sent. */
464
- function isAgentMessageEventType(eventType) {
465
- return eventType === "agent.message" || eventType === "agent.top_level_message";
466
- }
467
467
  // src/chat/inbox-items/user-input-request.ts
468
468
  const USER_INPUT_LIMITS = {
469
469
  maxButtonOptions: 5,
@@ -1612,18 +1612,22 @@ const guardianActionReviewedEventDataSchema = z.object({
1612
1612
  "ask",
1613
1613
  "deny"
1614
1614
  ]),
1615
+ /** Set on decisions recorded since Guardian names one rule. */
1616
+ rule: z.string().min(1).optional(),
1617
+ /** Set on decisions recorded since the record keeps why. */
1618
+ reason: z.string().min(1).optional(),
1615
1619
  riskLevel: z.enum([
1616
1620
  "low",
1617
1621
  "medium",
1618
1622
  "high",
1619
1623
  "critical"
1620
- ]),
1624
+ ]).optional(),
1621
1625
  userAuthorization: z.enum([
1622
1626
  "high",
1623
1627
  "medium",
1624
1628
  "low",
1625
1629
  "unknown"
1626
- ])
1630
+ ]).optional()
1627
1631
  }).strict();
1628
1632
  const conversationMessageRoleSchema = z.union([
1629
1633
  z.literal("user"),
@@ -2382,18 +2386,20 @@ const conversationReportGuardianActionReviewedEventDataSchema = z.object({
2382
2386
  "ask",
2383
2387
  "deny"
2384
2388
  ]),
2389
+ rule: z.string().min(1).optional(),
2390
+ reason: z.string().min(1).optional(),
2385
2391
  riskLevel: z.enum([
2386
2392
  "low",
2387
2393
  "medium",
2388
2394
  "high",
2389
2395
  "critical"
2390
- ]),
2396
+ ]).optional(),
2391
2397
  userAuthorization: z.enum([
2392
2398
  "high",
2393
2399
  "medium",
2394
2400
  "low",
2395
2401
  "unknown"
2396
- ])
2402
+ ]).optional()
2397
2403
  }).strict();
2398
2404
  const conversationReportTurnContextEventDataSchema = z.object({
2399
2405
  type: z.literal("turn_context"),
@@ -3058,4 +3064,4 @@ const TODOS_REGISTRATION_NAME = "todos";
3058
3064
  const UPDATE_TODOS_TOOL_NAME = `${TODOS_REGISTRATION_NAME}_updateTodos`;
3059
3065
  /** Assignee text for the list's own agent, in tool results and blocks. */
3060
3066
  const SELF_TODO_ASSIGNEE = "self";
3061
- export { activityPreviewText as $, automationTitleSchema as $t, automationVersionSchema as A, isLegacyResultEventType as An, spaceListQuerySchema as At, conversationDetailQuerySchema as B, getNextRunAtMs as Bn, annotationCard as Bt, automationScheduleIntentSchema as C, userInputRequestSchema as Cn, instructionActors as Ct, automationVersionActivateSchema as D, TOP_LEVEL_AGENT_MESSAGE_EVENT_TYPE as Dn, SPACE_NAME_MAX_CHARS as Dt, automationUpdateSchema as E, AGENT_UPDATE_EVENT_TYPE as En, SPACE_DESCRIPTION_MAX_CHARS as Et, actorIdentitySchema as F, automationTaskText as Fn, spaceVisibilitySchema as Ft, conversationParamsSchema as G, usageSchema as Gn, resolveMessageCards as Gt, conversationEventHistorySchema as H, isValidTimeZone as Hn, messageCardText as Ht, conversationActivityPreviewSchema as I, DEFAULT_NOTIFICATION_SCHEDULE as In, updateSpaceBodySchema as It, conversationReportMessageEventSchema as J, inputFileSchema as Jt, conversationReportEventDataSchema as K, gatewayOnlyProviders as Kn, MAX_ATTACHMENT_BYTES as Kt, conversationAttachmentParamsSchema as L, isWithinNotificationSchedule as Ln, conversationTreeStateSchema as Lt, scheduledAutomationSummarySchema as M, automationTaskColumns as Mn, spaceParamsSchema as Mt, CONVERSATION_DETAIL_VERSION_HEADER as N, automationTaskDescription as Nn, spaceRefSchema as Nt, automationVersionListSchema as O, isAgentMessageEventType as On, archiveSpaceBodySchema as Ot, CONVERSATION_VERSION_HEADER as P, automationTaskSchema as Pn, spaceSchema as Pt, conversationUsageSchema as Q, automationInstructionToolSchema as Qt, conversationAttachmentQuerySchema as R, notificationScheduleSchema as Rn, conversationReadPositionSchema as Rt, automationRunWindowsSchema as S, userInputQuestionSchema as Sn, contextProvenance as St, automationSummarySchema as T, AGENT_MESSAGE_EVENT_TYPE as Tn, sameActorIdentity as Tt, conversationEventPageSchema as U, CONTENT_VERSION_HEADER as Un, readMessageCardRefs as Ut, conversationDetailReportSchema as V, getZonedDateTimeParts as Vn, messageCardRef as Vt, conversationEventsQuerySchema as W, apiErrorSchema as Wn, removedCardSchema as Wt, conversationSummaryReportSchema as X, readMessageAttachments as Xt, conversationReportStatusSchema as Y, messageAttachmentSchema as Yt, conversationSurfaceSchema as Z, automationContextToolSchema as Zt, automationListQuerySchema as _, buttonUserInputField as _n, historyReplacementSchema as _t, UPDATE_TODOS_TOOL_NAME as a, compileScheduleIntent as an, KNOWN_CONVERSATION_EVENT_TYPES as at, automationRunListSchema as b, normalizeUserInputAnswer as bn, piMessageSchema as bt, automationEditSchema as c, weekdaySchema as cn, conversationTurnFailureReasonSchema as ct, automationExecutionSchema as d, inboxItemNoticeRequestSchema as dn, agentHistoryFromRow as dt, taskOutcomeInputSchema as en, conversationChildAgentTotalsSchema as et, automationExecutionStatusDaySchema as f, inboxItemQuestion as fn, encodeAgentHistoryPayload as ft, automationListPageSchema as g, answeredChoices as gn, historyItemFromPiMessage as gt, automationListItemSchema as h, USER_INPUT_NOTE as hn, HISTORY_REPLACEMENT_TYPES as ht, TODO_STATUSES as i, ScheduleIntentError as in, formatAgentTypes as it, eventAutomationSummarySchema as j, automationSkillNameSchema as jn, spaceListSchema as jt, automationVersionParamsSchema as k, isAgentUpdateEventType as kn, createSpaceBodySchema as kt, automationEventCatalogSchema as l, eventAutomationSchema as ln, decodeStoredConversationEvent as lt, automationLifecycleSchema as m, USER_INPUT_LIMITS as mn, AGENT_HISTORY_ITEM_TYPES as mt, SELF_TODO_ASSIGNEE as n, scheduledAutomationSchema as nn, agentTypeInstructions as nt, isOpenTodoStatus as o, scheduleIntentFromTool as on, conversationEventDataSchema as ot, automationExecutionStatusSchema as p, inboxItemRequestSchema as pn, isAgentHistoryData as pt, conversationReportEventSchema as q, MAX_INPUT_ATTACHMENTS as qt, TODOS_REGISTRATION_NAME as r, scheduledRunSchema as rn, agentTypeSchema as rt, automationEditErrorSchema as s, toolScheduleIntentSchema as sn, conversationTurnFailureCodeSchema as st, OPEN_TODO_STATUSES as t, SCHEDULED_AUTOMATION_SYSTEM_ACTOR as tn, AGENT_TYPES as tt, automationExecutionListSchema as u, eventAutomationTriggerSchema as un, newConversationEventSchema as ut, automationListSchema as v, formatUserInputAnswer as vn, isHistoryReplacement as vt, automationSchedulePreviewSchema as w, AGENT_EVENT_NAMESPACE as wn, instructionProvenanceFor as wt, automationRunSchema as x, userInputFieldsSchema as xn, agentInstructionProvenance as xt, automationParamsSchema as y, isEmptyUserInputAnswer as yn, piMessageFromHistoryItem as yt, conversationAuxiliaryCostsSchema as z, getFirstRunAtMs as zn, inboxItemChangeRecordSchema as zt };
3067
+ export { activityPreviewText as $, automationTitleSchema as $t, automationVersionSchema as A, isWithinNotificationSchedule as An, spaceListQuerySchema as At, conversationDetailQuerySchema as B, TOP_LEVEL_AGENT_MESSAGE_EVENT_TYPE as Bn, annotationCard as Bt, automationScheduleIntentSchema as C, userInputRequestSchema as Cn, instructionActors as Ct, automationVersionActivateSchema as D, automationTaskSchema as Dn, SPACE_NAME_MAX_CHARS as Dt, automationUpdateSchema as E, automationTaskDescription as En, SPACE_DESCRIPTION_MAX_CHARS as Et, actorIdentitySchema as F, isValidTimeZone as Fn, spaceVisibilitySchema as Ft, conversationParamsSchema as G, usageSchema as Gn, resolveMessageCards as Gt, conversationEventHistorySchema as H, isAgentUpdateEventType as Hn, messageCardText as Ht, conversationActivityPreviewSchema as I, CONTENT_VERSION_HEADER as In, updateSpaceBodySchema as It, conversationReportMessageEventSchema as J, inputFileSchema as Jt, conversationReportEventDataSchema as K, usageTokensSchema as Kn, MAX_ATTACHMENT_BYTES as Kt, conversationAttachmentParamsSchema as L, apiErrorSchema as Ln, conversationTreeStateSchema as Lt, scheduledAutomationSummarySchema as M, getFirstRunAtMs as Mn, spaceParamsSchema as Mt, CONVERSATION_DETAIL_VERSION_HEADER as N, getNextRunAtMs as Nn, spaceRefSchema as Nt, automationVersionListSchema as O, automationTaskText as On, archiveSpaceBodySchema as Ot, CONVERSATION_VERSION_HEADER as P, getZonedDateTimeParts as Pn, spaceSchema as Pt, conversationUsageSchema as Q, automationInstructionToolSchema as Qt, conversationAttachmentQuerySchema as R, AGENT_MESSAGE_EVENT_TYPE as Rn, conversationReadPositionSchema as Rt, automationRunWindowsSchema as S, userInputQuestionSchema as Sn, contextProvenance as St, automationSummarySchema as T, automationTaskColumns as Tn, sameActorIdentity as Tt, conversationEventPageSchema as U, isLegacyResultEventType as Un, readMessageCardRefs as Ut, conversationDetailReportSchema as V, isAgentMessageEventType as Vn, messageCardRef as Vt, conversationEventsQuerySchema as W, gatewayOnlyProviders as Wn, removedCardSchema as Wt, conversationSummaryReportSchema as X, readMessageAttachments as Xt, conversationReportStatusSchema as Y, messageAttachmentSchema as Yt, conversationSurfaceSchema as Z, automationContextToolSchema as Zt, automationListQuerySchema as _, buttonUserInputField as _n, historyReplacementSchema as _t, UPDATE_TODOS_TOOL_NAME as a, compileScheduleIntent as an, KNOWN_CONVERSATION_EVENT_TYPES as at, automationRunListSchema as b, normalizeUserInputAnswer as bn, piMessageSchema as bt, automationEditSchema as c, weekdaySchema as cn, conversationTurnFailureReasonSchema as ct, automationExecutionSchema as d, inboxItemNoticeRequestSchema as dn, agentHistoryFromRow as dt, taskOutcomeInputSchema as en, conversationChildAgentTotalsSchema as et, automationExecutionStatusDaySchema as f, inboxItemQuestion as fn, encodeAgentHistoryPayload as ft, automationListPageSchema as g, answeredChoices as gn, historyItemFromPiMessage as gt, automationListItemSchema as h, USER_INPUT_NOTE as hn, HISTORY_REPLACEMENT_TYPES as ht, TODO_STATUSES as i, ScheduleIntentError as in, formatAgentTypes as it, eventAutomationSummarySchema as j, notificationScheduleSchema as jn, spaceListSchema as jt, automationVersionParamsSchema as k, DEFAULT_NOTIFICATION_SCHEDULE as kn, createSpaceBodySchema as kt, automationEventCatalogSchema as l, eventAutomationSchema as ln, decodeStoredConversationEvent as lt, automationLifecycleSchema as m, USER_INPUT_LIMITS as mn, AGENT_HISTORY_ITEM_TYPES as mt, SELF_TODO_ASSIGNEE as n, scheduledAutomationSchema as nn, agentTypeInstructions as nt, isOpenTodoStatus as o, scheduleIntentFromTool as on, conversationEventDataSchema as ot, automationExecutionStatusSchema as p, inboxItemRequestSchema as pn, isAgentHistoryData as pt, conversationReportEventSchema as q, MAX_INPUT_ATTACHMENTS as qt, TODOS_REGISTRATION_NAME as r, scheduledRunSchema as rn, agentTypeSchema as rt, automationEditErrorSchema as s, toolScheduleIntentSchema as sn, conversationTurnFailureCodeSchema as st, OPEN_TODO_STATUSES as t, SCHEDULED_AUTOMATION_SYSTEM_ACTOR as tn, AGENT_TYPES as tt, automationExecutionListSchema as u, eventAutomationTriggerSchema as un, newConversationEventSchema as ut, automationListSchema as v, formatUserInputAnswer as vn, isHistoryReplacement as vt, automationSchedulePreviewSchema as w, automationSkillNameSchema as wn, instructionProvenanceFor as wt, automationRunSchema as x, userInputFieldsSchema as xn, agentInstructionProvenance as xt, automationParamsSchema as y, isEmptyUserInputAnswer as yn, piMessageFromHistoryItem as yt, conversationAuxiliaryCostsSchema as z, AGENT_UPDATE_EVENT_TYPE as zn, inboxItemChangeRecordSchema as zt };
@@ -1,4 +1,4 @@
1
- import { Fs as SlackActionError, qs as withSlackRetries, zs as getSlackClient } from "./db-BFmyYZtJ.js";
1
+ import { Bs as withSlackRetries, Ms as getSlackClient, Os as SlackActionError } from "./db-of6e3sGt.js";
2
2
  import * as z from "zod";
3
3
  // src/chat/slack/users.ts
4
4
  const profileFieldsSchema = z.object({ fields: z.record(z.string(), z.object({
@@ -1,5 +1,5 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-BKpuH2hG.js";
2
- import { n as pluginCatalogRuntime } from "./catalog-runtime-DfSpJZdY.js";
2
+ import { n as pluginCatalogRuntime } from "./catalog-runtime-BfdAnztW.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.317.0";
2
+ var version = "0.318.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-BeZhWWBE.js";
1
+ export { t as JUNIOR_VERSION } from "./version-VEXiEcZu.js";
@@ -1,8 +1,8 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-BKpuH2hG.js";
2
- import { $t as drainConversationMailbox, An as isAttemptInterrupt, Gt as checkInConversationWork, Ir as nudgeIdempotencyKey, Jt as clearConsumedConversationWake, Kt as claimConversationAttempt, Nr as ConversationQueueMessageRejectedError, Qt as deadLetterAttempt, Sn as isInvalidConversationRecordError, Ut as beginConversationResume, Xt as completeConversationStop, Zt as completeConversationWork, _n as countPendingConversationMessages, cn as releaseConversationWork, cr as getTurnRequestDeadline, dn as startConversationWork, jn as selectAttemptMessages, ln as requestAnotherSlice, on as recordAttemptFailure, ou as ownsLocation, rn as getConversationWorkState, sn as recordConversationRetry, tn as ensureConversationWake, xn as isFinalAttempt, yn as hasConversationStop, zt as ackMessages } from "./db-BFmyYZtJ.js";
3
- import { $ as isProviderRetryError, n as getChatConfig } from "./config-CHQ8X251.js";
4
- import { T as withLogContext, b as setSpanAttributes, h as logWarn, m as logInfo, p as logException } from "./logging--smS7XRK.js";
5
- import { K as saveHeldInput, W as getConversationStoppedAtMs } from "./mailbox-turn-uSXhUFc9.js";
2
+ import { $t as completeConversationWork, Cn as isFinalAttempt, Gt as beginConversationResume, Ir as ConversationQueueMessageRejectedError, Jt as claimConversationAttempt, Mn as isAttemptInterrupt, Nl as isTopLevel, Nn as selectAttemptMessages, Qt as completeConversationStop, Vt as ackMessages, Xt as clearConsumedConversationWake, an as getConversationWorkState, cn as recordAttemptFailure, dn as requestAnotherSlice, en as deadLetterAttempt, ln as recordConversationRetry, pn as startConversationWork, qt as checkInConversationWork, rd as isProviderRetryError, rn as ensureConversationWake, tn as drainConversationMailbox, un as releaseConversationWork, ur as getTurnRequestDeadline, wn as isInvalidConversationRecordError, xn as hasConversationStop, yn as countPendingConversationMessages, zr as nudgeIdempotencyKey } from "./db-of6e3sGt.js";
3
+ import { R as getChatConfig } from "./context-BKF_5zzI.js";
4
+ import { f as logException, m as logWarn, p as logInfo, w as withLogContext, y as setSpanAttributes } from "./logging-BnOG0qz2.js";
5
+ import { G as saveHeldInput, U as getConversationStoppedAtMs } from "./mailbox-turn-Byrry9o1.js";
6
6
  // src/chat/task-execution/lost-lease.ts
7
7
  /**
8
8
  * Count a slice that lost its Conversation Lease as a failed attempt, then
@@ -213,7 +213,7 @@ async function processConversationWorkInContext(message, options) {
213
213
  let destination = initial.destination;
214
214
  if (!destination && options.conversationStore) {
215
215
  const stored = await options.conversationStore.get({ conversationId });
216
- if (stored && ownsLocation(stored)) destination = stored.destination;
216
+ if (stored && isTopLevel(stored)) destination = stored.destination;
217
217
  }
218
218
  const lease = await startConversationWork({
219
219
  conversationId,
@@ -0,0 +1,2 @@
1
+ ALTER TABLE "junior_turns" ADD COLUMN "discarded_cost_micro_usd" bigint DEFAULT 0 NOT NULL;--> statement-breakpoint
2
+ ALTER TABLE "junior_turns" ADD COLUMN "discarded_tokens" jsonb;
@@ -0,0 +1,73 @@
1
+ {
2
+ "type": "diff",
3
+ "version": "10",
4
+ "dialect": "postgres",
5
+ "id": "811305d1-7881-43e6-9f0c-280f35526253",
6
+ "prevIds": ["69888e8a-0d59-4095-b43a-c3e1ba2c6cc1"],
7
+ "footprints": [
8
+ {
9
+ "statementType": "add_column",
10
+ "statementTarget": [
11
+ "column",
12
+ "public",
13
+ "junior_turns",
14
+ "discarded_cost_micro_usd"
15
+ ],
16
+ "writes": [
17
+ "s|col|public.junior_turns.discarded_cost_micro_usd",
18
+ "n|col|public.junior_turns.discarded_cost_micro_usd",
19
+ "e|col|public.junior_turns.discarded_cost_micro_usd"
20
+ ],
21
+ "reads": ["n|tbl|public.junior_turns", "n|sch|public"]
22
+ },
23
+ {
24
+ "statementType": "add_column",
25
+ "statementTarget": [
26
+ "column",
27
+ "public",
28
+ "junior_turns",
29
+ "discarded_tokens"
30
+ ],
31
+ "writes": [
32
+ "s|col|public.junior_turns.discarded_tokens",
33
+ "n|col|public.junior_turns.discarded_tokens",
34
+ "e|col|public.junior_turns.discarded_tokens"
35
+ ],
36
+ "reads": ["n|tbl|public.junior_turns", "n|sch|public"]
37
+ }
38
+ ],
39
+ "deltas": [
40
+ {
41
+ "op": "create",
42
+ "row": {
43
+ "schema": "public",
44
+ "table": "junior_turns",
45
+ "name": "discarded_cost_micro_usd",
46
+ "type": "bigint",
47
+ "typeSchema": null,
48
+ "notNull": true,
49
+ "dimensions": 0,
50
+ "default": "0",
51
+ "generated": null,
52
+ "identity": null,
53
+ "entityType": "columns"
54
+ }
55
+ },
56
+ {
57
+ "op": "create",
58
+ "row": {
59
+ "schema": "public",
60
+ "table": "junior_turns",
61
+ "name": "discarded_tokens",
62
+ "type": "jsonb",
63
+ "typeSchema": null,
64
+ "notNull": false,
65
+ "dimensions": 0,
66
+ "default": null,
67
+ "generated": null,
68
+ "identity": null,
69
+ "entityType": "columns"
70
+ }
71
+ }
72
+ ]
73
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sentry/junior",
3
- "version": "0.317.0",
3
+ "version": "0.318.0",
4
4
  "private": false,
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -65,7 +65,7 @@
65
65
  "@modelcontextprotocol/sdk": "1.32.0",
66
66
  "@neondatabase/serverless": "^1.1.0",
67
67
  "@sentry/api": "2.16.0",
68
- "@sentry/junior-plugin-api": "0.317.0",
68
+ "@sentry/junior-plugin-api": "0.318.0",
69
69
  "@sentry/nitro": "11.16.0",
70
70
  "@sentry/node": "11.16.0",
71
71
  "@sentry/server-utils": "11.16.0",
@@ -109,9 +109,9 @@
109
109
  "@emnapi/core": "^1.10.0",
110
110
  "@emnapi/runtime": "^1.10.0",
111
111
  "@hono/node-server": "2.1.3",
112
- "@sentry/junior-github": "0.317.0",
113
- "@sentry/junior-notion": "0.317.0",
114
- "@sentry/junior-sentry": "0.317.0",
112
+ "@sentry/junior-github": "0.318.0",
113
+ "@sentry/junior-notion": "0.318.0",
114
+ "@sentry/junior-sentry": "0.318.0",
115
115
  "@sentry/junior-testing": "0.0.0",
116
116
  "@types/node": "^24.19.2",
117
117
  "@types/pg": "^8.15.6",