@sentry/junior 0.306.0 → 0.307.1

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 (91) hide show
  1. package/dist/{adapter-context-CnY-i32r.js → adapter-context-HrBTD8rJ.js} +2 -2
  2. package/dist/{admin-BLLdLnXh.js → admin-B78_KmfR.js} +2 -2
  3. package/dist/{agent-runner-BaLjEjPR.js → agent-runner-DxivxUYd.js} +226 -137
  4. package/dist/api/schema.d.ts +2 -2
  5. package/dist/api/schema.js +4 -4
  6. package/dist/api.d.ts +1 -1
  7. package/dist/api.js +328 -298
  8. package/dist/{app-DvYbM9UD.d.ts → app-EZur8cVC.d.ts} +12 -3
  9. package/dist/app.d.ts +2 -2
  10. package/dist/app.js +84 -44
  11. package/dist/background-compaction-queue-HlljT9ql.js +231 -0
  12. package/dist/{briefs-DvyzXfrF.js → briefs-DR8mp-TK.js} +2 -2
  13. package/dist/{catalog-runtime-B1R-nHd3.js → catalog-runtime-Se9idiDR.js} +1 -1
  14. package/dist/cli/chat.d.ts +1 -1
  15. package/dist/cli/chat.js +17 -16
  16. package/dist/cli/check.js +58 -48
  17. package/dist/cli/main.js +3 -3
  18. package/dist/cli/plugins.d.ts +1 -1
  19. package/dist/cli/plugins.js +4 -4
  20. package/dist/cli/snapshot-create.js +5 -5
  21. package/dist/cli/upgrade.d.ts +2 -2
  22. package/dist/cli/upgrade.js +3 -8
  23. package/dist/{config-DUD-zMvp.js → config-DY5c1E0l.js} +74 -38
  24. package/dist/{connections-CDhsqPcC.js → connections-C-SqzubG.js} +10 -8
  25. package/dist/{continue-in-slack-BXQizz9o.js → continue-in-slack-DNkrrWuQ.js} +5 -5
  26. package/dist/{conversation-privacy-YE54gMN8.js → conversation-privacy-CVj9vSrP.js} +1 -1
  27. package/dist/{conversation-turn-BzdmrHb0.js → conversation-turn-CkzrIfJ2.js} +19 -47
  28. package/dist/{credential-sync-Cdm-e1vJ.js → credential-sync-B9CIkgOT.js} +28 -28
  29. package/dist/{db-DV2ZUb1Y.js → db-C21CyyTE.js} +140 -11
  30. package/dist/{db-pH357Dkt.d.ts → db-C41UgdBj.d.ts} +1 -1
  31. package/dist/{executor-CjNhwwnj.js → executor-DfNoVVGd.js} +93 -32
  32. package/dist/{install-DbD7C5td.js → install-lYZs8UCL.js} +2 -2
  33. package/dist/instrumentation.js +2 -2
  34. package/dist/{lineage-BFdIPb3o.js → lineage-BJTSY53A.js} +2 -2
  35. package/dist/{logging-oYpJYr-S.js → logging-DjW7LjgJ.js} +1 -1
  36. package/dist/{message-BBPcMKJY.js → message-BPPZpdoZ.js} +8 -8
  37. package/dist/{model-input-DYYF3a8B.js → model-input-DKqiLFGa.js} +3 -3
  38. package/dist/nitro.d.ts +2 -2
  39. package/dist/nitro.js +12 -5
  40. package/dist/{oauth-callback-server-C7Q987su.js → oauth-callback-server-OJP8Y4Ca.js} +2 -2
  41. package/dist/{oauth-relay-DAmfVmJu.js → oauth-relay-KwDz41Z3.js} +1 -1
  42. package/dist/{plugins-B_0Cr0MO.d.ts → plugins-fBrz8PCV.d.ts} +2 -0
  43. package/dist/{projection-CWXDE0f6.js → projection-D47mlszd.js} +1112 -693
  44. package/dist/{prompt-P3eRqO8C.js → prompt-DuWH_YIb.js} +3 -3
  45. package/dist/{registry-1pzXmplY.js → registry-yht0oxq6.js} +19 -9
  46. package/dist/{resolve-n87oXY-d.js → resolve-gZ-hVMYl.js} +3 -3
  47. package/dist/{result-BmF9v9bv.js → result-CP99Ok0_.js} +13 -11
  48. package/dist/{runner-4j7ZsxP5.js → runner-eVlnUkY7.js} +9 -9
  49. package/dist/{sandbox-egress-signals-BRQI8HvT.js → sandbox-egress-signals-DZL_0lnG.js} +1 -1
  50. package/dist/{schedule-CHPWQn-x.js → schedule-BG1tEbRF.js} +34 -4
  51. package/dist/{schema-CVbIjrF3.d.ts → schema-CRXcj4fj.d.ts} +350 -143
  52. package/dist/{schema-D7iIEh6t.js → schema-D4jdesIu.js} +12 -4
  53. package/dist/{service-account-DzQiOmqa.js → service-account-CZneZHh7.js} +8 -6
  54. package/dist/{service-account-BDQ9xzta.js → service-account-tI3LBg2_.js} +3 -3
  55. package/dist/{session-stop-BQxgHR4X.js → session-stop-D3S7mSkX.js} +36 -23
  56. package/dist/{skills-CPf4vNuC.js → skills-Bm6uSO9V.js} +32 -28
  57. package/dist/{slack-conversation-unfurl-B1KEptUg.js → slack-conversation-unfurl-BeBvg3xU.js} +10 -10
  58. package/dist/{spawn-CjGddiAU.js → spawn-vhMAmLuh.js} +6 -6
  59. package/dist/{state-9wfj6aSD.js → state-3Yiy2FvP.js} +4 -4
  60. package/dist/{stop-CsQGuN5n.js → stop-Bh53GUoX.js} +146 -158
  61. package/dist/{store-Dz3YZ7gQ.js → store-BZJdHYR7.js} +5 -5
  62. package/dist/{background-compaction-queue-D2wzxtGU.js → task-queue-BEl5G38v.js} +164 -180
  63. package/dist/{task-runner-frzlUvFD.js → task-runner-C6Bujc6h.js} +11 -8
  64. package/dist/{thread-context-C4QuZlM8.js → thread-context-DxMQGGd_.js} +6 -6
  65. package/dist/{turn-session-routing-BXaubz2w.js → turn-session-routing-CmQY0T60.js} +24 -5
  66. package/dist/{turn-user-message-DNC0eRZ7.js → turn-user-message-Dfbr3Ud9.js} +3 -3
  67. package/dist/{users-XCCKn3xW.js → users-6rSdqXXk.js} +1 -1
  68. package/dist/{validation-L5fdjmFX.js → validation--hsjOLRL.js} +1 -1
  69. package/dist/{version-BFmuwgxP.js → version-9iMT25Hq.js} +1 -1
  70. package/dist/version.js +1 -1
  71. package/dist/{viewer-DKOeHpv3.js → viewer-De1vmuEA.js} +3 -3
  72. package/dist/{warmup-mTMIatCV.js → warmup-C0IblNtf.js} +596 -281
  73. package/dist/{web-message-id-CUaSiGme.js → web-message-id-BT8Mg8LL.js} +1 -1
  74. package/dist/{worker-Bz4KNxjI.js → worker-CiyRr2q7.js} +8 -7
  75. package/migrations/0115_automation_creator_slack_index.sql +1 -0
  76. package/migrations/0116_conversation_event_search.sql +25 -0
  77. package/migrations/0117_automation_last_run.sql +46 -0
  78. package/migrations/0118_automation_last_run_index.sql +1 -0
  79. package/migrations/0119_money_micro_usd.sql +29 -0
  80. package/migrations/0120_conversation_cost_micro_usd.sql +8 -0
  81. package/migrations/meta/0115_snapshot.json +5225 -0
  82. package/migrations/meta/0116_snapshot.json +5388 -0
  83. package/migrations/meta/0117_snapshot.json +5413 -0
  84. package/migrations/meta/0118_snapshot.json +5428 -0
  85. package/migrations/meta/0119_snapshot.json +5441 -0
  86. package/migrations/meta/0120_snapshot.json +5441 -0
  87. package/migrations/meta/_journal.json +42 -0
  88. package/package.json +10 -9
  89. package/dist/queue-7FSijgqG.js +0 -115
  90. package/dist/secrets-DHaJ5TTn.js +0 -18
  91. package/dist/task-queue-CFlrJguF.js +0 -89
@@ -1,8 +1,8 @@
1
- import { F as sumUtcHoursIntoSixHours, M as fillUtcHours, d as userInputRequestSchema, i as AGENT_INVOCATION_STATUSES, j as fillUtcDays, y as PLAN_ITEM_STATUSES } from "./web-message-id-CUaSiGme.js";
1
+ import { F as sumUtcHoursIntoSixHours, M as fillUtcHours, d as userInputRequestSchema, i as AGENT_INVOCATION_STATUSES, j as fillUtcDays, y as PLAN_ITEM_STATUSES } from "./web-message-id-BT8Mg8LL.js";
2
2
  import { $ as inputFileSchema, D as conversationChildAgentTotalsSchema, E as idempotencyKeySchema, c as conversationAuxiliaryCostsSchema, i as actorIdentitySchema, m as conversationParamsSchema, x as conversationUsageSchema, y as conversationSummaryReportSchema } from "./conversation--f85g4zL.js";
3
3
  import "./conversation-feed-BNs9KiqC.js";
4
4
  import { t as isPushServiceEndpoint } from "./push-endpoint-CO-nomUd.js";
5
- import { r as notificationScheduleSchema } from "./schedule-CHPWQn-x.js";
5
+ import { r as notificationScheduleSchema } from "./schedule-BG1tEbRF.js";
6
6
  import * as z from "zod";
7
7
  import { codeChangeStateSchema, eventMatchSchema, objectTypeSchema, ownedObjectAnnotationSchema } from "@sentry/junior-plugin-api";
8
8
  // src/api/schema/conversation-attachment-upload.ts
@@ -88,8 +88,8 @@ const conversationAutoArchiveSchema = z.object({ autoArchive: z.boolean() }).str
88
88
  const archiveDoneConversationsResponseSchema = z.object({ archived: z.number().int().nonnegative() }).strict();
89
89
  // src/api/schema/conversation-outline.ts
90
90
  /**
91
- * Longest outline item text. The outline previews each message, so the
92
- * server cuts the text and does not send whole messages.
91
+ * Longest outline item text and reply. The outline previews each message,
92
+ * so the server cuts the text and does not send whole messages.
93
93
  */
94
94
  const CONVERSATION_OUTLINE_TEXT_LENGTH = 200;
95
95
  /**
@@ -99,7 +99,15 @@ const CONVERSATION_OUTLINE_TEXT_LENGTH = 200;
99
99
  */
100
100
  const conversationOutlineSchema = z.object({ items: z.array(z.object({
101
101
  seq: z.number().int().nonnegative(),
102
+ createdAt: z.string().datetime(),
103
+ /** Identity id of the author. Detail `authors` maps it to the person. */
104
+ actorIdentityId: z.string().min(1).optional(),
105
+ /** Agent invocation whose input this is. An agent wrote it. */
106
+ agentInvocationId: z.string().min(1).optional(),
102
107
  text: z.string().min(1),
108
+ /** The last Junior text before the next item. */
109
+ reply: z.string().min(1).optional(),
110
+ /** People that the text or the reply mention. */
103
111
  mentions: z.array(actorIdentitySchema).optional()
104
112
  }).strict()) }).strict();
105
113
  // src/api/schema/conversation-stats.ts
@@ -1,8 +1,9 @@
1
- import { K as isRecord, b as setSpanAttributes, h as logWarn } from "./logging-oYpJYr-S.js";
2
- import { c as fetchWithBoundedOAuthErrorBodies, i as resolvePluginHeaderEnvRefs } from "./registry-1pzXmplY.js";
3
- import { $ as getStateAdapter, at as withLock, bt as parseDestination, it as fenceLock, nt as MUTATION_LOCK_TTL_MS } from "./db-DV2ZUb1Y.js";
4
- import { n as readEncryptedState, r as findLegacyWebActorUserId, t as createEncryptedState } from "./state-9wfj6aSD.js";
5
- import { n as botConfig } from "./config-DUD-zMvp.js";
1
+ import { K as isRecord, b as setSpanAttributes, h as logWarn } from "./logging-DjW7LjgJ.js";
2
+ import { i as resolvePluginHeaderEnvRefs, l as fetchWithBoundedOAuthErrorBodies } from "./registry-yht0oxq6.js";
3
+ import { $ as getStateAdapter, Dt as parseDestination, at as withLock, it as fenceLock, nt as MUTATION_LOCK_TTL_MS } from "./db-C21CyyTE.js";
4
+ import { n as readEncryptedState, r as findLegacyWebActorUserId, t as createEncryptedState } from "./state-3Yiy2FvP.js";
5
+ import { n as botConfig } from "./config-DY5c1E0l.js";
6
+ import pLimit from "p-limit";
6
7
  import { AsyncLocalStorage } from "node:async_hooks";
7
8
  import { randomUUID } from "node:crypto";
8
9
  import { sourceSchema } from "@sentry/junior-plugin-api";
@@ -234,7 +235,8 @@ async function deleteMcpAuthSessionsForUserProvider(userId, provider) {
234
235
  const stateAdapter = await getConnectedStateAdapter();
235
236
  const indexKey = sessionIndexKey(userId, provider);
236
237
  const authSessionIds = parseSessionIndex(await stateAdapter.get(indexKey));
237
- for (const authSessionId of authSessionIds) await stateAdapter.delete(sessionKey(authSessionId));
238
+ const limit = pLimit(8);
239
+ await Promise.all(authSessionIds.map((authSessionId) => limit(() => stateAdapter.delete(sessionKey(authSessionId)))));
238
240
  await stateAdapter.delete(indexKey);
239
241
  }
240
242
  async function getMcpStoredOAuthCredentials(userId, provider) {
@@ -1,6 +1,6 @@
1
- import { n as finishServiceAccountSignIn, o as serviceAccountPlugins, r as getServiceAccountStatus, s as startServiceAccountSignIn, t as disconnectServiceAccount } from "./service-account-DzQiOmqa.js";
2
- import { n as pluginCatalogRuntime } from "./catalog-runtime-B1R-nHd3.js";
3
- import { Z as disconnectStateAdapter } from "./db-DV2ZUb1Y.js";
1
+ import { n as finishServiceAccountSignIn, o as serviceAccountPlugins, r as getServiceAccountStatus, s as startServiceAccountSignIn, t as disconnectServiceAccount } from "./service-account-CZneZHh7.js";
2
+ import { n as pluginCatalogRuntime } from "./catalog-runtime-Se9idiDR.js";
3
+ import { Z as disconnectStateAdapter } from "./db-C21CyyTE.js";
4
4
  import { CLI_USAGE } from "./cli/run.js";
5
5
  import { createServer } from "node:http";
6
6
  // src/cli/service-account.ts
@@ -1,18 +1,19 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-BKpuH2hG.js";
2
- import { $n as getPlugins, A as normalizeConversationText, Ac as ToolInputError, Ca as SANDBOX_WORKSPACE_ROOT, Cn as hasRuntimeTurnContext, Co as findActorTimezone, Cr as getReviewItem, Cs as normalizeSlackReplyMarkdown, Di as listWorkspaces, Ea as sandboxSkillPathResolution, Fn as CAPABILITY_SECTION_TAG, In as REQUEST_CONTEXT_SECTION_TAG, Ln as SESSION_CONTEXT_SECTION_TAG, Mn as retainRuntimeTurnContext, Nn as stripRuntimeTurnContext, Qn as getPluginUserPromptContributions, Qo as postSlackMessage, Rn as TURN_CONTEXT_TAG, Ss as formatSlackLink, Ta as sandboxSkillFile, Ts as slackMention, Vs as getDashboardObjectIconLink, Xa as buildSentryConversationUrl, Xn as getPluginSystemPromptContributions, Yn as getPluginSlackConversationLink, at as getTurnRecord, ba as SANDBOX_DATA_ROOT, bi as verifyTimerWatchCredentialSubject, cc as CORE_EVENT_NAMESPACE, dc as eventCatalogEntry, fc as eventGuidance, gn as REPORT_BLOCKED_TOOL_NAME, is as slackExternalRefIdSchema, it as getStoredTurnFields, ls as getSlackClient, ni as cancelSubscriptions, nn as REPLY_TOOL_NAME, ot as listTurnSummaries, qc as JUNIOR_THREAD_STATE_TTL_MS, un as NO_REPLY_TOOL_NAME, wa as sandboxSkillDir, x as toStoredConversationMessage, xa as SANDBOX_REPOS_ROOT, xs as escapeSlackMrkdwnText, zs as getDashboardConversationLink } from "./projection-CWXDE0f6.js";
3
- import { $ as getStateAdapter, B as findLinkedSlackUser, I as resolveActorIdentityId, P as SYSTEM_IDENTITY_ID, T as isPersonInput, V as findSlackUserByPrimaryEmail, X as createCache, _t as nextDetailVersion, a as getConversationStore, o as getDb, r as getConversationEventStore, s as getSqlExecutor, vt as touchConversationDetail } from "./db-DV2ZUb1Y.js";
4
- import { G as escapeTagText, H as escapeXmlText, Q as tagJson, R as isCompactionSummaryText, U as authorAttrs, V as escapeXml, W as escapeClosingTags, X as renderTag$1, Y as renderChildTag, n as botConfig, o as getSlackBotToken, z as renderCurrentInstruction } from "./config-DUD-zMvp.js";
2
+ import { A as normalizeConversationText, An as getPluginSystemPromptContributions, Bs as slackMention, Cc as CORE_EVENT_NAMESPACE, Dc as eventGuidance, Ec as eventCatalogEntry, Fa as SANDBOX_WORKSPACE_ROOT, Gc as ToolInputError, Ia as sandboxSkillDir, Is as escapeSlackMrkdwnText, La as sandboxSkillFile, Lo as findActorTimezone, Ls as formatSlackLink, Ma as SANDBOX_REPOS_ROOT, Mn as getPluginUserPromptContributions, Nn as getPlugins, Pr as getReviewItem, Ra as sandboxSkillPathResolution, Ri as listWorkspaces, Rs as normalizeSlackReplyMarkdown, _s as fitsSlackMetadataLimit, at as getTurnRecord, co as buildSentryConversationUrl, dr as stripRuntimeTurnContext, ec as getDashboardConversationLink, fs as postSlackMessage, gn as REPORT_BLOCKED_TOOL_NAME, gr as TURN_CONTEXT_TAG, hr as SESSION_CONTEXT_SECTION_TAG, it as getStoredTurnFields, ja as SANDBOX_DATA_ROOT, ji as verifyTimerWatchCredentialSubject, kn as getPluginSlackConversationLink, mr as REQUEST_CONTEXT_SECTION_TAG, nc as getDashboardObjectIconLink, nn as REPLY_TOOL_NAME, ot as listTurnSummaries, pi as cancelSubscriptions, pr as CAPABILITY_SECTION_TAG, sl as JUNIOR_THREAD_STATE_TTL_MS, tr as hasRuntimeTurnContext, un as NO_REPLY_TOOL_NAME, ur as retainRuntimeTurnContext, ws as getSlackClient, x as toStoredConversationMessage, ys as slackExternalRefIdSchema } from "./projection-D47mlszd.js";
3
+ import { $ as getStateAdapter, B as findLinkedSlackUser, I as resolveActorIdentityId, P as SYSTEM_IDENTITY_ID, T as isPersonInput, Tt as touchConversationDetail, V as findSlackUserByPrimaryEmail, X as createCache, a as getConversationStore, o as getDb, r as getConversationEventStore, s as getSqlExecutor, wt as nextDetailVersion } from "./db-C21CyyTE.js";
4
+ import { G as escapeTagText, H as escapeXmlText, Q as tagJson, R as isCompactionSummaryText, U as authorAttrs, V as escapeXml, W as escapeClosingTags, X as renderTag$1, Y as renderChildTag, n as botConfig, o as getSlackBotToken, z as renderCurrentInstruction } from "./config-DY5c1E0l.js";
5
5
  import { a as listReferenceFiles, c as soulPathCandidates, l as worldPathCandidates } from "./package-discovery-x4AvVhMj.js";
6
- import { G as normalizeIdentityEmail, W as isNativeIdentityProvider, h as logWarn, m as logInfo, p as logException, v as serializeGenAiAttribute } from "./logging-oYpJYr-S.js";
7
- import { _ as JUNIOR_NATIVE_EVENT_NAMESPACE, a as EVENT_SYSTEM_ACTOR, i as EVENT_MESSAGE_AUTHOR, o as eventBotAuthorId, r as EVENT_AUTHOR_ID, s as isEventConversationMessage, x as conversationNoteEvent } from "./prompt-P3eRqO8C.js";
8
- import { b as SELF_PLAN_ASSIGNEE, c as formatUserInputAnswer, h as isVisionImageMediaType, v as userCustomizationTextSchema, x as isOpenPlanItemStatus } from "./web-message-id-CUaSiGme.js";
9
- import { F as juniorConversations, I as juniorIdentities, L as juniorUsers, _ as juniorAgentBindings, o as juniorPlanItemVersionSeq, s as juniorPlanItems } from "./executor-CjNhwwnj.js";
10
- import { i as parseSkillFile } from "./skills-CPf4vNuC.js";
11
- import { a as toCanonicalInputMessage } from "./conversation-privacy-YE54gMN8.js";
6
+ import { G as normalizeIdentityEmail, W as isNativeIdentityProvider, h as logWarn, m as logInfo, p as logException, v as serializeGenAiAttribute } from "./logging-DjW7LjgJ.js";
7
+ import { _ as JUNIOR_NATIVE_EVENT_NAMESPACE, a as EVENT_SYSTEM_ACTOR, i as EVENT_MESSAGE_AUTHOR, o as eventBotAuthorId, r as EVENT_AUTHOR_ID, s as isEventConversationMessage, x as conversationNoteEvent } from "./prompt-DuWH_YIb.js";
8
+ import { b as SELF_PLAN_ASSIGNEE, c as formatUserInputAnswer, h as isVisionImageMediaType, v as userCustomizationTextSchema, x as isOpenPlanItemStatus } from "./web-message-id-BT8Mg8LL.js";
9
+ import { B as juniorUsers, R as juniorConversations, c as juniorPlanItems, s as juniorPlanItemVersionSeq, v as juniorAgentBindings, z as juniorIdentities } from "./executor-DfNoVVGd.js";
10
+ import { i as parseSkillFile } from "./skills-Bm6uSO9V.js";
11
+ import { a as toCanonicalInputMessage } from "./conversation-privacy-CVj9vSrP.js";
12
12
  import { o as isUserActor, p as parseSlackUserId, t as createActor } from "./actor-D2iXzvlN.js";
13
- import { r as appendAndEnqueueInboundMessage } from "./store-Dz3YZ7gQ.js";
14
- import { i as lookupSlackUserProfile, t as lookupActiveSlackWorkspaceMember } from "./users-XCCKn3xW.js";
15
- import { h as credentialSubjectSchema } from "./registry-1pzXmplY.js";
13
+ import { r as appendAndEnqueueInboundMessage } from "./store-BZJdHYR7.js";
14
+ import { i as lookupSlackUserProfile, t as lookupActiveSlackWorkspaceMember } from "./users-6rSdqXXk.js";
15
+ import { g as credentialSubjectSchema } from "./registry-yht0oxq6.js";
16
+ import pLimit from "p-limit";
16
17
  import * as z from "zod";
17
18
  import { getCurrentSystemMessage, getSystemMessageText } from "@earendil-works/pi-ai/compat";
18
19
  import path from "node:path";
@@ -23,7 +24,6 @@ import { and, asc, eq, inArray, isNull, lt, lte, or, sql } from "drizzle-orm";
23
24
  import { agentEventKeys, createEventSource, createLocalSource, createWebSource, eventMatchFieldsSchema, objectFactFields, objectPresentation, objectTypeSchema } from "@sentry/junior-plugin-api";
24
25
  import { alias } from "drizzle-orm/pg-core";
25
26
  import fs from "node:fs";
26
- import pLimit from "p-limit";
27
27
  // src/chat/pi/agent-history.ts
28
28
  function isSystemMessage(message) {
29
29
  return message?.role === "system";
@@ -2226,9 +2226,19 @@ async function sendSlackReply(args) {
2226
2226
  text,
2227
2227
  cards: []
2228
2228
  }));
2229
- const cards = (args.cards ?? []).map((card) => renderSlackCard(card, args.conversationId));
2230
- for (let index = 0; index < cards.length; index += 5) {
2231
- const group = cards.slice(index, index + 5);
2229
+ const groups = [];
2230
+ for (const card of args.cards ?? []) {
2231
+ const rendered = renderSlackCard(card, args.conversationId);
2232
+ const slackCard = rendered.entity && !fitsSlackMetadataLimit([rendered.entity]) ? {
2233
+ entity: null,
2234
+ text: rendered.text
2235
+ } : rendered;
2236
+ const group = groups.at(-1);
2237
+ const entities = [...group ?? [], slackCard].flatMap((item) => item.entity ? [item.entity] : []);
2238
+ if (group && group.length < 5 && fitsSlackMetadataLimit(entities)) group.push(slackCard);
2239
+ else groups.push([slackCard]);
2240
+ }
2241
+ for (const [index, group] of groups.entries()) {
2232
2242
  const lastPost = posts.at(-1);
2233
2243
  if (index === 0 && lastPost) lastPost.cards = group;
2234
2244
  else posts.push({
@@ -3177,7 +3187,6 @@ const legacyWebMailboxMetadataSchema = z.object({
3177
3187
  messageId: z.string().min(1)
3178
3188
  }).strict();
3179
3189
  // src/chat/task-execution/mailbox-turn.ts
3180
- const MAILBOX_TURN_READ_CONCURRENCY = 8;
3181
3190
  /**
3182
3191
  * Restore Turn input facts, with saved Message fallback for legacy cursors.
3183
3192
  *
@@ -3229,7 +3238,7 @@ async function listActiveMailboxTurns(conversationId) {
3229
3238
  * `listActiveMailboxTurns` it keeps a Turn whose history was deleted.
3230
3239
  */
3231
3240
  async function listActiveMailboxTurnSources(conversationIds) {
3232
- const limit = pLimit(MAILBOX_TURN_READ_CONCURRENCY);
3241
+ const limit = pLimit(8);
3233
3242
  const summaries = (await Promise.all(conversationIds.map((conversationId) => limit(() => listTurnSummaries(conversationId))))).flatMap((list) => list.filter(isOpenTurnSummary));
3234
3243
  const stored = await getStoredTurnFields(summaries);
3235
3244
  const sources = new Map(conversationIds.map((conversationId) => [conversationId, []]));
@@ -4095,7 +4104,8 @@ async function savedInputInstruction(args) {
4095
4104
  * the input is the same as on web.
4096
4105
  */
4097
4106
  async function eventReviewItemInputs(messages) {
4098
- const rendered = await Promise.all(messages.map(async (message) => [message.inboundMessageId, await loadReviewItemInput(message.input.reviewItemChange)]));
4107
+ const limit = pLimit(8);
4108
+ const rendered = await Promise.all(messages.map((message) => limit(async () => [message.inboundMessageId, await loadReviewItemInput(message.input.reviewItemChange)])));
4099
4109
  return new Map(rendered.flatMap(([id, text]) => text ? [[id, text]] : []));
4100
4110
  }
4101
4111
  // src/chat/conversations/session-stop.ts
@@ -4111,10 +4121,13 @@ const STOPPED_CONVERSATION_SKIP_REASON = "stopped conversation";
4111
4121
  */
4112
4122
  async function markConversationsStopped(conversationIds, options) {
4113
4123
  if (conversationIds.length === 0) return;
4114
- if (options.cancelWatches) for (const conversationId of conversationIds) await cancelSubscriptions({
4115
- conversationId,
4116
- state: options.state
4117
- });
4124
+ if (options.cancelWatches) {
4125
+ const limit = pLimit(8);
4126
+ await Promise.all(conversationIds.map((conversationId) => limit(() => cancelSubscriptions({
4127
+ conversationId,
4128
+ state: options.state
4129
+ }))));
4130
+ }
4118
4131
  const stoppedAt = new Date(options.nowMs ?? Date.now());
4119
4132
  await getSqlExecutor().db().update(juniorConversations).set({
4120
4133
  stoppedAt,
@@ -1,11 +1,38 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-BKpuH2hG.js";
2
2
  import { s as skillRoots } from "./package-discovery-x4AvVhMj.js";
3
- import { h as logWarn } from "./logging-oYpJYr-S.js";
4
- import { n as pluginCatalogRuntime } from "./catalog-runtime-B1R-nHd3.js";
3
+ import { h as logWarn } from "./logging-DjW7LjgJ.js";
4
+ import { n as pluginCatalogRuntime } from "./catalog-runtime-Se9idiDR.js";
5
5
  import * as z from "zod";
6
6
  import path from "node:path";
7
7
  import fs from "node:fs/promises";
8
8
  import { parse } from "yaml";
9
+ // src/chat/skill-references.ts
10
+ function isCommonEnvironmentVariable(name) {
11
+ return [
12
+ "HOME",
13
+ "LANG",
14
+ "PATH",
15
+ "PWD",
16
+ "SHELL",
17
+ "TEMP",
18
+ "TERM",
19
+ "TMP",
20
+ "TMPDIR",
21
+ "USER",
22
+ "XDG_CONFIG_HOME"
23
+ ].includes(name.toUpperCase());
24
+ }
25
+ /**
26
+ * Return the skills that `text` references explicitly, in order: each
27
+ * `$name`, then each `/name`. Only these two forms reference a skill.
28
+ */
29
+ function skillReferences(text, availableSkills) {
30
+ const isSkill = (name) => availableSkills.some((skill) => skill.name === name);
31
+ const dollarPattern = /(?<![\w$])\$([a-z0-9]+(?:-[a-z0-9]+)*)/gi;
32
+ const slashPattern = /(?:^|\s)\/([a-z0-9]+(?:-[a-z0-9]+)*)(?![a-z0-9/-])/gi;
33
+ const names = (pattern) => [...text.matchAll(pattern)].flatMap((match) => match[1] ? [match[1].toLowerCase()] : []);
34
+ return [...names(dollarPattern).filter((name) => !isCommonEnvironmentVariable(name)), ...names(slashPattern)].filter(isSkill);
35
+ }
9
36
  // src/chat/skills.ts
10
37
  var skills_exports = /* @__PURE__ */ __exportAll({
11
38
  discoverSkills: () => discoverSkills,
@@ -240,21 +267,6 @@ async function discoverSkills(options) {
240
267
  };
241
268
  return sorted;
242
269
  }
243
- function isCommonEnvironmentVariable(name) {
244
- return [
245
- "HOME",
246
- "LANG",
247
- "PATH",
248
- "PWD",
249
- "SHELL",
250
- "TEMP",
251
- "TERM",
252
- "TMP",
253
- "TMPDIR",
254
- "USER",
255
- "XDG_CONFIG_HOME"
256
- ].includes(name.toUpperCase());
257
- }
258
270
  /**
259
271
  * Extract an explicit skill invocation from a user message. `$name` is the
260
272
  * canonical form; `/name` still works for older messages and automations.
@@ -262,16 +274,8 @@ function isCommonEnvironmentVariable(name) {
262
274
  function parseSkillInvocation(messageText, availableSkills) {
263
275
  const trimmed = messageText.trim();
264
276
  const escapePattern = (value) => value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
265
- for (const match of trimmed.matchAll(/(?<![\w$])\$([a-z0-9]+(?:-[a-z0-9]+)*)/gi)) {
266
- const skillName = match[1]?.toLowerCase();
267
- if (!skillName) continue;
268
- if (isCommonEnvironmentVariable(skillName)) continue;
269
- if (availableSkills.some((skill) => skill.name === skillName)) return { skillName };
270
- }
271
- for (const match of trimmed.matchAll(/(?:^|\s)\/([a-z0-9]+(?:-[a-z0-9]+)*)(?![a-z0-9/-])/gi)) {
272
- const skillName = match[1]?.toLowerCase();
273
- if (skillName && availableSkills.some((skill) => skill.name === skillName)) return { skillName };
274
- }
277
+ const [referencedSkill] = skillReferences(trimmed, availableSkills);
278
+ if (referencedSkill) return { skillName: referencedSkill };
275
279
  const namedSkill = availableSkills.find((skill) => {
276
280
  if (skill.disableModelInvocation !== true) return false;
277
281
  const skillPattern = escapePattern(skill.name);
@@ -311,4 +315,4 @@ async function loadSkillsByName(skillNames, available) {
311
315
  }
312
316
  return skills;
313
317
  }
314
- export { parseSkillInvocation as a, parseSkillFile as i, findSkillByName as n, skills_exports as o, loadSkillsByName as r, discoverSkills as t };
318
+ export { parseSkillInvocation as a, parseSkillFile as i, findSkillByName as n, skills_exports as o, loadSkillsByName as r, skillReferences as s, discoverSkills as t };
@@ -1,15 +1,15 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-BKpuH2hG.js";
2
- import { Ct as deferConversationMove, Fa as readConversationAccessFromSql, Ss as formatSlackLink, Wa as readLatestConversationBrief, Zo as postSlackEphemeralMessage, es as unfurlSlackLinks, qs as parseDashboardConversationLink, vs as getWorkspaceTeamId, xs as escapeSlackMrkdwnText } from "./projection-CWXDE0f6.js";
2
+ import { Ct as deferConversationMove, Is as escapeSlackMrkdwnText, Ls as formatSlackLink, Ns as getWorkspaceTeamId, cc as parseDashboardConversationLink, ds as postSlackEphemeralMessage, ms as unfurlSlackLinks, no as readLatestConversationBrief, qa as readConversationAccessFromSql } from "./projection-D47mlszd.js";
3
3
  import { _ as slackUserIdSchema, b as slackMessageTsSchema, f as parseSlackTeamId, g as slackTeamIdSchema, h as slackChannelIdSchema, m as slackBotIdSchema, n as createSlackActor, p as parseSlackUserId, s as parseActorUserId, u as parseSlackChannelId } from "./actor-D2iXzvlN.js";
4
- import { X as createCache, a as getConversationStore, o as getDb, s as getSqlExecutor, st as getConversationIdByProviderConversation } from "./db-DV2ZUb1Y.js";
5
- import { i as lookupSlackUserProfile, n as lookupSlackBot } from "./users-XCCKn3xW.js";
6
- import { E as withSpan } from "./logging-oYpJYr-S.js";
7
- import { i as readActorIdentity } from "./viewer-DKOeHpv3.js";
8
- import { t as runWithSlackInstallation } from "./adapter-context-CnY-i32r.js";
9
- import { a as isMovableToSlack, i as continueConversationInSlack, n as alreadyContinuesInSlackMessage, t as BUSY } from "./continue-in-slack-BXQizz9o.js";
10
- import { dr as checkSlackChannelReadAccess } from "./warmup-mTMIatCV.js";
11
- import "./store-Dz3YZ7gQ.js";
12
- import { n as botConfig } from "./config-DUD-zMvp.js";
4
+ import { X as createCache, a as getConversationStore, o as getDb, s as getSqlExecutor, st as getConversationIdByProviderConversation } from "./db-C21CyyTE.js";
5
+ import { i as lookupSlackUserProfile, n as lookupSlackBot } from "./users-6rSdqXXk.js";
6
+ import { E as withSpan } from "./logging-DjW7LjgJ.js";
7
+ import { i as readActorIdentity } from "./viewer-De1vmuEA.js";
8
+ import { t as runWithSlackInstallation } from "./adapter-context-HrBTD8rJ.js";
9
+ import { a as isMovableToSlack, i as continueConversationInSlack, n as alreadyContinuesInSlackMessage, t as BUSY } from "./continue-in-slack-DNkrrWuQ.js";
10
+ import { fr as checkSlackChannelReadAccess } from "./warmup-C0IblNtf.js";
11
+ import "./store-BZJdHYR7.js";
12
+ import { n as botConfig } from "./config-DY5c1E0l.js";
13
13
  import * as z from "zod";
14
14
  // src/chat/ingress/workspace-membership.ts
15
15
  const MEMBER_TTL_MS = 3e5;
@@ -1,10 +1,10 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-BKpuH2hG.js";
2
- import { M as toolInvocationDestination, j as actorFromRun } from "./agent-runner-BaLjEjPR.js";
3
- import { n as botConfig } from "./config-DUD-zMvp.js";
4
- import { t as readConversationLineage } from "./lineage-BFdIPb3o.js";
5
- import { _ as getConversationWorkState } from "./store-Dz3YZ7gQ.js";
6
- import { Vt as getAgentInvocation, bn as AgentDepthLimitError, sn as createAndEnqueueAgentInvocation, wn as getAgentBinding } from "./warmup-mTMIatCV.js";
7
- import { I as getUnnamedAgentConversationId, T as getAgentInvocationId, k as getAgentInvocationMessageId } from "./turn-user-message-DNC0eRZ7.js";
2
+ import { F as actorFromRun, I as toolInvocationDestination } from "./agent-runner-DxivxUYd.js";
3
+ import { n as botConfig } from "./config-DY5c1E0l.js";
4
+ import { t as readConversationLineage } from "./lineage-BJTSY53A.js";
5
+ import { _ as getConversationWorkState } from "./store-BZJdHYR7.js";
6
+ import { Vt as getAgentInvocation, bn as AgentDepthLimitError, sn as createAndEnqueueAgentInvocation, wn as getAgentBinding } from "./warmup-C0IblNtf.js";
7
+ import { I as getUnnamedAgentConversationId, T as getAgentInvocationId, k as getAgentInvocationMessageId } from "./turn-user-message-Dfbr3Ud9.js";
8
8
  // src/chat/agent-invocations/spawn.ts
9
9
  var spawn_exports = /* @__PURE__ */ __exportAll({ bindSpawnAgent: () => bindSpawnAgent });
10
10
  /**
@@ -1,7 +1,7 @@
1
- import { i as getChatConfig } from "./config-DUD-zMvp.js";
2
- import { h as logWarn } from "./logging-oYpJYr-S.js";
3
- import { o as getDb } from "./db-DV2ZUb1Y.js";
4
- import { L as juniorUsers } from "./executor-CjNhwwnj.js";
1
+ import { i as getChatConfig } from "./config-DY5c1E0l.js";
2
+ import { h as logWarn } from "./logging-DjW7LjgJ.js";
3
+ import { o as getDb } from "./db-C21CyyTE.js";
4
+ import { B as juniorUsers } from "./executor-DfNoVVGd.js";
5
5
  import { createCipheriv, createDecipheriv, createHash, randomBytes } from "node:crypto";
6
6
  import { eq } from "drizzle-orm";
7
7
  // src/chat/conversations/legacy-web-actor-id.ts