@sentry/junior 0.73.0 → 0.74.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/dist/api-reference.d.ts +1 -1
- package/dist/app.js +258 -62
- package/dist/chat/app/production.d.ts +3 -0
- package/dist/chat/config.d.ts +3 -0
- package/dist/chat/conversations/configured.d.ts +5 -0
- package/dist/chat/conversations/sql/migrations.d.ts +11 -0
- package/dist/chat/conversations/sql/schema/conversations.d.ts +435 -0
- package/dist/chat/conversations/sql/schema/destinations.d.ts +200 -0
- package/dist/chat/conversations/sql/schema/identities.d.ts +214 -0
- package/dist/chat/conversations/sql/schema/migrations.d.ts +58 -0
- package/dist/chat/conversations/sql/schema/timestamps.d.ts +1 -0
- package/dist/chat/conversations/sql/schema.d.ts +910 -0
- package/dist/chat/conversations/sql/store.d.ts +52 -0
- package/dist/chat/conversations/state.d.ts +4 -0
- package/dist/chat/conversations/store.d.ts +57 -0
- package/dist/chat/ingress/slack-webhook.d.ts +2 -0
- package/dist/chat/plugins/agent-hooks.d.ts +2 -2
- package/dist/chat/respond.d.ts +1 -1
- package/dist/chat/services/mcp-auth-orchestration.d.ts +6 -5
- package/dist/chat/services/pending-auth.d.ts +2 -0
- package/dist/chat/services/plugin-auth-orchestration.d.ts +7 -6
- package/dist/chat/sql/db.d.ts +20 -0
- package/dist/chat/sql/neon.d.ts +9 -0
- package/dist/chat/sql/schema.d.ts +906 -0
- package/dist/chat/state/turn-session.d.ts +3 -0
- package/dist/chat/task-execution/slack-work.d.ts +2 -0
- package/dist/chat/task-execution/state.d.ts +209 -0
- package/dist/chat/task-execution/store.d.ts +30 -114
- package/dist/chat/task-execution/vercel-callback.d.ts +2 -0
- package/dist/chat/task-execution/worker.d.ts +2 -0
- package/dist/{chunk-ZDA2HYX5.js → chunk-2LUZA3LY.js} +3 -3
- package/dist/{chunk-RY6AL5C7.js → chunk-6UP2Z2RZ.js} +2 -2
- package/dist/{chunk-DIMX5F3T.js → chunk-F6HWCPOC.js} +1 -1
- package/dist/{chunk-WS2EG3GW.js → chunk-GM7HTXYC.js} +6 -0
- package/dist/{chunk-UZVHXZ7V.js → chunk-HYHKTFG2.js} +59 -15
- package/dist/chunk-JL2SLRAT.js +1970 -0
- package/dist/{chunk-OQSYYOLM.js → chunk-SQGMG7OD.js} +128 -114
- package/dist/{chunk-QUXPUKBH.js → chunk-Y7X25LFY.js} +1 -1
- package/dist/{chunk-UOTZ3EEQ.js → chunk-YOHFWWBV.js} +1 -1
- package/dist/{chunk-V4VYUY4A.js → chunk-YRDS7VKO.js} +1 -1
- package/dist/cli/chat.js +2 -2
- package/dist/cli/init.js +1 -1
- package/dist/cli/snapshot-warmup.js +3 -3
- package/dist/cli/upgrade.js +77 -7
- package/dist/instrumentation.js +0 -1
- package/dist/nitro.js +3 -3
- package/dist/reporting/conversations.d.ts +13 -3
- package/dist/reporting.d.ts +9 -2
- package/dist/reporting.js +101 -37
- package/dist/{runner-LMAM4OGD.js → runner-27NP2TEO.js} +7 -7
- package/dist/vercel.d.ts +6 -1
- package/dist/vercel.js +1 -1
- package/package.json +9 -4
- package/dist/chunk-AL5T52ZD.js +0 -1119
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import type { Destination } from "@sentry/junior-plugin-api";
|
|
2
|
+
import { type StoredSlackRequester } from "@/chat/requester";
|
|
3
|
+
import type { JuniorSqlDatabase, JuniorSqlMigrationExecutor } from "@/chat/sql/db";
|
|
4
|
+
import type { Conversation, ConversationExecution, ConversationSource, ConversationStore } from "../store";
|
|
5
|
+
export declare class SqlStore implements ConversationStore {
|
|
6
|
+
private readonly executor;
|
|
7
|
+
private readonly migrationExecutor;
|
|
8
|
+
private schemaReady;
|
|
9
|
+
constructor(executor: JuniorSqlDatabase, migrationExecutor: JuniorSqlMigrationExecutor);
|
|
10
|
+
/** Apply SQL schema migrations before runtime uses this store. */
|
|
11
|
+
migrate(): Promise<void>;
|
|
12
|
+
get(args: {
|
|
13
|
+
conversationId: string;
|
|
14
|
+
}): Promise<Conversation | undefined>;
|
|
15
|
+
recordActivity(args: {
|
|
16
|
+
activityAtMs?: number;
|
|
17
|
+
channelName?: string;
|
|
18
|
+
conversationId: string;
|
|
19
|
+
destination?: Destination;
|
|
20
|
+
nowMs?: number;
|
|
21
|
+
requester?: StoredSlackRequester;
|
|
22
|
+
source?: ConversationSource;
|
|
23
|
+
title?: string;
|
|
24
|
+
}): Promise<void>;
|
|
25
|
+
recordExecution(args: {
|
|
26
|
+
channelName?: string;
|
|
27
|
+
conversationId: string;
|
|
28
|
+
createdAtMs: number;
|
|
29
|
+
destination?: Destination;
|
|
30
|
+
execution: ConversationExecution;
|
|
31
|
+
lastActivityAtMs: number;
|
|
32
|
+
requester?: StoredSlackRequester;
|
|
33
|
+
source?: ConversationSource;
|
|
34
|
+
title?: string;
|
|
35
|
+
updatedAtMs: number;
|
|
36
|
+
}): Promise<void>;
|
|
37
|
+
/** Copy one conversation record into SQL during backfill. */
|
|
38
|
+
backfillConversation(conversation: Conversation): Promise<void>;
|
|
39
|
+
listByActivity(args?: {
|
|
40
|
+
limit?: number;
|
|
41
|
+
offset?: number;
|
|
42
|
+
}): Promise<Conversation[]>;
|
|
43
|
+
/** Serialize all durable mutations for one conversation inside a SQL transaction. */
|
|
44
|
+
private withConversationMutation;
|
|
45
|
+
private readConversationRow;
|
|
46
|
+
/** Upsert the conversation row while preserving previously discovered nullable metadata fields. */
|
|
47
|
+
private upsertConversation;
|
|
48
|
+
private upsertIdentity;
|
|
49
|
+
private upsertDestination;
|
|
50
|
+
}
|
|
51
|
+
/** Create a SQL-backed conversation store. */
|
|
52
|
+
export declare function createSqlStore(executor: JuniorSqlMigrationExecutor): SqlStore;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { StateAdapter } from "chat";
|
|
2
|
+
import type { ConversationStore } from "./store";
|
|
3
|
+
/** Create the no-SQL conversation record store backed by task-execution state. */
|
|
4
|
+
export declare function createStateConversationStore(state?: StateAdapter): ConversationStore;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import type { Destination } from "@sentry/junior-plugin-api";
|
|
2
|
+
import type { StoredSlackRequester } from "@/chat/requester";
|
|
3
|
+
export type ConversationSource = "api" | "internal" | "local" | "plugin" | "scheduler" | "slack";
|
|
4
|
+
export type ConversationStatus = "awaiting_resume" | "idle" | "pending" | "running";
|
|
5
|
+
export interface ConversationExecution {
|
|
6
|
+
lastCheckpointAtMs?: number;
|
|
7
|
+
lastEnqueuedAtMs?: number;
|
|
8
|
+
runId?: string;
|
|
9
|
+
status: ConversationStatus;
|
|
10
|
+
updatedAtMs?: number;
|
|
11
|
+
}
|
|
12
|
+
export interface Conversation {
|
|
13
|
+
channelName?: string;
|
|
14
|
+
conversationId: string;
|
|
15
|
+
createdAtMs: number;
|
|
16
|
+
destination?: Destination;
|
|
17
|
+
execution: ConversationExecution;
|
|
18
|
+
lastActivityAtMs: number;
|
|
19
|
+
requester?: StoredSlackRequester;
|
|
20
|
+
schemaVersion: 1;
|
|
21
|
+
source?: ConversationSource;
|
|
22
|
+
title?: string;
|
|
23
|
+
updatedAtMs: number;
|
|
24
|
+
}
|
|
25
|
+
/** Persist and read durable conversation metadata for reporting surfaces. */
|
|
26
|
+
export interface ConversationStore {
|
|
27
|
+
get(args: {
|
|
28
|
+
conversationId: string;
|
|
29
|
+
}): Promise<Conversation | undefined>;
|
|
30
|
+
recordActivity(args: {
|
|
31
|
+
activityAtMs?: number;
|
|
32
|
+
channelName?: string;
|
|
33
|
+
conversationId: string;
|
|
34
|
+
destination?: Destination;
|
|
35
|
+
nowMs?: number;
|
|
36
|
+
requester?: StoredSlackRequester;
|
|
37
|
+
source?: ConversationSource;
|
|
38
|
+
title?: string;
|
|
39
|
+
}): Promise<void>;
|
|
40
|
+
/** Store task-execution metadata for long-term conversation history. */
|
|
41
|
+
recordExecution(args: {
|
|
42
|
+
channelName?: string;
|
|
43
|
+
conversationId: string;
|
|
44
|
+
createdAtMs: number;
|
|
45
|
+
destination?: Destination;
|
|
46
|
+
execution: ConversationExecution;
|
|
47
|
+
lastActivityAtMs: number;
|
|
48
|
+
requester?: StoredSlackRequester;
|
|
49
|
+
source?: ConversationSource;
|
|
50
|
+
title?: string;
|
|
51
|
+
updatedAtMs: number;
|
|
52
|
+
}): Promise<void>;
|
|
53
|
+
listByActivity(args?: {
|
|
54
|
+
limit?: number;
|
|
55
|
+
offset?: number;
|
|
56
|
+
}): Promise<Conversation[]>;
|
|
57
|
+
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { SlackAdapter } from "@chat-adapter/slack";
|
|
2
2
|
import { type StateAdapter } from "chat";
|
|
3
3
|
import type { SlackTurnRuntime } from "@/chat/runtime/slack-runtime";
|
|
4
|
+
import type { ConversationStore } from "@/chat/conversations/store";
|
|
4
5
|
import type { ConversationWorkQueue } from "@/chat/task-execution/queue";
|
|
5
6
|
import type { UserTokenStore } from "@/chat/credentials/user-token-store";
|
|
6
7
|
import type { WaitUntilFn } from "@/handlers/types";
|
|
@@ -8,6 +9,7 @@ export interface SlackWebhookServices {
|
|
|
8
9
|
getUserTokenStore?: () => UserTokenStore;
|
|
9
10
|
getSlackAdapter: () => SlackAdapter;
|
|
10
11
|
queue: ConversationWorkQueue;
|
|
12
|
+
conversationStore?: ConversationStore;
|
|
11
13
|
runtime: Pick<SlackTurnRuntime<unknown>, "handleAssistantContextChanged" | "handleAssistantThreadStarted" | "handleNewMention" | "handleSubscribedMessage">;
|
|
12
14
|
state?: StateAdapter;
|
|
13
15
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AgentPluginRoute, PluginOperationalReport, SlackConversationLink, JuniorPluginRegistration } from "@sentry/junior-plugin-api";
|
|
1
|
+
import type { AgentPluginConversations, AgentPluginRoute, PluginOperationalReport, SlackConversationLink, JuniorPluginRegistration } from "@sentry/junior-plugin-api";
|
|
2
2
|
import type { ToolDefinition } from "@/chat/tools/definition";
|
|
3
3
|
import type { ToolRuntimeContext } from "@/chat/tools/types";
|
|
4
4
|
import type { SandboxInstance } from "@/chat/sandbox/workspace";
|
|
@@ -35,7 +35,7 @@ export declare function getAgentPluginRoutes(): AgentPluginRouteRegistration[];
|
|
|
35
35
|
/** Resolve the first plugin conversation URL for finalized Slack footers. */
|
|
36
36
|
export declare function getAgentPluginSlackConversationLink(conversationId: string): SlackConversationLink | undefined;
|
|
37
37
|
/** Collect read-only operational summaries exposed by plugins. */
|
|
38
|
-
export declare function getAgentPluginOperationalReports(nowMs
|
|
38
|
+
export declare function getAgentPluginOperationalReports(nowMs: number, conversations: AgentPluginConversations): Promise<PluginOperationalReport[]>;
|
|
39
39
|
/** Create one runner over runtime hook plugins registered by the app. */
|
|
40
40
|
export declare function createAgentPluginHookRunner(input?: {
|
|
41
41
|
requester?: Requester;
|
package/dist/chat/respond.d.ts
CHANGED
|
@@ -65,7 +65,7 @@ export interface ReplyRequestContext {
|
|
|
65
65
|
drainSteeringMessages?: (inject: (messages: ReplySteeringMessage[]) => Promise<void>) => Promise<ReplySteeringMessage[]>;
|
|
66
66
|
/** Return true when the durable worker should pause at the next Pi boundary. */
|
|
67
67
|
shouldYield?: () => boolean;
|
|
68
|
-
|
|
68
|
+
recordPendingAuth?: (pendingAuth: ConversationPendingAuthState) => void | Promise<void>;
|
|
69
69
|
onTextDelta?: (deltaText: string) => void | Promise<void>;
|
|
70
70
|
onAssistantMessageStart?: () => void | Promise<void>;
|
|
71
71
|
onToolInvocation?: (invocation: {
|
|
@@ -7,7 +7,8 @@ import type { PluginDefinition } from "@/chat/plugins/types";
|
|
|
7
7
|
export declare class McpAuthorizationPauseError extends AuthorizationPauseError {
|
|
8
8
|
constructor(provider: string, providerDisplayName: string, disposition: "link_already_sent" | "link_sent");
|
|
9
9
|
}
|
|
10
|
-
export interface
|
|
10
|
+
export interface McpAuthOrchestrationInput {
|
|
11
|
+
abortAgent: () => void;
|
|
11
12
|
conversationId?: string;
|
|
12
13
|
sessionId?: string;
|
|
13
14
|
requesterId?: string;
|
|
@@ -16,11 +17,11 @@ export interface McpAuthOrchestrationDeps {
|
|
|
16
17
|
threadTs?: string;
|
|
17
18
|
toolChannelId?: string;
|
|
18
19
|
userMessage: string;
|
|
19
|
-
|
|
20
|
+
pendingAuth?: ConversationPendingAuthState;
|
|
20
21
|
getConfiguration: () => Record<string, unknown>;
|
|
21
22
|
getArtifactState: () => ThreadArtifactsState | undefined;
|
|
22
23
|
getMergedArtifactState: () => ThreadArtifactsState;
|
|
23
|
-
|
|
24
|
+
recordPendingAuth?: (pendingAuth: ConversationPendingAuthState) => void | Promise<void>;
|
|
24
25
|
authorizationFlowMode?: AuthorizationFlowMode;
|
|
25
26
|
}
|
|
26
27
|
export interface McpAuthOrchestration {
|
|
@@ -28,5 +29,5 @@ export interface McpAuthOrchestration {
|
|
|
28
29
|
onAuthorizationRequired: (provider: string) => Promise<boolean>;
|
|
29
30
|
getPendingPause: () => McpAuthorizationPauseError | undefined;
|
|
30
31
|
}
|
|
31
|
-
/** Create MCP authorization orchestration for a single
|
|
32
|
-
export declare function createMcpAuthOrchestration(
|
|
32
|
+
/** Create MCP authorization orchestration for a single agent run. */
|
|
33
|
+
export declare function createMcpAuthOrchestration(input: McpAuthOrchestrationInput): McpAuthOrchestration;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { AuthorizationPauseKind } from "@/chat/services/auth-pause";
|
|
2
2
|
import type { ConversationPendingAuthState, ThreadConversationState } from "@/chat/state/conversation";
|
|
3
|
+
/** Decide whether the same agent-run session can reuse its fresh auth link. */
|
|
3
4
|
export declare function canReusePendingAuthLink(args: {
|
|
4
5
|
kind: AuthorizationPauseKind;
|
|
5
6
|
nowMs?: number;
|
|
@@ -7,6 +8,7 @@ export declare function canReusePendingAuthLink(args: {
|
|
|
7
8
|
provider: string;
|
|
8
9
|
requesterId: string;
|
|
9
10
|
scope?: string;
|
|
11
|
+
sessionId: string;
|
|
10
12
|
}): boolean;
|
|
11
13
|
export declare function getConversationPendingAuth(args: {
|
|
12
14
|
conversation: ThreadConversationState;
|
|
@@ -10,7 +10,8 @@ export declare class PluginCredentialFailureError extends Error {
|
|
|
10
10
|
readonly provider: string;
|
|
11
11
|
constructor(provider: string, message: string);
|
|
12
12
|
}
|
|
13
|
-
export interface
|
|
13
|
+
export interface PluginAuthOrchestrationInput {
|
|
14
|
+
abortAgent: () => void;
|
|
14
15
|
conversationId?: string;
|
|
15
16
|
sessionId?: string;
|
|
16
17
|
requesterId?: string;
|
|
@@ -19,8 +20,8 @@ export interface PluginAuthOrchestrationDeps {
|
|
|
19
20
|
threadTs?: string;
|
|
20
21
|
userMessage: string;
|
|
21
22
|
channelConfiguration?: ChannelConfigurationService;
|
|
22
|
-
|
|
23
|
-
|
|
23
|
+
pendingAuth?: ConversationPendingAuthState;
|
|
24
|
+
recordPendingAuth?: (pendingAuth: ConversationPendingAuthState) => void | Promise<void>;
|
|
24
25
|
authorizationFlowMode?: AuthorizationFlowMode;
|
|
25
26
|
userTokenStore?: UserTokenStore;
|
|
26
27
|
}
|
|
@@ -28,13 +29,13 @@ export interface PluginAuthOrchestration {
|
|
|
28
29
|
/**
|
|
29
30
|
* Inspect a sandbox tool result for an `auth_required` signal from the
|
|
30
31
|
* egress proxy. If one is present and an OAuth flow is available, parks the
|
|
31
|
-
* current
|
|
32
|
+
* current run and sends the user an authorization link. No-ops when the
|
|
32
33
|
* result carries no auth signal.
|
|
33
34
|
*/
|
|
34
35
|
maybeHandleAuthSignal: (details: unknown) => Promise<void>;
|
|
35
36
|
getPendingPause: () => PluginAuthorizationPauseError | undefined;
|
|
36
37
|
}
|
|
37
38
|
/**
|
|
38
|
-
* Start plugin OAuth from a sandbox egress auth signal and park the
|
|
39
|
+
* Start plugin OAuth from a sandbox egress auth signal and park the run.
|
|
39
40
|
*/
|
|
40
|
-
export declare function createPluginAuthOrchestration(
|
|
41
|
+
export declare function createPluginAuthOrchestration(input: PluginAuthOrchestrationInput): PluginAuthOrchestration;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared Junior SQL boundary.
|
|
3
|
+
*
|
|
4
|
+
* Feature schemas compose into `juniorSqlSchema`, and feature stores should use
|
|
5
|
+
* Drizzle through `db()`. Raw SQL exists on this executor for schema migration
|
|
6
|
+
* and catalog checks only.
|
|
7
|
+
*/
|
|
8
|
+
import type { PgDatabase } from "drizzle-orm/pg-core";
|
|
9
|
+
import type { PgQueryResultHKT } from "drizzle-orm/pg-core/session";
|
|
10
|
+
import type { juniorSqlSchema } from "./schema";
|
|
11
|
+
export type JuniorDatabase = PgDatabase<PgQueryResultHKT, typeof juniorSqlSchema>;
|
|
12
|
+
export interface JuniorSqlDatabase {
|
|
13
|
+
db(): JuniorDatabase;
|
|
14
|
+
transaction<T>(callback: () => Promise<T>): Promise<T>;
|
|
15
|
+
withLock<T>(lockName: string, callback: () => Promise<T>): Promise<T>;
|
|
16
|
+
}
|
|
17
|
+
export interface JuniorSqlMigrationExecutor extends JuniorSqlDatabase {
|
|
18
|
+
execute(statement: string, params?: readonly unknown[]): Promise<void>;
|
|
19
|
+
query<T = unknown>(statement: string, params?: readonly unknown[]): Promise<T[]>;
|
|
20
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { JuniorSqlMigrationExecutor } from "./db";
|
|
2
|
+
/** Neon-backed SQL executor with an owned connection pool lifecycle. */
|
|
3
|
+
export interface NeonJuniorSqlExecutor extends JuniorSqlMigrationExecutor {
|
|
4
|
+
close(): Promise<void>;
|
|
5
|
+
}
|
|
6
|
+
/** Create the shared Neon-backed Junior SQL executor. */
|
|
7
|
+
export declare function createNeonJuniorSqlExecutor(args: {
|
|
8
|
+
connectionString: string;
|
|
9
|
+
}): NeonJuniorSqlExecutor;
|