@sentry/junior 0.186.0 → 0.188.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.
- package/dist/{agent-hooks-4B3Z4WRK.js → agent-hooks-5RQEVLQD.js} +11 -11
- package/dist/api.js +32 -32
- package/dist/app.js +67 -91
- package/dist/{catalog-runtime-AFJCAOHC.js → catalog-runtime-L4A6BJ3U.js} +4 -4
- package/dist/chat/agent/types.d.ts +16 -17
- package/dist/chat/agent-invocations/types.d.ts +72 -0
- package/dist/chat/api-turns/{accepted-reply.d.ts → assistant-message.d.ts} +3 -2
- package/dist/chat/api-turns/cancellation.d.ts +0 -1
- package/dist/chat/api-turns/mailbox-input.d.ts +0 -3
- package/dist/chat/api-turns/routing.d.ts +22 -21
- package/dist/chat/api-turns/work.d.ts +2 -2
- package/dist/chat/conversations/location.d.ts +4 -9
- package/dist/chat/conversations/store.d.ts +17 -7
- package/dist/chat/event-tasks/tool-support.d.ts +6 -0
- package/dist/chat/resource-events/actor.d.ts +7 -0
- package/dist/chat/services/turn-session-routing.d.ts +10 -9
- package/dist/chat/task-execution/slack-resource-event.d.ts +13 -5
- package/dist/chat/task-input.d.ts +22 -0
- package/dist/{chunk-YXSBZRP7.js → chunk-32XSSFZV.js} +1 -1
- package/dist/{chunk-HKFLRIBD.js → chunk-3HEZWDS5.js} +2 -2
- package/dist/{chunk-INQHUE72.js → chunk-6FGN7ZEG.js} +6 -2
- package/dist/{chunk-TXLBLGNQ.js → chunk-6JZGXLL2.js} +5 -5
- package/dist/{chunk-H7X2G2KS.js → chunk-6YGFBU3A.js} +12 -12
- package/dist/{chunk-MCLWOBPN.js → chunk-AW77HH54.js} +23 -19
- package/dist/{chunk-2U7EPTRZ.js → chunk-CDSLOYOR.js} +5 -5
- package/dist/{chunk-CM6RTYSO.js → chunk-CIG6WI7Q.js} +9 -6
- package/dist/{chunk-7EOWT62G.js → chunk-CVBDVIF4.js} +1 -1
- package/dist/{chunk-QBL2AVFF.js → chunk-CZRWU4ZM.js} +2 -2
- package/dist/{chunk-GQMQCY7H.js → chunk-ERZMACYA.js} +3 -3
- package/dist/{chunk-FFYDRLXW.js → chunk-FIUCHYT6.js} +1 -1
- package/dist/{chunk-VQIWBJOP.js → chunk-HCIVBCP5.js} +1 -1
- package/dist/{chunk-43LODHJM.js → chunk-IUUQWIG2.js} +14 -31
- package/dist/{chunk-7EU4YSZ4.js → chunk-LODJKINF.js} +140 -123
- package/dist/{chunk-2IBDVE62.js → chunk-MQDIIFZM.js} +4 -4
- package/dist/{chunk-NRMAOGRS.js → chunk-NZLZ4KYZ.js} +1 -1
- package/dist/{chunk-PZZOGHVR.js → chunk-PSHMPRIU.js} +1 -1
- package/dist/{chunk-AD64YMEC.js → chunk-Q7O74WOO.js} +2 -2
- package/dist/{chunk-JFPY6XFF.js → chunk-QCGNHSMA.js} +6 -6
- package/dist/{chunk-OZG7E22Y.js → chunk-QDHJTKPE.js} +5 -5
- package/dist/{chunk-3CVEE6LA.js → chunk-QIMN3FXL.js} +1 -1
- package/dist/{chunk-64WF2GQ3.js → chunk-QIOUTXTZ.js} +1 -1
- package/dist/{chunk-VXL2LBPK.js → chunk-QVH6FW3T.js} +13 -3
- package/dist/{chunk-GSB3NTNS.js → chunk-RMB7CERI.js} +34 -36
- package/dist/{chunk-EWRPUXE3.js → chunk-SC67CH3C.js} +18 -14
- package/dist/{chunk-VQZYIVYN.js → chunk-UVUXFRYN.js} +6 -6
- package/dist/{chunk-DHYZ4VKG.js → chunk-VFZAUQ5V.js} +97 -47
- package/dist/{chunk-QU3URVWG.js → chunk-W2DDJCPS.js} +8 -8
- package/dist/{chunk-STOCCPWH.js → chunk-W42ENMJW.js} +1 -1
- package/dist/{chunk-BRKB5R7P.js → chunk-WGZJ5SU4.js} +1 -1
- package/dist/{chunk-O6GQO7VP.js → chunk-WW2Y7JIA.js} +26 -23
- package/dist/{chunk-HWXP6RHG.js → chunk-X55FOVZO.js} +3 -3
- package/dist/{chunk-ACGWTJ74.js → chunk-XI4PVY2T.js} +3 -3
- package/dist/{chunk-CV5CPRVG.js → chunk-XJIPMHKI.js} +3 -3
- package/dist/{chunk-VOGOTEW7.js → chunk-Z5SKZE5B.js} +2 -2
- package/dist/{chunk-DOP3FIQC.js → chunk-ZX7RSBQ6.js} +1 -1
- package/dist/cli/chat.js +33 -33
- package/dist/cli/check.js +5 -5
- package/dist/cli/plugins.js +12 -12
- package/dist/cli/snapshot-create.js +9 -9
- package/dist/cli/upgrade.js +6 -6
- package/dist/db/schema/agent-invocations.d.ts +36 -0
- package/dist/db/schema.d.ts +36 -0
- package/dist/{db-7XL4UPAE.js → db-YPRZAA2T.js} +6 -6
- package/dist/instrumentation.js +3 -3
- package/dist/nitro.js +6 -6
- package/dist/{oauth-callback-server-RAOYHWDI.js → oauth-callback-server-DBBIR3XG.js} +28 -28
- package/dist/{runner-KMPBWRPM.js → runner-FKVFFPLO.js} +20 -20
- package/dist/{skills-IPCALGLQ.js → skills-4RBAZEMV.js} +5 -5
- package/dist/spawn-CO7QFCNJ.js +41 -0
- package/dist/task-runner-DUGZGI7V.js +34 -0
- package/dist/{validation-BSRCCX6N.js → validation-E6Z5LHZM.js} +5 -5
- package/dist/version.js +1 -1
- package/dist/{work-T6UFTOJY.js → work-OFTXWOK4.js} +21 -21
- package/dist/{worker-L35OG7VA.js → worker-OMWNOKTJ.js} +10 -10
- package/package.json +4 -4
- package/dist/spawn-OSOWTMBG.js +0 -41
- package/dist/task-runner-IQNBA3RY.js +0 -34
|
@@ -1,11 +1,6 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Public agent-run launch contract.
|
|
3
|
-
*
|
|
4
|
-
* Providers build one flat `AgentRun` and call `AgentRunner.run`. Delivery and
|
|
5
|
-
* durability are capabilities that affect the run. `onEvent` is best-effort UI
|
|
6
|
-
* only. Stable composition binds stream, spawn, and tracing outside this type.
|
|
7
|
-
*/
|
|
1
|
+
/** Input for one Run through Junior's agent. */
|
|
8
2
|
import type { Destination, ReplyAttribution, Source, SystemActor } from "@sentry/junior-plugin-api";
|
|
3
|
+
import type { Location } from "@/chat/conversations/location";
|
|
9
4
|
import type { LocationConfigurationService } from "@/chat/configuration/types";
|
|
10
5
|
import type { ConversationPrivacy } from "@/chat/conversation-privacy";
|
|
11
6
|
import type { CredentialContext } from "@/chat/credentials/context";
|
|
@@ -38,7 +33,8 @@ export type AgentInstructionActor = {
|
|
|
38
33
|
authorName?: string;
|
|
39
34
|
/**
|
|
40
35
|
* Slack message ts for the instruction when known.
|
|
41
|
-
* TODO:
|
|
36
|
+
* TODO(dcramer): Use a provider-neutral message id after prompt attributes no
|
|
37
|
+
* longer require the Slack timestamp.
|
|
42
38
|
*/
|
|
43
39
|
slackTs?: string;
|
|
44
40
|
};
|
|
@@ -106,7 +102,12 @@ export type AgentRunState = {
|
|
|
106
102
|
* The runner must commit the preceding agent boundary before invoking this
|
|
107
103
|
* port; the accepted reply transaction appends only this message.
|
|
108
104
|
*/
|
|
109
|
-
export type
|
|
105
|
+
export type Delivery = {
|
|
106
|
+
/** Location where this capability can send output, when outside Junior. */
|
|
107
|
+
location?: Location;
|
|
108
|
+
/** Send one accepted assistant message. */
|
|
109
|
+
send(message: AssistantMessage): void | Promise<void>;
|
|
110
|
+
};
|
|
110
111
|
/** Resume the agent turn after a transient or ambiguous delivery failure. */
|
|
111
112
|
export declare class RetryableDeliveryError extends Error {
|
|
112
113
|
constructor(cause: unknown);
|
|
@@ -153,7 +154,7 @@ export type AgentEnvironment = {
|
|
|
153
154
|
};
|
|
154
155
|
};
|
|
155
156
|
/**
|
|
156
|
-
* One
|
|
157
|
+
* One bounded attempt to advance a Turn.
|
|
157
158
|
*
|
|
158
159
|
* Build identity, instruction, history, delivery, and durability here. Bind
|
|
159
160
|
* stable model/stream composition when creating the runner, not on each run.
|
|
@@ -178,14 +179,12 @@ export type AgentRun = {
|
|
|
178
179
|
credentialContext?: CredentialContext;
|
|
179
180
|
source: Source;
|
|
180
181
|
destination: Destination;
|
|
181
|
-
/** When true, also publish assistant output to the conversation destination. */
|
|
182
182
|
publishExternally?: boolean;
|
|
183
|
-
/** Confirmed visibility of the destination where this run is delivered. */
|
|
184
183
|
destinationVisibility?: ConversationPrivacy;
|
|
185
184
|
surface?: AgentTurnSurface;
|
|
186
185
|
dispatch?: AgentDispatch;
|
|
187
186
|
/**
|
|
188
|
-
* TODO: Move ephemeral Slack credentials and conversation labels into
|
|
187
|
+
* TODO(dcramer): Move ephemeral Slack credentials and conversation labels into
|
|
189
188
|
* provider-owned tool/prompt context so the shared run edge stays neutral.
|
|
190
189
|
*/
|
|
191
190
|
slackConversation?: SlackConversationContext;
|
|
@@ -197,9 +196,9 @@ export type AgentRun = {
|
|
|
197
196
|
* Optional agent capabilities disabled for this run slice.
|
|
198
197
|
* `interactive-auth` blocks pausing to send an OAuth link; missing credentials
|
|
199
198
|
* hard-fail instead. Default is enabled when omitted.
|
|
200
|
-
* TODO(#881
|
|
201
|
-
*
|
|
202
|
-
*
|
|
199
|
+
* TODO(dcramer): Issues #881 and #883 track a path for child invocations to
|
|
200
|
+
* force interactive auth when a delegated tool requires credentials the
|
|
201
|
+
* parent can already request. Children currently disable it.
|
|
203
202
|
*/
|
|
204
203
|
disabledFeatures?: readonly AgentFeature[];
|
|
205
204
|
/** Absolute wall-clock deadline for this host request, in milliseconds. */
|
|
@@ -212,7 +211,7 @@ export type AgentRun = {
|
|
|
212
211
|
state?: AgentRunState;
|
|
213
212
|
/** Best-effort progress only. */
|
|
214
213
|
onEvent?: (event: AgentEvent) => void | Promise<void>;
|
|
215
|
-
delivery?:
|
|
214
|
+
delivery?: Delivery;
|
|
216
215
|
durability?: AgentDurability;
|
|
217
216
|
};
|
|
218
217
|
/** Return whether one optional agent capability is disabled for this run. */
|
|
@@ -107,6 +107,12 @@ export declare const agentInvocationSchema: z.ZodDiscriminatedUnion<[z.ZodObject
|
|
|
107
107
|
platform: z.ZodLiteral<"slack">;
|
|
108
108
|
teamId: z.ZodString;
|
|
109
109
|
channelId: z.ZodString;
|
|
110
|
+
location: z.ZodOptional<z.ZodObject<{
|
|
111
|
+
id: z.ZodString;
|
|
112
|
+
provider: z.ZodString;
|
|
113
|
+
tenantId: z.ZodOptional<z.ZodString>;
|
|
114
|
+
providerId: z.ZodString;
|
|
115
|
+
}, z.core.$strict>>;
|
|
110
116
|
visibility: z.ZodEnum<{
|
|
111
117
|
private: "private";
|
|
112
118
|
public: "public";
|
|
@@ -114,10 +120,22 @@ export declare const agentInvocationSchema: z.ZodDiscriminatedUnion<[z.ZodObject
|
|
|
114
120
|
messageTs: z.ZodOptional<z.ZodString>;
|
|
115
121
|
threadTs: z.ZodOptional<z.ZodString>;
|
|
116
122
|
}, z.core.$strict>, z.ZodObject<{
|
|
123
|
+
location: z.ZodOptional<z.ZodObject<{
|
|
124
|
+
id: z.ZodString;
|
|
125
|
+
provider: z.ZodString;
|
|
126
|
+
tenantId: z.ZodOptional<z.ZodString>;
|
|
127
|
+
providerId: z.ZodString;
|
|
128
|
+
}, z.core.$strict>>;
|
|
117
129
|
platform: z.ZodLiteral<"local">;
|
|
118
130
|
visibility: z.ZodLiteral<"private">;
|
|
119
131
|
conversationId: z.ZodString;
|
|
120
132
|
}, z.core.$strict>, z.ZodObject<{
|
|
133
|
+
location: z.ZodOptional<z.ZodObject<{
|
|
134
|
+
id: z.ZodString;
|
|
135
|
+
provider: z.ZodString;
|
|
136
|
+
tenantId: z.ZodOptional<z.ZodString>;
|
|
137
|
+
providerId: z.ZodString;
|
|
138
|
+
}, z.core.$strict>>;
|
|
121
139
|
platform: z.ZodLiteral<"web">;
|
|
122
140
|
visibility: z.ZodEnum<{
|
|
123
141
|
private: "private";
|
|
@@ -232,6 +250,12 @@ export declare const agentInvocationSchema: z.ZodDiscriminatedUnion<[z.ZodObject
|
|
|
232
250
|
platform: z.ZodLiteral<"slack">;
|
|
233
251
|
teamId: z.ZodString;
|
|
234
252
|
channelId: z.ZodString;
|
|
253
|
+
location: z.ZodOptional<z.ZodObject<{
|
|
254
|
+
id: z.ZodString;
|
|
255
|
+
provider: z.ZodString;
|
|
256
|
+
tenantId: z.ZodOptional<z.ZodString>;
|
|
257
|
+
providerId: z.ZodString;
|
|
258
|
+
}, z.core.$strict>>;
|
|
235
259
|
visibility: z.ZodEnum<{
|
|
236
260
|
private: "private";
|
|
237
261
|
public: "public";
|
|
@@ -239,10 +263,22 @@ export declare const agentInvocationSchema: z.ZodDiscriminatedUnion<[z.ZodObject
|
|
|
239
263
|
messageTs: z.ZodOptional<z.ZodString>;
|
|
240
264
|
threadTs: z.ZodOptional<z.ZodString>;
|
|
241
265
|
}, z.core.$strict>, z.ZodObject<{
|
|
266
|
+
location: z.ZodOptional<z.ZodObject<{
|
|
267
|
+
id: z.ZodString;
|
|
268
|
+
provider: z.ZodString;
|
|
269
|
+
tenantId: z.ZodOptional<z.ZodString>;
|
|
270
|
+
providerId: z.ZodString;
|
|
271
|
+
}, z.core.$strict>>;
|
|
242
272
|
platform: z.ZodLiteral<"local">;
|
|
243
273
|
visibility: z.ZodLiteral<"private">;
|
|
244
274
|
conversationId: z.ZodString;
|
|
245
275
|
}, z.core.$strict>, z.ZodObject<{
|
|
276
|
+
location: z.ZodOptional<z.ZodObject<{
|
|
277
|
+
id: z.ZodString;
|
|
278
|
+
provider: z.ZodString;
|
|
279
|
+
tenantId: z.ZodOptional<z.ZodString>;
|
|
280
|
+
providerId: z.ZodString;
|
|
281
|
+
}, z.core.$strict>>;
|
|
246
282
|
platform: z.ZodLiteral<"web">;
|
|
247
283
|
visibility: z.ZodEnum<{
|
|
248
284
|
private: "private";
|
|
@@ -355,6 +391,12 @@ export declare const agentInvocationSchema: z.ZodDiscriminatedUnion<[z.ZodObject
|
|
|
355
391
|
platform: z.ZodLiteral<"slack">;
|
|
356
392
|
teamId: z.ZodString;
|
|
357
393
|
channelId: z.ZodString;
|
|
394
|
+
location: z.ZodOptional<z.ZodObject<{
|
|
395
|
+
id: z.ZodString;
|
|
396
|
+
provider: z.ZodString;
|
|
397
|
+
tenantId: z.ZodOptional<z.ZodString>;
|
|
398
|
+
providerId: z.ZodString;
|
|
399
|
+
}, z.core.$strict>>;
|
|
358
400
|
visibility: z.ZodEnum<{
|
|
359
401
|
private: "private";
|
|
360
402
|
public: "public";
|
|
@@ -362,10 +404,22 @@ export declare const agentInvocationSchema: z.ZodDiscriminatedUnion<[z.ZodObject
|
|
|
362
404
|
messageTs: z.ZodOptional<z.ZodString>;
|
|
363
405
|
threadTs: z.ZodOptional<z.ZodString>;
|
|
364
406
|
}, z.core.$strict>, z.ZodObject<{
|
|
407
|
+
location: z.ZodOptional<z.ZodObject<{
|
|
408
|
+
id: z.ZodString;
|
|
409
|
+
provider: z.ZodString;
|
|
410
|
+
tenantId: z.ZodOptional<z.ZodString>;
|
|
411
|
+
providerId: z.ZodString;
|
|
412
|
+
}, z.core.$strict>>;
|
|
365
413
|
platform: z.ZodLiteral<"local">;
|
|
366
414
|
visibility: z.ZodLiteral<"private">;
|
|
367
415
|
conversationId: z.ZodString;
|
|
368
416
|
}, z.core.$strict>, z.ZodObject<{
|
|
417
|
+
location: z.ZodOptional<z.ZodObject<{
|
|
418
|
+
id: z.ZodString;
|
|
419
|
+
provider: z.ZodString;
|
|
420
|
+
tenantId: z.ZodOptional<z.ZodString>;
|
|
421
|
+
providerId: z.ZodString;
|
|
422
|
+
}, z.core.$strict>>;
|
|
369
423
|
platform: z.ZodLiteral<"web">;
|
|
370
424
|
visibility: z.ZodEnum<{
|
|
371
425
|
private: "private";
|
|
@@ -476,6 +530,12 @@ export declare const createAgentInvocationSchema: z.ZodObject<{
|
|
|
476
530
|
platform: z.ZodLiteral<"slack">;
|
|
477
531
|
teamId: z.ZodString;
|
|
478
532
|
channelId: z.ZodString;
|
|
533
|
+
location: z.ZodOptional<z.ZodObject<{
|
|
534
|
+
id: z.ZodString;
|
|
535
|
+
provider: z.ZodString;
|
|
536
|
+
tenantId: z.ZodOptional<z.ZodString>;
|
|
537
|
+
providerId: z.ZodString;
|
|
538
|
+
}, z.core.$strict>>;
|
|
479
539
|
visibility: z.ZodEnum<{
|
|
480
540
|
private: "private";
|
|
481
541
|
public: "public";
|
|
@@ -483,10 +543,22 @@ export declare const createAgentInvocationSchema: z.ZodObject<{
|
|
|
483
543
|
messageTs: z.ZodOptional<z.ZodString>;
|
|
484
544
|
threadTs: z.ZodOptional<z.ZodString>;
|
|
485
545
|
}, z.core.$strict>, z.ZodObject<{
|
|
546
|
+
location: z.ZodOptional<z.ZodObject<{
|
|
547
|
+
id: z.ZodString;
|
|
548
|
+
provider: z.ZodString;
|
|
549
|
+
tenantId: z.ZodOptional<z.ZodString>;
|
|
550
|
+
providerId: z.ZodString;
|
|
551
|
+
}, z.core.$strict>>;
|
|
486
552
|
platform: z.ZodLiteral<"local">;
|
|
487
553
|
visibility: z.ZodLiteral<"private">;
|
|
488
554
|
conversationId: z.ZodString;
|
|
489
555
|
}, z.core.$strict>, z.ZodObject<{
|
|
556
|
+
location: z.ZodOptional<z.ZodObject<{
|
|
557
|
+
id: z.ZodString;
|
|
558
|
+
provider: z.ZodString;
|
|
559
|
+
tenantId: z.ZodOptional<z.ZodString>;
|
|
560
|
+
providerId: z.ZodString;
|
|
561
|
+
}, z.core.$strict>>;
|
|
490
562
|
platform: z.ZodLiteral<"web">;
|
|
491
563
|
visibility: z.ZodEnum<{
|
|
492
564
|
private: "private";
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import type { AssistantMessage } from "@earendil-works/pi-ai";
|
|
2
2
|
import type { ThreadConversationState } from "@/chat/state/conversation";
|
|
3
|
-
/**
|
|
4
|
-
export declare function
|
|
3
|
+
/** Store one assistant Message and its Agent history. */
|
|
4
|
+
export declare function commitAssistantMessage(args: {
|
|
5
5
|
agentMessage?: AssistantMessage;
|
|
6
6
|
conversation: ThreadConversationState;
|
|
7
7
|
conversationId: string;
|
|
8
8
|
sessionId: string;
|
|
9
|
+
source?: "web";
|
|
9
10
|
text: string;
|
|
10
11
|
userMessageId: string;
|
|
11
12
|
}): Promise<void>;
|
|
@@ -12,7 +12,6 @@ export declare function createApiTurnCancellation(): ApiTurnCancellation;
|
|
|
12
12
|
/** Close one cancelled Turn without a failure reply or retry. */
|
|
13
13
|
export declare function completeCancelledApiTurn(args: {
|
|
14
14
|
acknowledge(): Promise<void>;
|
|
15
|
-
actorId: string;
|
|
16
15
|
cancellation?: ApiTurnCancellation;
|
|
17
16
|
conversation: ThreadConversationState;
|
|
18
17
|
conversationId: string;
|
|
@@ -1,7 +1,4 @@
|
|
|
1
1
|
/** Shared mailbox helpers for conversation-only turns. */
|
|
2
|
-
import type { LocalActor } from "@/chat/actor";
|
|
3
2
|
import type { InboundMessage } from "@/chat/task-execution/store";
|
|
4
3
|
/** Join non-empty mailbox texts for one conversation-only turn. */
|
|
5
4
|
export declare function joinMailboxText(messages: readonly InboundMessage[]): string;
|
|
6
|
-
/** Local actor stamped on resource-event conversation-only turns. */
|
|
7
|
-
export declare function localResourceEventActor(): LocalActor;
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
+
import { type Source } from "@sentry/junior-plugin-api";
|
|
3
|
+
import { type Actor } from "@/chat/actor";
|
|
4
|
+
import type { ConversationPrivacy } from "@/chat/conversation-privacy";
|
|
5
|
+
import type { ConversationAuthor, ConversationMessage } from "@/chat/state/conversation";
|
|
2
6
|
import type { InboundMessage } from "@/chat/task-execution/store";
|
|
3
7
|
import type { ConversationWorkerContext } from "@/chat/task-execution/worker";
|
|
4
8
|
declare const apiTurnMailboxMetadataSchema: z.ZodObject<{
|
|
@@ -10,37 +14,34 @@ declare const apiTurnMailboxMetadataSchema: z.ZodObject<{
|
|
|
10
14
|
messageId: z.ZodString;
|
|
11
15
|
}, z.core.$strict>;
|
|
12
16
|
export type ApiTurnMailboxMetadata = z.output<typeof apiTurnMailboxMetadataSchema>;
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
* TODO(resource-events): Remove the dedicated `resource_event` work kind once
|
|
17
|
-
* local/web destinations run plain mailbox system wakes the same way as any
|
|
18
|
-
* other deferred conversation turn (no special batch/actor fork).
|
|
19
|
-
*/
|
|
20
|
-
export type LocalResourceEventMailboxEntry = {
|
|
17
|
+
export interface TurnInput {
|
|
18
|
+
actor: Actor;
|
|
19
|
+
author: ConversationAuthor;
|
|
21
20
|
message: InboundMessage;
|
|
22
|
-
|
|
23
|
-
}
|
|
21
|
+
source: "resource_event" | "web";
|
|
22
|
+
}
|
|
23
|
+
export type TurnIdentity = Pick<TurnInput, "actor" | "author" | "source">;
|
|
24
|
+
/** Restore normalized Turn identity from one saved Message. */
|
|
25
|
+
export declare function turnIdentityFromConversationMessage(message: ConversationMessage): TurnIdentity | undefined;
|
|
26
|
+
/** Build the AgentRun Source for one Turn input. */
|
|
27
|
+
export declare function sourceFromTurnInput(args: {
|
|
28
|
+
conversationId: string;
|
|
29
|
+
source: TurnInput["source"];
|
|
30
|
+
visibility?: ConversationPrivacy;
|
|
31
|
+
}): Source;
|
|
24
32
|
/** Return the active root API Turn for one Conversation, if it has one. */
|
|
25
33
|
export declare function getActiveApiTurnId(conversationId: string): Promise<string | undefined>;
|
|
26
34
|
/** Return the idle auth-paused root API Turn for one Conversation. */
|
|
27
35
|
export declare function getAuthPausedApiTurnId(conversationId: string): Promise<string | undefined>;
|
|
28
36
|
/**
|
|
29
|
-
* Resolve conversation-only work from
|
|
37
|
+
* Resolve conversation-only work from new input or a saved Turn.
|
|
30
38
|
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
* those wakes on this runner instead of falling through to Slack.
|
|
39
|
+
* User messages from the Conversation API run here. Resource events with a
|
|
40
|
+
* local Destination run here too. Saved state identifies a resumed Turn.
|
|
34
41
|
*/
|
|
35
42
|
export declare function resolveApiTurnWork(context: ConversationWorkerContext): Promise<{
|
|
36
43
|
kind: "mailbox";
|
|
37
|
-
batch:
|
|
38
|
-
message: InboundMessage;
|
|
39
|
-
metadata: ApiTurnMailboxMetadata;
|
|
40
|
-
}>;
|
|
41
|
-
} | {
|
|
42
|
-
kind: "resource_event";
|
|
43
|
-
batch: LocalResourceEventMailboxEntry[];
|
|
44
|
+
batch: TurnInput[];
|
|
44
45
|
} | {
|
|
45
46
|
kind: "resume";
|
|
46
47
|
turnId: string;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { StateAdapter } from "chat";
|
|
2
2
|
import { type Destination } from "@sentry/junior-plugin-api";
|
|
3
3
|
import type { ConversationPrivacy } from "@/chat/conversation-privacy";
|
|
4
|
-
import type
|
|
4
|
+
import { type WebActor } from "@/chat/actor";
|
|
5
5
|
import type { ConversationStore } from "@/chat/conversations/store";
|
|
6
6
|
import type { AgentRunner } from "@/chat/runtime/agent-runner";
|
|
7
7
|
import { type InboundMessage } from "@/chat/task-execution/store";
|
|
@@ -90,7 +90,7 @@ export declare function appendAndEnqueueApiConversationMessage(input: AppendApiC
|
|
|
90
90
|
exclusive: true;
|
|
91
91
|
}): Promise<ApiConversationMessageAdmission>;
|
|
92
92
|
export declare function appendAndEnqueueApiConversationMessage(input: AppendApiConversationMessageInput, options: EnqueueOptions): Promise<ApiConversationMessageAccepted>;
|
|
93
|
-
/** Create the worker for
|
|
93
|
+
/** Create the worker for Turns that need no provider delivery. */
|
|
94
94
|
export declare function createApiTurnWorker(agentRunner: AgentRunner, cancellation?: ApiTurnCancellation): (context: ConversationWorkerContext) => Promise<ConversationWorkerResult>;
|
|
95
95
|
/** Route Conversation API work before other work. */
|
|
96
96
|
export declare function routeApiTurnWork(options: {
|
|
@@ -1,10 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
export
|
|
4
|
-
|
|
5
|
-
provider: z.ZodString;
|
|
6
|
-
tenantId: z.ZodOptional<z.ZodString>;
|
|
7
|
-
providerId: z.ZodString;
|
|
8
|
-
}, z.core.$strict>;
|
|
9
|
-
/** Validated provider location associated with a conversation. */
|
|
1
|
+
import { locationSchema } from "@sentry/junior-plugin-api";
|
|
2
|
+
import type { z } from "zod";
|
|
3
|
+
export { locationSchema };
|
|
4
|
+
/** Validated Location associated with a Conversation. */
|
|
10
5
|
export type Location = z.output<typeof locationSchema>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Destination, Source } from "@sentry/junior-plugin-api";
|
|
2
|
+
import type { Location } from "@/chat/conversations/location";
|
|
2
3
|
import type { ConversationPrivacy } from "@/chat/conversation-privacy";
|
|
3
4
|
import type { StoredSlackActor } from "@/chat/actor";
|
|
4
|
-
import type { Location } from "@/chat/conversations/location";
|
|
5
5
|
import type { SessionSource } from "@/chat/source";
|
|
6
6
|
import type { AgentTurnUsage } from "@/chat/usage";
|
|
7
7
|
export type ConversationSource = "api" | "internal" | "local" | "plugin" | "resource_event" | "scheduler" | "slack" | "web";
|
|
@@ -13,10 +13,18 @@ export interface ConversationExecution {
|
|
|
13
13
|
status: ConversationStatus;
|
|
14
14
|
updatedAtMs?: number;
|
|
15
15
|
}
|
|
16
|
-
/**
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
16
|
+
/**
|
|
17
|
+
* Durable Conversation owned by Junior.
|
|
18
|
+
*
|
|
19
|
+
* The final interface stores zero or one complete Location here. No Location
|
|
20
|
+
* means the Conversation stays in Junior's API and UI. A Location names the
|
|
21
|
+
* outside place where a provider can deliver the Conversation. Source may also
|
|
22
|
+
* contain this Location so the agent can use it. Delivery contains it when
|
|
23
|
+
* output may be sent there. Only Delivery allows output to be sent.
|
|
24
|
+
*
|
|
25
|
+
* `destination` and `sessionSource` temporarily duplicate parts of that model.
|
|
26
|
+
* Their field TODOs state when each legacy copy can be removed.
|
|
27
|
+
*/
|
|
20
28
|
export interface Conversation {
|
|
21
29
|
channelName?: string;
|
|
22
30
|
conversationId: string;
|
|
@@ -29,7 +37,9 @@ export interface Conversation {
|
|
|
29
37
|
usage?: AgentTurnUsage;
|
|
30
38
|
};
|
|
31
39
|
lastActivityAtMs: number;
|
|
32
|
-
|
|
40
|
+
/** Immutable parent Conversation. */
|
|
41
|
+
parentConversationId?: string;
|
|
42
|
+
/** Optional provider coordinates associated with this Conversation. */
|
|
33
43
|
location?: Location;
|
|
34
44
|
actor?: StoredSlackActor;
|
|
35
45
|
schemaVersion: 1;
|
|
@@ -53,7 +63,7 @@ export interface Conversation {
|
|
|
53
63
|
}
|
|
54
64
|
/** Persist and read durable conversation metadata for reporting surfaces. */
|
|
55
65
|
export interface ConversationStore {
|
|
56
|
-
/** Create one
|
|
66
|
+
/** Create one Conversation with an immutable parent. */
|
|
57
67
|
createChild(args: {
|
|
58
68
|
childConversationId: string;
|
|
59
69
|
parentConversationId: string;
|
|
@@ -97,6 +97,12 @@ export declare function requireEventTaskSlackContext(context: ToolRuntimeContext
|
|
|
97
97
|
teamId: string;
|
|
98
98
|
channelId: string;
|
|
99
99
|
visibility: "private" | "public";
|
|
100
|
+
location?: {
|
|
101
|
+
id: string;
|
|
102
|
+
provider: string;
|
|
103
|
+
providerId: string;
|
|
104
|
+
tenantId?: string | undefined;
|
|
105
|
+
} | undefined;
|
|
100
106
|
messageTs?: string | undefined;
|
|
101
107
|
threadTs?: string | undefined;
|
|
102
108
|
};
|
|
@@ -5,6 +5,13 @@
|
|
|
5
5
|
* same system input for resource-event turns.
|
|
6
6
|
*/
|
|
7
7
|
export declare const RESOURCE_EVENT_AUTHOR_ID = "UJRNEVENT";
|
|
8
|
+
/** Synthetic Message author for resource-event input. */
|
|
9
|
+
export declare const RESOURCE_EVENT_MESSAGE_AUTHOR: {
|
|
10
|
+
readonly fullName: "Junior event";
|
|
11
|
+
readonly isBot: true;
|
|
12
|
+
readonly userId: "UJRNEVENT";
|
|
13
|
+
readonly userName: "junior-event";
|
|
14
|
+
};
|
|
8
15
|
/** System execution actor for every resource-event turn. */
|
|
9
16
|
export declare const RESOURCE_EVENT_SYSTEM_ACTOR: {
|
|
10
17
|
readonly platform: "system";
|
|
@@ -1,32 +1,33 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Load
|
|
2
|
+
* Load Location, Destination, and session Source from the Conversation record.
|
|
3
3
|
*
|
|
4
|
-
* Destination is set once on the root
|
|
5
|
-
*
|
|
6
|
-
* same
|
|
4
|
+
* Destination is set once on the root Conversation. A Conversation with a
|
|
5
|
+
* parent reads through that relation. Later Turns and mailbox wakes use the
|
|
6
|
+
* same Destination so tools stay consistent for the whole Conversation.
|
|
7
7
|
*/
|
|
8
8
|
import type { Destination, Source } from "@sentry/junior-plugin-api";
|
|
9
|
+
import type { Location } from "@/chat/conversations/location";
|
|
9
10
|
import type { ConversationStore } from "@/chat/conversations/store";
|
|
10
11
|
export interface TurnSessionRouting {
|
|
11
12
|
destination: Destination;
|
|
12
|
-
|
|
13
|
+
location?: Location;
|
|
13
14
|
/** Present when the conversation already stores a session source. */
|
|
14
15
|
source?: Source;
|
|
15
16
|
}
|
|
16
|
-
/**
|
|
17
|
+
/** Conversation data with a required Destination and Source. */
|
|
17
18
|
export type RequiredTurnSessionRouting = TurnSessionRouting & {
|
|
18
19
|
source: Source;
|
|
19
20
|
};
|
|
20
21
|
/**
|
|
21
|
-
* Resolve the
|
|
22
|
+
* Resolve the Conversation's Location, Destination, and session Source.
|
|
22
23
|
*
|
|
23
|
-
*
|
|
24
|
+
* Reads parent Conversations when this Conversation has no Destination.
|
|
24
25
|
*/
|
|
25
26
|
export declare function resolveConversationRouting(args: {
|
|
26
27
|
conversationId: string;
|
|
27
28
|
conversationStore?: ConversationStore;
|
|
28
29
|
}): Promise<TurnSessionRouting | undefined>;
|
|
29
|
-
/** Require
|
|
30
|
+
/** Require the Conversation Destination and Source from SQL. */
|
|
30
31
|
export declare function resolveTurnSessionRouting(args: {
|
|
31
32
|
conversationId: string;
|
|
32
33
|
conversationStore?: ConversationStore;
|
|
@@ -16,15 +16,23 @@ import type { SlackAdapter } from "@chat-adapter/slack";
|
|
|
16
16
|
import type { Destination, SlackDestination } from "@sentry/junior-plugin-api";
|
|
17
17
|
import type { ConversationStore } from "@/chat/conversations/store";
|
|
18
18
|
import type { InboundMessage } from "@/chat/task-execution/store";
|
|
19
|
-
/**
|
|
19
|
+
/** Resolved Slack place for one plain resource-event wake, when a thread exists. */
|
|
20
|
+
export type SlackResourceEventThread = {
|
|
21
|
+
destination: SlackDestination;
|
|
22
|
+
threadTs: string;
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* Load Slack destination and threadTs for a resource-event wake.
|
|
26
|
+
*
|
|
27
|
+
* Returns undefined when the Conversation has no Slack thread. The temporary
|
|
28
|
+
* synthetic Message/Thread bridge cannot invent one; the Slack worker must drop
|
|
29
|
+
* that wake instead of retrying.
|
|
30
|
+
*/
|
|
20
31
|
export declare function resolveSlackResourceEventThread(args: {
|
|
21
32
|
conversationId: string;
|
|
22
33
|
conversationStore?: ConversationStore;
|
|
23
34
|
destination?: Destination;
|
|
24
|
-
}): Promise<
|
|
25
|
-
destination: SlackDestination;
|
|
26
|
-
threadTs: string;
|
|
27
|
-
}>;
|
|
35
|
+
}): Promise<SlackResourceEventThread | undefined>;
|
|
28
36
|
/** Whether a mailbox row is a plain resource-event wake (no Slack envelope). */
|
|
29
37
|
export declare function isPlainResourceEventRecord(record: InboundMessage): boolean;
|
|
30
38
|
/**
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Render agent input for a task run.
|
|
3
|
+
*
|
|
4
|
+
* Section order and required prose live in `chat/README.md` under Task agent
|
|
5
|
+
* input. Empty optional fields are omitted.
|
|
6
|
+
*/
|
|
7
|
+
export declare function renderTaskInput(args: {
|
|
8
|
+
/** Stored task instruction, or subscription intent. */
|
|
9
|
+
instructions: string;
|
|
10
|
+
/** Human label for the matched resource, when present. */
|
|
11
|
+
about?: string;
|
|
12
|
+
/** Plugin guidance scoped under the instructions. */
|
|
13
|
+
guidance?: string;
|
|
14
|
+
/** Trusted one-line summary, when available. */
|
|
15
|
+
trustedSummary?: string;
|
|
16
|
+
/** Structured verified fields, when available. */
|
|
17
|
+
verifiedDetails?: Record<string, unknown>;
|
|
18
|
+
/** Untrusted provider text; never treated as instructions. */
|
|
19
|
+
externalText?: string;
|
|
20
|
+
externalTextMaxLength?: number;
|
|
21
|
+
trustedSummaryMaxLength?: number;
|
|
22
|
+
}): string;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
pluginCatalogRuntime
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-NZLZ4KYZ.js";
|
|
4
4
|
import {
|
|
5
5
|
skillRoots
|
|
6
6
|
} from "./chunk-TXKUKMVO.js";
|
|
7
7
|
import {
|
|
8
8
|
logWarn
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-QIMN3FXL.js";
|
|
10
10
|
|
|
11
11
|
// src/chat/skills.ts
|
|
12
12
|
import fs from "fs/promises";
|
|
@@ -29,7 +29,9 @@ function assertRunConsistency(run) {
|
|
|
29
29
|
switch (source.platform) {
|
|
30
30
|
case "slack": {
|
|
31
31
|
if (destination.platform !== "slack") {
|
|
32
|
-
throw new TypeError(
|
|
32
|
+
throw new TypeError(
|
|
33
|
+
"Run source and destination platforms do not match"
|
|
34
|
+
);
|
|
33
35
|
}
|
|
34
36
|
if (source.teamId !== destination.teamId) {
|
|
35
37
|
throw new TypeError("Slack source and destination teams do not match");
|
|
@@ -38,7 +40,9 @@ function assertRunConsistency(run) {
|
|
|
38
40
|
}
|
|
39
41
|
case "local": {
|
|
40
42
|
if (destination.platform !== "local") {
|
|
41
|
-
throw new TypeError(
|
|
43
|
+
throw new TypeError(
|
|
44
|
+
"Run source and destination platforms do not match"
|
|
45
|
+
);
|
|
42
46
|
}
|
|
43
47
|
if (source.conversationId !== destination.conversationId) {
|
|
44
48
|
throw new TypeError(
|
|
@@ -7,23 +7,23 @@ import {
|
|
|
7
7
|
import {
|
|
8
8
|
formatProviderLabel,
|
|
9
9
|
startOAuthFlow
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-UVUXFRYN.js";
|
|
11
11
|
import {
|
|
12
12
|
abandonReplacedPendingAuth,
|
|
13
13
|
canReusePendingAuthLink
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-Z5SKZE5B.js";
|
|
15
15
|
import {
|
|
16
16
|
recordAuthorizationRequested
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-6YGFBU3A.js";
|
|
18
18
|
import {
|
|
19
19
|
AGENT_INVOCATION_MAILBOX_STATUSES
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-QVH6FW3T.js";
|
|
21
21
|
import {
|
|
22
22
|
TURN_REASONING_LEVELS
|
|
23
23
|
} from "./chunk-D4YV5TDV.js";
|
|
24
24
|
import {
|
|
25
25
|
pluginCatalogRuntime
|
|
26
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-NZLZ4KYZ.js";
|
|
27
27
|
import {
|
|
28
28
|
credentialContextSchema
|
|
29
29
|
} from "./chunk-CEMMLV5L.js";
|