@sentry/junior 0.318.0 → 0.320.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 (94) hide show
  1. package/dist/{context-BKF_5zzI.js → adapter-DlLLoJKj.js} +537 -537
  2. package/dist/{admin-UOHix_5P.js → admin-BzRXDVfh.js} +1 -1
  3. package/dist/{agent-runner-DeYymwh2.js → agent-DxZ7nHfD.js} +19866 -6720
  4. package/dist/{agent-status-BA5x3Xtp.js → agent-status-Bq_AIpyp.js} +105 -1
  5. package/dist/{agent-update-delivery-DH8bx7jU.js → agent-update-delivery-CO4FU5Gg.js} +4 -5
  6. package/dist/api/schema.d.ts +45 -23
  7. package/dist/api/schema.js +4 -4
  8. package/dist/api.js +79 -84
  9. package/dist/{app-DKAOuaoC.d.ts → app-CHCFIIDu.d.ts} +5 -4
  10. package/dist/app.d.ts +2 -2
  11. package/dist/app.js +119 -194
  12. package/dist/{change-record-BzJgLsv7.d.ts → change-record-K-KsqNhT.d.ts} +9 -5
  13. package/dist/{channel-access-A0de5lRv.js → channel-access-BghWqlXx.js} +1 -1
  14. package/dist/{chat-core-engine-D3Wd7f5n.js → chat-core-engine-BgfSLrDu.js} +31 -14
  15. package/dist/cli/chat.d.ts +1 -1
  16. package/dist/cli/chat.js +23 -23
  17. package/dist/cli/check.js +5 -5
  18. package/dist/cli/main.js +2 -2
  19. package/dist/cli/plugins.d.ts +1 -1
  20. package/dist/cli/plugins.js +8 -8
  21. package/dist/cli/snapshot-create.js +5 -5
  22. package/dist/cli/upgrade.d.ts +1 -1
  23. package/dist/cli/upgrade.js +3 -4
  24. package/dist/{continue-in-slack-YxwMQVeR.js → continue-in-slack-DBlQP4PC.js} +3 -3
  25. package/dist/{conversation-feed-Cj7IuBtM.js → conversation-feed-DEUdD7mb.js} +2 -106
  26. package/dist/{conversation-privacy-Cr_dNW1p.js → conversation-privacy-qoh95v90.js} +1 -1
  27. package/dist/{create-Btl1y1rq.js → create-jZSaDrCR.js} +115 -5
  28. package/dist/{credential-sync-DTarZ63K.js → credential-sync-Bj9-UlNE.js} +15 -18
  29. package/dist/{db-of6e3sGt.js → db-BacvswT0.js} +4602 -727
  30. package/dist/{deployment-C0qXa0FD.js → deployment-BoJkRPDt.js} +3 -3
  31. package/dist/{engine-context-C_QL_bMQ.js → engine-context-Bi3Ync5t.js} +521 -150
  32. package/dist/{html-9_pS9SjY.js → html-DW0pw5Pr.js} +6 -8
  33. package/dist/instrumentation.js +7 -23
  34. package/dist/list-Dz3CdP3g.js +5016 -0
  35. package/dist/{logging-BnOG0qz2.js → logging-DsTnMqyi.js} +8 -33
  36. package/dist/{mailbox-turn-Byrry9o1.js → markers-C33gNYNE.js} +1705 -1284
  37. package/dist/nitro.d.ts +2 -2
  38. package/dist/nitro.js +6 -7
  39. package/dist/{oauth-callback-server-CjnnUr4o.js → oauth-callback-server-C-pEhAQK.js} +2 -2
  40. package/dist/{oauth-relay-BvHFH0fV.js → oauth-relay-DIXdH-io.js} +1 -1
  41. package/dist/{plugins-fBrz8PCV.d.ts → plugins-DhGXZjlu.d.ts} +1 -0
  42. package/dist/{profile-iHw1uu32.js → profile-v9vA3RvH.js} +16 -18
  43. package/dist/{prompt-DEkStuxG.js → prompt-C5CW2wKO.js} +1 -1
  44. package/dist/{reports-C1d9azyV.js → reports-eBgrhPXS.js} +2 -2
  45. package/dist/{resolve-DC6zBuDV.js → resolve-HVXmbeCr.js} +5 -5
  46. package/dist/{result-DxewDuXb.js → result-BPNzgeTl.js} +20 -9
  47. package/dist/{runner-99YxVN_r.js → runner-aNSDTST6.js} +7 -8
  48. package/dist/{sandbox-egress-signals-CgoX5CTI.js → sandbox-egress-signals-nzp9Ykf7.js} +1 -1
  49. package/dist/{schema-BTojNBr5.js → schema-BlTO5M1d.js} +16 -8
  50. package/dist/{service-account-YDCPSByj.js → service-account-DWIf1t6p.js} +4 -5
  51. package/dist/{skills-CleC0Hze.js → skills-50izzzdK.js} +9 -9
  52. package/dist/{slack-conversation-unfurl-BNQLC12R.js → slack-conversation-unfurl-C6jXhVYg.js} +7 -7
  53. package/dist/storage-BtCxXiNt.js +273 -0
  54. package/dist/{system-prompt-table-Ci6Ck4gk.js → system-prompt-table-CIR1B44Z.js} +27 -85
  55. package/dist/topic-B2EWKKBT.js +6 -0
  56. package/dist/{package-discovery-DD9vencX.js → topics-DxuKurCX.js} +21 -1
  57. package/dist/{types-DCzTAA63.js → types-BNHkJrOP.js} +25 -11
  58. package/dist/{users-Cb9c1k9q.js → users-DOVo9sdU.js} +1 -1
  59. package/dist/{validation-BiUmWPhy.js → validation-CK0vuEHB.js} +4 -4
  60. package/dist/{version-VEXiEcZu.js → version-BuLVNlxB.js} +1 -1
  61. package/dist/version.js +1 -1
  62. package/dist/{worker-ChWYQdhm.js → worker-C82kHU1R.js} +4 -4
  63. package/migrations/20261127052408_space_name_nullable/migration.sql +5 -0
  64. package/migrations/20261127052408_space_name_nullable/snapshot.json +29 -0
  65. package/migrations/20261127060000_annotation_object_id_index/migration.sql +1 -0
  66. package/migrations/20261127060000_annotation_object_id_index/snapshot.json +69 -0
  67. package/migrations/20261127060001_annotation_subjects/migration.sql +78 -0
  68. package/migrations/20261127060001_annotation_subjects/snapshot.json +104 -0
  69. package/migrations/20261127060002_annotation_subject_index/migration.sql +1 -0
  70. package/migrations/20261127060002_annotation_subject_index/snapshot.json +70 -0
  71. package/migrations/20261127060003_annotation_title_url/migration.sql +84 -0
  72. package/migrations/20261127060003_annotation_title_url/snapshot.json +73 -0
  73. package/migrations/20261127150242_drop_space_members/migration.sql +9 -0
  74. package/migrations/20261127150242_drop_space_members/snapshot.json +53 -0
  75. package/package.json +9 -7
  76. package/dist/auth-pause-state-f9hJM_zO.js +0 -113
  77. package/dist/catalog-runtime-BfdAnztW.js +0 -6
  78. package/dist/child-message-peFWLcCZ.js +0 -15
  79. package/dist/conversation-turn-Bru4w_FD.js +0 -1250
  80. package/dist/job-runner-B2XEvpif.js +0 -1505
  81. package/dist/lineage-nh4z9iQN.js +0 -36
  82. package/dist/list-HRP3TIRl.js +0 -12631
  83. package/dist/markers-CTTtJqYn.js +0 -342
  84. package/dist/message-BRUuLgrY.js +0 -153
  85. package/dist/model-input-CFC62mf-.js +0 -82
  86. package/dist/registry-Cl7Labpe.js +0 -3279
  87. package/dist/run-conversation-Cz2ubZK-.js +0 -337
  88. package/dist/sender-actors-77zTQbSG.js +0 -84
  89. package/dist/spawn-DuZfodPa.js +0 -45
  90. package/dist/task-runner-BJ9Up3bG.js +0 -1529
  91. package/dist/topic-CRYYBYp-.js +0 -7
  92. package/dist/topics-BoCkoPJJ.js +0 -21
  93. package/dist/turn-membership-VT7XZh-L.js +0 -856
  94. package/dist/turn-wake-C7HeLHAM.js +0 -151
package/dist/cli/chat.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { t as loadAppPluginSet } from "../plugin-module-Cv2ETe8Y.js";
2
- import { G as loadConfig, W as installChatConfig } from "../context-BKF_5zzI.js";
3
- import { n as executeAgentRun, t as createAgentRunner } from "../agent-runner-DeYymwh2.js";
2
+ import { G as loadConfig, W as installChatConfig } from "../adapter-DlLLoJKj.js";
3
+ import { on as createAgentRunner, t as executeAgentRun } from "../agent-DxZ7nHfD.js";
4
4
  import path from "node:path";
5
5
  import { createHash, randomUUID } from "node:crypto";
6
6
  import { stderr, stdin, stdout } from "node:process";
@@ -107,29 +107,29 @@ async function loadLocalPluginSet() {
107
107
  }
108
108
  /** Configure plugin hooks after local chat has selected its state adapter. */
109
109
  async function configureLocalChatPlugins(pluginSet) {
110
- const [pluginsModule, registryModule, catalogRuntimeModule, validationModule, databaseModule] = await Promise.all([
110
+ const [pluginsModule, appContextModule, validationModule, databaseModule] = await Promise.all([
111
111
  import("../plugins-D_Ru4CWc.js").then((n) => n.o),
112
- import("../db-of6e3sGt.js").then((n) => n.Tt),
113
- import("../catalog-runtime-BfdAnztW.js").then((n) => n.t),
114
- import("../validation-BiUmWPhy.js").then((n) => n.r),
115
- import("../db-of6e3sGt.js").then((n) => n.t)
112
+ import("../db-BacvswT0.js").then((n) => n.Md),
113
+ import("../validation-CK0vuEHB.js").then((n) => n.r),
114
+ import("../db-BacvswT0.js").then((n) => n.t)
116
115
  ]);
117
116
  const resolvedPluginSet = pluginSet === void 0 ? await loadLocalPluginSet() : pluginSet ?? void 0;
118
117
  const plugins = pluginsModule.pluginRuntimeRegistrationsFromPluginSet(resolvedPluginSet);
119
118
  const pluginConfig = resolvedPluginSet ? pluginsModule.pluginCatalogConfigFromPluginSet(resolvedPluginSet) : pluginsModule.pluginCatalogConfigFromEnv();
120
119
  const shouldValidatePluginCatalog = Boolean(pluginConfig) || Boolean(resolvedPluginSet?.registrations.length);
121
- registryModule.validatePlugins(plugins);
122
- const previousPluginCatalogConfig = catalogRuntimeModule.pluginCatalogRuntime.setConfig(pluginConfig);
120
+ const previousAppContext = appContextModule.installAppContext(appContextModule.createAppContext({
121
+ plugins,
122
+ pluginConfig
123
+ }));
123
124
  try {
124
125
  if (shouldValidatePluginCatalog) {
125
- catalogRuntimeModule.pluginCatalogRuntime.getSignature();
126
+ appContextModule.getAppContext().catalog.getSignature();
126
127
  validationModule.validatePluginRegistrations(resolvedPluginSet?.registrations ?? []);
127
128
  validationModule.validatePluginEgressCredentialHooks(resolvedPluginSet?.registrations ?? []);
128
129
  }
129
130
  databaseModule.getDb();
130
- registryModule.setPlugins(plugins);
131
131
  } catch (error) {
132
- catalogRuntimeModule.pluginCatalogRuntime.setConfig(previousPluginCatalogConfig);
132
+ appContextModule.installAppContext(previousAppContext);
133
133
  throw error;
134
134
  }
135
135
  }
@@ -164,17 +164,17 @@ function localDevServerUrl() {
164
164
  async function prepareLocalChatRun(io, pluginSet) {
165
165
  installLocalChatConfig({ eventEmbeddings: { enabled: true } });
166
166
  await configureLocalChatPlugins(pluginSet);
167
- const { runLocalAgentTurn } = await import("../runner-99YxVN_r.js");
168
- const { startLocalOAuthCallbackServer } = await import("../oauth-callback-server-CjnnUr4o.js");
169
- const { createLocalOAuthState } = await import("../oauth-relay-BvHFH0fV.js").then((n) => n.t);
170
- const { createLocalSandboxEgressSignalTransport } = await import("../sandbox-egress-signals-CgoX5CTI.js");
171
- const { bindSpawnAgent } = await import("../spawn-DuZfodPa.js").then((n) => n.n);
172
- const { bindMessageAgent } = await import("../message-BRUuLgrY.js").then((n) => n.n);
173
- const { runConversation } = await import("../run-conversation-Cz2ubZK-.js").then((n) => n.n);
174
- const { createConversationTurnWorker } = await import("../conversation-turn-Bru4w_FD.js").then((n) => n.t);
175
- const { resumeForPersonInput } = await import("../mailbox-turn-Byrry9o1.js").then((n) => n.K);
167
+ const { runLocalAgentTurn } = await import("../runner-aNSDTST6.js");
168
+ const { startLocalOAuthCallbackServer } = await import("../oauth-callback-server-C-pEhAQK.js");
169
+ const { createLocalOAuthState } = await import("../oauth-relay-DIXdH-io.js").then((n) => n.t);
170
+ const { createLocalSandboxEgressSignalTransport } = await import("../sandbox-egress-signals-nzp9Ykf7.js");
171
+ const { bindSpawnAgent } = await import("../agent-DxZ7nHfD.js").then((n) => n.nn);
172
+ const { bindMessageAgent } = await import("../agent-DxZ7nHfD.js").then((n) => n.an);
173
+ const { runConversation } = await import("../agent-DxZ7nHfD.js").then((n) => n.Y);
174
+ const { createConversationTurnWorker } = await import("../agent-DxZ7nHfD.js").then((n) => n.X);
175
+ const { resumeForPersonInput } = await import("../markers-C33gNYNE.js").then((n) => n.M);
176
176
  const { createLocalConversationWork } = await import("../conversation-work-BaT_T6EB.js");
177
- const { processConversationWork } = await import("../worker-ChWYQdhm.js").then((n) => n.n);
177
+ const { processConversationWork } = await import("../worker-C82kHU1R.js").then((n) => n.n);
178
178
  let agentRunner;
179
179
  const localConversationWork = createLocalConversationWork(async (message) => {
180
180
  if (!agentRunner) throw new Error("Local agent runner is not ready");
@@ -241,7 +241,7 @@ async function runPrompt(options, io, pluginSet) {
241
241
  async function runCorePrompt(options, io, pluginSet) {
242
242
  installLocalChatConfig();
243
243
  await configureLocalChatPlugins(pluginSet);
244
- const { runCoreEnginePrompt } = await import("../chat-core-engine-D3Wd7f5n.js");
244
+ const { runCoreEnginePrompt } = await import("../chat-core-engine-BgfSLrDu.js");
245
245
  const result = await runCoreEnginePrompt({
246
246
  conversationId: newRunConversationId(),
247
247
  message: options.message
package/dist/cli/check.js CHANGED
@@ -1,13 +1,13 @@
1
- import { G as mapBounded } from "../prompt-DEkStuxG.js";
2
- import { a as parseSkillFile } from "../skills-CleC0Hze.js";
3
- import { a as JUNIOR_CONVERSATION_WORK_CALLBACK_ROUTE, c as JUNIOR_HEARTBEAT_ROUTE, m as LEGACY_JUNIOR_CONVERSATION_WORK_FUNCTION } from "../deployment-C0qXa0FD.js";
4
- import { X as parseInlinePluginManifest, Z as parsePluginManifest } from "../registry-Cl7Labpe.js";
1
+ import { G as mapBounded } from "../prompt-C5CW2wKO.js";
2
+ import { a as parseSkillFile } from "../skills-50izzzdK.js";
3
+ import { a as JUNIOR_CONVERSATION_WORK_CALLBACK_ROUTE, m as LEGACY_JUNIOR_CONVERSATION_WORK_FUNCTION, s as JUNIOR_HEARTBEAT_ROUTE } from "../deployment-BoJkRPDt.js";
4
+ import { Mf as parsePluginManifest, jf as parseInlinePluginManifest } from "../db-BacvswT0.js";
5
5
  import * as z from "zod";
6
6
  import path from "node:path";
7
7
  import { mentionsTag } from "@sentry/junior-plugin-api";
8
+ import { pathToFileURL } from "node:url";
8
9
  import pLimit from "p-limit";
9
10
  import fs from "node:fs/promises";
10
- import { pathToFileURL } from "node:url";
11
11
  // src/cli/check.ts
12
12
  const DEFAULT_IO = {
13
13
  info: console.log,
package/dist/cli/main.js CHANGED
@@ -45,10 +45,10 @@ async function runChat(argv, pluginSet) {
45
45
  return await (await import("./chat.js")).runChat(argv, void 0, { pluginSet });
46
46
  }
47
47
  async function runAdmin(argv) {
48
- return await (await import("../admin-UOHix_5P.js")).runAdmin(argv);
48
+ return await (await import("../admin-BzRXDVfh.js")).runAdmin(argv);
49
49
  }
50
50
  async function runServiceAccount(argv) {
51
- return await (await import("../service-account-YDCPSByj.js")).runServiceAccount(argv);
51
+ return await (await import("../service-account-DWIf1t6p.js")).runServiceAccount(argv);
52
52
  }
53
53
  function topLevelCommand(argv) {
54
54
  return (argv[0] === "--" ? argv.slice(1) : argv)[0];
@@ -1,4 +1,4 @@
1
- import { n as JuniorPluginSet } from "../plugins-fBrz8PCV.js";
1
+ import { n as JuniorPluginSet } from "../plugins-DhGXZjlu.js";
2
2
  import { PluginCliIo } from "@sentry/junior-plugin-api";
3
3
  export type PluginCommandIo = PluginCliIo;
4
4
  export interface CliPluginCommandDispatcher {
@@ -1,7 +1,6 @@
1
- import { Dt as validatePlugins, Et as setPlugins, a as getDb, kt as coreRegistrations } from "../db-of6e3sGt.js";
2
- import { h as createPluginLogger } from "../prompt-DEkStuxG.js";
3
- import { n as pluginCatalogRuntime } from "../catalog-runtime-BfdAnztW.js";
4
- import { n as validatePluginRegistrations, t as validatePluginEgressCredentialHooks } from "../validation-BiUmWPhy.js";
1
+ import { Fd as installAppContext, Nd as createAppContext, a as getDb, kt as coreRegistrations } from "../db-BacvswT0.js";
2
+ import { h as createPluginLogger } from "../prompt-C5CW2wKO.js";
3
+ import { n as validatePluginRegistrations, t as validatePluginEgressCredentialHooks } from "../validation-CK0vuEHB.js";
5
4
  import { t as loadAppPluginSet } from "../plugin-module-Cv2ETe8Y.js";
6
5
  import { a as pluginRuntimeRegistrationsFromPluginSet, i as pluginCliRegistrationsFromPluginSet, r as pluginCatalogConfigFromPluginSet } from "../plugins-D_Ru4CWc.js";
7
6
  import { Command, CommanderError } from "commander";
@@ -123,19 +122,20 @@ async function loadPluginRegistrations(args) {
123
122
  const cliPlugins = [...pluginCliRegistrationsFromPluginSet(pluginSet), ...coreCliPlugins];
124
123
  const runtimePlugins = pluginRuntimeRegistrationsFromPluginSet(pluginSet);
125
124
  const pluginConfig = pluginCatalogConfigFromPluginSet(pluginSet);
126
- validatePlugins(runtimePlugins);
127
- const previousPluginCatalogConfig = pluginCatalogRuntime.setConfig(pluginConfig);
125
+ const previousAppContext = installAppContext(createAppContext({
126
+ plugins: runtimePlugins,
127
+ pluginConfig
128
+ }));
128
129
  try {
129
130
  validatePluginRegistrations(pluginSet.registrations);
130
131
  validatePluginEgressCredentialHooks(pluginSet.registrations);
131
132
  args.validateConfiguredCommands?.(cliPlugins);
132
- setPlugins(runtimePlugins);
133
133
  return {
134
134
  cliPlugins,
135
135
  runtimePlugins
136
136
  };
137
137
  } catch (error) {
138
- pluginCatalogRuntime.setConfig(previousPluginCatalogConfig);
138
+ installAppContext(previousAppContext);
139
139
  throw error;
140
140
  }
141
141
  }
@@ -1,7 +1,7 @@
1
- import { R as getChatConfig, _ as disconnectStateAdapter } from "../context-BKF_5zzI.js";
2
- import { n as pluginCatalogRuntime } from "../catalog-runtime-BfdAnztW.js";
3
- import { n as resolve } from "../resolve-DC6zBuDV.js";
4
- import { t as create, u as SANDBOX_RUNTIME } from "../profile-iHw1uu32.js";
1
+ import { R as getChatConfig, n as disconnectStateAdapter } from "../adapter-DlLLoJKj.js";
2
+ import { Pd as getAppContext } from "../db-BacvswT0.js";
3
+ import { n as resolve } from "../resolve-HVXmbeCr.js";
4
+ import { t as create, u as SANDBOX_RUNTIME } from "../profile-v9vA3RvH.js";
5
5
  // src/cli/snapshot-create.ts
6
6
  const DEFAULT_TIMEOUT_MS = 6e5;
7
7
  function progressMessage(phase) {
@@ -15,7 +15,7 @@ function formatList(values) {
15
15
  return values.length > 0 ? values.join(", ") : "none";
16
16
  }
17
17
  function logSnapshotProfile(runtime, log) {
18
- const providers = pluginCatalogRuntime.getProviders();
18
+ const providers = getAppContext().catalog.getProviders();
19
19
  const currentProfile = create(runtime);
20
20
  const pluginNames = providers.map((plugin) => plugin.manifest.name).sort();
21
21
  const snapshotPluginNames = providers.filter((plugin) => (plugin.manifest.runtimeDependencies?.length ?? 0) > 0 || (plugin.manifest.runtimePostinstall?.length ?? 0) > 0).map((plugin) => plugin.manifest.name).sort();
@@ -1,4 +1,4 @@
1
- import { n as JuniorPluginSet } from "../plugins-fBrz8PCV.js";
1
+ import { n as JuniorPluginSet } from "../plugins-DhGXZjlu.js";
2
2
  import "../db-BpxcYXfD.js";
3
3
  interface UpgradeIo {
4
4
  info: (line: string) => void;
@@ -1,13 +1,12 @@
1
- import { R as getChatConfig } from "../context-BKF_5zzI.js";
2
- import { c as pendingMigrations, l as readMigrationRecords, s as createJuniorSqlExecutor } from "../db-of6e3sGt.js";
1
+ import { R as getChatConfig } from "../adapter-DlLLoJKj.js";
2
+ import { Id as createPluginCatalogRuntime, c as pendingMigrations, l as readMigrationRecords, s as createJuniorSqlExecutor } from "../db-BacvswT0.js";
3
3
  import { t as loadAppPluginSet } from "../plugin-module-Cv2ETe8Y.js";
4
- import { t as createPluginCatalogRuntime } from "../registry-Cl7Labpe.js";
5
4
  import { n as pluginCatalogConfigFromEnv, r as pluginCatalogConfigFromPluginSet, t as defineJuniorPlugins } from "../plugins-D_Ru4CWc.js";
6
5
  import { t as isMissingVirtualModule } from "../virtual-module-BeKA_EII.js";
7
6
  import { basename, dirname, join, resolve } from "node:path";
7
+ import { fileURLToPath } from "node:url";
8
8
  import { createHash } from "node:crypto";
9
9
  import { readMigrationFiles } from "drizzle-orm/migrator";
10
- import { fileURLToPath } from "node:url";
11
10
  import { createJiti } from "jiti";
12
11
  // src/chat/conversations/sql/migrations.ts
13
12
  /** SQL schema migrations for durable Junior records. */
@@ -1,6 +1,6 @@
1
- import { A as setFirstConversationLocation, Mi as formatSlackLink, N as claimProviderConversation, O as withConversationMutationLock, P as getConversationIdByProviderConversation, Sf as juniorDestinations, Tn as moveIdleConversationDestination, a as getDb, bi as getSlackMessagePermalink, i as getConversationStore, ji as escapeSlackMrkdwnText, o as getSqlExecutor, tl as getDashboardConversationLink, wi as postSlackMessage, yi as deleteSlackMessage } from "./db-of6e3sGt.js";
2
- import { E as parseSlackChannelId, P as parseSlackMessageTs, y as getStateAdapter } from "./context-BKF_5zzI.js";
3
- import { n as joinPublicChannelForRead, t as checkSlackChannelReadAccess } from "./channel-access-A0de5lRv.js";
1
+ import { A as setFirstConversationLocation, Ii as escapeSlackMrkdwnText, Kp as juniorDestinations, Li as formatSlackLink, N as claimProviderConversation, O as withConversationMutationLock, P as getConversationIdByProviderConversation, Sl as getDashboardConversationLink, Ti as getSlackMessagePermalink, Tn as moveIdleConversationDestination, a as getDb, i as getConversationStore, ki as postSlackMessage, o as getSqlExecutor, wi as deleteSlackMessage } from "./db-BacvswT0.js";
2
+ import { E as parseSlackChannelId, P as parseSlackMessageTs, i as getStateAdapter } from "./adapter-DlLLoJKj.js";
3
+ import { n as joinPublicChannelForRead, t as checkSlackChannelReadAccess } from "./channel-access-BghWqlXx.js";
4
4
  import { and, eq } from "drizzle-orm";
5
5
  // src/chat/slack/continue-in-slack.ts
6
6
  /** Refusal for a move that cannot wait for the active Run. */
@@ -1,109 +1,5 @@
1
- import { F as actorIdentitySchema, Nt as spaceRefSchema, V as conversationDetailReportSchema, X as conversationSummaryReportSchema, Yt as messageAttachmentSchema, zt as inboxItemChangeRecordSchema } from "./types-DCzTAA63.js";
1
+ import { F as actorIdentitySchema, Nt as spaceRefSchema, V as conversationDetailReportSchema, X as conversationSummaryReportSchema, Xt as messageAttachmentSchema, zt as inboxItemChangeRecordSchema } from "./types-BNHkJrOP.js";
2
2
  import * as z from "zod";
3
- // src/api/objects/cards.ts
4
- const MAX_LABEL_CHARS = 256;
5
- const MAX_FACT_CHARS = 160;
6
- const conversationStates = {
7
- done: "done",
8
- needs_input: "needs input",
9
- working: "working"
10
- };
11
- function personName(person) {
12
- return person.fullName ?? person.slackUserName ?? person.email;
13
- }
14
- /**
15
- * Build the card of one Conversation that the viewer may read. Give
16
- * `description` only when the viewer may see private content.
17
- */
18
- function conversationObjectCard(args) {
19
- const { summary } = args;
20
- const participants = args.participants.flatMap((person) => personName(person)?.slice(0, MAX_FACT_CHARS) ?? []).slice(0, 5);
21
- return {
22
- kind: "object",
23
- objectType: "conversation",
24
- key: summary.conversationId.slice(0, 256),
25
- label: summary.displayTitle.slice(0, MAX_LABEL_CHARS),
26
- title: summary.displayTitle.slice(0, 512),
27
- url: args.url,
28
- status: summary.archivedAt ? "archived" : conversationStates[summary.status],
29
- ...args.description ? { description: args.description.slice(0, 4e3) } : void 0,
30
- facts: {
31
- type: "conversation",
32
- ...participants.length > 0 ? { participants } : void 0,
33
- lastActivityAt: summary.lastSeenAt
34
- }
35
- };
36
- }
37
- /** Build the card of one known person from what the People pages show. */
38
- function personObjectCard(args) {
39
- const { person } = args;
40
- const name = personName(person) ?? person.email;
41
- return {
42
- kind: "object",
43
- objectType: "person",
44
- key: person.email.toLowerCase().slice(0, 256),
45
- label: name.slice(0, MAX_LABEL_CHARS),
46
- title: name.slice(0, 512),
47
- url: args.url,
48
- facts: {
49
- type: "person",
50
- email: person.email.slice(0, MAX_FACT_CHARS),
51
- ...person.slackUserName ? { slackHandle: person.slackUserName.slice(0, MAX_FACT_CHARS) } : void 0,
52
- ...args.githubHandle ? { githubHandle: args.githubHandle } : void 0,
53
- ...person.avatarUrl ? { avatarUrl: person.avatarUrl } : void 0
54
- }
55
- };
56
- }
57
- const MAX_SNIPPET_CHARS = 280;
58
- const MAX_TITLE_CHARS = 100;
59
- function truncate(text, max) {
60
- return text.length > max ? `${text.slice(0, max - 1).trimEnd()}…` : text;
61
- }
62
- /**
63
- * Build the card of one chat message. Give `text` only when the viewer may
64
- * read the message: the card shows a short snippet of it, never all of it.
65
- */
66
- function messageObjectCard(args) {
67
- const snippet = args.text?.replace(/\s+/g, " ").trim();
68
- const title = snippet ? truncate(snippet, MAX_TITLE_CHARS) : `Message in ${args.channel}`;
69
- return {
70
- kind: "object",
71
- objectType: "message",
72
- key: args.key.slice(0, 256),
73
- label: args.channel.slice(0, MAX_LABEL_CHARS),
74
- title,
75
- url: args.url,
76
- ...snippet && snippet.length > title.length ? { description: truncate(snippet, MAX_SNIPPET_CHARS) } : void 0,
77
- facts: {
78
- type: "message",
79
- channel: args.channel.slice(0, MAX_FACT_CHARS),
80
- ...args.author ? { author: args.author.slice(0, MAX_FACT_CHARS) } : void 0,
81
- ...args.sentAt ? { sentAt: args.sentAt } : void 0
82
- }
83
- };
84
- }
85
- /**
86
- * Build the card of one public web page from its oEmbed fields or meta
87
- * tags. `thumbnailUrl` must be a Junior image path.
88
- */
89
- function webPageObjectCard(args) {
90
- return {
91
- kind: "object",
92
- objectType: "web_page",
93
- key: args.url.slice(0, 256),
94
- label: truncate(args.title, MAX_LABEL_CHARS),
95
- title: truncate(args.title, 512),
96
- url: args.url,
97
- ...args.description ? { description: truncate(args.description, MAX_SNIPPET_CHARS) } : void 0,
98
- facts: {
99
- type: "web_page",
100
- ...args.siteName ? { siteName: truncate(args.siteName, MAX_FACT_CHARS) } : void 0,
101
- ...args.author ? { author: truncate(args.author, MAX_FACT_CHARS) } : void 0,
102
- ...args.media ? { media: args.media } : void 0,
103
- ...args.thumbnailUrl ? { thumbnailUrl: args.thumbnailUrl } : void 0
104
- }
105
- };
106
- }
107
3
  // src/reporting-schema.ts
108
4
  const healthReportSchema = z.object({
109
5
  status: z.literal("ok"),
@@ -442,4 +338,4 @@ const conversationFeedSchema = z.object({
442
338
  */
443
339
  waitingRowsTruncated: z.literal(true).optional()
444
340
  }).strict();
445
- export { conversationUnchangedDetailWithMailboxSchema as A, runtimeInfoReportSchema as B, cancelConversationPendingMessagesBodySchema as C, conversationPendingMessageDeliverySchema as D, conversationPendingAuthorizationSchema as E, pluginOperationalReportSchema as F, messageObjectCard as G, skillReportSchema as H, pluginPackageContentItemReportSchema as I, personObjectCard as K, pluginPackageContentReportSchema as L, steerConversationPendingMessagesResponseSchema as M, healthReportSchema as N, conversationPendingMessageSchema as O, pluginOperationalReportFeedSchema as P, pluginSchema as R, conversationAutoArchiveSchema as S, conversationDetailWithMailboxReportSchema as T, skillReportsSchema as U, skillDetailReportSchema as V, conversationObjectCard as W, reorderPinnedConversationsBodySchema as _, conversationInviteResponseSchema as a, archiveConversationResponseSchema as b, conversationSubscriptionResponseSchema as c, CONVERSATION_TITLE_MAX_LENGTH as d, conversationTitleSchema as f, pinConversationResponseSchema as g, pinConversationBodySchema as h, conversationInviteBodySchema as i, steerConversationPendingMessagesBodySchema as j, conversationPendingMessagesReportSchema as k, setConversationSpaceBodySchema as l, renameConversationResponseSchema as m, conversationFeedSchema as n, conversationLeaveResponseSchema as o, renameConversationBodySchema as p, webPageObjectCard as q, stopConversationTurnResponseSchema as r, conversationSubscriptionBodySchema as s, conversationFeedQuerySchema as t, setConversationSpaceResponseSchema as u, reorderPinnedConversationsResponseSchema as v, cancelConversationPendingMessagesResponseSchema as w, archiveDoneConversationsResponseSchema as x, archiveConversationBodySchema as y, pluginsSchema as z };
341
+ export { conversationUnchangedDetailWithMailboxSchema as A, runtimeInfoReportSchema as B, cancelConversationPendingMessagesBodySchema as C, conversationPendingMessageDeliverySchema as D, conversationPendingAuthorizationSchema as E, pluginOperationalReportSchema as F, skillReportSchema as H, pluginPackageContentItemReportSchema as I, pluginPackageContentReportSchema as L, steerConversationPendingMessagesResponseSchema as M, healthReportSchema as N, conversationPendingMessageSchema as O, pluginOperationalReportFeedSchema as P, pluginSchema as R, conversationAutoArchiveSchema as S, conversationDetailWithMailboxReportSchema as T, skillReportsSchema as U, skillDetailReportSchema as V, reorderPinnedConversationsBodySchema as _, conversationInviteResponseSchema as a, archiveConversationResponseSchema as b, conversationSubscriptionResponseSchema as c, CONVERSATION_TITLE_MAX_LENGTH as d, conversationTitleSchema as f, pinConversationResponseSchema as g, pinConversationBodySchema as h, conversationInviteBodySchema as i, steerConversationPendingMessagesBodySchema as j, conversationPendingMessagesReportSchema as k, setConversationSpaceBodySchema as l, renameConversationResponseSchema as m, conversationFeedSchema as n, conversationLeaveResponseSchema as o, renameConversationBodySchema as p, stopConversationTurnResponseSchema as r, conversationSubscriptionBodySchema as s, conversationFeedQuerySchema as t, setConversationSpaceResponseSchema as u, reorderPinnedConversationsResponseSchema as v, cancelConversationPendingMessagesResponseSchema as w, archiveDoneConversationsResponseSchema as x, archiveConversationBodySchema as y, pluginsSchema as z };
@@ -1,4 +1,4 @@
1
- import { m as logWarn } from "./logging-BnOG0qz2.js";
1
+ import { m as logWarn } from "./logging-DsTnMqyi.js";
2
2
  import { AsyncLocalStorage } from "node:async_hooks";
3
3
  import { renderSystemMessageUpdate } from "@earendil-works/pi-ai";
4
4
  // src/chat/conversation-privacy.ts
@@ -1,9 +1,119 @@
1
- import { C as getChildAgentLockName, T as getSpawnedChildConversationId, Tr as loadTurnStart, U as getConversationStoppedAtMs, b as readAgentConfig, l as appendParentMessage, u as buildParentMessage, y as agentConfigSchema, zt as addConversationNote } from "./mailbox-turn-Byrry9o1.js";
2
- import { Pt as getAgentBinding, Rt as spawnChildAgentInputSchema, Zd as juniorAgentBindings, an as getConversationWorkState, hf as juniorConversations, i as getConversationStore, o as getSqlExecutor, rn as ensureConversationWake, xn as hasConversationStop, yd as nextDetailVersion } from "./db-of6e3sGt.js";
3
- import { n as recordSubagentStartedMarker, o as listOpenChildAgents, p as readChildConversationSender } from "./markers-CTTtJqYn.js";
4
- import { I as AgentNameInUseError, L as AgentStoppedError, R as ChildAgentLimitError } from "./agent-runner-DeYymwh2.js";
1
+ import { Pt as getAgentBinding, Rt as spawnChildAgentInputSchema, Uf as nextDetailVersion, an as getConversationWorkState, i as getConversationStore, o as getSqlExecutor, rn as ensureConversationWake, xn as hasConversationStop, xp as juniorAgentBindings, zp as juniorConversations } from "./db-BacvswT0.js";
2
+ import { C as getChildAgentLockName, Nr as loadTurnStart, Pt as addConversationNote, T as getSpawnedChildConversationId, b as readAgentConfig, f as readChildConversationSender, k as getConversationStoppedAtMs, m as buildParentMessage, n as recordSubagentStartedMarker, o as listOpenChildAgents, p as appendParentMessage, y as agentConfigSchema } from "./markers-C33gNYNE.js";
5
3
  import { eq } from "drizzle-orm";
6
4
  import { randomUUID } from "node:crypto";
5
+ // src/chat/agent/types.ts
6
+ /** Resume the agent turn after a transient or ambiguous delivery failure. */
7
+ var RetryableDeliveryError = class extends Error {
8
+ constructor(cause) {
9
+ super("Assistant delivery was transient or ambiguous", { cause });
10
+ this.name = "RetryableDeliveryError";
11
+ }
12
+ };
13
+ /** Return whether one optional agent capability is disabled for this run. */
14
+ function isAgentRunFeatureDisabled(disabledFeatures, feature) {
15
+ return disabledFeatures?.includes(feature) ?? false;
16
+ }
17
+ /** Resolve the explicit actor, dispatch actor, or credential actor for this run. */
18
+ function actorFromRun(run) {
19
+ if (run.dispatch?.actor) return run.dispatch.actor;
20
+ if (run.actor) return run.actor;
21
+ if (run.credentialContext && !("type" in run.credentialContext.actor)) return run.credentialContext.actor;
22
+ }
23
+ /**
24
+ * Reject contradictory provider coordinates before the run touches state.
25
+ * `conversation` comes from the stored Conversation, never from the Run.
26
+ */
27
+ function assertRunConsistency(run, conversation) {
28
+ const { destination, source } = run;
29
+ switch (source.kind) {
30
+ case "slack":
31
+ if (destination.platform !== "slack") throw new TypeError("Run source and destination platforms do not match");
32
+ if (source.teamId !== destination.teamId) throw new TypeError("Slack source and destination teams do not match");
33
+ break;
34
+ case "local":
35
+ if (destination.platform !== "local") throw new TypeError("Run source and destination platforms do not match");
36
+ if (source.conversationId !== destination.conversationId) throw new TypeError("Source and destination conversation IDs do not match");
37
+ if (run.surface !== "internal" && destination.conversationId !== run.conversationId) throw new TypeError("Source, destination, and run conversation IDs do not match");
38
+ break;
39
+ case "web":
40
+ if (run.surface !== "internal" && source.conversationId !== run.conversationId) throw new TypeError("Web source and run conversation IDs do not match");
41
+ switch (destination.platform) {
42
+ case "local":
43
+ if (conversation?.kind === "thread" && conversation.hasParent) break;
44
+ if (source.conversationId !== destination.conversationId) throw new TypeError("Source and destination conversation IDs do not match");
45
+ if (run.surface !== "internal" && destination.conversationId !== run.conversationId) throw new TypeError("Source, destination, and run conversation IDs do not match");
46
+ }
47
+ break;
48
+ case "event":
49
+ case "scheduled_automation":
50
+ case "event_automation":
51
+ case "plugin_dispatch":
52
+ case "parent_message": return;
53
+ }
54
+ const actor = run.dispatch?.actor ?? run.actor;
55
+ if (!actor || actor.platform === "system") return;
56
+ if (actor.platform !== source.kind) throw new TypeError(`Actor platform "${actor.platform}" does not match Source kind "${source.kind}"`);
57
+ if (actor.platform === "slack" && source.kind === "slack" && actor.teamId !== source.teamId) throw new TypeError("Slack Actor team does not match Source team");
58
+ }
59
+ /** Route tool side effects to the tool channel when one overrides the destination. */
60
+ function toolInvocationDestination(run) {
61
+ if (run.destination.platform !== "slack" || !run.toolChannelId) return run.destination;
62
+ return {
63
+ platform: "slack",
64
+ teamId: run.destination.teamId,
65
+ channelId: run.toolChannelId
66
+ };
67
+ }
68
+ /** Infer the run surface when the caller did not state one. */
69
+ function surfaceFromRun(run) {
70
+ if (run.surface) return run.surface;
71
+ if (run.source.kind === "slack") return "slack";
72
+ if (run.source.kind === "web") return "api";
73
+ return "internal";
74
+ }
75
+ // src/chat/child-agents/errors.ts
76
+ /** A child agent already uses this name in the parent Conversation. */
77
+ var AgentNameInUseError = class extends Error {
78
+ constructor(name) {
79
+ super(`A child agent named "${name}" already exists`);
80
+ this.name = "AgentNameInUseError";
81
+ }
82
+ };
83
+ /** Parent already has the maximum number of active child agents. */
84
+ var ChildAgentLimitError = class extends Error {
85
+ constructor(limit) {
86
+ super(`Parent already has ${limit} active child agents (limit ${limit})`);
87
+ this.name = "ChildAgentLimitError";
88
+ }
89
+ };
90
+ /**
91
+ * The Conversation that calls startAgent is too deep to start child agents,
92
+ * or its parent chain does not end at a root.
93
+ */
94
+ var AgentDepthLimitError = class extends Error {
95
+ constructor(maxAgentDepth) {
96
+ super(`This agent cannot start child agents: only ${maxAgentDepth} level(s) of child agents can start their own`);
97
+ this.name = "AgentDepthLimitError";
98
+ }
99
+ };
100
+ /** A stopped Conversation cannot give work to child agents. */
101
+ var AgentStoppedError = class extends Error {
102
+ constructor() {
103
+ super("This conversation is stopped, so it cannot give work to child agents");
104
+ this.name = "AgentStoppedError";
105
+ }
106
+ };
107
+ /**
108
+ * A messageAgent target is not the parent, a child, or a top-level agent that
109
+ * the sender can message.
110
+ */
111
+ var AgentMessageTargetError = class extends Error {
112
+ constructor(message) {
113
+ super(message);
114
+ this.name = "AgentMessageTargetError";
115
+ }
116
+ };
7
117
  /**
8
118
  * A stopped child agent cannot start or give work to child agents until its
9
119
  * parent gives it new work, which ends the stop. A root Conversation has no
@@ -210,4 +320,4 @@ async function messageChildAgent(input, options, nowMs = Date.now()) {
210
320
  };
211
321
  }) };
212
322
  }
213
- export { spawnChildAgent as n, messageChildAgent as t };
323
+ export { AgentNameInUseError as a, RetryableDeliveryError as c, isAgentRunFeatureDisabled as d, surfaceFromRun as f, AgentMessageTargetError as i, actorFromRun as l, spawnChildAgent as n, AgentStoppedError as o, toolInvocationDestination as p, AgentDepthLimitError as r, ChildAgentLimitError as s, messageChildAgent as t, assertRunConsistency as u };
@@ -1,23 +1,20 @@
1
- import { C as acquireActiveLock, L as botConfig, R as getChatConfig, k as parseSlackUserId, y as getStateAdapter, z as getRuntimeMetadata } from "./context-BKF_5zzI.js";
2
- import { Js as readIdentityById, Ms as getSlackClient, cc as upsertLinkedIdentity, ec as resolveActorIdentityId, o as getSqlExecutor, oc as findUserByVerifiedEmails, wi as postSlackMessage } from "./db-of6e3sGt.js";
3
- import { O as isNativeIdentityProvider, f as logException, g as runBestEffort, m as logWarn } from "./logging-BnOG0qz2.js";
4
- import { G as mapBounded } from "./prompt-DEkStuxG.js";
5
- import { En as recordAuthorizationCompleted, Tn as recordAuthenticationLinked, br as getTurnRecord, dr as getConversationPendingAuth, gt as coerceThreadConversationState, ir as authorizationId, ni as formatProviderLabel, pt as getPersistedThreadState, ri as parseOAuthStatePayload, vt as deleteWebAuthorization } from "./mailbox-turn-Byrry9o1.js";
6
- import { i as finalizeMcpAuthorization } from "./agent-runner-DeYymwh2.js";
7
- import { i as homeDir } from "./package-discovery-DD9vencX.js";
8
- import { t as discoverSkills } from "./skills-CleC0Hze.js";
9
- import { C as getMcpAuthSession, H as getMcpProviderErrorAttributes, T as getMcpStoredOAuthCredentials, f as buildOAuthTokenRequest, k as putMcpStoredOAuthCredentials, m as hasRequiredOAuthScope, p as parseOAuthTokenResponse, y as deleteMcpAuthSession } from "./registry-Cl7Labpe.js";
10
- import { n as pluginCatalogRuntime } from "./catalog-runtime-BfdAnztW.js";
11
- import { A as createUserTokenStore, I as resolvePluginOAuthAccount } from "./profile-iHw1uu32.js";
12
- import { i as lookupSlackUserProfile } from "./users-Cb9c1k9q.js";
13
- import { a as wakePausedTurn, i as wakeAuthorizedTurn } from "./turn-wake-C7HeLHAM.js";
14
- import { s as readConnectedOAuthTokens, t as escapeHtml, u as htmlCallbackResponse } from "./html-9_pS9SjY.js";
15
- import { n as relayLocalOAuthCallback } from "./oauth-relay-BvHFH0fV.js";
1
+ import { l as homeDir } from "./topics-DxuKurCX.js";
2
+ import { L as botConfig, R as getChatConfig, c as acquireActiveLock, i as getStateAdapter, k as parseSlackUserId, z as getRuntimeMetadata } from "./adapter-DlLLoJKj.js";
3
+ import { Cf as getMcpProviderErrorAttributes, Dc as upsertLinkedIdentity, Jd as parseOAuthTokenResponse, Pd as getAppContext, Tc as findUserByVerifiedEmails, Xs as getSlackClient, Yd as hasRequiredOAuthScope, ef as deleteMcpAuthSession, fc as readIdentityById, if as getMcpAuthSession, ki as postSlackMessage, o as getSqlExecutor, of as getMcpStoredOAuthCredentials, qd as buildOAuthTokenRequest, uf as putMcpStoredOAuthCredentials, yc as resolveActorIdentityId } from "./db-BacvswT0.js";
4
+ import { O as isNativeIdentityProvider, f as logException, g as runBestEffort, m as logWarn } from "./logging-DsTnMqyi.js";
5
+ import { G as mapBounded } from "./prompt-C5CW2wKO.js";
6
+ import { $ as deleteWebAuthorization, J as getPersistedThreadState, Mn as recordAuthenticationLinked, Nn as recordAuthorizationCompleted, Or as getTurnRecord, Z as coerceThreadConversationState, di as formatProviderLabel, fi as parseOAuthStatePayload, fr as authorizationId, yr as getConversationPendingAuth } from "./markers-C33gNYNE.js";
7
+ import { Zt as finalizeMcpAuthorization, nt as wakeAuthorizedTurn, rt as wakePausedTurn } from "./agent-DxZ7nHfD.js";
8
+ import { t as discoverSkills } from "./skills-50izzzdK.js";
9
+ import { A as createUserTokenStore, I as resolvePluginOAuthAccount } from "./profile-v9vA3RvH.js";
10
+ import { i as lookupSlackUserProfile } from "./users-DOVo9sdU.js";
11
+ import { s as readConnectedOAuthTokens, t as escapeHtml, u as htmlCallbackResponse } from "./html-DW0pw5Pr.js";
12
+ import { n as relayLocalOAuthCallback } from "./oauth-relay-DIXdH-io.js";
16
13
  import * as z from "zod";
17
14
  import path from "node:path";
18
15
  import { pluginStoredTokensSchema } from "@sentry/junior-plugin-api";
19
- import { createHmac, createSecretKey, timingSafeEqual } from "node:crypto";
20
16
  import fs from "node:fs";
17
+ import { createHmac, createSecretKey, timingSafeEqual } from "node:crypto";
21
18
  // src/handlers/mcp-oauth-callback.ts
22
19
  /**
23
20
  * MCP OAuth callback handler.
@@ -288,7 +285,7 @@ async function buildHomeView(userId, userTokenStore) {
288
285
  const runtimeMetadata = getRuntimeMetadata();
289
286
  const descriptionText = loadDescriptionText();
290
287
  const skillsSummaryText = await buildSkillsSummaryText();
291
- const providers = pluginCatalogRuntime.getProviders();
288
+ const providers = getAppContext().catalog.getProviders();
292
289
  const connections = await mapBounded(providers, async (plugin) => {
293
290
  const tokens = await readConnectedOAuthTokens(userId, plugin, userTokenStore);
294
291
  return {
@@ -478,7 +475,7 @@ async function wakeAuthorizedPluginTurn(stored, options) {
478
475
  async function GET(request, provider, waitUntil, options) {
479
476
  const localRelay = await relayLocalOAuthCallback(request);
480
477
  if (localRelay) return localRelay;
481
- const providerConfig = pluginCatalogRuntime.getOAuthConfig(provider);
478
+ const providerConfig = getAppContext().catalog.getOAuthConfig(provider);
482
479
  if (!providerConfig) return htmlErrorResponse("Unknown provider", "The OAuth provider in this link is not recognized.", 404);
483
480
  const providerLabel = formatProviderLabel(provider);
484
481
  const url = new URL(request.url);