feat(web_core): implement Stage 3 Sauce-TS bidirectional RPC and @index function - #2264
Open
gspencergoog wants to merge 7 commits into
Open
feat(web_core): implement Stage 3 Sauce-TS bidirectional RPC and @index function#2264gspencergoog wants to merge 7 commits into
gspencergoog wants to merge 7 commits into
Conversation
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
This pull request implements Stage 3 (
Sauce-TS) deliverables for the Web Core renderer package (typescript/web_core). It introduces theRpcHandlerengine for handling bidirectional remote function calls between the client renderer and server agent, enforces execution boundaries (callableFrom) and user activation constraints (requiresUserActivation), exports structured RPC error codes and exceptions (RpcError,RpcErrorCode), registers the built-in@indexfunction with array index resolution, and cleans up legacyv0_9re-export stubs.Stack Context
v1_0_firing_ts) — Core v1.0 Zod schemas, version adapters,callableFrommetadata, composition constraints, and data model path resolution.v1_0_sauce_ts) — Bidirectional RPC execution (callRendererFunction,callAgentFunction), dynamicValidationResulthandling, multi-catalog resolution engine, and@indexloop function.Changes
1. Bidirectional RPC Engine (
typescript/web_core/src/v1_0/rpc/)RpcHandlerinsrc/v1_0/rpc/rpc-handler.tsto process incomingcallRendererFunctionmessages and returnrendererFunctionResponsepayloads.callAgentFunctionrequest tracking and response resolution via incomingagentFunctionResponsemessages matchingfunctionCallId.RpcErrorCodeenum (INVALID_FUNCTION_CALL,EXECUTION_ERROR,TIMEOUT,CANCELLED,DISPOSED,DUPLICATE,NO_LISTENER) andRpcErrorexception class with prototype restoration.RpcHandlerOptionsoptions bag with backward-compatible array constructor overload.isDisposedlifecycle guards failing fast post-disposal, andglobalThis.crypto.randomUUID()feature checks with non-secure context fallbacks.callableFrom:rendererOnly,agentOnly,rendererOrAgent) and user activation context constraints (requiresUserActivation).2. Basic Catalog
@indexFunction & Property MergingIndexApiinsrc/v0_9/basic_catalog/functions/basic_functions_api.tswithz.coerce.number().optional()schema validation.IndexImplementationwith strict/^\d+$/path segment regex matching to resolve loop indices for nested child contexts, supporting optionaloffsetconfiguration.processUpdateComponentsOpinsrc/processing/message-processor.tsto merge existing properties with incoming properties on partial updates.3. Public Export & Modular Cleanup (
typescript/web_core/src/v1_0/)RpcHandler,OutboundMessageListener,RpcHandlerOptions,RpcErrorCode, andRpcErrorfromsrc/v1_0/index.ts.src/v0_9/stub files across catalog, rendering, reactivity, and state directories.Impact & Risks
Testing
npm run testintypescript/web_core— 295/295 passing tests (100%).node tests/conformance/conformance_test.mjs— 216/216 passing test vectors (100%).yarn buildand zero ESLint errors withyarn lint.