Skip to content

feat(ai): actions opt in to AI tools via ai: block (ADR-0011) - #1581

Merged
xuyushun441-sys merged 1 commit into
mainfrom
feat/adr-0011-actions-as-ai-tools
Jun 4, 2026
Merged

feat(ai): actions opt in to AI tools via ai: block (ADR-0011)#1581
xuyushun441-sys merged 1 commit into
mainfrom
feat/adr-0011-actions-as-ai-tools

Conversation

@xuyushun441-sys

Copy link
Copy Markdown
Contributor

What

Implements ADR-0011 (Actions as AI Tools) with the opt-in ai: block design, and realigns the ADR doc with what's now built.

An Action becomes an AI-callable tool only when it opts in (ai.exposed: true), which requires an explicit, LLM-facing ai.description (≥40 chars, distinct from the UI label). No heuristic auto-exposure, no label-derived descriptions.

Why opt-in (and why now)

The first implementation (same day as the original draft) shortcut to opt-out + heuristic auto-exposure + label-derived descriptions — contradicting two explicit points of the ADR. In an AI-authoring world, writing a description is no longer a burden (the AI author writes it for free), so the only thing opt-in costs is friction that no longer exists — while the governance gate it provides (a human decides which capabilities the agent fleet may invoke) becomes the platform's core value. Since the platform has not yet shipped, this is a clean break: the aiExposed field is removed outright, no compat shim.

Changes

  • spec: ActionAiSchema (exposed / description / category / paramHints / outputSchema / requiresConfirmation) on ActionSchema + refine rules (exposed⇒description; paramHints keys ⊆ params); remove flat aiExposed; extend AIToolDefinition with category/outputSchema/objectName/requiresConfirmation; Studio action.formaiExposedai block.
  • service-ai: action-tools.ts bridge gates on opt-in, uses ai.description, merges paramHints, summarises outputSchema into the description, honours the requiresConfirmation override (reuses the existing HITL approval queue), and emits a lint warning when an exposed destructive-looking action asserts itself safe.
  • examples/app-todo: migrate script actions to opt-in (ADR Phase 2 testbed).
  • docs: rewrite ADR-0011 → Accepted/Implemented with the AI-author rationale and the as-built bridge.

Verification

  • spec + service-ai unit tests: 96 passed (new cases: ai-block validation, paramHints merge, outputSchema summary, category/requiresConfirmation passthrough, lint warning); full service-ai suite 328 passed.
  • @objectstack/spec and @objectstack/service-ai build + DTS clean.
  • app-todo demo: exactly the 5 opted-in script actions register; modal + dangerous actions correctly excluded; HITL path registers delete_completed only when approval is wired. (The demo's sys_user "no such table" exit is pre-existing — confirmed identical on baseline with these changes stashed — and unrelated to exposure.)

🤖 Generated with Claude Code

Realign ADR-0011 with its original opt-in design and finalise the
implementation. An Action becomes an AI-callable tool only when it sets
`ai.exposed: true`, which requires an explicit LLM-facing `ai.description`
(distinct from the UI `label`). No heuristic auto-exposure, no label-derived
descriptions — a clean break from the first implementation's opt-out
`aiExposed` flag, which is removed outright (no compat shim; not yet shipped).
- spec: ActionAiSchema (exposed/description/category/paramHints/outputSchema/
requiresConfirmation) + refines; remove aiExposed; extend AIToolDefinition
with category/outputSchema/objectName/requiresConfirmation; update action.form.
- service-ai: bridge gates on opt-in, uses ai.description, merges paramHints,
summarises outputSchema into the description, honours requiresConfirmation
override, and warns on exposed destructive actions asserted safe.
- examples/app-todo: migrate script actions to opt-in (testbed).
- docs: rewrite ADR-0011 to Accepted/Implemented with the AI-author rationale.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@vercel

vercelBot commented Jun 4, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

ProjectDeploymentActionsUpdated (UTC)
specReadyReadyPreview, CommentJun 4, 2026 1:41pm

Request Review

@github-actionsgithub-actionsBot added documentation Improvements or additions to documentation tests protocol:ui tooling size/xl labels Jun 4, 2026
@xuyushun441-sys
xuyushun441-sys merged commit a46c017 into mainJun 4, 2026
12 checks passed
@xuyushun441-sys
xuyushun441-sys deleted the feat/adr-0011-actions-as-ai-tools branch June 4, 2026 13:47
os-zhuang added a commit that referenced this pull request Jun 8, 2026
…1666)
Add parent-scoped readonlyWhen rules to showcase_invoice_line's product,
quantity and unit_price: readonlyWhen "parent.status == 'paid'". The inline
line-item grid evaluates these per row against the live header invoice, so a
paid invoice's lines render read-only — the "paid invoice → lock lines" case.
Pairs with objectui#1607 (MasterDetailForm binds the header as `parent`).
Co-authored-by: Jack <zhuangjianguo@gmail.com>
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
os-zhuang added a commit that referenced this pull request Jun 22, 2026
…ADR-0032) (#2187)
Extends the action-predicate guard to the remaining flat record-scoped sites,
catching bare field references that silently mis-behave at runtime:
- field conditional rules (requiredWhen/readonlyWhen/conditionalRequired/visibleWhen) — fail-open when broken
- sharing-rule condition (security: which rows a principal sees)
- lifecycle hook condition (skips handler when false)
- nested `when` on conditional validation rules
formula: add `parent` to record-scope namespace roots — master-detail inline
grids inject the header record as `parent` for a child field's readonlyWhen
(ADR-0036, #1581), so `parent.status` is legitimate, not a bare ref.
Verified: full monorepo build 76 tasks clean (zero false positives across all
examples + platform bundles); cli validator suite 25 cases (5 new).
Deeply-nested UI visibility (view/page tree, object field-group visibleOn,
app-nav) is deferred — it needs a recursive walker + per-node scope rules.
Co-authored-by: Jack Zhuang <277994282+os-zhuang@users.noreply.github.com>
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentationImprovements or additions to documentationprotocol:uisize/xlteststooling

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@xuyushun441-sys@os-zhuang