@devpad/api 2.5.1 → 2.5.3

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.
@@ -1,6 +1,6 @@
1
1
  // ../schema/dist/database/schema.js
2
2
  import { relations, sql } from "drizzle-orm";
3
- import { index, int, integer, primaryKey, sqliteTable, text, unique } from "drizzle-orm/sqlite-core";
3
+ import { index, int, integer, primaryKey, sqliteTable, text, unique, uniqueIndex } from "drizzle-orm/sqlite-core";
4
4
  var timestamps = () => ({
5
5
  created_at: text("created_at").notNull().default(sql`(CURRENT_TIMESTAMP)`),
6
6
  updated_at: text("updated_at").notNull().default(sql`(CURRENT_TIMESTAMP)`)
@@ -405,10 +405,12 @@ var ignore_path = sqliteTable("ignore_path", {
405
405
  });
406
406
  var ROLLOUT_SHAPES = ["gradual", "atomic"];
407
407
  var RUN_KINDS = ["deploy", "rollback"];
408
- var RUN_STATUSES = ["queued", "deploying", "baking", "awaiting_approval", "rolling_back", "completed", "rolled_back", "failed", "cancelled"];
408
+ var RUN_STATUSES = ["queued", "deploying", "unconfirmed", "baking", "awaiting_approval", "rolling_back", "completed", "rolled_back", "failed", "cancelled"];
409
409
  var FORCED_ATOMIC_REASONS = ["do_migrations", "asset_affinity_none"];
410
- var STAGE_EVENT_KINDS = ["deploy_started", "deploy_completed", "bake_started", "bake_completed", "gate_verdict", "approval_requested", "rollback_started", "rollback_completed", "warning", "error"];
410
+ var STAGE_EVENT_KINDS = ["deploy_started", "deploy_completed", "deploy_failed", "dispatch_requested", "dispatch_failed", "timed_out", "bake_started", "bake_completed", "gate_verdict", "approval_requested", "rollback_started", "rollback_completed", "warning", "error"];
411
411
  var APPROVAL_DECISIONS = ["approved", "denied"];
412
+ var DEPLOY_MODES = ["orchestrated", "external"];
413
+ var DISPATCH_STATUSES = ["claimed", "dispatched", "failed"];
412
414
  var pipeline_package = sqliteTable("pipeline_package", {
413
415
  ...entity("pipeline-package"),
414
416
  owner_id: text("owner_id").notNull().references(() => user.id),
@@ -416,12 +418,22 @@ var pipeline_package = sqliteTable("pipeline_package", {
416
418
  repo_url: text("repo_url"),
417
419
  default_template_ref: text("default_template_ref"),
418
420
  script_name_overrides: text("script_name_overrides", { mode: "json" }),
419
- project_id: text("project_id").references(() => project.id)
421
+ project_id: text("project_id").references(() => project.id),
422
+ // External deploy mode (#155): `external` packages let CI own the actual
423
+ // deploys; the orchestrator only holds the manual staging→production
424
+ // gate + run record. `external_target` carries repo/workflow/ref/timeout
425
+ // + gate — parsed+validated by `external_target` at the service
426
+ // boundary (raw JSON on the row is untrusted).
427
+ deploy_mode: text("deploy_mode", { enum: DEPLOY_MODES }).notNull().default("orchestrated"),
428
+ external_target: text("external_target", { mode: "json" })
420
429
  });
421
430
  var pipeline_run = sqliteTable("pipeline_run", {
422
431
  ...entity("pipeline-run"),
423
432
  package_id: text("package_id").notNull().references(() => pipeline_package.id),
424
- version_set_id: text("version_set_id").notNull(),
433
+ // Exactly one of `version_set_id` / `commit_sha` is set — the invariant is
434
+ // enforced in code (`run_target_of` in core runs.ts), not by a CHECK.
435
+ version_set_id: text("version_set_id"),
436
+ commit_sha: text("commit_sha"),
425
437
  shape: text("shape", { enum: ROLLOUT_SHAPES }).notNull(),
426
438
  kind: text("kind", { enum: RUN_KINDS }).notNull().default("deploy"),
427
439
  status: text("status", { enum: RUN_STATUSES }).notNull().default("queued"),
@@ -440,7 +452,19 @@ var pipeline_stage_event = sqliteTable("pipeline_stage_event", {
440
452
  payload: text("payload", { mode: "json" }),
441
453
  ts: text("ts").notNull().default(sql`(CURRENT_TIMESTAMP)`),
442
454
  idempotency_hash: text("idempotency_hash")
443
- });
455
+ }, (table) => [
456
+ uniqueIndex("idx_pipeline_stage_event_idem_uniq").on(table.run_id, table.idempotency_hash).where(sql`idempotency_hash IS NOT NULL`)
457
+ ]);
458
+ var pipeline_dispatch = sqliteTable("pipeline_dispatch", {
459
+ ...id("pipeline-dispatch"),
460
+ run_id: text("run_id").notNull().references(() => pipeline_run.id),
461
+ stage_name: text("stage_name").notNull(),
462
+ commit_sha: text("commit_sha").notNull(),
463
+ status: text("status", { enum: DISPATCH_STATUSES }).notNull().default("claimed"),
464
+ error: text("error"),
465
+ requested_by: text("requested_by"),
466
+ ...timestamps()
467
+ }, (table) => [unique("pipeline_dispatch_run_stage_unique").on(table.run_id, table.stage_name)]);
444
468
  var pipeline_grant = sqliteTable("pipeline_grant", {
445
469
  ...entity("pipeline-grant"),
446
470
  package_id: text("package_id").notNull().references(() => pipeline_package.id),
@@ -566,7 +590,11 @@ var pipeline_package_relations = relations(pipeline_package, ({ one, many }) =>
566
590
  var pipeline_run_relations = relations(pipeline_run, ({ one, many }) => ({
567
591
  package: one(pipeline_package, { fields: [pipeline_run.package_id], references: [pipeline_package.id] }),
568
592
  events: many(pipeline_stage_event),
569
- approvals: many(pipeline_approval)
593
+ approvals: many(pipeline_approval),
594
+ dispatches: many(pipeline_dispatch)
595
+ }));
596
+ var pipeline_dispatch_relations = relations(pipeline_dispatch, ({ one }) => ({
597
+ run: one(pipeline_run, { fields: [pipeline_dispatch.run_id], references: [pipeline_run.id] })
570
598
  }));
571
599
  var pipeline_stage_event_relations = relations(pipeline_stage_event, ({ one }) => ({
572
600
  run: one(pipeline_run, { fields: [pipeline_stage_event.run_id], references: [pipeline_run.id] })
@@ -743,6 +771,7 @@ var run_kind = z.union([z.literal("deploy"), z.literal("rollback")]);
743
771
  var run_status = z.union([
744
772
  z.literal("queued"),
745
773
  z.literal("deploying"),
774
+ z.literal("unconfirmed"),
746
775
  z.literal("baking"),
747
776
  z.literal("awaiting_approval"),
748
777
  z.literal("rolling_back"),
@@ -755,6 +784,10 @@ var forced_atomic_reason = z.union([z.literal("do_migrations"), z.literal("asset
755
784
  var stage_event_kind = z.union([
756
785
  z.literal("deploy_started"),
757
786
  z.literal("deploy_completed"),
787
+ z.literal("deploy_failed"),
788
+ z.literal("dispatch_requested"),
789
+ z.literal("dispatch_failed"),
790
+ z.literal("timed_out"),
758
791
  z.literal("bake_started"),
759
792
  z.literal("bake_completed"),
760
793
  z.literal("gate_verdict"),
@@ -765,6 +798,16 @@ var stage_event_kind = z.union([
765
798
  z.literal("error")
766
799
  ]);
767
800
  var approval_decision = z.union([z.literal("approved"), z.literal("denied")]);
801
+ var deploy_mode = z.union([z.literal("orchestrated"), z.literal("external")]);
802
+ var commit_sha = z.string().regex(/^[0-9a-f]{40}$/, "commit_sha must be a 40-hex SHA");
803
+ var external_target = z.object({
804
+ repo: z.string().regex(/^[^/\s]+\/[^/\s]+$/, "repo must be owner/name"),
805
+ workflow: z.string().min(1).describe("workflow file name, e.g. deploy.yml"),
806
+ ref: z.string().min(1).default("main"),
807
+ timeout_ms: z.number().int().positive().default(27e5),
808
+ gate: z.object({ type: z.literal("manual") }).default({ type: "manual" })
809
+ });
810
+ var dispatch_status = z.union([z.literal("claimed"), z.literal("dispatched"), z.literal("failed")]);
768
811
  var grant_scope = z.string().regex(/^[a-z0-9_-]+:[a-z0-9_-]+(:[^\s]+)?$/, "Invalid scope format");
769
812
  var rollout_stage = z.object({
770
813
  name: z.string(),
@@ -793,12 +836,15 @@ var upsert_pipeline_package = z.object({
793
836
  repo_url: z.string().nullable().optional(),
794
837
  default_template_ref: z.string().nullable().optional(),
795
838
  script_name_overrides: z.record(z.string(), z.string()).nullable().optional(),
796
- project_id: z.string().nullable().optional()
839
+ project_id: z.string().nullable().optional(),
840
+ deploy_mode: deploy_mode.optional(),
841
+ external_target: external_target.nullable().optional()
797
842
  });
798
843
  var upsert_pipeline_run = z.object({
799
844
  id: z.string().optional().nullable(),
800
845
  package_id: z.string(),
801
- version_set_id: z.string(),
846
+ version_set_id: z.string().nullable(),
847
+ commit_sha: commit_sha.nullable().optional(),
802
848
  shape: rollout_shape,
803
849
  kind: run_kind.optional(),
804
850
  status: run_status.optional(),
@@ -831,6 +877,15 @@ var upsert_pipeline_approval = z.object({
831
877
  decided_by: z.string().nullable().optional(),
832
878
  decided_at: z.string().nullable().optional()
833
879
  });
880
+ var upsert_pipeline_dispatch = z.object({
881
+ id: z.string().optional().nullable(),
882
+ run_id: z.string(),
883
+ stage_name: z.string(),
884
+ commit_sha,
885
+ status: dispatch_status.optional(),
886
+ error: z.string().nullable().optional(),
887
+ requested_by: z.string().nullable().optional()
888
+ });
834
889
  var upsert_pipeline_analysis_template = z.object({
835
890
  id: z.string().optional(),
836
891
  owner_id: z.string().min(1),
@@ -1128,6 +1183,10 @@ export {
1128
1183
  forced_atomic_reason,
1129
1184
  stage_event_kind,
1130
1185
  approval_decision,
1186
+ deploy_mode,
1187
+ commit_sha,
1188
+ external_target,
1189
+ dispatch_status,
1131
1190
  grant_scope,
1132
1191
  rollout_stage,
1133
1192
  resolved_rollout,
@@ -1138,6 +1197,7 @@ export {
1138
1197
  insert_pipeline_stage_event,
1139
1198
  upsert_pipeline_grant,
1140
1199
  upsert_pipeline_approval,
1200
+ upsert_pipeline_dispatch,
1141
1201
  upsert_pipeline_analysis_template,
1142
1202
  pipeline_oidc_provider,
1143
1203
  upsert_pipeline_oidc_trust,
package/dist/index.d.ts CHANGED
@@ -1,11 +1,11 @@
1
1
  import { G as PostListParams, T as PostsResponse, x as Post, D as PostCreate, Q as PostUpdate, Z as VersionInfo, y as PostContent, C as Category, k as CategoryCreate, A as AccessKey } from './types.d-DbgtG-w1.js';
2
- import { ai as Profile, u as CreateProfileInput, aw as UpdateProfileInput, aj as ProfileFilter, c as AddFilterInput, aq as Timeline, A as Account, ae as PlatformSettings } from './types.d-BLyXuxuY.js';
2
+ import { ai as Profile, u as CreateProfileInput, aw as UpdateProfileInput, aj as ProfileFilter, c as AddFilterInput, aq as Timeline, A as Account, ae as PlatformSettings } from './types.d-CAKmVOCU.js';
3
3
  import { z } from 'zod';
4
- import { c as ApiKey, O as Project, aE as UpsertProject, G as GetConfigResult, a2 as SaveConfigRequest, ao as TodoUpdate, H as HistoryAction, R as ProjectGraphResponse, S as ProjectViewLayoutInput, M as Milestone, ad as Task, o as Goal, p as Hook, v as HookTrigger, r as HookActionPublic, aw as UpsertHook, t as HookDelivery, ak as TaskWithDetails, aH as UpsertTodo, aF as UpsertTag, ag as TaskLink, C as ClaimRequest, m as DoneRequest, a as AdvanceStageRequest, aG as UpsertTaskLink, f as ApplyRequest, e as ApplyOp, ac as TagWithTypedColor, l as Document, U as PushDocRequest, an as ThreadMarker, i as CreateThreadRequest, b as AnnotationThread, V as PushInterfaceReportRequest, y as InterfaceDiffClass, a6 as Signoff, Y as RequestCheckpointRequest, k as DecideCheckpointRequest, Z as ReviewItem, D as DashboardResponse, K as PipelineRun, L as PipelineStageEvent, B as PipelineGrant, J as PipelinePackage, P as PipelineAnalysisTemplate, F as PipelineOidcTrust } from './types.d-BPhr25k1.js';
5
- export { Q as ProjectConfig, _ as ReviewItemKind } from './types.d-BPhr25k1.js';
4
+ import { c as ApiKey, R as Project, aH as UpsertProject, G as GetConfigResult, a4 as SaveConfigRequest, aq as TodoUpdate, H as HistoryAction, T as ProjectGraphResponse, U as ProjectViewLayoutInput, M as Milestone, af as Task, p as Goal, q as Hook, w as HookTrigger, s as HookActionPublic, ay as UpsertHook, u as HookDelivery, am as TaskWithDetails, aK as UpsertTodo, aI as UpsertTag, ai as TaskLink, C as ClaimRequest, m as DoneRequest, a as AdvanceStageRequest, aJ as UpsertTaskLink, f as ApplyRequest, e as ApplyOp, ae as TagWithTypedColor, l as Document, W as PushDocRequest, ap as ThreadMarker, i as CreateThreadRequest, b as AnnotationThread, X as PushInterfaceReportRequest, z as InterfaceDiffClass, a8 as Signoff, _ as RequestCheckpointRequest, k as DecideCheckpointRequest, $ as ReviewItem, D as DashboardResponse, O as PipelineRun, Q as PipelineStageEvent, J as PipelineGrant, L as PipelinePackage, P as PipelineAnalysisTemplate, K as PipelineOidcTrust } from './types.d-D5SZVjNV.js';
5
+ export { S as ProjectConfig, a0 as ReviewItemKind } from './types.d-D5SZVjNV.js';
6
6
  import { Result } from '@f0rbit/corpus';
7
7
  export { Result, err, ok } from '@f0rbit/corpus';
8
- import { b as CompletionPolicy, H as HookDeliveryStatus, C as CompletedVia, j as StageEventKind } from './schema.d-CJi69lKr.js';
8
+ import { b as CompletionPolicy, H as HookDeliveryStatus, C as CompletedVia, c as DispatchStatus, l as StageEventKind } from './schema.d-DKK3C47P.js';
9
9
  import 'drizzle-orm';
10
10
  import './media.d-R87HGuRp.js';
11
11
  import 'drizzle-orm/sqlite-core';
@@ -705,6 +705,26 @@ type PushInterfaceReportResult = {
705
705
  classification: InterfaceDiffClass;
706
706
  signoff: Signoff | null;
707
707
  };
708
+ /**
709
+ * Wire shape of `GET /v1/runs/:id/dispatches` (orchestrator proxy, #155) —
710
+ * the run's dispatch ledger rows. `commit_sha` is null on orchestrated
711
+ * (version-set-targeted) runs.
712
+ */
713
+ type PipelineDispatchEntry = {
714
+ stage_name: string;
715
+ commit_sha: string | null;
716
+ status: DispatchStatus;
717
+ error: string | null;
718
+ requested_by: string | null;
719
+ created_at: string;
720
+ updated_at: string;
721
+ };
722
+ type PipelineDispatches = {
723
+ run_id: string;
724
+ run_status: string;
725
+ commit_sha: string | null;
726
+ dispatches: PipelineDispatchEntry[];
727
+ };
708
728
  type FoldDiff = {
709
729
  kind: "missing_row";
710
730
  entity: "milestone" | "goal";
@@ -1687,12 +1707,15 @@ declare class ApiClient {
1687
1707
  status: string;
1688
1708
  }>>;
1689
1709
  /**
1690
- * Approve a stage in a pipeline run
1710
+ * Approve a stage in a pipeline run. Identity is resolved
1711
+ * server-side by the worker proxy (`X-Devpad-Actor` header) — the
1712
+ * caller never supplies a `user_id`. Approvals are human-only:
1713
+ * api-channel callers get `403 human_approval_required`; approve
1714
+ * from the devpad web UI while signed in.
1691
1715
  */
1692
1716
  approve: (run_id: string, input: {
1693
1717
  stage_name: string;
1694
1718
  decision: "approved" | "denied";
1695
- user_id: string;
1696
1719
  reason?: string;
1697
1720
  }) => Promise<ApiResult<void>>;
1698
1721
  /**
@@ -1703,6 +1726,19 @@ declare class ApiClient {
1703
1726
  * Rollback a pipeline run
1704
1727
  */
1705
1728
  rollback: (run_id: string) => Promise<ApiResult<void>>;
1729
+ /**
1730
+ * Re-dispatch a FAILED external production dispatch (#155). Human-only:
1731
+ * only valid when the run's production dispatch row is `failed` —
1732
+ * any other state is a 4xx from the orchestrator. api-channel callers
1733
+ * get `403 human_approval_required` from the worker proxy; call from
1734
+ * the devpad web UI while signed in.
1735
+ */
1736
+ redispatch: (run_id: string) => Promise<ApiResult<void>>;
1737
+ /**
1738
+ * Read a run's dispatch ledger (`GET /v1/runs/:id/dispatches`): one
1739
+ * row per stage with claim/dispatch status, error text and actor.
1740
+ */
1741
+ dispatches: (run_id: string) => Promise<ApiResult<PipelineDispatches>>;
1706
1742
  /**
1707
1743
  * Stage-event namespace — Phase 2.C webhook ingestion + read-back.
1708
1744
  *
@@ -1736,13 +1772,16 @@ declare class ApiClient {
1736
1772
  */
1737
1773
  list: (package_id?: string) => Promise<ApiResult<PipelineGrant[]>>;
1738
1774
  /**
1739
- * Approve a grant
1775
+ * Approve a pending grant. Human-only — the actor is resolved
1776
+ * server-side by the worker proxy; api-channel callers get
1777
+ * `403 human_approval_required`.
1740
1778
  */
1741
- approve: (grant_id: string, user_id: string) => Promise<ApiResult<PipelineGrant>>;
1779
+ approve: (grant_id: string) => Promise<ApiResult<PipelineGrant>>;
1742
1780
  /**
1743
- * Deny a grant
1781
+ * Deny a pending grant. Human-only — same actor resolution as
1782
+ * `approve`.
1744
1783
  */
1745
- deny: (grant_id: string, user_id: string, reason?: string) => Promise<ApiResult<{
1784
+ deny: (grant_id: string, reason?: string) => Promise<ApiResult<{
1746
1785
  success: boolean;
1747
1786
  }>>;
1748
1787
  };
@@ -1966,4 +2005,4 @@ declare const tools: Record<string, ToolDefinition>;
1966
2005
  declare const toolNames: string[];
1967
2006
  declare function getTool(name: string): ToolDefinition | undefined;
1968
2007
 
1969
- export { AccessKey, Account, AddFilterInput, ApiClient, ApiError, type ApiResult, type ApiResultError, type ApplyResponse, type AuthMode, AuthenticationError, type BubbleStep, Category, CategoryCreate, CreateProfileInput, DecideCheckpointRequest, type DocContent, type DocVersionInfo, type DoneResponse, type EdgeSummary, Milestone, type MilestoneLensResponse, type MilestoneLensRow, NetworkError, PlatformSettings, Post, PostContent, PostCreate, PostListParams, PostUpdate, PostsResponse, Profile, ProfileFilter, Project, type PublicHook, type PullDocResponse, type PulseErrorIssue, type PulseErrorsResult, type PulseEventRow, type PulseEventsPage, type PulseLatencyByMinute, type PulseLatencyResult, type PulseLogsResult, type PulseSummary, type PulseSummaryByDay, type PushInterfaceReportResult, type RequestHistoryEntry, type RequestOptions, ReviewItem, type RollupCounts, SaveConfigRequest, Signoff, Task, TaskWithDetails, Timeline, type ToolDefinition, UpdateProfileInput, UpsertProject, UpsertTag, UpsertTodo, ValidationError, VersionInfo, ApiClient as default, getTool, getUserFriendlyErrorMessage, parseZodErrors, pulseSummaryHasData, toolNames, tools, wrap };
2008
+ export { AccessKey, Account, AddFilterInput, ApiClient, ApiError, type ApiResult, type ApiResultError, type ApplyResponse, type AuthMode, AuthenticationError, type BubbleStep, Category, CategoryCreate, CreateProfileInput, DecideCheckpointRequest, type DocContent, type DocVersionInfo, type DoneResponse, type EdgeSummary, Milestone, type MilestoneLensResponse, type MilestoneLensRow, NetworkError, type PipelineDispatchEntry, type PipelineDispatches, PlatformSettings, Post, PostContent, PostCreate, PostListParams, PostUpdate, PostsResponse, Profile, ProfileFilter, Project, type PublicHook, type PullDocResponse, type PulseErrorIssue, type PulseErrorsResult, type PulseEventRow, type PulseEventsPage, type PulseLatencyByMinute, type PulseLatencyResult, type PulseLogsResult, type PulseSummary, type PulseSummaryByDay, type PushInterfaceReportResult, type RequestHistoryEntry, type RequestOptions, ReviewItem, type RollupCounts, SaveConfigRequest, Signoff, Task, TaskWithDetails, Timeline, type ToolDefinition, UpdateProfileInput, UpsertProject, UpsertTag, UpsertTodo, ValidationError, VersionInfo, ApiClient as default, getTool, getUserFriendlyErrorMessage, parseZodErrors, pulseSummaryHasData, toolNames, tools, wrap };
package/dist/index.js CHANGED
@@ -16,7 +16,7 @@ import {
16
16
  upsert_project,
17
17
  upsert_task_link,
18
18
  upsert_todo
19
- } from "./chunk-HIDAIYV4.js";
19
+ } from "./chunk-WM2RV3FZ.js";
20
20
  import {
21
21
  CategoryCreateSchema,
22
22
  PostCreateSchema,
@@ -1463,7 +1463,11 @@ var ApiClient2 = class {
1463
1463
  })
1464
1464
  ),
1465
1465
  /**
1466
- * Approve a stage in a pipeline run
1466
+ * Approve a stage in a pipeline run. Identity is resolved
1467
+ * server-side by the worker proxy (`X-Devpad-Actor` header) — the
1468
+ * caller never supplies a `user_id`. Approvals are human-only:
1469
+ * api-channel callers get `403 human_approval_required`; approve
1470
+ * from the devpad web UI while signed in.
1467
1471
  */
1468
1472
  approve: (run_id, input) => wrap(
1469
1473
  () => this.clients.pipelines.post(`/runs/${run_id}/approve`, {
@@ -1478,6 +1482,19 @@ var ApiClient2 = class {
1478
1482
  * Rollback a pipeline run
1479
1483
  */
1480
1484
  rollback: (run_id) => wrap(() => this.clients.pipelines.post(`/runs/${run_id}/rollback`, { body: {} })),
1485
+ /**
1486
+ * Re-dispatch a FAILED external production dispatch (#155). Human-only:
1487
+ * only valid when the run's production dispatch row is `failed` —
1488
+ * any other state is a 4xx from the orchestrator. api-channel callers
1489
+ * get `403 human_approval_required` from the worker proxy; call from
1490
+ * the devpad web UI while signed in.
1491
+ */
1492
+ redispatch: (run_id) => wrap(() => this.clients.pipelines.post(`/runs/${run_id}/redispatch`, { body: {} })),
1493
+ /**
1494
+ * Read a run's dispatch ledger (`GET /v1/runs/:id/dispatches`): one
1495
+ * row per stage with claim/dispatch status, error text and actor.
1496
+ */
1497
+ dispatches: (run_id) => wrap(() => this.clients.pipelines.get(`/runs/${run_id}/dispatches`)),
1481
1498
  /**
1482
1499
  * Stage-event namespace — Phase 2.C webhook ingestion + read-back.
1483
1500
  *
@@ -1511,19 +1528,22 @@ var ApiClient2 = class {
1511
1528
  })
1512
1529
  ),
1513
1530
  /**
1514
- * Approve a grant
1531
+ * Approve a pending grant. Human-only — the actor is resolved
1532
+ * server-side by the worker proxy; api-channel callers get
1533
+ * `403 human_approval_required`.
1515
1534
  */
1516
- approve: (grant_id, user_id) => wrap(
1535
+ approve: (grant_id) => wrap(
1517
1536
  () => this.clients.pipelines.post(`/grants/${grant_id}/approve`, {
1518
- body: { user_id }
1537
+ body: {}
1519
1538
  })
1520
1539
  ),
1521
1540
  /**
1522
- * Deny a grant
1541
+ * Deny a pending grant. Human-only — same actor resolution as
1542
+ * `approve`.
1523
1543
  */
1524
- deny: (grant_id, user_id, reason) => wrap(
1544
+ deny: (grant_id, reason) => wrap(
1525
1545
  () => this.clients.pipelines.post(`/grants/${grant_id}/deny`, {
1526
- body: { user_id, reason }
1546
+ body: reason !== void 0 ? { reason } : {}
1527
1547
  })
1528
1548
  )
1529
1549
  },
@@ -2463,6 +2483,14 @@ var tools = {
2463
2483
  }),
2464
2484
  execute: async (client, input) => unwrap(await client.pipelines.get(input.run_id))
2465
2485
  }),
2486
+ devpad_pipelines_dispatches: define_tool({
2487
+ name: "devpad_pipelines_dispatches",
2488
+ description: "List a pipeline run's dispatch ledger rows (external deploy mode #155): per-stage claim/dispatch status, error text, and requesting actor. Read-only.",
2489
+ inputSchema: z2.object({
2490
+ run_id: z2.string().describe("Pipeline run ID")
2491
+ }),
2492
+ execute: async (client, input) => unwrap(await client.pipelines.dispatches(input.run_id))
2493
+ }),
2466
2494
  devpad_pipelines_create: define_tool({
2467
2495
  name: "devpad_pipelines_create",
2468
2496
  description: "Create a new pipeline run",
@@ -2474,16 +2502,21 @@ var tools = {
2474
2502
  }),
2475
2503
  devpad_pipelines_approve: define_tool({
2476
2504
  name: "devpad_pipelines_approve",
2477
- description: "Approve or deny a stage in a pipeline run",
2505
+ description: "Approve or deny a stage in a pipeline run. Human-only: the actor is resolved from the caller's own authentication, and approvals are gated to signed-in humans in the devpad web UI \u2014 API-key/MCP callers receive 403 human_approval_required. Failures surface as typed errors, never thrown.",
2478
2506
  inputSchema: z2.object({
2479
2507
  run_id: z2.string().describe("Pipeline run ID"),
2480
2508
  stage_name: z2.string().describe("Stage name to approve"),
2481
2509
  decision: z2.enum(["approved", "denied"]).describe("Approval decision"),
2482
- user_id: z2.string().describe("User ID making the decision"),
2483
2510
  reason: z2.string().optional().describe("Optional reason for the decision")
2484
2511
  }),
2485
2512
  execute: async (client, input) => {
2486
- unwrap(await client.pipelines.approve(input.run_id, input));
2513
+ unwrap(
2514
+ await client.pipelines.approve(input.run_id, {
2515
+ stage_name: input.stage_name,
2516
+ decision: input.decision,
2517
+ reason: input.reason
2518
+ })
2519
+ );
2487
2520
  return { success: true };
2488
2521
  }
2489
2522
  }),
@@ -2546,22 +2579,20 @@ var tools = {
2546
2579
  }),
2547
2580
  devpad_pipelines_grants_approve: define_tool({
2548
2581
  name: "devpad_pipelines_grants_approve",
2549
- description: "Approve a pending vault grant request for a pipeline package",
2582
+ description: "Approve a pending vault grant request for a pipeline package. Human-only: requires a signed-in human deciding in the devpad web UI \u2014 API-key/MCP callers receive 403 human_approval_required.",
2550
2583
  inputSchema: z2.object({
2551
- grant_id: z2.string().describe("Grant ID to approve"),
2552
- user_id: z2.string().describe("User ID making the approval decision")
2584
+ grant_id: z2.string().describe("Grant ID to approve")
2553
2585
  }),
2554
- execute: async (client, input) => unwrap(await client.pipelines.grants.approve(input.grant_id, input.user_id))
2586
+ execute: async (client, input) => unwrap(await client.pipelines.grants.approve(input.grant_id))
2555
2587
  }),
2556
2588
  devpad_pipelines_grants_deny: define_tool({
2557
2589
  name: "devpad_pipelines_grants_deny",
2558
- description: "Deny a pending vault grant request for a pipeline package",
2590
+ description: "Deny a pending vault grant request for a pipeline package. Human-only: requires a signed-in human deciding in the devpad web UI \u2014 API-key/MCP callers receive 403 human_approval_required.",
2559
2591
  inputSchema: z2.object({
2560
2592
  grant_id: z2.string().describe("Grant ID to deny"),
2561
- user_id: z2.string().describe("User ID making the denial decision"),
2562
2593
  reason: z2.string().optional().describe("Optional reason for the denial")
2563
2594
  }),
2564
- execute: async (client, input) => unwrap(await client.pipelines.grants.deny(input.grant_id, input.user_id, input.reason))
2595
+ execute: async (client, input) => unwrap(await client.pipelines.grants.deny(input.grant_id, input.reason))
2565
2596
  }),
2566
2597
  devpad_pipelines_packages_list: define_tool({
2567
2598
  name: "devpad_pipelines_packages_list",