@sentry/junior 0.195.0 → 0.197.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 (76) hide show
  1. package/dist/{agent-hooks-VIBTIP5F.js → agent-hooks-CM4EKXL4.js} +13 -13
  2. package/dist/api/schema.js +3 -3
  3. package/dist/api.js +27 -27
  4. package/dist/app.d.ts +8 -2
  5. package/dist/app.js +102 -108
  6. package/dist/{catalog-runtime-6E6SGRZK.js → catalog-runtime-V7WGCXUD.js} +4 -4
  7. package/dist/chat/agent/handoff.d.ts +73 -0
  8. package/dist/chat/config.d.ts +2 -2
  9. package/dist/chat/model-profile.d.ts +12 -0
  10. package/dist/chat/no-reply.d.ts +4 -3
  11. package/dist/chat/services/automated-turn-limit.d.ts +13 -34
  12. package/dist/chat/services/subscribed-decision.d.ts +8 -0
  13. package/dist/chat/slack/automated-turn-limit-notice.d.ts +2 -24
  14. package/dist/chat/tools/types.d.ts +6 -2
  15. package/dist/{chunk-RKA22BQP.js → chunk-2K26W3FP.js} +1 -1
  16. package/dist/{chunk-FE3Y4KES.js → chunk-4USCVHQZ.js} +5 -5
  17. package/dist/{chunk-PFQRZ4IB.js → chunk-4UUKQB6I.js} +7 -7
  18. package/dist/{chunk-KQ3GZGBK.js → chunk-5GWV7SXF.js} +4 -11
  19. package/dist/{chunk-7PQMTME5.js → chunk-5MMQLB2B.js} +1 -1
  20. package/dist/{chunk-FPQPYJEG.js → chunk-6ZQ3CE6X.js} +1 -1
  21. package/dist/{chunk-HUQOXMDG.js → chunk-7ENMKNEK.js} +1 -1
  22. package/dist/{chunk-GFBR4S3Q.js → chunk-7NL7T6VU.js} +1 -1
  23. package/dist/{chunk-I4RH3KLJ.js → chunk-BGSAFVJO.js} +1 -1
  24. package/dist/{chunk-3VWIZVK7.js → chunk-BQ7UXCUO.js} +1 -1
  25. package/dist/{chunk-LMYRF6HX.js → chunk-BR5GNDPS.js} +85 -14
  26. package/dist/{chunk-L62JVQPL.js → chunk-C2SOA3KN.js} +3 -3
  27. package/dist/{chunk-JBSCMOLR.js → chunk-DBTI74IT.js} +6 -6
  28. package/dist/{chunk-X3PBQ4BK.js → chunk-DHWYAHAM.js} +1 -1
  29. package/dist/{chunk-RQO67SAO.js → chunk-DLXA2ZXJ.js} +2 -2
  30. package/dist/{chunk-KBPWC7NU.js → chunk-EZKISZ3Q.js} +1 -1
  31. package/dist/{chunk-6TRQLG3D.js → chunk-FCONFDZ4.js} +1 -1
  32. package/dist/{chunk-7UED4D5T.js → chunk-H6QL3FWC.js} +22 -22
  33. package/dist/{chunk-5HNXLP4W.js → chunk-HDSDOBWN.js} +1 -1
  34. package/dist/{chunk-QKHZF2LH.js → chunk-IGSAXSM7.js} +4 -4
  35. package/dist/{chunk-HE5PZAPS.js → chunk-ITP4OR7R.js} +4 -4
  36. package/dist/{chunk-QPZL2IYT.js → chunk-LBN67OZR.js} +1 -1
  37. package/dist/{chunk-R5OHONYU.js → chunk-LIK4T6CF.js} +6 -6
  38. package/dist/{chunk-RZ3PBNDV.js → chunk-LMTHFU5D.js} +7 -7
  39. package/dist/{chunk-5NR7N567.js → chunk-MJCJ62RZ.js} +4 -4
  40. package/dist/{chunk-PYTRZZ4V.js → chunk-NANQFFGO.js} +8 -8
  41. package/dist/{chunk-D4YV5TDV.js → chunk-NHJU2ZAL.js} +11 -0
  42. package/dist/{chunk-FEZIEEOP.js → chunk-O2H7JUEQ.js} +289 -334
  43. package/dist/{chunk-CE2P6TOV.js → chunk-O5RG7SKU.js} +3 -3
  44. package/dist/{chunk-7MYXH5LA.js → chunk-PF3PEX4Q.js} +1 -1
  45. package/dist/{chunk-C4NY6L7S.js → chunk-PM5WSDAD.js} +1 -1
  46. package/dist/{chunk-KUQRWV53.js → chunk-S3DRTWPX.js} +5 -5
  47. package/dist/{chunk-N67T4VY3.js → chunk-SBCWV4E4.js} +9 -9
  48. package/dist/{chunk-6GGDBXXP.js → chunk-T5MK3RUT.js} +3 -3
  49. package/dist/{chunk-OQHO62VA.js → chunk-V2IX5Q5L.js} +8 -8
  50. package/dist/{chunk-DTYOEHUP.js → chunk-VAUPAX3O.js} +4 -4
  51. package/dist/{chunk-BJZML4RT.js → chunk-WOJG25QZ.js} +9 -9
  52. package/dist/{chunk-QHJZSYKY.js → chunk-XALIC5SY.js} +2 -2
  53. package/dist/{chunk-VYDIA2UL.js → chunk-YC5CFKME.js} +2 -6
  54. package/dist/{chunk-LM7UE523.js → chunk-YLBJBBYX.js} +3 -3
  55. package/dist/{chunk-R5BGW4WR.js → chunk-YZQLXALE.js} +2 -2
  56. package/dist/cli/chat.js +35 -35
  57. package/dist/cli/check.js +5 -5
  58. package/dist/cli/plugins.js +14 -14
  59. package/dist/cli/snapshot-create.js +10 -10
  60. package/dist/cli/upgrade.js +7 -7
  61. package/dist/{db-FVCSDROR.js → db-6BD722UD.js} +8 -8
  62. package/dist/instrumentation.js +3 -3
  63. package/dist/nitro.js +7 -7
  64. package/dist/{oauth-callback-server-Z5PXTDOE.js → oauth-callback-server-P6AIT27Q.js} +31 -31
  65. package/dist/{runner-RHYU7OGV.js → runner-OKPDZOJC.js} +23 -23
  66. package/dist/{skills-QTN73DN5.js → skills-CQFX3V2I.js} +5 -5
  67. package/dist/spawn-GA5MADGU.js +42 -0
  68. package/dist/task-runner-7IIYO44C.js +36 -0
  69. package/dist/{validation-2ZK7GA6N.js → validation-STB4W433.js} +5 -5
  70. package/dist/version.js +1 -1
  71. package/dist/{work-7IBKSZRU.js → work-B7N5TEYI.js} +23 -23
  72. package/dist/worker-W6PBEHCA.js +24 -0
  73. package/package.json +5 -5
  74. package/dist/spawn-R56OWLUH.js +0 -42
  75. package/dist/task-runner-LLJZTLRP.js +0 -36
  76. package/dist/worker-RNVQVCO7.js +0 -24
@@ -1,14 +1,13 @@
1
1
  /**
2
2
  * Stops event wakes after too many automated Turns with no user Turn.
3
3
  *
4
- * Resource-event watches count on the Conversation. Event tasks and other
5
- * agent dispatches count on the Slack Destination. A finished user Turn clears
6
- * every scope that Turn can name.
4
+ * Counts on the Conversation only. A finished user Turn clears the count so
5
+ * later automated wakes can run again.
7
6
  */
8
- import type { Destination, Source } from "@sentry/junior-plugin-api";
7
+ import type { Source } from "@sentry/junior-plugin-api";
9
8
  import type { StateAdapter } from "chat";
10
9
  import { z } from "zod";
11
- /** Stored consecutive-turn limit for one Conversation or Destination. */
10
+ /** Stored consecutive automated-turn count for one Conversation. */
12
11
  declare const automatedTurnLimitStateSchema: z.ZodObject<{
13
12
  consecutiveAutomatedTurns: z.ZodNumber;
14
13
  noticePostedAtMs: z.ZodOptional<z.ZodNumber>;
@@ -16,13 +15,6 @@ declare const automatedTurnLimitStateSchema: z.ZodObject<{
16
15
  updatedAtMs: z.ZodNumber;
17
16
  }, z.core.$strict>;
18
17
  export type AutomatedTurnLimitState = z.output<typeof automatedTurnLimitStateSchema>;
19
- export type AutomatedTurnLimitScope = {
20
- kind: "conversation";
21
- conversationId: string;
22
- } | {
23
- kind: "destination";
24
- destination: Destination;
25
- };
26
18
  export type AutomatedTurnLimitDecision = {
27
19
  status: "allow";
28
20
  consecutiveAutomatedTurns: number;
@@ -35,29 +27,17 @@ export type AutomatedTurnLimitUpdate = {
35
27
  consecutiveAutomatedTurns: number;
36
28
  paused: boolean;
37
29
  shouldPostNotice: boolean;
38
- /** Where the pause notice should tell the user to reply. */
39
- resumeIn: "thread" | "channel";
40
30
  };
41
31
  /** True when this Source starts an automated Turn rather than a user Turn. */
42
32
  export declare function isAutomatedTurnSource(source: Source | undefined): boolean;
43
- /**
44
- * Scope that counts automated Turns for this Source.
45
- * Resource-event watches stay on the Conversation. Dispatches use Destination.
46
- */
47
- export declare function automatedTurnLimitScopeForSource(args: {
48
- conversationId: string;
49
- destination?: Destination;
50
- source?: Source;
51
- }): AutomatedTurnLimitScope | undefined;
52
33
  /** Plain notice when automatic updates stop until the user replies. */
53
34
  export declare function buildAutomatedTurnLimitResponse(args: {
54
35
  maxTurns: number;
55
- resumeIn?: "thread" | "channel";
56
36
  }): string;
57
- /** Read the current consecutive-turn limit for one scope. */
37
+ /** Read the consecutive automated-turn count for one Conversation. */
58
38
  export declare function getAutomatedTurnLimitState(args: {
39
+ conversationId: string;
59
40
  nowMs?: number;
60
- scope: AutomatedTurnLimitScope;
61
41
  state?: StateAdapter;
62
42
  }): Promise<AutomatedTurnLimitState>;
63
43
  /**
@@ -66,16 +46,16 @@ export declare function getAutomatedTurnLimitState(args: {
66
46
  * posts it. Clear the claim if that post fails or is skipped.
67
47
  */
68
48
  export declare function admitAutomatedTurn(args: {
49
+ conversationId: string;
69
50
  maxTurns: number;
70
51
  nowMs?: number;
71
- scope: AutomatedTurnLimitScope;
72
52
  state?: StateAdapter;
73
53
  }): Promise<AutomatedTurnLimitDecision>;
74
54
  /** Count one finished automated Turn toward the consecutive-turn limit. */
75
55
  export declare function countAutomatedTurn(args: {
56
+ conversationId: string;
76
57
  maxTurns: number;
77
58
  nowMs?: number;
78
- scope: AutomatedTurnLimitScope;
79
59
  state?: StateAdapter;
80
60
  }): Promise<AutomatedTurnLimitUpdate>;
81
61
  /**
@@ -83,25 +63,24 @@ export declare function countAutomatedTurn(args: {
83
63
  * Keeps the pause and consecutive count.
84
64
  */
85
65
  export declare function clearAutomatedTurnLimitNoticeClaim(args: {
66
+ conversationId: string;
86
67
  nowMs?: number;
87
- scope: AutomatedTurnLimitScope;
88
68
  state?: StateAdapter;
89
69
  }): Promise<void>;
90
70
  /** Clear the consecutive automated-turn count after a user-owned Turn. */
91
71
  export declare function resetAutomatedTurnLimit(args: {
72
+ conversationId: string;
92
73
  nowMs?: number;
93
- scope: AutomatedTurnLimitScope;
94
74
  state?: StateAdapter;
95
75
  }): Promise<void>;
96
76
  /**
97
- * Update consecutive automated-turn limits after one finished Turn.
77
+ * Update consecutive automated-turn counts after one finished Turn.
98
78
  *
99
- * Automated Turns count one matching scope. User Turns clear Conversation and
100
- * Destination scopes so later event wakes can run again.
79
+ * Automated Turns count on the Conversation. User Turns clear that count so
80
+ * later event wakes can run again.
101
81
  */
102
82
  export declare function recordFinishedTurnForAutomatedLimit(args: {
103
83
  conversationId: string;
104
- destination?: Destination;
105
84
  maxTurns: number;
106
85
  nowMs?: number;
107
86
  source?: Source;
@@ -37,6 +37,14 @@ declare const replyDecisionSchema: z.ZodObject<{
37
37
  confidence: z.ZodNumber;
38
38
  reason: z.ZodString;
39
39
  }, z.core.$strict>;
40
+ /**
41
+ * Return a stop decision for one message body.
42
+ * Deferred batches must call this on each body, not on joined text.
43
+ */
44
+ export declare function getThreadStopDecision(args: {
45
+ rawText: string;
46
+ text: string;
47
+ }): SubscribedDecisionResult | undefined;
40
48
  /** Fast heuristic check before the LLM classifier — skips messages directed at another party. */
41
49
  export declare function getSubscribedReplyPreflightDecision(args: {
42
50
  botUserName: string;
@@ -1,36 +1,14 @@
1
- /**
2
- * Destination-visible pause notice for the consecutive automated-turn limit.
3
- *
4
- * Best-effort: a failed post must not fail the Turn or re-enable event wakes.
5
- * The consecutive-turn limit claims the notice slot before this post. Clear that
6
- * claim when the post fails or is skipped so a later paused wake can try again.
7
- */
8
- import type { Destination } from "@sentry/junior-plugin-api";
9
- import { type AutomatedTurnLimitScope, type AutomatedTurnLimitUpdate } from "@/chat/services/automated-turn-limit";
1
+ import { type AutomatedTurnLimitUpdate } from "@/chat/services/automated-turn-limit";
10
2
  /** Post the pause notice for one Conversation Location when known. */
11
3
  export declare function postAutomatedTurnLimitNoticeForConversation(args: {
12
4
  conversationId: string;
13
5
  maxTurns: number;
14
6
  nowMs?: number;
15
- resumeIn?: "thread" | "channel";
16
- scope?: AutomatedTurnLimitScope;
17
- }): Promise<boolean>;
18
- /** Post the pause notice for one Slack Destination. */
19
- export declare function postAutomatedTurnLimitNoticeForDestination(args: {
20
- destination: Destination;
21
- maxTurns: number;
22
- nowMs?: number;
23
- resumeIn?: "thread" | "channel";
24
- scope?: AutomatedTurnLimitScope;
25
7
  threadTs?: string;
26
8
  }): Promise<boolean>;
27
- /**
28
- * Post the pause notice after a finished Turn hits the limit.
29
- * Prefer the Conversation Location so thread watches stay in-thread.
30
- */
9
+ /** Post the pause notice after a finished Turn hits the limit. */
31
10
  export declare function maybePostAutomatedTurnLimitNotice(args: {
32
11
  conversationId: string;
33
- destination?: Destination;
34
12
  maxTurns: number;
35
13
  nowMs?: number;
36
14
  threadTs?: string;
@@ -13,9 +13,13 @@ import type { SpawnAgent } from "@/chat/agent/types";
13
13
  import type { AttachmentStorage } from "@/chat/attachments/storage";
14
14
  import type { Workspace } from "@/chat/workspaces/types";
15
15
  import type { ConversationPrivacy } from "@/chat/conversation-privacy";
16
+ interface HandoffProfile {
17
+ description?: string;
18
+ name: ModelProfile;
19
+ }
16
20
  interface HandoffControl {
17
- /** Non-empty catalog of configured targets. */
18
- profiles: readonly [ModelProfile, ...ModelProfile[]];
21
+ /** Non-empty list of configured profiles. */
22
+ profiles: readonly [HandoffProfile, ...HandoffProfile[]];
19
23
  execute: (profile: ModelProfile, options: {
20
24
  signal?: AbortSignal;
21
25
  toolCallId: string;
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  createPluginCatalogRuntime
3
- } from "./chunk-X3PBQ4BK.js";
3
+ } from "./chunk-DHWYAHAM.js";
4
4
 
5
5
  // src/chat/plugins/catalog-runtime.ts
6
6
  var pluginCatalogRuntime = createPluginCatalogRuntime();
@@ -1,18 +1,18 @@
1
1
  import {
2
2
  persistConversationMessages
3
- } from "./chunk-RZ3PBNDV.js";
3
+ } from "./chunk-LMTHFU5D.js";
4
4
  import {
5
5
  JUNIOR_THREAD_STATE_TTL_MS
6
6
  } from "./chunk-3Y47VMHV.js";
7
7
  import {
8
8
  getDb
9
- } from "./chunk-KQ3GZGBK.js";
9
+ } from "./chunk-5GWV7SXF.js";
10
10
  import {
11
11
  juniorLocationConfigurations
12
- } from "./chunk-FPQPYJEG.js";
12
+ } from "./chunk-6ZQ3CE6X.js";
13
13
  import {
14
14
  getStateAdapter
15
- } from "./chunk-7MYXH5LA.js";
15
+ } from "./chunk-PF3PEX4Q.js";
16
16
  import {
17
17
  juniorDestinations
18
18
  } from "./chunk-VFUK3X5B.js";
@@ -20,7 +20,7 @@ import {
20
20
  isRecord,
21
21
  toOptionalNumber,
22
22
  toOptionalString
23
- } from "./chunk-HUQOXMDG.js";
23
+ } from "./chunk-7ENMKNEK.js";
24
24
 
25
25
  // src/chat/state/conversation.ts
26
26
  function defaultConversationState() {
@@ -5,7 +5,7 @@ import {
5
5
  getConversationEventStore,
6
6
  getDb,
7
7
  getSqlExecutor
8
- } from "./chunk-KQ3GZGBK.js";
8
+ } from "./chunk-5GWV7SXF.js";
9
9
  import {
10
10
  juniorCodeChanges,
11
11
  juniorCodeRepositories,
@@ -16,7 +16,7 @@ import {
16
16
  juniorUsers,
17
17
  juniorWorkspaceRepos,
18
18
  juniorWorkspaces
19
- } from "./chunk-FPQPYJEG.js";
19
+ } from "./chunk-6ZQ3CE6X.js";
20
20
  import {
21
21
  SANDBOX_WORKSPACE_ROOT,
22
22
  getVercelSandboxCredentials,
@@ -24,19 +24,19 @@ import {
24
24
  isSandboxMissingError,
25
25
  runNonInteractiveCommand,
26
26
  sleep
27
- } from "./chunk-LM7UE523.js";
27
+ } from "./chunk-YLBJBBYX.js";
28
28
  import {
29
29
  getStateAdapter
30
- } from "./chunk-7MYXH5LA.js";
30
+ } from "./chunk-PF3PEX4Q.js";
31
31
  import {
32
32
  botConfig,
33
33
  completeObject,
34
34
  embedTexts,
35
35
  getSlackBotToken
36
- } from "./chunk-LMYRF6HX.js";
36
+ } from "./chunk-BR5GNDPS.js";
37
37
  import {
38
38
  defaultModelId
39
- } from "./chunk-D4YV5TDV.js";
39
+ } from "./chunk-NHJU2ZAL.js";
40
40
  import {
41
41
  isActorUserId,
42
42
  parseActorUserId,
@@ -52,7 +52,7 @@ import {
52
52
  setSpanAttributes,
53
53
  setSpanStatus,
54
54
  withSpan
55
- } from "./chunk-HUQOXMDG.js";
55
+ } from "./chunk-7ENMKNEK.js";
56
56
 
57
57
  // src/chat/plugins/agent-hooks.ts
58
58
  import {
@@ -8,19 +8,19 @@ import {
8
8
  juniorConversations,
9
9
  juniorIdentities,
10
10
  juniorUsers
11
- } from "./chunk-FPQPYJEG.js";
11
+ } from "./chunk-6ZQ3CE6X.js";
12
12
  import {
13
13
  conversationEventDataSchema,
14
14
  decodeStoredConversationEvent,
15
15
  historyReplacementSchema,
16
16
  newConversationEventSchema
17
- } from "./chunk-GFBR4S3Q.js";
17
+ } from "./chunk-7NL7T6VU.js";
18
18
  import {
19
19
  juniorDestinations
20
20
  } from "./chunk-VFUK3X5B.js";
21
21
  import {
22
22
  getChatConfig
23
- } from "./chunk-LMYRF6HX.js";
23
+ } from "./chunk-BR5GNDPS.js";
24
24
  import {
25
25
  parseActorUserId,
26
26
  parseSlackChannelReferenceId,
@@ -28,7 +28,7 @@ import {
28
28
  } from "./chunk-N7TMSOZH.js";
29
29
  import {
30
30
  normalizeIdentityEmail
31
- } from "./chunk-HUQOXMDG.js";
31
+ } from "./chunk-7ENMKNEK.js";
32
32
 
33
33
  // src/chat/conversations/sql/store.ts
34
34
  import { randomUUID as randomUUID2 } from "crypto";
@@ -68,12 +68,6 @@ function sameDestination(left, right) {
68
68
  }
69
69
  return false;
70
70
  }
71
- function destinationKey(destination) {
72
- if (destination.platform === "local") {
73
- return destination.conversationId;
74
- }
75
- return `slack:${destination.teamId}:${destination.channelId}`;
76
- }
77
71
 
78
72
  // src/chat/identities/sql.ts
79
73
  import { randomUUID } from "crypto";
@@ -1842,7 +1836,6 @@ export {
1842
1836
  parseDestination,
1843
1837
  requireSlackDestination,
1844
1838
  sameDestination,
1845
- destinationKey,
1846
1839
  upsertIdentity,
1847
1840
  upsertLinkedIdentity,
1848
1841
  deleteProviderIdentityForSlackUser,
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  getConversationEventStore
3
- } from "./chunk-KQ3GZGBK.js";
3
+ } from "./chunk-5GWV7SXF.js";
4
4
 
5
5
  // src/chat/conversations/turn-lifecycle.ts
6
6
  var ConversationTurnLifecycleService = class {
@@ -4,7 +4,7 @@ import {
4
4
  } from "./chunk-VFUK3X5B.js";
5
5
  import {
6
6
  DEFAULT_SQL_STATEMENT_TIMEOUT_MS
7
- } from "./chunk-LMYRF6HX.js";
7
+ } from "./chunk-BR5GNDPS.js";
8
8
 
9
9
  // src/db/neon.ts
10
10
  import { AsyncLocalStorage } from "async_hooks";
@@ -12,7 +12,7 @@ import {
12
12
  } from "./chunk-PEQXYSSE.js";
13
13
  import {
14
14
  JUNIOR_VERSION
15
- } from "./chunk-C4NY6L7S.js";
15
+ } from "./chunk-PM5WSDAD.js";
16
16
 
17
17
  // src/deployment.ts
18
18
  var JUNIOR_HEARTBEAT_ROUTE = "/api/internal/heartbeat";
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  TURN_REASONING_LEVELS,
3
3
  modelProfileSchema
4
- } from "./chunk-D4YV5TDV.js";
4
+ } from "./chunk-NHJU2ZAL.js";
5
5
 
6
6
  // src/chat/conversations/provenance.ts
7
7
  import { actorSchema } from "@sentry/junior-plugin-api";
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  FUNCTION_TIMEOUT_BUFFER_SECONDS,
3
3
  getChatConfig
4
- } from "./chunk-LMYRF6HX.js";
4
+ } from "./chunk-BR5GNDPS.js";
5
5
 
6
6
  // src/chat/runtime/request-deadline.ts
7
7
  import { AsyncLocalStorage } from "async_hooks";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  pluginCatalogRuntime
3
- } from "./chunk-RKA22BQP.js";
3
+ } from "./chunk-2K26W3FP.js";
4
4
 
5
5
  // src/chat/plugins/validation.ts
6
6
  import { isDeepStrictEqual } from "util";
@@ -1,13 +1,14 @@
1
1
  import {
2
+ TURN_REASONING_LEVELS,
2
3
  modelProfileSchema,
3
4
  parseTurnReasoningLevel
4
- } from "./chunk-D4YV5TDV.js";
5
+ } from "./chunk-NHJU2ZAL.js";
5
6
  import {
6
7
  getCurrentConversationPrivacy,
7
8
  toCanonicalInputMessage,
8
9
  toCanonicalOutputMessage,
9
10
  toGenAiMessagesTraceAttributes
10
- } from "./chunk-KBPWC7NU.js";
11
+ } from "./chunk-EZKISZ3Q.js";
11
12
  import {
12
13
  extractGenAiUsageAttributes,
13
14
  logException,
@@ -15,7 +16,7 @@ import {
15
16
  normalizeGenAiFinishReason,
16
17
  serializeGenAiAttribute,
17
18
  withSpan
18
- } from "./chunk-HUQOXMDG.js";
19
+ } from "./chunk-7ENMKNEK.js";
19
20
 
20
21
  // src/chat/services/provider-error.ts
21
22
  var ProviderError = class extends Error {
@@ -807,33 +808,103 @@ function validateGatewayModelId(raw) {
807
808
  function validateEmbeddingModelId(raw) {
808
809
  return toOptionalTrimmed(raw);
809
810
  }
811
+ var DEFAULT_STANDARD_PROFILE_DESCRIPTION = "Use for default assistant work: lookups, explanations, ordinary tool use, short answers, and light investigation of one source. Avoid for implementation, debugging, multi-file changes, architecture decisions, or research across several systems.";
812
+ var DEFAULT_HANDOFF_PROFILE_DESCRIPTION = "Use for coding and difficult multi-step work: implementation, debugging, root-cause analysis, broad refactors, multi-file changes, architecture decisions, and research across several systems. Avoid for simple lookups, short answers, single-file reads, or ordinary tool use that the default profile can finish.";
813
+ function parseOptionalProfileDescription(rawDescription, configName, profile) {
814
+ if (rawDescription === void 0) {
815
+ return void 0;
816
+ }
817
+ if (typeof rawDescription !== "string") {
818
+ throw new Error(
819
+ `${configName}.${profile}.description must be a string when set`
820
+ );
821
+ }
822
+ const description = toOptionalTrimmed(rawDescription);
823
+ if (!description) {
824
+ throw new Error(
825
+ `${configName}.${profile}.description must not be empty when set`
826
+ );
827
+ }
828
+ return description;
829
+ }
830
+ function parseOptionalProfileReasoningLevel(rawReasoningLevel, configName, profile) {
831
+ if (rawReasoningLevel === void 0) {
832
+ return void 0;
833
+ }
834
+ try {
835
+ return parseTurnReasoningLevel(rawReasoningLevel);
836
+ } catch {
837
+ throw new Error(
838
+ `${configName}.${profile}.reasoningLevel must be one of ${TURN_REASONING_LEVELS.join(", ")}`
839
+ );
840
+ }
841
+ }
842
+ function parseProfileConfig(rawProfile, configName, profile) {
843
+ if (typeof rawProfile === "string") {
844
+ const modelId2 = validateGatewayModelId(rawProfile);
845
+ if (!modelId2) {
846
+ throw new Error(`${configName}.${profile} must not be empty`);
847
+ }
848
+ return { modelId: modelId2 };
849
+ }
850
+ if (!rawProfile || typeof rawProfile !== "object" || Array.isArray(rawProfile)) {
851
+ throw new Error(
852
+ `${configName}.${profile} must be a model id string or an object with modelId`
853
+ );
854
+ }
855
+ const rawModelId = rawProfile.modelId;
856
+ if (typeof rawModelId !== "string") {
857
+ throw new Error(
858
+ `${configName}.${profile}.modelId must be a model id string`
859
+ );
860
+ }
861
+ const modelId = validateGatewayModelId(rawModelId);
862
+ if (!modelId) {
863
+ throw new Error(`${configName}.${profile}.modelId must not be empty`);
864
+ }
865
+ const description = parseOptionalProfileDescription(
866
+ rawProfile.description,
867
+ configName,
868
+ profile
869
+ );
870
+ const reasoningLevel = parseOptionalProfileReasoningLevel(
871
+ rawProfile.reasoningLevel,
872
+ configName,
873
+ profile
874
+ );
875
+ return {
876
+ modelId,
877
+ ...description ? { description } : void 0,
878
+ ...reasoningLevel ? { reasoningLevel } : void 0
879
+ };
880
+ }
810
881
  function parseProfileMap(rawProfiles, configName) {
811
882
  if (!rawProfiles || typeof rawProfiles !== "object" || Array.isArray(rawProfiles)) {
812
883
  const objectType = configName === "AI_MODEL_PROFILES" ? "a JSON object" : "an object";
813
884
  throw new Error(`${configName} must be ${objectType}`);
814
885
  }
815
886
  const profiles = {};
816
- for (const [profile, rawModelId] of Object.entries(rawProfiles)) {
887
+ for (const [profile, rawProfile] of Object.entries(rawProfiles)) {
817
888
  if (!modelProfileSchema.safeParse(profile).success) {
818
889
  throw new Error(
819
890
  `${configName} profile "${profile}" must match ^[a-z][a-z0-9_-]*$`
820
891
  );
821
892
  }
822
- if (typeof rawModelId !== "string") {
823
- throw new Error(`${configName}.${profile} must be a model id string`);
824
- }
825
- const modelId = validateGatewayModelId(rawModelId);
826
- if (!modelId) {
827
- throw new Error(`${configName}.${profile} must not be empty`);
828
- }
829
- profiles[profile] = { modelId };
893
+ profiles[profile] = parseProfileConfig(rawProfile, configName, profile);
830
894
  }
831
895
  return profiles;
832
896
  }
833
897
  function parseProfiles(rawValue, standardModelId, handoffModelId) {
834
898
  const profiles = {
835
- standard: { modelId: standardModelId },
836
- handoff: { modelId: handoffModelId, reasoningLevel: "high" }
899
+ standard: {
900
+ modelId: standardModelId,
901
+ description: DEFAULT_STANDARD_PROFILE_DESCRIPTION
902
+ },
903
+ handoff: {
904
+ modelId: handoffModelId,
905
+ description: DEFAULT_HANDOFF_PROFILE_DESCRIPTION,
906
+ reasoningLevel: "high"
907
+ }
837
908
  };
838
909
  const trimmed = toOptionalTrimmed(rawValue);
839
910
  if (trimmed === void 0) {
@@ -6,14 +6,14 @@ import {
6
6
  isStale,
7
7
  runNonInteractiveCommand,
8
8
  sleep
9
- } from "./chunk-LM7UE523.js";
9
+ } from "./chunk-YLBJBBYX.js";
10
10
  import {
11
11
  getStateAdapter
12
- } from "./chunk-7MYXH5LA.js";
12
+ } from "./chunk-PF3PEX4Q.js";
13
13
  import {
14
14
  setSpanAttributes,
15
15
  withSpan
16
- } from "./chunk-HUQOXMDG.js";
16
+ } from "./chunk-7ENMKNEK.js";
17
17
 
18
18
  // src/chat/sandbox/resources.ts
19
19
  var configuredResources;
@@ -7,23 +7,23 @@ import {
7
7
  import {
8
8
  formatProviderLabel,
9
9
  startOAuthFlow
10
- } from "./chunk-R5OHONYU.js";
10
+ } from "./chunk-LIK4T6CF.js";
11
11
  import {
12
12
  abandonReplacedPendingAuth,
13
13
  canReusePendingAuthLink
14
- } from "./chunk-VYDIA2UL.js";
14
+ } from "./chunk-YC5CFKME.js";
15
15
  import {
16
16
  recordAuthorizationRequested
17
- } from "./chunk-RZ3PBNDV.js";
17
+ } from "./chunk-LMTHFU5D.js";
18
18
  import {
19
19
  AGENT_INVOCATION_MAILBOX_STATUSES
20
- } from "./chunk-FPQPYJEG.js";
20
+ } from "./chunk-6ZQ3CE6X.js";
21
21
  import {
22
22
  TURN_REASONING_LEVELS
23
- } from "./chunk-D4YV5TDV.js";
23
+ } from "./chunk-NHJU2ZAL.js";
24
24
  import {
25
25
  pluginCatalogRuntime
26
- } from "./chunk-RKA22BQP.js";
26
+ } from "./chunk-2K26W3FP.js";
27
27
  import {
28
28
  credentialContextSchema
29
29
  } from "./chunk-CEMMLV5L.js";
@@ -12,7 +12,7 @@ import {
12
12
  logInfo,
13
13
  logWarn,
14
14
  setSpanAttributes
15
- } from "./chunk-HUQOXMDG.js";
15
+ } from "./chunk-7ENMKNEK.js";
16
16
 
17
17
  // src/chat/plugins/manifest.ts
18
18
  import { z } from "zod";
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  pluginCatalogRuntime
3
- } from "./chunk-RKA22BQP.js";
3
+ } from "./chunk-2K26W3FP.js";
4
4
  import {
5
5
  skillRoots
6
6
  } from "./chunk-TXKUKMVO.js";
7
7
  import {
8
8
  logWarn
9
- } from "./chunk-HUQOXMDG.js";
9
+ } from "./chunk-7ENMKNEK.js";
10
10
 
11
11
  // src/chat/skills.ts
12
12
  import fs from "fs/promises";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  logWarn
3
- } from "./chunk-HUQOXMDG.js";
3
+ } from "./chunk-7ENMKNEK.js";
4
4
 
5
5
  // src/chat/conversation-privacy.ts
6
6
  import { AsyncLocalStorage } from "async_hooks";
@@ -5,7 +5,7 @@ import {
5
5
  } from "./chunk-N7TMSOZH.js";
6
6
  import {
7
7
  toOptionalString
8
- } from "./chunk-HUQOXMDG.js";
8
+ } from "./chunk-7ENMKNEK.js";
9
9
 
10
10
  // src/chat/slack/context.ts
11
11
  import { z } from "zod";