@sentry/junior-plugin-api 0.125.0 → 0.126.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/README.md +3 -0
- package/dist/context.d.ts +2 -2
- package/dist/dispatch.d.ts +3 -1
- package/dist/index.js +13 -7
- package/dist/schemas.d.ts +24 -15
- package/dist/tasks.d.ts +4 -4
- package/package.json +1 -1
- package/src/context.ts +5 -5
- package/src/dispatch.ts +3 -0
- package/src/schemas.ts +17 -3
package/README.md
CHANGED
|
@@ -89,6 +89,9 @@ routing, response validation, rendering, confirmation, and query state.
|
|
|
89
89
|
owns browser rendering.
|
|
90
90
|
- `ctx.agent.dispatch` creates durable agent work with an explicit actor,
|
|
91
91
|
destination, source, metadata, and idempotency identity.
|
|
92
|
+
- Dispatches may include compact `replyAttribution` for destination-visible
|
|
93
|
+
context about what produced the reply. Core owns platform rendering; opaque
|
|
94
|
+
dispatch metadata remains internal.
|
|
92
95
|
- Delegated credential subjects declare the narrow action that authorized them.
|
|
93
96
|
Core owns runtime bindings; scheduler task subjects are accepted only from the
|
|
94
97
|
scheduler plugin and are bound to the exact task id.
|
package/dist/context.d.ts
CHANGED
|
@@ -14,7 +14,7 @@ export type SlackSource = Extract<Source, {
|
|
|
14
14
|
export type LocalSource = Extract<Source, {
|
|
15
15
|
platform: "local";
|
|
16
16
|
}>;
|
|
17
|
-
export type
|
|
17
|
+
export type SourceVisibility = Source["visibility"];
|
|
18
18
|
export type Destination = z.output<typeof destinationSchema>;
|
|
19
19
|
export type SlackDestination = Extract<Destination, {
|
|
20
20
|
platform: "slack";
|
|
@@ -91,7 +91,7 @@ export declare function createSlackSource(input: {
|
|
|
91
91
|
teamId: string;
|
|
92
92
|
threadTs?: string;
|
|
93
93
|
/** Runtime-normalized source visibility. */
|
|
94
|
-
|
|
94
|
+
visibility: SourceVisibility;
|
|
95
95
|
}): SlackSource;
|
|
96
96
|
/** Build a normalized local source from a local conversation id. */
|
|
97
97
|
export declare function createLocalSource(conversationId: string): LocalSource;
|
package/dist/dispatch.d.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import { destinationVisibilitySchema, dispatchOptionsSchema } from "./schemas";
|
|
2
|
+
import { destinationVisibilitySchema, dispatchOptionsSchema, replyAttributionSchema } from "./schemas";
|
|
3
3
|
export type DestinationVisibility = z.output<typeof destinationVisibilitySchema>;
|
|
4
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>;
|
|
5
7
|
export interface DispatchResult {
|
|
6
8
|
id: string;
|
|
7
9
|
status: "created" | "already_exists";
|
package/dist/index.js
CHANGED
|
@@ -84,7 +84,7 @@ var exactNonBlankStringSchema = nonBlankStringSchema.refine(
|
|
|
84
84
|
(value) => value === value.trim()
|
|
85
85
|
);
|
|
86
86
|
var platformSchema = z3.enum(["slack", "local"]);
|
|
87
|
-
var
|
|
87
|
+
var sourceVisibilitySchema = z3.enum(["public", "private"]);
|
|
88
88
|
var destinationVisibilitySchema = z3.enum(["public", "private"]);
|
|
89
89
|
var slackAddressSchema = z3.object({
|
|
90
90
|
platform: z3.literal("slack"),
|
|
@@ -101,13 +101,13 @@ var destinationSchema = z3.discriminatedUnion("platform", [
|
|
|
101
101
|
localDestinationSchema
|
|
102
102
|
]);
|
|
103
103
|
var slackSourceSchema = slackAddressSchema.extend({
|
|
104
|
-
|
|
104
|
+
visibility: sourceVisibilitySchema,
|
|
105
105
|
messageTs: nonBlankStringSchema.optional(),
|
|
106
106
|
threadTs: nonBlankStringSchema.optional()
|
|
107
107
|
}).strict();
|
|
108
108
|
var localSourceSchema = z3.object({
|
|
109
109
|
platform: z3.literal("local"),
|
|
110
|
-
|
|
110
|
+
visibility: z3.literal("private"),
|
|
111
111
|
conversationId: localConversationIdSchema
|
|
112
112
|
}).strict();
|
|
113
113
|
var sourceSchema = z3.discriminatedUnion("platform", [
|
|
@@ -202,6 +202,10 @@ var dispatchMetadataSchema = z3.record(z3.string(), z3.string()).superRefine((me
|
|
|
202
202
|
}
|
|
203
203
|
}
|
|
204
204
|
});
|
|
205
|
+
var replyAttributionSchema = z3.object({
|
|
206
|
+
label: exactNonBlankStringSchema.pipe(z3.string().max(48)).refine((value) => !/[\r\n]/.test(value)),
|
|
207
|
+
detail: exactNonBlankStringSchema.pipe(z3.string().max(128)).refine((value) => !/[\r\n]/.test(value)).optional()
|
|
208
|
+
}).strict();
|
|
205
209
|
var dispatchOptionsSchema = z3.object({
|
|
206
210
|
idempotencyKey: nonBlankStringSchema.pipe(z3.string().max(512)),
|
|
207
211
|
credentialSubject: pluginCredentialSubjectSchema.optional(),
|
|
@@ -209,6 +213,7 @@ var dispatchOptionsSchema = z3.object({
|
|
|
209
213
|
destinationVisibility: destinationVisibilitySchema,
|
|
210
214
|
input: nonBlankStringSchema.pipe(z3.string().max(32e3)),
|
|
211
215
|
metadata: dispatchMetadataSchema.optional(),
|
|
216
|
+
replyAttribution: replyAttributionSchema.optional(),
|
|
212
217
|
source: sourceSchema
|
|
213
218
|
}).strict();
|
|
214
219
|
|
|
@@ -216,7 +221,7 @@ var dispatchOptionsSchema = z3.object({
|
|
|
216
221
|
function createSlackSource(input) {
|
|
217
222
|
return {
|
|
218
223
|
platform: "slack",
|
|
219
|
-
|
|
224
|
+
visibility: input.visibility,
|
|
220
225
|
teamId: input.teamId,
|
|
221
226
|
channelId: input.channelId,
|
|
222
227
|
...input.messageTs ? { messageTs: input.messageTs } : {},
|
|
@@ -226,12 +231,12 @@ function createSlackSource(input) {
|
|
|
226
231
|
function createLocalSource(conversationId) {
|
|
227
232
|
return {
|
|
228
233
|
platform: "local",
|
|
229
|
-
|
|
234
|
+
visibility: "private",
|
|
230
235
|
conversationId
|
|
231
236
|
};
|
|
232
237
|
}
|
|
233
238
|
function isPrivateSource(source) {
|
|
234
|
-
return source.
|
|
239
|
+
return source.visibility === "private";
|
|
235
240
|
}
|
|
236
241
|
function getSourceKey(source) {
|
|
237
242
|
if (source.platform === "local") {
|
|
@@ -746,13 +751,14 @@ export {
|
|
|
746
751
|
pluginUserPageLinksSchema,
|
|
747
752
|
promptContextSchema,
|
|
748
753
|
promptMessageSchema,
|
|
754
|
+
replyAttributionSchema,
|
|
749
755
|
resourceEventSchema,
|
|
750
756
|
resourceLinkAnnotationSchema,
|
|
751
757
|
slackActorSchema,
|
|
752
758
|
slackDestinationSchema,
|
|
753
759
|
slackSourceSchema,
|
|
754
760
|
sourceSchema,
|
|
755
|
-
|
|
761
|
+
sourceVisibilitySchema,
|
|
756
762
|
subscribableResourceSchema,
|
|
757
763
|
systemActorSchema,
|
|
758
764
|
toolApprovalModeSchema,
|
package/dist/schemas.d.ts
CHANGED
|
@@ -6,9 +6,9 @@ export declare const platformSchema: z.ZodEnum<{
|
|
|
6
6
|
local: "local";
|
|
7
7
|
}>;
|
|
8
8
|
/** Runtime source visibility visible to plugins. */
|
|
9
|
-
export declare const
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
export declare const sourceVisibilitySchema: z.ZodEnum<{
|
|
10
|
+
public: "public";
|
|
11
|
+
private: "private";
|
|
12
12
|
}>;
|
|
13
13
|
/** Provider-neutral visibility of a routed destination. */
|
|
14
14
|
export declare const destinationVisibilitySchema: z.ZodEnum<{
|
|
@@ -40,9 +40,9 @@ export declare const slackSourceSchema: z.ZodObject<{
|
|
|
40
40
|
platform: z.ZodLiteral<"slack">;
|
|
41
41
|
teamId: z.ZodString;
|
|
42
42
|
channelId: z.ZodString;
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
43
|
+
visibility: z.ZodEnum<{
|
|
44
|
+
public: "public";
|
|
45
|
+
private: "private";
|
|
46
46
|
}>;
|
|
47
47
|
messageTs: z.ZodOptional<z.ZodString>;
|
|
48
48
|
threadTs: z.ZodOptional<z.ZodString>;
|
|
@@ -50,7 +50,7 @@ export declare const slackSourceSchema: z.ZodObject<{
|
|
|
50
50
|
/** Runtime-owned local CLI coordinates for the inbound invocation. */
|
|
51
51
|
export declare const localSourceSchema: z.ZodObject<{
|
|
52
52
|
platform: z.ZodLiteral<"local">;
|
|
53
|
-
|
|
53
|
+
visibility: z.ZodLiteral<"private">;
|
|
54
54
|
conversationId: z.ZodString;
|
|
55
55
|
}, z.core.$strict>;
|
|
56
56
|
/** Runtime-owned provider-neutral coordinates for the inbound invocation. */
|
|
@@ -58,15 +58,15 @@ export declare const sourceSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
58
58
|
platform: z.ZodLiteral<"slack">;
|
|
59
59
|
teamId: z.ZodString;
|
|
60
60
|
channelId: z.ZodString;
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
61
|
+
visibility: z.ZodEnum<{
|
|
62
|
+
public: "public";
|
|
63
|
+
private: "private";
|
|
64
64
|
}>;
|
|
65
65
|
messageTs: z.ZodOptional<z.ZodString>;
|
|
66
66
|
threadTs: z.ZodOptional<z.ZodString>;
|
|
67
67
|
}, z.core.$strict>, z.ZodObject<{
|
|
68
68
|
platform: z.ZodLiteral<"local">;
|
|
69
|
-
|
|
69
|
+
visibility: z.ZodLiteral<"private">;
|
|
70
70
|
conversationId: z.ZodString;
|
|
71
71
|
}, z.core.$strict>], "platform">;
|
|
72
72
|
/** Stable user credential subject shape accepted from plugins. */
|
|
@@ -117,6 +117,11 @@ export declare const actorSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
117
117
|
platform: z.ZodLiteral<"system">;
|
|
118
118
|
name: z.ZodString;
|
|
119
119
|
}, z.core.$strict>], "platform">;
|
|
120
|
+
/** Compact destination-visible context explaining what produced a reply. */
|
|
121
|
+
export declare const replyAttributionSchema: z.ZodObject<{
|
|
122
|
+
label: z.ZodPipe<z.ZodString, z.ZodString>;
|
|
123
|
+
detail: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodString>>;
|
|
124
|
+
}, z.core.$strict>;
|
|
120
125
|
/** Plugin dispatch request accepted by Junior core. */
|
|
121
126
|
export declare const dispatchOptionsSchema: z.ZodObject<{
|
|
122
127
|
idempotencyKey: z.ZodPipe<z.ZodString, z.ZodString>;
|
|
@@ -141,19 +146,23 @@ export declare const dispatchOptionsSchema: z.ZodObject<{
|
|
|
141
146
|
}>;
|
|
142
147
|
input: z.ZodPipe<z.ZodString, z.ZodString>;
|
|
143
148
|
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
149
|
+
replyAttribution: z.ZodOptional<z.ZodObject<{
|
|
150
|
+
label: z.ZodPipe<z.ZodString, z.ZodString>;
|
|
151
|
+
detail: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodString>>;
|
|
152
|
+
}, z.core.$strict>>;
|
|
144
153
|
source: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
145
154
|
platform: z.ZodLiteral<"slack">;
|
|
146
155
|
teamId: z.ZodString;
|
|
147
156
|
channelId: z.ZodString;
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
157
|
+
visibility: z.ZodEnum<{
|
|
158
|
+
public: "public";
|
|
159
|
+
private: "private";
|
|
151
160
|
}>;
|
|
152
161
|
messageTs: z.ZodOptional<z.ZodString>;
|
|
153
162
|
threadTs: z.ZodOptional<z.ZodString>;
|
|
154
163
|
}, z.core.$strict>, z.ZodObject<{
|
|
155
164
|
platform: z.ZodLiteral<"local">;
|
|
156
|
-
|
|
165
|
+
visibility: z.ZodLiteral<"private">;
|
|
157
166
|
conversationId: z.ZodString;
|
|
158
167
|
}, z.core.$strict>], "platform">;
|
|
159
168
|
}, z.core.$strict>;
|
package/dist/tasks.d.ts
CHANGED
|
@@ -126,15 +126,15 @@ export declare const pluginRunContextSchema: z.ZodObject<{
|
|
|
126
126
|
platform: z.ZodLiteral<"slack">;
|
|
127
127
|
teamId: z.ZodString;
|
|
128
128
|
channelId: z.ZodString;
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
129
|
+
visibility: z.ZodEnum<{
|
|
130
|
+
public: "public";
|
|
131
|
+
private: "private";
|
|
132
132
|
}>;
|
|
133
133
|
messageTs: z.ZodOptional<z.ZodString>;
|
|
134
134
|
threadTs: z.ZodOptional<z.ZodString>;
|
|
135
135
|
}, z.core.$strict>, z.ZodObject<{
|
|
136
136
|
platform: z.ZodLiteral<"local">;
|
|
137
|
-
|
|
137
|
+
visibility: z.ZodLiteral<"private">;
|
|
138
138
|
conversationId: z.ZodString;
|
|
139
139
|
}, z.core.$strict>], "platform">;
|
|
140
140
|
transcript: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
package/package.json
CHANGED
package/src/context.ts
CHANGED
|
@@ -19,7 +19,7 @@ export type SystemActor = z.output<typeof systemActorSchema>;
|
|
|
19
19
|
export type Source = z.output<typeof sourceSchema>;
|
|
20
20
|
export type SlackSource = Extract<Source, { platform: "slack" }>;
|
|
21
21
|
export type LocalSource = Extract<Source, { platform: "local" }>;
|
|
22
|
-
export type
|
|
22
|
+
export type SourceVisibility = Source["visibility"];
|
|
23
23
|
|
|
24
24
|
export type Destination = z.output<typeof destinationSchema>;
|
|
25
25
|
|
|
@@ -103,11 +103,11 @@ export function createSlackSource(input: {
|
|
|
103
103
|
teamId: string;
|
|
104
104
|
threadTs?: string;
|
|
105
105
|
/** Runtime-normalized source visibility. */
|
|
106
|
-
|
|
106
|
+
visibility: SourceVisibility;
|
|
107
107
|
}): SlackSource {
|
|
108
108
|
return {
|
|
109
109
|
platform: "slack",
|
|
110
|
-
|
|
110
|
+
visibility: input.visibility,
|
|
111
111
|
teamId: input.teamId,
|
|
112
112
|
channelId: input.channelId,
|
|
113
113
|
...(input.messageTs ? { messageTs: input.messageTs } : {}),
|
|
@@ -119,14 +119,14 @@ export function createSlackSource(input: {
|
|
|
119
119
|
export function createLocalSource(conversationId: string): LocalSource {
|
|
120
120
|
return {
|
|
121
121
|
platform: "local",
|
|
122
|
-
|
|
122
|
+
visibility: "private",
|
|
123
123
|
conversationId,
|
|
124
124
|
};
|
|
125
125
|
}
|
|
126
126
|
|
|
127
127
|
/** Return whether a source is private to a person or restricted group. */
|
|
128
128
|
export function isPrivateSource(source: Source): boolean {
|
|
129
|
-
return source.
|
|
129
|
+
return source.visibility === "private";
|
|
130
130
|
}
|
|
131
131
|
|
|
132
132
|
/** Return the stable source identity used for idempotency and attribution. */
|
package/src/dispatch.ts
CHANGED
|
@@ -2,12 +2,15 @@ import { z } from "zod";
|
|
|
2
2
|
import {
|
|
3
3
|
destinationVisibilitySchema,
|
|
4
4
|
dispatchOptionsSchema,
|
|
5
|
+
replyAttributionSchema,
|
|
5
6
|
} from "./schemas";
|
|
6
7
|
|
|
7
8
|
export type DestinationVisibility = z.output<
|
|
8
9
|
typeof destinationVisibilitySchema
|
|
9
10
|
>;
|
|
10
11
|
export type DispatchOptions = z.output<typeof dispatchOptionsSchema>;
|
|
12
|
+
/** Compact destination-visible context explaining what produced a reply. */
|
|
13
|
+
export type ReplyAttribution = z.output<typeof replyAttributionSchema>;
|
|
11
14
|
|
|
12
15
|
export interface DispatchResult {
|
|
13
16
|
id: string;
|
package/src/schemas.ts
CHANGED
|
@@ -23,7 +23,7 @@ const exactNonBlankStringSchema = nonBlankStringSchema.refine(
|
|
|
23
23
|
export const platformSchema = z.enum(["slack", "local"]);
|
|
24
24
|
|
|
25
25
|
/** Runtime source visibility visible to plugins. */
|
|
26
|
-
export const
|
|
26
|
+
export const sourceVisibilitySchema = z.enum(["public", "private"]);
|
|
27
27
|
|
|
28
28
|
/** Provider-neutral visibility of a routed destination. */
|
|
29
29
|
export const destinationVisibilitySchema = z.enum(["public", "private"]);
|
|
@@ -56,7 +56,7 @@ export const destinationSchema = z.discriminatedUnion("platform", [
|
|
|
56
56
|
/** Runtime-owned Slack coordinates for the inbound invocation. */
|
|
57
57
|
export const slackSourceSchema = slackAddressSchema
|
|
58
58
|
.extend({
|
|
59
|
-
|
|
59
|
+
visibility: sourceVisibilitySchema,
|
|
60
60
|
messageTs: nonBlankStringSchema.optional(),
|
|
61
61
|
threadTs: nonBlankStringSchema.optional(),
|
|
62
62
|
})
|
|
@@ -66,7 +66,7 @@ export const slackSourceSchema = slackAddressSchema
|
|
|
66
66
|
export const localSourceSchema = z
|
|
67
67
|
.object({
|
|
68
68
|
platform: z.literal("local"),
|
|
69
|
-
|
|
69
|
+
visibility: z.literal("private"),
|
|
70
70
|
conversationId: localConversationIdSchema,
|
|
71
71
|
})
|
|
72
72
|
.strict();
|
|
@@ -187,6 +187,19 @@ const dispatchMetadataSchema = z
|
|
|
187
187
|
}
|
|
188
188
|
});
|
|
189
189
|
|
|
190
|
+
/** Compact destination-visible context explaining what produced a reply. */
|
|
191
|
+
export const replyAttributionSchema = z
|
|
192
|
+
.object({
|
|
193
|
+
label: exactNonBlankStringSchema
|
|
194
|
+
.pipe(z.string().max(48))
|
|
195
|
+
.refine((value) => !/[\r\n]/.test(value)),
|
|
196
|
+
detail: exactNonBlankStringSchema
|
|
197
|
+
.pipe(z.string().max(128))
|
|
198
|
+
.refine((value) => !/[\r\n]/.test(value))
|
|
199
|
+
.optional(),
|
|
200
|
+
})
|
|
201
|
+
.strict();
|
|
202
|
+
|
|
190
203
|
/** Plugin dispatch request accepted by Junior core. */
|
|
191
204
|
export const dispatchOptionsSchema = z
|
|
192
205
|
.object({
|
|
@@ -196,6 +209,7 @@ export const dispatchOptionsSchema = z
|
|
|
196
209
|
destinationVisibility: destinationVisibilitySchema,
|
|
197
210
|
input: nonBlankStringSchema.pipe(z.string().max(32_000)),
|
|
198
211
|
metadata: dispatchMetadataSchema.optional(),
|
|
212
|
+
replyAttribution: replyAttributionSchema.optional(),
|
|
199
213
|
source: sourceSchema,
|
|
200
214
|
})
|
|
201
215
|
.strict();
|