@sentry/junior 0.295.0 → 0.296.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 (62) hide show
  1. package/dist/{admin-ifgjyfpF.js → admin-z_lgDi-z.js} +2 -2
  2. package/dist/{agent-runner-DjMTPWEO.js → agent-runner-HoQiUKLL.js} +194 -132
  3. package/dist/api/schema.d.ts +1 -1
  4. package/dist/api/schema.js +1 -1
  5. package/dist/api.d.ts +1 -1
  6. package/dist/api.js +294 -328
  7. package/dist/{app-uiTzRbvq.d.ts → app-C75Ft-A_.d.ts} +2 -2
  8. package/dist/app.d.ts +1 -1
  9. package/dist/app.js +26 -26
  10. package/dist/{background-compaction-queue-DUkHZjmL.js → background-compaction-queue-Cre1wFt9.js} +4 -4
  11. package/dist/{briefs-CbNYM-q2.js → briefs-BXECHduJ.js} +2 -2
  12. package/dist/{catalog-runtime-DgouZKZm.js → catalog-runtime-CpCmlD9L.js} +1 -1
  13. package/dist/cli/chat.js +14 -14
  14. package/dist/cli/check.js +3 -3
  15. package/dist/cli/main.js +3 -3
  16. package/dist/cli/plugins.js +4 -4
  17. package/dist/cli/snapshot-create.js +4 -4
  18. package/dist/cli/upgrade.d.ts +1 -1
  19. package/dist/cli/upgrade.js +3 -3
  20. package/dist/{config-DvnTPCfp.js → config-CCPHvTqx.js} +18 -2
  21. package/dist/{connections-CWaIVl_1.js → connections-B5pWh8e2.js} +6 -6
  22. package/dist/{conversation-privacy-DPjv4SnA.js → conversation-privacy-CZD5soDW.js} +1 -1
  23. package/dist/{credential-sync-BhbaZfmO.js → credential-sync-DwLkIvXI.js} +13 -13
  24. package/dist/{db-CCUqQe0E.d.ts → db-B3iyr_Or.d.ts} +1 -1
  25. package/dist/{db-Dts2XvLu.js → db-C1M1y-bh.js} +17 -23
  26. package/dist/{executor-Ck73J0wP.js → executor-DUSEwXaO.js} +10 -4
  27. package/dist/instrumentation.js +19 -2
  28. package/dist/{logging-9OAq-fdg.js → logging-D0svFM8r.js} +1 -1
  29. package/dist/{message-CtaPzC7m.js → message-BFnIwKpx.js} +9 -9
  30. package/dist/nitro.d.ts +1 -1
  31. package/dist/nitro.js +2 -2
  32. package/dist/{oauth-callback-server-C_LXY1d4.js → oauth-callback-server-BXRtD6Fk.js} +2 -2
  33. package/dist/{projection-BzJQncZV.js → projection-B6VS7kbo.js} +156 -49
  34. package/dist/{prompt-Cbq5b4SO.js → prompt-CD11tfG8.js} +3 -3
  35. package/dist/{registry-cbpOxO4M.js → registry-CHewwYEo.js} +1 -1
  36. package/dist/{resolve-t-pmRdwS.js → resolve-1owMH4qo.js} +3 -3
  37. package/dist/{result-DhgjR3nQ.js → result-CEqQFrEf.js} +8 -8
  38. package/dist/{runner-CHv9X9TH.js → runner-BtWvJslp.js} +7 -7
  39. package/dist/{sandbox-egress-signals-Yy3fSCbg.js → sandbox-egress-signals-ByftwJVt.js} +1 -1
  40. package/dist/{schema-TSEisVJR.d.ts → schema-Ct1Zf2xy.d.ts} +16 -0
  41. package/dist/{schema-BhneuGYv.js → schema-D2iGyYIp.js} +11 -0
  42. package/dist/{service-account-C4rBP8ne.js → service-account-BZEuMKdo.js} +3 -3
  43. package/dist/{service-account-DjPIwCMj.js → service-account-DLoeoHww.js} +3 -3
  44. package/dist/{session-stop-DkxI5vc3.js → session-stop-hYNTNpVf.js} +14 -14
  45. package/dist/{skills-BZE2DP8I.js → skills-DXgd5Inh.js} +3 -3
  46. package/dist/{spawn-BvULxIiu.js → spawn-YeqlNDv8.js} +5 -5
  47. package/dist/{state-CO9ETDzk.js → state-C3CbtD_m.js} +2 -2
  48. package/dist/{stop-CL-rdtQb.js → stop-Cze_pEL8.js} +288 -246
  49. package/dist/{store-DgD78_NK.js → store-CZ9vqR4P.js} +3 -3
  50. package/dist/{task-runner-CKOj6xla.js → task-runner-CMiNGsER.js} +274 -250
  51. package/dist/{turn-failure-response-BTSo6SMJ.js → turn-failure-response-pXhZ2wMK.js} +11 -8
  52. package/dist/{validation-CXeYgBzq.js → validation-Du7NdkOR.js} +1 -1
  53. package/dist/{version-AQa7Fr2H.js → version-EN3Wnq-R.js} +1 -1
  54. package/dist/version.js +1 -1
  55. package/dist/{viewer-Bqkb678l.js → viewer-Agxi_o5c.js} +3 -3
  56. package/dist/{warmup-h6u1e9n0.js → warmup-CY2ArYag.js} +251 -103
  57. package/dist/{work-yN_GAuXY.js → work-EA98F0ia.js} +11 -11
  58. package/dist/{worker-Hl7N292I.js → worker-BALVdWbv.js} +6 -6
  59. package/migrations/0101_drop_legacy_columns.sql +12 -0
  60. package/migrations/meta/0101_snapshot.json +4496 -0
  61. package/migrations/meta/_journal.json +7 -0
  62. package/package.json +5 -4
package/dist/nitro.js CHANGED
@@ -1,6 +1,6 @@
1
- import { A as JUNIOR_CONTEXT_COMPACTION_CALLBACK_ROUTE, D as JUNIOR_AUTO_ARCHIVE_CRON_SCHEDULE, F as JUNIOR_RETENTION_CRON_SCHEDULE, I as JUNIOR_RETENTION_ROUTE, L as JUNIOR_WORKSPACE_SNAPSHOT_JOB_CALLBACK_ROUTE, M as JUNIOR_HEARTBEAT_CRON_SCHEDULE, N as JUNIOR_HEARTBEAT_ROUTE, O as JUNIOR_AUTO_ARCHIVE_ROUTE, P as JUNIOR_PLUGIN_TASK_CALLBACK_ROUTE, j as JUNIOR_CONVERSATION_WORK_CALLBACK_ROUTE, k as JUNIOR_CACHE_WARMUP_CALLBACK_ROUTE, z as getDeploymentServiceVersion } from "./logging-9OAq-fdg.js";
1
+ import { A as JUNIOR_CONTEXT_COMPACTION_CALLBACK_ROUTE, D as JUNIOR_AUTO_ARCHIVE_CRON_SCHEDULE, F as JUNIOR_RETENTION_CRON_SCHEDULE, I as JUNIOR_RETENTION_ROUTE, L as JUNIOR_WORKSPACE_SNAPSHOT_JOB_CALLBACK_ROUTE, M as JUNIOR_HEARTBEAT_CRON_SCHEDULE, N as JUNIOR_HEARTBEAT_ROUTE, O as JUNIOR_AUTO_ARCHIVE_ROUTE, P as JUNIOR_PLUGIN_TASK_CALLBACK_ROUTE, j as JUNIOR_CONVERSATION_WORK_CALLBACK_ROUTE, k as JUNIOR_CACHE_WARMUP_CALLBACK_ROUTE, z as getDeploymentServiceVersion } from "./logging-D0svFM8r.js";
2
2
  import { d as resolvePackageDir, t as discoverInstalledPluginPackageContent, u as isValidPackageName } from "./package-discovery-DJhGdS4c.js";
3
- import { S as CACHE_WARMUP_QUEUE_TOPIC, _ as resolveConversationWorkQueueTopic, a as PLUGIN_TASK_QUEUE_TOPIC, f as WORKSPACE_SNAPSHOT_JOB_QUEUE_TOPIC, t as BACKGROUND_COMPACTION_QUEUE_TOPIC } from "./background-compaction-queue-DUkHZjmL.js";
3
+ import { S as CACHE_WARMUP_QUEUE_TOPIC, _ as resolveConversationWorkQueueTopic, a as PLUGIN_TASK_QUEUE_TOPIC, f as WORKSPACE_SNAPSHOT_JOB_QUEUE_TOPIC, t as BACKGROUND_COMPACTION_QUEUE_TOPIC } from "./background-compaction-queue-Cre1wFt9.js";
4
4
  import { a as pluginRuntimeRegistrationsFromPluginSet, r as pluginCatalogConfigFromPluginSet } from "./plugins-HYh_JOdw.js";
5
5
  import { n as loadPluginSetFromModule, r as resolvePluginModule } from "./plugin-module-Cf5gVPWP.js";
6
6
  import path from "node:path";
@@ -1,5 +1,5 @@
1
- import { En as createUserTokenStore } from "./projection-BzJQncZV.js";
2
- import { a as GET, n as syncLocalOAuthCredential, r as GET$1 } from "./credential-sync-BhbaZfmO.js";
1
+ import { En as createUserTokenStore } from "./projection-B6VS7kbo.js";
2
+ import { a as GET, n as syncLocalOAuthCredential, r as GET$1 } from "./credential-sync-DwLkIvXI.js";
3
3
  import { createServer } from "node:http";
4
4
  // src/chat/local/oauth-callback-server.ts
5
5
  const LOCAL_OAUTH_TIMEOUT_MS = 6e5;
@@ -1,17 +1,17 @@
1
1
  import { a as getClient$1, h as startSpan, n as captureMessage, r as continueTrace, v as __exportAll } from "./sentry-BRTJqumy.js";
2
- import { A as estimateTextTokens, E as resolveGatewayModel, I as unwrapCurrentInstruction, L as escapeXml, S as completeObject, T as rerankTexts, X as toOptionalTrimmed, i as getChatConfig, n as botConfig, o as getSlackBotToken, v as normalizeSlackEmojiName, w as embedTexts, x as completeDecision, y as GEN_AI_PROVIDER_NAME } from "./config-DvnTPCfp.js";
3
- import { E as withSpan, G as isRecord$2, K as toOptionalNumber, _ as runBestEffort, a as extractGenAiUsageSummary, b as setSpanAttributes, c as getLogContextAttributes, d as logAudit, h as logWarn, m as logInfo, o as getActiveTraceContext, p as logException, q as toOptionalString, t as buildTurnFailureResponse, x as setSpanStatus, y as setSentryUser } from "./logging-9OAq-fdg.js";
4
- import { t as canExposeConversationPayload } from "./conversation-privacy-DPjv4SnA.js";
2
+ import { A as estimateTextTokens, E as resolveGatewayModel, I as unwrapCurrentInstruction, L as escapeXml, S as completeObject, T as rerankTexts, X as toOptionalTrimmed, i as getChatConfig, n as botConfig, o as getSlackBotToken, v as normalizeSlackEmojiName, w as embedTexts, x as completeDecision, y as GEN_AI_PROVIDER_NAME } from "./config-CCPHvTqx.js";
3
+ import { E as withSpan, G as isRecord$2, K as toOptionalNumber, _ as runBestEffort, a as extractGenAiUsageSummary, b as setSpanAttributes, c as getLogContextAttributes, d as logAudit, h as logWarn, m as logInfo, o as getActiveTraceContext, p as logException, q as toOptionalString, t as buildTurnFailureResponse, x as setSpanStatus, y as setSentryUser } from "./logging-D0svFM8r.js";
4
+ import { t as canExposeConversationPayload } from "./conversation-privacy-CZD5soDW.js";
5
5
  import { c as parseStoredSlackActor, d as parseSlackChannelReferenceId, f as parseSlackTeamId, h as parseSlackMessageTs, i as isActorUserId, l as toStoredSlackActor, p as parseSlackUserId, s as parseActorUserId } from "./actor-6jsm_v96.js";
6
- import { P as resolveActorIdentityId, U as bindProviderConversation, V as saveUserTimezone, Z as hasAgentTurnUsage, a as getConversationStore, d as createSqlConversationEventStore, et as conversationDetailTouch, f as eventFromRow, it as parseDestination, j as startLocationThread, o as getDb, ot as sameDestination, p as withConversationEventLock, q as addAgentTurnUsage, r as getConversationEventStore, s as getSqlExecutor, w as isPersonInput, x as createSqlStore, z as readUserTimezone } from "./db-Dts2XvLu.js";
7
- import { A as juniorConversations, D as juniorCodeChanges, E as juniorConversationAnnotations, M as juniorUsers, N as juniorDestinations, O as juniorCodeRepositories, a as juniorPushSubscriptions, b as juniorConversationBriefs, f as juniorAutomations, i as juniorWorkspaces, j as juniorIdentities, k as juniorAttachments, l as juniorReviewItems, m as juniorLocationConfigurations, n as juniorSnapshots, o as juniorReviewItemAssignees, r as juniorWorkspaceRepos, s as juniorReviewItemConversations, v as juniorConversationParticipants, w as juniorConversationEvents } from "./executor-Ck73J0wP.js";
6
+ import { P as resolveActorIdentityId, U as bindProviderConversation, V as saveUserTimezone, Z as hasAgentTurnUsage, a as getConversationStore, d as createSqlConversationEventStore, et as conversationDetailTouch, f as eventFromRow, it as parseDestination, j as startLocationThread, o as getDb, ot as sameDestination, p as withConversationEventLock, q as addAgentTurnUsage, r as getConversationEventStore, s as getSqlExecutor, w as isPersonInput, x as createSqlStore, z as readUserTimezone } from "./db-C1M1y-bh.js";
7
+ import { A as juniorConversations, D as juniorCodeChanges, E as juniorConversationAnnotations, M as juniorUsers, N as juniorDestinations, O as juniorCodeRepositories, a as juniorPushSubscriptions, b as juniorConversationBriefs, f as juniorAutomations, i as juniorWorkspaces, j as juniorIdentities, k as juniorAttachments, l as juniorReviewItems, m as juniorLocationConfigurations, n as juniorSnapshots, o as juniorReviewItemAssignees, r as juniorWorkspaceRepos, s as juniorReviewItemConversations, v as juniorConversationParticipants, w as juniorConversationEvents } from "./executor-DUSEwXaO.js";
8
8
  import { _ as instructionProvenanceFor, g as instructionActors, h as contextProvenance, o as agentHistoryItemSchema } from "./media-BepyEUNm.js";
9
- import { _ as CredentialUnavailableError, a as resolveAuthTokenPlaceholder, f as credentialContextForActor, g as credentialUserSubjectId, h as credentialSubjectSchema, m as credentialLogContext, o as resolvePluginCommandEnv, p as credentialContextSchema } from "./registry-cbpOxO4M.js";
10
- import { n as pluginCatalogRuntime } from "./catalog-runtime-DgouZKZm.js";
11
- import { d as JUNIOR_NATIVE_EVENT_NAMESPACE, f as agentsInstructionsUpdatedEvent, g as renderJuniorNativeConversationEvent, l as completeObject$1, m as authenticationUnlinkedEvent, n as briefEntriesFromReportEvents, o as isEventConversationMessage, p as authenticationLinkedEvent, s as generateBrief, t as BRIEF_PROMPT, u as completeText } from "./prompt-Cbq5b4SO.js";
9
+ import { _ as CredentialUnavailableError, a as resolveAuthTokenPlaceholder, f as credentialContextForActor, g as credentialUserSubjectId, h as credentialSubjectSchema, m as credentialLogContext, o as resolvePluginCommandEnv, p as credentialContextSchema } from "./registry-CHewwYEo.js";
10
+ import { n as pluginCatalogRuntime } from "./catalog-runtime-CpCmlD9L.js";
11
+ import { d as JUNIOR_NATIVE_EVENT_NAMESPACE, f as agentsInstructionsUpdatedEvent, g as renderJuniorNativeConversationEvent, l as completeObject$1, m as authenticationUnlinkedEvent, n as briefEntriesFromReportEvents, o as isEventConversationMessage, p as authenticationLinkedEvent, s as generateBrief, t as BRIEF_PROMPT, u as completeText } from "./prompt-CD11tfG8.js";
12
12
  import { a as withLock, i as fenceLock, n as MUTATION_LOCK_TTL_MS, r as acquireActiveLock } from "./locks-D-0h111u.js";
13
- import { g as createCache, i as readActorIdentity, l as resolveViewerUser, n as findUserByEmailFromSql, o as readIdentityById, p as parseAvatarUrl, s as readIdentityByIdFromSql } from "./viewer-Bqkb678l.js";
14
- import { a as getStateAdapter, i as getDefaultRedisStateAdapterFor, n as readEncryptedState, o as getStateValues, s as setStateValues, t as createEncryptedState } from "./state-CO9ETDzk.js";
13
+ import { g as createCache, i as readActorIdentity, l as resolveViewerUser, n as findUserByEmailFromSql, o as readIdentityById, p as parseAvatarUrl, s as readIdentityByIdFromSql } from "./viewer-Agxi_o5c.js";
14
+ import { a as getStateAdapter, i as getDefaultRedisStateAdapterFor, n as readEncryptedState, o as getStateValues, s as setStateValues, t as createEncryptedState } from "./state-C3CbtD_m.js";
15
15
  import { n as isWithinNotificationSchedule, r as notificationScheduleSchema, s as isValidTimeZone, t as DEFAULT_NOTIFICATION_SCHEDULE } from "./schedule-cP0AACm1.js";
16
16
  import { F as messageCardRef, J as conversationBriefSchema, L as readMessageCardRefs, N as reviewItemChangeRecordSchema, U as readMessageAttachments, X as parseStoredBrief, Y as parseBriefInput, _ as conversationReportMessageEventSchema, g as conversationReportEventSchema, q as briefResourceLabel } from "./conversation-CMkSmi02.js";
17
17
  import { n as redactSandboxEgressProxyPath, t as SANDBOX_EGRESS_PROXY_PATH } from "./proxy-path-BHYoKZdq.js";
@@ -465,7 +465,7 @@ const PKT_LENGTH = /^[0-9a-f]{4}$/i;
465
465
  function isGitReceivePack(method, upstreamUrl) {
466
466
  return method.toUpperCase() === "POST" && upstreamUrl.pathname.toLowerCase().endsWith("/git-receive-pack");
467
467
  }
468
- function unreadable(reason) {
468
+ function unreadable$1(reason) {
469
469
  return {
470
470
  kind: "unreadable",
471
471
  reason
@@ -480,34 +480,158 @@ function unreadable(reason) {
480
480
  */
481
481
  function readGitPush(body) {
482
482
  const bytes = new Uint8Array(body ?? /* @__PURE__ */ new ArrayBuffer(0));
483
- if (bytes[0] === 31 && bytes[1] === 139) return unreadable("gzip");
483
+ if (bytes[0] === 31 && bytes[1] === 139) return unreadable$1("gzip");
484
484
  const decoder = new TextDecoder();
485
485
  const updates = [];
486
486
  let offset = 0;
487
487
  while (true) {
488
- if (offset + 4 > bytes.length) return unreadable("unterminated");
488
+ if (offset + 4 > bytes.length) return unreadable$1("unterminated");
489
489
  const lengthText = String.fromCharCode(...bytes.subarray(offset, offset + 4));
490
- if (!PKT_LENGTH.test(lengthText)) return unreadable("malformed");
490
+ if (!PKT_LENGTH.test(lengthText)) return unreadable$1("malformed");
491
491
  const length = Number.parseInt(lengthText, 16);
492
492
  if (length === 0) return {
493
493
  kind: "commands",
494
494
  updates
495
495
  };
496
- if (length < 4) return unreadable("malformed");
497
- if (offset + length > bytes.length) return unreadable("unterminated");
496
+ if (length < 4) return unreadable$1("malformed");
497
+ if (offset + length > bytes.length) return unreadable$1("unterminated");
498
498
  const line = decoder.decode(bytes.subarray(offset + 4, offset + length)).replace(/\n$/, "");
499
499
  offset += length;
500
500
  if (line.startsWith("shallow ")) continue;
501
501
  const command = line.split("\0", 1)[0];
502
- if (command === "push-cert") return unreadable("signed");
502
+ if (command === "push-cert") return unreadable$1("signed");
503
503
  const [oldId, newId, ref, ...rest] = command.split(" ");
504
- if (!oldId || !newId || !ref || rest.length > 0 || !OBJECT_ID.test(oldId) || !OBJECT_ID.test(newId)) return unreadable("malformed");
504
+ if (!oldId || !newId || !ref || rest.length > 0 || !OBJECT_ID.test(oldId) || !OBJECT_ID.test(newId)) return unreadable$1("malformed");
505
505
  updates.push({
506
506
  deletes: ZERO_OBJECT_ID.test(newId),
507
507
  ref
508
508
  });
509
509
  }
510
510
  }
511
+ // src/chat/egress/graphql.ts
512
+ /** Largest GraphQL body that the host reads before it issues credentials. */
513
+ const GRAPHQL_BODY_LIMIT_BYTES = 65536;
514
+ /** Match a GraphQL request whose body names the operation. */
515
+ function isGraphqlPost(method, upstreamUrl) {
516
+ return method.toUpperCase() === "POST" && upstreamUrl.pathname.toLowerCase().endsWith("/graphql");
517
+ }
518
+ function unreadable(reason) {
519
+ return {
520
+ kind: "unreadable",
521
+ reason
522
+ };
523
+ }
524
+ /**
525
+ * Read the operations of a GraphQL POST body.
526
+ *
527
+ * A JSON array is a batch. One unreadable entry makes the whole batch
528
+ * unreadable.
529
+ */
530
+ async function readGraphqlRequest(body) {
531
+ const bytes = new Uint8Array(body ?? /* @__PURE__ */ new ArrayBuffer(0));
532
+ if (bytes[0] === 31 && bytes[1] === 139) return unreadable("gzip");
533
+ if (bytes.byteLength > GRAPHQL_BODY_LIMIT_BYTES) return unreadable("too-large");
534
+ let parsed;
535
+ try {
536
+ parsed = JSON.parse(new TextDecoder().decode(bytes));
537
+ } catch {
538
+ return unreadable("json");
539
+ }
540
+ if (!Array.isArray(parsed)) {
541
+ const operation = await readOperation(parsed);
542
+ return typeof operation === "string" ? unreadable(operation) : {
543
+ kind: "operation",
544
+ operation
545
+ };
546
+ }
547
+ const operations = [];
548
+ for (const entry of parsed) {
549
+ const operation = await readOperation(entry);
550
+ if (typeof operation === "string") return unreadable(operation);
551
+ operations.push(operation);
552
+ }
553
+ return {
554
+ kind: "batch",
555
+ operations
556
+ };
557
+ }
558
+ async function readOperation(entry) {
559
+ if (!entry || typeof entry !== "object" || Array.isArray(entry)) return "json";
560
+ const { operationName, query } = entry;
561
+ if (typeof query !== "string") return "query";
562
+ if (operationName !== void 0 && operationName !== null && typeof operationName !== "string") return "operation";
563
+ const { parse } = await import("graphql");
564
+ let document;
565
+ try {
566
+ document = parse(query, { noLocation: true });
567
+ } catch {
568
+ return "document";
569
+ }
570
+ const fragments = /* @__PURE__ */ new Map();
571
+ const operations = [];
572
+ for (const definition of document.definitions) if (definition.kind === "OperationDefinition") operations.push(definition);
573
+ else if (definition.kind === "FragmentDefinition") {
574
+ if (fragments.has(definition.name.value)) return "document";
575
+ fragments.set(definition.name.value, definition);
576
+ }
577
+ const operation = operationName ? operations.find((candidate) => candidate.name?.value === operationName) : operations.length === 1 ? operations[0] : void 0;
578
+ if (!operation) return "operation";
579
+ const fields = /* @__PURE__ */ new Map();
580
+ const rootFields = [];
581
+ if (!collectFields(operation.selectionSet, fragments, /* @__PURE__ */ new Set(), fields) || !collectRootFields(operation.selectionSet, fragments, /* @__PURE__ */ new Set(), rootFields)) return "document";
582
+ return {
583
+ fields: [...fields.values()],
584
+ ...operation.name ? { name: operation.name.value } : void 0,
585
+ rootFields,
586
+ type: operation.operation
587
+ };
588
+ }
589
+ /** Add each distinct field at any depth. Each fragment is read once. */
590
+ function collectFields(selectionSet, fragments, seen, fields) {
591
+ for (const selection of selectionSet.selections) {
592
+ if (selection.kind === "Field") {
593
+ const name = selection.name.value;
594
+ const args = (selection.arguments ?? []).map((arg) => arg.name.value);
595
+ const key = [name, ...args].join("\0");
596
+ if (!fields.has(key)) fields.set(key, {
597
+ arguments: args,
598
+ name
599
+ });
600
+ if (selection.selectionSet && !collectFields(selection.selectionSet, fragments, seen, fields)) return false;
601
+ continue;
602
+ }
603
+ const inner = fragmentSelectionSet(selection, fragments, seen);
604
+ if (inner === false) return false;
605
+ if (inner && !collectFields(inner, fragments, seen, fields)) return false;
606
+ }
607
+ return true;
608
+ }
609
+ /** Add the operation root fields, through fragments. */
610
+ function collectRootFields(selectionSet, fragments, seen, rootFields) {
611
+ for (const selection of selectionSet.selections) {
612
+ if (selection.kind === "Field") {
613
+ rootFields.push(selection.name.value);
614
+ continue;
615
+ }
616
+ const inner = fragmentSelectionSet(selection, fragments, seen);
617
+ if (inner === false) return false;
618
+ if (inner && !collectRootFields(inner, fragments, seen, rootFields)) return false;
619
+ }
620
+ return true;
621
+ }
622
+ /**
623
+ * Return the selections of an inline fragment or a fragment spread.
624
+ *
625
+ * Returns undefined for a fragment already read, which also stops cycles, and
626
+ * false for a spread of an undefined fragment.
627
+ */
628
+ function fragmentSelectionSet(selection, fragments, seen) {
629
+ if (selection.kind === "InlineFragment") return selection.selectionSet;
630
+ const name = selection.name.value;
631
+ if (seen.has(name)) return;
632
+ seen.add(name);
633
+ return fragments.get(name)?.selectionSet ?? false;
634
+ }
511
635
  // src/chat/slack/user.ts
512
636
  const slackUserInfoSchema = z.object({
513
637
  ok: z.literal(true),
@@ -10532,6 +10656,7 @@ async function selectPluginGrant(input) {
10532
10656
  request: {
10533
10657
  ...input.bodyText !== void 0 ? { bodyText: input.bodyText } : void 0,
10534
10658
  ...input.gitPush ? { gitPush: input.gitPush } : void 0,
10659
+ ...input.graphql ? { graphql: input.graphql } : void 0,
10535
10660
  method: input.method,
10536
10661
  ...input.operation ? { operation: input.operation } : void 0,
10537
10662
  url: input.upstreamUrl.toString()
@@ -10855,6 +10980,7 @@ async function selectSandboxEgressGrant(input) {
10855
10980
  const pluginGrant = await selectPluginGrant({
10856
10981
  ...input.bodyText !== void 0 ? { bodyText: input.bodyText } : void 0,
10857
10982
  ...input.gitPush ? { gitPush: input.gitPush } : void 0,
10983
+ ...input.graphql ? { graphql: input.graphql } : void 0,
10858
10984
  ...input.operation ? { operation: input.operation } : void 0,
10859
10985
  provider: input.provider,
10860
10986
  method: input.method,
@@ -11097,28 +11223,14 @@ function unreadableBodyResponse(eventId) {
11097
11223
  headers: { "cache-control": "no-store" }
11098
11224
  });
11099
11225
  }
11100
- /** Identify GitHub writes whose body determines whether a grant is safe. */
11101
- function githubBodyInspection(input) {
11102
- if (input.provider !== "github" || input.requestMethod.toUpperCase() !== "POST" || input.upstreamUrl.hostname.toLowerCase() !== "api.github.com") return;
11103
- const pathname = input.upstreamUrl.pathname.toLowerCase();
11104
- if (pathname.endsWith("/graphql")) return "graphql";
11105
- return /^\/repos\/[^/]+\/[^/]+\/pulls\/[^/]+\/reviews(?:\/[^/]+\/events)?$/.test(pathname) ? "pull-request-review" : void 0;
11226
+ /** Identify GitHub review writes whose body decides whether a grant is safe. */
11227
+ function isGitHubPullRequestReviewPost(input) {
11228
+ return input.provider === "github" && input.requestMethod.toUpperCase() === "POST" && input.upstreamUrl.hostname.toLowerCase() === "api.github.com" && /^\/repos\/[^/]+\/[^/]+\/pulls\/[^/]+\/reviews(?:\/[^/]+\/events)?$/.test(input.upstreamUrl.pathname.toLowerCase());
11106
11229
  }
11107
- function grantSelectionBodyTooLargeMessage(inspection) {
11108
- return inspection === "graphql" ? "GitHub GraphQL request body is too large to inspect before issuing credentials." : "GitHub pull request review request body is too large to inspect before issuing credentials.";
11109
- }
11110
- function grantSelectionBodyText(input) {
11111
- if (input.body === void 0) return;
11112
- if (input.body.byteLength > GRANT_SELECTION_BODY_TEXT_LIMIT_BYTES) {
11113
- const inspection = githubBodyInspection({
11114
- provider: input.provider,
11115
- requestMethod: input.request.method,
11116
- upstreamUrl: input.upstreamUrl
11117
- });
11118
- if (inspection) throw new EgressPolicyDenied(grantSelectionBodyTooLargeMessage(inspection));
11119
- return;
11120
- }
11121
- return new TextDecoder().decode(input.body);
11230
+ function grantSelectionBodyText(body) {
11231
+ if (body === void 0) return;
11232
+ if (body.byteLength > GRANT_SELECTION_BODY_TEXT_LIMIT_BYTES) throw new EgressPolicyDenied("GitHub pull request review request body is too large to inspect before issuing credentials.");
11233
+ return new TextDecoder().decode(body);
11122
11234
  }
11123
11235
  function responseContentLength(upstream) {
11124
11236
  const raw = upstream.headers.get("content-length");
@@ -11279,21 +11391,16 @@ async function executeCredentialedEgressRequest(input) {
11279
11391
  ...egressDecisionAttributes("denied", "request body is unreadable")
11280
11392
  }));
11281
11393
  }
11282
- const bodyForGrantSelection = githubBodyInspection({
11283
- provider,
11284
- requestMethod: request.method,
11285
- upstreamUrl
11286
- }) ? body : void 0;
11287
11394
  let grantSelection;
11288
11395
  try {
11289
11396
  grantSelection = await selectSandboxEgressGrant({
11290
- bodyText: grantSelectionBodyText({
11291
- body: bodyForGrantSelection,
11397
+ ...isGitHubPullRequestReviewPost({
11292
11398
  provider,
11293
- request,
11399
+ requestMethod: request.method,
11294
11400
  upstreamUrl
11295
- }),
11401
+ }) ? { bodyText: grantSelectionBodyText(body) } : void 0,
11296
11402
  ...isGitReceivePack(request.method, upstreamUrl) ? { gitPush: readGitPush(body) } : void 0,
11403
+ ...isGraphqlPost(request.method, upstreamUrl) ? { graphql: await readGraphqlRequest(body) } : void 0,
11297
11404
  ...operation ? { operation } : void 0,
11298
11405
  provider,
11299
11406
  method: request.method,
@@ -14249,7 +14356,7 @@ async function getPluginConversationTitleContext(args) {
14249
14356
  const COMPACTION_TRIGGER_RATIO = .9;
14250
14357
  const CONTEXT_INPUT_LIMIT_RATIO = .95;
14251
14358
  const COMPACTION_TARGET_RATIO = .8;
14252
- const BACKGROUND_COMPACTION_MARK_RATIO = .7;
14359
+ const BACKGROUND_COMPACTION_MARK_RATIO = .85;
14253
14360
  const FALLBACK_CONTEXT_WINDOW_TOKENS = 4e5;
14254
14361
  function positiveInteger(value, fallback) {
14255
14362
  return Number.isFinite(value) && value > 0 ? Math.floor(value) : fallback;
@@ -1,6 +1,6 @@
1
- import { C as completeText$1, S as completeObject$1, x as completeDecision$1 } from "./config-DvnTPCfp.js";
2
- import { _ as runBestEffort, a as extractGenAiUsageSummary } from "./logging-9OAq-fdg.js";
3
- import { J as agentTurnCostUsd, r as getConversationEventStore } from "./db-Dts2XvLu.js";
1
+ import { C as completeText$1, S as completeObject$1, x as completeDecision$1 } from "./config-CCPHvTqx.js";
2
+ import { _ as runBestEffort, a as extractGenAiUsageSummary } from "./logging-D0svFM8r.js";
3
+ import { J as agentTurnCostUsd, r as getConversationEventStore } from "./db-C1M1y-bh.js";
4
4
  import { J as conversationBriefSchema, K as briefOutcomeStatusSchema, Y as parseBriefInput } from "./conversation-CMkSmi02.js";
5
5
  import * as z from "zod";
6
6
  import { conversationEventPresentationSchema, defineConversationEvent } from "@sentry/junior-plugin-api";
@@ -1,4 +1,4 @@
1
- import { b as setSpanAttributes, h as logWarn, m as logInfo } from "./logging-9OAq-fdg.js";
1
+ import { b as setSpanAttributes, h as logWarn, m as logInfo } from "./logging-D0svFM8r.js";
2
2
  import { o as isUserActor, s as parseActorUserId } from "./actor-6jsm_v96.js";
3
3
  import { n as normalizePluginPackageNames, o as pluginRoots, t as discoverInstalledPluginPackageContent } from "./package-discovery-DJhGdS4c.js";
4
4
  import path from "node:path";
@@ -1,6 +1,6 @@
1
- import { Di as isStale, Ha as SANDBOX_WORKSPACE_ROOT, Ja as runNonInteractiveCommand, Ma as sleep, Ra as SANDBOX_COMMAND_PATH, Ti as create, ki as getSandboxProvider } from "./projection-BzJQncZV.js";
2
- import { E as withSpan, b as setSpanAttributes } from "./logging-9OAq-fdg.js";
3
- import { a as getStateAdapter } from "./state-CO9ETDzk.js";
1
+ import { Di as isStale, Ha as SANDBOX_WORKSPACE_ROOT, Ja as runNonInteractiveCommand, Ma as sleep, Ra as SANDBOX_COMMAND_PATH, Ti as create, ki as getSandboxProvider } from "./projection-B6VS7kbo.js";
2
+ import { E as withSpan, b as setSpanAttributes } from "./logging-D0svFM8r.js";
3
+ import { a as getStateAdapter } from "./state-C3CbtD_m.js";
4
4
  import * as z from "zod";
5
5
  // src/chat/sandbox/resources.ts
6
6
  let configuredResources;
@@ -1,12 +1,12 @@
1
1
  import { v as __exportAll } from "./sentry-BRTJqumy.js";
2
- import { Cn as renderUntrustedTag } from "./projection-BzJQncZV.js";
3
- import { M as SYSTEM_IDENTITY_ID } from "./db-Dts2XvLu.js";
4
- import { f as credentialContextForActor } from "./registry-cbpOxO4M.js";
5
- import { cn as listUnreportedSiblingAgents } from "./agent-runner-DjMTPWEO.js";
6
- import { C as isTerminalAgentInvocation, G as getAgentInvocationIdForEvents, K as getAgentInvocationIdForMessage, Y as getAgentInvocationResultMessageId, k as markAgentInvocationParentMailboxAppended, q as getAgentInvocationIdForResult, x as getLatestAgentInvocationForConversation, y as getAgentInvocation } from "./turn-failure-response-BTSo6SMJ.js";
7
- import { D as timerWatchCredentialSubject, E as renderEventBatchInputs, S as EVENT_WAIT_MS, T as isEventMailboxMetadata, f as getEventBatchDelayMs, m as parseEventMessages, n as isWatchEvent, s as eventReviewItemInputs, w as eventBatchMessageMeta } from "./session-stop-DkxI5vc3.js";
8
- import { r as appendAndEnqueueInboundMessage } from "./store-DgD78_NK.js";
9
- import { a as enqueueAgentInvocation, l as createAgentInvocationFromLatest, o as resolveAgentInvocationId, t as createAgentInvocationWorker } from "./work-yN_GAuXY.js";
2
+ import { Cn as renderUntrustedTag } from "./projection-B6VS7kbo.js";
3
+ import { M as SYSTEM_IDENTITY_ID } from "./db-C1M1y-bh.js";
4
+ import { f as credentialContextForActor } from "./registry-CHewwYEo.js";
5
+ import { cn as listUnreportedSiblingAgents } from "./agent-runner-HoQiUKLL.js";
6
+ import { C as isTerminalAgentInvocation, G as getAgentInvocationIdForEvents, K as getAgentInvocationIdForMessage, Y as getAgentInvocationResultMessageId, k as markAgentInvocationParentMailboxAppended, q as getAgentInvocationIdForResult, x as getLatestAgentInvocationForConversation, y as getAgentInvocation } from "./turn-failure-response-pXhZ2wMK.js";
7
+ import { D as timerWatchCredentialSubject, E as renderEventBatchInputs, S as EVENT_WAIT_MS, T as isEventMailboxMetadata, f as getEventBatchDelayMs, m as parseEventMessages, n as isWatchEvent, s as eventReviewItemInputs, w as eventBatchMessageMeta } from "./session-stop-hYNTNpVf.js";
8
+ import { r as appendAndEnqueueInboundMessage } from "./store-CZ9vqR4P.js";
9
+ import { a as enqueueAgentInvocation, l as createAgentInvocationFromLatest, o as resolveAgentInvocationId, t as createAgentInvocationWorker } from "./work-EA98F0ia.js";
10
10
  import { n as isAgentInvocationResultEventType, t as agentInvocationResultEventType } from "./result-event-type-DD6BAgT7.js";
11
11
  // src/chat/agent-invocations/result.ts
12
12
  var result_exports = /* @__PURE__ */ __exportAll({
@@ -1,11 +1,11 @@
1
- import { A as latestConversationMessageSeq, I as upsertConversationMessage, M as normalizeConversationText, N as recordDeliveredAssistantMessage, Qt as persistWithRetry, W as authorizationId, a as loadProjection, b as persistConversationMessages, d as recordAuthorizationCompleted, j as markConversationMessage, nt as saveTurnCheckpoint, t as commitAcceptedReply, v as hydrateConversationMessages } from "./projection-BzJQncZV.js";
2
- import { S as setTags, T as withLogContext, p as logException } from "./logging-9OAq-fdg.js";
3
- import { M as SYSTEM_IDENTITY_ID, a as getConversationStore, r as getConversationEventStore } from "./db-Dts2XvLu.js";
4
- import { f as credentialContextForActor } from "./registry-cbpOxO4M.js";
1
+ import { A as latestConversationMessageSeq, I as upsertConversationMessage, M as normalizeConversationText, N as recordDeliveredAssistantMessage, Qt as persistWithRetry, W as authorizationId, a as loadProjection, b as persistConversationMessages, d as recordAuthorizationCompleted, j as markConversationMessage, nt as saveTurnCheckpoint, t as commitAcceptedReply, v as hydrateConversationMessages } from "./projection-B6VS7kbo.js";
2
+ import { S as setTags, T as withLogContext, p as logException } from "./logging-D0svFM8r.js";
3
+ import { M as SYSTEM_IDENTITY_ID, a as getConversationStore, r as getConversationEventStore } from "./db-C1M1y-bh.js";
4
+ import { f as credentialContextForActor } from "./registry-CHewwYEo.js";
5
5
  import { I as messageCardText } from "./conversation-CMkSmi02.js";
6
- import { D as getAssistantReplyText } from "./warmup-h6u1e9n0.js";
7
- import { dt as markTurnFailed, f as ConversationTurnLifecycleService, ft as startActiveTurn, i as completeAuthPauseTurn, l as buildDeliveredTurnStatePatch, m as loadPendingMessageCards, t as finalizeFailedTurnReplyWithEvent, u as buildTurnThreadContext } from "./turn-failure-response-BTSo6SMJ.js";
8
- import { ft as getPersistedSandboxState, gt as coerceThreadConversationState, ht as persistThreadStateById, n as scheduleSessionCompletedPluginTasks, pt as getPersistedThreadState, t as processPluginTask } from "./task-runner-CKOj6xla.js";
6
+ import { T as getAssistantReplyText } from "./warmup-CY2ArYag.js";
7
+ import { dt as markTurnFailed, f as ConversationTurnLifecycleService, ft as startActiveTurn, i as completeAuthPauseTurn, l as buildDeliveredTurnStatePatch, m as loadPendingMessageCards, t as finalizeFailedTurnReplyWithEvent, u as buildTurnThreadContext } from "./turn-failure-response-pXhZ2wMK.js";
8
+ import { c as getPersistedThreadState, d as coerceThreadConversationState, n as scheduleSessionCompletedPluginTasks, s as getPersistedSandboxState, t as processPluginTask, u as persistThreadStateById } from "./task-runner-CMiNGsER.js";
9
9
  import { randomUUID } from "node:crypto";
10
10
  import { createLocalSource, localDestinationSchema } from "@sentry/junior-plugin-api";
11
11
  // src/chat/local/runner.ts
@@ -1,4 +1,4 @@
1
- import { Da as sandboxEgressSignalsResponseSchema } from "./projection-BzJQncZV.js";
1
+ import { Da as sandboxEgressSignalsResponseSchema } from "./projection-B6VS7kbo.js";
2
2
  // src/chat/local/sandbox-egress-signals.ts
3
3
  const SANDBOX_EGRESS_SIGNALS_PATH = "/api/internal/sandbox-egress/signals";
4
4
  const LOCAL_DEV_SERVER_TIMEOUT_MS = 1e3;
@@ -4117,6 +4117,10 @@ declare const conversationMetricDaySchema: z.ZodObject<{
4117
4117
  date: z.ZodString;
4118
4118
  durationMs: z.ZodNumber;
4119
4119
  inputTokens: z.ZodOptional<z.ZodNumber>;
4120
+ mergedCodeChangeCostUsd: z.ZodOptional<z.ZodNumber>;
4121
+ mergedCodeChanges: z.ZodOptional<z.ZodNumber>;
4122
+ outcomeCostUsd: z.ZodOptional<z.ZodNumber>;
4123
+ outcomes: z.ZodOptional<z.ZodNumber>;
4120
4124
  tokens: z.ZodOptional<z.ZodNumber>;
4121
4125
  }, z.core.$strict>;
4122
4126
  declare const guardianMetricDaySchema: z.ZodObject<{
@@ -4205,6 +4209,10 @@ declare const conversationStatsReportSchema: z.ZodObject<{
4205
4209
  date: z.ZodString;
4206
4210
  durationMs: z.ZodNumber;
4207
4211
  inputTokens: z.ZodOptional<z.ZodNumber>;
4212
+ mergedCodeChangeCostUsd: z.ZodOptional<z.ZodNumber>;
4213
+ mergedCodeChanges: z.ZodOptional<z.ZodNumber>;
4214
+ outcomeCostUsd: z.ZodOptional<z.ZodNumber>;
4215
+ outcomes: z.ZodOptional<z.ZodNumber>;
4208
4216
  tokens: z.ZodOptional<z.ZodNumber>;
4209
4217
  }, z.core.$strict>>;
4210
4218
  metricHours: z.ZodOptional<z.ZodArray<z.ZodObject<{
@@ -4215,6 +4223,10 @@ declare const conversationStatsReportSchema: z.ZodObject<{
4215
4223
  date: z.ZodString;
4216
4224
  durationMs: z.ZodNumber;
4217
4225
  inputTokens: z.ZodOptional<z.ZodNumber>;
4226
+ mergedCodeChangeCostUsd: z.ZodOptional<z.ZodNumber>;
4227
+ mergedCodeChanges: z.ZodOptional<z.ZodNumber>;
4228
+ outcomeCostUsd: z.ZodOptional<z.ZodNumber>;
4229
+ outcomes: z.ZodOptional<z.ZodNumber>;
4218
4230
  tokens: z.ZodOptional<z.ZodNumber>;
4219
4231
  }, z.core.$strict>>>;
4220
4232
  metricSixHours: z.ZodOptional<z.ZodArray<z.ZodObject<{
@@ -4225,6 +4237,10 @@ declare const conversationStatsReportSchema: z.ZodObject<{
4225
4237
  date: z.ZodString;
4226
4238
  durationMs: z.ZodNumber;
4227
4239
  inputTokens: z.ZodOptional<z.ZodNumber>;
4240
+ mergedCodeChangeCostUsd: z.ZodOptional<z.ZodNumber>;
4241
+ mergedCodeChanges: z.ZodOptional<z.ZodNumber>;
4242
+ outcomeCostUsd: z.ZodOptional<z.ZodNumber>;
4243
+ outcomes: z.ZodOptional<z.ZodNumber>;
4228
4244
  tokens: z.ZodOptional<z.ZodNumber>;
4229
4245
  }, z.core.$strict>>>;
4230
4246
  locations: z.ZodArray<z.ZodObject<{
@@ -111,6 +111,17 @@ const conversationMetricDaySchema = z.object({
111
111
  date: conversationMetricBucketSchema,
112
112
  durationMs: z.number(),
113
113
  inputTokens: z.number().optional(),
114
+ /** Conversation cost split to `mergedCodeChanges`. */
115
+ mergedCodeChangeCostUsd: z.number().optional(),
116
+ /** Code changes merged in this bucket. They are also `outcomes`. */
117
+ mergedCodeChanges: z.number().optional(),
118
+ /** Conversation cost of `outcomes`. */
119
+ outcomeCostUsd: z.number().optional(),
120
+ /**
121
+ * Merged code changes, plus root Conversations without code changes
122
+ * whose latest Brief is `done` or `answered`.
123
+ */
124
+ outcomes: z.number().optional(),
114
125
  tokens: z.number().optional()
115
126
  }).strict();
116
127
  const guardianMetricDaySchema = z.object({
@@ -1,6 +1,6 @@
1
- import { n as pluginCatalogRuntime } from "./catalog-runtime-DgouZKZm.js";
2
- import { r as disconnectStateAdapter } from "./state-CO9ETDzk.js";
3
- import { n as finishServiceAccountSignIn, o as serviceAccountPlugins, r as getServiceAccountStatus, s as startServiceAccountSignIn, t as disconnectServiceAccount } from "./service-account-DjPIwCMj.js";
1
+ import { n as pluginCatalogRuntime } from "./catalog-runtime-CpCmlD9L.js";
2
+ import { r as disconnectStateAdapter } from "./state-C3CbtD_m.js";
3
+ import { n as finishServiceAccountSignIn, o as serviceAccountPlugins, r as getServiceAccountStatus, s as startServiceAccountSignIn, t as disconnectServiceAccount } from "./service-account-DLoeoHww.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,7 +1,7 @@
1
- import { G as isRecord, b as setSpanAttributes, h as logWarn } from "./logging-9OAq-fdg.js";
2
- import { c as fetchWithBoundedOAuthErrorBodies, i as resolvePluginHeaderEnvRefs } from "./registry-cbpOxO4M.js";
1
+ import { G as isRecord, b as setSpanAttributes, h as logWarn } from "./logging-D0svFM8r.js";
2
+ import { c as fetchWithBoundedOAuthErrorBodies, i as resolvePluginHeaderEnvRefs } from "./registry-CHewwYEo.js";
3
3
  import { a as withLock, i as fenceLock, n as MUTATION_LOCK_TTL_MS } from "./locks-D-0h111u.js";
4
- import { a as getStateAdapter, n as readEncryptedState, t as createEncryptedState } from "./state-CO9ETDzk.js";
4
+ import { a as getStateAdapter, n as readEncryptedState, t as createEncryptedState } from "./state-C3CbtD_m.js";
5
5
  import { AsyncLocalStorage } from "node:async_hooks";
6
6
  import { randomUUID } from "node:crypto";
7
7
  import { UnauthorizedError, auth } from "@modelcontextprotocol/sdk/client/auth.js";
@@ -1,18 +1,18 @@
1
1
  import { v as __exportAll } from "./sentry-BRTJqumy.js";
2
- import { Bn as getPlugins, Cn as renderUntrustedTag, Ga as sandboxSkillPathResolution, In as getPluginSlackConversationLink, Li as escapeSlackMrkdwnText, M as normalizeConversationText, Ri as formatSlackLink, Sn as renderTag, Ua as sandboxSkillDir, Wa as sandboxSkillFile, Yi as postSlackMessage, _i as listWorkspaces, fn as retainRuntimeTurnContext, ho as buildSentryConversationUrl, ii as getDashboardObjectIconLink, ni as JUNIOR_THREAD_STATE_TTL_MS, ot as getTurnRecord, pn as stripRuntimeTurnContext, ri as getDashboardConversationLink, rn as hasRuntimeTurnContext, sr as getReviewItem, st as listTurnSummaries, ti as verifyTimerWatchCredentialSubject, ui as ToolInputError, vn as escapeClosingTags, wn as tagJson, x as toStoredConversationMessage, xn as renderChildTag, yn as escapeTagText, zi as normalizeSlackReplyMarkdown, zn as getPluginUserPromptContributions, zr as cancelSubscriptions } from "./projection-BzJQncZV.js";
3
- import { F as renderCurrentInstruction, L as escapeXml, n as botConfig } from "./config-DvnTPCfp.js";
4
- import { h as logWarn, m as logInfo, p as logException, v as serializeGenAiAttribute } from "./logging-9OAq-fdg.js";
2
+ import { Bn as getPlugins, Cn as renderUntrustedTag, Ga as sandboxSkillPathResolution, In as getPluginSlackConversationLink, Li as escapeSlackMrkdwnText, M as normalizeConversationText, Ri as formatSlackLink, Sn as renderTag, Ua as sandboxSkillDir, Wa as sandboxSkillFile, Yi as postSlackMessage, _i as listWorkspaces, fn as retainRuntimeTurnContext, ho as buildSentryConversationUrl, ii as getDashboardObjectIconLink, ni as JUNIOR_THREAD_STATE_TTL_MS, ot as getTurnRecord, pn as stripRuntimeTurnContext, ri as getDashboardConversationLink, rn as hasRuntimeTurnContext, sr as getReviewItem, st as listTurnSummaries, ti as verifyTimerWatchCredentialSubject, ui as ToolInputError, vn as escapeClosingTags, wn as tagJson, x as toStoredConversationMessage, xn as renderChildTag, yn as escapeTagText, zi as normalizeSlackReplyMarkdown, zn as getPluginUserPromptContributions, zr as cancelSubscriptions } from "./projection-B6VS7kbo.js";
3
+ import { F as renderCurrentInstruction, L as escapeXml, n as botConfig } from "./config-CCPHvTqx.js";
4
+ import { h as logWarn, m as logInfo, p as logException, v as serializeGenAiAttribute } from "./logging-D0svFM8r.js";
5
5
  import { o as isUserActor, t as createActor } from "./actor-6jsm_v96.js";
6
- import { M as SYSTEM_IDENTITY_ID, a as getConversationStore, o as getDb, r as getConversationEventStore, s as getSqlExecutor, tt as nextDetailVersion, w as isPersonInput } from "./db-Dts2XvLu.js";
7
- import { A as juniorConversations, M as juniorUsers } from "./executor-Ck73J0wP.js";
6
+ import { M as SYSTEM_IDENTITY_ID, a as getConversationStore, o as getDb, r as getConversationEventStore, s as getSqlExecutor, tt as nextDetailVersion, w as isPersonInput } from "./db-C1M1y-bh.js";
7
+ import { A as juniorConversations, M as juniorUsers } from "./executor-DUSEwXaO.js";
8
8
  import { i as isVisionImageMediaType } from "./media-BepyEUNm.js";
9
- import { h as credentialSubjectSchema } from "./registry-cbpOxO4M.js";
10
- import { a as EVENT_SYSTEM_ACTOR, d as JUNIOR_NATIVE_EVENT_NAMESPACE, h as conversationNoteEvent, i as EVENT_MESSAGE_AUTHOR, o as isEventConversationMessage, r as EVENT_AUTHOR_ID } from "./prompt-Cbq5b4SO.js";
11
- import { a as getStateAdapter } from "./state-CO9ETDzk.js";
12
- import { _ as buildDeploymentSystemPrompt, b as FINISH_AUTOMATION_RUN_TOOL_NAME, k as NO_REPLY_TOOL_NAME, y as buildTurnContextPrompt } from "./warmup-h6u1e9n0.js";
9
+ import { h as credentialSubjectSchema } from "./registry-CHewwYEo.js";
10
+ import { a as EVENT_SYSTEM_ACTOR, d as JUNIOR_NATIVE_EVENT_NAMESPACE, h as conversationNoteEvent, i as EVENT_MESSAGE_AUTHOR, o as isEventConversationMessage, r as EVENT_AUTHOR_ID } from "./prompt-CD11tfG8.js";
11
+ import { a as getStateAdapter } from "./state-C3CbtD_m.js";
12
+ import { D as NO_REPLY_TOOL_NAME, _ as buildDeploymentSystemPrompt, b as REPLY_TOOL_NAME, j as REPORT_BLOCKED_TOOL_NAME, y as buildTurnContextPrompt } from "./warmup-CY2ArYag.js";
13
13
  import { D as userCustomizationTextSchema, v as formatUserInputAnswer } from "./reporting-window-B3Ze-Qnt.js";
14
- import { r as appendAndEnqueueInboundMessage } from "./store-DgD78_NK.js";
15
- import { _t as CORE_EVENT_NAMESPACE, bt as eventCatalogEntry, xt as eventGuidance } from "./task-runner-CKOj6xla.js";
14
+ import { r as appendAndEnqueueInboundMessage } from "./store-CZ9vqR4P.js";
15
+ import { Ct as eventGuidance, St as eventCatalogEntry, yt as CORE_EVENT_NAMESPACE } from "./task-runner-CMiNGsER.js";
16
16
  import { isDeepStrictEqual } from "node:util";
17
17
  import * as z from "zod";
18
18
  import { and, eq, inArray, isNull, lt, lte, or, sql } from "drizzle-orm";
@@ -1148,8 +1148,8 @@ async function maybePostAutomatedTurnLimitNotice(args) {
1148
1148
  * its own child tags, and the outcome rule is always last.
1149
1149
  */
1150
1150
  /**
1151
- * Shared closing lines. Automations pass outcomes and end with a declared
1152
- * result. Watches follow the Conversation's reply rules. A Watch reply goes
1151
+ * Shared closing lines. Automations pass outcomes and end with an answer
1152
+ * tool. Watches follow the Conversation's reply rules. A Watch reply goes
1153
1153
  * only to the Conversation, so a question asked in the provider must also get
1154
1154
  * its answer there. Watch instructions often say to stay silent, so this rule
1155
1155
  * sits in the contract, not in plugin guidance.
@@ -1160,7 +1160,7 @@ function replyContractLines(outcomes) {
1160
1160
  "When you reply, follow any reply format in the instructions.",
1161
1161
  `When the outcome needs nobody's attention, such as a routine fix that worked or feedback that you handled, end the Turn with \`${NO_REPLY_TOOL_NAME}\` and put the outcome in its \`note\`. The note stays in the Conversation but notifies nobody. Do not use it when the instructions say to notify, mention, or report to a person, when the reply asks a question, when a person must decide or act, or when something failed.`
1162
1162
  ];
1163
- return [`End with \`${FINISH_AUTOMATION_RUN_TOOL_NAME}\`.`];
1163
+ return [`End with \`${REPLY_TOOL_NAME}\`, \`${NO_REPLY_TOOL_NAME}\`, or \`${REPORT_BLOCKED_TOOL_NAME}\`.`];
1164
1164
  }
1165
1165
  function oneLine(value) {
1166
1166
  return value.replace(/[\r\n]+/g, " ").replace(/\s+/g, " ").trim();
@@ -1,7 +1,7 @@
1
1
  import { v as __exportAll } from "./sentry-BRTJqumy.js";
2
- import { h as logWarn } from "./logging-9OAq-fdg.js";
2
+ import { h as logWarn } from "./logging-D0svFM8r.js";
3
3
  import { s as skillRoots } from "./package-discovery-DJhGdS4c.js";
4
- import { n as pluginCatalogRuntime } from "./catalog-runtime-DgouZKZm.js";
4
+ import { n as pluginCatalogRuntime } from "./catalog-runtime-CpCmlD9L.js";
5
5
  import path from "node:path";
6
6
  import * as z from "zod";
7
7
  import fs from "node:fs/promises";
@@ -265,7 +265,7 @@ function isCommonEnvironmentVariable(name) {
265
265
  function parseSkillInvocation(messageText, availableSkills) {
266
266
  const trimmed = messageText.trim();
267
267
  const escapePattern = (value) => value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
268
- for (const match of trimmed.matchAll(/(?:^|\s)\$([a-z0-9]+(?:-[a-z0-9]+)*)/gi)) {
268
+ for (const match of trimmed.matchAll(/(?<![\w$])\$([a-z0-9]+(?:-[a-z0-9]+)*)/gi)) {
269
269
  const skillName = match[1]?.toLowerCase();
270
270
  if (!skillName) continue;
271
271
  if (isCommonEnvironmentVariable(skillName)) continue;
@@ -1,9 +1,9 @@
1
1
  import { v as __exportAll } from "./sentry-BRTJqumy.js";
2
- import { n as botConfig } from "./config-DvnTPCfp.js";
3
- import { O as conversationKindFromRow, o as getDb } from "./db-Dts2XvLu.js";
4
- import { A as juniorConversations } from "./executor-Ck73J0wP.js";
5
- import { en as AgentDepthLimitError, hn as toolInvocationDestination, mn as actorFromRun } from "./agent-runner-DjMTPWEO.js";
6
- import { n as createAndEnqueueAgentInvocation } from "./work-yN_GAuXY.js";
2
+ import { n as botConfig } from "./config-CCPHvTqx.js";
3
+ import { O as conversationKindFromRow, o as getDb } from "./db-C1M1y-bh.js";
4
+ import { A as juniorConversations } from "./executor-DUSEwXaO.js";
5
+ import { en as AgentDepthLimitError, hn as toolInvocationDestination, mn as actorFromRun } from "./agent-runner-HoQiUKLL.js";
6
+ import { n as createAndEnqueueAgentInvocation } from "./work-EA98F0ia.js";
7
7
  import { desc, eq, sql } from "drizzle-orm";
8
8
  // src/chat/conversations/lineage.ts
9
9
  /**
@@ -1,5 +1,5 @@
1
- import { i as getChatConfig } from "./config-DvnTPCfp.js";
2
- import { h as logWarn } from "./logging-9OAq-fdg.js";
1
+ import { i as getChatConfig } from "./config-CCPHvTqx.js";
2
+ import { h as logWarn } from "./logging-D0svFM8r.js";
3
3
  import { t as ACTIVE_LOCK_TTL_MS } from "./locks-D-0h111u.js";
4
4
  import { createCipheriv, createDecipheriv, randomBytes } from "node:crypto";
5
5
  import { createMemoryState } from "@chat-adapter/state-memory";