@sentry/junior 0.194.0 → 0.195.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 (88) hide show
  1. package/dist/{agent-hooks-IDX764FD.js → agent-hooks-VIBTIP5F.js} +11 -11
  2. package/dist/api/activity.d.ts +9 -1
  3. package/dist/api/code/overview.d.ts +12 -0
  4. package/dist/api/locations/detail.d.ts +8 -0
  5. package/dist/api/locations/list.d.ts +5 -0
  6. package/dist/api/people/code.d.ts +6 -0
  7. package/dist/api/people/shared.d.ts +9 -1
  8. package/dist/api/reporting-window.d.ts +39 -1
  9. package/dist/api/schema/code.d.ts +12 -0
  10. package/dist/api/schema/conversation.d.ts +25 -0
  11. package/dist/api/schema/location.d.ts +13 -0
  12. package/dist/api/schema/person.d.ts +14 -0
  13. package/dist/api/schema/task.d.ts +12 -0
  14. package/dist/api/schema.js +1 -1
  15. package/dist/api.js +242 -63
  16. package/dist/app.js +102 -38
  17. package/dist/{catalog-runtime-MICXEBLK.js → catalog-runtime-6E6SGRZK.js} +4 -4
  18. package/dist/chat/config.d.ts +1 -0
  19. package/dist/chat/event-tasks/store.d.ts +27 -17
  20. package/dist/chat/resource-events/notification.d.ts +2 -1
  21. package/dist/chat/services/automated-turn-limit.d.ts +110 -0
  22. package/dist/chat/slack/automated-turn-limit-notice.d.ts +38 -0
  23. package/dist/chat/tasks/execution-stats.d.ts +2 -1
  24. package/dist/chat/tasks/read.d.ts +5 -2
  25. package/dist/{chunk-KNIAWMBU.js → chunk-3VWIZVK7.js} +1 -1
  26. package/dist/{chunk-XND3J6AT.js → chunk-5HNXLP4W.js} +1 -1
  27. package/dist/{chunk-VOB2DKO6.js → chunk-5NR7N567.js} +24 -13
  28. package/dist/{chunk-CFGBKPWQ.js → chunk-6GGDBXXP.js} +3 -3
  29. package/dist/{chunk-IOGDKPVU.js → chunk-6TRQLG3D.js} +1 -1
  30. package/dist/{chunk-V4HXV5MY.js → chunk-7MYXH5LA.js} +1 -1
  31. package/dist/{chunk-6H2MKVV5.js → chunk-7PQMTME5.js} +1 -1
  32. package/dist/{chunk-INTBMGNX.js → chunk-7UED4D5T.js} +21 -21
  33. package/dist/{chunk-NPO24LAN.js → chunk-BJZML4RT.js} +8 -8
  34. package/dist/{chunk-IME5OW4Y.js → chunk-C4NY6L7S.js} +1 -1
  35. package/dist/{chunk-53IEEFFP.js → chunk-CE2P6TOV.js} +3 -3
  36. package/dist/{chunk-WMJS5DDV.js → chunk-DTYOEHUP.js} +148 -19
  37. package/dist/{chunk-GY5SEFVL.js → chunk-FE3Y4KES.js} +5 -5
  38. package/dist/{chunk-G4RARFNT.js → chunk-FEZIEEOP.js} +957 -567
  39. package/dist/{chunk-XLWZRHX5.js → chunk-FPQPYJEG.js} +23 -29
  40. package/dist/{chunk-73JEAQRT.js → chunk-HE5PZAPS.js} +4 -4
  41. package/dist/{chunk-X76JVHQ4.js → chunk-HUQOXMDG.js} +1 -1
  42. package/dist/{chunk-NWWDFHXP.js → chunk-I4RH3KLJ.js} +1 -1
  43. package/dist/{chunk-QMEF4Z7R.js → chunk-JBSCMOLR.js} +5 -5
  44. package/dist/{chunk-JOI3DHML.js → chunk-KBPWC7NU.js} +1 -1
  45. package/dist/{chunk-ADEACKAH.js → chunk-KQ3GZGBK.js} +10 -3
  46. package/dist/{chunk-2NL3Y47F.js → chunk-KUQRWV53.js} +5 -5
  47. package/dist/{chunk-ELCYG6UU.js → chunk-L62JVQPL.js} +3 -3
  48. package/dist/{chunk-7ANA7PBB.js → chunk-LM7UE523.js} +3 -3
  49. package/dist/{chunk-U76RWMFR.js → chunk-LMYRF6HX.js} +4 -2
  50. package/dist/{chunk-F2KSURTJ.js → chunk-N67T4VY3.js} +9 -9
  51. package/dist/{chunk-AWZS5SVX.js → chunk-OQHO62VA.js} +8 -8
  52. package/dist/{chunk-CCTYK5RH.js → chunk-PFQRZ4IB.js} +9 -6
  53. package/dist/{chunk-H4DCWLTR.js → chunk-PYTRZZ4V.js} +8 -8
  54. package/dist/{chunk-XRDSML3K.js → chunk-QHJZSYKY.js} +2 -2
  55. package/dist/{chunk-E53C73ML.js → chunk-QKHZF2LH.js} +4 -4
  56. package/dist/{chunk-YSLIB7ER.js → chunk-QPZL2IYT.js} +82 -6
  57. package/dist/{chunk-RFE7DCZK.js → chunk-R5BGW4WR.js} +2 -2
  58. package/dist/{chunk-ENWIHU54.js → chunk-R5OHONYU.js} +6 -6
  59. package/dist/{chunk-WWXJUURQ.js → chunk-RKA22BQP.js} +1 -1
  60. package/dist/{chunk-P2P6MUQ4.js → chunk-RQO67SAO.js} +2 -2
  61. package/dist/{chunk-OEQOAONV.js → chunk-RZ3PBNDV.js} +6 -6
  62. package/dist/{chunk-G35QGPO2.js → chunk-VYDIA2UL.js} +1 -1
  63. package/dist/{chunk-S7GX44BU.js → chunk-X3PBQ4BK.js} +1 -1
  64. package/dist/cli/chat.js +33 -33
  65. package/dist/cli/check.js +5 -5
  66. package/dist/cli/plugins.js +12 -12
  67. package/dist/cli/snapshot-create.js +9 -9
  68. package/dist/cli/upgrade.js +6 -6
  69. package/dist/db/schema/event-tasks.d.ts +21 -0
  70. package/dist/db/schema.d.ts +19 -0
  71. package/dist/{db-3IEVINAY.js → db-FVCSDROR.js} +6 -6
  72. package/dist/instrumentation.js +3 -3
  73. package/dist/nitro.js +6 -6
  74. package/dist/{oauth-callback-server-N7L2BB4L.js → oauth-callback-server-Z5PXTDOE.js} +29 -29
  75. package/dist/{runner-PTTZV3WU.js → runner-RHYU7OGV.js} +21 -21
  76. package/dist/{skills-POMWS2RR.js → skills-QTN73DN5.js} +5 -5
  77. package/dist/spawn-R56OWLUH.js +42 -0
  78. package/dist/task-runner-LLJZTLRP.js +36 -0
  79. package/dist/{validation-U6LOMXR7.js → validation-2ZK7GA6N.js} +5 -5
  80. package/dist/version.js +1 -1
  81. package/dist/{work-FHA3BS4L.js → work-7IBKSZRU.js} +21 -21
  82. package/dist/{worker-GR4UNVVP.js → worker-RNVQVCO7.js} +10 -10
  83. package/migrations/0038_event_task_status.sql +5 -0
  84. package/migrations/meta/0038_snapshot.json +3323 -0
  85. package/migrations/meta/_journal.json +8 -1
  86. package/package.json +5 -5
  87. package/dist/spawn-R75MXXKE.js +0 -42
  88. package/dist/task-runner-OQLRHADB.js +0 -36
@@ -4,7 +4,7 @@ import {
4
4
  } from "./chunk-VFUK3X5B.js";
5
5
  import {
6
6
  DEFAULT_SQL_STATEMENT_TIMEOUT_MS
7
- } from "./chunk-U76RWMFR.js";
7
+ } from "./chunk-LMYRF6HX.js";
8
8
 
9
9
  // src/db/neon.ts
10
10
  import { AsyncLocalStorage } from "async_hooks";
@@ -560,6 +560,7 @@ var juniorLocationConfigurations = pgTable13(
560
560
  );
561
561
 
562
562
  // src/db/schema/event-tasks.ts
563
+ import { sql as sql5 } from "drizzle-orm";
563
564
  import { bigint, index as index11, jsonb as jsonb6, pgTable as pgTable14, text as text14 } from "drizzle-orm/pg-core";
564
565
  var juniorEventTasks = pgTable14(
565
566
  "junior_event_tasks",
@@ -569,22 +570,15 @@ var juniorEventTasks = pgTable14(
569
570
  namespace: text14("namespace").notNull(),
570
571
  identifier: text14("identifier").notNull(),
571
572
  createdAtMs: bigint("created_at_ms", { mode: "number" }).notNull(),
573
+ /** Retained row status. Deleted tasks keep history but stop matching. */
574
+ status: text14("status").$type().notNull().default("active"),
572
575
  /** Short display title generated from the task instruction. */
573
576
  title: text14("title"),
574
577
  task: jsonb6("task_json").$type().notNull()
575
578
  },
576
579
  (table) => [
577
- index11("junior_event_tasks_team_idx").on(
578
- table.teamId,
579
- table.createdAtMs,
580
- table.id
581
- ),
582
- index11("junior_event_tasks_match_idx").on(
583
- table.namespace,
584
- table.identifier,
585
- table.createdAtMs,
586
- table.id
587
- )
580
+ index11("junior_event_tasks_team_idx").on(table.teamId, table.createdAtMs, table.id).where(sql5`${table.status} <> 'deleted'`),
581
+ index11("junior_event_tasks_match_idx").on(table.namespace, table.identifier, table.createdAtMs, table.id).where(sql5`${table.status} <> 'deleted'`)
588
582
  ]
589
583
  );
590
584
 
@@ -608,7 +602,7 @@ var juniorStats = pgTable15(
608
602
  );
609
603
 
610
604
  // src/db/schema/task-executions.ts
611
- import { sql as sql5 } from "drizzle-orm";
605
+ import { sql as sql6 } from "drizzle-orm";
612
606
  import {
613
607
  bigint as bigint2,
614
608
  check,
@@ -632,11 +626,11 @@ var juniorTaskExecutions = pgTable16(
632
626
  (table) => [
633
627
  check(
634
628
  "junior_task_executions_kind_check",
635
- sql5`${table.kind} in ('scheduled', 'event')`
629
+ sql6`${table.kind} in ('scheduled', 'event')`
636
630
  ),
637
631
  check(
638
632
  "junior_task_executions_status_check",
639
- sql5`${table.status} in ('blocked', 'completed', 'failed')`
633
+ sql6`${table.status} in ('blocked', 'completed', 'failed')`
640
634
  ),
641
635
  primaryKey8({
642
636
  name: "junior_task_executions_kind_namespace_execution_id_pk",
@@ -665,7 +659,7 @@ var juniorTaskExecutions = pgTable16(
665
659
  );
666
660
 
667
661
  // src/db/schema/scheduled-tasks.ts
668
- import { sql as sql6 } from "drizzle-orm";
662
+ import { sql as sql7 } from "drizzle-orm";
669
663
  import { bigint as bigint3, index as index13, jsonb as jsonb7, pgTable as pgTable17, text as text17 } from "drizzle-orm/pg-core";
670
664
  var juniorSchedulerTasks = pgTable17(
671
665
  "junior_scheduler_tasks",
@@ -687,16 +681,16 @@ var juniorSchedulerTasks = pgTable17(
687
681
  (table) => [
688
682
  // TODO(dcramer): Remove after no supported runtime reads or writes the
689
683
  // legacy creatorSlackUserId column.
690
- index13("junior_scheduler_tasks_creator_idx").on(table.teamId, table.creatorSlackUserId, table.createdAtMs, table.id).where(sql6`${table.status} <> 'deleted'`),
684
+ index13("junior_scheduler_tasks_creator_idx").on(table.teamId, table.creatorSlackUserId, table.createdAtMs, table.id).where(sql7`${table.status} <> 'deleted'`),
691
685
  index13("junior_scheduler_tasks_creator_identity_idx").on(table.creatorIdentityId, table.createdAtMs, table.id).where(
692
- sql6`${table.status} <> 'deleted' AND ${table.creatorIdentityId} IS NOT NULL`
686
+ sql7`${table.status} <> 'deleted' AND ${table.creatorIdentityId} IS NOT NULL`
693
687
  ),
694
- index13("junior_scheduler_tasks_team_status_idx").on(table.teamId, table.createdAtMs, table.id).where(sql6`${table.status} <> 'deleted'`),
688
+ index13("junior_scheduler_tasks_team_status_idx").on(table.teamId, table.createdAtMs, table.id).where(sql7`${table.status} <> 'deleted'`),
695
689
  index13("junior_scheduler_tasks_run_now_due_idx").on(table.runNowAtMs, table.createdAtMs, table.id).where(
696
- sql6`${table.status} = 'active' AND ${table.runNowAtMs} IS NOT NULL`
690
+ sql7`${table.status} = 'active' AND ${table.runNowAtMs} IS NOT NULL`
697
691
  ),
698
692
  index13("junior_scheduler_tasks_next_run_due_idx").on(table.nextRunAtMs, table.createdAtMs, table.id).where(
699
- sql6`${table.status} = 'active' AND ${table.nextRunAtMs} IS NOT NULL`
693
+ sql7`${table.status} = 'active' AND ${table.nextRunAtMs} IS NOT NULL`
700
694
  )
701
695
  ]
702
696
  );
@@ -723,7 +717,7 @@ var juniorSchedulerRuns = pgTable17(
723
717
  );
724
718
 
725
719
  // src/db/schema/snapshots.ts
726
- import { sql as sql7 } from "drizzle-orm";
720
+ import { sql as sql8 } from "drizzle-orm";
727
721
  import {
728
722
  bigint as bigint4,
729
723
  check as check2,
@@ -785,27 +779,27 @@ var juniorSnapshots = pgTable19(
785
779
  (table) => [
786
780
  check2(
787
781
  "junior_snapshots_status_check",
788
- sql7`${table.status} in ('building', 'failed', 'ready')`
782
+ sql8`${table.status} in ('building', 'failed', 'ready')`
789
783
  ),
790
784
  check2(
791
785
  "junior_snapshots_build_phase_check",
792
- sql7`${table.buildPhase} is null or ${table.buildPhase} in ('created', 'dependencies_installed', 'repositories_prepared')`
786
+ sql8`${table.buildPhase} is null or ${table.buildPhase} in ('created', 'dependencies_installed', 'repositories_prepared')`
793
787
  ),
794
788
  check2(
795
789
  "junior_snapshots_ready_fields_check",
796
- sql7`${table.status} <> 'ready' or (${table.snapshotId} is not null and ${table.buildDurationMs} is not null and ${table.generatedAt} is not null)`
790
+ sql8`${table.status} <> 'ready' or (${table.snapshotId} is not null and ${table.buildDurationMs} is not null and ${table.generatedAt} is not null)`
797
791
  ),
798
792
  check2(
799
793
  "junior_snapshots_build_fields_check",
800
- sql7`${table.status} = 'ready' or (${table.buildStartedAt} is not null and ${table.buildPhase} is not null)`
794
+ sql8`${table.status} = 'ready' or (${table.buildStartedAt} is not null and ${table.buildPhase} is not null)`
801
795
  ),
802
796
  check2(
803
797
  "junior_snapshots_build_duration_check",
804
- sql7`${table.buildDurationMs} is null or ${table.buildDurationMs} >= 0`
798
+ sql8`${table.buildDurationMs} is null or ${table.buildDurationMs} >= 0`
805
799
  ),
806
800
  check2(
807
801
  "junior_snapshots_size_bytes_check",
808
- sql7`${table.sizeBytes} is null or ${table.sizeBytes} >= 0`
802
+ sql8`${table.sizeBytes} is null or ${table.sizeBytes} >= 0`
809
803
  ),
810
804
  // Provider snapshot ids are unique. Nulls stay allowed for in-flight rows.
811
805
  uniqueIndex9("junior_snapshots_snapshot_id_uidx").on(table.snapshotId),
@@ -815,7 +809,7 @@ var juniorSnapshots = pgTable19(
815
809
  table.profileHash,
816
810
  table.status
817
811
  ),
818
- uniqueIndex9("junior_snapshots_active_build_uidx").on(table.workspaceId, table.profileHash).where(sql7`${table.status} = 'building'`),
812
+ uniqueIndex9("junior_snapshots_active_build_uidx").on(table.workspaceId, table.profileHash).where(sql8`${table.status} = 'building'`),
819
813
  index14("junior_snapshots_workspace_status_idx").on(
820
814
  table.workspaceId,
821
815
  table.status
@@ -19,23 +19,23 @@ import {
19
19
  releaseConversationWork,
20
20
  requestAnotherSlice,
21
21
  startConversationWork
22
- } from "./chunk-E53C73ML.js";
22
+ } from "./chunk-QKHZF2LH.js";
23
23
  import {
24
24
  getTurnRequestDeadline
25
- } from "./chunk-NWWDFHXP.js";
25
+ } from "./chunk-I4RH3KLJ.js";
26
26
  import {
27
27
  ConversationQueueMessageRejectedError
28
28
  } from "./chunk-JAL3CH4G.js";
29
29
  import {
30
30
  getChatConfig,
31
31
  isProviderRetryError
32
- } from "./chunk-U76RWMFR.js";
32
+ } from "./chunk-LMYRF6HX.js";
33
33
  import {
34
34
  logException,
35
35
  logInfo,
36
36
  logWarn,
37
37
  withLogContext
38
- } from "./chunk-X76JVHQ4.js";
38
+ } from "./chunk-HUQOXMDG.js";
39
39
 
40
40
  // src/chat/task-execution/worker.ts
41
41
  var CONVERSATION_WORK_DEFER_DELAY_MS = 15e3;
@@ -12,7 +12,7 @@ import {
12
12
  } from "./chunk-PEQXYSSE.js";
13
13
  import {
14
14
  JUNIOR_VERSION
15
- } from "./chunk-IME5OW4Y.js";
15
+ } from "./chunk-C4NY6L7S.js";
16
16
 
17
17
  // src/deployment.ts
18
18
  var JUNIOR_HEARTBEAT_ROUTE = "/api/internal/heartbeat";
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  FUNCTION_TIMEOUT_BUFFER_SECONDS,
3
3
  getChatConfig
4
- } from "./chunk-U76RWMFR.js";
4
+ } from "./chunk-LMYRF6HX.js";
5
5
 
6
6
  // src/chat/runtime/request-deadline.ts
7
7
  import { AsyncLocalStorage } from "async_hooks";
@@ -7,23 +7,23 @@ import {
7
7
  import {
8
8
  formatProviderLabel,
9
9
  startOAuthFlow
10
- } from "./chunk-ENWIHU54.js";
10
+ } from "./chunk-R5OHONYU.js";
11
11
  import {
12
12
  abandonReplacedPendingAuth,
13
13
  canReusePendingAuthLink
14
- } from "./chunk-G35QGPO2.js";
14
+ } from "./chunk-VYDIA2UL.js";
15
15
  import {
16
16
  recordAuthorizationRequested
17
- } from "./chunk-OEQOAONV.js";
17
+ } from "./chunk-RZ3PBNDV.js";
18
18
  import {
19
19
  AGENT_INVOCATION_MAILBOX_STATUSES
20
- } from "./chunk-XLWZRHX5.js";
20
+ } from "./chunk-FPQPYJEG.js";
21
21
  import {
22
22
  TURN_REASONING_LEVELS
23
23
  } from "./chunk-D4YV5TDV.js";
24
24
  import {
25
25
  pluginCatalogRuntime
26
- } from "./chunk-WWXJUURQ.js";
26
+ } from "./chunk-RKA22BQP.js";
27
27
  import {
28
28
  credentialContextSchema
29
29
  } from "./chunk-CEMMLV5L.js";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  logWarn
3
- } from "./chunk-X76JVHQ4.js";
3
+ } from "./chunk-HUQOXMDG.js";
4
4
 
5
5
  // src/chat/conversation-privacy.ts
6
6
  import { AsyncLocalStorage } from "async_hooks";
@@ -8,7 +8,7 @@ import {
8
8
  juniorConversations,
9
9
  juniorIdentities,
10
10
  juniorUsers
11
- } from "./chunk-XLWZRHX5.js";
11
+ } from "./chunk-FPQPYJEG.js";
12
12
  import {
13
13
  conversationEventDataSchema,
14
14
  decodeStoredConversationEvent,
@@ -20,7 +20,7 @@ import {
20
20
  } from "./chunk-VFUK3X5B.js";
21
21
  import {
22
22
  getChatConfig
23
- } from "./chunk-U76RWMFR.js";
23
+ } from "./chunk-LMYRF6HX.js";
24
24
  import {
25
25
  parseActorUserId,
26
26
  parseSlackChannelReferenceId,
@@ -28,7 +28,7 @@ import {
28
28
  } from "./chunk-N7TMSOZH.js";
29
29
  import {
30
30
  normalizeIdentityEmail
31
- } from "./chunk-X76JVHQ4.js";
31
+ } from "./chunk-HUQOXMDG.js";
32
32
 
33
33
  // src/chat/conversations/sql/store.ts
34
34
  import { randomUUID as randomUUID2 } from "crypto";
@@ -68,6 +68,12 @@ function sameDestination(left, right) {
68
68
  }
69
69
  return false;
70
70
  }
71
+ function destinationKey(destination) {
72
+ if (destination.platform === "local") {
73
+ return destination.conversationId;
74
+ }
75
+ return `slack:${destination.teamId}:${destination.channelId}`;
76
+ }
71
77
 
72
78
  // src/chat/identities/sql.ts
73
79
  import { randomUUID } from "crypto";
@@ -1836,6 +1842,7 @@ export {
1836
1842
  parseDestination,
1837
1843
  requireSlackDestination,
1838
1844
  sameDestination,
1845
+ destinationKey,
1839
1846
  upsertIdentity,
1840
1847
  upsertLinkedIdentity,
1841
1848
  deleteProviderIdentityForSlackUser,
@@ -2,16 +2,16 @@ import {
2
2
  coerceThreadConversationState,
3
3
  getPersistedThreadState,
4
4
  persistThreadStateById
5
- } from "./chunk-GY5SEFVL.js";
5
+ } from "./chunk-FE3Y4KES.js";
6
6
  import {
7
7
  clearPendingAuth,
8
8
  markTurnClosed,
9
9
  markTurnCompleted
10
- } from "./chunk-G35QGPO2.js";
10
+ } from "./chunk-VYDIA2UL.js";
11
11
  import {
12
12
  hydrateConversationMessages,
13
13
  markConversationMessage
14
- } from "./chunk-OEQOAONV.js";
14
+ } from "./chunk-RZ3PBNDV.js";
15
15
  import {
16
16
  buildDeterministicTurnId
17
17
  } from "./chunk-DA2KGZZI.js";
@@ -20,13 +20,13 @@ import {
20
20
  findProviderError,
21
21
  getProviderErrorAttributes,
22
22
  getProviderErrorUserMessage
23
- } from "./chunk-U76RWMFR.js";
23
+ } from "./chunk-LMYRF6HX.js";
24
24
  import {
25
25
  parseSlackMessageTs
26
26
  } from "./chunk-N7TMSOZH.js";
27
27
  import {
28
28
  buildTurnFailureResponse
29
- } from "./chunk-X76JVHQ4.js";
29
+ } from "./chunk-HUQOXMDG.js";
30
30
 
31
31
  // src/chat/runtime/delivered-turn-state.ts
32
32
  function buildDeliveredTurnStatePatch(args) {
@@ -6,14 +6,14 @@ import {
6
6
  isStale,
7
7
  runNonInteractiveCommand,
8
8
  sleep
9
- } from "./chunk-7ANA7PBB.js";
9
+ } from "./chunk-LM7UE523.js";
10
10
  import {
11
11
  getStateAdapter
12
- } from "./chunk-V4HXV5MY.js";
12
+ } from "./chunk-7MYXH5LA.js";
13
13
  import {
14
14
  setSpanAttributes,
15
15
  withSpan
16
- } from "./chunk-X76JVHQ4.js";
16
+ } from "./chunk-HUQOXMDG.js";
17
17
 
18
18
  // src/chat/sandbox/resources.ts
19
19
  var configuredResources;
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  toOptionalTrimmed
3
- } from "./chunk-U76RWMFR.js";
3
+ } from "./chunk-LMYRF6HX.js";
4
4
  import {
5
5
  pluginCatalogRuntime
6
- } from "./chunk-WWXJUURQ.js";
6
+ } from "./chunk-RKA22BQP.js";
7
7
  import {
8
8
  setSpanAttributes,
9
9
  setSpanStatus
10
- } from "./chunk-X76JVHQ4.js";
10
+ } from "./chunk-HUQOXMDG.js";
11
11
 
12
12
  // src/chat/sandbox/paths.ts
13
13
  function normalizeWorkspaceRoot(input) {
@@ -7,7 +7,7 @@ import {
7
7
  toCanonicalInputMessage,
8
8
  toCanonicalOutputMessage,
9
9
  toGenAiMessagesTraceAttributes
10
- } from "./chunk-JOI3DHML.js";
10
+ } from "./chunk-KBPWC7NU.js";
11
11
  import {
12
12
  extractGenAiUsageAttributes,
13
13
  logException,
@@ -15,7 +15,7 @@ import {
15
15
  normalizeGenAiFinishReason,
16
16
  serializeGenAiAttribute,
17
17
  withSpan
18
- } from "./chunk-X76JVHQ4.js";
18
+ } from "./chunk-HUQOXMDG.js";
19
19
 
20
20
  // src/chat/services/provider-error.ts
21
21
  var ProviderError = class extends Error {
@@ -675,6 +675,7 @@ var MIN_AGENT_TURN_TIMEOUT_MS = 10 * 1e3;
675
675
  var DEFAULT_AGENT_TURN_TIMEOUT_MS = 12 * 60 * 1e3;
676
676
  var MAX_SLICES_PER_TURN = 100;
677
677
  var MAX_TOOL_CALLS_PER_TURN = 150;
678
+ var MAX_CONSECUTIVE_AUTOMATED_TURNS = 10;
678
679
  var DEFAULT_FUNCTION_MAX_DURATION_SECONDS = 300;
679
680
  var DEFAULT_SLACK_SLASH_COMMAND = "/jr";
680
681
  var DEFAULT_PROCESSING_REACTION_EMOJI = "eyes";
@@ -904,6 +905,7 @@ function readBotConfig(env, functionMaxDurationSeconds) {
904
905
  visionModelId: validateGatewayModelId(env.AI_VISION_MODEL),
905
906
  maxSlicesPerTurn: MAX_SLICES_PER_TURN,
906
907
  maxToolCallsPerTurn: MAX_TOOL_CALLS_PER_TURN,
908
+ maxConsecutiveAutomatedTurns: MAX_CONSECUTIVE_AUTOMATED_TURNS,
907
909
  turnTimeoutMs: parseAgentTurnTimeoutMs(
908
910
  env.AGENT_TURN_TIMEOUT_MS,
909
911
  maxTurnTimeoutMs
@@ -1,15 +1,15 @@
1
1
  import {
2
2
  AgentRunError,
3
3
  executeTurn
4
- } from "./chunk-53IEEFFP.js";
4
+ } from "./chunk-CE2P6TOV.js";
5
5
  import {
6
6
  ConversationTurnLifecycleService
7
- } from "./chunk-6H2MKVV5.js";
7
+ } from "./chunk-7PQMTME5.js";
8
8
  import {
9
9
  getPersistedSandboxState,
10
10
  getPersistedThreadState,
11
11
  persistThreadStateById
12
- } from "./chunk-GY5SEFVL.js";
12
+ } from "./chunk-FE3Y4KES.js";
13
13
  import {
14
14
  AgentInvocationBusyError,
15
15
  AgentInvocationLimitError,
@@ -18,32 +18,32 @@ import {
18
18
  agentBindingSchema,
19
19
  agentInvocationSchema,
20
20
  createAgentInvocationSchema
21
- } from "./chunk-QMEF4Z7R.js";
21
+ } from "./chunk-JBSCMOLR.js";
22
22
  import {
23
23
  TurnInputCommitLostError,
24
24
  getAssistantReplyText,
25
25
  getConversationTurnBoundaryError,
26
26
  isTurnInputCommitLostError
27
- } from "./chunk-G35QGPO2.js";
27
+ } from "./chunk-VYDIA2UL.js";
28
28
  import {
29
29
  failTurnRecord,
30
30
  getTerminalAssistantMessages,
31
31
  getTurnRecord,
32
32
  openConversationProjection,
33
33
  saveTurnCheckpoint
34
- } from "./chunk-OEQOAONV.js";
34
+ } from "./chunk-RZ3PBNDV.js";
35
35
  import {
36
36
  appendAndEnqueueInboundMessage
37
- } from "./chunk-E53C73ML.js";
37
+ } from "./chunk-QKHZF2LH.js";
38
38
  import {
39
39
  getConversationEventStore,
40
40
  getConversationStore,
41
41
  getSqlExecutor
42
- } from "./chunk-ADEACKAH.js";
42
+ } from "./chunk-KQ3GZGBK.js";
43
43
  import {
44
44
  juniorAgentBindings,
45
45
  juniorAgentInvocations
46
- } from "./chunk-XLWZRHX5.js";
46
+ } from "./chunk-FPQPYJEG.js";
47
47
 
48
48
  // src/chat/agent-invocations/work.ts
49
49
  import { z } from "zod";
@@ -1,32 +1,32 @@
1
1
  import {
2
2
  resolveBaseUrl
3
- } from "./chunk-ENWIHU54.js";
3
+ } from "./chunk-R5OHONYU.js";
4
4
  import {
5
5
  createPluginLogger,
6
6
  getPlugins,
7
7
  getSlackClient,
8
8
  withSlackRetries
9
- } from "./chunk-CCTYK5RH.js";
9
+ } from "./chunk-PFQRZ4IB.js";
10
10
  import {
11
11
  getDb,
12
12
  parseDestination
13
- } from "./chunk-ADEACKAH.js";
13
+ } from "./chunk-KQ3GZGBK.js";
14
14
  import {
15
15
  sleep
16
- } from "./chunk-7ANA7PBB.js";
16
+ } from "./chunk-LM7UE523.js";
17
17
  import {
18
18
  acquireActiveLock,
19
19
  getStateAdapter
20
- } from "./chunk-V4HXV5MY.js";
20
+ } from "./chunk-7MYXH5LA.js";
21
21
  import {
22
22
  pluginCatalogRuntime
23
- } from "./chunk-WWXJUURQ.js";
23
+ } from "./chunk-RKA22BQP.js";
24
24
  import {
25
25
  fetchWithBoundedOAuthErrorBodies
26
- } from "./chunk-S7GX44BU.js";
26
+ } from "./chunk-X3PBQ4BK.js";
27
27
  import {
28
28
  isRecord
29
- } from "./chunk-X76JVHQ4.js";
29
+ } from "./chunk-HUQOXMDG.js";
30
30
 
31
31
  // src/chat/capabilities/router.ts
32
32
  var ProviderCredentialRouter = class {
@@ -5,7 +5,7 @@ import {
5
5
  getConversationEventStore,
6
6
  getDb,
7
7
  getSqlExecutor
8
- } from "./chunk-ADEACKAH.js";
8
+ } from "./chunk-KQ3GZGBK.js";
9
9
  import {
10
10
  juniorCodeChanges,
11
11
  juniorCodeRepositories,
@@ -16,7 +16,7 @@ import {
16
16
  juniorUsers,
17
17
  juniorWorkspaceRepos,
18
18
  juniorWorkspaces
19
- } from "./chunk-XLWZRHX5.js";
19
+ } from "./chunk-FPQPYJEG.js";
20
20
  import {
21
21
  SANDBOX_WORKSPACE_ROOT,
22
22
  getVercelSandboxCredentials,
@@ -24,16 +24,16 @@ import {
24
24
  isSandboxMissingError,
25
25
  runNonInteractiveCommand,
26
26
  sleep
27
- } from "./chunk-7ANA7PBB.js";
27
+ } from "./chunk-LM7UE523.js";
28
28
  import {
29
29
  getStateAdapter
30
- } from "./chunk-V4HXV5MY.js";
30
+ } from "./chunk-7MYXH5LA.js";
31
31
  import {
32
32
  botConfig,
33
33
  completeObject,
34
34
  embedTexts,
35
35
  getSlackBotToken
36
- } from "./chunk-U76RWMFR.js";
36
+ } from "./chunk-LMYRF6HX.js";
37
37
  import {
38
38
  defaultModelId
39
39
  } from "./chunk-D4YV5TDV.js";
@@ -52,7 +52,7 @@ import {
52
52
  setSpanAttributes,
53
53
  setSpanStatus,
54
54
  withSpan
55
- } from "./chunk-X76JVHQ4.js";
55
+ } from "./chunk-HUQOXMDG.js";
56
56
 
57
57
  // src/chat/plugins/agent-hooks.ts
58
58
  import {
@@ -3523,6 +3523,9 @@ function createPluginHookRunner(input = {}) {
3523
3523
  name: tool.name,
3524
3524
  input: nextInput
3525
3525
  },
3526
+ users: {
3527
+ resolveActor: async () => input.actor ? await readActorIdentity(input.actor) : void 0
3528
+ },
3526
3529
  env: {
3527
3530
  get(key) {
3528
3531
  return env[key] ?? normalizeEnv(nextInput.env)[key];
@@ -3,39 +3,39 @@ import {
3
3
  } from "./chunk-RC745GGZ.js";
4
4
  import {
5
5
  parseSlackThreadId
6
- } from "./chunk-IOGDKPVU.js";
6
+ } from "./chunk-6TRQLG3D.js";
7
7
  import {
8
8
  appendAndEnqueueExclusiveInboundMessage,
9
9
  appendAndEnqueueInboundMessage
10
- } from "./chunk-E53C73ML.js";
10
+ } from "./chunk-QKHZF2LH.js";
11
11
  import {
12
12
  buildDeterministicTurnId
13
13
  } from "./chunk-DA2KGZZI.js";
14
14
  import {
15
15
  normalizeSlackConversationId
16
- } from "./chunk-CCTYK5RH.js";
16
+ } from "./chunk-PFQRZ4IB.js";
17
17
  import {
18
18
  getConversationStore,
19
19
  getDb
20
- } from "./chunk-ADEACKAH.js";
20
+ } from "./chunk-KQ3GZGBK.js";
21
21
  import {
22
22
  juniorConversationParticipants,
23
23
  juniorConversations,
24
24
  juniorIdentities,
25
25
  juniorUsers
26
- } from "./chunk-XLWZRHX5.js";
26
+ } from "./chunk-FPQPYJEG.js";
27
27
  import {
28
28
  juniorDestinations
29
29
  } from "./chunk-VFUK3X5B.js";
30
30
  import {
31
31
  getSlackBotToken
32
- } from "./chunk-U76RWMFR.js";
32
+ } from "./chunk-LMYRF6HX.js";
33
33
  import {
34
34
  canExposeConversationPayload
35
- } from "./chunk-JOI3DHML.js";
35
+ } from "./chunk-KBPWC7NU.js";
36
36
  import {
37
37
  logWarn
38
- } from "./chunk-X76JVHQ4.js";
38
+ } from "./chunk-HUQOXMDG.js";
39
39
 
40
40
  // src/handlers/health.ts
41
41
  function readHealthReport() {
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  createAndEnqueueAgentInvocation
3
- } from "./chunk-F2KSURTJ.js";
3
+ } from "./chunk-N67T4VY3.js";
4
4
  import {
5
5
  actorFromRun,
6
6
  toolInvocationDestination
7
- } from "./chunk-ENWIHU54.js";
7
+ } from "./chunk-R5OHONYU.js";
8
8
 
9
9
  // src/chat/agent-invocations/spawn.ts
10
10
  function bindSpawnAgent(run, options) {
@@ -8,14 +8,14 @@ import {
8
8
  getConversationStore,
9
9
  parseDestination,
10
10
  sameDestination
11
- } from "./chunk-ADEACKAH.js";
11
+ } from "./chunk-KQ3GZGBK.js";
12
12
  import {
13
13
  getDefaultRedisStateAdapterFor,
14
14
  getStateAdapter
15
- } from "./chunk-V4HXV5MY.js";
15
+ } from "./chunk-7MYXH5LA.js";
16
16
  import {
17
17
  getChatConfig
18
- } from "./chunk-U76RWMFR.js";
18
+ } from "./chunk-LMYRF6HX.js";
19
19
  import {
20
20
  parseStoredSlackActor
21
21
  } from "./chunk-N7TMSOZH.js";
@@ -23,7 +23,7 @@ import {
23
23
  isRecord,
24
24
  toOptionalNumber,
25
25
  toOptionalString
26
- } from "./chunk-X76JVHQ4.js";
26
+ } from "./chunk-HUQOXMDG.js";
27
27
 
28
28
  // src/chat/task-execution/state.ts
29
29
  import { randomUUID } from "crypto";