Skip to content

Commit

Permalink
Showing 1,495 changed files with 39,902 additions and 31,134 deletions.
7 changes: 5 additions & 2 deletions .env
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
###### Default settings, override in .env.local file that is auto-generated on install ######
DATABASE_URL=postgresql://magick:magick_default_pw@localhost:5432/magick
# Copy these to .env.local and fill in your own values to customize
CLIENT_PLUGINS=github,rest,discord,twitter,loop,task,googleai,openai,search,bluesky,avatar,elevenlabs,database,anthropic,intent
SERVER_PLUGINS=github,rest,discord,twitter,loop,task,googleai,openai,search,bluesky,elevenlabs,database,anthropic,intent
# CLIENT_PLUGINS=github,rest,discord,twitter,loop,task,googleai,openai,search,bluesky,elevenlabs,database,anthropic,intent
# SERVER_PLUGINS=github,rest,discord,twitter,loop,task,googleai,openai,search,bluesky,elevenlabs,database,anthropic,intent
CLIENT_PLUGINS=discord,twitter,loop,googleai,openai,search,elevenlabs,database,anthropic,intent,rest
SERVER_PLUGINS=discord,twitter,loop,googleai,openai,search,elevenlabs,database,anthropic,intent,rest


# Memory to use for build cache
NODE_OPTIONS="--max-old-space-size=8192"
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
packages/plugins/discord/shared/src/types/ChannelType.ts
2 changes: 1 addition & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
@@ -10,7 +10,7 @@
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
"rules": {
"no-extra-semi": "off",
"@typescript-eslint/no-extra-semi": "off",
"@typescript-eslint/no-extra-semipackages/client/core/src/components/Drawer/Newsidebar": "off",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/ban-types": "off"
}
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -60,4 +60,4 @@ data.json
/logs
docstore.json
.vercel
.nx
.nx
3 changes: 2 additions & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Add files here to ignore them from prettier formatting
/dist
/coverage
/coverage
/.nx/cache
3 changes: 3 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"recommendations": ["ms-playwright.playwright"]
}
11 changes: 11 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -28,6 +28,17 @@
"request": "attach",
"port": 7777
},
{
"name": "CloudAgentWorker",
"type": "node",
"request": "attach",
"port": 8089,
"resolveSourceMapLocations": [
"${workspaceFolder}/**",
"!**/node_modules/**"
],
"outFiles": ["${workspaceFolder}/dist/**/*.js"]
},
{
"name": "Server",
"type": "node",
2 changes: 1 addition & 1 deletion apps/agent/knexfile.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { DATABASE_URL } from '@magickml/config'
import { DATABASE_URL } from 'shared/config'

const config = {
client: 'pg',
2 changes: 1 addition & 1 deletion apps/agent/package.json
Original file line number Diff line number Diff line change
@@ -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"
}
}
11 changes: 5 additions & 6 deletions apps/agent/project.json
Original file line number Diff line number Diff line change
@@ -4,9 +4,9 @@
"sourceRoot": "apps/agent/src",
"projectType": "application",
"implicitDependencies": [
"@magickml/server-core",
"@magickml/core",
"@magickml/agents",
"server-core",
"shared-core",
"server-agents",
"@magickml/plugin-*"
],
"targets": {
@@ -56,7 +56,7 @@
}
},
"lint": {
"executor": "@nx/linter:eslint",
"executor": "@nx/eslint:lint",
"outputs": [
"{options.outputFile}"
],
@@ -72,8 +72,7 @@
"{workspaceRoot}/coverage/{projectRoot}"
],
"options": {
"jestConfig": "apps/agent/jest.config.ts",
"passWithNoTests": true
"jestConfig": "apps/agent/jest.config.ts"
}
}
},
8 changes: 4 additions & 4 deletions apps/agent/src/index.ts
Original file line number Diff line number Diff line change
@@ -5,12 +5,12 @@
* @packageDocumentation
*/

import { AgentManager } from '@magickml/agents'
import { app, initApp } from '@magickml/server-core'
import { initLogger, getLogger } from '@magickml/core'
import { AgentManager } from 'server/agents'
import { app, initApp } from 'server/core'
import { initLogger, getLogger } from 'shared/core'
import 'regenerator-runtime/runtime'
import pluginExports from './plugins'
import { PRODUCTION, DONT_CRASH_ON_ERROR } from '@magickml/config'
import { PRODUCTION, DONT_CRASH_ON_ERROR } from 'shared/config'

/**
* Asynchronously loads the application's plugins and logs their names.
4 changes: 2 additions & 2 deletions apps/agent/test/app.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// For more information about this file see https://dove.feathersjs.com/guides/cli/app.test.html
import assert from 'assert'
import axios from 'axios'
import { app } from '@magickml/server-core'
import { app } from 'server/core'

const port = app.get('port')
const appUrl = `http://${app.get('host')}:${port}`
@@ -16,7 +16,7 @@ describe('Feathers application tests', () => {
it('shows a 404 JSON error', async () => {
try {
await axios.get(`${appUrl}/path/to/nowhere`, {
responseType: 'json',
responseType: 'json'
})
assert.fail('should never get here')
} catch (error: any) {
30 changes: 10 additions & 20 deletions apps/client/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,36 +1,26 @@
{
"extends": [
"plugin:playwright/recommended",
"plugin:@nx/react",
"../../.eslintrc.json"
],
"ignorePatterns": [
"!**/*",
"**/node_modules/**",
"src/plugins.ts"
],
"ignorePatterns": ["!**/*", "**/node_modules/**", "src/plugins.ts"],
"overrides": [
{
"files": [
"*.ts",
"*.tsx",
"*.js",
"*.jsx"
],
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
"rules": {}
},
{
"files": ["*.ts", "*.tsx"],
"rules": {}
},
{
"files": [
"*.ts",
"*.tsx"
],
"files": ["*.js", "*.jsx"],
"rules": {}
},
{
"files": [
"*.js",
"*.jsx"
],
"files": ["e2e/**/*.{ts,js,tsx,jsx}"],
"rules": {}
}
]
}
}
8 changes: 8 additions & 0 deletions apps/client/e2e/example.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { test, expect } from '@playwright/test'

test('has title', async ({ page }) => {
await page.goto('/')

// Expect h1 to contain a substring.
expect(await page.locator('h1').innerText()).toContain('Welcome')
})
33 changes: 33 additions & 0 deletions apps/client/playwright.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import { defineConfig } from '@playwright/test'
import { nxE2EPreset } from '@nx/playwright/preset'

import { workspaceRoot } from '@nx/devkit'

// For CI, you may want to set BASE_URL to the deployed application.
const baseURL = process.env['BASE_URL'] || 'http://localhost:4200'

/**
* Read environment variables from file.
* https://github.com/motdotla/dotenv
*/
// require('dotenv').config();

/**
* See https://playwright.dev/docs/test-configuration.
*/
export default defineConfig({
...nxE2EPreset(__filename, { testDir: './e2e' }),
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
use: {
baseURL,
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
trace: 'on-first-retry',
},
/* Run your local dev server before starting the tests */
webServer: {
command: 'npm run dev',
url: 'http://localhost:4200',
reuseExistingServer: !process.env.CI,
cwd: workspaceRoot,
},
})
14 changes: 10 additions & 4 deletions apps/client/project.json
Original file line number Diff line number Diff line change
@@ -3,7 +3,7 @@
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "apps/client/src",
"projectType": "application",
"implicitDependencies": ["@magickml/editor", "@magickml/core"],
"implicitDependencies": ["client-editor", "shared-core"],
"targets": {
"build": {
"executor": "@nx/vite:build",
@@ -57,7 +57,7 @@
}
},
"lint": {
"executor": "@nx/linter:eslint",
"executor": "@nx/eslint:lint",
"outputs": ["{options.outputFile}"],
"options": {
"lintFilePatterns": ["apps/client/**/*.{ts,tsx,js,jsx}"]
@@ -67,8 +67,14 @@
"executor": "@nx/jest:jest",
"outputs": ["{workspaceRoot}/coverage/apps/client"],
"options": {
"jestConfig": "apps/client/jest.config.ts",
"passWithNoTests": true
"jestConfig": "apps/client/jest.config.ts"
}
},
"e2e": {
"executor": "@nx/playwright:playwright",
"outputs": ["{workspaceRoot}/dist/.playwright/apps/client"],
"options": {
"config": "apps/client/playwright.config.ts"
}
}
},
22 changes: 13 additions & 9 deletions apps/client/src/main.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// DOCUMENTED
import { createRoot } from 'react-dom/client'
import { MagickIDE } from '@magickml/editor'
import { AppConfig } from '@magickml/client-core'
import { MagickIDE } from 'client/editor'
import {
DEFAULT_PROJECT_ID,
API_ROOT_URL,
@@ -10,16 +9,17 @@ import {
POSTHOG_ENABLED,
DEFAULT_USER_TOKEN,
STANDALONE,
} from '@magickml/config'
} from 'shared/config'
import { PostHogProvider } from 'posthog-js/react'
import { initLogger, getLogger } from '@magickml/core'
import { initLogger, getLogger } from 'shared/core'

import plugins from './plugins'
import { AppConfig } from '@magickml/providers'

// We want to add this back in eventually, but it's causing some visual bugs
//import './globals.css'

initLogger({ name: "AIDE" })
initLogger({ name: 'AIDE' })

const logger = getLogger()

@@ -28,9 +28,9 @@ logger.info('loaded with plugins %o', plugins)
* Initialize and render the MagickIDE component when running as a standalone editor (not inside an iframe)
*/
if (window === window.parent) {
logger.info("not in iframe")
logger.info('not in iframe')
if (STANDALONE) {
logger.info("standalone")
logger.info('standalone')
const container = document.getElementById('root') as Element
const root = createRoot(container) // createRoot(container!) if you use TypeScript
; (window as any).root = root
@@ -56,11 +56,15 @@ if (window === window.parent) {
root.render(<Root />)
}
} else {
logger.info("iframe: In iframe")
logger.info('iframe: In iframe')
/**
* If the editor is loaded in an iframe, listen for messages from the parent to initialize and render the MagickIDE component
*/
const TRUSTED_PARENT_URLS = [TRUSTED_PARENT_URL, 'https://www.magickml.com', 'https://beta.magickml.com'].map(url => url.replace(/\/+$/, ''));
const TRUSTED_PARENT_URLS = [
TRUSTED_PARENT_URL,
'https://www.magickml.com',
'https://beta.magickml.com']
.map(url => url.replace(/\/+$/, ''));

window.addEventListener(
'message',
4 changes: 2 additions & 2 deletions apps/cloud-agent-manager/project.json
Original file line number Diff line number Diff line change
@@ -39,10 +39,10 @@
}
},
"lint": {
"executor": "@nx/linter:eslint",
"executor": "@nx/eslint:lint",
"outputs": ["{options.outputFile}"],
"options": {
"lintFilePatterns": ["packages/cloud-agent-manager/**/*.ts"]
"lintFilePatterns": ["packages/server/cloud-agent-manager/**/*.ts"]
}
},
"test": {
33 changes: 17 additions & 16 deletions apps/cloud-agent-manager/src/main.ts
Original file line number Diff line number Diff line change
@@ -1,23 +1,24 @@
import { CloudAgentManager, FeathersSyncReporter } from "@magickml/cloud-agent-manager"
import { initLogger, getLogger } from "@magickml/core"
import { app, BullQueue, initApp } from "@magickml/server-core"
import { DONT_CRASH_ON_ERROR, PRODUCTION } from "@magickml/config"
import { initAgentCommander } from "@magickml/agents"
import {
CloudAgentManager,
FeathersSyncReporter,
} from 'server/cloud-agent-manager'
import { initLogger, getLogger } from 'shared/core'
import { app, BullQueue, initApp } from 'server/core'
import { DONT_CRASH_ON_ERROR, PRODUCTION } from 'shared/config'
import { initAgentCommander } from 'server/agents'
import { getPinoTransport } from '@hyperdx/node-opentelemetry'

if (PRODUCTION) {
initLogger({
name: 'cloud-agent-manager',
transport: {
targets: [
getPinoTransport('info')
]
},
level: 'info',
})
initLogger({
name: 'cloud-agent-manager',
transport: {
targets: [getPinoTransport('info')],
},
level: 'info',
})
} else {
initLogger({ name: 'cloud-agent-manager' })
}
initLogger({ name: 'cloud-agent-manager' })
}
const logger = getLogger()

function start() {
4 changes: 2 additions & 2 deletions apps/cloud-agent-worker/project.json
Original file line number Diff line number Diff line change
@@ -41,10 +41,10 @@
}
},
"lint": {
"executor": "@nx/linter:eslint",
"executor": "@nx/eslint:lint",
"outputs": ["{options.outputFile}"],
"options": {
"lintFilePatterns": ["packages/cloud-agent-worker/**/*.ts"]
"lintFilePatterns": ["packages/server/cloud-agent-worker/**/*.ts"]
}
},
"test": {
Loading

0 comments on commit d37e8fc

Please sign in to comment.