@cosmicdrift/kumiko-framework 0.414.0 → 0.416.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (115) hide show
  1. package/agents/api/framework-engine.md +46 -8
  2. package/agents/api/framework-errors.md +1 -1
  3. package/agents/api/framework-ui-types.md +69 -4
  4. package/agents/api/renderer-web.md +27 -4
  5. package/agents/api/types.md +68 -16
  6. package/agents/api.md +2 -2
  7. package/agents/boot-rules.md +39 -7
  8. package/agents/examples/crypto-shredding-hr.md +63 -1
  9. package/agents/examples/embedded.md +24 -1
  10. package/agents/examples/handbook-knowledge.md +129 -0
  11. package/agents/examples/record-detail-layout.md +113 -7
  12. package/agents/examples/signature.md +186 -0
  13. package/agents/examples/writeform-section.md +1 -0
  14. package/agents/examples.md +2 -0
  15. package/agents/features-index.md +4 -0
  16. package/agents/features.md +14 -0
  17. package/agents/widgets.md +7 -0
  18. package/dist/api/request-context-internals.d.ts +2 -0
  19. package/dist/api/request-context-scopes.js +9 -2
  20. package/dist/api/request-context.js +1 -1
  21. package/dist/api/routes.js +4 -4
  22. package/dist/api/server-event-dispatcher.js +3 -0
  23. package/dist/api/server-routes.js +2 -0
  24. package/dist/db/parent-ref-clause.js +31 -3
  25. package/dist/db/parent-ref-global-hosts.d.ts +4 -1
  26. package/dist/db/parent-ref-global-hosts.js +50 -12
  27. package/dist/db/queries/rls-boot-catalog.js +5 -6
  28. package/dist/db/queries/rls-shape.d.ts +1 -0
  29. package/dist/db/queries/rls-shape.js +21 -6
  30. package/dist/db/table-builder.js +3 -1
  31. package/dist/engine/boot-validator/boot-phases.js +5 -0
  32. package/dist/engine/boot-validator/boot-rules.d.ts +144 -9
  33. package/dist/engine/boot-validator/card-meta-overflow-rules.d.ts +2 -2
  34. package/dist/engine/boot-validator/card-meta-overflow-rules.js +2 -2
  35. package/dist/engine/boot-validator/card-meta-overflow.js +7 -5
  36. package/dist/engine/boot-validator/cross-tenant-file-read.d.ts +3 -0
  37. package/dist/engine/boot-validator/cross-tenant-file-read.js +19 -0
  38. package/dist/engine/boot-validator/entity-declaration-rules.d.ts +10 -0
  39. package/dist/engine/boot-validator/entity-declaration-rules.js +10 -0
  40. package/dist/engine/boot-validator/entity-list-screens.js +2 -7
  41. package/dist/engine/boot-validator/list-row-guidance-rules.d.ts +17 -2
  42. package/dist/engine/boot-validator/list-row-guidance-rules.js +17 -2
  43. package/dist/engine/boot-validator/list-row-guidance.d.ts +7 -0
  44. package/dist/engine/boot-validator/list-row-guidance.js +45 -1
  45. package/dist/engine/boot-validator/list-sort-summary-rules.d.ts +2 -2
  46. package/dist/engine/boot-validator/list-sort-summary-rules.js +2 -2
  47. package/dist/engine/boot-validator/list-sort-summary.js +31 -20
  48. package/dist/engine/boot-validator/list-toolbar-options.js +3 -4
  49. package/dist/engine/boot-validator/named-filter-rules.d.ts +10 -0
  50. package/dist/engine/boot-validator/named-filter-rules.js +10 -0
  51. package/dist/engine/boot-validator/projection-list-screens.js +5 -4
  52. package/dist/engine/boot-validator/query-output-columns.js +18 -0
  53. package/dist/engine/boot-validator/query-output-guidance.js +3 -0
  54. package/dist/engine/boot-validator/query-refs.js +14 -1
  55. package/dist/engine/boot-validator/relative-time-format.d.ts +1 -0
  56. package/dist/engine/boot-validator/relative-time-format.js +51 -0
  57. package/dist/engine/boot-validator/screens-actions-rules.d.ts +16 -1
  58. package/dist/engine/boot-validator/screens-actions-rules.js +16 -1
  59. package/dist/engine/boot-validator/screens-actions.js +56 -16
  60. package/dist/engine/boot-validator/screens-dashboard-narrow.d.ts +2 -1
  61. package/dist/engine/boot-validator/screens-dashboard-narrow.js +43 -4
  62. package/dist/engine/boot-validator/screens-dashboard-rules.d.ts +12 -2
  63. package/dist/engine/boot-validator/screens-dashboard-rules.js +12 -2
  64. package/dist/engine/boot-validator/screens-dashboard.js +2 -1
  65. package/dist/engine/boot-validator/screens-forms-layout-rules.d.ts +5 -0
  66. package/dist/engine/boot-validator/screens-forms-layout-rules.js +5 -0
  67. package/dist/engine/boot-validator/screens-forms-rules.d.ts +60 -0
  68. package/dist/engine/boot-validator/screens-forms-rules.js +60 -0
  69. package/dist/engine/boot-validator/screens-forms.d.ts +1 -1
  70. package/dist/engine/boot-validator/screens-forms.js +108 -2
  71. package/dist/engine/boot-validator/screens-kind-config-edit.js +1 -0
  72. package/dist/engine/boot-validator/screens-kind-projection-detail-rules.d.ts +5 -0
  73. package/dist/engine/boot-validator/screens-kind-projection-detail-rules.js +5 -0
  74. package/dist/engine/boot-validator/screens-kind-projection-detail.js +30 -0
  75. package/dist/engine/boot-validator/screens-lists-rules.d.ts +5 -0
  76. package/dist/engine/boot-validator/screens-lists-rules.js +5 -0
  77. package/dist/engine/boot-validator/screens-lists.js +4 -1
  78. package/dist/engine/build-config-feature-schema.js +5 -35
  79. package/dist/engine/config-access-rules.d.ts +3 -0
  80. package/dist/engine/config-access-rules.js +34 -0
  81. package/dist/engine/factories.d.ts +2 -0
  82. package/dist/engine/named-filter-roles.js +6 -14
  83. package/dist/engine/project-app-schema-for-roles.js +2 -0
  84. package/dist/engine/schema-builder.js +3 -1
  85. package/dist/engine/soft-delete-cleanup.js +2 -0
  86. package/dist/errors/reasons.d.ts +1 -0
  87. package/dist/errors/reasons.js +4 -0
  88. package/dist/files/file-routes.d.ts +2 -0
  89. package/dist/files/file-routes.js +85 -22
  90. package/dist/files/foreign-tenant-file-read.d.ts +13 -0
  91. package/dist/files/foreign-tenant-file-read.js +64 -0
  92. package/dist/i18n/required-surface-keys.js +28 -7
  93. package/dist/jobs/job-runner-execution.js +3 -0
  94. package/dist/jobs/job-runner-types.d.ts +1 -0
  95. package/dist/jobs/job-runner.js +8 -0
  96. package/dist/pipeline/context-services.d.ts +1 -1
  97. package/dist/pipeline/context-services.js +1 -1
  98. package/dist/pipeline/event-dispatcher-delivery.js +3 -0
  99. package/dist/pipeline/event-dispatcher.d.ts +2 -0
  100. package/dist/pipeline/handler-context-phase-denials.js +1 -1
  101. package/dist/pipeline/irreversible-operation-gate.js +36 -10
  102. package/dist/search/meilisearch-adapter-internals.d.ts +2 -0
  103. package/dist/search/meilisearch-adapter-internals.js +5 -0
  104. package/dist/search/meilisearch-adapter.d.ts +1 -0
  105. package/dist/search/meilisearch-adapter.js +3 -2
  106. package/dist/ui-types/card-column-roles.d.ts +2 -0
  107. package/dist/ui-types/card-column-roles.js +15 -0
  108. package/dist/ui-types/index.d.ts +2 -2
  109. package/dist/ui-types/index.js +1 -1
  110. package/package.json +3 -3
  111. package/presets/biome-plugins/no-date-api.grit +3 -1
  112. package/presets/biome-plugins/no-direct-fetch.grit +1 -1
  113. package/presets/biome-plugins/unsafe-json-parse.grit +7 -1
  114. package/presets/biome-rules.json +12 -10
  115. package/src/changes.json +99 -0
@@ -5,7 +5,7 @@ import { validateListRowGuidance } from "./list-row-guidance.js";
5
5
  import { assertWriteHandlerRegistered, isRowClickAction, resolveRowActionNavigateTarget, resolveScreenTargetQn, validateActionHasIcon, validateClientActionName, validateRowActionNavigateParams, } from "./screens-actions.js";
6
6
  import { DASHBOARD_CHART_RULES } from "./screens-dashboard-chart-rules.js";
7
7
  import { validateDashboardPanelLink, validateListRowLinkTarget, } from "./screens-dashboard-links.js";
8
- import { validateDashboardPanelNarrow, validateListRowLinkShape, } from "./screens-dashboard-narrow.js";
8
+ import { validateDashboardLayout, validateDashboardPanelNarrow, validateListRowLinkShape, } from "./screens-dashboard-narrow.js";
9
9
  import { DASHBOARD_RULES } from "./screens-dashboard-rules.js";
10
10
  import { assertRefTargetRegistered, validateColumnRendererForm } from "./screens-lists.js";
11
11
  // Panel-driven, no entity — structural checks (unique panel ids, non-empty
@@ -18,6 +18,7 @@ export function validateDashboardScreen(featureName, screenId, screen, featureMa
18
18
  `declare at least one panel.`,
19
19
  });
20
20
  }
21
+ validateDashboardLayout(featureName, screenId, screen);
21
22
  const panelIds = new Set();
22
23
  const addPanelId = (id, context) => {
23
24
  if (panelIds.has(id)) {
@@ -89,6 +89,11 @@ export declare const FORM_LAYOUT_RULES: {
89
89
  readonly summary: "Inline form layouts have no relatedList sections.";
90
90
  readonly fix: "Move the section to a projectionDetail screen or remove it.";
91
91
  };
92
+ readonly stepListSectionUnsupported: {
93
+ readonly id: "form/step-list-section-unsupported";
94
+ readonly summary: "Inline form layouts have no stepList sections.";
95
+ readonly fix: "Move the section to a projectionDetail screen or remove it.";
96
+ };
92
97
  readonly writeFormSectionUnsupported: {
93
98
  readonly id: "form/write-form-section-unsupported";
94
99
  readonly summary: "Inline form layouts have no writeForm sections.";
@@ -89,6 +89,11 @@ export const FORM_LAYOUT_RULES = {
89
89
  summary: "Inline form layouts have no relatedList sections.",
90
90
  fix: "Move the section to a projectionDetail screen or remove it.",
91
91
  },
92
+ stepListSectionUnsupported: {
93
+ id: "form/step-list-section-unsupported",
94
+ summary: "Inline form layouts have no stepList sections.",
95
+ fix: "Move the section to a projectionDetail screen or remove it.",
96
+ },
92
97
  writeFormSectionUnsupported: {
93
98
  id: "form/write-form-section-unsupported",
94
99
  summary: "Inline form layouts have no writeForm sections.",
@@ -44,6 +44,66 @@ export declare const FORM_FIELD_RULES: {
44
44
  readonly summary: "fillAction does not target a sensitive, writeOnly or password field.";
45
45
  readonly fix: "Remove fillAction.";
46
46
  };
47
+ readonly fieldDescriptionUnknownField: {
48
+ readonly id: "form/field-description-unknown-field";
49
+ readonly summary: "actionForm fieldDescriptions keys name fields of the form.";
50
+ readonly fix: "Name a field of the form or remove the entry.";
51
+ };
52
+ readonly fieldTextParamUnknownField: {
53
+ readonly id: "form/field-text-param-unknown-field";
54
+ readonly summary: "actionForm fieldLabels and fieldDescriptions params name fields of the form.";
55
+ readonly fix: "Point each param at a field of the form or use the plain i18n key.";
56
+ };
57
+ readonly fieldBadgeUnknownField: {
58
+ readonly id: "form/field-badge-unknown-field";
59
+ readonly summary: "actionForm fieldBadges keys name fields of the form.";
60
+ readonly fix: "Name a field of the form or remove the entry.";
61
+ };
62
+ readonly aiAssistContextFieldUnknown: {
63
+ readonly id: "form/ai-assist-context-field-unknown";
64
+ readonly summary: "aiAssist.contextFields names fields of the same form.";
65
+ readonly fix: "Name other fields of the same form or remove the entry.";
66
+ };
67
+ readonly aiAssistFieldType: {
68
+ readonly id: "form/ai-assist-field-type";
69
+ readonly summary: "aiAssist targets a text or longText field.";
70
+ readonly fix: "Remove aiAssist or use a text or longText field.";
71
+ };
72
+ readonly aiAssistSensitiveField: {
73
+ readonly id: "form/ai-assist-sensitive-field";
74
+ readonly summary: "aiAssist does not target a sensitive, writeOnly or password field.";
75
+ readonly fix: "Remove aiAssist; the field text would be sent to the AI.";
76
+ };
77
+ readonly aiAssistChipInvalid: {
78
+ readonly id: "form/ai-assist-chip-invalid";
79
+ readonly summary: "An aiAssist chip has a label and at least one param.";
80
+ readonly fix: 'Set a non-empty label and params such as { style: "short" }.';
81
+ };
82
+ readonly aiAssistResultFieldEmpty: {
83
+ readonly id: "form/ai-assist-result-field-empty";
84
+ readonly summary: "aiAssist names a non-empty resultField.";
85
+ readonly fix: "Set resultField to the key of the query result that holds the text.";
86
+ };
87
+ readonly aiAssistPromptParamEmpty: {
88
+ readonly id: "form/ai-assist-prompt-param-empty";
89
+ readonly summary: "aiAssist.prompt names a non-empty param.";
90
+ readonly fix: "Set prompt.param to the query payload key that receives the typed instruction.";
91
+ };
92
+ readonly aiAssistEmpty: {
93
+ readonly id: "form/ai-assist-empty";
94
+ readonly summary: "aiAssist declares at least one chip or a prompt.";
95
+ readonly fix: "Add chips or prompt, or remove aiAssist.";
96
+ };
97
+ readonly valueChipsFieldType: {
98
+ readonly id: "form/value-chips-field-type";
99
+ readonly summary: "valueChips targets a number, decimal, bigInt or money field.";
100
+ readonly fix: "Remove valueChips or use a numeric or money field.";
101
+ };
102
+ readonly valueChipsUnknownField: {
103
+ readonly id: "form/value-chips-unknown-field";
104
+ readonly summary: "valueChips.from names a field of the same form.";
105
+ readonly fix: "Name a field of the same form (hidden and submit: false is fine) that holds the numbers.";
106
+ };
47
107
  readonly requiredFieldWithoutWidget: {
48
108
  readonly id: "form/required-field-without-widget";
49
109
  readonly summary: "A required entityEdit field has a widget to fill it.";
@@ -44,6 +44,66 @@ export const FORM_FIELD_RULES = {
44
44
  summary: "fillAction does not target a sensitive, writeOnly or password field.",
45
45
  fix: "Remove fillAction.",
46
46
  },
47
+ fieldDescriptionUnknownField: {
48
+ id: "form/field-description-unknown-field",
49
+ summary: "actionForm fieldDescriptions keys name fields of the form.",
50
+ fix: "Name a field of the form or remove the entry.",
51
+ },
52
+ fieldTextParamUnknownField: {
53
+ id: "form/field-text-param-unknown-field",
54
+ summary: "actionForm fieldLabels and fieldDescriptions params name fields of the form.",
55
+ fix: "Point each param at a field of the form or use the plain i18n key.",
56
+ },
57
+ fieldBadgeUnknownField: {
58
+ id: "form/field-badge-unknown-field",
59
+ summary: "actionForm fieldBadges keys name fields of the form.",
60
+ fix: "Name a field of the form or remove the entry.",
61
+ },
62
+ aiAssistContextFieldUnknown: {
63
+ id: "form/ai-assist-context-field-unknown",
64
+ summary: "aiAssist.contextFields names fields of the same form.",
65
+ fix: "Name other fields of the same form or remove the entry.",
66
+ },
67
+ aiAssistFieldType: {
68
+ id: "form/ai-assist-field-type",
69
+ summary: "aiAssist targets a text or longText field.",
70
+ fix: "Remove aiAssist or use a text or longText field.",
71
+ },
72
+ aiAssistSensitiveField: {
73
+ id: "form/ai-assist-sensitive-field",
74
+ summary: "aiAssist does not target a sensitive, writeOnly or password field.",
75
+ fix: "Remove aiAssist; the field text would be sent to the AI.",
76
+ },
77
+ aiAssistChipInvalid: {
78
+ id: "form/ai-assist-chip-invalid",
79
+ summary: "An aiAssist chip has a label and at least one param.",
80
+ fix: 'Set a non-empty label and params such as { style: "short" }.',
81
+ },
82
+ aiAssistResultFieldEmpty: {
83
+ id: "form/ai-assist-result-field-empty",
84
+ summary: "aiAssist names a non-empty resultField.",
85
+ fix: "Set resultField to the key of the query result that holds the text.",
86
+ },
87
+ aiAssistPromptParamEmpty: {
88
+ id: "form/ai-assist-prompt-param-empty",
89
+ summary: "aiAssist.prompt names a non-empty param.",
90
+ fix: "Set prompt.param to the query payload key that receives the typed instruction.",
91
+ },
92
+ aiAssistEmpty: {
93
+ id: "form/ai-assist-empty",
94
+ summary: "aiAssist declares at least one chip or a prompt.",
95
+ fix: "Add chips or prompt, or remove aiAssist.",
96
+ },
97
+ valueChipsFieldType: {
98
+ id: "form/value-chips-field-type",
99
+ summary: "valueChips targets a number, decimal, bigInt or money field.",
100
+ fix: "Remove valueChips or use a numeric or money field.",
101
+ },
102
+ valueChipsUnknownField: {
103
+ id: "form/value-chips-unknown-field",
104
+ summary: "valueChips.from names a field of the same form.",
105
+ fix: "Name a field of the same form (hidden and submit: false is fine) that holds the numbers.",
106
+ },
47
107
  requiredFieldWithoutWidget: {
48
108
  id: "form/required-field-without-widget",
49
109
  summary: "A required entityEdit field has a widget to fill it.",
@@ -9,7 +9,7 @@ export declare function validateFillActionTarget(where: string, fieldSpec: Exclu
9
9
  readonly type: string;
10
10
  } | undefined): void;
11
11
  export declare function validateNoWidgetRequiredField(featureName: string, screenId: string, entityDef: EntityDefinition, fieldSpec: Exclude<EditFieldSpec, string>): void;
12
- export declare function validateTabSections(featureName: string, screenId: string, screenType: "projectionDetail" | "entityEdit", sections: readonly {
12
+ export declare function validateTabSections(featureName: string, screenId: string, screenType: "projectionDetail" | "entityEdit", allSections: readonly {
13
13
  readonly id?: string;
14
14
  readonly title?: string;
15
15
  }[]): void;
@@ -78,6 +78,18 @@ export function validateEditFieldExtras(featureName, screenId, entityDef, fieldS
78
78
  // name must be a field of the same form — a typo would otherwise render no
79
79
  // affix or send an undefined param without a hint.
80
80
  export function validateFieldFormRefs(where, fieldSpec, formFieldNames) {
81
+ if (fieldSpec.valueChips !== undefined && !formFieldNames.has(fieldSpec.valueChips.from)) {
82
+ throw bootRuleError(FORM_FIELD_RULES.valueChipsUnknownField, {
83
+ message: `${where} valueChips.from "${fieldSpec.valueChips.from}" is not a field of this form. Known fields: ${[...formFieldNames].sort().join(", ")}`,
84
+ });
85
+ }
86
+ for (const contextField of fieldSpec.aiAssist?.contextFields ?? []) {
87
+ if (!formFieldNames.has(contextField)) {
88
+ throw bootRuleError(FORM_FIELD_RULES.aiAssistContextFieldUnknown, {
89
+ message: `${where} aiAssist.contextFields names unknown field "${contextField}" — it must be another field of the same form.`,
90
+ });
91
+ }
92
+ }
81
93
  const affixes = [
82
94
  ["prefix", fieldSpec.prefix],
83
95
  ["suffix", fieldSpec.suffix],
@@ -104,10 +116,61 @@ export function validateFieldFormRefs(where, fieldSpec, formFieldNames) {
104
116
  }
105
117
  }
106
118
  }
107
- const FILL_ACTION_FIELD_TYPES = ["text", "number", "decimal", "bigInt"];
108
119
  // The fill button writes a plain text or numeric query result into the field;
109
120
  // a secret value must never be filled from a query response.
121
+ const FILL_ACTION_FIELD_TYPES = ["text", "number", "decimal", "bigInt"];
122
+ const AI_ASSIST_FIELD_TYPES = ["text", "longText"];
123
+ const VALUE_CHIPS_FIELD_TYPES = ["number", "decimal", "bigInt", "money"];
124
+ function validateAssistTargets(where, fieldSpec, fieldDef) {
125
+ // skip: the field is unknown (reported elsewhere)
126
+ if (fieldDef === undefined)
127
+ return;
128
+ const { aiAssist, valueChips } = fieldSpec;
129
+ if (valueChips !== undefined && !VALUE_CHIPS_FIELD_TYPES.includes(fieldDef.type)) {
130
+ throw bootRuleError(FORM_FIELD_RULES.valueChipsFieldType, {
131
+ message: `${where} valueChips needs a ${VALUE_CHIPS_FIELD_TYPES.join(", ")} field, not "${fieldDef.type}".`,
132
+ });
133
+ }
134
+ if (aiAssist === undefined)
135
+ return;
136
+ validateAiAssistTarget(where, aiAssist, fieldDef);
137
+ }
138
+ function validateAiAssistTarget(where, aiAssist, fieldDef) {
139
+ if (!AI_ASSIST_FIELD_TYPES.includes(fieldDef.type)) {
140
+ throw bootRuleError(FORM_FIELD_RULES.aiAssistFieldType, {
141
+ message: `${where} aiAssist needs a text or longText field, not "${fieldDef.type}".`,
142
+ });
143
+ }
144
+ if (isSensitiveOrPasswordField(fieldDef)) {
145
+ throw bootRuleError(FORM_FIELD_RULES.aiAssistSensitiveField, {
146
+ message: `${where} aiAssist targets a sensitive, writeOnly or password field. Remove aiAssist.`,
147
+ });
148
+ }
149
+ if ((aiAssist.chips ?? []).length === 0 && aiAssist.prompt === undefined) {
150
+ throw bootRuleError(FORM_FIELD_RULES.aiAssistEmpty, {
151
+ message: `${where} aiAssist has neither chips nor a prompt.`,
152
+ });
153
+ }
154
+ if (aiAssist.resultField.trim() === "") {
155
+ throw bootRuleError(FORM_FIELD_RULES.aiAssistResultFieldEmpty, {
156
+ message: `${where} aiAssist.resultField is empty. Name the query result key that holds the text.`,
157
+ });
158
+ }
159
+ if (aiAssist.prompt !== undefined && aiAssist.prompt.param.trim() === "") {
160
+ throw bootRuleError(FORM_FIELD_RULES.aiAssistPromptParamEmpty, {
161
+ message: `${where} aiAssist.prompt.param is empty. Name the query payload key for the typed instruction.`,
162
+ });
163
+ }
164
+ for (const chip of aiAssist.chips ?? []) {
165
+ if (chip.label.trim() === "" || Object.keys(chip.params).length === 0) {
166
+ throw bootRuleError(FORM_FIELD_RULES.aiAssistChipInvalid, {
167
+ message: `${where} aiAssist chip "${chip.label}" needs a label and at least one param.`,
168
+ });
169
+ }
170
+ }
171
+ }
110
172
  export function validateFillActionTarget(where, fieldSpec, fieldDef) {
173
+ validateAssistTargets(where, fieldSpec, fieldDef);
111
174
  // skip: no fill action, or the field is unknown (reported elsewhere)
112
175
  if (fieldSpec.fillAction === undefined || fieldDef === undefined)
113
176
  return;
@@ -153,7 +216,11 @@ export function validateNoWidgetRequiredField(featureName, screenId, entityDef,
153
216
  // Shared by projectionDetail and entityEdit: a tab strip needs something to
154
217
  // label each tab with and a stable id per tab — the id anchors the ?tab=
155
218
  // param on projectionDetail and the jump-to-erroring-tab logic on entityEdit.
156
- export function validateTabSections(featureName, screenId, screenType, sections) {
219
+ export function validateTabSections(featureName, screenId, screenType, allSections) {
220
+ // projectionDetail: adjacent sections sharing an id are the blocks of one tab.
221
+ const sections = allSections.filter((section, index) => screenType !== "projectionDetail" ||
222
+ section.id === undefined ||
223
+ section.id !== allSections[index - 1]?.id);
157
224
  if (sections.length < 2) {
158
225
  throw bootRuleError(FORM_LAYOUT_RULES.tabsTooFewSections, {
159
226
  message: `[Feature ${featureName}] Screen "${screenId}" (${screenType}) has mode: "tabs" but only ` +
@@ -563,6 +630,12 @@ function validateFormLayoutSections(featureName, screenId, context, layout, fiel
563
630
  `primitive (fw#2166). Move the section to a projectionDetail screen or remove it.`,
564
631
  });
565
632
  }
633
+ if (section.kind === "stepList") {
634
+ throw bootRuleError(FORM_LAYOUT_RULES.stepListSectionUnsupported, {
635
+ message: `[Feature ${featureName}] Screen "${screenId}" (${context}) stepList section ` +
636
+ `"${section.title ?? section.field}" is not supported — stepList is a projectionDetail-only primitive. Move the section to a projectionDetail screen or remove it.`,
637
+ });
638
+ }
566
639
  if (isWriteFormEditSection(section)) {
567
640
  throw bootRuleError(FORM_LAYOUT_RULES.writeFormSectionUnsupported, {
568
641
  message: `[Feature ${featureName}] Screen "${screenId}" (${context}) writeForm section ` +
@@ -634,6 +707,38 @@ function validateInlineFormNavTargets(feature, screenId, screen, kind, lookups)
634
707
  }
635
708
  // actionForm/secretMint have no entity link, only a write-handler QN +
636
709
  // inline fields: checks handler registration, field types, layout refs, and nav targets.
710
+ function validateActionFormFieldTexts(featureName, screenId, screen, fieldNames) {
711
+ for (const described of Object.keys(screen.fieldDescriptions ?? {})) {
712
+ if (fieldNames.has(described))
713
+ continue;
714
+ throw bootRuleError(FORM_FIELD_RULES.fieldDescriptionUnknownField, {
715
+ message: `[Feature ${featureName}] Screen "${screenId}" (actionForm) fieldDescriptions names unknown field "${described}". Known fields: ${[...fieldNames].sort().join(", ")}`,
716
+ });
717
+ }
718
+ for (const [owner, texts] of [
719
+ ["fieldLabels", screen.fieldLabels],
720
+ ["fieldDescriptions", screen.fieldDescriptions],
721
+ ]) {
722
+ for (const [fieldName, ref] of Object.entries(texts ?? {})) {
723
+ if (typeof ref === "string")
724
+ continue;
725
+ for (const param of Object.values(ref.params)) {
726
+ if (fieldNames.has(param))
727
+ continue;
728
+ throw bootRuleError(FORM_FIELD_RULES.fieldTextParamUnknownField, {
729
+ message: `[Feature ${featureName}] Screen "${screenId}" (actionForm) ${owner}.${fieldName} param names unknown field "${param}". Known fields: ${[...fieldNames].sort().join(", ")}`,
730
+ });
731
+ }
732
+ }
733
+ }
734
+ for (const badged of Object.keys(screen.fieldBadges ?? {})) {
735
+ if (fieldNames.has(badged))
736
+ continue;
737
+ throw bootRuleError(FORM_FIELD_RULES.fieldBadgeUnknownField, {
738
+ message: `[Feature ${featureName}] Screen "${screenId}" (actionForm) fieldBadges names unknown field "${badged}". Known fields: ${[...fieldNames].sort().join(", ")}`,
739
+ });
740
+ }
741
+ }
637
742
  export function validateInlineFormScreen(feature, screenId, screen, kind, allWriteHandlerQns, lookups, featureMap) {
638
743
  validateWriteHandlerRegistered(feature.name, screenId, kind, screen.handler, allWriteHandlerQns);
639
744
  // Only a secretMint's own mint step may skip fields/sections entirely
@@ -643,6 +748,7 @@ export function validateInlineFormScreen(feature, screenId, screen, kind, allWri
643
748
  validateFormLayoutSections(feature.name, screenId, kind, screen.layout, fieldNames, screen.fields, allowEmptyMintForm && fieldNames.size === 0);
644
749
  validateWizardLayout(feature.name, screenId, kind, screen.layout, featureMap, fieldNames);
645
750
  if (screen.type === "actionForm") {
751
+ validateActionFormFieldTexts(feature.name, screenId, screen, fieldNames);
646
752
  validateFormDerivations(feature.name, screenId, screen);
647
753
  validateFormDerivationsEnforced(feature.name, screenId, screen, featureMap);
648
754
  }
@@ -86,6 +86,7 @@ function layoutFieldNames(screen) {
86
86
  for (const section of screen.layout.sections) {
87
87
  if (isExtensionEditSection(section) ||
88
88
  section.kind === "relatedList" ||
89
+ section.kind === "stepList" ||
89
90
  section.kind === "writeForm") {
90
91
  continue;
91
92
  }
@@ -14,6 +14,11 @@ export declare const PROJECTION_DETAIL_RULES: {
14
14
  readonly summary: "A projectionDetail with a header sets no recordTitleField.";
15
15
  readonly fix: "Drop recordTitleField; header.title names the record.";
16
16
  };
17
+ readonly initialTabInvalid: {
18
+ readonly id: "projection-detail/initial-tab-invalid";
19
+ readonly summary: "initialTab needs layout.mode tabs and each rule names an existing section id; footerHint needs footerActions.";
20
+ readonly fix: "Use tabs mode and section ids from the layout for initialTab, or declare footerActions next to footerHint.";
21
+ };
17
22
  readonly tabsSectionGroupsAndActions: {
18
23
  readonly id: "projection-detail/tabs-section-groups-and-actions";
19
24
  readonly summary: "A tabs-mode section declares groups or actions, not both.";
@@ -14,6 +14,11 @@ export const PROJECTION_DETAIL_RULES = {
14
14
  summary: "A projectionDetail with a header sets no recordTitleField.",
15
15
  fix: "Drop recordTitleField; header.title names the record.",
16
16
  },
17
+ initialTabInvalid: {
18
+ id: "projection-detail/initial-tab-invalid",
19
+ summary: "initialTab needs layout.mode tabs and each rule names an existing section id; footerHint needs footerActions.",
20
+ fix: "Use tabs mode and section ids from the layout for initialTab, or declare footerActions next to footerHint.",
21
+ },
17
22
  tabsSectionGroupsAndActions: {
18
23
  id: "projection-detail/tabs-section-groups-and-actions",
19
24
  summary: "A tabs-mode section declares groups or actions, not both.",
@@ -1,6 +1,7 @@
1
1
  import { SELECT_OPTION_TONES } from "@cosmicdrift/kumiko-types/fields";
2
2
  import { isExtensionEditSection, isFieldsEditSection, isWriteFormEditSection, normalizeEditField, sectionFieldSpecs, } from "../screen-helpers.js";
3
3
  import { bootRuleError } from "./boot-rule.js";
4
+ import { validateRelativeTimeFormat } from "./relative-time-format.js";
4
5
  import { assertWriteHandlerRegistered, resolveRowActionNavigateTarget, validateActionHasIcon, validatePrimaryActionTarget, } from "./screens-actions.js";
5
6
  import { rejectWriteOnlyFormField, validateFieldsXorGroups, validateFormSelectOptions, validateTabSections, } from "./screens-forms.js";
6
7
  import { validateProjectionDetailGuidance } from "./screens-kind-projection-detail-guidance.js";
@@ -51,6 +52,29 @@ function validateProjectionDetailTabs(featureName, screenId, screen) {
51
52
  }
52
53
  }
53
54
  }
55
+ function validateProjectionDetailInitialTab(featureName, screenId, screen) {
56
+ const where = `[Feature ${featureName}] Screen "${screenId}" (projectionDetail)`;
57
+ if (screen.footerHint !== undefined && (screen.footerActions ?? []).length === 0) {
58
+ throw bootRuleError(PROJECTION_DETAIL_RULES.initialTabInvalid, {
59
+ message: `${where} sets footerHint without footerActions — the footer bar only exists with footer actions.`,
60
+ });
61
+ }
62
+ // skip: the first tab opens first
63
+ if (screen.initialTab === undefined)
64
+ return;
65
+ if (screen.layout.mode !== "tabs") {
66
+ throw bootRuleError(PROJECTION_DETAIL_RULES.initialTabInvalid, {
67
+ message: `${where} sets initialTab without layout.mode "tabs".`,
68
+ });
69
+ }
70
+ for (const rule of screen.initialTab) {
71
+ if (!screen.layout.sections.some((section) => section.id === rule.tab)) {
72
+ throw bootRuleError(PROJECTION_DETAIL_RULES.initialTabInvalid, {
73
+ message: `${where} initialTab names tab "${rule.tab}", which is not a section id on this screen.`,
74
+ });
75
+ }
76
+ }
77
+ }
54
78
  function validateProjectionDetailMetricNavigate(ctx, screenId, screen, field, navigate) {
55
79
  const featureName = ctx.feature.name;
56
80
  if (navigate.screen === undefined && navigate.entity === undefined) {
@@ -77,6 +101,7 @@ function validateProjectionDetailMetric(ctx, screenId, screen, metric) {
77
101
  `there is no fallback to the raw column name.`,
78
102
  });
79
103
  }
104
+ validateRelativeTimeFormat(`[Feature ${ctx.feature.name}] Screen "${screenId}" (projectionDetail)`, `metric "${metric.field}"`, metric.format);
80
105
  if (metric.navigate !== undefined) {
81
106
  validateProjectionDetailMetricNavigate(ctx, screenId, screen, metric.field, metric.navigate);
82
107
  }
@@ -252,6 +277,10 @@ function validateProjectionDetailSection(ctx, screenId, screen, section) {
252
277
  else if (isWriteFormEditSection(section)) {
253
278
  validateProjectionDetailWriteForm(ctx, screenId, screen, section);
254
279
  }
280
+ else if (section.kind === "stepList") {
281
+ // field existence is checked against the outputSchema in query-output-columns
282
+ return;
283
+ }
255
284
  else {
256
285
  validateProjectionDetailFieldsSection(ctx, screenId, section);
257
286
  }
@@ -283,6 +312,7 @@ export function validateProjectionDetailScreen(ctx, screenId, screen) {
283
312
  validateProjectionDetailFlags(featureName, screenId, screen);
284
313
  rejectEmptySections(featureName, screenId, "projectionDetail", screen.layout.sections.length);
285
314
  validateProjectionDetailTabs(featureName, screenId, screen);
315
+ validateProjectionDetailInitialTab(featureName, screenId, screen);
286
316
  for (const metric of screen.metrics ?? []) {
287
317
  validateProjectionDetailMetric(ctx, screenId, screen, metric);
288
318
  }
@@ -44,6 +44,11 @@ export declare const LIST_SCREEN_RULES: {
44
44
  readonly summary: "A column renderer's react.__component is a non-empty string.";
45
45
  readonly fix: "Set react.__component to the name of a client columnRenderers entry.";
46
46
  };
47
+ readonly relativeTimeOptionsInvalid: {
48
+ readonly id: "list/relative-time-options-invalid";
49
+ readonly summary: "relativeTime format options (style, absoluteAfterDays, withTime, timeZone) are valid.";
50
+ readonly fix: "Use style long, short or narrow, an integer absoluteAfterDays of at least 1 and a boolean withTime and an IANA timeZone.";
51
+ };
47
52
  readonly enumOptionTonesInvalid: {
48
53
  readonly id: "list/enum-option-tones-invalid";
49
54
  readonly summary: "enumOption column tones are known select option tones.";
@@ -44,6 +44,11 @@ export const LIST_SCREEN_RULES = {
44
44
  summary: "A column renderer's react.__component is a non-empty string.",
45
45
  fix: "Set react.__component to the name of a client columnRenderers entry.",
46
46
  },
47
+ relativeTimeOptionsInvalid: {
48
+ id: "list/relative-time-options-invalid",
49
+ summary: "relativeTime format options (style, absoluteAfterDays, withTime, timeZone) are valid.",
50
+ fix: "Use style long, short or narrow, an integer absoluteAfterDays of at least 1 and a boolean withTime and an IANA timeZone.",
51
+ },
47
52
  enumOptionTonesInvalid: {
48
53
  id: "list/enum-option-tones-invalid",
49
54
  summary: "enumOption column tones are known select option tones.",
@@ -7,11 +7,12 @@ import { explicitListScreenId, normalizeListColumn, resolveNavParentScreen, scre
7
7
  import { bootRuleError } from "./boot-rule.js";
8
8
  import { ENTITY_LIST_RULES } from "./entity-list-screens-rules.js";
9
9
  import { validateListBulkActions } from "./list-bulk-actions.js";
10
- import { validateListRowGuidance } from "./list-row-guidance.js";
10
+ import { validateListRowGuidance, validatePhotoGrid } from "./list-row-guidance.js";
11
11
  import { LIST_ROW_GUIDANCE_RULES } from "./list-row-guidance-rules.js";
12
12
  import { rejectSummaryRowOnRelatedList } from "./list-sort-summary.js";
13
13
  import { validateListTableOptions } from "./list-table-options.js";
14
14
  import { validateRelatedListGroupingRules } from "./related-list-table-rules.js";
15
+ import { validateRelativeTimeFormat } from "./relative-time-format.js";
15
16
  import { assertWriteHandlerRegistered, isRowClickAction, rejectRedirectOnListRowAction, resolveRowActionNavigateTarget, validateClientActionName, validateDrawerTargetAction, validateRowActionNavigateParams, } from "./screens-actions.js";
16
17
  import { SCREEN_ACTION_RULES } from "./screens-actions-rules.js";
17
18
  import { SCREEN_KIND_RULES } from "./screens-kind-rules.js";
@@ -94,6 +95,7 @@ function validateRelatedListTableAndBulk(args) {
94
95
  // swallow a summaryRow with a less specific message.
95
96
  rejectSummaryRowOnRelatedList(`[Feature ${featureName}] ${where}`, section.table);
96
97
  validateRelatedListGroupingRules(`[Feature ${featureName}] ${where}`, section, args.screenType === "entityList expandableRow");
98
+ validatePhotoGrid(`[Feature ${featureName}] ${where}`, section);
97
99
  validateListTableOptions(`[Feature ${featureName}] ${where}`, section.table, section.columns);
98
100
  if (section.rowActions !== undefined)
99
101
  validateRelatedListRowActions(args, section.rowActions);
@@ -278,6 +280,7 @@ export function rejectInertColumnSortable(featureName, screenId, screenType, col
278
280
  // failure.
279
281
  export function validateColumnRendererForm(featureName, screenId, column) {
280
282
  validateEnumOptionTones(`[Feature ${featureName}] Screen "${screenId}"`, column);
283
+ validateRelativeTimeFormat(`[Feature ${featureName}] Screen "${screenId}"`, `column "${column.field}"`, column.renderer);
281
284
  if (column.linkParamsField !== undefined && column.linkScreenField === undefined) {
282
285
  throw bootRuleError(LIST_ROW_GUIDANCE_RULES.linkParamsWithoutScreenField, {
283
286
  message: `[Feature ${featureName}] Screen "${screenId}" column "${column.field}" sets linkParamsField ` +
@@ -16,12 +16,12 @@
16
16
  // refs (buildNavRegistrySliceForApp qualifies them itself).
17
17
  import { isOptionsQueryFieldRef } from "@cosmicdrift/kumiko-types/fields";
18
18
  import { CONFIG_EDIT_ENTITY, fieldLabelKey } from "../i18n/required-surface-keys.js";
19
+ import { rolesToAccess, unionAccessRules } from "./config-access-rules.js";
19
20
  import { isEncryptedAtRest } from "./config-helpers.js";
20
21
  import { EXTENSION_SELECTOR_HINT_KEY, isSelectableInSettings, settingsSelectablePluginIds, } from "./extension-selector-plugins.js";
21
22
  import { createBooleanField, createNumberField, createSelectField, createTextField, } from "./factories.js";
22
23
  import { isKebabSegment, toKebab } from "./qualified-name.js";
23
24
  import { isFieldsEditSection, sectionFieldSpecs, } from "./screen-helpers.js";
24
- import { isOpenToAllGranted } from "./types/handlers.js";
25
25
  // Namespace under which buildAppSchema attaches the generated screens/navs
26
26
  // (find-or-create FeatureSchema). It MUST match CONFIG_FEATURE from the config
27
27
  // bundled feature. The framework cannot import that constant because of the
@@ -681,7 +681,7 @@ function buildScreen(shortId, scope, feature, keys, access, hub, options = {}) {
681
681
  if (k.def.required === true)
682
682
  requiredFields.push(id);
683
683
  }
684
- const { section, screenDescription } = buildSettingsSection(feature, scope, keys.map(fieldId), hub, options);
684
+ const { section, screenDescription } = buildSettingsSection(feature, scope, keys.map((k) => k.def.mask?.readOnly === true ? { field: fieldId(k), readOnly: true } : fieldId(k)), hub, options);
685
685
  return {
686
686
  id: shortId,
687
687
  type: "configEdit",
@@ -809,6 +809,9 @@ function collectMaskedKeys(registry) {
809
809
  if (def.group !== undefined && !isKebabSegment(def.group)) {
810
810
  throw new Error(`[Feature ${ownerFeature}] config key "${qn.slice(sep + ":config:".length)}" has invalid group "${def.group}" — must be kebab-case.`);
811
811
  }
812
+ if (def.mask?.readOnly === true && def.required === true) {
813
+ throw new Error(`[Feature ${ownerFeature}] config key "${qn.slice(sep + ":config:".length)}" is mask.readOnly and required — nobody could fill it.`);
814
+ }
812
815
  // computed keys derive their value — there is no row to set, so a
813
816
  // configEdit screen could not write them. Skip even when masked.
814
817
  if (def.mask === undefined || def.computed !== undefined)
@@ -835,36 +838,3 @@ function maskOrder(k) {
835
838
  function minMaskOrder(keys) {
836
839
  return Math.min(...keys.map(maskOrder));
837
840
  }
838
- // The hub is for editing: anyone allowed to WRITE at least one key in the group
839
- // sees the Settings entry (write, not read). This keeps system-scope (write
840
- // default `["system"]`) hidden from humans until the author opts in with
841
- // write: SystemAdmin, while user-scope (write `all`) is shown to everyone.
842
- // `all` can only be represented as openToAll in AccessRule; writes remain
843
- // gated per key on the server.
844
- // Access rules for navs are unioned: an openToAll nav opens the whole gate;
845
- // otherwise roles are combined. Navs without access rules contribute nothing.
846
- function unionAccessRules(rules) {
847
- const roles = [];
848
- for (const rule of rules) {
849
- if (rule === undefined)
850
- continue;
851
- if ("openToAll" in rule) {
852
- if (isOpenToAllGranted(rule))
853
- return rule;
854
- continue;
855
- }
856
- roles.push(...rule.roles);
857
- }
858
- return rolesToAccess(roles);
859
- }
860
- // `all` can only be represented as openToAll in AccessRule; writes remain gated
861
- // per key on the server.
862
- function rolesToAccess(roles) {
863
- if (roles.includes("all"))
864
- return {
865
- openToAll: {
866
- reason: 'config key declares the "all" role, so every signed-in user of the tenant may read/write it',
867
- },
868
- };
869
- return { roles: [...new Set(roles)] };
870
- }
@@ -0,0 +1,3 @@
1
+ import type { AccessRule } from "./types/handlers.ts";
2
+ export declare function unionAccessRules(rules: readonly (AccessRule | undefined)[]): AccessRule;
3
+ export declare function rolesToAccess(roles: readonly string[]): AccessRule;
@@ -0,0 +1,34 @@
1
+ import { isOpenToAllGranted } from "./types/handlers.js";
2
+ // The hub is for editing: anyone allowed to WRITE at least one key in the group
3
+ // sees the Settings entry (write, not read). This keeps system-scope (write
4
+ // default `["system"]`) hidden from humans until the author opts in with
5
+ // write: SystemAdmin, while user-scope (write `all`) is shown to everyone.
6
+ // `all` can only be represented as openToAll in AccessRule; writes remain
7
+ // gated per key on the server.
8
+ // Access rules for navs are unioned: an openToAll nav opens the whole gate;
9
+ // otherwise roles are combined. Navs without access rules contribute nothing.
10
+ export function unionAccessRules(rules) {
11
+ const roles = [];
12
+ for (const rule of rules) {
13
+ if (rule === undefined)
14
+ continue;
15
+ if ("openToAll" in rule) {
16
+ if (isOpenToAllGranted(rule))
17
+ return rule;
18
+ continue;
19
+ }
20
+ roles.push(...rule.roles);
21
+ }
22
+ return rolesToAccess(roles);
23
+ }
24
+ // `all` can only be represented as openToAll in AccessRule; writes remain gated
25
+ // per key on the server.
26
+ export function rolesToAccess(roles) {
27
+ if (roles.includes("all"))
28
+ return {
29
+ openToAll: {
30
+ reason: 'config key declares the "all" role, so every signed-in user of the tenant may read/write it',
31
+ },
32
+ };
33
+ return { roles: [...new Set(roles)] };
34
+ }
@@ -219,4 +219,6 @@ export declare function createEntity<const F, const T extends EntityTenancy = "t
219
219
  readonly transferable?: boolean;
220
220
  /** See EntityDefinition.attachedFileAccess. */
221
221
  readonly attachedFileAccess?: EntityDefinition["attachedFileAccess"];
222
+ /** See EntityDefinition.crossTenantFileRead. */
223
+ readonly crossTenantFileRead?: EntityDefinition["crossTenantFileRead"];
222
224
  }): F extends FieldsMap ? EntityDefinition<F, T> : never;