@sentry/junior-plugin-api 0.226.0 → 0.228.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.js CHANGED
@@ -1,5 +1,5 @@
1
1
  // src/object-annotations.ts
2
- import { z as z2 } from "zod";
2
+ import { z as z3 } from "zod";
3
3
 
4
4
  // src/object-facts.ts
5
5
  import { z } from "zod";
@@ -30,7 +30,7 @@ var objectFactsSchema = z.discriminatedUnion("type", [
30
30
  dueDate: z.iso.date().optional(),
31
31
  labels: z.array(text).max(5).optional()
32
32
  }),
33
- // Deployments remain Items. Never copy environment values or logs.
33
+ // Deployments: never copy environment values or logs.
34
34
  z.strictObject({
35
35
  type: z.literal("deployment"),
36
36
  project: text.optional(),
@@ -70,9 +70,6 @@ function objectFactFields(facts) {
70
70
  );
71
71
  add("sourceBranch", "From", facts.sourceBranch);
72
72
  add("targetBranch", "Into", facts.targetBranch);
73
- add("changedFiles", "Files changed", facts.changedFiles);
74
- add("additions", "Lines added", facts.additions);
75
- add("deletions", "Lines removed", facts.deletions);
76
73
  break;
77
74
  }
78
75
  case "task":
@@ -94,37 +91,126 @@ function objectFactFields(facts) {
94
91
  add("branch", "Branch", facts.branch);
95
92
  break;
96
93
  }
97
- return fields;
94
+ return fields.slice(0, 4);
95
+ }
96
+
97
+ // src/object-presentation.ts
98
+ import { z as z2 } from "zod";
99
+ var objectTypeSchema = z2.enum([
100
+ "task",
101
+ "code_change",
102
+ "automation",
103
+ "deployment",
104
+ "item"
105
+ ]);
106
+ var objectTypeLabels = {
107
+ task: "Ticket",
108
+ code_change: "Code change",
109
+ automation: "Automation",
110
+ deployment: "Deployment",
111
+ item: "Item"
112
+ };
113
+ function objectPresentation(object) {
114
+ const type = object.objectType === "item" && object.facts?.type === "deployment" ? "deployment" : object.objectType;
115
+ const status = object.status?.toLowerCase();
116
+ let icon = {
117
+ task: "issue-opened",
118
+ code_change: "git-pull-request",
119
+ automation: "workflow",
120
+ deployment: "rocket",
121
+ item: "package"
122
+ }[type];
123
+ let tone = type === "automation" ? "info" : "neutral";
124
+ if (type === "code_change") {
125
+ if (status === "draft") icon = "git-pull-request-draft";
126
+ if (status === "closed") {
127
+ icon = "git-pull-request-closed";
128
+ tone = "danger";
129
+ }
130
+ if (status === "merged") {
131
+ icon = "git-merge";
132
+ tone = "accent";
133
+ }
134
+ if (status === "open") tone = "success";
135
+ } else if (type === "task") {
136
+ if (status === "closed") {
137
+ icon = "issue-closed";
138
+ tone = "accent";
139
+ }
140
+ if (status === "open") tone = "success";
141
+ } else if (type === "deployment") {
142
+ if (status === "ready" || status === "succeeded") tone = "success";
143
+ if (status === "error" || status === "failed") tone = "danger";
144
+ if (status === "building" || status === "in_progress") tone = "info";
145
+ }
146
+ if (status === "warning" || status === "blocked") tone = "warning";
147
+ return { icon, tone, label: objectTypeLabels[type] };
148
+ }
149
+ function objectIconPath(icon) {
150
+ return `/_junior/dashboard/object-icons/v1/${icon}.png`;
98
151
  }
99
152
 
100
153
  // src/object-annotations.ts
101
- var objectAnnotationSchema = z2.object({
102
- kind: z2.literal("object"),
103
- key: z2.string().trim().min(1).max(256),
104
- label: z2.string().trim().min(1).max(256),
105
- objectType: z2.enum(["task", "code_change", "automation", "item"]),
106
- title: z2.string().trim().min(1).max(512),
107
- url: z2.url().max(2048).refine((value) => ["http:", "https:"].includes(new URL(value).protocol)).nullable(),
108
- description: z2.string().max(4e3).optional(),
109
- status: z2.string().trim().min(1).max(100).optional(),
110
- trigger: z2.string().max(4e3).optional(),
111
- warning: z2.string().max(1e3).optional(),
112
- displayType: z2.string().trim().min(1).max(80).optional(),
113
- sourceUpdatedAt: z2.iso.datetime({ offset: true }).optional(),
154
+ var objectAnnotationSchema = z3.object({
155
+ kind: z3.literal("object"),
156
+ key: z3.string().trim().min(1).max(256),
157
+ label: z3.string().trim().min(1).max(256),
158
+ objectType: objectTypeSchema,
159
+ title: z3.string().trim().min(1).max(512),
160
+ url: z3.url().max(2048).refine((value) => ["http:", "https:"].includes(new URL(value).protocol)).nullable(),
161
+ description: z3.string().max(4e3).optional(),
162
+ status: z3.string().trim().min(1).max(100).optional(),
163
+ trigger: z3.string().max(4e3).optional(),
164
+ warning: z3.string().max(1e3).optional(),
165
+ displayType: z3.string().trim().min(1).max(80).optional(),
166
+ sourceUpdatedAt: z3.iso.datetime({ offset: true }).optional(),
114
167
  facts: objectFactsSchema.refine(
115
168
  (facts) => new TextEncoder().encode(JSON.stringify(facts)).length <= 4096,
116
169
  "Object facts must not exceed 4 KiB"
117
170
  ).optional()
118
171
  }).strict().refine(
119
- (annotation) => !annotation.facts || (annotation.facts.type === "deployment" ? annotation.objectType === "item" : annotation.facts.type === annotation.objectType),
172
+ (annotation) => !annotation.facts || (annotation.facts.type === "deployment" ? annotation.objectType === "deployment" || annotation.objectType === "item" : annotation.facts.type === annotation.objectType),
120
173
  "Object facts must match the object type"
121
174
  );
122
175
  var ownedObjectAnnotationSchema = objectAnnotationSchema.safeExtend({
123
- plugin: z2.string().min(1)
176
+ plugin: z3.string().min(1)
124
177
  });
125
178
 
179
+ // src/object-icons.ts
180
+ var objectIconPaths = {
181
+ "issue-opened": [
182
+ "M8 9.5a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3Z",
183
+ "M8 0a8 8 0 1 1 0 16A8 8 0 0 1 8 0ZM1.5 8a6.5 6.5 0 1 0 13 0 6.5 6.5 0 0 0-13 0Z"
184
+ ],
185
+ "issue-closed": [
186
+ "M11.28 6.78a.75.75 0 0 0-1.06-1.06L7.25 8.69 5.78 7.22a.75.75 0 0 0-1.06 1.06l2 2a.75.75 0 0 0 1.06 0l3.5-3.5Z",
187
+ "M16 8A8 8 0 1 1 0 8a8 8 0 0 1 16 0Zm-1.5 0a6.5 6.5 0 1 0-13 0 6.5 6.5 0 0 0 13 0Z"
188
+ ],
189
+ "git-pull-request": [
190
+ "M1.5 3.25a2.25 2.25 0 1 1 3 2.122v5.256a2.251 2.251 0 1 1-1.5 0V5.372A2.25 2.25 0 0 1 1.5 3.25Zm5.677-.177L9.573.677A.25.25 0 0 1 10 .854V2.5h1A2.5 2.5 0 0 1 13.5 5v5.628a2.251 2.251 0 1 1-1.5 0V5a1 1 0 0 0-1-1h-1v1.646a.25.25 0 0 1-.427.177L7.177 3.427a.25.25 0 0 1 0-.354ZM3.75 2.5a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5Zm0 9.5a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5Zm8.25.75a.75.75 0 1 0 1.5 0 .75.75 0 0 0-1.5 0Z"
191
+ ],
192
+ "git-pull-request-draft": [
193
+ "M3.25 1A2.25 2.25 0 0 1 4 5.372v5.256a2.251 2.251 0 1 1-1.5 0V5.372A2.251 2.251 0 0 1 3.25 1Zm9.5 14a2.25 2.25 0 1 1 0-4.5 2.25 2.25 0 0 1 0 4.5ZM2.5 3.25a.75.75 0 1 0 1.5 0 .75.75 0 0 0-1.5 0ZM3.25 12a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5Zm9.5 0a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5ZM14 7.5a1.25 1.25 0 1 1-2.5 0 1.25 1.25 0 0 1 2.5 0Zm0-4.25a1.25 1.25 0 1 1-2.5 0 1.25 1.25 0 0 1 2.5 0Z"
194
+ ],
195
+ "git-pull-request-closed": [
196
+ "M3.25 1A2.25 2.25 0 0 1 4 5.372v5.256a2.251 2.251 0 1 1-1.5 0V5.372A2.251 2.251 0 0 1 3.25 1Zm9.5 5.5a.75.75 0 0 1 .75.75v3.378a2.251 2.251 0 1 1-1.5 0V7.25a.75.75 0 0 1 .75-.75Zm-2.03-5.273a.75.75 0 0 1 1.06 0l.97.97.97-.97a.748.748 0 0 1 1.265.332.75.75 0 0 1-.205.729l-.97.97.97.97a.751.751 0 0 1-.018 1.042.751.751 0 0 1-1.042.018l-.97-.97-.97.97a.749.749 0 0 1-1.275-.326.749.749 0 0 1 .215-.734l.97-.97-.97-.97a.75.75 0 0 1 0-1.06ZM2.5 3.25a.75.75 0 1 0 1.5 0 .75.75 0 0 0-1.5 0ZM3.25 12a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5Zm9.5 0a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5Z"
197
+ ],
198
+ "git-merge": [
199
+ "M5.45 5.154A4.25 4.25 0 0 0 9.25 7.5h1.378a2.251 2.251 0 1 1 0 1.5H9.25A5.734 5.734 0 0 1 5 7.123v3.505a2.25 2.25 0 1 1-1.5 0V5.372a2.25 2.25 0 1 1 1.95-.218ZM4.25 13.5a.75.75 0 1 0 0-1.5.75.75 0 0 0 0 1.5Zm8.5-4.5a.75.75 0 1 0 0-1.5.75.75 0 0 0 0 1.5ZM5 3.25a.75.75 0 1 0 0 .005V3.25Z"
200
+ ],
201
+ workflow: [
202
+ "M0 1.75C0 .784.784 0 1.75 0h3.5C6.216 0 7 .784 7 1.75v3.5A1.75 1.75 0 0 1 5.25 7H4v4a1 1 0 0 0 1 1h4v-1.25C9 9.784 9.784 9 10.75 9h3.5c.966 0 1.75.784 1.75 1.75v3.5A1.75 1.75 0 0 1 14.25 16h-3.5A1.75 1.75 0 0 1 9 14.25v-.75H5A2.5 2.5 0 0 1 2.5 11V7h-.75A1.75 1.75 0 0 1 0 5.25Zm1.75-.25a.25.25 0 0 0-.25.25v3.5c0 .138.112.25.25.25h3.5a.25.25 0 0 0 .25-.25v-3.5a.25.25 0 0 0-.25-.25Zm9 9a.25.25 0 0 0-.25.25v3.5c0 .138.112.25.25.25h3.5a.25.25 0 0 0 .25-.25v-3.5a.25.25 0 0 0-.25-.25Z"
203
+ ],
204
+ rocket: [
205
+ "M14.064 0h.186C15.216 0 16 .784 16 1.75v.186a8.752 8.752 0 0 1-2.564 6.186l-.458.459c-.314.314-.641.616-.979.904v3.207c0 .608-.315 1.172-.833 1.49l-2.774 1.707a.749.749 0 0 1-1.11-.418l-.954-3.102a1.214 1.214 0 0 1-.145-.125L3.754 9.816a1.218 1.218 0 0 1-.124-.145L.528 8.717a.749.749 0 0 1-.418-1.11l1.71-2.774A1.748 1.748 0 0 1 3.31 4h3.204c.288-.338.59-.665.904-.979l.459-.458A8.749 8.749 0 0 1 14.064 0ZM8.938 3.623h-.002l-.458.458c-.76.76-1.437 1.598-2.02 2.5l-1.5 2.317 2.143 2.143 2.317-1.5c.902-.583 1.74-1.26 2.499-2.02l.459-.458a7.25 7.25 0 0 0 2.123-5.127V1.75a.25.25 0 0 0-.25-.25h-.186a7.249 7.249 0 0 0-5.125 2.123ZM3.56 14.56c-.732.732-2.334 1.045-3.005 1.148a.234.234 0 0 1-.201-.064.234.234 0 0 1-.064-.201c.103-.671.416-2.273 1.15-3.003a1.502 1.502 0 1 1 2.12 2.12Zm6.94-3.935c-.088.06-.177.118-.266.175l-2.35 1.521.548 1.783 1.949-1.2a.25.25 0 0 0 .119-.213ZM3.678 8.116 5.2 5.766c.058-.09.117-.178.176-.266H3.309a.25.25 0 0 0-.213.119l-1.2 1.95ZM12 5a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z"
206
+ ],
207
+ package: [
208
+ "m8.878.392 5.25 3.045c.54.314.872.89.872 1.514v6.098a1.75 1.75 0 0 1-.872 1.514l-5.25 3.045a1.75 1.75 0 0 1-1.756 0l-5.25-3.045A1.75 1.75 0 0 1 1 11.049V4.951c0-.624.332-1.201.872-1.514L7.122.392a1.75 1.75 0 0 1 1.756 0ZM7.875 1.69l-4.63 2.685L8 7.133l4.755-2.758-4.63-2.685a.248.248 0 0 0-.25 0ZM2.5 5.677v5.372c0 .09.047.171.125.216l4.625 2.683V8.432Zm6.25 8.271 4.625-2.683a.25.25 0 0 0 .125-.216V5.677L8.75 8.432Z"
209
+ ]
210
+ };
211
+
126
212
  // src/annotations.ts
127
- import { z as z3 } from "zod";
213
+ import { z as z4 } from "zod";
128
214
  function usesHttpProtocol(value) {
129
215
  try {
130
216
  const protocol = new URL(value).protocol;
@@ -133,19 +219,20 @@ function usesHttpProtocol(value) {
133
219
  return false;
134
220
  }
135
221
  }
136
- var resourceLinkAnnotationSchema = z3.object({
137
- kind: z3.literal("resource_link"),
138
- key: z3.string().trim().min(1).max(256),
139
- label: z3.string().trim().min(1).max(256),
140
- url: z3.string().url().max(2048).refine(usesHttpProtocol, "URL must use HTTP or HTTPS."),
141
- description: z3.string().trim().min(1).max(512).optional(),
142
- status: z3.enum(["open", "draft", "closed", "merged", "warning"]).optional()
222
+ var resourceLinkAnnotationSchema = z4.object({
223
+ kind: z4.literal("resource_link"),
224
+ objectType: objectTypeSchema.optional(),
225
+ key: z4.string().trim().min(1).max(256),
226
+ label: z4.string().trim().min(1).max(256),
227
+ url: z4.string().url().max(2048).refine(usesHttpProtocol, "URL must use HTTP or HTTPS."),
228
+ description: z4.string().trim().min(1).max(512).optional(),
229
+ status: z4.enum(["open", "draft", "closed", "merged", "warning"]).optional()
143
230
  }).strict();
144
- var conversationAnnotationInputSchema = z3.discriminatedUnion("kind", [
231
+ var conversationAnnotationInputSchema = z4.discriminatedUnion("kind", [
145
232
  resourceLinkAnnotationSchema,
146
233
  objectAnnotationSchema
147
234
  ]);
148
- var conversationSidebarIconSchema = z3.enum([
235
+ var conversationSidebarIconSchema = z4.enum([
149
236
  "circle-dot",
150
237
  "circle-dashed",
151
238
  "circle-x",
@@ -153,37 +240,39 @@ var conversationSidebarIconSchema = z3.enum([
153
240
  "git-pull-request",
154
241
  "triangle-alert"
155
242
  ]);
156
- var conversationSidebarAnnotationSchema = z3.object({
243
+ var conversationSidebarAnnotationSchema = z4.object({
157
244
  icon: conversationSidebarIconSchema.optional(),
158
- key: z3.string().trim().min(1).max(256),
159
- label: z3.string().trim().min(1).max(256)
245
+ objectType: objectTypeSchema.optional(),
246
+ status: z4.string().trim().min(1).max(100).optional(),
247
+ key: z4.string().trim().min(1).max(256),
248
+ label: z4.string().trim().min(1).max(256)
160
249
  }).strict();
161
250
 
162
251
  // src/code.ts
163
- import { z as z4 } from "zod";
164
- var codeChangeStateSchema = z4.enum(["closed", "merged", "open"]);
165
- var codeChangeInputSchema = z4.object({
166
- closedAt: z4.date().optional(),
167
- conversationIds: z4.array(z4.string().min(1)).default([]),
168
- mergedAt: z4.date().optional(),
169
- number: z4.number().int().positive(),
170
- openedAt: z4.date(),
171
- providerId: z4.string().min(1),
172
- repository: z4.object({
173
- name: z4.string().min(1),
174
- providerId: z4.string().min(1),
175
- url: z4.string().url().optional()
252
+ import { z as z5 } from "zod";
253
+ var codeChangeStateSchema = z5.enum(["closed", "merged", "open"]);
254
+ var codeChangeInputSchema = z5.object({
255
+ closedAt: z5.date().optional(),
256
+ conversationIds: z5.array(z5.string().min(1)).default([]),
257
+ mergedAt: z5.date().optional(),
258
+ number: z5.number().int().positive(),
259
+ openedAt: z5.date(),
260
+ providerId: z5.string().min(1),
261
+ repository: z5.object({
262
+ name: z5.string().min(1),
263
+ providerId: z5.string().min(1),
264
+ url: z5.string().url().optional()
176
265
  }).strict(),
177
266
  state: codeChangeStateSchema,
178
- title: z4.string().min(1).optional(),
179
- updatedAt: z4.date(),
180
- url: z4.string().url().optional()
267
+ title: z5.string().min(1).optional(),
268
+ updatedAt: z5.date(),
269
+ url: z5.string().url().optional()
181
270
  }).strict();
182
271
 
183
272
  // src/conversation-events.ts
184
- import { z as z5 } from "zod";
185
- var conversationEventNameSchema = z5.string().trim().min(1).max(64).regex(/^[a-z][a-z0-9_]*$/);
186
- var conversationEventIconSchema = z5.enum([
273
+ import { z as z6 } from "zod";
274
+ var conversationEventNameSchema = z6.string().trim().min(1).max(64).regex(/^[a-z][a-z0-9_]*$/);
275
+ var conversationEventIconSchema = z6.enum([
187
276
  "activity",
188
277
  "brain",
189
278
  "calendar",
@@ -195,22 +284,22 @@ var conversationEventIconSchema = z5.enum([
195
284
  "sparkles",
196
285
  "warning"
197
286
  ]);
198
- var conversationEventDetailSchema = z5.object({
199
- content: z5.string().min(1).max(32 * 1024).optional(),
200
- description: z5.string().trim().min(1).max(2e3).optional(),
201
- metadata: z5.array(z5.string().trim().min(1).max(120)).max(8).optional(),
202
- title: z5.string().trim().min(1).max(4e3)
287
+ var conversationEventDetailSchema = z6.object({
288
+ content: z6.string().min(1).max(32 * 1024).optional(),
289
+ description: z6.string().trim().min(1).max(2e3).optional(),
290
+ metadata: z6.array(z6.string().trim().min(1).max(120)).max(8).optional(),
291
+ title: z6.string().trim().min(1).max(4e3)
203
292
  }).strict();
204
- var conversationEventPresentationSchema = z5.object({
205
- details: z5.array(conversationEventDetailSchema).max(100).optional(),
293
+ var conversationEventPresentationSchema = z6.object({
294
+ details: z6.array(conversationEventDetailSchema).max(100).optional(),
206
295
  icon: conversationEventIconSchema.optional(),
207
- preview: z5.string().trim().min(1).max(500).optional(),
208
- title: z5.string().trim().min(1).max(120)
296
+ preview: z6.string().trim().min(1).max(500).optional(),
297
+ title: z6.string().trim().min(1).max(120)
209
298
  }).strict();
210
299
  function defineConversationEvent(definition) {
211
- const identity = z5.object({
300
+ const identity = z6.object({
212
301
  name: conversationEventNameSchema,
213
- version: z5.number().int().positive()
302
+ version: z6.number().int().positive()
214
303
  }).strict().parse({ name: definition.name, version: definition.version });
215
304
  let eventDefinition;
216
305
  const createEvent = (data) => ({
@@ -233,85 +322,85 @@ function defineConversationEvent(definition) {
233
322
  }
234
323
 
235
324
  // src/schemas.ts
236
- import { z as z6 } from "zod";
237
- var slackTeamIdSchema = z6.string().regex(/^T[A-Z0-9]+$/);
238
- var slackConversationIdSchema = z6.string().regex(/^(C|G|D)[A-Z0-9]+$/);
239
- var localConversationIdSchema = z6.string().regex(/^local:[a-z0-9_-]+:[a-z0-9][a-z0-9_-]*$/);
240
- var actorUserIdSchema = z6.string().min(1).refine(
325
+ import { z as z7 } from "zod";
326
+ var slackTeamIdSchema = z7.string().regex(/^T[A-Z0-9]+$/);
327
+ var slackConversationIdSchema = z7.string().regex(/^(C|G|D)[A-Z0-9]+$/);
328
+ var localConversationIdSchema = z7.string().regex(/^local:[a-z0-9_-]+:[a-z0-9][a-z0-9_-]*$/);
329
+ var actorUserIdSchema = z7.string().min(1).refine(
241
330
  (value) => value === value.trim() && value.toLowerCase() !== "unknown"
242
331
  );
243
332
  var exactActorUserIdSchema = actorUserIdSchema;
244
- var nonBlankStringSchema = z6.string().refine((value) => value.trim().length > 0);
333
+ var nonBlankStringSchema = z7.string().refine((value) => value.trim().length > 0);
245
334
  var exactNonBlankStringSchema = nonBlankStringSchema.refine(
246
335
  (value) => value === value.trim()
247
336
  );
248
- var baseLocationSchema = z6.object({
337
+ var baseLocationSchema = z7.object({
249
338
  /** Stable SQL identity used by Location configuration and reporting. */
250
339
  id: nonBlankStringSchema,
251
340
  provider: exactNonBlankStringSchema
252
341
  }).strict();
253
342
  var slackLocationSchema = baseLocationSchema.extend({
254
- provider: z6.literal("slack"),
343
+ provider: z7.literal("slack"),
255
344
  teamId: slackTeamIdSchema,
256
345
  channelId: slackConversationIdSchema,
257
346
  threadTs: exactNonBlankStringSchema.optional()
258
347
  }).strict();
259
- var locationSchema = z6.discriminatedUnion("provider", [
348
+ var locationSchema = z7.discriminatedUnion("provider", [
260
349
  slackLocationSchema
261
350
  ]);
262
- var platformSchema = z6.enum(["slack", "local"]);
263
- var sourceVisibilitySchema = z6.enum(["public", "private"]);
264
- var destinationVisibilitySchema = z6.enum(["public", "private"]);
265
- var slackAddressSchema = z6.object({
266
- platform: z6.literal("slack"),
351
+ var platformSchema = z7.enum(["slack", "local"]);
352
+ var sourceVisibilitySchema = z7.enum(["public", "private"]);
353
+ var destinationVisibilitySchema = z7.enum(["public", "private"]);
354
+ var slackAddressSchema = z7.object({
355
+ platform: z7.literal("slack"),
267
356
  teamId: slackTeamIdSchema,
268
357
  channelId: slackConversationIdSchema,
269
358
  threadTs: exactNonBlankStringSchema.optional()
270
359
  }).strict();
271
360
  var slackDestinationSchema = slackAddressSchema;
272
- var localDestinationSchema = z6.object({
273
- platform: z6.literal("local"),
361
+ var localDestinationSchema = z7.object({
362
+ platform: z7.literal("local"),
274
363
  conversationId: localConversationIdSchema
275
364
  }).strict();
276
- var destinationSchema = z6.discriminatedUnion("platform", [
365
+ var destinationSchema = z7.discriminatedUnion("platform", [
277
366
  slackDestinationSchema,
278
367
  localDestinationSchema
279
368
  ]);
280
- var taskOutcomeSchema = z6.object({
281
- action: z6.literal("send_message"),
369
+ var taskOutcomeSchema = z7.object({
370
+ action: z7.literal("send_message"),
282
371
  destination: slackDestinationSchema
283
372
  }).strict();
284
- var slackSourceSchema = z6.object({
285
- kind: z6.literal("slack"),
373
+ var slackSourceSchema = z7.object({
374
+ kind: z7.literal("slack"),
286
375
  teamId: slackTeamIdSchema,
287
376
  channelId: slackConversationIdSchema,
288
377
  visibility: sourceVisibilitySchema,
289
378
  messageTs: nonBlankStringSchema.optional(),
290
379
  threadTs: nonBlankStringSchema.optional()
291
380
  }).strict();
292
- var localSourceSchema = z6.object({
293
- kind: z6.literal("local"),
294
- visibility: z6.literal("private"),
381
+ var localSourceSchema = z7.object({
382
+ kind: z7.literal("local"),
383
+ visibility: z7.literal("private"),
295
384
  conversationId: localConversationIdSchema
296
385
  }).strict();
297
- var webSourceSchema = z6.object({
298
- kind: z6.literal("web"),
386
+ var webSourceSchema = z7.object({
387
+ kind: z7.literal("web"),
299
388
  visibility: sourceVisibilitySchema,
300
389
  // Web can continue any existing conversation id, including Slack roots.
301
390
  conversationId: exactNonBlankStringSchema
302
391
  }).strict();
303
- var eventSourceSchema = z6.object({
304
- kind: z6.literal("event"),
392
+ var eventSourceSchema = z7.object({
393
+ kind: z7.literal("event"),
305
394
  eventKey: exactNonBlankStringSchema,
306
395
  eventType: exactNonBlankStringSchema,
307
396
  identifier: exactNonBlankStringSchema,
308
397
  namespace: exactNonBlankStringSchema
309
398
  }).strict();
310
- var scheduledAutomationSourceSchema = z6.object({ kind: z6.literal("scheduled_automation") }).strict();
311
- var eventAutomationSourceSchema = z6.object({ kind: z6.literal("event_automation") }).strict();
312
- var pluginDispatchSourceSchema = z6.object({ kind: z6.literal("plugin_dispatch") }).strict();
313
- var agentInvocationSourceSchema = z6.object({ kind: z6.literal("agent_invocation") }).strict();
314
- var currentSourceSchema = z6.discriminatedUnion("kind", [
399
+ var scheduledAutomationSourceSchema = z7.object({ kind: z7.literal("scheduled_automation") }).strict();
400
+ var eventAutomationSourceSchema = z7.object({ kind: z7.literal("event_automation") }).strict();
401
+ var pluginDispatchSourceSchema = z7.object({ kind: z7.literal("plugin_dispatch") }).strict();
402
+ var agentInvocationSourceSchema = z7.object({ kind: z7.literal("agent_invocation") }).strict();
403
+ var currentSourceSchema = z7.discriminatedUnion("kind", [
315
404
  slackSourceSchema,
316
405
  localSourceSchema,
317
406
  webSourceSchema,
@@ -341,22 +430,22 @@ function normalizeStoredSource(value) {
341
430
  const { location: _location, platform: kind, ...fields } = source;
342
431
  return { ...fields, kind };
343
432
  }
344
- var sourceSchema = z6.preprocess(
433
+ var sourceSchema = z7.preprocess(
345
434
  normalizeStoredSource,
346
435
  currentSourceSchema
347
436
  );
348
- var pluginCredentialSubjectSchema = z6.discriminatedUnion(
437
+ var pluginCredentialSubjectSchema = z7.discriminatedUnion(
349
438
  "allowedWhen",
350
439
  [
351
- z6.object({
352
- type: z6.literal("user"),
440
+ z7.object({
441
+ type: z7.literal("user"),
353
442
  userId: exactActorUserIdSchema,
354
- allowedWhen: z6.literal("private-direct-conversation")
443
+ allowedWhen: z7.literal("private-direct-conversation")
355
444
  }).strict(),
356
- z6.object({
357
- type: z6.literal("user"),
445
+ z7.object({
446
+ type: z7.literal("user"),
358
447
  userId: exactActorUserIdSchema,
359
- allowedWhen: z6.literal("scheduled-automation"),
448
+ allowedWhen: z7.literal("scheduled-automation"),
360
449
  taskId: exactNonBlankStringSchema
361
450
  }).strict()
362
451
  ]
@@ -367,30 +456,30 @@ var actorProfileSchema = {
367
456
  userId: exactActorUserIdSchema,
368
457
  userName: nonBlankStringSchema.optional()
369
458
  };
370
- var slackActorSchema = z6.object({
459
+ var slackActorSchema = z7.object({
371
460
  ...actorProfileSchema,
372
- platform: z6.literal("slack"),
461
+ platform: z7.literal("slack"),
373
462
  teamId: slackTeamIdSchema
374
463
  }).strict();
375
- var localActorSchema = z6.object({
464
+ var localActorSchema = z7.object({
376
465
  ...actorProfileSchema,
377
- platform: z6.literal("local")
466
+ platform: z7.literal("local")
378
467
  }).strict();
379
- var webActorSchema = z6.object({
468
+ var webActorSchema = z7.object({
380
469
  ...actorProfileSchema,
381
- platform: z6.literal("web")
470
+ platform: z7.literal("web")
382
471
  }).strict();
383
- var systemActorSchema = z6.object({
384
- platform: z6.literal("system"),
472
+ var systemActorSchema = z7.object({
473
+ platform: z7.literal("system"),
385
474
  name: exactActorUserIdSchema
386
475
  }).strict();
387
- var actorSchema = z6.discriminatedUnion("platform", [
476
+ var actorSchema = z7.discriminatedUnion("platform", [
388
477
  slackActorSchema,
389
478
  localActorSchema,
390
479
  webActorSchema,
391
480
  systemActorSchema
392
481
  ]);
393
- var identitySchema = z6.object({
482
+ var identitySchema = z7.object({
394
483
  displayName: nonBlankStringSchema.optional(),
395
484
  handle: nonBlankStringSchema.optional(),
396
485
  id: exactNonBlankStringSchema,
@@ -398,17 +487,17 @@ var identitySchema = z6.object({
398
487
  providerSubjectId: exactNonBlankStringSchema,
399
488
  providerTenantId: exactNonBlankStringSchema.optional()
400
489
  }).strict();
401
- var userSchema = z6.object({
490
+ var userSchema = z7.object({
402
491
  displayName: nonBlankStringSchema.optional(),
403
492
  email: nonBlankStringSchema.max(320),
404
493
  id: exactNonBlankStringSchema,
405
- identities: z6.array(identitySchema).max(100)
494
+ identities: z7.array(identitySchema).max(100)
406
495
  }).strict();
407
- var dispatchMetadataSchema = z6.record(z6.string(), z6.string()).superRefine((metadata, ctx) => {
496
+ var dispatchMetadataSchema = z7.record(z7.string(), z7.string()).superRefine((metadata, ctx) => {
408
497
  const entries = Object.entries(metadata);
409
498
  if (entries.length > 20) {
410
499
  ctx.addIssue({
411
- code: z6.ZodIssueCode.custom,
500
+ code: z7.ZodIssueCode.custom,
412
501
  message: "Dispatch metadata has too many keys"
413
502
  });
414
503
  return;
@@ -416,7 +505,7 @@ var dispatchMetadataSchema = z6.record(z6.string(), z6.string()).superRefine((me
416
505
  for (const [key, value] of entries) {
417
506
  if (!key.trim()) {
418
507
  ctx.addIssue({
419
- code: z6.ZodIssueCode.custom,
508
+ code: z7.ZodIssueCode.custom,
420
509
  message: "Dispatch metadata values must be strings",
421
510
  path: [key]
422
511
  });
@@ -424,44 +513,44 @@ var dispatchMetadataSchema = z6.record(z6.string(), z6.string()).superRefine((me
424
513
  }
425
514
  if (key.length > 128) {
426
515
  ctx.addIssue({
427
- code: z6.ZodIssueCode.custom,
516
+ code: z7.ZodIssueCode.custom,
428
517
  message: "Dispatch metadata key exceeds the maximum length",
429
518
  path: [key]
430
519
  });
431
520
  }
432
521
  if (/[\r\n]/.test(key)) {
433
522
  ctx.addIssue({
434
- code: z6.ZodIssueCode.custom,
523
+ code: z7.ZodIssueCode.custom,
435
524
  message: "Dispatch metadata keys must be single-line strings",
436
525
  path: [key]
437
526
  });
438
527
  }
439
528
  if (/[\r\n]/.test(value)) {
440
529
  ctx.addIssue({
441
- code: z6.ZodIssueCode.custom,
530
+ code: z7.ZodIssueCode.custom,
442
531
  message: "Dispatch metadata values must be single-line strings",
443
532
  path: [key]
444
533
  });
445
534
  }
446
535
  if (value.length > 512) {
447
536
  ctx.addIssue({
448
- code: z6.ZodIssueCode.custom,
537
+ code: z7.ZodIssueCode.custom,
449
538
  message: "Dispatch metadata value exceeds the maximum length",
450
539
  path: [key]
451
540
  });
452
541
  }
453
542
  }
454
543
  });
455
- var replyAttributionSchema = z6.object({
456
- label: exactNonBlankStringSchema.pipe(z6.string().max(48)).refine((value) => !/[\r\n]/.test(value)),
457
- detail: exactNonBlankStringSchema.pipe(z6.string().max(128)).refine((value) => !/[\r\n]/.test(value)).optional()
544
+ var replyAttributionSchema = z7.object({
545
+ label: exactNonBlankStringSchema.pipe(z7.string().max(48)).refine((value) => !/[\r\n]/.test(value)),
546
+ detail: exactNonBlankStringSchema.pipe(z7.string().max(128)).refine((value) => !/[\r\n]/.test(value)).optional()
458
547
  }).strict();
459
- var dispatchOptionsSchema = z6.object({
460
- idempotencyKey: nonBlankStringSchema.pipe(z6.string().max(512)),
548
+ var dispatchOptionsSchema = z7.object({
549
+ idempotencyKey: nonBlankStringSchema.pipe(z7.string().max(512)),
461
550
  credentialSubject: pluginCredentialSubjectSchema.optional(),
462
551
  destination: slackDestinationSchema,
463
552
  destinationVisibility: destinationVisibilitySchema,
464
- input: nonBlankStringSchema.pipe(z6.string().max(32e3)),
553
+ input: nonBlankStringSchema.pipe(z7.string().max(32e3)),
465
554
  metadata: dispatchMetadataSchema.optional(),
466
555
  replyAttribution: replyAttributionSchema.optional()
467
556
  }).strict();
@@ -529,15 +618,15 @@ function isSlackDestination(destination) {
529
618
  }
530
619
 
531
620
  // src/prompt.ts
532
- import { z as z7 } from "zod";
533
- var promptContextKindSchema = z7.string().trim().min(1).max(64).regex(/^[a-z][a-z0-9_-]*$/);
534
- var promptMessageSchema = z7.object({
535
- text: z7.string().trim().min(1).max(8e3)
621
+ import { z as z8 } from "zod";
622
+ var promptContextKindSchema = z8.string().trim().min(1).max(64).regex(/^[a-z][a-z0-9_-]*$/);
623
+ var promptMessageSchema = z8.object({
624
+ text: z8.string().trim().min(1).max(8e3)
536
625
  }).strict();
537
- var promptContextSchema = z7.object({
626
+ var promptContextSchema = z8.object({
538
627
  kind: promptContextKindSchema,
539
- version: z7.number().int().positive(),
540
- content: z7.record(z7.string(), z7.unknown())
628
+ version: z8.number().int().positive(),
629
+ content: z8.record(z8.string(), z8.unknown())
541
630
  }).strict();
542
631
  function definePromptContext(definition) {
543
632
  const identity = promptContextSchema.pick({ kind: true, version: true }).parse({ kind: definition.kind, version: definition.version });
@@ -551,13 +640,13 @@ function definePromptContext(definition) {
551
640
  }
552
641
 
553
642
  // src/events.ts
554
- import { z as z8 } from "zod";
643
+ import { z as z9 } from "zod";
555
644
  var EVENT_SUMMARY_MAX_LENGTH = 4e3;
556
645
  var EVENT_TEXT_MAX_LENGTH = 8e3;
557
646
  var EVENT_DATA_MAX_KEYS = 32;
558
647
  var EVENT_DATA_MAX_JSON_BYTES = 4e3;
559
648
  var EVENT_GUIDANCE_MAX_LENGTH = 1e3;
560
- var eventDataSchema = z8.record(z8.string(), z8.unknown()).superRefine((value, context) => {
649
+ var eventDataSchema = z9.record(z9.string(), z9.unknown()).superRefine((value, context) => {
561
650
  const keys = Object.keys(value);
562
651
  if (keys.length > EVENT_DATA_MAX_KEYS) {
563
652
  context.addIssue({
@@ -575,17 +664,17 @@ var eventDataSchema = z8.record(z8.string(), z8.unknown()).superRefine((value, c
575
664
  });
576
665
  }
577
666
  });
578
- var eventTypeSchema = z8.string().regex(/^[a-z][a-z0-9_-]*(?:\.[a-z][a-z0-9_-]*)+$/).describe(
667
+ var eventTypeSchema = z9.string().regex(/^[a-z][a-z0-9_-]*(?:\.[a-z][a-z0-9_-]*)+$/).describe(
579
668
  "Canonical dotted event type, such as issue.closed or pull_request.review.changes_requested."
580
669
  );
581
- var resourceTypeSchema = z8.string().regex(/^[a-z][a-z0-9_]*$/).describe(
670
+ var resourceTypeSchema = z9.string().regex(/^[a-z][a-z0-9_]*$/).describe(
582
671
  "Canonical plugin-defined resource type, such as issue or pull_request."
583
672
  );
584
673
  var EVENT_MATCH_FIELD_NAME = /^[a-z][a-zA-Z0-9]*$/;
585
- var eventMatchFieldSchema = z8.object({
586
- kind: z8.enum(["boolean", "string", "number"]),
587
- description: z8.string().trim().min(1).max(200),
588
- enum: z8.array(z8.string().min(1)).min(1).optional()
674
+ var eventMatchFieldSchema = z9.object({
675
+ kind: z9.enum(["boolean", "string", "number"]),
676
+ description: z9.string().trim().min(1).max(200),
677
+ enum: z9.array(z9.string().min(1)).min(1).optional()
589
678
  }).strict().superRefine((field, context) => {
590
679
  if (field.enum && field.kind !== "string") {
591
680
  context.addIssue({
@@ -595,7 +684,7 @@ var eventMatchFieldSchema = z8.object({
595
684
  });
596
685
  }
597
686
  });
598
- var eventMatchFieldsSchema = z8.record(z8.string().regex(EVENT_MATCH_FIELD_NAME), eventMatchFieldSchema).superRefine((fields, context) => {
687
+ var eventMatchFieldsSchema = z9.record(z9.string().regex(EVENT_MATCH_FIELD_NAME), eventMatchFieldSchema).superRefine((fields, context) => {
599
688
  if (Object.keys(fields).length > EVENT_DATA_MAX_KEYS) {
600
689
  context.addIssue({
601
690
  code: "custom",
@@ -603,13 +692,13 @@ var eventMatchFieldsSchema = z8.record(z8.string().regex(EVENT_MATCH_FIELD_NAME)
603
692
  });
604
693
  }
605
694
  });
606
- var eventMatchSchema = z8.record(
607
- z8.string().regex(EVENT_MATCH_FIELD_NAME),
608
- z8.union([
609
- z8.boolean(),
610
- z8.number().finite(),
611
- z8.string().min(1),
612
- z8.array(z8.union([z8.number().finite(), z8.string().min(1)])).min(1)
695
+ var eventMatchSchema = z9.record(
696
+ z9.string().regex(EVENT_MATCH_FIELD_NAME),
697
+ z9.union([
698
+ z9.boolean(),
699
+ z9.number().finite(),
700
+ z9.string().min(1),
701
+ z9.array(z9.union([z9.number().finite(), z9.string().min(1)])).min(1)
613
702
  ])
614
703
  ).superRefine((match, context) => {
615
704
  if (Object.keys(match).length > EVENT_DATA_MAX_KEYS) {
@@ -660,14 +749,14 @@ function eventMatches(match, data) {
660
749
  }
661
750
  return true;
662
751
  }
663
- var pluginEventTypeSchema = z8.object({
752
+ var pluginEventTypeSchema = z9.object({
664
753
  type: resourceTypeSchema,
665
- supportedEvents: z8.array(eventTypeSchema).min(1),
666
- suggestedEvents: z8.array(eventTypeSchema).optional(),
754
+ supportedEvents: z9.array(eventTypeSchema).min(1),
755
+ suggestedEvents: z9.array(eventTypeSchema).optional(),
667
756
  matchFields: eventMatchFieldsSchema.optional(),
668
- guidance: z8.record(
757
+ guidance: z9.record(
669
758
  eventTypeSchema,
670
- z8.string().trim().min(1).max(EVENT_GUIDANCE_MAX_LENGTH)
759
+ z9.string().trim().min(1).max(EVENT_GUIDANCE_MAX_LENGTH)
671
760
  ).optional()
672
761
  }).strict().superRefine((resourceType, context) => {
673
762
  const supported = /* @__PURE__ */ new Set();
@@ -709,10 +798,10 @@ var pluginEventTypeSchema = z8.object({
709
798
  suggested.add(eventType);
710
799
  });
711
800
  });
712
- var pluginEventsSchema = z8.object({
713
- resourceTypes: z8.array(pluginEventTypeSchema).min(1),
714
- isEnabled: z8.function({ input: [], output: z8.boolean() }).optional(),
715
- normalizeIdentifier: z8.function({ input: [z8.string()], output: z8.string() }).optional()
801
+ var pluginEventsSchema = z9.object({
802
+ resourceTypes: z9.array(pluginEventTypeSchema).min(1),
803
+ isEnabled: z9.function({ input: [], output: z9.boolean() }).optional(),
804
+ normalizeIdentifier: z9.function({ input: [z9.string()], output: z9.string() }).optional()
716
805
  }).strict().superRefine((registration, context) => {
717
806
  const seen = /* @__PURE__ */ new Set();
718
807
  registration.resourceTypes.forEach((resourceType, index) => {
@@ -734,62 +823,63 @@ function normalizeEventIdentifier(registration, identifier) {
734
823
  }
735
824
  return normalized;
736
825
  }
737
- var subscribableResourceSchema = z8.object({
738
- identifier: z8.string().min(1),
739
- label: z8.string().min(1),
740
- namespace: z8.string().min(1),
741
- suggestedEvents: z8.array(eventTypeSchema).optional(),
742
- supportedEvents: z8.array(eventTypeSchema),
826
+ var subscribableResourceSchema = z9.object({
827
+ identifier: z9.string().min(1),
828
+ label: z9.string().min(1),
829
+ namespace: z9.string().min(1),
830
+ suggestedEvents: z9.array(eventTypeSchema).optional(),
831
+ supportedEvents: z9.array(eventTypeSchema),
743
832
  type: resourceTypeSchema
744
833
  }).strict();
745
- var watchResultSchema = z8.object({
746
- events: z8.array(eventTypeSchema).min(1),
747
- id: z8.string().min(1)
834
+ var watchResultSchema = z9.object({
835
+ events: z9.array(eventTypeSchema).min(1),
836
+ id: z9.string().min(1)
748
837
  }).strict();
749
- var eventInputSchema = z8.object({
750
- eventKey: z8.string().min(1),
838
+ var eventInputSchema = z9.object({
839
+ objectType: objectTypeSchema.optional(),
840
+ eventKey: z9.string().min(1),
751
841
  eventType: eventTypeSchema,
752
- identifier: z8.string().min(1),
753
- occurredAtMs: z8.number().finite(),
754
- terminal: z8.boolean().optional(),
755
- trustedSummary: z8.string().min(1).transform((value) => value.slice(0, EVENT_SUMMARY_MAX_LENGTH)),
842
+ identifier: z9.string().min(1),
843
+ occurredAtMs: z9.number().finite(),
844
+ terminal: z9.boolean().optional(),
845
+ trustedSummary: z9.string().min(1).transform((value) => value.slice(0, EVENT_SUMMARY_MAX_LENGTH)),
756
846
  /** Trusted structured facts. Prefer ids and urls over long prose. */
757
847
  data: eventDataSchema.optional(),
758
- untrustedText: z8.string().transform((value) => value.slice(0, EVENT_TEXT_MAX_LENGTH)).optional()
848
+ untrustedText: z9.string().transform((value) => value.slice(0, EVENT_TEXT_MAX_LENGTH)).optional()
759
849
  }).strict();
760
850
  var eventSchema = eventInputSchema.extend({
761
- namespace: z8.string().min(1)
851
+ namespace: z9.string().min(1)
762
852
  });
763
853
 
764
854
  // src/tasks.ts
765
- import { z as z9 } from "zod";
766
- var pluginRunTranscriptProvenanceSchema = z9.object({
767
- authority: z9.enum(["instruction", "context"]),
855
+ import { z as z10 } from "zod";
856
+ var pluginRunTranscriptProvenanceSchema = z10.object({
857
+ authority: z10.enum(["instruction", "context"]),
768
858
  actor: actorSchema.optional()
769
859
  }).strict();
770
- var pluginRunTranscriptEntrySchema = z9.discriminatedUnion("type", [
771
- z9.object({
772
- type: z9.literal("message"),
773
- role: z9.enum(["user", "assistant"]),
774
- text: z9.string().min(1),
860
+ var pluginRunTranscriptEntrySchema = z10.discriminatedUnion("type", [
861
+ z10.object({
862
+ type: z10.literal("message"),
863
+ role: z10.enum(["user", "assistant"]),
864
+ text: z10.string().min(1),
775
865
  provenance: pluginRunTranscriptProvenanceSchema.optional(),
776
- isRunActor: z9.boolean().optional()
866
+ isRunActor: z10.boolean().optional()
777
867
  }).strict(),
778
- z9.object({
779
- type: z9.literal("toolResult"),
780
- toolName: z9.string().min(1),
781
- isError: z9.boolean(),
782
- text: z9.string().min(1).optional()
868
+ z10.object({
869
+ type: z10.literal("toolResult"),
870
+ toolName: z10.string().min(1),
871
+ isError: z10.boolean(),
872
+ text: z10.string().min(1).optional()
783
873
  }).strict()
784
874
  ]);
785
- var pluginRunContextSchema = z9.object({
875
+ var pluginRunContextSchema = z10.object({
786
876
  /** User linked to the Actor, when known. */
787
- actorUserId: z9.string().min(1).optional(),
788
- completedAtMs: z9.number().finite(),
789
- conversationId: z9.string().min(1),
877
+ actorUserId: z10.string().min(1).optional(),
878
+ completedAtMs: z10.number().finite(),
879
+ conversationId: z10.string().min(1),
790
880
  destination: destinationSchema,
791
881
  /** Location associated with this Conversation. */
792
- locationId: z9.string().min(1).optional(),
882
+ locationId: z10.string().min(1).optional(),
793
883
  /**
794
884
  * All distinct actors annotated on this run's committed instruction-authority
795
885
  * messages, in first-seen order. Attribution provenance only, never an
@@ -798,45 +888,45 @@ var pluginRunContextSchema = z9.object({
798
888
  * exceed the actors visible in the transcript slice. Usually `[run.actor]`;
799
889
  * possibly empty for system runs with no human instructions.
800
890
  */
801
- actors: z9.array(actorSchema),
891
+ actors: z10.array(actorSchema),
802
892
  /**
803
893
  * The single actor this run executes as. Absent only for actor-less legacy
804
894
  * system records, so authority-sensitive plugins must fail closed.
805
895
  */
806
896
  actor: actorSchema.optional(),
807
- runId: z9.string().min(1),
897
+ runId: z10.string().min(1),
808
898
  source: sourceSchema,
809
- transcript: z9.array(pluginRunTranscriptEntrySchema)
899
+ transcript: z10.array(pluginRunTranscriptEntrySchema)
810
900
  }).strict();
811
901
 
812
902
  // src/tools.ts
813
- import { z as z10 } from "zod";
903
+ import { z as z11 } from "zod";
814
904
  var PluginToolInputError = class extends Error {
815
905
  constructor(message, options) {
816
906
  super(message, options);
817
907
  this.name = "PluginToolInputError";
818
908
  }
819
909
  };
820
- var pluginToolContentSchema = z10.discriminatedUnion("type", [
821
- z10.object({ type: z10.literal("text"), text: z10.string() }).strict(),
822
- z10.object({
823
- type: z10.literal("image"),
824
- data: z10.string(),
825
- mimeType: z10.string()
910
+ var pluginToolContentSchema = z11.discriminatedUnion("type", [
911
+ z11.object({ type: z11.literal("text"), text: z11.string() }).strict(),
912
+ z11.object({
913
+ type: z11.literal("image"),
914
+ data: z11.string(),
915
+ mimeType: z11.string()
826
916
  }).strict()
827
917
  ]);
828
- var pluginToolContinuationSchema = z10.object({
829
- arguments: z10.record(z10.string(), z10.unknown()),
830
- reason: z10.string().min(1).optional()
918
+ var pluginToolContinuationSchema = z11.object({
919
+ arguments: z11.record(z11.string(), z11.unknown()),
920
+ reason: z11.string().min(1).optional()
831
921
  }).strict();
832
- var pluginToolOutputSchema = z10.object({
922
+ var pluginToolOutputSchema = z11.object({
833
923
  /** Object results to save and show with the next reply. Omit for silent updates. */
834
- objectAnnotations: z10.array(objectAnnotationSchema).optional(),
835
- target: z10.string().min(1).optional(),
836
- truncated: z10.boolean().optional(),
924
+ objectAnnotations: z11.array(objectAnnotationSchema).optional(),
925
+ target: z11.string().min(1).optional(),
926
+ truncated: z11.boolean().optional(),
837
927
  continuation: pluginToolContinuationSchema.optional()
838
928
  }).passthrough();
839
- var toolApprovalModeSchema = z10.enum(["auto", "review", "approve"]);
929
+ var toolApprovalModeSchema = z11.enum(["auto", "review", "approve"]);
840
930
  var REQUIRED_TOOL_ANNOTATION_KEYS = [
841
931
  "destructiveHint",
842
932
  "idempotentHint",
@@ -872,7 +962,7 @@ function createZodTool(definition, helperName) {
872
962
  let modelInputSchema;
873
963
  let modelOutputSchema;
874
964
  try {
875
- modelInputSchema = z10.toJSONSchema(inputSchema);
965
+ modelInputSchema = z11.toJSONSchema(inputSchema);
876
966
  } catch (error) {
877
967
  throw new TypeError(
878
968
  `${helperName}() inputSchema must be representable as JSON Schema.`,
@@ -880,7 +970,7 @@ function createZodTool(definition, helperName) {
880
970
  );
881
971
  }
882
972
  try {
883
- modelOutputSchema = z10.toJSONSchema(outputSchema);
973
+ modelOutputSchema = z11.toJSONSchema(outputSchema);
884
974
  } catch (error) {
885
975
  throw new TypeError(
886
976
  `${helperName}() outputSchema must be representable as JSON Schema.`,
@@ -906,7 +996,7 @@ function createZodTool(definition, helperName) {
906
996
  );
907
997
  if (isPluginToolOutputEnvelope(result)) {
908
998
  return {
909
- content: z10.array(pluginToolContentSchema).parse(result.content),
999
+ content: z11.array(pluginToolContentSchema).parse(result.content),
910
1000
  details: outputSchema.parse(result.details)
911
1001
  };
912
1002
  }
@@ -923,76 +1013,76 @@ function definePluginTool(definition) {
923
1013
  }
924
1014
 
925
1015
  // src/operations.ts
926
- import { z as z11 } from "zod";
927
- var pluginApiRouteRequestContextSchema = z11.object({
928
- auth: z11.object({
929
- user: z11.object({
930
- email: z11.string().nullable().optional(),
931
- emailVerified: z11.boolean().optional(),
932
- name: z11.string().nullable().optional()
1016
+ import { z as z12 } from "zod";
1017
+ var pluginApiRouteRequestContextSchema = z12.object({
1018
+ auth: z12.object({
1019
+ user: z12.object({
1020
+ email: z12.string().nullable().optional(),
1021
+ emailVerified: z12.boolean().optional(),
1022
+ name: z12.string().nullable().optional()
933
1023
  }).strict()
934
1024
  }).strict(),
935
1025
  pluginName: nonBlankStringSchema
936
1026
  }).strict();
937
1027
 
938
1028
  // src/credentials.ts
939
- import { z as z12 } from "zod";
940
- var pluginProviderNameSchema = z12.string().regex(/^[a-z][a-z0-9-]*$/);
941
- var pluginGrantNameSchema = z12.string().regex(/^[a-z][a-z0-9.-]*$/);
942
- var pluginGrantAccessSchema = z12.union([
943
- z12.literal("read"),
944
- z12.literal("write")
1029
+ import { z as z13 } from "zod";
1030
+ var pluginProviderNameSchema = z13.string().regex(/^[a-z][a-z0-9-]*$/);
1031
+ var pluginGrantNameSchema = z13.string().regex(/^[a-z][a-z0-9.-]*$/);
1032
+ var pluginGrantAccessSchema = z13.union([
1033
+ z13.literal("read"),
1034
+ z13.literal("write")
945
1035
  ]);
946
- var pluginAuthorizationSchema = z12.object({
1036
+ var pluginAuthorizationSchema = z13.object({
947
1037
  provider: pluginProviderNameSchema,
948
1038
  scope: nonBlankStringSchema.optional(),
949
- type: z12.literal("oauth")
1039
+ type: z13.literal("oauth")
950
1040
  }).strict();
951
- var pluginProviderAccountSchema = z12.object({
1041
+ var pluginProviderAccountSchema = z13.object({
952
1042
  displayName: nonBlankStringSchema.optional(),
953
1043
  handle: nonBlankStringSchema.optional(),
954
1044
  id: nonBlankStringSchema,
955
1045
  label: nonBlankStringSchema.optional(),
956
1046
  url: nonBlankStringSchema.optional()
957
1047
  }).strict();
958
- var pluginStoredTokensSchema = z12.object({
1048
+ var pluginStoredTokensSchema = z13.object({
959
1049
  account: pluginProviderAccountSchema.optional(),
960
1050
  accessToken: nonBlankStringSchema,
961
- expiresAt: z12.number().finite().optional(),
1051
+ expiresAt: z13.number().finite().optional(),
962
1052
  refreshToken: nonBlankStringSchema,
963
- refreshTokenExpiresAt: z12.number().finite().optional(),
1053
+ refreshTokenExpiresAt: z13.number().finite().optional(),
964
1054
  scope: nonBlankStringSchema.optional()
965
1055
  }).strict();
966
- var pluginGrantSchema = z12.object({
1056
+ var pluginGrantSchema = z13.object({
967
1057
  access: pluginGrantAccessSchema,
968
1058
  leaseScope: nonBlankStringSchema.optional(),
969
1059
  name: pluginGrantNameSchema,
970
1060
  reason: nonBlankStringSchema.optional(),
971
- requirements: z12.array(nonBlankStringSchema).min(1).optional()
1061
+ requirements: z13.array(nonBlankStringSchema).min(1).optional()
972
1062
  }).strict();
973
- var pluginCredentialHeaderTransformSchema = z12.object({
974
- domain: z12.string().min(1),
975
- headers: z12.record(z12.string(), z12.string()).refine((headers) => Object.keys(headers).length > 0)
1063
+ var pluginCredentialHeaderTransformSchema = z13.object({
1064
+ domain: z13.string().min(1),
1065
+ headers: z13.record(z13.string(), z13.string()).refine((headers) => Object.keys(headers).length > 0)
976
1066
  }).strict();
977
- var pluginCredentialLeaseSchema = z12.object({
1067
+ var pluginCredentialLeaseSchema = z13.object({
978
1068
  account: pluginProviderAccountSchema.optional(),
979
1069
  authorization: pluginAuthorizationSchema.optional(),
980
- expiresAt: z12.string().refine((value) => Number.isFinite(Date.parse(value))),
981
- headerTransforms: z12.array(pluginCredentialHeaderTransformSchema).min(1)
1070
+ expiresAt: z13.string().refine((value) => Number.isFinite(Date.parse(value))),
1071
+ headerTransforms: z13.array(pluginCredentialHeaderTransformSchema).min(1)
982
1072
  }).strict();
983
- var pluginCredentialResultSchema = z12.discriminatedUnion("type", [
984
- z12.object({
1073
+ var pluginCredentialResultSchema = z13.discriminatedUnion("type", [
1074
+ z13.object({
985
1075
  lease: pluginCredentialLeaseSchema,
986
- type: z12.literal("lease")
1076
+ type: z13.literal("lease")
987
1077
  }).strict(),
988
- z12.object({
1078
+ z13.object({
989
1079
  authorization: pluginAuthorizationSchema.optional(),
990
1080
  message: nonBlankStringSchema,
991
- type: z12.literal("needed")
1081
+ type: z13.literal("needed")
992
1082
  }).strict(),
993
- z12.object({
1083
+ z13.object({
994
1084
  message: nonBlankStringSchema,
995
- type: z12.literal("unavailable")
1085
+ type: z13.literal("unavailable")
996
1086
  }).strict()
997
1087
  ]);
998
1088
  var EgressAuthRequired = class extends Error {
@@ -1128,44 +1218,44 @@ function defineJuniorPlugin(plugin) {
1128
1218
  }
1129
1219
 
1130
1220
  // src/user-pages.ts
1131
- import { z as z13 } from "zod";
1221
+ import { z as z14 } from "zod";
1132
1222
  var userPageIdSchema = nonBlankStringSchema.max(64).regex(/^[a-z][a-z0-9-]*$/);
1133
1223
  var userPageLabelSchema = nonBlankStringSchema.max(80);
1134
1224
  var userPageDescriptionSchema = nonBlankStringSchema.max(500);
1135
- var userPageNavigationSchema = z13.enum(["primary", "profile"]);
1136
- var pluginUserPageMetricSchema = z13.object({
1225
+ var userPageNavigationSchema = z14.enum(["primary", "profile"]);
1226
+ var pluginUserPageMetricSchema = z14.object({
1137
1227
  detail: nonBlankStringSchema.max(500).optional(),
1138
1228
  label: nonBlankStringSchema.max(80),
1139
- tone: z13.enum(["good", "neutral", "warning"]).optional(),
1229
+ tone: z14.enum(["good", "neutral", "warning"]).optional(),
1140
1230
  value: nonBlankStringSchema.max(120)
1141
1231
  }).strict();
1142
- var pluginUserPageMetadataSchema = z13.object({
1232
+ var pluginUserPageMetadataSchema = z14.object({
1143
1233
  label: nonBlankStringSchema.max(80),
1144
1234
  value: nonBlankStringSchema.max(500)
1145
1235
  }).strict();
1146
- var pluginUserPageActionSchema = z13.object({
1236
+ var pluginUserPageActionSchema = z14.object({
1147
1237
  confirmation: nonBlankStringSchema.max(500).optional(),
1148
1238
  href: nonBlankStringSchema.max(500).regex(/^\/api\/plugins\/[a-z][a-z0-9-]*(?:\/|$)/),
1149
1239
  label: nonBlankStringSchema.max(80),
1150
- method: z13.literal("DELETE"),
1151
- tone: z13.enum(["danger", "neutral"]).optional()
1240
+ method: z14.literal("DELETE"),
1241
+ tone: z14.enum(["danger", "neutral"]).optional()
1152
1242
  }).strict();
1153
- var pluginUserPageRecordSchema = z13.object({
1154
- actions: z13.array(pluginUserPageActionSchema).max(4).optional(),
1243
+ var pluginUserPageRecordSchema = z14.object({
1244
+ actions: z14.array(pluginUserPageActionSchema).max(4).optional(),
1155
1245
  description: nonBlankStringSchema.max(1e3).optional(),
1156
1246
  id: nonBlankStringSchema.max(128),
1157
- metadata: z13.array(pluginUserPageMetadataSchema).max(8).optional(),
1247
+ metadata: z14.array(pluginUserPageMetadataSchema).max(8).optional(),
1158
1248
  title: nonBlankStringSchema.max(4e3)
1159
1249
  }).strict();
1160
- var pluginUserPageContentSchema = z13.object({
1250
+ var pluginUserPageContentSchema = z14.object({
1161
1251
  emptyText: nonBlankStringSchema.max(500).optional(),
1162
- metrics: z13.array(pluginUserPageMetricSchema).max(6).optional(),
1252
+ metrics: z14.array(pluginUserPageMetricSchema).max(6).optional(),
1163
1253
  nextCursor: nonBlankStringSchema.max(1e3).optional(),
1164
- records: z13.array(pluginUserPageRecordSchema).max(100),
1254
+ records: z14.array(pluginUserPageRecordSchema).max(100),
1165
1255
  searchPlaceholder: nonBlankStringSchema.max(120).optional(),
1166
- type: z13.literal("list")
1256
+ type: z14.literal("list")
1167
1257
  }).strict();
1168
- var pluginUserPageLinkSchema = z13.object({
1258
+ var pluginUserPageLinkSchema = z14.object({
1169
1259
  description: userPageDescriptionSchema,
1170
1260
  id: userPageIdSchema,
1171
1261
  label: userPageLabelSchema,
@@ -1173,14 +1263,14 @@ var pluginUserPageLinkSchema = z13.object({
1173
1263
  pluginDisplayName: nonBlankStringSchema.max(200),
1174
1264
  pluginName: nonBlankStringSchema.max(100)
1175
1265
  }).strict();
1176
- var pluginUserPageLinksSchema = z13.array(pluginUserPageLinkSchema);
1266
+ var pluginUserPageLinksSchema = z14.array(pluginUserPageLinkSchema);
1177
1267
  var pluginUserPageCursorSchema = nonBlankStringSchema.max(1e3).optional();
1178
1268
  var pluginUserPageFilterSchema = nonBlankStringSchema.max(64).optional();
1179
- var pluginUserPageQuerySchema = z13.string().trim().max(200).optional();
1180
- var pluginUserPageInputSchema = z13.object({
1269
+ var pluginUserPageQuerySchema = z14.string().trim().max(200).optional();
1270
+ var pluginUserPageInputSchema = z14.object({
1181
1271
  cursor: pluginUserPageCursorSchema,
1182
1272
  filter: pluginUserPageFilterSchema,
1183
- limit: z13.number().int().min(1).max(50),
1273
+ limit: z14.number().int().min(1).max(50),
1184
1274
  query: pluginUserPageQuerySchema
1185
1275
  }).strict();
1186
1276
  export {
@@ -1239,6 +1329,10 @@ export {
1239
1329
  objectAnnotationSchema,
1240
1330
  objectFactFields,
1241
1331
  objectFactsSchema,
1332
+ objectIconPath,
1333
+ objectIconPaths,
1334
+ objectPresentation,
1335
+ objectTypeSchema,
1242
1336
  ownedObjectAnnotationSchema,
1243
1337
  platformSchema,
1244
1338
  pluginApiRouteRequestContextSchema,