@sentry/junior-plugin-api 0.101.0 → 0.102.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/index.js +19 -5
- package/dist/schemas.d.ts +14 -4
- package/dist/tools.d.ts +3 -1
- package/package.json +1 -1
- package/src/schemas.ts +23 -7
- package/src/tools.ts +4 -1
package/README.md
CHANGED
|
@@ -48,6 +48,9 @@ reports, migrations, and other typed hook surfaces exported by this package.
|
|
|
48
48
|
execute through the host queue/callback lifecycle.
|
|
49
49
|
- `ctx.agent.dispatch` creates durable agent work with an explicit actor,
|
|
50
50
|
destination, source, metadata, and idempotency identity.
|
|
51
|
+
- Delegated credential subjects declare the narrow action that authorized them.
|
|
52
|
+
Core owns runtime bindings; scheduler task subjects are accepted only from the
|
|
53
|
+
scheduler plugin and are bound to the exact task id.
|
|
51
54
|
- Completed dispatch and task projections are durable plugin inputs, not an
|
|
52
55
|
invitation to inspect unrestricted conversation state.
|
|
53
56
|
|
package/dist/index.js
CHANGED
|
@@ -7,6 +7,9 @@ var exactActorUserIdSchema = z.string().min(1).refine(
|
|
|
7
7
|
(value) => value === value.trim() && value.toLowerCase() !== "unknown"
|
|
8
8
|
);
|
|
9
9
|
var nonBlankStringSchema = z.string().refine((value) => value.trim().length > 0);
|
|
10
|
+
var exactNonBlankStringSchema = nonBlankStringSchema.refine(
|
|
11
|
+
(value) => value === value.trim()
|
|
12
|
+
);
|
|
10
13
|
var platformSchema = z.enum(["slack", "local"]);
|
|
11
14
|
var sourceTypeSchema = z.enum(["pub", "priv"]);
|
|
12
15
|
var slackAddressSchema = z.object({
|
|
@@ -37,11 +40,22 @@ var sourceSchema = z.discriminatedUnion("platform", [
|
|
|
37
40
|
slackSourceSchema,
|
|
38
41
|
localSourceSchema
|
|
39
42
|
]);
|
|
40
|
-
var pluginCredentialSubjectSchema = z.
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
43
|
+
var pluginCredentialSubjectSchema = z.discriminatedUnion(
|
|
44
|
+
"allowedWhen",
|
|
45
|
+
[
|
|
46
|
+
z.object({
|
|
47
|
+
type: z.literal("user"),
|
|
48
|
+
userId: exactActorUserIdSchema,
|
|
49
|
+
allowedWhen: z.literal("private-direct-conversation")
|
|
50
|
+
}).strict(),
|
|
51
|
+
z.object({
|
|
52
|
+
type: z.literal("user"),
|
|
53
|
+
userId: exactActorUserIdSchema,
|
|
54
|
+
allowedWhen: z.literal("scheduled-task"),
|
|
55
|
+
taskId: exactNonBlankStringSchema
|
|
56
|
+
}).strict()
|
|
57
|
+
]
|
|
58
|
+
);
|
|
45
59
|
var actorProfileSchema = {
|
|
46
60
|
email: nonBlankStringSchema.optional(),
|
|
47
61
|
fullName: nonBlankStringSchema.optional(),
|
package/dist/schemas.d.ts
CHANGED
|
@@ -65,11 +65,16 @@ export declare const sourceSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
65
65
|
conversationId: z.ZodString;
|
|
66
66
|
}, z.core.$strict>], "platform">;
|
|
67
67
|
/** Stable user credential subject shape accepted from plugins. */
|
|
68
|
-
export declare const pluginCredentialSubjectSchema: z.ZodObject<{
|
|
68
|
+
export declare const pluginCredentialSubjectSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
69
69
|
type: z.ZodLiteral<"user">;
|
|
70
70
|
userId: z.ZodString;
|
|
71
71
|
allowedWhen: z.ZodLiteral<"private-direct-conversation">;
|
|
72
|
-
}, z.core.$strict
|
|
72
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
73
|
+
type: z.ZodLiteral<"user">;
|
|
74
|
+
userId: z.ZodString;
|
|
75
|
+
allowedWhen: z.ZodLiteral<"scheduled-task">;
|
|
76
|
+
taskId: z.ZodString;
|
|
77
|
+
}, z.core.$strict>], "allowedWhen">;
|
|
73
78
|
export declare const slackActorSchema: z.ZodObject<{
|
|
74
79
|
platform: z.ZodLiteral<"slack">;
|
|
75
80
|
teamId: z.ZodString;
|
|
@@ -110,11 +115,16 @@ export declare const actorSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
110
115
|
/** Plugin dispatch request accepted by Junior core. */
|
|
111
116
|
export declare const dispatchOptionsSchema: z.ZodObject<{
|
|
112
117
|
idempotencyKey: z.ZodPipe<z.ZodString, z.ZodString>;
|
|
113
|
-
credentialSubject: z.ZodOptional<z.ZodObject<{
|
|
118
|
+
credentialSubject: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
114
119
|
type: z.ZodLiteral<"user">;
|
|
115
120
|
userId: z.ZodString;
|
|
116
121
|
allowedWhen: z.ZodLiteral<"private-direct-conversation">;
|
|
117
|
-
}, z.core.$strict
|
|
122
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
123
|
+
type: z.ZodLiteral<"user">;
|
|
124
|
+
userId: z.ZodString;
|
|
125
|
+
allowedWhen: z.ZodLiteral<"scheduled-task">;
|
|
126
|
+
taskId: z.ZodString;
|
|
127
|
+
}, z.core.$strict>], "allowedWhen">>;
|
|
118
128
|
destination: z.ZodObject<{
|
|
119
129
|
platform: z.ZodLiteral<"slack">;
|
|
120
130
|
teamId: z.ZodString;
|
package/dist/tools.d.ts
CHANGED
|
@@ -153,7 +153,9 @@ export interface SlackToolRegistrationHookContext {
|
|
|
153
153
|
canCreateCanvas: boolean;
|
|
154
154
|
canPostToChannel: boolean;
|
|
155
155
|
};
|
|
156
|
-
credentialSubject?: PluginCredentialSubject
|
|
156
|
+
credentialSubject?: Extract<PluginCredentialSubject, {
|
|
157
|
+
allowedWhen: "private-direct-conversation";
|
|
158
|
+
}>;
|
|
157
159
|
}
|
|
158
160
|
interface BaseToolRegistrationHookContext extends PluginContext {
|
|
159
161
|
/**
|
package/package.json
CHANGED
package/src/schemas.ts
CHANGED
|
@@ -15,6 +15,9 @@ const exactActorUserIdSchema = z
|
|
|
15
15
|
export const nonBlankStringSchema = z
|
|
16
16
|
.string()
|
|
17
17
|
.refine((value) => value.trim().length > 0);
|
|
18
|
+
const exactNonBlankStringSchema = nonBlankStringSchema.refine(
|
|
19
|
+
(value) => value === value.trim(),
|
|
20
|
+
);
|
|
18
21
|
|
|
19
22
|
/** Runtime platform names supported by plugin public contracts. */
|
|
20
23
|
export const platformSchema = z.enum(["slack", "local"]);
|
|
@@ -72,13 +75,26 @@ export const sourceSchema = z.discriminatedUnion("platform", [
|
|
|
72
75
|
]);
|
|
73
76
|
|
|
74
77
|
/** Stable user credential subject shape accepted from plugins. */
|
|
75
|
-
export const pluginCredentialSubjectSchema = z
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
78
|
+
export const pluginCredentialSubjectSchema = z.discriminatedUnion(
|
|
79
|
+
"allowedWhen",
|
|
80
|
+
[
|
|
81
|
+
z
|
|
82
|
+
.object({
|
|
83
|
+
type: z.literal("user"),
|
|
84
|
+
userId: exactActorUserIdSchema,
|
|
85
|
+
allowedWhen: z.literal("private-direct-conversation"),
|
|
86
|
+
})
|
|
87
|
+
.strict(),
|
|
88
|
+
z
|
|
89
|
+
.object({
|
|
90
|
+
type: z.literal("user"),
|
|
91
|
+
userId: exactActorUserIdSchema,
|
|
92
|
+
allowedWhen: z.literal("scheduled-task"),
|
|
93
|
+
taskId: exactNonBlankStringSchema,
|
|
94
|
+
})
|
|
95
|
+
.strict(),
|
|
96
|
+
],
|
|
97
|
+
);
|
|
82
98
|
|
|
83
99
|
/** Shared exact actor profile fields for platform-scoped actors. */
|
|
84
100
|
const actorProfileSchema = {
|
package/src/tools.ts
CHANGED
|
@@ -277,7 +277,10 @@ export interface SlackToolRegistrationHookContext {
|
|
|
277
277
|
canCreateCanvas: boolean;
|
|
278
278
|
canPostToChannel: boolean;
|
|
279
279
|
};
|
|
280
|
-
credentialSubject?:
|
|
280
|
+
credentialSubject?: Extract<
|
|
281
|
+
PluginCredentialSubject,
|
|
282
|
+
{ allowedWhen: "private-direct-conversation" }
|
|
283
|
+
>;
|
|
281
284
|
}
|
|
282
285
|
|
|
283
286
|
interface BaseToolRegistrationHookContext extends PluginContext {
|