@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
package/dist/sdk/react.d.ts.bak
DELETED
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* A2R-IX React SDK
|
|
3
|
-
*
|
|
4
|
-
* React hooks and components for A2R-IX integration.
|
|
5
|
-
*/
|
|
6
|
-
import React from 'react';
|
|
7
|
-
import type { UIRoot } from '../types';
|
|
8
|
-
import type { JSONPatch } from '../state/patch';
|
|
9
|
-
import { IXCapsuleClient, type IXCapsuleClientConfig, type IXCapsuleEvent } from './api';
|
|
10
|
-
interface IXContextValue {
|
|
11
|
-
client: IXCapsuleClient | null;
|
|
12
|
-
capsuleId: string | null;
|
|
13
|
-
state: Record<string, unknown>;
|
|
14
|
-
dispatch: (actionId: string, params?: Record<string, unknown>) => void;
|
|
15
|
-
applyPatch: (patch: JSONPatch) => void;
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* Hook to use IX context
|
|
19
|
-
*/
|
|
20
|
-
export declare function useIX(): IXContextValue;
|
|
21
|
-
/**
|
|
22
|
-
* Props for IXProvider
|
|
23
|
-
*/
|
|
24
|
-
interface IXProviderProps {
|
|
25
|
-
/** API configuration */
|
|
26
|
-
config: IXCapsuleClientConfig;
|
|
27
|
-
/** Capsule ID (if already created) */
|
|
28
|
-
capsuleId?: string;
|
|
29
|
-
/** UI definition (for creating new capsule) */
|
|
30
|
-
ui?: UIRoot;
|
|
31
|
-
/** Children */
|
|
32
|
-
children: React.ReactNode;
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* IX Provider component
|
|
36
|
-
*/
|
|
37
|
-
export declare function IXProvider({ config, capsuleId: initialCapsuleId, ui, children }: IXProviderProps): React.ReactElement;
|
|
38
|
-
/**
|
|
39
|
-
* Props for IXRenderer
|
|
40
|
-
*/
|
|
41
|
-
interface IXRendererProps {
|
|
42
|
-
/** Capsule ID (uses context if not provided) */
|
|
43
|
-
capsuleId?: string;
|
|
44
|
-
/** Custom component mapping */
|
|
45
|
-
components?: Record<string, React.ComponentType<unknown>>;
|
|
46
|
-
}
|
|
47
|
-
/**
|
|
48
|
-
* IX Renderer component
|
|
49
|
-
*
|
|
50
|
-
* Renders an IX capsule UI using the React renderer.
|
|
51
|
-
*/
|
|
52
|
-
export declare function IXRenderer({ capsuleId: propCapsuleId, components }: IXRendererProps): React.ReactElement | null;
|
|
53
|
-
/**
|
|
54
|
-
* Hook to use IX capsule state
|
|
55
|
-
*/
|
|
56
|
-
export declare function useIXState<T>(path: string): [T | undefined, (value: T) => void];
|
|
57
|
-
/**
|
|
58
|
-
* Hook to dispatch IX actions
|
|
59
|
-
*/
|
|
60
|
-
export declare function useIXAction(actionId: string): (params?: Record<string, unknown>) => void;
|
|
61
|
-
export type { IXCapsuleClientConfig, IXCapsuleEvent, UIRoot, JSONPatch };
|
|
62
|
-
export { IXCapsuleClient };
|
|
63
|
-
//# sourceMappingURL=react.d.ts.map
|
package/dist/sdk/react.js.bak
DELETED
|
@@ -1,161 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
/**
|
|
3
|
-
* A2R-IX React SDK
|
|
4
|
-
*
|
|
5
|
-
* React hooks and components for A2R-IX integration.
|
|
6
|
-
*/
|
|
7
|
-
import { useState, useEffect, useCallback, useRef, createContext, useContext } from 'react';
|
|
8
|
-
import { createReactRenderer } from '../react/renderer';
|
|
9
|
-
import { IXCapsuleClient } from './api';
|
|
10
|
-
const IXContext = createContext(null);
|
|
11
|
-
/**
|
|
12
|
-
* Hook to use IX context
|
|
13
|
-
*/
|
|
14
|
-
export function useIX() {
|
|
15
|
-
const context = useContext(IXContext);
|
|
16
|
-
if (!context) {
|
|
17
|
-
throw new Error('useIX must be used within IXProvider');
|
|
18
|
-
}
|
|
19
|
-
return context;
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* IX Provider component
|
|
23
|
-
*/
|
|
24
|
-
export function IXProvider({ config, capsuleId: initialCapsuleId, ui, children }) {
|
|
25
|
-
const [client] = useState(() => createIXClient(config));
|
|
26
|
-
const [capsuleId, setCapsuleId] = useState(initialCapsuleId || null);
|
|
27
|
-
const [state, setState] = useState({});
|
|
28
|
-
const eventHandlerRef = useRef();
|
|
29
|
-
// Create capsule if UI provided and no capsuleId
|
|
30
|
-
useEffect(() => {
|
|
31
|
-
if (!capsuleId && ui) {
|
|
32
|
-
client.createCapsule({ ui }).then((response) => {
|
|
33
|
-
setCapsuleId(response.capsule_id);
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
}, [client, capsuleId, ui]);
|
|
37
|
-
// Set up event handler
|
|
38
|
-
useEffect(() => {
|
|
39
|
-
eventHandlerRef.current = (event) => {
|
|
40
|
-
if (event.event_type === 'state-change' && event.state_update) {
|
|
41
|
-
setState((prev) => ({ ...prev, ...event.state_update }));
|
|
42
|
-
}
|
|
43
|
-
};
|
|
44
|
-
}, []);
|
|
45
|
-
// Update config onEvent handler
|
|
46
|
-
useEffect(() => {
|
|
47
|
-
const originalOnEvent = config.onEvent;
|
|
48
|
-
config.onEvent = (event) => {
|
|
49
|
-
eventHandlerRef.current?.(event);
|
|
50
|
-
originalOnEvent?.(event);
|
|
51
|
-
};
|
|
52
|
-
}, [config]);
|
|
53
|
-
// Fetch initial state
|
|
54
|
-
useEffect(() => {
|
|
55
|
-
if (capsuleId) {
|
|
56
|
-
client.getCapsule(capsuleId).then((capsule) => {
|
|
57
|
-
setState(capsule.state);
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
}, [client, capsuleId]);
|
|
61
|
-
// Cleanup on unmount
|
|
62
|
-
useEffect(() => {
|
|
63
|
-
return () => {
|
|
64
|
-
client.dispose();
|
|
65
|
-
};
|
|
66
|
-
}, [client]);
|
|
67
|
-
const dispatch = useCallback((actionId, params) => {
|
|
68
|
-
if (capsuleId) {
|
|
69
|
-
client.dispatchAction(capsuleId, { action_id: actionId, params });
|
|
70
|
-
}
|
|
71
|
-
}, [client, capsuleId]);
|
|
72
|
-
const applyPatch = useCallback((patch) => {
|
|
73
|
-
if (capsuleId) {
|
|
74
|
-
client.applyPatch(capsuleId, patch);
|
|
75
|
-
}
|
|
76
|
-
}, [client, capsuleId]);
|
|
77
|
-
const value = {
|
|
78
|
-
client,
|
|
79
|
-
capsuleId,
|
|
80
|
-
state,
|
|
81
|
-
dispatch,
|
|
82
|
-
applyPatch,
|
|
83
|
-
};
|
|
84
|
-
return (_jsx(IXContext.Provider, { value: value, children: children }));
|
|
85
|
-
}
|
|
86
|
-
/**
|
|
87
|
-
* IX Renderer component
|
|
88
|
-
*
|
|
89
|
-
* Renders an IX capsule UI using the React renderer.
|
|
90
|
-
*/
|
|
91
|
-
export function IXRenderer({ capsuleId: propCapsuleId, components }) {
|
|
92
|
-
const ix = useIX();
|
|
93
|
-
const capsuleId = propCapsuleId || ix.capsuleId;
|
|
94
|
-
const [ui, setUi] = useState(null);
|
|
95
|
-
const rendererRef = useRef(null);
|
|
96
|
-
// Create renderer
|
|
97
|
-
useEffect(() => {
|
|
98
|
-
rendererRef.current = createReactRenderer({
|
|
99
|
-
components,
|
|
100
|
-
stateStore: {
|
|
101
|
-
get: (path) => (path ? ix.state[path] : ix.state),
|
|
102
|
-
set: (path, value) => {
|
|
103
|
-
ix.applyPatch([{ op: 'replace', path: `/${path.replace(/\./g, '/')}`, value }]);
|
|
104
|
-
},
|
|
105
|
-
subscribe: () => () => { },
|
|
106
|
-
batch: () => { },
|
|
107
|
-
snapshot: () => ix.state,
|
|
108
|
-
restore: () => { },
|
|
109
|
-
reset: () => { },
|
|
110
|
-
compute: () => { },
|
|
111
|
-
bind: () => { },
|
|
112
|
-
getBindings: () => [],
|
|
113
|
-
},
|
|
114
|
-
onEvent: (name, payload) => {
|
|
115
|
-
ix.dispatch(name, payload);
|
|
116
|
-
},
|
|
117
|
-
});
|
|
118
|
-
return () => {
|
|
119
|
-
rendererRef.current = null;
|
|
120
|
-
};
|
|
121
|
-
}, [ix, components]);
|
|
122
|
-
// Fetch UI when capsuleId changes
|
|
123
|
-
useEffect(() => {
|
|
124
|
-
if (capsuleId && ix.client) {
|
|
125
|
-
ix.client.getCapsule(capsuleId).then((capsule) => {
|
|
126
|
-
setUi(capsule.ui);
|
|
127
|
-
});
|
|
128
|
-
}
|
|
129
|
-
}, [capsuleId, ix.client]);
|
|
130
|
-
if (!ui || !rendererRef.current) {
|
|
131
|
-
return null;
|
|
132
|
-
}
|
|
133
|
-
const { UIRoot: UIRootComponent } = rendererRef.current;
|
|
134
|
-
return _jsx(UIRootComponent, { root: ui });
|
|
135
|
-
}
|
|
136
|
-
/**
|
|
137
|
-
* Hook to use IX capsule state
|
|
138
|
-
*/
|
|
139
|
-
export function useIXState(path) {
|
|
140
|
-
const ix = useIX();
|
|
141
|
-
const value = ix.state[path];
|
|
142
|
-
const setValue = useCallback((newValue) => {
|
|
143
|
-
ix.applyPatch([{ op: 'replace', path: `/${path.replace(/\./g, '/')}`, value: newValue }]);
|
|
144
|
-
}, [ix, path]);
|
|
145
|
-
return [value, setValue];
|
|
146
|
-
}
|
|
147
|
-
/**
|
|
148
|
-
* Hook to dispatch IX actions
|
|
149
|
-
*/
|
|
150
|
-
export function useIXAction(actionId) {
|
|
151
|
-
const ix = useIX();
|
|
152
|
-
return useCallback((params) => {
|
|
153
|
-
ix.dispatch(actionId, params);
|
|
154
|
-
}, [ix, actionId]);
|
|
155
|
-
}
|
|
156
|
-
// Helper function
|
|
157
|
-
function createIXClient(config) {
|
|
158
|
-
return new IXCapsuleClient(config);
|
|
159
|
-
}
|
|
160
|
-
export { IXCapsuleClient };
|
|
161
|
-
//# sourceMappingURL=react.js.map
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* State Module
|
|
3
|
-
*
|
|
4
|
-
* JSON Patch engine (RFC 6902) and state store for A2R-IX.
|
|
5
|
-
*/
|
|
6
|
-
export { createStateStore, getStateStore, clearStateStore, type StateStore, type StateStoreConfig, } from './store';
|
|
7
|
-
export { applyPatch, applyPatchToStore, applyOperation, generatePatch, invertPatch, validatePatch, validateOperation, getValueAtPath, setValueAtPath, decodeJsonPointer, encodeJsonPointer, type JSONPatch, type JSONPatchOperation, type PatchResult, } from './patch';
|
|
8
|
-
//# sourceMappingURL=index.d.ts.map
|
package/dist/state/index.js.bak
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* State Module
|
|
3
|
-
*
|
|
4
|
-
* JSON Patch engine (RFC 6902) and state store for A2R-IX.
|
|
5
|
-
*/
|
|
6
|
-
export { createStateStore, getStateStore, clearStateStore, } from './store';
|
|
7
|
-
export { applyPatch, applyPatchToStore, applyOperation, generatePatch, invertPatch, validatePatch, validateOperation, getValueAtPath, setValueAtPath, decodeJsonPointer, encodeJsonPointer, } from './patch';
|
|
8
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* JSON Patch Engine (RFC 6902)
|
|
3
|
-
*
|
|
4
|
-
* Implements JSON Patch operations for state synchronization.
|
|
5
|
-
*/
|
|
6
|
-
import type { StateStore } from './store';
|
|
7
|
-
export interface JSONPatchOperation {
|
|
8
|
-
op: 'add' | 'remove' | 'replace' | 'move' | 'copy' | 'test';
|
|
9
|
-
path: string;
|
|
10
|
-
value?: unknown;
|
|
11
|
-
from?: string;
|
|
12
|
-
}
|
|
13
|
-
export type JSONPatch = JSONPatchOperation[];
|
|
14
|
-
export interface PatchResult {
|
|
15
|
-
success: boolean;
|
|
16
|
-
operations: JSONPatchOperation[];
|
|
17
|
-
failedAt?: number;
|
|
18
|
-
error?: string;
|
|
19
|
-
newState?: Record<string, unknown>;
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* JSON Pointer helpers
|
|
23
|
-
*/
|
|
24
|
-
export declare function decodeJsonPointer(pointer: string): string[];
|
|
25
|
-
export declare function encodeJsonPointer(segments: string[]): string;
|
|
26
|
-
/**
|
|
27
|
-
* Get value at JSON Pointer path
|
|
28
|
-
*/
|
|
29
|
-
export declare function getValueAtPath(obj: unknown, pointer: string): unknown;
|
|
30
|
-
/**
|
|
31
|
-
* Set value at JSON Pointer path
|
|
32
|
-
*/
|
|
33
|
-
export declare function setValueAtPath(obj: unknown, pointer: string, value: unknown, operation: 'add' | 'replace' | 'remove'): unknown;
|
|
34
|
-
/**
|
|
35
|
-
* Apply single patch operation
|
|
36
|
-
*/
|
|
37
|
-
export declare function applyOperation(state: Record<string, unknown>, operation: JSONPatchOperation): {
|
|
38
|
-
success: boolean;
|
|
39
|
-
newState: Record<string, unknown>;
|
|
40
|
-
error?: string;
|
|
41
|
-
};
|
|
42
|
-
/**
|
|
43
|
-
* Apply JSON Patch to state
|
|
44
|
-
*/
|
|
45
|
-
export declare function applyPatch(state: Record<string, unknown>, patch: JSONPatch): PatchResult;
|
|
46
|
-
/**
|
|
47
|
-
* Apply patch to state store
|
|
48
|
-
*/
|
|
49
|
-
export declare function applyPatchToStore(store: StateStore, patch: JSONPatch): PatchResult;
|
|
50
|
-
/**
|
|
51
|
-
* Generate JSON Patch from two objects (diff)
|
|
52
|
-
*/
|
|
53
|
-
export declare function generatePatch(from: unknown, to: unknown, path?: string): JSONPatch;
|
|
54
|
-
/**
|
|
55
|
-
* Invert a patch for undo functionality
|
|
56
|
-
*/
|
|
57
|
-
export declare function invertPatch(patch: JSONPatch, state: Record<string, unknown>): JSONPatch;
|
|
58
|
-
/**
|
|
59
|
-
* Validate patch operation
|
|
60
|
-
*/
|
|
61
|
-
export declare function validateOperation(op: JSONPatchOperation): {
|
|
62
|
-
valid: boolean;
|
|
63
|
-
error?: string;
|
|
64
|
-
};
|
|
65
|
-
/**
|
|
66
|
-
* Validate entire patch
|
|
67
|
-
*/
|
|
68
|
-
export declare function validatePatch(patch: JSONPatch): {
|
|
69
|
-
valid: boolean;
|
|
70
|
-
error?: string;
|
|
71
|
-
index?: number;
|
|
72
|
-
};
|
|
73
|
-
//# sourceMappingURL=patch.d.ts.map
|