@sentry/junior 0.178.0 → 0.180.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 (138) hide show
  1. package/dist/{agent-hooks-PBT4NNBV.js → agent-hooks-DKDDRKZA.js} +16 -18
  2. package/dist/api/schema.js +0 -1
  3. package/dist/api.js +401 -366
  4. package/dist/app.d.ts +4 -0
  5. package/dist/app.js +783 -1367
  6. package/dist/catalog-runtime-WXKGUF3W.js +14 -0
  7. package/dist/chat/agent/sandbox.d.ts +0 -2
  8. package/dist/chat/api-turns/routing.d.ts +4 -0
  9. package/dist/chat/api-turns/work.d.ts +5 -0
  10. package/dist/chat/config.d.ts +5 -2
  11. package/dist/chat/configuration/defaults.d.ts +1 -1
  12. package/dist/chat/conversations/projection.d.ts +6 -4
  13. package/dist/chat/ingress/message-router.d.ts +3 -0
  14. package/dist/chat/model-profile.d.ts +8 -10
  15. package/dist/chat/pi/conversation-events.d.ts +3 -2
  16. package/dist/chat/plugins/task-queue.d.ts +40 -3
  17. package/dist/chat/plugins/task-runner.d.ts +1 -1
  18. package/dist/chat/queue/callback.d.ts +26 -0
  19. package/dist/chat/queue/sign.d.ts +30 -0
  20. package/dist/chat/sandbox/sandbox.d.ts +0 -2
  21. package/dist/chat/sandbox/session.d.ts +0 -2
  22. package/dist/chat/sandbox/skill-sync.d.ts +1 -1
  23. package/dist/chat/sandbox/snapshot/events.d.ts +23 -0
  24. package/dist/chat/sandbox/snapshot/job-callback.d.ts +5 -0
  25. package/dist/chat/sandbox/snapshot/job-queue.d.ts +26 -0
  26. package/dist/chat/sandbox/snapshot/job-runner.d.ts +11 -0
  27. package/dist/chat/sandbox/snapshot/not-ready-error.d.ts +6 -0
  28. package/dist/chat/sandbox/snapshot/workspace.d.ts +9 -3
  29. package/dist/chat/scheduled-tasks/personal.d.ts +5 -8
  30. package/dist/chat/scheduled-tasks/runs.d.ts +49 -0
  31. package/dist/chat/scheduled-tasks/schedule-intent.d.ts +1 -1
  32. package/dist/chat/scheduled-tasks/tasks.d.ts +27 -0
  33. package/dist/chat/scheduled-tasks/tool-support.d.ts +0 -4
  34. package/dist/chat/scheduled-tasks/tools/create.d.ts +1 -1
  35. package/dist/chat/scheduled-tasks/tools/update.d.ts +1 -1
  36. package/dist/chat/scheduled-tasks/types.d.ts +127 -78
  37. package/dist/chat/services/turn-router.d.ts +4 -3
  38. package/dist/chat/task-execution/queue-signing.d.ts +10 -21
  39. package/dist/chat/task-execution/state.d.ts +48 -0
  40. package/dist/chat/task-execution/store.d.ts +28 -2
  41. package/dist/chat/task-execution/worker.d.ts +4 -1
  42. package/dist/chat/tools/handoff/tool.d.ts +1 -1
  43. package/dist/{chunk-534BO42N.js → chunk-2AYEVN7K.js} +8 -8
  44. package/dist/{chunk-D3UJTX4U.js → chunk-2YIRH4E3.js} +46 -46
  45. package/dist/{chunk-4K6VNP3S.js → chunk-3ILJBWP7.js} +35 -227
  46. package/dist/{chunk-FQ6BMP5P.js → chunk-5PUMIMNQ.js} +2724 -1257
  47. package/dist/{chunk-G3CQEUHI.js → chunk-5TUR4M3M.js} +8 -61
  48. package/dist/{chunk-6ZWRNC4D.js → chunk-6Y5B5PEX.js} +1 -1
  49. package/dist/{chunk-KEQAA42D.js → chunk-6YCEWOLO.js} +4 -4
  50. package/dist/chunk-7H2VZTWN.js +103 -0
  51. package/dist/{chunk-22T3HB44.js → chunk-CCDXTDSY.js} +8 -8
  52. package/dist/{chunk-CGA4ERJ5.js → chunk-CEMMLV5L.js} +1 -1
  53. package/dist/chunk-CK6EINVZ.js +1181 -0
  54. package/dist/{chunk-FIANEE7Z.js → chunk-CM5HNV2W.js} +6 -6
  55. package/dist/{chunk-PRDKO3QB.js → chunk-CP73FKME.js} +144 -218
  56. package/dist/{chunk-XWUJWHFD.js → chunk-DHLOGWYH.js} +36 -36
  57. package/dist/chunk-DKIJ2RP5.js +68 -0
  58. package/dist/{chunk-ABLODWPO.js → chunk-DRHEGXTZ.js} +1 -1
  59. package/dist/{chunk-OOUNJNMR.js → chunk-DWPN6SCH.js} +1 -1
  60. package/dist/chunk-EWHP2IRG.js +209 -0
  61. package/dist/{chunk-ZCHHVTMF.js → chunk-FGC3PHNH.js} +3 -3
  62. package/dist/{chunk-H6ZXBFGX.js → chunk-GA5NS74S.js} +1 -1
  63. package/dist/{chunk-BFLMRTPD.js → chunk-GPXAHUQH.js} +84 -274
  64. package/dist/chunk-GUKXEPMX.js +218 -0
  65. package/dist/{chunk-3ZZEPLLB.js → chunk-I6IFTAPF.js} +108 -76
  66. package/dist/{chunk-RGXOLPWO.js → chunk-IANUX7HX.js} +5 -5
  67. package/dist/{chunk-UMG7M32G.js → chunk-KCL6AWYW.js} +74 -68
  68. package/dist/{chunk-BUGO42R6.js → chunk-L7LTGN4Z.js} +129 -31
  69. package/dist/{chunk-QCCLDJHB.js → chunk-LGVQLNLS.js} +42 -41
  70. package/dist/chunk-M3QYTBQ6.js +55 -0
  71. package/dist/{chunk-AVRWMQ4U.js → chunk-MXEUIGHO.js} +2 -2
  72. package/dist/{chunk-M63DETLL.js → chunk-N7TMSOZH.js} +6 -6
  73. package/dist/{chunk-JVXZ3WDH.js → chunk-O4QYZTDK.js} +33 -32
  74. package/dist/chunk-PEQXYSSE.js +45 -0
  75. package/dist/{chunk-OGRD5PFM.js → chunk-QSO7B5JO.js} +1 -1
  76. package/dist/{chunk-UGWBJAGN.js → chunk-RAZG3YHC.js} +100 -79
  77. package/dist/{chunk-XCNS3CXE.js → chunk-S7YRTOSQ.js} +69 -73
  78. package/dist/{chunk-LAOP4EPL.js → chunk-SDBKZ5LV.js} +108 -5
  79. package/dist/{chunk-RE4XWXBV.js → chunk-TC5DE5KJ.js} +22 -18
  80. package/dist/{chunk-H4HBKISO.js → chunk-TXKUKMVO.js} +1 -1
  81. package/dist/chunk-U5EUCUBH.js +164 -0
  82. package/dist/{chunk-BHHWCNXI.js → chunk-VG722ONZ.js} +18 -16
  83. package/dist/{chunk-U3UDPGZG.js → chunk-VGPPWWHF.js} +16 -16
  84. package/dist/{chunk-AQHSXA3J.js → chunk-WVAMRKYG.js} +9 -54
  85. package/dist/chunk-X6GDDWQH.js +60 -0
  86. package/dist/{chunk-6OYVH66J.js → chunk-ZE2KOV3G.js} +1 -1
  87. package/dist/{chunk-IQRPDKPJ.js → chunk-ZM7ZURJS.js} +4 -3
  88. package/dist/cli/chat.js +47 -43
  89. package/dist/cli/check.js +13 -15
  90. package/dist/cli/env.js +0 -1
  91. package/dist/cli/init.js +0 -1
  92. package/dist/cli/main.js +2 -3
  93. package/dist/cli/plugins.js +18 -20
  94. package/dist/cli/run.js +0 -1
  95. package/dist/cli/snapshot-create.js +14 -16
  96. package/dist/cli/upgrade.js +16 -18
  97. package/dist/{conversation-work-KATFHLG3.js → conversation-work-VIOQ5ZF3.js} +0 -2
  98. package/dist/db/schema/scheduled-tasks.d.ts +29 -5
  99. package/dist/db/schema.d.ts +28 -4
  100. package/dist/{db-QVYOWATH.js → db-6SBHIAJK.js} +8 -10
  101. package/dist/deployment.d.ts +1 -0
  102. package/dist/{discovery-GUFTFBTL.js → discovery-DWVDM7UK.js} +1 -2
  103. package/dist/{experimental-XVDOSRBS.js → experimental-SIJSRDJD.js} +0 -1
  104. package/dist/instrumentation.js +7 -9
  105. package/dist/nitro.js +39 -13
  106. package/dist/{oauth-callback-server-PLPAFXO6.js → oauth-callback-server-WSDQPZZS.js} +34 -32
  107. package/dist/{oauth-relay-3ZU72UGL.js → oauth-relay-5XPVRPYB.js} +0 -1
  108. package/dist/{plugins-HW4VWW6G.js → plugins-YTYJMMJF.js} +1 -2
  109. package/dist/{runner-AGNEIOZS.js → runner-GWTSWESR.js} +39 -33
  110. package/dist/{sandbox-egress-signals-DXOOBSBI.js → sandbox-egress-signals-FIL7EGPR.js} +5 -6
  111. package/dist/{sentry-JMWTS32N.js → sentry-MB3NL3IR.js} +1 -2
  112. package/dist/skills-F32BPFYW.js +27 -0
  113. package/dist/spawn-X5BPP5OE.js +37 -0
  114. package/dist/task-runner-2FPBV5PP.js +32 -0
  115. package/dist/validation-62WO524A.js +17 -0
  116. package/dist/vercel.js +0 -1
  117. package/dist/version.js +1 -2
  118. package/dist/work-3C3CMZ24.js +45 -0
  119. package/dist/worker-MFAI6ZEK.js +22 -0
  120. package/package.json +7 -6
  121. package/dist/catalog-runtime-M7QGKPFZ.js +0 -16
  122. package/dist/chat/plugins/task-callback.d.ts +0 -5
  123. package/dist/chat/plugins/task-message.d.ts +0 -23
  124. package/dist/chat/plugins/task-signing.d.ts +0 -31
  125. package/dist/chat/sandbox/snapshot/waiting-error.d.ts +0 -15
  126. package/dist/chat/scheduled-tasks/store.d.ts +0 -78
  127. package/dist/chat/services/workspace-snapshot-wait.d.ts +0 -27
  128. package/dist/chunk-5I6ORJUY.js +0 -127
  129. package/dist/chunk-6GWA276C.js +0 -72
  130. package/dist/chunk-AGJ4OQ2V.js +0 -51
  131. package/dist/chunk-MLKGABMK.js +0 -9
  132. package/dist/chunk-RGV6KHDM.js +0 -1944
  133. package/dist/chunk-WR76IVA5.js +0 -130
  134. package/dist/skills-U5KQ66EM.js +0 -29
  135. package/dist/spawn-ZRYYZP2B.js +0 -37
  136. package/dist/validation-QE4U45KS.js +0 -19
  137. package/dist/work-ATAXAHJJ.js +0 -45
  138. package/dist/worker-LIL5AOER.js +0 -24
@@ -1,18 +1,18 @@
1
1
  import {
2
2
  credentialUserSubjectId
3
- } from "./chunk-CGA4ERJ5.js";
4
- import {
5
- logInfo,
6
- logWarn,
7
- setSpanAttributes
8
- } from "./chunk-UGWBJAGN.js";
3
+ } from "./chunk-CEMMLV5L.js";
9
4
  import {
10
5
  discoverInstalledPluginPackageContent,
11
6
  normalizePluginPackageNames
12
- } from "./chunk-OOUNJNMR.js";
7
+ } from "./chunk-DWPN6SCH.js";
13
8
  import {
14
9
  pluginRoots
15
- } from "./chunk-H4HBKISO.js";
10
+ } from "./chunk-TXKUKMVO.js";
11
+ import {
12
+ logInfo,
13
+ logWarn,
14
+ setSpanAttributes
15
+ } from "./chunk-RAZG3YHC.js";
16
16
 
17
17
  // src/chat/plugins/manifest.ts
18
18
  import { z } from "zod";
@@ -626,9 +626,9 @@ function normalizeCredentials(data, name) {
626
626
  return {
627
627
  type: "oauth-bearer",
628
628
  domains,
629
- ...apiHeaders ? { apiHeaders } : {},
629
+ ...apiHeaders ? { apiHeaders } : void 0,
630
630
  authTokenEnv: result.data["auth-token-env"],
631
- ...result.data["auth-token-placeholder"] ? { authTokenPlaceholder: result.data["auth-token-placeholder"] } : {}
631
+ ...result.data["auth-token-placeholder"] ? { authTokenPlaceholder: result.data["auth-token-placeholder"] } : void 0
632
632
  };
633
633
  }
634
634
  function normalizeRuntimeDependencies(entries, name) {
@@ -751,8 +751,8 @@ function normalizeRuntimePostinstall(commands, name) {
751
751
  const normalizedArgs = result.data.args?.map((arg) => arg.trim()).filter((arg) => arg.length > 0);
752
752
  parsed.push({
753
753
  cmd: result.data.cmd,
754
- ...normalizedArgs && normalizedArgs.length > 0 ? { args: normalizedArgs } : {},
755
- ...typeof result.data.sudo === "boolean" ? { sudo: result.data.sudo } : {}
754
+ ...normalizedArgs && normalizedArgs.length > 0 ? { args: normalizedArgs } : void 0,
755
+ ...typeof result.data.sudo === "boolean" ? { sudo: result.data.sudo } : void 0
756
756
  });
757
757
  }
758
758
  return parsed.length > 0 ? parsed : void 0;
@@ -831,9 +831,9 @@ function normalizeMcp(data, envVars, name) {
831
831
  return {
832
832
  transport: "http",
833
833
  url: result.data.url,
834
- ...headers ? { headers } : {},
835
- ...result.data["allowed-tools"] ? { allowedTools: result.data["allowed-tools"] } : {},
836
- ...result.data["wrapped-tools"] ? { wrappedTools: result.data["wrapped-tools"] } : {}
834
+ ...headers ? { headers } : void 0,
835
+ ...result.data["allowed-tools"] ? { allowedTools: result.data["allowed-tools"] } : void 0,
836
+ ...result.data["wrapped-tools"] ? { wrappedTools: result.data["wrapped-tools"] } : void 0
837
837
  };
838
838
  }
839
839
  function parseManifestSource(parsedSource, dir, config, options) {
@@ -941,14 +941,14 @@ function parseManifestSource(parsedSource, dir, config, options) {
941
941
  displayName: data["display-name"],
942
942
  description: data.description,
943
943
  configKeys,
944
- ...domains ? { domains } : {},
945
- ...apiHeaders ? { apiHeaders } : {},
946
- ...commandEnv ? { commandEnv } : {},
947
- ...Object.keys(envVars).length > 0 ? { envVars } : {},
948
- ...credentials ? { credentials } : {},
949
- ...runtimeDependencies ? { runtimeDependencies } : {},
950
- ...runtimePostinstall ? { runtimePostinstall } : {},
951
- ...mcp ? { mcp } : {}
944
+ ...domains ? { domains } : void 0,
945
+ ...apiHeaders ? { apiHeaders } : void 0,
946
+ ...commandEnv ? { commandEnv } : void 0,
947
+ ...Object.keys(envVars).length > 0 ? { envVars } : void 0,
948
+ ...credentials ? { credentials } : void 0,
949
+ ...runtimeDependencies ? { runtimeDependencies } : void 0,
950
+ ...runtimePostinstall ? { runtimePostinstall } : void 0,
951
+ ...mcp ? { mcp } : void 0
952
952
  };
953
953
  if (data.oauth) {
954
954
  if (!credentials && options?.allowHookManagedEgress !== true) {
@@ -977,11 +977,11 @@ function parseManifestSource(parsedSource, dir, config, options) {
977
977
  clientSecretEnv: result.data["client-secret-env"],
978
978
  authorizeEndpoint: result.data["authorize-endpoint"],
979
979
  tokenEndpoint: result.data["token-endpoint"],
980
- ...result.data.scope ? { scope: result.data.scope } : {},
981
- ...authorizeParams ? { authorizeParams } : {},
982
- ...result.data["token-auth-method"] ? { tokenAuthMethod: result.data["token-auth-method"] } : {},
983
- ...tokenExtraHeaders ? { tokenExtraHeaders } : {},
984
- ...result.data["treat-empty-scope-as-unreported"] ? { treatEmptyScopeAsUnreported: true } : {}
980
+ ...result.data.scope ? { scope: result.data.scope } : void 0,
981
+ ...authorizeParams ? { authorizeParams } : void 0,
982
+ ...result.data["token-auth-method"] ? { tokenAuthMethod: result.data["token-auth-method"] } : void 0,
983
+ ...tokenExtraHeaders ? { tokenExtraHeaders } : void 0,
984
+ ...result.data["treat-empty-scope-as-unreported"] ? { treatEmptyScopeAsUnreported: true } : void 0
985
985
  };
986
986
  }
987
987
  assertCommandEnvDoesNotExposeHostSecretRefs(
@@ -1021,7 +1021,7 @@ function parseManifestSource(parsedSource, dir, config, options) {
1021
1021
  manifest.target = {
1022
1022
  type: result.data.type,
1023
1023
  configKey: qualifiedKey,
1024
- ...commandFlags ? { commandFlags } : {}
1024
+ ...commandFlags ? { commandFlags } : void 0
1025
1025
  };
1026
1026
  }
1027
1027
  return manifest;
@@ -1152,7 +1152,7 @@ function getOAuthProviderErrorAttributes(error) {
1152
1152
  "app.credential.provider": error.provider,
1153
1153
  "app.oauth.error.phase": error.phase,
1154
1154
  "server.address": error.resourceHost,
1155
- ...error.status !== void 0 ? { "http.response.status_code": error.status } : {}
1155
+ ...error.status !== void 0 ? { "http.response.status_code": error.status } : void 0
1156
1156
  };
1157
1157
  }
1158
1158
  async function readBoundedOAuthErrorBody(response) {
@@ -1393,7 +1393,7 @@ function parseOAuthTokenResponse(data, requestedScope, options) {
1393
1393
  const result = {
1394
1394
  accessToken,
1395
1395
  refreshToken: resolvedRefreshToken,
1396
- ...scope ? { scope } : {}
1396
+ ...scope ? { scope } : void 0
1397
1397
  };
1398
1398
  if (expiresIn !== void 0) {
1399
1399
  if (typeof expiresIn !== "number" || !Number.isFinite(expiresIn) || expiresIn <= 0) {
@@ -1593,9 +1593,9 @@ function createOAuthBearerBroker(manifest, credentials, deps) {
1593
1593
  );
1594
1594
  }
1595
1595
  const refreshedTokens = {
1596
- ...latest.refreshTokenExpiresAt ? { refreshTokenExpiresAt: latest.refreshTokenExpiresAt } : {},
1596
+ ...latest.refreshTokenExpiresAt ? { refreshTokenExpiresAt: latest.refreshTokenExpiresAt } : void 0,
1597
1597
  ...refreshed,
1598
- ...latest.account ? { account: latest.account } : {}
1598
+ ...latest.account ? { account: latest.account } : void 0
1599
1599
  };
1600
1600
  await deps.userTokenStore.set(
1601
1601
  userSubjectId,
@@ -1690,8 +1690,8 @@ function registerPluginManifest(state, manifest, pluginDir, skillsDir, migration
1690
1690
  const definition = {
1691
1691
  manifest,
1692
1692
  dir: pluginDir,
1693
- ...migrationsDir ? { migrationsDir } : {},
1694
- ...skillsDir ? { skillsDir } : {}
1693
+ ...migrationsDir ? { migrationsDir } : void 0,
1694
+ ...skillsDir ? { skillsDir } : void 0
1695
1695
  };
1696
1696
  state.pluginDefinitions.push(definition);
1697
1697
  state.pluginsByName.set(manifest.name, definition);
@@ -1775,7 +1775,7 @@ function normalizePluginCatalogConfig(config) {
1775
1775
  return {
1776
1776
  inlineManifests: config.inlineManifests ? structuredClone(config.inlineManifests) : void 0,
1777
1777
  packages: normalizePluginPackageNames(config.packages),
1778
- ...config.manifests ? { manifests: structuredClone(config.manifests) } : {}
1778
+ ...config.manifests ? { manifests: structuredClone(config.manifests) } : void 0
1779
1779
  };
1780
1780
  }
1781
1781
  function clonePluginCatalogConfig(config) {
@@ -1783,9 +1783,9 @@ function clonePluginCatalogConfig(config) {
1783
1783
  return void 0;
1784
1784
  }
1785
1785
  return {
1786
- ...config.inlineManifests ? { inlineManifests: structuredClone(config.inlineManifests) } : {},
1786
+ ...config.inlineManifests ? { inlineManifests: structuredClone(config.inlineManifests) } : void 0,
1787
1787
  packages: [...config.packages ?? []],
1788
- ...config.manifests ? { manifests: structuredClone(config.manifests) } : {}
1788
+ ...config.manifests ? { manifests: structuredClone(config.manifests) } : void 0
1789
1789
  };
1790
1790
  }
1791
1791
  function packageContentByName(packagedContent, packageName) {
@@ -1907,7 +1907,7 @@ function logLoadedPlugins(state) {
1907
1907
  "app.plugin.config_key_count": plugin.manifest.configKeys.length,
1908
1908
  "app.plugin.has_mcp": Boolean(plugin.manifest.mcp),
1909
1909
  "file.directory": plugin.dir,
1910
- ...plugin.skillsDir ? { "app.file.skill_directory": plugin.skillsDir } : {}
1910
+ ...plugin.skillsDir ? { "app.file.skill_directory": plugin.skillsDir } : void 0
1911
1911
  });
1912
1912
  }
1913
1913
  }
@@ -1986,8 +1986,8 @@ function createPluginCatalogRuntime() {
1986
1986
  for (const command of plugin.manifest.runtimePostinstall ?? []) {
1987
1987
  commands.push({
1988
1988
  cmd: command.cmd,
1989
- ...command.args ? { args: [...command.args] } : {},
1990
- ...command.sudo !== void 0 ? { sudo: command.sudo } : {}
1989
+ ...command.args ? { args: [...command.args] } : void 0,
1990
+ ...command.sudo !== void 0 ? { sudo: command.sudo } : void 0
1991
1991
  });
1992
1992
  }
1993
1993
  }
@@ -2002,11 +2002,11 @@ function createPluginCatalogRuntime() {
2002
2002
  clientSecretEnv: oauth.clientSecretEnv,
2003
2003
  authorizeEndpoint: oauth.authorizeEndpoint,
2004
2004
  tokenEndpoint: oauth.tokenEndpoint,
2005
- ...oauth.scope ? { scope: oauth.scope } : {},
2006
- ...oauth.authorizeParams ? { authorizeParams: { ...oauth.authorizeParams } } : {},
2007
- ...oauth.tokenAuthMethod ? { tokenAuthMethod: oauth.tokenAuthMethod } : {},
2008
- ...oauth.tokenExtraHeaders ? { tokenExtraHeaders: { ...oauth.tokenExtraHeaders } } : {},
2009
- ...oauth.treatEmptyScopeAsUnreported ? { treatEmptyScopeAsUnreported: true } : {},
2005
+ ...oauth.scope ? { scope: oauth.scope } : void 0,
2006
+ ...oauth.authorizeParams ? { authorizeParams: { ...oauth.authorizeParams } } : void 0,
2007
+ ...oauth.tokenAuthMethod ? { tokenAuthMethod: oauth.tokenAuthMethod } : void 0,
2008
+ ...oauth.tokenExtraHeaders ? { tokenExtraHeaders: { ...oauth.tokenExtraHeaders } } : void 0,
2009
+ ...oauth.treatEmptyScopeAsUnreported ? { treatEmptyScopeAsUnreported: true } : void 0,
2010
2010
  callbackPath: `/api/oauth/callback/${plugin.manifest.name}`
2011
2011
  };
2012
2012
  },
@@ -1,28 +1,22 @@
1
1
  import {
2
2
  coerceThreadConversationState,
3
- getPersistedThreadState,
4
- persistThreadStateById
5
- } from "./chunk-G3CQEUHI.js";
3
+ getPersistedThreadState
4
+ } from "./chunk-5TUR4M3M.js";
6
5
  import {
7
6
  pluginTaskId,
8
7
  pluginTaskParamsSchema,
9
8
  sendVercelPluginTask
10
- } from "./chunk-5I6ORJUY.js";
9
+ } from "./chunk-U5EUCUBH.js";
11
10
  import {
12
- buildDeterministicTurnId,
13
- clearPendingAuth,
14
11
  getPiMessageRole,
15
12
  getTurnRecord,
16
13
  hydrateConversationMessages,
17
14
  instructionTextForProjection,
18
15
  isToolResultError,
19
16
  isToolResultMessage,
20
- markConversationMessage,
21
- markTurnClosed,
22
- markTurnCompleted,
23
17
  normalizeToolNameFromResult,
24
18
  stripRuntimeTurnContext
25
- } from "./chunk-BFLMRTPD.js";
19
+ } from "./chunk-GPXAHUQH.js";
26
20
  import {
27
21
  createPluginConversationEvents,
28
22
  createPluginEmbedder,
@@ -30,7 +24,7 @@ import {
30
24
  createPluginModel,
31
25
  createPluginState,
32
26
  getPlugins
33
- } from "./chunk-XWUJWHFD.js";
27
+ } from "./chunk-DHLOGWYH.js";
34
28
  import {
35
29
  JUNIOR_THREAD_STATE_TTL_MS
36
30
  } from "./chunk-3Y47VMHV.js";
@@ -38,56 +32,30 @@ import {
38
32
  getConversationStore,
39
33
  getDb,
40
34
  sameActorIdentity
41
- } from "./chunk-XCNS3CXE.js";
35
+ } from "./chunk-S7YRTOSQ.js";
42
36
  import {
43
37
  juniorConversations,
44
38
  juniorTaskExecutions
45
- } from "./chunk-ZCHHVTMF.js";
39
+ } from "./chunk-FGC3PHNH.js";
46
40
  import {
47
41
  getStateAdapter
48
- } from "./chunk-H6ZXBFGX.js";
49
- import {
50
- ProviderError,
51
- findProviderError,
52
- getProviderErrorAttributes,
53
- getProviderErrorUserMessage
54
- } from "./chunk-3ZZEPLLB.js";
42
+ } from "./chunk-GA5NS74S.js";
55
43
  import {
56
44
  credentialSubjectSchema
57
- } from "./chunk-CGA4ERJ5.js";
45
+ } from "./chunk-CEMMLV5L.js";
58
46
  import {
59
47
  parseSlackMessageTs
60
- } from "./chunk-M63DETLL.js";
48
+ } from "./chunk-N7TMSOZH.js";
61
49
  import {
62
- buildTurnFailureResponse,
63
50
  logWarn
64
- } from "./chunk-UGWBJAGN.js";
65
-
66
- // src/chat/runtime/delivered-turn-state.ts
67
- function buildDeliveredTurnStatePatch(args) {
68
- const conversation = structuredClone(args.conversation);
69
- clearPendingAuth(conversation, args.sessionId);
70
- markConversationMessage(conversation, args.userMessageId, {
71
- replied: true,
72
- skippedReason: void 0
73
- });
74
- markTurnCompleted({
75
- conversation,
76
- nowMs: Date.now(),
77
- sessionId: args.sessionId
78
- });
79
- return {
80
- conversation,
81
- sandboxRef: args.reply.sandboxRef
82
- };
83
- }
51
+ } from "./chunk-RAZG3YHC.js";
84
52
 
85
53
  // src/chat/plugins/task-runner.ts
86
54
  import { pluginRunContextSchema } from "@sentry/junior-plugin-api";
87
55
 
88
56
  // src/chat/services/turn-session-routing.ts
89
57
  async function resolveTurnSessionRouting(args) {
90
- const conversationStore = args.conversationStore ?? (await import("./db-QVYOWATH.js")).getConversationStore();
58
+ const conversationStore = args.conversationStore ?? (await import("./db-6SBHIAJK.js")).getConversationStore();
91
59
  const conversation = await conversationStore.get({
92
60
  conversationId: args.conversationId
93
61
  });
@@ -148,7 +116,7 @@ async function recordTaskExecution(type, taskId, options) {
148
116
  const status = options.status ?? "completed";
149
117
  try {
150
118
  await getDb().insert(juniorTaskExecutions).values({
151
- ...options.conversationId ? { conversationId: options.conversationId } : {},
119
+ ...options.conversationId ? { conversationId: options.conversationId } : void 0,
152
120
  executedAtMs: nowMs,
153
121
  executionId: options.executionId,
154
122
  kind: type,
@@ -205,8 +173,8 @@ async function readTaskExecutionSummaries(type, namespace, options = {}) {
205
173
  rows.map((row) => [
206
174
  row.taskId,
207
175
  {
208
- ...row.lastConversationId ? { lastConversationId: row.lastConversationId } : {},
209
- ...row.lastExecutedAtMs !== null ? { lastExecutedAtMs: row.lastExecutedAtMs } : {},
176
+ ...row.lastConversationId ? { lastConversationId: row.lastConversationId } : void 0,
177
+ ...row.lastExecutedAtMs !== null ? { lastExecutedAtMs: row.lastExecutedAtMs } : void 0,
210
178
  runsLast7Days: row.runsLast7Days,
211
179
  totalRuns: row.totalRuns
212
180
  }
@@ -290,11 +258,11 @@ async function readTaskExecutions(args) {
290
258
  return rows.map((row) => {
291
259
  const title = row.title?.trim();
292
260
  return {
293
- ...row.conversationId ? { conversationId: row.conversationId } : {},
261
+ ...row.conversationId ? { conversationId: row.conversationId } : void 0,
294
262
  executedAt: new Date(row.executedAtMs).toISOString(),
295
263
  executionId: row.executionId,
296
264
  status: row.status,
297
- ...title ? { title } : {}
265
+ ...title ? { title } : void 0
298
266
  };
299
267
  });
300
268
  }
@@ -330,13 +298,13 @@ async function readTaskRuns(args) {
330
298
  const title = row.title?.trim();
331
299
  return [
332
300
  {
333
- ...row.conversationId ? { conversationId: row.conversationId } : {},
301
+ ...row.conversationId ? { conversationId: row.conversationId } : void 0,
334
302
  executedAt: new Date(row.executedAtMs).toISOString(),
335
303
  executionId: row.executionId,
336
304
  kind: row.kind,
337
305
  status: row.status,
338
306
  taskId: row.taskId,
339
- ...title ? { title } : {}
307
+ ...title ? { title } : void 0
340
308
  }
341
309
  ];
342
310
  });
@@ -499,8 +467,8 @@ function toDispatchProjection(record) {
499
467
  return {
500
468
  id: record.id,
501
469
  status: record.status,
502
- ...record.resultMessageTs ? { resultMessageTs: record.resultMessageTs } : {},
503
- ...record.errorMessage ? { errorMessage: record.errorMessage } : {}
470
+ ...record.resultMessageTs ? { resultMessageTs: record.resultMessageTs } : void 0,
471
+ ...record.errorMessage ? { errorMessage: record.errorMessage } : void 0
504
472
  };
505
473
  }
506
474
  function isTerminalDispatchStatus(status) {
@@ -580,15 +548,15 @@ async function createOrGetDispatch(args) {
580
548
  const record = {
581
549
  actor: { platform: "system", name: args.plugin },
582
550
  createdAtMs: args.nowMs,
583
- ...args.options.credentialSubject ? { credentialSubject: args.options.credentialSubject } : {},
551
+ ...args.options.credentialSubject ? { credentialSubject: args.options.credentialSubject } : void 0,
584
552
  destination: args.options.destination,
585
553
  destinationVisibility: args.options.destinationVisibility,
586
554
  id,
587
555
  idempotencyKey: args.options.idempotencyKey,
588
556
  input: args.options.input,
589
- ...metadata ? { metadata } : {},
557
+ ...metadata ? { metadata } : void 0,
590
558
  plugin: args.plugin,
591
- ...args.options.replyAttribution ? { replyAttribution: args.options.replyAttribution } : {},
559
+ ...args.options.replyAttribution ? { replyAttribution: args.options.replyAttribution } : void 0,
592
560
  status: "pending",
593
561
  source: args.options.source,
594
562
  updatedAtMs: args.nowMs
@@ -644,7 +612,7 @@ async function recordEventTaskExecution(previous, next, status) {
644
612
  const conversationId = getDispatchConversationId(next);
645
613
  const conversation = await getConversationStore().get({ conversationId });
646
614
  await recordTaskExecution("event", eventTaskId, {
647
- ...conversation ? { conversationId } : {},
615
+ ...conversation ? { conversationId } : void 0,
648
616
  executionId: next.id,
649
617
  nowMs: next.updatedAtMs,
650
618
  status
@@ -657,7 +625,7 @@ async function markDispatchBlocked(id, errorMessage, resultMessageTs) {
657
625
  (record) => isTerminalDispatchStatus(record.status) ? record : {
658
626
  ...record,
659
627
  errorMessage,
660
- ...resultMessageTs ? { resultMessageTs } : {},
628
+ ...resultMessageTs ? { resultMessageTs } : void 0,
661
629
  status: "blocked"
662
630
  }
663
631
  );
@@ -671,7 +639,7 @@ async function markDispatchCompleted(id, resultMessageTs) {
671
639
  (record) => isTerminalDispatchStatus(record.status) ? record : {
672
640
  ...record,
673
641
  errorMessage: void 0,
674
- ...resultMessageTs ? { resultMessageTs } : {},
642
+ ...resultMessageTs ? { resultMessageTs } : void 0,
675
643
  status: "completed"
676
644
  }
677
645
  );
@@ -685,7 +653,7 @@ async function markDispatchFailed(id, errorMessage, resultMessageTs) {
685
653
  (record) => isTerminalDispatchStatus(record.status) ? record : {
686
654
  ...record,
687
655
  errorMessage,
688
- ...resultMessageTs ? { resultMessageTs } : {},
656
+ ...resultMessageTs ? { resultMessageTs } : void 0,
689
657
  status: "failed"
690
658
  }
691
659
  );
@@ -766,7 +734,7 @@ function sanitizeText(text) {
766
734
  function messageProvenance(provenance) {
767
735
  return {
768
736
  authority: provenance.authority,
769
- ...provenance.actor ? { actor: provenance.actor } : {}
737
+ ...provenance.actor ? { actor: provenance.actor } : void 0
770
738
  };
771
739
  }
772
740
  function runTranscriptEntry(message, provenance, runActor) {
@@ -799,7 +767,7 @@ function runTranscriptEntry(message, provenance, runActor) {
799
767
  type: "toolResult",
800
768
  toolName,
801
769
  isError: isToolResultError(message),
802
- ...text ? { text } : {}
770
+ ...text ? { text } : void 0
803
771
  };
804
772
  }
805
773
  function turnMessagesWithProvenance(record) {
@@ -826,8 +794,8 @@ function slackContextAuthor(source, message) {
826
794
  platform: "slack",
827
795
  teamId: source.teamId,
828
796
  userId,
829
- ...message.author?.userName ? { userName: message.author.userName } : {},
830
- ...message.author?.fullName ? { fullName: message.author.fullName } : {}
797
+ ...message.author?.userName ? { userName: message.author.userName } : void 0,
798
+ ...message.author?.fullName ? { fullName: message.author.fullName } : void 0
831
799
  };
832
800
  }
833
801
  function slackTimestampMs(value) {
@@ -884,7 +852,7 @@ async function loadConversationContextTranscriptEntries(record, source, runActor
884
852
  text,
885
853
  provenance: {
886
854
  authority: "context",
887
- ...author ? { actor: author } : {}
855
+ ...author ? { actor: author } : void 0
888
856
  },
889
857
  isRunActor: sameActorIdentity(author, runActor)
890
858
  });
@@ -939,7 +907,7 @@ async function loadPluginRun(params) {
939
907
  // Derived from the full run provenance on the record, not the sliced or
940
908
  // stripped transcript, so it reflects every committed instruction actor.
941
909
  actors: record.actors,
942
- ...runActor ? { actor: runActor } : {},
910
+ ...runActor ? { actor: runActor } : void 0,
943
911
  runId: record.turnId,
944
912
  source: routing.source,
945
913
  transcript: [...contextEntries, ...runEntries]
@@ -1025,155 +993,6 @@ async function processPluginTask(message, options = {}) {
1025
993
  });
1026
994
  }
1027
995
 
1028
- // src/chat/interruption-marker.ts
1029
- var INTERRUPTED_MARKER = "\n\n[Response interrupted before completion]";
1030
- function getInterruptionMarker() {
1031
- return INTERRUPTED_MARKER;
1032
- }
1033
-
1034
- // src/chat/services/turn-failure-response.ts
1035
- function requireTurnFailureEventId(eventId, eventName) {
1036
- if (!eventId) {
1037
- throw new Error(`Sentry did not return an event ID for ${eventName}`);
1038
- }
1039
- return eventId;
1040
- }
1041
- function getExecutionFailureReason(reply) {
1042
- const errorMessage = reply.diagnostics.errorMessage?.trim();
1043
- if (errorMessage) {
1044
- return errorMessage;
1045
- }
1046
- if (reply.diagnostics.toolErrorCount > 0) {
1047
- return `${reply.diagnostics.toolErrorCount} tool result error(s)`;
1048
- }
1049
- if (reply.diagnostics.assistantMessageCount > 0) {
1050
- return "assistant returned no text";
1051
- }
1052
- return "empty assistant turn";
1053
- }
1054
- function getFailureCapture(reply) {
1055
- if (reply.diagnostics.outcome === "provider_error") {
1056
- const providerError = findProviderError(reply.diagnostics.providerError);
1057
- return {
1058
- eventName: "agent.turn.provider_error",
1059
- error: reply.diagnostics.providerError ?? new Error(
1060
- reply.diagnostics.errorMessage ?? "Provider error without explicit message"
1061
- ),
1062
- attributes: providerError ? getProviderErrorAttributes(providerError) : {},
1063
- body: "Agent turn failed with provider error"
1064
- };
1065
- }
1066
- const failureReason = getExecutionFailureReason(reply);
1067
- return {
1068
- eventName: "agent.turn.execution.failed",
1069
- error: new Error(`Agent turn execution failure: ${failureReason}`),
1070
- attributes: {
1071
- "app.ai.execution_failure_reason": failureReason
1072
- },
1073
- body: "Agent turn completed with execution failure"
1074
- };
1075
- }
1076
- function getAgentTurnDiagnosticsAttributes(reply) {
1077
- return {
1078
- "app.ai.outcome": reply.diagnostics.outcome,
1079
- "app.ai.assistant_messages": reply.diagnostics.assistantMessageCount,
1080
- "app.ai.tool_results": reply.diagnostics.toolResultCount,
1081
- "app.ai.tool_error_results": reply.diagnostics.toolErrorCount,
1082
- "app.ai.tool_call_count": reply.diagnostics.toolCalls.length,
1083
- "app.ai.used_primary_text": reply.diagnostics.usedPrimaryText,
1084
- ...reply.diagnostics.reasoningLevel ? {
1085
- "gen_ai.request.reasoning.level": reply.diagnostics.reasoningLevel
1086
- } : {},
1087
- ...reply.diagnostics.stopReason ? {
1088
- "gen_ai.response.finish_reasons": [reply.diagnostics.stopReason]
1089
- } : {},
1090
- ...reply.diagnostics.errorMessage && reply.diagnostics.outcome !== "provider_error" ? { "exception.message": reply.diagnostics.errorMessage } : {}
1091
- };
1092
- }
1093
- function finalizeFailedTurnReplyWithEvent(args) {
1094
- if (args.reply.diagnostics.outcome === "success") {
1095
- return { reply: args.reply };
1096
- }
1097
- const capture = getFailureCapture(args.reply);
1098
- const eventId = requireTurnFailureEventId(
1099
- args.logException(capture.error, capture.eventName, {
1100
- ...getAgentTurnDiagnosticsAttributes(args.reply),
1101
- ...args.attributes,
1102
- ...capture.attributes
1103
- }),
1104
- capture.eventName
1105
- );
1106
- const providerPartialText = args.reply.diagnostics.outcome === "provider_error" && args.reply.diagnostics.assistantMessageCount > 0 ? args.reply.text.trim() : "";
1107
- const providerUserMessage = args.reply.diagnostics.providerError instanceof ProviderError ? getProviderErrorUserMessage(args.reply.diagnostics.providerError) : "";
1108
- const failureText = providerUserMessage ? `${providerUserMessage} Reference: \`event_id=${eventId}\`.` : buildTurnFailureResponse(eventId);
1109
- return {
1110
- eventId,
1111
- reply: {
1112
- ...args.reply,
1113
- text: providerPartialText ? `${providerPartialText}${getInterruptionMarker()}` : failureText
1114
- }
1115
- };
1116
- }
1117
-
1118
- // src/chat/runtime/turn-user-message.ts
1119
- function getTurnUserMessage(conversation, sessionId) {
1120
- for (let index = conversation.messages.length - 1; index >= 0; index -= 1) {
1121
- const message = conversation.messages[index];
1122
- if (message?.role !== "user") {
1123
- continue;
1124
- }
1125
- if (buildDeterministicTurnId(message.id) === sessionId) {
1126
- return message;
1127
- }
1128
- }
1129
- return void 0;
1130
- }
1131
- function getTurnUserMessageId(conversation, sessionId) {
1132
- return getTurnUserMessage(conversation, sessionId)?.id;
1133
- }
1134
- function getTurnUserSlackMessageTs(message) {
1135
- return parseSlackMessageTs(message?.meta?.slackTs);
1136
- }
1137
- function getTurnUserReplyAttachmentContext(message) {
1138
- const inboundAttachmentCount = message?.meta?.attachmentCount ?? 0;
1139
- const imageAttachmentCount = message?.meta?.imageAttachmentCount ?? 0;
1140
- const imagesHydrated = message?.meta?.imagesHydrated === true;
1141
- return {
1142
- ...inboundAttachmentCount > 0 ? { inboundAttachmentCount } : {},
1143
- ...!imagesHydrated && imageAttachmentCount > 0 ? { omittedImageAttachmentCount: imageAttachmentCount } : {}
1144
- };
1145
- }
1146
-
1147
- // src/chat/runtime/auth-pause-state.ts
1148
- function completeAuthPauseTurn(args) {
1149
- markConversationMessage(
1150
- args.conversation,
1151
- getTurnUserMessageId(args.conversation, args.sessionId),
1152
- {
1153
- replied: true,
1154
- skippedReason: void 0
1155
- }
1156
- );
1157
- markTurnClosed({
1158
- conversation: args.conversation,
1159
- nowMs: Date.now(),
1160
- sessionId: args.sessionId
1161
- });
1162
- }
1163
- async function persistAuthPauseTurnState(args) {
1164
- const currentState = await getPersistedThreadState(args.threadStateId);
1165
- const conversation = coerceThreadConversationState(currentState);
1166
- await hydrateConversationMessages({
1167
- conversation,
1168
- conversationId: args.threadStateId
1169
- });
1170
- completeAuthPauseTurn({
1171
- conversation,
1172
- sessionId: args.sessionId
1173
- });
1174
- await persistThreadStateById(args.threadStateId, { conversation });
1175
- }
1176
-
1177
996
  export {
1178
997
  recordTaskExecution,
1179
998
  readTaskExecutionSummaries,
@@ -1197,18 +1016,7 @@ export {
1197
1016
  listPendingDispatchMailboxAppends,
1198
1017
  claimDispatchMailboxAppend,
1199
1018
  getPluginDispatchProjection,
1200
- buildDeliveredTurnStatePatch,
1201
- getTurnUserMessage,
1202
- getTurnUserMessageId,
1203
- getTurnUserSlackMessageTs,
1204
- getTurnUserReplyAttachmentContext,
1205
1019
  resolveTurnSessionRouting,
1206
1020
  scheduleSessionCompletedPluginTasks,
1207
- processPluginTask,
1208
- getInterruptionMarker,
1209
- requireTurnFailureEventId,
1210
- getAgentTurnDiagnosticsAttributes,
1211
- finalizeFailedTurnReplyWithEvent,
1212
- completeAuthPauseTurn,
1213
- persistAuthPauseTurnState
1021
+ processPluginTask
1214
1022
  };