@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.
- package/dist/{context-BKF_5zzI.js → adapter-DlLLoJKj.js} +537 -537
- package/dist/{admin-UOHix_5P.js → admin-BzRXDVfh.js} +1 -1
- package/dist/{agent-runner-DeYymwh2.js → agent-DxZ7nHfD.js} +19866 -6720
- package/dist/{agent-status-BA5x3Xtp.js → agent-status-Bq_AIpyp.js} +105 -1
- package/dist/{agent-update-delivery-DH8bx7jU.js → agent-update-delivery-CO4FU5Gg.js} +4 -5
- package/dist/api/schema.d.ts +45 -23
- package/dist/api/schema.js +4 -4
- package/dist/api.js +79 -84
- package/dist/{app-DKAOuaoC.d.ts → app-CHCFIIDu.d.ts} +5 -4
- package/dist/app.d.ts +2 -2
- package/dist/app.js +119 -194
- package/dist/{change-record-BzJgLsv7.d.ts → change-record-K-KsqNhT.d.ts} +9 -5
- package/dist/{channel-access-A0de5lRv.js → channel-access-BghWqlXx.js} +1 -1
- package/dist/{chat-core-engine-D3Wd7f5n.js → chat-core-engine-BgfSLrDu.js} +31 -14
- package/dist/cli/chat.d.ts +1 -1
- package/dist/cli/chat.js +23 -23
- package/dist/cli/check.js +5 -5
- package/dist/cli/main.js +2 -2
- package/dist/cli/plugins.d.ts +1 -1
- package/dist/cli/plugins.js +8 -8
- package/dist/cli/snapshot-create.js +5 -5
- package/dist/cli/upgrade.d.ts +1 -1
- package/dist/cli/upgrade.js +3 -4
- package/dist/{continue-in-slack-YxwMQVeR.js → continue-in-slack-DBlQP4PC.js} +3 -3
- package/dist/{conversation-feed-Cj7IuBtM.js → conversation-feed-DEUdD7mb.js} +2 -106
- package/dist/{conversation-privacy-Cr_dNW1p.js → conversation-privacy-qoh95v90.js} +1 -1
- package/dist/{create-Btl1y1rq.js → create-jZSaDrCR.js} +115 -5
- package/dist/{credential-sync-DTarZ63K.js → credential-sync-Bj9-UlNE.js} +15 -18
- package/dist/{db-of6e3sGt.js → db-BacvswT0.js} +4602 -727
- package/dist/{deployment-C0qXa0FD.js → deployment-BoJkRPDt.js} +3 -3
- package/dist/{engine-context-C_QL_bMQ.js → engine-context-Bi3Ync5t.js} +521 -150
- package/dist/{html-9_pS9SjY.js → html-DW0pw5Pr.js} +6 -8
- package/dist/instrumentation.js +7 -23
- package/dist/list-Dz3CdP3g.js +5016 -0
- package/dist/{logging-BnOG0qz2.js → logging-DsTnMqyi.js} +8 -33
- package/dist/{mailbox-turn-Byrry9o1.js → markers-C33gNYNE.js} +1705 -1284
- package/dist/nitro.d.ts +2 -2
- package/dist/nitro.js +6 -7
- package/dist/{oauth-callback-server-CjnnUr4o.js → oauth-callback-server-C-pEhAQK.js} +2 -2
- package/dist/{oauth-relay-BvHFH0fV.js → oauth-relay-DIXdH-io.js} +1 -1
- package/dist/{plugins-fBrz8PCV.d.ts → plugins-DhGXZjlu.d.ts} +1 -0
- package/dist/{profile-iHw1uu32.js → profile-v9vA3RvH.js} +16 -18
- package/dist/{prompt-DEkStuxG.js → prompt-C5CW2wKO.js} +1 -1
- package/dist/{reports-C1d9azyV.js → reports-eBgrhPXS.js} +2 -2
- package/dist/{resolve-DC6zBuDV.js → resolve-HVXmbeCr.js} +5 -5
- package/dist/{result-DxewDuXb.js → result-BPNzgeTl.js} +20 -9
- package/dist/{runner-99YxVN_r.js → runner-aNSDTST6.js} +7 -8
- package/dist/{sandbox-egress-signals-CgoX5CTI.js → sandbox-egress-signals-nzp9Ykf7.js} +1 -1
- package/dist/{schema-BTojNBr5.js → schema-BlTO5M1d.js} +16 -8
- package/dist/{service-account-YDCPSByj.js → service-account-DWIf1t6p.js} +4 -5
- package/dist/{skills-CleC0Hze.js → skills-50izzzdK.js} +9 -9
- package/dist/{slack-conversation-unfurl-BNQLC12R.js → slack-conversation-unfurl-C6jXhVYg.js} +7 -7
- package/dist/storage-BtCxXiNt.js +273 -0
- package/dist/{system-prompt-table-Ci6Ck4gk.js → system-prompt-table-CIR1B44Z.js} +27 -85
- package/dist/topic-B2EWKKBT.js +6 -0
- package/dist/{package-discovery-DD9vencX.js → topics-DxuKurCX.js} +21 -1
- package/dist/{types-DCzTAA63.js → types-BNHkJrOP.js} +25 -11
- package/dist/{users-Cb9c1k9q.js → users-DOVo9sdU.js} +1 -1
- package/dist/{validation-BiUmWPhy.js → validation-CK0vuEHB.js} +4 -4
- package/dist/{version-VEXiEcZu.js → version-BuLVNlxB.js} +1 -1
- package/dist/version.js +1 -1
- package/dist/{worker-ChWYQdhm.js → worker-C82kHU1R.js} +4 -4
- package/migrations/20261127052408_space_name_nullable/migration.sql +5 -0
- package/migrations/20261127052408_space_name_nullable/snapshot.json +29 -0
- package/migrations/20261127060000_annotation_object_id_index/migration.sql +1 -0
- package/migrations/20261127060000_annotation_object_id_index/snapshot.json +69 -0
- package/migrations/20261127060001_annotation_subjects/migration.sql +78 -0
- package/migrations/20261127060001_annotation_subjects/snapshot.json +104 -0
- package/migrations/20261127060002_annotation_subject_index/migration.sql +1 -0
- package/migrations/20261127060002_annotation_subject_index/snapshot.json +70 -0
- package/migrations/20261127060003_annotation_title_url/migration.sql +84 -0
- package/migrations/20261127060003_annotation_title_url/snapshot.json +73 -0
- package/migrations/20261127150242_drop_space_members/migration.sql +9 -0
- package/migrations/20261127150242_drop_space_members/snapshot.json +53 -0
- package/package.json +9 -7
- package/dist/auth-pause-state-f9hJM_zO.js +0 -113
- package/dist/catalog-runtime-BfdAnztW.js +0 -6
- package/dist/child-message-peFWLcCZ.js +0 -15
- package/dist/conversation-turn-Bru4w_FD.js +0 -1250
- package/dist/job-runner-B2XEvpif.js +0 -1505
- package/dist/lineage-nh4z9iQN.js +0 -36
- package/dist/list-HRP3TIRl.js +0 -12631
- package/dist/markers-CTTtJqYn.js +0 -342
- package/dist/message-BRUuLgrY.js +0 -153
- package/dist/model-input-CFC62mf-.js +0 -82
- package/dist/registry-Cl7Labpe.js +0 -3279
- package/dist/run-conversation-Cz2ubZK-.js +0 -337
- package/dist/sender-actors-77zTQbSG.js +0 -84
- package/dist/spawn-DuZfodPa.js +0 -45
- package/dist/task-runner-BJ9Up3bG.js +0 -1529
- package/dist/topic-CRYYBYp-.js +0 -7
- package/dist/topics-BoCkoPJJ.js +0 -21
- package/dist/turn-membership-VT7XZh-L.js +0 -856
- 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 "../
|
|
3
|
-
import {
|
|
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,
|
|
110
|
+
const [pluginsModule, appContextModule, validationModule, databaseModule] = await Promise.all([
|
|
111
111
|
import("../plugins-D_Ru4CWc.js").then((n) => n.o),
|
|
112
|
-
import("../db-
|
|
113
|
-
import("../
|
|
114
|
-
import("../
|
|
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
|
-
|
|
122
|
-
|
|
120
|
+
const previousAppContext = appContextModule.installAppContext(appContextModule.createAppContext({
|
|
121
|
+
plugins,
|
|
122
|
+
pluginConfig
|
|
123
|
+
}));
|
|
123
124
|
try {
|
|
124
125
|
if (shouldValidatePluginCatalog) {
|
|
125
|
-
|
|
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
|
-
|
|
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-
|
|
168
|
-
const { startLocalOAuthCallbackServer } = await import("../oauth-callback-server-
|
|
169
|
-
const { createLocalOAuthState } = await import("../oauth-relay-
|
|
170
|
-
const { createLocalSandboxEgressSignalTransport } = await import("../sandbox-egress-signals-
|
|
171
|
-
const { bindSpawnAgent } = await import("../
|
|
172
|
-
const { bindMessageAgent } = await import("../
|
|
173
|
-
const { runConversation } = await import("../
|
|
174
|
-
const { createConversationTurnWorker } = await import("../
|
|
175
|
-
const { resumeForPersonInput } = await import("../
|
|
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-
|
|
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-
|
|
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-
|
|
2
|
-
import { a as parseSkillFile } from "../skills-
|
|
3
|
-
import { a as JUNIOR_CONVERSATION_WORK_CALLBACK_ROUTE,
|
|
4
|
-
import {
|
|
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-
|
|
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-
|
|
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];
|
package/dist/cli/plugins.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as JuniorPluginSet } from "../plugins-
|
|
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 {
|
package/dist/cli/plugins.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { h as createPluginLogger } from "../prompt-
|
|
3
|
-
import { n as
|
|
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
|
-
|
|
127
|
-
|
|
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
|
-
|
|
138
|
+
installAppContext(previousAppContext);
|
|
139
139
|
throw error;
|
|
140
140
|
}
|
|
141
141
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { R as getChatConfig,
|
|
2
|
-
import {
|
|
3
|
-
import { n as resolve } from "../resolve-
|
|
4
|
-
import { t as create, u as SANDBOX_RUNTIME } from "../profile-
|
|
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 =
|
|
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();
|
package/dist/cli/upgrade.d.ts
CHANGED
package/dist/cli/upgrade.js
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
import { R as getChatConfig } from "../
|
|
2
|
-
import { c as pendingMigrations, l as readMigrationRecords, s as createJuniorSqlExecutor } from "../db-
|
|
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,
|
|
2
|
-
import { E as parseSlackChannelId, P as parseSlackMessageTs,
|
|
3
|
-
import { n as joinPublicChannelForRead, t as checkSlackChannelReadAccess } from "./channel-access-
|
|
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,
|
|
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,
|
|
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-
|
|
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 {
|
|
2
|
-
import { Pt as
|
|
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 {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import { t as discoverSkills } from "./skills-
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
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 =
|
|
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 =
|
|
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);
|