You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

73 lines
2.0 KiB

Reduce App core to Logger/Bus/Timers/Orca; everything else is opt-in services Big-bang replacement of the active-app composition: legacy uppercase surface (App.Lang, App.Cache, App.Format, App.Frontend, App.Dom, App.Storage, App.Http) removed entirely. All non-core artifacts are now opt-in via services schema: services: { cache: defineActiveCache(), lang: defineActiveLang(...), ... } Schema services are exposed as lowercase properties (App.cache, App.lang, …) with end-to-end type safety; accessing a service the schema didn't declare is a compile error. Three import paths split for honest tree-shaking: $active-app createActiveApp + core types/errors/bus-context $active-app/services defineActive* / defineEngine* factories $active-app/presets applyCache* / applyPerm* / applyStandardOrca Service factories declare core deps (logger/bus/timers/orca) and sibling service deps (e.g. format wires localeSource from lang automatically when both are declared). The builder validates names, computes topological order, detects cycles, builds immediates eagerly, and exposes lazy proxies that materialise on first access. factory.create() runs inside untrack so subscriptions wired during construction (e.g. lang.onLocaleChange) cannot crash the outer reactive scope when triggered from a $derived. Reactions to lifecycle events (cache.clear on revoke / identity change, perm.invalidate on identity change) move from internal bus subscriptions inside arts to opt-in orca presets registered by the application: applyStandardOrca(App) // or cherry-pick individual apply* functions Also lands a working showcase at /demo wiring 10 of 12 services (everything except auth/connections, which need a real server) plus a mocked perm fetcher and a real http client against jsonplaceholder. Misc cleanup along the way: - libs/cache/{key,policy,scope}.ts: missing CACHE_VALIDATION_MESSAGES imports (the throw paths were never covered by tests, so the bug only surfaced via the demo) - All arts READMEs scrubbed of autoInvalidateOn / APP_EVENT_USER_* references; bus README rewritten around the orca-preset model - refactorizacion.md moved out of src/ into docs/ Verification: 1347/1347 vitest tests passing, demo loads and exercises all wired services in a real browser with zero console errors. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
5 months ago
/**
* Public entry point of `arts/active-app`.
*
* Three import paths exist:
*
* - `$active-app` — `createActiveApp`, types, errors. What every app
* needs to compose its runtime.
Reduce App core to Logger/Bus/Timers/Orca; everything else is opt-in services Big-bang replacement of the active-app composition: legacy uppercase surface (App.Lang, App.Cache, App.Format, App.Frontend, App.Dom, App.Storage, App.Http) removed entirely. All non-core artifacts are now opt-in via services schema: services: { cache: defineActiveCache(), lang: defineActiveLang(...), ... } Schema services are exposed as lowercase properties (App.cache, App.lang, …) with end-to-end type safety; accessing a service the schema didn't declare is a compile error. Three import paths split for honest tree-shaking: $active-app createActiveApp + core types/errors/bus-context $active-app/services defineActive* / defineEngine* factories $active-app/presets applyCache* / applyPerm* / applyStandardOrca Service factories declare core deps (logger/bus/timers/orca) and sibling service deps (e.g. format wires localeSource from lang automatically when both are declared). The builder validates names, computes topological order, detects cycles, builds immediates eagerly, and exposes lazy proxies that materialise on first access. factory.create() runs inside untrack so subscriptions wired during construction (e.g. lang.onLocaleChange) cannot crash the outer reactive scope when triggered from a $derived. Reactions to lifecycle events (cache.clear on revoke / identity change, perm.invalidate on identity change) move from internal bus subscriptions inside arts to opt-in orca presets registered by the application: applyStandardOrca(App) // or cherry-pick individual apply* functions Also lands a working showcase at /demo wiring 10 of 12 services (everything except auth/connections, which need a real server) plus a mocked perm fetcher and a real http client against jsonplaceholder. Misc cleanup along the way: - libs/cache/{key,policy,scope}.ts: missing CACHE_VALIDATION_MESSAGES imports (the throw paths were never covered by tests, so the bug only surfaced via the demo) - All arts READMEs scrubbed of autoInvalidateOn / APP_EVENT_USER_* references; bus README rewritten around the orca-preset model - refactorizacion.md moved out of src/ into docs/ Verification: 1347/1347 vitest tests passing, demo loads and exercises all wired services in a real browser with zero console errors. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
5 months ago
* - `$active-app/services` — `defineActive*` / `defineEngine*`
* factories for the declarative service schema. Loaded only by
* apps that declare services.
* - `$active-app/presets` — orchestration presets registered on
Prefs as schema-based core + lowercase App.* surface Two structural changes that were overdue and got bundled because they touched the same set of files. ## Prefs is now a schema, not a fixed shape Previously every preference had to be declared in a closed `PrefsCapabilities` interface (`languages`, `locales`, `currencies`, `themes`, `densities`, `motions`, `timezones`, `unitSystems`). Adding a new pref required forking `$libs/prefs` — bad framework design. The redesign replaces the fixed shape with a schema: PrefsSchema = Record<string, PrefsDimension<TIntent, TEffective>> Each dimension owns its own validator (`validate`), environment-fed resolver (`resolve`) and optional sibling-derived value (`derive`). The engine is generic over the schema and iterates it; it knows nothing about "locale" or "theme" specifically. Built-in dimensions live in `arts/prefs/dimensions/*` (locale, language, theme, density, motion, timezone, currency, unit-system, direction, plus boolean / enum / string / number primitives). The `standardPrefsDimensions(catalog)` preset composes the canonical set; apps spread it and add their own: const schema = { ...standardPrefsDimensions({ languages, locales, currencies }), sidebarCollapsed: booleanDimension({ default: false }), notificationLevel: enumDimension( ['all', 'mentions', 'none'] as const, { default: 'mentions' } ) }; Active surface exposes one slot per schema key with uniform verbs: App.prefs.locale.get() App.prefs.locale.set('es-ES') App.prefs.locale.clear() App.prefs.locale.onChange((v) => …) App.prefs.sidebarCollapsed.set(true) `setIntent('locale', value)` stays available as a low-level pass- through (storage bridge consumes it generically) but UI code uses the dimension surface. ## Lowercase core surface `App.Logger`, `App.Bus`, `App.Timers`, `App.Orca`, `App.Prefs` are gone. The "PascalCase for core, lowercase for services" rule was visual signalling against JS convention, no technical benefit, and created an asymmetry on the same object. All core members are now lowercase, matching services: App.logger App.bus App.timers App.orca App.prefs `createPrefsStorageBridge` keeps its old responsibilities; sources helpers (`prefsLocaleSource`, …) are gone — the dimension API replaces them. ## What changed - `$libs/prefs`: fully generic schema-based types + resolver. Old fixed `PrefsCapabilities` / `PrefsIntent` / `PrefsEffective` removed; replaced by `PrefsDimension`, `PrefsSchema`, `PrefsEffectiveOf<S>`, `PrefsIntentOf<S>`. - `arts/prefs`: engine + active wrapper rewritten to schema. Per- dimension active surface auto-built from schema keys. Sources file deleted (replaced by dimension surface). New `arts/prefs/dimensions/*` and `arts/prefs/standard.ts`. Storage bridge made schema-generic. - `arts/active-app`: lowercase `CoreServices` / `ActiveAppCore`, `prefs?: ActiveAppPrefsOptions<S>` root option carrying the schema. `defineActivePrefs` deleted (prefs is core, not service). `lang` / `format` / `frontend` factories migrated to read `core.prefs.<dim>` directly via defensive `readSlot()` helpers (each dimension is optional from the factory's POV; if the app's schema omits one, the integration degrades gracefully). - Presets, demos, web routes, README docstrings, `check-aliases.mjs` guards, marketing snippets all migrated. - Tests: `engine-prefs`, `active-prefs`, `storage-bridge`, `resolve-prefs`, `validate-intent`, `prefs-consumer-wiring`, `service-factories` rewritten for the schema-based API. `sources.test.ts` deleted (sources file is gone). ## Verification - `npm run check`: 0 errors, 0 warnings (1527 files). - `npm test`: 1645 tests across 139 files, all green. - `node scripts/check-aliases.mjs`: clean (lowercase enforced for every member of `App.*`, including `Logger`/`Bus`/`Timers`/`Orca`/ `Prefs` which now flag as forbidden capitals). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
5 months ago
* `App.orca`. Loaded only by apps that opt into the standard
Reduce App core to Logger/Bus/Timers/Orca; everything else is opt-in services Big-bang replacement of the active-app composition: legacy uppercase surface (App.Lang, App.Cache, App.Format, App.Frontend, App.Dom, App.Storage, App.Http) removed entirely. All non-core artifacts are now opt-in via services schema: services: { cache: defineActiveCache(), lang: defineActiveLang(...), ... } Schema services are exposed as lowercase properties (App.cache, App.lang, …) with end-to-end type safety; accessing a service the schema didn't declare is a compile error. Three import paths split for honest tree-shaking: $active-app createActiveApp + core types/errors/bus-context $active-app/services defineActive* / defineEngine* factories $active-app/presets applyCache* / applyPerm* / applyStandardOrca Service factories declare core deps (logger/bus/timers/orca) and sibling service deps (e.g. format wires localeSource from lang automatically when both are declared). The builder validates names, computes topological order, detects cycles, builds immediates eagerly, and exposes lazy proxies that materialise on first access. factory.create() runs inside untrack so subscriptions wired during construction (e.g. lang.onLocaleChange) cannot crash the outer reactive scope when triggered from a $derived. Reactions to lifecycle events (cache.clear on revoke / identity change, perm.invalidate on identity change) move from internal bus subscriptions inside arts to opt-in orca presets registered by the application: applyStandardOrca(App) // or cherry-pick individual apply* functions Also lands a working showcase at /demo wiring 10 of 12 services (everything except auth/connections, which need a real server) plus a mocked perm fetcher and a real http client against jsonplaceholder. Misc cleanup along the way: - libs/cache/{key,policy,scope}.ts: missing CACHE_VALIDATION_MESSAGES imports (the throw paths were never covered by tests, so the bug only surfaced via the demo) - All arts READMEs scrubbed of autoInvalidateOn / APP_EVENT_USER_* references; bus README rewritten around the orca-preset model - refactorizacion.md moved out of src/ into docs/ Verification: 1347/1347 vitest tests passing, demo loads and exercises all wired services in a real browser with zero console errors. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
5 months ago
* reactions.
*
* Splitting the entry points lets the bundler tree-shake each layer
* independently. An app that only consumes the core never pulls in
* service factories or presets.
*
* The Svelte-context bridge (`setBus` / `getBus`) lives in `$bus`, not
* here. It is owned by the bus, which is the semantic origin of the
Prefs as schema-based core + lowercase App.* surface Two structural changes that were overdue and got bundled because they touched the same set of files. ## Prefs is now a schema, not a fixed shape Previously every preference had to be declared in a closed `PrefsCapabilities` interface (`languages`, `locales`, `currencies`, `themes`, `densities`, `motions`, `timezones`, `unitSystems`). Adding a new pref required forking `$libs/prefs` — bad framework design. The redesign replaces the fixed shape with a schema: PrefsSchema = Record<string, PrefsDimension<TIntent, TEffective>> Each dimension owns its own validator (`validate`), environment-fed resolver (`resolve`) and optional sibling-derived value (`derive`). The engine is generic over the schema and iterates it; it knows nothing about "locale" or "theme" specifically. Built-in dimensions live in `arts/prefs/dimensions/*` (locale, language, theme, density, motion, timezone, currency, unit-system, direction, plus boolean / enum / string / number primitives). The `standardPrefsDimensions(catalog)` preset composes the canonical set; apps spread it and add their own: const schema = { ...standardPrefsDimensions({ languages, locales, currencies }), sidebarCollapsed: booleanDimension({ default: false }), notificationLevel: enumDimension( ['all', 'mentions', 'none'] as const, { default: 'mentions' } ) }; Active surface exposes one slot per schema key with uniform verbs: App.prefs.locale.get() App.prefs.locale.set('es-ES') App.prefs.locale.clear() App.prefs.locale.onChange((v) => …) App.prefs.sidebarCollapsed.set(true) `setIntent('locale', value)` stays available as a low-level pass- through (storage bridge consumes it generically) but UI code uses the dimension surface. ## Lowercase core surface `App.Logger`, `App.Bus`, `App.Timers`, `App.Orca`, `App.Prefs` are gone. The "PascalCase for core, lowercase for services" rule was visual signalling against JS convention, no technical benefit, and created an asymmetry on the same object. All core members are now lowercase, matching services: App.logger App.bus App.timers App.orca App.prefs `createPrefsStorageBridge` keeps its old responsibilities; sources helpers (`prefsLocaleSource`, …) are gone — the dimension API replaces them. ## What changed - `$libs/prefs`: fully generic schema-based types + resolver. Old fixed `PrefsCapabilities` / `PrefsIntent` / `PrefsEffective` removed; replaced by `PrefsDimension`, `PrefsSchema`, `PrefsEffectiveOf<S>`, `PrefsIntentOf<S>`. - `arts/prefs`: engine + active wrapper rewritten to schema. Per- dimension active surface auto-built from schema keys. Sources file deleted (replaced by dimension surface). New `arts/prefs/dimensions/*` and `arts/prefs/standard.ts`. Storage bridge made schema-generic. - `arts/active-app`: lowercase `CoreServices` / `ActiveAppCore`, `prefs?: ActiveAppPrefsOptions<S>` root option carrying the schema. `defineActivePrefs` deleted (prefs is core, not service). `lang` / `format` / `frontend` factories migrated to read `core.prefs.<dim>` directly via defensive `readSlot()` helpers (each dimension is optional from the factory's POV; if the app's schema omits one, the integration degrades gracefully). - Presets, demos, web routes, README docstrings, `check-aliases.mjs` guards, marketing snippets all migrated. - Tests: `engine-prefs`, `active-prefs`, `storage-bridge`, `resolve-prefs`, `validate-intent`, `prefs-consumer-wiring`, `service-factories` rewritten for the schema-based API. `sources.test.ts` deleted (sources file is gone). ## Verification - `npm run check`: 0 errors, 0 warnings (1527 files). - `npm test`: 1645 tests across 139 files, all green. - `node scripts/check-aliases.mjs`: clean (lowercase enforced for every member of `App.*`, including `Logger`/`Bus`/`Timers`/`Orca`/ `Prefs` which now flag as forbidden capitals). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
5 months ago
* pattern; App is a consumer that just calls `setBus(App.bus)` once at
* the layout root.
Reduce App core to Logger/Bus/Timers/Orca; everything else is opt-in services Big-bang replacement of the active-app composition: legacy uppercase surface (App.Lang, App.Cache, App.Format, App.Frontend, App.Dom, App.Storage, App.Http) removed entirely. All non-core artifacts are now opt-in via services schema: services: { cache: defineActiveCache(), lang: defineActiveLang(...), ... } Schema services are exposed as lowercase properties (App.cache, App.lang, …) with end-to-end type safety; accessing a service the schema didn't declare is a compile error. Three import paths split for honest tree-shaking: $active-app createActiveApp + core types/errors/bus-context $active-app/services defineActive* / defineEngine* factories $active-app/presets applyCache* / applyPerm* / applyStandardOrca Service factories declare core deps (logger/bus/timers/orca) and sibling service deps (e.g. format wires localeSource from lang automatically when both are declared). The builder validates names, computes topological order, detects cycles, builds immediates eagerly, and exposes lazy proxies that materialise on first access. factory.create() runs inside untrack so subscriptions wired during construction (e.g. lang.onLocaleChange) cannot crash the outer reactive scope when triggered from a $derived. Reactions to lifecycle events (cache.clear on revoke / identity change, perm.invalidate on identity change) move from internal bus subscriptions inside arts to opt-in orca presets registered by the application: applyStandardOrca(App) // or cherry-pick individual apply* functions Also lands a working showcase at /demo wiring 10 of 12 services (everything except auth/connections, which need a real server) plus a mocked perm fetcher and a real http client against jsonplaceholder. Misc cleanup along the way: - libs/cache/{key,policy,scope}.ts: missing CACHE_VALIDATION_MESSAGES imports (the throw paths were never covered by tests, so the bug only surfaced via the demo) - All arts READMEs scrubbed of autoInvalidateOn / APP_EVENT_USER_* references; bus README rewritten around the orca-preset model - refactorizacion.md moved out of src/ into docs/ Verification: 1347/1347 vitest tests passing, demo loads and exercises all wired services in a real browser with zero console errors. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
5 months ago
*/
export { createActiveApp } from './active-app.svelte.ts';
export { APP_MODULE } from './consts.ts';
Reduce App core to Logger/Bus/Timers/Orca; everything else is opt-in services Big-bang replacement of the active-app composition: legacy uppercase surface (App.Lang, App.Cache, App.Format, App.Frontend, App.Dom, App.Storage, App.Http) removed entirely. All non-core artifacts are now opt-in via services schema: services: { cache: defineActiveCache(), lang: defineActiveLang(...), ... } Schema services are exposed as lowercase properties (App.cache, App.lang, …) with end-to-end type safety; accessing a service the schema didn't declare is a compile error. Three import paths split for honest tree-shaking: $active-app createActiveApp + core types/errors/bus-context $active-app/services defineActive* / defineEngine* factories $active-app/presets applyCache* / applyPerm* / applyStandardOrca Service factories declare core deps (logger/bus/timers/orca) and sibling service deps (e.g. format wires localeSource from lang automatically when both are declared). The builder validates names, computes topological order, detects cycles, builds immediates eagerly, and exposes lazy proxies that materialise on first access. factory.create() runs inside untrack so subscriptions wired during construction (e.g. lang.onLocaleChange) cannot crash the outer reactive scope when triggered from a $derived. Reactions to lifecycle events (cache.clear on revoke / identity change, perm.invalidate on identity change) move from internal bus subscriptions inside arts to opt-in orca presets registered by the application: applyStandardOrca(App) // or cherry-pick individual apply* functions Also lands a working showcase at /demo wiring 10 of 12 services (everything except auth/connections, which need a real server) plus a mocked perm fetcher and a real http client against jsonplaceholder. Misc cleanup along the way: - libs/cache/{key,policy,scope}.ts: missing CACHE_VALIDATION_MESSAGES imports (the throw paths were never covered by tests, so the bug only surfaced via the demo) - All arts READMEs scrubbed of autoInvalidateOn / APP_EVENT_USER_* references; bus README rewritten around the orca-preset model - refactorizacion.md moved out of src/ into docs/ Verification: 1347/1347 vitest tests passing, demo loads and exercises all wired services in a real browser with zero console errors. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
5 months ago
export {
Reduce App core to Logger/Bus/Timers/Orca; everything else is opt-in services Big-bang replacement of the active-app composition: legacy uppercase surface (App.Lang, App.Cache, App.Format, App.Frontend, App.Dom, App.Storage, App.Http) removed entirely. All non-core artifacts are now opt-in via services schema: services: { cache: defineActiveCache(), lang: defineActiveLang(...), ... } Schema services are exposed as lowercase properties (App.cache, App.lang, …) with end-to-end type safety; accessing a service the schema didn't declare is a compile error. Three import paths split for honest tree-shaking: $active-app createActiveApp + core types/errors/bus-context $active-app/services defineActive* / defineEngine* factories $active-app/presets applyCache* / applyPerm* / applyStandardOrca Service factories declare core deps (logger/bus/timers/orca) and sibling service deps (e.g. format wires localeSource from lang automatically when both are declared). The builder validates names, computes topological order, detects cycles, builds immediates eagerly, and exposes lazy proxies that materialise on first access. factory.create() runs inside untrack so subscriptions wired during construction (e.g. lang.onLocaleChange) cannot crash the outer reactive scope when triggered from a $derived. Reactions to lifecycle events (cache.clear on revoke / identity change, perm.invalidate on identity change) move from internal bus subscriptions inside arts to opt-in orca presets registered by the application: applyStandardOrca(App) // or cherry-pick individual apply* functions Also lands a working showcase at /demo wiring 10 of 12 services (everything except auth/connections, which need a real server) plus a mocked perm fetcher and a real http client against jsonplaceholder. Misc cleanup along the way: - libs/cache/{key,policy,scope}.ts: missing CACHE_VALIDATION_MESSAGES imports (the throw paths were never covered by tests, so the bug only surfaced via the demo) - All arts READMEs scrubbed of autoInvalidateOn / APP_EVENT_USER_* references; bus README rewritten around the orca-preset model - refactorizacion.md moved out of src/ into docs/ Verification: 1347/1347 vitest tests passing, demo loads and exercises all wired services in a real browser with zero console errors. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
5 months ago
APP_EVENT_DISPOSE_STARTING,
publishAppDisposeStarting,
onAppDisposeStarting,
type AppDisposeStartingPayload,
type AppEventBus,
type AppEventMap,
type AppEventRuntime
} from './events.ts';
export {
AappInvalidEventRuntimeError,
Big-bang: remove legacy translators, App.createActiveX(), APP_EVENT_*, autoInvalidate* Completes step 3 of the active-app refactor. The orca-based service schema model is now the single supported path; the legacy auto-reactive ecosystem is gone. Removed: - arts/active-app/integrations/session-translator.ts and auth-cache.ts (their purpose is replaced by orca presets in arts/active-app/presets/). - arts/connection/bus-session-source.ts (canonical session events flow through SESSION_EVENT_* directly). - libs/active-app/ entirely. Its contents (consts, errors, events reduced to APP_EVENT_DISPOSE_STARTING) consolidated into arts/active-app/{consts,errors,events}.ts. The libs layer no longer has anything app-specific. - From arts/cache: - bus / autoInvalidateOn options on ActiveCacheOptions. - wireAutoInvalidation internal subscription. - CACHE_AUTO_INVALIDATE_* constants and types. - From arts/perm: - bus / autoInvalidateOn options on ActivePermsOptions. - wireAutoInvalidation internal subscription. - PERM_AUTO_INVALIDATE_* constants and types. - From arts/connection: - bus option in EngineConnectionsOptions. - shouldWireBusSessionSource helper. - The "reacts to canonical app identity bus events" test that depended on the deleted bus-session-source. - From arts/active-app/active-app.svelte.ts: - createSiumEngine() / createActiveSession() / createActiveConnections() / createActivePerms() / createActiveAuth() factory methods. - App.Sess / App.Perms / App.Auth getters and the singleton guards (Sess !== undefined etc.). - APP_ORCHESTRATION_* preset system, resolveActiveAppOrchestration, STANDARD_ORCHESTRATION_TRANSLATORS, all five translator handles. - APP_ERROR_ALREADY_CREATED_* / APP_ERROR_CREATE_PERM_ENDPOINT_REQUIRED constants (orphan after factory removal). - From arts/active-app/test: - ecosystem.integration.test.ts (9 monolithic tests, ~1900 lines). - session-translator.test.ts. - create-sium-engine.test.ts. - From libs/active-app/test: - events.test.ts (covered the deleted publishers and the legacy APP_USER_IDENTITY_* causes). - APP_EVENT_USER_IDENTITY_CHANGED, APP_EVENT_TENANT_SWITCHED, APP_EVENT_PERMISSIONS_REFRESH_REQUESTED, APP_EVENT_CACHE_INVALIDATE_REQUESTED, APP_EVENT_CONNECTIVITY_CHANGED (only DISPOSE_STARTING survives). - Their associated payload interfaces and the APP_USER_IDENTITY_CAUSE_* constants. - publishAppUserIdentityChanged / publishAppPermsRefreshRequested / publishAppCacheInvalidateRequested / publishAppTenantSwitched / publishAppConnectivityChanged. publishAppDisposeStarting and the new onAppDisposeStarting helper remain. Final shape of arts/active-app/: - active-app.svelte.ts: builds Logger, Lang, Format, Frontend, Dom, Storage, Http, Timers, Bus, Orca, Cache, then the schema services via buildServiceBuilders. dispose() publishes DISPOSE_STARTING and tears everything down in reverse construction order. - services.ts, service-builder.ts, service-factories/, presets/, bus-context.svelte.ts, consts.ts, errors.ts, events.ts, types.ts, index.ts (public barrel exposing every define*, applyStandardOrca, types and errors). Suite: 1374 tests pass. The reduction from the prior 1408 reflects the deleted legacy tests; coverage of the new model is comprehensive (schema-declarative.test.ts, service-builder.test.ts, service-factories.test.ts, presets.test.ts, active-app.test.ts core, plus the existing per-art suites). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
5 months ago
AappServiceConstructionFailedError,
AappServiceDependencyCycleError,
AappServiceNameMismatchError,
Reduce App core to Logger/Bus/Timers/Orca; everything else is opt-in services Big-bang replacement of the active-app composition: legacy uppercase surface (App.Lang, App.Cache, App.Format, App.Frontend, App.Dom, App.Storage, App.Http) removed entirely. All non-core artifacts are now opt-in via services schema: services: { cache: defineActiveCache(), lang: defineActiveLang(...), ... } Schema services are exposed as lowercase properties (App.cache, App.lang, …) with end-to-end type safety; accessing a service the schema didn't declare is a compile error. Three import paths split for honest tree-shaking: $active-app createActiveApp + core types/errors/bus-context $active-app/services defineActive* / defineEngine* factories $active-app/presets applyCache* / applyPerm* / applyStandardOrca Service factories declare core deps (logger/bus/timers/orca) and sibling service deps (e.g. format wires localeSource from lang automatically when both are declared). The builder validates names, computes topological order, detects cycles, builds immediates eagerly, and exposes lazy proxies that materialise on first access. factory.create() runs inside untrack so subscriptions wired during construction (e.g. lang.onLocaleChange) cannot crash the outer reactive scope when triggered from a $derived. Reactions to lifecycle events (cache.clear on revoke / identity change, perm.invalidate on identity change) move from internal bus subscriptions inside arts to opt-in orca presets registered by the application: applyStandardOrca(App) // or cherry-pick individual apply* functions Also lands a working showcase at /demo wiring 10 of 12 services (everything except auth/connections, which need a real server) plus a mocked perm fetcher and a real http client against jsonplaceholder. Misc cleanup along the way: - libs/cache/{key,policy,scope}.ts: missing CACHE_VALIDATION_MESSAGES imports (the throw paths were never covered by tests, so the bug only surfaced via the demo) - All arts READMEs scrubbed of autoInvalidateOn / APP_EVENT_USER_* references; bus README rewritten around the orca-preset model - refactorizacion.md moved out of src/ into docs/ Verification: 1347/1347 vitest tests passing, demo loads and exercises all wired services in a real browser with zero console errors. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
5 months ago
AappUnsafeEventPayloadError,
isAappInvalidEventRuntimeError,
Big-bang: remove legacy translators, App.createActiveX(), APP_EVENT_*, autoInvalidate* Completes step 3 of the active-app refactor. The orca-based service schema model is now the single supported path; the legacy auto-reactive ecosystem is gone. Removed: - arts/active-app/integrations/session-translator.ts and auth-cache.ts (their purpose is replaced by orca presets in arts/active-app/presets/). - arts/connection/bus-session-source.ts (canonical session events flow through SESSION_EVENT_* directly). - libs/active-app/ entirely. Its contents (consts, errors, events reduced to APP_EVENT_DISPOSE_STARTING) consolidated into arts/active-app/{consts,errors,events}.ts. The libs layer no longer has anything app-specific. - From arts/cache: - bus / autoInvalidateOn options on ActiveCacheOptions. - wireAutoInvalidation internal subscription. - CACHE_AUTO_INVALIDATE_* constants and types. - From arts/perm: - bus / autoInvalidateOn options on ActivePermsOptions. - wireAutoInvalidation internal subscription. - PERM_AUTO_INVALIDATE_* constants and types. - From arts/connection: - bus option in EngineConnectionsOptions. - shouldWireBusSessionSource helper. - The "reacts to canonical app identity bus events" test that depended on the deleted bus-session-source. - From arts/active-app/active-app.svelte.ts: - createSiumEngine() / createActiveSession() / createActiveConnections() / createActivePerms() / createActiveAuth() factory methods. - App.Sess / App.Perms / App.Auth getters and the singleton guards (Sess !== undefined etc.). - APP_ORCHESTRATION_* preset system, resolveActiveAppOrchestration, STANDARD_ORCHESTRATION_TRANSLATORS, all five translator handles. - APP_ERROR_ALREADY_CREATED_* / APP_ERROR_CREATE_PERM_ENDPOINT_REQUIRED constants (orphan after factory removal). - From arts/active-app/test: - ecosystem.integration.test.ts (9 monolithic tests, ~1900 lines). - session-translator.test.ts. - create-sium-engine.test.ts. - From libs/active-app/test: - events.test.ts (covered the deleted publishers and the legacy APP_USER_IDENTITY_* causes). - APP_EVENT_USER_IDENTITY_CHANGED, APP_EVENT_TENANT_SWITCHED, APP_EVENT_PERMISSIONS_REFRESH_REQUESTED, APP_EVENT_CACHE_INVALIDATE_REQUESTED, APP_EVENT_CONNECTIVITY_CHANGED (only DISPOSE_STARTING survives). - Their associated payload interfaces and the APP_USER_IDENTITY_CAUSE_* constants. - publishAppUserIdentityChanged / publishAppPermsRefreshRequested / publishAppCacheInvalidateRequested / publishAppTenantSwitched / publishAppConnectivityChanged. publishAppDisposeStarting and the new onAppDisposeStarting helper remain. Final shape of arts/active-app/: - active-app.svelte.ts: builds Logger, Lang, Format, Frontend, Dom, Storage, Http, Timers, Bus, Orca, Cache, then the schema services via buildServiceBuilders. dispose() publishes DISPOSE_STARTING and tears everything down in reverse construction order. - services.ts, service-builder.ts, service-factories/, presets/, bus-context.svelte.ts, consts.ts, errors.ts, events.ts, types.ts, index.ts (public barrel exposing every define*, applyStandardOrca, types and errors). Suite: 1374 tests pass. The reduction from the prior 1408 reflects the deleted legacy tests; coverage of the new model is comprehensive (schema-declarative.test.ts, service-builder.test.ts, service-factories.test.ts, presets.test.ts, active-app.test.ts core, plus the existing per-art suites). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
5 months ago
isAappServiceConstructionFailedError,
isAappServiceDependencyCycleError,
Reduce App core to Logger/Bus/Timers/Orca; everything else is opt-in services Big-bang replacement of the active-app composition: legacy uppercase surface (App.Lang, App.Cache, App.Format, App.Frontend, App.Dom, App.Storage, App.Http) removed entirely. All non-core artifacts are now opt-in via services schema: services: { cache: defineActiveCache(), lang: defineActiveLang(...), ... } Schema services are exposed as lowercase properties (App.cache, App.lang, …) with end-to-end type safety; accessing a service the schema didn't declare is a compile error. Three import paths split for honest tree-shaking: $active-app createActiveApp + core types/errors/bus-context $active-app/services defineActive* / defineEngine* factories $active-app/presets applyCache* / applyPerm* / applyStandardOrca Service factories declare core deps (logger/bus/timers/orca) and sibling service deps (e.g. format wires localeSource from lang automatically when both are declared). The builder validates names, computes topological order, detects cycles, builds immediates eagerly, and exposes lazy proxies that materialise on first access. factory.create() runs inside untrack so subscriptions wired during construction (e.g. lang.onLocaleChange) cannot crash the outer reactive scope when triggered from a $derived. Reactions to lifecycle events (cache.clear on revoke / identity change, perm.invalidate on identity change) move from internal bus subscriptions inside arts to opt-in orca presets registered by the application: applyStandardOrca(App) // or cherry-pick individual apply* functions Also lands a working showcase at /demo wiring 10 of 12 services (everything except auth/connections, which need a real server) plus a mocked perm fetcher and a real http client against jsonplaceholder. Misc cleanup along the way: - libs/cache/{key,policy,scope}.ts: missing CACHE_VALIDATION_MESSAGES imports (the throw paths were never covered by tests, so the bug only surfaced via the demo) - All arts READMEs scrubbed of autoInvalidateOn / APP_EVENT_USER_* references; bus README rewritten around the orca-preset model - refactorizacion.md moved out of src/ into docs/ Verification: 1347/1347 vitest tests passing, demo loads and exercises all wired services in a real browser with zero console errors. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
5 months ago
isAappServiceNameMismatchError,
isAappUnsafeEventPayloadError
} from './errors.ts';
Build runtime infrastructure layer: aapp + 5 new artifacts Adds the application composition root and six new runtime artifacts. lang and logr alone could not cover an app surface — locale propagation, format helpers, frontend preferences, validation, persistence and DOM service all needed independent artifacts that aapp wires together under a single locale source of truth and a shared logger. New artifacts: - aapp: composition root. createActiveApp + createTestApp + App.createSiumEngine + frontend.persist + Storage wiring. - stor: pluggable adapters (local/session/memory/cookie + SSR via cookieAdapter.fromCookies), envelope versioning + migrate + TTL, validate via Standard Schema, intra-tab + cross-tab sync, Storage.clear(), per-entry adapter/namespace overrides. - adom: reactive DOM service. shareViewport opt-in + per-window tracker, dispose(). breakpoints, viewport, attribute writes. - fend: frontend preferences (theme, mode, dir, density, reducedMotion, reducedSound) with auto/clear/isAuto pattern. - fmts: localized formatting (numbers, currency, units, dates) with shared LocaleSource and per-domain auto/clear pattern. - sium: validation engine. Standard Schema interop, Lang/Logger injection, codec/refine/transform, domain types (color/date/time), introspection. Existing artifacts extended: - lang: BCP 47 SupportedLocale (LangBase | base-region), mono lang for monolingual apps, extend() leaf-overwrite warning, EngineLang/ActiveLang naming alignment with the rest of the project (no Instance suffix). - logr: EngineLogger.dispose(), failureThrottleMs anti-cascade for transports, README sync to the per-level filter API (minLevel removed). Cross-cutting: - $locale: shared LocaleSource type consumed by fmts and fend. - arts/README.md: artifact map, dependency graph, naming conventions. - Test pages for every artifact under /test/<artifact>. 733 tests passing; svelte-check clean except 2 pre-existing errors on sium/svelte provider (port pending). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
6 months ago
export type {
ActiveApp,
ActiveAppBusEvents,
Reduce App core to Logger/Bus/Timers/Orca; everything else is opt-in services Big-bang replacement of the active-app composition: legacy uppercase surface (App.Lang, App.Cache, App.Format, App.Frontend, App.Dom, App.Storage, App.Http) removed entirely. All non-core artifacts are now opt-in via services schema: services: { cache: defineActiveCache(), lang: defineActiveLang(...), ... } Schema services are exposed as lowercase properties (App.cache, App.lang, …) with end-to-end type safety; accessing a service the schema didn't declare is a compile error. Three import paths split for honest tree-shaking: $active-app createActiveApp + core types/errors/bus-context $active-app/services defineActive* / defineEngine* factories $active-app/presets applyCache* / applyPerm* / applyStandardOrca Service factories declare core deps (logger/bus/timers/orca) and sibling service deps (e.g. format wires localeSource from lang automatically when both are declared). The builder validates names, computes topological order, detects cycles, builds immediates eagerly, and exposes lazy proxies that materialise on first access. factory.create() runs inside untrack so subscriptions wired during construction (e.g. lang.onLocaleChange) cannot crash the outer reactive scope when triggered from a $derived. Reactions to lifecycle events (cache.clear on revoke / identity change, perm.invalidate on identity change) move from internal bus subscriptions inside arts to opt-in orca presets registered by the application: applyStandardOrca(App) // or cherry-pick individual apply* functions Also lands a working showcase at /demo wiring 10 of 12 services (everything except auth/connections, which need a real server) plus a mocked perm fetcher and a real http client against jsonplaceholder. Misc cleanup along the way: - libs/cache/{key,policy,scope}.ts: missing CACHE_VALIDATION_MESSAGES imports (the throw paths were never covered by tests, so the bug only surfaced via the demo) - All arts READMEs scrubbed of autoInvalidateOn / APP_EVENT_USER_* references; bus README rewritten around the orca-preset model - refactorizacion.md moved out of src/ into docs/ Verification: 1347/1347 vitest tests passing, demo loads and exercises all wired services in a real browser with zero console errors. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
5 months ago
ActiveAppCore,
Build runtime infrastructure layer: aapp + 5 new artifacts Adds the application composition root and six new runtime artifacts. lang and logr alone could not cover an app surface — locale propagation, format helpers, frontend preferences, validation, persistence and DOM service all needed independent artifacts that aapp wires together under a single locale source of truth and a shared logger. New artifacts: - aapp: composition root. createActiveApp + createTestApp + App.createSiumEngine + frontend.persist + Storage wiring. - stor: pluggable adapters (local/session/memory/cookie + SSR via cookieAdapter.fromCookies), envelope versioning + migrate + TTL, validate via Standard Schema, intra-tab + cross-tab sync, Storage.clear(), per-entry adapter/namespace overrides. - adom: reactive DOM service. shareViewport opt-in + per-window tracker, dispose(). breakpoints, viewport, attribute writes. - fend: frontend preferences (theme, mode, dir, density, reducedMotion, reducedSound) with auto/clear/isAuto pattern. - fmts: localized formatting (numbers, currency, units, dates) with shared LocaleSource and per-domain auto/clear pattern. - sium: validation engine. Standard Schema interop, Lang/Logger injection, codec/refine/transform, domain types (color/date/time), introspection. Existing artifacts extended: - lang: BCP 47 SupportedLocale (LangBase | base-region), mono lang for monolingual apps, extend() leaf-overwrite warning, EngineLang/ActiveLang naming alignment with the rest of the project (no Instance suffix). - logr: EngineLogger.dispose(), failureThrottleMs anti-cascade for transports, README sync to the per-level filter API (minLevel removed). Cross-cutting: - $locale: shared LocaleSource type consumed by fmts and fend. - arts/README.md: artifact map, dependency graph, naming conventions. - Test pages for every artifact under /test/<artifact>. 733 tests passing; svelte-check clean except 2 pre-existing errors on sium/svelte provider (port pending). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
6 months ago
ActiveAppOptions,
Prefs as schema-based core + lowercase App.* surface Two structural changes that were overdue and got bundled because they touched the same set of files. ## Prefs is now a schema, not a fixed shape Previously every preference had to be declared in a closed `PrefsCapabilities` interface (`languages`, `locales`, `currencies`, `themes`, `densities`, `motions`, `timezones`, `unitSystems`). Adding a new pref required forking `$libs/prefs` — bad framework design. The redesign replaces the fixed shape with a schema: PrefsSchema = Record<string, PrefsDimension<TIntent, TEffective>> Each dimension owns its own validator (`validate`), environment-fed resolver (`resolve`) and optional sibling-derived value (`derive`). The engine is generic over the schema and iterates it; it knows nothing about "locale" or "theme" specifically. Built-in dimensions live in `arts/prefs/dimensions/*` (locale, language, theme, density, motion, timezone, currency, unit-system, direction, plus boolean / enum / string / number primitives). The `standardPrefsDimensions(catalog)` preset composes the canonical set; apps spread it and add their own: const schema = { ...standardPrefsDimensions({ languages, locales, currencies }), sidebarCollapsed: booleanDimension({ default: false }), notificationLevel: enumDimension( ['all', 'mentions', 'none'] as const, { default: 'mentions' } ) }; Active surface exposes one slot per schema key with uniform verbs: App.prefs.locale.get() App.prefs.locale.set('es-ES') App.prefs.locale.clear() App.prefs.locale.onChange((v) => …) App.prefs.sidebarCollapsed.set(true) `setIntent('locale', value)` stays available as a low-level pass- through (storage bridge consumes it generically) but UI code uses the dimension surface. ## Lowercase core surface `App.Logger`, `App.Bus`, `App.Timers`, `App.Orca`, `App.Prefs` are gone. The "PascalCase for core, lowercase for services" rule was visual signalling against JS convention, no technical benefit, and created an asymmetry on the same object. All core members are now lowercase, matching services: App.logger App.bus App.timers App.orca App.prefs `createPrefsStorageBridge` keeps its old responsibilities; sources helpers (`prefsLocaleSource`, …) are gone — the dimension API replaces them. ## What changed - `$libs/prefs`: fully generic schema-based types + resolver. Old fixed `PrefsCapabilities` / `PrefsIntent` / `PrefsEffective` removed; replaced by `PrefsDimension`, `PrefsSchema`, `PrefsEffectiveOf<S>`, `PrefsIntentOf<S>`. - `arts/prefs`: engine + active wrapper rewritten to schema. Per- dimension active surface auto-built from schema keys. Sources file deleted (replaced by dimension surface). New `arts/prefs/dimensions/*` and `arts/prefs/standard.ts`. Storage bridge made schema-generic. - `arts/active-app`: lowercase `CoreServices` / `ActiveAppCore`, `prefs?: ActiveAppPrefsOptions<S>` root option carrying the schema. `defineActivePrefs` deleted (prefs is core, not service). `lang` / `format` / `frontend` factories migrated to read `core.prefs.<dim>` directly via defensive `readSlot()` helpers (each dimension is optional from the factory's POV; if the app's schema omits one, the integration degrades gracefully). - Presets, demos, web routes, README docstrings, `check-aliases.mjs` guards, marketing snippets all migrated. - Tests: `engine-prefs`, `active-prefs`, `storage-bridge`, `resolve-prefs`, `validate-intent`, `prefs-consumer-wiring`, `service-factories` rewritten for the schema-based API. `sources.test.ts` deleted (sources file is gone). ## Verification - `npm run check`: 0 errors, 0 warnings (1527 files). - `npm test`: 1645 tests across 139 files, all green. - `node scripts/check-aliases.mjs`: clean (lowercase enforced for every member of `App.*`, including `Logger`/`Bus`/`Timers`/`Orca`/ `Prefs` which now flag as forbidden capitals). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
5 months ago
ActiveAppPrefsOptions,
Reduce App core to Logger/Bus/Timers/Orca; everything else is opt-in services Big-bang replacement of the active-app composition: legacy uppercase surface (App.Lang, App.Cache, App.Format, App.Frontend, App.Dom, App.Storage, App.Http) removed entirely. All non-core artifacts are now opt-in via services schema: services: { cache: defineActiveCache(), lang: defineActiveLang(...), ... } Schema services are exposed as lowercase properties (App.cache, App.lang, …) with end-to-end type safety; accessing a service the schema didn't declare is a compile error. Three import paths split for honest tree-shaking: $active-app createActiveApp + core types/errors/bus-context $active-app/services defineActive* / defineEngine* factories $active-app/presets applyCache* / applyPerm* / applyStandardOrca Service factories declare core deps (logger/bus/timers/orca) and sibling service deps (e.g. format wires localeSource from lang automatically when both are declared). The builder validates names, computes topological order, detects cycles, builds immediates eagerly, and exposes lazy proxies that materialise on first access. factory.create() runs inside untrack so subscriptions wired during construction (e.g. lang.onLocaleChange) cannot crash the outer reactive scope when triggered from a $derived. Reactions to lifecycle events (cache.clear on revoke / identity change, perm.invalidate on identity change) move from internal bus subscriptions inside arts to opt-in orca presets registered by the application: applyStandardOrca(App) // or cherry-pick individual apply* functions Also lands a working showcase at /demo wiring 10 of 12 services (everything except auth/connections, which need a real server) plus a mocked perm fetcher and a real http client against jsonplaceholder. Misc cleanup along the way: - libs/cache/{key,policy,scope}.ts: missing CACHE_VALIDATION_MESSAGES imports (the throw paths were never covered by tests, so the bug only surfaced via the demo) - All arts READMEs scrubbed of autoInvalidateOn / APP_EVENT_USER_* references; bus README rewritten around the orca-preset model - refactorizacion.md moved out of src/ into docs/ Verification: 1347/1347 vitest tests passing, demo loads and exercises all wired services in a real browser with zero console errors. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
5 months ago
ActiveAppServicesIntrospection
} from './types.ts';
Add arts/timr, arts/sess, arts/http; sess actor extension; aapp factory New artifacts: arts/timr — runtime timer scheduler (singleton-per-App, never global). Engine + Active split. Race-safe via (id, key, version) guard against stale native callbacks, async tasks resolving after cancel/replace, interval ticks scheduled after dispose, and ack-style timeouts. Per- entry AbortController; intervals reuse the signal across ticks. awaitTask:true (default, no overlap) vs awaitTask:false (fire-and- forget cadence; failures don't stop the interval — semantic frozen). Recursive setTimeout for intervals. scheduleAt(past) → delay 0 (no error). Fake-clock injectable for deterministic tests. Pure computeBackoffDelay helper. 50 server tests + 7 browser tests + full README + DESIGN_TIMR + interactive test page at /test/timr. arts/sess — session lifecycle with three generics (TUser/TCredential/TData) plus optional SessionActor metadata (kind/source/confidence — orthogonal axis to identity). Tagged AdoptResult/RefreshResult/RevokeResult; never void. Generation guard against stale refresh from local cancel, cross-tab storage events, or re-adopt. onRefresh contract (null=fatal, throw=transient). onRevoke replaces revokeUrl (consumer controls fetch; engine just gets boolean). Default scope: 'global' when onRevoke configured. INITIAL_SESSION sync dispatch on subscribe. BroadcastChannel payload: {type, event, generation} only — never tokens. SSR cookie reader validates invariants. withAutoRefresh helper, 401-retry hook with applyAuth + loop guard, JWT exp helper. 103 tests (60 server + 5 browser + 38 actor/error/etc) + README + DESIGN.md + test page at /test/sess. arts/http — HTTP client with Standard Schema body validation, retry + Retry-After, attempt + total timeout via AbortSignal composition, hooks (beforeRequest/beforeRetry/afterResponse/beforeError), tagged HttpResult. Test page at /test/http. arts/conn — DESIGN_CONN.md only (no implementation yet). aapp: - App.createActiveSession<TUser, TCredential, TData>(opts) factory auto-injects App.Logger; throws SessAlreadyCreatedError on second call. App.Sess getter exposes the active session (undefined until first call). Auto-disposed by App.dispose(). - App.Timers integration deferred to timr Fase 3. libs/days: - toEpochMs(value) — permissive coercion (number | Date | string) → epoch ms. Exposed alongside the existing day/calendar helpers. Other: - sium examples moved to _examples/ (excluded from public surface). - sium-provider.svelte test removed (port pending; tracked elsewhere). - libs/env.ts — DEV flag single source of truth. - Various README touch-ups across artifacts. All artifacts: 1021 server tests + 12 browser tests; svelte-check + ESLint clean. The 9 server "errors" are pre-existing jsdom missing — unrelated. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
5 months ago
Big-bang: remove legacy translators, App.createActiveX(), APP_EVENT_*, autoInvalidate* Completes step 3 of the active-app refactor. The orca-based service schema model is now the single supported path; the legacy auto-reactive ecosystem is gone. Removed: - arts/active-app/integrations/session-translator.ts and auth-cache.ts (their purpose is replaced by orca presets in arts/active-app/presets/). - arts/connection/bus-session-source.ts (canonical session events flow through SESSION_EVENT_* directly). - libs/active-app/ entirely. Its contents (consts, errors, events reduced to APP_EVENT_DISPOSE_STARTING) consolidated into arts/active-app/{consts,errors,events}.ts. The libs layer no longer has anything app-specific. - From arts/cache: - bus / autoInvalidateOn options on ActiveCacheOptions. - wireAutoInvalidation internal subscription. - CACHE_AUTO_INVALIDATE_* constants and types. - From arts/perm: - bus / autoInvalidateOn options on ActivePermsOptions. - wireAutoInvalidation internal subscription. - PERM_AUTO_INVALIDATE_* constants and types. - From arts/connection: - bus option in EngineConnectionsOptions. - shouldWireBusSessionSource helper. - The "reacts to canonical app identity bus events" test that depended on the deleted bus-session-source. - From arts/active-app/active-app.svelte.ts: - createSiumEngine() / createActiveSession() / createActiveConnections() / createActivePerms() / createActiveAuth() factory methods. - App.Sess / App.Perms / App.Auth getters and the singleton guards (Sess !== undefined etc.). - APP_ORCHESTRATION_* preset system, resolveActiveAppOrchestration, STANDARD_ORCHESTRATION_TRANSLATORS, all five translator handles. - APP_ERROR_ALREADY_CREATED_* / APP_ERROR_CREATE_PERM_ENDPOINT_REQUIRED constants (orphan after factory removal). - From arts/active-app/test: - ecosystem.integration.test.ts (9 monolithic tests, ~1900 lines). - session-translator.test.ts. - create-sium-engine.test.ts. - From libs/active-app/test: - events.test.ts (covered the deleted publishers and the legacy APP_USER_IDENTITY_* causes). - APP_EVENT_USER_IDENTITY_CHANGED, APP_EVENT_TENANT_SWITCHED, APP_EVENT_PERMISSIONS_REFRESH_REQUESTED, APP_EVENT_CACHE_INVALIDATE_REQUESTED, APP_EVENT_CONNECTIVITY_CHANGED (only DISPOSE_STARTING survives). - Their associated payload interfaces and the APP_USER_IDENTITY_CAUSE_* constants. - publishAppUserIdentityChanged / publishAppPermsRefreshRequested / publishAppCacheInvalidateRequested / publishAppTenantSwitched / publishAppConnectivityChanged. publishAppDisposeStarting and the new onAppDisposeStarting helper remain. Final shape of arts/active-app/: - active-app.svelte.ts: builds Logger, Lang, Format, Frontend, Dom, Storage, Http, Timers, Bus, Orca, Cache, then the schema services via buildServiceBuilders. dispose() publishes DISPOSE_STARTING and tears everything down in reverse construction order. - services.ts, service-builder.ts, service-factories/, presets/, bus-context.svelte.ts, consts.ts, errors.ts, events.ts, types.ts, index.ts (public barrel exposing every define*, applyStandardOrca, types and errors). Suite: 1374 tests pass. The reduction from the prior 1408 reflects the deleted legacy tests; coverage of the new model is comprehensive (schema-declarative.test.ts, service-builder.test.ts, service-factories.test.ts, presets.test.ts, active-app.test.ts core, plus the existing per-art suites). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
5 months ago
export type {
AppServiceFactory,
AppServiceSchema,
CoreServices,
CoreServiceKey,
ResolveServiceInstances,
ServiceInitMode,
ServiceStatus
Reduce App core to Logger/Bus/Timers/Orca; everything else is opt-in services Big-bang replacement of the active-app composition: legacy uppercase surface (App.Lang, App.Cache, App.Format, App.Frontend, App.Dom, App.Storage, App.Http) removed entirely. All non-core artifacts are now opt-in via services schema: services: { cache: defineActiveCache(), lang: defineActiveLang(...), ... } Schema services are exposed as lowercase properties (App.cache, App.lang, …) with end-to-end type safety; accessing a service the schema didn't declare is a compile error. Three import paths split for honest tree-shaking: $active-app createActiveApp + core types/errors/bus-context $active-app/services defineActive* / defineEngine* factories $active-app/presets applyCache* / applyPerm* / applyStandardOrca Service factories declare core deps (logger/bus/timers/orca) and sibling service deps (e.g. format wires localeSource from lang automatically when both are declared). The builder validates names, computes topological order, detects cycles, builds immediates eagerly, and exposes lazy proxies that materialise on first access. factory.create() runs inside untrack so subscriptions wired during construction (e.g. lang.onLocaleChange) cannot crash the outer reactive scope when triggered from a $derived. Reactions to lifecycle events (cache.clear on revoke / identity change, perm.invalidate on identity change) move from internal bus subscriptions inside arts to opt-in orca presets registered by the application: applyStandardOrca(App) // or cherry-pick individual apply* functions Also lands a working showcase at /demo wiring 10 of 12 services (everything except auth/connections, which need a real server) plus a mocked perm fetcher and a real http client against jsonplaceholder. Misc cleanup along the way: - libs/cache/{key,policy,scope}.ts: missing CACHE_VALIDATION_MESSAGES imports (the throw paths were never covered by tests, so the bug only surfaced via the demo) - All arts READMEs scrubbed of autoInvalidateOn / APP_EVENT_USER_* references; bus README rewritten around the orca-preset model - refactorizacion.md moved out of src/ into docs/ Verification: 1347/1347 vitest tests passing, demo loads and exercises all wired services in a real browser with zero console errors. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
5 months ago
} from './services.ts';
Big-bang: remove legacy translators, App.createActiveX(), APP_EVENT_*, autoInvalidate* Completes step 3 of the active-app refactor. The orca-based service schema model is now the single supported path; the legacy auto-reactive ecosystem is gone. Removed: - arts/active-app/integrations/session-translator.ts and auth-cache.ts (their purpose is replaced by orca presets in arts/active-app/presets/). - arts/connection/bus-session-source.ts (canonical session events flow through SESSION_EVENT_* directly). - libs/active-app/ entirely. Its contents (consts, errors, events reduced to APP_EVENT_DISPOSE_STARTING) consolidated into arts/active-app/{consts,errors,events}.ts. The libs layer no longer has anything app-specific. - From arts/cache: - bus / autoInvalidateOn options on ActiveCacheOptions. - wireAutoInvalidation internal subscription. - CACHE_AUTO_INVALIDATE_* constants and types. - From arts/perm: - bus / autoInvalidateOn options on ActivePermsOptions. - wireAutoInvalidation internal subscription. - PERM_AUTO_INVALIDATE_* constants and types. - From arts/connection: - bus option in EngineConnectionsOptions. - shouldWireBusSessionSource helper. - The "reacts to canonical app identity bus events" test that depended on the deleted bus-session-source. - From arts/active-app/active-app.svelte.ts: - createSiumEngine() / createActiveSession() / createActiveConnections() / createActivePerms() / createActiveAuth() factory methods. - App.Sess / App.Perms / App.Auth getters and the singleton guards (Sess !== undefined etc.). - APP_ORCHESTRATION_* preset system, resolveActiveAppOrchestration, STANDARD_ORCHESTRATION_TRANSLATORS, all five translator handles. - APP_ERROR_ALREADY_CREATED_* / APP_ERROR_CREATE_PERM_ENDPOINT_REQUIRED constants (orphan after factory removal). - From arts/active-app/test: - ecosystem.integration.test.ts (9 monolithic tests, ~1900 lines). - session-translator.test.ts. - create-sium-engine.test.ts. - From libs/active-app/test: - events.test.ts (covered the deleted publishers and the legacy APP_USER_IDENTITY_* causes). - APP_EVENT_USER_IDENTITY_CHANGED, APP_EVENT_TENANT_SWITCHED, APP_EVENT_PERMISSIONS_REFRESH_REQUESTED, APP_EVENT_CACHE_INVALIDATE_REQUESTED, APP_EVENT_CONNECTIVITY_CHANGED (only DISPOSE_STARTING survives). - Their associated payload interfaces and the APP_USER_IDENTITY_CAUSE_* constants. - publishAppUserIdentityChanged / publishAppPermsRefreshRequested / publishAppCacheInvalidateRequested / publishAppTenantSwitched / publishAppConnectivityChanged. publishAppDisposeStarting and the new onAppDisposeStarting helper remain. Final shape of arts/active-app/: - active-app.svelte.ts: builds Logger, Lang, Format, Frontend, Dom, Storage, Http, Timers, Bus, Orca, Cache, then the schema services via buildServiceBuilders. dispose() publishes DISPOSE_STARTING and tears everything down in reverse construction order. - services.ts, service-builder.ts, service-factories/, presets/, bus-context.svelte.ts, consts.ts, errors.ts, events.ts, types.ts, index.ts (public barrel exposing every define*, applyStandardOrca, types and errors). Suite: 1374 tests pass. The reduction from the prior 1408 reflects the deleted legacy tests; coverage of the new model is comprehensive (schema-declarative.test.ts, service-builder.test.ts, service-factories.test.ts, presets.test.ts, active-app.test.ts core, plus the existing per-art suites). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
5 months ago
Reduce App core to Logger/Bus/Timers/Orca; everything else is opt-in services Big-bang replacement of the active-app composition: legacy uppercase surface (App.Lang, App.Cache, App.Format, App.Frontend, App.Dom, App.Storage, App.Http) removed entirely. All non-core artifacts are now opt-in via services schema: services: { cache: defineActiveCache(), lang: defineActiveLang(...), ... } Schema services are exposed as lowercase properties (App.cache, App.lang, …) with end-to-end type safety; accessing a service the schema didn't declare is a compile error. Three import paths split for honest tree-shaking: $active-app createActiveApp + core types/errors/bus-context $active-app/services defineActive* / defineEngine* factories $active-app/presets applyCache* / applyPerm* / applyStandardOrca Service factories declare core deps (logger/bus/timers/orca) and sibling service deps (e.g. format wires localeSource from lang automatically when both are declared). The builder validates names, computes topological order, detects cycles, builds immediates eagerly, and exposes lazy proxies that materialise on first access. factory.create() runs inside untrack so subscriptions wired during construction (e.g. lang.onLocaleChange) cannot crash the outer reactive scope when triggered from a $derived. Reactions to lifecycle events (cache.clear on revoke / identity change, perm.invalidate on identity change) move from internal bus subscriptions inside arts to opt-in orca presets registered by the application: applyStandardOrca(App) // or cherry-pick individual apply* functions Also lands a working showcase at /demo wiring 10 of 12 services (everything except auth/connections, which need a real server) plus a mocked perm fetcher and a real http client against jsonplaceholder. Misc cleanup along the way: - libs/cache/{key,policy,scope}.ts: missing CACHE_VALIDATION_MESSAGES imports (the throw paths were never covered by tests, so the bug only surfaced via the demo) - All arts READMEs scrubbed of autoInvalidateOn / APP_EVENT_USER_* references; bus README rewritten around the orca-preset model - refactorizacion.md moved out of src/ into docs/ Verification: 1347/1347 vitest tests passing, demo loads and exercises all wired services in a real browser with zero console errors. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
5 months ago
export { buildServiceBuilders } from './service-builder.ts';
export type { ServiceBuilders } from './service-builder.ts';

Powered by TurnKey Linux.