Skip to content

feat: RFC-A017 capability I/O schema materialization#418

Open
ngalluzzo wants to merge 5 commits intomainfrom
feat/io-schema-typing
Open

feat: RFC-A017 capability I/O schema materialization#418
ngalluzzo wants to merge 5 commits intomainfrom
feat/io-schema-typing

Conversation

@ngalluzzo
Copy link
Owner

@ngalluzzo ngalluzzo commented Mar 5, 2026

Product Outcome

Capability I/O schemas are now materialized inline on every capability index entry. Authors see the actual JSON shape of a capability's input, output, and error contracts in IDE hover tooltips when writing their spec — no more opaque URI references.

User/Customer Impact

Spec authors get richer, context-aware capability documentation directly in their editor: when they tab-complete a capability name in a do block, the hover card shows the real field shapes (e.g. input: {"type":"object","properties":{"message_id":…}}), making it possible to understand a capability's contract without leaving the editor or looking up external docs.

Scope Delivered

Out of Scope

  • Populating the chunk schema slot (reserved for streaming capabilities; requires a future spec-level annotation RFC)
  • Spec-level error annotations (error slot currently produces an empty strict-object artifact)
  • Provider publish pipeline changes to actually populate LockedCapability.inputSchema at publish time
  • Catalog ingestion CLI threading from LockedCapability schemas into BuildCapabilityIndexSnapshotInput.catalogCapabilities

Issue Link

Closes #413
Closes #414
Closes #415
Closes #416
Closes #417

Nic Galluzzo added 5 commits March 4, 2026 19:59
)

Replaces the ioSchemaRefs URI-reference pattern with inline
capabilitySchemaArtifact objects (target + schema + hash) on every
CapabilityIndexEntry, eliminating the indirection gap identified in
RFC-A017.

Contract changes:
- capabilityIndexArtifactVersionSchema bumped 1.0.0 → 1.1.0
- capabilityIoSchemaRefsSchema removed; capabilityIoSchemasSchema added
  with required input/output/error slots and a reserved optional chunk slot
- build-capability-index-snapshot hardcoded version bumped to match

Call-site migrations:
- extractLocalCapabilities: stub URI refs → unknown-stub schema artifacts
  (real compilation wired in Phase 3 / #416)
- resolve-authoring-completion-item: renders JSON.stringify(schema) for
  each slot instead of raw URI strings (Phase 4 / #417 will add truncation)
- All test fixtures and completion-do golden updated to new shape

Closes #413
Adds compileCapabilitySchemas to the spec compiler that converts
domain.capabilities in/out field annotations into deterministic
CompiledJsonSchemaArtifact objects (target + schema + hash).

- New function reads spec.domain.capabilities.<id>.in and .out string
  annotation maps, compiles them through the canonical field type
  contracts, and returns per-capability { input, output, error } schema
  artifact tuples
- error slot always produces the empty strict-object artifact; a future
  RFC will introduce spec-level error annotations to populate it
- Exposed via new @gooi/spec-compiler/capability-schemas subpath export
  so authoring-diagnostics bootstrap can import without coupling to the
  main compile-bundle entrypoint
- Four new tests cover determinism, empty fallbacks, and full annotation
  compilation

Closes #414
)

Adds optional inputSchema / outputSchema / errorSchema fields to
lockedCapabilitySchema so provider publish pipelines can embed inline
JSON Schema objects directly in marketplace listing entries.

The fields are optional to preserve backward compatibility with legacy
listings published before RFC-A017. The CLI/bootstrap threading layer
(#416) will use these fields when assembling catalogCapabilities entries
for the capability index, falling back to empty-object stubs when the
schemas are absent.

Closes #415
#416)

Connects compileCapabilitySchemas to the bootstrapAuthoringContext pipeline
so local capability ioSchemas are derived from real in/out field annotations
instead of stub artifacts.

Changes:
- bootstrapAuthoringContext: calls compileCapabilitySchemas(specSnapshot) and
  passes the result to extractLocalCapabilities
- extractLocalCapabilities: accepts an optional compiledSchemas map; when a
  capabilityId has a compiled entry, uses its { input, output, error } artifacts;
  otherwise falls back to the unknown-stub artifacts (preserves backward compat
  for callers that don't provide schemas)
- New test "local capability ioSchemas reflect compiled in/out field annotations"
  verifies that the hash is not the stub placeholder and field properties are
  populated correctly after annotation compilation

Closes #416
…to completion hover (#417)

Introduces a dedicated formatSchemaForHover utility that serializes a
JSON Schema object into a compact hover string, truncating at 400
characters with an ellipsis to keep tooltips readable.

Updates resolveAuthoringCompletionItem to use formatSchemaForHover for
the input/output/error schema lines in completion item documentation,
replacing the bare JSON.stringify calls from Phase 1.

- format-schema-for-hover.ts: new utility with 400-char truncation limit
- resolve-authoring-completion-item.ts: imports and uses formatSchemaForHover
- format-schema-for-hover.test.ts: 4 tests covering empty schema, compact
  rendering, truncation, and the exact-400-char boundary

Closes #417
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6383019c45

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +23 to +24
"import": "./dist/capability-schemas/compile-capability-schemas.js",
"default": "./dist/capability-schemas/compile-capability-schemas.js"

Choose a reason for hiding this comment

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

P1 Badge Build the new capability-schemas entrypoint

The new ./capability-schemas export points import/default to ./dist/capability-schemas/compile-capability-schemas.js, but this commit does not add a corresponding bun build output for that file in the package build script. In workspace Bun runs this is masked by the bun condition (src/...), but published/Node consumers that resolve the import condition will hit a missing file at runtime (ERR_MODULE_NOT_FOUND).

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment