Repository navigation
Agent-facing service schemas (external on any schema, toTypeScript audience, AsyncDataService.toObserveState) + defaultFactory Store<any> fix - #214
Merged
Conversation
…ence filter, AsyncDataService.toState Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…signable to Store<any, any, any> Relating Archetype.insert's generic Exact signature to an any-row archetype infers U = any, and Exact<T, any> collapsed to never. A defaultFactory store was therefore not assignable to Store<any, any, any>, so a single such transaction member (e.g. applyOperations) erased every transaction on its plugin and Store.Resources/Archetypes of that store evaluated to never. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… schema Removes the deprecated signature.external fallback and inlines the policy shape on Schema.external instead of exporting a separate External type. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Agent-facing service schemas
external(Schema.external) — the{ agent?, link? }exposure policy now lives on the member schema itself and is valid on any schema (actions, states, nested groups). BREAKING:signature.externalis removed — move it up one level onto the function schema.toTypeScript(schema, name, { audience })—audiencedefaults to"agent", omitting every property (at any depth) whose policy hides it from that channel, soexternal: { agent: false }members are never documented to an agent."link"keeps onlylink: truemembers;"all"emits everything.AsyncDataService.toObserveState(service)— walks the service's schema (through nested groups), observes everyobservemember in parallel viaObserve.fromProperties, and emits one object with the service's nested shape (state.foo.state.b). Typed asAsyncDataService.State<T>:Observe<X>→X, actions and action-only groups omitted, optional members stay optional. Re-derives the member set whenservice.schemachanges. Does not filter byexternal.defaultFactory type collapse fix
A
defaultFactorystore was not assignable toStore<any, any, any>: relatingArchetype.insert's generic<T>(row: Exact<V, T>)signature to an any-row archetype infersT = any, andExact<V, any>collapsed tonever. So a singleStore<any, any, any>-typed transaction member (e.g. the library's ownapplyOperations) was rejected, erasing every transaction on its plugin, andStore.Resources/Store.Archetypesof such a store silently evaluated tonever.Exactnow passesanythrough (excess-property rejection on real inserts is unchanged).Verified against the standalone 30-probe consumer repro: on 0.10.13 the bomb configs give 8 errors and 6/30 probes fail; against this branch the bomb gives 0 errors and 29/30 pass. The remaining line (p29 §5, mutable
Store→ReadonlyStore<any, any, any>) also fails for a plain store and predates defaultFactory — out of scope here.Version bump to 0.10.26.
Test plan
resolve-external-invocation.test.ts— schema-level policy on function and non-function membersto-typescript.test.ts— agent (default) / link / all audiences, nested hiding, hoisting reacts to hidden membersto-observe-state.test.ts— nested reconstruction, dotted keys, waits for all values, re-emit on change, unobserve, missing optional members, schema change releases old subscriptions;State<T>type assertiondefault-factory.test.ts— compile-time regressions (fail without the fix):applyOperations+ DFK plugin keeps transactions, DFK store →Store<any, any, any>,Store.Archetypes/Resourcesnotneverpnpm -r run typecheck,pnpm -r run test,pnpm run lint🤖 Generated with Claude Code