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.form aiExposedai 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
Copy link
Copy Markdown

vercel Bot commented Jun 4, 2026

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

Project Deployment Actions Updated (UTC)
spec Ready Ready Preview, Comment Jun 4, 2026 1:41pm

Request Review

@github-actions github-actions Bot 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 main Jun 4, 2026
12 checks passed
@xuyushun441-sys xuyushun441-sys deleted the feat/adr-0011-actions-as-ai-tools branch June 4, 2026 13:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation protocol:ui size/xl tests tooling

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants