@sentry/junior 0.222.0 → 0.224.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/{agent-hooks-DkriF84n.js → agent-hooks-DNLBwmsh.js} +60 -16
- package/dist/{agent-7kKtDe-6.js → agent-runner-9g6TQk9y.js} +879 -69
- package/dist/api/schema.d.ts +160 -11
- package/dist/api/schema.js +2 -2
- package/dist/api.js +16 -16
- package/dist/{app-C0zbsnr7.d.ts → app-BbSD6EtD.d.ts} +1 -1
- package/dist/app.d.ts +1 -1
- package/dist/app.js +1598 -69
- package/dist/{briefs-CNH1ztn5.js → briefs-CjXnGKzZ.js} +6 -6
- package/dist/{catalog-runtime-XH_LFA_7.js → catalog-runtime-CVZ9TEuK.js} +1 -1
- package/dist/{checkpoint-CRod8es5.js → checkpoint-Ceck_fLO.js} +12 -9
- package/dist/cli/chat.js +14 -15
- package/dist/cli/check.js +3 -3
- package/dist/cli/main.js +1 -1
- package/dist/cli/plugins.js +3 -3
- package/dist/cli/snapshot-create.js +3 -3
- package/dist/cli/upgrade.js +3 -3
- package/dist/{client-CcSboWx_.js → client-B27ufhzl.js} +56 -6
- package/dist/{config-CGYv-YPE.js → config-BAhl7-RC.js} +6 -7
- package/dist/{conversation-BBDt88di.js → conversation-1HUoZr2l.js} +33 -5
- package/dist/{conversation-privacy-BGjdDVWD.js → conversation-privacy-C-4JQzKD.js} +1 -1
- package/dist/credential-sync-BXHIxbtS.js +940 -0
- package/dist/{execution-stats-D97ePWuM.js → execution-stats-DikPOxJ1.js} +3 -3
- package/dist/{executor-BLBZ-UB8.js → executor-BG2Armby.js} +1 -1
- package/dist/{history-CaV8Ww7M.d.ts → history-yaSjGMD_.d.ts} +18 -0
- package/dist/instrumentation.js +2 -2
- package/dist/{job-queue-_8gxwDzt.js → job-queue-D4oAVrL9.js} +1 -1
- package/dist/{logging-qmsMdU0y.js → logging-iY0ssa2q.js} +1 -1
- package/dist/nitro.d.ts +1 -1
- package/dist/nitro.js +3 -3
- package/dist/{pending-auth-_1Ry-_Bw.js → oauth-authorization-BIijVS2N.js} +6 -48
- package/dist/{oauth-callback-server-Mjfm46A5.js → oauth-callback-server-DPkK3kzi.js} +4 -4
- package/dist/{profile-DbG8AlNd.js → profile-6KWhg_-U.js} +5 -9
- package/dist/{prompt-B8rCQI7K.js → prompt-90miy8VV.js} +1 -1
- package/dist/{registry-DGyQCsiy.js → registry-Ctgdjt-W.js} +1 -1
- package/dist/{resolve-D5SqDbCA.js → resolve-CB45ZukQ.js} +2 -2
- package/dist/{runner-BRAFjJhe.js → runner-BwKCqoF3.js} +9 -10
- package/dist/{sandbox-egress-signals-CdI1aVHT.js → sandbox-egress-signals-Cmy8ODat.js} +1 -1
- package/dist/{schema-CTOODa3L.js → schema-RpbW5Od2.js} +1 -1
- package/dist/{short-title-CB2fxEyx.js → short-title-xEkZwkcV.js} +2 -2
- package/dist/{skills-BoS3b8cg.js → skills-c2bMDVRS.js} +2 -2
- package/dist/{spawn-BXCU1udr.js → spawn-Cg6lyjE7.js} +2 -2
- package/dist/{stats-qUXQZq-w.js → stats-DP9zl3Jg.js} +19 -17
- package/dist/{task-queue-Di_q8922.js → task-queue-SL4uLfBB.js} +3 -3
- package/dist/{task-runner-4rCppQMo.js → task-runner-fntmnqzx.js} +9 -84
- package/dist/{thread-state-2Paza8DV.js → thread-state-Wfr0GdKS.js} +5 -5
- package/dist/{auth-pause-state-3OT67TA8.js → turn-failure-response-DLjSEm-R.js} +74 -84
- package/dist/{turn-lifecycle-f-y0Irpi.js → turn-lifecycle-5_jvLqRz.js} +1 -1
- package/dist/turn-session-routing-CQaysLoe.js +77 -0
- package/dist/{validation-Be9lSORU.js → validation-CnZkCN7o.js} +1 -1
- package/dist/{version-BydrOZMQ.js → version-C6lA-h_o.js} +1 -1
- package/dist/version.js +1 -1
- package/dist/{web-authorization-BdfOkTuG.js → web-authorization-Bbx999_q.js} +1 -1
- package/dist/{web-input-DegYUyKU.js → web-input-BoE1xE-K.js} +7 -7
- package/dist/{work-Citqpnfc.js → work-4Nhz9mVv.js} +52 -10
- package/dist/{worker-Bn_HFyvM.js → worker-CdWPsNL2.js} +5 -5
- package/package.json +4 -4
- package/dist/agent-runner-D0ImXS7U.js +0 -679
- package/dist/credential-sync-BfzGNruT.js +0 -2757
- package/dist/experimental-CIXf7Uye.js +0 -46
- package/dist/turn-execution--F7a9kEU.js +0 -47
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-B4FMCO8f.js";
|
|
2
|
-
import { a as embedTexts, r as completeObject } from "./client-
|
|
3
|
-
import { C as withSpan, P as normalizeIdentityEmail, _ as setSpanAttributes, d as logInfo, f as logWarn, u as logException, v as setSpanStatus } from "./logging-
|
|
2
|
+
import { a as embedTexts, r as completeObject } from "./client-B27ufhzl.js";
|
|
3
|
+
import { C as withSpan, F as isRecord$2, P as normalizeIdentityEmail, _ as setSpanAttributes, d as logInfo, f as logWarn, u as logException, v as setSpanStatus } from "./logging-iY0ssa2q.js";
|
|
4
4
|
import { a as getClient$1 } from "./sentry-CgWZM_kV.js";
|
|
5
|
-
import { t as canExposeConversationPayload } from "./conversation-privacy-
|
|
6
|
-
import { a as getChatConfig, n as botConfig, s as getSlackBotToken } from "./config-
|
|
5
|
+
import { t as canExposeConversationPayload } from "./conversation-privacy-C-4JQzKD.js";
|
|
6
|
+
import { a as getChatConfig, n as botConfig, s as getSlackBotToken } from "./config-BAhl7-RC.js";
|
|
7
7
|
import { n as defaultModelId } from "./model-profile-CZmVoGdX.js";
|
|
8
8
|
import { _ as parseSlackMessageTs, c as isActorUserId, h as parseSlackTeamId, m as parseSlackChannelReferenceId, u as parseActorUserId } from "./context-Bplcgypl.js";
|
|
9
9
|
import { n as juniorDestinations } from "./destinations-BeBiJeEM.js";
|
|
10
|
-
import { C as juniorCodeRepositories, D as juniorIdentities, E as juniorConversations, O as juniorUsers, S as juniorCodeChanges, T as conversationReadColumns, _ as CONVERSATION_METRICS, g as juniorConversationBriefs, h as juniorConversationBindings, i as juniorWorkspaces, m as juniorConversationParticipants, n as juniorSnapshots, r as juniorWorkspaceRepos, t as createJuniorSqlExecutor, v as juniorConversationMetrics, x as juniorConversationAnnotations, y as juniorConversationEvents } from "./executor-
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import { n as briefEntriesFromReportEvents, s as generateBrief, t as BRIEF_PROMPT } from "./prompt-
|
|
10
|
+
import { C as juniorCodeRepositories, D as juniorIdentities, E as juniorConversations, O as juniorUsers, S as juniorCodeChanges, T as conversationReadColumns, _ as CONVERSATION_METRICS, g as juniorConversationBriefs, h as juniorConversationBindings, i as juniorWorkspaces, m as juniorConversationParticipants, n as juniorSnapshots, r as juniorWorkspaceRepos, t as createJuniorSqlExecutor, v as juniorConversationMetrics, x as juniorConversationAnnotations, y as juniorConversationEvents } from "./executor-BG2Armby.js";
|
|
11
|
+
import { C as conversationReportEventSchema, G as historyReplacementSchema, K as newConversationEventSchema, L as conversationBriefSchema, N as readMessageCards, R as parseBriefInput, V as conversationEventDataSchema, W as decodeStoredConversationEvent, Z as usageSchema } from "./conversation-1HUoZr2l.js";
|
|
12
|
+
import { N as SANDBOX_WORKSPACE_ROOT, k as sleep$1, l as isSandboxMissingError, n as hash, v as getVercelSandboxCredentials, w as getStateAdapter, x as runNonInteractiveCommand } from "./profile-6KWhg_-U.js";
|
|
13
|
+
import { n as briefEntriesFromReportEvents, s as generateBrief, t as BRIEF_PROMPT } from "./prompt-90miy8VV.js";
|
|
14
14
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
15
15
|
import { z } from "zod";
|
|
16
16
|
import { createHash, createHmac, randomUUID, timingSafeEqual } from "node:crypto";
|
|
17
17
|
import { and, arrayContains, asc, desc, eq, exists, getTableColumns, gt, gte, inArray, isNotNull, isNull, lt, lte, max, ne, notExists, or, sql } from "drizzle-orm";
|
|
18
|
-
import { codeChangeInputSchema, conversationAnnotationInputSchema, conversationEventPresentationSchema, defineConversationEvent, destinationSchema, eventInputSchema, eventMatchSchema, eventMatches, eventTypeSchema, identitySchema, locationSchema, missingToolAnnotationKeys, normalizeEventIdentifier, pluginEventsSchema, promptContextSchema, promptMessageSchema, sourceSchema, stableEventMatchKey, userSchema } from "@sentry/junior-plugin-api";
|
|
18
|
+
import { codeChangeInputSchema, conversationAnnotationInputSchema, conversationEventPresentationSchema, defineConversationEvent, destinationSchema, eventInputSchema, eventMatchSchema, eventMatches, eventTypeSchema, identitySchema, locationSchema, missingToolAnnotationKeys, normalizeEventIdentifier, objectAnnotationSchema, pluginEventsSchema, promptContextSchema, promptMessageSchema, sourceSchema, stableEventMatchKey, userSchema } from "@sentry/junior-plugin-api";
|
|
19
19
|
import { alias } from "drizzle-orm/pg-core";
|
|
20
20
|
import { WebClient } from "@slack/web-api";
|
|
21
21
|
import { Sandbox } from "@vercel/sandbox";
|
|
@@ -1707,6 +1707,43 @@ async function listConversationAnnotationsById(db, conversationIds) {
|
|
|
1707
1707
|
return byConversation;
|
|
1708
1708
|
}
|
|
1709
1709
|
//#endregion
|
|
1710
|
+
//#region src/chat/conversations/annotation-results.ts
|
|
1711
|
+
/** Save object annotations and return their Message card snapshots. */
|
|
1712
|
+
async function saveObjectAnnotations(conversationId, plugin, value) {
|
|
1713
|
+
const annotations = objectAnnotationSchema.array().parse(value);
|
|
1714
|
+
await getDb().transaction(async (db) => {
|
|
1715
|
+
const store = createPluginAnnotations({
|
|
1716
|
+
conversationId,
|
|
1717
|
+
plugin,
|
|
1718
|
+
db
|
|
1719
|
+
});
|
|
1720
|
+
for (const annotation of annotations) {
|
|
1721
|
+
await store.upsert(annotation);
|
|
1722
|
+
await store.remove("resource_link", annotation.key);
|
|
1723
|
+
}
|
|
1724
|
+
});
|
|
1725
|
+
return annotations.map((annotation) => ({
|
|
1726
|
+
...annotation,
|
|
1727
|
+
plugin
|
|
1728
|
+
}));
|
|
1729
|
+
}
|
|
1730
|
+
/** Save annotations from a successful plugin tool result and attach their cards. */
|
|
1731
|
+
async function annotateToolResult(conversationId, plugin, result) {
|
|
1732
|
+
if (!isRecord$2(result) || result.isError === true) return result;
|
|
1733
|
+
const details = isRecord$2(result.details) ? result.details : result;
|
|
1734
|
+
if (details.timed_out === true || details.isError === true || !Array.isArray(details.objectAnnotations)) return result;
|
|
1735
|
+
const cards = await saveObjectAnnotations(conversationId, plugin, details.objectAnnotations);
|
|
1736
|
+
const annotated = {
|
|
1737
|
+
...details,
|
|
1738
|
+
objectCards: cards
|
|
1739
|
+
};
|
|
1740
|
+
if (isRecord$2(result.details)) return {
|
|
1741
|
+
...result,
|
|
1742
|
+
details: annotated
|
|
1743
|
+
};
|
|
1744
|
+
return annotated;
|
|
1745
|
+
}
|
|
1746
|
+
//#endregion
|
|
1710
1747
|
//#region src/chat/conversations/sql/privacy.ts
|
|
1711
1748
|
const privacyRoot = alias(juniorConversations, "privacy_root");
|
|
1712
1749
|
/** Accept only a structurally valid persisted root as privacy authority. */
|
|
@@ -2018,7 +2055,7 @@ function reportEventData(args) {
|
|
|
2018
2055
|
...typeof data.meta?.eventType === "string" ? { eventType: data.meta.eventType } : void 0,
|
|
2019
2056
|
...typeof data.meta?.explicitMention === "boolean" ? { explicitMention: data.meta.explicitMention } : void 0,
|
|
2020
2057
|
...args.canExposePayload && typeof data.meta?.trustedSummary === "string" ? { trustedSummary: data.meta.trustedSummary } : void 0,
|
|
2021
|
-
...args.canExposePayload && data.meta?.cards ? { cards: readMessageCards(data.meta
|
|
2058
|
+
...args.canExposePayload && (data.meta?.cards || data.meta?.objectCards) ? { cards: readMessageCards(data.meta) } : void 0,
|
|
2022
2059
|
...args.canExposePayload ? { text: data.text } : { redacted: true }
|
|
2023
2060
|
};
|
|
2024
2061
|
}
|
|
@@ -4467,7 +4504,7 @@ var PluginHookDeniedError = class extends Error {
|
|
|
4467
4504
|
};
|
|
4468
4505
|
let registeredPlugins = [];
|
|
4469
4506
|
const PLUGIN_NAME_RE = /^[a-z][a-z0-9-]*$/;
|
|
4470
|
-
const
|
|
4507
|
+
const PLUGIN_TASK_NAME_RE = /^[a-z][A-Za-z0-9]*$/;
|
|
4471
4508
|
const OPERATIONAL_REPORT_MAX_METRICS = 8;
|
|
4472
4509
|
const OPERATIONAL_REPORT_MAX_WIDGETS = 12;
|
|
4473
4510
|
const OPERATIONAL_REPORT_MAX_CHART_SERIES = 8;
|
|
@@ -4646,7 +4683,7 @@ function validatePlugins(plugins) {
|
|
|
4646
4683
|
if (seen.has(name)) throw new Error(`Duplicate plugin name "${name}"`);
|
|
4647
4684
|
if (plugin.events !== void 0 && !pluginEventsSchema.safeParse(plugin.events).success) throw new Error(`Plugin "${name}" events is invalid`);
|
|
4648
4685
|
for (const [taskName, task] of Object.entries(plugin.tasks ?? {})) {
|
|
4649
|
-
if (!
|
|
4686
|
+
if (!PLUGIN_TASK_NAME_RE.test(taskName)) throw new Error(`Plugin task "${taskName}" from plugin "${name}" must be a camelCase identifier`);
|
|
4650
4687
|
if (typeof task.run !== "function") throw new Error(`Plugin task "${taskName}" from plugin "${name}" must define a run function`);
|
|
4651
4688
|
}
|
|
4652
4689
|
seen.add(name);
|
|
@@ -4885,7 +4922,6 @@ function getPluginTools(context, sandbox = createSandboxCapability(context.works
|
|
|
4885
4922
|
const pluginTools = hook(pluginContext);
|
|
4886
4923
|
const namespace = pluginToolNamespace(pluginName);
|
|
4887
4924
|
for (const [localName, tool] of Object.entries(pluginTools)) {
|
|
4888
|
-
if (!PLUGIN_TOOL_NAME_RE.test(localName)) throw new Error(`Plugin tool "${localName}" from plugin "${pluginName}" must be a camelCase identifier`);
|
|
4889
4925
|
const name = `${namespace}_${localName}`;
|
|
4890
4926
|
if (tools[name]) throw new Error(`Duplicate plugin tool "${name}" from plugin "${pluginName}"`);
|
|
4891
4927
|
const definition = tool;
|
|
@@ -4906,7 +4942,12 @@ function getPluginTools(context, sandbox = createSandboxCapability(context.works
|
|
|
4906
4942
|
description: plugin.manifest.description
|
|
4907
4943
|
};
|
|
4908
4944
|
definition.exposure ??= "deferred";
|
|
4909
|
-
|
|
4945
|
+
const execute = definition.execute;
|
|
4946
|
+
if (execute) {
|
|
4947
|
+
const wrapped = Object.create(definition);
|
|
4948
|
+
wrapped.execute = async (input, options) => annotateToolResult(context.conversationId, pluginName, await execute.call(definition, input, options));
|
|
4949
|
+
tools[name] = wrapped;
|
|
4950
|
+
} else tools[name] = definition;
|
|
4910
4951
|
}
|
|
4911
4952
|
}
|
|
4912
4953
|
return tools;
|
|
@@ -5264,6 +5305,7 @@ function createPluginHookRunner(input = {}) {
|
|
|
5264
5305
|
const loaded = getPlugins();
|
|
5265
5306
|
return {
|
|
5266
5307
|
async afterMcpTool(tool) {
|
|
5308
|
+
const cards = [];
|
|
5267
5309
|
for (const plugin of loaded) {
|
|
5268
5310
|
if (plugin.manifest.name !== tool.provider) continue;
|
|
5269
5311
|
const hook = plugin.hooks?.afterMcpTool;
|
|
@@ -5274,7 +5316,7 @@ function createPluginHookRunner(input = {}) {
|
|
|
5274
5316
|
plugin: plugin.manifest.name
|
|
5275
5317
|
}) : void 0;
|
|
5276
5318
|
try {
|
|
5277
|
-
await hook({
|
|
5319
|
+
const result = await hook({
|
|
5278
5320
|
...basePluginContext(plugin),
|
|
5279
5321
|
...tool.conversationId ? { conversationId: tool.conversationId } : void 0,
|
|
5280
5322
|
...annotations ? { annotations } : void 0,
|
|
@@ -5284,6 +5326,7 @@ function createPluginHookRunner(input = {}) {
|
|
|
5284
5326
|
name: tool.toolName
|
|
5285
5327
|
}
|
|
5286
5328
|
});
|
|
5329
|
+
if (result && tool.conversationId) cards.push(...await saveObjectAnnotations(tool.conversationId, plugin.manifest.name, result.objectAnnotations));
|
|
5287
5330
|
} catch (error) {
|
|
5288
5331
|
logWarn("agent.plugin.after_mcp_tool.failed", {
|
|
5289
5332
|
"app.plugin.name": plugin.manifest.name,
|
|
@@ -5292,6 +5335,7 @@ function createPluginHookRunner(input = {}) {
|
|
|
5292
5335
|
});
|
|
5293
5336
|
}
|
|
5294
5337
|
}
|
|
5338
|
+
return cards;
|
|
5295
5339
|
},
|
|
5296
5340
|
async prepareWorkspace(sandbox, repos, signal) {
|
|
5297
5341
|
const preparers = new Set(loaded.filter((plugin) => plugin.hooks?.workspacePrepare).map((plugin) => plugin.manifest.name));
|
|
@@ -5393,4 +5437,4 @@ function createPluginHookRunner(input = {}) {
|
|
|
5393
5437
|
};
|
|
5394
5438
|
}
|
|
5395
5439
|
//#endregion
|
|
5396
|
-
export { resolveViewerUser as $,
|
|
5440
|
+
export { resolveViewerUser as $, locationFromRow as $t, tryWorkspaceRepoCheckoutPath as A, createPluginConversationEvents as At, downloadPrivateSlackFile as B, agentsInstructionsUpdatedEvent as Bt, invalidateReadySnapshot as C, conversationArchivedForEmail as Ct, SANDBOX_RUNTIME as D, conversationNotArchivedForEmail as Dt, setWorkspaceSnapshotBuild as E, conversationHasParticipantUser as Et, bindSlackDirectCredentialSubject as F, saveObjectAnnotations as Ft, isDmChannel as G, getConversationMessageSearchStore as Gt, getHeaderString as H, authenticationUnlinkedEvent as Ht, verifyEventAutomationCredentialSubject as I, createPluginAnnotations as It, withSlackRetries as J, getSqlExecutor as Jt, normalizeSlackConversationId as K, getConversationStore as Kt, verifyScheduledAutomationCredentialSubject as L, listConversationAnnotations as Lt, resolveChannelCapabilities as M, readConversationEventPage as Mt, bindEventAutomationCredentialSubject as N, buildSentryConversationUrl as Nt, deleteWorkspaceSnapshotBuilders as O, conversationNotArchivedForUser as Ot, bindScheduledAutomationCredentialSubject as P, resolveRootVisibility as Pt, readActorIdentity as Q, withConversationMutationLock as Qt, verifySlackDirectCredentialSubject as R, listConversationAnnotationsById as Rt, WorkspaceValidationError as S, conversationArchiveTimes as St, setWorkspaceSnapshot as T, conversationHasParticipantEmail as Tt, getSlackClient as U, db_exports as Ut, getFilePermalink as V, authenticationLinkedEvent as Vt, isConversationScopedChannel as W, getConversationEventStore as Wt, runWithWorkspaceTeamId as X, withConversationEventLock as Xt, getWorkspaceTeamId as Y, createSqlConversationEventStore as Yt, findUserByEmail as Z, sanitizePostgresJson as Zt, deleteWorkspace as _, createPluginState as _t, getPluginRoutes as a, agentTurnUsageSchema as an, STOP_WATCHING_TOOL_NAME as at, listWorkspaces as b, createPluginLogger as bt, getPluginTools as c, deleteProviderIdentityForSlackUser as cn, collectEventMatchKeys as ct, setPlugins as d, createSlackDestination as dn, findMatchingWatches as dt, bindProviderConversation as en, updateViewerDisplayName as et, validatePlugins as f, parseDestination as fn, listWatches as ft, createWorkspace as g, setDashboardConversationLinkOptions as gt, setBriefsConfig as h, getDashboardTaskLink as ht, getPluginApiRoutes as i, agentTurnTotalTokens as in, RESOURCE_WATCH_TOOL_SOURCE as it, workspaceRepoCheckoutPath as j, readLatestConversationBrief as jt, getWorkspaceSnapshotBuilder as k, viewerConversationMembership as kt, getPluginUserPromptContributions as l, upsertIdentity as ln, createWatch as lt, registration_exports as m, sameDestination as mn, getDashboardConversationLink as mt, applyPluginFormatMarkdown as n, addAgentTurnUsage as nn, RESOURCE_SUBSCRIPTION_DEFAULT_TTL_MS as nt, getPluginSlackConversationLink as o, hasAgentTurnUsage as on, cancelSubscriptions as ot, coreTaskRegistrations as p, requireSlackDestination as pn, JUNIOR_THREAD_STATE_TTL_MS as pt, runWithSlackInstallationToken as q, getDb as qt, createPluginHookRunner as r, agentTurnCostUsd as rn, RESOURCE_SUBSCRIPTION_MAX_TTL_MS as rt, getPluginSystemPromptContributions as s, resolveRootConversationId as sn, cancelWatch as st, agent_hooks_exports as t, parseSessionSource as tn, getSlackToolContext as tt, getPlugins as u, upsertLinkedIdentity as un, deliverWatch as ut, getWorkspace as v, createPluginEmbedder as vt, loadSnapshotsForProfile as w, conversationArchivedForUser as wt, updateWorkspace as x, readConversationAccessFromSql as xt, getWorkspaceByName as y, createPluginModel as yt, SlackActionError as z, JUNIOR_NATIVE_EVENT_NAMESPACE as zt };
|