@sentry/junior-plugin-api 0.198.0 → 0.200.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/index.d.ts +2025 -19
- package/package.json +4 -5
- package/dist/annotations.d.ts +0 -75
- package/dist/cli.d.ts +0 -39
- package/dist/code.d.ts +0 -37
- package/dist/context.d.ts +0 -158
- package/dist/conversation-events.d.ts +0 -80
- package/dist/credentials.d.ts +0 -184
- package/dist/dispatch.d.ts +0 -16
- package/dist/egress-policy.d.ts +0 -9
- package/dist/hooks.d.ts +0 -43
- package/dist/manifest.d.ts +0 -76
- package/dist/operations.d.ts +0 -153
- package/dist/prompt.d.ts +0 -56
- package/dist/registration.d.ts +0 -28
- package/dist/resource-events.d.ts +0 -128
- package/dist/schemas.d.ts +0 -261
- package/dist/state.d.ts +0 -10
- package/dist/tasks.d.ts +0 -250
- package/dist/tools.d.ts +0 -351
- package/dist/user-pages.d.ts +0 -97
- package/src/annotations.ts +0 -78
- package/src/cli.ts +0 -54
- package/src/code.ts +0 -37
- package/src/context.ts +0 -241
- package/src/conversation-events.ts +0 -136
- package/src/credentials.ts +0 -221
- package/src/dispatch.ts +0 -31
- package/src/egress-policy.ts +0 -15
- package/src/hooks.ts +0 -118
- package/src/index.ts +0 -29
- package/src/manifest.ts +0 -89
- package/src/operations.ts +0 -199
- package/src/prompt.ts +0 -99
- package/src/registration.ts +0 -173
- package/src/resource-events.ts +0 -320
- package/src/schemas.ts +0 -348
- package/src/state.ts +0 -15
- package/src/tasks.ts +0 -105
- package/src/tools.ts +0 -579
- package/src/user-pages.ts +0 -130
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sentry/junior-plugin-api",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.200.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -13,13 +13,12 @@
|
|
|
13
13
|
},
|
|
14
14
|
"exports": {
|
|
15
15
|
".": {
|
|
16
|
-
"types": "./
|
|
16
|
+
"types": "./dist/index.d.ts",
|
|
17
17
|
"default": "./dist/index.js"
|
|
18
18
|
}
|
|
19
19
|
},
|
|
20
20
|
"files": [
|
|
21
|
-
"dist"
|
|
22
|
-
"src"
|
|
21
|
+
"dist"
|
|
23
22
|
],
|
|
24
23
|
"dependencies": {
|
|
25
24
|
"commander": "^14.0.3",
|
|
@@ -32,7 +31,7 @@
|
|
|
32
31
|
"typescript": "^6.0.3"
|
|
33
32
|
},
|
|
34
33
|
"scripts": {
|
|
35
|
-
"build": "tsup
|
|
34
|
+
"build": "tsup",
|
|
36
35
|
"lint": "oxlint --config ../junior/.oxlintrc.json --deny-warnings src tsup.config.ts",
|
|
37
36
|
"typecheck": "tsc --noEmit"
|
|
38
37
|
}
|
package/dist/annotations.d.ts
DELETED
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
import type { PluginContext } from "./context";
|
|
3
|
-
export declare const resourceLinkAnnotationSchema: z.ZodObject<{
|
|
4
|
-
kind: z.ZodLiteral<"resource_link">;
|
|
5
|
-
key: z.ZodString;
|
|
6
|
-
label: z.ZodString;
|
|
7
|
-
url: z.ZodString;
|
|
8
|
-
description: z.ZodOptional<z.ZodString>;
|
|
9
|
-
status: z.ZodOptional<z.ZodEnum<{
|
|
10
|
-
open: "open";
|
|
11
|
-
draft: "draft";
|
|
12
|
-
closed: "closed";
|
|
13
|
-
merged: "merged";
|
|
14
|
-
warning: "warning";
|
|
15
|
-
}>>;
|
|
16
|
-
}, z.core.$strict>;
|
|
17
|
-
/** Core-known annotation shapes that plugins may attach to a conversation. */
|
|
18
|
-
export declare const conversationAnnotationInputSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
19
|
-
kind: z.ZodLiteral<"resource_link">;
|
|
20
|
-
key: z.ZodString;
|
|
21
|
-
label: z.ZodString;
|
|
22
|
-
url: z.ZodString;
|
|
23
|
-
description: z.ZodOptional<z.ZodString>;
|
|
24
|
-
status: z.ZodOptional<z.ZodEnum<{
|
|
25
|
-
open: "open";
|
|
26
|
-
draft: "draft";
|
|
27
|
-
closed: "closed";
|
|
28
|
-
merged: "merged";
|
|
29
|
-
warning: "warning";
|
|
30
|
-
}>>;
|
|
31
|
-
}, z.core.$strict>], "kind">;
|
|
32
|
-
export type ConversationAnnotationInput = z.output<typeof conversationAnnotationInputSchema>;
|
|
33
|
-
export type ConversationAnnotation = ConversationAnnotationInput & {
|
|
34
|
-
plugin: string;
|
|
35
|
-
createdAt: string;
|
|
36
|
-
updatedAt: string;
|
|
37
|
-
};
|
|
38
|
-
export interface PluginAnnotations {
|
|
39
|
-
upsert(annotation: ConversationAnnotationInput): Promise<void>;
|
|
40
|
-
remove(kind: ConversationAnnotationInput["kind"], key: string): Promise<void>;
|
|
41
|
-
list(): Promise<ConversationAnnotation[]>;
|
|
42
|
-
}
|
|
43
|
-
export interface PluginConversationAnnotations {
|
|
44
|
-
forConversation(conversationId: string): PluginAnnotations;
|
|
45
|
-
}
|
|
46
|
-
export declare const conversationSidebarIconSchema: z.ZodEnum<{
|
|
47
|
-
"circle-dot": "circle-dot";
|
|
48
|
-
"circle-dashed": "circle-dashed";
|
|
49
|
-
"circle-x": "circle-x";
|
|
50
|
-
"git-merge": "git-merge";
|
|
51
|
-
"git-pull-request": "git-pull-request";
|
|
52
|
-
"triangle-alert": "triangle-alert";
|
|
53
|
-
}>;
|
|
54
|
-
export declare const conversationSidebarAnnotationSchema: z.ZodObject<{
|
|
55
|
-
icon: z.ZodOptional<z.ZodEnum<{
|
|
56
|
-
"circle-dot": "circle-dot";
|
|
57
|
-
"circle-dashed": "circle-dashed";
|
|
58
|
-
"circle-x": "circle-x";
|
|
59
|
-
"git-merge": "git-merge";
|
|
60
|
-
"git-pull-request": "git-pull-request";
|
|
61
|
-
"triangle-alert": "triangle-alert";
|
|
62
|
-
}>>;
|
|
63
|
-
key: z.ZodString;
|
|
64
|
-
label: z.ZodString;
|
|
65
|
-
}, z.core.$strict>;
|
|
66
|
-
export type ConversationSidebarAnnotation = z.output<typeof conversationSidebarAnnotationSchema>;
|
|
67
|
-
export interface ConversationSidebarHookContext extends PluginContext {
|
|
68
|
-
/** Stored annotations owned by this plugin, keyed by candidate conversation. */
|
|
69
|
-
annotationsByConversationId: Record<string, ConversationAnnotation[]>;
|
|
70
|
-
conversationIds: string[];
|
|
71
|
-
}
|
|
72
|
-
export interface ConversationSidebarResult {
|
|
73
|
-
/** Sidebar annotations in display order. Put the newest annotation first. */
|
|
74
|
-
annotationsByConversationId: Record<string, ConversationSidebarAnnotation[]>;
|
|
75
|
-
}
|
package/dist/cli.d.ts
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Public Commander-based CLI contract for plugin-owned admin commands.
|
|
3
|
-
* Junior owns the root command, plugin namespaces, context injection, and exit
|
|
4
|
-
* normalization; plugins only configure subcommands under their namespace.
|
|
5
|
-
*/
|
|
6
|
-
import type { Command } from "commander";
|
|
7
|
-
import type { PluginContext } from "./context";
|
|
8
|
-
export interface PluginCliIo {
|
|
9
|
-
writeError(text: string): Promise<void> | void;
|
|
10
|
-
writeOutput(text: string): Promise<void> | void;
|
|
11
|
-
}
|
|
12
|
-
export interface PluginCliActionCommand {
|
|
13
|
-
name: string;
|
|
14
|
-
summary: string;
|
|
15
|
-
}
|
|
16
|
-
/** Host/admin context exposed to plugin-owned CLI command actions. */
|
|
17
|
-
export interface PluginCliActionContext extends Pick<PluginContext, "db" | "log" | "plugin"> {
|
|
18
|
-
command: PluginCliActionCommand;
|
|
19
|
-
io: PluginCliIo;
|
|
20
|
-
}
|
|
21
|
-
/** Plugin action callback wrapped by the Junior host for context and exit codes. */
|
|
22
|
-
export type PluginCliActionHandler<Args extends unknown[] = unknown[]> = (ctx: PluginCliActionContext, ...args: Args) => Promise<number | void> | number | void;
|
|
23
|
-
export interface PluginCliHost {
|
|
24
|
-
/** Wrap a Commander action so Junior can inject context and normalize exits. */
|
|
25
|
-
action<Args extends unknown[]>(handler: PluginCliActionHandler<Args>): (...args: Args) => Promise<void>;
|
|
26
|
-
}
|
|
27
|
-
/** Plugin-owned top-level CLI command registration. */
|
|
28
|
-
export interface PluginCliCommandDefinition {
|
|
29
|
-
/** Configure subcommands under the host-created top-level namespace. */
|
|
30
|
-
configure(command: Command, junior: PluginCliHost): void;
|
|
31
|
-
/** Unique host-level command namespace owned by this plugin. */
|
|
32
|
-
name: string;
|
|
33
|
-
/** One-line summary used in generated command help. */
|
|
34
|
-
summary: string;
|
|
35
|
-
}
|
|
36
|
-
/** Plugin-owned CLI command catalog. */
|
|
37
|
-
export interface PluginCliDefinition {
|
|
38
|
-
commands: PluginCliCommandDefinition[];
|
|
39
|
-
}
|
package/dist/code.d.ts
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
export declare const codeChangeStateSchema: z.ZodEnum<{
|
|
3
|
-
open: "open";
|
|
4
|
-
closed: "closed";
|
|
5
|
-
merged: "merged";
|
|
6
|
-
}>;
|
|
7
|
-
export type CodeChangeState = z.output<typeof codeChangeStateSchema>;
|
|
8
|
-
export declare const codeChangeInputSchema: z.ZodObject<{
|
|
9
|
-
closedAt: z.ZodOptional<z.ZodDate>;
|
|
10
|
-
conversationIds: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
11
|
-
mergedAt: z.ZodOptional<z.ZodDate>;
|
|
12
|
-
number: z.ZodNumber;
|
|
13
|
-
openedAt: z.ZodDate;
|
|
14
|
-
providerId: z.ZodString;
|
|
15
|
-
repository: z.ZodObject<{
|
|
16
|
-
name: z.ZodString;
|
|
17
|
-
providerId: z.ZodString;
|
|
18
|
-
url: z.ZodOptional<z.ZodString>;
|
|
19
|
-
}, z.core.$strict>;
|
|
20
|
-
state: z.ZodEnum<{
|
|
21
|
-
open: "open";
|
|
22
|
-
closed: "closed";
|
|
23
|
-
merged: "merged";
|
|
24
|
-
}>;
|
|
25
|
-
title: z.ZodOptional<z.ZodString>;
|
|
26
|
-
updatedAt: z.ZodDate;
|
|
27
|
-
url: z.ZodOptional<z.ZodString>;
|
|
28
|
-
}, z.core.$strict>;
|
|
29
|
-
export type CodeChangeInput = z.input<typeof codeChangeInputSchema>;
|
|
30
|
-
/** Write code changes from a plugin to Junior's code records. */
|
|
31
|
-
export interface CodeChangePublisher {
|
|
32
|
-
associateConversations(input: {
|
|
33
|
-
conversationIds: string[];
|
|
34
|
-
providerId: string;
|
|
35
|
-
}): Promise<void>;
|
|
36
|
-
record(input: CodeChangeInput): Promise<void>;
|
|
37
|
-
}
|
package/dist/context.d.ts
DELETED
|
@@ -1,158 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
import type { ZodTypeAny } from "zod";
|
|
3
|
-
import { destinationSchema, identitySchema, locationSchema, webActorSchema, localActorSchema, platformSchema, actorSchema, slackActorSchema, systemActorSchema, sourceSchema, sourceVisibilitySchema, slackLocationSchema, userSchema } from "./schemas";
|
|
4
|
-
/** Runtime platform name without source or destination coordinates. */
|
|
5
|
-
export type Platform = z.output<typeof platformSchema>;
|
|
6
|
-
export type Actor = z.output<typeof actorSchema>;
|
|
7
|
-
export type SlackActor = z.output<typeof slackActorSchema>;
|
|
8
|
-
export type LocalActor = z.output<typeof localActorSchema>;
|
|
9
|
-
export type WebActor = z.output<typeof webActorSchema>;
|
|
10
|
-
export type SystemActor = z.output<typeof systemActorSchema>;
|
|
11
|
-
export type Identity = z.output<typeof identitySchema>;
|
|
12
|
-
export type User = z.output<typeof userSchema>;
|
|
13
|
-
export type Source = z.output<typeof sourceSchema>;
|
|
14
|
-
/** Validated Location associated with a Conversation. */
|
|
15
|
-
export type Location = z.output<typeof locationSchema>;
|
|
16
|
-
/** Complete Slack Location associated with a Conversation. */
|
|
17
|
-
export type SlackLocation = z.output<typeof slackLocationSchema>;
|
|
18
|
-
export type SlackSource = Extract<Source, {
|
|
19
|
-
kind: "slack";
|
|
20
|
-
}>;
|
|
21
|
-
export type LocalSource = Extract<Source, {
|
|
22
|
-
kind: "local";
|
|
23
|
-
}>;
|
|
24
|
-
export type WebSource = Extract<Source, {
|
|
25
|
-
kind: "web";
|
|
26
|
-
}>;
|
|
27
|
-
export type ResourceEventSource = Extract<Source, {
|
|
28
|
-
kind: "resource_event";
|
|
29
|
-
}>;
|
|
30
|
-
export type ScheduledTaskSource = Extract<Source, {
|
|
31
|
-
kind: "scheduled_task";
|
|
32
|
-
}>;
|
|
33
|
-
export type EventTaskSource = Extract<Source, {
|
|
34
|
-
kind: "event_task";
|
|
35
|
-
}>;
|
|
36
|
-
export type PluginDispatchSource = Extract<Source, {
|
|
37
|
-
kind: "plugin_dispatch";
|
|
38
|
-
}>;
|
|
39
|
-
export type AgentInvocationSource = Extract<Source, {
|
|
40
|
-
kind: "agent_invocation";
|
|
41
|
-
}>;
|
|
42
|
-
export type SourceVisibility = z.output<typeof sourceVisibilitySchema>;
|
|
43
|
-
export type Destination = z.output<typeof destinationSchema>;
|
|
44
|
-
export type SlackDestination = Extract<Destination, {
|
|
45
|
-
platform: "slack";
|
|
46
|
-
}>;
|
|
47
|
-
export type LocalDestination = Extract<Destination, {
|
|
48
|
-
platform: "local";
|
|
49
|
-
}>;
|
|
50
|
-
export interface PluginMetadata {
|
|
51
|
-
name: string;
|
|
52
|
-
}
|
|
53
|
-
export interface PluginLogger {
|
|
54
|
-
error(message: string, metadata?: Record<string, unknown>): void;
|
|
55
|
-
info(message: string, metadata?: Record<string, unknown>): void;
|
|
56
|
-
warn(message: string, metadata?: Record<string, unknown>): void;
|
|
57
|
-
}
|
|
58
|
-
export interface PluginModel {
|
|
59
|
-
/** Run a host-owned structured model call without exposing provider credentials. */
|
|
60
|
-
completeObject<TSchema extends ZodTypeAny>(input: {
|
|
61
|
-
maxTokens?: number;
|
|
62
|
-
prompt: string;
|
|
63
|
-
schema: TSchema;
|
|
64
|
-
system?: string;
|
|
65
|
-
}): Promise<{
|
|
66
|
-
/** Best-effort estimated provider cost for this completion. */
|
|
67
|
-
costUsd?: number;
|
|
68
|
-
object: z.infer<TSchema>;
|
|
69
|
-
}>;
|
|
70
|
-
}
|
|
71
|
-
export interface PluginEmbedder {
|
|
72
|
-
/** Embed plugin-owned text for derived retrieval without exposing provider credentials. */
|
|
73
|
-
embedTexts(input: {
|
|
74
|
-
texts: string[];
|
|
75
|
-
}): Promise<{
|
|
76
|
-
/** Best-effort estimated provider cost for this embedding call. */
|
|
77
|
-
costUsd?: number;
|
|
78
|
-
dimensions: number;
|
|
79
|
-
model: string;
|
|
80
|
-
provider: string;
|
|
81
|
-
vectors: number[][];
|
|
82
|
-
}>;
|
|
83
|
-
}
|
|
84
|
-
export interface PluginContext {
|
|
85
|
-
/** Shared Drizzle database connection for plugin runtime code. */
|
|
86
|
-
db: unknown;
|
|
87
|
-
log: PluginLogger;
|
|
88
|
-
plugin: PluginMetadata;
|
|
89
|
-
}
|
|
90
|
-
interface BaseInvocationContext {
|
|
91
|
-
/**
|
|
92
|
-
* Opaque Junior conversation/session identity for this invocation.
|
|
93
|
-
* Interactive Slack turns use `slack:{channelId}:{threadTs}`.
|
|
94
|
-
*/
|
|
95
|
-
conversationId?: string;
|
|
96
|
-
/** Location associated with this Conversation. */
|
|
97
|
-
locationId?: string;
|
|
98
|
-
}
|
|
99
|
-
export interface SlackInvocationContext extends BaseInvocationContext {
|
|
100
|
-
/** Runtime-owned default outbound destination for this invocation. */
|
|
101
|
-
destination: SlackDestination;
|
|
102
|
-
actor?: SlackActor;
|
|
103
|
-
/** Runtime-owned source where the invocation came from. */
|
|
104
|
-
source: SlackSource;
|
|
105
|
-
}
|
|
106
|
-
export interface LocalInvocationContext extends BaseInvocationContext {
|
|
107
|
-
/** Runtime-owned default outbound destination for this invocation. */
|
|
108
|
-
destination: LocalDestination;
|
|
109
|
-
actor?: LocalActor;
|
|
110
|
-
/** Runtime-owned source where the invocation came from. */
|
|
111
|
-
source: LocalSource;
|
|
112
|
-
}
|
|
113
|
-
export interface WebInvocationContext extends BaseInvocationContext {
|
|
114
|
-
/** Existing conversation destination used for location and tool context. */
|
|
115
|
-
destination: Destination;
|
|
116
|
-
actor?: WebActor;
|
|
117
|
-
/** Runtime-owned dashboard/web source for this invocation. */
|
|
118
|
-
source: WebSource;
|
|
119
|
-
}
|
|
120
|
-
export interface ResourceEventInvocationContext extends BaseInvocationContext {
|
|
121
|
-
/** Existing conversation destination used for tool context. */
|
|
122
|
-
destination: Destination;
|
|
123
|
-
actor?: Actor;
|
|
124
|
-
/** Runtime-owned Resource event Source for this invocation. */
|
|
125
|
-
source: ResourceEventSource;
|
|
126
|
-
}
|
|
127
|
-
export type InvocationContext = LocalInvocationContext | SlackInvocationContext | WebInvocationContext | (BaseInvocationContext & {
|
|
128
|
-
destination: Destination;
|
|
129
|
-
actor?: Actor;
|
|
130
|
-
source: AgentInvocationSource | EventTaskSource | PluginDispatchSource | ResourceEventSource | ScheduledTaskSource;
|
|
131
|
-
});
|
|
132
|
-
/** Build a normalized Slack source from runtime-owned Slack coordinates. */
|
|
133
|
-
export declare function createSlackSource(input: {
|
|
134
|
-
channelId: string;
|
|
135
|
-
messageTs?: string;
|
|
136
|
-
teamId: string;
|
|
137
|
-
threadTs?: string;
|
|
138
|
-
/** Runtime-normalized source visibility. */
|
|
139
|
-
visibility: SourceVisibility;
|
|
140
|
-
}): SlackSource;
|
|
141
|
-
/** Build a normalized local source from a local conversation id. */
|
|
142
|
-
export declare function createLocalSource(conversationId: string): LocalSource;
|
|
143
|
-
/** Build a normalized web/dashboard source from a conversation id. */
|
|
144
|
-
export declare function createWebSource(conversationId: string, visibility?: SourceVisibility): WebSource;
|
|
145
|
-
/** Build a normalized Resource event Source from one matched event. */
|
|
146
|
-
export declare function createResourceEventSource(input: {
|
|
147
|
-
eventKey: string;
|
|
148
|
-
eventType: string;
|
|
149
|
-
identifier: string;
|
|
150
|
-
namespace: string;
|
|
151
|
-
}): ResourceEventSource;
|
|
152
|
-
/** Return whether a source is private to a person or restricted group. */
|
|
153
|
-
export declare function isPrivateSource(source: Source): boolean;
|
|
154
|
-
/** Return the stable source identity used for idempotency and attribution. */
|
|
155
|
-
export declare function getSourceKey(source: Source): string | undefined;
|
|
156
|
-
/** Narrow a runtime destination to the Slack-specific address shape. */
|
|
157
|
-
export declare function isSlackDestination(destination: Destination | undefined): destination is SlackDestination;
|
|
158
|
-
export {};
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
export declare const conversationEventIconSchema: z.ZodEnum<{
|
|
3
|
-
check: "check";
|
|
4
|
-
key: "key";
|
|
5
|
-
link: "link";
|
|
6
|
-
warning: "warning";
|
|
7
|
-
activity: "activity";
|
|
8
|
-
brain: "brain";
|
|
9
|
-
calendar: "calendar";
|
|
10
|
-
database: "database";
|
|
11
|
-
info: "info";
|
|
12
|
-
sparkles: "sparkles";
|
|
13
|
-
}>;
|
|
14
|
-
/** Safe, core-rendered presentation for one plugin conversation event. */
|
|
15
|
-
export declare const conversationEventPresentationSchema: z.ZodObject<{
|
|
16
|
-
details: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
17
|
-
content: z.ZodOptional<z.ZodString>;
|
|
18
|
-
description: z.ZodOptional<z.ZodString>;
|
|
19
|
-
metadata: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
20
|
-
title: z.ZodString;
|
|
21
|
-
}, z.core.$strict>>>;
|
|
22
|
-
icon: z.ZodOptional<z.ZodEnum<{
|
|
23
|
-
check: "check";
|
|
24
|
-
key: "key";
|
|
25
|
-
link: "link";
|
|
26
|
-
warning: "warning";
|
|
27
|
-
activity: "activity";
|
|
28
|
-
brain: "brain";
|
|
29
|
-
calendar: "calendar";
|
|
30
|
-
database: "database";
|
|
31
|
-
info: "info";
|
|
32
|
-
sparkles: "sparkles";
|
|
33
|
-
}>>;
|
|
34
|
-
preview: z.ZodOptional<z.ZodString>;
|
|
35
|
-
title: z.ZodString;
|
|
36
|
-
}, z.core.$strict>;
|
|
37
|
-
export type ConversationEventPresentation = z.output<typeof conversationEventPresentationSchema>;
|
|
38
|
-
/** One validated plugin event value waiting for conversation-bound emission. */
|
|
39
|
-
export interface PluginConversationEventValue {
|
|
40
|
-
readonly data: Record<string, unknown>;
|
|
41
|
-
readonly definition: PluginConversationEventDefinition;
|
|
42
|
-
}
|
|
43
|
-
/** Registered schema and optional transcript presentation for one event version. */
|
|
44
|
-
export interface PluginConversationEventDefinition {
|
|
45
|
-
readonly eventName: string;
|
|
46
|
-
readonly version: number;
|
|
47
|
-
parse(data: unknown): Record<string, unknown>;
|
|
48
|
-
renderEvent(data: Record<string, unknown>): ConversationEventPresentation | undefined;
|
|
49
|
-
}
|
|
50
|
-
/** Typed factory returned while authoring one plugin conversation event. */
|
|
51
|
-
export interface DefinedConversationEvent<TInput> extends PluginConversationEventDefinition {
|
|
52
|
-
(data: TInput): PluginConversationEventValue;
|
|
53
|
-
}
|
|
54
|
-
/** Define one typed, versioned plugin-owned conversation event. */
|
|
55
|
-
export declare function defineConversationEvent<TSchema extends z.ZodType<Record<string, unknown>>>(definition: {
|
|
56
|
-
name: string;
|
|
57
|
-
version: number;
|
|
58
|
-
schema: TSchema;
|
|
59
|
-
renderEvent(event: z.output<TSchema>): z.input<typeof conversationEventPresentationSchema> | undefined;
|
|
60
|
-
}): DefinedConversationEvent<z.input<TSchema>>;
|
|
61
|
-
/** Conversation-bound event writer supplied by Junior core. */
|
|
62
|
-
export interface PluginConversationEvents {
|
|
63
|
-
emit(event: PluginConversationEventValue): Promise<void>;
|
|
64
|
-
}
|
|
65
|
-
export interface PluginConversationEventCostDay {
|
|
66
|
-
costUsd: number;
|
|
67
|
-
date: string;
|
|
68
|
-
events: number;
|
|
69
|
-
}
|
|
70
|
-
/** Read aggregate costs for events owned by the current plugin namespace. */
|
|
71
|
-
export interface PluginConversationEventStats {
|
|
72
|
-
costsByDay(input: {
|
|
73
|
-
days: 7 | 30 | 90;
|
|
74
|
-
eventName: string;
|
|
75
|
-
}): Promise<PluginConversationEventCostDay[]>;
|
|
76
|
-
costsByHour(input: {
|
|
77
|
-
eventName: string;
|
|
78
|
-
hours?: number;
|
|
79
|
-
}): Promise<PluginConversationEventCostDay[]>;
|
|
80
|
-
}
|
package/dist/credentials.d.ts
DELETED
|
@@ -1,184 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
import type { PluginContext } from "./context";
|
|
3
|
-
import { pluginCredentialSubjectSchema } from "./schemas";
|
|
4
|
-
declare const pluginGrantAccessSchema: z.ZodUnion<readonly [z.ZodLiteral<"read">, z.ZodLiteral<"write">]>;
|
|
5
|
-
/** Runtime schema for provider authorization a plugin may request. */
|
|
6
|
-
export declare const pluginAuthorizationSchema: z.ZodObject<{
|
|
7
|
-
provider: z.ZodString;
|
|
8
|
-
scope: z.ZodOptional<z.ZodString>;
|
|
9
|
-
type: z.ZodLiteral<"oauth">;
|
|
10
|
-
}, z.core.$strict>;
|
|
11
|
-
/** Runtime schema for a provider account attached to stored OAuth tokens. */
|
|
12
|
-
export declare const pluginProviderAccountSchema: z.ZodObject<{
|
|
13
|
-
displayName: z.ZodOptional<z.ZodString>;
|
|
14
|
-
handle: z.ZodOptional<z.ZodString>;
|
|
15
|
-
id: z.ZodString;
|
|
16
|
-
label: z.ZodOptional<z.ZodString>;
|
|
17
|
-
url: z.ZodOptional<z.ZodString>;
|
|
18
|
-
}, z.core.$strict>;
|
|
19
|
-
/** Runtime schema for OAuth tokens stored by the host for plugin credentials. */
|
|
20
|
-
export declare const pluginStoredTokensSchema: z.ZodObject<{
|
|
21
|
-
account: z.ZodOptional<z.ZodObject<{
|
|
22
|
-
displayName: z.ZodOptional<z.ZodString>;
|
|
23
|
-
handle: z.ZodOptional<z.ZodString>;
|
|
24
|
-
id: z.ZodString;
|
|
25
|
-
label: z.ZodOptional<z.ZodString>;
|
|
26
|
-
url: z.ZodOptional<z.ZodString>;
|
|
27
|
-
}, z.core.$strict>>;
|
|
28
|
-
accessToken: z.ZodString;
|
|
29
|
-
expiresAt: z.ZodOptional<z.ZodNumber>;
|
|
30
|
-
refreshToken: z.ZodString;
|
|
31
|
-
refreshTokenExpiresAt: z.ZodOptional<z.ZodNumber>;
|
|
32
|
-
scope: z.ZodOptional<z.ZodString>;
|
|
33
|
-
}, z.core.$strict>;
|
|
34
|
-
/** Runtime schema for a plugin-defined outbound credential grant. */
|
|
35
|
-
export declare const pluginGrantSchema: z.ZodObject<{
|
|
36
|
-
access: z.ZodUnion<readonly [z.ZodLiteral<"read">, z.ZodLiteral<"write">]>;
|
|
37
|
-
leaseScope: z.ZodOptional<z.ZodString>;
|
|
38
|
-
name: z.ZodString;
|
|
39
|
-
reason: z.ZodOptional<z.ZodString>;
|
|
40
|
-
requirements: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
41
|
-
}, z.core.$strict>;
|
|
42
|
-
/** Runtime schema for plugin-issued header mutations. */
|
|
43
|
-
export declare const pluginCredentialHeaderTransformSchema: z.ZodObject<{
|
|
44
|
-
domain: z.ZodString;
|
|
45
|
-
headers: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
46
|
-
}, z.core.$strict>;
|
|
47
|
-
/** Runtime schema for a short-lived plugin-issued credential lease. */
|
|
48
|
-
export declare const pluginCredentialLeaseSchema: z.ZodObject<{
|
|
49
|
-
account: z.ZodOptional<z.ZodObject<{
|
|
50
|
-
displayName: z.ZodOptional<z.ZodString>;
|
|
51
|
-
handle: z.ZodOptional<z.ZodString>;
|
|
52
|
-
id: z.ZodString;
|
|
53
|
-
label: z.ZodOptional<z.ZodString>;
|
|
54
|
-
url: z.ZodOptional<z.ZodString>;
|
|
55
|
-
}, z.core.$strict>>;
|
|
56
|
-
authorization: z.ZodOptional<z.ZodObject<{
|
|
57
|
-
provider: z.ZodString;
|
|
58
|
-
scope: z.ZodOptional<z.ZodString>;
|
|
59
|
-
type: z.ZodLiteral<"oauth">;
|
|
60
|
-
}, z.core.$strict>>;
|
|
61
|
-
expiresAt: z.ZodString;
|
|
62
|
-
headerTransforms: z.ZodArray<z.ZodObject<{
|
|
63
|
-
domain: z.ZodString;
|
|
64
|
-
headers: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
65
|
-
}, z.core.$strict>>;
|
|
66
|
-
}, z.core.$strict>;
|
|
67
|
-
/** Runtime schema for the result returned by a plugin credential hook. */
|
|
68
|
-
export declare const pluginCredentialResultSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
69
|
-
lease: z.ZodObject<{
|
|
70
|
-
account: z.ZodOptional<z.ZodObject<{
|
|
71
|
-
displayName: z.ZodOptional<z.ZodString>;
|
|
72
|
-
handle: z.ZodOptional<z.ZodString>;
|
|
73
|
-
id: z.ZodString;
|
|
74
|
-
label: z.ZodOptional<z.ZodString>;
|
|
75
|
-
url: z.ZodOptional<z.ZodString>;
|
|
76
|
-
}, z.core.$strict>>;
|
|
77
|
-
authorization: z.ZodOptional<z.ZodObject<{
|
|
78
|
-
provider: z.ZodString;
|
|
79
|
-
scope: z.ZodOptional<z.ZodString>;
|
|
80
|
-
type: z.ZodLiteral<"oauth">;
|
|
81
|
-
}, z.core.$strict>>;
|
|
82
|
-
expiresAt: z.ZodString;
|
|
83
|
-
headerTransforms: z.ZodArray<z.ZodObject<{
|
|
84
|
-
domain: z.ZodString;
|
|
85
|
-
headers: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
86
|
-
}, z.core.$strict>>;
|
|
87
|
-
}, z.core.$strict>;
|
|
88
|
-
type: z.ZodLiteral<"lease">;
|
|
89
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
90
|
-
authorization: z.ZodOptional<z.ZodObject<{
|
|
91
|
-
provider: z.ZodString;
|
|
92
|
-
scope: z.ZodOptional<z.ZodString>;
|
|
93
|
-
type: z.ZodLiteral<"oauth">;
|
|
94
|
-
}, z.core.$strict>>;
|
|
95
|
-
message: z.ZodString;
|
|
96
|
-
type: z.ZodLiteral<"needed">;
|
|
97
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
98
|
-
message: z.ZodString;
|
|
99
|
-
type: z.ZodLiteral<"unavailable">;
|
|
100
|
-
}, z.core.$strict>], "type">;
|
|
101
|
-
export type PluginCredentialSubject = z.output<typeof pluginCredentialSubjectSchema>;
|
|
102
|
-
export type PluginGrantAccess = z.output<typeof pluginGrantAccessSchema>;
|
|
103
|
-
/** Provider authorization Junior can start when a plugin-owned grant is missing. */
|
|
104
|
-
export type PluginAuthorization = z.output<typeof pluginAuthorizationSchema>;
|
|
105
|
-
/** Interrupt sandbox egress so Junior can start provider authorization. */
|
|
106
|
-
export declare class EgressAuthRequired extends Error {
|
|
107
|
-
authorization?: PluginAuthorization;
|
|
108
|
-
constructor(message: string, options?: {
|
|
109
|
-
authorization?: PluginAuthorization;
|
|
110
|
-
cause?: unknown;
|
|
111
|
-
});
|
|
112
|
-
}
|
|
113
|
-
/** Deny provider egress before Junior issues credentials for a disallowed operation. */
|
|
114
|
-
export declare class EgressPolicyDenied extends Error {
|
|
115
|
-
constructor(message: string, options?: {
|
|
116
|
-
cause?: unknown;
|
|
117
|
-
});
|
|
118
|
-
}
|
|
119
|
-
/** Provider account identity resolved by a plugin OAuth hook. */
|
|
120
|
-
export type PluginProviderAccount = z.output<typeof pluginProviderAccountSchema>;
|
|
121
|
-
/** Plugin-defined grant required before Junior can forward one outbound request. */
|
|
122
|
-
export type PluginGrant = z.output<typeof pluginGrantSchema>;
|
|
123
|
-
/** Request details available while selecting the grant for sandbox egress. */
|
|
124
|
-
export interface PluginEgressRequest {
|
|
125
|
-
/** Capped request body text when the host exposes it for provider-specific grant classification. */
|
|
126
|
-
bodyText?: string;
|
|
127
|
-
method: string;
|
|
128
|
-
/** Plugin-declared operation this request performs, used for grant classification and diagnostics. */
|
|
129
|
-
operation?: string;
|
|
130
|
-
url: string;
|
|
131
|
-
}
|
|
132
|
-
export interface EgressHookContext extends PluginContext {
|
|
133
|
-
request: PluginEgressRequest;
|
|
134
|
-
}
|
|
135
|
-
export interface PluginEgressResponse {
|
|
136
|
-
/** Snapshot of upstream response headers; mutations do not affect pass-through. */
|
|
137
|
-
headers: Headers;
|
|
138
|
-
readText(maxBytes: number): Promise<string | undefined>;
|
|
139
|
-
status: number;
|
|
140
|
-
}
|
|
141
|
-
export interface EgressResponseHookContext extends PluginContext {
|
|
142
|
-
grant: PluginGrant;
|
|
143
|
-
permissionDenied(message: string): void;
|
|
144
|
-
request: Omit<PluginEgressRequest, "bodyText">;
|
|
145
|
-
response: PluginEgressResponse;
|
|
146
|
-
}
|
|
147
|
-
/** Header mutations a plugin-issued credential lease may apply to owned domains. */
|
|
148
|
-
export type PluginCredentialHeaderTransform = z.output<typeof pluginCredentialHeaderTransformSchema>;
|
|
149
|
-
/** Short-lived credential headers issued by a plugin for a selected grant. */
|
|
150
|
-
export type PluginCredentialLease = z.output<typeof pluginCredentialLeaseSchema>;
|
|
151
|
-
export type PluginCredentialResult = z.output<typeof pluginCredentialResultSchema>;
|
|
152
|
-
export type PluginCredentialActor = {
|
|
153
|
-
platform: "system";
|
|
154
|
-
name: string;
|
|
155
|
-
} | {
|
|
156
|
-
type: "user";
|
|
157
|
-
userId: string;
|
|
158
|
-
};
|
|
159
|
-
export interface PluginResolvedCredentialUser {
|
|
160
|
-
type: "user";
|
|
161
|
-
userId: string;
|
|
162
|
-
}
|
|
163
|
-
export type PluginStoredTokens = z.output<typeof pluginStoredTokensSchema>;
|
|
164
|
-
export interface PluginUserTokenSlot {
|
|
165
|
-
get(): Promise<PluginStoredTokens | undefined>;
|
|
166
|
-
set(tokens: PluginStoredTokens): Promise<void>;
|
|
167
|
-
/** Run token refresh work after the host has serialized this user/provider slot, or throw after a bounded wait. */
|
|
168
|
-
withRefresh<T>(callback: () => Promise<T>): Promise<T>;
|
|
169
|
-
userId: string;
|
|
170
|
-
}
|
|
171
|
-
export interface PluginTokenStore {
|
|
172
|
-
credentialSubject?: PluginUserTokenSlot;
|
|
173
|
-
currentUser?: PluginUserTokenSlot;
|
|
174
|
-
}
|
|
175
|
-
export interface ResolveOAuthAccountHookContext extends PluginContext {
|
|
176
|
-
tokens: PluginStoredTokens;
|
|
177
|
-
}
|
|
178
|
-
export interface IssueCredentialHookContext extends PluginContext {
|
|
179
|
-
actor: PluginCredentialActor;
|
|
180
|
-
credentialSubject?: PluginResolvedCredentialUser;
|
|
181
|
-
grant: PluginGrant;
|
|
182
|
-
tokens: PluginTokenStore;
|
|
183
|
-
}
|
|
184
|
-
export {};
|
package/dist/dispatch.d.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
import { destinationVisibilitySchema, dispatchOptionsSchema, replyAttributionSchema } from "./schemas";
|
|
3
|
-
export type DestinationVisibility = z.output<typeof destinationVisibilitySchema>;
|
|
4
|
-
export type DispatchOptions = z.output<typeof dispatchOptionsSchema>;
|
|
5
|
-
/** Compact destination-visible context explaining what produced a reply. */
|
|
6
|
-
export type ReplyAttribution = z.output<typeof replyAttributionSchema>;
|
|
7
|
-
export interface DispatchResult {
|
|
8
|
-
id: string;
|
|
9
|
-
status: "created" | "already_exists";
|
|
10
|
-
}
|
|
11
|
-
export interface Dispatch {
|
|
12
|
-
errorMessage?: string;
|
|
13
|
-
id: string;
|
|
14
|
-
resultMessageTs?: string;
|
|
15
|
-
status: "pending" | "running" | "awaiting_resume" | "completed" | "failed" | "blocked";
|
|
16
|
-
}
|
package/dist/egress-policy.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Deny provider egress when a plugin policy does not allow the request.
|
|
3
|
-
*
|
|
4
|
-
* Call from a plugin `grantForEgress` hook before returning a write grant.
|
|
5
|
-
*/
|
|
6
|
-
export declare function enforceEgressPolicy(input: {
|
|
7
|
-
allowed: boolean;
|
|
8
|
-
denialMessage: string;
|
|
9
|
-
}): void;
|