@devpad/api 2.2.11 → 2.2.12

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