@sentry/junior 0.257.0 → 0.258.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (101) hide show
  1. package/dist/{actor-BTtLaeWy.js → actor-tlxzqaRe.js} +3 -6
  2. package/dist/{admin-DgIkm6Vy.js → admin-My1SLGVO.js} +2 -3
  3. package/dist/{agent-hooks-BjtTzvru.js → agent-hooks-BJ_5mlRH.js} +69 -109
  4. package/dist/{agent-invocations-Bdu3ROfo.js → agent-invocations-Qfz7dWgU.js} +6 -12
  5. package/dist/{agent-runner-D7OboVb3.js → agent-runner-DGsFQw72.js} +261 -458
  6. package/dist/api/schema.d.ts +414 -448
  7. package/dist/api/schema.js +5 -5
  8. package/dist/api.d.ts +2 -12
  9. package/dist/api.js +94 -158
  10. package/dist/{app-BsU5QNBd.d.ts → app-PX2H1PxU.d.ts} +21 -44
  11. package/dist/app.d.ts +3 -3
  12. package/dist/app.js +204 -321
  13. package/dist/{assistant-reply-CbTPebzL.js → assistant-reply-H1M-91oF.js} +3 -5
  14. package/dist/{automation-CHdlHVZP.js → automation-DWBFBenG.js} +6 -11
  15. package/dist/{briefs-oLOldnDM.js → briefs-vYoK85rJ.js} +8 -11
  16. package/dist/{cadence-D00SCzT1.js → cadence-R7Em4RjE.js} +1 -2
  17. package/dist/{catalog-runtime-CZzhGQ7F.js → catalog-runtime-BN4DVxco.js} +3 -4
  18. package/dist/cli/chat.d.ts +2 -4
  19. package/dist/cli/chat.js +22 -24
  20. package/dist/cli/check.d.ts +1 -3
  21. package/dist/cli/check.js +4 -5
  22. package/dist/cli/env.d.ts +1 -3
  23. package/dist/cli/env.js +1 -2
  24. package/dist/cli/init.d.ts +1 -3
  25. package/dist/cli/init.js +3 -3
  26. package/dist/cli/main.d.ts +1 -3
  27. package/dist/cli/main.js +4 -5
  28. package/dist/cli/plugins.d.ts +2 -4
  29. package/dist/cli/plugins.js +7 -8
  30. package/dist/cli/run.d.ts +1 -2
  31. package/dist/cli/run.js +1 -2
  32. package/dist/cli/snapshot-create.d.ts +1 -3
  33. package/dist/cli/snapshot-create.js +4 -5
  34. package/dist/cli/upgrade.d.ts +3 -6
  35. package/dist/cli/upgrade.js +11 -17
  36. package/dist/{client-D8HnkOQX.js → client-DbyHuMFU.js} +9 -16
  37. package/dist/{config-CJRnWK9H.js → config-_WO_AjCB.js} +18 -15
  38. package/dist/{connections-ClYrKzpX.js → connections-ag_1JOhB.js} +14 -19
  39. package/dist/{conversation-CKNLYBJt.js → conversation-DjN3mlog.js} +8 -15
  40. package/dist/{conversation-privacy-C8b1nphZ.js → conversation-privacy-DHP_xnVj.js} +2 -3
  41. package/dist/{conversation-work-C6y3T5Hx.js → conversation-work-BaT_T6EB.js} +1 -2
  42. package/dist/{credential-sync-BXfohNmJ.js → credential-sync-B-CPX_ag.js} +23 -28
  43. package/dist/{db-Ca9Nt5ci.d.ts → db-BnRqQ7G5.d.ts} +1 -1
  44. package/dist/{executor-Do0THDRR.js → executor-RvG6kVe1.js} +30 -52
  45. package/dist/{experimental-CQIvMUO7.js → experimental-BNK1l1jv.js} +2 -4
  46. package/dist/{history-9pO1Zd4Y.js → history-AY8rs-FR.js} +5 -9
  47. package/dist/{history-DvqWZlYX.d.ts → history-BgI33Kie.d.ts} +12 -20
  48. package/dist/{images-BN_BiBXF.js → images-C2J_bj2g.js} +5 -6
  49. package/dist/instrumentation.d.ts +1 -3
  50. package/dist/instrumentation.js +6 -8
  51. package/dist/{job-queue-B6SV9uVa.js → job-queue-DVe37it2.js} +6 -12
  52. package/dist/{logging-CWxiIuCF.js → logging-DsHONhVm.js} +7 -12
  53. package/dist/{message-TUOdbSBW.js → message-DyitL8no.js} +5 -6
  54. package/dist/{model-profile-BwU8mqwD.js → model-profile-Bg8EoCKD.js} +2 -4
  55. package/dist/nitro.d.ts +3 -5
  56. package/dist/nitro.js +12 -17
  57. package/dist/{oauth-authorization-BA4Dt6a7.js → oauth-authorization-djQn5Nhy.js} +2 -4
  58. package/dist/{oauth-callback-server-Dj5UJODo.js → oauth-callback-server-CDby-pCn.js} +3 -4
  59. package/dist/{oauth-relay-CdCnu80W.js → oauth-relay-CTygMkNx.js} +2 -3
  60. package/dist/{package-discovery-BVvSnQBB.js → package-discovery-DJBompdd.js} +17 -21
  61. package/dist/{pending-auth-s_QFribU.js → pending-auth-D8J1uJUS.js} +37 -28
  62. package/dist/{plugin-module-CVvEUSMH.js → plugin-module-Cf5gVPWP.js} +1 -2
  63. package/dist/{plugins-CjfUP5gJ.d.ts → plugins-B11Mfkmv.d.ts} +0 -4
  64. package/dist/{plugins-egKWjgue.js → plugins-DOm9Y6qI.js} +2 -3
  65. package/dist/{private-trace-result-BLvBjy_e.js → private-trace-result-CE7_lEdq.js} +1 -2
  66. package/dist/{profile-h-72wM78.js → profile-DpYjfKke.js} +16 -28
  67. package/dist/{prompt-DyoEj9c2.js → prompt-xgpyMtg7.js} +5 -9
  68. package/dist/{queue-B5SnqRln.d.ts → queue-C37RbDVc.d.ts} +0 -2
  69. package/dist/{registry-sLTr-sV9.js → registry-Du566MtJ.js} +16 -29
  70. package/dist/{resolve-ncQPZROQ.js → resolve-ClCIgh8E.js} +7 -12
  71. package/dist/{result-C883vngT.js → result-BBbKA61B.js} +13 -17
  72. package/dist/{rolldown-runtime-B4FMCO8f.js → rolldown-runtime-nwUcYXjP.js} +1 -2
  73. package/dist/{runner-CzYImdOF.js → runner-CCuqFSqx.js} +12 -13
  74. package/dist/{sandbox-egress-signals-CZbMINHI.js → sandbox-egress-signals-DY1mbKF4.js} +2 -3
  75. package/dist/{schema-Dy69D4Ge.js → schema-DrMh3NtR.js} +15 -26
  76. package/dist/{sentry-CgWZM_kV.js → sentry-BBUlHih9.js} +2 -3
  77. package/dist/{session-stop-CQjKd4a2.js → session-stop-CIoFiwwe.js} +23 -33
  78. package/dist/{skills-C22SLruK.js → skills-DyQBLIrK.js} +9 -9
  79. package/dist/{spawn-DY9CLXDL.js → spawn-Dqfeo7XP.js} +4 -5
  80. package/dist/{store-DoewL5mG.d.ts → store-CG0VJyye.d.ts} +0 -14
  81. package/dist/{store-DXFIQy-G.js → store-DJLwq4x8.js} +13 -15
  82. package/dist/{task-queue-B17vV0La.js → task-queue-BzW4MaWU.js} +5 -7
  83. package/dist/{task-runner-DUjvzYXj.js → task-runner-D3qJh4fK.js} +22 -26
  84. package/dist/{tasks-D_WIJtvO.js → tasks-CEXKTASS.js} +62 -78
  85. package/dist/{thread-state-Ch4yuCqG.js → thread-state-W3f6kAtz.js} +13 -19
  86. package/dist/{turn-failure-response-C5nBKC4S.js → turn-failure-response-CWx7aNIh.js} +16 -22
  87. package/dist/{turn-lifecycle-CO-ylUmV.js → turn-lifecycle-C9JFst7-.js} +2 -3
  88. package/dist/{turn-session-routing-B3LWooK5.js → turn-session-routing-CUxtfpr7.js} +2 -3
  89. package/dist/{validation-CXYxaNYx.js → validation-BHRxa5G4.js} +3 -4
  90. package/dist/vercel.d.ts +1 -3
  91. package/dist/vercel.js +1 -2
  92. package/dist/{version-BcdZy2zg.js → version-C0U6rHg0.js} +3 -5
  93. package/dist/{version-CnXZ614E.d.ts → version-Cc2OFd9G.d.ts} +0 -2
  94. package/dist/version.d.ts +1 -1
  95. package/dist/version.js +1 -2
  96. package/dist/{viewer-DSZXygMU.js → viewer-CGvvRqKp.js} +26 -57
  97. package/dist/{web-input-B9Bv0_lR.js → web-input-Keb5GRWj.js} +98 -155
  98. package/dist/{web-message-id-xPI_EFSC.js → web-message-id-CJSUiksE.js} +3 -6
  99. package/dist/{work-nAfDSUFP.js → work-DRcsJ3hV.js} +14 -16
  100. package/dist/{worker-vGXZ6XFT.js → worker-Cjo-QqPq.js} +7 -8
  101. package/package.json +7 -6
@@ -1,12 +1,12 @@
1
- import { t as __exportAll } from "./rolldown-runtime-B4FMCO8f.js";
2
- import { m as logWarn } from "./logging-CWxiIuCF.js";
3
- import { s as skillRoots } from "./package-discovery-BVvSnQBB.js";
4
- import { n as pluginCatalogRuntime } from "./catalog-runtime-CZzhGQ7F.js";
1
+ import { t as __exportAll } from "./rolldown-runtime-nwUcYXjP.js";
2
+ import { m as logWarn } from "./logging-DsHONhVm.js";
3
+ import { s as skillRoots } from "./package-discovery-DJBompdd.js";
4
+ import { n as pluginCatalogRuntime } from "./catalog-runtime-BN4DVxco.js";
5
5
  import path from "node:path";
6
6
  import { z } from "zod";
7
7
  import fs from "node:fs/promises";
8
8
  import { parse } from "yaml";
9
- //#region src/chat/skills.ts
9
+ // src/chat/skills.ts
10
10
  var skills_exports = /* @__PURE__ */ __exportAll({
11
11
  discoverSkills: () => discoverSkills,
12
12
  findSkillByName: () => findSkillByName,
@@ -82,7 +82,7 @@ function stripFrontmatter(raw) {
82
82
  /** Parse a SKILL.md file's frontmatter and body. */
83
83
  function parseSkillFile(raw, expectedName) {
84
84
  const match = FRONTMATTER_RE.exec(raw);
85
- if (!match) return {
85
+ if (match?.[1] === void 0) return {
86
86
  ok: false,
87
87
  error: "Missing YAML frontmatter at start of file"
88
88
  };
@@ -263,13 +263,14 @@ function parseSkillInvocation(messageText, availableSkills) {
263
263
  const trimmed = messageText.trim();
264
264
  const escapePattern = (value) => value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
265
265
  const slashMatch = /(?:^|\s)\/([a-z0-9]+(?:-[a-z0-9]+)*)/i.exec(trimmed);
266
- if (slashMatch) {
266
+ if (slashMatch?.[1]) {
267
267
  const skillName = slashMatch[1].toLowerCase();
268
268
  if (!availableSkills.some((skill) => skill.name === skillName)) return null;
269
269
  return { skillName };
270
270
  }
271
271
  for (const match of trimmed.matchAll(/(?:^|\s)\$([a-z0-9]+(?:-[a-z0-9]+)*)/gi)) {
272
- const skillName = match[1].toLowerCase();
272
+ const skillName = match[1]?.toLowerCase();
273
+ if (!skillName) continue;
273
274
  if (isCommonEnvironmentVariable(skillName)) continue;
274
275
  if (availableSkills.some((skill) => skill.name === skillName)) return { skillName };
275
276
  }
@@ -312,5 +313,4 @@ async function loadSkillsByName(skillNames, available) {
312
313
  }
313
314
  return skills;
314
315
  }
315
- //#endregion
316
316
  export { parseSkillInvocation as a, parseSkillFile as i, findSkillByName as n, skills_exports as o, loadSkillsByName as r, discoverSkills as t };
@@ -1,7 +1,7 @@
1
- import { t as __exportAll } from "./rolldown-runtime-B4FMCO8f.js";
2
- import { Ht as actorFromRun, Ut as toolInvocationDestination } from "./agent-runner-D7OboVb3.js";
3
- import { n as createAndEnqueueAgentInvocation } from "./work-nAfDSUFP.js";
4
- //#region src/chat/agent-invocations/spawn.ts
1
+ import { t as __exportAll } from "./rolldown-runtime-nwUcYXjP.js";
2
+ import { Ht as toolInvocationDestination, Vt as actorFromRun } from "./agent-runner-DGsFQw72.js";
3
+ import { n as createAndEnqueueAgentInvocation } from "./work-DRcsJ3hV.js";
4
+ // src/chat/agent-invocations/spawn.ts
5
5
  var spawn_exports = /* @__PURE__ */ __exportAll({ bindSpawnAgent: () => bindSpawnAgent });
6
6
  /** Bind a Run's Actor and credentials to new Agent invocations. */
7
7
  function bindSpawnAgent(run, options) {
@@ -28,5 +28,4 @@ function bindSpawnAgent(run, options) {
28
28
  })).childConversationId };
29
29
  };
30
30
  }
31
- //#endregion
32
31
  export { spawn_exports as n, bindSpawnAgent as t };
@@ -1,14 +1,9 @@
1
1
  import { z } from "zod";
2
2
  import { Destination, Source, locationSchema } from "@sentry/junior-plugin-api";
3
3
  import "@earendil-works/pi-ai";
4
- //#region src/chat/conversation-privacy.d.ts
5
4
  type ConversationPrivacy = "public" | "private";
6
- //#endregion
7
- //#region src/chat/conversations/location.d.ts
8
5
  /** Validated Location associated with a Conversation. */
9
6
  type Location = z.output<typeof locationSchema>;
10
- //#endregion
11
- //#region src/chat/actor.d.ts
12
7
  declare const storedSlackActorSchema: z.ZodObject<{
13
8
  email: z.ZodOptional<z.ZodString>;
14
9
  fullName: z.ZodOptional<z.ZodString>;
@@ -18,8 +13,6 @@ declare const storedSlackActorSchema: z.ZodObject<{
18
13
  teamId: z.ZodOptional<z.ZodString>;
19
14
  }, z.core.$strict>;
20
15
  type StoredSlackActor = z.output<typeof storedSlackActorSchema>;
21
- //#endregion
22
- //#region src/chat/source.d.ts
23
16
  /** Legacy provider Source fields stored on a Conversation. */
24
17
  type SessionSource = Extract<Source, {
25
18
  kind: "web";
@@ -28,8 +21,6 @@ type SessionSource = Extract<Source, {
28
21
  }> | Omit<Extract<Source, {
29
22
  kind: "slack";
30
23
  }>, "messageTs">;
31
- //#endregion
32
- //#region src/usage-schema.d.ts
33
24
  declare const usageSchema: z.ZodObject<{
34
25
  inputTokens: z.ZodOptional<z.ZodNumber>;
35
26
  outputTokens: z.ZodOptional<z.ZodNumber>;
@@ -46,8 +37,6 @@ declare const usageSchema: z.ZodObject<{
46
37
  }, z.core.$strict>>;
47
38
  }, z.core.$strict>;
48
39
  type Usage = z.output<typeof usageSchema>;
49
- //#endregion
50
- //#region src/chat/usage.d.ts
51
40
  /**
52
41
  * Structured token and cost usage captured for a single agent turn.
53
42
  *
@@ -57,8 +46,6 @@ type Usage = z.output<typeof usageSchema>;
57
46
  * whether to display a breakdown or a single aggregate.
58
47
  */
59
48
  type AgentTurnUsage = Usage;
60
- //#endregion
61
- //#region src/chat/conversations/store.d.ts
62
49
  type ConversationSource = "api" | "internal" | "local" | "plugin" | "event" | "scheduler" | "slack" | "web";
63
50
  type ConversationStatus = "paused" | "failed" | "idle" | "pending" | "running";
64
51
  interface ConversationExecution {
@@ -205,5 +192,4 @@ interface ConversationStore {
205
192
  offset?: number;
206
193
  }): Promise<Conversation[]>;
207
194
  }
208
- //#endregion
209
195
  export { ConversationStore as t };
@@ -1,14 +1,14 @@
1
- import { B as toOptionalNumber, V as toOptionalString, z as isRecord } from "./logging-CWxiIuCF.js";
2
- import { i as getChatConfig } from "./config-CJRnWK9H.js";
3
- import { s as parseStoredSlackActor } from "./actor-BTtLaeWy.js";
4
- import { U as sameDestination, V as parseDestination, d as getConversationStore } from "./viewer-DSZXygMU.js";
5
- import { it as JUNIOR_THREAD_STATE_TTL_MS } from "./agent-hooks-BjtTzvru.js";
6
- import { C as getDefaultRedisStateAdapterFor, w as getStateAdapter } from "./profile-h-72wM78.js";
7
- import "./job-queue-B6SV9uVa.js";
1
+ import { B as toOptionalNumber, V as toOptionalString, z as isRecord } from "./logging-DsHONhVm.js";
2
+ import { i as getChatConfig } from "./config-_WO_AjCB.js";
3
+ import { s as parseStoredSlackActor } from "./actor-tlxzqaRe.js";
4
+ import { B as sameDestination, R as parseDestination, u as getConversationStore } from "./viewer-CGvvRqKp.js";
5
+ import { it as JUNIOR_THREAD_STATE_TTL_MS } from "./agent-hooks-BJ_5mlRH.js";
6
+ import { C as getDefaultRedisStateAdapterFor, w as getStateAdapter } from "./profile-DpYjfKke.js";
7
+ import "./job-queue-DVe37it2.js";
8
8
  import { z } from "zod";
9
9
  import { randomUUID } from "node:crypto";
10
10
  import { destinationSchema } from "@sentry/junior-plugin-api";
11
- //#region src/chat/task-execution/state.ts
11
+ // src/chat/task-execution/state.ts
12
12
  /**
13
13
  * Expiring conversation mailbox and execution index store.
14
14
  *
@@ -336,8 +336,8 @@ function uniqueIndexEntries(value) {
336
336
  return [...entries.values()];
337
337
  }
338
338
  function retainedIndexEntries(indexKey, entries) {
339
- if (indexKey === CONVERSATION_BY_ACTIVITY_INDEX_KEY) return entries.sort(compareIndexDescending).slice(0, CONVERSATION_ACTIVITY_INDEX_MAX_LENGTH);
340
- if (indexKey === CONVERSATION_ACTIVE_INDEX_KEY) return entries.sort(compareIndexAscending);
339
+ if (indexKey === "junior:conversation:v2:by-activity") return entries.sort(compareIndexDescending).slice(0, CONVERSATION_ACTIVITY_INDEX_MAX_LENGTH);
340
+ if (indexKey === "junior:conversation:v2:active") return entries.sort(compareIndexAscending);
341
341
  throw new Error(`Unknown conversation index ${indexKey}`);
342
342
  }
343
343
  function redisIndexKey(indexKey) {
@@ -402,7 +402,7 @@ function redisConversationIndexStore(client) {
402
402
  },
403
403
  async upsert(args) {
404
404
  const key = redisIndexKey(args.indexKey);
405
- if (args.indexKey === CONVERSATION_BY_ACTIVITY_INDEX_KEY) {
405
+ if (args.indexKey === "junior:conversation:v2:by-activity") {
406
406
  await client.sendCommand([
407
407
  "EVAL",
408
408
  upsertBoundedActivityScript,
@@ -415,7 +415,7 @@ function redisConversationIndexStore(client) {
415
415
  ]);
416
416
  return;
417
417
  }
418
- if (args.indexKey === CONVERSATION_ACTIVE_INDEX_KEY) {
418
+ if (args.indexKey === "junior:conversation:v2:active") {
419
419
  await client.sendCommand([
420
420
  "ZADD",
421
421
  key,
@@ -1125,8 +1125,7 @@ async function listActiveConversationIds$1(args = {}) {
1125
1125
  scoreMax: args.staleBeforeMs
1126
1126
  })).map((entry) => entry.conversationId);
1127
1127
  }
1128
- //#endregion
1129
- //#region src/chat/task-execution/store.ts
1128
+ // src/chat/task-execution/store.ts
1130
1129
  function metadataStore(options) {
1131
1130
  return options.conversationStore ?? getConversationStore();
1132
1131
  }
@@ -1413,5 +1412,4 @@ async function removeActiveConversation(args) {
1413
1412
  async function listActiveConversationIds(args = {}) {
1414
1413
  return await listActiveConversationIds$1(args);
1415
1414
  }
1416
- //#endregion
1417
1415
  export { hasRunnableConversationWork$1 as A, requestAnotherSlice as C, CONVERSATION_WORK_CHECK_IN_INTERVAL_MS as D, stopConversationWork as E, isInvalidConversationRecordError as M, CONVERSATION_WORK_STALE_ENQUEUE_MS as O, removeActiveConversation as S, startConversationWork as T, hasRunnableConversationWork as _, cancelHumanFacingPendingMessages as a, recordConversationRetry as b, clearExpiredConversationLease as c, countPendingConversationMessages as d, deadLetterAttempt as f, getConversationWorkState as g, getConversation as h, beginConversationResume as i, isFinalAttempt as j, hasConversationStop as k, completeConversationStop as l, ensureConversationWake as m, appendAndEnqueueExclusiveInboundMessage as n, checkInConversationWork as o, drainConversationMailbox as p, appendAndEnqueueInboundMessage as r, clearConsumedConversationWake as s, ackMessages as t, completeConversationWork as u, listActiveConversationIds as v, requestConversationWork as w, releaseConversationWork as x, recordAttemptFailure as y };
@@ -1,9 +1,9 @@
1
- import { m as logWarn } from "./logging-CWxiIuCF.js";
2
- import { c as QUEUE_SIGNATURE_MAX_AGE_MS, d as createVercelQueueClient, l as signQueueMessage, p as runWithTurnRequestDeadline, u as verifyQueueMessage } from "./job-queue-B6SV9uVa.js";
1
+ import { m as logWarn } from "./logging-DsHONhVm.js";
2
+ import { c as QUEUE_SIGNATURE_MAX_AGE_MS, d as createVercelQueueClient, l as signQueueMessage, p as runWithTurnRequestDeadline, u as verifyQueueMessage } from "./job-queue-DVe37it2.js";
3
3
  import { z } from "zod";
4
4
  import { createHash } from "node:crypto";
5
5
  import { handleCallback, registerDevConsumer } from "@vercel/queue";
6
- //#region src/chat/queue/callback.ts
6
+ // src/chat/queue/callback.ts
7
7
  /** Shared Vercel Queue callback wiring for signed messages. */
8
8
  /** Build the HTTP callback and local-dev consumer for one signed queue. */
9
9
  function queueCallback(options) {
@@ -56,8 +56,7 @@ function queueCallback(options) {
56
56
  }
57
57
  };
58
58
  }
59
- //#endregion
60
- //#region src/chat/plugins/task-queue.ts
59
+ // src/chat/plugins/task-queue.ts
61
60
  /**
62
61
  * Delivery for plugin-registered tasks.
63
62
  *
@@ -115,7 +114,7 @@ function pluginTaskCallback() {
115
114
  maxDeliveries: PLUGIN_TASK_MAX_DELIVERIES,
116
115
  onRejected: logPluginTaskQueueMessageRejected,
117
116
  run: async (message) => {
118
- const { processPluginTask } = await import("./task-runner-DUjvzYXj.js").then((n) => n.r);
117
+ const { processPluginTask } = await import("./task-runner-D3qJh4fK.js").then((n) => n.r);
119
118
  await processPluginTask(message);
120
119
  },
121
120
  topic: PLUGIN_TASK_QUEUE_TOPIC,
@@ -137,5 +136,4 @@ function createVercelPluginTaskCallback() {
137
136
  function registerVercelPluginTaskDevConsumer() {
138
137
  return pluginTaskCallback().registerDev();
139
138
  }
140
- //#endregion
141
139
  export { registerVercelPluginTaskDevConsumer as a, pluginTaskParamsSchema as i, createVercelPluginTaskCallback as n, sendVercelPluginTask as o, pluginTaskId as r, queueCallback as s, PLUGIN_TASK_QUEUE_TOPIC as t };
@@ -1,22 +1,22 @@
1
- import { t as __exportAll } from "./rolldown-runtime-B4FMCO8f.js";
2
- import { g as runBestEffort, m as logWarn } from "./logging-CWxiIuCF.js";
3
- import { g as parseSlackMessageTs } from "./actor-BTtLaeWy.js";
4
- import { E as agentTurnTotalTokens, T as agentTurnCostUsd, d as getConversationStore, f as getDb, i as readActorIdentity } from "./viewer-DSZXygMU.js";
5
- import { s as juniorConversations } from "./agent-invocations-Bdu3ROfo.js";
6
- import { a as juniorAutomationRuns, s as juniorAutomations } from "./executor-Do0THDRR.js";
7
- import { m as sameActorIdentity } from "./history-9pO1Zd4Y.js";
8
- import { h as credentialSubjectSchema } from "./registry-sLTr-sV9.js";
9
- import { A as escapeSlackMrkdwnText, B as postSlackMessage, R as openSlackDirectMessage, Wt as hydrateConversationMessages, Xt as fallbackShortTitle, Z as getTurnRecord, _t as isToolResultMessage, bt as stripRuntimeTurnContext, gt as isToolResultError, i as readScheduledAutomation, j as formatSlackLink, l as blockEventAutomation, lt as getPiMessageRole, m as getEventAutomation, pt as instructionTextForProjection, vt as normalizeToolNameFromResult } from "./tasks-D_WIJtvO.js";
10
- import { St as createPluginConversationEvents, dt as createPluginModel, ft as createPluginLogger, it as JUNIOR_THREAD_STATE_TTL_MS, lt as createPluginState, p as coreTaskRegistrations, st as getDashboardTaskLink, u as getPlugins, ut as createPluginEmbedder } from "./agent-hooks-BjtTzvru.js";
11
- import { w as getStateAdapter } from "./profile-h-72wM78.js";
12
- import { r as getPersistedThreadState, s as coerceThreadConversationState } from "./thread-state-Ch4yuCqG.js";
13
- import { t as resolveConversationRouting } from "./turn-session-routing-B3LWooK5.js";
14
- import { i as pluginTaskParamsSchema, o as sendVercelPluginTask, r as pluginTaskId } from "./task-queue-B17vV0La.js";
1
+ import { t as __exportAll } from "./rolldown-runtime-nwUcYXjP.js";
2
+ import { g as runBestEffort, m as logWarn } from "./logging-DsHONhVm.js";
3
+ import { g as parseSlackMessageTs } from "./actor-tlxzqaRe.js";
4
+ import { T as agentTurnTotalTokens, d as getDb, r as readActorIdentity, u as getConversationStore, w as agentTurnCostUsd } from "./viewer-CGvvRqKp.js";
5
+ import { s as juniorConversations } from "./agent-invocations-Qfz7dWgU.js";
6
+ import { a as juniorAutomationRuns, s as juniorAutomations } from "./executor-RvG6kVe1.js";
7
+ import { m as sameActorIdentity } from "./history-AY8rs-FR.js";
8
+ import { h as credentialSubjectSchema } from "./registry-Du566MtJ.js";
9
+ import { A as escapeSlackMrkdwnText, B as postSlackMessage, R as openSlackDirectMessage, Wt as hydrateConversationMessages, Xt as fallbackShortTitle, Z as getTurnRecord, _t as isToolResultMessage, bt as stripRuntimeTurnContext, gt as isToolResultError, i as readScheduledAutomation, j as formatSlackLink, l as blockEventAutomation, lt as getPiMessageRole, m as getEventAutomation, pt as instructionTextForProjection, vt as normalizeToolNameFromResult } from "./tasks-CEXKTASS.js";
10
+ import { St as createPluginConversationEvents, dt as createPluginModel, ft as createPluginLogger, it as JUNIOR_THREAD_STATE_TTL_MS, lt as createPluginState, p as coreTaskRegistrations, st as getDashboardTaskLink, u as getPlugins, ut as createPluginEmbedder } from "./agent-hooks-BJ_5mlRH.js";
11
+ import { w as getStateAdapter } from "./profile-DpYjfKke.js";
12
+ import { r as getPersistedThreadState, s as coerceThreadConversationState } from "./thread-state-W3f6kAtz.js";
13
+ import { t as resolveConversationRouting } from "./turn-session-routing-CUxtfpr7.js";
14
+ import { i as pluginTaskParamsSchema, o as sendVercelPluginTask, r as pluginTaskId } from "./task-queue-BzW4MaWU.js";
15
15
  import { z } from "zod";
16
16
  import { createHash } from "node:crypto";
17
17
  import { and, asc, count, desc, eq, gte, inArray, isNotNull, lte, max, sql } from "drizzle-orm";
18
18
  import { destinationSchema, destinationVisibilitySchema, isSlackDestination, pluginRunContextSchema, replyAttributionSchema, sourceSchema, taskOutcomeSchema } from "@sentry/junior-plugin-api";
19
- //#region src/api/conversations/aggregate.ts
19
+ // src/api/conversations/aggregate.ts
20
20
  function usageTokenValue(source, field) {
21
21
  return sql`CASE
22
22
  WHEN ${source.usage}->>${field} IS NOT NULL
@@ -98,8 +98,7 @@ function conversationRangeColumns() {
98
98
  function conversationActiveDaysColumn() {
99
99
  return sql`COUNT(DISTINCT (${juniorConversations.lastActivityAt} AT TIME ZONE 'UTC')::date)::integer`;
100
100
  }
101
- //#endregion
102
- //#region src/chat/automations/execution-stats.ts
101
+ // src/chat/automations/execution-stats.ts
103
102
  const AUTOMATION_EXECUTION_STATUSES = [
104
103
  "blocked",
105
104
  "completed",
@@ -428,8 +427,7 @@ async function readExecutionStatusBuckets(args) {
428
427
  status: juniorAutomationRuns.status
429
428
  }).from(juniorAutomationRuns).where(and(isExecution(), eq(juniorAutomationRuns.automationId, args.automationId), gte(juniorAutomationRuns.completedAtMs, args.startMs), lte(juniorAutomationRuns.completedAtMs, args.endMs))).groupBy(args.bucket, juniorAutomationRuns.status).orderBy(asc(args.bucket), asc(juniorAutomationRuns.status));
430
429
  }
431
- //#endregion
432
- //#region src/chat/automations/blocked-notice.ts
430
+ // src/chat/automations/blocked-notice.ts
433
431
  function buildBlockedNoticeText(automationId, title, reason) {
434
432
  const url = getDashboardTaskLink(automationId);
435
433
  return [
@@ -458,8 +456,7 @@ async function notifyAutomationBlocked(ref) {
458
456
  ...ref.dispatchId ? { "app.dispatch.id": ref.dispatchId } : void 0
459
457
  });
460
458
  }
461
- //#endregion
462
- //#region src/chat/agent-dispatch/store.ts
459
+ // src/chat/agent-dispatch/store.ts
463
460
  const DISPATCH_PREFIX = "junior:agent_dispatch";
464
461
  const DISPATCH_LOCK_TTL_MS = 6e5;
465
462
  const DISPATCH_MAILBOX_APPEND_INDEX_LOCK_TTL_MS = 1e4;
@@ -555,6 +552,7 @@ function normalizeMetadata(metadata) {
555
552
  return entries.length > 0 ? Object.fromEntries(entries) : void 0;
556
553
  }
557
554
  const DISPATCH_ID_PREFIX = "agent-dispatch:";
555
+ /** Return the stable dispatch id for one plugin idempotency key. */
558
556
  function buildDispatchId(plugin, idempotencyKey) {
559
557
  return `dispatch_${createHash("sha256").update(plugin).update("\0").update(idempotencyKey).digest("hex").slice(0, 32)}`;
560
558
  }
@@ -785,8 +783,7 @@ async function getPluginDispatchProjection(args) {
785
783
  if (!record || record.plugin !== args.plugin) return;
786
784
  return toDispatchProjection(record);
787
785
  }
788
- //#endregion
789
- //#region src/chat/plugins/task-runner.ts
786
+ // src/chat/plugins/task-runner.ts
790
787
  var task_runner_exports = /* @__PURE__ */ __exportAll({
791
788
  processPluginTask: () => processPluginTask,
792
789
  scheduleSessionCompletedPluginTasks: () => scheduleSessionCompletedPluginTasks
@@ -1032,9 +1029,8 @@ async function scheduleSessionCompletedPluginTasks(params, options = {}) {
1032
1029
  async function processPluginTask(message, options = {}) {
1033
1030
  await withPluginTaskLock(pluginTaskId(message), async () => {
1034
1031
  const resolved = findPluginTask(message);
1035
- if (!resolved) throw new Error(`Plugin task "${message.plugin}.${message.name}" is not registered`);
1032
+ if (!resolved?.task) throw new Error(`Plugin task "${message.plugin}.${message.name}" is not registered`);
1036
1033
  await resolved.task.run(taskPluginContext(resolved.plugin, message, options));
1037
1034
  });
1038
1035
  }
1039
- //#endregion
1040
- export { readAutomationRuns as A, readAutomationExecutionByConversationId as C, readAutomationExecutionStatusHours as D, readAutomationExecutionStatusDays as E, conversationRangeColumns as F, recordAutomationExecution as M, conversationActiveDaysColumn as N, readAutomationExecutionSummaries as O, conversationAggregateColumns as P, existingConversationId as S, readAutomationExecutionHours as T, markDispatchCompleted as _, confirmDispatchMailboxAppend as a, notifyAutomationBlocked as b, getDispatchIdForConversation as c, getDispatchTurnId as d, getPluginDispatchProjection as f, markDispatchBlocked as g, markDispatchAwaitingResume as h, claimDispatchMailboxAppend as i, readAutomationTitlesByConversationId as j, readAutomationExecutions as k, getDispatchInputMessageId as l, listPendingDispatchMailboxAppends as m, scheduleSessionCompletedPluginTasks as n, createOrGetDispatch as o, isTerminalDispatchStatus as p, task_runner_exports as r, getDispatchConversationId as s, processPluginTask as t, getDispatchRecord as u, markDispatchFailed as v, readAutomationExecutionDays as w, emptyAutomationRunWindows as x, markDispatchRunning as y };
1036
+ export { readAutomationExecutions as A, existingConversationId as C, readAutomationExecutionStatusDays as D, readAutomationExecutionHours as E, conversationAggregateColumns as F, conversationRangeColumns as I, readAutomationTitlesByConversationId as M, recordAutomationExecution as N, readAutomationExecutionStatusHours as O, conversationActiveDaysColumn as P, emptyAutomationRunWindows as S, readAutomationExecutionDays as T, markDispatchBlocked as _, claimDispatchMailboxAppend as a, markDispatchRunning as b, getDispatchConversationId as c, getDispatchRecord as d, getDispatchTurnId as f, markDispatchAwaitingResume as g, listPendingDispatchMailboxAppends as h, buildDispatchId as i, readAutomationRuns as j, readAutomationExecutionSummaries as k, getDispatchIdForConversation as l, isTerminalDispatchStatus as m, scheduleSessionCompletedPluginTasks as n, confirmDispatchMailboxAppend as o, getPluginDispatchProjection as p, task_runner_exports as r, createOrGetDispatch as s, processPluginTask as t, getDispatchInputMessageId as u, markDispatchCompleted as v, readAutomationExecutionByConversationId as w, notifyAutomationBlocked as x, markDispatchFailed as y };