Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions .changeset/33689-ai-action-confirmation-elicited.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
---
'@objectstack/spec': minor
---

feat(spec)!: a declared-gated action on an AI door is confirmed by a person, elicited in the MCP client or handed off to the app, never by the caller's own `confirm: true`

Clause-②: yes (narrowing) — once the doors implement the contract, a caller's `confirm: true` stops counting on an action declaring `ai.requiresConfirmation: true`; `@objectstack/spec/contracts` gains `AI_ACTION_CONFIRMATION_CAPABILITY`, `ACTION_CONFIRMATION_REFUSAL_REASONS`, `ActionConfirmationRefusalReason`, `ActionConfirmationHandOff`, `ActionConfirmationPending`, `IActionConfirmationService`, `ACTION_CONFIRMATION_SERVICE` and the optional `ActionConfirmationRequiredDetails.reason`.
Metadata-protocol: semantic
Skills-docs: follow-up — `skills/objectstack-ai/SKILL.md` (the MCP tool table: `run_action` / `resume_run` "refused with the same 428 unless the call sends `confirm: true`") teaches the member contract, which is still the door's behaviour in this release; it moves with the change that implements the doors, together with the MCP-served skill text (`packages/mcp/src/skill-md.ts`, `ui/apps/console/src/pages/developer/objectstack-skill.ts`) and the `ToolSchema` prescription in `packages/spec/src/ai/tool.zod.ts`.

<!-- adr-0087: registered action-requires-confirmation-elicited -->

**BREAKING, when the implementing change ships**, for an MCP client, an agent or a script that runs an action declaring `ai.requiresConfirmation: true` through `run_action` or `resume_run` by sending `confirm: true` itself. Ruled by the account owner: 「3826 照建议(征询版)」, amended 「我开始重新接受你说的主流方案,就是推送到客户的手机端」 and 「比如最简单的我可以先推送到邮件」.

⚠ In the release that carries this changeset nothing changes at any door: `run_action` and `resume_run` still run a declared-gated action on `confirm: true` and refuse it without, over stdio and Streamable HTTP alike. Keep sending `confirm: true` until a release's changelog says the doors confirm by elicitation. What ships now is the contract the doors move to, in `@objectstack/spec/contracts` (`AI_ACTION_CONFIRMATION_CAPABILITY`, `contracts/ai-service.ts`):

- After every admission gate (the subject load included) and before anything runs, the person is asked, in three steps: **elicit** when the client advertised `elicitation` at `initialize` and the door can carry it (one `elicitation/create`, form mode); otherwise **hand off** to the host's pending-confirmation service (`IActionConfirmationService`, registered under `ACTION_CONFIRMATION_SERVICE` = `'ai.actionConfirmation'`), answering `status: 'pending_confirmation'` with a pending id and a plain message, the person the call ran as, and only they, then approving or rejecting in the app, where the action runs as them with every gate and permission re-checked; a handed-off `resume_run` carries its run id and values (`ActionConfirmationHandOff.run`), and approving it resumes that parked run, never a new one; **refuse** only when the host registers no such service (`428 ACTION_CONFIRMATION_REQUIRED`, `details.reason: 'no_confirmation_service'`).
- An elicited `accept` runs the call once; `decline`, `cancel` (an error answer or a dropped connection included) and no answer within the door's bound are refused with reason `declined`, `cancelled` or `timed_out`. A call refused at confirmation may have read its subject and writes nothing.
- The approve and reject doors of the pending-confirmation service take a person's signed-in session to the app and nothing else: they refuse an AI identity, and an API key, token or other service credential, whoever it resolves to. When a pending item lapses, and how the caller learns its outcome, are the host's to define.
- The caller's `confirm` never counts on such a call.
- An AI service account acting for itself is refused whatever it sends, unchanged (ADR-0151 D3 rule 3), with reason `service_account` on every door; it is neither elicited nor handed off.
- An elicited `accept` proves the client answered, not that a person did; an approved hand-off proves a signed-in session to the app answered, not that a person did.
- Outside the amendment: the MCP `delete_record` and `delete_records` gates still read `confirm: true`, and REST `/actions` stays outside the gate for a person.

The semantic entry `action-requires-confirmation-elicited` carries the same notice, with the same timing, into the upgrade guide and `os migrate meta`.

What changes for a caller, from the release whose doors implement it:

- FROM confirm with the person yourself, then send `confirm: true` on `run_action` / `resume_run` TO advertise `elicitation` (form mode) at `initialize` and let the server ask the person, or, from a client that cannot, relay the pending answer's message and let the person decide in the app; `confirm` then confers nothing.
- FROM a script or agent that runs a gated action unattended with `confirm: true` TO a pending answer the person decides in the app (or a refusal on a host with no pending-confirmation service); where the action is safe unattended, its author declares `ai.requiresConfirmation: false`.
7 changes: 7 additions & 0 deletions packages/spec/api-surface/contracts.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
"description": "Every exported `name (kind)` of one published entry point of @objectstack/spec — the breadth half of the ADR-0059 backward-compatibility gate. Sharded by entry point (#5837) so two PRs touching different entry points never share a file. Reads the BUILT dist/*.d.ts: regenerate with `pnpm --filter @objectstack/spec gen:api-surface` after a real build.",
"entry": "./contracts",
"exports": [
"ACTION_CONFIRMATION_REFUSAL_REASONS (const)",
"ACTION_CONFIRMATION_SERVICE (const)",
"AIActionConfirmation (interface)",
"AIConversation (interface)",
"AIMessage (type)",
Expand All @@ -14,6 +16,7 @@
"AIToolCall (type)",
"AIToolDefinition (interface)",
"AIToolResult (type)",
"AI_ACTION_CONFIRMATION_CAPABILITY (const)",
"AI_ACTION_CONFIRMATION_MEMBER (const)",
"APPROVAL_ACTION_KINDS (const)",
"APPROVAL_ACTION_KIND_LABELS (const)",
Expand All @@ -23,6 +26,9 @@
"APPROVAL_STATUS_LABELS (const)",
"AUDIT_CHECKPOINT_SIGNER_SERVICE (const)",
"AUDIT_CHECKPOINT_SINK_SERVICE (const)",
"ActionConfirmationHandOff (interface)",
"ActionConfirmationPending (interface)",
"ActionConfirmationRefusalReason (type)",
"ActionConfirmationRequiredDetails (interface)",
"AdapterContext (interface)",
"AdapterSearchOptions (interface)",
Expand Down Expand Up @@ -135,6 +141,7 @@
"HttpResponseObserver (type)",
"IAIConversationService (interface)",
"IAIService (interface)",
"IActionConfirmationService (interface)",
"IAdvancedServiceRegistry (interface)",
"IAnalyticsService (interface)",
"IAppLifecycleService (interface)",
Expand Down
7 changes: 7 additions & 0 deletions packages/spec/export-origins/contracts.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
"description": "Which SOURCE DECLARATION each name exported by one public entry point of @objectstack/spec resolves to, after its alias chain is unwound: `<src path>#<declared name> (<kind>)`. Two exports share an origin string iff they are the same declaration — so equal origins across two entries are a harmless re-export, and different origins under one name are the #4411 dual-source trap. Generated from src/ (no build needed) and read by the export-surface pin tests, which compare against it instead of each building their own ts.createProgram — that was ~55s of compilation per CI lap and a non-deterministic timeout that ejected unrelated PRs from the merge queue (#4796). Sharded by entry point (#5837) so two retirement PRs never share a file. Carries NO line numbers: the pins asserted the line as `\\d+`, and recording it would rewrite this artifact on every edit that shifts a line in any .zod.ts. Regenerate with `pnpm --filter @objectstack/spec gen:export-origins` and read the diff.",
"entry": "./contracts",
"exports": {
"ACTION_CONFIRMATION_REFUSAL_REASONS": "src/contracts/ai-service.ts#ACTION_CONFIRMATION_REFUSAL_REASONS (const)",
"ACTION_CONFIRMATION_SERVICE": "src/contracts/ai-service.ts#ACTION_CONFIRMATION_SERVICE (const)",
"AIActionConfirmation": "src/contracts/ai-service.ts#AIActionConfirmation (interface)",
"AIConversation": "src/contracts/ai-service.ts#AIConversation (interface)",
"AIMessage": "src/contracts/ai-service.ts#AIMessage (type)",
Expand All @@ -14,6 +16,7 @@
"AIToolCall": "src/contracts/ai-service.ts#AIToolCall (type)",
"AIToolDefinition": "src/contracts/ai-service.ts#AIToolDefinition (interface)",
"AIToolResult": "src/contracts/ai-service.ts#AIToolResult (type)",
"AI_ACTION_CONFIRMATION_CAPABILITY": "src/contracts/ai-service.ts#AI_ACTION_CONFIRMATION_CAPABILITY (const)",
"AI_ACTION_CONFIRMATION_MEMBER": "src/contracts/ai-service.ts#AI_ACTION_CONFIRMATION_MEMBER (const)",
"APPROVAL_ACTION_KINDS": "src/contracts/approval-service.ts#APPROVAL_ACTION_KINDS (const)",
"APPROVAL_ACTION_KIND_LABELS": "src/contracts/approval-service.ts#APPROVAL_ACTION_KIND_LABELS (const)",
Expand All @@ -23,6 +26,9 @@
"APPROVAL_STATUS_LABELS": "src/contracts/approval-service.ts#APPROVAL_STATUS_LABELS (const)",
"AUDIT_CHECKPOINT_SIGNER_SERVICE": "src/contracts/audit-checkpoint.ts#AUDIT_CHECKPOINT_SIGNER_SERVICE (const)",
"AUDIT_CHECKPOINT_SINK_SERVICE": "src/contracts/audit-checkpoint.ts#AUDIT_CHECKPOINT_SINK_SERVICE (const)",
"ActionConfirmationHandOff": "src/contracts/ai-service.ts#ActionConfirmationHandOff (interface)",
"ActionConfirmationPending": "src/contracts/ai-service.ts#ActionConfirmationPending (interface)",
"ActionConfirmationRefusalReason": "src/contracts/ai-service.ts#ActionConfirmationRefusalReason (type)",
"ActionConfirmationRequiredDetails": "src/contracts/ai-service.ts#ActionConfirmationRequiredDetails (interface)",
"AdapterContext": "src/contracts/knowledge-adapter.ts#AdapterContext (interface)",
"AdapterSearchOptions": "src/contracts/knowledge-adapter.ts#AdapterSearchOptions (interface)",
Expand Down Expand Up @@ -135,6 +141,7 @@
"HttpResponseObserver": "src/contracts/http-server.ts#HttpResponseObserver (type)",
"IAIConversationService": "src/contracts/ai-service.ts#IAIConversationService (interface)",
"IAIService": "src/contracts/ai-service.ts#IAIService (interface)",
"IActionConfirmationService": "src/contracts/ai-service.ts#IActionConfirmationService (interface)",
"IAdvancedServiceRegistry": "src/contracts/service-registry.ts#IAdvancedServiceRegistry (interface)",
"IAnalyticsService": "src/contracts/analytics-service.ts#IAnalyticsService (interface)",
"IAppLifecycleService": "src/contracts/app-lifecycle-service.ts#IAppLifecycleService (interface)",
Expand Down
Loading
Loading