@devpad/api 2.3.3 → 2.3.5
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/{chunk-ZPDYJASJ.js → chunk-A7B2SE7T.js} +149 -2
- package/dist/index.d.ts +41 -6
- package/dist/index.js +70 -2
- package/dist/schema/blog.d.ts +800 -111
- package/dist/schema/index.d.ts +2 -2
- package/dist/schema/index.js +19 -1
- package/dist/schema/media.d.ts +2 -2
- package/dist/{schema.d-D3xGKqB8.d.ts → schema.d-CFQELmTM.d.ts} +684 -1
- package/dist/{types.d-BZOIiHoO.d.ts → types.d-CK6qaT-O.d.ts} +31 -31
- package/dist/{types.d-8FWQKyCL.d.ts → types.d-NajL6dL5.d.ts} +431 -38
- package/package.json +2 -2
- package/dist/{types.d-BhWQru2j.d.ts → types.d-BEtzx3lu.d.ts} +6 -6
|
@@ -52,6 +52,11 @@ var api_keys = sqliteTable("api_keys", {
|
|
|
52
52
|
name: text("name"),
|
|
53
53
|
note: text("note"),
|
|
54
54
|
scope: text("scope", { enum: ["devpad", "blog", "media", "pulse", "all"] }).notNull().default("all"),
|
|
55
|
+
// v2.4 (task A3.1): nullable project scope. `null` = legacy all-projects
|
|
56
|
+
// key, behaves exactly as before. Non-null keys are rejected by the
|
|
57
|
+
// scope guard (`packages/worker/src/middleware/scope-guard.ts`) on any
|
|
58
|
+
// resource belonging to a different project.
|
|
59
|
+
project_id: text("project_id").references(() => project.id),
|
|
55
60
|
enabled: integer("enabled", { mode: "boolean" }).notNull().default(true),
|
|
56
61
|
last_used_at: text("last_used_at"),
|
|
57
62
|
...timestamps(),
|
|
@@ -71,7 +76,11 @@ var project = sqliteTable("project", {
|
|
|
71
76
|
link_text: text("link_text"),
|
|
72
77
|
visibility: text("visibility", { enum: ["PUBLIC", "PRIVATE", "HIDDEN", "ARCHIVED", "DRAFT", "DELETED"] }).notNull().default("PRIVATE"),
|
|
73
78
|
current_version: text("current_version"),
|
|
74
|
-
scan_branch: text("scan_branch")
|
|
79
|
+
scan_branch: text("scan_branch"),
|
|
80
|
+
// v2.4 (task A3.6) — per-project opt-in, OFF by default: a merged PR
|
|
81
|
+
// completes its linked task automatically via the GitHub App inbound
|
|
82
|
+
// webhook. Diff-linked status because agents are unreliable narrators.
|
|
83
|
+
github_autoclose: integer("github_autoclose", { mode: "boolean" }).notNull().default(false)
|
|
75
84
|
});
|
|
76
85
|
var ACTIONS = [
|
|
77
86
|
"CREATE_TASK",
|
|
@@ -198,6 +207,65 @@ var apply_log = sqliteTable("apply_log", {
|
|
|
198
207
|
response: text("response", { mode: "json" }).notNull(),
|
|
199
208
|
created_at: text("created_at").notNull().default(sql`(CURRENT_TIMESTAMP)`)
|
|
200
209
|
});
|
|
210
|
+
var TASK_EVENT_KINDS = [
|
|
211
|
+
"task.created",
|
|
212
|
+
"task.updated",
|
|
213
|
+
"task.completed",
|
|
214
|
+
"task.reopened",
|
|
215
|
+
"task.claimed",
|
|
216
|
+
"edge.created",
|
|
217
|
+
"edge.removed",
|
|
218
|
+
"node.children_all_done",
|
|
219
|
+
"policy.fired",
|
|
220
|
+
"node.completion_stale"
|
|
221
|
+
];
|
|
222
|
+
var TASK_EVENT_ACTORS = ["user", "api", "policy", "github"];
|
|
223
|
+
var TASK_EVENT_DISPATCH_STATUSES = ["pending", "dispatched"];
|
|
224
|
+
var task_event = sqliteTable("task_event", {
|
|
225
|
+
id: integer("id").primaryKey({ autoIncrement: true }),
|
|
226
|
+
event_id: text("event_id").notNull().unique().$defaultFn(() => `evt_${crypto.randomUUID()}`),
|
|
227
|
+
kind: text("kind", { enum: TASK_EVENT_KINDS }).notNull(),
|
|
228
|
+
subject_id: text("subject_id").notNull(),
|
|
229
|
+
project_id: text("project_id"),
|
|
230
|
+
actor: text("actor", { enum: TASK_EVENT_ACTORS }).notNull(),
|
|
231
|
+
payload: text("payload", { mode: "json" }).notNull(),
|
|
232
|
+
occurred_at: text("occurred_at").notNull().default(sql`(CURRENT_TIMESTAMP)`),
|
|
233
|
+
dispatch_status: text("dispatch_status", { enum: TASK_EVENT_DISPATCH_STATUSES }).notNull().default("pending"),
|
|
234
|
+
dispatched_at: text("dispatched_at")
|
|
235
|
+
}, (table) => [
|
|
236
|
+
index("task_event_subject_id_idx").on(table.subject_id),
|
|
237
|
+
index("task_event_dispatch_status_idx").on(table.dispatch_status)
|
|
238
|
+
]);
|
|
239
|
+
var hook = sqliteTable("hook", {
|
|
240
|
+
...entity("hook"),
|
|
241
|
+
project_id: text("project_id").notNull().references(() => project.id),
|
|
242
|
+
enabled: integer("enabled", { mode: "boolean" }).notNull().default(true),
|
|
243
|
+
// HookTrigger: { kinds: TaskEventKind[], selector: { subject_kind?, tag?, ancestor_id? } }
|
|
244
|
+
trigger: text("trigger", { mode: "json" }).notNull(),
|
|
245
|
+
// HookAction: { kind: "webhook", url, secret_encrypted? } | { kind: "vault", scope, op, args? } | { kind: "pipeline", package_id }
|
|
246
|
+
action: text("action", { mode: "json" }).notNull()
|
|
247
|
+
}, (table) => [index("hook_project_id_idx").on(table.project_id)]);
|
|
248
|
+
var HOOK_DELIVERY_STATUSES = ["pending", "delivered", "failed_transient", "failed_permanent"];
|
|
249
|
+
var hook_delivery = sqliteTable("hook_delivery", {
|
|
250
|
+
// PK = sha256(`${event_id}:${hook_id}`) — see hooks/dispatch.ts's
|
|
251
|
+
// `hook_delivery_id`. Never generated any other way.
|
|
252
|
+
id: text("id").primaryKey(),
|
|
253
|
+
hook_id: text("hook_id").notNull().references(() => hook.id),
|
|
254
|
+
event_id: text("event_id").notNull(),
|
|
255
|
+
status: text("status", { enum: HOOK_DELIVERY_STATUSES }).notNull().default("pending"),
|
|
256
|
+
attempts: integer("attempts").notNull().default(0),
|
|
257
|
+
last_error: text("last_error"),
|
|
258
|
+
...timestamps()
|
|
259
|
+
}, (table) => [
|
|
260
|
+
index("hook_delivery_hook_id_idx").on(table.hook_id),
|
|
261
|
+
index("hook_delivery_status_idx").on(table.status)
|
|
262
|
+
]);
|
|
263
|
+
var github_webhook_event = sqliteTable("github_webhook_event", {
|
|
264
|
+
id: text("id").primaryKey(),
|
|
265
|
+
delivery_guid: text("delivery_guid").notNull(),
|
|
266
|
+
event_type: text("event_type").notNull(),
|
|
267
|
+
processed_at: text("processed_at").notNull().default(sql`(CURRENT_TIMESTAMP)`)
|
|
268
|
+
}, (table) => [index("github_webhook_event_delivery_guid_idx").on(table.delivery_guid)]);
|
|
201
269
|
var checklist = sqliteTable("checklist", {
|
|
202
270
|
...entity("checklist"),
|
|
203
271
|
task_id: text("task_id").notNull().references(() => task.id),
|
|
@@ -393,6 +461,16 @@ var task_link_relations = relations(task_link, ({ one }) => ({
|
|
|
393
461
|
var task_rollup_relations = relations(task_rollup, ({ one }) => ({
|
|
394
462
|
task: one(task, { fields: [task_rollup.task_id], references: [task.id] })
|
|
395
463
|
}));
|
|
464
|
+
var task_event_relations = relations(task_event, ({ one }) => ({
|
|
465
|
+
subject: one(task, { fields: [task_event.subject_id], references: [task.id] })
|
|
466
|
+
}));
|
|
467
|
+
var hook_relations = relations(hook, ({ one, many }) => ({
|
|
468
|
+
project: one(project, { fields: [hook.project_id], references: [project.id] }),
|
|
469
|
+
deliveries: many(hook_delivery)
|
|
470
|
+
}));
|
|
471
|
+
var hook_delivery_relations = relations(hook_delivery, ({ one }) => ({
|
|
472
|
+
hook: one(hook, { fields: [hook_delivery.hook_id], references: [hook.id] })
|
|
473
|
+
}));
|
|
396
474
|
var checklist_relations = relations(checklist, ({ one, many }) => ({
|
|
397
475
|
task: one(task, { fields: [checklist.task_id], references: [task.id] }),
|
|
398
476
|
items: many(checklist_item)
|
|
@@ -759,6 +837,66 @@ var apply_request = z.object({
|
|
|
759
837
|
ops: z.array(apply_op).min(1)
|
|
760
838
|
});
|
|
761
839
|
var claim_request = z.object({ actor: z.string().min(1), base_rev: z.number().int() });
|
|
840
|
+
var done_request = z.object({ base_rev: z.number().int() });
|
|
841
|
+
var task_event_actor = z.enum(TASK_EVENT_ACTORS);
|
|
842
|
+
var task_event_payload = z.discriminatedUnion("kind", [
|
|
843
|
+
z.object({ kind: z.literal("task.created"), title: z.string() }),
|
|
844
|
+
z.object({ kind: z.literal("task.updated"), fields: z.array(z.string()) }),
|
|
845
|
+
z.object({ kind: z.literal("task.completed"), via: z.enum(COMPLETED_VIA_VALUES) }),
|
|
846
|
+
z.object({ kind: z.literal("task.reopened"), via: z.enum(COMPLETED_VIA_VALUES) }),
|
|
847
|
+
z.object({ kind: z.literal("task.claimed"), actor: z.string() }),
|
|
848
|
+
z.object({ kind: z.literal("edge.created"), link_kind: task_link_kind, dst_id: z.string().nullable() }),
|
|
849
|
+
z.object({ kind: z.literal("edge.removed"), link_kind: task_link_kind, dst_id: z.string().nullable() }),
|
|
850
|
+
z.object({ kind: z.literal("node.children_all_done") }),
|
|
851
|
+
z.object({ kind: z.literal("policy.fired"), policy: z.enum(COMPLETION_POLICIES) }),
|
|
852
|
+
z.object({ kind: z.literal("node.completion_stale"), child_id: z.string() })
|
|
853
|
+
]);
|
|
854
|
+
var hook_selector = z.object({
|
|
855
|
+
subject_kind: z.enum(TASK_KINDS).optional(),
|
|
856
|
+
tag: z.string().optional(),
|
|
857
|
+
ancestor_id: z.string().optional()
|
|
858
|
+
});
|
|
859
|
+
var hook_trigger = z.object({
|
|
860
|
+
kinds: z.array(z.enum(TASK_EVENT_KINDS)).min(1),
|
|
861
|
+
selector: hook_selector.default({})
|
|
862
|
+
});
|
|
863
|
+
var hook_action_input = z.discriminatedUnion("kind", [
|
|
864
|
+
z.object({ kind: z.literal("webhook"), url: z.string().url(), secret: z.string().min(1).optional() }),
|
|
865
|
+
z.object({
|
|
866
|
+
kind: z.literal("vault"),
|
|
867
|
+
scope: z.string().min(1),
|
|
868
|
+
op: z.string().min(1),
|
|
869
|
+
args: z.record(z.string(), z.unknown()).optional()
|
|
870
|
+
}),
|
|
871
|
+
z.object({ kind: z.literal("pipeline"), package_id: z.string().min(1) })
|
|
872
|
+
]);
|
|
873
|
+
var hook_action_stored = z.discriminatedUnion("kind", [
|
|
874
|
+
z.object({ kind: z.literal("webhook"), url: z.string().url(), secret_encrypted: z.string().optional() }),
|
|
875
|
+
z.object({
|
|
876
|
+
kind: z.literal("vault"),
|
|
877
|
+
scope: z.string().min(1),
|
|
878
|
+
op: z.string().min(1),
|
|
879
|
+
args: z.record(z.string(), z.unknown()).optional()
|
|
880
|
+
}),
|
|
881
|
+
z.object({ kind: z.literal("pipeline"), package_id: z.string().min(1) })
|
|
882
|
+
]);
|
|
883
|
+
var hook_action_public = z.discriminatedUnion("kind", [
|
|
884
|
+
z.object({ kind: z.literal("webhook"), url: z.string().url(), has_secret: z.boolean() }),
|
|
885
|
+
z.object({
|
|
886
|
+
kind: z.literal("vault"),
|
|
887
|
+
scope: z.string().min(1),
|
|
888
|
+
op: z.string().min(1),
|
|
889
|
+
args: z.record(z.string(), z.unknown()).optional()
|
|
890
|
+
}),
|
|
891
|
+
z.object({ kind: z.literal("pipeline"), package_id: z.string().min(1) })
|
|
892
|
+
]);
|
|
893
|
+
var upsert_hook = z.object({
|
|
894
|
+
id: z.string().optional(),
|
|
895
|
+
project_id: z.string(),
|
|
896
|
+
enabled: z.boolean().default(true),
|
|
897
|
+
trigger: hook_trigger,
|
|
898
|
+
action: hook_action_input
|
|
899
|
+
});
|
|
762
900
|
|
|
763
901
|
export {
|
|
764
902
|
GRAPH_DEPTH_CAP,
|
|
@@ -803,5 +941,14 @@ export {
|
|
|
803
941
|
upsert_task_link,
|
|
804
942
|
apply_op,
|
|
805
943
|
apply_request,
|
|
806
|
-
claim_request
|
|
944
|
+
claim_request,
|
|
945
|
+
done_request,
|
|
946
|
+
task_event_actor,
|
|
947
|
+
task_event_payload,
|
|
948
|
+
hook_selector,
|
|
949
|
+
hook_trigger,
|
|
950
|
+
hook_action_input,
|
|
951
|
+
hook_action_stored,
|
|
952
|
+
hook_action_public,
|
|
953
|
+
upsert_hook
|
|
807
954
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
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-
|
|
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-
|
|
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-BEtzx3lu.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-CK6qaT-O.js';
|
|
3
3
|
import { z } from 'zod';
|
|
4
|
-
import { a as ApiKey,
|
|
5
|
-
export {
|
|
4
|
+
import { a as ApiKey, y as Project, ag as UpsertProject, G as GetConfigResult, S as SaveConfigRequest, a2 as TodoUpdate, H as HistoryAction, M as Milestone, j as Goal, k as Hook, q as HookTrigger, m as HookActionPublic, a8 as UpsertHook, o as HookDelivery, a1 as TaskWithDetails, aj as UpsertTodo, ah as UpsertTag, W as Task, Z as TaskLink, C as ClaimRequest, h as DoneRequest, ai as UpsertTaskLink, d as ApplyRequest, c as ApplyOp, V as TagWithTypedColor, D as DashboardResponse, w as PipelineRun, x as PipelineStageEvent, t as PipelineGrant, v as PipelinePackage, P as PipelineAnalysisTemplate, u as PipelineOidcTrust } from './types.d-NajL6dL5.js';
|
|
5
|
+
export { z as ProjectConfig } from './types.d-NajL6dL5.js';
|
|
6
6
|
import { Result } from '@f0rbit/corpus';
|
|
7
7
|
export { Result, err, ok } from '@f0rbit/corpus';
|
|
8
|
-
import { S as StageEventKind } from './schema.d-
|
|
8
|
+
import { H as HookDeliveryStatus, C as CompletedVia, S as StageEventKind } from './schema.d-CFQELmTM.js';
|
|
9
9
|
import 'drizzle-orm';
|
|
10
10
|
import './media.d-R87HGuRp.js';
|
|
11
11
|
import 'drizzle-orm/sqlite-core';
|
|
@@ -678,6 +678,11 @@ type ApiResultError = {
|
|
|
678
678
|
type ApiResult<T> = Result<T, ApiResultError>;
|
|
679
679
|
declare function wrap<T>(fn: () => Promise<T>): Promise<ApiResult<T>>;
|
|
680
680
|
|
|
681
|
+
/** Wire shape returned by every hooks route — `secret_encrypted` never round-trips (see `packages/core/src/services/hooks/registry.ts`'s `PublicHook`). */
|
|
682
|
+
type PublicHook = Omit<Hook, "action" | "trigger"> & {
|
|
683
|
+
trigger: HookTrigger;
|
|
684
|
+
action: HookActionPublic;
|
|
685
|
+
};
|
|
681
686
|
type ReadyResponse = {
|
|
682
687
|
items: Task[];
|
|
683
688
|
next_cursor: string | null;
|
|
@@ -698,6 +703,15 @@ type ApplyResponse = {
|
|
|
698
703
|
idempotency_key: string;
|
|
699
704
|
results: ApplyOpResult[];
|
|
700
705
|
};
|
|
706
|
+
type BubbleStep = {
|
|
707
|
+
task: Task;
|
|
708
|
+
via: CompletedVia;
|
|
709
|
+
};
|
|
710
|
+
type DoneResponse = {
|
|
711
|
+
completed: Task;
|
|
712
|
+
bubbled: BubbleStep[];
|
|
713
|
+
hooks_fired: string[];
|
|
714
|
+
};
|
|
701
715
|
|
|
702
716
|
type TagWithCount = {
|
|
703
717
|
tag: string;
|
|
@@ -795,6 +809,7 @@ declare class ApiClient {
|
|
|
795
809
|
create: (input?: string | {
|
|
796
810
|
name?: string;
|
|
797
811
|
scope?: "devpad" | "blog" | "media" | "pulse" | "all";
|
|
812
|
+
project_id?: string;
|
|
798
813
|
}) => Promise<ApiResult<{
|
|
799
814
|
message: string;
|
|
800
815
|
key: {
|
|
@@ -944,6 +959,18 @@ declare class ApiClient {
|
|
|
944
959
|
*/
|
|
945
960
|
goals: (id: string) => Promise<ApiResult<Goal[]>>;
|
|
946
961
|
};
|
|
962
|
+
/**
|
|
963
|
+
* Hooks namespace (task A3.2) — automation registry + delivery ledger.
|
|
964
|
+
* Webhook secrets are write-only: `secret_encrypted` never round-trips.
|
|
965
|
+
*/
|
|
966
|
+
readonly hooks: {
|
|
967
|
+
list: (project_id: string) => Promise<ApiResult<PublicHook[]>>;
|
|
968
|
+
upsert: (data: UpsertHook) => Promise<ApiResult<PublicHook>>;
|
|
969
|
+
delete: (id: string) => Promise<ApiResult<{
|
|
970
|
+
success: boolean;
|
|
971
|
+
}>>;
|
|
972
|
+
deliveries: (id: string, status?: HookDeliveryStatus) => Promise<ApiResult<HookDelivery[]>>;
|
|
973
|
+
};
|
|
947
974
|
/**
|
|
948
975
|
* Goals namespace with Result-wrapped operations
|
|
949
976
|
*/
|
|
@@ -1052,6 +1079,14 @@ declare class ApiClient {
|
|
|
1052
1079
|
near: (id: string) => Promise<ApiResult<NearResponse>>;
|
|
1053
1080
|
/** Atomic claim: sets claimed_by/claimed_at + IN_PROGRESS, guarded on claimed_by IS NULL and base_rev. */
|
|
1054
1081
|
claim: (id: string, data: ClaimRequest) => Promise<ApiResult<Task>>;
|
|
1082
|
+
/**
|
|
1083
|
+
* Completes a task through the single completion entrypoint
|
|
1084
|
+
* (CompletionEngine) — the response's `bubbled` chain is the ordered
|
|
1085
|
+
* list of ancestors an auto_children cascade also completed, exactly
|
|
1086
|
+
* what a ripple animation would replay. `hooks_fired` is a placeholder
|
|
1087
|
+
* until phase A3.
|
|
1088
|
+
*/
|
|
1089
|
+
done: (id: string, data: DoneRequest) => Promise<ApiResult<DoneResponse>>;
|
|
1055
1090
|
/** Create a typed edge between two tasks (or a task and an external ref). */
|
|
1056
1091
|
link: (data: UpsertTaskLink) => Promise<ApiResult<TaskLink>>;
|
|
1057
1092
|
/** Remove a typed edge by its own id. */
|
|
@@ -1718,4 +1753,4 @@ declare const tools: Record<string, ToolDefinition>;
|
|
|
1718
1753
|
declare const toolNames: string[];
|
|
1719
1754
|
declare function getTool(name: string): ToolDefinition | undefined;
|
|
1720
1755
|
|
|
1721
|
-
export { AccessKey, Account, AddFilterInput, ApiClient, ApiError, type ApiResult, type ApiResultError, type AuthMode, AuthenticationError, Category, CategoryCreate, CreateProfileInput, NetworkError, PlatformSettings, Post, PostContent, PostCreate, PostListParams, PostUpdate, PostsResponse, Profile, ProfileFilter, Project, type PulseErrorIssue, type PulseErrorsResult, type PulseEventRow, type PulseEventsPage, type PulseLatencyByMinute, type PulseLatencyResult, type PulseLogsResult, type PulseSummary, type PulseSummaryByDay, type RequestHistoryEntry, type RequestOptions, SaveConfigRequest, Task, TaskWithDetails, Timeline, type ToolDefinition, UpdateProfileInput, UpsertProject, UpsertTag, UpsertTodo, ValidationError, VersionInfo, ApiClient as default, getTool, getUserFriendlyErrorMessage, parseZodErrors, pulseSummaryHasData, toolNames, tools, wrap };
|
|
1756
|
+
export { AccessKey, Account, AddFilterInput, ApiClient, ApiError, type ApiResult, type ApiResultError, type AuthMode, AuthenticationError, Category, CategoryCreate, CreateProfileInput, NetworkError, PlatformSettings, Post, PostContent, PostCreate, PostListParams, PostUpdate, PostsResponse, Profile, ProfileFilter, Project, type PublicHook, type PulseErrorIssue, type PulseErrorsResult, type PulseEventRow, type PulseEventsPage, type PulseLatencyByMinute, type PulseLatencyResult, type PulseLogsResult, type PulseSummary, type PulseSummaryByDay, type RequestHistoryEntry, type RequestOptions, SaveConfigRequest, 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
|
@@ -5,11 +5,12 @@ import {
|
|
|
5
5
|
save_config_request,
|
|
6
6
|
save_tags_request,
|
|
7
7
|
upsert_goal,
|
|
8
|
+
upsert_hook,
|
|
8
9
|
upsert_milestone,
|
|
9
10
|
upsert_project,
|
|
10
11
|
upsert_task_link,
|
|
11
12
|
upsert_todo
|
|
12
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-A7B2SE7T.js";
|
|
13
14
|
import {
|
|
14
15
|
CategoryCreateSchema,
|
|
15
16
|
PostCreateSchema,
|
|
@@ -740,6 +741,20 @@ var ApiClient2 = class {
|
|
|
740
741
|
*/
|
|
741
742
|
goals: (id) => wrap(() => this.clients.milestones.get(`/milestones/${id}/goals`))
|
|
742
743
|
};
|
|
744
|
+
/**
|
|
745
|
+
* Hooks namespace (task A3.2) — automation registry + delivery ledger.
|
|
746
|
+
* Webhook secrets are write-only: `secret_encrypted` never round-trips.
|
|
747
|
+
*/
|
|
748
|
+
this.hooks = {
|
|
749
|
+
list: (project_id) => wrap(() => this.clients.hooks.get("/hooks", { query: { project_id } })),
|
|
750
|
+
upsert: (data) => wrap(
|
|
751
|
+
() => data.id ? this.clients.hooks.patch(`/hooks/${data.id}`, { body: data }) : this.clients.hooks.post("/hooks", { body: data })
|
|
752
|
+
),
|
|
753
|
+
delete: (id) => wrap(() => this.clients.hooks.delete(`/hooks/${id}`)),
|
|
754
|
+
deliveries: (id, status) => wrap(
|
|
755
|
+
() => this.clients.hooks.get(`/hooks/${id}/deliveries`, status ? { query: { status } } : {})
|
|
756
|
+
)
|
|
757
|
+
};
|
|
743
758
|
/**
|
|
744
759
|
* Goals namespace with Result-wrapped operations
|
|
745
760
|
*/
|
|
@@ -880,6 +895,14 @@ var ApiClient2 = class {
|
|
|
880
895
|
near: (id) => wrap(() => this.clients.tasks.get(`/tasks/${id}/near`)),
|
|
881
896
|
/** Atomic claim: sets claimed_by/claimed_at + IN_PROGRESS, guarded on claimed_by IS NULL and base_rev. */
|
|
882
897
|
claim: (id, data) => wrap(() => this.clients.tasks.post(`/tasks/${id}/claim`, { body: data })),
|
|
898
|
+
/**
|
|
899
|
+
* Completes a task through the single completion entrypoint
|
|
900
|
+
* (CompletionEngine) — the response's `bubbled` chain is the ordered
|
|
901
|
+
* list of ancestors an auto_children cascade also completed, exactly
|
|
902
|
+
* what a ripple animation would replay. `hooks_fired` is a placeholder
|
|
903
|
+
* until phase A3.
|
|
904
|
+
*/
|
|
905
|
+
done: (id, data) => wrap(() => this.clients.tasks.post(`/tasks/${id}/done`, { body: data })),
|
|
883
906
|
/** Create a typed edge between two tasks (or a task and an external ref). */
|
|
884
907
|
link: (data) => wrap(() => this.clients.tasks.post("/tasks/link", { body: data })),
|
|
885
908
|
/** Remove a typed edge by its own id. */
|
|
@@ -1536,7 +1559,8 @@ var ApiClient2 = class {
|
|
|
1536
1559
|
blog: new ApiClient({ ...clientOptions, category: "blog" }),
|
|
1537
1560
|
media: new ApiClient({ ...clientOptions, category: "media" }),
|
|
1538
1561
|
pulse: new ApiClient({ ...clientOptions, base_url: `${base_url}/pulse`, category: "pulse" }),
|
|
1539
|
-
pipelines: new ApiClient({ ...clientOptions, category: "pipelines" })
|
|
1562
|
+
pipelines: new ApiClient({ ...clientOptions, category: "pipelines" }),
|
|
1563
|
+
hooks: new ApiClient({ ...clientOptions, category: "hooks" })
|
|
1540
1564
|
};
|
|
1541
1565
|
}
|
|
1542
1566
|
/**
|
|
@@ -1640,6 +1664,16 @@ var milestone_by_id = z2.object({
|
|
|
1640
1664
|
var goal_by_id = z2.object({
|
|
1641
1665
|
id: z2.string().describe("Goal ID")
|
|
1642
1666
|
});
|
|
1667
|
+
var hook_filters = z2.object({
|
|
1668
|
+
project_id: z2.string().describe("Project ID to list hooks for")
|
|
1669
|
+
});
|
|
1670
|
+
var hook_by_id = z2.object({
|
|
1671
|
+
id: z2.string().describe("Hook ID")
|
|
1672
|
+
});
|
|
1673
|
+
var hook_deliveries_input = z2.object({
|
|
1674
|
+
id: z2.string().describe("Hook ID"),
|
|
1675
|
+
status: z2.enum(["pending", "delivered", "failed_transient", "failed_permanent"]).optional().describe("Filter by delivery status \u2014 use failed_permanent to see the DLQ")
|
|
1676
|
+
});
|
|
1643
1677
|
var github_branches = z2.object({
|
|
1644
1678
|
owner: z2.string().describe("Repository owner"),
|
|
1645
1679
|
repo: z2.string().describe("Repository name")
|
|
@@ -1742,6 +1776,31 @@ var tools = {
|
|
|
1742
1776
|
})
|
|
1743
1777
|
)
|
|
1744
1778
|
}),
|
|
1779
|
+
// Hooks (task A3.2) — project-scoped automation registry + delivery ledger
|
|
1780
|
+
devpad_hooks_list: define_tool({
|
|
1781
|
+
name: "devpad_hooks_list",
|
|
1782
|
+
description: "List hooks configured for a project",
|
|
1783
|
+
inputSchema: hook_filters,
|
|
1784
|
+
execute: async (client, input) => unwrap(await client.hooks.list(input.project_id))
|
|
1785
|
+
}),
|
|
1786
|
+
devpad_hooks_upsert: define_tool({
|
|
1787
|
+
name: "devpad_hooks_upsert",
|
|
1788
|
+
description: "Create or update a hook (webhook/vault/pipeline action fired on matching task_event kinds). Pass 'id' to update.",
|
|
1789
|
+
inputSchema: upsert_hook,
|
|
1790
|
+
execute: async (client, input) => unwrap(await client.hooks.upsert(input))
|
|
1791
|
+
}),
|
|
1792
|
+
devpad_hooks_delete: define_tool({
|
|
1793
|
+
name: "devpad_hooks_delete",
|
|
1794
|
+
description: "Delete a hook",
|
|
1795
|
+
inputSchema: hook_by_id,
|
|
1796
|
+
execute: async (client, input) => unwrap(await client.hooks.delete(input.id))
|
|
1797
|
+
}),
|
|
1798
|
+
devpad_hooks_deliveries: define_tool({
|
|
1799
|
+
name: "devpad_hooks_deliveries",
|
|
1800
|
+
description: "List delivery attempts for a hook, optionally filtered by status (the DLQ is status=failed_permanent)",
|
|
1801
|
+
inputSchema: hook_deliveries_input,
|
|
1802
|
+
execute: async (client, input) => unwrap(await client.hooks.deliveries(input.id, input.status))
|
|
1803
|
+
}),
|
|
1745
1804
|
// Goals
|
|
1746
1805
|
devpad_goals_list: define_tool({
|
|
1747
1806
|
name: "devpad_goals_list",
|
|
@@ -1918,6 +1977,15 @@ var tools = {
|
|
|
1918
1977
|
}),
|
|
1919
1978
|
execute: async (client, input) => unwrap(await client.tasks.claim(input.id, { actor: input.actor, base_rev: input.base_rev }))
|
|
1920
1979
|
}),
|
|
1980
|
+
devpad_tasks_done: define_tool({
|
|
1981
|
+
name: "devpad_tasks_done",
|
|
1982
|
+
description: "Complete a task through the single completion entrypoint (CompletionEngine). Returns { completed, bubbled, hooks_fired } \u2014 bubbled is the ordered chain of ancestors an auto_children cascade also completed. 409 on stale base_rev or if already completed.",
|
|
1983
|
+
inputSchema: z2.object({
|
|
1984
|
+
id: z2.string().describe("Task ID"),
|
|
1985
|
+
base_rev: z2.number().int().describe("Expected current rev \u2014 optimistic concurrency guard")
|
|
1986
|
+
}),
|
|
1987
|
+
execute: async (client, input) => unwrap(await client.tasks.done(input.id, { base_rev: input.base_rev }))
|
|
1988
|
+
}),
|
|
1921
1989
|
devpad_tasks_link: define_tool({
|
|
1922
1990
|
name: "devpad_tasks_link",
|
|
1923
1991
|
description: "Create a typed edge between two tasks (blocks | relates_to | references | discovered_from | tracks_metric)",
|