@elsium-ai/app 0.1.6

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.
@@ -0,0 +1,11 @@
1
+ import type { Context, Next } from 'hono';
2
+ import type { AuthConfig, CorsConfig, RateLimitConfig } from './types';
3
+ export declare function corsMiddleware(config?: CorsConfig | boolean): (c: Context, next: Next) => Promise<(Response & import("hono").TypedResponse<null, 200, "body">) | undefined>;
4
+ export declare function authMiddleware(config: AuthConfig): (c: Context, next: Next) => Promise<void | (Response & import("hono").TypedResponse<{
5
+ error: string;
6
+ }, 401, "json">)>;
7
+ export declare function rateLimitMiddleware(config: RateLimitConfig): (c: Context, next: Next) => Promise<(Response & import("hono").TypedResponse<{
8
+ error: string;
9
+ retryAfterMs: number;
10
+ }, 429, "json">) | undefined>;
11
+ //# sourceMappingURL=middleware.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"middleware.d.ts","sourceRoot":"","sources":["../src/middleware.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAA;AACzC,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAItE,wBAAgB,cAAc,CAAC,MAAM,GAAE,UAAU,GAAG,OAAc,IAInD,GAAG,OAAO,EAAE,MAAM,IAAI,uFAiCpC;AAID,wBAAgB,cAAc,CAAC,MAAM,EAAE,UAAU,IAClC,GAAG,OAAO,EAAE,MAAM,IAAI;;kBAwBpC;AAaD,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,eAAe,IAG5C,GAAG,OAAO,EAAE,MAAM,IAAI;;;8BAsCpC"}
package/dist/rbac.d.ts ADDED
@@ -0,0 +1,20 @@
1
+ import type { Context, Next } from 'hono';
2
+ export type Permission = 'model:use' | 'model:use:*' | `model:use:${string}` | 'agent:execute' | 'agent:execute:*' | `agent:execute:${string}` | 'tool:call' | 'tool:call:*' | `tool:call:${string}` | 'config:read' | 'config:write' | 'audit:read' | 'audit:write';
3
+ export interface Role {
4
+ name: string;
5
+ permissions: Permission[];
6
+ inherits?: string[];
7
+ }
8
+ export interface RBACConfig {
9
+ roles: Role[];
10
+ defaultRole?: string;
11
+ roleExtractor?: (c: Context) => string | undefined;
12
+ trustRoleHeader?: boolean;
13
+ }
14
+ export interface RBAC {
15
+ hasPermission(role: string, permission: Permission): boolean;
16
+ middleware(required: Permission): (c: Context, next: Next) => Promise<Response | undefined>;
17
+ getRolePermissions(role: string): Permission[];
18
+ }
19
+ export declare function createRBAC(config: RBACConfig): RBAC;
20
+ //# sourceMappingURL=rbac.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rbac.d.ts","sourceRoot":"","sources":["../src/rbac.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAA;AAIzC,MAAM,MAAM,UAAU,GACnB,WAAW,GACX,aAAa,GACb,aAAa,MAAM,EAAE,GACrB,eAAe,GACf,iBAAiB,GACjB,iBAAiB,MAAM,EAAE,GACzB,WAAW,GACX,aAAa,GACb,aAAa,MAAM,EAAE,GACrB,aAAa,GACb,cAAc,GACd,YAAY,GACZ,aAAa,CAAA;AAEhB,MAAM,WAAW,IAAI;IACpB,IAAI,EAAE,MAAM,CAAA;IACZ,WAAW,EAAE,UAAU,EAAE,CAAA;IACzB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAA;CACnB;AAED,MAAM,WAAW,UAAU;IAC1B,KAAK,EAAE,IAAI,EAAE,CAAA;IACb,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,aAAa,CAAC,EAAE,CAAC,CAAC,EAAE,OAAO,KAAK,MAAM,GAAG,SAAS,CAAA;IAClD,eAAe,CAAC,EAAE,OAAO,CAAA;CACzB;AAED,MAAM,WAAW,IAAI;IACpB,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,UAAU,GAAG,OAAO,CAAA;IAC5D,UAAU,CAAC,QAAQ,EAAE,UAAU,GAAG,CAAC,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,KAAK,OAAO,CAAC,QAAQ,GAAG,SAAS,CAAC,CAAA;IAC3F,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU,EAAE,CAAA;CAC9C;AAyCD,wBAAgB,UAAU,CAAC,MAAM,EAAE,UAAU,GAAG,IAAI,CA8EnD"}
@@ -0,0 +1,15 @@
1
+ import type { Agent } from '@elsium-ai/agents';
2
+ import type { Gateway } from '@elsium-ai/gateway';
3
+ import type { Tracer } from '@elsium-ai/observe';
4
+ import { Hono } from 'hono';
5
+ export interface RoutesDeps {
6
+ gateway: Gateway;
7
+ agents: Map<string, Agent>;
8
+ defaultAgent?: Agent;
9
+ tracer?: Tracer;
10
+ startTime: number;
11
+ version: string;
12
+ providers: string[];
13
+ }
14
+ export declare function createRoutes(deps: RoutesDeps): Hono;
15
+ //# sourceMappingURL=routes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"routes.d.ts","sourceRoot":"","sources":["../src/routes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAC9C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAA;AACjD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAA;AAChD,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAA;AAS3B,MAAM,WAAW,UAAU;IAC1B,OAAO,EAAE,OAAO,CAAA;IAChB,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,KAAK,CAAC,CAAA;IAC1B,YAAY,CAAC,EAAE,KAAK,CAAA;IACpB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,SAAS,EAAE,MAAM,CAAA;IACjB,OAAO,EAAE,MAAM,CAAA;IACf,SAAS,EAAE,MAAM,EAAE,CAAA;CACnB;AAED,wBAAgB,YAAY,CAAC,IAAI,EAAE,UAAU,GAAG,IAAI,CA+JnD"}
@@ -0,0 +1,85 @@
1
+ import type { Agent } from '@elsium-ai/agents';
2
+ import type { RAGPipeline } from '@elsium-ai/rag';
3
+ export interface AppConfig {
4
+ gateway: {
5
+ providers: Record<string, {
6
+ apiKey: string;
7
+ baseUrl?: string;
8
+ }>;
9
+ defaultModel?: string;
10
+ };
11
+ agents?: Agent[];
12
+ rag?: RAGPipeline;
13
+ observe?: {
14
+ tracing?: boolean;
15
+ costTracking?: boolean;
16
+ export?: string;
17
+ };
18
+ server?: ServerConfig;
19
+ }
20
+ export interface ServerConfig {
21
+ port?: number;
22
+ hostname?: string;
23
+ cors?: boolean | CorsConfig;
24
+ auth?: AuthConfig;
25
+ rateLimit?: RateLimitConfig;
26
+ }
27
+ export interface CorsConfig {
28
+ origin?: string | string[];
29
+ methods?: string[];
30
+ headers?: string[];
31
+ credentials?: boolean;
32
+ }
33
+ export interface AuthConfig {
34
+ type: 'bearer';
35
+ token: string;
36
+ }
37
+ export interface RateLimitConfig {
38
+ windowMs: number;
39
+ maxRequests: number;
40
+ }
41
+ export interface ChatRequest {
42
+ message: string;
43
+ agent?: string;
44
+ stream?: boolean;
45
+ }
46
+ export interface ChatResponse {
47
+ message: string;
48
+ usage: {
49
+ inputTokens: number;
50
+ outputTokens: number;
51
+ totalTokens: number;
52
+ cost: number;
53
+ };
54
+ model: string;
55
+ traceId: string;
56
+ }
57
+ export interface CompleteRequest {
58
+ messages: Array<{
59
+ role: string;
60
+ content: string;
61
+ }>;
62
+ model?: string;
63
+ system?: string;
64
+ maxTokens?: number;
65
+ temperature?: number;
66
+ stream?: boolean;
67
+ }
68
+ export interface HealthResponse {
69
+ status: 'ok' | 'degraded';
70
+ version: string;
71
+ uptime: number;
72
+ providers: string[];
73
+ }
74
+ export interface MetricsResponse {
75
+ uptime: number;
76
+ totalRequests: number;
77
+ totalTokens: number;
78
+ totalCost: number;
79
+ byModel: Record<string, {
80
+ requests: number;
81
+ tokens: number;
82
+ cost: number;
83
+ }>;
84
+ }
85
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAC9C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAEjD,MAAM,WAAW,SAAS;IACzB,OAAO,EAAE;QACR,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE;YAAE,MAAM,EAAE,MAAM,CAAC;YAAC,OAAO,CAAC,EAAE,MAAM,CAAA;SAAE,CAAC,CAAA;QAC/D,YAAY,CAAC,EAAE,MAAM,CAAA;KACrB,CAAA;IACD,MAAM,CAAC,EAAE,KAAK,EAAE,CAAA;IAChB,GAAG,CAAC,EAAE,WAAW,CAAA;IACjB,OAAO,CAAC,EAAE;QACT,OAAO,CAAC,EAAE,OAAO,CAAA;QACjB,YAAY,CAAC,EAAE,OAAO,CAAA;QACtB,MAAM,CAAC,EAAE,MAAM,CAAA;KACf,CAAA;IACD,MAAM,CAAC,EAAE,YAAY,CAAA;CACrB;AAED,MAAM,WAAW,YAAY;IAC5B,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,IAAI,CAAC,EAAE,OAAO,GAAG,UAAU,CAAA;IAC3B,IAAI,CAAC,EAAE,UAAU,CAAA;IACjB,SAAS,CAAC,EAAE,eAAe,CAAA;CAC3B;AAED,MAAM,WAAW,UAAU;IAC1B,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAA;IAC1B,OAAO,CAAC,EAAE,MAAM,EAAE,CAAA;IAClB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAA;IAClB,WAAW,CAAC,EAAE,OAAO,CAAA;CACrB;AAED,MAAM,WAAW,UAAU;IAC1B,IAAI,EAAE,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;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;CAC3E"}
package/package.json ADDED
@@ -0,0 +1,43 @@
1
+ {
2
+ "name": "@elsium-ai/app",
3
+ "version": "0.1.6",
4
+ "description": "App bootstrap, HTTP server, and API routes for ElsiumAI",
5
+ "license": "MIT",
6
+ "author": "Eric Utrera <ebutrera9103@gmail.com>",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "https://github.com/elsium-ai/elsium-ai",
10
+ "directory": "packages/app"
11
+ },
12
+ "type": "module",
13
+ "main": "./dist/index.js",
14
+ "types": "./dist/index.d.ts",
15
+ "exports": {
16
+ ".": {
17
+ "import": "./dist/index.js",
18
+ "types": "./dist/index.d.ts"
19
+ }
20
+ },
21
+ "files": [
22
+ "dist"
23
+ ],
24
+ "scripts": {
25
+ "build": "bun build ./src/index.ts --outdir ./dist --target bun && bun x tsc -p tsconfig.build.json --emitDeclarationOnly",
26
+ "dev": "bun --watch src/index.ts"
27
+ },
28
+ "dependencies": {
29
+ "@elsium-ai/core": "workspace:*",
30
+ "@elsium-ai/gateway": "workspace:*",
31
+ "@elsium-ai/agents": "workspace:*",
32
+ "@elsium-ai/tools": "workspace:*",
33
+ "@elsium-ai/observe": "workspace:*",
34
+ "@elsium-ai/rag": "workspace:*",
35
+ "@elsium-ai/workflows": "workspace:*",
36
+ "hono": "^4.7.0",
37
+ "zod": "^3.24.0"
38
+ },
39
+ "devDependencies": {
40
+ "bun-types": "^1.3.0",
41
+ "typescript": "^5.7.0"
42
+ }
43
+ }