@frontmcp/ui 0.6.1 → 0.6.2
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/bridge/core/bridge-factory.d.ts +1 -0
- package/bridge/core/bridge-factory.d.ts.map +1 -1
- package/bridge/index.d.ts +1 -1
- package/bridge/index.d.ts.map +1 -1
- package/bridge/index.js +39 -881
- package/bundler/browser-components.d.ts +42 -0
- package/bundler/browser-components.d.ts.map +1 -0
- package/bundler/bundler.d.ts +78 -4
- package/bundler/bundler.d.ts.map +1 -1
- package/bundler/index.d.ts +8 -8
- package/bundler/index.d.ts.map +1 -1
- package/bundler/index.js +1315 -1854
- package/bundler/types.d.ts +188 -7
- package/bundler/types.d.ts.map +1 -1
- package/esm/bridge/{index.js → index.mjs} +40 -877
- package/esm/bundler/{index.js → index.mjs} +1391 -1895
- package/esm/{index.js → index.mjs} +215 -3091
- package/esm/layouts/{index.js → index.mjs} +3 -3
- package/esm/package.json +9 -8
- package/esm/react/index.mjs +1183 -0
- package/esm/renderers/index.mjs +611 -0
- package/esm/universal/{index.js → index.mjs} +266 -70
- package/index.d.ts +1 -4
- package/index.d.ts.map +1 -1
- package/index.js +208 -3113
- package/layouts/base.d.ts.map +1 -1
- package/layouts/index.js +3 -3
- package/layouts/presets.d.ts.map +1 -1
- package/package.json +9 -8
- package/react/Badge.d.ts.map +1 -1
- package/react/hooks/context.d.ts.map +1 -1
- package/react/index.d.ts +0 -1
- package/react/index.d.ts.map +1 -1
- package/react/index.js +57 -2001
- package/react/types.d.ts.map +1 -1
- package/renderers/index.d.ts +9 -4
- package/renderers/index.d.ts.map +1 -1
- package/renderers/index.js +328 -88
- package/renderers/mdx.renderer.d.ts +99 -0
- package/renderers/mdx.renderer.d.ts.map +1 -0
- package/renderers/react.renderer.d.ts +22 -13
- package/renderers/react.renderer.d.ts.map +1 -1
- package/renderers/transpiler.d.ts +49 -0
- package/renderers/transpiler.d.ts.map +1 -0
- package/universal/cached-runtime.d.ts +25 -1
- package/universal/cached-runtime.d.ts.map +1 -1
- package/universal/index.js +266 -70
- package/universal/runtime-builder.d.ts.map +1 -1
- package/universal/types.d.ts.map +1 -1
- package/web-components/elements/fmcp-input.d.ts.map +1 -1
- package/web-components/elements/fmcp-select.d.ts.map +1 -1
- package/web-components/index.d.ts +0 -1
- package/web-components/index.d.ts.map +1 -1
- package/bundler/cache.d.ts +0 -173
- package/bundler/cache.d.ts.map +0 -1
- package/bundler/file-cache/component-builder.d.ts +0 -167
- package/bundler/file-cache/component-builder.d.ts.map +0 -1
- package/bundler/file-cache/hash-calculator.d.ts +0 -155
- package/bundler/file-cache/hash-calculator.d.ts.map +0 -1
- package/bundler/file-cache/index.d.ts +0 -12
- package/bundler/file-cache/index.d.ts.map +0 -1
- package/bundler/file-cache/storage/filesystem.d.ts +0 -149
- package/bundler/file-cache/storage/filesystem.d.ts.map +0 -1
- package/bundler/file-cache/storage/index.d.ts +0 -11
- package/bundler/file-cache/storage/index.d.ts.map +0 -1
- package/bundler/file-cache/storage/interface.d.ts +0 -152
- package/bundler/file-cache/storage/interface.d.ts.map +0 -1
- package/bundler/file-cache/storage/redis.d.ts +0 -139
- package/bundler/file-cache/storage/redis.d.ts.map +0 -1
- package/bundler/sandbox/enclave-adapter.d.ts +0 -121
- package/bundler/sandbox/enclave-adapter.d.ts.map +0 -1
- package/bundler/sandbox/executor.d.ts +0 -14
- package/bundler/sandbox/executor.d.ts.map +0 -1
- package/bundler/sandbox/policy.d.ts +0 -62
- package/bundler/sandbox/policy.d.ts.map +0 -1
- package/esm/bridge/adapters/base-adapter.d.ts +0 -104
- package/esm/bridge/adapters/base-adapter.d.ts.map +0 -1
- package/esm/bridge/adapters/claude.adapter.d.ts +0 -67
- package/esm/bridge/adapters/claude.adapter.d.ts.map +0 -1
- package/esm/bridge/adapters/ext-apps.adapter.d.ts +0 -143
- package/esm/bridge/adapters/ext-apps.adapter.d.ts.map +0 -1
- package/esm/bridge/adapters/gemini.adapter.d.ts +0 -64
- package/esm/bridge/adapters/gemini.adapter.d.ts.map +0 -1
- package/esm/bridge/adapters/generic.adapter.d.ts +0 -56
- package/esm/bridge/adapters/generic.adapter.d.ts.map +0 -1
- package/esm/bridge/adapters/index.d.ts +0 -26
- package/esm/bridge/adapters/index.d.ts.map +0 -1
- package/esm/bridge/adapters/openai.adapter.d.ts +0 -65
- package/esm/bridge/adapters/openai.adapter.d.ts.map +0 -1
- package/esm/bridge/core/adapter-registry.d.ts +0 -122
- package/esm/bridge/core/adapter-registry.d.ts.map +0 -1
- package/esm/bridge/core/bridge-factory.d.ts +0 -199
- package/esm/bridge/core/bridge-factory.d.ts.map +0 -1
- package/esm/bridge/core/index.d.ts +0 -10
- package/esm/bridge/core/index.d.ts.map +0 -1
- package/esm/bridge/index.d.ts +0 -62
- package/esm/bridge/index.d.ts.map +0 -1
- package/esm/bridge/runtime/iife-generator.d.ts +0 -62
- package/esm/bridge/runtime/iife-generator.d.ts.map +0 -1
- package/esm/bridge/runtime/index.d.ts +0 -10
- package/esm/bridge/runtime/index.d.ts.map +0 -1
- package/esm/bridge/types.d.ts +0 -386
- package/esm/bridge/types.d.ts.map +0 -1
- package/esm/bundler/bundler.d.ts +0 -208
- package/esm/bundler/bundler.d.ts.map +0 -1
- package/esm/bundler/cache.d.ts +0 -173
- package/esm/bundler/cache.d.ts.map +0 -1
- package/esm/bundler/file-cache/component-builder.d.ts +0 -167
- package/esm/bundler/file-cache/component-builder.d.ts.map +0 -1
- package/esm/bundler/file-cache/hash-calculator.d.ts +0 -155
- package/esm/bundler/file-cache/hash-calculator.d.ts.map +0 -1
- package/esm/bundler/file-cache/index.d.ts +0 -12
- package/esm/bundler/file-cache/index.d.ts.map +0 -1
- package/esm/bundler/file-cache/storage/filesystem.d.ts +0 -149
- package/esm/bundler/file-cache/storage/filesystem.d.ts.map +0 -1
- package/esm/bundler/file-cache/storage/index.d.ts +0 -11
- package/esm/bundler/file-cache/storage/index.d.ts.map +0 -1
- package/esm/bundler/file-cache/storage/interface.d.ts +0 -152
- package/esm/bundler/file-cache/storage/interface.d.ts.map +0 -1
- package/esm/bundler/file-cache/storage/redis.d.ts +0 -139
- package/esm/bundler/file-cache/storage/redis.d.ts.map +0 -1
- package/esm/bundler/index.d.ts +0 -43
- package/esm/bundler/index.d.ts.map +0 -1
- package/esm/bundler/sandbox/enclave-adapter.d.ts +0 -121
- package/esm/bundler/sandbox/enclave-adapter.d.ts.map +0 -1
- package/esm/bundler/sandbox/executor.d.ts +0 -14
- package/esm/bundler/sandbox/executor.d.ts.map +0 -1
- package/esm/bundler/sandbox/policy.d.ts +0 -62
- package/esm/bundler/sandbox/policy.d.ts.map +0 -1
- package/esm/bundler/types.d.ts +0 -702
- package/esm/bundler/types.d.ts.map +0 -1
- package/esm/components/alert.d.ts +0 -66
- package/esm/components/alert.d.ts.map +0 -1
- package/esm/components/alert.schema.d.ts +0 -98
- package/esm/components/alert.schema.d.ts.map +0 -1
- package/esm/components/avatar.d.ts +0 -77
- package/esm/components/avatar.d.ts.map +0 -1
- package/esm/components/avatar.schema.d.ts +0 -170
- package/esm/components/avatar.schema.d.ts.map +0 -1
- package/esm/components/badge.d.ts +0 -64
- package/esm/components/badge.d.ts.map +0 -1
- package/esm/components/badge.schema.d.ts +0 -91
- package/esm/components/badge.schema.d.ts.map +0 -1
- package/esm/components/button.d.ts +0 -100
- package/esm/components/button.d.ts.map +0 -1
- package/esm/components/button.schema.d.ts +0 -120
- package/esm/components/button.schema.d.ts.map +0 -1
- package/esm/components/card.d.ts +0 -53
- package/esm/components/card.d.ts.map +0 -1
- package/esm/components/card.schema.d.ts +0 -93
- package/esm/components/card.schema.d.ts.map +0 -1
- package/esm/components/form.d.ts +0 -212
- package/esm/components/form.d.ts.map +0 -1
- package/esm/components/form.schema.d.ts +0 -365
- package/esm/components/form.schema.d.ts.map +0 -1
- package/esm/components/index.d.ts +0 -29
- package/esm/components/index.d.ts.map +0 -1
- package/esm/components/list.d.ts +0 -121
- package/esm/components/list.d.ts.map +0 -1
- package/esm/components/list.schema.d.ts +0 -129
- package/esm/components/list.schema.d.ts.map +0 -1
- package/esm/components/modal.d.ts +0 -100
- package/esm/components/modal.d.ts.map +0 -1
- package/esm/components/modal.schema.d.ts +0 -151
- package/esm/components/modal.schema.d.ts.map +0 -1
- package/esm/components/table.d.ts +0 -91
- package/esm/components/table.d.ts.map +0 -1
- package/esm/components/table.schema.d.ts +0 -123
- package/esm/components/table.schema.d.ts.map +0 -1
- package/esm/index.d.ts +0 -40
- package/esm/index.d.ts.map +0 -1
- package/esm/layouts/base.d.ts +0 -86
- package/esm/layouts/base.d.ts.map +0 -1
- package/esm/layouts/index.d.ts +0 -8
- package/esm/layouts/index.d.ts.map +0 -1
- package/esm/layouts/presets.d.ts +0 -134
- package/esm/layouts/presets.d.ts.map +0 -1
- package/esm/pages/consent.d.ts +0 -117
- package/esm/pages/consent.d.ts.map +0 -1
- package/esm/pages/error.d.ts +0 -101
- package/esm/pages/error.d.ts.map +0 -1
- package/esm/pages/index.d.ts +0 -9
- package/esm/pages/index.d.ts.map +0 -1
- package/esm/pages/index.js +0 -1036
- package/esm/react/Alert.d.ts +0 -101
- package/esm/react/Alert.d.ts.map +0 -1
- package/esm/react/Badge.d.ts +0 -100
- package/esm/react/Badge.d.ts.map +0 -1
- package/esm/react/Button.d.ts +0 -108
- package/esm/react/Button.d.ts.map +0 -1
- package/esm/react/Card.d.ts +0 -103
- package/esm/react/Card.d.ts.map +0 -1
- package/esm/react/hooks/context.d.ts +0 -179
- package/esm/react/hooks/context.d.ts.map +0 -1
- package/esm/react/hooks/index.d.ts +0 -42
- package/esm/react/hooks/index.d.ts.map +0 -1
- package/esm/react/hooks/tools.d.ts +0 -284
- package/esm/react/hooks/tools.d.ts.map +0 -1
- package/esm/react/index.d.ts +0 -80
- package/esm/react/index.d.ts.map +0 -1
- package/esm/react/index.js +0 -3124
- package/esm/react/types.d.ts +0 -105
- package/esm/react/types.d.ts.map +0 -1
- package/esm/react/utils.d.ts +0 -43
- package/esm/react/utils.d.ts.map +0 -1
- package/esm/render/index.d.ts +0 -8
- package/esm/render/index.d.ts.map +0 -1
- package/esm/render/prerender.d.ts +0 -57
- package/esm/render/prerender.d.ts.map +0 -1
- package/esm/renderers/index.d.ts +0 -21
- package/esm/renderers/index.d.ts.map +0 -1
- package/esm/renderers/index.js +0 -381
- package/esm/renderers/react.adapter.d.ts +0 -70
- package/esm/renderers/react.adapter.d.ts.map +0 -1
- package/esm/renderers/react.renderer.d.ts +0 -96
- package/esm/renderers/react.renderer.d.ts.map +0 -1
- package/esm/universal/UniversalApp.d.ts +0 -108
- package/esm/universal/UniversalApp.d.ts.map +0 -1
- package/esm/universal/cached-runtime.d.ts +0 -115
- package/esm/universal/cached-runtime.d.ts.map +0 -1
- package/esm/universal/context.d.ts +0 -122
- package/esm/universal/context.d.ts.map +0 -1
- package/esm/universal/index.d.ts +0 -57
- package/esm/universal/index.d.ts.map +0 -1
- package/esm/universal/renderers/html.renderer.d.ts +0 -37
- package/esm/universal/renderers/html.renderer.d.ts.map +0 -1
- package/esm/universal/renderers/index.d.ts +0 -112
- package/esm/universal/renderers/index.d.ts.map +0 -1
- package/esm/universal/renderers/markdown.renderer.d.ts +0 -33
- package/esm/universal/renderers/markdown.renderer.d.ts.map +0 -1
- package/esm/universal/renderers/mdx.renderer.d.ts +0 -38
- package/esm/universal/renderers/mdx.renderer.d.ts.map +0 -1
- package/esm/universal/renderers/react.renderer.d.ts +0 -46
- package/esm/universal/renderers/react.renderer.d.ts.map +0 -1
- package/esm/universal/runtime-builder.d.ts +0 -33
- package/esm/universal/runtime-builder.d.ts.map +0 -1
- package/esm/universal/store.d.ts +0 -135
- package/esm/universal/store.d.ts.map +0 -1
- package/esm/universal/types.d.ts +0 -199
- package/esm/universal/types.d.ts.map +0 -1
- package/esm/web-components/core/attribute-parser.d.ts +0 -82
- package/esm/web-components/core/attribute-parser.d.ts.map +0 -1
- package/esm/web-components/core/base-element.d.ts +0 -197
- package/esm/web-components/core/base-element.d.ts.map +0 -1
- package/esm/web-components/core/index.d.ts +0 -9
- package/esm/web-components/core/index.d.ts.map +0 -1
- package/esm/web-components/elements/fmcp-alert.d.ts +0 -46
- package/esm/web-components/elements/fmcp-alert.d.ts.map +0 -1
- package/esm/web-components/elements/fmcp-badge.d.ts +0 -47
- package/esm/web-components/elements/fmcp-badge.d.ts.map +0 -1
- package/esm/web-components/elements/fmcp-button.d.ts +0 -117
- package/esm/web-components/elements/fmcp-button.d.ts.map +0 -1
- package/esm/web-components/elements/fmcp-card.d.ts +0 -53
- package/esm/web-components/elements/fmcp-card.d.ts.map +0 -1
- package/esm/web-components/elements/fmcp-input.d.ts +0 -96
- package/esm/web-components/elements/fmcp-input.d.ts.map +0 -1
- package/esm/web-components/elements/fmcp-select.d.ts +0 -100
- package/esm/web-components/elements/fmcp-select.d.ts.map +0 -1
- package/esm/web-components/elements/index.d.ts +0 -13
- package/esm/web-components/elements/index.d.ts.map +0 -1
- package/esm/web-components/index.d.ts +0 -50
- package/esm/web-components/index.d.ts.map +0 -1
- package/esm/web-components/register.d.ts +0 -57
- package/esm/web-components/register.d.ts.map +0 -1
- package/esm/web-components/types.d.ts +0 -122
- package/esm/web-components/types.d.ts.map +0 -1
- package/esm/widgets/index.d.ts +0 -8
- package/esm/widgets/index.d.ts.map +0 -1
- package/esm/widgets/index.js +0 -883
- package/esm/widgets/progress.d.ts +0 -133
- package/esm/widgets/progress.d.ts.map +0 -1
- package/esm/widgets/resource.d.ts +0 -163
- package/esm/widgets/resource.d.ts.map +0 -1
- package/pages/consent.d.ts +0 -117
- package/pages/consent.d.ts.map +0 -1
- package/pages/error.d.ts +0 -101
- package/pages/error.d.ts.map +0 -1
- package/pages/index.d.ts +0 -9
- package/pages/index.d.ts.map +0 -1
- package/pages/index.js +0 -1065
- package/react/utils.d.ts +0 -43
- package/react/utils.d.ts.map +0 -1
- package/widgets/index.d.ts +0 -8
- package/widgets/index.d.ts.map +0 -1
- package/widgets/index.js +0 -910
- package/widgets/progress.d.ts +0 -133
- package/widgets/progress.d.ts.map +0 -1
- package/widgets/resource.d.ts +0 -163
- package/widgets/resource.d.ts.map +0 -1
- /package/esm/components/{index.js → index.mjs} +0 -0
- /package/esm/render/{index.js → index.mjs} +0 -0
- /package/esm/web-components/{index.js → index.mjs} +0 -0
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Build Cache Storage
|
|
3
|
-
*
|
|
4
|
-
* Storage implementations for component build caching.
|
|
5
|
-
*
|
|
6
|
-
* @packageDocumentation
|
|
7
|
-
*/
|
|
8
|
-
export { type BuildCacheStorage, type StorageOptions, type CacheEntry, type CacheEntryMetadata, DEFAULT_STORAGE_OPTIONS, calculateManifestSize, } from './interface';
|
|
9
|
-
export { FilesystemStorage, createFilesystemStorage, type FilesystemStorageOptions } from './filesystem';
|
|
10
|
-
export { RedisStorage, createRedisStorage, type RedisStorageOptions, type RedisClient } from './redis';
|
|
11
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/bundler/file-cache/storage/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,EACL,KAAK,iBAAiB,EACtB,KAAK,cAAc,EACnB,KAAK,UAAU,EACf,KAAK,kBAAkB,EACvB,uBAAuB,EACvB,qBAAqB,GACtB,MAAM,aAAa,CAAC;AAGrB,OAAO,EAAE,iBAAiB,EAAE,uBAAuB,EAAE,KAAK,wBAAwB,EAAE,MAAM,cAAc,CAAC;AAGzG,OAAO,EAAE,YAAY,EAAE,kBAAkB,EAAE,KAAK,mBAAmB,EAAE,KAAK,WAAW,EAAE,MAAM,SAAS,CAAC"}
|
|
@@ -1,152 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Build Cache Storage Interface
|
|
3
|
-
*
|
|
4
|
-
* Abstract interface for storing and retrieving component build manifests.
|
|
5
|
-
* Implementations include filesystem (development) and Redis (production).
|
|
6
|
-
*
|
|
7
|
-
* @packageDocumentation
|
|
8
|
-
*/
|
|
9
|
-
import type { ComponentBuildManifest, CacheStats } from '@frontmcp/uipack/dependency';
|
|
10
|
-
/**
|
|
11
|
-
* Options for storage initialization.
|
|
12
|
-
*/
|
|
13
|
-
export interface StorageOptions {
|
|
14
|
-
/**
|
|
15
|
-
* Maximum number of entries to store.
|
|
16
|
-
* @default 1000
|
|
17
|
-
*/
|
|
18
|
-
maxEntries?: number;
|
|
19
|
-
/**
|
|
20
|
-
* Maximum total size in bytes.
|
|
21
|
-
* @default 104857600 (100MB)
|
|
22
|
-
*/
|
|
23
|
-
maxSize?: number;
|
|
24
|
-
/**
|
|
25
|
-
* Default TTL in seconds.
|
|
26
|
-
* @default 86400 (24 hours)
|
|
27
|
-
*/
|
|
28
|
-
defaultTtl?: number;
|
|
29
|
-
/**
|
|
30
|
-
* Whether to compress stored data.
|
|
31
|
-
* @default false
|
|
32
|
-
*/
|
|
33
|
-
compress?: boolean;
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* Abstract interface for build cache storage.
|
|
37
|
-
*
|
|
38
|
-
* Implementations should handle:
|
|
39
|
-
* - Key-value storage of ComponentBuildManifest
|
|
40
|
-
* - TTL-based expiration
|
|
41
|
-
* - Size-based eviction
|
|
42
|
-
* - Concurrent access safety
|
|
43
|
-
*/
|
|
44
|
-
export interface BuildCacheStorage {
|
|
45
|
-
/**
|
|
46
|
-
* Storage identifier for logging/debugging.
|
|
47
|
-
*/
|
|
48
|
-
readonly type: string;
|
|
49
|
-
/**
|
|
50
|
-
* Initialize the storage backend.
|
|
51
|
-
* Must be called before other operations.
|
|
52
|
-
*/
|
|
53
|
-
initialize(): Promise<void>;
|
|
54
|
-
/**
|
|
55
|
-
* Retrieve a cached build manifest by key.
|
|
56
|
-
*
|
|
57
|
-
* @param key - Cache key (typically content hash)
|
|
58
|
-
* @returns Cached manifest or undefined if not found/expired
|
|
59
|
-
*/
|
|
60
|
-
get(key: string): Promise<ComponentBuildManifest | undefined>;
|
|
61
|
-
/**
|
|
62
|
-
* Store a build manifest in cache.
|
|
63
|
-
*
|
|
64
|
-
* @param key - Cache key
|
|
65
|
-
* @param manifest - Build manifest to store
|
|
66
|
-
* @param ttl - Optional TTL in seconds (overrides default)
|
|
67
|
-
*/
|
|
68
|
-
set(key: string, manifest: ComponentBuildManifest, ttl?: number): Promise<void>;
|
|
69
|
-
/**
|
|
70
|
-
* Check if a key exists in cache (and is not expired).
|
|
71
|
-
*
|
|
72
|
-
* @param key - Cache key to check
|
|
73
|
-
* @returns true if key exists and is valid
|
|
74
|
-
*/
|
|
75
|
-
has(key: string): Promise<boolean>;
|
|
76
|
-
/**
|
|
77
|
-
* Delete a cached entry.
|
|
78
|
-
*
|
|
79
|
-
* @param key - Cache key to delete
|
|
80
|
-
* @returns true if entry was deleted, false if not found
|
|
81
|
-
*/
|
|
82
|
-
delete(key: string): Promise<boolean>;
|
|
83
|
-
/**
|
|
84
|
-
* Clear all cached entries.
|
|
85
|
-
*/
|
|
86
|
-
clear(): Promise<void>;
|
|
87
|
-
/**
|
|
88
|
-
* Get cache statistics.
|
|
89
|
-
*/
|
|
90
|
-
getStats(): Promise<CacheStats>;
|
|
91
|
-
/**
|
|
92
|
-
* Clean up expired entries.
|
|
93
|
-
* Returns number of entries removed.
|
|
94
|
-
*/
|
|
95
|
-
cleanup(): Promise<number>;
|
|
96
|
-
/**
|
|
97
|
-
* Close the storage connection.
|
|
98
|
-
* Should be called when the application shuts down.
|
|
99
|
-
*/
|
|
100
|
-
close(): Promise<void>;
|
|
101
|
-
}
|
|
102
|
-
/**
|
|
103
|
-
* Metadata for a cached entry.
|
|
104
|
-
*/
|
|
105
|
-
export interface CacheEntryMetadata {
|
|
106
|
-
/**
|
|
107
|
-
* Cache key.
|
|
108
|
-
*/
|
|
109
|
-
key: string;
|
|
110
|
-
/**
|
|
111
|
-
* Size of the cached data in bytes.
|
|
112
|
-
*/
|
|
113
|
-
size: number;
|
|
114
|
-
/**
|
|
115
|
-
* Timestamp when entry was created (ms since epoch).
|
|
116
|
-
*/
|
|
117
|
-
createdAt: number;
|
|
118
|
-
/**
|
|
119
|
-
* Timestamp when entry expires (ms since epoch).
|
|
120
|
-
*/
|
|
121
|
-
expiresAt: number;
|
|
122
|
-
/**
|
|
123
|
-
* Last access timestamp (ms since epoch).
|
|
124
|
-
*/
|
|
125
|
-
lastAccessedAt: number;
|
|
126
|
-
/**
|
|
127
|
-
* Number of times the entry has been accessed.
|
|
128
|
-
*/
|
|
129
|
-
accessCount: number;
|
|
130
|
-
}
|
|
131
|
-
/**
|
|
132
|
-
* Wrapper around cached data with metadata.
|
|
133
|
-
*/
|
|
134
|
-
export interface CacheEntry<T = ComponentBuildManifest> {
|
|
135
|
-
/**
|
|
136
|
-
* The cached data.
|
|
137
|
-
*/
|
|
138
|
-
data: T;
|
|
139
|
-
/**
|
|
140
|
-
* Entry metadata.
|
|
141
|
-
*/
|
|
142
|
-
metadata: CacheEntryMetadata;
|
|
143
|
-
}
|
|
144
|
-
/**
|
|
145
|
-
* Default storage options.
|
|
146
|
-
*/
|
|
147
|
-
export declare const DEFAULT_STORAGE_OPTIONS: Required<StorageOptions>;
|
|
148
|
-
/**
|
|
149
|
-
* Calculate the size of a manifest in bytes.
|
|
150
|
-
*/
|
|
151
|
-
export declare function calculateManifestSize(manifest: ComponentBuildManifest): number;
|
|
152
|
-
//# sourceMappingURL=interface.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"interface.d.ts","sourceRoot":"","sources":["../../../../src/bundler/file-cache/storage/interface.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,sBAAsB,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAEtF;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB;;;OAGG;IACH,OAAO,CAAC,EA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G;IACH,WAAW,EAAE,MAAM,CAAC;CACrB;AAED;;GAEG;AACH,MAAM,WAAW,UAAU,CAAC,CAAC,GAAG,sBAAsB;IACpD;;OAEG;IACH,IAAI,EAAE,CAAC,CAAC;IAER;;OAEG;IACH,QAAQ,EAAE,kBAAkB,CAAC;CAC9B;AAED;;GAEG;AACH,eAAO,MAAM,uBAAuB,EAAE,QAAQ,CAAC,cAAc,CAK5D,CAAC;AAEF;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,sBAAsB,GAAG,MAAM,CAQ9E"}
|
|
@@ -1,139 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Redis Build Cache Storage
|
|
3
|
-
*
|
|
4
|
-
* Redis-based cache storage for production environments.
|
|
5
|
-
* Uses Redis TTL for expiration and optional compression.
|
|
6
|
-
*
|
|
7
|
-
* @packageDocumentation
|
|
8
|
-
*/
|
|
9
|
-
import type { ComponentBuildManifest, CacheStats } from '@frontmcp/uipack/dependency';
|
|
10
|
-
import type { BuildCacheStorage, StorageOptions } from './interface';
|
|
11
|
-
/**
|
|
12
|
-
* Redis client interface (compatible with ioredis and redis packages).
|
|
13
|
-
*/
|
|
14
|
-
export interface RedisClient {
|
|
15
|
-
get(key: string): Promise<string | null>;
|
|
16
|
-
set(key: string, value: string, mode?: string, duration?: number): Promise<unknown>;
|
|
17
|
-
setex(key: string, seconds: number, value: string): Promise<unknown>;
|
|
18
|
-
del(key: string | string[]): Promise<number>;
|
|
19
|
-
exists(key: string | string[]): Promise<number>;
|
|
20
|
-
keys(pattern: string): Promise<string[]>;
|
|
21
|
-
ttl(key: string): Promise<number>;
|
|
22
|
-
expire(key: string, seconds: number): Promise<number>;
|
|
23
|
-
quit(): Promise<unknown>;
|
|
24
|
-
ping(): Promise<string>;
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* Options specific to Redis storage.
|
|
28
|
-
*/
|
|
29
|
-
export interface RedisStorageOptions extends StorageOptions {
|
|
30
|
-
/**
|
|
31
|
-
* Redis client instance.
|
|
32
|
-
* Must be provided.
|
|
33
|
-
*/
|
|
34
|
-
client: RedisClient;
|
|
35
|
-
/**
|
|
36
|
-
* Key prefix for cache entries.
|
|
37
|
-
* @default 'frontmcp:ui:build:'
|
|
38
|
-
*/
|
|
39
|
-
keyPrefix?: string;
|
|
40
|
-
/**
|
|
41
|
-
* Whether to use JSON.stringify/parse (vs raw storage).
|
|
42
|
-
* @default true
|
|
43
|
-
*/
|
|
44
|
-
json?: boolean;
|
|
45
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
* Redis-based build cache storage.
|
|
48
|
-
*
|
|
49
|
-
* Stores build manifests in Redis with automatic TTL expiration.
|
|
50
|
-
* Suitable for production environments with multiple server instances.
|
|
51
|
-
*
|
|
52
|
-
* @example
|
|
53
|
-
* ```typescript
|
|
54
|
-
* import Redis from 'ioredis';
|
|
55
|
-
*
|
|
56
|
-
* const redis = new Redis(process.env.REDIS_URL);
|
|
57
|
-
* const storage = new RedisStorage({
|
|
58
|
-
* client: redis,
|
|
59
|
-
* keyPrefix: 'myapp:builds:',
|
|
60
|
-
* defaultTtl: 3600, // 1 hour
|
|
61
|
-
* });
|
|
62
|
-
*
|
|
63
|
-
* await storage.initialize();
|
|
64
|
-
* await storage.set('abc123', manifest);
|
|
65
|
-
* ```
|
|
66
|
-
*/
|
|
67
|
-
export declare class RedisStorage implements BuildCacheStorage {
|
|
68
|
-
readonly type = "redis";
|
|
69
|
-
private readonly options;
|
|
70
|
-
private initialized;
|
|
71
|
-
private localStats;
|
|
72
|
-
constructor(options: RedisStorageOptions);
|
|
73
|
-
/**
|
|
74
|
-
* Initialize the Redis connection.
|
|
75
|
-
*/
|
|
76
|
-
initialize(): Promise<void>;
|
|
77
|
-
/**
|
|
78
|
-
* Get a cached manifest.
|
|
79
|
-
*/
|
|
80
|
-
get(key: string): Promise<ComponentBuildManifest | undefined>;
|
|
81
|
-
/**
|
|
82
|
-
* Store a manifest in cache.
|
|
83
|
-
*/
|
|
84
|
-
set(key: string, manifest: ComponentBuildManifest, ttl?: number): Promise<void>;
|
|
85
|
-
/**
|
|
86
|
-
* Check if a key exists.
|
|
87
|
-
*/
|
|
88
|
-
has(key: string): Promise<boolean>;
|
|
89
|
-
/**
|
|
90
|
-
* Delete a cached entry.
|
|
91
|
-
*/
|
|
92
|
-
delete(key: string): Promise<boolean>;
|
|
93
|
-
/**
|
|
94
|
-
* Clear all cached entries.
|
|
95
|
-
*/
|
|
96
|
-
clear(): Promise<void>;
|
|
97
|
-
/**
|
|
98
|
-
* Get cache statistics.
|
|
99
|
-
*/
|
|
100
|
-
getStats(): Promise<CacheStats>;
|
|
101
|
-
/**
|
|
102
|
-
* Clean up expired entries.
|
|
103
|
-
* Redis handles TTL expiration automatically, so this just refreshes stats.
|
|
104
|
-
*/
|
|
105
|
-
cleanup(): Promise<number>;
|
|
106
|
-
/**
|
|
107
|
-
* Close the Redis connection.
|
|
108
|
-
*/
|
|
109
|
-
close(): Promise<void>;
|
|
110
|
-
/**
|
|
111
|
-
* Get the Redis key for a cache key.
|
|
112
|
-
*/
|
|
113
|
-
private getRedisKey;
|
|
114
|
-
/**
|
|
115
|
-
* Get the Redis key for stats.
|
|
116
|
-
*/
|
|
117
|
-
private getStatsKey;
|
|
118
|
-
/**
|
|
119
|
-
* Ensure the storage is initialized.
|
|
120
|
-
*/
|
|
121
|
-
private ensureInitialized;
|
|
122
|
-
/**
|
|
123
|
-
* Load stats from Redis.
|
|
124
|
-
*/
|
|
125
|
-
private loadStats;
|
|
126
|
-
/**
|
|
127
|
-
* Persist stats to Redis.
|
|
128
|
-
*/
|
|
129
|
-
private persistStats;
|
|
130
|
-
/**
|
|
131
|
-
* Update hit rate statistic.
|
|
132
|
-
*/
|
|
133
|
-
private updateHitRate;
|
|
134
|
-
}
|
|
135
|
-
/**
|
|
136
|
-
* Create a Redis storage instance.
|
|
137
|
-
*/
|
|
138
|
-
export declare function createRedisStorage(options: RedisStorageOptions): RedisStorage;
|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B;IAMzB;;OAEG;YACW,SAAS;IAiBvB;;OAEG;YACW,YAAY;IAW1B;;OAEG;IACH,OAAO,CAAC,aAAa;CAItB;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,mBAAmB,GAAG,YAAY,CAE7E"}
|
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Enclave-VM Secure Code Executor
|
|
3
|
-
*
|
|
4
|
-
* Executes bundled code in a secure sandbox using enclave-vm.
|
|
5
|
-
* Provides defense-in-depth security with:
|
|
6
|
-
* - AST-based validation (81+ blocked attack vectors)
|
|
7
|
-
* - Timeout enforcement (default 5000ms)
|
|
8
|
-
* - Resource limits (maxIterations, maxToolCalls)
|
|
9
|
-
* - Six security layers
|
|
10
|
-
*
|
|
11
|
-
* @packageDocumentation
|
|
12
|
-
*/
|
|
13
|
-
import type { SecurityPolicy } from '../types';
|
|
14
|
-
/**
|
|
15
|
-
* Context for code execution.
|
|
16
|
-
*/
|
|
17
|
-
export interface ExecutionContext {
|
|
18
|
-
/**
|
|
19
|
-
* React module to inject.
|
|
20
|
-
*/
|
|
21
|
-
React?: unknown;
|
|
22
|
-
/**
|
|
23
|
-
* ReactDOM module to inject.
|
|
24
|
-
*/
|
|
25
|
-
ReactDOM?: unknown;
|
|
26
|
-
/**
|
|
27
|
-
* Additional modules to inject.
|
|
28
|
-
*/
|
|
29
|
-
modules?: Record<string, unknown>;
|
|
30
|
-
/**
|
|
31
|
-
* Additional global variables.
|
|
32
|
-
*/
|
|
33
|
-
globals?: Record<string, unknown>;
|
|
34
|
-
/**
|
|
35
|
-
* Security policy to enforce.
|
|
36
|
-
*/
|
|
37
|
-
security?: SecurityPolicy;
|
|
38
|
-
/**
|
|
39
|
-
* Execution timeout in milliseconds.
|
|
40
|
-
* @default 5000
|
|
41
|
-
*/
|
|
42
|
-
timeout?: number;
|
|
43
|
-
/**
|
|
44
|
-
* Maximum loop iterations allowed.
|
|
45
|
-
* @default 10000
|
|
46
|
-
*/
|
|
47
|
-
maxIterations?: number;
|
|
48
|
-
}
|
|
49
|
-
/**
|
|
50
|
-
* Result of code execution.
|
|
51
|
-
*/
|
|
52
|
-
export interface ExecutionResult<T = unknown> {
|
|
53
|
-
/**
|
|
54
|
-
* Exported value from the code.
|
|
55
|
-
*/
|
|
56
|
-
exports: T;
|
|
57
|
-
/**
|
|
58
|
-
* Execution time in ms.
|
|
59
|
-
*/
|
|
60
|
-
executionTime: number;
|
|
61
|
-
/**
|
|
62
|
-
* Console output captured during execution.
|
|
63
|
-
*/
|
|
64
|
-
consoleOutput?: string[];
|
|
65
|
-
}
|
|
66
|
-
/**
|
|
67
|
-
* Execute bundled code in a secure enclave-vm sandbox.
|
|
68
|
-
*
|
|
69
|
-
* Provides a sandboxed execution context with:
|
|
70
|
-
* - AST-based code validation (81+ attack vectors blocked)
|
|
71
|
-
* - Timeout enforcement (default 5000ms)
|
|
72
|
-
* - Resource limits (maxIterations)
|
|
73
|
-
* - Six security layers (defense-in-depth)
|
|
74
|
-
*
|
|
75
|
-
* @param code - Bundled JavaScript code
|
|
76
|
-
* @param context - Execution context
|
|
77
|
-
* @returns Execution result with exports
|
|
78
|
-
*
|
|
79
|
-
* @example
|
|
80
|
-
* ```typescript
|
|
81
|
-
* const code = `
|
|
82
|
-
* const React = require('react');
|
|
83
|
-
* function Widget({ data }) {
|
|
84
|
-
* return React.createElement('div', null, data.message);
|
|
85
|
-
* }
|
|
86
|
-
* module.exports = Widget;
|
|
87
|
-
* `;
|
|
88
|
-
*
|
|
89
|
-
* const result = await executeCode(code, {
|
|
90
|
-
* React: require('react'),
|
|
91
|
-
* timeout: 3000,
|
|
92
|
-
* });
|
|
93
|
-
*
|
|
94
|
-
* console.log(result.exports); // Widget function
|
|
95
|
-
* ```
|
|
96
|
-
*/
|
|
97
|
-
export declare function executeCode<T = unknown>(code: string, context?: ExecutionContext): Promise<ExecutionResult<T>>;
|
|
98
|
-
/**
|
|
99
|
-
* Execute bundled code and extract the default export.
|
|
100
|
-
*
|
|
101
|
-
* Convenience wrapper around executeCode that extracts
|
|
102
|
-
* the default export.
|
|
103
|
-
*
|
|
104
|
-
* @param code - Bundled JavaScript code
|
|
105
|
-
* @param context - Execution context
|
|
106
|
-
* @returns Default export from the code
|
|
107
|
-
*/
|
|
108
|
-
export declare function executeDefault<T = unknown>(code: string, context?: ExecutionContext): Promise<T>;
|
|
109
|
-
/**
|
|
110
|
-
* Error thrown during code execution.
|
|
111
|
-
*/
|
|
112
|
-
export declare class ExecutionError extends Error {
|
|
113
|
-
/** Error code for categorization */
|
|
114
|
-
code?: string;
|
|
115
|
-
constructor(message: string, cause?: unknown);
|
|
116
|
-
}
|
|
117
|
-
/**
|
|
118
|
-
* Check if an error is an ExecutionError.
|
|
119
|
-
*/
|
|
120
|
-
export declare function isExecutionError(error: unknown): error is ExecutionError;
|
|
121
|
-
//# sourceMappingURL=enclave-adapter.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"enclave-adapter.d.ts","sourceRoot":"","sources":["../../../src/bundler/sandbox/enclave-adapter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAGH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAE/C;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B;;OAEG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;IAEhB;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAElC;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAElC;;OAEG;IACH,QAAQ,CAAC,EAAE,cAAc,CAAC;IAE1B;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;;OAGG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED;;GAEG;AACH,MAAM,WAAW,eAAe,CAAC,CAAC,GAAG,OAAO;IAC1C;;OAEG;IACH,OAAO,EAAE,CAAC,CAAC;IAEX;;OAEG;IACH,aAAa,EAAE,MAAM,CAAC;IAEtB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;CAC1B;AA6LD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,wBAAsB,WAAW,CAAC,CAAC,GAAG,OAAO,EAC3C,IAAI,EAAE,MAAM,EACZ,OAAO,GAAE,gBAAqB,GAC7B,OAAO,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,CAqH7B;AAED;;;;;;;;;GASG;AACH,wBAAsB,cAAc,CAAC,CAAC,GAAG,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,GAAE,gBAAqB,GAAG,OAAO,CAAC,CAAC,CAAC,CAuB1G;AAED;;GAEG;AACH,qBAAa,cAAe,SAAQ,KAAK;IACvC,oCAAoC;IACpC,IAAI,CAAC,EAAE,MAAM,CAAC;gBAEF,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,OAAO;CAS7C;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,cAAc,CAExE"}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Secure Code Executor
|
|
3
|
-
*
|
|
4
|
-
* Executes bundled code in a secure sandbox using enclave-vm.
|
|
5
|
-
* Provides defense-in-depth security with:
|
|
6
|
-
* - AST-based validation (81+ blocked attack vectors)
|
|
7
|
-
* - Timeout enforcement (default 5000ms)
|
|
8
|
-
* - Resource limits (maxIterations)
|
|
9
|
-
* - Six security layers
|
|
10
|
-
*
|
|
11
|
-
* @packageDocumentation
|
|
12
|
-
*/
|
|
13
|
-
export { executeCode, executeDefault, ExecutionError, isExecutionError, type ExecutionContext, type ExecutionResult, } from './enclave-adapter';
|
|
14
|
-
//# sourceMappingURL=executor.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"executor.d.ts","sourceRoot":"","sources":["../../../src/bundler/sandbox/executor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAGH,OAAO,EACL,WAAW,EACX,cAAc,EACd,cAAc,EACd,gBAAgB,EAChB,KAAK,gBAAgB,EACrB,KAAK,eAAe,GACrB,MAAM,mBAAmB,CAAC"}
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Sandbox Security Policy
|
|
3
|
-
*
|
|
4
|
-
* Defines and validates security policies for bundler execution.
|
|
5
|
-
*
|
|
6
|
-
* @packageDocumentation
|
|
7
|
-
*/
|
|
8
|
-
import type { SecurityPolicy, SecurityViolation } from '../types';
|
|
9
|
-
/**
|
|
10
|
-
* Validate source code against a security policy.
|
|
11
|
-
*
|
|
12
|
-
* @param source - Source code to validate
|
|
13
|
-
* @param policy - Security policy to enforce
|
|
14
|
-
* @returns Array of security violations (empty if valid)
|
|
15
|
-
*
|
|
16
|
-
* @example
|
|
17
|
-
* ```typescript
|
|
18
|
-
* const violations = validateSource(code, DEFAULT_SECURITY_POLICY);
|
|
19
|
-
* if (violations.length > 0) {
|
|
20
|
-
* throw new Error(`Security violations: ${violations.map(v => v.message).join(', ')}`);
|
|
21
|
-
* }
|
|
22
|
-
* ```
|
|
23
|
-
*/
|
|
24
|
-
export declare function validateSource(source: string, policy?: SecurityPolicy): SecurityViolation[];
|
|
25
|
-
/**
|
|
26
|
-
* Validate import statements against policy.
|
|
27
|
-
*
|
|
28
|
-
* @param source - Source code to check
|
|
29
|
-
* @param policy - Security policy
|
|
30
|
-
* @returns Array of import violations
|
|
31
|
-
*/
|
|
32
|
-
export declare function validateImports(source: string, policy?: SecurityPolicy): SecurityViolation[];
|
|
33
|
-
/**
|
|
34
|
-
* Validate bundle size against policy.
|
|
35
|
-
*
|
|
36
|
-
* @param size - Bundle size in bytes
|
|
37
|
-
* @param policy - Security policy
|
|
38
|
-
* @returns Violation if size exceeds limit, undefined otherwise
|
|
39
|
-
*/
|
|
40
|
-
export declare function validateSize(size: number, policy?: SecurityPolicy): SecurityViolation | undefined;
|
|
41
|
-
/**
|
|
42
|
-
* Create a merged security policy with defaults.
|
|
43
|
-
*
|
|
44
|
-
* @param userPolicy - User-provided policy overrides
|
|
45
|
-
* @returns Merged policy with defaults
|
|
46
|
-
*/
|
|
47
|
-
export declare function mergePolicy(userPolicy?: Partial<SecurityPolicy>): SecurityPolicy;
|
|
48
|
-
/**
|
|
49
|
-
* Security error thrown when policy is violated.
|
|
50
|
-
*/
|
|
51
|
-
export declare class SecurityError extends Error {
|
|
52
|
-
readonly violations: SecurityViolation[];
|
|
53
|
-
constructor(message: string, violations: SecurityViolation[]);
|
|
54
|
-
}
|
|
55
|
-
/**
|
|
56
|
-
* Throw if any violations exist.
|
|
57
|
-
*
|
|
58
|
-
* @param violations - Array of violations to check
|
|
59
|
-
* @throws SecurityError if violations exist
|
|
60
|
-
*/
|
|
61
|
-
export declare function throwOnViolations(violations: SecurityViolation[]): void;
|
|
62
|
-
//# sourceMappingURL=policy.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"policy.d.ts","sourceRoot":"","sources":["../../../src/bundler/sandbox/policy.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAoBlE;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,GAAE,cAAwC,GAAG,iBAAiB,EAAE,CAyDpH;AAED;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,GAAE,cAAwC,GAAG,iBAAiB,EAAE,CAqDrH;AAED;;;;;;GAMG;AACH,wBAAgB,YAAY,CAC1B,IAAI,EAAE,MAAM,EACZ,MAAM,GAAE,cAAwC,GAC/C,iBAAiB,GAAG,SAAS,CAY/B;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,UAAU,CAAC,EAAE,OAAO,CAAC,cAAc,CAAC,GAAG,cAAc,CAehF;AAsBD;;GAEG;AACH,qBAAa,aAAc,SAAQ,KAAK;IACtC,QAAQ,CAAC,UAAU,EAAE,iBAAiB,EAAE,CAAC;gBAE7B,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,iBAAiB,EAAE;CAK7D;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,UAAU,EAAE,iBAAiB,EAAE,GAAG,IAAI,CAKvE"}
|
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Base Platform Adapter
|
|
3
|
-
*
|
|
4
|
-
* Abstract base class for platform adapters with default implementations.
|
|
5
|
-
* Extend this class to create custom adapters for new platforms.
|
|
6
|
-
*
|
|
7
|
-
* @packageDocumentation
|
|
8
|
-
*/
|
|
9
|
-
import type { PlatformAdapter, AdapterCapabilities, DisplayMode, UserAgentInfo, SafeAreaInsets, ViewportInfo, HostContext } from '../types';
|
|
10
|
-
/**
|
|
11
|
-
* Default adapter capabilities (most features disabled).
|
|
12
|
-
*/
|
|
13
|
-
export declare const DEFAULT_CAPABILITIES: AdapterCapabilities;
|
|
14
|
-
/**
|
|
15
|
-
* Default safe area insets (no insets).
|
|
16
|
-
*/
|
|
17
|
-
export declare const DEFAULT_SAFE_AREA: SafeAreaInsets;
|
|
18
|
-
/**
|
|
19
|
-
* Abstract base class for platform adapters.
|
|
20
|
-
* Provides default implementations that can be overridden.
|
|
21
|
-
*/
|
|
22
|
-
export declare abstract class BaseAdapter implements PlatformAdapter {
|
|
23
|
-
abstract readonly id: string;
|
|
24
|
-
abstract readonly name: string;
|
|
25
|
-
abstract readonly priority: number;
|
|
26
|
-
protected _capabilities: AdapterCapabilities;
|
|
27
|
-
protected _hostContext: HostContext;
|
|
28
|
-
protected _widgetState: Record<string, unknown>;
|
|
29
|
-
protected _toolInput: Record<string, unknown>;
|
|
30
|
-
protected _toolOutput: unknown;
|
|
31
|
-
protected _structuredContent: unknown;
|
|
32
|
-
protected _initialized: boolean;
|
|
33
|
-
protected _contextListeners: Set<(changes: Partial<HostContext>) => void>;
|
|
34
|
-
protected _toolResultListeners: Set<(result: unknown) => void>;
|
|
35
|
-
constructor();
|
|
36
|
-
get capabilities(): AdapterCapabilities;
|
|
37
|
-
abstract canHandle(): boolean;
|
|
38
|
-
initialize(): Promise<void>;
|
|
39
|
-
dispose(): void;
|
|
40
|
-
getTheme(): 'light' | 'dark';
|
|
41
|
-
getDisplayMode(): DisplayMode;
|
|
42
|
-
getUserAgent(): UserAgentInfo;
|
|
43
|
-
getLocale(): string;
|
|
44
|
-
getToolInput(): Record<string, unknown>;
|
|
45
|
-
getToolOutput(): unknown;
|
|
46
|
-
getStructuredContent(): unknown;
|
|
47
|
-
getWidgetState(): Record<string, unknown>;
|
|
48
|
-
getSafeArea(): SafeAreaInsets;
|
|
49
|
-
getViewport(): ViewportInfo | undefined;
|
|
50
|
-
getHostContext(): HostContext;
|
|
51
|
-
callTool(_name: string, _args: Record<string, unknown>): Promise<unknown>;
|
|
52
|
-
sendMessage(_content: string): Promise<void>;
|
|
53
|
-
openLink(url: string): Promise<void>;
|
|
54
|
-
requestDisplayMode(_mode: DisplayMode): Promise<void>;
|
|
55
|
-
requestClose(): Promise<void>;
|
|
56
|
-
setWidgetState(state: Record<string, unknown>): void;
|
|
57
|
-
onContextChange(callback: (changes: Partial<HostContext>) => void): () => void;
|
|
58
|
-
onToolResult(callback: (result: unknown) => void): () => void;
|
|
59
|
-
/**
|
|
60
|
-
* Create default host context from environment detection.
|
|
61
|
-
*/
|
|
62
|
-
protected _createDefaultHostContext(): HostContext;
|
|
63
|
-
/**
|
|
64
|
-
* Detect theme from CSS media query.
|
|
65
|
-
*/
|
|
66
|
-
protected _detectTheme(): 'light' | 'dark';
|
|
67
|
-
/**
|
|
68
|
-
* Detect locale from navigator.
|
|
69
|
-
*/
|
|
70
|
-
protected _detectLocale(): string;
|
|
71
|
-
/**
|
|
72
|
-
* Detect user agent capabilities.
|
|
73
|
-
*/
|
|
74
|
-
protected _detectUserAgent(): UserAgentInfo;
|
|
75
|
-
/**
|
|
76
|
-
* Detect viewport dimensions.
|
|
77
|
-
*/
|
|
78
|
-
protected _detectViewport(): ViewportInfo | undefined;
|
|
79
|
-
/**
|
|
80
|
-
* Read injected tool data from window globals.
|
|
81
|
-
*/
|
|
82
|
-
protected _readInjectedData(): void;
|
|
83
|
-
/**
|
|
84
|
-
* Load widget state from localStorage.
|
|
85
|
-
*/
|
|
86
|
-
protected _loadWidgetState(): void;
|
|
87
|
-
/**
|
|
88
|
-
* Persist widget state to localStorage.
|
|
89
|
-
*/
|
|
90
|
-
protected _persistWidgetState(): void;
|
|
91
|
-
/**
|
|
92
|
-
* Get localStorage key for widget state.
|
|
93
|
-
*/
|
|
94
|
-
protected _getStateKey(): string;
|
|
95
|
-
/**
|
|
96
|
-
* Notify context change listeners.
|
|
97
|
-
*/
|
|
98
|
-
protected _notifyContextChange(changes: Partial<HostContext>): void;
|
|
99
|
-
/**
|
|
100
|
-
* Notify tool result listeners.
|
|
101
|
-
*/
|
|
102
|
-
protected _notifyToolResult(result: unknown): void;
|
|
103
|
-
}
|
|
104
|
-
//# sourceMappingURL=base-adapter.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"base-adapter.d.ts","sourceRoot":"","sources":["../../../../src/bridge/adapters/base-adapter.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EACV,eAAe,EACf,mBAAmB,EACnB,WAAW,EACX,aAAa,EACb,cAAc,EACd,YAAY,EACZ,WAAW,EACZ,MAAM,UAAU,CAAC;AAElB;;GAEG;AACH,eAAO,MAAM,oBAAoB,EAAE,mBAQlC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,iBAAiB,EAA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