diff --git a/.changeset/37895-skills-action-locations-acted-on.md b/.changeset/37895-skills-action-locations-acted-on.md new file mode 100644 index 00000000000..4e2232cbbc0 --- /dev/null +++ b/.changeset/37895-skills-action-locations-acted-on.md @@ -0,0 +1,16 @@ +--- +'@objectstack/skills': patch +--- + +docs(skills): the published skills teach the action `locations` words of protocol 19 + +Clause-②: no +Metadata-protocol: none + +`skills/objectstack-ui/rules/actions.md`: the location table lists `list` (acts on no record: the list page toolbar), `record` (acts on one record, on the record page and on each list row; the default), `record_page` (the record page only), `record_row` (each list row only), `record_related` and `record_section`. One line under it names what replaced `list_toolbar`, `list_item`, `record_header` and `record_more`. The `actionLayout` paragraph says the `record` arm takes `record` / `record_page` actions and the `list` arm takes `list` actions. + +The six examples that had dropped their `locations` key declare a placement again: `"locations": ["record"]` on the "Mark as done" JSON in `skills/objectstack-ui/SKILL.md`; `['record']` on `crm_reassign_lead`, `crm_convert_lead`, `crm_open_invoice_pdf` and `crm_add_invoice_line`; and `['record_page']` on `crm_print_a3`. This replaces the earlier note in this release, which said that an action copied from one of them needs its `locations` added. + +`skills/objectstack-ui/rules/record-page.md` and `skills/objectstack-formula/SKILL.md` each change one sentence to the new words, and five eval cases under `skills/objectstack-ui/evals/` expect them. Nothing an author can write changes: these are the words `@objectstack/spec` 19 already accepts. + +Token ceilings: `skills/objectstack-ui/rules/actions.md` 3844 to 3918, after one restating sentence was cut from it; `skills/objectstack-ui/SKILL.md` 2256 to 2262; `skills/objectstack-formula/SKILL.md` 6090 to 6088. diff --git a/scripts/check-skills-token-ratchet.mjs b/scripts/check-skills-token-ratchet.mjs index 7e3ec5b2384..d884ac1ef5c 100644 --- a/scripts/check-skills-token-ratchet.mjs +++ b/scripts/check-skills-token-ratchet.mjs @@ -813,7 +813,10 @@ export const CEILINGS = new Map([ // 6090; the ceiling moves +82, the measured remainder only. Pinned AT the // measurement. // ceil(($(wc -c < skills/objectstack-formula/SKILL.md) - 20) / 4) == ceil(24357 / 4) - ['skills/objectstack-formula/SKILL.md', 6090], // -53 (was 6055), then -5 A2′ (was 6002), then +11 (was 5997), then +82 (was 6008) + // 6090 -> 6088: the action `visible` / `disabled` paragraph says "a list row" where it wrote + // the retired action location word `list_item` (-7 bytes); the row follows the measurement + // down, 24384 bytes (24357 priced) -> 24377 (24350 priced) -> 6088 tokens. + ['skills/objectstack-formula/SKILL.md', 6088], // -53 (was 6055), then -5 A2′ (was 6002), then +11 (was 5997), then +82 (was 6008), then -2 (was 6090) ['skills/objectstack-i18n/SKILL.md', 6333], // -11 (was 6349), then -5 A2′ (was 6338) // 12705 -> 12984 (2026-08-31 app-repo-principles raise, see the block above). // The largest of the five and the frame the other four are read under: what an @@ -1125,7 +1128,17 @@ export const CEILINGS = new Map([ // ceil(($(wc -c < skills/objectstack-ui/SKILL.md) - 20) / 4) == ceil(9087 / 4) // 2264 -> 2256: the Actions JSON fence drops its `locations` key (32 bytes), so it parses // under both action location vocabularies; the row follows the measurement down. - ['skills/objectstack-ui/SKILL.md', 2256], // -8 to the measurement (was 2264) + // 2256 -> 2262: the Actions JSON fence declares its placement again, in the protocol-19 word + // (`"locations": ["record"],`, +25 bytes; it had dropped the key so that it parsed under + // both vocabularies, the 2264 -> 2256 note above). No cut pays for it: the one passage + // weighed as restatement, " over an image, avatar or file field" beside `gallery` in the + // List Views kind list, was ruled teaching by the seat's review of the PR and stays, and + // nothing else in the file restates another passage. So the ruling's second half carries the + // delta: 9050 bytes (9023 priced) -> 9075 (9048 priced) -> 2262 tokens, headroom 0 before, + // ceiling +6, the measured remainder only, pinned AT the measurement (2 under the 2264 the + // row held before the fence dropped its key). Standing ruling (2026-10-27, tap A): + // 「A:先削重复,余额按实测提高」 (ruling record 6513306068, letter B). + ['skills/objectstack-ui/SKILL.md', 2262], // +6 to the measurement (was 2256) // 8333 -> 6193: RE-LOCK at the landed count after the #19715 split (decision // batch #213 item 1, maintainer 「1 2 4 同意」): the worked R1, the report // template and the v17-canonical shapes block moved VERBATIM into @@ -1697,7 +1710,23 @@ export const CEILINGS = new Map([ // 3890 -> 3844: five checked examples drop their `locations` line (186 bytes), so each // compiles under both action location vocabularies; the row follows the measurement down. // ceil($(wc -c < skills/objectstack-ui/rules/actions.md) / 4) == ceil(15373 / 4) - ['skills/objectstack-ui/rules/actions.md', 3844], + // 3844 -> 3918: the file teaches the protocol-19 action location vocabulary, which says what + // an action acts on (`list`, `record`, and the narrow words `record_page`, `record_row`, + // `record_related`, `record_section`). The location table's four page-part rows become four + // rows in those words, one line under the table names what replaced each old word, the + // `actionLayout` paragraph and the `defaultFromRow` sentence name the new words, and the five + // checked examples declare a placement again (130 bytes; the 3890 -> 3844 note above is the + // 186 they dropped). PAID DOWN FIRST by 62 bytes of restatement in this file: the opening + // "Actions are user-triggered operations on an object or a view." (the paragraph under it + // says how `objectName` binds an action to an object and how a view names one). Nothing else + // in the file restates another passage, so the same ruling's second half carries the rest. + // Arithmetic: the text adds 359 bytes, the cut removes 62, so the file is 15373 -> 15670 + // bytes -> 3918 tokens, headroom 0 before, ceiling +74, the measured remainder only, pinned + // AT the measurement (28 above the 3890 the row held before the examples dropped their key). + // Same ruling (2026-10-27, tap A): 「A:先削重复,余额按实测提高」 (ruling record 6513306068, + // letter B). + // ceil($(wc -c < skills/objectstack-ui/rules/actions.md) / 4) == ceil(15670 / 4) + ['skills/objectstack-ui/rules/actions.md', 3918], // 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-formula/SKILL.md b/skills/objectstack-formula/SKILL.md index 1f706598487..177c1938bdf 100644 --- a/skills/objectstack-formula/SKILL.md +++ b/skills/objectstack-formula/SKILL.md @@ -136,7 +136,7 @@ does not satisfy that gate. `has()` over an **undeclared** key stays legal: that is its use there — telling "absent from this PATCH" apart from "explicitly null". **The exception: action `visible` / `disabled` are client-side and sparse.** -They bind the row the client already holds, and that row — a `list_item` row +They bind the row the client already holds, and that row — a list row above all — lacks a key when the column is outside the view's projection, when field-level security refuses it, or when it was never written (the mongo and memory drivers). diff --git a/skills/objectstack-ui/SKILL.md b/skills/objectstack-ui/SKILL.md index 0d5881b25c4..f71a97fb091 100644 --- a/skills/objectstack-ui/SKILL.md +++ b/skills/objectstack-ui/SKILL.md @@ -133,7 +133,7 @@ reports success and changes nothing. Call the API, with the option `value`, never its label ([Actions](./rules/actions.md)): ```json -{ "name": "mark_done", "label": "Mark as done", "objectName": "task", +{ "name": "mark_done", "label": "Mark as done", "objectName": "task", "locations": ["record"], "type": "script", "body": { "language": "js", "capabilities": ["api.write"], "source": "await ctx.api.object('task').update({ id: ctx.recordId, status: 'done' });" } } ``` diff --git a/skills/objectstack-ui/evals/record-page.json b/skills/objectstack-ui/evals/record-page.json index aa8d25982c7..d6dc3e37404 100644 --- a/skills/objectstack-ui/evals/record-page.json +++ b/skills/objectstack-ui/evals/record-page.json @@ -45,7 +45,7 @@ { "id": 3, "prompt": "Our account record page is a custom `kind: 'full'` page with its own tab strip. Installed packages keep adding header actions to `account` (an 'Open in billing' link, for one), and none of them ever shows in the page header. Make the header show every action placed on the account's header, including ones a package adds later, without us listing ids. None of the project's files are in this directory: write the change in your answer.", - "expected_output": "Keep the `kind: 'full'` page and its tab strip, and set `placedActions: true` on its `page:header` node: `{ type: 'page:header', properties: { placedActions: true } }`. The header then draws every action of `account` whose `locations` include `record_header` or `record_more`, read live, so a package's action appears without a page edit. No `actions` id list beside it: an authored list is the whole set, and `placedActions: true` beside one is refused. Not a return to a `slotted` page and never a `slots.tabs`.", + "expected_output": "Keep the `kind: 'full'` page and its tab strip, and set `placedActions: true` on its `page:header` node: `{ type: 'page:header', properties: { placedActions: true } }`. The header then draws every action of `account` whose `locations` include `record` or `record_page`, read live, so a package's action appears without a page edit. No `actions` id list beside it: an authored list is the whole set, and `placedActions: true` beside one is refused. Not a return to a `slotted` page and never a `slots.tabs`.", "files": [], "assertions": { "must_contain": [ diff --git a/skills/objectstack-ui/evals/views-apps-actions-pages.json b/skills/objectstack-ui/evals/views-apps-actions-pages.json index 160d7d4ca97..8172c250de2 100644 --- a/skills/objectstack-ui/evals/views-apps-actions-pages.json +++ b/skills/objectstack-ui/evals/views-apps-actions-pages.json @@ -24,10 +24,10 @@ { "id": 3, "prompt": "Add a Convert action on `lead` — only for qualified, not-yet-converted leads, from the record header and each list row, launching the `crm_lead_conversion` flow — and a bulk 'Add to campaign' that asks which campaign, for the selected rows.", - "expected_output": "Two `defineAction` items. Convert: `type: 'flow'`, `target: 'crm_lead_conversion'`, `locations: ['record_header', 'list_item']`, `visible: P`record.status == \"qualified\" && record.is_converted == false`` (bare CEL, never brace-wrapped), `confirmText`, `successMessage`, `refreshAfter: true`. Bulk: `type: 'script'`, `execution: 'perRecord'`, wired by the lead list view's `bulkActions: ['']`, a field-backed `params: [{ field: 'campaign_id', objectOverride: 'campaign', required: true }]`, and a `body` that runs once per ticked row and reads that row's id as `ctx.recordId`.", + "expected_output": "Two `defineAction` items. Convert: `type: 'flow'`, `target: 'crm_lead_conversion'`, `locations: ['record']`, `visible: P`record.status == \"qualified\" && record.is_converted == false`` (bare CEL, never brace-wrapped), `confirmText`, `successMessage`, `refreshAfter: true`. Bulk: `type: 'script'`, `execution: 'perRecord'`, wired by the lead list view's `bulkActions: ['']`, a field-backed `params: [{ field: 'campaign_id', objectOverride: 'campaign', required: true }]`, and a `body` that runs once per ticked row and reads that row's id as `ctx.recordId`.", "files": [], "assertions": { - "must_contain": ["defineAction", "locations", "record_header", "bulkActions", "visible", "successMessage", "ctx.recordId"], + "must_contain": ["defineAction", "locations", "'record'", "bulkActions", "visible", "successMessage", "ctx.recordId"], "must_not_contain": ["{record.", "input.selectedIds"] } }, @@ -134,7 +134,7 @@ { "id": 14, "prompt": "Add a 'Mark as done' button on `task` records that sets `status` to Done (the option is labelled Done, its value is `done`).", - "expected_output": "A `defineAction`, not a view: `name`, `label: 'Mark as done'`, `objectName: 'task'`, `locations: ['record_header']`, `type: 'script'`, `body: { language: 'js', source: \"await ctx.api.object('task').update({ id: ctx.recordId, status: 'done' });\", capabilities: ['api.write'] }`, `refreshAfter: true`. The body CALLS the update with the option value: a body that returns `{ status: 'done' }` or assigns to `ctx.record` writes nothing, an `expression` body cannot write, and without `api.write` the sandbox refuses the call.", + "expected_output": "A `defineAction`, not a view: `name`, `label: 'Mark as done'`, `objectName: 'task'`, `locations: ['record']`, `type: 'script'`, `body: { language: 'js', source: \"await ctx.api.object('task').update({ id: ctx.recordId, status: 'done' });\", capabilities: ['api.write'] }`, `refreshAfter: true`. The body CALLS the update with the option value: a body that returns `{ status: 'done' }` or assigns to `ctx.record` writes nothing, an `expression` body cannot write, and without `api.write` the sandbox refuses the call.", "files": [], "assertions": { "must_contain": ["defineAction", "objectName: 'task'", "ctx.api.object('task').update", "ctx.recordId", "api.write", "status: 'done'"], @@ -233,8 +233,8 @@ }, { "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.", + "prompt": "`crm_opportunity` has five record actions, all placed at `record_page`: `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` 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"], @@ -254,7 +254,7 @@ { "id": 26, "prompt": "Add a 'Delete Task' button on the `project_task` record page that deletes the task. Our in-app assistant must be able to run it too, but only after the user agrees, since a deleted task's time entries go with it.", - "expected_output": "One registered `defineAction` on `objectName: 'project_task'` with a placement (`locations: ['record_header']`), a body that deletes the current record (a `type: 'script'` `js` body calling `ctx.api.object('project_task').delete(...)` on `ctx.recordId`, with `capabilities: ['api.write']`), `confirmText` for the person clicking, and `ai: { exposed: true, description: '…', requiresConfirmation: true }`. `confirmText` is the click dialog's copy only and gates no AI call, so the assistant's run is held for the user's approval by `ai.requiresConfirmation: true`, not by `confirmText` or by a sentence in `ai.description` asking the model to confirm first.", + "expected_output": "One registered `defineAction` on `objectName: 'project_task'` with a placement (`locations: ['record_page']`), a body that deletes the current record (a `type: 'script'` `js` body calling `ctx.api.object('project_task').delete(...)` on `ctx.recordId`, with `capabilities: ['api.write']`), `confirmText` for the person clicking, and `ai: { exposed: true, description: '…', requiresConfirmation: true }`. `confirmText` is the click dialog's copy only and gates no AI call, so the assistant's run is held for the user's approval by `ai.requiresConfirmation: true`, not by `confirmText` or by a sentence in `ai.description` asking the model to confirm first.", "files": [], "assertions": { "must_contain": ["requiresConfirmation: true", "exposed: true", "confirmText", "project_task"], diff --git a/skills/objectstack-ui/rules/actions.md b/skills/objectstack-ui/rules/actions.md index 83548250d5f..629bd519616 100644 --- a/skills/objectstack-ui/rules/actions.md +++ b/skills/objectstack-ui/rules/actions.md @@ -1,6 +1,5 @@ # Actions -Actions are user-triggered operations on an object or a view. Register them under `defineStack({ actions: [...] })`; the six types: [Action Types](../SKILL.md#action-types). @@ -17,23 +16,25 @@ in `language: 'js'` (an `expression` body has no I/O) with ## Where Actions Appear (`locations`) -| Value | Surface | +| Value | Acts on, and where | |:-----------------|:--------| -| `record_header` | Detail page header | -| `record_more` | Detail page overflow menu (⋯) | +| `list` | No record: the list page toolbar; one ticked row is its `recordId`, several are refused (no `_selectedIds`) | +| `record` | One record, the default: the record page and each list row | +| `record_page` | The record page only; `component: 'action:menu'` puts it in the ⋯ menu | +| `record_row` | Each list row only | | `record_related` | Related-list section in a record | | `record_section` | Body section/tab of a record | -| `list_item` | Per-row action in list views | -| `list_toolbar` | Toolbar button; one ticked row is its `recordId`, several are refused (no `_selectedIds`) | + +Until protocol 19: `list_toolbar` (now `list`), `list_item` (`record_row`), `record_header` / `record_more` (`record_page`). ## 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 +goes to the ⋯ menu, those `more` names first. `record` takes `record` / +`record_page` actions wherever that header draws (record page, side preview, +phone bar, a row's ⋮ menu order); `list` takes `list` actions and may pin `$import` / `$export` (pinned only). `os validate` refuses a name the arm's scope does not place, on the object or an extension of one the same stack defines. On an installed object only its paired `.custom` package's extension @@ -65,6 +66,7 @@ export const ReassignLeadAction = defineAction({ name: 'crm_reassign_lead', label: 'Reassign Lead', objectName: 'lead', + locations: ['record'], type: 'api', target: 'lead', disabled: P`record.status == "converted"`, @@ -90,6 +92,7 @@ export const ConvertLeadAction = defineAction({ name: 'crm_convert_lead', label: 'Convert Lead', objectName: 'lead', + locations: ['record'], icon: 'arrow-right-circle', type: 'flow', target: 'crm_lead_conversion', @@ -173,6 +176,7 @@ export const PrintA3Action = defineAction({ name: 'crm_print_a3', label: 'Print A3', objectName: 'lead', + locations: ['record_page'], type: 'url', target: '/print/a3?id=${ctx.recordId}', // interpolated at click openIn: 'new-tab', @@ -196,6 +200,7 @@ export const OpenInvoicePdfAction = defineAction({ name: 'crm_open_invoice_pdf', label: 'Open PDF', objectName: 'invoice', + locations: ['record'], type: 'script', target: 'crm_open_invoice_pdf', opensInNewTab: true, @@ -216,7 +221,7 @@ placeholder and widget come from the object metadata (`widget` only while the param keeps or restates the field's `type`; a param that overrides `type` names its own `widget`); `objectOverride` borrows a field of another object, and `defaultFromRow: true` -pre-fills from the selected row in `list_item`. +pre-fills from the list row it runs on (`record` / `record_row`). **An action that adds a child line sets its price.** `lookupAutofill` fills only the form and the grid, and a stored `expression` reads only its own row, so a @@ -232,6 +237,7 @@ export const AddInvoiceLineAction = defineAction({ name: 'crm_add_invoice_line', label: 'Add Line', objectName: 'invoice', + locations: ['record'], type: 'script', params: [ { field: 'product', objectOverride: 'invoice_line', required: true }, diff --git a/skills/objectstack-ui/rules/record-page.md b/skills/objectstack-ui/rules/record-page.md index 38d66eeafd8..ec48c879944 100644 --- a/skills/objectstack-ui/rules/record-page.md +++ b/skills/objectstack-ui/rules/record-page.md @@ -37,7 +37,7 @@ refused by name. `isDefault: true` makes it the object's default record page. that looks nothing like the default (a chart tab, a bespoke strip) is `kind: 'full'`: `regions` drawn as authored ([Pages](./pages.md)). A phone and the drawer draw the standard page (steps 1–3); no key keeps a full page there, only a page named in the URL (a print page) draws everywhere. The standard page -draws no `record_section` action: one that must show there also lists `record_more`. +draws no `record_section` action: one that must show there also lists `record_page`. **5 · On an object's list the name opens the page, its hover icon the drawer.** `navigation.mode` is deprecated there: `drawer`, `page`, `new_window` change