@sentry/junior 0.210.2 → 0.212.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.
Files changed (64) hide show
  1. package/dist/{agent-DruBLdjK.js → agent-Cgc7jAIH.js} +353 -21
  2. package/dist/{agent-hooks-BYZAFpgB.js → agent-hooks-B2Yt2b88.js} +207 -47
  3. package/dist/{agent-runner-Be5K-k2o.js → agent-runner-CkNX-ynf.js} +5 -5
  4. package/dist/api/schema.js +2 -2
  5. package/dist/api.d.ts +1 -1
  6. package/dist/api.js +72 -33
  7. package/dist/{app-gyu3D9Gn.d.ts → app-D4nNdzPG.d.ts} +1 -1
  8. package/dist/app.d.ts +1 -1
  9. package/dist/app.js +32 -32
  10. package/dist/{auth-pause-state-DedOKgr4.js → auth-pause-state-BbcDkPac.js} +6 -6
  11. package/dist/{briefs-CQDK-Dj2.js → briefs-4-OVELML.js} +4 -4
  12. package/dist/{catalog-runtime-Ddk0rxU3.js → catalog-runtime-BvN_lNVo.js} +1 -1
  13. package/dist/{checkpoint-Cto3lP0d.js → checkpoint-EAQ5Xerb.js} +151 -528
  14. package/dist/cli/chat.js +13 -13
  15. package/dist/cli/check.js +3 -3
  16. package/dist/cli/main.js +1 -1
  17. package/dist/cli/plugins.js +3 -3
  18. package/dist/cli/snapshot-create.js +3 -3
  19. package/dist/cli/upgrade.d.ts +1 -1
  20. package/dist/cli/upgrade.js +3 -3
  21. package/dist/{client-Dstl8V7v.js → client-C1KycWNq.js} +2 -2
  22. package/dist/{config-QWyCRQ8L.js → config-C0-PnQoF.js} +2 -2
  23. package/dist/{conversation-AA4R1VUn.js → conversation-CRWntH-A.js} +19 -19
  24. package/dist/{conversation-privacy-BIClFm9b.js → conversation-privacy-BFzYxnTS.js} +1 -1
  25. package/dist/{credential-sync-MFTk0Zba.js → credential-sync-CZz6Vk6X.js} +20 -20
  26. package/dist/{db-D74z7BZH.d.ts → db-Ca9Nt5ci.d.ts} +1 -1
  27. package/dist/{execution-stats-BEax3h2o.js → execution-stats-CoDjBQbE.js} +3 -4
  28. package/dist/{executor-C5onDgaC.js → executor-CaVeGYeA.js} +39 -2
  29. package/dist/instrumentation.js +2 -2
  30. package/dist/{job-queue-Dpfxr7U6.js → job-queue-BhaNX9DL.js} +1 -1
  31. package/dist/{logging-CKkKExae.js → logging-B5-PLvDo.js} +1 -1
  32. package/dist/nitro.d.ts +1 -1
  33. package/dist/nitro.js +3 -3
  34. package/dist/{oauth-callback-server-W_3TiFJo.js → oauth-callback-server-G5q7i0Qp.js} +2 -2
  35. package/dist/{pending-auth-CUOLqzoR.js → pending-auth-CDndLOLO.js} +2 -2
  36. package/dist/{profile-DU-tdAeS.js → profile-BcZ6EBQ4.js} +4 -4
  37. package/dist/{prompt-C1IA4qkj.js → prompt-kRlibHYT.js} +1 -1
  38. package/dist/{registry-BiaaVqDO.js → registry-BIeo1ST6.js} +1 -1
  39. package/dist/{resolve-B178kFFr.js → resolve-BgAZ4KxF.js} +2 -2
  40. package/dist/{runner-CEw5Bd40.js → runner-Cqd0EG3G.js} +10 -10
  41. package/dist/{sandbox-egress-signals-R9n0mBQr.js → sandbox-egress-signals-DrOoklMj.js} +1 -1
  42. package/dist/{schema-CwTeb-BF.js → schema-xHUgeh46.js} +1 -1
  43. package/dist/short-title-CxQHLU3_.js +65 -0
  44. package/dist/{skills-DNxkkZnA.js → skills-DlrAH1on.js} +2 -2
  45. package/dist/{spawn-D_d9fLq3.js → spawn-BtMqHjwx.js} +2 -2
  46. package/dist/{stats-BvEUKgru.js → stats-D5OWazLs.js} +15 -7
  47. package/dist/{store-Det8MQ9g.d.ts → store-DoewL5mG.d.ts} +3 -2
  48. package/dist/{task-queue-DkaL57J_.js → task-queue-C-o2Q4O-.js} +3 -3
  49. package/dist/{task-runner-DDuflo-o.js → task-runner-Mt_TGUBH.js} +8 -8
  50. package/dist/{thread-state-fcmz8adQ.js → thread-state-C81fvhJu.js} +5 -5
  51. package/dist/{turn-execution-BNKloE6i.js → turn-execution-Ruj9SSJU.js} +3 -3
  52. package/dist/{turn-lifecycle-BEcSsBf7.js → turn-lifecycle-xIZNwgaq.js} +1 -1
  53. package/dist/{validation-CgH5VUx2.js → validation-sgYqCVwr.js} +1 -1
  54. package/dist/{version-CS4pJjG8.js → version-BE7Zf9Wx.js} +1 -1
  55. package/dist/version.js +1 -1
  56. package/dist/{web-authorization-D2ts7w_1.js → web-authorization-BXrGezGm.js} +1 -1
  57. package/dist/{web-input-Bxb1i41z.js → web-input-FJ7NNJDx.js} +4 -4
  58. package/dist/{work-HzD-98Ng.js → work-DlYdbVfB.js} +9 -9
  59. package/dist/{worker-DWDTNdyB.js → worker-BfxedsTU.js} +5 -5
  60. package/migrations/0042_conversation_metrics.sql +26 -0
  61. package/migrations/meta/0042_snapshot.json +3610 -0
  62. package/migrations/meta/_journal.json +7 -0
  63. package/package.json +5 -5
  64. package/dist/usage-BU5d5wmV.js +0 -175
@@ -1,28 +1,28 @@
1
- import { C as resolveGatewayCredential, S as getGatewayApiKey, _ as findProviderError, b as isProviderRetryError, c as COMPACTION_SUMMARY_PREFIX, d as isCompactionSummaryText, f as renderCurrentInstruction, g as createProviderError, h as ProviderError, i as completeText, l as MODEL_HANDOFF_SUMMARY_PREFIX, m as escapeXml, n as GEN_AI_SERVER_ADDRESS, o as resolveGatewayModel, p as unwrapCurrentInstruction, r as completeObject, s as ACTIVE_TURN_COMPACTION_SUMMARY_PREFIX, t as GEN_AI_PROVIDER_NAME, u as hasCompactedConversationContext, v as getProviderErrorAttributes, x as MISSING_GATEWAY_CREDENTIALS_ERROR } from "./client-Dstl8V7v.js";
2
- import { C as withSpan, F as isRecord$2, P as normalizeIdentityEmail, S as withLogContext, _ as setSpanAttributes, a as extractGenAiUsageSummary, b as summarizeMessageText, c as getTracePropagationHeaders, d as logInfo, f as logWarn, h as serializeGenAiAttribute, i as extractGenAiUsageAttributes, l as logError, p as normalizeGenAiFinishReason, s as getLogContextAttributesForSpan, u as logException, v as setSpanStatus, y as setTags } from "./logging-CKkKExae.js";
1
+ import { C as resolveGatewayCredential, S as getGatewayApiKey, _ as findProviderError, b as isProviderRetryError, c as COMPACTION_SUMMARY_PREFIX, d as isCompactionSummaryText, f as renderCurrentInstruction, g as createProviderError, h as ProviderError, i as completeText, l as MODEL_HANDOFF_SUMMARY_PREFIX, m as escapeXml, n as GEN_AI_SERVER_ADDRESS, o as resolveGatewayModel, p as unwrapCurrentInstruction, r as completeObject, s as ACTIVE_TURN_COMPACTION_SUMMARY_PREFIX, t as GEN_AI_PROVIDER_NAME, u as hasCompactedConversationContext, v as getProviderErrorAttributes, x as MISSING_GATEWAY_CREDENTIALS_ERROR } from "./client-C1KycWNq.js";
2
+ import { C as withSpan, F as isRecord$2, P as normalizeIdentityEmail, S as withLogContext, _ as setSpanAttributes, a as extractGenAiUsageSummary, b as summarizeMessageText, c as getTracePropagationHeaders, d as logInfo, f as logWarn, h as serializeGenAiAttribute, i as extractGenAiUsageAttributes, l as logError, p as normalizeGenAiFinishReason, s as getLogContextAttributesForSpan, u as logException, v as setSpanStatus, y as setTags } from "./logging-B5-PLvDo.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-BIClFm9b.js";
5
- import { h as normalizeSlackEmojiName, n as botConfig } from "./config-QWyCRQ8L.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-BFzYxnTS.js";
5
+ import { h as normalizeSlackEmojiName, n as botConfig } from "./config-C0-PnQoF.js";
6
6
  import { a as modelIdForProfile, c as TURN_REASONING_LEVELS, i as formatModelProfiles, o as modelProfileSchema, r as formatModelProfile, s as profileConfig, t as ModelProfileNotConfiguredError } from "./model-profile-CZmVoGdX.js";
7
7
  import { _ as parseSlackMessageTs, g as parseSlackUserId, h as parseSlackTeamId, i as credentialUserSubjectId, l as isUserActor, m as parseSlackChannelReferenceId, n as credentialContextSchema, p as parseSlackChannelId, t as credentialContextForActor } from "./context-Bplcgypl.js";
8
- import { A as tryWorkspaceRepoCheckoutPath, B as downloadPrivateSlackFile, C as invalidateReadySnapshot, D as SANDBOX_RUNTIME, E as setWorkspaceSnapshotBuild, Gt as getDb, Ht as getConversationEventStore, J as withSlackRetries, K as normalizeSlackConversationId, Kt as getSqlExecutor, M as resolveChannelCapabilities, O as deleteWorkspaceSnapshotBuilders, Q as readActorIdentity, S as WorkspaceValidationError, T as setWorkspaceSnapshot, U as getSlackClient, Ut as getConversationMessageSearchStore, V as getFilePermalink, W as isConversationScopedChannel, Wt as getConversationStore, _ as deleteWorkspace, an as parseDestination, at as STOP_WATCHING_TOOL_NAME, b as listWorkspaces, bt as createPluginLogger, c as getPluginTools, dt as findMatchingWatches, ft as listWatches, g as createWorkspace, ht as getDashboardTaskLink, it as RESOURCE_WATCH_TOOL_SOURCE, j as workspaceRepoCheckoutPath, k as getWorkspaceSnapshotBuilder, l as getPluginUserPromptContributions, lt as createWatch, mt as getDashboardConversationLink, nt as RESOURCE_SUBSCRIPTION_DEFAULT_TTL_MS, ot as cancelSubscriptions, pt as JUNIOR_THREAD_STATE_TTL_MS, r as createPluginHookRunner, s as getPluginSystemPromptContributions, st as cancelWatch, tt as getSlackToolContext, u as getPlugins, ut as deliverWatch, v as getWorkspace, w as loadSnapshotsForProfile, x as updateWorkspace, y as getWorkspaceByName, z as SlackActionError } from "./agent-hooks-BYZAFpgB.js";
8
+ import { A as tryWorkspaceRepoCheckoutPath, B as downloadPrivateSlackFile, C as invalidateReadySnapshot, D as SANDBOX_RUNTIME, E as setWorkspaceSnapshotBuild, Gt as getDb, Ht as getConversationEventStore, J as withSlackRetries, K as normalizeSlackConversationId, Kt as getSqlExecutor, M as resolveChannelCapabilities, O as deleteWorkspaceSnapshotBuilders, Q as readActorIdentity, S as WorkspaceValidationError, T as setWorkspaceSnapshot, U as getSlackClient, Ut as getConversationMessageSearchStore, V as getFilePermalink, W as isConversationScopedChannel, Wt as getConversationStore, _ as deleteWorkspace, at as STOP_WATCHING_TOOL_NAME, b as listWorkspaces, bt as createPluginLogger, c as getPluginTools, dt as findMatchingWatches, en as addAgentTurnUsage, ft as listWatches, g as createWorkspace, ht as getDashboardTaskLink, in as hasAgentTurnUsage, it as RESOURCE_WATCH_TOOL_SOURCE, j as workspaceRepoCheckoutPath, k as getWorkspaceSnapshotBuilder, l as getPluginUserPromptContributions, lt as createWatch, mt as getDashboardConversationLink, nt as RESOURCE_SUBSCRIPTION_DEFAULT_TTL_MS, ot as cancelSubscriptions, pt as JUNIOR_THREAD_STATE_TTL_MS, r as createPluginHookRunner, s as getPluginSystemPromptContributions, st as cancelWatch, tt as getSlackToolContext, u as getPlugins, un as parseDestination, ut as deliverWatch, v as getWorkspace, w as loadSnapshotsForProfile, x as updateWorkspace, y as getWorkspaceByName, z as SlackActionError } from "./agent-hooks-B2Yt2b88.js";
9
9
  import { n as juniorDestinations } from "./destinations-BeBiJeEM.js";
10
- import { D as juniorArtifacts, S as juniorAttachments, T as juniorIdentities, a as juniorSchedulerRuns, d as AGENT_INVOCATION_MAILBOX_STATUSES, g as juniorConversationBriefs, w as juniorConversations, y as juniorConversationAnnotations } from "./executor-C5onDgaC.js";
11
- import { A as briefLinkSchema, F as KNOWN_CONVERSATION_EVENT_TYPES, G as instructionProvenanceFor, K as sameActorIdentity, M as conversationBriefSchema, U as contextProvenance, W as instructionActors, j as briefOutcomeStatusSchema } from "./conversation-AA4R1VUn.js";
10
+ import { D as juniorIdentities, E as juniorConversations, a as juniorSchedulerRuns, d as AGENT_INVOCATION_MAILBOX_STATUSES, g as juniorConversationBriefs, k as juniorArtifacts, w as juniorAttachments, x as juniorConversationAnnotations } from "./executor-CaVeGYeA.js";
11
+ import { A as briefLinkSchema, G as sameActorIdentity, H as contextProvenance, M as conversationBriefSchema, P as KNOWN_CONVERSATION_EVENT_TYPES, U as instructionActors, W as instructionProvenanceFor, j as briefOutcomeStatusSchema } from "./conversation-CRWntH-A.js";
12
12
  import { a as listReferenceFiles, c as soulPathCandidates, l as worldPathCandidates } from "./package-discovery-7a9YqLhE.js";
13
- import { a as resolvePluginCommandEnv, c as getOAuthProviderErrorAttributes, i as resolveAuthTokenPlaceholder, o as OAuthProviderError, s as fetchWithBoundedOAuthErrorBodies, u as CredentialUnavailableError } from "./registry-BiaaVqDO.js";
14
- import { n as pluginCatalogRuntime } from "./catalog-runtime-Ddk0rxU3.js";
15
- import { a as parseSkillInvocation, n as findSkillByName, r as loadSkillsByName, t as discoverSkills } from "./skills-DNxkkZnA.js";
16
- import { A as normalizeToLf$1, At as retainRuntimeTurnContext, B as openConversationProjection, C as DEFAULT_SEARCH_COMMAND_TIMEOUT_MS, Ct as hasRuntimeTurnContext, D as getRipgrepSearchLocation, Dt as isToolResultError, E as collectFiles, Et as isContinuablePiBoundary, G as recordAuthorizationRequested, H as recordAttachmentsDelivered, I as loadConnectedMcpProviders, K as recordGuardianActionReviewed, L as loadConversationProjection, M as resolveWorkspacePath, Mt as trimTrailingAssistantMessages, N as truncateText$1, Nt as TURN_CONTEXT_TAG, O as isMissingPathError, Ot as isToolResultMessage, S as resolveRepositoryInstructionsForDirectories, St as getUserMessageInstructionText, T as RIPGREP_EXCLUDED_GLOBS, Tt as isAssistantMessage, V as recordAgentsInstructionsUpdated, X as recordTurnRoute, Y as recordToolExecutionStarted, _ as AGENTS_REPLACEMENT_NOTICE, _t as historyItemFromPiMessage, b as listRepositoryDirectories, bt as getPiMessageRole, f as TurnSliceLimitExceededError, g as AGENTS_REMOVAL_NOTICE, gt as getAgentContextInputLimitTokens, h as isTurnExecutionLimitExceededError, ht as getAgentContextCompactionTriggerTokens, j as positiveInteger$1, jt as stripRuntimeTurnContext, k as missingPathSearchResult, kt as normalizeToolNameFromResult, mt as estimateTextTokens, n as loadTurnCheckpoint, p as assertTurnToolCallLimit, q as recordMcpProviderConnected, r as saveTurnCheckpoint, t as continuableMessages, v as buildAgentsInstructionsMessage, vt as piMessageFromHistoryItem, w as MAX_TEXT_CHARS, x as renderAgentsInstructions, xt as getTerminalAssistantMessages, y as findVisibleAgentsInstructions, yt as extractAssistantText, z as loadTurnRoute } from "./checkpoint-Cto3lP0d.js";
17
- import { a as hasAgentTurnUsage, c as generateShortTitle, l as resolveTaskTitle, o as ToolInputError, t as addAgentTurnUsage } from "./usage-BU5d5wmV.js";
18
- import { A as sleep$1, D as fenceLock, E as acquireActiveLock, F as sandboxSkillDir, I as sandboxSkillFile, L as sandboxSkillPathResolution, M as SANDBOX_REPOS_ROOT, N as SANDBOX_SKILLS_ROOT, P as SANDBOX_WORKSPACE_ROOT, _ 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_DATA_ROOT, k as withLock, 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-DU-tdAeS.js";
19
- import { $ as workspaceSnapshotFinishedEvent, B as createEventAutomation, C as SCHEDULED_AUTOMATION_SYSTEM_ACTOR, D as eventAutomationMatchesDestination, E as eventAutomationListToolResultSchema, F as effectiveTaskOutcomes, Gt as makeStructuredToolOutput, I as moveTaskOutcomes, L as resolveTaskOutcomes, M as requireEventAutomationSlackContext, N as requireSupportedEventAutomationTrigger, O as eventAutomationToolResult, P as writableEventAutomation, Q as WORKSPACE_SNAPSHOT_READY_EVENT, R as taskOutcomeInputSchema, T as compactEventAutomation, Ut as injectContinuationToolName, V as deleteEventAutomation, W as getEventAutomation, Wt as juniorToolOutputSchema, X as getEventCatalog, Y as saveEventAutomation, Z as WORKSPACE_SNAPSHOT_FAILED_EVENT, at as normalizeCatalogEventIdentifier, c as parseSlackThreadId, ct as registeredEventTypeSchema, et as workspaceSnapshotWatch, f as createScheduledAutomation, g as listScheduledAutomationsForTeam, i as readLiveAttachment, it as hasPluginEventCatalogEntries, j as registeredEventAutomationTriggerSchema, k as eventAutomationToolResultSchema, lt as registeredResourceTypeSchema, nt as eventNamespaceSchema, ot as pluginSupportsEvent, pt as appendAndEnqueueInboundMessage, q as listEventAutomationsForTeam, rt as hasEventCatalogEntries, s as storeAttachments, st as registeredEventMatchSchema, t as incrementStat, tt as eventGuidance, ut as requireSupportedEventMatch, v as readScheduledAutomation, y as saveScheduledAutomation } from "./stats-BvEUKgru.js";
20
- import { _ as isTurnInputCommitLostError, c as sanitizeAssistantText, f as CooperativeTurnYieldError, l as NO_REPLY_MARKER, n as canReusePendingAuthLink, o as decideReply, p as TurnInputCommitLostError, s as getAssistantReplyText, t as abandonReplacedPendingAuth, u as isNoReplyMarker } from "./pending-auth-CUOLqzoR.js";
21
- import { C as toolInvocationDestination, S as surfaceFromRun, _ as uploadFilesToConversation, b as assertRunConsistency, h as postSlackMessage, i as formatProviderLabel, m as getSlackMessagePermalink, o as resolveBaseUrl, p as addReactionToMessage, r as deliverOAuthAuthorization, s as startOAuthFlow, v as RetryableDeliveryError, x as isAgentRunFeatureDisabled, y as actorFromRun } from "./agent-runner-Be5K-k2o.js";
22
- import { r as EVENT_AUTHOR_ID } from "./prompt-C1IA4qkj.js";
23
- 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-B178kFFr.js";
13
+ import { a as resolvePluginCommandEnv, c as getOAuthProviderErrorAttributes, i as resolveAuthTokenPlaceholder, o as OAuthProviderError, s as fetchWithBoundedOAuthErrorBodies, u as CredentialUnavailableError } from "./registry-BIeo1ST6.js";
14
+ import { n as pluginCatalogRuntime } from "./catalog-runtime-BvN_lNVo.js";
15
+ import { a as parseSkillInvocation, n as findSkillByName, r as loadSkillsByName, t as discoverSkills } from "./skills-DlrAH1on.js";
16
+ import { A as TURN_CONTEXT_TAG, C as isContinuablePiBoundary, D as retainRuntimeTurnContext, E as normalizeToolNameFromResult, H as recordAuthorizationRequested, I as loadTurnRoute, K as recordToolExecutionStarted, L as openConversationProjection, N as loadConnectedMcpProviders, O as stripRuntimeTurnContext, P as loadConversationProjection, R as recordAgentsInstructionsUpdated, S as isAssistantMessage, T as isToolResultMessage, U as recordGuardianActionReviewed, W as recordMcpProviderConnected, _ as getPiMessageRole, b as hasRuntimeTurnContext, dt as estimateTextTokens, f as TurnSliceLimitExceededError, ft as getAgentContextCompactionTriggerTokens, g as extractAssistantText, h as isTurnExecutionLimitExceededError, ht as piMessageFromHistoryItem, k as trimTrailingAssistantMessages, mt as historyItemFromPiMessage, n as loadTurnCheckpoint, p as assertTurnToolCallLimit, pt as getAgentContextInputLimitTokens, q as recordTurnRoute, r as saveTurnCheckpoint, t as continuableMessages, v as getTerminalAssistantMessages, w as isToolResultError, y as getUserMessageInstructionText, z as recordAttachmentsDelivered } from "./checkpoint-EAQ5Xerb.js";
17
+ import { n as generateShortTitle, r as resolveTaskTitle } from "./short-title-CxQHLU3_.js";
18
+ import { A as sleep$1, D as fenceLock, E as acquireActiveLock, F as sandboxSkillDir, I as sandboxSkillFile, L as sandboxSkillPathResolution, M as SANDBOX_REPOS_ROOT, N as SANDBOX_SKILLS_ROOT, P as SANDBOX_WORKSPACE_ROOT, _ 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_DATA_ROOT, k as withLock, 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-BcZ6EBQ4.js";
19
+ import { $ as workspaceSnapshotFinishedEvent, B as createEventAutomation, C as SCHEDULED_AUTOMATION_SYSTEM_ACTOR, D as eventAutomationMatchesDestination, E as eventAutomationListToolResultSchema, F as effectiveTaskOutcomes, Gt as makeStructuredToolOutput, I as moveTaskOutcomes, Jt as ToolInputError, L as resolveTaskOutcomes, M as requireEventAutomationSlackContext, N as requireSupportedEventAutomationTrigger, O as eventAutomationToolResult, P as writableEventAutomation, Q as WORKSPACE_SNAPSHOT_READY_EVENT, R as taskOutcomeInputSchema, T as compactEventAutomation, Ut as injectContinuationToolName, V as deleteEventAutomation, W as getEventAutomation, Wt as juniorToolOutputSchema, X as getEventCatalog, Y as saveEventAutomation, Z as WORKSPACE_SNAPSHOT_FAILED_EVENT, at as normalizeCatalogEventIdentifier, c as parseSlackThreadId, ct as registeredEventTypeSchema, et as workspaceSnapshotWatch, f as createScheduledAutomation, g as listScheduledAutomationsForTeam, i as readLiveAttachment, it as hasPluginEventCatalogEntries, j as registeredEventAutomationTriggerSchema, k as eventAutomationToolResultSchema, lt as registeredResourceTypeSchema, nt as eventNamespaceSchema, ot as pluginSupportsEvent, pt as appendAndEnqueueInboundMessage, q as listEventAutomationsForTeam, rt as hasEventCatalogEntries, s as storeAttachments, st as registeredEventMatchSchema, t as incrementStat, tt as eventGuidance, ut as requireSupportedEventMatch, v as readScheduledAutomation, y as saveScheduledAutomation } from "./stats-D5OWazLs.js";
20
+ import { _ as isTurnInputCommitLostError, c as sanitizeAssistantText, f as CooperativeTurnYieldError, l as NO_REPLY_MARKER, n as canReusePendingAuthLink, o as decideReply, p as TurnInputCommitLostError, s as getAssistantReplyText, t as abandonReplacedPendingAuth, u as isNoReplyMarker } from "./pending-auth-CDndLOLO.js";
21
+ import { C as toolInvocationDestination, S as surfaceFromRun, _ as uploadFilesToConversation, b as assertRunConsistency, h as postSlackMessage, i as formatProviderLabel, m as getSlackMessagePermalink, o as resolveBaseUrl, p as addReactionToMessage, r as deliverOAuthAuthorization, s as startOAuthFlow, v as RetryableDeliveryError, x as isAgentRunFeatureDisabled, y as actorFromRun } from "./agent-runner-CkNX-ynf.js";
22
+ import { r as EVENT_AUTHOR_ID } from "./prompt-kRlibHYT.js";
23
+ 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-BgAZ4KxF.js";
24
24
  import { t as getVercelConversationWorkQueue } from "./vercel-queue-DIkVcfK4.js";
25
- import { a as getTurnRequestDeadline, n as sendNextWorkspaceSnapshotJob, r as sendWorkspaceSnapshotJob } from "./job-queue-Dpfxr7U6.js";
25
+ import { a as getTurnRequestDeadline, n as sendNextWorkspaceSnapshotJob, r as sendWorkspaceSnapshotJob } from "./job-queue-BhaNX9DL.js";
26
26
  import { n as privateTraceResultAttributes } from "./private-trace-result-BLvBjy_e.js";
27
27
  import { streamSimple } from "@earendil-works/pi-ai/compat";
28
28
  import { createGatewayProvider } from "@ai-sdk/gateway";
@@ -218,6 +218,339 @@ var SkillSandbox = class {
218
218
  }
219
219
  };
220
220
  //#endregion
221
+ //#region src/chat/tools/sandbox/file-utils.ts
222
+ const MAX_TEXT_CHARS = 6e4;
223
+ const RIPGREP_EXCLUDED_GLOBS = ["!**/.git/**", "!**/node_modules/**"];
224
+ const DEFAULT_SEARCH_COMMAND_TIMEOUT_MS = 3e4;
225
+ const SKIPPED_DIRECTORIES = /* @__PURE__ */ new Set([".git", "node_modules"]);
226
+ /** Normalize model-supplied numeric knobs before they reach filesystem tools. */
227
+ function positiveInteger$1(value) {
228
+ if (typeof value !== "number" || !Number.isFinite(value)) return;
229
+ const integer = Math.floor(value);
230
+ return integer > 0 ? integer : void 0;
231
+ }
232
+ /** Compare and slice text in one line-ending space while preserving callers' output rules. */
233
+ function normalizeToLf$1(value) {
234
+ return value.replace(/\r\n/g, "\n").replace(/\r/g, "\n");
235
+ }
236
+ /** Keep tool output inside the model-facing budget with an explicit notice. */
237
+ function truncateText$1(value, maxChars = MAX_TEXT_CHARS) {
238
+ if (value.length <= maxChars) return {
239
+ content: value,
240
+ truncated: false
241
+ };
242
+ const removed = value.length - maxChars;
243
+ return {
244
+ content: `${value.slice(0, maxChars)}\n\n[output truncated: ${removed} characters removed]`,
245
+ truncated: true
246
+ };
247
+ }
248
+ /** Detect model-facing missing paths without swallowing sandbox lifecycle/API failures. */
249
+ function isMissingPathError(error) {
250
+ if (!error || typeof error !== "object") return false;
251
+ const candidate = error;
252
+ if (candidate.code === "ENOENT") return true;
253
+ return typeof candidate.message === "string" && candidate.message.startsWith("File not found:");
254
+ }
255
+ /** Reject an expected missing search/list path through the tool-error channel. */
256
+ function missingPathSearchResult(params) {
257
+ const textPath = params.displayPath ?? params.missingPath ?? params.path;
258
+ throw new ToolInputError(`Path not found: ${textPath}`);
259
+ }
260
+ function escapeRegExp(value) {
261
+ return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
262
+ }
263
+ function globToRegExp(pattern) {
264
+ let source = "";
265
+ for (let index = 0; index < pattern.length; index += 1) {
266
+ const char = pattern[index];
267
+ const next = pattern[index + 1];
268
+ if (char === "*" && next === "*") {
269
+ if (pattern[index + 2] === "/") {
270
+ source += "(?:.*/)?";
271
+ index += 2;
272
+ continue;
273
+ }
274
+ source += ".*";
275
+ index += 1;
276
+ continue;
277
+ }
278
+ if (char === "*") {
279
+ source += "[^/]*";
280
+ continue;
281
+ }
282
+ if (char === "?") {
283
+ source += "[^/]";
284
+ continue;
285
+ }
286
+ source += escapeRegExp(char);
287
+ }
288
+ return new RegExp(`^${source}$`);
289
+ }
290
+ function matchesGlob(relativePath, pattern) {
291
+ const matcher = globToRegExp(pattern);
292
+ if (matcher.test(relativePath)) return true;
293
+ if (pattern.startsWith("**/") && matchesGlob(relativePath, pattern.slice(3))) return true;
294
+ return !pattern.includes("/") && matcher.test(path.posix.basename(relativePath));
295
+ }
296
+ /** Keep sandbox filesystem tools scoped to the mounted workspace root. */
297
+ function resolveWorkspacePath(input, fallback = ".") {
298
+ const requested = (input ?? "").trim() || fallback;
299
+ const absolute = requested.startsWith("/") ? requested : path.posix.join(SANDBOX_WORKSPACE_ROOT, requested);
300
+ const normalized = path.posix.normalize(absolute);
301
+ if (normalized !== SANDBOX_WORKSPACE_ROOT && !normalized.startsWith(`${SANDBOX_WORKSPACE_ROOT}/`)) throw new ToolInputError(`Path must stay within ${SANDBOX_WORKSPACE_ROOT}: ${requested}`);
302
+ return normalized;
303
+ }
304
+ /** Anchor ripgrep paths and globs to the requested search root. */
305
+ function getRipgrepSearchLocation(root, rootIsDirectory) {
306
+ if (rootIsDirectory) return {
307
+ cwd: root,
308
+ target: "."
309
+ };
310
+ return {
311
+ cwd: path.posix.dirname(root),
312
+ target: path.posix.basename(root)
313
+ };
314
+ }
315
+ /** Share bounded workspace traversal across search tools so their skip rules stay aligned. */
316
+ async function collectFiles(params) {
317
+ const files = [];
318
+ let limitReached = false;
319
+ let missingPath;
320
+ const visit = async (dirPath) => {
321
+ if (missingPath) return;
322
+ let entries;
323
+ try {
324
+ entries = (await params.fs.readdir(dirPath)).sort((a, b) => a.toLowerCase().localeCompare(b.toLowerCase()));
325
+ } catch (error) {
326
+ if (isMissingPathError(error)) {
327
+ missingPath = dirPath;
328
+ return;
329
+ }
330
+ throw error;
331
+ }
332
+ for (const entry of entries) {
333
+ const fullPath = path.posix.join(dirPath, entry);
334
+ let stat;
335
+ try {
336
+ stat = await params.fs.stat(fullPath);
337
+ } catch (error) {
338
+ if (isMissingPathError(error)) {
339
+ missingPath = fullPath;
340
+ return;
341
+ }
342
+ throw error;
343
+ }
344
+ if (stat.isDirectory()) {
345
+ if (!SKIPPED_DIRECTORIES.has(entry)) await visit(fullPath);
346
+ if (limitReached) return;
347
+ continue;
348
+ }
349
+ const relativePath = path.posix.relative(params.root, fullPath);
350
+ if (!params.pattern || matchesGlob(relativePath, params.pattern)) {
351
+ files.push(fullPath);
352
+ if (params.limit && files.length >= params.limit) {
353
+ limitReached = true;
354
+ return;
355
+ }
356
+ }
357
+ }
358
+ };
359
+ let stat;
360
+ try {
361
+ stat = await params.fs.stat(params.root);
362
+ } catch (error) {
363
+ if (isMissingPathError(error)) return {
364
+ files,
365
+ limitReached: false,
366
+ missingPath: params.root,
367
+ missingRoot: true
368
+ };
369
+ throw error;
370
+ }
371
+ if (!stat.isDirectory()) {
372
+ const relativePath = path.posix.basename(params.root);
373
+ return {
374
+ files: !params.pattern || matchesGlob(relativePath, params.pattern) ? [params.root] : [],
375
+ limitReached: false,
376
+ missingRoot: false
377
+ };
378
+ }
379
+ await visit(params.root);
380
+ return {
381
+ files,
382
+ limitReached,
383
+ missingPath,
384
+ missingRoot: missingPath === params.root
385
+ };
386
+ }
387
+ //#endregion
388
+ //#region src/chat/repository-instructions.ts
389
+ const AGENTS_FILENAME = "AGENTS.md";
390
+ const MAX_REPOSITORY_INSTRUCTIONS_BYTES = 32768;
391
+ const AGENTS_REPLACEMENT_NOTICE = "These AGENTS.md instructions replace all previously provided AGENTS.md instructions.";
392
+ const AGENTS_REMOVAL_NOTICE = "The previously provided AGENTS.md instructions no longer apply.";
393
+ async function pathExists(fs, target) {
394
+ try {
395
+ await fs.stat(target);
396
+ return true;
397
+ } catch (error) {
398
+ if (isMissingPathError(error)) return false;
399
+ throw error;
400
+ }
401
+ }
402
+ async function directoryExists(fs, target) {
403
+ try {
404
+ return (await fs.stat(target)).isDirectory();
405
+ } catch (error) {
406
+ if (isMissingPathError(error)) return false;
407
+ throw error;
408
+ }
409
+ }
410
+ async function findGitRoot(fs, cwd) {
411
+ let current = cwd;
412
+ for (;;) {
413
+ if (await pathExists(fs, path.posix.join(current, ".git"))) return current;
414
+ if (current === SANDBOX_WORKSPACE_ROOT) return;
415
+ const parent = path.posix.dirname(current);
416
+ if (parent === current || parent !== SANDBOX_WORKSPACE_ROOT && !parent.startsWith(`${SANDBOX_WORKSPACE_ROOT}/`)) return;
417
+ current = parent;
418
+ }
419
+ }
420
+ /** Return Git worktrees under repos/, sorted for stable instruction capture. */
421
+ async function listRepositoryDirectories(fs) {
422
+ if (!await directoryExists(fs, SANDBOX_REPOS_ROOT)) return [];
423
+ const entries = await fs.readdir(SANDBOX_REPOS_ROOT);
424
+ const repositories = [];
425
+ for (const entry of entries) {
426
+ const candidate = path.posix.join(SANDBOX_REPOS_ROOT, entry);
427
+ if (await directoryExists(fs, candidate) && await pathExists(fs, path.posix.join(candidate, ".git"))) repositories.push(candidate);
428
+ }
429
+ return repositories.sort((left, right) => left < right ? -1 : left > right ? 1 : 0);
430
+ }
431
+ async function readInstructionFile(fs, filePath) {
432
+ try {
433
+ const content = await fs.readFile(filePath, { encoding: "utf8" });
434
+ return content.trim() ? content : void 0;
435
+ } catch (error) {
436
+ if (isMissingPathError(error)) return;
437
+ throw error;
438
+ }
439
+ }
440
+ /** Resolve the effective root-to-cwd AGENTS.md bundle for one selected directory. */
441
+ async function resolveRepositoryInstructions(args) {
442
+ const gitRoot = await findGitRoot(args.fs, args.cwd);
443
+ if (!gitRoot) return;
444
+ const directories = [];
445
+ let current = args.cwd;
446
+ for (;;) {
447
+ directories.push(current);
448
+ if (current === gitRoot) break;
449
+ current = path.posix.dirname(current);
450
+ }
451
+ directories.reverse();
452
+ const sources = [];
453
+ let remaining = Math.max(0, args.maxBytes ?? MAX_REPOSITORY_INSTRUCTIONS_BYTES);
454
+ for (const directory of directories) {
455
+ if (remaining <= 0) break;
456
+ const filePath = path.posix.join(directory, AGENTS_FILENAME);
457
+ const content = await readInstructionFile(args.fs, filePath);
458
+ if (!content) continue;
459
+ const bytes = Buffer.from(content, "utf8");
460
+ const bounded = bytes.length <= remaining ? content : bytes.subarray(0, remaining).toString("utf8");
461
+ sources.push({
462
+ content: bounded,
463
+ path: filePath
464
+ });
465
+ remaining -= Buffer.byteLength(bounded, "utf8");
466
+ }
467
+ if (sources.length === 0) return;
468
+ const text = formatInstructionSources(sources);
469
+ const fingerprint = createHash("sha256").update(JSON.stringify({
470
+ directory: args.cwd,
471
+ sources
472
+ })).digest("hex");
473
+ return {
474
+ directory: args.cwd,
475
+ fingerprint,
476
+ sources,
477
+ text
478
+ };
479
+ }
480
+ function formatInstructionSources(sources) {
481
+ if (sources.length === 1) return sources[0].content;
482
+ return sources.map((source) => `## ${path.posix.dirname(source.path)}\n\n${source.content}`).join("\n\n");
483
+ }
484
+ /** Combine AGENTS.md bundles from one or more repository directories. */
485
+ function mergeRepositoryInstructions(bundles) {
486
+ if (bundles.length === 0) return;
487
+ if (bundles.length === 1) return bundles[0];
488
+ const sources = bundles.flatMap((bundle) => bundle.sources);
489
+ const text = formatInstructionSources(sources);
490
+ return {
491
+ fingerprint: createHash("sha256").update(JSON.stringify({
492
+ directories: bundles.map((bundle) => bundle.directory ?? null),
493
+ sources
494
+ })).digest("hex"),
495
+ sources,
496
+ text
497
+ };
498
+ }
499
+ /** Resolve AGENTS.md instructions for each selected repository directory. */
500
+ async function resolveRepositoryInstructionsForDirectories(args) {
501
+ const uniqueDirectories = [...new Set(args.directories.filter((directory) => directory === SANDBOX_WORKSPACE_ROOT || directory.startsWith(`${SANDBOX_WORKSPACE_ROOT}/`)))].sort((left, right) => left < right ? -1 : left > right ? 1 : 0);
502
+ let remaining = MAX_REPOSITORY_INSTRUCTIONS_BYTES;
503
+ const bundles = [];
504
+ for (const directory of uniqueDirectories) {
505
+ if (remaining <= 0) break;
506
+ const instructions = await resolveRepositoryInstructions({
507
+ cwd: directory,
508
+ fs: args.fs,
509
+ maxBytes: remaining
510
+ });
511
+ if (!instructions) continue;
512
+ bundles.push(instructions);
513
+ remaining -= instructions.sources.reduce((total, source) => total + Buffer.byteLength(source.content, "utf8"), 0);
514
+ }
515
+ return mergeRepositoryInstructions(bundles);
516
+ }
517
+ /** Render repository instructions with Codex's exact model-visible wrapper. */
518
+ function renderAgentsInstructions(args) {
519
+ return `# AGENTS.md instructions${args.directory ? ` for ${args.directory}` : ""}\n\n<INSTRUCTIONS>\n${args.text}\n</INSTRUCTIONS>`;
520
+ }
521
+ /** Build one user-role repository-instructions context message. */
522
+ function buildAgentsInstructionsMessage(args) {
523
+ return {
524
+ role: "user",
525
+ content: [{
526
+ type: "text",
527
+ text: renderAgentsInstructions(args)
528
+ }],
529
+ timestamp: args.timestamp ?? Date.now()
530
+ };
531
+ }
532
+ /** Read the latest effective AGENTS.md state from model-visible history. */
533
+ function findVisibleAgentsInstructions(messages) {
534
+ for (let messageIndex = messages.length - 1; messageIndex >= 0; messageIndex -= 1) {
535
+ const message = messages[messageIndex];
536
+ if (message.role !== "user" || !Array.isArray(message.content)) continue;
537
+ for (let partIndex = message.content.length - 1; partIndex >= 0; partIndex -= 1) {
538
+ const part = message.content[partIndex];
539
+ if (part.type !== "text" || typeof part.text !== "string" || !part.text.startsWith("# AGENTS.md instructions")) continue;
540
+ const match = part.text.match(/^# AGENTS\.md instructions(?: for ([^\n]+))?\n\n<INSTRUCTIONS>\n([\s\S]*)\n<\/INSTRUCTIONS>$/);
541
+ if (!match) continue;
542
+ let text = match[2];
543
+ if (text === "The previously provided AGENTS.md instructions no longer apply.") return { active: false };
544
+ if (text.startsWith(`These AGENTS.md instructions replace all previously provided AGENTS.md instructions.\n\n`)) text = text.slice(86);
545
+ return {
546
+ active: true,
547
+ ...match[1] ? { directory: match[1] } : void 0,
548
+ text
549
+ };
550
+ }
551
+ }
552
+ }
553
+ //#endregion
221
554
  //#region src/chat/agent/repository-context.ts
222
555
  function findRestoredInstructions(messages, provenance) {
223
556
  const restoredContext = messages?.map((message, index) => ({
@@ -5449,9 +5782,8 @@ function createSandbox(options) {
5449
5782
  if (!runtime.sandboxRef()) return;
5450
5783
  const { fs } = await runtime.tools();
5451
5784
  const workspaceDirectories = activeWorkspace?.repos.map((repo) => tryWorkspaceRepoCheckoutPath(repo.repo)).filter((checkoutPath) => Boolean(checkoutPath)).map((checkoutPath) => `${SANDBOX_WORKSPACE_ROOT}/${checkoutPath}`) ?? [];
5452
- const directories = workspaceDirectories.length > 0 ? workspaceDirectories : await listRepositoryDirectories(fs);
5453
5785
  return await resolveRepositoryInstructionsForDirectories({
5454
- directories,
5786
+ directories: workspaceDirectories.length > 0 ? workspaceDirectories : await listRepositoryDirectories(fs),
5455
5787
  fs
5456
5788
  });
5457
5789
  },