@sentry/junior 0.260.0 → 0.262.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 (67) hide show
  1. package/dist/{adapter-Dj5BTJRd.js → adapter-t-Y9RHML.js} +2 -2
  2. package/dist/{admin-tzkZDqrH.js → admin-BCqeFndQ.js} +1 -1
  3. package/dist/{agent-hooks-V4Hfc2tB.js → agent-hooks-9q2zdKHL.js} +73 -20
  4. package/dist/{agent-invocations-Qfz7dWgU.js → agent-invocations-CxKldAeB.js} +1 -0
  5. package/dist/{agent-runner-DvTUyGTY.js → agent-runner-Cx6NO5LE.js} +115 -37
  6. package/dist/api/schema.js +1 -1
  7. package/dist/api.js +42 -41
  8. package/dist/{app-BsBUs3rF.d.ts → app-Bo0kB987.d.ts} +6 -1
  9. package/dist/app.d.ts +1 -1
  10. package/dist/app.js +59 -63
  11. package/dist/{assistant-reply-CEOMzsWy.js → assistant-reply-B2qUBAwL.js} +1 -1
  12. package/dist/{briefs-BSCkyYqs.js → briefs-DsGH2Vym.js} +2 -2
  13. package/dist/{catalog-runtime-Bpcs2b2L.js → catalog-runtime-CfwKT0sn.js} +1 -1
  14. package/dist/cli/chat.js +15 -17
  15. package/dist/cli/check.js +3 -3
  16. package/dist/cli/init.js +1 -1
  17. package/dist/cli/main.js +3 -3
  18. package/dist/cli/plugins.js +4 -4
  19. package/dist/cli/snapshot-create.js +4 -4
  20. package/dist/cli/upgrade.js +3 -3
  21. package/dist/{client-JeyzRwsT.js → client-DpfjZgNk.js} +2 -2
  22. package/dist/{config-ULs6Zl9b.js → config-BiCtNiu5.js} +2 -2
  23. package/dist/{connections-CZ7HhEmN.js → connections-D9IKbfk-.js} +10 -10
  24. package/dist/{conversation-privacy-BQSlZXgV.js → conversation-privacy-CBUI0frD.js} +1 -1
  25. package/dist/{credential-sync-BKcv5rBe.js → credential-sync-Bu6ZOuOk.js} +14 -14
  26. package/dist/{executor-BoGNVEDn.js → executor-O8xqLDN6.js} +4 -3
  27. package/dist/{images-BBmDXQCB.js → images-AM1exvU0.js} +2 -2
  28. package/dist/instrumentation.js +2 -2
  29. package/dist/{job-queue-CbdVyaCo.js → job-queue-DmarAQGI.js} +1 -1
  30. package/dist/{logging-DSMmkHXG.js → logging-dZN1Bvtu.js} +1 -1
  31. package/dist/{message-zaj5gBbS.js → message-C_g2S8kv.js} +3 -3
  32. package/dist/nitro.d.ts +1 -1
  33. package/dist/nitro.js +3 -3
  34. package/dist/{oauth-callback-server-yYFG8Own.js → oauth-callback-server-DvvOvr4q.js} +2 -2
  35. package/dist/{profile-ByWkAY7L.js → profile-BP2N5uDY.js} +13 -6
  36. package/dist/{registry-BL-osYWN.js → registry-BUje_knT.js} +1 -1
  37. package/dist/{resolve-HuPG2VMB.js → resolve-DftZiYNU.js} +4 -4
  38. package/dist/{result-DS7V4a3-.js → result-CRMRT9CE.js} +16 -11
  39. package/dist/{runner-Cba_OfGl.js → runner-4mmL2Pt1.js} +10 -10
  40. package/dist/{sandbox-egress-signals-C7NcPzea.js → sandbox-egress-signals-1ysv0z5A.js} +1 -1
  41. package/dist/{schema-OzL8Zw4H.js → schema-XuTZukI9.js} +1 -1
  42. package/dist/{service-account-DqwHhwJA.js → service-account-B1sH3P7d.js} +3 -3
  43. package/dist/{service-account-Ko1Xs--F.js → service-account-Del2I_x3.js} +3 -3
  44. package/dist/{session-stop-HfKx-pky.js → session-stop-ZuyOHxdK.js} +11 -11
  45. package/dist/{skills-D6_bcAuW.js → skills-lPeepA2b.js} +2 -2
  46. package/dist/{spawn-BWqK6EwM.js → spawn-DovpdlrW.js} +3 -2
  47. package/dist/{store-DzRbd5VT.js → store-dZynGGFW.js} +6 -6
  48. package/dist/{task-queue-9LICOzcL.js → task-queue-CmMCtzHO.js} +3 -3
  49. package/dist/{task-runner-DGnd_B5X.js → task-runner-BRgJ5e0s.js} +19 -11
  50. package/dist/{tasks-CjrS098O.js → tasks-Bh2qYaed.js} +45 -28
  51. package/dist/{thread-state-CqkYowEz.js → thread-state-DA37FsAT.js} +5 -5
  52. package/dist/{turn-failure-response-BkKmGqFt.js → turn-failure-response-BLcscQ-f.js} +7 -7
  53. package/dist/{turn-lifecycle-DYv8IV6w.js → turn-lifecycle-D0e887FM.js} +1 -1
  54. package/dist/{turn-session-routing-TaVhKmdz.js → turn-session-routing-DdbSbJS6.js} +1 -1
  55. package/dist/{validation-BrXMYPyo.js → validation-DtcovXqq.js} +1 -1
  56. package/dist/{version-Ct049vav.js → version-JcDaJ75p.js} +1 -1
  57. package/dist/version.js +1 -1
  58. package/dist/{viewer-C-J0ewlH.js → viewer-oMTUVAcR.js} +4 -4
  59. package/dist/{web-input-C_xB3RXp.js → web-input-FQ5wgqYn.js} +26 -26
  60. package/dist/{work-D829Ue7k.js → work-BiIKfayl.js} +40 -10
  61. package/dist/{worker-BRTYzlpk.js → worker-BZ7l75NM.js} +5 -5
  62. package/migrations/0062_plugin_report_index.sql +20 -0
  63. package/migrations/0063_agent_invocation_type.sql +1 -0
  64. package/migrations/meta/0062_snapshot.json +3499 -0
  65. package/migrations/meta/0063_snapshot.json +3505 -0
  66. package/migrations/meta/_journal.json +14 -0
  67. package/package.json +10 -10
@@ -1,7 +1,7 @@
1
- import { i as getChatConfig } from "./config-ULs6Zl9b.js";
1
+ import { i as getChatConfig } from "./config-BiCtNiu5.js";
2
+ import { setTimeout } from "node:timers/promises";
2
3
  import { createMemoryState } from "@chat-adapter/state-memory";
3
4
  import { createRedisState } from "@chat-adapter/state-redis";
4
- import { setTimeout } from "node:timers/promises";
5
5
  // src/chat/state/locks.ts
6
6
  const ACTIVE_LOCK_TTL_MS = 9e4;
7
7
  const MUTATION_LOCK_TTL_MS = 1e4;
@@ -1,4 +1,4 @@
1
- import { a as setUserAdminFromSql, d as getDb, n as listAdminUsersFromSql } from "./viewer-C-J0ewlH.js";
1
+ import { a as setUserAdminFromSql, d as getDb, n as listAdminUsersFromSql } from "./viewer-oMTUVAcR.js";
2
2
  import { CLI_USAGE } from "./cli/run.js";
3
3
  // src/cli/admin.ts
4
4
  /**
@@ -1,27 +1,27 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-nwUcYXjP.js";
2
- import { i as completeObject, o as embedTexts } from "./client-JeyzRwsT.js";
3
- import { T as withSpan, a as extractGenAiUsageSummary, b as setSpanStatus, f as logException, m as logWarn, p as logInfo, y as setSpanAttributes, z as isRecord$1 } from "./logging-DSMmkHXG.js";
2
+ import { i as completeObject, o as embedTexts } from "./client-DpfjZgNk.js";
3
+ import { T as withSpan, a as extractGenAiUsageSummary, b as setSpanStatus, f as logException, m as logWarn, p as logInfo, y as setSpanAttributes, z as isRecord$1 } from "./logging-dZN1Bvtu.js";
4
4
  import { a as getClient$1 } from "./sentry-BBUlHih9.js";
5
- import { t as canExposeConversationPayload } from "./conversation-privacy-BQSlZXgV.js";
6
- import { i as getChatConfig, n as botConfig, o as getSlackBotToken } from "./config-ULs6Zl9b.js";
5
+ import { t as canExposeConversationPayload } from "./conversation-privacy-CBUI0frD.js";
6
+ import { i as getChatConfig, n as botConfig, o as getSlackBotToken } from "./config-BiCtNiu5.js";
7
7
  import { r as defaultModelId } from "./model-profile-Bg8EoCKD.js";
8
8
  import { d as parseSlackTeamId, g as parseSlackMessageTs, i as isActorUserId, o as parseActorUserId, u as parseSlackChannelReferenceId } from "./actor-tlxzqaRe.js";
9
- import { D as hasAgentTurnUsage, M as readUserTimezone, P as saveUserTimezone, c as getConversationEventStore, d as getDb, f as getSqlExecutor, g as createSqlStore, i as resolveViewerUser, r as readActorIdentity } from "./viewer-C-J0ewlH.js";
10
- import { c as juniorIdentities, d as juniorDestinations, l as juniorUsers, s as juniorConversations } from "./agent-invocations-Qfz7dWgU.js";
11
- import { _ as juniorConversationAnnotations, b as juniorAttachments, f as juniorConversationBriefs, h as juniorConversationEvents, i as juniorWorkspaces, n as juniorSnapshots, r as juniorWorkspaceRepos, u as juniorConversationParticipants, v as juniorCodeChanges, y as juniorCodeRepositories } from "./executor-BoGNVEDn.js";
9
+ import { D as hasAgentTurnUsage, M as readUserTimezone, P as saveUserTimezone, c as getConversationEventStore, d as getDb, f as getSqlExecutor, g as createSqlStore, i as resolveViewerUser, r as readActorIdentity } from "./viewer-oMTUVAcR.js";
10
+ import { c as juniorIdentities, d as juniorDestinations, l as juniorUsers, s as juniorConversations } from "./agent-invocations-CxKldAeB.js";
11
+ import { _ as juniorConversationAnnotations, b as juniorAttachments, f as juniorConversationBriefs, h as juniorConversationEvents, i as juniorWorkspaces, n as juniorSnapshots, r as juniorWorkspaceRepos, u as juniorConversationParticipants, v as juniorCodeChanges, y as juniorCodeRepositories } from "./executor-O8xqLDN6.js";
12
12
  import { o as decodeStoredConversationEvent } from "./history-AY8rs-FR.js";
13
- import { h as credentialSubjectSchema } from "./registry-BL-osYWN.js";
13
+ import { h as credentialSubjectSchema } from "./registry-BUje_knT.js";
14
+ import { n as getDefaultRedisStateAdapterFor, r as getStateAdapter, s as withLock } from "./adapter-t-Y9RHML.js";
14
15
  import { i as isValidTimeZone } from "./cadence-R7Em4RjE.js";
15
16
  import { B as readMessageAttachments, C as conversationReportEventSchema, F as readMessageCardRefs, J as parseBriefInput, q as conversationBriefSchema, w as conversationReportMessageEventSchema } from "./conversation-CvuKJ3tA.js";
16
17
  import { n as briefEntriesFromReportEvents, s as generateBrief, t as BRIEF_PROMPT } from "./prompt-DeVax2qO.js";
17
- import { n as getDefaultRedisStateAdapterFor, r as getStateAdapter } from "./adapter-Dj5BTJRd.js";
18
- import { E as SANDBOX_WORKSPACE_ROOT, S as runNonInteractiveCommand, l as isSandboxMissingError, n as hash, v as getVercelSandboxCredentials, y as sleep$1 } from "./profile-ByWkAY7L.js";
18
+ import { D as SANDBOX_WORKSPACE_ROOT, S as runNonInteractiveCommand, l as isSandboxMissingError, n as hash, v as getVercelSandboxCredentials, y as sleep$1 } from "./profile-BP2N5uDY.js";
19
19
  import { AsyncLocalStorage } from "node:async_hooks";
20
20
  import { z } from "zod";
21
21
  import { createHash, createHmac, randomUUID, timingSafeEqual } from "node:crypto";
22
22
  import { and, arrayContains, asc, desc, eq, exists, getTableColumns, gte, inArray, isNotNull, isNull, lt, lte, max, ne, notExists, or, sql } from "drizzle-orm";
23
23
  import { codeChangeInputSchema, conversationAnnotationInputSchema, conversationEventPresentationSchema, defineConversationEvent, eventInputSchema, eventMatchSchema, eventMatches, eventTypeSchema, missingToolAnnotationKeys, normalizeEventIdentifier, objectAnnotationSchema, objectIconPath, objectTypeSchema, pluginEventsSchema, promptContextSchema, promptMessageSchema, stableEventMatchKey } from "@sentry/junior-plugin-api";
24
- import { alias } from "drizzle-orm/pg-core";
24
+ import { alias, union } from "drizzle-orm/pg-core";
25
25
  import { WebClient } from "@slack/web-api";
26
26
  import { Sandbox } from "@vercel/sandbox";
27
27
  // src/chat/conversations/structured-events.ts
@@ -157,6 +157,46 @@ function renderJuniorNativeConversationEvent(args) {
157
157
  const presentation = definition.renderEvent(definition.parse(args.content));
158
158
  return presentation === void 0 ? void 0 : conversationEventPresentationSchema.parse(presentation);
159
159
  }
160
+ // src/chat/state/cache.ts
161
+ const MAX_CACHE_KEY_LENGTH = 512;
162
+ const LOAD_WAIT_MS = 1e4;
163
+ /**
164
+ * Create a cache in the state adapter under `junior:cache:{namespace}:`.
165
+ * Entries are wrapped, so `null` and `false` values are cache hits.
166
+ */
167
+ function createCache(state, namespace) {
168
+ return { async getOrLoad(key, load, options) {
169
+ if (!key.trim()) throw new Error("Cache key is required");
170
+ if (key.length > MAX_CACHE_KEY_LENGTH) throw new Error("Cache key exceeds the maximum length");
171
+ const cacheKey = `junior:cache:${namespace}:${key}`;
172
+ const cached = async () => options?.refresh ? void 0 : await state.get(cacheKey) ?? void 0;
173
+ await state.connect();
174
+ const hit = await cached();
175
+ if (hit) return hit.value;
176
+ const attempt = await withLock(state, `${cacheKey}:load`, async () => {
177
+ const loadedMeanwhile = await cached();
178
+ if (loadedMeanwhile) return loadedMeanwhile.value;
179
+ const entry = await load();
180
+ if (entry.ttlMs !== void 0) {
181
+ if (!(entry.ttlMs > 0)) throw new Error("Cache ttlMs must be positive");
182
+ await state.set(cacheKey, { value: entry.value }, entry.ttlMs);
183
+ }
184
+ return entry.value;
185
+ }, {
186
+ keepAlive: true,
187
+ waitMs: LOAD_WAIT_MS
188
+ });
189
+ if (attempt.acquired) return attempt.value;
190
+ return (await load()).value;
191
+ } };
192
+ }
193
+ // src/chat/plugins/cache.ts
194
+ /** Create the cache scoped to one plugin. */
195
+ function createPluginCache(plugin) {
196
+ return { async getOrLoad(key, load, options) {
197
+ return await createCache(getStateAdapter(), `plugin:${plugin}`).getOrLoad(key, load, options);
198
+ } };
199
+ }
160
200
  // src/chat/slack/user.ts
161
201
  const slackUserInfoSchema = z.object({
162
202
  ok: z.literal(true),
@@ -1451,12 +1491,16 @@ function conversationHasParticipantUser(userId) {
1451
1491
  return exists(participant);
1452
1492
  }
1453
1493
  /**
1454
- * True when a verified primary-email user participates on this root
1455
- * conversation. Used only for the actorEmail feed fallback.
1494
+ * True when the conversation is one the person started or participates in.
1495
+ * Feeds filter with this id set instead of a per-row membership check, so
1496
+ * Postgres reads only that person's conversations, not every root.
1456
1497
  */
1457
- function conversationHasParticipantEmail(email) {
1458
- const participant = getDb().select({ rootConversationId: juniorConversationParticipants.rootConversationId }).from(juniorConversationParticipants).innerJoin(juniorUsers, eq(juniorUsers.id, juniorConversationParticipants.userId)).where(and(eq(juniorConversationParticipants.rootConversationId, juniorConversations.conversationId), eq(juniorUsers.primaryEmailNormalized, email)));
1459
- return exists(participant);
1498
+ function conversationIsMemberRoot(member) {
1499
+ const db = getDb();
1500
+ const started = db.select({ conversationId: juniorConversations.conversationId }).from(juniorConversations).innerJoin(juniorIdentities, eq(juniorIdentities.id, juniorConversations.actorIdentityId));
1501
+ const participating = db.select({ conversationId: juniorConversationParticipants.rootConversationId }).from(juniorConversationParticipants);
1502
+ const memberRoots = "userId" in member ? union(started.where(eq(juniorIdentities.userId, member.userId)), participating.where(eq(juniorConversationParticipants.userId, member.userId))) : union(started.innerJoin(juniorUsers, eq(juniorUsers.id, juniorIdentities.userId)).where(eq(juniorUsers.primaryEmailNormalized, member.email)), participating.innerJoin(juniorUsers, eq(juniorUsers.id, juniorConversationParticipants.userId)).where(eq(juniorUsers.primaryEmailNormalized, member.email)));
1503
+ return inArray(juniorConversations.conversationId, memberRoots);
1460
1504
  }
1461
1505
  /** True when one user's personal feed has archived this root after the cutoff. */
1462
1506
  function conversationArchivedForUser(userId, archivedAfter) {
@@ -3419,6 +3463,7 @@ function basePluginContext(plugin) {
3419
3463
  const name = plugin.manifest.name;
3420
3464
  return {
3421
3465
  plugin: { name },
3466
+ cache: createPluginCache(name),
3422
3467
  log: createPluginLogger(name),
3423
3468
  db: getDb()
3424
3469
  };
@@ -3779,9 +3824,17 @@ function getPluginTools(context, sandbox = createSandboxCapability(context.works
3779
3824
  });
3780
3825
  }
3781
3826
  },
3782
- workspaces: { async findByRepository(input) {
3783
- return await listWorkspaceNamesByRepository(getDb(), input);
3784
- } }
3827
+ workspaces: {
3828
+ async active() {
3829
+ const id = context.workspaces?.activeWorkspaceId();
3830
+ if (!id) return void 0;
3831
+ const workspace = await getWorkspace(getDb(), id);
3832
+ return workspace ? { name: workspace.name } : {};
3833
+ },
3834
+ async findByRepository(input) {
3835
+ return await listWorkspaceNamesByRepository(getDb(), input);
3836
+ }
3837
+ }
3785
3838
  };
3786
3839
  let pluginContext;
3787
3840
  switch (context.source.kind) {
@@ -4345,4 +4398,4 @@ function createPluginHookRunner(input = {}) {
4345
4398
  }
4346
4399
  };
4347
4400
  }
4348
- export { bindSlackDirectCredentialSubject as $, authenticationUnlinkedEvent as $t, getWorkspaceSnapshotBuilder as A, conversationHasParticipantUser as At, STOP_WATCHING_TOOL_NAME as B, readAttachmentVisionSummary as Bt, WorkspaceValidationError as C, createPluginModel as Ct, setWorkspaceSnapshotBuild as D, conversationArchivedForEmail as Dt, setWorkspaceSnapshot as E, conversationArchiveTimes as Et, isSlackMessageTurn as F, readLatestConversationBrief as Ft, createWatch as G, listConversationAnnotations as Gt, cancelWatch as H, resolveRootVisibility as Ht, slackMessageTurnDisabledReason as I, readConversationEventPage as It, getWatch as J, resolveUserTimezone as Jt, deliverWatch as K, listConversationAnnotationsById as Kt, RESOURCE_SUBSCRIPTION_DEFAULT_TTL_MS as L, buildSentryConversationUrl as Lt, workspaceRepoCheckoutPath as M, conversationNotArchivedForUser as Mt, resolveChannelCapabilities as N, viewerConversationMembership as Nt, SANDBOX_RUNTIME as O, conversationArchivedForUser as Ot, getSlackToolContext as P, createPluginConversationEvents as Pt, bindScheduledAutomationCredentialSubject as Q, authenticationLinkedEvent as Qt, RESOURCE_SUBSCRIPTION_MAX_TTL_MS as R, getSlackFileId as Rt, updateWorkspace as S, createPluginEmbedder as St, loadSnapshotsForProfile as T, readConversationAccessFromSql as Tt, collectEventMatchKeys as U, saveObjectAnnotations as Ut, cancelSubscriptions as V, recordSlackAttachment as Vt, createTimerWatch as W, createPluginAnnotations as Wt, takeDueTimerWatches as X, JUNIOR_NATIVE_EVENT_NAMESPACE as Xt, listWatches as Y, lookupSlackUser as Yt, bindEventAutomationCredentialSubject as Z, agentsInstructionsUpdatedEvent as Zt, deleteWorkspace as _, getDashboardConversationLink as _t, getPluginRoutes as a, downloadPrivateSlackFile as at, listWorkspaces as b, setDashboardConversationLinkOptions as bt, getPluginTools as c, getSlackClient as ct, setPlugins as d, normalizeSlackConversationId as dt, conversationNoteEvent as en, verifyEventAutomationCredentialSubject as et, validatePlugins as f, runWithSlackInstallationToken as ft, createWorkspace as g, JUNIOR_THREAD_STATE_TTL_MS as gt, setBriefsConfig as h, runWithWorkspaceTeamId as ht, getPluginApiRoutes as i, SlackActionError as it, tryWorkspaceRepoCheckoutPath as j, conversationNotArchivedForEmail as jt, deleteWorkspaceSnapshotBuilders as k, conversationHasParticipantEmail as kt, getPluginUserPromptContributions as l, isConversationScopedChannel as lt, registration_exports as m, getWorkspaceTeamId as mt, applyPluginFormatMarkdown as n, verifySlackDirectCredentialSubject as nt, getPluginSlackConversationLink as o, getFilePermalink as ot, coreTaskRegistrations as p, withSlackRetries as pt, findMatchingWatches as q, defaultTimezone as qt, createPluginHookRunner as r, verifyTimerWatchCredentialSubject as rt, getPluginSystemPromptContributions as s, getHeaderString as st, agent_hooks_exports as t, verifyScheduledAutomationCredentialSubject as tt, getPlugins as u, isDmChannel as ut, getWorkspace as v, getDashboardObjectIconLink as vt, invalidateReadySnapshot as w, createPluginLogger as wt, listWorkspacesByRepository as x, createPluginState as xt, getWorkspaceByName as y, getDashboardTaskLink as yt, RESOURCE_WATCH_TOOL_SOURCE as z, matchSlackAttachments as zt };
4401
+ export { bindSlackDirectCredentialSubject as $, agentsInstructionsUpdatedEvent as $t, getWorkspaceSnapshotBuilder as A, conversationIsMemberRoot as At, STOP_WATCHING_TOOL_NAME as B, readAttachmentVisionSummary as Bt, WorkspaceValidationError as C, createPluginModel as Ct, setWorkspaceSnapshotBuild as D, conversationArchivedForEmail as Dt, setWorkspaceSnapshot as E, conversationArchiveTimes as Et, isSlackMessageTurn as F, readLatestConversationBrief as Ft, createWatch as G, listConversationAnnotations as Gt, cancelWatch as H, resolveRootVisibility as Ht, slackMessageTurnDisabledReason as I, readConversationEventPage as It, getWatch as J, resolveUserTimezone as Jt, deliverWatch as K, listConversationAnnotationsById as Kt, RESOURCE_SUBSCRIPTION_DEFAULT_TTL_MS as L, buildSentryConversationUrl as Lt, workspaceRepoCheckoutPath as M, conversationNotArchivedForUser as Mt, resolveChannelCapabilities as N, viewerConversationMembership as Nt, SANDBOX_RUNTIME as O, conversationArchivedForUser as Ot, getSlackToolContext as P, createPluginConversationEvents as Pt, bindScheduledAutomationCredentialSubject as Q, JUNIOR_NATIVE_EVENT_NAMESPACE as Qt, RESOURCE_SUBSCRIPTION_MAX_TTL_MS as R, getSlackFileId as Rt, updateWorkspace as S, createPluginEmbedder as St, loadSnapshotsForProfile as T, readConversationAccessFromSql as Tt, collectEventMatchKeys as U, saveObjectAnnotations as Ut, cancelSubscriptions as V, recordSlackAttachment as Vt, createTimerWatch as W, createPluginAnnotations as Wt, takeDueTimerWatches as X, createPluginCache as Xt, listWatches as Y, lookupSlackUser as Yt, bindEventAutomationCredentialSubject as Z, createCache as Zt, deleteWorkspace as _, getDashboardConversationLink as _t, getPluginRoutes as a, downloadPrivateSlackFile as at, listWorkspaces as b, setDashboardConversationLinkOptions as bt, getPluginTools as c, getSlackClient as ct, setPlugins as d, normalizeSlackConversationId as dt, authenticationLinkedEvent as en, verifyEventAutomationCredentialSubject as et, validatePlugins as f, runWithSlackInstallationToken as ft, createWorkspace as g, JUNIOR_THREAD_STATE_TTL_MS as gt, setBriefsConfig as h, runWithWorkspaceTeamId as ht, getPluginApiRoutes as i, SlackActionError as it, tryWorkspaceRepoCheckoutPath as j, conversationNotArchivedForEmail as jt, deleteWorkspaceSnapshotBuilders as k, conversationHasParticipantUser as kt, getPluginUserPromptContributions as l, isConversationScopedChannel as lt, registration_exports as m, getWorkspaceTeamId as mt, applyPluginFormatMarkdown as n, conversationNoteEvent as nn, verifySlackDirectCredentialSubject as nt, getPluginSlackConversationLink as o, getFilePermalink as ot, coreTaskRegistrations as p, withSlackRetries as pt, findMatchingWatches as q, defaultTimezone as qt, createPluginHookRunner as r, verifyTimerWatchCredentialSubject as rt, getPluginSystemPromptContributions as s, getHeaderString as st, agent_hooks_exports as t, authenticationUnlinkedEvent as tn, verifyScheduledAutomationCredentialSubject as tt, getPlugins as u, isDmChannel as ut, getWorkspace as v, getDashboardObjectIconLink as vt, invalidateReadySnapshot as w, createPluginLogger as wt, listWorkspacesByRepository as x, createPluginState as xt, getWorkspaceByName as y, getDashboardTaskLink as yt, RESOURCE_WATCH_TOOL_SOURCE as z, matchSlackAttachments as zt };
@@ -155,6 +155,7 @@ const juniorAgentInvocations = pgTable("junior_agent_invocations", {
155
155
  source: jsonb("source_json").$type().notNull(),
156
156
  destination: jsonb("destination_json").$type().notNull(),
157
157
  destinationVisibility: text("destination_visibility").$type(),
158
+ agentType: text("agent_type").$type(),
158
159
  modelProfile: text("model_profile").$type(),
159
160
  reasoningLevel: text("reasoning_level").$type(),
160
161
  parentToolCallId: text("parent_tool_call_id"),
@@ -1,30 +1,30 @@
1
- import { $t as isToolResultError, A as ToolInputError, An as createSandboxEgressCredentialToken, At as saveTurnCheckpoint, B as recordAgentsInstructionsUpdated, Bt as TurnToolCallLimitExceededError, Ct as abandonReplacedPendingAuth, Dn as clearSandboxEgressSignals, F as loadLastModelProfile, G as recordGuardianActionReviewed, Gn as getSlackMessagePermalink, Gt as extractAssistantText, Hn as slackMention, Ht as createTurnLimitGate, In as resolveBaseUrl, J as recordToolExecutionStarted, Jt as getUserMessageInstructionText, K as recordMcpProviderConnected, Kn as openSlackDirectMessage, Kt as getPiMessageRole, Lt as TURN_LIMIT_DISABLED_REASON, N as loadConnectedMcpProviders, Nn as deliverOAuthAuthorization, O as automationRevision, On as consumeSandboxEgressAuthRequiredSignal, Ot as continuableMessages, P as loadConversationProjection, Pn as formatProviderLabel, Qn as getOAuthAccountProviders, Qt as isContinuablePiBoundary, R as loadTurnRoute, Rt as TurnBudgetExceededError, Sn as resolveSandboxCommandEnvironment, St as AuthorizationPauseError, Ut as isTurnExecutionLimitExceededError, V as recordAttachmentsDelivered, W as recordAuthorizationRequested, Wn as addReactionToMessage, Y as recordTurnRoute, Yn as uploadFilesToConversation, Yt as hasRuntimeTurnContext, Zt as isAssistantMessage, _n as isExperimentalFeatureEnabled, _t as PluginCredentialFailureError, a as saveScheduledAutomation, an as TURN_CONTEXT_TAG, bn as createUserTokenStore, bt as AuthPausePersistenceError, d as createEventAutomation, en as isToolResultMessage, f as deleteEventAutomation, fn as estimateTextTokens, g as listEventAutomationsForTeam, gt as createPluginEgress, i as readScheduledAutomation, in as trimTrailingAssistantMessages, ir as getConfigDefaults, it as resolveTaskTitle, kn as consumeSandboxEgressPermissionDeniedSignal, kt as loadTurnCheckpoint, m as getEventAutomation, mn as getAgentContextInputLimitTokens, n as listScheduledAutomationsForTeam, nn as retainRuntimeTurnContext, nr as historyItemFromPiMessage, pn as getAgentContextCompactionTriggerTokens, qt as getTerminalAssistantMessages, rn as stripRuntimeTurnContext, rr as piMessageFromHistoryItem, rt as fallbackShortTitle, t as createScheduledAutomation, tn as normalizeToolNameFromResult, v as saveEventAutomation, vt as createPluginAuthOrchestration, wt as canReusePendingAuthLink, xn as buildSandboxEgressNetworkPolicy, xt as AuthorizationFlowDisabledError, y as setEventAutomationStatus, yt as authorizationId, z as openConversationProjection, zt as TurnSliceLimitExceededError } from "./tasks-CjrS098O.js";
2
- import { S as resolveGatewayCredential, _ as getProviderErrorAttributes, a as completeText, b as MISSING_GATEWAY_CREDENTIALS_ERROR, c as COMPACTION_SUMMARY_PREFIX, d as renderCurrentInstruction, f as unwrapCurrentInstruction, g as findProviderError, h as createProviderError, i as completeObject, l as hasCompactedConversationContext, m as ProviderError, n as GEN_AI_SERVER_ADDRESS, p as escapeXml, s as resolveGatewayModel, t as GEN_AI_PROVIDER_NAME, u as isCompactionSummaryText, x as getGatewayApiKey, y as isProviderRetryError } from "./client-JeyzRwsT.js";
3
- import { R as normalizeIdentityEmail, S as summarizeMessageText, T as withSpan, V as toOptionalString, _ as serializeGenAiAttribute, a as extractGenAiUsageSummary, b as setSpanStatus, c as getLogContextAttributesForSpan, d as logError, f as logException, h as normalizeGenAiFinishReason, i as extractGenAiUsageAttributes, l as getTracePropagationHeaders, m as logWarn, p as logInfo, w as withLogContext, x as setTags, y as setSpanAttributes, z as isRecord$4 } from "./logging-DSMmkHXG.js";
1
+ import { $t as isToolResultError, A as ToolInputError, At as saveTurnCheckpoint, B as recordAgentsInstructionsUpdated, Bt as TurnToolCallLimitExceededError, Ct as abandonReplacedPendingAuth, Dn as consumeSandboxEgressAuthRequiredSignal, En as clearSandboxEgressSignals, F as loadLastModelProfile, Fn as resolveBaseUrl, G as recordGuardianActionReviewed, Gn as openSlackDirectMessage, Gt as extractAssistantText, Ht as createTurnLimitGate, J as recordToolExecutionStarted, Jn as uploadFilesToConversation, Jt as getUserMessageInstructionText, K as recordMcpProviderConnected, Kt as getPiMessageRole, Lt as TURN_LIMIT_DISABLED_REASON, Mn as deliverOAuthAuthorization, N as loadConnectedMcpProviders, Nn as formatProviderLabel, O as automationRevision, On as consumeSandboxEgressPermissionDeniedSignal, Ot as continuableMessages, P as loadConversationProjection, Qt as isContinuablePiBoundary, R as loadTurnRoute, Rt as TurnBudgetExceededError, St as AuthorizationPauseError, Un as addReactionToMessage, Ut as isTurnExecutionLimitExceededError, V as recordAttachmentsDelivered, Vn as slackMention, W as recordAuthorizationRequested, Wn as getSlackMessagePermalink, Y as recordTurnRoute, Yt as hasRuntimeTurnContext, Zn as getOAuthAccountProviders, Zt as isAssistantMessage, _t as PluginCredentialFailureError, a as saveScheduledAutomation, an as TURN_CONTEXT_TAG, bn as buildSandboxEgressNetworkPolicy, bt as AuthPausePersistenceError, d as createEventAutomation, en as isToolResultMessage, f as deleteEventAutomation, fn as estimateTextTokens, g as listEventAutomationsForTeam, gn as isExperimentalFeatureEnabled, gt as createPluginEgress, i as readScheduledAutomation, in as trimTrailingAssistantMessages, it as resolveTaskTitle, kn as createSandboxEgressCredentialToken, kt as loadTurnCheckpoint, m as getEventAutomation, mn as getAgentContextInputLimitTokens, n as listScheduledAutomationsForTeam, nn as retainRuntimeTurnContext, nr as piMessageFromHistoryItem, pn as getAgentContextCompactionTriggerTokens, qt as getTerminalAssistantMessages, rn as stripRuntimeTurnContext, rr as getConfigDefaults, rt as fallbackShortTitle, t as createScheduledAutomation, tn as normalizeToolNameFromResult, tr as historyItemFromPiMessage, v as saveEventAutomation, vt as createPluginAuthOrchestration, wt as canReusePendingAuthLink, xn as resolveSandboxCommandEnvironment, xt as AuthorizationFlowDisabledError, y as setEventAutomationStatus, yn as createUserTokenStore, yt as authorizationId, z as openConversationProjection, zt as TurnSliceLimitExceededError } from "./tasks-Bh2qYaed.js";
2
+ import { S as resolveGatewayCredential, _ as getProviderErrorAttributes, a as completeText, b as MISSING_GATEWAY_CREDENTIALS_ERROR, c as COMPACTION_SUMMARY_PREFIX, d as renderCurrentInstruction, f as unwrapCurrentInstruction, g as findProviderError, h as createProviderError, i as completeObject, l as hasCompactedConversationContext, m as ProviderError, n as GEN_AI_SERVER_ADDRESS, p as escapeXml, s as resolveGatewayModel, t as GEN_AI_PROVIDER_NAME, u as isCompactionSummaryText, x as getGatewayApiKey, y as isProviderRetryError } from "./client-DpfjZgNk.js";
3
+ import { R as normalizeIdentityEmail, S as summarizeMessageText, T as withSpan, V as toOptionalString, _ as serializeGenAiAttribute, a as extractGenAiUsageSummary, b as setSpanStatus, c as getLogContextAttributesForSpan, d as logError, f as logException, h as normalizeGenAiFinishReason, i as extractGenAiUsageAttributes, l as getTracePropagationHeaders, m as logWarn, p as logInfo, w as withLogContext, x as setTags, y as setSpanAttributes, z as isRecord$4 } from "./logging-dZN1Bvtu.js";
4
4
  import { m as startInactiveSpan, v as withActiveSpan } from "./sentry-BBUlHih9.js";
5
- import { a as toCanonicalInputMessage, c as toGenAiPayloadMetadata, i as runWithConversationPrivacy, l as toGenAiPayloadTraceAttributes, o as toCanonicalOutputMessage, r as resolveConversationPrivacy, s as toGenAiMessagesTraceAttributes, t as canExposeConversationPayload } from "./conversation-privacy-BQSlZXgV.js";
6
- import { n as botConfig, v as normalizeSlackEmojiName } from "./config-ULs6Zl9b.js";
5
+ import { a as toCanonicalInputMessage, c as toGenAiPayloadMetadata, i as runWithConversationPrivacy, l as toGenAiPayloadTraceAttributes, o as toCanonicalOutputMessage, r as resolveConversationPrivacy, s as toGenAiMessagesTraceAttributes, t as canExposeConversationPayload } from "./conversation-privacy-CBUI0frD.js";
6
+ import { n as botConfig, v as normalizeSlackEmojiName } from "./config-BiCtNiu5.js";
7
7
  import { a as formatModelProfiles, c as profileConfig, i as formatModelProfile, l as TURN_REASONING_LEVELS, n as ModelProfileNotConfiguredError, o as modelIdForProfile, s as modelProfileSchema } from "./model-profile-Bg8EoCKD.js";
8
8
  import { a as isUserActor, d as parseSlackTeamId, f as parseSlackUserId, g as parseSlackMessageTs, l as parseSlackChannelId, u as parseSlackChannelReferenceId } from "./actor-tlxzqaRe.js";
9
- import { C as addAgentTurnUsage, D as hasAgentTurnUsage, R as parseDestination, c as getConversationEventStore, d as getDb, f as getSqlExecutor, l as getConversationMessageSearchStore, r as readActorIdentity, u as getConversationStore, w as agentTurnCostUsd } from "./viewer-C-J0ewlH.js";
10
- import { a as juniorAgentInvocations, c as juniorIdentities, d as juniorDestinations, i as juniorAgentBindings, n as AGENT_INVOCATION_PARENT_MAILBOX_STATUSES, s as juniorConversations, t as AGENT_INVOCATION_MAILBOX_STATUSES } from "./agent-invocations-Qfz7dWgU.js";
11
- import { _ as juniorConversationAnnotations, a as juniorAutomationRuns, b as juniorAttachments, c as juniorStats, f as juniorConversationBriefs, x as juniorArtifacts } from "./executor-BoGNVEDn.js";
9
+ import { C as addAgentTurnUsage, D as hasAgentTurnUsage, R as parseDestination, c as getConversationEventStore, d as getDb, f as getSqlExecutor, l as getConversationMessageSearchStore, r as readActorIdentity, u as getConversationStore, w as agentTurnCostUsd } from "./viewer-oMTUVAcR.js";
10
+ import { a as juniorAgentInvocations, c as juniorIdentities, d as juniorDestinations, i as juniorAgentBindings, n as AGENT_INVOCATION_PARENT_MAILBOX_STATUSES, s as juniorConversations, t as AGENT_INVOCATION_MAILBOX_STATUSES } from "./agent-invocations-CxKldAeB.js";
11
+ import { _ as juniorConversationAnnotations, a as juniorAutomationRuns, b as juniorAttachments, c as juniorStats, f as juniorConversationBriefs, x as juniorArtifacts } from "./executor-O8xqLDN6.js";
12
12
  import { d as contextProvenance, f as instructionActors, m as sameActorIdentity, p as instructionProvenanceFor, t as KNOWN_CONVERSATION_EVENT_TYPES, u as agentInstructionProvenance } from "./history-AY8rs-FR.js";
13
13
  import { a as listReferenceFiles, c as soulPathCandidates, l as worldPathCandidates } from "./package-discovery-DJBompdd.js";
14
- import { c as fetchWithBoundedOAuthErrorBodies, d as actorLogContext, f as credentialContextForActor, g as credentialUserSubjectId, i as resolvePluginHeaderEnvRefs, l as getOAuthProviderErrorAttributes, p as credentialContextSchema, s as OAuthProviderError } from "./registry-BL-osYWN.js";
15
- import { n as pluginCatalogRuntime } from "./catalog-runtime-Bpcs2b2L.js";
16
- import { a as parseSkillInvocation, i as parseSkillFile, n as findSkillByName, r as loadSkillsByName, t as discoverSkills } from "./skills-D6_bcAuW.js";
17
- import { A as getWorkspaceSnapshotBuilder, B as STOP_WATCHING_TOOL_NAME, C as WorkspaceValidationError, D as setWorkspaceSnapshotBuild, E as setWorkspaceSnapshot, F as isSlackMessageTurn, G as createWatch, H as cancelWatch, I as slackMessageTurnDisabledReason, J as getWatch, Jt as resolveUserTimezone, K as deliverWatch, L as RESOURCE_SUBSCRIPTION_DEFAULT_TTL_MS, M as workspaceRepoCheckoutPath, N as resolveChannelCapabilities, O as SANDBOX_RUNTIME, P as getSlackToolContext, R as RESOURCE_SUBSCRIPTION_MAX_TTL_MS, S as updateWorkspace, T as loadSnapshotsForProfile, Ut as saveObjectAnnotations, V as cancelSubscriptions, W as createTimerWatch, Wt as createPluginAnnotations, Xt as JUNIOR_NATIVE_EVENT_NAMESPACE, Y as listWatches, _ as deleteWorkspace, _t as getDashboardConversationLink, at as downloadPrivateSlackFile, b as listWorkspaces, c as getPluginTools, ct as getSlackClient, dt as normalizeSlackConversationId, en as conversationNoteEvent, g as createWorkspace, it as SlackActionError, j as tryWorkspaceRepoCheckoutPath, k as deleteWorkspaceSnapshotBuilders, l as getPluginUserPromptContributions, lt as isConversationScopedChannel, ot as getFilePermalink, pt as withSlackRetries, q as findMatchingWatches, qt as defaultTimezone, r as createPluginHookRunner, s as getPluginSystemPromptContributions, u as getPlugins, ut as isDmChannel$1, v as getWorkspace, w as invalidateReadySnapshot, y as getWorkspaceByName, yt as getDashboardTaskLink, z as RESOURCE_WATCH_TOOL_SOURCE, zt as matchSlackAttachments } from "./agent-hooks-V4Hfc2tB.js";
14
+ import { c as fetchWithBoundedOAuthErrorBodies, d as actorLogContext, f as credentialContextForActor, g as credentialUserSubjectId, i as resolvePluginHeaderEnvRefs, l as getOAuthProviderErrorAttributes, p as credentialContextSchema, s as OAuthProviderError } from "./registry-BUje_knT.js";
15
+ import { n as pluginCatalogRuntime } from "./catalog-runtime-CfwKT0sn.js";
16
+ import { a as parseSkillInvocation, i as parseSkillFile, n as findSkillByName, r as loadSkillsByName, t as discoverSkills } from "./skills-lPeepA2b.js";
17
+ import { A as getWorkspaceSnapshotBuilder, B as STOP_WATCHING_TOOL_NAME, C as WorkspaceValidationError, D as setWorkspaceSnapshotBuild, E as setWorkspaceSnapshot, F as isSlackMessageTurn, G as createWatch, H as cancelWatch, I as slackMessageTurnDisabledReason, J as getWatch, Jt as resolveUserTimezone, K as deliverWatch, L as RESOURCE_SUBSCRIPTION_DEFAULT_TTL_MS, M as workspaceRepoCheckoutPath, N as resolveChannelCapabilities, O as SANDBOX_RUNTIME, P as getSlackToolContext, Qt as JUNIOR_NATIVE_EVENT_NAMESPACE, R as RESOURCE_SUBSCRIPTION_MAX_TTL_MS, S as updateWorkspace, T as loadSnapshotsForProfile, Ut as saveObjectAnnotations, V as cancelSubscriptions, W as createTimerWatch, Wt as createPluginAnnotations, Y as listWatches, _ as deleteWorkspace, _t as getDashboardConversationLink, at as downloadPrivateSlackFile, b as listWorkspaces, c as getPluginTools, ct as getSlackClient, dt as normalizeSlackConversationId, g as createWorkspace, it as SlackActionError, j as tryWorkspaceRepoCheckoutPath, k as deleteWorkspaceSnapshotBuilders, l as getPluginUserPromptContributions, lt as isConversationScopedChannel, nn as conversationNoteEvent, ot as getFilePermalink, pt as withSlackRetries, q as findMatchingWatches, qt as defaultTimezone, r as createPluginHookRunner, s as getPluginSystemPromptContributions, u as getPlugins, ut as isDmChannel$1, v as getWorkspace, w as invalidateReadySnapshot, y as getWorkspaceByName, yt as getDashboardTaskLink, z as RESOURCE_WATCH_TOOL_SOURCE, zt as matchSlackAttachments } from "./agent-hooks-9q2zdKHL.js";
18
+ import { o as fenceLock, r as getStateAdapter, s as withLock } from "./adapter-t-Y9RHML.js";
18
19
  import { i as isValidTimeZone, r as getZonedDateTimeParts } from "./cadence-R7Em4RjE.js";
19
20
  import { G as briefLinkSchema, H as detectImageMediaType, I as removedCardSchema, K as briefOutcomeStatusSchema, U as isVisionImageMediaType, q as conversationBriefSchema } from "./conversation-CvuKJ3tA.js";
20
- import { o as fenceLock, r as getStateAdapter, s as withLock } from "./adapter-Dj5BTJRd.js";
21
- import { C as SANDBOX_DATA_ROOT, D as sandboxSkillDir, E as SANDBOX_WORKSPACE_ROOT, O as sandboxSkillFile, S as runNonInteractiveCommand, T as SANDBOX_SKILLS_ROOT, _ as workspaceSnapshotNotReadyUserMessage, a as isAbortError, b as buildCommandScript, c as isSandboxCommandStreamInterruptedError, d as isSnapshottingError, f as throwSandboxOperationError, g as isWorkspaceSnapshotNotReadyError, h as getWorkspaceSnapshotNotReadyError, i as ensureDockerDaemon, k as sandboxSkillPathResolution, l as isSandboxMissingError, m as WorkspaceSnapshotNotReadyError, n as hash, o as isAlreadyExistsError, p as wrapSandboxSetupError, r as isStale, s as isSandboxApiTransientError, t as create, u as isSandboxUnavailableError, v as getVercelSandboxCredentials, w as SANDBOX_REPOS_ROOT, x as buildNonInteractiveShellScript, y as sleep } from "./profile-ByWkAY7L.js";
22
- import { a as isNoReplyMarker, i as NO_REPLY_MARKER, n as getAssistantReplyText, r as sanitizeAssistantText, t as decideReply } from "./assistant-reply-CEOMzsWy.js";
23
- import { A as requireSupportedEventMatch, B as readAutomationResult, C as eventNamespaceSchema, D as registeredEventTypeSchema, E as registeredEventMatchSchema, I as FINISH_AUTOMATION_RUN_TOOL_NAME, L as automationResultSchema, O as registeredResourceTypeSchema, T as pluginSupportsEvent, V as remindMissingAutomationResult, _ as WORKSPACE_SNAPSHOT_FAILED_EVENT, b as workspaceSnapshotWatch, d as getEventCatalog, k as requireEventIdentifier, n as markConversationsStopped, o as enqueueEventNotification, p as requireSlackChannelMessageScope, t as getConversationStoppedAtMs, v as WORKSPACE_SNAPSHOT_READY_EVENT, w as hasEventCatalogEntries, x as automationEventCatalog, y as workspaceSnapshotFinishedEvent } from "./session-stop-HfKx-pky.js";
24
- import { a as createSandboxSession, c as postinstall, d as getSandboxResources, i as bindSandboxFileSystem, l as setSnapshotSpanAttributes, n as isMissingError, o as stopSession, r as resolve$1, s as dependencies } from "./resolve-HuPG2VMB.js";
25
- import { a as getVercelConversationWorkQueue, f as getTurnRequestDeadline, n as sendNextWorkspaceSnapshotJob, r as sendWorkspaceSnapshotJob } from "./job-queue-CbdVyaCo.js";
26
- import { E as stopConversationWork } from "./store-DzRbd5VT.js";
27
- import { _ as getMcpProviderErrorAttributes, a as serviceAccountOnly, c as createMcpServiceAccountClientProvider, d as PluginMcpClient, f as McpProviderError, g as getMcpAwareTelemetryMessage, h as getMcpAwareErrorType, i as serviceAccountAllows, l as getMcpServiceAccountCredentials, m as McpToolError, p as McpServiceAccountRequiredError, u as McpAuthorizationRequiredError, v as toMcpProviderError } from "./service-account-Ko1Xs--F.js";
21
+ import { A as sandboxSkillPathResolution, C as SANDBOX_COMMAND_PATH, D as SANDBOX_WORKSPACE_ROOT, E as SANDBOX_SKILLS_ROOT, O as sandboxSkillDir, S as runNonInteractiveCommand, T as SANDBOX_REPOS_ROOT, _ as workspaceSnapshotNotReadyUserMessage, a as isAbortError, b as buildCommandScript, c as isSandboxCommandStreamInterruptedError, d as isSnapshottingError, f as throwSandboxOperationError, g as isWorkspaceSnapshotNotReadyError, h as getWorkspaceSnapshotNotReadyError, i as ensureDockerDaemon, k as sandboxSkillFile, l as isSandboxMissingError, m as WorkspaceSnapshotNotReadyError, n as hash, o as isAlreadyExistsError, p as wrapSandboxSetupError, r as isStale, s as isSandboxApiTransientError, t as create, u as isSandboxUnavailableError, v as getVercelSandboxCredentials, w as SANDBOX_DATA_ROOT, x as buildNonInteractiveShellScript, y as sleep } from "./profile-BP2N5uDY.js";
22
+ import { a as isNoReplyMarker, i as NO_REPLY_MARKER, n as getAssistantReplyText, r as sanitizeAssistantText, t as decideReply } from "./assistant-reply-B2qUBAwL.js";
23
+ import { A as requireSupportedEventMatch, B as readAutomationResult, C as eventNamespaceSchema, D as registeredEventTypeSchema, E as registeredEventMatchSchema, I as FINISH_AUTOMATION_RUN_TOOL_NAME, L as automationResultSchema, O as registeredResourceTypeSchema, T as pluginSupportsEvent, V as remindMissingAutomationResult, _ as WORKSPACE_SNAPSHOT_FAILED_EVENT, b as workspaceSnapshotWatch, d as getEventCatalog, k as requireEventIdentifier, n as markConversationsStopped, o as enqueueEventNotification, p as requireSlackChannelMessageScope, t as getConversationStoppedAtMs, v as WORKSPACE_SNAPSHOT_READY_EVENT, w as hasEventCatalogEntries, x as automationEventCatalog, y as workspaceSnapshotFinishedEvent } from "./session-stop-ZuyOHxdK.js";
24
+ import { a as createSandboxSession, c as postinstall, d as getSandboxResources, i as bindSandboxFileSystem, l as setSnapshotSpanAttributes, n as isMissingError, o as stopSession, r as resolve$1, s as dependencies } from "./resolve-DftZiYNU.js";
25
+ import { a as getVercelConversationWorkQueue, f as getTurnRequestDeadline, n as sendNextWorkspaceSnapshotJob, r as sendWorkspaceSnapshotJob } from "./job-queue-DmarAQGI.js";
26
+ import { E as stopConversationWork } from "./store-dZynGGFW.js";
27
+ import { _ as getMcpProviderErrorAttributes, a as serviceAccountOnly, c as createMcpServiceAccountClientProvider, d as PluginMcpClient, f as McpProviderError, g as getMcpAwareTelemetryMessage, h as getMcpAwareErrorType, i as serviceAccountAllows, l as getMcpServiceAccountCredentials, m as McpToolError, p as McpServiceAccountRequiredError, u as McpAuthorizationRequiredError, v as toMcpProviderError } from "./service-account-Del2I_x3.js";
28
28
  import { F as taskOutcomeInputSchema, M as compileScheduleIntent, N as scheduleIntentSchema, O as automationInstructionToolSchema, T as SCHEDULED_AUTOMATION_SYSTEM_ACTOR, j as ScheduleIntentError, k as automationTitleSchema } from "./automation-DrpcA-SX.js";
29
29
  import { n as privateTraceResultAttributes } from "./private-trace-result-CE7_lEdq.js";
30
30
  import { streamSimple } from "@earendil-works/pi-ai/compat";
@@ -1808,7 +1808,7 @@ const TOOL_POLICY_RULES = [
1808
1808
  "- Use createEventAutomation only when the user explicitly asks for an event automation or durable whenever-this-happens-do-X automation. Ordinary watch, notify, and tell-me-when requests use watchEvents. When an event automation's resource and events are known, create it without redundant confirmation.",
1809
1809
  "- Scheduled and event automations use their creator's connected credentials by default when the requested work needs them. Do not ask for separate confirmation merely to use those credentials. On creation, omit credentialMode for this default; set system only when the creator requires it. For updates, creator means the original createdBy actor, not the current requester. Only that creator may enable creator credential use; another requester's confirmation cannot authorize it.",
1810
1810
  "- Event automations list for the current destination, not one thread. Public automations can also be updated or deleted by automation id from another destination in the same workspace. When listing them, use createdBy to explain creator-only credential changes and warn when trigger.available is false; an unavailable automation remains stored but cannot receive events until its plugin event is enabled again.",
1811
- "- When `handoff` is available, compare its active and available model profiles before loading a skill or starting substantial work. Follow its selection rules and switch first when another profile fits better.",
1811
+ "- Before loading a skill or starting substantial work, decide how to run it. When `handoff` is available and another profile fits better, switch first. When `spawnAgent` is available and its delegation rules fit, give independent tracks to child agents. Otherwise do the work inline.",
1812
1812
  "- Run `jr-rpc config get|set|unset|list` for provider defaults and `jr-rpc plugins list` for installed plugin introspection as standalone bash commands; do not chain them with `cd`, `&&`, pipes, or provider commands.",
1813
1813
  "- If the first result is empty, stale, ambiguous, or incomplete, try a focused alternate query, path, command, or source before concluding the answer cannot be verified."
1814
1814
  ];
@@ -1830,7 +1830,7 @@ const PLANNING_RULES = [
1830
1830
  ];
1831
1831
  const TASK_EXECUTION_RULES = [
1832
1832
  "- Actionable request: act in this turn.",
1833
- "- Continue until done or genuinely blocked. Do not finish with a plan, promise, or offer to check next when an available tool or source can move the request forward.",
1833
+ "- Continue until done, genuinely blocked, or waiting on child agents you started. Do not finish with a plan, promise, or offer to check next when an available tool or source can move the request forward.",
1834
1834
  "- Ask the user only for missing access, approval, or a decision that blocks safe progress. Ask one focused question; otherwise infer conservatively and continue.",
1835
1835
  "- For conflicting evidence, compare sources and state which source is authoritative for the answer.",
1836
1836
  "- A tool result with `timed_out: true` means that attempt did not finish. Continue the active task. Before retrying work that may have side effects, inspect authoritative state and do not repeat a mutation that already applied."
@@ -1897,11 +1897,12 @@ function buildBehaviorSection(platform, mode) {
1897
1897
  renderRuleSection("failure-handling", automation ? AUTOMATION_FAILURE_RULES : mode === "child_agent" ? CHILD_AGENT_FAILURE_RULES : FAILURE_RULES)
1898
1898
  ].join("\n\n");
1899
1899
  }
1900
+ const SLACK_MARKDOWN_RULES = ["- Use Slack-flavored Markdown: **bold** section labels, `code`, [text](url) links, bullet lists, and fenced code blocks. No hash-prefixed headings and no tables.", "- Write a Slack channel as `<#C…>` when you already know its ID, so Slack renders a channel link. Do not look up an ID only for formatting. When the ID is unknown, write plain `#name` and never invent an ID."];
1900
1901
  function buildAutomationOutputSection(platform) {
1901
1902
  return [
1902
1903
  platform === "slack" ? `<output format="slack-markdown">` : `<output format="markdown">`,
1903
1904
  "- Follow any format in the instruction. Otherwise keep the message as short as the job allows, and do not describe the run.",
1904
- platform === "slack" ? "- Use Slack-flavored Markdown: **bold** section labels, `code`, [text](url) links, bullet lists, and fenced code blocks. No hash-prefixed headings and no tables." : "- Use concise Markdown: short paragraphs, bullets, links, and fenced code blocks.",
1905
+ ...platform === "slack" ? SLACK_MARKDOWN_RULES : ["- Use concise Markdown: short paragraphs, bullets, links, and fenced code blocks."],
1905
1906
  "</output>"
1906
1907
  ].join("\n");
1907
1908
  }
@@ -1925,7 +1926,7 @@ function buildOutputSection(platform, mode) {
1925
1926
  `<output format="slack-markdown">`,
1926
1927
  "- Default to the shortest complete reply—usually 1–5 sentences and under 800 characters. Include only the outcome, decisive evidence, and any blocker or required next action. If useful detail would exceed that, put it in a Slack canvas and reply with the link. An explicit user request for detail overrides this target.",
1927
1928
  "- Start with the answer or result, not internal process narration.",
1928
- "- Use Slack-flavored Markdown: **bold** section labels, `code`, [text](url) links, bullet lists, and fenced code blocks. No hash-prefixed headings and no tables.",
1929
+ ...SLACK_MARKDOWN_RULES,
1929
1930
  "- End every turn with a final user-facing markdown response unless the Slack action rules allow a no-reply completion.",
1930
1931
  "</output>"
1931
1932
  ].join("\n");
@@ -3658,7 +3659,6 @@ async function syncSkillsToSandbox(params) {
3658
3659
  // src/chat/sandbox/session.ts
3659
3660
  const DEFAULT_MAX_OUTPUT_LENGTH = 3e4;
3660
3661
  const DEFAULT_BASH_COMMAND_TIMEOUT_MS = 3e5;
3661
- const SANDBOX_RUNTIME_BIN_DIR = `${SANDBOX_WORKSPACE_ROOT}/.junior/bin`;
3662
3662
  const SNAPSHOT_BOOT_RETRY_COUNT = 3;
3663
3663
  const SNAPSHOT_BOOT_RETRY_DELAY_MS = 1e3;
3664
3664
  const SANDBOX_NAME_PREFIX = "junior-";
@@ -4131,7 +4131,7 @@ function createSandboxRuntime(options) {
4131
4131
  ...sandboxCommandEnv,
4132
4132
  ...input.env ?? {}
4133
4133
  },
4134
- pathPrefix: `${SANDBOX_RUNTIME_BIN_DIR}:$PATH`
4134
+ path: SANDBOX_COMMAND_PATH
4135
4135
  });
4136
4136
  const controller = new AbortController();
4137
4137
  const timeoutMs = input.timeoutMs && input.timeoutMs > 0 ? input.timeoutMs : DEFAULT_BASH_COMMAND_TIMEOUT_MS;
@@ -7012,6 +7012,62 @@ function conversationSubtree(conversationIds) {
7012
7012
  select scope_conversation_id, conversation_id from tree
7013
7013
  ) conversation_subtree`;
7014
7014
  }
7015
+ // src/chat/agent-invocations/agent-types.ts
7016
+ /**
7017
+ * Child agent types. A type is plain data: when to pick it, whether the child
7018
+ * starts with its parent's history, and what it reads with its task. Runtime
7019
+ * code reads only these fields, never a type name, so types can later come
7020
+ * from configuration. Types do not limit tools: Guardian reviews each child
7021
+ * action against the root user's messages, as for any child. A child keeps its
7022
+ * type for later agent invocations, the same as its profile. A child without
7023
+ * a type starts fresh.
7024
+ */
7025
+ const AGENT_TYPES = [
7026
+ "fork",
7027
+ "explore",
7028
+ "reviewer"
7029
+ ];
7030
+ /**
7031
+ * Stored name of a child agent type. Like a model profile, a stored name stays
7032
+ * readable after its type is removed; the runtime then treats the child as a
7033
+ * child without a type.
7034
+ */
7035
+ const agentTypeSchema = z.string().regex(/^[a-z][a-z0-9_-]*$/);
7036
+ const AGENT_TYPE_DEFINITIONS = {
7037
+ fork: {
7038
+ whenToUse: "A copy of you. Use it when the brief would need most of what you already know, or when the intermediate tool output is not worth keeping in your context. The task is a directive: say what to do and what is in or out of scope; do not re-explain the background.",
7039
+ startsWithParentHistory: true,
7040
+ instructions: "You are a fork of your parent agent. The messages before your first parent task are copied from the parent's conversation so you have its context. They are not your job: your job is the parent task below. Sandbox files, approvals, and credentials of the parent were not copied, and your sandbox is separate. Verify files in your own sandbox before you use them."
7041
+ },
7042
+ explore: {
7043
+ whenToUse: "Investigation across code, docs, logs, telemetry, or the web. Use it when an answer needs reading across many files or sources and you need the conclusion with evidence, not the raw output.",
7044
+ startsWithParentHistory: false,
7045
+ instructions: "You are an explore agent. Your job is to investigate and report, so do not change anything outside your sandbox unless the task asks for it. Report what you found with exact evidence, such as paths, lines, links, and ids, and say what you could not verify."
7046
+ },
7047
+ reviewer: {
7048
+ whenToUse: "An independent second opinion on a change, plan, or claim. Give it the evidence to judge, not your conclusion.",
7049
+ startsWithParentHistory: false,
7050
+ instructions: "You are a reviewer agent. Give an independent assessment. Do not assume that the parent's framing is correct: verify each claim against the evidence. Do not change anything outside your own sandbox. Report concrete problems ranked by severity, each with its evidence, and say clearly when you found none."
7051
+ }
7052
+ };
7053
+ function agentTypeDefinition(type) {
7054
+ return type && Object.hasOwn(AGENT_TYPE_DEFINITIONS, type) ? AGENT_TYPE_DEFINITIONS[type] : void 0;
7055
+ }
7056
+ /** Model-facing list of child agent types, with how each child starts. */
7057
+ function formatAgentTypes() {
7058
+ return AGENT_TYPES.map((type) => {
7059
+ const definition = AGENT_TYPE_DEFINITIONS[type];
7060
+ return `- "${type}"${definition.startsWithParentHistory ? " (starts with this conversation's history)" : ""}: ${definition.whenToUse}`;
7061
+ }).join("\n");
7062
+ }
7063
+ /** Return whether a child of this type starts with its parent's history. */
7064
+ function agentTypeStartsWithParentHistory(type) {
7065
+ return agentTypeDefinition(type)?.startsWithParentHistory ?? false;
7066
+ }
7067
+ /** Return the instructions that a child of this type reads with its task. */
7068
+ function agentTypeInstructions(type) {
7069
+ return agentTypeDefinition(type)?.instructions;
7070
+ }
7015
7071
  // src/chat/agent-invocations/types.ts
7016
7072
  const exactStringSchema = z.string().min(1).refine((value) => value === value.trim());
7017
7073
  const agentNameSchema = exactStringSchema.max(64);
@@ -7036,6 +7092,7 @@ const agentInvocationBaseSchema = z.object({
7036
7092
  mailboxStatus: agentInvocationMailboxStatusSchema,
7037
7093
  parentConversationId: exactStringSchema,
7038
7094
  parentToolCallId: exactStringSchema.optional(),
7095
+ agentType: agentTypeSchema.optional(),
7039
7096
  modelProfile: modelProfileSchema.optional(),
7040
7097
  reasoningLevel: z.enum(TURN_REASONING_LEVELS).optional(),
7041
7098
  source: sourceSchema,
@@ -7074,6 +7131,7 @@ const createAgentInvocationSchema = z.object({
7074
7131
  input: exactStringSchema,
7075
7132
  parentConversationId: exactStringSchema,
7076
7133
  parentToolCallId: exactStringSchema.optional(),
7134
+ agentType: agentTypeSchema.optional(),
7077
7135
  modelProfile: modelProfileSchema.optional(),
7078
7136
  reasoningLevel: z.enum(TURN_REASONING_LEVELS).optional(),
7079
7137
  title: exactStringSchema.optional()
@@ -7206,6 +7264,7 @@ function invocationFromRow(row) {
7206
7264
  parentConversationId: row.parentConversationId,
7207
7265
  ...row.parentMailboxStatus ? { parentMailboxStatus: row.parentMailboxStatus } : void 0,
7208
7266
  ...row.parentToolCallId ? { parentToolCallId: row.parentToolCallId } : void 0,
7267
+ ...row.agentType ? { agentType: row.agentType } : void 0,
7209
7268
  ...row.modelProfile ? { modelProfile: row.modelProfile } : void 0,
7210
7269
  ...row.reasoningLevel ? { reasoningLevel: row.reasoningLevel } : void 0,
7211
7270
  ...row.result !== null ? { result: row.result } : void 0,
@@ -7222,7 +7281,7 @@ function invocationFromRow(row) {
7222
7281
  * stored title wins.
7223
7282
  */
7224
7283
  function sameCreateInput(invocation, input) {
7225
- return invocation.parentConversationId === input.parentConversationId && invocation.agentName === input.agentName && invocation.input === input.input && invocation.modelProfile === input.modelProfile && invocation.reasoningLevel === input.reasoningLevel && JSON.stringify(invocation.actor) === JSON.stringify(input.actor) && JSON.stringify(invocation.credentialContext) === JSON.stringify(input.credentialContext) && JSON.stringify(invocation.destination) === JSON.stringify(input.destination);
7284
+ return invocation.parentConversationId === input.parentConversationId && invocation.agentName === input.agentName && invocation.input === input.input && invocation.agentType === input.agentType && invocation.modelProfile === input.modelProfile && invocation.reasoningLevel === input.reasoningLevel && JSON.stringify(invocation.actor) === JSON.stringify(input.actor) && JSON.stringify(invocation.credentialContext) === JSON.stringify(input.credentialContext) && JSON.stringify(invocation.destination) === JSON.stringify(input.destination);
7226
7285
  }
7227
7286
  /** Read one named child binding in its parent-agent scope. */
7228
7287
  async function getAgentBinding(args) {
@@ -7324,6 +7383,7 @@ async function createAgentInvocation(rawInput, nowMs = Date.now()) {
7324
7383
  credentialContext: input.credentialContext ?? null,
7325
7384
  source: { kind: "agent_invocation" },
7326
7385
  destination: input.destination,
7386
+ agentType: input.agentType ?? null,
7327
7387
  modelProfile: input.modelProfile ?? null,
7328
7388
  reasoningLevel: input.reasoningLevel ?? null,
7329
7389
  parentToolCallId: input.parentToolCallId ?? null,
@@ -7358,6 +7418,7 @@ async function createAgentInvocationFromLatest(args, nowMs = Date.now()) {
7358
7418
  credentialContext: (args.runAs ?? args.latest).credentialContext ?? null,
7359
7419
  source: args.runAs?.source ?? { kind: "agent_invocation" },
7360
7420
  destination: args.latest.destination,
7421
+ agentType: args.latest.agentType ?? null,
7361
7422
  modelProfile: args.latest.modelProfile ?? null,
7362
7423
  reasoningLevel: args.latest.reasoningLevel ?? null,
7363
7424
  status: "pending",
@@ -7421,6 +7482,7 @@ async function createAgentInvocationForMessage(input, nowMs = Date.now()) {
7421
7482
  credentialContext: input.credentialContext ?? null,
7422
7483
  source: { kind: "agent_invocation" },
7423
7484
  destination: input.destination,
7485
+ agentType: latest.agentType ?? null,
7424
7486
  modelProfile: latest.modelProfile ?? null,
7425
7487
  reasoningLevel: latest.reasoningLevel ?? null,
7426
7488
  parentToolCallId: input.parentToolCallId,
@@ -7594,6 +7656,16 @@ async function listChildAgents(parentConversationId) {
7594
7656
  return [...byChild.entries()].map(([childConversationId, invocations]) => childAgentFromInvocations(invocations, resultInvocationIds, stoppedAtMs.get(childConversationId))).sort((left, right) => right.updatedAtMs - left.updatedAtMs);
7595
7657
  }
7596
7658
  /**
7659
+ * List the other child agents of one parent whose results have not reached
7660
+ * the parent yet. A child counts while it runs and after it finishes until its
7661
+ * result is appended to the parent mailbox.
7662
+ */
7663
+ async function listUnreportedSiblingAgents(parentConversationId, childConversationId) {
7664
+ const [children, pendingResults] = await Promise.all([listChildAgents(parentConversationId), getSqlExecutor().db().selectDistinct({ childConversationId: juniorAgentInvocations.childConversationId }).from(juniorAgentInvocations).where(and(eq(juniorAgentInvocations.parentConversationId, parentConversationId), eq(juniorAgentInvocations.parentMailboxStatus, "pending")))]);
7665
+ const withPendingResult = new Set(pendingResults.map((row) => row.childConversationId));
7666
+ return children.filter((child) => child.childConversationId !== childConversationId && (NON_TERMINAL_AGENT_INVOCATION_STATUSES.includes(child.status) || withPendingResult.has(child.childConversationId)));
7667
+ }
7668
+ /**
7597
7669
  * List every child agent below one Conversation, at any depth. A parent owns
7598
7670
  * the work of its child agents and of their child agents. The list never has
7599
7671
  * the Conversation itself, its parent, or a sibling.
@@ -7778,13 +7850,18 @@ const spawnAgentOutputSchema = juniorToolOutputSchema.extend({ conversation_id:
7778
7850
  function createSpawnAgentTool(spawnAgent, profileControl) {
7779
7851
  const profileNames = [profileControl.defaultProfile, ...Object.keys(profileControl.profiles).filter((profile) => profile !== profileControl.defaultProfile).sort()];
7780
7852
  const profileSchema = z.enum(profileNames);
7853
+ const profileList = formatModelProfiles(profileControl.profiles, profileNames);
7781
7854
  return zodTool({
7782
7855
  description: [
7783
- "Start a new asynchronous child agent on a delegated task. Give it a name when you may send it more work later. To give more work to a child agent that already exists, use messageAgent instead.",
7784
- "The parent should normally choose the child's profile to fit the delegated task. Use the profile descriptions below to choose; do not choose by profile name alone. When omitted, the child uses the profile active for this turn. A child keeps its original profile when it receives more work through messageAgent.",
7785
- "This call confirms durable scheduling, not task completion. The result arrives later as a new task in this conversation; do not wait or poll for it.",
7856
+ "Start a new asynchronous child agent on a delegated task. A child agent has its own sandbox and tool budget, runs at the same time as you, and sends back only its result. Use child agents to run independent work in parallel and to keep long investigations out of your context.",
7857
+ "Delegate when: the request splits into independent tracks that each need real investigation, such as several repos, services, sources, or items (start every track in the same message); an answer needs reading across many files, logs, or sources and you need the conclusion, not the raw output; a side task does not block your main answer; or you want a second opinion that is not anchored on your analysis (give it the evidence, not your conclusion).",
7858
+ "Do it yourself when: the work fits in a handful of tool calls; you already know the file, symbol, or value to look up; or the job is one modest task that you would only split into pieces. Each child rebuilds its context and its result arrives in a later turn, so when in doubt, do not spawn.",
7859
+ `Pick agent_type when one fits; omit it for a fresh general-purpose child with your tools:\n${formatAgentTypes()}`,
7860
+ "After you delegate, do not do the same work yourself. End your turn with a short status. You know nothing about a child's findings until its result arrives: do not predict them, do not wait or poll, and if the user asks before then, give status.",
7861
+ "Give a child a name when you may send it more work later. To give more work to a child agent that already exists, use messageAgent instead.",
7862
+ "Choose the child's profile from the descriptions below to fit the delegated task, not by profile name. When omitted, the child uses the profile active for this turn. A child keeps its type and profile when it receives more work through messageAgent.",
7786
7863
  "Your task text is not user approval. A child's action review reads the user's own messages in the root conversation.",
7787
- `Configured profiles:\n${formatModelProfiles(profileControl.profiles, profileNames)}`
7864
+ `Configured profiles:\n${profileList}`
7788
7865
  ].join(" "),
7789
7866
  annotations: {
7790
7867
  destructiveHint: false,
@@ -7793,9 +7870,10 @@ function createSpawnAgentTool(spawnAgent, profileControl) {
7793
7870
  readOnlyHint: false
7794
7871
  },
7795
7872
  inputSchema: z.object({
7796
- task: z.string().trim().min(1).describe("Self-contained task. The child gets no thread history and has its own sandbox, so this is its only context from you. Include: the goal and concrete output; target repos, refs, paths, and URLs; facts you already verified; constraints, including which remote side effects are allowed (scratch work in its sandbox is always fine); what counts as done; and what evidence to return. State rules the child must follow. Do not paste thread history or claim user approval."),
7873
+ task: z.string().trim().min(1).describe("Self-contained brief. Unless its agent type starts with this conversation's history, the child has not seen this thread, so this is its only context. Brief it like a capable peer who just joined: the goal and why it matters; target repos, refs, paths, and URLs; facts you already verified and what you ruled out; constraints, including which remote side effects are allowed (scratch work in its sandbox is always fine); what counts as done; and the shape and length of the result to return. Do the synthesis yourself: name the exact question, files, or change instead of writing 'based on your findings, fix it'. If you cannot write a clear brief, you do not understand the task well enough to delegate it. Summarize thread facts instead of pasting the thread, and do not claim user approval."),
7797
7874
  title: z.string().trim().min(1).max(60).nullable().optional().describe("Optional short display title for the task. Omit to generate one from the task."),
7798
7875
  name: agentNameSchema.refine((name) => name !== PARENT_AGENT_TARGET, { message: `"${PARENT_AGENT_TARGET}" is reserved` }).nullable().optional().describe("New child-agent name that messageAgent can address, or omit for a one-off agent"),
7876
+ agent_type: z.enum(AGENT_TYPES).nullable().optional().describe("Child agent type from the list in this tool's description. Omit or pass null for a fresh general-purpose child."),
7799
7877
  profile: profileSchema.nullable().optional().describe("Exact configured profile whose task-fit description matches the delegated task. The parent should normally set this; omit or pass null to use the active profile for this turn."),
7800
7878
  reasoning_level: z.enum(TURN_REASONING_LEVELS).nullable().optional().describe("Optional reasoning level for this delegated task only")
7801
7879
  }).strict(),
@@ -7813,6 +7891,7 @@ function createSpawnAgentTool(spawnAgent, profileControl) {
7813
7891
  result = await spawnAgent({
7814
7892
  task: input.task,
7815
7893
  profile: input.profile ?? profileControl.activeProfile(),
7894
+ ...input.agent_type ? { agentType: input.agent_type } : void 0,
7816
7895
  ...title ? { title } : void 0,
7817
7896
  ...input.name ? { name: input.name } : void 0,
7818
7897
  ...input.reasoning_level ? { reasoningLevel: input.reasoning_level } : void 0
@@ -18776,10 +18855,9 @@ function createAgentRunner(execute, options) {
18776
18855
  const tracePropagation = options?.tracePropagation;
18777
18856
  const bindSpawnAgent = options?.bindSpawnAgent;
18778
18857
  const bindMessageAgent = options?.bindMessageAgent;
18779
- const canBindSpawn = Boolean(bindSpawnAgent) && isExperimentalFeatureEnabled("subagents");
18780
18858
  return { run: async (run) => {
18781
- const spawnAgent = bindSpawnAgent && canBindSpawn && !isAgentRunFeatureDisabled(run.disabledFeatures, "subagents") ? bindSpawnAgent(run) : void 0;
18782
- const messageAgent = bindMessageAgent && canBindSpawn && (spawnAgent || run.parentConversationId) ? bindMessageAgent(run) : void 0;
18859
+ const spawnAgent = bindSpawnAgent && !isAgentRunFeatureDisabled(run.disabledFeatures, "subagents") ? bindSpawnAgent(run) : void 0;
18860
+ const messageAgent = bindMessageAgent && bindSpawnAgent && (spawnAgent || run.parentConversationId) ? bindMessageAgent(run) : void 0;
18783
18861
  const nextRun = {
18784
18862
  ...run,
18785
18863
  environment: {
@@ -18794,7 +18872,7 @@ function createAgentRunner(execute, options) {
18794
18872
  } } : void 0
18795
18873
  };
18796
18874
  if (run.instruction.storedAttachments?.length) {
18797
- const { loadInputImages } = await import("./images-BBmDXQCB.js").then((n) => n.n);
18875
+ const { loadInputImages } = await import("./images-AM1exvU0.js").then((n) => n.n);
18798
18876
  const storage = nextRun.environment?.attachmentStorage;
18799
18877
  if (!storage) throw new Error("Attachment storage is unavailable.");
18800
18878
  nextRun.instruction = {
@@ -18809,4 +18887,4 @@ function createAgentRunner(execute, options) {
18809
18887
  return await execute(nextRun, streamFn);
18810
18888
  } };
18811
18889
  }
18812
- export { getAgentInvocationIdForResult as $, listThreadReplies as A, getConversationTurnBoundaryError as At, stopConversationSession as B, requestAttachmentDeletion as C, actorFromRun as Ct, resolveSlackChannelIdFromMessage as D, CooperativeTurnYieldError as Dt, readSlackRawMessageContext as E, ConversationTurnBoundaryError as Et, AutomationEditError as F, markTurnCompleted as Ft, createAgentInvocation as G, recordSubagentStarted as H, eventAutomationTriggerAvailable as I, markTurnFailed as It, findChildAgentConversationId as J, createAgentInvocationForMessage as K, effectiveTaskOutcomes as L, startActiveTurn as Lt, logScheduledAutomationRunSkipped as M, isTurnInputCommitLostError as Mt, scheduledAutomationRunAttributes as N, isTurnInputDeferredError as Nt, resolveSlackChannelIdFromThreadId as O, TurnInputCommitLostError as Ot, editEventAutomation as P, markTurnClosed as Pt, getAgentInvocationIdForMessage as Q, resolveTaskOutcomes as R, shouldEmitDevAgentTrace as Rt, readLiveAttachment as S, RetryableDeliveryError as St, parseSlackThreadId as T, readBlockedReport as Tt, listChildAgents as U, recordSubagentEnded as V, completeAgentInvocation as W, getAgentInvocation as X, getActiveAgentInvocationForConversation as Y, getAgentInvocationIdForEvents as Z, unpublishedArtifactHeaders as _, conversationSubtreeColumns as _t, finalizeMcpAuthorization as a, isTerminalAgentInvocation as at, renderBlockText as b, buildSteeringPiMessage as bt, deleteMcpServerSessionId as c, markAgentInvocationMailboxAppended as ct, getMcpStoredOAuthCredentials as d, markAgentInvocationRunning as dt, getAgentInvocationMessageId as et, putMcpStoredOAuthCredentials as f, markAgentInvocationSteered as ft, readPublicArtifact as g, conversationSubtree as gt, publicArtifactHeaders as h, PARENT_AGENT_TARGET as ht, buildAuthPauseResponse as i, getLatestAgentInvocationForConversation as it, editScheduledAutomation as j, isCooperativeTurnYieldError as jt, getConversationInfo as k, TurnInputDeferredError as kt, deleteMcpStoredOAuthCredentials as l, markAgentInvocationParentMailboxAppended as lt, readStats as m, AgentMessageTargetError as mt, executeAgentRun as n, getAgentInvocationTurnId as nt, deleteMcpAuthSession as o, listPendingAgentInvocationMailboxAppends as ot, latestProgressStatus as p, reportReplacedAgentInvocation as pt, createAgentInvocationFromLatest as q, createContextCompactor as r, getChildAgentLabel as rt, deleteMcpAuthSessionsForUserProvider as s, listPendingAgentInvocationResults as st, createAgentRunner as t, getAgentInvocationResultMessageId as tt, getMcpAuthSession as u, markAgentInvocationPaused as ut, lookupSlackUserProfile as v, processWorkspaceSnapshotJob as vt, storeAttachment as w, toolInvocationDestination as wt, collectAttachmentGarbage as x, withoutSavedSteeringMessages as xt, renderAttachmentText as y, ingestEvent as yt, stopChildAgentsOf as z };
18890
+ export { getAgentInvocationIdForMessage as $, listThreadReplies as A, CooperativeTurnYieldError as At, stopConversationSession as B, startActiveTurn as Bt, requestAttachmentDeletion as C, buildSteeringPiMessage as Ct, resolveSlackChannelIdFromMessage as D, toolInvocationDestination as Dt, readSlackRawMessageContext as E, actorFromRun as Et, AutomationEditError as F, isTurnInputCommitLostError as Ft, completeAgentInvocation as G, recordSubagentStarted as H, eventAutomationTriggerAvailable as I, isTurnInputDeferredError as It, createAgentInvocationFromLatest as J, createAgentInvocation as K, effectiveTaskOutcomes as L, markTurnClosed as Lt, logScheduledAutomationRunSkipped as M, TurnInputDeferredError as Mt, scheduledAutomationRunAttributes as N, getConversationTurnBoundaryError as Nt, resolveSlackChannelIdFromThreadId as O, readBlockedReport as Ot, editEventAutomation as P, isCooperativeTurnYieldError as Pt, getAgentInvocationIdForEvents as Q, resolveTaskOutcomes as R, markTurnCompleted as Rt, readLiveAttachment as S, ingestEvent as St, parseSlackThreadId as T, RetryableDeliveryError as Tt, listChildAgents as U, recordSubagentEnded as V, shouldEmitDevAgentTrace as Vt, listUnreportedSiblingAgents as W, getActiveAgentInvocationForConversation as X, findChildAgentConversationId as Y, getAgentInvocation as Z, unpublishedArtifactHeaders as _, agentTypeInstructions as _t, finalizeMcpAuthorization as a, getLatestAgentInvocationForConversation as at, renderBlockText as b, conversationSubtreeColumns as bt, deleteMcpServerSessionId as c, listPendingAgentInvocationResults as ct, getMcpStoredOAuthCredentials as d, markAgentInvocationPaused as dt, getAgentInvocationIdForResult as et, putMcpStoredOAuthCredentials as f, markAgentInvocationRunning as ft, readPublicArtifact as g, PARENT_AGENT_TARGET as gt, publicArtifactHeaders as h, AgentMessageTargetError as ht, buildAuthPauseResponse as i, getChildAgentLabel as it, editScheduledAutomation as j, TurnInputCommitLostError as jt, getConversationInfo as k, ConversationTurnBoundaryError as kt, deleteMcpStoredOAuthCredentials as l, markAgentInvocationMailboxAppended as lt, readStats as m, reportReplacedAgentInvocation as mt, executeAgentRun as n, getAgentInvocationResultMessageId as nt, deleteMcpAuthSession as o, isTerminalAgentInvocation as ot, latestProgressStatus as p, markAgentInvocationSteered as pt, createAgentInvocationForMessage as q, createContextCompactor as r, getAgentInvocationTurnId as rt, deleteMcpAuthSessionsForUserProvider as s, listPendingAgentInvocationMailboxAppends as st, createAgentRunner as t, getAgentInvocationMessageId as tt, getMcpAuthSession as u, markAgentInvocationParentMailboxAppended as ut, lookupSlackUserProfile as v, agentTypeStartsWithParentHistory as vt, storeAttachment as w, withoutSavedSteeringMessages as wt, collectAttachmentGarbage as x, processWorkspaceSnapshotJob as xt, renderAttachmentText as y, conversationSubtree as yt, stopChildAgentsOf as z, markTurnFailed as zt };
@@ -2,5 +2,5 @@ import { a as conversationTurnFailureReasonSchema, i as conversationTurnFailureC
2
2
  import { A as forkConversationResponseSchema, C as conversationReportEventSchema, D as createConversationBodySchema, L as resolveMessageCards, O as createConversationMessageBodySchema, P as messageCardText, R as MAX_INPUT_IMAGES, S as conversationReportEventDataSchema, T as conversationSummaryReportSchema, V as INPUT_IMAGE_TYPES, _ as conversationParamsSchema, a as cancelConversationPendingMessagesBodySchema, b as conversationPendingMessageSchema, d as conversationDetailReportSchema, f as conversationEventHistorySchema, g as conversationFeedSchema, h as conversationFeedQuerySchema, i as archiveConversationResponseSchema, j as conversationChildAgentTotalsSchema, k as forkConversationBodySchema, l as conversationAuxiliaryCostsSchema, m as conversationEventsQuerySchema, o as cancelConversationPendingMessagesResponseSchema, p as conversationEventPageSchema, r as archiveConversationBodySchema, s as conversationActivityPreviewSchema, t as acceptedConversationMessageSchema, u as conversationDetailQuerySchema, v as conversationPendingAuthorizationSchema, x as conversationPendingMessagesReportSchema, y as conversationPendingMessageDeliverySchema, z as MAX_INPUT_IMAGE_BYTES } from "../conversation-CvuKJ3tA.js";
3
3
  import { C as eventAutomationSummarySchema, S as automationVersionSchema, _ as automationSummarySchema, a as automationExecutionSchema, b as automationVersionListSchema, d as automationParamsSchema, f as automationRunListSchema, g as automationSchedulePreviewSchema, h as automationScheduleIntentSchema, i as automationExecutionListSchema, l as automationListQuerySchema, m as automationRunWindowsSchema, n as automationEditSchema, o as automationExecutionStatusDaySchema, p as automationRunSchema, r as automationEventCatalogSchema, s as automationExecutionStatusSchema, t as automationEditErrorSchema, u as automationListSchema, v as automationUpdateSchema, w as scheduledAutomationSummarySchema, x as automationVersionParamsSchema, y as automationVersionActivateSchema } from "../automation-DrpcA-SX.js";
4
4
  import { C as skillReportsSchema, S as skillReportSchema, _ as pluginPackageContentItemReportSchema, b as pluginsSchema, g as pluginOperationalReportSchema, h as pluginOperationalReportFeedSchema, m as healthReportSchema, t as webMessageId, v as pluginPackageContentReportSchema, x as runtimeInfoReportSchema, y as pluginSchema } from "../web-message-id-CJSUiksE.js";
5
- import { B as codeChangeSummarySchema, C as personParamsSchema, D as locationDirectoryReportSchema, E as locationDetailReportSchema, F as connectionSchema, G as codeRepositorySummarySchema, H as codePersonReportSchema, I as disconnectConnectionResponseSchema, J as stopConversationTurnResponseSchema, K as conversationChildAgentSchema, L as startConnectionResponseSchema, M as dailyConversationActivitySchema, N as connectionListSchema, O as locationParamsSchema, P as connectionParamsSchema, R as codeActivityDaySchema, S as actorProfileReportSchema, T as locationActivityDayReportSchema, U as codeRepositoryParamsSchema, V as codeOverviewReportSchema, W as codeRepositoryReportSchema, X as apiErrorSchema, Y as conversationStatsReportSchema, _ as personalTokenListSchema, a as workspaceBodySchema, b as revokePersonalTokenResponseSchema, c as workspaceRepoSchema, d as serviceAccountListSchema, f as serviceAccountParamsSchema, g as createdPersonalTokenSchema, h as createPersonalTokenBodySchema, i as deleteWorkspaceResponseSchema, l as workspaceSchema, m as startServiceAccountSignInResponseSchema, n as statsReportSchema, o as workspaceListSchema, p as serviceAccountSchema, q as conversationChildAgentsReportSchema, r as baselineSnapshotSchema, s as workspaceParamsSchema, t as statSchema, u as disconnectServiceAccountResponseSchema, v as personalTokenMetadataSchema, w as personalSpendReportSchema, x as actorDirectoryReportSchema, y as personalTokenParamsSchema, z as codeChangeSummaryReportSchema } from "../schema-OzL8Zw4H.js";
5
+ import { B as codeChangeSummarySchema, C as personParamsSchema, D as locationDirectoryReportSchema, E as locationDetailReportSchema, F as connectionSchema, G as codeRepositorySummarySchema, H as codePersonReportSchema, I as disconnectConnectionResponseSchema, J as stopConversationTurnResponseSchema, K as conversationChildAgentSchema, L as startConnectionResponseSchema, M as dailyConversationActivitySchema, N as connectionListSchema, O as locationParamsSchema, P as connectionParamsSchema, R as codeActivityDaySchema, S as actorProfileReportSchema, T as locationActivityDayReportSchema, U as codeRepositoryParamsSchema, V as codeOverviewReportSchema, W as codeRepositoryReportSchema, X as apiErrorSchema, Y as conversationStatsReportSchema, _ as personalTokenListSchema, a as workspaceBodySchema, b as revokePersonalTokenResponseSchema, c as workspaceRepoSchema, d as serviceAccountListSchema, f as serviceAccountParamsSchema, g as createdPersonalTokenSchema, h as createPersonalTokenBodySchema, i as deleteWorkspaceResponseSchema, l as workspaceSchema, m as startServiceAccountSignInResponseSchema, n as statsReportSchema, o as workspaceListSchema, p as serviceAccountSchema, q as conversationChildAgentsReportSchema, r as baselineSnapshotSchema, s as workspaceParamsSchema, t as statSchema, u as disconnectServiceAccountResponseSchema, v as personalTokenMetadataSchema, w as personalSpendReportSchema, x as actorDirectoryReportSchema, y as personalTokenParamsSchema, z as codeChangeSummaryReportSchema } from "../schema-XuTZukI9.js";
6
6
  export { INPUT_IMAGE_TYPES, MAX_INPUT_IMAGES, MAX_INPUT_IMAGE_BYTES, acceptedConversationMessageSchema, actorDirectoryReportSchema, actorProfileReportSchema, apiErrorSchema, archiveConversationBodySchema, archiveConversationResponseSchema, automationEditErrorSchema, automationEditSchema, automationEventCatalogSchema, automationExecutionListSchema, automationExecutionSchema, automationExecutionStatusDaySchema, automationExecutionStatusSchema, automationListQuerySchema, automationListSchema, automationParamsSchema, automationRunListSchema, automationRunSchema, automationRunWindowsSchema, automationScheduleIntentSchema, automationSchedulePreviewSchema, automationSummarySchema, automationUpdateSchema, automationVersionActivateSchema, automationVersionListSchema, automationVersionParamsSchema, automationVersionSchema, baselineSnapshotSchema, cancelConversationPendingMessagesBodySchema, cancelConversationPendingMessagesResponseSchema, codeActivityDaySchema, codeChangeSummaryReportSchema, codeChangeSummarySchema, codeOverviewReportSchema, codePersonReportSchema, codeRepositoryParamsSchema, codeRepositoryReportSchema, codeRepositorySummarySchema, connectionListSchema, connectionParamsSchema, connectionSchema, conversationActivityPreviewSchema, conversationAuxiliaryCostsSchema, conversationChildAgentSchema, conversationChildAgentTotalsSchema, conversationChildAgentsReportSchema, conversationDetailQuerySchema, conversationDetailReportSchema, conversationEventHistorySchema, conversationEventPageSchema, conversationEventsQuerySchema, conversationFeedQuerySchema, conversationFeedSchema, conversationParamsSchema, conversationPendingAuthorizationSchema, conversationPendingMessageDeliverySchema, conversationPendingMessageSchema, conversationPendingMessagesReportSchema, conversationReportEventDataSchema, conversationReportEventSchema, conversationStatsReportSchema, conversationSummaryReportSchema, conversationTurnFailureCodeSchema, conversationTurnFailureReasonSchema, createConversationBodySchema, createConversationMessageBodySchema, createPersonalTokenBodySchema, createdPersonalTokenSchema, dailyConversationActivitySchema, deleteWorkspaceResponseSchema, disconnectConnectionResponseSchema, disconnectServiceAccountResponseSchema, eventAutomationSummarySchema, forkConversationBodySchema, forkConversationResponseSchema, healthReportSchema, locationActivityDayReportSchema, locationDetailReportSchema, locationDirectoryReportSchema, locationParamsSchema, messageCardText, personParamsSchema, personalSpendReportSchema, personalTokenListSchema, personalTokenMetadataSchema, personalTokenParamsSchema, pluginOperationalReportFeedSchema, pluginOperationalReportSchema, pluginPackageContentItemReportSchema, pluginPackageContentReportSchema, pluginSchema, pluginsSchema, resolveMessageCards, revokePersonalTokenResponseSchema, runtimeInfoReportSchema, scheduledAutomationSummarySchema, serviceAccountListSchema, serviceAccountParamsSchema, serviceAccountSchema, skillReportSchema, skillReportsSchema, startConnectionResponseSchema, startServiceAccountSignInResponseSchema, statSchema, statsReportSchema, stopConversationTurnResponseSchema, webMessageId, workspaceBodySchema, workspaceListSchema, workspaceParamsSchema, workspaceRepoSchema, workspaceSchema };