Skip to content

Refactor schema system: pass ParsedActionSchema in-memory instead of re-reading files#2015

Merged
curtisman merged 2 commits intomicrosoft:mainfrom
curtisman:compfixes
Mar 17, 2026
Merged

Refactor schema system: pass ParsedActionSchema in-memory instead of re-reading files#2015
curtisman merged 2 commits intomicrosoft:mainfrom
curtisman:compfixes

Conversation

@curtisman
Copy link
Member

Summary

Refactors the schema pipeline to pass already-loaded ParsedActionSchema objects in-memory instead of repeatedly reading .pas.json and .ts files from disk.

Changes

Manifest field naming

  • Renames compiledSchemaFileschemaFile (points to compiled .pas.json)
  • Renames schemaFileoriginalSchemaFile (points to .ts source for legacy code paths)
  • Makes schema paths relative to the package directory
  • Documents path resolution behavior in agentInterface.ts

Eliminate redundant file I/O

  • enrichGrammarWithCheckedVariables now accepts ParsedActionSchema directly instead of loading from a file path
  • Grammar generation callback (configureGrammarGeneration) returns ParsedActionSchema from the in-memory actionSchemaFileCache instead of resolving file paths on disk
  • MCP server schema text is generated from parsed schema via generateSchemaTypeDefinition instead of reading .ts files from disk
  • AgentSubSchemaInfo uses schemaText (generated from PAS) instead of schemaFilePath

New API

  • Adds getSchemaInfoFromParsedSchema() to actionGrammar for extracting SchemaInfo from an in-memory ParsedActionSchema, with loadSchemaInfo refactored to delegate to it

Type safety

  • Uses proper ParsedActionSchema typing in agent-cache instead of any

Files changed (28)

  • 14 agent manifest JSON files (field renames + relative paths)
  • Core schema pipeline: actionConfig.ts, agentInterface.ts, schemaReader.ts, generation/index.ts
  • Grammar: grammarMetadata.ts, appAgentManager.ts
  • Dispatcher: dispatcher.ts, commandHandlerContext.ts, dispatcherTypes, agentTranslators.ts
  • Cache: cache.ts, grammarIntegration.spec.ts
  • Server: commandServer.ts
  • Provider: npmAgentProvider.ts

…re-reading files

Rename manifest fields back to original convention:
- compiledSchemaFile -> schemaFile (points to .pas.json compiled format)
- schemaFile -> originalSchemaFile (points to .ts source for legacy code paths)

Eliminate redundant file I/O throughout the schema pipeline:
- enrichGrammarWithCheckedVariables now accepts ParsedActionSchema directly
  instead of loading from a file path
- Grammar generation callback returns ParsedActionSchema from the already-loaded
  actionSchemaFileCache instead of resolving file paths
- Schema text for MCP server is generated from parsed schema via
  generateSchemaTypeDefinition instead of reading .ts files from disk
- AgentSubSchemaInfo uses schemaText (generated) instead of schemaFilePath

Add getSchemaInfoFromParsedSchema to actionGrammar for extracting SchemaInfo
from an in-memory ParsedActionSchema, with loadSchemaInfo refactored to use it.

Use proper ParsedActionSchema typing in agent-cache instead of 'any'.

Make schema paths in manifests relative to the package directory and document
path resolution behavior in agentInterface.ts.
@curtisman curtisman added this pull request to the merge queue Mar 17, 2026
Merged via the queue into microsoft:main with commit fdf4164 Mar 17, 2026
13 of 15 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