@sentry/junior 0.309.0 → 0.310.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-context-1YUbMpD3.js → adapter-context-BhKpjpGD.js} +2 -2
- package/dist/{admin-u30A8TcD.js → admin-tgZEZAk2.js} +2 -2
- package/dist/{agent-runner-sJLhgPQV.js → agent-runner-D9cvNlQl.js} +176 -138
- package/dist/api/schema.js +5 -5
- package/dist/api.js +30 -30
- package/dist/app.js +31 -30
- package/dist/{background-compaction-queue-CUJXVKG3.js → background-compaction-queue-BGHqkhkY.js} +4 -4
- package/dist/{briefs-BHi70IR5.js → briefs-DKxkoruh.js} +3 -3
- package/dist/{catalog-runtime-Chc_IP2o.js → catalog-runtime-BxwzbLKY.js} +1 -1
- package/dist/cli/chat.js +16 -16
- package/dist/cli/check.js +3 -3
- package/dist/cli/main.js +3 -3
- package/dist/cli/plugins.js +4 -4
- package/dist/cli/snapshot-create.js +5 -5
- package/dist/cli/upgrade.js +3 -3
- package/dist/{config-BIyIdTtA.js → config-Dkt2Le2b.js} +2 -2
- package/dist/{continue-in-slack-BQJBfiQh.js → continue-in-slack-BWVwePKD.js} +5 -5
- package/dist/{conversation-CzrLhdHG.js → conversation-M9KZ5JxF.js} +1 -1
- package/dist/{conversation-feed-B9e3_gxz.js → conversation-feed-Ci6YD1N-.js} +1 -1
- package/dist/{conversation-privacy-CkTW29hd.js → conversation-privacy-C39g8BY4.js} +1 -1
- package/dist/{conversation-turn-CZaYQUum.js → conversation-turn-CBlZIH02.js} +16 -16
- package/dist/{credential-sync-58m_CyIJ.js → credential-sync-vGnrB0BY.js} +16 -16
- package/dist/{db-CFUpEZi9.js → db-CFZggNoy.js} +13 -5
- package/dist/{executor-DXL0O0MV.js → executor-BPkZDx5-.js} +10 -3
- package/dist/{history-N7IVbUom.js → history-CYstOMKX.js} +6 -0
- package/dist/{html-CaBu2VbT.js → html-2r2KmLwi.js} +6 -6
- package/dist/{install-DhTBUUov.js → install-C-oE6C_u.js} +2 -2
- package/dist/instrumentation.js +2 -2
- package/dist/{lineage-CxtOI2_p.js → lineage-CsvrEFQe.js} +2 -2
- package/dist/{logging-BNUovdcX.js → logging-D5gkyvnK.js} +1 -1
- package/dist/{message-DcUsS2vg.js → message-DwvJ-I3w.js} +8 -8
- package/dist/{model-input-o3rEqgwM.js → model-input-MAq2881y.js} +2 -2
- package/dist/nitro.js +3 -3
- package/dist/{oauth-callback-server-1Fizd1EM.js → oauth-callback-server-DIF6Li06.js} +2 -2
- package/dist/{oauth-relay-DOwngqdM.js → oauth-relay-DPE-wrwO.js} +1 -1
- package/dist/{projection-Ce4pmhKP.js → projection-jZSlEAXG.js} +32 -15
- package/dist/{prompt-DEqjDVMs.js → prompt-CaMyeCpA.js} +4 -4
- package/dist/{registry-CNE4ZBnG.js → registry-BBkWFCl8.js} +1 -1
- package/dist/{resolve-qbPg-aC-.js → resolve-B38MkHXE.js} +3 -3
- package/dist/{result-ZGnDzcsb.js → result-BaqSZcJb.js} +8 -8
- package/dist/{runner-eGIxpAMf.js → runner-11h8PrHh.js} +10 -10
- package/dist/{sandbox-egress-signals-DMFB1kCp.js → sandbox-egress-signals-CTcACAtJ.js} +1 -1
- package/dist/{schedule-Cire6NU7.js → schedule-DWxZ3kja.js} +1 -1
- package/dist/{schema-CfIey9Ao.js → schema-obw5jvR4.js} +3 -3
- package/dist/{service-account-B1VXCTqg.js → service-account-Bx93N1n1.js} +3 -3
- package/dist/{service-account-Cw_LWZ4-.js → service-account-Zc5bUcIJ.js} +5 -5
- package/dist/{session-stop-P2XdTiwr.js → session-stop-BfY4rhJs.js} +39 -36
- package/dist/{skills-Zg8-vrje.js → skills-C8Npu5zO.js} +77 -31
- package/dist/{slack-conversation-unfurl-DA51qH0c.js → slack-conversation-unfurl-DlRVA02H.js} +10 -10
- package/dist/{spawn-DBi4-zD8.js → spawn-CXr58R0x.js} +6 -6
- package/dist/{state-C-Ftk23K.js → state-CGrGVeQC.js} +4 -4
- package/dist/{stop-D9xideLM.js → stop-DYzjRf2U.js} +33 -33
- package/dist/{store-BjIXA0Al.js → store-D4FQ1Nml.js} +5 -5
- package/dist/{task-queue-D0_qbnpo.js → task-queue-CaZffYaH.js} +3 -3
- package/dist/{task-runner-DQMq4XY0.js → task-runner-Dm7BHbGp.js} +7 -7
- package/dist/{thread-context-D0i1e-5O.js → thread-context-Dyj1KWaY.js} +7 -7
- package/dist/{turn-session-routing-C0l68I_O.js → turn-session-routing-CD0BRCex.js} +4 -4
- package/dist/{turn-user-message-nBVvOXjs.js → turn-user-message-9IxeEv5v.js} +3 -3
- package/dist/{users-DdjMjbmM.js → users-CaUAYMb3.js} +1 -1
- package/dist/{validation-CRbvRPvu.js → validation-DxVNIxA0.js} +1 -1
- package/dist/{version-BYdVs12p.js → version-Cr7Z71yG.js} +1 -1
- package/dist/version.js +1 -1
- package/dist/{viewer-DudYrQGj.js → viewer-AHldghAD.js} +3 -3
- package/dist/{warmup-DN9OHN1-.js → warmup-C6LOZ2d2.js} +22 -22
- package/dist/{worker-C9ZfJXmV.js → worker-CUBtu1Li.js} +8 -8
- package/migrations/0124_artifact_visibility.sql +9 -0
- package/migrations/0125_artifact_public_sha_index.sql +1 -0
- package/migrations/meta/0124_snapshot.json +5516 -0
- package/migrations/meta/0125_snapshot.json +5516 -0
- package/migrations/meta/_journal.json +14 -0
- package/package.json +7 -7
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { Ms as runWithSlackInstallationToken } from "./projection-jZSlEAXG.js";
|
|
2
|
+
import { tt as getStateAdapter } from "./db-CFZggNoy.js";
|
|
3
3
|
// src/chat/slack/adapter-context.ts
|
|
4
4
|
const initializedAdapters = /* @__PURE__ */ new WeakSet();
|
|
5
5
|
async function getConnectedState(stateAdapter) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { o as getDb } from "./db-
|
|
2
|
-
import { r as listAdminUsersFromSql, u as setUserAdminFromSql } from "./viewer-
|
|
1
|
+
import { o as getDb } from "./db-CFZggNoy.js";
|
|
2
|
+
import { r as listAdminUsersFromSql, u as setUserAdminFromSql } from "./viewer-AHldghAD.js";
|
|
3
3
|
import { CLI_USAGE } from "./cli/run.js";
|
|
4
4
|
// src/cli/admin.ts
|
|
5
5
|
/**
|
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
import { $
|
|
2
|
-
import { $ as getProviderErrorAttributes, F as textCharsForTokens, G as readParentAgentTask, I as COMPACTION_SUMMARY_PREFIX, L as hasCompactedConversationContext, M as estimateMessagesTokens, N as estimateRequestOverheadTokens, P as estimateTextTokens, Q as findProviderError, R as isCompactionSummaryText, V as unwrapCurrentInstruction, X as createAssistantProviderError, Y as ProviderError, Z as createProviderError, at as bufferBody, b as GEN_AI_PROVIDER_NAME, et as getProviderErrorUserMessage, j as requestPrefixAttributes, k as resolveGatewayModel, n as botConfig, nt as isProviderRetryError, q as renderThreadContext, rt as getGatewayApiKey, tt as isProviderRefusal, v as toPiReasoningLevel, x as GEN_AI_SERVER_ADDRESS, y as normalizeSlackEmojiName } from "./config-
|
|
1
|
+
import { $ as loadTurnCheckpoint, $i as getSandboxProvider, $n as extractAssistantText, $s as readScheduledAutomation, $t as TurnSliceLimitExceededError, Aa as PluginToolDeniedError, B as getAgentContextInputLimitTokens, Ba as sandboxSkillFile, Cc as saveEventAutomation, Co as readLiveAttachment, Cs as SlackActionError, Da as SANDBOX_RUNTIME, Do as storeAttachments, Fs as sleep, G as AuthPausePersistenceError, H as PluginCredentialFailureError, Ha as buildCommandScript, Hs as normalizeSlackReplyMarkdown, Ia as SANDBOX_SCRATCH_ROOT, Ii as renderToolResultNudge, Ir as getReviewItem, J as abandonReplacedPendingAuth, K as AuthorizationFlowDisabledError, L as calculateContextCompactionTargetTokens, La as SANDBOX_SKILLS_ROOT, Na as SANDBOX_COMMAND_PATH, Nn as getPluginTools, No as createConversationEmbedder, Oa as tryWorkspaceRepoCheckoutPath, On as createPluginHookRunner, Oo as storeDeferredAttachment, Os as isConversationScopedChannel, Pa as SANDBOX_DATA_ROOT, Q as continuableMessages, Qi as ensureDockerDaemon, Qt as TurnBudgetExceededError, R as getAgentBackgroundCompactionMarkTokens, Ra as SANDBOX_WORKSPACE_ROOT, Sn as createUserTokenStore, Ta as resolveSandboxCommandEnvironment, U as createPluginAuthOrchestration, Ua as buildNonInteractiveShellScript, V as createPluginEgress, Va as sandboxSkillPathResolution, Vn as isEventEmbeddingsEnabled, Vo as resolveUserTimezone, W as authorizationId, Wa as runNonInteractiveCommand, Xc as isToolInputError, Xi as hash, Xt as GATED_TURN_LIMIT_WRAP_UP_MESSAGE, Y as canReusePendingAuthLink, Yc as ToolInputError, Ys as createScheduledAutomation, Zt as TURN_LIMIT_WRAP_UP_MESSAGE, _a as workspaceSnapshotNotReadyUserMessage, _c as createEventAutomation, _l as historyItemFromPiMessage, _n as CODE_MODE_CALL_STATUS_TEXT, a as loadConversationSkillNames, an as isAnswerToolName, ba as consumeSandboxEgressPermissionDeniedSignal, bc as getEventAutomation, bl as getConfigDefaults, ca as SandboxCallTimeoutError, cc as getDashboardReviewItemLink, cr as isStandaloneRuntimeContextMessage, da as isAlreadyExistsError, di as getSlackToolContext, dn as sanitizeAssistantText, dr as normalizeToolNameFromResult, ea as isRetryableSandboxFailure, ec as saveScheduledAutomation, en as TurnToolCallLimitExceededError, er as getPiMessageRole, fa as throwSandboxOperationError, fl as credentialAuditAttributes, fn as NO_REPLY_TOOL_NAME, fr as retainRuntimeTurnContext, g as recordSkillLoaded, ga as isWorkspaceSnapshotNotReadyError, gn as CODEMODE_TOOL_NAME, gr as REQUEST_CONTEXT_SECTION_TAG, h as recordMcpProviderConnected, ha as getWorkspaceSnapshotNotReadyError, hn as readNoReply, hr as CAPABILITY_SECTION_TAG, hs as postSlackMessage, i as loadConversationProjection, ia as formatProviderLabel, in as REPLY_TOOL_NAME, ir as hasTurnInput, ko as AttachmentSourceUnavailableError, l as recordAgentsInstructionsUpdated, la as findInErrorChain, ln as decideReply, lr as isToolResultError, ls as addReactionToMessage, m as recordGuardianActionReviewed, mn as isLegacyNoReplyMarker, mr as trimTrailingAssistantMessages, nn as createTurnLimitGate, nr as getUserMessageInstructionText, nt as saveTurnCheckpoint, oa as resolveBaseUrl, on as readTurnAnswer, or as isAssistantMessage, p as recordAuthorizationRequested, pa as wrapSandboxSetupError, pl as credentialAuditSource, pr as stripRuntimeTurnContext, q as AuthorizationPauseError, qc as automationRevision, r as loadConnectedMcpProviders, ra as deliverOAuthAuthorization, rn as isTurnExecutionLimitExceededError, sn as remindMissingAnswer, sr as isContinuablePiBoundary, tr as getTerminalAssistantMessages, u as recordAttachmentsDelivered, ui as resolveChannelCapabilities, ul as resolveTaskTitle, un as getAssistantReplyText, ur as isToolResultMessage, us as deleteSlackMessage, v as recordToolExecutionStarted, va as clearSandboxEgressSignals, vl as piMessageFromHistoryItem, vn as REPORT_BLOCKED_TOOL_NAME, vo as readSlackAttachmentSource, vs as updateSlackMessage, wa as buildSandboxEgressNetworkPolicy, xa as createSandboxEgressCredentialToken, ya as consumeSandboxEgressAuthRequiredSignal, yl as projectConversationEvents, yn as readBlockedReport, ys as uploadFilesToConversation, z as getAgentContextCompactionTriggerTokens, za as sandboxSkillDir, zi as getWorkspace, zs as escapeSlackMrkdwnText } from "./projection-jZSlEAXG.js";
|
|
2
|
+
import { $ as getProviderErrorAttributes, F as textCharsForTokens, G as readParentAgentTask, I as COMPACTION_SUMMARY_PREFIX, L as hasCompactedConversationContext, M as estimateMessagesTokens, N as estimateRequestOverheadTokens, P as estimateTextTokens, Q as findProviderError, R as isCompactionSummaryText, V as unwrapCurrentInstruction, X as createAssistantProviderError, Y as ProviderError, Z as createProviderError, at as bufferBody, b as GEN_AI_PROVIDER_NAME, et as getProviderErrorUserMessage, j as requestPrefixAttributes, k as resolveGatewayModel, n as botConfig, nt as isProviderRetryError, q as renderThreadContext, rt as getGatewayApiKey, tt as isProviderRefusal, v as toPiReasoningLevel, x as GEN_AI_SERVER_ADDRESS, y as normalizeSlackEmojiName } from "./config-Dkt2Le2b.js";
|
|
3
3
|
import { t as mapBounded } from "./fan-out-Cod-yEHG.js";
|
|
4
|
-
import { C as summarizeMessageText, E as withSpan, H as runWithLogAttributes, S as setTags, T as withLogContext, _ as runBestEffort, a as extractGenAiUsageSummary, b as setSpanAttributes, d as logAudit, f as logError, g as normalizeGenAiFinishReason, h as logWarn, i as extractGenAiUsageAttributes, l as getLogContextAttributesForSpan, m as logInfo, p as logException, t as buildTurnFailureResponse, u as getTracePropagationHeaders, v as serializeGenAiAttribute, x as setSpanStatus } from "./logging-
|
|
4
|
+
import { C as summarizeMessageText, E as withSpan, H as runWithLogAttributes, S as setTags, T as withLogContext, _ as runBestEffort, a as extractGenAiUsageSummary, b as setSpanAttributes, d as logAudit, f as logError, g as normalizeGenAiFinishReason, h as logWarn, i as extractGenAiUsageAttributes, l as getLogContextAttributesForSpan, m as logInfo, p as logException, t as buildTurnFailureResponse, u as getTracePropagationHeaders, v as serializeGenAiAttribute, x as setSpanStatus } from "./logging-D5gkyvnK.js";
|
|
5
5
|
import { g as withActiveSpan, i as getActiveSpan, m as startInactiveSpan } from "./sentry-CPbZjomA.js";
|
|
6
|
-
import { a as toCanonicalInputMessage, c as toGenAiPayloadMetadata, i as runWithConversationPrivacy, l as toGenAiPayloadTraceAttributes, o as toCanonicalOutputMessage, r as resolveConversationPrivacy, s as toGenAiMessagesTraceAttributes } from "./conversation-privacy-
|
|
6
|
+
import { a as toCanonicalInputMessage, c as toGenAiPayloadMetadata, i as runWithConversationPrivacy, l as toGenAiPayloadTraceAttributes, o as toCanonicalOutputMessage, r as resolveConversationPrivacy, s as toGenAiMessagesTraceAttributes } from "./conversation-privacy-C39g8BY4.js";
|
|
7
7
|
import { f as parseSlackTeamId, n as createSlackActor, o as isUserActor, p as parseSlackUserId, v as parseSlackMessageTs } from "./actor-BsBdxDXQ.js";
|
|
8
|
-
import {
|
|
9
|
-
import { H as juniorArtifacts, R as juniorConversations, d as juniorReviewItemSlackCards, p as juniorAutomationRuns } from "./executor-
|
|
10
|
-
import { d as contextProvenance, f as instructionActors, m as sameActorIdentity, p as instructionProvenanceFor } from "./history-
|
|
8
|
+
import { A as turnBehavior, D as isTopLevelKind, E as isPersonInput, Et as nextDetailVersion, St as hasAgentTurnUsage, T as dispatchInstructionsInvokeSkills, a as getConversationStore, jt as sameDestination, k as promptModeTurnTools, o as getDb, r as getConversationEventStore, s as getSqlExecutor, st as withLock, tt as getStateAdapter, vt as addAgentTurnUsage, yt as agentTurnCostUsd } from "./db-CFZggNoy.js";
|
|
9
|
+
import { H as juniorArtifacts, R as juniorConversations, d as juniorReviewItemSlackCards, p as juniorAutomationRuns } from "./executor-BPkZDx5-.js";
|
|
10
|
+
import { d as contextProvenance, f as instructionActors, m as sameActorIdentity, p as instructionProvenanceFor } from "./history-CYstOMKX.js";
|
|
11
11
|
import { a as listReferenceFiles } from "./package-discovery-DD9vencX.js";
|
|
12
|
-
import {
|
|
13
|
-
import { _ as credentialUserSubjectId, c as OAuthProviderError, f as actorLogContext, i as resolvePluginHeaderEnvRefs, l as fetchWithBoundedOAuthErrorBodies, u as getOAuthProviderErrorAttributes } from "./registry-
|
|
14
|
-
import { n as pluginCatalogRuntime } from "./catalog-runtime-
|
|
15
|
-
import { C as McpProviderError, D as getMcpAwareTelemetryMessage, E as getMcpAwareErrorType, O as getMcpProviderErrorAttributes, S as putMcpStoredOAuthCredentials, T as McpToolError, _ as getMcpServerSessionId, a as serviceAccountOnly, b as putMcpAuthSession, c as createMcpServiceAccountClientProvider, d as PluginMcpClient, f as deleteMcpAuthSession, g as getMcpAuthSession, i as serviceAccountAllows, k as toMcpProviderError, l as getMcpServiceAccountCredentials, m as deleteMcpServerSessionId, u as McpAuthorizationRequiredError, v as getMcpStoredOAuthCredentials, w as McpServiceAccountRequiredError, x as putMcpServerSessionId, y as patchMcpAuthSession } from "./service-account-
|
|
16
|
-
import { d as completeText, g as NoAudioError, h as transcribeFromUrl, p as generateImages, u as completeObject } from "./prompt-
|
|
17
|
-
import { A as automationContextToolSchema, B as compileScheduleIntent, I as SCHEDULED_AUTOMATION_SYSTEM_ACTOR, M as automationTitleSchema, N as taskOutcomeInputSchema, V as scheduleIntentFromTool, X as automationTaskDescription, j as automationInstructionToolSchema, z as ScheduleIntentError } from "./schedule-
|
|
18
|
-
import { Z as MAX_ATTACHMENT_BYTES } from "./conversation-
|
|
19
|
-
import { a as readActorIdentityFromSql, i as readActorIdentity } from "./viewer-
|
|
20
|
-
import { c as QUEUE_SIGNATURE_MAX_AGE_MS } from "./task-queue-
|
|
21
|
-
import { At as
|
|
22
|
-
import { $ as createUpdatePlanTool, $n as createSlackPublicSearchTool, $r as requireToolCaller, Ar as createSearchAutomationsTool, B as createStopWatchingResourcesTool, Br as automationToolResultSchema, C as createWorkspaceTools, Ci as requireAutomationSkill, Cr as createSlackCanvasEditTool, Di as moveTaskOutcomes, Dr as resolveWorkspacePath, E as ensureWorkspaceSnapshotBuild, Er as positiveInteger, F as createUserLookupTool, Fr as zodTool, Ft as createListWatchesTool, G as createReadFileTool, Gr as triggerKind, H as createSearchConversationEventsTool, Hr as automationTriggerSchema, I as userLookupIdentityProviders, Ir as zodToolDefinition, J as TOOL_RESULT_MAX_CHARS, Jr as makeStructuredToolOutput, K as missingFileResult, Kr as injectContinuationToolName, Kt as listAgentInvocationsForConversation, L as createUpdateUserCustomizationTool, Lr as automationIdForToolCall, M as createWebFetchTool, Mr as createDeleteAutomationTool, N as createWatchTimerTool, Nr as AUTOMATIONS_TOOL_SOURCE, Nt as createReadConversationEventTool, O as requireReadyWorkspaceSnapshot, Oi as resolveTaskOutcomes, Or as createOperationKey, P as createWatchEventsTool, Pr as parseToolInput, Pt as createRunOperatorSqlTool, Q as createBashTool, Qr as requireToolAutomation, R as createSubmitFeedbackTool, Rr as automationSkillToolSchema, S as enabledMode, Sr as createSlackCanvasReadTool, Ti as missingAutomationSkillReason, Tr as isMissingPathError, U as createSearchConversationsTool, Ur as editedAutomationTask, V as createSearchEventTypesTool, Vr as automationTriggerChangesSchema, W as createWriteFileTool, Wn as createSetConversationSubscriptionTool, Wr as newAutomationTask, X as createEditFileTool, Xr as automationToolContext, Y as capToolResult, Yn as createSlackThreadReadTool, Yr as getConversationAccess, Z as editFile, Zr as automationToolsDisabledReason, _i as editEventAutomation, a as createCacheWarmingRecorder, ar as createSlackConversationSearchChannelPort, at as createReplyTool, ct as createArchiveAgentTool, dr as resolveSlackChannelRef, ei as requireToolCreator, er as createSlackListUpdateItemTool, et as createStopAgentTool, fr as slackChannelRefParam, gi as editScheduledAutomation, gt as createUpdateReviewItemTool, ht as createSearchReviewItemsTool, ii as changeAutomationLifecycle, ir as createSlackConversationMessageSearchTool, it as createReportBlockedTool, j as createWebSearchTool, jr as createRunAutomationNowTool, k as prepareWorkspaceSnapshot, kr as createCanvas, mr as joinPublicChannelForRead, mt as createAddReviewItemTool, nr as createSlackListCreateTool, nt as createListAgentsTool, or as createSlackChannelListMessagesTool, ot as createNoReplyTool, pr as checkSlackChannelReadAccess, q as sliceFileContent, qr as juniorToolOutputSchema, ri as automationEditor, rn as isParentMessageMeta, rr as createSlackListAddItemsTool, rt as createReportProgressTool, st as createMessageAgentTool, ti as requireToolDestination, tr as createSlackListGetItemsTool, tt as createSpawnAgentTool, ur as createSlackChannelJoinTool, vi as changedEventMatch, w as incrementStat, wr as SLACK_TOOL_SOURCE, x as coreToolSlots, xi as requireAutomationTaskText, xr as createSlackCanvasWriteTool, yi as requireEventAutomationTrigger, z as createSystemTimeTool, zr as automationToolResult } from "./warmup-
|
|
12
|
+
import { n as findSkillByName, o as parseSkillInvocations, r as loadSkillsByName, t as discoverSkills } from "./skills-C8Npu5zO.js";
|
|
13
|
+
import { _ as credentialUserSubjectId, c as OAuthProviderError, f as actorLogContext, i as resolvePluginHeaderEnvRefs, l as fetchWithBoundedOAuthErrorBodies, u as getOAuthProviderErrorAttributes } from "./registry-BBkWFCl8.js";
|
|
14
|
+
import { n as pluginCatalogRuntime } from "./catalog-runtime-BxwzbLKY.js";
|
|
15
|
+
import { C as McpProviderError, D as getMcpAwareTelemetryMessage, E as getMcpAwareErrorType, O as getMcpProviderErrorAttributes, S as putMcpStoredOAuthCredentials, T as McpToolError, _ as getMcpServerSessionId, a as serviceAccountOnly, b as putMcpAuthSession, c as createMcpServiceAccountClientProvider, d as PluginMcpClient, f as deleteMcpAuthSession, g as getMcpAuthSession, i as serviceAccountAllows, k as toMcpProviderError, l as getMcpServiceAccountCredentials, m as deleteMcpServerSessionId, u as McpAuthorizationRequiredError, v as getMcpStoredOAuthCredentials, w as McpServiceAccountRequiredError, x as putMcpServerSessionId, y as patchMcpAuthSession } from "./service-account-Zc5bUcIJ.js";
|
|
16
|
+
import { d as completeText, g as NoAudioError, h as transcribeFromUrl, p as generateImages, u as completeObject } from "./prompt-CaMyeCpA.js";
|
|
17
|
+
import { A as automationContextToolSchema, B as compileScheduleIntent, I as SCHEDULED_AUTOMATION_SYSTEM_ACTOR, M as automationTitleSchema, N as taskOutcomeInputSchema, V as scheduleIntentFromTool, X as automationTaskDescription, j as automationInstructionToolSchema, z as ScheduleIntentError } from "./schedule-DWxZ3kja.js";
|
|
18
|
+
import { Z as MAX_ATTACHMENT_BYTES } from "./conversation-M9KZ5JxF.js";
|
|
19
|
+
import { a as readActorIdentityFromSql, i as readActorIdentity } from "./viewer-AHldghAD.js";
|
|
20
|
+
import { c as QUEUE_SIGNATURE_MAX_AGE_MS } from "./task-queue-CaZffYaH.js";
|
|
21
|
+
import { At as buildAgentsInstructionsMessage, C as PLAN_DELTA_TAG, Dt as JUNIOR_PERSONALITY, Ft as foldLeadingSystemMessages, It as foldSystemMessages, Lt as readAgentHistory, Mt as readRepositoryInstructions, Nt as renderAgentsInstructions, Ot as AGENTS_REMOVAL_NOTICE, Pt as showsAgentsInstructions, Rt as withAgentRequest, T as renderPlanSnapshot, X as resolveBotSlackTeamId, Z as readTaskInstructions, _t as requireSlackChannelMessageScope, d as buildPromptInput, f as buildSteeringPiMessage, h as loadPromptTurnContext, ht as getEventCatalog, jt as findVisibleAgentsInstructions, kt as AGENTS_REPLACEMENT_NOTICE, tt as resolveSlackReplyTarget, u as assemblePrompt, x as listPlanItems, xt as slackChannelMessageTrigger, zt as writeAgentHistory } from "./session-stop-BfY4rhJs.js";
|
|
22
|
+
import { $ as createUpdatePlanTool, $n as createSlackPublicSearchTool, $r as requireToolCaller, Ar as createSearchAutomationsTool, B as createStopWatchingResourcesTool, Br as automationToolResultSchema, C as createWorkspaceTools, Ci as requireAutomationSkill, Cr as createSlackCanvasEditTool, Di as moveTaskOutcomes, Dr as resolveWorkspacePath, E as ensureWorkspaceSnapshotBuild, Er as positiveInteger, F as createUserLookupTool, Fr as zodTool, Ft as createListWatchesTool, G as createReadFileTool, Gr as triggerKind, H as createSearchConversationEventsTool, Hr as automationTriggerSchema, I as userLookupIdentityProviders, Ir as zodToolDefinition, J as TOOL_RESULT_MAX_CHARS, Jr as makeStructuredToolOutput, K as missingFileResult, Kr as injectContinuationToolName, Kt as listAgentInvocationsForConversation, L as createUpdateUserCustomizationTool, Lr as automationIdForToolCall, M as createWebFetchTool, Mr as createDeleteAutomationTool, N as createWatchTimerTool, Nr as AUTOMATIONS_TOOL_SOURCE, Nt as createReadConversationEventTool, O as requireReadyWorkspaceSnapshot, Oi as resolveTaskOutcomes, Or as createOperationKey, P as createWatchEventsTool, Pr as parseToolInput, Pt as createRunOperatorSqlTool, Q as createBashTool, Qr as requireToolAutomation, R as createSubmitFeedbackTool, Rr as automationSkillToolSchema, S as enabledMode, Sr as createSlackCanvasReadTool, Ti as missingAutomationSkillReason, Tr as isMissingPathError, U as createSearchConversationsTool, Ur as editedAutomationTask, V as createSearchEventTypesTool, Vr as automationTriggerChangesSchema, W as createWriteFileTool, Wn as createSetConversationSubscriptionTool, Wr as newAutomationTask, X as createEditFileTool, Xr as automationToolContext, Y as capToolResult, Yn as createSlackThreadReadTool, Yr as getConversationAccess, Z as editFile, Zr as automationToolsDisabledReason, _i as editEventAutomation, a as createCacheWarmingRecorder, ar as createSlackConversationSearchChannelPort, at as createReplyTool, ct as createArchiveAgentTool, dr as resolveSlackChannelRef, ei as requireToolCreator, er as createSlackListUpdateItemTool, et as createStopAgentTool, fr as slackChannelRefParam, gi as editScheduledAutomation, gt as createUpdateReviewItemTool, ht as createSearchReviewItemsTool, ii as changeAutomationLifecycle, ir as createSlackConversationMessageSearchTool, it as createReportBlockedTool, j as createWebSearchTool, jr as createRunAutomationNowTool, k as prepareWorkspaceSnapshot, kr as createCanvas, mr as joinPublicChannelForRead, mt as createAddReviewItemTool, nr as createSlackListCreateTool, nt as createListAgentsTool, or as createSlackChannelListMessagesTool, ot as createNoReplyTool, pr as checkSlackChannelReadAccess, q as sliceFileContent, qr as juniorToolOutputSchema, ri as automationEditor, rn as isParentMessageMeta, rr as createSlackListAddItemsTool, rt as createReportProgressTool, st as createMessageAgentTool, ti as requireToolDestination, tr as createSlackListGetItemsTool, tt as createSpawnAgentTool, ur as createSlackChannelJoinTool, vi as changedEventMatch, w as incrementStat, wr as SLACK_TOOL_SOURCE, x as coreToolSlots, xi as requireAutomationTaskText, xr as createSlackCanvasWriteTool, yi as requireEventAutomationTrigger, z as createSystemTimeTool, zr as automationToolResult } from "./warmup-C6LOZ2d2.js";
|
|
23
23
|
import { a as USER_INPUT_LIMITS, i as AGENT_INVOCATION_STATUSES, m as detectImageMediaType, o as USER_INPUT_NOTE, s as buttonUserInputField, u as normalizeUserInputAnswer } from "./web-message-id-BT8Mg8LL.js";
|
|
24
|
-
import { d as isTurnInputCommitLostError, o as CooperativeTurnYieldError, s as TurnInputCommitLostError } from "./turn-user-message-
|
|
25
|
-
import { m as getVercelConversationWorkQueue, n as backgroundCompactionId } from "./background-compaction-queue-
|
|
26
|
-
import { t as resolveConversationRouting } from "./turn-session-routing-
|
|
27
|
-
import { o as getSandboxResources, r as setSnapshotSpanAttributes } from "./install-
|
|
28
|
-
import { n as resolve$1 } from "./resolve-
|
|
29
|
-
import { t as runWithSlackInstallation } from "./adapter-context-
|
|
24
|
+
import { d as isTurnInputCommitLostError, o as CooperativeTurnYieldError, s as TurnInputCommitLostError } from "./turn-user-message-9IxeEv5v.js";
|
|
25
|
+
import { m as getVercelConversationWorkQueue, n as backgroundCompactionId } from "./background-compaction-queue-BGHqkhkY.js";
|
|
26
|
+
import { t as resolveConversationRouting } from "./turn-session-routing-CD0BRCex.js";
|
|
27
|
+
import { o as getSandboxResources, r as setSnapshotSpanAttributes } from "./install-C-oE6C_u.js";
|
|
28
|
+
import { n as resolve$1 } from "./resolve-B38MkHXE.js";
|
|
29
|
+
import { t as runWithSlackInstallation } from "./adapter-context-BhKpjpGD.js";
|
|
30
30
|
import { n as privateTraceResultAttributes } from "./private-trace-result-CE7_lEdq.js";
|
|
31
31
|
import * as z from "zod";
|
|
32
32
|
import pLimit from "p-limit";
|
|
@@ -1444,31 +1444,26 @@ function actionConfirmationRetryMessages(messages) {
|
|
|
1444
1444
|
return retryMessages;
|
|
1445
1445
|
}
|
|
1446
1446
|
// src/chat/agent/skills.ts
|
|
1447
|
-
/** Run-scoped skill discovery and explicit invocation. */
|
|
1448
1447
|
let startupDiscoveryLogged = false;
|
|
1449
|
-
/** Upsert a skill into the active skills list by name. */
|
|
1450
|
-
function upsertActiveSkill(activeSkills, next) {
|
|
1451
|
-
const existing = activeSkills.find((skill) => skill.name === next.name);
|
|
1452
|
-
if (existing) {
|
|
1453
|
-
existing.body = next.body;
|
|
1454
|
-
existing.description = next.description;
|
|
1455
|
-
existing.skillPath = next.skillPath;
|
|
1456
|
-
existing.allowedTools = next.allowedTools;
|
|
1457
|
-
existing.pluginProvider = next.pluginProvider;
|
|
1458
|
-
return;
|
|
1459
|
-
}
|
|
1460
|
-
activeSkills.push(next);
|
|
1461
|
-
}
|
|
1462
1448
|
/**
|
|
1463
1449
|
* Return the skills that the model can load with `loadSkill`. A manual-only
|
|
1464
|
-
* skill is loadable only
|
|
1465
|
-
*
|
|
1466
|
-
* SKILL.md instructions.
|
|
1467
|
-
*
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1450
|
+
* skill is loadable only when the Turn's message invokes it, when `loadSkill`
|
|
1451
|
+
* loaded it earlier in the Conversation, or when a loadable skill references
|
|
1452
|
+
* it as `$name` in its SKILL.md instructions. The model can load any loadable
|
|
1453
|
+
* skill at any time, so the list is fixed for the Turn. No other text, such
|
|
1454
|
+
* as memory, thread messages, or tool results, unlocks one.
|
|
1455
|
+
*/
|
|
1456
|
+
function loadableSkills(availableSkills, invokedSkillNames) {
|
|
1457
|
+
const byName = new Map(availableSkills.map((skill) => [skill.name, skill]));
|
|
1458
|
+
const unlocked = /* @__PURE__ */ new Set();
|
|
1459
|
+
const pending = [...invokedSkillNames, ...availableSkills.filter((skill) => skill.disableModelInvocation !== true).map((skill) => skill.name)];
|
|
1460
|
+
for (let name = pending.pop(); name !== void 0; name = pending.pop()) {
|
|
1461
|
+
const skill = byName.get(name);
|
|
1462
|
+
if (!skill || unlocked.has(name)) continue;
|
|
1463
|
+
unlocked.add(name);
|
|
1464
|
+
pending.push(...skill.references ?? []);
|
|
1465
|
+
}
|
|
1466
|
+
return availableSkills.filter((skill) => unlocked.has(skill.name));
|
|
1472
1467
|
}
|
|
1473
1468
|
/** Discover skills for one slice; emits the startup discovery summary once per process. */
|
|
1474
1469
|
async function discoverRunSkills(args) {
|
|
@@ -1487,6 +1482,21 @@ async function discoverRunSkills(args) {
|
|
|
1487
1482
|
}
|
|
1488
1483
|
return availableSkills;
|
|
1489
1484
|
}
|
|
1485
|
+
/**
|
|
1486
|
+
* Return the text whose skill references unlock skills in this Run: the
|
|
1487
|
+
* person's own input, or the instructions of an Automation run. Text that no
|
|
1488
|
+
* person wrote for this Run, such as Event text, an agent result, a parent
|
|
1489
|
+
* agent task, or a plugin dispatch, unlocks nothing.
|
|
1490
|
+
*/
|
|
1491
|
+
function skillInvocationText(run, actor) {
|
|
1492
|
+
if (run.dispatch) return dispatchInstructionsInvokeSkills(run.dispatch) ? readTaskInstructions(run.instruction.text) ?? "" : "";
|
|
1493
|
+
const provenance = run.instruction.provenance ?? instructionProvenanceFor(actor);
|
|
1494
|
+
if (provenance.authority !== "instruction" || !provenance.actor || provenance.actor.platform === "system") return "";
|
|
1495
|
+
return (run.instruction.inputs ?? [{
|
|
1496
|
+
kind: "person",
|
|
1497
|
+
text: run.instruction.text
|
|
1498
|
+
}]).filter((input) => input.kind === "person").map((input) => input.text).join("\n\n");
|
|
1499
|
+
}
|
|
1490
1500
|
function lastLoadedSkillName(messages) {
|
|
1491
1501
|
for (let index = messages.length - 1; index >= 0; index -= 1) {
|
|
1492
1502
|
const message = messages[index];
|
|
@@ -1496,13 +1506,15 @@ function lastLoadedSkillName(messages) {
|
|
|
1496
1506
|
if (typeof skillName === "string" && skillName.trim()) return skillName;
|
|
1497
1507
|
}
|
|
1498
1508
|
}
|
|
1499
|
-
/**
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
return
|
|
1509
|
+
/**
|
|
1510
|
+
* Make the last skill that `loadSkill` loaded earlier in this Turn active
|
|
1511
|
+
* again in a resumed slice, so its tool limits and files still apply. Skills
|
|
1512
|
+
* from earlier Turns are never restored.
|
|
1513
|
+
*/
|
|
1514
|
+
async function restoreActiveSkill(args) {
|
|
1515
|
+
if (!args.resumed) return;
|
|
1516
|
+
const skillName = lastLoadedSkillName(args.currentTurnMessages);
|
|
1517
|
+
if (skillName) await args.skillSandbox.loadSkill(skillName);
|
|
1506
1518
|
}
|
|
1507
1519
|
// src/chat/capabilities/jr-rpc-command.ts
|
|
1508
1520
|
function commandResult(input) {
|
|
@@ -4205,7 +4217,11 @@ function createLoadSkillTool(availableSkills, options) {
|
|
|
4205
4217
|
const result = await loadSkillFromHost(availableSkills, skill_name);
|
|
4206
4218
|
const loadedSkill = toLoadedSkill(result, availableSkills);
|
|
4207
4219
|
if (loadedSkill) await options?.onSkillLoaded?.(loadedSkill);
|
|
4208
|
-
|
|
4220
|
+
const loadable = (availableSkills.find((skill) => skill.name === result.skill_name)?.references ?? []).filter((name) => name !== result.skill_name && availableSkills.some((skill) => skill.name === name && skill.disableModelInvocation));
|
|
4221
|
+
return loadable.length > 0 ? {
|
|
4222
|
+
...result,
|
|
4223
|
+
loadable_skills: loadable
|
|
4224
|
+
} : result;
|
|
4209
4225
|
}
|
|
4210
4226
|
});
|
|
4211
4227
|
}
|
|
@@ -5153,6 +5169,78 @@ function createSlackCanvasCreateTool(context, state) {
|
|
|
5153
5169
|
}
|
|
5154
5170
|
});
|
|
5155
5171
|
}
|
|
5172
|
+
// src/chat/automations/tool-destination.ts
|
|
5173
|
+
/** Model-facing Destination of a new or moved Automation. */
|
|
5174
|
+
const automationDestinationParam = slackChannelRefParam.describe("Slack channel: \"current_conversation\" (this conversation's channel or DM) or a public channel id, mention, or known name, only one the user named. Never a web conversation.");
|
|
5175
|
+
/**
|
|
5176
|
+
* Return the Slack workspace of a new Destination. A Conversation with no
|
|
5177
|
+
* Slack Location, such as a web Conversation, binds no workspace token, so
|
|
5178
|
+
* Slack calls use the single bot token. It can reach only that token's
|
|
5179
|
+
* workspace, and only for a caller with a linked Slack account there.
|
|
5180
|
+
*/
|
|
5181
|
+
async function requireDestinationTeamId(context, caller) {
|
|
5182
|
+
if (context.destination) {
|
|
5183
|
+
const teamId = parseSlackTeamId(context.destination.teamId);
|
|
5184
|
+
if (!teamId) throw new ToolInputError("Slack workspace is unavailable.");
|
|
5185
|
+
return teamId;
|
|
5186
|
+
}
|
|
5187
|
+
const teamId = parseSlackTeamId(await resolveBotSlackTeamId());
|
|
5188
|
+
if (!teamId) throw new ToolInputError("No Slack workspace can be chosen from this conversation. Ask from the Slack channel where the automation should deliver.");
|
|
5189
|
+
if (!caller.viewer.identities.some((identity) => identity.provider === "slack" && identity.providerTenantId === teamId)) throw new ToolInputError("An automation delivers to Slack, and your account has no linked Slack account in this workspace. Link Slack, or ask from the Slack channel where it should deliver.");
|
|
5190
|
+
return teamId;
|
|
5191
|
+
}
|
|
5192
|
+
/**
|
|
5193
|
+
* Resolve where a new or moved Automation delivers. "current_conversation"
|
|
5194
|
+
* is the channel or DM of this Conversation. A channel reference must name a
|
|
5195
|
+
* public Slack channel, and Junior joins it so the Automation can post there.
|
|
5196
|
+
* A private channel or DM can be a Destination only from there, so a web
|
|
5197
|
+
* Conversation can name only a public channel.
|
|
5198
|
+
*/
|
|
5199
|
+
async function resolveToolDestination(context, caller, value) {
|
|
5200
|
+
if (value === "current_conversation") return {
|
|
5201
|
+
destination: requireToolDestination(context),
|
|
5202
|
+
visibility: context.visibility
|
|
5203
|
+
};
|
|
5204
|
+
const teamId = await requireDestinationTeamId(context, caller);
|
|
5205
|
+
const { channelId, channelName } = await resolveSlackChannelRef({
|
|
5206
|
+
field: "destination",
|
|
5207
|
+
value,
|
|
5208
|
+
teamId
|
|
5209
|
+
});
|
|
5210
|
+
const here = context.destination;
|
|
5211
|
+
if (here && channelId === here.channelId) return {
|
|
5212
|
+
destination: here,
|
|
5213
|
+
visibility: context.visibility
|
|
5214
|
+
};
|
|
5215
|
+
const access = await checkSlackChannelReadAccess({
|
|
5216
|
+
currentChannelIds: [],
|
|
5217
|
+
targetChannelId: channelId,
|
|
5218
|
+
teamId
|
|
5219
|
+
});
|
|
5220
|
+
if (!access.allowed) throw new ToolInputError(access.reason === "private" ? "Only a public channel can be named as a destination. For a private channel or DM, ask from there." : access.error);
|
|
5221
|
+
if (access.isMember !== true) {
|
|
5222
|
+
const joined = await joinPublicChannelForRead({
|
|
5223
|
+
targetChannelId: channelId,
|
|
5224
|
+
...channelName ? { channelName } : void 0
|
|
5225
|
+
});
|
|
5226
|
+
if (!joined.ok) throw new ToolInputError(joined.error);
|
|
5227
|
+
}
|
|
5228
|
+
const destination = {
|
|
5229
|
+
platform: "slack",
|
|
5230
|
+
teamId,
|
|
5231
|
+
channelId
|
|
5232
|
+
};
|
|
5233
|
+
const name = access.channelName ?? channelName;
|
|
5234
|
+
await getConversationStore().recordDestinationVisibility({
|
|
5235
|
+
destination,
|
|
5236
|
+
...name ? { channelName: name } : void 0,
|
|
5237
|
+
visibility: "public"
|
|
5238
|
+
});
|
|
5239
|
+
return {
|
|
5240
|
+
destination,
|
|
5241
|
+
visibility: "public"
|
|
5242
|
+
};
|
|
5243
|
+
}
|
|
5156
5244
|
// src/chat/scheduled-automations/telemetry.ts
|
|
5157
5245
|
/** Safe structured telemetry attributes for scheduled-automation lifecycle events. */
|
|
5158
5246
|
/** Correlation attributes shared by scheduled-automation create and run events. */
|
|
@@ -5219,7 +5307,7 @@ async function createScheduled(context, next, compiled) {
|
|
|
5219
5307
|
updatedAtMs: nowMs,
|
|
5220
5308
|
createdBy: next.creator.createdBy,
|
|
5221
5309
|
creatorIdentityId: next.creator.identity.id,
|
|
5222
|
-
conversationAccess: getConversationAccess(destination,
|
|
5310
|
+
conversationAccess: getConversationAccess(destination, next.visibility),
|
|
5223
5311
|
credentialMode: next.credentialMode,
|
|
5224
5312
|
destination,
|
|
5225
5313
|
executionActor: SCHEDULED_AUTOMATION_SYSTEM_ACTOR,
|
|
@@ -5238,12 +5326,12 @@ async function createScheduled(context, next, compiled) {
|
|
|
5238
5326
|
ownedByViewer: true
|
|
5239
5327
|
};
|
|
5240
5328
|
}
|
|
5241
|
-
async function createEvent(
|
|
5329
|
+
async function createEvent(next, trigger) {
|
|
5242
5330
|
return {
|
|
5243
5331
|
kind: "event",
|
|
5244
5332
|
task: await createEventAutomation(getDb(), requireSlackChannelMessageScope({
|
|
5245
5333
|
id: next.id,
|
|
5246
|
-
destinationVisibility:
|
|
5334
|
+
destinationVisibility: next.visibility === "public" ? "public" : "private",
|
|
5247
5335
|
createdAtMs: next.nowMs,
|
|
5248
5336
|
createdBy: next.creator.createdBy,
|
|
5249
5337
|
creatorIdentityId: next.creator.identity.id,
|
|
@@ -5293,7 +5381,7 @@ function createAutomationTool(context, catalog, skills = []) {
|
|
|
5293
5381
|
readOnlyHint: false
|
|
5294
5382
|
},
|
|
5295
5383
|
executionMode: "sequential",
|
|
5296
|
-
description: "Create a durable automation. It
|
|
5384
|
+
description: "Create a durable automation. It delivers to a Slack channel or DM, never a thread or a web conversation. When an installed skill does the work, have the automation run that skill; do not write an instruction that names the skill. Ordinary watch, notify, or tell-me-when requests use watchEvents instead. Store the requested future work; do not perform it or check its service access now unless the user also asks for that. When the trigger is known, create it without redundant confirmation.",
|
|
5297
5385
|
inputSchema: z.object({
|
|
5298
5386
|
instruction: automationInstructionToolSchema.nullable().optional(),
|
|
5299
5387
|
skill: automationSkillToolSchema(skills).nullable().optional(),
|
|
@@ -5301,7 +5389,8 @@ function createAutomationTool(context, catalog, skills = []) {
|
|
|
5301
5389
|
title: z.string().trim().min(1).max(60).nullable().describe("Optional short display title. Omit or use null to generate one from the instruction or skill.").optional(),
|
|
5302
5390
|
trigger: trigger.describe("Use type \"schedule\" for one-time or recurring work. Use type \"event\" only when the user explicitly asks for an event automation or durable whenever-this-happens-do-X work; it runs for every matching event."),
|
|
5303
5391
|
outcomes: z.array(taskOutcomeInputSchema).max(5).describe("Successful work is silent by default: omit this or use an empty list when the Automation acts through tools without a status message. Add send_message only when the user asks for a reminder, notification, post, digest, summary, or other visible result.").optional(),
|
|
5304
|
-
credential_mode: z.enum(["creator", "system"]).nullable().describe("Omit or use null for the system default: runs use your own credentials. Use creator only when the creator asks for their connected credentials to be available to the runs.").optional()
|
|
5392
|
+
credential_mode: z.enum(["creator", "system"]).nullable().describe("Omit or use null for the system default: runs use your own credentials. Use creator only when the creator asks for their connected credentials to be available to the runs.").optional(),
|
|
5393
|
+
destination: automationDestinationParam.nullable().describe(`${automationDestinationParam.description} ${context.destination ? "Omit or use null for current_conversation." : "Required: current_conversation is unavailable here."}`).optional()
|
|
5305
5394
|
}).strict(),
|
|
5306
5395
|
prepareArguments(args) {
|
|
5307
5396
|
const prepared = { ...args };
|
|
@@ -5310,13 +5399,14 @@ function createAutomationTool(context, catalog, skills = []) {
|
|
|
5310
5399
|
if (prepared.skill == null) delete prepared.skill;
|
|
5311
5400
|
if (prepared.context == null) delete prepared.context;
|
|
5312
5401
|
if (prepared.credential_mode === null) delete prepared.credential_mode;
|
|
5402
|
+
if (prepared.destination == null) delete prepared.destination;
|
|
5313
5403
|
return prepared;
|
|
5314
5404
|
},
|
|
5315
5405
|
outputSchema: automationToolResultSchema,
|
|
5316
5406
|
async execute(input, options) {
|
|
5317
5407
|
const kind = triggerKind(input.trigger);
|
|
5318
|
-
const destination = requireToolDestination(context);
|
|
5319
5408
|
const caller = await requireToolCaller(context);
|
|
5409
|
+
const { destination, visibility } = await resolveToolDestination(context, caller, input.destination ?? "current_conversation");
|
|
5320
5410
|
const creator = requireToolCreator(caller, destination, kind);
|
|
5321
5411
|
const { createdBy } = creator;
|
|
5322
5412
|
const task = newAutomationTask({
|
|
@@ -5349,6 +5439,7 @@ function createAutomationTool(context, catalog, skills = []) {
|
|
|
5349
5439
|
const next = {
|
|
5350
5440
|
creator,
|
|
5351
5441
|
destination,
|
|
5442
|
+
visibility,
|
|
5352
5443
|
id,
|
|
5353
5444
|
nowMs,
|
|
5354
5445
|
task,
|
|
@@ -5362,7 +5453,7 @@ function createAutomationTool(context, catalog, skills = []) {
|
|
|
5362
5453
|
title: input.title
|
|
5363
5454
|
})
|
|
5364
5455
|
};
|
|
5365
|
-
return requireOwnAutomation(compiled ? await createScheduled(context, next, compiled) : await createEvent(
|
|
5456
|
+
return requireOwnAutomation(compiled ? await createScheduled(context, next, compiled) : await createEvent(next, eventTrigger));
|
|
5366
5457
|
}
|
|
5367
5458
|
});
|
|
5368
5459
|
}
|
|
@@ -5382,61 +5473,11 @@ async function resolveDestinationVisibility(args) {
|
|
|
5382
5473
|
async function requireNoIncompleteRun(automationId) {
|
|
5383
5474
|
if ((await getDb().select({ id: juniorAutomationRuns.id }).from(juniorAutomationRuns).where(and(eq(juniorAutomationRuns.automationId, automationId), inArray(juniorAutomationRuns.status, ["pending", "running"]))).limit(1)).length > 0) throw new ToolInputError("Scheduled automation cannot be moved while an occurrence is already running. Try again after the current run finishes.");
|
|
5384
5475
|
}
|
|
5385
|
-
/**
|
|
5386
|
-
* Resolve where a move goes. "current_conversation" is this Conversation. A
|
|
5387
|
-
* channel reference must name a public Slack channel in this workspace, and
|
|
5388
|
-
* Junior joins it so the Automation can post there.
|
|
5389
|
-
*/
|
|
5390
|
-
async function requireMoveDestination(context, value) {
|
|
5391
|
-
const here = requireToolDestination(context);
|
|
5392
|
-
if (value === "current_conversation") return {
|
|
5393
|
-
destination: here,
|
|
5394
|
-
visibility: context.visibility
|
|
5395
|
-
};
|
|
5396
|
-
const teamId = parseSlackTeamId(here.teamId);
|
|
5397
|
-
if (!teamId) throw new ToolInputError("Slack workspace is unavailable.");
|
|
5398
|
-
const { channelId, channelName } = await resolveSlackChannelRef({
|
|
5399
|
-
field: "destination",
|
|
5400
|
-
value,
|
|
5401
|
-
teamId
|
|
5402
|
-
});
|
|
5403
|
-
if (channelId === here.channelId) return {
|
|
5404
|
-
destination: here,
|
|
5405
|
-
visibility: context.visibility
|
|
5406
|
-
};
|
|
5407
|
-
const access = await checkSlackChannelReadAccess({
|
|
5408
|
-
currentChannelIds: [],
|
|
5409
|
-
targetChannelId: channelId,
|
|
5410
|
-
teamId
|
|
5411
|
-
});
|
|
5412
|
-
if (!access.allowed) throw new ToolInputError(access.reason === "private" ? "Only a public channel can be named as a destination. To move an automation into a private channel or DM, ask from there." : access.error);
|
|
5413
|
-
if (access.isMember !== true) {
|
|
5414
|
-
const joined = await joinPublicChannelForRead({
|
|
5415
|
-
targetChannelId: channelId,
|
|
5416
|
-
...channelName ? { channelName } : void 0
|
|
5417
|
-
});
|
|
5418
|
-
if (!joined.ok) throw new ToolInputError(joined.error);
|
|
5419
|
-
}
|
|
5420
|
-
const destination = {
|
|
5421
|
-
platform: "slack",
|
|
5422
|
-
teamId,
|
|
5423
|
-
channelId
|
|
5424
|
-
};
|
|
5425
|
-
const name = access.channelName ?? channelName;
|
|
5426
|
-
await getConversationStore().recordDestinationVisibility({
|
|
5427
|
-
destination,
|
|
5428
|
-
...name ? { channelName: name } : void 0,
|
|
5429
|
-
visibility: "public"
|
|
5430
|
-
});
|
|
5431
|
-
return {
|
|
5432
|
-
destination,
|
|
5433
|
-
visibility: "public"
|
|
5434
|
-
};
|
|
5435
|
-
}
|
|
5436
5476
|
/** Edit and save a scheduled Automation, including a move to a new Destination. */
|
|
5437
|
-
async function updateScheduled(context, current, input, editedTask, editor) {
|
|
5477
|
+
async function updateScheduled(context, caller, current, input, editedTask, editor) {
|
|
5438
5478
|
const { task, ownedByViewer: isCreator } = current;
|
|
5439
|
-
|
|
5479
|
+
if (input.destination && !context.destination) throw new ToolInputError("Move an automation from a Slack channel or DM, not from a web conversation.");
|
|
5480
|
+
const target = input.destination ? await resolveToolDestination(context, caller, input.destination) : void 0;
|
|
5440
5481
|
const destination = target?.destination;
|
|
5441
5482
|
const moving = destination !== void 0 && !sameDestination(task.destination, destination);
|
|
5442
5483
|
if (destination && !moving && Object.keys(input).every((key) => key === "destination" || key === "credential_mode" && input.credential_mode === task.credentialMode)) return current;
|
|
@@ -5504,7 +5545,7 @@ function createUpdateAutomationTool(context, catalog, skills = []) {
|
|
|
5504
5545
|
outcomes: z.array(taskOutcomeInputSchema).max(5).nullable().describe("Replacement messages to send after successful work. Use an empty list to send nothing. Omit or use null to leave unchanged.").optional(),
|
|
5505
5546
|
credential_mode: z.enum(["system", "creator"]).nullable().describe("Set creator to make the automation creator's credentials available, or system to disable them. Creator always means the automation's createdBy actor, never the current requester. Only that creator may enable creator mode. Omit or null leaves it unchanged.").optional(),
|
|
5506
5547
|
status: z.enum(["active", "paused"]).nullable().describe("Set active to resume a paused or blocked automation, or paused to stop it. When it uses its creator's credentials, only the creator can resume it. Omit or use null to leave unchanged.").optional(),
|
|
5507
|
-
destination:
|
|
5548
|
+
destination: automationDestinationParam.nullable().describe(`Where to move a scheduled automation. ${automationDestinationParam.description} Omit to keep its destination.`).optional()
|
|
5508
5549
|
}).strict();
|
|
5509
5550
|
return zodTool({
|
|
5510
5551
|
exposure: "deferred",
|
|
@@ -5541,7 +5582,7 @@ function createUpdateAutomationTool(context, catalog, skills = []) {
|
|
|
5541
5582
|
current: current.task.task
|
|
5542
5583
|
});
|
|
5543
5584
|
let saved = current;
|
|
5544
|
-
if (Object.keys(input).length > 0) saved = current.kind === "scheduled" ? await updateScheduled(context, current, input, editedTask, editor) : await updateEvent(current, input, editedTask, editor, catalog);
|
|
5585
|
+
if (Object.keys(input).length > 0) saved = current.kind === "scheduled" ? await updateScheduled(context, caller, current, input, editedTask, editor) : await updateEvent(current, input, editedTask, editor, catalog);
|
|
5545
5586
|
if (status !== void 0 && status !== saved.task.status) saved = await changeAutomationLifecycle(saved, {
|
|
5546
5587
|
action: status === "paused" ? "pause" : "resume",
|
|
5547
5588
|
revision: automationRevision(saved.task)
|
|
@@ -5608,7 +5649,7 @@ async function publishImage(args) {
|
|
|
5608
5649
|
const baseUrl = resolvePublicBaseUrl(args.publicBaseUrl);
|
|
5609
5650
|
const sha256 = createHash("sha256").update(args.body).digest("hex");
|
|
5610
5651
|
const now = args.now ?? /* @__PURE__ */ new Date();
|
|
5611
|
-
const [existing] = await args.db.db().select({ id: juniorArtifacts.id }).from(juniorArtifacts).where(and(eq(juniorArtifacts.conversationId, args.conversationId), eq(juniorArtifacts.sha256, sha256)));
|
|
5652
|
+
const [existing] = await args.db.db().select({ id: juniorArtifacts.id }).from(juniorArtifacts).where(and(eq(juniorArtifacts.conversationId, args.conversationId), eq(juniorArtifacts.sha256, sha256), eq(juniorArtifacts.visibility, "public")));
|
|
5612
5653
|
const id = existing?.id ?? randomUUID();
|
|
5613
5654
|
const storageKey = artifactKey(`${id}.${extension}`);
|
|
5614
5655
|
await args.storage.put({
|
|
@@ -5625,17 +5666,17 @@ async function publishImage(args) {
|
|
|
5625
5666
|
deleteRequestedAt: null,
|
|
5626
5667
|
ext: extension,
|
|
5627
5668
|
id,
|
|
5628
|
-
public: true,
|
|
5629
5669
|
sha256,
|
|
5630
|
-
storageKey
|
|
5670
|
+
storageKey,
|
|
5671
|
+
visibility: "public"
|
|
5631
5672
|
}).onConflictDoUpdate({
|
|
5632
5673
|
target: [juniorArtifacts.conversationId, juniorArtifacts.sha256],
|
|
5674
|
+
targetWhere: eq(juniorArtifacts.visibility, "public"),
|
|
5633
5675
|
set: {
|
|
5634
5676
|
bytes: args.body.byteLength,
|
|
5635
5677
|
contentType,
|
|
5636
5678
|
deleteRequestedAt: null,
|
|
5637
|
-
ext: extension
|
|
5638
|
-
public: true
|
|
5679
|
+
ext: extension
|
|
5639
5680
|
}
|
|
5640
5681
|
}).returning({
|
|
5641
5682
|
ext: juniorArtifacts.ext,
|
|
@@ -5668,7 +5709,7 @@ async function readPublicArtifact(args) {
|
|
|
5668
5709
|
const [row] = await args.db.db().select({
|
|
5669
5710
|
contentType: juniorArtifacts.contentType,
|
|
5670
5711
|
storageKey: juniorArtifacts.storageKey
|
|
5671
|
-
}).from(juniorArtifacts).where(and(eq(juniorArtifacts.id, parsed.id), eq(juniorArtifacts.
|
|
5712
|
+
}).from(juniorArtifacts).where(and(eq(juniorArtifacts.id, parsed.id), eq(juniorArtifacts.visibility, "public"), isNull(juniorArtifacts.deleteRequestedAt)));
|
|
5672
5713
|
if (!row) return null;
|
|
5673
5714
|
const body = await args.storage.get(row.storageKey);
|
|
5674
5715
|
if (!body) return null;
|
|
@@ -9680,8 +9721,7 @@ async function wireAgentTools(args) {
|
|
|
9680
9721
|
modelId: botConfig.guardianModelId
|
|
9681
9722
|
})
|
|
9682
9723
|
});
|
|
9683
|
-
const
|
|
9684
|
-
const tools = createTools(skills, {
|
|
9724
|
+
const tools = createTools(loadableSkills(args.availableSkills, [...args.invokedSkillNames, ...args.conversationSkillNames]), {
|
|
9685
9725
|
writeGeneratedFiles: async (files) => {
|
|
9686
9726
|
const refs = await agentSandbox.writeGeneratedFiles(files);
|
|
9687
9727
|
args.generatedFiles.push(...files);
|
|
@@ -9690,8 +9730,10 @@ async function wireAgentTools(args) {
|
|
|
9690
9730
|
toolOverrides: args.run.environment?.toolOverrides,
|
|
9691
9731
|
onSkillLoaded: async (loadedSkill) => {
|
|
9692
9732
|
const effective = await args.skillSandbox.loadSkill(loadedSkill.name) ?? loadedSkill;
|
|
9693
|
-
|
|
9694
|
-
|
|
9733
|
+
if (effective.disableModelInvocation) await recordSkillLoaded({
|
|
9734
|
+
conversationId: args.run.conversationId,
|
|
9735
|
+
skillName: effective.name
|
|
9736
|
+
});
|
|
9695
9737
|
await tryRecordSkillLoadStat(effective);
|
|
9696
9738
|
}
|
|
9697
9739
|
}, toolRuntimeContext, {
|
|
@@ -11585,11 +11627,9 @@ async function executeAgentRunInPrivacyContext(run, conversationKind, conversati
|
|
|
11585
11627
|
});
|
|
11586
11628
|
}
|
|
11587
11629
|
const dispatchSkill = run.dispatch?.skill;
|
|
11588
|
-
const
|
|
11589
|
-
|
|
11590
|
-
|
|
11591
|
-
const activeSkills = [];
|
|
11592
|
-
const skillSandbox = new SkillSandbox(availableSkills, activeSkills);
|
|
11630
|
+
const invokedSkillNames = dispatchSkill ? [dispatchSkill] : parseSkillInvocations(skillInvocationText(run, actor), availableSkills);
|
|
11631
|
+
if (dispatchSkill && !findSkillByName(dispatchSkill, availableSkills)) throw new Error(missingAutomationSkillReason(dispatchSkill));
|
|
11632
|
+
const skillSandbox = new SkillSandbox(availableSkills);
|
|
11593
11633
|
const checkpoint = await loadTurnCheckpoint({
|
|
11594
11634
|
conversationId,
|
|
11595
11635
|
turnId
|
|
@@ -11657,10 +11697,9 @@ async function executeAgentRunInPrivacyContext(run, conversationKind, conversati
|
|
|
11657
11697
|
conversationId,
|
|
11658
11698
|
credentialSubjectId: credentialUserId
|
|
11659
11699
|
}) : []);
|
|
11660
|
-
const
|
|
11661
|
-
|
|
11700
|
+
const conversationSkillNames = await loadConversationSkillNames(conversationId);
|
|
11701
|
+
await restoreActiveSkill({
|
|
11662
11702
|
currentTurnMessages,
|
|
11663
|
-
invokedSkill,
|
|
11664
11703
|
resumed: resumedFromSessionRecord,
|
|
11665
11704
|
skillSandbox
|
|
11666
11705
|
});
|
|
@@ -11718,7 +11757,6 @@ async function executeAgentRunInPrivacyContext(run, conversationKind, conversati
|
|
|
11718
11757
|
});
|
|
11719
11758
|
const wiring = await wireAgentTools({
|
|
11720
11759
|
abortAgent: () => agent?.abort(),
|
|
11721
|
-
activeSkills,
|
|
11722
11760
|
behavior,
|
|
11723
11761
|
currentActor: actor,
|
|
11724
11762
|
currentAgentMessages,
|
|
@@ -11731,7 +11769,8 @@ async function executeAgentRunInPrivacyContext(run, conversationKind, conversati
|
|
|
11731
11769
|
durability,
|
|
11732
11770
|
authorization,
|
|
11733
11771
|
generatedFiles,
|
|
11734
|
-
|
|
11772
|
+
invokedSkillNames,
|
|
11773
|
+
conversationSkillNames,
|
|
11735
11774
|
onEvent: run.onEvent,
|
|
11736
11775
|
onFatalToolError(error) {
|
|
11737
11776
|
pendingPiHookError = error;
|
|
@@ -11777,7 +11816,6 @@ async function executeAgentRunInPrivacyContext(run, conversationKind, conversati
|
|
|
11777
11816
|
conversationPrivacy,
|
|
11778
11817
|
existingSessionPiMessages: existingSessionRecord?.piMessages,
|
|
11779
11818
|
existingTurnStartMessageIndex: existingSessionRecord?.turnStartMessageIndex,
|
|
11780
|
-
explicitSkill,
|
|
11781
11819
|
priorPiMessages,
|
|
11782
11820
|
repositoryInstructions: initialRepositoryInstructions,
|
|
11783
11821
|
resumedFromSessionRecord,
|
|
@@ -12396,7 +12434,7 @@ function createAgentRunner(execute, options) {
|
|
|
12396
12434
|
}
|
|
12397
12435
|
};
|
|
12398
12436
|
const loadStoredAttachments = async (attachments) => {
|
|
12399
|
-
const { loadInputAttachments } = await import("./model-input-
|
|
12437
|
+
const { loadInputAttachments } = await import("./model-input-MAq2881y.js").then((n) => n.i);
|
|
12400
12438
|
const storage = nextRun.environment?.attachmentStorage;
|
|
12401
12439
|
if (!storage) throw new Error("Attachment storage is unavailable.");
|
|
12402
12440
|
return await loadInputAttachments({
|