@sentry/junior 0.278.0 → 0.280.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/{actor-B4DYygOB.js → actor-6jsm_v96.js} +1 -1
- package/dist/{adapter-BXosqTMx.js → adapter-DVN3iwf9.js} +1 -1
- package/dist/{admin-Thn7NfOi.js → admin-Q_UI--9W.js} +1 -1
- package/dist/{agent-runner-DE-43MPb.js → agent-runner-_PYLv4Qo.js} +79 -39
- package/dist/api/schema.d.ts +2 -2
- package/dist/api/schema.js +7 -7
- package/dist/api.d.ts +3 -3
- package/dist/api.js +184 -418
- package/dist/{app-CHNS-AX2.d.ts → app-CL2zzzE0.d.ts} +5 -5
- package/dist/app.d.ts +1 -1
- package/dist/app.js +462 -80
- package/dist/{assistant-reply-pauL6qyn.js → assistant-reply-DbebsAxi.js} +1 -1
- package/dist/{automation-DphoTRYl.js → automation-CPqRFjIa.js} +2 -2
- package/dist/{background-compaction-queue-CAL4A2y7.js → background-compaction-queue-B9lmh8Ml.js} +3 -3
- package/dist/{briefs-4fyPJJEu.js → briefs-Dej7V0Bz.js} +11 -10
- package/dist/{catalog-runtime-BoOb5oUv.js → catalog-runtime-DpN0sWQ6.js} +2 -2
- package/dist/cli/chat.js +16 -16
- package/dist/cli/check.js +3 -3
- package/dist/cli/main.js +4 -4
- package/dist/cli/plugins.js +5 -5
- package/dist/cli/snapshot-create.js +4 -4
- package/dist/cli/upgrade.d.ts +1 -1
- package/dist/cli/upgrade.js +4 -4
- package/dist/{client-v_OVYuHZ.js → client-h2A2ZPzY.js} +7 -3
- package/dist/{config-o2jLRY5J.js → config-CusBFORe.js} +3 -3
- package/dist/{connections-RC4NXAx8.js → connections-C4h6mGha.js} +11 -11
- package/dist/{conversation-CZfyQvdm.js → conversation-DExTZw8B.js} +22 -7
- package/dist/conversation-pending-messages-Dgz6hrJs.js +173 -0
- package/dist/{conversation-privacy-C23M8KaD.js → conversation-privacy-2cm6OpNg.js} +1 -1
- package/dist/{credential-sync-Dd0WyNfF.js → credential-sync-DK06Jgt-.js} +17 -17
- package/dist/{db-BjLzDJCt.d.ts → db-Dsvk1Tp1.d.ts} +2 -2
- package/dist/{executor-CJfsD0VX.js → executor-Cmr0J8W3.js} +152 -7
- package/dist/instrumentation.d.ts +12 -0
- package/dist/instrumentation.js +56 -23
- package/dist/{logging-dFaXvBRK.js → logging-CGnh65_X.js} +2 -2
- package/dist/{media-DTAA8Qs_.js → media-Dq9_svfQ.js} +1 -1
- package/dist/{message-DSwxIZet.js → message-RpAnqHPY.js} +10 -10
- package/dist/nitro.d.ts +1 -1
- package/dist/nitro.js +18 -6
- package/dist/{oauth-callback-server-CDcuCp27.js → oauth-callback-server-BBnhVKuX.js} +2 -2
- package/dist/{oauth-relay-C6ZAyJgf.js → oauth-relay-D6xxVywK.js} +2 -2
- package/dist/{package-discovery-DJBompdd.js → package-discovery-DJhGdS4c.js} +1 -1
- package/dist/{plugins-DOm9Y6qI.js → plugins-HYh_JOdw.js} +1 -1
- package/dist/{projection-BTge9wrH.js → projection-C1MghKyI.js} +257 -137
- package/dist/{prompt-DDtCnlHP.js → prompt-BcHg-BMy.js} +2 -2
- package/dist/proxy-path-BHYoKZdq.js +15 -0
- package/dist/{queue-C37RbDVc.d.ts → queue-CZyYgPF0.d.ts} +1 -1
- package/dist/{registry-Cp6CNmtP.js → registry-DR7DjX9H.js} +4 -4
- package/dist/{reporting-window-DgHgwQB3.js → reporting-window-B-QP9zX1.js} +28 -2
- package/dist/{resolve-B_7h2cXx.js → resolve-0Ful4oDv.js} +4 -4
- package/dist/{result-5LBEfnLX.js → result-Dd9kCuQ-.js} +12 -12
- package/dist/{runner-C5-S4oq-.js → runner-yiY8gUUu.js} +11 -11
- package/dist/{sandbox-egress-signals-B4GehT1L.js → sandbox-egress-signals-BzQVHCMz.js} +1 -1
- package/dist/{schema-Tr484cCC.d.ts → schema-BkMmF552.d.ts} +1232 -222
- package/dist/{schema-B5fpczDw.js → schema-C5pEgfHc.js} +30 -70
- package/dist/sentry-BRTJqumy.js +51 -0
- package/dist/sentry-DrKC2NeM.d.ts +1 -0
- package/dist/sentry-route-name-BhwWnfqj.js +51 -0
- package/dist/{service-account-Cq_dLrZJ.js → service-account-Cu7HFLZQ.js} +3 -3
- package/dist/{service-account-BkEv20zf.js → service-account-PIMpWZHF.js} +3 -3
- package/dist/{session-stop-BsS4qFS2.js → session-stop-CDEMsNtv.js} +14 -15
- package/dist/{skills-M0BA0_s6.js → skills-B2xIoe0f.js} +5 -5
- package/dist/{spawn-BO3y7H4d.js → spawn-C0DySQRV.js} +3 -3
- package/dist/{stop-D5R82Wla.js → stop-Dj5-nrAo.js} +740 -285
- package/dist/{store-BGBzQWNf.js → store-Dlio-o6u.js} +6 -6
- package/dist/{store-CGJZTEVz.js → store-QzOfDwKA.js} +3 -3
- package/dist/{task-queue-UD27ei2U.js → task-queue-Cp1V_XW3.js} +4 -4
- package/dist/{task-runner-noxjOjkM.js → task-runner-CQkkUj3o.js} +23 -11
- package/dist/{thread-state-BSu6rM6p.js → thread-state-Bn87cfzE.js} +4 -4
- package/dist/{turn-failure-response-wahwyPrZ.js → turn-failure-response-CQebxByj.js} +8 -8
- package/dist/{turn-lifecycle-Bo4Trccw.js → turn-lifecycle-CJJsOhXB.js} +1 -1
- package/dist/{turn-session-routing-DnSaaEpn.js → turn-session-routing-bmG330Cf.js} +10 -11
- package/dist/{validation-B9-8iKyw.js → validation-D1wcf7hp.js} +2 -2
- package/dist/{version-C7HejFP2.js → version-BeHSXUK6.js} +1 -1
- package/dist/version.js +1 -1
- package/dist/{viewer-DLXajQZE.js → viewer-BZ0Hp5Nb.js} +6 -7
- package/dist/{work-DRGSlfia.js → work-BTcCIbWu.js} +12 -12
- package/dist/{worker-BGh5Dwc6.js → worker-D3fDK6zc.js} +7 -7
- package/migrations/0077_drop_agent_invocation_model_profile.sql +1 -0
- package/migrations/0078_plugin_conversation_index.sql +20 -0
- package/migrations/0079_conversation_event_author_index.sql +20 -0
- package/migrations/meta/0077_snapshot.json +4141 -0
- package/migrations/meta/0078_snapshot.json +4175 -0
- package/migrations/meta/0079_snapshot.json +4203 -0
- package/migrations/meta/_journal.json +21 -0
- package/package.json +4 -4
- package/dist/agent-invocations-D7c4BQGc.js +0 -182
- package/dist/common-Eu6sx09c.js +0 -107
- package/dist/rolldown-runtime-nwUcYXjP.js +0 -27
- package/dist/sentry-MDkYAVPV.js +0 -23
|
@@ -1,28 +1,27 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { i as getChatConfig, n as botConfig, o as getSlackBotToken, v as normalizeSlackEmojiName } from "./config-
|
|
4
|
-
import { E as withSpan, G as toOptionalNumber, K as toOptionalString, W as isRecord$2, a as extractGenAiUsageSummary, b as setSpanAttributes, c as getLogContextAttributes, d as logAudit, h as logWarn, m as logInfo, o as getActiveTraceContext, p as logException, t as buildTurnFailureResponse, y as setSentryUser } from "./logging-
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import { _ as CredentialUnavailableError, a as resolveAuthTokenPlaceholder, f as credentialContextForActor, h as credentialSubjectSchema, m as credentialLogContext, o as resolvePluginCommandEnv, p as credentialContextSchema } from "./registry-Cp6CNmtP.js";
|
|
13
|
-
import { n as pluginCatalogRuntime } from "./catalog-runtime-BoOb5oUv.js";
|
|
1
|
+
import { a as getClient$1, n as captureMessage, r as continueTrace, v as __exportAll } from "./sentry-BRTJqumy.js";
|
|
2
|
+
import { a as completeText, c as resolveGatewayModel, i as completeObject, m as escapeXml, o as embedTexts, p as unwrapCurrentInstruction, r as completeDecision, s as rerankTexts, t as GEN_AI_PROVIDER_NAME, w as toOptionalTrimmed, x as isProviderRetryError } from "./client-h2A2ZPzY.js";
|
|
3
|
+
import { i as getChatConfig, n as botConfig, o as getSlackBotToken, v as normalizeSlackEmojiName } from "./config-CusBFORe.js";
|
|
4
|
+
import { E as withSpan, G as toOptionalNumber, K as toOptionalString, W as isRecord$2, _ as runBestEffort, a as extractGenAiUsageSummary, b as setSpanAttributes, c as getLogContextAttributes, d as logAudit, h as logWarn, m as logInfo, o as getActiveTraceContext, p as logException, t as buildTurnFailureResponse, y as setSentryUser } from "./logging-CGnh65_X.js";
|
|
5
|
+
import { t as canExposeConversationPayload } from "./conversation-privacy-2cm6OpNg.js";
|
|
6
|
+
import { c as parseStoredSlackActor, d as parseSlackChannelReferenceId, f as parseSlackTeamId, h as parseSlackMessageTs, i as isActorUserId, l as toStoredSlackActor, p as parseSlackUserId, s as parseActorUserId } from "./actor-6jsm_v96.js";
|
|
7
|
+
import { C as getSqlExecutor, D as createSqlConversationEventStore, G as bindProviderConversation, I as resolveActorIdentityId, O as eventFromRow, P as startLocationThread, S as getDb, U as saveUserTimezone, V as readUserTimezone, X as addAgentTurnUsage, at as sameDestination, et as hasAgentTurnUsage, g as createCache, i as readActorIdentity, j as createSqlStore, k as withConversationEventLock, l as resolveViewerUser, n as findUserByEmailFromSql, o as readIdentityById, p as parseAvatarUrl, q as conversationDetailTouch, rt as parseDestination, s as readIdentityByIdFromSql, tt as resolveRootConversationId, x as getConversationStore, y as getConversationEventStore } from "./viewer-BZ0Hp5Nb.js";
|
|
8
|
+
import { A as juniorIdentities, D as juniorAttachments, E as juniorCodeRepositories, M as juniorDestinations, S as juniorConversationEvents, T as juniorCodeChanges, _ as juniorConversationParticipants, a as juniorReviewItemAssignees, c as juniorReviewItems, d as juniorAutomations, i as juniorWorkspaces, j as juniorUsers, k as juniorConversations, n as juniorSnapshots, o as juniorReviewItemConversations, p as juniorLocationConfigurations, r as juniorWorkspaceRepos, w as juniorConversationAnnotations, y as juniorConversationBriefs } from "./executor-Cmr0J8W3.js";
|
|
9
|
+
import { a as agentHistoryItemSchema, g as instructionProvenanceFor, h as instructionActors, m as contextProvenance } from "./media-Dq9_svfQ.js";
|
|
10
|
+
import { _ as CredentialUnavailableError, a as resolveAuthTokenPlaceholder, f as credentialContextForActor, h as credentialSubjectSchema, m as credentialLogContext, o as resolvePluginCommandEnv, p as credentialContextSchema } from "./registry-DR7DjX9H.js";
|
|
11
|
+
import { n as pluginCatalogRuntime } from "./catalog-runtime-DpN0sWQ6.js";
|
|
14
12
|
import { a as withLock, i as fenceLock, n as MUTATION_LOCK_TTL_MS, r as acquireActiveLock } from "./locks-D-0h111u.js";
|
|
15
|
-
import { n as getDefaultRedisStateAdapterFor, r as getStateAdapter } from "./adapter-
|
|
13
|
+
import { n as getDefaultRedisStateAdapterFor, r as getStateAdapter } from "./adapter-DVN3iwf9.js";
|
|
16
14
|
import { i as isValidTimeZone } from "./cadence-R7Em4RjE.js";
|
|
17
|
-
import { A as messageCardRef, H as conversationBriefSchema, M as readMessageCardRefs, O as reviewItemChangeRecordSchema, R as readMessageAttachments, U as parseBriefInput, _ as conversationReportMessageEventSchema, g as conversationReportEventSchema } from "./conversation-
|
|
18
|
-
import { n as briefEntriesFromReportEvents, s as generateBrief, t as BRIEF_PROMPT } from "./prompt-
|
|
15
|
+
import { A as messageCardRef, H as conversationBriefSchema, M as readMessageCardRefs, O as reviewItemChangeRecordSchema, R as readMessageAttachments, U as parseBriefInput, _ as conversationReportMessageEventSchema, g as conversationReportEventSchema } from "./conversation-DExTZw8B.js";
|
|
16
|
+
import { n as briefEntriesFromReportEvents, s as generateBrief, t as BRIEF_PROMPT } from "./prompt-BcHg-BMy.js";
|
|
17
|
+
import { n as redactSandboxEgressProxyPath, t as SANDBOX_EGRESS_PROXY_PATH } from "./proxy-path-BHYoKZdq.js";
|
|
19
18
|
import path from "node:path";
|
|
20
19
|
import { isDeepStrictEqual } from "node:util";
|
|
21
20
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
22
21
|
import { createHash, createHmac, createPrivateKey, createPublicKey, generateKeyPairSync, randomBytes, randomUUID, sign, timingSafeEqual } from "node:crypto";
|
|
23
|
-
import
|
|
22
|
+
import * as z from "zod";
|
|
24
23
|
import { and, arrayContains, asc, count, desc, eq, exists, getTableColumns, gt, gte, ilike, inArray, isNotNull, isNull, lt, lte, max, ne, notExists, or, sql } from "drizzle-orm";
|
|
25
|
-
import { EgressAuthRequired, EgressPolicyDenied, actorSchema, codeChangeInputSchema, conversationAnnotationInputSchema, conversationEventPresentationSchema, defineConversationEvent, destinationSchema, eventDataSchema, eventInputSchema, eventMatchSchema, eventMatches, eventTypeSchema, missingToolAnnotationKeys, normalizeEventIdentifier, objectAnnotationSchema, objectIconPath, objectTypeSchema, pluginAuthorizationSchema, pluginCredentialHeaderTransformSchema, pluginCredentialResultSchema, pluginEventsSchema, pluginGrantSchema, pluginProviderAccountSchema, pluginStoredTokensSchema, promptContextSchema, promptMessageSchema, sourceSchema, stableEventMatchKey } from "@sentry/junior-plugin-api";
|
|
24
|
+
import { EgressAuthRequired, EgressPolicyDenied, actorSchema, codeChangeInputSchema, conversationAnnotationInputSchema, conversationEventPresentationSchema, defineConversationEvent, destinationSchema, eventDataSchema, eventInputSchema, eventMatchSchema, eventMatches, eventTypeSchema, isPluginModelCostEventName, missingToolAnnotationKeys, normalizeEventIdentifier, objectAnnotationSchema, objectIconPath, objectTypeSchema, pluginAuthorizationSchema, pluginCredentialHeaderTransformSchema, pluginCredentialResultSchema, pluginEventsSchema, pluginGrantSchema, pluginModelCostEventNames, pluginProviderAccountSchema, pluginStoredTokensSchema, promptContextSchema, promptMessageSchema, sourceSchema, stableEventMatchKey } from "@sentry/junior-plugin-api";
|
|
26
25
|
import { alias, union } from "drizzle-orm/pg-core";
|
|
27
26
|
import fs from "node:fs/promises";
|
|
28
27
|
import http from "node:http";
|
|
@@ -259,7 +258,7 @@ function historyItemProvenance(data) {
|
|
|
259
258
|
* Host-only events are filtered, completed authorization becomes a synthetic
|
|
260
259
|
* observation, and `maxSeq` reproduces an exact committed boundary.
|
|
261
260
|
*/
|
|
262
|
-
function projectConversationEvents(events, options = {}) {
|
|
261
|
+
function projectConversationEvents$1(events, options = {}) {
|
|
263
262
|
const messages = [];
|
|
264
263
|
const provenance = [];
|
|
265
264
|
const seqs = [];
|
|
@@ -1441,91 +1440,141 @@ async function readConversationEventRows(executor, args) {
|
|
|
1441
1440
|
end`
|
|
1442
1441
|
}).from(juniorConversationEvents).where(and(eq(juniorConversationEvents.conversationId, args.conversationId), args.beforeSeq === void 0 ? void 0 : lt(juniorConversationEvents.seq, args.beforeSeq), args.afterSeq === void 0 ? void 0 : gt(juniorConversationEvents.seq, args.afterSeq), inArray(juniorConversationEvents.type, args.types ?? [...conversationReportSourceEventTypes]), args.subagentInvocationIds === void 0 ? void 0 : inArray(sql`${juniorConversationEvents.payload}->>'subagentInvocationId'`, args.subagentInvocationIds), args.toolCallIds === void 0 ? void 0 : inArray(sql`${juniorConversationEvents.payload}->>'toolCallId'`, args.toolCallIds))).orderBy(args.direction === "forward" ? asc(juniorConversationEvents.seq) : desc(juniorConversationEvents.seq)).limit(args.limit);
|
|
1443
1442
|
}
|
|
1444
|
-
/**
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
limit: 1,
|
|
1462
|
-
types: ["assistant_message"]
|
|
1463
|
-
})])).flat().sort((left, right) => left.seq - right.seq) : [];
|
|
1464
|
-
const endedInvocationIds = [...new Set(events.flatMap((event) => event.data.type === "subagent_ended" ? [event.data.subagentInvocationId] : []))];
|
|
1465
|
-
const subagentStartRows = endedInvocationIds.length === 0 ? [] : await readConversationEventRows(executor, {
|
|
1466
|
-
conversationId: args.conversationId,
|
|
1467
|
-
direction: "forward",
|
|
1468
|
-
limit: endedInvocationIds.length,
|
|
1469
|
-
subagentInvocationIds: endedInvocationIds,
|
|
1470
|
-
types: ["subagent_started"]
|
|
1471
|
-
});
|
|
1472
|
-
const [firstTurnStartRow] = await readConversationEventRows(executor, {
|
|
1473
|
-
conversationId: args.conversationId,
|
|
1443
|
+
/**
|
|
1444
|
+
* Read the last Turn end before the `turns`-th latest Turn start. Its seq is
|
|
1445
|
+
* null when the Conversation has fewer Turns, or no Turn ended before them.
|
|
1446
|
+
*
|
|
1447
|
+
* Input messages are written before their `turn_started`, so a page of the
|
|
1448
|
+
* latest Turns starts after the Turn before them, not at the start event.
|
|
1449
|
+
*/
|
|
1450
|
+
function readLatestTurnsPageStart(executor, conversationId, turns) {
|
|
1451
|
+
const started = alias(juniorConversationEvents, "started");
|
|
1452
|
+
const ended = alias(juniorConversationEvents, "ended");
|
|
1453
|
+
const turnStart = executor.db().select({ seq: started.seq }).from(started).where(and(eq(started.conversationId, conversationId), eq(started.type, "turn_started"))).orderBy(desc(started.seq)).offset(turns - 1).limit(1);
|
|
1454
|
+
return executor.db().select({ seq: max(ended.seq) }).from(ended).where(and(eq(ended.conversationId, conversationId), inArray(ended.type, ["turn_completed", "turn_failed"]), lt(ended.seq, sql`(${turnStart})`)));
|
|
1455
|
+
}
|
|
1456
|
+
/** Read the first Turn start, which marks history inherited from a fork. */
|
|
1457
|
+
async function readFirstTurnStart(executor, conversationId) {
|
|
1458
|
+
const [row] = await readConversationEventRows(executor, {
|
|
1459
|
+
conversationId,
|
|
1474
1460
|
direction: "forward",
|
|
1475
1461
|
limit: 1,
|
|
1476
1462
|
types: ["turn_started"]
|
|
1477
1463
|
});
|
|
1464
|
+
return row ? eventFromRow(row) : void 0;
|
|
1465
|
+
}
|
|
1466
|
+
/** Resolve entity starts that precede the page, then project it once. */
|
|
1467
|
+
async function projectConversationEvents(executor, args) {
|
|
1468
|
+
const events = args.events.sort((left, right) => left.seq - right.seq);
|
|
1469
|
+
const firstSeq = events[0]?.seq;
|
|
1470
|
+
const endedInvocationIds = [...new Set(events.flatMap((event) => event.data.type === "subagent_ended" ? [event.data.subagentInvocationId] : []))];
|
|
1478
1471
|
const toolResultIds = conversationReportToolResultIds(events);
|
|
1479
|
-
const
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1472
|
+
const [turnBoundaryRows, modelCallRows, subagentStartRows, toolStartRows] = await Promise.all([
|
|
1473
|
+
firstSeq === void 0 ? [] : readConversationEventRows(executor, {
|
|
1474
|
+
conversationId: args.conversationId,
|
|
1475
|
+
beforeSeq: firstSeq,
|
|
1476
|
+
direction: "backward",
|
|
1477
|
+
limit: 1,
|
|
1478
|
+
types: [
|
|
1479
|
+
"turn_started",
|
|
1480
|
+
"turn_completed",
|
|
1481
|
+
"turn_failed"
|
|
1482
|
+
]
|
|
1483
|
+
}),
|
|
1484
|
+
firstSeq === void 0 ? [] : readConversationEventRows(executor, {
|
|
1485
|
+
conversationId: args.conversationId,
|
|
1486
|
+
beforeSeq: firstSeq,
|
|
1487
|
+
direction: "backward",
|
|
1488
|
+
limit: 1,
|
|
1489
|
+
types: ["assistant_message"]
|
|
1490
|
+
}),
|
|
1491
|
+
endedInvocationIds.length === 0 ? [] : readConversationEventRows(executor, {
|
|
1492
|
+
conversationId: args.conversationId,
|
|
1493
|
+
direction: "forward",
|
|
1494
|
+
limit: endedInvocationIds.length,
|
|
1495
|
+
subagentInvocationIds: endedInvocationIds,
|
|
1496
|
+
types: ["subagent_started"]
|
|
1497
|
+
}),
|
|
1498
|
+
toolResultIds.length === 0 ? [] : readConversationEventRows(executor, {
|
|
1499
|
+
conversationId: args.conversationId,
|
|
1500
|
+
direction: "forward",
|
|
1501
|
+
limit: toolResultIds.length,
|
|
1502
|
+
toolCallIds: toolResultIds,
|
|
1503
|
+
types: ["tool_execution_started"]
|
|
1504
|
+
}),
|
|
1505
|
+
args.canExposePayload ? hydrateMessageAttachments(executor, args.conversationId, events) : void 0
|
|
1506
|
+
]);
|
|
1487
1507
|
return projectConversationReportEventPage({
|
|
1488
1508
|
canExposePayload: args.canExposePayload,
|
|
1489
1509
|
events,
|
|
1490
|
-
...
|
|
1510
|
+
...args.firstTurnStart ? { firstTurnStart: args.firstTurnStart } : void 0,
|
|
1491
1511
|
subagentStartEvents: subagentStartRows.map(eventFromRow),
|
|
1492
1512
|
toolStartEvents: toolStartRows.map(eventFromRow),
|
|
1493
|
-
modelContextEvents:
|
|
1513
|
+
modelContextEvents: [...turnBoundaryRows, ...modelCallRows].sort((left, right) => left.seq - right.seq).map(eventFromRow)
|
|
1494
1514
|
});
|
|
1495
1515
|
}
|
|
1496
1516
|
/**
|
|
1497
|
-
*
|
|
1517
|
+
* Scan source rows in bounded chunks until more than `limit` reporting
|
|
1518
|
+
* events are known, then project the scanned rows once.
|
|
1498
1519
|
*
|
|
1499
|
-
*
|
|
1500
|
-
*
|
|
1501
|
-
* assuming every agent history event produces a reporting event.
|
|
1520
|
+
* Each chunk is decoded once. A chunk is counted without the entity starts
|
|
1521
|
+
* that precede it, which can only undercount, so the scan never stops early.
|
|
1502
1522
|
*/
|
|
1503
|
-
async function
|
|
1523
|
+
async function scanConversationEventPage(executor, args) {
|
|
1504
1524
|
const scanSize = Math.max(args.limit + 1, MIN_SCAN_SIZE);
|
|
1505
|
-
const
|
|
1506
|
-
|
|
1507
|
-
let
|
|
1508
|
-
|
|
1509
|
-
|
|
1525
|
+
const firstTurnStartRead = readFirstTurnStart(executor, args.conversationId);
|
|
1526
|
+
const events = [];
|
|
1527
|
+
let { afterSeq, beforeSeq } = args;
|
|
1528
|
+
let firstTurnStart;
|
|
1529
|
+
let counted = 0;
|
|
1530
|
+
while (counted <= args.limit) {
|
|
1531
|
+
const [batch, turnStart] = await Promise.all([readConversationEventRows(executor, {
|
|
1532
|
+
afterSeq,
|
|
1510
1533
|
beforeSeq,
|
|
1511
1534
|
conversationId: args.conversationId,
|
|
1512
|
-
direction:
|
|
1535
|
+
direction: args.direction,
|
|
1513
1536
|
limit: scanSize
|
|
1514
|
-
});
|
|
1537
|
+
}), firstTurnStartRead]);
|
|
1538
|
+
firstTurnStart = turnStart;
|
|
1515
1539
|
if (batch.length === 0) break;
|
|
1516
|
-
|
|
1517
|
-
|
|
1540
|
+
const decoded = batch.map(eventFromRow).sort((left, right) => left.seq - right.seq);
|
|
1541
|
+
events.push(...decoded);
|
|
1542
|
+
counted += projectConversationReportEventPage({
|
|
1518
1543
|
canExposePayload: args.canExposePayload,
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
});
|
|
1522
|
-
if (
|
|
1523
|
-
beforeSeq = batch.at(-1).seq;
|
|
1524
|
-
|
|
1544
|
+
events: decoded,
|
|
1545
|
+
...firstTurnStart ? { firstTurnStart } : void 0
|
|
1546
|
+
}).length;
|
|
1547
|
+
if (batch.length < scanSize) break;
|
|
1548
|
+
if (args.direction === "backward") beforeSeq = batch.at(-1).seq;
|
|
1549
|
+
else afterSeq = batch.at(-1).seq;
|
|
1550
|
+
}
|
|
1551
|
+
return projectConversationEvents(executor, {
|
|
1552
|
+
canExposePayload: args.canExposePayload,
|
|
1553
|
+
conversationId: args.conversationId,
|
|
1554
|
+
events,
|
|
1555
|
+
...firstTurnStart ? { firstTurnStart } : void 0
|
|
1556
|
+
});
|
|
1557
|
+
}
|
|
1558
|
+
/**
|
|
1559
|
+
* Read the latest reporting events before an exclusive boundary.
|
|
1560
|
+
*
|
|
1561
|
+
* Not every agent history event produces a reporting event, so source rows
|
|
1562
|
+
* are scanned until the requested page and one older event are known. With
|
|
1563
|
+
* `latestTurns`, the page also starts after the Turn before the latest
|
|
1564
|
+
* Turns, so it holds whole Turns when they fit in `limit`.
|
|
1565
|
+
*/
|
|
1566
|
+
async function readConversationEventPage(executor, args) {
|
|
1567
|
+
const { latestTurns, ...pageArgs } = args;
|
|
1568
|
+
const pageStart = latestTurns === void 0 ? void 0 : readLatestTurnsPageStart(executor, args.conversationId, latestTurns);
|
|
1569
|
+
const [projected, startRows] = await Promise.all([scanConversationEventPage(executor, {
|
|
1570
|
+
...pageArgs,
|
|
1571
|
+
...pageStart ? { afterSeq: sql`coalesce((${pageStart}), -1)` } : void 0,
|
|
1572
|
+
direction: "backward"
|
|
1573
|
+
}), pageStart]);
|
|
1525
1574
|
const events = projected.slice(-args.limit);
|
|
1526
1575
|
return {
|
|
1527
1576
|
events,
|
|
1528
|
-
...projected.length > events.length && events[0] ? { previousSeq: events[0].seq } : void 0
|
|
1577
|
+
...(projected.length > events.length || (startRows?.[0]?.seq ?? null) !== null) && events[0] ? { previousSeq: events[0].seq } : void 0
|
|
1529
1578
|
};
|
|
1530
1579
|
}
|
|
1531
1580
|
/**
|
|
@@ -1561,33 +1610,26 @@ async function readConversationEventPageAround(executor, args) {
|
|
|
1561
1610
|
* page around the read position, so this page reads nothing before it.
|
|
1562
1611
|
*/
|
|
1563
1612
|
async function readConversationEventPageAfter(executor, args) {
|
|
1564
|
-
const
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
while (projected.length <= args.limit) {
|
|
1569
|
-
const batch = await readConversationEventRows(executor, {
|
|
1570
|
-
afterSeq,
|
|
1571
|
-
conversationId: args.conversationId,
|
|
1572
|
-
direction: "forward",
|
|
1573
|
-
limit: scanSize
|
|
1574
|
-
});
|
|
1575
|
-
if (batch.length === 0) break;
|
|
1576
|
-
rows.push(...batch);
|
|
1577
|
-
projected = await projectConversationEventRows(executor, {
|
|
1578
|
-
canExposePayload: args.canExposePayload,
|
|
1579
|
-
conversationId: args.conversationId,
|
|
1580
|
-
rows
|
|
1581
|
-
});
|
|
1582
|
-
if (projected.length > args.limit || batch.length < scanSize) break;
|
|
1583
|
-
afterSeq = batch.at(-1).seq;
|
|
1584
|
-
}
|
|
1613
|
+
const projected = await scanConversationEventPage(executor, {
|
|
1614
|
+
...args,
|
|
1615
|
+
direction: "forward"
|
|
1616
|
+
});
|
|
1585
1617
|
const events = projected.slice(0, args.limit);
|
|
1586
1618
|
return {
|
|
1587
1619
|
events,
|
|
1588
1620
|
...projected.length > events.length ? { nextSeq: events.at(-1).seq } : void 0
|
|
1589
1621
|
};
|
|
1590
1622
|
}
|
|
1623
|
+
/** Read the newest event position, or -1 before the first event. */
|
|
1624
|
+
async function readConversationLastEventSeq(executor, conversationId) {
|
|
1625
|
+
const [row] = await executor.db().select({ seq: max(juniorConversationEvents.seq) }).from(juniorConversationEvents).where(eq(juniorConversationEvents.conversationId, conversationId));
|
|
1626
|
+
return row?.seq ?? -1;
|
|
1627
|
+
}
|
|
1628
|
+
/** Read the transcript position of one Message, when a Turn has read it. */
|
|
1629
|
+
async function readConversationMessageEventSeq(executor, conversationId, messageId) {
|
|
1630
|
+
const [row] = await executor.db().select({ seq: juniorConversationEvents.seq }).from(juniorConversationEvents).where(and(eq(juniorConversationEvents.conversationId, conversationId), eq(juniorConversationEvents.type, "message"), sql`${juniorConversationEvents.payload}->>'messageId' = ${messageId}`)).orderBy(asc(juniorConversationEvents.seq)).limit(1);
|
|
1631
|
+
return row?.seq;
|
|
1632
|
+
}
|
|
1591
1633
|
// src/chat/briefs/input.ts
|
|
1592
1634
|
const EVENT_PAGE_SIZE = 500;
|
|
1593
1635
|
async function readReportEventsThrough(executor, conversationId, throughSeq) {
|
|
@@ -1809,6 +1851,14 @@ async function readLatestConversationBrief(db, conversationId) {
|
|
|
1809
1851
|
const rows = await db.select().from(juniorConversationBriefs).where(eq(juniorConversationBriefs.conversationId, conversationId)).orderBy(desc(juniorConversationBriefs.version)).limit(1);
|
|
1810
1852
|
return rows[0] ? briefVersionFromRow(rows[0]) : void 0;
|
|
1811
1853
|
}
|
|
1854
|
+
/**
|
|
1855
|
+
* Read the newest Brief version that covers no event after `seq`. That is the
|
|
1856
|
+
* Brief as a reader saw it when they stopped at `seq`.
|
|
1857
|
+
*/
|
|
1858
|
+
async function readConversationBriefThrough(db, conversationId, seq) {
|
|
1859
|
+
const rows = await db.select().from(juniorConversationBriefs).where(and(eq(juniorConversationBriefs.conversationId, conversationId), lte(juniorConversationBriefs.throughSeq, seq))).orderBy(desc(juniorConversationBriefs.version)).limit(1);
|
|
1860
|
+
return rows[0] ? briefVersionFromRow(rows[0]) : void 0;
|
|
1861
|
+
}
|
|
1812
1862
|
// src/chat/briefs/task.ts
|
|
1813
1863
|
const BRIEF_LOCK_TTL_MS = 6e5;
|
|
1814
1864
|
function hasUserInstruction(run) {
|
|
@@ -1873,7 +1923,7 @@ async function updateConversationBrief(context) {
|
|
|
1873
1923
|
return;
|
|
1874
1924
|
}
|
|
1875
1925
|
const input = await briefInputFromSql(executor, run.conversationId, terminalSeq);
|
|
1876
|
-
const modelId = botConfig.
|
|
1926
|
+
const modelId = botConfig.fastModelId;
|
|
1877
1927
|
const generation = await generateBrief({
|
|
1878
1928
|
completeObject: (request) => completeObject({
|
|
1879
1929
|
...request,
|
|
@@ -2104,11 +2154,13 @@ function createPluginConversationEventReader(plugin) {
|
|
|
2104
2154
|
return (await db.select({
|
|
2105
2155
|
content: sql`${juniorConversationEvents.payload}->'content'`,
|
|
2106
2156
|
createdAt: juniorConversationEvents.createdAt,
|
|
2157
|
+
seq: juniorConversationEvents.seq,
|
|
2107
2158
|
turnId: sql`${juniorConversationEvents.payload}->>'turnId'`,
|
|
2108
2159
|
version: sql`(${juniorConversationEvents.payload}->>'version')::integer`
|
|
2109
2160
|
}).from(juniorConversationEvents).where(and(eq(juniorConversationEvents.conversationId, input.conversationId), eq(juniorConversationEvents.type, "structured_event"), sql`${juniorConversationEvents.payload}->>'namespace' = ${plugin.manifest.name}`, sql`${juniorConversationEvents.payload}->>'name' = ${eventName}`)).orderBy(desc(juniorConversationEvents.seq))).map((row) => ({
|
|
2110
2161
|
content: row.content,
|
|
2111
2162
|
createdAt: row.createdAt.toISOString(),
|
|
2163
|
+
seq: row.seq,
|
|
2112
2164
|
...row.turnId ? { turnId: row.turnId } : void 0,
|
|
2113
2165
|
version: row.version
|
|
2114
2166
|
}));
|
|
@@ -2127,7 +2179,7 @@ function startOfUtcDay(value) {
|
|
|
2127
2179
|
return date;
|
|
2128
2180
|
}
|
|
2129
2181
|
function registeredEventName(plugin, eventName) {
|
|
2130
|
-
if (!plugin.conversationEvents?.some((definition) => definition.eventName === eventName)) throw new TypeError(`Plugin "${plugin.manifest.name}" did not register event "${eventName}"`);
|
|
2182
|
+
if (!isPluginModelCostEventName(eventName) && !plugin.conversationEvents?.some((definition) => definition.eventName === eventName)) throw new TypeError(`Plugin "${plugin.manifest.name}" did not register event "${eventName}"`);
|
|
2131
2183
|
return eventName;
|
|
2132
2184
|
}
|
|
2133
2185
|
/** Create aggregate event-cost reads bound to one plugin's registered namespace. */
|
|
@@ -2221,6 +2273,37 @@ function createPluginLogger(plugin) {
|
|
|
2221
2273
|
}
|
|
2222
2274
|
};
|
|
2223
2275
|
}
|
|
2276
|
+
// src/chat/plugins/model-cost.ts
|
|
2277
|
+
/**
|
|
2278
|
+
* Bind plugin model cost to one Conversation. Each priced call becomes an
|
|
2279
|
+
* event in the plugin's namespace, so Conversation cost counts it without
|
|
2280
|
+
* the plugin reporting it. A failed write is logged, not thrown, so it
|
|
2281
|
+
* cannot discard a model result that already succeeded.
|
|
2282
|
+
*/
|
|
2283
|
+
function createPluginModelCostRecorder(args) {
|
|
2284
|
+
return async ({ costUsd, modelRole }) => {
|
|
2285
|
+
await runBestEffort(async () => {
|
|
2286
|
+
await getConversationEventStore().append(args.conversationId, [{
|
|
2287
|
+
createdAtMs: Date.now(),
|
|
2288
|
+
data: {
|
|
2289
|
+
type: "structured_event",
|
|
2290
|
+
namespace: args.pluginName,
|
|
2291
|
+
name: pluginModelCostEventNames[args.source],
|
|
2292
|
+
version: 1,
|
|
2293
|
+
...args.turnId ? { turnId: args.turnId } : void 0,
|
|
2294
|
+
content: {
|
|
2295
|
+
costUsd,
|
|
2296
|
+
modelRole,
|
|
2297
|
+
...args.toolName ? { toolName: args.toolName } : void 0
|
|
2298
|
+
}
|
|
2299
|
+
}
|
|
2300
|
+
}], { activity: "preserve" });
|
|
2301
|
+
}, "plugin.model_cost.record.failed", {
|
|
2302
|
+
"app.plugin.name": args.pluginName,
|
|
2303
|
+
"gen_ai.tool.name": args.toolName
|
|
2304
|
+
});
|
|
2305
|
+
};
|
|
2306
|
+
}
|
|
2224
2307
|
// src/chat/sandbox/noninteractive-command.ts
|
|
2225
2308
|
const NON_INTERACTIVE_ENV = {
|
|
2226
2309
|
CI: "1",
|
|
@@ -2410,6 +2493,10 @@ function createPluginModel(pluginName, options = {}, runtime = {}) {
|
|
|
2410
2493
|
pluginModelRole: "structured"
|
|
2411
2494
|
}
|
|
2412
2495
|
});
|
|
2496
|
+
if (result.costUsd !== void 0) await runtime.onCost?.({
|
|
2497
|
+
costUsd: result.costUsd,
|
|
2498
|
+
modelRole: "structured"
|
|
2499
|
+
});
|
|
2413
2500
|
return {
|
|
2414
2501
|
object: result.object,
|
|
2415
2502
|
...result.costUsd !== void 0 ? { costUsd: result.costUsd } : void 0
|
|
@@ -2422,7 +2509,7 @@ function createPluginEmbedder(pluginName, runtime = {}) {
|
|
|
2422
2509
|
model: botConfig.embeddingModelId,
|
|
2423
2510
|
provider: GEN_AI_PROVIDER_NAME,
|
|
2424
2511
|
async embedTexts(input) {
|
|
2425
|
-
|
|
2512
|
+
const result = await embedTexts({
|
|
2426
2513
|
modelId: botConfig.embeddingModelId,
|
|
2427
2514
|
texts: input.texts,
|
|
2428
2515
|
...input.inputType !== void 0 ? { inputType: input.inputType } : void 0,
|
|
@@ -2432,13 +2519,18 @@ function createPluginEmbedder(pluginName, runtime = {}) {
|
|
|
2432
2519
|
pluginModelRole: "embedding"
|
|
2433
2520
|
}
|
|
2434
2521
|
});
|
|
2522
|
+
if (result.costUsd !== void 0) await runtime.onCost?.({
|
|
2523
|
+
costUsd: result.costUsd,
|
|
2524
|
+
modelRole: "embedding"
|
|
2525
|
+
});
|
|
2526
|
+
return result;
|
|
2435
2527
|
}
|
|
2436
2528
|
};
|
|
2437
2529
|
}
|
|
2438
2530
|
/** Create the host-owned reranking capability exposed to prompt hooks. */
|
|
2439
|
-
function createPluginReranker(pluginName) {
|
|
2531
|
+
function createPluginReranker(pluginName, runtime = {}) {
|
|
2440
2532
|
return { async rerank(input) {
|
|
2441
|
-
|
|
2533
|
+
const result = await rerankTexts({
|
|
2442
2534
|
documents: input.documents,
|
|
2443
2535
|
modelId: botConfig.rerankingModelId,
|
|
2444
2536
|
query: input.query,
|
|
@@ -2447,6 +2539,11 @@ function createPluginReranker(pluginName) {
|
|
|
2447
2539
|
pluginModelRole: "reranking"
|
|
2448
2540
|
}
|
|
2449
2541
|
});
|
|
2542
|
+
if (result.costUsd !== void 0) await runtime.onCost?.({
|
|
2543
|
+
costUsd: result.costUsd,
|
|
2544
|
+
modelRole: "reranking"
|
|
2545
|
+
});
|
|
2546
|
+
return result;
|
|
2450
2547
|
} };
|
|
2451
2548
|
}
|
|
2452
2549
|
/** Create the host-owned decision model capability exposed to tool hooks. */
|
|
@@ -2467,6 +2564,10 @@ function createPluginDecider(pluginName, runtime = {}) {
|
|
|
2467
2564
|
pluginModelRole: "decision"
|
|
2468
2565
|
}
|
|
2469
2566
|
});
|
|
2567
|
+
if (result.costUsd !== void 0) await runtime.onCost?.({
|
|
2568
|
+
costUsd: result.costUsd,
|
|
2569
|
+
modelRole: "decision"
|
|
2570
|
+
});
|
|
2470
2571
|
const answer = result.answers.answer;
|
|
2471
2572
|
return {
|
|
2472
2573
|
choice: answer.choice,
|
|
@@ -3776,7 +3877,6 @@ function parseSandboxEgressPermissionDeniedSignal(value) {
|
|
|
3776
3877
|
return result.success ? result.data : void 0;
|
|
3777
3878
|
}
|
|
3778
3879
|
// src/chat/sandbox/egress/session.ts
|
|
3779
|
-
const SANDBOX_EGRESS_PROXY_PATH = "/api/internal/sandbox-egress";
|
|
3780
3880
|
const SANDBOX_EGRESS_TOKEN_VERSION = "v1";
|
|
3781
3881
|
const SANDBOX_EGRESS_HMAC_CONTEXT = "junior.sandbox_egress.v1";
|
|
3782
3882
|
const SANDBOX_EGRESS_AUTH_SIGNAL_PREFIX = "sandbox-egress-auth-required";
|
|
@@ -3998,14 +4098,10 @@ function sandboxEgressAttributes(input) {
|
|
|
3998
4098
|
...input.status ? { "http.response.status_code": input.status } : void 0
|
|
3999
4099
|
};
|
|
4000
4100
|
}
|
|
4001
|
-
/** Hide the credential token in a sandbox egress proxy path before logging. */
|
|
4002
|
-
function redactSandboxEgressProxyPath(pathname) {
|
|
4003
|
-
if (pathname.startsWith(`/api/internal/sandbox-egress/`)) return `${SANDBOX_EGRESS_PROXY_PATH}/<token>`;
|
|
4004
|
-
return pathname;
|
|
4005
|
-
}
|
|
4006
4101
|
/** Return log attributes for the proxy route and the upstream path. */
|
|
4007
4102
|
function sandboxEgressRoutingAttributes(request, upstreamUrl) {
|
|
4008
|
-
const
|
|
4103
|
+
const proxyUrl = new URL(request.url);
|
|
4104
|
+
const attributes = { "app.sandbox.egress.proxy_path": redactSandboxEgressProxyPath(proxyUrl.pathname) };
|
|
4009
4105
|
if (upstreamUrl) {
|
|
4010
4106
|
attributes["app.sandbox.egress.upstream_path"] = upstreamUrl.pathname;
|
|
4011
4107
|
const gitService = upstreamUrl.searchParams.get("service");
|
|
@@ -7268,11 +7364,20 @@ async function runAfterToolExecuteHooks(args) {
|
|
|
7268
7364
|
for (const plugin of hooked) {
|
|
7269
7365
|
if (signal?.aborted) break;
|
|
7270
7366
|
const pluginName = plugin.manifest.name;
|
|
7367
|
+
const onCost = createPluginModelCostRecorder({
|
|
7368
|
+
...args.turn,
|
|
7369
|
+
pluginName,
|
|
7370
|
+
source: "afterToolExecute",
|
|
7371
|
+
toolName: args.tool.name
|
|
7372
|
+
});
|
|
7271
7373
|
let denial;
|
|
7272
7374
|
try {
|
|
7273
7375
|
await withPluginHookSpan(pluginName, "afterToolExecute", async () => await plugin.hooks.afterToolExecute({
|
|
7274
7376
|
...basePluginContext$1(plugin),
|
|
7275
|
-
decider: createPluginDecider(pluginName, {
|
|
7377
|
+
decider: createPluginDecider(pluginName, {
|
|
7378
|
+
onCost,
|
|
7379
|
+
signal
|
|
7380
|
+
}),
|
|
7276
7381
|
decision: {
|
|
7277
7382
|
deny(reason) {
|
|
7278
7383
|
denial = reason;
|
|
@@ -7284,7 +7389,10 @@ async function runAfterToolExecuteHooks(args) {
|
|
|
7284
7389
|
});
|
|
7285
7390
|
}
|
|
7286
7391
|
},
|
|
7287
|
-
model: createPluginModel(pluginName, plugin.model, {
|
|
7392
|
+
model: createPluginModel(pluginName, plugin.model, {
|
|
7393
|
+
onCost,
|
|
7394
|
+
signal
|
|
7395
|
+
}),
|
|
7288
7396
|
sandbox,
|
|
7289
7397
|
...signal ? { signal } : void 0,
|
|
7290
7398
|
tool: {
|
|
@@ -8838,19 +8946,26 @@ function pluginSpanAttributeSetter(pluginName, setSpanAttributes) {
|
|
|
8838
8946
|
};
|
|
8839
8947
|
}
|
|
8840
8948
|
function invocationPluginContext(plugin, context, setSpanAttributes, turnId) {
|
|
8949
|
+
const base = basePluginContext$1(plugin);
|
|
8950
|
+
const onCost = context.conversationId ? createPluginModelCostRecorder({
|
|
8951
|
+
conversationId: context.conversationId,
|
|
8952
|
+
pluginName: plugin.manifest.name,
|
|
8953
|
+
source: "userPrompt",
|
|
8954
|
+
...turnId ? { turnId } : void 0
|
|
8955
|
+
}) : void 0;
|
|
8841
8956
|
return {
|
|
8842
|
-
...
|
|
8957
|
+
...base,
|
|
8843
8958
|
conversationId: context.conversationId,
|
|
8844
8959
|
locationId: context.locationId,
|
|
8845
|
-
embedder: createPluginEmbedder(plugin.manifest.name),
|
|
8960
|
+
embedder: createPluginEmbedder(plugin.manifest.name, { onCost }),
|
|
8846
8961
|
...context.conversationId && turnId ? { events: createPluginConversationEvents({
|
|
8847
8962
|
conversationId: context.conversationId,
|
|
8848
8963
|
operationId: `user-prompt:${turnId}`,
|
|
8849
8964
|
plugin,
|
|
8850
8965
|
turnId
|
|
8851
8966
|
}) } : void 0,
|
|
8852
|
-
model: createPluginModel(plugin.manifest.name, plugin.model),
|
|
8853
|
-
reranker: createPluginReranker(plugin.manifest.name),
|
|
8967
|
+
model: createPluginModel(plugin.manifest.name, plugin.model, { onCost }),
|
|
8968
|
+
reranker: createPluginReranker(plugin.manifest.name, { onCost }),
|
|
8854
8969
|
setSpanAttributes: pluginSpanAttributeSetter(plugin.manifest.name, setSpanAttributes),
|
|
8855
8970
|
source: context.source,
|
|
8856
8971
|
text: context.userText ?? "",
|
|
@@ -9115,6 +9230,12 @@ function getPluginTools(context, sandbox = createSandboxCapability(context.works
|
|
|
9115
9230
|
};
|
|
9116
9231
|
const resolveActor = context.resolveActorIdentity ?? (async () => void 0);
|
|
9117
9232
|
const automationUrl = (context.source.kind === "event_automation" || context.source.kind === "scheduled_automation") && context.source.automationId ? getDashboardTaskLink(context.source.automationId) : void 0;
|
|
9233
|
+
const onCost = createPluginModelCostRecorder({
|
|
9234
|
+
conversationId: context.conversationId,
|
|
9235
|
+
pluginName,
|
|
9236
|
+
source: "tool",
|
|
9237
|
+
...context.turnId ? { turnId: context.turnId } : void 0
|
|
9238
|
+
});
|
|
9118
9239
|
const common = {
|
|
9119
9240
|
...basePluginContext$1(plugin),
|
|
9120
9241
|
annotations,
|
|
@@ -9123,10 +9244,10 @@ function getPluginTools(context, sandbox = createSandboxCapability(context.works
|
|
|
9123
9244
|
locationId: context.locationId,
|
|
9124
9245
|
...slackContext ? { slack: slackContext } : void 0,
|
|
9125
9246
|
userText: context.userText,
|
|
9126
|
-
embedder: createPluginEmbedder(pluginName),
|
|
9247
|
+
embedder: createPluginEmbedder(pluginName, { onCost }),
|
|
9127
9248
|
egress: context.egress,
|
|
9128
9249
|
...mcp ? { mcp } : void 0,
|
|
9129
|
-
model: createPluginModel(pluginName, plugin.model),
|
|
9250
|
+
model: createPluginModel(pluginName, plugin.model, { onCost }),
|
|
9130
9251
|
events,
|
|
9131
9252
|
sandbox,
|
|
9132
9253
|
state: createPluginState(pluginName),
|
|
@@ -9560,11 +9681,13 @@ function createPluginHookRunner(input = {}) {
|
|
|
9560
9681
|
const loaded = getPlugins();
|
|
9561
9682
|
return {
|
|
9562
9683
|
async afterToolExecute(tool) {
|
|
9563
|
-
if (!input.
|
|
9684
|
+
if (!input.toolRun) return [];
|
|
9685
|
+
const { sandbox, ...turn } = input.toolRun;
|
|
9564
9686
|
return await runAfterToolExecuteHooks({
|
|
9565
9687
|
plugins: loaded,
|
|
9566
|
-
sandbox:
|
|
9567
|
-
tool
|
|
9688
|
+
sandbox: sandbox(),
|
|
9689
|
+
tool,
|
|
9690
|
+
turn
|
|
9568
9691
|
});
|
|
9569
9692
|
},
|
|
9570
9693
|
async afterMcpTool(tool) {
|
|
@@ -10218,12 +10341,9 @@ function egressAttributes(input) {
|
|
|
10218
10341
|
...input.status ? { "http.response.status_code": input.status } : void 0
|
|
10219
10342
|
};
|
|
10220
10343
|
}
|
|
10221
|
-
function redactedProxyPath(pathname) {
|
|
10222
|
-
if (pathname.startsWith(`/api/internal/sandbox-egress/`)) return `${SANDBOX_EGRESS_PROXY_PATH}/<token>`;
|
|
10223
|
-
return pathname;
|
|
10224
|
-
}
|
|
10225
10344
|
function routingAttributes(request, upstreamUrl) {
|
|
10226
|
-
const
|
|
10345
|
+
const proxyUrl = new URL(request.url);
|
|
10346
|
+
const attributes = { "app.sandbox.egress.proxy_path": redactSandboxEgressProxyPath(proxyUrl.pathname) };
|
|
10227
10347
|
if (upstreamUrl) {
|
|
10228
10348
|
attributes["app.sandbox.egress.upstream_path"] = upstreamUrl.pathname;
|
|
10229
10349
|
const gitService = upstreamUrl.searchParams.get("service");
|
|
@@ -12851,7 +12971,7 @@ async function materializeStoredTurnRecord(conversationId, turnId, followCurrent
|
|
|
12851
12971
|
const eventStore = getConversationEventStore();
|
|
12852
12972
|
const currentHistoryVersion = await eventStore.loadCurrentHistoryVersion(conversationId);
|
|
12853
12973
|
const followsReplacement = followCurrentReplacement && (parsed.state === "running" || parsed.state === "paused") && parsed.historyVersion !== void 0 && parsed.historyVersion !== currentHistoryVersion;
|
|
12854
|
-
const piProjection = followsReplacement ? projectConversationEvents(await eventStore.loadCurrentHistory(conversationId)) : pinnedProjection;
|
|
12974
|
+
const piProjection = followsReplacement ? projectConversationEvents$1(await eventStore.loadCurrentHistory(conversationId)) : pinnedProjection;
|
|
12855
12975
|
const turnStartMessageIndex = followsReplacement ? 0 : parsed.turnStartSeq === void 0 ? void 0 : piProjection.seqs.filter((seq) => seq <= parsed.turnStartSeq).length;
|
|
12856
12976
|
const conversationStore = getConversationStore();
|
|
12857
12977
|
const conversation = await conversationStore.get({ conversationId });
|
|
@@ -14409,15 +14529,15 @@ function resolveCommitProvenance(args) {
|
|
|
14409
14529
|
}
|
|
14410
14530
|
/** Load the current Pi agent history for a conversation. */
|
|
14411
14531
|
async function loadProjection(args) {
|
|
14412
|
-
return projectConversationEvents(await getConversationEventStore().loadCurrentHistory(args.conversationId)).messages;
|
|
14532
|
+
return projectConversationEvents$1(await getConversationEventStore().loadCurrentHistory(args.conversationId)).messages;
|
|
14413
14533
|
}
|
|
14414
14534
|
/** Load current Pi context with aligned provenance and source event sequences. */
|
|
14415
14535
|
async function loadConversationProjection(args) {
|
|
14416
|
-
return projectConversationEvents(await getConversationEventStore().loadCurrentHistory(args.conversationId));
|
|
14536
|
+
return projectConversationEvents$1(await getConversationEventStore().loadCurrentHistory(args.conversationId));
|
|
14417
14537
|
}
|
|
14418
14538
|
/** Load the active Pi projection before a conversation's next request. */
|
|
14419
14539
|
async function openConversationProjection(args) {
|
|
14420
|
-
return projectConversationEvents(await getConversationEventStore().loadCurrentHistory(args.conversationId));
|
|
14540
|
+
return projectConversationEvents$1(await getConversationEventStore().loadCurrentHistory(args.conversationId));
|
|
14421
14541
|
}
|
|
14422
14542
|
/**
|
|
14423
14543
|
* Load a turn's committed Pi projection from the durable event store.
|
|
@@ -14432,10 +14552,10 @@ async function openConversationProjection(args) {
|
|
|
14432
14552
|
*/
|
|
14433
14553
|
async function loadTurnProjection(args) {
|
|
14434
14554
|
const eventStore = getConversationEventStore();
|
|
14435
|
-
if (args.committedSeq < 0) return projectConversationEvents(await eventStore.loadCurrentHistory(args.conversationId));
|
|
14555
|
+
if (args.committedSeq < 0) return projectConversationEvents$1(await eventStore.loadCurrentHistory(args.conversationId));
|
|
14436
14556
|
const historyEvents = await eventStore.loadHistoryContaining(args.conversationId, args.committedSeq, args.includeTail ? void 0 : args.committedSeq);
|
|
14437
14557
|
if (!historyEvents) return;
|
|
14438
|
-
return projectConversationEvents(historyEvents);
|
|
14558
|
+
return projectConversationEvents$1(historyEvents);
|
|
14439
14559
|
}
|
|
14440
14560
|
/** Load MCP providers the credential subject connected in this conversation. */
|
|
14441
14561
|
async function loadConnectedMcpProviders(args) {
|
|
@@ -14494,7 +14614,7 @@ async function commitAcceptedReply(args) {
|
|
|
14494
14614
|
async function commitMessagesLocked(args, executor) {
|
|
14495
14615
|
const eventStore = createSqlConversationEventStore(executor);
|
|
14496
14616
|
const currentEvents = await eventStore.loadCurrentHistory(args.conversationId);
|
|
14497
|
-
const current = projectConversationEvents(currentEvents);
|
|
14617
|
+
const current = projectConversationEvents$1(currentEvents);
|
|
14498
14618
|
const nextLocalMessages = args.messages.map(normalizeDurableMessage);
|
|
14499
14619
|
const matchingPrefix = countDurablePrefix(current.messages, nextLocalMessages);
|
|
14500
14620
|
const nextLocalProvenance = resolveCommitProvenance({
|
|
@@ -14734,4 +14854,4 @@ async function recordGuardianActionReviewed(args) {
|
|
|
14734
14854
|
createdAtMs: Date.now()
|
|
14735
14855
|
}]);
|
|
14736
14856
|
}
|
|
14737
|
-
export { completeTurnRecord as $, recordSlackAttachment as $a, isWorkspaceSnapshotNotReadyError as $i, takeReviewItem as $n, updateWorkspace as $r, isStandaloneRuntimeContextMessage as $t, getConversationMessageSlackTs as A, canAccessConversation as Aa, removeReactionFromMessage as Ai, createPluginHookRunner as An, takeDueTimerWatches as Ar, requestAnotherSlice as At, authorizationId as B, readConversationViewerMarks as Ba, isConversationScopedChannel as Bi, coreTaskRegistrations as Bn, getDashboardObjectIconLink as Br, createTurnLimitGate as Bt, settleConversationTitleWork as C, sandboxSkillDir as Ca, addReactionToMessage as Ci, setExperimentalFeatures as Cn, collectEventMatchKeys as Cr, isInvalidConversationRecordError as Ct, buildConversationContext as D, buildNonInteractiveShellScript as Da, openSlackModal as Di, getOAuthAccountProviders as Dn, findMatchingWatches as Dr, recordConversationRetry as Dt, appendThreadContextMessages as E, buildCommandScript as Ea, openSlackDirectMessage as Ei, webActorUserIds as En, deliverWatch as Er, recordAttemptFailure as Et, turnHasReply as F, conversationIsMemberRoot as Fa, SlackActionError as Fi, getPluginTools as Fn, verifyScheduledAutomationCredentialSubject as Fr, TURN_LIMIT_WRAP_UP_MESSAGE as Ft, canReusePendingAuthLink as G, readConversationEventPageAfter as Ga, getWorkspaceTeamId as Gi, countReviewItemsNeedingUser as Gn, createPluginState as Gr, getPiMessageRole as Gt, AuthorizationFlowDisabledError as H, createPluginConversationEvents as Ha, normalizeSlackConversationId as Hi, setBriefsConfig as Hn, getDashboardTaskLink as Hr, CODEMODE_TOOL_NAME as Ht, upsertConversationMessage as I, conversationNotArchivedForEmail as Ia, downloadPrivateSlackFile as Ii, getPluginUserPromptContributions as In, verifySlackDirectCredentialSubject as Ir, TurnBudgetExceededError as It, wasPendingAuthStopped as J, loadForkHistory as Ja, isAlreadyExistsError as Ji, getReviewItem as Jn, deleteWorkspace as Jr, hasCurrentInstruction as Jt, clearPendingAuth as K, readConversationEventPageAround as Ka, runWithWorkspaceTeamId as Ki, dismissOpenReviewItems as Kn, renderToolResultNudge as Kr, getTerminalAssistantMessages as Kt, createPluginEgress as L, conversationNotArchivedForUser as La, getFilePermalink as Li, getPlugins as Ln, verifyTimerWatchCredentialSubject as Lr, TurnSliceLimitExceededError as Lt, markConversationMessage as M, conversationArchivedForEmail as Ma, uploadFilesToConversation as Mi, getPluginRoutes as Mn, bindScheduledAutomationCredentialSubject as Mr, startConversationWork as Mt, normalizeConversationText as N, conversationArchivedForUser as Na, slackEntitySchema as Ni, getPluginSlackConversationLink as Nn, bindSlackDirectCredentialSubject as Nr, steerWebPendingMessages as Nt, createConversationMemoryService as O, runNonInteractiveCommand as Oa, postSlackEphemeralMessage as Oi, resolvePluginOAuthAccount as On, getWatch as Or, releaseConversationWork as Ot, recordDeliveredAssistantMessage as P, conversationHasParticipantUser as Pa, slackExternalRefIdSchema as Pi, getPluginSystemPromptContributions as Pn, verifyEventAutomationCredentialSubject as Pr, stopConversationWork as Pt, abandonTurnRecord as Q, readAttachmentVisionSummary as Qa, getWorkspaceSnapshotNotReadyError as Qi, searchReviewItems as Qn, listWorkspacesByRepository as Qr, isContinuablePiBoundary as Qt, PluginCredentialFailureError as R, conversationPinnedForUser as Ra, getHeaderString as Ri, setPlugins as Rn, JUNIOR_THREAD_STATE_TTL_MS as Rr, TurnToolCallLimitExceededError as Rt, resolveConversationTitle as S, SANDBOX_WORKSPACE_ROOT as Sa, truncateStatusText as Si, isExperimentalFeatureEnabled as Sn, cancelWatch as Sr, isFinalAttempt as St, resolveTaskTitle as T, sandboxSkillPathResolution as Ta, getSlackMessagePermalink as Ti, findLegacyWebActorUserId as Tn, createWatch as Tr, markConversationWorkEnqueued as Tt, AuthorizationPauseError as U, readLatestConversationBrief as Ua, runWithSlackInstallationToken as Ui, REVIEW_ITEM_REPLIED_REASON as Un, setDashboardConversationLinkOptions as Ur, persistWithRetry as Ut, AuthPausePersistenceError as V, viewerConversationMembership as Va, isDmChannel as Vi, registration_exports as Vn, getDashboardReviewItemLink as Vr, isTurnExecutionLimitExceededError as Vt, abandonReplacedPendingAuth as W, readConversationEventPage as Wa, withSlackRetries as Wi, closeReviewItem as Wn, ToolInputError as Wr, extractAssistantText as Wt, loadTurnCheckpoint as X, getSlackFileId as Xa, wrapSandboxSetupError as Xi, listReplyActionItems as Xn, getWorkspaceByName as Xr, instructionTextForProjection as Xt, continuableMessages as Y, notInheritedByForkChild as Ya, throwSandboxOperationError as Yi, insertReviewItem as Yn, getWorkspace as Yr, hasRuntimeTurnContext as Yt, saveTurnCheckpoint as Z, matchSlackAttachments as Za, WorkspaceSnapshotNotReadyError as Zi, listWaitingConversations as Zn, listWorkspaces as Zr, isAssistantMessage as Zt, appendConversationMessages as _, SANDBOX_COMMAND_PATH as _a, escapeSlackMrkdwnText as _i, estimateTextTokens as _n, setConfigDefaults as _o, RESOURCE_SUBSCRIPTION_DEFAULT_TTL_MS as _r, drainConversationMailbox as _t, loadProjection as a, parseSandboxEgressCredentialToken as aa, create as ai, trimTrailingAssistantMessages as an, defaultTimezone as ao, isOnlyAssignee as ar, CONVERSATION_WORK_STALE_ENQUEUE_MS as at, projectConversationMessages as b, SANDBOX_REPOS_ROOT as ba, normalizeSlackStatusText as bi, getAgentContextInputLimitTokens as bn, STOP_WATCHING_TOOL_NAME as br, hasConversationStop as bt, recordAgentsInstructionsUpdated as c, resolveSandboxCommandEnvironment as ca, ensureDockerDaemon as ci, TURN_CONTEXT_TAG as cn, createPluginCache as co, requireReviewItemLinks as cr, appendInboundMessage as ct, recordAuthorizationCompleted as d, sleep$2 as da, proxyVercelSandboxEgressRequest as di, SubscribedReplyReason as dn, historyItemFromPiMessage as do, EVERYONE_ASSIGNEE as dr, checkInConversationWork as dt, workspaceSnapshotNotReadyUserMessage as ea, WorkspaceValidationError as ei, isToolResultError as en, resolveRootVisibility as eo, updateReviewItemContent as er, failTurnRecord as et, recordAuthorizationRequested as f, tryWorkspaceRepoCheckoutPath as fa, deliverOAuthAuthorization as fi, decideSubscribedThreadReply as fn, piMessageFromHistoryItem as fo, automationCreatorUserId as fr, clearConsumedConversationWake as ft, recordToolExecutionStarted as g, createPluginModel as ga, startOAuthFlow as gi, estimateRequestOverheadTokens as gn, getConfigDefaults as go, getSlackToolContext as gr, deadLetterAttempt as gt, recordSubscribedReplyRoute as h, createPluginEmbedder as ha, resolveBaseUrl as hi, calculateContextCompactionTargetTokens as hn, conversationNoteEvent as ho, resolveChannelCapabilities as hr, completeConversationWork as ht, loadConversationProjection as i, createSandboxEgressCredentialToken as ia, setWorkspaceSnapshotBuild as ii, stripRuntimeTurnContext as in, listConversationAnnotationsById as io, canReadReviewItem as ir, CONVERSATION_WORK_CHECK_IN_INTERVAL_MS as it, isHumanConversationMessage as j, readConversationAccessFromSql as ja, updateSlackMessage as ji, getPluginApiRoutes as jn, bindEventAutomationCredentialSubject as jr, requestConversationWork as jt, estimateConversationContextTokens as k, createPluginLogger as ka, postSlackMessage as ki, agent_hooks_exports as kn, listWatches as kr, removeActiveConversation as kt, recordAttachmentsDelivered as l, normalizeSandboxEgressTracePropagationDomains as la, getSandboxProvider as li, buildDeterministicAssistantMessageId as ln, createDurableLocationConfigurationService as lo, reviewItemNeedsUser as lr, beginConversationResume as lt, recordMcpProviderConnected as m, PluginToolDeniedError as ma, parseOAuthStatePayload as mi, getThreadStopDecision as mn, JUNIOR_NATIVE_EVENT_NAMESPACE as mo, resolveAssignees as mr, completeConversationStop as mt, commitMessages as n, consumeSandboxEgressAuthRequiredSignal as na, loadSnapshotsForProfile as ni, normalizeToolNameFromResult as nn, createPluginAnnotations as no, canActOnReviewItem as nr, listTurnSummaries as nt, loadTurnProjection as o, sandboxEgressSignalsResponseSchema as oa, hash as oi, REQUEST_CONTEXT_SECTION_TAG as on, resolveUserTimezone as oo, readReviewItemAgentScope as or, ackMessages as ot, recordGuardianActionReviewed as p, workspaceRepoCheckoutPath as pa, formatProviderLabel as pi, getSubscribedReplyPreflightDecision as pn, projectConversationEvents as po, resolveAssignee as pr, clearExpiredConversationLease as pt, getConversationPendingAuth as q, buildSentryConversationUrl as qa, isAbortError as qi, getOpenReviewItemByDedupeKey as qn, createWorkspace as qr, getUserMessageInstructionText as qt, loadConnectedMcpProviders as r, consumeSandboxEgressPermissionDeniedSignal as ra, setWorkspaceSnapshot as ri, retainRuntimeTurnContext as rn, listConversationAnnotations as ro, canAgentChangeReviewItem as rr, recordTurnSummary as rt, openConversationProjection as s, buildSandboxEgressNetworkPolicy as sa, isStale as si, SESSION_CONTEXT_SECTION_TAG as sn, lookupSlackUser as so, requireReviewItemAssignees as sr, appendExclusiveInboundMessage as st, commitAcceptedReply as t, clearSandboxEgressSignals as ta, invalidateReadySnapshot as ti, isToolResultMessage as tn, saveObjectAnnotations as to, PLUGIN_REVIEW_ITEM_KEY_PREFIX as tr, getTurnRecord as tt, recordAuthenticationLinked as u, SANDBOX_RUNTIME as ua, isVercelSandboxEgressRequest as ui, buildDeterministicTurnId as un, configValueSchema as uo, reviewItemReaderForUser as ur, cancelHumanFacingPendingMessages as ut, hydrateConversationMessages as v, SANDBOX_DATA_ROOT as va, formatSlackLink as vi, getAgentBackgroundCompactionMarkTokens as vn, RESOURCE_SUBSCRIPTION_MAX_TTL_MS as vr, getConversation as vt, fallbackShortTitle as w, sandboxSkillFile as wa, deleteSlackMessage as wi, createUserTokenStore as wn, createTimerWatch as wr, listActiveConversationIds as wt, persistConversationMessageSummaries as x, SANDBOX_SKILLS_ROOT as xa, slackMention as xi, getExperimentalFeatures as xn, cancelSubscriptions as xr, hasRunnableConversationWork as xt, persistConversationMessages as y, SANDBOX_JUNIOR_ROOT as ya, normalizeSlackReplyMarkdown as yi, getAgentContextCompactionTriggerTokens as yn, RESOURCE_WATCH_TOOL_SOURCE as yr, getConversationWorkState as yt, createPluginAuthOrchestration as z, conversationViewerMarks as za, getSlackClient as zi, validatePlugins as zn, getDashboardConversationLink as zr, buildTurnErrorResponse as zt };
|
|
14857
|
+
export { completeTurnRecord as $, notInheritedByForkChild as $a, isWorkspaceSnapshotNotReadyError as $i, takeReviewItem as $n, updateWorkspace as $r, isStandaloneRuntimeContextMessage as $t, getConversationMessageSlackTs as A, createPluginLogger as Aa, removeReactionFromMessage as Ai, createPluginHookRunner as An, takeDueTimerWatches as Ar, requestAnotherSlice as At, authorizationId as B, conversationViewerMarks as Ba, isConversationScopedChannel as Bi, coreTaskRegistrations as Bn, getDashboardObjectIconLink as Br, createTurnLimitGate as Bt, settleConversationTitleWork as C, sandboxSkillDir as Ca, addReactionToMessage as Ci, setExperimentalFeatures as Cn, collectEventMatchKeys as Cr, isInvalidConversationRecordError as Ct, buildConversationContext as D, buildNonInteractiveShellScript as Da, openSlackModal as Di, getOAuthAccountProviders as Dn, findMatchingWatches as Dr, recordConversationRetry as Dt, appendThreadContextMessages as E, buildCommandScript as Ea, openSlackDirectMessage as Ei, webActorUserIds as En, deliverWatch as Er, recordAttemptFailure as Et, turnHasReply as F, conversationHasParticipantUser as Fa, SlackActionError as Fi, getPluginTools as Fn, verifyScheduledAutomationCredentialSubject as Fr, TURN_LIMIT_WRAP_UP_MESSAGE as Ft, canReusePendingAuthLink as G, readLatestConversationBrief as Ga, getWorkspaceTeamId as Gi, countReviewItemsNeedingUser as Gn, createPluginState as Gr, getPiMessageRole as Gt, AuthorizationFlowDisabledError as H, viewerConversationMembership as Ha, normalizeSlackConversationId as Hi, setBriefsConfig as Hn, getDashboardTaskLink as Hr, CODEMODE_TOOL_NAME as Ht, upsertConversationMessage as I, conversationIsMemberRoot as Ia, downloadPrivateSlackFile as Ii, getPluginUserPromptContributions as In, verifySlackDirectCredentialSubject as Ir, TurnBudgetExceededError as It, wasPendingAuthStopped as J, readConversationEventPageAround as Ja, isAlreadyExistsError as Ji, getReviewItem as Jn, deleteWorkspace as Jr, hasCurrentInstruction as Jt, clearPendingAuth as K, readConversationEventPage as Ka, runWithWorkspaceTeamId as Ki, dismissOpenReviewItems as Kn, renderToolResultNudge as Kr, getTerminalAssistantMessages as Kt, createPluginEgress as L, conversationNotArchivedForEmail as La, getFilePermalink as Li, getPlugins as Ln, verifyTimerWatchCredentialSubject as Lr, TurnSliceLimitExceededError as Lt, markConversationMessage as M, readConversationAccessFromSql as Ma, uploadFilesToConversation as Mi, getPluginRoutes as Mn, bindScheduledAutomationCredentialSubject as Mr, startConversationWork as Mt, normalizeConversationText as N, conversationArchivedForEmail as Na, slackEntitySchema as Ni, getPluginSlackConversationLink as Nn, bindSlackDirectCredentialSubject as Nr, steerWebPendingMessages as Nt, createConversationMemoryService as O, runNonInteractiveCommand as Oa, postSlackEphemeralMessage as Oi, resolvePluginOAuthAccount as On, getWatch as Or, releaseConversationWork as Ot, recordDeliveredAssistantMessage as P, conversationArchivedForUser as Pa, slackExternalRefIdSchema as Pi, getPluginSystemPromptContributions as Pn, verifyEventAutomationCredentialSubject as Pr, stopConversationWork as Pt, abandonTurnRecord as Q, loadForkHistory as Qa, getWorkspaceSnapshotNotReadyError as Qi, searchReviewItems as Qn, listWorkspacesByRepository as Qr, isContinuablePiBoundary as Qt, PluginCredentialFailureError as R, conversationNotArchivedForUser as Ra, getHeaderString as Ri, setPlugins as Rn, JUNIOR_THREAD_STATE_TTL_MS as Rr, TurnToolCallLimitExceededError as Rt, resolveConversationTitle as S, SANDBOX_WORKSPACE_ROOT as Sa, truncateStatusText as Si, isExperimentalFeatureEnabled as Sn, cancelWatch as Sr, isFinalAttempt as St, resolveTaskTitle as T, sandboxSkillPathResolution as Ta, getSlackMessagePermalink as Ti, findLegacyWebActorUserId as Tn, createWatch as Tr, markConversationWorkEnqueued as Tt, AuthorizationPauseError as U, createPluginConversationEvents as Ua, runWithSlackInstallationToken as Ui, REVIEW_ITEM_REPLIED_REASON as Un, setDashboardConversationLinkOptions as Ur, persistWithRetry as Ut, AuthPausePersistenceError as V, readConversationViewerMarks as Va, isDmChannel as Vi, registration_exports as Vn, getDashboardReviewItemLink as Vr, isTurnExecutionLimitExceededError as Vt, abandonReplacedPendingAuth as W, readConversationBriefThrough as Wa, withSlackRetries as Wi, closeReviewItem as Wn, ToolInputError as Wr, extractAssistantText as Wt, loadTurnCheckpoint as X, readConversationMessageEventSeq as Xa, wrapSandboxSetupError as Xi, listReplyActionItems as Xn, getWorkspaceByName as Xr, instructionTextForProjection as Xt, continuableMessages as Y, readConversationLastEventSeq as Ya, throwSandboxOperationError as Yi, insertReviewItem as Yn, getWorkspace as Yr, hasRuntimeTurnContext as Yt, saveTurnCheckpoint as Z, buildSentryConversationUrl as Za, WorkspaceSnapshotNotReadyError as Zi, listWaitingConversations as Zn, listWorkspaces as Zr, isAssistantMessage as Zt, appendConversationMessages as _, SANDBOX_COMMAND_PATH as _a, escapeSlackMrkdwnText as _i, estimateTextTokens as _n, projectConversationEvents$1 as _o, RESOURCE_SUBSCRIPTION_DEFAULT_TTL_MS as _r, drainConversationMailbox as _t, loadProjection as a, parseSandboxEgressCredentialToken as aa, create as ai, trimTrailingAssistantMessages as an, saveObjectAnnotations as ao, isOnlyAssignee as ar, CONVERSATION_WORK_STALE_ENQUEUE_MS as at, projectConversationMessages as b, SANDBOX_REPOS_ROOT as ba, normalizeSlackStatusText as bi, getAgentContextInputLimitTokens as bn, getConfigDefaults as bo, STOP_WATCHING_TOOL_NAME as br, hasConversationStop as bt, recordAgentsInstructionsUpdated as c, resolveSandboxCommandEnvironment as ca, ensureDockerDaemon as ci, TURN_CONTEXT_TAG as cn, listConversationAnnotationsById as co, requireReviewItemLinks as cr, appendInboundMessage as ct, recordAuthorizationCompleted as d, sleep$2 as da, proxyVercelSandboxEgressRequest as di, SubscribedReplyReason as dn, lookupSlackUser as do, EVERYONE_ASSIGNEE as dr, checkInConversationWork as dt, workspaceSnapshotNotReadyUserMessage as ea, WorkspaceValidationError as ei, isToolResultError as en, getSlackFileId as eo, updateReviewItemContent as er, failTurnRecord as et, recordAuthorizationRequested as f, tryWorkspaceRepoCheckoutPath as fa, deliverOAuthAuthorization as fi, decideSubscribedThreadReply as fn, createPluginCache as fo, automationCreatorUserId as fr, clearConsumedConversationWake as ft, recordToolExecutionStarted as g, createPluginModel as ga, startOAuthFlow as gi, estimateRequestOverheadTokens as gn, piMessageFromHistoryItem as go, getSlackToolContext as gr, deadLetterAttempt as gt, recordSubscribedReplyRoute as h, createPluginEmbedder as ha, resolveBaseUrl as hi, calculateContextCompactionTargetTokens as hn, historyItemFromPiMessage as ho, resolveChannelCapabilities as hr, completeConversationWork as ht, loadConversationProjection as i, createSandboxEgressCredentialToken as ia, setWorkspaceSnapshotBuild as ii, stripRuntimeTurnContext as in, resolveRootVisibility as io, canReadReviewItem as ir, CONVERSATION_WORK_CHECK_IN_INTERVAL_MS as it, isHumanConversationMessage as j, canAccessConversation as ja, updateSlackMessage as ji, getPluginApiRoutes as jn, bindEventAutomationCredentialSubject as jr, requestConversationWork as jt, estimateConversationContextTokens as k, createPluginModelCostRecorder as ka, postSlackMessage as ki, agent_hooks_exports as kn, listWatches as kr, removeActiveConversation as kt, recordAttachmentsDelivered as l, normalizeSandboxEgressTracePropagationDomains as la, getSandboxProvider as li, buildDeterministicAssistantMessageId as ln, defaultTimezone as lo, reviewItemNeedsUser as lr, beginConversationResume as lt, recordMcpProviderConnected as m, PluginToolDeniedError as ma, parseOAuthStatePayload as mi, getThreadStopDecision as mn, configValueSchema as mo, resolveAssignees as mr, completeConversationStop as mt, commitMessages as n, consumeSandboxEgressAuthRequiredSignal as na, loadSnapshotsForProfile as ni, normalizeToolNameFromResult as nn, readAttachmentVisionSummary as no, canActOnReviewItem as nr, listTurnSummaries as nt, loadTurnProjection as o, sandboxEgressSignalsResponseSchema as oa, hash as oi, REQUEST_CONTEXT_SECTION_TAG as on, createPluginAnnotations as oo, readReviewItemAgentScope as or, ackMessages as ot, recordGuardianActionReviewed as p, workspaceRepoCheckoutPath as pa, formatProviderLabel as pi, getSubscribedReplyPreflightDecision as pn, createDurableLocationConfigurationService as po, resolveAssignee as pr, clearExpiredConversationLease as pt, getConversationPendingAuth as q, readConversationEventPageAfter as qa, isAbortError as qi, getOpenReviewItemByDedupeKey as qn, createWorkspace as qr, getUserMessageInstructionText as qt, loadConnectedMcpProviders as r, consumeSandboxEgressPermissionDeniedSignal as ra, setWorkspaceSnapshot as ri, retainRuntimeTurnContext as rn, recordSlackAttachment as ro, canAgentChangeReviewItem as rr, recordTurnSummary as rt, openConversationProjection as s, buildSandboxEgressNetworkPolicy as sa, isStale as si, SESSION_CONTEXT_SECTION_TAG as sn, listConversationAnnotations as so, requireReviewItemAssignees as sr, appendExclusiveInboundMessage as st, commitAcceptedReply as t, clearSandboxEgressSignals as ta, invalidateReadySnapshot as ti, isToolResultMessage as tn, matchSlackAttachments as to, PLUGIN_REVIEW_ITEM_KEY_PREFIX as tr, getTurnRecord as tt, recordAuthenticationLinked as u, SANDBOX_RUNTIME as ua, isVercelSandboxEgressRequest as ui, buildDeterministicTurnId as un, resolveUserTimezone as uo, reviewItemReaderForUser as ur, cancelHumanFacingPendingMessages as ut, hydrateConversationMessages as v, SANDBOX_DATA_ROOT as va, formatSlackLink as vi, getAgentBackgroundCompactionMarkTokens as vn, JUNIOR_NATIVE_EVENT_NAMESPACE as vo, RESOURCE_SUBSCRIPTION_MAX_TTL_MS as vr, getConversation as vt, fallbackShortTitle as w, sandboxSkillFile as wa, deleteSlackMessage as wi, createUserTokenStore as wn, createTimerWatch as wr, listActiveConversationIds as wt, persistConversationMessageSummaries as x, SANDBOX_SKILLS_ROOT as xa, slackMention as xi, getExperimentalFeatures as xn, setConfigDefaults as xo, cancelSubscriptions as xr, hasRunnableConversationWork as xt, persistConversationMessages as y, SANDBOX_JUNIOR_ROOT as ya, normalizeSlackReplyMarkdown as yi, getAgentContextCompactionTriggerTokens as yn, conversationNoteEvent as yo, RESOURCE_WATCH_TOOL_SOURCE as yr, getConversationWorkState as yt, createPluginAuthOrchestration as z, conversationPinnedForUser as za, getSlackClient as zi, validatePlugins as zn, getDashboardConversationLink as zr, buildTurnErrorResponse as zt };
|