@endge/core 9.0.0 → 11.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (131) hide show
  1. package/dist/core.js +41944 -40206
  2. package/dist/features/core/kernel/config/debugger.config.d.ts +3 -0
  3. package/dist/features/core/kernel/config/kernel.config.d.ts +2 -2
  4. package/dist/features/core/kernel/config/modules.config.d.ts +6 -1
  5. package/dist/features/core/kernel/constants/kernel.constants.d.ts +1 -3
  6. package/dist/features/core/kernel/endge.d.ts +20 -6
  7. package/dist/features/core/kernel/errors/EndgeDebuggerReadOnlyError.d.ts +5 -0
  8. package/dist/features/core/kernel/tools/debugger-snapshot.d.ts +13 -0
  9. package/dist/features/core/kernel/tools/read-only-document.d.ts +2 -0
  10. package/dist/features/core/kernel/types/bootstrap.types.d.ts +8 -2
  11. package/dist/features/core/modules/bridge/adapters/BrowserBridge_Adapter.d.ts +0 -3
  12. package/dist/features/core/modules/bridge/config/bridge.config.d.ts +17 -0
  13. package/dist/features/core/modules/bridge/debug/EndgeBridgeDebug_Module.d.ts +59 -4
  14. package/dist/features/core/modules/bridge/domain/bridge-sync.type.d.ts +30 -0
  15. package/dist/features/core/modules/bridge/tools/bridge-sync.d.ts +16 -0
  16. package/dist/features/core/modules/commands/EndgeCommands_Module.d.ts +17 -0
  17. package/dist/features/core/modules/commands/config/commands.config.d.ts +9 -0
  18. package/dist/features/core/modules/commands/domain/commands.types.d.ts +38 -0
  19. package/dist/features/core/modules/commands/services/LocalCommandExecutor.d.ts +9 -0
  20. package/dist/features/core/modules/commands/services/RemoteCommandExecutor.d.ts +9 -0
  21. package/dist/features/core/modules/commands/services/context/SetDataModeCommand.d.ts +9 -0
  22. package/dist/features/core/modules/commands/services/context/SetFacetCommand.d.ts +9 -0
  23. package/dist/features/core/modules/commands/services/context/SetLocaleCommand.d.ts +9 -0
  24. package/dist/features/core/modules/commands/services/context/SetThemeCommand.d.ts +9 -0
  25. package/dist/features/core/modules/commands/services/context/SetTimezoneCommand.d.ts +9 -0
  26. package/dist/features/core/modules/commands/services/context/SetUserCommand.d.ts +9 -0
  27. package/dist/features/core/modules/commands/services/context/SetWorkspaceCommand.d.ts +9 -0
  28. package/dist/features/core/modules/commands/services/runtime/PauseRuntimeCommand.d.ts +9 -0
  29. package/dist/features/core/modules/commands/services/runtime/ResumeRuntimeCommand.d.ts +9 -0
  30. package/dist/features/core/modules/commands/services/runtime/StopRuntimeCommand.d.ts +9 -0
  31. package/dist/features/core/modules/commands/tools/command-payload.d.ts +4 -0
  32. package/dist/features/core/modules/commands/types/command-executor.type.d.ts +19 -0
  33. package/dist/features/core/modules/commands/types/context-command-target.type.d.ts +12 -0
  34. package/dist/features/core/modules/commands/types/runtime-command-target.type.d.ts +5 -0
  35. package/dist/features/core/modules/compiler/EndgeCompiler_Module.d.ts +7 -6
  36. package/dist/features/core/modules/compiler/services/action/action-compile.d.ts +2 -0
  37. package/dist/features/core/modules/compiler/services/computation/computation-compile.d.ts +2 -0
  38. package/dist/features/core/modules/computations/model/ComputationResource.d.ts +11 -1
  39. package/dist/features/core/modules/computations/model/ComputationResourceRegistry.d.ts +9 -0
  40. package/dist/features/core/modules/configuration/EndgeConfiguration_Module.d.ts +4 -2
  41. package/dist/features/core/modules/configuration/domain/endge-configuration.d.ts +1 -1
  42. package/dist/features/core/modules/configuration/domain/tooltip.config.d.ts +1 -1
  43. package/dist/features/core/modules/configuration/domain/types/configuration.type.d.ts +3 -1
  44. package/dist/features/core/modules/context/EndgeContext_Module.d.ts +33 -22
  45. package/dist/features/core/modules/context/domain/context-events.types.d.ts +8 -0
  46. package/dist/features/core/modules/context/domain/context-persistence.types.d.ts +8 -8
  47. package/dist/features/core/modules/domain/EndgeDomain_Module.d.ts +20 -201
  48. package/dist/features/core/modules/domain/documents/document-metadata.d.ts +7 -0
  49. package/dist/features/core/modules/domain/documents/domain-document-descriptors.d.ts +4 -10
  50. package/dist/features/core/modules/domain/documents/service-document-serializer.d.ts +0 -1
  51. package/dist/features/core/modules/domain/entities/RComponentBase.d.ts +0 -1
  52. package/dist/features/core/modules/domain/entities/RComposition.d.ts +1 -1
  53. package/dist/features/core/modules/domain/entities/REntity.d.ts +2 -0
  54. package/dist/features/core/modules/domain/entities/RFacet.d.ts +14 -0
  55. package/dist/features/core/modules/domain/entities/RFacetDocument.d.ts +12 -0
  56. package/dist/features/core/modules/domain/entities/RFolder.d.ts +5 -0
  57. package/dist/features/core/modules/domain/entities/RSimulation.d.ts +1 -1
  58. package/dist/features/core/modules/domain/entities/RWorkspace.d.ts +3 -1
  59. package/dist/features/core/modules/domain/types/document/codegen.types.d.ts +14 -4
  60. package/dist/features/core/modules/domain/types/document/document-metadata.types.d.ts +38 -0
  61. package/dist/features/core/modules/domain/types/document/document.types.d.ts +4 -15
  62. package/dist/features/core/modules/domain/types/document/domain-export.type.d.ts +4 -7
  63. package/dist/features/core/modules/domain/types/document/domain-provider.type.d.ts +48 -1
  64. package/dist/features/core/modules/domain/types/document/domain-snapshot.type.d.ts +6 -1
  65. package/dist/features/core/modules/domain/types/document/query.types.d.ts +0 -48
  66. package/dist/features/core/modules/domain-repository/EndgeDomainRepository_Module.d.ts +25 -2
  67. package/dist/features/core/modules/events/EndgeEvents_Module.d.ts +13 -63
  68. package/dist/features/core/modules/events/domain/events.types.d.ts +34 -22
  69. package/dist/features/core/modules/i18n/services/composition-i18n-catalog-projection.d.ts +1 -3
  70. package/dist/features/core/modules/i18n/tools/resolve-runtime-translation.d.ts +3 -0
  71. package/dist/features/core/modules/program/domain/types/program.types.d.ts +1 -1
  72. package/dist/features/core/modules/runtime/ComponentSFCEventBoundary.d.ts +1 -1
  73. package/dist/features/core/modules/runtime/EndgeRuntimeScopes_Module.d.ts +5 -0
  74. package/dist/features/core/modules/runtime/EndgeRuntime_Module.d.ts +45 -8
  75. package/dist/features/core/modules/runtime/domain/component-sfc-render-port.types.d.ts +8 -0
  76. package/dist/features/core/modules/runtime/domain/execution-context.types.d.ts +5 -12
  77. package/dist/features/core/modules/runtime/domain/runtime-entity-map.types.d.ts +3 -3
  78. package/dist/features/core/modules/runtime/domain/runtime-host.types.d.ts +3 -4
  79. package/dist/features/core/modules/runtime/domain/runtime-inspection.types.d.ts +28 -0
  80. package/dist/features/core/modules/runtime/domain/runtime-render-inspection.types.d.ts +27 -0
  81. package/dist/features/core/modules/runtime/domain/runtime.types.d.ts +4 -3
  82. package/dist/features/core/modules/runtime/domain/simulation-runtime.types.d.ts +25 -0
  83. package/dist/features/core/modules/runtime/domain/stream-runtime.types.d.ts +3 -1
  84. package/dist/features/core/modules/runtime/execution/endge-simulation.d.ts +5 -0
  85. package/dist/features/core/modules/runtime/hosts/ComponentSFCRuntimeHost.d.ts +3 -0
  86. package/dist/features/core/modules/runtime/hosts/CompositionRuntimeHost.d.ts +2 -3
  87. package/dist/features/core/modules/runtime/hosts/FilterViewRuntimeHost.d.ts +5 -0
  88. package/dist/features/core/modules/runtime/hosts/SimulationRuntimeHost.d.ts +52 -0
  89. package/dist/features/core/modules/runtime/hosts/StreamRuntimeHost.d.ts +7 -4
  90. package/dist/features/core/modules/runtime/services/simulation/create-simulation-schema.d.ts +5 -0
  91. package/dist/features/core/modules/runtime/services/simulation/find-simulation-runtime.d.ts +4 -0
  92. package/dist/features/core/modules/runtime/services/simulation/prepare-simulation-overrides.d.ts +14 -0
  93. package/dist/features/core/modules/runtime/services/strategies/CompositionRuntimeStrategy.d.ts +1 -1
  94. package/dist/features/core/modules/runtime/services/strategies/SimulationRuntimeStrategy.d.ts +9 -0
  95. package/dist/features/core/modules/runtime/services/transports/BrowserWebSocketStreamTransportFactory.d.ts +6 -0
  96. package/dist/features/core/modules/runtime/tools/runtime-inspection.d.ts +10 -0
  97. package/dist/features/core/modules/runtime/tools/runtime-render-inspection.d.ts +6 -0
  98. package/dist/features/core/modules/runtime/tools/runtime-render-values.d.ts +4 -0
  99. package/dist/features/core/modules/source/EndgeSource_Module.d.ts +2 -2
  100. package/dist/features/core/modules/source/domain/types/composition-source.types.d.ts +14 -1
  101. package/dist/features/core/modules/source/domain/types/configuration-source.types.d.ts +2 -0
  102. package/dist/features/core/modules/source/domain/types/simulation-source.types.d.ts +25 -7
  103. package/dist/features/core/modules/source/domain/types/source-engine.types.d.ts +9 -4
  104. package/dist/features/core/modules/source/domain/types/store-source.types.d.ts +2 -0
  105. package/dist/features/core/modules/source/domain/types/stream-source.types.d.ts +15 -1
  106. package/dist/features/core/modules/source/domain/types/type-source.types.d.ts +2 -0
  107. package/dist/features/core/modules/source/domain/types/update-source.types.d.ts +2 -0
  108. package/dist/features/core/modules/source/services/SimulationSourceResolver.d.ts +3 -2
  109. package/dist/features/core/modules/source/services/compilers/action-source-compile.d.ts +2 -0
  110. package/dist/features/core/modules/source/services/compilers/composition-source-compile.d.ts +1 -1
  111. package/dist/features/core/modules/source/services/component-sfc/component-sfc-metadata-source-patch.d.ts +2 -2
  112. package/dist/features/core/modules/source/services/strategies/CompositionSourceEngineStrategy.d.ts +2 -2
  113. package/dist/features/core/modules/source/services/strategies/SimulationSourceEngineStrategy.d.ts +2 -2
  114. package/dist/features/core/modules/source/templates/simulation.default.source.d.ts +2 -2
  115. package/dist/features/core/modules/workspace/EndgeWorkspace_Module.d.ts +2 -0
  116. package/dist/features/core/modules/workspace/domain/workspace.types.d.ts +5 -0
  117. package/dist/features/federation/EndgeFederation.d.ts +3 -0
  118. package/dist/features/federation/types/federation.types.d.ts +5 -0
  119. package/dist/main.d.ts +22 -9
  120. package/package.json +3 -3
  121. package/dist/features/core/modules/domain/entities/REnvironment.d.ts +0 -9
  122. package/dist/features/core/modules/domain/entities/RParameter.d.ts +0 -11
  123. package/dist/features/core/modules/domain/entities/RProject.d.ts +0 -64
  124. package/dist/features/core/modules/domain/entities/RQueryFilter.d.ts +0 -12
  125. package/dist/features/core/modules/domain/entities/RTenant.d.ts +0 -10
  126. package/dist/features/core/modules/events/domain/EndgeEvent.d.ts +0 -33
  127. package/dist/features/core/modules/runtime/domain/runtime-project-session.types.d.ts +0 -31
  128. package/dist/features/core/modules/runtime/execution/endge-project.d.ts +0 -6
  129. package/dist/features/core/modules/runtime/hosts/ProjectRuntimeHost.d.ts +0 -21
  130. package/dist/features/core/modules/runtime/services/strategies/ProjectRuntimeStrategy.d.ts +0 -9
  131. package/dist/features/core/modules/source/templates/project.default.source.d.ts +0 -2
@@ -0,0 +1,5 @@
1
+ import { RuntimeControlOperation, RuntimeControlTarget } from '../../runtime/domain/runtime-inspection.types';
2
+ /** Узкий API владельца Runtime для общих локальных обработчиков. */
3
+ export interface EndgeRuntimeCommandTarget {
4
+ control: (operation: RuntimeControlOperation, target: RuntimeControlTarget) => Promise<void>;
5
+ }
@@ -2,7 +2,6 @@ import { EndgeBootContext } from '../../kernel/types/bootstrap.types';
2
2
  import { RSimulation } from '../domain/entities/RSimulation';
3
3
  import { RStore } from '../domain/entities/RStore';
4
4
  import { RStream } from '../domain/entities/RStream';
5
- import { RStyle } from '../domain/entities/RStyle';
6
5
  import { RType } from '../domain/entities/RType';
7
6
  import { RUpdate } from '../domain/entities/RUpdate';
8
7
  import { RVocabs } from '../domain/entities/RVocabs';
@@ -21,8 +20,8 @@ import { RComposition } from '../domain/entities/RComposition';
21
20
  import { RComputation } from '../domain/entities/RComputation';
22
21
  import { RDataView } from '../domain/entities/RDataView';
23
22
  import { RFilter } from '../domain/entities/RFilter';
24
- import { RProject } from '../domain/entities/RProject';
25
23
  import { RQuery } from '../domain/entities/RQuery';
24
+ import { RStyle } from '../domain/entities/RStyle';
26
25
  import { EndgeModule } from '../../../federation/EndgeModule';
27
26
  /**
28
27
  * Компилятор persisted domain model в compiled program artifacts.
@@ -69,6 +68,8 @@ export declare class EndgeCompiler_Module extends EndgeModule<EndgeBootContext>
69
68
  buildAction(entity: RAction): ProgramArtifact<ActionProgramPayload>;
70
69
  /** Компилирует один ComponentSFC без запуска полного domain build. */
71
70
  buildComponentSFC(entity: RComponentSFC): ProgramArtifact<ComponentSFCProgramPayload>;
71
+ /** Компилирует наблюдаемый SFC без записи в Program и без запуска runtime. */
72
+ compileComponentSFCArtifact(entity: RComponentSFC): ProgramArtifact<ComponentSFCProgramPayload>;
72
73
  /** Компилирует один DataView source в Endge.program без запуска остальных compiler-фаз. */
73
74
  buildDataView(entity: RDataView): ProgramArtifact<DataViewProgramPayload>;
74
75
  /** Компилирует один Store source в Endge.program. */
@@ -77,16 +78,14 @@ export declare class EndgeCompiler_Module extends EndgeModule<EndgeBootContext>
77
78
  buildStream(entity: RStream): ProgramArtifact<StreamSourceArtifact>;
78
79
  /** Компилирует один Simulation source в Endge.program. */
79
80
  buildSimulation(entity: RSimulation): ProgramArtifact<SimulationSourceArtifact>;
81
+ /** Компилирует черновик Simulation без публикации в общей Program. */
82
+ compileSimulationArtifact(entity: RSimulation): ProgramArtifact<SimulationSourceArtifact>;
80
83
  /** Компилирует один дочерний Update source в Endge.program. */
81
84
  buildUpdate(entity: RUpdate): ProgramArtifact<UpdateSourceArtifact>;
82
85
  /** Компилирует один Filter source в Endge.program. */
83
86
  buildFilter(entity: RFilter): ProgramArtifact<FilterProgramPayload>;
84
87
  /** Компилирует один Composition source в Endge.program. */
85
88
  buildComposition(entity: RComposition): ProgramArtifact<CompositionProgramPayload>;
86
- /** Компилирует корневой граф проекта под собственной project identity. */
87
- buildProject(entity: RProject): ProgramArtifact<CompositionProgramPayload>;
88
- /** Создаёт isolated project artifact для Preview без публикации в общей program. */
89
- compileProjectArtifact(entity: RProject): ProgramArtifact<CompositionProgramPayload>;
90
89
  /**
91
90
  * Компилирует transient Composition artifact без публикации в Endge.program.
92
91
  * Используется runtime session overlays, которым нельзя менять общий build.
@@ -235,6 +234,8 @@ export declare class EndgeCompiler_Module extends EndgeModule<EndgeBootContext>
235
234
  private _resolveFilterSource;
236
235
  /** Возвращает сохраненный Composition source. */
237
236
  private _resolveCompositionSource;
237
+ /** Возвращает immutable selections в generic Source key space. */
238
+ private _sourceExecutionContext;
238
239
  /** Создает пустой query payload для error-artifact. */
239
240
  private _makeEmptyQueryPayload;
240
241
  /** Создает пустой Filter payload для error-artifact. */
@@ -1,7 +1,9 @@
1
1
  import { RAction } from '../../../domain/entities/RAction';
2
+ import { ProgramMetadataMap } from '../../../program/domain/types/program-metadata.types';
2
3
  import { ActionProgramPayload, ProgramDependency, ProgramDiagnostic } from '../../../program/domain/types/program.types';
3
4
  export interface ActionCompileResult {
4
5
  payload: ActionProgramPayload;
6
+ metadata: ProgramMetadataMap;
5
7
  diagnostics: Omit<ProgramDiagnostic, 'entityRef'>[];
6
8
  dependencies: ProgramDependency[];
7
9
  }
@@ -1,4 +1,5 @@
1
1
  import { ComputationProgramPayload } from '../../../domain/types/computation/computation-program.types';
2
+ import { ProgramMetadataMap } from '../../../program/domain/types/program-metadata.types';
2
3
  import { ProgramDiagnostic } from '../../../program/domain/types/program.types';
3
4
  import * as t from '@babel/types';
4
5
  type DiagnosticDraft = Omit<ProgramDiagnostic, 'entityRef'>;
@@ -7,6 +8,7 @@ export interface ComputationCompileInput {
7
8
  }
8
9
  export interface ComputationCompileResult {
9
10
  payload: ComputationProgramPayload;
11
+ metadata: ProgramMetadataMap;
10
12
  diagnostics: DiagnosticDraft[];
11
13
  }
12
14
  /** Компилирует source defineComputation в детерминированный выходной граф. */
@@ -5,6 +5,7 @@ type SyncRunner<T> = (input: unknown) => T;
5
5
  export declare class ComputationResourceState<T = unknown> implements ComputationResourceContract<T> {
6
6
  private readonly _asyncRunner;
7
7
  private readonly _syncRunner;
8
+ private readonly _identity;
8
9
  private _status;
9
10
  private _value;
10
11
  private _error;
@@ -12,11 +13,20 @@ export declare class ComputationResourceState<T = unknown> implements Computatio
12
13
  private _revision;
13
14
  private _disposed;
14
15
  private _input;
15
- constructor(input: unknown, _asyncRunner: AsyncRunner<T>, _syncRunner?: SyncRunner<T> | null);
16
+ constructor(input: unknown, _asyncRunner: AsyncRunner<T>, _syncRunner?: SyncRunner<T> | null, _identity?: string);
16
17
  get status(): import('../../domain/types/computation/computation-runtime.types').ComputationResourceStatus;
17
18
  get loading(): boolean;
18
19
  get value(): T | undefined;
19
20
  get error(): ComputationRuntimeErrorShape | null;
21
+ /** Снимок фактического результата для пассивного renderer debugger. */
22
+ snapshot(): {
23
+ identity: string;
24
+ input: unknown;
25
+ status: import('../../domain/types/computation/computation-runtime.types').ComputationResourceStatus;
26
+ loading: boolean;
27
+ value: T | undefined;
28
+ error: ComputationRuntimeErrorShape | null;
29
+ };
20
30
  updateInput(input: unknown): void;
21
31
  refresh(): Promise<void>;
22
32
  subscribe(listener: VoidFunction): VoidFunction;
@@ -10,4 +10,13 @@ export declare class ComputationResourceRegistry {
10
10
  /** Renderer освобождает завершившихся consumers, не затрагивая соседние scopes. */
11
11
  releaseScope(scope: string, keep?: (key: string) => boolean): void;
12
12
  dispose(): void;
13
+ /** Считывает ресурсы существующих consumers; новые вычисления не создаются. */
14
+ snapshot(): {
15
+ identity: string;
16
+ input: unknown;
17
+ status: import('../../domain/types/computation/computation-runtime.types').ComputationResourceStatus;
18
+ loading: boolean;
19
+ value: unknown;
20
+ error: import('../../domain/types/computation/computation-runtime.types').ComputationRuntimeErrorShape | null;
21
+ }[];
13
22
  }
@@ -5,10 +5,12 @@ import { EndgeModule } from '../../../federation/EndgeModule';
5
5
  export declare class EndgeConfiguration_Module extends EndgeModule<EndgeBootContext> {
6
6
  private _current;
7
7
  private _buildContext;
8
- /** Разрешает Workspace - Tenant - Project - Environment до compiler build. */
8
+ /** Разрешает Workspace и выбранные документы активных фасетов до compiler build. */
9
9
  build(ctx: EndgeBootContext): void;
10
10
  /** Очищает effective configuration перед следующим boot. */
11
11
  reset(): void;
12
+ /** Принимает уже разрешённую конфигурацию клиента без build, команд и запуска приложения. */
13
+ applyInspection(configuration: EndgeConfiguration): void;
12
14
  /** Включает effective configuration текущего build в диагностическое дерево. */
13
15
  createDiagnosticsSnapshot(): EndgeConfiguration;
14
16
  /** Возвращает effective configuration текущего build. */
@@ -27,5 +29,5 @@ export declare class EndgeConfiguration_Module extends EndgeModule<EndgeBootCont
27
29
  resolveUpstream(layer: EndgeConfigurationLayer): EndgeConfiguration;
28
30
  /** Строит preview без изменения активной конфигурации запуска. */
29
31
  preview(upstream: EndgeConfiguration, contribution: EndgeConfigurationContribution): EndgeConfiguration;
30
- private _resolveEntity;
32
+ private _activeFacets;
31
33
  }
@@ -6,7 +6,7 @@ export declare function createDefaultEndgeConfiguration(): EndgeConfiguration;
6
6
  export declare function normalizeEndgeConfiguration(input: unknown): EndgeConfiguration;
7
7
  /** Нормализует contribution сущности; пустое значение означает чистое наследование. */
8
8
  export declare function normalizeEndgeConfigurationContribution(input: unknown): EndgeConfigurationContribution;
9
- /** Применяет один Project/Environment/Tenant contribution к upstream configuration. */
9
+ /** Применяет один contribution Workspace или выбранного фасетного документа к upstream configuration. */
10
10
  export declare function applyEndgeConfigurationContribution(upstream: EndgeConfiguration, contribution: EndgeConfigurationContribution): EndgeConfiguration;
11
11
  /** Возвращает стабильный hash полного build context без platform crypto API. */
12
12
  export declare function createEndgeContextHash(input: unknown): string;
@@ -1,3 +1,3 @@
1
1
  import { EndgeTooltipConfiguration } from './types/configuration.type';
2
- /** Системные defaults, применяемые до переопределений Workspace -> Tenant -> Project -> Environment. */
2
+ /** Системные defaults, применяемые до Workspace и выбранных фасетных документов. */
3
3
  export declare const DEFAULT_ENDGE_TOOLTIP_CONFIGURATION: Readonly<EndgeTooltipConfiguration>;
@@ -168,7 +168,9 @@ export type EndgeConfigurationContribution = {
168
168
  mode: 'replace';
169
169
  value: EndgeConfiguration;
170
170
  };
171
- export type EndgeConfigurationLayer = 'workspace' | 'tenant' | 'project' | 'environment';
171
+ export type EndgeConfigurationLayer = 'workspace' | {
172
+ facetIdentity: string;
173
+ };
172
174
  /** Immutable input, передаваемый compiler strategies. */
173
175
  export interface EndgeBuildContext {
174
176
  workspaceIdentity: string;
@@ -1,5 +1,6 @@
1
- import { EndgeBootContext } from '../../kernel/types/bootstrap.types';
1
+ import { EndgeBootContext, EndgeBootMode } from '../../kernel/types/bootstrap.types';
2
2
  import { EndgeConfiguration } from '../configuration/domain/types/configuration.type';
3
+ import { ContextEvent } from './domain/context-events.types';
3
4
  import { EndgeContextPersistenceConfig, EndgeContextSnapshot, EndgeKeyboardContextSnapshot, EndgePersistenceScope, EndgeRuntimeContextSnapshot, EndgeSessionIdentityProvider, EndgeStorageAdapter } from './domain/context-persistence.types';
4
5
  import { EndgeContextStateListener, EndgeContextStateTransform } from './domain/context-state.types';
5
6
  import { EndgePersistenceInput } from './persistence/EndgeStorageAdapterRegistry';
@@ -8,7 +9,7 @@ import { EndgeDataMode } from '../workspace/domain/workspace.types';
8
9
  import { RuntimeStateController } from './persistence/RuntimeStateController';
9
10
  import { EndgeModule } from '../../../federation/EndgeModule';
10
11
  /**
11
- * Контекст выполнения Endge: текущий workspace/project/environment/user scope
12
+ * Контекст выполнения Endge: текущий workspace/dynamic facets/user scope
12
13
  * и координатор persistence-инфраструктуры приложения.
13
14
  */
14
15
  export declare class EndgeContext_Module extends EndgeModule<EndgeBootContext> {
@@ -17,9 +18,7 @@ export declare class EndgeContext_Module extends EndgeModule<EndgeBootContext> {
17
18
  private readonly _stateListeners;
18
19
  private _contextPersistence;
19
20
  private _currentWorkspace;
20
- private _currentTenant;
21
- private _currentProject;
22
- private _currentEnvironment;
21
+ private _facetSelections;
23
22
  private _currentUser;
24
23
  private _currentLocale;
25
24
  private _pendingLocale;
@@ -33,7 +32,12 @@ export declare class EndgeContext_Module extends EndgeModule<EndgeBootContext> {
33
32
  private _dataModeOverride;
34
33
  private _sessionProvider;
35
34
  private _isHydrating;
35
+ private _eventContext;
36
+ private _publishingContextChanges;
36
37
  private _executionContextLocked;
38
+ private _bootMode;
39
+ private _beforeInspection;
40
+ get bootMode(): EndgeBootMode;
37
41
  /** Создаёт контекст, регистрирует storage adapters и восстанавливает snapshot. */
38
42
  constructor();
39
43
  /** Применяет explicit structural context до load/build остальных модулей. */
@@ -46,10 +50,10 @@ export declare class EndgeContext_Module extends EndgeModule<EndgeBootContext> {
46
50
  registerStorageAdapter(adapter: EndgeStorageAdapter): void;
47
51
  /** Настраивает persistence текущего контекста. */
48
52
  configurePersistence(config: EndgeContextPersistenceConfig): void;
49
- /** Устанавливает provider актуальных tenant и user identity. */
53
+ /** Устанавливает provider актуальных user identity и обязательных session facet selections. */
50
54
  setSessionIdentityProvider(provider: EndgeSessionIdentityProvider | null): void;
51
- /** Показывает, что Tenant принудительно задан authenticated session provider. */
52
- get isTenantLockedBySession(): boolean;
55
+ /** Показывает, что выбор документа фасета задан authenticated session provider. */
56
+ isFacetLockedBySession(facetIdentity: string): boolean;
53
57
  /** Сериализует текущий execution scope в snapshot. */
54
58
  createDiagnosticsSnapshot(): Record<string, unknown>;
55
59
  serialize(): EndgeContextSnapshot;
@@ -61,8 +65,14 @@ export declare class EndgeContext_Module extends EndgeModule<EndgeBootContext> {
61
65
  setKeyboardState(input: EndgeKeyboardContextSnapshot): void;
62
66
  /** Сохраняет подписчиков legacy-модуля и проецирует постоянные поля контекста в Raph. */
63
67
  notify(): void;
68
+ /** Применяет типизированное событие через setters, сохраняя их проверки и side effects. */
69
+ applyEvent(event: ContextEvent): void;
64
70
  /** Восстанавливает execution scope из snapshot с безопасными defaults. */
65
71
  deserialize(payload: Partial<EndgeContextSnapshot> | undefined): void;
72
+ /** Adopts observed scope only in memory; developer authorization stays with the host session. */
73
+ applyInspection(snapshot: EndgeContextSnapshot & {
74
+ dataMode?: EndgeDataMode;
75
+ }): void;
66
76
  /** Сохраняет текущий context snapshot через выбранный adapter. */
67
77
  saveToStorage(): void;
68
78
  /** Загружает context snapshot из нового или legacy storage key. */
@@ -71,7 +81,7 @@ export declare class EndgeContext_Module extends EndgeModule<EndgeBootContext> {
71
81
  getPersistenceScope(): EndgePersistenceScope;
72
82
  /** Возвращает dynamic state текущего полного context scope. */
73
83
  getState<T>(key: string, transform?: EndgeContextStateTransform<T>): T | undefined;
74
- /** Сохраняет dynamic state в scope текущих workspace/tenant/project/environment/user. */
84
+ /** Сохраняет dynamic state в scope текущих workspace/facet selections/user. */
75
85
  setState<T>(key: string, state: T, transform?: EndgeContextStateTransform<T>): void;
76
86
  /** Удаляет dynamic state только из текущего полного context scope. */
77
87
  removeState(key: string): void;
@@ -91,16 +101,14 @@ export declare class EndgeContext_Module extends EndgeModule<EndgeBootContext> {
91
101
  getCurrentWorkspace(): string | null;
92
102
  /** Устанавливает текущий workspace и сохраняет контекст. */
93
103
  setCurrentWorkspace(identity: string | null): void;
94
- /** Возвращает identity текущего tenant с учётом session provider. */
95
- getCurrentTenant(): string;
96
- /** Устанавливает fallback identity текущего tenant. */
97
- setCurrentTenant(identity: string | null): void;
98
- /** Возвращает identity текущего project. */
99
- getCurrentProject(): string;
100
- /** Устанавливает текущий project и сохраняет контекст. */
101
- setCurrentProject(identity: string | null): void;
102
- /** Возвращает identity текущего environment. */
103
- getCurrentEnvironment(): string;
104
+ /** Возвращает immutable map выбранных документов по identity фасета. */
105
+ getFacetSelections(): Readonly<Record<string, string>>;
106
+ /** Возвращает выбранный документ фасета либо null, если фасет не имеет выбора. */
107
+ getFacetSelection(facetIdentity: string): string | null;
108
+ /** Устанавливает один выбор до следующего structural boot. */
109
+ setFacetSelection(facetIdentity: string, documentIdentity: string | null): void;
110
+ /** Заменяет structural map до следующего boot. */
111
+ setFacetSelections(selections: Readonly<Record<string, string>>): void;
104
112
  /** Возвращает immutable structural coordinates текущего boot lifecycle. */
105
113
  getExecutionContext(): EndgeExecutionContext;
106
114
  /**
@@ -109,8 +117,6 @@ export declare class EndgeContext_Module extends EndgeModule<EndgeBootContext> {
109
117
  * безопасно перейти на первую доступную сущность, если Domain изменился.
110
118
  */
111
119
  resolveExecutionContext(input: EndgeExecutionContextResolutionInput): EndgeExecutionContext;
112
- /** Устанавливает текущий environment и сохраняет контекст. */
113
- setCurrentEnvironment(identity: string | null): void;
114
120
  /** Возвращает identity текущего user с учётом session provider. */
115
121
  getCurrentUser(): string;
116
122
  /** Устанавливает fallback identity текущего user. */
@@ -158,13 +164,18 @@ export declare class EndgeContext_Module extends EndgeModule<EndgeBootContext> {
158
164
  private _resolveAdapter;
159
165
  private _notifyState;
160
166
  private _warnStateFailure;
167
+ /** Снимок фактических значений: session identities и effective data mode включены. */
168
+ private _readEventContext;
169
+ /** Constructor hydration задаёт baseline; последующие commits публикуют только изменения. */
170
+ private _publishContextChanges;
171
+ private _emitContextChange;
161
172
  private _syncPersistentContextToRaph;
162
173
  private _setRaphValueIfChanged;
163
174
  /** Возвращает identity активного workspace для persistence scope. */
164
175
  private _requireCurrentWorkspace;
165
176
  /** Создаёт безопасный scope для контроллера, который не читает и не изменяет состояние. */
166
177
  private _getDisabledPersistenceScope;
167
- /** Вычисляет tenant и user identity текущей сессии. */
178
+ /** Вычисляет user identity текущей сессии. */
168
179
  private _resolveSessionIdentity;
169
180
  /** Обновляет одно поле scope и публикует изменение контекста. */
170
181
  private _setScopeValue;
@@ -0,0 +1,8 @@
1
+ import { EndgeCoreEventMap } from '../../events/domain/events.types';
2
+ /** Событие для applyEvent с согласованными именем и типом payload. */
3
+ export type ContextEvent = {
4
+ [K in keyof EndgeCoreEventMap & `context:${string}`]: {
5
+ readonly name: K;
6
+ readonly payload: EndgeCoreEventMap[K];
7
+ };
8
+ }[keyof EndgeCoreEventMap & `context:${string}`];
@@ -8,9 +8,7 @@ export interface EndgeContextPersistenceConfig {
8
8
  }
9
9
  export interface EndgeContextSnapshot {
10
10
  workspace: string | null;
11
- tenant: string | null;
12
- project: string | null;
13
- environment: string | null;
11
+ facets: Readonly<Record<string, string>>;
14
12
  user: string | null;
15
13
  locale: string | null;
16
14
  theme: string | null;
@@ -46,15 +44,17 @@ export interface EndgeRuntimeContextSnapshot extends EndgeContextSnapshot {
46
44
  }
47
45
  export interface EndgePersistenceScope {
48
46
  workspaceId: string;
49
- tenantId: string;
50
- projectId: string;
51
- environmentId: string;
47
+ facetSelections: readonly EndgePersistenceFacetSelection[];
52
48
  userId: string;
53
49
  }
50
+ export interface EndgePersistenceFacetSelection {
51
+ facetIdentity: string;
52
+ documentIdentity: string;
53
+ }
54
54
  export type EndgePersistenceScopeResolver = () => EndgePersistenceScope;
55
55
  export interface EndgeSessionIdentity {
56
56
  userId?: string | null;
57
- tenantId?: string | null;
57
+ facetSelections?: Readonly<Record<string, string>>;
58
58
  }
59
59
  export interface EndgeSessionIdentityProvider {
60
60
  getCurrentIdentity: () => EndgeSessionIdentity | null;
@@ -67,7 +67,7 @@ export interface EndgeStorageAdapter {
67
67
  remove: (key: string) => void;
68
68
  }
69
69
  export interface RuntimeStateDocument {
70
- version: 1;
70
+ version: 2;
71
71
  scope: EndgePersistenceScope;
72
72
  runtimeId: string;
73
73
  state: Record<string, Record<string, unknown>>;