@sentry/junior-plugin-api 0.315.0 → 0.316.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 +316 -302
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1502,6 +1502,11 @@ export interface PluginEgressRequest {
|
|
|
1502
1502
|
* grant classification.
|
|
1503
1503
|
*/
|
|
1504
1504
|
bodyText?: string;
|
|
1505
|
+
/**
|
|
1506
|
+
* Conversation of a Sandbox request, from its signed credential context.
|
|
1507
|
+
* Use it to limit what one Conversation spends, never to grant access.
|
|
1508
|
+
*/
|
|
1509
|
+
conversationId?: string;
|
|
1505
1510
|
/** Set for every Git `git-receive-pack` POST. */
|
|
1506
1511
|
gitPush?: PluginGitPush;
|
|
1507
1512
|
/** Set for every POST to a URL path that ends in `/graphql`. */
|
|
@@ -3935,309 +3940,19 @@ export declare function eventTriggerFiltersText(filters: readonly string[]): str
|
|
|
3935
3940
|
*/
|
|
3936
3941
|
export declare function eventTriggerText(resource: string, description: Pick<EventTriggerDescription, "events" | "filters">): string;
|
|
3937
3942
|
/**
|
|
3938
|
-
*
|
|
3939
|
-
*
|
|
3940
|
-
*
|
|
3943
|
+
* A code change title split by Conventional Commits, such as
|
|
3944
|
+
* `feat(api)!: Add retries`. The plugin that owns the code change parses it,
|
|
3945
|
+
* so the Inbox can lead with the words and show the rest as pills.
|
|
3941
3946
|
*/
|
|
3942
|
-
export
|
|
3943
|
-
|
|
3944
|
-
|
|
3945
|
-
|
|
3946
|
-
|
|
3947
|
-
|
|
3948
|
-
|
|
3949
|
-
|
|
3950
|
-
|
|
3951
|
-
userName: z.ZodOptional<z.ZodString>;
|
|
3952
|
-
platform: z.ZodLiteral<"slack">;
|
|
3953
|
-
teamId: z.ZodString;
|
|
3954
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
3955
|
-
email: z.ZodOptional<z.ZodString>;
|
|
3956
|
-
fullName: z.ZodOptional<z.ZodString>;
|
|
3957
|
-
userId: z.ZodString;
|
|
3958
|
-
userName: z.ZodOptional<z.ZodString>;
|
|
3959
|
-
platform: z.ZodLiteral<"local">;
|
|
3960
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
3961
|
-
email: z.ZodOptional<z.ZodString>;
|
|
3962
|
-
fullName: z.ZodOptional<z.ZodString>;
|
|
3963
|
-
userId: z.ZodString;
|
|
3964
|
-
userName: z.ZodOptional<z.ZodString>;
|
|
3965
|
-
platform: z.ZodLiteral<"web">;
|
|
3966
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
3967
|
-
platform: z.ZodLiteral<"system">;
|
|
3968
|
-
name: z.ZodString;
|
|
3969
|
-
}, z.core.$strict>], "platform">>;
|
|
3970
|
-
}, z.core.$strict>;
|
|
3971
|
-
/** One normalized transcript entry from the completed run exposed to plugin tasks. */
|
|
3972
|
-
export declare const pluginRunTranscriptEntrySchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
3973
|
-
type: z.ZodLiteral<"message">;
|
|
3974
|
-
role: z.ZodEnum<{
|
|
3975
|
-
assistant: "assistant";
|
|
3976
|
-
user: "user";
|
|
3977
|
-
}>;
|
|
3978
|
-
text: z.ZodString;
|
|
3979
|
-
provenance: z.ZodOptional<z.ZodObject<{
|
|
3980
|
-
authority: z.ZodEnum<{
|
|
3981
|
-
context: "context";
|
|
3982
|
-
instruction: "instruction";
|
|
3983
|
-
}>;
|
|
3984
|
-
actor: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
3985
|
-
email: z.ZodOptional<z.ZodString>;
|
|
3986
|
-
fullName: z.ZodOptional<z.ZodString>;
|
|
3987
|
-
userId: z.ZodString;
|
|
3988
|
-
userName: z.ZodOptional<z.ZodString>;
|
|
3989
|
-
platform: z.ZodLiteral<"slack">;
|
|
3990
|
-
teamId: z.ZodString;
|
|
3991
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
3992
|
-
email: z.ZodOptional<z.ZodString>;
|
|
3993
|
-
fullName: z.ZodOptional<z.ZodString>;
|
|
3994
|
-
userId: z.ZodString;
|
|
3995
|
-
userName: z.ZodOptional<z.ZodString>;
|
|
3996
|
-
platform: z.ZodLiteral<"local">;
|
|
3997
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
3998
|
-
email: z.ZodOptional<z.ZodString>;
|
|
3999
|
-
fullName: z.ZodOptional<z.ZodString>;
|
|
4000
|
-
userId: z.ZodString;
|
|
4001
|
-
userName: z.ZodOptional<z.ZodString>;
|
|
4002
|
-
platform: z.ZodLiteral<"web">;
|
|
4003
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
4004
|
-
platform: z.ZodLiteral<"system">;
|
|
4005
|
-
name: z.ZodString;
|
|
4006
|
-
}, z.core.$strict>], "platform">>;
|
|
4007
|
-
}, z.core.$strict>>;
|
|
4008
|
-
isRunActor: z.ZodOptional<z.ZodBoolean>;
|
|
4009
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
4010
|
-
type: z.ZodLiteral<"toolResult">;
|
|
4011
|
-
toolName: z.ZodString;
|
|
4012
|
-
isError: z.ZodBoolean;
|
|
4013
|
-
text: z.ZodOptional<z.ZodString>;
|
|
4014
|
-
}, z.core.$strict>], "type">;
|
|
4015
|
-
export type PluginRunTranscriptProvenance = z.output<typeof pluginRunTranscriptProvenanceSchema>;
|
|
4016
|
-
/** Runtime-owned completed-run projection exposed to plugin tasks. */
|
|
4017
|
-
export declare const pluginRunContextSchema: z.ZodObject<{
|
|
4018
|
-
actorUserId: z.ZodOptional<z.ZodString>;
|
|
4019
|
-
completedAtMs: z.ZodNumber;
|
|
4020
|
-
conversationId: z.ZodString;
|
|
4021
|
-
destination: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
4022
|
-
platform: z.ZodLiteral<"slack">;
|
|
4023
|
-
teamId: z.ZodString;
|
|
4024
|
-
channelId: z.ZodString;
|
|
4025
|
-
threadTs: z.ZodOptional<z.ZodString>;
|
|
4026
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
4027
|
-
platform: z.ZodLiteral<"local">;
|
|
4028
|
-
conversationId: z.ZodString;
|
|
4029
|
-
}, z.core.$strict>], "platform">;
|
|
4030
|
-
locationId: z.ZodOptional<z.ZodString>;
|
|
4031
|
-
actors: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
4032
|
-
email: z.ZodOptional<z.ZodString>;
|
|
4033
|
-
fullName: z.ZodOptional<z.ZodString>;
|
|
4034
|
-
userId: z.ZodString;
|
|
4035
|
-
userName: z.ZodOptional<z.ZodString>;
|
|
4036
|
-
platform: z.ZodLiteral<"slack">;
|
|
4037
|
-
teamId: z.ZodString;
|
|
4038
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
4039
|
-
email: z.ZodOptional<z.ZodString>;
|
|
4040
|
-
fullName: z.ZodOptional<z.ZodString>;
|
|
4041
|
-
userId: z.ZodString;
|
|
4042
|
-
userName: z.ZodOptional<z.ZodString>;
|
|
4043
|
-
platform: z.ZodLiteral<"local">;
|
|
4044
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
4045
|
-
email: z.ZodOptional<z.ZodString>;
|
|
4046
|
-
fullName: z.ZodOptional<z.ZodString>;
|
|
4047
|
-
userId: z.ZodString;
|
|
4048
|
-
userName: z.ZodOptional<z.ZodString>;
|
|
4049
|
-
platform: z.ZodLiteral<"web">;
|
|
4050
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
4051
|
-
platform: z.ZodLiteral<"system">;
|
|
4052
|
-
name: z.ZodString;
|
|
4053
|
-
}, z.core.$strict>], "platform">>;
|
|
4054
|
-
actor: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
4055
|
-
email: z.ZodOptional<z.ZodString>;
|
|
4056
|
-
fullName: z.ZodOptional<z.ZodString>;
|
|
4057
|
-
userId: z.ZodString;
|
|
4058
|
-
userName: z.ZodOptional<z.ZodString>;
|
|
4059
|
-
platform: z.ZodLiteral<"slack">;
|
|
4060
|
-
teamId: z.ZodString;
|
|
4061
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
4062
|
-
email: z.ZodOptional<z.ZodString>;
|
|
4063
|
-
fullName: z.ZodOptional<z.ZodString>;
|
|
4064
|
-
userId: z.ZodString;
|
|
4065
|
-
userName: z.ZodOptional<z.ZodString>;
|
|
4066
|
-
platform: z.ZodLiteral<"local">;
|
|
4067
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
4068
|
-
email: z.ZodOptional<z.ZodString>;
|
|
4069
|
-
fullName: z.ZodOptional<z.ZodString>;
|
|
4070
|
-
userId: z.ZodString;
|
|
4071
|
-
userName: z.ZodOptional<z.ZodString>;
|
|
4072
|
-
platform: z.ZodLiteral<"web">;
|
|
4073
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
4074
|
-
platform: z.ZodLiteral<"system">;
|
|
4075
|
-
name: z.ZodString;
|
|
4076
|
-
}, z.core.$strict>], "platform">>;
|
|
4077
|
-
runId: z.ZodString;
|
|
4078
|
-
source: z.ZodPreprocess<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
4079
|
-
kind: z.ZodLiteral<"slack">;
|
|
4080
|
-
teamId: z.ZodString;
|
|
4081
|
-
channelId: z.ZodString;
|
|
4082
|
-
visibility: z.ZodEnum<{
|
|
4083
|
-
private: "private";
|
|
4084
|
-
public: "public";
|
|
4085
|
-
}>;
|
|
4086
|
-
messageTs: z.ZodOptional<z.ZodString>;
|
|
4087
|
-
threadTs: z.ZodOptional<z.ZodString>;
|
|
4088
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
4089
|
-
kind: z.ZodLiteral<"local">;
|
|
4090
|
-
visibility: z.ZodLiteral<"private">;
|
|
4091
|
-
conversationId: z.ZodString;
|
|
4092
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
4093
|
-
kind: z.ZodLiteral<"web">;
|
|
4094
|
-
visibility: z.ZodEnum<{
|
|
4095
|
-
private: "private";
|
|
4096
|
-
public: "public";
|
|
4097
|
-
}>;
|
|
4098
|
-
conversationId: z.ZodString;
|
|
4099
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
4100
|
-
kind: z.ZodLiteral<"event">;
|
|
4101
|
-
eventKey: z.ZodString;
|
|
4102
|
-
eventType: z.ZodString;
|
|
4103
|
-
identifier: z.ZodString;
|
|
4104
|
-
namespace: z.ZodString;
|
|
4105
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
4106
|
-
automationId: z.ZodOptional<z.ZodString>;
|
|
4107
|
-
automationRunId: z.ZodOptional<z.ZodString>;
|
|
4108
|
-
kind: z.ZodLiteral<"scheduled_automation">;
|
|
4109
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
4110
|
-
automationId: z.ZodOptional<z.ZodString>;
|
|
4111
|
-
automationRunId: z.ZodOptional<z.ZodString>;
|
|
4112
|
-
kind: z.ZodLiteral<"event_automation">;
|
|
4113
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
4114
|
-
kind: z.ZodLiteral<"plugin_dispatch">;
|
|
4115
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
4116
|
-
kind: z.ZodLiteral<"parent_message">;
|
|
4117
|
-
}, z.core.$strict>], "kind">, unknown>;
|
|
4118
|
-
transcript: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
4119
|
-
type: z.ZodLiteral<"message">;
|
|
4120
|
-
role: z.ZodEnum<{
|
|
4121
|
-
assistant: "assistant";
|
|
4122
|
-
user: "user";
|
|
4123
|
-
}>;
|
|
4124
|
-
text: z.ZodString;
|
|
4125
|
-
provenance: z.ZodOptional<z.ZodObject<{
|
|
4126
|
-
authority: z.ZodEnum<{
|
|
4127
|
-
context: "context";
|
|
4128
|
-
instruction: "instruction";
|
|
4129
|
-
}>;
|
|
4130
|
-
actor: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
4131
|
-
email: z.ZodOptional<z.ZodString>;
|
|
4132
|
-
fullName: z.ZodOptional<z.ZodString>;
|
|
4133
|
-
userId: z.ZodString;
|
|
4134
|
-
userName: z.ZodOptional<z.ZodString>;
|
|
4135
|
-
platform: z.ZodLiteral<"slack">;
|
|
4136
|
-
teamId: z.ZodString;
|
|
4137
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
4138
|
-
email: z.ZodOptional<z.ZodString>;
|
|
4139
|
-
fullName: z.ZodOptional<z.ZodString>;
|
|
4140
|
-
userId: z.ZodString;
|
|
4141
|
-
userName: z.ZodOptional<z.ZodString>;
|
|
4142
|
-
platform: z.ZodLiteral<"local">;
|
|
4143
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
4144
|
-
email: z.ZodOptional<z.ZodString>;
|
|
4145
|
-
fullName: z.ZodOptional<z.ZodString>;
|
|
4146
|
-
userId: z.ZodString;
|
|
4147
|
-
userName: z.ZodOptional<z.ZodString>;
|
|
4148
|
-
platform: z.ZodLiteral<"web">;
|
|
4149
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
4150
|
-
platform: z.ZodLiteral<"system">;
|
|
4151
|
-
name: z.ZodString;
|
|
4152
|
-
}, z.core.$strict>], "platform">>;
|
|
4153
|
-
}, z.core.$strict>>;
|
|
4154
|
-
isRunActor: z.ZodOptional<z.ZodBoolean>;
|
|
4155
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
4156
|
-
type: z.ZodLiteral<"toolResult">;
|
|
4157
|
-
toolName: z.ZodString;
|
|
4158
|
-
isError: z.ZodBoolean;
|
|
4159
|
-
text: z.ZodOptional<z.ZodString>;
|
|
4160
|
-
}, z.core.$strict>], "type">>;
|
|
4161
|
-
}, z.core.$strict>;
|
|
4162
|
-
export type PluginRunTranscriptEntry = z.output<typeof pluginRunTranscriptEntrySchema>;
|
|
4163
|
-
export type PluginRunContext = z.output<typeof pluginRunContextSchema>;
|
|
4164
|
-
/** Runtime context passed to a plugin-owned background task. */
|
|
4165
|
-
export interface PluginTaskContext extends PluginContext {
|
|
4166
|
-
embedder: PluginEmbedder;
|
|
4167
|
-
events: PluginConversationEvents;
|
|
4168
|
-
id: string;
|
|
4169
|
-
model: PluginModel;
|
|
4170
|
-
name: string;
|
|
4171
|
-
run: {
|
|
4172
|
-
load(): Promise<PluginRunContext>;
|
|
4173
|
-
};
|
|
4174
|
-
state: PluginState;
|
|
4175
|
-
/** Events that this plugin emitted in the completed Turn, oldest first. */
|
|
4176
|
-
turnEvents: PluginTurnEventReader;
|
|
4177
|
-
}
|
|
4178
|
-
/** Task that Junior runs after each completed session. */
|
|
4179
|
-
export interface PluginSessionTaskDefinition {
|
|
4180
|
-
payload?: undefined;
|
|
4181
|
-
run(ctx: PluginTaskContext): Promise<void> | void;
|
|
4182
|
-
}
|
|
4183
|
-
/** Runtime context passed to one attempt of a task that `tasks.start` started. */
|
|
4184
|
-
export interface PluginStartedTaskContext<Payload = unknown> extends PluginContext {
|
|
4185
|
-
annotations: PluginConversationAnnotations;
|
|
4186
|
-
codeChanges: PluginCodeChanges;
|
|
4187
|
-
conversationChanges: PluginConversationChanges;
|
|
4188
|
-
/** Publishes the plugin's Events, as the heartbeat and routes do. */
|
|
4189
|
-
events: EventPublisher;
|
|
4190
|
-
/**
|
|
4191
|
-
* True on the last delivery that Junior makes. An attempt that throws
|
|
4192
|
-
* now is not run again, so a task that waits for a provider can write
|
|
4193
|
-
* its fallback instead.
|
|
4194
|
-
*/
|
|
4195
|
-
lastDelivery: boolean;
|
|
4196
|
-
name: string;
|
|
4197
|
-
/** The payload from `tasks.start`, parsed with the task's `payload` schema. */
|
|
4198
|
-
payload: Payload;
|
|
4199
|
-
state: PluginState;
|
|
4200
|
-
}
|
|
4201
|
-
/**
|
|
4202
|
-
* Task that runs only when the plugin starts it with `tasks.start`. Junior
|
|
4203
|
-
* sends the payload as JSON in the queue message and parses it with
|
|
4204
|
-
* `payload` before each attempt. A failed attempt runs again later, a
|
|
4205
|
-
* bounded number of times.
|
|
4206
|
-
*/
|
|
4207
|
-
export interface PluginStartedTaskDefinition<Schema extends z.ZodType = z.ZodType> {
|
|
4208
|
-
payload: Schema;
|
|
4209
|
-
run(ctx: PluginStartedTaskContext<z.output<Schema>>): Promise<void> | void;
|
|
4210
|
-
}
|
|
4211
|
-
/** Plugin task handler registered by name in a plugin manifest module. */
|
|
4212
|
-
export type PluginTaskDefinition = PluginSessionTaskDefinition | PluginStartedTaskDefinition;
|
|
4213
|
-
/** Task handlers keyed by the plugin-owned task name. */
|
|
4214
|
-
export type PluginTasks = Record<string, PluginTaskDefinition>;
|
|
4215
|
-
/** Input of `tasks.start`. */
|
|
4216
|
-
export declare const pluginTaskStartInputSchema: z.ZodObject<{
|
|
4217
|
-
key: z.ZodString;
|
|
4218
|
-
name: z.ZodString;
|
|
4219
|
-
delaySeconds: z.ZodOptional<z.ZodNumber>;
|
|
4220
|
-
payload: z.ZodUnknown;
|
|
4221
|
-
}, z.core.$strict>;
|
|
4222
|
-
export type PluginTaskStartInput = z.output<typeof pluginTaskStartInputSchema>;
|
|
4223
|
-
/** Starts this plugin's tasks on the plugin task queue. */
|
|
4224
|
-
export interface PluginTaskStarter {
|
|
4225
|
-
start(input: PluginTaskStartInput): Promise<void>;
|
|
4226
|
-
}
|
|
4227
|
-
/**
|
|
4228
|
-
* A code change title split by Conventional Commits, such as
|
|
4229
|
-
* `feat(api)!: Add retries`. The plugin that owns the code change parses it,
|
|
4230
|
-
* so the Inbox can lead with the words and show the rest as pills.
|
|
4231
|
-
*/
|
|
4232
|
-
export interface InboxItemSubjectTitleParts {
|
|
4233
|
-
/** The title without its type prefix, such as `Add retries`. */
|
|
4234
|
-
text: string;
|
|
4235
|
-
/** The change type as one word, such as `Feature`. Unset when unknown. */
|
|
4236
|
-
type?: string;
|
|
4237
|
-
/** The scope, such as `api`. */
|
|
4238
|
-
scope?: string;
|
|
4239
|
-
/** The title marks a breaking change, such as with `!`. */
|
|
4240
|
-
breaking?: boolean;
|
|
3947
|
+
export interface InboxItemSubjectTitleParts {
|
|
3948
|
+
/** The title without its type prefix, such as `Add retries`. */
|
|
3949
|
+
text: string;
|
|
3950
|
+
/** The change type as one word, such as `Feature`. Unset when unknown. */
|
|
3951
|
+
type?: string;
|
|
3952
|
+
/** The scope, such as `api`. */
|
|
3953
|
+
scope?: string;
|
|
3954
|
+
/** The title marks a breaking change, such as with `!`. */
|
|
3955
|
+
breaking?: boolean;
|
|
4241
3956
|
}
|
|
4242
3957
|
/** What a plugin item is about, such as a pull request. */
|
|
4243
3958
|
export interface InboxItemSubjectInput {
|
|
@@ -4550,6 +4265,305 @@ export interface SlackConversationLink {
|
|
|
4550
4265
|
export interface SlackConversationLinkHookContext extends PluginContext {
|
|
4551
4266
|
conversationId: string;
|
|
4552
4267
|
}
|
|
4268
|
+
/**
|
|
4269
|
+
* Runtime-owned provenance for a transcript message: whether it is a durable
|
|
4270
|
+
* instruction or ambient context, plus the actor identity when known. Missing
|
|
4271
|
+
* provenance on an entry means unattributed context.
|
|
4272
|
+
*/
|
|
4273
|
+
export declare const pluginRunTranscriptProvenanceSchema: z.ZodObject<{
|
|
4274
|
+
authority: z.ZodEnum<{
|
|
4275
|
+
context: "context";
|
|
4276
|
+
instruction: "instruction";
|
|
4277
|
+
}>;
|
|
4278
|
+
actor: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
4279
|
+
email: z.ZodOptional<z.ZodString>;
|
|
4280
|
+
fullName: z.ZodOptional<z.ZodString>;
|
|
4281
|
+
userId: z.ZodString;
|
|
4282
|
+
userName: z.ZodOptional<z.ZodString>;
|
|
4283
|
+
platform: z.ZodLiteral<"slack">;
|
|
4284
|
+
teamId: z.ZodString;
|
|
4285
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
4286
|
+
email: z.ZodOptional<z.ZodString>;
|
|
4287
|
+
fullName: z.ZodOptional<z.ZodString>;
|
|
4288
|
+
userId: z.ZodString;
|
|
4289
|
+
userName: z.ZodOptional<z.ZodString>;
|
|
4290
|
+
platform: z.ZodLiteral<"local">;
|
|
4291
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
4292
|
+
email: z.ZodOptional<z.ZodString>;
|
|
4293
|
+
fullName: z.ZodOptional<z.ZodString>;
|
|
4294
|
+
userId: z.ZodString;
|
|
4295
|
+
userName: z.ZodOptional<z.ZodString>;
|
|
4296
|
+
platform: z.ZodLiteral<"web">;
|
|
4297
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
4298
|
+
platform: z.ZodLiteral<"system">;
|
|
4299
|
+
name: z.ZodString;
|
|
4300
|
+
}, z.core.$strict>], "platform">>;
|
|
4301
|
+
}, z.core.$strict>;
|
|
4302
|
+
/** One normalized transcript entry from the completed run exposed to plugin tasks. */
|
|
4303
|
+
export declare const pluginRunTranscriptEntrySchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
4304
|
+
type: z.ZodLiteral<"message">;
|
|
4305
|
+
role: z.ZodEnum<{
|
|
4306
|
+
assistant: "assistant";
|
|
4307
|
+
user: "user";
|
|
4308
|
+
}>;
|
|
4309
|
+
text: z.ZodString;
|
|
4310
|
+
provenance: z.ZodOptional<z.ZodObject<{
|
|
4311
|
+
authority: z.ZodEnum<{
|
|
4312
|
+
context: "context";
|
|
4313
|
+
instruction: "instruction";
|
|
4314
|
+
}>;
|
|
4315
|
+
actor: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
4316
|
+
email: z.ZodOptional<z.ZodString>;
|
|
4317
|
+
fullName: z.ZodOptional<z.ZodString>;
|
|
4318
|
+
userId: z.ZodString;
|
|
4319
|
+
userName: z.ZodOptional<z.ZodString>;
|
|
4320
|
+
platform: z.ZodLiteral<"slack">;
|
|
4321
|
+
teamId: z.ZodString;
|
|
4322
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
4323
|
+
email: z.ZodOptional<z.ZodString>;
|
|
4324
|
+
fullName: z.ZodOptional<z.ZodString>;
|
|
4325
|
+
userId: z.ZodString;
|
|
4326
|
+
userName: z.ZodOptional<z.ZodString>;
|
|
4327
|
+
platform: z.ZodLiteral<"local">;
|
|
4328
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
4329
|
+
email: z.ZodOptional<z.ZodString>;
|
|
4330
|
+
fullName: z.ZodOptional<z.ZodString>;
|
|
4331
|
+
userId: z.ZodString;
|
|
4332
|
+
userName: z.ZodOptional<z.ZodString>;
|
|
4333
|
+
platform: z.ZodLiteral<"web">;
|
|
4334
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
4335
|
+
platform: z.ZodLiteral<"system">;
|
|
4336
|
+
name: z.ZodString;
|
|
4337
|
+
}, z.core.$strict>], "platform">>;
|
|
4338
|
+
}, z.core.$strict>>;
|
|
4339
|
+
isRunActor: z.ZodOptional<z.ZodBoolean>;
|
|
4340
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
4341
|
+
type: z.ZodLiteral<"toolResult">;
|
|
4342
|
+
toolName: z.ZodString;
|
|
4343
|
+
isError: z.ZodBoolean;
|
|
4344
|
+
text: z.ZodOptional<z.ZodString>;
|
|
4345
|
+
}, z.core.$strict>], "type">;
|
|
4346
|
+
export type PluginRunTranscriptProvenance = z.output<typeof pluginRunTranscriptProvenanceSchema>;
|
|
4347
|
+
/** Runtime-owned completed-run projection exposed to plugin tasks. */
|
|
4348
|
+
export declare const pluginRunContextSchema: z.ZodObject<{
|
|
4349
|
+
actorUserId: z.ZodOptional<z.ZodString>;
|
|
4350
|
+
completedAtMs: z.ZodNumber;
|
|
4351
|
+
conversationId: z.ZodString;
|
|
4352
|
+
destination: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
4353
|
+
platform: z.ZodLiteral<"slack">;
|
|
4354
|
+
teamId: z.ZodString;
|
|
4355
|
+
channelId: z.ZodString;
|
|
4356
|
+
threadTs: z.ZodOptional<z.ZodString>;
|
|
4357
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
4358
|
+
platform: z.ZodLiteral<"local">;
|
|
4359
|
+
conversationId: z.ZodString;
|
|
4360
|
+
}, z.core.$strict>], "platform">;
|
|
4361
|
+
locationId: z.ZodOptional<z.ZodString>;
|
|
4362
|
+
actors: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
4363
|
+
email: z.ZodOptional<z.ZodString>;
|
|
4364
|
+
fullName: z.ZodOptional<z.ZodString>;
|
|
4365
|
+
userId: z.ZodString;
|
|
4366
|
+
userName: z.ZodOptional<z.ZodString>;
|
|
4367
|
+
platform: z.ZodLiteral<"slack">;
|
|
4368
|
+
teamId: z.ZodString;
|
|
4369
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
4370
|
+
email: z.ZodOptional<z.ZodString>;
|
|
4371
|
+
fullName: z.ZodOptional<z.ZodString>;
|
|
4372
|
+
userId: z.ZodString;
|
|
4373
|
+
userName: z.ZodOptional<z.ZodString>;
|
|
4374
|
+
platform: z.ZodLiteral<"local">;
|
|
4375
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
4376
|
+
email: z.ZodOptional<z.ZodString>;
|
|
4377
|
+
fullName: z.ZodOptional<z.ZodString>;
|
|
4378
|
+
userId: z.ZodString;
|
|
4379
|
+
userName: z.ZodOptional<z.ZodString>;
|
|
4380
|
+
platform: z.ZodLiteral<"web">;
|
|
4381
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
4382
|
+
platform: z.ZodLiteral<"system">;
|
|
4383
|
+
name: z.ZodString;
|
|
4384
|
+
}, z.core.$strict>], "platform">>;
|
|
4385
|
+
actor: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
4386
|
+
email: z.ZodOptional<z.ZodString>;
|
|
4387
|
+
fullName: z.ZodOptional<z.ZodString>;
|
|
4388
|
+
userId: z.ZodString;
|
|
4389
|
+
userName: z.ZodOptional<z.ZodString>;
|
|
4390
|
+
platform: z.ZodLiteral<"slack">;
|
|
4391
|
+
teamId: z.ZodString;
|
|
4392
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
4393
|
+
email: z.ZodOptional<z.ZodString>;
|
|
4394
|
+
fullName: z.ZodOptional<z.ZodString>;
|
|
4395
|
+
userId: z.ZodString;
|
|
4396
|
+
userName: z.ZodOptional<z.ZodString>;
|
|
4397
|
+
platform: z.ZodLiteral<"local">;
|
|
4398
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
4399
|
+
email: z.ZodOptional<z.ZodString>;
|
|
4400
|
+
fullName: z.ZodOptional<z.ZodString>;
|
|
4401
|
+
userId: z.ZodString;
|
|
4402
|
+
userName: z.ZodOptional<z.ZodString>;
|
|
4403
|
+
platform: z.ZodLiteral<"web">;
|
|
4404
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
4405
|
+
platform: z.ZodLiteral<"system">;
|
|
4406
|
+
name: z.ZodString;
|
|
4407
|
+
}, z.core.$strict>], "platform">>;
|
|
4408
|
+
runId: z.ZodString;
|
|
4409
|
+
source: z.ZodPreprocess<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
4410
|
+
kind: z.ZodLiteral<"slack">;
|
|
4411
|
+
teamId: z.ZodString;
|
|
4412
|
+
channelId: z.ZodString;
|
|
4413
|
+
visibility: z.ZodEnum<{
|
|
4414
|
+
private: "private";
|
|
4415
|
+
public: "public";
|
|
4416
|
+
}>;
|
|
4417
|
+
messageTs: z.ZodOptional<z.ZodString>;
|
|
4418
|
+
threadTs: z.ZodOptional<z.ZodString>;
|
|
4419
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
4420
|
+
kind: z.ZodLiteral<"local">;
|
|
4421
|
+
visibility: z.ZodLiteral<"private">;
|
|
4422
|
+
conversationId: z.ZodString;
|
|
4423
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
4424
|
+
kind: z.ZodLiteral<"web">;
|
|
4425
|
+
visibility: z.ZodEnum<{
|
|
4426
|
+
private: "private";
|
|
4427
|
+
public: "public";
|
|
4428
|
+
}>;
|
|
4429
|
+
conversationId: z.ZodString;
|
|
4430
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
4431
|
+
kind: z.ZodLiteral<"event">;
|
|
4432
|
+
eventKey: z.ZodString;
|
|
4433
|
+
eventType: z.ZodString;
|
|
4434
|
+
identifier: z.ZodString;
|
|
4435
|
+
namespace: z.ZodString;
|
|
4436
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
4437
|
+
automationId: z.ZodOptional<z.ZodString>;
|
|
4438
|
+
automationRunId: z.ZodOptional<z.ZodString>;
|
|
4439
|
+
kind: z.ZodLiteral<"scheduled_automation">;
|
|
4440
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
4441
|
+
automationId: z.ZodOptional<z.ZodString>;
|
|
4442
|
+
automationRunId: z.ZodOptional<z.ZodString>;
|
|
4443
|
+
kind: z.ZodLiteral<"event_automation">;
|
|
4444
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
4445
|
+
kind: z.ZodLiteral<"plugin_dispatch">;
|
|
4446
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
4447
|
+
kind: z.ZodLiteral<"parent_message">;
|
|
4448
|
+
}, z.core.$strict>], "kind">, unknown>;
|
|
4449
|
+
transcript: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
4450
|
+
type: z.ZodLiteral<"message">;
|
|
4451
|
+
role: z.ZodEnum<{
|
|
4452
|
+
assistant: "assistant";
|
|
4453
|
+
user: "user";
|
|
4454
|
+
}>;
|
|
4455
|
+
text: z.ZodString;
|
|
4456
|
+
provenance: z.ZodOptional<z.ZodObject<{
|
|
4457
|
+
authority: z.ZodEnum<{
|
|
4458
|
+
context: "context";
|
|
4459
|
+
instruction: "instruction";
|
|
4460
|
+
}>;
|
|
4461
|
+
actor: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
4462
|
+
email: z.ZodOptional<z.ZodString>;
|
|
4463
|
+
fullName: z.ZodOptional<z.ZodString>;
|
|
4464
|
+
userId: z.ZodString;
|
|
4465
|
+
userName: z.ZodOptional<z.ZodString>;
|
|
4466
|
+
platform: z.ZodLiteral<"slack">;
|
|
4467
|
+
teamId: z.ZodString;
|
|
4468
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
4469
|
+
email: z.ZodOptional<z.ZodString>;
|
|
4470
|
+
fullName: z.ZodOptional<z.ZodString>;
|
|
4471
|
+
userId: z.ZodString;
|
|
4472
|
+
userName: z.ZodOptional<z.ZodString>;
|
|
4473
|
+
platform: z.ZodLiteral<"local">;
|
|
4474
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
4475
|
+
email: z.ZodOptional<z.ZodString>;
|
|
4476
|
+
fullName: z.ZodOptional<z.ZodString>;
|
|
4477
|
+
userId: z.ZodString;
|
|
4478
|
+
userName: z.ZodOptional<z.ZodString>;
|
|
4479
|
+
platform: z.ZodLiteral<"web">;
|
|
4480
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
4481
|
+
platform: z.ZodLiteral<"system">;
|
|
4482
|
+
name: z.ZodString;
|
|
4483
|
+
}, z.core.$strict>], "platform">>;
|
|
4484
|
+
}, z.core.$strict>>;
|
|
4485
|
+
isRunActor: z.ZodOptional<z.ZodBoolean>;
|
|
4486
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
4487
|
+
type: z.ZodLiteral<"toolResult">;
|
|
4488
|
+
toolName: z.ZodString;
|
|
4489
|
+
isError: z.ZodBoolean;
|
|
4490
|
+
text: z.ZodOptional<z.ZodString>;
|
|
4491
|
+
}, z.core.$strict>], "type">>;
|
|
4492
|
+
}, z.core.$strict>;
|
|
4493
|
+
export type PluginRunTranscriptEntry = z.output<typeof pluginRunTranscriptEntrySchema>;
|
|
4494
|
+
export type PluginRunContext = z.output<typeof pluginRunContextSchema>;
|
|
4495
|
+
/** Runtime context passed to a plugin-owned background task. */
|
|
4496
|
+
export interface PluginTaskContext extends PluginContext {
|
|
4497
|
+
embedder: PluginEmbedder;
|
|
4498
|
+
events: PluginConversationEvents;
|
|
4499
|
+
id: string;
|
|
4500
|
+
model: PluginModel;
|
|
4501
|
+
name: string;
|
|
4502
|
+
run: {
|
|
4503
|
+
load(): Promise<PluginRunContext>;
|
|
4504
|
+
};
|
|
4505
|
+
state: PluginState;
|
|
4506
|
+
/** Events that this plugin emitted in the completed Turn, oldest first. */
|
|
4507
|
+
turnEvents: PluginTurnEventReader;
|
|
4508
|
+
}
|
|
4509
|
+
/** Task that Junior runs after each completed session. */
|
|
4510
|
+
export interface PluginSessionTaskDefinition {
|
|
4511
|
+
payload?: undefined;
|
|
4512
|
+
run(ctx: PluginTaskContext): Promise<void> | void;
|
|
4513
|
+
}
|
|
4514
|
+
/** Runtime context passed to one attempt of a task that `tasks.start` started. */
|
|
4515
|
+
export interface PluginStartedTaskContext<Payload = unknown> extends PluginContext {
|
|
4516
|
+
annotations: PluginConversationAnnotations;
|
|
4517
|
+
codeChanges: PluginCodeChanges;
|
|
4518
|
+
conversationChanges: PluginConversationChanges;
|
|
4519
|
+
/** Publishes the plugin's Events, as the heartbeat and routes do. */
|
|
4520
|
+
events: EventPublisher;
|
|
4521
|
+
/** Inbox items, as from a plugin route. */
|
|
4522
|
+
inboxItems: PluginConversationInboxItems;
|
|
4523
|
+
/**
|
|
4524
|
+
* True on the last delivery that Junior makes. An attempt that throws
|
|
4525
|
+
* now is not run again, so a task that waits for a provider can write
|
|
4526
|
+
* its fallback instead.
|
|
4527
|
+
*/
|
|
4528
|
+
lastDelivery: boolean;
|
|
4529
|
+
name: string;
|
|
4530
|
+
/** The payload from `tasks.start`, parsed with the task's `payload` schema. */
|
|
4531
|
+
payload: Payload;
|
|
4532
|
+
state: PluginState;
|
|
4533
|
+
/**
|
|
4534
|
+
* Starts this plugin's tasks, as from a plugin route. A task that must
|
|
4535
|
+
* wait longer than its retries cover can start itself again.
|
|
4536
|
+
*/
|
|
4537
|
+
tasks: PluginTaskStarter;
|
|
4538
|
+
/** Stored identities and their users, as from a plugin route. */
|
|
4539
|
+
users: RouteRegistrationHookContext["users"];
|
|
4540
|
+
}
|
|
4541
|
+
/**
|
|
4542
|
+
* Task that runs only when the plugin starts it with `tasks.start`. Junior
|
|
4543
|
+
* sends the payload as JSON in the queue message and parses it with
|
|
4544
|
+
* `payload` before each attempt. A failed attempt runs again later, a
|
|
4545
|
+
* bounded number of times.
|
|
4546
|
+
*/
|
|
4547
|
+
export interface PluginStartedTaskDefinition<Schema extends z.ZodType = z.ZodType> {
|
|
4548
|
+
payload: Schema;
|
|
4549
|
+
run(ctx: PluginStartedTaskContext<z.output<Schema>>): Promise<void> | void;
|
|
4550
|
+
}
|
|
4551
|
+
/** Plugin task handler registered by name in a plugin manifest module. */
|
|
4552
|
+
export type PluginTaskDefinition = PluginSessionTaskDefinition | PluginStartedTaskDefinition;
|
|
4553
|
+
/** Task handlers keyed by the plugin-owned task name. */
|
|
4554
|
+
export type PluginTasks = Record<string, PluginTaskDefinition>;
|
|
4555
|
+
/** Input of `tasks.start`. */
|
|
4556
|
+
export declare const pluginTaskStartInputSchema: z.ZodObject<{
|
|
4557
|
+
key: z.ZodString;
|
|
4558
|
+
name: z.ZodString;
|
|
4559
|
+
delaySeconds: z.ZodOptional<z.ZodNumber>;
|
|
4560
|
+
payload: z.ZodUnknown;
|
|
4561
|
+
}, z.core.$strict>;
|
|
4562
|
+
export type PluginTaskStartInput = z.output<typeof pluginTaskStartInputSchema>;
|
|
4563
|
+
/** Starts this plugin's tasks on the plugin task queue. */
|
|
4564
|
+
export interface PluginTaskStarter {
|
|
4565
|
+
start(input: PluginTaskStartInput): Promise<void>;
|
|
4566
|
+
}
|
|
4553
4567
|
/**
|
|
4554
4568
|
* Deny provider egress when a plugin policy does not allow the request.
|
|
4555
4569
|
*
|