@devpad/api 2.2.5 → 2.2.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -5,7 +5,7 @@ import {
5
5
  upsert_milestone,
6
6
  upsert_project,
7
7
  upsert_todo
8
- } from "./chunk-7SQVSGWV.js";
8
+ } from "./chunk-ZPEX7KVX.js";
9
9
 
10
10
  // src/errors.ts
11
11
  var ApiError = class _ApiError extends Error {
@@ -320,14 +320,14 @@ var ApiClient = class {
320
320
  if (response.status === HTTP_STATUS.NO_CONTENT) {
321
321
  result = void 0;
322
322
  } else {
323
- const text = await response.text();
324
- if (!text || text.trim() === "" || text.trim() === "null") {
323
+ const text2 = await response.text();
324
+ if (!text2 || text2.trim() === "" || text2.trim() === "null") {
325
325
  result = void 0;
326
326
  } else {
327
327
  try {
328
- result = JSON.parse(text);
328
+ result = JSON.parse(text2);
329
329
  } catch (parseError) {
330
- result = text;
330
+ result = text2;
331
331
  }
332
332
  }
333
333
  }
@@ -446,8 +446,8 @@ var ApiClient2 = class {
446
446
  const result = await this.projects.list(filters);
447
447
  if (!result.ok) throw new Error(result.error.message);
448
448
  return result.value.reduce(
449
- (acc, project) => {
450
- acc[project.id] = project;
449
+ (acc, project2) => {
450
+ acc[project2.id] = project2;
451
451
  return acc;
452
452
  },
453
453
  {}
@@ -456,7 +456,7 @@ var ApiClient2 = class {
456
456
  /**
457
457
  * Get project by ID
458
458
  */
459
- find: (id) => wrap(() => this.clients.projects.get("/projects", { query: { id } })),
459
+ find: (id2) => wrap(() => this.clients.projects.get("/projects", { query: { id: id2 } })),
460
460
  /**
461
461
  * Get project by name
462
462
  */
@@ -464,7 +464,7 @@ var ApiClient2 = class {
464
464
  /**
465
465
  * Get project by ID (throws if not found)
466
466
  */
467
- getById: (id) => wrap(() => this.clients.projects.get("/projects", { query: { id } })),
467
+ getById: (id2) => wrap(() => this.clients.projects.get("/projects", { query: { id: id2 } })),
468
468
  /**
469
469
  * Create a new project
470
470
  */
@@ -478,30 +478,30 @@ var ApiClient2 = class {
478
478
  body: idOrData
479
479
  });
480
480
  }
481
- const id = idOrData;
481
+ const id2 = idOrData;
482
482
  if (!changes) {
483
483
  throw new Error("Changes parameter required for update");
484
484
  }
485
- const result = await this.projects.find(id);
485
+ const result = await this.projects.find(id2);
486
486
  if (!result.ok) throw new Error(result.error.message);
487
- if (!result.value) throw new Error(`Project with id ${id} not found`);
488
- const project = result.value;
487
+ if (!result.value) throw new Error(`Project with id ${id2} not found`);
488
+ const project2 = result.value;
489
489
  const updateData = {
490
- id: project.id,
491
- project_id: project.project_id,
492
- owner_id: project.owner_id,
493
- name: project.name,
494
- description: project.description,
495
- specification: project.specification,
496
- repo_url: project.repo_url,
497
- repo_id: project.repo_id,
498
- icon_url: project.icon_url,
499
- status: project.status,
500
- deleted: project.deleted,
501
- link_url: project.link_url,
502
- link_text: project.link_text,
503
- visibility: project.visibility,
504
- current_version: project.current_version,
490
+ id: project2.id,
491
+ project_id: project2.project_id,
492
+ owner_id: project2.owner_id,
493
+ name: project2.name,
494
+ description: project2.description,
495
+ specification: project2.specification,
496
+ repo_url: project2.repo_url,
497
+ repo_id: project2.repo_id,
498
+ icon_url: project2.icon_url,
499
+ status: project2.status,
500
+ deleted: project2.deleted,
501
+ link_url: project2.link_url,
502
+ link_text: project2.link_text,
503
+ visibility: project2.visibility,
504
+ current_version: project2.current_version,
505
505
  ...changes
506
506
  };
507
507
  return this.clients.projects.patch("/projects", {
@@ -582,9 +582,9 @@ var ApiClient2 = class {
582
582
  /**
583
583
  * Delete project (soft delete)
584
584
  */
585
- deleteProject: (project) => wrap(
585
+ deleteProject: (project2) => wrap(
586
586
  () => this.clients.projects.patch("/projects", {
587
- body: { ...project, deleted: true }
587
+ body: { ...project2, deleted: true }
588
588
  })
589
589
  )
590
590
  };
@@ -603,9 +603,9 @@ var ApiClient2 = class {
603
603
  /**
604
604
  * Get milestone by ID
605
605
  */
606
- find: (id) => wrap(async () => {
606
+ find: (id2) => wrap(async () => {
607
607
  try {
608
- return await this.clients.milestones.get(`/milestones/${id}`);
608
+ return await this.clients.milestones.get(`/milestones/${id2}`);
609
609
  } catch (error) {
610
610
  return null;
611
611
  }
@@ -617,32 +617,32 @@ var ApiClient2 = class {
617
617
  /**
618
618
  * Update milestone
619
619
  */
620
- update: async (id, data) => wrap(async () => {
621
- const result = await this.milestones.find(id);
620
+ update: async (id2, data) => wrap(async () => {
621
+ const result = await this.milestones.find(id2);
622
622
  if (!result.ok) throw new Error(result.error.message);
623
- if (!result.value) throw new Error(`Milestone with id ${id} not found`);
624
- const milestone = result.value;
623
+ if (!result.value) throw new Error(`Milestone with id ${id2} not found`);
624
+ const milestone2 = result.value;
625
625
  const updateData = {
626
- id: milestone.id,
627
- project_id: milestone.project_id,
628
- name: data.name ?? milestone.name,
629
- description: data.description ?? milestone.description,
630
- target_time: data.target_time ?? milestone.target_time,
631
- target_version: data.target_version ?? milestone.target_version,
632
- finished_at: data.finished_at !== void 0 ? data.finished_at : milestone.finished_at
626
+ id: milestone2.id,
627
+ project_id: milestone2.project_id,
628
+ name: data.name ?? milestone2.name,
629
+ description: data.description ?? milestone2.description,
630
+ target_time: data.target_time ?? milestone2.target_time,
631
+ target_version: data.target_version ?? milestone2.target_version,
632
+ finished_at: data.finished_at !== void 0 ? data.finished_at : milestone2.finished_at
633
633
  };
634
- return this.clients.milestones.patch(`/milestones/${id}`, {
634
+ return this.clients.milestones.patch(`/milestones/${id2}`, {
635
635
  body: updateData
636
636
  });
637
637
  }),
638
638
  /**
639
639
  * Delete milestone (soft delete)
640
640
  */
641
- delete: (id) => wrap(() => this.clients.milestones.delete(`/milestones/${id}`)),
641
+ delete: (id2) => wrap(() => this.clients.milestones.delete(`/milestones/${id2}`)),
642
642
  /**
643
643
  * Get goals for a milestone
644
644
  */
645
- goals: (id) => wrap(() => this.clients.milestones.get(`/milestones/${id}/goals`))
645
+ goals: (id2) => wrap(() => this.clients.milestones.get(`/milestones/${id2}/goals`))
646
646
  };
647
647
  /**
648
648
  * Goals namespace with Result-wrapped operations
@@ -655,7 +655,7 @@ var ApiClient2 = class {
655
655
  /**
656
656
  * Get goal by ID
657
657
  */
658
- find: (id) => wrap(() => this.clients.goals.get(`/goals/${id}`)),
658
+ find: (id2) => wrap(() => this.clients.goals.get(`/goals/${id2}`)),
659
659
  /**
660
660
  * Create new goal
661
661
  */
@@ -663,27 +663,27 @@ var ApiClient2 = class {
663
663
  /**
664
664
  * Update goal
665
665
  */
666
- update: async (id, data) => wrap(async () => {
667
- const result = await this.goals.find(id);
666
+ update: async (id2, data) => wrap(async () => {
667
+ const result = await this.goals.find(id2);
668
668
  if (!result.ok) throw new Error(result.error.message);
669
- if (!result.value) throw new Error(`Goal with id ${id} not found`);
670
- const goal = result.value;
669
+ if (!result.value) throw new Error(`Goal with id ${id2} not found`);
670
+ const goal2 = result.value;
671
671
  const updateData = {
672
- id: goal.id,
673
- milestone_id: goal.milestone_id,
674
- name: data.name ?? goal.name,
675
- description: data.description ?? goal.description,
676
- target_time: data.target_time ?? goal.target_time,
677
- finished_at: data.finished_at !== void 0 ? data.finished_at : goal.finished_at
672
+ id: goal2.id,
673
+ milestone_id: goal2.milestone_id,
674
+ name: data.name ?? goal2.name,
675
+ description: data.description ?? goal2.description,
676
+ target_time: data.target_time ?? goal2.target_time,
677
+ finished_at: data.finished_at !== void 0 ? data.finished_at : goal2.finished_at
678
678
  };
679
- return this.clients.goals.patch(`/goals/${id}`, {
679
+ return this.clients.goals.patch(`/goals/${id2}`, {
680
680
  body: updateData
681
681
  });
682
682
  }),
683
683
  /**
684
684
  * Delete goal (soft delete)
685
685
  */
686
- delete: (id) => wrap(() => this.clients.goals.delete(`/goals/${id}`))
686
+ delete: (id2) => wrap(() => this.clients.goals.delete(`/goals/${id2}`))
687
687
  };
688
688
  /**
689
689
  * Tasks namespace with Result-wrapped operations
@@ -701,7 +701,7 @@ var ApiClient2 = class {
701
701
  /**
702
702
  * Get task by ID
703
703
  */
704
- find: (id) => wrap(() => this.clients.tasks.get("/tasks", { query: { id } })),
704
+ find: (id2) => wrap(() => this.clients.tasks.get("/tasks", { query: { id: id2 } })),
705
705
  /**
706
706
  * Get tasks by project ID
707
707
  */
@@ -717,23 +717,23 @@ var ApiClient2 = class {
717
717
  /**
718
718
  * Update an existing task
719
719
  */
720
- update: async (id, changes) => wrap(async () => {
721
- const result = await this.tasks.find(id);
720
+ update: async (id2, changes) => wrap(async () => {
721
+ const result = await this.tasks.find(id2);
722
722
  if (!result.ok) throw new Error(result.error.message);
723
- if (!result.value) throw new Error(`Task with id ${id} not found`);
724
- const task = result.value;
723
+ if (!result.value) throw new Error(`Task with id ${id2} not found`);
724
+ const task2 = result.value;
725
725
  const updateData = {
726
- id,
727
- title: task.task.title,
728
- summary: task.task.summary,
729
- description: task.task.description,
730
- progress: task.task.progress,
731
- visibility: task.task.visibility,
732
- start_time: task.task.start_time,
733
- end_time: task.task.end_time,
734
- priority: task.task.priority,
735
- owner_id: task.task.owner_id,
736
- project_id: task.task.project_id,
726
+ id: id2,
727
+ title: task2.task.title,
728
+ summary: task2.task.summary,
729
+ description: task2.task.description,
730
+ progress: task2.task.progress,
731
+ visibility: task2.task.visibility,
732
+ start_time: task2.task.start_time,
733
+ end_time: task2.task.end_time,
734
+ priority: task2.task.priority,
735
+ owner_id: task2.task.owner_id,
736
+ project_id: task2.task.project_id,
737
737
  ...changes
738
738
  };
739
739
  return this.clients.tasks.patch("/tasks", {
@@ -751,9 +751,9 @@ var ApiClient2 = class {
751
751
  /**
752
752
  * Delete task (soft delete)
753
753
  */
754
- deleteTask: (task) => wrap(
754
+ deleteTask: (task2) => wrap(
755
755
  () => this.clients.tasks.patch("/tasks", {
756
- body: { ...task.task, deleted: true }
756
+ body: { ...task2.task, deleted: true }
757
757
  })
758
758
  ),
759
759
  /**
@@ -815,7 +815,7 @@ var ApiClient2 = class {
815
815
  getForPost: (uuid) => wrap(() => this.clients.blog.get(`/blog/tags/posts/${uuid}/tags`)),
816
816
  setForPost: (uuid, tags) => wrap(() => this.clients.blog.put(`/blog/tags/posts/${uuid}/tags`, { body: { tags } })),
817
817
  addToPost: (uuid, tags) => wrap(() => this.clients.blog.post(`/blog/tags/posts/${uuid}/tags`, { body: { tags } })),
818
- removeFromPost: (uuid, tag) => wrap(() => this.clients.blog.delete(`/blog/tags/posts/${uuid}/tags/${tag}`))
818
+ removeFromPost: (uuid, tag2) => wrap(() => this.clients.blog.delete(`/blog/tags/posts/${uuid}/tags/${tag2}`))
819
819
  },
820
820
  categories: {
821
821
  tree: () => wrap(() => this.clients.blog.get("/blog/categories")),
@@ -830,12 +830,12 @@ var ApiClient2 = class {
830
830
  tokens: {
831
831
  list: () => wrap(() => this.clients.blog.get("/blog/tokens")),
832
832
  create: (data) => wrap(() => this.clients.blog.post("/blog/tokens", { body: data })),
833
- update: (id, data) => wrap(
834
- () => this.clients.blog.put(`/blog/tokens/${id}`, {
833
+ update: (id2, data) => wrap(
834
+ () => this.clients.blog.put(`/blog/tokens/${id2}`, {
835
835
  body: data
836
836
  })
837
837
  ),
838
- delete: (id) => wrap(() => this.clients.blog.delete(`/blog/tokens/${id}`))
838
+ delete: (id2) => wrap(() => this.clients.blog.delete(`/blog/tokens/${id2}`))
839
839
  }
840
840
  };
841
841
  this.media = {
@@ -845,9 +845,9 @@ var ApiClient2 = class {
845
845
  return res.profiles;
846
846
  }),
847
847
  create: (data) => wrap(() => this.clients.media.post("/profiles", { body: data })),
848
- get: (id) => wrap(() => this.clients.media.get(`/profiles/${id}`)),
849
- update: (id, data) => wrap(() => this.clients.media.patch(`/profiles/${id}`, { body: data })),
850
- delete: (id) => wrap(() => this.clients.media.delete(`/profiles/${id}`)),
848
+ get: (id2) => wrap(() => this.clients.media.get(`/profiles/${id2}`)),
849
+ update: (id2, data) => wrap(() => this.clients.media.patch(`/profiles/${id2}`, { body: data })),
850
+ delete: (id2) => wrap(() => this.clients.media.delete(`/profiles/${id2}`)),
851
851
  filters: {
852
852
  list: (profile_id) => wrap(async () => {
853
853
  const res = await this.clients.media.get(`/profiles/${profile_id}/filters`);
@@ -1033,15 +1033,15 @@ var ApiClient2 = class {
1033
1033
  /**
1034
1034
  * Get a subscription by ID
1035
1035
  */
1036
- get: (id) => wrap(() => this.clients.pulse.get(`/admin/subs/${id}`)),
1036
+ get: (id2) => wrap(() => this.clients.pulse.get(`/admin/subs/${id2}`)),
1037
1037
  /**
1038
1038
  * Update a subscription
1039
1039
  */
1040
- update: (id, patch) => wrap(() => this.clients.pulse.patch(`/admin/subs/${id}`, { body: patch })),
1040
+ update: (id2, patch) => wrap(() => this.clients.pulse.patch(`/admin/subs/${id2}`, { body: patch })),
1041
1041
  /**
1042
1042
  * Delete a subscription
1043
1043
  */
1044
- delete: (id) => wrap(() => this.clients.pulse.delete(`/admin/subs/${id}`))
1044
+ delete: (id2) => wrap(() => this.clients.pulse.delete(`/admin/subs/${id2}`))
1045
1045
  },
1046
1046
  /**
1047
1047
  * Ingest key management
@@ -1066,7 +1066,154 @@ var ApiClient2 = class {
1066
1066
  /**
1067
1067
  * Delete an ingest key
1068
1068
  */
1069
- delete: (id, input) => wrap(() => this.clients.pulse.delete(`/admin/keys/${id}`, { query: { project_id: input.project_id } }))
1069
+ delete: (id2, input) => wrap(() => this.clients.pulse.delete(`/admin/keys/${id2}`, { query: { project_id: input.project_id } }))
1070
+ }
1071
+ };
1072
+ /**
1073
+ * Pipelines namespace with Result-wrapped operations
1074
+ */
1075
+ this.pipelines = {
1076
+ /**
1077
+ * List pipeline runs ordered by `created_at` DESC. Optional filters
1078
+ * narrow by package and/or status; `limit` defaults to 50 server-side
1079
+ * and is capped at 200.
1080
+ */
1081
+ list: (filter) => {
1082
+ const query = {};
1083
+ if (filter?.package_id !== void 0) query.package_id = filter.package_id;
1084
+ if (filter?.status !== void 0) query.status = filter.status;
1085
+ if (filter?.limit !== void 0) query.limit = String(filter.limit);
1086
+ return wrap(() => this.clients.pipelines.get("/runs", Object.keys(query).length > 0 ? { query } : void 0));
1087
+ },
1088
+ /**
1089
+ * Get a pipeline run by ID
1090
+ */
1091
+ get: (run_id) => wrap(() => this.clients.pipelines.get(`/runs/${run_id}`)),
1092
+ /**
1093
+ * Create a new pipeline run
1094
+ */
1095
+ create: (input) => wrap(
1096
+ () => this.clients.pipelines.post("/runs", {
1097
+ body: input
1098
+ })
1099
+ ),
1100
+ /**
1101
+ * Approve a stage in a pipeline run
1102
+ */
1103
+ approve: (run_id, input) => wrap(
1104
+ () => this.clients.pipelines.post(`/runs/${run_id}/approve`, {
1105
+ body: input
1106
+ })
1107
+ ),
1108
+ /**
1109
+ * Cancel a pipeline run
1110
+ */
1111
+ cancel: (run_id) => wrap(() => this.clients.pipelines.post(`/runs/${run_id}/cancel`, { body: {} })),
1112
+ /**
1113
+ * Rollback a pipeline run
1114
+ */
1115
+ rollback: (run_id) => wrap(() => this.clients.pipelines.post(`/runs/${run_id}/rollback`, { body: {} })),
1116
+ /**
1117
+ * Grants namespace
1118
+ */
1119
+ grants: {
1120
+ /**
1121
+ * List grants for a package
1122
+ */
1123
+ list: (package_id) => wrap(
1124
+ () => this.clients.pipelines.get("/grants", {
1125
+ query: package_id ? { package_id } : {}
1126
+ })
1127
+ ),
1128
+ /**
1129
+ * Approve a grant
1130
+ */
1131
+ approve: (grant_id, user_id) => wrap(
1132
+ () => this.clients.pipelines.post(`/grants/${grant_id}/approve`, {
1133
+ body: { user_id }
1134
+ })
1135
+ ),
1136
+ /**
1137
+ * Deny a grant
1138
+ */
1139
+ deny: (grant_id, user_id, reason) => wrap(
1140
+ () => this.clients.pipelines.post(`/grants/${grant_id}/deny`, {
1141
+ body: { user_id, reason }
1142
+ })
1143
+ )
1144
+ },
1145
+ /**
1146
+ * Packages namespace — full CRUD over pipeline_package rows. Writes
1147
+ * (create/update/delete) require the orchestrator bearer token; the
1148
+ * HttpClient picks it up via the standard auth header injection.
1149
+ */
1150
+ packages: {
1151
+ /**
1152
+ * List packages, optionally filtered by linked devpad project.
1153
+ * Packages with `project_id = null` are not yet linked.
1154
+ */
1155
+ list: (filter) => {
1156
+ const query = {};
1157
+ if (filter?.project_id !== void 0) query.project_id = filter.project_id;
1158
+ return wrap(() => this.clients.pipelines.get("/packages", Object.keys(query).length > 0 ? { query } : void 0));
1159
+ },
1160
+ /**
1161
+ * Get a single package by id
1162
+ */
1163
+ get: (package_id) => wrap(() => this.clients.pipelines.get(`/packages/${package_id}`)),
1164
+ /**
1165
+ * Register a new pipeline package. `id` is canonically the same as
1166
+ * `name` per existing convention but is supplied explicitly so the
1167
+ * orchestrator can disambiguate renames without conflicts.
1168
+ */
1169
+ create: (input) => wrap(() => this.clients.pipelines.post("/packages", { body: input })),
1170
+ /**
1171
+ * Partially update a package row. Missing keys preserve existing
1172
+ * values; explicit `null` clears the field.
1173
+ */
1174
+ update: (package_id, input) => wrap(() => this.clients.pipelines.patch(`/packages/${package_id}`, { body: input })),
1175
+ /**
1176
+ * Remove a package. Refuses (409) if pipeline_run rows still
1177
+ * reference the package — clean up runs first.
1178
+ */
1179
+ delete: (package_id) => wrap(() => this.clients.pipelines.delete(`/packages/${package_id}`))
1180
+ },
1181
+ /**
1182
+ * OIDC trust-policy namespace — admin-gated CRUD for the
1183
+ * `pipeline_oidc_trust` table. Phase 15.D surface; each call requires
1184
+ * the orchestrator's bearer token (literal `PIPELINES_TOKEN`).
1185
+ * `owner_id` is required on every operation — single-tenant today,
1186
+ * but the column is in place so multi-user ACLs slot in later.
1187
+ */
1188
+ oidc_trust: {
1189
+ /**
1190
+ * List policies for an owner, ordered created_at DESC, id ASC —
1191
+ * matches the trust-matcher resolution order so the management UI
1192
+ * shows the policy that would be picked first.
1193
+ */
1194
+ list: (input) => wrap(() => this.clients.pipelines.get("/oidc-trust", { query: { owner_id: input.owner_id } })),
1195
+ /**
1196
+ * Get a single policy by id, scoped to its owner. 404 when
1197
+ * unknown, soft-deleted, or owned by a different user.
1198
+ */
1199
+ get: (id2, input) => wrap(() => this.clients.pipelines.get(`/oidc-trust/${id2}`, { query: { owner_id: input.owner_id } })),
1200
+ /**
1201
+ * Create a new policy. Defaults per plan §I.5: `repo_pattern: "*"`,
1202
+ * `allowed_actions: ["artifacts:upload","runs:start"]`,
1203
+ * `session_ttl_seconds: 900`.
1204
+ */
1205
+ create: (input) => wrap(() => this.clients.pipelines.post("/oidc-trust", { body: input })),
1206
+ /**
1207
+ * Partial patch — only the supplied fields are touched. Validation
1208
+ * runs against the merged record server-side.
1209
+ */
1210
+ update: (id2, input) => wrap(() => this.clients.pipelines.patch(`/oidc-trust/${id2}`, { body: input })),
1211
+ /**
1212
+ * Soft-delete a policy (sets `deleted = true`; row preserved for
1213
+ * audit). The matcher and management list both skip soft-deleted
1214
+ * rows.
1215
+ */
1216
+ delete: (id2, input) => wrap(() => this.clients.pipelines.delete(`/oidc-trust/${id2}`, { query: { owner_id: input.owner_id } }))
1070
1217
  }
1071
1218
  };
1072
1219
  const base_url = options.base_url || "http://localhost:4321/api/v1";
@@ -1097,7 +1244,8 @@ var ApiClient2 = class {
1097
1244
  tags: new ApiClient({ ...clientOptions, category: "tags" }),
1098
1245
  blog: new ApiClient({ ...clientOptions, category: "blog" }),
1099
1246
  media: new ApiClient({ ...clientOptions, category: "media" }),
1100
- pulse: new ApiClient({ ...clientOptions, base_url: `${base_url}/pulse`, category: "pulse" })
1247
+ pulse: new ApiClient({ ...clientOptions, base_url: `${base_url}/pulse`, category: "pulse" }),
1248
+ pipelines: new ApiClient({ ...clientOptions, category: "pipelines" })
1101
1249
  };
1102
1250
  }
1103
1251
  /**
@@ -1120,6 +1268,394 @@ var ApiClient2 = class {
1120
1268
  }
1121
1269
  };
1122
1270
 
1271
+ // ../schema/dist/database/schema.js
1272
+ import { relations, sql } from "drizzle-orm";
1273
+ import { int, integer, primaryKey, sqliteTable, text, unique } from "drizzle-orm/sqlite-core";
1274
+ var timestamps = () => ({
1275
+ created_at: text("created_at").notNull().default(sql`(CURRENT_TIMESTAMP)`),
1276
+ updated_at: text("updated_at").notNull().default(sql`(CURRENT_TIMESTAMP)`)
1277
+ });
1278
+ var deleted = () => ({
1279
+ deleted: int("deleted", { mode: "boolean" }).notNull().default(false)
1280
+ });
1281
+ var provenance = () => ({
1282
+ created_by: text("created_by", { enum: ["user", "api"] }).notNull().default("user"),
1283
+ modified_by: text("modified_by", { enum: ["user", "api"] }).notNull().default("user"),
1284
+ protected: int("protected", { mode: "boolean" }).notNull().default(false)
1285
+ });
1286
+ var owner_id = () => ({
1287
+ owner_id: text("owner_id").notNull().references(() => user.id)
1288
+ });
1289
+ var id = (prefix) => ({
1290
+ id: text("id").primaryKey().$defaultFn(() => `${prefix}_${crypto.randomUUID()}`)
1291
+ });
1292
+ var entity = (prefix) => ({
1293
+ ...id(prefix),
1294
+ ...timestamps(),
1295
+ ...deleted(),
1296
+ ...provenance()
1297
+ });
1298
+ var owned_entity = (prefix) => ({
1299
+ ...entity(prefix),
1300
+ ...owner_id()
1301
+ });
1302
+ var user = sqliteTable("user", {
1303
+ id: text("id").primaryKey().$defaultFn(() => `user_${crypto.randomUUID()}`),
1304
+ github_id: integer("github_id"),
1305
+ name: text("name"),
1306
+ email: text("email").unique(),
1307
+ email_verified: text("email_verified"),
1308
+ // timestamp
1309
+ image_url: text("image_url"),
1310
+ task_view: text("task_view", { enum: ["list", "grid"] }).notNull().default("list")
1311
+ });
1312
+ var session = sqliteTable("session", {
1313
+ id: text("id").notNull().primaryKey(),
1314
+ userId: text("user_id").notNull().references(() => user.id),
1315
+ expiresAt: integer("expires_at").notNull(),
1316
+ access_token: text("access_token")
1317
+ });
1318
+ var api_keys = sqliteTable("api_keys", {
1319
+ ...id("apikey"),
1320
+ user_id: text("user_id").notNull().references(() => user.id),
1321
+ key_hash: text("key_hash").notNull().unique(),
1322
+ name: text("name"),
1323
+ note: text("note"),
1324
+ scope: text("scope", { enum: ["devpad", "blog", "media", "pulse", "all"] }).notNull().default("all"),
1325
+ enabled: integer("enabled", { mode: "boolean" }).notNull().default(true),
1326
+ last_used_at: text("last_used_at"),
1327
+ ...timestamps(),
1328
+ deleted: integer("deleted", { mode: "boolean" }).notNull().default(false)
1329
+ });
1330
+ var project = sqliteTable("project", {
1331
+ ...owned_entity("project"),
1332
+ project_id: text("project_id").notNull(),
1333
+ name: text("name").notNull(),
1334
+ description: text("description"),
1335
+ specification: text("specification"),
1336
+ repo_url: text("repo_url"),
1337
+ repo_id: integer("repo_id"),
1338
+ icon_url: text("icon_url"),
1339
+ status: text("status", { enum: ["DEVELOPMENT", "PAUSED", "RELEASED", "LIVE", "FINISHED", "ABANDONED", "STOPPED"] }).notNull().default("DEVELOPMENT"),
1340
+ link_url: text("link_url"),
1341
+ link_text: text("link_text"),
1342
+ visibility: text("visibility", { enum: ["PUBLIC", "PRIVATE", "HIDDEN", "ARCHIVED", "DRAFT", "DELETED"] }).notNull().default("PRIVATE"),
1343
+ current_version: text("current_version"),
1344
+ scan_branch: text("scan_branch")
1345
+ });
1346
+ var ACTIONS = [
1347
+ "CREATE_TASK",
1348
+ "UPDATE_TASK",
1349
+ "DELETE_TASK",
1350
+ "CREATE_PROJECT",
1351
+ "UPDATE_PROJECT",
1352
+ "DELETE_PROJECT",
1353
+ "CREATE_TAG",
1354
+ "UPDATE_TAG",
1355
+ "DELETE_TAG",
1356
+ "CREATE_GOAL",
1357
+ "UPDATE_GOAL",
1358
+ "DELETE_GOAL",
1359
+ "CREATE_MILESTONE",
1360
+ "UPDATE_MILESTONE",
1361
+ "DELETE_MILESTONE",
1362
+ "CREATE_CHECKLIST",
1363
+ "UPDATE_CHECKLIST",
1364
+ "DELETE_CHECKLIST"
1365
+ ];
1366
+ var action = sqliteTable("action", {
1367
+ ...owned_entity("action"),
1368
+ type: text("type", { enum: ACTIONS }).notNull(),
1369
+ description: text("description").notNull(),
1370
+ data: text("data", { mode: "json" }),
1371
+ channel: text("channel", { enum: ["user", "api"] }).notNull().default("user")
1372
+ });
1373
+ var tracker_result = sqliteTable("tracker_result", {
1374
+ id: integer("id").primaryKey({ autoIncrement: true }),
1375
+ project_id: text("project_id").notNull().references(() => project.id),
1376
+ created_at: text("created_at").notNull().default(sql`(CURRENT_TIMESTAMP)`),
1377
+ data: text("data", { mode: "json" }).notNull(),
1378
+ accepted: integer("accepted", { mode: "boolean" }).notNull().default(false)
1379
+ });
1380
+ var todo_updates = sqliteTable("todo_updates", {
1381
+ id: integer("id").primaryKey({ autoIncrement: true }),
1382
+ project_id: text("project_id").notNull().references(() => project.id),
1383
+ created_at: text("created_at").notNull().default(sql`(CURRENT_TIMESTAMP)`),
1384
+ old_id: integer("old_id").references(() => tracker_result.id),
1385
+ new_id: integer("new_id").notNull().references(() => tracker_result.id),
1386
+ data: text("data", { mode: "json" }).notNull(),
1387
+ status: text("status", { enum: ["PENDING", "ACCEPTED", "REJECTED", "IGNORED"] }).notNull().default("PENDING"),
1388
+ branch: text("branch"),
1389
+ commit_sha: text("commit_sha"),
1390
+ commit_msg: text("commit_msg"),
1391
+ commit_url: text("commit_url")
1392
+ });
1393
+ var update_tracker_relations = relations(todo_updates, ({ one }) => ({
1394
+ old: one(tracker_result, { fields: [todo_updates.old_id], references: [tracker_result.id] }),
1395
+ new: one(tracker_result, { fields: [todo_updates.new_id], references: [tracker_result.id] })
1396
+ }));
1397
+ var milestone = sqliteTable("milestone", {
1398
+ ...entity("milestone"),
1399
+ project_id: text("project_id").notNull().references(() => project.id),
1400
+ name: text("name").notNull(),
1401
+ description: text("description"),
1402
+ target_time: text("target_time"),
1403
+ target_version: text("target_version"),
1404
+ finished_at: text("finished_at"),
1405
+ after_id: text("after_id")
1406
+ });
1407
+ var goal = sqliteTable("goal", {
1408
+ ...entity("goal"),
1409
+ milestone_id: text("milestone_id").notNull().references(() => milestone.id),
1410
+ name: text("name").notNull(),
1411
+ description: text("description"),
1412
+ target_time: text("target_time"),
1413
+ finished_at: text("finished_at")
1414
+ });
1415
+ var task = sqliteTable("task", {
1416
+ ...owned_entity("task"),
1417
+ title: text("title").notNull(),
1418
+ progress: text("progress", { enum: ["UNSTARTED", "IN_PROGRESS", "COMPLETED"] }).notNull().default("UNSTARTED"),
1419
+ visibility: text("visibility", { enum: ["PUBLIC", "PRIVATE", "HIDDEN", "ARCHIVED", "DRAFT", "DELETED"] }).notNull().default("PRIVATE"),
1420
+ goal_id: text("goal_id").references(() => goal.id),
1421
+ project_id: text("project_id").references(() => project.id),
1422
+ description: text("description"),
1423
+ start_time: text("start_time"),
1424
+ end_time: text("end_time"),
1425
+ summary: text("summary"),
1426
+ codebase_task_id: text("codebase_task_id").references(() => codebase_tasks.id),
1427
+ priority: text("priority", { enum: ["LOW", "MEDIUM", "HIGH"] }).notNull().default("LOW")
1428
+ });
1429
+ var checklist = sqliteTable("checklist", {
1430
+ ...entity("checklist"),
1431
+ task_id: text("task_id").notNull().references(() => task.id),
1432
+ name: text("name").notNull()
1433
+ });
1434
+ var checklist_item = sqliteTable("checklist_item", {
1435
+ ...entity("checklist-item"),
1436
+ checklist_id: text("checklist_id").notNull().references(() => checklist.id),
1437
+ parent_id: text("parent_id"),
1438
+ name: text("name").notNull(),
1439
+ checked: int("checked", { mode: "boolean" }).notNull().default(false)
1440
+ });
1441
+ var codebase_tasks = sqliteTable("codebase_tasks", {
1442
+ ...entity("codebase-task"),
1443
+ branch: text("branch"),
1444
+ commit_sha: text("commit_sha"),
1445
+ commit_msg: text("commit_msg"),
1446
+ commit_url: text("commit_url"),
1447
+ type: text("type"),
1448
+ text: text("text"),
1449
+ file: text("file"),
1450
+ line: integer("line"),
1451
+ context: text("context", { mode: "json" }),
1452
+ recent_scan_id: integer("recent_scan_id").references(() => tracker_result.id)
1453
+ });
1454
+ var tag = sqliteTable("tag", {
1455
+ ...owned_entity("tag"),
1456
+ title: text("title").notNull(),
1457
+ color: text("color"),
1458
+ render: int("render", { mode: "boolean" }).notNull().default(true)
1459
+ }, (table) => ({
1460
+ tag_unique: unique("tag_unique").on(table.owner_id, table.title)
1461
+ }));
1462
+ var task_tag = sqliteTable("task_tag", {
1463
+ task_id: text("task_id").notNull().references(() => task.id),
1464
+ tag_id: text("tag_id").notNull().references(() => tag.id),
1465
+ ...timestamps()
1466
+ }, (table) => ({
1467
+ task_tag_unique: primaryKey({ columns: [table.task_id, table.tag_id] })
1468
+ }));
1469
+ var commit_detail = sqliteTable("commit_detail", {
1470
+ sha: text("sha").primaryKey(),
1471
+ message: text("message").notNull(),
1472
+ url: text("url").notNull(),
1473
+ avatar_url: text("avatar_url"),
1474
+ author_user: text("author_user").notNull(),
1475
+ author_name: text("author_name"),
1476
+ author_email: text("author_email").notNull(),
1477
+ date: text("date").notNull()
1478
+ });
1479
+ var tag_config = sqliteTable("tag_config", {
1480
+ ...id("tag_config"),
1481
+ project_id: text("project_id").notNull().references(() => project.id),
1482
+ // Foreign key to projects
1483
+ tag_id: text("tag_id").notNull().references(() => tag.id),
1484
+ // Foreign key to tags
1485
+ match: text("match").notNull(),
1486
+ // Match pattern for this tag
1487
+ ...timestamps()
1488
+ });
1489
+ var ignore_path = sqliteTable("ignore_path", {
1490
+ ...id("ignore_path"),
1491
+ project_id: text("project_id").notNull().references(() => project.id),
1492
+ // Foreign key to projects
1493
+ path: text("path").notNull(),
1494
+ // Ignore path
1495
+ ...timestamps()
1496
+ });
1497
+ var ROLLOUT_SHAPES = ["gradual", "atomic"];
1498
+ var RUN_KINDS = ["deploy", "rollback"];
1499
+ var RUN_STATUSES = ["queued", "deploying", "baking", "awaiting_approval", "rolling_back", "completed", "rolled_back", "failed", "cancelled"];
1500
+ var FORCED_ATOMIC_REASONS = ["do_migrations", "asset_affinity_none"];
1501
+ var STAGE_EVENT_KINDS = ["deploy_started", "deploy_completed", "bake_started", "bake_completed", "gate_verdict", "approval_requested", "rollback_started", "rollback_completed", "warning", "error"];
1502
+ var APPROVAL_DECISIONS = ["approved", "denied"];
1503
+ var pipeline_package = sqliteTable("pipeline_package", {
1504
+ ...entity("pipeline-package"),
1505
+ owner_id: text("owner_id").notNull().references(() => user.id),
1506
+ name: text("name").notNull(),
1507
+ repo_url: text("repo_url"),
1508
+ default_template_ref: text("default_template_ref"),
1509
+ script_name_overrides: text("script_name_overrides", { mode: "json" }),
1510
+ project_id: text("project_id").references(() => project.id)
1511
+ });
1512
+ var pipeline_run = sqliteTable("pipeline_run", {
1513
+ ...entity("pipeline-run"),
1514
+ package_id: text("package_id").notNull().references(() => pipeline_package.id),
1515
+ version_set_id: text("version_set_id").notNull(),
1516
+ shape: text("shape", { enum: ROLLOUT_SHAPES }).notNull(),
1517
+ kind: text("kind", { enum: RUN_KINDS }).notNull().default("deploy"),
1518
+ status: text("status", { enum: RUN_STATUSES }).notNull().default("queued"),
1519
+ current_stage: text("current_stage"),
1520
+ resolved_rollout: text("resolved_rollout", { mode: "json" }).notNull(),
1521
+ resolved_gates: text("resolved_gates", { mode: "json" }).notNull(),
1522
+ forced_atomic_reason: text("forced_atomic_reason", { enum: FORCED_ATOMIC_REASONS }),
1523
+ started_at: text("started_at"),
1524
+ finished_at: text("finished_at")
1525
+ });
1526
+ var pipeline_stage_event = sqliteTable("pipeline_stage_event", {
1527
+ ...id("pipeline-stage-event"),
1528
+ run_id: text("run_id").notNull().references(() => pipeline_run.id),
1529
+ stage_name: text("stage_name").notNull(),
1530
+ kind: text("kind", { enum: STAGE_EVENT_KINDS }).notNull(),
1531
+ payload: text("payload", { mode: "json" }),
1532
+ ts: text("ts").notNull().default(sql`(CURRENT_TIMESTAMP)`)
1533
+ });
1534
+ var pipeline_grant = sqliteTable("pipeline_grant", {
1535
+ ...entity("pipeline-grant"),
1536
+ package_id: text("package_id").notNull().references(() => pipeline_package.id),
1537
+ stage_name: text("stage_name").notNull(),
1538
+ scope: text("scope").notNull(),
1539
+ granted_by: text("granted_by").references(() => user.id),
1540
+ granted_at: text("granted_at")
1541
+ });
1542
+ var pipeline_approval = sqliteTable("pipeline_approval", {
1543
+ ...id("pipeline-approval"),
1544
+ run_id: text("run_id").notNull().references(() => pipeline_run.id),
1545
+ stage_name: text("stage_name").notNull(),
1546
+ decision: text("decision", { enum: APPROVAL_DECISIONS }),
1547
+ reason: text("reason"),
1548
+ decided_by: text("decided_by").references(() => user.id),
1549
+ decided_at: text("decided_at"),
1550
+ ...timestamps()
1551
+ });
1552
+ var pipeline_analysis_template = sqliteTable("pipeline_analysis_template", {
1553
+ ...entity("pipeline-analysis-template"),
1554
+ owner_id: text("owner_id").notNull().references(() => user.id),
1555
+ name: text("name").notNull(),
1556
+ query_dsl: text("query_dsl", { mode: "json" }).notNull(),
1557
+ threshold_dsl: text("threshold_dsl", { mode: "json" }).notNull(),
1558
+ window_ms: integer("window_ms").notNull().default(6e5)
1559
+ });
1560
+ var PIPELINE_OIDC_PROVIDERS = ["github"];
1561
+ var pipeline_oidc_trust = sqliteTable("pipeline_oidc_trust", {
1562
+ ...entity("pipeline-oidc-trust"),
1563
+ owner_id: text("owner_id").notNull().references(() => user.id),
1564
+ provider: text("provider", { enum: PIPELINE_OIDC_PROVIDERS }).notNull().default("github"),
1565
+ github_owner: text("github_owner").notNull(),
1566
+ repo_pattern: text("repo_pattern").notNull().default("*"),
1567
+ allowed_refs: text("allowed_refs", { mode: "json" }).$type().notNull().default(sql`'[]'`),
1568
+ allowed_environments: text("allowed_environments", { mode: "json" }).$type().notNull().default(sql`'[]'`),
1569
+ expected_audience: text("expected_audience").notNull(),
1570
+ allowed_actions: text("allowed_actions", { mode: "json" }).$type().notNull().default(sql`'["artifacts:upload","runs:start"]'`),
1571
+ session_ttl_seconds: integer("session_ttl_seconds").notNull().default(900),
1572
+ last_used_at: text("last_used_at")
1573
+ });
1574
+ var user_relations = relations(user, ({ many }) => ({
1575
+ sessions: many(session),
1576
+ api_keys: many(api_keys),
1577
+ actions: many(action),
1578
+ tasks: many(task),
1579
+ tags: many(tag)
1580
+ }));
1581
+ var session_relations = relations(session, ({ one }) => ({
1582
+ user: one(user, { fields: [session.userId], references: [user.id] })
1583
+ }));
1584
+ var api_keys_relations = relations(api_keys, ({ one }) => ({
1585
+ owner: one(user, { fields: [api_keys.user_id], references: [user.id] })
1586
+ }));
1587
+ var project_relations = relations(project, ({ one, many }) => ({
1588
+ owner: one(user, { fields: [project.owner_id], references: [user.id] }),
1589
+ tracker_results: many(tracker_result),
1590
+ milestones: many(milestone),
1591
+ todo_updates: many(todo_updates)
1592
+ }));
1593
+ var action_relations = relations(action, ({ one }) => ({
1594
+ owner: one(user, { fields: [action.owner_id], references: [user.id] })
1595
+ }));
1596
+ var tracker_result_relations = relations(tracker_result, ({ one }) => ({
1597
+ project: one(project, { fields: [tracker_result.project_id], references: [project.id] })
1598
+ }));
1599
+ var todoUpdatesRelations = relations(todo_updates, ({ one }) => ({
1600
+ project: one(project, { fields: [todo_updates.project_id], references: [project.id] }),
1601
+ oldTrackerResult: one(tracker_result, { fields: [todo_updates.old_id], references: [tracker_result.id] }),
1602
+ newTrackerResult: one(tracker_result, { fields: [todo_updates.new_id], references: [tracker_result.id] })
1603
+ }));
1604
+ var milestone_relations = relations(milestone, ({ one, many }) => ({
1605
+ project: one(project, { fields: [milestone.project_id], references: [project.id] }),
1606
+ goals: many(goal)
1607
+ }));
1608
+ var goal_relations = relations(goal, ({ one }) => ({
1609
+ milestone: one(milestone, { fields: [goal.milestone_id], references: [milestone.id] })
1610
+ }));
1611
+ var task_relations = relations(task, ({ one, many }) => ({
1612
+ owner: one(user, { fields: [task.owner_id], references: [user.id] }),
1613
+ goal: one(goal, { fields: [task.goal_id], references: [goal.id] }),
1614
+ codebase_task: one(codebase_tasks, { fields: [task.codebase_task_id], references: [codebase_tasks.id] }),
1615
+ checklists: many(checklist)
1616
+ }));
1617
+ var checklist_relations = relations(checklist, ({ one, many }) => ({
1618
+ task: one(task, { fields: [checklist.task_id], references: [task.id] }),
1619
+ items: many(checklist_item)
1620
+ }));
1621
+ var checklist_item_relations = relations(checklist_item, ({ one }) => ({
1622
+ checklist: one(checklist, { fields: [checklist_item.checklist_id], references: [checklist.id] })
1623
+ }));
1624
+ var tag_relations = relations(tag, ({ one }) => ({
1625
+ owner: one(user, { fields: [tag.owner_id], references: [user.id] })
1626
+ }));
1627
+ var task_tag_relations = relations(task_tag, ({ one }) => ({
1628
+ task: one(task, { fields: [task_tag.task_id], references: [task.id] }),
1629
+ tag: one(tag, { fields: [task_tag.tag_id], references: [tag.id] })
1630
+ }));
1631
+ var pipeline_package_relations = relations(pipeline_package, ({ one, many }) => ({
1632
+ owner: one(user, { fields: [pipeline_package.owner_id], references: [user.id] }),
1633
+ runs: many(pipeline_run),
1634
+ grants: many(pipeline_grant)
1635
+ }));
1636
+ var pipeline_run_relations = relations(pipeline_run, ({ one, many }) => ({
1637
+ package: one(pipeline_package, { fields: [pipeline_run.package_id], references: [pipeline_package.id] }),
1638
+ events: many(pipeline_stage_event),
1639
+ approvals: many(pipeline_approval)
1640
+ }));
1641
+ var pipeline_stage_event_relations = relations(pipeline_stage_event, ({ one }) => ({
1642
+ run: one(pipeline_run, { fields: [pipeline_stage_event.run_id], references: [pipeline_run.id] })
1643
+ }));
1644
+ var pipeline_grant_relations = relations(pipeline_grant, ({ one }) => ({
1645
+ package: one(pipeline_package, { fields: [pipeline_grant.package_id], references: [pipeline_package.id] }),
1646
+ granted_by_user: one(user, { fields: [pipeline_grant.granted_by], references: [user.id] })
1647
+ }));
1648
+ var pipeline_approval_relations = relations(pipeline_approval, ({ one }) => ({
1649
+ run: one(pipeline_run, { fields: [pipeline_approval.run_id], references: [pipeline_run.id] }),
1650
+ decided_by_user: one(user, { fields: [pipeline_approval.decided_by], references: [user.id] })
1651
+ }));
1652
+ var pipeline_analysis_template_relations = relations(pipeline_analysis_template, ({ one }) => ({
1653
+ owner: one(user, { fields: [pipeline_analysis_template.owner_id], references: [user.id] })
1654
+ }));
1655
+ var pipeline_oidc_trust_relations = relations(pipeline_oidc_trust, ({ one }) => ({
1656
+ owner: one(user, { fields: [pipeline_oidc_trust.owner_id], references: [user.id] })
1657
+ }));
1658
+
1123
1659
  // src/tools.ts
1124
1660
  import { z } from "zod";
1125
1661
  function unwrap(result) {
@@ -1306,9 +1842,9 @@ var tools = {
1306
1842
  id: z.string().describe("Project ID")
1307
1843
  }),
1308
1844
  execute: async (client, input) => {
1309
- const project = unwrap(await client.projects.find(input.id));
1310
- if (!project) throw new Error(`Project ${input.id} not found`);
1311
- unwrap(await client.projects.deleteProject(project));
1845
+ const project2 = unwrap(await client.projects.find(input.id));
1846
+ if (!project2) throw new Error(`Project ${input.id} not found`);
1847
+ unwrap(await client.projects.deleteProject(project2));
1312
1848
  return { success: true };
1313
1849
  }
1314
1850
  },
@@ -1370,9 +1906,9 @@ var tools = {
1370
1906
  id: z.string().describe("Task ID")
1371
1907
  }),
1372
1908
  execute: async (client, input) => {
1373
- const task = unwrap(await client.tasks.find(input.id));
1374
- if (!task) throw new Error(`Task ${input.id} not found`);
1375
- unwrap(await client.tasks.deleteTask(task));
1909
+ const task2 = unwrap(await client.tasks.find(input.id));
1910
+ if (!task2) throw new Error(`Task ${input.id} not found`);
1911
+ unwrap(await client.tasks.deleteTask(task2));
1376
1912
  return { success: true };
1377
1913
  }
1378
1914
  },
@@ -1546,8 +2082,8 @@ var tools = {
1546
2082
  slug: z.string().optional().describe("Profile slug")
1547
2083
  }),
1548
2084
  execute: async (client, input) => {
1549
- const { id, ...data } = input;
1550
- return unwrap(await client.media.profiles.update(id, data));
2085
+ const { id: id2, ...data } = input;
2086
+ return unwrap(await client.media.profiles.update(id2, data));
1551
2087
  }
1552
2088
  },
1553
2089
  devpad_media_profiles_delete: {
@@ -1681,6 +2217,200 @@ var tools = {
1681
2217
  rate_limit_per_min: z.number().optional().describe("Rate limit in requests per minute (default 600)")
1682
2218
  }),
1683
2219
  execute: async (client, input) => unwrap(await client.pulse.keys.create(input))
2220
+ },
2221
+ devpad_pipelines_list: {
2222
+ name: "devpad_pipelines_list",
2223
+ description: "List pipeline runs (newest first). Optionally filter by package and/or status; cap limit at 200.",
2224
+ inputSchema: z.object({
2225
+ package_id: z.string().optional().describe("Filter runs to a specific package"),
2226
+ status: z.enum(RUN_STATUSES).optional().describe("Filter by run status"),
2227
+ limit: z.number().int().positive().max(200).optional().describe("Max rows to return (default 50, cap 200)")
2228
+ }),
2229
+ execute: async (client, input) => unwrap(await client.pipelines.list(input))
2230
+ },
2231
+ devpad_pipelines_get: {
2232
+ name: "devpad_pipelines_get",
2233
+ description: "Get a pipeline run by ID",
2234
+ inputSchema: z.object({
2235
+ run_id: z.string().describe("Pipeline run ID")
2236
+ }),
2237
+ execute: async (client, input) => unwrap(await client.pipelines.get(input.run_id))
2238
+ },
2239
+ devpad_pipelines_create: {
2240
+ name: "devpad_pipelines_create",
2241
+ description: "Create a new pipeline run",
2242
+ inputSchema: z.object({
2243
+ package_id: z.string().describe("Package ID"),
2244
+ version_set_id: z.string().describe("Version set ID to deploy")
2245
+ }),
2246
+ execute: async (client, input) => unwrap(await client.pipelines.create(input))
2247
+ },
2248
+ devpad_pipelines_approve: {
2249
+ name: "devpad_pipelines_approve",
2250
+ description: "Approve or deny a stage in a pipeline run",
2251
+ inputSchema: z.object({
2252
+ run_id: z.string().describe("Pipeline run ID"),
2253
+ stage_name: z.string().describe("Stage name to approve"),
2254
+ decision: z.enum(["approved", "denied"]).describe("Approval decision"),
2255
+ user_id: z.string().describe("User ID making the decision"),
2256
+ reason: z.string().optional().describe("Optional reason for the decision")
2257
+ }),
2258
+ execute: async (client, input) => {
2259
+ unwrap(await client.pipelines.approve(input.run_id, input));
2260
+ return { success: true };
2261
+ }
2262
+ },
2263
+ devpad_pipelines_cancel: {
2264
+ name: "devpad_pipelines_cancel",
2265
+ description: "Cancel a pipeline run",
2266
+ inputSchema: z.object({
2267
+ run_id: z.string().describe("Pipeline run ID")
2268
+ }),
2269
+ execute: async (client, input) => {
2270
+ unwrap(await client.pipelines.cancel(input.run_id));
2271
+ return { success: true };
2272
+ }
2273
+ },
2274
+ devpad_pipelines_rollback: {
2275
+ name: "devpad_pipelines_rollback",
2276
+ description: "Rollback a completed or failed pipeline run",
2277
+ inputSchema: z.object({
2278
+ run_id: z.string().describe("Pipeline run ID")
2279
+ }),
2280
+ execute: async (client, input) => {
2281
+ unwrap(await client.pipelines.rollback(input.run_id));
2282
+ return { success: true };
2283
+ }
2284
+ },
2285
+ devpad_pipelines_grants_list: {
2286
+ name: "devpad_pipelines_grants_list",
2287
+ description: "List vault grants for a pipeline package",
2288
+ inputSchema: z.object({
2289
+ package_id: z.string().describe("Package ID to filter grants by")
2290
+ }),
2291
+ execute: async (client, input) => unwrap(await client.pipelines.grants.list(input.package_id))
2292
+ },
2293
+ devpad_pipelines_grants_approve: {
2294
+ name: "devpad_pipelines_grants_approve",
2295
+ description: "Approve a pending vault grant request for a pipeline package",
2296
+ inputSchema: z.object({
2297
+ grant_id: z.string().describe("Grant ID to approve"),
2298
+ user_id: z.string().describe("User ID making the approval decision")
2299
+ }),
2300
+ execute: async (client, input) => unwrap(await client.pipelines.grants.approve(input.grant_id, input.user_id))
2301
+ },
2302
+ devpad_pipelines_grants_deny: {
2303
+ name: "devpad_pipelines_grants_deny",
2304
+ description: "Deny a pending vault grant request for a pipeline package",
2305
+ inputSchema: z.object({
2306
+ grant_id: z.string().describe("Grant ID to deny"),
2307
+ user_id: z.string().describe("User ID making the denial decision"),
2308
+ reason: z.string().optional().describe("Optional reason for the denial")
2309
+ }),
2310
+ execute: async (client, input) => unwrap(await client.pipelines.grants.deny(input.grant_id, input.user_id, input.reason))
2311
+ },
2312
+ devpad_pipelines_packages_list: {
2313
+ name: "devpad_pipelines_packages_list",
2314
+ description: "List pipeline packages. Optionally filter by linked devpad project_id; unlinked packages have project_id = null.",
2315
+ inputSchema: z.object({
2316
+ project_id: z.string().optional().describe("Filter packages by linked devpad project")
2317
+ }),
2318
+ execute: async (client, input) => unwrap(await client.pipelines.packages.list(input))
2319
+ },
2320
+ devpad_pipelines_packages_get: {
2321
+ name: "devpad_pipelines_packages_get",
2322
+ description: "Get a pipeline package by ID",
2323
+ inputSchema: z.object({
2324
+ package_id: z.string().describe("Pipeline package ID")
2325
+ }),
2326
+ execute: async (client, input) => unwrap(await client.pipelines.packages.get(input.package_id))
2327
+ },
2328
+ devpad_pipelines_packages_create: {
2329
+ name: "devpad_pipelines_packages_create",
2330
+ description: "Register a new pipeline-managed package. By convention `id` equals the package `name`. `project_id` optionally links the package to a devpad project.",
2331
+ inputSchema: z.object({
2332
+ id: z.string().describe("Canonical package ID (typically the same as name)"),
2333
+ name: z.string().describe("Package name"),
2334
+ owner_id: z.string().describe("User ID of the owner"),
2335
+ repo_url: z.string().optional().describe("Optional git repo URL"),
2336
+ project_id: z.string().optional().describe("Optional devpad project ID to link"),
2337
+ default_template_ref: z.string().optional().describe("Optional default pipeline template ref")
2338
+ }),
2339
+ execute: async (client, input) => unwrap(await client.pipelines.packages.create(input))
2340
+ },
2341
+ devpad_pipelines_packages_update: {
2342
+ name: "devpad_pipelines_packages_update",
2343
+ description: "Partially update a pipeline package. Only the provided fields are touched.",
2344
+ inputSchema: z.object({
2345
+ id: z.string().describe("Pipeline package ID"),
2346
+ repo_url: z.string().nullable().optional(),
2347
+ project_id: z.string().nullable().optional(),
2348
+ default_template_ref: z.string().nullable().optional(),
2349
+ script_name_overrides: z.record(z.string(), z.string()).nullable().optional()
2350
+ }),
2351
+ execute: async (client, input) => {
2352
+ const { id: id2, ...patch } = input;
2353
+ return unwrap(await client.pipelines.packages.update(id2, patch));
2354
+ }
2355
+ },
2356
+ devpad_pipelines_packages_delete: {
2357
+ name: "devpad_pipelines_packages_delete",
2358
+ description: "Delete a pipeline package. Refuses with conflict if existing pipeline_run rows still reference the package.",
2359
+ inputSchema: z.object({
2360
+ id: z.string().describe("Pipeline package ID")
2361
+ }),
2362
+ execute: async (client, input) => unwrap(await client.pipelines.packages.delete(input.id))
2363
+ },
2364
+ devpad_pipelines_oidc_trust_list: {
2365
+ name: "devpad_pipelines_oidc_trust_list",
2366
+ 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.",
2367
+ inputSchema: z.object({
2368
+ owner_id: z.string().describe("User ID whose trust policies to list")
2369
+ }),
2370
+ execute: async (client, input) => unwrap(await client.pipelines.oidc_trust.list(input))
2371
+ },
2372
+ devpad_pipelines_oidc_trust_create: {
2373
+ name: "devpad_pipelines_oidc_trust_create",
2374
+ 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.',
2375
+ inputSchema: z.object({
2376
+ owner_id: z.string().describe("Devpad user ID who owns this policy"),
2377
+ github_owner: z.string().describe('GitHub `repository_owner` claim to trust (e.g. "f0rbit")'),
2378
+ expected_audience: z.string().describe("Required `aud` claim on the OIDC token \u2014 typically the orchestrator URL"),
2379
+ repo_pattern: z.string().optional().describe('Glob matched against the repo name ("*" matches all). Default: "*"'),
2380
+ allowed_refs: z.array(z.string()).optional().describe('Allowed Git refs (e.g. ["refs/heads/main"]). Empty/omitted = any ref'),
2381
+ allowed_environments: z.array(z.string()).optional().describe("Allowed GitHub environments. Empty/omitted = any"),
2382
+ allowed_actions: z.array(z.string()).optional().describe('Scope strings granted to session tokens. Default: ["artifacts:upload","runs:start"]'),
2383
+ session_ttl_seconds: z.number().int().positive().optional().describe("Session token TTL. Default: 900 (15 min)")
2384
+ }),
2385
+ execute: async (client, input) => unwrap(await client.pipelines.oidc_trust.create(input))
2386
+ },
2387
+ devpad_pipelines_oidc_trust_update: {
2388
+ name: "devpad_pipelines_oidc_trust_update",
2389
+ description: "Partially update a GitHub Actions OIDC trust policy. Only the supplied fields are touched; validation runs server-side against the merged record.",
2390
+ inputSchema: z.object({
2391
+ id: z.string().describe("Trust policy ID"),
2392
+ owner_id: z.string().describe("Owner ID (must match the policy's owner)"),
2393
+ github_owner: z.string().optional(),
2394
+ expected_audience: z.string().optional(),
2395
+ repo_pattern: z.string().optional(),
2396
+ allowed_refs: z.array(z.string()).optional(),
2397
+ allowed_environments: z.array(z.string()).optional(),
2398
+ allowed_actions: z.array(z.string()).optional(),
2399
+ session_ttl_seconds: z.number().int().positive().optional()
2400
+ }),
2401
+ execute: async (client, input) => {
2402
+ const { id: id2, ...patch } = input;
2403
+ return unwrap(await client.pipelines.oidc_trust.update(id2, patch));
2404
+ }
2405
+ },
2406
+ devpad_pipelines_oidc_trust_delete: {
2407
+ name: "devpad_pipelines_oidc_trust_delete",
2408
+ description: "Soft-delete a GitHub Actions OIDC trust policy. The row is preserved for audit; the matcher and list operations skip soft-deleted rows.",
2409
+ inputSchema: z.object({
2410
+ id: z.string().describe("Trust policy ID"),
2411
+ owner_id: z.string().describe("Owner ID (must match the policy's owner)")
2412
+ }),
2413
+ execute: async (client, input) => unwrap(await client.pipelines.oidc_trust.delete(input.id, { owner_id: input.owner_id }))
1684
2414
  }
1685
2415
  };
1686
2416
  var toolNames = Object.keys(tools);