Skip to content

Commit

Permalink
Fix lots of merge issues and errors
Browse files Browse the repository at this point in the history
  • Loading branch information
parzival418 committed Nov 3, 2023
1 parent 3bcdb73 commit 9d1eb3a
Show file tree
Hide file tree
Showing 35 changed files with 179 additions and 188 deletions.
2 changes: 1 addition & 1 deletion apps/agent/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
},
"dependencies": {
"knex": "^2.4.2",
"@magickml/core": "file:../../dist/packages/shared/core",
"shared/core": "file:../../dist/packages/shared/core",
"@magickml/server-core": "file:../../dist/packages/server-core"
}
}
18 changes: 15 additions & 3 deletions apps/docs/docs/developer-guides/Package Overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,37 +8,49 @@ sidebar_position: 1
# Package Overview

## Apps

### Client

@magickml/client (./apps/client)
Frontend application. Everything the user sees in Magick IDE is exposed through the client, although most of the code lives in client-core and editor packages, as well as engine. Thin, mostly contains build settings and entrypoint.

### Server

@magickml/server (./apps/server)
Backend server application. Depends on server-core and engine. Thin, mostly contains startup code and configuration for the server. Provides an API which the client talks to, and runs preview spells for clients.

### Agent

@magickml/agent (./apps/agent)
Backend agent application. Depends on server-core and engine. Thin, startups the AgentManager and manages agents from the database. Talks directly to the database, not to the server.

### Docs

@magickml/docs (./apps/docs)
Documentation server build on Docusaurus.

## Shared Packages

### Engine
@magickml/core (./packages/core/shared)
Core runtime code for Magick. Contains all of the spell and spell running code, common interfaces and nodes. Available for install via [npm](https://www.npmjs.com/package/@magickml/core)

shared/core (./packages/core/shared)
Core runtime code for Magick. Contains all of the spell and spell running code, common interfaces and nodes. Available for install via [npm](https://www.npmjs.com/package/shared/core)

## Front End Packages

### Client Core

@magickml/client-core (./packages/core/client)
Frontend UI components and common code.

### Editor

@magickml/editor
Application code for the IDE, including windows, providers and state. Used in the client. Exports the entire Magick editor as components which can be imported whole or individually for custom routing (for example, in a Next.js frontend). Available for install via [npm](https://www.npmjs.com/package/@magickml/editor)

## Server Packages

### Server Core

@magickml/server-core (./packages/core/server)
Contains all of the server code, imported by the server and agent apps.
Contains all of the server code, imported by the server and agent apps.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,18 @@
"migrate": "nx run @magickml/server:migrate",
"lint": "npx nx run-many --all --target=lint --max-warnings=0",
"lint-fix": "npx nx run-many --all --target=lint --fix --max-warnings=0",
"lint:engine": "npx nx lint @magickml/core --fix",
"lint:engine": "npx nx lint shared/core --fix",
"lint:editor": "npx nx lint @magickml/editor --fix",
"lint:server-core": "npx nx lint @magickml/server-core",
"build": "npx nx lint @magickml/core && npx nx run-many --target=build --projects=@magickml/server,@magickml/cloud-agent-worker-app,@magickml/cloud-agent-manager-app",
"build": "npx nx lint shared/core && npx nx run-many --target=build --projects=@magickml/server,@magickml/cloud-agent-worker-app,@magickml/cloud-agent-manager-app",
"build-client": "npx nx build @magickml/client",
"heroku-prebuild": "npm i -g @nrwl/cli",
"build-server": "npx nx build @magickml/server",
"build-agent": "npx nx build @magickml/agent",
"build-docs": "npx nx build @magickml/docs",
"build-engine": "npx nx build @magickml/core",
"build-engine": "npx nx build shared/core",
"test": "npx nx test",
"test:core": "npx nx test @magickml/core",
"test:core": "npx nx test shared/core",
"nukefromorbit": "rimraf ./packages/**/node_modules && rimraf ./node_modules && rimraf ./apps/**/node_modules",
"remove": "npx nx generate @nx/workspace:remove",
"sortPackage": "npx sort-package-json",
Expand Down
3 changes: 2 additions & 1 deletion packages/client/editor/src/components/Workspace.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ const Workspace = ({ tab, pubSub }) => {
const props = {
tab,
node,
spellId: ''
}
const component = node.getComponent()
switch (component) {
Expand All @@ -117,7 +118,7 @@ const Workspace = ({ tab, pubSub }) => {

return (
<>
<EventHandler tab={tab} pubSub={pubSub} />
<EventHandler tab={tab} pubSub={pubSub} spellId="" />
<Layout json={tab.layoutJson} factory={factory(tab)} tab={tab} />
</>
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,6 @@ function DocumentTable({ documents }) {
): DocumentData => {
return {
row,
fileName,
content,
type,
projectId,
Expand Down
2 changes: 1 addition & 1 deletion packages/client/feathers-redux-toolkit/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"forceConsistentCasingInFileNames": true,
"strict": true,
"noImplicitOverride": true,
"noPropertyAccessFromIndexSignature": true,
"noPropertyAccessFromIndexSignature": false,
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true,
"types": ["vitest"]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// DOCUMENTED
import { SpellInterface } from '@magickml/core'
import { SpellInterface } from 'shared/core'
import otJson0 from 'ot-json0'
import { app } from '../../app'
import { Params } from '@feathersjs/feathers'
Expand Down
4 changes: 2 additions & 2 deletions packages/plugins/anthropic/server/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// UNDOCUMENTED
/**
* A plugin for the @magickml/core that adds anthropic completion functionality
* A plugin for the shared/core that adds anthropic completion functionality
*
* @remarks
* The plugin uses handlers for text, chat and text embedding which are defined in the 'makeTextCompletion',
Expand Down Expand Up @@ -28,7 +28,7 @@ const completionHandlers = {
}

/**
* A server plugin for the @magickml/core that adds anthropic completion functionality
* A server plugin for the shared/core that adds anthropic completion functionality
*/
const anthropicPlugin = new ServerPlugin({
name: 'anthropicPlugin',
Expand Down
2 changes: 1 addition & 1 deletion packages/plugins/avatar/client/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import App from './App'

/**
* This module provides an AvatarPlugin to be used
* with the @magickml/core client-side library.
* with the shared/core client-side library.
* @module AvatarPlugin
*/

Expand Down
4 changes: 2 additions & 2 deletions packages/plugins/database/server/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// DOCUMENTED
/**
* A plugin for the @magickml/core that adds OpenAI completion functionality
* A plugin for the shared/core that adds OpenAI completion functionality
*
* @remarks
* The plugin uses handlers for text, chat and text embedding which are defined in the 'makeTextCompletion',
Expand Down Expand Up @@ -32,7 +32,7 @@ const completionHandlers = {
}

/**
* A server plugin for the @magickml/core that adds OpenAI completion functionality
* A server plugin for the shared/core that adds OpenAI completion functionality
*/
const databasePlugin = new ServerPlugin({
name: 'databasePlugin',
Expand Down
4 changes: 2 additions & 2 deletions packages/plugins/elevenlabs/server/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// DOCUMENTED
/**
* A plugin for the @magickml/core that adds elevenlabs completion functionality
* A plugin for the shared/core that adds elevenlabs completion functionality
*
* @remarks
* The plugin uses handlers for text, chat and text embedding which are defined in the 'makeTextCompletion',
Expand Down Expand Up @@ -28,7 +28,7 @@ const completionHandlers = {
}

/**
* A server plugin for the @magickml/core that adds elevenlabs completion functionality
* A server plugin for the shared/core that adds elevenlabs completion functionality
*/
const elevenlabsPlugin = new ServerPlugin({
name: 'elevenlabsPlugin',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ type InputReturn =
* It belongs to the Ethereum family according to the specification in the constructor.
*
* @remarks
* This component extends the MagickComponent class from the @magickml/core module and has an async worker method.
* This component extends the MagickComponent class from the shared/core module and has an async worker method.
*
* @returns a promise with a custom InputReturn type
*/
Expand Down Expand Up @@ -96,9 +96,9 @@ export class GetRecentTxsFromWallet extends MagickComponent<
* @remarks
* As shown before, the component expects a custom return of the InputReturn type.
*
* @param node - Required by the worker and uses the WorkerData type from the @magickml/core module.
* @param inputs - Required by the worker and uses the MagickWorkerInputs type from the @magickml/core module.
* @param outputs - Required by the worker and uses the MagickWorkerOutputs type from the @magickml/core module.
* @param node - Required by the worker and uses the WorkerData type from the shared/core module.
* @param inputs - Required by the worker and uses the MagickWorkerInputs type from the shared/core module.
* @param outputs - Required by the worker and uses the MagickWorkerOutputs type from the shared/core module.
* @param data - A property of the worker method which defines the wallet address.
*
* @returns a promise with a custom InputReturn type
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { CompletionHandlerInputData, saveRequest } from 'shared/core'
import { GOOGLEAI_ENDPOINT } from '../constants'
import { trackGoogleAIUsage } from 'server/core'
import { wordCount } from './shared'
import { DEFAULT_GOOGLEAI_API_KEY } from '@magickml/config'
import { DEFAULT_GOOGLEAI_API_KEY } from 'shared/config'

type ChatMessage = {
author?: string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { CompletionHandlerInputData, saveRequest } from 'shared/core'
import { GOOGLEAI_ENDPOINT } from '../constants'
import { trackGoogleAIUsage } from 'server/core'
import { wordCount } from './shared'
import { DEFAULT_GOOGLEAI_API_KEY } from '@magickml/config'
import { DEFAULT_GOOGLEAI_API_KEY } from 'shared/config'

/**
* Makes an API request to an AI text completion service.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
import { GOOGLEAI_ENDPOINT } from '../constants'
import { trackGoogleAIUsage } from 'server/core'
import { wordCount } from './shared'
import { DEFAULT_GOOGLEAI_API_KEY } from '@magickml/config'
import { DEFAULT_GOOGLEAI_API_KEY } from 'shared/config'

/**
* A function that makes a request to create a text embedding using GoogleAI's
Expand Down
4 changes: 2 additions & 2 deletions packages/plugins/googleai/server/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// DOCUMENTED
/**
* A plugin for the @magickml/core that adds GoogleAI completion functionality
* A plugin for the shared/core that adds GoogleAI completion functionality
*
* @remarks
* The plugin uses handlers for text, chat and text embedding which are defined in the 'makeTextCompletion',
Expand Down Expand Up @@ -34,7 +34,7 @@ const completionHandlers = {
}

/**
* A server plugin for the @magickml/core that adds GoogleAI completion functionality
* A server plugin for the shared/core that adds GoogleAI completion functionality
*/
const GoogleAIPlugin = new ServerPlugin({
name: 'GoogleAIPlugin',
Expand Down
4 changes: 2 additions & 2 deletions packages/plugins/localmodel/server/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// DOCUMENTED
/**
* A plugin for the @magickml/core that adds LocalModel completion functionality
* A plugin for the shared/core that adds LocalModel completion functionality
*
* @remarks
* The plugin uses handlers for text, chat and text embedding which are defined in the 'makeTextCompletion',
Expand Down Expand Up @@ -34,7 +34,7 @@ const completionHandlers = {
}

/**
* A server plugin for the @magickml/core that adds local completion functionality
* A server plugin for the shared/core that adds local completion functionality
*/
const LocalModelPlugin = new ServerPlugin({
name: 'LocalModelPlugin',
Expand Down
4 changes: 2 additions & 2 deletions packages/plugins/openai/server/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// DOCUMENTED
/**
* A plugin for the @magickml/core that adds OpenAI completion functionality
* A plugin for the shared/core that adds OpenAI completion functionality
*
* @remarks
* The plugin uses handlers for text, chat and text embedding which are defined in the 'makeTextCompletion',
Expand Down Expand Up @@ -36,7 +36,7 @@ const completionHandlers = {
}

/**
* A server plugin for the @magickml/core that adds OpenAI completion functionality
* A server plugin for the shared/core that adds OpenAI completion functionality
*/
const OpenAIPlugin = new ServerPlugin({
name: 'OpenAIPlugin',
Expand Down
6 changes: 3 additions & 3 deletions packages/server/core/src/auth/cloudAuthentication.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export class CloudJwtService extends AuthenticationService {
* @param params - The parameters required for authentication
* @returns payload with permissions if exists
*/
async getPayload(authResult, params) {
override async getPayload(authResult, params) {
// Call original `getPayload` first
const payload = await super.getPayload(authResult, params)
const { user } = authResult
Expand All @@ -54,7 +54,7 @@ export class CloudJwtService extends AuthenticationService {
* @param secretOverride - Override the secret used for encryption
* @returns decrypted token payload
*/
async verifyAccessToken(
override async verifyAccessToken(
token: string,
_optsOverride,
secretOverride?: string
Expand Down Expand Up @@ -86,7 +86,7 @@ export class CloudJwtService extends AuthenticationService {
* @param allowed - Allowed authentication strategies
* @returns Authentication result
*/
async authenticate(
override async authenticate(
authentication: AuthenticationRequest,
params: AuthenticationParams,
...allowed: string[]
Expand Down
11 changes: 7 additions & 4 deletions packages/server/core/src/communication/PubSub/Redis.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { RedisPubSub } from 'server/redis-pubsub'
import { PubSub } from './PubSub'

import { app } from '../../app';
import { app } from '../../app'

export class RedisPubSubWrapper extends PubSub {
pubsub: RedisPubSub
Expand All @@ -11,15 +11,18 @@ export class RedisPubSubWrapper extends PubSub {
this.pubsub = app.get('pubsub')
}

async publish(channel: string, message: string): Promise<void> {
override async publish(channel: string, message: string): Promise<void> {
return await this.pubsub.publish(channel, message)
}

async subscribe(channel: string, callback: Function): Promise<void> {
override async subscribe(channel: string, callback: Function): Promise<void> {
return await this.pubsub.subscribe(channel, callback)
}

async patternSubscribe(pattern: string, callback: Function): Promise<void> {
override async patternSubscribe(
pattern: string,
callback: Function
): Promise<void> {
return await this.pubsub.patternSubscribe(pattern, callback)
}
}
2 changes: 1 addition & 1 deletion packages/server/core/src/communication/Workers/BullMQ.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export class BullMQWorker extends Worker {
super()
}

initialize(
override initialize(
queueName: string,
callback: (job: Job<any>) => Promise<any>
): void {
Expand Down
10 changes: 5 additions & 5 deletions packages/server/core/src/config/types.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// DOCUMENTED
// Import the required types from '@magickml/core' and rename them to avoid naming conflicts.
// Import the required types from 'shared/core' and rename them to avoid naming conflicts.
import {
Route as MagickRoute,
Middleware as MagickMiddleware,
Expand All @@ -8,21 +8,21 @@ import {
} from 'shared/core'

/**
* Type alias for Middleware imported from '@magickml/core'.
* Type alias for Middleware imported from 'shared/core'.
*/
export type Middleware = MagickMiddleware

/**
* Type alias for Method imported from '@magickml/core'.
* Type alias for Method imported from 'shared/core'.
*/
export type Method = MagickMethod

/**
* Type alias for Handler imported from '@magickml/core'.
* Type alias for Handler imported from 'shared/core'.
*/
export type Handler = MagickHandler

/**
* Type alias for Route imported from '@magickml/core'.
* Type alias for Route imported from 'shared/core'.
*/
export type Route = MagickRoute
Loading

0 comments on commit 9d1eb3a

Please sign in to comment.