@sentry/junior 0.279.0 → 0.281.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-phTTgw7H.js → adapter-RVQGEa98.js} +1 -1
- package/dist/{admin-PcpJDugZ.js → admin-DQpHx6Og.js} +1 -1
- package/dist/{agent-runner-DwvT1BY0.js → agent-runner-B229gXUY.js} +1002 -980
- 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 +188 -86
- package/dist/{app-DVs6noo7.d.ts → app-BQ9RZS43.d.ts} +4 -4
- package/dist/app.d.ts +1 -1
- package/dist/app.js +45 -38
- package/dist/{assistant-reply-BXfxczd7.js → assistant-reply-DQbtwc6j.js} +1 -1
- package/dist/{automation-BehArCcq.js → automation-sIsmIXH7.js} +2 -2
- package/dist/{background-compaction-queue-CcbuLJrZ.js → background-compaction-queue-oegyrxSe.js} +3 -3
- package/dist/{briefs-Dd_ezwED.js → briefs-BwzGWJgR.js} +5 -9
- package/dist/{catalog-runtime-BWVMeZhW.js → catalog-runtime-ClKzLvbN.js} +1 -1
- package/dist/cli/chat.js +15 -15
- package/dist/cli/check.js +3 -3
- package/dist/cli/main.js +3 -3
- package/dist/cli/plugins.js +4 -4
- package/dist/cli/snapshot-create.js +4 -4
- package/dist/cli/upgrade.d.ts +1 -1
- package/dist/cli/upgrade.js +3 -3
- package/dist/{client-Bpxe4vKa.js → client-DkG0Tj53.js} +2 -2
- package/dist/{config-C_bmRhrJ.js → config-3AZ11aSM.js} +2 -2
- package/dist/{connections-B2rHe5W5.js → connections-C0ut_6RW.js} +11 -11
- package/dist/{conversation-CIiJtx5q.js → conversation-DNtcULyX.js} +45 -14
- package/dist/{conversation-pending-messages-CnBvE6-6.js → conversation-pending-messages-LlFnr9-m.js} +11 -3
- package/dist/{conversation-privacy-CzOfcz0U.js → conversation-privacy-DAgeBGLN.js} +1 -1
- package/dist/{credential-sync-Dal_unpv.js → credential-sync-Bg8NPuvj.js} +16 -16
- package/dist/{db-CyLrV9C7.d.ts → db-BCFM0CUX.d.ts} +2 -2
- package/dist/{executor-BfYH-Wws.js → executor-DLKnzP6S.js} +149 -6
- package/dist/instrumentation.js +2 -2
- package/dist/{logging-CkT3_Xxp.js → logging-DHzrobea.js} +1 -1
- package/dist/{media-DTAA8Qs_.js → media-Dq9_svfQ.js} +1 -1
- package/dist/{message-Q5dkgaJ5.js → message-LR8z5jXJ.js} +9 -9
- package/dist/nitro.d.ts +1 -1
- package/dist/nitro.js +3 -3
- package/dist/{oauth-callback-server-BDRaqe8O.js → oauth-callback-server-EWdpj0_y.js} +2 -2
- package/dist/{oauth-relay-D0G3T16m.js → oauth-relay-D6xxVywK.js} +1 -1
- package/dist/{projection-DWxX7pb1.js → projection-Bhz1tp0G.js} +194 -119
- package/dist/{prompt--dwus7Y-.js → prompt-DI6KCtwb.js} +6 -27
- package/dist/{queue-C37RbDVc.d.ts → queue-CZyYgPF0.d.ts} +1 -1
- package/dist/{registry-DnrdeO4s.js → registry-EjhulgQW.js} +3 -3
- package/dist/{reporting-window-DgHgwQB3.js → reporting-window-B-QP9zX1.js} +28 -2
- package/dist/{resolve-C_QXfqD_.js → resolve-Cw6OW4Fj.js} +4 -4
- package/dist/{result-DNmOxT-N.js → result-BoD0jevy.js} +11 -11
- package/dist/{runner-zd_noJ1l.js → runner-D22bsBDS.js} +11 -11
- package/dist/{sandbox-egress-signals-DQjv-nbG.js → sandbox-egress-signals-BG5GYacQ.js} +1 -1
- package/dist/{schema-CNJNzvr8.js → schema-BN34Jy-U.js} +30 -7
- package/dist/{schema-e90H5FIN.d.ts → schema-CsqJzkP5.d.ts} +95 -13
- package/dist/{service-account-CCH2Hv4h.js → service-account-Dd1nnAQZ.js} +3 -3
- package/dist/{service-account-BK26XlHo.js → service-account-xo-CeMqI.js} +3 -3
- package/dist/{session-stop-6Tf--T7G.js → session-stop-CHSYB2uw.js} +13 -14
- package/dist/{skills-BNrk8gi4.js → skills-BGJr6xtW.js} +3 -3
- package/dist/{spawn-C75hAB9l.js → spawn-Cl8WS7zi.js} +2 -2
- package/dist/{stop-RYbf7PWi.js → stop-C9lHWpvl.js} +332 -149
- package/dist/{store-G3h2djJU.js → store-C4z8gOgZ.js} +3 -3
- package/dist/{store-CO5vGjwD.js → store-DeTnwVJt.js} +6 -6
- package/dist/{task-queue-DlN58XeM.js → task-queue-BBos68l0.js} +4 -4
- package/dist/{task-runner-B-Bdm23d.js → task-runner-BSF9zO-H.js} +8 -8
- package/dist/{thread-state-Cj_7Slru.js → thread-state-DGq1o5JX.js} +4 -4
- package/dist/{turn-failure-response-CE7gaoC7.js → turn-failure-response--9bA4uLP.js} +8 -8
- package/dist/{turn-lifecycle-7sXwXLJ6.js → turn-lifecycle-t5fimxwQ.js} +1 -1
- package/dist/{turn-session-routing-FBdaH1zf.js → turn-session-routing-RBtUe-3y.js} +10 -11
- package/dist/{validation-DLWxEzWW.js → validation-DrR0leBT.js} +1 -1
- package/dist/{version-DtQ8WFIZ.js → version-D_HFt_Dq.js} +1 -1
- package/dist/version.js +1 -1
- package/dist/{viewer-vsM8_90o.js → viewer-DWlpSFdj.js} +9 -8
- package/dist/{work-DsoFRO_0.js → work-pPoqtRea.js} +12 -12
- package/dist/{worker-6kZEsCXs.js → worker-CoVKgJ-O.js} +6 -6
- package/package.json +5 -5
- package/dist/agent-invocations-CUg_SODU.js +0 -181
|
@@ -1,26 +1,25 @@
|
|
|
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-
|
|
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, _ 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-
|
|
5
|
-
import { t as canExposeConversationPayload } from "./conversation-privacy-
|
|
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-
|
|
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-
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import { a as
|
|
11
|
-
import {
|
|
12
|
-
import { n as pluginCatalogRuntime } from "./catalog-runtime-BWVMeZhW.js";
|
|
1
|
+
import { a as getClient$1, h as startSpan, 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-DkG0Tj53.js";
|
|
3
|
+
import { i as getChatConfig, n as botConfig, o as getSlackBotToken, v as normalizeSlackEmojiName } from "./config-3AZ11aSM.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-DHzrobea.js";
|
|
5
|
+
import { t as canExposeConversationPayload } from "./conversation-privacy-DAgeBGLN.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-DWlpSFdj.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-DLKnzP6S.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-EjhulgQW.js";
|
|
11
|
+
import { n as pluginCatalogRuntime } from "./catalog-runtime-ClKzLvbN.js";
|
|
13
12
|
import { a as withLock, i as fenceLock, n as MUTATION_LOCK_TTL_MS, r as acquireActiveLock } from "./locks-D-0h111u.js";
|
|
14
|
-
import { n as getDefaultRedisStateAdapterFor, r as getStateAdapter } from "./adapter-
|
|
13
|
+
import { n as getDefaultRedisStateAdapterFor, r as getStateAdapter } from "./adapter-RVQGEa98.js";
|
|
15
14
|
import { i as isValidTimeZone } from "./cadence-R7Em4RjE.js";
|
|
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-
|
|
17
|
-
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, W as parseStoredBrief, _ as conversationReportMessageEventSchema, g as conversationReportEventSchema } from "./conversation-DNtcULyX.js";
|
|
16
|
+
import { n as briefEntriesFromReportEvents, s as generateBrief, t as BRIEF_PROMPT } from "./prompt-DI6KCtwb.js";
|
|
18
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
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";
|
|
@@ -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 = [];
|
|
@@ -809,8 +808,14 @@ async function resolveRootVisibility(executor, conversationId) {
|
|
|
809
808
|
return readCandidateVisibility(executor, candidate);
|
|
810
809
|
}
|
|
811
810
|
// src/chat/briefs/events.ts
|
|
812
|
-
|
|
813
|
-
|
|
811
|
+
function renderBriefUpdated(event) {
|
|
812
|
+
return {
|
|
813
|
+
icon: "activity",
|
|
814
|
+
title: `Brief updated (v${event.version})`
|
|
815
|
+
};
|
|
816
|
+
}
|
|
817
|
+
/** Previous stored Brief event shape retained for transcript rendering. */
|
|
818
|
+
const briefUpdatedEventV1 = defineConversationEvent({
|
|
814
819
|
name: "brief_updated",
|
|
815
820
|
version: 1,
|
|
816
821
|
schema: z.object({
|
|
@@ -821,12 +826,20 @@ const briefUpdatedEvent = defineConversationEvent({
|
|
|
821
826
|
openDecisions: z.number().int().nonnegative(),
|
|
822
827
|
links: z.number().int().nonnegative()
|
|
823
828
|
}).strict(),
|
|
824
|
-
renderEvent
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
829
|
+
renderEvent: renderBriefUpdated
|
|
830
|
+
});
|
|
831
|
+
/** Durable cost and size record for one stored Brief version. */
|
|
832
|
+
const briefUpdatedEvent = defineConversationEvent({
|
|
833
|
+
name: "brief_updated",
|
|
834
|
+
version: 2,
|
|
835
|
+
schema: z.object({
|
|
836
|
+
version: z.number().int().positive(),
|
|
837
|
+
modelId: z.string().min(1),
|
|
838
|
+
costUsd: z.number().finite().nonnegative().optional(),
|
|
839
|
+
decisions: z.number().int().nonnegative(),
|
|
840
|
+
links: z.number().int().nonnegative()
|
|
841
|
+
}).strict(),
|
|
842
|
+
renderEvent: renderBriefUpdated
|
|
830
843
|
});
|
|
831
844
|
// src/chat/slack/attachments.ts
|
|
832
845
|
/** Save the vision summary for a stored Slack attachment. */
|
|
@@ -850,6 +863,15 @@ async function matchSlackAttachments(args) {
|
|
|
850
863
|
filename: juniorAttachments.filename
|
|
851
864
|
}).from(juniorAttachments).where(and(eq(juniorAttachments.conversationId, args.conversationId), eq(juniorAttachments.provider, "slack"), inArray(juniorAttachments.providerId, args.providerIds), isNull(juniorAttachments.deleteRequestedAt)));
|
|
852
865
|
}
|
|
866
|
+
/**
|
|
867
|
+
* Fingerprint the live Slack attachments that `matchSlackAttachments` can
|
|
868
|
+
* return for a Conversation. It changes when one is stored or deleted, so a
|
|
869
|
+
* reader can tell that stored messages may now show other files.
|
|
870
|
+
*/
|
|
871
|
+
async function readSlackAttachmentsVersion(db, conversationId) {
|
|
872
|
+
const [row] = await db.db().select({ version: sql`coalesce(md5(string_agg(${juniorAttachments.id}, ',' order by ${juniorAttachments.id})), '')` }).from(juniorAttachments).where(and(eq(juniorAttachments.conversationId, conversationId), eq(juniorAttachments.provider, "slack"), isNull(juniorAttachments.deleteRequestedAt)));
|
|
873
|
+
return row?.version ?? "";
|
|
874
|
+
}
|
|
853
875
|
/** Read the Slack file identity retained by the Chat SDK. */
|
|
854
876
|
function getSlackFileId(attachment) {
|
|
855
877
|
const metadataId = attachment.fetchMetadata?.fileId;
|
|
@@ -1441,91 +1463,152 @@ async function readConversationEventRows(executor, args) {
|
|
|
1441
1463
|
end`
|
|
1442
1464
|
}).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
1465
|
}
|
|
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,
|
|
1466
|
+
/**
|
|
1467
|
+
* Read the last Turn end before the `turns`-th latest Turn start. Its seq is
|
|
1468
|
+
* null when the Conversation has fewer Turns, or no Turn ended before them.
|
|
1469
|
+
*
|
|
1470
|
+
* Input messages are written before their `turn_started`, so a page of the
|
|
1471
|
+
* latest Turns starts after the Turn before them, not at the start event.
|
|
1472
|
+
*/
|
|
1473
|
+
function readLatestTurnsPageStart(executor, conversationId, turns) {
|
|
1474
|
+
const started = alias(juniorConversationEvents, "started");
|
|
1475
|
+
const ended = alias(juniorConversationEvents, "ended");
|
|
1476
|
+
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);
|
|
1477
|
+
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})`)));
|
|
1478
|
+
}
|
|
1479
|
+
/** Read the first Turn start, which marks history inherited from a fork. */
|
|
1480
|
+
async function readFirstTurnStart(executor, conversationId) {
|
|
1481
|
+
const [row] = await readConversationEventRows(executor, {
|
|
1482
|
+
conversationId,
|
|
1474
1483
|
direction: "forward",
|
|
1475
1484
|
limit: 1,
|
|
1476
1485
|
types: ["turn_started"]
|
|
1477
1486
|
});
|
|
1487
|
+
return row ? eventFromRow(row) : void 0;
|
|
1488
|
+
}
|
|
1489
|
+
function projectEventPage(args) {
|
|
1490
|
+
return startSpan({
|
|
1491
|
+
attributes: { "app.conversation.event.count": args.events.length },
|
|
1492
|
+
name: "Project conversation events",
|
|
1493
|
+
op: "function"
|
|
1494
|
+
}, () => projectConversationReportEventPage(args));
|
|
1495
|
+
}
|
|
1496
|
+
/** Resolve entity starts that precede the page, then project it once. */
|
|
1497
|
+
async function projectConversationEvents(executor, args) {
|
|
1498
|
+
const events = args.events.sort((left, right) => left.seq - right.seq);
|
|
1499
|
+
const firstSeq = events[0]?.seq;
|
|
1500
|
+
const endedInvocationIds = [...new Set(events.flatMap((event) => event.data.type === "subagent_ended" ? [event.data.subagentInvocationId] : []))];
|
|
1478
1501
|
const toolResultIds = conversationReportToolResultIds(events);
|
|
1479
|
-
const
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1502
|
+
const [turnBoundaryRows, modelCallRows, subagentStartRows, toolStartRows] = await Promise.all([
|
|
1503
|
+
firstSeq === void 0 ? [] : readConversationEventRows(executor, {
|
|
1504
|
+
conversationId: args.conversationId,
|
|
1505
|
+
beforeSeq: firstSeq,
|
|
1506
|
+
direction: "backward",
|
|
1507
|
+
limit: 1,
|
|
1508
|
+
types: [
|
|
1509
|
+
"turn_started",
|
|
1510
|
+
"turn_completed",
|
|
1511
|
+
"turn_failed"
|
|
1512
|
+
]
|
|
1513
|
+
}),
|
|
1514
|
+
firstSeq === void 0 ? [] : readConversationEventRows(executor, {
|
|
1515
|
+
conversationId: args.conversationId,
|
|
1516
|
+
beforeSeq: firstSeq,
|
|
1517
|
+
direction: "backward",
|
|
1518
|
+
limit: 1,
|
|
1519
|
+
types: ["assistant_message"]
|
|
1520
|
+
}),
|
|
1521
|
+
endedInvocationIds.length === 0 ? [] : readConversationEventRows(executor, {
|
|
1522
|
+
conversationId: args.conversationId,
|
|
1523
|
+
direction: "forward",
|
|
1524
|
+
limit: endedInvocationIds.length,
|
|
1525
|
+
subagentInvocationIds: endedInvocationIds,
|
|
1526
|
+
types: ["subagent_started"]
|
|
1527
|
+
}),
|
|
1528
|
+
toolResultIds.length === 0 ? [] : readConversationEventRows(executor, {
|
|
1529
|
+
conversationId: args.conversationId,
|
|
1530
|
+
direction: "forward",
|
|
1531
|
+
limit: toolResultIds.length,
|
|
1532
|
+
toolCallIds: toolResultIds,
|
|
1533
|
+
types: ["tool_execution_started"]
|
|
1534
|
+
}),
|
|
1535
|
+
args.canExposePayload ? hydrateMessageAttachments(executor, args.conversationId, events) : void 0
|
|
1536
|
+
]);
|
|
1537
|
+
return projectEventPage({
|
|
1488
1538
|
canExposePayload: args.canExposePayload,
|
|
1489
1539
|
events,
|
|
1490
|
-
...
|
|
1540
|
+
...args.firstTurnStart ? { firstTurnStart: args.firstTurnStart } : void 0,
|
|
1491
1541
|
subagentStartEvents: subagentStartRows.map(eventFromRow),
|
|
1492
1542
|
toolStartEvents: toolStartRows.map(eventFromRow),
|
|
1493
|
-
modelContextEvents:
|
|
1543
|
+
modelContextEvents: [...turnBoundaryRows, ...modelCallRows].sort((left, right) => left.seq - right.seq).map(eventFromRow)
|
|
1494
1544
|
});
|
|
1495
1545
|
}
|
|
1496
1546
|
/**
|
|
1497
|
-
*
|
|
1547
|
+
* Scan source rows in bounded chunks until more than `limit` reporting
|
|
1548
|
+
* events are known, then project the scanned rows once.
|
|
1498
1549
|
*
|
|
1499
|
-
*
|
|
1500
|
-
*
|
|
1501
|
-
* assuming every agent history event produces a reporting event.
|
|
1550
|
+
* Each chunk is decoded once. A chunk is counted without the entity starts
|
|
1551
|
+
* that precede it, which can only undercount, so the scan never stops early.
|
|
1502
1552
|
*/
|
|
1503
|
-
async function
|
|
1553
|
+
async function scanConversationEventPage(executor, args) {
|
|
1504
1554
|
const scanSize = Math.max(args.limit + 1, MIN_SCAN_SIZE);
|
|
1505
|
-
const
|
|
1506
|
-
|
|
1507
|
-
let
|
|
1508
|
-
|
|
1509
|
-
|
|
1555
|
+
const firstTurnStartRead = readFirstTurnStart(executor, args.conversationId);
|
|
1556
|
+
const events = [];
|
|
1557
|
+
let { afterSeq, beforeSeq } = args;
|
|
1558
|
+
let firstTurnStart;
|
|
1559
|
+
let counted = 0;
|
|
1560
|
+
while (counted <= args.limit) {
|
|
1561
|
+
const [batch, turnStart] = await Promise.all([readConversationEventRows(executor, {
|
|
1562
|
+
afterSeq,
|
|
1510
1563
|
beforeSeq,
|
|
1511
1564
|
conversationId: args.conversationId,
|
|
1512
|
-
direction:
|
|
1565
|
+
direction: args.direction,
|
|
1513
1566
|
limit: scanSize
|
|
1514
|
-
});
|
|
1567
|
+
}), firstTurnStartRead]);
|
|
1568
|
+
firstTurnStart = turnStart;
|
|
1515
1569
|
if (batch.length === 0) break;
|
|
1516
|
-
|
|
1517
|
-
|
|
1570
|
+
const decoded = startSpan({
|
|
1571
|
+
attributes: { "app.conversation.event.count": batch.length },
|
|
1572
|
+
name: "Decode conversation events",
|
|
1573
|
+
op: "function"
|
|
1574
|
+
}, () => batch.map(eventFromRow).sort((left, right) => left.seq - right.seq));
|
|
1575
|
+
events.push(...decoded);
|
|
1576
|
+
counted += projectEventPage({
|
|
1518
1577
|
canExposePayload: args.canExposePayload,
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
});
|
|
1522
|
-
if (
|
|
1523
|
-
beforeSeq = batch.at(-1).seq;
|
|
1524
|
-
|
|
1578
|
+
events: decoded,
|
|
1579
|
+
...firstTurnStart ? { firstTurnStart } : void 0
|
|
1580
|
+
}).length;
|
|
1581
|
+
if (batch.length < scanSize) break;
|
|
1582
|
+
if (args.direction === "backward") beforeSeq = batch.at(-1).seq;
|
|
1583
|
+
else afterSeq = batch.at(-1).seq;
|
|
1584
|
+
}
|
|
1585
|
+
return projectConversationEvents(executor, {
|
|
1586
|
+
canExposePayload: args.canExposePayload,
|
|
1587
|
+
conversationId: args.conversationId,
|
|
1588
|
+
events,
|
|
1589
|
+
...firstTurnStart ? { firstTurnStart } : void 0
|
|
1590
|
+
});
|
|
1591
|
+
}
|
|
1592
|
+
/**
|
|
1593
|
+
* Read the latest reporting events before an exclusive boundary.
|
|
1594
|
+
*
|
|
1595
|
+
* Not every agent history event produces a reporting event, so source rows
|
|
1596
|
+
* are scanned until the requested page and one older event are known. With
|
|
1597
|
+
* `latestTurns`, the page also starts after the Turn before the latest
|
|
1598
|
+
* Turns, so it holds whole Turns when they fit in `limit`.
|
|
1599
|
+
*/
|
|
1600
|
+
async function readConversationEventPage(executor, args) {
|
|
1601
|
+
const { latestTurns, ...pageArgs } = args;
|
|
1602
|
+
const pageStart = latestTurns === void 0 ? void 0 : readLatestTurnsPageStart(executor, args.conversationId, latestTurns);
|
|
1603
|
+
const [projected, startRows] = await Promise.all([scanConversationEventPage(executor, {
|
|
1604
|
+
...pageArgs,
|
|
1605
|
+
...pageStart ? { afterSeq: sql`coalesce((${pageStart}), -1)` } : void 0,
|
|
1606
|
+
direction: "backward"
|
|
1607
|
+
}), pageStart]);
|
|
1525
1608
|
const events = projected.slice(-args.limit);
|
|
1526
1609
|
return {
|
|
1527
1610
|
events,
|
|
1528
|
-
...projected.length > events.length && events[0] ? { previousSeq: events[0].seq } : void 0
|
|
1611
|
+
...(projected.length > events.length || (startRows?.[0]?.seq ?? null) !== null) && events[0] ? { previousSeq: events[0].seq } : void 0
|
|
1529
1612
|
};
|
|
1530
1613
|
}
|
|
1531
1614
|
/**
|
|
@@ -1561,27 +1644,10 @@ async function readConversationEventPageAround(executor, args) {
|
|
|
1561
1644
|
* page around the read position, so this page reads nothing before it.
|
|
1562
1645
|
*/
|
|
1563
1646
|
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
|
-
}
|
|
1647
|
+
const projected = await scanConversationEventPage(executor, {
|
|
1648
|
+
...args,
|
|
1649
|
+
direction: "forward"
|
|
1650
|
+
});
|
|
1585
1651
|
const events = projected.slice(0, args.limit);
|
|
1586
1652
|
return {
|
|
1587
1653
|
events,
|
|
@@ -1768,7 +1834,7 @@ function briefVersionFromRow(row) {
|
|
|
1768
1834
|
version: row.version,
|
|
1769
1835
|
turnId: row.turnId,
|
|
1770
1836
|
throughSeq: row.throughSeq,
|
|
1771
|
-
content:
|
|
1837
|
+
content: parseStoredBrief(row.content),
|
|
1772
1838
|
searchText: row.searchText,
|
|
1773
1839
|
modelId: row.modelId,
|
|
1774
1840
|
...row.costUsd !== null ? { costUsd: row.costUsd } : void 0,
|
|
@@ -1819,6 +1885,14 @@ async function readLatestConversationBrief(db, conversationId) {
|
|
|
1819
1885
|
const rows = await db.select().from(juniorConversationBriefs).where(eq(juniorConversationBriefs.conversationId, conversationId)).orderBy(desc(juniorConversationBriefs.version)).limit(1);
|
|
1820
1886
|
return rows[0] ? briefVersionFromRow(rows[0]) : void 0;
|
|
1821
1887
|
}
|
|
1888
|
+
/**
|
|
1889
|
+
* Read the newest Brief version that covers no event after `seq`. That is the
|
|
1890
|
+
* Brief as a reader saw it when they stopped at `seq`.
|
|
1891
|
+
*/
|
|
1892
|
+
async function readConversationBriefThrough(db, conversationId, seq) {
|
|
1893
|
+
const rows = await db.select().from(juniorConversationBriefs).where(and(eq(juniorConversationBriefs.conversationId, conversationId), lte(juniorConversationBriefs.throughSeq, seq))).orderBy(desc(juniorConversationBriefs.version)).limit(1);
|
|
1894
|
+
return rows[0] ? briefVersionFromRow(rows[0]) : void 0;
|
|
1895
|
+
}
|
|
1822
1896
|
// src/chat/briefs/task.ts
|
|
1823
1897
|
const BRIEF_LOCK_TTL_MS = 6e5;
|
|
1824
1898
|
function hasUserInstruction(run) {
|
|
@@ -1841,7 +1915,6 @@ async function emitBriefUpdated(context, stored) {
|
|
|
1841
1915
|
modelId: stored.modelId,
|
|
1842
1916
|
...stored.costUsd !== void 0 ? { costUsd: stored.costUsd } : void 0,
|
|
1843
1917
|
decisions: stored.content.decisions.length,
|
|
1844
|
-
openDecisions: stored.content.openDecisions.length,
|
|
1845
1918
|
links: stored.content.links.length
|
|
1846
1919
|
}));
|
|
1847
1920
|
}
|
|
@@ -1915,7 +1988,7 @@ const briefsTaskRegistration = {
|
|
|
1915
1988
|
displayName: "Briefs",
|
|
1916
1989
|
description: "Durable Conversation Brief generation"
|
|
1917
1990
|
},
|
|
1918
|
-
conversationEvents: [briefUpdatedEvent],
|
|
1991
|
+
conversationEvents: [briefUpdatedEventV1, briefUpdatedEvent],
|
|
1919
1992
|
hooks: { async operationalReport(context) {
|
|
1920
1993
|
return await buildBriefsOperationalReport({
|
|
1921
1994
|
briefDays: await context.eventStats.costsByDay({
|
|
@@ -2114,11 +2187,13 @@ function createPluginConversationEventReader(plugin) {
|
|
|
2114
2187
|
return (await db.select({
|
|
2115
2188
|
content: sql`${juniorConversationEvents.payload}->'content'`,
|
|
2116
2189
|
createdAt: juniorConversationEvents.createdAt,
|
|
2190
|
+
seq: juniorConversationEvents.seq,
|
|
2117
2191
|
turnId: sql`${juniorConversationEvents.payload}->>'turnId'`,
|
|
2118
2192
|
version: sql`(${juniorConversationEvents.payload}->>'version')::integer`
|
|
2119
2193
|
}).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) => ({
|
|
2120
2194
|
content: row.content,
|
|
2121
2195
|
createdAt: row.createdAt.toISOString(),
|
|
2196
|
+
seq: row.seq,
|
|
2122
2197
|
...row.turnId ? { turnId: row.turnId } : void 0,
|
|
2123
2198
|
version: row.version
|
|
2124
2199
|
}));
|
|
@@ -12929,7 +13004,7 @@ async function materializeStoredTurnRecord(conversationId, turnId, followCurrent
|
|
|
12929
13004
|
const eventStore = getConversationEventStore();
|
|
12930
13005
|
const currentHistoryVersion = await eventStore.loadCurrentHistoryVersion(conversationId);
|
|
12931
13006
|
const followsReplacement = followCurrentReplacement && (parsed.state === "running" || parsed.state === "paused") && parsed.historyVersion !== void 0 && parsed.historyVersion !== currentHistoryVersion;
|
|
12932
|
-
const piProjection = followsReplacement ? projectConversationEvents(await eventStore.loadCurrentHistory(conversationId)) : pinnedProjection;
|
|
13007
|
+
const piProjection = followsReplacement ? projectConversationEvents$1(await eventStore.loadCurrentHistory(conversationId)) : pinnedProjection;
|
|
12933
13008
|
const turnStartMessageIndex = followsReplacement ? 0 : parsed.turnStartSeq === void 0 ? void 0 : piProjection.seqs.filter((seq) => seq <= parsed.turnStartSeq).length;
|
|
12934
13009
|
const conversationStore = getConversationStore();
|
|
12935
13010
|
const conversation = await conversationStore.get({ conversationId });
|
|
@@ -14487,15 +14562,15 @@ function resolveCommitProvenance(args) {
|
|
|
14487
14562
|
}
|
|
14488
14563
|
/** Load the current Pi agent history for a conversation. */
|
|
14489
14564
|
async function loadProjection(args) {
|
|
14490
|
-
return projectConversationEvents(await getConversationEventStore().loadCurrentHistory(args.conversationId)).messages;
|
|
14565
|
+
return projectConversationEvents$1(await getConversationEventStore().loadCurrentHistory(args.conversationId)).messages;
|
|
14491
14566
|
}
|
|
14492
14567
|
/** Load current Pi context with aligned provenance and source event sequences. */
|
|
14493
14568
|
async function loadConversationProjection(args) {
|
|
14494
|
-
return projectConversationEvents(await getConversationEventStore().loadCurrentHistory(args.conversationId));
|
|
14569
|
+
return projectConversationEvents$1(await getConversationEventStore().loadCurrentHistory(args.conversationId));
|
|
14495
14570
|
}
|
|
14496
14571
|
/** Load the active Pi projection before a conversation's next request. */
|
|
14497
14572
|
async function openConversationProjection(args) {
|
|
14498
|
-
return projectConversationEvents(await getConversationEventStore().loadCurrentHistory(args.conversationId));
|
|
14573
|
+
return projectConversationEvents$1(await getConversationEventStore().loadCurrentHistory(args.conversationId));
|
|
14499
14574
|
}
|
|
14500
14575
|
/**
|
|
14501
14576
|
* Load a turn's committed Pi projection from the durable event store.
|
|
@@ -14510,10 +14585,10 @@ async function openConversationProjection(args) {
|
|
|
14510
14585
|
*/
|
|
14511
14586
|
async function loadTurnProjection(args) {
|
|
14512
14587
|
const eventStore = getConversationEventStore();
|
|
14513
|
-
if (args.committedSeq < 0) return projectConversationEvents(await eventStore.loadCurrentHistory(args.conversationId));
|
|
14588
|
+
if (args.committedSeq < 0) return projectConversationEvents$1(await eventStore.loadCurrentHistory(args.conversationId));
|
|
14514
14589
|
const historyEvents = await eventStore.loadHistoryContaining(args.conversationId, args.committedSeq, args.includeTail ? void 0 : args.committedSeq);
|
|
14515
14590
|
if (!historyEvents) return;
|
|
14516
|
-
return projectConversationEvents(historyEvents);
|
|
14591
|
+
return projectConversationEvents$1(historyEvents);
|
|
14517
14592
|
}
|
|
14518
14593
|
/** Load MCP providers the credential subject connected in this conversation. */
|
|
14519
14594
|
async function loadConnectedMcpProviders(args) {
|
|
@@ -14572,7 +14647,7 @@ async function commitAcceptedReply(args) {
|
|
|
14572
14647
|
async function commitMessagesLocked(args, executor) {
|
|
14573
14648
|
const eventStore = createSqlConversationEventStore(executor);
|
|
14574
14649
|
const currentEvents = await eventStore.loadCurrentHistory(args.conversationId);
|
|
14575
|
-
const current = projectConversationEvents(currentEvents);
|
|
14650
|
+
const current = projectConversationEvents$1(currentEvents);
|
|
14576
14651
|
const nextLocalMessages = args.messages.map(normalizeDurableMessage);
|
|
14577
14652
|
const matchingPrefix = countDurablePrefix(current.messages, nextLocalMessages);
|
|
14578
14653
|
const nextLocalProvenance = resolveCommitProvenance({
|
|
@@ -14812,4 +14887,4 @@ async function recordGuardianActionReviewed(args) {
|
|
|
14812
14887
|
createdAtMs: Date.now()
|
|
14813
14888
|
}]);
|
|
14814
14889
|
}
|
|
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 };
|
|
14890
|
+
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, setConfigDefaults as So, 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, piMessageFromHistoryItem as _o, RESOURCE_SUBSCRIPTION_DEFAULT_TTL_MS as _r, drainConversationMailbox as _t, loadProjection as a, parseSandboxEgressCredentialToken as aa, create as ai, trimTrailingAssistantMessages as an, resolveRootVisibility 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, conversationNoteEvent 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, listConversationAnnotations as co, requireReviewItemLinks as cr, appendInboundMessage as ct, recordAuthorizationCompleted as d, sleep$2 as da, proxyVercelSandboxEgressRequest as di, SubscribedReplyReason as dn, resolveUserTimezone 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, lookupSlackUser as fo, automationCreatorUserId as fr, clearConsumedConversationWake as ft, recordToolExecutionStarted as g, createPluginModel as ga, startOAuthFlow as gi, estimateRequestOverheadTokens as gn, historyItemFromPiMessage as go, getSlackToolContext as gr, deadLetterAttempt as gt, recordSubscribedReplyRoute as h, createPluginEmbedder as ha, resolveBaseUrl as hi, calculateContextCompactionTargetTokens as hn, configValueSchema as ho, resolveChannelCapabilities as hr, completeConversationWork as ht, loadConversationProjection as i, createSandboxEgressCredentialToken as ia, setWorkspaceSnapshotBuild as ii, stripRuntimeTurnContext as in, recordSlackAttachment 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, listConversationAnnotationsById as lo, reviewItemNeedsUser as lr, beginConversationResume as lt, recordMcpProviderConnected as m, PluginToolDeniedError as ma, parseOAuthStatePayload as mi, getThreadStopDecision as mn, createDurableLocationConfigurationService 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, saveObjectAnnotations as oo, readReviewItemAgentScope as or, ackMessages as ot, recordGuardianActionReviewed as p, workspaceRepoCheckoutPath as pa, formatProviderLabel as pi, getSubscribedReplyPreflightDecision as pn, createPluginCache 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, readSlackAttachmentsVersion as ro, canAgentChangeReviewItem as rr, recordTurnSummary as rt, openConversationProjection as s, buildSandboxEgressNetworkPolicy as sa, isStale as si, SESSION_CONTEXT_SECTION_TAG as sn, createPluginAnnotations 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, defaultTimezone as uo, reviewItemReaderForUser as ur, cancelHumanFacingPendingMessages as ut, hydrateConversationMessages as v, SANDBOX_DATA_ROOT as va, formatSlackLink as vi, getAgentBackgroundCompactionMarkTokens as vn, projectConversationEvents$1 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, getConfigDefaults as xo, cancelSubscriptions as xr, hasRunnableConversationWork as xt, persistConversationMessages as y, SANDBOX_JUNIOR_ROOT as ya, normalizeSlackReplyMarkdown as yi, getAgentContextCompactionTriggerTokens as yn, JUNIOR_NATIVE_EVENT_NAMESPACE 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 };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { H as conversationBriefSchema, U as parseBriefInput, V as briefOutcomeStatusSchema } from "./conversation-
|
|
2
|
-
import
|
|
1
|
+
import { H as conversationBriefSchema, U as parseBriefInput, V as briefOutcomeStatusSchema } from "./conversation-DNtcULyX.js";
|
|
2
|
+
import * as z from "zod";
|
|
3
3
|
// src/chat/briefs/generate.ts
|
|
4
4
|
const MAX_INPUT_CHARS = 6e4;
|
|
5
5
|
const MAX_MESSAGE_TEXT_CHARS = 4e3;
|
|
@@ -8,19 +8,16 @@ const MAX_LINKS = 40;
|
|
|
8
8
|
const SIZE_CAPS = {
|
|
9
9
|
small: {
|
|
10
10
|
decisions: 3,
|
|
11
|
-
openDecisions: 2,
|
|
12
11
|
facts: 5,
|
|
13
12
|
keywords: 5
|
|
14
13
|
},
|
|
15
14
|
medium: {
|
|
16
15
|
decisions: 8,
|
|
17
|
-
openDecisions: 5,
|
|
18
16
|
facts: 10,
|
|
19
17
|
keywords: 8
|
|
20
18
|
},
|
|
21
19
|
large: {
|
|
22
20
|
decisions: 20,
|
|
23
|
-
openDecisions: 10,
|
|
24
21
|
facts: 15,
|
|
25
22
|
keywords: 12
|
|
26
23
|
}
|
|
@@ -41,10 +38,6 @@ const modelBriefSchema = z.object({
|
|
|
41
38
|
"assumed"
|
|
42
39
|
])
|
|
43
40
|
}).strict()),
|
|
44
|
-
openDecisions: z.array(z.object({
|
|
45
|
-
text: z.string().trim().min(1),
|
|
46
|
-
owner: z.string().trim().min(1).nullable()
|
|
47
|
-
}).strict()),
|
|
48
41
|
facts: z.array(z.string().trim().min(1)),
|
|
49
42
|
keywords: z.array(z.string().trim().min(1)),
|
|
50
43
|
urls: z.array(z.object({
|
|
@@ -109,17 +102,6 @@ function normalizeModelBrief(args) {
|
|
|
109
102
|
kind
|
|
110
103
|
}];
|
|
111
104
|
});
|
|
112
|
-
const openDecisions = args.model.openDecisions.flatMap((decision) => {
|
|
113
|
-
if (hasRuntimeMarker(decision.text)) {
|
|
114
|
-
droppedRuntimeMarkerCount += 1;
|
|
115
|
-
return [];
|
|
116
|
-
}
|
|
117
|
-
const owner = attribution(decision.owner);
|
|
118
|
-
return [{
|
|
119
|
-
text: truncate(decision.text, 400),
|
|
120
|
-
...owner ? { owner } : void 0
|
|
121
|
-
}];
|
|
122
|
-
});
|
|
123
105
|
const facts = args.model.facts.filter((fact) => {
|
|
124
106
|
const keep = !hasRuntimeMarker(fact);
|
|
125
107
|
if (!keep) droppedRuntimeMarkerCount += 1;
|
|
@@ -136,7 +118,6 @@ function normalizeModelBrief(args) {
|
|
|
136
118
|
text: truncateSentence(args.model.outcome.text, 600)
|
|
137
119
|
},
|
|
138
120
|
decisions: decisions.slice(0, args.caps.decisions),
|
|
139
|
-
openDecisions: openDecisions.slice(0, args.caps.openDecisions),
|
|
140
121
|
facts: uniqueStrings(facts, args.caps.facts),
|
|
141
122
|
links: args.links,
|
|
142
123
|
keywords: uniqueStrings(args.model.keywords.map((keyword) => keyword.toLowerCase()), args.caps.keywords)
|
|
@@ -343,7 +324,6 @@ function buildBriefSearchText(brief, title) {
|
|
|
343
324
|
brief.intent,
|
|
344
325
|
brief.outcome.text,
|
|
345
326
|
...brief.decisions.map((decision) => decision.text),
|
|
346
|
-
...brief.openDecisions.map((decision) => decision.text),
|
|
347
327
|
...brief.facts,
|
|
348
328
|
...brief.keywords,
|
|
349
329
|
...brief.links.map((link) => link.label),
|
|
@@ -528,21 +508,20 @@ function briefEntriesFromReportEvents(events) {
|
|
|
528
508
|
// src/chat/briefs/prompt.ts
|
|
529
509
|
const BRIEF_PROMPT = `You write one durable Brief for a Junior Conversation.
|
|
530
510
|
|
|
531
|
-
Use only facts supported by the supplied entries, evidence, or previous Brief. Do not invent names, ids, numbers, outcomes, choices,
|
|
511
|
+
Use only facts supported by the supplied entries, evidence, or previous Brief. Do not invent names, ids, numbers, outcomes, choices, or links.
|
|
532
512
|
|
|
533
513
|
Rules:
|
|
534
514
|
- Summarize the intent and current outcome in plain prose.
|
|
535
515
|
- Keep earlier decisions unless later entries reverse them. State a reversal as a new decision.
|
|
536
516
|
- A decision is a choice made by a listed participant in this Conversation. It is not a research finding, tool result, action, observation, or suggestion. Put findings in facts or the summary.
|
|
537
|
-
- Set each decision kind to stated when a human participant stated the choice themselves, confirmed when Junior proposed it and a human participant explicitly accepted it, or assumed when Junior chose while working and no participant confirmed or objected.
|
|
538
|
-
-
|
|
517
|
+
- Set each decision's \`kind\` to \`stated\` when a human participant stated the choice themselves, \`confirmed\` when Junior proposed it and a human participant explicitly accepted it, or \`assumed\` when Junior chose while working and no participant confirmed or objected.
|
|
518
|
+
- Set a decision's \`by\` to the participant who made it, or Junior. Use only names in the supplied record. Set \`by\` to \`null\` when no supported attribution exists.
|
|
539
519
|
- Facts are durable one-line facts that help after the transcript expires. Prefer ids, versions, owners, constraints, and numbers. Do not list fields, recap the transcript, or include transient progress.
|
|
540
520
|
- Ignore Junior runtime mechanics, context tags, and markers such as [[NO_REPLY]].
|
|
541
521
|
- Never say that a code change was merged, closed, deployed, or released unless a supplied code change or resource has that status. Say opened for an open code change.
|
|
542
|
-
- Attribute by or owner only to a participant in the supplied record. Junior is also valid. Set by or owner to null when no supported attribution exists.
|
|
543
522
|
- Choose the outcome status that best describes where the Conversation ended.
|
|
544
523
|
- Follow the supplied size class caps. Keep the first items that matter most.
|
|
545
|
-
- Cite a URL only when its exact full string occurs in an entry, evidence, or the previous Brief. Return cited URLs in urls
|
|
524
|
+
- Cite a URL only when its exact full string occurs in an entry, evidence, or the previous Brief. Return cited URLs in \`urls\`. Core adds code changes and resources separately.
|
|
546
525
|
- Keep the summary under 600 characters, intent under 400 characters, outcome text under 600 characters, and each other string under 400 characters.
|
|
547
526
|
`;
|
|
548
527
|
export { EVENT_SYSTEM_ACTOR as a, EVENT_MESSAGE_AUTHOR as i, briefEntriesFromReportEvents as n, isEventConversationMessage as o, EVENT_AUTHOR_ID as r, generateBrief as s, BRIEF_PROMPT as t };
|