@sentry/junior 0.75.0 → 0.76.1
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/README.md +1 -1
- package/bin/junior.mjs +4 -66
- package/dist/agent-hooks-ZOE7RIED.js +37 -0
- package/dist/api-reference.d.ts +2 -0
- package/dist/app.js +364 -135
- package/dist/build/virtual-config.d.ts +2 -2
- package/dist/chat/agent-dispatch/runner.d.ts +2 -0
- package/dist/chat/config.d.ts +1 -0
- package/dist/chat/credentials/state-adapter-token-store.d.ts +2 -0
- package/dist/chat/credentials/user-token-store.d.ts +17 -12
- package/dist/chat/db.d.ts +8 -0
- package/dist/chat/mcp/auth-store.d.ts +2 -1
- package/dist/chat/mcp/oauth.d.ts +2 -1
- package/dist/chat/oauth-flow.d.ts +3 -1
- package/dist/chat/pi/client.d.ts +15 -7
- package/dist/chat/plugins/agent-hooks.d.ts +7 -0
- package/dist/chat/plugins/auth/oauth-request.d.ts +11 -7
- package/dist/chat/plugins/model.d.ts +9 -0
- package/dist/chat/plugins/prompt.d.ts +5 -0
- package/dist/chat/plugins/task-callback.d.ts +5 -0
- package/dist/chat/plugins/task-message.d.ts +23 -0
- package/dist/chat/plugins/task-queue.d.ts +5 -0
- package/dist/chat/plugins/task-runner.d.ts +12 -0
- package/dist/chat/plugins/task-signing.d.ts +31 -0
- package/dist/chat/prompt.d.ts +4 -0
- package/dist/chat/requester.d.ts +6 -5
- package/dist/chat/respond-helpers.d.ts +2 -0
- package/dist/chat/respond.d.ts +4 -2
- package/dist/chat/runtime/agent-continue-runner.d.ts +4 -0
- package/dist/chat/runtime/reply-executor.d.ts +5 -1
- package/dist/chat/runtime/slack-resume.d.ts +10 -2
- package/dist/chat/sentry.d.ts +1 -0
- package/dist/chat/services/mcp-auth-orchestration.d.ts +2 -1
- package/dist/chat/services/plugin-auth-orchestration.d.ts +2 -1
- package/dist/chat/services/subscribed-decision.d.ts +2 -2
- package/dist/chat/services/turn-session-record.d.ts +11 -7
- package/dist/chat/slack/footer.d.ts +1 -1
- package/dist/chat/state/turn-session.d.ts +8 -5
- package/dist/chat/tools/agent-tools.d.ts +8 -1
- package/dist/chat/tools/slack/context.d.ts +2 -2
- package/dist/chat/tools/types.d.ts +4 -4
- package/dist/chat/vercel-queue-client.d.ts +3 -0
- package/dist/{chunk-C3AM4Z4J.js → chunk-2ECJXSVQ.js} +5 -5
- package/dist/{chunk-OJODNL2P.js → chunk-4SCWV7TJ.js} +2 -2
- package/dist/chunk-4UO6FK4G.js +64 -0
- package/dist/{chunk-BNJIEFQC.js → chunk-56TBVRJG.js} +2 -2
- package/dist/{chunk-OK4KKR7B.js → chunk-EJN6G5A2.js} +28 -12
- package/dist/{chunk-TQ74BATR.js → chunk-FFGXUXMD.js} +435 -111
- package/dist/{chunk-XJHDZUGD.js → chunk-JBASI5VV.js} +4 -4
- package/dist/chunk-KNFROR7R.js +127 -0
- package/dist/{chunk-VNTLUFTY.js → chunk-KOIMO7S3.js} +126 -87
- package/dist/chunk-MLKGABMK.js +9 -0
- package/dist/{chunk-NPVUAXUE.js → chunk-NFTMTIP3.js} +303 -33
- package/dist/chunk-NYKJ3KON.js +1082 -0
- package/dist/{chunk-SJHUF3DP.js → chunk-OJ53FYVG.js} +2 -10
- package/dist/{chunk-62FUNJYS.js → chunk-Q6XFTRV5.js} +54 -3
- package/dist/{chunk-UJ7OTHPO.js → chunk-R6Z5XWY3.js} +12 -670
- package/dist/chunk-RV5RYIJW.js +56 -0
- package/dist/{chunk-EE6PJWY4.js → chunk-SG5WAA7H.js} +7 -5
- package/dist/chunk-ST6YNAXG.js +54 -0
- package/dist/{chunk-FCZO7LAR.js → chunk-T77LUIX3.js} +139 -153
- package/dist/{chunk-EIYL7I4S.js → chunk-VALUBQ7R.js} +22 -30
- package/dist/{chunk-OZSPLAQ4.js → chunk-XBBC6W45.js} +1 -1
- package/dist/{chunk-ZNNTSPNF.js → chunk-Y5OFBCBZ.js} +1 -1
- package/dist/{chunk-74HO27II.js → chunk-Z4CIQ3EB.js} +5 -1
- package/dist/{chunk-2RWFUS5F.js → chunk-ZLMBNBUG.js} +101 -44
- package/dist/{chunk-JEELK46E.js → chunk-ZQB37HUX.js} +11 -11
- package/dist/cli/chat.js +52 -23
- package/dist/cli/check.js +7 -7
- package/dist/cli/env.js +4 -53
- package/dist/cli/init.js +6 -1
- package/dist/cli/main.js +84 -0
- package/dist/cli/plugins.js +244 -0
- package/dist/cli/run.js +5 -52
- package/dist/cli/snapshot-warmup.js +9 -9
- package/dist/cli/upgrade.js +167 -48
- package/dist/db-7A7PFRGL.js +17 -0
- package/dist/deployment.d.ts +1 -0
- package/dist/instrumentation.js +14 -18
- package/dist/nitro.d.ts +1 -1
- package/dist/nitro.js +43 -22
- package/dist/plugins-PZMDS7AT.js +15 -0
- package/dist/plugins.d.ts +4 -2
- package/dist/{registry-NLZFIW23.js → registry-OIPAJU2O.js} +6 -6
- package/dist/reporting.js +34 -26
- package/dist/{runner-LUQZ5G67.js → runner-7Z4D6AKV.js} +76 -23
- package/dist/sentry-4CP5NNQ5.js +31 -0
- package/dist/validation-SLA6IGF7.js +15 -0
- package/dist/vercel.js +1 -1
- package/package.json +8 -7
- package/dist/agent-hooks-2HEB4C3Q.js +0 -33
- package/dist/chat/conversations/configured.d.ts +0 -7
- package/dist/chat/conversations/state.d.ts +0 -4
- package/dist/chat/plugins/db.d.ts +0 -31
- package/dist/chunk-2KG3PWR4.js +0 -17
- package/dist/chunk-D7NFH5GD.js +0 -570
- package/dist/chunk-MCMROINU.js +0 -12
- package/dist/chunk-WBZ4M5N5.js +0 -59
- package/dist/db-A3ILH67H.js +0 -20
- package/dist/plugins-OMJKLRJ2.js +0 -13
- package/dist/validation-VMCPP3YO.js +0 -15
|
@@ -9,12 +9,12 @@ export interface RuntimePluginModule {
|
|
|
9
9
|
export declare function renderVirtualConfig(options: {
|
|
10
10
|
plugins?: PluginCatalogConfig;
|
|
11
11
|
pluginModule?: RuntimePluginModule;
|
|
12
|
-
|
|
12
|
+
pluginRuntimeRegistrations?: string[];
|
|
13
13
|
}): string;
|
|
14
14
|
/** Inject a virtual module so createApp() can read the plugin list at runtime. */
|
|
15
15
|
export declare function injectVirtualConfig(nitro: Nitro, options?: {
|
|
16
16
|
loadPluginSet?: () => Promise<JuniorPluginSet | undefined>;
|
|
17
17
|
pluginModule?: RuntimePluginModule;
|
|
18
18
|
plugins?: PluginCatalogConfig;
|
|
19
|
-
|
|
19
|
+
pluginRuntimeRegistrations?: string[];
|
|
20
20
|
}): void;
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { generateAssistantReply as generateAssistantReplyImpl } from "@/chat/respond";
|
|
2
2
|
import type { SandboxEgressTracePropagationConfig } from "@/chat/sandbox/egress-tracing";
|
|
3
|
+
import { scheduleSessionCompletedPluginTasks } from "@/chat/plugins/task-runner";
|
|
3
4
|
import { scheduleDispatchCallback } from "./signing";
|
|
4
5
|
import type { DispatchCallback } from "./types";
|
|
5
6
|
export interface AgentDispatchRunnerDeps {
|
|
6
7
|
generateAssistantReply?: typeof generateAssistantReplyImpl;
|
|
7
8
|
scheduleCallback?: typeof scheduleDispatchCallback;
|
|
9
|
+
scheduleSessionCompletedPluginTasks?: typeof scheduleSessionCompletedPluginTasks;
|
|
8
10
|
tracePropagation?: SandboxEgressTracePropagationConfig;
|
|
9
11
|
}
|
|
10
12
|
/** Run one serverless slice for a core-owned agent dispatch. */
|
package/dist/chat/config.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ export type AdvisorThinkingLevel = (typeof ADVISOR_THINKING_LEVELS)[number];
|
|
|
7
7
|
export declare const FUNCTION_TIMEOUT_BUFFER_SECONDS = 20;
|
|
8
8
|
export interface BotConfig {
|
|
9
9
|
advisor: AdvisorConfig;
|
|
10
|
+
embeddingModelId: string;
|
|
10
11
|
fastModelId: string;
|
|
11
12
|
loadingMessages: string[];
|
|
12
13
|
modelId: string;
|
|
@@ -6,4 +6,6 @@ export declare class StateAdapterTokenStore implements UserTokenStore {
|
|
|
6
6
|
get(userId: string, provider: string): Promise<StoredTokens | undefined>;
|
|
7
7
|
set(userId: string, provider: string, tokens: StoredTokens): Promise<void>;
|
|
8
8
|
delete(userId: string, provider: string): Promise<void>;
|
|
9
|
+
/** Wait for the per-slot refresh gate so rotated refresh tokens are used once. */
|
|
10
|
+
withRefresh<T>(userId: string, provider: string, callback: () => Promise<T>): Promise<T>;
|
|
9
11
|
}
|
|
@@ -1,17 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
accessToken:
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
1
|
+
import { type PluginProviderAccount, type PluginStoredTokens } from "@sentry/junior-plugin-api";
|
|
2
|
+
export declare const storedTokensSchema: import("zod").ZodObject<{
|
|
3
|
+
account: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
4
|
+
id: import("zod").ZodString;
|
|
5
|
+
label: import("zod").ZodOptional<import("zod").ZodString>;
|
|
6
|
+
url: import("zod").ZodOptional<import("zod").ZodString>;
|
|
7
|
+
}, import("zod/v4/core").$strict>>;
|
|
8
|
+
accessToken: import("zod").ZodString;
|
|
9
|
+
expiresAt: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
10
|
+
refreshToken: import("zod").ZodString;
|
|
11
|
+
refreshTokenExpiresAt: import("zod").ZodOptional<import("zod").ZodNumber>;
|
|
12
|
+
scope: import("zod").ZodOptional<import("zod").ZodString>;
|
|
13
|
+
}, import("zod/v4/core").$strict>;
|
|
14
|
+
export type StoredProviderAccount = PluginProviderAccount;
|
|
15
|
+
export type StoredTokens = PluginStoredTokens;
|
|
13
16
|
export interface UserTokenStore {
|
|
14
17
|
get(userId: string, provider: string): Promise<StoredTokens | undefined>;
|
|
15
18
|
set(userId: string, provider: string, tokens: StoredTokens): Promise<void>;
|
|
16
19
|
delete(userId: string, provider: string): Promise<void>;
|
|
20
|
+
/** Run refresh-token rotation for one user/provider slot, or throw after a bounded wait. */
|
|
21
|
+
withRefresh<T>(userId: string, provider: string, callback: () => Promise<T>): Promise<T>;
|
|
17
22
|
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ConversationStore } from "@/chat/conversations/store";
|
|
2
|
+
import type { JuniorDatabase } from "@/chat/sql/db";
|
|
3
|
+
/** Return the process Drizzle database. */
|
|
4
|
+
export declare function getDb(): JuniorDatabase;
|
|
5
|
+
/** Return the SQL-backed conversation store. */
|
|
6
|
+
export declare function getConversationStore(): ConversationStore;
|
|
7
|
+
/** Close the process SQL database when it has been opened. */
|
|
8
|
+
export declare function closeDb(): Promise<void>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { OAuthClientInformationMixed, OAuthTokens } from "@modelcontextprotocol/sdk/shared/auth.js";
|
|
2
2
|
import type { OAuthDiscoveryState } from "@modelcontextprotocol/sdk/client/auth.js";
|
|
3
|
-
import type
|
|
3
|
+
import { type Destination, type Source } from "@sentry/junior-plugin-api";
|
|
4
4
|
import type { ThreadArtifactsState } from "@/chat/state/artifacts";
|
|
5
5
|
export interface McpAuthSessionState {
|
|
6
6
|
authSessionId: string;
|
|
@@ -8,6 +8,7 @@ export interface McpAuthSessionState {
|
|
|
8
8
|
userId: string;
|
|
9
9
|
conversationId: string;
|
|
10
10
|
destination?: Destination;
|
|
11
|
+
source?: Source;
|
|
11
12
|
sessionId: string;
|
|
12
13
|
userMessage: string;
|
|
13
14
|
channelId?: string;
|
package/dist/chat/mcp/oauth.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Destination } from "@sentry/junior-plugin-api";
|
|
1
|
+
import type { Destination, Source } from "@sentry/junior-plugin-api";
|
|
2
2
|
import type { ThreadArtifactsState } from "@/chat/state/artifacts";
|
|
3
3
|
import { type McpAuthSessionState } from "./auth-store";
|
|
4
4
|
import { StateBackedMcpOAuthClientProvider } from "./oauth-provider";
|
|
@@ -7,6 +7,7 @@ export declare function createMcpOAuthClientProvider(input: {
|
|
|
7
7
|
provider: string;
|
|
8
8
|
conversationId: string;
|
|
9
9
|
destination?: Destination;
|
|
10
|
+
source?: Source;
|
|
10
11
|
sessionId: string;
|
|
11
12
|
userId: string;
|
|
12
13
|
userMessage: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type Destination, type Source } from "@sentry/junior-plugin-api";
|
|
2
2
|
import type { ChannelConfigurationService } from "@/chat/configuration/types";
|
|
3
3
|
type PrivateDeliveryResult = "in_context" | "fallback_dm" | false;
|
|
4
4
|
export type OAuthStatePayload = {
|
|
@@ -6,6 +6,7 @@ export type OAuthStatePayload = {
|
|
|
6
6
|
provider: string;
|
|
7
7
|
channelId?: string;
|
|
8
8
|
destination?: Destination;
|
|
9
|
+
source?: Source;
|
|
9
10
|
threadTs?: string;
|
|
10
11
|
pendingMessage?: string;
|
|
11
12
|
configuration?: Record<string, unknown>;
|
|
@@ -17,6 +18,7 @@ type OAuthFlowInput = {
|
|
|
17
18
|
requesterId: string;
|
|
18
19
|
channelId?: string;
|
|
19
20
|
destination?: Destination;
|
|
21
|
+
source?: Source;
|
|
20
22
|
threadTs?: string;
|
|
21
23
|
userMessage?: string;
|
|
22
24
|
channelConfiguration?: ChannelConfigurationService;
|
package/dist/chat/pi/client.d.ts
CHANGED
|
@@ -9,11 +9,8 @@ export declare const MISSING_GATEWAY_CREDENTIALS_ERROR = "Missing AI gateway cre
|
|
|
9
9
|
* the bearer token string directly.
|
|
10
10
|
*/
|
|
11
11
|
export declare function getGatewayApiKey(): string | undefined;
|
|
12
|
-
/**
|
|
13
|
-
|
|
14
|
-
* token when auth comes from VERCEL_OIDC_TOKEN.
|
|
15
|
-
*/
|
|
16
|
-
export declare function getPiGatewayApiKeyOverride(): string | undefined;
|
|
12
|
+
/** Return the Gateway credential shape expected by Pi Agent getApiKey hooks. */
|
|
13
|
+
export declare function getPiGatewayApiKey(): string | undefined;
|
|
17
14
|
/**
|
|
18
15
|
* Look up a gateway model by id. Throws `Unknown AI Gateway model id: …` if
|
|
19
16
|
* the id is not in pi-ai's registry — callers at the config boundary can use
|
|
@@ -35,7 +32,7 @@ export declare function completeText(params: {
|
|
|
35
32
|
message: import("@earendil-works/pi-ai").AssistantMessage;
|
|
36
33
|
text: string;
|
|
37
34
|
}>;
|
|
38
|
-
/** Execute a schema-constrained completion using the
|
|
35
|
+
/** Execute a schema-constrained completion using the AI SDK structured output path. */
|
|
39
36
|
export declare function completeObject<TSchema extends ZodTypeAny>(params: {
|
|
40
37
|
modelId: string;
|
|
41
38
|
schema: TSchema;
|
|
@@ -48,5 +45,16 @@ export declare function completeObject<TSchema extends ZodTypeAny>(params: {
|
|
|
48
45
|
metadata?: Record<string, unknown>;
|
|
49
46
|
}): Promise<{
|
|
50
47
|
object: z.infer<TSchema>;
|
|
51
|
-
|
|
48
|
+
}>;
|
|
49
|
+
/** Generate text embeddings through the host-owned AI Gateway provider. */
|
|
50
|
+
export declare function embedTexts(params: {
|
|
51
|
+
modelId: string;
|
|
52
|
+
texts: string[];
|
|
53
|
+
signal?: AbortSignal;
|
|
54
|
+
metadata?: Record<string, unknown>;
|
|
55
|
+
}): Promise<{
|
|
56
|
+
dimensions: number;
|
|
57
|
+
model: string;
|
|
58
|
+
provider: string;
|
|
59
|
+
vectors: number[][];
|
|
52
60
|
}>;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { PluginConversations, PluginRoute, PluginOperationalReport, SlackConversationLink, PluginRegistration } from "@sentry/junior-plugin-api";
|
|
2
|
+
import type { PluginPromptContributionContext } from "@/chat/plugins/prompt";
|
|
2
3
|
import type { ToolDefinition } from "@/chat/tools/definition";
|
|
3
4
|
import type { ToolRuntimeContext } from "@/chat/tools/types";
|
|
4
5
|
import type { SandboxInstance } from "@/chat/sandbox/workspace";
|
|
@@ -28,6 +29,12 @@ export declare function validatePlugins(plugins: PluginRegistration[]): void;
|
|
|
28
29
|
export declare function setPlugins(nextPlugins: PluginRegistration[]): PluginRegistration[];
|
|
29
30
|
/** Return the current runtime hook plugins without exposing mutable state. */
|
|
30
31
|
export declare function getPlugins(): PluginRegistration[];
|
|
32
|
+
/** Collect stable plugin prompt contributions for the static system prompt. */
|
|
33
|
+
export declare function getPluginSystemPromptContributions(source: ToolRuntimeContext["source"]): Promise<PluginPromptContributionContext[]>;
|
|
34
|
+
/** Collect request-scoped plugin prompt contributions. */
|
|
35
|
+
export declare function getPluginUserPromptContributions(args: {
|
|
36
|
+
context: Pick<ToolRuntimeContext, "conversationId" | "destination" | "requester" | "source" | "userText">;
|
|
37
|
+
}): Promise<PluginPromptContributionContext[]>;
|
|
31
38
|
/** Collect turn-scoped tools exposed by plugins. */
|
|
32
39
|
export declare function getPluginTools(context: ToolRuntimeContext): Record<string, ToolDefinition<any>>;
|
|
33
40
|
/** Collect route handlers exposed by plugins for app-level mounting. */
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
1
2
|
type OAuthTokenRequestInput = {
|
|
2
3
|
clientId: string;
|
|
3
4
|
clientSecret: string;
|
|
@@ -5,16 +6,19 @@ type OAuthTokenRequestInput = {
|
|
|
5
6
|
tokenAuthMethod?: "body" | "basic";
|
|
6
7
|
tokenExtraHeaders?: Record<string, string>;
|
|
7
8
|
};
|
|
9
|
+
declare const parsedOAuthTokenResponseSchema: z.ZodObject<{
|
|
10
|
+
accessToken: z.ZodString;
|
|
11
|
+
refreshToken: z.ZodString;
|
|
12
|
+
expiresAt: z.ZodOptional<z.ZodNumber>;
|
|
13
|
+
refreshTokenExpiresAt: z.ZodOptional<z.ZodNumber>;
|
|
14
|
+
scope: z.ZodOptional<z.ZodString>;
|
|
15
|
+
}, z.core.$strict>;
|
|
16
|
+
export type OAuthTokenResponse = z.output<typeof parsedOAuthTokenResponseSchema>;
|
|
8
17
|
export declare function buildOAuthTokenRequest(input: OAuthTokenRequestInput): {
|
|
9
18
|
headers: Record<string, string>;
|
|
10
19
|
body: BodyInit;
|
|
11
20
|
};
|
|
12
|
-
export declare function parseOAuthTokenResponse(data:
|
|
21
|
+
export declare function parseOAuthTokenResponse(data: unknown, requestedScope?: string, options?: {
|
|
13
22
|
treatEmptyScopeAsUnreported?: boolean;
|
|
14
|
-
}):
|
|
15
|
-
accessToken: string;
|
|
16
|
-
refreshToken: string;
|
|
17
|
-
expiresAt?: number;
|
|
18
|
-
scope?: string;
|
|
19
|
-
};
|
|
23
|
+
}): OAuthTokenResponse;
|
|
20
24
|
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { PluginEmbedder, PluginModel, PluginModelConfig } from "@sentry/junior-plugin-api";
|
|
2
|
+
/** Create the host-owned structured model capability exposed to plugins. */
|
|
3
|
+
export declare function createPluginModel(pluginName: string, options?: PluginModelConfig, runtime?: {
|
|
4
|
+
signal?: AbortSignal;
|
|
5
|
+
}): PluginModel;
|
|
6
|
+
/** Create the host-owned embedding capability exposed to prompt hooks. */
|
|
7
|
+
export declare function createPluginEmbedder(pluginName: string, runtime?: {
|
|
8
|
+
signal?: AbortSignal;
|
|
9
|
+
}): PluginEmbedder;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare const PLUGIN_TASK_DEV_CONSUMER_GROUP = "junior_plugin_tasks_dev";
|
|
2
|
+
/** Create the Vercel Queue push callback for plugin background tasks. */
|
|
3
|
+
export declare function createVercelPluginTaskCallback(): (request: Request) => Promise<Response>;
|
|
4
|
+
/** Register the Vercel Queue local-dev consumer for plugin background tasks. */
|
|
5
|
+
export declare function registerVercelPluginTaskDevConsumer(): (() => void) | undefined;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const pluginTaskParamsSchema: z.ZodObject<{
|
|
3
|
+
conversationId: z.ZodString;
|
|
4
|
+
sessionId: z.ZodString;
|
|
5
|
+
}, z.core.$strict>;
|
|
6
|
+
export type PluginTaskParams = z.output<typeof pluginTaskParamsSchema>;
|
|
7
|
+
export declare const pluginTaskQueueMessageSchema: z.ZodObject<{
|
|
8
|
+
name: z.ZodString;
|
|
9
|
+
params: z.ZodObject<{
|
|
10
|
+
conversationId: z.ZodString;
|
|
11
|
+
sessionId: z.ZodString;
|
|
12
|
+
}, z.core.$strict>;
|
|
13
|
+
plugin: z.ZodString;
|
|
14
|
+
}, z.core.$strict>;
|
|
15
|
+
export type PluginTaskQueueMessage = z.output<typeof pluginTaskQueueMessageSchema>;
|
|
16
|
+
/** Build the stable task id used for queue idempotency and tracing. */
|
|
17
|
+
export declare function pluginTaskId(args: {
|
|
18
|
+
name: string;
|
|
19
|
+
params: PluginTaskParams;
|
|
20
|
+
plugin: string;
|
|
21
|
+
}): string;
|
|
22
|
+
/** Parse the bounded queue payload accepted by the plugin task callback. */
|
|
23
|
+
export declare function parsePluginTaskQueueMessage(value: unknown): PluginTaskQueueMessage | undefined;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { type PluginTaskQueueMessage } from "./task-message";
|
|
2
|
+
export declare const PLUGIN_TASK_QUEUE_TOPIC = "junior_plugin_tasks";
|
|
3
|
+
export declare const PLUGIN_TASK_QUEUE_RETENTION_SECONDS: number;
|
|
4
|
+
/** Send one plugin task wakeup through Vercel Queues. */
|
|
5
|
+
export declare function sendVercelPluginTask(message: PluginTaskQueueMessage): Promise<void>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type PluginTaskParams, type PluginTaskQueueMessage } from "./task-message";
|
|
2
|
+
export interface ScheduleSessionCompletedPluginTasksOptions {
|
|
3
|
+
send?: (message: PluginTaskQueueMessage) => Promise<void>;
|
|
4
|
+
}
|
|
5
|
+
interface ProcessPluginTaskOptions {
|
|
6
|
+
signal?: AbortSignal;
|
|
7
|
+
}
|
|
8
|
+
/** Schedule all plugin tasks interested in a completed agent-run session. */
|
|
9
|
+
export declare function scheduleSessionCompletedPluginTasks(params: PluginTaskParams, options?: ScheduleSessionCompletedPluginTasksOptions): Promise<void>;
|
|
10
|
+
/** Execute one parsed plugin task request. */
|
|
11
|
+
export declare function processPluginTask(message: PluginTaskQueueMessage, options?: ProcessPluginTaskOptions): Promise<void>;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { type PluginTaskQueueMessage } from "./task-message";
|
|
3
|
+
export declare const PLUGIN_TASK_QUEUE_SIGNATURE_MAX_SKEW_MS: number;
|
|
4
|
+
export type PluginTaskQueueRejectReason = "expired" | "malformed" | "signature_mismatch";
|
|
5
|
+
type VerificationResult = {
|
|
6
|
+
message: PluginTaskQueueMessage;
|
|
7
|
+
status: "verified";
|
|
8
|
+
} | {
|
|
9
|
+
reason: PluginTaskQueueRejectReason;
|
|
10
|
+
status: "rejected";
|
|
11
|
+
} | {
|
|
12
|
+
reason: "invalid_clock" | "missing_secret";
|
|
13
|
+
status: "unavailable";
|
|
14
|
+
};
|
|
15
|
+
declare const signedPluginTaskQueueMessageSchema: z.ZodObject<{
|
|
16
|
+
name: z.ZodString;
|
|
17
|
+
params: z.ZodObject<{
|
|
18
|
+
conversationId: z.ZodString;
|
|
19
|
+
sessionId: z.ZodString;
|
|
20
|
+
}, z.core.$strict>;
|
|
21
|
+
plugin: z.ZodString;
|
|
22
|
+
signature: z.ZodString;
|
|
23
|
+
signatureVersion: z.ZodLiteral<"v1">;
|
|
24
|
+
signedAtMs: z.ZodNumber;
|
|
25
|
+
}, z.core.$strict>;
|
|
26
|
+
type SignedPluginTaskQueueMessage = z.output<typeof signedPluginTaskQueueMessageSchema>;
|
|
27
|
+
/** Sign a plugin task payload before it crosses the public queue callback. */
|
|
28
|
+
export declare function signPluginTaskQueueMessage(message: PluginTaskQueueMessage, nowMs?: number): SignedPluginTaskQueueMessage;
|
|
29
|
+
/** Verify a plugin task payload from the public queue callback route. */
|
|
30
|
+
export declare function verifyPluginTaskQueueMessage(value: unknown, nowMs?: number): VerificationResult;
|
|
31
|
+
export {};
|
package/dist/chat/prompt.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import type { SlackConversationContext } from "@/chat/slack/conversation-context
|
|
|
2
2
|
import type { ThreadArtifactsState } from "@/chat/state/artifacts";
|
|
3
3
|
import type { SkillMetadata, SkillInvocation } from "@/chat/skills";
|
|
4
4
|
import type { ActiveMcpCatalogSummary } from "@/chat/tools/skill/mcp-tool-summary";
|
|
5
|
+
import type { PluginPromptContributionContext } from "@/chat/plugins/prompt";
|
|
5
6
|
import type { Destination, Source } from "@sentry/junior-plugin-api";
|
|
6
7
|
export declare const JUNIOR_PERSONALITY: string;
|
|
7
8
|
export declare const JUNIOR_WORLD: string | null;
|
|
@@ -10,10 +11,13 @@ interface ToolPromptContext {
|
|
|
10
11
|
promptGuidelines?: string[];
|
|
11
12
|
promptSnippet?: string;
|
|
12
13
|
}
|
|
14
|
+
/** Render plugin system prompt additions under a core-owned wrapper. */
|
|
15
|
+
export declare function buildPluginSystemPromptContributions(contributions: PluginPromptContributionContext[]): string | null;
|
|
13
16
|
type TurnContextPromptInput = {
|
|
14
17
|
availableSkills: SkillMetadata[];
|
|
15
18
|
activeMcpCatalogs?: ActiveMcpCatalogSummary[];
|
|
16
19
|
includeSessionContext?: boolean;
|
|
20
|
+
pluginPromptContributions?: PluginPromptContributionContext[];
|
|
17
21
|
toolGuidance?: ToolPromptContext[];
|
|
18
22
|
runtime?: {
|
|
19
23
|
conversationId?: string;
|
package/dist/chat/requester.d.ts
CHANGED
|
@@ -2,8 +2,7 @@
|
|
|
2
2
|
* Canonical requester identity.
|
|
3
3
|
*
|
|
4
4
|
* Runtime requesters are platform-scoped actors. Stored Slack requester parsing
|
|
5
|
-
* remains explicit so
|
|
6
|
-
* malformed team or user ids.
|
|
5
|
+
* remains explicit so durable conversation metadata is not repaired on read.
|
|
7
6
|
*/
|
|
8
7
|
import { z } from "zod";
|
|
9
8
|
export declare const storedSlackRequesterSchema: z.ZodObject<{
|
|
@@ -34,6 +33,8 @@ export interface SlackRequesterProfile {
|
|
|
34
33
|
userName?: string;
|
|
35
34
|
}
|
|
36
35
|
export type StoredSlackRequester = z.output<typeof storedSlackRequesterSchema>;
|
|
36
|
+
/** Parse a serialized runtime requester that crossed a durable boundary. */
|
|
37
|
+
export declare function parseRequester(value: unknown): Requester | undefined;
|
|
37
38
|
interface RequesterInput {
|
|
38
39
|
email?: string;
|
|
39
40
|
fullName?: string;
|
|
@@ -58,9 +59,9 @@ export declare function createSlackRequester(teamId: string, userId: string, pro
|
|
|
58
59
|
export declare function parseStoredSlackRequester(value: unknown): StoredSlackRequester | undefined;
|
|
59
60
|
/** Convert a runtime Slack requester into its durable session shape. */
|
|
60
61
|
export declare function toStoredSlackRequester(requester: SlackRequester): StoredSlackRequester;
|
|
61
|
-
/**
|
|
62
|
-
export declare function
|
|
63
|
-
requester?:
|
|
62
|
+
/** Resolve a Slack resume requester from stored runtime identity and the active actor. */
|
|
63
|
+
export declare function createSlackResumeRequester(args: {
|
|
64
|
+
requester?: Requester;
|
|
64
65
|
teamId: string;
|
|
65
66
|
userId: string;
|
|
66
67
|
}): SlackRequester;
|
|
@@ -59,6 +59,8 @@ export declare function isToolResultMessage(value: unknown): value is ToolResult
|
|
|
59
59
|
export declare function normalizeToolNameFromResult(result: unknown): string | undefined;
|
|
60
60
|
/** Check whether a tool result carries an error flag. */
|
|
61
61
|
export declare function isToolResultError(result: unknown): boolean;
|
|
62
|
+
/** Extract tool names that completed successfully from raw Pi messages. */
|
|
63
|
+
export declare function getSuccessfulToolCalls(messages: readonly unknown[]): string[];
|
|
62
64
|
/** Type guard for Pi SDK assistant messages. */
|
|
63
65
|
export declare function isAssistantMessage(value: unknown): value is AssistantMessage;
|
|
64
66
|
/** Extract role string from a raw Pi message. */
|
package/dist/chat/respond.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ import { type SandboxAcquiredState } from "@/chat/sandbox/sandbox";
|
|
|
8
8
|
import type { SandboxEgressTracePropagationConfig } from "@/chat/sandbox/egress-tracing";
|
|
9
9
|
import type { AssistantStatusSpec } from "@/chat/slack/assistant-thread/status";
|
|
10
10
|
import type { SlackConversationContext } from "@/chat/slack/conversation-context";
|
|
11
|
+
import { type ToolExecutionReport } from "@/chat/tools/agent-tools";
|
|
11
12
|
import { type AssistantReply, type AgentTurnDiagnostics } from "@/chat/services/turn-result";
|
|
12
13
|
import type { AgentTurnSurface } from "@/chat/state/turn-session";
|
|
13
14
|
import type { CredentialContext } from "@/chat/credentials/context";
|
|
@@ -18,7 +19,7 @@ export interface ReplyRequestContext {
|
|
|
18
19
|
skillDirs?: string[];
|
|
19
20
|
credentialContext?: CredentialContext;
|
|
20
21
|
requester?: Requester;
|
|
21
|
-
source
|
|
22
|
+
source: Source;
|
|
22
23
|
slackConversation?: SlackConversationContext;
|
|
23
24
|
destination: Destination;
|
|
24
25
|
surface?: AgentTurnSurface;
|
|
@@ -80,7 +81,8 @@ export interface ReplyRequestContext {
|
|
|
80
81
|
onToolInvocation?: (invocation: {
|
|
81
82
|
toolName: string;
|
|
82
83
|
params: Record<string, unknown>;
|
|
83
|
-
}) => void
|
|
84
|
+
}) => void | Promise<void>;
|
|
85
|
+
onToolResult?: (result: ToolExecutionReport) => void | Promise<void>;
|
|
84
86
|
}
|
|
85
87
|
export type AssistantReplyRequestContext = ReplyRequestContext;
|
|
86
88
|
export interface ReplyRequestAttachment {
|
|
@@ -6,6 +6,10 @@ export interface AgentContinueRunnerOptions {
|
|
|
6
6
|
generateReply?: typeof generateAssistantReply;
|
|
7
7
|
resumeTurn?: typeof resumeSlackTurn;
|
|
8
8
|
scheduleAgentContinue?: (request: AgentContinueRequest) => Promise<void>;
|
|
9
|
+
scheduleSessionCompletedPluginTasks?: (params: {
|
|
10
|
+
conversationId: string;
|
|
11
|
+
sessionId: string;
|
|
12
|
+
}) => Promise<void>;
|
|
9
13
|
}
|
|
10
14
|
/**
|
|
11
15
|
* Continue one paused Slack agent run from durable conversation state.
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
*/
|
|
9
9
|
import type { Message, Thread } from "chat";
|
|
10
10
|
import type { SlackAdapter } from "@chat-adapter/slack";
|
|
11
|
-
import type
|
|
11
|
+
import { type Destination } from "@sentry/junior-plugin-api";
|
|
12
12
|
import { generateAssistantReply as generateAssistantReplyImpl } from "@/chat/respond";
|
|
13
13
|
import type { PreparedTurnState } from "@/chat/runtime/turn-preparation";
|
|
14
14
|
import { type PrepareTurnStateInput, type QueuedTurnMessage, type TurnToolInvocation } from "@/chat/runtime/turn-input";
|
|
@@ -26,6 +26,10 @@ export interface ReplyExecutorServices {
|
|
|
26
26
|
}) => Promise<AgentContinueRequest | undefined>;
|
|
27
27
|
lookupSlackUser: typeof lookupSlackUser;
|
|
28
28
|
scheduleAgentContinue: (request: AgentContinueRequest) => Promise<void>;
|
|
29
|
+
scheduleSessionCompletedPluginTasks: (params: {
|
|
30
|
+
conversationId: string;
|
|
31
|
+
sessionId: string;
|
|
32
|
+
}) => Promise<void>;
|
|
29
33
|
}
|
|
30
34
|
interface ReplyExecutorDeps {
|
|
31
35
|
getSlackAdapter: () => SlackAdapter;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { generateAssistantReply, type AssistantReply, type AssistantReplyRequestContext } from "@/chat/respond";
|
|
2
|
+
import type { Source } from "@sentry/junior-plugin-api";
|
|
2
3
|
/** Error raised when another worker already owns the resume lock. */
|
|
3
4
|
export declare class ResumeTurnBusyError extends Error {
|
|
4
5
|
constructor(lockKey: string);
|
|
@@ -8,10 +9,14 @@ interface ResumeSlackTurnArgs {
|
|
|
8
9
|
channelId: string;
|
|
9
10
|
threadTs: string;
|
|
10
11
|
messageTs?: string;
|
|
11
|
-
replyContext?:
|
|
12
|
+
replyContext?: ResumeReplyContext;
|
|
12
13
|
lockKey?: string;
|
|
13
14
|
initialText?: string;
|
|
14
15
|
generateReply?: typeof generateAssistantReply;
|
|
16
|
+
scheduleSessionCompletedPluginTasks?: (params: {
|
|
17
|
+
conversationId: string;
|
|
18
|
+
sessionId: string;
|
|
19
|
+
}) => Promise<void>;
|
|
15
20
|
onSuccess?: (reply: AssistantReply) => Promise<void>;
|
|
16
21
|
onFailure?: (error: unknown) => Promise<void>;
|
|
17
22
|
onAuthPause?: (error: unknown) => Promise<void>;
|
|
@@ -20,6 +25,9 @@ interface ResumeSlackTurnArgs {
|
|
|
20
25
|
beforeStart?: () => Promise<Partial<ResumeSlackTurnArgs> | false | void>;
|
|
21
26
|
replyTimeoutMs?: number;
|
|
22
27
|
}
|
|
28
|
+
type ResumeReplyContext = AssistantReplyRequestContext & {
|
|
29
|
+
source: Source;
|
|
30
|
+
};
|
|
23
31
|
/**
|
|
24
32
|
* Resume a paused Slack turn under the normal thread lock.
|
|
25
33
|
*
|
|
@@ -35,7 +43,7 @@ export declare function resumeAuthorizedRequest(args: {
|
|
|
35
43
|
threadTs: string;
|
|
36
44
|
messageTs?: string;
|
|
37
45
|
connectedText: string;
|
|
38
|
-
replyContext?:
|
|
46
|
+
replyContext?: ResumeReplyContext;
|
|
39
47
|
lockKey?: string;
|
|
40
48
|
generateReply?: typeof generateAssistantReply;
|
|
41
49
|
onSuccess?: (reply: AssistantReply) => Promise<void>;
|
package/dist/chat/sentry.d.ts
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
/** Sentry SDK re-export. Isolates the concrete package to a single file. */
|
|
2
|
+
export { captureException, continueTrace, flush, getClient, getGlobalScope, init, setTag, setUser, startInactiveSpan, startSpan, vercelAIIntegration, withActiveSpan, withScope, } from "@sentry/node";
|
|
2
3
|
export * from "@sentry/node";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { OAuthClientProvider } from "@modelcontextprotocol/sdk/client/auth.js";
|
|
2
|
-
import type { Destination } from "@sentry/junior-plugin-api";
|
|
2
|
+
import type { Destination, Source } from "@sentry/junior-plugin-api";
|
|
3
3
|
import { AuthorizationPauseError, type AuthorizationFlowMode } from "@/chat/services/auth-pause";
|
|
4
4
|
import type { ThreadArtifactsState } from "@/chat/state/artifacts";
|
|
5
5
|
import type { ConversationPendingAuthState } from "@/chat/state/conversation";
|
|
@@ -14,6 +14,7 @@ export interface McpAuthOrchestrationInput {
|
|
|
14
14
|
requesterId?: string;
|
|
15
15
|
channelId?: string;
|
|
16
16
|
destination?: Destination;
|
|
17
|
+
source?: Source;
|
|
17
18
|
threadTs?: string;
|
|
18
19
|
toolChannelId?: string;
|
|
19
20
|
userMessage: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Destination } from "@sentry/junior-plugin-api";
|
|
1
|
+
import type { Destination, Source } from "@sentry/junior-plugin-api";
|
|
2
2
|
import type { ChannelConfigurationService } from "@/chat/configuration/types";
|
|
3
3
|
import type { UserTokenStore } from "@/chat/credentials/user-token-store";
|
|
4
4
|
import { AuthorizationPauseError, type AuthorizationFlowMode } from "@/chat/services/auth-pause";
|
|
@@ -17,6 +17,7 @@ export interface PluginAuthOrchestrationInput {
|
|
|
17
17
|
requesterId?: string;
|
|
18
18
|
channelId?: string;
|
|
19
19
|
destination?: Destination;
|
|
20
|
+
source?: Source;
|
|
20
21
|
threadTs?: string;
|
|
21
22
|
userMessage: string;
|
|
22
23
|
channelConfiguration?: ChannelConfigurationService;
|
|
@@ -31,10 +31,10 @@ export interface SubscribedDecisionResult {
|
|
|
31
31
|
}
|
|
32
32
|
declare const replyDecisionSchema: z.ZodObject<{
|
|
33
33
|
should_reply: z.ZodBoolean;
|
|
34
|
-
should_unsubscribe: z.
|
|
34
|
+
should_unsubscribe: z.ZodBoolean;
|
|
35
35
|
confidence: z.ZodNumber;
|
|
36
36
|
reason: z.ZodOptional<z.ZodString>;
|
|
37
|
-
}, z.core.$
|
|
37
|
+
}, z.core.$strict>;
|
|
38
38
|
/** Fast heuristic check before the LLM classifier — skips messages directed at another party. */
|
|
39
39
|
export declare function getSubscribedReplyPreflightDecision(args: {
|
|
40
40
|
botUserName: string;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { type AgentTurnSessionRecord, type AgentTurnSurface } from "@/chat/state/turn-session";
|
|
2
|
-
import type {
|
|
3
|
-
import type { Destination } from "@sentry/junior-plugin-api";
|
|
2
|
+
import type { Destination, Requester, Source } from "@sentry/junior-plugin-api";
|
|
4
3
|
import type { PiMessage } from "@/chat/pi/messages";
|
|
5
4
|
import { type AgentTurnUsage } from "@/chat/usage";
|
|
6
5
|
export declare const AGENT_CONTINUE_MAX_SLICES = 48;
|
|
@@ -29,12 +28,13 @@ export declare function persistRunningSessionRecord(args: {
|
|
|
29
28
|
channelName?: string;
|
|
30
29
|
conversationId: string;
|
|
31
30
|
destination?: Destination;
|
|
31
|
+
source?: Source;
|
|
32
32
|
sessionId: string;
|
|
33
33
|
sliceId: number;
|
|
34
34
|
messages: PiMessage[];
|
|
35
35
|
loadedSkillNames?: string[];
|
|
36
36
|
logContext: SessionRecordLogContext;
|
|
37
|
-
requester?:
|
|
37
|
+
requester?: Requester;
|
|
38
38
|
surface?: AgentTurnSurface;
|
|
39
39
|
turnStartMessageIndex?: number;
|
|
40
40
|
}): Promise<boolean>;
|
|
@@ -45,12 +45,13 @@ export declare function persistCompletedSessionRecord(args: {
|
|
|
45
45
|
currentDurationMs?: number;
|
|
46
46
|
currentUsage?: AgentTurnUsage;
|
|
47
47
|
destination?: Destination;
|
|
48
|
+
source?: Source;
|
|
48
49
|
sessionId: string;
|
|
49
50
|
sliceId: number;
|
|
50
51
|
allMessages: PiMessage[];
|
|
51
52
|
loadedSkillNames?: string[];
|
|
52
53
|
logContext: SessionRecordLogContext;
|
|
53
|
-
requester?:
|
|
54
|
+
requester?: Requester;
|
|
54
55
|
surface?: AgentTurnSurface;
|
|
55
56
|
turnStartMessageIndex?: number;
|
|
56
57
|
}): Promise<void>;
|
|
@@ -66,11 +67,12 @@ export declare function persistAuthPauseSessionRecord(args: {
|
|
|
66
67
|
currentDurationMs?: number;
|
|
67
68
|
currentUsage?: AgentTurnUsage;
|
|
68
69
|
destination?: Destination;
|
|
70
|
+
source?: Source;
|
|
69
71
|
messages: PiMessage[];
|
|
70
72
|
loadedSkillNames?: string[];
|
|
71
73
|
errorMessage: string;
|
|
72
74
|
logContext: SessionRecordLogContext;
|
|
73
|
-
requester?:
|
|
75
|
+
requester?: Requester;
|
|
74
76
|
surface?: AgentTurnSurface;
|
|
75
77
|
}): Promise<AgentTurnSessionRecord | undefined>;
|
|
76
78
|
/**
|
|
@@ -85,11 +87,12 @@ export declare function persistTimeoutSessionRecord(args: {
|
|
|
85
87
|
currentDurationMs?: number;
|
|
86
88
|
currentUsage?: AgentTurnUsage;
|
|
87
89
|
destination?: Destination;
|
|
90
|
+
source?: Source;
|
|
88
91
|
messages: PiMessage[];
|
|
89
92
|
loadedSkillNames?: string[];
|
|
90
93
|
errorMessage: string;
|
|
91
94
|
logContext: SessionRecordLogContext;
|
|
92
|
-
requester?:
|
|
95
|
+
requester?: Requester;
|
|
93
96
|
surface?: AgentTurnSurface;
|
|
94
97
|
}): Promise<AgentTurnSessionRecord | undefined>;
|
|
95
98
|
/**
|
|
@@ -103,11 +106,12 @@ export declare function persistYieldSessionRecord(args: {
|
|
|
103
106
|
currentDurationMs?: number;
|
|
104
107
|
currentUsage?: AgentTurnUsage;
|
|
105
108
|
destination?: Destination;
|
|
109
|
+
source?: Source;
|
|
106
110
|
messages: PiMessage[];
|
|
107
111
|
loadedSkillNames?: string[];
|
|
108
112
|
errorMessage: string;
|
|
109
113
|
logContext: SessionRecordLogContext;
|
|
110
|
-
requester?:
|
|
114
|
+
requester?: Requester;
|
|
111
115
|
surface?: AgentTurnSurface;
|
|
112
116
|
}): Promise<AgentTurnSessionRecord | undefined>;
|
|
113
117
|
export {};
|