@devpad/cli 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.
Files changed (2) hide show
  1. package/dist/index.js +897 -589
  2. package/package.json +5 -5
package/dist/index.js CHANGED
@@ -15843,7 +15843,7 @@ var require_emoji_regex = __commonJS((exports, module) => {
15843
15843
  };
15844
15844
  });
15845
15845
 
15846
- // ../api/dist/chunk-UIFZ5MOM.js
15846
+ // ../api/dist/chunk-DIX4XVUQ.js
15847
15847
  init_zod();
15848
15848
  init_drizzle_orm();
15849
15849
  init_sqlite_core();
@@ -16031,16 +16031,12 @@ var tag = sqliteTable("tag", {
16031
16031
  title: text("title").notNull(),
16032
16032
  color: text("color"),
16033
16033
  render: int("render", { mode: "boolean" }).notNull().default(true)
16034
- }, (table3) => ({
16035
- tag_unique: unique("tag_unique").on(table3.owner_id, table3.title)
16036
- }));
16034
+ }, (table3) => [unique("tag_unique").on(table3.owner_id, table3.title)]);
16037
16035
  var task_tag = sqliteTable("task_tag", {
16038
16036
  task_id: text("task_id").notNull().references(() => task.id),
16039
16037
  tag_id: text("tag_id").notNull().references(() => tag.id),
16040
16038
  ...timestamps()
16041
- }, (table3) => ({
16042
- task_tag_unique: primaryKey({ columns: [table3.task_id, table3.tag_id] })
16043
- }));
16039
+ }, (table3) => [primaryKey({ columns: [table3.task_id, table3.tag_id] })]);
16044
16040
  var commit_detail = sqliteTable("commit_detail", {
16045
16041
  sha: text("sha").primaryKey(),
16046
16042
  message: text("message").notNull(),
@@ -16506,8 +16502,203 @@ var dashboard_response = exports_external.object({
16506
16502
  rollback_rate: exports_external.number().min(0).max(1).nullable()
16507
16503
  });
16508
16504
 
16505
+ // ../api/dist/chunk-5L3AUVMM.js
16506
+ init_dist();
16507
+ init_zod();
16508
+ init_dist();
16509
+ init_zod();
16510
+ init_dist();
16511
+ var PostContentSchema = exports_external.object({
16512
+ title: exports_external.string().min(1),
16513
+ content: exports_external.string(),
16514
+ description: exports_external.string().optional(),
16515
+ format: exports_external.enum(["md", "adoc"])
16516
+ });
16517
+ var postsStoreDefinition = define_store("posts", json_codec(PostContentSchema));
16518
+ var VersionInfoSchema = exports_external.object({
16519
+ hash: exports_external.string(),
16520
+ parent: exports_external.string().nullable(),
16521
+ created_at: exports_external.date()
16522
+ });
16523
+ var parsePostContent = PostContentSchema.parse.bind(PostContentSchema);
16524
+ var PostRowSchema = exports_external.object({
16525
+ id: exports_external.number(),
16526
+ uuid: exports_external.string(),
16527
+ author_id: exports_external.string(),
16528
+ slug: exports_external.string(),
16529
+ corpus_version: exports_external.string().nullable(),
16530
+ category: exports_external.string(),
16531
+ archived: exports_external.boolean(),
16532
+ publish_at: exports_external.coerce.date().nullable(),
16533
+ created_at: exports_external.coerce.date(),
16534
+ updated_at: exports_external.coerce.date()
16535
+ });
16536
+ var PostRowInsertSchema = exports_external.object({
16537
+ id: exports_external.number().optional(),
16538
+ uuid: exports_external.string(),
16539
+ author_id: exports_external.string(),
16540
+ slug: exports_external.string(),
16541
+ corpus_version: exports_external.string().nullable().optional(),
16542
+ category: exports_external.string().optional(),
16543
+ archived: exports_external.boolean().optional(),
16544
+ publish_at: exports_external.coerce.date().nullable().optional(),
16545
+ created_at: exports_external.coerce.date().optional(),
16546
+ updated_at: exports_external.coerce.date().optional()
16547
+ });
16548
+ var CategorySchema = exports_external.object({
16549
+ id: exports_external.number(),
16550
+ owner_id: exports_external.string(),
16551
+ name: exports_external.string(),
16552
+ parent: exports_external.string().nullable()
16553
+ });
16554
+ var CategoryInsertSchema = exports_external.object({
16555
+ id: exports_external.number().optional(),
16556
+ owner_id: exports_external.string(),
16557
+ name: exports_external.string(),
16558
+ parent: exports_external.string().nullable().optional()
16559
+ });
16560
+ var TagSchema = exports_external.object({
16561
+ post_id: exports_external.number(),
16562
+ tag: exports_external.string()
16563
+ });
16564
+ var TagInsertSchema = exports_external.object({
16565
+ post_id: exports_external.number(),
16566
+ tag: exports_external.string()
16567
+ });
16568
+ var AccessKeyRowSchema = exports_external.object({
16569
+ id: exports_external.number(),
16570
+ user_id: exports_external.string(),
16571
+ key_hash: exports_external.string(),
16572
+ name: exports_external.string(),
16573
+ note: exports_external.string().nullable(),
16574
+ enabled: exports_external.boolean(),
16575
+ created_at: exports_external.coerce.date()
16576
+ });
16577
+ var AccessKeySchema = AccessKeyRowSchema.omit({ key_hash: true });
16578
+ var AccessKeyInsertSchema = exports_external.object({
16579
+ id: exports_external.number().optional(),
16580
+ user_id: exports_external.string(),
16581
+ key_hash: exports_external.string(),
16582
+ name: exports_external.string(),
16583
+ note: exports_external.string().nullable().optional(),
16584
+ enabled: exports_external.boolean().optional(),
16585
+ created_at: exports_external.coerce.date().optional()
16586
+ });
16587
+ var IntegrationSchema = exports_external.object({
16588
+ id: exports_external.number(),
16589
+ user_id: exports_external.string(),
16590
+ source: exports_external.string(),
16591
+ location: exports_external.string(),
16592
+ data: exports_external.record(exports_external.unknown()).nullable(),
16593
+ last_fetch: exports_external.coerce.date().nullable(),
16594
+ status: exports_external.string().nullable(),
16595
+ created_at: exports_external.coerce.date()
16596
+ });
16597
+ var IntegrationInsertSchema = exports_external.object({
16598
+ id: exports_external.number().optional(),
16599
+ user_id: exports_external.string(),
16600
+ source: exports_external.string(),
16601
+ location: exports_external.string(),
16602
+ data: exports_external.record(exports_external.unknown()).nullable().optional(),
16603
+ last_fetch: exports_external.coerce.date().nullable().optional(),
16604
+ status: exports_external.string().nullable().optional(),
16605
+ created_at: exports_external.coerce.date().optional()
16606
+ });
16607
+ var FetchLinkSchema = exports_external.object({
16608
+ id: exports_external.number(),
16609
+ post_id: exports_external.number(),
16610
+ integration_id: exports_external.number(),
16611
+ identifier: exports_external.string()
16612
+ });
16613
+ var FetchLinkInsertSchema = exports_external.object({
16614
+ id: exports_external.number().optional(),
16615
+ post_id: exports_external.number(),
16616
+ integration_id: exports_external.number(),
16617
+ identifier: exports_external.string()
16618
+ });
16619
+ var PostSchema = exports_external.object({
16620
+ id: exports_external.number(),
16621
+ uuid: exports_external.string().uuid(),
16622
+ author_id: exports_external.string(),
16623
+ slug: exports_external.string(),
16624
+ title: exports_external.string(),
16625
+ content: exports_external.string(),
16626
+ description: exports_external.string().optional(),
16627
+ format: exports_external.enum(["md", "adoc"]),
16628
+ category: exports_external.string(),
16629
+ tags: exports_external.array(exports_external.string()),
16630
+ archived: exports_external.boolean(),
16631
+ publish_at: exports_external.coerce.date().nullable(),
16632
+ created_at: exports_external.coerce.date(),
16633
+ updated_at: exports_external.coerce.date(),
16634
+ project_ids: exports_external.array(exports_external.string()),
16635
+ corpus_version: exports_external.string().nullable()
16636
+ });
16637
+ var SlugPattern = /^[a-z0-9]+(?:-[a-z0-9]+)*$/;
16638
+ var PostCreateSchema = exports_external.object({
16639
+ slug: exports_external.string().regex(SlugPattern, "Slug must be lowercase alphanumeric with hyphens"),
16640
+ title: exports_external.string().min(1),
16641
+ content: exports_external.string(),
16642
+ description: exports_external.string().optional(),
16643
+ format: exports_external.enum(["md", "adoc"]).default("md"),
16644
+ category: exports_external.string().default("root"),
16645
+ tags: exports_external.array(exports_external.string()).default([]),
16646
+ publish_at: exports_external.coerce.date().nullable().optional(),
16647
+ project_ids: exports_external.array(exports_external.string()).optional()
16648
+ });
16649
+ var PostUpdateSchema = exports_external.object({
16650
+ slug: exports_external.string().regex(SlugPattern, "Slug must be lowercase alphanumeric with hyphens").optional(),
16651
+ title: exports_external.string().min(1).optional(),
16652
+ content: exports_external.string().optional(),
16653
+ description: exports_external.string().optional(),
16654
+ format: exports_external.enum(["md", "adoc"]).optional(),
16655
+ category: exports_external.string().optional(),
16656
+ tags: exports_external.array(exports_external.string()).optional(),
16657
+ archived: exports_external.boolean().optional(),
16658
+ publish_at: exports_external.coerce.date().nullable().optional(),
16659
+ project_ids: exports_external.array(exports_external.string()).optional()
16660
+ });
16661
+ var PostListParamsSchema = exports_external.object({
16662
+ category: exports_external.string().optional(),
16663
+ tag: exports_external.string().optional(),
16664
+ project: exports_external.string().optional(),
16665
+ status: exports_external.enum(["published", "scheduled", "draft", "all"]).default("all"),
16666
+ archived: exports_external.boolean().default(false),
16667
+ limit: exports_external.coerce.number().min(1).max(100).default(10),
16668
+ offset: exports_external.coerce.number().min(0).default(0),
16669
+ sort: exports_external.enum(["created", "updated", "published"]).default("updated")
16670
+ });
16671
+ var PostsResponseSchema = exports_external.object({
16672
+ posts: exports_external.array(PostSchema),
16673
+ total_posts: exports_external.number(),
16674
+ total_pages: exports_external.number(),
16675
+ per_page: exports_external.number(),
16676
+ current_page: exports_external.number()
16677
+ });
16678
+ var CategoryCreateSchema = exports_external.object({
16679
+ name: exports_external.string().min(1),
16680
+ parent: exports_external.string().default("root")
16681
+ });
16682
+ var AccessKeyCreateSchema = exports_external.object({
16683
+ name: exports_external.string().min(1),
16684
+ note: exports_external.string().optional()
16685
+ });
16686
+ var AccessKeyUpdateSchema = exports_external.object({
16687
+ name: exports_external.string().min(1).optional(),
16688
+ note: exports_external.string().optional(),
16689
+ enabled: exports_external.boolean().optional()
16690
+ });
16691
+ var IntegrationUpsertSchema = exports_external.object({
16692
+ source: exports_external.string().min(1),
16693
+ location: exports_external.string().min(1),
16694
+ data: exports_external.record(exports_external.unknown()).optional()
16695
+ });
16696
+
16509
16697
  // ../api/dist/index.js
16510
16698
  init_dist();
16699
+ init_dist();
16700
+ init_drizzle_orm();
16701
+ init_sqlite_core();
16511
16702
  init_zod();
16512
16703
  var ApiError = class _ApiError extends Error {
16513
16704
  constructor(message, options = {}) {
@@ -16569,7 +16760,7 @@ async function handleResponseError(response) {
16569
16760
  parsedError = JSON.parse(errorText);
16570
16761
  } catch {}
16571
16762
  if (response.status === HTTP_STATUS.BAD_REQUEST && parsedError?.error?.name === "ZodError") {
16572
- const zodErrorDetails = parsedError.error?.issues ? JSON.stringify(parsedError.error) : errorMessage;
16763
+ const zodErrorDetails = parsedError.error.issues ? JSON.stringify(parsedError.error) : errorMessage;
16573
16764
  throw new ValidationError(zodErrorDetails);
16574
16765
  }
16575
16766
  throw new ApiError(errorMessage, { statusCode: response.status });
@@ -16579,43 +16770,43 @@ function handleNetworkError(error) {
16579
16770
  throw new NetworkError(message);
16580
16771
  }
16581
16772
  var ArrayBufferedQueue = class {
16582
- constructor(_capacity) {
16583
- this._capacity = _capacity;
16584
- this._entries = [];
16585
- this._head = 0;
16586
- this._tail = 0;
16587
- this._size = 0;
16773
+ constructor(capacity) {
16774
+ this.capacity = capacity;
16775
+ this.entries = [];
16776
+ this.head = 0;
16777
+ this.tail = 0;
16778
+ this.count = 0;
16588
16779
  }
16589
16780
  latest() {
16590
- if (this._size === 0)
16781
+ if (this.count === 0)
16591
16782
  return null;
16592
- return this._entries[this._tail - 1] ?? null;
16783
+ return this.entries[this.tail - 1] ?? null;
16593
16784
  }
16594
16785
  list() {
16595
- if (this._size === 0)
16786
+ if (this.count === 0)
16596
16787
  return [];
16597
- if (this._head < this._tail) {
16598
- return this._entries.slice(this._head, this._tail);
16788
+ if (this.head < this.tail) {
16789
+ return this.entries.slice(this.head, this.tail);
16599
16790
  }
16600
- return this._entries.slice(this._head).concat(this._entries.slice(0, this._tail));
16791
+ return this.entries.slice(this.head).concat(this.entries.slice(0, this.tail));
16601
16792
  }
16602
16793
  add(item) {
16603
- if (this._size === this._capacity) {
16604
- this._head = (this._head + 1) % this._capacity;
16794
+ if (this.count === this.capacity) {
16795
+ this.head = (this.head + 1) % this.capacity;
16605
16796
  } else {
16606
- this._size++;
16797
+ this.count++;
16607
16798
  }
16608
- this._entries[this._tail] = item;
16609
- this._tail = (this._tail + 1) % this._capacity;
16799
+ this.entries[this.tail] = item;
16800
+ this.tail = (this.tail + 1) % this.capacity;
16610
16801
  }
16611
16802
  size() {
16612
- return this._size;
16803
+ return this.count;
16613
16804
  }
16614
16805
  clear() {
16615
- this._entries = [];
16616
- this._head = 0;
16617
- this._tail = 0;
16618
- this._size = 0;
16806
+ this.entries = [];
16807
+ this.head = 0;
16808
+ this.tail = 0;
16809
+ this.count = 0;
16619
16810
  }
16620
16811
  };
16621
16812
  var ApiClient = class {
@@ -16648,7 +16839,7 @@ var ApiClient = class {
16648
16839
  return url.toString();
16649
16840
  }
16650
16841
  generateRequestId() {
16651
- return `${Date.now()}-${Math.random().toString(36).substring(2, 11)}`;
16842
+ return `${String(Date.now())}-${Math.random().toString(36).substring(2, 11)}`;
16652
16843
  }
16653
16844
  async request(path, options = {}) {
16654
16845
  const { method = "GET", headers = {}, body, query } = options;
@@ -16699,7 +16890,7 @@ var ApiClient = class {
16699
16890
  if (this.debug) {
16700
16891
  console.log(`[ERROR][${this.category}] ${method} ${path} [${requestId}] failed`, {
16701
16892
  status: response.status,
16702
- duration: `${duration}ms`,
16893
+ duration: `${String(duration)}ms`,
16703
16894
  body,
16704
16895
  query
16705
16896
  });
@@ -16719,21 +16910,21 @@ var ApiClient = class {
16719
16910
  if (response.status === HTTP_STATUS.NO_CONTENT) {
16720
16911
  result = undefined;
16721
16912
  } else {
16722
- const text3 = await response.text();
16723
- if (!text3 || text3.trim() === "" || text3.trim() === "null") {
16913
+ const text22 = await response.text();
16914
+ if (!text22 || text22.trim() === "" || text22.trim() === "null") {
16724
16915
  result = undefined;
16725
16916
  } else {
16726
16917
  try {
16727
- result = JSON.parse(text3);
16728
- } catch (parseError) {
16729
- result = text3;
16918
+ result = JSON.parse(text22);
16919
+ } catch {
16920
+ result = text22;
16730
16921
  }
16731
16922
  }
16732
16923
  }
16733
16924
  if (this.debug) {
16734
16925
  console.log(`[INFO][${this.category}] ${method} ${path} [${requestId}] completed`, {
16735
16926
  status: response.status,
16736
- duration: `${duration}ms`
16927
+ duration: `${String(duration)}ms`
16737
16928
  });
16738
16929
  }
16739
16930
  return result;
@@ -16742,7 +16933,7 @@ var ApiClient = class {
16742
16933
  if (this.debug) {
16743
16934
  console.log(`[ERROR][${this.category}] ${method} ${path} [${requestId}] failed`, {
16744
16935
  url,
16745
- duration: `${duration}ms`,
16936
+ duration: `${String(duration)}ms`,
16746
16937
  error: error instanceof Error ? error.message : String(error),
16747
16938
  body,
16748
16939
  query
@@ -16795,11 +16986,23 @@ var ApiClient = class {
16795
16986
  return headers;
16796
16987
  }
16797
16988
  };
16989
+ var string_field = (value, key) => {
16990
+ if (typeof value !== "object" || value === null || !(key in value))
16991
+ return;
16992
+ const field = value[key];
16993
+ return typeof field === "string" ? field : undefined;
16994
+ };
16995
+ var number_field = (value, key) => {
16996
+ if (typeof value !== "object" || value === null || !(key in value))
16997
+ return;
16998
+ const field = value[key];
16999
+ return typeof field === "number" ? field : undefined;
17000
+ };
16798
17001
  function wrap(fn) {
16799
17002
  return fn().then((data) => ok(data)).catch((error) => err({
16800
- message: error.message || "Unknown error",
16801
- code: error.code,
16802
- status_code: error.statusCode || error.status_code
17003
+ message: error instanceof Error ? error.message : "Unknown error",
17004
+ code: string_field(error, "code"),
17005
+ status_code: number_field(error, "statusCode") ?? number_field(error, "status_code")
16803
17006
  }));
16804
17007
  }
16805
17008
  var ApiClient2 = class {
@@ -16910,7 +17113,7 @@ var ApiClient2 = class {
16910
17113
  find: (id2) => wrap(async () => {
16911
17114
  try {
16912
17115
  return await this.clients.milestones.get(`/milestones/${id2}`);
16913
- } catch (error) {
17116
+ } catch {
16914
17117
  return null;
16915
17118
  }
16916
17119
  }),
@@ -17160,7 +17363,9 @@ var ApiClient2 = class {
17160
17363
  };
17161
17364
  this.user = {
17162
17365
  history: () => wrap(() => this.clients.auth.get("/user/history")),
17163
- preferences: (data) => wrap(() => this.clients.auth.patch("/user/preferences", { body: data }))
17366
+ preferences: (data) => wrap(() => this.clients.auth.patch("/user/preferences", {
17367
+ body: data
17368
+ }))
17164
17369
  };
17165
17370
  this.pulse = {
17166
17371
  summary: (input) => wrap(() => this.clients.pulse.get("/summary/:project_id".replace(":project_id", input.project_id), {
@@ -17182,7 +17387,9 @@ var ApiClient2 = class {
17182
17387
  query.limit = String(input.limit);
17183
17388
  if (input.cursor)
17184
17389
  query.cursor = input.cursor;
17185
- return this.clients.pulse.get("/events/:project_id".replace(":project_id", input.project_id), { query });
17390
+ return this.clients.pulse.get("/events/:project_id".replace(":project_id", input.project_id), {
17391
+ query
17392
+ });
17186
17393
  }),
17187
17394
  errors: (input) => wrap(() => {
17188
17395
  const query = {};
@@ -17194,7 +17401,9 @@ var ApiClient2 = class {
17194
17401
  }
17195
17402
  if (input.group_by_fingerprint)
17196
17403
  query.group_by_fingerprint = "true";
17197
- return this.clients.pulse.get("/errors/:project_id".replace(":project_id", input.project_id), { query });
17404
+ return this.clients.pulse.get("/errors/:project_id".replace(":project_id", input.project_id), {
17405
+ query
17406
+ });
17198
17407
  }),
17199
17408
  logs: (input) => wrap(() => {
17200
17409
  const query = {};
@@ -17222,7 +17431,9 @@ var ApiClient2 = class {
17222
17431
  query.route = input.route;
17223
17432
  if (input.percentiles && input.percentiles.length > 0)
17224
17433
  query.percentiles = input.percentiles.join(",");
17225
- return this.clients.pulse.get("/latency/:project_id".replace(":project_id", input.project_id), { query });
17434
+ return this.clients.pulse.get("/latency/:project_id".replace(":project_id", input.project_id), {
17435
+ query
17436
+ });
17226
17437
  }),
17227
17438
  subs: {
17228
17439
  list: (input) => wrap(() => this.clients.pulse.get("/admin/subs", { query: { project_id: input.project_id } })),
@@ -17334,13 +17545,13 @@ var ApiClient2 = class {
17334
17545
  }
17335
17546
  };
17336
17547
  const base_url = options.base_url || "http://localhost:4321/api/v1";
17337
- this._api_key = options.api_key ?? "";
17338
- this._auth_mode = options.auth_mode ?? (options.api_key?.startsWith("jwt:") ? "session" : options.api_key ? "key" : "cookie");
17548
+ this.api_key_field = options.api_key ?? "";
17549
+ this.auth_mode_field = options.auth_mode ?? (options.api_key?.startsWith("jwt:") ? "session" : options.api_key ? "key" : "cookie");
17339
17550
  const clientOptions = {
17340
17551
  base_url,
17341
17552
  api_key: options.api_key,
17342
17553
  max_history_size: options.max_history_size,
17343
- auth_mode: this._auth_mode,
17554
+ auth_mode: this.auth_mode_field,
17344
17555
  credentials: options.credentials,
17345
17556
  default_headers: options.default_headers,
17346
17557
  custom_fetch: options.custom_fetch
@@ -17369,12 +17580,55 @@ var ApiClient2 = class {
17369
17580
  return this.clients.projects.history();
17370
17581
  }
17371
17582
  getApiKey() {
17372
- return this._api_key;
17583
+ return this.api_key_field;
17373
17584
  }
17374
17585
  getAuthMode() {
17375
- return this._auth_mode;
17586
+ return this.auth_mode_field;
17376
17587
  }
17377
17588
  };
17589
+ var blog_posts = sqliteTable("blog_posts", {
17590
+ id: integer("id").primaryKey({ autoIncrement: true }),
17591
+ uuid: text("uuid").notNull().unique(),
17592
+ author_id: text("author_id").notNull(),
17593
+ slug: text("slug").notNull(),
17594
+ corpus_version: text("corpus_version"),
17595
+ category: text("category").notNull().default("root"),
17596
+ archived: integer("archived", { mode: "boolean" }).notNull().default(false),
17597
+ publish_at: integer("publish_at", { mode: "timestamp" }),
17598
+ created_at: integer("created_at", { mode: "timestamp" }).notNull().default(sql`(unixepoch())`),
17599
+ updated_at: integer("updated_at", { mode: "timestamp" }).notNull().default(sql`(unixepoch())`)
17600
+ }, (table3) => [unique("posts_author_slug_unique").on(table3.author_id, table3.slug)]);
17601
+ var blog_categories = sqliteTable("blog_categories", {
17602
+ id: integer("id").primaryKey({ autoIncrement: true }),
17603
+ owner_id: text("owner_id").notNull(),
17604
+ name: text("name").notNull(),
17605
+ parent: text("parent").default("root")
17606
+ }, (table3) => [unique("categories_owner_name_unique").on(table3.owner_id, table3.name)]);
17607
+ var blog_tags = sqliteTable("blog_tags", {
17608
+ post_id: integer("post_id").notNull().references(() => blog_posts.id, { onDelete: "cascade" }),
17609
+ tag: text("tag").notNull()
17610
+ }, (table3) => [primaryKey({ columns: [table3.post_id, table3.tag] })]);
17611
+ var blog_integrations = sqliteTable("blog_integrations", {
17612
+ id: integer("id").primaryKey({ autoIncrement: true }),
17613
+ user_id: text("user_id").notNull(),
17614
+ source: text("source").notNull(),
17615
+ location: text("location").notNull(),
17616
+ data: text("data", { mode: "json" }).$type(),
17617
+ last_fetch: integer("last_fetch", { mode: "timestamp" }),
17618
+ status: text("status").default("pending"),
17619
+ created_at: integer("created_at", { mode: "timestamp" }).notNull().default(sql`(unixepoch())`)
17620
+ });
17621
+ var blog_fetch_links = sqliteTable("blog_fetch_links", {
17622
+ id: integer("id").primaryKey({ autoIncrement: true }),
17623
+ post_id: integer("post_id").notNull().references(() => blog_posts.id, { onDelete: "cascade" }),
17624
+ integration_id: integer("integration_id").notNull().references(() => blog_integrations.id, { onDelete: "cascade" }),
17625
+ identifier: text("identifier").notNull()
17626
+ }, (table3) => [unique("fetch_links_integration_identifier_unique").on(table3.integration_id, table3.identifier)]);
17627
+ var blog_post_projects = sqliteTable("blog_post_projects", {
17628
+ post_id: integer("post_id").notNull().references(() => blog_posts.id, { onDelete: "cascade" }),
17629
+ project_id: text("project_id").notNull(),
17630
+ created_at: integer("created_at", { mode: "timestamp" }).notNull().default(sql`(unixepoch())`)
17631
+ }, (table3) => [primaryKey({ columns: [table3.post_id, table3.project_id] })]);
17378
17632
  function unwrap2(result) {
17379
17633
  if (!result.ok)
17380
17634
  throw new Error(result.error?.message ?? "Unknown error");
@@ -17409,26 +17663,33 @@ var github_branches = exports_external.object({
17409
17663
  owner: exports_external.string().describe("Repository owner"),
17410
17664
  repo: exports_external.string().describe("Repository name")
17411
17665
  });
17666
+ var define_tool = (def) => def;
17412
17667
  var tools = {
17413
- devpad_projects_list: {
17668
+ devpad_projects_list: define_tool({
17414
17669
  name: "devpad_projects_list",
17415
17670
  description: "List all projects (or only public ones)",
17416
17671
  inputSchema: project_filters,
17417
17672
  execute: async (client, input) => unwrap2(await client.projects.list(input))
17418
- },
17419
- devpad_projects_get: {
17673
+ }),
17674
+ devpad_projects_get: define_tool({
17420
17675
  name: "devpad_projects_get",
17421
17676
  description: "Get project by ID or name",
17422
17677
  inputSchema: project_by_id_or_name,
17423
- execute: async (client, input) => unwrap2(input.id ? await client.projects.getById(input.id) : await client.projects.getByName(input.name))
17424
- },
17425
- devpad_projects_upsert: {
17678
+ execute: async (client, input) => {
17679
+ if (input.id)
17680
+ return unwrap2(await client.projects.getById(input.id));
17681
+ if (!input.name)
17682
+ throw new Error("either id or name must be provided");
17683
+ return unwrap2(await client.projects.getByName(input.name));
17684
+ }
17685
+ }),
17686
+ devpad_projects_upsert: define_tool({
17426
17687
  name: "devpad_projects_upsert",
17427
17688
  description: "Create or update a project (set deleted=true to delete). Returns 409 if entity is protected by user - pass force=true to override.",
17428
17689
  inputSchema: upsert_project,
17429
17690
  execute: async (client, input) => unwrap2(await client.projects.upsert(input))
17430
- },
17431
- devpad_projects_config_save: {
17691
+ }),
17692
+ devpad_projects_config_save: define_tool({
17432
17693
  name: "devpad_projects_config_save",
17433
17694
  description: "Save project configuration",
17434
17695
  inputSchema: save_config_request,
@@ -17436,26 +17697,26 @@ var tools = {
17436
17697
  unwrap2(await client.projects.config.save(input));
17437
17698
  return { success: true };
17438
17699
  }
17439
- },
17440
- devpad_tasks_list: {
17700
+ }),
17701
+ devpad_tasks_list: define_tool({
17441
17702
  name: "devpad_tasks_list",
17442
17703
  description: "List tasks, optionally filtered by project or tag",
17443
17704
  inputSchema: task_filters,
17444
17705
  execute: async (client, input) => unwrap2(await client.tasks.list(input))
17445
- },
17446
- devpad_tasks_get: {
17706
+ }),
17707
+ devpad_tasks_get: define_tool({
17447
17708
  name: "devpad_tasks_get",
17448
17709
  description: "Get task by ID",
17449
17710
  inputSchema: task_by_id,
17450
17711
  execute: async (client, input) => unwrap2(await client.tasks.find(input.id))
17451
- },
17452
- devpad_tasks_upsert: {
17712
+ }),
17713
+ devpad_tasks_upsert: define_tool({
17453
17714
  name: "devpad_tasks_upsert",
17454
17715
  description: "Create or update a task (set deleted=true to delete). Returns 409 if entity is protected by user - pass force=true to override.",
17455
17716
  inputSchema: upsert_todo,
17456
17717
  execute: async (client, input) => unwrap2(await client.tasks.upsert(input))
17457
- },
17458
- devpad_tasks_save_tags: {
17718
+ }),
17719
+ devpad_tasks_save_tags: define_tool({
17459
17720
  name: "devpad_tasks_save_tags",
17460
17721
  description: "Save tags for tasks",
17461
17722
  inputSchema: save_tags_request,
@@ -17463,20 +17724,20 @@ var tools = {
17463
17724
  unwrap2(await client.tasks.saveTags(input));
17464
17725
  return { success: true };
17465
17726
  }
17466
- },
17467
- devpad_milestones_list: {
17727
+ }),
17728
+ devpad_milestones_list: define_tool({
17468
17729
  name: "devpad_milestones_list",
17469
17730
  description: "List milestones for authenticated user or by project",
17470
17731
  inputSchema: milestone_filters,
17471
17732
  execute: async (client, input) => unwrap2(input.project_id ? await client.milestones.getByProject(input.project_id) : await client.milestones.list())
17472
- },
17473
- devpad_milestones_get: {
17733
+ }),
17734
+ devpad_milestones_get: define_tool({
17474
17735
  name: "devpad_milestones_get",
17475
17736
  description: "Get milestone by ID",
17476
17737
  inputSchema: milestone_by_id,
17477
17738
  execute: async (client, input) => unwrap2(await client.milestones.find(input.id))
17478
- },
17479
- devpad_milestones_upsert: {
17739
+ }),
17740
+ devpad_milestones_upsert: define_tool({
17480
17741
  name: "devpad_milestones_upsert",
17481
17742
  description: "Create or update a milestone. Returns 409 if entity is protected by user - pass force=true to override.",
17482
17743
  inputSchema: upsert_milestone,
@@ -17494,20 +17755,20 @@ var tools = {
17494
17755
  target_version: input.target_version,
17495
17756
  finished_at: input.finished_at
17496
17757
  }))
17497
- },
17498
- devpad_goals_list: {
17758
+ }),
17759
+ devpad_goals_list: define_tool({
17499
17760
  name: "devpad_goals_list",
17500
17761
  description: "List goals for authenticated user",
17501
17762
  inputSchema: exports_external.object({}),
17502
17763
  execute: async (client) => unwrap2(await client.goals.list())
17503
- },
17504
- devpad_goals_get: {
17764
+ }),
17765
+ devpad_goals_get: define_tool({
17505
17766
  name: "devpad_goals_get",
17506
17767
  description: "Get goal by ID",
17507
17768
  inputSchema: goal_by_id,
17508
17769
  execute: async (client, input) => unwrap2(await client.goals.find(input.id))
17509
- },
17510
- devpad_goals_upsert: {
17770
+ }),
17771
+ devpad_goals_upsert: define_tool({
17511
17772
  name: "devpad_goals_upsert",
17512
17773
  description: "Create or update a goal. Returns 409 if entity is protected by user - pass force=true to override.",
17513
17774
  inputSchema: upsert_goal,
@@ -17523,26 +17784,26 @@ var tools = {
17523
17784
  target_time: input.target_time,
17524
17785
  finished_at: input.finished_at
17525
17786
  }))
17526
- },
17527
- devpad_tags_list: {
17787
+ }),
17788
+ devpad_tags_list: define_tool({
17528
17789
  name: "devpad_tags_list",
17529
17790
  description: "List tags for authenticated user",
17530
17791
  inputSchema: exports_external.object({}),
17531
17792
  execute: async (client) => unwrap2(await client.tags.list())
17532
- },
17533
- devpad_github_repos: {
17793
+ }),
17794
+ devpad_github_repos: define_tool({
17534
17795
  name: "devpad_github_repos",
17535
17796
  description: "List GitHub repositories for authenticated user",
17536
17797
  inputSchema: exports_external.object({}),
17537
17798
  execute: async (client) => unwrap2(await client.github.repos())
17538
- },
17539
- devpad_github_branches: {
17799
+ }),
17800
+ devpad_github_branches: define_tool({
17540
17801
  name: "devpad_github_branches",
17541
17802
  description: "List branches for a GitHub repository",
17542
17803
  inputSchema: github_branches,
17543
17804
  execute: async (client, input) => unwrap2(await client.github.branches(input.owner, input.repo))
17544
- },
17545
- devpad_projects_delete: {
17805
+ }),
17806
+ devpad_projects_delete: define_tool({
17546
17807
  name: "devpad_projects_delete",
17547
17808
  description: "Delete a project",
17548
17809
  inputSchema: exports_external.object({
@@ -17555,56 +17816,56 @@ var tools = {
17555
17816
  unwrap2(await client.projects.deleteProject(project2));
17556
17817
  return { success: true };
17557
17818
  }
17558
- },
17559
- devpad_projects_history: {
17819
+ }),
17820
+ devpad_projects_history: define_tool({
17560
17821
  name: "devpad_projects_history",
17561
17822
  description: "Get project history",
17562
17823
  inputSchema: exports_external.object({
17563
17824
  project_id: exports_external.string().describe("Project ID")
17564
17825
  }),
17565
17826
  execute: async (client, input) => unwrap2(await client.projects.history(input.project_id))
17566
- },
17567
- devpad_projects_specification: {
17827
+ }),
17828
+ devpad_projects_specification: define_tool({
17568
17829
  name: "devpad_projects_specification",
17569
17830
  description: "Fetch project specification from GitHub",
17570
17831
  inputSchema: exports_external.object({
17571
17832
  project_id: exports_external.string().describe("Project ID")
17572
17833
  }),
17573
17834
  execute: async (client, input) => unwrap2(await client.projects.specification(input.project_id))
17574
- },
17575
- devpad_projects_config_load: {
17835
+ }),
17836
+ devpad_projects_config_load: define_tool({
17576
17837
  name: "devpad_projects_config_load",
17577
17838
  description: "Load project configuration",
17578
17839
  inputSchema: exports_external.object({
17579
17840
  project_id: exports_external.string().describe("Project ID")
17580
17841
  }),
17581
17842
  execute: async (client, input) => unwrap2(await client.projects.config.load(input.project_id))
17582
- },
17583
- devpad_milestones_delete: {
17843
+ }),
17844
+ devpad_milestones_delete: define_tool({
17584
17845
  name: "devpad_milestones_delete",
17585
17846
  description: "Delete a milestone",
17586
17847
  inputSchema: exports_external.object({
17587
17848
  id: exports_external.string().describe("Milestone ID")
17588
17849
  }),
17589
17850
  execute: async (client, input) => unwrap2(await client.milestones.delete(input.id))
17590
- },
17591
- devpad_milestones_goals: {
17851
+ }),
17852
+ devpad_milestones_goals: define_tool({
17592
17853
  name: "devpad_milestones_goals",
17593
17854
  description: "Get goals for a milestone",
17594
17855
  inputSchema: exports_external.object({
17595
17856
  id: exports_external.string().describe("Milestone ID")
17596
17857
  }),
17597
17858
  execute: async (client, input) => unwrap2(await client.milestones.goals(input.id))
17598
- },
17599
- devpad_goals_delete: {
17859
+ }),
17860
+ devpad_goals_delete: define_tool({
17600
17861
  name: "devpad_goals_delete",
17601
17862
  description: "Delete a goal",
17602
17863
  inputSchema: exports_external.object({
17603
17864
  id: exports_external.string().describe("Goal ID")
17604
17865
  }),
17605
17866
  execute: async (client, input) => unwrap2(await client.goals.delete(input.id))
17606
- },
17607
- devpad_tasks_delete: {
17867
+ }),
17868
+ devpad_tasks_delete: define_tool({
17608
17869
  name: "devpad_tasks_delete",
17609
17870
  description: "Delete a task",
17610
17871
  inputSchema: exports_external.object({
@@ -17617,22 +17878,22 @@ var tools = {
17617
17878
  unwrap2(await client.tasks.deleteTask(task2));
17618
17879
  return { success: true };
17619
17880
  }
17620
- },
17621
- devpad_tasks_history: {
17881
+ }),
17882
+ devpad_tasks_history: define_tool({
17622
17883
  name: "devpad_tasks_history",
17623
17884
  description: "Get task history",
17624
17885
  inputSchema: exports_external.object({
17625
17886
  task_id: exports_external.string().describe("Task ID")
17626
17887
  }),
17627
17888
  execute: async (client, input) => unwrap2(await client.tasks.history.get(input.task_id))
17628
- },
17629
- devpad_user_history: {
17889
+ }),
17890
+ devpad_user_history: define_tool({
17630
17891
  name: "devpad_user_history",
17631
17892
  description: "Get user activity history",
17632
17893
  inputSchema: exports_external.object({}),
17633
17894
  execute: async (client) => unwrap2(await client.user.history())
17634
- },
17635
- devpad_user_preferences: {
17895
+ }),
17896
+ devpad_user_preferences: define_tool({
17636
17897
  name: "devpad_user_preferences",
17637
17898
  description: "Update user preferences",
17638
17899
  inputSchema: exports_external.object({
@@ -17640,8 +17901,8 @@ var tools = {
17640
17901
  task_view: exports_external.enum(["list", "grid"]).describe("Task view preference")
17641
17902
  }),
17642
17903
  execute: async (client, input) => unwrap2(await client.user.preferences(input))
17643
- },
17644
- devpad_activity_ai: {
17904
+ }),
17905
+ devpad_activity_ai: define_tool({
17645
17906
  name: "devpad_activity_ai",
17646
17907
  description: "Get AI activity feed - shows recent actions made via API/MCP grouped into sessions by time window",
17647
17908
  inputSchema: exports_external.object({
@@ -17649,104 +17910,69 @@ var tools = {
17649
17910
  since: exports_external.string().optional().describe("Only show activity after this ISO date")
17650
17911
  }),
17651
17912
  execute: async (client, input) => unwrap2(await client.activity.ai(input))
17652
- },
17653
- devpad_blog_posts_list: {
17913
+ }),
17914
+ devpad_blog_posts_list: define_tool({
17654
17915
  name: "devpad_blog_posts_list",
17655
17916
  description: "List blog posts with optional filters",
17656
- inputSchema: exports_external.object({
17657
- category: exports_external.string().optional().describe("Filter by category"),
17658
- tag: exports_external.string().optional().describe("Filter by tag"),
17659
- project: exports_external.string().optional().describe("Filter by project ID"),
17660
- status: exports_external.enum(["draft", "published"]).optional().describe("Filter by status"),
17661
- archived: exports_external.boolean().optional().describe("Filter by archived state"),
17662
- limit: exports_external.number().optional().describe("Max posts to return"),
17663
- offset: exports_external.number().optional().describe("Offset for pagination"),
17664
- sort: exports_external.string().optional().describe("Sort order")
17665
- }),
17917
+ inputSchema: PostListParamsSchema.partial(),
17666
17918
  execute: async (client, input) => unwrap2(await client.blog.posts.list(input))
17667
- },
17668
- devpad_blog_posts_get: {
17919
+ }),
17920
+ devpad_blog_posts_get: define_tool({
17669
17921
  name: "devpad_blog_posts_get",
17670
17922
  description: "Get a blog post by slug",
17671
17923
  inputSchema: exports_external.object({
17672
17924
  slug: exports_external.string().describe("Post slug")
17673
17925
  }),
17674
17926
  execute: async (client, input) => unwrap2(await client.blog.posts.getBySlug(input.slug))
17675
- },
17676
- devpad_blog_posts_create: {
17927
+ }),
17928
+ devpad_blog_posts_create: define_tool({
17677
17929
  name: "devpad_blog_posts_create",
17678
17930
  description: "Create a new blog post",
17679
- inputSchema: exports_external.object({
17680
- title: exports_external.string().describe("Post title"),
17681
- content: exports_external.string().describe("Post content"),
17682
- format: exports_external.enum(["markdown", "html"]).describe("Content format"),
17683
- slug: exports_external.string().optional().describe("Custom slug"),
17684
- category: exports_external.string().optional().describe("Category name"),
17685
- tags: exports_external.array(exports_external.string()).optional().describe("Tag names"),
17686
- description: exports_external.string().optional().describe("Post description"),
17687
- publish_at: exports_external.string().optional().describe("Scheduled publish date (ISO string)"),
17688
- project_ids: exports_external.array(exports_external.string()).optional().describe("Associated project IDs"),
17689
- archived: exports_external.boolean().optional().describe("Whether post is archived")
17690
- }),
17931
+ inputSchema: PostCreateSchema,
17691
17932
  execute: async (client, input) => unwrap2(await client.blog.posts.create(input))
17692
- },
17693
- devpad_blog_posts_update: {
17933
+ }),
17934
+ devpad_blog_posts_update: define_tool({
17694
17935
  name: "devpad_blog_posts_update",
17695
17936
  description: "Update a blog post by UUID",
17696
- inputSchema: exports_external.object({
17697
- uuid: exports_external.string().describe("Post UUID"),
17698
- title: exports_external.string().optional().describe("Post title"),
17699
- content: exports_external.string().optional().describe("Post content"),
17700
- format: exports_external.enum(["markdown", "html"]).optional().describe("Content format"),
17701
- slug: exports_external.string().optional().describe("Custom slug"),
17702
- category: exports_external.string().optional().describe("Category name"),
17703
- tags: exports_external.array(exports_external.string()).optional().describe("Tag names"),
17704
- description: exports_external.string().optional().describe("Post description"),
17705
- publish_at: exports_external.string().optional().describe("Scheduled publish date (ISO string)"),
17706
- project_ids: exports_external.array(exports_external.string()).optional().describe("Associated project IDs"),
17707
- archived: exports_external.boolean().optional().describe("Whether post is archived")
17708
- }),
17937
+ inputSchema: PostUpdateSchema.extend({ uuid: exports_external.string().describe("Post UUID") }),
17709
17938
  execute: async (client, input) => {
17710
17939
  const { uuid, ...data } = input;
17711
17940
  return unwrap2(await client.blog.posts.update(uuid, data));
17712
17941
  }
17713
- },
17714
- devpad_blog_posts_delete: {
17942
+ }),
17943
+ devpad_blog_posts_delete: define_tool({
17715
17944
  name: "devpad_blog_posts_delete",
17716
17945
  description: "Delete a blog post by UUID",
17717
17946
  inputSchema: exports_external.object({
17718
17947
  uuid: exports_external.string().describe("Post UUID")
17719
17948
  }),
17720
17949
  execute: async (client, input) => unwrap2(await client.blog.posts.delete(input.uuid))
17721
- },
17722
- devpad_blog_tags_list: {
17950
+ }),
17951
+ devpad_blog_tags_list: define_tool({
17723
17952
  name: "devpad_blog_tags_list",
17724
17953
  description: "List all blog tags with post counts",
17725
17954
  inputSchema: exports_external.object({}),
17726
17955
  execute: async (client) => unwrap2(await client.blog.tags.list())
17727
- },
17728
- devpad_blog_categories_tree: {
17956
+ }),
17957
+ devpad_blog_categories_tree: define_tool({
17729
17958
  name: "devpad_blog_categories_tree",
17730
17959
  description: "Get the blog category tree",
17731
17960
  inputSchema: exports_external.object({}),
17732
17961
  execute: async (client) => unwrap2(await client.blog.categories.tree())
17733
- },
17734
- devpad_blog_categories_create: {
17962
+ }),
17963
+ devpad_blog_categories_create: define_tool({
17735
17964
  name: "devpad_blog_categories_create",
17736
17965
  description: "Create a blog category",
17737
- inputSchema: exports_external.object({
17738
- name: exports_external.string().describe("Category name"),
17739
- parent: exports_external.string().optional().describe("Parent category name")
17740
- }),
17966
+ inputSchema: CategoryCreateSchema,
17741
17967
  execute: async (client, input) => unwrap2(await client.blog.categories.create(input))
17742
- },
17743
- devpad_blog_tokens_list: {
17968
+ }),
17969
+ devpad_blog_tokens_list: define_tool({
17744
17970
  name: "devpad_blog_tokens_list",
17745
17971
  description: "List blog access tokens",
17746
17972
  inputSchema: exports_external.object({}),
17747
17973
  execute: async (client) => unwrap2(await client.blog.tokens.list())
17748
- },
17749
- devpad_blog_tokens_create: {
17974
+ }),
17975
+ devpad_blog_tokens_create: define_tool({
17750
17976
  name: "devpad_blog_tokens_create",
17751
17977
  description: "Create a blog access token",
17752
17978
  inputSchema: exports_external.object({
@@ -17754,14 +17980,14 @@ var tools = {
17754
17980
  note: exports_external.string().optional().describe("Optional note")
17755
17981
  }),
17756
17982
  execute: async (client, input) => unwrap2(await client.blog.tokens.create(input))
17757
- },
17758
- devpad_media_profiles_list: {
17983
+ }),
17984
+ devpad_media_profiles_list: define_tool({
17759
17985
  name: "devpad_media_profiles_list",
17760
17986
  description: "List media profiles",
17761
17987
  inputSchema: exports_external.object({}),
17762
17988
  execute: async (client) => unwrap2(await client.media.profiles.list())
17763
- },
17764
- devpad_media_profiles_create: {
17989
+ }),
17990
+ devpad_media_profiles_create: define_tool({
17765
17991
  name: "devpad_media_profiles_create",
17766
17992
  description: "Create a media profile",
17767
17993
  inputSchema: exports_external.object({
@@ -17769,16 +17995,16 @@ var tools = {
17769
17995
  slug: exports_external.string().describe("Profile slug")
17770
17996
  }),
17771
17997
  execute: async (client, input) => unwrap2(await client.media.profiles.create(input))
17772
- },
17773
- devpad_media_profiles_get: {
17998
+ }),
17999
+ devpad_media_profiles_get: define_tool({
17774
18000
  name: "devpad_media_profiles_get",
17775
18001
  description: "Get a media profile by ID",
17776
18002
  inputSchema: exports_external.object({
17777
18003
  id: exports_external.string().describe("Profile ID")
17778
18004
  }),
17779
18005
  execute: async (client, input) => unwrap2(await client.media.profiles.get(input.id))
17780
- },
17781
- devpad_media_profiles_update: {
18006
+ }),
18007
+ devpad_media_profiles_update: define_tool({
17782
18008
  name: "devpad_media_profiles_update",
17783
18009
  description: "Update a media profile by ID",
17784
18010
  inputSchema: exports_external.object({
@@ -17790,32 +18016,32 @@ var tools = {
17790
18016
  const { id: id2, ...data } = input;
17791
18017
  return unwrap2(await client.media.profiles.update(id2, data));
17792
18018
  }
17793
- },
17794
- devpad_media_profiles_delete: {
18019
+ }),
18020
+ devpad_media_profiles_delete: define_tool({
17795
18021
  name: "devpad_media_profiles_delete",
17796
18022
  description: "Delete a media profile by ID",
17797
18023
  inputSchema: exports_external.object({
17798
18024
  id: exports_external.string().describe("Profile ID")
17799
18025
  }),
17800
18026
  execute: async (client, input) => unwrap2(await client.media.profiles.delete(input.id))
17801
- },
17802
- devpad_media_connections_list: {
18027
+ }),
18028
+ devpad_media_connections_list: define_tool({
17803
18029
  name: "devpad_media_connections_list",
17804
18030
  description: "List connections for a media profile",
17805
18031
  inputSchema: exports_external.object({
17806
18032
  profile_id: exports_external.string().describe("Profile ID")
17807
18033
  }),
17808
18034
  execute: async (client, input) => unwrap2(await client.media.connections.list(input.profile_id))
17809
- },
17810
- devpad_media_connections_refresh: {
18035
+ }),
18036
+ devpad_media_connections_refresh: define_tool({
17811
18037
  name: "devpad_media_connections_refresh",
17812
18038
  description: "Refresh a media connection",
17813
18039
  inputSchema: exports_external.object({
17814
18040
  account_id: exports_external.string().describe("Account/connection ID")
17815
18041
  }),
17816
18042
  execute: async (client, input) => unwrap2(await client.media.connections.refresh(input.account_id))
17817
- },
17818
- devpad_media_timeline_get: {
18043
+ }),
18044
+ devpad_media_timeline_get: define_tool({
17819
18045
  name: "devpad_media_timeline_get",
17820
18046
  description: "Get media timeline for a user",
17821
18047
  inputSchema: exports_external.object({
@@ -17827,8 +18053,8 @@ var tools = {
17827
18053
  const { user_id, ...params } = input;
17828
18054
  return unwrap2(await client.media.timeline.get(user_id, params));
17829
18055
  }
17830
- },
17831
- devpad_pulse_summary: {
18056
+ }),
18057
+ devpad_pulse_summary: define_tool({
17832
18058
  name: "devpad_pulse_summary",
17833
18059
  description: "Get summary analytics for a project (pageviews, sessions, errors, latency)",
17834
18060
  inputSchema: exports_external.object({
@@ -17836,8 +18062,8 @@ var tools = {
17836
18062
  range: exports_external.enum(["24h", "7d", "30d", "90d"]).describe("Time range")
17837
18063
  }),
17838
18064
  execute: async (client, input) => unwrap2(await client.pulse.summary({ project_id: input.project_id, range: input.range }))
17839
- },
17840
- devpad_pulse_events: {
18065
+ }),
18066
+ devpad_pulse_events: define_tool({
17841
18067
  name: "devpad_pulse_events",
17842
18068
  description: "List events for a project with optional filtering",
17843
18069
  inputSchema: exports_external.object({
@@ -17851,8 +18077,8 @@ var tools = {
17851
18077
  cursor: exports_external.string().optional().describe("Pagination cursor")
17852
18078
  }),
17853
18079
  execute: async (client, input) => unwrap2(await client.pulse.events(input))
17854
- },
17855
- devpad_pulse_errors: {
18080
+ }),
18081
+ devpad_pulse_errors: define_tool({
17856
18082
  name: "devpad_pulse_errors",
17857
18083
  description: "List error issues for a project, optionally grouped by fingerprint",
17858
18084
  inputSchema: exports_external.object({
@@ -17865,8 +18091,8 @@ var tools = {
17865
18091
  range: input.range,
17866
18092
  group_by_fingerprint: input.group_by_fingerprint
17867
18093
  }))
17868
- },
17869
- devpad_pulse_logs: {
18094
+ }),
18095
+ devpad_pulse_logs: define_tool({
17870
18096
  name: "devpad_pulse_logs",
17871
18097
  description: "List logs for a project with optional level and message filtering",
17872
18098
  inputSchema: exports_external.object({
@@ -17876,8 +18102,8 @@ var tools = {
17876
18102
  search: exports_external.string().optional().describe("Search in log messages")
17877
18103
  }),
17878
18104
  execute: async (client, input) => unwrap2(await client.pulse.logs(input))
17879
- },
17880
- devpad_pulse_latency: {
18105
+ }),
18106
+ devpad_pulse_latency: define_tool({
17881
18107
  name: "devpad_pulse_latency",
17882
18108
  description: "Get request latency metrics (p50, p95, p99) for a project",
17883
18109
  inputSchema: exports_external.object({
@@ -17887,16 +18113,16 @@ var tools = {
17887
18113
  percentiles: exports_external.array(exports_external.number()).optional().describe("Percentiles to compute (default [50, 95, 99])")
17888
18114
  }),
17889
18115
  execute: async (client, input) => unwrap2(await client.pulse.latency(input))
17890
- },
17891
- devpad_alerts_list: {
18116
+ }),
18117
+ devpad_alerts_list: define_tool({
17892
18118
  name: "devpad_alerts_list",
17893
18119
  description: "List notification subscriptions (alerts) for a project",
17894
18120
  inputSchema: exports_external.object({
17895
18121
  project_id: exports_external.string().describe("Project ID")
17896
18122
  }),
17897
18123
  execute: async (client, input) => unwrap2(await client.pulse.subs.list(input))
17898
- },
17899
- devpad_alerts_subscribe: {
18124
+ }),
18125
+ devpad_alerts_subscribe: define_tool({
17900
18126
  name: "devpad_alerts_subscribe",
17901
18127
  description: "Create a new notification subscription (alert) for events",
17902
18128
  inputSchema: exports_external.object({
@@ -17907,16 +18133,16 @@ var tools = {
17907
18133
  cooldown_seconds: exports_external.number().optional().describe("Cooldown between notifications (default 60)")
17908
18134
  }),
17909
18135
  execute: async (client, input) => unwrap2(await client.pulse.subs.create(input))
17910
- },
17911
- devpad_alerts_unsubscribe: {
18136
+ }),
18137
+ devpad_alerts_unsubscribe: define_tool({
17912
18138
  name: "devpad_alerts_unsubscribe",
17913
18139
  description: "Delete a notification subscription by ID",
17914
18140
  inputSchema: exports_external.object({
17915
18141
  id: exports_external.string().describe("Subscription ID")
17916
18142
  }),
17917
18143
  execute: async (client, input) => unwrap2(await client.pulse.subs.delete(input.id))
17918
- },
17919
- devpad_pulse_key_create: {
18144
+ }),
18145
+ devpad_pulse_key_create: define_tool({
17920
18146
  name: "devpad_pulse_key_create",
17921
18147
  description: "Create a new ingest key for a project (returns plaintext once)",
17922
18148
  inputSchema: exports_external.object({
@@ -17925,8 +18151,8 @@ var tools = {
17925
18151
  rate_limit_per_min: exports_external.number().optional().describe("Rate limit in requests per minute (default 600)")
17926
18152
  }),
17927
18153
  execute: async (client, input) => unwrap2(await client.pulse.keys.create(input))
17928
- },
17929
- devpad_pipelines_list: {
18154
+ }),
18155
+ devpad_pipelines_list: define_tool({
17930
18156
  name: "devpad_pipelines_list",
17931
18157
  description: "List pipeline runs (newest first). Optionally filter by package and/or status; cap limit at 200.",
17932
18158
  inputSchema: exports_external.object({
@@ -17935,16 +18161,16 @@ var tools = {
17935
18161
  limit: exports_external.number().int().positive().max(200).optional().describe("Max rows to return (default 50, cap 200)")
17936
18162
  }),
17937
18163
  execute: async (client, input) => unwrap2(await client.pipelines.list(input))
17938
- },
17939
- devpad_pipelines_get: {
18164
+ }),
18165
+ devpad_pipelines_get: define_tool({
17940
18166
  name: "devpad_pipelines_get",
17941
18167
  description: "Get a pipeline run by ID",
17942
18168
  inputSchema: exports_external.object({
17943
18169
  run_id: exports_external.string().describe("Pipeline run ID")
17944
18170
  }),
17945
18171
  execute: async (client, input) => unwrap2(await client.pipelines.get(input.run_id))
17946
- },
17947
- devpad_pipelines_create: {
18172
+ }),
18173
+ devpad_pipelines_create: define_tool({
17948
18174
  name: "devpad_pipelines_create",
17949
18175
  description: "Create a new pipeline run",
17950
18176
  inputSchema: exports_external.object({
@@ -17952,8 +18178,8 @@ var tools = {
17952
18178
  version_set_id: exports_external.string().describe("Version set ID to deploy")
17953
18179
  }),
17954
18180
  execute: async (client, input) => unwrap2(await client.pipelines.create(input))
17955
- },
17956
- devpad_pipelines_approve: {
18181
+ }),
18182
+ devpad_pipelines_approve: define_tool({
17957
18183
  name: "devpad_pipelines_approve",
17958
18184
  description: "Approve or deny a stage in a pipeline run",
17959
18185
  inputSchema: exports_external.object({
@@ -17967,8 +18193,8 @@ var tools = {
17967
18193
  unwrap2(await client.pipelines.approve(input.run_id, input));
17968
18194
  return { success: true };
17969
18195
  }
17970
- },
17971
- devpad_pipelines_cancel: {
18196
+ }),
18197
+ devpad_pipelines_cancel: define_tool({
17972
18198
  name: "devpad_pipelines_cancel",
17973
18199
  description: "Cancel a pipeline run",
17974
18200
  inputSchema: exports_external.object({
@@ -17978,8 +18204,8 @@ var tools = {
17978
18204
  unwrap2(await client.pipelines.cancel(input.run_id));
17979
18205
  return { success: true };
17980
18206
  }
17981
- },
17982
- devpad_pipelines_rollback: {
18207
+ }),
18208
+ devpad_pipelines_rollback: define_tool({
17983
18209
  name: "devpad_pipelines_rollback",
17984
18210
  description: "Rollback a completed or failed pipeline run",
17985
18211
  inputSchema: exports_external.object({
@@ -17989,8 +18215,8 @@ var tools = {
17989
18215
  unwrap2(await client.pipelines.rollback(input.run_id));
17990
18216
  return { success: true };
17991
18217
  }
17992
- },
17993
- devpad_pipelines_runs_events_ingest: {
18218
+ }),
18219
+ devpad_pipelines_runs_events_ingest: define_tool({
17994
18220
  name: "devpad_pipelines_runs_events_ingest",
17995
18221
  description: 'Ingest an external webhook event against an in-flight pipeline run. Idempotent on (idempotency_key, payload). Server-side stamps payload.source = "external".',
17996
18222
  inputSchema: exports_external.object({
@@ -18006,24 +18232,24 @@ var tools = {
18006
18232
  payload: input.payload,
18007
18233
  idempotency_key: input.idempotency_key
18008
18234
  }))
18009
- },
18010
- devpad_pipelines_runs_events_list: {
18235
+ }),
18236
+ devpad_pipelines_runs_events_list: define_tool({
18011
18237
  name: "devpad_pipelines_runs_events_list",
18012
18238
  description: "List stored stage events for a pipeline run, newest-first",
18013
18239
  inputSchema: exports_external.object({
18014
18240
  run_id: exports_external.string().describe("Pipeline run ID")
18015
18241
  }),
18016
18242
  execute: async (client, input) => unwrap2(await client.pipelines.events.list(input.run_id))
18017
- },
18018
- devpad_pipelines_grants_list: {
18243
+ }),
18244
+ devpad_pipelines_grants_list: define_tool({
18019
18245
  name: "devpad_pipelines_grants_list",
18020
18246
  description: "List vault grants for a pipeline package",
18021
18247
  inputSchema: exports_external.object({
18022
18248
  package_id: exports_external.string().describe("Package ID to filter grants by")
18023
18249
  }),
18024
18250
  execute: async (client, input) => unwrap2(await client.pipelines.grants.list(input.package_id))
18025
- },
18026
- devpad_pipelines_grants_approve: {
18251
+ }),
18252
+ devpad_pipelines_grants_approve: define_tool({
18027
18253
  name: "devpad_pipelines_grants_approve",
18028
18254
  description: "Approve a pending vault grant request for a pipeline package",
18029
18255
  inputSchema: exports_external.object({
@@ -18031,8 +18257,8 @@ var tools = {
18031
18257
  user_id: exports_external.string().describe("User ID making the approval decision")
18032
18258
  }),
18033
18259
  execute: async (client, input) => unwrap2(await client.pipelines.grants.approve(input.grant_id, input.user_id))
18034
- },
18035
- devpad_pipelines_grants_deny: {
18260
+ }),
18261
+ devpad_pipelines_grants_deny: define_tool({
18036
18262
  name: "devpad_pipelines_grants_deny",
18037
18263
  description: "Deny a pending vault grant request for a pipeline package",
18038
18264
  inputSchema: exports_external.object({
@@ -18041,24 +18267,24 @@ var tools = {
18041
18267
  reason: exports_external.string().optional().describe("Optional reason for the denial")
18042
18268
  }),
18043
18269
  execute: async (client, input) => unwrap2(await client.pipelines.grants.deny(input.grant_id, input.user_id, input.reason))
18044
- },
18045
- devpad_pipelines_packages_list: {
18270
+ }),
18271
+ devpad_pipelines_packages_list: define_tool({
18046
18272
  name: "devpad_pipelines_packages_list",
18047
18273
  description: "List pipeline packages. Optionally filter by linked devpad project_id; unlinked packages have project_id = null.",
18048
18274
  inputSchema: exports_external.object({
18049
18275
  project_id: exports_external.string().optional().describe("Filter packages by linked devpad project")
18050
18276
  }),
18051
18277
  execute: async (client, input) => unwrap2(await client.pipelines.packages.list(input))
18052
- },
18053
- devpad_pipelines_packages_get: {
18278
+ }),
18279
+ devpad_pipelines_packages_get: define_tool({
18054
18280
  name: "devpad_pipelines_packages_get",
18055
18281
  description: "Get a pipeline package by ID",
18056
18282
  inputSchema: exports_external.object({
18057
18283
  package_id: exports_external.string().describe("Pipeline package ID")
18058
18284
  }),
18059
18285
  execute: async (client, input) => unwrap2(await client.pipelines.packages.get(input.package_id))
18060
- },
18061
- devpad_pipelines_packages_create: {
18286
+ }),
18287
+ devpad_pipelines_packages_create: define_tool({
18062
18288
  name: "devpad_pipelines_packages_create",
18063
18289
  description: "Register a new pipeline-managed package. By convention `id` equals the package `name`. `project_id` optionally links the package to a devpad project.",
18064
18290
  inputSchema: exports_external.object({
@@ -18070,8 +18296,8 @@ var tools = {
18070
18296
  default_template_ref: exports_external.string().optional().describe("Optional default pipeline template ref")
18071
18297
  }),
18072
18298
  execute: async (client, input) => unwrap2(await client.pipelines.packages.create(input))
18073
- },
18074
- devpad_pipelines_packages_update: {
18299
+ }),
18300
+ devpad_pipelines_packages_update: define_tool({
18075
18301
  name: "devpad_pipelines_packages_update",
18076
18302
  description: "Partially update a pipeline package. Only the provided fields are touched.",
18077
18303
  inputSchema: exports_external.object({
@@ -18085,24 +18311,24 @@ var tools = {
18085
18311
  const { id: id2, ...patch } = input;
18086
18312
  return unwrap2(await client.pipelines.packages.update(id2, patch));
18087
18313
  }
18088
- },
18089
- devpad_pipelines_packages_delete: {
18314
+ }),
18315
+ devpad_pipelines_packages_delete: define_tool({
18090
18316
  name: "devpad_pipelines_packages_delete",
18091
18317
  description: "Delete a pipeline package. Refuses with conflict if existing pipeline_run rows still reference the package.",
18092
18318
  inputSchema: exports_external.object({
18093
18319
  id: exports_external.string().describe("Pipeline package ID")
18094
18320
  }),
18095
18321
  execute: async (client, input) => unwrap2(await client.pipelines.packages.delete(input.id))
18096
- },
18097
- devpad_pipelines_analysis_templates_list: {
18322
+ }),
18323
+ devpad_pipelines_analysis_templates_list: define_tool({
18098
18324
  name: "devpad_pipelines_analysis_templates_list",
18099
18325
  description: "List pipeline analysis templates for an owner. Each row encodes the threshold DSL + window referenced by analysis-gate evaluations.",
18100
18326
  inputSchema: exports_external.object({
18101
18327
  owner_id: exports_external.string().describe("Devpad user ID whose templates to list")
18102
18328
  }),
18103
18329
  execute: async (client, input) => unwrap2(await client.pipelines.analysis_templates.list(input))
18104
- },
18105
- devpad_pipelines_analysis_templates_get: {
18330
+ }),
18331
+ devpad_pipelines_analysis_templates_get: define_tool({
18106
18332
  name: "devpad_pipelines_analysis_templates_get",
18107
18333
  description: "Get a single pipeline analysis template by id, scoped to its owner.",
18108
18334
  inputSchema: exports_external.object({
@@ -18110,8 +18336,8 @@ var tools = {
18110
18336
  owner_id: exports_external.string().describe("Owner ID (must match the template's owner)")
18111
18337
  }),
18112
18338
  execute: async (client, input) => unwrap2(await client.pipelines.analysis_templates.get(input.id, { owner_id: input.owner_id }))
18113
- },
18114
- devpad_pipelines_analysis_templates_create: {
18339
+ }),
18340
+ devpad_pipelines_analysis_templates_create: define_tool({
18115
18341
  name: "devpad_pipelines_analysis_templates_create",
18116
18342
  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).',
18117
18343
  inputSchema: exports_external.object({
@@ -18122,8 +18348,8 @@ var tools = {
18122
18348
  window_ms: exports_external.number().int().positive().optional().describe("Analysis window in milliseconds. Default: 600000")
18123
18349
  }),
18124
18350
  execute: async (client, input) => unwrap2(await client.pipelines.analysis_templates.create(input))
18125
- },
18126
- devpad_pipelines_analysis_templates_update: {
18351
+ }),
18352
+ devpad_pipelines_analysis_templates_update: define_tool({
18127
18353
  name: "devpad_pipelines_analysis_templates_update",
18128
18354
  description: "Partially update a pipeline analysis template. Only the supplied fields are touched. Re-validates threshold_dsl when present.",
18129
18355
  inputSchema: exports_external.object({
@@ -18138,8 +18364,8 @@ var tools = {
18138
18364
  const { id: id2, ...patch } = input;
18139
18365
  return unwrap2(await client.pipelines.analysis_templates.update(id2, patch));
18140
18366
  }
18141
- },
18142
- devpad_pipelines_analysis_templates_delete: {
18367
+ }),
18368
+ devpad_pipelines_analysis_templates_delete: define_tool({
18143
18369
  name: "devpad_pipelines_analysis_templates_delete",
18144
18370
  description: "Hard-delete a pipeline analysis template. Does NOT consult pipeline_run.resolved_gates — runs snapshot their gate template at resolve-time, so deletion never orphans in-flight runs.",
18145
18371
  inputSchema: exports_external.object({
@@ -18147,16 +18373,16 @@ var tools = {
18147
18373
  owner_id: exports_external.string().describe("Owner ID (must match the template's owner)")
18148
18374
  }),
18149
18375
  execute: async (client, input) => unwrap2(await client.pipelines.analysis_templates.delete(input.id, { owner_id: input.owner_id }))
18150
- },
18151
- devpad_pipelines_oidc_trust_list: {
18376
+ }),
18377
+ devpad_pipelines_oidc_trust_list: define_tool({
18152
18378
  name: "devpad_pipelines_oidc_trust_list",
18153
18379
  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.",
18154
18380
  inputSchema: exports_external.object({
18155
18381
  owner_id: exports_external.string().describe("User ID whose trust policies to list")
18156
18382
  }),
18157
18383
  execute: async (client, input) => unwrap2(await client.pipelines.oidc_trust.list(input))
18158
- },
18159
- devpad_pipelines_oidc_trust_create: {
18384
+ }),
18385
+ devpad_pipelines_oidc_trust_create: define_tool({
18160
18386
  name: "devpad_pipelines_oidc_trust_create",
18161
18387
  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.',
18162
18388
  inputSchema: exports_external.object({
@@ -18170,8 +18396,8 @@ var tools = {
18170
18396
  session_ttl_seconds: exports_external.number().int().positive().optional().describe("Session token TTL. Default: 900 (15 min)")
18171
18397
  }),
18172
18398
  execute: async (client, input) => unwrap2(await client.pipelines.oidc_trust.create(input))
18173
- },
18174
- devpad_pipelines_oidc_trust_update: {
18399
+ }),
18400
+ devpad_pipelines_oidc_trust_update: define_tool({
18175
18401
  name: "devpad_pipelines_oidc_trust_update",
18176
18402
  description: "Partially update a GitHub Actions OIDC trust policy. Only the supplied fields are touched; validation runs server-side against the merged record.",
18177
18403
  inputSchema: exports_external.object({
@@ -18189,8 +18415,8 @@ var tools = {
18189
18415
  const { id: id2, ...patch } = input;
18190
18416
  return unwrap2(await client.pipelines.oidc_trust.update(id2, patch));
18191
18417
  }
18192
- },
18193
- devpad_pipelines_oidc_trust_delete: {
18418
+ }),
18419
+ devpad_pipelines_oidc_trust_delete: define_tool({
18194
18420
  name: "devpad_pipelines_oidc_trust_delete",
18195
18421
  description: "Soft-delete a GitHub Actions OIDC trust policy. The row is preserved for audit; the matcher and list operations skip soft-deleted rows.",
18196
18422
  inputSchema: exports_external.object({
@@ -18198,7 +18424,7 @@ var tools = {
18198
18424
  owner_id: exports_external.string().describe("Owner ID (must match the policy's owner)")
18199
18425
  }),
18200
18426
  execute: async (client, input) => unwrap2(await client.pipelines.oidc_trust.delete(input.id, { owner_id: input.owner_id }))
18201
- }
18427
+ })
18202
18428
  };
18203
18429
  var toolNames = Object.keys(tools);
18204
18430
  function getTool(name) {
@@ -18720,6 +18946,9 @@ import { createInterface } from "node:readline/promises";
18720
18946
 
18721
18947
  // ../api/dist/index.js
18722
18948
  init_dist();
18949
+ init_dist();
18950
+ init_drizzle_orm();
18951
+ init_sqlite_core();
18723
18952
  init_zod();
18724
18953
  var ApiError2 = class _ApiError2 extends Error {
18725
18954
  constructor(message, options = {}) {
@@ -18781,7 +19010,7 @@ async function handleResponseError2(response) {
18781
19010
  parsedError = JSON.parse(errorText);
18782
19011
  } catch {}
18783
19012
  if (response.status === HTTP_STATUS2.BAD_REQUEST && parsedError?.error?.name === "ZodError") {
18784
- const zodErrorDetails = parsedError.error?.issues ? JSON.stringify(parsedError.error) : errorMessage;
19013
+ const zodErrorDetails = parsedError.error.issues ? JSON.stringify(parsedError.error) : errorMessage;
18785
19014
  throw new ValidationError2(zodErrorDetails);
18786
19015
  }
18787
19016
  throw new ApiError2(errorMessage, { statusCode: response.status });
@@ -18791,43 +19020,43 @@ function handleNetworkError2(error) {
18791
19020
  throw new NetworkError2(message);
18792
19021
  }
18793
19022
  var ArrayBufferedQueue2 = class {
18794
- constructor(_capacity) {
18795
- this._capacity = _capacity;
18796
- this._entries = [];
18797
- this._head = 0;
18798
- this._tail = 0;
18799
- this._size = 0;
19023
+ constructor(capacity) {
19024
+ this.capacity = capacity;
19025
+ this.entries = [];
19026
+ this.head = 0;
19027
+ this.tail = 0;
19028
+ this.count = 0;
18800
19029
  }
18801
19030
  latest() {
18802
- if (this._size === 0)
19031
+ if (this.count === 0)
18803
19032
  return null;
18804
- return this._entries[this._tail - 1] ?? null;
19033
+ return this.entries[this.tail - 1] ?? null;
18805
19034
  }
18806
19035
  list() {
18807
- if (this._size === 0)
19036
+ if (this.count === 0)
18808
19037
  return [];
18809
- if (this._head < this._tail) {
18810
- return this._entries.slice(this._head, this._tail);
19038
+ if (this.head < this.tail) {
19039
+ return this.entries.slice(this.head, this.tail);
18811
19040
  }
18812
- return this._entries.slice(this._head).concat(this._entries.slice(0, this._tail));
19041
+ return this.entries.slice(this.head).concat(this.entries.slice(0, this.tail));
18813
19042
  }
18814
19043
  add(item) {
18815
- if (this._size === this._capacity) {
18816
- this._head = (this._head + 1) % this._capacity;
19044
+ if (this.count === this.capacity) {
19045
+ this.head = (this.head + 1) % this.capacity;
18817
19046
  } else {
18818
- this._size++;
19047
+ this.count++;
18819
19048
  }
18820
- this._entries[this._tail] = item;
18821
- this._tail = (this._tail + 1) % this._capacity;
19049
+ this.entries[this.tail] = item;
19050
+ this.tail = (this.tail + 1) % this.capacity;
18822
19051
  }
18823
19052
  size() {
18824
- return this._size;
19053
+ return this.count;
18825
19054
  }
18826
19055
  clear() {
18827
- this._entries = [];
18828
- this._head = 0;
18829
- this._tail = 0;
18830
- this._size = 0;
19056
+ this.entries = [];
19057
+ this.head = 0;
19058
+ this.tail = 0;
19059
+ this.count = 0;
18831
19060
  }
18832
19061
  };
18833
19062
  var ApiClient3 = class {
@@ -18860,7 +19089,7 @@ var ApiClient3 = class {
18860
19089
  return url.toString();
18861
19090
  }
18862
19091
  generateRequestId() {
18863
- return `${Date.now()}-${Math.random().toString(36).substring(2, 11)}`;
19092
+ return `${String(Date.now())}-${Math.random().toString(36).substring(2, 11)}`;
18864
19093
  }
18865
19094
  async request(path, options = {}) {
18866
19095
  const { method = "GET", headers = {}, body, query } = options;
@@ -18911,7 +19140,7 @@ var ApiClient3 = class {
18911
19140
  if (this.debug) {
18912
19141
  console.log(`[ERROR][${this.category}] ${method} ${path} [${requestId}] failed`, {
18913
19142
  status: response.status,
18914
- duration: `${duration}ms`,
19143
+ duration: `${String(duration)}ms`,
18915
19144
  body,
18916
19145
  query
18917
19146
  });
@@ -18931,21 +19160,21 @@ var ApiClient3 = class {
18931
19160
  if (response.status === HTTP_STATUS2.NO_CONTENT) {
18932
19161
  result = undefined;
18933
19162
  } else {
18934
- const text3 = await response.text();
18935
- if (!text3 || text3.trim() === "" || text3.trim() === "null") {
19163
+ const text22 = await response.text();
19164
+ if (!text22 || text22.trim() === "" || text22.trim() === "null") {
18936
19165
  result = undefined;
18937
19166
  } else {
18938
19167
  try {
18939
- result = JSON.parse(text3);
18940
- } catch (parseError) {
18941
- result = text3;
19168
+ result = JSON.parse(text22);
19169
+ } catch {
19170
+ result = text22;
18942
19171
  }
18943
19172
  }
18944
19173
  }
18945
19174
  if (this.debug) {
18946
19175
  console.log(`[INFO][${this.category}] ${method} ${path} [${requestId}] completed`, {
18947
19176
  status: response.status,
18948
- duration: `${duration}ms`
19177
+ duration: `${String(duration)}ms`
18949
19178
  });
18950
19179
  }
18951
19180
  return result;
@@ -18954,7 +19183,7 @@ var ApiClient3 = class {
18954
19183
  if (this.debug) {
18955
19184
  console.log(`[ERROR][${this.category}] ${method} ${path} [${requestId}] failed`, {
18956
19185
  url,
18957
- duration: `${duration}ms`,
19186
+ duration: `${String(duration)}ms`,
18958
19187
  error: error instanceof Error ? error.message : String(error),
18959
19188
  body,
18960
19189
  query
@@ -19007,11 +19236,23 @@ var ApiClient3 = class {
19007
19236
  return headers;
19008
19237
  }
19009
19238
  };
19239
+ var string_field2 = (value, key) => {
19240
+ if (typeof value !== "object" || value === null || !(key in value))
19241
+ return;
19242
+ const field = value[key];
19243
+ return typeof field === "string" ? field : undefined;
19244
+ };
19245
+ var number_field2 = (value, key) => {
19246
+ if (typeof value !== "object" || value === null || !(key in value))
19247
+ return;
19248
+ const field = value[key];
19249
+ return typeof field === "number" ? field : undefined;
19250
+ };
19010
19251
  function wrap2(fn) {
19011
19252
  return fn().then((data) => ok(data)).catch((error) => err({
19012
- message: error.message || "Unknown error",
19013
- code: error.code,
19014
- status_code: error.statusCode || error.status_code
19253
+ message: error instanceof Error ? error.message : "Unknown error",
19254
+ code: string_field2(error, "code"),
19255
+ status_code: number_field2(error, "statusCode") ?? number_field2(error, "status_code")
19015
19256
  }));
19016
19257
  }
19017
19258
  var ApiClient22 = class {
@@ -19122,7 +19363,7 @@ var ApiClient22 = class {
19122
19363
  find: (id2) => wrap2(async () => {
19123
19364
  try {
19124
19365
  return await this.clients.milestones.get(`/milestones/${id2}`);
19125
- } catch (error) {
19366
+ } catch {
19126
19367
  return null;
19127
19368
  }
19128
19369
  }),
@@ -19372,7 +19613,9 @@ var ApiClient22 = class {
19372
19613
  };
19373
19614
  this.user = {
19374
19615
  history: () => wrap2(() => this.clients.auth.get("/user/history")),
19375
- preferences: (data) => wrap2(() => this.clients.auth.patch("/user/preferences", { body: data }))
19616
+ preferences: (data) => wrap2(() => this.clients.auth.patch("/user/preferences", {
19617
+ body: data
19618
+ }))
19376
19619
  };
19377
19620
  this.pulse = {
19378
19621
  summary: (input) => wrap2(() => this.clients.pulse.get("/summary/:project_id".replace(":project_id", input.project_id), {
@@ -19394,7 +19637,9 @@ var ApiClient22 = class {
19394
19637
  query.limit = String(input.limit);
19395
19638
  if (input.cursor)
19396
19639
  query.cursor = input.cursor;
19397
- return this.clients.pulse.get("/events/:project_id".replace(":project_id", input.project_id), { query });
19640
+ return this.clients.pulse.get("/events/:project_id".replace(":project_id", input.project_id), {
19641
+ query
19642
+ });
19398
19643
  }),
19399
19644
  errors: (input) => wrap2(() => {
19400
19645
  const query = {};
@@ -19406,7 +19651,9 @@ var ApiClient22 = class {
19406
19651
  }
19407
19652
  if (input.group_by_fingerprint)
19408
19653
  query.group_by_fingerprint = "true";
19409
- return this.clients.pulse.get("/errors/:project_id".replace(":project_id", input.project_id), { query });
19654
+ return this.clients.pulse.get("/errors/:project_id".replace(":project_id", input.project_id), {
19655
+ query
19656
+ });
19410
19657
  }),
19411
19658
  logs: (input) => wrap2(() => {
19412
19659
  const query = {};
@@ -19434,7 +19681,9 @@ var ApiClient22 = class {
19434
19681
  query.route = input.route;
19435
19682
  if (input.percentiles && input.percentiles.length > 0)
19436
19683
  query.percentiles = input.percentiles.join(",");
19437
- return this.clients.pulse.get("/latency/:project_id".replace(":project_id", input.project_id), { query });
19684
+ return this.clients.pulse.get("/latency/:project_id".replace(":project_id", input.project_id), {
19685
+ query
19686
+ });
19438
19687
  }),
19439
19688
  subs: {
19440
19689
  list: (input) => wrap2(() => this.clients.pulse.get("/admin/subs", { query: { project_id: input.project_id } })),
@@ -19546,13 +19795,13 @@ var ApiClient22 = class {
19546
19795
  }
19547
19796
  };
19548
19797
  const base_url = options.base_url || "http://localhost:4321/api/v1";
19549
- this._api_key = options.api_key ?? "";
19550
- this._auth_mode = options.auth_mode ?? (options.api_key?.startsWith("jwt:") ? "session" : options.api_key ? "key" : "cookie");
19798
+ this.api_key_field = options.api_key ?? "";
19799
+ this.auth_mode_field = options.auth_mode ?? (options.api_key?.startsWith("jwt:") ? "session" : options.api_key ? "key" : "cookie");
19551
19800
  const clientOptions = {
19552
19801
  base_url,
19553
19802
  api_key: options.api_key,
19554
19803
  max_history_size: options.max_history_size,
19555
- auth_mode: this._auth_mode,
19804
+ auth_mode: this.auth_mode_field,
19556
19805
  credentials: options.credentials,
19557
19806
  default_headers: options.default_headers,
19558
19807
  custom_fetch: options.custom_fetch
@@ -19581,12 +19830,55 @@ var ApiClient22 = class {
19581
19830
  return this.clients.projects.history();
19582
19831
  }
19583
19832
  getApiKey() {
19584
- return this._api_key;
19833
+ return this.api_key_field;
19585
19834
  }
19586
19835
  getAuthMode() {
19587
- return this._auth_mode;
19836
+ return this.auth_mode_field;
19588
19837
  }
19589
19838
  };
19839
+ var blog_posts2 = sqliteTable("blog_posts", {
19840
+ id: integer("id").primaryKey({ autoIncrement: true }),
19841
+ uuid: text("uuid").notNull().unique(),
19842
+ author_id: text("author_id").notNull(),
19843
+ slug: text("slug").notNull(),
19844
+ corpus_version: text("corpus_version"),
19845
+ category: text("category").notNull().default("root"),
19846
+ archived: integer("archived", { mode: "boolean" }).notNull().default(false),
19847
+ publish_at: integer("publish_at", { mode: "timestamp" }),
19848
+ created_at: integer("created_at", { mode: "timestamp" }).notNull().default(sql`(unixepoch())`),
19849
+ updated_at: integer("updated_at", { mode: "timestamp" }).notNull().default(sql`(unixepoch())`)
19850
+ }, (table3) => [unique("posts_author_slug_unique").on(table3.author_id, table3.slug)]);
19851
+ var blog_categories2 = sqliteTable("blog_categories", {
19852
+ id: integer("id").primaryKey({ autoIncrement: true }),
19853
+ owner_id: text("owner_id").notNull(),
19854
+ name: text("name").notNull(),
19855
+ parent: text("parent").default("root")
19856
+ }, (table3) => [unique("categories_owner_name_unique").on(table3.owner_id, table3.name)]);
19857
+ var blog_tags2 = sqliteTable("blog_tags", {
19858
+ post_id: integer("post_id").notNull().references(() => blog_posts2.id, { onDelete: "cascade" }),
19859
+ tag: text("tag").notNull()
19860
+ }, (table3) => [primaryKey({ columns: [table3.post_id, table3.tag] })]);
19861
+ var blog_integrations2 = sqliteTable("blog_integrations", {
19862
+ id: integer("id").primaryKey({ autoIncrement: true }),
19863
+ user_id: text("user_id").notNull(),
19864
+ source: text("source").notNull(),
19865
+ location: text("location").notNull(),
19866
+ data: text("data", { mode: "json" }).$type(),
19867
+ last_fetch: integer("last_fetch", { mode: "timestamp" }),
19868
+ status: text("status").default("pending"),
19869
+ created_at: integer("created_at", { mode: "timestamp" }).notNull().default(sql`(unixepoch())`)
19870
+ });
19871
+ var blog_fetch_links2 = sqliteTable("blog_fetch_links", {
19872
+ id: integer("id").primaryKey({ autoIncrement: true }),
19873
+ post_id: integer("post_id").notNull().references(() => blog_posts2.id, { onDelete: "cascade" }),
19874
+ integration_id: integer("integration_id").notNull().references(() => blog_integrations2.id, { onDelete: "cascade" }),
19875
+ identifier: text("identifier").notNull()
19876
+ }, (table3) => [unique("fetch_links_integration_identifier_unique").on(table3.integration_id, table3.identifier)]);
19877
+ var blog_post_projects2 = sqliteTable("blog_post_projects", {
19878
+ post_id: integer("post_id").notNull().references(() => blog_posts2.id, { onDelete: "cascade" }),
19879
+ project_id: text("project_id").notNull(),
19880
+ created_at: integer("created_at", { mode: "timestamp" }).notNull().default(sql`(unixepoch())`)
19881
+ }, (table3) => [primaryKey({ columns: [table3.post_id, table3.project_id] })]);
19590
19882
  function unwrap3(result) {
19591
19883
  if (!result.ok)
19592
19884
  throw new Error(result.error?.message ?? "Unknown error");
@@ -19621,26 +19913,33 @@ var github_branches2 = exports_external.object({
19621
19913
  owner: exports_external.string().describe("Repository owner"),
19622
19914
  repo: exports_external.string().describe("Repository name")
19623
19915
  });
19916
+ var define_tool2 = (def) => def;
19624
19917
  var tools2 = {
19625
- devpad_projects_list: {
19918
+ devpad_projects_list: define_tool2({
19626
19919
  name: "devpad_projects_list",
19627
19920
  description: "List all projects (or only public ones)",
19628
19921
  inputSchema: project_filters2,
19629
19922
  execute: async (client, input) => unwrap3(await client.projects.list(input))
19630
- },
19631
- devpad_projects_get: {
19923
+ }),
19924
+ devpad_projects_get: define_tool2({
19632
19925
  name: "devpad_projects_get",
19633
19926
  description: "Get project by ID or name",
19634
19927
  inputSchema: project_by_id_or_name2,
19635
- execute: async (client, input) => unwrap3(input.id ? await client.projects.getById(input.id) : await client.projects.getByName(input.name))
19636
- },
19637
- devpad_projects_upsert: {
19928
+ execute: async (client, input) => {
19929
+ if (input.id)
19930
+ return unwrap3(await client.projects.getById(input.id));
19931
+ if (!input.name)
19932
+ throw new Error("either id or name must be provided");
19933
+ return unwrap3(await client.projects.getByName(input.name));
19934
+ }
19935
+ }),
19936
+ devpad_projects_upsert: define_tool2({
19638
19937
  name: "devpad_projects_upsert",
19639
19938
  description: "Create or update a project (set deleted=true to delete). Returns 409 if entity is protected by user - pass force=true to override.",
19640
19939
  inputSchema: upsert_project,
19641
19940
  execute: async (client, input) => unwrap3(await client.projects.upsert(input))
19642
- },
19643
- devpad_projects_config_save: {
19941
+ }),
19942
+ devpad_projects_config_save: define_tool2({
19644
19943
  name: "devpad_projects_config_save",
19645
19944
  description: "Save project configuration",
19646
19945
  inputSchema: save_config_request,
@@ -19648,26 +19947,26 @@ var tools2 = {
19648
19947
  unwrap3(await client.projects.config.save(input));
19649
19948
  return { success: true };
19650
19949
  }
19651
- },
19652
- devpad_tasks_list: {
19950
+ }),
19951
+ devpad_tasks_list: define_tool2({
19653
19952
  name: "devpad_tasks_list",
19654
19953
  description: "List tasks, optionally filtered by project or tag",
19655
19954
  inputSchema: task_filters2,
19656
19955
  execute: async (client, input) => unwrap3(await client.tasks.list(input))
19657
- },
19658
- devpad_tasks_get: {
19956
+ }),
19957
+ devpad_tasks_get: define_tool2({
19659
19958
  name: "devpad_tasks_get",
19660
19959
  description: "Get task by ID",
19661
19960
  inputSchema: task_by_id2,
19662
19961
  execute: async (client, input) => unwrap3(await client.tasks.find(input.id))
19663
- },
19664
- devpad_tasks_upsert: {
19962
+ }),
19963
+ devpad_tasks_upsert: define_tool2({
19665
19964
  name: "devpad_tasks_upsert",
19666
19965
  description: "Create or update a task (set deleted=true to delete). Returns 409 if entity is protected by user - pass force=true to override.",
19667
19966
  inputSchema: upsert_todo,
19668
19967
  execute: async (client, input) => unwrap3(await client.tasks.upsert(input))
19669
- },
19670
- devpad_tasks_save_tags: {
19968
+ }),
19969
+ devpad_tasks_save_tags: define_tool2({
19671
19970
  name: "devpad_tasks_save_tags",
19672
19971
  description: "Save tags for tasks",
19673
19972
  inputSchema: save_tags_request,
@@ -19675,20 +19974,20 @@ var tools2 = {
19675
19974
  unwrap3(await client.tasks.saveTags(input));
19676
19975
  return { success: true };
19677
19976
  }
19678
- },
19679
- devpad_milestones_list: {
19977
+ }),
19978
+ devpad_milestones_list: define_tool2({
19680
19979
  name: "devpad_milestones_list",
19681
19980
  description: "List milestones for authenticated user or by project",
19682
19981
  inputSchema: milestone_filters2,
19683
19982
  execute: async (client, input) => unwrap3(input.project_id ? await client.milestones.getByProject(input.project_id) : await client.milestones.list())
19684
- },
19685
- devpad_milestones_get: {
19983
+ }),
19984
+ devpad_milestones_get: define_tool2({
19686
19985
  name: "devpad_milestones_get",
19687
19986
  description: "Get milestone by ID",
19688
19987
  inputSchema: milestone_by_id2,
19689
19988
  execute: async (client, input) => unwrap3(await client.milestones.find(input.id))
19690
- },
19691
- devpad_milestones_upsert: {
19989
+ }),
19990
+ devpad_milestones_upsert: define_tool2({
19692
19991
  name: "devpad_milestones_upsert",
19693
19992
  description: "Create or update a milestone. Returns 409 if entity is protected by user - pass force=true to override.",
19694
19993
  inputSchema: upsert_milestone,
@@ -19706,20 +20005,20 @@ var tools2 = {
19706
20005
  target_version: input.target_version,
19707
20006
  finished_at: input.finished_at
19708
20007
  }))
19709
- },
19710
- devpad_goals_list: {
20008
+ }),
20009
+ devpad_goals_list: define_tool2({
19711
20010
  name: "devpad_goals_list",
19712
20011
  description: "List goals for authenticated user",
19713
20012
  inputSchema: exports_external.object({}),
19714
20013
  execute: async (client) => unwrap3(await client.goals.list())
19715
- },
19716
- devpad_goals_get: {
20014
+ }),
20015
+ devpad_goals_get: define_tool2({
19717
20016
  name: "devpad_goals_get",
19718
20017
  description: "Get goal by ID",
19719
20018
  inputSchema: goal_by_id2,
19720
20019
  execute: async (client, input) => unwrap3(await client.goals.find(input.id))
19721
- },
19722
- devpad_goals_upsert: {
20020
+ }),
20021
+ devpad_goals_upsert: define_tool2({
19723
20022
  name: "devpad_goals_upsert",
19724
20023
  description: "Create or update a goal. Returns 409 if entity is protected by user - pass force=true to override.",
19725
20024
  inputSchema: upsert_goal,
@@ -19735,26 +20034,26 @@ var tools2 = {
19735
20034
  target_time: input.target_time,
19736
20035
  finished_at: input.finished_at
19737
20036
  }))
19738
- },
19739
- devpad_tags_list: {
20037
+ }),
20038
+ devpad_tags_list: define_tool2({
19740
20039
  name: "devpad_tags_list",
19741
20040
  description: "List tags for authenticated user",
19742
20041
  inputSchema: exports_external.object({}),
19743
20042
  execute: async (client) => unwrap3(await client.tags.list())
19744
- },
19745
- devpad_github_repos: {
20043
+ }),
20044
+ devpad_github_repos: define_tool2({
19746
20045
  name: "devpad_github_repos",
19747
20046
  description: "List GitHub repositories for authenticated user",
19748
20047
  inputSchema: exports_external.object({}),
19749
20048
  execute: async (client) => unwrap3(await client.github.repos())
19750
- },
19751
- devpad_github_branches: {
20049
+ }),
20050
+ devpad_github_branches: define_tool2({
19752
20051
  name: "devpad_github_branches",
19753
20052
  description: "List branches for a GitHub repository",
19754
20053
  inputSchema: github_branches2,
19755
20054
  execute: async (client, input) => unwrap3(await client.github.branches(input.owner, input.repo))
19756
- },
19757
- devpad_projects_delete: {
20055
+ }),
20056
+ devpad_projects_delete: define_tool2({
19758
20057
  name: "devpad_projects_delete",
19759
20058
  description: "Delete a project",
19760
20059
  inputSchema: exports_external.object({
@@ -19767,56 +20066,56 @@ var tools2 = {
19767
20066
  unwrap3(await client.projects.deleteProject(project2));
19768
20067
  return { success: true };
19769
20068
  }
19770
- },
19771
- devpad_projects_history: {
20069
+ }),
20070
+ devpad_projects_history: define_tool2({
19772
20071
  name: "devpad_projects_history",
19773
20072
  description: "Get project history",
19774
20073
  inputSchema: exports_external.object({
19775
20074
  project_id: exports_external.string().describe("Project ID")
19776
20075
  }),
19777
20076
  execute: async (client, input) => unwrap3(await client.projects.history(input.project_id))
19778
- },
19779
- devpad_projects_specification: {
20077
+ }),
20078
+ devpad_projects_specification: define_tool2({
19780
20079
  name: "devpad_projects_specification",
19781
20080
  description: "Fetch project specification from GitHub",
19782
20081
  inputSchema: exports_external.object({
19783
20082
  project_id: exports_external.string().describe("Project ID")
19784
20083
  }),
19785
20084
  execute: async (client, input) => unwrap3(await client.projects.specification(input.project_id))
19786
- },
19787
- devpad_projects_config_load: {
20085
+ }),
20086
+ devpad_projects_config_load: define_tool2({
19788
20087
  name: "devpad_projects_config_load",
19789
20088
  description: "Load project configuration",
19790
20089
  inputSchema: exports_external.object({
19791
20090
  project_id: exports_external.string().describe("Project ID")
19792
20091
  }),
19793
20092
  execute: async (client, input) => unwrap3(await client.projects.config.load(input.project_id))
19794
- },
19795
- devpad_milestones_delete: {
20093
+ }),
20094
+ devpad_milestones_delete: define_tool2({
19796
20095
  name: "devpad_milestones_delete",
19797
20096
  description: "Delete a milestone",
19798
20097
  inputSchema: exports_external.object({
19799
20098
  id: exports_external.string().describe("Milestone ID")
19800
20099
  }),
19801
20100
  execute: async (client, input) => unwrap3(await client.milestones.delete(input.id))
19802
- },
19803
- devpad_milestones_goals: {
20101
+ }),
20102
+ devpad_milestones_goals: define_tool2({
19804
20103
  name: "devpad_milestones_goals",
19805
20104
  description: "Get goals for a milestone",
19806
20105
  inputSchema: exports_external.object({
19807
20106
  id: exports_external.string().describe("Milestone ID")
19808
20107
  }),
19809
20108
  execute: async (client, input) => unwrap3(await client.milestones.goals(input.id))
19810
- },
19811
- devpad_goals_delete: {
20109
+ }),
20110
+ devpad_goals_delete: define_tool2({
19812
20111
  name: "devpad_goals_delete",
19813
20112
  description: "Delete a goal",
19814
20113
  inputSchema: exports_external.object({
19815
20114
  id: exports_external.string().describe("Goal ID")
19816
20115
  }),
19817
20116
  execute: async (client, input) => unwrap3(await client.goals.delete(input.id))
19818
- },
19819
- devpad_tasks_delete: {
20117
+ }),
20118
+ devpad_tasks_delete: define_tool2({
19820
20119
  name: "devpad_tasks_delete",
19821
20120
  description: "Delete a task",
19822
20121
  inputSchema: exports_external.object({
@@ -19829,22 +20128,22 @@ var tools2 = {
19829
20128
  unwrap3(await client.tasks.deleteTask(task2));
19830
20129
  return { success: true };
19831
20130
  }
19832
- },
19833
- devpad_tasks_history: {
20131
+ }),
20132
+ devpad_tasks_history: define_tool2({
19834
20133
  name: "devpad_tasks_history",
19835
20134
  description: "Get task history",
19836
20135
  inputSchema: exports_external.object({
19837
20136
  task_id: exports_external.string().describe("Task ID")
19838
20137
  }),
19839
20138
  execute: async (client, input) => unwrap3(await client.tasks.history.get(input.task_id))
19840
- },
19841
- devpad_user_history: {
20139
+ }),
20140
+ devpad_user_history: define_tool2({
19842
20141
  name: "devpad_user_history",
19843
20142
  description: "Get user activity history",
19844
20143
  inputSchema: exports_external.object({}),
19845
20144
  execute: async (client) => unwrap3(await client.user.history())
19846
- },
19847
- devpad_user_preferences: {
20145
+ }),
20146
+ devpad_user_preferences: define_tool2({
19848
20147
  name: "devpad_user_preferences",
19849
20148
  description: "Update user preferences",
19850
20149
  inputSchema: exports_external.object({
@@ -19852,8 +20151,8 @@ var tools2 = {
19852
20151
  task_view: exports_external.enum(["list", "grid"]).describe("Task view preference")
19853
20152
  }),
19854
20153
  execute: async (client, input) => unwrap3(await client.user.preferences(input))
19855
- },
19856
- devpad_activity_ai: {
20154
+ }),
20155
+ devpad_activity_ai: define_tool2({
19857
20156
  name: "devpad_activity_ai",
19858
20157
  description: "Get AI activity feed - shows recent actions made via API/MCP grouped into sessions by time window",
19859
20158
  inputSchema: exports_external.object({
@@ -19861,104 +20160,69 @@ var tools2 = {
19861
20160
  since: exports_external.string().optional().describe("Only show activity after this ISO date")
19862
20161
  }),
19863
20162
  execute: async (client, input) => unwrap3(await client.activity.ai(input))
19864
- },
19865
- devpad_blog_posts_list: {
20163
+ }),
20164
+ devpad_blog_posts_list: define_tool2({
19866
20165
  name: "devpad_blog_posts_list",
19867
20166
  description: "List blog posts with optional filters",
19868
- inputSchema: exports_external.object({
19869
- category: exports_external.string().optional().describe("Filter by category"),
19870
- tag: exports_external.string().optional().describe("Filter by tag"),
19871
- project: exports_external.string().optional().describe("Filter by project ID"),
19872
- status: exports_external.enum(["draft", "published"]).optional().describe("Filter by status"),
19873
- archived: exports_external.boolean().optional().describe("Filter by archived state"),
19874
- limit: exports_external.number().optional().describe("Max posts to return"),
19875
- offset: exports_external.number().optional().describe("Offset for pagination"),
19876
- sort: exports_external.string().optional().describe("Sort order")
19877
- }),
20167
+ inputSchema: PostListParamsSchema.partial(),
19878
20168
  execute: async (client, input) => unwrap3(await client.blog.posts.list(input))
19879
- },
19880
- devpad_blog_posts_get: {
20169
+ }),
20170
+ devpad_blog_posts_get: define_tool2({
19881
20171
  name: "devpad_blog_posts_get",
19882
20172
  description: "Get a blog post by slug",
19883
20173
  inputSchema: exports_external.object({
19884
20174
  slug: exports_external.string().describe("Post slug")
19885
20175
  }),
19886
20176
  execute: async (client, input) => unwrap3(await client.blog.posts.getBySlug(input.slug))
19887
- },
19888
- devpad_blog_posts_create: {
20177
+ }),
20178
+ devpad_blog_posts_create: define_tool2({
19889
20179
  name: "devpad_blog_posts_create",
19890
20180
  description: "Create a new blog post",
19891
- inputSchema: exports_external.object({
19892
- title: exports_external.string().describe("Post title"),
19893
- content: exports_external.string().describe("Post content"),
19894
- format: exports_external.enum(["markdown", "html"]).describe("Content format"),
19895
- slug: exports_external.string().optional().describe("Custom slug"),
19896
- category: exports_external.string().optional().describe("Category name"),
19897
- tags: exports_external.array(exports_external.string()).optional().describe("Tag names"),
19898
- description: exports_external.string().optional().describe("Post description"),
19899
- publish_at: exports_external.string().optional().describe("Scheduled publish date (ISO string)"),
19900
- project_ids: exports_external.array(exports_external.string()).optional().describe("Associated project IDs"),
19901
- archived: exports_external.boolean().optional().describe("Whether post is archived")
19902
- }),
20181
+ inputSchema: PostCreateSchema,
19903
20182
  execute: async (client, input) => unwrap3(await client.blog.posts.create(input))
19904
- },
19905
- devpad_blog_posts_update: {
20183
+ }),
20184
+ devpad_blog_posts_update: define_tool2({
19906
20185
  name: "devpad_blog_posts_update",
19907
20186
  description: "Update a blog post by UUID",
19908
- inputSchema: exports_external.object({
19909
- uuid: exports_external.string().describe("Post UUID"),
19910
- title: exports_external.string().optional().describe("Post title"),
19911
- content: exports_external.string().optional().describe("Post content"),
19912
- format: exports_external.enum(["markdown", "html"]).optional().describe("Content format"),
19913
- slug: exports_external.string().optional().describe("Custom slug"),
19914
- category: exports_external.string().optional().describe("Category name"),
19915
- tags: exports_external.array(exports_external.string()).optional().describe("Tag names"),
19916
- description: exports_external.string().optional().describe("Post description"),
19917
- publish_at: exports_external.string().optional().describe("Scheduled publish date (ISO string)"),
19918
- project_ids: exports_external.array(exports_external.string()).optional().describe("Associated project IDs"),
19919
- archived: exports_external.boolean().optional().describe("Whether post is archived")
19920
- }),
20187
+ inputSchema: PostUpdateSchema.extend({ uuid: exports_external.string().describe("Post UUID") }),
19921
20188
  execute: async (client, input) => {
19922
20189
  const { uuid, ...data } = input;
19923
20190
  return unwrap3(await client.blog.posts.update(uuid, data));
19924
20191
  }
19925
- },
19926
- devpad_blog_posts_delete: {
20192
+ }),
20193
+ devpad_blog_posts_delete: define_tool2({
19927
20194
  name: "devpad_blog_posts_delete",
19928
20195
  description: "Delete a blog post by UUID",
19929
20196
  inputSchema: exports_external.object({
19930
20197
  uuid: exports_external.string().describe("Post UUID")
19931
20198
  }),
19932
20199
  execute: async (client, input) => unwrap3(await client.blog.posts.delete(input.uuid))
19933
- },
19934
- devpad_blog_tags_list: {
20200
+ }),
20201
+ devpad_blog_tags_list: define_tool2({
19935
20202
  name: "devpad_blog_tags_list",
19936
20203
  description: "List all blog tags with post counts",
19937
20204
  inputSchema: exports_external.object({}),
19938
20205
  execute: async (client) => unwrap3(await client.blog.tags.list())
19939
- },
19940
- devpad_blog_categories_tree: {
20206
+ }),
20207
+ devpad_blog_categories_tree: define_tool2({
19941
20208
  name: "devpad_blog_categories_tree",
19942
20209
  description: "Get the blog category tree",
19943
20210
  inputSchema: exports_external.object({}),
19944
20211
  execute: async (client) => unwrap3(await client.blog.categories.tree())
19945
- },
19946
- devpad_blog_categories_create: {
20212
+ }),
20213
+ devpad_blog_categories_create: define_tool2({
19947
20214
  name: "devpad_blog_categories_create",
19948
20215
  description: "Create a blog category",
19949
- inputSchema: exports_external.object({
19950
- name: exports_external.string().describe("Category name"),
19951
- parent: exports_external.string().optional().describe("Parent category name")
19952
- }),
20216
+ inputSchema: CategoryCreateSchema,
19953
20217
  execute: async (client, input) => unwrap3(await client.blog.categories.create(input))
19954
- },
19955
- devpad_blog_tokens_list: {
20218
+ }),
20219
+ devpad_blog_tokens_list: define_tool2({
19956
20220
  name: "devpad_blog_tokens_list",
19957
20221
  description: "List blog access tokens",
19958
20222
  inputSchema: exports_external.object({}),
19959
20223
  execute: async (client) => unwrap3(await client.blog.tokens.list())
19960
- },
19961
- devpad_blog_tokens_create: {
20224
+ }),
20225
+ devpad_blog_tokens_create: define_tool2({
19962
20226
  name: "devpad_blog_tokens_create",
19963
20227
  description: "Create a blog access token",
19964
20228
  inputSchema: exports_external.object({
@@ -19966,14 +20230,14 @@ var tools2 = {
19966
20230
  note: exports_external.string().optional().describe("Optional note")
19967
20231
  }),
19968
20232
  execute: async (client, input) => unwrap3(await client.blog.tokens.create(input))
19969
- },
19970
- devpad_media_profiles_list: {
20233
+ }),
20234
+ devpad_media_profiles_list: define_tool2({
19971
20235
  name: "devpad_media_profiles_list",
19972
20236
  description: "List media profiles",
19973
20237
  inputSchema: exports_external.object({}),
19974
20238
  execute: async (client) => unwrap3(await client.media.profiles.list())
19975
- },
19976
- devpad_media_profiles_create: {
20239
+ }),
20240
+ devpad_media_profiles_create: define_tool2({
19977
20241
  name: "devpad_media_profiles_create",
19978
20242
  description: "Create a media profile",
19979
20243
  inputSchema: exports_external.object({
@@ -19981,16 +20245,16 @@ var tools2 = {
19981
20245
  slug: exports_external.string().describe("Profile slug")
19982
20246
  }),
19983
20247
  execute: async (client, input) => unwrap3(await client.media.profiles.create(input))
19984
- },
19985
- devpad_media_profiles_get: {
20248
+ }),
20249
+ devpad_media_profiles_get: define_tool2({
19986
20250
  name: "devpad_media_profiles_get",
19987
20251
  description: "Get a media profile by ID",
19988
20252
  inputSchema: exports_external.object({
19989
20253
  id: exports_external.string().describe("Profile ID")
19990
20254
  }),
19991
20255
  execute: async (client, input) => unwrap3(await client.media.profiles.get(input.id))
19992
- },
19993
- devpad_media_profiles_update: {
20256
+ }),
20257
+ devpad_media_profiles_update: define_tool2({
19994
20258
  name: "devpad_media_profiles_update",
19995
20259
  description: "Update a media profile by ID",
19996
20260
  inputSchema: exports_external.object({
@@ -20002,32 +20266,32 @@ var tools2 = {
20002
20266
  const { id: id2, ...data } = input;
20003
20267
  return unwrap3(await client.media.profiles.update(id2, data));
20004
20268
  }
20005
- },
20006
- devpad_media_profiles_delete: {
20269
+ }),
20270
+ devpad_media_profiles_delete: define_tool2({
20007
20271
  name: "devpad_media_profiles_delete",
20008
20272
  description: "Delete a media profile by ID",
20009
20273
  inputSchema: exports_external.object({
20010
20274
  id: exports_external.string().describe("Profile ID")
20011
20275
  }),
20012
20276
  execute: async (client, input) => unwrap3(await client.media.profiles.delete(input.id))
20013
- },
20014
- devpad_media_connections_list: {
20277
+ }),
20278
+ devpad_media_connections_list: define_tool2({
20015
20279
  name: "devpad_media_connections_list",
20016
20280
  description: "List connections for a media profile",
20017
20281
  inputSchema: exports_external.object({
20018
20282
  profile_id: exports_external.string().describe("Profile ID")
20019
20283
  }),
20020
20284
  execute: async (client, input) => unwrap3(await client.media.connections.list(input.profile_id))
20021
- },
20022
- devpad_media_connections_refresh: {
20285
+ }),
20286
+ devpad_media_connections_refresh: define_tool2({
20023
20287
  name: "devpad_media_connections_refresh",
20024
20288
  description: "Refresh a media connection",
20025
20289
  inputSchema: exports_external.object({
20026
20290
  account_id: exports_external.string().describe("Account/connection ID")
20027
20291
  }),
20028
20292
  execute: async (client, input) => unwrap3(await client.media.connections.refresh(input.account_id))
20029
- },
20030
- devpad_media_timeline_get: {
20293
+ }),
20294
+ devpad_media_timeline_get: define_tool2({
20031
20295
  name: "devpad_media_timeline_get",
20032
20296
  description: "Get media timeline for a user",
20033
20297
  inputSchema: exports_external.object({
@@ -20039,8 +20303,8 @@ var tools2 = {
20039
20303
  const { user_id, ...params } = input;
20040
20304
  return unwrap3(await client.media.timeline.get(user_id, params));
20041
20305
  }
20042
- },
20043
- devpad_pulse_summary: {
20306
+ }),
20307
+ devpad_pulse_summary: define_tool2({
20044
20308
  name: "devpad_pulse_summary",
20045
20309
  description: "Get summary analytics for a project (pageviews, sessions, errors, latency)",
20046
20310
  inputSchema: exports_external.object({
@@ -20048,8 +20312,8 @@ var tools2 = {
20048
20312
  range: exports_external.enum(["24h", "7d", "30d", "90d"]).describe("Time range")
20049
20313
  }),
20050
20314
  execute: async (client, input) => unwrap3(await client.pulse.summary({ project_id: input.project_id, range: input.range }))
20051
- },
20052
- devpad_pulse_events: {
20315
+ }),
20316
+ devpad_pulse_events: define_tool2({
20053
20317
  name: "devpad_pulse_events",
20054
20318
  description: "List events for a project with optional filtering",
20055
20319
  inputSchema: exports_external.object({
@@ -20063,8 +20327,8 @@ var tools2 = {
20063
20327
  cursor: exports_external.string().optional().describe("Pagination cursor")
20064
20328
  }),
20065
20329
  execute: async (client, input) => unwrap3(await client.pulse.events(input))
20066
- },
20067
- devpad_pulse_errors: {
20330
+ }),
20331
+ devpad_pulse_errors: define_tool2({
20068
20332
  name: "devpad_pulse_errors",
20069
20333
  description: "List error issues for a project, optionally grouped by fingerprint",
20070
20334
  inputSchema: exports_external.object({
@@ -20077,8 +20341,8 @@ var tools2 = {
20077
20341
  range: input.range,
20078
20342
  group_by_fingerprint: input.group_by_fingerprint
20079
20343
  }))
20080
- },
20081
- devpad_pulse_logs: {
20344
+ }),
20345
+ devpad_pulse_logs: define_tool2({
20082
20346
  name: "devpad_pulse_logs",
20083
20347
  description: "List logs for a project with optional level and message filtering",
20084
20348
  inputSchema: exports_external.object({
@@ -20088,8 +20352,8 @@ var tools2 = {
20088
20352
  search: exports_external.string().optional().describe("Search in log messages")
20089
20353
  }),
20090
20354
  execute: async (client, input) => unwrap3(await client.pulse.logs(input))
20091
- },
20092
- devpad_pulse_latency: {
20355
+ }),
20356
+ devpad_pulse_latency: define_tool2({
20093
20357
  name: "devpad_pulse_latency",
20094
20358
  description: "Get request latency metrics (p50, p95, p99) for a project",
20095
20359
  inputSchema: exports_external.object({
@@ -20099,16 +20363,16 @@ var tools2 = {
20099
20363
  percentiles: exports_external.array(exports_external.number()).optional().describe("Percentiles to compute (default [50, 95, 99])")
20100
20364
  }),
20101
20365
  execute: async (client, input) => unwrap3(await client.pulse.latency(input))
20102
- },
20103
- devpad_alerts_list: {
20366
+ }),
20367
+ devpad_alerts_list: define_tool2({
20104
20368
  name: "devpad_alerts_list",
20105
20369
  description: "List notification subscriptions (alerts) for a project",
20106
20370
  inputSchema: exports_external.object({
20107
20371
  project_id: exports_external.string().describe("Project ID")
20108
20372
  }),
20109
20373
  execute: async (client, input) => unwrap3(await client.pulse.subs.list(input))
20110
- },
20111
- devpad_alerts_subscribe: {
20374
+ }),
20375
+ devpad_alerts_subscribe: define_tool2({
20112
20376
  name: "devpad_alerts_subscribe",
20113
20377
  description: "Create a new notification subscription (alert) for events",
20114
20378
  inputSchema: exports_external.object({
@@ -20119,16 +20383,16 @@ var tools2 = {
20119
20383
  cooldown_seconds: exports_external.number().optional().describe("Cooldown between notifications (default 60)")
20120
20384
  }),
20121
20385
  execute: async (client, input) => unwrap3(await client.pulse.subs.create(input))
20122
- },
20123
- devpad_alerts_unsubscribe: {
20386
+ }),
20387
+ devpad_alerts_unsubscribe: define_tool2({
20124
20388
  name: "devpad_alerts_unsubscribe",
20125
20389
  description: "Delete a notification subscription by ID",
20126
20390
  inputSchema: exports_external.object({
20127
20391
  id: exports_external.string().describe("Subscription ID")
20128
20392
  }),
20129
20393
  execute: async (client, input) => unwrap3(await client.pulse.subs.delete(input.id))
20130
- },
20131
- devpad_pulse_key_create: {
20394
+ }),
20395
+ devpad_pulse_key_create: define_tool2({
20132
20396
  name: "devpad_pulse_key_create",
20133
20397
  description: "Create a new ingest key for a project (returns plaintext once)",
20134
20398
  inputSchema: exports_external.object({
@@ -20137,8 +20401,8 @@ var tools2 = {
20137
20401
  rate_limit_per_min: exports_external.number().optional().describe("Rate limit in requests per minute (default 600)")
20138
20402
  }),
20139
20403
  execute: async (client, input) => unwrap3(await client.pulse.keys.create(input))
20140
- },
20141
- devpad_pipelines_list: {
20404
+ }),
20405
+ devpad_pipelines_list: define_tool2({
20142
20406
  name: "devpad_pipelines_list",
20143
20407
  description: "List pipeline runs (newest first). Optionally filter by package and/or status; cap limit at 200.",
20144
20408
  inputSchema: exports_external.object({
@@ -20147,16 +20411,16 @@ var tools2 = {
20147
20411
  limit: exports_external.number().int().positive().max(200).optional().describe("Max rows to return (default 50, cap 200)")
20148
20412
  }),
20149
20413
  execute: async (client, input) => unwrap3(await client.pipelines.list(input))
20150
- },
20151
- devpad_pipelines_get: {
20414
+ }),
20415
+ devpad_pipelines_get: define_tool2({
20152
20416
  name: "devpad_pipelines_get",
20153
20417
  description: "Get a pipeline run by ID",
20154
20418
  inputSchema: exports_external.object({
20155
20419
  run_id: exports_external.string().describe("Pipeline run ID")
20156
20420
  }),
20157
20421
  execute: async (client, input) => unwrap3(await client.pipelines.get(input.run_id))
20158
- },
20159
- devpad_pipelines_create: {
20422
+ }),
20423
+ devpad_pipelines_create: define_tool2({
20160
20424
  name: "devpad_pipelines_create",
20161
20425
  description: "Create a new pipeline run",
20162
20426
  inputSchema: exports_external.object({
@@ -20164,8 +20428,8 @@ var tools2 = {
20164
20428
  version_set_id: exports_external.string().describe("Version set ID to deploy")
20165
20429
  }),
20166
20430
  execute: async (client, input) => unwrap3(await client.pipelines.create(input))
20167
- },
20168
- devpad_pipelines_approve: {
20431
+ }),
20432
+ devpad_pipelines_approve: define_tool2({
20169
20433
  name: "devpad_pipelines_approve",
20170
20434
  description: "Approve or deny a stage in a pipeline run",
20171
20435
  inputSchema: exports_external.object({
@@ -20179,8 +20443,8 @@ var tools2 = {
20179
20443
  unwrap3(await client.pipelines.approve(input.run_id, input));
20180
20444
  return { success: true };
20181
20445
  }
20182
- },
20183
- devpad_pipelines_cancel: {
20446
+ }),
20447
+ devpad_pipelines_cancel: define_tool2({
20184
20448
  name: "devpad_pipelines_cancel",
20185
20449
  description: "Cancel a pipeline run",
20186
20450
  inputSchema: exports_external.object({
@@ -20190,8 +20454,8 @@ var tools2 = {
20190
20454
  unwrap3(await client.pipelines.cancel(input.run_id));
20191
20455
  return { success: true };
20192
20456
  }
20193
- },
20194
- devpad_pipelines_rollback: {
20457
+ }),
20458
+ devpad_pipelines_rollback: define_tool2({
20195
20459
  name: "devpad_pipelines_rollback",
20196
20460
  description: "Rollback a completed or failed pipeline run",
20197
20461
  inputSchema: exports_external.object({
@@ -20201,8 +20465,8 @@ var tools2 = {
20201
20465
  unwrap3(await client.pipelines.rollback(input.run_id));
20202
20466
  return { success: true };
20203
20467
  }
20204
- },
20205
- devpad_pipelines_runs_events_ingest: {
20468
+ }),
20469
+ devpad_pipelines_runs_events_ingest: define_tool2({
20206
20470
  name: "devpad_pipelines_runs_events_ingest",
20207
20471
  description: 'Ingest an external webhook event against an in-flight pipeline run. Idempotent on (idempotency_key, payload). Server-side stamps payload.source = "external".',
20208
20472
  inputSchema: exports_external.object({
@@ -20218,24 +20482,24 @@ var tools2 = {
20218
20482
  payload: input.payload,
20219
20483
  idempotency_key: input.idempotency_key
20220
20484
  }))
20221
- },
20222
- devpad_pipelines_runs_events_list: {
20485
+ }),
20486
+ devpad_pipelines_runs_events_list: define_tool2({
20223
20487
  name: "devpad_pipelines_runs_events_list",
20224
20488
  description: "List stored stage events for a pipeline run, newest-first",
20225
20489
  inputSchema: exports_external.object({
20226
20490
  run_id: exports_external.string().describe("Pipeline run ID")
20227
20491
  }),
20228
20492
  execute: async (client, input) => unwrap3(await client.pipelines.events.list(input.run_id))
20229
- },
20230
- devpad_pipelines_grants_list: {
20493
+ }),
20494
+ devpad_pipelines_grants_list: define_tool2({
20231
20495
  name: "devpad_pipelines_grants_list",
20232
20496
  description: "List vault grants for a pipeline package",
20233
20497
  inputSchema: exports_external.object({
20234
20498
  package_id: exports_external.string().describe("Package ID to filter grants by")
20235
20499
  }),
20236
20500
  execute: async (client, input) => unwrap3(await client.pipelines.grants.list(input.package_id))
20237
- },
20238
- devpad_pipelines_grants_approve: {
20501
+ }),
20502
+ devpad_pipelines_grants_approve: define_tool2({
20239
20503
  name: "devpad_pipelines_grants_approve",
20240
20504
  description: "Approve a pending vault grant request for a pipeline package",
20241
20505
  inputSchema: exports_external.object({
@@ -20243,8 +20507,8 @@ var tools2 = {
20243
20507
  user_id: exports_external.string().describe("User ID making the approval decision")
20244
20508
  }),
20245
20509
  execute: async (client, input) => unwrap3(await client.pipelines.grants.approve(input.grant_id, input.user_id))
20246
- },
20247
- devpad_pipelines_grants_deny: {
20510
+ }),
20511
+ devpad_pipelines_grants_deny: define_tool2({
20248
20512
  name: "devpad_pipelines_grants_deny",
20249
20513
  description: "Deny a pending vault grant request for a pipeline package",
20250
20514
  inputSchema: exports_external.object({
@@ -20253,24 +20517,24 @@ var tools2 = {
20253
20517
  reason: exports_external.string().optional().describe("Optional reason for the denial")
20254
20518
  }),
20255
20519
  execute: async (client, input) => unwrap3(await client.pipelines.grants.deny(input.grant_id, input.user_id, input.reason))
20256
- },
20257
- devpad_pipelines_packages_list: {
20520
+ }),
20521
+ devpad_pipelines_packages_list: define_tool2({
20258
20522
  name: "devpad_pipelines_packages_list",
20259
20523
  description: "List pipeline packages. Optionally filter by linked devpad project_id; unlinked packages have project_id = null.",
20260
20524
  inputSchema: exports_external.object({
20261
20525
  project_id: exports_external.string().optional().describe("Filter packages by linked devpad project")
20262
20526
  }),
20263
20527
  execute: async (client, input) => unwrap3(await client.pipelines.packages.list(input))
20264
- },
20265
- devpad_pipelines_packages_get: {
20528
+ }),
20529
+ devpad_pipelines_packages_get: define_tool2({
20266
20530
  name: "devpad_pipelines_packages_get",
20267
20531
  description: "Get a pipeline package by ID",
20268
20532
  inputSchema: exports_external.object({
20269
20533
  package_id: exports_external.string().describe("Pipeline package ID")
20270
20534
  }),
20271
20535
  execute: async (client, input) => unwrap3(await client.pipelines.packages.get(input.package_id))
20272
- },
20273
- devpad_pipelines_packages_create: {
20536
+ }),
20537
+ devpad_pipelines_packages_create: define_tool2({
20274
20538
  name: "devpad_pipelines_packages_create",
20275
20539
  description: "Register a new pipeline-managed package. By convention `id` equals the package `name`. `project_id` optionally links the package to a devpad project.",
20276
20540
  inputSchema: exports_external.object({
@@ -20282,8 +20546,8 @@ var tools2 = {
20282
20546
  default_template_ref: exports_external.string().optional().describe("Optional default pipeline template ref")
20283
20547
  }),
20284
20548
  execute: async (client, input) => unwrap3(await client.pipelines.packages.create(input))
20285
- },
20286
- devpad_pipelines_packages_update: {
20549
+ }),
20550
+ devpad_pipelines_packages_update: define_tool2({
20287
20551
  name: "devpad_pipelines_packages_update",
20288
20552
  description: "Partially update a pipeline package. Only the provided fields are touched.",
20289
20553
  inputSchema: exports_external.object({
@@ -20297,24 +20561,24 @@ var tools2 = {
20297
20561
  const { id: id2, ...patch } = input;
20298
20562
  return unwrap3(await client.pipelines.packages.update(id2, patch));
20299
20563
  }
20300
- },
20301
- devpad_pipelines_packages_delete: {
20564
+ }),
20565
+ devpad_pipelines_packages_delete: define_tool2({
20302
20566
  name: "devpad_pipelines_packages_delete",
20303
20567
  description: "Delete a pipeline package. Refuses with conflict if existing pipeline_run rows still reference the package.",
20304
20568
  inputSchema: exports_external.object({
20305
20569
  id: exports_external.string().describe("Pipeline package ID")
20306
20570
  }),
20307
20571
  execute: async (client, input) => unwrap3(await client.pipelines.packages.delete(input.id))
20308
- },
20309
- devpad_pipelines_analysis_templates_list: {
20572
+ }),
20573
+ devpad_pipelines_analysis_templates_list: define_tool2({
20310
20574
  name: "devpad_pipelines_analysis_templates_list",
20311
20575
  description: "List pipeline analysis templates for an owner. Each row encodes the threshold DSL + window referenced by analysis-gate evaluations.",
20312
20576
  inputSchema: exports_external.object({
20313
20577
  owner_id: exports_external.string().describe("Devpad user ID whose templates to list")
20314
20578
  }),
20315
20579
  execute: async (client, input) => unwrap3(await client.pipelines.analysis_templates.list(input))
20316
- },
20317
- devpad_pipelines_analysis_templates_get: {
20580
+ }),
20581
+ devpad_pipelines_analysis_templates_get: define_tool2({
20318
20582
  name: "devpad_pipelines_analysis_templates_get",
20319
20583
  description: "Get a single pipeline analysis template by id, scoped to its owner.",
20320
20584
  inputSchema: exports_external.object({
@@ -20322,8 +20586,8 @@ var tools2 = {
20322
20586
  owner_id: exports_external.string().describe("Owner ID (must match the template's owner)")
20323
20587
  }),
20324
20588
  execute: async (client, input) => unwrap3(await client.pipelines.analysis_templates.get(input.id, { owner_id: input.owner_id }))
20325
- },
20326
- devpad_pipelines_analysis_templates_create: {
20589
+ }),
20590
+ devpad_pipelines_analysis_templates_create: define_tool2({
20327
20591
  name: "devpad_pipelines_analysis_templates_create",
20328
20592
  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).',
20329
20593
  inputSchema: exports_external.object({
@@ -20334,8 +20598,8 @@ var tools2 = {
20334
20598
  window_ms: exports_external.number().int().positive().optional().describe("Analysis window in milliseconds. Default: 600000")
20335
20599
  }),
20336
20600
  execute: async (client, input) => unwrap3(await client.pipelines.analysis_templates.create(input))
20337
- },
20338
- devpad_pipelines_analysis_templates_update: {
20601
+ }),
20602
+ devpad_pipelines_analysis_templates_update: define_tool2({
20339
20603
  name: "devpad_pipelines_analysis_templates_update",
20340
20604
  description: "Partially update a pipeline analysis template. Only the supplied fields are touched. Re-validates threshold_dsl when present.",
20341
20605
  inputSchema: exports_external.object({
@@ -20350,8 +20614,8 @@ var tools2 = {
20350
20614
  const { id: id2, ...patch } = input;
20351
20615
  return unwrap3(await client.pipelines.analysis_templates.update(id2, patch));
20352
20616
  }
20353
- },
20354
- devpad_pipelines_analysis_templates_delete: {
20617
+ }),
20618
+ devpad_pipelines_analysis_templates_delete: define_tool2({
20355
20619
  name: "devpad_pipelines_analysis_templates_delete",
20356
20620
  description: "Hard-delete a pipeline analysis template. Does NOT consult pipeline_run.resolved_gates — runs snapshot their gate template at resolve-time, so deletion never orphans in-flight runs.",
20357
20621
  inputSchema: exports_external.object({
@@ -20359,16 +20623,16 @@ var tools2 = {
20359
20623
  owner_id: exports_external.string().describe("Owner ID (must match the template's owner)")
20360
20624
  }),
20361
20625
  execute: async (client, input) => unwrap3(await client.pipelines.analysis_templates.delete(input.id, { owner_id: input.owner_id }))
20362
- },
20363
- devpad_pipelines_oidc_trust_list: {
20626
+ }),
20627
+ devpad_pipelines_oidc_trust_list: define_tool2({
20364
20628
  name: "devpad_pipelines_oidc_trust_list",
20365
20629
  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.",
20366
20630
  inputSchema: exports_external.object({
20367
20631
  owner_id: exports_external.string().describe("User ID whose trust policies to list")
20368
20632
  }),
20369
20633
  execute: async (client, input) => unwrap3(await client.pipelines.oidc_trust.list(input))
20370
- },
20371
- devpad_pipelines_oidc_trust_create: {
20634
+ }),
20635
+ devpad_pipelines_oidc_trust_create: define_tool2({
20372
20636
  name: "devpad_pipelines_oidc_trust_create",
20373
20637
  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.',
20374
20638
  inputSchema: exports_external.object({
@@ -20382,8 +20646,8 @@ var tools2 = {
20382
20646
  session_ttl_seconds: exports_external.number().int().positive().optional().describe("Session token TTL. Default: 900 (15 min)")
20383
20647
  }),
20384
20648
  execute: async (client, input) => unwrap3(await client.pipelines.oidc_trust.create(input))
20385
- },
20386
- devpad_pipelines_oidc_trust_update: {
20649
+ }),
20650
+ devpad_pipelines_oidc_trust_update: define_tool2({
20387
20651
  name: "devpad_pipelines_oidc_trust_update",
20388
20652
  description: "Partially update a GitHub Actions OIDC trust policy. Only the supplied fields are touched; validation runs server-side against the merged record.",
20389
20653
  inputSchema: exports_external.object({
@@ -20401,8 +20665,8 @@ var tools2 = {
20401
20665
  const { id: id2, ...patch } = input;
20402
20666
  return unwrap3(await client.pipelines.oidc_trust.update(id2, patch));
20403
20667
  }
20404
- },
20405
- devpad_pipelines_oidc_trust_delete: {
20668
+ }),
20669
+ devpad_pipelines_oidc_trust_delete: define_tool2({
20406
20670
  name: "devpad_pipelines_oidc_trust_delete",
20407
20671
  description: "Soft-delete a GitHub Actions OIDC trust policy. The row is preserved for audit; the matcher and list operations skip soft-deleted rows.",
20408
20672
  inputSchema: exports_external.object({
@@ -20410,7 +20674,7 @@ var tools2 = {
20410
20674
  owner_id: exports_external.string().describe("Owner ID (must match the policy's owner)")
20411
20675
  }),
20412
20676
  execute: async (client, input) => unwrap3(await client.pipelines.oidc_trust.delete(input.id, { owner_id: input.owner_id }))
20413
- }
20677
+ })
20414
20678
  };
20415
20679
  var toolNames2 = Object.keys(tools2);
20416
20680
  // ../pipeline-templates/src/default-gradual.ts
@@ -20473,14 +20737,14 @@ var validate_package_name = (name) => {
20473
20737
  if (name.length > MAX_PACKAGE_NAME_LENGTH) {
20474
20738
  return err({
20475
20739
  code: "package_name_too_long",
20476
- message: `package name must be ≤ ${MAX_PACKAGE_NAME_LENGTH} chars, got ${name.length}`,
20740
+ message: `package name must be ≤ ${String(MAX_PACKAGE_NAME_LENGTH)} chars, got ${String(name.length)}`,
20477
20741
  length: name.length
20478
20742
  });
20479
20743
  }
20480
20744
  if (!PACKAGE_NAME_PATTERN.test(name)) {
20481
20745
  return err({
20482
20746
  code: "package_name_invalid_chars",
20483
- message: `package name must match ${PACKAGE_NAME_PATTERN}; got "${name}"`,
20747
+ message: `package name must match ${String(PACKAGE_NAME_PATTERN)}; got "${name}"`,
20484
20748
  name
20485
20749
  });
20486
20750
  }
@@ -20490,7 +20754,7 @@ var compute_compatibility_date = (now) => {
20490
20754
  const year = now.getUTCFullYear();
20491
20755
  const month = String(now.getUTCMonth() + 1).padStart(2, "0");
20492
20756
  const day = String(now.getUTCDate()).padStart(2, "0");
20493
- return `${year}-${month}-${day}`;
20757
+ return `${String(year)}-${month}-${day}`;
20494
20758
  };
20495
20759
  var to_pascal_case = (name) => {
20496
20760
  return name.split("-").filter((part) => part.length > 0).map((part) => part[0].toUpperCase() + part.slice(1)).join("");
@@ -20560,16 +20824,16 @@ var render_template = (template, vars) => {
20560
20824
  for (const match2 of placeholder_matches) {
20561
20825
  const key = match2[1];
20562
20826
  if (!["if", "else", "endif"].includes(key.toLowerCase())) {
20563
- all_matches.push({ full: match2[0], key, index: match2.index ?? 0 });
20827
+ all_matches.push({ full: match2[0], key, index: match2.index });
20564
20828
  }
20565
20829
  }
20566
20830
  for (const match2 of template.matchAll(IF_ELSE_BLOCK_PATTERN)) {
20567
20831
  const key = match2[1];
20568
- all_matches.push({ full: match2[0], key, index: match2.index ?? 0 });
20832
+ all_matches.push({ full: match2[0], key, index: match2.index });
20569
20833
  }
20570
20834
  for (const match2 of template.matchAll(IF_BLOCK_PATTERN)) {
20571
20835
  const key = match2[1];
20572
- all_matches.push({ full: match2[0], key, index: match2.index ?? 0 });
20836
+ all_matches.push({ full: match2[0], key, index: match2.index });
20573
20837
  }
20574
20838
  const missing = all_matches.find((m) => !(m.key in vars));
20575
20839
  if (missing !== undefined) {
@@ -20780,7 +21044,7 @@ var compute_asset_hash = (bytes, extension_without_dot) => {
20780
21044
  };
20781
21045
  var mime_for_asset = (filepath) => {
20782
21046
  const type = import_mime.default.getType(filepath);
20783
- return type === null || type === undefined ? "application/octet-stream" : type;
21047
+ return type === null ? "application/octet-stream" : type;
20784
21048
  };
20785
21049
  var to_posix_relative = (root, full) => {
20786
21050
  const rel = relative(root, full);
@@ -20792,6 +21056,8 @@ var list_files_recursive = (root) => {
20792
21056
  const stack = [root];
20793
21057
  while (stack.length > 0) {
20794
21058
  const dir = stack.pop();
21059
+ if (dir === undefined)
21060
+ break;
20795
21061
  let entries = [];
20796
21062
  try {
20797
21063
  entries = readdirSync(dir, { withFileTypes: true });
@@ -20799,7 +21065,7 @@ var list_files_recursive = (root) => {
20799
21065
  return err({ kind: "io_error", path: dir, reason: e instanceof Error ? e.message : String(e) });
20800
21066
  }
20801
21067
  for (const entry of entries) {
20802
- const full = join(dir, String(entry.name));
21068
+ const full = join(dir, entry.name);
20803
21069
  if (entry.isSymbolicLink())
20804
21070
  continue;
20805
21071
  if (entry.isDirectory()) {
@@ -20827,7 +21093,7 @@ var walk_assets_dir = (assets_dir, options = {}) => {
20827
21093
  let st;
20828
21094
  try {
20829
21095
  st = statSync(assets_dir);
20830
- } catch (e) {
21096
+ } catch {
20831
21097
  return err({ kind: "not_a_directory", path: assets_dir });
20832
21098
  }
20833
21099
  if (!st.isDirectory()) {
@@ -20903,6 +21169,8 @@ var list_files_recursive2 = (root) => {
20903
21169
  const stack = [root];
20904
21170
  while (stack.length > 0) {
20905
21171
  const dir = stack.pop();
21172
+ if (dir === undefined)
21173
+ break;
20906
21174
  let entries = [];
20907
21175
  try {
20908
21176
  entries = readdirSync2(dir, { withFileTypes: true });
@@ -20910,7 +21178,7 @@ var list_files_recursive2 = (root) => {
20910
21178
  return err({ kind: "io_error", path: dir, reason: e instanceof Error ? e.message : String(e) });
20911
21179
  }
20912
21180
  for (const entry of entries) {
20913
- const full = join2(dir, String(entry.name));
21181
+ const full = join2(dir, entry.name);
20914
21182
  if (entry.isSymbolicLink())
20915
21183
  continue;
20916
21184
  if (entry.isDirectory()) {
@@ -20938,7 +21206,7 @@ var walk_bundle_dir = (bundle_dir) => {
20938
21206
  let st;
20939
21207
  try {
20940
21208
  st = statSync2(bundle_dir);
20941
- } catch (e) {
21209
+ } catch {
20942
21210
  return err({ kind: "not_a_directory", path: bundle_dir });
20943
21211
  }
20944
21212
  if (!st.isDirectory()) {
@@ -21037,9 +21305,9 @@ var create_corpus_http_backend = (input) => {
21037
21305
  version: upload2.value.version_set_id,
21038
21306
  content_hash: upload2.value.content_hash
21039
21307
  };
21040
- await shadow.data.put(meta.data_key, bytes).catch(() => {
21041
- return;
21042
- });
21308
+ const shadow_write2 = await shadow.data.put(meta.data_key, bytes);
21309
+ if (!shadow_write2.ok)
21310
+ console.warn(`corpus-http-backend: shadow data write failed for ${meta.data_key}`, shadow_write2.error);
21043
21311
  return shadow.metadata.put(remote_meta2);
21044
21312
  }
21045
21313
  const upload = await upload_blob_to_store(input, meta.store_id, bytes);
@@ -21050,9 +21318,9 @@ var create_corpus_http_backend = (input) => {
21050
21318
  version: upload.value.version,
21051
21319
  content_hash: upload.value.content_hash
21052
21320
  };
21053
- await shadow.data.put(meta.data_key, bytes).catch(() => {
21054
- return;
21055
- });
21321
+ const shadow_write = await shadow.data.put(meta.data_key, bytes);
21322
+ if (!shadow_write.ok)
21323
+ console.warn(`corpus-http-backend: shadow data write failed for ${meta.data_key}`, shadow_write.error);
21056
21324
  return shadow.metadata.put(remote_meta);
21057
21325
  };
21058
21326
  return {
@@ -21117,14 +21385,12 @@ var to_bytes2 = async (data) => {
21117
21385
  const reader = data.getReader();
21118
21386
  const chunks = [];
21119
21387
  let total = 0;
21120
- while (true) {
21388
+ for (;; ) {
21121
21389
  const { done, value } = await reader.read();
21122
21390
  if (done)
21123
21391
  break;
21124
- if (value !== undefined) {
21125
- chunks.push(value);
21126
- total += value.byteLength;
21127
- }
21392
+ chunks.push(value);
21393
+ total += value.byteLength;
21128
21394
  }
21129
21395
  const out = new Uint8Array(total);
21130
21396
  let off = 0;
@@ -21135,7 +21401,7 @@ var to_bytes2 = async (data) => {
21135
21401
  return out;
21136
21402
  };
21137
21403
  var translate_http_error = (e, operation) => {
21138
- const message = e.kind === "http" ? `HTTP ${e.status} ${e.status_text}` : e.kind === "network" ? `network error: ${String(e.cause)}` : `decode error: ${e.message}`;
21404
+ const message = e.kind === "http" ? `HTTP ${String(e.status)} ${e.status_text}` : e.kind === "network" ? `network error: ${String(e.cause)}` : `decode error: ${e.message}`;
21139
21405
  return { kind: "storage_error", cause: new Error(message), operation };
21140
21406
  };
21141
21407
 
@@ -21231,8 +21497,8 @@ function validate_artifact_paths(input) {
21231
21497
  { name: "pipeline_path", path: input.pipeline_path },
21232
21498
  { name: "grants_path", path: input.grants_path }
21233
21499
  ];
21234
- for (const { name, path: path2 } of paths) {
21235
- if (!path2 || path2.trim() === "") {
21500
+ for (const { name, path: field_path } of paths) {
21501
+ if (!field_path || field_path.trim() === "") {
21236
21502
  return err({
21237
21503
  kind: "validation_error",
21238
21504
  message: `${name} must not be empty`
@@ -21265,13 +21531,13 @@ function build_manifest(inputs, artifacts) {
21265
21531
  message: "exactly one of bundle_ref or bundle_manifest_ref must be set"
21266
21532
  });
21267
21533
  }
21268
- const worker_base = has_single_file ? {
21534
+ const worker_base = artifacts.bundle_ref !== undefined ? {
21269
21535
  artifact_ref: artifacts.bundle_ref,
21270
21536
  size_bytes: artifacts.bundle?.length ?? 0,
21271
21537
  compatibility_date
21272
21538
  } : {
21273
21539
  artifact_ref: "",
21274
- bundle_manifest_ref: artifacts.bundle_manifest_ref,
21540
+ bundle_manifest_ref: artifacts.bundle_manifest_ref ?? "",
21275
21541
  size_bytes: artifacts.bundle_total_size_bytes ?? 0,
21276
21542
  compatibility_date
21277
21543
  };
@@ -21309,7 +21575,7 @@ function build_bundle_manifest_from_walk(walked, module_refs, main_module, compa
21309
21575
  if (module_refs.length !== walked.parts.length) {
21310
21576
  return err({
21311
21577
  kind: "schema_error",
21312
- message: `module_refs length (${module_refs.length}) doesn't match walked parts (${walked.parts.length})`
21578
+ message: `module_refs length (${String(module_refs.length)}) doesn't match walked parts (${String(walked.parts.length)})`
21313
21579
  });
21314
21580
  }
21315
21581
  const modules = walked.parts.map((part, idx) => ({
@@ -21334,7 +21600,7 @@ function build_asset_manifest_from_walk(walked, asset_refs, config = {}) {
21334
21600
  if (asset_refs.length !== walked.parts.length) {
21335
21601
  return err({
21336
21602
  kind: "schema_error",
21337
- message: `asset_refs length (${asset_refs.length}) doesn't match walked parts (${walked.parts.length})`
21603
+ message: `asset_refs length (${String(asset_refs.length)}) doesn't match walked parts (${String(walked.parts.length)})`
21338
21604
  });
21339
21605
  }
21340
21606
  const assets = walked.parts.map((part, idx) => ({
@@ -21364,7 +21630,7 @@ function compile_template_to_json(template) {
21364
21630
  }
21365
21631
  async function compile_pipeline_ts(pipeline_path) {
21366
21632
  const absolute_path = path.resolve(pipeline_path);
21367
- const cache_bust = `?t=${Date.now()}-${Math.floor(Math.random() * 1e6)}`;
21633
+ const cache_bust = `?t=${String(Date.now())}-${String(Math.floor(Math.random() * 1e6))}`;
21368
21634
  const import_url = `${absolute_path}${cache_bust}`;
21369
21635
  let module_ns;
21370
21636
  try {
@@ -21384,7 +21650,7 @@ var normalise_module_default = (default_export) => {
21384
21650
  }
21385
21651
  if (typeof default_export === "object" && "ok" in default_export) {
21386
21652
  const result = default_export;
21387
- if (result.ok === false) {
21653
+ if (!result.ok) {
21388
21654
  return err({ kind: "dsl_error", cause: result.error });
21389
21655
  }
21390
21656
  return validate_template_shape(result.value);
@@ -22370,11 +22636,15 @@ var render_and_write_one = async (templates_root, target_dir, entry, vars) => {
22370
22636
  var run_command = async (command, args, cwd) => {
22371
22637
  return new Promise((resolve) => {
22372
22638
  const proc = spawn(command, args, { cwd, stdio: "ignore" });
22373
- proc.on("error", (e) => resolve(err({ message: format_error(e), code: null })));
22639
+ proc.on("error", (e) => {
22640
+ resolve(err({ message: format_error(e), code: null }));
22641
+ });
22374
22642
  proc.on("close", (code) => {
22375
- if (code === 0)
22376
- return resolve(ok(undefined));
22377
- resolve(err({ message: `${command} exited with code ${code}`, code }));
22643
+ if (code === 0) {
22644
+ resolve(ok(undefined));
22645
+ return;
22646
+ }
22647
+ resolve(err({ message: `${command} exited with code ${String(code)}`, code }));
22378
22648
  });
22379
22649
  });
22380
22650
  };
@@ -22481,7 +22751,7 @@ var action_init = async (name, options) => {
22481
22751
  });
22482
22752
  if (!result.ok)
22483
22753
  return fail_with(spinner, format_scaffolder_error(result.error));
22484
- spinner.succeed(`Scaffolded ${result.value.files_written.length} files`);
22754
+ spinner.succeed(`Scaffolded ${String(result.value.files_written.length)} files`);
22485
22755
  print_next_steps2(result.value.target_dir, result.value.package_name, options.rollout);
22486
22756
  };
22487
22757
  var default_client_factory = () => {
@@ -22532,7 +22802,7 @@ var action_grants_list = (client_factory) => async (options) => {
22532
22802
  const result = await client.pipelines.grants.list(options.package);
22533
22803
  if (!result.ok)
22534
22804
  return fail_with(spinner, result.error.message);
22535
- spinner.succeed(`${result.value.length} grant(s)`);
22805
+ spinner.succeed(`${String(result.value.length)} grant(s)`);
22536
22806
  for (const g of result.value) {
22537
22807
  const granted_at = g.granted_at ?? source_default2.dim("pending");
22538
22808
  console.log(` ${source_default2.bold(g.id)} ${g.stage_name} ${source_default2.cyan(g.scope)} ${granted_at}`);
@@ -22567,6 +22837,15 @@ var resolve_mode = (options) => {
22567
22837
  const mode = explicit ?? (url !== undefined && url !== "" && token !== undefined && token !== "" ? "cloudflare-http" : "memory");
22568
22838
  return { mode, pipelines_url: url, pipelines_token: token };
22569
22839
  };
22840
+ var require_http_input = (resolved) => {
22841
+ if (resolved.pipelines_url === undefined || resolved.pipelines_token === undefined) {
22842
+ return {
22843
+ ok: false,
22844
+ error: "cloudflare-http mode requires DEVPAD_PIPELINES_URL + DEVPAD_PIPELINES_TOKEN (env or input)"
22845
+ };
22846
+ }
22847
+ return { ok: true, value: { pipelines_url: resolved.pipelines_url, pipelines_token: resolved.pipelines_token } };
22848
+ };
22570
22849
  var action_artifacts_upload = async (options) => {
22571
22850
  const spinner = make_spinner("Uploading artifacts to corpus...").start();
22572
22851
  if (options.bundle !== undefined && options.bundleDir !== undefined) {
@@ -22611,7 +22890,10 @@ var action_artifacts_upload = async (options) => {
22611
22890
  let pipeline_ref;
22612
22891
  let grants_ref;
22613
22892
  if (resolved.mode === "cloudflare-http") {
22614
- const http_input = { pipelines_url: resolved.pipelines_url, pipelines_token: resolved.pipelines_token };
22893
+ const http_input_result = require_http_input(resolved);
22894
+ if (!http_input_result.ok)
22895
+ return fail_with(spinner, http_input_result.error);
22896
+ const http_input = http_input_result.value;
22615
22897
  const refs = await upload_sidecars_http(http_input, { manifest_text, infra_plan, pipeline, grants });
22616
22898
  if (!refs.ok)
22617
22899
  return fail_with(spinner, refs.error);
@@ -22632,7 +22914,10 @@ var action_artifacts_upload = async (options) => {
22632
22914
  if (options.bundle !== undefined) {
22633
22915
  bundle_bytes = readFileSync3(options.bundle);
22634
22916
  if (resolved.mode === "cloudflare-http") {
22635
- const http_input = { pipelines_url: resolved.pipelines_url, pipelines_token: resolved.pipelines_token };
22917
+ const http_input_result = require_http_input(resolved);
22918
+ if (!http_input_result.ok)
22919
+ return fail_with(spinner, http_input_result.error);
22920
+ const http_input = http_input_result.value;
22636
22921
  const u8 = new Uint8Array(bundle_bytes.buffer, bundle_bytes.byteOffset, bundle_bytes.byteLength);
22637
22922
  const upload = await upload_blob_to_store(http_input, "worker-bundles", u8);
22638
22923
  if (!upload.ok)
@@ -22642,10 +22927,15 @@ var action_artifacts_upload = async (options) => {
22642
22927
  bundle_ref = `worker-bundles/${compute_hash2(bundle_bytes).slice(0, 12)}`;
22643
22928
  }
22644
22929
  } else {
22930
+ if (options.bundleDir === undefined)
22931
+ return fail_with(spinner, "--bundle-dir is required");
22645
22932
  const walk = walk_bundle_dir(options.bundleDir);
22646
22933
  if (!walk.ok)
22647
22934
  return fail_with(spinner, format_bundle_walk_error(walk.error));
22648
22935
  bundle_total_size_bytes = walk.value.total_size_bytes;
22936
+ if (options.mainModule === undefined) {
22937
+ return fail_with(spinner, "--main-module is required when --bundle-dir is supplied");
22938
+ }
22649
22939
  const main_module = options.mainModule;
22650
22940
  const has_main = walk.value.parts.some((p) => p.name === main_module);
22651
22941
  if (!has_main) {
@@ -22676,7 +22966,10 @@ var action_artifacts_upload = async (options) => {
22676
22966
  }
22677
22967
  let template_ref;
22678
22968
  if (resolved.mode === "cloudflare-http") {
22679
- const http_input = { pipelines_url: resolved.pipelines_url, pipelines_token: resolved.pipelines_token };
22969
+ const http_input_result = require_http_input(resolved);
22970
+ if (!http_input_result.ok)
22971
+ return fail_with(spinner, http_input_result.error);
22972
+ const http_input = http_input_result.value;
22680
22973
  const template_upload = await compile_and_upload_template(http_input, options.pipeline);
22681
22974
  if (!template_upload.ok)
22682
22975
  return fail_with(spinner, template_upload.error);
@@ -22702,7 +22995,10 @@ var action_artifacts_upload = async (options) => {
22702
22995
  return fail_with(spinner, manifest_result.error.message);
22703
22996
  let version_set_id;
22704
22997
  if (resolved.mode === "cloudflare-http") {
22705
- const http_input = { pipelines_url: resolved.pipelines_url, pipelines_token: resolved.pipelines_token };
22998
+ const http_input_result = require_http_input(resolved);
22999
+ if (!http_input_result.ok)
23000
+ return fail_with(spinner, http_input_result.error);
23001
+ const http_input = http_input_result.value;
22706
23002
  const upload = await upload_version_set(http_input, manifest_result.value);
22707
23003
  if (!upload.ok) {
22708
23004
  return fail_with(spinner, `version-set upload failed: ${format_http_error(upload.error)}`);
@@ -22714,7 +23010,7 @@ var action_artifacts_upload = async (options) => {
22714
23010
  const version_sets = version_set_store2(backend);
22715
23011
  const put_result = await version_sets.put(manifest_result.value);
22716
23012
  if (!put_result.ok) {
22717
- const error_msg = put_result.error.kind === "storage_error" ? put_result.error.cause?.message || "Storage error" : "Failed to store manifest";
23013
+ const error_msg = put_result.error.kind === "storage_error" ? put_result.error.cause.message || "Storage error" : "Failed to store manifest";
22718
23014
  return fail_with(spinner, error_msg);
22719
23015
  }
22720
23016
  version_set_id = put_result.value.version;
@@ -22731,7 +23027,7 @@ var action_artifacts_upload = async (options) => {
22731
23027
  };
22732
23028
  var format_http_error = (e) => {
22733
23029
  if (e.kind === "http")
22734
- return `HTTP ${e.status} ${e.status_text}`;
23030
+ return `HTTP ${String(e.status)} ${String(e.status_text)}`;
22735
23031
  if (e.kind === "network")
22736
23032
  return `network error: ${String(e.cause)}`;
22737
23033
  return e.message ?? "unknown error";
@@ -22755,7 +23051,7 @@ var format_asset_walk_error = (e) => {
22755
23051
  case "io_error":
22756
23052
  return `assets-dir read failed at ${e.path}: ${e.reason}`;
22757
23053
  case "asset_too_large":
22758
- return `asset exceeds CF limit (${e.limit_bytes} bytes): ${e.path} is ${e.size_bytes} bytes`;
23054
+ return `asset exceeds CF limit (${String(e.limit_bytes)} bytes): ${e.path} is ${String(e.size_bytes)} bytes`;
22759
23055
  }
22760
23056
  };
22761
23057
  var upload_sidecars_http = async (input, blobs) => {
@@ -22778,7 +23074,10 @@ var to_u8 = (b) => new Uint8Array(b.buffer, b.byteOffset, b.byteLength);
22778
23074
  var upload_bundle_directory = async (resolved, walk, build) => {
22779
23075
  const module_refs = [];
22780
23076
  if (resolved.mode === "cloudflare-http") {
22781
- const http_input = { pipelines_url: resolved.pipelines_url, pipelines_token: resolved.pipelines_token };
23077
+ const http_input_result = require_http_input(resolved);
23078
+ if (!http_input_result.ok)
23079
+ return http_input_result;
23080
+ const http_input = http_input_result.value;
22782
23081
  for (const part of walk.parts) {
22783
23082
  const upload = await upload_blob_to_store(http_input, "worker-modules", part.bytes);
22784
23083
  if (!upload.ok)
@@ -22798,7 +23097,10 @@ var upload_bundle_directory = async (resolved, walk, build) => {
22798
23097
  return { ok: false, error: manifest.error.message };
22799
23098
  const manifest_bytes = new TextEncoder().encode(JSON.stringify(manifest.value));
22800
23099
  if (resolved.mode === "cloudflare-http") {
22801
- const http_input = { pipelines_url: resolved.pipelines_url, pipelines_token: resolved.pipelines_token };
23100
+ const http_input_result = require_http_input(resolved);
23101
+ if (!http_input_result.ok)
23102
+ return http_input_result;
23103
+ const http_input = http_input_result.value;
22802
23104
  const upload = await upload_blob_to_store(http_input, "bundle-manifests", manifest_bytes);
22803
23105
  if (!upload.ok)
22804
23106
  return { ok: false, error: `bundle-manifests upload failed: ${format_http_error(upload.error)}` };
@@ -22809,7 +23111,10 @@ var upload_bundle_directory = async (resolved, walk, build) => {
22809
23111
  var upload_assets_directory = async (resolved, walk, config) => {
22810
23112
  const asset_refs = [];
22811
23113
  if (resolved.mode === "cloudflare-http") {
22812
- const http_input = { pipelines_url: resolved.pipelines_url, pipelines_token: resolved.pipelines_token };
23114
+ const http_input_result = require_http_input(resolved);
23115
+ if (!http_input_result.ok)
23116
+ return http_input_result;
23117
+ const http_input = http_input_result.value;
22813
23118
  for (const part of walk.parts) {
22814
23119
  const upload = await upload_blob_to_store(http_input, "asset-files", part.bytes);
22815
23120
  if (!upload.ok)
@@ -22826,7 +23131,10 @@ var upload_assets_directory = async (resolved, walk, config) => {
22826
23131
  return { ok: false, error: manifest.error.message };
22827
23132
  const manifest_bytes = new TextEncoder().encode(JSON.stringify(manifest.value));
22828
23133
  if (resolved.mode === "cloudflare-http") {
22829
- const http_input = { pipelines_url: resolved.pipelines_url, pipelines_token: resolved.pipelines_token };
23134
+ const http_input_result = require_http_input(resolved);
23135
+ if (!http_input_result.ok)
23136
+ return http_input_result;
23137
+ const http_input = http_input_result.value;
22830
23138
  const upload = await upload_blob_to_store(http_input, "asset-manifests", manifest_bytes);
22831
23139
  if (!upload.ok)
22832
23140
  return { ok: false, error: `asset-manifests upload failed: ${format_http_error(upload.error)}` };
@@ -22834,27 +23142,27 @@ var upload_assets_directory = async (resolved, walk, config) => {
22834
23142
  }
22835
23143
  return { ok: true, value: `asset-manifests/${compute_hash2(Buffer.from(manifest_bytes)).slice(0, 12)}` };
22836
23144
  };
23145
+ var try_parse_json_object = (text3) => {
23146
+ try {
23147
+ const parsed = JSON.parse(text3);
23148
+ return typeof parsed === "object" && parsed !== null && !Array.isArray(parsed) ? parsed : null;
23149
+ } catch {
23150
+ return null;
23151
+ }
23152
+ };
22837
23153
  var parse_asset_config = (raw) => {
22838
23154
  if (raw === undefined || raw === "")
22839
23155
  return { ok: true, value: {} };
22840
- const try_parse = (text3) => {
22841
- try {
22842
- const parsed = JSON.parse(text3);
22843
- return typeof parsed === "object" && parsed !== null && !Array.isArray(parsed) ? parsed : null;
22844
- } catch {
22845
- return null;
22846
- }
22847
- };
22848
- const inline = try_parse(raw);
23156
+ const inline = try_parse_json_object(raw);
22849
23157
  if (inline !== null)
22850
23158
  return { ok: true, value: inline };
22851
23159
  let file_text;
22852
23160
  try {
22853
23161
  file_text = readFileSync3(raw, "utf8");
22854
- } catch (e) {
23162
+ } catch {
22855
23163
  return { ok: false, error: `--asset-config is neither valid JSON nor a readable file path: ${raw}` };
22856
23164
  }
22857
- const from_file = try_parse(file_text);
23165
+ const from_file = try_parse_json_object(file_text);
22858
23166
  if (from_file === null)
22859
23167
  return { ok: false, error: `--asset-config file does not contain a JSON object: ${raw}` };
22860
23168
  return { ok: true, value: from_file };
@@ -22959,7 +23267,7 @@ var action_runs_events_list = (client_factory) => async (run_id) => {
22959
23267
  const result = await client.pipelines.events.list(run_id);
22960
23268
  if (!result.ok)
22961
23269
  return fail_with(spinner, result.error.message);
22962
- spinner.succeed(`${result.value.length} event(s)`);
23270
+ spinner.succeed(`${String(result.value.length)} event(s)`);
22963
23271
  for (const ev of result.value) {
22964
23272
  console.log(` ${source_default2.dim(ev.ts)} ${source_default2.cyan(ev.kind)} ${ev.stage_name} ${source_default2.dim(ev.id)}`);
22965
23273
  }
@@ -22969,11 +23277,11 @@ var action_packages_list = (client_factory) => async (options) => {
22969
23277
  const client = client_factory();
22970
23278
  const filter = options.project !== undefined ? { project_id: await resolve_project_id(client, options.project) } : undefined;
22971
23279
  if (filter !== undefined && filter.project_id === null)
22972
- return fail_with(spinner, `project "${options.project}" not found`);
23280
+ return fail_with(spinner, `project "${String(options.project)}" not found`);
22973
23281
  const result = await client.pipelines.packages.list(filter);
22974
23282
  if (!result.ok)
22975
23283
  return fail_with(spinner, result.error.message);
22976
- spinner.succeed(`${result.value.length} package(s)`);
23284
+ spinner.succeed(`${String(result.value.length)} package(s)`);
22977
23285
  for (const p of result.value) {
22978
23286
  const project_label = p.project_id ?? source_default2.dim("(unlinked)");
22979
23287
  const repo_label = p.repo_url ?? source_default2.dim("(no repo)");
@@ -22986,7 +23294,7 @@ var action_packages_get = (client_factory) => async (id2) => {
22986
23294
  const result = await client.pipelines.packages.get(id2);
22987
23295
  if (!result.ok)
22988
23296
  return fail_with(spinner, result.error.message);
22989
- spinner.succeed(`${result.value.id}`);
23297
+ spinner.succeed(result.value.id);
22990
23298
  console.log(JSON.stringify(result.value, null, 2));
22991
23299
  };
22992
23300
  var action_packages_create = (client_factory) => async (name_arg, options) => {
@@ -23089,22 +23397,22 @@ var action_oidc_trust_list = (client_factory) => async (options) => {
23089
23397
  const result = await client.pipelines.oidc_trust.list({ owner_id: owner_id2 });
23090
23398
  if (!result.ok)
23091
23399
  return fail_with(spinner, result.error.message);
23092
- spinner.succeed(`${result.value.length} policy(ies)`);
23400
+ spinner.succeed(`${String(result.value.length)} policy(ies)`);
23093
23401
  if (result.value.length === 0) {
23094
23402
  console.log(source_default2.dim(" no policies — run `pipelines oidc-trust add` to create one"));
23095
23403
  return;
23096
23404
  }
23097
23405
  for (const p of result.value) {
23098
- const refs_label = p.allowed_refs && p.allowed_refs.length > 0 ? p.allowed_refs.join(",") : source_default2.dim("any");
23099
- const envs_label = p.allowed_environments && p.allowed_environments.length > 0 ? p.allowed_environments.join(",") : source_default2.dim("any");
23406
+ const refs_label = p.allowed_refs.length > 0 ? p.allowed_refs.join(",") : source_default2.dim("any");
23407
+ const envs_label = p.allowed_environments.length > 0 ? p.allowed_environments.join(",") : source_default2.dim("any");
23100
23408
  const last_used = p.last_used_at ?? source_default2.dim("(never)");
23101
23409
  console.log(` ${source_default2.bold(p.id)}`);
23102
23410
  console.log(` owner: ${source_default2.cyan(p.github_owner)}/${p.repo_pattern}`);
23103
23411
  console.log(` aud: ${p.expected_audience}`);
23104
- console.log(` actions: ${(p.allowed_actions ?? []).join(",")}`);
23412
+ console.log(` actions: ${p.allowed_actions.join(",")}`);
23105
23413
  console.log(` refs: ${refs_label}`);
23106
23414
  console.log(` environments: ${envs_label}`);
23107
- console.log(` ttl: ${p.session_ttl_seconds}s`);
23415
+ console.log(` ttl: ${String(p.session_ttl_seconds)}s`);
23108
23416
  console.log(` last_used: ${last_used}`);
23109
23417
  }
23110
23418
  };
@@ -23165,8 +23473,8 @@ var action_oidc_trust_add = (client_factory) => async (options) => {
23165
23473
  console.log(` github_owner: ${result.value.github_owner}`);
23166
23474
  console.log(` repo_pattern: ${result.value.repo_pattern}`);
23167
23475
  console.log(` aud: ${result.value.expected_audience}`);
23168
- console.log(` actions: ${(result.value.allowed_actions ?? []).join(",")}`);
23169
- console.log(` ttl: ${result.value.session_ttl_seconds}s`);
23476
+ console.log(` actions: ${result.value.allowed_actions.join(",")}`);
23477
+ console.log(` ttl: ${String(result.value.session_ttl_seconds)}s`);
23170
23478
  };
23171
23479
  var action_oidc_trust_remove = (client_factory) => async (id2, options) => {
23172
23480
  const client = client_factory();
@@ -23207,16 +23515,16 @@ var action_analysis_templates_list = (client_factory) => async (options) => {
23207
23515
  const result = await client.pipelines.analysis_templates.list({ owner_id: owner_id2 });
23208
23516
  if (!result.ok)
23209
23517
  return fail_with(spinner, result.error.message);
23210
- spinner.succeed(`${result.value.length} template(s)`);
23518
+ spinner.succeed(`${String(result.value.length)} template(s)`);
23211
23519
  if (result.value.length === 0) {
23212
23520
  console.log(source_default2.dim(" no templates — run `pipelines analysis-templates create` to add one"));
23213
23521
  return;
23214
23522
  }
23215
23523
  for (const t of result.value) {
23216
- const dsl_text = typeof t.threshold_dsl === "string" ? t.threshold_dsl : String(t.threshold_dsl ?? "");
23524
+ const dsl_text = typeof t.threshold_dsl === "string" ? t.threshold_dsl : JSON.stringify(t.threshold_dsl ?? "");
23217
23525
  const dsl_lines = dsl_text.split(`
23218
23526
  `).filter((l) => l.trim().length > 0).length;
23219
- console.log(` ${source_default2.bold(t.id)} ${source_default2.cyan(t.name)} ${dsl_lines} threshold(s) ${t.window_ms}ms`);
23527
+ console.log(` ${source_default2.bold(t.id)} ${source_default2.cyan(t.name)} ${String(dsl_lines)} threshold(s) ${String(t.window_ms)}ms`);
23220
23528
  }
23221
23529
  };
23222
23530
  var action_analysis_templates_get = (client_factory) => async (id2, options) => {
@@ -23261,7 +23569,7 @@ var action_analysis_templates_create = (client_factory) => async (options) => {
23261
23569
  spinner.succeed(`created ${result.value.id}`);
23262
23570
  console.log(source_default2.green(` id: ${result.value.id}`));
23263
23571
  console.log(` name: ${result.value.name}`);
23264
- console.log(` window_ms: ${result.value.window_ms}`);
23572
+ console.log(` window_ms: ${String(result.value.window_ms)}`);
23265
23573
  };
23266
23574
  var action_analysis_templates_update = (client_factory) => async (id2, options) => {
23267
23575
  const spinner = make_spinner(`Updating ${id2}...`).start();
@@ -23340,8 +23648,8 @@ var action_workflow_migrate = (_client_factory) => async (package_name, options)
23340
23648
  `).length;
23341
23649
  const new_lines = rendered.value.split(`
23342
23650
  `).length;
23343
- console.log(` before: ${old_lines} lines`);
23344
- console.log(` after: ${new_lines} lines`);
23651
+ console.log(` before: ${String(old_lines)} lines`);
23652
+ console.log(` after: ${String(new_lines)} lines`);
23345
23653
  console.log(source_default2.dim(` omit --dry-run to write`));
23346
23654
  }
23347
23655
  return;
@@ -23356,8 +23664,8 @@ var action_workflow_migrate = (_client_factory) => async (package_name, options)
23356
23664
  `).length;
23357
23665
  const new_lines = rendered.value.split(`
23358
23666
  `).length;
23359
- console.log(` before: ${old_lines} lines${existed_before ? "" : " (new file)"}`);
23360
- console.log(` after: ${new_lines} lines`);
23667
+ console.log(` before: ${String(old_lines)} lines${existed_before ? "" : " (new file)"}`);
23668
+ console.log(` after: ${String(new_lines)} lines`);
23361
23669
  }
23362
23670
  };
23363
23671
  var resolve_owner_id = async (client) => {
@@ -23516,8 +23824,8 @@ projects.command("create").description("Create a new project").requiredOption("-
23516
23824
  description: options.description,
23517
23825
  private: options.private
23518
23826
  });
23519
- spinner.succeed(`Project "${result.name}" created`);
23520
- console.log(source_default.green(`ID: ${result.id}`));
23827
+ spinner.succeed(`Project "${String(result.name)}" created`);
23828
+ console.log(source_default.green(`ID: ${String(result.id)}`));
23521
23829
  } catch (error) {
23522
23830
  spinner.fail("Failed to create project");
23523
23831
  handleError(error);
@@ -23604,8 +23912,8 @@ tasks.command("create").description("Create a new task").requiredOption("-t, --t
23604
23912
  priority: options.priority.toUpperCase(),
23605
23913
  progress: options.status === "done" ? "DONE" : options.status === "in_progress" ? "IN_PROGRESS" : "TODO"
23606
23914
  });
23607
- spinner.succeed(`Task "${result.title}" created`);
23608
- console.log(source_default.green(`ID: ${result.id}`));
23915
+ spinner.succeed(`Task "${String(result.title)}" created`);
23916
+ console.log(source_default.green(`ID: ${String(result.id)}`));
23609
23917
  } catch (error) {
23610
23918
  spinner.fail("Failed to create task");
23611
23919
  handleError(error);
@@ -23622,7 +23930,7 @@ tasks.command("done <id>").description("Mark a task as done").action(async (id2)
23622
23930
  id: id2,
23623
23931
  progress: "DONE"
23624
23932
  });
23625
- spinner.succeed(`Task "${result.title}" marked as done`);
23933
+ spinner.succeed(`Task "${String(result.title)}" marked as done`);
23626
23934
  } catch (error) {
23627
23935
  spinner.fail("Failed to update task");
23628
23936
  handleError(error);
@@ -23639,7 +23947,7 @@ tasks.command("todo <id>").description("Mark a task as todo").action(async (id2)
23639
23947
  id: id2,
23640
23948
  progress: "TODO"
23641
23949
  });
23642
- spinner.succeed(`Task "${result.title}" marked as todo`);
23950
+ spinner.succeed(`Task "${String(result.title)}" marked as todo`);
23643
23951
  } catch (error) {
23644
23952
  spinner.fail("Failed to update task");
23645
23953
  handleError(error);
@@ -23710,8 +24018,8 @@ milestones.command("create").description("Create a new milestone").requiredOptio
23710
24018
  target_time: options.targetTime,
23711
24019
  target_version: options.targetVersion
23712
24020
  });
23713
- spinner.succeed(`Milestone "${result.name}" created`);
23714
- console.log(source_default.green(`ID: ${result.id}`));
24021
+ spinner.succeed(`Milestone "${String(result.name)}" created`);
24022
+ console.log(source_default.green(`ID: ${String(result.id)}`));
23715
24023
  } catch (error) {
23716
24024
  spinner.fail("Failed to create milestone");
23717
24025
  handleError(error);
@@ -23746,8 +24054,8 @@ goals.command("create").description("Create a new goal").requiredOption("-n, --n
23746
24054
  description: options.description,
23747
24055
  target_time: options.targetTime
23748
24056
  });
23749
- spinner.succeed(`Goal "${result.name}" created`);
23750
- console.log(source_default.green(`ID: ${result.id}`));
24057
+ spinner.succeed(`Goal "${String(result.name)}" created`);
24058
+ console.log(source_default.green(`ID: ${String(result.id)}`));
23751
24059
  } catch (error) {
23752
24060
  spinner.fail("Failed to create goal");
23753
24061
  handleError(error);