@sentry/junior 0.183.0 → 0.184.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-SNRBZYAU.js → agent-hooks-XTZVALGQ.js} +11 -11
- package/dist/api/acp/auth.d.ts +46 -0
- package/dist/api/acp/authorization-page.d.ts +11 -0
- package/dist/api/acp/conversations.d.ts +70 -0
- package/dist/api/acp/errors.d.ts +6 -0
- package/dist/api/acp/route.d.ts +16 -0
- package/dist/api/acp/schema.d.ts +97 -0
- package/dist/api/acp/sleep.d.ts +2 -0
- package/dist/api/acp/state.d.ts +22 -0
- package/dist/api/acp/transport.d.ts +113 -0
- package/dist/api.js +29 -29
- package/dist/app.d.ts +0 -4
- package/dist/app.js +2010 -82
- package/dist/{catalog-runtime-3I3JOIIH.js → catalog-runtime-5357XR4F.js} +4 -4
- package/dist/{chunk-24OJZ5OU.js → chunk-2ZQPVX7C.js} +6 -6
- package/dist/{chunk-LZBPGX5A.js → chunk-3S7ULUWW.js} +1 -1
- package/dist/{chunk-AHMWPFIW.js → chunk-4CNDGK25.js} +6 -6
- package/dist/{chunk-3HJ4F4L7.js → chunk-4RONS3WR.js} +4 -4
- package/dist/{chunk-LMNMMESF.js → chunk-6UDPINOX.js} +2 -2
- package/dist/{chunk-W46NIB5H.js → chunk-6VOYP4M6.js} +2 -3
- package/dist/{chunk-W5JMPEBO.js → chunk-6WGC3SO4.js} +9 -9
- package/dist/{chunk-T5MTGX2E.js → chunk-ACPDVEJO.js} +22 -20
- package/dist/{chunk-6UXDTPEN.js → chunk-BCHYQS4B.js} +1 -1
- package/dist/{chunk-2ADFGSUS.js → chunk-BHYRYYLY.js} +1 -1
- package/dist/{chunk-IO6KFXYE.js → chunk-BT53RIGJ.js} +7 -7
- package/dist/{chunk-G2B2XZQW.js → chunk-DUKIDPF6.js} +1 -1
- package/dist/{chunk-PLZT45VC.js → chunk-E57WPXWY.js} +5 -5
- package/dist/{chunk-2EPYYVJC.js → chunk-FKEZZMXS.js} +8 -8
- package/dist/{chunk-R767Y7QV.js → chunk-HIPUIPJM.js} +5 -5
- package/dist/{chunk-3L7CWDQQ.js → chunk-HUXFMDBZ.js} +1 -1
- package/dist/{chunk-AX3UDIMA.js → chunk-IZDYYYGP.js} +3 -3
- package/dist/{chunk-56XONJPF.js → chunk-JA43DV4Y.js} +1 -1
- package/dist/{chunk-QI5JW5AG.js → chunk-JM2COLGC.js} +6 -6
- package/dist/{chunk-QZV76CM4.js → chunk-JNO2GUDS.js} +21 -21
- package/dist/{chunk-35PM4YY5.js → chunk-K7VDC2QW.js} +6 -6
- package/dist/{chunk-4WGFWHWP.js → chunk-LCP4EDKR.js} +1 -1
- package/dist/{chunk-EENQGEIP.js → chunk-LHXIZLFF.js} +1 -1
- package/dist/{chunk-WOKJRLM2.js → chunk-M5YWNMTE.js} +5 -5
- package/dist/{chunk-37IQ6DGU.js → chunk-MAPJFUMV.js} +3 -3
- package/dist/{chunk-FJMTMGBC.js → chunk-MLSQX2EX.js} +1 -1
- package/dist/{chunk-E3OBGRHN.js → chunk-PJPRXO2T.js} +1 -1
- package/dist/{chunk-VOV3SCM3.js → chunk-QABCY33S.js} +1 -1
- package/dist/{chunk-X52ESOBP.js → chunk-SHJK75Z2.js} +3 -3
- package/dist/{chunk-AYW7J6K4.js → chunk-UBOIHNTH.js} +13 -13
- package/dist/{chunk-V64JCZUV.js → chunk-UF6BUA5W.js} +3 -3
- package/dist/{chunk-KTXOGLNE.js → chunk-WQFEWULF.js} +2 -2
- package/dist/{chunk-SQHFVIMZ.js → chunk-YKX6MTLU.js} +1 -1
- package/dist/{chunk-HUK5XIZL.js → chunk-Z3QAXJR7.js} +4 -4
- package/dist/cli/chat.js +32 -32
- package/dist/cli/check.js +5 -5
- package/dist/cli/plugins.js +12 -12
- package/dist/cli/snapshot-create.js +9 -9
- package/dist/cli/upgrade.js +6 -6
- package/dist/{db-K2VMNLHQ.js → db-MA52H62H.js} +6 -6
- package/dist/instrumentation.js +3 -3
- package/dist/nitro.js +6 -6
- package/dist/{oauth-callback-server-DZZMTKSS.js → oauth-callback-server-DXGHKN6S.js} +25 -25
- package/dist/{runner-IIAKWDXI.js → runner-4IXUAQNK.js} +18 -18
- package/dist/{skills-EXIQ7BP5.js → skills-X3DY7AXO.js} +5 -5
- package/dist/spawn-43WGS6CH.js +37 -0
- package/dist/task-runner-VDRKITPV.js +32 -0
- package/dist/{validation-XUGIWBJF.js → validation-Z6JXSTJS.js} +5 -5
- package/dist/version.js +1 -1
- package/dist/{work-G4RLJ634.js → work-OKWRFBDW.js} +18 -18
- package/dist/worker-B236AE72.js +22 -0
- package/package.json +5 -6
- package/dist/app-adapter.d.ts +0 -85
- package/dist/chat/api-turns/adapter-conversations.d.ts +0 -15
- package/dist/spawn-ZR6OOEAN.js +0 -37
- package/dist/task-runner-C52HYCVD.js +0 -32
- package/dist/worker-R2JEHK67.js +0 -22
|
@@ -13,24 +13,24 @@ import {
|
|
|
13
13
|
getPlugins,
|
|
14
14
|
setPlugins,
|
|
15
15
|
validatePlugins
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-4CNDGK25.js";
|
|
17
17
|
import "./chunk-3Y47VMHV.js";
|
|
18
|
-
import "./chunk-
|
|
19
|
-
import "./chunk-
|
|
20
|
-
import "./chunk-
|
|
21
|
-
import "./chunk-
|
|
18
|
+
import "./chunk-IZDYYYGP.js";
|
|
19
|
+
import "./chunk-BCHYQS4B.js";
|
|
20
|
+
import "./chunk-SHJK75Z2.js";
|
|
21
|
+
import "./chunk-DUKIDPF6.js";
|
|
22
22
|
import "./chunk-VFUK3X5B.js";
|
|
23
|
-
import "./chunk-
|
|
24
|
-
import "./chunk-
|
|
25
|
-
import "./chunk-
|
|
26
|
-
import "./chunk-
|
|
23
|
+
import "./chunk-6UDPINOX.js";
|
|
24
|
+
import "./chunk-BHYRYYLY.js";
|
|
25
|
+
import "./chunk-PJPRXO2T.js";
|
|
26
|
+
import "./chunk-LHXIZLFF.js";
|
|
27
27
|
import "./chunk-CEMMLV5L.js";
|
|
28
28
|
import "./chunk-N7TMSOZH.js";
|
|
29
29
|
import "./chunk-DWPN6SCH.js";
|
|
30
30
|
import "./chunk-TXKUKMVO.js";
|
|
31
|
-
import "./chunk-
|
|
31
|
+
import "./chunk-3S7ULUWW.js";
|
|
32
32
|
import "./chunk-PEQXYSSE.js";
|
|
33
|
-
import "./chunk-
|
|
33
|
+
import "./chunk-6VOYP4M6.js";
|
|
34
34
|
export {
|
|
35
35
|
PluginHookDeniedError,
|
|
36
36
|
applyPluginFormatMarkdown,
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import * as acp from "@agentclientprotocol/sdk";
|
|
2
|
+
import { type User } from "@sentry/junior-plugin-api";
|
|
3
|
+
import { type AcpState } from "./state";
|
|
4
|
+
import { type AcpRequestReceipt } from "./transport";
|
|
5
|
+
export type AcpAuthorizationCompletion = "busy" | "completed" | "conflict" | "expired" | "invalid";
|
|
6
|
+
export declare const ACP_AUTH_METHOD_ID = "junior";
|
|
7
|
+
export declare const ACP_AUTH_METHOD: {
|
|
8
|
+
id: string;
|
|
9
|
+
name: string;
|
|
10
|
+
description: string;
|
|
11
|
+
};
|
|
12
|
+
/** Create the secret cookie that proves control of one ACP connection. */
|
|
13
|
+
export declare function createAcpConnectionCredential(request: Request): {
|
|
14
|
+
cookie: string;
|
|
15
|
+
credentialHash: string;
|
|
16
|
+
};
|
|
17
|
+
/** Verify that this request controls the supplied ACP connection hash. */
|
|
18
|
+
export declare function hasAcpConnectionCredential(request: Request, expectedHash: string): boolean;
|
|
19
|
+
/** Start browser authorization for one ACP authenticate request. */
|
|
20
|
+
export declare function beginAcpAuthorization(args: {
|
|
21
|
+
baseURL?: string;
|
|
22
|
+
connectionId: string;
|
|
23
|
+
credentialHash: string;
|
|
24
|
+
request: Request;
|
|
25
|
+
requestId: acp.JsonRpcId;
|
|
26
|
+
requestKey: string;
|
|
27
|
+
state: AcpState;
|
|
28
|
+
}): Promise<AcpRequestReceipt>;
|
|
29
|
+
/** Bind a Google-authenticated user and resume the pending ACP request. */
|
|
30
|
+
export declare function completeAcpAuthorization(args: {
|
|
31
|
+
state: AcpState;
|
|
32
|
+
transactionId: string;
|
|
33
|
+
user: User;
|
|
34
|
+
userCode: string;
|
|
35
|
+
}): Promise<AcpAuthorizationCompletion>;
|
|
36
|
+
/** Consume a client response to the browser URL elicitation. */
|
|
37
|
+
export declare function handleAcpAuthorizationResponse(args: {
|
|
38
|
+
connectionId: string;
|
|
39
|
+
response: acp.AnyResponse;
|
|
40
|
+
state: AcpState;
|
|
41
|
+
}): Promise<"accepted" | "cancelled" | "ignored">;
|
|
42
|
+
/** Finish an abandoned browser authorization while its connection stream is live. */
|
|
43
|
+
export declare function expireAcpAuthorization(args: {
|
|
44
|
+
connectionId: string;
|
|
45
|
+
state: AcpState;
|
|
46
|
+
}): Promise<boolean>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/** Own the dashboard-authenticated ACP confirmation page. */
|
|
2
|
+
import type { User } from "@sentry/junior-plugin-api";
|
|
3
|
+
import type { AcpState } from "./state";
|
|
4
|
+
export declare const ACP_AUTHORIZATION_PATH = "/_junior/acp/auth/:transactionId";
|
|
5
|
+
/** Complete one ACP browser authorization for a host-authenticated user. */
|
|
6
|
+
export declare function handleAcpAuthorizationPage(args: {
|
|
7
|
+
agentName: string;
|
|
8
|
+
request: Request;
|
|
9
|
+
state: AcpState;
|
|
10
|
+
user: User;
|
|
11
|
+
}): Promise<Response>;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/** Bind ACP sessions to Junior's existing Conversation runtime. */
|
|
2
|
+
import type { StateAdapter } from "chat";
|
|
3
|
+
import type { User } from "@sentry/junior-plugin-api";
|
|
4
|
+
import type { ConversationEventStore } from "@/chat/conversations/history";
|
|
5
|
+
import type { ConversationStore } from "@/chat/conversations/store";
|
|
6
|
+
import type { ConversationWorkQueue } from "@/chat/task-execution/queue";
|
|
7
|
+
type ConversationMessage = {
|
|
8
|
+
id: string;
|
|
9
|
+
role: "assistant" | "user";
|
|
10
|
+
text: string;
|
|
11
|
+
};
|
|
12
|
+
type PromptAdmission = {
|
|
13
|
+
afterCursor: number;
|
|
14
|
+
messageId: string;
|
|
15
|
+
status: "accepted";
|
|
16
|
+
turnId: string;
|
|
17
|
+
} | {
|
|
18
|
+
status: "active";
|
|
19
|
+
} | {
|
|
20
|
+
status: "not_found";
|
|
21
|
+
};
|
|
22
|
+
type TurnTerminal = {
|
|
23
|
+
outcome: "cancelled" | "completed";
|
|
24
|
+
status: "completed";
|
|
25
|
+
} | {
|
|
26
|
+
failureCode: string;
|
|
27
|
+
status: "failed";
|
|
28
|
+
};
|
|
29
|
+
type TurnPage = {
|
|
30
|
+
cursor: number;
|
|
31
|
+
messages: ConversationMessage[];
|
|
32
|
+
terminal?: TurnTerminal;
|
|
33
|
+
};
|
|
34
|
+
/** ACP operations backed by Junior Conversations. */
|
|
35
|
+
export type AcpConversations = {
|
|
36
|
+
cancel(args: {
|
|
37
|
+
conversationId: string;
|
|
38
|
+
user: User;
|
|
39
|
+
}): Promise<"cancelled" | "not_found">;
|
|
40
|
+
create(args: {
|
|
41
|
+
conversationId: string;
|
|
42
|
+
user: User;
|
|
43
|
+
}): Promise<void>;
|
|
44
|
+
hasAccess(args: {
|
|
45
|
+
conversationId: string;
|
|
46
|
+
user: User;
|
|
47
|
+
}): Promise<boolean>;
|
|
48
|
+
prompt(args: {
|
|
49
|
+
conversationId: string;
|
|
50
|
+
idempotencyKey: string;
|
|
51
|
+
text: string;
|
|
52
|
+
user: User;
|
|
53
|
+
}): Promise<PromptAdmission>;
|
|
54
|
+
readMessages(conversationId: string): Promise<ConversationMessage[]>;
|
|
55
|
+
readTurn(args: {
|
|
56
|
+
afterCursor: number;
|
|
57
|
+
conversationId: string;
|
|
58
|
+
messageId: string;
|
|
59
|
+
turnId: string;
|
|
60
|
+
}): Promise<TurnPage>;
|
|
61
|
+
};
|
|
62
|
+
interface ConversationOptions {
|
|
63
|
+
conversationStore?: ConversationStore;
|
|
64
|
+
eventStore: ConversationEventStore;
|
|
65
|
+
queue: ConversationWorkQueue;
|
|
66
|
+
state: StateAdapter;
|
|
67
|
+
}
|
|
68
|
+
/** Create the ACP view of Junior's Conversation runtime. */
|
|
69
|
+
export declare function createAcpConversations(options: ConversationOptions): AcpConversations;
|
|
70
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { ReportAcpError } from "./errors";
|
|
2
|
+
import type { AcpConversations } from "./conversations";
|
|
3
|
+
import type { AcpState } from "./state";
|
|
4
|
+
/** Dependencies for the serverless-safe remote ACP HTTP handler. */
|
|
5
|
+
type AcpHttpHandlerOptions = {
|
|
6
|
+
browserAuth?: {
|
|
7
|
+
baseURL?: string;
|
|
8
|
+
};
|
|
9
|
+
conversations: AcpConversations;
|
|
10
|
+
onError?: ReportAcpError;
|
|
11
|
+
state: AcpState;
|
|
12
|
+
version: string;
|
|
13
|
+
};
|
|
14
|
+
/** Create a serverless-safe remote ACP v1 HTTP handler. */
|
|
15
|
+
export declare function createAcpHttpHandler(options: AcpHttpHandlerOptions): (request: Request) => Promise<Response>;
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const SESSION_HEADER_METHODS: Set<string>;
|
|
3
|
+
export declare const acpConnectionIdSchema: z.ZodString;
|
|
4
|
+
export declare const acpSessionIdSchema: z.ZodString;
|
|
5
|
+
export declare const acpCallSchema: z.ZodObject<{
|
|
6
|
+
id: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodNull]>>;
|
|
7
|
+
jsonrpc: z.ZodLiteral<"2.0">;
|
|
8
|
+
method: z.ZodString;
|
|
9
|
+
params: z.ZodOptional<z.ZodUnknown>;
|
|
10
|
+
}, z.core.$strict>;
|
|
11
|
+
export declare const acpResponseSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
12
|
+
id: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodNull]>;
|
|
13
|
+
jsonrpc: z.ZodLiteral<"2.0">;
|
|
14
|
+
result: z.ZodUnknown;
|
|
15
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
16
|
+
error: z.ZodObject<{
|
|
17
|
+
code: z.ZodNumber;
|
|
18
|
+
data: z.ZodOptional<z.ZodUnknown>;
|
|
19
|
+
message: z.ZodString;
|
|
20
|
+
}, z.core.$strict>;
|
|
21
|
+
id: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodNull]>;
|
|
22
|
+
jsonrpc: z.ZodLiteral<"2.0">;
|
|
23
|
+
}, z.core.$strict>]>;
|
|
24
|
+
export declare const acpInboundMessageSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
25
|
+
id: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodNull]>>;
|
|
26
|
+
jsonrpc: z.ZodLiteral<"2.0">;
|
|
27
|
+
method: z.ZodString;
|
|
28
|
+
params: z.ZodOptional<z.ZodUnknown>;
|
|
29
|
+
}, z.core.$strict>, z.ZodUnion<readonly [z.ZodObject<{
|
|
30
|
+
id: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodNull]>;
|
|
31
|
+
jsonrpc: z.ZodLiteral<"2.0">;
|
|
32
|
+
result: z.ZodUnknown;
|
|
33
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
34
|
+
error: z.ZodObject<{
|
|
35
|
+
code: z.ZodNumber;
|
|
36
|
+
data: z.ZodOptional<z.ZodUnknown>;
|
|
37
|
+
message: z.ZodString;
|
|
38
|
+
}, z.core.$strict>;
|
|
39
|
+
id: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodNull]>;
|
|
40
|
+
jsonrpc: z.ZodLiteral<"2.0">;
|
|
41
|
+
}, z.core.$strict>]>]>;
|
|
42
|
+
export declare const initializeParamsSchema: z.ZodObject<{
|
|
43
|
+
_meta: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
44
|
+
clientCapabilities: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
45
|
+
clientInfo: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
46
|
+
_meta: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
47
|
+
name: z.ZodString;
|
|
48
|
+
title: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
49
|
+
version: z.ZodString;
|
|
50
|
+
}, z.core.$strict>>>;
|
|
51
|
+
protocolVersion: z.ZodNumber;
|
|
52
|
+
}, z.core.$strict>;
|
|
53
|
+
export declare const authenticateParamsSchema: z.ZodObject<{
|
|
54
|
+
_meta: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
55
|
+
methodId: z.ZodString;
|
|
56
|
+
}, z.core.$strict>;
|
|
57
|
+
export declare const newSessionParamsSchema: z.ZodObject<{
|
|
58
|
+
_meta: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
59
|
+
additionalDirectories: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
60
|
+
cwd: z.ZodString;
|
|
61
|
+
mcpServers: z.ZodArray<z.ZodUnknown>;
|
|
62
|
+
}, z.core.$strict>;
|
|
63
|
+
export declare const loadSessionParamsSchema: z.ZodObject<{
|
|
64
|
+
_meta: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
65
|
+
additionalDirectories: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
66
|
+
cwd: z.ZodString;
|
|
67
|
+
mcpServers: z.ZodArray<z.ZodUnknown>;
|
|
68
|
+
sessionId: z.ZodString;
|
|
69
|
+
}, z.core.$strict>;
|
|
70
|
+
export declare const promptParamsSchema: z.ZodObject<{
|
|
71
|
+
_meta: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
72
|
+
prompt: z.ZodArray<z.ZodObject<{
|
|
73
|
+
_meta: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
74
|
+
annotations: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
75
|
+
_meta: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
76
|
+
audience: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodEnum<{
|
|
77
|
+
user: "user";
|
|
78
|
+
assistant: "assistant";
|
|
79
|
+
}>>>>;
|
|
80
|
+
lastModified: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
81
|
+
priority: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
82
|
+
}, z.core.$strict>>>;
|
|
83
|
+
text: z.ZodString;
|
|
84
|
+
type: z.ZodLiteral<"text">;
|
|
85
|
+
}, z.core.$strict>>;
|
|
86
|
+
sessionId: z.ZodString;
|
|
87
|
+
}, z.core.$strict>;
|
|
88
|
+
export declare const cancelParamsSchema: z.ZodObject<{
|
|
89
|
+
_meta: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
90
|
+
sessionId: z.ZodString;
|
|
91
|
+
}, z.core.$strict>;
|
|
92
|
+
export type AcpCall = z.output<typeof acpCallSchema>;
|
|
93
|
+
export type AcpResponse = z.output<typeof acpResponseSchema>;
|
|
94
|
+
export type SessionParams = z.output<typeof newSessionParamsSchema>;
|
|
95
|
+
export type LoadSessionParams = z.output<typeof loadSessionParamsSchema>;
|
|
96
|
+
export type PromptParams = z.output<typeof promptParamsSchema>;
|
|
97
|
+
export type CancelParams = z.output<typeof cancelParamsSchema>;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { Lock, StateAdapter } from "chat";
|
|
2
|
+
/** One lock held in shared ACP state. */
|
|
3
|
+
export type AcpLock = Lock;
|
|
4
|
+
/** Shared state operations required by the ACP transport. */
|
|
5
|
+
export type AcpState = Pick<StateAdapter, "acquireLock" | "appendToList" | "delete" | "extendLock" | "get" | "getList" | "releaseLock" | "set">;
|
|
6
|
+
export declare const MUTATION_LOCK_TTL_MS = 10000;
|
|
7
|
+
type LockAttempt<T> = {
|
|
8
|
+
acquired: false;
|
|
9
|
+
} | {
|
|
10
|
+
acquired: true;
|
|
11
|
+
value: T;
|
|
12
|
+
};
|
|
13
|
+
/** Run one ACP state mutation while its shared lock remains owned. */
|
|
14
|
+
export declare function withLock<T>(state: AcpState, key: string, run: (lock: AcpLock) => Promise<T>, options?: {
|
|
15
|
+
keepAlive?: boolean;
|
|
16
|
+
retryMs?: number;
|
|
17
|
+
ttlMs?: number;
|
|
18
|
+
waitMs?: number;
|
|
19
|
+
}): Promise<LockAttempt<T>>;
|
|
20
|
+
/** Prove ACP lock ownership immediately before a blind state write. */
|
|
21
|
+
export declare function fenceLock(state: AcpState, lock: AcpLock, ttlMs?: number): Promise<void>;
|
|
22
|
+
export {};
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { type User } from "@sentry/junior-plugin-api";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import type { ReportAcpError } from "./errors";
|
|
4
|
+
import type { AcpConversations } from "./conversations";
|
|
5
|
+
import { type AcpState } from "./state";
|
|
6
|
+
export declare const ACP_STATE_TTL_MS: number;
|
|
7
|
+
declare const acpConnectionSchema: z.ZodObject<{
|
|
8
|
+
credentialHash: z.ZodString;
|
|
9
|
+
nonce: z.ZodString;
|
|
10
|
+
user: z.ZodOptional<z.ZodObject<{
|
|
11
|
+
displayName: z.ZodOptional<z.ZodString>;
|
|
12
|
+
email: z.ZodString;
|
|
13
|
+
id: z.ZodString;
|
|
14
|
+
identities: z.ZodArray<z.ZodObject<{
|
|
15
|
+
displayName: z.ZodOptional<z.ZodString>;
|
|
16
|
+
handle: z.ZodOptional<z.ZodString>;
|
|
17
|
+
id: z.ZodString;
|
|
18
|
+
provider: z.ZodString;
|
|
19
|
+
providerSubjectId: z.ZodString;
|
|
20
|
+
providerTenantId: z.ZodOptional<z.ZodString>;
|
|
21
|
+
}, z.core.$strict>>;
|
|
22
|
+
}, z.core.$strict>>;
|
|
23
|
+
}, z.core.$strict>;
|
|
24
|
+
declare const acpStreamRouteSchema: z.ZodObject<{
|
|
25
|
+
connectionId: z.ZodString;
|
|
26
|
+
sessionId: z.ZodOptional<z.ZodString>;
|
|
27
|
+
}, z.core.$strict>;
|
|
28
|
+
declare const acpPromptStreamOutputSchema: z.ZodObject<{
|
|
29
|
+
afterSeq: z.ZodNumber;
|
|
30
|
+
kind: z.ZodLiteral<"prompt">;
|
|
31
|
+
messageId: z.ZodString;
|
|
32
|
+
requestId: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodNull]>;
|
|
33
|
+
turnId: z.ZodString;
|
|
34
|
+
}, z.core.$strict>;
|
|
35
|
+
declare const acpRequestReceiptSchema: z.ZodObject<{
|
|
36
|
+
deliveryKey: z.ZodOptional<z.ZodString>;
|
|
37
|
+
outputs: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
38
|
+
kind: z.ZodLiteral<"message">;
|
|
39
|
+
message: z.ZodUnion<readonly [z.ZodObject<{
|
|
40
|
+
id: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodNull]>>;
|
|
41
|
+
jsonrpc: z.ZodLiteral<"2.0">;
|
|
42
|
+
method: z.ZodString;
|
|
43
|
+
params: z.ZodOptional<z.ZodUnknown>;
|
|
44
|
+
}, z.core.$strict>, z.ZodUnion<readonly [z.ZodObject<{
|
|
45
|
+
id: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodNull]>;
|
|
46
|
+
jsonrpc: z.ZodLiteral<"2.0">;
|
|
47
|
+
result: z.ZodUnknown;
|
|
48
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
49
|
+
error: z.ZodObject<{
|
|
50
|
+
code: z.ZodNumber;
|
|
51
|
+
data: z.ZodOptional<z.ZodUnknown>;
|
|
52
|
+
message: z.ZodString;
|
|
53
|
+
}, z.core.$strict>;
|
|
54
|
+
id: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodNull]>;
|
|
55
|
+
jsonrpc: z.ZodLiteral<"2.0">;
|
|
56
|
+
}, z.core.$strict>]>]>;
|
|
57
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
58
|
+
kind: z.ZodLiteral<"replay">;
|
|
59
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
60
|
+
afterSeq: z.ZodNumber;
|
|
61
|
+
kind: z.ZodLiteral<"prompt">;
|
|
62
|
+
messageId: z.ZodString;
|
|
63
|
+
requestId: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodNull]>;
|
|
64
|
+
turnId: z.ZodString;
|
|
65
|
+
}, z.core.$strict>], "kind">>;
|
|
66
|
+
sessionId: z.ZodOptional<z.ZodString>;
|
|
67
|
+
}, z.core.$strict>;
|
|
68
|
+
export type AcpConnection = z.output<typeof acpConnectionSchema>;
|
|
69
|
+
export type AcpStreamRoute = z.output<typeof acpStreamRouteSchema>;
|
|
70
|
+
export type AcpPromptStreamOutput = z.output<typeof acpPromptStreamOutputSchema>;
|
|
71
|
+
export type AcpRequestReceipt = z.output<typeof acpRequestReceiptSchema>;
|
|
72
|
+
/** Create one unauthenticated ACP transport connection. */
|
|
73
|
+
export declare function createAcpConnection(state: AcpState, credentialHash: string): Promise<{
|
|
74
|
+
connection: AcpConnection;
|
|
75
|
+
connectionId: string;
|
|
76
|
+
}>;
|
|
77
|
+
/** Read one live ACP transport connection. */
|
|
78
|
+
export declare function readAcpConnection(state: AcpState, connectionId: string): Promise<AcpConnection | undefined>;
|
|
79
|
+
/** Remove one ACP connection so all of its live streams terminate. */
|
|
80
|
+
export declare function deleteAcpConnection(state: AcpState, connectionId: string): Promise<void>;
|
|
81
|
+
/** Bind one live ACP connection to the canonical authorized user. */
|
|
82
|
+
export declare function bindAcpConnectionUser(args: {
|
|
83
|
+
connectionId: string;
|
|
84
|
+
credentialHash: string;
|
|
85
|
+
state: AcpState;
|
|
86
|
+
user: User;
|
|
87
|
+
}): Promise<"completed" | "conflict" | "expired">;
|
|
88
|
+
/** Replace one pending request receipt and queue its final output once. */
|
|
89
|
+
export declare function completeAcpRequest(args: {
|
|
90
|
+
connectionId: string;
|
|
91
|
+
receipt: AcpRequestReceipt;
|
|
92
|
+
requestKey: string;
|
|
93
|
+
state: AcpState;
|
|
94
|
+
}): Promise<"completed" | "expired" | "full">;
|
|
95
|
+
/** Store a receipt once and reserve output before side-effecting creation. */
|
|
96
|
+
export declare function acceptAcpRequest(args: {
|
|
97
|
+
connectionId: string;
|
|
98
|
+
createReceipt: () => Promise<AcpRequestReceipt>;
|
|
99
|
+
reserveRoute?: AcpStreamRoute;
|
|
100
|
+
requestKey: string;
|
|
101
|
+
state: AcpState;
|
|
102
|
+
}): Promise<"accepted" | "busy" | "expired" | "full">;
|
|
103
|
+
/** Open one connection or session SSE reader backed by shared state. */
|
|
104
|
+
export declare function openAcpSse(args: {
|
|
105
|
+
conversations: AcpConversations;
|
|
106
|
+
maintain?: () => Promise<void>;
|
|
107
|
+
onError?: ReportAcpError;
|
|
108
|
+
requestSignal: AbortSignal;
|
|
109
|
+
route: AcpStreamRoute;
|
|
110
|
+
state: AcpState;
|
|
111
|
+
userId?: string;
|
|
112
|
+
}): Promise<Response>;
|
|
113
|
+
export {};
|
package/dist/api.js
CHANGED
|
@@ -60,12 +60,12 @@ import {
|
|
|
60
60
|
resolveSlackConversationContextFromThreadId,
|
|
61
61
|
viewerConversationMembership,
|
|
62
62
|
webActorFromEmail
|
|
63
|
-
} from "./chunk-
|
|
63
|
+
} from "./chunk-UBOIHNTH.js";
|
|
64
64
|
import {
|
|
65
65
|
buildSentryConversationUrl,
|
|
66
66
|
getWebAuthorization
|
|
67
|
-
} from "./chunk-
|
|
68
|
-
import "./chunk-
|
|
67
|
+
} from "./chunk-LCP4EDKR.js";
|
|
68
|
+
import "./chunk-M5YWNMTE.js";
|
|
69
69
|
import {
|
|
70
70
|
readTaskExecutionByConversationId,
|
|
71
71
|
readTaskExecutionDays,
|
|
@@ -73,9 +73,9 @@ import {
|
|
|
73
73
|
readTaskExecutionSummaries,
|
|
74
74
|
readTaskExecutions,
|
|
75
75
|
readTaskRuns
|
|
76
|
-
} from "./chunk-
|
|
76
|
+
} from "./chunk-6WGC3SO4.js";
|
|
77
77
|
import "./chunk-M3QYTBQ6.js";
|
|
78
|
-
import "./chunk-
|
|
78
|
+
import "./chunk-E57WPXWY.js";
|
|
79
79
|
import {
|
|
80
80
|
healthReportSchema,
|
|
81
81
|
pluginOperationalReportFeedSchema,
|
|
@@ -83,7 +83,7 @@ import {
|
|
|
83
83
|
runtimeInfoReportSchema,
|
|
84
84
|
skillReportsSchema
|
|
85
85
|
} from "./chunk-UTL3MHPC.js";
|
|
86
|
-
import "./chunk-
|
|
86
|
+
import "./chunk-UF6BUA5W.js";
|
|
87
87
|
import {
|
|
88
88
|
deleteEventTask,
|
|
89
89
|
eventTaskBelongsToUser,
|
|
@@ -100,31 +100,31 @@ import {
|
|
|
100
100
|
readScheduledTask,
|
|
101
101
|
readStats,
|
|
102
102
|
saveScheduledTask
|
|
103
|
-
} from "./chunk-
|
|
103
|
+
} from "./chunk-HIPUIPJM.js";
|
|
104
104
|
import {
|
|
105
105
|
parseSlackThreadId
|
|
106
|
-
} from "./chunk-
|
|
106
|
+
} from "./chunk-YKX6MTLU.js";
|
|
107
107
|
import {
|
|
108
108
|
cancelHumanFacingPendingMessages,
|
|
109
109
|
getConversation
|
|
110
|
-
} from "./chunk-
|
|
111
|
-
import "./chunk-
|
|
110
|
+
} from "./chunk-Z3QAXJR7.js";
|
|
111
|
+
import "./chunk-JA43DV4Y.js";
|
|
112
112
|
import {
|
|
113
113
|
agentTurnUsageSchema,
|
|
114
114
|
fallbackShortTitle,
|
|
115
115
|
hasAgentTurnUsage,
|
|
116
116
|
renderJuniorNativeConversationEvent
|
|
117
|
-
} from "./chunk-
|
|
117
|
+
} from "./chunk-2ZQPVX7C.js";
|
|
118
118
|
import {
|
|
119
119
|
getCachedSnapshot
|
|
120
|
-
} from "./chunk-
|
|
120
|
+
} from "./chunk-MAPJFUMV.js";
|
|
121
121
|
import "./chunk-PDO5BLNM.js";
|
|
122
122
|
import {
|
|
123
123
|
getVercelConversationWorkQueue
|
|
124
124
|
} from "./chunk-DKIJ2RP5.js";
|
|
125
125
|
import "./chunk-JAL3CH4G.js";
|
|
126
126
|
import "./chunk-7H2VZTWN.js";
|
|
127
|
-
import "./chunk-
|
|
127
|
+
import "./chunk-MLSQX2EX.js";
|
|
128
128
|
import {
|
|
129
129
|
SANDBOX_RUNTIME,
|
|
130
130
|
WorkspaceValidationError,
|
|
@@ -144,7 +144,7 @@ import {
|
|
|
144
144
|
updateWorkspace,
|
|
145
145
|
withSlackRetries,
|
|
146
146
|
workspaceRepoCheckoutPath
|
|
147
|
-
} from "./chunk-
|
|
147
|
+
} from "./chunk-4CNDGK25.js";
|
|
148
148
|
import "./chunk-3Y47VMHV.js";
|
|
149
149
|
import {
|
|
150
150
|
decodeStoredConversationEvent,
|
|
@@ -154,7 +154,7 @@ import {
|
|
|
154
154
|
locationFromRow,
|
|
155
155
|
parseSessionSource,
|
|
156
156
|
resolveRootConversationId
|
|
157
|
-
} from "./chunk-
|
|
157
|
+
} from "./chunk-IZDYYYGP.js";
|
|
158
158
|
import {
|
|
159
159
|
conversationReadColumns,
|
|
160
160
|
juniorApiTokens,
|
|
@@ -166,19 +166,19 @@ import {
|
|
|
166
166
|
juniorIdentities,
|
|
167
167
|
juniorSchedulerTasks,
|
|
168
168
|
juniorUsers
|
|
169
|
-
} from "./chunk-
|
|
169
|
+
} from "./chunk-BCHYQS4B.js";
|
|
170
170
|
import {
|
|
171
171
|
create,
|
|
172
172
|
hash
|
|
173
|
-
} from "./chunk-
|
|
174
|
-
import "./chunk-
|
|
173
|
+
} from "./chunk-SHJK75Z2.js";
|
|
174
|
+
import "./chunk-DUKIDPF6.js";
|
|
175
175
|
import {
|
|
176
176
|
juniorDestinations
|
|
177
177
|
} from "./chunk-VFUK3X5B.js";
|
|
178
|
-
import "./chunk-
|
|
179
|
-
import "./chunk-
|
|
180
|
-
import "./chunk-
|
|
181
|
-
import "./chunk-
|
|
178
|
+
import "./chunk-6UDPINOX.js";
|
|
179
|
+
import "./chunk-BHYRYYLY.js";
|
|
180
|
+
import "./chunk-PJPRXO2T.js";
|
|
181
|
+
import "./chunk-LHXIZLFF.js";
|
|
182
182
|
import "./chunk-CEMMLV5L.js";
|
|
183
183
|
import {
|
|
184
184
|
parseSlackChannelId,
|
|
@@ -190,9 +190,9 @@ import "./chunk-TXKUKMVO.js";
|
|
|
190
190
|
import {
|
|
191
191
|
logException,
|
|
192
192
|
logWarn
|
|
193
|
-
} from "./chunk-
|
|
193
|
+
} from "./chunk-3S7ULUWW.js";
|
|
194
194
|
import "./chunk-PEQXYSSE.js";
|
|
195
|
-
import "./chunk-
|
|
195
|
+
import "./chunk-6VOYP4M6.js";
|
|
196
196
|
|
|
197
197
|
// src/api.ts
|
|
198
198
|
import { Hono as Hono9 } from "hono";
|
|
@@ -4314,7 +4314,7 @@ async function readPeoplePluginReports(args) {
|
|
|
4314
4314
|
source: "plugins"
|
|
4315
4315
|
});
|
|
4316
4316
|
}
|
|
4317
|
-
const { getPluginProfileReports } = await import("./agent-hooks-
|
|
4317
|
+
const { getPluginProfileReports } = await import("./agent-hooks-XTZVALGQ.js");
|
|
4318
4318
|
return pluginOperationalReportFeedSchema.parse({
|
|
4319
4319
|
generatedAt: new Date(nowMs).toISOString(),
|
|
4320
4320
|
reports: await getPluginProfileReports({
|
|
@@ -5110,7 +5110,7 @@ function readDescriptionText(home) {
|
|
|
5110
5110
|
}
|
|
5111
5111
|
}
|
|
5112
5112
|
async function readSkillReports() {
|
|
5113
|
-
const { discoverSkills } = await import("./skills-
|
|
5113
|
+
const { discoverSkills } = await import("./skills-X3DY7AXO.js");
|
|
5114
5114
|
const skills = await discoverSkills();
|
|
5115
5115
|
return skillReportsSchema.parse(
|
|
5116
5116
|
skills.map((skill) => ({
|
|
@@ -5120,7 +5120,7 @@ async function readSkillReports() {
|
|
|
5120
5120
|
);
|
|
5121
5121
|
}
|
|
5122
5122
|
async function readPlugins() {
|
|
5123
|
-
const { pluginCatalogRuntime } = await import("./catalog-runtime-
|
|
5123
|
+
const { pluginCatalogRuntime } = await import("./catalog-runtime-5357XR4F.js");
|
|
5124
5124
|
return pluginsSchema.parse(
|
|
5125
5125
|
pluginCatalogRuntime.getProviders().map((plugin) => ({
|
|
5126
5126
|
configKeys: plugin.manifest.configKeys ?? [],
|
|
@@ -5133,7 +5133,7 @@ async function readPlugins() {
|
|
|
5133
5133
|
async function readRuntimeInfoReport() {
|
|
5134
5134
|
const [{ homeDir }, { pluginCatalogRuntime }, plugins, skills] = await Promise.all([
|
|
5135
5135
|
import("./discovery-DWVDM7UK.js"),
|
|
5136
|
-
import("./catalog-runtime-
|
|
5136
|
+
import("./catalog-runtime-5357XR4F.js"),
|
|
5137
5137
|
readPlugins(),
|
|
5138
5138
|
readSkillReports()
|
|
5139
5139
|
]);
|
|
@@ -5149,7 +5149,7 @@ async function readRuntimeInfoReport() {
|
|
|
5149
5149
|
}
|
|
5150
5150
|
async function readPluginOperationalReportFeed() {
|
|
5151
5151
|
const nowMs = Date.now();
|
|
5152
|
-
const { getPluginOperationalReports } = await import("./agent-hooks-
|
|
5152
|
+
const { getPluginOperationalReports } = await import("./agent-hooks-XTZVALGQ.js");
|
|
5153
5153
|
return pluginOperationalReportFeedSchema.parse({
|
|
5154
5154
|
source: "plugins",
|
|
5155
5155
|
generatedAt: new Date(nowMs).toISOString(),
|
package/dist/app.d.ts
CHANGED
|
@@ -4,15 +4,11 @@ import { type SandboxResourceConfig } from "@/chat/sandbox/resources";
|
|
|
4
4
|
import { type JuniorPluginSet } from "./plugins";
|
|
5
5
|
import type { ConversationWorkCallbackOptions } from "@/chat/app/conversation-work";
|
|
6
6
|
import type { WaitUntilFn } from "@/handlers/types";
|
|
7
|
-
import type { JuniorAppAdapter } from "./app-adapter";
|
|
8
7
|
import { JUNIOR_VERSION } from "./version";
|
|
9
8
|
export { defineJuniorPlugins } from "./plugins";
|
|
10
9
|
export { JUNIOR_VERSION };
|
|
11
10
|
export type { JuniorPluginInput, JuniorPluginSet, JuniorPluginSetOptions, } from "./plugins";
|
|
12
|
-
export type { AdapterConversations, AdapterMessage, AdapterPromptAdmission, AdapterTurnPage, AdapterTurnTerminal, JuniorAdapterState, JuniorAppAdapter, JuniorAppAdapterContext, JuniorAppAdapterRoutes, JuniorAuthenticatedRoute, } from "./app-adapter";
|
|
13
11
|
export interface JuniorAppOptions {
|
|
14
|
-
/** Non-plugin adapters mounted against Junior's shared runtime. */
|
|
15
|
-
adapters?: readonly JuniorAppAdapter[];
|
|
16
12
|
/** Authenticated dashboard mounted by core when configured. */
|
|
17
13
|
dashboard?: JuniorDashboardOptions;
|
|
18
14
|
/**
|