Skip to content

Conversation

@adilhbay
Copy link

@adilhbay adilhbay commented Jan 26, 2026

Summary

  • Add TypeSpec emitter that generates Effect Schema definitions from TypeSpec models
  • Support for @mutationTool, @explorationTool, and @executionTool decorators
  • Auto-generate mutation tool schemas (Create/Update/Delete) from collection models
  • Fix schema generation for optional fields with descriptions
  • Split ConnectNodes into sequential and branching tools for clearer API

Test plan

  • Go tests pass
  • TypeScript typecheck passes
  • Schema generation produces valid Effect Schemas
  • Optional fields with annotations generate correct code pattern

adilhbay and others added 13 commits January 21, 2026 22:06
   - Use Object.values().map() instead of manual listing in index.ts
   - Delete schemas-effect.ts (209 lines of unnecessary re-exports)
   - Delete test-effect-schemas.ts (development artifact)
   - Build validation map dynamically from EffectSchemas

   Adding a new tool now requires only 2 steps:
   1. Add schema to MutationSchemas/ExplorationSchemas/ExecutionSchemas
   2. Run pnpm generate:schemas
Replace hand-written Effect Schema definitions with TypeSpec-generated code.
This introduces a new emitter that transforms @aitool decorated models into
Effect Schema TypeScript files.

New emitter infrastructure (tools/spec-lib/src/ai-tools/):
- lib.ts: @aitool decorator and ToolCategory enum
- main.tsp: TypeSpec declarations
- emitter.tsx: Alloy.js emitter generating Effect Schemas
- index.ts: Module exports

Tool definitions moved to TypeSpec (packages/spec/api/flow.tsp):
- 12 Mutation tools (CreateJsNode, ConnectNodes, etc.)
- 8 Exploration tools (GetWorkflowGraph, SearchApiDocs, etc.)
- 3 Execution tools (RunWorkflow, StopWorkflow, ValidateWorkflow)

The emitter generates code that imports shared schemas from common.ts
and produces the same JSON Schema output as the hand-written files.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
… decorator

Replace 23 duplicate AI tool models with a @mutationTool decorator on
collection models. The emitter resolves Insert/Update/Delete properties
at emit time based on primary keys, visibility, and exclude lists.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Auto-generate Get{ModelName} exploration tools from @mutationTool-decorated
collections using PK fields. Annotate FlowRunRequest/FlowStopRequest with
@aitool for execution schema generation.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
…ema generation

Add a new @explorationTool decorator that generates custom exploration tools
from collection model primary keys. Apply it to the Flow model to create a
ValidateWorkflow tool. Also wire up execution and exploration schemas into
the JSON schema generator alongside mutations.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Extract getFieldSchema/formatStringLiteral to field-schema.ts, replace
implicit auto-generated Get* exploration tools with explicit @explorationTool
decorators on each mutation model, unify 3 import components and 4
tool/property schema components into single generic versions, and simplify
CategoryFiles to a uniform rendering path. Reduces emitter from 772 to 331
lines.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Make sourceHandle optional on Edge model so ConnectNodes allows omitting
it for sequential flows. Add exclude support to the emitter's Update case
so UpdateNodeConfig correctly omits the immutable kind field.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Replace single ConnectNodes tool with two specialized tools:
- ConnectSequentialNodes: excludes sourceHandle for ManualStart/JS/HTTP nodes
- ConnectBranchingNodes: requires sourceHandle for Condition/For/ForEach nodes

This eliminates the need for optional sourceHandle which caused Go type issues.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Fix OptionalPosition to apply annotations inside Schema.optional wrapper
- Fix emitter to generate correct code for optional fields with descriptions
- Add src/tools to tsconfig.lib.json include list
- Fix index signature access to use bracket notation in index.ts

Schema.optional() returns a PropertySignature that cannot be piped,
so annotations must be applied to the inner schema first.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
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