@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.
- package/dist/{agent-hooks-PBT4NNBV.js → agent-hooks-DKDDRKZA.js} +16 -18
- package/dist/api/schema.js +0 -1
- package/dist/api.js +401 -366
- package/dist/app.d.ts +4 -0
- package/dist/app.js +783 -1367
- package/dist/catalog-runtime-WXKGUF3W.js +14 -0
- package/dist/chat/agent/sandbox.d.ts +0 -2
- package/dist/chat/api-turns/routing.d.ts +4 -0
- package/dist/chat/api-turns/work.d.ts +5 -0
- package/dist/chat/config.d.ts +5 -2
- package/dist/chat/configuration/defaults.d.ts +1 -1
- package/dist/chat/conversations/projection.d.ts +6 -4
- package/dist/chat/ingress/message-router.d.ts +3 -0
- package/dist/chat/model-profile.d.ts +8 -10
- package/dist/chat/pi/conversation-events.d.ts +3 -2
- package/dist/chat/plugins/task-queue.d.ts +40 -3
- package/dist/chat/plugins/task-runner.d.ts +1 -1
- package/dist/chat/queue/callback.d.ts +26 -0
- package/dist/chat/queue/sign.d.ts +30 -0
- package/dist/chat/sandbox/sandbox.d.ts +0 -2
- package/dist/chat/sandbox/session.d.ts +0 -2
- package/dist/chat/sandbox/skill-sync.d.ts +1 -1
- package/dist/chat/sandbox/snapshot/events.d.ts +23 -0
- package/dist/chat/sandbox/snapshot/job-callback.d.ts +5 -0
- package/dist/chat/sandbox/snapshot/job-queue.d.ts +26 -0
- package/dist/chat/sandbox/snapshot/job-runner.d.ts +11 -0
- package/dist/chat/sandbox/snapshot/not-ready-error.d.ts +6 -0
- package/dist/chat/sandbox/snapshot/workspace.d.ts +9 -3
- package/dist/chat/scheduled-tasks/personal.d.ts +5 -8
- package/dist/chat/scheduled-tasks/runs.d.ts +49 -0
- package/dist/chat/scheduled-tasks/schedule-intent.d.ts +1 -1
- package/dist/chat/scheduled-tasks/tasks.d.ts +27 -0
- package/dist/chat/scheduled-tasks/tool-support.d.ts +0 -4
- package/dist/chat/scheduled-tasks/tools/create.d.ts +1 -1
- package/dist/chat/scheduled-tasks/tools/update.d.ts +1 -1
- package/dist/chat/scheduled-tasks/types.d.ts +127 -78
- package/dist/chat/services/turn-router.d.ts +4 -3
- package/dist/chat/task-execution/queue-signing.d.ts +10 -21
- package/dist/chat/task-execution/state.d.ts +48 -0
- package/dist/chat/task-execution/store.d.ts +28 -2
- package/dist/chat/task-execution/worker.d.ts +4 -1
- package/dist/chat/tools/handoff/tool.d.ts +1 -1
- package/dist/{chunk-534BO42N.js → chunk-2AYEVN7K.js} +8 -8
- package/dist/{chunk-D3UJTX4U.js → chunk-2YIRH4E3.js} +46 -46
- package/dist/{chunk-4K6VNP3S.js → chunk-3ILJBWP7.js} +35 -227
- package/dist/{chunk-FQ6BMP5P.js → chunk-5PUMIMNQ.js} +2724 -1257
- package/dist/{chunk-G3CQEUHI.js → chunk-5TUR4M3M.js} +8 -61
- package/dist/{chunk-6ZWRNC4D.js → chunk-6Y5B5PEX.js} +1 -1
- package/dist/{chunk-KEQAA42D.js → chunk-6YCEWOLO.js} +4 -4
- package/dist/chunk-7H2VZTWN.js +103 -0
- package/dist/{chunk-22T3HB44.js → chunk-CCDXTDSY.js} +8 -8
- package/dist/{chunk-CGA4ERJ5.js → chunk-CEMMLV5L.js} +1 -1
- package/dist/chunk-CK6EINVZ.js +1181 -0
- package/dist/{chunk-FIANEE7Z.js → chunk-CM5HNV2W.js} +6 -6
- package/dist/{chunk-PRDKO3QB.js → chunk-CP73FKME.js} +144 -218
- package/dist/{chunk-XWUJWHFD.js → chunk-DHLOGWYH.js} +36 -36
- package/dist/chunk-DKIJ2RP5.js +68 -0
- package/dist/{chunk-ABLODWPO.js → chunk-DRHEGXTZ.js} +1 -1
- package/dist/{chunk-OOUNJNMR.js → chunk-DWPN6SCH.js} +1 -1
- package/dist/chunk-EWHP2IRG.js +209 -0
- package/dist/{chunk-ZCHHVTMF.js → chunk-FGC3PHNH.js} +3 -3
- package/dist/{chunk-H6ZXBFGX.js → chunk-GA5NS74S.js} +1 -1
- package/dist/{chunk-BFLMRTPD.js → chunk-GPXAHUQH.js} +84 -274
- package/dist/chunk-GUKXEPMX.js +218 -0
- package/dist/{chunk-3ZZEPLLB.js → chunk-I6IFTAPF.js} +108 -76
- package/dist/{chunk-RGXOLPWO.js → chunk-IANUX7HX.js} +5 -5
- package/dist/{chunk-UMG7M32G.js → chunk-KCL6AWYW.js} +74 -68
- package/dist/{chunk-BUGO42R6.js → chunk-L7LTGN4Z.js} +129 -31
- package/dist/{chunk-QCCLDJHB.js → chunk-LGVQLNLS.js} +42 -41
- package/dist/chunk-M3QYTBQ6.js +55 -0
- package/dist/{chunk-AVRWMQ4U.js → chunk-MXEUIGHO.js} +2 -2
- package/dist/{chunk-M63DETLL.js → chunk-N7TMSOZH.js} +6 -6
- package/dist/{chunk-JVXZ3WDH.js → chunk-O4QYZTDK.js} +33 -32
- package/dist/chunk-PEQXYSSE.js +45 -0
- package/dist/{chunk-OGRD5PFM.js → chunk-QSO7B5JO.js} +1 -1
- package/dist/{chunk-UGWBJAGN.js → chunk-RAZG3YHC.js} +100 -79
- package/dist/{chunk-XCNS3CXE.js → chunk-S7YRTOSQ.js} +69 -73
- package/dist/{chunk-LAOP4EPL.js → chunk-SDBKZ5LV.js} +108 -5
- package/dist/{chunk-RE4XWXBV.js → chunk-TC5DE5KJ.js} +22 -18
- package/dist/{chunk-H4HBKISO.js → chunk-TXKUKMVO.js} +1 -1
- package/dist/chunk-U5EUCUBH.js +164 -0
- package/dist/{chunk-BHHWCNXI.js → chunk-VG722ONZ.js} +18 -16
- package/dist/{chunk-U3UDPGZG.js → chunk-VGPPWWHF.js} +16 -16
- package/dist/{chunk-AQHSXA3J.js → chunk-WVAMRKYG.js} +9 -54
- package/dist/chunk-X6GDDWQH.js +60 -0
- package/dist/{chunk-6OYVH66J.js → chunk-ZE2KOV3G.js} +1 -1
- package/dist/{chunk-IQRPDKPJ.js → chunk-ZM7ZURJS.js} +4 -3
- package/dist/cli/chat.js +47 -43
- package/dist/cli/check.js +13 -15
- package/dist/cli/env.js +0 -1
- package/dist/cli/init.js +0 -1
- package/dist/cli/main.js +2 -3
- package/dist/cli/plugins.js +18 -20
- package/dist/cli/run.js +0 -1
- package/dist/cli/snapshot-create.js +14 -16
- package/dist/cli/upgrade.js +16 -18
- package/dist/{conversation-work-KATFHLG3.js → conversation-work-VIOQ5ZF3.js} +0 -2
- package/dist/db/schema/scheduled-tasks.d.ts +29 -5
- package/dist/db/schema.d.ts +28 -4
- package/dist/{db-QVYOWATH.js → db-6SBHIAJK.js} +8 -10
- package/dist/deployment.d.ts +1 -0
- package/dist/{discovery-GUFTFBTL.js → discovery-DWVDM7UK.js} +1 -2
- package/dist/{experimental-XVDOSRBS.js → experimental-SIJSRDJD.js} +0 -1
- package/dist/instrumentation.js +7 -9
- package/dist/nitro.js +39 -13
- package/dist/{oauth-callback-server-PLPAFXO6.js → oauth-callback-server-WSDQPZZS.js} +34 -32
- package/dist/{oauth-relay-3ZU72UGL.js → oauth-relay-5XPVRPYB.js} +0 -1
- package/dist/{plugins-HW4VWW6G.js → plugins-YTYJMMJF.js} +1 -2
- package/dist/{runner-AGNEIOZS.js → runner-GWTSWESR.js} +39 -33
- package/dist/{sandbox-egress-signals-DXOOBSBI.js → sandbox-egress-signals-FIL7EGPR.js} +5 -6
- package/dist/{sentry-JMWTS32N.js → sentry-MB3NL3IR.js} +1 -2
- package/dist/skills-F32BPFYW.js +27 -0
- package/dist/spawn-X5BPP5OE.js +37 -0
- package/dist/task-runner-2FPBV5PP.js +32 -0
- package/dist/validation-62WO524A.js +17 -0
- package/dist/vercel.js +0 -1
- package/dist/version.js +1 -2
- package/dist/work-3C3CMZ24.js +45 -0
- package/dist/worker-MFAI6ZEK.js +22 -0
- package/package.json +7 -6
- package/dist/catalog-runtime-M7QGKPFZ.js +0 -16
- package/dist/chat/plugins/task-callback.d.ts +0 -5
- package/dist/chat/plugins/task-message.d.ts +0 -23
- package/dist/chat/plugins/task-signing.d.ts +0 -31
- package/dist/chat/sandbox/snapshot/waiting-error.d.ts +0 -15
- package/dist/chat/scheduled-tasks/store.d.ts +0 -78
- package/dist/chat/services/workspace-snapshot-wait.d.ts +0 -27
- package/dist/chunk-5I6ORJUY.js +0 -127
- package/dist/chunk-6GWA276C.js +0 -72
- package/dist/chunk-AGJ4OQ2V.js +0 -51
- package/dist/chunk-MLKGABMK.js +0 -9
- package/dist/chunk-RGV6KHDM.js +0 -1944
- package/dist/chunk-WR76IVA5.js +0 -130
- package/dist/skills-U5KQ66EM.js +0 -29
- package/dist/spawn-ZRYYZP2B.js +0 -37
- package/dist/validation-QE4U45KS.js +0 -19
- package/dist/work-ATAXAHJJ.js +0 -45
- package/dist/worker-LIL5AOER.js +0 -24
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import {
|
|
2
|
+
pluginCatalogRuntime
|
|
3
|
+
} from "./chunk-DRHEGXTZ.js";
|
|
4
|
+
import "./chunk-2YIRH4E3.js";
|
|
5
|
+
import "./chunk-CEMMLV5L.js";
|
|
6
|
+
import "./chunk-N7TMSOZH.js";
|
|
7
|
+
import "./chunk-DWPN6SCH.js";
|
|
8
|
+
import "./chunk-TXKUKMVO.js";
|
|
9
|
+
import "./chunk-RAZG3YHC.js";
|
|
10
|
+
import "./chunk-PEQXYSSE.js";
|
|
11
|
+
import "./chunk-ZM7ZURJS.js";
|
|
12
|
+
export {
|
|
13
|
+
pluginCatalogRuntime
|
|
14
|
+
};
|
|
@@ -31,8 +31,6 @@ export interface AgentSandboxOptions {
|
|
|
31
31
|
actor?: Actor;
|
|
32
32
|
locationConfiguration?: LocationConfigurationService;
|
|
33
33
|
configurationValues: Record<string, unknown>;
|
|
34
|
-
/** Durable-worker soft yield for long Workspace snapshot waits. */
|
|
35
|
-
shouldYield?: () => boolean;
|
|
36
34
|
getActiveSkill(): Skill | null;
|
|
37
35
|
prepareSandbox(workspace: SandboxWorkspace): void | Promise<void>;
|
|
38
36
|
prepareWorkspace?(workspace: SandboxWorkspace, recipe: Workspace, signal?: AbortSignal): Promise<void>;
|
|
@@ -10,6 +10,10 @@ declare const apiTurnMailboxMetadataSchema: z.ZodObject<{
|
|
|
10
10
|
messageId: z.ZodString;
|
|
11
11
|
}, z.core.$strict>;
|
|
12
12
|
export type ApiTurnMailboxMetadata = z.output<typeof apiTurnMailboxMetadataSchema>;
|
|
13
|
+
/** Return the active root API Turn for one Conversation, if it has one. */
|
|
14
|
+
export declare function getActiveApiTurnId(conversationId: string): Promise<string | undefined>;
|
|
15
|
+
/** Return the idle auth-paused root API Turn for one Conversation. */
|
|
16
|
+
export declare function getAuthPausedApiTurnId(conversationId: string): Promise<string | undefined>;
|
|
13
17
|
/**
|
|
14
18
|
* Resolve API Turn work from mailbox metadata or an active checkpoint.
|
|
15
19
|
*
|
|
@@ -47,6 +47,11 @@ export declare function createApiConversationId(args: {
|
|
|
47
47
|
actorEmail: string;
|
|
48
48
|
idempotencyKey: string;
|
|
49
49
|
}): string;
|
|
50
|
+
/** Build the retry-stable Message id used by one API mailbox request. */
|
|
51
|
+
export declare function apiConversationMessageId(args: {
|
|
52
|
+
conversationId: string;
|
|
53
|
+
idempotencyKey: string;
|
|
54
|
+
}): string;
|
|
50
55
|
/** Stable turn id for one API mailbox message (matches getTurnUserMessage). */
|
|
51
56
|
export declare function apiTurnIdForMessage(messageId: string): string;
|
|
52
57
|
/** Rebuild the dashboard actor from durable conversation identity. */
|
package/dist/chat/config.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type TurnReasoningLevel } from "@/chat/reasoning-level";
|
|
2
|
-
import { type
|
|
2
|
+
import { type ModelProfileConfig, type ModelProfile } from "@/chat/model-profile";
|
|
3
3
|
export declare const DEFAULT_SQL_STATEMENT_TIMEOUT_MS = 30000;
|
|
4
4
|
/**
|
|
5
5
|
* Buffer between the Vercel function timeout and the agent turn timeout so
|
|
@@ -11,12 +11,13 @@ export declare const CONVERSATION_WORK_SOFT_YIELD_BUFFER_SECONDS = 40;
|
|
|
11
11
|
export interface BotConfig {
|
|
12
12
|
contextWindowTokens: number;
|
|
13
13
|
crossActorMidRunMode: CrossActorMidRunMode;
|
|
14
|
+
defaultProfile: ModelProfile;
|
|
14
15
|
embeddingModelId: string;
|
|
15
16
|
fastModelId: string;
|
|
16
17
|
guardianModelId: string;
|
|
17
18
|
imageGenerationModelId: string;
|
|
18
19
|
loadingMessages: string[];
|
|
19
|
-
profiles: Readonly<Record<string,
|
|
20
|
+
profiles: Readonly<Record<string, ModelProfileConfig>>;
|
|
20
21
|
reasoningLevel?: TurnReasoningLevel;
|
|
21
22
|
visionModelId?: string;
|
|
22
23
|
maxSlicesPerTurn: number;
|
|
@@ -73,6 +74,8 @@ export interface SlackReactionConfig {
|
|
|
73
74
|
completedReactionEmoji: string;
|
|
74
75
|
processingReactionEmoji: string;
|
|
75
76
|
}
|
|
77
|
+
/** Apply profiles from createApp(). */
|
|
78
|
+
export declare function setProfiles(profiles: Readonly<Record<string, string>> | undefined, defaultProfile: string | undefined): void;
|
|
76
79
|
/** Return the current Slack reaction emoji config. */
|
|
77
80
|
export declare function getSlackReactionConfig(): SlackReactionConfig;
|
|
78
81
|
/** Apply Slack reaction emoji overrides from createApp() options, validating names. */
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/** Store install-wide configuration defaults. */
|
|
2
|
-
export declare function setConfigDefaults(defaults:
|
|
2
|
+
export declare function setConfigDefaults(defaults: unknown): void;
|
|
3
3
|
/** Return the install-wide configuration defaults (empty object when none set). */
|
|
4
4
|
export declare function getConfigDefaults(): Record<string, unknown>;
|
|
@@ -145,14 +145,16 @@ export declare function recordSubscribedReplyRoute(args: {
|
|
|
145
145
|
shouldReply: boolean;
|
|
146
146
|
shouldUnsubscribe?: boolean;
|
|
147
147
|
}): Promise<void>;
|
|
148
|
-
/** Load a previously selected
|
|
148
|
+
/** Load a previously selected model profile for a resumed turn. */
|
|
149
149
|
export declare function loadTurnRoute(args: {
|
|
150
150
|
conversationId: string;
|
|
151
151
|
turnId: string;
|
|
152
|
-
}): Promise<Extract<ConversationEvent["data"], {
|
|
152
|
+
}): Promise<(Extract<ConversationEvent["data"], {
|
|
153
153
|
type: "turn_routed";
|
|
154
|
-
}>
|
|
155
|
-
|
|
154
|
+
}> & {
|
|
155
|
+
seq: number;
|
|
156
|
+
}) | undefined>;
|
|
157
|
+
/** Record the model profile selected for one turn without changing agent history. */
|
|
156
158
|
export declare function recordTurnRoute(args: {
|
|
157
159
|
conversationId: string;
|
|
158
160
|
turnId: string;
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
+
import { Message } from "chat";
|
|
1
2
|
export type ThreadMessageKind = "new_mention" | "subscribed_message";
|
|
2
3
|
/** Derive canonical Slack thread IDs from the raw event payload. */
|
|
4
|
+
/** Rebuild a Message onto a normalized Slack thread id. */
|
|
5
|
+
export declare function withNormalizedThreadId(message: Message, threadId: string): Message;
|
|
3
6
|
export declare function normalizeIncomingSlackThreadId(threadId: string, message: unknown): string;
|
|
4
7
|
/** Classify an incoming message as a mention or subscribed message. */
|
|
5
8
|
export declare function determineThreadMessageKind(args: {
|
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import type { BotConfig } from "@/chat/config";
|
|
3
3
|
import type { TurnReasoningLevel } from "@/chat/reasoning-level";
|
|
4
|
-
export declare const STANDARD_MODEL_PROFILE = "standard";
|
|
5
|
-
export declare const DEFAULT_HANDOFF_MODEL_PROFILE = "handoff";
|
|
6
4
|
/** Keep durable profile names stable and safe to expose in tool schemas. */
|
|
7
5
|
export declare const modelProfileSchema: z.ZodString;
|
|
8
|
-
/** A configured
|
|
6
|
+
/** A configured name for a model. */
|
|
9
7
|
export type ModelProfile = z.output<typeof modelProfileSchema>;
|
|
10
|
-
/** Runtime configuration for one named
|
|
11
|
-
export interface
|
|
8
|
+
/** Runtime configuration for one named model profile. */
|
|
9
|
+
export interface ModelProfileConfig {
|
|
12
10
|
modelId: string;
|
|
13
11
|
reasoningLevel?: TurnReasoningLevel;
|
|
14
12
|
}
|
|
@@ -16,9 +14,9 @@ export interface ExecutionProfileConfig {
|
|
|
16
14
|
export declare class ModelProfileNotConfiguredError extends Error {
|
|
17
15
|
constructor(profile: ModelProfile);
|
|
18
16
|
}
|
|
19
|
-
/** Resolve a
|
|
17
|
+
/** Resolve a model id from a configured profile. */
|
|
20
18
|
export declare function modelIdForProfile(config: BotConfig, profile: ModelProfile): string;
|
|
21
|
-
/** Resolve the
|
|
22
|
-
export declare function
|
|
23
|
-
/**
|
|
24
|
-
export declare function profileConfig(config: BotConfig, profile: ModelProfile):
|
|
19
|
+
/** Resolve the configured default profile's model. */
|
|
20
|
+
export declare function defaultModelId(config: BotConfig): string;
|
|
21
|
+
/** Return one configured profile. */
|
|
22
|
+
export declare function profileConfig(config: BotConfig, profile: ModelProfile): ModelProfileConfig;
|
|
@@ -13,7 +13,7 @@ export interface PiConversationProjection {
|
|
|
13
13
|
messages: PiMessage[];
|
|
14
14
|
provenance: ConversationMessageProvenance[];
|
|
15
15
|
modelProfile: ModelProfile;
|
|
16
|
-
|
|
16
|
+
replacementSeq: number | undefined;
|
|
17
17
|
}
|
|
18
18
|
/** Pi context with the source event sequence for every projected message. */
|
|
19
19
|
export interface PiConversationEventProjection extends PiConversationProjection {
|
|
@@ -32,6 +32,7 @@ export declare function piMessageFromHistoryItem(data: AgentHistoryItem): PiMess
|
|
|
32
32
|
* Host-only events are filtered, completed authorization becomes a synthetic
|
|
33
33
|
* observation, and `maxSeq` reproduces an exact committed boundary.
|
|
34
34
|
*/
|
|
35
|
-
export declare function projectConversationEvents(events: ConversationEvent[], options
|
|
35
|
+
export declare function projectConversationEvents(events: ConversationEvent[], options: {
|
|
36
|
+
defaultProfile: ModelProfile;
|
|
36
37
|
maxSeq?: number;
|
|
37
38
|
}): PiConversationEventProjection;
|
|
@@ -1,5 +1,42 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/** Deploy topic name. Keep stable for Vercel queue wiring. */
|
|
2
3
|
export declare const PLUGIN_TASK_QUEUE_TOPIC = "junior_plugin_tasks";
|
|
3
|
-
export declare const
|
|
4
|
-
|
|
4
|
+
export declare const pluginTaskParamsSchema: z.ZodObject<{
|
|
5
|
+
conversationId: z.ZodString;
|
|
6
|
+
sessionId: z.ZodString;
|
|
7
|
+
}, z.core.$strict>;
|
|
8
|
+
export type PluginTaskParams = z.output<typeof pluginTaskParamsSchema>;
|
|
9
|
+
export declare const pluginTaskQueueMessageSchema: z.ZodObject<{
|
|
10
|
+
name: z.ZodString;
|
|
11
|
+
params: z.ZodObject<{
|
|
12
|
+
conversationId: z.ZodString;
|
|
13
|
+
sessionId: z.ZodString;
|
|
14
|
+
}, z.core.$strict>;
|
|
15
|
+
plugin: z.ZodString;
|
|
16
|
+
}, z.core.$strict>;
|
|
17
|
+
export type PluginTaskQueueMessage = z.output<typeof pluginTaskQueueMessageSchema>;
|
|
18
|
+
/** Build the stable id used for delivery dedupe and tracing. */
|
|
19
|
+
export declare function pluginTaskId(args: {
|
|
20
|
+
name: string;
|
|
21
|
+
params: PluginTaskParams;
|
|
22
|
+
plugin: string;
|
|
23
|
+
}): string;
|
|
24
|
+
/** Sign a plugin task message for tests and local checks. */
|
|
25
|
+
export declare function signPluginTaskQueueMessage(message: PluginTaskQueueMessage, nowMs?: number): {
|
|
26
|
+
name: string;
|
|
27
|
+
params: {
|
|
28
|
+
conversationId: string;
|
|
29
|
+
sessionId: string;
|
|
30
|
+
};
|
|
31
|
+
plugin: string;
|
|
32
|
+
} & {
|
|
33
|
+
signature: string;
|
|
34
|
+
signatureVersion: "v1";
|
|
35
|
+
signedAtMs: number;
|
|
36
|
+
};
|
|
37
|
+
/** Send one plugin task through the shared signed delivery path. */
|
|
5
38
|
export declare function sendVercelPluginTask(message: PluginTaskQueueMessage): Promise<void>;
|
|
39
|
+
/** Create the HTTP callback for plugin tasks. */
|
|
40
|
+
export declare function createVercelPluginTaskCallback(): (request: Request) => Promise<Response>;
|
|
41
|
+
/** Register the local-dev consumer for plugin tasks. */
|
|
42
|
+
export declare function registerVercelPluginTaskDevConsumer(): (() => void) | undefined;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type PluginTaskParams, type PluginTaskQueueMessage } from "./task-
|
|
1
|
+
import { type PluginTaskParams, type PluginTaskQueueMessage } from "./task-queue";
|
|
2
2
|
export interface ScheduleSessionCompletedPluginTasksOptions {
|
|
3
3
|
send?: (message: PluginTaskQueueMessage) => Promise<void>;
|
|
4
4
|
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/** Shared Vercel Queue callback wiring for signed messages. */
|
|
2
|
+
import { type MessageMetadata } from "@vercel/queue";
|
|
3
|
+
import type { QueueRejectReason, QueueVerifyResult } from "./sign";
|
|
4
|
+
export interface QueueCallbackOptions<Message> {
|
|
5
|
+
consumerGroup: string;
|
|
6
|
+
/** Use `null` when durable state already owns the attempt limit. */
|
|
7
|
+
maxDeliveries: number | null;
|
|
8
|
+
onRejected(reason: QueueRejectReason | string, metadata: MessageMetadata, error?: unknown): void;
|
|
9
|
+
permanentError?: (error: unknown) => string | undefined;
|
|
10
|
+
run(message: Message, metadata: MessageMetadata): Promise<void>;
|
|
11
|
+
/**
|
|
12
|
+
* Acknowledge without checking or running the message.
|
|
13
|
+
* Use for kill switches that must not depend on signing secrets.
|
|
14
|
+
*/
|
|
15
|
+
skip?: (metadata: MessageMetadata) => boolean;
|
|
16
|
+
topic: string;
|
|
17
|
+
verify(value: unknown): QueueVerifyResult<Message>;
|
|
18
|
+
visibilityTimeoutSeconds?: number;
|
|
19
|
+
}
|
|
20
|
+
/** Build the HTTP callback and local-dev consumer for one signed queue. */
|
|
21
|
+
export declare function queueCallback<Message>(options: QueueCallbackOptions<Message>): {
|
|
22
|
+
create: () => (requestOrEvent: Request | {
|
|
23
|
+
request: Request;
|
|
24
|
+
}) => Promise<Response>;
|
|
25
|
+
registerDev: () => (() => void) | undefined;
|
|
26
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const QUEUE_SIGNATURE_MAX_AGE_MS: number;
|
|
3
|
+
export type QueueRejectReason = "expired" | "malformed" | "signature_mismatch";
|
|
4
|
+
export type QueueVerifyResult<Message> = {
|
|
5
|
+
status: "verified";
|
|
6
|
+
message: Message;
|
|
7
|
+
} | {
|
|
8
|
+
status: "rejected";
|
|
9
|
+
reason: QueueRejectReason;
|
|
10
|
+
} | {
|
|
11
|
+
status: "unavailable";
|
|
12
|
+
reason: "invalid_clock" | "missing_secret";
|
|
13
|
+
};
|
|
14
|
+
export interface QueueSignConfig<Message extends object, Version extends string> {
|
|
15
|
+
context: string;
|
|
16
|
+
maxAgeMs?: number;
|
|
17
|
+
schema: z.ZodType<Message>;
|
|
18
|
+
/** Kept for jobs that already signed with `:` instead of null bytes. */
|
|
19
|
+
separator?: string;
|
|
20
|
+
signatureVersion: Version;
|
|
21
|
+
parts(message: Message): readonly string[];
|
|
22
|
+
}
|
|
23
|
+
/** Sign one queue message. */
|
|
24
|
+
export declare function signQueueMessage<Message extends object, Version extends string>(config: QueueSignConfig<Message, Version>, message: Message, nowMs?: number): Message & {
|
|
25
|
+
signature: string;
|
|
26
|
+
signatureVersion: Version;
|
|
27
|
+
signedAtMs: number;
|
|
28
|
+
};
|
|
29
|
+
/** Check one signed queue message. */
|
|
30
|
+
export declare function verifyQueueMessage<Message extends object, Version extends string>(config: QueueSignConfig<Message, Version>, value: unknown, nowMs?: number): QueueVerifyResult<Message>;
|
|
@@ -33,8 +33,6 @@ export interface SandboxOptions {
|
|
|
33
33
|
skills: SkillMetadata[];
|
|
34
34
|
referenceFiles: string[];
|
|
35
35
|
timeoutMs?: number;
|
|
36
|
-
/** Durable-worker soft yield for long Workspace snapshot waits. */
|
|
37
|
-
shouldYield?: () => boolean;
|
|
38
36
|
traceContext?: LogContext;
|
|
39
37
|
tracePropagation?: SandboxEgressTracePropagationConfig;
|
|
40
38
|
credentialEgress?: CredentialContext;
|
|
@@ -38,8 +38,6 @@ interface SandboxRuntimeOptions {
|
|
|
38
38
|
skills: SkillMetadata[];
|
|
39
39
|
referenceFiles: string[];
|
|
40
40
|
timeoutMs?: number;
|
|
41
|
-
/** Durable-worker soft yield for long Workspace snapshot waits. */
|
|
42
|
-
shouldYield?: () => boolean;
|
|
43
41
|
traceContext?: LogContext;
|
|
44
42
|
commandEnv?: () => Promise<Record<string, string>>;
|
|
45
43
|
createNetworkPolicy?: (egressId: string, traceHeaders?: TracePropagationHeaders) => NetworkPolicy | undefined;
|
|
@@ -8,7 +8,7 @@ export declare function resolveHostDataPath(referenceFiles: string[], sandboxPat
|
|
|
8
8
|
export declare function isHostFileMissingError(error: unknown): boolean;
|
|
9
9
|
/** Copy the current skill set and reference files into a sandbox. */
|
|
10
10
|
export declare function syncSkillsToSandbox(params: {
|
|
11
|
-
sandbox: SandboxSession
|
|
11
|
+
sandbox: Pick<SandboxSession, "mkDir" | "writeFiles">;
|
|
12
12
|
skills: SkillMetadata[];
|
|
13
13
|
referenceFiles?: string[];
|
|
14
14
|
withSpan: <T>(name: string, op: string, attributes: Record<string, unknown>, callback: () => Promise<T>) => Promise<T>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { ResourceEvent, SubscribableResource } from "@sentry/junior-plugin-api";
|
|
2
|
+
export declare const WORKSPACE_SNAPSHOT_NAMESPACE = "junior";
|
|
3
|
+
export declare const WORKSPACE_SNAPSHOT_RESOURCE_TYPE = "workspace_snapshot";
|
|
4
|
+
export declare const WORKSPACE_SNAPSHOT_READY_EVENT = "workspace_snapshot.ready";
|
|
5
|
+
export declare const WORKSPACE_SNAPSHOT_FAILED_EVENT = "workspace_snapshot.failed";
|
|
6
|
+
/** Describe the events that report when a snapshot build ends. */
|
|
7
|
+
export declare function workspaceSnapshotWatch(input: {
|
|
8
|
+
workspaceId: string;
|
|
9
|
+
workspaceName: string;
|
|
10
|
+
}): SubscribableResource;
|
|
11
|
+
type WorkspaceSnapshotResult = {
|
|
12
|
+
workspaceId: string;
|
|
13
|
+
resultId: string;
|
|
14
|
+
occurredAtMs?: number;
|
|
15
|
+
} & ({
|
|
16
|
+
status: "ready";
|
|
17
|
+
} | {
|
|
18
|
+
status: "failed";
|
|
19
|
+
error?: string | null;
|
|
20
|
+
});
|
|
21
|
+
/** Report that a Workspace snapshot build is ready or failed. */
|
|
22
|
+
export declare function workspaceSnapshotFinishedEvent(input: WorkspaceSnapshotResult): ResourceEvent;
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare const WORKSPACE_SNAPSHOT_JOB_DEV_CONSUMER_GROUP = "junior_workspace_snapshots_dev";
|
|
2
|
+
/** Create the HTTP route for snapshot build messages. */
|
|
3
|
+
export declare function createVercelWorkspaceSnapshotJobCallback(): (request: Request) => Promise<Response>;
|
|
4
|
+
/** Receive snapshot build messages during local development. */
|
|
5
|
+
export declare function registerVercelWorkspaceSnapshotJobDevConsumer(): (() => void) | undefined;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const WORKSPACE_SNAPSHOT_JOB_QUEUE_TOPIC = "junior_workspace_snapshots";
|
|
3
|
+
declare const workspaceSnapshotJobMessageSchema: z.ZodObject<{
|
|
4
|
+
workspaceId: z.ZodString;
|
|
5
|
+
profileHash: z.ZodString;
|
|
6
|
+
}, z.core.$strict>;
|
|
7
|
+
export type WorkspaceSnapshotJobMessage = z.output<typeof workspaceSnapshotJobMessageSchema>;
|
|
8
|
+
/** Sign a Workspace snapshot job for tests and local checks. */
|
|
9
|
+
export declare function signWorkspaceSnapshotJobMessage(message: WorkspaceSnapshotJobMessage, nowMs?: number): {
|
|
10
|
+
workspaceId: string;
|
|
11
|
+
profileHash: string;
|
|
12
|
+
} & {
|
|
13
|
+
signature: string;
|
|
14
|
+
signatureVersion: "v1";
|
|
15
|
+
signedAtMs: number;
|
|
16
|
+
};
|
|
17
|
+
/** Check that a recent queue message came from Junior. */
|
|
18
|
+
export declare function verifyWorkspaceSnapshotJobMessage(value: unknown, nowMs?: number): import("@/chat/queue/sign").QueueVerifyResult<{
|
|
19
|
+
workspaceId: string;
|
|
20
|
+
profileHash: string;
|
|
21
|
+
}>;
|
|
22
|
+
/** Send a job unless the same Workspace build already has one. */
|
|
23
|
+
export declare function sendWorkspaceSnapshotJob(message: WorkspaceSnapshotJobMessage): Promise<void>;
|
|
24
|
+
/** Send the next job for a Workspace build that is still running. */
|
|
25
|
+
export declare function sendNextWorkspaceSnapshotJob(message: WorkspaceSnapshotJobMessage): Promise<void>;
|
|
26
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Workspace } from "@/chat/workspaces/types";
|
|
2
|
+
import { type WorkspaceSnapshotJobMessage } from "./job-queue";
|
|
3
|
+
/** Run a snapshot build and send another job if it needs more time. */
|
|
4
|
+
export declare function processWorkspaceSnapshotJob(message: WorkspaceSnapshotJobMessage, options?: {
|
|
5
|
+
signal?: AbortSignal;
|
|
6
|
+
}): Promise<void>;
|
|
7
|
+
/** Start a snapshot build when no ready snapshot exists. */
|
|
8
|
+
export declare function ensureWorkspaceSnapshotBuild(input: {
|
|
9
|
+
workspace: Workspace;
|
|
10
|
+
sendAgain?: boolean;
|
|
11
|
+
}): Promise<"ready" | "building">;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/** Report that a Workspace snapshot is not ready to use. */
|
|
2
|
+
export declare class WorkspaceSnapshotNotReadyError extends Error {
|
|
3
|
+
constructor(workspaceName: string);
|
|
4
|
+
}
|
|
5
|
+
/** Check an error and its causes for a snapshot that is not ready. */
|
|
6
|
+
export declare function isWorkspaceSnapshotNotReadyError(error: unknown): boolean;
|
|
@@ -1,16 +1,22 @@
|
|
|
1
1
|
import type { Snapshot } from "@/chat/sandbox/snapshot/resolve";
|
|
2
2
|
import { type SandboxSession } from "@/chat/sandbox/workspace";
|
|
3
3
|
import type { Workspace } from "@/chat/workspaces/types";
|
|
4
|
+
/** Return the ready snapshot or report that the Workspace must build one. */
|
|
5
|
+
export declare function requireReadyWorkspaceSnapshot(params: {
|
|
6
|
+
workspace: Workspace;
|
|
7
|
+
runtime: string;
|
|
8
|
+
staleSnapshotId?: string;
|
|
9
|
+
}): Promise<Snapshot>;
|
|
4
10
|
/**
|
|
5
|
-
*
|
|
6
|
-
*
|
|
11
|
+
* Continue a Workspace snapshot build from its saved state.
|
|
12
|
+
* The full build can run for up to one hour.
|
|
7
13
|
*/
|
|
8
14
|
export declare function resolveWorkspaceSnapshot(params: {
|
|
9
15
|
workspace: Workspace;
|
|
10
16
|
runtime: string;
|
|
11
17
|
staleSnapshotId?: string;
|
|
12
18
|
signal?: AbortSignal;
|
|
13
|
-
|
|
19
|
+
shouldStop?: () => boolean;
|
|
14
20
|
applyNetworkPolicy(sandbox: SandboxSession): Promise<unknown>;
|
|
15
21
|
prepareRepositories?(sandbox: SandboxSession, workspace: Workspace, signal?: AbortSignal): Promise<void>;
|
|
16
22
|
removeCredentialRoute: boolean;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
/** Viewer-scoped scheduled-task queries and mutations. */
|
|
2
2
|
import type { User } from "@sentry/junior-plugin-api";
|
|
3
|
-
import type {
|
|
3
|
+
import type { JuniorDatabase } from "@/db/db";
|
|
4
4
|
import type { ScheduledTask } from "./types";
|
|
5
|
-
type PersonalScheduledTaskStore = Pick<SchedulerStore, "getTask" | "listTasksCreatedBy" | "saveTask">;
|
|
6
5
|
export interface ViewerScheduledTaskPage {
|
|
7
6
|
nextCursor?: string;
|
|
8
7
|
tasks: ScheduledTask[];
|
|
@@ -18,9 +17,7 @@ export declare class InvalidScheduledTaskCursorError extends Error {
|
|
|
18
17
|
export declare class PersonalScheduledTaskNotFoundError extends Error {
|
|
19
18
|
constructor();
|
|
20
19
|
}
|
|
21
|
-
/**
|
|
22
|
-
export declare function
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
};
|
|
26
|
-
export {};
|
|
20
|
+
/** Delete one scheduled task created by the viewer. */
|
|
21
|
+
export declare function deleteViewerScheduledTask(db: JuniorDatabase, user: User, id: string, nowMs?: number): Promise<void>;
|
|
22
|
+
/** List scheduled tasks created by the viewer with a stable SQL cursor. */
|
|
23
|
+
export declare function listViewerScheduledTasks(db: JuniorDatabase, user: User, input: ViewerScheduledTaskPageInput): Promise<ViewerScheduledTaskPage>;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type { JuniorDatabase } from "@/db/db";
|
|
2
|
+
import { type ScheduledRun } from "./types";
|
|
3
|
+
/** List incomplete runs for retained scheduled tasks. */
|
|
4
|
+
export declare function listIncompleteScheduledRuns(db: JuniorDatabase): Promise<ScheduledRun[]>;
|
|
5
|
+
/** Claim one due scheduler run under the deployed global claim lock. */
|
|
6
|
+
export declare function claimDueScheduledRun(db: JuniorDatabase, args: {
|
|
7
|
+
nowMs: number;
|
|
8
|
+
}): Promise<ScheduledRun | undefined>;
|
|
9
|
+
/** Mark a pending run dispatched only for the active claim. */
|
|
10
|
+
export declare function markScheduledRunDispatched(db: JuniorDatabase, args: {
|
|
11
|
+
claimedAtMs: number;
|
|
12
|
+
dispatchId: string;
|
|
13
|
+
nowMs: number;
|
|
14
|
+
runId: string;
|
|
15
|
+
}): Promise<ScheduledRun | undefined>;
|
|
16
|
+
/** Complete a run only for its active start timestamp. */
|
|
17
|
+
export declare function markScheduledRunCompleted(db: JuniorDatabase, args: {
|
|
18
|
+
completedAtMs: number;
|
|
19
|
+
resultMessageTs?: string;
|
|
20
|
+
runId: string;
|
|
21
|
+
startedAtMs: number;
|
|
22
|
+
}): Promise<ScheduledRun | undefined>;
|
|
23
|
+
/** Fail a claimed or running run only for its active transition guard. */
|
|
24
|
+
export declare function markScheduledRunFailed(db: JuniorDatabase, args: {
|
|
25
|
+
completedAtMs: number;
|
|
26
|
+
errorMessage: string;
|
|
27
|
+
startedAtMs?: number;
|
|
28
|
+
runId: string;
|
|
29
|
+
}): Promise<ScheduledRun | undefined>;
|
|
30
|
+
/** Block a claimed or running run only for its active transition guard. */
|
|
31
|
+
export declare function markScheduledRunBlocked(db: JuniorDatabase, args: {
|
|
32
|
+
completedAtMs: number;
|
|
33
|
+
errorMessage: string;
|
|
34
|
+
runId: string;
|
|
35
|
+
startedAtMs?: number;
|
|
36
|
+
}): Promise<ScheduledRun | undefined>;
|
|
37
|
+
/** Skip a pending run only before dispatch begins. */
|
|
38
|
+
export declare function markScheduledRunSkipped(db: JuniorDatabase, args: {
|
|
39
|
+
completedAtMs: number;
|
|
40
|
+
errorMessage: string;
|
|
41
|
+
runId: string;
|
|
42
|
+
}): Promise<ScheduledRun | undefined>;
|
|
43
|
+
/** Advance a scheduled task after a terminal run under its task lock. */
|
|
44
|
+
export declare function advanceScheduledTaskAfterRun(db: JuniorDatabase, args: {
|
|
45
|
+
errorMessage?: string;
|
|
46
|
+
nowMs: number;
|
|
47
|
+
run: ScheduledRun;
|
|
48
|
+
status: "blocked" | "completed" | "failed";
|
|
49
|
+
}): Promise<void>;
|
|
@@ -11,9 +11,9 @@ export declare const scheduleIntentSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
|
11
11
|
type: z.ZodLiteral<"after">;
|
|
12
12
|
value: z.ZodNumber;
|
|
13
13
|
unit: z.ZodEnum<{
|
|
14
|
-
day: "day";
|
|
15
14
|
hour: "hour";
|
|
16
15
|
minute: "minute";
|
|
16
|
+
day: "day";
|
|
17
17
|
second: "second";
|
|
18
18
|
week: "week";
|
|
19
19
|
}>;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { JuniorDatabase } from "@/db/db";
|
|
2
|
+
import { juniorSchedulerTasks } from "@/db/schema/scheduled-tasks";
|
|
3
|
+
import { type ScheduledTask } from "./types";
|
|
4
|
+
type ScheduledTaskRow = Pick<typeof juniorSchedulerTasks.$inferSelect, "creatorIdentityId" | "record" | "title">;
|
|
5
|
+
/** Decode a retained scheduler task row and reject invalid routing context. */
|
|
6
|
+
export declare function parseScheduledTaskRow(row: ScheduledTaskRow): ScheduledTask | undefined;
|
|
7
|
+
/** Keep scan paths from returning current or legacy tombstones. */
|
|
8
|
+
export declare function isListedScheduledTask(task: ScheduledTask | undefined): task is ScheduledTask;
|
|
9
|
+
/** Build the stable run id for one task occurrence. */
|
|
10
|
+
export declare function scheduledRunId(taskId: string, scheduledForMs: number): string;
|
|
11
|
+
/** Acquire the deployed advisory lock for one scheduled task. */
|
|
12
|
+
export declare function withScheduledTaskLock<T>(db: JuniorDatabase, taskId: string, callback: (db: JuniorDatabase) => Promise<T>): Promise<T>;
|
|
13
|
+
/** Read and decode one scheduled task. */
|
|
14
|
+
export declare function readScheduledTask(db: JuniorDatabase, taskId: string): Promise<ScheduledTask | undefined>;
|
|
15
|
+
/** List decoded scheduled tasks in stable creation order. */
|
|
16
|
+
export declare function listScheduledTasks(db: JuniorDatabase): Promise<ScheduledTask[]>;
|
|
17
|
+
/** List decoded scheduled tasks for one team in stable creation order. */
|
|
18
|
+
export declare function listScheduledTasksForTeam(db: JuniorDatabase, teamId: string): Promise<ScheduledTask[]>;
|
|
19
|
+
/** Create a scheduled task once under its retry-stable task lock. */
|
|
20
|
+
export declare function createScheduledTask(db: JuniorDatabase, task: ScheduledTask): Promise<ScheduledTask>;
|
|
21
|
+
/** Save a scheduled task and clear its blocked occurrence on reactivation. */
|
|
22
|
+
export declare function saveScheduledTask(db: JuniorDatabase, task: ScheduledTask): Promise<ScheduledTask>;
|
|
23
|
+
/** Save a scheduled task inside a task lock already held by the caller. */
|
|
24
|
+
export declare function saveScheduledTaskInLock(db: JuniorDatabase, task: ScheduledTask, current: ScheduledTask | undefined): Promise<void>;
|
|
25
|
+
/** List scheduled tasks whose current Slack destination is public. */
|
|
26
|
+
export declare function listPublicScheduledTasksForTeams(db: JuniorDatabase, teamIds: string[], limit: number): Promise<ScheduledTask[]>;
|
|
27
|
+
export {};
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
import { type Identity, type SlackDestination, type SlackActor, type SlackSource, type User } from "@sentry/junior-plugin-api";
|
|
2
2
|
import { z } from "zod";
|
|
3
|
-
import { type SchedulerStore } from "./store";
|
|
4
3
|
import type { ScheduledTask, ScheduledTaskConversationAccess, ScheduledTaskPrincipal, ScheduledTaskStatus } from "./types";
|
|
5
4
|
export interface SchedulerToolContext {
|
|
6
5
|
actor?: SlackActor;
|
|
7
6
|
now?: () => number;
|
|
8
7
|
source?: SlackSource;
|
|
9
|
-
store: SchedulerStore;
|
|
10
8
|
users: {
|
|
11
9
|
resolveActor(): Promise<{
|
|
12
10
|
identity: Identity;
|
|
@@ -226,8 +224,6 @@ export declare function buildTaskId(args: {
|
|
|
226
224
|
destination: SlackDestination;
|
|
227
225
|
toolCallId: string | undefined;
|
|
228
226
|
}): string;
|
|
229
|
-
/** Keep concrete scheduler tools coupled to the injected store, not global state. */
|
|
230
|
-
export declare function schedulerStore(context: SchedulerToolContext): SchedulerStore;
|
|
231
227
|
/** Accept only persisted scheduler statuses from model-facing update input. */
|
|
232
228
|
export declare function normalizeStatus(value: string | undefined): ScheduledTaskStatus | undefined;
|
|
233
229
|
/** Centralize scheduler timezone defaulting for all concrete tool entry points. */
|
|
@@ -20,7 +20,7 @@ export declare function createSlackScheduleCreateTaskTool(context: SchedulerTool
|
|
|
20
20
|
timing: {
|
|
21
21
|
type: "after";
|
|
22
22
|
value: number;
|
|
23
|
-
unit: "
|
|
23
|
+
unit: "hour" | "minute" | "day" | "second" | "week";
|
|
24
24
|
} | {
|
|
25
25
|
type: "at";
|
|
26
26
|
date: string;
|
|
@@ -21,7 +21,7 @@ export declare function createSlackScheduleUpdateTaskTool(context: SchedulerTool
|
|
|
21
21
|
timing: {
|
|
22
22
|
type: "after";
|
|
23
23
|
value: number;
|
|
24
|
-
unit: "
|
|
24
|
+
unit: "hour" | "minute" | "day" | "second" | "week";
|
|
25
25
|
} | {
|
|
26
26
|
type: "at";
|
|
27
27
|
date: string;
|