7 return failed<void>(Status::Rejected,
RuleId(
"editing.package.empty-owner"),
8 "EditorPackage.ownerModule must not be empty");
10 return failed<void>(Status::Rejected,
RuleId(
"editing.package.incomplete"),
11 "EditorPackage is marked incomplete and Host rejected the mount");
13 const bool hasAutomationCommand = [&] {
15 if (command.automationAllowed)
return true;
19 if (hasAutomationCommand && package.
panels.empty())
20 return failed<void>(Status::Rejected,
RuleId(
"editing.package.panel-required"),
21 "Automation-allowed commands require at least one package panel");
24 if (panel.id.empty() || panel.region.empty() || panel.capability.empty() || panel.context.empty())
25 return failed<void>(Status::Rejected,
RuleId(
"editing.package.panel-incomplete"),
26 "EditorPanelSpec requires id, region, capability and context");
30 if (command.id.empty() || command.ownerModule.empty())
31 return failed<void>(Status::Rejected,
RuleId(
"editing.package.command-id"),
32 "Package commands require id and ownerModule");
34 return failed<void>(Status::Rejected,
RuleId(
"editing.package.command-owner"),
35 "Package command ownerModule must match package.ownerModule");
36 if (command.payloadSchema.typeId.empty() && command.payloadSchema.properties.empty())
37 return failed<void>(Status::Rejected,
RuleId(
"editing.package.payload-schema"),
38 "Package commands require an explicit payloadSchema (use emptyObject)");
39 if (command.automationAllowed) {
40 if (command.panelCapability.empty() || command.panelContext.empty())
41 return failed<void>(Status::Rejected,
RuleId(
"editing.package.panel-binding"),
42 "Automation-allowed commands require panelCapability and panelContext");
45 if (panel.capability == command.panelCapability && panel.context == command.panelContext) {
51 return failed<void>(Status::Rejected,
RuleId(
"editing.package.panel-binding-missing"),
52 "Command panelBinding does not match any package panel");
58 return failed<void>(Status::Rejected,
RuleId(
"editing.package.target-type"),
59 "Package targetTypes require a non-empty type");
60 if (
target.createSchema.typeId.empty() &&
target.createSchema.properties.empty())
61 return failed<void>(Status::Rejected,
RuleId(
"editing.package.create-schema"),
62 "Package targetTypes require an explicit createSchema (use emptyObject)");
65 return applied<void>();