@alneas/eaos-server 0.0.0-stage → 0.2.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.
- package/CHANGELOG.md +41 -0
- package/LICENSE +21 -0
- package/README.ja.md +49 -0
- package/README.md +46 -2
- package/dist/agentic/agent-jobs.d.ts +333 -0
- package/dist/agentic/agent-jobs.js +15 -0
- package/dist/agentic/agent-jobs.js.map +1 -0
- package/dist/agentic/agent-node.d.ts +40 -0
- package/dist/agentic/agent-node.js +7 -0
- package/dist/agentic/agent-node.js.map +1 -0
- package/dist/agentic/agent-runner.d.ts +33 -0
- package/dist/agentic/agent-runner.js +7 -0
- package/dist/agentic/agent-runner.js.map +1 -0
- package/dist/agentic/ai-broker.d.ts +169 -0
- package/dist/agentic/ai-broker.js +8 -0
- package/dist/agentic/ai-broker.js.map +1 -0
- package/dist/agentic/atomic-checkpointer.d.ts +137 -0
- package/dist/agentic/atomic-checkpointer.js +9 -0
- package/dist/agentic/atomic-checkpointer.js.map +1 -0
- package/dist/agentic/autonomous-worker.d.ts +122 -0
- package/dist/agentic/autonomous-worker.js +10 -0
- package/dist/agentic/autonomous-worker.js.map +1 -0
- package/dist/agentic/event-bridge.d.ts +350 -0
- package/dist/agentic/event-bridge.js +9 -0
- package/dist/agentic/event-bridge.js.map +1 -0
- package/dist/agentic/executor.d.ts +91 -0
- package/dist/agentic/executor.js +12 -0
- package/dist/agentic/executor.js.map +1 -0
- package/dist/agentic/graph-projection.d.ts +119 -0
- package/dist/agentic/graph-projection.js +7 -0
- package/dist/agentic/graph-projection.js.map +1 -0
- package/dist/agentic/graph.d.ts +524 -0
- package/dist/agentic/graph.js +7 -0
- package/dist/agentic/graph.js.map +1 -0
- package/dist/agentic/index.d.ts +28 -0
- package/dist/agentic/index.js +87 -0
- package/dist/agentic/index.js.map +1 -0
- package/dist/agentic/local-runner.d.ts +106 -0
- package/dist/agentic/local-runner.js +7 -0
- package/dist/agentic/local-runner.js.map +1 -0
- package/dist/agentic/remote-executor.d.ts +67 -0
- package/dist/agentic/remote-executor.js +8 -0
- package/dist/agentic/remote-executor.js.map +1 -0
- package/dist/agentic/types.d.ts +157 -0
- package/dist/agentic/types.js +7 -0
- package/dist/agentic/types.js.map +1 -0
- package/dist/agentic/workflow-catalog.d.ts +152 -0
- package/dist/agentic/workflow-catalog.js +7 -0
- package/dist/agentic/workflow-catalog.js.map +1 -0
- package/dist/agentic/workflow-compiler.d.ts +44 -0
- package/dist/agentic/workflow-compiler.js +8 -0
- package/dist/agentic/workflow-compiler.js.map +1 -0
- package/dist/agentic/workflow-coordinator.d.ts +170 -0
- package/dist/agentic/workflow-coordinator.js +8 -0
- package/dist/agentic/workflow-coordinator.js.map +1 -0
- package/dist/agentic/workflow-manager.d.ts +91 -0
- package/dist/agentic/workflow-manager.js +7 -0
- package/dist/agentic/workflow-manager.js.map +1 -0
- package/dist/agentic/workflow-registry.d.ts +334 -0
- package/dist/agentic/workflow-registry.js +7 -0
- package/dist/agentic/workflow-registry.js.map +1 -0
- package/dist/artifacts-CteHmCMI.d.ts +614 -0
- package/dist/auth-hooks/api-key.d.ts +75 -0
- package/dist/auth-hooks/api-key.js +7 -0
- package/dist/auth-hooks/api-key.js.map +1 -0
- package/dist/auth-hooks/index.d.ts +80 -0
- package/dist/auth-hooks/index.js +28 -0
- package/dist/auth-hooks/index.js.map +1 -0
- package/dist/browser-auth/account-memberships.d.ts +213 -0
- package/dist/browser-auth/account-memberships.js +13 -0
- package/dist/browser-auth/account-memberships.js.map +1 -0
- package/dist/browser-auth/index.d.ts +8 -0
- package/dist/browser-auth/index.js +59 -0
- package/dist/browser-auth/index.js.map +1 -0
- package/dist/browser-auth/kratos-session.d.ts +37 -0
- package/dist/browser-auth/kratos-session.js +7 -0
- package/dist/browser-auth/kratos-session.js.map +1 -0
- package/dist/browser-auth/platform-session.d.ts +120 -0
- package/dist/browser-auth/platform-session.js +7 -0
- package/dist/browser-auth/platform-session.js.map +1 -0
- package/dist/browser-auth/public-memberships.d.ts +22 -0
- package/dist/browser-auth/public-memberships.js +7 -0
- package/dist/browser-auth/public-memberships.js.map +1 -0
- package/dist/cache/index.d.ts +181 -0
- package/dist/cache/index.js +197 -0
- package/dist/cache/index.js.map +1 -0
- package/dist/chunk-32746UQZ.js +131 -0
- package/dist/chunk-32746UQZ.js.map +1 -0
- package/dist/chunk-3NLSWP2Y.js +223 -0
- package/dist/chunk-3NLSWP2Y.js.map +1 -0
- package/dist/chunk-3P4XTTQH.js +346 -0
- package/dist/chunk-3P4XTTQH.js.map +1 -0
- package/dist/chunk-3VITSHN3.js +15 -0
- package/dist/chunk-3VITSHN3.js.map +1 -0
- package/dist/chunk-46UWPEW2.js +226 -0
- package/dist/chunk-46UWPEW2.js.map +1 -0
- package/dist/chunk-4BARRLJR.js +180 -0
- package/dist/chunk-4BARRLJR.js.map +1 -0
- package/dist/chunk-4VORUFKR.js +45 -0
- package/dist/chunk-4VORUFKR.js.map +1 -0
- package/dist/chunk-55D4ERWO.js +1 -0
- package/dist/chunk-55D4ERWO.js.map +1 -0
- package/dist/chunk-5TBBZIND.js +18 -0
- package/dist/chunk-5TBBZIND.js.map +1 -0
- package/dist/chunk-5WOZWPZA.js +211 -0
- package/dist/chunk-5WOZWPZA.js.map +1 -0
- package/dist/chunk-6CBVZ6CT.js +168 -0
- package/dist/chunk-6CBVZ6CT.js.map +1 -0
- package/dist/chunk-6XZXYNJR.js +74 -0
- package/dist/chunk-6XZXYNJR.js.map +1 -0
- package/dist/chunk-753HWDSC.js +222 -0
- package/dist/chunk-753HWDSC.js.map +1 -0
- package/dist/chunk-7AHSS7SO.js +81 -0
- package/dist/chunk-7AHSS7SO.js.map +1 -0
- package/dist/chunk-7FTJN4SA.js +1 -0
- package/dist/chunk-7FTJN4SA.js.map +1 -0
- package/dist/chunk-AVDMLTPF.js +24 -0
- package/dist/chunk-AVDMLTPF.js.map +1 -0
- package/dist/chunk-BKAHUEIT.js +95 -0
- package/dist/chunk-BKAHUEIT.js.map +1 -0
- package/dist/chunk-CJ7OFEF7.js +134 -0
- package/dist/chunk-CJ7OFEF7.js.map +1 -0
- package/dist/chunk-EJKWDZIU.js +111 -0
- package/dist/chunk-EJKWDZIU.js.map +1 -0
- package/dist/chunk-F2J6IQ6I.js +247 -0
- package/dist/chunk-F2J6IQ6I.js.map +1 -0
- package/dist/chunk-F3O7CELI.js +23 -0
- package/dist/chunk-F3O7CELI.js.map +1 -0
- package/dist/chunk-F4IITPGX.js +221 -0
- package/dist/chunk-F4IITPGX.js.map +1 -0
- package/dist/chunk-FD6VC2NA.js +66 -0
- package/dist/chunk-FD6VC2NA.js.map +1 -0
- package/dist/chunk-FRRRWAHO.js +14 -0
- package/dist/chunk-FRRRWAHO.js.map +1 -0
- package/dist/chunk-HCKAGLLB.js +17 -0
- package/dist/chunk-HCKAGLLB.js.map +1 -0
- package/dist/chunk-HVC7FG6B.js +191 -0
- package/dist/chunk-HVC7FG6B.js.map +1 -0
- package/dist/chunk-HXFVOR7Z.js +496 -0
- package/dist/chunk-HXFVOR7Z.js.map +1 -0
- package/dist/chunk-IJWYS2PF.js +122 -0
- package/dist/chunk-IJWYS2PF.js.map +1 -0
- package/dist/chunk-INCHXAFK.js +1395 -0
- package/dist/chunk-INCHXAFK.js.map +1 -0
- package/dist/chunk-JT6BRGQM.js +1 -0
- package/dist/chunk-JT6BRGQM.js.map +1 -0
- package/dist/chunk-L6PMAEMB.js +115 -0
- package/dist/chunk-L6PMAEMB.js.map +1 -0
- package/dist/chunk-LOUGW6MU.js +126 -0
- package/dist/chunk-LOUGW6MU.js.map +1 -0
- package/dist/chunk-LYPZPE53.js +129 -0
- package/dist/chunk-LYPZPE53.js.map +1 -0
- package/dist/chunk-NNCCN7JP.js +186 -0
- package/dist/chunk-NNCCN7JP.js.map +1 -0
- package/dist/chunk-PBC3MZUL.js +212 -0
- package/dist/chunk-PBC3MZUL.js.map +1 -0
- package/dist/chunk-R4ADP2DC.js +20 -0
- package/dist/chunk-R4ADP2DC.js.map +1 -0
- package/dist/chunk-RHN4Y6VS.js +44 -0
- package/dist/chunk-RHN4Y6VS.js.map +1 -0
- package/dist/chunk-SDJNYPYK.js +770 -0
- package/dist/chunk-SDJNYPYK.js.map +1 -0
- package/dist/chunk-UGNTCOVR.js +28 -0
- package/dist/chunk-UGNTCOVR.js.map +1 -0
- package/dist/chunk-VC2PCK2S.js +31 -0
- package/dist/chunk-VC2PCK2S.js.map +1 -0
- package/dist/chunk-VF5YDZJC.js +305 -0
- package/dist/chunk-VF5YDZJC.js.map +1 -0
- package/dist/chunk-VISRDVTK.js +675 -0
- package/dist/chunk-VISRDVTK.js.map +1 -0
- package/dist/chunk-W6O3LVBY.js +102 -0
- package/dist/chunk-W6O3LVBY.js.map +1 -0
- package/dist/chunk-WFEAKJLR.js +47 -0
- package/dist/chunk-WFEAKJLR.js.map +1 -0
- package/dist/chunk-XIEY2OF4.js +67 -0
- package/dist/chunk-XIEY2OF4.js.map +1 -0
- package/dist/chunk-XITLHDG3.js +37 -0
- package/dist/chunk-XITLHDG3.js.map +1 -0
- package/dist/chunk-XMWPYZWZ.js +61 -0
- package/dist/chunk-XMWPYZWZ.js.map +1 -0
- package/dist/chunk-XUP6CNOM.js +34 -0
- package/dist/chunk-XUP6CNOM.js.map +1 -0
- package/dist/chunk-YABTQZDJ.js +25 -0
- package/dist/chunk-YABTQZDJ.js.map +1 -0
- package/dist/chunk-YMHVRBUU.js +199 -0
- package/dist/chunk-YMHVRBUU.js.map +1 -0
- package/dist/chunk-YMJ7BRKU.js +510 -0
- package/dist/chunk-YMJ7BRKU.js.map +1 -0
- package/dist/chunk-ZC3XWU7B.js +28 -0
- package/dist/chunk-ZC3XWU7B.js.map +1 -0
- package/dist/chunk-ZHMTD5KV.js +90 -0
- package/dist/chunk-ZHMTD5KV.js.map +1 -0
- package/dist/chunk-ZWZDLOE7.js +160 -0
- package/dist/chunk-ZWZDLOE7.js.map +1 -0
- package/dist/db-package/db/local-first-sqlite-adapter.d.ts +432 -0
- package/dist/db-package/db/local-first-sqlite-adapter.js +7 -0
- package/dist/db-package/db/local-first-sqlite-adapter.js.map +1 -0
- package/dist/db-package/index.d.ts +7 -0
- package/dist/db-package/index.js +16 -0
- package/dist/db-package/index.js.map +1 -0
- package/dist/db-package/migration/aggregator.d.ts +86 -0
- package/dist/db-package/migration/aggregator.js +7 -0
- package/dist/db-package/migration/aggregator.js.map +1 -0
- package/dist/db-package/migration/index.d.ts +3 -0
- package/dist/db-package/migration/index.js +8 -0
- package/dist/db-package/migration/index.js.map +1 -0
- package/dist/engine.d.ts +205 -0
- package/dist/engine.js +20 -0
- package/dist/engine.js.map +1 -0
- package/dist/entitlements/index.d.ts +313 -0
- package/dist/entitlements/index.js +23 -0
- package/dist/entitlements/index.js.map +1 -0
- package/dist/execution/chat.d.ts +7 -0
- package/dist/execution/chat.js +7 -0
- package/dist/execution/chat.js.map +1 -0
- package/dist/execution/index.d.ts +342 -0
- package/dist/execution/index.js +66 -0
- package/dist/execution/index.js.map +1 -0
- package/dist/execution/tool-agent.d.ts +7 -0
- package/dist/execution/tool-agent.js +8 -0
- package/dist/execution/tool-agent.js.map +1 -0
- package/dist/extensions/index.d.ts +172 -0
- package/dist/extensions/index.js +95 -0
- package/dist/extensions/index.js.map +1 -0
- package/dist/health/index.d.ts +35 -0
- package/dist/health/index.js +7 -0
- package/dist/health/index.js.map +1 -0
- package/dist/index.d.ts +43 -0
- package/dist/index.js +161 -0
- package/dist/index.js.map +1 -0
- package/dist/lifecycle/index.d.ts +133 -0
- package/dist/lifecycle/index.js +13 -0
- package/dist/lifecycle/index.js.map +1 -0
- package/dist/lifecycle-engine/backend-migration.d.ts +2 -0
- package/dist/lifecycle-engine/backend-migration.js +11 -0
- package/dist/lifecycle-engine/backend-migration.js.map +1 -0
- package/dist/lifecycle-engine/baseline.d.ts +2 -0
- package/dist/lifecycle-engine/baseline.js +9 -0
- package/dist/lifecycle-engine/baseline.js.map +1 -0
- package/dist/lifecycle-engine/index.d.ts +1497 -0
- package/dist/lifecycle-engine/index.js +41 -0
- package/dist/lifecycle-engine/index.js.map +1 -0
- package/dist/lifecycle-engine/platform/artifacts.d.ts +4 -0
- package/dist/lifecycle-engine/platform/artifacts.js +7 -0
- package/dist/lifecycle-engine/platform/artifacts.js.map +1 -0
- package/dist/lifecycle-engine/platform/control-plane.d.ts +12 -0
- package/dist/lifecycle-engine/platform/control-plane.js +2 -0
- package/dist/lifecycle-engine/platform/control-plane.js.map +1 -0
- package/dist/lifecycle-engine/platform/database-router.d.ts +118 -0
- package/dist/lifecycle-engine/platform/database-router.js +7 -0
- package/dist/lifecycle-engine/platform/database-router.js.map +1 -0
- package/dist/lifecycle-engine/platform/deployment-placements.d.ts +464 -0
- package/dist/lifecycle-engine/platform/deployment-placements.js +16 -0
- package/dist/lifecycle-engine/platform/deployment-placements.js.map +1 -0
- package/dist/lifecycle-engine/platform/deployment.d.ts +4 -0
- package/dist/lifecycle-engine/platform/deployment.js +17 -0
- package/dist/lifecycle-engine/platform/deployment.js.map +1 -0
- package/dist/lifecycle-engine/platform/index.d.ts +737 -0
- package/dist/lifecycle-engine/platform/index.js +60 -0
- package/dist/lifecycle-engine/platform/index.js.map +1 -0
- package/dist/lifecycle-engine/platform/runtime.d.ts +80 -0
- package/dist/lifecycle-engine/platform/runtime.js +11 -0
- package/dist/lifecycle-engine/platform/runtime.js.map +1 -0
- package/dist/lifecycle-engine/platform/site-publication.d.ts +102 -0
- package/dist/lifecycle-engine/platform/site-publication.js +7 -0
- package/dist/lifecycle-engine/platform/site-publication.js.map +1 -0
- package/dist/lifecycle-engine/platform/user-directory.d.ts +139 -0
- package/dist/lifecycle-engine/platform/user-directory.js +13 -0
- package/dist/lifecycle-engine/platform/user-directory.js.map +1 -0
- package/dist/mcp.d.ts +92 -0
- package/dist/mcp.js +10 -0
- package/dist/mcp.js.map +1 -0
- package/dist/middleware/auth.d.ts +118 -0
- package/dist/middleware/auth.js +7 -0
- package/dist/middleware/auth.js.map +1 -0
- package/dist/middleware/error-handler.d.ts +35 -0
- package/dist/middleware/error-handler.js +7 -0
- package/dist/middleware/error-handler.js.map +1 -0
- package/dist/middleware/module-guard.d.ts +33 -0
- package/dist/middleware/module-guard.js +7 -0
- package/dist/middleware/module-guard.js.map +1 -0
- package/dist/platform-admin/index.d.ts +37 -0
- package/dist/platform-admin/index.js +11 -0
- package/dist/platform-admin/index.js.map +1 -0
- package/dist/platform-admin/store.d.ts +346 -0
- package/dist/platform-admin/store.js +7 -0
- package/dist/platform-admin/store.js.map +1 -0
- package/dist/plugin-data/annotations.d.ts +6 -0
- package/dist/plugin-data/annotations.js +12 -0
- package/dist/plugin-data/annotations.js.map +1 -0
- package/dist/plugin-data/atomic-context.d.ts +41 -0
- package/dist/plugin-data/atomic-context.js +9 -0
- package/dist/plugin-data/atomic-context.js.map +1 -0
- package/dist/plugin-data/atomic.d.ts +6 -0
- package/dist/plugin-data/atomic.js +26 -0
- package/dist/plugin-data/atomic.js.map +1 -0
- package/dist/plugin-data/audit.d.ts +6 -0
- package/dist/plugin-data/audit.js +12 -0
- package/dist/plugin-data/audit.js.map +1 -0
- package/dist/plugin-data/commands.d.ts +6 -0
- package/dist/plugin-data/commands.js +8 -0
- package/dist/plugin-data/commands.js.map +1 -0
- package/dist/plugin-data/composite.d.ts +6 -0
- package/dist/plugin-data/composite.js +8 -0
- package/dist/plugin-data/composite.js.map +1 -0
- package/dist/plugin-data/delivery.d.ts +6 -0
- package/dist/plugin-data/delivery.js +16 -0
- package/dist/plugin-data/delivery.js.map +1 -0
- package/dist/plugin-data/index.d.ts +2798 -0
- package/dist/plugin-data/index.js +102 -0
- package/dist/plugin-data/index.js.map +1 -0
- package/dist/plugin-data/json-documents.d.ts +6 -0
- package/dist/plugin-data/json-documents.js +16 -0
- package/dist/plugin-data/json-documents.js.map +1 -0
- package/dist/plugin-data/outbox.d.ts +6 -0
- package/dist/plugin-data/outbox.js +16 -0
- package/dist/plugin-data/outbox.js.map +1 -0
- package/dist/plugin-data/scoped-records.d.ts +6 -0
- package/dist/plugin-data/scoped-records.js +10 -0
- package/dist/plugin-data/scoped-records.js.map +1 -0
- package/dist/plugin-sdk.d.ts +41 -0
- package/dist/plugin-sdk.js +10 -0
- package/dist/plugin-sdk.js.map +1 -0
- package/dist/sql-lifecycle/index.d.ts +138 -0
- package/dist/sql-lifecycle/index.js +167 -0
- package/dist/sql-lifecycle/index.js.map +1 -0
- package/dist/storage/index.d.ts +2 -0
- package/dist/storage/index.js +13 -0
- package/dist/storage/index.js.map +1 -0
- package/dist/storage/s3-compatible.d.ts +139 -0
- package/dist/storage/s3-compatible.js +11 -0
- package/dist/storage/s3-compatible.js.map +1 -0
- package/dist/tenant.d.ts +108 -0
- package/dist/tenant.js +9 -0
- package/dist/tenant.js.map +1 -0
- package/dist/workspace-context.d.ts +119 -0
- package/dist/workspace-context.js +9 -0
- package/dist/workspace-context.js.map +1 -0
- package/docs/api.md +30560 -0
- package/docs/db/README.md +49 -0
- package/docs/db/docs/api.md +1613 -0
- package/docs/db/docs/guide.md +47 -0
- package/docs/entitlements.md +60 -0
- package/docs/guide.md +92 -0
- package/docs/index.md +57 -0
- package/docs/ja/db/README.md +46 -0
- package/docs/ja/db/docs/guide.md +53 -0
- package/docs/ja/guide.md +46 -0
- package/docs/ja/lifecycle/README.md +46 -0
- package/docs/ja/lifecycle/docs/guide.md +45 -0
- package/docs/ja/storage/README.md +46 -0
- package/docs/ja/storage/docs/guide.md +43 -0
- package/docs/lifecycle/README.md +49 -0
- package/docs/lifecycle/docs/api.md +3770 -0
- package/docs/lifecycle/docs/baseline.md +50 -0
- package/docs/lifecycle/docs/guide.md +47 -0
- package/docs/storage/README.md +49 -0
- package/docs/storage/docs/api.md +470 -0
- package/docs/storage/docs/guide.md +47 -0
- package/package.json +354 -4
package/dist/engine.d.ts
ADDED
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
import * as _alneas_eaos_core from '@alneas/eaos-core';
|
|
2
|
+
import { PluginManifest, EaosEnv, PluginRegistry, McpGatekeeper } from '@alneas/eaos-core';
|
|
3
|
+
import { LifecycleRuntime } from './lifecycle/index.js';
|
|
4
|
+
import { McpRouterOptions } from './mcp.js';
|
|
5
|
+
import { Hono } from 'hono';
|
|
6
|
+
import { AuthSessionVerifier } from './middleware/auth.js';
|
|
7
|
+
import { HealthRouterOptions } from './health/index.js';
|
|
8
|
+
import { PluginEntitlementRuntime, EntitlementPrincipalResolver } from './entitlements/index.js';
|
|
9
|
+
import '@alneas/eaos-server/lifecycle-engine';
|
|
10
|
+
import 'hono/types';
|
|
11
|
+
import './plugin-data/index.js';
|
|
12
|
+
import '@alneas/eaos-core/plugin-sdk';
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Engine composition settings retained by {@link ErpEngine}; host adapters own authentication and persistence.
|
|
16
|
+
*/
|
|
17
|
+
interface EaosConfig {
|
|
18
|
+
/** Nonblank application label used by public health responses. */
|
|
19
|
+
appName: string;
|
|
20
|
+
/** Trusted plugin manifests registered sequentially during initialize. */
|
|
21
|
+
plugins: PluginManifest[];
|
|
22
|
+
/** Optional host UI theme metadata retained in config; the server engine does not apply it. */
|
|
23
|
+
theme?: {
|
|
24
|
+
/** Optional host UI accent color; not interpreted by this engine. */
|
|
25
|
+
primaryColor?: string;
|
|
26
|
+
/** Optional host UI logo URL; not fetched by this engine. */
|
|
27
|
+
logoUrl?: string;
|
|
28
|
+
};
|
|
29
|
+
/** Optional host driver metadata retained in config; this engine does not create a database connection. */
|
|
30
|
+
database?: {
|
|
31
|
+
/** Selected host database dialect; does not create or migrate a connection. */
|
|
32
|
+
driver: 'oracle' | 'supabase' | 'postgres';
|
|
33
|
+
};
|
|
34
|
+
/** Optional exact browser allowOrigins list; empty/absent disables CORS middleware. */
|
|
35
|
+
cors?: {
|
|
36
|
+
/** Exact allowed browser origins; credentials are enabled for configured CORS. */
|
|
37
|
+
allowOrigins: string[];
|
|
38
|
+
};
|
|
39
|
+
/** Optional verifier and skipped path prefixes; see AuthMiddlewareOptions. */
|
|
40
|
+
auth?: {
|
|
41
|
+
/** Optional verified session/API-key adapter; omission installs no authentication. */
|
|
42
|
+
verifier?: AuthSessionVerifier;
|
|
43
|
+
/** Authentication-exempt path prefixes; defaults follow createAuthMiddleware. */
|
|
44
|
+
skipPaths?: string[];
|
|
45
|
+
};
|
|
46
|
+
/** Validate each manifest's declared secrets unless exactly false. Defaults to true. */
|
|
47
|
+
validateSecrets?: boolean;
|
|
48
|
+
/** Host composition callbacks invoked synchronously after shared authentication and before plugin route guards; each receives the app and returns no value. */
|
|
49
|
+
middleware?: Array<(app: Hono<EaosEnv>) => void>;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Returns an engine configuration unchanged while checking its TypeScript shape.
|
|
53
|
+
* @param config - Configuration to retain; no runtime validation or cloning occurs.
|
|
54
|
+
* @returns The same object reference.
|
|
55
|
+
* @example
|
|
56
|
+
* ```typescript
|
|
57
|
+
* import { defineConfig } from "@alneas/eaos-server/engine";
|
|
58
|
+
* const config = defineConfig({ appName: "example-service", plugins: [] });
|
|
59
|
+
* console.log(config.appName);
|
|
60
|
+
* ```
|
|
61
|
+
*/
|
|
62
|
+
declare function defineConfig(config: EaosConfig): EaosConfig;
|
|
63
|
+
/**
|
|
64
|
+
* Per-application host authorization, route, and health adapters for {@link ErpEngine.createApp}.
|
|
65
|
+
*/
|
|
66
|
+
interface CreateAppOptions {
|
|
67
|
+
/** Optional shared runtime for declared commercial/usage entitlement admission. */
|
|
68
|
+
entitlements?: PluginEntitlementRuntime;
|
|
69
|
+
/** Optional verified principal resolver; defaults to resolveEngineEntitlementPrincipal. */
|
|
70
|
+
resolveEntitlementPrincipal?: EntitlementPrincipalResolver;
|
|
71
|
+
/** Optional current lifecycle/tenant/backend admission for plugin routes and MCP tools. */
|
|
72
|
+
lifecycle?: LifecycleRuntime;
|
|
73
|
+
/** Optional module middleware factory called at composition for each plugin/extension requirement; defaults to createModuleGuard. */
|
|
74
|
+
requireModule?: (moduleId: string) => any;
|
|
75
|
+
/** Optional authentication verifier overriding config.auth.verifier. */
|
|
76
|
+
verifier?: AuthSessionVerifier;
|
|
77
|
+
/** Install module guards unless exactly false. Defaults to true. */
|
|
78
|
+
enableModuleGuard?: boolean;
|
|
79
|
+
/** Per-plugin dependencies passed to the route factory. */
|
|
80
|
+
pluginOptions?: Record<string, unknown>;
|
|
81
|
+
/** Optional MCP adapter configuration; prefix defaults to /api/mcp and shared entitlements take precedence. */
|
|
82
|
+
mcp?: McpRouterOptions & {
|
|
83
|
+
/**
|
|
84
|
+
* Optional mount path for the shared MCP router; defaults to /api/mcp when the engine composes routes.
|
|
85
|
+
*/
|
|
86
|
+
prefix?: string;
|
|
87
|
+
};
|
|
88
|
+
/** Additional host routers mounted after plugin/MCP routes; no plugin-specific guard is automatically added. */
|
|
89
|
+
customRoutes?: Array<{
|
|
90
|
+
/** Host-selected mount prefix passed directly to Hono route composition; this entry receives no automatic plugin/module-specific guard. */
|
|
91
|
+
prefix: string;
|
|
92
|
+
/** Trusted Hono child router; host composition must install its route-specific authorization before exposing handlers. */
|
|
93
|
+
router: Hono<any>;
|
|
94
|
+
}>;
|
|
95
|
+
/** Optional dependency readiness checks and clock; engine appName is supplied automatically. */
|
|
96
|
+
health?: Omit<HealthRouterOptions, 'appName'>;
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Registers plugin manifests and composes Hono routes with host authentication, entitlement, and lifecycle adapters.
|
|
100
|
+
* @remarks Constructing the engine creates no HTTP listener or persistent store. Initialize once before composing apps. Configuration is retained by reference. Authentication is installed only when a verifier is supplied; custom routes need their own authorization policies beyond the shared middleware.
|
|
101
|
+
* @example
|
|
102
|
+
* ```typescript
|
|
103
|
+
* import { createErpEngine } from "@alneas/eaos-server/engine";
|
|
104
|
+
* const engine = createErpEngine({ appName: "example-service", plugins: [] });
|
|
105
|
+
* await engine.initialize();
|
|
106
|
+
* const app = engine.createApp();
|
|
107
|
+
* console.log((await app.request("/health/live")).status); // 200
|
|
108
|
+
* ```
|
|
109
|
+
*/
|
|
110
|
+
declare class ErpEngine {
|
|
111
|
+
/** Public plugin registry populated during initialize; external mutation affects subsequently composed apps. */
|
|
112
|
+
readonly registry: PluginRegistry;
|
|
113
|
+
/** Shared MCP policy registry populated from plugin manifests during initialize. */
|
|
114
|
+
readonly gatekeeper: McpGatekeeper;
|
|
115
|
+
private initialized;
|
|
116
|
+
private config;
|
|
117
|
+
/**
|
|
118
|
+
* Retains host composition configuration for registration and future app creation.
|
|
119
|
+
* @param config - App label, plugin manifests, and optional host composition settings.
|
|
120
|
+
*/
|
|
121
|
+
constructor(config: EaosConfig);
|
|
122
|
+
/**
|
|
123
|
+
* Registers manifests and gatekeeper policies and validates declared plugin secrets by default.
|
|
124
|
+
* @returns No value; resolves after registration and validation, or immediately after a prior successful initialization.
|
|
125
|
+
* @throws Rejects duplicate plugin IDs, registry failures, or secret validation failures.
|
|
126
|
+
* @remarks Registration occurs before secret validation, so failure can leave partial registry state. Concurrent initialization is not serialized and retrying a failed initialization may encounter already-registered IDs. Create a new engine after correcting failed setup. No migrations or plugin activation are performed.
|
|
127
|
+
* @example
|
|
128
|
+
* ```typescript
|
|
129
|
+
* import { createErpEngine } from "@alneas/eaos-server/engine";
|
|
130
|
+
* const engine = createErpEngine({ appName: "example-service", plugins: [] });
|
|
131
|
+
* await engine.initialize();
|
|
132
|
+
* console.log(engine.getRegisteredPlugins().length); // 0
|
|
133
|
+
* ```
|
|
134
|
+
*/
|
|
135
|
+
initialize(): Promise<void>;
|
|
136
|
+
/**
|
|
137
|
+
* Composes registered plugin routes, shared middleware, optional MCP/custom routes, and public health endpoints.
|
|
138
|
+
* @param options - Live host adapters and route settings; see {@link CreateAppOptions}.
|
|
139
|
+
* @returns A new Hono app sharing this engine registry, gatekeeper, and configured adapters; it does not start a server.
|
|
140
|
+
* @throws Before initialization, or for synchronous middleware, plugin route factory, or health setup failures. Request-time adapter errors pass through the app error handler.
|
|
141
|
+
* @remarks Module guarding defaults on. Lifecycle enforcement is installed only when supplied, while declared plugin entitlements require their corresponding runtime checks. CORS uses configured origins with credentials enabled; unknown origins receive the first configured allow-origin value. Repeated calls create separate routers but may reuse host dependencies.
|
|
142
|
+
* @example
|
|
143
|
+
* ```typescript
|
|
144
|
+
* import { createErpEngine } from "@alneas/eaos-server/engine";
|
|
145
|
+
* const engine = createErpEngine({ appName: "example-service", plugins: [] });
|
|
146
|
+
* await engine.initialize();
|
|
147
|
+
* const app = engine.createApp();
|
|
148
|
+
* console.log((await app.request("/health/live")).status);
|
|
149
|
+
* ```
|
|
150
|
+
*/
|
|
151
|
+
createApp(options?: CreateAppOptions): Hono<EaosEnv>;
|
|
152
|
+
/**
|
|
153
|
+
* Reads the manifests currently registered in this engine.
|
|
154
|
+
* @returns Registry manifest list, empty before registration or with no configured plugins; objects are not deep-cloned by this method.
|
|
155
|
+
* @example
|
|
156
|
+
* ```typescript
|
|
157
|
+
* import { createErpEngine } from "@alneas/eaos-server/engine";
|
|
158
|
+
* const engine = createErpEngine({ appName: "example-service", plugins: [] });
|
|
159
|
+
* await engine.initialize();
|
|
160
|
+
* console.log(engine.getRegisteredPlugins()); // []
|
|
161
|
+
* ```
|
|
162
|
+
*/
|
|
163
|
+
getRegisteredPlugins(): PluginManifest[];
|
|
164
|
+
/**
|
|
165
|
+
* Collects MCP tool definitions from all currently registered manifests.
|
|
166
|
+
* @returns Registry tool definitions, or an empty array when none exist; this list is not filtered for a request principal or tenant.
|
|
167
|
+
* @example
|
|
168
|
+
* ```typescript
|
|
169
|
+
* import { createErpEngine } from "@alneas/eaos-server/engine";
|
|
170
|
+
* const engine = createErpEngine({ appName: "example-service", plugins: [] });
|
|
171
|
+
* await engine.initialize();
|
|
172
|
+
* console.log(engine.getAllMcpTools()); // []
|
|
173
|
+
* ```
|
|
174
|
+
*/
|
|
175
|
+
getAllMcpTools(): _alneas_eaos_core.McpToolDefinition[];
|
|
176
|
+
/**
|
|
177
|
+
* Reads the host configuration retained at construction.
|
|
178
|
+
* @returns The original mutable configuration object; no cloning occurs.
|
|
179
|
+
* @example
|
|
180
|
+
* ```typescript
|
|
181
|
+
* import { createErpEngine } from "@alneas/eaos-server/engine";
|
|
182
|
+
* const engine = createErpEngine({ appName: "example-service", plugins: [] });
|
|
183
|
+
* await engine.initialize();
|
|
184
|
+
* console.log(engine.getConfig().appName);
|
|
185
|
+
* ```
|
|
186
|
+
*/
|
|
187
|
+
getConfig(): EaosConfig;
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* Creates an uninitialized engine retaining the supplied host configuration.
|
|
191
|
+
* @param config - Engine composition settings; see {@link EaosConfig}.
|
|
192
|
+
* @returns A new engine; await initialize before createApp.
|
|
193
|
+
* @example
|
|
194
|
+
* ```typescript
|
|
195
|
+
* import { createErpEngine } from "@alneas/eaos-server/engine";
|
|
196
|
+
* const engine = createErpEngine({ appName: "example-service", plugins: [] });
|
|
197
|
+
* await engine.initialize();
|
|
198
|
+
* const app = engine.createApp();
|
|
199
|
+
* console.log((await app.request("/health/live")).status);
|
|
200
|
+
* ```
|
|
201
|
+
*/
|
|
202
|
+
declare function createErpEngine(config: EaosConfig): ErpEngine;
|
|
203
|
+
|
|
204
|
+
export { ErpEngine, createErpEngine, defineConfig };
|
|
205
|
+
export type { CreateAppOptions, EaosConfig };
|
package/dist/engine.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ErpEngine,
|
|
3
|
+
createErpEngine,
|
|
4
|
+
defineConfig
|
|
5
|
+
} from "./chunk-F4IITPGX.js";
|
|
6
|
+
import "./chunk-L6PMAEMB.js";
|
|
7
|
+
import "./chunk-XIEY2OF4.js";
|
|
8
|
+
import "./chunk-AVDMLTPF.js";
|
|
9
|
+
import "./chunk-VC2PCK2S.js";
|
|
10
|
+
import "./chunk-R4ADP2DC.js";
|
|
11
|
+
import "./chunk-VF5YDZJC.js";
|
|
12
|
+
import "./chunk-46UWPEW2.js";
|
|
13
|
+
import "./chunk-INCHXAFK.js";
|
|
14
|
+
import "./chunk-3VITSHN3.js";
|
|
15
|
+
export {
|
|
16
|
+
ErpEngine,
|
|
17
|
+
createErpEngine,
|
|
18
|
+
defineConfig
|
|
19
|
+
};
|
|
20
|
+
//# sourceMappingURL=engine.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1,313 @@
|
|
|
1
|
+
import * as hono_types from 'hono/types';
|
|
2
|
+
import * as hono from 'hono';
|
|
3
|
+
import { Context, Hono } from 'hono';
|
|
4
|
+
import { TenantEntitlements, PlatformPrincipal, PluginEntitlement, EntitlementDecision } from '@alneas/eaos-core';
|
|
5
|
+
import { AtomicRepository, AtomicSession } from '../plugin-data/index.js';
|
|
6
|
+
import { Dialect, DataContract } from '@alneas/eaos-server/lifecycle-engine';
|
|
7
|
+
import '@alneas/eaos-core/plugin-sdk';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Declares reviewed control-plane storage for tenant subscription/addon/quota state across supported SQL dialects.
|
|
11
|
+
* @remarks Hosts install this contract through reviewed lifecycle operations; importing the constant performs no migration.
|
|
12
|
+
* @see createSqlTenantEntitlementLoader for the reader usage example.
|
|
13
|
+
*/
|
|
14
|
+
declare const tenantEntitlementContract: DataContract;
|
|
15
|
+
/**
|
|
16
|
+
* Builds a parameterized tenant entitlement reader for the reviewed control-plane table.
|
|
17
|
+
* @param driver - Host SQL dialect and execute callback; execute receives SQL and one tenant binding and resolves optional rows. Credentials and connection lifecycle remain host-owned.
|
|
18
|
+
* @returns An async loader accepting a verified 1–128-character tenant ID (letters/digits/underscore/dot/hyphen, starting alphanumeric) and resolving validated entitlements or null when no row exists.
|
|
19
|
+
* @throws Loader calls reject invalid tenant IDs, multiple rows, malformed JSON/contracts, tenant mismatch, and propagated SQL errors.
|
|
20
|
+
* @remarks Row keys are normalized to lowercase; JSON columns may be strings or already parsed values. No row-level authorization or shared transaction is established by this factory.
|
|
21
|
+
* @example
|
|
22
|
+
* ```typescript
|
|
23
|
+
* import { createSqlTenantEntitlementLoader } from "@alneas/eaos-server/entitlements";
|
|
24
|
+
* export function entitlementLoader(driver: Parameters<typeof createSqlTenantEntitlementLoader>[0]) {
|
|
25
|
+
* return createSqlTenantEntitlementLoader(driver);
|
|
26
|
+
* }
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
declare function createSqlTenantEntitlementLoader(driver: {
|
|
30
|
+
/**
|
|
31
|
+
* SQL placeholder dialect: Oracle uses :1, PostgreSQL $1, and SQLite ? for the tenant binding.
|
|
32
|
+
*/
|
|
33
|
+
dialect: Dialect;
|
|
34
|
+
/**
|
|
35
|
+
* Executes the loader's parameterized tenant SELECT through the trusted host connection.
|
|
36
|
+
* @param sql - SQL supplied by the loader with one dialect-correct tenant placeholder.
|
|
37
|
+
* @param bindings - One verified tenant ID in placeholder order.
|
|
38
|
+
* @returns Optional result rows; no rows resolves to null at the loader boundary.
|
|
39
|
+
* @throws Host query errors reject the entitlement lookup.
|
|
40
|
+
* @example
|
|
41
|
+
* ```typescript
|
|
42
|
+
* import { createSqlTenantEntitlementLoader } from '@alneas/eaos-server/entitlements';
|
|
43
|
+
* export async function loadContract(driver: Parameters<typeof createSqlTenantEntitlementLoader>[0], verifiedTenantId: string) {
|
|
44
|
+
* // The host supplies the reviewed schema and privileged read connection.
|
|
45
|
+
* return createSqlTenantEntitlementLoader(driver)(verifiedTenantId);
|
|
46
|
+
* }
|
|
47
|
+
* ```
|
|
48
|
+
*/
|
|
49
|
+
execute(sql: string, bindings: unknown[]): Promise<{
|
|
50
|
+
/**
|
|
51
|
+
* Optional result rows; missing rows is treated as an empty result, while more than one row rejects as ambiguous.
|
|
52
|
+
*/
|
|
53
|
+
rows?: Record<string, unknown>[];
|
|
54
|
+
}>;
|
|
55
|
+
}): (tenantId: string) => Promise<TenantEntitlements | null>;
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Carries a denied entitlement decision for HTTP or host failure handling.
|
|
59
|
+
* @example
|
|
60
|
+
* ```typescript
|
|
61
|
+
* import { EntitlementError } from "@alneas/eaos-server/entitlements";
|
|
62
|
+
* const error = new EntitlementError({ allowed: false, status: 402, reason: "quota-exceeded" });
|
|
63
|
+
* console.log(error.decision.status);
|
|
64
|
+
* ```
|
|
65
|
+
*/
|
|
66
|
+
declare class EntitlementError extends Error {
|
|
67
|
+
readonly decision: Exclude<EntitlementDecision, {
|
|
68
|
+
/** Type-level allowed-branch discriminator removed by Exclude; this constructor accepts only denied decisions with allowed false. */
|
|
69
|
+
allowed: true;
|
|
70
|
+
}>;
|
|
71
|
+
/**
|
|
72
|
+
* Creates an error whose message is the denial reason.
|
|
73
|
+
* @param decision - Denied decision retained as a public readonly property for status/reason mapping.
|
|
74
|
+
*/
|
|
75
|
+
constructor(decision: Exclude<EntitlementDecision, {
|
|
76
|
+
/** Type-level allowed-branch discriminator removed by Exclude; this constructor accepts only denied decisions with allowed false. */
|
|
77
|
+
allowed: true;
|
|
78
|
+
}>);
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Trusted control-plane reads, lifecycle policy, and reservation persistence for {@link PluginEntitlementRuntime}.
|
|
82
|
+
*/
|
|
83
|
+
interface EntitlementRuntimeOptions {
|
|
84
|
+
/** Shared durable control-plane repository, with transaction/CAS and tenant isolation. */
|
|
85
|
+
repository: AtomicRepository;
|
|
86
|
+
/** Read current contracts from eaos_tenant_entitlements; never from request headers/body. */
|
|
87
|
+
load: (tenantId: string) => Promise<TenantEntitlements | null>;
|
|
88
|
+
/** Optional joined control-plane read; quota and contract observe the same host transaction. */
|
|
89
|
+
loadInTransaction?: (principal: PlatformPrincipal, session: AtomicSession) => Promise<TenantEntitlements | null>;
|
|
90
|
+
/** Same live lifecycle admission for HTTP, MCP, jobs, webhooks and asset delivery. */
|
|
91
|
+
isActive: (principal: PlatformPrincipal, pluginId: string) => Promise<boolean>;
|
|
92
|
+
/** Clock for validity and UTC monthly metering period; defaults to a fresh Date per read. */
|
|
93
|
+
clock?: () => Date;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Checks live plugin entitlements and durably reserves metered admission attempts.
|
|
97
|
+
* @remarks A durable quota reservation counts admitted attempts, including failed handler attempts. No refund, cancellation, retry, or business-handler transaction is supplied. Shared concurrency/CAS and tenant isolation depend on the host AtomicRepository. For a contract snapshot consistent with reservation writes, supply loadInTransaction.
|
|
98
|
+
* @example
|
|
99
|
+
* ```typescript
|
|
100
|
+
* import { PluginEntitlementRuntime, type EntitlementRuntimeOptions } from "@alneas/eaos-server/entitlements";
|
|
101
|
+
* export function entitlementRuntime(options: EntitlementRuntimeOptions) {
|
|
102
|
+
* return new PluginEntitlementRuntime(options);
|
|
103
|
+
* }
|
|
104
|
+
* ```
|
|
105
|
+
*/
|
|
106
|
+
declare class PluginEntitlementRuntime {
|
|
107
|
+
private readonly options;
|
|
108
|
+
/**
|
|
109
|
+
* Retains host control-plane callbacks and repository without opening a connection.
|
|
110
|
+
* @param options - Trusted entitlement persistence, active-plugin checks, and optional clock.
|
|
111
|
+
*/
|
|
112
|
+
constructor(options: EntitlementRuntimeOptions);
|
|
113
|
+
/**
|
|
114
|
+
* Loads and validates current tenant contract data for a verified principal.
|
|
115
|
+
* @param principal - Verified platform principal validated by assertPlatformPrincipal.
|
|
116
|
+
* @param session - Optional active atomic session; loadInTransaction is used only when both are supplied.
|
|
117
|
+
* @returns A structured clone of current entitlements, or null when absent.
|
|
118
|
+
* @throws Rejects invalid principal/contract, mismatched tenant, clone errors, or host load failures.
|
|
119
|
+
* @example
|
|
120
|
+
* ```typescript
|
|
121
|
+
* import { PluginEntitlementRuntime, type EntitlementRuntimeOptions } from "@alneas/eaos-server/entitlements";
|
|
122
|
+
* import type { PlatformPrincipal } from "@alneas/eaos-core";
|
|
123
|
+
* export async function snapshot(options: EntitlementRuntimeOptions, principal: PlatformPrincipal) {
|
|
124
|
+
* return new PluginEntitlementRuntime(options).snapshot(principal);
|
|
125
|
+
* }
|
|
126
|
+
* ```
|
|
127
|
+
*/
|
|
128
|
+
snapshot(principal: PlatformPrincipal, session?: AtomicSession): Promise<TenantEntitlements | null>;
|
|
129
|
+
/**
|
|
130
|
+
* Evaluates lifecycle and subscription policy without consuming quota.
|
|
131
|
+
* @param principal - Verified user/tenant principal.
|
|
132
|
+
* @param pluginId - Exact plugin ID used by lifecycle and entitlement evaluation.
|
|
133
|
+
* @param rule - Plugin access tier, allowed tenants, and optional metering declaration.
|
|
134
|
+
* @param session - Optional reservation transaction for a joined contract read.
|
|
135
|
+
* @returns Allowed/denied decision; inactive lifecycle returns denied 404 tenant-locked. This check does not reserve usage.
|
|
136
|
+
* @throws Rejects invalid data or propagated lifecycle/load/clock errors.
|
|
137
|
+
* @example
|
|
138
|
+
* ```typescript
|
|
139
|
+
* import { PluginEntitlementRuntime, type EntitlementRuntimeOptions } from "@alneas/eaos-server/entitlements";
|
|
140
|
+
* import type { PlatformPrincipal, PluginEntitlement } from "@alneas/eaos-core";
|
|
141
|
+
* export async function check(options: EntitlementRuntimeOptions, principal: PlatformPrincipal, pluginId: string, rule: PluginEntitlement) {
|
|
142
|
+
* return new PluginEntitlementRuntime(options).check(principal, pluginId, rule);
|
|
143
|
+
* }
|
|
144
|
+
* ```
|
|
145
|
+
*/
|
|
146
|
+
check(principal: PlatformPrincipal, pluginId: string, rule: PluginEntitlement, session?: AtomicSession): Promise<EntitlementDecision>;
|
|
147
|
+
/**
|
|
148
|
+
* Rechecks entitlement under the repository transaction and reserves one metered attempt with an audit entry.
|
|
149
|
+
* @param principal - Verified principal used for tenant-scoped repository admission.
|
|
150
|
+
* @param pluginId - Plugin whose live entitlement is required.
|
|
151
|
+
* @param rule - Current plugin entitlement policy; unmetered rules perform no counter write.
|
|
152
|
+
* @param operation - Host operation label recorded in metering audit data.
|
|
153
|
+
* @returns No value; resolves after entitlement admission and any quota/audit persistence.
|
|
154
|
+
* @throws Rejects EntitlementError for denied policy/quota, invalid stored usage counter, or host transaction/load/lifecycle/audit failures.
|
|
155
|
+
* @remarks Counters use a UTC YYYY-MM period and count admitted attempts, not successful work. Calling admit repeatedly consumes repeatedly; no idempotency key is applied.
|
|
156
|
+
* @example
|
|
157
|
+
* ```typescript
|
|
158
|
+
* import { PluginEntitlementRuntime, type EntitlementRuntimeOptions } from "@alneas/eaos-server/entitlements";
|
|
159
|
+
* import type { PlatformPrincipal, PluginEntitlement } from "@alneas/eaos-core";
|
|
160
|
+
* export async function admit(options: EntitlementRuntimeOptions, principal: PlatformPrincipal, pluginId: string, rule: PluginEntitlement) {
|
|
161
|
+
* await new PluginEntitlementRuntime(options).admit(principal, pluginId, rule, "example:execute");
|
|
162
|
+
* }
|
|
163
|
+
* ```
|
|
164
|
+
*/
|
|
165
|
+
admit(principal: PlatformPrincipal, pluginId: string, rule: PluginEntitlement, operation: string): Promise<void>;
|
|
166
|
+
/**
|
|
167
|
+
* Reserves admission before executing host work outside the reservation transaction.
|
|
168
|
+
* @typeParam T - Resolved host work result.
|
|
169
|
+
* @param principal - Verified tenant/user principal.
|
|
170
|
+
* @param pluginId - Required plugin ID.
|
|
171
|
+
* @param rule - Plugin entitlement policy.
|
|
172
|
+
* @param operation - Host operation label for metering audit.
|
|
173
|
+
* @param work - Called without arguments only after admission; resolves the business result.
|
|
174
|
+
* @returns The host work result.
|
|
175
|
+
* @throws Rejects admission or work failures; failed work does not refund a reservation.
|
|
176
|
+
* @example
|
|
177
|
+
* ```typescript
|
|
178
|
+
* import { PluginEntitlementRuntime, type EntitlementRuntimeOptions } from "@alneas/eaos-server/entitlements";
|
|
179
|
+
* import type { PlatformPrincipal, PluginEntitlement } from "@alneas/eaos-core";
|
|
180
|
+
* export async function execute<T>(options: EntitlementRuntimeOptions, principal: PlatformPrincipal, pluginId: string, rule: PluginEntitlement, work: () => Promise<T>) {
|
|
181
|
+
* return new PluginEntitlementRuntime(options).run(principal, pluginId, rule, "example:execute", work);
|
|
182
|
+
* }
|
|
183
|
+
* ```
|
|
184
|
+
*/
|
|
185
|
+
run<T>(principal: PlatformPrincipal, pluginId: string, rule: PluginEntitlement, operation: string, work: () => Promise<T>): Promise<T>;
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* Host callback resolving authenticated user/tenant membership from a request.
|
|
189
|
+
* @param context - Hono request context after host authentication.
|
|
190
|
+
* @returns Verified platform principal, or null to deny authentication.
|
|
191
|
+
* @throws Host failures propagate through request handling.
|
|
192
|
+
* @see createPluginEntitlementGuard for usage.
|
|
193
|
+
*/
|
|
194
|
+
type EntitlementPrincipalResolver = (context: Context) => Promise<PlatformPrincipal | null>;
|
|
195
|
+
/**
|
|
196
|
+
* Resolves the engine context principal only when user.tenantId matches tenantId and userId exists.
|
|
197
|
+
* @param c - Hono context populated exclusively by trusted host authentication middleware.
|
|
198
|
+
* @returns Principal using context IDs and user roles, or null for missing/mismatched identity.
|
|
199
|
+
* @remarks Does not independently query live membership or authenticate headers.
|
|
200
|
+
* @example
|
|
201
|
+
* ```typescript
|
|
202
|
+
* import { Hono } from "hono";
|
|
203
|
+
* import { resolveEngineEntitlementPrincipal } from "@alneas/eaos-server/entitlements";
|
|
204
|
+
* const app = new Hono();
|
|
205
|
+
* app.get("/identity-state", async c => c.json({ authenticated: !!await resolveEngineEntitlementPrincipal(c) }));
|
|
206
|
+
* ```
|
|
207
|
+
*/
|
|
208
|
+
declare const resolveEngineEntitlementPrincipal: EntitlementPrincipalResolver;
|
|
209
|
+
/**
|
|
210
|
+
* Determines whether a plugin rule needs the external entitlement runtime.
|
|
211
|
+
* @param rule - Declared plugin entitlement policy.
|
|
212
|
+
* @returns True for nonpublic tier, any metering, or any allowedTenants property; otherwise false.
|
|
213
|
+
* @remarks Public unmetered rules still require authentication and host lifecycle/resource admission.
|
|
214
|
+
* @example
|
|
215
|
+
* ```typescript
|
|
216
|
+
* import { requiresEntitlementRuntime } from "@alneas/eaos-server/entitlements";
|
|
217
|
+
* import type { PluginEntitlement } from "@alneas/eaos-core";
|
|
218
|
+
* export function needsSubscription(rule: PluginEntitlement) { return requiresEntitlementRuntime(rule); }
|
|
219
|
+
* ```
|
|
220
|
+
*/
|
|
221
|
+
declare function requiresEntitlementRuntime(rule: PluginEntitlement): boolean;
|
|
222
|
+
/**
|
|
223
|
+
* Creates a request guard reserving current restricted/metered plugin admission before downstream work.
|
|
224
|
+
* @param pluginId - Exact plugin ID to admit.
|
|
225
|
+
* @param rule - Declared plugin access and metering policy.
|
|
226
|
+
* @param runtime - Required for restricted/metered/allowed-tenant rules; absence returns 503.
|
|
227
|
+
* @param resolvePrincipal - Verified request principal callback; defaults to resolveEngineEntitlementPrincipal.
|
|
228
|
+
* @returns Hono middleware returning 401 for absent identity, policy status for EntitlementError, or completing downstream work without a value.
|
|
229
|
+
* @throws Request handling propagates invalid principal, host runtime, resolver, and downstream errors outside normalized entitlement denial.
|
|
230
|
+
* @remarks Public unmetered rules skip runtime checks after principal validation; host lifecycle/resource authorization remains required. Metered admission counts failed downstream attempts.
|
|
231
|
+
* @example
|
|
232
|
+
* ```typescript
|
|
233
|
+
* import { Hono } from "hono";
|
|
234
|
+
* import { createPluginEntitlementGuard, type PluginEntitlementRuntime, type EntitlementPrincipalResolver } from "@alneas/eaos-server/entitlements";
|
|
235
|
+
* import type { PluginEntitlement } from "@alneas/eaos-core";
|
|
236
|
+
* export function protectedApp(rule: PluginEntitlement, runtime: PluginEntitlementRuntime, resolvePrincipal: EntitlementPrincipalResolver) {
|
|
237
|
+
* const app = new Hono();
|
|
238
|
+
* app.use("*", createPluginEntitlementGuard("example-plugin", rule, runtime, resolvePrincipal));
|
|
239
|
+
* return app;
|
|
240
|
+
* }
|
|
241
|
+
* ```
|
|
242
|
+
*/
|
|
243
|
+
declare function createPluginEntitlementGuard(pluginId: string, rule: PluginEntitlement, runtime?: PluginEntitlementRuntime, resolvePrincipal?: EntitlementPrincipalResolver): hono.MiddlewareHandler<any, string, {}, Response | (Response & hono.TypedResponse<{
|
|
244
|
+
error: string;
|
|
245
|
+
}, 401, "json">)>;
|
|
246
|
+
/**
|
|
247
|
+
* Trusted downloadable asset catalog entry; client input selects IDs rather than object keys.
|
|
248
|
+
* @see createPluginAssetRouter.
|
|
249
|
+
*/
|
|
250
|
+
interface ProtectedPluginAsset {
|
|
251
|
+
/** Public asset ID unique within a plugin catalog. */
|
|
252
|
+
id: string;
|
|
253
|
+
/** Owning plugin ID. */
|
|
254
|
+
pluginId: string;
|
|
255
|
+
/** Host storage object key passed to the signing port. */
|
|
256
|
+
key: string;
|
|
257
|
+
/** Lowercase 64-hex checksum validated before signing. */
|
|
258
|
+
sha256: string;
|
|
259
|
+
/** Host-declared media type returned as metadata. */
|
|
260
|
+
contentType: string;
|
|
261
|
+
}
|
|
262
|
+
/**
|
|
263
|
+
* Creates entitled asset URL delivery using a trusted catalog and host signing transport.
|
|
264
|
+
* @param options - runtime checks current entitlement; resolvePrincipal authenticates the request; plugins supplies rules; assets supplies trusted object metadata; sign receives cloned asset, verified principal, and expiresIn=60 seconds and resolves a capability URL.
|
|
265
|
+
* @returns A router serving GET /:pluginId/:assetId with URL/checksum/contentType/60-second lifetime, or 401/404/policy denial responses. Successful responses use private, no-store caching.
|
|
266
|
+
* @throws Request handling propagates resolver/runtime/signing errors or invalid trusted checksums.
|
|
267
|
+
* @remarks Entitlement is checked before and after external signing, but no quota is reserved by this route. Signed URLs may remain usable after later revocation until expiry; the signing port must enforce private access and the requested lifetime. Catalogs, keys, and credentials must remain host-controlled.
|
|
268
|
+
* @example
|
|
269
|
+
* ```typescript
|
|
270
|
+
* import { createPluginAssetRouter } from "@alneas/eaos-server/entitlements";
|
|
271
|
+
* export function assetRoutes(options: Parameters<typeof createPluginAssetRouter>[0]) {
|
|
272
|
+
* return createPluginAssetRouter(options);
|
|
273
|
+
* }
|
|
274
|
+
* ```
|
|
275
|
+
*/
|
|
276
|
+
declare function createPluginAssetRouter(options: {
|
|
277
|
+
/**
|
|
278
|
+
* Current lifecycle/subscription policy checker; URL delivery checks it before signing and immediately before returning the capability.
|
|
279
|
+
*/
|
|
280
|
+
runtime: PluginEntitlementRuntime;
|
|
281
|
+
/**
|
|
282
|
+
* Authenticates each asset request and resolves a verified tenant/user principal or null to return 401; errors propagate through Hono.
|
|
283
|
+
*/
|
|
284
|
+
resolvePrincipal: EntitlementPrincipalResolver;
|
|
285
|
+
/**
|
|
286
|
+
* Trusted plugin-ID to entitlement-policy catalog; an unknown plugin is returned as unavailable.
|
|
287
|
+
*/
|
|
288
|
+
plugins: Readonly<Record<string, PluginEntitlement>>;
|
|
289
|
+
/**
|
|
290
|
+
* Trusted asset catalog looked up by plugin ID and asset ID; client input never supplies storage object keys.
|
|
291
|
+
*/
|
|
292
|
+
assets: readonly ProtectedPluginAsset[];
|
|
293
|
+
/**
|
|
294
|
+
* Host signing callback invoked after initial admission with exact asset/principal and a 60-second lifetime; resolves a private capability URL and may reject.
|
|
295
|
+
*/
|
|
296
|
+
sign: (input: {
|
|
297
|
+
/**
|
|
298
|
+
* Structured clone of the trusted catalog asset, including storage key and validated lowercase SHA-256.
|
|
299
|
+
*/
|
|
300
|
+
asset: ProtectedPluginAsset;
|
|
301
|
+
/**
|
|
302
|
+
* Verified principal for the current asset request; use it for host signing authorization.
|
|
303
|
+
*/
|
|
304
|
+
principal: PlatformPrincipal;
|
|
305
|
+
/**
|
|
306
|
+
* Requested signed URL lifetime in seconds; this router always supplies 60.
|
|
307
|
+
*/
|
|
308
|
+
expiresIn: number;
|
|
309
|
+
}) => Promise<string>;
|
|
310
|
+
}): Hono<hono_types.BlankEnv, hono_types.BlankSchema, "/">;
|
|
311
|
+
|
|
312
|
+
export { EntitlementError, PluginEntitlementRuntime, createPluginAssetRouter, createPluginEntitlementGuard, createSqlTenantEntitlementLoader, requiresEntitlementRuntime, resolveEngineEntitlementPrincipal, tenantEntitlementContract };
|
|
313
|
+
export type { EntitlementPrincipalResolver, EntitlementRuntimeOptions, ProtectedPluginAsset };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import {
|
|
2
|
+
EntitlementError,
|
|
3
|
+
PluginEntitlementRuntime,
|
|
4
|
+
createPluginAssetRouter,
|
|
5
|
+
createPluginEntitlementGuard,
|
|
6
|
+
createSqlTenantEntitlementLoader,
|
|
7
|
+
requiresEntitlementRuntime,
|
|
8
|
+
resolveEngineEntitlementPrincipal,
|
|
9
|
+
tenantEntitlementContract
|
|
10
|
+
} from "../chunk-46UWPEW2.js";
|
|
11
|
+
import "../chunk-INCHXAFK.js";
|
|
12
|
+
import "../chunk-3VITSHN3.js";
|
|
13
|
+
export {
|
|
14
|
+
EntitlementError,
|
|
15
|
+
PluginEntitlementRuntime,
|
|
16
|
+
createPluginAssetRouter,
|
|
17
|
+
createPluginEntitlementGuard,
|
|
18
|
+
createSqlTenantEntitlementLoader,
|
|
19
|
+
requiresEntitlementRuntime,
|
|
20
|
+
resolveEngineEntitlementPrincipal,
|
|
21
|
+
tenantEntitlementContract
|
|
22
|
+
};
|
|
23
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import '@alneas/appkit-core/ai/ai-chat';
|
|
2
|
+
import '@alneas/appkit-core/ai/action';
|
|
3
|
+
import '@alneas/eaos-core';
|
|
4
|
+
export { ChatClientOptions, ChatCompletion, ChatGovernanceOptions, createChatClient } from './index.js';
|
|
5
|
+
import 'hono/types';
|
|
6
|
+
import 'hono';
|
|
7
|
+
import '@alneas/appkit-core/ai';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|