@sentry/junior 0.272.0 → 0.274.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 (71) hide show
  1. package/dist/{adapter-BDYDi1F9.js → adapter-4qThDhgF.js} +1 -1
  2. package/dist/{admin-Dj7EFycG.js → admin-c7ASvs6x.js} +1 -1
  3. package/dist/{agent-runner-Cl6Usx2Y.js → agent-runner-CLHM48dh.js} +780 -396
  4. package/dist/api/schema.d.ts +1 -1
  5. package/dist/api/schema.js +5 -5
  6. package/dist/api.d.ts +1 -1
  7. package/dist/api.js +58 -575
  8. package/dist/{app-DjZblE2J.d.ts → app-BlmPpPoR.d.ts} +4 -9
  9. package/dist/app.d.ts +1 -1
  10. package/dist/app.js +673 -127
  11. package/dist/{assistant-reply-DN2w6JL_.js → assistant-reply-2IwdFWuQ.js} +1 -1
  12. package/dist/{automation-CV7g5h3A.js → automation-BGrd03QO.js} +1 -1
  13. package/dist/{briefs-PysAqnjV.js → briefs-C1-NOh8m.js} +4 -4
  14. package/dist/{catalog-runtime-BNeCWIaF.js → catalog-runtime-BnIJimKZ.js} +1 -1
  15. package/dist/cli/chat.js +15 -15
  16. package/dist/cli/check.js +3 -3
  17. package/dist/cli/init.js +1 -1
  18. package/dist/cli/main.js +3 -3
  19. package/dist/cli/plugins.js +4 -4
  20. package/dist/cli/snapshot-create.js +4 -4
  21. package/dist/cli/upgrade.d.ts +1 -1
  22. package/dist/cli/upgrade.js +3 -3
  23. package/dist/{client-FRphcDWW.js → client-C0ZIxoDr.js} +63 -5
  24. package/dist/{reporting-schema-CZREhYc-.js → common-Eu6sx09c.js} +4 -1
  25. package/dist/{config-BUP9wjiR.js → config-DS-QLVSL.js} +6 -14
  26. package/dist/{connections-CesHau9u.js → connections-Djb6ANAh.js} +11 -11
  27. package/dist/{conversation-BtQzLoK8.js → conversation-BjTo9ZFL.js} +11 -1
  28. package/dist/{conversation-privacy-DiGvA9a3.js → conversation-privacy-3IMUZSHC.js} +1 -1
  29. package/dist/{credential-sync-D2odJC30.js → credential-sync-ig88EB_v.js} +15 -16
  30. package/dist/{db-BPLmOwXf.d.ts → db-BMZhoYKj.d.ts} +1 -1
  31. package/dist/{executor-DGDpyegI.js → executor-C2moGIHS.js} +2 -2
  32. package/dist/instrumentation.js +114 -3
  33. package/dist/{job-queue-CjB97sii.js → job-queue-Bh9sFO9t.js} +3 -3
  34. package/dist/{logging-CjkDr-jP.js → logging-DYRS7E8s.js} +14 -2
  35. package/dist/{media-U6Tuz6Mi.js → media-DstkkoNP.js} +21 -2
  36. package/dist/{message-D9y8PKA1.js → message-CicNrhCv.js} +9 -9
  37. package/dist/nitro.d.ts +1 -1
  38. package/dist/nitro.js +3 -3
  39. package/dist/{oauth-callback-server-02Pej6hj.js → oauth-callback-server-BXyrepfY.js} +2 -2
  40. package/dist/{credentialed-CgTulRDH.js → projection-CMRrv9Pt.js} +4595 -51
  41. package/dist/{prompt-vfceH0c-.js → prompt-JEWUUpLW.js} +1 -1
  42. package/dist/{registry-7XgwNgQe.js → registry-D92WLl5I.js} +2 -2
  43. package/dist/{resolve-CuuxNfWG.js → resolve-C-Dh14ps.js} +3 -3
  44. package/dist/{result-BRhb6iN1.js → result-DZ8TCQkd.js} +9 -9
  45. package/dist/{runner-DaWCofuS.js → runner-BBmhrQTM.js} +11 -11
  46. package/dist/{sandbox-egress-signals-Bn6FA1UC.js → sandbox-egress-signals-Cehpq6hC.js} +1 -1
  47. package/dist/{schema-D5VLF4NT.js → schema-CX9XGKCm.js} +18 -9
  48. package/dist/{schema-CNjAzYOw.d.ts → schema-DfdHlBnb.d.ts} +22 -2
  49. package/dist/{service-account-H45LIAG2.js → service-account-Bapo6l0R.js} +3 -3
  50. package/dist/{service-account-D9vrsi8d.js → service-account-Ce1465Fn.js} +3 -3
  51. package/dist/{session-stop-HKl0ECX0.js → session-stop-CI5qJU7a.js} +11 -11
  52. package/dist/{skills-CsiKu3-g.js → skills-D-d79XQ6.js} +2 -2
  53. package/dist/{spawn-DqjBxqWh.js → spawn-C_FETz5x.js} +2 -2
  54. package/dist/{list-JZUP1yog.js → stop-CmwFHwiN.js} +1003 -436
  55. package/dist/{store-DyVKH0QB.js → store-BIQYXvoV.js} +4 -4
  56. package/dist/{store-CPF2kzbu.js → store-BvI3yBGS.js} +3 -3
  57. package/dist/{task-queue-BbQXCcNX.js → task-queue-BdB0pab8.js} +4 -4
  58. package/dist/{task-runner-ChzW5E7R.js → task-runner-DQr2QfvJ.js} +7 -7
  59. package/dist/{thread-state-Ds8JTsX6.js → thread-state-ngCvtWNa.js} +4 -5
  60. package/dist/{turn-failure-response-DCMvjsA0.js → turn-failure-response-BDT3sT2v.js} +7 -8
  61. package/dist/{turn-lifecycle-DM_77q33.js → turn-lifecycle-B7O6rZEX.js} +1 -1
  62. package/dist/turn-session-routing-DIeqG2pO.js +1625 -0
  63. package/dist/{validation-DcGelbBi.js → validation-D3Xik64v.js} +1 -1
  64. package/dist/{version-C48azPKq.js → version-BoWLhNzj.js} +1 -1
  65. package/dist/version.js +1 -1
  66. package/dist/{viewer-BCRuO8Wg.js → viewer-D25XOUHc.js} +41 -20
  67. package/dist/{work-zxkmbJAp.js → work-D12-wcf4.js} +11 -39
  68. package/dist/{worker-CNNxHF1V.js → worker-DGxfDtES.js} +6 -6
  69. package/package.json +4 -4
  70. package/dist/turn-session-routing-BV_gX7n3.js +0 -6072
  71. package/dist/{oauth-relay-CTygMkNx.js → oauth-relay-C6ZAyJgf.js} +1 -1
@@ -1,5 +1,5 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-nwUcYXjP.js";
2
- import { n as pluginCatalogRuntime } from "./catalog-runtime-BNeCWIaF.js";
2
+ import { n as pluginCatalogRuntime } from "./catalog-runtime-BnIJimKZ.js";
3
3
  import { isDeepStrictEqual } from "node:util";
4
4
  // src/chat/plugins/validation.ts
5
5
  var validation_exports = /* @__PURE__ */ __exportAll({
@@ -1,5 +1,5 @@
1
1
  // package.json
2
- var version = "0.272.0";
2
+ var version = "0.274.0";
3
3
  // src/version.ts
4
4
  /** Installed Junior package version, or `unknown` when package metadata is unavailable. */
5
5
  const JUNIOR_VERSION = typeof version === "string" && version.trim() ? version : "unknown";
package/dist/version.js CHANGED
@@ -1 +1 @@
1
- export { t as JUNIOR_VERSION } from "./version-C48azPKq.js";
1
+ export { t as JUNIOR_VERSION } from "./version-BoWLhNzj.js";
@@ -1,10 +1,10 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-nwUcYXjP.js";
2
- import { i as getChatConfig } from "./config-BUP9wjiR.js";
3
- import { L as GOOGLE_IDENTITY_PROVIDER, h as logWarn, z as normalizeIdentityEmail } from "./logging-CjkDr-jP.js";
2
+ import { i as getChatConfig } from "./config-DS-QLVSL.js";
3
+ import { B as normalizeIdentityEmail, R as GOOGLE_IDENTITY_PROVIDER, h as logWarn } from "./logging-DYRS7E8s.js";
4
4
  import { a as isSlackUserId, d as parseSlackChannelReferenceId, f as parseSlackTeamId, s as parseActorUserId } from "./actor-B4DYygOB.js";
5
5
  import { c as juniorIdentities, d as juniorDestinations, l as juniorUsers, o as conversationReadColumns, s as juniorConversations } from "./agent-invocations-C1RNOCs8.js";
6
- import { S as juniorConversationAnnotations, b as juniorConversationEvents, g as juniorConversationBindings, h as juniorConversationParticipants, t as createJuniorSqlExecutor, v as CONVERSATION_METRICS, y as juniorConversationMetrics } from "./executor-DGDpyegI.js";
7
- import { d as newConversationEventSchema, f as encodeHistoryPayload, l as decodeStoredConversationEvent, n as detectImageMediaType, o as conversationEventDataSchema, u as historyReplacementSchema, v as usageSchema } from "./media-U6Tuz6Mi.js";
6
+ import { S as juniorConversationAnnotations, b as juniorConversationEvents, g as juniorConversationBindings, h as juniorConversationParticipants, t as createJuniorSqlExecutor, v as CONVERSATION_METRICS, y as juniorConversationMetrics } from "./executor-C2moGIHS.js";
7
+ import { d as newConversationEventSchema, f as encodeHistoryPayload, l as decodeStoredConversationEvent, n as detectImageMediaType, o as conversationEventDataSchema, u as historyReplacementSchema, v as usageSchema } from "./media-DstkkoNP.js";
8
8
  import { a as withLock } from "./locks-D-0h111u.js";
9
9
  import { createHash, randomUUID } from "node:crypto";
10
10
  import { and, asc, desc, eq, gt, gte, inArray, isNotNull, isNull, lt, lte, ne, or, sql } from "drizzle-orm";
@@ -1436,13 +1436,22 @@ var SqlConversationEventStore = class {
1436
1436
  });
1437
1437
  }
1438
1438
  }
1439
- async replaceHistory(conversationId, replacement) {
1439
+ async replaceHistory(conversationId, replacement, options = {}) {
1440
1440
  const parsed = historyReplacementSchema.parse(replacement);
1441
- await withConversationEventLock(this.executor, conversationId, async () => {
1442
- await ensureConversationRow(this.executor, conversationId, Date.now());
1441
+ return withConversationEventLock(this.executor, conversationId, async () => {
1443
1442
  const cursor = await this.readCursor(conversationId);
1444
- const historyVersion = (cursor.maxHistoryVersion ?? 0) + 1;
1443
+ const currentHistoryVersion = cursor.maxHistoryVersion ?? 0;
1444
+ if (options.expectedHistoryVersion !== void 0 && options.expectedHistoryVersion !== currentHistoryVersion) return {
1445
+ status: "conflict",
1446
+ historyVersion: currentHistoryVersion
1447
+ };
1448
+ await ensureConversationRow(this.executor, conversationId, Date.now());
1449
+ const historyVersion = currentHistoryVersion + 1;
1445
1450
  await this.executor.db().insert(juniorConversationEvents).values(insertFromEvent(conversationId, cursor.nextSeq, historyVersion, parsed));
1451
+ return {
1452
+ status: "replaced",
1453
+ historyVersion
1454
+ };
1446
1455
  });
1447
1456
  }
1448
1457
  async loadCurrentHistoryVersion(conversationId) {
@@ -1743,8 +1752,14 @@ function parseAvatarUrl(value, provider) {
1743
1752
  const host = url.hostname.toLowerCase();
1744
1753
  return hosts.some((allowed) => host === allowed || host.endsWith(`.${allowed}`)) ? url.href : void 0;
1745
1754
  }
1746
- function avatarPath(identityId) {
1747
- return `/api/people/avatars/${encodeURIComponent(identityId)}`;
1755
+ function avatarUrlHash(url) {
1756
+ return createHash("sha256").update(url).digest("hex");
1757
+ }
1758
+ function avatarVersion(url) {
1759
+ return avatarUrlHash(url).slice(0, 16);
1760
+ }
1761
+ function avatarPath(identityId, avatarUrl) {
1762
+ return `/api/people/avatars/${encodeURIComponent(identityId)}?v=${avatarVersion(avatarUrl)}`;
1748
1763
  }
1749
1764
  /**
1750
1765
  * Read the photo path of each user: the Slack photo, then the Google photo.
@@ -1753,6 +1768,7 @@ function avatarPath(identityId) {
1753
1768
  async function readUserAvatarUrls(db, userIds) {
1754
1769
  if (userIds.length === 0) return /* @__PURE__ */ new Map();
1755
1770
  const rows = await db.select({
1771
+ avatarUrl: juniorIdentities.avatarUrl,
1756
1772
  identityId: juniorIdentities.id,
1757
1773
  provider: juniorIdentities.provider,
1758
1774
  updatedAt: juniorIdentities.updatedAt,
@@ -1761,7 +1777,7 @@ async function readUserAvatarUrls(db, userIds) {
1761
1777
  const rank = (row) => AVATAR_PROVIDERS.indexOf(row.provider);
1762
1778
  rows.sort((left, right) => rank(left) - rank(right) || right.updatedAt.getTime() - left.updatedAt.getTime());
1763
1779
  const avatars = /* @__PURE__ */ new Map();
1764
- for (const row of rows) if (row.userId && !avatars.has(row.userId)) avatars.set(row.userId, avatarPath(row.identityId));
1780
+ for (const row of rows) if (row.userId && row.avatarUrl && !avatars.has(row.userId)) avatars.set(row.userId, avatarPath(row.identityId, row.avatarUrl));
1765
1781
  return avatars;
1766
1782
  }
1767
1783
  /**
@@ -1770,7 +1786,7 @@ async function readUserAvatarUrls(db, userIds) {
1770
1786
  */
1771
1787
  function identityAvatarUrl(row, userAvatarUrls) {
1772
1788
  if (row.userId) return userAvatarUrls.get(row.userId);
1773
- return row.avatarUrl ? avatarPath(row.identityId) : void 0;
1789
+ return row.avatarUrl ? avatarPath(row.identityId, row.avatarUrl) : void 0;
1774
1790
  }
1775
1791
  async function readBoundedBody(response, maxBytes) {
1776
1792
  if (!response.body) return /* @__PURE__ */ new Uint8Array();
@@ -1834,9 +1850,10 @@ async function fetchAvatarImage(url, provider) {
1834
1850
  };
1835
1851
  }
1836
1852
  /**
1837
- * Read the saved photo of one Identity. Junior fetches it from the provider
1838
- * once and keeps it in the state cache for a day. Return undefined when the
1839
- * Identity has no photo or the provider does not return one.
1853
+ * Read the saved photo of one Identity and its version. Junior fetches it
1854
+ * from the provider once and keeps it in the state cache for a day. Return
1855
+ * undefined when the Identity has no photo or the provider does not return
1856
+ * one.
1840
1857
  */
1841
1858
  async function readAvatarImage(db, state, identityId) {
1842
1859
  const [row] = await db.select({
@@ -1844,15 +1861,19 @@ async function readAvatarImage(db, state, identityId) {
1844
1861
  provider: juniorIdentities.provider
1845
1862
  }).from(juniorIdentities).where(and(eq(juniorIdentities.id, identityId), eq(juniorIdentities.kind, "user"))).limit(1);
1846
1863
  const url = row ? parseAvatarUrl(row.avatarUrl, row.provider) : void 0;
1847
- if (!row || !url) return void 0;
1848
- const key = `avatar:${createHash("sha256").update(url).digest("hex")}`;
1849
- return await createCache(state, "core").getOrLoad(key, async () => {
1864
+ if (!row?.avatarUrl || !url) return void 0;
1865
+ const key = `avatar:${avatarUrlHash(url)}`;
1866
+ const image = await createCache(state, "core").getOrLoad(key, async () => {
1850
1867
  const loaded = await fetchAvatarImage(url, row.provider);
1851
1868
  return {
1852
1869
  value: loaded,
1853
1870
  ttlMs: loaded ? AVATAR_CACHE_TTL_MS : AVATAR_FAILURE_TTL_MS
1854
1871
  };
1855
- }) ?? void 0;
1872
+ });
1873
+ return image ? {
1874
+ image,
1875
+ version: avatarVersion(row.avatarUrl)
1876
+ } : void 0;
1856
1877
  }
1857
1878
  // src/chat/plugins/viewer.ts
1858
1879
  function identityFromRow(row) {
@@ -1966,4 +1987,4 @@ async function readIdentityByIdFromSql(db, identityId) {
1966
1987
  async function readIdentityById(identityId) {
1967
1988
  return await readIdentityByIdFromSql(getDb(), identityId);
1968
1989
  }
1969
- export { startLocationThread as A, upsertLinkedIdentity as B, getSqlExecutor as C, createSqlStore as D, loadConversationSlackTenantIds as E, deleteProviderIdentityForUser as F, agentTurnTotalTokens as G, parseSessionSource as H, findUserByVerifiedEmails as I, resolveRootConversationId as J, agentTurnUsageSchema as K, readUserTimezone as L, resolveActorIdentityId as M, saveActorAvatar as N, withConversationMutationLock as O, deleteProviderIdentityForSlackUser as P, sameDestination as Q, recordGoogleSignIn as R, getDb as S, withConversationEventLock as T, addAgentTurnUsage as U, bindProviderConversation as V, agentTurnCostUsd as W, parseDestination as X, createSlackDestination as Y, requireSlackDestination as Z, closeDb as _, readActorIdentityFromSql as a, getConversationMessageSearchStore as b, readViewerAvatarUrl as c, updateViewerDisplayName as d, identityAvatarUrl as f, createCache as g, readUserAvatarUrls as h, readActorIdentity as i, SYSTEM_IDENTITY_ID as j, locationFromRow as k, resolveViewerUser as l, readAvatarImage as m, findUserByEmailFromSql as n, readIdentityById as o, parseAvatarUrl as p, hasAgentTurnUsage as q, listAdminUsersFromSql as r, readIdentityByIdFromSql as s, findUserByEmail as t, setUserAdminFromSql as u, db_exports as v, createSqlConversationEventStore as w, getConversationStore as x, getConversationEventStore as y, saveUserTimezone as z };
1990
+ export { sameDestination as $, locationFromRow as A, saveUserTimezone as B, getSqlExecutor as C, loadConversationSlackTenantIds as D, withConversationEventLock as E, deleteProviderIdentityForSlackUser as F, agentTurnCostUsd as G, bindProviderConversation as H, deleteProviderIdentityForUser as I, hasAgentTurnUsage as J, agentTurnTotalTokens as K, findUserByVerifiedEmails as L, SYSTEM_IDENTITY_ID as M, resolveActorIdentityId as N, createSqlStore as O, saveActorAvatar as P, requireSlackDestination as Q, readUserTimezone as R, getDb as S, eventFromRow as T, parseSessionSource as U, upsertLinkedIdentity as V, addAgentTurnUsage as W, createSlackDestination as X, resolveRootConversationId as Y, parseDestination as Z, closeDb as _, readActorIdentityFromSql as a, getConversationMessageSearchStore as b, readViewerAvatarUrl as c, updateViewerDisplayName as d, identityAvatarUrl as f, createCache as g, readUserAvatarUrls as h, readActorIdentity as i, startLocationThread as j, withConversationMutationLock as k, resolveViewerUser as l, readAvatarImage as m, findUserByEmailFromSql as n, readIdentityById as o, parseAvatarUrl as p, agentTurnUsageSchema as q, listAdminUsersFromSql as r, readIdentityByIdFromSql as s, findUserByEmail as t, setUserAdminFromSql as u, db_exports as v, createSqlConversationEventStore as w, getConversationStore as x, getConversationEventStore as y, recordGoogleSignIn as z };
@@ -1,14 +1,14 @@
1
- import { Dn as failTurnRecord, Nt as openConversationProjection, On as getTurnRecord, Tn as abandonTurnRecord, dn as PluginCredentialFailureError, hn as AuthorizationFlowDisabledError, mr as isTurnExecutionLimitExceededError, wn as saveTurnCheckpoint, yr as getTerminalAssistantMessages } from "./turn-session-routing-BV_gX7n3.js";
2
- import { n as botConfig } from "./config-BUP9wjiR.js";
3
- import { j as SYSTEM_IDENTITY_ID, x as getConversationStore, y as getConversationEventStore } from "./viewer-BCRuO8Wg.js";
4
- import { _ as sameActorIdentity, p as agentInstructionProvenance } from "./media-U6Tuz6Mi.js";
5
- import { Dt as buildSteeringPiMessage, Ot as withoutSavedSteeringMessages, Pt as readBlockedReport, _t as stopChildAgentsOf, bt as recordSubagentStarted, yt as recordSubagentEnded } from "./agent-runner-Cl6Usx2Y.js";
6
- import { B as agentTypeStartsWithParentHistory, E as markAgentInvocationSteered, J as isTurnInputCommitLostError, K as getConversationTurnBoundaryError, O as reportReplacedAgentInvocation, S as markAgentInvocationMailboxAppended, T as markAgentInvocationRunning, W as TurnInputCommitLostError, d as getAgentInvocationMessageId, g as getLatestAgentInvocationForConversation, n as completeAgentInvocation, o as getActiveAgentInvocationForConversation, p as getAgentInvocationTurnId, r as createAgentInvocation, s as getAgentInvocation, v as isTerminalAgentInvocation, w as markAgentInvocationPaused, y as listActiveAgentInvocationsForConversation, z as agentTypeInstructions } from "./store-DyVKH0QB.js";
7
- import { n as getAssistantReplyText } from "./assistant-reply-DN2w6JL_.js";
8
- import { A as recordFinishedTurnForAutomatedLimit, j as resetAutomatedTurnLimit, w as maybePostAutomatedTurnLimitNotice } from "./session-stop-HKl0ECX0.js";
9
- import { r as appendAndEnqueueInboundMessage } from "./store-CPF2kzbu.js";
10
- import { t as ConversationTurnLifecycleService } from "./turn-lifecycle-DM_77q33.js";
11
- import { a as persistThreadStateById, n as getPersistedSandboxState, r as getPersistedThreadState } from "./thread-state-Ds8JTsX6.js";
1
+ import { G as AuthorizationFlowDisabledError, La as loadForkHistory, V as PluginCredentialFailureError, Wt as isTurnExecutionLimitExceededError, Yt as getTerminalAssistantMessages, et as saveTurnCheckpoint, it as getTurnRecord, l as openConversationProjection, rt as failTurnRecord, tt as abandonTurnRecord } from "./projection-CMRrv9Pt.js";
2
+ import { n as botConfig } from "./config-DS-QLVSL.js";
3
+ import { M as SYSTEM_IDENTITY_ID, x as getConversationStore, y as getConversationEventStore } from "./viewer-D25XOUHc.js";
4
+ import { _ as sameActorIdentity, p as agentInstructionProvenance } from "./media-DstkkoNP.js";
5
+ import { Ft as readBlockedReport, Ot as buildSteeringPiMessage, bt as recordSubagentEnded, kt as withoutSavedSteeringMessages, vt as stopChildAgentsOf, xt as recordSubagentStarted } from "./agent-runner-CLHM48dh.js";
6
+ import { B as agentTypeStartsWithParentHistory, E as markAgentInvocationSteered, J as isTurnInputCommitLostError, K as getConversationTurnBoundaryError, O as reportReplacedAgentInvocation, S as markAgentInvocationMailboxAppended, T as markAgentInvocationRunning, W as TurnInputCommitLostError, d as getAgentInvocationMessageId, g as getLatestAgentInvocationForConversation, n as completeAgentInvocation, o as getActiveAgentInvocationForConversation, p as getAgentInvocationTurnId, r as createAgentInvocation, s as getAgentInvocation, v as isTerminalAgentInvocation, w as markAgentInvocationPaused, y as listActiveAgentInvocationsForConversation, z as agentTypeInstructions } from "./store-BIQYXvoV.js";
7
+ import { n as getAssistantReplyText } from "./assistant-reply-2IwdFWuQ.js";
8
+ import { A as recordFinishedTurnForAutomatedLimit, j as resetAutomatedTurnLimit, w as maybePostAutomatedTurnLimitNotice } from "./session-stop-CI5qJU7a.js";
9
+ import { r as appendAndEnqueueInboundMessage } from "./store-BvI3yBGS.js";
10
+ import { t as ConversationTurnLifecycleService } from "./turn-lifecycle-B7O6rZEX.js";
11
+ import { a as persistThreadStateById, n as getPersistedSandboxState, r as getPersistedThreadState } from "./thread-state-ngCvtWNa.js";
12
12
  import { isDeepStrictEqual } from "node:util";
13
13
  import { z } from "zod";
14
14
  // src/chat/runtime/turn-execution.ts
@@ -56,34 +56,6 @@ async function finishTurn(conversationId, turnId, saved) {
56
56
  outcome: saved.outcome
57
57
  });
58
58
  }
59
- // src/chat/agent-invocations/fork-history.ts
60
- /**
61
- * Cut parent history for a fork: everything before the parent's message that
62
- * started the fork, through the last point where every tool call has its
63
- * result. A model request with an unanswered tool call fails, and the parent
64
- * can commit its history in the middle of a tool round.
65
- */
66
- function forkHistoryFrom(messages, parentToolCallId) {
67
- const spawnIndex = parentToolCallId ? messages.findIndex((message) => message.role === "assistant" && message.content.some((part) => part.type === "toolCall" && part.id === parentToolCallId)) : -1;
68
- const before = spawnIndex >= 0 ? messages.slice(0, spawnIndex) : messages;
69
- const pending = /* @__PURE__ */ new Set();
70
- let end = 0;
71
- for (const [index, message] of before.entries()) {
72
- if (message.role === "assistant") {
73
- for (const part of message.content) if (part.type === "toolCall") pending.add(part.id);
74
- } else if (message.role === "toolResult") pending.delete(message.toolCallId);
75
- if (pending.size === 0) end = index + 1;
76
- }
77
- return before.slice(0, end);
78
- }
79
- /**
80
- * Load the start history of a fork child from its parent Conversation. The
81
- * child commits it as its own history in its first checkpoint, so later
82
- * agent invocations of the child read it from the child Conversation.
83
- */
84
- async function loadForkHistory(invocation) {
85
- return forkHistoryFrom((await openConversationProjection({ conversationId: invocation.parentConversationId })).messages, invocation.parentToolCallId);
86
- }
87
59
  // src/chat/agent-invocations/work.ts
88
60
  const agentInvocationMailboxMetadataSchema = z.object({
89
61
  agentInvocationId: z.string().min(1),
@@ -1,10 +1,10 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-nwUcYXjP.js";
2
- import { Xn as isInvalidConversationRecordError, Yn as isFinalAttempt, qn as hasConversationStop } from "./turn-session-routing-BV_gX7n3.js";
3
- import { y as isProviderRetryError } from "./client-FRphcDWW.js";
4
- import { i as getChatConfig } from "./config-BUP9wjiR.js";
5
- import { T as withLogContext, b as setSpanAttributes, h as logWarn, m as logInfo, p as logException } from "./logging-CjkDr-jP.js";
6
- import { f as getTurnRequestDeadline, m as ConversationQueueMessageRejectedError } from "./job-queue-CjB97sii.js";
7
- import { C as requestAnotherSlice, T as startConversationWork, b as recordConversationRetry, d as countPendingConversationMessages, f as deadLetterAttempt, g as getConversationWorkState, i as beginConversationResume, l as completeConversationStop, m as ensureConversationWake, o as checkInConversationWork, p as drainConversationMailbox, s as clearConsumedConversationWake, t as ackMessages, u as completeConversationWork, x as releaseConversationWork, y as recordAttemptFailure } from "./store-CPF2kzbu.js";
2
+ import { Ct as hasConversationStop, Et as isInvalidConversationRecordError, Tt as isFinalAttempt } from "./projection-CMRrv9Pt.js";
3
+ import { b as isProviderRetryError } from "./client-C0ZIxoDr.js";
4
+ import { i as getChatConfig } from "./config-DS-QLVSL.js";
5
+ import { T as withLogContext, b as setSpanAttributes, h as logWarn, m as logInfo, p as logException } from "./logging-DYRS7E8s.js";
6
+ import { f as getTurnRequestDeadline, m as ConversationQueueMessageRejectedError } from "./job-queue-Bh9sFO9t.js";
7
+ import { C as requestAnotherSlice, T as startConversationWork, b as recordConversationRetry, d as countPendingConversationMessages, f as deadLetterAttempt, g as getConversationWorkState, i as beginConversationResume, l as completeConversationStop, m as ensureConversationWake, o as checkInConversationWork, p as drainConversationMailbox, s as clearConsumedConversationWake, t as ackMessages, u as completeConversationWork, x as releaseConversationWork, y as recordAttemptFailure } from "./store-BvI3yBGS.js";
8
8
  // src/chat/task-execution/attempt-selection.ts
9
9
  function selectContiguousTurnBatch(messages) {
10
10
  const first = messages[0];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sentry/junior",
3
- "version": "0.272.0",
3
+ "version": "0.274.0",
4
4
  "private": false,
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -91,7 +91,7 @@
91
91
  "sharp": "^0.35.3",
92
92
  "yaml": "^2.9.0",
93
93
  "zod": "^4.5.4",
94
- "@sentry/junior-plugin-api": "0.272.0"
94
+ "@sentry/junior-plugin-api": "0.274.0"
95
95
  },
96
96
  "peerDependencies": {
97
97
  "bullmq": "^6.5.0",
@@ -126,9 +126,9 @@
126
126
  "typescript": "^7.0.2",
127
127
  "vercel": "^54.4.0",
128
128
  "vitest": "^4.1.12",
129
- "@sentry/junior-github": "0.272.0",
129
+ "@sentry/junior-github": "0.274.0",
130
130
  "@sentry/junior-testing": "0.0.0",
131
- "@sentry/junior-memory": "0.272.0"
131
+ "@sentry/junior-memory": "0.274.0"
132
132
  },
133
133
  "scripts": {
134
134
  "build": "tsdown",