Skip to content

feat(runtime): add first-class library API for framework libraries#43

Merged
Flussen merged 3 commits intov1.0-betafrom
codex/implement-library-api-in-opencore-framework
Feb 16, 2026
Merged

feat(runtime): add first-class library API for framework libraries#43
Flussen merged 3 commits intov1.0-betafrom
codex/implement-library-api-in-opencore-framework

Conversation

@Flussen
Copy link
Copy Markdown
Member

@Flussen Flussen commented Feb 16, 2026

Motivation

  • Provide a small, explicit framework-level API so official and third-party libraries can expose a consistent internal event bus and a namespaced external bridge while staying in runtime/* (not kernel).
  • Keep the core runtime implementation tiny and tree-shakeable and ensure the client/runtime core never imports Node core modules (no events, fs, etc.).
  • Align with existing logging and runtime layout patterns so libraries can get namespaced loggers and a minimal namespaced config accessor.

Description

  • Added shared core types and primitives under src/runtime/core/library: types.ts, a tiny Map/Set createLibraryBus() (on/once/off/emit), createLibraryBase() and createLibraryConfigAccessor() with TSDoc explaining internal vs external events.
  • Implemented createServerLibrary() in src/runtime/server/library that composes the base and exposes emitExternal(), emitNetExternal(), getLogger() and getConfig() and follows the exact naming convention opencore:<libName>:<eventName>.
  • Implemented createClientLibrary() in src/runtime/client/library that composes the base and exposes emitServer(), getLogger() and getConfig() using the same namespaced convention.
  • Exported the new APIs from runtime/core, runtime/server and runtime/client barrels and added lightweight tests/examples demonstrating internal bus behavior, buildEventName() and server/client wrapper usage.

Testing

  • Ran pnpm -r build and the TypeScript build completed successfully.
  • Ran pnpm -r test (unit + integration via Vitest) and the test suite passed: all tests executed successfully (including the new unit tests).
  • Validated that the core/client runtime additions are pure TypeScript with no Node core-module imports and that the external event naming format is opencore:<libName>:<eventName> as enforced by buildEventName().

Codex Task

Audit summary before implementation:\n- runtime/core currently exposed only entity/spatial/world and had no reusable runtime-level event helpers for libraries.\n- runtime/server/client entrypoints are surfaced through runtime/*/api.ts and package exports ./server + ./client, with no ./core subpath export.\n- logging patterns are centralized in kernel/logger via coreLogger and child logger factories; runtime uses those loggers directly.\n- no dedicated runtime config accessor pattern exists in server/client/core, so this change adds a minimal namespaced accessor for library APIs.\n\nImplementation:\n- Added runtime/core library primitives: tiny Map/Set internal bus, createLibraryBase, shared library types, and namespaced config accessor.\n- Added createServerLibrary and createClientLibrary wrappers with namespaced external bridges and logger/config helpers.\n- Exported library APIs via runtime/server and runtime/client barrels and exported core library primitives from runtime/core.\n- Added unit tests covering event bus behavior, name building, and server/client wrapper usage.
…tors, and processors for cross-side communication.
@Flussen Flussen merged commit 577f4d2 into v1.0-beta Feb 16, 2026
@Flussen Flussen deleted the codex/implement-library-api-in-opencore-framework branch February 16, 2026 18:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant