@sentry/junior 0.243.0 → 0.245.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/{admin-DHOGoI03.js → admin-BEbNsG87.js} +1 -1
- package/dist/{agent-hooks-Cqo6ULp6.js → agent-hooks-Caa0Qh_Q.js} +22 -12
- package/dist/{agent-invocations-BzRAZ_nj.js → agent-invocations-BO6ddZax.js} +1 -0
- package/dist/{agent-runner-BZOjoMlZ.js → agent-runner-BEuPFbbv.js} +199 -57
- package/dist/api/schema.d.ts +78 -3
- package/dist/api/schema.js +3 -3
- package/dist/api.js +316 -246
- package/dist/{app-DRLh-8zs.d.ts → app-BYB7szGb.d.ts} +2 -0
- package/dist/app.d.ts +1 -1
- package/dist/app.js +172 -105
- package/dist/{briefs-C4GogKaB.js → briefs-DFAh_jTW.js} +4 -4
- package/dist/{catalog-runtime-jazDa-oO.js → catalog-runtime-wmq_fqff.js} +1 -1
- package/dist/cli/chat.js +12 -12
- package/dist/cli/check.js +3 -3
- package/dist/cli/main.js +2 -2
- package/dist/cli/plugins.js +4 -4
- package/dist/cli/snapshot-create.js +3 -3
- package/dist/cli/upgrade.js +3 -3
- package/dist/{client-Es79bknZ.js → client-Bn9SRFCi.js} +2 -2
- package/dist/{config-gype19qQ.js → config-_XAINZMN.js} +11 -2
- package/dist/{conversation-mt3yJ09u.js → conversation-CvBG57Io.js} +15 -2
- package/dist/{conversation-privacy-BIplVfmz.js → conversation-privacy-BN5SGxsF.js} +1 -1
- package/dist/{credential-sync-BY97dkST.js → credential-sync-BvaUm6HQ.js} +14 -14
- package/dist/{executor-C7bsEF-c.js → executor-CFIqoCNJ.js} +3 -3
- package/dist/{history-DlsoHsoe.js → history-Nte1oVed.js} +3 -0
- package/dist/{images-WmrEAtto.js → images-Ci43I3ek.js} +3 -3
- package/dist/instrumentation.js +2 -2
- package/dist/{job-queue-DQDesz8a.js → job-queue-CGicV7x6.js} +1 -1
- package/dist/{logging-CdZ1LQJ7.js → logging-Bs3dV81s.js} +1 -1
- package/dist/nitro.d.ts +1 -1
- package/dist/nitro.js +3 -3
- package/dist/{oauth-authorization-Di0KlyoJ.js → oauth-authorization-COzWmMjO.js} +1 -1
- package/dist/{oauth-callback-server-Cmog7Q3T.js → oauth-callback-server-17c9_39v.js} +2 -2
- package/dist/{pending-auth-CNAlGOyl.js → pending-auth-Bnhg7Q9k.js} +2 -2
- package/dist/{profile-qqt_2di0.js → profile-BA471c-l.js} +4 -4
- package/dist/{prompt-D_cg2iqi.js → prompt-C9Q9cjD3.js} +1 -1
- package/dist/{registry-WOJKAIRI.js → registry-BYNOFO6e.js} +1 -1
- package/dist/{resolve-C8VvY0lg.js → resolve-rpz8No2i.js} +2 -2
- package/dist/{runner-DojxjGmt.js → runner-C8DRk9X6.js} +10 -10
- package/dist/{sandbox-egress-signals-B7azPnsm.js → sandbox-egress-signals-B8hurjFt.js} +1 -1
- package/dist/{schema-nQRsPWSr.js → schema-WRgR9EL6.js} +11 -6
- package/dist/{skills-Zj-9pbSU.js → skills-C4yrD2NR.js} +2 -2
- package/dist/{spawn-DDJ5z9IC.js → spawn-CdAaTXrY.js} +4 -3
- package/dist/{task-queue-CAi-XM8x.js → task-queue-BBxHzlIB.js} +3 -3
- package/dist/{task-runner-CIP2asjP.js → task-runner-BqFapTjs.js} +12 -12
- package/dist/{tasks-Qx6Fos_R.js → tasks-Ddd7OAkp.js} +83 -12
- package/dist/{thread-state-BN_5S1bx.js → thread-state-DqErwbA8.js} +7 -7
- package/dist/{turn-failure-response-B1UW2T7a.js → turn-failure-response-DtL1-fOl.js} +9 -9
- package/dist/{turn-lifecycle-BzeE4sVD.js → turn-lifecycle-B5pzyD6W.js} +1 -1
- package/dist/{turn-session-routing-DsvU39zW.js → turn-session-routing-D6pTU5uF.js} +1 -1
- package/dist/{validation-Dklx_nds.js → validation-BAzlyNIc.js} +1 -1
- package/dist/{version-BvG02ZTN.js → version-CiXDH3oe.js} +1 -1
- package/dist/version.js +1 -1
- package/dist/{viewer-B7qDM2DM.js → viewer-wCn8xneI.js} +5 -5
- package/dist/{web-authorization-Cqv7bP19.js → web-authorization-d5MtGpfG.js} +6 -6
- package/dist/{web-input-CqnqSfzI.js → web-input-BZTiCtvP.js} +71 -48
- package/dist/{work-D_BBvd4I.js → work-4QPqTd5_.js} +6 -6
- package/dist/{worker-BWdV_5Ys.js → worker-mc62tybz.js} +5 -5
- package/migrations/0052_agent_invocation_title.sql +1 -0
- package/migrations/meta/0052_snapshot.json +3765 -0
- package/migrations/meta/_journal.json +7 -0
- package/package.json +5 -5
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as setUserAdminFromSql, d as getDb, n as listAdminUsersFromSql } from "./viewer-
|
|
1
|
+
import { a as setUserAdminFromSql, d as getDb, n as listAdminUsersFromSql } from "./viewer-wCn8xneI.js";
|
|
2
2
|
import { CLI_USAGE } from "./cli/run.js";
|
|
3
3
|
//#region src/cli/admin.ts
|
|
4
4
|
/**
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-B4FMCO8f.js";
|
|
2
|
-
import { a as embedTexts, r as completeObject } from "./client-
|
|
3
|
-
import { I as isRecord$1, a as extractGenAiUsageSummary, d as logException, f as logInfo, p as logWarn, v as setSpanAttributes, w as withSpan, y as setSpanStatus } from "./logging-
|
|
2
|
+
import { a as embedTexts, r as completeObject } from "./client-Bn9SRFCi.js";
|
|
3
|
+
import { I as isRecord$1, a as extractGenAiUsageSummary, d as logException, f as logInfo, p as logWarn, v as setSpanAttributes, w as withSpan, y as setSpanStatus } from "./logging-Bs3dV81s.js";
|
|
4
4
|
import { a as getClient$1 } from "./sentry-CgWZM_kV.js";
|
|
5
|
-
import { t as canExposeConversationPayload } from "./conversation-privacy-
|
|
6
|
-
import { i as getChatConfig, n as botConfig, o as getSlackBotToken } from "./config-
|
|
5
|
+
import { t as canExposeConversationPayload } from "./conversation-privacy-BN5SGxsF.js";
|
|
6
|
+
import { i as getChatConfig, n as botConfig, o as getSlackBotToken } from "./config-_XAINZMN.js";
|
|
7
7
|
import { r as defaultModelId } from "./model-profile-BwU8mqwD.js";
|
|
8
8
|
import { d as parseSlackTeamId, g as parseSlackMessageTs, i as isActorUserId, o as parseActorUserId, u as parseSlackChannelReferenceId } from "./actor-BTtLaeWy.js";
|
|
9
|
-
import { O as readUserTimezone, T as hasAgentTurnUsage, c as getConversationEventStore, d as getDb, f as getSqlExecutor, h as createSqlStore, i as resolveViewerUser, k as saveUserTimezone, r as readActorIdentity } from "./viewer-
|
|
10
|
-
import { c as juniorIdentities, d as juniorDestinations, l as juniorUsers, s as juniorConversations } from "./agent-invocations-
|
|
11
|
-
import { S as juniorAttachments, _ as juniorConversationEvents, b as juniorCodeChanges, f as juniorConversationParticipants, i as juniorWorkspaces, m as juniorConversationBriefs, n as juniorSnapshots, r as juniorWorkspaceRepos, x as juniorCodeRepositories, y as juniorConversationAnnotations } from "./executor-
|
|
12
|
-
import { o as decodeStoredConversationEvent } from "./history-
|
|
13
|
-
import { p as credentialSubjectSchema } from "./registry-
|
|
14
|
-
import { B as
|
|
15
|
-
import { C as getDefaultRedisStateAdapterFor, N as SANDBOX_WORKSPACE_ROOT, k as sleep$1, l as isSandboxMissingError, n as hash, v as getVercelSandboxCredentials, w as getStateAdapter, x as runNonInteractiveCommand } from "./profile-
|
|
9
|
+
import { O as readUserTimezone, T as hasAgentTurnUsage, c as getConversationEventStore, d as getDb, f as getSqlExecutor, h as createSqlStore, i as resolveViewerUser, k as saveUserTimezone, r as readActorIdentity } from "./viewer-wCn8xneI.js";
|
|
10
|
+
import { c as juniorIdentities, d as juniorDestinations, l as juniorUsers, s as juniorConversations } from "./agent-invocations-BO6ddZax.js";
|
|
11
|
+
import { S as juniorAttachments, _ as juniorConversationEvents, b as juniorCodeChanges, f as juniorConversationParticipants, i as juniorWorkspaces, m as juniorConversationBriefs, n as juniorSnapshots, r as juniorWorkspaceRepos, x as juniorCodeRepositories, y as juniorConversationAnnotations } from "./executor-CFIqoCNJ.js";
|
|
12
|
+
import { o as decodeStoredConversationEvent } from "./history-Nte1oVed.js";
|
|
13
|
+
import { p as credentialSubjectSchema } from "./registry-BYNOFO6e.js";
|
|
14
|
+
import { B as conversationBriefSchema, C as conversationReportEventSchema, G as readMessageCardRefs, P as readMessageAttachments, V as parseBriefInput } from "./conversation-CvBG57Io.js";
|
|
15
|
+
import { C as getDefaultRedisStateAdapterFor, N as SANDBOX_WORKSPACE_ROOT, k as sleep$1, l as isSandboxMissingError, n as hash, v as getVercelSandboxCredentials, w as getStateAdapter, x as runNonInteractiveCommand } from "./profile-BA471c-l.js";
|
|
16
16
|
import { i as isValidTimeZone } from "./cadence-D00SCzT1.js";
|
|
17
|
-
import { n as briefEntriesFromReportEvents, s as generateBrief, t as BRIEF_PROMPT } from "./prompt-
|
|
17
|
+
import { n as briefEntriesFromReportEvents, s as generateBrief, t as BRIEF_PROMPT } from "./prompt-C9Q9cjD3.js";
|
|
18
18
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
19
19
|
import { z } from "zod";
|
|
20
20
|
import { createHash, createHmac, randomUUID, timingSafeEqual } from "node:crypto";
|
|
@@ -1178,6 +1178,14 @@ function reportEventData(args) {
|
|
|
1178
1178
|
default: return;
|
|
1179
1179
|
}
|
|
1180
1180
|
}
|
|
1181
|
+
function reportSubagentLabel(data, canExposePayload) {
|
|
1182
|
+
if (!canExposePayload) return {};
|
|
1183
|
+
return {
|
|
1184
|
+
...data.agentName ? { agentName: data.agentName } : void 0,
|
|
1185
|
+
...data.task ? { task: data.task } : void 0,
|
|
1186
|
+
...data.title ? { title: data.title } : void 0
|
|
1187
|
+
};
|
|
1188
|
+
}
|
|
1181
1189
|
/**
|
|
1182
1190
|
* Project canonical events into the ordered reporting boundary.
|
|
1183
1191
|
*
|
|
@@ -1254,6 +1262,7 @@ function projectConversationReportEventPage(args) {
|
|
|
1254
1262
|
startedAt: new Date(event.createdAtMs).toISOString(),
|
|
1255
1263
|
childConversationId: event.data.childConversationId,
|
|
1256
1264
|
subagentKind: event.data.subagentKind,
|
|
1265
|
+
...reportSubagentLabel(event.data, args.canExposePayload),
|
|
1257
1266
|
status: "running",
|
|
1258
1267
|
...event.data.parentToolCallId ? { parentToolCallId: event.data.parentToolCallId } : void 0
|
|
1259
1268
|
};
|
|
@@ -1266,6 +1275,7 @@ function projectConversationReportEventPage(args) {
|
|
|
1266
1275
|
startedAt: new Date(started.createdAtMs).toISOString(),
|
|
1267
1276
|
childConversationId: started.data.childConversationId,
|
|
1268
1277
|
subagentKind: started.data.subagentKind,
|
|
1278
|
+
...reportSubagentLabel(started.data, args.canExposePayload),
|
|
1269
1279
|
...started.data.parentToolCallId ? { parentToolCallId: started.data.parentToolCallId } : void 0,
|
|
1270
1280
|
status: event.data.outcome === "success" ? "completed" : event.data.outcome
|
|
1271
1281
|
};
|
|
@@ -152,6 +152,7 @@ const juniorAgentInvocations = pgTable("junior_agent_invocations", {
|
|
|
152
152
|
childConversationId: text("child_conversation_id").notNull().references(() => juniorConversations.conversationId),
|
|
153
153
|
agentName: text("agent_name"),
|
|
154
154
|
input: text("input").notNull(),
|
|
155
|
+
title: text("title"),
|
|
155
156
|
actor: jsonb("actor_json").$type().notNull(),
|
|
156
157
|
credentialContext: jsonb("credential_context_json").$type(),
|
|
157
158
|
source: jsonb("source_json").$type().notNull(),
|
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
import { b as getGatewayApiKey, c as hasCompactedConversationContext, d as unwrapCurrentInstruction, f as escapeXml, g as getProviderErrorAttributes, h as findProviderError, i as completeText, l as isCompactionSummaryText, m as createProviderError, n as GEN_AI_SERVER_ADDRESS, o as resolveGatewayModel, p as ProviderError, r as completeObject, s as COMPACTION_SUMMARY_PREFIX, t as GEN_AI_PROVIDER_NAME, u as renderCurrentInstruction, v as isProviderRetryError, x as resolveGatewayCredential, y as MISSING_GATEWAY_CREDENTIALS_ERROR } from "./client-
|
|
2
|
-
import { C as withLogContext, F as normalizeIdentityEmail, I as isRecord$3, L as toOptionalNumber, R as toOptionalString, a as extractGenAiUsageSummary, b as setTags, c as getLogContextAttributesForSpan, d as logException, f as logInfo, g as serializeGenAiAttribute, i as extractGenAiUsageAttributes, l as getTracePropagationHeaders, m as normalizeGenAiFinishReason, p as logWarn, u as logError, v as setSpanAttributes, w as withSpan, x as summarizeMessageText, y as setSpanStatus } from "./logging-
|
|
1
|
+
import { b as getGatewayApiKey, c as hasCompactedConversationContext, d as unwrapCurrentInstruction, f as escapeXml, g as getProviderErrorAttributes, h as findProviderError, i as completeText, l as isCompactionSummaryText, m as createProviderError, n as GEN_AI_SERVER_ADDRESS, o as resolveGatewayModel, p as ProviderError, r as completeObject, s as COMPACTION_SUMMARY_PREFIX, t as GEN_AI_PROVIDER_NAME, u as renderCurrentInstruction, v as isProviderRetryError, x as resolveGatewayCredential, y as MISSING_GATEWAY_CREDENTIALS_ERROR } from "./client-Bn9SRFCi.js";
|
|
2
|
+
import { C as withLogContext, F as normalizeIdentityEmail, I as isRecord$3, L as toOptionalNumber, R as toOptionalString, a as extractGenAiUsageSummary, b as setTags, c as getLogContextAttributesForSpan, d as logException, f as logInfo, g as serializeGenAiAttribute, i as extractGenAiUsageAttributes, l as getTracePropagationHeaders, m as normalizeGenAiFinishReason, p as logWarn, u as logError, v as setSpanAttributes, w as withSpan, x as summarizeMessageText, y as setSpanStatus } from "./logging-Bs3dV81s.js";
|
|
3
3
|
import { m as startInactiveSpan, v as withActiveSpan } from "./sentry-CgWZM_kV.js";
|
|
4
|
-
import { a as toCanonicalInputMessage, c as toGenAiPayloadMetadata, i as runWithConversationPrivacy, l as toGenAiPayloadTraceAttributes, o as toCanonicalOutputMessage, r as resolveConversationPrivacy, s as toGenAiMessagesTraceAttributes, t as canExposeConversationPayload } from "./conversation-privacy-
|
|
5
|
-
import { i as getChatConfig, n as botConfig, v as normalizeSlackEmojiName } from "./config-
|
|
4
|
+
import { a as toCanonicalInputMessage, c as toGenAiPayloadMetadata, i as runWithConversationPrivacy, l as toGenAiPayloadTraceAttributes, o as toCanonicalOutputMessage, r as resolveConversationPrivacy, s as toGenAiMessagesTraceAttributes, t as canExposeConversationPayload } from "./conversation-privacy-BN5SGxsF.js";
|
|
5
|
+
import { i as getChatConfig, n as botConfig, v as normalizeSlackEmojiName } from "./config-_XAINZMN.js";
|
|
6
6
|
import { a as formatModelProfiles, c as profileConfig, i as formatModelProfile, l as TURN_REASONING_LEVELS, n as ModelProfileNotConfiguredError, o as modelIdForProfile, s as modelProfileSchema } from "./model-profile-BwU8mqwD.js";
|
|
7
7
|
import { a as isUserActor, d as parseSlackTeamId, f as parseSlackUserId, g as parseSlackMessageTs, l as parseSlackChannelId, s as parseStoredSlackActor, u as parseSlackChannelReferenceId } from "./actor-BTtLaeWy.js";
|
|
8
|
-
import { F as sameDestination$1, N as parseDestination, T as hasAgentTurnUsage, c as getConversationEventStore, d as getDb, f as getSqlExecutor, l as getConversationMessageSearchStore, r as readActorIdentity, u as getConversationStore, x as addAgentTurnUsage } from "./viewer-
|
|
9
|
-
import { a as juniorAgentInvocations, c as juniorIdentities, d as juniorDestinations, i as juniorAgentBindings, n as AGENT_INVOCATION_PARENT_MAILBOX_STATUSES, r as AGENT_INVOCATION_STATUSES, s as juniorConversations, t as AGENT_INVOCATION_MAILBOX_STATUSES } from "./agent-invocations-
|
|
10
|
-
import { C as juniorArtifacts, S as juniorAttachments, a as juniorSchedulerRuns, l as juniorStats, m as juniorConversationBriefs, y as juniorConversationAnnotations } from "./executor-
|
|
11
|
-
import { d as instructionActors, f as instructionProvenanceFor, p as sameActorIdentity, t as KNOWN_CONVERSATION_EVENT_TYPES, u as contextProvenance } from "./history-
|
|
8
|
+
import { F as sameDestination$1, N as parseDestination, T as hasAgentTurnUsage, c as getConversationEventStore, d as getDb, f as getSqlExecutor, l as getConversationMessageSearchStore, r as readActorIdentity, u as getConversationStore, x as addAgentTurnUsage } from "./viewer-wCn8xneI.js";
|
|
9
|
+
import { a as juniorAgentInvocations, c as juniorIdentities, d as juniorDestinations, i as juniorAgentBindings, n as AGENT_INVOCATION_PARENT_MAILBOX_STATUSES, r as AGENT_INVOCATION_STATUSES, s as juniorConversations, t as AGENT_INVOCATION_MAILBOX_STATUSES } from "./agent-invocations-BO6ddZax.js";
|
|
10
|
+
import { C as juniorArtifacts, S as juniorAttachments, a as juniorSchedulerRuns, l as juniorStats, m as juniorConversationBriefs, y as juniorConversationAnnotations } from "./executor-CFIqoCNJ.js";
|
|
11
|
+
import { d as instructionActors, f as instructionProvenanceFor, p as sameActorIdentity, t as KNOWN_CONVERSATION_EVENT_TYPES, u as contextProvenance } from "./history-Nte1oVed.js";
|
|
12
12
|
import { a as listReferenceFiles, c as soulPathCandidates, l as worldPathCandidates } from "./package-discovery-BVvSnQBB.js";
|
|
13
|
-
import { a as resolveAuthTokenPlaceholder, c as fetchWithBoundedOAuthErrorBodies, d as credentialContextForActor, f as credentialContextSchema, h as CredentialUnavailableError, i as resolvePluginHeaderEnvRefs, l as getOAuthProviderErrorAttributes, m as credentialUserSubjectId, o as resolvePluginCommandEnv, p as credentialSubjectSchema, s as OAuthProviderError } from "./registry-
|
|
14
|
-
import { n as pluginCatalogRuntime } from "./catalog-runtime-
|
|
15
|
-
import { a as parseSkillInvocation, i as parseSkillFile, n as findSkillByName, r as loadSkillsByName, t as discoverSkills } from "./skills-
|
|
16
|
-
import {
|
|
17
|
-
import { A as getWorkspaceSnapshotBuilder, B as cancelWatch, Bt as isConversationScopedChannel, C as WorkspaceValidationError, D as setWorkspaceSnapshotBuild, E as setWorkspaceSnapshot, F as RESOURCE_SUBSCRIPTION_DEFAULT_TTL_MS, Ft as SlackActionError, G as findMatchingWatches, H as createTimerWatch, Ht as normalizeSlackConversationId, I as RESOURCE_SUBSCRIPTION_MAX_TTL_MS, It as downloadPrivateSlackFile, K as listWatches, L as RESOURCE_WATCH_TOOL_SOURCE, Lt as getFilePermalink, M as workspaceRepoCheckoutPath, Mt as defaultTimezone, N as resolveChannelCapabilities, Nt as resolveUserTimezone, O as SANDBOX_RUNTIME, Ot as saveObjectAnnotations, P as getSlackToolContext, R as STOP_WATCHING_TOOL_NAME, S as updateWorkspace, T as loadSnapshotsForProfile, U as createWatch, Vt as isDmChannel$1, W as deliverWatch, Wt as withSlackRetries, _ as deleteWorkspace, b as listWorkspaces, c as getPluginTools, et as verifyTimerWatchCredentialSubject, g as createWorkspace, it as getDashboardTaskLink, j as tryWorkspaceRepoCheckoutPath, k as deleteWorkspaceSnapshotBuilders, kt as createPluginAnnotations, l as getPluginUserPromptContributions, lt as createPluginLogger, nt as getDashboardConversationLink, r as createPluginHookRunner, s as getPluginSystemPromptContributions, tt as JUNIOR_THREAD_STATE_TTL_MS, u as getPlugins, v as getWorkspace, w as invalidateReadySnapshot, wt as matchSlackAttachments, y as getWorkspaceByName, z as cancelSubscriptions, zt as getSlackClient } from "./agent-hooks-
|
|
18
|
-
import {
|
|
19
|
-
import { A as SANDBOX_DATA_ROOT, C as getDefaultRedisStateAdapterFor, D as fenceLock, E as acquireActiveLock, F as sandboxSkillFile, I as sandboxSkillPathResolution, M as SANDBOX_SKILLS_ROOT, N as SANDBOX_WORKSPACE_ROOT, O as withLock, P as sandboxSkillDir, _ as workspaceSnapshotNotReadyUserMessage, a as isAbortError, b as buildNonInteractiveShellScript, c as isSandboxCommandStreamInterruptedError, d as isSnapshottingError, f as throwSandboxOperationError, g as isWorkspaceSnapshotNotReadyError, h as getWorkspaceSnapshotNotReadyError, i as ensureDockerDaemon, j as SANDBOX_REPOS_ROOT, k as sleep$2, l as isSandboxMissingError, m as WorkspaceSnapshotNotReadyError, n as hash, o as isAlreadyExistsError, p as wrapSandboxSetupError, r as isStale, s as isSandboxApiTransientError, t as create, u as isSandboxUnavailableError, v as getVercelSandboxCredentials, w as getStateAdapter, x as runNonInteractiveCommand, y as buildCommandScript } from "./profile-
|
|
20
|
-
import { n as canReusePendingAuthLink, t as abandonReplacedPendingAuth } from "./pending-auth-
|
|
21
|
-
import { a as NO_REPLY_MARKER, c as CooperativeTurnYieldError, i as sanitizeAssistantText, l as TurnInputCommitLostError, n as decideReply, o as isNoReplyMarker, p as isTurnInputCommitLostError, r as getAssistantReplyText, t as authorizationId } from "./oauth-authorization-
|
|
13
|
+
import { a as resolveAuthTokenPlaceholder, c as fetchWithBoundedOAuthErrorBodies, d as credentialContextForActor, f as credentialContextSchema, h as CredentialUnavailableError, i as resolvePluginHeaderEnvRefs, l as getOAuthProviderErrorAttributes, m as credentialUserSubjectId, o as resolvePluginCommandEnv, p as credentialSubjectSchema, s as OAuthProviderError } from "./registry-BYNOFO6e.js";
|
|
14
|
+
import { n as pluginCatalogRuntime } from "./catalog-runtime-wmq_fqff.js";
|
|
15
|
+
import { a as parseSkillInvocation, i as parseSkillFile, n as findSkillByName, r as loadSkillsByName, t as discoverSkills } from "./skills-C4yrD2NR.js";
|
|
16
|
+
import { At as openConversationProjection, B as postSlackEphemeralMessage, Bt as recordTurnRoute, Et as loadLastModelProfile, F as slackMention, Ft as recordAuthorizationRequested, It as recordGuardianActionReviewed, J as saveTurnCheckpoint, Jt as fallbackShortTitle, K as continuableMessages, L as addReactionToMessage, Lt as recordMcpProviderConnected, M as formatSlackLink, Mt as recordAttachmentsDelivered, R as getSlackMessagePermalink, Tt as loadConversationProjection, U as uploadFilesToConversation, V as postSlackMessage, Yt as resolveTaskTitle, _t as retainRuntimeTurnContext, a as readScheduledAutomation, at as isTurnExecutionLimitExceededError, b as saveEventAutomation, bt as TURN_CONTEXT_TAG, cn as getAgentContextCompactionTriggerTokens, ct as getTerminalAssistantMessages, dn as piMessageFromHistoryItem, f as createEventAutomation, ft as isAssistantMessage, g as getEventAutomation, gt as normalizeToolNameFromResult, ht as isToolResultMessage, j as escapeSlackMrkdwnText, jt as recordAgentsInstructionsUpdated, k as automationRevision, kt as loadTurnRoute, ln as getAgentContextInputLimitTokens, lt as getUserMessageInstructionText, mt as isToolResultError, nt as TurnSliceLimitExceededError, o as saveScheduledAutomation, ot as extractAssistantText, p as deleteEventAutomation, pt as isContinuablePiBoundary, q as loadTurnCheckpoint, r as listScheduledAutomationsForTeam, rt as assertTurnToolCallLimit, sn as estimateTextTokens, st as getPiMessageRole, t as createScheduledAutomation, un as historyItemFromPiMessage, ut as hasRuntimeTurnContext, v as listEventAutomationsForTeam, vt as stripRuntimeTurnContext, wt as loadConnectedMcpProviders, x as setEventAutomationStatus, xt as ToolInputError, yt as trimTrailingAssistantMessages, z as openSlackDirectMessage, zt as recordToolExecutionStarted } from "./tasks-Ddd7OAkp.js";
|
|
17
|
+
import { A as getWorkspaceSnapshotBuilder, B as cancelWatch, Bt as isConversationScopedChannel, C as WorkspaceValidationError, D as setWorkspaceSnapshotBuild, E as setWorkspaceSnapshot, F as RESOURCE_SUBSCRIPTION_DEFAULT_TTL_MS, Ft as SlackActionError, G as findMatchingWatches, H as createTimerWatch, Ht as normalizeSlackConversationId, I as RESOURCE_SUBSCRIPTION_MAX_TTL_MS, It as downloadPrivateSlackFile, K as listWatches, L as RESOURCE_WATCH_TOOL_SOURCE, Lt as getFilePermalink, M as workspaceRepoCheckoutPath, Mt as defaultTimezone, N as resolveChannelCapabilities, Nt as resolveUserTimezone, O as SANDBOX_RUNTIME, Ot as saveObjectAnnotations, P as getSlackToolContext, R as STOP_WATCHING_TOOL_NAME, S as updateWorkspace, T as loadSnapshotsForProfile, U as createWatch, Vt as isDmChannel$1, W as deliverWatch, Wt as withSlackRetries, _ as deleteWorkspace, b as listWorkspaces, c as getPluginTools, et as verifyTimerWatchCredentialSubject, g as createWorkspace, it as getDashboardTaskLink, j as tryWorkspaceRepoCheckoutPath, k as deleteWorkspaceSnapshotBuilders, kt as createPluginAnnotations, l as getPluginUserPromptContributions, lt as createPluginLogger, nt as getDashboardConversationLink, r as createPluginHookRunner, s as getPluginSystemPromptContributions, tt as JUNIOR_THREAD_STATE_TTL_MS, u as getPlugins, v as getWorkspace, w as invalidateReadySnapshot, wt as matchSlackAttachments, y as getWorkspaceByName, z as cancelSubscriptions, zt as getSlackClient } from "./agent-hooks-Caa0Qh_Q.js";
|
|
18
|
+
import { B as conversationBriefSchema, I as isVisionImageMediaType, K as removedCardSchema, R as briefLinkSchema, z as briefOutcomeStatusSchema } from "./conversation-CvBG57Io.js";
|
|
19
|
+
import { A as SANDBOX_DATA_ROOT, C as getDefaultRedisStateAdapterFor, D as fenceLock, E as acquireActiveLock, F as sandboxSkillFile, I as sandboxSkillPathResolution, M as SANDBOX_SKILLS_ROOT, N as SANDBOX_WORKSPACE_ROOT, O as withLock, P as sandboxSkillDir, _ as workspaceSnapshotNotReadyUserMessage, a as isAbortError, b as buildNonInteractiveShellScript, c as isSandboxCommandStreamInterruptedError, d as isSnapshottingError, f as throwSandboxOperationError, g as isWorkspaceSnapshotNotReadyError, h as getWorkspaceSnapshotNotReadyError, i as ensureDockerDaemon, j as SANDBOX_REPOS_ROOT, k as sleep$2, l as isSandboxMissingError, m as WorkspaceSnapshotNotReadyError, n as hash, o as isAlreadyExistsError, p as wrapSandboxSetupError, r as isStale, s as isSandboxApiTransientError, t as create, u as isSandboxUnavailableError, v as getVercelSandboxCredentials, w as getStateAdapter, x as runNonInteractiveCommand, y as buildCommandScript } from "./profile-BA471c-l.js";
|
|
20
|
+
import { n as canReusePendingAuthLink, t as abandonReplacedPendingAuth } from "./pending-auth-Bnhg7Q9k.js";
|
|
21
|
+
import { a as NO_REPLY_MARKER, c as CooperativeTurnYieldError, i as sanitizeAssistantText, l as TurnInputCommitLostError, n as decideReply, o as isNoReplyMarker, p as isTurnInputCommitLostError, r as getAssistantReplyText, t as authorizationId } from "./oauth-authorization-COzWmMjO.js";
|
|
22
22
|
import { i as isValidTimeZone, r as getZonedDateTimeParts } from "./cadence-D00SCzT1.js";
|
|
23
|
-
import { r as EVENT_AUTHOR_ID } from "./prompt-
|
|
24
|
-
import { a as createSandboxSession, c as postinstall, d as getSandboxResources, i as bindSandboxFileSystem, l as setSnapshotSpanAttributes, n as isMissingError, o as stopSession, r as resolve$1, s as dependencies } from "./resolve-
|
|
25
|
-
import { a as getVercelConversationWorkQueue, f as getTurnRequestDeadline, n as sendNextWorkspaceSnapshotJob, r as sendWorkspaceSnapshotJob } from "./job-queue-
|
|
23
|
+
import { r as EVENT_AUTHOR_ID } from "./prompt-C9Q9cjD3.js";
|
|
24
|
+
import { a as createSandboxSession, c as postinstall, d as getSandboxResources, i as bindSandboxFileSystem, l as setSnapshotSpanAttributes, n as isMissingError, o as stopSession, r as resolve$1, s as dependencies } from "./resolve-rpz8No2i.js";
|
|
25
|
+
import { a as getVercelConversationWorkQueue, f as getTurnRequestDeadline, n as sendNextWorkspaceSnapshotJob, r as sendWorkspaceSnapshotJob } from "./job-queue-CGicV7x6.js";
|
|
26
26
|
import { F as taskOutcomeInputSchema, M as compileScheduleIntent, N as scheduleIntentSchema, O as automationInstructionToolSchema, T as SCHEDULED_AUTOMATION_SYSTEM_ACTOR, j as ScheduleIntentError, k as automationTitleSchema } from "./automation-gznOMaQ2.js";
|
|
27
27
|
import { r as isExperimentalFeatureEnabled } from "./experimental-Qn9rKLgx.js";
|
|
28
28
|
import { n as privateTraceResultAttributes } from "./private-trace-result-BLvBjy_e.js";
|
|
@@ -5154,22 +5154,14 @@ function hasEventCatalogEntries(catalog) {
|
|
|
5154
5154
|
return Object.keys(catalog).length > 0;
|
|
5155
5155
|
}
|
|
5156
5156
|
/**
|
|
5157
|
-
* True when at least one plugin namespace is enabled.
|
|
5158
|
-
*
|
|
5159
|
-
* Core Workspace snapshot events stay in the catalog for search and temporary
|
|
5160
|
-
* watches. Durable event automations still require a plugin publisher.
|
|
5161
|
-
*/
|
|
5162
|
-
function hasPluginEventCatalogEntries(catalog) {
|
|
5163
|
-
return Object.keys(pluginEventCatalog(catalog)).length > 0;
|
|
5164
|
-
}
|
|
5165
|
-
/**
|
|
5166
5157
|
* Catalog entries that durable event automations may select.
|
|
5167
5158
|
*
|
|
5168
5159
|
* Core Workspace snapshot events only wake temporary watches. Snapshot finish
|
|
5169
5160
|
* does not run event-automation ingest, so those namespaces stay out of create/update
|
|
5170
|
-
* schemas and trigger availability.
|
|
5161
|
+
* schemas and trigger availability. The core `slack` namespace stays in: Slack
|
|
5162
|
+
* ingress runs event-automation ingest for channel messages.
|
|
5171
5163
|
*/
|
|
5172
|
-
function
|
|
5164
|
+
function automationEventCatalog(catalog) {
|
|
5173
5165
|
return Object.fromEntries(Object.entries(catalog).filter(([namespace]) => namespace !== CORE_EVENT_NAMESPACE));
|
|
5174
5166
|
}
|
|
5175
5167
|
function enumSchema(values, unavailableMessage) {
|
|
@@ -5301,23 +5293,100 @@ function workspaceSnapshotFinishedEvent(input) {
|
|
|
5301
5293
|
return event;
|
|
5302
5294
|
}
|
|
5303
5295
|
//#endregion
|
|
5296
|
+
//#region src/chat/slack/channel-message-events.ts
|
|
5297
|
+
/** Core-owned event namespace for Slack Events. Not a plugin publisher. */
|
|
5298
|
+
const SLACK_EVENT_NAMESPACE = "slack";
|
|
5299
|
+
/** The trigger identifier that names the channel of the automation. */
|
|
5300
|
+
const SLACK_CURRENT_CHANNEL_IDENTIFIER = "current_channel";
|
|
5301
|
+
const CHANNEL_RESOURCE_TYPE = "channel";
|
|
5302
|
+
const MESSAGE_POSTED_EVENT = "message.posted";
|
|
5303
|
+
const CHANNEL_ID_PATTERN = /^[CG][A-Z0-9]{2,}$/;
|
|
5304
|
+
/** Event registration for new top-level Slack channel messages. */
|
|
5305
|
+
function slackChannelMessageEvents() {
|
|
5306
|
+
return { resourceTypes: [{
|
|
5307
|
+
type: CHANNEL_RESOURCE_TYPE,
|
|
5308
|
+
identifier: {
|
|
5309
|
+
format: `"${SLACK_CURRENT_CHANNEL_IDENTIFIER}" for the channel where the automation is created`,
|
|
5310
|
+
pattern: /^(?:current_channel|[CG][A-Z0-9]{2,})$/
|
|
5311
|
+
},
|
|
5312
|
+
supportedEvents: [MESSAGE_POSTED_EVENT],
|
|
5313
|
+
suggestedEvents: [],
|
|
5314
|
+
guidance: { [MESSAGE_POSTED_EVENT]: "A person posted a new top-level message in this channel. A reply goes in that message's thread. If the instructions do not apply to this message, end with no action." }
|
|
5315
|
+
}] };
|
|
5316
|
+
}
|
|
5317
|
+
/**
|
|
5318
|
+
* Bind a Slack channel-message automation to its own channel.
|
|
5319
|
+
*
|
|
5320
|
+
* Resolve `current_channel` to the destination channel and reject other
|
|
5321
|
+
* channels, so private channel text cannot reach another channel.
|
|
5322
|
+
*/
|
|
5323
|
+
function requireSlackChannelMessageScope(automation) {
|
|
5324
|
+
if (automation.trigger.namespace !== "slack") return automation;
|
|
5325
|
+
const channelId = automation.destination.channelId;
|
|
5326
|
+
if (!CHANNEL_ID_PATTERN.test(channelId)) throw new ToolInputError("A Slack channel-message automation works only in a channel, not in a DM.");
|
|
5327
|
+
const identifier = automation.trigger.identifier === "current_channel" ? channelId : automation.trigger.identifier;
|
|
5328
|
+
if (identifier !== channelId) throw new ToolInputError(`A Slack channel-message automation can watch only the channel where it posts. Use identifier "${SLACK_CURRENT_CHANNEL_IDENTIFIER}", or create the automation in the channel to watch.`);
|
|
5329
|
+
return {
|
|
5330
|
+
...automation,
|
|
5331
|
+
credentialMode: "system",
|
|
5332
|
+
trigger: {
|
|
5333
|
+
...automation.trigger,
|
|
5334
|
+
identifier
|
|
5335
|
+
}
|
|
5336
|
+
};
|
|
5337
|
+
}
|
|
5338
|
+
/**
|
|
5339
|
+
* Build the Event for one new top-level channel message, or nothing.
|
|
5340
|
+
*
|
|
5341
|
+
* Thread replies and bot posts, including Slackbot, do not count. Bots can
|
|
5342
|
+
* post often and use up the run limit of the automation.
|
|
5343
|
+
*/
|
|
5344
|
+
function slackChannelMessageEvent(input) {
|
|
5345
|
+
if (input.botId || input.subtype === "bot_message" || input.userId === "USLACKBOT") return;
|
|
5346
|
+
if (input.threadTs && input.threadTs !== input.ts) return void 0;
|
|
5347
|
+
if (!CHANNEL_ID_PATTERN.test(input.channelId)) return void 0;
|
|
5348
|
+
return {
|
|
5349
|
+
eventKey: `${input.channelId}:${input.ts}`,
|
|
5350
|
+
eventType: MESSAGE_POSTED_EVENT,
|
|
5351
|
+
identifier: input.channelId,
|
|
5352
|
+
occurredAtMs: Math.floor(Number(input.ts) * 1e3),
|
|
5353
|
+
trustedSummary: `<@${input.userId}> posted a new message in <#${input.channelId}>.`,
|
|
5354
|
+
data: {
|
|
5355
|
+
channelId: input.channelId,
|
|
5356
|
+
messageTs: input.ts,
|
|
5357
|
+
userId: input.userId
|
|
5358
|
+
},
|
|
5359
|
+
...input.text?.trim() ? { untrustedText: input.text } : void 0
|
|
5360
|
+
};
|
|
5361
|
+
}
|
|
5362
|
+
/** Return the source message thread for a channel-message run. */
|
|
5363
|
+
function slackChannelMessageReplyThreadTs(event) {
|
|
5364
|
+
if (event.namespace !== "slack") return void 0;
|
|
5365
|
+
const messageTs = event.data?.messageTs;
|
|
5366
|
+
return typeof messageTs === "string" ? messageTs : void 0;
|
|
5367
|
+
}
|
|
5368
|
+
//#endregion
|
|
5304
5369
|
//#region src/chat/events/runtime-catalog.ts
|
|
5305
5370
|
/**
|
|
5306
5371
|
* Enabled event registrations for search, guidance, and tool schemas.
|
|
5307
5372
|
*
|
|
5308
|
-
* Includes core Workspace snapshot events under the `junior` namespace,
|
|
5309
|
-
*
|
|
5373
|
+
* Includes core Workspace snapshot events under the `junior` namespace, Slack
|
|
5374
|
+
* channel-message events under the `slack` namespace, plus every enabled plugin
|
|
5375
|
+
* registration. Plugins may not use the `junior` or `slack` namespaces.
|
|
5310
5376
|
*/
|
|
5311
5377
|
function getEventCatalog() {
|
|
5312
|
-
const catalog = {
|
|
5313
|
-
|
|
5314
|
-
|
|
5315
|
-
|
|
5316
|
-
|
|
5378
|
+
const catalog = {
|
|
5379
|
+
[CORE_EVENT_NAMESPACE]: { resourceTypes: [...workspaceSnapshotEvents().resourceTypes, {
|
|
5380
|
+
type: "timer",
|
|
5381
|
+
supportedEvents: ["timer.fired"],
|
|
5382
|
+
suggestedEvents: []
|
|
5383
|
+
}] },
|
|
5384
|
+
[SLACK_EVENT_NAMESPACE]: slackChannelMessageEvents()
|
|
5385
|
+
};
|
|
5317
5386
|
for (const plugin of getPlugins()) {
|
|
5318
5387
|
const registration = plugin.events;
|
|
5319
5388
|
if (!registration || registration.isEnabled?.() === false) continue;
|
|
5320
|
-
if (plugin.manifest.name === "junior") throw new Error(`Plugin "${
|
|
5389
|
+
if (plugin.manifest.name === "junior" || plugin.manifest.name === "slack") throw new Error(`Plugin "${plugin.manifest.name}" cannot register events; that namespace is reserved for core events`);
|
|
5321
5390
|
catalog[plugin.manifest.name] = registration;
|
|
5322
5391
|
}
|
|
5323
5392
|
return catalog;
|
|
@@ -9639,6 +9708,7 @@ const agentInvocationBaseSchema = z.object({
|
|
|
9639
9708
|
parentToolCallId: exactStringSchema.optional(),
|
|
9640
9709
|
reasoningLevel: z.enum(TURN_REASONING_LEVELS).optional(),
|
|
9641
9710
|
source: sourceSchema,
|
|
9711
|
+
title: exactStringSchema.optional(),
|
|
9642
9712
|
updatedAtMs: z.number().finite()
|
|
9643
9713
|
}).strict();
|
|
9644
9714
|
const agentInvocationSchema = z.discriminatedUnion("status", [
|
|
@@ -9673,7 +9743,8 @@ const createAgentInvocationSchema = z.object({
|
|
|
9673
9743
|
input: exactStringSchema,
|
|
9674
9744
|
parentConversationId: exactStringSchema,
|
|
9675
9745
|
parentToolCallId: exactStringSchema.optional(),
|
|
9676
|
-
reasoningLevel: z.enum(TURN_REASONING_LEVELS).optional()
|
|
9746
|
+
reasoningLevel: z.enum(TURN_REASONING_LEVELS).optional(),
|
|
9747
|
+
title: exactStringSchema.optional()
|
|
9677
9748
|
}).strict();
|
|
9678
9749
|
//#endregion
|
|
9679
9750
|
//#region src/chat/agent-invocations/errors.ts
|
|
@@ -9769,10 +9840,15 @@ function invocationFromRow(row) {
|
|
|
9769
9840
|
source: row.source,
|
|
9770
9841
|
status: row.status,
|
|
9771
9842
|
...row.terminalAt ? { terminalAtMs: row.terminalAt.getTime() } : void 0,
|
|
9843
|
+
...row.title ? { title: row.title } : void 0,
|
|
9772
9844
|
updatedAtMs: row.updatedAt.getTime()
|
|
9773
9845
|
});
|
|
9774
9846
|
}
|
|
9775
|
-
/**
|
|
9847
|
+
/**
|
|
9848
|
+
* Require every durable creation input to match before replaying one key.
|
|
9849
|
+
* The title is not compared: a retry can generate a different one, and the
|
|
9850
|
+
* stored title wins.
|
|
9851
|
+
*/
|
|
9776
9852
|
function sameCreateInput(invocation, input) {
|
|
9777
9853
|
return invocation.parentConversationId === input.parentConversationId && invocation.agentName === input.agentName && invocation.input === input.input && invocation.reasoningLevel === input.reasoningLevel && JSON.stringify(invocation.actor) === JSON.stringify(input.actor) && JSON.stringify(invocation.credentialContext) === JSON.stringify(input.credentialContext) && JSON.stringify(invocation.destination) === JSON.stringify(input.destination);
|
|
9778
9854
|
}
|
|
@@ -9797,6 +9873,18 @@ async function getLatestAgentInvocationForConversation(childConversationId) {
|
|
|
9797
9873
|
const rows = await getSqlExecutor().db().select().from(juniorAgentInvocations).where(eq(juniorAgentInvocations.childConversationId, childConversationId)).orderBy(desc(juniorAgentInvocations.createdAt)).limit(1);
|
|
9798
9874
|
return rows[0] ? invocationFromRow(rows[0]) : void 0;
|
|
9799
9875
|
}
|
|
9876
|
+
/**
|
|
9877
|
+
* Read the name and the newest task title of one child Conversation, for
|
|
9878
|
+
* labels. Agent invocations that give a nested result to the child have no
|
|
9879
|
+
* title, so an agent invocation with a title comes first.
|
|
9880
|
+
*/
|
|
9881
|
+
async function getChildAgentLabel(childConversationId) {
|
|
9882
|
+
const [row] = await getSqlExecutor().db().select({
|
|
9883
|
+
agentName: juniorAgentInvocations.agentName,
|
|
9884
|
+
title: juniorAgentInvocations.title
|
|
9885
|
+
}).from(juniorAgentInvocations).where(eq(juniorAgentInvocations.childConversationId, childConversationId)).orderBy(sql`${juniorAgentInvocations.title} is null`, desc(juniorAgentInvocations.createdAt)).limit(1);
|
|
9886
|
+
return row;
|
|
9887
|
+
}
|
|
9800
9888
|
/** Bound the agent invocations that one child agent listing reads. */
|
|
9801
9889
|
const CHILD_AGENT_LIST_INVOCATION_LIMIT = 200;
|
|
9802
9890
|
/** Return the child state that one child's agent invocations show. */
|
|
@@ -9812,6 +9900,7 @@ function childAgentFromInvocations(invocations, resultInvocationIds) {
|
|
|
9812
9900
|
...terminal && terminal.status !== "completed" ? { errorMessage: terminal.errorMessage } : void 0,
|
|
9813
9901
|
status: terminal?.parentMailboxStatus === "replaced" ? "pending" : terminal?.parentMailboxStatus === "skipped" ? "stopped" : current.status,
|
|
9814
9902
|
task: task.input,
|
|
9903
|
+
...task.title ? { title: task.title } : void 0,
|
|
9815
9904
|
updatedAtMs: Math.max(...invocations.map((invocation) => invocation.updatedAtMs))
|
|
9816
9905
|
};
|
|
9817
9906
|
}
|
|
@@ -9883,6 +9972,7 @@ async function createAgentInvocation(rawInput, nowMs = Date.now()) {
|
|
|
9883
9972
|
childConversationId,
|
|
9884
9973
|
agentName: input.agentName ?? null,
|
|
9885
9974
|
input: input.input,
|
|
9975
|
+
title: input.title ?? null,
|
|
9886
9976
|
actor: input.actor,
|
|
9887
9977
|
credentialContext: input.credentialContext ?? null,
|
|
9888
9978
|
source: { kind: "agent_invocation" },
|
|
@@ -10082,6 +10172,7 @@ const listAgentsOutputSchema = juniorToolOutputSchema.extend({ agents: z.array(z
|
|
|
10082
10172
|
name: agentNameSchema.optional().describe("Child-agent name. Pass it to spawnAgent to reuse it."),
|
|
10083
10173
|
status: z.enum(AGENT_INVOCATION_STATUSES).describe("pending: waiting to run. running or paused: working. completed, blocked, failed, or stopped: not working."),
|
|
10084
10174
|
task: z.string().describe("Latest task given to the child agent"),
|
|
10175
|
+
title: z.string().optional().describe("Short display title of the latest task"),
|
|
10085
10176
|
error: z.string().optional().describe("Why the child agent is blocked, failed, or stopped"),
|
|
10086
10177
|
updated_at: z.string().describe("Time of the latest change")
|
|
10087
10178
|
}).strict()).describe("Child agents of this conversation, newest activity first") });
|
|
@@ -10102,6 +10193,7 @@ function createListAgentsTool(conversationId) {
|
|
|
10102
10193
|
...agent.agentName ? { name: agent.agentName } : void 0,
|
|
10103
10194
|
status: agent.status,
|
|
10104
10195
|
task: truncate(agent.task, TASK_MAX_LENGTH),
|
|
10196
|
+
...agent.title ? { title: agent.title } : void 0,
|
|
10105
10197
|
...agent.errorMessage ? { error: truncate(agent.errorMessage, ERROR_MAX_LENGTH) } : void 0,
|
|
10106
10198
|
updated_at: new Date(agent.updatedAtMs).toISOString()
|
|
10107
10199
|
})) })
|
|
@@ -10122,16 +10214,24 @@ function createSpawnAgentTool(spawnAgent) {
|
|
|
10122
10214
|
},
|
|
10123
10215
|
inputSchema: z.object({
|
|
10124
10216
|
task: z.string().trim().min(1).describe("Task for the child agent"),
|
|
10217
|
+
title: z.string().trim().min(1).max(60).nullable().optional().describe("Optional short display title for the task. Omit to generate one from the task."),
|
|
10125
10218
|
name: agentNameSchema.nullable().optional().describe("Stable child-agent name, or omit for a one-off agent"),
|
|
10126
10219
|
reasoning_level: z.enum(TURN_REASONING_LEVELS).nullable().optional().describe("Optional reasoning level for this delegated task only")
|
|
10127
10220
|
}).strict(),
|
|
10128
10221
|
outputSchema: spawnAgentOutputSchema,
|
|
10129
10222
|
execute: async (input, options) => {
|
|
10130
10223
|
if (!options.toolCallId) throw new ToolInputError("spawnAgent requires an active tool call ID");
|
|
10224
|
+
const title = await resolveTaskTitle({
|
|
10225
|
+
completeText,
|
|
10226
|
+
instruction: input.task,
|
|
10227
|
+
signal: options.signal,
|
|
10228
|
+
title: input.title
|
|
10229
|
+
});
|
|
10131
10230
|
let result;
|
|
10132
10231
|
try {
|
|
10133
10232
|
result = await spawnAgent({
|
|
10134
10233
|
task: input.task,
|
|
10234
|
+
...title ? { title } : void 0,
|
|
10135
10235
|
...input.name ? { name: input.name } : void 0,
|
|
10136
10236
|
...input.reasoning_level ? { reasoningLevel: input.reasoning_level } : void 0
|
|
10137
10237
|
}, {
|
|
@@ -10150,25 +10250,45 @@ function createSpawnAgentTool(spawnAgent) {
|
|
|
10150
10250
|
//#endregion
|
|
10151
10251
|
//#region src/chat/agent-invocations/markers.ts
|
|
10152
10252
|
/**
|
|
10153
|
-
* Dashboard
|
|
10253
|
+
* Dashboard records for agent invocations. The parent Conversation gets one
|
|
10154
10254
|
* `subagent_started` and one `subagent_ended` event for each agent invocation.
|
|
10255
|
+
* The child Conversation gets `message` events for its input and its result,
|
|
10256
|
+
* because a child has no Location that records visible messages.
|
|
10155
10257
|
*/
|
|
10156
10258
|
const SUBAGENT_KIND = "agent";
|
|
10157
10259
|
/**
|
|
10158
|
-
* Record in the parent Conversation that one agent invocation started
|
|
10159
|
-
*
|
|
10260
|
+
* Record in the parent Conversation that one agent invocation started, and
|
|
10261
|
+
* record its input as a user message in the child Conversation. The dashboard
|
|
10262
|
+
* pairs the parent event with `subagent_ended` to show the child and its
|
|
10160
10263
|
* status. It must be written before the child mailbox append, so the child
|
|
10161
10264
|
* cannot end first.
|
|
10162
10265
|
*/
|
|
10163
10266
|
async function recordSubagentStarted(invocation) {
|
|
10164
|
-
|
|
10267
|
+
const eventStore = getConversationEventStore();
|
|
10268
|
+
const messageId = getAgentInvocationMessageId(invocation.invocationId);
|
|
10269
|
+
await eventStore.append(invocation.childConversationId, [{
|
|
10270
|
+
idempotencyKey: `message:${messageId}`,
|
|
10271
|
+
data: {
|
|
10272
|
+
type: "message",
|
|
10273
|
+
messageId,
|
|
10274
|
+
role: "user",
|
|
10275
|
+
text: invocation.input
|
|
10276
|
+
},
|
|
10277
|
+
createdAtMs: invocation.createdAtMs
|
|
10278
|
+
}]);
|
|
10279
|
+
await eventStore.append(invocation.parentConversationId, [{
|
|
10165
10280
|
idempotencyKey: `subagent_started:${invocation.invocationId}`,
|
|
10166
10281
|
data: {
|
|
10167
10282
|
type: "subagent_started",
|
|
10168
10283
|
subagentInvocationId: invocation.invocationId,
|
|
10169
10284
|
subagentKind: SUBAGENT_KIND,
|
|
10170
10285
|
childConversationId: invocation.childConversationId,
|
|
10171
|
-
...invocation.
|
|
10286
|
+
...invocation.agentName ? { agentName: invocation.agentName } : void 0,
|
|
10287
|
+
...invocation.parentToolCallId ? {
|
|
10288
|
+
parentToolCallId: invocation.parentToolCallId,
|
|
10289
|
+
task: invocation.input
|
|
10290
|
+
} : void 0,
|
|
10291
|
+
...invocation.title ? { title: invocation.title } : void 0,
|
|
10172
10292
|
...invocation.reasoningLevel ? { reasoningLevel: invocation.reasoningLevel } : void 0
|
|
10173
10293
|
},
|
|
10174
10294
|
createdAtMs: invocation.createdAtMs
|
|
@@ -10181,12 +10301,14 @@ const SUBAGENT_OUTCOMES = {
|
|
|
10181
10301
|
stopped: "aborted"
|
|
10182
10302
|
};
|
|
10183
10303
|
/**
|
|
10184
|
-
* Record in the parent Conversation how one agent invocation ended
|
|
10304
|
+
* Record in the parent Conversation how one agent invocation ended, and record
|
|
10305
|
+
* a completed result as an assistant message in the child Conversation. The
|
|
10185
10306
|
* heartbeat result repair also calls this, because the child work can be
|
|
10186
10307
|
* acknowledged before the worker reports the result.
|
|
10187
10308
|
*/
|
|
10188
10309
|
async function recordSubagentEnded(invocation) {
|
|
10189
|
-
|
|
10310
|
+
const eventStore = getConversationEventStore();
|
|
10311
|
+
await eventStore.append(invocation.parentConversationId, [{
|
|
10190
10312
|
idempotencyKey: `subagent_ended:${invocation.invocationId}`,
|
|
10191
10313
|
data: {
|
|
10192
10314
|
type: "subagent_ended",
|
|
@@ -10195,6 +10317,19 @@ async function recordSubagentEnded(invocation) {
|
|
|
10195
10317
|
},
|
|
10196
10318
|
createdAtMs: invocation.terminalAtMs
|
|
10197
10319
|
}]);
|
|
10320
|
+
const result = invocation.status === "completed" ? invocation.result.trim() : "";
|
|
10321
|
+
if (!result) return;
|
|
10322
|
+
const messageId = `agent-invocation:${invocation.invocationId}:reply`;
|
|
10323
|
+
await eventStore.append(invocation.childConversationId, [{
|
|
10324
|
+
idempotencyKey: `message:${messageId}`,
|
|
10325
|
+
data: {
|
|
10326
|
+
type: "message",
|
|
10327
|
+
messageId,
|
|
10328
|
+
role: "assistant",
|
|
10329
|
+
text: result
|
|
10330
|
+
},
|
|
10331
|
+
createdAtMs: invocation.terminalAtMs
|
|
10332
|
+
}]);
|
|
10198
10333
|
}
|
|
10199
10334
|
//#endregion
|
|
10200
10335
|
//#region src/chat/agent-invocations/stop.ts
|
|
@@ -10568,6 +10703,7 @@ function createWatchEventsTool(context, catalog) {
|
|
|
10568
10703
|
outputSchema: outputSchema$2,
|
|
10569
10704
|
async execute(input) {
|
|
10570
10705
|
if (input.namespace === "junior" && input.resourceType === "timer") throw new ToolInputError("Use watchTimer to create a timer Watch.");
|
|
10706
|
+
if (input.namespace === "slack") throw new ToolInputError("Slack channel messages can trigger only an event automation in that channel. Use createEventAutomation.");
|
|
10571
10707
|
const events = cleanStrings(input.events);
|
|
10572
10708
|
for (const eventType of events) if (!pluginSupportsEvent(catalog, input.namespace, input.resourceType, eventType)) throw new ToolInputError(`Resource type "${input.namespace}:${input.resourceType}" does not support event "${eventType}".`);
|
|
10573
10709
|
const intent = input.intent.trim();
|
|
@@ -10732,7 +10868,7 @@ const eventAutomationListToolResultSchema = juniorToolOutputSchema.extend({
|
|
|
10732
10868
|
}).strict();
|
|
10733
10869
|
/** Build the validated event trigger accepted by event-automation tools. */
|
|
10734
10870
|
function registeredEventAutomationTriggerSchema(catalog) {
|
|
10735
|
-
const plugins =
|
|
10871
|
+
const plugins = automationEventCatalog(catalog);
|
|
10736
10872
|
return z.object({
|
|
10737
10873
|
namespace: eventNamespaceSchema(plugins),
|
|
10738
10874
|
identifier: z.string().trim().min(1).max(300),
|
|
@@ -10744,7 +10880,7 @@ function registeredEventAutomationTriggerSchema(catalog) {
|
|
|
10744
10880
|
}
|
|
10745
10881
|
/** Reject an event-automation trigger that is no longer supported by the catalog. */
|
|
10746
10882
|
function requireSupportedEventAutomationTrigger(catalog, trigger) {
|
|
10747
|
-
const plugins =
|
|
10883
|
+
const plugins = automationEventCatalog(catalog);
|
|
10748
10884
|
for (const eventType of trigger.events) if (!pluginSupportsEvent(plugins, trigger.namespace, trigger.resourceType, eventType)) throw new ToolInputError(`Resource type "${trigger.namespace}:${trigger.resourceType}" does not support event "${eventType}".`);
|
|
10749
10885
|
return requireSupportedEventMatch(plugins, {
|
|
10750
10886
|
match: trigger.match,
|
|
@@ -10786,7 +10922,7 @@ async function writableEventAutomation(context, id) {
|
|
|
10786
10922
|
return task;
|
|
10787
10923
|
}
|
|
10788
10924
|
function eventAutomationTriggerAvailable(task, catalog) {
|
|
10789
|
-
const registration =
|
|
10925
|
+
const registration = automationEventCatalog(catalog)[task.trigger.namespace];
|
|
10790
10926
|
return Boolean(registration && task.trigger.events.every((eventType) => registration.resourceTypes.some((resourceType) => resourceType.supportedEvents.includes(eventType))));
|
|
10791
10927
|
}
|
|
10792
10928
|
/** Project an event automation into the bounded tool-result shape. */
|
|
@@ -10910,7 +11046,7 @@ function createEventAutomationTool(context, catalog) {
|
|
|
10910
11046
|
instruction: input.instruction,
|
|
10911
11047
|
title: input.title
|
|
10912
11048
|
});
|
|
10913
|
-
const task = {
|
|
11049
|
+
const task = requireSlackChannelMessageScope({
|
|
10914
11050
|
id,
|
|
10915
11051
|
destinationVisibility: source.visibility,
|
|
10916
11052
|
createdAtMs: Date.now(),
|
|
@@ -10932,7 +11068,7 @@ function createEventAutomationTool(context, catalog) {
|
|
|
10932
11068
|
events: [...new Set(input.trigger.events)],
|
|
10933
11069
|
...match ? { match } : void 0
|
|
10934
11070
|
}
|
|
10935
|
-
};
|
|
11071
|
+
});
|
|
10936
11072
|
return eventAutomationToolResult(context.conversationId, await createEventAutomation(db, task), catalog, actor.userId);
|
|
10937
11073
|
}
|
|
10938
11074
|
});
|
|
@@ -11064,11 +11200,17 @@ async function editEventAutomation(current, input, isCreator, catalog) {
|
|
|
11064
11200
|
};
|
|
11065
11201
|
}
|
|
11066
11202
|
const changesExecution = input.instruction !== void 0 && input.instruction !== current.task.text || changesEventAutomationTrigger(current.trigger, trigger);
|
|
11067
|
-
|
|
11203
|
+
const next = {
|
|
11068
11204
|
...current,
|
|
11069
11205
|
...await editAutomationFields(current, input, isCreator, changesExecution),
|
|
11070
11206
|
trigger
|
|
11071
11207
|
};
|
|
11208
|
+
try {
|
|
11209
|
+
return requireSlackChannelMessageScope(next);
|
|
11210
|
+
} catch (error) {
|
|
11211
|
+
if (error instanceof ToolInputError) throw new AutomationEditError(error.message, "trigger");
|
|
11212
|
+
throw error;
|
|
11213
|
+
}
|
|
11072
11214
|
}
|
|
11073
11215
|
//#endregion
|
|
11074
11216
|
//#region src/chat/tools/update-event-automation.ts
|
|
@@ -11141,7 +11283,7 @@ function createUpdateEventAutomationTool(context, catalog) {
|
|
|
11141
11283
|
function createEventAutomationTools(context, catalog) {
|
|
11142
11284
|
if (context.source.kind !== "slack" || context.destination.platform !== "slack" || context.actor?.platform !== "slack") return {};
|
|
11143
11285
|
return {
|
|
11144
|
-
|
|
11286
|
+
createEventAutomation: createEventAutomationTool(context, catalog),
|
|
11145
11287
|
listEventAutomations: createListEventAutomationsTool(context, catalog),
|
|
11146
11288
|
updateEventAutomation: createUpdateEventAutomationTool(context, catalog),
|
|
11147
11289
|
deleteEventAutomation: createDeleteEventAutomationTool(context, catalog)
|
|
@@ -21581,7 +21723,7 @@ function createAgentRunner(execute, options) {
|
|
|
21581
21723
|
} } : void 0
|
|
21582
21724
|
};
|
|
21583
21725
|
if (run.instruction.storedAttachments?.length) {
|
|
21584
|
-
const { loadInputImages } = await import("./images-
|
|
21726
|
+
const { loadInputImages } = await import("./images-Ci43I3ek.js").then((n) => n.n);
|
|
21585
21727
|
const storage = nextRun.environment?.attachmentStorage;
|
|
21586
21728
|
if (!storage) throw new Error("Attachment storage is unavailable.");
|
|
21587
21729
|
nextRun.instruction = {
|
|
@@ -21597,4 +21739,4 @@ function createAgentRunner(execute, options) {
|
|
|
21597
21739
|
} };
|
|
21598
21740
|
}
|
|
21599
21741
|
//#endregion
|
|
21600
|
-
export {
|
|
21742
|
+
export { getChildAgentLabel as $, isInvalidConversationRecordError as $t, resolveSlackChannelIdFromMessage as A, completeConversationStop as At, effectiveTaskOutcomes as B, recordAttemptFailure as Bt, renderBlockText as C, finishedRunReply as Cn, appendAndEnqueueExclusiveInboundMessage as Ct, storeAttachment as D, setConfigDefaults as Dn, checkInConversationWork as Dt, requestAttachmentDeletion as E, getConfigDefaults as En, cancelHumanFacingPendingMessages as Et, logScheduledAutomationRunSkipped as F, ensureConversationWake as Ft, completeAgentInvocation as G, requestConversationWork as Gt, stopChildAgentsOf as H, releaseConversationWork as Ht, scheduledAutomationRunAttributes as I, getConversation as It, getActiveAgentInvocationForConversation as J, CONVERSATION_WORK_CHECK_IN_INTERVAL_MS as Jt, createAgentInvocation as K, startConversationWork as Kt, editEventAutomation as L, getConversationWorkState as Lt, getConversationInfo as M, countPendingConversationMessages as Mt, listThreadReplies as N, deadLetterAttempt as Nt, parseSlackThreadId as O, clearConsumedConversationWake as Ot, editScheduledAutomation as P, drainConversationMailbox as Pt, getAgentInvocationTurnId as Q, isFinalAttempt as Qt, AutomationEditError as R, hasRunnableConversationWork as Rt, renderAttachmentText as S, deliversFinalText as Sn, ackMessages as St, readLiveAttachment as T, shouldEmitDevAgentTrace as Tn, beginConversationResume as Tt, recordSubagentEnded as U, removeActiveConversation as Ut, resolveTaskOutcomes as V, recordConversationRetry as Vt, recordSubagentStarted as W, requestAnotherSlice as Wt, getAgentInvocationMessageId as X, hasConversationStop as Xt, getAgentInvocation as Y, CONVERSATION_WORK_STALE_ENQUEUE_MS as Yt, getAgentInvocationResultMessageId as Z, hasRunnableConversationWork$1 as Zt, resolvePluginOAuthAccount as _, buildSteeringPiMessage as _n, SLACK_EVENT_NAMESPACE as _t, buildAuthPauseResponse as a, shouldPropagateSandboxEgressTrace as an, markAgentInvocationMailboxAppended as at, unpublishedArtifactHeaders as b, toolInvocationDestination as bn, automationEventCatalog as bt, deleteMcpAuthSessionsForUserProvider as c, consumeSandboxEgressAuthRequiredSignal as cn, markAgentInvocationRunning as ct, getMcpAuthSession as d, sandboxEgressSignalsResponseSchema as dn, processWorkspaceSnapshotJob as dt, renderTaskInput as en, getLatestAgentInvocationForConversation as et, getMcpStoredOAuthCredentials as f, formatProviderLabel as fn, ingestEvent as ft, readStats as g, createUserTokenStore as gn, getEventCatalog as gt, latestProgressStatus as h, startOAuthFlow as hn, timerWatchCredentialSubject as ht, executeCredentialedEgressRequest as i, normalizeSandboxEgressTracePropagationDomains as in, listPendingAgentInvocationResults as it, resolveSlackChannelIdFromThreadId as j, completeConversationWork as jt, readSlackRawMessageContext as k, clearExpiredConversationLease as kt, deleteMcpServerSessionId as l, consumeSandboxEgressPermissionDeniedSignal as ln, reportReplacedAgentInvocation as lt, PluginCredentialFailureError as m, resolveBaseUrl as mn, isEventMailboxMetadata as mt, executeAgentRun as n, recordFinishedTurnForAutomatedLimit as nn, listChildAgents as nt, finalizeMcpAuthorization as o, SANDBOX_EGRESS_PROXY_PATH as on, markAgentInvocationParentMailboxAppended as ot, putMcpStoredOAuthCredentials as p, parseOAuthStatePayload as pn, EVENT_WAIT_MS as pt, createAgentInvocationForResult as q, stopConversationWork as qt, createContextCompactor as r, resolveSandboxEgressProviderForHost as rn, listPendingAgentInvocationMailboxAppends as rt, deleteMcpAuthSession as s, clearSandboxEgressSignals as sn, markAgentInvocationPaused as st, createAgentRunner as t, maybePostAutomatedTurnLimitNotice as tn, isTerminalAgentInvocation as tt, deleteMcpStoredOAuthCredentials as u, parseSandboxEgressCredentialToken as un, getMcpProviderErrorAttributes as ut, publicArtifactHeaders as v, RetryableDeliveryError as vn, slackChannelMessageEvent as vt, collectAttachmentGarbage as w, runDispatchOutcome as wn, appendAndEnqueueInboundMessage as wt, lookupSlackUserProfile as x, AuthorizationFlowDisabledError as xn, eventGuidance as xt, readPublicArtifact as y, actorFromRun as yn, slackChannelMessageReplyThreadTs as yt, eventAutomationTriggerAvailable as z, listActiveConversationIds as zt };
|