How to use @casual-simulation/aux-vm - 10 common examples

To help you get started, we’ve selected a few @casual-simulation/aux-vm examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github casual-simulation / aux / src / aux-vm-client / vm / RemoteAuxChannel.ts View on Github external
constructor(
        user: AuxUser,
        config: AuxConfig,
        options: RemoteAuxChannelOptions
    ) {
        super(user, config, options);
        this._partitionOptions = {
            ...(options.partitionOptions || {
                defaultHost: null,
            }),
            treeOptions: {
                filter: filterAtomFactory(() => this.helper),
            },
        };
        //  {
        //     defaultHost: defaultHost,
        //     store: options.store,
        //     crypto: options.crypto,
        //     treeOptions: {
        //         filter: filterAtomFactory(() => this.helper),
        //     },
        // };
    }
github casual-simulation / aux / src / aux-server / server / modules / SetupChannelModule.ts View on Github external
private async _setupChannel(
        info: RealtimeChannelInfo,
        event: SetupChannelAction
    ) {
        try {
            const newChannelInfo = {
                id: getTreeName(event.channel),
                type: 'aux',
            };
            const hasChannel = await this._channelManager.hasChannel(
                newChannelInfo
            );
            if (!hasChannel) {
                console.log(
                    `[SetupChannelModule] Setting up new channel ${
                        event.channel
                    }`
                );
                const channel = await this._channelManager.loadChannel(
                    newChannelInfo
                );

                if (event.botOrMod) {
github casual-simulation / aux / src / aux-vm-client / partitions / RemoteCausalRepoPartitionFactory.ts View on Github external
export async function createRemoteCausalRepoPartition(
    config: PartitionConfig,
    user: User
): Promise {
    if (config.type === 'remote_causal_repo') {
        const manager = new SocketManager(config.host);
        manager.init();
        const connection = new SocketIOConnectionClient(manager.socket, user);
        const client = new CausalRepoClient(connection);
        const partition = new RemoteCausalRepoPartitionImpl(
            user,
            client,
            config
        );
        await partition.init();
        return partition;
    }
    return undefined;
}
github casual-simulation / aux / src / aux-vm-node / managers / NodeSimulationFactories.ts View on Github external
export function nodeSimulationForRemote(
    host: string,
    user: AuxUser,
    id: string,
    config: FormulaLibraryOptions['config']
): RemoteSimulation {
    const parsedId = parseSimulationId(id);
    return new RemoteSimulationImpl(
        id,
        config,
        {
            shared: {
                type: 'remote_causal_tree',
                host: host,
                id: id,
                treeName: getTreeName(parsedId.channel),
            },
        },
        cfg =>
            new AuxVMNode(
                new RemoteAuxChannel(user, cfg, {
                    sandboxFactory: lib => getSandbox(lib),
                    partitionOptions: {
                        defaultHost: host,
                        store: new NullCausalTreeStore(),
                        crypto: new NodeSigningCryptoImpl(
                            'ECDSA-SHA256-NISTP256'
                        ),
                    },
                })
            )
    );
github casual-simulation / aux / src / aux-vm-browser / managers / BotPanelManager.spec.ts View on Github external
beforeEach(async () => {
        vm = new TestAuxVM(userId);
        vm.processEvents = true;
        helper = new BotHelper(vm);
        helper.userId = userId;
        selection = new SelectionManager(helper);
        recent = new RecentBotManager(helper);
        index = new BotIndex();

        watcher = new BotWatcher(helper, index, vm.stateUpdated);

        await vm.sendEvents([botAdded(createBot('user'))]);

        manager = new BotPanelManager(watcher, helper, selection, recent);
    });
github casual-simulation / aux / src / aux-vm-browser / managers / RecentBotManager.spec.ts View on Github external
beforeEach(async () => {
        vm = new TestAuxVM();
        helper = new BotHelper(vm);
        helper.userId = 'user';
        recent = new RecentBotManager(helper);
    });
github casual-simulation / aux / src / aux-server / aux-web / shared / AppManager.ts View on Github external
constructor() {
        this._progress = new BehaviorSubject(null);
        this._initOffline();
        this._simulationManager = new SimulationManager(id => {
            return new BotManager(this._user, id, this._config);
        });
        this._userSubject = new BehaviorSubject(null);
        this._db = new AppDatabase();
    }
github casual-simulation / aux / src / aux-server / aux-web / shared / AppManager.ts View on Github external
constructor() {
        this._progress = new BehaviorSubject(null);
        this._initOffline();
        this._simulationManager = new SimulationManager(id => {
            return new FileManager(this._user, id, this._config);
        });
        this._userSubject = new BehaviorSubject(null);
        this._db = new AppDatabase();
    }
github casual-simulation / aux / src / aux-vm-client / vm / RemoteAuxChannel.ts View on Github external
protected async _createPartition(
        config: PartitionConfig
    ): Promise {
        return await createAuxPartition(
            config,
            createRemoteCausalTreePartitionFactory(
                this._partitionOptions,
                this.user
            ),
            createMemoryPartition,
            config => createCausalRepoPartition(config, this.user),
            config => createRemoteCausalRepoPartition(config, this.user),
            config => createCausalRepoClientPartition(config, this.user)
        );
    }
github casual-simulation / aux / src / aux-vm-node / vm / NodeAuxChannel.ts View on Github external
protected async _createPartition(
        config: PartitionConfig
    ): Promise {
        return await createAuxPartition(
            config,
            createLocalCausalTreePartitionFactory(
                {
                    treeOptions: {
                        filter: filterAtomFactory(() => this.helper),
                    },
                },
                this.user,
                this._device
            ),
            createMemoryPartition,
            config => createCausalRepoPartition(config, this.user)
        );
    }