@allternit/ix 0.1.0 → 0.1.1
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/README.md +6 -6
- package/dist/adapters/json-render.d.ts +5 -5
- package/dist/adapters/json-render.js +12 -12
- package/dist/collab/visual-editor.d.ts +1 -1
- package/dist/collab/visual-editor.js +4 -4
- package/dist/collab/visual-editor.js.map +1 -1
- package/dist/collab/yjs-adapter.d.ts +1 -1
- package/dist/collab/yjs-adapter.js +2 -2
- package/dist/collab/yjs-adapter.js.map +1 -1
- package/dist/collab/yjs-client.js +1 -1
- package/dist/collab/yjs-client.js.map +1 -1
- package/dist/collab/yjs-types.js +1 -1
- package/dist/collab/yjs-types.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/pipeline/llm-to-ix.d.ts +5 -5
- package/dist/pipeline/llm-to-ix.d.ts.map +1 -1
- package/dist/pipeline/llm-to-ix.js +6 -6
- package/dist/react/renderer.d.ts +2 -2
- package/dist/react/renderer.js +3 -3
- package/dist/react/renderer.js.map +1 -1
- package/dist/renderer/renderer.d.ts +1 -1
- package/dist/renderer/renderer.js +1 -1
- package/dist/runtime/capsule-runtime.d.ts +1 -1
- package/dist/runtime/capsule-runtime.js +1 -1
- package/dist/sdk/api.d.ts +3 -3
- package/dist/sdk/api.js +3 -3
- package/dist/sdk/index.d.ts +2 -2
- package/dist/sdk/index.js +2 -2
- package/dist/sdk/react.d.ts +2 -2
- package/dist/sdk/react.js +2 -2
- package/dist/state/index.d.ts +1 -1
- package/dist/state/index.js +1 -1
- package/dist/state/store.d.ts +1 -1
- package/dist/state/store.js +3 -3
- package/dist/state/store.js.map +1 -1
- package/dist/svelte/index.d.ts +1 -1
- package/dist/svelte/index.js +1 -1
- package/dist/svelte/renderer.d.ts +3 -3
- package/dist/svelte/renderer.js +4 -4
- package/dist/svelte/renderer.js.map +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/index.js +1 -1
- package/dist/vue/renderer.d.ts +3 -3
- package/dist/vue/renderer.js +5 -5
- package/dist/vue/renderer.js.map +1 -1
- package/package.json +8 -8
- package/dist/adapters/json-render.d.ts.bak +0 -211
- package/dist/adapters/json-render.js.bak +0 -576
- package/dist/catalog/registry.d.ts.bak +0 -65
- package/dist/catalog/registry.js.bak +0 -388
- package/dist/collab/capsule-registry.d.ts.bak +0 -114
- package/dist/collab/capsule-registry.js.bak +0 -271
- package/dist/collab/index.d.ts.bak +0 -21
- package/dist/collab/index.js.bak +0 -32
- package/dist/collab/visual-editor.d.ts.bak +0 -199
- package/dist/collab/visual-editor.js.bak +0 -259
- package/dist/collab/yjs-adapter.d.ts.bak +0 -95
- package/dist/collab/yjs-adapter.js.bak +0 -282
- package/dist/collab/yjs-client.d.ts.bak +0 -101
- package/dist/collab/yjs-client.js.bak +0 -193
- package/dist/collab/yjs-protocols.d.ts.bak +0 -128
- package/dist/collab/yjs-protocols.js.bak +0 -245
- package/dist/collab/yjs-types.d.ts.bak +0 -201
- package/dist/collab/yjs-types.js.bak +0 -45
- package/dist/index.d.ts.bak +0 -38
- package/dist/index.js.bak +0 -48
- package/dist/pipeline/llm-to-ix.d.ts.bak +0 -249
- package/dist/pipeline/llm-to-ix.js.bak +0 -992
- package/dist/react/index.d.ts.bak +0 -18
- package/dist/react/index.js.bak +0 -18
- package/dist/react/renderer.d.ts.bak +0 -47
- package/dist/react/renderer.js.bak +0 -420
- package/dist/renderer/renderer.d.ts.bak +0 -55
- package/dist/renderer/renderer.js.bak +0 -232
- package/dist/runtime/capsule-runtime.d.ts.bak +0 -227
- package/dist/runtime/capsule-runtime.js.bak +0 -563
- package/dist/runtime/policy-gates.d.ts.bak +0 -116
- package/dist/runtime/policy-gates.js.bak +0 -317
- package/dist/schema/ui-ir.d.ts.bak +0 -26
- package/dist/schema/ui-ir.js.bak +0 -51
- package/dist/sdk/api.d.ts.bak +0 -101
- package/dist/sdk/api.js.bak +0 -177
- package/dist/sdk/index.d.ts.bak +0 -9
- package/dist/sdk/index.js.bak +0 -10
- package/dist/sdk/react.d.ts.bak +0 -63
- package/dist/sdk/react.js.bak +0 -161
- package/dist/state/index.d.ts.bak +0 -8
- package/dist/state/index.js.bak +0 -8
- package/dist/state/patch.d.ts.bak +0 -73
- package/dist/state/patch.js.bak +0 -437
- package/dist/state/store.d.ts.bak +0 -50
- package/dist/state/store.js.bak +0 -246
- package/dist/svelte/index.d.ts.bak +0 -15
- package/dist/svelte/index.js.bak +0 -15
- package/dist/svelte/renderer.d.ts.bak +0 -35
- package/dist/svelte/renderer.js.bak +0 -317
- package/dist/types/index.d.ts.bak +0 -349
- package/dist/types/index.js.bak +0 -152
- package/dist/vue/index.d.ts.bak +0 -18
- package/dist/vue/index.js.bak +0 -18
- package/dist/vue/renderer.d.ts.bak +0 -46
- package/dist/vue/renderer.js.bak +0 -302
|
@@ -1,232 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* UI Renderer
|
|
3
|
-
*
|
|
4
|
-
* Core renderer for A2R-IX UI IR. Platform-agnostic base that delegates
|
|
5
|
-
to platform-specific renderers (React, Vue, etc.).
|
|
6
|
-
*/
|
|
7
|
-
/**
|
|
8
|
-
* Create UI renderer
|
|
9
|
-
*/
|
|
10
|
-
export function createUIRenderer(config) {
|
|
11
|
-
let currentRoot = null;
|
|
12
|
-
let currentContainer = null;
|
|
13
|
-
let destroyed = false;
|
|
14
|
-
const stateStore = config.stateStore;
|
|
15
|
-
const catalog = config.catalog;
|
|
16
|
-
const platform = config.platform;
|
|
17
|
-
function render(root, container) {
|
|
18
|
-
if (destroyed) {
|
|
19
|
-
throw new Error('Renderer has been destroyed');
|
|
20
|
-
}
|
|
21
|
-
currentRoot = root;
|
|
22
|
-
currentContainer = container;
|
|
23
|
-
// Initialize state
|
|
24
|
-
if (stateStore && root.state?.initial) {
|
|
25
|
-
Object.entries(root.state.initial).forEach(([path, value]) => {
|
|
26
|
-
stateStore.set(path, value);
|
|
27
|
-
});
|
|
28
|
-
}
|
|
29
|
-
// Render component tree
|
|
30
|
-
const elements = root.components.map((comp) => renderComponent(comp));
|
|
31
|
-
const rootElement = platform.createElement('Fragment', {}, elements);
|
|
32
|
-
platform.render(rootElement, container);
|
|
33
|
-
}
|
|
34
|
-
function renderComponent(component, context) {
|
|
35
|
-
try {
|
|
36
|
-
// Validate component against catalog
|
|
37
|
-
if (catalog && !catalog.validate(component.type, component.props)) {
|
|
38
|
-
throw new Error(`Invalid props for component type: ${component.type}`);
|
|
39
|
-
}
|
|
40
|
-
// Build props with context evaluation
|
|
41
|
-
const props = {};
|
|
42
|
-
if (component.props) {
|
|
43
|
-
Object.entries(component.props).forEach(([key, value]) => {
|
|
44
|
-
props[key] = evaluateValue(value, context || {});
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
// Add bindings
|
|
48
|
-
if (component.bindings && stateStore) {
|
|
49
|
-
component.bindings.forEach((binding) => {
|
|
50
|
-
const value = stateStore.get(binding.statePath);
|
|
51
|
-
props[binding.prop] = value;
|
|
52
|
-
if (binding.direction === 'two-way') {
|
|
53
|
-
// Add onChange handler
|
|
54
|
-
props[`on${capitalize(binding.prop)}Change`] = (newValue) => {
|
|
55
|
-
stateStore.set(binding.statePath, newValue);
|
|
56
|
-
};
|
|
57
|
-
}
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
// Add event handlers
|
|
61
|
-
if (component.events) {
|
|
62
|
-
component.events.forEach((event) => {
|
|
63
|
-
props[event.event] = (...args) => {
|
|
64
|
-
handleEvent(event.action, event.params, args);
|
|
65
|
-
};
|
|
66
|
-
});
|
|
67
|
-
}
|
|
68
|
-
// Render children
|
|
69
|
-
let children = [];
|
|
70
|
-
if (component.children) {
|
|
71
|
-
children = component.children.map(child => renderComponent(child, context));
|
|
72
|
-
}
|
|
73
|
-
// Handle repeat
|
|
74
|
-
if (component.repeat && stateStore) {
|
|
75
|
-
const items = stateStore.get(component.repeat.items) || [];
|
|
76
|
-
children = items.map((item, index) => {
|
|
77
|
-
const itemContext = {
|
|
78
|
-
...context,
|
|
79
|
-
[component.repeat.as]: item,
|
|
80
|
-
...(component.repeat.indexAs ? { [component.repeat.indexAs]: index } : {}),
|
|
81
|
-
};
|
|
82
|
-
return renderComponent(component.children?.[0] || { id: generateId(), type: 'Fragment', props: {} }, itemContext);
|
|
83
|
-
});
|
|
84
|
-
}
|
|
85
|
-
// Add key/id
|
|
86
|
-
props.key = component.id;
|
|
87
|
-
// Create element
|
|
88
|
-
return platform.createElement(component.type, props, children);
|
|
89
|
-
}
|
|
90
|
-
catch (error) {
|
|
91
|
-
config.onError?.(error, component.id);
|
|
92
|
-
return platform.createElement('ErrorBoundary', { error }, []);
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
function handleEvent(actionId, params, eventArgs) {
|
|
96
|
-
if (!currentRoot)
|
|
97
|
-
return;
|
|
98
|
-
const action = currentRoot.actions.find((a) => a.id === actionId);
|
|
99
|
-
if (!action) {
|
|
100
|
-
config.onError?.(new Error(`Action not found: ${actionId}`));
|
|
101
|
-
return;
|
|
102
|
-
}
|
|
103
|
-
executeAction(action, params, eventArgs);
|
|
104
|
-
}
|
|
105
|
-
function executeAction(action, params, eventArgs) {
|
|
106
|
-
const { handler } = action;
|
|
107
|
-
switch (handler.type) {
|
|
108
|
-
case 'setState': {
|
|
109
|
-
if (stateStore) {
|
|
110
|
-
// Evaluate value expression with params and event
|
|
111
|
-
const context = { params, event: eventArgs[0], ...stateStore.snapshot() };
|
|
112
|
-
const value = evaluateValue(handler.value, context);
|
|
113
|
-
stateStore.set(handler.path, value);
|
|
114
|
-
}
|
|
115
|
-
break;
|
|
116
|
-
}
|
|
117
|
-
case 'emitEvent': {
|
|
118
|
-
const context = { params, event: eventArgs[0], ...stateStore?.snapshot() };
|
|
119
|
-
const payload = evaluateValue(handler.payload, context);
|
|
120
|
-
config.onEvent?.(handler.name, payload);
|
|
121
|
-
break;
|
|
122
|
-
}
|
|
123
|
-
case 'navigate': {
|
|
124
|
-
// Navigation handled by platform
|
|
125
|
-
break;
|
|
126
|
-
}
|
|
127
|
-
case 'validate': {
|
|
128
|
-
// Validation logic
|
|
129
|
-
break;
|
|
130
|
-
}
|
|
131
|
-
case 'custom': {
|
|
132
|
-
config.onEvent?.(action.id, { params, event: eventArgs[0] });
|
|
133
|
-
break;
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
function update(patch) {
|
|
138
|
-
if (!stateStore || destroyed)
|
|
139
|
-
return;
|
|
140
|
-
// Apply patch to state
|
|
141
|
-
const snapshot = stateStore.snapshot();
|
|
142
|
-
patch.forEach((op) => {
|
|
143
|
-
if (op.op === 'add' || op.op === 'replace') {
|
|
144
|
-
const path = op.path.slice(1).replace(/\//g, '.');
|
|
145
|
-
stateStore.set(path, op.value);
|
|
146
|
-
}
|
|
147
|
-
else if (op.op === 'remove') {
|
|
148
|
-
const path = op.path.slice(1).replace(/\//g, '.');
|
|
149
|
-
stateStore.set(path, undefined);
|
|
150
|
-
}
|
|
151
|
-
});
|
|
152
|
-
// Re-render if needed
|
|
153
|
-
if (currentRoot && currentContainer) {
|
|
154
|
-
render(currentRoot, currentContainer);
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
function dispatch(actionId, params) {
|
|
158
|
-
handleEvent(actionId, params, []);
|
|
159
|
-
}
|
|
160
|
-
function getState(path) {
|
|
161
|
-
if (!stateStore)
|
|
162
|
-
return undefined;
|
|
163
|
-
return path ? stateStore.get(path) : stateStore.snapshot();
|
|
164
|
-
}
|
|
165
|
-
function setState(path, value) {
|
|
166
|
-
stateStore?.set(path, value);
|
|
167
|
-
}
|
|
168
|
-
function subscribe(path, callback) {
|
|
169
|
-
if (!stateStore)
|
|
170
|
-
return () => { };
|
|
171
|
-
return stateStore.subscribe(path, callback);
|
|
172
|
-
}
|
|
173
|
-
function destroy() {
|
|
174
|
-
if (currentContainer) {
|
|
175
|
-
platform.unmount(currentContainer);
|
|
176
|
-
}
|
|
177
|
-
destroyed = true;
|
|
178
|
-
currentRoot = null;
|
|
179
|
-
currentContainer = null;
|
|
180
|
-
}
|
|
181
|
-
return {
|
|
182
|
-
render,
|
|
183
|
-
update,
|
|
184
|
-
dispatch,
|
|
185
|
-
getState,
|
|
186
|
-
setState,
|
|
187
|
-
subscribe,
|
|
188
|
-
destroy,
|
|
189
|
-
};
|
|
190
|
-
}
|
|
191
|
-
/**
|
|
192
|
-
* Evaluate value expression
|
|
193
|
-
*/
|
|
194
|
-
function evaluateValue(value, context) {
|
|
195
|
-
if (value === null || typeof value !== 'object') {
|
|
196
|
-
return value;
|
|
197
|
-
}
|
|
198
|
-
if ('$path' in value) {
|
|
199
|
-
const path = value.$path;
|
|
200
|
-
return path.split('.').reduce((acc, key) => {
|
|
201
|
-
if (acc && typeof acc === 'object') {
|
|
202
|
-
return acc[key];
|
|
203
|
-
}
|
|
204
|
-
return undefined;
|
|
205
|
-
}, context);
|
|
206
|
-
}
|
|
207
|
-
if ('$expr' in value) {
|
|
208
|
-
const expr = value.$expr;
|
|
209
|
-
try {
|
|
210
|
-
// Simple expression evaluation
|
|
211
|
-
const fn = new Function('context', `with(context) { return ${expr}; }`);
|
|
212
|
-
return fn(context);
|
|
213
|
-
}
|
|
214
|
-
catch {
|
|
215
|
-
return undefined;
|
|
216
|
-
}
|
|
217
|
-
}
|
|
218
|
-
return value;
|
|
219
|
-
}
|
|
220
|
-
/**
|
|
221
|
-
* Generate unique ID
|
|
222
|
-
*/
|
|
223
|
-
function generateId() {
|
|
224
|
-
return `comp_${Math.random().toString(36).substr(2, 9)}`;
|
|
225
|
-
}
|
|
226
|
-
/**
|
|
227
|
-
* Capitalize string
|
|
228
|
-
*/
|
|
229
|
-
function capitalize(str) {
|
|
230
|
-
return str.charAt(0).toUpperCase() + str.slice(1);
|
|
231
|
-
}
|
|
232
|
-
//# sourceMappingURL=renderer.js.map
|
|
@@ -1,227 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* IX Capsule Runtime
|
|
3
|
-
*
|
|
4
|
-
* Integration with P3.9 MCP Apps capsule infrastructure for sandboxed
|
|
5
|
-
* execution of A2R-IX UI capsules.
|
|
6
|
-
*/
|
|
7
|
-
import type { UIRoot } from '../types';
|
|
8
|
-
import type { StateStore } from '../state/store';
|
|
9
|
-
import type { JSONPatch } from '../state/patch';
|
|
10
|
-
import type { PolicyGate } from './policy-gates';
|
|
11
|
-
export interface IXCapsuleConfig {
|
|
12
|
-
/** Capsule ID */
|
|
13
|
-
id: string;
|
|
14
|
-
/** UI definition */
|
|
15
|
-
ui: UIRoot;
|
|
16
|
-
/** Policy gates for security */
|
|
17
|
-
policyGates?: PolicyGate[];
|
|
18
|
-
/** State store (isolated per capsule) */
|
|
19
|
-
stateStore: StateStore;
|
|
20
|
-
/** Event handler for capsule events */
|
|
21
|
-
onEvent?: (event: IXCapsuleEvent) => void;
|
|
22
|
-
/** State change handler */
|
|
23
|
-
onStateChange?: (path: string, value: unknown) => void;
|
|
24
|
-
/** Destroy handler */
|
|
25
|
-
onDestroy?: () => void;
|
|
26
|
-
}
|
|
27
|
-
export interface IXCapsuleEvent {
|
|
28
|
-
type: 'action' | 'state-change' | 'error' | 'lifecycle';
|
|
29
|
-
capsuleId: string;
|
|
30
|
-
action?: string;
|
|
31
|
-
params?: Record<string, unknown>;
|
|
32
|
-
path?: string;
|
|
33
|
-
value?: unknown;
|
|
34
|
-
error?: Error;
|
|
35
|
-
lifecycle?: 'mount' | 'unmount' | 'update';
|
|
36
|
-
}
|
|
37
|
-
export interface IXCapsule {
|
|
38
|
-
/** Capsule ID */
|
|
39
|
-
id: string;
|
|
40
|
-
/** Get current UI definition */
|
|
41
|
-
getUI: () => UIRoot;
|
|
42
|
-
/** Update UI with new definition */
|
|
43
|
-
updateUI: (ui: UIRoot) => void;
|
|
44
|
-
/** Apply state patch */
|
|
45
|
-
applyPatch: (patch: JSONPatch) => void;
|
|
46
|
-
/** Get state value */
|
|
47
|
-
getState: (path: string) => unknown;
|
|
48
|
-
/** Set state value */
|
|
49
|
-
setState: (path: string, value: unknown) => void;
|
|
50
|
-
/** Dispatch action */
|
|
51
|
-
dispatch: (actionId: string, params?: Record<string, unknown>) => Promise<boolean>;
|
|
52
|
-
/** Subscribe to capsule events */
|
|
53
|
-
subscribe: (callback: (event: IXCapsuleEvent) => void) => () => void;
|
|
54
|
-
/** Destroy capsule */
|
|
55
|
-
destroy: () => void;
|
|
56
|
-
/** Check if capsule is active */
|
|
57
|
-
isActive: () => boolean;
|
|
58
|
-
/** GAP-62: Get capsule metrics */
|
|
59
|
-
getMetrics: () => IXCapsuleMetrics;
|
|
60
|
-
}
|
|
61
|
-
/**
|
|
62
|
-
* GAP-62: Extended capsule metrics
|
|
63
|
-
*/
|
|
64
|
-
export interface IXCapsuleMetrics {
|
|
65
|
-
/** Number of renders */
|
|
66
|
-
renderCount: number;
|
|
67
|
-
/** Number of actions dispatched */
|
|
68
|
-
actionCount: number;
|
|
69
|
-
/** Number of state updates */
|
|
70
|
-
stateUpdateCount: number;
|
|
71
|
-
/** Number of errors */
|
|
72
|
-
errorCount: number;
|
|
73
|
-
/** Capsule start time (ms timestamp) */
|
|
74
|
-
startTime: number;
|
|
75
|
-
/** Last activity time (ms timestamp) */
|
|
76
|
-
lastActivity: number;
|
|
77
|
-
/** GAP-63: CPU usage metrics */
|
|
78
|
-
cpu?: {
|
|
79
|
-
/** User CPU time used (milliseconds) */
|
|
80
|
-
userTime: number;
|
|
81
|
-
/** System CPU time used (milliseconds) */
|
|
82
|
-
systemTime: number;
|
|
83
|
-
/** Total CPU time (user + system) */
|
|
84
|
-
totalTime: number;
|
|
85
|
-
/** CPU usage percentage (approximate) */
|
|
86
|
-
usagePercent: number;
|
|
87
|
-
};
|
|
88
|
-
/** GAP-63: Memory usage metrics */
|
|
89
|
-
memory?: {
|
|
90
|
-
/** Heap used in bytes */
|
|
91
|
-
heapUsed: number;
|
|
92
|
-
/** Heap total in bytes */
|
|
93
|
-
heapTotal: number;
|
|
94
|
-
/** External memory in bytes */
|
|
95
|
-
external: number;
|
|
96
|
-
/** RSS (Resident Set Size) in bytes */
|
|
97
|
-
rss: number;
|
|
98
|
-
/** Array buffer memory in bytes */
|
|
99
|
-
arrayBuffers: number;
|
|
100
|
-
};
|
|
101
|
-
/** GAP-63: Network metrics (for capsules making network requests) */
|
|
102
|
-
network?: {
|
|
103
|
-
/** Number of requests made */
|
|
104
|
-
requestCount: number;
|
|
105
|
-
/** Number of successful responses */
|
|
106
|
-
successCount: number;
|
|
107
|
-
/** Number of failed requests */
|
|
108
|
-
errorCount: number;
|
|
109
|
-
/** Total bytes sent */
|
|
110
|
-
bytesSent: number;
|
|
111
|
-
/** Total bytes received */
|
|
112
|
-
bytesReceived: number;
|
|
113
|
-
/** Average response time (ms) */
|
|
114
|
-
avgResponseTime: number;
|
|
115
|
-
};
|
|
116
|
-
/** Uptime in milliseconds */
|
|
117
|
-
uptime: number;
|
|
118
|
-
}
|
|
119
|
-
/**
|
|
120
|
-
* Create IX Capsule
|
|
121
|
-
*/
|
|
122
|
-
export declare function createIXCapsule(config: IXCapsuleConfig): IXCapsule;
|
|
123
|
-
/**
|
|
124
|
-
* IX Capsule Registry
|
|
125
|
-
*/
|
|
126
|
-
export declare class IXCapsuleRegistry {
|
|
127
|
-
private capsules;
|
|
128
|
-
private defaultPolicyGates;
|
|
129
|
-
/**
|
|
130
|
-
* Set default policy gates for all capsules
|
|
131
|
-
*/
|
|
132
|
-
setDefaultPolicyGates(gates: PolicyGate[]): void;
|
|
133
|
-
/**
|
|
134
|
-
* Create and register capsule
|
|
135
|
-
*/
|
|
136
|
-
create(config: Omit<IXCapsuleConfig, 'policyGates'> & {
|
|
137
|
-
policyGates?: PolicyGate[];
|
|
138
|
-
}): IXCapsule;
|
|
139
|
-
/**
|
|
140
|
-
* Get capsule by ID
|
|
141
|
-
*/
|
|
142
|
-
get(id: string): IXCapsule | undefined;
|
|
143
|
-
/**
|
|
144
|
-
* Check if capsule exists
|
|
145
|
-
*/
|
|
146
|
-
has(id: string): boolean;
|
|
147
|
-
/**
|
|
148
|
-
* Remove capsule
|
|
149
|
-
*/
|
|
150
|
-
remove(id: string): boolean;
|
|
151
|
-
/**
|
|
152
|
-
* List all capsules
|
|
153
|
-
*/
|
|
154
|
-
list(): IXCapsule[];
|
|
155
|
-
/**
|
|
156
|
-
* Get active capsules
|
|
157
|
-
*/
|
|
158
|
-
getActive(): IXCapsule[];
|
|
159
|
-
/**
|
|
160
|
-
* Broadcast patch to all capsules
|
|
161
|
-
*/
|
|
162
|
-
broadcastPatch(patch: JSONPatch): void;
|
|
163
|
-
/**
|
|
164
|
-
* Destroy all capsules
|
|
165
|
-
*/
|
|
166
|
-
clear(): void;
|
|
167
|
-
/**
|
|
168
|
-
* GAP-62/64: Get metrics for all capsules
|
|
169
|
-
* Returns aggregated metrics for all registered capsules
|
|
170
|
-
*/
|
|
171
|
-
getMetrics(): Record<string, IXCapsuleMetrics>;
|
|
172
|
-
/**
|
|
173
|
-
* GAP-64: Get aggregated metrics across all capsules
|
|
174
|
-
* Returns summary statistics for the entire registry
|
|
175
|
-
*/
|
|
176
|
-
getAggregatedMetrics(): IXAggregatedMetrics;
|
|
177
|
-
/**
|
|
178
|
-
* GAP-64: Export metrics for external monitoring systems
|
|
179
|
-
* Returns metrics in a format suitable for Prometheus, DataDog, etc.
|
|
180
|
-
*/
|
|
181
|
-
exportMetrics(): IXMetricsExport;
|
|
182
|
-
/**
|
|
183
|
-
* Convert metrics to Prometheus format
|
|
184
|
-
*/
|
|
185
|
-
private toPrometheusFormat;
|
|
186
|
-
}
|
|
187
|
-
/**
|
|
188
|
-
* GAP-64: Aggregated metrics interface
|
|
189
|
-
*/
|
|
190
|
-
export interface IXAggregatedMetrics {
|
|
191
|
-
/** Total number of capsules in registry */
|
|
192
|
-
totalCapsules: number;
|
|
193
|
-
/** Number of currently active capsules */
|
|
194
|
-
activeCapsules: number;
|
|
195
|
-
/** Total renders across all capsules */
|
|
196
|
-
totalRenders: number;
|
|
197
|
-
/** Total actions across all capsules */
|
|
198
|
-
totalActions: number;
|
|
199
|
-
/** Total state updates across all capsules */
|
|
200
|
-
totalStateUpdates: number;
|
|
201
|
-
/** Total errors across all capsules */
|
|
202
|
-
totalErrors: number;
|
|
203
|
-
/** Average uptime in milliseconds */
|
|
204
|
-
avgUptime: number;
|
|
205
|
-
/** Total memory used in bytes */
|
|
206
|
-
totalMemoryUsed: number;
|
|
207
|
-
/** Average CPU usage percentage */
|
|
208
|
-
avgCpuUsage: number;
|
|
209
|
-
}
|
|
210
|
-
/**
|
|
211
|
-
* GAP-64: Metrics export format
|
|
212
|
-
*/
|
|
213
|
-
export interface IXMetricsExport {
|
|
214
|
-
/** Export timestamp */
|
|
215
|
-
timestamp: number;
|
|
216
|
-
/** Summary statistics */
|
|
217
|
-
summary: IXAggregatedMetrics;
|
|
218
|
-
/** Individual capsule metrics */
|
|
219
|
-
capsules: Record<string, IXCapsuleMetrics>;
|
|
220
|
-
/** Prometheus-formatted metrics */
|
|
221
|
-
prometheus: string;
|
|
222
|
-
}
|
|
223
|
-
/**
|
|
224
|
-
* Global capsule registry
|
|
225
|
-
*/
|
|
226
|
-
export declare const globalCapsuleRegistry: IXCapsuleRegistry;
|
|
227
|
-
//# sourceMappingURL=capsule-runtime.d.ts.map
|