diff --git a/.changeset/36630-skills-action-layout.md b/.changeset/36630-skills-action-layout.md new file mode 100644 index 00000000000..351d076e268 --- /dev/null +++ b/.changeset/36630-skills-action-layout.md @@ -0,0 +1,10 @@ +--- +'@objectstack/skills': patch +--- + +docs(skills): objectstack-ui teaches the object's `actionLayout` + +Clause-②: no +Metadata-protocol: none + +`rules/actions.md` gains one section, "Button Order (`actionLayout`)": an arm per scope (`list`, `record`), `pinned` (at most 3 buttons, in order, `[]` pins none) and `more` (the order of the overflow menu, unnamed actions after it), which placements each arm takes and where the `record` arm is drawn (record page, side preview, phone bar, a row's menu order), the list page's `$import` / `$export` as pinned-only built-ins, that `os validate` refuses a name the arm's scope does not place, and that on an installed object only its paired `.custom` package's extension writes the key, arm by arm. Text only; one eval case exercises it. diff --git a/scripts/check-skills-token-ratchet.mjs b/scripts/check-skills-token-ratchet.mjs index c3bd8ab5f32..f22de69ad2d 100644 --- a/scripts/check-skills-token-ratchet.mjs +++ b/scripts/check-skills-token-ratchet.mjs @@ -1523,7 +1523,21 @@ export const CEILINGS = new Map([ // before, ceiling +378, the measured remainder only, pinned AT the measurement. Same ruling // (2026-10-27, tap A): 「A:先削重复,余额按实测提高」 (ruling record 6513306068, letter B). // ceil($(wc -c < skills/objectstack-ui/rules/actions.md) / 4) == ceil(14843 / 4) - ['skills/objectstack-ui/rules/actions.md', 3711], + // 3711 -> 3880 (#36630): one section after the `locations` table, "Button Order + // (`actionLayout`)": the object key's arms and parts, the limit of 3 pinned, which placements + // each arm takes and where the `record` arm is drawn, the list page's `$import` / `$export` as + // pinned-only built-ins, that `os validate` refuses a name the arm's scope does not place, and + // that on an installed object only the paired `.custom` package's extension writes it. PAID + // DOWN FIRST by 49 bytes of restatement in this file: " (`'Choose the new owner of + // {{ record.name }}.'`)" beside `description` on the copy-holes bullet (the `helpText` bullet + // right below it and the Reassign Lead block's `successMessage` show the `{{ record.name }}` + // spelling). Nothing else in the file restates another passage (see the 2777 -> 2808 note + // above), so the same ruling's second half carries the rest. Arithmetic: the text adds 726 + // bytes, the cut removes 49, so the file is 14842 -> 15519 bytes -> 3880 tokens, zero headroom + // before, ceiling +169, the measured remainder only, pinned AT the measurement. Same ruling + // (2026-10-27, tap A): 「A:先削重复,余额按实测提高」 (ruling record 6513306068, letter B). + // ceil($(wc -c < skills/objectstack-ui/rules/actions.md) / 4) == ceil(15519 / 4) + ['skills/objectstack-ui/rules/actions.md', 3880], // 6090 -> 6252 (#19715, card item 4): a 5-line table of contents at the top, // anchors to the file's existing headings, nothing else changed. +162 tokens, // zero headroom to absorb any of it, ceiling +162. Maintainer ruling diff --git a/skills/objectstack-ui/evals/views-apps-actions-pages.json b/skills/objectstack-ui/evals/views-apps-actions-pages.json index 9c0d3aa89cb..2eec4651e8c 100644 --- a/skills/objectstack-ui/evals/views-apps-actions-pages.json +++ b/skills/objectstack-ui/evals/views-apps-actions-pages.json @@ -230,6 +230,16 @@ "must_contain": ["perRecord", "bulkActions: [", "ctx.record"], "must_not_contain": ["succeeded:", "{ succeeded", "{ failed"] } + }, + { + "id": 24, + "prompt": "`crm_opportunity` has five record actions, all placed at `record_header`: `mark_won`, `mark_lost`, `clone`, `share`, `archive`. The team wants Mark Won, Mark Lost, Clone and Share as header buttons in that order, Archive under More, and on the list page Export as a button after the `mass_assign` toolbar action. Write the metadata that does this.", + "expected_output": "One key on the object, no page file and no edit to any action: `actionLayout: { record: { pinned: ['mark_won', 'mark_lost', 'clone'], more: ['share', 'archive'] }, list: { pinned: ['mass_assign', '$export'] } }`. The answer says an arm pins at most three buttons, so the fourth requested button, Share, leads `more` instead (a fourth name in `pinned` is refused). The `record` arm holds for the record page, the side preview and the phone action bar alike. `$export` is the list page's built-in, named only in the `list` arm's `pinned`; `mass_assign` must be placed at `list_toolbar` or `os validate` refuses the name. Not four names in `pinned`, not an `order` renumbering on each action (shared by every surface, and it names no buttons), not `$export` in `more`, and not a `definePage` header listing action ids.", + "files": [], + "assertions": { + "must_contain": ["actionLayout", "pinned", "more", "$export"], + "must_not_contain": ["'clone', 'share']", "definePage"] + } } ] } diff --git a/skills/objectstack-ui/rules/actions.md b/skills/objectstack-ui/rules/actions.md index c662acc643a..2652f16de46 100644 --- a/skills/objectstack-ui/rules/actions.md +++ b/skills/objectstack-ui/rules/actions.md @@ -26,6 +26,18 @@ in `language: 'js'` (an `expression` body has no I/O) with | `list_item` | Per-row action in list views | | `list_toolbar` | Toolbar button; one ticked row is its `recordId`, several are refused (no `_selectedIds`) | +## Button Order (`actionLayout`) + +The object's `actionLayout` arranges one scope per arm: +`{ record: { pinned: ['crm_convert_lead'], more: ['crm_print_a3'] } }`. `pinned` +(required; `[]` pins none) names at most 3 buttons, in order; every other action +goes to the ⋯ menu, those `more` names first. `record` takes `record_header` / +`record_more` actions wherever that header draws (record page, side preview, +phone bar, a row's ⋮ menu order); `list` takes `list_toolbar` actions and may +pin `$import` / `$export` (pinned only). `os validate` refuses a name the arm's +scope does not place. On an installed object only its paired `.custom` package's +extension writes it (as `fieldGroups`, objectstack-data), each arm whole. + ## Visibility, Disable & Feedback - `visible` — a bare CEL predicate over the current record (prefer the `P\`...\`` template; `record.` resolves identically on every surface, never `${…}`- or `{…}`-wrapped — see `objectstack-formula`); when false the action is **hidden**. @@ -37,7 +49,7 @@ in `language: 'js'` (an `expression` body has no I/O) with - `preflight` — a read the param dialog shows above the params before submit: `{ read: { url }, path?, fields?, seed? }` sends one `GET` (no other `method`, no body or credentials) to a same-origin API path (one leading `/`) whose only holes are `${param.NAME}` (a declared param; re-read when it changes), `${ctx.recordId}` and `${ctx.record.FIELD}`. `path` selects the answer's sub-tree (`data`); `fields` rows are `resultDialog.fields`' (omitted: JSON). Each `seed: [{ param, path }]` entry fills a declared param, drawn read-only and submitted as shown: seeded once, no `defaultValue` / `defaultFromRow` / `carryOver`, read by no hole; mark it `required` so Confirm waits for the answer. Refused without a non-empty `params` and beside `execution: 'aggregate'`. UX, not authorization: the endpoint still checks a seeded value. - `resultDialog` — a one-shot dialog that shows the server answer in place of the success toast (so no `successMessage`; `outcomeMessages` is refused beside it): `{ title?, description?, acknowledge?, format?, fields? }`. `fields: [{ path, label?, format? }]`, `path` a dot path into `result.data` (omitted: the whole answer as JSON); `format` is one of `qrcode`, `code-list`, `secret`, `text`, `json`, or `table` with `columns: [{ path, label?, format? }]` (one row per element of the array at `path`, one cell per column; required with `table` and refused beside any other format). The dialog-level `format` (default `json`) and a cell's (default `text`) take every format but `table`. A `text` or `code-list` cell draws the value with no copy control; a `secret` or `qrcode` cell keeps its own. - `successMessage` / `errorMessage` — toast copy; without `successMessage` the UI shows a generic "Action completed". -- Copy holes are `{{ }}`: `confirmText`, `description` (`'Choose the new owner of {{ record.name }}.'`) and a param's `helpText` read `record`; `successMessage` and each `outcomeMessages` entry (`resent: 'Invitation resent to {{ result.email }}'`) read `result` (the handler's answer) and `record`; `errorMessage` takes none. A `bulkActionDefs` entry's `confirmText` reads `{{ count }}` and its params by bare name (`{{ tier }}`). In all of them `${record.name}`, `{name}`, logic in a hole and a blank sentence fail `os validate`. +- Copy holes are `{{ }}`: `confirmText`, `description` and a param's `helpText` read `record`; `successMessage` and each `outcomeMessages` entry (`resent: 'Invitation resent to {{ result.email }}'`) read `result` (the handler's answer) and `record`; `errorMessage` takes none. A `bulkActionDefs` entry's `confirmText` reads `{{ count }}` and its params by bare name (`{{ tier }}`). In all of them `${record.name}`, `{name}`, logic in a hole and a blank sentence fail `os validate`. - A param's `helpText`, like `description`, is a sentence or an inline locale map (`{ en: 'Why {{ record.name }} is paused', 'zh-CN': '暂停原因' }`); the map is how a page button's inline `action` (no bundle reaches it) writes its hint per locale. - `undoable: true` — an **Undo** in the success toast (and `Ctrl+Z`). Snapshot: runtime on `operation: 'update'`, console on `type: 'api'`; else refused. - A list view's `bulkActions: ['']` runs the action once per ticked row. A body that writes each selected row takes that form: declare `execution: 'perRecord'` and write the row it is handed (`ctx.record`, `ctx.recordId`; `crm_create_campaign` below); a row whose run throws is listed with its message. A `bulkActionDefs` entry `{ name, operation: 'custom', execution: 'aggregate' }` runs it once for the selection. A script body or a flow receives the ids under the built-in key `params._selectedIds` (`input._selectedIds`), at most 5000 and only ids the caller can read: one the caller cannot read refuses the whole call (`404 RECORD_NOT_FOUND`) before it starts. A throw is one outcome for the selection; a return value's top-level `succeeded` or `failed` is read as a `BulkActionResult` (`@objectstack/spec/ui`), and in any other form (counts, one list) reported as unreadable.