@sentry/junior 0.184.0 → 0.186.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-XTZVALGQ.js → agent-hooks-4B3Z4WRK.js} +13 -11
- package/dist/api/acp/schema.d.ts +20 -2
- package/dist/api/code/overview.d.ts +39 -0
- package/dist/api/locations/detail.d.ts +1 -1
- package/dist/api/people/code.d.ts +22 -0
- package/dist/api/schema/code.d.ts +46 -0
- package/dist/api/schema/conversation.d.ts +108 -20
- package/dist/api/schema/location.d.ts +1 -1
- package/dist/api/schema/person.d.ts +1 -1
- package/dist/api/schema.d.ts +4 -4
- package/dist/api/schema.js +12 -1
- package/dist/api.js +368 -78
- package/dist/app.js +1412 -538
- package/dist/{catalog-runtime-5357XR4F.js → catalog-runtime-AFJCAOHC.js} +4 -4
- package/dist/chat/api-turns/accepted-reply.d.ts +11 -0
- package/dist/chat/api-turns/cancellation.d.ts +3 -5
- package/dist/chat/api-turns/mailbox-input.d.ts +7 -0
- package/dist/chat/api-turns/routing.d.ts +18 -3
- package/dist/chat/api-turns/work.d.ts +4 -9
- package/dist/chat/app/conversation-work.d.ts +1 -1
- package/dist/chat/app/factory.d.ts +4 -0
- package/dist/chat/app/services.d.ts +4 -3
- package/dist/chat/conversations/history.d.ts +83 -9
- package/dist/chat/conversations/turn-lifecycle.d.ts +6 -3
- package/dist/chat/providers/slack/input.d.ts +32 -0
- package/dist/chat/{runtime → providers/slack}/processing-reaction.d.ts +6 -8
- package/dist/chat/{runtime/slack-resume.d.ts → providers/slack/resume.d.ts} +16 -19
- package/dist/chat/providers/slack/runtime.d.ts +1 -12
- package/dist/chat/providers/slack/turn.d.ts +10 -25
- package/dist/chat/resource-events/actor.d.ts +7 -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 +2 -14
- package/dist/chat/resource-events/tool-support.d.ts +0 -5
- package/dist/chat/resource-events/workspace.d.ts +7 -3
- package/dist/chat/runtime/turn-execution.d.ts +7 -2
- package/dist/chat/sandbox/egress/credentials.d.ts +5 -4
- package/dist/chat/sandbox/egress/session.d.ts +10 -11
- 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/scheduled-tasks/tool-support.d.ts +5 -5
- package/dist/chat/scheduled-tasks/tools/create.d.ts +2 -2
- package/dist/chat/scheduled-tasks/tools/delete.d.ts +2 -2
- package/dist/chat/scheduled-tasks/tools/list.d.ts +2 -2
- package/dist/chat/scheduled-tasks/tools/run-now.d.ts +2 -2
- package/dist/chat/scheduled-tasks/tools/update.d.ts +2 -2
- package/dist/chat/scheduled-tasks/types.d.ts +1 -1
- package/dist/chat/sentry-links.d.ts +2 -0
- package/dist/chat/services/provider-retry.d.ts +2 -0
- package/dist/chat/services/turn-failure-response.d.ts +4 -0
- package/dist/chat/services/turn-session-routing.d.ts +20 -5
- package/dist/chat/task-execution/paused-turn.d.ts +0 -2
- 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-execution/state.d.ts +2 -2
- package/dist/chat/task-execution/store.d.ts +1 -1
- package/dist/chat/task-execution/turn-wake.d.ts +12 -0
- package/dist/chat/tool-support/action-review.d.ts +1 -1
- package/dist/chat/tools/event-tasks.d.ts +1 -1
- package/dist/chat/tools/resource-events.d.ts +2 -2
- package/dist/chat/tools/search-conversation-events.d.ts +1 -1
- package/dist/chat/tools/types.d.ts +1 -1
- package/dist/chat/tools/watch-resource-events.d.ts +2 -2
- package/dist/{chunk-Z3QAXJR7.js → chunk-2IBDVE62.js} +12 -9
- package/dist/{chunk-4RONS3WR.js → chunk-2U7EPTRZ.js} +11 -5
- package/dist/{chunk-3S7ULUWW.js → chunk-3CVEE6LA.js} +1 -1
- package/dist/{chunk-IZDYYYGP.js → chunk-43LODHJM.js} +24 -384
- package/dist/{chunk-LHXIZLFF.js → chunk-64WF2GQ3.js} +1 -1
- package/dist/{chunk-YKX6MTLU.js → chunk-7EOWT62G.js} +1 -1
- package/dist/{chunk-UBOIHNTH.js → chunk-7EU4YSZ4.js} +362 -188
- package/dist/{chunk-UF6BUA5W.js → chunk-ACGWTJ74.js} +3 -3
- package/dist/{chunk-6UDPINOX.js → chunk-AD64YMEC.js} +19 -44
- package/dist/{chunk-MLSQX2EX.js → chunk-BRKB5R7P.js} +1 -1
- package/dist/{chunk-E57WPXWY.js → chunk-CM6RTYSO.js} +5 -5
- package/dist/{chunk-MAPJFUMV.js → chunk-CV5CPRVG.js} +3 -3
- package/dist/chunk-D4YV5TDV.js +45 -0
- package/dist/{chunk-HIPUIPJM.js → chunk-DHYZ4VKG.js} +383 -254
- package/dist/{chunk-DUKIDPF6.js → chunk-DOP3FIQC.js} +1 -1
- package/dist/{chunk-BT53RIGJ.js → chunk-EWRPUXE3.js} +12 -50
- package/dist/{chunk-BHYRYYLY.js → chunk-FFYDRLXW.js} +1 -1
- package/dist/chunk-GFBR4S3Q.js +406 -0
- package/dist/chunk-GQMQCY7H.js +58 -0
- package/dist/{chunk-JNO2GUDS.js → chunk-GSB3NTNS.js} +926 -1856
- package/dist/{chunk-2ZQPVX7C.js → chunk-H7X2G2KS.js} +25 -12
- package/dist/{chunk-WQFEWULF.js → chunk-HKFLRIBD.js} +2 -2
- package/dist/{chunk-SHJK75Z2.js → chunk-HWXP6RHG.js} +38 -4
- package/dist/{chunk-RF6J3DIO.js → chunk-INQHUE72.js} +84 -1
- package/dist/{chunk-4CNDGK25.js → chunk-JFPY6XFF.js} +911 -993
- package/dist/{chunk-6WGC3SO4.js → chunk-MCLWOBPN.js} +80 -18
- package/dist/{chunk-PJPRXO2T.js → chunk-NRMAOGRS.js} +1 -1
- package/dist/{chunk-ACPDVEJO.js → chunk-O6GQO7VP.js} +201 -218
- package/dist/{chunk-M5YWNMTE.js → chunk-OZG7E22Y.js} +24 -6
- package/dist/{chunk-WVIA7V3M.js → chunk-PFAZSRGR.js} +29 -1
- package/dist/{chunk-LCP4EDKR.js → chunk-PZZOGHVR.js} +14 -4
- package/dist/{chunk-QABCY33S.js → chunk-QBL2AVFF.js} +2 -2
- package/dist/{chunk-FKEZZMXS.js → chunk-QU3URVWG.js} +9 -94
- package/dist/{chunk-M3QYTBQ6.js → chunk-STOCCPWH.js} +11 -2
- package/dist/{chunk-K7VDC2QW.js → chunk-TXLBLGNQ.js} +6 -6
- package/dist/{chunk-JA43DV4Y.js → chunk-VOGOTEW7.js} +1 -1
- package/dist/{chunk-HUXFMDBZ.js → chunk-VQIWBJOP.js} +1 -1
- package/dist/{chunk-JM2COLGC.js → chunk-VQZYIVYN.js} +6 -6
- package/dist/{chunk-BCHYQS4B.js → chunk-VXL2LBPK.js} +1 -1
- package/dist/{chunk-6VOYP4M6.js → chunk-YXSBZRP7.js} +1 -1
- package/dist/cli/chat.js +35 -33
- package/dist/cli/check.js +5 -5
- package/dist/cli/plugins.js +14 -12
- package/dist/cli/snapshot-create.js +10 -9
- package/dist/cli/upgrade.js +7 -6
- package/dist/{db-MA52H62H.js → db-7XL4UPAE.js} +8 -6
- package/dist/instrumentation.js +3 -3
- package/dist/nitro.js +7 -6
- package/dist/{oauth-callback-server-DXGHKN6S.js → oauth-callback-server-RAOYHWDI.js} +30 -27
- package/dist/{runner-4IXUAQNK.js → runner-KMPBWRPM.js} +24 -19
- package/dist/{skills-X3DY7AXO.js → skills-IPCALGLQ.js} +5 -5
- package/dist/spawn-OSOWTMBG.js +41 -0
- package/dist/task-runner-IQNBA3RY.js +34 -0
- package/dist/{validation-Z6JXSTJS.js → validation-BSRCCX6N.js} +5 -5
- package/dist/version.js +1 -1
- package/dist/{work-OKWRFBDW.js → work-T6UFTOJY.js} +24 -19
- package/dist/worker-L35OG7VA.js +24 -0
- package/package.json +5 -5
- package/dist/spawn-43WGS6CH.js +0 -37
- package/dist/task-runner-VDRKITPV.js +0 -32
- package/dist/worker-B236AE72.js +0 -22
|
@@ -1,39 +1,24 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Add Slack
|
|
2
|
+
* Add Slack behavior around one Turn.
|
|
3
3
|
*
|
|
4
|
-
* This module
|
|
5
|
-
*
|
|
6
|
-
* provider-neutral runtime contract. Agent execution stays behind
|
|
7
|
-
* `AgentRunner`.
|
|
4
|
+
* This module owns Slack status, delivery, and state.
|
|
5
|
+
* It calls `executeTurn` to run and finish the Turn.
|
|
8
6
|
*/
|
|
9
7
|
import type { Message, Thread } from "chat";
|
|
10
8
|
import type { SlackAdapter } from "@chat-adapter/slack";
|
|
11
9
|
import { type Destination } from "@sentry/junior-plugin-api";
|
|
12
|
-
import type
|
|
10
|
+
import { type ExecuteTurn } from "@/chat/runtime/turn-execution";
|
|
13
11
|
import type { PreparedTurnState } from "@/chat/runtime/turn-preparation";
|
|
14
12
|
import { type PrepareTurnStateInput, type QueuedTurnMessage, type TurnToolInvocation } from "@/chat/runtime/turn-input";
|
|
15
13
|
import type { ContextCompactor } from "@/chat/services/context-compaction";
|
|
16
|
-
import {
|
|
17
|
-
import type
|
|
18
|
-
import type { ConversationTurnLifecycle } from "@/chat/conversations/turn-lifecycle";
|
|
14
|
+
import type { PausedTurns } from "@/chat/task-execution/turn-wake";
|
|
15
|
+
import { type ScheduleSessionCompletedPluginTasksOptions } from "@/chat/plugins/task-runner";
|
|
19
16
|
import type { DispatchTurnContext, DispatchTurnResult } from "@/chat/agent-dispatch/types";
|
|
20
|
-
export interface SlackTurnServices {
|
|
21
|
-
agentRunner: AgentRunner;
|
|
22
|
-
contextCompactor: ContextCompactor;
|
|
23
|
-
getPausedTurnRequest: (args: {
|
|
24
|
-
conversationId: string;
|
|
25
|
-
turnId: string;
|
|
26
|
-
}) => Promise<PausedTurnRequest | undefined>;
|
|
27
|
-
lookupSlackUser: typeof lookupSlackUser;
|
|
28
|
-
turnLifecycle: ConversationTurnLifecycle;
|
|
29
|
-
wakePausedTurn: (request: PausedTurnRequest) => Promise<void>;
|
|
30
|
-
scheduleSessionCompletedPluginTasks: (params: {
|
|
31
|
-
conversationId: string;
|
|
32
|
-
sessionId: string;
|
|
33
|
-
}) => Promise<void>;
|
|
34
|
-
}
|
|
35
17
|
interface SlackTurnDeps {
|
|
18
|
+
contextCompactor: ContextCompactor;
|
|
19
|
+
executeTurn: ExecuteTurn;
|
|
36
20
|
getSlackAdapter: () => SlackAdapter;
|
|
21
|
+
pausedTurns: PausedTurns;
|
|
37
22
|
resolveUserAttachments: (attachments: Message["attachments"] | undefined, context: {
|
|
38
23
|
threadId?: string;
|
|
39
24
|
actorId?: string;
|
|
@@ -48,7 +33,7 @@ interface SlackTurnDeps {
|
|
|
48
33
|
promptText?: string;
|
|
49
34
|
}>>;
|
|
50
35
|
prepareTurnState: (args: PrepareTurnStateInput) => Promise<PreparedTurnState>;
|
|
51
|
-
|
|
36
|
+
sendPluginTask?: ScheduleSessionCompletedPluginTasksOptions["send"];
|
|
52
37
|
}
|
|
53
38
|
/** Build the Slack caller that prepares input and delivers output for a Turn. */
|
|
54
39
|
export declare function createSlackTurn(deps: SlackTurnDeps): (thread: Thread, message: Message, options: {
|
|
@@ -1,5 +1,10 @@
|
|
|
1
|
-
/**
|
|
2
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Synthetic author id stamped on resource-event mailbox messages.
|
|
3
|
+
*
|
|
4
|
+
* Kept stable so provider adapters and conversation history can recognize the
|
|
5
|
+
* same system input for resource-event turns.
|
|
6
|
+
*/
|
|
7
|
+
export declare const RESOURCE_EVENT_AUTHOR_ID = "UJRNEVENT";
|
|
3
8
|
/** System execution actor for every resource-event turn. */
|
|
4
9
|
export declare const RESOURCE_EVENT_SYSTEM_ACTOR: {
|
|
5
10
|
readonly platform: "system";
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { ResourceEvent } from "@sentry/junior-plugin-api";
|
|
2
|
+
import type { StateAdapter } from "chat";
|
|
3
|
+
import type { ConversationWorkQueue } from "@/chat/task-execution/queue";
|
|
4
|
+
export type ResourceEventAppPublisher = {
|
|
5
|
+
neededMatchKeys(input: {
|
|
6
|
+
eventTypes: string[];
|
|
7
|
+
identifiers: string[];
|
|
8
|
+
namespace: string;
|
|
9
|
+
}): Promise<string[]>;
|
|
10
|
+
publish(event: ResourceEvent): Promise<void>;
|
|
11
|
+
};
|
|
12
|
+
/** Build the core resource-event publisher used by plugin routes. */
|
|
13
|
+
export declare function createResourceEventAppPublisher(args: {
|
|
14
|
+
conversationWork: () => {
|
|
15
|
+
queue?: ConversationWorkQueue;
|
|
16
|
+
state?: StateAdapter;
|
|
17
|
+
};
|
|
18
|
+
}): ResourceEventAppPublisher;
|
|
@@ -2,6 +2,25 @@ import { type PluginResourceEvents, type ResourceEventMatch, type ResourceEventM
|
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
type ResourceEventRegistration = Pick<PluginResourceEvents, "resourceTypes" | "normalizeIdentifier">;
|
|
4
4
|
export type ResourceEventCatalog = Readonly<Record<string, ResourceEventRegistration>>;
|
|
5
|
+
/** Core-owned resource-event namespace. Not a plugin publisher. */
|
|
6
|
+
export declare const CORE_RESOURCE_EVENT_NAMESPACE = "junior";
|
|
7
|
+
/** True when the catalog has any enabled registration. */
|
|
8
|
+
export declare function hasResourceEventCatalogEntries(catalog: ResourceEventCatalog): boolean;
|
|
9
|
+
/**
|
|
10
|
+
* True when at least one plugin namespace is enabled.
|
|
11
|
+
*
|
|
12
|
+
* Core Workspace snapshot events stay in the catalog for search and temporary
|
|
13
|
+
* watches. Durable event tasks still require a plugin publisher.
|
|
14
|
+
*/
|
|
15
|
+
export declare function hasPluginResourceEventCatalogEntries(catalog: ResourceEventCatalog): boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Catalog entries that durable event tasks may select.
|
|
18
|
+
*
|
|
19
|
+
* Core Workspace snapshot events only wake temporary watches. Snapshot finish
|
|
20
|
+
* does not run event-task ingest, so those namespaces stay out of create/update
|
|
21
|
+
* schemas and trigger availability.
|
|
22
|
+
*/
|
|
23
|
+
export declare function pluginResourceEventCatalog(catalog: ResourceEventCatalog): ResourceEventCatalog;
|
|
5
24
|
/** Build the model-facing namespace enum from enabled resource event plugins. */
|
|
6
25
|
export declare function eventNamespaceSchema(catalog: ResourceEventCatalog): z.ZodString | z.ZodEnum<{
|
|
7
26
|
[x: string]: string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ConversationWorkQueue } from "@/chat/task-execution/queue";
|
|
2
|
-
import { appendAndEnqueueInboundMessage } from "@/chat/task-execution/store";
|
|
2
|
+
import { appendAndEnqueueInboundMessage, type AppendAndEnqueueInboundMessageResult, type InboundMessage } from "@/chat/task-execution/store";
|
|
3
3
|
import type { ResourceEventSubscription } from "@/chat/resource-events/store";
|
|
4
4
|
export interface ResourceEventNotification {
|
|
5
5
|
eventKey: string;
|
|
@@ -19,10 +19,35 @@ export interface ResourceEventNotification {
|
|
|
19
19
|
* contract. Stable delivery rules live in runtime and docs, not this prompt.
|
|
20
20
|
*/
|
|
21
21
|
export declare function renderResourceEventNotificationText(subscription: Pick<ResourceEventSubscription, "intent" | "label" | "resourceType">, event: Pick<ResourceEventNotification, "namespace" | "eventType" | "trustedSummary" | "data" | "untrustedText">): string;
|
|
22
|
-
/**
|
|
22
|
+
/** Resource-event identity stamped on plain mailbox input. */
|
|
23
|
+
export type ResourceEventMailboxMetadata = {
|
|
24
|
+
kind: "resource_event";
|
|
25
|
+
resourceEvent: {
|
|
26
|
+
eventKey: string;
|
|
27
|
+
eventType: string;
|
|
28
|
+
namespace: string;
|
|
29
|
+
identifier: string;
|
|
30
|
+
subscriptionId: string;
|
|
31
|
+
};
|
|
32
|
+
} & Record<string, unknown>;
|
|
33
|
+
/** Whether mailbox metadata is a plain resource-event wake. */
|
|
34
|
+
export declare function isResourceEventMailboxMetadata(value: unknown): value is ResourceEventMailboxMetadata;
|
|
35
|
+
/** Build plain conversation mailbox input for one matched watch. */
|
|
36
|
+
export declare function createResourceEventInboundMessage(input: {
|
|
37
|
+
event: ResourceEventNotification;
|
|
38
|
+
subscription: Pick<ResourceEventSubscription, "conversationId" | "id">;
|
|
39
|
+
text: string;
|
|
40
|
+
receivedAtMs?: number;
|
|
41
|
+
}): InboundMessage;
|
|
42
|
+
/**
|
|
43
|
+
* Enqueue a resource event as normal conversation mailbox input.
|
|
44
|
+
*
|
|
45
|
+
* The watch only names the conversation. Destination stays on the conversation
|
|
46
|
+
* and is applied when the worker runs.
|
|
47
|
+
*/
|
|
23
48
|
export declare function enqueueResourceEventNotification(args: {
|
|
24
49
|
event: ResourceEventNotification;
|
|
25
50
|
queue: ConversationWorkQueue;
|
|
26
51
|
subscription: ResourceEventSubscription;
|
|
27
52
|
state?: Parameters<typeof appendAndEnqueueInboundMessage>[0]["state"];
|
|
28
|
-
}): Promise<
|
|
53
|
+
}): Promise<AppendAndEnqueueInboundMessageResult>;
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
-
import type
|
|
2
|
-
/**
|
|
1
|
+
import { type ResourceEventCatalog } from "@/chat/resource-events/catalog";
|
|
2
|
+
/**
|
|
3
|
+
* Enabled resource-event registrations for search, guidance, and tool schemas.
|
|
4
|
+
*
|
|
5
|
+
* Includes core Workspace snapshot events under the `junior` namespace, plus
|
|
6
|
+
* every enabled plugin registration. Plugins may not use the `junior` namespace.
|
|
7
|
+
*/
|
|
3
8
|
export declare function getResourceEventCatalog(): ResourceEventCatalog;
|
|
@@ -1,17 +1,9 @@
|
|
|
1
1
|
import type { StateAdapter } from "chat";
|
|
2
|
-
import { type
|
|
2
|
+
import { type ResourceEventData, type ResourceEventMatch } from "@sentry/junior-plugin-api";
|
|
3
3
|
import { z } from "zod";
|
|
4
4
|
declare const subscriptionSchema: z.ZodObject<{
|
|
5
5
|
conversationId: z.ZodString;
|
|
6
6
|
createdAtMs: z.ZodNumber;
|
|
7
|
-
destination: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
8
|
-
platform: z.ZodLiteral<"slack">;
|
|
9
|
-
teamId: z.ZodString;
|
|
10
|
-
channelId: z.ZodString;
|
|
11
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
12
|
-
platform: z.ZodLiteral<"local">;
|
|
13
|
-
conversationId: z.ZodString;
|
|
14
|
-
}, z.core.$strict>], "platform">;
|
|
15
7
|
events: z.ZodArray<z.ZodString>;
|
|
16
8
|
expiresAtMs: z.ZodNumber;
|
|
17
9
|
id: z.ZodString;
|
|
@@ -23,15 +15,14 @@ declare const subscriptionSchema: z.ZodObject<{
|
|
|
23
15
|
resourceType: z.ZodString;
|
|
24
16
|
status: z.ZodEnum<{
|
|
25
17
|
completed: "completed";
|
|
26
|
-
active: "active";
|
|
27
18
|
cancelled: "cancelled";
|
|
19
|
+
active: "active";
|
|
28
20
|
}>;
|
|
29
21
|
updatedAtMs: z.ZodNumber;
|
|
30
22
|
}, z.core.$strict>;
|
|
31
23
|
export type ResourceEventSubscription = z.output<typeof subscriptionSchema>;
|
|
32
24
|
export interface CreateResourceEventSubscriptionInput {
|
|
33
25
|
conversationId: string;
|
|
34
|
-
destination: Destination;
|
|
35
26
|
events: string[];
|
|
36
27
|
expiresAtMs: number;
|
|
37
28
|
intent: string;
|
|
@@ -75,7 +66,6 @@ export declare function collectResourceEventMatchKeys(input: {
|
|
|
75
66
|
namespace: string;
|
|
76
67
|
nowMs?: number;
|
|
77
68
|
state?: StateAdapter;
|
|
78
|
-
teamId: string;
|
|
79
69
|
}): Promise<string[]>;
|
|
80
70
|
/** Find active subscriptions interested in a normalized resource event. */
|
|
81
71
|
export declare function findMatchingResourceEventSubscriptions(input: {
|
|
@@ -85,7 +75,6 @@ export declare function findMatchingResourceEventSubscriptions(input: {
|
|
|
85
75
|
namespace: string;
|
|
86
76
|
identifier: string;
|
|
87
77
|
state?: StateAdapter;
|
|
88
|
-
teamId: string;
|
|
89
78
|
}): Promise<ResourceEventSubscription[]>;
|
|
90
79
|
/** Recheck and deliver a matched subscription while holding its status lock. */
|
|
91
80
|
export declare function deliverResourceEventSubscription(input: {
|
|
@@ -97,7 +86,6 @@ export declare function deliverResourceEventSubscription(input: {
|
|
|
97
86
|
identifier: string;
|
|
98
87
|
state?: StateAdapter;
|
|
99
88
|
subscription: ResourceEventSubscription;
|
|
100
|
-
teamId: string;
|
|
101
89
|
terminal?: boolean;
|
|
102
90
|
waitDeadlineMs?: number;
|
|
103
91
|
}): Promise<boolean>;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type { ToolRuntimeContext } from "@/chat/tools/types";
|
|
2
1
|
/** Default lifetime for temporary resource subscriptions. */
|
|
3
2
|
export declare const RESOURCE_SUBSCRIPTION_DEFAULT_TTL_MS: number;
|
|
4
3
|
/** Hard upper bound for temporary resource subscriptions. */
|
|
@@ -8,7 +7,3 @@ export declare const RESOURCE_WATCH_TOOL_SOURCE: {
|
|
|
8
7
|
id: string;
|
|
9
8
|
description: string;
|
|
10
9
|
};
|
|
11
|
-
/** Require the Slack thread identity that owns a resource watch. */
|
|
12
|
-
export declare function requireResourceWatchConversation(context: ToolRuntimeContext): string;
|
|
13
|
-
/** Return whether the current runtime can safely manage conversation watches. */
|
|
14
|
-
export declare function canUseResourceEventSubscriptionTools(context: ToolRuntimeContext): boolean;
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
/**
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Resolve the single-bot Slack team id for event-task indexing.
|
|
3
|
+
*
|
|
4
|
+
* Resource watches do not use this. Event tasks still key by destination team
|
|
5
|
+
* until that store is conversation-owned. Resource-event delivery itself is
|
|
6
|
+
* not gated on Slack.
|
|
7
|
+
*/
|
|
4
8
|
export declare function createResourceEventTeamIdResolver(): () => Promise<string | undefined>;
|
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
import type { AgentRun } from "@/chat/agent/types";
|
|
2
2
|
import type { CompleteConversationTurnInput, FailConversationTurnInput } from "@/chat/conversations/turn-lifecycle";
|
|
3
3
|
import type { AgentRunOutcome } from "@/chat/runtime/agent-run-outcome";
|
|
4
|
-
import type
|
|
4
|
+
import { type AgentRunner } from "@/chat/runtime/agent-runner";
|
|
5
5
|
import type { AgentRunResult } from "@/chat/services/turn-result";
|
|
6
6
|
type SavedTurnResult = {
|
|
7
7
|
finishedAtMs?: number;
|
|
8
8
|
outcome: CompleteConversationTurnInput["outcome"];
|
|
9
9
|
} | {
|
|
10
|
+
eventId?: string;
|
|
10
11
|
finishedAtMs?: number;
|
|
11
12
|
failureCode: FailConversationTurnInput["failureCode"];
|
|
13
|
+
failureReason?: FailConversationTurnInput["failureReason"];
|
|
12
14
|
outcome: "failed";
|
|
13
15
|
};
|
|
14
16
|
type TurnExecutionOutcome = Exclude<AgentRunOutcome, {
|
|
@@ -25,6 +27,9 @@ export declare class AgentRunError extends Error {
|
|
|
25
27
|
*
|
|
26
28
|
* A paused Run, or a Run waiting for authorization, leaves the Turn open. A
|
|
27
29
|
* save error also leaves the Turn open so the worker can retry or recover it.
|
|
30
|
+
* A timeout aborts the Run before this function reports the failure.
|
|
28
31
|
*/
|
|
29
|
-
export declare function executeTurn(agentRunner: AgentRunner, run: AgentRun, saveResult: (result: AgentRunResult) => Promise<SavedTurnResult
|
|
32
|
+
export declare function executeTurn(agentRunner: AgentRunner, run: AgentRun, saveResult: (result: AgentRunResult) => Promise<SavedTurnResult>, timeoutMs?: number): Promise<TurnExecutionOutcome>;
|
|
33
|
+
/** Run the agent and finish a Turn after its caller saves the result. */
|
|
34
|
+
export type ExecuteTurn = (run: AgentRun, saveResult: (result: AgentRunResult) => Promise<SavedTurnResult>, timeoutMs?: number) => Promise<TurnExecutionOutcome>;
|
|
30
35
|
export {};
|
|
@@ -49,11 +49,12 @@ export declare function selectSandboxEgressGrant(input: {
|
|
|
49
49
|
*/
|
|
50
50
|
export declare function authorizationForSandboxEgressGrant(provider: string, selection: SandboxEgressGrantSelection): PluginAuthorization | undefined;
|
|
51
51
|
/**
|
|
52
|
-
* Return
|
|
52
|
+
* Return credential header transforms for a selected grant.
|
|
53
53
|
*
|
|
54
|
-
*
|
|
55
|
-
*
|
|
56
|
-
*
|
|
54
|
+
* Only shared installation grants are remembered on the host. User and other
|
|
55
|
+
* grants always issue from the live credential source so a saved login change
|
|
56
|
+
* cannot leave stale auth headers in place. The sandbox context only authorizes
|
|
57
|
+
* the request.
|
|
57
58
|
*/
|
|
58
59
|
export declare function sandboxEgressCredentialLease(provider: string, selection: SandboxEgressGrantSelection, context: SandboxEgressCredentialContext): Promise<SandboxEgressCredentialLease>;
|
|
59
60
|
/** Return whether a credential lease can modify requests to the target host. */
|
|
@@ -22,18 +22,17 @@ export declare function createSandboxEgressCredentialToken(input: {
|
|
|
22
22
|
*/
|
|
23
23
|
export declare function parseSandboxEgressCredentialToken(token: string | undefined): SandboxEgressCredentialContext | undefined;
|
|
24
24
|
/**
|
|
25
|
-
*
|
|
25
|
+
* Remember auth headers for a shared installation grant.
|
|
26
26
|
*
|
|
27
|
-
*
|
|
28
|
-
* context expiry
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
export declare function clearSandboxEgressCredentialLease(provider: string, grant: SandboxEgressCredentialLease["grant"], context: SandboxEgressCredentialContext): Promise<void>;
|
|
27
|
+
* User and other grants are ignored here. TTL follows the provider expiry.
|
|
28
|
+
* Sandbox context expiry still decides whether a request may use the headers;
|
|
29
|
+
* it does not shorten a shared installation grant for other sandboxes.
|
|
30
|
+
*/
|
|
31
|
+
export declare function setSandboxEgressCredentialLease(_context: SandboxEgressCredentialContext, lease: SandboxEgressCredentialLease): Promise<void>;
|
|
32
|
+
/** Load remembered auth headers for a shared installation grant. */
|
|
33
|
+
export declare function getSandboxEgressCredentialLease(provider: string, grant: SandboxEgressCredentialLease["grant"], _context: SandboxEgressCredentialContext): Promise<SandboxEgressCredentialLease | undefined>;
|
|
34
|
+
/** Drop remembered installation headers after the upstream rejects them. */
|
|
35
|
+
export declare function clearSandboxEgressCredentialLease(provider: string, grant: SandboxEgressCredentialLease["grant"], _context: SandboxEgressCredentialContext): Promise<void>;
|
|
37
36
|
/**
|
|
38
37
|
* Record that credential issuance needs user authorization for this command.
|
|
39
38
|
*
|
|
@@ -12,7 +12,7 @@ export declare function isAbortError(error: unknown): boolean;
|
|
|
12
12
|
export declare function isSandboxApiTransientError(error: unknown): boolean;
|
|
13
13
|
/** Detect interrupted command streams where no reliable exit status is available. */
|
|
14
14
|
export declare function isSandboxCommandStreamInterruptedError(error: unknown): boolean;
|
|
15
|
-
/** Wrap
|
|
15
|
+
/** Wrap setup failures. Keep WorkspaceSnapshotNotReadyError as-is. */
|
|
16
16
|
export declare function wrapSandboxSetupError(error: unknown): Error;
|
|
17
17
|
/** Record span data and throw one stable sandbox operation error. */
|
|
18
18
|
export declare function throwSandboxOperationError(action: string, error: unknown, includeMissingPath?: boolean): never;
|
|
@@ -1,8 +1,15 @@
|
|
|
1
|
-
import type { ResourceEvent, SubscribableResource } from "@sentry/junior-plugin-api";
|
|
1
|
+
import type { PluginResourceEvents, ResourceEvent, SubscribableResource } from "@sentry/junior-plugin-api";
|
|
2
2
|
export declare const WORKSPACE_SNAPSHOT_NAMESPACE = "junior";
|
|
3
3
|
export declare const WORKSPACE_SNAPSHOT_RESOURCE_TYPE = "workspace_snapshot";
|
|
4
4
|
export declare const WORKSPACE_SNAPSHOT_READY_EVENT = "workspace_snapshot.ready";
|
|
5
5
|
export declare const WORKSPACE_SNAPSHOT_FAILED_EVENT = "workspace_snapshot.failed";
|
|
6
|
+
/**
|
|
7
|
+
* Core catalog entry for Workspace snapshot ready and failed events.
|
|
8
|
+
*
|
|
9
|
+
* Uses the same registration shape as plugins so search, guidance, and tool
|
|
10
|
+
* schemas treat these events like any other resource type.
|
|
11
|
+
*/
|
|
12
|
+
export declare function workspaceSnapshotResourceEvents(): PluginResourceEvents;
|
|
6
13
|
/** Describe the events that report when a snapshot build ends. */
|
|
7
14
|
export declare function workspaceSnapshotWatch(input: {
|
|
8
15
|
workspaceId: string;
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
/** Report that a Workspace snapshot is not ready to use. */
|
|
2
2
|
export declare class WorkspaceSnapshotNotReadyError extends Error {
|
|
3
|
+
readonly workspaceName: string;
|
|
3
4
|
constructor(workspaceName: string);
|
|
4
5
|
}
|
|
5
|
-
/**
|
|
6
|
+
/** Return WorkspaceSnapshotNotReadyError from this error or its causes. */
|
|
7
|
+
export declare function getWorkspaceSnapshotNotReadyError(error: unknown): WorkspaceSnapshotNotReadyError | undefined;
|
|
8
|
+
/** True when this error or a cause is WorkspaceSnapshotNotReadyError. */
|
|
6
9
|
export declare function isWorkspaceSnapshotNotReadyError(error: unknown): boolean;
|
|
10
|
+
/** User message when a Workspace sandbox is still preparing. */
|
|
11
|
+
export declare function workspaceSnapshotNotReadyUserMessage(error: WorkspaceSnapshotNotReadyError): string;
|
|
@@ -34,8 +34,8 @@ declare const compactTaskResultSchema: z.ZodObject<{
|
|
|
34
34
|
}, z.core.$strict>;
|
|
35
35
|
conversation_access: z.ZodObject<{
|
|
36
36
|
audience: z.ZodEnum<{
|
|
37
|
-
channel: "channel";
|
|
38
37
|
direct: "direct";
|
|
38
|
+
channel: "channel";
|
|
39
39
|
group: "group";
|
|
40
40
|
}>;
|
|
41
41
|
visibility: z.ZodEnum<{
|
|
@@ -79,8 +79,8 @@ export declare const scheduleTaskToolResultSchema: z.ZodObject<{
|
|
|
79
79
|
}, z.core.$strict>;
|
|
80
80
|
conversation_access: z.ZodObject<{
|
|
81
81
|
audience: z.ZodEnum<{
|
|
82
|
-
channel: "channel";
|
|
83
82
|
direct: "direct";
|
|
83
|
+
channel: "channel";
|
|
84
84
|
group: "group";
|
|
85
85
|
}>;
|
|
86
86
|
visibility: z.ZodEnum<{
|
|
@@ -124,8 +124,8 @@ export declare const scheduleListToolResultSchema: z.ZodObject<{
|
|
|
124
124
|
}, z.core.$strict>;
|
|
125
125
|
conversation_access: z.ZodObject<{
|
|
126
126
|
audience: z.ZodEnum<{
|
|
127
|
-
channel: "channel";
|
|
128
127
|
direct: "direct";
|
|
128
|
+
channel: "channel";
|
|
129
129
|
group: "group";
|
|
130
130
|
}>;
|
|
131
131
|
visibility: z.ZodEnum<{
|
|
@@ -178,7 +178,7 @@ export declare function scheduleTaskToolResult(target: string, task: CompactTask
|
|
|
178
178
|
channel_id: string;
|
|
179
179
|
};
|
|
180
180
|
conversation_access: {
|
|
181
|
-
audience: "
|
|
181
|
+
audience: "direct" | "channel" | "group";
|
|
182
182
|
visibility: "private" | "public";
|
|
183
183
|
};
|
|
184
184
|
credential_mode: "system" | "creator";
|
|
@@ -208,7 +208,7 @@ export declare function scheduleListToolResult(args: {
|
|
|
208
208
|
channel_id: string;
|
|
209
209
|
};
|
|
210
210
|
conversation_access: {
|
|
211
|
-
audience: "
|
|
211
|
+
audience: "direct" | "channel" | "group";
|
|
212
212
|
visibility: "private" | "public";
|
|
213
213
|
};
|
|
214
214
|
credential_mode: "system" | "creator";
|
|
@@ -47,7 +47,7 @@ export declare function createSlackScheduleCreateTaskTool(context: SchedulerTool
|
|
|
47
47
|
channel_id: string;
|
|
48
48
|
};
|
|
49
49
|
conversation_access: {
|
|
50
|
-
audience: "
|
|
50
|
+
audience: "direct" | "channel" | "group";
|
|
51
51
|
visibility: "private" | "public";
|
|
52
52
|
};
|
|
53
53
|
credential_mode: "system" | "creator";
|
|
@@ -77,7 +77,7 @@ export declare function createSlackScheduleCreateTaskTool(context: SchedulerTool
|
|
|
77
77
|
channel_id: string;
|
|
78
78
|
};
|
|
79
79
|
conversation_access: {
|
|
80
|
-
audience: "
|
|
80
|
+
audience: "direct" | "channel" | "group";
|
|
81
81
|
visibility: "private" | "public";
|
|
82
82
|
};
|
|
83
83
|
credential_mode: "system" | "creator";
|
|
@@ -22,7 +22,7 @@ export declare function createSlackScheduleDeleteTaskTool(context: SchedulerTool
|
|
|
22
22
|
channel_id: string;
|
|
23
23
|
};
|
|
24
24
|
conversation_access: {
|
|
25
|
-
audience: "
|
|
25
|
+
audience: "direct" | "channel" | "group";
|
|
26
26
|
visibility: "private" | "public";
|
|
27
27
|
};
|
|
28
28
|
credential_mode: "system" | "creator";
|
|
@@ -52,7 +52,7 @@ export declare function createSlackScheduleDeleteTaskTool(context: SchedulerTool
|
|
|
52
52
|
channel_id: string;
|
|
53
53
|
};
|
|
54
54
|
conversation_access: {
|
|
55
|
-
audience: "
|
|
55
|
+
audience: "direct" | "channel" | "group";
|
|
56
56
|
visibility: "private" | "public";
|
|
57
57
|
};
|
|
58
58
|
credential_mode: "system" | "creator";
|
|
@@ -23,7 +23,7 @@ export declare function createSlackScheduleListTasksTool(context: SchedulerToolC
|
|
|
23
23
|
channel_id: string;
|
|
24
24
|
};
|
|
25
25
|
conversation_access: {
|
|
26
|
-
audience: "
|
|
26
|
+
audience: "direct" | "channel" | "group";
|
|
27
27
|
visibility: "private" | "public";
|
|
28
28
|
};
|
|
29
29
|
credential_mode: "system" | "creator";
|
|
@@ -53,7 +53,7 @@ export declare function createSlackScheduleListTasksTool(context: SchedulerToolC
|
|
|
53
53
|
channel_id: string;
|
|
54
54
|
};
|
|
55
55
|
conversation_access: {
|
|
56
|
-
audience: "
|
|
56
|
+
audience: "direct" | "channel" | "group";
|
|
57
57
|
visibility: "private" | "public";
|
|
58
58
|
};
|
|
59
59
|
credential_mode: "system" | "creator";
|
|
@@ -22,7 +22,7 @@ export declare function createSlackScheduleRunTaskNowTool(context: SchedulerTool
|
|
|
22
22
|
channel_id: string;
|
|
23
23
|
};
|
|
24
24
|
conversation_access: {
|
|
25
|
-
audience: "
|
|
25
|
+
audience: "direct" | "channel" | "group";
|
|
26
26
|
visibility: "private" | "public";
|
|
27
27
|
};
|
|
28
28
|
credential_mode: "system" | "creator";
|
|
@@ -52,7 +52,7 @@ export declare function createSlackScheduleRunTaskNowTool(context: SchedulerTool
|
|
|
52
52
|
channel_id: string;
|
|
53
53
|
};
|
|
54
54
|
conversation_access: {
|
|
55
|
-
audience: "
|
|
55
|
+
audience: "direct" | "channel" | "group";
|
|
56
56
|
visibility: "private" | "public";
|
|
57
57
|
};
|
|
58
58
|
credential_mode: "system" | "creator";
|
|
@@ -49,7 +49,7 @@ export declare function createSlackScheduleUpdateTaskTool(context: SchedulerTool
|
|
|
49
49
|
channel_id: string;
|
|
50
50
|
};
|
|
51
51
|
conversation_access: {
|
|
52
|
-
audience: "
|
|
52
|
+
audience: "direct" | "channel" | "group";
|
|
53
53
|
visibility: "private" | "public";
|
|
54
54
|
};
|
|
55
55
|
credential_mode: "system" | "creator";
|
|
@@ -79,7 +79,7 @@ export declare function createSlackScheduleUpdateTaskTool(context: SchedulerTool
|
|
|
79
79
|
channel_id: string;
|
|
80
80
|
};
|
|
81
81
|
conversation_access: {
|
|
82
|
-
audience: "
|
|
82
|
+
audience: "direct" | "channel" | "group";
|
|
83
83
|
visibility: "private" | "public";
|
|
84
84
|
};
|
|
85
85
|
credential_mode: "system" | "creator";
|
|
@@ -25,8 +25,8 @@ export declare const scheduledTaskSchema: z.ZodObject<{
|
|
|
25
25
|
id: z.ZodString;
|
|
26
26
|
conversationAccess: z.ZodObject<{
|
|
27
27
|
audience: z.ZodEnum<{
|
|
28
|
-
channel: "channel";
|
|
29
28
|
direct: "direct";
|
|
29
|
+
channel: "channel";
|
|
30
30
|
group: "group";
|
|
31
31
|
}>;
|
|
32
32
|
visibility: z.ZodEnum<{
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
/** Build a Sentry conversation URL only when the runtime has enough Sentry config. */
|
|
2
2
|
export declare function buildSentryConversationUrl(conversationId: string): string | undefined;
|
|
3
|
+
/** Build a Sentry event URL only when the runtime has enough Sentry config. */
|
|
4
|
+
export declare function buildSentryEventUrl(eventId: string): string | undefined;
|
|
3
5
|
/** Build a Sentry trace URL only when the runtime has enough Sentry config. */
|
|
4
6
|
export declare function buildSentryTraceUrl(traceId: string): string | undefined;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type AssistantMessage } from "@earendil-works/pi-ai";
|
|
2
2
|
import type { PiMessage } from "@/chat/pi/messages";
|
|
3
|
+
import { type ProviderError } from "@/chat/services/provider-error";
|
|
3
4
|
/** Apply Junior's retry budget to a retryable Pi assistant failure. */
|
|
4
5
|
export declare function nextProviderRetry(args: {
|
|
5
6
|
attempt: number;
|
|
@@ -8,4 +9,5 @@ export declare function nextProviderRetry(args: {
|
|
|
8
9
|
}): {
|
|
9
10
|
delayMs: number;
|
|
10
11
|
messages: PiMessage[];
|
|
12
|
+
providerError: ProviderError;
|
|
11
13
|
} | undefined;
|
|
@@ -1,12 +1,16 @@
|
|
|
1
|
+
import type { ConversationTurnFailureReason } from "@/chat/conversations/history";
|
|
1
2
|
import type { AgentRunResult } from "@/chat/services/turn-result";
|
|
2
3
|
type LogException = (error: unknown, eventName: string, attributes?: Record<string, unknown>) => string | undefined;
|
|
3
4
|
/** Require captured turn failures to carry a real Sentry event reference. */
|
|
4
5
|
export declare function requireTurnFailureEventId(eventId: string | undefined, eventName: string): string;
|
|
6
|
+
/** Return a fixed reason label for a failed model turn. */
|
|
7
|
+
export declare function getTurnFailureReason(reply: AgentRunResult): ConversationTurnFailureReason | undefined;
|
|
5
8
|
/** Keep failed-turn Sentry captures and completion spans on the same keys. */
|
|
6
9
|
export declare function getAgentTurnDiagnosticsAttributes(reply: AgentRunResult): Record<string, unknown>;
|
|
7
10
|
/** Sanitized failure fallback plus its optional captured event ID. */
|
|
8
11
|
export interface FinalizedTurnFailure {
|
|
9
12
|
eventId?: string;
|
|
13
|
+
failureReason?: ConversationTurnFailureReason;
|
|
10
14
|
reply: AgentRunResult;
|
|
11
15
|
}
|
|
12
16
|
/** Enforce one captured failure response and return its structured correlation. */
|
|
@@ -1,18 +1,33 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Load
|
|
2
|
+
* Load destination and session source from the conversation record.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
4
|
+
* Destination is set once on the root conversation. Child conversations
|
|
5
|
+
* inherit through parent lineage. Later turns and mailbox wakes use that
|
|
6
|
+
* same destination so tools stay consistent for the whole conversation.
|
|
6
7
|
*/
|
|
7
8
|
import type { Destination, Source } from "@sentry/junior-plugin-api";
|
|
8
9
|
import type { ConversationStore } from "@/chat/conversations/store";
|
|
9
10
|
export interface TurnSessionRouting {
|
|
10
11
|
destination: Destination;
|
|
11
12
|
locationId?: string;
|
|
12
|
-
source
|
|
13
|
+
/** Present when the conversation already stores a session source. */
|
|
14
|
+
source?: Source;
|
|
13
15
|
}
|
|
16
|
+
/** Full turn routing: destination plus a completed session source. */
|
|
17
|
+
export type RequiredTurnSessionRouting = TurnSessionRouting & {
|
|
18
|
+
source: Source;
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* Resolve the conversation's destination and session source.
|
|
22
|
+
*
|
|
23
|
+
* Walks parent lineage when the conversation has no destination of its own.
|
|
24
|
+
*/
|
|
25
|
+
export declare function resolveConversationRouting(args: {
|
|
26
|
+
conversationId: string;
|
|
27
|
+
conversationStore?: ConversationStore;
|
|
28
|
+
}): Promise<TurnSessionRouting | undefined>;
|
|
14
29
|
/** Require conversation destination and session source from SQL. */
|
|
15
30
|
export declare function resolveTurnSessionRouting(args: {
|
|
16
31
|
conversationId: string;
|
|
17
32
|
conversationStore?: ConversationStore;
|
|
18
|
-
}): Promise<
|
|
33
|
+
}): Promise<RequiredTurnSessionRouting>;
|