@devpad/api 2.2.6 → 2.2.8

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
@@ -1,11 +1,13 @@
1
1
  import {
2
+ RUN_STATUSES,
3
+ STAGE_EVENT_KINDS,
2
4
  save_config_request,
3
5
  save_tags_request,
4
6
  upsert_goal,
5
7
  upsert_milestone,
6
8
  upsert_project,
7
9
  upsert_todo
8
- } from "./chunk-7SQVSGWV.js";
10
+ } from "./chunk-TEOIDOOX.js";
9
11
 
10
12
  // src/errors.ts
11
13
  var ApiError = class _ApiError extends Error {
@@ -423,9 +425,7 @@ var ApiClient2 = class {
423
425
  list: () => wrap(() => this.clients.auth.get("/keys")),
424
426
  create: (input) => {
425
427
  const body = typeof input === "string" ? { name: input } : input ?? {};
426
- return wrap(
427
- () => this.clients.auth.post("/keys", { body })
428
- );
428
+ return wrap(() => this.clients.auth.post("/keys", { body }));
429
429
  },
430
430
  revoke: (key_id) => wrap(() => this.clients.auth.delete(`/keys/${key_id}`)),
431
431
  remove: (key_id) => wrap(() => this.clients.auth.delete(`/keys/${key_id}`))
@@ -1069,6 +1069,226 @@ var ApiClient2 = class {
1069
1069
  delete: (id, input) => wrap(() => this.clients.pulse.delete(`/admin/keys/${id}`, { query: { project_id: input.project_id } }))
1070
1070
  }
1071
1071
  };
1072
+ /**
1073
+ * Pipelines namespace with Result-wrapped operations
1074
+ */
1075
+ this.pipelines = {
1076
+ /**
1077
+ * Dashboard namespace — Phase 2.D observability slice. Aggregates
1078
+ * `pipeline_run`, `pipeline_stage_event`, and `pipeline_approval`
1079
+ * for the project's pipeline_package(s) over `window_ms` and
1080
+ * enriches the response with pulse `/summary` when configured.
1081
+ *
1082
+ * Lives at `GET /v1/pipelines/dashboard?project_id=...&window_ms=...`
1083
+ * on the main worker (unified D1 binding — no orchestrator hop).
1084
+ * Auth: session cookie + ownership check on the project_id.
1085
+ * Cache: `public, max-age=30`.
1086
+ */
1087
+ dashboard: {
1088
+ get: (input) => {
1089
+ const query = { project_id: input.project_id };
1090
+ if (input.window_ms !== void 0) query.window_ms = String(input.window_ms);
1091
+ return wrap(() => this.clients.pipelines.get("/pipelines/dashboard", { query }));
1092
+ }
1093
+ },
1094
+ /**
1095
+ * List pipeline runs ordered by `created_at` DESC. Optional filters
1096
+ * narrow by package and/or status; `limit` defaults to 50 server-side
1097
+ * and is capped at 200.
1098
+ */
1099
+ list: (filter) => {
1100
+ const query = {};
1101
+ if (filter?.package_id !== void 0) query.package_id = filter.package_id;
1102
+ if (filter?.status !== void 0) query.status = filter.status;
1103
+ if (filter?.limit !== void 0) query.limit = String(filter.limit);
1104
+ return wrap(() => this.clients.pipelines.get("/runs", Object.keys(query).length > 0 ? { query } : void 0));
1105
+ },
1106
+ /**
1107
+ * Get a pipeline run by ID
1108
+ */
1109
+ get: (run_id) => wrap(() => this.clients.pipelines.get(`/runs/${run_id}`)),
1110
+ /**
1111
+ * Create a new pipeline run
1112
+ */
1113
+ create: (input) => wrap(
1114
+ () => this.clients.pipelines.post("/runs", {
1115
+ body: input
1116
+ })
1117
+ ),
1118
+ /**
1119
+ * Approve a stage in a pipeline run
1120
+ */
1121
+ approve: (run_id, input) => wrap(
1122
+ () => this.clients.pipelines.post(`/runs/${run_id}/approve`, {
1123
+ body: input
1124
+ })
1125
+ ),
1126
+ /**
1127
+ * Cancel a pipeline run
1128
+ */
1129
+ cancel: (run_id) => wrap(() => this.clients.pipelines.post(`/runs/${run_id}/cancel`, { body: {} })),
1130
+ /**
1131
+ * Rollback a pipeline run
1132
+ */
1133
+ rollback: (run_id) => wrap(() => this.clients.pipelines.post(`/runs/${run_id}/rollback`, { body: {} })),
1134
+ /**
1135
+ * Stage-event namespace — Phase 2.C webhook ingestion + read-back.
1136
+ *
1137
+ * `ingest` posts a webhook event against an in-flight run; auth
1138
+ * mode is the standard bearer/session header (admin bypass; session
1139
+ * must carry `runs:events` and matching `package_id`). Server-side
1140
+ * stamps `payload.source = "external"`. Idempotency: same
1141
+ * `idempotency_key` + same payload returns `{ duplicated: true }`;
1142
+ * same key + different payload returns a 400 validation_error.
1143
+ *
1144
+ * `list` is read-only and returns the run's events newest-first.
1145
+ */
1146
+ events: {
1147
+ ingest: (run_id, input) => wrap(() => this.clients.pipelines.post(`/runs/${run_id}/events`, { body: input })),
1148
+ list: (run_id) => wrap(() => this.clients.pipelines.get(`/runs/${run_id}/events`))
1149
+ },
1150
+ /**
1151
+ * Grants namespace
1152
+ */
1153
+ grants: {
1154
+ /**
1155
+ * List grants for a package
1156
+ */
1157
+ list: (package_id) => wrap(
1158
+ () => this.clients.pipelines.get("/grants", {
1159
+ query: package_id ? { package_id } : {}
1160
+ })
1161
+ ),
1162
+ /**
1163
+ * Approve a grant
1164
+ */
1165
+ approve: (grant_id, user_id) => wrap(
1166
+ () => this.clients.pipelines.post(`/grants/${grant_id}/approve`, {
1167
+ body: { user_id }
1168
+ })
1169
+ ),
1170
+ /**
1171
+ * Deny a grant
1172
+ */
1173
+ deny: (grant_id, user_id, reason) => wrap(
1174
+ () => this.clients.pipelines.post(`/grants/${grant_id}/deny`, {
1175
+ body: { user_id, reason }
1176
+ })
1177
+ )
1178
+ },
1179
+ /**
1180
+ * Packages namespace — full CRUD over pipeline_package rows. Writes
1181
+ * (create/update/delete) require the orchestrator bearer token; the
1182
+ * HttpClient picks it up via the standard auth header injection.
1183
+ */
1184
+ packages: {
1185
+ /**
1186
+ * List packages, optionally filtered by linked devpad project.
1187
+ * Packages with `project_id = null` are not yet linked.
1188
+ */
1189
+ list: (filter) => {
1190
+ const query = {};
1191
+ if (filter?.project_id !== void 0) query.project_id = filter.project_id;
1192
+ return wrap(() => this.clients.pipelines.get("/packages", Object.keys(query).length > 0 ? { query } : void 0));
1193
+ },
1194
+ /**
1195
+ * Get a single package by id
1196
+ */
1197
+ get: (package_id) => wrap(() => this.clients.pipelines.get(`/packages/${package_id}`)),
1198
+ /**
1199
+ * Register a new pipeline package. `id` is canonically the same as
1200
+ * `name` per existing convention but is supplied explicitly so the
1201
+ * orchestrator can disambiguate renames without conflicts.
1202
+ */
1203
+ create: (input) => wrap(() => this.clients.pipelines.post("/packages", { body: input })),
1204
+ /**
1205
+ * Partially update a package row. Missing keys preserve existing
1206
+ * values; explicit `null` clears the field.
1207
+ */
1208
+ update: (package_id, input) => wrap(() => this.clients.pipelines.patch(`/packages/${package_id}`, { body: input })),
1209
+ /**
1210
+ * Remove a package. Refuses (409) if pipeline_run rows still
1211
+ * reference the package — clean up runs first.
1212
+ */
1213
+ delete: (package_id) => wrap(() => this.clients.pipelines.delete(`/packages/${package_id}`))
1214
+ },
1215
+ /**
1216
+ * Analysis-template namespace — admin-gated CRUD for the
1217
+ * `pipeline_analysis_template` table. Phase 2.A surface; each
1218
+ * call requires the orchestrator's bearer token (literal
1219
+ * `PIPELINES_TOKEN`). `owner_id` is required on every operation
1220
+ * — single-tenant today, but the column is in place so multi-user
1221
+ * ACLs slot in later.
1222
+ */
1223
+ analysis_templates: {
1224
+ /**
1225
+ * List templates for an owner.
1226
+ */
1227
+ list: (input) => wrap(() => this.clients.pipelines.get("/analysis-templates", { query: { owner_id: input.owner_id } })),
1228
+ /**
1229
+ * Get a single template by id, scoped to its owner. 404 when
1230
+ * unknown or owned by a different user.
1231
+ */
1232
+ get: (id, input) => wrap(() => this.clients.pipelines.get(`/analysis-templates/${id}`, { query: { owner_id: input.owner_id } })),
1233
+ /**
1234
+ * Create a new analysis template. `threshold_dsl` is parsed
1235
+ * server-side; parse failure returns 400 `validation_error`
1236
+ * with `field: "threshold_dsl"` and a descriptive message.
1237
+ * `window_ms` defaults to 600_000 (10 min) when omitted.
1238
+ */
1239
+ create: (input) => wrap(() => this.clients.pipelines.post("/analysis-templates", { body: input })),
1240
+ /**
1241
+ * Partial patch — only the supplied fields are touched.
1242
+ * Re-validates `threshold_dsl` when supplied; same
1243
+ * `validation_error` shape as create on parse failure.
1244
+ */
1245
+ update: (id, input) => wrap(() => this.clients.pipelines.patch(`/analysis-templates/${id}`, { body: input })),
1246
+ /**
1247
+ * Hard-delete the template. Does NOT consult
1248
+ * `pipeline_run.resolved_gates` — runs snapshot their gate
1249
+ * template at resolve-time, so deletion never orphans
1250
+ * in-flight runs.
1251
+ */
1252
+ delete: (id, input) => wrap(() => this.clients.pipelines.delete(`/analysis-templates/${id}`, { query: { owner_id: input.owner_id } }))
1253
+ },
1254
+ /**
1255
+ * OIDC trust-policy namespace — admin-gated CRUD for the
1256
+ * `pipeline_oidc_trust` table. Phase 15.D surface; each call requires
1257
+ * the orchestrator's bearer token (literal `PIPELINES_TOKEN`).
1258
+ * `owner_id` is required on every operation — single-tenant today,
1259
+ * but the column is in place so multi-user ACLs slot in later.
1260
+ */
1261
+ oidc_trust: {
1262
+ /**
1263
+ * List policies for an owner, ordered created_at DESC, id ASC —
1264
+ * matches the trust-matcher resolution order so the management UI
1265
+ * shows the policy that would be picked first.
1266
+ */
1267
+ list: (input) => wrap(() => this.clients.pipelines.get("/oidc-trust", { query: { owner_id: input.owner_id } })),
1268
+ /**
1269
+ * Get a single policy by id, scoped to its owner. 404 when
1270
+ * unknown, soft-deleted, or owned by a different user.
1271
+ */
1272
+ get: (id, input) => wrap(() => this.clients.pipelines.get(`/oidc-trust/${id}`, { query: { owner_id: input.owner_id } })),
1273
+ /**
1274
+ * Create a new policy. Defaults per plan §I.5: `repo_pattern: "*"`,
1275
+ * `allowed_actions: ["artifacts:upload","runs:start"]`,
1276
+ * `session_ttl_seconds: 900`.
1277
+ */
1278
+ create: (input) => wrap(() => this.clients.pipelines.post("/oidc-trust", { body: input })),
1279
+ /**
1280
+ * Partial patch — only the supplied fields are touched. Validation
1281
+ * runs against the merged record server-side.
1282
+ */
1283
+ update: (id, input) => wrap(() => this.clients.pipelines.patch(`/oidc-trust/${id}`, { body: input })),
1284
+ /**
1285
+ * Soft-delete a policy (sets `deleted = true`; row preserved for
1286
+ * audit). The matcher and management list both skip soft-deleted
1287
+ * rows.
1288
+ */
1289
+ delete: (id, input) => wrap(() => this.clients.pipelines.delete(`/oidc-trust/${id}`, { query: { owner_id: input.owner_id } }))
1290
+ }
1291
+ };
1072
1292
  const base_url = options.base_url || "http://localhost:4321/api/v1";
1073
1293
  this._api_key = options.api_key ?? "";
1074
1294
  this._auth_mode = options.auth_mode ?? (options.api_key?.startsWith("jwt:") ? "session" : options.api_key ? "key" : "cookie");
@@ -1097,7 +1317,8 @@ var ApiClient2 = class {
1097
1317
  tags: new ApiClient({ ...clientOptions, category: "tags" }),
1098
1318
  blog: new ApiClient({ ...clientOptions, category: "blog" }),
1099
1319
  media: new ApiClient({ ...clientOptions, category: "media" }),
1100
- pulse: new ApiClient({ ...clientOptions, base_url: `${base_url}/pulse`, category: "pulse" })
1320
+ pulse: new ApiClient({ ...clientOptions, base_url: `${base_url}/pulse`, category: "pulse" }),
1321
+ pipelines: new ApiClient({ ...clientOptions, category: "pipelines" })
1101
1322
  };
1102
1323
  }
1103
1324
  /**
@@ -1681,6 +1902,281 @@ var tools = {
1681
1902
  rate_limit_per_min: z.number().optional().describe("Rate limit in requests per minute (default 600)")
1682
1903
  }),
1683
1904
  execute: async (client, input) => unwrap(await client.pulse.keys.create(input))
1905
+ },
1906
+ devpad_pipelines_list: {
1907
+ name: "devpad_pipelines_list",
1908
+ description: "List pipeline runs (newest first). Optionally filter by package and/or status; cap limit at 200.",
1909
+ inputSchema: z.object({
1910
+ package_id: z.string().optional().describe("Filter runs to a specific package"),
1911
+ status: z.enum(RUN_STATUSES).optional().describe("Filter by run status"),
1912
+ limit: z.number().int().positive().max(200).optional().describe("Max rows to return (default 50, cap 200)")
1913
+ }),
1914
+ execute: async (client, input) => unwrap(await client.pipelines.list(input))
1915
+ },
1916
+ devpad_pipelines_get: {
1917
+ name: "devpad_pipelines_get",
1918
+ description: "Get a pipeline run by ID",
1919
+ inputSchema: z.object({
1920
+ run_id: z.string().describe("Pipeline run ID")
1921
+ }),
1922
+ execute: async (client, input) => unwrap(await client.pipelines.get(input.run_id))
1923
+ },
1924
+ devpad_pipelines_create: {
1925
+ name: "devpad_pipelines_create",
1926
+ description: "Create a new pipeline run",
1927
+ inputSchema: z.object({
1928
+ package_id: z.string().describe("Package ID"),
1929
+ version_set_id: z.string().describe("Version set ID to deploy")
1930
+ }),
1931
+ execute: async (client, input) => unwrap(await client.pipelines.create(input))
1932
+ },
1933
+ devpad_pipelines_approve: {
1934
+ name: "devpad_pipelines_approve",
1935
+ description: "Approve or deny a stage in a pipeline run",
1936
+ inputSchema: z.object({
1937
+ run_id: z.string().describe("Pipeline run ID"),
1938
+ stage_name: z.string().describe("Stage name to approve"),
1939
+ decision: z.enum(["approved", "denied"]).describe("Approval decision"),
1940
+ user_id: z.string().describe("User ID making the decision"),
1941
+ reason: z.string().optional().describe("Optional reason for the decision")
1942
+ }),
1943
+ execute: async (client, input) => {
1944
+ unwrap(await client.pipelines.approve(input.run_id, input));
1945
+ return { success: true };
1946
+ }
1947
+ },
1948
+ devpad_pipelines_cancel: {
1949
+ name: "devpad_pipelines_cancel",
1950
+ description: "Cancel a pipeline run",
1951
+ inputSchema: z.object({
1952
+ run_id: z.string().describe("Pipeline run ID")
1953
+ }),
1954
+ execute: async (client, input) => {
1955
+ unwrap(await client.pipelines.cancel(input.run_id));
1956
+ return { success: true };
1957
+ }
1958
+ },
1959
+ devpad_pipelines_rollback: {
1960
+ name: "devpad_pipelines_rollback",
1961
+ description: "Rollback a completed or failed pipeline run",
1962
+ inputSchema: z.object({
1963
+ run_id: z.string().describe("Pipeline run ID")
1964
+ }),
1965
+ execute: async (client, input) => {
1966
+ unwrap(await client.pipelines.rollback(input.run_id));
1967
+ return { success: true };
1968
+ }
1969
+ },
1970
+ devpad_pipelines_runs_events_ingest: {
1971
+ name: "devpad_pipelines_runs_events_ingest",
1972
+ description: 'Ingest an external webhook event against an in-flight pipeline run. Idempotent on (idempotency_key, payload). Server-side stamps payload.source = "external".',
1973
+ inputSchema: z.object({
1974
+ run_id: z.string().describe("Pipeline run ID"),
1975
+ stage_name: z.string().min(1).describe("Stage the event is associated with"),
1976
+ kind: z.enum(STAGE_EVENT_KINDS).describe("Event kind from STAGE_EVENT_KINDS"),
1977
+ payload: z.unknown().optional().describe("Arbitrary JSON payload \u2014 server-side stamps source = external"),
1978
+ idempotency_key: z.string().uuid().describe("UUID idempotency key; reuse with the same payload returns duplicated:true")
1979
+ }),
1980
+ execute: async (client, input) => unwrap(
1981
+ await client.pipelines.events.ingest(input.run_id, {
1982
+ stage_name: input.stage_name,
1983
+ kind: input.kind,
1984
+ payload: input.payload,
1985
+ idempotency_key: input.idempotency_key
1986
+ })
1987
+ )
1988
+ },
1989
+ devpad_pipelines_runs_events_list: {
1990
+ name: "devpad_pipelines_runs_events_list",
1991
+ description: "List stored stage events for a pipeline run, newest-first",
1992
+ inputSchema: z.object({
1993
+ run_id: z.string().describe("Pipeline run ID")
1994
+ }),
1995
+ execute: async (client, input) => unwrap(await client.pipelines.events.list(input.run_id))
1996
+ },
1997
+ devpad_pipelines_grants_list: {
1998
+ name: "devpad_pipelines_grants_list",
1999
+ description: "List vault grants for a pipeline package",
2000
+ inputSchema: z.object({
2001
+ package_id: z.string().describe("Package ID to filter grants by")
2002
+ }),
2003
+ execute: async (client, input) => unwrap(await client.pipelines.grants.list(input.package_id))
2004
+ },
2005
+ devpad_pipelines_grants_approve: {
2006
+ name: "devpad_pipelines_grants_approve",
2007
+ description: "Approve a pending vault grant request for a pipeline package",
2008
+ inputSchema: z.object({
2009
+ grant_id: z.string().describe("Grant ID to approve"),
2010
+ user_id: z.string().describe("User ID making the approval decision")
2011
+ }),
2012
+ execute: async (client, input) => unwrap(await client.pipelines.grants.approve(input.grant_id, input.user_id))
2013
+ },
2014
+ devpad_pipelines_grants_deny: {
2015
+ name: "devpad_pipelines_grants_deny",
2016
+ description: "Deny a pending vault grant request for a pipeline package",
2017
+ inputSchema: z.object({
2018
+ grant_id: z.string().describe("Grant ID to deny"),
2019
+ user_id: z.string().describe("User ID making the denial decision"),
2020
+ reason: z.string().optional().describe("Optional reason for the denial")
2021
+ }),
2022
+ execute: async (client, input) => unwrap(await client.pipelines.grants.deny(input.grant_id, input.user_id, input.reason))
2023
+ },
2024
+ devpad_pipelines_packages_list: {
2025
+ name: "devpad_pipelines_packages_list",
2026
+ description: "List pipeline packages. Optionally filter by linked devpad project_id; unlinked packages have project_id = null.",
2027
+ inputSchema: z.object({
2028
+ project_id: z.string().optional().describe("Filter packages by linked devpad project")
2029
+ }),
2030
+ execute: async (client, input) => unwrap(await client.pipelines.packages.list(input))
2031
+ },
2032
+ devpad_pipelines_packages_get: {
2033
+ name: "devpad_pipelines_packages_get",
2034
+ description: "Get a pipeline package by ID",
2035
+ inputSchema: z.object({
2036
+ package_id: z.string().describe("Pipeline package ID")
2037
+ }),
2038
+ execute: async (client, input) => unwrap(await client.pipelines.packages.get(input.package_id))
2039
+ },
2040
+ devpad_pipelines_packages_create: {
2041
+ name: "devpad_pipelines_packages_create",
2042
+ description: "Register a new pipeline-managed package. By convention `id` equals the package `name`. `project_id` optionally links the package to a devpad project.",
2043
+ inputSchema: z.object({
2044
+ id: z.string().describe("Canonical package ID (typically the same as name)"),
2045
+ name: z.string().describe("Package name"),
2046
+ owner_id: z.string().describe("User ID of the owner"),
2047
+ repo_url: z.string().optional().describe("Optional git repo URL"),
2048
+ project_id: z.string().optional().describe("Optional devpad project ID to link"),
2049
+ default_template_ref: z.string().optional().describe("Optional default pipeline template ref")
2050
+ }),
2051
+ execute: async (client, input) => unwrap(await client.pipelines.packages.create(input))
2052
+ },
2053
+ devpad_pipelines_packages_update: {
2054
+ name: "devpad_pipelines_packages_update",
2055
+ description: "Partially update a pipeline package. Only the provided fields are touched.",
2056
+ inputSchema: z.object({
2057
+ id: z.string().describe("Pipeline package ID"),
2058
+ repo_url: z.string().nullable().optional(),
2059
+ project_id: z.string().nullable().optional(),
2060
+ default_template_ref: z.string().nullable().optional(),
2061
+ script_name_overrides: z.record(z.string(), z.string()).nullable().optional()
2062
+ }),
2063
+ execute: async (client, input) => {
2064
+ const { id, ...patch } = input;
2065
+ return unwrap(await client.pipelines.packages.update(id, patch));
2066
+ }
2067
+ },
2068
+ devpad_pipelines_packages_delete: {
2069
+ name: "devpad_pipelines_packages_delete",
2070
+ description: "Delete a pipeline package. Refuses with conflict if existing pipeline_run rows still reference the package.",
2071
+ inputSchema: z.object({
2072
+ id: z.string().describe("Pipeline package ID")
2073
+ }),
2074
+ execute: async (client, input) => unwrap(await client.pipelines.packages.delete(input.id))
2075
+ },
2076
+ devpad_pipelines_analysis_templates_list: {
2077
+ name: "devpad_pipelines_analysis_templates_list",
2078
+ description: "List pipeline analysis templates for an owner. Each row encodes the threshold DSL + window referenced by analysis-gate evaluations.",
2079
+ inputSchema: z.object({
2080
+ owner_id: z.string().describe("Devpad user ID whose templates to list")
2081
+ }),
2082
+ execute: async (client, input) => unwrap(await client.pipelines.analysis_templates.list(input))
2083
+ },
2084
+ devpad_pipelines_analysis_templates_get: {
2085
+ name: "devpad_pipelines_analysis_templates_get",
2086
+ description: "Get a single pipeline analysis template by id, scoped to its owner.",
2087
+ inputSchema: z.object({
2088
+ id: z.string().describe("Pipeline analysis template ID"),
2089
+ owner_id: z.string().describe("Owner ID (must match the template's owner)")
2090
+ }),
2091
+ execute: async (client, input) => unwrap(await client.pipelines.analysis_templates.get(input.id, { owner_id: input.owner_id }))
2092
+ },
2093
+ devpad_pipelines_analysis_templates_create: {
2094
+ name: "devpad_pipelines_analysis_templates_create",
2095
+ 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).',
2096
+ inputSchema: z.object({
2097
+ owner_id: z.string().describe("Devpad user ID who owns this template"),
2098
+ name: z.string().describe('Human-readable name (e.g. "default-analysis")'),
2099
+ threshold_dsl: z.string().describe("Multi-line threshold DSL"),
2100
+ query_dsl: z.unknown().optional().describe("Optional structured query DSL stored alongside thresholds"),
2101
+ window_ms: z.number().int().positive().optional().describe("Analysis window in milliseconds. Default: 600000")
2102
+ }),
2103
+ execute: async (client, input) => unwrap(await client.pipelines.analysis_templates.create(input))
2104
+ },
2105
+ devpad_pipelines_analysis_templates_update: {
2106
+ name: "devpad_pipelines_analysis_templates_update",
2107
+ description: "Partially update a pipeline analysis template. Only the supplied fields are touched. Re-validates threshold_dsl when present.",
2108
+ inputSchema: z.object({
2109
+ id: z.string().describe("Pipeline analysis template ID"),
2110
+ owner_id: z.string().describe("Owner ID (must match the template's owner)"),
2111
+ name: z.string().optional(),
2112
+ threshold_dsl: z.string().optional(),
2113
+ query_dsl: z.unknown().optional(),
2114
+ window_ms: z.number().int().positive().optional()
2115
+ }),
2116
+ execute: async (client, input) => {
2117
+ const { id, ...patch } = input;
2118
+ return unwrap(await client.pipelines.analysis_templates.update(id, patch));
2119
+ }
2120
+ },
2121
+ devpad_pipelines_analysis_templates_delete: {
2122
+ name: "devpad_pipelines_analysis_templates_delete",
2123
+ description: "Hard-delete a pipeline analysis template. Does NOT consult pipeline_run.resolved_gates \u2014 runs snapshot their gate template at resolve-time, so deletion never orphans in-flight runs.",
2124
+ inputSchema: z.object({
2125
+ id: z.string().describe("Pipeline analysis template ID"),
2126
+ owner_id: z.string().describe("Owner ID (must match the template's owner)")
2127
+ }),
2128
+ execute: async (client, input) => unwrap(await client.pipelines.analysis_templates.delete(input.id, { owner_id: input.owner_id }))
2129
+ },
2130
+ devpad_pipelines_oidc_trust_list: {
2131
+ name: "devpad_pipelines_oidc_trust_list",
2132
+ 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.",
2133
+ inputSchema: z.object({
2134
+ owner_id: z.string().describe("User ID whose trust policies to list")
2135
+ }),
2136
+ execute: async (client, input) => unwrap(await client.pipelines.oidc_trust.list(input))
2137
+ },
2138
+ devpad_pipelines_oidc_trust_create: {
2139
+ name: "devpad_pipelines_oidc_trust_create",
2140
+ 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.',
2141
+ inputSchema: z.object({
2142
+ owner_id: z.string().describe("Devpad user ID who owns this policy"),
2143
+ github_owner: z.string().describe('GitHub `repository_owner` claim to trust (e.g. "f0rbit")'),
2144
+ expected_audience: z.string().describe("Required `aud` claim on the OIDC token \u2014 typically the orchestrator URL"),
2145
+ repo_pattern: z.string().optional().describe('Glob matched against the repo name ("*" matches all). Default: "*"'),
2146
+ allowed_refs: z.array(z.string()).optional().describe('Allowed Git refs (e.g. ["refs/heads/main"]). Empty/omitted = any ref'),
2147
+ allowed_environments: z.array(z.string()).optional().describe("Allowed GitHub environments. Empty/omitted = any"),
2148
+ allowed_actions: z.array(z.string()).optional().describe('Scope strings granted to session tokens. Default: ["artifacts:upload","runs:start"]'),
2149
+ session_ttl_seconds: z.number().int().positive().optional().describe("Session token TTL. Default: 900 (15 min)")
2150
+ }),
2151
+ execute: async (client, input) => unwrap(await client.pipelines.oidc_trust.create(input))
2152
+ },
2153
+ devpad_pipelines_oidc_trust_update: {
2154
+ name: "devpad_pipelines_oidc_trust_update",
2155
+ description: "Partially update a GitHub Actions OIDC trust policy. Only the supplied fields are touched; validation runs server-side against the merged record.",
2156
+ inputSchema: z.object({
2157
+ id: z.string().describe("Trust policy ID"),
2158
+ owner_id: z.string().describe("Owner ID (must match the policy's owner)"),
2159
+ github_owner: z.string().optional(),
2160
+ expected_audience: z.string().optional(),
2161
+ repo_pattern: z.string().optional(),
2162
+ allowed_refs: z.array(z.string()).optional(),
2163
+ allowed_environments: z.array(z.string()).optional(),
2164
+ allowed_actions: z.array(z.string()).optional(),
2165
+ session_ttl_seconds: z.number().int().positive().optional()
2166
+ }),
2167
+ execute: async (client, input) => {
2168
+ const { id, ...patch } = input;
2169
+ return unwrap(await client.pipelines.oidc_trust.update(id, patch));
2170
+ }
2171
+ },
2172
+ devpad_pipelines_oidc_trust_delete: {
2173
+ name: "devpad_pipelines_oidc_trust_delete",
2174
+ description: "Soft-delete a GitHub Actions OIDC trust policy. The row is preserved for audit; the matcher and list operations skip soft-deleted rows.",
2175
+ inputSchema: z.object({
2176
+ id: z.string().describe("Trust policy ID"),
2177
+ owner_id: z.string().describe("Owner ID (must match the policy's owner)")
2178
+ }),
2179
+ execute: async (client, input) => unwrap(await client.pipelines.oidc_trust.delete(input.id, { owner_id: input.owner_id }))
1684
2180
  }
1685
2181
  };
1686
2182
  var toolNames = Object.keys(tools);
@@ -1044,4 +1044,4 @@ declare const media_platform_credentials: drizzle_orm_sqlite_core.SQLiteTableWit
1044
1044
  dialect: "sqlite";
1045
1045
  }>;
1046
1046
 
1047
- export { type MediaPlatform as M, media_profile_filters as a, media_accounts as b, media_account_settings as c, media_platform_credentials as d, media_rate_limits as e, media_profiles as m };
1047
+ export { type MediaPlatform as M, media_accounts as a, media_platform_credentials as b, media_profile_filters as c, media_profiles as d, media_rate_limits as e, media_account_settings as m };