@sentry/junior 0.305.0 → 0.307.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 (98) hide show
  1. package/dist/{adapter-context-BpvbUki8.js → adapter-context-B69WPn6b.js} +2 -2
  2. package/dist/{admin-CoDt35ny.js → admin-nCJXMgkp.js} +2 -2
  3. package/dist/{agent-runner-C5d6rY5g.js → agent-runner-DdFcxAxG.js} +463 -303
  4. package/dist/api/schema.d.ts +2 -2
  5. package/dist/api/schema.js +7 -8
  6. package/dist/api.d.ts +19 -4
  7. package/dist/api.js +437 -310
  8. package/dist/{app-Cs157Zc5.d.ts → app-EZur8cVC.d.ts} +12 -3
  9. package/dist/app.d.ts +2 -2
  10. package/dist/app.js +532 -439
  11. package/dist/background-compaction-queue-BhEe4UfU.js +231 -0
  12. package/dist/{briefs-BRdznF7c.js → briefs-Dl9lxi7J.js} +3 -3
  13. package/dist/{catalog-runtime-J52Tej47.js → catalog-runtime-OXrv2Ewn.js} +1 -1
  14. package/dist/cli/chat.d.ts +1 -1
  15. package/dist/cli/chat.js +17 -16
  16. package/dist/cli/check.js +58 -48
  17. package/dist/cli/main.js +3 -3
  18. package/dist/cli/plugins.d.ts +1 -1
  19. package/dist/cli/plugins.js +4 -4
  20. package/dist/cli/snapshot-create.js +5 -5
  21. package/dist/cli/upgrade.d.ts +2 -2
  22. package/dist/cli/upgrade.js +3 -8
  23. package/dist/{config-CBZp0udd.js → config-362yMSIz.js} +183 -49
  24. package/dist/{connections-BYmuJ6Vm.js → connections-BJv3EjmB.js} +10 -8
  25. package/dist/{continue-in-slack-Cvot6S38.js → continue-in-slack-CFEevC7z.js} +5 -5
  26. package/dist/{conversation-BOqdRtUx.js → conversation--f85g4zL.js} +132 -132
  27. package/dist/{conversation-feed-CgpgP7yi.js → conversation-feed-BNs9KiqC.js} +1 -1
  28. package/dist/{conversation-privacy-D2pOzBNl.js → conversation-privacy-Tjj5P2W6.js} +1 -1
  29. package/dist/{conversation-turn-CI8WDpnK.js → conversation-turn-DU0_WDAr.js} +26 -72
  30. package/dist/{credential-sync-COqnZ1Dx.js → credential-sync-D6aFARKE.js} +28 -27
  31. package/dist/{db-DU84dCVu.js → db-Bcbd9zQc.js} +226 -18
  32. package/dist/{db-zbN5ZV_o.d.ts → db-C41UgdBj.d.ts} +1 -1
  33. package/dist/{executor-CFyrgOu1.js → executor-DBMBrpNV.js} +137 -33
  34. package/dist/{history-m2-ceTTX.js → history-N7IVbUom.js} +5 -1
  35. package/dist/{install-CQ76CfRw.js → install-CgoAbzfF.js} +2 -2
  36. package/dist/instrumentation.js +2 -2
  37. package/dist/{lineage-DLd2UxVP.js → lineage-CsZDmz3e.js} +2 -2
  38. package/dist/{logging-BPNTQVFu.js → logging-CHCuQ5iz.js} +1 -1
  39. package/dist/{message-BWJLeQ5e.js → message-B8vCbZZB.js} +8 -8
  40. package/dist/{model-input-DoM9Ht-d.js → model-input-Xluiy-1W.js} +3 -3
  41. package/dist/nitro.d.ts +2 -2
  42. package/dist/nitro.js +3 -4
  43. package/dist/{oauth-callback-server-DeHbnAQl.js → oauth-callback-server-BUuNvfvu.js} +2 -2
  44. package/dist/{oauth-relay-DAmfVmJu.js → oauth-relay-DGAZzg9m.js} +1 -1
  45. package/dist/{plugins-B_0Cr0MO.d.ts → plugins-fBrz8PCV.d.ts} +2 -0
  46. package/dist/{projection-CcFBVFUo.js → projection-xPpvqexa.js} +13423 -11432
  47. package/dist/{prompt-C5LREK2p.js → prompt-D8u4jFs_.js} +15 -7
  48. package/dist/{registry-BjZZqKqi.js → registry-D20hG3r6.js} +19 -9
  49. package/dist/{resolve-CeJgXuH1.js → resolve-BhCySRCW.js} +3 -3
  50. package/dist/{result-icDrueyB.js → result-DddO63S9.js} +13 -11
  51. package/dist/{runner-nVfMkMMB.js → runner-DQR9vYce.js} +13 -15
  52. package/dist/{sandbox-egress-signals-H9vQ5qRf.js → sandbox-egress-signals-DFlNUOnK.js} +1 -1
  53. package/dist/{automation-CuA3yEcD.js → schedule-BG1tEbRF.js} +380 -8
  54. package/dist/{schema-CKcu-IK6.d.ts → schema-CRXcj4fj.d.ts} +420 -143
  55. package/dist/{schema-Bx0Mlo32.js → schema-D4jdesIu.js} +62 -8
  56. package/dist/{service-account-DU5865XA.js → service-account-Bv5QwrEq.js} +8 -6
  57. package/dist/{service-account-Dw06p3zm.js → service-account-CNfycv0z.js} +3 -3
  58. package/dist/{session-stop-uotLtp4g.js → session-stop-BDdwyZaa.js} +878 -171
  59. package/dist/{skills-Bex1EaO5.js → skills-63i1Bcv1.js} +32 -28
  60. package/dist/{slack-conversation-unfurl-EPG3riWF.js → slack-conversation-unfurl-DtpBUlUu.js} +10 -9
  61. package/dist/{spawn-CoD3vDuS.js → spawn-mwimEY9_.js} +6 -6
  62. package/dist/{state-nCR4Muhn.js → state-BBn9L6gC.js} +4 -4
  63. package/dist/{stop-BFVd0P0m.js → stop-Da-Ug7tg.js} +172 -239
  64. package/dist/{store-Ca6G962n.js → store-CdWg2r2L.js} +5 -5
  65. package/dist/{background-compaction-queue-BTqMIfTA.js → task-queue-BcjAYWyB.js} +164 -180
  66. package/dist/{task-runner-xsOPIxCZ.js → task-runner-CoXmMlsW.js} +13 -11
  67. package/dist/{thread-context-BOvZhsKK.js → thread-context-ZPGqOjW7.js} +8 -91
  68. package/dist/turn-session-routing-DFYak28Q.js +263 -0
  69. package/dist/{turn-user-message-BrhuyYrH.js → turn-user-message-B1S8nOnG.js} +3 -3
  70. package/dist/users-DDbENg-I.js +181 -0
  71. package/dist/{validation-BnY9K5WB.js → validation-fl21ps-k.js} +1 -1
  72. package/dist/{version-qROlRQGF.js → version-DCdMMx_0.js} +1 -1
  73. package/dist/version.js +1 -1
  74. package/dist/{viewer-CxUiOraX.js → viewer-DN_xzVKj.js} +3 -3
  75. package/dist/{warmup--Gkz7iB-.js → warmup-CxhEhm71.js} +842 -532
  76. package/dist/{web-message-id-lNodcCOI.js → web-message-id-BT8Mg8LL.js} +16 -1
  77. package/dist/{worker-DJ8d9fmD.js → worker-Btb1SB5h.js} +8 -7
  78. package/migrations/0114_plan_items.sql +22 -0
  79. package/migrations/0115_automation_creator_slack_index.sql +1 -0
  80. package/migrations/0116_conversation_event_search.sql +25 -0
  81. package/migrations/0117_automation_last_run.sql +46 -0
  82. package/migrations/0118_automation_last_run_index.sql +1 -0
  83. package/migrations/0119_money_micro_usd.sql +29 -0
  84. package/migrations/0120_conversation_cost_micro_usd.sql +8 -0
  85. package/migrations/meta/0114_snapshot.json +5203 -0
  86. package/migrations/meta/0115_snapshot.json +5225 -0
  87. package/migrations/meta/0116_snapshot.json +5388 -0
  88. package/migrations/meta/0117_snapshot.json +5413 -0
  89. package/migrations/meta/0118_snapshot.json +5428 -0
  90. package/migrations/meta/0119_snapshot.json +5441 -0
  91. package/migrations/meta/0120_snapshot.json +5441 -0
  92. package/migrations/meta/_journal.json +49 -0
  93. package/package.json +10 -9
  94. package/dist/queue-B2AAL3ym.js +0 -115
  95. package/dist/schedule-cP0AACm1.js +0 -344
  96. package/dist/secrets-DHaJ5TTn.js +0 -18
  97. package/dist/task-queue-BLPZU6kC.js +0 -89
  98. package/dist/turn-session-routing-2bW2qfeb.js +0 -1792
@@ -1,7 +1,7 @@
1
- import { A as searchWeb$1, C as completeObject$1, D as generateImages$1, E as gatewayCostUsd, G as createProviderError, Q as resolveGatewayCredential, S as completeDecision$1, T as embedTexts$1, U as ProviderError, X as isProviderRetryError, b as GEN_AI_PROVIDER_NAME, w as completeText$1, x as GEN_AI_SERVER_ADDRESS } from "./config-CBZp0udd.js";
2
- import { E as withSpan, _ as runBestEffort, a as extractGenAiUsageSummary, i as extractGenAiUsageAttributes, p as logException } from "./logging-BPNTQVFu.js";
3
- import { r as getConversationEventStore, st as agentTurnCostUsd } from "./db-DU84dCVu.js";
4
- import { $ as conversationBriefSchema, Z as briefOutcomeStatusSchema, et as parseBriefInput } from "./conversation-BOqdRtUx.js";
1
+ import { $ as ProviderError, A as searchWeb$1, C as completeObject$1, D as generateImages$1, E as gatewayCostUsd, S as completeDecision$1, T as embedTexts$1, b as GEN_AI_PROVIDER_NAME, ct as resolveGatewayCredential, ot as isProviderRetryError, tt as createProviderError, w as completeText$1, x as GEN_AI_SERVER_ADDRESS } from "./config-362yMSIz.js";
2
+ import { E as withSpan, _ as runBestEffort, a as extractGenAiUsageSummary, i as extractGenAiUsageAttributes, p as logException } from "./logging-CHCuQ5iz.js";
3
+ import { _t as agentTurnCostUsd, r as getConversationEventStore } from "./db-Bcbd9zQc.js";
4
+ import { I as conversationBriefSchema, L as parseBriefInput, P as briefOutcomeStatusSchema } from "./conversation--f85g4zL.js";
5
5
  import * as z from "zod";
6
6
  import { createGatewayProvider } from "@ai-sdk/gateway";
7
7
  import { transcribe } from "ai";
@@ -780,7 +780,15 @@ const EVENT_SYSTEM_ACTOR = {
780
780
  * Source and Actor. `eventType` only supports saved synthetic Slack input.
781
781
  */
782
782
  function isEventConversationMessage(message) {
783
- return Boolean(message.meta?.eventType) || message.author?.userId === "UJRNEVENT";
783
+ return Boolean(message.meta?.eventType) || isEventAuthorId(message.author?.userId);
784
+ }
785
+ /** Author id of an Event Message by a listed bot, which has no Identity. */
786
+ function eventBotAuthorId(provider, handle) {
787
+ return `${EVENT_AUTHOR_ID}:${provider}:${handle.toLowerCase()}`;
788
+ }
789
+ /** Whether an author id belongs to an Event Message, system or listed bot. */
790
+ function isEventAuthorId(id) {
791
+ return id === "UJRNEVENT" || Boolean(id?.startsWith(`UJRNEVENT:`));
784
792
  }
785
793
  // src/chat/briefs/event-entries.ts
786
794
  const TOOL_TEXT_LIMIT = 1500;
@@ -842,7 +850,7 @@ function briefEntriesFromReportEvents(events) {
842
850
  if (data.type === "message" && data.text && data.role !== "system") {
843
851
  const turnId = data.role === "user" ? turnByMessageId.get(data.messageId) : activeTurnId;
844
852
  const author = actorName(data.actorIdentity, resolvedActorNames);
845
- const role = data.role === "user" && (Boolean(data.eventType) || data.actorIdentity?.slackUserId === "UJRNEVENT") ? "event" : data.role;
853
+ const role = data.role === "user" && (Boolean(data.eventType) || isEventAuthorId(data.actorIdentity?.slackUserId)) ? "event" : data.role;
846
854
  entries.push({
847
855
  index: event.seq,
848
856
  role,
@@ -888,4 +896,4 @@ Rules:
888
896
  - Cite a URL only when its exact full string occurs in an entry, evidence, or the previous Brief. Return cited URLs in \`urls\`. Core adds code changes and resources separately.
889
897
  - Keep the summary under 600 characters, intent under 400 characters, outcome text under 600 characters, and each other string under 400 characters.
890
898
  `;
891
- export { agentsInstructionsUpdatedEvent as _, EVENT_SYSTEM_ACTOR as a, conversationNoteEvent as b, completeDecision as c, embedTexts as d, generateImages as f, JUNIOR_NATIVE_EVENT_NAMESPACE as g, NoAudioError as h, EVENT_MESSAGE_AUTHOR as i, completeObject as l, transcribeFromUrl as m, briefEntriesFromReportEvents as n, isEventConversationMessage as o, searchWeb as p, EVENT_AUTHOR_ID as r, generateBrief as s, BRIEF_PROMPT as t, completeText as u, authenticationLinkedEvent as v, renderJuniorNativeConversationEvent as x, authenticationUnlinkedEvent as y };
899
+ export { renderJuniorNativeConversationEvent as S, JUNIOR_NATIVE_EVENT_NAMESPACE as _, EVENT_SYSTEM_ACTOR as a, authenticationUnlinkedEvent as b, generateBrief as c, completeText as d, embedTexts as f, NoAudioError as g, transcribeFromUrl as h, EVENT_MESSAGE_AUTHOR as i, completeDecision as l, searchWeb as m, briefEntriesFromReportEvents as n, eventBotAuthorId as o, generateImages as p, EVENT_AUTHOR_ID as r, isEventConversationMessage as s, BRIEF_PROMPT as t, completeObject as u, agentsInstructionsUpdatedEvent as v, conversationNoteEvent as x, authenticationLinkedEvent as y };
@@ -1,5 +1,5 @@
1
1
  import { n as normalizePluginPackageNames, o as pluginRoots, t as discoverInstalledPluginPackageContent } from "./package-discovery-x4AvVhMj.js";
2
- import { b as setSpanAttributes, h as logWarn, m as logInfo } from "./logging-BPNTQVFu.js";
2
+ import { b as setSpanAttributes, h as logWarn, m as logInfo } from "./logging-CHCuQ5iz.js";
3
3
  import { o as isUserActor, s as parseActorUserId } from "./actor-D2iXzvlN.js";
4
4
  import * as z from "zod";
5
5
  import path from "node:path";
@@ -96,11 +96,13 @@ function inlineManifestSource(manifest) {
96
96
  setDefined$1(result, "name", manifest.name);
97
97
  setDefined$1(result, "display-name", manifest.displayName);
98
98
  setDefined$1(result, "description", manifest.description);
99
+ setDefined$1(result, "review-context", manifest.reviewContext);
99
100
  setDefined$1(result, "config-keys", inlineTokenListSource(manifest.name, manifest.configKeys));
100
101
  setDefined$1(result, "domains", manifest.domains);
101
102
  setDefined$1(result, "api-headers", manifest.apiHeaders);
102
103
  setDefined$1(result, "command-env", manifest.commandEnv);
103
104
  setDefined$1(result, "env-vars", manifest.envVars);
105
+ setDefined$1(result, "tools-send-no-credential", manifest.toolsSendNoCredential);
104
106
  setDefined$1(result, "credentials", inlineCredentialsSource(manifest.credentials));
105
107
  setDefined$1(result, "runtime-dependencies", manifest.runtimeDependencies);
106
108
  setDefined$1(result, "runtime-postinstall", manifest.runtimePostinstall);
@@ -279,6 +281,7 @@ const manifestSourceSchema = z.object({
279
281
  name: z.string().refine((value) => PLUGIN_NAME_RE.test(value), { error: "invalid" }),
280
282
  "display-name": nonEmptyTrimmedString,
281
283
  description: nonEmptyTrimmedString,
284
+ "review-context": nonEmptyTrimmedString.optional(),
282
285
  "config-keys": z.array(z.string(), { error: "must be an array when provided" }).optional(),
283
286
  domains: domainsSchema.optional(),
284
287
  "api-headers": stringMapSchema.optional(),
@@ -290,7 +293,8 @@ const manifestSourceSchema = z.object({
290
293
  mcp: z.record(z.string(), z.unknown(), { error: "must be an object" }).optional(),
291
294
  oauth: z.record(z.string(), z.unknown(), { error: "must be an object" }).optional(),
292
295
  accounts: z.record(z.string(), z.unknown(), { error: "must be an object" }).optional(),
293
- target: z.record(z.string(), z.unknown(), { error: "must be an object" }).optional()
296
+ target: z.record(z.string(), z.unknown(), { error: "must be an object" }).optional(),
297
+ "tools-send-no-credential": z.boolean({ error: "must be a boolean" }).optional()
294
298
  }).passthrough();
295
299
  function setDefined(target, key, value) {
296
300
  if (value !== void 0) target[key] = value;
@@ -299,11 +303,13 @@ function manifestConfigPatch(config) {
299
303
  const result = {};
300
304
  setDefined(result, "display-name", config.displayName);
301
305
  setDefined(result, "description", config.description);
306
+ setDefined(result, "review-context", config.reviewContext);
302
307
  setDefined(result, "config-keys", config.configKeys);
303
308
  setDefined(result, "domains", config.domains);
304
309
  setDefined(result, "api-headers", config.apiHeaders);
305
310
  setDefined(result, "command-env", config.commandEnv);
306
311
  setDefined(result, "env-vars", config.envVars);
312
+ setDefined(result, "tools-send-no-credential", config.toolsSendNoCredential);
307
313
  if (config.credentials !== void 0) {
308
314
  if (!config.credentials) result["credentials"] = null;
309
315
  else {
@@ -704,6 +710,7 @@ function parseManifestSource(parsedSource, dir, config, options) {
704
710
  name: data.name,
705
711
  displayName: data["display-name"],
706
712
  description: data.description,
713
+ ...data["review-context"] ? { reviewContext: data["review-context"] } : void 0,
707
714
  configKeys,
708
715
  ...domains ? { domains } : void 0,
709
716
  ...apiHeaders ? { apiHeaders } : void 0,
@@ -713,7 +720,8 @@ function parseManifestSource(parsedSource, dir, config, options) {
713
720
  ...runtimeDependencies ? { runtimeDependencies } : void 0,
714
721
  ...runtimePostinstall ? { runtimePostinstall } : void 0,
715
722
  ...mcp ? { mcp } : void 0,
716
- ...accounts ? { accounts } : void 0
723
+ ...accounts ? { accounts } : void 0,
724
+ ...data["tools-send-no-credential"] ? { toolsSendNoCredential: true } : void 0
717
725
  };
718
726
  if (data.oauth) {
719
727
  if (!credentials && options?.allowHookManagedEgress !== true) throw new Error(`Plugin ${data.name} oauth requires credentials`);
@@ -1080,10 +1088,14 @@ function resolvePluginCommandEnv(manifest) {
1080
1088
  return env;
1081
1089
  }
1082
1090
  // src/chat/plugins/auth/auth-token-placeholder.ts
1083
- const DEFAULT_PLACEHOLDERS = { "oauth-bearer": "host_managed_credential" };
1091
+ /**
1092
+ * The marker that every built-in Sandbox credential placeholder contains,
1093
+ * such as `host_managed_credential` or `ghp_host_managed_credential`.
1094
+ */
1095
+ const HOST_MANAGED_CREDENTIAL_PLACEHOLDER = "host_managed_credential";
1084
1096
  /** Resolve the non-secret sandbox token placeholder for token-backed credentials. */
1085
1097
  function resolveAuthTokenPlaceholder(credentials) {
1086
- return credentials.authTokenPlaceholder?.trim() || DEFAULT_PLACEHOLDERS[credentials.type];
1098
+ return credentials.authTokenPlaceholder?.trim() || "host_managed_credential";
1087
1099
  }
1088
1100
  // src/chat/plugins/auth/api-headers-broker.ts
1089
1101
  const MAX_LEASE_MS$1 = 36e5;
@@ -1166,9 +1178,7 @@ function buildOAuthTokenRequest(input) {
1166
1178
  }
1167
1179
  const contentType = headers.get("Content-Type") ?? DEFAULT_TOKEN_CONTENT_TYPE;
1168
1180
  const serializedHeaders = {};
1169
- headers.forEach((value, key) => {
1170
- serializedHeaders[key] = value;
1171
- });
1181
+ for (const [key, value] of headers) serializedHeaders[key] = value;
1172
1182
  return {
1173
1183
  headers: serializedHeaders,
1174
1184
  body: contentTypeToBody(contentType, payload)
@@ -1676,4 +1686,4 @@ function createPluginCatalogRuntime() {
1676
1686
  }
1677
1687
  };
1678
1688
  }
1679
- export { CredentialUnavailableError as _, resolveAuthTokenPlaceholder as a, fetchWithBoundedOAuthErrorBodies as c, actorLogContext as d, credentialContextForActor as f, credentialUserSubjectId as g, credentialSubjectSchema as h, resolvePluginHeaderEnvRefs as i, getOAuthProviderErrorAttributes as l, credentialLogContext as m, buildOAuthTokenRequest as n, resolvePluginCommandEnv as o, credentialContextSchema as p, parseOAuthTokenResponse as r, OAuthProviderError as s, createPluginCatalogRuntime as t, hasRequiredOAuthScope as u, parseInlinePluginManifest as v, parsePluginManifest as y };
1689
+ export { credentialUserSubjectId as _, HOST_MANAGED_CREDENTIAL_PLACEHOLDER as a, parsePluginManifest as b, OAuthProviderError as c, hasRequiredOAuthScope as d, actorLogContext as f, credentialSubjectSchema as g, credentialLogContext as h, resolvePluginHeaderEnvRefs as i, fetchWithBoundedOAuthErrorBodies as l, credentialContextSchema as m, buildOAuthTokenRequest as n, resolveAuthTokenPlaceholder as o, credentialContextForActor as p, parseOAuthTokenResponse as r, resolvePluginCommandEnv as s, createPluginCatalogRuntime as t, getOAuthProviderErrorAttributes as u, CredentialUnavailableError as v, parseInlinePluginManifest as y };
@@ -1,6 +1,6 @@
1
- import { i as trace, n as postinstall, o as getSandboxResources, t as dependencies } from "./install-CQ76CfRw.js";
2
- import { ea as create, fs as sleep, ia as getSandboxProvider, na as isStale } from "./projection-CcFBVFUo.js";
3
- import { X as getStateAdapter } from "./db-DU84dCVu.js";
1
+ import { i as trace, n as postinstall, o as getSandboxResources, t as dependencies } from "./install-CgoAbzfF.js";
2
+ import { Ji as isStale, Ki as create, Ms as sleep, Xi as getSandboxProvider } from "./projection-xPpvqexa.js";
3
+ import { $ as getStateAdapter } from "./db-Bcbd9zQc.js";
4
4
  import * as z from "zod";
5
5
  // src/chat/sandbox/snapshot/resolve.ts
6
6
  const SNAPSHOT_CACHE_PREFIX = "junior:sandbox_snapshot_profile:v2";
@@ -1,13 +1,14 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-BKpuH2hG.js";
2
- import { P as SYSTEM_IDENTITY_ID, a as getConversationStore, k as turnBehavior } from "./db-DU84dCVu.js";
3
- import { C as listActiveMailboxTurns, N as renderEventBatchInputs, P as timerWatchCredentialSubject, T as resolveMailboxTurnWork, j as eventBatchMessageMeta, k as EVENT_WAIT_MS, s as eventReviewItemInputs, t as getConversationStoppedAtMs, w as parseEventMessages, x as getEventBatchDelayMs } from "./session-stop-uotLtp4g.js";
4
- import { a as EVENT_SYSTEM_ACTOR } from "./prompt-C5LREK2p.js";
5
- import { f as credentialContextForActor } from "./registry-BjZZqKqi.js";
6
- import { A as getAgentInvocationResultMessageId, C as ownAgentInvocation, D as getAgentInvocationIdForMessage, E as getAgentInvocationIdForEvents, F as getTurnReplyKey, M as getAgentReplyMessageId, O as getAgentInvocationIdForResult, R as buildDeterministicTurnId, S as listChildMessages, b as hasAgentInvocationReply, j as getAgentInvocationTurnId, y as childMessageSenderMetadata } from "./turn-user-message-BrhuyYrH.js";
7
- import { _ as getConversationWorkState, r as appendAndEnqueueInboundMessage } from "./store-Ca6G962n.js";
8
- import { $t as childAgentInput, Bt as NON_TERMINAL_AGENT_INVOCATION_STATUSES, Gt as getLatestAgentInvocationForConversation, Kt as isTerminalAgentInvocation, Qt as sendsResultToParent, Vt as TERMINAL_AGENT_INVOCATION_STATUSES, Xt as markAgentInvocationParentMailboxAppended, Zt as reportReplacedWithoutOpenWork, an as logDroppedParentMessage, cn as createAgentInvocationWorker, dn as endAgentInvocationsOfStoppedWork, en as getChildAgentInputSender, fn as enqueueAgentInvocation, nn as routeChildInput, on as parentMessageText, pn as resolveAgentInvocationId, qt as listAgentInvocationsForConversation, sn as readParentMessage, tn as readChildConversationSender, un as endActiveAgentInvocations, xn as createAgentInvocationFromLatest, zt as listUnreportedSiblingAgents } from "./warmup--Gkz7iB-.js";
9
- import { Kn as renderUntrustedTag } from "./projection-CcFBVFUo.js";
10
- import { C as agentInvocationResultEventType, S as AGENT_REPLY_EVENT_TYPE, b as AGENT_MESSAGE_EVENT_TYPE, y as AGENT_INVOCATION_EVENT_NAMESPACE } from "./web-message-id-lNodcCOI.js";
2
+ import { P as SYSTEM_IDENTITY_ID, a as getConversationStore, k as turnBehavior } from "./db-Bcbd9zQc.js";
3
+ import { A as parseEventMessages, B as renderEventBatchInputs, D as getEventBatchDelayMs, F as EVENT_WAIT_MS, R as eventBatchMessageMeta, V as timerWatchCredentialSubject, j as resolveMailboxTurnWork, k as listActiveMailboxTurns, s as eventReviewItemInputs, t as getConversationStoppedAtMs } from "./session-stop-BDdwyZaa.js";
4
+ import { a as EVENT_SYSTEM_ACTOR } from "./prompt-D8u4jFs_.js";
5
+ import { p as credentialContextForActor } from "./registry-D20hG3r6.js";
6
+ import { A as getAgentInvocationResultMessageId, C as ownAgentInvocation, D as getAgentInvocationIdForMessage, E as getAgentInvocationIdForEvents, F as getTurnReplyKey, M as getAgentReplyMessageId, O as getAgentInvocationIdForResult, R as buildDeterministicTurnId, S as listChildMessages, b as hasAgentInvocationReply, j as getAgentInvocationTurnId, y as childMessageSenderMetadata } from "./turn-user-message-B1S8nOnG.js";
7
+ import { _ as getConversationWorkState, r as appendAndEnqueueInboundMessage } from "./store-CdWg2r2L.js";
8
+ import { $t as readChildConversationSender, Gt as listAgentInvocationsForConversation, Jt as markAgentInvocationParentMailboxAppended, Lt as listUnreportedSiblingAgents, Qt as getChildAgentInputSender, Rt as NON_TERMINAL_AGENT_INVOCATION_STATUSES, Ut as getLatestAgentInvocationForConversation, Wt as isTerminalAgentInvocation, Xt as sendsResultToParent, Yt as reportReplacedWithoutOpenWork, Zt as childAgentInput, an as readParentMessage, cn as endActiveAgentInvocations, dn as resolveAgentInvocationId, en as routeChildInput, in as parentMessageText, ln as endAgentInvocationsOfStoppedWork, on as createAgentInvocationWorker, rn as logDroppedParentMessage, un as enqueueAgentInvocation, yn as createAgentInvocationFromLatest, zt as TERMINAL_AGENT_INVOCATION_STATUSES } from "./warmup-CxhEhm71.js";
9
+ import { Z as renderUntrustedTag } from "./config-362yMSIz.js";
10
+ import { C as AGENT_MESSAGE_EVENT_TYPE, E as agentInvocationResultEventType, S as AGENT_INVOCATION_EVENT_NAMESPACE, T as AGENT_REPLY_EVENT_TYPE } from "./web-message-id-BT8Mg8LL.js";
11
+ import pLimit from "p-limit";
11
12
  import { actorSchema } from "@sentry/junior-plugin-api";
12
13
  // src/chat/agent-invocations/result.ts
13
14
  var result_exports = /* @__PURE__ */ __exportAll({
@@ -500,7 +501,8 @@ async function withAgentInvocationResultActors(work) {
500
501
  if (work.kind !== "mailbox") return work;
501
502
  const conversationId = work.batch[0]?.message.conversationId;
502
503
  const [latest, stoppedAtMs] = conversationId ? await Promise.all([getLatestAgentInvocationForConversation(conversationId), getConversationStoppedAtMs(conversationId)]) : [void 0, void 0];
503
- const kept = (await Promise.all(work.batch.map(async (entry) => {
504
+ const limit = pLimit(8);
505
+ const kept = (await Promise.all(work.batch.map((entry) => limit(async () => {
504
506
  const parentMessage = readParentMessage(entry.message);
505
507
  if (parentMessage) {
506
508
  if (await routeChildInput(entry.message, latest, stoppedAtMs) === "dropped") {
@@ -538,7 +540,7 @@ async function withAgentInvocationResultActors(work) {
538
540
  ...entry,
539
541
  actor
540
542
  };
541
- }))).filter((entry) => entry !== void 0);
543
+ })))).filter((entry) => entry !== void 0);
542
544
  return kept.length > 0 ? {
543
545
  kind: "mailbox",
544
546
  batch: kept
@@ -1,12 +1,13 @@
1
- import { B as messageCardText } from "./conversation-BOqdRtUx.js";
2
- import { c as buildDeliveredTurnStatePatch, l as loadPendingMessageCards, o as completeAuthPauseTurn, r as finalizeFailedTurnReplyWithEvent, t as buildTurnThreadContext } from "./thread-context-BOvZhsKK.js";
3
- import { A as latestConversationMessageSeq, I as upsertConversationMessage, M as normalizeConversationText, N as recordDeliveredAssistantMessage, W as authorizationId, a as loadProjection, b as persistConversationMessages, bn as persistWithRetry, d as recordAuthorizationCompleted, j as markConversationMessage, nt as saveTurnCheckpoint, t as commitAcceptedReply, un as getAssistantReplyText, v as hydrateConversationMessages } from "./projection-CcFBVFUo.js";
4
- import { S as setTags, T as withLogContext, p as logException } from "./logging-BPNTQVFu.js";
5
- import { n as scheduleSessionCompletedPluginTasks, t as processPluginTask } from "./task-runner-xsOPIxCZ.js";
6
- import { a as getPersistedThreadState, c as coerceThreadConversationState, i as getPersistedSandboxState, s as persistThreadStateById } from "./turn-session-routing-2bW2qfeb.js";
7
- import { _ as ConversationTurnLifecycleService, g as startActiveTurn, h as markTurnFailed } from "./turn-user-message-BrhuyYrH.js";
8
- import { f as credentialContextForActor } from "./registry-BjZZqKqi.js";
9
- import { P as SYSTEM_IDENTITY_ID, a as getConversationStore, r as getConversationEventStore } from "./db-DU84dCVu.js";
1
+ import { q as messageCardText } from "./conversation--f85g4zL.js";
2
+ import { a as buildDeliveredTurnStatePatch, o as loadPendingMessageCards, r as completeAuthPauseTurn, t as buildTurnThreadContext } from "./thread-context-ZPGqOjW7.js";
3
+ import { A as normalizeConversationText, H as authorizationId, O as latestConversationMessageSeq, P as upsertConversationMessage, a as loadProjection, b as persistConversationMessages, cn as getAssistantReplyText, d as recordAuthorizationCompleted, et as saveTurnCheckpoint, j as recordDeliveredAssistantMessage, k as markConversationMessage, t as commitAcceptedReply, v as hydrateConversationMessages, vn as persistWithRetry } from "./projection-xPpvqexa.js";
4
+ import { S as setTags, T as withLogContext, p as logException } from "./logging-CHCuQ5iz.js";
5
+ import { n as scheduleSessionCompletedPluginTasks, t as processPluginTask } from "./task-runner-CoXmMlsW.js";
6
+ import { a as getPersistedThreadState, c as coerceThreadConversationState, i as getPersistedSandboxState, s as persistThreadStateById } from "./turn-session-routing-DFYak28Q.js";
7
+ import { _ as ConversationTurnLifecycleService, g as startActiveTurn, h as markTurnFailed } from "./turn-user-message-B1S8nOnG.js";
8
+ import { L as finalizeFailedTurnReplyWithEvent } from "./agent-runner-DdFcxAxG.js";
9
+ import { p as credentialContextForActor } from "./registry-D20hG3r6.js";
10
+ import { P as SYSTEM_IDENTITY_ID, a as getConversationStore, r as getConversationEventStore } from "./db-Bcbd9zQc.js";
10
11
  import { randomUUID } from "node:crypto";
11
12
  import { createLocalSource, localDestinationSchema } from "@sentry/junior-plugin-api";
12
13
  // src/chat/local/runner.ts
@@ -267,10 +268,7 @@ async function runLocalAgentTurnInContext(input, deps) {
267
268
  if (outcome.status !== "completed") throw new Error(`Local agent run ended with ${outcome.status}`);
268
269
  reply = outcome.result;
269
270
  modelFailureCaptureAttempted = reply.diagnostics.outcome !== "success";
270
- const finalized = finalizeFailedTurnReplyWithEvent({
271
- reply,
272
- logException
273
- });
271
+ const finalized = finalizeFailedTurnReplyWithEvent({ reply });
274
272
  reply = finalized.reply;
275
273
  modelFailureEventId = finalized.eventId;
276
274
  modelFailureReason = finalized.failureReason;
@@ -382,7 +380,7 @@ async function runLocalAgentTurnInContext(input, deps) {
382
380
  await scheduleSessionCompletedPluginTasks({
383
381
  conversationId: input.conversationId,
384
382
  sessionId: turnId
385
- }, { send: async (message) => {
383
+ }, async (message) => {
386
384
  try {
387
385
  await processPluginTask(message);
388
386
  } catch (error) {
@@ -393,7 +391,7 @@ async function runLocalAgentTurnInContext(input, deps) {
393
391
  turnId
394
392
  });
395
393
  }
396
- } });
394
+ });
397
395
  } catch (error) {
398
396
  logException(error, "local.plugin.session_completion_task.failed", {
399
397
  conversationId: input.conversationId,
@@ -1,4 +1,4 @@
1
- import { qa as sandboxEgressSignalsResponseSchema } from "./projection-CcFBVFUo.js";
1
+ import { ba as sandboxEgressSignalsResponseSchema } from "./projection-xPpvqexa.js";
2
2
  // src/chat/local/sandbox-egress-signals.ts
3
3
  const SANDBOX_EGRESS_SIGNALS_PATH = "/api/internal/sandbox-egress/signals";
4
4
  const LOCAL_DEV_SERVER_TIMEOUT_MS = 1e3;