bpmax-cli 0.2.1-beta.76 → 0.2.1-beta.77

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/bin.js CHANGED
@@ -514,7 +514,7 @@ function pluginAgentCapabilityForRequest(method, normalizedPath) {
514
514
  // package.json
515
515
  var package_default = {
516
516
  name: "bpmax-cli",
517
- version: "0.2.1-beta.76",
517
+ version: "0.2.1-beta.77",
518
518
  description: "CLI for BPMAX environments with multi-profile config and local login callback flow",
519
519
  type: "module",
520
520
  bin: {
@@ -10295,6 +10295,44 @@ function pageCompositionCapabilities(template) {
10295
10295
  return [...new Set([...declared, ...blocks, ...actions].filter((item) => typeof item === "string" && !!item.trim()).map((item) => item.trim()))];
10296
10296
  }
10297
10297
  var PAGE_COMPOSITION_QUERY_ENGINES = /* @__PURE__ */ new Set(["es", "sql", "api"]);
10298
+ var PAGE_COMPOSITION_QUERY_MODES = /* @__PURE__ */ new Set(["list", "aggregate"]);
10299
+ var PAGE_COMPOSITION_AGGREGATE_TYPES = /* @__PURE__ */ new Set([
10300
+ "terms",
10301
+ "date_histogram",
10302
+ "sum",
10303
+ "avg",
10304
+ "min",
10305
+ "max",
10306
+ "stats",
10307
+ "cardinality",
10308
+ "value_count"
10309
+ ]);
10310
+ var PAGE_COMPOSITION_AGGREGATE_BUCKET_TYPES = /* @__PURE__ */ new Set([
10311
+ "terms",
10312
+ "date_histogram"
10313
+ ]);
10314
+ var PAGE_COMPOSITION_AGGREGATE_MAX_NODES = 32;
10315
+ var PAGE_COMPOSITION_AGGREGATE_MAX_DEPTH = 3;
10316
+ var PAGE_COMPOSITION_AGGREGATE_MAX_TERMS_SIZE = 100;
10317
+ var PAGE_COMPOSITION_AGGREGATE_PARAM_KEYS = /* @__PURE__ */ new Set([
10318
+ "data_set_id",
10319
+ "data_set_key",
10320
+ "flow_type",
10321
+ "flow_key",
10322
+ "query"
10323
+ ]);
10324
+ var PAGE_COMPOSITION_AGGREGATE_QUERY_TYPES = /* @__PURE__ */ new Set([
10325
+ "term",
10326
+ "terms",
10327
+ "match",
10328
+ "match_phrase",
10329
+ "prefix",
10330
+ "wildcard",
10331
+ "exists",
10332
+ "range"
10333
+ ]);
10334
+ var PAGE_COMPOSITION_AGGREGATE_MAX_QUERY_FIELDS = 50;
10335
+ var PAGE_COMPOSITION_AGGREGATE_MAX_QUERY_VALUES = 100;
10298
10336
  var PAGE_COMPOSITION_ES_BODY_KEYS = [
10299
10337
  "data_set_id",
10300
10338
  "data_set_key",
@@ -10308,6 +10346,7 @@ var PAGE_COMPOSITION_ES_DEFAULT_PAGE_SIZE = 20;
10308
10346
  var PAGE_COMPOSITION_ROW_PATH = /^[A-Za-z_$][A-Za-z0-9_$]*(?:\.[A-Za-z0-9_$-]+)*$/;
10309
10347
  var PAGE_COMPOSITION_METHOD_NAME = /^[A-Za-z][A-Za-z0-9_]*$/;
10310
10348
  var PAGE_COMPOSITION_METHOD_SHA = /^[a-f0-9]{64}$/i;
10349
+ var PAGE_COMPOSITION_METHOD_RESOURCE_URL = /^\/static\/client\/[^\s"'<>?#]+\.mjs(?:\?[^\s"'<>#]*)?$/i;
10311
10350
  var PAGE_COMPOSITION_METHOD_FORBIDDEN = /(?:\b(?:constructor|__proto__|prototype|Function|eval|globalThis|window|document|process|require|import|this|ownerDocument|defaultView|fetch|XMLHttpRequest|WebSocket|setTimeout|setInterval|location|localStorage|sessionStorage|navigator|alert|confirm|prompt)\b|\$(?:root|parent|children|refs|el)\b)/i;
10312
10351
  var PAGE_COMPOSITION_METHOD_RESERVED = /* @__PURE__ */ new Set([
10313
10352
  "queryRows",
@@ -10391,7 +10430,7 @@ ${code}
10391
10430
  const resource = resources.find(
10392
10431
  (item) => isRecord5(item) && item.name === definition.resource
10393
10432
  );
10394
- if (!resource || resource.kind !== "script" || resource.format !== "esm" || typeof resource.url !== "string" || !PAGE_COMPOSITION_METHOD_SHA.test(String(resource.sha256 || "")) || !/\.mjs$/i.test(String(resource.name || "")) || !PAGE_COMPOSITION_METHOD_NAME.test(String(definition.export || ""))) {
10433
+ if (!resource || resource.kind !== "script" || resource.format !== "esm" || typeof resource.url !== "string" || !PAGE_COMPOSITION_METHOD_RESOURCE_URL.test(resource.url) || !PAGE_COMPOSITION_METHOD_SHA.test(String(resource.sha256 || "")) || !/\.mjs$/i.test(String(resource.name || "")) || !PAGE_COMPOSITION_METHOD_NAME.test(String(definition.export || ""))) {
10395
10434
  errors.push(
10396
10435
  `page-template method ${name} requires a registered ESM .mjs script with SHA-256 and a named export.`
10397
10436
  );
@@ -10442,6 +10481,344 @@ function isProjectListResource(resource) {
10442
10481
  const normalized = String(resource ?? "").trim().replace(/^\/?(api\/)?/, "/").replace(/\/+$/, "");
10443
10482
  return normalized === "/project/list";
10444
10483
  }
10484
+ function isProjectAggregateResource(resource) {
10485
+ const normalized = String(resource ?? "").trim().replace(/^\/?(api\/)?/, "/").replace(/\/+$/, "");
10486
+ return normalized === "/project/aggregate";
10487
+ }
10488
+ var PAGE_COMPOSITION_FILTER_FIELD_KEYS = /* @__PURE__ */ new Set([
10489
+ "status",
10490
+ "keyword",
10491
+ "owner",
10492
+ "created_date",
10493
+ "createdDate"
10494
+ ]);
10495
+ var PAGE_COMPOSITION_FILTER_GROUP_NAME = /^[A-Za-z][A-Za-z0-9_-]{0,63}$/;
10496
+ function normalizePageCompositionFilterGroup(name, definition, errors) {
10497
+ const hasCamel = Object.prototype.hasOwnProperty.call(definition, "filterGroup");
10498
+ const hasSnake = Object.prototype.hasOwnProperty.call(definition, "filter_group");
10499
+ if (hasCamel && hasSnake) {
10500
+ errors.push(
10501
+ `[page_template.filter.group_duplicate] query ${name} must use only filterGroup; filter_group is an input alias, not a second declaration.`
10502
+ );
10503
+ return void 0;
10504
+ }
10505
+ if (!hasCamel && !hasSnake) return void 0;
10506
+ const raw = hasCamel ? definition.filterGroup : definition.filter_group;
10507
+ if (typeof raw !== "string" || !PAGE_COMPOSITION_FILTER_GROUP_NAME.test(raw.trim())) {
10508
+ errors.push(
10509
+ `[page_template.filter.group_invalid] query ${name} filterGroup must be a non-empty name matching ${PAGE_COMPOSITION_FILTER_GROUP_NAME.source}.`
10510
+ );
10511
+ return void 0;
10512
+ }
10513
+ return raw.trim();
10514
+ }
10515
+ function normalizePageCompositionFilterFields(name, value, errors) {
10516
+ if (value === void 0) return void 0;
10517
+ if (!isRecord5(value) || Object.keys(value).length === 0) {
10518
+ errors.push(
10519
+ `[page_template.filter.fields_invalid] query ${name} filter_fields must be a non-empty object.`
10520
+ );
10521
+ return void 0;
10522
+ }
10523
+ const normalized = {};
10524
+ for (const [rawKey, rawField] of Object.entries(value)) {
10525
+ if (!PAGE_COMPOSITION_FILTER_FIELD_KEYS.has(rawKey)) {
10526
+ errors.push(
10527
+ `[page_template.filter.fields_unknown] query ${name} filter_fields.${rawKey} is not a supported control; use status, keyword, owner or created_date.`
10528
+ );
10529
+ continue;
10530
+ }
10531
+ const key = rawKey === "createdDate" ? "created_date" : rawKey;
10532
+ if (Object.prototype.hasOwnProperty.call(normalized, key)) {
10533
+ errors.push(
10534
+ `[page_template.filter.fields_duplicate] query ${name} declares both created_date and createdDate; use one canonical key.`
10535
+ );
10536
+ continue;
10537
+ }
10538
+ if (!isSafePageCompositionAggregateField(rawField)) {
10539
+ errors.push(
10540
+ `[page_template.filter.fields_unsafe] query ${name} filter_fields.${rawKey} must be a safe ES field path.`
10541
+ );
10542
+ continue;
10543
+ }
10544
+ const duplicateKey = Object.entries(normalized).find(
10545
+ ([, field]) => field === rawField
10546
+ )?.[0];
10547
+ if (duplicateKey) {
10548
+ errors.push(
10549
+ `[page_template.filter.fields_duplicate] query ${name} filter_fields.${rawKey} maps to the same ES field as ${duplicateKey}; each interactive control needs a distinct field.`
10550
+ );
10551
+ continue;
10552
+ }
10553
+ normalized[key] = rawField;
10554
+ }
10555
+ return Object.keys(normalized).length === Object.keys(value).length && !errors.some((error) => error.includes(`query ${name} filter_fields.`)) ? normalized : void 0;
10556
+ }
10557
+ function isSafePageCompositionAggregateField(value) {
10558
+ return typeof value === "string" && value.length <= 256 && PAGE_COMPOSITION_ROW_PATH.test(value) && !value.split(".").some((part) => ["__proto__", "prototype", "constructor"].includes(part));
10559
+ }
10560
+ function isSafePageCompositionAggregateInteger(value) {
10561
+ return typeof value === "number" && Number.isSafeInteger(value);
10562
+ }
10563
+ function isSafePageCompositionAggregateName(value) {
10564
+ return /^[A-Za-z][A-Za-z0-9_-]{0,63}$/.test(value) && !["__proto__", "prototype", "constructor"].includes(value);
10565
+ }
10566
+ function validatePageCompositionAggregateQuery(name, value, errors) {
10567
+ if (value === void 0 || value === null) return;
10568
+ if (!isRecord5(value)) {
10569
+ errors.push(`[page_template.query.aggregate_query] query ${name} params.query must be an object.`);
10570
+ return;
10571
+ }
10572
+ const fields = Object.entries(value);
10573
+ if (fields.length > PAGE_COMPOSITION_AGGREGATE_MAX_QUERY_FIELDS) {
10574
+ errors.push(`[page_template.query.aggregate_query] query ${name} params.query must contain at most ${PAGE_COMPOSITION_AGGREGATE_MAX_QUERY_FIELDS} fields.`);
10575
+ return;
10576
+ }
10577
+ const scalar = (input, path29) => {
10578
+ if (![
10579
+ "string",
10580
+ "number",
10581
+ "boolean"
10582
+ ].includes(typeof input) || input === "" || typeof input === "number" && !Number.isFinite(input) || typeof input === "string" && input.length > 1024) {
10583
+ errors.push(`[page_template.query.aggregate_query] query ${name} ${path29} must be a finite scalar.`);
10584
+ }
10585
+ };
10586
+ fields.forEach(([field, item]) => {
10587
+ const path29 = `params.query.${field}`;
10588
+ if (!isSafePageCompositionAggregateField(field)) {
10589
+ errors.push(`[page_template.query.aggregate_query] query ${name} ${path29} uses an unsafe field path.`);
10590
+ return;
10591
+ }
10592
+ if (!isRecord5(item) || typeof item.type !== "string" || !PAGE_COMPOSITION_AGGREGATE_QUERY_TYPES.has(item.type) || Object.keys(item).some((key) => !["type", "value"].includes(key))) {
10593
+ errors.push(`[page_template.query.aggregate_query] query ${name} ${path29} must use exactly the typed type/value filter shape.`);
10594
+ return;
10595
+ }
10596
+ if (item.type === "exists") {
10597
+ if (item.value !== void 0) errors.push(`[page_template.query.aggregate_query] query ${name} ${path29}.value is not allowed for exists.`);
10598
+ return;
10599
+ }
10600
+ if (item.type === "range") {
10601
+ const rangeValue = item.value;
10602
+ if (!isRecord5(rangeValue)) {
10603
+ errors.push(`[page_template.query.aggregate_query] query ${name} ${path29}.value must be an object.`);
10604
+ return;
10605
+ }
10606
+ const keys = Object.keys(rangeValue);
10607
+ if (!keys.length || keys.some((key) => !["gt", "gte", "lt", "lte"].includes(key))) {
10608
+ errors.push(`[page_template.query.aggregate_query] query ${name} ${path29}.value only supports gt, gte, lt and lte.`);
10609
+ return;
10610
+ }
10611
+ keys.forEach((key) => scalar(rangeValue[key], `${path29}.value.${key}`));
10612
+ return;
10613
+ }
10614
+ if (item.type === "terms") {
10615
+ const termsValue = item.value;
10616
+ if (!Array.isArray(termsValue) || termsValue.length > PAGE_COMPOSITION_AGGREGATE_MAX_QUERY_VALUES) {
10617
+ errors.push(`[page_template.query.aggregate_query] query ${name} ${path29}.value must contain at most ${PAGE_COMPOSITION_AGGREGATE_MAX_QUERY_VALUES} values.`);
10618
+ return;
10619
+ }
10620
+ termsValue.forEach((entry, index) => scalar(entry, `${path29}.value[${index}]`));
10621
+ return;
10622
+ }
10623
+ scalar(item.value, `${path29}.value`);
10624
+ });
10625
+ }
10626
+ function validatePageCompositionInteractiveQuery(name, value, filterFields, errors) {
10627
+ if (value === void 0) return;
10628
+ const queryErrors = [];
10629
+ validatePageCompositionAggregateQuery(name, value, queryErrors);
10630
+ errors.push(
10631
+ ...queryErrors.map(
10632
+ (error) => error.replace(
10633
+ "[page_template.query.aggregate_query]",
10634
+ "[page_template.filter.query_invalid]"
10635
+ )
10636
+ )
10637
+ );
10638
+ if (queryErrors.length || !isRecord5(value)) return;
10639
+ const controlledFields = new Set(Object.values(filterFields));
10640
+ for (const [field, clause] of Object.entries(value)) {
10641
+ if (controlledFields.has(field) && isRecord5(clause) && !["term", "terms"].includes(String(clause.type))) {
10642
+ errors.push(
10643
+ `[page_template.filter.query_conflict] query ${name} fixed query field ${field} must use term or terms when it is controlled by filter_fields; other clauses cannot be safely intersected with an interactive filter.`
10644
+ );
10645
+ }
10646
+ }
10647
+ }
10648
+ function validatePageCompositionAggregateOrder(name, value, errors) {
10649
+ if (value === void 0) return void 0;
10650
+ if (!isRecord5(value) || Object.keys(value).length !== 1) {
10651
+ errors.push(`[page_template.query.aggregate_invalid] query ${name} aggregation order must contain one field mapped to asc or desc.`);
10652
+ return void 0;
10653
+ }
10654
+ const [field, direction] = Object.entries(value)[0];
10655
+ if (!/^(?:_count|_key|[A-Za-z][A-Za-z0-9_-]{0,63})$/.test(field) || !["asc", "desc"].includes(String(direction))) {
10656
+ errors.push(`[page_template.query.aggregate_invalid] query ${name} aggregation order only supports a safe aggregation key with asc or desc.`);
10657
+ return void 0;
10658
+ }
10659
+ return { [field]: String(direction) };
10660
+ }
10661
+ function validatePageCompositionAggregations(name, value, errors) {
10662
+ if (!isRecord5(value) || Object.keys(value).length === 0) {
10663
+ errors.push(`[page_template.query.aggregate_invalid] query ${name} requires a non-empty aggs object.`);
10664
+ return void 0;
10665
+ }
10666
+ let nodeCount = 0;
10667
+ const visit = (aggregationName, input, depth) => {
10668
+ nodeCount += 1;
10669
+ if (nodeCount > PAGE_COMPOSITION_AGGREGATE_MAX_NODES) {
10670
+ errors.push(`[page_template.query.aggregate_limit] query ${name} exceeds ${PAGE_COMPOSITION_AGGREGATE_MAX_NODES} aggregation nodes.`);
10671
+ return void 0;
10672
+ }
10673
+ if (depth > PAGE_COMPOSITION_AGGREGATE_MAX_DEPTH) {
10674
+ errors.push(`[page_template.query.aggregate_limit] query ${name} exceeds aggregation depth ${PAGE_COMPOSITION_AGGREGATE_MAX_DEPTH}.`);
10675
+ return void 0;
10676
+ }
10677
+ if (!isRecord5(input) || typeof input.type !== "string" || !PAGE_COMPOSITION_AGGREGATE_TYPES.has(input.type)) {
10678
+ errors.push(`[page_template.query.aggregate_invalid] query ${name} aggregation ${aggregationName} type must be one of ${[...PAGE_COMPOSITION_AGGREGATE_TYPES].join(", ")}.`);
10679
+ return void 0;
10680
+ }
10681
+ const type = input.type;
10682
+ if (Object.prototype.hasOwnProperty.call(input, "aggregations")) {
10683
+ errors.push(`[page_template.query.aggregate_invalid] query ${name} aggregation ${aggregationName} aggregations is not allowed; use aggs.`);
10684
+ return void 0;
10685
+ }
10686
+ const commonKeys = ["type", "field", "aggs"];
10687
+ const allowed = /* @__PURE__ */ new Set([
10688
+ ...commonKeys,
10689
+ ...type === "terms" ? ["size", "order", "missing", "min_doc_count"] : [],
10690
+ ...type === "date_histogram" ? ["calendar_interval", "fixed_interval", "interval", "min_doc_count", "format", "time_zone", "order", "missing"] : [],
10691
+ ...type === "cardinality" ? ["missing", "precision_threshold", "rehash"] : [],
10692
+ ...(/* @__PURE__ */ new Set(["sum", "avg", "min", "max", "stats", "value_count"])).has(type) ? ["missing"] : []
10693
+ ]);
10694
+ const invalidKey = Object.keys(input).find((key) => !allowed.has(key));
10695
+ if (invalidKey) {
10696
+ errors.push(`[page_template.query.aggregate_invalid] query ${name} aggregation ${aggregationName} contains unsupported key ${invalidKey}; script, runtime_mappings and arbitrary DSL are forbidden.`);
10697
+ return void 0;
10698
+ }
10699
+ if (!isSafePageCompositionAggregateField(input.field)) {
10700
+ errors.push(`[page_template.query.aggregate_field] query ${name} aggregation ${aggregationName} requires a safe field path.`);
10701
+ return void 0;
10702
+ }
10703
+ const result = { type, field: input.field };
10704
+ if (input.size !== void 0) {
10705
+ const size = input.size;
10706
+ if (!isSafePageCompositionAggregateInteger(size) || size < 1 || size > PAGE_COMPOSITION_AGGREGATE_MAX_TERMS_SIZE || type !== "terms") {
10707
+ errors.push(`[page_template.query.aggregate_limit] query ${name} aggregation ${aggregationName} size must be an integer from 1 to ${PAGE_COMPOSITION_AGGREGATE_MAX_TERMS_SIZE} and is only supported for terms.`);
10708
+ } else result.size = size;
10709
+ }
10710
+ if (type === "terms" && input.min_doc_count !== void 0) {
10711
+ const min = input.min_doc_count;
10712
+ if (!isSafePageCompositionAggregateInteger(min) || min < 0 || min > 1e6) {
10713
+ errors.push(`[page_template.query.aggregate_invalid] query ${name} terms ${aggregationName} min_doc_count must be an integer from 0 to 1000000.`);
10714
+ } else result.min_doc_count = min;
10715
+ }
10716
+ const order = validatePageCompositionAggregateOrder(name, input.order, errors);
10717
+ if (input.order !== void 0 && !PAGE_COMPOSITION_AGGREGATE_BUCKET_TYPES.has(type)) {
10718
+ errors.push(`[page_template.query.aggregate_invalid] query ${name} metric aggregation ${aggregationName} cannot contain order.`);
10719
+ }
10720
+ if (order) result.order = order;
10721
+ if (input.missing !== void 0) {
10722
+ const missingType = typeof input.missing;
10723
+ if (!["string", "number", "boolean"].includes(missingType) || missingType === "string" && (!String(input.missing).length || String(input.missing).length > 1024) || missingType === "number" && !Number.isFinite(input.missing)) {
10724
+ errors.push(`[page_template.query.aggregate_invalid] query ${name} aggregation ${aggregationName} missing must be a scalar.`);
10725
+ } else result.missing = input.missing;
10726
+ }
10727
+ if (type === "date_histogram") {
10728
+ const calendar = input.calendar_interval;
10729
+ const fixed = input.fixed_interval;
10730
+ const interval = input.interval;
10731
+ const intervals = [calendar, fixed, interval].filter((item) => item !== void 0);
10732
+ if (intervals.length !== 1) {
10733
+ errors.push(`[page_template.query.aggregate_invalid] query ${name} date_histogram ${aggregationName} requires exactly one calendar_interval, fixed_interval or interval.`);
10734
+ } else if (calendar !== void 0 && !["minute", "hour", "day", "week", "month", "quarter", "year"].includes(String(calendar))) {
10735
+ errors.push(`[page_template.query.aggregate_invalid] query ${name} date_histogram ${aggregationName} has an unsupported calendar_interval.`);
10736
+ } else if (fixed !== void 0 && (typeof fixed !== "string" || !/^[1-9]\d{0,8}(?:ms|s|m|h|d)$/.test(fixed))) {
10737
+ errors.push(`[page_template.query.aggregate_invalid] query ${name} date_histogram ${aggregationName} has an unsupported fixed_interval.`);
10738
+ } else if (interval !== void 0 && (typeof interval !== "string" || !["minute", "hour", "day", "week", "month", "quarter", "year"].includes(interval) && !/^\d{1,9}(?:ms|s|m|h|d|w|M|q|y)$/.test(interval))) {
10739
+ errors.push(`[page_template.query.aggregate_invalid] query ${name} date_histogram ${aggregationName} has an unsupported interval.`);
10740
+ } else {
10741
+ if (calendar !== void 0) result.calendar_interval = String(calendar);
10742
+ if (fixed !== void 0) result.fixed_interval = String(fixed);
10743
+ if (interval !== void 0) result.interval = String(interval);
10744
+ }
10745
+ if (input.min_doc_count !== void 0) {
10746
+ const min = input.min_doc_count;
10747
+ if (!isSafePageCompositionAggregateInteger(min) || min < 0 || min > 1) errors.push(`[page_template.query.aggregate_invalid] query ${name} date_histogram ${aggregationName} min_doc_count must be 0 or 1.`);
10748
+ else result.min_doc_count = min;
10749
+ }
10750
+ if (input.format !== void 0) {
10751
+ if (typeof input.format !== "string" || !input.format.trim() || input.format.length > 64 || input.format.includes("\0")) errors.push(`[page_template.query.aggregate_invalid] query ${name} date_histogram ${aggregationName} format is invalid.`);
10752
+ else result.format = input.format;
10753
+ }
10754
+ if (input.time_zone !== void 0) {
10755
+ if (typeof input.time_zone !== "string" || !input.time_zone.trim() || input.time_zone.length > 64 || input.time_zone.includes("\0")) errors.push(`[page_template.query.aggregate_invalid] query ${name} date_histogram ${aggregationName} time_zone is invalid.`);
10756
+ else result.time_zone = input.time_zone;
10757
+ }
10758
+ const dateOrder = validatePageCompositionAggregateOrder(name, input.order, errors);
10759
+ if (dateOrder) result.order = dateOrder;
10760
+ }
10761
+ if (type === "cardinality" && input.precision_threshold !== void 0) {
10762
+ const precision = input.precision_threshold;
10763
+ if (!isSafePageCompositionAggregateInteger(precision) || precision < 0 || precision > 4e4) errors.push(`[page_template.query.aggregate_limit] query ${name} cardinality ${aggregationName} precision_threshold must be between 0 and 40000.`);
10764
+ else result.precision_threshold = precision;
10765
+ }
10766
+ if (type === "cardinality" && input.rehash !== void 0) {
10767
+ if (typeof input.rehash !== "boolean") errors.push(`[page_template.query.aggregate_invalid] query ${name} cardinality ${aggregationName} rehash must be a boolean.`);
10768
+ else result.rehash = input.rehash;
10769
+ }
10770
+ if (input.aggs !== void 0) {
10771
+ if (!PAGE_COMPOSITION_AGGREGATE_BUCKET_TYPES.has(type)) {
10772
+ errors.push(`[page_template.query.aggregate_invalid] query ${name} metric aggregation ${aggregationName} cannot contain nested aggs.`);
10773
+ } else {
10774
+ const children = input.aggs;
10775
+ if (!isRecord5(children) || Object.keys(children).length === 0) {
10776
+ errors.push(`[page_template.query.aggregate_invalid] query ${name} nested aggs for ${aggregationName} must be a non-empty object.`);
10777
+ } else {
10778
+ const normalizedChildren = {};
10779
+ for (const [childName, child] of Object.entries(children)) {
10780
+ if (!isSafePageCompositionAggregateName(childName)) {
10781
+ errors.push(`[page_template.query.aggregate_invalid] query ${name} aggregation name ${childName} is invalid.`);
10782
+ continue;
10783
+ }
10784
+ const normalizedChild = visit(childName, child, depth + 1);
10785
+ if (normalizedChild) normalizedChildren[childName] = normalizedChild;
10786
+ }
10787
+ result.aggs = normalizedChildren;
10788
+ }
10789
+ }
10790
+ }
10791
+ return result;
10792
+ };
10793
+ const normalized = {};
10794
+ for (const [aggregationName, aggregation] of Object.entries(value)) {
10795
+ if (!isSafePageCompositionAggregateName(aggregationName)) {
10796
+ errors.push(`[page_template.query.aggregate_invalid] query ${name} aggregation name ${aggregationName} is invalid.`);
10797
+ continue;
10798
+ }
10799
+ const normalizedAggregation = visit(aggregationName, aggregation, 1);
10800
+ if (normalizedAggregation) normalized[aggregationName] = normalizedAggregation;
10801
+ }
10802
+ return normalized;
10803
+ }
10804
+ function pageCompositionAggregationTrace(value) {
10805
+ if (!isRecord5(value)) return [];
10806
+ const trace = [];
10807
+ const visit = (name, aggregation, depth) => {
10808
+ if (!isRecord5(aggregation)) return;
10809
+ trace.push({
10810
+ name,
10811
+ type: aggregation.type ?? null,
10812
+ field: aggregation.field ?? null,
10813
+ depth,
10814
+ ...aggregation.size !== void 0 ? { size: aggregation.size } : {}
10815
+ });
10816
+ const children = isRecord5(aggregation.aggs) ? aggregation.aggs : {};
10817
+ Object.entries(children).forEach(([childName, child]) => visit(childName, child, depth + 1));
10818
+ };
10819
+ Object.entries(value).forEach(([name, aggregation]) => visit(name, aggregation, 1));
10820
+ return trace;
10821
+ }
10445
10822
  function hasNonEmptyParam(params, key) {
10446
10823
  const value = params[key];
10447
10824
  return value !== void 0 && value !== null && String(value).trim() !== "";
@@ -10539,6 +10916,26 @@ function analyzePageCompositionQueries(queries) {
10539
10916
  errors.push(`page-template query ${name} must be an object.`);
10540
10917
  continue;
10541
10918
  }
10919
+ const filterGroup = normalizePageCompositionFilterGroup(
10920
+ name,
10921
+ definition,
10922
+ errors
10923
+ );
10924
+ if ((Object.prototype.hasOwnProperty.call(definition, "filterGroup") || Object.prototype.hasOwnProperty.call(definition, "filter_group")) && !filterGroup) {
10925
+ continue;
10926
+ }
10927
+ const hasFilterFields = Object.prototype.hasOwnProperty.call(definition, "filter_fields") || Object.prototype.hasOwnProperty.call(definition, "filterFields");
10928
+ if (Object.prototype.hasOwnProperty.call(definition, "filter_fields") && Object.prototype.hasOwnProperty.call(definition, "filterFields")) {
10929
+ errors.push(
10930
+ `[page_template.filter.fields_duplicate] query ${name} must use only filter_fields; filterFields is an input alias, not a second declaration.`
10931
+ );
10932
+ }
10933
+ const filterFields = normalizePageCompositionFilterFields(
10934
+ name,
10935
+ definition.filter_fields ?? definition.filterFields,
10936
+ errors
10937
+ );
10938
+ if (hasFilterFields && !filterFields) continue;
10542
10939
  const params = isRecord5(definition.params) ? definition.params : {};
10543
10940
  validatePageCompositionRowMapping(
10544
10941
  name,
@@ -10552,6 +10949,175 @@ function analyzePageCompositionQueries(queries) {
10552
10949
  }
10553
10950
  const resource = definition.resource ?? definition.endpoint ?? (declared === "es" ? "/project/list" : void 0);
10554
10951
  const projectList = isProjectListResource(resource);
10952
+ const projectAggregate = isProjectAggregateResource(resource);
10953
+ const mode = definition.mode === void 0 ? void 0 : String(definition.mode).trim().toLowerCase();
10954
+ if (mode !== void 0 && !PAGE_COMPOSITION_QUERY_MODES.has(mode)) {
10955
+ errors.push(`[page_template.query.aggregate_mode] query ${name} mode must be list or aggregate.`);
10956
+ continue;
10957
+ }
10958
+ if (Object.prototype.hasOwnProperty.call(definition, "aggregations") && mode !== "aggregate" && !projectAggregate) {
10959
+ errors.push(
10960
+ `[page_template.query.aggregate_mode] query ${name} top-level aggregations is not supported; move it to top-level aggs on a mode: "aggregate" query using /project/aggregate.`
10961
+ );
10962
+ continue;
10963
+ }
10964
+ if (mode === "aggregate" || projectAggregate || Object.prototype.hasOwnProperty.call(definition, "aggs")) {
10965
+ if (filterFields) {
10966
+ errors.push(
10967
+ `[page_template.filter.fields_resource] query ${name} filter_fields is only supported on the paginated /project/list query; declare it on the list query in the filterGroup.`
10968
+ );
10969
+ continue;
10970
+ }
10971
+ if (mode !== "aggregate") {
10972
+ errors.push(`[page_template.query.aggregate_mode] query ${name} aggregate queries must declare mode: "aggregate".`);
10973
+ continue;
10974
+ }
10975
+ if (declared !== "es") {
10976
+ errors.push(`[page_template.query.aggregate_mode] query ${name} aggregate queries must declare engine: "es".`);
10977
+ continue;
10978
+ }
10979
+ if (!projectAggregate) {
10980
+ errors.push(`[page_template.query.aggregate_resource] query ${name} aggregate queries must use resource /project/aggregate.`);
10981
+ continue;
10982
+ }
10983
+ if (definition.method !== void 0 && String(definition.method).trim().toUpperCase() !== "POST") {
10984
+ errors.push(`[page_template.query.aggregate_resource] query ${name} /project/aggregate must use POST.`);
10985
+ continue;
10986
+ }
10987
+ if (!hasNonEmptyParam(params, "data_set_key") && !hasNonEmptyParam(params, "data_set_id")) {
10988
+ errors.push(`[page_template.query.es_dataset_required] query ${name} engine "es" requires params.data_set_key or params.data_set_id.`);
10989
+ continue;
10990
+ }
10991
+ if (hasNonEmptyParam(params, "data_set_key") && hasNonEmptyParam(params, "data_set_id")) {
10992
+ errors.push(`[page_template.query.aggregate_invalid] query ${name} must use exactly one of params.data_set_key or params.data_set_id.`);
10993
+ continue;
10994
+ }
10995
+ if (hasNonEmptyParam(params, "data_set_key")) {
10996
+ if (typeof params.data_set_key !== "string" || !params.data_set_key.trim()) {
10997
+ errors.push(`[page_template.query.aggregate_invalid] query ${name} params.data_set_key must be a non-empty string.`);
10998
+ continue;
10999
+ }
11000
+ if (typeof params.flow_type !== "string" || !params.flow_type.trim() || typeof params.flow_key !== "string") {
11001
+ warnings.push(
11002
+ `[page_template.query.dataset_scope] query ${name}: aggregate data_set_key requires string params.flow_type and params.flow_key (flow_key may be empty); the runtime may inherit them from the current route.`
11003
+ );
11004
+ }
11005
+ }
11006
+ if (hasNonEmptyParam(params, "data_set_id") && (!Number.isSafeInteger(params.data_set_id) || Number(params.data_set_id) <= 0)) {
11007
+ errors.push(`[page_template.query.aggregate_invalid] query ${name} params.data_set_id must be a positive safe integer.`);
11008
+ continue;
11009
+ }
11010
+ if (params.flow_type !== void 0 && (typeof params.flow_type !== "string" || !params.flow_type.trim())) {
11011
+ errors.push(`[page_template.query.aggregate_invalid] query ${name} params.flow_type must be a non-empty string when provided.`);
11012
+ continue;
11013
+ }
11014
+ if (params.flow_key !== void 0 && typeof params.flow_key !== "string") {
11015
+ errors.push(`[page_template.query.aggregate_invalid] query ${name} params.flow_key must be a string when provided.`);
11016
+ continue;
11017
+ }
11018
+ const aggregateDefinitionKeys = /* @__PURE__ */ new Set([
11019
+ "engine",
11020
+ "mode",
11021
+ "resource",
11022
+ "endpoint",
11023
+ "method",
11024
+ "params",
11025
+ "aggs",
11026
+ "filterGroup",
11027
+ "filter_group"
11028
+ ]);
11029
+ const unsupportedDefinitionKey = Object.keys(definition).find((key) => !aggregateDefinitionKeys.has(key));
11030
+ if (unsupportedDefinitionKey) {
11031
+ errors.push(`[page_template.query.aggregate_invalid] query ${name} cannot contain ${unsupportedDefinitionKey}; arbitrary ES DSL and unsupported aggregate fields are forbidden. Aggregate queries only accept engine, mode, resource, method, params, aggs and filterGroup.`);
11032
+ continue;
11033
+ }
11034
+ const forbiddenAggregateDefinitionKeys = ["query", "body", "dsl", "script", "runtime_mappings", "aggregations", "index", "shard_size", "page", "page_size", "sort", "sorts", "preProcessHook", "postProcessHook", "hooks", "is_select_all"];
11035
+ const forbiddenAggregateParamKeys = ["body", "dsl", "script", "runtime_mappings", "aggregations", "index", "aggs"];
11036
+ const forbiddenDefinitionKey = forbiddenAggregateDefinitionKeys.find((key) => Object.prototype.hasOwnProperty.call(definition, key));
11037
+ if (forbiddenDefinitionKey) {
11038
+ errors.push(`[page_template.query.aggregate_invalid] query ${name} cannot contain ${forbiddenDefinitionKey}; arbitrary ES DSL is forbidden.`);
11039
+ continue;
11040
+ }
11041
+ const forbiddenParamKey = forbiddenAggregateParamKeys.find((key) => Object.prototype.hasOwnProperty.call(params, key));
11042
+ if (forbiddenParamKey) {
11043
+ errors.push(`[page_template.query.aggregate_invalid] query ${name} params cannot contain ${forbiddenParamKey}; arbitrary ES DSL is forbidden.`);
11044
+ continue;
11045
+ }
11046
+ const unsupportedParamKey = Object.keys(params).find((key) => !PAGE_COMPOSITION_AGGREGATE_PARAM_KEYS.has(key));
11047
+ if (unsupportedParamKey) {
11048
+ errors.push(`[page_template.query.aggregate_invalid] query ${name} params cannot contain ${unsupportedParamKey}; aggregate queries only accept dataset, flow and typed query parameters.`);
11049
+ continue;
11050
+ }
11051
+ validatePageCompositionAggregateQuery(name, params.query, errors);
11052
+ if (errors.some((error) => error.includes(`[page_template.query.aggregate_query] query ${name} `))) continue;
11053
+ const normalizedAggs = validatePageCompositionAggregations(name, definition.aggs, errors);
11054
+ if (!normalizedAggs || errors.some((error) => error.includes(`query ${name} `) && error.includes("aggregate"))) continue;
11055
+ if (Object.prototype.hasOwnProperty.call(params, "page") || Object.prototype.hasOwnProperty.call(params, "page_size")) {
11056
+ errors.push(`[page_template.query.aggregate_invalid] query ${name} aggregate queries must not carry pagination parameters.`);
11057
+ continue;
11058
+ }
11059
+ const normalizedDefinition2 = {
11060
+ ...definition,
11061
+ engine: "es",
11062
+ mode: "aggregate",
11063
+ resource: "/project/aggregate",
11064
+ method: "POST",
11065
+ params: { ...params },
11066
+ aggs: normalizedAggs,
11067
+ ...filterGroup ? { filterGroup } : {}
11068
+ };
11069
+ delete normalizedDefinition2.endpoint;
11070
+ delete normalizedDefinition2.aggregations;
11071
+ delete normalizedDefinition2.filter_group;
11072
+ normalized[name] = normalizedDefinition2;
11073
+ continue;
11074
+ }
11075
+ if (filterFields && !projectList) {
11076
+ errors.push(
11077
+ `[page_template.filter.fields_resource] query ${name} filter_fields requires resource /project/list.`
11078
+ );
11079
+ continue;
11080
+ }
11081
+ if (filterFields && declared !== void 0 && declared !== "es") {
11082
+ errors.push(
11083
+ `[page_template.filter.fields_engine] query ${name} filter_fields requires engine: "es".`
11084
+ );
11085
+ continue;
11086
+ }
11087
+ if ((filterFields || filterGroup) && definition.filterMode !== "server") {
11088
+ errors.push(
11089
+ `[page_template.filter.fields_mode] query ${name} filter_fields requires filterMode: "server" so controls are sent to the server.`
11090
+ );
11091
+ continue;
11092
+ }
11093
+ if (filterGroup && !filterFields) {
11094
+ errors.push(
11095
+ `[page_template.filter.fields_required] query ${name} filterGroup requires an explicit filter_fields mapping on the paginated /project/list query; runtime defaults are not allowed.`
11096
+ );
11097
+ continue;
11098
+ }
11099
+ if (filterGroup && filterFields) {
11100
+ validatePageCompositionInteractiveQuery(
11101
+ name,
11102
+ params.query,
11103
+ filterFields,
11104
+ errors
11105
+ );
11106
+ if (errors.some(
11107
+ (error) => error.includes(`[page_template.filter.query_`) && error.includes(`query ${name} `)
11108
+ )) {
11109
+ continue;
11110
+ }
11111
+ }
11112
+ const misplacedAggregateParam = ["aggs", "aggregations"].find(
11113
+ (key) => Object.prototype.hasOwnProperty.call(params, key)
11114
+ );
11115
+ if (misplacedAggregateParam) {
11116
+ errors.push(
11117
+ `[page_template.query.aggregate_mode] query ${name} params.${misplacedAggregateParam} is ignored by /project/list; move it to top-level aggs on a mode: "aggregate" query using /project/aggregate.`
11118
+ );
11119
+ continue;
11120
+ }
10555
11121
  const esShaped = PAGE_COMPOSITION_ES_BODY_KEYS.some(
10556
11122
  (key) => Object.prototype.hasOwnProperty.call(params, key)
10557
11123
  );
@@ -10623,8 +11189,12 @@ function analyzePageCompositionQueries(queries) {
10623
11189
  ...definition,
10624
11190
  engine,
10625
11191
  ...resolvedResource,
10626
- ...engine === "es" && projectList ? { method: "POST" } : {}
11192
+ ...engine === "es" && projectList ? { method: "POST" } : {},
11193
+ ...filterFields ? { filter_fields: filterFields } : {},
11194
+ ...filterGroup ? { filterGroup } : {}
10627
11195
  };
11196
+ delete normalizedDefinition.filterFields;
11197
+ delete normalizedDefinition.filter_group;
10628
11198
  if (definition.row_mapping !== void 0 || definition.rowMapping !== void 0) {
10629
11199
  normalizedDefinition.row_mapping = definition.row_mapping ?? definition.rowMapping;
10630
11200
  delete normalizedDefinition.rowMapping;
@@ -10638,6 +11208,25 @@ function analyzePageCompositionQueries(queries) {
10638
11208
  }
10639
11209
  normalized[name] = normalizedDefinition;
10640
11210
  }
11211
+ const groups = /* @__PURE__ */ new Map();
11212
+ for (const [name, definition] of Object.entries(normalized)) {
11213
+ const group = isRecord5(definition) ? definition.filterGroup : void 0;
11214
+ if (typeof group !== "string") continue;
11215
+ const entry = groups.get(group) || { lists: [], aggregates: [] };
11216
+ if (isRecord5(definition) && definition.mode === "aggregate") {
11217
+ entry.aggregates.push(name);
11218
+ } else {
11219
+ entry.lists.push(name);
11220
+ }
11221
+ groups.set(group, entry);
11222
+ }
11223
+ for (const [group, members] of groups) {
11224
+ if (members.aggregates.length && !members.lists.length) {
11225
+ warnings.push(
11226
+ `[page_template.filter.group_list_missing] filterGroup ${group} has aggregate queries (${members.aggregates.join(", ")}) but no grouped /project/list query; interactive filters cannot refresh this group.`
11227
+ );
11228
+ }
11229
+ }
10641
11230
  return { queries: normalized, errors, warnings };
10642
11231
  }
10643
11232
  function pageCompositionQueryEngineTrace(queries) {
@@ -10645,13 +11234,18 @@ function pageCompositionQueryEngineTrace(queries) {
10645
11234
  Object.entries(queries).map(([name, definition]) => {
10646
11235
  const item = isRecord5(definition) ? definition : {};
10647
11236
  const params = isRecord5(item.params) ? item.params : {};
11237
+ const filterFields = isRecord5(item.filter_fields) ? item.filter_fields : void 0;
10648
11238
  return [
10649
11239
  name,
10650
11240
  {
10651
11241
  engine: item.engine ?? null,
11242
+ mode: item.mode ?? (item.engine === "es" ? "list" : null),
10652
11243
  resource: item.resource ?? item.endpoint ?? null,
11244
+ ...item.filterGroup || item.filter_group ? { filterGroup: item.filterGroup ?? item.filter_group } : {},
10653
11245
  data_set_key: params.data_set_key ?? null,
10654
11246
  data_set_id: params.data_set_id ?? null,
11247
+ ...filterFields ? { filter_fields: filterFields } : {},
11248
+ ...item.mode === "aggregate" ? { aggregations: pageCompositionAggregationTrace(item.aggs) } : {},
10655
11249
  ...item.engine === "sql" ? { reason: item.reason ?? null } : {}
10656
11250
  }
10657
11251
  ];
@@ -16255,6 +16849,8 @@ async function previewPageTemplateWork(workFile, outDir, mode = "mock") {
16255
16849
  ]
16256
16850
  )
16257
16851
  ),
16852
+ methods_registry_version: 1,
16853
+ methods_registry_hash: hashJson(isRecord5(data.methods) ? data.methods : {}),
16258
16854
  compiled_template_hash: hashJson(render),
16259
16855
  submit_payload_hash: hashJson(payload),
16260
16856
  data_trace_hash: hashJson(dataTrace),
@@ -17314,6 +17910,13 @@ async function submitConfigDomain(config, profile, domain, id, submitFile, confi
17314
17910
  if (domain === "page-template" && submit.preview_manifest !== void 0) {
17315
17911
  validatePageTemplatePreviewManifest(submit.preview_manifest, submit.payload);
17316
17912
  }
17913
+ const pageTemplatePreviewConfirmation = domain === "page-template" && isRecord5(submit.preview_manifest) && options.dryRun !== true;
17914
+ const pageTemplateExpectedConfirm = `submit ${domain} ${id}`;
17915
+ if (pageTemplatePreviewConfirmation && confirm3 !== void 0 && confirm3 !== pageTemplateExpectedConfirm) {
17916
+ throw new Error(
17917
+ `[page_template_confirmation_mismatch] Expected "${pageTemplateExpectedConfirm}" when --confirm is provided; omit --confirm to use the verified preview manifest.`
17918
+ );
17919
+ }
17317
17920
  let listTemplateValidation;
17318
17921
  let listTemplateOverride;
17319
17922
  if (domain === "list-template") {
@@ -17415,7 +18018,12 @@ async function submitConfigDomain(config, profile, domain, id, submitFile, confi
17415
18018
  }
17416
18019
  await ensureConfigCapability(profile, `${definition.capability}.create`);
17417
18020
  const expectedConfirm2 = `submit ${domain} ${id}`;
17418
- if (confirm3 !== expectedConfirm2) {
18021
+ if (domain === "page-template" && submit.preview_manifest === void 0 && confirm3 === expectedConfirm2) {
18022
+ throw new Error(
18023
+ "[page_template_preview_manifest_required] Confirmed page-template writes require the preview manifest produced by preview/build. Re-run preview, then rebuild with --preview-manifest before submitting."
18024
+ );
18025
+ }
18026
+ if (confirm3 !== expectedConfirm2 && !pageTemplatePreviewConfirmation) {
17419
18027
  return {
17420
18028
  ...dryRunFields(expectedConfirm2),
17421
18029
  domain,
@@ -17532,6 +18140,10 @@ async function submitConfigDomain(config, profile, domain, id, submitFile, confi
17532
18140
  domain,
17533
18141
  ...standardConfigWriteResponse({ domain, id, executedId: createdId ?? null, payload: submit.payload, response: response2 }),
17534
18142
  created_id: createdId ?? null,
18143
+ ...pageTemplatePreviewConfirmation ? {
18144
+ confirmation_mode: "verified_preview_manifest",
18145
+ confirmation_reused: true
18146
+ } : {},
17535
18147
  endpoint: definition.createPath,
17536
18148
  method: definition.createMethod,
17537
18149
  response: response2,
@@ -17713,6 +18325,11 @@ async function submitConfigDomain(config, profile, domain, id, submitFile, confi
17713
18325
  };
17714
18326
  }
17715
18327
  const expectedConfirm = `submit ${domain} ${id}`;
18328
+ if (domain === "page-template" && submit.preview_manifest === void 0 && confirm3 === expectedConfirm) {
18329
+ throw new Error(
18330
+ "[page_template_preview_manifest_required] Confirmed page-template writes require the preview manifest produced by preview/build. Re-run preview, then rebuild with --preview-manifest before submitting."
18331
+ );
18332
+ }
17716
18333
  if (submitMode !== "create" && typeof submit.base_hash !== "string") {
17717
18334
  throw new Error(`${domain} submit requires a current base_hash from export/build. Re-export the remote config, rebuild, then submit.`);
17718
18335
  }
@@ -17790,7 +18407,7 @@ async function submitConfigDomain(config, profile, domain, id, submitFile, confi
17790
18407
  const mutationDiff = diffJsonNormalized(domain, current, submitPayload);
17791
18408
  const datasetCustomKeyInitialization = domain === "dataset" && isRecord5(current) && !normalizeText(current.custom_key).trim() && Boolean(normalizeText(submit.payload.custom_key).trim()) && options.initializeDatasetCustomKey;
17792
18409
  const requiredConfirm = datasetCustomKeyInitialization ? `initialize dataset custom_key ${id} ${normalizeText(submit.payload.custom_key).trim()}` : expectedConfirm;
17793
- if (confirm3 !== requiredConfirm) {
18410
+ if (confirm3 !== requiredConfirm && !pageTemplatePreviewConfirmation) {
17794
18411
  return {
17795
18412
  ...dryRunFields(requiredConfirm),
17796
18413
  domain,
@@ -17928,6 +18545,10 @@ async function submitConfigDomain(config, profile, domain, id, submitFile, confi
17928
18545
  ...standardConfigWriteResponse({ domain, id, payload: submitPayload, response }),
17929
18546
  endpoint,
17930
18547
  method: definition.submitMethod,
18548
+ ...pageTemplatePreviewConfirmation ? {
18549
+ confirmation_mode: "verified_preview_manifest",
18550
+ confirmation_reused: true
18551
+ } : {},
17931
18552
  ...publishMode ? { publish_mode: publishMode } : {},
17932
18553
  ...consoleTemplateWarnings.length ? {
17933
18554
  warnings: consoleTemplateWarnings,
@@ -21359,7 +21980,7 @@ function registerConfigCommands(program2) {
21359
21980
  printResult(options.format, result);
21360
21981
  });
21361
21982
  }
21362
- const createCommand = domainCommand.command("create").description(domain === "flow-template" ? "Create a new main flow template through the typed adapter" : `Create a ${domain} config object through a verified typed adapter; dry-run unless --confirm is exact`).option("--profile <profile>", "Profile name").option("--confirm <text>", "Exact confirmation text").option("--publish-live", "For flow-template, publish the created flow to live after saving draft").option("--response-out <file>", "Write the full JSON response to a file").option("--format <format>", "Output format", "pretty");
21983
+ const createCommand = domainCommand.command("create").description(domain === "flow-template" ? "Create a new main flow template through the typed adapter" : domain === "page-template" ? "Create a page-template config object through the typed adapter; a verified preview manifest authorizes the write" : `Create a ${domain} config object through a verified typed adapter; dry-run unless --confirm is exact`).option("--profile <profile>", "Profile name").option("--confirm <text>", "Exact confirmation text").option("--publish-live", "For flow-template, publish the created flow to live after saving draft").option("--response-out <file>", "Write the full JSON response to a file").option("--format <format>", "Output format", "pretty");
21363
21984
  if (domain === "flow-template") {
21364
21985
  createCommand.requiredOption("--work <file>", "Flow-template work JSON file").option("--agent <agent>", "Agent adapter for installed plugin lint discovery", "codex");
21365
21986
  } else {
@@ -21552,7 +22173,7 @@ function registerConfigCommands(program2) {
21552
22173
  await writeResponseOut(options.out, output);
21553
22174
  printResult(options.format, output);
21554
22175
  });
21555
- domainCommand.command("submit").description(`Submit a ${domain} payload when a verified domain adapter is available; dry-run unless --confirm is exact`).requiredOption("--id <id>", "Remote config id").requiredOption("--payload <file>", "Submit payload JSON file produced by build").option("--profile <profile>", "Profile name").option("--agent <agent>", "Agent adapter for installed plugin lint discovery", "codex").option("--confirm <text>", "Exact confirmation text").option("--publish-live", "For flow-template, submit this payload as a live publish").option("--initialize-custom-key", "For a legacy dataset only, permit one-time empty custom_key initialization with an exact confirmation").option("--validation-report <file>", "Runtime/E2E permission matrix evidence bound to this submit payload").option("--override-reason <reason>", "Explicit audited reason for bypassing a required list-template validation report").option("--response-out <file>", "Write the full JSON response to a file").option("--format <format>", "Output format", "pretty").action(async (options) => {
22176
+ domainCommand.command("submit").description(`Submit a ${domain} payload when a verified domain adapter is available; page-template reuses a verified preview manifest and other domains require --confirm`).requiredOption("--id <id>", "Remote config id").requiredOption("--payload <file>", "Submit payload JSON file produced by build").option("--profile <profile>", "Profile name").option("--agent <agent>", "Agent adapter for installed plugin lint discovery", "codex").option("--confirm <text>", "Exact confirmation text").option("--dry-run", "Validate and print the submit result without writing remotely").option("--publish-live", "For flow-template, submit this payload as a live publish").option("--initialize-custom-key", "For a legacy dataset only, permit one-time empty custom_key initialization with an exact confirmation").option("--validation-report <file>", "Runtime/E2E permission matrix evidence bound to this submit payload").option("--override-reason <reason>", "Explicit audited reason for bypassing a required list-template validation report").option("--response-out <file>", "Write the full JSON response to a file").option("--format <format>", "Output format", "pretty").action(async (options) => {
21556
22177
  const configData = await loadConfig();
21557
22178
  const resolved = resolveProfile(configData, options.profile);
21558
22179
  const result = await submitConfigDomain(
@@ -21561,10 +22182,11 @@ function registerConfigCommands(program2) {
21561
22182
  domain,
21562
22183
  options.id,
21563
22184
  options.payload,
21564
- options.confirm,
22185
+ options.dryRun ? void 0 : options.confirm,
21565
22186
  {
21566
22187
  publishLive: Boolean(options.publishLive),
21567
22188
  agent: options.agent || "codex",
22189
+ dryRun: Boolean(options.dryRun),
21568
22190
  initializeDatasetCustomKey: Boolean(options.initializeCustomKey),
21569
22191
  validationReportFile: options.validationReport,
21570
22192
  overrideReason: options.overrideReason