@devpad/api 2.2.11 → 2.2.13

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
@@ -7,7 +7,13 @@ import {
7
7
  upsert_milestone,
8
8
  upsert_project,
9
9
  upsert_todo
10
- } from "./chunk-UIFZ5MOM.js";
10
+ } from "./chunk-DIX4XVUQ.js";
11
+ import {
12
+ CategoryCreateSchema,
13
+ PostCreateSchema,
14
+ PostListParamsSchema,
15
+ PostUpdateSchema
16
+ } from "./chunk-5L3AUVMM.js";
11
17
 
12
18
  // src/errors.ts
13
19
  var ApiError = class _ApiError extends Error {
@@ -69,11 +75,12 @@ async function handleResponseError(response) {
69
75
  const errorMessage = errorText || "Request failed";
70
76
  let parsedError = null;
71
77
  try {
72
- parsedError = JSON.parse(errorText);
78
+ const raw = JSON.parse(errorText);
79
+ parsedError = raw;
73
80
  } catch {
74
81
  }
75
82
  if (response.status === HTTP_STATUS.BAD_REQUEST && parsedError?.error?.name === "ZodError") {
76
- const zodErrorDetails = parsedError.error?.issues ? JSON.stringify(parsedError.error) : errorMessage;
83
+ const zodErrorDetails = parsedError.error.issues ? JSON.stringify(parsedError.error) : errorMessage;
77
84
  throw new ValidationError(zodErrorDetails);
78
85
  }
79
86
  throw new ApiError(errorMessage, { statusCode: response.status });
@@ -91,48 +98,53 @@ function isAuthenticationError(error) {
91
98
  function isNetworkError(error) {
92
99
  return error instanceof NetworkError;
93
100
  }
101
+ function tryParseZodErrorString(errorMessage) {
102
+ const zodErrorMatch = errorMessage.match(/ZodError: (.+)/);
103
+ if (!zodErrorMatch?.[1]) return null;
104
+ try {
105
+ const raw = JSON.parse(zodErrorMatch[1]);
106
+ return raw;
107
+ } catch {
108
+ const issuesMatch = errorMessage.match(/issues:\s*(\[.*\])/s);
109
+ if (!issuesMatch?.[1]) return null;
110
+ try {
111
+ const raw_issues = JSON.parse(issuesMatch[1]);
112
+ return { issues: raw_issues };
113
+ } catch {
114
+ return null;
115
+ }
116
+ }
117
+ }
94
118
  function parseZodErrors(errorMessage) {
95
119
  try {
96
120
  let parsedError = null;
97
121
  try {
98
- parsedError = JSON.parse(errorMessage);
122
+ const raw = JSON.parse(errorMessage);
123
+ parsedError = raw;
99
124
  } catch {
100
- const zodErrorMatch = errorMessage.match(/ZodError: (.+)/);
101
- if (zodErrorMatch && zodErrorMatch[1]) {
102
- try {
103
- parsedError = JSON.parse(zodErrorMatch[1]);
104
- } catch {
105
- const issuesMatch = errorMessage.match(/issues:\s*(\[.*\])/s);
106
- if (issuesMatch && issuesMatch[1]) {
107
- try {
108
- parsedError = { issues: JSON.parse(issuesMatch[1]) };
109
- } catch {
110
- }
111
- }
112
- }
113
- }
125
+ parsedError = tryParseZodErrorString(errorMessage);
114
126
  }
115
127
  if (parsedError?.issues && Array.isArray(parsedError.issues)) {
116
128
  const friendlyMessages = parsedError.issues.map((issue) => {
117
- const path = issue.path && issue.path.length > 0 ? issue.path.join(".") : "field";
129
+ const path = issue.path.length > 0 ? issue.path.join(".") : "field";
118
130
  const message = issue.message || "is invalid";
119
131
  switch (issue.code) {
120
132
  case "invalid_type":
121
133
  return `${path} must be a ${issue.expected} (received ${issue.received})`;
122
134
  case "too_small":
123
135
  if (issue.type === "string") {
124
- return `${path} must be at least ${issue.minimum} characters long`;
136
+ return `${path} must be at least ${String(issue.minimum)} characters long`;
125
137
  }
126
138
  if (issue.type === "number") {
127
- return `${path} must be at least ${issue.minimum}`;
139
+ return `${path} must be at least ${String(issue.minimum)}`;
128
140
  }
129
141
  return `${path} is too small`;
130
142
  case "too_big":
131
143
  if (issue.type === "string") {
132
- return `${path} must be no more than ${issue.maximum} characters long`;
144
+ return `${path} must be no more than ${String(issue.maximum)} characters long`;
133
145
  }
134
146
  if (issue.type === "number") {
135
- return `${path} must be no more than ${issue.maximum}`;
147
+ return `${path} must be no more than ${String(issue.maximum)}`;
136
148
  }
137
149
  return `${path} is too large`;
138
150
  case "invalid_string":
@@ -148,18 +160,28 @@ function parseZodErrors(errorMessage) {
148
160
  return `${path} format is invalid`;
149
161
  case "custom":
150
162
  return `${path}: ${message}`;
163
+ case "invalid_literal":
164
+ case "unrecognized_keys":
165
+ case "invalid_union":
166
+ case "invalid_union_discriminator":
167
+ case "invalid_enum_value":
168
+ case "invalid_arguments":
169
+ case "invalid_return_type":
170
+ case "invalid_date":
171
+ case "invalid_intersection_types":
172
+ case "not_multiple_of":
173
+ case "not_finite":
151
174
  default:
152
175
  return `${path}: ${message}`;
153
176
  }
154
177
  });
155
178
  if (friendlyMessages.length === 1) {
156
- return friendlyMessages[0];
179
+ return friendlyMessages[0] ?? errorMessage;
157
180
  }
158
181
  return `Validation failed:
159
182
  \u2022 ${friendlyMessages.join("\n\u2022 ")}`;
160
183
  }
161
- } catch (e) {
162
- console.debug("Failed to parse Zod error:", e);
184
+ } catch {
163
185
  }
164
186
  return errorMessage;
165
187
  }
@@ -187,41 +209,41 @@ function getUserFriendlyErrorMessage(error) {
187
209
 
188
210
  // src/request.ts
189
211
  var ArrayBufferedQueue = class {
190
- constructor(_capacity) {
191
- this._capacity = _capacity;
192
- this._entries = [];
193
- this._head = 0;
194
- this._tail = 0;
195
- this._size = 0;
212
+ constructor(capacity) {
213
+ this.capacity = capacity;
214
+ this.entries = [];
215
+ this.head = 0;
216
+ this.tail = 0;
217
+ this.count = 0;
196
218
  }
197
219
  latest() {
198
- if (this._size === 0) return null;
199
- return this._entries[this._tail - 1] ?? null;
220
+ if (this.count === 0) return null;
221
+ return this.entries[this.tail - 1] ?? null;
200
222
  }
201
223
  list() {
202
- if (this._size === 0) return [];
203
- if (this._head < this._tail) {
204
- return this._entries.slice(this._head, this._tail);
224
+ if (this.count === 0) return [];
225
+ if (this.head < this.tail) {
226
+ return this.entries.slice(this.head, this.tail);
205
227
  }
206
- return this._entries.slice(this._head).concat(this._entries.slice(0, this._tail));
228
+ return this.entries.slice(this.head).concat(this.entries.slice(0, this.tail));
207
229
  }
208
230
  add(item) {
209
- if (this._size === this._capacity) {
210
- this._head = (this._head + 1) % this._capacity;
231
+ if (this.count === this.capacity) {
232
+ this.head = (this.head + 1) % this.capacity;
211
233
  } else {
212
- this._size++;
234
+ this.count++;
213
235
  }
214
- this._entries[this._tail] = item;
215
- this._tail = (this._tail + 1) % this._capacity;
236
+ this.entries[this.tail] = item;
237
+ this.tail = (this.tail + 1) % this.capacity;
216
238
  }
217
239
  size() {
218
- return this._size;
240
+ return this.count;
219
241
  }
220
242
  clear() {
221
- this._entries = [];
222
- this._head = 0;
223
- this._tail = 0;
224
- this._size = 0;
243
+ this.entries = [];
244
+ this.head = 0;
245
+ this.tail = 0;
246
+ this.count = 0;
225
247
  }
226
248
  };
227
249
  var ApiClient = class {
@@ -251,7 +273,7 @@ var ApiClient = class {
251
273
  return url.toString();
252
274
  }
253
275
  generateRequestId() {
254
- return `${Date.now()}-${Math.random().toString(36).substring(2, 11)}`;
276
+ return `${String(Date.now())}-${Math.random().toString(36).substring(2, 11)}`;
255
277
  }
256
278
  async request(path, options = {}) {
257
279
  const { method = "GET", headers = {}, body, query } = options;
@@ -302,7 +324,7 @@ var ApiClient = class {
302
324
  if (this.debug) {
303
325
  console.log(`[ERROR][${this.category}] ${method} ${path} [${requestId}] failed`, {
304
326
  status: response.status,
305
- duration: `${duration}ms`,
327
+ duration: `${String(duration)}ms`,
306
328
  body,
307
329
  query
308
330
  });
@@ -322,21 +344,22 @@ var ApiClient = class {
322
344
  if (response.status === HTTP_STATUS.NO_CONTENT) {
323
345
  result = void 0;
324
346
  } else {
325
- const text = await response.text();
326
- if (!text || text.trim() === "" || text.trim() === "null") {
347
+ const text2 = await response.text();
348
+ if (!text2 || text2.trim() === "" || text2.trim() === "null") {
327
349
  result = void 0;
328
350
  } else {
329
351
  try {
330
- result = JSON.parse(text);
331
- } catch (parseError) {
332
- result = text;
352
+ const raw = JSON.parse(text2);
353
+ result = raw;
354
+ } catch {
355
+ result = text2;
333
356
  }
334
357
  }
335
358
  }
336
359
  if (this.debug) {
337
360
  console.log(`[INFO][${this.category}] ${method} ${path} [${requestId}] completed`, {
338
361
  status: response.status,
339
- duration: `${duration}ms`
362
+ duration: `${String(duration)}ms`
340
363
  });
341
364
  }
342
365
  return result;
@@ -345,7 +368,7 @@ var ApiClient = class {
345
368
  if (this.debug) {
346
369
  console.log(`[ERROR][${this.category}] ${method} ${path} [${requestId}] failed`, {
347
370
  url,
348
- duration: `${duration}ms`,
371
+ duration: `${String(duration)}ms`,
349
372
  error: error instanceof Error ? error.message : String(error),
350
373
  body,
351
374
  query
@@ -401,12 +424,22 @@ var ApiClient = class {
401
424
 
402
425
  // src/result.ts
403
426
  import { err, ok } from "@f0rbit/corpus";
427
+ var string_field = (value, key) => {
428
+ if (typeof value !== "object" || value === null || !(key in value)) return void 0;
429
+ const field = value[key];
430
+ return typeof field === "string" ? field : void 0;
431
+ };
432
+ var number_field = (value, key) => {
433
+ if (typeof value !== "object" || value === null || !(key in value)) return void 0;
434
+ const field = value[key];
435
+ return typeof field === "number" ? field : void 0;
436
+ };
404
437
  function wrap(fn) {
405
438
  return fn().then((data) => ok(data)).catch(
406
439
  (error) => err({
407
- message: error.message || "Unknown error",
408
- code: error.code,
409
- status_code: error.statusCode || error.status_code
440
+ message: error instanceof Error ? error.message : "Unknown error",
441
+ code: string_field(error, "code"),
442
+ status_code: number_field(error, "statusCode") ?? number_field(error, "status_code")
410
443
  })
411
444
  );
412
445
  }
@@ -447,13 +480,10 @@ var ApiClient2 = class {
447
480
  map: async (filters) => wrap(async () => {
448
481
  const result = await this.projects.list(filters);
449
482
  if (!result.ok) throw new Error(result.error.message);
450
- return result.value.reduce(
451
- (acc, project) => {
452
- acc[project.id] = project;
453
- return acc;
454
- },
455
- {}
456
- );
483
+ return result.value.reduce((acc, project) => {
484
+ acc[project.id] = project;
485
+ return acc;
486
+ }, {});
457
487
  }),
458
488
  /**
459
489
  * Get project by ID
@@ -608,7 +638,7 @@ var ApiClient2 = class {
608
638
  find: (id) => wrap(async () => {
609
639
  try {
610
640
  return await this.clients.milestones.get(`/milestones/${id}`);
611
- } catch (error) {
641
+ } catch {
612
642
  return null;
613
643
  }
614
644
  }),
@@ -948,7 +978,11 @@ var ApiClient2 = class {
948
978
  /**
949
979
  * Update user preferences
950
980
  */
951
- preferences: (data) => wrap(() => this.clients.auth.patch("/user/preferences", { body: data }))
981
+ preferences: (data) => wrap(
982
+ () => this.clients.auth.patch("/user/preferences", {
983
+ body: data
984
+ })
985
+ )
952
986
  };
953
987
  /**
954
988
  * Pulse analytics and monitoring namespace
@@ -974,7 +1008,9 @@ var ApiClient2 = class {
974
1008
  if (input.search) query.search = input.search;
975
1009
  if (input.limit) query.limit = String(input.limit);
976
1010
  if (input.cursor) query.cursor = input.cursor;
977
- return this.clients.pulse.get("/events/:project_id".replace(":project_id", input.project_id), { query });
1011
+ return this.clients.pulse.get("/events/:project_id".replace(":project_id", input.project_id), {
1012
+ query
1013
+ });
978
1014
  }),
979
1015
  /**
980
1016
  * List error issues for a project
@@ -988,7 +1024,9 @@ var ApiClient2 = class {
988
1024
  query.to = String(input.range.to);
989
1025
  }
990
1026
  if (input.group_by_fingerprint) query.group_by_fingerprint = "true";
991
- return this.clients.pulse.get("/errors/:project_id".replace(":project_id", input.project_id), { query });
1027
+ return this.clients.pulse.get("/errors/:project_id".replace(":project_id", input.project_id), {
1028
+ query
1029
+ });
992
1030
  }),
993
1031
  /**
994
1032
  * List logs for a project
@@ -1018,7 +1056,9 @@ var ApiClient2 = class {
1018
1056
  }
1019
1057
  if (input.route) query.route = input.route;
1020
1058
  if (input.percentiles && input.percentiles.length > 0) query.percentiles = input.percentiles.join(",");
1021
- return this.clients.pulse.get("/latency/:project_id".replace(":project_id", input.project_id), { query });
1059
+ return this.clients.pulse.get("/latency/:project_id".replace(":project_id", input.project_id), {
1060
+ query
1061
+ });
1022
1062
  }),
1023
1063
  /**
1024
1064
  * Subscription management
@@ -1344,13 +1384,13 @@ var ApiClient2 = class {
1344
1384
  }
1345
1385
  };
1346
1386
  const base_url = options.base_url || "http://localhost:4321/api/v1";
1347
- this._api_key = options.api_key ?? "";
1348
- this._auth_mode = options.auth_mode ?? (options.api_key?.startsWith("jwt:") ? "session" : options.api_key ? "key" : "cookie");
1387
+ this.api_key_field = options.api_key ?? "";
1388
+ this.auth_mode_field = options.auth_mode ?? (options.api_key?.startsWith("jwt:") ? "session" : options.api_key ? "key" : "cookie");
1349
1389
  const clientOptions = {
1350
1390
  base_url,
1351
1391
  api_key: options.api_key,
1352
1392
  max_history_size: options.max_history_size,
1353
- auth_mode: this._auth_mode,
1393
+ auth_mode: this.auth_mode_field,
1354
1394
  credentials: options.credentials,
1355
1395
  default_headers: options.default_headers,
1356
1396
  custom_fetch: options.custom_fetch
@@ -1385,16 +1425,66 @@ var ApiClient2 = class {
1385
1425
  * Get the API key
1386
1426
  */
1387
1427
  getApiKey() {
1388
- return this._api_key;
1428
+ return this.api_key_field;
1389
1429
  }
1390
1430
  /**
1391
1431
  * Get the authentication mode
1392
1432
  */
1393
1433
  getAuthMode() {
1394
- return this._auth_mode;
1434
+ return this.auth_mode_field;
1395
1435
  }
1396
1436
  };
1397
1437
 
1438
+ // ../schema/dist/blog/index.js
1439
+ import { create_cloudflare_backend, create_corpus, create_memory_backend, define_store, err as err2, json_codec, ok as ok2 } from "@f0rbit/corpus";
1440
+
1441
+ // ../schema/dist/database/blog.js
1442
+ import { sql } from "drizzle-orm";
1443
+ import { integer, primaryKey, sqliteTable, text, unique } from "drizzle-orm/sqlite-core";
1444
+ var blog_posts = sqliteTable("blog_posts", {
1445
+ id: integer("id").primaryKey({ autoIncrement: true }),
1446
+ uuid: text("uuid").notNull().unique(),
1447
+ author_id: text("author_id").notNull(),
1448
+ slug: text("slug").notNull(),
1449
+ corpus_version: text("corpus_version"),
1450
+ category: text("category").notNull().default("root"),
1451
+ archived: integer("archived", { mode: "boolean" }).notNull().default(false),
1452
+ publish_at: integer("publish_at", { mode: "timestamp" }),
1453
+ created_at: integer("created_at", { mode: "timestamp" }).notNull().default(sql`(unixepoch())`),
1454
+ updated_at: integer("updated_at", { mode: "timestamp" }).notNull().default(sql`(unixepoch())`)
1455
+ }, (table) => [unique("posts_author_slug_unique").on(table.author_id, table.slug)]);
1456
+ var blog_categories = sqliteTable("blog_categories", {
1457
+ id: integer("id").primaryKey({ autoIncrement: true }),
1458
+ owner_id: text("owner_id").notNull(),
1459
+ name: text("name").notNull(),
1460
+ parent: text("parent").default("root")
1461
+ }, (table) => [unique("categories_owner_name_unique").on(table.owner_id, table.name)]);
1462
+ var blog_tags = sqliteTable("blog_tags", {
1463
+ post_id: integer("post_id").notNull().references(() => blog_posts.id, { onDelete: "cascade" }),
1464
+ tag: text("tag").notNull()
1465
+ }, (table) => [primaryKey({ columns: [table.post_id, table.tag] })]);
1466
+ var blog_integrations = sqliteTable("blog_integrations", {
1467
+ id: integer("id").primaryKey({ autoIncrement: true }),
1468
+ user_id: text("user_id").notNull(),
1469
+ source: text("source").notNull(),
1470
+ location: text("location").notNull(),
1471
+ data: text("data", { mode: "json" }).$type(),
1472
+ last_fetch: integer("last_fetch", { mode: "timestamp" }),
1473
+ status: text("status").default("pending"),
1474
+ created_at: integer("created_at", { mode: "timestamp" }).notNull().default(sql`(unixepoch())`)
1475
+ });
1476
+ var blog_fetch_links = sqliteTable("blog_fetch_links", {
1477
+ id: integer("id").primaryKey({ autoIncrement: true }),
1478
+ post_id: integer("post_id").notNull().references(() => blog_posts.id, { onDelete: "cascade" }),
1479
+ integration_id: integer("integration_id").notNull().references(() => blog_integrations.id, { onDelete: "cascade" }),
1480
+ identifier: text("identifier").notNull()
1481
+ }, (table) => [unique("fetch_links_integration_identifier_unique").on(table.integration_id, table.identifier)]);
1482
+ var blog_post_projects = sqliteTable("blog_post_projects", {
1483
+ post_id: integer("post_id").notNull().references(() => blog_posts.id, { onDelete: "cascade" }),
1484
+ project_id: text("project_id").notNull(),
1485
+ created_at: integer("created_at", { mode: "timestamp" }).notNull().default(sql`(unixepoch())`)
1486
+ }, (table) => [primaryKey({ columns: [table.post_id, table.project_id] })]);
1487
+
1398
1488
  // src/tools.ts
1399
1489
  import { z } from "zod";
1400
1490
  function unwrap(result) {
@@ -1430,27 +1520,32 @@ var github_branches = z.object({
1430
1520
  owner: z.string().describe("Repository owner"),
1431
1521
  repo: z.string().describe("Repository name")
1432
1522
  });
1523
+ var define_tool = (def) => def;
1433
1524
  var tools = {
1434
1525
  // Projects
1435
- devpad_projects_list: {
1526
+ devpad_projects_list: define_tool({
1436
1527
  name: "devpad_projects_list",
1437
1528
  description: "List all projects (or only public ones)",
1438
1529
  inputSchema: project_filters,
1439
1530
  execute: async (client, input) => unwrap(await client.projects.list(input))
1440
- },
1441
- devpad_projects_get: {
1531
+ }),
1532
+ devpad_projects_get: define_tool({
1442
1533
  name: "devpad_projects_get",
1443
1534
  description: "Get project by ID or name",
1444
1535
  inputSchema: project_by_id_or_name,
1445
- execute: async (client, input) => unwrap(input.id ? await client.projects.getById(input.id) : await client.projects.getByName(input.name))
1446
- },
1447
- devpad_projects_upsert: {
1536
+ execute: async (client, input) => {
1537
+ if (input.id) return unwrap(await client.projects.getById(input.id));
1538
+ if (!input.name) throw new Error("either id or name must be provided");
1539
+ return unwrap(await client.projects.getByName(input.name));
1540
+ }
1541
+ }),
1542
+ devpad_projects_upsert: define_tool({
1448
1543
  name: "devpad_projects_upsert",
1449
1544
  description: "Create or update a project (set deleted=true to delete). Returns 409 if entity is protected by user - pass force=true to override.",
1450
1545
  inputSchema: upsert_project,
1451
1546
  execute: async (client, input) => unwrap(await client.projects.upsert(input))
1452
- },
1453
- devpad_projects_config_save: {
1547
+ }),
1548
+ devpad_projects_config_save: define_tool({
1454
1549
  name: "devpad_projects_config_save",
1455
1550
  description: "Save project configuration",
1456
1551
  inputSchema: save_config_request,
@@ -1458,27 +1553,27 @@ var tools = {
1458
1553
  unwrap(await client.projects.config.save(input));
1459
1554
  return { success: true };
1460
1555
  }
1461
- },
1556
+ }),
1462
1557
  // Tasks
1463
- devpad_tasks_list: {
1558
+ devpad_tasks_list: define_tool({
1464
1559
  name: "devpad_tasks_list",
1465
1560
  description: "List tasks, optionally filtered by project or tag",
1466
1561
  inputSchema: task_filters,
1467
1562
  execute: async (client, input) => unwrap(await client.tasks.list(input))
1468
- },
1469
- devpad_tasks_get: {
1563
+ }),
1564
+ devpad_tasks_get: define_tool({
1470
1565
  name: "devpad_tasks_get",
1471
1566
  description: "Get task by ID",
1472
1567
  inputSchema: task_by_id,
1473
1568
  execute: async (client, input) => unwrap(await client.tasks.find(input.id))
1474
- },
1475
- devpad_tasks_upsert: {
1569
+ }),
1570
+ devpad_tasks_upsert: define_tool({
1476
1571
  name: "devpad_tasks_upsert",
1477
1572
  description: "Create or update a task (set deleted=true to delete). Returns 409 if entity is protected by user - pass force=true to override.",
1478
1573
  inputSchema: upsert_todo,
1479
1574
  execute: async (client, input) => unwrap(await client.tasks.upsert(input))
1480
- },
1481
- devpad_tasks_save_tags: {
1575
+ }),
1576
+ devpad_tasks_save_tags: define_tool({
1482
1577
  name: "devpad_tasks_save_tags",
1483
1578
  description: "Save tags for tasks",
1484
1579
  inputSchema: save_tags_request,
@@ -1486,23 +1581,23 @@ var tools = {
1486
1581
  unwrap(await client.tasks.saveTags(input));
1487
1582
  return { success: true };
1488
1583
  }
1489
- },
1584
+ }),
1490
1585
  // Milestones
1491
- devpad_milestones_list: {
1586
+ devpad_milestones_list: define_tool({
1492
1587
  name: "devpad_milestones_list",
1493
1588
  description: "List milestones for authenticated user or by project",
1494
1589
  inputSchema: milestone_filters,
1495
1590
  execute: async (client, input) => unwrap(
1496
1591
  input.project_id ? await client.milestones.getByProject(input.project_id) : await client.milestones.list()
1497
1592
  )
1498
- },
1499
- devpad_milestones_get: {
1593
+ }),
1594
+ devpad_milestones_get: define_tool({
1500
1595
  name: "devpad_milestones_get",
1501
1596
  description: "Get milestone by ID",
1502
1597
  inputSchema: milestone_by_id,
1503
1598
  execute: async (client, input) => unwrap(await client.milestones.find(input.id))
1504
- },
1505
- devpad_milestones_upsert: {
1599
+ }),
1600
+ devpad_milestones_upsert: define_tool({
1506
1601
  name: "devpad_milestones_upsert",
1507
1602
  description: "Create or update a milestone. Returns 409 if entity is protected by user - pass force=true to override.",
1508
1603
  inputSchema: upsert_milestone,
@@ -1522,21 +1617,21 @@ var tools = {
1522
1617
  finished_at: input.finished_at
1523
1618
  })
1524
1619
  )
1525
- },
1620
+ }),
1526
1621
  // Goals
1527
- devpad_goals_list: {
1622
+ devpad_goals_list: define_tool({
1528
1623
  name: "devpad_goals_list",
1529
1624
  description: "List goals for authenticated user",
1530
1625
  inputSchema: z.object({}),
1531
1626
  execute: async (client) => unwrap(await client.goals.list())
1532
- },
1533
- devpad_goals_get: {
1627
+ }),
1628
+ devpad_goals_get: define_tool({
1534
1629
  name: "devpad_goals_get",
1535
1630
  description: "Get goal by ID",
1536
1631
  inputSchema: goal_by_id,
1537
1632
  execute: async (client, input) => unwrap(await client.goals.find(input.id))
1538
- },
1539
- devpad_goals_upsert: {
1633
+ }),
1634
+ devpad_goals_upsert: define_tool({
1540
1635
  name: "devpad_goals_upsert",
1541
1636
  description: "Create or update a goal. Returns 409 if entity is protected by user - pass force=true to override.",
1542
1637
  inputSchema: upsert_goal,
@@ -1554,29 +1649,29 @@ var tools = {
1554
1649
  finished_at: input.finished_at
1555
1650
  })
1556
1651
  )
1557
- },
1652
+ }),
1558
1653
  // Tags
1559
- devpad_tags_list: {
1654
+ devpad_tags_list: define_tool({
1560
1655
  name: "devpad_tags_list",
1561
1656
  description: "List tags for authenticated user",
1562
1657
  inputSchema: z.object({}),
1563
1658
  execute: async (client) => unwrap(await client.tags.list())
1564
- },
1659
+ }),
1565
1660
  // GitHub integration
1566
- devpad_github_repos: {
1661
+ devpad_github_repos: define_tool({
1567
1662
  name: "devpad_github_repos",
1568
1663
  description: "List GitHub repositories for authenticated user",
1569
1664
  inputSchema: z.object({}),
1570
1665
  execute: async (client) => unwrap(await client.github.repos())
1571
- },
1572
- devpad_github_branches: {
1666
+ }),
1667
+ devpad_github_branches: define_tool({
1573
1668
  name: "devpad_github_branches",
1574
1669
  description: "List branches for a GitHub repository",
1575
1670
  inputSchema: github_branches,
1576
1671
  execute: async (client, input) => unwrap(await client.github.branches(input.owner, input.repo))
1577
- },
1672
+ }),
1578
1673
  // Additional project operations
1579
- devpad_projects_delete: {
1674
+ devpad_projects_delete: define_tool({
1580
1675
  name: "devpad_projects_delete",
1581
1676
  description: "Delete a project",
1582
1677
  inputSchema: z.object({
@@ -1588,59 +1683,59 @@ var tools = {
1588
1683
  unwrap(await client.projects.deleteProject(project));
1589
1684
  return { success: true };
1590
1685
  }
1591
- },
1592
- devpad_projects_history: {
1686
+ }),
1687
+ devpad_projects_history: define_tool({
1593
1688
  name: "devpad_projects_history",
1594
1689
  description: "Get project history",
1595
1690
  inputSchema: z.object({
1596
1691
  project_id: z.string().describe("Project ID")
1597
1692
  }),
1598
1693
  execute: async (client, input) => unwrap(await client.projects.history(input.project_id))
1599
- },
1600
- devpad_projects_specification: {
1694
+ }),
1695
+ devpad_projects_specification: define_tool({
1601
1696
  name: "devpad_projects_specification",
1602
1697
  description: "Fetch project specification from GitHub",
1603
1698
  inputSchema: z.object({
1604
1699
  project_id: z.string().describe("Project ID")
1605
1700
  }),
1606
1701
  execute: async (client, input) => unwrap(await client.projects.specification(input.project_id))
1607
- },
1608
- devpad_projects_config_load: {
1702
+ }),
1703
+ devpad_projects_config_load: define_tool({
1609
1704
  name: "devpad_projects_config_load",
1610
1705
  description: "Load project configuration",
1611
1706
  inputSchema: z.object({
1612
1707
  project_id: z.string().describe("Project ID")
1613
1708
  }),
1614
1709
  execute: async (client, input) => unwrap(await client.projects.config.load(input.project_id))
1615
- },
1710
+ }),
1616
1711
  // Additional milestone operations
1617
- devpad_milestones_delete: {
1712
+ devpad_milestones_delete: define_tool({
1618
1713
  name: "devpad_milestones_delete",
1619
1714
  description: "Delete a milestone",
1620
1715
  inputSchema: z.object({
1621
1716
  id: z.string().describe("Milestone ID")
1622
1717
  }),
1623
1718
  execute: async (client, input) => unwrap(await client.milestones.delete(input.id))
1624
- },
1625
- devpad_milestones_goals: {
1719
+ }),
1720
+ devpad_milestones_goals: define_tool({
1626
1721
  name: "devpad_milestones_goals",
1627
1722
  description: "Get goals for a milestone",
1628
1723
  inputSchema: z.object({
1629
1724
  id: z.string().describe("Milestone ID")
1630
1725
  }),
1631
1726
  execute: async (client, input) => unwrap(await client.milestones.goals(input.id))
1632
- },
1727
+ }),
1633
1728
  // Additional goal operations
1634
- devpad_goals_delete: {
1729
+ devpad_goals_delete: define_tool({
1635
1730
  name: "devpad_goals_delete",
1636
1731
  description: "Delete a goal",
1637
1732
  inputSchema: z.object({
1638
1733
  id: z.string().describe("Goal ID")
1639
1734
  }),
1640
1735
  execute: async (client, input) => unwrap(await client.goals.delete(input.id))
1641
- },
1736
+ }),
1642
1737
  // Additional task operations
1643
- devpad_tasks_delete: {
1738
+ devpad_tasks_delete: define_tool({
1644
1739
  name: "devpad_tasks_delete",
1645
1740
  description: "Delete a task",
1646
1741
  inputSchema: z.object({
@@ -1652,23 +1747,23 @@ var tools = {
1652
1747
  unwrap(await client.tasks.deleteTask(task));
1653
1748
  return { success: true };
1654
1749
  }
1655
- },
1656
- devpad_tasks_history: {
1750
+ }),
1751
+ devpad_tasks_history: define_tool({
1657
1752
  name: "devpad_tasks_history",
1658
1753
  description: "Get task history",
1659
1754
  inputSchema: z.object({
1660
1755
  task_id: z.string().describe("Task ID")
1661
1756
  }),
1662
1757
  execute: async (client, input) => unwrap(await client.tasks.history.get(input.task_id))
1663
- },
1758
+ }),
1664
1759
  // User operations
1665
- devpad_user_history: {
1760
+ devpad_user_history: define_tool({
1666
1761
  name: "devpad_user_history",
1667
1762
  description: "Get user activity history",
1668
1763
  inputSchema: z.object({}),
1669
1764
  execute: async (client) => unwrap(await client.user.history())
1670
- },
1671
- devpad_user_preferences: {
1765
+ }),
1766
+ devpad_user_preferences: define_tool({
1672
1767
  name: "devpad_user_preferences",
1673
1768
  description: "Update user preferences",
1674
1769
  inputSchema: z.object({
@@ -1676,8 +1771,8 @@ var tools = {
1676
1771
  task_view: z.enum(["list", "grid"]).describe("Task view preference")
1677
1772
  }),
1678
1773
  execute: async (client, input) => unwrap(await client.user.preferences(input))
1679
- },
1680
- devpad_activity_ai: {
1774
+ }),
1775
+ devpad_activity_ai: define_tool({
1681
1776
  name: "devpad_activity_ai",
1682
1777
  description: "Get AI activity feed - shows recent actions made via API/MCP grouped into sessions by time window",
1683
1778
  inputSchema: z.object({
@@ -1685,104 +1780,69 @@ var tools = {
1685
1780
  since: z.string().optional().describe("Only show activity after this ISO date")
1686
1781
  }),
1687
1782
  execute: async (client, input) => unwrap(await client.activity.ai(input))
1688
- },
1689
- devpad_blog_posts_list: {
1783
+ }),
1784
+ devpad_blog_posts_list: define_tool({
1690
1785
  name: "devpad_blog_posts_list",
1691
1786
  description: "List blog posts with optional filters",
1692
- inputSchema: z.object({
1693
- category: z.string().optional().describe("Filter by category"),
1694
- tag: z.string().optional().describe("Filter by tag"),
1695
- project: z.string().optional().describe("Filter by project ID"),
1696
- status: z.enum(["draft", "published"]).optional().describe("Filter by status"),
1697
- archived: z.boolean().optional().describe("Filter by archived state"),
1698
- limit: z.number().optional().describe("Max posts to return"),
1699
- offset: z.number().optional().describe("Offset for pagination"),
1700
- sort: z.string().optional().describe("Sort order")
1701
- }),
1787
+ inputSchema: PostListParamsSchema.partial(),
1702
1788
  execute: async (client, input) => unwrap(await client.blog.posts.list(input))
1703
- },
1704
- devpad_blog_posts_get: {
1789
+ }),
1790
+ devpad_blog_posts_get: define_tool({
1705
1791
  name: "devpad_blog_posts_get",
1706
1792
  description: "Get a blog post by slug",
1707
1793
  inputSchema: z.object({
1708
1794
  slug: z.string().describe("Post slug")
1709
1795
  }),
1710
1796
  execute: async (client, input) => unwrap(await client.blog.posts.getBySlug(input.slug))
1711
- },
1712
- devpad_blog_posts_create: {
1797
+ }),
1798
+ devpad_blog_posts_create: define_tool({
1713
1799
  name: "devpad_blog_posts_create",
1714
1800
  description: "Create a new blog post",
1715
- inputSchema: z.object({
1716
- title: z.string().describe("Post title"),
1717
- content: z.string().describe("Post content"),
1718
- format: z.enum(["markdown", "html"]).describe("Content format"),
1719
- slug: z.string().optional().describe("Custom slug"),
1720
- category: z.string().optional().describe("Category name"),
1721
- tags: z.array(z.string()).optional().describe("Tag names"),
1722
- description: z.string().optional().describe("Post description"),
1723
- publish_at: z.string().optional().describe("Scheduled publish date (ISO string)"),
1724
- project_ids: z.array(z.string()).optional().describe("Associated project IDs"),
1725
- archived: z.boolean().optional().describe("Whether post is archived")
1726
- }),
1801
+ inputSchema: PostCreateSchema,
1727
1802
  execute: async (client, input) => unwrap(await client.blog.posts.create(input))
1728
- },
1729
- devpad_blog_posts_update: {
1803
+ }),
1804
+ devpad_blog_posts_update: define_tool({
1730
1805
  name: "devpad_blog_posts_update",
1731
1806
  description: "Update a blog post by UUID",
1732
- inputSchema: z.object({
1733
- uuid: z.string().describe("Post UUID"),
1734
- title: z.string().optional().describe("Post title"),
1735
- content: z.string().optional().describe("Post content"),
1736
- format: z.enum(["markdown", "html"]).optional().describe("Content format"),
1737
- slug: z.string().optional().describe("Custom slug"),
1738
- category: z.string().optional().describe("Category name"),
1739
- tags: z.array(z.string()).optional().describe("Tag names"),
1740
- description: z.string().optional().describe("Post description"),
1741
- publish_at: z.string().optional().describe("Scheduled publish date (ISO string)"),
1742
- project_ids: z.array(z.string()).optional().describe("Associated project IDs"),
1743
- archived: z.boolean().optional().describe("Whether post is archived")
1744
- }),
1807
+ inputSchema: PostUpdateSchema.extend({ uuid: z.string().describe("Post UUID") }),
1745
1808
  execute: async (client, input) => {
1746
1809
  const { uuid, ...data } = input;
1747
1810
  return unwrap(await client.blog.posts.update(uuid, data));
1748
1811
  }
1749
- },
1750
- devpad_blog_posts_delete: {
1812
+ }),
1813
+ devpad_blog_posts_delete: define_tool({
1751
1814
  name: "devpad_blog_posts_delete",
1752
1815
  description: "Delete a blog post by UUID",
1753
1816
  inputSchema: z.object({
1754
1817
  uuid: z.string().describe("Post UUID")
1755
1818
  }),
1756
1819
  execute: async (client, input) => unwrap(await client.blog.posts.delete(input.uuid))
1757
- },
1758
- devpad_blog_tags_list: {
1820
+ }),
1821
+ devpad_blog_tags_list: define_tool({
1759
1822
  name: "devpad_blog_tags_list",
1760
1823
  description: "List all blog tags with post counts",
1761
1824
  inputSchema: z.object({}),
1762
1825
  execute: async (client) => unwrap(await client.blog.tags.list())
1763
- },
1764
- devpad_blog_categories_tree: {
1826
+ }),
1827
+ devpad_blog_categories_tree: define_tool({
1765
1828
  name: "devpad_blog_categories_tree",
1766
1829
  description: "Get the blog category tree",
1767
1830
  inputSchema: z.object({}),
1768
1831
  execute: async (client) => unwrap(await client.blog.categories.tree())
1769
- },
1770
- devpad_blog_categories_create: {
1832
+ }),
1833
+ devpad_blog_categories_create: define_tool({
1771
1834
  name: "devpad_blog_categories_create",
1772
1835
  description: "Create a blog category",
1773
- inputSchema: z.object({
1774
- name: z.string().describe("Category name"),
1775
- parent: z.string().optional().describe("Parent category name")
1776
- }),
1836
+ inputSchema: CategoryCreateSchema,
1777
1837
  execute: async (client, input) => unwrap(await client.blog.categories.create(input))
1778
- },
1779
- devpad_blog_tokens_list: {
1838
+ }),
1839
+ devpad_blog_tokens_list: define_tool({
1780
1840
  name: "devpad_blog_tokens_list",
1781
1841
  description: "List blog access tokens",
1782
1842
  inputSchema: z.object({}),
1783
1843
  execute: async (client) => unwrap(await client.blog.tokens.list())
1784
- },
1785
- devpad_blog_tokens_create: {
1844
+ }),
1845
+ devpad_blog_tokens_create: define_tool({
1786
1846
  name: "devpad_blog_tokens_create",
1787
1847
  description: "Create a blog access token",
1788
1848
  inputSchema: z.object({
@@ -1790,14 +1850,14 @@ var tools = {
1790
1850
  note: z.string().optional().describe("Optional note")
1791
1851
  }),
1792
1852
  execute: async (client, input) => unwrap(await client.blog.tokens.create(input))
1793
- },
1794
- devpad_media_profiles_list: {
1853
+ }),
1854
+ devpad_media_profiles_list: define_tool({
1795
1855
  name: "devpad_media_profiles_list",
1796
1856
  description: "List media profiles",
1797
1857
  inputSchema: z.object({}),
1798
1858
  execute: async (client) => unwrap(await client.media.profiles.list())
1799
- },
1800
- devpad_media_profiles_create: {
1859
+ }),
1860
+ devpad_media_profiles_create: define_tool({
1801
1861
  name: "devpad_media_profiles_create",
1802
1862
  description: "Create a media profile",
1803
1863
  inputSchema: z.object({
@@ -1805,16 +1865,16 @@ var tools = {
1805
1865
  slug: z.string().describe("Profile slug")
1806
1866
  }),
1807
1867
  execute: async (client, input) => unwrap(await client.media.profiles.create(input))
1808
- },
1809
- devpad_media_profiles_get: {
1868
+ }),
1869
+ devpad_media_profiles_get: define_tool({
1810
1870
  name: "devpad_media_profiles_get",
1811
1871
  description: "Get a media profile by ID",
1812
1872
  inputSchema: z.object({
1813
1873
  id: z.string().describe("Profile ID")
1814
1874
  }),
1815
1875
  execute: async (client, input) => unwrap(await client.media.profiles.get(input.id))
1816
- },
1817
- devpad_media_profiles_update: {
1876
+ }),
1877
+ devpad_media_profiles_update: define_tool({
1818
1878
  name: "devpad_media_profiles_update",
1819
1879
  description: "Update a media profile by ID",
1820
1880
  inputSchema: z.object({
@@ -1826,32 +1886,32 @@ var tools = {
1826
1886
  const { id, ...data } = input;
1827
1887
  return unwrap(await client.media.profiles.update(id, data));
1828
1888
  }
1829
- },
1830
- devpad_media_profiles_delete: {
1889
+ }),
1890
+ devpad_media_profiles_delete: define_tool({
1831
1891
  name: "devpad_media_profiles_delete",
1832
1892
  description: "Delete a media profile by ID",
1833
1893
  inputSchema: z.object({
1834
1894
  id: z.string().describe("Profile ID")
1835
1895
  }),
1836
1896
  execute: async (client, input) => unwrap(await client.media.profiles.delete(input.id))
1837
- },
1838
- devpad_media_connections_list: {
1897
+ }),
1898
+ devpad_media_connections_list: define_tool({
1839
1899
  name: "devpad_media_connections_list",
1840
1900
  description: "List connections for a media profile",
1841
1901
  inputSchema: z.object({
1842
1902
  profile_id: z.string().describe("Profile ID")
1843
1903
  }),
1844
1904
  execute: async (client, input) => unwrap(await client.media.connections.list(input.profile_id))
1845
- },
1846
- devpad_media_connections_refresh: {
1905
+ }),
1906
+ devpad_media_connections_refresh: define_tool({
1847
1907
  name: "devpad_media_connections_refresh",
1848
1908
  description: "Refresh a media connection",
1849
1909
  inputSchema: z.object({
1850
1910
  account_id: z.string().describe("Account/connection ID")
1851
1911
  }),
1852
1912
  execute: async (client, input) => unwrap(await client.media.connections.refresh(input.account_id))
1853
- },
1854
- devpad_media_timeline_get: {
1913
+ }),
1914
+ devpad_media_timeline_get: define_tool({
1855
1915
  name: "devpad_media_timeline_get",
1856
1916
  description: "Get media timeline for a user",
1857
1917
  inputSchema: z.object({
@@ -1863,9 +1923,9 @@ var tools = {
1863
1923
  const { user_id, ...params } = input;
1864
1924
  return unwrap(await client.media.timeline.get(user_id, params));
1865
1925
  }
1866
- },
1926
+ }),
1867
1927
  // Pulse analytics tools
1868
- devpad_pulse_summary: {
1928
+ devpad_pulse_summary: define_tool({
1869
1929
  name: "devpad_pulse_summary",
1870
1930
  description: "Get summary analytics for a project (pageviews, sessions, errors, latency)",
1871
1931
  inputSchema: z.object({
@@ -1873,8 +1933,8 @@ var tools = {
1873
1933
  range: z.enum(["24h", "7d", "30d", "90d"]).describe("Time range")
1874
1934
  }),
1875
1935
  execute: async (client, input) => unwrap(await client.pulse.summary({ project_id: input.project_id, range: input.range }))
1876
- },
1877
- devpad_pulse_events: {
1936
+ }),
1937
+ devpad_pulse_events: define_tool({
1878
1938
  name: "devpad_pulse_events",
1879
1939
  description: "List events for a project with optional filtering",
1880
1940
  inputSchema: z.object({
@@ -1888,8 +1948,8 @@ var tools = {
1888
1948
  cursor: z.string().optional().describe("Pagination cursor")
1889
1949
  }),
1890
1950
  execute: async (client, input) => unwrap(await client.pulse.events(input))
1891
- },
1892
- devpad_pulse_errors: {
1951
+ }),
1952
+ devpad_pulse_errors: define_tool({
1893
1953
  name: "devpad_pulse_errors",
1894
1954
  description: "List error issues for a project, optionally grouped by fingerprint",
1895
1955
  inputSchema: z.object({
@@ -1904,8 +1964,8 @@ var tools = {
1904
1964
  group_by_fingerprint: input.group_by_fingerprint
1905
1965
  })
1906
1966
  )
1907
- },
1908
- devpad_pulse_logs: {
1967
+ }),
1968
+ devpad_pulse_logs: define_tool({
1909
1969
  name: "devpad_pulse_logs",
1910
1970
  description: "List logs for a project with optional level and message filtering",
1911
1971
  inputSchema: z.object({
@@ -1915,8 +1975,8 @@ var tools = {
1915
1975
  search: z.string().optional().describe("Search in log messages")
1916
1976
  }),
1917
1977
  execute: async (client, input) => unwrap(await client.pulse.logs(input))
1918
- },
1919
- devpad_pulse_latency: {
1978
+ }),
1979
+ devpad_pulse_latency: define_tool({
1920
1980
  name: "devpad_pulse_latency",
1921
1981
  description: "Get request latency metrics (p50, p95, p99) for a project",
1922
1982
  inputSchema: z.object({
@@ -1926,16 +1986,16 @@ var tools = {
1926
1986
  percentiles: z.array(z.number()).optional().describe("Percentiles to compute (default [50, 95, 99])")
1927
1987
  }),
1928
1988
  execute: async (client, input) => unwrap(await client.pulse.latency(input))
1929
- },
1930
- devpad_alerts_list: {
1989
+ }),
1990
+ devpad_alerts_list: define_tool({
1931
1991
  name: "devpad_alerts_list",
1932
1992
  description: "List notification subscriptions (alerts) for a project",
1933
1993
  inputSchema: z.object({
1934
1994
  project_id: z.string().describe("Project ID")
1935
1995
  }),
1936
1996
  execute: async (client, input) => unwrap(await client.pulse.subs.list(input))
1937
- },
1938
- devpad_alerts_subscribe: {
1997
+ }),
1998
+ devpad_alerts_subscribe: define_tool({
1939
1999
  name: "devpad_alerts_subscribe",
1940
2000
  description: "Create a new notification subscription (alert) for events",
1941
2001
  inputSchema: z.object({
@@ -1946,16 +2006,16 @@ var tools = {
1946
2006
  cooldown_seconds: z.number().optional().describe("Cooldown between notifications (default 60)")
1947
2007
  }),
1948
2008
  execute: async (client, input) => unwrap(await client.pulse.subs.create(input))
1949
- },
1950
- devpad_alerts_unsubscribe: {
2009
+ }),
2010
+ devpad_alerts_unsubscribe: define_tool({
1951
2011
  name: "devpad_alerts_unsubscribe",
1952
2012
  description: "Delete a notification subscription by ID",
1953
2013
  inputSchema: z.object({
1954
2014
  id: z.string().describe("Subscription ID")
1955
2015
  }),
1956
2016
  execute: async (client, input) => unwrap(await client.pulse.subs.delete(input.id))
1957
- },
1958
- devpad_pulse_key_create: {
2017
+ }),
2018
+ devpad_pulse_key_create: define_tool({
1959
2019
  name: "devpad_pulse_key_create",
1960
2020
  description: "Create a new ingest key for a project (returns plaintext once)",
1961
2021
  inputSchema: z.object({
@@ -1964,8 +2024,8 @@ var tools = {
1964
2024
  rate_limit_per_min: z.number().optional().describe("Rate limit in requests per minute (default 600)")
1965
2025
  }),
1966
2026
  execute: async (client, input) => unwrap(await client.pulse.keys.create(input))
1967
- },
1968
- devpad_pipelines_list: {
2027
+ }),
2028
+ devpad_pipelines_list: define_tool({
1969
2029
  name: "devpad_pipelines_list",
1970
2030
  description: "List pipeline runs (newest first). Optionally filter by package and/or status; cap limit at 200.",
1971
2031
  inputSchema: z.object({
@@ -1974,16 +2034,16 @@ var tools = {
1974
2034
  limit: z.number().int().positive().max(200).optional().describe("Max rows to return (default 50, cap 200)")
1975
2035
  }),
1976
2036
  execute: async (client, input) => unwrap(await client.pipelines.list(input))
1977
- },
1978
- devpad_pipelines_get: {
2037
+ }),
2038
+ devpad_pipelines_get: define_tool({
1979
2039
  name: "devpad_pipelines_get",
1980
2040
  description: "Get a pipeline run by ID",
1981
2041
  inputSchema: z.object({
1982
2042
  run_id: z.string().describe("Pipeline run ID")
1983
2043
  }),
1984
2044
  execute: async (client, input) => unwrap(await client.pipelines.get(input.run_id))
1985
- },
1986
- devpad_pipelines_create: {
2045
+ }),
2046
+ devpad_pipelines_create: define_tool({
1987
2047
  name: "devpad_pipelines_create",
1988
2048
  description: "Create a new pipeline run",
1989
2049
  inputSchema: z.object({
@@ -1991,8 +2051,8 @@ var tools = {
1991
2051
  version_set_id: z.string().describe("Version set ID to deploy")
1992
2052
  }),
1993
2053
  execute: async (client, input) => unwrap(await client.pipelines.create(input))
1994
- },
1995
- devpad_pipelines_approve: {
2054
+ }),
2055
+ devpad_pipelines_approve: define_tool({
1996
2056
  name: "devpad_pipelines_approve",
1997
2057
  description: "Approve or deny a stage in a pipeline run",
1998
2058
  inputSchema: z.object({
@@ -2006,8 +2066,8 @@ var tools = {
2006
2066
  unwrap(await client.pipelines.approve(input.run_id, input));
2007
2067
  return { success: true };
2008
2068
  }
2009
- },
2010
- devpad_pipelines_cancel: {
2069
+ }),
2070
+ devpad_pipelines_cancel: define_tool({
2011
2071
  name: "devpad_pipelines_cancel",
2012
2072
  description: "Cancel a pipeline run",
2013
2073
  inputSchema: z.object({
@@ -2017,8 +2077,8 @@ var tools = {
2017
2077
  unwrap(await client.pipelines.cancel(input.run_id));
2018
2078
  return { success: true };
2019
2079
  }
2020
- },
2021
- devpad_pipelines_rollback: {
2080
+ }),
2081
+ devpad_pipelines_rollback: define_tool({
2022
2082
  name: "devpad_pipelines_rollback",
2023
2083
  description: "Rollback a completed or failed pipeline run",
2024
2084
  inputSchema: z.object({
@@ -2028,8 +2088,8 @@ var tools = {
2028
2088
  unwrap(await client.pipelines.rollback(input.run_id));
2029
2089
  return { success: true };
2030
2090
  }
2031
- },
2032
- devpad_pipelines_runs_events_ingest: {
2091
+ }),
2092
+ devpad_pipelines_runs_events_ingest: define_tool({
2033
2093
  name: "devpad_pipelines_runs_events_ingest",
2034
2094
  description: 'Ingest an external webhook event against an in-flight pipeline run. Idempotent on (idempotency_key, payload). Server-side stamps payload.source = "external".',
2035
2095
  inputSchema: z.object({
@@ -2047,24 +2107,24 @@ var tools = {
2047
2107
  idempotency_key: input.idempotency_key
2048
2108
  })
2049
2109
  )
2050
- },
2051
- devpad_pipelines_runs_events_list: {
2110
+ }),
2111
+ devpad_pipelines_runs_events_list: define_tool({
2052
2112
  name: "devpad_pipelines_runs_events_list",
2053
2113
  description: "List stored stage events for a pipeline run, newest-first",
2054
2114
  inputSchema: z.object({
2055
2115
  run_id: z.string().describe("Pipeline run ID")
2056
2116
  }),
2057
2117
  execute: async (client, input) => unwrap(await client.pipelines.events.list(input.run_id))
2058
- },
2059
- devpad_pipelines_grants_list: {
2118
+ }),
2119
+ devpad_pipelines_grants_list: define_tool({
2060
2120
  name: "devpad_pipelines_grants_list",
2061
2121
  description: "List vault grants for a pipeline package",
2062
2122
  inputSchema: z.object({
2063
2123
  package_id: z.string().describe("Package ID to filter grants by")
2064
2124
  }),
2065
2125
  execute: async (client, input) => unwrap(await client.pipelines.grants.list(input.package_id))
2066
- },
2067
- devpad_pipelines_grants_approve: {
2126
+ }),
2127
+ devpad_pipelines_grants_approve: define_tool({
2068
2128
  name: "devpad_pipelines_grants_approve",
2069
2129
  description: "Approve a pending vault grant request for a pipeline package",
2070
2130
  inputSchema: z.object({
@@ -2072,8 +2132,8 @@ var tools = {
2072
2132
  user_id: z.string().describe("User ID making the approval decision")
2073
2133
  }),
2074
2134
  execute: async (client, input) => unwrap(await client.pipelines.grants.approve(input.grant_id, input.user_id))
2075
- },
2076
- devpad_pipelines_grants_deny: {
2135
+ }),
2136
+ devpad_pipelines_grants_deny: define_tool({
2077
2137
  name: "devpad_pipelines_grants_deny",
2078
2138
  description: "Deny a pending vault grant request for a pipeline package",
2079
2139
  inputSchema: z.object({
@@ -2082,24 +2142,24 @@ var tools = {
2082
2142
  reason: z.string().optional().describe("Optional reason for the denial")
2083
2143
  }),
2084
2144
  execute: async (client, input) => unwrap(await client.pipelines.grants.deny(input.grant_id, input.user_id, input.reason))
2085
- },
2086
- devpad_pipelines_packages_list: {
2145
+ }),
2146
+ devpad_pipelines_packages_list: define_tool({
2087
2147
  name: "devpad_pipelines_packages_list",
2088
2148
  description: "List pipeline packages. Optionally filter by linked devpad project_id; unlinked packages have project_id = null.",
2089
2149
  inputSchema: z.object({
2090
2150
  project_id: z.string().optional().describe("Filter packages by linked devpad project")
2091
2151
  }),
2092
2152
  execute: async (client, input) => unwrap(await client.pipelines.packages.list(input))
2093
- },
2094
- devpad_pipelines_packages_get: {
2153
+ }),
2154
+ devpad_pipelines_packages_get: define_tool({
2095
2155
  name: "devpad_pipelines_packages_get",
2096
2156
  description: "Get a pipeline package by ID",
2097
2157
  inputSchema: z.object({
2098
2158
  package_id: z.string().describe("Pipeline package ID")
2099
2159
  }),
2100
2160
  execute: async (client, input) => unwrap(await client.pipelines.packages.get(input.package_id))
2101
- },
2102
- devpad_pipelines_packages_create: {
2161
+ }),
2162
+ devpad_pipelines_packages_create: define_tool({
2103
2163
  name: "devpad_pipelines_packages_create",
2104
2164
  description: "Register a new pipeline-managed package. By convention `id` equals the package `name`. `project_id` optionally links the package to a devpad project.",
2105
2165
  inputSchema: z.object({
@@ -2111,8 +2171,8 @@ var tools = {
2111
2171
  default_template_ref: z.string().optional().describe("Optional default pipeline template ref")
2112
2172
  }),
2113
2173
  execute: async (client, input) => unwrap(await client.pipelines.packages.create(input))
2114
- },
2115
- devpad_pipelines_packages_update: {
2174
+ }),
2175
+ devpad_pipelines_packages_update: define_tool({
2116
2176
  name: "devpad_pipelines_packages_update",
2117
2177
  description: "Partially update a pipeline package. Only the provided fields are touched.",
2118
2178
  inputSchema: z.object({
@@ -2126,24 +2186,24 @@ var tools = {
2126
2186
  const { id, ...patch } = input;
2127
2187
  return unwrap(await client.pipelines.packages.update(id, patch));
2128
2188
  }
2129
- },
2130
- devpad_pipelines_packages_delete: {
2189
+ }),
2190
+ devpad_pipelines_packages_delete: define_tool({
2131
2191
  name: "devpad_pipelines_packages_delete",
2132
2192
  description: "Delete a pipeline package. Refuses with conflict if existing pipeline_run rows still reference the package.",
2133
2193
  inputSchema: z.object({
2134
2194
  id: z.string().describe("Pipeline package ID")
2135
2195
  }),
2136
2196
  execute: async (client, input) => unwrap(await client.pipelines.packages.delete(input.id))
2137
- },
2138
- devpad_pipelines_analysis_templates_list: {
2197
+ }),
2198
+ devpad_pipelines_analysis_templates_list: define_tool({
2139
2199
  name: "devpad_pipelines_analysis_templates_list",
2140
2200
  description: "List pipeline analysis templates for an owner. Each row encodes the threshold DSL + window referenced by analysis-gate evaluations.",
2141
2201
  inputSchema: z.object({
2142
2202
  owner_id: z.string().describe("Devpad user ID whose templates to list")
2143
2203
  }),
2144
2204
  execute: async (client, input) => unwrap(await client.pipelines.analysis_templates.list(input))
2145
- },
2146
- devpad_pipelines_analysis_templates_get: {
2205
+ }),
2206
+ devpad_pipelines_analysis_templates_get: define_tool({
2147
2207
  name: "devpad_pipelines_analysis_templates_get",
2148
2208
  description: "Get a single pipeline analysis template by id, scoped to its owner.",
2149
2209
  inputSchema: z.object({
@@ -2151,8 +2211,8 @@ var tools = {
2151
2211
  owner_id: z.string().describe("Owner ID (must match the template's owner)")
2152
2212
  }),
2153
2213
  execute: async (client, input) => unwrap(await client.pipelines.analysis_templates.get(input.id, { owner_id: input.owner_id }))
2154
- },
2155
- devpad_pipelines_analysis_templates_create: {
2214
+ }),
2215
+ devpad_pipelines_analysis_templates_create: define_tool({
2156
2216
  name: "devpad_pipelines_analysis_templates_create",
2157
2217
  description: 'Create a new pipeline analysis template. `threshold_dsl` is a multi-line DSL: `metric_name OP value [: pending]` (OPs: > < >= <= =). Trailing ": pending" marks a breach as Pending rather than Fail. Server-side parse failure surfaces as `validation_error` with field=threshold_dsl. `window_ms` defaults to 600000 (10 min).',
2158
2218
  inputSchema: z.object({
@@ -2163,8 +2223,8 @@ var tools = {
2163
2223
  window_ms: z.number().int().positive().optional().describe("Analysis window in milliseconds. Default: 600000")
2164
2224
  }),
2165
2225
  execute: async (client, input) => unwrap(await client.pipelines.analysis_templates.create(input))
2166
- },
2167
- devpad_pipelines_analysis_templates_update: {
2226
+ }),
2227
+ devpad_pipelines_analysis_templates_update: define_tool({
2168
2228
  name: "devpad_pipelines_analysis_templates_update",
2169
2229
  description: "Partially update a pipeline analysis template. Only the supplied fields are touched. Re-validates threshold_dsl when present.",
2170
2230
  inputSchema: z.object({
@@ -2179,8 +2239,8 @@ var tools = {
2179
2239
  const { id, ...patch } = input;
2180
2240
  return unwrap(await client.pipelines.analysis_templates.update(id, patch));
2181
2241
  }
2182
- },
2183
- devpad_pipelines_analysis_templates_delete: {
2242
+ }),
2243
+ devpad_pipelines_analysis_templates_delete: define_tool({
2184
2244
  name: "devpad_pipelines_analysis_templates_delete",
2185
2245
  description: "Hard-delete a pipeline analysis template. Does NOT consult pipeline_run.resolved_gates \u2014 runs snapshot their gate template at resolve-time, so deletion never orphans in-flight runs.",
2186
2246
  inputSchema: z.object({
@@ -2188,16 +2248,16 @@ var tools = {
2188
2248
  owner_id: z.string().describe("Owner ID (must match the template's owner)")
2189
2249
  }),
2190
2250
  execute: async (client, input) => unwrap(await client.pipelines.analysis_templates.delete(input.id, { owner_id: input.owner_id }))
2191
- },
2192
- devpad_pipelines_oidc_trust_list: {
2251
+ }),
2252
+ devpad_pipelines_oidc_trust_list: define_tool({
2193
2253
  name: "devpad_pipelines_oidc_trust_list",
2194
2254
  description: "List GitHub Actions OIDC trust policies for an owner. Returned ordered by created_at DESC, id ASC to match the orchestrator's trust-matcher resolution order.",
2195
2255
  inputSchema: z.object({
2196
2256
  owner_id: z.string().describe("User ID whose trust policies to list")
2197
2257
  }),
2198
2258
  execute: async (client, input) => unwrap(await client.pipelines.oidc_trust.list(input))
2199
- },
2200
- devpad_pipelines_oidc_trust_create: {
2259
+ }),
2260
+ devpad_pipelines_oidc_trust_create: define_tool({
2201
2261
  name: "devpad_pipelines_oidc_trust_create",
2202
2262
  description: 'Create a GitHub Actions OIDC trust policy. Authorises CI in repos owned by `github_owner` (filtered by `repo_pattern` and optional ref/environment lists) to mint orchestrator session tokens. Defaults: repo_pattern="*", allowed_actions=["artifacts:upload","runs:start"], session_ttl_seconds=900.',
2203
2263
  inputSchema: z.object({
@@ -2211,8 +2271,8 @@ var tools = {
2211
2271
  session_ttl_seconds: z.number().int().positive().optional().describe("Session token TTL. Default: 900 (15 min)")
2212
2272
  }),
2213
2273
  execute: async (client, input) => unwrap(await client.pipelines.oidc_trust.create(input))
2214
- },
2215
- devpad_pipelines_oidc_trust_update: {
2274
+ }),
2275
+ devpad_pipelines_oidc_trust_update: define_tool({
2216
2276
  name: "devpad_pipelines_oidc_trust_update",
2217
2277
  description: "Partially update a GitHub Actions OIDC trust policy. Only the supplied fields are touched; validation runs server-side against the merged record.",
2218
2278
  inputSchema: z.object({
@@ -2230,8 +2290,8 @@ var tools = {
2230
2290
  const { id, ...patch } = input;
2231
2291
  return unwrap(await client.pipelines.oidc_trust.update(id, patch));
2232
2292
  }
2233
- },
2234
- devpad_pipelines_oidc_trust_delete: {
2293
+ }),
2294
+ devpad_pipelines_oidc_trust_delete: define_tool({
2235
2295
  name: "devpad_pipelines_oidc_trust_delete",
2236
2296
  description: "Soft-delete a GitHub Actions OIDC trust policy. The row is preserved for audit; the matcher and list operations skip soft-deleted rows.",
2237
2297
  inputSchema: z.object({
@@ -2239,7 +2299,7 @@ var tools = {
2239
2299
  owner_id: z.string().describe("Owner ID (must match the policy's owner)")
2240
2300
  }),
2241
2301
  execute: async (client, input) => unwrap(await client.pipelines.oidc_trust.delete(input.id, { owner_id: input.owner_id }))
2242
- }
2302
+ })
2243
2303
  };
2244
2304
  var toolNames = Object.keys(tools);
2245
2305
  function getTool(name) {