@sentry/junior 0.9.4 → 0.10.1

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.
package/README.md CHANGED
@@ -18,13 +18,6 @@ export { GET, POST } from "@sentry/junior/handler";
18
18
  export const runtime = "nodejs";
19
19
  ```
20
20
 
21
- `app/api/queue/callback/route.js`:
22
-
23
- ```js
24
- export { POST } from "@sentry/junior/handlers/queue-callback";
25
- export const runtime = "nodejs";
26
- ```
27
-
28
21
  `next.config.mjs`:
29
22
 
30
23
  ```js
@@ -4,7 +4,7 @@ import {
4
4
  getPluginSkillRoots,
5
5
  logInfo,
6
6
  logWarn
7
- } from "./chunk-MY7JNCS2.js";
7
+ } from "./chunk-VWHGDGDH.js";
8
8
  import {
9
9
  skillRoots
10
10
  } from "./chunk-KCLEEKYX.js";
@@ -2,11 +2,7 @@ import {
2
2
  getPluginRuntimeDependencies,
3
3
  getPluginRuntimePostinstall,
4
4
  withSpan
5
- } from "./chunk-MY7JNCS2.js";
6
-
7
- // src/chat/state/adapter.ts
8
- import { createMemoryState } from "@chat-adapter/state-memory";
9
- import { createRedisState } from "@chat-adapter/state-redis";
5
+ } from "./chunk-VWHGDGDH.js";
10
6
 
11
7
  // src/chat/optional-string.ts
12
8
  function toOptionalTrimmed(value) {
@@ -20,8 +16,8 @@ function toOptionalTrimmed(value) {
20
16
  // src/chat/config.ts
21
17
  var MIN_AGENT_TURN_TIMEOUT_MS = 10 * 1e3;
22
18
  var DEFAULT_AGENT_TURN_TIMEOUT_MS = 12 * 60 * 1e3;
23
- var DEFAULT_QUEUE_CALLBACK_MAX_DURATION_SECONDS = 800;
24
- var TURN_TIMEOUT_BUFFER_SECONDS = 20;
19
+ var DEFAULT_FUNCTION_MAX_DURATION_SECONDS = 800;
20
+ var FUNCTION_TIMEOUT_BUFFER_SECONDS = 20;
25
21
  function parseAgentTurnTimeoutMs(rawValue, maxTimeoutMs) {
26
22
  const value = Number.parseInt(rawValue ?? "", 10);
27
23
  if (Number.isNaN(value)) {
@@ -32,25 +28,21 @@ function parseAgentTurnTimeoutMs(rawValue, maxTimeoutMs) {
32
28
  }
33
29
  return Math.max(MIN_AGENT_TURN_TIMEOUT_MS, Math.min(value, maxTimeoutMs));
34
30
  }
35
- function resolveQueueCallbackMaxDurationSeconds(env) {
36
- const value = Number.parseInt(
37
- env.QUEUE_CALLBACK_MAX_DURATION_SECONDS ?? "",
38
- 10
39
- );
31
+ function resolveFunctionMaxDurationSeconds(env) {
32
+ const raw = env.FUNCTION_MAX_DURATION_SECONDS ?? env.QUEUE_CALLBACK_MAX_DURATION_SECONDS;
33
+ const value = Number.parseInt(raw ?? "", 10);
40
34
  if (Number.isNaN(value) || value <= 0) {
41
- return DEFAULT_QUEUE_CALLBACK_MAX_DURATION_SECONDS;
35
+ return DEFAULT_FUNCTION_MAX_DURATION_SECONDS;
42
36
  }
43
37
  return value;
44
38
  }
45
- function resolveMaxTurnTimeoutMs(queueCallbackMaxDurationSeconds) {
46
- const budgetSeconds = queueCallbackMaxDurationSeconds - TURN_TIMEOUT_BUFFER_SECONDS;
39
+ function resolveMaxTurnTimeoutMs(functionMaxDurationSeconds) {
40
+ const budgetSeconds = functionMaxDurationSeconds - FUNCTION_TIMEOUT_BUFFER_SECONDS;
47
41
  return Math.max(MIN_AGENT_TURN_TIMEOUT_MS, budgetSeconds * 1e3);
48
42
  }
49
43
  function readBotConfig(env) {
50
- const queueCallbackMaxDurationSeconds = resolveQueueCallbackMaxDurationSeconds(env);
51
- const maxTurnTimeoutMs = resolveMaxTurnTimeoutMs(
52
- queueCallbackMaxDurationSeconds
53
- );
44
+ const functionMaxDurationSeconds = resolveFunctionMaxDurationSeconds(env);
45
+ const maxTurnTimeoutMs = resolveMaxTurnTimeoutMs(functionMaxDurationSeconds);
54
46
  return {
55
47
  userName: env.JUNIOR_BOT_NAME ?? "junior",
56
48
  modelId: env.AI_MODEL ?? "anthropic/claude-sonnet-4.6",
@@ -64,9 +56,7 @@ function readBotConfig(env) {
64
56
  function readChatConfig(env = process.env) {
65
57
  return {
66
58
  bot: readBotConfig(env),
67
- queue: {
68
- callbackMaxDurationSeconds: resolveQueueCallbackMaxDurationSeconds(env)
69
- },
59
+ functionMaxDurationSeconds: resolveFunctionMaxDurationSeconds(env),
70
60
  slack: {
71
61
  botToken: toOptionalTrimmed(env.SLACK_BOT_TOKEN) ?? toOptionalTrimmed(env.SLACK_BOT_USER_TOKEN),
72
62
  signingSecret: toOptionalTrimmed(env.SLACK_SIGNING_SECRET),
@@ -103,6 +93,8 @@ function getRuntimeMetadata() {
103
93
  }
104
94
 
105
95
  // src/chat/state/adapter.ts
96
+ import { createMemoryState } from "@chat-adapter/state-memory";
97
+ import { createRedisState } from "@chat-adapter/state-redis";
106
98
  var MIN_LOCK_TTL_MS = 1e3 * 60 * 5;
107
99
  var stateAdapter;
108
100
  var redisStateAdapter;
@@ -122,6 +114,9 @@ function createQueuedStateAdapter(base) {
122
114
  releaseLock: (lock) => base.releaseLock(lock),
123
115
  extendLock: (lock, ttlMs) => base.extendLock(lock, Math.max(ttlMs, MIN_LOCK_TTL_MS)),
124
116
  forceReleaseLock: (threadId) => base.forceReleaseLock(threadId),
117
+ enqueue: (threadId, entry, maxSize) => base.enqueue(threadId, entry, maxSize),
118
+ dequeue: (threadId) => base.dequeue(threadId),
119
+ queueDepth: (threadId) => base.queueDepth(threadId),
125
120
  get: (key) => base.get(key),
126
121
  getList: (key) => base.getList(key),
127
122
  set: (key, value, ttlMs) => base.set(key, value, ttlMs),
@@ -144,18 +139,6 @@ function createStateAdapter() {
144
139
  redisStateAdapter = redisState;
145
140
  return createQueuedStateAdapter(redisState);
146
141
  }
147
- function getOptionalRedisStateAdapter() {
148
- getStateAdapter();
149
- return redisStateAdapter;
150
- }
151
- async function getConnectedStateContext() {
152
- const adapter = getStateAdapter();
153
- await adapter.connect();
154
- return {
155
- redisStateAdapter: getOptionalRedisStateAdapter(),
156
- stateAdapter: adapter
157
- };
158
- }
159
142
  function getStateAdapter() {
160
143
  if (!stateAdapter) {
161
144
  stateAdapter = createStateAdapter();
@@ -806,13 +789,13 @@ function isSnapshotMissingError(error) {
806
789
 
807
790
  export {
808
791
  toOptionalTrimmed,
792
+ getChatConfig,
809
793
  botConfig,
810
794
  getSlackBotToken,
811
795
  getSlackSigningSecret,
812
796
  getSlackClientId,
813
797
  getSlackClientSecret,
814
798
  getRuntimeMetadata,
815
- getConnectedStateContext,
816
799
  getStateAdapter,
817
800
  disconnectStateAdapter,
818
801
  SANDBOX_WORKSPACE_ROOT,