Skip to content

Give the {} event shorthand an empty-object JSON Schema - #153

Merged
davidkpiano merged 1 commit into
nextfrom
davidkpiano/empty-event-schema-json
Oct 12, 2026
Merged

davidkpiano merged 1 commit into
nextfrom
davidkpiano/empty-event-schema-json

Conversation

@davidkpiano

@davidkpiano davidkpiano commented Oct 12, 2026 •

Copy link
Copy Markdown
Member

Problem

An event declared with the {} shorthand in setupAgent({ events: { APPROVE: {} } }) and listed in agent.decide({ allowedEvents }) made createAiSdkExecutors fail:

Standard schema vendor 'statelyai-agent' does not support JSON Schema conversion.

The shorthand normalizes to a hand-rolled Standard Schema in src/setup-agent.ts. The AI SDK's asSchema converts non-zod Standard Schemas only through the ~standard.jsonSchema.input() extension, which that schema lacked.

Fix

emptyEventSchema now exposes jsonSchema.input() returning { type: "object", properties: {}, additionalProperties: false }, the same pattern the adapter's own fallback unknownSchema in src/ai-sdk/mappers.ts already uses.

Test

End-to-end test in src/ai-sdk/index.test.ts: {} event → agent.decide({ allowedEvents }) → createAiSdkExecutors with a mock model capturing the tool's input schema. Reproduced the exact error before the fix.

Patch changeset included. pnpm vitest --run src, typecheck, lint, format all green.


Devin Review

Events declared as `{}` normalize to a hand-rolled statelyai-agent Standard
Schema with no JSON Schema extension, so offering one to a model through
createAiSdkExecutors' decide path threw "Standard schema vendor
'statelyai-agent' does not support JSON Schema conversion." The schema now
exposes ~standard.jsonSchema.input() returning an empty object schema.
@changeset-bot

changeset-bot Bot commented Oct 12, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 45d6383

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 6 packages
Name Type
@statelyai/agent Patch
@statelyai/agent-demo Patch
@statelyai/example-next-host Patch
@statelyai/example-tanstack-ai-stream Patch
@statelyai/example-cloudflare-agent-host Patch
@statelyai/example-cloudflare-workers-ai-host Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@coderabbitai

coderabbitai Bot commented Oct 12, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 18 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 2 included reviews currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 79f3acbc-dfa3-4643-a27b-f0e45466adc8

📥 Commits

Reviewing files that changed from the base of the PR and between 42c37ba and 45d6383.


📒 Files selected for processing (3)
  • .changeset/empty-event-shorthand-json-schema.md
  • src/ai-sdk/index.test.ts
  • src/setup-agent.ts

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Devin Review

@davidkpiano
davidkpiano merged commit 7577d20 into next Oct 12, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant