@sentry/junior 0.178.0 → 0.180.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 (138) hide show
  1. package/dist/{agent-hooks-PBT4NNBV.js → agent-hooks-DKDDRKZA.js} +16 -18
  2. package/dist/api/schema.js +0 -1
  3. package/dist/api.js +401 -366
  4. package/dist/app.d.ts +4 -0
  5. package/dist/app.js +783 -1367
  6. package/dist/catalog-runtime-WXKGUF3W.js +14 -0
  7. package/dist/chat/agent/sandbox.d.ts +0 -2
  8. package/dist/chat/api-turns/routing.d.ts +4 -0
  9. package/dist/chat/api-turns/work.d.ts +5 -0
  10. package/dist/chat/config.d.ts +5 -2
  11. package/dist/chat/configuration/defaults.d.ts +1 -1
  12. package/dist/chat/conversations/projection.d.ts +6 -4
  13. package/dist/chat/ingress/message-router.d.ts +3 -0
  14. package/dist/chat/model-profile.d.ts +8 -10
  15. package/dist/chat/pi/conversation-events.d.ts +3 -2
  16. package/dist/chat/plugins/task-queue.d.ts +40 -3
  17. package/dist/chat/plugins/task-runner.d.ts +1 -1
  18. package/dist/chat/queue/callback.d.ts +26 -0
  19. package/dist/chat/queue/sign.d.ts +30 -0
  20. package/dist/chat/sandbox/sandbox.d.ts +0 -2
  21. package/dist/chat/sandbox/session.d.ts +0 -2
  22. package/dist/chat/sandbox/skill-sync.d.ts +1 -1
  23. package/dist/chat/sandbox/snapshot/events.d.ts +23 -0
  24. package/dist/chat/sandbox/snapshot/job-callback.d.ts +5 -0
  25. package/dist/chat/sandbox/snapshot/job-queue.d.ts +26 -0
  26. package/dist/chat/sandbox/snapshot/job-runner.d.ts +11 -0
  27. package/dist/chat/sandbox/snapshot/not-ready-error.d.ts +6 -0
  28. package/dist/chat/sandbox/snapshot/workspace.d.ts +9 -3
  29. package/dist/chat/scheduled-tasks/personal.d.ts +5 -8
  30. package/dist/chat/scheduled-tasks/runs.d.ts +49 -0
  31. package/dist/chat/scheduled-tasks/schedule-intent.d.ts +1 -1
  32. package/dist/chat/scheduled-tasks/tasks.d.ts +27 -0
  33. package/dist/chat/scheduled-tasks/tool-support.d.ts +0 -4
  34. package/dist/chat/scheduled-tasks/tools/create.d.ts +1 -1
  35. package/dist/chat/scheduled-tasks/tools/update.d.ts +1 -1
  36. package/dist/chat/scheduled-tasks/types.d.ts +127 -78
  37. package/dist/chat/services/turn-router.d.ts +4 -3
  38. package/dist/chat/task-execution/queue-signing.d.ts +10 -21
  39. package/dist/chat/task-execution/state.d.ts +48 -0
  40. package/dist/chat/task-execution/store.d.ts +28 -2
  41. package/dist/chat/task-execution/worker.d.ts +4 -1
  42. package/dist/chat/tools/handoff/tool.d.ts +1 -1
  43. package/dist/{chunk-534BO42N.js → chunk-2AYEVN7K.js} +8 -8
  44. package/dist/{chunk-D3UJTX4U.js → chunk-2YIRH4E3.js} +46 -46
  45. package/dist/{chunk-4K6VNP3S.js → chunk-3ILJBWP7.js} +35 -227
  46. package/dist/{chunk-FQ6BMP5P.js → chunk-5PUMIMNQ.js} +2724 -1257
  47. package/dist/{chunk-G3CQEUHI.js → chunk-5TUR4M3M.js} +8 -61
  48. package/dist/{chunk-6ZWRNC4D.js → chunk-6Y5B5PEX.js} +1 -1
  49. package/dist/{chunk-KEQAA42D.js → chunk-6YCEWOLO.js} +4 -4
  50. package/dist/chunk-7H2VZTWN.js +103 -0
  51. package/dist/{chunk-22T3HB44.js → chunk-CCDXTDSY.js} +8 -8
  52. package/dist/{chunk-CGA4ERJ5.js → chunk-CEMMLV5L.js} +1 -1
  53. package/dist/chunk-CK6EINVZ.js +1181 -0
  54. package/dist/{chunk-FIANEE7Z.js → chunk-CM5HNV2W.js} +6 -6
  55. package/dist/{chunk-PRDKO3QB.js → chunk-CP73FKME.js} +144 -218
  56. package/dist/{chunk-XWUJWHFD.js → chunk-DHLOGWYH.js} +36 -36
  57. package/dist/chunk-DKIJ2RP5.js +68 -0
  58. package/dist/{chunk-ABLODWPO.js → chunk-DRHEGXTZ.js} +1 -1
  59. package/dist/{chunk-OOUNJNMR.js → chunk-DWPN6SCH.js} +1 -1
  60. package/dist/chunk-EWHP2IRG.js +209 -0
  61. package/dist/{chunk-ZCHHVTMF.js → chunk-FGC3PHNH.js} +3 -3
  62. package/dist/{chunk-H6ZXBFGX.js → chunk-GA5NS74S.js} +1 -1
  63. package/dist/{chunk-BFLMRTPD.js → chunk-GPXAHUQH.js} +84 -274
  64. package/dist/chunk-GUKXEPMX.js +218 -0
  65. package/dist/{chunk-3ZZEPLLB.js → chunk-I6IFTAPF.js} +108 -76
  66. package/dist/{chunk-RGXOLPWO.js → chunk-IANUX7HX.js} +5 -5
  67. package/dist/{chunk-UMG7M32G.js → chunk-KCL6AWYW.js} +74 -68
  68. package/dist/{chunk-BUGO42R6.js → chunk-L7LTGN4Z.js} +129 -31
  69. package/dist/{chunk-QCCLDJHB.js → chunk-LGVQLNLS.js} +42 -41
  70. package/dist/chunk-M3QYTBQ6.js +55 -0
  71. package/dist/{chunk-AVRWMQ4U.js → chunk-MXEUIGHO.js} +2 -2
  72. package/dist/{chunk-M63DETLL.js → chunk-N7TMSOZH.js} +6 -6
  73. package/dist/{chunk-JVXZ3WDH.js → chunk-O4QYZTDK.js} +33 -32
  74. package/dist/chunk-PEQXYSSE.js +45 -0
  75. package/dist/{chunk-OGRD5PFM.js → chunk-QSO7B5JO.js} +1 -1
  76. package/dist/{chunk-UGWBJAGN.js → chunk-RAZG3YHC.js} +100 -79
  77. package/dist/{chunk-XCNS3CXE.js → chunk-S7YRTOSQ.js} +69 -73
  78. package/dist/{chunk-LAOP4EPL.js → chunk-SDBKZ5LV.js} +108 -5
  79. package/dist/{chunk-RE4XWXBV.js → chunk-TC5DE5KJ.js} +22 -18
  80. package/dist/{chunk-H4HBKISO.js → chunk-TXKUKMVO.js} +1 -1
  81. package/dist/chunk-U5EUCUBH.js +164 -0
  82. package/dist/{chunk-BHHWCNXI.js → chunk-VG722ONZ.js} +18 -16
  83. package/dist/{chunk-U3UDPGZG.js → chunk-VGPPWWHF.js} +16 -16
  84. package/dist/{chunk-AQHSXA3J.js → chunk-WVAMRKYG.js} +9 -54
  85. package/dist/chunk-X6GDDWQH.js +60 -0
  86. package/dist/{chunk-6OYVH66J.js → chunk-ZE2KOV3G.js} +1 -1
  87. package/dist/{chunk-IQRPDKPJ.js → chunk-ZM7ZURJS.js} +4 -3
  88. package/dist/cli/chat.js +47 -43
  89. package/dist/cli/check.js +13 -15
  90. package/dist/cli/env.js +0 -1
  91. package/dist/cli/init.js +0 -1
  92. package/dist/cli/main.js +2 -3
  93. package/dist/cli/plugins.js +18 -20
  94. package/dist/cli/run.js +0 -1
  95. package/dist/cli/snapshot-create.js +14 -16
  96. package/dist/cli/upgrade.js +16 -18
  97. package/dist/{conversation-work-KATFHLG3.js → conversation-work-VIOQ5ZF3.js} +0 -2
  98. package/dist/db/schema/scheduled-tasks.d.ts +29 -5
  99. package/dist/db/schema.d.ts +28 -4
  100. package/dist/{db-QVYOWATH.js → db-6SBHIAJK.js} +8 -10
  101. package/dist/deployment.d.ts +1 -0
  102. package/dist/{discovery-GUFTFBTL.js → discovery-DWVDM7UK.js} +1 -2
  103. package/dist/{experimental-XVDOSRBS.js → experimental-SIJSRDJD.js} +0 -1
  104. package/dist/instrumentation.js +7 -9
  105. package/dist/nitro.js +39 -13
  106. package/dist/{oauth-callback-server-PLPAFXO6.js → oauth-callback-server-WSDQPZZS.js} +34 -32
  107. package/dist/{oauth-relay-3ZU72UGL.js → oauth-relay-5XPVRPYB.js} +0 -1
  108. package/dist/{plugins-HW4VWW6G.js → plugins-YTYJMMJF.js} +1 -2
  109. package/dist/{runner-AGNEIOZS.js → runner-GWTSWESR.js} +39 -33
  110. package/dist/{sandbox-egress-signals-DXOOBSBI.js → sandbox-egress-signals-FIL7EGPR.js} +5 -6
  111. package/dist/{sentry-JMWTS32N.js → sentry-MB3NL3IR.js} +1 -2
  112. package/dist/skills-F32BPFYW.js +27 -0
  113. package/dist/spawn-X5BPP5OE.js +37 -0
  114. package/dist/task-runner-2FPBV5PP.js +32 -0
  115. package/dist/validation-62WO524A.js +17 -0
  116. package/dist/vercel.js +0 -1
  117. package/dist/version.js +1 -2
  118. package/dist/work-3C3CMZ24.js +45 -0
  119. package/dist/worker-MFAI6ZEK.js +22 -0
  120. package/package.json +7 -6
  121. package/dist/catalog-runtime-M7QGKPFZ.js +0 -16
  122. package/dist/chat/plugins/task-callback.d.ts +0 -5
  123. package/dist/chat/plugins/task-message.d.ts +0 -23
  124. package/dist/chat/plugins/task-signing.d.ts +0 -31
  125. package/dist/chat/sandbox/snapshot/waiting-error.d.ts +0 -15
  126. package/dist/chat/scheduled-tasks/store.d.ts +0 -78
  127. package/dist/chat/services/workspace-snapshot-wait.d.ts +0 -27
  128. package/dist/chunk-5I6ORJUY.js +0 -127
  129. package/dist/chunk-6GWA276C.js +0 -72
  130. package/dist/chunk-AGJ4OQ2V.js +0 -51
  131. package/dist/chunk-MLKGABMK.js +0 -9
  132. package/dist/chunk-RGV6KHDM.js +0 -1944
  133. package/dist/chunk-WR76IVA5.js +0 -130
  134. package/dist/skills-U5KQ66EM.js +0 -29
  135. package/dist/spawn-ZRYYZP2B.js +0 -37
  136. package/dist/validation-QE4U45KS.js +0 -19
  137. package/dist/work-ATAXAHJJ.js +0 -45
  138. package/dist/worker-LIL5AOER.js +0 -24
@@ -1,86 +1,135 @@
1
- /** Durable scheduled-task domain types owned by Junior core. */
2
- import type { SlackDestination, SystemActor } from "@sentry/junior-plugin-api";
3
1
  import { z } from "zod";
4
- export type ScheduledTaskStatus = "active" | "blocked" | "completed" | "deleted";
5
- export declare const scheduledTaskCredentialModeSchema: z.ZodEnum<{
2
+ declare const scheduledTaskStatusSchema: z.ZodEnum<{
3
+ completed: "completed";
4
+ blocked: "blocked";
5
+ active: "active";
6
+ deleted: "deleted";
7
+ }>;
8
+ export type ScheduledTaskStatus = z.output<typeof scheduledTaskStatusSchema>;
9
+ declare const scheduledTaskCredentialModeSchema: z.ZodEnum<{
6
10
  system: "system";
7
11
  creator: "creator";
8
12
  }>;
9
- export type ScheduledTaskCredentialMode = z.infer<typeof scheduledTaskCredentialModeSchema>;
10
- export type ScheduledRunStatus = "pending" | "running" | "completed" | "failed" | "blocked" | "skipped";
11
- export interface ScheduledTaskPrincipal {
12
- slackUserId: string;
13
- fullName?: string;
14
- userName?: string;
15
- }
16
- export type ScheduledTaskExecutionActor = SystemActor;
13
+ export type ScheduledTaskCredentialMode = z.output<typeof scheduledTaskCredentialModeSchema>;
14
+ declare const scheduledRunStatusSchema: z.ZodEnum<{
15
+ pending: "pending";
16
+ running: "running";
17
+ completed: "completed";
18
+ failed: "failed";
19
+ blocked: "blocked";
20
+ skipped: "skipped";
21
+ }>;
22
+ export type ScheduledRunStatus = z.output<typeof scheduledRunStatusSchema>;
23
+ /** Validate the current scheduled-task domain shape. */
24
+ export declare const scheduledTaskSchema: z.ZodObject<{
25
+ id: z.ZodString;
26
+ conversationAccess: z.ZodObject<{
27
+ audience: z.ZodEnum<{
28
+ channel: "channel";
29
+ direct: "direct";
30
+ group: "group";
31
+ }>;
32
+ visibility: z.ZodEnum<{
33
+ private: "private";
34
+ public: "public";
35
+ }>;
36
+ }, z.core.$strict>;
37
+ createdAtMs: z.ZodNumber;
38
+ createdBy: z.ZodObject<{
39
+ slackUserId: z.ZodString;
40
+ fullName: z.ZodOptional<z.ZodString>;
41
+ userName: z.ZodOptional<z.ZodString>;
42
+ }, z.core.$strict>;
43
+ creatorIdentityId: z.ZodString;
44
+ credentialMode: z.ZodEnum<{
45
+ system: "system";
46
+ creator: "creator";
47
+ }>;
48
+ destination: z.ZodObject<{
49
+ platform: z.ZodLiteral<"slack">;
50
+ teamId: z.ZodString;
51
+ channelId: z.ZodString;
52
+ }, z.core.$strict>;
53
+ executionActor: z.ZodOptional<z.ZodObject<{
54
+ platform: z.ZodLiteral<"system">;
55
+ name: z.ZodString;
56
+ }, z.core.$strict>>;
57
+ lastRunAtMs: z.ZodOptional<z.ZodNumber>;
58
+ nextRunAtMs: z.ZodOptional<z.ZodNumber>;
59
+ originalRequest: z.ZodOptional<z.ZodString>;
60
+ runNowAtMs: z.ZodOptional<z.ZodNumber>;
61
+ schedule: z.ZodObject<{
62
+ description: z.ZodString;
63
+ kind: z.ZodEnum<{
64
+ one_off: "one_off";
65
+ recurring: "recurring";
66
+ }>;
67
+ recurrence: z.ZodOptional<z.ZodObject<{
68
+ dayOfMonth: z.ZodOptional<z.ZodNumber>;
69
+ frequency: z.ZodEnum<{
70
+ daily: "daily";
71
+ weekly: "weekly";
72
+ monthly: "monthly";
73
+ yearly: "yearly";
74
+ }>;
75
+ interval: z.ZodNumber;
76
+ month: z.ZodOptional<z.ZodNumber>;
77
+ startDate: z.ZodString;
78
+ time: z.ZodObject<{
79
+ hour: z.ZodNumber;
80
+ minute: z.ZodNumber;
81
+ }, z.core.$strict>;
82
+ weekdays: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
83
+ }, z.core.$strict>>;
84
+ timezone: z.ZodString;
85
+ }, z.core.$strict>;
86
+ status: z.ZodEnum<{
87
+ completed: "completed";
88
+ blocked: "blocked";
89
+ active: "active";
90
+ deleted: "deleted";
91
+ }>;
92
+ statusReason: z.ZodOptional<z.ZodString>;
93
+ task: z.ZodObject<{
94
+ text: z.ZodString;
95
+ }, z.core.$strict>;
96
+ title: z.ZodOptional<z.ZodString>;
97
+ updatedAtMs: z.ZodNumber;
98
+ }, z.core.$strict>;
99
+ /** Validate the current scheduled-run domain shape. */
100
+ export declare const scheduledRunSchema: z.ZodObject<{
101
+ id: z.ZodString;
102
+ attempt: z.ZodNumber;
103
+ claimedAtMs: z.ZodNumber;
104
+ completedAtMs: z.ZodOptional<z.ZodNumber>;
105
+ dispatchId: z.ZodOptional<z.ZodString>;
106
+ errorMessage: z.ZodOptional<z.ZodString>;
107
+ resultMessageTs: z.ZodOptional<z.ZodString>;
108
+ scheduledForMs: z.ZodNumber;
109
+ startedAtMs: z.ZodOptional<z.ZodNumber>;
110
+ status: z.ZodEnum<{
111
+ pending: "pending";
112
+ running: "running";
113
+ completed: "completed";
114
+ failed: "failed";
115
+ blocked: "blocked";
116
+ skipped: "skipped";
117
+ }>;
118
+ taskId: z.ZodString;
119
+ }, z.core.$strict>;
120
+ export type ScheduledTask = z.output<typeof scheduledTaskSchema>;
121
+ export type ScheduledRun = z.output<typeof scheduledRunSchema>;
122
+ export type ScheduledTaskRecord = Omit<ScheduledTask, "title">;
123
+ export type ScheduledTaskPrincipal = ScheduledTask["createdBy"];
124
+ export type ScheduledTaskExecutionActor = NonNullable<ScheduledTask["executionActor"]>;
125
+ export type ScheduledTaskConversationAccess = ScheduledTask["conversationAccess"];
126
+ export type ScheduledTaskSchedule = ScheduledTask["schedule"];
127
+ export type ScheduledTaskRecurrence = NonNullable<ScheduledTaskSchedule["recurrence"]>;
128
+ export type ScheduledTaskSpec = ScheduledTask["task"];
129
+ export type ScheduledCalendarFrequency = ScheduledTaskRecurrence["frequency"];
130
+ export type ScheduledLocalTime = ScheduledTaskRecurrence["time"];
17
131
  export declare const SCHEDULED_TASK_SYSTEM_ACTOR: Readonly<{
18
132
  platform: "system";
19
133
  name: string;
20
134
  }>;
21
- export interface ScheduledTaskConversationAccess {
22
- audience: "direct" | "group" | "channel";
23
- visibility: "private" | "public";
24
- }
25
- export type ScheduledCalendarFrequency = "daily" | "weekly" | "monthly" | "yearly";
26
- export interface ScheduledLocalTime {
27
- hour: number;
28
- minute: number;
29
- }
30
- export interface ScheduledTaskRecurrence {
31
- dayOfMonth?: number;
32
- frequency: ScheduledCalendarFrequency;
33
- interval: number;
34
- month?: number;
35
- startDate: string;
36
- time: ScheduledLocalTime;
37
- weekdays?: number[];
38
- }
39
- export interface ScheduledTaskSchedule {
40
- description: string;
41
- timezone: string;
42
- kind: "one_off" | "recurring";
43
- recurrence?: ScheduledTaskRecurrence;
44
- }
45
- export interface ScheduledTaskSpec {
46
- text: string;
47
- }
48
- export interface ScheduledTask {
49
- id: string;
50
- createdAtMs: number;
51
- createdBy: ScheduledTaskPrincipal;
52
- /** Authoritative provider identity that created the task. */
53
- creatorIdentityId: string;
54
- conversationAccess: ScheduledTaskConversationAccess;
55
- /** Selects system credentials or task-bound creator credential delegation. */
56
- credentialMode: ScheduledTaskCredentialMode;
57
- destination: SlackDestination;
58
- executionActor?: ScheduledTaskExecutionActor;
59
- lastRunAtMs?: number;
60
- nextRunAtMs?: number;
61
- originalRequest?: string;
62
- runNowAtMs?: number;
63
- schedule: ScheduledTaskSchedule;
64
- status: ScheduledTaskStatus;
65
- statusReason?: string;
66
- task: ScheduledTaskSpec;
67
- /**
68
- * Short display title generated from the task instruction.
69
- * SQL-backed column; never stored inside the JSON record payload.
70
- */
71
- title?: string;
72
- updatedAtMs: number;
73
- }
74
- export interface ScheduledRun {
75
- id: string;
76
- attempt: number;
77
- claimedAtMs: number;
78
- completedAtMs?: number;
79
- dispatchId?: string;
80
- errorMessage?: string;
81
- resultMessageTs?: string;
82
- scheduledForMs: number;
83
- startedAtMs?: number;
84
- status: ScheduledRunStatus;
85
- taskId: string;
86
- }
135
+ export {};
@@ -2,8 +2,8 @@ import type { ThinkingLevel as AgentThinkingLevel } from "@earendil-works/pi-age
2
2
  import type { ThinkingLevel as ProviderThinkingLevel } from "@earendil-works/pi-ai";
3
3
  import { z } from "zod";
4
4
  import { type TurnReasoningLevel } from "@/chat/reasoning-level";
5
- import { type ModelProfile, type ExecutionProfileConfig } from "@/chat/model-profile";
6
- declare function createTurnRouteSchema(profiles: Readonly<Record<string, ExecutionProfileConfig>>): z.ZodObject<{
5
+ import { type ModelProfile, type ModelProfileConfig } from "@/chat/model-profile";
6
+ declare function createTurnRouteSchema(profiles: Readonly<Record<string, ModelProfileConfig>>): z.ZodObject<{
7
7
  reasoning_level: z.ZodEnum<{
8
8
  low: "low";
9
9
  medium: "medium";
@@ -49,9 +49,10 @@ export declare function selectTurnRoute(args: {
49
49
  threadId?: string;
50
50
  };
51
51
  currentTurnBlocks?: string[];
52
+ defaultProfile: ModelProfile;
52
53
  fastModelId: string;
53
54
  messageText: string;
54
- profiles: Readonly<Record<string, ExecutionProfileConfig>>;
55
+ profiles: Readonly<Record<string, ModelProfileConfig>>;
55
56
  }): Promise<TurnRoute>;
56
57
  /** Convert a routing bucket into the Pi Agent reasoning setting for a main turn. */
57
58
  export declare function toPiReasoningLevel(level: TurnRoute["reasoningLevel"]): AgentThinkingLevel | "off";
@@ -1,28 +1,17 @@
1
- import { z } from "zod";
1
+ import { type QueueVerifyResult } from "@/chat/queue/sign";
2
2
  import { type ConversationQueueMessage } from "./queue";
3
3
  export declare const CONVERSATION_WORK_QUEUE_SIGNATURE_MAX_SKEW_MS: number;
4
- declare const signedConversationQueueMessageSchema: z.ZodObject<{
5
- schemaVersion: z.ZodLiteral<2>;
6
- conversationId: z.ZodString;
7
- signature: z.ZodString;
8
- signatureVersion: z.ZodLiteral<"v2">;
9
- signedAtMs: z.ZodNumber;
10
- }, z.core.$strict>;
11
- type SignedConversationQueueMessage = z.output<typeof signedConversationQueueMessageSchema>;
12
- export type ConversationQueueMessageVerificationResult = {
13
- message: ConversationQueueMessage;
14
- status: "verified";
15
- } | {
16
- reason: "expired" | "malformed" | "signature_mismatch";
17
- status: "rejected";
18
- } | {
19
- reason: "invalid_clock" | "missing_secret";
20
- status: "unavailable";
21
- };
4
+ export type ConversationQueueMessageVerificationResult = QueueVerifyResult<ConversationQueueMessage>;
22
5
  /** Sign a conversation queue payload before it crosses the public callback route. */
23
- export declare function signConversationQueueMessage(message: ConversationQueueMessage, nowMs?: number): SignedConversationQueueMessage;
6
+ export declare function signConversationQueueMessage(message: ConversationQueueMessage, nowMs?: number): {
7
+ schemaVersion: 2;
8
+ conversationId: string;
9
+ } & {
10
+ signature: string;
11
+ signatureVersion: "v2";
12
+ signedAtMs: number;
13
+ };
24
14
  /** Explain whether a queue payload is verified, rejected, or unavailable. */
25
15
  export declare function verifyConversationQueueMessage(value: unknown, nowMs?: number): ConversationQueueMessageVerificationResult;
26
16
  /** Verify a signed conversation queue payload from the Vercel Queue callback. */
27
17
  export declare function verifySignedConversationQueueMessage(value: unknown, nowMs?: number): ConversationQueueMessage | undefined;
28
- export {};
@@ -86,6 +86,11 @@ export interface Lease {
86
86
  lastCheckInAtMs: number;
87
87
  token: string;
88
88
  }
89
+ /** Durable request to stop the current Conversation run. */
90
+ export interface ConversationStop {
91
+ inboundMessageIds: string[];
92
+ runId: string;
93
+ }
89
94
  export interface ConversationExecution {
90
95
  inboundMessageIds: string[];
91
96
  lastCheckpointAtMs?: number;
@@ -97,6 +102,7 @@ export interface ConversationExecution {
97
102
  pendingMessages: InboundMessage[];
98
103
  runId?: string;
99
104
  status: ExecutionStatus;
105
+ stop?: ConversationStop;
100
106
  updatedAtMs?: number;
101
107
  }
102
108
  export interface Conversation {
@@ -143,6 +149,26 @@ export interface AppendInboundMessageResult {
143
149
  export interface AppendAndEnqueueInboundMessageResult extends AppendInboundMessageResult {
144
150
  queueMessageId?: string;
145
151
  }
152
+ /** Result of requesting that the current Conversation run stop. */
153
+ export type StopConversationWorkResult = {
154
+ status: "no_work";
155
+ } | {
156
+ runId: string;
157
+ status: "requested";
158
+ };
159
+ /** Result of clearing one stop observed by the matching leased run. */
160
+ export interface CompleteConversationStopResult {
161
+ status: "cleared" | "lost_lease" | "none";
162
+ removedInboundMessageIds: string[];
163
+ }
164
+ /** Result of an append that rejects new work while a Conversation is runnable. */
165
+ export type AppendExclusiveInboundMessageResult = AppendInboundMessageResult | {
166
+ status: "active";
167
+ };
168
+ /** Exclusive append result with an optional queue delivery id. */
169
+ export type AppendAndEnqueueExclusiveInboundMessageResult = AppendAndEnqueueInboundMessageResult | {
170
+ status: "active";
171
+ };
146
172
  export interface RequestConversationWorkResult {
147
173
  status: "created" | "updated";
148
174
  }
@@ -168,6 +194,12 @@ export declare function appendInboundMessage(args: {
168
194
  nowMs?: number;
169
195
  state?: StateAdapter;
170
196
  }): Promise<AppendInboundMessageResult>;
197
+ /** Append only when the Conversation has no other runnable work. */
198
+ export declare function appendExclusiveInboundMessage(args: {
199
+ message: InboundMessage;
200
+ nowMs?: number;
201
+ state?: StateAdapter;
202
+ }): Promise<AppendExclusiveInboundMessageResult>;
171
203
  /** Mark a conversation runnable when there is no new mailbox message. */
172
204
  export declare function requestConversationWork(args: {
173
205
  conversationId: string;
@@ -256,6 +288,20 @@ export declare function ackMessages(args: {
256
288
  nowMs?: number;
257
289
  state?: StateAdapter;
258
290
  }): Promise<boolean>;
291
+ /** Persist a stop request for the current run without process affinity. */
292
+ export declare function stopConversationWork(args: {
293
+ conversationId: string;
294
+ nowMs?: number;
295
+ state?: StateAdapter;
296
+ }): Promise<StopConversationWorkResult>;
297
+ /** Clear one observed stop request and discard older human-facing mailbox work. */
298
+ export declare function completeConversationStop(args: {
299
+ conversationId: string;
300
+ leaseToken: string;
301
+ nowMs?: number;
302
+ runId: string;
303
+ state?: StateAdapter;
304
+ }): Promise<CompleteConversationStopResult>;
259
305
  /** Cancel human-facing pending mailbox rows without requiring a worker lease. */
260
306
  export declare function cancelHumanFacingPendingMessages(args: {
261
307
  conversationId: string;
@@ -301,6 +347,8 @@ export declare function completeConversationWork(args: {
301
347
  leaseToken: string;
302
348
  madeProgress?: boolean;
303
349
  nowMs?: number;
350
+ /** Keep a raced stop runnable after a stop-aware adapter returns. */
351
+ resumeIfStopped?: boolean;
304
352
  state?: StateAdapter;
305
353
  }): Promise<"completed" | "lost_lease" | "pending">;
306
354
  /** Failure outcome: `lost_lease` (another owner took over), `recorded` (retry counted), or `skipped` (durable progress was made). */
@@ -2,8 +2,8 @@ import type { StateAdapter } from "chat";
2
2
  import type { ConversationStore } from "@/chat/conversations/store";
3
3
  import { type ConversationWorkQueue } from "./queue";
4
4
  import * as workState from "./state";
5
- export { CONVERSATION_ACTIVE_INDEX_KEY, CONVERSATION_BY_ACTIVITY_INDEX_KEY, CONVERSATION_WORK_CHECK_IN_INTERVAL_MS, CONVERSATION_WORK_LEASE_TTL_MS, CONVERSATION_WORK_MAX_DELIVERY_ATTEMPTS, CONVERSATION_WORK_MAX_RETRIES, CONVERSATION_WORK_STALE_ENQUEUE_MS, isFinalAttempt, isInvalidConversationRecordError, type AgentInput, type AttemptFailure, type AppendAndEnqueueInboundMessageResult, type AppendInboundMessageResult, type Conversation, type ConversationExecution, type ConversationWorkLease, type ConversationWorkState, type ExecutionStatus, type InboundMessage, type InboundMessageDelivery, type Lease, type RequestConversationWorkResult, type Source, type StartConversationWorkAcquired, type StartConversationWorkActive, type StartConversationWorkNoWork, type StartConversationWorkResult, } from "@/chat/task-execution/state";
6
- import type { AppendAndEnqueueInboundMessageResult, Conversation, InboundMessage } from "@/chat/task-execution/state";
5
+ export { CONVERSATION_ACTIVE_INDEX_KEY, CONVERSATION_BY_ACTIVITY_INDEX_KEY, CONVERSATION_WORK_CHECK_IN_INTERVAL_MS, CONVERSATION_WORK_LEASE_TTL_MS, CONVERSATION_WORK_MAX_DELIVERY_ATTEMPTS, CONVERSATION_WORK_MAX_RETRIES, CONVERSATION_WORK_STALE_ENQUEUE_MS, isFinalAttempt, isInvalidConversationRecordError, type AgentInput, type AttemptFailure, type AppendAndEnqueueInboundMessageResult, type AppendInboundMessageResult, type CompleteConversationStopResult, type Conversation, type ConversationExecution, type ConversationStop, type ConversationWorkLease, type ConversationWorkState, type ExecutionStatus, type InboundMessage, type InboundMessageDelivery, type Lease, type RequestConversationWorkResult, type Source, type StartConversationWorkAcquired, type StartConversationWorkActive, type StartConversationWorkNoWork, type StartConversationWorkResult, type StopConversationWorkResult, } from "@/chat/task-execution/state";
6
+ import type { AppendAndEnqueueExclusiveInboundMessageResult, AppendAndEnqueueInboundMessageResult, Conversation, InboundMessage } from "@/chat/task-execution/state";
7
7
  export type EnsureConversationWakeResult = {
8
8
  queueMessageId?: string;
9
9
  status: "enqueued";
@@ -63,6 +63,30 @@ export declare function appendAndEnqueueInboundMessage(args: {
63
63
  queue: ConversationWorkQueue;
64
64
  state?: StateAdapter;
65
65
  }): Promise<AppendAndEnqueueInboundMessageResult>;
66
+ /** Persist exclusive inbound work and wake its worker when admitted. */
67
+ export declare function appendAndEnqueueExclusiveInboundMessage(args: {
68
+ message: InboundMessage;
69
+ conversationStore?: ConversationStore;
70
+ nowMs?: number;
71
+ queue: ConversationWorkQueue;
72
+ state?: StateAdapter;
73
+ }): Promise<AppendAndEnqueueExclusiveInboundMessageResult>;
74
+ /** Persist a stop request for the current Conversation run. */
75
+ export declare function stopConversationWork(args: {
76
+ conversationId: string;
77
+ conversationStore?: ConversationStore;
78
+ nowMs?: number;
79
+ state?: StateAdapter;
80
+ }): Promise<workState.StopConversationWorkResult>;
81
+ /** Finish an observed stop request under the current worker lease. */
82
+ export declare function completeConversationStop(args: {
83
+ conversationId: string;
84
+ conversationStore?: ConversationStore;
85
+ leaseToken: string;
86
+ nowMs?: number;
87
+ runId: string;
88
+ state?: StateAdapter;
89
+ }): Promise<workState.CompleteConversationStopResult>;
66
90
  /** Clear an accepted wake marker after its delivery finds no runnable work. */
67
91
  export declare function clearConsumedConversationWake(args: {
68
92
  conversationId: string;
@@ -179,6 +203,8 @@ export declare function completeConversationWork(args: {
179
203
  madeProgress?: boolean;
180
204
  conversationStore?: ConversationStore;
181
205
  nowMs?: number;
206
+ /** Keep a raced stop runnable after a stop-aware adapter returns. */
207
+ resumeIfStopped?: boolean;
182
208
  state?: StateAdapter;
183
209
  }): Promise<"pending" | "completed" | "lost_lease">;
184
210
  /** Record one failed delivery attempt and dead-letter messages at their limit. */
@@ -12,6 +12,8 @@ export interface ConversationWorkerContext {
12
12
  publishExternally: boolean;
13
13
  /** True when the current execution slice must stop at its next safe boundary. */
14
14
  shouldYield(): boolean;
15
+ /** Return an AbortSignal backed by the durable Conversation stop request. */
16
+ stopSignal?(): AbortSignal;
15
17
  }
16
18
  export interface InboxAttempt {
17
19
  ack(): Promise<void>;
@@ -22,7 +24,8 @@ export interface InboxAttempt {
22
24
  messages: InboundMessage[];
23
25
  }
24
26
  export interface ConversationWorkerResult {
25
- status: "completed" | "deferred" | "lost_lease" | "yielded";
27
+ /** `paused` waits for an external wake but must resume if a stop raced it. */
28
+ status: "completed" | "deferred" | "lost_lease" | "paused" | "yielded";
26
29
  }
27
30
  export interface ConversationWorkProcessResult {
28
31
  status: "active" | "completed" | "failed" | "lost_lease" | "no_work" | "pending_requeued" | "yielded";
@@ -1,6 +1,6 @@
1
1
  import type { ToolRuntimeContext } from "@/chat/tools/types";
2
2
  export declare const HANDOFF_TOOL_NAME = "handoff";
3
- /** Create the runtime control for an in-place execution-profile switch. */
3
+ /** Create the tool that switches the active model profile. */
4
4
  export declare function createHandoffTool(handoff: NonNullable<ToolRuntimeContext["handoff"]>): Omit<import("../definition").AnyToolDefinition, "inputSchema" | "outputSchema" | "prepareArguments" | "execute"> & {
5
5
  inputSchema: import("../definition").JsonSchemaObject;
6
6
  outputSchema: import("../definition").JsonSchemaObject;
@@ -6,14 +6,14 @@ import {
6
6
  isStale,
7
7
  runNonInteractiveCommand,
8
8
  sleep
9
- } from "./chunk-AQHSXA3J.js";
9
+ } from "./chunk-WVAMRKYG.js";
10
10
  import {
11
11
  getStateAdapter
12
- } from "./chunk-H6ZXBFGX.js";
12
+ } from "./chunk-GA5NS74S.js";
13
13
  import {
14
14
  setSpanAttributes,
15
15
  withSpan
16
- } from "./chunk-UGWBJAGN.js";
16
+ } from "./chunk-RAZG3YHC.js";
17
17
 
18
18
  // src/chat/sandbox/resources.ts
19
19
  var configuredResources;
@@ -57,9 +57,9 @@ function setSnapshotSpanAttributes(snapshot) {
57
57
  "app.sandbox.source": snapshot.snapshotId ? "snapshot" : "created",
58
58
  "app.sandbox.snapshot.cache_hit": snapshot.cacheHit,
59
59
  "app.sandbox.snapshot.resolve_outcome": snapshot.resolveOutcome,
60
- ...snapshot.profileHash ? { "app.sandbox.snapshot.profile_hash": snapshot.profileHash } : {},
60
+ ...snapshot.profileHash ? { "app.sandbox.snapshot.profile_hash": snapshot.profileHash } : void 0,
61
61
  "app.sandbox.snapshot.dependency_count": snapshot.dependencyCount,
62
- ...snapshot.rebuildReason ? { "app.sandbox.snapshot.rebuild_reason": snapshot.rebuildReason } : {}
62
+ ...snapshot.rebuildReason ? { "app.sandbox.snapshot.rebuild_reason": snapshot.rebuildReason } : void 0
63
63
  });
64
64
  }
65
65
  async function trace(name, op, attributes, callback) {
@@ -283,7 +283,7 @@ async function postinstall(sandbox, commands, signal, timeoutMs) {
283
283
  pathPrefix: `${SANDBOX_WORKSPACE_ROOT}/.junior/bin:$PATH`,
284
284
  signal,
285
285
  timeoutMs,
286
- ...command.sudo !== void 0 ? { sudo: command.sudo } : {}
286
+ ...command.sudo !== void 0 ? { sudo: command.sudo } : void 0
287
287
  });
288
288
  if (result.exitCode !== 0) {
289
289
  const detail = result.stderr.trim() || result.stdout.trim() || "command failed";
@@ -460,7 +460,7 @@ async function build(value, runtime, timeoutMs, signal, prepare) {
460
460
  runtime,
461
461
  signal,
462
462
  ...sandboxCredentials ?? {},
463
- ...resources ? { resources } : {}
463
+ ...resources ? { resources } : void 0
464
464
  })
465
465
  );
466
466
  try {
@@ -680,7 +680,7 @@ async function resolve(params) {
680
680
  ),
681
681
  createdAtMs: lockResult.createdAtMs,
682
682
  buildDurationMs: lockResult.buildDurationMs,
683
- ...rebuildReason ? { rebuildReason } : {}
683
+ ...rebuildReason ? { rebuildReason } : void 0
684
684
  };
685
685
  }
686
686
  );