@sentry/junior 0.257.0 → 0.258.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 (101) hide show
  1. package/dist/{actor-BTtLaeWy.js → actor-tlxzqaRe.js} +3 -6
  2. package/dist/{admin-DgIkm6Vy.js → admin-My1SLGVO.js} +2 -3
  3. package/dist/{agent-hooks-BjtTzvru.js → agent-hooks-BJ_5mlRH.js} +69 -109
  4. package/dist/{agent-invocations-Bdu3ROfo.js → agent-invocations-Qfz7dWgU.js} +6 -12
  5. package/dist/{agent-runner-D7OboVb3.js → agent-runner-DGsFQw72.js} +261 -458
  6. package/dist/api/schema.d.ts +414 -448
  7. package/dist/api/schema.js +5 -5
  8. package/dist/api.d.ts +2 -12
  9. package/dist/api.js +94 -158
  10. package/dist/{app-BsU5QNBd.d.ts → app-PX2H1PxU.d.ts} +21 -44
  11. package/dist/app.d.ts +3 -3
  12. package/dist/app.js +204 -321
  13. package/dist/{assistant-reply-CbTPebzL.js → assistant-reply-H1M-91oF.js} +3 -5
  14. package/dist/{automation-CHdlHVZP.js → automation-DWBFBenG.js} +6 -11
  15. package/dist/{briefs-oLOldnDM.js → briefs-vYoK85rJ.js} +8 -11
  16. package/dist/{cadence-D00SCzT1.js → cadence-R7Em4RjE.js} +1 -2
  17. package/dist/{catalog-runtime-CZzhGQ7F.js → catalog-runtime-BN4DVxco.js} +3 -4
  18. package/dist/cli/chat.d.ts +2 -4
  19. package/dist/cli/chat.js +22 -24
  20. package/dist/cli/check.d.ts +1 -3
  21. package/dist/cli/check.js +4 -5
  22. package/dist/cli/env.d.ts +1 -3
  23. package/dist/cli/env.js +1 -2
  24. package/dist/cli/init.d.ts +1 -3
  25. package/dist/cli/init.js +3 -3
  26. package/dist/cli/main.d.ts +1 -3
  27. package/dist/cli/main.js +4 -5
  28. package/dist/cli/plugins.d.ts +2 -4
  29. package/dist/cli/plugins.js +7 -8
  30. package/dist/cli/run.d.ts +1 -2
  31. package/dist/cli/run.js +1 -2
  32. package/dist/cli/snapshot-create.d.ts +1 -3
  33. package/dist/cli/snapshot-create.js +4 -5
  34. package/dist/cli/upgrade.d.ts +3 -6
  35. package/dist/cli/upgrade.js +11 -17
  36. package/dist/{client-D8HnkOQX.js → client-DbyHuMFU.js} +9 -16
  37. package/dist/{config-CJRnWK9H.js → config-_WO_AjCB.js} +18 -15
  38. package/dist/{connections-ClYrKzpX.js → connections-ag_1JOhB.js} +14 -19
  39. package/dist/{conversation-CKNLYBJt.js → conversation-DjN3mlog.js} +8 -15
  40. package/dist/{conversation-privacy-C8b1nphZ.js → conversation-privacy-DHP_xnVj.js} +2 -3
  41. package/dist/{conversation-work-C6y3T5Hx.js → conversation-work-BaT_T6EB.js} +1 -2
  42. package/dist/{credential-sync-BXfohNmJ.js → credential-sync-B-CPX_ag.js} +23 -28
  43. package/dist/{db-Ca9Nt5ci.d.ts → db-BnRqQ7G5.d.ts} +1 -1
  44. package/dist/{executor-Do0THDRR.js → executor-RvG6kVe1.js} +30 -52
  45. package/dist/{experimental-CQIvMUO7.js → experimental-BNK1l1jv.js} +2 -4
  46. package/dist/{history-9pO1Zd4Y.js → history-AY8rs-FR.js} +5 -9
  47. package/dist/{history-DvqWZlYX.d.ts → history-BgI33Kie.d.ts} +12 -20
  48. package/dist/{images-BN_BiBXF.js → images-C2J_bj2g.js} +5 -6
  49. package/dist/instrumentation.d.ts +1 -3
  50. package/dist/instrumentation.js +6 -8
  51. package/dist/{job-queue-B6SV9uVa.js → job-queue-DVe37it2.js} +6 -12
  52. package/dist/{logging-CWxiIuCF.js → logging-DsHONhVm.js} +7 -12
  53. package/dist/{message-TUOdbSBW.js → message-DyitL8no.js} +5 -6
  54. package/dist/{model-profile-BwU8mqwD.js → model-profile-Bg8EoCKD.js} +2 -4
  55. package/dist/nitro.d.ts +3 -5
  56. package/dist/nitro.js +12 -17
  57. package/dist/{oauth-authorization-BA4Dt6a7.js → oauth-authorization-djQn5Nhy.js} +2 -4
  58. package/dist/{oauth-callback-server-Dj5UJODo.js → oauth-callback-server-CDby-pCn.js} +3 -4
  59. package/dist/{oauth-relay-CdCnu80W.js → oauth-relay-CTygMkNx.js} +2 -3
  60. package/dist/{package-discovery-BVvSnQBB.js → package-discovery-DJBompdd.js} +17 -21
  61. package/dist/{pending-auth-s_QFribU.js → pending-auth-D8J1uJUS.js} +37 -28
  62. package/dist/{plugin-module-CVvEUSMH.js → plugin-module-Cf5gVPWP.js} +1 -2
  63. package/dist/{plugins-CjfUP5gJ.d.ts → plugins-B11Mfkmv.d.ts} +0 -4
  64. package/dist/{plugins-egKWjgue.js → plugins-DOm9Y6qI.js} +2 -3
  65. package/dist/{private-trace-result-BLvBjy_e.js → private-trace-result-CE7_lEdq.js} +1 -2
  66. package/dist/{profile-h-72wM78.js → profile-DpYjfKke.js} +16 -28
  67. package/dist/{prompt-DyoEj9c2.js → prompt-xgpyMtg7.js} +5 -9
  68. package/dist/{queue-B5SnqRln.d.ts → queue-C37RbDVc.d.ts} +0 -2
  69. package/dist/{registry-sLTr-sV9.js → registry-Du566MtJ.js} +16 -29
  70. package/dist/{resolve-ncQPZROQ.js → resolve-ClCIgh8E.js} +7 -12
  71. package/dist/{result-C883vngT.js → result-BBbKA61B.js} +13 -17
  72. package/dist/{rolldown-runtime-B4FMCO8f.js → rolldown-runtime-nwUcYXjP.js} +1 -2
  73. package/dist/{runner-CzYImdOF.js → runner-CCuqFSqx.js} +12 -13
  74. package/dist/{sandbox-egress-signals-CZbMINHI.js → sandbox-egress-signals-DY1mbKF4.js} +2 -3
  75. package/dist/{schema-Dy69D4Ge.js → schema-DrMh3NtR.js} +15 -26
  76. package/dist/{sentry-CgWZM_kV.js → sentry-BBUlHih9.js} +2 -3
  77. package/dist/{session-stop-CQjKd4a2.js → session-stop-CIoFiwwe.js} +23 -33
  78. package/dist/{skills-C22SLruK.js → skills-DyQBLIrK.js} +9 -9
  79. package/dist/{spawn-DY9CLXDL.js → spawn-Dqfeo7XP.js} +4 -5
  80. package/dist/{store-DoewL5mG.d.ts → store-CG0VJyye.d.ts} +0 -14
  81. package/dist/{store-DXFIQy-G.js → store-DJLwq4x8.js} +13 -15
  82. package/dist/{task-queue-B17vV0La.js → task-queue-BzW4MaWU.js} +5 -7
  83. package/dist/{task-runner-DUjvzYXj.js → task-runner-D3qJh4fK.js} +22 -26
  84. package/dist/{tasks-D_WIJtvO.js → tasks-CEXKTASS.js} +62 -78
  85. package/dist/{thread-state-Ch4yuCqG.js → thread-state-W3f6kAtz.js} +13 -19
  86. package/dist/{turn-failure-response-C5nBKC4S.js → turn-failure-response-CWx7aNIh.js} +16 -22
  87. package/dist/{turn-lifecycle-CO-ylUmV.js → turn-lifecycle-C9JFst7-.js} +2 -3
  88. package/dist/{turn-session-routing-B3LWooK5.js → turn-session-routing-CUxtfpr7.js} +2 -3
  89. package/dist/{validation-CXYxaNYx.js → validation-BHRxa5G4.js} +3 -4
  90. package/dist/vercel.d.ts +1 -3
  91. package/dist/vercel.js +1 -2
  92. package/dist/{version-BcdZy2zg.js → version-C0U6rHg0.js} +3 -5
  93. package/dist/{version-CnXZ614E.d.ts → version-Cc2OFd9G.d.ts} +0 -2
  94. package/dist/version.d.ts +1 -1
  95. package/dist/version.js +1 -2
  96. package/dist/{viewer-DSZXygMU.js → viewer-CGvvRqKp.js} +26 -57
  97. package/dist/{web-input-B9Bv0_lR.js → web-input-Keb5GRWj.js} +98 -155
  98. package/dist/{web-message-id-xPI_EFSC.js → web-message-id-CJSUiksE.js} +3 -6
  99. package/dist/{work-nAfDSUFP.js → work-DRcsJ3hV.js} +14 -16
  100. package/dist/{worker-vGXZ6XFT.js → worker-Cjo-QqPq.js} +7 -8
  101. package/package.json +7 -6
@@ -1,6 +1,6 @@
1
1
  import { z } from "zod";
2
2
  import "@sentry/junior-plugin-api";
3
- //#region src/chat/slack/timestamp.ts
3
+ // src/chat/slack/timestamp.ts
4
4
  /** Native Slack message timestamp, safe to pass as Slack Web API `message_ts`. */
5
5
  const slackMessageTsSchema = z.string().trim().regex(/^\d+(?:\.\d+)?$/).brand();
6
6
  /** Parse a native Slack message timestamp from untrusted message metadata. */
@@ -8,8 +8,7 @@ function parseSlackMessageTs(value) {
8
8
  const parsed = slackMessageTsSchema.safeParse(value);
9
9
  return parsed.success ? parsed.data : void 0;
10
10
  }
11
- //#endregion
12
- //#region src/chat/slack/ids.ts
11
+ // src/chat/slack/ids.ts
13
12
  const slackChannelIdSchema = z.string().regex(/^[CDG][A-Z0-9]+$/).brand();
14
13
  const slackTeamIdSchema = z.string().regex(/^T[A-Z0-9]+$/).brand();
15
14
  const slackUserIdSchema = z.string().regex(/^[UW][A-Z0-9]+$/).brand();
@@ -54,8 +53,7 @@ function parseSlackUserId(value) {
54
53
  const parsed = slackUserIdSchema.safeParse(value.trim());
55
54
  return parsed.success ? parsed.data : void 0;
56
55
  }
57
- //#endregion
58
- //#region src/chat/actor.ts
56
+ // src/chat/actor.ts
59
57
  /**
60
58
  * Canonical actor identity.
61
59
  *
@@ -199,5 +197,4 @@ function createSlackResumeActor(args) {
199
197
  if (!actor || actor.platform !== "slack") throw new Error("Slack actor requires team and user ids");
200
198
  return actor;
201
199
  }
202
- //#endregion
203
200
  export { slackMessageTsSchema as _, isUserActor as a, toStoredSlackActor as c, parseSlackTeamId as d, parseSlackUserId as f, parseSlackMessageTs as g, slackUserIdSchema as h, isActorUserId as i, parseSlackChannelId as l, slackTeamIdSchema as m, createSlackActor as n, parseActorUserId as o, slackChannelIdSchema as p, createSlackResumeActor as r, parseStoredSlackActor as s, createActor as t, parseSlackChannelReferenceId as u };
@@ -1,6 +1,6 @@
1
- import { f as getDb, o as setUserAdminFromSql, r as listAdminUsersFromSql } from "./viewer-DSZXygMU.js";
1
+ import { a as setUserAdminFromSql, d as getDb, n as listAdminUsersFromSql } from "./viewer-CGvvRqKp.js";
2
2
  import { CLI_USAGE } from "./cli/run.js";
3
- //#region src/cli/admin.ts
3
+ // src/cli/admin.ts
4
4
  /**
5
5
  * Operator CLI for the Junior-wide admin role.
6
6
  *
@@ -29,5 +29,4 @@ async function runAdmin(argv) {
29
29
  console.error(CLI_USAGE);
30
30
  return 1;
31
31
  }
32
- //#endregion
33
32
  export { runAdmin };
@@ -1,20 +1,20 @@
1
- import { t as __exportAll } from "./rolldown-runtime-B4FMCO8f.js";
2
- import { a as embedTexts, r as completeObject } from "./client-D8HnkOQX.js";
3
- import { T as withSpan, a as extractGenAiUsageSummary, b as setSpanStatus, f as logException, m as logWarn, p as logInfo, y as setSpanAttributes, z as isRecord$1 } from "./logging-CWxiIuCF.js";
4
- import { a as getClient$1 } from "./sentry-CgWZM_kV.js";
5
- import { t as canExposeConversationPayload } from "./conversation-privacy-C8b1nphZ.js";
6
- import { i as getChatConfig, n as botConfig, o as getSlackBotToken } from "./config-CJRnWK9H.js";
7
- import { r as defaultModelId } from "./model-profile-BwU8mqwD.js";
8
- import { d as parseSlackTeamId, g as parseSlackMessageTs, i as isActorUserId, o as parseActorUserId, u as parseSlackChannelReferenceId } from "./actor-BTtLaeWy.js";
9
- import { I as saveUserTimezone, O as hasAgentTurnUsage, P as readUserTimezone, _ as createSqlStore, a as resolveViewerUser, f as getDb, i as readActorIdentity, l as getConversationEventStore, p as getSqlExecutor } from "./viewer-DSZXygMU.js";
10
- import { c as juniorIdentities, d as juniorDestinations, l as juniorUsers, s as juniorConversations } from "./agent-invocations-Bdu3ROfo.js";
11
- import { _ as juniorConversationAnnotations, b as juniorAttachments, f as juniorConversationBriefs, h as juniorConversationEvents, i as juniorWorkspaces, n as juniorSnapshots, r as juniorWorkspaceRepos, u as juniorConversationParticipants, v as juniorCodeChanges, y as juniorCodeRepositories } from "./executor-Do0THDRR.js";
12
- import { o as decodeStoredConversationEvent } from "./history-9pO1Zd4Y.js";
13
- import { h as credentialSubjectSchema } from "./registry-sLTr-sV9.js";
14
- import { C as conversationReportEventSchema, F as readMessageAttachments, H as conversationBriefSchema, U as parseBriefInput, q as readMessageCardRefs } from "./conversation-CKNLYBJt.js";
15
- import { C as getDefaultRedisStateAdapterFor, N as SANDBOX_WORKSPACE_ROOT, k as sleep$1, l as isSandboxMissingError, n as hash, v as getVercelSandboxCredentials, w as getStateAdapter, x as runNonInteractiveCommand } from "./profile-h-72wM78.js";
16
- import { i as isValidTimeZone } from "./cadence-D00SCzT1.js";
17
- import { n as briefEntriesFromReportEvents, s as generateBrief, t as BRIEF_PROMPT } from "./prompt-DyoEj9c2.js";
1
+ import { t as __exportAll } from "./rolldown-runtime-nwUcYXjP.js";
2
+ import { a as embedTexts, r as completeObject } from "./client-DbyHuMFU.js";
3
+ import { T as withSpan, a as extractGenAiUsageSummary, b as setSpanStatus, f as logException, m as logWarn, p as logInfo, y as setSpanAttributes, z as isRecord$1 } from "./logging-DsHONhVm.js";
4
+ import { a as getClient$1 } from "./sentry-BBUlHih9.js";
5
+ import { t as canExposeConversationPayload } from "./conversation-privacy-DHP_xnVj.js";
6
+ import { i as getChatConfig, n as botConfig, o as getSlackBotToken } from "./config-_WO_AjCB.js";
7
+ import { r as defaultModelId } from "./model-profile-Bg8EoCKD.js";
8
+ import { d as parseSlackTeamId, g as parseSlackMessageTs, i as isActorUserId, o as parseActorUserId, u as parseSlackChannelReferenceId } from "./actor-tlxzqaRe.js";
9
+ import { D as hasAgentTurnUsage, M as readUserTimezone, P as saveUserTimezone, c as getConversationEventStore, d as getDb, f as getSqlExecutor, g as createSqlStore, i as resolveViewerUser, r as readActorIdentity } from "./viewer-CGvvRqKp.js";
10
+ import { c as juniorIdentities, d as juniorDestinations, l as juniorUsers, s as juniorConversations } from "./agent-invocations-Qfz7dWgU.js";
11
+ import { _ as juniorConversationAnnotations, b as juniorAttachments, f as juniorConversationBriefs, h as juniorConversationEvents, i as juniorWorkspaces, n as juniorSnapshots, r as juniorWorkspaceRepos, u as juniorConversationParticipants, v as juniorCodeChanges, y as juniorCodeRepositories } from "./executor-RvG6kVe1.js";
12
+ import { o as decodeStoredConversationEvent } from "./history-AY8rs-FR.js";
13
+ import { h as credentialSubjectSchema } from "./registry-Du566MtJ.js";
14
+ import { C as conversationReportEventSchema, F as readMessageAttachments, H as conversationBriefSchema, U as parseBriefInput, q as readMessageCardRefs } from "./conversation-DjN3mlog.js";
15
+ import { C as getDefaultRedisStateAdapterFor, N as SANDBOX_WORKSPACE_ROOT, k as sleep$1, l as isSandboxMissingError, n as hash, v as getVercelSandboxCredentials, w as getStateAdapter, x as runNonInteractiveCommand } from "./profile-DpYjfKke.js";
16
+ import { i as isValidTimeZone } from "./cadence-R7Em4RjE.js";
17
+ import { n as briefEntriesFromReportEvents, s as generateBrief, t as BRIEF_PROMPT } from "./prompt-xgpyMtg7.js";
18
18
  import { AsyncLocalStorage } from "node:async_hooks";
19
19
  import { z } from "zod";
20
20
  import { createHash, createHmac, randomUUID, timingSafeEqual } from "node:crypto";
@@ -23,7 +23,7 @@ import { codeChangeInputSchema, conversationAnnotationInputSchema, conversationE
23
23
  import { alias } from "drizzle-orm/pg-core";
24
24
  import { WebClient } from "@slack/web-api";
25
25
  import { Sandbox } from "@vercel/sandbox";
26
- //#region src/chat/conversations/structured-events.ts
26
+ // src/chat/conversations/structured-events.ts
27
27
  /** Reserved namespace for Junior-owned conversation metadata events. */
28
28
  const JUNIOR_NATIVE_EVENT_NAMESPACE = "junior";
29
29
  const authenticationEventContentSchema = z.object({
@@ -156,8 +156,7 @@ function renderJuniorNativeConversationEvent(args) {
156
156
  const presentation = definition.renderEvent(definition.parse(args.content));
157
157
  return presentation === void 0 ? void 0 : conversationEventPresentationSchema.parse(presentation);
158
158
  }
159
- //#endregion
160
- //#region src/chat/slack/workspace-context.ts
159
+ // src/chat/slack/workspace-context.ts
161
160
  const workspaceTeamIdStorage = new AsyncLocalStorage();
162
161
  /** Run a callback with the Slack workspace team ID for the inbound webhook. */
163
162
  function runWithWorkspaceTeamId(teamId, fn) {
@@ -168,8 +167,7 @@ function runWithWorkspaceTeamId(teamId, fn) {
168
167
  function getWorkspaceTeamId() {
169
168
  return workspaceTeamIdStorage.getStore();
170
169
  }
171
- //#endregion
172
- //#region src/chat/slack/client.ts
170
+ // src/chat/slack/client.ts
173
171
  var SlackActionError = class extends Error {
174
172
  code;
175
173
  apiError;
@@ -507,8 +505,7 @@ async function downloadPrivateSlackFile(url) {
507
505
  "app.slack.method": "files.download"
508
506
  });
509
507
  }
510
- //#endregion
511
- //#region src/chat/slack/user.ts
508
+ // src/chat/slack/user.ts
512
509
  const slackUserInfoSchema = z.object({
513
510
  ok: z.literal(true),
514
511
  user: z.object({
@@ -577,8 +574,7 @@ async function lookupSlackUser(teamId, userId) {
577
574
  return null;
578
575
  }
579
576
  }
580
- //#endregion
581
- //#region src/chat/identities/timezone.ts
577
+ // src/chat/identities/timezone.ts
582
578
  const DEFAULT_TIMEZONE = "America/Los_Angeles";
583
579
  /** The install timezone, used when Junior does not know a person's timezone. */
584
580
  function defaultTimezone() {
@@ -597,8 +593,7 @@ async function resolveUserTimezone(args) {
597
593
  }
598
594
  return (args.userId ? await readUserTimezone(args.db, args.userId) : void 0) ?? defaultTimezone();
599
595
  }
600
- //#endregion
601
- //#region src/chat/plugins/annotations.ts
596
+ // src/chat/plugins/annotations.ts
602
597
  function annotationFromRow(row) {
603
598
  const parsed = conversationAnnotationInputSchema.safeParse(row.annotation);
604
599
  if (!parsed.success) return void 0;
@@ -661,8 +656,7 @@ async function listConversationAnnotationsById(db, conversationIds) {
661
656
  }
662
657
  return byConversation;
663
658
  }
664
- //#endregion
665
- //#region src/chat/conversations/annotation-results.ts
659
+ // src/chat/conversations/annotation-results.ts
666
660
  /** Save object annotations and retain returned facts in the tool result. */
667
661
  async function saveObjectAnnotations(conversationId, plugin, value) {
668
662
  const annotations = objectAnnotationSchema.array().parse(value);
@@ -699,8 +693,7 @@ async function annotateToolResult(conversationId, plugin, result) {
699
693
  };
700
694
  return annotated;
701
695
  }
702
- //#endregion
703
- //#region src/chat/conversations/sql/privacy.ts
696
+ // src/chat/conversations/sql/privacy.ts
704
697
  const privacyRoot = alias(juniorConversations, "privacy_root");
705
698
  /** Accept only a structurally valid persisted root as privacy authority. */
706
699
  async function readRootCandidate(executor, conversationId) {
@@ -713,7 +706,7 @@ async function readRootCandidate(executor, conversationId) {
713
706
  rootParentConversationId: privacyRoot.parentConversationId,
714
707
  rootRootConversationId: privacyRoot.rootConversationId
715
708
  }).from(juniorConversations).leftJoin(privacyRoot, eq(privacyRoot.conversationId, juniorConversations.rootConversationId)).where(eq(juniorConversations.conversationId, conversationId)))[0];
716
- return row?.requestedRootConversationId !== null && (row?.requestedParentConversationId !== null || row?.requestedRootConversationId === row?.requestedConversationId) && row?.rootConversationId === row.requestedRootConversationId && row.rootRootConversationId === row.rootConversationId && row.rootParentConversationId === null && row.rootDestinationId !== null ? {
709
+ return row !== void 0 && row.requestedRootConversationId !== null && (row.requestedParentConversationId !== null || row.requestedRootConversationId === row.requestedConversationId) && row.rootConversationId === row.requestedRootConversationId && row.rootRootConversationId === row.rootConversationId && row.rootParentConversationId === null && row.rootDestinationId !== null ? {
717
710
  destinationId: row.rootDestinationId,
718
711
  rootConversationId: row.rootConversationId
719
712
  } : void 0;
@@ -740,8 +733,7 @@ async function resolveRootVisibility(executor, conversationId) {
740
733
  };
741
734
  return readCandidateVisibility(executor, candidate);
742
735
  }
743
- //#endregion
744
- //#region src/chat/briefs/events.ts
736
+ // src/chat/briefs/events.ts
745
737
  /** Durable cost and size record for one stored Brief version. */
746
738
  const briefUpdatedEvent = defineConversationEvent({
747
739
  name: "brief_updated",
@@ -761,8 +753,7 @@ const briefUpdatedEvent = defineConversationEvent({
761
753
  };
762
754
  }
763
755
  });
764
- //#endregion
765
- //#region src/chat/slack/attachments.ts
756
+ // src/chat/slack/attachments.ts
766
757
  /** Save the vision summary for a stored Slack attachment. */
767
758
  async function recordSlackAttachment(args) {
768
759
  await args.db.db().update(juniorAttachments).set({ visionSummary: args.visionSummary }).where(and(eq(juniorAttachments.id, args.attachmentId), eq(juniorAttachments.conversationId, args.conversationId), isNull(juniorAttachments.deleteRequestedAt)));
@@ -789,8 +780,7 @@ function getSlackFileId(attachment) {
789
780
  if (metadataId) return metadataId;
790
781
  return (attachment.url ?? attachment.fetchMetadata?.url ?? "").match(/(?:^|[-/])(F[A-Z0-9]+)(?:[-/]|$)/i)?.[1];
791
782
  }
792
- //#endregion
793
- //#region src/api/conversations/message-attachments.ts
783
+ // src/api/conversations/message-attachments.ts
794
784
  /** Resolve saved Slack file references without exposing private storage details. */
795
785
  async function hydrateMessageAttachments(db, conversationId, events) {
796
786
  const messages = events.flatMap((event) => event.data.type === "message" ? [event.data] : []);
@@ -818,8 +808,7 @@ function slackFileIds(meta) {
818
808
  const ids = meta?.slackFileIds ?? meta?.imageFileIds;
819
809
  return Array.isArray(ids) ? ids.filter((id) => typeof id === "string") : [];
820
810
  }
821
- //#endregion
822
- //#region src/chat/sentry-links.ts
811
+ // src/chat/sentry-links.ts
823
812
  function getSentryOrgSlug() {
824
813
  return process.env.SENTRY_ORG_SLUG?.trim() || void 0;
825
814
  }
@@ -855,8 +844,7 @@ function buildSentryEventUrl(eventId) {
855
844
  query: { query: eventId }
856
845
  });
857
846
  }
858
- //#endregion
859
- //#region src/api/conversations/event-model.ts
847
+ // src/api/conversations/event-model.ts
860
848
  /** Apply recorded model choices without carrying a previous turn's settings forward. */
861
849
  function conversationEventModel(data, current) {
862
850
  if (data.type === "turn_started") return void 0;
@@ -895,8 +883,7 @@ function conversationEventModelCall(data) {
895
883
  ...hasAgentTurnUsage(usage) ? { usage } : void 0
896
884
  };
897
885
  }
898
- //#endregion
899
- //#region src/api/conversations/events.ts
886
+ // src/api/conversations/events.ts
900
887
  /** Canonical event types that can contribute to the reporting projection. */
901
888
  const conversationReportSourceEventTypes = [
902
889
  "message",
@@ -1318,8 +1305,7 @@ function projectConversationReportEventPage(args) {
1318
1305
  }
1319
1306
  return projected;
1320
1307
  }
1321
- //#endregion
1322
- //#region src/api/conversations/event-page.ts
1308
+ // src/api/conversations/event-page.ts
1323
1309
  const conversationEventColumns = getTableColumns(juniorConversationEvents);
1324
1310
  const MIN_SCAN_SIZE = 64;
1325
1311
  /** Read bounded canonical rows while excluding model-only replacement history. */
@@ -1430,8 +1416,7 @@ async function readConversationEventPage(executor, args) {
1430
1416
  ...projected.length > events.length && events[0] ? { previousSeq: events[0].seq } : void 0
1431
1417
  };
1432
1418
  }
1433
- //#endregion
1434
- //#region src/chat/briefs/input.ts
1419
+ // src/chat/briefs/input.ts
1435
1420
  const EVENT_PAGE_SIZE = 500;
1436
1421
  async function readReportEventsThrough(executor, conversationId, throughSeq) {
1437
1422
  const pages = [];
@@ -1500,8 +1485,7 @@ async function briefInputFromSql(executor, conversationId, throughSeq) {
1500
1485
  }))
1501
1486
  });
1502
1487
  }
1503
- //#endregion
1504
- //#region src/chat/briefs/operational-report.ts
1488
+ // src/chat/briefs/operational-report.ts
1505
1489
  const DAY_MS$1 = 864e5;
1506
1490
  const WINDOWS = [
1507
1491
  7,
@@ -1595,8 +1579,7 @@ async function buildBriefsOperationalReport(args) {
1595
1579
  }]
1596
1580
  };
1597
1581
  }
1598
- //#endregion
1599
- //#region src/chat/briefs/store.ts
1582
+ // src/chat/briefs/store.ts
1600
1583
  function briefVersionFromRow(row) {
1601
1584
  return {
1602
1585
  conversationId: row.conversationId,
@@ -1654,8 +1637,7 @@ async function readLatestConversationBrief(db, conversationId) {
1654
1637
  const rows = await db.select().from(juniorConversationBriefs).where(eq(juniorConversationBriefs.conversationId, conversationId)).orderBy(desc(juniorConversationBriefs.version)).limit(1);
1655
1638
  return rows[0] ? briefVersionFromRow(rows[0]) : void 0;
1656
1639
  }
1657
- //#endregion
1658
- //#region src/chat/briefs/task.ts
1640
+ // src/chat/briefs/task.ts
1659
1641
  const BRIEF_LOCK_TTL_MS = 6e5;
1660
1642
  function hasUserInstruction(run) {
1661
1643
  return run.transcript.some((entry) => entry.type === "message" && entry.role === "user" && entry.provenance?.authority === "instruction");
@@ -1766,8 +1748,7 @@ const briefsTaskRegistration = {
1766
1748
  await updateConversationBrief(context);
1767
1749
  } } }
1768
1750
  };
1769
- //#endregion
1770
- //#region src/chat/plugins/conversation-events.ts
1751
+ // src/chat/plugins/conversation-events.ts
1771
1752
  function registeredDefinition(plugin, value) {
1772
1753
  return plugin.conversationEvents?.find((definition) => definition === value.definition);
1773
1754
  }
@@ -1804,8 +1785,7 @@ function renderPluginConversationEvent(args) {
1804
1785
  if (!definition) return void 0;
1805
1786
  return definition.renderEvent(definition.parse(args.content));
1806
1787
  }
1807
- //#endregion
1808
- //#region src/api/conversations/membership.ts
1788
+ // src/api/conversations/membership.ts
1809
1789
  /** True when the viewer is a materialized participant on this root conversation. */
1810
1790
  function conversationHasParticipantUser(userId) {
1811
1791
  const participant = getDb().select({ rootConversationId: juniorConversationParticipants.rootConversationId }).from(juniorConversationParticipants).where(and(eq(juniorConversationParticipants.rootConversationId, juniorConversations.conversationId), eq(juniorConversationParticipants.userId, userId)));
@@ -1860,8 +1840,7 @@ async function conversationIdsWithParticipantUser(db, conversationIds, userId) {
1860
1840
  const rows = await db.select({ rootConversationId: juniorConversationParticipants.rootConversationId }).from(juniorConversationParticipants).where(and(eq(juniorConversationParticipants.userId, userId), inArray(juniorConversationParticipants.rootConversationId, [...conversationIds])));
1861
1841
  return new Set(rows.map((row) => row.rootConversationId));
1862
1842
  }
1863
- //#endregion
1864
- //#region src/api/conversations/access.ts
1843
+ // src/api/conversations/access.ts
1865
1844
  const rootConversation = alias(juniorConversations, "access_root_conversation");
1866
1845
  const rootDestination = alias(juniorDestinations, "access_root_destination");
1867
1846
  const rootIdentity = alias(juniorIdentities, "access_root_identity");
@@ -1901,8 +1880,7 @@ async function readConversationAccessFromSql(db, conversationIds, viewer) {
1901
1880
  }];
1902
1881
  }));
1903
1882
  }
1904
- //#endregion
1905
- //#region src/chat/plugins/conversation-event-reader.ts
1883
+ // src/chat/plugins/conversation-event-reader.ts
1906
1884
  function registeredEventName$1(plugin, eventName) {
1907
1885
  if (!plugin.conversationEvents?.some((definition) => definition.eventName === eventName)) throw new TypeError(`Plugin "${plugin.manifest.name}" did not register event "${eventName}"`);
1908
1886
  return eventName;
@@ -1924,8 +1902,7 @@ function createPluginConversationEventReader(plugin) {
1924
1902
  }));
1925
1903
  } };
1926
1904
  }
1927
- //#endregion
1928
- //#region src/chat/plugins/conversation-event-stats.ts
1905
+ // src/chat/plugins/conversation-event-stats.ts
1929
1906
  const DAY_MS = 864e5;
1930
1907
  const costRowSchema = z.object({
1931
1908
  costUsd: z.number().finite().nonnegative(),
@@ -2006,8 +1983,7 @@ function createPluginConversationEventStats(plugin, now = Date.now) {
2006
1983
  }
2007
1984
  };
2008
1985
  }
2009
- //#endregion
2010
- //#region src/chat/plugins/logging.ts
1986
+ // src/chat/plugins/logging.ts
2011
1987
  /** Create the host logger exposed to plugin hooks. */
2012
1988
  function createPluginLogger(plugin) {
2013
1989
  return {
@@ -2033,8 +2009,7 @@ function createPluginLogger(plugin) {
2033
2009
  }
2034
2010
  };
2035
2011
  }
2036
- //#endregion
2037
- //#region src/chat/plugins/model.ts
2012
+ // src/chat/plugins/model.ts
2038
2013
  /** Create the host-owned structured model capability exposed to plugins. */
2039
2014
  function createPluginModel(pluginName, options = {}, runtime = {}) {
2040
2015
  return { async completeObject(input) {
@@ -2072,8 +2047,7 @@ function createPluginEmbedder(pluginName, runtime = {}) {
2072
2047
  });
2073
2048
  } };
2074
2049
  }
2075
- //#endregion
2076
- //#region src/chat/plugins/state.ts
2050
+ // src/chat/plugins/state.ts
2077
2051
  const MAX_PLUGIN_STATE_KEY_LENGTH = 512;
2078
2052
  function hashKeyPart(value) {
2079
2053
  return createHash("sha256").update(value).digest("hex").slice(0, 32);
@@ -2130,8 +2104,7 @@ function createPluginState(plugin, adapter) {
2130
2104
  }
2131
2105
  };
2132
2106
  }
2133
- //#endregion
2134
- //#region src/chat/dashboard-link.ts
2107
+ // src/chat/dashboard-link.ts
2135
2108
  let dashboardConversationLinkOptions;
2136
2109
  function withHttps(host) {
2137
2110
  return /^https?:\/\//.test(host) ? host : `https://${host}`;
@@ -2181,12 +2154,10 @@ function getDashboardObjectIconLink(icon) {
2181
2154
  if (url.protocol !== "https:" || url.hostname === "localhost") return void 0;
2182
2155
  return url.href;
2183
2156
  }
2184
- //#endregion
2185
- //#region src/chat/state/ttl.ts
2157
+ // src/chat/state/ttl.ts
2186
2158
  /** Retain expiring conversation/runtime state long enough for resume and dashboard history. */
2187
2159
  const JUNIOR_THREAD_STATE_TTL_MS = 6048e5;
2188
- //#endregion
2189
- //#region src/chat/events/timer-index.ts
2160
+ // src/chat/events/timer-index.ts
2190
2161
  const DUE_KEY = "junior:watches:due";
2191
2162
  const CLAIM_MS = 12e4;
2192
2163
  const BATCH_SIZE = 25;
@@ -2257,8 +2228,7 @@ async function updateTimerIndex(state, operation) {
2257
2228
  await state.releaseLock(lock);
2258
2229
  }
2259
2230
  }
2260
- //#endregion
2261
- //#region src/chat/credentials/subject.ts
2231
+ // src/chat/credentials/subject.ts
2262
2232
  const CREDENTIAL_SUBJECT_HMAC_CONTEXT = "junior.credential_subject.v1";
2263
2233
  const CREDENTIAL_SUBJECT_SIGNATURE_VERSION = "v1";
2264
2234
  function getCredentialSubjectSecret() {
@@ -2444,8 +2414,7 @@ function verifyTimerWatchCredentialSubject(input) {
2444
2414
  subject.userId
2445
2415
  ])), binding.signature);
2446
2416
  }
2447
- //#endregion
2448
- //#region src/chat/events/store.ts
2417
+ // src/chat/events/store.ts
2449
2418
  const EVENT_PREFIX = "junior:resource_event_subscription:v5";
2450
2419
  const INDEX_LOCK_TTL_MS = 1e4;
2451
2420
  const SUBSCRIPTION_LOCK_TTL_MS = 1e4;
@@ -2832,8 +2801,7 @@ async function deliverWatch(input) {
2832
2801
  return delivered;
2833
2802
  }, input.waitDeadlineMs);
2834
2803
  }
2835
- //#endregion
2836
- //#region src/chat/events/tool-support.ts
2804
+ // src/chat/events/tool-support.ts
2837
2805
  /** Default lifetime for temporary watches. */
2838
2806
  const RESOURCE_SUBSCRIPTION_DEFAULT_TTL_MS = 12096e5;
2839
2807
  /** Hard upper bound for temporary watches. */
@@ -2843,8 +2811,7 @@ const RESOURCE_WATCH_TOOL_SOURCE = {
2843
2811
  id: "resource-watches",
2844
2812
  description: "Inspect or stop watches for the current conversation and its child agents."
2845
2813
  };
2846
- //#endregion
2847
- //#region src/chat/slack/tool-support/context.ts
2814
+ // src/chat/slack/tool-support/context.ts
2848
2815
  /** Resolve Slack tool context from the Conversation Location. */
2849
2816
  function getSlackToolContext(context) {
2850
2817
  const source = context.source.kind === "slack" ? context.source : void 0;
@@ -2882,8 +2849,7 @@ function isSlackMessageTurn(context) {
2882
2849
  function slackMessageTurnDisabledReason(context) {
2883
2850
  return isSlackMessageTurn(context) ? void 0 : "It needs a Turn that a person started with a Slack message.";
2884
2851
  }
2885
- //#endregion
2886
- //#region src/chat/slack/tool-support/channel-capabilities.ts
2852
+ // src/chat/slack/tool-support/channel-capabilities.ts
2887
2853
  /** Resolve channel capabilities from a Slack channel ID. */
2888
2854
  function resolveChannelCapabilities(channelId) {
2889
2855
  return {
@@ -2893,8 +2859,7 @@ function resolveChannelCapabilities(channelId) {
2893
2859
  canAddReactions: isConversationScopedChannel(channelId)
2894
2860
  };
2895
2861
  }
2896
- //#endregion
2897
- //#region src/chat/workspaces/checkout-path.ts
2862
+ // src/chat/workspaces/checkout-path.ts
2898
2863
  /** Derive the fixed sandbox checkout path for one repository, or undefined when invalid. */
2899
2864
  function tryWorkspaceRepoCheckoutPath(repo) {
2900
2865
  const name = repo.split("/").filter(Boolean).at(-1);
@@ -2907,8 +2872,7 @@ function workspaceRepoCheckoutPath(repo) {
2907
2872
  if (!path) throw new Error(`Invalid repository name for checkout path: ${repo}`);
2908
2873
  return path;
2909
2874
  }
2910
- //#endregion
2911
- //#region src/chat/sandbox/snapshot/builder-sandbox.ts
2875
+ // src/chat/sandbox/snapshot/builder-sandbox.ts
2912
2876
  /** Resume the named Sandbox that owns one Workspace snapshot build. */
2913
2877
  async function getWorkspaceSnapshotBuilder(name, signal) {
2914
2878
  const credentials = getVercelSandboxCredentials();
@@ -2938,12 +2902,10 @@ async function deleteWorkspaceSnapshotBuilders(names) {
2938
2902
  }
2939
2903
  if (hasError) throw firstError;
2940
2904
  }
2941
- //#endregion
2942
- //#region src/chat/sandbox/snapshot/runtime.ts
2905
+ // src/chat/sandbox/snapshot/runtime.ts
2943
2906
  /** Runtime used to build and start reusable Sandbox snapshots. */
2944
2907
  const SANDBOX_RUNTIME = "node22";
2945
- //#endregion
2946
- //#region src/chat/sandbox/snapshot/store.ts
2908
+ // src/chat/sandbox/snapshot/store.ts
2947
2909
  function builderNames(rows) {
2948
2910
  return [...new Set(rows.map((row) => row.sandboxName).filter((name) => Boolean(name)))];
2949
2911
  }
@@ -3075,8 +3037,7 @@ async function setWorkspaceSnapshotBuild(workspaceId, build, options = {}) {
3075
3037
  }).onConflictDoNothing().returning({ id: juniorSnapshots.id })).length > 0;
3076
3038
  });
3077
3039
  }
3078
- //#endregion
3079
- //#region src/chat/workspaces/validation.ts
3040
+ // src/chat/workspaces/validation.ts
3080
3041
  const WORKSPACE_NAME_PATTERN = /^[a-z][a-z0-9_-]{0,63}$/;
3081
3042
  const PROVIDER_PATTERN = /^[a-z][a-z0-9_-]{0,63}$/;
3082
3043
  const REPO_PATTERN = /^[A-Za-z0-9._-]+\/[A-Za-z0-9._-]+$/;
@@ -3128,8 +3089,7 @@ function normalizeWorkspaceRecipe(input) {
3128
3089
  repos
3129
3090
  };
3130
3091
  }
3131
- //#endregion
3132
- //#region src/chat/workspaces/store.ts
3092
+ // src/chat/workspaces/store.ts
3133
3093
  function workspaceFromRows(row, repos, snapshot) {
3134
3094
  return {
3135
3095
  id: row.id,
@@ -3288,8 +3248,7 @@ async function deleteWorkspace(id) {
3288
3248
  await cleanupSnapshotBuilders(id, result.builderNames);
3289
3249
  return result.deleted;
3290
3250
  }
3291
- //#endregion
3292
- //#region src/chat/code/store.ts
3251
+ // src/chat/code/store.ts
3293
3252
  /** Record the latest details for one code change created by Junior. */
3294
3253
  async function recordCodeChange(db, provider, input) {
3295
3254
  const change = codeChangeInputSchema.parse(input);
@@ -3357,8 +3316,7 @@ async function associateCodeChangeConversations(db, provider, input) {
3357
3316
  ORDER BY value
3358
3317
  )` }).where(and(eq(juniorCodeChanges.provider, provider), eq(juniorCodeChanges.providerId, input.providerId)));
3359
3318
  }
3360
- //#endregion
3361
- //#region src/chat/code/publisher.ts
3319
+ // src/chat/code/publisher.ts
3362
3320
  /** Connect a plugin to Junior's code records. */
3363
3321
  function createCodeChangePublisher(provider) {
3364
3322
  return {
@@ -3370,8 +3328,7 @@ function createCodeChangePublisher(provider) {
3370
3328
  }
3371
3329
  };
3372
3330
  }
3373
- //#endregion
3374
- //#region src/chat/briefs/registration.ts
3331
+ // src/chat/briefs/registration.ts
3375
3332
  var registration_exports = /* @__PURE__ */ __exportAll({
3376
3333
  coreTaskRegistrations: () => coreTaskRegistrations,
3377
3334
  isBriefsEnabled: () => isBriefsEnabled,
@@ -3392,8 +3349,7 @@ function isBriefsEnabled() {
3392
3349
  function coreTaskRegistrations() {
3393
3350
  return isBriefsEnabled() ? [briefsTaskRegistration] : [];
3394
3351
  }
3395
- //#endregion
3396
- //#region src/chat/plugins/agent-hooks.ts
3352
+ // src/chat/plugins/agent-hooks.ts
3397
3353
  var agent_hooks_exports = /* @__PURE__ */ __exportAll({
3398
3354
  PluginHookDeniedError: () => PluginHookDeniedError,
3399
3355
  applyPluginFormatMarkdown: () => applyPluginFormatMarkdown,
@@ -3777,9 +3733,11 @@ function getPluginTools(context, sandbox = createSandboxCapability(context.works
3777
3733
  }
3778
3734
  };
3779
3735
  const resolveActor = context.resolveActorIdentity ?? (async () => void 0);
3736
+ const automationUrl = (context.source.kind === "event_automation" || context.source.kind === "scheduled_automation") && context.source.automationId ? getDashboardTaskLink(context.source.automationId) : void 0;
3780
3737
  const common = {
3781
3738
  ...basePluginContext(plugin),
3782
3739
  annotations,
3740
+ ...automationUrl ? { automationLink: { url: automationUrl } } : void 0,
3783
3741
  conversationId: context.conversationId,
3784
3742
  locationId: context.locationId,
3785
3743
  ...slackContext ? { slack: slackContext } : void 0,
@@ -4094,7 +4052,10 @@ function sanitizeOperationalReport(args) {
4094
4052
  categories: widget.categories.slice(-100).map((category, categoryIndex) => ({
4095
4053
  id: operationalReportText(category.id, OPERATIONAL_REPORT_MAX_LABEL_LENGTH) ?? `${widgetIndex}:${categoryIndex}`,
4096
4054
  label: operationalReportText(category.label, OPERATIONAL_REPORT_MAX_LABEL_LENGTH) ?? String(categoryIndex + 1),
4097
- values: Object.fromEntries(seriesEntries.map(({ sanitizedSeries, sourceKey }) => [sanitizedSeries.key, Number.isFinite(category.values[sourceKey]) ? category.values[sourceKey] : 0]))
4055
+ values: Object.fromEntries(seriesEntries.map(({ sanitizedSeries, sourceKey }) => {
4056
+ const value = category.values[sourceKey];
4057
+ return [sanitizedSeries.key, value !== void 0 && Number.isFinite(value) ? value : 0];
4058
+ }))
4098
4059
  })),
4099
4060
  id,
4100
4061
  series,
@@ -4370,5 +4331,4 @@ function createPluginHookRunner(input = {}) {
4370
4331
  }
4371
4332
  };
4372
4333
  }
4373
- //#endregion
4374
4334
  export { bindSlackDirectCredentialSubject as $, authenticationUnlinkedEvent as $t, getWorkspaceSnapshotBuilder as A, resolveRootVisibility as At, STOP_WATCHING_TOOL_NAME as B, getFilePermalink as Bt, WorkspaceValidationError as C, readLatestConversationBrief as Ct, setWorkspaceSnapshotBuild as D, matchSlackAttachments as Dt, setWorkspaceSnapshot as E, getSlackFileId as Et, isSlackMessageTurn as F, defaultTimezone as Ft, createWatch as G, normalizeSlackConversationId as Gt, cancelWatch as H, getSlackClient as Ht, slackMessageTurnDisabledReason as I, resolveUserTimezone as It, getWatch as J, getWorkspaceTeamId as Jt, deliverWatch as K, runWithSlackInstallationToken as Kt, RESOURCE_SUBSCRIPTION_DEFAULT_TTL_MS as L, lookupSlackUser as Lt, workspaceRepoCheckoutPath as M, createPluginAnnotations as Mt, resolveChannelCapabilities as N, listConversationAnnotations as Nt, SANDBOX_RUNTIME as O, readAttachmentVisionSummary as Ot, getSlackToolContext as P, listConversationAnnotationsById as Pt, bindScheduledAutomationCredentialSubject as Q, authenticationLinkedEvent as Qt, RESOURCE_SUBSCRIPTION_MAX_TTL_MS as R, SlackActionError as Rt, updateWorkspace as S, createPluginConversationEvents as St, loadSnapshotsForProfile as T, buildSentryConversationUrl as Tt, collectEventMatchKeys as U, isConversationScopedChannel as Ut, cancelSubscriptions as V, getHeaderString as Vt, createTimerWatch as W, isDmChannel as Wt, takeDueTimerWatches as X, JUNIOR_NATIVE_EVENT_NAMESPACE as Xt, listWatches as Y, runWithWorkspaceTeamId as Yt, bindEventAutomationCredentialSubject as Z, agentsInstructionsUpdatedEvent as Zt, deleteWorkspace as _, conversationHasParticipantEmail as _t, getPluginRoutes as a, getDashboardConversationLink as at, listWorkspaces as b, conversationNotArchivedForUser as bt, getPluginTools as c, setDashboardConversationLinkOptions as ct, setPlugins as d, createPluginModel as dt, conversationNoteEvent as en, verifyEventAutomationCredentialSubject as et, validatePlugins as f, createPluginLogger as ft, createWorkspace as g, conversationArchivedForUser as gt, setBriefsConfig as h, conversationArchivedForEmail as ht, getPluginApiRoutes as i, JUNIOR_THREAD_STATE_TTL_MS as it, tryWorkspaceRepoCheckoutPath as j, saveObjectAnnotations as jt, deleteWorkspaceSnapshotBuilders as k, recordSlackAttachment as kt, getPluginUserPromptContributions as l, createPluginState as lt, registration_exports as m, conversationArchiveTimes as mt, applyPluginFormatMarkdown as n, verifySlackDirectCredentialSubject as nt, getPluginSlackConversationLink as o, getDashboardObjectIconLink as ot, coreTaskRegistrations as p, readConversationAccessFromSql as pt, findMatchingWatches as q, withSlackRetries as qt, createPluginHookRunner as r, verifyTimerWatchCredentialSubject as rt, getPluginSystemPromptContributions as s, getDashboardTaskLink as st, agent_hooks_exports as t, verifyScheduledAutomationCredentialSubject as tt, getPlugins as u, createPluginEmbedder as ut, getWorkspace as v, conversationHasParticipantUser as vt, invalidateReadySnapshot as w, readConversationEventPage as wt, listWorkspacesByRepository as x, viewerConversationMembership as xt, getWorkspaceByName as y, conversationNotArchivedForEmail as yt, RESOURCE_WATCH_TOOL_SOURCE as z, downloadPrivateSlackFile as zt };
@@ -1,10 +1,9 @@
1
1
  import { z } from "zod";
2
2
  import { getTableColumns, sql } from "drizzle-orm";
3
3
  import { boolean, index, integer, jsonb, pgTable, primaryKey, text, timestamp, uniqueIndex } from "drizzle-orm/pg-core";
4
- //#region src/db/schema/timestamps.ts
4
+ // src/db/schema/timestamps.ts
5
5
  const timestamptz = (name) => timestamp(name, { withTimezone: true });
6
- //#endregion
7
- //#region src/db/schema/destinations.ts
6
+ // src/db/schema/destinations.ts
8
7
  const juniorDestinationKindSchema = z.enum([
9
8
  "channel",
10
9
  "dm",
@@ -26,8 +25,7 @@ const juniorDestinations = pgTable("junior_destinations", {
26
25
  createdAt: timestamptz("created_at").notNull(),
27
26
  updatedAt: timestamptz("updated_at").notNull()
28
27
  }, (table) => [uniqueIndex("junior_destinations_provider_destination_uidx").on(table.provider, table.providerTenantId, table.providerDestinationId), index("junior_destinations_provider_kind_idx").on(table.provider, table.kind)]);
29
- //#endregion
30
- //#region src/db/schema/users.ts
28
+ // src/db/schema/users.ts
31
29
  const juniorUsers = pgTable("junior_users", {
32
30
  id: text("id").primaryKey(),
33
31
  primaryEmail: text("primary_email").notNull(),
@@ -39,8 +37,7 @@ const juniorUsers = pgTable("junior_users", {
39
37
  createdAt: timestamptz("created_at").notNull(),
40
38
  updatedAt: timestamptz("updated_at").notNull()
41
39
  }, (table) => [uniqueIndex("junior_users_primary_email_normalized_uidx").on(table.primaryEmailNormalized)]);
42
- //#endregion
43
- //#region src/db/schema/identities.ts
40
+ // src/db/schema/identities.ts
44
41
  const juniorIdentities = pgTable("junior_identities", {
45
42
  id: text("id").primaryKey(),
46
43
  kind: text("kind").$type().notNull(),
@@ -64,8 +61,7 @@ const juniorIdentities = pgTable("junior_identities", {
64
61
  index("junior_identities_verified_email_idx").on(table.emailNormalized).where(sql`${table.emailVerified} = true AND ${table.emailNormalized} IS NOT NULL`),
65
62
  index("junior_identities_kind_provider_idx").on(table.kind, table.provider)
66
63
  ]);
67
- //#endregion
68
- //#region src/db/schema/conversations.ts
64
+ // src/db/schema/conversations.ts
69
65
  const juniorConversations = pgTable("junior_conversations", {
70
66
  conversationId: text("conversation_id").primaryKey(),
71
67
  schemaVersion: integer("schema_version").notNull().default(1),
@@ -116,8 +112,7 @@ function conversationReadColumns() {
116
112
  const { legacyArchivedAt, ...columns } = getTableColumns(juniorConversations);
117
113
  return columns;
118
114
  }
119
- //#endregion
120
- //#region src/db/schema/agent-invocations.ts
115
+ // src/db/schema/agent-invocations.ts
121
116
  const AGENT_INVOCATION_STATUSES = [
122
117
  "pending",
123
118
  "running",
@@ -176,5 +171,4 @@ const juniorAgentInvocations = pgTable("junior_agent_invocations", {
176
171
  index("junior_agent_invocations_mailbox_idx").on(table.mailboxStatus, table.createdAt),
177
172
  index("junior_agent_invocations_parent_mailbox_idx").on(table.parentMailboxStatus, table.terminalAt)
178
173
  ]);
179
- //#endregion
180
174
  export { juniorAgentInvocations as a, juniorIdentities as c, juniorDestinations as d, timestamptz as f, juniorAgentBindings as i, juniorUsers as l, AGENT_INVOCATION_PARENT_MAILBOX_STATUSES as n, conversationReadColumns as o, AGENT_INVOCATION_STATUSES as r, juniorConversations as s, AGENT_INVOCATION_MAILBOX_STATUSES as t, juniorDestinationKindSchema as u };