@caelo-cms/provisioning 0.10.67 → 0.10.68

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/agent-db.js CHANGED
@@ -14,6 +14,132 @@ var __export = (target, all) => {
14
14
  });
15
15
  };
16
16
 
17
+ // ../../node_modules/colorjs.io/src/util.js
18
+ var exports_util2 = {};
19
+ __export(exports_util2, {
20
+ bisectLeft: () => bisectLeft,
21
+ clamp: () => clamp,
22
+ copySign: () => copySign,
23
+ diag: () => diag,
24
+ interpolate: () => interpolate,
25
+ interpolateInv: () => interpolateInv,
26
+ inv: () => inv,
27
+ isInstance: () => isInstance,
28
+ isNone: () => isNone,
29
+ isString: () => isString,
30
+ lu: () => lu,
31
+ mapRange: () => mapRange,
32
+ multiplyMatrices: () => multiplyMatrices,
33
+ multiply_v3_m3x3: () => multiply_v3_m3x3,
34
+ serializeNumber: () => serializeNumber,
35
+ skipNone: () => skipNone,
36
+ solve: () => solve,
37
+ spow: () => spow,
38
+ toPrecision: () => toPrecision,
39
+ type: () => type,
40
+ zdiv: () => zdiv
41
+ });
42
+
43
+ // ../../node_modules/colorjs.io/src/contrast/index.js
44
+ var exports_contrast = {};
45
+ __export(exports_contrast, {
46
+ contrastAPCA: () => contrastAPCA,
47
+ contrastDeltaPhi: () => contrastDeltaPhi,
48
+ contrastLstar: () => contrastLstar,
49
+ contrastMichelson: () => contrastMichelson,
50
+ contrastWCAG21: () => contrastWCAG21,
51
+ contrastWeber: () => contrastWeber
52
+ });
53
+
54
+ // ../../node_modules/colorjs.io/src/luminance.js
55
+ var exports_luminance = {};
56
+ __export(exports_luminance, {
57
+ getLuminance: () => getLuminance,
58
+ register: () => register,
59
+ setLuminance: () => setLuminance
60
+ });
61
+
62
+ // ../../node_modules/colorjs.io/src/chromaticity.js
63
+ var exports_chromaticity = {};
64
+ __export(exports_chromaticity, {
65
+ register: () => register2,
66
+ uv: () => uv,
67
+ xy: () => xy
68
+ });
69
+
70
+ // ../../node_modules/colorjs.io/src/variations.js
71
+ var exports_variations = {};
72
+ __export(exports_variations, {
73
+ darken: () => darken,
74
+ lighten: () => lighten
75
+ });
76
+
77
+ // ../../node_modules/colorjs.io/src/interpolation.js
78
+ var exports_interpolation = {};
79
+ __export(exports_interpolation, {
80
+ isRange: () => isRange,
81
+ mix: () => mix,
82
+ range: () => range,
83
+ register: () => register3,
84
+ steps: () => steps
85
+ });
86
+
87
+ // ../../node_modules/colorjs.io/src/spaces/index-fn.js
88
+ var exports_index_fn = {};
89
+ __export(exports_index_fn, {
90
+ A98RGB: () => a98rgb_default,
91
+ A98RGB_Linear: () => a98rgb_linear_default,
92
+ ACEScc: () => acescc_default,
93
+ ACEScg: () => acescg_default,
94
+ CAM16_JMh: () => cam16_default,
95
+ HCT: () => hct_default,
96
+ HPLuv: () => hpluv_default,
97
+ HSL: () => hsl_default,
98
+ HSL_P3: () => hsl_p3_default,
99
+ HSL_REC2020: () => hsl_rec2020_default,
100
+ HSLuv: () => hsluv_default,
101
+ HSV: () => hsv_default,
102
+ HWB: () => hwb_default,
103
+ HelmGen: () => helmgen_default,
104
+ HelmGenLCh: () => helmgenlch_default,
105
+ Helmlab: () => helmlab_default,
106
+ ICTCP: () => ictcp_default,
107
+ JzCzHz: () => jzczhz_default,
108
+ Jzazbz: () => jzazbz_default,
109
+ LCH: () => lch_default,
110
+ LCH_P3: () => lch_p3_default,
111
+ LCH_REC_2020: () => lch_rec2020_default,
112
+ LCH_sRGB: () => lch_srgb_default,
113
+ LCHuv: () => lchuv_default,
114
+ Lab: () => lab_default,
115
+ Lab_D65: () => lab_d65_default,
116
+ Luv: () => luv_default,
117
+ OKLCH: () => oklch_default,
118
+ OKLCH_P3: () => oklch_p3_default,
119
+ OKLCH_REC_2020: () => oklch_rec2020_default,
120
+ OKLCH_sRGB: () => oklch_srgb_default,
121
+ OKLab: () => oklab_default,
122
+ OKLrCH: () => oklrch_default,
123
+ OKLrab: () => oklrab_default,
124
+ Okhsl: () => okhsl_default,
125
+ Okhsv: () => okhsv_default,
126
+ P3: () => p3_default,
127
+ P3_Linear: () => p3_linear_default,
128
+ ProPhoto: () => prophoto_default,
129
+ ProPhoto_Linear: () => prophoto_linear_default,
130
+ REC_2020: () => rec2020_default,
131
+ REC_2020_Linear: () => rec2020_linear_default,
132
+ REC_2020_Scene_Referred: () => rec2020_oetf_default,
133
+ REC_2100_HLG: () => rec2100_hlg_default,
134
+ REC_2100_Linear: () => rec2100_linear_default,
135
+ REC_2100_PQ: () => rec2100_pq_default,
136
+ XYZ_ABS_D65: () => xyz_abs_d65_default,
137
+ XYZ_D50: () => xyz_d50_default,
138
+ XYZ_D65: () => xyz_d65_default,
139
+ sRGB: () => srgb_default,
140
+ sRGB_Linear: () => srgb_linear_default
141
+ });
142
+
17
143
  // ../../node_modules/zod/v4/core/util.js
18
144
  function getEnumValues(entries) {
19
145
  const numericValues = Object.values(entries).filter((v) => typeof v === "number");
@@ -6546,6 +6672,17 @@ function pathOfEmbeddedUrl(url) {
6546
6672
  }
6547
6673
  }
6548
6674
 
6675
+ // ../shared/src/strip-cdata.ts
6676
+ var CDATA_ENVELOPE = /^\s*<!\[CDATA\[([\s\S]*)\]\]>\s*$/;
6677
+ function unwrapCdataEnvelope(value) {
6678
+ if (typeof value !== "string")
6679
+ return value;
6680
+ const m = CDATA_ENVELOPE.exec(value);
6681
+ if (!m || m[1] === undefined || m[1].includes("]]>"))
6682
+ return value;
6683
+ return m[1];
6684
+ }
6685
+
6549
6686
  // ../shared/src/ai-tools.ts
6550
6687
  function stripSurroundingQuotes(v) {
6551
6688
  if (typeof v !== "string")
@@ -6553,6 +6690,9 @@ function stripSurroundingQuotes(v) {
6553
6690
  const m = v.match(/^(["'])([\s\S]+)\1$/);
6554
6691
  return m ? m[2] : v;
6555
6692
  }
6693
+ function sourceTextArg(schema) {
6694
+ return preprocess(unwrapCdataEnvelope, schema);
6695
+ }
6556
6696
  var positionInputSchema = preprocess(stripSurroundingQuotes, union([
6557
6697
  _enum(["top", "bottom"]),
6558
6698
  preprocess((v) => typeof v === "string" && /^\d+$/.test(v) ? Number.parseInt(v, 10) : v, number2().int().min(0).max(1000))
@@ -6563,9 +6703,9 @@ var editModuleToolInput = object({
6563
6703
  description: string2().max(1000).optional(),
6564
6704
  kind: _enum(["chrome", "hero", "content", "cta", "utility"]).optional(),
6565
6705
  type: slugSchema.optional(),
6566
- html: string2().max(MODULE_HTML_MAX).optional(),
6567
- css: string2().max(MODULE_CSS_MAX).optional(),
6568
- js: string2().max(MODULE_JS_MAX).optional(),
6706
+ html: sourceTextArg(string2().max(MODULE_HTML_MAX)).optional(),
6707
+ css: sourceTextArg(string2().max(MODULE_CSS_MAX)).optional(),
6708
+ js: sourceTextArg(string2().max(MODULE_JS_MAX)).optional(),
6569
6709
  fields: array(moduleFieldSchema).max(64).optional(),
6570
6710
  bindThemeLiterals: boolean2().optional()
6571
6711
  }).strict();
@@ -6580,8 +6720,9 @@ var siteMemoryProposeToolInput = object({
6580
6720
  body: string2().min(1).max(4000),
6581
6721
  rationale: string2().min(1).max(1000)
6582
6722
  }).strict();
6723
+ var LOAD_SKILL_MAX_SLUGS = 20;
6583
6724
  var loadSkillToolInput = object({
6584
- slugs: array(string2().min(1).max(120).regex(/^[a-z0-9-]+$/, "lowercase letters/digits/hyphens")).min(1).max(5)
6725
+ slugs: array(string2().min(1).max(120).regex(/^[a-z0-9-]+$/, "lowercase letters/digits/hyphens")).min(1).max(LOAD_SKILL_MAX_SLUGS)
6585
6726
  }).strict();
6586
6727
  var addModuleToolInput = object({
6587
6728
  target: _enum(["page", "layout", "template"]),
@@ -6593,9 +6734,9 @@ var addModuleToolInput = object({
6593
6734
  description: string2().max(1000).optional(),
6594
6735
  kind: _enum(["chrome", "hero", "content", "cta", "utility"]).optional(),
6595
6736
  type: slugSchema.optional(),
6596
- html: string2().min(1).max(50000).optional(),
6597
- css: string2().max(50000).optional(),
6598
- js: string2().max(50000).optional(),
6737
+ html: sourceTextArg(string2().min(1).max(50000)).optional(),
6738
+ css: sourceTextArg(string2().max(50000)).optional(),
6739
+ js: sourceTextArg(string2().max(50000)).optional(),
6599
6740
  fields: array(moduleFieldSchema).max(64).optional(),
6600
6741
  bindThemeLiterals: boolean2().optional(),
6601
6742
  values: record(string2(), unknown()).optional()
@@ -6741,8 +6882,8 @@ var slugInputSchema = string2().min(1).max(120).regex(/^[a-z0-9][a-z0-9-]*$/, "l
6741
6882
  var createTemplateToolInput = object({
6742
6883
  slug: slugInputSchema,
6743
6884
  displayName: string2().min(1).max(256),
6744
- html: string2().min(1).max(2000000),
6745
- css: string2().max(2000000).default(""),
6885
+ html: sourceTextArg(string2().min(1).max(2000000)),
6886
+ css: sourceTextArg(string2().max(2000000)).default(""),
6746
6887
  layoutId: string2().uuid().optional(),
6747
6888
  blocks: array(object({
6748
6889
  name: string2().min(1).max(80),
@@ -6768,8 +6909,8 @@ var setTemplateLayoutToolInput = object({
6768
6909
  var createLayoutToolInput = object({
6769
6910
  slug: slugInputSchema,
6770
6911
  displayName: string2().min(1).max(200),
6771
- html: string2().min(1).max(50000),
6772
- css: string2().max(50000).optional(),
6912
+ html: sourceTextArg(string2().min(1).max(50000)),
6913
+ css: sourceTextArg(string2().max(50000)).optional(),
6773
6914
  blocks: array(object({
6774
6915
  name: string2().min(1).max(80),
6775
6916
  displayName: string2().min(1).max(200),
@@ -7131,9 +7272,9 @@ var buildPageModuleSchema = object({
7131
7272
  description: string2().max(1000).optional(),
7132
7273
  kind: moduleKindSchema.optional(),
7133
7274
  type: slugSchema.optional(),
7134
- html: string2().min(1).max(MODULE_HTML_MAX).optional(),
7135
- css: string2().max(MODULE_CSS_MAX).optional(),
7136
- js: string2().max(MODULE_JS_MAX).optional(),
7275
+ html: sourceTextArg(string2().min(1).max(MODULE_HTML_MAX)).optional(),
7276
+ css: sourceTextArg(string2().max(MODULE_CSS_MAX)).optional(),
7277
+ js: sourceTextArg(string2().max(MODULE_JS_MAX)).optional(),
7137
7278
  fields: array(moduleFieldSchema).max(64).optional(),
7138
7279
  bindThemeLiterals: boolean2().optional(),
7139
7280
  content: buildPageContentSchema.optional()
@@ -7172,12 +7313,6 @@ var buildPageTargetSchema = object({
7172
7313
  }).strict().superRefine((page, ctx) => {
7173
7314
  const createKeys = ["slug", "title", "name", "templateId", "status", "parentPageId"].filter((k) => page[k] !== undefined);
7174
7315
  if (page.pageId !== undefined) {
7175
- if (page.metaDescription !== undefined) {
7176
- ctx.addIssue({
7177
- code: ZodIssueCode.custom,
7178
- message: "page.metaDescription is written only for a page this call CREATES \u2014 drop it with pageId; an existing page without a description gets one via autofill_page_seo."
7179
- });
7180
- }
7181
7316
  if (createKeys.length > 0) {
7182
7317
  ctx.addIssue({
7183
7318
  code: ZodIssueCode.custom,
@@ -7212,6 +7347,7 @@ var buildPageInputSchema = object({
7212
7347
  }
7213
7348
  });
7214
7349
  var buildPagePlacementResultSchema = object({
7350
+ index: number2().int().nonnegative(),
7215
7351
  blockName: string2(),
7216
7352
  position: number2().int().nonnegative(),
7217
7353
  moduleId: string2(),
@@ -7918,7 +8054,7 @@ var UNSAFE_KEYS = new Set(["__proto__", "constructor", "prototype"]);
7918
8054
  var aliasRegex = /^\{[a-zA-Z0-9_.-]+\}$/;
7919
8055
  var aliasString = string2().regex(aliasRegex, "DTCG alias must look like '{group.token}'");
7920
8056
  var colorValueString = string2().min(1).max(200).regex(/^(#[0-9a-fA-F]{3,8}|(oklch|rgb|rgba|hsl|hsla|lab|lch|color|hwb)\(.+\)|transparent|currentColor|[a-zA-Z]+)$/, "color value must be #hex, oklch(...), rgb(...), or a CSS named color");
7921
- var dimensionValueString = string2().min(1).max(80).regex(/^-?\d+(\.\d+)?(rem|em|px|%|vh|vw|vmin|vmax|pt|pc|ch|ex|fr|deg|rad|turn|s|ms)?$|^auto$|^0$/, "dimension must be a CSS length / number / percentage");
8057
+ var dimensionValueString = string2().min(1).max(120).regex(/^-?\d+(\.\d+)?(rem|em|px|%|vh|vw|vmin|vmax|pt|pc|ch|ex|fr|deg|rad|turn|s|ms)?$|^auto$|^0$|^(calc|clamp|min|max)\([0-9a-zA-Z.%+\-*/,\s()]+\)$/, "dimension must be a CSS length / number / percentage, or clamp()/calc()/min()/max() over them");
7922
8058
  var fontWeightValue = union([
7923
8059
  number2().int().min(1).max(1000),
7924
8060
  _enum(["normal", "bold", "lighter", "bolder"])
@@ -8085,6 +8221,15 @@ var CATEGORY_EXPECTATIONS = {
8085
8221
  ease: 'a cubic-bezier(...) string, an easing keyword (linear|ease|ease-in|ease-out|ease-in-out|step-start|step-end), a DTCG [x1,y1,x2,y2] tuple, or an alias like "{motion.ease}"',
8086
8222
  duration: 'a duration string ending in ms or s (e.g. "200ms", "0.5s") or an alias'
8087
8223
  };
8224
+ function valueAtPath(root, path) {
8225
+ let node = root;
8226
+ for (const key of path) {
8227
+ if (node === null || typeof node !== "object")
8228
+ return node;
8229
+ node = node[key];
8230
+ }
8231
+ return node;
8232
+ }
8088
8233
  function describeValue(value) {
8089
8234
  if (typeof value === "string")
8090
8235
  return JSON.stringify(value);
@@ -8126,7 +8271,7 @@ function refineKnownCategoryLeaves(category, schema, node, path, ctx) {
8126
8271
  ctx.addIssue({
8127
8272
  code: "custom",
8128
8273
  path: [...path, ...issue.path],
8129
- message: `${category} token "${String(name)}" invalid: ${issue.message} (got ${describeValue(obj.$value)})`
8274
+ message: `${category} token "${String(name)}" invalid: ${issue.message} (got ${describeValue(valueAtPath(obj, issue.path))})`
8130
8275
  });
8131
8276
  }
8132
8277
  }
@@ -8340,6 +8485,11 @@ var pageLogEntrySchema = object({
8340
8485
  detail: pageLogDetailSchema.nullable(),
8341
8486
  createdAt: string2().datetime()
8342
8487
  }).strict();
8488
+ // ../shared/src/phase-timer.ts
8489
+ var phaseTimingSchema = object({
8490
+ phase: string2().min(1),
8491
+ ms: number2().int().nonnegative()
8492
+ });
8343
8493
  // ../shared/src/proposal-status.ts
8344
8494
  var PROPOSAL_STATUSES = ["pending", "applied", "rejected", "superseded"];
8345
8495
  var proposalStatus = _enum(PROPOSAL_STATUSES);
@@ -8515,32 +8665,6 @@ var rebuildReturnShape = object({
8515
8665
  }).strict()).max(100).default([]),
8516
8666
  summary: string2().max(4000).default("")
8517
8667
  }).strict();
8518
- // ../../node_modules/colorjs.io/src/util.js
8519
- var exports_util2 = {};
8520
- __export(exports_util2, {
8521
- bisectLeft: () => bisectLeft,
8522
- clamp: () => clamp,
8523
- copySign: () => copySign,
8524
- diag: () => diag,
8525
- interpolate: () => interpolate,
8526
- interpolateInv: () => interpolateInv,
8527
- inv: () => inv,
8528
- isInstance: () => isInstance,
8529
- isNone: () => isNone,
8530
- isString: () => isString,
8531
- lu: () => lu,
8532
- mapRange: () => mapRange,
8533
- multiplyMatrices: () => multiplyMatrices,
8534
- multiply_v3_m3x3: () => multiply_v3_m3x3,
8535
- serializeNumber: () => serializeNumber,
8536
- skipNone: () => skipNone,
8537
- solve: () => solve,
8538
- spow: () => spow,
8539
- toPrecision: () => toPrecision,
8540
- type: () => type,
8541
- zdiv: () => zdiv
8542
- });
8543
-
8544
8668
  // ../../node_modules/colorjs.io/src/multiply-matrices.js
8545
8669
  function multiplyMatrices(A, B) {
8546
8670
  let m = A.length;
@@ -11999,24 +12123,7 @@ function equals(color1, color2) {
11999
12123
  color2 = getColor(color2);
12000
12124
  return color1.space === color2.space && color1.alpha === color2.alpha && color1.coords.every((c, i) => c === color2.coords[i]);
12001
12125
  }
12002
- // ../../node_modules/colorjs.io/src/contrast/index.js
12003
- var exports_contrast = {};
12004
- __export(exports_contrast, {
12005
- contrastAPCA: () => contrastAPCA,
12006
- contrastDeltaPhi: () => contrastDeltaPhi,
12007
- contrastLstar: () => contrastLstar,
12008
- contrastMichelson: () => contrastMichelson,
12009
- contrastWCAG21: () => contrastWCAG21,
12010
- contrastWeber: () => contrastWeber
12011
- });
12012
-
12013
12126
  // ../../node_modules/colorjs.io/src/luminance.js
12014
- var exports_luminance = {};
12015
- __export(exports_luminance, {
12016
- getLuminance: () => getLuminance,
12017
- register: () => register,
12018
- setLuminance: () => setLuminance
12019
- });
12020
12127
  function getLuminance(color) {
12021
12128
  return get(color, [xyz_d65_default, "y"]);
12022
12129
  }
@@ -12226,12 +12333,6 @@ function contrast(background, foreground, o) {
12226
12333
  }
12227
12334
 
12228
12335
  // ../../node_modules/colorjs.io/src/chromaticity.js
12229
- var exports_chromaticity = {};
12230
- __export(exports_chromaticity, {
12231
- register: () => register2,
12232
- uv: () => uv,
12233
- xy: () => xy
12234
- });
12235
12336
  function uv(color) {
12236
12337
  let [X, Y, Z] = getAll(color, xyz_d65_default);
12237
12338
  let denom = X + 15 * Y + 3 * Z;
@@ -12268,11 +12369,6 @@ function deltaE(c1, c2, o = {}) {
12268
12369
  throw new TypeError(`Unknown deltaE method: ${method}`);
12269
12370
  }
12270
12371
  // ../../node_modules/colorjs.io/src/variations.js
12271
- var exports_variations = {};
12272
- __export(exports_variations, {
12273
- darken: () => darken,
12274
- lighten: () => lighten
12275
- });
12276
12372
  function lighten(color, amount = 0.25) {
12277
12373
  let space = ColorSpace.get("oklch", "lch");
12278
12374
  let lightness = [space, "l"];
@@ -12286,14 +12382,6 @@ function darken(color, amount = 0.25) {
12286
12382
  lighten.returns = "color";
12287
12383
  darken.returns = "color";
12288
12384
  // ../../node_modules/colorjs.io/src/interpolation.js
12289
- var exports_interpolation = {};
12290
- __export(exports_interpolation, {
12291
- isRange: () => isRange,
12292
- mix: () => mix,
12293
- range: () => range,
12294
- register: () => register3,
12295
- steps: () => steps
12296
- });
12297
12385
  function mix(c1, c2, p, o = {}) {
12298
12386
  [c1, c2] = [getColor(c1), getColor(c2)];
12299
12387
  if (type(p) === "object") {
@@ -12436,63 +12524,6 @@ function register3(Color) {
12436
12524
  Color.defineFunction("range", range, { returns: "function<color>" });
12437
12525
  Color.defineFunction("steps", steps, { returns: "array<color>" });
12438
12526
  }
12439
-
12440
- // ../../node_modules/colorjs.io/src/spaces/index-fn.js
12441
- var exports_index_fn = {};
12442
- __export(exports_index_fn, {
12443
- A98RGB: () => a98rgb_default,
12444
- A98RGB_Linear: () => a98rgb_linear_default,
12445
- ACEScc: () => acescc_default,
12446
- ACEScg: () => acescg_default,
12447
- CAM16_JMh: () => cam16_default,
12448
- HCT: () => hct_default,
12449
- HPLuv: () => hpluv_default,
12450
- HSL: () => hsl_default,
12451
- HSL_P3: () => hsl_p3_default,
12452
- HSL_REC2020: () => hsl_rec2020_default,
12453
- HSLuv: () => hsluv_default,
12454
- HSV: () => hsv_default,
12455
- HWB: () => hwb_default,
12456
- HelmGen: () => helmgen_default,
12457
- HelmGenLCh: () => helmgenlch_default,
12458
- Helmlab: () => helmlab_default,
12459
- ICTCP: () => ictcp_default,
12460
- JzCzHz: () => jzczhz_default,
12461
- Jzazbz: () => jzazbz_default,
12462
- LCH: () => lch_default,
12463
- LCH_P3: () => lch_p3_default,
12464
- LCH_REC_2020: () => lch_rec2020_default,
12465
- LCH_sRGB: () => lch_srgb_default,
12466
- LCHuv: () => lchuv_default,
12467
- Lab: () => lab_default,
12468
- Lab_D65: () => lab_d65_default,
12469
- Luv: () => luv_default,
12470
- OKLCH: () => oklch_default,
12471
- OKLCH_P3: () => oklch_p3_default,
12472
- OKLCH_REC_2020: () => oklch_rec2020_default,
12473
- OKLCH_sRGB: () => oklch_srgb_default,
12474
- OKLab: () => oklab_default,
12475
- OKLrCH: () => oklrch_default,
12476
- OKLrab: () => oklrab_default,
12477
- Okhsl: () => okhsl_default,
12478
- Okhsv: () => okhsv_default,
12479
- P3: () => p3_default,
12480
- P3_Linear: () => p3_linear_default,
12481
- ProPhoto: () => prophoto_default,
12482
- ProPhoto_Linear: () => prophoto_linear_default,
12483
- REC_2020: () => rec2020_default,
12484
- REC_2020_Linear: () => rec2020_linear_default,
12485
- REC_2020_Scene_Referred: () => rec2020_oetf_default,
12486
- REC_2100_HLG: () => rec2100_hlg_default,
12487
- REC_2100_Linear: () => rec2100_linear_default,
12488
- REC_2100_PQ: () => rec2100_pq_default,
12489
- XYZ_ABS_D65: () => xyz_abs_d65_default,
12490
- XYZ_D50: () => xyz_d50_default,
12491
- XYZ_D65: () => xyz_d65_default,
12492
- sRGB: () => srgb_default,
12493
- sRGB_Linear: () => srgb_linear_default
12494
- });
12495
-
12496
12527
  // ../../node_modules/colorjs.io/src/spaces/hsl.js
12497
12528
  var hsl_default = new ColorSpace({
12498
12529
  id: "hsl",
@@ -18120,6 +18151,30 @@ async function runPostCommitEffects(effects) {
18120
18151
  // ../query-api/src/adapter.ts
18121
18152
  var SQL3 = globalThis.Bun?.SQL;
18122
18153
  var DEFAULT_ROLES = { admin: "admin_role", public: ["admin_role", "public_role"] };
18154
+ var POOL_IDLE_TIMEOUT_SECONDS = 300;
18155
+ var COMMIT_ROLLED_BACK = "ERR_POSTGRES_COMMIT_ROLLED_BACK";
18156
+ var MIN_BUN_VERSION = "1.4.4";
18157
+ function assertPoolSafeBun(version) {
18158
+ const parts = (v) => v.split("-")[0]?.split(".").map(Number) ?? [];
18159
+ const have = parts(version);
18160
+ const need = parts(MIN_BUN_VERSION);
18161
+ for (let i = 0;i < need.length; i++) {
18162
+ const h = have[i] ?? 0;
18163
+ const n = need[i] ?? 0;
18164
+ if (h > n)
18165
+ return;
18166
+ if (h < n) {
18167
+ throw new Error(`DatabaseAdapter needs Bun >= ${MIN_BUN_VERSION} (running ${version}): older Bun closes pooled connections mid-transaction after the idle timeout. Upgrade Bun.`);
18168
+ }
18169
+ }
18170
+ }
18171
+
18172
+ class DatabaseUnresponsiveError extends Error {
18173
+ name = "DatabaseUnresponsiveError";
18174
+ constructor(pool, deadlineMs) {
18175
+ super(`the ${pool} database pool did not answer within ${deadlineMs} ms; its connections hang or the database is overloaded`);
18176
+ }
18177
+ }
18123
18178
 
18124
18179
  class AdminDatabaseUnavailableError extends Error {
18125
18180
  name = "AdminDatabaseUnavailableError";
@@ -18141,6 +18196,21 @@ function validatePoolMax(value, source) {
18141
18196
  }
18142
18197
  return value;
18143
18198
  }
18199
+ function withDeadline(work, signal, onMissed) {
18200
+ if (signal.aborted)
18201
+ return Promise.reject(onMissed());
18202
+ return new Promise((resolve, reject) => {
18203
+ const abort = () => reject(onMissed());
18204
+ signal.addEventListener("abort", abort, { once: true });
18205
+ Promise.resolve(work).then((v) => {
18206
+ signal.removeEventListener("abort", abort);
18207
+ resolve(v);
18208
+ }, (e) => {
18209
+ signal.removeEventListener("abort", abort);
18210
+ reject(e);
18211
+ });
18212
+ });
18213
+ }
18144
18214
  function postCommitFailureMessage(failures) {
18145
18215
  const list = failures.map((f) => `${f.effect.label} (${f.message})`).join("; ");
18146
18216
  return `The change is saved, but its follow-up in the running server failed: ${list}. Do not repeat the change. Restart the admin server so the running state is rebuilt from the saved data; the failure is in the audit log.`;
@@ -18160,8 +18230,10 @@ class DatabaseAdapter {
18160
18230
  if (config.adminDatabaseUrl === null !== (this.#roles.admin === null)) {
18161
18231
  throw new Error("DatabaseAdapter: a public-only adapter (adminDatabaseUrl: null) must expect no admin role, and an adapter with an admin URL must expect one");
18162
18232
  }
18233
+ assertPoolSafeBun(globalThis.Bun?.version ?? "0");
18163
18234
  const poolMax = resolvePoolMax(config.poolMax);
18164
- const open = (url) => poolMax === undefined ? new SQL3(url) : new SQL3(url, { max: poolMax });
18235
+ const idleTimeout = config.poolIdleTimeoutSeconds ?? POOL_IDLE_TIMEOUT_SECONDS;
18236
+ const open = (url) => new SQL3(url, poolMax === undefined ? { idleTimeout } : { max: poolMax, idleTimeout });
18165
18237
  this.#adminRaw = config.adminDatabaseUrl === null ? null : open(config.adminDatabaseUrl);
18166
18238
  this.#publicRaw = open(config.publicDatabaseUrl);
18167
18239
  this.#admin = this.#adminRaw === null ? null : drizzle(this.#adminRaw);
@@ -18200,20 +18272,52 @@ class DatabaseAdapter {
18200
18272
  return this.#verifyPromise;
18201
18273
  }
18202
18274
  async#verifyRolesOnce() {
18203
- if (this.#adminRaw !== null) {
18204
- const admin = await this.#identity(this.#adminRaw);
18205
- if (admin.user !== this.#roles.admin || admin.database !== "cms_admin") {
18206
- throw new Error(`DatabaseAdapter admin pool expected (${this.#roles.admin}, cms_admin) but connected as (${admin.user}, ${admin.database}). Check ADMIN_DATABASE_URL.`);
18275
+ if (this.#adminRaw !== null)
18276
+ this.#assertIdentity("admin", await this.#identity(this.#adminRaw));
18277
+ this.#assertIdentity("public", await this.#identity(this.#publicRaw));
18278
+ }
18279
+ #assertIdentity(pool, id) {
18280
+ if (pool === "admin") {
18281
+ if (id.user !== this.#roles.admin || id.database !== "cms_admin") {
18282
+ throw new Error(`DatabaseAdapter admin pool expected (${this.#roles.admin}, cms_admin) but connected as (${id.user}, ${id.database}). Check ADMIN_DATABASE_URL.`);
18207
18283
  }
18284
+ return;
18208
18285
  }
18209
- const pub = await this.#identity(this.#publicRaw);
18210
- if (pub.database !== "cms_public") {
18211
- throw new Error(`DatabaseAdapter public pool expected database cms_public but connected to ${pub.database}. Check PUBLIC_DATABASE_URL / PUBLIC_ADMIN_DATABASE_URL.`);
18286
+ if (id.database !== "cms_public") {
18287
+ throw new Error(`DatabaseAdapter public pool expected database cms_public but connected to ${id.database}. Check PUBLIC_DATABASE_URL / PUBLIC_ADMIN_DATABASE_URL.`);
18212
18288
  }
18213
- if (!this.#roles.public.includes(pub.user)) {
18214
- throw new Error(`DatabaseAdapter public pool expected user ${this.#roles.public.join(" or ")}, got ${pub.user}.`);
18289
+ if (!this.#roles.public.includes(id.user)) {
18290
+ throw new Error(`DatabaseAdapter public pool expected user ${this.#roles.public.join(" or ")}, got ${id.user}.`);
18215
18291
  }
18216
18292
  }
18293
+ async ping(deadlineMs) {
18294
+ const deadline = AbortSignal.timeout(deadlineMs);
18295
+ const pools = [["public", this.#publicRaw]];
18296
+ if (this.#adminRaw !== null)
18297
+ pools.unshift(["admin", this.#adminRaw]);
18298
+ await Promise.all(pools.map(async ([name, pool]) => {
18299
+ const unresponsive = () => new DatabaseUnresponsiveError(name, deadlineMs);
18300
+ let reserved;
18301
+ try {
18302
+ reserved = await pool.reserve({ signal: deadline });
18303
+ } catch (e) {
18304
+ if (deadline.aborted)
18305
+ throw unresponsive();
18306
+ throw e;
18307
+ }
18308
+ let identity;
18309
+ try {
18310
+ identity = await withDeadline(this.#identity(reserved), deadline, unresponsive);
18311
+ } catch (e) {
18312
+ await reserved.close().catch(() => {
18313
+ return;
18314
+ });
18315
+ throw e;
18316
+ }
18317
+ reserved.release();
18318
+ this.#assertIdentity(name, identity);
18319
+ }));
18320
+ }
18217
18321
  async#identity(pool) {
18218
18322
  const rows = await pool`SELECT current_user::text AS user, current_database()::text AS database`;
18219
18323
  const row = rows[0];
@@ -18228,6 +18332,7 @@ class DatabaseAdapter {
18228
18332
  let publishAfterCommit = false;
18229
18333
  let postCommit = [];
18230
18334
  let result;
18335
+ let handlerError = null;
18231
18336
  try {
18232
18337
  result = await db.transaction(async (tx) => {
18233
18338
  postCommit = collectPostCommitEffects(tx);
@@ -18238,6 +18343,8 @@ class DatabaseAdapter {
18238
18343
  return err(branchNotFound(op.name, denied));
18239
18344
  }
18240
18345
  const out = await op.handler(ctx, validatedInput, tx);
18346
+ if (!out.ok)
18347
+ handlerError = out;
18241
18348
  if (out.ok && op.database === "cms_admin") {
18242
18349
  publishAfterCommit = await this.#projectionDirty(tx);
18243
18350
  }
@@ -18255,6 +18362,9 @@ class DatabaseAdapter {
18255
18362
  });
18256
18363
  }
18257
18364
  const pgDetail = extractPgFields(thrown);
18365
+ if (pgDetail?.code === COMMIT_ROLLED_BACK && handlerError !== null) {
18366
+ return handlerError;
18367
+ }
18258
18368
  return err({
18259
18369
  kind: "HandlerError",
18260
18370
  operation: op.name,
package/dist/compose.js CHANGED
@@ -222,7 +222,7 @@ function serviceRuntime(images, service, devCommand, mounts = []) {
222
222
  return [
223
223
  " # DEV MODE (cms-provision init --dev): runs the Caelo checkout this",
224
224
  " # .caelo/ dir lives in. Contributors only — never an end-user install.",
225
- " image: oven/bun:1.4.2",
225
+ " image: oven/bun:1.4.4",
226
226
  " working_dir: /app",
227
227
  ` command: ${devCommand}`,
228
228
  ...volumes(["../..:/app", ...mounts]),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@caelo-cms/provisioning",
3
- "version": "0.10.67",
3
+ "version": "0.10.68",
4
4
  "private": false,
5
5
  "license": "MPL-2.0",
6
6
  "description": "Pulumi-driven provisioning for Caelo CMS — `bunx @caelo-cms/provisioning --provider <self-hosted|gcp|aws|azure>` brings up a TLS-served install with Postgres + storage + secrets manager + the admin + the API gateway.",
@@ -40,7 +40,7 @@
40
40
  "prepublishOnly": "tsc -b --force && bun build ../platform-updater/src/agent-db.ts --target=bun --outfile=dist/agent-db.js && tsc --project stacks/gcp/tsconfig.json && tsc --project stacks/gcp-firebase/tsconfig.json"
41
41
  },
42
42
  "dependencies": {
43
- "@caelo-cms/shared": "^0.10.67",
43
+ "@caelo-cms/shared": "^0.10.68",
44
44
  "@clack/prompts": "1.8.1",
45
45
  "@pulumi/command": "^1",
46
46
  "@pulumi/gcp": "^10",
package/src/compose.ts CHANGED
@@ -343,7 +343,7 @@ function serviceRuntime(
343
343
  return [
344
344
  " # DEV MODE (cms-provision init --dev): runs the Caelo checkout this",
345
345
  " # .caelo/ dir lives in. Contributors only — never an end-user install.",
346
- " image: oven/bun:1.4.2",
346
+ " image: oven/bun:1.4.4",
347
347
  " working_dir: /app",
348
348
  ` command: ${devCommand}`,
349
349
  ...volumes(["../..:/app", ...mounts]),