@devpad/mcp 2.6.12 → 2.6.14

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.
Files changed (2) hide show
  1. package/dist/index.js +520 -287
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -7999,6 +7999,181 @@ class PrimaryKey {
7999
7999
  }
8000
8000
  }
8001
8001
 
8002
+ // ../../node_modules/@f0rbit/corpus/dist/types.js
8003
+ var ok = (value) => ({ ok: true, value });
8004
+ var err = (error) => ({ ok: false, error });
8005
+ function define_store(id, codec, opts) {
8006
+ if (typeof opts === "string") {
8007
+ return { id, codec, description: opts };
8008
+ }
8009
+ return { id, codec, description: opts?.description, data_key_fn: opts?.data_key_fn };
8010
+ }
8011
+
8012
+ // ../../node_modules/@f0rbit/corpus/dist/utils.js
8013
+ function json_codec(schema) {
8014
+ return {
8015
+ content_type: "application/json",
8016
+ encode: async (value) => new TextEncoder().encode(JSON.stringify(value)),
8017
+ decode: async (bytes) => schema.parse(JSON.parse(new TextDecoder().decode(bytes)))
8018
+ };
8019
+ }
8020
+ function create_filter_pipeline(config) {
8021
+ return (items, opts) => {
8022
+ let filtered = items;
8023
+ for (const { key, predicate } of config.filters) {
8024
+ const optValue = opts[key];
8025
+ if (optValue !== undefined && optValue !== null) {
8026
+ filtered = filtered.filter((item) => predicate(item, optValue));
8027
+ }
8028
+ }
8029
+ filtered.sort(config.sort);
8030
+ if (opts.limit) {
8031
+ filtered = filtered.slice(0, opts.limit);
8032
+ }
8033
+ return filtered;
8034
+ };
8035
+ }
8036
+ var snapshot_filter_pipeline = create_filter_pipeline({
8037
+ filters: [
8038
+ { key: "before", predicate: (m, before) => m.created_at < before },
8039
+ { key: "after", predicate: (m, after) => m.created_at > after },
8040
+ { key: "tags", predicate: (m, tags) => tags.length === 0 || tags.every((tag) => m.tags?.includes(tag)) }
8041
+ ],
8042
+ sort: (a, b) => b.created_at.getTime() - a.created_at.getTime()
8043
+ });
8044
+
8045
+ // ../../node_modules/@f0rbit/corpus/dist/result.js
8046
+ var try_catch = (fn, on_error) => {
8047
+ try {
8048
+ return ok(fn());
8049
+ } catch (e) {
8050
+ return err(on_error(e));
8051
+ }
8052
+ };
8053
+ var try_catch_async = async (fn, on_error) => {
8054
+ try {
8055
+ return ok(await fn());
8056
+ } catch (e) {
8057
+ return err(on_error(e));
8058
+ }
8059
+ };
8060
+ var fetch_result = async (input, init, on_error, parse_body = (r) => r.json()) => {
8061
+ try {
8062
+ const response = await fetch(input, init);
8063
+ if (!response.ok) {
8064
+ return err(on_error({ type: "http", status: response.status, status_text: response.statusText }));
8065
+ }
8066
+ return ok(await parse_body(response));
8067
+ } catch (e) {
8068
+ return err(on_error({ type: "network", cause: e }));
8069
+ }
8070
+ };
8071
+ var create_pipe = (promised) => ({
8072
+ map: (fn) => create_pipe(promised.then((r) => {
8073
+ if (r.ok)
8074
+ return ok(fn(r.value));
8075
+ return err(r.error);
8076
+ })),
8077
+ map_async: (fn) => create_pipe(promised.then(async (r) => {
8078
+ if (r.ok)
8079
+ return ok(await fn(r.value));
8080
+ return err(r.error);
8081
+ })),
8082
+ flat_map: (fn) => create_pipe(promised.then((r) => {
8083
+ if (r.ok)
8084
+ return fn(r.value);
8085
+ return err(r.error);
8086
+ })),
8087
+ map_err: (fn) => create_pipe(promised.then((r) => {
8088
+ if (r.ok)
8089
+ return ok(r.value);
8090
+ return err(fn(r.error));
8091
+ })),
8092
+ tap: (fn) => create_pipe(promised.then(async (r) => {
8093
+ if (r.ok)
8094
+ await fn(r.value);
8095
+ return r;
8096
+ })),
8097
+ tap_err: (fn) => create_pipe(promised.then(async (r) => {
8098
+ if (!r.ok)
8099
+ await fn(r.error);
8100
+ return r;
8101
+ })),
8102
+ unwrap_or: (default_value) => promised.then((r) => r.ok ? r.value : default_value),
8103
+ result: () => promised
8104
+ });
8105
+ var pipe = (initial) => create_pipe(Promise.resolve(initial));
8106
+ pipe.ok = (value) => pipe(ok(value));
8107
+ pipe.err = (error) => pipe(err(error));
8108
+ pipe.try = (fn, on_error) => pipe(try_catch_async(fn, on_error));
8109
+ pipe.fetch = (input, init, on_error, parse_body) => pipe(fetch_result(input, init, on_error, parse_body));
8110
+
8111
+ // ../../node_modules/@f0rbit/corpus/dist/observations/storage.js
8112
+ var observation_filter_pipeline = create_filter_pipeline({
8113
+ filters: [
8114
+ {
8115
+ key: "type",
8116
+ predicate: (r, type) => {
8117
+ const types = Array.isArray(type) ? type : [type];
8118
+ return types.includes(r.type);
8119
+ }
8120
+ },
8121
+ { key: "source_store_id", predicate: (r, id) => r.source_store_id === id },
8122
+ { key: "source_version", predicate: (r, version) => r.source_version === version },
8123
+ { key: "source_prefix", predicate: (r, prefix) => r.source_version.startsWith(prefix) },
8124
+ { key: "created_after", predicate: (r, after) => r.created_at > after },
8125
+ { key: "created_before", predicate: (r, before) => r.created_at < before },
8126
+ { key: "observed_after", predicate: (r, after) => r.observed_at !== null && r.observed_at > after },
8127
+ { key: "observed_before", predicate: (r, before) => r.observed_at !== null && r.observed_at < before }
8128
+ ],
8129
+ sort: (a, b) => b.created_at.localeCompare(a.created_at)
8130
+ });
8131
+ // ../../node_modules/@f0rbit/corpus/dist/observations/schema.js
8132
+ var corpus_observations = sqliteTable("corpus_observations", {
8133
+ id: text("id").primaryKey(),
8134
+ type: text("type").notNull(),
8135
+ source_store_id: text("source_store_id").notNull(),
8136
+ source_version: text("source_version").notNull(),
8137
+ source_path: text("source_path"),
8138
+ source_span_start: text("source_span_start"),
8139
+ source_span_end: text("source_span_end"),
8140
+ content: text("content").notNull(),
8141
+ confidence: real("confidence"),
8142
+ observed_at: text("observed_at"),
8143
+ created_at: text("created_at").notNull(),
8144
+ derived_from: text("derived_from")
8145
+ }, (table) => ({
8146
+ type_idx: index("idx_obs_type").on(table.type),
8147
+ source_idx: index("idx_obs_source").on(table.source_store_id, table.source_version),
8148
+ type_observed_idx: index("idx_obs_type_observed").on(table.type, table.observed_at),
8149
+ type_source_idx: index("idx_obs_type_source").on(table.type, table.source_store_id)
8150
+ }));
8151
+ // ../../node_modules/@f0rbit/corpus/dist/backend/memory.js
8152
+ var CORPUS_DEV = (() => {
8153
+ try {
8154
+ return typeof process !== "undefined" && process.env?.CORPUS_DEV === "1";
8155
+ } catch {
8156
+ return false;
8157
+ }
8158
+ })();
8159
+ // ../../node_modules/@f0rbit/corpus/dist/schema.js
8160
+ var corpus_snapshots = sqliteTable("corpus_snapshots", {
8161
+ store_id: text("store_id").notNull(),
8162
+ version: text("version").notNull(),
8163
+ parents: text("parents").notNull(),
8164
+ created_at: text("created_at").notNull(),
8165
+ invoked_at: text("invoked_at"),
8166
+ content_hash: text("content_hash").notNull(),
8167
+ content_type: text("content_type").notNull(),
8168
+ size_bytes: integer("size_bytes").notNull(),
8169
+ data_key: text("data_key").notNull(),
8170
+ tags: text("tags")
8171
+ }, (table) => ({
8172
+ pk: primaryKey({ columns: [table.store_id, table.version] }),
8173
+ created_idx: index("idx_store_created").on(table.store_id, table.created_at),
8174
+ hash_idx: index("idx_content_hash").on(table.store_id, table.content_hash),
8175
+ data_key_idx: index("idx_data_key").on(table.data_key)
8176
+ }));
8002
8177
  // ../../node_modules/zod/v3/helpers/util.js
8003
8178
  var util;
8004
8179
  (function(util) {
@@ -11860,6 +12035,41 @@ var coerce = {
11860
12035
  date: (arg) => ZodDate.create({ ...arg, coerce: true })
11861
12036
  };
11862
12037
  var NEVER = INVALID;
12038
+ // ../../node_modules/@f0rbit/corpus/dist/version-set.js
12039
+ var VersionSetManifestSchema = objectType({
12040
+ package: stringType(),
12041
+ git_sha: stringType().length(40),
12042
+ created_at: stringType().datetime(),
12043
+ builds: objectType({
12044
+ worker: objectType({
12045
+ artifact_ref: stringType(),
12046
+ size_bytes: numberType().int(),
12047
+ compatibility_date: stringType()
12048
+ }),
12049
+ assets: objectType({
12050
+ artifact_ref: stringType().optional(),
12051
+ version_affinity: enumType(["pinned", "none"]).default("pinned")
12052
+ }).optional()
12053
+ }),
12054
+ migrations: objectType({
12055
+ d1_plan_ref: stringType().optional(),
12056
+ do_migrations: arrayType(objectType({
12057
+ class_name: stringType(),
12058
+ tag: stringType(),
12059
+ kind: enumType([
12060
+ "new_sqlite_classes",
12061
+ "new_classes",
12062
+ "renamed_classes",
12063
+ "deleted_classes",
12064
+ "transferred_classes"
12065
+ ])
12066
+ })).default([])
12067
+ }),
12068
+ env_manifest_ref: stringType(),
12069
+ infra_plan_ref: stringType(),
12070
+ grants_ref: stringType().optional(),
12071
+ template_ref: stringType().optional()
12072
+ });
11863
12073
  // ../../node_modules/drizzle-zod/index.mjs
11864
12074
  var CONSTANTS = {
11865
12075
  INT8_MIN: -128,
@@ -12111,7 +12321,7 @@ var createSelectSchema = (entity, refine) => {
12111
12321
  return handleColumns(columns, refine ?? {}, selectConditions);
12112
12322
  };
12113
12323
 
12114
- // ../api/dist/chunk-DHYAC4LG.js
12324
+ // ../api/dist/chunk-3HPT255B.js
12115
12325
  var timestamps = () => ({
12116
12326
  created_at: text("created_at").notNull().default(sql`(CURRENT_TIMESTAMP)`),
12117
12327
  updated_at: text("updated_at").notNull().default(sql`(CURRENT_TIMESTAMP)`)
@@ -12215,14 +12425,14 @@ var action = sqliteTable("action", {
12215
12425
  ...owned_entity("action"),
12216
12426
  type: text("type", { enum: ACTIONS }).notNull(),
12217
12427
  description: text("description").notNull(),
12218
- data: text("data", { mode: "json" }),
12428
+ data: text("data", { mode: "json" }).$type(),
12219
12429
  channel: text("channel", { enum: ["user", "api"] }).notNull().default("user")
12220
12430
  });
12221
12431
  var tracker_result = sqliteTable("tracker_result", {
12222
12432
  id: integer("id").primaryKey({ autoIncrement: true }),
12223
12433
  project_id: text("project_id").notNull().references(() => project.id),
12224
12434
  created_at: text("created_at").notNull().default(sql`(CURRENT_TIMESTAMP)`),
12225
- data: text("data", { mode: "json" }).notNull(),
12435
+ data: text("data", { mode: "json" }).$type().notNull(),
12226
12436
  accepted: integer("accepted", { mode: "boolean" }).notNull().default(false)
12227
12437
  });
12228
12438
  var todo_updates = sqliteTable("todo_updates", {
@@ -12231,7 +12441,7 @@ var todo_updates = sqliteTable("todo_updates", {
12231
12441
  created_at: text("created_at").notNull().default(sql`(CURRENT_TIMESTAMP)`),
12232
12442
  old_id: integer("old_id").references(() => tracker_result.id),
12233
12443
  new_id: integer("new_id").notNull().references(() => tracker_result.id),
12234
- data: text("data", { mode: "json" }).notNull(),
12444
+ data: text("data", { mode: "json" }).$type().notNull(),
12235
12445
  status: text("status", { enum: ["PENDING", "ACCEPTED", "REJECTED", "IGNORED"] }).notNull().default("PENDING"),
12236
12446
  branch: text("branch"),
12237
12447
  commit_sha: text("commit_sha"),
@@ -12293,7 +12503,7 @@ var task_link = sqliteTable("task_link", {
12293
12503
  src_id: text("src_id").notNull().references(() => task.id),
12294
12504
  dst_id: text("dst_id").references(() => task.id),
12295
12505
  kind: text("kind", { enum: TASK_LINK_KINDS }).notNull(),
12296
- ref: text("ref", { mode: "json" }),
12506
+ ref: text("ref", { mode: "json" }).$type(),
12297
12507
  note: text("note")
12298
12508
  }, (table) => [
12299
12509
  unique("task_link_unique").on(table.src_id, table.dst_id, table.kind),
@@ -12310,7 +12520,7 @@ var task_rollup = sqliteTable("task_rollup", {
12310
12520
  var apply_log = sqliteTable("apply_log", {
12311
12521
  idempotency_key: text("idempotency_key").primaryKey(),
12312
12522
  owner_id: text("owner_id").notNull().references(() => user.id),
12313
- response: text("response", { mode: "json" }).notNull(),
12523
+ response: text("response", { mode: "json" }).$type().notNull(),
12314
12524
  created_at: text("created_at").notNull().default(sql`(CURRENT_TIMESTAMP)`)
12315
12525
  });
12316
12526
  var TASK_EVENT_KINDS = [
@@ -12340,7 +12550,7 @@ var task_event = sqliteTable("task_event", {
12340
12550
  subject_id: text("subject_id").notNull(),
12341
12551
  project_id: text("project_id"),
12342
12552
  actor: text("actor", { enum: TASK_EVENT_ACTORS }).notNull(),
12343
- payload: text("payload", { mode: "json" }).notNull(),
12553
+ payload: text("payload", { mode: "json" }).$type().notNull(),
12344
12554
  occurred_at: text("occurred_at").notNull().default(sql`(CURRENT_TIMESTAMP)`),
12345
12555
  dispatch_status: text("dispatch_status", { enum: TASK_EVENT_DISPATCH_STATUSES }).notNull().default("pending"),
12346
12556
  dispatched_at: text("dispatched_at")
@@ -12352,8 +12562,8 @@ var hook = sqliteTable("hook", {
12352
12562
  ...entity("hook"),
12353
12563
  project_id: text("project_id").notNull().references(() => project.id),
12354
12564
  enabled: integer("enabled", { mode: "boolean" }).notNull().default(true),
12355
- trigger: text("trigger", { mode: "json" }).notNull(),
12356
- action: text("action", { mode: "json" }).notNull()
12565
+ trigger: text("trigger", { mode: "json" }).$type().notNull(),
12566
+ action: text("action", { mode: "json" }).$type().notNull()
12357
12567
  }, (table) => [index("hook_project_id_idx").on(table.project_id)]);
12358
12568
  var HOOK_DELIVERY_STATUSES = ["pending", "delivered", "failed_transient", "failed_permanent"];
12359
12569
  var hook_delivery = sqliteTable("hook_delivery", {
@@ -12438,7 +12648,7 @@ var codebase_tasks = sqliteTable("codebase_tasks", {
12438
12648
  text: text("text"),
12439
12649
  file: text("file"),
12440
12650
  line: integer("line"),
12441
- context: text("context", { mode: "json" }),
12651
+ context: text("context", { mode: "json" }).$type(),
12442
12652
  recent_scan_id: integer("recent_scan_id").references(() => tracker_result.id)
12443
12653
  });
12444
12654
  var tag = sqliteTable("tag", {
@@ -12489,10 +12699,10 @@ var pipeline_package = sqliteTable("pipeline_package", {
12489
12699
  name: text("name").notNull(),
12490
12700
  repo_url: text("repo_url"),
12491
12701
  default_template_ref: text("default_template_ref"),
12492
- script_name_overrides: text("script_name_overrides", { mode: "json" }),
12702
+ script_name_overrides: text("script_name_overrides", { mode: "json" }).$type(),
12493
12703
  project_id: text("project_id").references(() => project.id),
12494
12704
  deploy_mode: text("deploy_mode", { enum: DEPLOY_MODES }).notNull().default("orchestrated"),
12495
- external_target: text("external_target", { mode: "json" })
12705
+ external_target: text("external_target", { mode: "json" }).$type()
12496
12706
  });
12497
12707
  var pipeline_run = sqliteTable("pipeline_run", {
12498
12708
  ...entity("pipeline-run"),
@@ -12503,8 +12713,8 @@ var pipeline_run = sqliteTable("pipeline_run", {
12503
12713
  kind: text("kind", { enum: RUN_KINDS }).notNull().default("deploy"),
12504
12714
  status: text("status", { enum: RUN_STATUSES }).notNull().default("queued"),
12505
12715
  current_stage: text("current_stage"),
12506
- resolved_rollout: text("resolved_rollout", { mode: "json" }).notNull(),
12507
- resolved_gates: text("resolved_gates", { mode: "json" }).notNull(),
12716
+ resolved_rollout: text("resolved_rollout", { mode: "json" }).$type().notNull(),
12717
+ resolved_gates: text("resolved_gates", { mode: "json" }).$type().notNull(),
12508
12718
  forced_atomic_reason: text("forced_atomic_reason", { enum: FORCED_ATOMIC_REASONS }),
12509
12719
  started_at: text("started_at"),
12510
12720
  finished_at: text("finished_at"),
@@ -12515,7 +12725,7 @@ var pipeline_stage_event = sqliteTable("pipeline_stage_event", {
12515
12725
  run_id: text("run_id").notNull().references(() => pipeline_run.id),
12516
12726
  stage_name: text("stage_name").notNull(),
12517
12727
  kind: text("kind", { enum: STAGE_EVENT_KINDS }).notNull(),
12518
- payload: text("payload", { mode: "json" }),
12728
+ payload: text("payload", { mode: "json" }).$type(),
12519
12729
  ts: text("ts").notNull().default(sql`(CURRENT_TIMESTAMP)`),
12520
12730
  idempotency_hash: text("idempotency_hash")
12521
12731
  }, (table) => [
@@ -12554,8 +12764,8 @@ var pipeline_analysis_template = sqliteTable("pipeline_analysis_template", {
12554
12764
  ...entity("pipeline-analysis-template"),
12555
12765
  owner_id: text("owner_id").notNull().references(() => user.id),
12556
12766
  name: text("name").notNull(),
12557
- query_dsl: text("query_dsl", { mode: "json" }).notNull(),
12558
- threshold_dsl: text("threshold_dsl", { mode: "json" }).notNull(),
12767
+ query_dsl: text("query_dsl", { mode: "json" }).$type().notNull(),
12768
+ threshold_dsl: text("threshold_dsl", { mode: "json" }).$type().notNull(),
12559
12769
  window_ms: integer("window_ms").notNull().default(600000)
12560
12770
  });
12561
12771
  var PIPELINE_OIDC_PROVIDERS = ["github"];
@@ -13221,210 +13431,64 @@ var project_graph_response = objectType({
13221
13431
  });
13222
13432
  var project_view_pin = objectType({ x: numberType(), y: numberType() });
13223
13433
  var project_view_layout = objectType({ pins: recordType(stringType(), project_view_pin) });
13224
-
13225
- // ../../node_modules/@f0rbit/corpus/dist/types.js
13226
- var ok = (value) => ({ ok: true, value });
13227
- var err = (error) => ({ ok: false, error });
13228
- function define_store(id, codec, opts) {
13229
- if (typeof opts === "string") {
13230
- return { id, codec, description: opts };
13231
- }
13232
- return { id, codec, description: opts?.description, data_key_fn: opts?.data_key_fn };
13233
- }
13234
-
13235
- // ../../node_modules/@f0rbit/corpus/dist/utils.js
13236
- function json_codec(schema) {
13237
- return {
13238
- content_type: "application/json",
13239
- encode: async (value) => new TextEncoder().encode(JSON.stringify(value)),
13240
- decode: async (bytes) => schema.parse(JSON.parse(new TextDecoder().decode(bytes)))
13241
- };
13242
- }
13243
- function create_filter_pipeline(config) {
13244
- return (items, opts) => {
13245
- let filtered = items;
13246
- for (const { key, predicate } of config.filters) {
13247
- const optValue = opts[key];
13248
- if (optValue !== undefined && optValue !== null) {
13249
- filtered = filtered.filter((item) => predicate(item, optValue));
13250
- }
13251
- }
13252
- filtered.sort(config.sort);
13253
- if (opts.limit) {
13254
- filtered = filtered.slice(0, opts.limit);
13255
- }
13256
- return filtered;
13257
- };
13258
- }
13259
- var snapshot_filter_pipeline = create_filter_pipeline({
13260
- filters: [
13261
- { key: "before", predicate: (m, before) => m.created_at < before },
13262
- { key: "after", predicate: (m, after) => m.created_at > after },
13263
- { key: "tags", predicate: (m, tags) => tags.length === 0 || tags.every((tag) => m.tags?.includes(tag)) }
13264
- ],
13265
- sort: (a, b) => b.created_at.getTime() - a.created_at.getTime()
13434
+ var action_data = objectType({
13435
+ task_id: stringType().optional(),
13436
+ project_id: stringType().optional(),
13437
+ milestone_id: stringType().optional(),
13438
+ goal_id: stringType().optional(),
13439
+ title: stringType().optional(),
13440
+ name: stringType().nullish(),
13441
+ href: stringType().nullish(),
13442
+ message: stringType().nullish(),
13443
+ status: stringType().nullish(),
13444
+ from: stringType().nullish(),
13445
+ to: stringType().nullish(),
13446
+ override: booleanType().optional(),
13447
+ reason: stringType().nullish()
13448
+ });
13449
+ var scan_diff_info = objectType({
13450
+ text: stringType(),
13451
+ line: numberType(),
13452
+ file: stringType(),
13453
+ context: arrayType(stringType()).optional()
13454
+ });
13455
+ var scan_diff_result = objectType({
13456
+ id: stringType(),
13457
+ tag: stringType(),
13458
+ type: enumType(["SAME", "MOVE", "UPDATE", "NEW", "DELETE"]),
13459
+ data: objectType({ old: scan_diff_info.nullable(), new: scan_diff_info.nullable() }),
13460
+ proposal: scan_diff_proposal.nullable().optional()
13266
13461
  });
13267
-
13268
- // ../../node_modules/@f0rbit/corpus/dist/result.js
13269
- var try_catch_async = async (fn, on_error) => {
13270
- try {
13271
- return ok(await fn());
13272
- } catch (e) {
13273
- return err(on_error(e));
13274
- }
13275
- };
13276
- var fetch_result = async (input, init, on_error, parse_body = (r) => r.json()) => {
13277
- try {
13278
- const response = await fetch(input, init);
13279
- if (!response.ok) {
13280
- return err(on_error({ type: "http", status: response.status, status_text: response.statusText }));
13281
- }
13282
- return ok(await parse_body(response));
13283
- } catch (e) {
13284
- return err(on_error({ type: "network", cause: e }));
13285
- }
13462
+ var scan_diff_results = arrayType(scan_diff_result);
13463
+ var scan_parsed_task = objectType({
13464
+ id: stringType(),
13465
+ file: stringType(),
13466
+ line: numberType(),
13467
+ tag: stringType(),
13468
+ text: stringType(),
13469
+ context: arrayType(stringType())
13470
+ });
13471
+ var scan_parsed_tasks = arrayType(scan_parsed_task);
13472
+ var decode_legacy_json_string = (value) => {
13473
+ if (typeof value !== "string")
13474
+ return value;
13475
+ const decoded = try_catch(() => JSON.parse(value), (e) => e);
13476
+ return decoded.ok ? decoded.value : value;
13286
13477
  };
13287
- var create_pipe = (promised) => ({
13288
- map: (fn) => create_pipe(promised.then((r) => {
13289
- if (r.ok)
13290
- return ok(fn(r.value));
13291
- return err(r.error);
13292
- })),
13293
- map_async: (fn) => create_pipe(promised.then(async (r) => {
13294
- if (r.ok)
13295
- return ok(await fn(r.value));
13296
- return err(r.error);
13297
- })),
13298
- flat_map: (fn) => create_pipe(promised.then((r) => {
13299
- if (r.ok)
13300
- return fn(r.value);
13301
- return err(r.error);
13302
- })),
13303
- map_err: (fn) => create_pipe(promised.then((r) => {
13304
- if (r.ok)
13305
- return ok(r.value);
13306
- return err(fn(r.error));
13307
- })),
13308
- tap: (fn) => create_pipe(promised.then(async (r) => {
13309
- if (r.ok)
13310
- await fn(r.value);
13311
- return r;
13312
- })),
13313
- tap_err: (fn) => create_pipe(promised.then(async (r) => {
13314
- if (!r.ok)
13315
- await fn(r.error);
13316
- return r;
13317
- })),
13318
- unwrap_or: (default_value) => promised.then((r) => r.ok ? r.value : default_value),
13319
- result: () => promised
13320
- });
13321
- var pipe = (initial) => create_pipe(Promise.resolve(initial));
13322
- pipe.ok = (value) => pipe(ok(value));
13323
- pipe.err = (error) => pipe(err(error));
13324
- pipe.try = (fn, on_error) => pipe(try_catch_async(fn, on_error));
13325
- pipe.fetch = (input, init, on_error, parse_body) => pipe(fetch_result(input, init, on_error, parse_body));
13478
+ var scan_diff_results_stored = preprocessType(decode_legacy_json_string, scan_diff_results);
13479
+ var scan_parsed_tasks_stored = preprocessType(decode_legacy_json_string, scan_parsed_tasks);
13480
+ var scan_context = arrayType(stringType());
13481
+ var scan_context_stored = preprocessType(decode_legacy_json_string, scan_context.nullable());
13482
+ var apply_op_result = objectType({
13483
+ op: enumType(["create", "update", "reparent", "link", "unlink", "claim", "complete"]),
13484
+ id: stringType()
13485
+ });
13486
+ var apply_log_response = objectType({ idempotency_key: stringType(), results: arrayType(apply_op_result) });
13487
+ var stage_event_payload = recordType(stringType(), unknownType());
13488
+ var analysis_query_dsl = unknownType();
13489
+ var analysis_threshold_dsl = stringType();
13490
+ var script_name_overrides = recordType(stringType(), stringType());
13326
13491
 
13327
- // ../../node_modules/@f0rbit/corpus/dist/observations/storage.js
13328
- var observation_filter_pipeline = create_filter_pipeline({
13329
- filters: [
13330
- {
13331
- key: "type",
13332
- predicate: (r, type) => {
13333
- const types = Array.isArray(type) ? type : [type];
13334
- return types.includes(r.type);
13335
- }
13336
- },
13337
- { key: "source_store_id", predicate: (r, id) => r.source_store_id === id },
13338
- { key: "source_version", predicate: (r, version) => r.source_version === version },
13339
- { key: "source_prefix", predicate: (r, prefix) => r.source_version.startsWith(prefix) },
13340
- { key: "created_after", predicate: (r, after) => r.created_at > after },
13341
- { key: "created_before", predicate: (r, before) => r.created_at < before },
13342
- { key: "observed_after", predicate: (r, after) => r.observed_at !== null && r.observed_at > after },
13343
- { key: "observed_before", predicate: (r, before) => r.observed_at !== null && r.observed_at < before }
13344
- ],
13345
- sort: (a, b) => b.created_at.localeCompare(a.created_at)
13346
- });
13347
- // ../../node_modules/@f0rbit/corpus/dist/observations/schema.js
13348
- var corpus_observations = sqliteTable("corpus_observations", {
13349
- id: text("id").primaryKey(),
13350
- type: text("type").notNull(),
13351
- source_store_id: text("source_store_id").notNull(),
13352
- source_version: text("source_version").notNull(),
13353
- source_path: text("source_path"),
13354
- source_span_start: text("source_span_start"),
13355
- source_span_end: text("source_span_end"),
13356
- content: text("content").notNull(),
13357
- confidence: real("confidence"),
13358
- observed_at: text("observed_at"),
13359
- created_at: text("created_at").notNull(),
13360
- derived_from: text("derived_from")
13361
- }, (table) => ({
13362
- type_idx: index("idx_obs_type").on(table.type),
13363
- source_idx: index("idx_obs_source").on(table.source_store_id, table.source_version),
13364
- type_observed_idx: index("idx_obs_type_observed").on(table.type, table.observed_at),
13365
- type_source_idx: index("idx_obs_type_source").on(table.type, table.source_store_id)
13366
- }));
13367
- // ../../node_modules/@f0rbit/corpus/dist/backend/memory.js
13368
- var CORPUS_DEV = (() => {
13369
- try {
13370
- return typeof process !== "undefined" && process.env?.CORPUS_DEV === "1";
13371
- } catch {
13372
- return false;
13373
- }
13374
- })();
13375
- // ../../node_modules/@f0rbit/corpus/dist/schema.js
13376
- var corpus_snapshots = sqliteTable("corpus_snapshots", {
13377
- store_id: text("store_id").notNull(),
13378
- version: text("version").notNull(),
13379
- parents: text("parents").notNull(),
13380
- created_at: text("created_at").notNull(),
13381
- invoked_at: text("invoked_at"),
13382
- content_hash: text("content_hash").notNull(),
13383
- content_type: text("content_type").notNull(),
13384
- size_bytes: integer("size_bytes").notNull(),
13385
- data_key: text("data_key").notNull(),
13386
- tags: text("tags")
13387
- }, (table) => ({
13388
- pk: primaryKey({ columns: [table.store_id, table.version] }),
13389
- created_idx: index("idx_store_created").on(table.store_id, table.created_at),
13390
- hash_idx: index("idx_content_hash").on(table.store_id, table.content_hash),
13391
- data_key_idx: index("idx_data_key").on(table.data_key)
13392
- }));
13393
- // ../../node_modules/@f0rbit/corpus/dist/version-set.js
13394
- var VersionSetManifestSchema = objectType({
13395
- package: stringType(),
13396
- git_sha: stringType().length(40),
13397
- created_at: stringType().datetime(),
13398
- builds: objectType({
13399
- worker: objectType({
13400
- artifact_ref: stringType(),
13401
- size_bytes: numberType().int(),
13402
- compatibility_date: stringType()
13403
- }),
13404
- assets: objectType({
13405
- artifact_ref: stringType().optional(),
13406
- version_affinity: enumType(["pinned", "none"]).default("pinned")
13407
- }).optional()
13408
- }),
13409
- migrations: objectType({
13410
- d1_plan_ref: stringType().optional(),
13411
- do_migrations: arrayType(objectType({
13412
- class_name: stringType(),
13413
- tag: stringType(),
13414
- kind: enumType([
13415
- "new_sqlite_classes",
13416
- "new_classes",
13417
- "renamed_classes",
13418
- "deleted_classes",
13419
- "transferred_classes"
13420
- ])
13421
- })).default([])
13422
- }),
13423
- env_manifest_ref: stringType(),
13424
- infra_plan_ref: stringType(),
13425
- grants_ref: stringType().optional(),
13426
- template_ref: stringType().optional()
13427
- });
13428
13492
  // ../api/dist/chunk-V6CM3V4I.js
13429
13493
  var PostContentSchema = objectType({
13430
13494
  title: stringType().min(1),
@@ -13613,6 +13677,149 @@ var IntegrationUpsertSchema = objectType({
13613
13677
  });
13614
13678
 
13615
13679
  // ../api/dist/index.js
13680
+ var wire_error = objectType({
13681
+ ok: literalType(false),
13682
+ error: objectType({
13683
+ code: stringType().min(1),
13684
+ message: stringType().optional()
13685
+ }).passthrough()
13686
+ });
13687
+ var external_event_payload = objectType({ sha: stringType().min(1) }).passthrough();
13688
+ var external_event_request = objectType({
13689
+ ...webhook_event_body.shape,
13690
+ payload: external_event_payload
13691
+ });
13692
+ var noop_tick = stringType().regex(/^noop:[a-z_]+$/);
13693
+ var failed_tick = stringType().regex(/^failed:.+/);
13694
+ var ingest_tick = unionType([
13695
+ literalType("applied"),
13696
+ noop_tick,
13697
+ failed_tick,
13698
+ literalType("skipped:informational"),
13699
+ literalType("skipped:duplicated")
13700
+ ]);
13701
+ var external_event_response = objectType({
13702
+ ok: literalType(true),
13703
+ value: objectType({
13704
+ event_id: stringType().min(1),
13705
+ duplicated: booleanType(),
13706
+ tick: ingest_tick
13707
+ })
13708
+ });
13709
+ var auth_channel_wire = unionType([literalType("user"), literalType("api")]);
13710
+ var wire_entity = {
13711
+ id: stringType().min(1),
13712
+ created_at: stringType(),
13713
+ updated_at: stringType(),
13714
+ deleted: booleanType(),
13715
+ created_by: auth_channel_wire,
13716
+ modified_by: auth_channel_wire,
13717
+ protected: booleanType()
13718
+ };
13719
+ var pipeline_run_wire = objectType({
13720
+ ...wire_entity,
13721
+ package_id: stringType().min(1),
13722
+ version_set_id: stringType().nullable(),
13723
+ commit_sha: stringType().nullable(),
13724
+ shape: rollout_shape,
13725
+ kind: run_kind,
13726
+ status: run_status,
13727
+ current_stage: stringType().nullable(),
13728
+ resolved_rollout,
13729
+ resolved_gates,
13730
+ forced_atomic_reason: forced_atomic_reason.nullable(),
13731
+ started_at: stringType().nullable(),
13732
+ finished_at: stringType().nullable(),
13733
+ error: stringType().nullable()
13734
+ });
13735
+ var pipeline_stage_event_wire = objectType({
13736
+ id: stringType().min(1),
13737
+ run_id: stringType().min(1),
13738
+ stage_name: stringType(),
13739
+ kind: stage_event_kind,
13740
+ payload: stage_event_payload.nullable(),
13741
+ ts: stringType(),
13742
+ idempotency_hash: stringType().nullable()
13743
+ });
13744
+ var pipeline_grant_wire = objectType({
13745
+ ...wire_entity,
13746
+ package_id: stringType().min(1),
13747
+ stage_name: stringType(),
13748
+ scope: stringType(),
13749
+ granted_by: stringType().nullable(),
13750
+ granted_at: stringType().nullable(),
13751
+ auto_approved: booleanType()
13752
+ });
13753
+ var pipeline_package_wire = objectType({
13754
+ ...wire_entity,
13755
+ owner_id: stringType().min(1),
13756
+ name: stringType(),
13757
+ repo_url: stringType().nullable(),
13758
+ default_template_ref: stringType().nullable(),
13759
+ script_name_overrides: script_name_overrides.nullable(),
13760
+ project_id: stringType().nullable(),
13761
+ deploy_mode,
13762
+ external_target: external_target.nullable()
13763
+ });
13764
+ var pipeline_run_list_wire = arrayType(pipeline_run_wire);
13765
+ var pipeline_stage_event_list_wire = arrayType(pipeline_stage_event_wire);
13766
+ var pipeline_grant_list_wire = arrayType(pipeline_grant_wire);
13767
+ var pipeline_package_list_wire = arrayType(pipeline_package_wire);
13768
+ var pipeline_dispatch_entry_wire = objectType({
13769
+ stage_name: stringType(),
13770
+ commit_sha: stringType(),
13771
+ status: dispatch_status,
13772
+ error: stringType().nullable(),
13773
+ requested_by: stringType().nullable(),
13774
+ created_at: stringType(),
13775
+ updated_at: stringType()
13776
+ });
13777
+ var pipeline_dispatch_ledger_wire = objectType({
13778
+ run_id: stringType().min(1),
13779
+ run_status,
13780
+ commit_sha: stringType().nullable(),
13781
+ dispatches: arrayType(pipeline_dispatch_entry_wire)
13782
+ });
13783
+ var pipeline_ingest_response_wire = objectType({
13784
+ event_id: stringType().min(1),
13785
+ duplicated: booleanType(),
13786
+ tick: ingest_tick
13787
+ });
13788
+ var pipeline_run_start_wire = objectType({
13789
+ run_id: stringType().min(1),
13790
+ status: run_status
13791
+ });
13792
+ var pipelines_deleted_wire = objectType({ deleted: literalType(true) });
13793
+ var pipelines_deny_wire = objectType({ success: literalType(true) });
13794
+ var pipeline_analysis_template_wire = objectType({
13795
+ ...wire_entity,
13796
+ owner_id: stringType().min(1),
13797
+ name: stringType(),
13798
+ query_dsl: unknownType(),
13799
+ threshold_dsl: stringType(),
13800
+ window_ms: numberType().int().positive()
13801
+ }).transform((template) => ({ ...template, query_dsl: template.query_dsl }));
13802
+ var pipeline_oidc_trust_wire = objectType({
13803
+ ...wire_entity,
13804
+ owner_id: stringType().min(1),
13805
+ provider: literalType("github"),
13806
+ github_owner: stringType(),
13807
+ repo_pattern: stringType(),
13808
+ allowed_refs: arrayType(stringType()),
13809
+ allowed_environments: arrayType(stringType()),
13810
+ expected_audience: stringType(),
13811
+ allowed_actions: arrayType(stringType()),
13812
+ session_ttl_seconds: numberType().int().positive(),
13813
+ last_used_at: stringType().nullable(),
13814
+ repository_id: stringType().nullable(),
13815
+ repository_owner_id: stringType().nullable()
13816
+ });
13817
+ var pipelines_dashboard_wire = objectType({
13818
+ ...dashboard_response.shape,
13819
+ pulse: recordType(unknownType()).nullable().catch(null)
13820
+ });
13821
+ var pipeline_analysis_template_list_wire = arrayType(pipeline_analysis_template_wire);
13822
+ var pipeline_oidc_trust_list_wire = arrayType(pipeline_oidc_trust_wire);
13616
13823
  var PulseEventRowSchema = objectType({
13617
13824
  id: numberType(),
13618
13825
  project_id: stringType(),
@@ -13701,6 +13908,19 @@ var ValidationError = class extends ApiError {
13701
13908
  super(message, { code: "VALIDATION_ERROR" });
13702
13909
  }
13703
13910
  };
13911
+ var zod_issue = custom((value) => typeof value === "object" && value !== null && ("path" in value) && Array.isArray(value.path));
13912
+ var parsed_error_body = objectType({
13913
+ error: unionType([stringType(), objectType({ name: stringType().optional(), issues: arrayType(zod_issue).optional() })]).optional(),
13914
+ issues: arrayType(zod_issue).optional()
13915
+ });
13916
+ var parse_error_body = (raw) => {
13917
+ const parsed = parsed_error_body.safeParse(raw);
13918
+ return parsed.success ? parsed.data : null;
13919
+ };
13920
+ var parse_json_error_body = (text2) => {
13921
+ const raw = try_catch(() => JSON.parse(text2), (e) => e);
13922
+ return raw.ok ? parse_error_body(raw.value) : null;
13923
+ };
13704
13924
  var HTTP_STATUS = {
13705
13925
  OK: 200,
13706
13926
  CREATED: 201,
@@ -13724,11 +13944,7 @@ function handleHttpResponse(response) {
13724
13944
  async function handleResponseError(response) {
13725
13945
  const errorText = await response.text();
13726
13946
  const errorMessage = errorText || "Request failed";
13727
- let parsedError = null;
13728
- try {
13729
- const raw = JSON.parse(errorText);
13730
- parsedError = raw;
13731
- } catch {}
13947
+ const parsedError = parse_json_error_body(errorText);
13732
13948
  const structuredError = typeof parsedError?.error === "object" ? parsedError.error : undefined;
13733
13949
  if (response.status === HTTP_STATUS.BAD_REQUEST && structuredError?.name === "ZodError") {
13734
13950
  const zodErrorDetails = structuredError.issues ? JSON.stringify(structuredError) : errorMessage;
@@ -13822,6 +14038,22 @@ var ApiClient = class {
13822
14038
  generateRequestId() {
13823
14039
  return `${String(Date.now())}-${Math.random().toString(36).substring(2, 11)}`;
13824
14040
  }
14041
+ async read_body(response) {
14042
+ if (response.status === HTTP_STATUS.NO_CONTENT)
14043
+ return;
14044
+ const text2 = await response.text();
14045
+ if (!text2 || text2.trim() === "" || text2.trim() === "null")
14046
+ return;
14047
+ const parsed = try_catch(() => JSON.parse(text2), (error) => error);
14048
+ if (parsed.ok)
14049
+ return parsed.value;
14050
+ if (this.debug) {
14051
+ console.log(`[DEBUG][${this.category}] response body is not JSON, returning raw text`, {
14052
+ error: parsed.error instanceof Error ? parsed.error.message : String(parsed.error)
14053
+ });
14054
+ }
14055
+ return text2;
14056
+ }
13825
14057
  async request(path, options = {}) {
13826
14058
  const { method = "GET", headers = {}, body, query } = options;
13827
14059
  const url = this.buildUrl(path, query);
@@ -13887,22 +14119,7 @@ var ApiClient = class {
13887
14119
  }
13888
14120
  }
13889
14121
  this.request_history.add(historyEntry);
13890
- let result;
13891
- if (response.status === HTTP_STATUS.NO_CONTENT) {
13892
- result = undefined;
13893
- } else {
13894
- const text2 = await response.text();
13895
- if (!text2 || text2.trim() === "" || text2.trim() === "null") {
13896
- result = undefined;
13897
- } else {
13898
- try {
13899
- const raw = JSON.parse(text2);
13900
- result = raw;
13901
- } catch {
13902
- result = text2;
13903
- }
13904
- }
13905
- }
14122
+ const result = await this.read_body(response);
13906
14123
  if (this.debug) {
13907
14124
  console.log(`[INFO][${this.category}] ${method} ${path} [${requestId}] completed`, {
13908
14125
  status: response.status,
@@ -13968,16 +14185,18 @@ var ApiClient = class {
13968
14185
  return headers;
13969
14186
  }
13970
14187
  };
13971
- var string_field = (value, key) => {
13972
- if (typeof value !== "object" || value === null || !(key in value))
14188
+ var field_of = (value, key) => {
14189
+ if (typeof value !== "object" || value === null)
13973
14190
  return;
13974
- const field = value[key];
14191
+ const field = Reflect.get(value, key);
14192
+ return field;
14193
+ };
14194
+ var string_field = (value, key) => {
14195
+ const field = field_of(value, key);
13975
14196
  return typeof field === "string" ? field : undefined;
13976
14197
  };
13977
14198
  var number_field = (value, key) => {
13978
- if (typeof value !== "object" || value === null || !(key in value))
13979
- return;
13980
- const field = value[key];
14199
+ const field = field_of(value, key);
13981
14200
  return typeof field === "number" ? field : undefined;
13982
14201
  };
13983
14202
  function wrap(fn) {
@@ -14062,7 +14281,7 @@ var ApiClient2 = class {
14062
14281
  body: idOrData
14063
14282
  });
14064
14283
  }
14065
- const id = idOrData;
14284
+ const id = typeof idOrData === "string" ? idOrData : idOrData.id ?? "";
14066
14285
  if (!changes) {
14067
14286
  throw new Error("Changes parameter required for update");
14068
14287
  }
@@ -14141,8 +14360,10 @@ var ApiClient2 = class {
14141
14360
  find: (id) => wrap(async () => {
14142
14361
  try {
14143
14362
  return await this.clients.milestones.get(`/milestones/${id}`);
14144
- } catch {
14145
- return null;
14363
+ } catch (error) {
14364
+ if (error instanceof ApiError && error.statusCode === HTTP_STATUS.NOT_FOUND)
14365
+ return null;
14366
+ throw error;
14146
14367
  }
14147
14368
  }),
14148
14369
  create: (data) => wrap(() => this.clients.milestones.post("/milestones", { body: data })),
@@ -14583,7 +14804,7 @@ var ApiClient2 = class {
14583
14804
  const query = { project_id: input.project_id };
14584
14805
  if (input.window_ms !== undefined)
14585
14806
  query.window_ms = String(input.window_ms);
14586
- return wrap(() => this.clients.pipelines.get("/pipelines/dashboard", { query }));
14807
+ return wrap(async () => pipelines_dashboard_wire.parse(await this.clients.pipelines.get("/pipelines/dashboard", { query })));
14587
14808
  }
14588
14809
  },
14589
14810
  list: (filter) => {
@@ -14594,69 +14815,76 @@ var ApiClient2 = class {
14594
14815
  query.status = filter.status;
14595
14816
  if (filter?.limit !== undefined)
14596
14817
  query.limit = String(filter.limit);
14597
- return wrap(() => this.clients.pipelines.get("/runs", Object.keys(query).length > 0 ? { query } : undefined));
14818
+ return wrap(async () => {
14819
+ const raw = await this.clients.pipelines.get("/runs", Object.keys(query).length > 0 ? { query } : undefined);
14820
+ return pipeline_run_list_wire.parse(raw);
14821
+ });
14598
14822
  },
14599
- get: (run_id) => wrap(() => this.clients.pipelines.get(`/runs/${run_id}`)),
14600
- create: (input) => wrap(() => this.clients.pipelines.post("/runs", {
14601
- body: input
14602
- })),
14823
+ get: (run_id) => wrap(async () => pipeline_run_wire.parse(await this.clients.pipelines.get(`/runs/${run_id}`))),
14824
+ create: (input) => wrap(async () => pipeline_run_start_wire.parse(await this.clients.pipelines.post("/runs", { body: input }))),
14603
14825
  approve: (run_id, input) => wrap(() => this.clients.pipelines.post(`/runs/${run_id}/approve`, {
14604
14826
  body: input
14605
14827
  })),
14606
14828
  cancel: (run_id) => wrap(() => this.clients.pipelines.post(`/runs/${run_id}/cancel`, { body: {} })),
14607
14829
  rollback: (run_id) => wrap(() => this.clients.pipelines.post(`/runs/${run_id}/rollback`, { body: {} })),
14608
14830
  redispatch: (run_id) => wrap(() => this.clients.pipelines.post(`/runs/${run_id}/redispatch`, { body: {} })),
14609
- dispatches: (run_id) => wrap(() => this.clients.pipelines.get(`/runs/${run_id}/dispatches`)),
14831
+ dispatches: (run_id) => wrap(async () => pipeline_dispatch_ledger_wire.parse(await this.clients.pipelines.get(`/runs/${run_id}/dispatches`))),
14610
14832
  events: {
14611
- ingest: (run_id, input) => wrap(() => this.clients.pipelines.post(`/runs/${run_id}/events`, {
14833
+ ingest: (run_id, input) => wrap(async () => pipeline_ingest_response_wire.parse(await this.clients.pipelines.post(`/runs/${run_id}/events`, {
14612
14834
  body: input
14613
- })),
14614
- list: (run_id) => wrap(() => this.clients.pipelines.get(`/runs/${run_id}/events`))
14835
+ }))),
14836
+ list: (run_id) => wrap(async () => pipeline_stage_event_list_wire.parse(await this.clients.pipelines.get(`/runs/${run_id}/events`)))
14615
14837
  },
14616
14838
  grants: {
14617
- list: (package_id) => wrap(() => this.clients.pipelines.get("/grants", {
14618
- query: package_id ? { package_id } : {}
14619
- })),
14620
- approve: (grant_id) => wrap(() => this.clients.pipelines.post(`/grants/${grant_id}/approve`, {
14839
+ list: (package_id) => wrap(async () => {
14840
+ const raw = await this.clients.pipelines.get("/grants", {
14841
+ query: package_id ? { package_id } : {}
14842
+ });
14843
+ return pipeline_grant_list_wire.parse(raw);
14844
+ }),
14845
+ approve: (grant_id) => wrap(async () => pipeline_grant_wire.parse(await this.clients.pipelines.post(`/grants/${grant_id}/approve`, {
14621
14846
  body: {}
14622
- })),
14623
- deny: (grant_id, reason) => wrap(() => this.clients.pipelines.post(`/grants/${grant_id}/deny`, {
14847
+ }))),
14848
+ deny: (grant_id, reason) => wrap(async () => pipelines_deny_wire.parse(await this.clients.pipelines.post(`/grants/${grant_id}/deny`, {
14624
14849
  body: reason !== undefined ? { reason } : {}
14625
- }))
14850
+ })))
14626
14851
  },
14627
14852
  packages: {
14628
14853
  list: (filter) => {
14629
14854
  const query = {};
14630
14855
  if (filter?.project_id !== undefined)
14631
14856
  query.project_id = filter.project_id;
14632
- return wrap(() => this.clients.pipelines.get("/packages", Object.keys(query).length > 0 ? { query } : undefined));
14857
+ return wrap(async () => {
14858
+ const raw = await this.clients.pipelines.get("/packages", Object.keys(query).length > 0 ? { query } : undefined);
14859
+ return pipeline_package_list_wire.parse(raw);
14860
+ });
14633
14861
  },
14634
- get: (package_id) => wrap(() => this.clients.pipelines.get(`/packages/${package_id}`)),
14635
- create: (input) => wrap(() => this.clients.pipelines.post("/packages", { body: input })),
14636
- update: (package_id, input) => wrap(() => this.clients.pipelines.patch(`/packages/${package_id}`, { body: input })),
14637
- delete: (package_id) => wrap(() => this.clients.pipelines.delete(`/packages/${package_id}`))
14862
+ get: (package_id) => wrap(async () => pipeline_package_wire.parse(await this.clients.pipelines.get(`/packages/${package_id}`))),
14863
+ create: (input) => wrap(async () => pipeline_package_wire.parse(await this.clients.pipelines.post("/packages", { body: input }))),
14864
+ update: (package_id, input) => wrap(async () => pipeline_package_wire.parse(await this.clients.pipelines.patch(`/packages/${package_id}`, { body: input }))),
14865
+ delete: (package_id) => wrap(async () => pipelines_deleted_wire.parse(await this.clients.pipelines.delete(`/packages/${package_id}`)))
14638
14866
  },
14639
14867
  analysis_templates: {
14640
- list: (input) => wrap(() => this.clients.pipelines.get("/analysis-templates", {
14868
+ list: (input) => wrap(async () => pipeline_analysis_template_list_wire.parse(await this.clients.pipelines.get("/analysis-templates", {
14641
14869
  query: { owner_id: input.owner_id }
14642
- })),
14643
- get: (id, input) => wrap(() => this.clients.pipelines.get(`/analysis-templates/${id}`, {
14870
+ }))),
14871
+ get: (id, input) => wrap(async () => pipeline_analysis_template_wire.parse(await this.clients.pipelines.get(`/analysis-templates/${id}`, {
14644
14872
  query: { owner_id: input.owner_id }
14645
- })),
14646
- create: (input) => wrap(() => this.clients.pipelines.post("/analysis-templates", { body: input })),
14647
- update: (id, input) => wrap(() => this.clients.pipelines.patch(`/analysis-templates/${id}`, { body: input })),
14648
- delete: (id, input) => wrap(() => this.clients.pipelines.delete(`/analysis-templates/${id}`, {
14873
+ }))),
14874
+ create: (input) => wrap(async () => pipeline_analysis_template_wire.parse(await this.clients.pipelines.post("/analysis-templates", { body: input }))),
14875
+ update: (id, input) => wrap(async () => pipeline_analysis_template_wire.parse(await this.clients.pipelines.patch(`/analysis-templates/${id}`, { body: input }))),
14876
+ delete: (id, input) => wrap(async () => pipelines_deleted_wire.parse(await this.clients.pipelines.delete(`/analysis-templates/${id}`, {
14649
14877
  query: { owner_id: input.owner_id }
14650
- }))
14878
+ })))
14651
14879
  },
14652
14880
  oidc_trust: {
14653
- list: (input) => wrap(() => this.clients.pipelines.get("/oidc-trust", { query: { owner_id: input.owner_id } })),
14654
- get: (id, input) => wrap(() => this.clients.pipelines.get(`/oidc-trust/${id}`, { query: { owner_id: input.owner_id } })),
14655
- create: (input) => wrap(() => this.clients.pipelines.post("/oidc-trust", { body: input })),
14656
- update: (id, input) => wrap(() => this.clients.pipelines.patch(`/oidc-trust/${id}`, { body: input })),
14657
- delete: (id, input) => wrap(() => this.clients.pipelines.delete(`/oidc-trust/${id}`, {
14881
+ list: (input) => wrap(async () => pipeline_oidc_trust_list_wire.parse(await this.clients.pipelines.get("/oidc-trust", { query: { owner_id: input.owner_id } }))),
14882
+ get: (id, input) => wrap(async () => pipeline_oidc_trust_wire.parse(await this.clients.pipelines.get(`/oidc-trust/${id}`, { query: { owner_id: input.owner_id } }))),
14883
+ create: (input) => wrap(async () => pipeline_oidc_trust_wire.parse(await this.clients.pipelines.post("/oidc-trust", { body: input }))),
14884
+ update: (id, input) => wrap(async () => pipeline_oidc_trust_wire.parse(await this.clients.pipelines.patch(`/oidc-trust/${id}`, { body: input }))),
14885
+ delete: (id, input) => wrap(async () => pipelines_deleted_wire.parse(await this.clients.pipelines.delete(`/oidc-trust/${id}`, {
14658
14886
  query: { owner_id: input.owner_id }
14659
- }))
14887
+ })))
14660
14888
  }
14661
14889
  };
14662
14890
  getApiKey() {
@@ -14711,7 +14939,7 @@ var blog_post_projects = sqliteTable("blog_post_projects", {
14711
14939
  }, (table) => [primaryKey({ columns: [table.post_id, table.project_id] })]);
14712
14940
  function unwrap2(result) {
14713
14941
  if (!result.ok)
14714
- throw new Error(result.error?.message ?? "Unknown error");
14942
+ throw new Error(result.error.message);
14715
14943
  return result.value;
14716
14944
  }
14717
14945
  var project_filters = objectType({
@@ -22842,12 +23070,16 @@ class StdioServerTransport {
22842
23070
  }
22843
23071
 
22844
23072
  // src/index.ts
23073
+ var is_json_schema_object = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
22845
23074
  function zodToMCPSchema(schema) {
22846
23075
  try {
22847
- const jsonSchema = zodToJsonSchema(schema, {
23076
+ const converted = zodToJsonSchema(schema, {
22848
23077
  target: "openApi3",
22849
23078
  $refStrategy: "none"
22850
23079
  });
23080
+ if (!is_json_schema_object(converted))
23081
+ throw new Error("zod-to-json-schema returned a non-object schema");
23082
+ const jsonSchema = converted;
22851
23083
  const { $schema: _, ...cleanSchema } = jsonSchema;
22852
23084
  if (jsonSchema.type === "object")
22853
23085
  return jsonSchema;
@@ -22858,7 +23090,8 @@ function zodToMCPSchema(schema) {
22858
23090
  },
22859
23091
  required: []
22860
23092
  };
22861
- } catch {
23093
+ } catch (error) {
23094
+ console.error("[mcp] tool json-schema conversion failed, using open schema:", error);
22862
23095
  return {
22863
23096
  type: "object",
22864
23097
  properties: {},
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@devpad/mcp",
3
- "version": "2.6.12",
3
+ "version": "2.6.14",
4
4
  "description": "MCP server for devpad - exposes devpad API functionality via Model Context Protocol",
5
5
  "keywords": [
6
6
  "ai-tools",
@@ -51,7 +51,7 @@
51
51
  "zod-to-json-schema": "^3.24.6"
52
52
  },
53
53
  "devDependencies": {
54
- "@devpad/api": "^2.6.12",
54
+ "@devpad/api": "^2.6.14",
55
55
  "@types/node": "^24.3.0",
56
56
  "typescript": "^5.0.0"
57
57
  },