@devpad/api 2.3.5 → 2.3.6

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.
@@ -44,7 +44,8 @@ var isUnauthorizedError = (e) => hasKind(e, "unauthorized");
44
44
  var isScanError = (e) => hasKind(e, "scan_error");
45
45
  var isGithubError = (e) => hasKind(e, "github_error");
46
46
  var isValidationFieldError = (e) => hasKind(e, "validation_error");
47
- var isServiceError = (e) => isNotFoundError(e) || isForbiddenError(e) || isValidationError(e) || isValidationFieldError(e) || isRateLimitedError(e) || isStoreError(e) || isNetworkError(e) || isAuthExpiredError(e) || isApiError(e) || isParseError(e) || isEncryptionError(e) || isDatabaseError(e) || isConflictError(e) || isProtectedError(e) || isBadRequestError(e) || isUnauthorizedError(e) || isScanError(e) || isGithubError(e);
47
+ var isApprovalChannelError = (e) => hasKind(e, "approval_channel");
48
+ var isServiceError = (e) => isNotFoundError(e) || isForbiddenError(e) || isValidationError(e) || isValidationFieldError(e) || isRateLimitedError(e) || isStoreError(e) || isNetworkError(e) || isAuthExpiredError(e) || isApiError(e) || isParseError(e) || isEncryptionError(e) || isDatabaseError(e) || isConflictError(e) || isProtectedError(e) || isBadRequestError(e) || isUnauthorizedError(e) || isScanError(e) || isGithubError(e) || isApprovalChannelError(e);
48
49
  var isRetryableError = (e) => isRateLimitedError(e) || isNetworkError(e);
49
50
  var notFound = (resource, id, ctx) => logAndReturn({ kind: "not_found", resource, ...id && { id } }, ctx);
50
51
  var forbidden = (reason, ctx) => logAndReturn({ kind: "forbidden", ...reason && { reason, message: reason } }, ctx);
@@ -70,6 +71,11 @@ var unauthorized = (message, ctx) => logAndReturn({ kind: "unauthorized", ...mes
70
71
  var scanError = (message, ctx) => logAndReturn({ kind: "scan_error", ...message && { message } }, ctx);
71
72
  var githubError = (message, ctx) => logAndReturn({ kind: "github_error", ...message && { message } }, ctx);
72
73
  var validationFieldError = (field, message, ctx) => logAndReturn({ kind: "validation_error", field, ...message && { message } }, ctx);
74
+ var approvalChannel = (task_id, message, ctx) => logAndReturn({
75
+ kind: "approval_channel",
76
+ task_id,
77
+ message: message ?? `Task ${task_id} is an approval node \u2014 only a human (auth_channel=user) may complete it`
78
+ }, ctx);
73
79
  var errors = {
74
80
  notFound,
75
81
  forbidden,
@@ -89,6 +95,7 @@ var errors = {
89
95
  scanError,
90
96
  githubError,
91
97
  validationFieldError,
98
+ approvalChannel,
92
99
  is: {
93
100
  notFound: isNotFoundError,
94
101
  forbidden: isForbiddenError,
@@ -108,6 +115,7 @@ var errors = {
108
115
  unauthorized: isUnauthorizedError,
109
116
  scanError: isScanError,
110
117
  githubError: isGithubError,
118
+ approvalChannel: isApprovalChannelError,
111
119
  serviceError: isServiceError,
112
120
  retryable: isRetryableError
113
121
  }
@@ -133,6 +141,7 @@ export {
133
141
  isScanError,
134
142
  isGithubError,
135
143
  isValidationFieldError,
144
+ isApprovalChannelError,
136
145
  isServiceError,
137
146
  isRetryableError,
138
147
  notFound,
@@ -153,5 +162,6 @@ export {
153
162
  scanError,
154
163
  githubError,
155
164
  validationFieldError,
165
+ approvalChannel,
156
166
  errors
157
167
  };
@@ -100,7 +100,11 @@ var ACTIONS = [
100
100
  "DELETE_MILESTONE",
101
101
  "CREATE_CHECKLIST",
102
102
  "UPDATE_CHECKLIST",
103
- "DELETE_CHECKLIST"
103
+ "DELETE_CHECKLIST",
104
+ // v2.4 (task A4.5) — audit row for every stage transition, gated or
105
+ // overridden. Written regardless of auth_channel so the AI Activity Feed
106
+ // (`channel` column) can distinguish an agent-driven override.
107
+ "ADVANCE_STAGE"
104
108
  ];
105
109
  var action = sqliteTable("action", {
106
110
  ...owned_entity("action"),
@@ -157,6 +161,7 @@ var TASK_KINDS = ["task", "phase", "approval"];
157
161
  var COMPLETION_POLICIES = ["manual", "auto_children"];
158
162
  var COMPLETED_VIA_VALUES = ["user", "api", "policy"];
159
163
  var TASK_LINK_KINDS = ["blocks", "relates_to", "references", "discovered_from", "tracks_metric"];
164
+ var SDLC_STAGES = ["ideate", "plan", "build", "review", "deploy", "live"];
160
165
  var task = sqliteTable("task", {
161
166
  ...owned_entity("task"),
162
167
  title: text("title").notNull(),
@@ -180,7 +185,10 @@ var task = sqliteTable("task", {
180
185
  completion_policy: text("completion_policy", { enum: COMPLETION_POLICIES }).notNull().default("manual"),
181
186
  completed_via: text("completed_via", { enum: COMPLETED_VIA_VALUES }),
182
187
  claimed_by: text("claimed_by"),
183
- claimed_at: text("claimed_at")
188
+ claimed_at: text("claimed_at"),
189
+ // v2.4 (task A4.5) — nullable: opting a task into SDLC stage tracking is
190
+ // per-task, not a blanket migration.
191
+ stage: text("stage", { enum: SDLC_STAGES })
184
192
  }, (table) => [index("task_parent_id_idx").on(table.parent_id)]);
185
193
  var task_link = sqliteTable("task_link", {
186
194
  ...entity("link"),
@@ -217,7 +225,15 @@ var TASK_EVENT_KINDS = [
217
225
  "edge.removed",
218
226
  "node.children_all_done",
219
227
  "policy.fired",
220
- "node.completion_stale"
228
+ "node.completion_stale",
229
+ // v2.4 (task A4) — docs/annotation/signoff/stage events. Hooks can bind to
230
+ // any of these exactly like a graph event; no new dispatch machinery.
231
+ "doc.pushed",
232
+ "thread.opened",
233
+ "thread.resolved",
234
+ "signoff.requested",
235
+ "signoff.decided",
236
+ "stage.advanced"
221
237
  ];
222
238
  var TASK_EVENT_ACTORS = ["user", "api", "policy", "github"];
223
239
  var TASK_EVENT_DISPATCH_STATUSES = ["pending", "dispatched"];
@@ -266,6 +282,58 @@ var github_webhook_event = sqliteTable("github_webhook_event", {
266
282
  event_type: text("event_type").notNull(),
267
283
  processed_at: text("processed_at").notNull().default(sql`(CURRENT_TIMESTAMP)`)
268
284
  }, (table) => [index("github_webhook_event_delivery_guid_idx").on(table.delivery_guid)]);
285
+ var DOCUMENT_KINDS = ["plan", "design", "interface"];
286
+ var DOCUMENT_STATUSES = ["draft", "in_review", "approved"];
287
+ var document = sqliteTable("document", {
288
+ ...entity("doc"),
289
+ project_id: text("project_id").notNull().references(() => project.id),
290
+ // Nullable subject node — a doc need not be tied to a specific task
291
+ // (e.g. a project-level design doc).
292
+ task_id: text("task_id").references(() => task.id),
293
+ kind: text("kind", { enum: DOCUMENT_KINDS }).notNull(),
294
+ title: text("title").notNull(),
295
+ // Corpus version pointer cache — the DB never stores content, only the
296
+ // latest corpus snapshot version for this document's dedicated store
297
+ // (`docStoreId`). Null until the first push.
298
+ head_version: text("head_version"),
299
+ status: text("status", { enum: DOCUMENT_STATUSES }).notNull().default("draft")
300
+ }, (table) => [index("document_project_id_idx").on(table.project_id), index("document_task_id_idx").on(table.task_id)]);
301
+ var THREAD_STATUSES = ["open", "addressed", "resolved", "orphaned"];
302
+ var annotation_thread = sqliteTable("annotation_thread", {
303
+ ...id("thread"),
304
+ document_id: text("document_id").notNull().references(() => document.id),
305
+ // The marker's own `id` field (embedded in the doc) — stable across
306
+ // versions/re-anchoring, distinct from this row's own DB id.
307
+ thread_id: text("thread_id").notNull(),
308
+ status: text("status", { enum: THREAD_STATUSES }).notNull().default("open"),
309
+ blocking: int("blocking", { mode: "boolean" }).notNull().default(false),
310
+ ...timestamps()
311
+ }, (table) => [
312
+ unique("annotation_thread_unique").on(table.document_id, table.thread_id),
313
+ index("annotation_thread_document_id_idx").on(table.document_id),
314
+ index("annotation_thread_status_idx").on(table.status)
315
+ ]);
316
+ var SIGNOFF_SUBJECT_KINDS = ["doc_version", "stage", "pipeline_gate"];
317
+ var SIGNOFF_CHECKPOINTS = ["plan", "types", "design"];
318
+ var SIGNOFF_DECISIONS = ["approved", "changes_requested", "auto"];
319
+ var signoff = sqliteTable("signoff", {
320
+ ...entity("signoff"),
321
+ subject_kind: text("subject_kind", { enum: SIGNOFF_SUBJECT_KINDS }).notNull(),
322
+ subject_id: text("subject_id").notNull(),
323
+ checkpoint: text("checkpoint", { enum: SIGNOFF_CHECKPOINTS }).notNull(),
324
+ // The `kind:"approval"` task node this checkpoint projects into the
325
+ // graph — null only for the brief window before `request_checkpoint`
326
+ // finishes creating it (never persisted mid-transaction in practice).
327
+ task_id: text("task_id").references(() => task.id),
328
+ decision: text("decision", { enum: SIGNOFF_DECISIONS }),
329
+ decided_by: text("decided_by").references(() => user.id),
330
+ decided_at: text("decided_at"),
331
+ reason: text("reason"),
332
+ content_hash: text("content_hash")
333
+ }, (table) => [
334
+ index("signoff_subject_idx").on(table.subject_kind, table.subject_id),
335
+ index("signoff_task_id_idx").on(table.task_id)
336
+ ]);
269
337
  var checklist = sqliteTable("checklist", {
270
338
  ...entity("checklist"),
271
339
  task_id: text("task_id").notNull().references(() => task.id),
@@ -512,6 +580,18 @@ var pipeline_analysis_template_relations = relations(pipeline_analysis_template,
512
580
  var pipeline_oidc_trust_relations = relations(pipeline_oidc_trust, ({ one }) => ({
513
581
  owner: one(user, { fields: [pipeline_oidc_trust.owner_id], references: [user.id] })
514
582
  }));
583
+ var document_relations = relations(document, ({ one, many }) => ({
584
+ project: one(project, { fields: [document.project_id], references: [project.id] }),
585
+ task: one(task, { fields: [document.task_id], references: [task.id] }),
586
+ threads: many(annotation_thread)
587
+ }));
588
+ var annotation_thread_relations = relations(annotation_thread, ({ one }) => ({
589
+ document: one(document, { fields: [annotation_thread.document_id], references: [document.id] })
590
+ }));
591
+ var signoff_relations = relations(signoff, ({ one }) => ({
592
+ task: one(task, { fields: [signoff.task_id], references: [task.id] }),
593
+ decided_by_user: one(user, { fields: [signoff.decided_by], references: [user.id] })
594
+ }));
515
595
 
516
596
  // ../schema/dist/validation.js
517
597
  import { z } from "zod";
@@ -849,8 +929,110 @@ var task_event_payload = z.discriminatedUnion("kind", [
849
929
  z.object({ kind: z.literal("edge.removed"), link_kind: task_link_kind, dst_id: z.string().nullable() }),
850
930
  z.object({ kind: z.literal("node.children_all_done") }),
851
931
  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() })
932
+ z.object({ kind: z.literal("node.completion_stale"), child_id: z.string() }),
933
+ z.object({ kind: z.literal("doc.pushed"), document_id: z.string(), version: z.string() }),
934
+ z.object({ kind: z.literal("thread.opened"), document_id: z.string(), thread_id: z.string() }),
935
+ z.object({ kind: z.literal("thread.resolved"), document_id: z.string(), thread_id: z.string() }),
936
+ z.object({
937
+ kind: z.literal("signoff.requested"),
938
+ subject_kind: z.enum(SIGNOFF_SUBJECT_KINDS),
939
+ subject_id: z.string(),
940
+ checkpoint: z.enum(SIGNOFF_CHECKPOINTS)
941
+ }),
942
+ z.object({
943
+ kind: z.literal("signoff.decided"),
944
+ subject_kind: z.enum(SIGNOFF_SUBJECT_KINDS),
945
+ subject_id: z.string(),
946
+ checkpoint: z.enum(SIGNOFF_CHECKPOINTS),
947
+ decision: z.enum(SIGNOFF_DECISIONS)
948
+ }),
949
+ z.object({
950
+ kind: z.literal("stage.advanced"),
951
+ from: z.enum(SDLC_STAGES).nullable(),
952
+ to: z.enum(SDLC_STAGES),
953
+ override: z.boolean()
954
+ })
853
955
  ]);
956
+ var document_kind = z.enum(DOCUMENT_KINDS);
957
+ var push_doc_request = z.object({
958
+ document_id: z.string().optional(),
959
+ project_id: z.string(),
960
+ task_id: z.string().nullable().optional(),
961
+ kind: document_kind,
962
+ title: z.string().min(1),
963
+ html: z.string()
964
+ });
965
+ var thread_anchor = z.object({
966
+ quote: z.string().min(1),
967
+ prefix: z.string(),
968
+ suffix: z.string(),
969
+ start: z.number().int().nonnegative(),
970
+ end: z.number().int().nonnegative()
971
+ });
972
+ var thread_entry = z.object({
973
+ author: z.string().min(1),
974
+ channel: z.enum(["user", "api"]),
975
+ body: z.string().min(1),
976
+ at: z.string()
977
+ });
978
+ var thread_status = z.enum(THREAD_STATUSES);
979
+ var thread_marker = z.object({
980
+ id: z.string().min(1),
981
+ anchor: thread_anchor,
982
+ status: thread_status,
983
+ blocking: z.boolean(),
984
+ entries: z.array(thread_entry).min(1)
985
+ });
986
+ var create_thread_request = z.object({
987
+ quote: z.string().min(1),
988
+ prefix: z.string(),
989
+ suffix: z.string(),
990
+ start: z.number().int().nonnegative(),
991
+ end: z.number().int().nonnegative(),
992
+ body: z.string().min(1),
993
+ blocking: z.boolean().optional().default(false)
994
+ });
995
+ var reply_thread_request = z.object({ body: z.string().min(1) });
996
+ var toggle_blocking_request = z.object({ blocking: z.boolean() });
997
+ var signoff_subject_kind = z.enum(SIGNOFF_SUBJECT_KINDS);
998
+ var signoff_checkpoint = z.enum(SIGNOFF_CHECKPOINTS);
999
+ var request_checkpoint_request = z.object({
1000
+ project_id: z.string(),
1001
+ subject_kind: signoff_subject_kind,
1002
+ subject_id: z.string(),
1003
+ checkpoint: signoff_checkpoint,
1004
+ // Explicit, not inferred (architecture-decisions) — the caller names the
1005
+ // downstream task ids this checkpoint's approval node blocks.
1006
+ blocks: z.array(z.string()).default([])
1007
+ });
1008
+ var decide_checkpoint_request = z.object({
1009
+ decision: z.union([z.literal("approved"), z.literal("changes_requested")]),
1010
+ reason: z.string().optional()
1011
+ });
1012
+ var sdlc_stage = z.enum(SDLC_STAGES);
1013
+ var advance_stage_request = z.object({
1014
+ to: sdlc_stage,
1015
+ override: z.boolean().optional().default(false),
1016
+ reason: z.string().optional()
1017
+ });
1018
+ var push_interface_report_request = z.object({
1019
+ document_id: z.string().optional(),
1020
+ project_id: z.string(),
1021
+ task_id: z.string().nullable().optional(),
1022
+ title: z.string().min(1),
1023
+ normalized: z.string()
1024
+ });
1025
+ var INTERFACE_DIFF_CLASSES = ["additive", "breaking", "unchanged"];
1026
+ var REVIEW_ITEM_KINDS = ["signoff", "annotation", "pipeline_gate", "scan_diff"];
1027
+ var review_item = z.object({
1028
+ kind: z.enum(REVIEW_ITEM_KINDS),
1029
+ subject_id: z.string(),
1030
+ title: z.string(),
1031
+ project_id: z.string().nullable(),
1032
+ created_at: z.string(),
1033
+ path: z.string()
1034
+ });
1035
+ var reviews_pending_response = z.object({ items: z.array(review_item) });
854
1036
  var hook_selector = z.object({
855
1037
  subject_kind: z.enum(TASK_KINDS).optional(),
856
1038
  tag: z.string().optional(),
@@ -945,6 +1127,26 @@ export {
945
1127
  done_request,
946
1128
  task_event_actor,
947
1129
  task_event_payload,
1130
+ document_kind,
1131
+ push_doc_request,
1132
+ thread_anchor,
1133
+ thread_entry,
1134
+ thread_status,
1135
+ thread_marker,
1136
+ create_thread_request,
1137
+ reply_thread_request,
1138
+ toggle_blocking_request,
1139
+ signoff_subject_kind,
1140
+ signoff_checkpoint,
1141
+ request_checkpoint_request,
1142
+ decide_checkpoint_request,
1143
+ sdlc_stage,
1144
+ advance_stage_request,
1145
+ push_interface_report_request,
1146
+ INTERFACE_DIFF_CLASSES,
1147
+ REVIEW_ITEM_KINDS,
1148
+ review_item,
1149
+ reviews_pending_response,
948
1150
  hook_selector,
949
1151
  hook_trigger,
950
1152
  hook_action_input,
@@ -73,7 +73,11 @@ type ValidationFieldError = BaseError & {
73
73
  kind: "validation_error";
74
74
  field: string;
75
75
  };
76
- type ServiceError = NotFoundError | ForbiddenError | ValidationError | ValidationFieldError | RateLimitedError | StoreError | NetworkError | AuthExpiredError | ApiError | ParseError | EncryptionError | DatabaseError | ConflictError | ProtectedError | BadRequestError | UnauthorizedError | ScanError | GithubError;
76
+ type ApprovalChannelError = BaseError & {
77
+ kind: "approval_channel";
78
+ task_id: string;
79
+ };
80
+ type ServiceError = NotFoundError | ForbiddenError | ValidationError | ValidationFieldError | RateLimitedError | StoreError | NetworkError | AuthExpiredError | ApiError | ParseError | EncryptionError | DatabaseError | ConflictError | ProtectedError | BadRequestError | UnauthorizedError | ScanError | GithubError | ApprovalChannelError;
77
81
  type ProviderError = RateLimitedError | AuthExpiredError | NetworkError | ApiError | ParseError;
78
82
  type CronError = StoreError | NetworkError | AuthExpiredError | EncryptionError;
79
83
  type ErrorContext = {
@@ -111,6 +115,7 @@ declare const isUnauthorizedError: (e: unknown) => e is UnauthorizedError;
111
115
  declare const isScanError: (e: unknown) => e is ScanError;
112
116
  declare const isGithubError: (e: unknown) => e is GithubError;
113
117
  declare const isValidationFieldError: (e: unknown) => e is ValidationFieldError;
118
+ declare const isApprovalChannelError: (e: unknown) => e is ApprovalChannelError;
114
119
  declare const isServiceError: (e: unknown) => e is ServiceError;
115
120
  declare const isRetryableError: (e: unknown) => boolean;
116
121
  declare const notFound: (resource: string, id?: string, ctx?: Record<string, unknown>) => Result<never, NotFoundError>;
@@ -131,6 +136,7 @@ declare const unauthorized: (message?: string, ctx?: Record<string, unknown>) =>
131
136
  declare const scanError: (message?: string, ctx?: Record<string, unknown>) => Result<never, ScanError>;
132
137
  declare const githubError: (message?: string, ctx?: Record<string, unknown>) => Result<never, GithubError>;
133
138
  declare const validationFieldError: (field: string, message?: string, ctx?: Record<string, unknown>) => Result<never, ValidationFieldError>;
139
+ declare const approvalChannel: (task_id: string, message?: string, ctx?: Record<string, unknown>) => Result<never, ApprovalChannelError>;
134
140
  declare const errors: {
135
141
  readonly notFound: (resource: string, id?: string, ctx?: Record<string, unknown>) => Result<never, NotFoundError>;
136
142
  readonly forbidden: (reason?: string, ctx?: Record<string, unknown>) => Result<never, ForbiddenError>;
@@ -150,6 +156,7 @@ declare const errors: {
150
156
  readonly scanError: (message?: string, ctx?: Record<string, unknown>) => Result<never, ScanError>;
151
157
  readonly githubError: (message?: string, ctx?: Record<string, unknown>) => Result<never, GithubError>;
152
158
  readonly validationFieldError: (field: string, message?: string, ctx?: Record<string, unknown>) => Result<never, ValidationFieldError>;
159
+ readonly approvalChannel: (task_id: string, message?: string, ctx?: Record<string, unknown>) => Result<never, ApprovalChannelError>;
153
160
  readonly is: {
154
161
  readonly notFound: (e: unknown) => e is NotFoundError;
155
162
  readonly forbidden: (e: unknown) => e is ForbiddenError;
@@ -169,9 +176,10 @@ declare const errors: {
169
176
  readonly unauthorized: (e: unknown) => e is UnauthorizedError;
170
177
  readonly scanError: (e: unknown) => e is ScanError;
171
178
  readonly githubError: (e: unknown) => e is GithubError;
179
+ readonly approvalChannel: (e: unknown) => e is ApprovalChannelError;
172
180
  readonly serviceError: (e: unknown) => e is ServiceError;
173
181
  readonly retryable: (e: unknown) => boolean;
174
182
  };
175
183
  };
176
184
 
177
- export { isValidationFieldError as $, type ApiError as A, type BadRequestError as B, type ConflictError as C, type DatabaseError as D, type EncryptionError as E, type ForbiddenError as F, type GithubError as G, isEncryptionError as H, isForbiddenError as I, isGithubError as J, isNetworkError as K, isNotFoundError as L, isParseError as M, type NetworkError as N, isProtectedError as O, type ParseError as P, isRateLimitedError as Q, type RateLimitedError as R, type ScanError as S, isRetryableError as T, type UnauthorizedError as U, type ValidationError as V, isScanError as W, isServiceError as X, isStoreError as Y, isUnauthorizedError as Z, isValidationError as _, type AuthExpiredError as a, networkError as a0, notFound as a1, parseError as a2, protectedEntity as a3, rateLimited as a4, scanError as a5, storeError as a6, unauthorized as a7, validation as a8, validationFieldError as a9, type BaseError as b, type CronError as c, type ErrorContext as d, type ErrorLogEntry as e, type NotFoundError as f, type ProtectedError as g, type ProviderError as h, type ServiceError as i, type StoreError as j, type ValidationFieldError as k, apiError as l, authExpired as m, badRequest as n, configureErrorLogging as o, conflict as p, dbError as q, encryptionError as r, errors as s, forbidden as t, githubError as u, isApiError as v, isAuthExpiredError as w, isBadRequestError as x, isConflictError as y, isDatabaseError as z };
185
+ export { isStoreError as $, type ApiError as A, type BadRequestError as B, type ConflictError as C, type DatabaseError as D, type EncryptionError as E, type ForbiddenError as F, type GithubError as G, isBadRequestError as H, isConflictError as I, isDatabaseError as J, isEncryptionError as K, isForbiddenError as L, isGithubError as M, type NetworkError as N, isNetworkError as O, type ParseError as P, isNotFoundError as Q, type RateLimitedError as R, type ScanError as S, isParseError as T, type UnauthorizedError as U, type ValidationError as V, isProtectedError as W, isRateLimitedError as X, isRetryableError as Y, isScanError as Z, isServiceError as _, type ApprovalChannelError as a, isUnauthorizedError as a0, isValidationError as a1, isValidationFieldError as a2, networkError as a3, notFound as a4, parseError as a5, protectedEntity as a6, rateLimited as a7, scanError as a8, storeError as a9, unauthorized as aa, validation as ab, validationFieldError as ac, type AuthExpiredError as b, type BaseError as c, type CronError as d, type ErrorContext as e, type ErrorLogEntry as f, type NotFoundError as g, type ProtectedError as h, type ProviderError as i, type ServiceError as j, type StoreError as k, type ValidationFieldError as l, apiError as m, approvalChannel as n, authExpired as o, badRequest as p, configureErrorLogging as q, conflict as r, dbError as s, encryptionError as t, errors as u, forbidden as v, githubError as w, isApiError as x, isApprovalChannelError as y, isAuthExpiredError as z };
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-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';
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-CsYeI1BE.js';
3
3
  import { z } from 'zod';
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';
4
+ import { c as ApiKey, O as Project, aA as UpsertProject, G as GetConfigResult, a0 as SaveConfigRequest, al as TodoUpdate, H as HistoryAction, M as Milestone, o as Goal, p as Hook, v as HookTrigger, r as HookActionPublic, as as UpsertHook, t as HookDelivery, ah as TaskWithDetails, aD as UpsertTodo, aB as UpsertTag, aa as Task, ad as TaskLink, C as ClaimRequest, m as DoneRequest, a as AdvanceStageRequest, aC as UpsertTaskLink, f as ApplyRequest, e as ApplyOp, a9 as TagWithTypedColor, l as Document, S as PushDocRequest, ak as ThreadMarker, i as CreateThreadRequest, b as AnnotationThread, T as PushInterfaceReportRequest, y as InterfaceDiffClass, a3 as Signoff, W as RequestCheckpointRequest, k as DecideCheckpointRequest, X 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-CEmFf0kh.js';
5
+ export { Q as ProjectConfig } from './types.d-CEmFf0kh.js';
6
6
  import { Result } from '@f0rbit/corpus';
7
7
  export { Result, err, ok } from '@f0rbit/corpus';
8
- import { H as HookDeliveryStatus, C as CompletedVia, S as StageEventKind } from './schema.d-CFQELmTM.js';
8
+ import { H as HookDeliveryStatus, C as CompletedVia, i as StageEventKind } from './schema.d-7jUA2Hd2.js';
9
9
  import 'drizzle-orm';
10
10
  import './media.d-R87HGuRp.js';
11
11
  import 'drizzle-orm/sqlite-core';
@@ -683,6 +683,27 @@ type PublicHook = Omit<Hook, "action" | "trigger"> & {
683
683
  trigger: HookTrigger;
684
684
  action: HookActionPublic;
685
685
  };
686
+ type DocContent = {
687
+ title: string;
688
+ html: string;
689
+ };
690
+ type DocVersionInfo = {
691
+ version: string;
692
+ parent: string | null;
693
+ created_at: string;
694
+ tags: string[];
695
+ };
696
+ type PullDocResponse = {
697
+ document: Document;
698
+ content: DocContent | null;
699
+ threads: ThreadMarker[];
700
+ orphaned: ThreadMarker[];
701
+ };
702
+ type PushInterfaceReportResult = {
703
+ document: Document;
704
+ classification: InterfaceDiffClass;
705
+ signoff: Signoff | null;
706
+ };
686
707
  type ReadyResponse = {
687
708
  items: Task[];
688
709
  next_cursor: string | null;
@@ -1087,6 +1108,12 @@ declare class ApiClient {
1087
1108
  * until phase A3.
1088
1109
  */
1089
1110
  done: (id: string, data: DoneRequest) => Promise<ApiResult<DoneResponse>>;
1111
+ /**
1112
+ * SDLC stage transition (v2.4, task A4.5) — gently enforced: a gated
1113
+ * hop missing its checkpoint 409s naming what's missing; `override:
1114
+ * true` always succeeds but audits.
1115
+ */
1116
+ advanceStage: (id: string, data: AdvanceStageRequest) => Promise<ApiResult<Task>>;
1090
1117
  /** Create a typed edge between two tasks (or a task and an external ref). */
1091
1118
  link: (data: UpsertTaskLink) => Promise<ApiResult<TaskLink>>;
1092
1119
  /** Remove a typed edge by its own id. */
@@ -1110,6 +1137,74 @@ declare class ApiClient {
1110
1137
  */
1111
1138
  list: () => Promise<ApiResult<TagWithTypedColor[]>>;
1112
1139
  };
1140
+ /**
1141
+ * Docs namespace (v2.4, task A4.1) — corpus-backed doc store. `push`
1142
+ * creates a new document (omit `document_id`) or a new version on an
1143
+ * existing one; content is sanitized server-side before it ever reaches
1144
+ * corpus.
1145
+ */
1146
+ readonly docs: {
1147
+ list: (filters: {
1148
+ project_id: string;
1149
+ task_id?: string;
1150
+ }) => Promise<ApiResult<Document[]>>;
1151
+ push: (data: PushDocRequest) => Promise<ApiResult<Document>>;
1152
+ /** Pulls a document's content at `version` (default: head). `content` is null for a document that's never been pushed to. */
1153
+ pull: (id: string, version?: string) => Promise<ApiResult<PullDocResponse>>;
1154
+ /** Full version history, newest first — the lineage walk. */
1155
+ versions: (id: string) => Promise<ApiResult<DocVersionInfo[]>>;
1156
+ /**
1157
+ * Annotation engine (task A4.2) — markers-in-doc threads. Every
1158
+ * mutation pushes a new corpus version; the doc itself is the thread
1159
+ * history (locked decision 3).
1160
+ */
1161
+ createThread: (document_id: string, data: CreateThreadRequest) => Promise<ApiResult<Document>>;
1162
+ replyThread: (document_id: string, thread_id: string, body: string) => Promise<ApiResult<Document>>;
1163
+ resolveThread: (document_id: string, thread_id: string) => Promise<ApiResult<Document>>;
1164
+ toggleBlocking: (document_id: string, thread_id: string, blocking: boolean) => Promise<ApiResult<Document>>;
1165
+ /** Pending annotation threads (anything not `resolved`) — scope to one document, or every document in a project. */
1166
+ unresolved: (filters: {
1167
+ project_id?: string;
1168
+ document_id?: string;
1169
+ }) => Promise<ApiResult<AnnotationThread[]>>;
1170
+ /**
1171
+ * Interface report v1 (task A4.4). `push` submits already-normalized
1172
+ * declaration text; the server independently recomputes the
1173
+ * additive-vs-breaking classification against its own stored previous
1174
+ * content and auto-approves additive diffs against an approved base.
1175
+ */
1176
+ pushInterfaceReport: (data: PushInterfaceReportRequest) => Promise<ApiResult<PushInterfaceReportResult>>;
1177
+ interfaceStatus: (filters: {
1178
+ project_id: string;
1179
+ task_id?: string;
1180
+ title: string;
1181
+ }) => Promise<ApiResult<{
1182
+ document_id: string | null;
1183
+ approved_content_hash: string | null;
1184
+ }>>;
1185
+ };
1186
+ /**
1187
+ * Signoffs namespace (v2.4, task A4.3) — the generalized human-approval
1188
+ * ledger. `decide` is human-only; an api-channel key gets 403.
1189
+ */
1190
+ readonly signoffs: {
1191
+ request: (data: RequestCheckpointRequest) => Promise<ApiResult<{
1192
+ signoff: Signoff;
1193
+ task_id: string;
1194
+ }>>;
1195
+ find: (id: string) => Promise<ApiResult<Signoff>>;
1196
+ decide: (id: string, data: DecideCheckpointRequest) => Promise<ApiResult<Signoff>>;
1197
+ };
1198
+ /**
1199
+ * Reviews namespace (v2.4, task A4.6) — the human's queue: one typed
1200
+ * aggregate across pending signoffs, open blocking annotation threads,
1201
+ * pending pipeline manual gates, and pending scanner diffs.
1202
+ */
1203
+ readonly reviews: {
1204
+ pending: () => Promise<ApiResult<{
1205
+ items: ReviewItem[];
1206
+ }>>;
1207
+ };
1113
1208
  /**
1114
1209
  * GitHub namespace with Result-wrapped operations
1115
1210
  */