@sentry/junior 0.319.0 → 0.321.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 (58) hide show
  1. package/dist/{adapter-8_S6Birm.js → adapter-BkDQYdg6.js} +1 -1
  2. package/dist/{admin-EsbUON1j.js → admin-XS3G9BOj.js} +1 -1
  3. package/dist/{agent-CtzMl32d.js → agent-CL9ZkOgx.js} +45 -52
  4. package/dist/{agent-update-delivery-pAvsbuGL.js → agent-update-delivery-t0bXEgPs.js} +4 -4
  5. package/dist/api/schema.d.ts +4 -12
  6. package/dist/api/schema.js +4 -4
  7. package/dist/api.js +30 -25
  8. package/dist/{app-tACXxJPI.d.ts → app-CwFRvmEH.d.ts} +2 -1
  9. package/dist/app.d.ts +1 -1
  10. package/dist/app.js +22 -219
  11. package/dist/{change-record-K-KsqNhT.d.ts → change-record-CRuG9Mu3.d.ts} +1 -6
  12. package/dist/{channel-access-DET5hzZM.js → channel-access-BUHB0saC.js} +1 -1
  13. package/dist/{chat-core-engine-DpM3tMVi.js → chat-core-engine-DuBaPbqK.js} +31 -14
  14. package/dist/cli/chat.js +16 -16
  15. package/dist/cli/check.js +4 -4
  16. package/dist/cli/main.js +2 -2
  17. package/dist/cli/plugins.js +3 -3
  18. package/dist/cli/snapshot-create.js +4 -4
  19. package/dist/cli/upgrade.js +2 -2
  20. package/dist/{continue-in-slack-CFzDyxkH.js → continue-in-slack-D9naZmqM.js} +3 -3
  21. package/dist/{conversation-feed-DEUdD7mb.js → conversation-feed-B1_1NJc8.js} +2 -12
  22. package/dist/{conversation-privacy-C2vYK55O.js → conversation-privacy-C0mixZKx.js} +1 -1
  23. package/dist/{create-Ta3SEIB5.js → create-CLV0M1vw.js} +2 -2
  24. package/dist/{credential-sync-DyRqDmY4.js → credential-sync-DL9r-ry5.js} +11 -11
  25. package/dist/{db-BCaNWl9p.js → db-CbURDbaB.js} +49 -28
  26. package/dist/{deployment-CfOew1Tm.js → deployment-D9uPRDMD.js} +1 -1
  27. package/dist/{engine-context-CiExoy1B.js → engine-context-BP0h6u4m.js} +389 -13
  28. package/dist/{html-Bb2Si1bR.js → html-l4hKICAL.js} +4 -4
  29. package/dist/instrumentation.js +2 -2
  30. package/dist/{list-wwDcROh9.js → list-cGaO9_Hf.js} +12 -37
  31. package/dist/{logging-BRPTXAdf.js → logging-CqgOoICc.js} +1 -1
  32. package/dist/{markers-9QoqW5ov.js → markers-BtUv4-oc.js} +40 -37
  33. package/dist/nitro.d.ts +1 -1
  34. package/dist/nitro.js +2 -2
  35. package/dist/{oauth-callback-server-vhL9b-PZ.js → oauth-callback-server-C3GxhsuB.js} +2 -2
  36. package/dist/{oauth-relay-CH2v7WiB.js → oauth-relay-BGm6sLCB.js} +1 -1
  37. package/dist/{profile-D9LdwmZi.js → profile-bLo0h7Le.js} +12 -6
  38. package/dist/{prompt-3TqxEOtc.js → prompt-CX29OGO9.js} +1 -1
  39. package/dist/{reports-K-tbtEyx.js → reports-DeDCCu_H.js} +2 -2
  40. package/dist/{resolve-BBV2qf8A.js → resolve-D9RKNH3v.js} +5 -5
  41. package/dist/{result-5IdGJP4M.js → result-BFBwK1M2.js} +7 -7
  42. package/dist/{runner-BK_joPlM.js → runner-DNdoVQg8.js} +7 -7
  43. package/dist/{sandbox-egress-signals-DXgWXXmm.js → sandbox-egress-signals-BBcCiEhm.js} +1 -1
  44. package/dist/{schema-zWGG6VC1.js → schema-RzsplzdI.js} +5 -3
  45. package/dist/{service-account-CateFyhw.js → service-account-B7E7OIFP.js} +2 -2
  46. package/dist/{skills-Ccjw8h2P.js → skills-DMJsS5e4.js} +4 -4
  47. package/dist/{slack-conversation-unfurl-ZC_TSpc4.js → slack-conversation-unfurl-EWYTnBZI.js} +7 -7
  48. package/dist/{storage-C9U7R5rM.js → storage-XD0lB4Gk.js} +2 -2
  49. package/dist/{system-prompt-table-YBTHIFlP.js → system-prompt-table-C886lsT9.js} +4 -4
  50. package/dist/{types-BNHkJrOP.js → types-CGgQ3-Bb.js} +1 -9
  51. package/dist/{users-CCRAqYb_.js → users-DBrcQl47.js} +1 -1
  52. package/dist/{validation-BCUpJa8K.js → validation-CofUHWqz.js} +1 -1
  53. package/dist/{version-BNm0JYj3.js → version-D_vbXyNw.js} +1 -1
  54. package/dist/version.js +1 -1
  55. package/dist/{worker-BhgpZ7_b.js → worker-buhFcpl9.js} +4 -4
  56. package/migrations/20261127150242_drop_space_members/migration.sql +9 -0
  57. package/migrations/20261127150242_drop_space_members/snapshot.json +53 -0
  58. package/package.json +6 -6
@@ -1,20 +1,20 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-BKpuH2hG.js";
2
- import { $ as resolveGatewayModel, B as getSlackBotToken, L as botConfig, P as parseSlackMessageTs, R as getChatConfig, S as isUserActor, T as toStoredSlackActor, Y as TURN_REASONING_LEVELS, _ as createActor, a as getStateValues, f as credentialContextForActor, h as credentialSubjectSchema, i as getStateAdapter, k as parseSlackUserId, l as fenceLock, s as MUTATION_LOCK_TTL_MS, u as withLock } from "./adapter-8_S6Birm.js";
3
- import { $l as instructionAuthor, Ad as authenticationLinkedEvent, Ai as postSlackMessage, Bc as getInboxItem, Bp as juniorConversations, Cd as getProviderErrorAttributes, Do as publishAgentUpdate, Dt as getRegistrations, Es as conversationSubtreeColumns, Et as getPlugins, Fd as getAppContext, Ff as addAgentTurnUsage, Fn as readParentMessage, Gt as appendInboundMessage, In as readInboundMessageSender, Kp as juniorUsers, Li as escapeSlackMrkdwnText, Ln as isEventMailboxMetadata, Ls as findActorTimezone, N as claimProviderConversation, Od as JUNIOR_NATIVE_EVENT_NAMESPACE, On as releaseInboundMessage, Ou as ToolInputError, Pl as projectConversationMessages, Qr as formatSentryEventReference, Ri as formatSlackLink, Sd as findProviderError, Sp as juniorAgentBindings, Tc as findSlackUserByPrimaryEmail, Ts as conversationSubtree, W as conversationLastTurnOutcomeSql, Wf as nextDetailVersion, Wi as getPluginUserPromptContributions, Wt as appendAndEnqueueInboundMessage, Xu as completeText, Yo as verifyTimerWatchCredentialSubject, Zl as dispatchInstructionsInvokeSkills, Zo as JUNIOR_THREAD_STATE_TTL_MS, Zs as getSlackClient, _n as takePendingEventMessages, a as getDb, ac as withSlackRetries, ao as fallbackShortTitle, ap as juniorWorkspaces, bc as resolveActorIdentityId, bd as createAssistantProviderError, d as createSqlConversationEventStore, du as EVENT_SYSTEM_ACTOR, ec as isDmChannel, eu as isPersonInput, fd as estimateTextTokens, fr as readThroughHttpCache, fu as eventBotAuthorId, gn as stopConversationWork, i as getConversationStore, ip as juniorWorkspaceRepos, j as startLocationThread, jd as conversationNoteEvent, kd as agentsInstructionsUpdatedEvent, ki as postSlackEphemeralMessage, kn as traceContextSchema, kp as juniorConversationEvents, lu as EVENT_AUTHOR_ID, mu as isEventConversationMessage, n as getConversationEventStore, o as getSqlExecutor, oa as createPluginCache, oc as sleep, on as getConversationWorkState, oo as generateShortTitle, po as getEventCatalog, qp as juniorDestinations, rn as dropPendingMessages, rp as juniorSnapshots, sa as getConfigDefaults, sd as createCache, sn as getConversationWorkStates, ta as pluginConfigValues, u as isPostgresErrorCode, uu as EVENT_MESSAGE_AUTHOR, v as withConversationEventLock, vd as isCompactionSummaryText, vu as eventGuidance, wc as findLinkedSlackUser, wd as getProviderErrorUserMessage, xd as createProviderError, xp as juniorLocationConfigurations, yc as SYSTEM_IDENTITY_ID, zr as getVercelConversationWorkQueue } from "./db-BCaNWl9p.js";
4
- import { Ct as instructionActors, St as contextProvenance, Un as isAgentUpdateEventType, Vt as messageCardRef, bt as piMessageSchema, gt as historyItemFromPiMessage, nt as agentTypeInstructions, pn as inboxItemQuestion, rt as agentTypeSchema, wt as instructionProvenanceFor, xn as normalizeUserInputAnswer, xt as agentInstructionProvenance, yn as formatUserInputAnswer, yt as piMessageFromHistoryItem } from "./types-BNHkJrOP.js";
5
- import { A as toOptionalString, O as isNativeIdentityProvider, S as summarizeMessageText, T as withSpan, _ as serializeGenAiAttribute, a as getActiveTraceContext, f as logException, m as logWarn, p as logInfo, y as setSpanAttributes } from "./logging-BRPTXAdf.js";
6
- import { A as retainRuntimeTurnContext, B as authorAttrs, D as isToolResultError, G as mapBounded, I as TURN_CONTEXT_TAG, L as renderCurrentInstruction, M as trimTrailingAssistantMessages, O as isToolResultMessage, T as isContinuablePiBoundary, U as renderParentAgentTask, W as renderThreadContext, _ as extractAssistantText, c as SANDBOX_REPOS_ROOT, d as SANDBOX_WORKSPACE_ROOT, h as createPluginLogger, j as stripRuntimeTurnContext, k as normalizeToolNameFromResult, w as isAssistantMessage, x as hasRuntimeTurnContext, y as getTerminalAssistantMessages, z as THREAD_CONTEXT_TAGS } from "./prompt-3TqxEOtc.js";
7
- import { a as toCanonicalInputMessage } from "./conversation-privacy-C2vYK55O.js";
8
- import { a as parseSkillFile, i as openAiPolicyDisablesImplicitInvocation } from "./skills-Ccjw8h2P.js";
9
- import { N as resolveSandboxEgressProviderForHost, O as parseSandboxEgressAuthRequiredSignal, f as findInErrorChain, n as hash, o as getSandboxProvider, u as SANDBOX_RUNTIME, x as executeCredentialedEgressRequest } from "./profile-D9LdwmZi.js";
10
- import { S as readBlockedReport, _ as NO_REPLY_TOOL_NAME, a as buildCapabilitySections, b as readNoReply, d as readTurnAnswer, g as sanitizeAssistantText, l as REPLY_TOOL_NAME, m as decideReply, n as buildPluginSections, o as buildTurnContextPrompt, s as readPluginContributions, t as buildModeSections, x as REPORT_BLOCKED_TOOL_NAME, y as isLegacyNoReplyMarker } from "./system-prompt-table-YBTHIFlP.js";
2
+ import { $ as resolveGatewayModel, B as getSlackBotToken, L as botConfig, P as parseSlackMessageTs, R as getChatConfig, S as isUserActor, T as toStoredSlackActor, Y as TURN_REASONING_LEVELS, _ as createActor, a as getStateValues, f as credentialContextForActor, h as credentialSubjectSchema, i as getStateAdapter, k as parseSlackUserId, l as fenceLock, s as MUTATION_LOCK_TTL_MS, u as withLock } from "./adapter-BkDQYdg6.js";
3
+ import { $s as isDmChannel, Cc as findLinkedSlackUser, Dd as agentsInstructionsUpdatedEvent, Dn as releaseInboundMessage, Dp as juniorConversationEvents, Ed as JUNIOR_NATIVE_EVENT_NAMESPACE, Eo as publishAgentUpdate, Et as getRegistrations, Eu as ToolInputError, Fn as readInboundMessageSender, Gp as juniorDestinations, Hf as nextDetailVersion, Ii as escapeSlackMrkdwnText, In as isEventMailboxMetadata, Is as findActorTimezone, Jo as verifyTimerWatchCredentialSubject, Ju as completeText, Li as formatSlackLink, Ml as projectConversationMessages, N as claimProviderConversation, Nd as getAppContext, Nf as addAgentTurnUsage, Od as authenticationLinkedEvent, Oi as postSlackEphemeralMessage, On as traceContextSchema, Pn as readParentMessage, Ql as isPersonInput, Rp as juniorConversations, Rr as getVercelConversationWorkQueue, Sd as getProviderErrorUserMessage, Ts as conversationSubtreeColumns, Tt as getPlugins, Ui as getPluginUserPromptContributions, Ut as appendAndEnqueueInboundMessage, W as conversationLastTurnOutcomeSql, Wp as juniorUsers, Wt as appendInboundMessage, Xo as JUNIOR_THREAD_STATE_TTL_MS, Xs as getSlackClient, Yl as dispatchInstructionsInvokeSkills, Zl as instructionAuthor, Zr as formatSentryEventReference, a as getDb, aa as createPluginCache, ac as sleep, ad as createCache, an as getConversationWorkState, ao as generateShortTitle, bd as findProviderError, bp as juniorAgentBindings, cu as EVENT_MESSAGE_AUTHOR, d as createSqlConversationEventStore, dr as readThroughHttpCache, ea as pluginConfigValues, fo as getEventCatalog, fu as isEventConversationMessage, gd as isCompactionSummaryText, gn as takePendingEventMessages, gu as eventGuidance, hn as stopConversationWork, i as getConversationStore, ic as withSlackRetries, io as fallbackShortTitle, j as startLocationThread, kd as conversationNoteEvent, ki as postSlackMessage, lu as EVENT_SYSTEM_ACTOR, n as getConversationEventStore, nn as dropPendingMessages, np as juniorWorkspaceRepos, o as getSqlExecutor, oa as getConfigDefaults, on as getConversationWorkStates, rp as juniorWorkspaces, su as EVENT_AUTHOR_ID, tp as juniorSnapshots, u as isPostgresErrorCode, ud as estimateTextTokens, uu as eventBotAuthorId, v as withConversationEventLock, vc as SYSTEM_IDENTITY_ID, vd as createAssistantProviderError, wc as findSlackUserByPrimaryEmail, ws as conversationSubtree, xd as getProviderErrorAttributes, yc as resolveActorIdentityId, yd as createProviderError, yp as juniorLocationConfigurations, zc as getInboxItem } from "./db-CbURDbaB.js";
4
+ import { Ct as instructionActors, Hn as isAgentUpdateEventType, St as contextProvenance, Vt as messageCardRef, bn as normalizeUserInputAnswer, bt as piMessageSchema, gt as historyItemFromPiMessage, nt as agentTypeInstructions, pn as inboxItemQuestion, rt as agentTypeSchema, vn as formatUserInputAnswer, wt as instructionProvenanceFor, xt as agentInstructionProvenance, yt as piMessageFromHistoryItem } from "./types-CGgQ3-Bb.js";
5
+ import { A as toOptionalString, O as isNativeIdentityProvider, S as summarizeMessageText, T as withSpan, _ as serializeGenAiAttribute, a as getActiveTraceContext, f as logException, m as logWarn, p as logInfo, y as setSpanAttributes } from "./logging-CqgOoICc.js";
6
+ import { A as retainRuntimeTurnContext, B as authorAttrs, D as isToolResultError, G as mapBounded, I as TURN_CONTEXT_TAG, L as renderCurrentInstruction, M as trimTrailingAssistantMessages, O as isToolResultMessage, T as isContinuablePiBoundary, U as renderParentAgentTask, W as renderThreadContext, _ as extractAssistantText, c as SANDBOX_REPOS_ROOT, d as SANDBOX_WORKSPACE_ROOT, h as createPluginLogger, j as stripRuntimeTurnContext, k as normalizeToolNameFromResult, w as isAssistantMessage, x as hasRuntimeTurnContext, y as getTerminalAssistantMessages, z as THREAD_CONTEXT_TAGS } from "./prompt-CX29OGO9.js";
7
+ import { a as toCanonicalInputMessage } from "./conversation-privacy-C0mixZKx.js";
8
+ import { a as parseSkillFile, i as openAiPolicyDisablesImplicitInvocation } from "./skills-DMJsS5e4.js";
9
+ import { N as resolveSandboxEgressProviderForHost, O as parseSandboxEgressAuthRequiredSignal, f as findInErrorChain, n as hash, o as getSandboxProvider, u as SANDBOX_RUNTIME, x as executeCredentialedEgressRequest } from "./profile-bLo0h7Le.js";
10
+ import { S as readBlockedReport, _ as NO_REPLY_TOOL_NAME, a as buildCapabilitySections, b as readNoReply, d as readTurnAnswer, g as sanitizeAssistantText, l as REPLY_TOOL_NAME, m as decideReply, n as buildPluginSections, o as buildTurnContextPrompt, s as readPluginContributions, t as buildModeSections, x as REPORT_BLOCKED_TOOL_NAME, y as isLegacyNoReplyMarker } from "./system-prompt-table-C886lsT9.js";
11
11
  import { t as isMissingVirtualModule } from "./virtual-module-BeKA_EII.js";
12
- import { i as lookupSlackUserProfile, t as lookupActiveSlackWorkspaceMember } from "./users-CCRAqYb_.js";
12
+ import { i as lookupSlackUserProfile, t as lookupActiveSlackWorkspaceMember } from "./users-DBrcQl47.js";
13
13
  import { r as userCustomizationTextSchema, s as isVisionImageMediaType } from "./user-customization-CvfuY9Eo.js";
14
14
  import * as z from "zod";
15
15
  import { getCurrentSystemMessage, getSystemMessageText } from "@earendil-works/pi-ai/compat";
16
16
  import path from "node:path";
17
- import { and, asc, desc, eq, inArray, isNotNull, isNull, like, lt, lte, ne, or, sql } from "drizzle-orm";
17
+ import { and, asc, desc, eq, inArray, isNotNull, isNull, lt, lte, ne, or, sql } from "drizzle-orm";
18
18
  import { alias } from "drizzle-orm/pg-core";
19
19
  import { actorSchema, agentEventKeys, createEventSource, createLocalSource, createWebSource, destinationSchema, escapeClosingTag, escapeClosingTags, escapeTagText, escapeTagTextAndQuotes, findTag, readTag, renderInlineTag, renderTag, sourceSchema, startsWithTag, tagJson, unescapeClosingTag, unescapeClosingTags } from "@sentry/junior-plugin-api";
20
20
  import { isDeepStrictEqual } from "node:util";
@@ -786,12 +786,14 @@ var ToolActionReviewLimitError = class extends Error {
786
786
  }
787
787
  };
788
788
  /**
789
- * True when an `auto` action must enter review. Only the annotations that
790
- * Junior or plugin code declares on the tool can skip review: read-only and
791
- * not destructive. Annotations that an MCP server sends reach Guardian only as
792
- * hints, because a server can mark a write as read-only.
789
+ * True when an `auto` action must enter review. Only Junior or plugin code
790
+ * can skip it: annotations that it declares on the tool, read-only and not
791
+ * destructive, or a remote MCP tool that the plugin lists by exact name in
792
+ * `mcp.guardian.skipReview`. Annotations that an MCP server sends reach
793
+ * Guardian only as hints, because a server can mark a write as read-only.
793
794
  */
794
- function autoActionNeedsReview({ annotations }) {
795
+ function autoActionNeedsReview({ annotations }, resolved) {
796
+ if (resolved?.skipReview) return false;
795
797
  return !(annotations?.readOnlyHint === true && annotations.destructiveHint !== true);
796
798
  }
797
799
  function actionActor(actor) {
@@ -932,7 +934,7 @@ async function prepareToolActionReview(action, context, priorRejections) {
932
934
  const { tool, input } = action;
933
935
  if (!mayNeedReview(tool)) return;
934
936
  const resolved = await tool.resolveApprovalMetadata?.(input);
935
- if (tool.approvalMode === "auto" && !autoActionNeedsReview(tool)) return;
937
+ if (tool.approvalMode === "auto" && !autoActionNeedsReview(tool, resolved)) return;
936
938
  assertAuthoritativeContext(context);
937
939
  const proposal = buildProposal(action.toolName, tool, input, resolved, context, priorRejections, await context.rootConversation?.(), action.script);
938
940
  return {
@@ -1519,6 +1521,7 @@ function isEventInboundMessageId(id) {
1519
1521
  return id.startsWith(EVENT_INBOUND_MESSAGE_PREFIX);
1520
1522
  }
1521
1523
  // src/chat/conversations/turn-lifecycle.ts
1524
+ /** The idempotency key of a Turn's `turn_started` event. */
1522
1525
  function turnStartedKey(turnId) {
1523
1526
  return `turn:${turnId}:started`;
1524
1527
  }
@@ -1563,7 +1566,7 @@ var ConversationTurnLifecycleService = class {
1563
1566
  /** Record a completion that is not a failure once. */
1564
1567
  async complete(input) {
1565
1568
  await this.events.append(input.conversationId, [{
1566
- idempotencyKey: `turn:${input.turnId}:terminal`,
1569
+ idempotencyKey: turnTerminalKey(input.turnId),
1567
1570
  createdAtMs: input.createdAtMs,
1568
1571
  data: {
1569
1572
  type: "turn_completed",
@@ -1576,7 +1579,7 @@ var ConversationTurnLifecycleService = class {
1576
1579
  /** Record a classified failure once. Do not store raw error text. */
1577
1580
  async fail(input) {
1578
1581
  await this.events.append(input.conversationId, [{
1579
- idempotencyKey: `turn:${input.turnId}:terminal`,
1582
+ idempotencyKey: turnTerminalKey(input.turnId),
1580
1583
  createdAtMs: input.createdAtMs,
1581
1584
  data: {
1582
1585
  type: "turn_failed",
@@ -1601,7 +1604,7 @@ var ConversationTurnLifecycleService = class {
1601
1604
  ...input.reportAs ? { starter: input.reportAs } : void 0,
1602
1605
  state: this.state
1603
1606
  };
1604
- const stored = await this.events.loadByIdempotencyKey(input.conversationId, `turn:${input.turnId}:terminal`);
1607
+ const stored = await this.events.loadByIdempotencyKey(input.conversationId, turnTerminalKey(input.turnId));
1605
1608
  if (stored?.data.type === "turn_failed") {
1606
1609
  const { failureCode } = stored.data;
1607
1610
  await publishAgentUpdate(input.conversationId, {
@@ -1642,6 +1645,13 @@ var ConversationTurnLifecycleService = class {
1642
1645
  });
1643
1646
  }
1644
1647
  };
1648
+ /**
1649
+ * The idempotency key of a Turn's `turn_completed` or `turn_failed` event.
1650
+ * The two share it, so a Turn ends once.
1651
+ */
1652
+ function turnTerminalKey(turnId) {
1653
+ return `turn:${turnId}:terminal`;
1654
+ }
1645
1655
  /** Return the Turn lifecycle that records Conversation events. */
1646
1656
  function getTurnLifecycle() {
1647
1657
  return new ConversationTurnLifecycleService(getConversationEventStore(), { watchQueue: getVercelConversationWorkQueue });
@@ -3007,7 +3017,9 @@ function getConversationMessageSlackTs(message) {
3007
3017
  return parseSlackMessageTs(message.meta?.slackTs);
3008
3018
  }
3009
3019
  // src/chat/services/conversation-title.ts
3010
- const inFlightTitles = /* @__PURE__ */ new Map();
3020
+ function inFlightTitles() {
3021
+ return getAppContext().conversationTitles;
3022
+ }
3011
3023
  /**
3012
3024
  * Set-once conversation title from the earliest human message.
3013
3025
  *
@@ -3018,12 +3030,12 @@ const inFlightTitles = /* @__PURE__ */ new Map();
3018
3030
  * is already titled or generation does not apply.
3019
3031
  */
3020
3032
  async function ensureConversationTitle(args) {
3021
- const pending = inFlightTitles.get(args.conversationId);
3033
+ const pending = inFlightTitles().get(args.conversationId);
3022
3034
  if (pending) return pending;
3023
3035
  const work = ensureConversationTitleOnce(args).finally(() => {
3024
- inFlightTitles.delete(args.conversationId);
3036
+ inFlightTitles().delete(args.conversationId);
3025
3037
  });
3026
- inFlightTitles.set(args.conversationId, work);
3038
+ inFlightTitles().set(args.conversationId, work);
3027
3039
  return work;
3028
3040
  }
3029
3041
  /** Return the earliest user message, which is the input of a dispatched run. */
@@ -3121,14 +3133,14 @@ function scheduleConversationTitle(args) {
3121
3133
  * gives this to `waitUntil` so title work has an owner.
3122
3134
  */
3123
3135
  async function settleConversationTitleWork(conversationId) {
3124
- await inFlightTitles.get(conversationId);
3136
+ await inFlightTitles().get(conversationId);
3125
3137
  }
3126
3138
  /**
3127
3139
  * Join in-flight generation when present, otherwise read the stored title.
3128
3140
  * Does not start generation; providers use this only to project a title.
3129
3141
  */
3130
3142
  async function resolveConversationTitle(args) {
3131
- const pending = inFlightTitles.get(args.conversationId);
3143
+ const pending = inFlightTitles().get(args.conversationId);
3132
3144
  if (pending) {
3133
3145
  const generated = await pending;
3134
3146
  if (generated?.trim()) return generated.trim();
@@ -5529,7 +5541,6 @@ async function withHeldInput(args, instruction) {
5529
5541
  }]]);
5530
5542
  }
5531
5543
  // src/chat/events/workspace.ts
5532
- const teamIdsByToken = /* @__PURE__ */ new Map();
5533
5544
  /**
5534
5545
  * Resolve the single-bot Slack team id for event-automation indexing, Event
5535
5546
  * people mentions, and author trust.
@@ -5542,6 +5553,7 @@ const teamIdsByToken = /* @__PURE__ */ new Map();
5542
5553
  async function resolveBotSlackTeamId() {
5543
5554
  const token = getSlackBotToken();
5544
5555
  if (!token) return void 0;
5556
+ const teamIdsByToken = getAppContext().slackBotTeamIds;
5545
5557
  let pending = teamIdsByToken.get(token);
5546
5558
  if (!pending) {
5547
5559
  pending = getSlackClient().auth.test().then((result) => {
@@ -7113,15 +7125,6 @@ function isParentMessageAuthor(author) {
7113
7125
  return typeof author?.userId === "string" && author.userId.startsWith(PARENT_MESSAGE_AUTHOR_PREFIX);
7114
7126
  }
7115
7127
  /**
7116
- * Read when the root Turn code last saved a parent message to one child, or
7117
- * undefined when it saved none.
7118
- */
7119
- async function readLastParentMessageAtMs(conversationId) {
7120
- const payload = juniorConversationEvents.payload;
7121
- const [row] = await getSqlExecutor().db().select({ createdAt: juniorConversationEvents.createdAt }).from(juniorConversationEvents).where(and(eq(juniorConversationEvents.conversationId, conversationId), eq(juniorConversationEvents.type, "message"), like(sql`${payload}->'meta'->'author'->>'userId'`, `${PARENT_MESSAGE_AUTHOR_PREFIX}%`))).orderBy(desc(juniorConversationEvents.createdAt)).limit(1);
7122
- return row?.createdAt.getTime();
7123
- }
7124
- /**
7125
7128
  * Commit the parent's history for the first Turn of a fork child, before the
7126
7129
  * Turn starts. `inputs` passed the sender check.
7127
7130
  */
@@ -7558,4 +7561,4 @@ async function appendSubagentEnded(parentConversationId, markerIds, outcome, cre
7558
7561
  createdAtMs
7559
7562
  })));
7560
7563
  }
7561
- export { createWebAuthorization as $, normalizeConversationText as $n, reviewToolActions as $r, getWorkspaceByName as $t, getConversationStoppedAtMs as A, loadTurnProjection as An, recordTurnSummary as Ar, withoutSavedSteeringMessages as At, sourceFromTurnInput as B, recordToolExecutionStarted as Bn, createTurnLimitGate as Br, getConversationTurnBoundaryError as Bt, getAgentReplyMessageId as C, withAgentRequest as Cn, pauseLostWorkerTurn as Cr, assemblePrompt as Ct, isInheritedForkHistory as D, loadConnectedMcpProviders as Dn, failTurnRecord as Dr, instructionForInputs as Dt, getSpawnedChildConversationId as E, commitMessages as En, completeTurnRecord as Er, instructionActorFor as Et, completeCancelledConversationTurn as F, recordAuthorizationRequested as Fn, TURN_LIMIT_WRAP_UP_MESSAGE as Fr, addConversationNote as Ft, getTurnUserReplyAttachmentContext as G, resolveConversationTitle as Gn, getAgentTurnDiagnosticsAttributes as Gr, markTurnCompleted as Gt, legacyWebMailboxMetadataSchema as H, hydrateConversationMessages as Hn, buildTurnFailureResponse as Hr, isTurnInputCommitLostError as Ht, getAuthPausedConversationTurnId as I, recordGuardianActionReviewed as In, TurnBudgetExceededError as Ir, ConversationTurnBoundaryError as It, getPersistedSandboxState as J, estimateConversationMessagesTokens as Jn, isCutOffStopReason as Jr, buildDeterministicAssistantMessageId as Jt, getTurnUserSlackMessageTs as K, settleConversationTitleWork as Kn, requireTurnFailureEventId as Kr, markTurnFailed as Kt, getEventBatchDelayMs as L, recordMcpProviderConnected as Ln, TurnSliceLimitExceededError as Lr, CooperativeTurnYieldError as Lt, saveHeldInput as M, recordAttachmentsDelivered as Mn, getTurnLifecycle as Mr, renderTaskInput as Mt, session_stop_exports as N, recordAuthenticationLinked as Nn, loadTurnStart as Nr, readUserCustomization as Nt, notInheritedByForkChild as O, loadConversationProjection as On, getTurnRecord as Or, loadPromptTurnContext as Ot, stopConversationTree as P, recordAuthorizationCompleted as Pn, GATED_TURN_LIMIT_WRAP_UP_MESSAGE as Pr, saveUserCustomization as Pt, coerceThreadConversationState as Q, markConversationMessage as Qn, createToolActionReview as Qr, getWorkspace as Qt, listActiveMailboxTurns as R, recordSkillLoaded as Rn, TurnToolCallLimitExceededError as Rr, TurnInputCommitLostError as Rt, getAgentMessageId as S, readAgentHistory as Sn, lostWorkerBeforeFirstSave as Sr, loadThreadContextTrimFloor as St, getPersonStopTurnId as T, commitAcceptedReply as Tn, abandonTurnRecord as Tr, buildSteeringPiMessage as Tt, getTurnUserMessage as U, persistConversationMessageWindow as Un, captureTurnFailure as Ur, isTurnInputDeferredError as Ut, turnInputFactsFromConversationMessage as V, appendConversationMessages as Vn, isTurnExecutionLimitExceededError as Vr, isCooperativeTurnYieldError as Vt, getTurnUserMessageId as W, persistConversationMessages as Wn, finalizeFailedTurnReplyWithEvent as Wr, markTurnClosed as Wt, persistThreadRuntimeState as X, isHumanConversationMessage as Xn, ToolActionReviewLimitError as Xr, createWorkspace as Xt, getPersistedThreadState as Y, getConversationMessageSlackTs as Yn, ToolActionRejectedError as Yr, buildDeterministicTurnId as Yt, persistThreadStateById as Z, latestConversationMessageSeq as Zn, ToolActionReviewUnavailableError as Zr, deleteWorkspace as Zt, dropWaitingParentMessages as _, readRepositoryInstructions as _n, canReusePendingAuthLink as _r, resolveEventAuthor as _t, listDescendantAgents as a, CODEMODE_TOOL_NAME as ai, tryWorkspaceRepoCheckoutPath as an, calculateContextCompactionTargetTokens as ar, EVENT_WAIT_MS as at, agentConfigSchema as b, foldLeadingSystemMessages as bn, continuableMessages as br, withHeldInput as bt, resultAuthorId as c, deliverOAuthAuthorization as ci, loadSnapshotsForProfile as cn, getAgentContextInputLimitTokens as cr, enqueueEventNotification as ct, isStopResult as d, startOAuthFlow as di, isExperimentalFeatureEnabled as dn, createPluginAuthOrchestration as dr, timerWatchCredentialSubject as dt, getToolActionRejectionMarker as ei, listWorkspaceNamesByRepository as en, recordDeliveredAssistantMessage as er, deleteWebAuthorization as et, readChildConversationSender as f, projectConversationEvents as fi, buildDeploymentSystemPrompt as fn, authorizationId as fr, eventAuthorText as ft, commitParentMessageFork as g, findVisibleAgentsInstructions as gn, abandonReplacedPendingAuth as gr, parseEmail as gt, childAgentTurnOptions as h, configValueSchema as hi, buildAgentsInstructionsMessage as hn, AuthorizationPauseError as hr, isTrustedSlackAuthor as ht, listChildAgents as i, USER_AUTHORIZATION_LEVELS as ii, WorkspaceValidationError as in, upsertConversationMessage as ir, savedInputInstruction as it, resumeForPersonInput as j, recordAgentsInstructionsUpdated as jn, ConversationTurnLifecycleService as jr, readTaskInstructions as jt, enqueueAutomatedInput as k, loadConversationSkillNames as kn, listTurnSummaries as kr, turnRequestText as kt, withSenderActors as l, formatProviderLabel as li, setWorkspaceSnapshot as ln, createPluginEgress as lr, eventBatchMessageMeta as lt, buildParentMessage as m, validateConfigValue as mi, AGENTS_REPLACEMENT_NOTICE as mn, AuthorizationFlowDisabledError as mr, isAllowedDomain as mt, recordSubagentStartedMarker as n, RISK_LEVELS as ni, listWorkspacesByRepository as nn, trimConversationMessages as nr, eventInboxItemInputs as nt, listOpenChildAgents as o, CODE_MODE_CALL_STATUS_TEXT as oi, workspaceRepoCheckoutPath as on, getAgentBackgroundCompactionMarkTokens as or, addQuietEventNote as ot, appendParentMessage as p, validateConfigKey as pi, AGENTS_REMOVAL_NOTICE as pn, AuthPausePersistenceError as pr, findTrustedUser as pt, getLocationConfigurationService as q, conversationAuthorDisplayName as qn, buildTurnResult as qr, startActiveTurn as qt, listAgentRelatives as r, ROOT_LINE_BREAK as ri, updateWorkspace as rn, turnHasReply as rr, loadInboxItemInput as rt, listUnreportedSiblingAgents as s, persistWithRetry as si, invalidateReadySnapshot as sn, getAgentContextCompactionTriggerTokens as sr, createEventInboundMessage as st, recordChildAgentEnded as t, restoreToolActionRejections as ti, listWorkspaces as tn, renderConversationMessageLine as tr, getWebAuthorization as tt, isChildAgentEvent as u, parseOAuthStatePayload as ui, setWorkspaceSnapshotBuild as un, PluginCredentialFailureError as ur, renderEventBatchInputs as ut, isParentMessageAuthor as v, renderAgentsInstructions as vn, clearPendingAuth as vr, resolveBotSlackTeamId as vt, getChildAgentLockName as w, writeAgentHistory as wn, saveTurnCheckpoint as wr, buildPromptInput as wt, readAgentConfig as x, foldSystemMessages as xn, loadTurnCheckpoint as xr, loadThreadContextCursor as xt, readLastParentMessageAtMs as y, showsAgentsInstructions as yn, getConversationPendingAuth as yr, isHeldInputMessage as yt, resolveMailboxTurnWork as z, recordSubscribedReplyRoute as zn, buildTurnErrorResponse as zr, TurnInputDeferredError as zt };
7564
+ export { deleteWebAuthorization as $, normalizeConversationText as $n, ToolActionReviewUnavailableError as $r, listWorkspaceNamesByRepository as $t, resumeForPersonInput as A, recordAgentsInstructionsUpdated as An, recordTurnSummary as Ar, readTaskInstructions as At, turnInputFactsFromConversationMessage as B, appendConversationMessages as Bn, TurnToolCallLimitExceededError as Br, isCooperativeTurnYieldError as Bt, getChildAgentLockName as C, writeAgentHistory as Cn, pauseLostWorkerTurn as Cr, buildPromptInput as Ct, notInheritedByForkChild as D, loadConversationProjection as Dn, failTurnRecord as Dr, loadPromptTurnContext as Dt, isInheritedForkHistory as E, loadConnectedMcpProviders as En, completeTurnRecord as Er, instructionForInputs as Et, getAuthPausedConversationTurnId as F, recordGuardianActionReviewed as Fn, turnTerminalKey as Fr, ConversationTurnBoundaryError as Ft, getTurnUserSlackMessageTs as G, resolveConversationTitle as Gn, captureTurnFailure as Gr, markTurnFailed as Gt, getTurnUserMessage as H, persistConversationMessageWindow as Hn, createTurnLimitGate as Hr, isTurnInputDeferredError as Ht, getEventBatchDelayMs as I, recordMcpProviderConnected as In, GATED_TURN_LIMIT_WRAP_UP_MESSAGE as Ir, CooperativeTurnYieldError as It, getPersistedThreadState as J, estimateConversationMessagesTokens as Jn, requireTurnFailureEventId as Jr, buildDeterministicTurnId as Jt, getLocationConfigurationService as K, settleConversationTitleWork as Kn, finalizeFailedTurnReplyWithEvent as Kr, startActiveTurn as Kt, listActiveMailboxTurns as L, recordSkillLoaded as Ln, TURN_LIMIT_WRAP_UP_MESSAGE as Lr, TurnInputCommitLostError as Lt, session_stop_exports as M, recordAuthenticationLinked as Mn, getTurnLifecycle as Mr, readUserCustomization as Mt, stopConversationTree as N, recordAuthorizationCompleted as Nn, loadTurnStart as Nr, saveUserCustomization as Nt, enqueueAutomatedInput as O, loadConversationSkillNames as On, getTurnRecord as Or, turnRequestText as Ot, completeCancelledConversationTurn as P, recordAuthorizationRequested as Pn, turnStartedKey as Pr, addConversationNote as Pt, createWebAuthorization as Q, markConversationMessage as Qn, ToolActionReviewLimitError as Qr, getWorkspaceByName as Qt, resolveMailboxTurnWork as R, recordSubscribedReplyRoute as Rn, TurnBudgetExceededError as Rr, TurnInputDeferredError as Rt, getAgentReplyMessageId as S, withAgentRequest as Sn, lostWorkerBeforeFirstSave as Sr, assemblePrompt as St, getSpawnedChildConversationId as T, commitMessages as Tn, abandonTurnRecord as Tr, instructionActorFor as Tt, getTurnUserMessageId as U, persistConversationMessages as Un, isTurnExecutionLimitExceededError as Ur, markTurnClosed as Ut, legacyWebMailboxMetadataSchema as V, hydrateConversationMessages as Vn, buildTurnErrorResponse as Vr, isTurnInputCommitLostError as Vt, getTurnUserReplyAttachmentContext as W, toStoredConversationMessage as Wn, buildTurnFailureResponse as Wr, markTurnCompleted as Wt, persistThreadStateById as X, isHumanConversationMessage as Xn, isCutOffStopReason as Xr, deleteWorkspace as Xt, persistThreadRuntimeState as Y, getConversationMessageSlackTs as Yn, buildTurnResult as Yr, createWorkspace as Yt, coerceThreadConversationState as Z, latestConversationMessageSeq as Zn, ToolActionRejectedError as Zr, getWorkspace as Zt, dropWaitingParentMessages as _, configValueSchema as _i, renderAgentsInstructions as _n, canReusePendingAuthLink as _r, resolveBotSlackTeamId as _t, listDescendantAgents as a, ROOT_LINE_BREAK as ai, workspaceRepoCheckoutPath as an, calculateContextCompactionTargetTokens as ar, addQuietEventNote as at, readAgentConfig as b, foldSystemMessages as bn, continuableMessages as br, loadThreadContextCursor as bt, resultAuthorId as c, CODE_MODE_CALL_STATUS_TEXT as ci, setWorkspaceSnapshot as cn, getAgentContextInputLimitTokens as cr, eventBatchMessageMeta as ct, isStopResult as d, formatProviderLabel as di, buildDeploymentSystemPrompt as dn, createPluginAuthOrchestration as dr, eventAuthorText as dt, createToolActionReview as ei, listWorkspaces as en, recordDeliveredAssistantMessage as er, getWebAuthorization as et, readChildConversationSender as f, parseOAuthStatePayload as fi, AGENTS_REMOVAL_NOTICE as fn, authorizationId as fr, findTrustedUser as ft, commitParentMessageFork as g, validateConfigValue as gi, readRepositoryInstructions as gn, abandonReplacedPendingAuth as gr, resolveEventAuthor as gt, childAgentTurnOptions as h, validateConfigKey as hi, findVisibleAgentsInstructions as hn, AuthorizationPauseError as hr, parseEmail as ht, listChildAgents as i, RISK_LEVELS as ii, tryWorkspaceRepoCheckoutPath as in, upsertConversationMessage as ir, EVENT_WAIT_MS as it, saveHeldInput as j, recordAttachmentsDelivered as jn, ConversationTurnLifecycleService as jr, renderTaskInput as jt, getConversationStoppedAtMs as k, loadTurnProjection as kn, listTurnSummaries as kr, withoutSavedSteeringMessages as kt, withSenderActors as l, persistWithRetry as li, setWorkspaceSnapshotBuild as ln, createPluginEgress as lr, renderEventBatchInputs as lt, buildParentMessage as m, projectConversationEvents as mi, buildAgentsInstructionsMessage as mn, AuthorizationFlowDisabledError as mr, isTrustedSlackAuthor as mt, recordSubagentStartedMarker as n, getToolActionRejectionMarker as ni, updateWorkspace as nn, trimConversationMessages as nr, loadInboxItemInput as nt, listOpenChildAgents as o, USER_AUTHORIZATION_LEVELS as oi, invalidateReadySnapshot as on, getAgentBackgroundCompactionMarkTokens as or, createEventInboundMessage as ot, appendParentMessage as p, startOAuthFlow as pi, AGENTS_REPLACEMENT_NOTICE as pn, AuthPausePersistenceError as pr, isAllowedDomain as pt, getPersistedSandboxState as q, conversationAuthorDisplayName as qn, getAgentTurnDiagnosticsAttributes as qr, buildDeterministicAssistantMessageId as qt, listAgentRelatives as r, restoreToolActionRejections as ri, WorkspaceValidationError as rn, turnHasReply as rr, savedInputInstruction as rt, listUnreportedSiblingAgents as s, CODEMODE_TOOL_NAME as si, loadSnapshotsForProfile as sn, getAgentContextCompactionTriggerTokens as sr, enqueueEventNotification as st, recordChildAgentEnded as t, reviewToolActions as ti, listWorkspacesByRepository as tn, renderConversationMessageLine as tr, eventInboxItemInputs as tt, isChildAgentEvent as u, deliverOAuthAuthorization as ui, isExperimentalFeatureEnabled as un, PluginCredentialFailureError as ur, timerWatchCredentialSubject as ut, isParentMessageAuthor as v, showsAgentsInstructions as vn, clearPendingAuth as vr, isHeldInputMessage as vt, getPersonStopTurnId as w, commitAcceptedReply as wn, saveTurnCheckpoint as wr, buildSteeringPiMessage as wt, getAgentMessageId as x, readAgentHistory as xn, loadTurnCheckpoint as xr, loadThreadContextTrimFloor as xt, agentConfigSchema as y, foldLeadingSystemMessages as yn, getConversationPendingAuth as yr, withHeldInput as yt, sourceFromTurnInput as z, recordToolExecutionStarted as zn, TurnSliceLimitExceededError as zr, getConversationTurnBoundaryError as zt };
package/dist/nitro.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { n as JuniorPluginSet } from "./plugins-DhGXZjlu.js";
2
- import { r as JuniorDashboardOptions } from "./app-tACXxJPI.js";
2
+ import { r as JuniorDashboardOptions } from "./app-CwFRvmEH.js";
3
3
  import { withSentryConfig as withSentryConfig$1 } from "@sentry/nitro";
4
4
  type SentryNitroConfig = Parameters<typeof withSentryConfig$1>[0];
5
5
  type SentryNitroOptions = NonNullable<Parameters<typeof withSentryConfig$1>[1]>;
package/dist/nitro.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { _ as toOptionalTrimmed, a as WORKSPACE_SNAPSHOT_JOB_QUEUE_TOPIC, g as resolvePackageDir, h as isValidPackageName, i as PLUGIN_TASK_QUEUE_TOPIC, n as CACHE_WARMUP_QUEUE_TOPIC, o as discoverInstalledPluginPackageContent, t as BACKGROUND_COMPACTION_QUEUE_TOPIC } from "./topics-DxuKurCX.js";
2
2
  import { t as startLocalVercelQueueServer } from "./local-server-CpnGhYml.js";
3
3
  import { n as TURN_STEP_TOPIC, t as TURN_ENDED_TOPIC } from "./topic-B2EWKKBT.js";
4
- import { a as JUNIOR_CONVERSATION_WORK_CALLBACK_ROUTE, c as JUNIOR_PLUGIN_TASK_CALLBACK_ROUTE, d as JUNIOR_TURN_ENDED_CALLBACK_ROUTE, f as JUNIOR_TURN_STEP_CALLBACK_ROUTE, g as getDeploymentServiceVersion, i as JUNIOR_CONTEXT_COMPACTION_CALLBACK_ROUTE, l as JUNIOR_RETENTION_CRON_SCHEDULE, n as JUNIOR_AUTO_ARCHIVE_ROUTE, o as JUNIOR_HEARTBEAT_CRON_SCHEDULE, p as JUNIOR_WORKSPACE_SNAPSHOT_JOB_CALLBACK_ROUTE, r as JUNIOR_CACHE_WARMUP_CALLBACK_ROUTE, s as JUNIOR_HEARTBEAT_ROUTE, t as JUNIOR_AUTO_ARCHIVE_CRON_SCHEDULE, u as JUNIOR_RETENTION_ROUTE } from "./deployment-CfOew1Tm.js";
4
+ import { a as JUNIOR_CONVERSATION_WORK_CALLBACK_ROUTE, c as JUNIOR_PLUGIN_TASK_CALLBACK_ROUTE, d as JUNIOR_TURN_ENDED_CALLBACK_ROUTE, f as JUNIOR_TURN_STEP_CALLBACK_ROUTE, g as getDeploymentServiceVersion, i as JUNIOR_CONTEXT_COMPACTION_CALLBACK_ROUTE, l as JUNIOR_RETENTION_CRON_SCHEDULE, n as JUNIOR_AUTO_ARCHIVE_ROUTE, o as JUNIOR_HEARTBEAT_CRON_SCHEDULE, p as JUNIOR_WORKSPACE_SNAPSHOT_JOB_CALLBACK_ROUTE, r as JUNIOR_CACHE_WARMUP_CALLBACK_ROUTE, s as JUNIOR_HEARTBEAT_ROUTE, t as JUNIOR_AUTO_ARCHIVE_CRON_SCHEDULE, u as JUNIOR_RETENTION_ROUTE } from "./deployment-D9uPRDMD.js";
5
5
  import { a as pluginRuntimeRegistrationsFromPluginSet, r as pluginCatalogConfigFromPluginSet } from "./plugins-D_Ru4CWc.js";
6
6
  import { n as loadPluginSetFromModule, r as resolvePluginModule } from "./plugin-module-Cv2ETe8Y.js";
7
7
  import path from "node:path";
@@ -252,7 +252,7 @@ function injectVirtualConfig(nitro, options) {
252
252
  */
253
253
  function injectVirtualSystemPrompts(nitro, options) {
254
254
  nitro.options.virtual["#junior/system-prompts"] = async () => {
255
- const { buildSystemPromptTable } = await import("./system-prompt-table-YBTHIFlP.js").then((n) => n.r);
255
+ const { buildSystemPromptTable } = await import("./system-prompt-table-C886lsT9.js").then((n) => n.r);
256
256
  const table = await buildSystemPromptTable(await options.loadPlugins(), options.botName);
257
257
  return `export const systemPrompts = ${JSON.stringify(table)};`;
258
258
  };
@@ -1,5 +1,5 @@
1
- import { a as GET, n as syncLocalOAuthCredential, r as GET$1 } from "./credential-sync-DyRqDmY4.js";
2
- import { A as createUserTokenStore } from "./profile-D9LdwmZi.js";
1
+ import { a as GET, n as syncLocalOAuthCredential, r as GET$1 } from "./credential-sync-DL9r-ry5.js";
2
+ import { A as createUserTokenStore } from "./profile-bLo0h7Le.js";
3
3
  import { createServer } from "node:http";
4
4
  // src/chat/local/oauth-callback-server.ts
5
5
  const LOCAL_OAUTH_TIMEOUT_MS = 6e5;
@@ -1,5 +1,5 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-BKpuH2hG.js";
2
- import { R as getChatConfig } from "./adapter-8_S6Birm.js";
2
+ import { R as getChatConfig } from "./adapter-BkDQYdg6.js";
3
3
  import * as z from "zod";
4
4
  import { randomBytes } from "node:crypto";
5
5
  import { SignJWT, jwtVerify } from "jose";
@@ -1,7 +1,7 @@
1
- import { R as getChatConfig, c as acquireActiveLock, g as credentialUserSubjectId, i as getStateAdapter, m as credentialLogContext, p as credentialContextSchema, s as MUTATION_LOCK_TTL_MS, u as withLock } from "./adapter-8_S6Birm.js";
2
- import { Af as CredentialUnavailableError, Bd as mergeHeaderTransforms, Et as getPlugins, Fd as getAppContext, Pf as workloadIdentityHeader, Rd as HOST_MANAGED_CREDENTIAL_PLACEHOLDER, a as getDb, aa as runNonInteractiveCommand, ff as createEncryptedState, gf as resolveApiHeaderTransforms, jf as ServiceAccountUnavailableError, kf as CredentialMintError, mf as findLegacyWebActorUserId, oa as createPluginCache, oc as sleep, pf as readEncryptedState, vf as resolvePluginCommandEnv, zd as resolveAuthTokenPlaceholder } from "./db-BCaNWl9p.js";
3
- import { G as mapBounded, d as SANDBOX_WORKSPACE_ROOT, h as createPluginLogger } from "./prompt-3TqxEOtc.js";
4
- import { T as withSpan, f as logException, m as logWarn, u as logAudit, v as setSentryUser, y as setSpanAttributes } from "./logging-BRPTXAdf.js";
1
+ import { R as getChatConfig, c as acquireActiveLock, g as credentialUserSubjectId, i as getStateAdapter, m as credentialLogContext, p as credentialContextSchema, s as MUTATION_LOCK_TTL_MS, u as withLock } from "./adapter-BkDQYdg6.js";
2
+ import { Df as CredentialMintError, Id as HOST_MANAGED_CREDENTIAL_PLACEHOLDER, Ld as resolveAuthTokenPlaceholder, Mf as workloadIdentityHeader, Nd as getAppContext, Of as CredentialUnavailableError, Rd as mergeHeaderTransforms, Tt as getPlugins, a as getDb, aa as createPluginCache, ac as sleep, df as readEncryptedState, ff as findLegacyWebActorUserId, gf as resolvePluginCommandEnv, ia as runNonInteractiveCommand, kf as ServiceAccountUnavailableError, mf as resolveApiHeaderTransforms, uf as createEncryptedState } from "./db-CbURDbaB.js";
3
+ import { G as mapBounded, d as SANDBOX_WORKSPACE_ROOT, h as createPluginLogger } from "./prompt-CX29OGO9.js";
4
+ import { T as withSpan, f as logException, m as logWarn, u as logAudit, v as setSentryUser, y as setSpanAttributes } from "./logging-CqgOoICc.js";
5
5
  import { n as redactSandboxEgressProxyPath, t as SANDBOX_EGRESS_PROXY_PATH } from "./proxy-path-BHYoKZdq.js";
6
6
  import { r as continueTrace } from "./sentry-CPbZjomA.js";
7
7
  import * as z from "zod";
@@ -1117,12 +1117,18 @@ async function responseTextWithinLimit(upstream, maxBytes) {
1117
1117
  }
1118
1118
  const body = clone.body;
1119
1119
  if (!body) return "";
1120
+ const reader = body.getReader();
1120
1121
  const chunks = [];
1121
1122
  let bytes = 0;
1122
1123
  try {
1123
- for await (const value of body) {
1124
+ while (true) {
1125
+ const { done, value } = await reader.read();
1126
+ if (done) break;
1124
1127
  bytes += value.byteLength;
1125
- if (bytes > limit) return;
1128
+ if (bytes > limit) {
1129
+ reader.cancel().catch(() => void 0);
1130
+ return;
1131
+ }
1126
1132
  chunks.push(value);
1127
1133
  }
1128
1134
  } catch {
@@ -1,4 +1,4 @@
1
- import { f as logException, m as logWarn, p as logInfo } from "./logging-BRPTXAdf.js";
1
+ import { f as logException, m as logWarn, p as logInfo } from "./logging-CqgOoICc.js";
2
2
  import { escapeClosingTags, escapeTagText, escapeTagTextAndQuotes, findTag, openingTag, readTag, renderTag, startsWithTag, stripTags, unescapeClosingTags, unescapeTagText } from "@sentry/junior-plugin-api";
3
3
  import pLimit from "p-limit";
4
4
  /**
@@ -1,5 +1,5 @@
1
- import { $i as basePluginContext, Dt as getRegistrations, Ki as createPluginState, pr as createPluginConversationEventStats } from "./db-BCaNWl9p.js";
2
- import { h as createPluginLogger, r as runPluginHooksAtOnce } from "./prompt-3TqxEOtc.js";
1
+ import { Et as getRegistrations, Gi as createPluginState, Qi as basePluginContext, fr as createPluginConversationEventStats } from "./db-CbURDbaB.js";
2
+ import { h as createPluginLogger, r as runPluginHooksAtOnce } from "./prompt-CX29OGO9.js";
3
3
  // src/chat/plugins/hooks/reports.ts
4
4
  const OPERATIONAL_REPORT_MAX_METRICS = 8;
5
5
  const OPERATIONAL_REPORT_MAX_WIDGETS = 12;
@@ -1,8 +1,8 @@
1
- import { R as getChatConfig, i as getStateAdapter } from "./adapter-8_S6Birm.js";
2
- import { aa as runNonInteractiveCommand, oc as sleep } from "./db-BCaNWl9p.js";
3
- import { a as SANDBOX_COMMAND_PATH, d as SANDBOX_WORKSPACE_ROOT } from "./prompt-3TqxEOtc.js";
4
- import { i as CURL_DOWNLOAD_ARGS, o as getSandboxProvider, r as isStale, t as create } from "./profile-D9LdwmZi.js";
5
- import { T as withSpan, y as setSpanAttributes } from "./logging-BRPTXAdf.js";
1
+ import { R as getChatConfig, i as getStateAdapter } from "./adapter-BkDQYdg6.js";
2
+ import { ac as sleep, ia as runNonInteractiveCommand } from "./db-CbURDbaB.js";
3
+ import { a as SANDBOX_COMMAND_PATH, d as SANDBOX_WORKSPACE_ROOT } from "./prompt-CX29OGO9.js";
4
+ import { i as CURL_DOWNLOAD_ARGS, o as getSandboxProvider, r as isStale, t as create } from "./profile-bLo0h7Le.js";
5
+ import { T as withSpan, y as setSpanAttributes } from "./logging-CqgOoICc.js";
6
6
  import * as z from "zod";
7
7
  // src/chat/sandbox/resources.ts
8
8
  /**
@@ -1,8 +1,8 @@
1
- import { Do as publishAgentUpdate, In as readInboundMessageSender, du as EVENT_SYSTEM_ACTOR, hu as CORE_EVENT_NAMESPACE, i as getConversationStore, on as getConversationWorkState, ou as remindsNoReplyForChildStatus, ru as parentResultActor, yc as SYSTEM_IDENTITY_ID } from "./db-BCaNWl9p.js";
2
- import { A as getConversationStoppedAtMs, C as getAgentReplyMessageId, R as listActiveMailboxTurns, S as getAgentMessageId, Yt as buildDeterministicTurnId, at as EVENT_WAIT_MS, c as resultAuthorId, f as readChildConversationSender, k as enqueueAutomatedInput, o as listOpenChildAgents, s as listUnreportedSiblingAgents, t as recordChildAgentEnded, x as readAgentConfig } from "./markers-9QoqW5ov.js";
3
- import { H as renderDataTag } from "./prompt-3TqxEOtc.js";
4
- import { _ as NO_REPLY_TOOL_NAME } from "./system-prompt-table-YBTHIFlP.js";
5
- import { Bn as AGENT_UPDATE_EVENT_TYPE, zn as AGENT_MESSAGE_EVENT_TYPE } from "./types-BNHkJrOP.js";
1
+ import { Eo as publishAgentUpdate, Fn as readInboundMessageSender, an as getConversationWorkState, i as getConversationStore, iu as remindsNoReplyForChildStatus, lu as EVENT_SYSTEM_ACTOR, pu as CORE_EVENT_NAMESPACE, tu as parentResultActor, vc as SYSTEM_IDENTITY_ID } from "./db-CbURDbaB.js";
2
+ import { Jt as buildDeterministicTurnId, L as listActiveMailboxTurns, O as enqueueAutomatedInput, S as getAgentReplyMessageId, b as readAgentConfig, c as resultAuthorId, f as readChildConversationSender, it as EVENT_WAIT_MS, k as getConversationStoppedAtMs, o as listOpenChildAgents, s as listUnreportedSiblingAgents, t as recordChildAgentEnded, x as getAgentMessageId } from "./markers-BtUv4-oc.js";
3
+ import { H as renderDataTag } from "./prompt-CX29OGO9.js";
4
+ import { _ as NO_REPLY_TOOL_NAME } from "./system-prompt-table-C886lsT9.js";
5
+ import { Rn as AGENT_MESSAGE_EVENT_TYPE, zn as AGENT_UPDATE_EVENT_TYPE } from "./types-CGgQ3-Bb.js";
6
6
  // src/chat/child-agents/child-message.ts
7
7
  /**
8
8
  * List the child replies and results among the ids that reached one
@@ -70,7 +70,7 @@ function renderAgentResult(args) {
70
70
  * Render the parent agent input for one child agent result as one
71
71
  * `<agent-result>`, the agent update that a Watch on the child also gets.
72
72
  * The system prompt says what to do for each status. A Lead's done result
73
- * also reminds it that a status update needs no reply.
73
+ * also reminds it that only a status update with no news needs no reply.
74
74
  */
75
75
  function renderResultInput(sender, result, openSiblings) {
76
76
  const agentResult = renderAgentResult({
@@ -86,7 +86,7 @@ function renderResultInput(sender, result, openSiblings) {
86
86
  });
87
87
  return result.status === "done" ? withNoReplyReminder(sender, agentResult) : agentResult;
88
88
  }
89
- const NO_REPLY_REMINDER = `If this is only a status update with nothing a member needs, end with \`${NO_REPLY_TOOL_NAME}\`.`;
89
+ const NO_REPLY_REMINDER = `If this is only a status update with no news for a member, end with \`${NO_REPLY_TOOL_NAME}\`. A done signal that is now true is news.`;
90
90
  function withNoReplyReminder(sender, input) {
91
91
  return remindsNoReplyForChildStatus(sender.parentKind) ? `${input}\n${NO_REPLY_REMINDER}` : input;
92
92
  }
@@ -1,10 +1,10 @@
1
- import { Ht as messageCardText } from "./types-BNHkJrOP.js";
2
- import { St as loadPendingMessageCards, bt as completeAuthPauseTurn, ct as scheduleSessionCompletedPluginTasks, st as processPluginTask, xt as buildDeliveredTurnStatePatch } from "./agent-CtzMl32d.js";
3
- import { h as getAssistantReplyText } from "./system-prompt-table-YBTHIFlP.js";
4
- import { f as logException, w as withLogContext, x as setTags } from "./logging-BRPTXAdf.js";
5
- import { $n as normalizeConversationText, Hn as hydrateConversationMessages, J as getPersistedSandboxState, Kt as markTurnFailed, Mr as getTurnLifecycle, On as loadConversationProjection, Pn as recordAuthorizationCompleted, Q as coerceThreadConversationState, Qn as markConversationMessage, Tn as commitAcceptedReply, Wn as persistConversationMessages, Wr as finalizeFailedTurnReplyWithEvent, Y as getPersistedThreadState, Z as persistThreadStateById, Zn as latestConversationMessageSeq, er as recordDeliveredAssistantMessage, fr as authorizationId, ir as upsertConversationMessage, qt as startActiveTurn, si as persistWithRetry, wr as saveTurnCheckpoint } from "./markers-9QoqW5ov.js";
6
- import { f as credentialContextForActor } from "./adapter-8_S6Birm.js";
7
- import { i as getConversationStore, yc as SYSTEM_IDENTITY_ID } from "./db-BCaNWl9p.js";
1
+ import { Ht as messageCardText } from "./types-CGgQ3-Bb.js";
2
+ import { St as loadPendingMessageCards, bt as completeAuthPauseTurn, ct as scheduleSessionCompletedPluginTasks, st as processPluginTask, xt as buildDeliveredTurnStatePatch } from "./agent-CL9ZkOgx.js";
3
+ import { h as getAssistantReplyText } from "./system-prompt-table-C886lsT9.js";
4
+ import { f as logException, w as withLogContext, x as setTags } from "./logging-CqgOoICc.js";
5
+ import { $n as normalizeConversationText, Dn as loadConversationProjection, Gt as markTurnFailed, J as getPersistedThreadState, Kr as finalizeFailedTurnReplyWithEvent, Kt as startActiveTurn, Mr as getTurnLifecycle, Nn as recordAuthorizationCompleted, Qn as markConversationMessage, Un as persistConversationMessages, Vn as hydrateConversationMessages, X as persistThreadStateById, Z as coerceThreadConversationState, Zn as latestConversationMessageSeq, er as recordDeliveredAssistantMessage, fr as authorizationId, ir as upsertConversationMessage, li as persistWithRetry, q as getPersistedSandboxState, wn as commitAcceptedReply, wr as saveTurnCheckpoint } from "./markers-BtUv4-oc.js";
6
+ import { f as credentialContextForActor } from "./adapter-BkDQYdg6.js";
7
+ import { i as getConversationStore, vc as SYSTEM_IDENTITY_ID } from "./db-CbURDbaB.js";
8
8
  import { createLocalSource, localDestinationSchema } from "@sentry/junior-plugin-api";
9
9
  import { randomUUID } from "node:crypto";
10
10
  // src/chat/local/runner.ts
@@ -1,4 +1,4 @@
1
- import { k as sandboxEgressSignalsResponseSchema } from "./profile-D9LdwmZi.js";
1
+ import { k as sandboxEgressSignalsResponseSchema } from "./profile-bLo0h7Le.js";
2
2
  // src/chat/local/sandbox-egress-signals.ts
3
3
  const SANDBOX_EGRESS_SIGNALS_PATH = "/api/internal/sandbox-egress/signals";
4
4
  const LOCAL_DEV_SERVER_TIMEOUT_MS = 1e3;
@@ -1,7 +1,7 @@
1
1
  import "./user-customization-CvfuY9Eo.js";
2
- import { F as actorIdentitySchema, G as conversationParamsSchema, Lt as conversationTreeStateSchema, Mn as notificationScheduleSchema, Q as conversationUsageSchema, X as conversationSummaryReportSchema, Yt as inputFileSchema, et as conversationChildAgentTotalsSchema, fn as inboxItemNoticeRequestSchema, i as TODO_STATUSES, mn as inboxItemRequestSchema, z as conversationAuxiliaryCostsSchema } from "./types-BNHkJrOP.js";
2
+ import { F as actorIdentitySchema, G as conversationParamsSchema, Lt as conversationTreeStateSchema, Q as conversationUsageSchema, X as conversationSummaryReportSchema, Yt as inputFileSchema, et as conversationChildAgentTotalsSchema, fn as inboxItemNoticeRequestSchema, i as TODO_STATUSES, jn as notificationScheduleSchema, mn as inboxItemRequestSchema, z as conversationAuxiliaryCostsSchema } from "./types-CGgQ3-Bb.js";
3
3
  import { l as fillUtcDays, p as sumUtcHoursIntoSixHours, t as AGENT_STATUSES, u as fillUtcHours, v as CHILD_AGENT_RESULTS } from "./agent-status-Bq_AIpyp.js";
4
- import { f as conversationTitleSchema } from "./conversation-feed-DEUdD7mb.js";
4
+ import { f as conversationTitleSchema } from "./conversation-feed-B1_1NJc8.js";
5
5
  import { t as isPushServiceEndpoint } from "./push-endpoint-CO-nomUd.js";
6
6
  import * as z from "zod";
7
7
  import { codeChangeStateSchema, eventMatchSchema, objectTypeSchema, ownedObjectAnnotationSchema } from "@sentry/junior-plugin-api";
@@ -300,7 +300,9 @@ const todoAssigneeSchema = z.discriminatedUnion("kind", [
300
300
  }).strict(),
301
301
  z.object({
302
302
  kind: z.literal("user"),
303
- name: z.string().min(1).optional()
303
+ name: z.string().min(1).optional(),
304
+ /** The To-do is assigned to the person who reads it. */
305
+ viewer: z.literal(true).optional()
304
306
  }).strict()
305
307
  ]);
306
308
  /**
@@ -1,5 +1,5 @@
1
- import { Fd as getAppContext, Hd as finishServiceAccountSignIn, Kd as serviceAccountPlugins, Ud as getServiceAccountStatus, Vd as disconnectServiceAccount, qd as startServiceAccountSignIn } from "./db-BCaNWl9p.js";
2
- import { n as disconnectStateAdapter } from "./adapter-8_S6Birm.js";
1
+ import { Bd as finishServiceAccountSignIn, Gd as startServiceAccountSignIn, Nd as getAppContext, Vd as getServiceAccountStatus, Wd as serviceAccountPlugins, zd as disconnectServiceAccount } from "./db-CbURDbaB.js";
2
+ import { n as disconnectStateAdapter } from "./adapter-BkDQYdg6.js";
3
3
  import { CLI_USAGE } from "./cli/run.js";
4
4
  import { createServer } from "node:http";
5
5
  // src/cli/service-account.ts
@@ -1,9 +1,9 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-BKpuH2hG.js";
2
- import { R as getChatConfig } from "./adapter-8_S6Birm.js";
2
+ import { R as getChatConfig } from "./adapter-BkDQYdg6.js";
3
3
  import { f as skillRoots } from "./topics-DxuKurCX.js";
4
- import { m as logWarn } from "./logging-BRPTXAdf.js";
5
- import { Fd as getAppContext } from "./db-BCaNWl9p.js";
6
- import { G as mapBounded } from "./prompt-3TqxEOtc.js";
4
+ import { m as logWarn } from "./logging-CqgOoICc.js";
5
+ import { Nd as getAppContext } from "./db-CbURDbaB.js";
6
+ import { G as mapBounded } from "./prompt-CX29OGO9.js";
7
7
  import * as z from "zod";
8
8
  import path from "node:path";
9
9
  import { parse } from "yaml";
@@ -1,11 +1,11 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-BKpuH2hG.js";
2
- import { Ar as readConversationAccessFromSql, Li as escapeSlackMrkdwnText, Mi as unfurlSlackLinks, P as getConversationIdByProviderConversation, Ri as formatSlackLink, a as getDb, fc as readActorIdentity, i as getConversationStore, jl as parseDashboardConversationLink, ki as postSlackEphemeralMessage, ni as runWithSlackInstallation, o as getSqlExecutor, sc as getWorkspaceTeamId, sd as createCache, xn as deferConversationMove } from "./db-BCaNWl9p.js";
3
- import { A as slackBotIdSchema, C as parseActorUserId, E as parseSlackChannelId, I as slackMessageTsSchema, L as botConfig, M as slackTeamIdSchema, N as slackUserIdSchema, O as parseSlackTeamId, j as slackChannelIdSchema, k as parseSlackUserId, v as createSlackActor } from "./adapter-8_S6Birm.js";
4
- import { i as lookupSlackUserProfile, n as lookupSlackBot } from "./users-CCRAqYb_.js";
5
- import { T as withSpan } from "./logging-BRPTXAdf.js";
6
- import { a as isMovableToSlack, i as continueConversationInSlack, n as alreadyContinuesInSlackMessage, t as BUSY } from "./continue-in-slack-CFzDyxkH.js";
7
- import { t as checkSlackChannelReadAccess } from "./channel-access-DET5hzZM.js";
8
- import { G as mapBounded } from "./prompt-3TqxEOtc.js";
2
+ import { Ii as escapeSlackMrkdwnText, Li as formatSlackLink, Oi as postSlackEphemeralMessage, P as getConversationIdByProviderConversation, a as getDb, ad as createCache, bn as deferConversationMove, dc as readActorIdentity, i as getConversationStore, ji as unfurlSlackLinks, kl as parseDashboardConversationLink, kr as readConversationAccessFromSql, o as getSqlExecutor, oc as getWorkspaceTeamId, ti as runWithSlackInstallation } from "./db-CbURDbaB.js";
3
+ import { A as slackBotIdSchema, C as parseActorUserId, E as parseSlackChannelId, I as slackMessageTsSchema, L as botConfig, M as slackTeamIdSchema, N as slackUserIdSchema, O as parseSlackTeamId, j as slackChannelIdSchema, k as parseSlackUserId, v as createSlackActor } from "./adapter-BkDQYdg6.js";
4
+ import { i as lookupSlackUserProfile, n as lookupSlackBot } from "./users-DBrcQl47.js";
5
+ import { T as withSpan } from "./logging-CqgOoICc.js";
6
+ import { a as isMovableToSlack, i as continueConversationInSlack, n as alreadyContinuesInSlackMessage, t as BUSY } from "./continue-in-slack-D9naZmqM.js";
7
+ import { t as checkSlackChannelReadAccess } from "./channel-access-BUHB0saC.js";
8
+ import { G as mapBounded } from "./prompt-CX29OGO9.js";
9
9
  import * as z from "zod";
10
10
  // src/chat/ingress/workspace-membership.ts
11
11
  const MEMBER_TTL_MS = 3e5;
@@ -1,5 +1,5 @@
1
- import { R as getChatConfig } from "./adapter-8_S6Birm.js";
2
- import { G as mapBounded } from "./prompt-3TqxEOtc.js";
1
+ import { R as getChatConfig } from "./adapter-BkDQYdg6.js";
2
+ import { G as mapBounded } from "./prompt-CX29OGO9.js";
3
3
  import * as z from "zod";
4
4
  import { AwsClient } from "aws4fetch";
5
5
  import { del, get, issueSignedToken, presignUrl, put } from "@vercel/blob";
@@ -1,7 +1,7 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-BKpuH2hG.js";
2
- import { D as isToolResultError, F as SESSION_CONTEXT_SECTION_TAG, I as TURN_CONTEXT_TAG, N as CAPABILITY_SECTION_TAG, O as isToolResultMessage, P as REQUEST_CONTEXT_SECTION_TAG, _ as extractAssistantText, d as SANDBOX_WORKSPACE_ROOT, f as sandboxSkillDir, h as createPluginLogger, k as normalizeToolNameFromResult, n as toPromptContributionContext, o as SANDBOX_DATA_ROOT, r as runPluginHooksAtOnce, t as PLUGIN_PROMPT_CONTRIBUTION_TOTAL_MAX_CHARS, w as isAssistantMessage } from "./prompt-3TqxEOtc.js";
2
+ import { D as isToolResultError, F as SESSION_CONTEXT_SECTION_TAG, I as TURN_CONTEXT_TAG, N as CAPABILITY_SECTION_TAG, O as isToolResultMessage, P as REQUEST_CONTEXT_SECTION_TAG, _ as extractAssistantText, d as SANDBOX_WORKSPACE_ROOT, f as sandboxSkillDir, h as createPluginLogger, k as normalizeToolNameFromResult, n as toPromptContributionContext, o as SANDBOX_DATA_ROOT, r as runPluginHooksAtOnce, t as PLUGIN_PROMPT_CONTRIBUTION_TOTAL_MAX_CHARS, w as isAssistantMessage } from "./prompt-CX29OGO9.js";
3
3
  import { m as worldPathCandidates, p as soulPathCandidates, u as listReferenceFiles } from "./topics-DxuKurCX.js";
4
- import { m as logWarn, p as logInfo } from "./logging-BRPTXAdf.js";
4
+ import { m as logWarn, p as logInfo } from "./logging-CqgOoICc.js";
5
5
  import * as z from "zod";
6
6
  import path from "node:path";
7
7
  import { escapeClosingTag, escapeTagText, escapeTagTextAndQuotes, findTags, indentTagLines, markdownNodes, openingTag, parseMarkdown, promptMessageSchema, renderInlineTag, renderTag, unescapeTagText } from "@sentry/junior-plugin-api";
@@ -333,9 +333,9 @@ const LEAD_RULES = [
333
333
  "- A member who tells you about a problem, a worry, or something they do not understand in the Space's area asks you to deal with it. Start the work that investigates it and delivers the fix or the answer, without asking first.",
334
334
  "- A brief gives the goal, the targets, the facts with their source, the constraints, what done means, and the shape of the result. Hand off only the work that the member asked for, and name other work as a follow-up. When you pass on a member's approval, quote their exact words.",
335
335
  "- When the result of one Thread changes the work of another, such as a renamed function or a moved file, tell the other Thread with `messageAgent`. Tell the members only when it changes what they get.",
336
- "- When the done signal of a Thread's work is true, archive the Thread with `archiveAgent`. Keep a Thread that a person still talks to.",
337
336
  "- A decision is a member's only when it changes what ships or who sees it, and nothing that they said settles it. Look for their earlier words first. A child's question about how to do the work, such as a design detail, is not a member's decision. A confirmation that a child or Guardian asks for before an action is the member's, as `<task-execution>` says. Make every other decision yourself and say that it is your decision. Do not write that a member gave it to you, such as \"they delegated it to me\".",
338
- `- When a child's result changes nothing for the members, end the Turn with \`${NO_REPLY_TOOL_NAME}\`.`,
337
+ "- When a child reports that the done signal of its work is true, such as a merged pull request, archive the child unless it still has open work. Then start the next step that the members agreed to, or tell the member what is done and the one next step that you suggest.",
338
+ `- When a child's result or message has no news for the members, such as checks that still run, end the Turn with \`${NO_REPLY_TOOL_NAME}\`.`,
339
339
  "- When a member asks where the work is, answer from `listAgents` and the live state of its pull requests, which a Task reads for you, in this order: what needs them, what is in flight, what is done.",
340
340
  "- The world section's facts, such as repositories and owners, help you write briefs. Its rules for how to do the work are for the Threads that do it."
341
341
  ];
@@ -587,14 +587,6 @@ function normalizeUserInputAnswer(request, answer) {
587
587
  ...other ? { other } : void 0
588
588
  };
589
589
  }
590
- /**
591
- * Return the option labels that an answer picked, in field order. Text
592
- * fields and the note pick no option.
593
- */
594
- function answeredChoices(request, answer) {
595
- const { values } = normalizeUserInputAnswer(request, answer);
596
- return request.fields.flatMap((field) => field.kind === "text" ? [] : values[field.id] ?? []);
597
- }
598
590
  /** Return true when an answer has no value and no free text. */
599
591
  function isEmptyUserInputAnswer(answer) {
600
592
  return !answer.other && Object.keys(answer.values).length === 0;
@@ -3078,4 +3070,4 @@ const TODOS_REGISTRATION_NAME = "todos";
3078
3070
  const UPDATE_TODOS_TOOL_NAME = `${TODOS_REGISTRATION_NAME}_updateTodos`;
3079
3071
  /** Assignee text for the list's own agent, in tool results and blocks. */
3080
3072
  const SELF_TODO_ASSIGNEE = "self";
3081
- export { activityPreviewText as $, automationInstructionToolSchema as $t, automationVersionSchema as A, DEFAULT_NOTIFICATION_SCHEDULE as An, spaceListQuerySchema as At, conversationDetailQuerySchema as B, AGENT_UPDATE_EVENT_TYPE as Bn, annotationCard as Bt, automationScheduleIntentSchema as C, userInputQuestionSchema as Cn, instructionActors as Ct, automationVersionActivateSchema as D, automationTaskDescription as Dn, SPACE_NAME_MAX_CHARS as Dt, automationUpdateSchema as E, automationTaskColumns as En, SPACE_DESCRIPTION_MAX_CHARS as Et, actorIdentitySchema as F, getZonedDateTimeParts as Fn, spaceVisibilitySchema as Ft, conversationParamsSchema as G, gatewayOnlyProviders as Gn, resolveMessageCards as Gt, conversationEventHistorySchema as H, isAgentMessageEventType as Hn, messageCardText as Ht, conversationActivityPreviewSchema as I, isValidTimeZone as In, updateSpaceBodySchema as It, conversationReportMessageEventSchema as J, MAX_INPUT_ATTACHMENTS as Jt, conversationReportEventDataSchema as K, usageSchema as Kn, automationCardStatus as Kt, conversationAttachmentParamsSchema as L, CONTENT_VERSION_HEADER as Ln, conversationTreeStateSchema as Lt, scheduledAutomationSummarySchema as M, notificationScheduleSchema as Mn, spaceParamsSchema as Mt, CONVERSATION_DETAIL_VERSION_HEADER as N, getFirstRunAtMs as Nn, spaceRefSchema as Nt, automationVersionListSchema as O, automationTaskSchema as On, archiveSpaceBodySchema as Ot, CONVERSATION_VERSION_HEADER as P, getNextRunAtMs as Pn, spaceSchema as Pt, conversationUsageSchema as Q, automationContextToolSchema as Qt, conversationAttachmentQuerySchema as R, apiErrorSchema as Rn, conversationReadPositionSchema as Rt, automationRunWindowsSchema as S, userInputFieldsSchema as Sn, contextProvenance as St, automationSummarySchema as T, automationSkillNameSchema as Tn, sameActorIdentity as Tt, conversationEventPageSchema as U, isAgentUpdateEventType as Un, readMessageCardRefs as Ut, conversationDetailReportSchema as V, TOP_LEVEL_AGENT_MESSAGE_EVENT_TYPE as Vn, messageCardRef as Vt, conversationEventsQuerySchema as W, isLegacyResultEventType as Wn, removedCardSchema as Wt, conversationSummaryReportSchema as X, messageAttachmentSchema as Xt, conversationReportStatusSchema as Y, inputFileSchema as Yt, conversationSurfaceSchema as Z, readMessageAttachments as Zt, automationListQuerySchema as _, answeredChoices as _n, historyReplacementSchema as _t, UPDATE_TODOS_TOOL_NAME as a, ScheduleIntentError as an, KNOWN_CONVERSATION_EVENT_TYPES as at, automationRunListSchema as b, isEmptyUserInputAnswer as bn, piMessageSchema as bt, automationEditSchema as c, toolScheduleIntentSchema as cn, conversationTurnFailureReasonSchema as ct, automationExecutionSchema as d, eventAutomationTriggerSchema as dn, agentHistoryFromRow as dt, automationTitleSchema as en, conversationChildAgentTotalsSchema as et, automationExecutionStatusDaySchema as f, inboxItemNoticeRequestSchema as fn, encodeAgentHistoryPayload as ft, automationListPageSchema as g, USER_INPUT_NOTE as gn, historyItemFromPiMessage as gt, automationListItemSchema as h, USER_INPUT_LIMITS as hn, HISTORY_REPLACEMENT_TYPES as ht, TODO_STATUSES as i, scheduledRunSchema as in, formatAgentTypes as it, eventAutomationSummarySchema as j, isWithinNotificationSchedule as jn, spaceListSchema as jt, automationVersionParamsSchema as k, automationTaskText as kn, createSpaceBodySchema as kt, automationEventCatalogSchema as l, weekdaySchema as ln, decodeStoredConversationEvent as lt, automationLifecycleSchema as m, inboxItemRequestSchema as mn, AGENT_HISTORY_ITEM_TYPES as mt, SELF_TODO_ASSIGNEE as n, SCHEDULED_AUTOMATION_SYSTEM_ACTOR as nn, agentTypeInstructions as nt, isOpenTodoStatus as o, compileScheduleIntent as on, conversationEventDataSchema as ot, automationExecutionStatusSchema as p, inboxItemQuestion as pn, isAgentHistoryData as pt, conversationReportEventSchema as q, usageTokensSchema as qn, MAX_ATTACHMENT_BYTES as qt, TODOS_REGISTRATION_NAME as r, scheduledAutomationSchema as rn, agentTypeSchema as rt, automationEditErrorSchema as s, scheduleIntentFromTool as sn, conversationTurnFailureCodeSchema as st, OPEN_TODO_STATUSES as t, taskOutcomeInputSchema as tn, AGENT_TYPES as tt, automationExecutionListSchema as u, eventAutomationSchema as un, newConversationEventSchema as ut, automationListSchema as v, buttonUserInputField as vn, isHistoryReplacement as vt, automationSchedulePreviewSchema as w, userInputRequestSchema as wn, instructionProvenanceFor as wt, automationRunSchema as x, normalizeUserInputAnswer as xn, agentInstructionProvenance as xt, automationParamsSchema as y, formatUserInputAnswer as yn, piMessageFromHistoryItem as yt, conversationAuxiliaryCostsSchema as z, AGENT_MESSAGE_EVENT_TYPE as zn, inboxItemChangeRecordSchema as zt };
3073
+ export { activityPreviewText as $, automationInstructionToolSchema as $t, automationVersionSchema as A, isWithinNotificationSchedule as An, spaceListQuerySchema as At, conversationDetailQuerySchema as B, TOP_LEVEL_AGENT_MESSAGE_EVENT_TYPE as Bn, annotationCard as Bt, automationScheduleIntentSchema as C, userInputRequestSchema as Cn, instructionActors as Ct, automationVersionActivateSchema as D, automationTaskSchema as Dn, SPACE_NAME_MAX_CHARS as Dt, automationUpdateSchema as E, automationTaskDescription as En, SPACE_DESCRIPTION_MAX_CHARS as Et, actorIdentitySchema as F, isValidTimeZone as Fn, spaceVisibilitySchema as Ft, conversationParamsSchema as G, usageSchema as Gn, resolveMessageCards as Gt, conversationEventHistorySchema as H, isAgentUpdateEventType as Hn, messageCardText as Ht, conversationActivityPreviewSchema as I, CONTENT_VERSION_HEADER as In, updateSpaceBodySchema as It, conversationReportMessageEventSchema as J, MAX_INPUT_ATTACHMENTS as Jt, conversationReportEventDataSchema as K, usageTokensSchema as Kn, automationCardStatus as Kt, conversationAttachmentParamsSchema as L, apiErrorSchema as Ln, conversationTreeStateSchema as Lt, scheduledAutomationSummarySchema as M, getFirstRunAtMs as Mn, spaceParamsSchema as Mt, CONVERSATION_DETAIL_VERSION_HEADER as N, getNextRunAtMs as Nn, spaceRefSchema as Nt, automationVersionListSchema as O, automationTaskText as On, archiveSpaceBodySchema as Ot, CONVERSATION_VERSION_HEADER as P, getZonedDateTimeParts as Pn, spaceSchema as Pt, conversationUsageSchema as Q, automationContextToolSchema as Qt, conversationAttachmentQuerySchema as R, AGENT_MESSAGE_EVENT_TYPE as Rn, conversationReadPositionSchema as Rt, automationRunWindowsSchema as S, userInputQuestionSchema as Sn, contextProvenance as St, automationSummarySchema as T, automationTaskColumns as Tn, sameActorIdentity as Tt, conversationEventPageSchema as U, isLegacyResultEventType as Un, readMessageCardRefs as Ut, conversationDetailReportSchema as V, isAgentMessageEventType as Vn, messageCardRef as Vt, conversationEventsQuerySchema as W, gatewayOnlyProviders as Wn, removedCardSchema as Wt, conversationSummaryReportSchema as X, messageAttachmentSchema as Xt, conversationReportStatusSchema as Y, inputFileSchema as Yt, conversationSurfaceSchema as Z, readMessageAttachments as Zt, automationListQuerySchema as _, buttonUserInputField as _n, historyReplacementSchema as _t, UPDATE_TODOS_TOOL_NAME as a, ScheduleIntentError as an, KNOWN_CONVERSATION_EVENT_TYPES as at, automationRunListSchema as b, normalizeUserInputAnswer as bn, piMessageSchema as bt, automationEditSchema as c, toolScheduleIntentSchema as cn, conversationTurnFailureReasonSchema as ct, automationExecutionSchema as d, eventAutomationTriggerSchema as dn, agentHistoryFromRow as dt, automationTitleSchema as en, conversationChildAgentTotalsSchema as et, automationExecutionStatusDaySchema as f, inboxItemNoticeRequestSchema as fn, encodeAgentHistoryPayload as ft, automationListPageSchema as g, USER_INPUT_NOTE as gn, historyItemFromPiMessage as gt, automationListItemSchema as h, USER_INPUT_LIMITS as hn, HISTORY_REPLACEMENT_TYPES as ht, TODO_STATUSES as i, scheduledRunSchema as in, formatAgentTypes as it, eventAutomationSummarySchema as j, notificationScheduleSchema as jn, spaceListSchema as jt, automationVersionParamsSchema as k, DEFAULT_NOTIFICATION_SCHEDULE as kn, createSpaceBodySchema as kt, automationEventCatalogSchema as l, weekdaySchema as ln, decodeStoredConversationEvent as lt, automationLifecycleSchema as m, inboxItemRequestSchema as mn, AGENT_HISTORY_ITEM_TYPES as mt, SELF_TODO_ASSIGNEE as n, SCHEDULED_AUTOMATION_SYSTEM_ACTOR as nn, agentTypeInstructions as nt, isOpenTodoStatus as o, compileScheduleIntent as on, conversationEventDataSchema as ot, automationExecutionStatusSchema as p, inboxItemQuestion as pn, isAgentHistoryData as pt, conversationReportEventSchema as q, MAX_ATTACHMENT_BYTES as qt, TODOS_REGISTRATION_NAME as r, scheduledAutomationSchema as rn, agentTypeSchema as rt, automationEditErrorSchema as s, scheduleIntentFromTool as sn, conversationTurnFailureCodeSchema as st, OPEN_TODO_STATUSES as t, taskOutcomeInputSchema as tn, AGENT_TYPES as tt, automationExecutionListSchema as u, eventAutomationSchema as un, newConversationEventSchema as ut, automationListSchema as v, formatUserInputAnswer as vn, isHistoryReplacement as vt, automationSchedulePreviewSchema as w, automationSkillNameSchema as wn, instructionProvenanceFor as wt, automationRunSchema as x, userInputFieldsSchema as xn, agentInstructionProvenance as xt, automationParamsSchema as y, isEmptyUserInputAnswer as yn, piMessageFromHistoryItem as yt, conversationAuxiliaryCostsSchema as z, AGENT_UPDATE_EVENT_TYPE as zn, inboxItemChangeRecordSchema as zt };
@@ -1,4 +1,4 @@
1
- import { Zs as getSlackClient, ac as withSlackRetries, qs as SlackActionError } from "./db-BCaNWl9p.js";
1
+ import { Ks as SlackActionError, Xs as getSlackClient, ic as withSlackRetries } from "./db-CbURDbaB.js";
2
2
  import * as z from "zod";
3
3
  // src/chat/slack/users.ts
4
4
  const profileFieldsSchema = z.object({ fields: z.record(z.string(), z.object({
@@ -1,5 +1,5 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-BKpuH2hG.js";
2
- import { Fd as getAppContext } from "./db-BCaNWl9p.js";
2
+ import { Nd as getAppContext } from "./db-CbURDbaB.js";
3
3
  import { isDeepStrictEqual } from "node:util";
4
4
  // src/chat/plugins/validation.ts
5
5
  var validation_exports = /* @__PURE__ */ __exportAll({