@sentry/junior 0.260.0 → 0.262.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-Dj5BTJRd.js → adapter-t-Y9RHML.js} +2 -2
- package/dist/{admin-tzkZDqrH.js → admin-BCqeFndQ.js} +1 -1
- package/dist/{agent-hooks-V4Hfc2tB.js → agent-hooks-9q2zdKHL.js} +73 -20
- package/dist/{agent-invocations-Qfz7dWgU.js → agent-invocations-CxKldAeB.js} +1 -0
- package/dist/{agent-runner-DvTUyGTY.js → agent-runner-Cx6NO5LE.js} +115 -37
- package/dist/api/schema.js +1 -1
- package/dist/api.js +42 -41
- package/dist/{app-BsBUs3rF.d.ts → app-Bo0kB987.d.ts} +6 -1
- package/dist/app.d.ts +1 -1
- package/dist/app.js +59 -63
- package/dist/{assistant-reply-CEOMzsWy.js → assistant-reply-B2qUBAwL.js} +1 -1
- package/dist/{briefs-BSCkyYqs.js → briefs-DsGH2Vym.js} +2 -2
- package/dist/{catalog-runtime-Bpcs2b2L.js → catalog-runtime-CfwKT0sn.js} +1 -1
- package/dist/cli/chat.js +15 -17
- package/dist/cli/check.js +3 -3
- package/dist/cli/init.js +1 -1
- 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.js +3 -3
- package/dist/{client-JeyzRwsT.js → client-DpfjZgNk.js} +2 -2
- package/dist/{config-ULs6Zl9b.js → config-BiCtNiu5.js} +2 -2
- package/dist/{connections-CZ7HhEmN.js → connections-D9IKbfk-.js} +10 -10
- package/dist/{conversation-privacy-BQSlZXgV.js → conversation-privacy-CBUI0frD.js} +1 -1
- package/dist/{credential-sync-BKcv5rBe.js → credential-sync-Bu6ZOuOk.js} +14 -14
- package/dist/{executor-BoGNVEDn.js → executor-O8xqLDN6.js} +4 -3
- package/dist/{images-BBmDXQCB.js → images-AM1exvU0.js} +2 -2
- package/dist/instrumentation.js +2 -2
- package/dist/{job-queue-CbdVyaCo.js → job-queue-DmarAQGI.js} +1 -1
- package/dist/{logging-DSMmkHXG.js → logging-dZN1Bvtu.js} +1 -1
- package/dist/{message-zaj5gBbS.js → message-C_g2S8kv.js} +3 -3
- package/dist/nitro.d.ts +1 -1
- package/dist/nitro.js +3 -3
- package/dist/{oauth-callback-server-yYFG8Own.js → oauth-callback-server-DvvOvr4q.js} +2 -2
- package/dist/{profile-ByWkAY7L.js → profile-BP2N5uDY.js} +13 -6
- package/dist/{registry-BL-osYWN.js → registry-BUje_knT.js} +1 -1
- package/dist/{resolve-HuPG2VMB.js → resolve-DftZiYNU.js} +4 -4
- package/dist/{result-DS7V4a3-.js → result-CRMRT9CE.js} +16 -11
- package/dist/{runner-Cba_OfGl.js → runner-4mmL2Pt1.js} +10 -10
- package/dist/{sandbox-egress-signals-C7NcPzea.js → sandbox-egress-signals-1ysv0z5A.js} +1 -1
- package/dist/{schema-OzL8Zw4H.js → schema-XuTZukI9.js} +1 -1
- package/dist/{service-account-DqwHhwJA.js → service-account-B1sH3P7d.js} +3 -3
- package/dist/{service-account-Ko1Xs--F.js → service-account-Del2I_x3.js} +3 -3
- package/dist/{session-stop-HfKx-pky.js → session-stop-ZuyOHxdK.js} +11 -11
- package/dist/{skills-D6_bcAuW.js → skills-lPeepA2b.js} +2 -2
- package/dist/{spawn-BWqK6EwM.js → spawn-DovpdlrW.js} +3 -2
- package/dist/{store-DzRbd5VT.js → store-dZynGGFW.js} +6 -6
- package/dist/{task-queue-9LICOzcL.js → task-queue-CmMCtzHO.js} +3 -3
- package/dist/{task-runner-DGnd_B5X.js → task-runner-BRgJ5e0s.js} +19 -11
- package/dist/{tasks-CjrS098O.js → tasks-Bh2qYaed.js} +45 -28
- package/dist/{thread-state-CqkYowEz.js → thread-state-DA37FsAT.js} +5 -5
- package/dist/{turn-failure-response-BkKmGqFt.js → turn-failure-response-BLcscQ-f.js} +7 -7
- package/dist/{turn-lifecycle-DYv8IV6w.js → turn-lifecycle-D0e887FM.js} +1 -1
- package/dist/{turn-session-routing-TaVhKmdz.js → turn-session-routing-DdbSbJS6.js} +1 -1
- package/dist/{validation-BrXMYPyo.js → validation-DtcovXqq.js} +1 -1
- package/dist/{version-Ct049vav.js → version-JcDaJ75p.js} +1 -1
- package/dist/version.js +1 -1
- package/dist/{viewer-C-J0ewlH.js → viewer-oMTUVAcR.js} +4 -4
- package/dist/{web-input-C_xB3RXp.js → web-input-FQ5wgqYn.js} +26 -26
- package/dist/{work-D829Ue7k.js → work-BiIKfayl.js} +40 -10
- package/dist/{worker-BRTYzlpk.js → worker-BZ7l75NM.js} +5 -5
- package/migrations/0062_plugin_report_index.sql +20 -0
- package/migrations/0063_agent_invocation_type.sql +1 -0
- package/migrations/meta/0062_snapshot.json +3499 -0
- package/migrations/meta/0063_snapshot.json +3505 -0
- package/migrations/meta/_journal.json +14 -0
- package/package.json +10 -10
|
@@ -1,19 +1,18 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { V as toOptionalString, f as logException, m as logWarn, o as getActiveTraceId, p as logInfo, s as getLogContextAttributes, t as buildTurnFailureResponse, u as logAudit, y as setSpanAttributes, z as isRecord } from "./logging-DSMmkHXG.js";
|
|
1
|
+
import { a as completeText, f as unwrapCurrentInstruction, p as escapeXml, s as resolveGatewayModel, y as isProviderRetryError } from "./client-DpfjZgNk.js";
|
|
2
|
+
import { V as toOptionalString, f as logException, m as logWarn, o as getActiveTraceId, p as logInfo, s as getLogContextAttributes, t as buildTurnFailureResponse, u as logAudit, y as setSpanAttributes, z as isRecord } from "./logging-dZN1Bvtu.js";
|
|
4
3
|
import { n as captureMessage } from "./sentry-BBUlHih9.js";
|
|
5
|
-
import { n as botConfig, v as normalizeSlackEmojiName } from "./config-
|
|
4
|
+
import { n as botConfig, v as normalizeSlackEmojiName } from "./config-BiCtNiu5.js";
|
|
6
5
|
import { c as toStoredSlackActor, f as parseSlackUserId, g as parseSlackMessageTs } from "./actor-tlxzqaRe.js";
|
|
7
|
-
import { C as addAgentTurnUsage, R as parseDestination, c as getConversationEventStore, d as getDb, f as getSqlExecutor, m as withConversationEventLock, p as createSqlConversationEventStore, u as getConversationStore, x as bindProviderConversation, y as startLocationThread } from "./viewer-
|
|
8
|
-
import { d as juniorDestinations } from "./agent-invocations-
|
|
9
|
-
import { a as juniorAutomationRuns, l as juniorLocationConfigurations, o as juniorAutomationVersions, s as juniorAutomations } from "./executor-
|
|
6
|
+
import { C as addAgentTurnUsage, R as parseDestination, c as getConversationEventStore, d as getDb, f as getSqlExecutor, m as withConversationEventLock, p as createSqlConversationEventStore, u as getConversationStore, x as bindProviderConversation, y as startLocationThread } from "./viewer-oMTUVAcR.js";
|
|
7
|
+
import { d as juniorDestinations } from "./agent-invocations-CxKldAeB.js";
|
|
8
|
+
import { a as juniorAutomationRuns, l as juniorLocationConfigurations, o as juniorAutomationVersions, s as juniorAutomations } from "./executor-O8xqLDN6.js";
|
|
10
9
|
import { d as contextProvenance, f as instructionActors, n as agentHistoryItemSchema, p as instructionProvenanceFor } from "./history-AY8rs-FR.js";
|
|
11
|
-
import { _ as CredentialUnavailableError, a as resolveAuthTokenPlaceholder, f as credentialContextForActor, h as credentialSubjectSchema, o as resolvePluginCommandEnv, p as credentialContextSchema } from "./registry-
|
|
12
|
-
import { n as pluginCatalogRuntime } from "./catalog-runtime-
|
|
13
|
-
import { $t as
|
|
10
|
+
import { _ as CredentialUnavailableError, a as resolveAuthTokenPlaceholder, f as credentialContextForActor, h as credentialSubjectSchema, o as resolvePluginCommandEnv, p as credentialContextSchema } from "./registry-BUje_knT.js";
|
|
11
|
+
import { n as pluginCatalogRuntime } from "./catalog-runtime-CfwKT0sn.js";
|
|
12
|
+
import { $t as agentsInstructionsUpdatedEvent, Qt as JUNIOR_NATIVE_EVENT_NAMESPACE, Xt as createPluginCache, ct as getSlackClient, dt as normalizeSlackConversationId, en as authenticationLinkedEvent, it as SlackActionError, n as applyPluginFormatMarkdown, pt as withSlackRetries, tn as authenticationUnlinkedEvent, u as getPlugins, ut as isDmChannel, wt as createPluginLogger } from "./agent-hooks-9q2zdKHL.js";
|
|
13
|
+
import { a as acquireActiveLock, i as MUTATION_LOCK_TTL_MS, o as fenceLock, r as getStateAdapter, s as withLock } from "./adapter-t-Y9RHML.js";
|
|
14
14
|
import { N as messageCardRef } from "./conversation-CvuKJ3tA.js";
|
|
15
|
-
import {
|
|
16
|
-
import { y as sleep } from "./profile-ByWkAY7L.js";
|
|
15
|
+
import { y as sleep } from "./profile-BP2N5uDY.js";
|
|
17
16
|
import { A as eventAutomationSchema, E as scheduledAutomationSchema, S as automationVersionSchema } from "./automation-DrpcA-SX.js";
|
|
18
17
|
import { isDeepStrictEqual } from "node:util";
|
|
19
18
|
import { z } from "zod";
|
|
@@ -420,6 +419,7 @@ function basePluginContext(plugin) {
|
|
|
420
419
|
const pluginName = plugin.manifest.name;
|
|
421
420
|
return {
|
|
422
421
|
plugin: { name: pluginName },
|
|
422
|
+
cache: createPluginCache(pluginName),
|
|
423
423
|
log: createPluginLogger(pluginName),
|
|
424
424
|
db: getDb()
|
|
425
425
|
};
|
|
@@ -1030,10 +1030,32 @@ function wrapBareReferences(text) {
|
|
|
1030
1030
|
}
|
|
1031
1031
|
return out.join("\n");
|
|
1032
1032
|
}
|
|
1033
|
+
const LIST_ITEM_PATTERN = /^[-*•]\s|^\d+\.\s/;
|
|
1034
|
+
/**
|
|
1035
|
+
* Turn a follow-up paragraph inside a list item into a bullet at the same
|
|
1036
|
+
* indent.
|
|
1037
|
+
*
|
|
1038
|
+
* Slack's `markdown` block keeps only one paragraph per list item. It joins
|
|
1039
|
+
* the other paragraphs to the top-level item's text with no space and renders
|
|
1040
|
+
* nested lists after them. As a bullet, the paragraph keeps its place and
|
|
1041
|
+
* nesting.
|
|
1042
|
+
*/
|
|
1043
|
+
function bulletListFollowUpParagraphs(text) {
|
|
1044
|
+
const lines = text.split("\n");
|
|
1045
|
+
let inCodeBlock = false;
|
|
1046
|
+
let inList = false;
|
|
1047
|
+
for (const [i, line] of lines.entries()) {
|
|
1048
|
+
const trimmed = line.trimStart();
|
|
1049
|
+
const isFence = trimmed.startsWith("```");
|
|
1050
|
+
if (!inCodeBlock && trimmed && trimmed.length === line.length) inList = LIST_ITEM_PATTERN.test(line);
|
|
1051
|
+
else if (!inCodeBlock && inList && trimmed && !isFence && lines[i - 1]?.trim() === "" && !LIST_ITEM_PATTERN.test(trimmed)) lines[i] = `${line.slice(0, line.length - trimmed.length)}- ${trimmed}`;
|
|
1052
|
+
if (isFence) inCodeBlock = !inCodeBlock;
|
|
1053
|
+
}
|
|
1054
|
+
return lines.join("\n");
|
|
1055
|
+
}
|
|
1033
1056
|
/** Insert blank lines between content blocks so Slack renders them with visual separation. */
|
|
1034
1057
|
function ensureBlockSpacing(text) {
|
|
1035
1058
|
const codeBlockPattern = /^```/;
|
|
1036
|
-
const listItemPattern = /^[-*•]\s|^\d+\.\s/;
|
|
1037
1059
|
const lines = text.split("\n");
|
|
1038
1060
|
const result = [];
|
|
1039
1061
|
let inCodeBlock = false;
|
|
@@ -1052,7 +1074,9 @@ function ensureBlockSpacing(text) {
|
|
|
1052
1074
|
continue;
|
|
1053
1075
|
}
|
|
1054
1076
|
const prev = result.length > 0 ? result[result.length - 1] : void 0;
|
|
1055
|
-
|
|
1077
|
+
const isListItem = LIST_ITEM_PATTERN.test(line.trimStart());
|
|
1078
|
+
const isListContinuation = prev !== void 0 && !isListItem && /^\s/.test(line) && (/^\s/.test(prev) || LIST_ITEM_PATTERN.test(prev));
|
|
1079
|
+
if (prev !== void 0 && prev.trim() !== "" && line.trim() !== "" && !isListContinuation && !(LIST_ITEM_PATTERN.test(prev.trimStart()) && isListItem)) result.push("");
|
|
1056
1080
|
result.push(line);
|
|
1057
1081
|
}
|
|
1058
1082
|
return result.join("\n");
|
|
@@ -1062,13 +1086,15 @@ function ensureBlockSpacing(text) {
|
|
|
1062
1086
|
* or `{ type: "markdown" }` blocks.
|
|
1063
1087
|
*
|
|
1064
1088
|
* Plugins may first rewrite ordinary Markdown. Core then applies Slack-only
|
|
1065
|
-
* delivery shaping: bare URL wrapping
|
|
1066
|
-
* owns chunking and continuation
|
|
1089
|
+
* delivery shaping: bare URL wrapping, block spacing, and list follow-up
|
|
1090
|
+
* paragraph bullets. Slack reply delivery owns chunking and continuation
|
|
1091
|
+
* markers separately.
|
|
1067
1092
|
*/
|
|
1068
1093
|
function normalizeSlackReplyMarkdown(text) {
|
|
1069
1094
|
let normalized = applyPluginFormatMarkdown(text).replace(/\r\n?/g, "\n").replace(/[ \t]+$/gm, "");
|
|
1070
1095
|
normalized = wrapBareReferences(normalized);
|
|
1071
1096
|
normalized = ensureBlockSpacing(normalized);
|
|
1097
|
+
normalized = bulletListFollowUpParagraphs(normalized);
|
|
1072
1098
|
return normalized.replace(/\n{3,}/g, "\n\n").trim();
|
|
1073
1099
|
}
|
|
1074
1100
|
/** Normalize assistant status text before handing it to Slack. */
|
|
@@ -2451,22 +2477,12 @@ async function executeCredentialedEgressRequest(input) {
|
|
|
2451
2477
|
}
|
|
2452
2478
|
}
|
|
2453
2479
|
// src/chat/experimental.ts
|
|
2454
|
-
var experimental_exports = /* @__PURE__ */ __exportAll({
|
|
2455
|
-
EXPERIMENTAL_FEATURES: () => EXPERIMENTAL_FEATURES,
|
|
2456
|
-
getExperimentalFeatures: () => getExperimentalFeatures,
|
|
2457
|
-
isExperimentalFeatureEnabled: () => isExperimentalFeatureEnabled,
|
|
2458
|
-
setExperimentalFeatures: () => setExperimentalFeatures
|
|
2459
|
-
});
|
|
2460
2480
|
/**
|
|
2461
2481
|
* Known unstable product features that must be opted into explicitly.
|
|
2462
2482
|
* Add new keys here as features graduate from private experiments; remove them
|
|
2463
2483
|
* once they become stable defaults.
|
|
2464
2484
|
*/
|
|
2465
|
-
const EXPERIMENTAL_FEATURES = [
|
|
2466
|
-
"operator-tools",
|
|
2467
|
-
"passive-routing",
|
|
2468
|
-
"subagents"
|
|
2469
|
-
];
|
|
2485
|
+
const EXPERIMENTAL_FEATURES = ["operator-tools", "passive-routing"];
|
|
2470
2486
|
const EXPERIMENTAL_FEATURE_SET = new Set(EXPERIMENTAL_FEATURES);
|
|
2471
2487
|
let configuredExperimental = {};
|
|
2472
2488
|
function isExperimentalFeature(value) {
|
|
@@ -4160,6 +4176,7 @@ async function getPluginConversationTitleContext(args) {
|
|
|
4160
4176
|
egress,
|
|
4161
4177
|
log: createPluginLogger(plugin.manifest.name),
|
|
4162
4178
|
plugin: { name: plugin.manifest.name },
|
|
4179
|
+
cache: createPluginCache(plugin.manifest.name),
|
|
4163
4180
|
signal,
|
|
4164
4181
|
text: args.text
|
|
4165
4182
|
}), timedOut]);
|
|
@@ -5808,4 +5825,4 @@ async function saveScheduledAutomation(db, task, expectedRevision, editedBy) {
|
|
|
5808
5825
|
async function saveScheduledAutomationInLock(db, task, current) {
|
|
5809
5826
|
await writeScheduledAutomation(db, requireStoredTask(task), current);
|
|
5810
5827
|
}
|
|
5811
|
-
export { projectConversationMessages as $,
|
|
5828
|
+
export { projectConversationMessages as $, createDurableLocationConfigurationService as $n, isToolResultError as $t, ToolInputError as A, parseSandboxEgressCredentialToken as An, saveTurnCheckpoint as At, recordAgentsInstructionsUpdated as B, normalizeSlackStatusText as Bn, TurnToolCallLimitExceededError as Bt, automationVersionOf as C, normalizeSandboxEgressTracePropagationDomains as Cn, abandonReplacedPendingAuth as Ct, AutomationConflictError as D, consumeSandboxEgressAuthRequiredSignal as Dn, wasPendingAuthStopped as Dt, sameDefinitionValue as E, clearSandboxEgressSignals as En, getConversationPendingAuth as Et, loadLastModelProfile as F, resolveBaseUrl as Fn, listTurnSummaries as Ft, recordGuardianActionReviewed as G, openSlackDirectMessage as Gn, extractAssistantText as Gt, recordAuthenticationLinked as H, truncateStatusText as Hn, createTurnLimitGate as Ht, loadProjection as I, startOAuthFlow as In, recordTurnSummary as It, recordToolExecutionStarted as J, uploadFilesToConversation as Jn, getUserMessageInstructionText as Jt, recordMcpProviderConnected as K, postSlackMessage as Kn, getPiMessageRole as Kt, loadTurnProjection as L, escapeSlackMrkdwnText as Ln, TURN_LIMIT_DISABLED_REASON as Lt, commitMessages as M, deliverOAuthAuthorization as Mn, completeTurnRecord as Mt, loadConnectedMcpProviders as N, formatProviderLabel as Nn, failTurnRecord as Nt, automationRevision as O, consumeSandboxEgressPermissionDeniedSignal as On, continuableMessages as Ot, loadConversationProjection as P, parseOAuthStatePayload as Pn, getTurnRecord as Pt, persistConversationMessages as Q, resolvePluginOAuthAccount as Qn, isContinuablePiBoundary as Qt, loadTurnRoute as R, formatSlackLink as Rn, TurnBudgetExceededError as Rt, automationDefinition as S, resolveSandboxEgressProviderForHost as Sn, AuthorizationPauseError as St, readAutomationVersion as T, SANDBOX_EGRESS_PROXY_PATH as Tn, clearPendingAuth as Tt, recordAuthorizationCompleted as U, addReactionToMessage as Un, isTurnExecutionLimitExceededError as Ut, recordAttachmentsDelivered as V, slackMention as Vn, buildTurnErrorResponse as Vt, recordAuthorizationRequested as W, getSlackMessagePermalink as Wn, persistWithRetry as Wt, appendConversationMessages as X, slackExternalRefIdSchema as Xn, instructionTextForProjection as Xt, recordTurnRoute as Y, slackEntitySchema as Yn, hasRuntimeTurnContext as Yt, hydrateConversationMessages as Z, getOAuthAccountProviders as Zn, isAssistantMessage as Zt, parseEventAutomationRow as _, setExperimentalFeatures as _n, PluginCredentialFailureError as _t, saveScheduledAutomation as a, TURN_CONTEXT_TAG as an, appendThreadContextMessages as at, admitEventAutomationRun as b, buildSandboxEgressNetworkPolicy as bn, AuthPausePersistenceError as bt, withScheduledAutomationLock as c, SubscribedReplyReason as cn, estimateConversationContextTokens as ct, createEventAutomation as d, getThreadStopDecision as dn, markConversationMessage as dt, isToolResultMessage as en, configValueSchema as er, persistConversationMessageSummaries as et, deleteEventAutomation as f, estimateTextTokens as fn, normalizeConversationText as ft, listEventAutomationsForTeam as g, isExperimentalFeatureEnabled as gn, createPluginEgress as gt, listDeletedEventAutomationsCreatedBy as h, getExperimentalFeatures as hn, upsertConversationMessage as ht, readScheduledAutomation as i, trimTrailingAssistantMessages as in, setConfigDefaults as ir, resolveTaskTitle as it, commitAcceptedReply as j, sandboxEgressSignalsResponseSchema as jn, abandonTurnRecord as jt, requireAutomationRevision as k, createSandboxEgressCredentialToken as kn, loadTurnCheckpoint as kt, blockEventAutomation as l, decideSubscribedThreadReply as ln, getConversationMessageSlackTs as lt, getEventAutomation as m, getAgentContextInputLimitTokens as mn, turnHasReply as mt, listScheduledAutomationsForTeam as n, retainRuntimeTurnContext as nn, piMessageFromHistoryItem as nr, settleConversationTitleWork as nt, saveScheduledAutomationInLock as o, buildDeterministicAssistantMessageId as on, buildConversationContext as ot, findMatchingEventAutomations as p, getAgentContextCompactionTriggerTokens as pn, recordDeliveredAssistantMessage as pt, recordSubscribedReplyRoute as q, removeReactionFromMessage as qn, getTerminalAssistantMessages as qt, parseScheduledAutomationRow as r, stripRuntimeTurnContext as rn, getConfigDefaults as rr, fallbackShortTitle as rt, scheduledRunId as s, buildDeterministicTurnId as sn, createConversationMemoryService as st, createScheduledAutomation as t, normalizeToolNameFromResult as tn, historyItemFromPiMessage as tr, resolveConversationTitle as tt, collectEventAutomationMatchKeys as u, getSubscribedReplyPreflightDecision as un, isHumanConversationMessage as ut, saveEventAutomation as v, executeCredentialedEgressRequest as vn, createPluginAuthOrchestration as vt, listAutomationVersions as w, shouldPropagateSandboxEgressTrace as wn, canReusePendingAuthLink as wt, eventAutomationRunLimitReason as x, resolveSandboxCommandEnvironment as xn, AuthorizationFlowDisabledError as xt, setEventAutomationStatus as y, createUserTokenStore as yn, authorizationId as yt, openConversationProjection as z, normalizeSlackReplyMarkdown as zn, TurnSliceLimitExceededError as zt };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { B as toOptionalNumber, V as toOptionalString, z as isRecord } from "./logging-
|
|
3
|
-
import { d as getDb } from "./viewer-
|
|
4
|
-
import { gt as JUNIOR_THREAD_STATE_TTL_MS } from "./agent-hooks-
|
|
5
|
-
import { r as getStateAdapter } from "./adapter-
|
|
1
|
+
import { $n as createDurableLocationConfigurationService, Q as persistConversationMessages } from "./tasks-Bh2qYaed.js";
|
|
2
|
+
import { B as toOptionalNumber, V as toOptionalString, z as isRecord } from "./logging-dZN1Bvtu.js";
|
|
3
|
+
import { d as getDb } from "./viewer-oMTUVAcR.js";
|
|
4
|
+
import { gt as JUNIOR_THREAD_STATE_TTL_MS } from "./agent-hooks-9q2zdKHL.js";
|
|
5
|
+
import { r as getStateAdapter } from "./adapter-t-Y9RHML.js";
|
|
6
6
|
// src/chat/state/conversation.ts
|
|
7
7
|
function defaultConversationState() {
|
|
8
8
|
return {
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { Tt as clearPendingAuth, Z as hydrateConversationMessages, dt as markConversationMessage, sn as buildDeterministicTurnId } from "./tasks-
|
|
2
|
-
import { _ as getProviderErrorAttributes, g as findProviderError, m as ProviderError, v as getProviderErrorUserMessage } from "./client-
|
|
3
|
-
import { t as buildTurnFailureResponse, z as isRecord } from "./logging-
|
|
1
|
+
import { Tt as clearPendingAuth, Z as hydrateConversationMessages, dt as markConversationMessage, sn as buildDeterministicTurnId } from "./tasks-Bh2qYaed.js";
|
|
2
|
+
import { _ as getProviderErrorAttributes, g as findProviderError, m as ProviderError, v as getProviderErrorUserMessage } from "./client-DpfjZgNk.js";
|
|
3
|
+
import { t as buildTurnFailureResponse, z as isRecord } from "./logging-dZN1Bvtu.js";
|
|
4
4
|
import { g as parseSlackMessageTs } from "./actor-tlxzqaRe.js";
|
|
5
|
-
import { c as getConversationEventStore, d as getDb } from "./viewer-
|
|
6
|
-
import {
|
|
7
|
-
import { Gt as listConversationAnnotations } from "./agent-hooks-
|
|
5
|
+
import { c as getConversationEventStore, d as getDb } from "./viewer-oMTUVAcR.js";
|
|
6
|
+
import { Lt as markTurnClosed, Rt as markTurnCompleted } from "./agent-runner-Cx6NO5LE.js";
|
|
7
|
+
import { Gt as listConversationAnnotations } from "./agent-hooks-9q2zdKHL.js";
|
|
8
8
|
import { F as readMessageCardRefs, I as removedCardSchema, L as resolveMessageCards } from "./conversation-CvuKJ3tA.js";
|
|
9
|
-
import { o as persistThreadStateById, r as getPersistedThreadState, s as coerceThreadConversationState } from "./thread-state-
|
|
9
|
+
import { o as persistThreadStateById, r as getPersistedThreadState, s as coerceThreadConversationState } from "./thread-state-DA37FsAT.js";
|
|
10
10
|
// src/chat/conversations/pending-cards.ts
|
|
11
11
|
/** Select undelivered cards and load their latest saved facts. */
|
|
12
12
|
async function loadPendingMessageCards(conversationId) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { c as getConversationEventStore } from "./viewer-
|
|
1
|
+
import { c as getConversationEventStore } from "./viewer-oMTUVAcR.js";
|
|
2
2
|
// src/chat/conversations/turn-lifecycle.ts
|
|
3
3
|
/** Persist correlated turn lifecycle facts with retry-safe terminal exclusion. */
|
|
4
4
|
var ConversationTurnLifecycleService = class {
|
|
@@ -34,7 +34,7 @@ function slackSourceForDestination(args) {
|
|
|
34
34
|
* Reads parent Conversations when this Conversation has no Destination.
|
|
35
35
|
*/
|
|
36
36
|
async function resolveConversationRouting(args) {
|
|
37
|
-
const conversationStore = args.conversationStore ?? (await import("./viewer-
|
|
37
|
+
const conversationStore = args.conversationStore ?? (await import("./viewer-oMTUVAcR.js").then((n) => n.s)).getConversationStore();
|
|
38
38
|
const chain = await loadConversationChain(args.conversationId, conversationStore);
|
|
39
39
|
let destination;
|
|
40
40
|
let source;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-nwUcYXjP.js";
|
|
2
|
-
import { n as pluginCatalogRuntime } from "./catalog-runtime-
|
|
2
|
+
import { n as pluginCatalogRuntime } from "./catalog-runtime-CfwKT0sn.js";
|
|
3
3
|
import { isDeepStrictEqual } from "node:util";
|
|
4
4
|
// src/chat/plugins/validation.ts
|
|
5
5
|
var validation_exports = /* @__PURE__ */ __exportAll({
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// package.json
|
|
2
|
-
var version = "0.
|
|
2
|
+
var version = "0.262.0";
|
|
3
3
|
// src/version.ts
|
|
4
4
|
/** Installed Junior package version, or `unknown` when package metadata is unavailable. */
|
|
5
5
|
const JUNIOR_VERSION = typeof version === "string" && version.trim() ? version : "unknown";
|
package/dist/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { t as JUNIOR_VERSION } from "./version-
|
|
1
|
+
export { t as JUNIOR_VERSION } from "./version-JcDaJ75p.js";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-nwUcYXjP.js";
|
|
2
|
-
import { I as GOOGLE_IDENTITY_PROVIDER, R as normalizeIdentityEmail } from "./logging-
|
|
3
|
-
import { i as getChatConfig } from "./config-
|
|
2
|
+
import { I as GOOGLE_IDENTITY_PROVIDER, R as normalizeIdentityEmail } from "./logging-dZN1Bvtu.js";
|
|
3
|
+
import { i as getChatConfig } from "./config-BiCtNiu5.js";
|
|
4
4
|
import { d as parseSlackTeamId, o as parseActorUserId, u as parseSlackChannelReferenceId } from "./actor-tlxzqaRe.js";
|
|
5
|
-
import { c as juniorIdentities, d as juniorDestinations, l as juniorUsers, o as conversationReadColumns, s as juniorConversations } from "./agent-invocations-
|
|
6
|
-
import { _ as juniorConversationAnnotations, d as juniorConversationBindings, h as juniorConversationEvents, m as juniorConversationMetrics, p as CONVERSATION_METRICS, t as createJuniorSqlExecutor, u as juniorConversationParticipants } from "./executor-
|
|
5
|
+
import { c as juniorIdentities, d as juniorDestinations, l as juniorUsers, o as conversationReadColumns, s as juniorConversations } from "./agent-invocations-CxKldAeB.js";
|
|
6
|
+
import { _ as juniorConversationAnnotations, d as juniorConversationBindings, h as juniorConversationEvents, m as juniorConversationMetrics, p as CONVERSATION_METRICS, t as createJuniorSqlExecutor, u as juniorConversationParticipants } from "./executor-O8xqLDN6.js";
|
|
7
7
|
import { c as newConversationEventSchema, h as usageSchema, l as encodeHistoryPayload, o as decodeStoredConversationEvent, r as conversationEventDataSchema, s as historyReplacementSchema } from "./history-AY8rs-FR.js";
|
|
8
8
|
import { randomUUID } from "node:crypto";
|
|
9
9
|
import { and, asc, desc, eq, gt, gte, inArray, isNull, lt, lte, ne, or, sql } from "drizzle-orm";
|
|
@@ -1,36 +1,36 @@
|
|
|
1
|
-
import { At as saveTurnCheckpoint, Bn as
|
|
2
|
-
import { a as completeText, p as escapeXml, r as completeDecision, y as isProviderRetryError } from "./client-
|
|
3
|
-
import { B as toOptionalNumber, T as withSpan, V as toOptionalString, d as logError, f as logException, m as logWarn, n as createChatSdkLogger, o as getActiveTraceId, p as logInfo, t as buildTurnFailureResponse, v as setSentryUser, w as withLogContext, x as setTags, y as setSpanAttributes, z as isRecord } from "./logging-
|
|
4
|
-
import { c as getSlackClientSecret, i as getChatConfig, l as getSlackSigningSecret, n as botConfig, o as getSlackBotToken, s as getSlackClientId, v as normalizeSlackEmojiName } from "./config-
|
|
1
|
+
import { At as saveTurnCheckpoint, Bn as normalizeSlackStatusText, Dt as wasPendingAuthStopped, E as sameDefinitionValue, Ft as listTurnSummaries, Hn as truncateStatusText, I as loadProjection, It as recordTurnSummary, Kn as postSlackMessage, Ln as escapeSlackMrkdwnText, M as commitMessages, Mt as completeTurnRecord, Nt as failTurnRecord, P as loadConversationProjection, Pt as getTurnRecord, Q as persistConversationMessages, Rn as formatSlackLink, S as automationDefinition, Tt as clearPendingAuth, U as recordAuthorizationCompleted, Un as addReactionToMessage, Vt as buildTurnErrorResponse, Wt as persistWithRetry, Z as hydrateConversationMessages, _ as parseEventAutomationRow, _t as PluginCredentialFailureError, at as appendThreadContextMessages, c as withScheduledAutomationLock, ct as estimateConversationContextTokens, dn as getThreadStopDecision, dt as markConversationMessage, er as configValueSchema, et as persistConversationMessageSummaries, f as deleteEventAutomation, ft as normalizeConversationText, gn as isExperimentalFeatureEnabled, h as listDeletedEventAutomationsCreatedBy, ht as upsertConversationMessage, i as readScheduledAutomation, in as trimTrailingAssistantMessages, j as commitAcceptedReply, jt as abandonTurnRecord, kt as loadTurnCheckpoint, ln as decideSubscribedThreadReply, lt as getConversationMessageSlackTs, mt as turnHasReply, o as saveScheduledAutomationInLock, on as buildDeterministicAssistantMessageId, ot as buildConversationContext, pt as recordDeliveredAssistantMessage, q as recordSubscribedReplyRoute, qn as removeReactionFromMessage, r as parseScheduledAutomationRow, rt as fallbackShortTitle, sn as buildDeterministicTurnId, st as createConversationMemoryService, tt as resolveConversationTitle, un as getSubscribedReplyPreflightDecision, ut as isHumanConversationMessage, w as listAutomationVersions, xt as AuthorizationFlowDisabledError, yn as createUserTokenStore, zn as normalizeSlackReplyMarkdown } from "./tasks-Bh2qYaed.js";
|
|
2
|
+
import { a as completeText, p as escapeXml, r as completeDecision, y as isProviderRetryError } from "./client-DpfjZgNk.js";
|
|
3
|
+
import { B as toOptionalNumber, T as withSpan, V as toOptionalString, d as logError, f as logException, m as logWarn, n as createChatSdkLogger, o as getActiveTraceId, p as logInfo, t as buildTurnFailureResponse, v as setSentryUser, w as withLogContext, x as setTags, y as setSpanAttributes, z as isRecord } from "./logging-dZN1Bvtu.js";
|
|
4
|
+
import { c as getSlackClientSecret, i as getChatConfig, l as getSlackSigningSecret, n as botConfig, o as getSlackBotToken, s as getSlackClientId, v as normalizeSlackEmojiName } from "./config-BiCtNiu5.js";
|
|
5
5
|
import { o as modelIdForProfile, r as defaultModelId } from "./model-profile-Bg8EoCKD.js";
|
|
6
6
|
import { a as isUserActor, g as parseSlackMessageTs, i as isActorUserId, l as parseSlackChannelId, n as createSlackActor, o as parseActorUserId, r as createSlackResumeActor, t as createActor } from "./actor-tlxzqaRe.js";
|
|
7
|
-
import { L as createSlackDestination, c as getConversationEventStore, d as getDb, f as getSqlExecutor, u as getConversationStore, z as requireSlackDestination } from "./viewer-
|
|
8
|
-
import { c as juniorIdentities, d as juniorDestinations, l as juniorUsers } from "./agent-invocations-
|
|
9
|
-
import { a as juniorAutomationRuns, s as juniorAutomations } from "./executor-
|
|
7
|
+
import { L as createSlackDestination, c as getConversationEventStore, d as getDb, f as getSqlExecutor, u as getConversationStore, z as requireSlackDestination } from "./viewer-oMTUVAcR.js";
|
|
8
|
+
import { c as juniorIdentities, d as juniorDestinations, l as juniorUsers } from "./agent-invocations-CxKldAeB.js";
|
|
9
|
+
import { a as juniorAutomationRuns, s as juniorAutomations } from "./executor-O8xqLDN6.js";
|
|
10
10
|
import { p as instructionProvenanceFor } from "./history-AY8rs-FR.js";
|
|
11
|
-
import { d as actorLogContext, f as credentialContextForActor } from "./registry-
|
|
12
|
-
import { A as listThreadReplies, At as
|
|
13
|
-
import { Bt as readAttachmentVisionSummary, Lt as buildSentryConversationUrl, Rt as getSlackFileId, V as cancelSubscriptions, Vt as recordSlackAttachment, Yt as lookupSlackUser, _t as getDashboardConversationLink, at as downloadPrivateSlackFile, ct as getSlackClient, dt as normalizeSlackConversationId, ft as runWithSlackInstallationToken, gt as JUNIOR_THREAD_STATE_TTL_MS, it as SlackActionError, o as getPluginSlackConversationLink, rt as verifyTimerWatchCredentialSubject, st as getHeaderString, ut as isDmChannel, vt as getDashboardObjectIconLink } from "./agent-hooks-
|
|
11
|
+
import { d as actorLogContext, f as credentialContextForActor } from "./registry-BUje_knT.js";
|
|
12
|
+
import { A as listThreadReplies, At as CooperativeTurnYieldError, Bt as startActiveTurn, Ct as buildSteeringPiMessage, D as resolveSlackChannelIdFromMessage, E as readSlackRawMessageContext, Ft as isTurnInputCommitLostError, I as eventAutomationTriggerAvailable, It as isTurnInputDeferredError, L as effectiveTaskOutcomes, Lt as markTurnClosed, Mt as TurnInputDeferredError, Nt as getConversationTurnBoundaryError, O as resolveSlackChannelIdFromThreadId, Pt as isCooperativeTurnYieldError, Rt as markTurnCompleted, T as parseSlackThreadId, Tt as RetryableDeliveryError, Vt as shouldEmitDevAgentTrace, b as renderBlockText, i as buildAuthPauseResponse, jt as TurnInputCommitLostError, k as getConversationInfo, kt as ConversationTurnBoundaryError, n as executeAgentRun, p as latestProgressStatus, r as createContextCompactor, t as createAgentRunner, w as storeAttachment, wt as withoutSavedSteeringMessages, y as renderAttachmentText, zt as markTurnFailed } from "./agent-runner-Cx6NO5LE.js";
|
|
13
|
+
import { Bt as readAttachmentVisionSummary, Lt as buildSentryConversationUrl, Rt as getSlackFileId, V as cancelSubscriptions, Vt as recordSlackAttachment, Yt as lookupSlackUser, _t as getDashboardConversationLink, at as downloadPrivateSlackFile, ct as getSlackClient, dt as normalizeSlackConversationId, ft as runWithSlackInstallationToken, gt as JUNIOR_THREAD_STATE_TTL_MS, it as SlackActionError, o as getPluginSlackConversationLink, rt as verifyTimerWatchCredentialSubject, st as getHeaderString, ut as isDmChannel, vt as getDashboardObjectIconLink } from "./agent-hooks-9q2zdKHL.js";
|
|
14
|
+
import { a as acquireActiveLock, i as MUTATION_LOCK_TTL_MS, r as getStateAdapter, s as withLock } from "./adapter-t-Y9RHML.js";
|
|
14
15
|
import { B as readMessageAttachments, U as isVisionImageMediaType } from "./conversation-CvuKJ3tA.js";
|
|
15
16
|
import { a as EVENT_SYSTEM_ACTOR, o as isEventConversationMessage } from "./prompt-DeVax2qO.js";
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import { E as stopConversationWork, g as getConversationWorkState, h as getConversation, m as ensureConversationWake, n as appendAndEnqueueExclusiveInboundMessage, r as appendAndEnqueueInboundMessage, w as requestConversationWork } from "./store-DzRbd5VT.js";
|
|
17
|
+
import { n as getAssistantReplyText } from "./assistant-reply-B2qUBAwL.js";
|
|
18
|
+
import { H as runDispatchOutcome, N as maybePostAutomatedTurnLimitNotice, P as recordFinishedTurnForAutomatedLimit, R as deliversFinalText, c as isEventMailboxMetadata, d as getEventCatalog, i as skipInputBeforeConversationStop, j as joinMailboxText, l as renderEventBatchText, s as eventBatchMessageEvents, u as timerWatchCredentialSubject, x as automationEventCatalog, z as finishedRunReply } from "./session-stop-ZuyOHxdK.js";
|
|
19
|
+
import { a as getVercelConversationWorkQueue, f as getTurnRequestDeadline } from "./job-queue-DmarAQGI.js";
|
|
20
|
+
import { E as stopConversationWork, g as getConversationWorkState, h as getConversation, m as ensureConversationWake, n as appendAndEnqueueExclusiveInboundMessage, r as appendAndEnqueueInboundMessage, w as requestConversationWork } from "./store-dZynGGFW.js";
|
|
21
21
|
import { l as automationListQuerySchema } from "./automation-DrpcA-SX.js";
|
|
22
22
|
import { c as sumUtcHoursIntoSixHours, m as healthReportSchema, t as webMessageId } from "./web-message-id-CJSUiksE.js";
|
|
23
|
-
import { A as readAutomationExecutions, D as readAutomationExecutionStatusDays, E as readAutomationExecutionHours, O as readAutomationExecutionStatusHours, S as emptyAutomationRunWindows, T as readAutomationExecutionDays, _ as markDispatchBlocked, a as claimDispatchMailboxAppend, b as markDispatchRunning, c as getDispatchConversationId, d as getDispatchRecord, f as getDispatchTurnId, g as markDispatchAwaitingResume, j as readAutomationRuns, k as readAutomationExecutionSummaries, l as getDispatchIdForConversation, m as isTerminalDispatchStatus, n as scheduleSessionCompletedPluginTasks, o as confirmDispatchMailboxAppend, t as processPluginTask, u as getDispatchInputMessageId, v as markDispatchCompleted, w as readAutomationExecutionByConversationId, y as markDispatchFailed } from "./task-runner-
|
|
24
|
-
import { a as withAgentInvocationResultActors, c as resolveMailboxTurnWork, i as startAgentInvocationsForChildInput, l as sourceFromTurnInput, o as getAuthPausedConversationTurnId, s as getEventBatchDelayMs, t as enqueueAgentInvocationResult, u as turnInputFactsFromConversationMessage } from "./result-
|
|
25
|
-
import { n as getTurnLifecycle, t as ConversationTurnLifecycleService } from "./turn-lifecycle-
|
|
26
|
-
import { i as resolveAgentInvocationId, o as AgentRunError, s as executeTurn, t as createAgentInvocationWorker } from "./work-
|
|
27
|
-
import { a as persistThreadState, i as persistThreadRuntimeState, n as getPersistedSandboxState, o as persistThreadStateById, r as getPersistedThreadState, s as coerceThreadConversationState, t as getLocationConfigurationService } from "./thread-state-
|
|
28
|
-
import { c as deleteWebAuthorization, d as createPausedTurns, f as getPausedTurnRequest, h as getTurnAuthorization, m as wakePausedTurn, s as createWebAuthorization } from "./connections-
|
|
29
|
-
import { n as resolveTurnSessionRouting } from "./turn-session-routing-
|
|
30
|
-
import { t as bindMessageAgent } from "./message-
|
|
31
|
-
import { t as bindSpawnAgent } from "./spawn-
|
|
32
|
-
import { a as persistAuthPauseTurnState, c as getTurnUserSlackMessageTs, d as loadPendingMessageCards, i as completeAuthPauseTurn, l as buildDeliveredTurnStatePatch, n as getAgentTurnDiagnosticsAttributes, o as getTurnUserMessage, r as requireTurnFailureEventId, s as getTurnUserReplyAttachmentContext, t as finalizeFailedTurnReplyWithEvent, u as getInterruptionMarker } from "./turn-failure-response-
|
|
33
|
-
import { r as storeInputImages } from "./images-
|
|
23
|
+
import { A as readAutomationExecutions, D as readAutomationExecutionStatusDays, E as readAutomationExecutionHours, O as readAutomationExecutionStatusHours, S as emptyAutomationRunWindows, T as readAutomationExecutionDays, _ as markDispatchBlocked, a as claimDispatchMailboxAppend, b as markDispatchRunning, c as getDispatchConversationId, d as getDispatchRecord, f as getDispatchTurnId, g as markDispatchAwaitingResume, j as readAutomationRuns, k as readAutomationExecutionSummaries, l as getDispatchIdForConversation, m as isTerminalDispatchStatus, n as scheduleSessionCompletedPluginTasks, o as confirmDispatchMailboxAppend, t as processPluginTask, u as getDispatchInputMessageId, v as markDispatchCompleted, w as readAutomationExecutionByConversationId, y as markDispatchFailed } from "./task-runner-BRgJ5e0s.js";
|
|
24
|
+
import { a as withAgentInvocationResultActors, c as resolveMailboxTurnWork, i as startAgentInvocationsForChildInput, l as sourceFromTurnInput, o as getAuthPausedConversationTurnId, s as getEventBatchDelayMs, t as enqueueAgentInvocationResult, u as turnInputFactsFromConversationMessage } from "./result-CRMRT9CE.js";
|
|
25
|
+
import { n as getTurnLifecycle, t as ConversationTurnLifecycleService } from "./turn-lifecycle-D0e887FM.js";
|
|
26
|
+
import { i as resolveAgentInvocationId, o as AgentRunError, s as executeTurn, t as createAgentInvocationWorker } from "./work-BiIKfayl.js";
|
|
27
|
+
import { a as persistThreadState, i as persistThreadRuntimeState, n as getPersistedSandboxState, o as persistThreadStateById, r as getPersistedThreadState, s as coerceThreadConversationState, t as getLocationConfigurationService } from "./thread-state-DA37FsAT.js";
|
|
28
|
+
import { c as deleteWebAuthorization, d as createPausedTurns, f as getPausedTurnRequest, h as getTurnAuthorization, m as wakePausedTurn, s as createWebAuthorization } from "./connections-D9IKbfk-.js";
|
|
29
|
+
import { n as resolveTurnSessionRouting } from "./turn-session-routing-DdbSbJS6.js";
|
|
30
|
+
import { t as bindMessageAgent } from "./message-C_g2S8kv.js";
|
|
31
|
+
import { t as bindSpawnAgent } from "./spawn-DovpdlrW.js";
|
|
32
|
+
import { a as persistAuthPauseTurnState, c as getTurnUserSlackMessageTs, d as loadPendingMessageCards, i as completeAuthPauseTurn, l as buildDeliveredTurnStatePatch, n as getAgentTurnDiagnosticsAttributes, o as getTurnUserMessage, r as requireTurnFailureEventId, s as getTurnUserReplyAttachmentContext, t as finalizeFailedTurnReplyWithEvent, u as getInterruptionMarker } from "./turn-failure-response-BLcscQ-f.js";
|
|
33
|
+
import { r as storeInputImages } from "./images-AM1exvU0.js";
|
|
34
34
|
import { z } from "zod";
|
|
35
35
|
import { createHash } from "node:crypto";
|
|
36
36
|
import { and, asc, count, desc, eq, exists, inArray, ne, or, sql } from "drizzle-orm";
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-nwUcYXjP.js";
|
|
2
|
-
import { At as saveTurnCheckpoint, Nt as failTurnRecord, Pt as getTurnRecord, Ut as isTurnExecutionLimitExceededError, _t as PluginCredentialFailureError, jt as abandonTurnRecord, qt as getTerminalAssistantMessages, xt as AuthorizationFlowDisabledError, z as openConversationProjection } from "./tasks-
|
|
3
|
-
import { n as botConfig } from "./config-
|
|
4
|
-
import { c as getConversationEventStore, u as getConversationStore } from "./viewer-
|
|
2
|
+
import { At as saveTurnCheckpoint, Nt as failTurnRecord, Pt as getTurnRecord, Ut as isTurnExecutionLimitExceededError, _t as PluginCredentialFailureError, jt as abandonTurnRecord, qt as getTerminalAssistantMessages, xt as AuthorizationFlowDisabledError, z as openConversationProjection } from "./tasks-Bh2qYaed.js";
|
|
3
|
+
import { n as botConfig } from "./config-BiCtNiu5.js";
|
|
4
|
+
import { c as getConversationEventStore, u as getConversationStore } from "./viewer-oMTUVAcR.js";
|
|
5
5
|
import { m as sameActorIdentity, u as agentInstructionProvenance } from "./history-AY8rs-FR.js";
|
|
6
|
-
import {
|
|
7
|
-
import { n as getAssistantReplyText } from "./assistant-reply-
|
|
8
|
-
import { F as resetAutomatedTurnLimit, N as maybePostAutomatedTurnLimitNotice, P as recordFinishedTurnForAutomatedLimit } from "./session-stop-
|
|
9
|
-
import { r as appendAndEnqueueInboundMessage } from "./store-
|
|
10
|
-
import { t as ConversationTurnLifecycleService } from "./turn-lifecycle-
|
|
11
|
-
import { n as getPersistedSandboxState, o as persistThreadStateById, r as getPersistedThreadState } from "./thread-state-
|
|
6
|
+
import { Ct as buildSteeringPiMessage, Ft as isTurnInputCommitLostError, G as completeAgentInvocation, H as recordSubagentStarted, K as createAgentInvocation, Nt as getConversationTurnBoundaryError, Ot as readBlockedReport, V as recordSubagentEnded, X as getActiveAgentInvocationForConversation, Z as getAgentInvocation, _t as agentTypeInstructions, at as getLatestAgentInvocationForConversation, dt as markAgentInvocationPaused, ft as markAgentInvocationRunning, jt as TurnInputCommitLostError, lt as markAgentInvocationMailboxAppended, mt as reportReplacedAgentInvocation, ot as isTerminalAgentInvocation, pt as markAgentInvocationSteered, rt as getAgentInvocationTurnId, tt as getAgentInvocationMessageId, vt as agentTypeStartsWithParentHistory, wt as withoutSavedSteeringMessages, z as stopChildAgentsOf } from "./agent-runner-Cx6NO5LE.js";
|
|
7
|
+
import { n as getAssistantReplyText } from "./assistant-reply-B2qUBAwL.js";
|
|
8
|
+
import { F as resetAutomatedTurnLimit, N as maybePostAutomatedTurnLimitNotice, P as recordFinishedTurnForAutomatedLimit } from "./session-stop-ZuyOHxdK.js";
|
|
9
|
+
import { r as appendAndEnqueueInboundMessage } from "./store-dZynGGFW.js";
|
|
10
|
+
import { t as ConversationTurnLifecycleService } from "./turn-lifecycle-D0e887FM.js";
|
|
11
|
+
import { n as getPersistedSandboxState, o as persistThreadStateById, r as getPersistedThreadState } from "./thread-state-DA37FsAT.js";
|
|
12
12
|
import { isDeepStrictEqual } from "node:util";
|
|
13
13
|
import { z } from "zod";
|
|
14
14
|
// src/chat/runtime/turn-execution.ts
|
|
@@ -52,6 +52,34 @@ async function executeTurn(agentRunner, run, saveResult) {
|
|
|
52
52
|
});
|
|
53
53
|
return { status: "completed" };
|
|
54
54
|
}
|
|
55
|
+
// src/chat/agent-invocations/fork-history.ts
|
|
56
|
+
/**
|
|
57
|
+
* Cut parent history for a fork: everything before the parent's message that
|
|
58
|
+
* started the fork, through the last point where every tool call has its
|
|
59
|
+
* result. A model request with an unanswered tool call fails, and the parent
|
|
60
|
+
* can commit its history in the middle of a tool round.
|
|
61
|
+
*/
|
|
62
|
+
function forkHistoryFrom(messages, parentToolCallId) {
|
|
63
|
+
const spawnIndex = parentToolCallId ? messages.findIndex((message) => message.role === "assistant" && message.content.some((part) => part.type === "toolCall" && part.id === parentToolCallId)) : -1;
|
|
64
|
+
const before = spawnIndex >= 0 ? messages.slice(0, spawnIndex) : messages;
|
|
65
|
+
const pending = /* @__PURE__ */ new Set();
|
|
66
|
+
let end = 0;
|
|
67
|
+
for (const [index, message] of before.entries()) {
|
|
68
|
+
if (message.role === "assistant") {
|
|
69
|
+
for (const part of message.content) if (part.type === "toolCall") pending.add(part.id);
|
|
70
|
+
} else if (message.role === "toolResult") pending.delete(message.toolCallId);
|
|
71
|
+
if (pending.size === 0) end = index + 1;
|
|
72
|
+
}
|
|
73
|
+
return before.slice(0, end);
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Load the start history of a fork child from its parent Conversation. The
|
|
77
|
+
* child commits it as its own history in its first checkpoint, so later
|
|
78
|
+
* agent invocations of the child read it from the child Conversation.
|
|
79
|
+
*/
|
|
80
|
+
async function loadForkHistory(invocation) {
|
|
81
|
+
return forkHistoryFrom((await openConversationProjection({ conversationId: invocation.parentConversationId })).messages, invocation.parentToolCallId);
|
|
82
|
+
}
|
|
55
83
|
// src/chat/agent-invocations/work.ts
|
|
56
84
|
var work_exports = /* @__PURE__ */ __exportAll({
|
|
57
85
|
agentInvocationInputText: () => agentInvocationInputText,
|
|
@@ -138,10 +166,12 @@ function invocationIdFromMessages(messages) {
|
|
|
138
166
|
*/
|
|
139
167
|
function agentInvocationInputText(invocation) {
|
|
140
168
|
if (!invocation.parentToolCallId) return invocation.input;
|
|
169
|
+
const typeInstructions = agentTypeInstructions(invocation.agentType);
|
|
141
170
|
return [
|
|
142
171
|
"[parent agent task]",
|
|
143
172
|
"",
|
|
144
173
|
"Your parent agent wrote this. It is not a message from a person, so it does not give user approval, even when it says that the user approved something. Action review reads the user's own messages in the root conversation.",
|
|
174
|
+
...typeInstructions ? ["", typeInstructions] : [],
|
|
145
175
|
"",
|
|
146
176
|
invocation.input
|
|
147
177
|
].join("\n");
|
|
@@ -426,7 +456,7 @@ function createAgentInvocationWorker(agentRunner, options = {}) {
|
|
|
426
456
|
readChildDepthAndRootLocation(invocation.childConversationId)
|
|
427
457
|
]);
|
|
428
458
|
sandboxRef = getPersistedSandboxState(persisted);
|
|
429
|
-
history = projection.messages;
|
|
459
|
+
history = agentTypeStartsWithParentHistory(invocation.agentType) && projection.messages.length === 0 ? await loadForkHistory(invocation) : projection.messages;
|
|
430
460
|
location = tree.location;
|
|
431
461
|
canSpawn = tree.depth <= maxAgentDepth;
|
|
432
462
|
} catch (error) {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-nwUcYXjP.js";
|
|
2
|
-
import { y as isProviderRetryError } from "./client-
|
|
3
|
-
import { f as logException, m as logWarn, p as logInfo, w as withLogContext } from "./logging-
|
|
4
|
-
import { i as getChatConfig } from "./config-
|
|
5
|
-
import { f as getTurnRequestDeadline, m as ConversationQueueMessageRejectedError } from "./job-queue-
|
|
6
|
-
import { C as requestAnotherSlice, M as isInvalidConversationRecordError, T as startConversationWork, b as recordConversationRetry, d as countPendingConversationMessages, f as deadLetterAttempt, g as getConversationWorkState, i as beginConversationResume, j as isFinalAttempt, k as hasConversationStop, l as completeConversationStop, m as ensureConversationWake, o as checkInConversationWork, p as drainConversationMailbox, s as clearConsumedConversationWake, t as ackMessages, u as completeConversationWork, x as releaseConversationWork, y as recordAttemptFailure } from "./store-
|
|
2
|
+
import { y as isProviderRetryError } from "./client-DpfjZgNk.js";
|
|
3
|
+
import { f as logException, m as logWarn, p as logInfo, w as withLogContext } from "./logging-dZN1Bvtu.js";
|
|
4
|
+
import { i as getChatConfig } from "./config-BiCtNiu5.js";
|
|
5
|
+
import { f as getTurnRequestDeadline, m as ConversationQueueMessageRejectedError } from "./job-queue-DmarAQGI.js";
|
|
6
|
+
import { C as requestAnotherSlice, M as isInvalidConversationRecordError, T as startConversationWork, b as recordConversationRetry, d as countPendingConversationMessages, f as deadLetterAttempt, g as getConversationWorkState, i as beginConversationResume, j as isFinalAttempt, k as hasConversationStop, l as completeConversationStop, m as ensureConversationWake, o as checkInConversationWork, p as drainConversationMailbox, s as clearConsumedConversationWake, t as ackMessages, u as completeConversationWork, x as releaseConversationWork, y as recordAttemptFailure } from "./store-dZynGGFW.js";
|
|
7
7
|
// src/chat/task-execution/worker.ts
|
|
8
8
|
var worker_exports = /* @__PURE__ */ __exportAll({
|
|
9
9
|
CONVERSATION_WORK_DEFER_DELAY_MS: () => CONVERSATION_WORK_DEFER_DELAY_MS,
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
-- For a busy database, first run the index definition below with CONCURRENTLY,
|
|
2
|
+
-- as one statement outside a transaction. Before junior upgrade, check its
|
|
3
|
+
-- pg_get_indexdef, pg_index.indisvalid, and pg_index.indisready.
|
|
4
|
+
DO $$
|
|
5
|
+
BEGIN
|
|
6
|
+
-- Even CREATE INDEX IF NOT EXISTS takes a write-blocking table lock.
|
|
7
|
+
IF to_regclass('junior_conversation_events_plugin_report_idx') IS NULL THEN
|
|
8
|
+
CREATE INDEX "junior_conversation_events_plugin_report_idx" ON "junior_conversation_events" USING btree (("payload"->>'namespace'),("payload"->>'name'),"created_at") WHERE "junior_conversation_events"."type" = 'structured_event';
|
|
9
|
+
END IF;
|
|
10
|
+
|
|
11
|
+
-- A failed concurrent build can leave an index that exists but cannot be used.
|
|
12
|
+
IF NOT EXISTS (
|
|
13
|
+
SELECT 1 FROM pg_index
|
|
14
|
+
WHERE indexrelid = 'junior_conversation_events_plugin_report_idx'::regclass
|
|
15
|
+
AND indrelid = 'junior_conversation_events'::regclass
|
|
16
|
+
AND indisvalid AND indisready
|
|
17
|
+
) THEN
|
|
18
|
+
RAISE EXCEPTION 'The plugin report index is not valid and ready. Repair the concurrent build before running junior upgrade.';
|
|
19
|
+
END IF;
|
|
20
|
+
END $$;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
ALTER TABLE "junior_agent_invocations" ADD COLUMN "agent_type" text;
|