@feltdb/core 0.2.0 → 0.4.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/LICENSE +19 -0
- package/dist/analytics-backend.d.ts +39 -0
- package/dist/analytics-backend.d.ts.map +1 -0
- package/dist/analytics-backend.js +152 -0
- package/dist/application-contract.d.ts +49 -0
- package/dist/application-contract.d.ts.map +1 -0
- package/dist/application-contract.js +13 -0
- package/dist/application-manifest.d.ts +305 -0
- package/dist/application-manifest.d.ts.map +1 -0
- package/dist/application-manifest.js +26 -0
- package/dist/artifact.d.ts +73 -0
- package/dist/artifact.d.ts.map +1 -0
- package/dist/artifact.js +21 -0
- package/dist/authorization.d.ts +99 -0
- package/dist/authorization.d.ts.map +1 -0
- package/dist/authorization.js +15 -0
- package/dist/bundle.d.ts +55 -0
- package/dist/bundle.d.ts.map +1 -0
- package/dist/bundle.js +13 -0
- package/dist/collection.d.ts +28 -0
- package/dist/collection.d.ts.map +1 -1
- package/dist/collection.js +83 -0
- package/dist/db.d.ts +18 -0
- package/dist/db.d.ts.map +1 -1
- package/dist/db.js +20 -8
- package/dist/distributed-indexing.d.ts +170 -0
- package/dist/distributed-indexing.d.ts.map +1 -0
- package/dist/distributed-indexing.js +260 -0
- package/dist/flowspec.d.ts +4 -0
- package/dist/flowspec.d.ts.map +1 -1
- package/dist/flowspec.js +8 -0
- package/dist/http-client.d.ts +35 -0
- package/dist/http-client.d.ts.map +1 -0
- package/dist/http-client.js +70 -0
- package/dist/identity.d.ts +40 -0
- package/dist/identity.d.ts.map +1 -0
- package/dist/identity.js +10 -0
- package/dist/index-analytics.d.ts +121 -0
- package/dist/index-analytics.d.ts.map +1 -0
- package/dist/index-analytics.js +279 -0
- package/dist/index-backend.d.ts +26 -0
- package/dist/index-backend.d.ts.map +1 -0
- package/dist/index-backend.js +115 -0
- package/dist/index-dashboard.d.ts +114 -0
- package/dist/index-dashboard.d.ts.map +1 -0
- package/dist/index-dashboard.js +256 -0
- package/dist/index-manager.d.ts +18 -0
- package/dist/index-manager.d.ts.map +1 -0
- package/dist/index-manager.js +333 -0
- package/dist/index-monitoring.d.ts +133 -0
- package/dist/index-monitoring.d.ts.map +1 -0
- package/dist/index-monitoring.js +218 -0
- package/dist/index-recovery.d.ts +57 -0
- package/dist/index-recovery.d.ts.map +1 -0
- package/dist/index-recovery.js +117 -0
- package/dist/index-store.d.ts +62 -0
- package/dist/index-store.d.ts.map +1 -0
- package/dist/index-store.js +141 -0
- package/dist/index-types.d.ts +70 -0
- package/dist/index-types.d.ts.map +1 -0
- package/dist/index-types.js +6 -0
- package/dist/index.d.ts +26 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +26 -0
- package/dist/observe.d.ts +51 -0
- package/dist/observe.d.ts.map +1 -0
- package/dist/observe.js +14 -0
- package/dist/protocol.d.ts +25 -0
- package/dist/protocol.d.ts.map +1 -0
- package/dist/protocol.js +18 -0
- package/dist/provider.d.ts +61 -0
- package/dist/provider.d.ts.map +1 -0
- package/dist/provider.js +17 -0
- package/dist/query-planner.d.ts +69 -0
- package/dist/query-planner.d.ts.map +1 -0
- package/dist/query-planner.js +184 -0
- package/dist/release.d.ts +60 -0
- package/dist/release.d.ts.map +1 -0
- package/dist/release.js +18 -0
- package/dist/sharding.d.ts +159 -0
- package/dist/sharding.d.ts.map +1 -0
- package/dist/sharding.js +317 -0
- package/dist/state-contract.d.ts +173 -0
- package/dist/state-contract.d.ts.map +1 -0
- package/dist/state-contract.js +24 -0
- package/dist/sync-contract.d.ts +101 -0
- package/dist/sync-contract.d.ts.map +1 -0
- package/dist/sync-contract.js +90 -0
- package/dist/worker.d.ts +90 -0
- package/dist/worker.d.ts.map +1 -0
- package/dist/worker.js +26 -0
- package/dist/workload.d.ts +102 -0
- package/dist/workload.d.ts.map +1 -0
- package/dist/workload.js +23 -0
- package/package.json +17 -5
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Index Persistence Layer
|
|
3
|
+
*
|
|
4
|
+
* Handles serialization and storage of indexes for durability.
|
|
5
|
+
* Indexes are stored in a special collection alongside application data.
|
|
6
|
+
*/
|
|
7
|
+
export class IndexStore {
|
|
8
|
+
constructor(db, collectionName) {
|
|
9
|
+
this.db = db;
|
|
10
|
+
this.collectionName = collectionName;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Save index metadata to storage.
|
|
14
|
+
* Stores index configuration but not the actual index data (rebuilt on demand).
|
|
15
|
+
*/
|
|
16
|
+
async saveIndexConfig(config, entryCount) {
|
|
17
|
+
const key = `__indexes__:${this.collectionName}:${config.name}`;
|
|
18
|
+
const stored = {
|
|
19
|
+
config,
|
|
20
|
+
version: 1,
|
|
21
|
+
createdAt: Date.now(),
|
|
22
|
+
lastUpdated: Date.now(),
|
|
23
|
+
entryCount,
|
|
24
|
+
};
|
|
25
|
+
const result = await this.db.insert(key, JSON.stringify(stored));
|
|
26
|
+
if (!result.success) {
|
|
27
|
+
console.warn(`Failed to save index config for ${config.name}: ${result.error}`);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Load all index configurations for a collection.
|
|
32
|
+
*/
|
|
33
|
+
async loadIndexConfigs() {
|
|
34
|
+
const result = await this.db.query(`__indexes__:${this.collectionName}`);
|
|
35
|
+
if (!result.success || !result.data) {
|
|
36
|
+
return [];
|
|
37
|
+
}
|
|
38
|
+
try {
|
|
39
|
+
const stored = JSON.parse(result.data);
|
|
40
|
+
return stored.map(s => s.config);
|
|
41
|
+
}
|
|
42
|
+
catch {
|
|
43
|
+
console.warn(`Failed to parse index configs for ${this.collectionName}`);
|
|
44
|
+
return [];
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Get specific index configuration.
|
|
49
|
+
*/
|
|
50
|
+
async getIndexConfig(indexName) {
|
|
51
|
+
const key = `__indexes__:${this.collectionName}:${indexName}`;
|
|
52
|
+
const result = await this.db.get(key);
|
|
53
|
+
if (!result.success || !result.data) {
|
|
54
|
+
return null;
|
|
55
|
+
}
|
|
56
|
+
try {
|
|
57
|
+
const stored = JSON.parse(result.data);
|
|
58
|
+
return stored.config;
|
|
59
|
+
}
|
|
60
|
+
catch {
|
|
61
|
+
return null;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Delete index metadata from storage.
|
|
66
|
+
*/
|
|
67
|
+
async deleteIndexConfig(indexName) {
|
|
68
|
+
const key = `__indexes__:${this.collectionName}:${indexName}`;
|
|
69
|
+
if (!this.db.delete) {
|
|
70
|
+
console.warn(`Failed to delete index config for ${indexName}: delete is not supported`);
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
const deleteResult = this.db.delete(key);
|
|
74
|
+
const result = deleteResult instanceof Promise ? await deleteResult : deleteResult;
|
|
75
|
+
if (!result?.success) {
|
|
76
|
+
console.warn(`Failed to delete index config for ${indexName}: ${result?.error}`);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Update index metadata (entry count, timestamp).
|
|
81
|
+
*/
|
|
82
|
+
async updateIndexStats(indexName, entryCount) {
|
|
83
|
+
const key = `__indexes__:${this.collectionName}:${indexName}`;
|
|
84
|
+
const result = await this.db.get(key);
|
|
85
|
+
if (!result.success || !result.data) {
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
try {
|
|
89
|
+
const stored = JSON.parse(result.data);
|
|
90
|
+
stored.lastUpdated = Date.now();
|
|
91
|
+
stored.entryCount = entryCount;
|
|
92
|
+
await this.db.insert(key, JSON.stringify(stored));
|
|
93
|
+
}
|
|
94
|
+
catch {
|
|
95
|
+
console.warn(`Failed to update index stats for ${indexName}`);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Get full index snapshot (configuration + metadata).
|
|
100
|
+
*/
|
|
101
|
+
async getSnapshot() {
|
|
102
|
+
const configs = await this.loadIndexConfigs();
|
|
103
|
+
return {
|
|
104
|
+
collectionName: this.collectionName,
|
|
105
|
+
indexes: configs.map(config => ({
|
|
106
|
+
config,
|
|
107
|
+
version: 1,
|
|
108
|
+
createdAt: Date.now(),
|
|
109
|
+
lastUpdated: Date.now(),
|
|
110
|
+
entryCount: 0,
|
|
111
|
+
})),
|
|
112
|
+
timestamp: Date.now(),
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Index rebuilder - reconstructs indexes from collection data.
|
|
118
|
+
* Used when loading persisted indexes at startup.
|
|
119
|
+
*/
|
|
120
|
+
export class IndexRebuilder {
|
|
121
|
+
static async rebuildIndexes(db, collectionName, items, indexConfigs) {
|
|
122
|
+
const indexes = new Map();
|
|
123
|
+
for (const config of indexConfigs) {
|
|
124
|
+
// For now, just track that we need to rebuild these indexes.
|
|
125
|
+
// Actual rebuilding happens in the IndexBackend when collections initialize.
|
|
126
|
+
indexes.set(config.name, {
|
|
127
|
+
config,
|
|
128
|
+
needsRebuild: true,
|
|
129
|
+
itemCount: items.length,
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
return indexes;
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Check if an index is stale by comparing entry count to collection size.
|
|
136
|
+
*/
|
|
137
|
+
static isStale(indexEntryCount, collectionSize) {
|
|
138
|
+
// If entry count is significantly less than collection size, index is likely stale
|
|
139
|
+
return indexEntryCount < collectionSize * 0.9;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Index Types and Interfaces
|
|
3
|
+
*
|
|
4
|
+
* Defines the contract for different index types and query strategies.
|
|
5
|
+
*/
|
|
6
|
+
export type IndexType = 'hash' | 'sorted' | 'compound' | 'text';
|
|
7
|
+
export interface IndexConfig {
|
|
8
|
+
/** Unique name for this index */
|
|
9
|
+
name: string;
|
|
10
|
+
/** Type of index (hash, sorted, compound, text) */
|
|
11
|
+
type: IndexType;
|
|
12
|
+
/** For single-field indexes: the field name */
|
|
13
|
+
field?: string;
|
|
14
|
+
/** For compound indexes: array of field names */
|
|
15
|
+
fields?: string[];
|
|
16
|
+
/** For text indexes: fields to search */
|
|
17
|
+
textFields?: string[];
|
|
18
|
+
/** Whether to maintain the index in-memory */
|
|
19
|
+
inmemory?: boolean;
|
|
20
|
+
/** Whether to persist this index to storage */
|
|
21
|
+
persistent?: boolean;
|
|
22
|
+
/** Optional description */
|
|
23
|
+
description?: string;
|
|
24
|
+
}
|
|
25
|
+
export interface IndexEntry<K = any, V = any> {
|
|
26
|
+
key: K;
|
|
27
|
+
values: V[];
|
|
28
|
+
count: number;
|
|
29
|
+
}
|
|
30
|
+
export interface IndexQuery {
|
|
31
|
+
field: string;
|
|
32
|
+
operator: 'eq' | 'gt' | 'gte' | 'lt' | 'lte' | 'in' | 'contains' | 'startsWith' | 'range';
|
|
33
|
+
value?: any;
|
|
34
|
+
values?: any[];
|
|
35
|
+
min?: any;
|
|
36
|
+
max?: any;
|
|
37
|
+
}
|
|
38
|
+
export interface IndexScanPlan {
|
|
39
|
+
indexName: string;
|
|
40
|
+
indexType: IndexType;
|
|
41
|
+
estimatedRows: number;
|
|
42
|
+
cost: number;
|
|
43
|
+
canPruneAll: boolean;
|
|
44
|
+
requiresPostFilter: boolean;
|
|
45
|
+
}
|
|
46
|
+
export interface QueryPlan {
|
|
47
|
+
strategy: 'full-scan' | 'index-scan' | 'index-merge' | 'index-join';
|
|
48
|
+
indexes: IndexScanPlan[];
|
|
49
|
+
estimatedRows: number;
|
|
50
|
+
totalCost: number;
|
|
51
|
+
explanation: string;
|
|
52
|
+
}
|
|
53
|
+
export interface IndexStats {
|
|
54
|
+
name: string;
|
|
55
|
+
type: IndexType;
|
|
56
|
+
entries: number;
|
|
57
|
+
size: number;
|
|
58
|
+
lastUpdated: number;
|
|
59
|
+
reads: number;
|
|
60
|
+
writes: number;
|
|
61
|
+
selectivity: number;
|
|
62
|
+
}
|
|
63
|
+
export interface IndexResult<T> {
|
|
64
|
+
recordIds: string[];
|
|
65
|
+
count: number;
|
|
66
|
+
indexUsed: string;
|
|
67
|
+
executionTimeMs: number;
|
|
68
|
+
cost: number;
|
|
69
|
+
}
|
|
70
|
+
//# sourceMappingURL=index-types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-types.d.ts","sourceRoot":"","sources":["../src/index-types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,MAAM,MAAM,SAAS,GAAG,MAAM,GAAG,QAAQ,GAAG,UAAU,GAAG,MAAM,CAAC;AAEhE,MAAM,WAAW,WAAW;IAC1B,iCAAiC;IACjC,IAAI,EAAE,MAAM,CAAC;IAEb,mDAAmD;IACnD,IAAI,EAAE,SAAS,CAAC;IAEhB,+CAA+C;IAC/C,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf,iDAAiD;IACjD,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAElB,yCAAyC;IACzC,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IAEtB,8CAA8C;IAC9C,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB,+CAA+C;IAC/C,UAAU,CAAC,EAAE,OAAO,CAAC;IAErB,2BAA2B;IAC3B,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,UAAU,CAAC,CAAC,GAAG,GAAG,EAAE,CAAC,GAAG,GAAG;IAC1C,GAAG,EAAE,CAAC,CAAC;IACP,MAAM,EAAE,CAAC,EAAE,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,UAAU;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,IAAI,GAAG,IAAI,GAAG,KAAK,GAAG,IAAI,GAAG,KAAK,GAAG,IAAI,GAAG,UAAU,GAAG,YAAY,GAAG,OAAO,CAAC;IAC1F,KAAK,CAAC,EAAE,GAAG,CAAC;IACZ,MAAM,CAAC,EAAE,GAAG,EAAE,CAAC;IACf,GAAG,CAAC,EAAE,GAAG,CAAC;IACV,GAAG,CAAC,EAAE,GAAG,CAAC;CACX;AAED,MAAM,WAAW,aAAa;IAC5B,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,SAAS,CAAC;IACrB,aAAa,EAAE,MAAM,CAAC;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,OAAO,CAAC;IACrB,kBAAkB,EAAE,OAAO,CAAC;CAC7B;AAED,MAAM,WAAW,SAAS;IACxB,QAAQ,EAAE,WAAW,GAAG,YAAY,GAAG,aAAa,GAAG,YAAY,CAAC;IACpE,OAAO,EAAE,aAAa,EAAE,CAAC;IACzB,aAAa,EAAE,MAAM,CAAC;IACtB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,SAAS,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,WAAW,CAAC,CAAC;IAC5B,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,eAAe,EAAE,MAAM,CAAC;IACxB,IAAI,EAAE,MAAM,CAAC;CACd"}
|
package/dist/index.d.ts
CHANGED
|
@@ -8,14 +8,40 @@
|
|
|
8
8
|
export * from './db.js';
|
|
9
9
|
export * from './collection.js';
|
|
10
10
|
export * from './reactive-graph.js';
|
|
11
|
+
export * from './index-types.js';
|
|
12
|
+
export * from './index-backend.js';
|
|
13
|
+
export * from './index-store.js';
|
|
14
|
+
export * from './index-recovery.js';
|
|
15
|
+
export * from './query-planner.js';
|
|
16
|
+
export * from './index-analytics.js';
|
|
17
|
+
export * from './analytics-backend.js';
|
|
18
|
+
export * from './index-dashboard.js';
|
|
19
|
+
export * from './index-monitoring.js';
|
|
20
|
+
export * from './distributed-indexing.js';
|
|
21
|
+
export * from './sharding.js';
|
|
11
22
|
export * from './recovery.js';
|
|
12
23
|
export * from './execution.js';
|
|
13
24
|
export * from './workflow.js';
|
|
14
25
|
export * from './capability.js';
|
|
15
26
|
export * from './memory-db.js';
|
|
16
27
|
export * from './http-db.js';
|
|
28
|
+
export * from './http-client.js';
|
|
17
29
|
export * from './indexeddb-db.js';
|
|
18
30
|
export * from './flowspec.js';
|
|
31
|
+
export * from './application-manifest.js';
|
|
32
|
+
export * from './state-contract.js';
|
|
33
|
+
export * from './authorization.js';
|
|
34
|
+
export * from './sync-contract.js';
|
|
35
|
+
export * from './workload.js';
|
|
36
|
+
export * from './worker.js';
|
|
37
|
+
export * from './artifact.js';
|
|
38
|
+
export * from './bundle.js';
|
|
39
|
+
export * from './release.js';
|
|
40
|
+
export * from './observe.js';
|
|
41
|
+
export * from './provider.js';
|
|
42
|
+
export * from './identity.js';
|
|
43
|
+
export * from './application-contract.js';
|
|
44
|
+
export { ProtocolHandler, type Message, type Operation as ProtocolOperation, type Response as ProtocolResponse, } from './protocol.js';
|
|
19
45
|
/**
|
|
20
46
|
* Agent Runtime APIs
|
|
21
47
|
*/
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,cAAc,SAAS,CAAC;AACxB,cAAc,iBAAiB,CAAC;AAChC,cAAc,qBAAqB,CAAC;AACpC,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,C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eAAe,CAAC;AAEvB;;GAEG;AACH,cAAc,YAAY,CAAC;AAC3B,cAAc,wBAAwB,CAAC;AACvC,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AAEnC;;GAEG;AACH,YAAY,EACV,eAAe,EACf,cAAc,EACd,cAAc,EACd,kBAAkB,EAClB,kBAAkB,GACnB,MAAM,SAAS,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -8,14 +8,40 @@
|
|
|
8
8
|
export * from './db.js';
|
|
9
9
|
export * from './collection.js';
|
|
10
10
|
export * from './reactive-graph.js';
|
|
11
|
+
export * from './index-types.js';
|
|
12
|
+
export * from './index-backend.js';
|
|
13
|
+
export * from './index-store.js';
|
|
14
|
+
export * from './index-recovery.js';
|
|
15
|
+
export * from './query-planner.js';
|
|
16
|
+
export * from './index-analytics.js';
|
|
17
|
+
export * from './analytics-backend.js';
|
|
18
|
+
export * from './index-dashboard.js';
|
|
19
|
+
export * from './index-monitoring.js';
|
|
20
|
+
export * from './distributed-indexing.js';
|
|
21
|
+
export * from './sharding.js';
|
|
11
22
|
export * from './recovery.js';
|
|
12
23
|
export * from './execution.js';
|
|
13
24
|
export * from './workflow.js';
|
|
14
25
|
export * from './capability.js';
|
|
15
26
|
export * from './memory-db.js';
|
|
16
27
|
export * from './http-db.js';
|
|
28
|
+
export * from './http-client.js';
|
|
17
29
|
export * from './indexeddb-db.js';
|
|
18
30
|
export * from './flowspec.js';
|
|
31
|
+
export * from './application-manifest.js';
|
|
32
|
+
export * from './state-contract.js';
|
|
33
|
+
export * from './authorization.js';
|
|
34
|
+
export * from './sync-contract.js';
|
|
35
|
+
export * from './workload.js';
|
|
36
|
+
export * from './worker.js';
|
|
37
|
+
export * from './artifact.js';
|
|
38
|
+
export * from './bundle.js';
|
|
39
|
+
export * from './release.js';
|
|
40
|
+
export * from './observe.js';
|
|
41
|
+
export * from './provider.js';
|
|
42
|
+
export * from './identity.js';
|
|
43
|
+
export * from './application-contract.js';
|
|
44
|
+
export { ProtocolHandler, } from './protocol.js';
|
|
19
45
|
/**
|
|
20
46
|
* Agent Runtime APIs
|
|
21
47
|
*/
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
export interface CausalEvent {
|
|
2
|
+
event_id: string;
|
|
3
|
+
causal_id: string;
|
|
4
|
+
parent_event_id?: string;
|
|
5
|
+
timestamp: number;
|
|
6
|
+
tenant_id: string;
|
|
7
|
+
application_id: string;
|
|
8
|
+
revision_id?: string;
|
|
9
|
+
subject_id: string;
|
|
10
|
+
subject_type: string;
|
|
11
|
+
authorization_decision_id?: string;
|
|
12
|
+
capability?: string;
|
|
13
|
+
resource?: string;
|
|
14
|
+
operation: string;
|
|
15
|
+
workload_id?: string;
|
|
16
|
+
attempt_id?: string;
|
|
17
|
+
worker_id?: string;
|
|
18
|
+
connection_id?: string;
|
|
19
|
+
execution_id?: string;
|
|
20
|
+
state_version?: string;
|
|
21
|
+
operation_ids: string[];
|
|
22
|
+
artifact_ids: string[];
|
|
23
|
+
result_id?: string;
|
|
24
|
+
status: string;
|
|
25
|
+
error_code?: string;
|
|
26
|
+
metadata: Record<string, unknown>;
|
|
27
|
+
schema_version: number;
|
|
28
|
+
}
|
|
29
|
+
export declare class ObserveClient {
|
|
30
|
+
private baseUrl;
|
|
31
|
+
private fetcher;
|
|
32
|
+
constructor(baseUrl?: string, fetcher?: typeof fetch);
|
|
33
|
+
private json;
|
|
34
|
+
events(applicationId: string): Promise<{
|
|
35
|
+
events: CausalEvent[];
|
|
36
|
+
}>;
|
|
37
|
+
cause(causalId: string): Promise<{
|
|
38
|
+
events: CausalEvent[];
|
|
39
|
+
}>;
|
|
40
|
+
workload(workloadId: string): Promise<{
|
|
41
|
+
events: CausalEvent[];
|
|
42
|
+
}>;
|
|
43
|
+
execution(executionId: string): Promise<{
|
|
44
|
+
events: CausalEvent[];
|
|
45
|
+
}>;
|
|
46
|
+
revision(revisionId: string): Promise<{
|
|
47
|
+
events: CausalEvent[];
|
|
48
|
+
}>;
|
|
49
|
+
append(event: CausalEvent): Promise<CausalEvent>;
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=observe.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"observe.d.ts","sourceRoot":"","sources":["../src/observe.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,WAAW;IAAC,QAAQ,EAAC,MAAM,CAAC;IAAA,SAAS,EAAC,MAAM,CAAC;IAAA,eAAe,CAAC,EAAC,MAAM,CAAC;IAAA,SAAS,EAAC,MAAM,CAAC;IAAA,SAAS,EAAC,MAAM,CAAC;IAAA,cAAc,EAAC,MAAM,CAAC;IAAA,WAAW,CAAC,EAAC,MAAM,CAAC;IAAA,UAAU,EAAC,MAAM,CAAC;IAAA,YAAY,EAAC,MAAM,CAAC;IAAA,yBAAyB,CAAC,EAAC,MAAM,CAAC;IAAA,UAAU,CAAC,EAAC,MAAM,CAAC;IAAA,QAAQ,CAAC,EAAC,MAAM,CAAC;IAAA,SAAS,EAAC,MAAM,CAAC;IAAA,WAAW,CAAC,EAAC,MAAM,CAAC;IAAA,UAAU,CAAC,EAAC,MAAM,CAAC;IAAA,SAAS,CAAC,EAAC,MAAM,CAAC;IAAA,aAAa,CAAC,EAAC,MAAM,CAAC;IAAA,YAAY,CAAC,EAAC,MAAM,CAAC;IAAA,aAAa,CAAC,EAAC,MAAM,CAAC;IAAA,aAAa,EAAC,MAAM,EAAE,CAAC;IAAA,YAAY,EAAC,MAAM,EAAE,CAAC;IAAA,SAAS,CAAC,EAAC,MAAM,CAAC;IAAA,MAAM,EAAC,MAAM,CAAC;IAAA,UAAU,CAAC,EAAC,MAAM,CAAC;IAAA,QAAQ,EAAC,MAAM,CAAC,MAAM,EAAC,OAAO,CAAC,CAAC;IAAA,cAAc,EAAC,MAAM,CAAA;CAAC;AAC/iB,qBAAa,aAAa;IAAa,OAAO,CAAC,OAAO;IAAI,OAAO,CAAC,OAAO;gBAA1B,OAAO,SAAG,EAAS,OAAO,GAAC,OAAO,KAAW;YAAiB,IAAI;IAA+R,MAAM,CAAC,aAAa,EAAC,MAAM;gBAA2B,WAAW,EAAE;;IAAmF,KAAK,CAAC,QAAQ,EAAC,MAAM;gBAA2B,WAAW,EAAE;;IAA+D,QAAQ,CAAC,UAAU,EAAC,MAAM;gBAA2B,WAAW,EAAE;;IAA6E,SAAS,CAAC,WAAW,EAAC,MAAM;gBAA2B,WAAW,EAAE;;IAA+E,QAAQ,CAAC,UAAU,EAAC,MAAM;gBAA2B,WAAW,EAAE;;IAA6E,MAAM,CAAC,KAAK,EAAC,WAAW;CAA0G"}
|
package/dist/observe.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export class ObserveClient {
|
|
2
|
+
constructor(baseUrl = '', fetcher = fetch) {
|
|
3
|
+
this.baseUrl = baseUrl;
|
|
4
|
+
this.fetcher = fetcher;
|
|
5
|
+
}
|
|
6
|
+
async json(path, init) { const r = await this.fetcher(`${this.baseUrl}${path}`, { credentials: 'include', headers: { 'content-type': 'application/json' }, ...init }); const v = await r.json(); if (!r.ok)
|
|
7
|
+
throw new Error(v?.error || `Observe request failed (${r.status})`); return v; }
|
|
8
|
+
events(applicationId) { return this.json(`/v1/observability/events?application_id=${encodeURIComponent(applicationId)}`); }
|
|
9
|
+
cause(causalId) { return this.json(`/v1/observability/causes/${encodeURIComponent(causalId)}`); }
|
|
10
|
+
workload(workloadId) { return this.json(`/v1/observability/workloads/${encodeURIComponent(workloadId)}/timeline`); }
|
|
11
|
+
execution(executionId) { return this.json(`/v1/observability/executions/${encodeURIComponent(executionId)}/timeline`); }
|
|
12
|
+
revision(revisionId) { return this.json(`/v1/observability/revisions/${encodeURIComponent(revisionId)}/timeline`); }
|
|
13
|
+
append(event) { return this.json('/v1/observability/events', { method: 'POST', body: JSON.stringify({ event }) }); }
|
|
14
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* FeltDB Protocol - Low-level communication protocol
|
|
3
|
+
*/
|
|
4
|
+
export interface Message {
|
|
5
|
+
type: string;
|
|
6
|
+
payload: any;
|
|
7
|
+
id?: string;
|
|
8
|
+
}
|
|
9
|
+
export interface Operation {
|
|
10
|
+
type: 'insert' | 'update' | 'delete' | 'query';
|
|
11
|
+
collection?: string;
|
|
12
|
+
data?: any;
|
|
13
|
+
id?: string;
|
|
14
|
+
}
|
|
15
|
+
export interface Response {
|
|
16
|
+
success: boolean;
|
|
17
|
+
data?: any;
|
|
18
|
+
error?: string;
|
|
19
|
+
}
|
|
20
|
+
export declare class ProtocolHandler {
|
|
21
|
+
static encode(message: Message): string;
|
|
22
|
+
static decode(data: string): Message;
|
|
23
|
+
static createOperation(op: Operation): Message;
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=protocol.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"protocol.d.ts","sourceRoot":"","sources":["../src/protocol.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,MAAM,WAAW,OAAO;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,GAAG,CAAC;IACb,EAAE,CAAC,EAAE,MAAM,CAAC;CACb;AAED,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,QAAQ,GAAG,QAAQ,GAAG,QAAQ,GAAG,OAAO,CAAC;IAC/C,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,IAAI,CAAC,EAAE,GAAG,CAAC;IACX,EAAE,CAAC,EAAE,MAAM,CAAC;CACb;AAED,MAAM,WAAW,QAAQ;IACvB,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,CAAC,EAAE,GAAG,CAAC;IACX,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,qBAAa,eAAe;IAC1B,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM;IAIvC,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;IAIpC,MAAM,CAAC,eAAe,CAAC,EAAE,EAAE,SAAS,GAAG,OAAO;CAO/C"}
|
package/dist/protocol.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* FeltDB Protocol - Low-level communication protocol
|
|
3
|
+
*/
|
|
4
|
+
export class ProtocolHandler {
|
|
5
|
+
static encode(message) {
|
|
6
|
+
return JSON.stringify(message);
|
|
7
|
+
}
|
|
8
|
+
static decode(data) {
|
|
9
|
+
return JSON.parse(data);
|
|
10
|
+
}
|
|
11
|
+
static createOperation(op) {
|
|
12
|
+
return {
|
|
13
|
+
type: 'operation',
|
|
14
|
+
payload: op,
|
|
15
|
+
id: `op-${Date.now()}`,
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
export type ProviderType = 'connection' | 'storage' | 'search' | 'vector' | 'llm' | 'embedding' | 'identity' | 'delivery' | 'worker' | 'execution' | 'scheduler' | 'deployment' | 'observability' | 'ui' | 'workflow' | 'capability' | 'agent';
|
|
2
|
+
export type ProviderStatus = 'INSTALLED' | 'AVAILABLE' | 'ENABLED' | 'DISABLED' | 'REVOKED' | 'UPGRADE_PENDING' | 'FAILED';
|
|
3
|
+
export interface ProviderManifest {
|
|
4
|
+
provider_id: string;
|
|
5
|
+
namespace: string;
|
|
6
|
+
provider_type: ProviderType;
|
|
7
|
+
version: string;
|
|
8
|
+
feltdb_contract: string;
|
|
9
|
+
capabilities: string[];
|
|
10
|
+
permissions: string[];
|
|
11
|
+
environments: string[];
|
|
12
|
+
runtimes: string[];
|
|
13
|
+
dependencies: Record<string, string>;
|
|
14
|
+
configuration_schema: unknown;
|
|
15
|
+
secret_requirements: string[];
|
|
16
|
+
migration_required: boolean;
|
|
17
|
+
publisher: string;
|
|
18
|
+
package_ref: string;
|
|
19
|
+
package_hash: string;
|
|
20
|
+
signature?: string;
|
|
21
|
+
}
|
|
22
|
+
export interface InstalledProvider {
|
|
23
|
+
manifest: ProviderManifest;
|
|
24
|
+
status: ProviderStatus;
|
|
25
|
+
installed_at: number;
|
|
26
|
+
tenant_bindings: string[];
|
|
27
|
+
application_bindings: string[];
|
|
28
|
+
granted_capabilities: string[];
|
|
29
|
+
configuration_revision?: string;
|
|
30
|
+
health: {
|
|
31
|
+
status: string;
|
|
32
|
+
ready: boolean;
|
|
33
|
+
version: string;
|
|
34
|
+
last_invocation?: number;
|
|
35
|
+
last_failure?: string;
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
export declare class ProviderClient {
|
|
39
|
+
private baseUrl;
|
|
40
|
+
private fetcher;
|
|
41
|
+
constructor(baseUrl?: string, fetcher?: typeof fetch);
|
|
42
|
+
private json;
|
|
43
|
+
list(): Promise<{
|
|
44
|
+
providers: InstalledProvider[];
|
|
45
|
+
}>;
|
|
46
|
+
inspect(id: string): Promise<InstalledProvider>;
|
|
47
|
+
install(manifest: ProviderManifest, tenantId?: string, applicationId?: string): Promise<InstalledProvider>;
|
|
48
|
+
enable(id: string): Promise<InstalledProvider>;
|
|
49
|
+
disable(id: string): Promise<InstalledProvider>;
|
|
50
|
+
revoke(id: string): Promise<InstalledProvider>;
|
|
51
|
+
status(id: string, status: ProviderStatus): Promise<InstalledProvider>;
|
|
52
|
+
health(id: string): Promise<{
|
|
53
|
+
status: string;
|
|
54
|
+
ready: boolean;
|
|
55
|
+
version: string;
|
|
56
|
+
last_invocation?: number;
|
|
57
|
+
last_failure?: string;
|
|
58
|
+
}>;
|
|
59
|
+
dependencies(id: string): Promise<Record<string, string>>;
|
|
60
|
+
}
|
|
61
|
+
//# sourceMappingURL=provider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../src/provider.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,YAAY,GAAC,YAAY,GAAC,SAAS,GAAC,QAAQ,GAAC,QAAQ,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EAAC,OAAO,CAAC;QAAA,OAAO,EAAC,MAAM,CAAC;QAAA,eAAe,CAAC,EAAC,MAAM,CAAC;QAAA,YAAY,CAAC,EAAC,MAAM,CAAA;KAAC,CAAA;CAAC;AAC5T,qBAAa,cAAc;IAAa,OAAO,CAAC,OAAO;IAAI,OAAO,CAAC,OAAO;gBAA1B,OAAO,SAAG,EAAS,OAAO,GAAC,OAAO,KAAW;YAAiB,IAAI;IAAgS,IAAI;mBAA+B,iBAAiB,EAAE;;IAAoB,OAAO,CAAC,EAAE,EAAC,MAAM;IAAiF,OAAO,CAAC,QAAQ,EAAC,gBAAgB,EAAC,QAAQ,CAAC,EAAC,MAAM,EAAC,aAAa,CAAC,EAAC,MAAM;IAAuJ,MAAM,CAAC,EAAE,EAAC,MAAM;IAAmC,OAAO,CAAC,EAAE,EAAC,MAAM;IAAoC,MAAM,CAAC,EAAE,EAAC,MAAM;IAAmC,MAAM,CAAC,EAAE,EAAC,MAAM,EAAC,MAAM,EAAC,cAAc;IAAsI,MAAM,CAAC,EAAE,EAAC,MAAM;gBAD14B,MAAM;eAAO,OAAO;iBAAS,MAAM;0BAAkB,MAAM;uBAAe,MAAM;;IAC45B,YAAY,CAAC,EAAE,EAAC,MAAM;CAAmG"}
|
package/dist/provider.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export class ProviderClient {
|
|
2
|
+
constructor(baseUrl = '', fetcher = fetch) {
|
|
3
|
+
this.baseUrl = baseUrl;
|
|
4
|
+
this.fetcher = fetcher;
|
|
5
|
+
}
|
|
6
|
+
async json(path, init) { const r = await this.fetcher(`${this.baseUrl}${path}`, { credentials: 'include', headers: { 'content-type': 'application/json' }, ...init }); const v = await r.json(); if (!r.ok)
|
|
7
|
+
throw new Error(v?.error || `Provider request failed (${r.status})`); return v; }
|
|
8
|
+
list() { return this.json('/v1/providers'); }
|
|
9
|
+
inspect(id) { return this.json(`/v1/providers/${encodeURIComponent(id)}`); }
|
|
10
|
+
install(manifest, tenantId, applicationId) { return this.json('/v1/providers', { method: 'POST', body: JSON.stringify({ manifest, tenant_id: tenantId, application_id: applicationId }) }); }
|
|
11
|
+
enable(id) { return this.status(id, 'ENABLED'); }
|
|
12
|
+
disable(id) { return this.status(id, 'DISABLED'); }
|
|
13
|
+
revoke(id) { return this.status(id, 'REVOKED'); }
|
|
14
|
+
status(id, status) { return this.json(`/v1/providers/${encodeURIComponent(id)}/status`, { method: 'POST', body: JSON.stringify({ status }) }); }
|
|
15
|
+
health(id) { return this.json(`/v1/providers/${encodeURIComponent(id)}/health`); }
|
|
16
|
+
dependencies(id) { return this.json(`/v1/providers/${encodeURIComponent(id)}/dependencies`); }
|
|
17
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Query Planner - Cost-Based Index Selection
|
|
3
|
+
*
|
|
4
|
+
* Analyzes queries and selects the optimal index to use.
|
|
5
|
+
* Uses cardinality estimation and index statistics to minimize query cost.
|
|
6
|
+
*/
|
|
7
|
+
import type { IndexConfig } from './index-types.js';
|
|
8
|
+
export interface QueryPredicate {
|
|
9
|
+
field: string;
|
|
10
|
+
operator: 'eq' | 'gt' | 'gte' | 'lt' | 'lte' | 'in' | 'range' | 'contains' | 'startsWith';
|
|
11
|
+
value?: any;
|
|
12
|
+
values?: any[];
|
|
13
|
+
}
|
|
14
|
+
export interface IndexScoreboard {
|
|
15
|
+
indexName: string;
|
|
16
|
+
indexType: string;
|
|
17
|
+
fields: string[];
|
|
18
|
+
score: number;
|
|
19
|
+
coverage: number;
|
|
20
|
+
estimatedRows: number;
|
|
21
|
+
cost: number;
|
|
22
|
+
}
|
|
23
|
+
export declare class QueryPlanner {
|
|
24
|
+
/**
|
|
25
|
+
* Analyze a predicate and select the best index.
|
|
26
|
+
*/
|
|
27
|
+
static planQuery(predicates: QueryPredicate[], indexes: IndexConfig[]): IndexScoreboard | null;
|
|
28
|
+
/**
|
|
29
|
+
* Score how well an index covers the given predicates.
|
|
30
|
+
*/
|
|
31
|
+
private static scoreIndex;
|
|
32
|
+
/**
|
|
33
|
+
* Explain the query plan (for debugging).
|
|
34
|
+
*/
|
|
35
|
+
static explainPlan(predicates: QueryPredicate[], indexes: IndexConfig[], selectedIndex?: IndexScoreboard): string;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Compound query builder for multi-field searches.
|
|
39
|
+
*/
|
|
40
|
+
export declare class CompoundQuery {
|
|
41
|
+
private predicates;
|
|
42
|
+
private fields;
|
|
43
|
+
/**
|
|
44
|
+
* Add a predicate for a field.
|
|
45
|
+
*/
|
|
46
|
+
addPredicate(field: string, operator: QueryPredicate['operator'], value: any): this;
|
|
47
|
+
/**
|
|
48
|
+
* Get all predicates.
|
|
49
|
+
*/
|
|
50
|
+
getPredicates(): QueryPredicate[];
|
|
51
|
+
/**
|
|
52
|
+
* Get fields involved in this query.
|
|
53
|
+
*/
|
|
54
|
+
getFields(): string[];
|
|
55
|
+
/**
|
|
56
|
+
* Find best index for this compound query.
|
|
57
|
+
*/
|
|
58
|
+
planWith(indexes: IndexConfig[]): IndexScoreboard | null;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Index recommendation engine - suggests indexes to create.
|
|
62
|
+
*/
|
|
63
|
+
export declare class IndexRecommender {
|
|
64
|
+
/**
|
|
65
|
+
* Analyze query patterns and recommend indexes.
|
|
66
|
+
*/
|
|
67
|
+
static recommendIndexes(queries: QueryPredicate[][]): IndexConfig[];
|
|
68
|
+
}
|
|
69
|
+
//# sourceMappingURL=query-planner.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"query-planner.d.ts","sourceRoot":"","sources":["../src/query-planner.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAEpD,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,IAAI,GAAG,IAAI,GAA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