Repository navigation
Commit 6592546
docs(skills): data hooks and actions teach the multi-reason refusal throw (#37619)
<!-- claude-projects-attribution: {"github_login":"os-sales"} -->
_Requested by **Sales** · [project
thread](https://claude.ai/code/project/chan_01D5bWFY3rFzgJcytD5gD4Uu?thread=cmsg_01D5bWFY3rFzgJcytD5gD4UuPE7uyDAJyqjwwMzomWv5ff)_
Fixes #37407
Clause-②: no (published prose only; teaches the list throw already on
main)
Metadata-protocol: none
## 维护者速读
- 用户能看到什么变化:AI
助手照技能文档写钩子或动作时,现在会写「一次拒绝、列出多条原因」的写法,每条原因按用户的语言显示一行,最后一行是总结句。以前文档只教一次一条原因,这个能力在
#37395 已经上线,文档没跟上。
- 为什么做:#36877 的裁决要求配套技能文档;5
号座位审核时还留了两条要写进来:一条原因怎么声明,以及总结句里有占位符时要传顶层参数,否则占位处是空的。
-
出错会怎样:只改技能文字,不动产品。两个文件原本都没有余量,为了不变长,同文件里压缩了一些说法,删了一个重复的条件示例和示例里的一个字段,没有删掉事实。写错的话撤回即可。
- 要你做什么:这是受管的技能文件,需要审批人批准后才能合并。
## What changes
`skills/objectstack-data/references/data-hooks.md` and
`skills/objectstack-ui/rules/actions.md`, plus a `patch` changeset for
`@objectstack/skills`.
- **data-hooks.md, Declared refusals:**
- The `reasons` bullet says how an entry declares them: a snake_case
reason mapped to `{ message }` only, under the code's wire `code` and
status; another status needs another code (zone o5-U note N1, comment
7181230894).
- The `params` bullet says a reason's holes follow the same rule.
- A new bullet teaches the list throw, `reasons: [{ reason, params? },
…]` instead of `reason`: one translated line each, filled from its own
`params`; `userMessage` joins them by newlines and ends with the entry's
`message`, filled from the throw's top-level `params`, else its holes
are empty (note N3); the HTTP doors answer `details.refusals: [{ reason,
message }]`, absent for a single `reason` (the MCP tool gives the lines
as text beside its envelope, so the page does not say every door).
- The last bullet adds that a listed reason is judged even under a code
that declares no `reasons`, and that a `reasons` that is not a non-empty
list of `{ reason, params? }`, or one beside `reason`, is a `500`.
- **actions.md, Refusing by code:** one sentence with the shape: "For
several reasons throw `reasons: [{ reason, params? }, …]`, not `reason`:
`userMessage` is one line per reason, closed by the code's `message`
(rules there)." The rules stay a pointer to the hook section.
- **Paid in the same files.** Both sat at zero token headroom, so every
added byte is paid for nearby; net −13 lines. Removed: the third
("Complex conditions") `condition` example, two comments that restated
the condition below them, `annual_revenue` from the insert `input`
sample, the "lifecycle events organized by operation type" lead-in. The
rest is tightened wording (data-hooks: What Are Hooks, `defineHook`,
`has()`, `filter:`, `findOne`, unpredicated `find`, capabilities
lead-in, `ctx.log`, `HookContext` note, `ctx.input`; actions: shorter
example strings and one `params` array on one line). No other file pins
any shortened string.
Checked against
`packages/runtime/src/sandbox/hook-refusal-catalogue.ts`,
`quickjs-runner.ts` and `packages/spec/src/data/declared-entry.zod.ts`
on `main`: the join order and closing line, top-level `params` filling
the closing `message`, `details.refusals` only on a list throw, a listed
reason judged under every code, `{ message }` as the reason value.
Small calls made here (no card):
- The list form is shown inline in a bullet, not as a second throw in
the example, to fit the byte budget. The assignment form (`e.reasons =
[...]; throw e`) is not taught; the object-literal throw is the one the
page already uses.
- The three list faults are written as run-time `500`s: the source
detects them in the runner, not at save.
- actions.md describes `userMessage`, not how the console toast renders
its newlines, which was not traced. The console's param-dialog listing
of reasons (#37538) is not taught here.
## Why
PR #37395 (#36877) let one throw carry several declared reasons. Its
`Skills-docs:` line points here: both pages taught the single `reason`
form only, so an agent writing a hook or action that refuses a selection
for several reasons had no pointer to the list.
## Verification
Run at `19b5b425d` (contract-review fixes; `f0fd20d1e` before), each
exit 0:
- `node scripts/check-skills-token-ratchet.mjs`: both files within their
ceilings (data-hooks.md 10122/10122, actions.md 3880/3880).
- `node scripts/check-skill-links.mjs`, `node
scripts/check-skill-identifier-liveness.mjs`, `node
scripts/check-skill-top-level-keys.mjs`.
- `pnpm --filter @objectstack/spec check:skill-refs`,
`check:skill-docs`.
- `pnpm --filter @objectstack/spec check:skill-examples` (after building
spec, client and client-react): 352 prose examples type-check, the
edited `os:check` blocks included.
- `node scripts/pm/overlap-check.mjs`: clean.
The edits were drafted by a contract-tier subagent, as `dispatch-gates
--tier` requires for `skills/**`, and reviewed here (one claim
narrowed). The contract-review fixes (S1, N1, N3 of 7197638051) were
drafted the same way; the extra bytes in actions.md are paid by
wording-only tightenings in the same file.
Contract review (L2) is owed before landing: `skills/**` is a governed
surface (Tier H).
## Human Minimum
- [x] 1. Schemas start as Zod; `packages/spec` holds no runtime logic.
- [x] 2. Every name I added uses the casing for its kind.
- [x] 3. No formatter ran; `pnpm lint` passes.
- [x] 4. One issue, one branch off an up-to-date `main`, one pull
request.
- [x] 5. A change that publishes carries a changeset, and both
declaration lines are filled in here and in the changeset.
- [x] 6. `packages/spec` touched: its generated artifacts are
regenerated and committed (not touched).
- [x] 7. No hand edits to `content/docs/references/`,
`packages/*/CHANGELOG.md` or `content/docs/releases/`.
- [x] 8. Title, body and comments are in English.
- [x] The *Before Submitting* list in CONTRIBUTING.md is done.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
https://claude.ai/code/session_01L6bhgUpnvPnJ1hR74pUrVj
---
_Generated by [Claude
Code](https://claude.ai/code/session_01L6bhgUpnvPnJ1hR74pUrVj)_
<!-- signed: repo:objectstack#2 · os-sales ·
session_01L6bhgUpnvPnJ1hR74pUrVj -->
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent 68aa1be commit 6592546
3 files changed
Lines changed: 68 additions & 71 deletions
File tree
- .changeset
- skills
- objectstack-data/references
- objectstack-ui/rules
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
20 | | - | |
21 | | - | |
| 20 | + | |
| 21 | + | |
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
25 | | - | |
26 | | - | |
27 | 25 | | |
28 | 26 | | |
29 | 27 | | |
| |||
66 | 64 | | |
67 | 65 | | |
68 | 66 | | |
69 | | - | |
70 | | - | |
71 | | - | |
72 | | - | |
73 | | - | |
74 | | - | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
75 | 72 | | |
76 | 73 | | |
77 | 74 | | |
| |||
125 | 122 | | |
126 | 123 | | |
127 | 124 | | |
128 | | - | |
| 125 | + | |
129 | 126 | | |
130 | 127 | | |
131 | 128 | | |
132 | 129 | | |
133 | | - | |
134 | 130 | | |
135 | 131 | | |
136 | | - | |
137 | 132 | | |
138 | 133 | | |
139 | | - | |
140 | | - | |
141 | | - | |
142 | 134 | | |
143 | 135 | | |
144 | 136 | | |
| |||
180 | 172 | | |
181 | 173 | | |
182 | 174 | | |
183 | | - | |
184 | | - | |
| 175 | + | |
| 176 | + | |
185 | 177 | | |
186 | 178 | | |
187 | 179 | | |
| |||
280 | 272 | | |
281 | 273 | | |
282 | 274 | | |
283 | | - | |
284 | | - | |
| 275 | + | |
285 | 276 | | |
286 | | - | |
287 | | - | |
288 | | - | |
289 | | - | |
290 | | - | |
291 | | - | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
292 | 281 | | |
293 | 282 | | |
294 | 283 | | |
| |||
298 | 287 | | |
299 | 288 | | |
300 | 289 | | |
301 | | - | |
302 | | - | |
| 290 | + | |
303 | 291 | | |
304 | 292 | | |
305 | 293 | | |
306 | 294 | | |
307 | 295 | | |
308 | | - | |
309 | | - | |
| 296 | + | |
| 297 | + | |
310 | 298 | | |
311 | 299 | | |
312 | 300 | | |
| |||
424 | 412 | | |
425 | 413 | | |
426 | 414 | | |
427 | | - | |
428 | | - | |
| 415 | + | |
429 | 416 | | |
430 | 417 | | |
431 | 418 | | |
432 | 419 | | |
433 | 420 | | |
434 | | - | |
435 | | - | |
436 | | - | |
437 | | - | |
| 421 | + | |
| 422 | + | |
438 | 423 | | |
439 | 424 | | |
440 | 425 | | |
| |||
504 | 489 | | |
505 | 490 | | |
506 | 491 | | |
507 | | - | |
| 492 | + | |
508 | 493 | | |
509 | 494 | | |
510 | 495 | | |
| |||
513 | 498 | | |
514 | 499 | | |
515 | 500 | | |
516 | | - | |
517 | 501 | | |
518 | 502 | | |
519 | 503 | | |
| |||
770 | 754 | | |
771 | 755 | | |
772 | 756 | | |
773 | | - | |
774 | 757 | | |
775 | 758 | | |
776 | 759 | | |
| |||
791 | 774 | | |
792 | 775 | | |
793 | 776 | | |
794 | | - | |
795 | 777 | | |
796 | 778 | | |
797 | 779 | | |
| |||
802 | 784 | | |
803 | 785 | | |
804 | 786 | | |
805 | | - | |
806 | | - | |
807 | | - | |
808 | | - | |
| 787 | + | |
| 788 | + | |
| 789 | + | |
809 | 790 | | |
810 | 791 | | |
811 | 792 | | |
| |||
840 | 821 | | |
841 | 822 | | |
842 | 823 | | |
843 | | - | |
844 | | - | |
845 | | - | |
846 | | - | |
| 824 | + | |
| 825 | + | |
| 826 | + | |
| 827 | + | |
| 828 | + | |
| 829 | + | |
| 830 | + | |
| 831 | + | |
| 832 | + | |
847 | 833 | | |
848 | 834 | | |
849 | | - | |
850 | | - | |
851 | | - | |
| 835 | + | |
| 836 | + | |
| 837 | + | |
| 838 | + | |
852 | 839 | | |
853 | 840 | | |
854 | 841 | | |
| |||
0 commit comments