@sentry/junior 0.277.0 → 0.279.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/{adapter-BtfBHVM5.js → adapter-phTTgw7H.js} +1 -1
- package/dist/{admin-DzAKbZsm.js → admin-PcpJDugZ.js} +1 -1
- package/dist/{agent-invocations-Crs3XHhg.js → agent-invocations-CUg_SODU.js} +0 -1
- package/dist/{agent-runner-BsYAbniN.js → agent-runner-DwvT1BY0.js} +321 -847
- package/dist/api/schema.d.ts +2 -2
- package/dist/api/schema.js +6 -6
- package/dist/api.d.ts +1 -1
- package/dist/api.js +46 -414
- package/dist/{app-BjEQwNVP.d.ts → app-DVs6noo7.d.ts} +6 -27
- package/dist/app.d.ts +2 -2
- package/dist/app.js +460 -78
- package/dist/{assistant-reply-NebRGG4G.js → assistant-reply-BXfxczd7.js} +28 -6
- package/dist/{automation-Cql9h2vO.js → automation-BehArCcq.js} +1 -1
- package/dist/{background-compaction-queue-hh18yCeU.js → background-compaction-queue-CcbuLJrZ.js} +2 -2
- package/dist/{briefs-BBo0Eimi.js → briefs-Dd_ezwED.js} +10 -10
- package/dist/{catalog-runtime-DE-F4Awo.js → catalog-runtime-BWVMeZhW.js} +2 -2
- package/dist/cli/chat.js +16 -16
- package/dist/cli/check.js +3 -3
- package/dist/cli/init.js +0 -2
- 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-DZ8HTnYH.js → client-Bpxe4vKa.js} +8 -4
- package/dist/{config-D5uUtrCP.js → config-C_bmRhrJ.js} +25 -100
- package/dist/{connections-Do24CGP5.js → connections-B2rHe5W5.js} +10 -10
- package/dist/{conversation-SsASlWL7.js → conversation-CIiJtx5q.js} +56 -104
- package/dist/conversation-pending-messages-CnBvE6-6.js +173 -0
- package/dist/{conversation-privacy-VuylvlKr.js → conversation-privacy-CzOfcz0U.js} +1 -1
- package/dist/{credential-sync-BGQK3pOa.js → credential-sync-Dal_unpv.js} +15 -15
- package/dist/{db-DEiwO5Sh.d.ts → db-CyLrV9C7.d.ts} +1 -1
- package/dist/{executor-hPfFTH0C.js → executor-BfYH-Wws.js} +6 -4
- package/dist/instrumentation.d.ts +12 -0
- package/dist/instrumentation.js +56 -23
- package/dist/{logging-cI3T1dNc.js → logging-CkT3_Xxp.js} +2 -2
- package/dist/{media-DstkkoNP.js → media-DTAA8Qs_.js} +21 -23
- package/dist/{message-DBwsAl7O.js → message-Q5dkgaJ5.js} +23 -29
- package/dist/nitro.d.ts +1 -1
- package/dist/nitro.js +18 -6
- package/dist/{oauth-callback-server-DXrnbplb.js → oauth-callback-server-BDRaqe8O.js} +2 -2
- package/dist/{oauth-relay-C6ZAyJgf.js → oauth-relay-D0G3T16m.js} +1 -1
- 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-7EFIqzuj.js → projection-DWxX7pb1.js} +214 -138
- package/dist/{prompt-oRfGsxd3.js → prompt--dwus7Y-.js} +1 -1
- package/dist/proxy-path-BHYoKZdq.js +15 -0
- package/dist/{registry-Bzefs7kT.js → registry-DnrdeO4s.js} +2 -2
- package/dist/{resolve-CuiEY_2u.js → resolve-C_QXfqD_.js} +3 -3
- package/dist/{result-DrcUtFaD.js → result-DNmOxT-N.js} +10 -10
- package/dist/{runner-CDE4CZ52.js → runner-zd_noJ1l.js} +11 -11
- package/dist/{sandbox-egress-signals-0tcmGd13.js → sandbox-egress-signals-DQjv-nbG.js} +1 -1
- package/dist/{schema-Dzi3lkdP.js → schema-CNJNzvr8.js} +4 -4
- package/dist/{schema-B6N2nc6v.d.ts → schema-e90H5FIN.d.ts} +2176 -967
- 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-BOz9pqOE.js → service-account-BK26XlHo.js} +3 -3
- package/dist/{service-account-DIyz_9Uh.js → service-account-CCH2Hv4h.js} +3 -3
- package/dist/{session-stop-0juF_BP0.js → session-stop-6Tf--T7G.js} +23 -16
- package/dist/{skills-CU5Is147.js → skills-BNrk8gi4.js} +4 -4
- package/dist/{spawn-6C9jHH4b.js → spawn-C75hAB9l.js} +3 -4
- package/dist/{stop-6FVG1c-r.js → stop-RYbf7PWi.js} +742 -207
- package/dist/{store-DtHZviJ1.js → store-CO5vGjwD.js} +9 -16
- package/dist/{store-DKs1WwdB.js → store-G3h2djJU.js} +3 -3
- package/dist/{task-queue-CcvFQE_p.js → task-queue-DlN58XeM.js} +3 -3
- package/dist/{task-runner-DBkNejLl.js → task-runner-B-Bdm23d.js} +22 -10
- package/dist/{thread-state-4hjEIkIq.js → thread-state-Cj_7Slru.js} +4 -4
- package/dist/{turn-failure-response-BZNLydC3.js → turn-failure-response-CE7gaoC7.js} +7 -7
- package/dist/{turn-lifecycle-BhqYjaa4.js → turn-lifecycle-7sXwXLJ6.js} +1 -1
- package/dist/{turn-session-routing-jnLOfBHJ.js → turn-session-routing-FBdaH1zf.js} +10 -10
- package/dist/{validation-BUFmsnKs.js → validation-DLWxEzWW.js} +2 -2
- package/dist/{version-DJTk0ZCE.js → version-DtQ8WFIZ.js} +1 -1
- package/dist/version.js +1 -1
- package/dist/{viewer-WY0RYE4E.js → viewer-vsM8_90o.js} +53 -22
- package/dist/{work-C5AKvXJV.js → work-DsoFRO_0.js} +12 -17
- package/dist/{worker-BcYVDVUy.js → worker-6kZEsCXs.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/0075_snapshot.json +98 -314
- package/migrations/meta/0076_snapshot.json +98 -314
- 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 +22 -1
- package/package.json +5 -5
- package/dist/common-Eu6sx09c.js +0 -107
- package/dist/model-profile-B998sjVd.js +0 -67
- package/dist/rolldown-runtime-nwUcYXjP.js +0 -27
- package/dist/sentry-MDkYAVPV.js +0 -23
|
@@ -1,29 +1,28 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
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 { t as canExposeConversationPayload } from "./conversation-privacy-VuylvlKr.js";
|
|
7
|
-
import { i as defaultModelId } from "./model-profile-B998sjVd.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-Bpxe4vKa.js";
|
|
3
|
+
import { i as getChatConfig, n as botConfig, o as getSlackBotToken, v as normalizeSlackEmojiName } from "./config-C_bmRhrJ.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-CkT3_Xxp.js";
|
|
5
|
+
import { t as canExposeConversationPayload } from "./conversation-privacy-CzOfcz0U.js";
|
|
8
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-B4DYygOB.js";
|
|
9
|
-
import {
|
|
10
|
-
import { c as juniorIdentities, d as juniorDestinations, l as juniorUsers, s as juniorConversations } from "./agent-invocations-
|
|
11
|
-
import { C as juniorCodeChanges, S as juniorConversationAnnotations, T as juniorAttachments, _ as juniorConversationBriefs, a as juniorReviewItemAssignees, b as juniorConversationEvents, c as juniorReviewItems, d as juniorAutomations, h as juniorConversationParticipants, i as juniorWorkspaces, n as juniorSnapshots, o as juniorReviewItemConversations, p as juniorLocationConfigurations, r as juniorWorkspaceRepos, w as juniorCodeRepositories } from "./executor-
|
|
12
|
-
import { a as agentHistoryItemSchema, g as instructionProvenanceFor, h as instructionActors, m as contextProvenance } from "./media-
|
|
13
|
-
import { _ as CredentialUnavailableError, a as resolveAuthTokenPlaceholder, f as credentialContextForActor, h as credentialSubjectSchema, m as credentialLogContext, o as resolvePluginCommandEnv, p as credentialContextSchema } from "./registry-
|
|
14
|
-
import { n as pluginCatalogRuntime } from "./catalog-runtime-
|
|
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-vsM8_90o.js";
|
|
8
|
+
import { c as juniorIdentities, d as juniorDestinations, l as juniorUsers, s as juniorConversations } from "./agent-invocations-CUg_SODU.js";
|
|
9
|
+
import { C as juniorCodeChanges, S as juniorConversationAnnotations, T as juniorAttachments, _ as juniorConversationBriefs, a as juniorReviewItemAssignees, b as juniorConversationEvents, c as juniorReviewItems, d as juniorAutomations, h as juniorConversationParticipants, i as juniorWorkspaces, n as juniorSnapshots, o as juniorReviewItemConversations, p as juniorLocationConfigurations, r as juniorWorkspaceRepos, w as juniorCodeRepositories } from "./executor-BfYH-Wws.js";
|
|
10
|
+
import { a as agentHistoryItemSchema, g as instructionProvenanceFor, h as instructionActors, m as contextProvenance } from "./media-DTAA8Qs_.js";
|
|
11
|
+
import { _ as CredentialUnavailableError, a as resolveAuthTokenPlaceholder, f as credentialContextForActor, h as credentialSubjectSchema, m as credentialLogContext, o as resolvePluginCommandEnv, p as credentialContextSchema } from "./registry-DnrdeO4s.js";
|
|
12
|
+
import { n as pluginCatalogRuntime } from "./catalog-runtime-BWVMeZhW.js";
|
|
15
13
|
import { a as withLock, i as fenceLock, n as MUTATION_LOCK_TTL_MS, r as acquireActiveLock } from "./locks-D-0h111u.js";
|
|
16
|
-
import { n as getDefaultRedisStateAdapterFor, r as getStateAdapter } from "./adapter-
|
|
14
|
+
import { n as getDefaultRedisStateAdapterFor, r as getStateAdapter } from "./adapter-phTTgw7H.js";
|
|
17
15
|
import { i as isValidTimeZone } from "./cadence-R7Em4RjE.js";
|
|
18
|
-
import {
|
|
19
|
-
import { n as briefEntriesFromReportEvents, s as generateBrief, t as BRIEF_PROMPT } from "./prompt
|
|
16
|
+
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-CIiJtx5q.js";
|
|
17
|
+
import { n as briefEntriesFromReportEvents, s as generateBrief, t as BRIEF_PROMPT } from "./prompt--dwus7Y-.js";
|
|
18
|
+
import { n as redactSandboxEgressProxyPath, t as SANDBOX_EGRESS_PROXY_PATH } from "./proxy-path-BHYoKZdq.js";
|
|
20
19
|
import path from "node:path";
|
|
21
20
|
import { isDeepStrictEqual } from "node:util";
|
|
22
21
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
23
22
|
import { createHash, createHmac, createPrivateKey, createPublicKey, generateKeyPairSync, randomBytes, randomUUID, sign, timingSafeEqual } from "node:crypto";
|
|
24
23
|
import { z } from "zod";
|
|
25
24
|
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";
|
|
26
|
-
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";
|
|
25
|
+
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";
|
|
27
26
|
import { alias, union } from "drizzle-orm/pg-core";
|
|
28
27
|
import fs from "node:fs/promises";
|
|
29
28
|
import http from "node:http";
|
|
@@ -254,24 +253,22 @@ function historyItemProvenance(data) {
|
|
|
254
253
|
/**
|
|
255
254
|
* Project ordered Junior events into Pi context.
|
|
256
255
|
*
|
|
257
|
-
* Compaction and handoff start with replacement history. Later
|
|
258
|
-
* events append after it.
|
|
256
|
+
* Compaction and legacy handoff events start with replacement history. Later
|
|
257
|
+
* native history events append after it.
|
|
259
258
|
*
|
|
260
259
|
* Host-only events are filtered, completed authorization becomes a synthetic
|
|
261
260
|
* observation, and `maxSeq` reproduces an exact committed boundary.
|
|
262
261
|
*/
|
|
263
|
-
function projectConversationEvents(events, options) {
|
|
262
|
+
function projectConversationEvents(events, options = {}) {
|
|
264
263
|
const messages = [];
|
|
265
264
|
const provenance = [];
|
|
266
265
|
const seqs = [];
|
|
267
|
-
let modelProfile = options.defaultProfile;
|
|
268
266
|
let replacementSeq;
|
|
269
267
|
for (const event of events) {
|
|
270
268
|
if (options.maxSeq !== void 0 && event.seq > options.maxSeq) break;
|
|
271
269
|
if (event.data.type === "unknown") throw new Error(`Unsupported conversation event "${event.data.originalType}" at seq ${event.seq} (schema version ${event.schemaVersion})`);
|
|
272
270
|
if (event.data.type === "compaction_requested" || event.data.type === "compaction_prepared") continue;
|
|
273
271
|
if (event.data.type === "compaction" || event.data.type === "handoff") {
|
|
274
|
-
modelProfile = event.data.modelProfile;
|
|
275
272
|
replacementSeq = event.seq;
|
|
276
273
|
for (const replacement of event.data.replacementHistory) {
|
|
277
274
|
const message = piMessageFromHistoryItem(replacement.item);
|
|
@@ -298,7 +295,6 @@ function projectConversationEvents(events, options) {
|
|
|
298
295
|
messages,
|
|
299
296
|
provenance,
|
|
300
297
|
seqs,
|
|
301
|
-
modelProfile,
|
|
302
298
|
replacementSeq
|
|
303
299
|
};
|
|
304
300
|
}
|
|
@@ -977,21 +973,10 @@ function buildSentryEventUrl(eventId) {
|
|
|
977
973
|
/** Apply recorded model choices without carrying a previous turn's settings forward. */
|
|
978
974
|
function conversationEventModel(data, current) {
|
|
979
975
|
if (data.type === "turn_started") return void 0;
|
|
980
|
-
if (data.type === "turn_routed" || data.type === "handoff") return {
|
|
981
|
-
modelId: data.modelId,
|
|
982
|
-
modelProfile: data.modelProfile,
|
|
983
|
-
...data.reasoningLevel ? { reasoningLevel: data.reasoningLevel } : void 0
|
|
984
|
-
};
|
|
985
976
|
if (data.type === "assistant_message") {
|
|
986
977
|
const model = text$1(data.model);
|
|
987
978
|
const provider = text$1(data.provider);
|
|
988
|
-
if (model) {
|
|
989
|
-
const modelId = model.includes("/") || !provider ? model : `${provider}/${model}`;
|
|
990
|
-
return {
|
|
991
|
-
...current,
|
|
992
|
-
modelId
|
|
993
|
-
};
|
|
994
|
-
}
|
|
979
|
+
if (model) return { modelId: model.includes("/") || !provider ? model : `${provider}/${model}` };
|
|
995
980
|
}
|
|
996
981
|
return current;
|
|
997
982
|
}
|
|
@@ -1025,11 +1010,9 @@ const conversationReportSourceEventTypes = [
|
|
|
1025
1010
|
"turn_context",
|
|
1026
1011
|
"structured_event",
|
|
1027
1012
|
"attachments_delivered",
|
|
1028
|
-
"turn_routed",
|
|
1029
1013
|
"turn_completed",
|
|
1030
1014
|
"turn_failed",
|
|
1031
1015
|
"compaction",
|
|
1032
|
-
"handoff",
|
|
1033
1016
|
"subagent_started",
|
|
1034
1017
|
"subagent_ended"
|
|
1035
1018
|
];
|
|
@@ -1248,6 +1231,7 @@ function reportEventData(args) {
|
|
|
1248
1231
|
eventObjectType: objectTypeSchema.safeParse(data.meta?.eventObjectType).data,
|
|
1249
1232
|
...typeof data.meta?.eventType === "string" ? { eventType: data.meta.eventType } : void 0,
|
|
1250
1233
|
...typeof data.meta?.explicitMention === "boolean" ? { explicitMention: data.meta.explicitMention } : void 0,
|
|
1234
|
+
...data.meta?.quiet === true ? { quiet: true } : void 0,
|
|
1251
1235
|
...args.canExposePayload && typeof data.meta?.trustedSummary === "string" ? { trustedSummary: data.meta.trustedSummary } : void 0,
|
|
1252
1236
|
...args.canExposePayload ? reportMessageEvents(data.meta) : void 0,
|
|
1253
1237
|
...args.canExposePayload && (data.meta?.cards || data.meta?.objectCards) ? { cards: readMessageCardRefs(data.meta) } : void 0,
|
|
@@ -1283,16 +1267,6 @@ function reportEventData(args) {
|
|
|
1283
1267
|
type: "attachments_delivered",
|
|
1284
1268
|
attachments: data.attachments
|
|
1285
1269
|
};
|
|
1286
|
-
case "turn_routed": return {
|
|
1287
|
-
type: "turn_routed",
|
|
1288
|
-
turnId: data.turnId,
|
|
1289
|
-
modelProfile: data.modelProfile,
|
|
1290
|
-
modelId: data.modelId,
|
|
1291
|
-
...data.costUsd !== void 0 ? { costUsd: data.costUsd } : void 0,
|
|
1292
|
-
reasoningLevel: data.reasoningLevel,
|
|
1293
|
-
...data.confidence !== void 0 ? { confidence: data.confidence } : void 0,
|
|
1294
|
-
source: data.source
|
|
1295
|
-
};
|
|
1296
1270
|
case "guardian_action_reviewed": return {
|
|
1297
1271
|
type: "guardian_action_reviewed",
|
|
1298
1272
|
turnId: data.turnId,
|
|
@@ -1322,7 +1296,6 @@ function reportEventData(args) {
|
|
|
1322
1296
|
}
|
|
1323
1297
|
case "compaction": return {
|
|
1324
1298
|
type: "compaction",
|
|
1325
|
-
modelProfile: data.modelProfile,
|
|
1326
1299
|
modelId: data.modelId,
|
|
1327
1300
|
...args.canExposePayload && data.summary ? { summary: data.summary } : void 0,
|
|
1328
1301
|
...data.details ? { details: data.details } : void 0
|
|
@@ -1435,15 +1408,7 @@ function projectConversationReportEventPage(args) {
|
|
|
1435
1408
|
};
|
|
1436
1409
|
subagentStarts.delete(event.data.subagentInvocationId);
|
|
1437
1410
|
}
|
|
1438
|
-
} else
|
|
1439
|
-
type: "handoff",
|
|
1440
|
-
modelProfile: event.data.modelProfile,
|
|
1441
|
-
modelId: event.data.modelId,
|
|
1442
|
-
...event.data.reasoningLevel ? { reasoningLevel: event.data.reasoningLevel } : void 0,
|
|
1443
|
-
...event.data.triggeringToolCallId ? { triggeringToolCallId: event.data.triggeringToolCallId } : void 0,
|
|
1444
|
-
...args.canExposePayload && event.data.summary ? { summary: event.data.summary } : void 0
|
|
1445
|
-
};
|
|
1446
|
-
else data = reportEventData({
|
|
1411
|
+
} else data = reportEventData({
|
|
1447
1412
|
canExposePayload: args.canExposePayload,
|
|
1448
1413
|
data: event.data
|
|
1449
1414
|
});
|
|
@@ -1474,7 +1439,7 @@ async function readConversationEventRows(executor, args) {
|
|
|
1474
1439
|
)
|
|
1475
1440
|
else ${juniorConversationEvents.payload}
|
|
1476
1441
|
end`
|
|
1477
|
-
}).from(juniorConversationEvents).where(and(eq(juniorConversationEvents.conversationId, args.conversationId), args.beforeSeq === void 0 ? void 0 : lt(juniorConversationEvents.seq, args.beforeSeq), 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);
|
|
1442
|
+
}).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);
|
|
1478
1443
|
}
|
|
1479
1444
|
/** Project stored rows and resolve entity starts that precede the page. */
|
|
1480
1445
|
async function projectConversationEventRows(executor, args) {
|
|
@@ -1486,8 +1451,6 @@ async function projectConversationEventRows(executor, args) {
|
|
|
1486
1451
|
limit: 1,
|
|
1487
1452
|
types: [
|
|
1488
1453
|
"turn_started",
|
|
1489
|
-
"turn_routed",
|
|
1490
|
-
"handoff",
|
|
1491
1454
|
"turn_completed",
|
|
1492
1455
|
"turn_failed"
|
|
1493
1456
|
]
|
|
@@ -1565,6 +1528,76 @@ async function readConversationEventPage(executor, args) {
|
|
|
1565
1528
|
...projected.length > events.length && events[0] ? { previousSeq: events[0].seq } : void 0
|
|
1566
1529
|
};
|
|
1567
1530
|
}
|
|
1531
|
+
/**
|
|
1532
|
+
* Read reporting events on both sides of one event.
|
|
1533
|
+
*
|
|
1534
|
+
* Half of the page ends with the event at `seq`, and the rest follows it. A
|
|
1535
|
+
* reader who opens at a read position gets the context before it and the
|
|
1536
|
+
* unread events after it in one page.
|
|
1537
|
+
*/
|
|
1538
|
+
async function readConversationEventPageAround(executor, args) {
|
|
1539
|
+
const { seq, ...pageArgs } = args;
|
|
1540
|
+
const beforeLimit = Math.floor(args.limit / 2);
|
|
1541
|
+
const [before, after] = await Promise.all([beforeLimit > 0 ? readConversationEventPage(executor, {
|
|
1542
|
+
...pageArgs,
|
|
1543
|
+
beforeSeq: seq + 1,
|
|
1544
|
+
limit: beforeLimit
|
|
1545
|
+
}) : void 0, readConversationEventPageAfter(executor, {
|
|
1546
|
+
...pageArgs,
|
|
1547
|
+
afterSeq: seq,
|
|
1548
|
+
limit: args.limit - beforeLimit
|
|
1549
|
+
})]);
|
|
1550
|
+
return {
|
|
1551
|
+
events: [...before?.events ?? [], ...after.events],
|
|
1552
|
+
...after.nextSeq === void 0 ? void 0 : { nextSeq: after.nextSeq },
|
|
1553
|
+
...before?.previousSeq === void 0 ? void 0 : { previousSeq: before.previousSeq }
|
|
1554
|
+
};
|
|
1555
|
+
}
|
|
1556
|
+
/**
|
|
1557
|
+
* Read the earliest reporting events after an exclusive boundary.
|
|
1558
|
+
*
|
|
1559
|
+
* This is the forward twin of `readConversationEventPage`. It returns
|
|
1560
|
+
* `nextSeq` when newer events follow the page. Earlier pages start from the
|
|
1561
|
+
* page around the read position, so this page reads nothing before it.
|
|
1562
|
+
*/
|
|
1563
|
+
async function readConversationEventPageAfter(executor, args) {
|
|
1564
|
+
const scanSize = Math.max(args.limit + 1, MIN_SCAN_SIZE);
|
|
1565
|
+
const rows = [];
|
|
1566
|
+
let afterSeq = args.afterSeq;
|
|
1567
|
+
let projected = [];
|
|
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
|
+
}
|
|
1585
|
+
const events = projected.slice(0, args.limit);
|
|
1586
|
+
return {
|
|
1587
|
+
events,
|
|
1588
|
+
...projected.length > events.length ? { nextSeq: events.at(-1).seq } : void 0
|
|
1589
|
+
};
|
|
1590
|
+
}
|
|
1591
|
+
/** Read the newest event position, or -1 before the first event. */
|
|
1592
|
+
async function readConversationLastEventSeq(executor, conversationId) {
|
|
1593
|
+
const [row] = await executor.db().select({ seq: max(juniorConversationEvents.seq) }).from(juniorConversationEvents).where(eq(juniorConversationEvents.conversationId, conversationId));
|
|
1594
|
+
return row?.seq ?? -1;
|
|
1595
|
+
}
|
|
1596
|
+
/** Read the transcript position of one Message, when a Turn has read it. */
|
|
1597
|
+
async function readConversationMessageEventSeq(executor, conversationId, messageId) {
|
|
1598
|
+
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);
|
|
1599
|
+
return row?.seq;
|
|
1600
|
+
}
|
|
1568
1601
|
// src/chat/briefs/input.ts
|
|
1569
1602
|
const EVENT_PAGE_SIZE = 500;
|
|
1570
1603
|
async function readReportEventsThrough(executor, conversationId, throughSeq) {
|
|
@@ -1850,7 +1883,7 @@ async function updateConversationBrief(context) {
|
|
|
1850
1883
|
return;
|
|
1851
1884
|
}
|
|
1852
1885
|
const input = await briefInputFromSql(executor, run.conversationId, terminalSeq);
|
|
1853
|
-
const modelId =
|
|
1886
|
+
const modelId = botConfig.fastModelId;
|
|
1854
1887
|
const generation = await generateBrief({
|
|
1855
1888
|
completeObject: (request) => completeObject({
|
|
1856
1889
|
...request,
|
|
@@ -2046,6 +2079,7 @@ async function readConversationAccessFromSql(db, conversationIds, viewer) {
|
|
|
2046
2079
|
return [row.conversationId, {
|
|
2047
2080
|
canViewPrivateContent,
|
|
2048
2081
|
isParticipant,
|
|
2082
|
+
...validRootConversationId !== void 0 ? { rootConversationId: validRootConversationId } : void 0,
|
|
2049
2083
|
visibility,
|
|
2050
2084
|
...validRootConversationId !== void 0 && row.provider !== null && row.providerTenantId ? { tenant: {
|
|
2051
2085
|
provider: row.provider,
|
|
@@ -2054,6 +2088,18 @@ async function readConversationAccessFromSql(db, conversationIds, viewer) {
|
|
|
2054
2088
|
}];
|
|
2055
2089
|
}));
|
|
2056
2090
|
}
|
|
2091
|
+
/**
|
|
2092
|
+
* Apply `policies/conversation-access.md`: whether work in the `requester`
|
|
2093
|
+
* Conversation may read or find the data of the `target` Conversation. The
|
|
2094
|
+
* person of the Turn does not change the result. A private Conversation is
|
|
2095
|
+
* reachable only from its own tree.
|
|
2096
|
+
*/
|
|
2097
|
+
function canAccessConversation(args) {
|
|
2098
|
+
const { requester, target } = args;
|
|
2099
|
+
if (requester.rootConversationId !== void 0 && requester.rootConversationId === target.rootConversationId) return true;
|
|
2100
|
+
if (!requester.tenant || !target.tenant || requester.tenant.provider !== target.tenant.provider || requester.tenant.providerTenantId !== target.tenant.providerTenantId) return false;
|
|
2101
|
+
return target.visibility === "public";
|
|
2102
|
+
}
|
|
2057
2103
|
// src/chat/plugins/conversation-event-reader.ts
|
|
2058
2104
|
function registeredEventName$1(plugin, eventName) {
|
|
2059
2105
|
if (!plugin.conversationEvents?.some((definition) => definition.eventName === eventName)) throw new TypeError(`Plugin "${plugin.manifest.name}" did not register event "${eventName}"`);
|
|
@@ -2091,7 +2137,7 @@ function startOfUtcDay(value) {
|
|
|
2091
2137
|
return date;
|
|
2092
2138
|
}
|
|
2093
2139
|
function registeredEventName(plugin, eventName) {
|
|
2094
|
-
if (!plugin.conversationEvents?.some((definition) => definition.eventName === eventName)) throw new TypeError(`Plugin "${plugin.manifest.name}" did not register event "${eventName}"`);
|
|
2140
|
+
if (!isPluginModelCostEventName(eventName) && !plugin.conversationEvents?.some((definition) => definition.eventName === eventName)) throw new TypeError(`Plugin "${plugin.manifest.name}" did not register event "${eventName}"`);
|
|
2095
2141
|
return eventName;
|
|
2096
2142
|
}
|
|
2097
2143
|
/** Create aggregate event-cost reads bound to one plugin's registered namespace. */
|
|
@@ -2185,6 +2231,37 @@ function createPluginLogger(plugin) {
|
|
|
2185
2231
|
}
|
|
2186
2232
|
};
|
|
2187
2233
|
}
|
|
2234
|
+
// src/chat/plugins/model-cost.ts
|
|
2235
|
+
/**
|
|
2236
|
+
* Bind plugin model cost to one Conversation. Each priced call becomes an
|
|
2237
|
+
* event in the plugin's namespace, so Conversation cost counts it without
|
|
2238
|
+
* the plugin reporting it. A failed write is logged, not thrown, so it
|
|
2239
|
+
* cannot discard a model result that already succeeded.
|
|
2240
|
+
*/
|
|
2241
|
+
function createPluginModelCostRecorder(args) {
|
|
2242
|
+
return async ({ costUsd, modelRole }) => {
|
|
2243
|
+
await runBestEffort(async () => {
|
|
2244
|
+
await getConversationEventStore().append(args.conversationId, [{
|
|
2245
|
+
createdAtMs: Date.now(),
|
|
2246
|
+
data: {
|
|
2247
|
+
type: "structured_event",
|
|
2248
|
+
namespace: args.pluginName,
|
|
2249
|
+
name: pluginModelCostEventNames[args.source],
|
|
2250
|
+
version: 1,
|
|
2251
|
+
...args.turnId ? { turnId: args.turnId } : void 0,
|
|
2252
|
+
content: {
|
|
2253
|
+
costUsd,
|
|
2254
|
+
modelRole,
|
|
2255
|
+
...args.toolName ? { toolName: args.toolName } : void 0
|
|
2256
|
+
}
|
|
2257
|
+
}
|
|
2258
|
+
}], { activity: "preserve" });
|
|
2259
|
+
}, "plugin.model_cost.record.failed", {
|
|
2260
|
+
"app.plugin.name": args.pluginName,
|
|
2261
|
+
"gen_ai.tool.name": args.toolName
|
|
2262
|
+
});
|
|
2263
|
+
};
|
|
2264
|
+
}
|
|
2188
2265
|
// src/chat/sandbox/noninteractive-command.ts
|
|
2189
2266
|
const NON_INTERACTIVE_ENV = {
|
|
2190
2267
|
CI: "1",
|
|
@@ -2360,7 +2437,7 @@ function createSandboxCapability(workspace, ownerSignal) {
|
|
|
2360
2437
|
/** Create the host-owned structured model capability exposed to plugins. */
|
|
2361
2438
|
function createPluginModel(pluginName, options = {}, runtime = {}) {
|
|
2362
2439
|
return { async completeObject(input) {
|
|
2363
|
-
const modelId = options.structuredModelId ?? (options.structuredModel === "default" ?
|
|
2440
|
+
const modelId = options.structuredModelId ?? (options.structuredModel === "default" ? botConfig.modelId : botConfig.fastModelId);
|
|
2364
2441
|
const result = await completeObject({
|
|
2365
2442
|
modelId,
|
|
2366
2443
|
schema: input.schema,
|
|
@@ -2374,6 +2451,10 @@ function createPluginModel(pluginName, options = {}, runtime = {}) {
|
|
|
2374
2451
|
pluginModelRole: "structured"
|
|
2375
2452
|
}
|
|
2376
2453
|
});
|
|
2454
|
+
if (result.costUsd !== void 0) await runtime.onCost?.({
|
|
2455
|
+
costUsd: result.costUsd,
|
|
2456
|
+
modelRole: "structured"
|
|
2457
|
+
});
|
|
2377
2458
|
return {
|
|
2378
2459
|
object: result.object,
|
|
2379
2460
|
...result.costUsd !== void 0 ? { costUsd: result.costUsd } : void 0
|
|
@@ -2386,7 +2467,7 @@ function createPluginEmbedder(pluginName, runtime = {}) {
|
|
|
2386
2467
|
model: botConfig.embeddingModelId,
|
|
2387
2468
|
provider: GEN_AI_PROVIDER_NAME,
|
|
2388
2469
|
async embedTexts(input) {
|
|
2389
|
-
|
|
2470
|
+
const result = await embedTexts({
|
|
2390
2471
|
modelId: botConfig.embeddingModelId,
|
|
2391
2472
|
texts: input.texts,
|
|
2392
2473
|
...input.inputType !== void 0 ? { inputType: input.inputType } : void 0,
|
|
@@ -2396,13 +2477,18 @@ function createPluginEmbedder(pluginName, runtime = {}) {
|
|
|
2396
2477
|
pluginModelRole: "embedding"
|
|
2397
2478
|
}
|
|
2398
2479
|
});
|
|
2480
|
+
if (result.costUsd !== void 0) await runtime.onCost?.({
|
|
2481
|
+
costUsd: result.costUsd,
|
|
2482
|
+
modelRole: "embedding"
|
|
2483
|
+
});
|
|
2484
|
+
return result;
|
|
2399
2485
|
}
|
|
2400
2486
|
};
|
|
2401
2487
|
}
|
|
2402
2488
|
/** Create the host-owned reranking capability exposed to prompt hooks. */
|
|
2403
|
-
function createPluginReranker(pluginName) {
|
|
2489
|
+
function createPluginReranker(pluginName, runtime = {}) {
|
|
2404
2490
|
return { async rerank(input) {
|
|
2405
|
-
|
|
2491
|
+
const result = await rerankTexts({
|
|
2406
2492
|
documents: input.documents,
|
|
2407
2493
|
modelId: botConfig.rerankingModelId,
|
|
2408
2494
|
query: input.query,
|
|
@@ -2411,6 +2497,11 @@ function createPluginReranker(pluginName) {
|
|
|
2411
2497
|
pluginModelRole: "reranking"
|
|
2412
2498
|
}
|
|
2413
2499
|
});
|
|
2500
|
+
if (result.costUsd !== void 0) await runtime.onCost?.({
|
|
2501
|
+
costUsd: result.costUsd,
|
|
2502
|
+
modelRole: "reranking"
|
|
2503
|
+
});
|
|
2504
|
+
return result;
|
|
2414
2505
|
} };
|
|
2415
2506
|
}
|
|
2416
2507
|
/** Create the host-owned decision model capability exposed to tool hooks. */
|
|
@@ -2431,6 +2522,10 @@ function createPluginDecider(pluginName, runtime = {}) {
|
|
|
2431
2522
|
pluginModelRole: "decision"
|
|
2432
2523
|
}
|
|
2433
2524
|
});
|
|
2525
|
+
if (result.costUsd !== void 0) await runtime.onCost?.({
|
|
2526
|
+
costUsd: result.costUsd,
|
|
2527
|
+
modelRole: "decision"
|
|
2528
|
+
});
|
|
2434
2529
|
const answer = result.answers.answer;
|
|
2435
2530
|
return {
|
|
2436
2531
|
choice: answer.choice,
|
|
@@ -3740,7 +3835,6 @@ function parseSandboxEgressPermissionDeniedSignal(value) {
|
|
|
3740
3835
|
return result.success ? result.data : void 0;
|
|
3741
3836
|
}
|
|
3742
3837
|
// src/chat/sandbox/egress/session.ts
|
|
3743
|
-
const SANDBOX_EGRESS_PROXY_PATH = "/api/internal/sandbox-egress";
|
|
3744
3838
|
const SANDBOX_EGRESS_TOKEN_VERSION = "v1";
|
|
3745
3839
|
const SANDBOX_EGRESS_HMAC_CONTEXT = "junior.sandbox_egress.v1";
|
|
3746
3840
|
const SANDBOX_EGRESS_AUTH_SIGNAL_PREFIX = "sandbox-egress-auth-required";
|
|
@@ -3962,14 +4056,10 @@ function sandboxEgressAttributes(input) {
|
|
|
3962
4056
|
...input.status ? { "http.response.status_code": input.status } : void 0
|
|
3963
4057
|
};
|
|
3964
4058
|
}
|
|
3965
|
-
/** Hide the credential token in a sandbox egress proxy path before logging. */
|
|
3966
|
-
function redactSandboxEgressProxyPath(pathname) {
|
|
3967
|
-
if (pathname.startsWith(`/api/internal/sandbox-egress/`)) return `${SANDBOX_EGRESS_PROXY_PATH}/<token>`;
|
|
3968
|
-
return pathname;
|
|
3969
|
-
}
|
|
3970
4059
|
/** Return log attributes for the proxy route and the upstream path. */
|
|
3971
4060
|
function sandboxEgressRoutingAttributes(request, upstreamUrl) {
|
|
3972
|
-
const
|
|
4061
|
+
const proxyUrl = new URL(request.url);
|
|
4062
|
+
const attributes = { "app.sandbox.egress.proxy_path": redactSandboxEgressProxyPath(proxyUrl.pathname) };
|
|
3973
4063
|
if (upstreamUrl) {
|
|
3974
4064
|
attributes["app.sandbox.egress.upstream_path"] = upstreamUrl.pathname;
|
|
3975
4065
|
const gitService = upstreamUrl.searchParams.get("service");
|
|
@@ -7232,11 +7322,20 @@ async function runAfterToolExecuteHooks(args) {
|
|
|
7232
7322
|
for (const plugin of hooked) {
|
|
7233
7323
|
if (signal?.aborted) break;
|
|
7234
7324
|
const pluginName = plugin.manifest.name;
|
|
7325
|
+
const onCost = createPluginModelCostRecorder({
|
|
7326
|
+
...args.turn,
|
|
7327
|
+
pluginName,
|
|
7328
|
+
source: "afterToolExecute",
|
|
7329
|
+
toolName: args.tool.name
|
|
7330
|
+
});
|
|
7235
7331
|
let denial;
|
|
7236
7332
|
try {
|
|
7237
7333
|
await withPluginHookSpan(pluginName, "afterToolExecute", async () => await plugin.hooks.afterToolExecute({
|
|
7238
7334
|
...basePluginContext$1(plugin),
|
|
7239
|
-
decider: createPluginDecider(pluginName, {
|
|
7335
|
+
decider: createPluginDecider(pluginName, {
|
|
7336
|
+
onCost,
|
|
7337
|
+
signal
|
|
7338
|
+
}),
|
|
7240
7339
|
decision: {
|
|
7241
7340
|
deny(reason) {
|
|
7242
7341
|
denial = reason;
|
|
@@ -7248,7 +7347,10 @@ async function runAfterToolExecuteHooks(args) {
|
|
|
7248
7347
|
});
|
|
7249
7348
|
}
|
|
7250
7349
|
},
|
|
7251
|
-
model: createPluginModel(pluginName, plugin.model, {
|
|
7350
|
+
model: createPluginModel(pluginName, plugin.model, {
|
|
7351
|
+
onCost,
|
|
7352
|
+
signal
|
|
7353
|
+
}),
|
|
7252
7354
|
sandbox,
|
|
7253
7355
|
...signal ? { signal } : void 0,
|
|
7254
7356
|
tool: {
|
|
@@ -8802,19 +8904,26 @@ function pluginSpanAttributeSetter(pluginName, setSpanAttributes) {
|
|
|
8802
8904
|
};
|
|
8803
8905
|
}
|
|
8804
8906
|
function invocationPluginContext(plugin, context, setSpanAttributes, turnId) {
|
|
8907
|
+
const base = basePluginContext$1(plugin);
|
|
8908
|
+
const onCost = context.conversationId ? createPluginModelCostRecorder({
|
|
8909
|
+
conversationId: context.conversationId,
|
|
8910
|
+
pluginName: plugin.manifest.name,
|
|
8911
|
+
source: "userPrompt",
|
|
8912
|
+
...turnId ? { turnId } : void 0
|
|
8913
|
+
}) : void 0;
|
|
8805
8914
|
return {
|
|
8806
|
-
...
|
|
8915
|
+
...base,
|
|
8807
8916
|
conversationId: context.conversationId,
|
|
8808
8917
|
locationId: context.locationId,
|
|
8809
|
-
embedder: createPluginEmbedder(plugin.manifest.name),
|
|
8918
|
+
embedder: createPluginEmbedder(plugin.manifest.name, { onCost }),
|
|
8810
8919
|
...context.conversationId && turnId ? { events: createPluginConversationEvents({
|
|
8811
8920
|
conversationId: context.conversationId,
|
|
8812
8921
|
operationId: `user-prompt:${turnId}`,
|
|
8813
8922
|
plugin,
|
|
8814
8923
|
turnId
|
|
8815
8924
|
}) } : void 0,
|
|
8816
|
-
model: createPluginModel(plugin.manifest.name, plugin.model),
|
|
8817
|
-
reranker: createPluginReranker(plugin.manifest.name),
|
|
8925
|
+
model: createPluginModel(plugin.manifest.name, plugin.model, { onCost }),
|
|
8926
|
+
reranker: createPluginReranker(plugin.manifest.name, { onCost }),
|
|
8818
8927
|
setSpanAttributes: pluginSpanAttributeSetter(plugin.manifest.name, setSpanAttributes),
|
|
8819
8928
|
source: context.source,
|
|
8820
8929
|
text: context.userText ?? "",
|
|
@@ -9079,6 +9188,12 @@ function getPluginTools(context, sandbox = createSandboxCapability(context.works
|
|
|
9079
9188
|
};
|
|
9080
9189
|
const resolveActor = context.resolveActorIdentity ?? (async () => void 0);
|
|
9081
9190
|
const automationUrl = (context.source.kind === "event_automation" || context.source.kind === "scheduled_automation") && context.source.automationId ? getDashboardTaskLink(context.source.automationId) : void 0;
|
|
9191
|
+
const onCost = createPluginModelCostRecorder({
|
|
9192
|
+
conversationId: context.conversationId,
|
|
9193
|
+
pluginName,
|
|
9194
|
+
source: "tool",
|
|
9195
|
+
...context.turnId ? { turnId: context.turnId } : void 0
|
|
9196
|
+
});
|
|
9082
9197
|
const common = {
|
|
9083
9198
|
...basePluginContext$1(plugin),
|
|
9084
9199
|
annotations,
|
|
@@ -9087,10 +9202,10 @@ function getPluginTools(context, sandbox = createSandboxCapability(context.works
|
|
|
9087
9202
|
locationId: context.locationId,
|
|
9088
9203
|
...slackContext ? { slack: slackContext } : void 0,
|
|
9089
9204
|
userText: context.userText,
|
|
9090
|
-
embedder: createPluginEmbedder(pluginName),
|
|
9205
|
+
embedder: createPluginEmbedder(pluginName, { onCost }),
|
|
9091
9206
|
egress: context.egress,
|
|
9092
9207
|
...mcp ? { mcp } : void 0,
|
|
9093
|
-
model: createPluginModel(pluginName, plugin.model),
|
|
9208
|
+
model: createPluginModel(pluginName, plugin.model, { onCost }),
|
|
9094
9209
|
events,
|
|
9095
9210
|
sandbox,
|
|
9096
9211
|
state: createPluginState(pluginName),
|
|
@@ -9524,11 +9639,13 @@ function createPluginHookRunner(input = {}) {
|
|
|
9524
9639
|
const loaded = getPlugins();
|
|
9525
9640
|
return {
|
|
9526
9641
|
async afterToolExecute(tool) {
|
|
9527
|
-
if (!input.
|
|
9642
|
+
if (!input.toolRun) return [];
|
|
9643
|
+
const { sandbox, ...turn } = input.toolRun;
|
|
9528
9644
|
return await runAfterToolExecuteHooks({
|
|
9529
9645
|
plugins: loaded,
|
|
9530
|
-
sandbox:
|
|
9531
|
-
tool
|
|
9646
|
+
sandbox: sandbox(),
|
|
9647
|
+
tool,
|
|
9648
|
+
turn
|
|
9532
9649
|
});
|
|
9533
9650
|
},
|
|
9534
9651
|
async afterMcpTool(tool) {
|
|
@@ -10182,12 +10299,9 @@ function egressAttributes(input) {
|
|
|
10182
10299
|
...input.status ? { "http.response.status_code": input.status } : void 0
|
|
10183
10300
|
};
|
|
10184
10301
|
}
|
|
10185
|
-
function redactedProxyPath(pathname) {
|
|
10186
|
-
if (pathname.startsWith(`/api/internal/sandbox-egress/`)) return `${SANDBOX_EGRESS_PROXY_PATH}/<token>`;
|
|
10187
|
-
return pathname;
|
|
10188
|
-
}
|
|
10189
10302
|
function routingAttributes(request, upstreamUrl) {
|
|
10190
|
-
const
|
|
10303
|
+
const proxyUrl = new URL(request.url);
|
|
10304
|
+
const attributes = { "app.sandbox.egress.proxy_path": redactSandboxEgressProxyPath(proxyUrl.pathname) };
|
|
10191
10305
|
if (upstreamUrl) {
|
|
10192
10306
|
attributes["app.sandbox.egress.upstream_path"] = upstreamUrl.pathname;
|
|
10193
10307
|
const gitService = upstreamUrl.searchParams.get("service");
|
|
@@ -12815,7 +12929,7 @@ async function materializeStoredTurnRecord(conversationId, turnId, followCurrent
|
|
|
12815
12929
|
const eventStore = getConversationEventStore();
|
|
12816
12930
|
const currentHistoryVersion = await eventStore.loadCurrentHistoryVersion(conversationId);
|
|
12817
12931
|
const followsReplacement = followCurrentReplacement && (parsed.state === "running" || parsed.state === "paused") && parsed.historyVersion !== void 0 && parsed.historyVersion !== currentHistoryVersion;
|
|
12818
|
-
const piProjection = followsReplacement ? projectConversationEvents(await eventStore.loadCurrentHistory(conversationId)
|
|
12932
|
+
const piProjection = followsReplacement ? projectConversationEvents(await eventStore.loadCurrentHistory(conversationId)) : pinnedProjection;
|
|
12819
12933
|
const turnStartMessageIndex = followsReplacement ? 0 : parsed.turnStartSeq === void 0 ? void 0 : piProjection.seqs.filter((seq) => seq <= parsed.turnStartSeq).length;
|
|
12820
12934
|
const conversationStore = getConversationStore();
|
|
12821
12935
|
const conversation = await conversationStore.get({ conversationId });
|
|
@@ -13676,6 +13790,7 @@ function recordDeliveredAssistantMessage(args) {
|
|
|
13676
13790
|
},
|
|
13677
13791
|
meta: {
|
|
13678
13792
|
...objectCards?.length ? { objectCards } : void 0,
|
|
13793
|
+
...args.quiet ? { quiet: args.quiet } : void 0,
|
|
13679
13794
|
replied: true,
|
|
13680
13795
|
...args.source ? { source: args.source } : void 0
|
|
13681
13796
|
}
|
|
@@ -14325,7 +14440,7 @@ function durableMessageIdentity(message) {
|
|
|
14325
14440
|
*
|
|
14326
14441
|
* Returns `current.length` only when every committed message still matches by
|
|
14327
14442
|
* durable identity. A shorter `next` or a content/role/timestamp change is a
|
|
14328
|
-
* branch that only compaction
|
|
14443
|
+
* branch that only compaction may perform.
|
|
14329
14444
|
*/
|
|
14330
14445
|
function countDurablePrefix(current, next) {
|
|
14331
14446
|
if (next.length < current.length) return countMatchingDeepPrefix(current, next);
|
|
@@ -14372,15 +14487,15 @@ function resolveCommitProvenance(args) {
|
|
|
14372
14487
|
}
|
|
14373
14488
|
/** Load the current Pi agent history for a conversation. */
|
|
14374
14489
|
async function loadProjection(args) {
|
|
14375
|
-
return projectConversationEvents(await getConversationEventStore().loadCurrentHistory(args.conversationId)
|
|
14490
|
+
return projectConversationEvents(await getConversationEventStore().loadCurrentHistory(args.conversationId)).messages;
|
|
14376
14491
|
}
|
|
14377
14492
|
/** Load current Pi context with aligned provenance and source event sequences. */
|
|
14378
14493
|
async function loadConversationProjection(args) {
|
|
14379
|
-
return projectConversationEvents(await getConversationEventStore().loadCurrentHistory(args.conversationId)
|
|
14494
|
+
return projectConversationEvents(await getConversationEventStore().loadCurrentHistory(args.conversationId));
|
|
14380
14495
|
}
|
|
14381
14496
|
/** Load the active Pi projection before a conversation's next request. */
|
|
14382
14497
|
async function openConversationProjection(args) {
|
|
14383
|
-
return projectConversationEvents(await getConversationEventStore().loadCurrentHistory(args.conversationId)
|
|
14498
|
+
return projectConversationEvents(await getConversationEventStore().loadCurrentHistory(args.conversationId));
|
|
14384
14499
|
}
|
|
14385
14500
|
/**
|
|
14386
14501
|
* Load a turn's committed Pi projection from the durable event store.
|
|
@@ -14395,10 +14510,10 @@ async function openConversationProjection(args) {
|
|
|
14395
14510
|
*/
|
|
14396
14511
|
async function loadTurnProjection(args) {
|
|
14397
14512
|
const eventStore = getConversationEventStore();
|
|
14398
|
-
if (args.committedSeq < 0) return projectConversationEvents(await eventStore.loadCurrentHistory(args.conversationId)
|
|
14513
|
+
if (args.committedSeq < 0) return projectConversationEvents(await eventStore.loadCurrentHistory(args.conversationId));
|
|
14399
14514
|
const historyEvents = await eventStore.loadHistoryContaining(args.conversationId, args.committedSeq, args.includeTail ? void 0 : args.committedSeq);
|
|
14400
14515
|
if (!historyEvents) return;
|
|
14401
|
-
return projectConversationEvents(historyEvents
|
|
14516
|
+
return projectConversationEvents(historyEvents);
|
|
14402
14517
|
}
|
|
14403
14518
|
/** Load MCP providers the credential subject connected in this conversation. */
|
|
14404
14519
|
async function loadConnectedMcpProviders(args) {
|
|
@@ -14413,7 +14528,7 @@ function messageTimestamp(message) {
|
|
|
14413
14528
|
*
|
|
14414
14529
|
* Checkpoints are append-only against the durable identity of the committed
|
|
14415
14530
|
* prefix (role, timestamp, content; tool results also match call id). A shorter
|
|
14416
|
-
* history or a true content branch is rejected — only compaction
|
|
14531
|
+
* history or a true content branch is rejected — only compaction may
|
|
14417
14532
|
* intentionally replace active model history. In-place Pi mutations of already
|
|
14418
14533
|
* committed assistant envelopes (usage/stopReason) do not block the suffix.
|
|
14419
14534
|
*/
|
|
@@ -14457,7 +14572,7 @@ async function commitAcceptedReply(args) {
|
|
|
14457
14572
|
async function commitMessagesLocked(args, executor) {
|
|
14458
14573
|
const eventStore = createSqlConversationEventStore(executor);
|
|
14459
14574
|
const currentEvents = await eventStore.loadCurrentHistory(args.conversationId);
|
|
14460
|
-
const current = projectConversationEvents(currentEvents
|
|
14575
|
+
const current = projectConversationEvents(currentEvents);
|
|
14461
14576
|
const nextLocalMessages = args.messages.map(normalizeDurableMessage);
|
|
14462
14577
|
const matchingPrefix = countDurablePrefix(current.messages, nextLocalMessages);
|
|
14463
14578
|
const nextLocalProvenance = resolveCommitProvenance({
|
|
@@ -14640,45 +14755,6 @@ async function recordSubscribedReplyRoute(args) {
|
|
|
14640
14755
|
}
|
|
14641
14756
|
}]);
|
|
14642
14757
|
}
|
|
14643
|
-
/**
|
|
14644
|
-
* Load the profile of the newest Turn route or handoff.
|
|
14645
|
-
*
|
|
14646
|
-
* The projection profile is not enough: a Turn route does not replace history.
|
|
14647
|
-
*/
|
|
14648
|
-
async function loadLastModelProfile(args) {
|
|
14649
|
-
const data = (await getConversationEventStore().query(args.conversationId, {
|
|
14650
|
-
limit: 1,
|
|
14651
|
-
types: ["turn_routed", "handoff"]
|
|
14652
|
-
})).events[0]?.data;
|
|
14653
|
-
return data?.type === "turn_routed" || data?.type === "handoff" ? data.modelProfile : void 0;
|
|
14654
|
-
}
|
|
14655
|
-
/** Load a previously selected model profile for a resumed turn. */
|
|
14656
|
-
async function loadTurnRoute(args) {
|
|
14657
|
-
const event = await getConversationEventStore().loadByIdempotencyKey(args.conversationId, `turn:${args.turnId}:routed`);
|
|
14658
|
-
if (!event) return;
|
|
14659
|
-
if (event.data.type !== "turn_routed" || event.data.turnId !== args.turnId) throw new Error(`Turn route key for "${args.turnId}" has invalid data`);
|
|
14660
|
-
return {
|
|
14661
|
-
...event.data,
|
|
14662
|
-
seq: event.seq
|
|
14663
|
-
};
|
|
14664
|
-
}
|
|
14665
|
-
/** Record the model profile selected for one turn without changing agent history. */
|
|
14666
|
-
async function recordTurnRoute(args) {
|
|
14667
|
-
await getConversationEventStore().append(args.conversationId, [{
|
|
14668
|
-
idempotencyKey: `turn:${args.turnId}:routed`,
|
|
14669
|
-
createdAtMs: Date.now(),
|
|
14670
|
-
data: {
|
|
14671
|
-
type: "turn_routed",
|
|
14672
|
-
turnId: args.turnId,
|
|
14673
|
-
modelProfile: args.modelProfile,
|
|
14674
|
-
modelId: args.modelId,
|
|
14675
|
-
...args.costUsd !== void 0 ? { costUsd: args.costUsd } : void 0,
|
|
14676
|
-
reasoningLevel: args.reasoningLevel,
|
|
14677
|
-
...args.confidence !== void 0 ? { confidence: args.confidence } : void 0,
|
|
14678
|
-
source: args.source
|
|
14679
|
-
}
|
|
14680
|
-
}]);
|
|
14681
|
-
}
|
|
14682
14758
|
/** Record a host-observed parent tool start without adding it to Pi replay. */
|
|
14683
14759
|
async function recordToolExecutionStarted(args) {
|
|
14684
14760
|
await getConversationEventStore().append(args.conversationId, [{
|
|
@@ -14736,4 +14812,4 @@ async function recordGuardianActionReviewed(args) {
|
|
|
14736
14812
|
createdAtMs: Date.now()
|
|
14737
14813
|
}]);
|
|
14738
14814
|
}
|
|
14739
|
-
export { loadTurnCheckpoint as $, recordSlackAttachment as $a, wrapSandboxSetupError as $i, listReplyActionItems as $n, getWorkspaceByName as $r, instructionTextForProjection as $t, buildConversationContext as A, buildNonInteractiveShellScript as Aa, openSlackModal as Ai, getOAuthAccountProviders as An, findMatchingWatches as Ar, recordConversationRetry as At, createPluginEgress as B, conversationPinnedForUser as Ba, getFilePermalink as Bi, getPlugins as Bn, verifyTimerWatchCredentialSubject as Br, TurnSliceLimitExceededError as Bt, projectConversationMessages as C, SANDBOX_REPOS_ROOT as Ca, normalizeSlackStatusText as Ci, getAgentContextInputLimitTokens as Cn, STOP_WATCHING_TOOL_NAME as Cr, hasConversationStop as Ct, fallbackShortTitle as D, sandboxSkillFile as Da, deleteSlackMessage as Di, createUserTokenStore as Dn, createTimerWatch as Dr, listActiveConversationIds as Dt, settleConversationTitleWork as E, sandboxSkillDir as Ea, addReactionToMessage as Ei, setExperimentalFeatures as En, collectEventMatchKeys as Er, isInvalidConversationRecordError as Et, markConversationMessage as F, conversationArchivedForUser as Fa, uploadFilesToConversation as Fi, getPluginRoutes as Fn, bindScheduledAutomationCredentialSubject as Fr, startConversationWork as Ft, AuthorizationFlowDisabledError as G, readLatestConversationBrief as Ga, normalizeSlackConversationId as Gi, setBriefsConfig as Gn, getDashboardTaskLink as Gr, CODEMODE_TOOL_NAME as Gt, createPluginAuthOrchestration as H, readConversationViewerMarks as Ha, getSlackClient as Hi, validatePlugins as Hn, getDashboardConversationLink as Hr, buildTurnErrorResponse as Ht, normalizeConversationText as I, conversationHasParticipantUser as Ia, slackEntitySchema as Ii, getPluginSlackConversationLink as In, bindSlackDirectCredentialSubject as Ir, steerWebPendingMessages as It, canReusePendingAuthLink as J, loadForkHistory as Ja, getWorkspaceTeamId as Ji, countReviewItemsNeedingUser as Jn, createPluginState as Jr, getPiMessageRole as Jt, AuthorizationPauseError as K, readConversationEventPage as Ka, runWithSlackInstallationToken as Ki, REVIEW_ITEM_REPLIED_REASON as Kn, setDashboardConversationLinkOptions as Kr, persistWithRetry as Kt, recordDeliveredAssistantMessage as L, conversationIsMemberRoot as La, slackExternalRefIdSchema as Li, getPluginSystemPromptContributions as Ln, verifyEventAutomationCredentialSubject as Lr, stopConversationWork as Lt, estimateConversationContextTokens as M, createPluginLogger as Ma, postSlackMessage as Mi, agent_hooks_exports as Mn, listWatches as Mr, removeActiveConversation as Mt, getConversationMessageSlackTs as N, readConversationAccessFromSql as Na, removeReactionFromMessage as Ni, createPluginHookRunner as Nn, takeDueTimerWatches as Nr, requestAnotherSlice as Nt, resolveTaskTitle as O, sandboxSkillPathResolution as Oa, getSlackMessagePermalink as Oi, findLegacyWebActorUserId as On, createWatch as Or, markConversationWorkEnqueued as Ot, isHumanConversationMessage as P, conversationArchivedForEmail as Pa, updateSlackMessage as Pi, getPluginApiRoutes as Pn, bindEventAutomationCredentialSubject as Pr, requestConversationWork as Pt, continuableMessages as Q, readAttachmentVisionSummary as Qa, throwSandboxOperationError as Qi, insertReviewItem as Qn, getWorkspace as Qr, hasRuntimeTurnContext as Qt, turnHasReply as R, conversationNotArchivedForEmail as Ra, SlackActionError as Ri, getPluginTools as Rn, verifyScheduledAutomationCredentialSubject as Rr, TURN_LIMIT_WRAP_UP_MESSAGE as Rt, persistConversationMessages as S, SANDBOX_JUNIOR_ROOT as Sa, normalizeSlackReplyMarkdown as Si, getAgentContextCompactionTriggerTokens as Sn, RESOURCE_WATCH_TOOL_SOURCE as Sr, getConversationWorkState as St, resolveConversationTitle as T, SANDBOX_WORKSPACE_ROOT as Ta, truncateStatusText as Ti, isExperimentalFeatureEnabled as Tn, cancelWatch as Tr, isFinalAttempt as Tt, authorizationId as U, viewerConversationMembership as Ua, isConversationScopedChannel as Ui, coreTaskRegistrations as Un, getDashboardObjectIconLink as Ur, createTurnLimitGate as Ut, PluginCredentialFailureError as V, conversationViewerMarks as Va, getHeaderString as Vi, setPlugins as Vn, JUNIOR_THREAD_STATE_TTL_MS as Vr, TurnToolCallLimitExceededError as Vt, AuthPausePersistenceError as W, createPluginConversationEvents as Wa, isDmChannel as Wi, registration_exports as Wn, getDashboardReviewItemLink as Wr, isTurnExecutionLimitExceededError as Wt, getConversationPendingAuth as X, getSlackFileId as Xa, isAbortError as Xi, getOpenReviewItemByDedupeKey as Xn, createWorkspace as Xr, getUserMessageInstructionText as Xt, clearPendingAuth as Y, notInheritedByForkChild as Ya, runWithWorkspaceTeamId as Yi, dismissOpenReviewItems as Yn, renderToolResultNudge as Yr, getTerminalAssistantMessages as Yt, wasPendingAuthStopped as Z, matchSlackAttachments as Za, isAlreadyExistsError as Zi, getReviewItem as Zn, deleteWorkspace as Zr, hasCurrentInstruction as Zt, recordSubscribedReplyRoute as _, PluginToolDeniedError as _a, parseOAuthStatePayload as _i, getThreadStopDecision as _n, setConfigDefaults as _o, resolveAssignees as _r, completeConversationStop as _t, loadLastModelProfile as a, consumeSandboxEgressAuthRequiredSignal as aa, loadSnapshotsForProfile as ai, normalizeToolNameFromResult as an, defaultTimezone as ao, canActOnReviewItem as ar, listTurnSummaries as at, appendConversationMessages as b, SANDBOX_COMMAND_PATH as ba, escapeSlackMrkdwnText as bi, estimateTextTokens as bn, RESOURCE_SUBSCRIPTION_DEFAULT_TTL_MS as br, drainConversationMailbox as bt, loadTurnRoute as c, parseSandboxEgressCredentialToken as ca, create as ci, trimTrailingAssistantMessages as cn, createPluginCache as co, isOnlyAssignee as cr, CONVERSATION_WORK_STALE_ENQUEUE_MS as ct, recordAttachmentsDelivered as d, resolveSandboxCommandEnvironment as da, ensureDockerDaemon as di, TURN_CONTEXT_TAG as dn, historyItemFromPiMessage as do, requireReviewItemLinks as dr, appendInboundMessage as dt, WorkspaceSnapshotNotReadyError as ea, listWorkspaces as ei, isAssistantMessage as en, resolveRootVisibility as eo, listWaitingConversations as er, saveTurnCheckpoint as et, recordAuthenticationLinked as f, normalizeSandboxEgressTracePropagationDomains as fa, getSandboxProvider as fi, buildDeterministicAssistantMessageId as fn, piMessageFromHistoryItem as fo, reviewItemNeedsUser as fr, beginConversationResume as ft, recordMcpProviderConnected as g, workspaceRepoCheckoutPath as ga, formatProviderLabel as gi, getSubscribedReplyPreflightDecision as gn, getConfigDefaults as go, resolveAssignee as gr, clearExpiredConversationLease as gt, recordGuardianActionReviewed as h, tryWorkspaceRepoCheckoutPath as ha, deliverOAuthAuthorization as hi, decideSubscribedThreadReply as hn, conversationNoteEvent as ho, automationCreatorUserId as hr, clearConsumedConversationWake as ht, loadConversationProjection as i, clearSandboxEgressSignals as ia, invalidateReadySnapshot as ii, isToolResultMessage as in, listConversationAnnotationsById as io, PLUGIN_REVIEW_ITEM_KEY_PREFIX as ir, getTurnRecord as it, createConversationMemoryService as j, runNonInteractiveCommand as ja, postSlackEphemeralMessage as ji, resolvePluginOAuthAccount as jn, getWatch as jr, releaseConversationWork as jt, appendThreadContextMessages as k, buildCommandScript as ka, openSlackDirectMessage as ki, webActorUserIds as kn, deliverWatch as kr, recordAttemptFailure as kt, openConversationProjection as l, sandboxEgressSignalsResponseSchema as la, hash as li, REQUEST_CONTEXT_SECTION_TAG as ln, createDurableLocationConfigurationService as lo, readReviewItemAgentScope as lr, ackMessages as lt, recordAuthorizationRequested as m, sleep$2 as ma, proxyVercelSandboxEgressRequest as mi, SubscribedReplyReason as mn, JUNIOR_NATIVE_EVENT_NAMESPACE as mo, EVERYONE_ASSIGNEE as mr, checkInConversationWork as mt, commitMessages as n, isWorkspaceSnapshotNotReadyError as na, updateWorkspace as ni, isStandaloneRuntimeContextMessage as nn, createPluginAnnotations as no, takeReviewItem as nr, completeTurnRecord as nt, loadProjection as o, consumeSandboxEgressPermissionDeniedSignal as oa, setWorkspaceSnapshot as oi, retainRuntimeTurnContext as on, resolveUserTimezone as oo, canAgentChangeReviewItem as or, recordTurnSummary as ot, recordAuthorizationCompleted as p, SANDBOX_RUNTIME as pa, isVercelSandboxEgressRequest as pi, buildDeterministicTurnId as pn, projectConversationEvents as po, reviewItemReaderForUser as pr, cancelHumanFacingPendingMessages as pt, abandonReplacedPendingAuth as q, buildSentryConversationUrl as qa, withSlackRetries as qi, closeReviewItem as qn, ToolInputError as qr, extractAssistantText as qt, loadConnectedMcpProviders as r, workspaceSnapshotNotReadyUserMessage as ra, WorkspaceValidationError as ri, isToolResultError as rn, listConversationAnnotations as ro, updateReviewItemContent as rr, failTurnRecord as rt, loadTurnProjection as s, createSandboxEgressCredentialToken as sa, setWorkspaceSnapshotBuild as si, stripRuntimeTurnContext as sn, lookupSlackUser as so, canReadReviewItem as sr, CONVERSATION_WORK_CHECK_IN_INTERVAL_MS as st, commitAcceptedReply as t, getWorkspaceSnapshotNotReadyError as ta, listWorkspacesByRepository as ti, isContinuablePiBoundary as tn, saveObjectAnnotations as to, searchReviewItems as tr, abandonTurnRecord as tt, recordAgentsInstructionsUpdated as u, buildSandboxEgressNetworkPolicy as ua, isStale as ui, SESSION_CONTEXT_SECTION_TAG as un, configValueSchema as uo, requireReviewItemAssignees as ur, appendExclusiveInboundMessage as ut, recordToolExecutionStarted as v, createPluginEmbedder as va, resolveBaseUrl as vi, calculateContextCompactionTargetTokens as vn, resolveChannelCapabilities as vr, completeConversationWork as vt, persistConversationMessageSummaries as w, SANDBOX_SKILLS_ROOT as wa, slackMention as wi, getExperimentalFeatures as wn, cancelSubscriptions as wr, hasRunnableConversationWork as wt, hydrateConversationMessages as x, SANDBOX_DATA_ROOT as xa, formatSlackLink as xi, getAgentBackgroundCompactionMarkTokens as xn, RESOURCE_SUBSCRIPTION_MAX_TTL_MS as xr, getConversation as xt, recordTurnRoute as y, createPluginModel as ya, startOAuthFlow as yi, estimateRequestOverheadTokens as yn, getSlackToolContext as yr, deadLetterAttempt as yt, upsertConversationMessage as z, conversationNotArchivedForUser as za, downloadPrivateSlackFile as zi, getPluginUserPromptContributions as zn, verifySlackDirectCredentialSubject as zr, TurnBudgetExceededError as zt };
|
|
14815
|
+
export { completeTurnRecord as $, getSlackFileId 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, readConversationEventPage 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, readConversationLastEventSeq as Ja, isAlreadyExistsError as Ji, getReviewItem as Jn, deleteWorkspace as Jr, hasCurrentInstruction as Jt, clearPendingAuth as K, readConversationEventPageAfter 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, notInheritedByForkChild 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, readLatestConversationBrief as Wa, withSlackRetries as Wi, closeReviewItem as Wn, ToolInputError as Wr, extractAssistantText as Wt, loadTurnCheckpoint as X, buildSentryConversationUrl as Xa, wrapSandboxSetupError as Xi, listReplyActionItems as Xn, getWorkspaceByName as Xr, instructionTextForProjection as Xt, continuableMessages as Y, readConversationMessageEventSeq as Ya, throwSandboxOperationError as Yi, insertReviewItem as Yn, getWorkspace as Yr, hasRuntimeTurnContext as Yt, saveTurnCheckpoint as Z, loadForkHistory 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, JUNIOR_NATIVE_EVENT_NAMESPACE as _o, RESOURCE_SUBSCRIPTION_DEFAULT_TTL_MS as _r, drainConversationMailbox as _t, loadProjection as a, parseSandboxEgressCredentialToken as aa, create as ai, trimTrailingAssistantMessages as an, createPluginAnnotations 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, setConfigDefaults 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, defaultTimezone as co, requireReviewItemLinks as cr, appendInboundMessage as ct, recordAuthorizationCompleted as d, sleep$2 as da, proxyVercelSandboxEgressRequest as di, SubscribedReplyReason as dn, createPluginCache as do, EVERYONE_ASSIGNEE as dr, checkInConversationWork as dt, workspaceSnapshotNotReadyUserMessage as ea, WorkspaceValidationError as ei, isToolResultError as en, matchSlackAttachments as eo, updateReviewItemContent as er, failTurnRecord as et, recordAuthorizationRequested as f, tryWorkspaceRepoCheckoutPath as fa, deliverOAuthAuthorization as fi, decideSubscribedThreadReply as fn, createDurableLocationConfigurationService as fo, automationCreatorUserId as fr, clearConsumedConversationWake as ft, recordToolExecutionStarted as g, createPluginModel as ga, startOAuthFlow as gi, estimateRequestOverheadTokens as gn, projectConversationEvents as go, getSlackToolContext as gr, deadLetterAttempt as gt, recordSubscribedReplyRoute as h, createPluginEmbedder as ha, resolveBaseUrl as hi, calculateContextCompactionTargetTokens as hn, piMessageFromHistoryItem as ho, resolveChannelCapabilities as hr, completeConversationWork as ht, loadConversationProjection as i, createSandboxEgressCredentialToken as ia, setWorkspaceSnapshotBuild as ii, stripRuntimeTurnContext as in, saveObjectAnnotations 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, resolveUserTimezone as lo, reviewItemNeedsUser as lr, beginConversationResume as lt, recordMcpProviderConnected as m, PluginToolDeniedError as ma, parseOAuthStatePayload as mi, getThreadStopDecision as mn, historyItemFromPiMessage as mo, resolveAssignees as mr, completeConversationStop as mt, commitMessages as n, consumeSandboxEgressAuthRequiredSignal as na, loadSnapshotsForProfile as ni, normalizeToolNameFromResult as nn, recordSlackAttachment as no, canActOnReviewItem as nr, listTurnSummaries as nt, loadTurnProjection as o, sandboxEgressSignalsResponseSchema as oa, hash as oi, REQUEST_CONTEXT_SECTION_TAG as on, listConversationAnnotations as oo, readReviewItemAgentScope as or, ackMessages as ot, recordGuardianActionReviewed as p, workspaceRepoCheckoutPath as pa, formatProviderLabel as pi, getSubscribedReplyPreflightDecision as pn, configValueSchema as po, resolveAssignee as pr, clearExpiredConversationLease as pt, getConversationPendingAuth as q, readConversationEventPageAround 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, resolveRootVisibility as ro, canAgentChangeReviewItem as rr, recordTurnSummary as rt, openConversationProjection as s, buildSandboxEgressNetworkPolicy as sa, isStale as si, SESSION_CONTEXT_SECTION_TAG as sn, listConversationAnnotationsById as so, requireReviewItemAssignees as sr, appendExclusiveInboundMessage as st, commitAcceptedReply as t, clearSandboxEgressSignals as ta, invalidateReadySnapshot as ti, isToolResultMessage as tn, readAttachmentVisionSummary 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, lookupSlackUser as uo, reviewItemReaderForUser as ur, cancelHumanFacingPendingMessages as ut, hydrateConversationMessages as v, SANDBOX_DATA_ROOT as va, formatSlackLink as vi, getAgentBackgroundCompactionMarkTokens as vn, conversationNoteEvent 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, cancelSubscriptions as xr, hasRunnableConversationWork as xt, persistConversationMessages as y, SANDBOX_JUNIOR_ROOT as ya, normalizeSlackReplyMarkdown as yi, getAgentContextCompactionTriggerTokens as yn, getConfigDefaults 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 };
|