@sentry/junior 0.185.0 → 0.187.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-NGZQLL5O.js → agent-hooks-XVAE2554.js} +11 -11
- package/dist/api/schema/conversation.d.ts +8 -0
- package/dist/api/schema.js +1 -1
- package/dist/api.js +44 -36
- package/dist/app.js +1079 -264
- package/dist/{catalog-runtime-AAEAO2RL.js → catalog-runtime-DWFAC562.js} +4 -4
- package/dist/chat/agent/types.d.ts +16 -13
- 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 +4 -0
- package/dist/chat/api-turns/routing.d.ts +23 -7
- package/dist/chat/api-turns/work.d.ts +2 -2
- package/dist/chat/conversations/location.d.ts +2 -2
- package/dist/chat/conversations/store.d.ts +13 -0
- package/dist/chat/conversations/turn-lifecycle.d.ts +2 -0
- package/dist/chat/providers/slack/runtime.d.ts +0 -2
- package/dist/chat/providers/slack/turn.d.ts +0 -2
- package/dist/chat/resource-events/actor.d.ts +14 -2
- package/dist/chat/resource-events/app-publisher.d.ts +18 -0
- package/dist/chat/resource-events/catalog.d.ts +19 -0
- package/dist/chat/resource-events/ingest.d.ts +0 -1
- package/dist/chat/resource-events/notification.d.ts +28 -3
- package/dist/chat/resource-events/runtime-catalog.d.ts +7 -2
- package/dist/chat/resource-events/store.d.ts +1 -13
- package/dist/chat/resource-events/workspace.d.ts +7 -3
- package/dist/chat/sandbox/egress/credentials.d.ts +5 -4
- package/dist/chat/sandbox/egress/session.d.ts +9 -9
- package/dist/chat/sandbox/errors.d.ts +1 -1
- package/dist/chat/sandbox/ref.d.ts +1 -1
- package/dist/chat/sandbox/snapshot/events.d.ts +8 -1
- package/dist/chat/sandbox/snapshot/not-ready-error.d.ts +6 -1
- package/dist/chat/sentry-links.d.ts +2 -0
- package/dist/chat/services/turn-session-routing.d.ts +23 -7
- package/dist/chat/task-execution/slack-resource-event.d.ts +47 -0
- package/dist/chat/task-execution/slack-work.d.ts +0 -21
- package/dist/chat/task-input.d.ts +22 -0
- package/dist/chat/tools/event-tasks.d.ts +1 -1
- package/dist/chat/tools/resource-events.d.ts +1 -1
- package/dist/{chunk-Y5G23T2D.js → chunk-27T5HZHO.js} +91 -7
- package/dist/{chunk-TVVAMOLS.js → chunk-2VUDJGB6.js} +2 -2
- package/dist/{chunk-X7NCJQAA.js → chunk-4A2R3AQB.js} +1 -1
- package/dist/{chunk-MWOH6CIK.js → chunk-4YD3DET6.js} +278 -116
- package/dist/{chunk-INQHUE72.js → chunk-6FGN7ZEG.js} +6 -2
- package/dist/{chunk-ZKKGFUWM.js → chunk-6FKNNUSN.js} +6 -6
- package/dist/{chunk-OMQ2J6F6.js → chunk-6YCIYOVA.js} +1 -1
- package/dist/{chunk-7GAP2XG4.js → chunk-7LRRVMPH.js} +1 -1
- package/dist/{chunk-4HA36IWS.js → chunk-BITZUBPJ.js} +8 -8
- package/dist/{chunk-QCT4226Q.js → chunk-D3GDGREI.js} +3 -3
- package/dist/{chunk-WLKWN4CD.js → chunk-D5BWM37G.js} +8 -5
- package/dist/{chunk-VH4IU3UC.js → chunk-DUE4EUNL.js} +19 -45
- package/dist/{chunk-DAPC2HTM.js → chunk-EIWYZXSM.js} +5 -5
- package/dist/{chunk-LVK4WJKM.js → chunk-HXR3FHTE.js} +13 -3
- package/dist/{chunk-UUULGCKK.js → chunk-ITLYUKGZ.js} +14 -4
- package/dist/{chunk-FTVMXDNN.js → chunk-JCRXXEMC.js} +1 -1
- package/dist/{chunk-EJYP3NQ4.js → chunk-JZPDYKRG.js} +37 -3
- package/dist/{chunk-HJPC32TQ.js → chunk-KRYJ5VOD.js} +20 -14
- package/dist/{chunk-QZKHHG3B.js → chunk-MUPPP7A7.js} +436 -283
- package/dist/{chunk-D63IUQQE.js → chunk-NIKLTFBP.js} +12 -9
- package/dist/{chunk-U4CTAVWN.js → chunk-NU775DLU.js} +2 -2
- package/dist/{chunk-W7GCLNIV.js → chunk-OM4SFFJK.js} +3 -3
- package/dist/{chunk-X2SS6BF7.js → chunk-P2VU5JNH.js} +32 -36
- package/dist/{chunk-4K25ODAO.js → chunk-PFAZSRGR.js} +3 -1
- package/dist/{chunk-EIJCPJOY.js → chunk-Q6OCUQ7W.js} +1 -1
- package/dist/{chunk-GJTIZQGJ.js → chunk-QH3I7ZOK.js} +1 -1
- package/dist/{chunk-4S47VHJR.js → chunk-STF4GSK4.js} +3 -3
- package/dist/{chunk-C6TS47CQ.js → chunk-TQHCZXN7.js} +11 -5
- package/dist/{chunk-ZIF2S464.js → chunk-U3KMII5Y.js} +1 -1
- package/dist/{chunk-6DOAUXLD.js → chunk-U5POFCKM.js} +753 -1718
- package/dist/{chunk-PNYJOEVV.js → chunk-U6ZQHRIP.js} +1 -1
- package/dist/{chunk-LRI5IRGY.js → chunk-URZ7UD4P.js} +2 -2
- package/dist/{chunk-6Q7YZLCL.js → chunk-VC343WHM.js} +9 -1
- package/dist/{chunk-ABAX75GG.js → chunk-WKIS4VRK.js} +17 -3
- package/dist/{chunk-FFHXG2FX.js → chunk-WL3R2KTS.js} +11 -29
- package/dist/{chunk-EWEH2PJW.js → chunk-WRDW3A3D.js} +5 -5
- package/dist/{chunk-7MHNIGHP.js → chunk-X5SXFVZT.js} +1 -1
- package/dist/{chunk-ATUWN6Z3.js → chunk-Z6OHCDXP.js} +2 -2
- 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-TRJ77FAU.js → db-FBHAWVXU.js} +6 -6
- package/dist/instrumentation.js +3 -3
- package/dist/nitro.js +6 -6
- package/dist/{oauth-callback-server-XD5SV3MS.js → oauth-callback-server-5HS5ULC6.js} +28 -28
- package/dist/{runner-KFX7NG6D.js → runner-46W6NV6B.js} +19 -19
- package/dist/{skills-J2AH26CW.js → skills-TG3QC4B6.js} +5 -5
- package/dist/spawn-Y6YWBIJS.js +41 -0
- package/dist/task-runner-YSGBPN4U.js +34 -0
- package/dist/{validation-O5J4VOPF.js → validation-GMRIDBC5.js} +5 -5
- package/dist/version.js +1 -1
- package/dist/{work-ECPQTG3U.js → work-W4ULBJTU.js} +21 -21
- package/dist/{worker-RS3DXUDO.js → worker-M6NVACS2.js} +10 -10
- package/package.json +4 -4
- package/dist/spawn-VU3CSRI6.js +0 -41
- package/dist/task-runner-5JG3VIIY.js +0 -34
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Slack edge helpers for resource-event mailbox wakes.
|
|
3
|
+
*
|
|
4
|
+
* Resource-event ingest stores plain conversation mailbox input. When the
|
|
5
|
+
* conversation destination is Slack, this module builds the Message and Thread
|
|
6
|
+
* the Slack runtime needs for one turn. It does not rewrite mailbox rows.
|
|
7
|
+
*
|
|
8
|
+
* TODO(slack-runtime): Drop this module once Slack turns can start from
|
|
9
|
+
* conversation destination + session source (channel, team, threadTs, text,
|
|
10
|
+
* event metadata) without a synthetic chat Message/Thread. Resource wakes and
|
|
11
|
+
* paused resume should share that entry; handleSubscribedMessage stays for
|
|
12
|
+
* real webhook traffic only.
|
|
13
|
+
*/
|
|
14
|
+
import { Message, ThreadImpl, type StateAdapter } from "chat";
|
|
15
|
+
import type { SlackAdapter } from "@chat-adapter/slack";
|
|
16
|
+
import type { Destination, SlackDestination } from "@sentry/junior-plugin-api";
|
|
17
|
+
import type { ConversationStore } from "@/chat/conversations/store";
|
|
18
|
+
import type { InboundMessage } from "@/chat/task-execution/store";
|
|
19
|
+
/** Load Slack destination and threadTs for a resource-event wake. */
|
|
20
|
+
export declare function resolveSlackResourceEventThread(args: {
|
|
21
|
+
conversationId: string;
|
|
22
|
+
conversationStore?: ConversationStore;
|
|
23
|
+
destination?: Destination;
|
|
24
|
+
}): Promise<{
|
|
25
|
+
destination: SlackDestination;
|
|
26
|
+
threadTs: string;
|
|
27
|
+
}>;
|
|
28
|
+
/** Whether a mailbox row is a plain resource-event wake (no Slack envelope). */
|
|
29
|
+
export declare function isPlainResourceEventRecord(record: InboundMessage): boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Build a Slack Message for one plain resource-event mailbox row.
|
|
32
|
+
*
|
|
33
|
+
* Used only at the Slack worker edge. The mailbox row stays plain.
|
|
34
|
+
*/
|
|
35
|
+
export declare function buildResourceEventSlackMessage(args: {
|
|
36
|
+
channelId: string;
|
|
37
|
+
record: InboundMessage;
|
|
38
|
+
threadTs: string;
|
|
39
|
+
}): Message;
|
|
40
|
+
/** Build a ThreadImpl for a resource-event Slack turn. */
|
|
41
|
+
export declare function buildResourceEventSlackThread(args: {
|
|
42
|
+
adapter: SlackAdapter;
|
|
43
|
+
message: Message;
|
|
44
|
+
state: StateAdapter;
|
|
45
|
+
threadTs: string;
|
|
46
|
+
channelId: string;
|
|
47
|
+
}): ThreadImpl;
|
|
@@ -251,25 +251,6 @@ interface SlackInboxTurnRuntime {
|
|
|
251
251
|
handleNewMention(thread: ThreadImpl, message: Message, hooks: SlackInboxTurnOptions): Promise<void>;
|
|
252
252
|
handleSubscribedMessage(thread: ThreadImpl, message: Message, hooks: SlackInboxTurnOptions): Promise<void>;
|
|
253
253
|
}
|
|
254
|
-
interface SlackResourceEventInboundInput {
|
|
255
|
-
event: {
|
|
256
|
-
eventKey: string;
|
|
257
|
-
eventType: string;
|
|
258
|
-
occurredAtMs: number;
|
|
259
|
-
namespace: string;
|
|
260
|
-
identifier: string;
|
|
261
|
-
};
|
|
262
|
-
subscription: {
|
|
263
|
-
conversationId: string;
|
|
264
|
-
destination: {
|
|
265
|
-
channelId: string;
|
|
266
|
-
platform: "slack";
|
|
267
|
-
teamId: string;
|
|
268
|
-
};
|
|
269
|
-
id: string;
|
|
270
|
-
};
|
|
271
|
-
text: string;
|
|
272
|
-
}
|
|
273
254
|
export interface CreateSlackConversationWorkerOptions {
|
|
274
255
|
crossActorMidRunMode?: CrossActorMidRunMode;
|
|
275
256
|
getSlackAdapter: () => SlackAdapter;
|
|
@@ -281,8 +262,6 @@ export interface CreateSlackConversationWorkerOptions {
|
|
|
281
262
|
runtime: SlackInboxTurnRuntime;
|
|
282
263
|
state?: StateAdapter;
|
|
283
264
|
}
|
|
284
|
-
/** Create a Slack mailbox record for a subscribed resource-event notification. */
|
|
285
|
-
export declare function createSlackResourceEventInboundMessage(input: SlackResourceEventInboundInput): InboundMessage;
|
|
286
265
|
/** Build the worker run function for queued Slack conversation work. */
|
|
287
266
|
export declare function createSlackConversationWorker(options: CreateSlackConversationWorkerOptions): (context: ConversationWorkerContext) => Promise<ConversationWorkerResult>;
|
|
288
267
|
/** Serialize a Slack message into the generic durable conversation mailbox. */
|
|
@@ -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,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type ResourceEventCatalog } from "@/chat/resource-events/catalog";
|
|
2
2
|
import type { ToolRegistry } from "@/chat/tools/definition";
|
|
3
3
|
import type { ToolRuntimeContext } from "@/chat/tools/types";
|
|
4
4
|
/** Build event task tools for an interactive Slack actor. */
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type ResourceEventCatalog } from "@/chat/resource-events/catalog";
|
|
2
2
|
import type { ToolRegistry } from "@/chat/tools/definition";
|
|
3
3
|
import type { ToolRuntimeContext } from "@/chat/tools/types";
|
|
4
4
|
/** Build the complete resource-watch tool set for this runtime context. */
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import {
|
|
2
2
|
persistConversationMessages
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-D5BWM37G.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-
|
|
9
|
+
} from "./chunk-WKIS4VRK.js";
|
|
10
10
|
import {
|
|
11
11
|
juniorLocationConfigurations
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-HXR3FHTE.js";
|
|
13
13
|
import {
|
|
14
14
|
getStateAdapter
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-U6ZQHRIP.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-
|
|
23
|
+
} from "./chunk-6YCIYOVA.js";
|
|
24
24
|
|
|
25
25
|
// src/chat/state/conversation.ts
|
|
26
26
|
function defaultConversationState() {
|
|
@@ -372,7 +372,10 @@ function createSqlLocationConfigurationStorage(db, destination) {
|
|
|
372
372
|
};
|
|
373
373
|
}
|
|
374
374
|
function createDurableLocationConfigurationService(args) {
|
|
375
|
-
const storage = createSqlLocationConfigurationStorage(
|
|
375
|
+
const storage = createSqlLocationConfigurationStorage(
|
|
376
|
+
args.db,
|
|
377
|
+
args.destination
|
|
378
|
+
);
|
|
376
379
|
let cutover;
|
|
377
380
|
const ensureCutover = () => cutover ??= (async () => {
|
|
378
381
|
if ((await storage.list()).length > 0) {
|
|
@@ -504,6 +507,85 @@ function getLocationConfigurationService(destination) {
|
|
|
504
507
|
});
|
|
505
508
|
}
|
|
506
509
|
|
|
510
|
+
// src/chat/services/turn-session-routing.ts
|
|
511
|
+
async function loadConversationChain(conversationId, conversationStore) {
|
|
512
|
+
const chain = [];
|
|
513
|
+
const seen = /* @__PURE__ */ new Set();
|
|
514
|
+
let cursor = conversationId;
|
|
515
|
+
while (cursor && !seen.has(cursor)) {
|
|
516
|
+
seen.add(cursor);
|
|
517
|
+
const conversation = await conversationStore.get({
|
|
518
|
+
conversationId: cursor
|
|
519
|
+
});
|
|
520
|
+
if (!conversation) {
|
|
521
|
+
break;
|
|
522
|
+
}
|
|
523
|
+
chain.push(conversation);
|
|
524
|
+
cursor = conversation.lineage?.parentConversationId;
|
|
525
|
+
}
|
|
526
|
+
return chain;
|
|
527
|
+
}
|
|
528
|
+
function slackSourceForDestination(args) {
|
|
529
|
+
if (args.source?.platform !== "slack" || args.source.channelId !== args.destination.channelId) {
|
|
530
|
+
return void 0;
|
|
531
|
+
}
|
|
532
|
+
const threadTs = args.source.threadTs?.trim();
|
|
533
|
+
return {
|
|
534
|
+
platform: "slack",
|
|
535
|
+
visibility: args.source.visibility ?? "public",
|
|
536
|
+
teamId: args.source.teamId?.trim() || args.destination.teamId,
|
|
537
|
+
channelId: args.source.channelId,
|
|
538
|
+
...threadTs ? { threadTs } : void 0
|
|
539
|
+
};
|
|
540
|
+
}
|
|
541
|
+
async function resolveConversationRouting(args) {
|
|
542
|
+
const conversationStore = args.conversationStore ?? (await import("./db-FBHAWVXU.js")).getConversationStore();
|
|
543
|
+
const chain = await loadConversationChain(
|
|
544
|
+
args.conversationId,
|
|
545
|
+
conversationStore
|
|
546
|
+
);
|
|
547
|
+
let destination;
|
|
548
|
+
let source;
|
|
549
|
+
let location;
|
|
550
|
+
for (const conversation of chain) {
|
|
551
|
+
destination ??= conversation.destination;
|
|
552
|
+
source ??= conversation.sessionSource;
|
|
553
|
+
location ??= conversation.location;
|
|
554
|
+
if (destination && source) {
|
|
555
|
+
break;
|
|
556
|
+
}
|
|
557
|
+
}
|
|
558
|
+
if (!destination) {
|
|
559
|
+
return void 0;
|
|
560
|
+
}
|
|
561
|
+
if (destination.platform === "slack") {
|
|
562
|
+
const slackSource = slackSourceForDestination({ destination, source });
|
|
563
|
+
return {
|
|
564
|
+
destination,
|
|
565
|
+
...location ? { location } : void 0,
|
|
566
|
+
...slackSource ? { source: slackSource } : void 0
|
|
567
|
+
};
|
|
568
|
+
}
|
|
569
|
+
return {
|
|
570
|
+
destination,
|
|
571
|
+
...location ? { location } : void 0,
|
|
572
|
+
...source ? { source } : void 0
|
|
573
|
+
};
|
|
574
|
+
}
|
|
575
|
+
async function resolveTurnSessionRouting(args) {
|
|
576
|
+
const routing = await resolveConversationRouting(args);
|
|
577
|
+
if (!routing?.destination || !routing.source) {
|
|
578
|
+
throw new Error(
|
|
579
|
+
`Conversation ${args.conversationId} is missing durable routing metadata`
|
|
580
|
+
);
|
|
581
|
+
}
|
|
582
|
+
return {
|
|
583
|
+
destination: routing.destination,
|
|
584
|
+
source: routing.source,
|
|
585
|
+
...routing.location ? { location: routing.location } : void 0
|
|
586
|
+
};
|
|
587
|
+
}
|
|
588
|
+
|
|
507
589
|
export {
|
|
508
590
|
configValueSchema,
|
|
509
591
|
coerceThreadConversationState,
|
|
@@ -512,5 +594,7 @@ export {
|
|
|
512
594
|
persistThreadRuntimeState,
|
|
513
595
|
getPersistedThreadState,
|
|
514
596
|
persistThreadStateById,
|
|
515
|
-
getLocationConfigurationService
|
|
597
|
+
getLocationConfigurationService,
|
|
598
|
+
resolveConversationRouting,
|
|
599
|
+
resolveTurnSessionRouting
|
|
516
600
|
};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createAndEnqueueAgentInvocation
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-KRYJ5VOD.js";
|
|
4
4
|
import {
|
|
5
5
|
actorFromRun,
|
|
6
6
|
toolInvocationDestination
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-6FGN7ZEG.js";
|
|
8
8
|
|
|
9
9
|
// src/chat/agent-invocations/spawn.ts
|
|
10
10
|
function bindSpawnAgent(run, options) {
|