bpmax-cli 0.2.1-beta.48 → 0.2.1-beta.49

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
@@ -299,6 +299,7 @@ function capabilityForRequest(method, path17) {
299
299
  if (normalizedMethod === "PUT" && /^\/workspace\/[^/]+$/.test(normalizedPath)) return "config.workspace.submit";
300
300
  if (normalizedMethod === "DELETE" && /^\/workspace\/[^/]+$/.test(normalizedPath)) return "config.workspace.delete";
301
301
  if (normalizedMethod === "GET" && normalizedPath === "/flow/flow_type") return "flow.list";
302
+ if (normalizedMethod === "GET" && normalizedPath === "/category/get_list_by_type") return "flow.list";
302
303
  if (normalizedMethod === "POST" && normalizedPath === "/flow/flow_type") return "config.flow_template.create";
303
304
  if (normalizedMethod === "GET" && normalizedPath === "/flow/options") return "flow.options";
304
305
  if (normalizedMethod === "GET" && normalizedPath === "/flow") return "config.flow_template.export";
@@ -497,7 +498,7 @@ function pluginAgentCapabilityForRequest(method, normalizedPath) {
497
498
  // package.json
498
499
  var package_default = {
499
500
  name: "bpmax-cli",
500
- version: "0.2.1-beta.48",
501
+ version: "0.2.1-beta.49",
501
502
  description: "CLI for BPMAX environments with multi-profile config and local login callback flow",
502
503
  type: "module",
503
504
  bin: {
@@ -5303,6 +5304,7 @@ function validateFlowTemplatePostCreateInitiatorStep(value, errors) {
5303
5304
  }
5304
5305
  function validateFlowAppFlowWork(value, errors, warnings) {
5305
5306
  validateFlowTemplateRemoteTemplateRefs(value, errors);
5307
+ validateFlowTemplateExpectedChildFlows(value, errors);
5306
5308
  validateFlowTemplateProjectAfterCreatePath(value, errors);
5307
5309
  validateFlowTemplateStandardPageCreateFormTemplate(value, errors);
5308
5310
  validateFlowTemplateStartConditionalJump(value, errors);
@@ -5359,6 +5361,7 @@ async function lintFlowAppWorkFiles(formWorkFile, flowWorkFile, options = {}) {
5359
5361
  let pluginLint;
5360
5362
  let stepDetailReferenceAudit;
5361
5363
  let flowReportReferenceAudit;
5364
+ let flowCategoryReferenceAudit;
5362
5365
  if (!isRecord4(formWork)) {
5363
5366
  formErrors.push("flow-app create requires form work to be a JSON object.");
5364
5367
  } else if (formWork.mode !== "create") {
@@ -5380,7 +5383,9 @@ async function lintFlowAppWorkFiles(formWorkFile, flowWorkFile, options = {}) {
5380
5383
  flowErrors.push(...pluginLint.errors);
5381
5384
  warnings.push(...pluginLint.warnings);
5382
5385
  }
5383
- if (options.pluginLint?.profile) {
5386
+ if (options.pluginLint?.profile && formErrors.length === 0 && flowErrors.length === 0) {
5387
+ flowCategoryReferenceAudit = await auditFlowCategoryReference(flowWork, options.pluginLint.profile);
5388
+ flowErrors.push(...flowCategoryReferenceAudit.errors);
5384
5389
  stepDetailReferenceAudit = await auditFlowStepDetailReferences(flowWork, options.pluginLint.profile);
5385
5390
  flowErrors.push(...stepDetailReferenceAudit.errors.filter((error) => !flowErrors.includes(error)));
5386
5391
  warnings.push(...stepDetailReferenceAudit.warnings);
@@ -5403,6 +5408,7 @@ async function lintFlowAppWorkFiles(formWorkFile, flowWorkFile, options = {}) {
5403
5408
  flow_template: flowErrors
5404
5409
  },
5405
5410
  ...pluginLint ? { plugin_lints: pluginLint.plugin_lints } : {},
5411
+ ...flowCategoryReferenceAudit ? { flow_category_reference: flowCategoryReferenceEvidence(flowCategoryReferenceAudit) } : {},
5406
5412
  ...stepDetailReferenceAudit ? {
5407
5413
  step_detail_references: stepDetailReferenceAudit.references,
5408
5414
  step_detail_warnings: stepDetailReferenceAudit.warnings,
@@ -6479,6 +6485,78 @@ function validateFlowTemplateRemoteTemplateRefs(value, errors) {
6479
6485
  }
6480
6486
  throw new Error(`flow-template online template reference gate failed: ${nextErrors.join("; ")}`);
6481
6487
  }
6488
+ function validateFlowTemplateExpectedChildFlows(value, errors) {
6489
+ const lint = isRecord4(value.bpmax_lint) ? value.bpmax_lint : {};
6490
+ const declarations = lint.expected_child_flows;
6491
+ if (declarations === void 0) return;
6492
+ const nextErrors = [];
6493
+ if (!Array.isArray(declarations)) {
6494
+ nextErrors.push("bpmax_lint.expected_child_flows must be an array.");
6495
+ } else {
6496
+ const data = isRecord4(value.data) ? value.data : {};
6497
+ const nodes = Array.isArray(data.nodes) ? data.nodes.map((node, index) => ({ node, index })).filter((entry) => isRecord4(entry.node)) : [];
6498
+ declarations.forEach((declaration, declarationIndex) => {
6499
+ const declarationPath = `bpmax_lint.expected_child_flows[${declarationIndex}]`;
6500
+ if (!isRecord4(declaration)) {
6501
+ nextErrors.push(`${declarationPath} must be an object.`);
6502
+ return;
6503
+ }
6504
+ const triggerNodeId = String(declaration.trigger_node_id ?? "").trim();
6505
+ const triggerNodeName = String(declaration.trigger_node_name ?? "").trim();
6506
+ const expectedFlow = String(declaration.flow ?? "").trim();
6507
+ if (!triggerNodeId && !triggerNodeName) {
6508
+ nextErrors.push(`${declarationPath} requires trigger_node_id or trigger_node_name.`);
6509
+ return;
6510
+ }
6511
+ if (!expectedFlow) {
6512
+ nextErrors.push(`${declarationPath}.flow must be the exact target context flow reference.`);
6513
+ return;
6514
+ }
6515
+ const matched = nodes.find(({ node }) => triggerNodeId ? String(node.id ?? "").trim() === triggerNodeId : String(node.name ?? "").trim() === triggerNodeName);
6516
+ if (!matched) {
6517
+ nextErrors.push(`${declarationPath} cannot resolve trigger node ${triggerNodeId || triggerNodeName}.`);
6518
+ return;
6519
+ }
6520
+ const nodePath = `data.nodes[${matched.index}]`;
6521
+ const autoTrigger = matched.node.auto_trigger_flows;
6522
+ if (!isRecord4(autoTrigger)) {
6523
+ nextErrors.push(`${nodePath}.auto_trigger_flows must be an object for declared child flow '${expectedFlow}'.`);
6524
+ return;
6525
+ }
6526
+ const flows = autoTrigger.flows;
6527
+ if (!Array.isArray(flows) || flows.length === 0) {
6528
+ nextErrors.push(`${nodePath}.auto_trigger_flows.flows is empty for declared child flow '${expectedFlow}'.`);
6529
+ return;
6530
+ }
6531
+ const flowIndex = flows.findIndex((item) => isRecord4(item) && String(item.flow ?? "").trim() === expectedFlow);
6532
+ if (flowIndex < 0) {
6533
+ nextErrors.push(`${nodePath}.auto_trigger_flows.flows does not reference declared child flow '${expectedFlow}'.`);
6534
+ return;
6535
+ }
6536
+ const flowItem = flows[flowIndex];
6537
+ const requireCreateRule = declaration.require_create_rule !== false;
6538
+ if (requireCreateRule && (typeof flowItem.create_rule !== "string" || !flowItem.create_rule.trim())) {
6539
+ nextErrors.push(`${nodePath}.auto_trigger_flows.flows[${flowIndex}].create_rule is required for declared child flow '${expectedFlow}'.`);
6540
+ }
6541
+ for (const field of ["create_again", "manual_end"]) {
6542
+ if (!Object.prototype.hasOwnProperty.call(autoTrigger, field) || typeof autoTrigger[field] !== "boolean") {
6543
+ nextErrors.push(`${nodePath}.auto_trigger_flows.${field} must be explicitly set to a boolean.`);
6544
+ }
6545
+ }
6546
+ for (const field of ["all_finish_action", "fail_action"]) {
6547
+ if (!Object.prototype.hasOwnProperty.call(autoTrigger, field) || typeof autoTrigger[field] !== "string") {
6548
+ nextErrors.push(`${nodePath}.auto_trigger_flows.${field} must be explicitly set to a string, including an intentional empty string.`);
6549
+ }
6550
+ }
6551
+ });
6552
+ }
6553
+ if (!nextErrors.length) return;
6554
+ if (errors) {
6555
+ errors.push(...nextErrors);
6556
+ return;
6557
+ }
6558
+ throw new Error(`flow-template expected child-flow gate failed: ${nextErrors.join("; ")}`);
6559
+ }
6482
6560
  function lintTemplateFieldReferences(value, errors) {
6483
6561
  const content = typeof value.content === "string" ? (() => {
6484
6562
  try {
@@ -6818,6 +6896,74 @@ async function auditFlowStepDetailReferences(flowWork, profile) {
6818
6896
  function flowStepDetailRuntimeProofRequired(audit) {
6819
6897
  return Boolean(audit?.references.some((reference) => reference.runtime_proof_required === true));
6820
6898
  }
6899
+ function flowCategoryRecords(value) {
6900
+ if (Array.isArray(value)) return value.filter(isRecord4);
6901
+ if (!isRecord4(value)) return [];
6902
+ for (const key of ["data", "list", "rows", "items"]) {
6903
+ if (Array.isArray(value[key])) return value[key].filter(isRecord4);
6904
+ }
6905
+ return [];
6906
+ }
6907
+ function usableFlowCategory(record) {
6908
+ const type = String(record.type ?? "flow").trim();
6909
+ const deleted = record.is_del === 1 || record.is_del === "1" || record.deleted === true;
6910
+ const disabled = record.enabled === false || record.status === 0 || record.status === "0";
6911
+ return type === "flow" && !deleted && !disabled && typeof record.key === "string" && record.key.trim().length > 0;
6912
+ }
6913
+ async function auditFlowCategoryReference(flowWork, profile) {
6914
+ const configuredKey = String(flowWork.category ?? "").trim() || "system";
6915
+ try {
6916
+ const response = await apiRequest(
6917
+ createApiClient(profile),
6918
+ "GET",
6919
+ "/category/get_list_by_type?type=flow",
6920
+ { capability: "flow.list" }
6921
+ );
6922
+ const categories = flowCategoryRecords(response).filter(usableFlowCategory);
6923
+ const availableKeys = [...new Set(categories.map((record) => String(record.key).trim()))].sort();
6924
+ if (!availableKeys.length) {
6925
+ return {
6926
+ errors: ["$.category cannot be validated because the current profile returned no active flow categories."],
6927
+ configuredKey,
6928
+ status: "unavailable",
6929
+ availableKeys,
6930
+ categories
6931
+ };
6932
+ }
6933
+ if (!availableKeys.includes(configuredKey)) {
6934
+ return {
6935
+ errors: [`$.category references unknown flow category '${configuredKey}'; available keys: ${availableKeys.join(", ")}.`],
6936
+ configuredKey,
6937
+ status: "invalid",
6938
+ availableKeys,
6939
+ categories
6940
+ };
6941
+ }
6942
+ return { errors: [], configuredKey, status: "verified", availableKeys, categories };
6943
+ } catch (error) {
6944
+ return {
6945
+ errors: [`$.category cannot be validated against the current profile: ${error instanceof Error ? error.message : String(error)}.`],
6946
+ configuredKey,
6947
+ status: "unavailable",
6948
+ availableKeys: [],
6949
+ categories: []
6950
+ };
6951
+ }
6952
+ }
6953
+ function flowCategoryReferenceEvidence(audit) {
6954
+ return {
6955
+ path: "$.category",
6956
+ configured_key: audit.configuredKey,
6957
+ status: audit.status,
6958
+ available_keys: audit.availableKeys,
6959
+ categories: audit.categories.map((record) => ({
6960
+ id: record.id ?? null,
6961
+ key: record.key,
6962
+ name: record.name ?? null,
6963
+ type: record.type ?? "flow"
6964
+ }))
6965
+ };
6966
+ }
6821
6967
  function flowTemplateScope(flowWork) {
6822
6968
  const data = isRecord4(flowWork.data) ? flowWork.data : {};
6823
6969
  const meta = isRecord4(data.meta) ? data.meta : {};
@@ -8358,6 +8504,7 @@ function normalizeFlowTemplatePayload(work) {
8358
8504
  }
8359
8505
  data.meta = meta;
8360
8506
  validateFlowTemplateRemoteTemplateRefs({ ...work, data });
8507
+ validateFlowTemplateExpectedChildFlows({ ...work, data });
8361
8508
  validateFlowTemplateProjectAfterCreatePath({ ...work, data });
8362
8509
  validateFlowTemplateStandardPageCreateFormTemplate({ ...work, data });
8363
8510
  validateFlowTemplateStartConditionalJump({ ...work, data });
@@ -11468,6 +11615,7 @@ async function createFlowTemplateFromWork(config, profile, workFile, confirm3, o
11468
11615
  throw new Error("flow-template create requires a work JSON object.");
11469
11616
  }
11470
11617
  validateFlowTemplateRemoteTemplateRefs(work);
11618
+ validateFlowTemplateExpectedChildFlows(work);
11471
11619
  validateFlowTemplateProjectAfterCreatePath(work);
11472
11620
  validateFlowTemplateStandardPageCreateFormTemplate(work);
11473
11621
  validateFlowTemplateStartConditionalJump(work);
@@ -11498,6 +11646,10 @@ async function createFlowTemplateFromWork(config, profile, workFile, confirm3, o
11498
11646
  if (pluginLint?.errors.length) {
11499
11647
  throw new Error(`flow-template plugin lint failed: ${pluginLint.errors.join("; ")}`);
11500
11648
  }
11649
+ const flowCategoryReferenceAudit = await auditFlowCategoryReference(work, profile);
11650
+ if (flowCategoryReferenceAudit.errors.length) {
11651
+ throw new Error(`flow-template category reference gate failed: ${flowCategoryReferenceAudit.errors.join("; ")}`);
11652
+ }
11501
11653
  const stepDetailReferenceAudit = await auditFlowStepDetailReferences(work, profile);
11502
11654
  if (stepDetailReferenceAudit.errors.length) {
11503
11655
  throw new Error(`flow-template step-detail reference gate failed: ${stepDetailReferenceAudit.errors.join("; ")}`);
@@ -11514,6 +11666,7 @@ async function createFlowTemplateFromWork(config, profile, workFile, confirm3, o
11514
11666
  create_endpoint: "/flow/flow_type",
11515
11667
  create_payload: createShell,
11516
11668
  draft_endpoint: "/flow?flow_type=<platform-flow-type>&publish=2",
11669
+ flow_category_reference: flowCategoryReferenceEvidence(flowCategoryReferenceAudit),
11517
11670
  step_detail_references: stepDetailReferenceAudit.references,
11518
11671
  step_detail_warnings: stepDetailReferenceAudit.warnings,
11519
11672
  flow_report_references: flowReportReferenceAudit.references,
@@ -11577,6 +11730,7 @@ async function createFlowTemplateFromWork(config, profile, workFile, confirm3, o
11577
11730
  create_response: createResponse,
11578
11731
  draft_endpoint: draftEndpoint,
11579
11732
  draft_response: draftResponse,
11733
+ flow_category_reference: flowCategoryReferenceEvidence(flowCategoryReferenceAudit),
11580
11734
  step_detail_references: stepDetailReferenceAudit.references,
11581
11735
  step_detail_warnings: stepDetailReferenceAudit.warnings,
11582
11736
  flow_report_references: flowReportReferenceAudit.references,
@@ -11608,6 +11762,11 @@ async function createFlowAppFromWork(config, profile, formWorkFile, flowWorkFile
11608
11762
  if (!name) {
11609
11763
  throw new Error("flow-app create requires name.");
11610
11764
  }
11765
+ const expectedConfirm = `create flow-app ${name} in ${workspace}`;
11766
+ const acceptedConfirmWithWorkspacePrefix = `create flow-app ${name} in w:${workspace}`;
11767
+ if (confirm3 !== void 0 && confirm3 !== "") {
11768
+ exactConfirmOrDryRun(confirm3, expectedConfirm, { equivalentConfirms: [acceptedConfirmWithWorkspacePrefix] });
11769
+ }
11611
11770
  const formWork = await readJsonFile(formWorkFile);
11612
11771
  const flowWork = await readJsonFile(flowWorkFile);
11613
11772
  if (!isRecord4(formWork) || formWork.mode !== "create") {
@@ -11646,8 +11805,6 @@ async function createFlowAppFromWork(config, profile, formWorkFile, flowWorkFile
11646
11805
  periods: []
11647
11806
  }
11648
11807
  };
11649
- const expectedConfirm = `create flow-app ${name} in ${workspace}`;
11650
- const acceptedConfirmWithWorkspacePrefix = `create flow-app ${name} in w:${workspace}`;
11651
11808
  const dryRunPlan = {
11652
11809
  operations: [
11653
11810
  { step: "create_form_template", method: "POST", path: "/form_template", payload: formPayload },
@@ -12786,6 +12943,7 @@ async function verifyConfigDomain(config, profile, domain, id, options = {}) {
12786
12943
  let stepDetailReferenceAudit;
12787
12944
  let flowReportAnalysis;
12788
12945
  let flowReportReferenceAudit;
12946
+ let flowCategoryReferenceAudit;
12789
12947
  if (domain === "step-detail-template" && isRecord4(actual)) {
12790
12948
  stepDetailAnalysis = analyzeStepDetailTemplate(actual, { allowUndeclaredCustomModules: true });
12791
12949
  structuralErrors.push(...stepDetailAnalysis.errors);
@@ -12802,6 +12960,8 @@ async function verifyConfigDomain(config, profile, domain, id, options = {}) {
12802
12960
  verificationWarnings.push(...flowReportAnalysis.warnings);
12803
12961
  }
12804
12962
  if (domain === "flow-template" && isRecord4(actual)) {
12963
+ flowCategoryReferenceAudit = await auditFlowCategoryReference(actual, profile);
12964
+ semanticErrors.push(...flowCategoryReferenceAudit.errors);
12805
12965
  stepDetailReferenceAudit = await auditFlowStepDetailReferences(actual, profile);
12806
12966
  semanticErrors.push(...stepDetailReferenceAudit.errors);
12807
12967
  verificationWarnings.push(...stepDetailReferenceAudit.warnings);
@@ -12850,6 +13010,7 @@ async function verifyConfigDomain(config, profile, domain, id, options = {}) {
12850
13010
  }
12851
13011
  } : {},
12852
13012
  ...stepDetailReferenceAudit ? { step_detail_references: stepDetailReferenceAudit.references } : {},
13013
+ ...flowCategoryReferenceAudit ? { flow_category_reference: flowCategoryReferenceEvidence(flowCategoryReferenceAudit) } : {},
12853
13014
  ...flowReportAnalysis ? {
12854
13015
  flow_report_template: {
12855
13016
  fields: flowReportAnalysis.fields,
@@ -13228,12 +13389,17 @@ async function buildConfigSubmitPayload(domain, workFile, outFile, metaFile, opt
13228
13389
  let stepDetailAnalysis;
13229
13390
  let flowReportAnalysis;
13230
13391
  let flowReportReferenceAudit;
13392
+ let flowCategoryReferenceAudit;
13231
13393
  if (domain === "flow-template" && isRecord4(work)) {
13232
13394
  const pluginLint = await runFlowTemplatePluginLint(work, options.pluginLint);
13233
13395
  if (pluginLint?.errors.length) {
13234
13396
  throw new Error(`flow-template plugin lint failed: ${pluginLint.errors.join("; ")}`);
13235
13397
  }
13236
13398
  if (options.pluginLint?.profile) {
13399
+ flowCategoryReferenceAudit = await auditFlowCategoryReference(work, options.pluginLint.profile);
13400
+ if (flowCategoryReferenceAudit.errors.length) {
13401
+ throw new Error(`flow-template category reference gate failed: ${flowCategoryReferenceAudit.errors.join("; ")}`);
13402
+ }
13237
13403
  stepDetailReferenceAudit = await auditFlowStepDetailReferences(work, options.pluginLint.profile);
13238
13404
  if (stepDetailReferenceAudit.errors.length) {
13239
13405
  throw new Error(`flow-template step-detail reference gate failed: ${stepDetailReferenceAudit.errors.join("; ")}`);
@@ -13295,6 +13461,7 @@ async function buildConfigSubmitPayload(domain, workFile, outFile, metaFile, opt
13295
13461
  meta: submitMeta,
13296
13462
  base_hash: createMode ? null : typeof meta.base_hash === "string" ? meta.base_hash : null,
13297
13463
  payload,
13464
+ ...flowCategoryReferenceAudit ? { flow_category_reference: flowCategoryReferenceEvidence(flowCategoryReferenceAudit) } : {},
13298
13465
  ...formTemplateWarnings.length ? { form_template_warnings: formTemplateWarnings } : {},
13299
13466
  ...flowDetailTemplateWarnings.length ? { flow_detail_template_warnings: flowDetailTemplateWarnings } : {},
13300
13467
  ...stepDetailReferenceAudit ? {
@@ -13454,6 +13621,7 @@ async function lintConfigWorkFile(file, options = {}) {
13454
13621
  const errors = [];
13455
13622
  const warnings = [];
13456
13623
  let pluginLint;
13624
+ let flowCategoryReferenceAudit;
13457
13625
  let stepDetailAnalysis;
13458
13626
  let stepDetailReferenceAudit;
13459
13627
  let flowReportAnalysis;
@@ -13510,6 +13678,7 @@ async function lintConfigWorkFile(file, options = {}) {
13510
13678
  if (isFlowTemplateWork(value)) {
13511
13679
  const flowWork = value;
13512
13680
  validateFlowTemplateRemoteTemplateRefs(flowWork, errors);
13681
+ validateFlowTemplateExpectedChildFlows(flowWork, errors);
13513
13682
  validateFlowTemplateProjectAfterCreatePath(flowWork, errors);
13514
13683
  validateFlowTemplateStandardPageCreateFormTemplate(flowWork, errors);
13515
13684
  validateFlowTemplateStartConditionalJump(flowWork, errors);
@@ -13527,6 +13696,8 @@ async function lintConfigWorkFile(file, options = {}) {
13527
13696
  }
13528
13697
  const profile = options.pluginLint?.profile;
13529
13698
  if (profile) {
13699
+ flowCategoryReferenceAudit = await auditFlowCategoryReference(flowWork, profile);
13700
+ errors.push(...flowCategoryReferenceAudit.errors.filter((error) => !errors.includes(error)));
13530
13701
  stepDetailReferenceAudit = await auditFlowStepDetailReferences(flowWork, profile);
13531
13702
  errors.push(...stepDetailReferenceAudit.errors.filter((error) => !errors.includes(error)));
13532
13703
  warnings.push(...stepDetailReferenceAudit.warnings);
@@ -13561,6 +13732,7 @@ async function lintConfigWorkFile(file, options = {}) {
13561
13732
  step_detail_references: stepDetailReferenceAudit.references,
13562
13733
  runtime_proof_required: flowStepDetailRuntimeProofRequired(stepDetailReferenceAudit)
13563
13734
  } : {},
13735
+ ...flowCategoryReferenceAudit ? { flow_category_reference: flowCategoryReferenceEvidence(flowCategoryReferenceAudit) } : {},
13564
13736
  ...flowReportAnalysis ? {
13565
13737
  flow_report_template: {
13566
13738
  fields: flowReportAnalysis.fields,
@@ -14056,8 +14228,10 @@ async function submitConfigDomain(config, profile, domain, id, submitFile, confi
14056
14228
  await ensureConfigCapability(profile, `${definition.capability}.export`);
14057
14229
  let stepDetailReferenceAudit;
14058
14230
  let flowReportReferenceAudit;
14231
+ let flowCategoryReferenceAudit;
14059
14232
  if (domain === "flow-template") {
14060
14233
  validateFlowTemplateRemoteTemplateRefs(submit.payload);
14234
+ validateFlowTemplateExpectedChildFlows(submit.payload);
14061
14235
  validateFlowTemplateProjectAfterCreatePath(submit.payload);
14062
14236
  validateFlowTemplateStandardPageCreateFormTemplate(submit.payload);
14063
14237
  validateFlowTemplateStartConditionalJump(submit.payload);
@@ -14077,6 +14251,10 @@ async function submitConfigDomain(config, profile, domain, id, submitFile, confi
14077
14251
  if (pluginLint?.errors.length) {
14078
14252
  throw new Error(`flow-template plugin lint failed: ${pluginLint.errors.join("; ")}`);
14079
14253
  }
14254
+ flowCategoryReferenceAudit = await auditFlowCategoryReference(submit.payload, profile);
14255
+ if (flowCategoryReferenceAudit.errors.length) {
14256
+ throw new Error(`flow-template category reference gate failed: ${flowCategoryReferenceAudit.errors.join("; ")}`);
14257
+ }
14080
14258
  stepDetailReferenceAudit = await auditFlowStepDetailReferences(submit.payload, profile);
14081
14259
  if (stepDetailReferenceAudit.errors.length) {
14082
14260
  throw new Error(`flow-template step-detail reference gate failed: ${stepDetailReferenceAudit.errors.join("; ")}`);
@@ -14251,6 +14429,7 @@ async function submitConfigDomain(config, profile, domain, id, submitFile, confi
14251
14429
  method: definition.submitMethod,
14252
14430
  payload: submitPayload,
14253
14431
  ...publishMode ? { publish_mode: publishMode } : {},
14432
+ ...flowCategoryReferenceAudit ? { flow_category_reference: flowCategoryReferenceEvidence(flowCategoryReferenceAudit) } : {},
14254
14433
  ...stepDetailReferenceAudit ? {
14255
14434
  step_detail_references: stepDetailReferenceAudit.references,
14256
14435
  step_detail_warnings: stepDetailReferenceAudit.warnings,
@@ -14342,6 +14521,7 @@ async function submitConfigDomain(config, profile, domain, id, submitFile, confi
14342
14521
  endpoint,
14343
14522
  method: definition.submitMethod,
14344
14523
  ...publishMode ? { publish_mode: publishMode } : {},
14524
+ ...flowCategoryReferenceAudit ? { flow_category_reference: flowCategoryReferenceEvidence(flowCategoryReferenceAudit) } : {},
14345
14525
  ...stepDetailReferenceAudit ? {
14346
14526
  step_detail_references: stepDetailReferenceAudit.references,
14347
14527
  step_detail_warnings: stepDetailReferenceAudit.warnings,
@@ -26932,6 +27112,39 @@ function validateConfigRuleForTaskRow(row, rule, issues) {
26932
27112
  function validateTaskbookConfigSkillGates(text5, issues) {
26933
27113
  const rows2 = extractTaskRows(text5);
26934
27114
  for (const row of rows2) {
27115
+ const taskId = row.task_id || "<unknown>";
27116
+ const taskText = `${row.business_goal || ""} ${row.evidence || ""} ${row.notes || ""}`;
27117
+ const taskEvidence = row.evidence || "";
27118
+ const completed = /^(?:已完成|完成|done|completed)$/i.test((row.status || "").trim());
27119
+ const childFlowTask = /子流程|父子流程|child[- ]?flow|auto_trigger_flows/i.test(taskText);
27120
+ const linkagePending = /待(?:后续)?联动配置|待联动配置|待回填|待补配/i.test(taskText);
27121
+ const runtimeChildCreationEvidence = /运行态.{0,20}自动创建.{0,20}子项目|父项目.{0,20}触发.{0,20}子项目|runtime.{0,20}(?:auto(?:matic)?(?:ally)?[- ]?)?creat(?:e|ed|ion).{0,20}child[- ]?project/i.test(taskEvidence);
27122
+ if (completed && childFlowTask && linkagePending) {
27123
+ addTaskbookIssue(
27124
+ issues,
27125
+ "completed_child_flow_linkage_pending",
27126
+ "taskbook.flow.child_linkage_completion",
27127
+ `\u4EFB\u52A1 ${taskId} \u4ECD\u6709\u7236\u5B50\u6D41\u7A0B\u8054\u52A8\u5F85\u529E\uFF0C\u4E0D\u80FD\u6807\u8BB0\u4E3A\u5B8C\u6210\u3002`,
27128
+ {
27129
+ domain: "flow-template",
27130
+ path: `tasks.${taskId}.status`,
27131
+ suggestion: "\u5148\u56DE\u586B bpmax_lint.expected_child_flows \u548C auto_trigger_flows.flows\uFF0C\u5B8C\u6210 typed verify \u4E0E\u8FD0\u884C\u6001\u81EA\u52A8\u521B\u5EFA\u5B50\u9879\u76EE\u9A8C\u6536\u3002"
27132
+ }
27133
+ );
27134
+ }
27135
+ if (completed && childFlowTask && !runtimeChildCreationEvidence) {
27136
+ addTaskbookIssue(
27137
+ issues,
27138
+ "completed_child_flow_runtime_evidence_missing",
27139
+ "taskbook.flow.child_runtime_completion",
27140
+ `\u4EFB\u52A1 ${taskId} \u7F3A\u5C11\u8FD0\u884C\u6001\u81EA\u52A8\u521B\u5EFA\u5B50\u9879\u76EE\u8BC1\u636E\uFF0C\u4E0D\u80FD\u6807\u8BB0\u4E3A\u5B8C\u6210\u3002`,
27141
+ {
27142
+ domain: "flow-template",
27143
+ path: `tasks.${taskId}.evidence`,
27144
+ suggestion: "\u65B0\u5EFA\u7236\u9879\u76EE\u5E76\u63A8\u8FDB\u5230\u89E6\u53D1\u8282\u70B9\uFF0C\u8BB0\u5F55\u81EA\u52A8\u521B\u5EFA\u5B50\u9879\u76EE\u6570\u91CF\u3001\u7236\u5B50\u5173\u8054\u3001\u5B57\u6BB5\u7EE7\u627F\u4E0E\u6C47\u5408\u7ED3\u679C\u3002"
27145
+ }
27146
+ );
27147
+ }
26935
27148
  for (const rule of CONFIG_TASK_RULES) {
26936
27149
  validateConfigRuleForTaskRow(row, rule, issues);
26937
27150
  }