@devpad/cli 2.2.11 → 2.2.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +919 -596
  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 = {}) {
@@ -16566,10 +16757,11 @@ async function handleResponseError(response) {
16566
16757
  const errorMessage = errorText || "Request failed";
16567
16758
  let parsedError = null;
16568
16759
  try {
16569
- parsedError = JSON.parse(errorText);
16760
+ const raw = JSON.parse(errorText);
16761
+ parsedError = raw;
16570
16762
  } catch {}
16571
16763
  if (response.status === HTTP_STATUS.BAD_REQUEST && parsedError?.error?.name === "ZodError") {
16572
- const zodErrorDetails = parsedError.error?.issues ? JSON.stringify(parsedError.error) : errorMessage;
16764
+ const zodErrorDetails = parsedError.error.issues ? JSON.stringify(parsedError.error) : errorMessage;
16573
16765
  throw new ValidationError(zodErrorDetails);
16574
16766
  }
16575
16767
  throw new ApiError(errorMessage, { statusCode: response.status });
@@ -16579,43 +16771,43 @@ function handleNetworkError(error) {
16579
16771
  throw new NetworkError(message);
16580
16772
  }
16581
16773
  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;
16774
+ constructor(capacity) {
16775
+ this.capacity = capacity;
16776
+ this.entries = [];
16777
+ this.head = 0;
16778
+ this.tail = 0;
16779
+ this.count = 0;
16588
16780
  }
16589
16781
  latest() {
16590
- if (this._size === 0)
16782
+ if (this.count === 0)
16591
16783
  return null;
16592
- return this._entries[this._tail - 1] ?? null;
16784
+ return this.entries[this.tail - 1] ?? null;
16593
16785
  }
16594
16786
  list() {
16595
- if (this._size === 0)
16787
+ if (this.count === 0)
16596
16788
  return [];
16597
- if (this._head < this._tail) {
16598
- return this._entries.slice(this._head, this._tail);
16789
+ if (this.head < this.tail) {
16790
+ return this.entries.slice(this.head, this.tail);
16599
16791
  }
16600
- return this._entries.slice(this._head).concat(this._entries.slice(0, this._tail));
16792
+ return this.entries.slice(this.head).concat(this.entries.slice(0, this.tail));
16601
16793
  }
16602
16794
  add(item) {
16603
- if (this._size === this._capacity) {
16604
- this._head = (this._head + 1) % this._capacity;
16795
+ if (this.count === this.capacity) {
16796
+ this.head = (this.head + 1) % this.capacity;
16605
16797
  } else {
16606
- this._size++;
16798
+ this.count++;
16607
16799
  }
16608
- this._entries[this._tail] = item;
16609
- this._tail = (this._tail + 1) % this._capacity;
16800
+ this.entries[this.tail] = item;
16801
+ this.tail = (this.tail + 1) % this.capacity;
16610
16802
  }
16611
16803
  size() {
16612
- return this._size;
16804
+ return this.count;
16613
16805
  }
16614
16806
  clear() {
16615
- this._entries = [];
16616
- this._head = 0;
16617
- this._tail = 0;
16618
- this._size = 0;
16807
+ this.entries = [];
16808
+ this.head = 0;
16809
+ this.tail = 0;
16810
+ this.count = 0;
16619
16811
  }
16620
16812
  };
16621
16813
  var ApiClient = class {
@@ -16648,7 +16840,7 @@ var ApiClient = class {
16648
16840
  return url.toString();
16649
16841
  }
16650
16842
  generateRequestId() {
16651
- return `${Date.now()}-${Math.random().toString(36).substring(2, 11)}`;
16843
+ return `${String(Date.now())}-${Math.random().toString(36).substring(2, 11)}`;
16652
16844
  }
16653
16845
  async request(path, options = {}) {
16654
16846
  const { method = "GET", headers = {}, body, query } = options;
@@ -16699,7 +16891,7 @@ var ApiClient = class {
16699
16891
  if (this.debug) {
16700
16892
  console.log(`[ERROR][${this.category}] ${method} ${path} [${requestId}] failed`, {
16701
16893
  status: response.status,
16702
- duration: `${duration}ms`,
16894
+ duration: `${String(duration)}ms`,
16703
16895
  body,
16704
16896
  query
16705
16897
  });
@@ -16719,21 +16911,22 @@ var ApiClient = class {
16719
16911
  if (response.status === HTTP_STATUS.NO_CONTENT) {
16720
16912
  result = undefined;
16721
16913
  } else {
16722
- const text3 = await response.text();
16723
- if (!text3 || text3.trim() === "" || text3.trim() === "null") {
16914
+ const text22 = await response.text();
16915
+ if (!text22 || text22.trim() === "" || text22.trim() === "null") {
16724
16916
  result = undefined;
16725
16917
  } else {
16726
16918
  try {
16727
- result = JSON.parse(text3);
16728
- } catch (parseError) {
16729
- result = text3;
16919
+ const raw = JSON.parse(text22);
16920
+ result = raw;
16921
+ } catch {
16922
+ result = text22;
16730
16923
  }
16731
16924
  }
16732
16925
  }
16733
16926
  if (this.debug) {
16734
16927
  console.log(`[INFO][${this.category}] ${method} ${path} [${requestId}] completed`, {
16735
16928
  status: response.status,
16736
- duration: `${duration}ms`
16929
+ duration: `${String(duration)}ms`
16737
16930
  });
16738
16931
  }
16739
16932
  return result;
@@ -16742,7 +16935,7 @@ var ApiClient = class {
16742
16935
  if (this.debug) {
16743
16936
  console.log(`[ERROR][${this.category}] ${method} ${path} [${requestId}] failed`, {
16744
16937
  url,
16745
- duration: `${duration}ms`,
16938
+ duration: `${String(duration)}ms`,
16746
16939
  error: error instanceof Error ? error.message : String(error),
16747
16940
  body,
16748
16941
  query
@@ -16795,11 +16988,23 @@ var ApiClient = class {
16795
16988
  return headers;
16796
16989
  }
16797
16990
  };
16991
+ var string_field = (value, key) => {
16992
+ if (typeof value !== "object" || value === null || !(key in value))
16993
+ return;
16994
+ const field = value[key];
16995
+ return typeof field === "string" ? field : undefined;
16996
+ };
16997
+ var number_field = (value, key) => {
16998
+ if (typeof value !== "object" || value === null || !(key in value))
16999
+ return;
17000
+ const field = value[key];
17001
+ return typeof field === "number" ? field : undefined;
17002
+ };
16798
17003
  function wrap(fn) {
16799
17004
  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
17005
+ message: error instanceof Error ? error.message : "Unknown error",
17006
+ code: string_field(error, "code"),
17007
+ status_code: number_field(error, "statusCode") ?? number_field(error, "status_code")
16803
17008
  }));
16804
17009
  }
16805
17010
  var ApiClient2 = class {
@@ -16910,7 +17115,7 @@ var ApiClient2 = class {
16910
17115
  find: (id2) => wrap(async () => {
16911
17116
  try {
16912
17117
  return await this.clients.milestones.get(`/milestones/${id2}`);
16913
- } catch (error) {
17118
+ } catch {
16914
17119
  return null;
16915
17120
  }
16916
17121
  }),
@@ -17160,7 +17365,9 @@ var ApiClient2 = class {
17160
17365
  };
17161
17366
  this.user = {
17162
17367
  history: () => wrap(() => this.clients.auth.get("/user/history")),
17163
- preferences: (data) => wrap(() => this.clients.auth.patch("/user/preferences", { body: data }))
17368
+ preferences: (data) => wrap(() => this.clients.auth.patch("/user/preferences", {
17369
+ body: data
17370
+ }))
17164
17371
  };
17165
17372
  this.pulse = {
17166
17373
  summary: (input) => wrap(() => this.clients.pulse.get("/summary/:project_id".replace(":project_id", input.project_id), {
@@ -17182,7 +17389,9 @@ var ApiClient2 = class {
17182
17389
  query.limit = String(input.limit);
17183
17390
  if (input.cursor)
17184
17391
  query.cursor = input.cursor;
17185
- return this.clients.pulse.get("/events/:project_id".replace(":project_id", input.project_id), { query });
17392
+ return this.clients.pulse.get("/events/:project_id".replace(":project_id", input.project_id), {
17393
+ query
17394
+ });
17186
17395
  }),
17187
17396
  errors: (input) => wrap(() => {
17188
17397
  const query = {};
@@ -17194,7 +17403,9 @@ var ApiClient2 = class {
17194
17403
  }
17195
17404
  if (input.group_by_fingerprint)
17196
17405
  query.group_by_fingerprint = "true";
17197
- return this.clients.pulse.get("/errors/:project_id".replace(":project_id", input.project_id), { query });
17406
+ return this.clients.pulse.get("/errors/:project_id".replace(":project_id", input.project_id), {
17407
+ query
17408
+ });
17198
17409
  }),
17199
17410
  logs: (input) => wrap(() => {
17200
17411
  const query = {};
@@ -17222,7 +17433,9 @@ var ApiClient2 = class {
17222
17433
  query.route = input.route;
17223
17434
  if (input.percentiles && input.percentiles.length > 0)
17224
17435
  query.percentiles = input.percentiles.join(",");
17225
- return this.clients.pulse.get("/latency/:project_id".replace(":project_id", input.project_id), { query });
17436
+ return this.clients.pulse.get("/latency/:project_id".replace(":project_id", input.project_id), {
17437
+ query
17438
+ });
17226
17439
  }),
17227
17440
  subs: {
17228
17441
  list: (input) => wrap(() => this.clients.pulse.get("/admin/subs", { query: { project_id: input.project_id } })),
@@ -17334,13 +17547,13 @@ var ApiClient2 = class {
17334
17547
  }
17335
17548
  };
17336
17549
  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");
17550
+ this.api_key_field = options.api_key ?? "";
17551
+ this.auth_mode_field = options.auth_mode ?? (options.api_key?.startsWith("jwt:") ? "session" : options.api_key ? "key" : "cookie");
17339
17552
  const clientOptions = {
17340
17553
  base_url,
17341
17554
  api_key: options.api_key,
17342
17555
  max_history_size: options.max_history_size,
17343
- auth_mode: this._auth_mode,
17556
+ auth_mode: this.auth_mode_field,
17344
17557
  credentials: options.credentials,
17345
17558
  default_headers: options.default_headers,
17346
17559
  custom_fetch: options.custom_fetch
@@ -17369,12 +17582,55 @@ var ApiClient2 = class {
17369
17582
  return this.clients.projects.history();
17370
17583
  }
17371
17584
  getApiKey() {
17372
- return this._api_key;
17585
+ return this.api_key_field;
17373
17586
  }
17374
17587
  getAuthMode() {
17375
- return this._auth_mode;
17588
+ return this.auth_mode_field;
17376
17589
  }
17377
17590
  };
17591
+ var blog_posts = sqliteTable("blog_posts", {
17592
+ id: integer("id").primaryKey({ autoIncrement: true }),
17593
+ uuid: text("uuid").notNull().unique(),
17594
+ author_id: text("author_id").notNull(),
17595
+ slug: text("slug").notNull(),
17596
+ corpus_version: text("corpus_version"),
17597
+ category: text("category").notNull().default("root"),
17598
+ archived: integer("archived", { mode: "boolean" }).notNull().default(false),
17599
+ publish_at: integer("publish_at", { mode: "timestamp" }),
17600
+ created_at: integer("created_at", { mode: "timestamp" }).notNull().default(sql`(unixepoch())`),
17601
+ updated_at: integer("updated_at", { mode: "timestamp" }).notNull().default(sql`(unixepoch())`)
17602
+ }, (table3) => [unique("posts_author_slug_unique").on(table3.author_id, table3.slug)]);
17603
+ var blog_categories = sqliteTable("blog_categories", {
17604
+ id: integer("id").primaryKey({ autoIncrement: true }),
17605
+ owner_id: text("owner_id").notNull(),
17606
+ name: text("name").notNull(),
17607
+ parent: text("parent").default("root")
17608
+ }, (table3) => [unique("categories_owner_name_unique").on(table3.owner_id, table3.name)]);
17609
+ var blog_tags = sqliteTable("blog_tags", {
17610
+ post_id: integer("post_id").notNull().references(() => blog_posts.id, { onDelete: "cascade" }),
17611
+ tag: text("tag").notNull()
17612
+ }, (table3) => [primaryKey({ columns: [table3.post_id, table3.tag] })]);
17613
+ var blog_integrations = sqliteTable("blog_integrations", {
17614
+ id: integer("id").primaryKey({ autoIncrement: true }),
17615
+ user_id: text("user_id").notNull(),
17616
+ source: text("source").notNull(),
17617
+ location: text("location").notNull(),
17618
+ data: text("data", { mode: "json" }).$type(),
17619
+ last_fetch: integer("last_fetch", { mode: "timestamp" }),
17620
+ status: text("status").default("pending"),
17621
+ created_at: integer("created_at", { mode: "timestamp" }).notNull().default(sql`(unixepoch())`)
17622
+ });
17623
+ var blog_fetch_links = sqliteTable("blog_fetch_links", {
17624
+ id: integer("id").primaryKey({ autoIncrement: true }),
17625
+ post_id: integer("post_id").notNull().references(() => blog_posts.id, { onDelete: "cascade" }),
17626
+ integration_id: integer("integration_id").notNull().references(() => blog_integrations.id, { onDelete: "cascade" }),
17627
+ identifier: text("identifier").notNull()
17628
+ }, (table3) => [unique("fetch_links_integration_identifier_unique").on(table3.integration_id, table3.identifier)]);
17629
+ var blog_post_projects = sqliteTable("blog_post_projects", {
17630
+ post_id: integer("post_id").notNull().references(() => blog_posts.id, { onDelete: "cascade" }),
17631
+ project_id: text("project_id").notNull(),
17632
+ created_at: integer("created_at", { mode: "timestamp" }).notNull().default(sql`(unixepoch())`)
17633
+ }, (table3) => [primaryKey({ columns: [table3.post_id, table3.project_id] })]);
17378
17634
  function unwrap2(result) {
17379
17635
  if (!result.ok)
17380
17636
  throw new Error(result.error?.message ?? "Unknown error");
@@ -17409,26 +17665,33 @@ var github_branches = exports_external.object({
17409
17665
  owner: exports_external.string().describe("Repository owner"),
17410
17666
  repo: exports_external.string().describe("Repository name")
17411
17667
  });
17668
+ var define_tool = (def) => def;
17412
17669
  var tools = {
17413
- devpad_projects_list: {
17670
+ devpad_projects_list: define_tool({
17414
17671
  name: "devpad_projects_list",
17415
17672
  description: "List all projects (or only public ones)",
17416
17673
  inputSchema: project_filters,
17417
17674
  execute: async (client, input) => unwrap2(await client.projects.list(input))
17418
- },
17419
- devpad_projects_get: {
17675
+ }),
17676
+ devpad_projects_get: define_tool({
17420
17677
  name: "devpad_projects_get",
17421
17678
  description: "Get project by ID or name",
17422
17679
  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: {
17680
+ execute: async (client, input) => {
17681
+ if (input.id)
17682
+ return unwrap2(await client.projects.getById(input.id));
17683
+ if (!input.name)
17684
+ throw new Error("either id or name must be provided");
17685
+ return unwrap2(await client.projects.getByName(input.name));
17686
+ }
17687
+ }),
17688
+ devpad_projects_upsert: define_tool({
17426
17689
  name: "devpad_projects_upsert",
17427
17690
  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
17691
  inputSchema: upsert_project,
17429
17692
  execute: async (client, input) => unwrap2(await client.projects.upsert(input))
17430
- },
17431
- devpad_projects_config_save: {
17693
+ }),
17694
+ devpad_projects_config_save: define_tool({
17432
17695
  name: "devpad_projects_config_save",
17433
17696
  description: "Save project configuration",
17434
17697
  inputSchema: save_config_request,
@@ -17436,26 +17699,26 @@ var tools = {
17436
17699
  unwrap2(await client.projects.config.save(input));
17437
17700
  return { success: true };
17438
17701
  }
17439
- },
17440
- devpad_tasks_list: {
17702
+ }),
17703
+ devpad_tasks_list: define_tool({
17441
17704
  name: "devpad_tasks_list",
17442
17705
  description: "List tasks, optionally filtered by project or tag",
17443
17706
  inputSchema: task_filters,
17444
17707
  execute: async (client, input) => unwrap2(await client.tasks.list(input))
17445
- },
17446
- devpad_tasks_get: {
17708
+ }),
17709
+ devpad_tasks_get: define_tool({
17447
17710
  name: "devpad_tasks_get",
17448
17711
  description: "Get task by ID",
17449
17712
  inputSchema: task_by_id,
17450
17713
  execute: async (client, input) => unwrap2(await client.tasks.find(input.id))
17451
- },
17452
- devpad_tasks_upsert: {
17714
+ }),
17715
+ devpad_tasks_upsert: define_tool({
17453
17716
  name: "devpad_tasks_upsert",
17454
17717
  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
17718
  inputSchema: upsert_todo,
17456
17719
  execute: async (client, input) => unwrap2(await client.tasks.upsert(input))
17457
- },
17458
- devpad_tasks_save_tags: {
17720
+ }),
17721
+ devpad_tasks_save_tags: define_tool({
17459
17722
  name: "devpad_tasks_save_tags",
17460
17723
  description: "Save tags for tasks",
17461
17724
  inputSchema: save_tags_request,
@@ -17463,20 +17726,20 @@ var tools = {
17463
17726
  unwrap2(await client.tasks.saveTags(input));
17464
17727
  return { success: true };
17465
17728
  }
17466
- },
17467
- devpad_milestones_list: {
17729
+ }),
17730
+ devpad_milestones_list: define_tool({
17468
17731
  name: "devpad_milestones_list",
17469
17732
  description: "List milestones for authenticated user or by project",
17470
17733
  inputSchema: milestone_filters,
17471
17734
  execute: async (client, input) => unwrap2(input.project_id ? await client.milestones.getByProject(input.project_id) : await client.milestones.list())
17472
- },
17473
- devpad_milestones_get: {
17735
+ }),
17736
+ devpad_milestones_get: define_tool({
17474
17737
  name: "devpad_milestones_get",
17475
17738
  description: "Get milestone by ID",
17476
17739
  inputSchema: milestone_by_id,
17477
17740
  execute: async (client, input) => unwrap2(await client.milestones.find(input.id))
17478
- },
17479
- devpad_milestones_upsert: {
17741
+ }),
17742
+ devpad_milestones_upsert: define_tool({
17480
17743
  name: "devpad_milestones_upsert",
17481
17744
  description: "Create or update a milestone. Returns 409 if entity is protected by user - pass force=true to override.",
17482
17745
  inputSchema: upsert_milestone,
@@ -17494,20 +17757,20 @@ var tools = {
17494
17757
  target_version: input.target_version,
17495
17758
  finished_at: input.finished_at
17496
17759
  }))
17497
- },
17498
- devpad_goals_list: {
17760
+ }),
17761
+ devpad_goals_list: define_tool({
17499
17762
  name: "devpad_goals_list",
17500
17763
  description: "List goals for authenticated user",
17501
17764
  inputSchema: exports_external.object({}),
17502
17765
  execute: async (client) => unwrap2(await client.goals.list())
17503
- },
17504
- devpad_goals_get: {
17766
+ }),
17767
+ devpad_goals_get: define_tool({
17505
17768
  name: "devpad_goals_get",
17506
17769
  description: "Get goal by ID",
17507
17770
  inputSchema: goal_by_id,
17508
17771
  execute: async (client, input) => unwrap2(await client.goals.find(input.id))
17509
- },
17510
- devpad_goals_upsert: {
17772
+ }),
17773
+ devpad_goals_upsert: define_tool({
17511
17774
  name: "devpad_goals_upsert",
17512
17775
  description: "Create or update a goal. Returns 409 if entity is protected by user - pass force=true to override.",
17513
17776
  inputSchema: upsert_goal,
@@ -17523,26 +17786,26 @@ var tools = {
17523
17786
  target_time: input.target_time,
17524
17787
  finished_at: input.finished_at
17525
17788
  }))
17526
- },
17527
- devpad_tags_list: {
17789
+ }),
17790
+ devpad_tags_list: define_tool({
17528
17791
  name: "devpad_tags_list",
17529
17792
  description: "List tags for authenticated user",
17530
17793
  inputSchema: exports_external.object({}),
17531
17794
  execute: async (client) => unwrap2(await client.tags.list())
17532
- },
17533
- devpad_github_repos: {
17795
+ }),
17796
+ devpad_github_repos: define_tool({
17534
17797
  name: "devpad_github_repos",
17535
17798
  description: "List GitHub repositories for authenticated user",
17536
17799
  inputSchema: exports_external.object({}),
17537
17800
  execute: async (client) => unwrap2(await client.github.repos())
17538
- },
17539
- devpad_github_branches: {
17801
+ }),
17802
+ devpad_github_branches: define_tool({
17540
17803
  name: "devpad_github_branches",
17541
17804
  description: "List branches for a GitHub repository",
17542
17805
  inputSchema: github_branches,
17543
17806
  execute: async (client, input) => unwrap2(await client.github.branches(input.owner, input.repo))
17544
- },
17545
- devpad_projects_delete: {
17807
+ }),
17808
+ devpad_projects_delete: define_tool({
17546
17809
  name: "devpad_projects_delete",
17547
17810
  description: "Delete a project",
17548
17811
  inputSchema: exports_external.object({
@@ -17555,56 +17818,56 @@ var tools = {
17555
17818
  unwrap2(await client.projects.deleteProject(project2));
17556
17819
  return { success: true };
17557
17820
  }
17558
- },
17559
- devpad_projects_history: {
17821
+ }),
17822
+ devpad_projects_history: define_tool({
17560
17823
  name: "devpad_projects_history",
17561
17824
  description: "Get project history",
17562
17825
  inputSchema: exports_external.object({
17563
17826
  project_id: exports_external.string().describe("Project ID")
17564
17827
  }),
17565
17828
  execute: async (client, input) => unwrap2(await client.projects.history(input.project_id))
17566
- },
17567
- devpad_projects_specification: {
17829
+ }),
17830
+ devpad_projects_specification: define_tool({
17568
17831
  name: "devpad_projects_specification",
17569
17832
  description: "Fetch project specification from GitHub",
17570
17833
  inputSchema: exports_external.object({
17571
17834
  project_id: exports_external.string().describe("Project ID")
17572
17835
  }),
17573
17836
  execute: async (client, input) => unwrap2(await client.projects.specification(input.project_id))
17574
- },
17575
- devpad_projects_config_load: {
17837
+ }),
17838
+ devpad_projects_config_load: define_tool({
17576
17839
  name: "devpad_projects_config_load",
17577
17840
  description: "Load project configuration",
17578
17841
  inputSchema: exports_external.object({
17579
17842
  project_id: exports_external.string().describe("Project ID")
17580
17843
  }),
17581
17844
  execute: async (client, input) => unwrap2(await client.projects.config.load(input.project_id))
17582
- },
17583
- devpad_milestones_delete: {
17845
+ }),
17846
+ devpad_milestones_delete: define_tool({
17584
17847
  name: "devpad_milestones_delete",
17585
17848
  description: "Delete a milestone",
17586
17849
  inputSchema: exports_external.object({
17587
17850
  id: exports_external.string().describe("Milestone ID")
17588
17851
  }),
17589
17852
  execute: async (client, input) => unwrap2(await client.milestones.delete(input.id))
17590
- },
17591
- devpad_milestones_goals: {
17853
+ }),
17854
+ devpad_milestones_goals: define_tool({
17592
17855
  name: "devpad_milestones_goals",
17593
17856
  description: "Get goals for a milestone",
17594
17857
  inputSchema: exports_external.object({
17595
17858
  id: exports_external.string().describe("Milestone ID")
17596
17859
  }),
17597
17860
  execute: async (client, input) => unwrap2(await client.milestones.goals(input.id))
17598
- },
17599
- devpad_goals_delete: {
17861
+ }),
17862
+ devpad_goals_delete: define_tool({
17600
17863
  name: "devpad_goals_delete",
17601
17864
  description: "Delete a goal",
17602
17865
  inputSchema: exports_external.object({
17603
17866
  id: exports_external.string().describe("Goal ID")
17604
17867
  }),
17605
17868
  execute: async (client, input) => unwrap2(await client.goals.delete(input.id))
17606
- },
17607
- devpad_tasks_delete: {
17869
+ }),
17870
+ devpad_tasks_delete: define_tool({
17608
17871
  name: "devpad_tasks_delete",
17609
17872
  description: "Delete a task",
17610
17873
  inputSchema: exports_external.object({
@@ -17617,22 +17880,22 @@ var tools = {
17617
17880
  unwrap2(await client.tasks.deleteTask(task2));
17618
17881
  return { success: true };
17619
17882
  }
17620
- },
17621
- devpad_tasks_history: {
17883
+ }),
17884
+ devpad_tasks_history: define_tool({
17622
17885
  name: "devpad_tasks_history",
17623
17886
  description: "Get task history",
17624
17887
  inputSchema: exports_external.object({
17625
17888
  task_id: exports_external.string().describe("Task ID")
17626
17889
  }),
17627
17890
  execute: async (client, input) => unwrap2(await client.tasks.history.get(input.task_id))
17628
- },
17629
- devpad_user_history: {
17891
+ }),
17892
+ devpad_user_history: define_tool({
17630
17893
  name: "devpad_user_history",
17631
17894
  description: "Get user activity history",
17632
17895
  inputSchema: exports_external.object({}),
17633
17896
  execute: async (client) => unwrap2(await client.user.history())
17634
- },
17635
- devpad_user_preferences: {
17897
+ }),
17898
+ devpad_user_preferences: define_tool({
17636
17899
  name: "devpad_user_preferences",
17637
17900
  description: "Update user preferences",
17638
17901
  inputSchema: exports_external.object({
@@ -17640,8 +17903,8 @@ var tools = {
17640
17903
  task_view: exports_external.enum(["list", "grid"]).describe("Task view preference")
17641
17904
  }),
17642
17905
  execute: async (client, input) => unwrap2(await client.user.preferences(input))
17643
- },
17644
- devpad_activity_ai: {
17906
+ }),
17907
+ devpad_activity_ai: define_tool({
17645
17908
  name: "devpad_activity_ai",
17646
17909
  description: "Get AI activity feed - shows recent actions made via API/MCP grouped into sessions by time window",
17647
17910
  inputSchema: exports_external.object({
@@ -17649,104 +17912,69 @@ var tools = {
17649
17912
  since: exports_external.string().optional().describe("Only show activity after this ISO date")
17650
17913
  }),
17651
17914
  execute: async (client, input) => unwrap2(await client.activity.ai(input))
17652
- },
17653
- devpad_blog_posts_list: {
17915
+ }),
17916
+ devpad_blog_posts_list: define_tool({
17654
17917
  name: "devpad_blog_posts_list",
17655
17918
  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
- }),
17919
+ inputSchema: PostListParamsSchema.partial(),
17666
17920
  execute: async (client, input) => unwrap2(await client.blog.posts.list(input))
17667
- },
17668
- devpad_blog_posts_get: {
17921
+ }),
17922
+ devpad_blog_posts_get: define_tool({
17669
17923
  name: "devpad_blog_posts_get",
17670
17924
  description: "Get a blog post by slug",
17671
17925
  inputSchema: exports_external.object({
17672
17926
  slug: exports_external.string().describe("Post slug")
17673
17927
  }),
17674
17928
  execute: async (client, input) => unwrap2(await client.blog.posts.getBySlug(input.slug))
17675
- },
17676
- devpad_blog_posts_create: {
17929
+ }),
17930
+ devpad_blog_posts_create: define_tool({
17677
17931
  name: "devpad_blog_posts_create",
17678
17932
  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
- }),
17933
+ inputSchema: PostCreateSchema,
17691
17934
  execute: async (client, input) => unwrap2(await client.blog.posts.create(input))
17692
- },
17693
- devpad_blog_posts_update: {
17935
+ }),
17936
+ devpad_blog_posts_update: define_tool({
17694
17937
  name: "devpad_blog_posts_update",
17695
17938
  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
- }),
17939
+ inputSchema: PostUpdateSchema.extend({ uuid: exports_external.string().describe("Post UUID") }),
17709
17940
  execute: async (client, input) => {
17710
17941
  const { uuid, ...data } = input;
17711
17942
  return unwrap2(await client.blog.posts.update(uuid, data));
17712
17943
  }
17713
- },
17714
- devpad_blog_posts_delete: {
17944
+ }),
17945
+ devpad_blog_posts_delete: define_tool({
17715
17946
  name: "devpad_blog_posts_delete",
17716
17947
  description: "Delete a blog post by UUID",
17717
17948
  inputSchema: exports_external.object({
17718
17949
  uuid: exports_external.string().describe("Post UUID")
17719
17950
  }),
17720
17951
  execute: async (client, input) => unwrap2(await client.blog.posts.delete(input.uuid))
17721
- },
17722
- devpad_blog_tags_list: {
17952
+ }),
17953
+ devpad_blog_tags_list: define_tool({
17723
17954
  name: "devpad_blog_tags_list",
17724
17955
  description: "List all blog tags with post counts",
17725
17956
  inputSchema: exports_external.object({}),
17726
17957
  execute: async (client) => unwrap2(await client.blog.tags.list())
17727
- },
17728
- devpad_blog_categories_tree: {
17958
+ }),
17959
+ devpad_blog_categories_tree: define_tool({
17729
17960
  name: "devpad_blog_categories_tree",
17730
17961
  description: "Get the blog category tree",
17731
17962
  inputSchema: exports_external.object({}),
17732
17963
  execute: async (client) => unwrap2(await client.blog.categories.tree())
17733
- },
17734
- devpad_blog_categories_create: {
17964
+ }),
17965
+ devpad_blog_categories_create: define_tool({
17735
17966
  name: "devpad_blog_categories_create",
17736
17967
  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
- }),
17968
+ inputSchema: CategoryCreateSchema,
17741
17969
  execute: async (client, input) => unwrap2(await client.blog.categories.create(input))
17742
- },
17743
- devpad_blog_tokens_list: {
17970
+ }),
17971
+ devpad_blog_tokens_list: define_tool({
17744
17972
  name: "devpad_blog_tokens_list",
17745
17973
  description: "List blog access tokens",
17746
17974
  inputSchema: exports_external.object({}),
17747
17975
  execute: async (client) => unwrap2(await client.blog.tokens.list())
17748
- },
17749
- devpad_blog_tokens_create: {
17976
+ }),
17977
+ devpad_blog_tokens_create: define_tool({
17750
17978
  name: "devpad_blog_tokens_create",
17751
17979
  description: "Create a blog access token",
17752
17980
  inputSchema: exports_external.object({
@@ -17754,14 +17982,14 @@ var tools = {
17754
17982
  note: exports_external.string().optional().describe("Optional note")
17755
17983
  }),
17756
17984
  execute: async (client, input) => unwrap2(await client.blog.tokens.create(input))
17757
- },
17758
- devpad_media_profiles_list: {
17985
+ }),
17986
+ devpad_media_profiles_list: define_tool({
17759
17987
  name: "devpad_media_profiles_list",
17760
17988
  description: "List media profiles",
17761
17989
  inputSchema: exports_external.object({}),
17762
17990
  execute: async (client) => unwrap2(await client.media.profiles.list())
17763
- },
17764
- devpad_media_profiles_create: {
17991
+ }),
17992
+ devpad_media_profiles_create: define_tool({
17765
17993
  name: "devpad_media_profiles_create",
17766
17994
  description: "Create a media profile",
17767
17995
  inputSchema: exports_external.object({
@@ -17769,16 +17997,16 @@ var tools = {
17769
17997
  slug: exports_external.string().describe("Profile slug")
17770
17998
  }),
17771
17999
  execute: async (client, input) => unwrap2(await client.media.profiles.create(input))
17772
- },
17773
- devpad_media_profiles_get: {
18000
+ }),
18001
+ devpad_media_profiles_get: define_tool({
17774
18002
  name: "devpad_media_profiles_get",
17775
18003
  description: "Get a media profile by ID",
17776
18004
  inputSchema: exports_external.object({
17777
18005
  id: exports_external.string().describe("Profile ID")
17778
18006
  }),
17779
18007
  execute: async (client, input) => unwrap2(await client.media.profiles.get(input.id))
17780
- },
17781
- devpad_media_profiles_update: {
18008
+ }),
18009
+ devpad_media_profiles_update: define_tool({
17782
18010
  name: "devpad_media_profiles_update",
17783
18011
  description: "Update a media profile by ID",
17784
18012
  inputSchema: exports_external.object({
@@ -17790,32 +18018,32 @@ var tools = {
17790
18018
  const { id: id2, ...data } = input;
17791
18019
  return unwrap2(await client.media.profiles.update(id2, data));
17792
18020
  }
17793
- },
17794
- devpad_media_profiles_delete: {
18021
+ }),
18022
+ devpad_media_profiles_delete: define_tool({
17795
18023
  name: "devpad_media_profiles_delete",
17796
18024
  description: "Delete a media profile by ID",
17797
18025
  inputSchema: exports_external.object({
17798
18026
  id: exports_external.string().describe("Profile ID")
17799
18027
  }),
17800
18028
  execute: async (client, input) => unwrap2(await client.media.profiles.delete(input.id))
17801
- },
17802
- devpad_media_connections_list: {
18029
+ }),
18030
+ devpad_media_connections_list: define_tool({
17803
18031
  name: "devpad_media_connections_list",
17804
18032
  description: "List connections for a media profile",
17805
18033
  inputSchema: exports_external.object({
17806
18034
  profile_id: exports_external.string().describe("Profile ID")
17807
18035
  }),
17808
18036
  execute: async (client, input) => unwrap2(await client.media.connections.list(input.profile_id))
17809
- },
17810
- devpad_media_connections_refresh: {
18037
+ }),
18038
+ devpad_media_connections_refresh: define_tool({
17811
18039
  name: "devpad_media_connections_refresh",
17812
18040
  description: "Refresh a media connection",
17813
18041
  inputSchema: exports_external.object({
17814
18042
  account_id: exports_external.string().describe("Account/connection ID")
17815
18043
  }),
17816
18044
  execute: async (client, input) => unwrap2(await client.media.connections.refresh(input.account_id))
17817
- },
17818
- devpad_media_timeline_get: {
18045
+ }),
18046
+ devpad_media_timeline_get: define_tool({
17819
18047
  name: "devpad_media_timeline_get",
17820
18048
  description: "Get media timeline for a user",
17821
18049
  inputSchema: exports_external.object({
@@ -17827,8 +18055,8 @@ var tools = {
17827
18055
  const { user_id, ...params } = input;
17828
18056
  return unwrap2(await client.media.timeline.get(user_id, params));
17829
18057
  }
17830
- },
17831
- devpad_pulse_summary: {
18058
+ }),
18059
+ devpad_pulse_summary: define_tool({
17832
18060
  name: "devpad_pulse_summary",
17833
18061
  description: "Get summary analytics for a project (pageviews, sessions, errors, latency)",
17834
18062
  inputSchema: exports_external.object({
@@ -17836,8 +18064,8 @@ var tools = {
17836
18064
  range: exports_external.enum(["24h", "7d", "30d", "90d"]).describe("Time range")
17837
18065
  }),
17838
18066
  execute: async (client, input) => unwrap2(await client.pulse.summary({ project_id: input.project_id, range: input.range }))
17839
- },
17840
- devpad_pulse_events: {
18067
+ }),
18068
+ devpad_pulse_events: define_tool({
17841
18069
  name: "devpad_pulse_events",
17842
18070
  description: "List events for a project with optional filtering",
17843
18071
  inputSchema: exports_external.object({
@@ -17851,8 +18079,8 @@ var tools = {
17851
18079
  cursor: exports_external.string().optional().describe("Pagination cursor")
17852
18080
  }),
17853
18081
  execute: async (client, input) => unwrap2(await client.pulse.events(input))
17854
- },
17855
- devpad_pulse_errors: {
18082
+ }),
18083
+ devpad_pulse_errors: define_tool({
17856
18084
  name: "devpad_pulse_errors",
17857
18085
  description: "List error issues for a project, optionally grouped by fingerprint",
17858
18086
  inputSchema: exports_external.object({
@@ -17865,8 +18093,8 @@ var tools = {
17865
18093
  range: input.range,
17866
18094
  group_by_fingerprint: input.group_by_fingerprint
17867
18095
  }))
17868
- },
17869
- devpad_pulse_logs: {
18096
+ }),
18097
+ devpad_pulse_logs: define_tool({
17870
18098
  name: "devpad_pulse_logs",
17871
18099
  description: "List logs for a project with optional level and message filtering",
17872
18100
  inputSchema: exports_external.object({
@@ -17876,8 +18104,8 @@ var tools = {
17876
18104
  search: exports_external.string().optional().describe("Search in log messages")
17877
18105
  }),
17878
18106
  execute: async (client, input) => unwrap2(await client.pulse.logs(input))
17879
- },
17880
- devpad_pulse_latency: {
18107
+ }),
18108
+ devpad_pulse_latency: define_tool({
17881
18109
  name: "devpad_pulse_latency",
17882
18110
  description: "Get request latency metrics (p50, p95, p99) for a project",
17883
18111
  inputSchema: exports_external.object({
@@ -17887,16 +18115,16 @@ var tools = {
17887
18115
  percentiles: exports_external.array(exports_external.number()).optional().describe("Percentiles to compute (default [50, 95, 99])")
17888
18116
  }),
17889
18117
  execute: async (client, input) => unwrap2(await client.pulse.latency(input))
17890
- },
17891
- devpad_alerts_list: {
18118
+ }),
18119
+ devpad_alerts_list: define_tool({
17892
18120
  name: "devpad_alerts_list",
17893
18121
  description: "List notification subscriptions (alerts) for a project",
17894
18122
  inputSchema: exports_external.object({
17895
18123
  project_id: exports_external.string().describe("Project ID")
17896
18124
  }),
17897
18125
  execute: async (client, input) => unwrap2(await client.pulse.subs.list(input))
17898
- },
17899
- devpad_alerts_subscribe: {
18126
+ }),
18127
+ devpad_alerts_subscribe: define_tool({
17900
18128
  name: "devpad_alerts_subscribe",
17901
18129
  description: "Create a new notification subscription (alert) for events",
17902
18130
  inputSchema: exports_external.object({
@@ -17907,16 +18135,16 @@ var tools = {
17907
18135
  cooldown_seconds: exports_external.number().optional().describe("Cooldown between notifications (default 60)")
17908
18136
  }),
17909
18137
  execute: async (client, input) => unwrap2(await client.pulse.subs.create(input))
17910
- },
17911
- devpad_alerts_unsubscribe: {
18138
+ }),
18139
+ devpad_alerts_unsubscribe: define_tool({
17912
18140
  name: "devpad_alerts_unsubscribe",
17913
18141
  description: "Delete a notification subscription by ID",
17914
18142
  inputSchema: exports_external.object({
17915
18143
  id: exports_external.string().describe("Subscription ID")
17916
18144
  }),
17917
18145
  execute: async (client, input) => unwrap2(await client.pulse.subs.delete(input.id))
17918
- },
17919
- devpad_pulse_key_create: {
18146
+ }),
18147
+ devpad_pulse_key_create: define_tool({
17920
18148
  name: "devpad_pulse_key_create",
17921
18149
  description: "Create a new ingest key for a project (returns plaintext once)",
17922
18150
  inputSchema: exports_external.object({
@@ -17925,8 +18153,8 @@ var tools = {
17925
18153
  rate_limit_per_min: exports_external.number().optional().describe("Rate limit in requests per minute (default 600)")
17926
18154
  }),
17927
18155
  execute: async (client, input) => unwrap2(await client.pulse.keys.create(input))
17928
- },
17929
- devpad_pipelines_list: {
18156
+ }),
18157
+ devpad_pipelines_list: define_tool({
17930
18158
  name: "devpad_pipelines_list",
17931
18159
  description: "List pipeline runs (newest first). Optionally filter by package and/or status; cap limit at 200.",
17932
18160
  inputSchema: exports_external.object({
@@ -17935,16 +18163,16 @@ var tools = {
17935
18163
  limit: exports_external.number().int().positive().max(200).optional().describe("Max rows to return (default 50, cap 200)")
17936
18164
  }),
17937
18165
  execute: async (client, input) => unwrap2(await client.pipelines.list(input))
17938
- },
17939
- devpad_pipelines_get: {
18166
+ }),
18167
+ devpad_pipelines_get: define_tool({
17940
18168
  name: "devpad_pipelines_get",
17941
18169
  description: "Get a pipeline run by ID",
17942
18170
  inputSchema: exports_external.object({
17943
18171
  run_id: exports_external.string().describe("Pipeline run ID")
17944
18172
  }),
17945
18173
  execute: async (client, input) => unwrap2(await client.pipelines.get(input.run_id))
17946
- },
17947
- devpad_pipelines_create: {
18174
+ }),
18175
+ devpad_pipelines_create: define_tool({
17948
18176
  name: "devpad_pipelines_create",
17949
18177
  description: "Create a new pipeline run",
17950
18178
  inputSchema: exports_external.object({
@@ -17952,8 +18180,8 @@ var tools = {
17952
18180
  version_set_id: exports_external.string().describe("Version set ID to deploy")
17953
18181
  }),
17954
18182
  execute: async (client, input) => unwrap2(await client.pipelines.create(input))
17955
- },
17956
- devpad_pipelines_approve: {
18183
+ }),
18184
+ devpad_pipelines_approve: define_tool({
17957
18185
  name: "devpad_pipelines_approve",
17958
18186
  description: "Approve or deny a stage in a pipeline run",
17959
18187
  inputSchema: exports_external.object({
@@ -17967,8 +18195,8 @@ var tools = {
17967
18195
  unwrap2(await client.pipelines.approve(input.run_id, input));
17968
18196
  return { success: true };
17969
18197
  }
17970
- },
17971
- devpad_pipelines_cancel: {
18198
+ }),
18199
+ devpad_pipelines_cancel: define_tool({
17972
18200
  name: "devpad_pipelines_cancel",
17973
18201
  description: "Cancel a pipeline run",
17974
18202
  inputSchema: exports_external.object({
@@ -17978,8 +18206,8 @@ var tools = {
17978
18206
  unwrap2(await client.pipelines.cancel(input.run_id));
17979
18207
  return { success: true };
17980
18208
  }
17981
- },
17982
- devpad_pipelines_rollback: {
18209
+ }),
18210
+ devpad_pipelines_rollback: define_tool({
17983
18211
  name: "devpad_pipelines_rollback",
17984
18212
  description: "Rollback a completed or failed pipeline run",
17985
18213
  inputSchema: exports_external.object({
@@ -17989,8 +18217,8 @@ var tools = {
17989
18217
  unwrap2(await client.pipelines.rollback(input.run_id));
17990
18218
  return { success: true };
17991
18219
  }
17992
- },
17993
- devpad_pipelines_runs_events_ingest: {
18220
+ }),
18221
+ devpad_pipelines_runs_events_ingest: define_tool({
17994
18222
  name: "devpad_pipelines_runs_events_ingest",
17995
18223
  description: 'Ingest an external webhook event against an in-flight pipeline run. Idempotent on (idempotency_key, payload). Server-side stamps payload.source = "external".',
17996
18224
  inputSchema: exports_external.object({
@@ -18006,24 +18234,24 @@ var tools = {
18006
18234
  payload: input.payload,
18007
18235
  idempotency_key: input.idempotency_key
18008
18236
  }))
18009
- },
18010
- devpad_pipelines_runs_events_list: {
18237
+ }),
18238
+ devpad_pipelines_runs_events_list: define_tool({
18011
18239
  name: "devpad_pipelines_runs_events_list",
18012
18240
  description: "List stored stage events for a pipeline run, newest-first",
18013
18241
  inputSchema: exports_external.object({
18014
18242
  run_id: exports_external.string().describe("Pipeline run ID")
18015
18243
  }),
18016
18244
  execute: async (client, input) => unwrap2(await client.pipelines.events.list(input.run_id))
18017
- },
18018
- devpad_pipelines_grants_list: {
18245
+ }),
18246
+ devpad_pipelines_grants_list: define_tool({
18019
18247
  name: "devpad_pipelines_grants_list",
18020
18248
  description: "List vault grants for a pipeline package",
18021
18249
  inputSchema: exports_external.object({
18022
18250
  package_id: exports_external.string().describe("Package ID to filter grants by")
18023
18251
  }),
18024
18252
  execute: async (client, input) => unwrap2(await client.pipelines.grants.list(input.package_id))
18025
- },
18026
- devpad_pipelines_grants_approve: {
18253
+ }),
18254
+ devpad_pipelines_grants_approve: define_tool({
18027
18255
  name: "devpad_pipelines_grants_approve",
18028
18256
  description: "Approve a pending vault grant request for a pipeline package",
18029
18257
  inputSchema: exports_external.object({
@@ -18031,8 +18259,8 @@ var tools = {
18031
18259
  user_id: exports_external.string().describe("User ID making the approval decision")
18032
18260
  }),
18033
18261
  execute: async (client, input) => unwrap2(await client.pipelines.grants.approve(input.grant_id, input.user_id))
18034
- },
18035
- devpad_pipelines_grants_deny: {
18262
+ }),
18263
+ devpad_pipelines_grants_deny: define_tool({
18036
18264
  name: "devpad_pipelines_grants_deny",
18037
18265
  description: "Deny a pending vault grant request for a pipeline package",
18038
18266
  inputSchema: exports_external.object({
@@ -18041,24 +18269,24 @@ var tools = {
18041
18269
  reason: exports_external.string().optional().describe("Optional reason for the denial")
18042
18270
  }),
18043
18271
  execute: async (client, input) => unwrap2(await client.pipelines.grants.deny(input.grant_id, input.user_id, input.reason))
18044
- },
18045
- devpad_pipelines_packages_list: {
18272
+ }),
18273
+ devpad_pipelines_packages_list: define_tool({
18046
18274
  name: "devpad_pipelines_packages_list",
18047
18275
  description: "List pipeline packages. Optionally filter by linked devpad project_id; unlinked packages have project_id = null.",
18048
18276
  inputSchema: exports_external.object({
18049
18277
  project_id: exports_external.string().optional().describe("Filter packages by linked devpad project")
18050
18278
  }),
18051
18279
  execute: async (client, input) => unwrap2(await client.pipelines.packages.list(input))
18052
- },
18053
- devpad_pipelines_packages_get: {
18280
+ }),
18281
+ devpad_pipelines_packages_get: define_tool({
18054
18282
  name: "devpad_pipelines_packages_get",
18055
18283
  description: "Get a pipeline package by ID",
18056
18284
  inputSchema: exports_external.object({
18057
18285
  package_id: exports_external.string().describe("Pipeline package ID")
18058
18286
  }),
18059
18287
  execute: async (client, input) => unwrap2(await client.pipelines.packages.get(input.package_id))
18060
- },
18061
- devpad_pipelines_packages_create: {
18288
+ }),
18289
+ devpad_pipelines_packages_create: define_tool({
18062
18290
  name: "devpad_pipelines_packages_create",
18063
18291
  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
18292
  inputSchema: exports_external.object({
@@ -18070,8 +18298,8 @@ var tools = {
18070
18298
  default_template_ref: exports_external.string().optional().describe("Optional default pipeline template ref")
18071
18299
  }),
18072
18300
  execute: async (client, input) => unwrap2(await client.pipelines.packages.create(input))
18073
- },
18074
- devpad_pipelines_packages_update: {
18301
+ }),
18302
+ devpad_pipelines_packages_update: define_tool({
18075
18303
  name: "devpad_pipelines_packages_update",
18076
18304
  description: "Partially update a pipeline package. Only the provided fields are touched.",
18077
18305
  inputSchema: exports_external.object({
@@ -18085,24 +18313,24 @@ var tools = {
18085
18313
  const { id: id2, ...patch } = input;
18086
18314
  return unwrap2(await client.pipelines.packages.update(id2, patch));
18087
18315
  }
18088
- },
18089
- devpad_pipelines_packages_delete: {
18316
+ }),
18317
+ devpad_pipelines_packages_delete: define_tool({
18090
18318
  name: "devpad_pipelines_packages_delete",
18091
18319
  description: "Delete a pipeline package. Refuses with conflict if existing pipeline_run rows still reference the package.",
18092
18320
  inputSchema: exports_external.object({
18093
18321
  id: exports_external.string().describe("Pipeline package ID")
18094
18322
  }),
18095
18323
  execute: async (client, input) => unwrap2(await client.pipelines.packages.delete(input.id))
18096
- },
18097
- devpad_pipelines_analysis_templates_list: {
18324
+ }),
18325
+ devpad_pipelines_analysis_templates_list: define_tool({
18098
18326
  name: "devpad_pipelines_analysis_templates_list",
18099
18327
  description: "List pipeline analysis templates for an owner. Each row encodes the threshold DSL + window referenced by analysis-gate evaluations.",
18100
18328
  inputSchema: exports_external.object({
18101
18329
  owner_id: exports_external.string().describe("Devpad user ID whose templates to list")
18102
18330
  }),
18103
18331
  execute: async (client, input) => unwrap2(await client.pipelines.analysis_templates.list(input))
18104
- },
18105
- devpad_pipelines_analysis_templates_get: {
18332
+ }),
18333
+ devpad_pipelines_analysis_templates_get: define_tool({
18106
18334
  name: "devpad_pipelines_analysis_templates_get",
18107
18335
  description: "Get a single pipeline analysis template by id, scoped to its owner.",
18108
18336
  inputSchema: exports_external.object({
@@ -18110,8 +18338,8 @@ var tools = {
18110
18338
  owner_id: exports_external.string().describe("Owner ID (must match the template's owner)")
18111
18339
  }),
18112
18340
  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: {
18341
+ }),
18342
+ devpad_pipelines_analysis_templates_create: define_tool({
18115
18343
  name: "devpad_pipelines_analysis_templates_create",
18116
18344
  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
18345
  inputSchema: exports_external.object({
@@ -18122,8 +18350,8 @@ var tools = {
18122
18350
  window_ms: exports_external.number().int().positive().optional().describe("Analysis window in milliseconds. Default: 600000")
18123
18351
  }),
18124
18352
  execute: async (client, input) => unwrap2(await client.pipelines.analysis_templates.create(input))
18125
- },
18126
- devpad_pipelines_analysis_templates_update: {
18353
+ }),
18354
+ devpad_pipelines_analysis_templates_update: define_tool({
18127
18355
  name: "devpad_pipelines_analysis_templates_update",
18128
18356
  description: "Partially update a pipeline analysis template. Only the supplied fields are touched. Re-validates threshold_dsl when present.",
18129
18357
  inputSchema: exports_external.object({
@@ -18138,8 +18366,8 @@ var tools = {
18138
18366
  const { id: id2, ...patch } = input;
18139
18367
  return unwrap2(await client.pipelines.analysis_templates.update(id2, patch));
18140
18368
  }
18141
- },
18142
- devpad_pipelines_analysis_templates_delete: {
18369
+ }),
18370
+ devpad_pipelines_analysis_templates_delete: define_tool({
18143
18371
  name: "devpad_pipelines_analysis_templates_delete",
18144
18372
  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
18373
  inputSchema: exports_external.object({
@@ -18147,16 +18375,16 @@ var tools = {
18147
18375
  owner_id: exports_external.string().describe("Owner ID (must match the template's owner)")
18148
18376
  }),
18149
18377
  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: {
18378
+ }),
18379
+ devpad_pipelines_oidc_trust_list: define_tool({
18152
18380
  name: "devpad_pipelines_oidc_trust_list",
18153
18381
  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
18382
  inputSchema: exports_external.object({
18155
18383
  owner_id: exports_external.string().describe("User ID whose trust policies to list")
18156
18384
  }),
18157
18385
  execute: async (client, input) => unwrap2(await client.pipelines.oidc_trust.list(input))
18158
- },
18159
- devpad_pipelines_oidc_trust_create: {
18386
+ }),
18387
+ devpad_pipelines_oidc_trust_create: define_tool({
18160
18388
  name: "devpad_pipelines_oidc_trust_create",
18161
18389
  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
18390
  inputSchema: exports_external.object({
@@ -18170,8 +18398,8 @@ var tools = {
18170
18398
  session_ttl_seconds: exports_external.number().int().positive().optional().describe("Session token TTL. Default: 900 (15 min)")
18171
18399
  }),
18172
18400
  execute: async (client, input) => unwrap2(await client.pipelines.oidc_trust.create(input))
18173
- },
18174
- devpad_pipelines_oidc_trust_update: {
18401
+ }),
18402
+ devpad_pipelines_oidc_trust_update: define_tool({
18175
18403
  name: "devpad_pipelines_oidc_trust_update",
18176
18404
  description: "Partially update a GitHub Actions OIDC trust policy. Only the supplied fields are touched; validation runs server-side against the merged record.",
18177
18405
  inputSchema: exports_external.object({
@@ -18189,8 +18417,8 @@ var tools = {
18189
18417
  const { id: id2, ...patch } = input;
18190
18418
  return unwrap2(await client.pipelines.oidc_trust.update(id2, patch));
18191
18419
  }
18192
- },
18193
- devpad_pipelines_oidc_trust_delete: {
18420
+ }),
18421
+ devpad_pipelines_oidc_trust_delete: define_tool({
18194
18422
  name: "devpad_pipelines_oidc_trust_delete",
18195
18423
  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
18424
  inputSchema: exports_external.object({
@@ -18198,7 +18426,7 @@ var tools = {
18198
18426
  owner_id: exports_external.string().describe("Owner ID (must match the policy's owner)")
18199
18427
  }),
18200
18428
  execute: async (client, input) => unwrap2(await client.pipelines.oidc_trust.delete(input.id, { owner_id: input.owner_id }))
18201
- }
18429
+ })
18202
18430
  };
18203
18431
  var toolNames = Object.keys(tools);
18204
18432
  function getTool(name) {
@@ -18720,6 +18948,9 @@ import { createInterface } from "node:readline/promises";
18720
18948
 
18721
18949
  // ../api/dist/index.js
18722
18950
  init_dist();
18951
+ init_dist();
18952
+ init_drizzle_orm();
18953
+ init_sqlite_core();
18723
18954
  init_zod();
18724
18955
  var ApiError2 = class _ApiError2 extends Error {
18725
18956
  constructor(message, options = {}) {
@@ -18778,10 +19009,11 @@ async function handleResponseError2(response) {
18778
19009
  const errorMessage = errorText || "Request failed";
18779
19010
  let parsedError = null;
18780
19011
  try {
18781
- parsedError = JSON.parse(errorText);
19012
+ const raw = JSON.parse(errorText);
19013
+ parsedError = raw;
18782
19014
  } catch {}
18783
19015
  if (response.status === HTTP_STATUS2.BAD_REQUEST && parsedError?.error?.name === "ZodError") {
18784
- const zodErrorDetails = parsedError.error?.issues ? JSON.stringify(parsedError.error) : errorMessage;
19016
+ const zodErrorDetails = parsedError.error.issues ? JSON.stringify(parsedError.error) : errorMessage;
18785
19017
  throw new ValidationError2(zodErrorDetails);
18786
19018
  }
18787
19019
  throw new ApiError2(errorMessage, { statusCode: response.status });
@@ -18791,43 +19023,43 @@ function handleNetworkError2(error) {
18791
19023
  throw new NetworkError2(message);
18792
19024
  }
18793
19025
  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;
19026
+ constructor(capacity) {
19027
+ this.capacity = capacity;
19028
+ this.entries = [];
19029
+ this.head = 0;
19030
+ this.tail = 0;
19031
+ this.count = 0;
18800
19032
  }
18801
19033
  latest() {
18802
- if (this._size === 0)
19034
+ if (this.count === 0)
18803
19035
  return null;
18804
- return this._entries[this._tail - 1] ?? null;
19036
+ return this.entries[this.tail - 1] ?? null;
18805
19037
  }
18806
19038
  list() {
18807
- if (this._size === 0)
19039
+ if (this.count === 0)
18808
19040
  return [];
18809
- if (this._head < this._tail) {
18810
- return this._entries.slice(this._head, this._tail);
19041
+ if (this.head < this.tail) {
19042
+ return this.entries.slice(this.head, this.tail);
18811
19043
  }
18812
- return this._entries.slice(this._head).concat(this._entries.slice(0, this._tail));
19044
+ return this.entries.slice(this.head).concat(this.entries.slice(0, this.tail));
18813
19045
  }
18814
19046
  add(item) {
18815
- if (this._size === this._capacity) {
18816
- this._head = (this._head + 1) % this._capacity;
19047
+ if (this.count === this.capacity) {
19048
+ this.head = (this.head + 1) % this.capacity;
18817
19049
  } else {
18818
- this._size++;
19050
+ this.count++;
18819
19051
  }
18820
- this._entries[this._tail] = item;
18821
- this._tail = (this._tail + 1) % this._capacity;
19052
+ this.entries[this.tail] = item;
19053
+ this.tail = (this.tail + 1) % this.capacity;
18822
19054
  }
18823
19055
  size() {
18824
- return this._size;
19056
+ return this.count;
18825
19057
  }
18826
19058
  clear() {
18827
- this._entries = [];
18828
- this._head = 0;
18829
- this._tail = 0;
18830
- this._size = 0;
19059
+ this.entries = [];
19060
+ this.head = 0;
19061
+ this.tail = 0;
19062
+ this.count = 0;
18831
19063
  }
18832
19064
  };
18833
19065
  var ApiClient3 = class {
@@ -18860,7 +19092,7 @@ var ApiClient3 = class {
18860
19092
  return url.toString();
18861
19093
  }
18862
19094
  generateRequestId() {
18863
- return `${Date.now()}-${Math.random().toString(36).substring(2, 11)}`;
19095
+ return `${String(Date.now())}-${Math.random().toString(36).substring(2, 11)}`;
18864
19096
  }
18865
19097
  async request(path, options = {}) {
18866
19098
  const { method = "GET", headers = {}, body, query } = options;
@@ -18911,7 +19143,7 @@ var ApiClient3 = class {
18911
19143
  if (this.debug) {
18912
19144
  console.log(`[ERROR][${this.category}] ${method} ${path} [${requestId}] failed`, {
18913
19145
  status: response.status,
18914
- duration: `${duration}ms`,
19146
+ duration: `${String(duration)}ms`,
18915
19147
  body,
18916
19148
  query
18917
19149
  });
@@ -18931,21 +19163,22 @@ var ApiClient3 = class {
18931
19163
  if (response.status === HTTP_STATUS2.NO_CONTENT) {
18932
19164
  result = undefined;
18933
19165
  } else {
18934
- const text3 = await response.text();
18935
- if (!text3 || text3.trim() === "" || text3.trim() === "null") {
19166
+ const text22 = await response.text();
19167
+ if (!text22 || text22.trim() === "" || text22.trim() === "null") {
18936
19168
  result = undefined;
18937
19169
  } else {
18938
19170
  try {
18939
- result = JSON.parse(text3);
18940
- } catch (parseError) {
18941
- result = text3;
19171
+ const raw = JSON.parse(text22);
19172
+ result = raw;
19173
+ } catch {
19174
+ result = text22;
18942
19175
  }
18943
19176
  }
18944
19177
  }
18945
19178
  if (this.debug) {
18946
19179
  console.log(`[INFO][${this.category}] ${method} ${path} [${requestId}] completed`, {
18947
19180
  status: response.status,
18948
- duration: `${duration}ms`
19181
+ duration: `${String(duration)}ms`
18949
19182
  });
18950
19183
  }
18951
19184
  return result;
@@ -18954,7 +19187,7 @@ var ApiClient3 = class {
18954
19187
  if (this.debug) {
18955
19188
  console.log(`[ERROR][${this.category}] ${method} ${path} [${requestId}] failed`, {
18956
19189
  url,
18957
- duration: `${duration}ms`,
19190
+ duration: `${String(duration)}ms`,
18958
19191
  error: error instanceof Error ? error.message : String(error),
18959
19192
  body,
18960
19193
  query
@@ -19007,11 +19240,23 @@ var ApiClient3 = class {
19007
19240
  return headers;
19008
19241
  }
19009
19242
  };
19243
+ var string_field2 = (value, key) => {
19244
+ if (typeof value !== "object" || value === null || !(key in value))
19245
+ return;
19246
+ const field = value[key];
19247
+ return typeof field === "string" ? field : undefined;
19248
+ };
19249
+ var number_field2 = (value, key) => {
19250
+ if (typeof value !== "object" || value === null || !(key in value))
19251
+ return;
19252
+ const field = value[key];
19253
+ return typeof field === "number" ? field : undefined;
19254
+ };
19010
19255
  function wrap2(fn) {
19011
19256
  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
19257
+ message: error instanceof Error ? error.message : "Unknown error",
19258
+ code: string_field2(error, "code"),
19259
+ status_code: number_field2(error, "statusCode") ?? number_field2(error, "status_code")
19015
19260
  }));
19016
19261
  }
19017
19262
  var ApiClient22 = class {
@@ -19122,7 +19367,7 @@ var ApiClient22 = class {
19122
19367
  find: (id2) => wrap2(async () => {
19123
19368
  try {
19124
19369
  return await this.clients.milestones.get(`/milestones/${id2}`);
19125
- } catch (error) {
19370
+ } catch {
19126
19371
  return null;
19127
19372
  }
19128
19373
  }),
@@ -19372,7 +19617,9 @@ var ApiClient22 = class {
19372
19617
  };
19373
19618
  this.user = {
19374
19619
  history: () => wrap2(() => this.clients.auth.get("/user/history")),
19375
- preferences: (data) => wrap2(() => this.clients.auth.patch("/user/preferences", { body: data }))
19620
+ preferences: (data) => wrap2(() => this.clients.auth.patch("/user/preferences", {
19621
+ body: data
19622
+ }))
19376
19623
  };
19377
19624
  this.pulse = {
19378
19625
  summary: (input) => wrap2(() => this.clients.pulse.get("/summary/:project_id".replace(":project_id", input.project_id), {
@@ -19394,7 +19641,9 @@ var ApiClient22 = class {
19394
19641
  query.limit = String(input.limit);
19395
19642
  if (input.cursor)
19396
19643
  query.cursor = input.cursor;
19397
- return this.clients.pulse.get("/events/:project_id".replace(":project_id", input.project_id), { query });
19644
+ return this.clients.pulse.get("/events/:project_id".replace(":project_id", input.project_id), {
19645
+ query
19646
+ });
19398
19647
  }),
19399
19648
  errors: (input) => wrap2(() => {
19400
19649
  const query = {};
@@ -19406,7 +19655,9 @@ var ApiClient22 = class {
19406
19655
  }
19407
19656
  if (input.group_by_fingerprint)
19408
19657
  query.group_by_fingerprint = "true";
19409
- return this.clients.pulse.get("/errors/:project_id".replace(":project_id", input.project_id), { query });
19658
+ return this.clients.pulse.get("/errors/:project_id".replace(":project_id", input.project_id), {
19659
+ query
19660
+ });
19410
19661
  }),
19411
19662
  logs: (input) => wrap2(() => {
19412
19663
  const query = {};
@@ -19434,7 +19685,9 @@ var ApiClient22 = class {
19434
19685
  query.route = input.route;
19435
19686
  if (input.percentiles && input.percentiles.length > 0)
19436
19687
  query.percentiles = input.percentiles.join(",");
19437
- return this.clients.pulse.get("/latency/:project_id".replace(":project_id", input.project_id), { query });
19688
+ return this.clients.pulse.get("/latency/:project_id".replace(":project_id", input.project_id), {
19689
+ query
19690
+ });
19438
19691
  }),
19439
19692
  subs: {
19440
19693
  list: (input) => wrap2(() => this.clients.pulse.get("/admin/subs", { query: { project_id: input.project_id } })),
@@ -19546,13 +19799,13 @@ var ApiClient22 = class {
19546
19799
  }
19547
19800
  };
19548
19801
  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");
19802
+ this.api_key_field = options.api_key ?? "";
19803
+ this.auth_mode_field = options.auth_mode ?? (options.api_key?.startsWith("jwt:") ? "session" : options.api_key ? "key" : "cookie");
19551
19804
  const clientOptions = {
19552
19805
  base_url,
19553
19806
  api_key: options.api_key,
19554
19807
  max_history_size: options.max_history_size,
19555
- auth_mode: this._auth_mode,
19808
+ auth_mode: this.auth_mode_field,
19556
19809
  credentials: options.credentials,
19557
19810
  default_headers: options.default_headers,
19558
19811
  custom_fetch: options.custom_fetch
@@ -19581,12 +19834,55 @@ var ApiClient22 = class {
19581
19834
  return this.clients.projects.history();
19582
19835
  }
19583
19836
  getApiKey() {
19584
- return this._api_key;
19837
+ return this.api_key_field;
19585
19838
  }
19586
19839
  getAuthMode() {
19587
- return this._auth_mode;
19840
+ return this.auth_mode_field;
19588
19841
  }
19589
19842
  };
19843
+ var blog_posts2 = sqliteTable("blog_posts", {
19844
+ id: integer("id").primaryKey({ autoIncrement: true }),
19845
+ uuid: text("uuid").notNull().unique(),
19846
+ author_id: text("author_id").notNull(),
19847
+ slug: text("slug").notNull(),
19848
+ corpus_version: text("corpus_version"),
19849
+ category: text("category").notNull().default("root"),
19850
+ archived: integer("archived", { mode: "boolean" }).notNull().default(false),
19851
+ publish_at: integer("publish_at", { mode: "timestamp" }),
19852
+ created_at: integer("created_at", { mode: "timestamp" }).notNull().default(sql`(unixepoch())`),
19853
+ updated_at: integer("updated_at", { mode: "timestamp" }).notNull().default(sql`(unixepoch())`)
19854
+ }, (table3) => [unique("posts_author_slug_unique").on(table3.author_id, table3.slug)]);
19855
+ var blog_categories2 = sqliteTable("blog_categories", {
19856
+ id: integer("id").primaryKey({ autoIncrement: true }),
19857
+ owner_id: text("owner_id").notNull(),
19858
+ name: text("name").notNull(),
19859
+ parent: text("parent").default("root")
19860
+ }, (table3) => [unique("categories_owner_name_unique").on(table3.owner_id, table3.name)]);
19861
+ var blog_tags2 = sqliteTable("blog_tags", {
19862
+ post_id: integer("post_id").notNull().references(() => blog_posts2.id, { onDelete: "cascade" }),
19863
+ tag: text("tag").notNull()
19864
+ }, (table3) => [primaryKey({ columns: [table3.post_id, table3.tag] })]);
19865
+ var blog_integrations2 = sqliteTable("blog_integrations", {
19866
+ id: integer("id").primaryKey({ autoIncrement: true }),
19867
+ user_id: text("user_id").notNull(),
19868
+ source: text("source").notNull(),
19869
+ location: text("location").notNull(),
19870
+ data: text("data", { mode: "json" }).$type(),
19871
+ last_fetch: integer("last_fetch", { mode: "timestamp" }),
19872
+ status: text("status").default("pending"),
19873
+ created_at: integer("created_at", { mode: "timestamp" }).notNull().default(sql`(unixepoch())`)
19874
+ });
19875
+ var blog_fetch_links2 = sqliteTable("blog_fetch_links", {
19876
+ id: integer("id").primaryKey({ autoIncrement: true }),
19877
+ post_id: integer("post_id").notNull().references(() => blog_posts2.id, { onDelete: "cascade" }),
19878
+ integration_id: integer("integration_id").notNull().references(() => blog_integrations2.id, { onDelete: "cascade" }),
19879
+ identifier: text("identifier").notNull()
19880
+ }, (table3) => [unique("fetch_links_integration_identifier_unique").on(table3.integration_id, table3.identifier)]);
19881
+ var blog_post_projects2 = sqliteTable("blog_post_projects", {
19882
+ post_id: integer("post_id").notNull().references(() => blog_posts2.id, { onDelete: "cascade" }),
19883
+ project_id: text("project_id").notNull(),
19884
+ created_at: integer("created_at", { mode: "timestamp" }).notNull().default(sql`(unixepoch())`)
19885
+ }, (table3) => [primaryKey({ columns: [table3.post_id, table3.project_id] })]);
19590
19886
  function unwrap3(result) {
19591
19887
  if (!result.ok)
19592
19888
  throw new Error(result.error?.message ?? "Unknown error");
@@ -19621,26 +19917,33 @@ var github_branches2 = exports_external.object({
19621
19917
  owner: exports_external.string().describe("Repository owner"),
19622
19918
  repo: exports_external.string().describe("Repository name")
19623
19919
  });
19920
+ var define_tool2 = (def) => def;
19624
19921
  var tools2 = {
19625
- devpad_projects_list: {
19922
+ devpad_projects_list: define_tool2({
19626
19923
  name: "devpad_projects_list",
19627
19924
  description: "List all projects (or only public ones)",
19628
19925
  inputSchema: project_filters2,
19629
19926
  execute: async (client, input) => unwrap3(await client.projects.list(input))
19630
- },
19631
- devpad_projects_get: {
19927
+ }),
19928
+ devpad_projects_get: define_tool2({
19632
19929
  name: "devpad_projects_get",
19633
19930
  description: "Get project by ID or name",
19634
19931
  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: {
19932
+ execute: async (client, input) => {
19933
+ if (input.id)
19934
+ return unwrap3(await client.projects.getById(input.id));
19935
+ if (!input.name)
19936
+ throw new Error("either id or name must be provided");
19937
+ return unwrap3(await client.projects.getByName(input.name));
19938
+ }
19939
+ }),
19940
+ devpad_projects_upsert: define_tool2({
19638
19941
  name: "devpad_projects_upsert",
19639
19942
  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
19943
  inputSchema: upsert_project,
19641
19944
  execute: async (client, input) => unwrap3(await client.projects.upsert(input))
19642
- },
19643
- devpad_projects_config_save: {
19945
+ }),
19946
+ devpad_projects_config_save: define_tool2({
19644
19947
  name: "devpad_projects_config_save",
19645
19948
  description: "Save project configuration",
19646
19949
  inputSchema: save_config_request,
@@ -19648,26 +19951,26 @@ var tools2 = {
19648
19951
  unwrap3(await client.projects.config.save(input));
19649
19952
  return { success: true };
19650
19953
  }
19651
- },
19652
- devpad_tasks_list: {
19954
+ }),
19955
+ devpad_tasks_list: define_tool2({
19653
19956
  name: "devpad_tasks_list",
19654
19957
  description: "List tasks, optionally filtered by project or tag",
19655
19958
  inputSchema: task_filters2,
19656
19959
  execute: async (client, input) => unwrap3(await client.tasks.list(input))
19657
- },
19658
- devpad_tasks_get: {
19960
+ }),
19961
+ devpad_tasks_get: define_tool2({
19659
19962
  name: "devpad_tasks_get",
19660
19963
  description: "Get task by ID",
19661
19964
  inputSchema: task_by_id2,
19662
19965
  execute: async (client, input) => unwrap3(await client.tasks.find(input.id))
19663
- },
19664
- devpad_tasks_upsert: {
19966
+ }),
19967
+ devpad_tasks_upsert: define_tool2({
19665
19968
  name: "devpad_tasks_upsert",
19666
19969
  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
19970
  inputSchema: upsert_todo,
19668
19971
  execute: async (client, input) => unwrap3(await client.tasks.upsert(input))
19669
- },
19670
- devpad_tasks_save_tags: {
19972
+ }),
19973
+ devpad_tasks_save_tags: define_tool2({
19671
19974
  name: "devpad_tasks_save_tags",
19672
19975
  description: "Save tags for tasks",
19673
19976
  inputSchema: save_tags_request,
@@ -19675,20 +19978,20 @@ var tools2 = {
19675
19978
  unwrap3(await client.tasks.saveTags(input));
19676
19979
  return { success: true };
19677
19980
  }
19678
- },
19679
- devpad_milestones_list: {
19981
+ }),
19982
+ devpad_milestones_list: define_tool2({
19680
19983
  name: "devpad_milestones_list",
19681
19984
  description: "List milestones for authenticated user or by project",
19682
19985
  inputSchema: milestone_filters2,
19683
19986
  execute: async (client, input) => unwrap3(input.project_id ? await client.milestones.getByProject(input.project_id) : await client.milestones.list())
19684
- },
19685
- devpad_milestones_get: {
19987
+ }),
19988
+ devpad_milestones_get: define_tool2({
19686
19989
  name: "devpad_milestones_get",
19687
19990
  description: "Get milestone by ID",
19688
19991
  inputSchema: milestone_by_id2,
19689
19992
  execute: async (client, input) => unwrap3(await client.milestones.find(input.id))
19690
- },
19691
- devpad_milestones_upsert: {
19993
+ }),
19994
+ devpad_milestones_upsert: define_tool2({
19692
19995
  name: "devpad_milestones_upsert",
19693
19996
  description: "Create or update a milestone. Returns 409 if entity is protected by user - pass force=true to override.",
19694
19997
  inputSchema: upsert_milestone,
@@ -19706,20 +20009,20 @@ var tools2 = {
19706
20009
  target_version: input.target_version,
19707
20010
  finished_at: input.finished_at
19708
20011
  }))
19709
- },
19710
- devpad_goals_list: {
20012
+ }),
20013
+ devpad_goals_list: define_tool2({
19711
20014
  name: "devpad_goals_list",
19712
20015
  description: "List goals for authenticated user",
19713
20016
  inputSchema: exports_external.object({}),
19714
20017
  execute: async (client) => unwrap3(await client.goals.list())
19715
- },
19716
- devpad_goals_get: {
20018
+ }),
20019
+ devpad_goals_get: define_tool2({
19717
20020
  name: "devpad_goals_get",
19718
20021
  description: "Get goal by ID",
19719
20022
  inputSchema: goal_by_id2,
19720
20023
  execute: async (client, input) => unwrap3(await client.goals.find(input.id))
19721
- },
19722
- devpad_goals_upsert: {
20024
+ }),
20025
+ devpad_goals_upsert: define_tool2({
19723
20026
  name: "devpad_goals_upsert",
19724
20027
  description: "Create or update a goal. Returns 409 if entity is protected by user - pass force=true to override.",
19725
20028
  inputSchema: upsert_goal,
@@ -19735,26 +20038,26 @@ var tools2 = {
19735
20038
  target_time: input.target_time,
19736
20039
  finished_at: input.finished_at
19737
20040
  }))
19738
- },
19739
- devpad_tags_list: {
20041
+ }),
20042
+ devpad_tags_list: define_tool2({
19740
20043
  name: "devpad_tags_list",
19741
20044
  description: "List tags for authenticated user",
19742
20045
  inputSchema: exports_external.object({}),
19743
20046
  execute: async (client) => unwrap3(await client.tags.list())
19744
- },
19745
- devpad_github_repos: {
20047
+ }),
20048
+ devpad_github_repos: define_tool2({
19746
20049
  name: "devpad_github_repos",
19747
20050
  description: "List GitHub repositories for authenticated user",
19748
20051
  inputSchema: exports_external.object({}),
19749
20052
  execute: async (client) => unwrap3(await client.github.repos())
19750
- },
19751
- devpad_github_branches: {
20053
+ }),
20054
+ devpad_github_branches: define_tool2({
19752
20055
  name: "devpad_github_branches",
19753
20056
  description: "List branches for a GitHub repository",
19754
20057
  inputSchema: github_branches2,
19755
20058
  execute: async (client, input) => unwrap3(await client.github.branches(input.owner, input.repo))
19756
- },
19757
- devpad_projects_delete: {
20059
+ }),
20060
+ devpad_projects_delete: define_tool2({
19758
20061
  name: "devpad_projects_delete",
19759
20062
  description: "Delete a project",
19760
20063
  inputSchema: exports_external.object({
@@ -19767,56 +20070,56 @@ var tools2 = {
19767
20070
  unwrap3(await client.projects.deleteProject(project2));
19768
20071
  return { success: true };
19769
20072
  }
19770
- },
19771
- devpad_projects_history: {
20073
+ }),
20074
+ devpad_projects_history: define_tool2({
19772
20075
  name: "devpad_projects_history",
19773
20076
  description: "Get project history",
19774
20077
  inputSchema: exports_external.object({
19775
20078
  project_id: exports_external.string().describe("Project ID")
19776
20079
  }),
19777
20080
  execute: async (client, input) => unwrap3(await client.projects.history(input.project_id))
19778
- },
19779
- devpad_projects_specification: {
20081
+ }),
20082
+ devpad_projects_specification: define_tool2({
19780
20083
  name: "devpad_projects_specification",
19781
20084
  description: "Fetch project specification from GitHub",
19782
20085
  inputSchema: exports_external.object({
19783
20086
  project_id: exports_external.string().describe("Project ID")
19784
20087
  }),
19785
20088
  execute: async (client, input) => unwrap3(await client.projects.specification(input.project_id))
19786
- },
19787
- devpad_projects_config_load: {
20089
+ }),
20090
+ devpad_projects_config_load: define_tool2({
19788
20091
  name: "devpad_projects_config_load",
19789
20092
  description: "Load project configuration",
19790
20093
  inputSchema: exports_external.object({
19791
20094
  project_id: exports_external.string().describe("Project ID")
19792
20095
  }),
19793
20096
  execute: async (client, input) => unwrap3(await client.projects.config.load(input.project_id))
19794
- },
19795
- devpad_milestones_delete: {
20097
+ }),
20098
+ devpad_milestones_delete: define_tool2({
19796
20099
  name: "devpad_milestones_delete",
19797
20100
  description: "Delete a milestone",
19798
20101
  inputSchema: exports_external.object({
19799
20102
  id: exports_external.string().describe("Milestone ID")
19800
20103
  }),
19801
20104
  execute: async (client, input) => unwrap3(await client.milestones.delete(input.id))
19802
- },
19803
- devpad_milestones_goals: {
20105
+ }),
20106
+ devpad_milestones_goals: define_tool2({
19804
20107
  name: "devpad_milestones_goals",
19805
20108
  description: "Get goals for a milestone",
19806
20109
  inputSchema: exports_external.object({
19807
20110
  id: exports_external.string().describe("Milestone ID")
19808
20111
  }),
19809
20112
  execute: async (client, input) => unwrap3(await client.milestones.goals(input.id))
19810
- },
19811
- devpad_goals_delete: {
20113
+ }),
20114
+ devpad_goals_delete: define_tool2({
19812
20115
  name: "devpad_goals_delete",
19813
20116
  description: "Delete a goal",
19814
20117
  inputSchema: exports_external.object({
19815
20118
  id: exports_external.string().describe("Goal ID")
19816
20119
  }),
19817
20120
  execute: async (client, input) => unwrap3(await client.goals.delete(input.id))
19818
- },
19819
- devpad_tasks_delete: {
20121
+ }),
20122
+ devpad_tasks_delete: define_tool2({
19820
20123
  name: "devpad_tasks_delete",
19821
20124
  description: "Delete a task",
19822
20125
  inputSchema: exports_external.object({
@@ -19829,22 +20132,22 @@ var tools2 = {
19829
20132
  unwrap3(await client.tasks.deleteTask(task2));
19830
20133
  return { success: true };
19831
20134
  }
19832
- },
19833
- devpad_tasks_history: {
20135
+ }),
20136
+ devpad_tasks_history: define_tool2({
19834
20137
  name: "devpad_tasks_history",
19835
20138
  description: "Get task history",
19836
20139
  inputSchema: exports_external.object({
19837
20140
  task_id: exports_external.string().describe("Task ID")
19838
20141
  }),
19839
20142
  execute: async (client, input) => unwrap3(await client.tasks.history.get(input.task_id))
19840
- },
19841
- devpad_user_history: {
20143
+ }),
20144
+ devpad_user_history: define_tool2({
19842
20145
  name: "devpad_user_history",
19843
20146
  description: "Get user activity history",
19844
20147
  inputSchema: exports_external.object({}),
19845
20148
  execute: async (client) => unwrap3(await client.user.history())
19846
- },
19847
- devpad_user_preferences: {
20149
+ }),
20150
+ devpad_user_preferences: define_tool2({
19848
20151
  name: "devpad_user_preferences",
19849
20152
  description: "Update user preferences",
19850
20153
  inputSchema: exports_external.object({
@@ -19852,8 +20155,8 @@ var tools2 = {
19852
20155
  task_view: exports_external.enum(["list", "grid"]).describe("Task view preference")
19853
20156
  }),
19854
20157
  execute: async (client, input) => unwrap3(await client.user.preferences(input))
19855
- },
19856
- devpad_activity_ai: {
20158
+ }),
20159
+ devpad_activity_ai: define_tool2({
19857
20160
  name: "devpad_activity_ai",
19858
20161
  description: "Get AI activity feed - shows recent actions made via API/MCP grouped into sessions by time window",
19859
20162
  inputSchema: exports_external.object({
@@ -19861,104 +20164,69 @@ var tools2 = {
19861
20164
  since: exports_external.string().optional().describe("Only show activity after this ISO date")
19862
20165
  }),
19863
20166
  execute: async (client, input) => unwrap3(await client.activity.ai(input))
19864
- },
19865
- devpad_blog_posts_list: {
20167
+ }),
20168
+ devpad_blog_posts_list: define_tool2({
19866
20169
  name: "devpad_blog_posts_list",
19867
20170
  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
- }),
20171
+ inputSchema: PostListParamsSchema.partial(),
19878
20172
  execute: async (client, input) => unwrap3(await client.blog.posts.list(input))
19879
- },
19880
- devpad_blog_posts_get: {
20173
+ }),
20174
+ devpad_blog_posts_get: define_tool2({
19881
20175
  name: "devpad_blog_posts_get",
19882
20176
  description: "Get a blog post by slug",
19883
20177
  inputSchema: exports_external.object({
19884
20178
  slug: exports_external.string().describe("Post slug")
19885
20179
  }),
19886
20180
  execute: async (client, input) => unwrap3(await client.blog.posts.getBySlug(input.slug))
19887
- },
19888
- devpad_blog_posts_create: {
20181
+ }),
20182
+ devpad_blog_posts_create: define_tool2({
19889
20183
  name: "devpad_blog_posts_create",
19890
20184
  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
- }),
20185
+ inputSchema: PostCreateSchema,
19903
20186
  execute: async (client, input) => unwrap3(await client.blog.posts.create(input))
19904
- },
19905
- devpad_blog_posts_update: {
20187
+ }),
20188
+ devpad_blog_posts_update: define_tool2({
19906
20189
  name: "devpad_blog_posts_update",
19907
20190
  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
- }),
20191
+ inputSchema: PostUpdateSchema.extend({ uuid: exports_external.string().describe("Post UUID") }),
19921
20192
  execute: async (client, input) => {
19922
20193
  const { uuid, ...data } = input;
19923
20194
  return unwrap3(await client.blog.posts.update(uuid, data));
19924
20195
  }
19925
- },
19926
- devpad_blog_posts_delete: {
20196
+ }),
20197
+ devpad_blog_posts_delete: define_tool2({
19927
20198
  name: "devpad_blog_posts_delete",
19928
20199
  description: "Delete a blog post by UUID",
19929
20200
  inputSchema: exports_external.object({
19930
20201
  uuid: exports_external.string().describe("Post UUID")
19931
20202
  }),
19932
20203
  execute: async (client, input) => unwrap3(await client.blog.posts.delete(input.uuid))
19933
- },
19934
- devpad_blog_tags_list: {
20204
+ }),
20205
+ devpad_blog_tags_list: define_tool2({
19935
20206
  name: "devpad_blog_tags_list",
19936
20207
  description: "List all blog tags with post counts",
19937
20208
  inputSchema: exports_external.object({}),
19938
20209
  execute: async (client) => unwrap3(await client.blog.tags.list())
19939
- },
19940
- devpad_blog_categories_tree: {
20210
+ }),
20211
+ devpad_blog_categories_tree: define_tool2({
19941
20212
  name: "devpad_blog_categories_tree",
19942
20213
  description: "Get the blog category tree",
19943
20214
  inputSchema: exports_external.object({}),
19944
20215
  execute: async (client) => unwrap3(await client.blog.categories.tree())
19945
- },
19946
- devpad_blog_categories_create: {
20216
+ }),
20217
+ devpad_blog_categories_create: define_tool2({
19947
20218
  name: "devpad_blog_categories_create",
19948
20219
  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
- }),
20220
+ inputSchema: CategoryCreateSchema,
19953
20221
  execute: async (client, input) => unwrap3(await client.blog.categories.create(input))
19954
- },
19955
- devpad_blog_tokens_list: {
20222
+ }),
20223
+ devpad_blog_tokens_list: define_tool2({
19956
20224
  name: "devpad_blog_tokens_list",
19957
20225
  description: "List blog access tokens",
19958
20226
  inputSchema: exports_external.object({}),
19959
20227
  execute: async (client) => unwrap3(await client.blog.tokens.list())
19960
- },
19961
- devpad_blog_tokens_create: {
20228
+ }),
20229
+ devpad_blog_tokens_create: define_tool2({
19962
20230
  name: "devpad_blog_tokens_create",
19963
20231
  description: "Create a blog access token",
19964
20232
  inputSchema: exports_external.object({
@@ -19966,14 +20234,14 @@ var tools2 = {
19966
20234
  note: exports_external.string().optional().describe("Optional note")
19967
20235
  }),
19968
20236
  execute: async (client, input) => unwrap3(await client.blog.tokens.create(input))
19969
- },
19970
- devpad_media_profiles_list: {
20237
+ }),
20238
+ devpad_media_profiles_list: define_tool2({
19971
20239
  name: "devpad_media_profiles_list",
19972
20240
  description: "List media profiles",
19973
20241
  inputSchema: exports_external.object({}),
19974
20242
  execute: async (client) => unwrap3(await client.media.profiles.list())
19975
- },
19976
- devpad_media_profiles_create: {
20243
+ }),
20244
+ devpad_media_profiles_create: define_tool2({
19977
20245
  name: "devpad_media_profiles_create",
19978
20246
  description: "Create a media profile",
19979
20247
  inputSchema: exports_external.object({
@@ -19981,16 +20249,16 @@ var tools2 = {
19981
20249
  slug: exports_external.string().describe("Profile slug")
19982
20250
  }),
19983
20251
  execute: async (client, input) => unwrap3(await client.media.profiles.create(input))
19984
- },
19985
- devpad_media_profiles_get: {
20252
+ }),
20253
+ devpad_media_profiles_get: define_tool2({
19986
20254
  name: "devpad_media_profiles_get",
19987
20255
  description: "Get a media profile by ID",
19988
20256
  inputSchema: exports_external.object({
19989
20257
  id: exports_external.string().describe("Profile ID")
19990
20258
  }),
19991
20259
  execute: async (client, input) => unwrap3(await client.media.profiles.get(input.id))
19992
- },
19993
- devpad_media_profiles_update: {
20260
+ }),
20261
+ devpad_media_profiles_update: define_tool2({
19994
20262
  name: "devpad_media_profiles_update",
19995
20263
  description: "Update a media profile by ID",
19996
20264
  inputSchema: exports_external.object({
@@ -20002,32 +20270,32 @@ var tools2 = {
20002
20270
  const { id: id2, ...data } = input;
20003
20271
  return unwrap3(await client.media.profiles.update(id2, data));
20004
20272
  }
20005
- },
20006
- devpad_media_profiles_delete: {
20273
+ }),
20274
+ devpad_media_profiles_delete: define_tool2({
20007
20275
  name: "devpad_media_profiles_delete",
20008
20276
  description: "Delete a media profile by ID",
20009
20277
  inputSchema: exports_external.object({
20010
20278
  id: exports_external.string().describe("Profile ID")
20011
20279
  }),
20012
20280
  execute: async (client, input) => unwrap3(await client.media.profiles.delete(input.id))
20013
- },
20014
- devpad_media_connections_list: {
20281
+ }),
20282
+ devpad_media_connections_list: define_tool2({
20015
20283
  name: "devpad_media_connections_list",
20016
20284
  description: "List connections for a media profile",
20017
20285
  inputSchema: exports_external.object({
20018
20286
  profile_id: exports_external.string().describe("Profile ID")
20019
20287
  }),
20020
20288
  execute: async (client, input) => unwrap3(await client.media.connections.list(input.profile_id))
20021
- },
20022
- devpad_media_connections_refresh: {
20289
+ }),
20290
+ devpad_media_connections_refresh: define_tool2({
20023
20291
  name: "devpad_media_connections_refresh",
20024
20292
  description: "Refresh a media connection",
20025
20293
  inputSchema: exports_external.object({
20026
20294
  account_id: exports_external.string().describe("Account/connection ID")
20027
20295
  }),
20028
20296
  execute: async (client, input) => unwrap3(await client.media.connections.refresh(input.account_id))
20029
- },
20030
- devpad_media_timeline_get: {
20297
+ }),
20298
+ devpad_media_timeline_get: define_tool2({
20031
20299
  name: "devpad_media_timeline_get",
20032
20300
  description: "Get media timeline for a user",
20033
20301
  inputSchema: exports_external.object({
@@ -20039,8 +20307,8 @@ var tools2 = {
20039
20307
  const { user_id, ...params } = input;
20040
20308
  return unwrap3(await client.media.timeline.get(user_id, params));
20041
20309
  }
20042
- },
20043
- devpad_pulse_summary: {
20310
+ }),
20311
+ devpad_pulse_summary: define_tool2({
20044
20312
  name: "devpad_pulse_summary",
20045
20313
  description: "Get summary analytics for a project (pageviews, sessions, errors, latency)",
20046
20314
  inputSchema: exports_external.object({
@@ -20048,8 +20316,8 @@ var tools2 = {
20048
20316
  range: exports_external.enum(["24h", "7d", "30d", "90d"]).describe("Time range")
20049
20317
  }),
20050
20318
  execute: async (client, input) => unwrap3(await client.pulse.summary({ project_id: input.project_id, range: input.range }))
20051
- },
20052
- devpad_pulse_events: {
20319
+ }),
20320
+ devpad_pulse_events: define_tool2({
20053
20321
  name: "devpad_pulse_events",
20054
20322
  description: "List events for a project with optional filtering",
20055
20323
  inputSchema: exports_external.object({
@@ -20063,8 +20331,8 @@ var tools2 = {
20063
20331
  cursor: exports_external.string().optional().describe("Pagination cursor")
20064
20332
  }),
20065
20333
  execute: async (client, input) => unwrap3(await client.pulse.events(input))
20066
- },
20067
- devpad_pulse_errors: {
20334
+ }),
20335
+ devpad_pulse_errors: define_tool2({
20068
20336
  name: "devpad_pulse_errors",
20069
20337
  description: "List error issues for a project, optionally grouped by fingerprint",
20070
20338
  inputSchema: exports_external.object({
@@ -20077,8 +20345,8 @@ var tools2 = {
20077
20345
  range: input.range,
20078
20346
  group_by_fingerprint: input.group_by_fingerprint
20079
20347
  }))
20080
- },
20081
- devpad_pulse_logs: {
20348
+ }),
20349
+ devpad_pulse_logs: define_tool2({
20082
20350
  name: "devpad_pulse_logs",
20083
20351
  description: "List logs for a project with optional level and message filtering",
20084
20352
  inputSchema: exports_external.object({
@@ -20088,8 +20356,8 @@ var tools2 = {
20088
20356
  search: exports_external.string().optional().describe("Search in log messages")
20089
20357
  }),
20090
20358
  execute: async (client, input) => unwrap3(await client.pulse.logs(input))
20091
- },
20092
- devpad_pulse_latency: {
20359
+ }),
20360
+ devpad_pulse_latency: define_tool2({
20093
20361
  name: "devpad_pulse_latency",
20094
20362
  description: "Get request latency metrics (p50, p95, p99) for a project",
20095
20363
  inputSchema: exports_external.object({
@@ -20099,16 +20367,16 @@ var tools2 = {
20099
20367
  percentiles: exports_external.array(exports_external.number()).optional().describe("Percentiles to compute (default [50, 95, 99])")
20100
20368
  }),
20101
20369
  execute: async (client, input) => unwrap3(await client.pulse.latency(input))
20102
- },
20103
- devpad_alerts_list: {
20370
+ }),
20371
+ devpad_alerts_list: define_tool2({
20104
20372
  name: "devpad_alerts_list",
20105
20373
  description: "List notification subscriptions (alerts) for a project",
20106
20374
  inputSchema: exports_external.object({
20107
20375
  project_id: exports_external.string().describe("Project ID")
20108
20376
  }),
20109
20377
  execute: async (client, input) => unwrap3(await client.pulse.subs.list(input))
20110
- },
20111
- devpad_alerts_subscribe: {
20378
+ }),
20379
+ devpad_alerts_subscribe: define_tool2({
20112
20380
  name: "devpad_alerts_subscribe",
20113
20381
  description: "Create a new notification subscription (alert) for events",
20114
20382
  inputSchema: exports_external.object({
@@ -20119,16 +20387,16 @@ var tools2 = {
20119
20387
  cooldown_seconds: exports_external.number().optional().describe("Cooldown between notifications (default 60)")
20120
20388
  }),
20121
20389
  execute: async (client, input) => unwrap3(await client.pulse.subs.create(input))
20122
- },
20123
- devpad_alerts_unsubscribe: {
20390
+ }),
20391
+ devpad_alerts_unsubscribe: define_tool2({
20124
20392
  name: "devpad_alerts_unsubscribe",
20125
20393
  description: "Delete a notification subscription by ID",
20126
20394
  inputSchema: exports_external.object({
20127
20395
  id: exports_external.string().describe("Subscription ID")
20128
20396
  }),
20129
20397
  execute: async (client, input) => unwrap3(await client.pulse.subs.delete(input.id))
20130
- },
20131
- devpad_pulse_key_create: {
20398
+ }),
20399
+ devpad_pulse_key_create: define_tool2({
20132
20400
  name: "devpad_pulse_key_create",
20133
20401
  description: "Create a new ingest key for a project (returns plaintext once)",
20134
20402
  inputSchema: exports_external.object({
@@ -20137,8 +20405,8 @@ var tools2 = {
20137
20405
  rate_limit_per_min: exports_external.number().optional().describe("Rate limit in requests per minute (default 600)")
20138
20406
  }),
20139
20407
  execute: async (client, input) => unwrap3(await client.pulse.keys.create(input))
20140
- },
20141
- devpad_pipelines_list: {
20408
+ }),
20409
+ devpad_pipelines_list: define_tool2({
20142
20410
  name: "devpad_pipelines_list",
20143
20411
  description: "List pipeline runs (newest first). Optionally filter by package and/or status; cap limit at 200.",
20144
20412
  inputSchema: exports_external.object({
@@ -20147,16 +20415,16 @@ var tools2 = {
20147
20415
  limit: exports_external.number().int().positive().max(200).optional().describe("Max rows to return (default 50, cap 200)")
20148
20416
  }),
20149
20417
  execute: async (client, input) => unwrap3(await client.pipelines.list(input))
20150
- },
20151
- devpad_pipelines_get: {
20418
+ }),
20419
+ devpad_pipelines_get: define_tool2({
20152
20420
  name: "devpad_pipelines_get",
20153
20421
  description: "Get a pipeline run by ID",
20154
20422
  inputSchema: exports_external.object({
20155
20423
  run_id: exports_external.string().describe("Pipeline run ID")
20156
20424
  }),
20157
20425
  execute: async (client, input) => unwrap3(await client.pipelines.get(input.run_id))
20158
- },
20159
- devpad_pipelines_create: {
20426
+ }),
20427
+ devpad_pipelines_create: define_tool2({
20160
20428
  name: "devpad_pipelines_create",
20161
20429
  description: "Create a new pipeline run",
20162
20430
  inputSchema: exports_external.object({
@@ -20164,8 +20432,8 @@ var tools2 = {
20164
20432
  version_set_id: exports_external.string().describe("Version set ID to deploy")
20165
20433
  }),
20166
20434
  execute: async (client, input) => unwrap3(await client.pipelines.create(input))
20167
- },
20168
- devpad_pipelines_approve: {
20435
+ }),
20436
+ devpad_pipelines_approve: define_tool2({
20169
20437
  name: "devpad_pipelines_approve",
20170
20438
  description: "Approve or deny a stage in a pipeline run",
20171
20439
  inputSchema: exports_external.object({
@@ -20179,8 +20447,8 @@ var tools2 = {
20179
20447
  unwrap3(await client.pipelines.approve(input.run_id, input));
20180
20448
  return { success: true };
20181
20449
  }
20182
- },
20183
- devpad_pipelines_cancel: {
20450
+ }),
20451
+ devpad_pipelines_cancel: define_tool2({
20184
20452
  name: "devpad_pipelines_cancel",
20185
20453
  description: "Cancel a pipeline run",
20186
20454
  inputSchema: exports_external.object({
@@ -20190,8 +20458,8 @@ var tools2 = {
20190
20458
  unwrap3(await client.pipelines.cancel(input.run_id));
20191
20459
  return { success: true };
20192
20460
  }
20193
- },
20194
- devpad_pipelines_rollback: {
20461
+ }),
20462
+ devpad_pipelines_rollback: define_tool2({
20195
20463
  name: "devpad_pipelines_rollback",
20196
20464
  description: "Rollback a completed or failed pipeline run",
20197
20465
  inputSchema: exports_external.object({
@@ -20201,8 +20469,8 @@ var tools2 = {
20201
20469
  unwrap3(await client.pipelines.rollback(input.run_id));
20202
20470
  return { success: true };
20203
20471
  }
20204
- },
20205
- devpad_pipelines_runs_events_ingest: {
20472
+ }),
20473
+ devpad_pipelines_runs_events_ingest: define_tool2({
20206
20474
  name: "devpad_pipelines_runs_events_ingest",
20207
20475
  description: 'Ingest an external webhook event against an in-flight pipeline run. Idempotent on (idempotency_key, payload). Server-side stamps payload.source = "external".',
20208
20476
  inputSchema: exports_external.object({
@@ -20218,24 +20486,24 @@ var tools2 = {
20218
20486
  payload: input.payload,
20219
20487
  idempotency_key: input.idempotency_key
20220
20488
  }))
20221
- },
20222
- devpad_pipelines_runs_events_list: {
20489
+ }),
20490
+ devpad_pipelines_runs_events_list: define_tool2({
20223
20491
  name: "devpad_pipelines_runs_events_list",
20224
20492
  description: "List stored stage events for a pipeline run, newest-first",
20225
20493
  inputSchema: exports_external.object({
20226
20494
  run_id: exports_external.string().describe("Pipeline run ID")
20227
20495
  }),
20228
20496
  execute: async (client, input) => unwrap3(await client.pipelines.events.list(input.run_id))
20229
- },
20230
- devpad_pipelines_grants_list: {
20497
+ }),
20498
+ devpad_pipelines_grants_list: define_tool2({
20231
20499
  name: "devpad_pipelines_grants_list",
20232
20500
  description: "List vault grants for a pipeline package",
20233
20501
  inputSchema: exports_external.object({
20234
20502
  package_id: exports_external.string().describe("Package ID to filter grants by")
20235
20503
  }),
20236
20504
  execute: async (client, input) => unwrap3(await client.pipelines.grants.list(input.package_id))
20237
- },
20238
- devpad_pipelines_grants_approve: {
20505
+ }),
20506
+ devpad_pipelines_grants_approve: define_tool2({
20239
20507
  name: "devpad_pipelines_grants_approve",
20240
20508
  description: "Approve a pending vault grant request for a pipeline package",
20241
20509
  inputSchema: exports_external.object({
@@ -20243,8 +20511,8 @@ var tools2 = {
20243
20511
  user_id: exports_external.string().describe("User ID making the approval decision")
20244
20512
  }),
20245
20513
  execute: async (client, input) => unwrap3(await client.pipelines.grants.approve(input.grant_id, input.user_id))
20246
- },
20247
- devpad_pipelines_grants_deny: {
20514
+ }),
20515
+ devpad_pipelines_grants_deny: define_tool2({
20248
20516
  name: "devpad_pipelines_grants_deny",
20249
20517
  description: "Deny a pending vault grant request for a pipeline package",
20250
20518
  inputSchema: exports_external.object({
@@ -20253,24 +20521,24 @@ var tools2 = {
20253
20521
  reason: exports_external.string().optional().describe("Optional reason for the denial")
20254
20522
  }),
20255
20523
  execute: async (client, input) => unwrap3(await client.pipelines.grants.deny(input.grant_id, input.user_id, input.reason))
20256
- },
20257
- devpad_pipelines_packages_list: {
20524
+ }),
20525
+ devpad_pipelines_packages_list: define_tool2({
20258
20526
  name: "devpad_pipelines_packages_list",
20259
20527
  description: "List pipeline packages. Optionally filter by linked devpad project_id; unlinked packages have project_id = null.",
20260
20528
  inputSchema: exports_external.object({
20261
20529
  project_id: exports_external.string().optional().describe("Filter packages by linked devpad project")
20262
20530
  }),
20263
20531
  execute: async (client, input) => unwrap3(await client.pipelines.packages.list(input))
20264
- },
20265
- devpad_pipelines_packages_get: {
20532
+ }),
20533
+ devpad_pipelines_packages_get: define_tool2({
20266
20534
  name: "devpad_pipelines_packages_get",
20267
20535
  description: "Get a pipeline package by ID",
20268
20536
  inputSchema: exports_external.object({
20269
20537
  package_id: exports_external.string().describe("Pipeline package ID")
20270
20538
  }),
20271
20539
  execute: async (client, input) => unwrap3(await client.pipelines.packages.get(input.package_id))
20272
- },
20273
- devpad_pipelines_packages_create: {
20540
+ }),
20541
+ devpad_pipelines_packages_create: define_tool2({
20274
20542
  name: "devpad_pipelines_packages_create",
20275
20543
  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
20544
  inputSchema: exports_external.object({
@@ -20282,8 +20550,8 @@ var tools2 = {
20282
20550
  default_template_ref: exports_external.string().optional().describe("Optional default pipeline template ref")
20283
20551
  }),
20284
20552
  execute: async (client, input) => unwrap3(await client.pipelines.packages.create(input))
20285
- },
20286
- devpad_pipelines_packages_update: {
20553
+ }),
20554
+ devpad_pipelines_packages_update: define_tool2({
20287
20555
  name: "devpad_pipelines_packages_update",
20288
20556
  description: "Partially update a pipeline package. Only the provided fields are touched.",
20289
20557
  inputSchema: exports_external.object({
@@ -20297,24 +20565,24 @@ var tools2 = {
20297
20565
  const { id: id2, ...patch } = input;
20298
20566
  return unwrap3(await client.pipelines.packages.update(id2, patch));
20299
20567
  }
20300
- },
20301
- devpad_pipelines_packages_delete: {
20568
+ }),
20569
+ devpad_pipelines_packages_delete: define_tool2({
20302
20570
  name: "devpad_pipelines_packages_delete",
20303
20571
  description: "Delete a pipeline package. Refuses with conflict if existing pipeline_run rows still reference the package.",
20304
20572
  inputSchema: exports_external.object({
20305
20573
  id: exports_external.string().describe("Pipeline package ID")
20306
20574
  }),
20307
20575
  execute: async (client, input) => unwrap3(await client.pipelines.packages.delete(input.id))
20308
- },
20309
- devpad_pipelines_analysis_templates_list: {
20576
+ }),
20577
+ devpad_pipelines_analysis_templates_list: define_tool2({
20310
20578
  name: "devpad_pipelines_analysis_templates_list",
20311
20579
  description: "List pipeline analysis templates for an owner. Each row encodes the threshold DSL + window referenced by analysis-gate evaluations.",
20312
20580
  inputSchema: exports_external.object({
20313
20581
  owner_id: exports_external.string().describe("Devpad user ID whose templates to list")
20314
20582
  }),
20315
20583
  execute: async (client, input) => unwrap3(await client.pipelines.analysis_templates.list(input))
20316
- },
20317
- devpad_pipelines_analysis_templates_get: {
20584
+ }),
20585
+ devpad_pipelines_analysis_templates_get: define_tool2({
20318
20586
  name: "devpad_pipelines_analysis_templates_get",
20319
20587
  description: "Get a single pipeline analysis template by id, scoped to its owner.",
20320
20588
  inputSchema: exports_external.object({
@@ -20322,8 +20590,8 @@ var tools2 = {
20322
20590
  owner_id: exports_external.string().describe("Owner ID (must match the template's owner)")
20323
20591
  }),
20324
20592
  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: {
20593
+ }),
20594
+ devpad_pipelines_analysis_templates_create: define_tool2({
20327
20595
  name: "devpad_pipelines_analysis_templates_create",
20328
20596
  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
20597
  inputSchema: exports_external.object({
@@ -20334,8 +20602,8 @@ var tools2 = {
20334
20602
  window_ms: exports_external.number().int().positive().optional().describe("Analysis window in milliseconds. Default: 600000")
20335
20603
  }),
20336
20604
  execute: async (client, input) => unwrap3(await client.pipelines.analysis_templates.create(input))
20337
- },
20338
- devpad_pipelines_analysis_templates_update: {
20605
+ }),
20606
+ devpad_pipelines_analysis_templates_update: define_tool2({
20339
20607
  name: "devpad_pipelines_analysis_templates_update",
20340
20608
  description: "Partially update a pipeline analysis template. Only the supplied fields are touched. Re-validates threshold_dsl when present.",
20341
20609
  inputSchema: exports_external.object({
@@ -20350,8 +20618,8 @@ var tools2 = {
20350
20618
  const { id: id2, ...patch } = input;
20351
20619
  return unwrap3(await client.pipelines.analysis_templates.update(id2, patch));
20352
20620
  }
20353
- },
20354
- devpad_pipelines_analysis_templates_delete: {
20621
+ }),
20622
+ devpad_pipelines_analysis_templates_delete: define_tool2({
20355
20623
  name: "devpad_pipelines_analysis_templates_delete",
20356
20624
  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
20625
  inputSchema: exports_external.object({
@@ -20359,16 +20627,16 @@ var tools2 = {
20359
20627
  owner_id: exports_external.string().describe("Owner ID (must match the template's owner)")
20360
20628
  }),
20361
20629
  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: {
20630
+ }),
20631
+ devpad_pipelines_oidc_trust_list: define_tool2({
20364
20632
  name: "devpad_pipelines_oidc_trust_list",
20365
20633
  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
20634
  inputSchema: exports_external.object({
20367
20635
  owner_id: exports_external.string().describe("User ID whose trust policies to list")
20368
20636
  }),
20369
20637
  execute: async (client, input) => unwrap3(await client.pipelines.oidc_trust.list(input))
20370
- },
20371
- devpad_pipelines_oidc_trust_create: {
20638
+ }),
20639
+ devpad_pipelines_oidc_trust_create: define_tool2({
20372
20640
  name: "devpad_pipelines_oidc_trust_create",
20373
20641
  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
20642
  inputSchema: exports_external.object({
@@ -20382,8 +20650,8 @@ var tools2 = {
20382
20650
  session_ttl_seconds: exports_external.number().int().positive().optional().describe("Session token TTL. Default: 900 (15 min)")
20383
20651
  }),
20384
20652
  execute: async (client, input) => unwrap3(await client.pipelines.oidc_trust.create(input))
20385
- },
20386
- devpad_pipelines_oidc_trust_update: {
20653
+ }),
20654
+ devpad_pipelines_oidc_trust_update: define_tool2({
20387
20655
  name: "devpad_pipelines_oidc_trust_update",
20388
20656
  description: "Partially update a GitHub Actions OIDC trust policy. Only the supplied fields are touched; validation runs server-side against the merged record.",
20389
20657
  inputSchema: exports_external.object({
@@ -20401,8 +20669,8 @@ var tools2 = {
20401
20669
  const { id: id2, ...patch } = input;
20402
20670
  return unwrap3(await client.pipelines.oidc_trust.update(id2, patch));
20403
20671
  }
20404
- },
20405
- devpad_pipelines_oidc_trust_delete: {
20672
+ }),
20673
+ devpad_pipelines_oidc_trust_delete: define_tool2({
20406
20674
  name: "devpad_pipelines_oidc_trust_delete",
20407
20675
  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
20676
  inputSchema: exports_external.object({
@@ -20410,7 +20678,7 @@ var tools2 = {
20410
20678
  owner_id: exports_external.string().describe("Owner ID (must match the policy's owner)")
20411
20679
  }),
20412
20680
  execute: async (client, input) => unwrap3(await client.pipelines.oidc_trust.delete(input.id, { owner_id: input.owner_id }))
20413
- }
20681
+ })
20414
20682
  };
20415
20683
  var toolNames2 = Object.keys(tools2);
20416
20684
  // ../pipeline-templates/src/default-gradual.ts
@@ -20473,14 +20741,14 @@ var validate_package_name = (name) => {
20473
20741
  if (name.length > MAX_PACKAGE_NAME_LENGTH) {
20474
20742
  return err({
20475
20743
  code: "package_name_too_long",
20476
- message: `package name must be ≤ ${MAX_PACKAGE_NAME_LENGTH} chars, got ${name.length}`,
20744
+ message: `package name must be ≤ ${String(MAX_PACKAGE_NAME_LENGTH)} chars, got ${String(name.length)}`,
20477
20745
  length: name.length
20478
20746
  });
20479
20747
  }
20480
20748
  if (!PACKAGE_NAME_PATTERN.test(name)) {
20481
20749
  return err({
20482
20750
  code: "package_name_invalid_chars",
20483
- message: `package name must match ${PACKAGE_NAME_PATTERN}; got "${name}"`,
20751
+ message: `package name must match ${String(PACKAGE_NAME_PATTERN)}; got "${name}"`,
20484
20752
  name
20485
20753
  });
20486
20754
  }
@@ -20490,7 +20758,7 @@ var compute_compatibility_date = (now) => {
20490
20758
  const year = now.getUTCFullYear();
20491
20759
  const month = String(now.getUTCMonth() + 1).padStart(2, "0");
20492
20760
  const day = String(now.getUTCDate()).padStart(2, "0");
20493
- return `${year}-${month}-${day}`;
20761
+ return `${String(year)}-${month}-${day}`;
20494
20762
  };
20495
20763
  var to_pascal_case = (name) => {
20496
20764
  return name.split("-").filter((part) => part.length > 0).map((part) => part[0].toUpperCase() + part.slice(1)).join("");
@@ -20560,16 +20828,16 @@ var render_template = (template, vars) => {
20560
20828
  for (const match2 of placeholder_matches) {
20561
20829
  const key = match2[1];
20562
20830
  if (!["if", "else", "endif"].includes(key.toLowerCase())) {
20563
- all_matches.push({ full: match2[0], key, index: match2.index ?? 0 });
20831
+ all_matches.push({ full: match2[0], key, index: match2.index });
20564
20832
  }
20565
20833
  }
20566
20834
  for (const match2 of template.matchAll(IF_ELSE_BLOCK_PATTERN)) {
20567
20835
  const key = match2[1];
20568
- all_matches.push({ full: match2[0], key, index: match2.index ?? 0 });
20836
+ all_matches.push({ full: match2[0], key, index: match2.index });
20569
20837
  }
20570
20838
  for (const match2 of template.matchAll(IF_BLOCK_PATTERN)) {
20571
20839
  const key = match2[1];
20572
- all_matches.push({ full: match2[0], key, index: match2.index ?? 0 });
20840
+ all_matches.push({ full: match2[0], key, index: match2.index });
20573
20841
  }
20574
20842
  const missing = all_matches.find((m) => !(m.key in vars));
20575
20843
  if (missing !== undefined) {
@@ -20780,7 +21048,7 @@ var compute_asset_hash = (bytes, extension_without_dot) => {
20780
21048
  };
20781
21049
  var mime_for_asset = (filepath) => {
20782
21050
  const type = import_mime.default.getType(filepath);
20783
- return type === null || type === undefined ? "application/octet-stream" : type;
21051
+ return type === null ? "application/octet-stream" : type;
20784
21052
  };
20785
21053
  var to_posix_relative = (root, full) => {
20786
21054
  const rel = relative(root, full);
@@ -20792,6 +21060,8 @@ var list_files_recursive = (root) => {
20792
21060
  const stack = [root];
20793
21061
  while (stack.length > 0) {
20794
21062
  const dir = stack.pop();
21063
+ if (dir === undefined)
21064
+ break;
20795
21065
  let entries = [];
20796
21066
  try {
20797
21067
  entries = readdirSync(dir, { withFileTypes: true });
@@ -20799,7 +21069,7 @@ var list_files_recursive = (root) => {
20799
21069
  return err({ kind: "io_error", path: dir, reason: e instanceof Error ? e.message : String(e) });
20800
21070
  }
20801
21071
  for (const entry of entries) {
20802
- const full = join(dir, String(entry.name));
21072
+ const full = join(dir, entry.name);
20803
21073
  if (entry.isSymbolicLink())
20804
21074
  continue;
20805
21075
  if (entry.isDirectory()) {
@@ -20827,7 +21097,7 @@ var walk_assets_dir = (assets_dir, options = {}) => {
20827
21097
  let st;
20828
21098
  try {
20829
21099
  st = statSync(assets_dir);
20830
- } catch (e) {
21100
+ } catch {
20831
21101
  return err({ kind: "not_a_directory", path: assets_dir });
20832
21102
  }
20833
21103
  if (!st.isDirectory()) {
@@ -20903,6 +21173,8 @@ var list_files_recursive2 = (root) => {
20903
21173
  const stack = [root];
20904
21174
  while (stack.length > 0) {
20905
21175
  const dir = stack.pop();
21176
+ if (dir === undefined)
21177
+ break;
20906
21178
  let entries = [];
20907
21179
  try {
20908
21180
  entries = readdirSync2(dir, { withFileTypes: true });
@@ -20910,7 +21182,7 @@ var list_files_recursive2 = (root) => {
20910
21182
  return err({ kind: "io_error", path: dir, reason: e instanceof Error ? e.message : String(e) });
20911
21183
  }
20912
21184
  for (const entry of entries) {
20913
- const full = join2(dir, String(entry.name));
21185
+ const full = join2(dir, entry.name);
20914
21186
  if (entry.isSymbolicLink())
20915
21187
  continue;
20916
21188
  if (entry.isDirectory()) {
@@ -20938,7 +21210,7 @@ var walk_bundle_dir = (bundle_dir) => {
20938
21210
  let st;
20939
21211
  try {
20940
21212
  st = statSync2(bundle_dir);
20941
- } catch (e) {
21213
+ } catch {
20942
21214
  return err({ kind: "not_a_directory", path: bundle_dir });
20943
21215
  }
20944
21216
  if (!st.isDirectory()) {
@@ -20993,7 +21265,14 @@ var post_envelope = async (input) => {
20993
21265
  if (!response.ok) {
20994
21266
  return err({ kind: "http", status: response.status, status_text: response.statusText });
20995
21267
  }
20996
- const body = await response.json().catch(() => null);
21268
+ let raw_body = null;
21269
+ try {
21270
+ const parsed = await response.json();
21271
+ raw_body = parsed;
21272
+ } catch {
21273
+ raw_body = null;
21274
+ }
21275
+ const body = raw_body;
20997
21276
  if (body === null || body.ok !== true || body.value === undefined) {
20998
21277
  return err({ kind: "decode", message: "unexpected response envelope" });
20999
21278
  }
@@ -21037,9 +21316,9 @@ var create_corpus_http_backend = (input) => {
21037
21316
  version: upload2.value.version_set_id,
21038
21317
  content_hash: upload2.value.content_hash
21039
21318
  };
21040
- await shadow.data.put(meta.data_key, bytes).catch(() => {
21041
- return;
21042
- });
21319
+ const shadow_write2 = await shadow.data.put(meta.data_key, bytes);
21320
+ if (!shadow_write2.ok)
21321
+ console.warn(`corpus-http-backend: shadow data write failed for ${meta.data_key}`, shadow_write2.error);
21043
21322
  return shadow.metadata.put(remote_meta2);
21044
21323
  }
21045
21324
  const upload = await upload_blob_to_store(input, meta.store_id, bytes);
@@ -21050,9 +21329,9 @@ var create_corpus_http_backend = (input) => {
21050
21329
  version: upload.value.version,
21051
21330
  content_hash: upload.value.content_hash
21052
21331
  };
21053
- await shadow.data.put(meta.data_key, bytes).catch(() => {
21054
- return;
21055
- });
21332
+ const shadow_write = await shadow.data.put(meta.data_key, bytes);
21333
+ if (!shadow_write.ok)
21334
+ console.warn(`corpus-http-backend: shadow data write failed for ${meta.data_key}`, shadow_write.error);
21056
21335
  return shadow.metadata.put(remote_meta);
21057
21336
  };
21058
21337
  return {
@@ -21117,14 +21396,12 @@ var to_bytes2 = async (data) => {
21117
21396
  const reader = data.getReader();
21118
21397
  const chunks = [];
21119
21398
  let total = 0;
21120
- while (true) {
21399
+ for (;; ) {
21121
21400
  const { done, value } = await reader.read();
21122
21401
  if (done)
21123
21402
  break;
21124
- if (value !== undefined) {
21125
- chunks.push(value);
21126
- total += value.byteLength;
21127
- }
21403
+ chunks.push(value);
21404
+ total += value.byteLength;
21128
21405
  }
21129
21406
  const out = new Uint8Array(total);
21130
21407
  let off = 0;
@@ -21135,7 +21412,7 @@ var to_bytes2 = async (data) => {
21135
21412
  return out;
21136
21413
  };
21137
21414
  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}`;
21415
+ 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
21416
  return { kind: "storage_error", cause: new Error(message), operation };
21140
21417
  };
21141
21418
 
@@ -21231,8 +21508,8 @@ function validate_artifact_paths(input) {
21231
21508
  { name: "pipeline_path", path: input.pipeline_path },
21232
21509
  { name: "grants_path", path: input.grants_path }
21233
21510
  ];
21234
- for (const { name, path: path2 } of paths) {
21235
- if (!path2 || path2.trim() === "") {
21511
+ for (const { name, path: field_path } of paths) {
21512
+ if (!field_path || field_path.trim() === "") {
21236
21513
  return err({
21237
21514
  kind: "validation_error",
21238
21515
  message: `${name} must not be empty`
@@ -21249,7 +21526,8 @@ function build_manifest(inputs, artifacts) {
21249
21526
  let manifest_data = artifacts.manifest;
21250
21527
  if (typeof manifest_data === "string") {
21251
21528
  try {
21252
- manifest_data = JSON.parse(manifest_data);
21529
+ const parsed = JSON.parse(manifest_data);
21530
+ manifest_data = parsed;
21253
21531
  } catch {
21254
21532
  return err({
21255
21533
  kind: "schema_error",
@@ -21265,13 +21543,13 @@ function build_manifest(inputs, artifacts) {
21265
21543
  message: "exactly one of bundle_ref or bundle_manifest_ref must be set"
21266
21544
  });
21267
21545
  }
21268
- const worker_base = has_single_file ? {
21546
+ const worker_base = artifacts.bundle_ref !== undefined ? {
21269
21547
  artifact_ref: artifacts.bundle_ref,
21270
21548
  size_bytes: artifacts.bundle?.length ?? 0,
21271
21549
  compatibility_date
21272
21550
  } : {
21273
21551
  artifact_ref: "",
21274
- bundle_manifest_ref: artifacts.bundle_manifest_ref,
21552
+ bundle_manifest_ref: artifacts.bundle_manifest_ref ?? "",
21275
21553
  size_bytes: artifacts.bundle_total_size_bytes ?? 0,
21276
21554
  compatibility_date
21277
21555
  };
@@ -21309,7 +21587,7 @@ function build_bundle_manifest_from_walk(walked, module_refs, main_module, compa
21309
21587
  if (module_refs.length !== walked.parts.length) {
21310
21588
  return err({
21311
21589
  kind: "schema_error",
21312
- message: `module_refs length (${module_refs.length}) doesn't match walked parts (${walked.parts.length})`
21590
+ message: `module_refs length (${String(module_refs.length)}) doesn't match walked parts (${String(walked.parts.length)})`
21313
21591
  });
21314
21592
  }
21315
21593
  const modules = walked.parts.map((part, idx) => ({
@@ -21334,7 +21612,7 @@ function build_asset_manifest_from_walk(walked, asset_refs, config = {}) {
21334
21612
  if (asset_refs.length !== walked.parts.length) {
21335
21613
  return err({
21336
21614
  kind: "schema_error",
21337
- message: `asset_refs length (${asset_refs.length}) doesn't match walked parts (${walked.parts.length})`
21615
+ message: `asset_refs length (${String(asset_refs.length)}) doesn't match walked parts (${String(walked.parts.length)})`
21338
21616
  });
21339
21617
  }
21340
21618
  const assets = walked.parts.map((part, idx) => ({
@@ -21364,7 +21642,7 @@ function compile_template_to_json(template) {
21364
21642
  }
21365
21643
  async function compile_pipeline_ts(pipeline_path) {
21366
21644
  const absolute_path = path.resolve(pipeline_path);
21367
- const cache_bust = `?t=${Date.now()}-${Math.floor(Math.random() * 1e6)}`;
21645
+ const cache_bust = `?t=${String(Date.now())}-${String(Math.floor(Math.random() * 1e6))}`;
21368
21646
  const import_url = `${absolute_path}${cache_bust}`;
21369
21647
  let module_ns;
21370
21648
  try {
@@ -21384,7 +21662,7 @@ var normalise_module_default = (default_export) => {
21384
21662
  }
21385
21663
  if (typeof default_export === "object" && "ok" in default_export) {
21386
21664
  const result = default_export;
21387
- if (result.ok === false) {
21665
+ if (!result.ok) {
21388
21666
  return err({ kind: "dsl_error", cause: result.error });
21389
21667
  }
21390
21668
  return validate_template_shape(result.value);
@@ -22370,11 +22648,15 @@ var render_and_write_one = async (templates_root, target_dir, entry, vars) => {
22370
22648
  var run_command = async (command, args, cwd) => {
22371
22649
  return new Promise((resolve) => {
22372
22650
  const proc = spawn(command, args, { cwd, stdio: "ignore" });
22373
- proc.on("error", (e) => resolve(err({ message: format_error(e), code: null })));
22651
+ proc.on("error", (e) => {
22652
+ resolve(err({ message: format_error(e), code: null }));
22653
+ });
22374
22654
  proc.on("close", (code) => {
22375
- if (code === 0)
22376
- return resolve(ok(undefined));
22377
- resolve(err({ message: `${command} exited with code ${code}`, code }));
22655
+ if (code === 0) {
22656
+ resolve(ok(undefined));
22657
+ return;
22658
+ }
22659
+ resolve(err({ message: `${command} exited with code ${String(code)}`, code }));
22378
22660
  });
22379
22661
  });
22380
22662
  };
@@ -22481,7 +22763,7 @@ var action_init = async (name, options) => {
22481
22763
  });
22482
22764
  if (!result.ok)
22483
22765
  return fail_with(spinner, format_scaffolder_error(result.error));
22484
- spinner.succeed(`Scaffolded ${result.value.files_written.length} files`);
22766
+ spinner.succeed(`Scaffolded ${String(result.value.files_written.length)} files`);
22485
22767
  print_next_steps2(result.value.target_dir, result.value.package_name, options.rollout);
22486
22768
  };
22487
22769
  var default_client_factory = () => {
@@ -22532,7 +22814,7 @@ var action_grants_list = (client_factory) => async (options) => {
22532
22814
  const result = await client.pipelines.grants.list(options.package);
22533
22815
  if (!result.ok)
22534
22816
  return fail_with(spinner, result.error.message);
22535
- spinner.succeed(`${result.value.length} grant(s)`);
22817
+ spinner.succeed(`${String(result.value.length)} grant(s)`);
22536
22818
  for (const g of result.value) {
22537
22819
  const granted_at = g.granted_at ?? source_default2.dim("pending");
22538
22820
  console.log(` ${source_default2.bold(g.id)} ${g.stage_name} ${source_default2.cyan(g.scope)} ${granted_at}`);
@@ -22567,6 +22849,15 @@ var resolve_mode = (options) => {
22567
22849
  const mode = explicit ?? (url !== undefined && url !== "" && token !== undefined && token !== "" ? "cloudflare-http" : "memory");
22568
22850
  return { mode, pipelines_url: url, pipelines_token: token };
22569
22851
  };
22852
+ var require_http_input = (resolved) => {
22853
+ if (resolved.pipelines_url === undefined || resolved.pipelines_token === undefined) {
22854
+ return {
22855
+ ok: false,
22856
+ error: "cloudflare-http mode requires DEVPAD_PIPELINES_URL + DEVPAD_PIPELINES_TOKEN (env or input)"
22857
+ };
22858
+ }
22859
+ return { ok: true, value: { pipelines_url: resolved.pipelines_url, pipelines_token: resolved.pipelines_token } };
22860
+ };
22570
22861
  var action_artifacts_upload = async (options) => {
22571
22862
  const spinner = make_spinner("Uploading artifacts to corpus...").start();
22572
22863
  if (options.bundle !== undefined && options.bundleDir !== undefined) {
@@ -22598,7 +22889,8 @@ var action_artifacts_upload = async (options) => {
22598
22889
  if (options.manifest !== undefined && options.manifest !== "") {
22599
22890
  manifest_text = readFileSync3(options.manifest, "utf8");
22600
22891
  }
22601
- const manifest_obj = JSON.parse(manifest_text);
22892
+ const raw_manifest = JSON.parse(manifest_text);
22893
+ const manifest_obj = raw_manifest;
22602
22894
  const infra_plan = readFileSync3(options.infraPlan);
22603
22895
  const pipeline = readFileSync3(options.pipeline);
22604
22896
  const grants = readFileSync3(options.grants);
@@ -22611,7 +22903,10 @@ var action_artifacts_upload = async (options) => {
22611
22903
  let pipeline_ref;
22612
22904
  let grants_ref;
22613
22905
  if (resolved.mode === "cloudflare-http") {
22614
- const http_input = { pipelines_url: resolved.pipelines_url, pipelines_token: resolved.pipelines_token };
22906
+ const http_input_result = require_http_input(resolved);
22907
+ if (!http_input_result.ok)
22908
+ return fail_with(spinner, http_input_result.error);
22909
+ const http_input = http_input_result.value;
22615
22910
  const refs = await upload_sidecars_http(http_input, { manifest_text, infra_plan, pipeline, grants });
22616
22911
  if (!refs.ok)
22617
22912
  return fail_with(spinner, refs.error);
@@ -22632,7 +22927,10 @@ var action_artifacts_upload = async (options) => {
22632
22927
  if (options.bundle !== undefined) {
22633
22928
  bundle_bytes = readFileSync3(options.bundle);
22634
22929
  if (resolved.mode === "cloudflare-http") {
22635
- const http_input = { pipelines_url: resolved.pipelines_url, pipelines_token: resolved.pipelines_token };
22930
+ const http_input_result = require_http_input(resolved);
22931
+ if (!http_input_result.ok)
22932
+ return fail_with(spinner, http_input_result.error);
22933
+ const http_input = http_input_result.value;
22636
22934
  const u8 = new Uint8Array(bundle_bytes.buffer, bundle_bytes.byteOffset, bundle_bytes.byteLength);
22637
22935
  const upload = await upload_blob_to_store(http_input, "worker-bundles", u8);
22638
22936
  if (!upload.ok)
@@ -22642,10 +22940,15 @@ var action_artifacts_upload = async (options) => {
22642
22940
  bundle_ref = `worker-bundles/${compute_hash2(bundle_bytes).slice(0, 12)}`;
22643
22941
  }
22644
22942
  } else {
22943
+ if (options.bundleDir === undefined)
22944
+ return fail_with(spinner, "--bundle-dir is required");
22645
22945
  const walk = walk_bundle_dir(options.bundleDir);
22646
22946
  if (!walk.ok)
22647
22947
  return fail_with(spinner, format_bundle_walk_error(walk.error));
22648
22948
  bundle_total_size_bytes = walk.value.total_size_bytes;
22949
+ if (options.mainModule === undefined) {
22950
+ return fail_with(spinner, "--main-module is required when --bundle-dir is supplied");
22951
+ }
22649
22952
  const main_module = options.mainModule;
22650
22953
  const has_main = walk.value.parts.some((p) => p.name === main_module);
22651
22954
  if (!has_main) {
@@ -22676,7 +22979,10 @@ var action_artifacts_upload = async (options) => {
22676
22979
  }
22677
22980
  let template_ref;
22678
22981
  if (resolved.mode === "cloudflare-http") {
22679
- const http_input = { pipelines_url: resolved.pipelines_url, pipelines_token: resolved.pipelines_token };
22982
+ const http_input_result = require_http_input(resolved);
22983
+ if (!http_input_result.ok)
22984
+ return fail_with(spinner, http_input_result.error);
22985
+ const http_input = http_input_result.value;
22680
22986
  const template_upload = await compile_and_upload_template(http_input, options.pipeline);
22681
22987
  if (!template_upload.ok)
22682
22988
  return fail_with(spinner, template_upload.error);
@@ -22702,7 +23008,10 @@ var action_artifacts_upload = async (options) => {
22702
23008
  return fail_with(spinner, manifest_result.error.message);
22703
23009
  let version_set_id;
22704
23010
  if (resolved.mode === "cloudflare-http") {
22705
- const http_input = { pipelines_url: resolved.pipelines_url, pipelines_token: resolved.pipelines_token };
23011
+ const http_input_result = require_http_input(resolved);
23012
+ if (!http_input_result.ok)
23013
+ return fail_with(spinner, http_input_result.error);
23014
+ const http_input = http_input_result.value;
22706
23015
  const upload = await upload_version_set(http_input, manifest_result.value);
22707
23016
  if (!upload.ok) {
22708
23017
  return fail_with(spinner, `version-set upload failed: ${format_http_error(upload.error)}`);
@@ -22714,7 +23023,7 @@ var action_artifacts_upload = async (options) => {
22714
23023
  const version_sets = version_set_store2(backend);
22715
23024
  const put_result = await version_sets.put(manifest_result.value);
22716
23025
  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";
23026
+ const error_msg = put_result.error.kind === "storage_error" ? put_result.error.cause.message || "Storage error" : "Failed to store manifest";
22718
23027
  return fail_with(spinner, error_msg);
22719
23028
  }
22720
23029
  version_set_id = put_result.value.version;
@@ -22731,7 +23040,7 @@ var action_artifacts_upload = async (options) => {
22731
23040
  };
22732
23041
  var format_http_error = (e) => {
22733
23042
  if (e.kind === "http")
22734
- return `HTTP ${e.status} ${e.status_text}`;
23043
+ return `HTTP ${String(e.status)} ${String(e.status_text)}`;
22735
23044
  if (e.kind === "network")
22736
23045
  return `network error: ${String(e.cause)}`;
22737
23046
  return e.message ?? "unknown error";
@@ -22755,7 +23064,7 @@ var format_asset_walk_error = (e) => {
22755
23064
  case "io_error":
22756
23065
  return `assets-dir read failed at ${e.path}: ${e.reason}`;
22757
23066
  case "asset_too_large":
22758
- return `asset exceeds CF limit (${e.limit_bytes} bytes): ${e.path} is ${e.size_bytes} bytes`;
23067
+ return `asset exceeds CF limit (${String(e.limit_bytes)} bytes): ${e.path} is ${String(e.size_bytes)} bytes`;
22759
23068
  }
22760
23069
  };
22761
23070
  var upload_sidecars_http = async (input, blobs) => {
@@ -22778,7 +23087,10 @@ var to_u8 = (b) => new Uint8Array(b.buffer, b.byteOffset, b.byteLength);
22778
23087
  var upload_bundle_directory = async (resolved, walk, build) => {
22779
23088
  const module_refs = [];
22780
23089
  if (resolved.mode === "cloudflare-http") {
22781
- const http_input = { pipelines_url: resolved.pipelines_url, pipelines_token: resolved.pipelines_token };
23090
+ const http_input_result = require_http_input(resolved);
23091
+ if (!http_input_result.ok)
23092
+ return http_input_result;
23093
+ const http_input = http_input_result.value;
22782
23094
  for (const part of walk.parts) {
22783
23095
  const upload = await upload_blob_to_store(http_input, "worker-modules", part.bytes);
22784
23096
  if (!upload.ok)
@@ -22798,7 +23110,10 @@ var upload_bundle_directory = async (resolved, walk, build) => {
22798
23110
  return { ok: false, error: manifest.error.message };
22799
23111
  const manifest_bytes = new TextEncoder().encode(JSON.stringify(manifest.value));
22800
23112
  if (resolved.mode === "cloudflare-http") {
22801
- const http_input = { pipelines_url: resolved.pipelines_url, pipelines_token: resolved.pipelines_token };
23113
+ const http_input_result = require_http_input(resolved);
23114
+ if (!http_input_result.ok)
23115
+ return http_input_result;
23116
+ const http_input = http_input_result.value;
22802
23117
  const upload = await upload_blob_to_store(http_input, "bundle-manifests", manifest_bytes);
22803
23118
  if (!upload.ok)
22804
23119
  return { ok: false, error: `bundle-manifests upload failed: ${format_http_error(upload.error)}` };
@@ -22809,7 +23124,10 @@ var upload_bundle_directory = async (resolved, walk, build) => {
22809
23124
  var upload_assets_directory = async (resolved, walk, config) => {
22810
23125
  const asset_refs = [];
22811
23126
  if (resolved.mode === "cloudflare-http") {
22812
- const http_input = { pipelines_url: resolved.pipelines_url, pipelines_token: resolved.pipelines_token };
23127
+ const http_input_result = require_http_input(resolved);
23128
+ if (!http_input_result.ok)
23129
+ return http_input_result;
23130
+ const http_input = http_input_result.value;
22813
23131
  for (const part of walk.parts) {
22814
23132
  const upload = await upload_blob_to_store(http_input, "asset-files", part.bytes);
22815
23133
  if (!upload.ok)
@@ -22826,7 +23144,10 @@ var upload_assets_directory = async (resolved, walk, config) => {
22826
23144
  return { ok: false, error: manifest.error.message };
22827
23145
  const manifest_bytes = new TextEncoder().encode(JSON.stringify(manifest.value));
22828
23146
  if (resolved.mode === "cloudflare-http") {
22829
- const http_input = { pipelines_url: resolved.pipelines_url, pipelines_token: resolved.pipelines_token };
23147
+ const http_input_result = require_http_input(resolved);
23148
+ if (!http_input_result.ok)
23149
+ return http_input_result;
23150
+ const http_input = http_input_result.value;
22830
23151
  const upload = await upload_blob_to_store(http_input, "asset-manifests", manifest_bytes);
22831
23152
  if (!upload.ok)
22832
23153
  return { ok: false, error: `asset-manifests upload failed: ${format_http_error(upload.error)}` };
@@ -22834,27 +23155,27 @@ var upload_assets_directory = async (resolved, walk, config) => {
22834
23155
  }
22835
23156
  return { ok: true, value: `asset-manifests/${compute_hash2(Buffer.from(manifest_bytes)).slice(0, 12)}` };
22836
23157
  };
23158
+ var try_parse_json_object = (text3) => {
23159
+ try {
23160
+ const parsed = JSON.parse(text3);
23161
+ return typeof parsed === "object" && parsed !== null && !Array.isArray(parsed) ? parsed : null;
23162
+ } catch {
23163
+ return null;
23164
+ }
23165
+ };
22837
23166
  var parse_asset_config = (raw) => {
22838
23167
  if (raw === undefined || raw === "")
22839
23168
  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);
23169
+ const inline = try_parse_json_object(raw);
22849
23170
  if (inline !== null)
22850
23171
  return { ok: true, value: inline };
22851
23172
  let file_text;
22852
23173
  try {
22853
23174
  file_text = readFileSync3(raw, "utf8");
22854
- } catch (e) {
23175
+ } catch {
22855
23176
  return { ok: false, error: `--asset-config is neither valid JSON nor a readable file path: ${raw}` };
22856
23177
  }
22857
- const from_file = try_parse(file_text);
23178
+ const from_file = try_parse_json_object(file_text);
22858
23179
  if (from_file === null)
22859
23180
  return { ok: false, error: `--asset-config file does not contain a JSON object: ${raw}` };
22860
23181
  return { ok: true, value: from_file };
@@ -22931,7 +23252,8 @@ var action_runs_events_ingest = (client_factory) => async (run_id, options) => {
22931
23252
  return fail_with(spinner, `--payload-file not found: ${options.payloadFile}`);
22932
23253
  const text3 = readFileSync3(options.payloadFile, "utf8");
22933
23254
  try {
22934
- payload = JSON.parse(text3);
23255
+ const parsed = JSON.parse(text3);
23256
+ payload = parsed;
22935
23257
  } catch (e) {
22936
23258
  return fail_with(spinner, `--payload-file is not valid JSON: ${e instanceof Error ? e.message : String(e)}`);
22937
23259
  }
@@ -22959,7 +23281,7 @@ var action_runs_events_list = (client_factory) => async (run_id) => {
22959
23281
  const result = await client.pipelines.events.list(run_id);
22960
23282
  if (!result.ok)
22961
23283
  return fail_with(spinner, result.error.message);
22962
- spinner.succeed(`${result.value.length} event(s)`);
23284
+ spinner.succeed(`${String(result.value.length)} event(s)`);
22963
23285
  for (const ev of result.value) {
22964
23286
  console.log(` ${source_default2.dim(ev.ts)} ${source_default2.cyan(ev.kind)} ${ev.stage_name} ${source_default2.dim(ev.id)}`);
22965
23287
  }
@@ -22969,11 +23291,11 @@ var action_packages_list = (client_factory) => async (options) => {
22969
23291
  const client = client_factory();
22970
23292
  const filter = options.project !== undefined ? { project_id: await resolve_project_id(client, options.project) } : undefined;
22971
23293
  if (filter !== undefined && filter.project_id === null)
22972
- return fail_with(spinner, `project "${options.project}" not found`);
23294
+ return fail_with(spinner, `project "${String(options.project)}" not found`);
22973
23295
  const result = await client.pipelines.packages.list(filter);
22974
23296
  if (!result.ok)
22975
23297
  return fail_with(spinner, result.error.message);
22976
- spinner.succeed(`${result.value.length} package(s)`);
23298
+ spinner.succeed(`${String(result.value.length)} package(s)`);
22977
23299
  for (const p of result.value) {
22978
23300
  const project_label = p.project_id ?? source_default2.dim("(unlinked)");
22979
23301
  const repo_label = p.repo_url ?? source_default2.dim("(no repo)");
@@ -22986,7 +23308,7 @@ var action_packages_get = (client_factory) => async (id2) => {
22986
23308
  const result = await client.pipelines.packages.get(id2);
22987
23309
  if (!result.ok)
22988
23310
  return fail_with(spinner, result.error.message);
22989
- spinner.succeed(`${result.value.id}`);
23311
+ spinner.succeed(result.value.id);
22990
23312
  console.log(JSON.stringify(result.value, null, 2));
22991
23313
  };
22992
23314
  var action_packages_create = (client_factory) => async (name_arg, options) => {
@@ -23036,7 +23358,8 @@ var action_packages_update = (client_factory) => async (id2, options) => {
23036
23358
  }
23037
23359
  if (options.scriptNameOverrides !== undefined) {
23038
23360
  try {
23039
- patch.script_name_overrides = JSON.parse(options.scriptNameOverrides);
23361
+ const parsed = JSON.parse(options.scriptNameOverrides);
23362
+ patch.script_name_overrides = parsed;
23040
23363
  } catch (e) {
23041
23364
  return fail_with(spinner, `--script-name-overrides is not valid JSON: ${String(e)}`);
23042
23365
  }
@@ -23089,22 +23412,22 @@ var action_oidc_trust_list = (client_factory) => async (options) => {
23089
23412
  const result = await client.pipelines.oidc_trust.list({ owner_id: owner_id2 });
23090
23413
  if (!result.ok)
23091
23414
  return fail_with(spinner, result.error.message);
23092
- spinner.succeed(`${result.value.length} policy(ies)`);
23415
+ spinner.succeed(`${String(result.value.length)} policy(ies)`);
23093
23416
  if (result.value.length === 0) {
23094
23417
  console.log(source_default2.dim(" no policies — run `pipelines oidc-trust add` to create one"));
23095
23418
  return;
23096
23419
  }
23097
23420
  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");
23421
+ const refs_label = p.allowed_refs.length > 0 ? p.allowed_refs.join(",") : source_default2.dim("any");
23422
+ const envs_label = p.allowed_environments.length > 0 ? p.allowed_environments.join(",") : source_default2.dim("any");
23100
23423
  const last_used = p.last_used_at ?? source_default2.dim("(never)");
23101
23424
  console.log(` ${source_default2.bold(p.id)}`);
23102
23425
  console.log(` owner: ${source_default2.cyan(p.github_owner)}/${p.repo_pattern}`);
23103
23426
  console.log(` aud: ${p.expected_audience}`);
23104
- console.log(` actions: ${(p.allowed_actions ?? []).join(",")}`);
23427
+ console.log(` actions: ${p.allowed_actions.join(",")}`);
23105
23428
  console.log(` refs: ${refs_label}`);
23106
23429
  console.log(` environments: ${envs_label}`);
23107
- console.log(` ttl: ${p.session_ttl_seconds}s`);
23430
+ console.log(` ttl: ${String(p.session_ttl_seconds)}s`);
23108
23431
  console.log(` last_used: ${last_used}`);
23109
23432
  }
23110
23433
  };
@@ -23165,8 +23488,8 @@ var action_oidc_trust_add = (client_factory) => async (options) => {
23165
23488
  console.log(` github_owner: ${result.value.github_owner}`);
23166
23489
  console.log(` repo_pattern: ${result.value.repo_pattern}`);
23167
23490
  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`);
23491
+ console.log(` actions: ${result.value.allowed_actions.join(",")}`);
23492
+ console.log(` ttl: ${String(result.value.session_ttl_seconds)}s`);
23170
23493
  };
23171
23494
  var action_oidc_trust_remove = (client_factory) => async (id2, options) => {
23172
23495
  const client = client_factory();
@@ -23207,16 +23530,16 @@ var action_analysis_templates_list = (client_factory) => async (options) => {
23207
23530
  const result = await client.pipelines.analysis_templates.list({ owner_id: owner_id2 });
23208
23531
  if (!result.ok)
23209
23532
  return fail_with(spinner, result.error.message);
23210
- spinner.succeed(`${result.value.length} template(s)`);
23533
+ spinner.succeed(`${String(result.value.length)} template(s)`);
23211
23534
  if (result.value.length === 0) {
23212
23535
  console.log(source_default2.dim(" no templates — run `pipelines analysis-templates create` to add one"));
23213
23536
  return;
23214
23537
  }
23215
23538
  for (const t of result.value) {
23216
- const dsl_text = typeof t.threshold_dsl === "string" ? t.threshold_dsl : String(t.threshold_dsl ?? "");
23539
+ const dsl_text = typeof t.threshold_dsl === "string" ? t.threshold_dsl : JSON.stringify(t.threshold_dsl ?? "");
23217
23540
  const dsl_lines = dsl_text.split(`
23218
23541
  `).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`);
23542
+ console.log(` ${source_default2.bold(t.id)} ${source_default2.cyan(t.name)} ${String(dsl_lines)} threshold(s) ${String(t.window_ms)}ms`);
23220
23543
  }
23221
23544
  };
23222
23545
  var action_analysis_templates_get = (client_factory) => async (id2, options) => {
@@ -23261,7 +23584,7 @@ var action_analysis_templates_create = (client_factory) => async (options) => {
23261
23584
  spinner.succeed(`created ${result.value.id}`);
23262
23585
  console.log(source_default2.green(` id: ${result.value.id}`));
23263
23586
  console.log(` name: ${result.value.name}`);
23264
- console.log(` window_ms: ${result.value.window_ms}`);
23587
+ console.log(` window_ms: ${String(result.value.window_ms)}`);
23265
23588
  };
23266
23589
  var action_analysis_templates_update = (client_factory) => async (id2, options) => {
23267
23590
  const spinner = make_spinner(`Updating ${id2}...`).start();
@@ -23340,8 +23663,8 @@ var action_workflow_migrate = (_client_factory) => async (package_name, options)
23340
23663
  `).length;
23341
23664
  const new_lines = rendered.value.split(`
23342
23665
  `).length;
23343
- console.log(` before: ${old_lines} lines`);
23344
- console.log(` after: ${new_lines} lines`);
23666
+ console.log(` before: ${String(old_lines)} lines`);
23667
+ console.log(` after: ${String(new_lines)} lines`);
23345
23668
  console.log(source_default2.dim(` omit --dry-run to write`));
23346
23669
  }
23347
23670
  return;
@@ -23356,8 +23679,8 @@ var action_workflow_migrate = (_client_factory) => async (package_name, options)
23356
23679
  `).length;
23357
23680
  const new_lines = rendered.value.split(`
23358
23681
  `).length;
23359
- console.log(` before: ${old_lines} lines${existed_before ? "" : " (new file)"}`);
23360
- console.log(` after: ${new_lines} lines`);
23682
+ console.log(` before: ${String(old_lines)} lines${existed_before ? "" : " (new file)"}`);
23683
+ console.log(` after: ${String(new_lines)} lines`);
23361
23684
  }
23362
23685
  };
23363
23686
  var resolve_owner_id = async (client) => {
@@ -23516,8 +23839,8 @@ projects.command("create").description("Create a new project").requiredOption("-
23516
23839
  description: options.description,
23517
23840
  private: options.private
23518
23841
  });
23519
- spinner.succeed(`Project "${result.name}" created`);
23520
- console.log(source_default.green(`ID: ${result.id}`));
23842
+ spinner.succeed(`Project "${String(result.name)}" created`);
23843
+ console.log(source_default.green(`ID: ${String(result.id)}`));
23521
23844
  } catch (error) {
23522
23845
  spinner.fail("Failed to create project");
23523
23846
  handleError(error);
@@ -23604,8 +23927,8 @@ tasks.command("create").description("Create a new task").requiredOption("-t, --t
23604
23927
  priority: options.priority.toUpperCase(),
23605
23928
  progress: options.status === "done" ? "DONE" : options.status === "in_progress" ? "IN_PROGRESS" : "TODO"
23606
23929
  });
23607
- spinner.succeed(`Task "${result.title}" created`);
23608
- console.log(source_default.green(`ID: ${result.id}`));
23930
+ spinner.succeed(`Task "${String(result.title)}" created`);
23931
+ console.log(source_default.green(`ID: ${String(result.id)}`));
23609
23932
  } catch (error) {
23610
23933
  spinner.fail("Failed to create task");
23611
23934
  handleError(error);
@@ -23622,7 +23945,7 @@ tasks.command("done <id>").description("Mark a task as done").action(async (id2)
23622
23945
  id: id2,
23623
23946
  progress: "DONE"
23624
23947
  });
23625
- spinner.succeed(`Task "${result.title}" marked as done`);
23948
+ spinner.succeed(`Task "${String(result.title)}" marked as done`);
23626
23949
  } catch (error) {
23627
23950
  spinner.fail("Failed to update task");
23628
23951
  handleError(error);
@@ -23639,7 +23962,7 @@ tasks.command("todo <id>").description("Mark a task as todo").action(async (id2)
23639
23962
  id: id2,
23640
23963
  progress: "TODO"
23641
23964
  });
23642
- spinner.succeed(`Task "${result.title}" marked as todo`);
23965
+ spinner.succeed(`Task "${String(result.title)}" marked as todo`);
23643
23966
  } catch (error) {
23644
23967
  spinner.fail("Failed to update task");
23645
23968
  handleError(error);
@@ -23710,8 +24033,8 @@ milestones.command("create").description("Create a new milestone").requiredOptio
23710
24033
  target_time: options.targetTime,
23711
24034
  target_version: options.targetVersion
23712
24035
  });
23713
- spinner.succeed(`Milestone "${result.name}" created`);
23714
- console.log(source_default.green(`ID: ${result.id}`));
24036
+ spinner.succeed(`Milestone "${String(result.name)}" created`);
24037
+ console.log(source_default.green(`ID: ${String(result.id)}`));
23715
24038
  } catch (error) {
23716
24039
  spinner.fail("Failed to create milestone");
23717
24040
  handleError(error);
@@ -23746,8 +24069,8 @@ goals.command("create").description("Create a new goal").requiredOption("-n, --n
23746
24069
  description: options.description,
23747
24070
  target_time: options.targetTime
23748
24071
  });
23749
- spinner.succeed(`Goal "${result.name}" created`);
23750
- console.log(source_default.green(`ID: ${result.id}`));
24072
+ spinner.succeed(`Goal "${String(result.name)}" created`);
24073
+ console.log(source_default.green(`ID: ${String(result.id)}`));
23751
24074
  } catch (error) {
23752
24075
  spinner.fail("Failed to create goal");
23753
24076
  handleError(error);