@sentry/junior 0.302.0 → 0.304.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 (100) hide show
  1. package/dist/{adapter-context-Cx9fn9B3.js → adapter-context-B1IpoELr.js} +2 -2
  2. package/dist/{admin-_poE5NKL.js → admin-BnVFGo_z.js} +5 -5
  3. package/dist/{agent-runner-CY9RvsTX.js → agent-runner-CoEeZSRh.js} +1461 -1248
  4. package/dist/api/schema.d.ts +2 -2
  5. package/dist/api/schema.js +6 -6
  6. package/dist/api.d.ts +13 -12
  7. package/dist/api.js +230 -105
  8. package/dist/{app-BpY3wtRP.d.ts → app-Cs157Zc5.d.ts} +17 -15
  9. package/dist/app.d.ts +1 -1
  10. package/dist/app.js +108 -96
  11. package/dist/{automation-Cva5ZOwW.js → automation-CuA3yEcD.js} +3 -1
  12. package/dist/{background-compaction-queue-CXFq1_Cz.js → background-compaction-queue-WLPNSF_b.js} +6 -6
  13. package/dist/{briefs-B3NG-pid.js → briefs-CagVVefw.js} +12 -9
  14. package/dist/{catalog-runtime-Dss0lSV6.js → catalog-runtime-B8ZXvXWm.js} +2 -2
  15. package/dist/cli/chat.d.ts +1 -1
  16. package/dist/cli/chat.js +21 -21
  17. package/dist/cli/check.js +10 -10
  18. package/dist/cli/env.d.ts +1 -0
  19. package/dist/cli/env.js +8 -7
  20. package/dist/cli/init.js +13 -4
  21. package/dist/cli/main.js +4 -4
  22. package/dist/cli/plugins.js +6 -6
  23. package/dist/cli/snapshot-create.js +7 -5
  24. package/dist/cli/upgrade.d.ts +2 -2
  25. package/dist/cli/upgrade.js +6 -6
  26. package/dist/{config-CzeZiMKs.js → config-DdO1BNcw.js} +142 -67
  27. package/dist/{connections-CDYhMfrs.js → connections-D20kp0j5.js} +6 -6
  28. package/dist/{continue-in-slack-7Uf05ndC.js → continue-in-slack-BKEVMBj1.js} +8 -8
  29. package/dist/{conversation-BNXfq6Lb.js → conversation-BOqdRtUx.js} +4 -12
  30. package/dist/{conversation-feed-Clf_cv0n.js → conversation-feed-CgpgP7yi.js} +35 -2
  31. package/dist/{conversation-privacy-D9xnM5mK.js → conversation-privacy-L1SK_v0V.js} +16 -8
  32. package/dist/{conversation-turn-D7SEZgTG.js → conversation-turn-BptVJylj.js} +20 -23
  33. package/dist/{credential-sync-DoD0gW-j.js → credential-sync-D1J1CGzL.js} +19 -19
  34. package/dist/{db-B-gtnNjr.js → db-EKJnkrIb.js} +180 -17
  35. package/dist/{db-BdsCzytP.d.ts → db-zbN5ZV_o.d.ts} +26 -26
  36. package/dist/{executor-DZg20EqU.js → executor-CoIZmFK8.js} +55 -15
  37. package/dist/{history-IjdmO_r6.js → history-m2-ceTTX.js} +21 -12
  38. package/dist/{install-t1KQyTUs.js → install-BT2Pf6HP.js} +3 -3
  39. package/dist/instrumentation.d.ts +4 -4
  40. package/dist/instrumentation.js +15 -11
  41. package/dist/{lineage-C79GjoQr.js → lineage-C5DGQCS_.js} +2 -2
  42. package/dist/{logging-C9oDAg4M.js → logging-QSZuMcvo.js} +19 -19
  43. package/dist/{message-BLUCzJXN.js → message-TtxftRHj.js} +9 -9
  44. package/dist/{model-input-5jwNC45G.js → model-input-BHXfA29g.js} +4 -9
  45. package/dist/nitro.d.ts +1 -1
  46. package/dist/nitro.js +8 -8
  47. package/dist/{oauth-callback-server-BBl66vCb.js → oauth-callback-server-B0enqHtZ.js} +5 -4
  48. package/dist/{oauth-relay-DRzq73b6.js → oauth-relay-DAmfVmJu.js} +3 -6
  49. package/dist/{package-discovery-DJhGdS4c.js → package-discovery-x4AvVhMj.js} +1 -1
  50. package/dist/{plugin-module-Cf5gVPWP.js → plugin-module-Cv2ETe8Y.js} +1 -1
  51. package/dist/{plugins-BBX07Jzt.js → plugins-Bkk0XRo2.js} +3 -3
  52. package/dist/{projection-CIBwgD3s.js → projection-CNKK7doO.js} +755 -221
  53. package/dist/{prompt-CRQbzp5e.js → prompt-DSjhoKu5.js} +185 -12
  54. package/dist/{queue-DtCDaIct.js → queue-CDxkit82.js} +4 -4
  55. package/dist/{queue-CZyYgPF0.d.ts → queue-CbEHUO0l.d.ts} +1 -1
  56. package/dist/{registry-DdFQHZ_d.js → registry-DBDNUUmz.js} +37 -37
  57. package/dist/{resolve-CdW4BdrK.js → resolve-CQLhMWSu.js} +3 -3
  58. package/dist/{result-oOMv1t4O.js → result-B-pauj42.js} +10 -15
  59. package/dist/rolldown-runtime-BKpuH2hG.js +26 -0
  60. package/dist/{runner-DqitLtm-.js → runner-B3KxKks5.js} +10 -10
  61. package/dist/{sandbox-egress-signals-Bw9I0yfJ.js → sandbox-egress-signals-DJJX9ClG.js} +1 -1
  62. package/dist/{schema-DnVQepWP.js → schema-Bx0Mlo32.js} +77 -13
  63. package/dist/{schema-BIFM-U1a.d.ts → schema-CKcu-IK6.d.ts} +562 -23
  64. package/dist/{secrets-DebYU866.js → secrets-DHaJ5TTn.js} +4 -4
  65. package/dist/{sentry-BRTJqumy.js → sentry-CPbZjomA.js} +3 -28
  66. package/dist/{sentry-route-name-BhwWnfqj.js → sentry-route-name-C6EIzAGP.js} +1 -1
  67. package/dist/{service-account-CrZftRTb.js → service-account-2HmlNPvy.js} +49 -48
  68. package/dist/{service-account-B6mKAPVo.js → service-account-DQLqkSVv.js} +5 -5
  69. package/dist/{session-stop-DW63Z3kj.js → session-stop-DEeZKqbX.js} +132 -74
  70. package/dist/{skills-C16fz60Z.js → skills-2UrD7JkN.js} +6 -9
  71. package/dist/{slack-conversation-unfurl-BHhefEb7.js → slack-conversation-unfurl-Dd129Uov.js} +14 -18
  72. package/dist/{spawn-D_RnFYfy.js → spawn-eMho9HDJ.js} +7 -7
  73. package/dist/{legacy-web-actor-id-C-cEeWqL.js → state-Bveuc4Zh.js} +32 -32
  74. package/dist/{stop-7p1i08CY.js → stop-D_ltJLDS.js} +359 -171
  75. package/dist/{store-C28I0CVW.js → store-COeYnPL_.js} +5 -5
  76. package/dist/{task-queue-BVUJbQ28.js → task-queue-CBIDXZpV.js} +3 -3
  77. package/dist/{task-runner-CWi8j7Z6.js → task-runner-CJF7zIJL.js} +15 -18
  78. package/dist/{thread-context-D3-yYUd0.js → thread-context-Cg0jt0aE.js} +12 -12
  79. package/dist/{turn-session-routing-BFMS9ATF.js → turn-session-routing-CaY3Tp8m.js} +32 -32
  80. package/dist/{turn-user-message-C3-O8Omt.js → turn-user-message-tcom1RYd.js} +3 -3
  81. package/dist/{validation-BSFKUIb4.js → validation-EU91JwIT.js} +2 -2
  82. package/dist/vercel.js +1 -1
  83. package/dist/{version-BHHXNi-0.js → version-BYRPhY5G.js} +1 -1
  84. package/dist/version.js +1 -1
  85. package/dist/{viewer-B1SO21Qa.js → viewer-Cf8ISkAc.js} +3 -3
  86. package/dist/{warmup-Bz9bzkzN.js → warmup-TgY4S1vx.js} +202 -577
  87. package/dist/{worker-BspReIIK.js → worker-C6Uq4OKD.js} +9 -12
  88. package/migrations/0109_user_preferences.sql +1 -0
  89. package/migrations/0110_code_change_repository_state_index.sql +1 -0
  90. package/migrations/0111_attachment_kinds.sql +14 -0
  91. package/migrations/0112_attachment_url_fill.sql +51 -0
  92. package/migrations/0113_attachment_url_index.sql +1 -0
  93. package/migrations/meta/0099_snapshot.json +102 -326
  94. package/migrations/meta/0109_snapshot.json +4925 -0
  95. package/migrations/meta/0110_snapshot.json +4952 -0
  96. package/migrations/meta/0111_snapshot.json +5011 -0
  97. package/migrations/meta/0112_snapshot.json +5011 -0
  98. package/migrations/meta/0113_snapshot.json +5033 -0
  99. package/migrations/meta/_journal.json +36 -1
  100. package/package.json +16 -19
@@ -1,18 +1,18 @@
1
1
  // src/chat/secrets.ts
2
2
  /** Read the server secret that signs internal tokens and payloads. */
3
3
  function readJuniorSecret() {
4
- return process.env.JUNIOR_SECRET?.trim() || void 0;
4
+ return process.env["JUNIOR_SECRET"]?.trim() || void 0;
5
5
  }
6
6
  /** Read the raw dashboard session secret, with `JUNIOR_SECRET` as fallback. */
7
7
  function readSignInSecret() {
8
- return process.env.BETTER_AUTH_SECRET ?? process.env.JUNIOR_SECRET;
8
+ return process.env["BETTER_AUTH_SECRET"] ?? process.env["JUNIOR_SECRET"];
9
9
  }
10
10
  /** Read the bearer secret that internal cron requests must send. */
11
11
  function readSchedulerSecret() {
12
- return process.env.JUNIOR_SCHEDULER_SECRET?.trim() || process.env.CRON_SECRET?.trim();
12
+ return process.env["JUNIOR_SCHEDULER_SECRET"]?.trim() || process.env["CRON_SECRET"]?.trim();
13
13
  }
14
14
  /** Read the VAPID private key that signs web push messages. */
15
15
  function readWebPushPrivateKey() {
16
- return process.env.JUNIOR_WEB_PUSH_PRIVATE_KEY?.trim();
16
+ return process.env["JUNIOR_WEB_PUSH_PRIVATE_KEY"]?.trim();
17
17
  }
18
18
  export { readWebPushPrivateKey as i, readSchedulerSecret as n, readSignInSecret as r, readJuniorSecret as t };
@@ -1,30 +1,5 @@
1
- import "node:module";
1
+ import { n as __reExport, t as __exportAll } from "./rolldown-runtime-BKpuH2hG.js";
2
2
  import { captureException, captureMessage, continueTrace, flush, getActiveSpan, getClient, getGlobalScope, getTraceData, init, logger, setTag, setUser, spanToJSON, startInactiveSpan, startSpan, startSpanManual, withActiveSpan, withScope } from "@sentry/node";
3
- // \0rolldown/runtime.js
4
- var __defProp = Object.defineProperty;
5
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
- var __getOwnPropNames = Object.getOwnPropertyNames;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __exportAll = (all, no_symbols) => {
9
- let target = {};
10
- for (var name in all) __defProp(target, name, {
11
- get: all[name],
12
- enumerable: true
13
- });
14
- if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
15
- return target;
16
- };
17
- var __copyProps = (to, from, except, desc) => {
18
- if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
19
- key = keys[i];
20
- if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
21
- get: ((k) => from[k]).bind(null, key),
22
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
23
- });
24
- }
25
- return to;
26
- };
27
- var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
28
3
  // src/chat/sentry.ts
29
4
  var sentry_exports = /* @__PURE__ */ __exportAll({
30
5
  captureException: () => captureException,
@@ -45,7 +20,7 @@ var sentry_exports = /* @__PURE__ */ __exportAll({
45
20
  startSpanManual: () => startSpanManual,
46
21
  withActiveSpan: () => withActiveSpan,
47
22
  withScope: () => withScope
48
- });
23
+ }, 2);
49
24
  import * as import__sentry_node from "@sentry/node";
50
25
  __reExport(sentry_exports, import__sentry_node);
51
- export { withScope as _, getClient as a, init as c, setTag as d, setUser as f, withActiveSpan as g, startSpan as h, getActiveSpan as i, logger as l, startInactiveSpan as m, captureMessage as n, getGlobalScope as o, spanToJSON as p, continueTrace as r, getTraceData as s, captureException as t, sentry_exports as u, __exportAll as v };
26
+ export { withScope as _, getClient as a, init as c, setTag as d, setUser as f, withActiveSpan as g, startSpan as h, getActiveSpan as i, logger as l, startInactiveSpan as m, captureMessage as n, getGlobalScope as o, spanToJSON as p, continueTrace as r, getTraceData as s, captureException as t, sentry_exports as u };
@@ -1,4 +1,4 @@
1
- import { i as getActiveSpan, u as sentry_exports } from "./sentry-BRTJqumy.js";
1
+ import { i as getActiveSpan, u as sentry_exports } from "./sentry-CPbZjomA.js";
2
2
  import { matchedRoutes } from "hono/route";
3
3
  // src/chat/sentry-route-name.ts
4
4
  const HTTP_ROUTE_ATTRIBUTE = "app.http.route";
@@ -1,7 +1,8 @@
1
- import { K as isRecord, b as setSpanAttributes, h as logWarn } from "./logging-C9oDAg4M.js";
2
- import { $ as fenceLock, J as getStateAdapter, Z as MUTATION_LOCK_TTL_MS, et as withLock, ht as parseDestination } from "./db-B-gtnNjr.js";
3
- import { c as fetchWithBoundedOAuthErrorBodies, i as resolvePluginHeaderEnvRefs } from "./registry-DdFQHZ_d.js";
4
- import { i as readEncryptedState, r as createEncryptedState, t as findLegacyWebActorUserId } from "./legacy-web-actor-id-C-cEeWqL.js";
1
+ import { K as isRecord, b as setSpanAttributes, h as logWarn } from "./logging-QSZuMcvo.js";
2
+ import { c as fetchWithBoundedOAuthErrorBodies, i as resolvePluginHeaderEnvRefs } from "./registry-DBDNUUmz.js";
3
+ import { $ as MUTATION_LOCK_TTL_MS, X as getStateAdapter, _t as parseDestination, nt as withLock, tt as fenceLock } from "./db-EKJnkrIb.js";
4
+ import { n as readEncryptedState, r as findLegacyWebActorUserId, t as createEncryptedState } from "./state-Bveuc4Zh.js";
5
+ import { n as botConfig } from "./config-DdO1BNcw.js";
5
6
  import { AsyncLocalStorage } from "node:async_hooks";
6
7
  import { randomUUID } from "node:crypto";
7
8
  import { sourceSchema } from "@sentry/junior-plugin-api";
@@ -119,29 +120,29 @@ function parseMcpAuthSession(value) {
119
120
  if (!isRecord(value)) return;
120
121
  try {
121
122
  const parsed = value;
122
- if (parsed.schemaVersion !== 2 || typeof parsed.authSessionId !== "string" || typeof parsed.provider !== "string" || typeof parsed.userId !== "string" || typeof parsed.conversationId !== "string" || typeof parsed.sessionId !== "string" || typeof parsed.userMessage !== "string" || typeof parsed.createdAtMs !== "number" || typeof parsed.updatedAtMs !== "number") return;
123
- const destination = parsed.destination === void 0 ? void 0 : parseDestination(parsed.destination);
124
- if (parsed.destination !== void 0 && !destination) return;
125
- const source = parsed.source === void 0 ? void 0 : sourceSchema.safeParse(parsed.source);
126
- if (parsed.source !== void 0 && (!source || !source.success)) return;
123
+ if (parsed["schemaVersion"] !== 2 || typeof parsed["authSessionId"] !== "string" || typeof parsed["provider"] !== "string" || typeof parsed["userId"] !== "string" || typeof parsed["conversationId"] !== "string" || typeof parsed["sessionId"] !== "string" || typeof parsed["userMessage"] !== "string" || typeof parsed["createdAtMs"] !== "number" || typeof parsed["updatedAtMs"] !== "number") return;
124
+ const destination = parsed["destination"] === void 0 ? void 0 : parseDestination(parsed["destination"]);
125
+ if (parsed["destination"] !== void 0 && !destination) return;
126
+ const source = parsed["source"] === void 0 ? void 0 : sourceSchema.safeParse(parsed["source"]);
127
+ if (parsed["source"] !== void 0 && (!source || !source.success)) return;
127
128
  return {
128
129
  schemaVersion: 2,
129
- authSessionId: parsed.authSessionId,
130
- provider: parsed.provider,
131
- userId: parsed.userId,
132
- conversationId: parsed.conversationId,
130
+ authSessionId: parsed["authSessionId"],
131
+ provider: parsed["provider"],
132
+ userId: parsed["userId"],
133
+ conversationId: parsed["conversationId"],
133
134
  ...destination ? { destination } : void 0,
134
135
  ...source?.success ? { source: source.data } : void 0,
135
- sessionId: parsed.sessionId,
136
- userMessage: parsed.userMessage,
137
- createdAtMs: parsed.createdAtMs,
138
- updatedAtMs: parsed.updatedAtMs,
139
- ...typeof parsed.channelId === "string" ? { channelId: parsed.channelId } : void 0,
140
- ...typeof parsed.threadTs === "string" ? { threadTs: parsed.threadTs } : void 0,
141
- ...typeof parsed.toolChannelId === "string" ? { toolChannelId: parsed.toolChannelId } : void 0,
142
- ...isRecord(parsed.configuration) ? { configuration: parsed.configuration } : void 0,
143
- ...typeof parsed.authorizationUrl === "string" ? { authorizationUrl: parsed.authorizationUrl } : void 0,
144
- ...typeof parsed.codeVerifier === "string" ? { codeVerifier: parsed.codeVerifier } : void 0
136
+ sessionId: parsed["sessionId"],
137
+ userMessage: parsed["userMessage"],
138
+ createdAtMs: parsed["createdAtMs"],
139
+ updatedAtMs: parsed["updatedAtMs"],
140
+ ...typeof parsed["channelId"] === "string" ? { channelId: parsed["channelId"] } : void 0,
141
+ ...typeof parsed["threadTs"] === "string" ? { threadTs: parsed["threadTs"] } : void 0,
142
+ ...typeof parsed["toolChannelId"] === "string" ? { toolChannelId: parsed["toolChannelId"] } : void 0,
143
+ ...isRecord(parsed["configuration"]) ? { configuration: parsed["configuration"] } : void 0,
144
+ ...typeof parsed["authorizationUrl"] === "string" ? { authorizationUrl: parsed["authorizationUrl"] } : void 0,
145
+ ...typeof parsed["codeVerifier"] === "string" ? { codeVerifier: parsed["codeVerifier"] } : void 0
145
146
  };
146
147
  } catch {
147
148
  return;
@@ -151,10 +152,10 @@ function parseServerSession(value) {
151
152
  if (typeof value !== "string") return;
152
153
  try {
153
154
  const parsed = JSON.parse(value);
154
- if (!isRecord(parsed) || typeof parsed.sessionId !== "string" || typeof parsed.updatedAtMs !== "number") return;
155
+ if (!isRecord(parsed) || typeof parsed["sessionId"] !== "string" || typeof parsed["updatedAtMs"] !== "number") return;
155
156
  return {
156
- sessionId: parsed.sessionId,
157
- updatedAtMs: parsed.updatedAtMs
157
+ sessionId: parsed["sessionId"],
158
+ updatedAtMs: parsed["updatedAtMs"]
158
159
  };
159
160
  } catch {
160
161
  return;
@@ -165,9 +166,9 @@ function parseStoredCredentials(value) {
165
166
  const parsed = typeof value === "string" ? JSON.parse(value) : value;
166
167
  if (!isRecord(parsed)) return;
167
168
  return {
168
- ...isRecord(parsed.clientInformation) ? { clientInformation: parsed.clientInformation } : void 0,
169
- ...isRecord(parsed.discoveryState) ? { discoveryState: parsed.discoveryState } : void 0,
170
- ...isRecord(parsed.tokens) ? { tokens: parsed.tokens } : void 0
169
+ ...isRecord(parsed["clientInformation"]) ? { clientInformation: parsed["clientInformation"] } : void 0,
170
+ ...isRecord(parsed["discoveryState"]) ? { discoveryState: parsed.discoveryState } : void 0,
171
+ ...isRecord(parsed["tokens"]) ? { tokens: parsed["tokens"] } : void 0
171
172
  };
172
173
  } catch {
173
174
  return;
@@ -294,7 +295,7 @@ function refreshTokenOf(body) {
294
295
  */
295
296
  function serializeMcpTokenRefresh(owner, fetchFn = globalThis.fetch) {
296
297
  let sentAccessToken;
297
- return (async (input, init) => {
298
+ return async (input, init) => {
298
299
  const sentRefreshToken = refreshTokenOf(init?.body);
299
300
  if (!sentRefreshToken) {
300
301
  const authorization = new Headers(init?.headers).get("authorization");
@@ -312,14 +313,14 @@ function serializeMcpTokenRefresh(owner, fetchFn = globalThis.fetch) {
312
313
  const response = await fetchFn(input, init);
313
314
  if (!response.ok) return response;
314
315
  const tokens = await response.clone().json();
315
- if (typeof tokens.access_token !== "string") return response;
316
+ if (typeof tokens["access_token"] !== "string") return response;
316
317
  await fenceLock(state, lock, REFRESH_LOCK_TTL_MS);
317
318
  await putMcpStoredOAuthCredentials(userId, provider, {
318
319
  ...stored,
319
320
  tokens: {
320
321
  ...current,
321
322
  ...tokens,
322
- refresh_token: typeof tokens.refresh_token === "string" ? tokens.refresh_token : sentRefreshToken
323
+ refresh_token: typeof tokens["refresh_token"] === "string" ? tokens["refresh_token"] : sentRefreshToken
323
324
  }
324
325
  });
325
326
  return response;
@@ -330,7 +331,7 @@ function serializeMcpTokenRefresh(owner, fetchFn = globalThis.fetch) {
330
331
  });
331
332
  if (!attempt.acquired) throw new Error(`Timed out waiting for the ${provider} MCP token refresh`);
332
333
  return attempt.value;
333
- });
334
+ };
334
335
  }
335
336
  // src/chat/mcp/client.ts
336
337
  const MCP_CLIENT_INFO = {
@@ -567,14 +568,14 @@ function updateLockKey(provider) {
567
568
  function parseCredentials(value) {
568
569
  try {
569
570
  const parsed = typeof value === "string" ? JSON.parse(value) : value;
570
- if (!isRecord(parsed) || !isRecord(parsed.clientInformation) || !isRecord(parsed.tokens) || typeof parsed.connectedAtMs !== "number" || typeof parsed.redirectUrl !== "string") return;
571
+ if (!isRecord(parsed) || !isRecord(parsed["clientInformation"]) || !isRecord(parsed["tokens"]) || typeof parsed["connectedAtMs"] !== "number" || typeof parsed["redirectUrl"] !== "string") return;
571
572
  return {
572
- clientInformation: parsed.clientInformation,
573
- connectedAtMs: parsed.connectedAtMs,
574
- ...typeof parsed.connectedBy === "string" ? { connectedBy: parsed.connectedBy } : void 0,
575
- ...isRecord(parsed.discoveryState) ? { discoveryState: parsed.discoveryState } : void 0,
576
- redirectUrl: parsed.redirectUrl,
577
- tokens: parsed.tokens
573
+ clientInformation: parsed["clientInformation"],
574
+ connectedAtMs: parsed["connectedAtMs"],
575
+ ...typeof parsed["connectedBy"] === "string" ? { connectedBy: parsed["connectedBy"] } : void 0,
576
+ ...isRecord(parsed["discoveryState"]) ? { discoveryState: parsed.discoveryState } : void 0,
577
+ redirectUrl: parsed["redirectUrl"],
578
+ tokens: parsed["tokens"]
578
579
  };
579
580
  } catch {
580
581
  return;
@@ -614,7 +615,7 @@ async function deleteMcpServiceAccountCredentials(provider) {
614
615
  }
615
616
  function clientMetadata(redirectUrl) {
616
617
  return {
617
- client_name: "Junior MCP Service Account",
618
+ client_name: `${botConfig.userName} MCP Service Account`,
618
619
  redirect_uris: [redirectUrl],
619
620
  grant_types: ["authorization_code", "refresh_token"],
620
621
  response_types: ["code"],
@@ -709,14 +710,14 @@ function signInKey(state) {
709
710
  return `${SIGN_IN_KEY_PREFIX}:${state}`;
710
711
  }
711
712
  function parseSignIn(value) {
712
- if (!isRecord(value) || !isRecord(value.clientInformation) || typeof value.codeVerifier !== "string" || typeof value.provider !== "string" || typeof value.redirectUrl !== "string") return;
713
+ if (!isRecord(value) || !isRecord(value["clientInformation"]) || typeof value["codeVerifier"] !== "string" || typeof value["provider"] !== "string" || typeof value["redirectUrl"] !== "string") return;
713
714
  return {
714
- clientInformation: value.clientInformation,
715
- codeVerifier: value.codeVerifier,
716
- ...isRecord(value.discoveryState) ? { discoveryState: value.discoveryState } : void 0,
717
- provider: value.provider,
718
- redirectUrl: value.redirectUrl,
719
- ...typeof value.startedBy === "string" ? { startedBy: value.startedBy } : void 0
715
+ clientInformation: value["clientInformation"],
716
+ codeVerifier: value["codeVerifier"],
717
+ ...isRecord(value["discoveryState"]) ? { discoveryState: value.discoveryState } : void 0,
718
+ provider: value["provider"],
719
+ redirectUrl: value["redirectUrl"],
720
+ ...typeof value["startedBy"] === "string" ? { startedBy: value["startedBy"] } : void 0
720
721
  };
721
722
  }
722
723
  /** Build an OAuth client provider that keeps sign-in state in memory. */
@@ -1,6 +1,6 @@
1
- import { K as disconnectStateAdapter } from "./db-B-gtnNjr.js";
2
- import { n as pluginCatalogRuntime } from "./catalog-runtime-Dss0lSV6.js";
3
- import { n as finishServiceAccountSignIn, o as serviceAccountPlugins, r as getServiceAccountStatus, s as startServiceAccountSignIn, t as disconnectServiceAccount } from "./service-account-CrZftRTb.js";
1
+ import { n as finishServiceAccountSignIn, o as serviceAccountPlugins, r as getServiceAccountStatus, s as startServiceAccountSignIn, t as disconnectServiceAccount } from "./service-account-2HmlNPvy.js";
2
+ import { n as pluginCatalogRuntime } from "./catalog-runtime-B8ZXvXWm.js";
3
+ import { J as disconnectStateAdapter } from "./db-EKJnkrIb.js";
4
4
  import { CLI_USAGE } from "./cli/run.js";
5
5
  import { createServer } from "node:http";
6
6
  // src/cli/service-account.ts
@@ -69,7 +69,7 @@ async function runConnect(plugin) {
69
69
  redirectUrl: loopback.redirectUrl
70
70
  });
71
71
  console.log([
72
- `Open this URL in a browser on this machine. Sign in as the account Junior should use for ${provider}, not as yourself:`,
72
+ `Open this URL in a browser on this machine. Sign in as the account the bot should use for ${provider}, not as yourself:`,
73
73
  "",
74
74
  authorizationUrl.toString(),
75
75
  "",
@@ -98,7 +98,7 @@ async function runStatus(plugin) {
98
98
  async function runDisconnect(plugin) {
99
99
  const provider = plugin.manifest.name;
100
100
  await disconnectServiceAccount(plugin);
101
- console.log(`Removed the ${provider} service account from Junior. To revoke the grant, remove Junior's connection in the ${provider} account settings.`);
101
+ console.log(`Removed the ${provider} service account. To revoke the grant, remove the app connection in the ${provider} account settings.`);
102
102
  return 0;
103
103
  }
104
104
  /** Run `junior service-account connect|status|disconnect <plugin>`. */