├── docs ├── .nvmrc ├── src │ ├── lib │ │ ├── constants.ts │ │ └── utils.ts │ ├── app │ │ ├── favicon.ico │ │ ├── docs │ │ │ ├── layout.tsx │ │ │ └── [...slug] │ │ │ │ ├── page.tsx │ │ │ │ └── loading.tsx │ │ ├── api │ │ │ └── docs │ │ │ │ ├── navigation │ │ │ │ └── route.ts │ │ │ │ ├── raw │ │ │ │ ├── [...slug] │ │ │ │ │ └── route.ts │ │ │ │ └── route.ts │ │ │ │ └── search │ │ │ │ └── route.ts │ │ └── layout.tsx │ ├── components │ │ ├── ui │ │ │ ├── skeleton.tsx │ │ │ ├── collapsible.tsx │ │ │ ├── textarea.tsx │ │ │ ├── label.tsx │ │ │ ├── input.tsx │ │ │ ├── separator.tsx │ │ │ ├── progress.tsx │ │ │ ├── slider.tsx │ │ │ ├── switch.tsx │ │ │ ├── badge.tsx │ │ │ ├── tooltip.tsx │ │ │ └── avatar.tsx │ │ ├── theme-provider.tsx │ │ └── mode-toggle.tsx │ └── docs │ │ ├── terminology │ │ ├── index.md │ │ └── backtesting.md │ │ ├── the0-CLI │ │ ├── index.md │ │ └── installation.md │ │ ├── index.md │ │ └── custom-bot-development │ │ └── index.md ├── public │ ├── docs │ │ ├── backtesting-1.png │ │ ├── backtesting-2.png │ │ └── test-doc-image.png │ ├── vercel.svg │ └── next.svg ├── postcss.config.js ├── postcss.config.mjs ├── next.config.mjs ├── components.json ├── tsconfig.json └── README.md ├── services ├── 0vers33r │ ├── src │ │ ├── __init__.py │ │ ├── common │ │ │ ├── __init__.py │ │ │ └── logging.py │ │ ├── services │ │ │ ├── __init__.py │ │ │ ├── firestore_database.py │ │ │ └── cloud_storage.py │ │ ├── tests │ │ │ ├── __init__.py │ │ │ └── test_samples │ │ │ │ └── js_code_injection.js │ │ └── interfaces │ │ │ └── __init__.py │ ├── .gitignore │ └── Dockerfile └── the0-ai │ ├── api │ ├── __init__.py │ ├── models │ │ └── __init__.py │ └── schemas.py │ ├── the0 │ ├── tools │ │ └── __init__.py │ ├── __init__.py │ └── agents │ │ ├── __init__.py │ │ └── base.py │ ├── tests │ ├── api │ │ └── __init__.py │ ├── __init__.py │ └── the0 │ │ ├── tools │ │ └── __init__.py │ │ └── __init__.py │ ├── alembic │ ├── README │ └── script.py.mako │ ├── .gitignore │ ├── entrypoint.sh │ ├── .env.example │ ├── pytest.ini │ └── Dockerfile ├── .gitignore ├── frontend ├── src │ ├── lib │ │ ├── constants.ts │ │ ├── auth │ │ │ ├── index.ts │ │ │ └── types.ts │ │ ├── utils.ts │ │ ├── result.ts │ │ ├── bot-type.ts │ │ ├── config.ts │ │ ├── axios.ts │ │ ├── auth-fetch.ts │ │ └── users.ts │ ├── components │ │ ├── spinner │ │ │ ├── index.ts │ │ │ └── Spinner.tsx │ │ ├── plotting │ │ │ └── index.ts │ │ ├── dashboard │ │ │ ├── index.ts │ │ │ └── CustomTable.tsx │ │ ├── trading-view │ │ │ └── index.ts │ │ ├── main-navigation │ │ │ ├── index.ts │ │ │ └── nav-item.tsx │ │ ├── settings │ │ │ ├── api-section.tsx │ │ │ └── profile-section.tsx │ │ ├── ui │ │ │ ├── skeleton.tsx │ │ │ ├── collapsible.tsx │ │ │ ├── textarea.tsx │ │ │ ├── label.tsx │ │ │ ├── input.tsx │ │ │ ├── separator.tsx │ │ │ ├── progress.tsx │ │ │ ├── toaster.tsx │ │ │ ├── slider.tsx │ │ │ ├── switch.tsx │ │ │ ├── badge.tsx │ │ │ ├── tooltip.tsx │ │ │ └── avatar.tsx │ │ ├── theme-provider.tsx │ │ ├── ai-agent │ │ │ ├── chat │ │ │ │ ├── TypingIndicator.tsx │ │ │ │ ├── ChatPanel.tsx │ │ │ │ └── ChatInput.tsx │ │ │ ├── ui │ │ │ │ ├── label.tsx │ │ │ │ ├── textarea.tsx │ │ │ │ ├── separator.tsx │ │ │ │ ├── input.tsx │ │ │ │ ├── sonner.tsx │ │ │ │ ├── slider.tsx │ │ │ │ └── switch.tsx │ │ │ ├── artifacts │ │ │ │ └── FileTree.tsx │ │ │ ├── layout │ │ │ │ └── CollapsibleArtifactsPanel.tsx │ │ │ └── common │ │ │ │ └── ArtifactIndicator.tsx │ │ ├── custom-bots │ │ │ ├── status-badge.tsx │ │ │ ├── loading-detail-state.tsx │ │ │ ├── empty-state.tsx │ │ │ ├── loading-state.tsx │ │ │ └── status-header.tsx │ │ ├── auth │ │ │ └── with-auth.tsx │ │ └── mode-toggle.tsx │ ├── app │ │ ├── favicon.ico │ │ ├── providers.tsx │ │ ├── settings │ │ │ ├── profile │ │ │ │ └── page.tsx │ │ │ └── api-settings │ │ │ │ └── page.tsx │ │ ├── custom-bots │ │ │ ├── page.tsx │ │ │ ├── [name] │ │ │ │ └── page.tsx │ │ │ └── not-found.tsx │ │ ├── page.tsx │ │ ├── api │ │ │ ├── ai-agent │ │ │ │ ├── chat │ │ │ │ │ ├── route.ts │ │ │ │ │ └── stream │ │ │ │ │ │ └── route.ts │ │ │ │ ├── sessions │ │ │ │ │ └── route.ts │ │ │ │ └── artifacts │ │ │ │ │ ├── route.ts │ │ │ │ │ └── [filename] │ │ │ │ │ └── route.ts │ │ │ ├── custom-bots │ │ │ │ └── route.ts │ │ │ └── api-keys │ │ │ │ └── stats │ │ │ │ └── summary │ │ │ │ └── route.ts │ │ ├── register │ │ │ └── page.tsx │ │ ├── install-cli │ │ │ ├── layout.tsx │ │ │ └── loading.tsx │ │ └── layout.tsx │ ├── types │ │ ├── operation.ts │ │ ├── index.ts │ │ └── ai-agent.ts │ ├── stores │ │ └── ai-agent │ │ │ ├── themeStore.ts │ │ │ ├── settingsStore.ts │ │ │ └── uiStore.ts │ └── middleware.ts ├── postcss.config.js ├── public │ ├── docs │ │ ├── backtesting-1.png │ │ ├── backtesting-2.png │ │ └── test-doc-image.png │ ├── vercel.svg │ └── next.svg ├── __mocks__ │ ├── remark-gfm.js │ ├── remark-breaks.js │ ├── react-markdown.js │ ├── uuid.js │ └── react-syntax-highlighter.js ├── postcss.config.mjs ├── next.config.mjs ├── components.json ├── tsconfig.json ├── jest.config.ts └── README.md ├── api ├── .gitignore ├── src │ ├── common │ │ ├── index.ts │ │ ├── entites │ │ │ └── base.entity.ts │ │ ├── result.ts │ │ └── repository.ts │ ├── database │ │ ├── migrations │ │ │ ├── 0002_petite_doctor_faustus.sql │ │ │ ├── 0001_breezy_sentinels.sql │ │ │ └── meta │ │ │ │ └── _journal.json │ │ ├── schema │ │ │ └── index.ts │ │ └── migrate.ts │ ├── backtest │ │ ├── backtest.constants.ts │ │ ├── dto │ │ │ └── create-backtest.dto.ts │ │ ├── entities │ │ │ └── backtest.entity.ts │ │ ├── backtest.module.ts │ │ └── backtest.repository.ts │ ├── app.service.ts │ ├── auth │ │ ├── dto │ │ │ └── validate-token.dto.ts │ │ ├── current-user.decorator.ts │ │ ├── auth-combined.decorator.ts │ │ └── auth.module.ts │ ├── api-key │ │ ├── api-key.decorator.ts │ │ ├── models │ │ │ └── api-key.model.ts │ │ ├── dto │ │ │ ├── api-key-created-response.dto.ts │ │ │ ├── api-key-response.dto.ts │ │ │ └── create-api-key.dto.ts │ │ └── api-key.module.ts │ ├── bot │ │ ├── dto │ │ │ ├── update-bot.dto.ts │ │ │ └── create-bot.dto.ts │ │ ├── entities │ │ │ └── bot.entity.ts │ │ ├── bot.repository.ts │ │ ├── bot.constants.ts │ │ └── bot.module.ts │ ├── nats │ │ └── nats.module.ts │ ├── app.controller.ts │ ├── logs │ │ ├── logs.module.ts │ │ ├── dto │ │ │ └── get-logs-query.dto.ts │ │ └── logs.controller.ts │ ├── app.controller.spec.ts │ ├── custom-bot │ │ └── custom-bot.module.ts │ ├── app.module.ts │ ├── main.ts │ └── config │ │ └── configuration.ts ├── tsconfig.build.json ├── nest-cli.json ├── test │ ├── jest-e2e.json │ └── app.e2e-spec.ts ├── .dockerignore ├── tsconfig.json └── drizzle.config.ts ├── cli ├── .gitignore ├── stories │ └── story.example.md ├── .the0ignore.example └── Makefile ├── runtime ├── .gitignore ├── internal │ ├── fixtures │ │ ├── js-test-bot.zip │ │ ├── py-test-bot.zip │ │ └── py-multi-test-bot.zip │ ├── util │ │ ├── validators.go │ │ ├── paritioning.go │ │ └── cron.go │ ├── metrics │ │ └── segment_metrics.go │ ├── model │ │ └── executable.go │ ├── constants │ │ └── database.go │ ├── bot-runner │ │ └── server │ │ │ └── master.go │ ├── backtest-runner │ │ ├── server │ │ │ └── master.go │ │ └── model │ │ │ └── backtest.go │ ├── bot-scheduler │ │ └── server │ │ │ └── master.go │ └── docker-runner │ │ └── entrypoints │ │ └── code_entrypoint_factory.go ├── pb │ └── worker.proto ├── start-application.sh ├── .dockerignore ├── deploy │ └── README.md └── Makefile ├── site ├── src │ ├── app │ │ ├── favicon.ico │ │ ├── page.tsx │ │ └── layout.tsx │ ├── lib │ │ ├── utils.ts │ │ └── constants.ts │ └── components │ │ ├── theme-provider.tsx │ │ ├── ui │ │ ├── input.tsx │ │ └── badge.tsx │ │ ├── mode-toggle.tsx │ │ └── landing-page │ │ └── hero.tsx ├── .prettierrc ├── postcss.config.js ├── public │ ├── vercel.svg │ ├── window.svg │ ├── file.svg │ ├── globe.svg │ └── next.svg ├── next.config.ts ├── components.json ├── eslint.config.mjs ├── .gitignore ├── tsconfig.json ├── README.md └── package.json ├── k8s ├── Chart.yaml └── templates │ └── ingress.yaml ├── .github └── workflows │ └── cli.yml └── docker └── .env.example /docs/.nvmrc: -------------------------------------------------------------------------------- 1 | 22.19.0 -------------------------------------------------------------------------------- /services/0vers33r/src/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /services/the0-ai/api/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /services/0vers33r/src/common/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /services/0vers33r/src/services/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /services/0vers33r/src/tests/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /services/the0-ai/the0/tools/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | **/*/.claude 2 | CLAUDE.md 3 | notes/ -------------------------------------------------------------------------------- /services/the0-ai/the0/__init__.py: -------------------------------------------------------------------------------- 1 | from . import agent 2 | -------------------------------------------------------------------------------- /docs/src/lib/constants.ts: -------------------------------------------------------------------------------- 1 | export const APP_NAME = "the0"; 2 | -------------------------------------------------------------------------------- /services/the0-ai/tests/api/__init__.py: -------------------------------------------------------------------------------- 1 | # API tests package 2 | -------------------------------------------------------------------------------- /frontend/src/lib/constants.ts: -------------------------------------------------------------------------------- 1 | export const APP_NAME = "the0"; 2 | -------------------------------------------------------------------------------- /services/the0-ai/alembic/README: -------------------------------------------------------------------------------- 1 | Generic single-database configuration. -------------------------------------------------------------------------------- /services/the0-ai/tests/__init__.py: -------------------------------------------------------------------------------- 1 | # Test package for the0-ai service 2 | -------------------------------------------------------------------------------- /services/the0-ai/tests/the0/tools/__init__.py: -------------------------------------------------------------------------------- 1 | # Tools tests package 2 | -------------------------------------------------------------------------------- /api/.gitignore: -------------------------------------------------------------------------------- 1 | dist/ 2 | node_modules 3 | package-lock.json 4 | .env 5 | .idea/ -------------------------------------------------------------------------------- /api/src/common/index.ts: -------------------------------------------------------------------------------- 1 | export { Result, Ok, Failure } from "./result"; 2 | -------------------------------------------------------------------------------- /services/0vers33r/.gitignore: -------------------------------------------------------------------------------- 1 | **/*/*.pyc 2 | .claude/ 3 | CLAUDE.md 4 | venv/ -------------------------------------------------------------------------------- /services/the0-ai/tests/the0/__init__.py: -------------------------------------------------------------------------------- 1 | # Agent and tools tests package 2 | -------------------------------------------------------------------------------- /cli/.gitignore: -------------------------------------------------------------------------------- 1 | the0-cli 2 | the0 3 | 4 | bin 5 | INITIAL.md 6 | .claude/ 7 | CLAUDE.md -------------------------------------------------------------------------------- /api/src/database/migrations/0002_petite_doctor_faustus.sql: -------------------------------------------------------------------------------- 1 | DROP TABLE IF EXISTS "user_bots"; -------------------------------------------------------------------------------- /frontend/src/components/spinner/index.ts: -------------------------------------------------------------------------------- 1 | export { default as Spinner } from "./Spinner"; 2 | -------------------------------------------------------------------------------- /frontend/src/components/plotting/index.ts: -------------------------------------------------------------------------------- 1 | export { default as PlotModal } from "./PlotModal"; 2 | -------------------------------------------------------------------------------- /frontend/src/components/dashboard/index.ts: -------------------------------------------------------------------------------- 1 | export { default as CustomTable } from "./CustomTable"; 2 | -------------------------------------------------------------------------------- /api/src/database/migrations/0001_breezy_sentinels.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE "custom_bots" ADD COLUMN "review" jsonb; -------------------------------------------------------------------------------- /docs/src/app/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexanderwanyoike/the0/HEAD/docs/src/app/favicon.ico -------------------------------------------------------------------------------- /runtime/.gitignore: -------------------------------------------------------------------------------- 1 | pb/*.go 2 | bad-bot.zip 3 | bad-bot/ 4 | CHANGE.md 5 | PR_MESSAGE.md 6 | build/ 7 | notes/ -------------------------------------------------------------------------------- /site/src/app/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexanderwanyoike/the0/HEAD/site/src/app/favicon.ico -------------------------------------------------------------------------------- /frontend/src/app/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexanderwanyoike/the0/HEAD/frontend/src/app/favicon.ico -------------------------------------------------------------------------------- /frontend/src/components/trading-view/index.ts: -------------------------------------------------------------------------------- 1 | export { default as TradingViewChart } from "./TradingViewChart"; 2 | -------------------------------------------------------------------------------- /docs/public/docs/backtesting-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexanderwanyoike/the0/HEAD/docs/public/docs/backtesting-1.png -------------------------------------------------------------------------------- /docs/public/docs/backtesting-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexanderwanyoike/the0/HEAD/docs/public/docs/backtesting-2.png -------------------------------------------------------------------------------- /docs/public/docs/test-doc-image.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexanderwanyoike/the0/HEAD/docs/public/docs/test-doc-image.png -------------------------------------------------------------------------------- /site/.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "semi": true, 3 | "singleQuote": false, 4 | "tabWidth": 2, 5 | "trailingComma": "all" 6 | } 7 | -------------------------------------------------------------------------------- /docs/postcss.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | plugins: { 3 | tailwindcss: {}, 4 | autoprefixer: {}, 5 | }, 6 | }; 7 | -------------------------------------------------------------------------------- /frontend/postcss.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | plugins: { 3 | tailwindcss: {}, 4 | autoprefixer: {}, 5 | }, 6 | }; 7 | -------------------------------------------------------------------------------- /site/postcss.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | plugins: { 3 | tailwindcss: {}, 4 | autoprefixer: {}, 5 | }, 6 | }; 7 | -------------------------------------------------------------------------------- /api/tsconfig.build.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "exclude": ["node_modules", "test", "dist", "**/*spec.ts"] 4 | } 5 | -------------------------------------------------------------------------------- /frontend/public/docs/backtesting-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexanderwanyoike/the0/HEAD/frontend/public/docs/backtesting-1.png -------------------------------------------------------------------------------- /frontend/public/docs/backtesting-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexanderwanyoike/the0/HEAD/frontend/public/docs/backtesting-2.png -------------------------------------------------------------------------------- /frontend/public/docs/test-doc-image.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexanderwanyoike/the0/HEAD/frontend/public/docs/test-doc-image.png -------------------------------------------------------------------------------- /api/src/common/entites/base.entity.ts: -------------------------------------------------------------------------------- 1 | export interface BaseEntity { 2 | id: string; 3 | createdAt?: Date; 4 | updatedAt?: Date; 5 | } 6 | -------------------------------------------------------------------------------- /frontend/__mocks__/remark-gfm.js: -------------------------------------------------------------------------------- 1 | // Mock for remark-gfm 2 | module.exports = function remarkGfm() { 3 | return function () {}; 4 | }; 5 | -------------------------------------------------------------------------------- /runtime/internal/fixtures/js-test-bot.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexanderwanyoike/the0/HEAD/runtime/internal/fixtures/js-test-bot.zip -------------------------------------------------------------------------------- /runtime/internal/fixtures/py-test-bot.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexanderwanyoike/the0/HEAD/runtime/internal/fixtures/py-test-bot.zip -------------------------------------------------------------------------------- /frontend/__mocks__/remark-breaks.js: -------------------------------------------------------------------------------- 1 | // Mock for remark-breaks 2 | module.exports = function remarkBreaks() { 3 | return function () {}; 4 | }; 5 | -------------------------------------------------------------------------------- /runtime/internal/fixtures/py-multi-test-bot.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alexanderwanyoike/the0/HEAD/runtime/internal/fixtures/py-multi-test-bot.zip -------------------------------------------------------------------------------- /services/0vers33r/src/common/logging.py: -------------------------------------------------------------------------------- 1 | import logging 2 | 3 | 4 | logging.basicConfig(level=logging.INFO) 5 | logger = logging.getLogger(__name__) 6 | -------------------------------------------------------------------------------- /site/public/vercel.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/types/operation.ts: -------------------------------------------------------------------------------- 1 | export type Operation = { 2 | type: "subscription_update_confirm" | "payment_method_update"; 3 | operationData?: any; 4 | }; 5 | -------------------------------------------------------------------------------- /api/src/backtest/backtest.constants.ts: -------------------------------------------------------------------------------- 1 | // NATS topics for backtest events 2 | export const BACKTEST_TOPICS = { 3 | CREATED: "the0.backtest.created", 4 | } as const; 5 | -------------------------------------------------------------------------------- /docs/postcss.config.mjs: -------------------------------------------------------------------------------- 1 | /** @type {import('postcss-load-config').Config} */ 2 | const config = { 3 | plugins: { 4 | tailwindcss: {}, 5 | }, 6 | }; 7 | 8 | export default config; 9 | -------------------------------------------------------------------------------- /api/src/app.service.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from "@nestjs/common"; 2 | 3 | @Injectable() 4 | export class AppService { 5 | getHello(): string { 6 | return "Hello World!"; 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /frontend/postcss.config.mjs: -------------------------------------------------------------------------------- 1 | /** @type {import('postcss-load-config').Config} */ 2 | const config = { 3 | plugins: { 4 | tailwindcss: {}, 5 | }, 6 | }; 7 | 8 | export default config; 9 | -------------------------------------------------------------------------------- /frontend/src/components/main-navigation/index.ts: -------------------------------------------------------------------------------- 1 | export { Sidebar } from "./sidebar"; 2 | export { NavItem } from "./nav-item"; 3 | export { UserActionsButton } from "./user-actions-button"; 4 | -------------------------------------------------------------------------------- /services/the0-ai/api/models/__init__.py: -------------------------------------------------------------------------------- 1 | from .database import Base, ChatSession, ChatMessage, Artifact, Setting 2 | 3 | __all__ = ["Base", "ChatSession", "ChatMessage", "Artifact", "Setting"] 4 | -------------------------------------------------------------------------------- /frontend/__mocks__/react-markdown.js: -------------------------------------------------------------------------------- 1 | // Mock for react-markdown 2 | module.exports = function Markdown({ children }) { 3 | return typeof children === "string" ? children : String(children); 4 | }; 5 | -------------------------------------------------------------------------------- /services/the0-ai/.gitignore: -------------------------------------------------------------------------------- 1 | venv 2 | INTIAL.md 3 | .env 4 | bots 5 | testprompt.md 6 | notes/ 7 | .data/ 8 | data/ 9 | **/*.pyc 10 | dist/ 11 | build/ 12 | .pytest_cache/ 13 | */**/__pycache__ -------------------------------------------------------------------------------- /api/src/auth/dto/validate-token.dto.ts: -------------------------------------------------------------------------------- 1 | import { IsNotEmpty, IsString } from "class-validator"; 2 | 3 | export class ValidateTokenDto { 4 | @IsNotEmpty() 5 | @IsString() 6 | token: string; 7 | } 8 | -------------------------------------------------------------------------------- /api/src/api-key/api-key.decorator.ts: -------------------------------------------------------------------------------- 1 | import { SetMetadata } from "@nestjs/common"; 2 | 3 | export const API_KEY_AUTH_KEY = "apiKeyAuth"; 4 | export const ApiKeyAuth = () => SetMetadata(API_KEY_AUTH_KEY, true); 5 | -------------------------------------------------------------------------------- /api/src/bot/dto/update-bot.dto.ts: -------------------------------------------------------------------------------- 1 | import { PartialType } from "@nestjs/mapped-types"; 2 | import { CreateBotDto } from "./create-bot.dto"; 3 | 4 | export class UpdateBotDto extends PartialType(CreateBotDto) {} 5 | -------------------------------------------------------------------------------- /docs/src/lib/utils.ts: -------------------------------------------------------------------------------- 1 | import { clsx, type ClassValue } from "clsx"; 2 | import { twMerge } from "tailwind-merge"; 3 | 4 | export function cn(...inputs: ClassValue[]) { 5 | return twMerge(clsx(inputs)); 6 | } 7 | -------------------------------------------------------------------------------- /site/src/lib/utils.ts: -------------------------------------------------------------------------------- 1 | import { type ClassValue, clsx } from "clsx"; 2 | import { twMerge } from "tailwind-merge"; 3 | 4 | export function cn(...inputs: ClassValue[]) { 5 | return twMerge(clsx(inputs)); 6 | } 7 | -------------------------------------------------------------------------------- /api/nest-cli.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json.schemastore.org/nest-cli", 3 | "collection": "@nestjs/schematics", 4 | "sourceRoot": "src", 5 | "compilerOptions": { 6 | "deleteOutDir": true 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /services/the0-ai/the0/agents/__init__.py: -------------------------------------------------------------------------------- 1 | """ 2 | the0 agents package. 3 | 4 | Multi-Agent System (MAS) for automated trading bot creation. 5 | """ 6 | 7 | from the0.agents import base 8 | 9 | __all__ = ["base"] 10 | -------------------------------------------------------------------------------- /frontend/src/types/index.ts: -------------------------------------------------------------------------------- 1 | export type { Backtest } from "./backtest"; 2 | export type { 3 | Message, 4 | ArtifactFile, 5 | ChatRequest, 6 | ChatResponse, 7 | StreamChunk, 8 | ApiError, 9 | } from "./ai-agent"; 10 | -------------------------------------------------------------------------------- /api/src/bot/entities/bot.entity.ts: -------------------------------------------------------------------------------- 1 | export class Bot { 2 | name: string; 3 | id: string; 4 | config: any; 5 | topic: string; 6 | createdAt: Date; 7 | updatedAt: Date; 8 | userId: string; 9 | customBotId: string; 10 | } 11 | -------------------------------------------------------------------------------- /frontend/__mocks__/uuid.js: -------------------------------------------------------------------------------- 1 | // Mock for uuid 2 | let counter = 0; 3 | 4 | function v4() { 5 | return `mock-uuid-${counter++}`; 6 | } 7 | 8 | module.exports = { v4 }; 9 | module.exports.v4 = v4; 10 | module.exports.default = { v4 }; 11 | -------------------------------------------------------------------------------- /frontend/next.config.mjs: -------------------------------------------------------------------------------- 1 | /** @type {import('next').NextConfig} */ 2 | const nextConfig = { 3 | reactStrictMode: true, 4 | pageExtensions: ["js", "jsx", "ts", "tsx"], 5 | output: "standalone", 6 | }; 7 | 8 | export default nextConfig; 9 | -------------------------------------------------------------------------------- /api/test/jest-e2e.json: -------------------------------------------------------------------------------- 1 | { 2 | "moduleFileExtensions": ["js", "json", "ts"], 3 | "rootDir": ".", 4 | "testEnvironment": "node", 5 | "testRegex": ".e2e-spec.ts$", 6 | "transform": { 7 | "^.+\\.(t|j)s$": "ts-jest" 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /services/the0-ai/entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | 4 | echo "Starting the0-ai service..." 5 | 6 | # Run migrations 7 | alembic upgrade head 8 | 9 | # Start the application 10 | exec python -m uvicorn api.main:app --host 0.0.0.0 --port 8000 -------------------------------------------------------------------------------- /api/src/api-key/models/api-key.model.ts: -------------------------------------------------------------------------------- 1 | export interface ApiKey { 2 | id: string; 3 | userId: string; 4 | name: string; 5 | key: string; 6 | isActive: boolean; 7 | createdAt: Date; 8 | updatedAt: Date; 9 | lastUsedAt?: Date; 10 | } 11 | -------------------------------------------------------------------------------- /frontend/src/components/settings/api-section.tsx: -------------------------------------------------------------------------------- 1 | import { ApiKeySection } from "./api-key-section"; 2 | 3 | export function ApiSection() { 4 | return ( 5 |
6 | 7 |
8 | ); 9 | } 10 | -------------------------------------------------------------------------------- /site/next.config.ts: -------------------------------------------------------------------------------- 1 | import type { NextConfig } from "next"; 2 | 3 | const nextConfig: NextConfig = { 4 | output: 'export', 5 | trailingSlash: true, 6 | images: { 7 | unoptimized: true 8 | } 9 | }; 10 | 11 | export default nextConfig; 12 | -------------------------------------------------------------------------------- /api/src/api-key/dto/api-key-created-response.dto.ts: -------------------------------------------------------------------------------- 1 | import { ApiKeyResponseDto } from "@/api-key/dto/api-key-response.dto"; 2 | 3 | export class ApiKeyCreatedResponseDto extends ApiKeyResponseDto { 4 | key: string; // Full key only returned on creation 5 | } 6 | -------------------------------------------------------------------------------- /api/src/api-key/dto/api-key-response.dto.ts: -------------------------------------------------------------------------------- 1 | export class ApiKeyResponseDto { 2 | id: string; 3 | userId: string; 4 | name: string; 5 | key: string; 6 | isActive: boolean; 7 | createdAt: Date; 8 | updatedAt: Date; 9 | lastUsedAt?: Date; 10 | } 11 | -------------------------------------------------------------------------------- /api/src/bot/dto/create-bot.dto.ts: -------------------------------------------------------------------------------- 1 | import { IsNotEmpty, IsObject, IsString } from "class-validator"; 2 | 3 | export class CreateBotDto { 4 | @IsNotEmpty() 5 | @IsString() 6 | name: string; 7 | 8 | @IsNotEmpty() 9 | @IsObject() 10 | config: any; 11 | } 12 | -------------------------------------------------------------------------------- /api/src/backtest/dto/create-backtest.dto.ts: -------------------------------------------------------------------------------- 1 | import { IsNotEmpty, IsObject, IsString } from "class-validator"; 2 | 3 | export class CreateBacktestDto { 4 | @IsNotEmpty() 5 | @IsString() 6 | name: string; 7 | 8 | @IsNotEmpty() 9 | @IsObject() 10 | config: any; 11 | } 12 | -------------------------------------------------------------------------------- /api/src/backtest/entities/backtest.entity.ts: -------------------------------------------------------------------------------- 1 | export class Backtest { 2 | name: string; 3 | id: string; 4 | config: any; 5 | analysis: any | null; 6 | status: string; 7 | createdAt: Date; 8 | updatedAt: Date; 9 | userId: string; 10 | customBotId: string; 11 | } 12 | -------------------------------------------------------------------------------- /frontend/src/app/providers.tsx: -------------------------------------------------------------------------------- 1 | "use client"; 2 | 3 | import { ThemeProvider } from "next-themes"; 4 | import { ReactNode } from "react"; 5 | 6 | export function Providers({ children }: { children: ReactNode }) { 7 | return {children}; 8 | } 9 | -------------------------------------------------------------------------------- /site/src/lib/constants.ts: -------------------------------------------------------------------------------- 1 | // Documentation and external links 2 | export const DOCS_URLS = { 3 | main: process.env.NEXT_PUBLIC_DOCS_URL || "https://docs.the0.dev", 4 | github: 5 | process.env.NEXT_PUBLIC_GITHUB_URL || 6 | "https://github.com/alexanderwanyoike/the0", 7 | } as const; 8 | -------------------------------------------------------------------------------- /frontend/src/lib/auth/index.ts: -------------------------------------------------------------------------------- 1 | // JWT Auth Service 2 | export { JwtAuthService } from "./jwt-auth.service"; 3 | 4 | // Types 5 | export type { 6 | AuthUser, 7 | LoginCredentials, 8 | RegisterCredentials, 9 | AuthResponse, 10 | ApiResponse, 11 | ApiError, 12 | Result, 13 | } from "./types"; 14 | -------------------------------------------------------------------------------- /api/src/auth/current-user.decorator.ts: -------------------------------------------------------------------------------- 1 | import { createParamDecorator, ExecutionContext } from "@nestjs/common"; 2 | 3 | export const CurrentUser = createParamDecorator( 4 | (data: unknown, ctx: ExecutionContext) => { 5 | const request = ctx.switchToHttp().getRequest(); 6 | return request.user; 7 | }, 8 | ); 9 | -------------------------------------------------------------------------------- /api/src/database/schema/index.ts: -------------------------------------------------------------------------------- 1 | // Re-export all schema tables and types 2 | export * from "./users"; 3 | export * from "./custom-bots"; 4 | // Logs are stored in external storage (MinIO/S3), not in database 5 | 6 | // Re-export connection utilities 7 | export { getDatabase, getDatabaseConfig, schema } from "../connection"; 8 | -------------------------------------------------------------------------------- /api/src/nats/nats.module.ts: -------------------------------------------------------------------------------- 1 | import { Module } from "@nestjs/common"; 2 | import { ConfigModule } from "@nestjs/config"; 3 | import { NatsService } from "./nats.service"; 4 | 5 | @Module({ 6 | imports: [ConfigModule], 7 | providers: [NatsService], 8 | exports: [NatsService], 9 | }) 10 | export class NatsModule {} 11 | -------------------------------------------------------------------------------- /frontend/src/app/settings/profile/page.tsx: -------------------------------------------------------------------------------- 1 | "use client"; 2 | import { ProfileSection } from "@/components/settings/profile-section"; 3 | import { withAuth } from "@/components/auth/with-auth"; 4 | 5 | function ProfileSettingsPage() { 6 | return ; 7 | } 8 | 9 | export default withAuth(ProfileSettingsPage); 10 | -------------------------------------------------------------------------------- /services/the0-ai/.env.example: -------------------------------------------------------------------------------- 1 | GOOGLE_GENAI_USE_VERTEXAI=FALSE 2 | GOOGLE_API_KEY=YEAH_THIS_IS_A_FAKE_KEY 3 | 4 | # Tavily API Configuration (for Researcher Agent web search) 5 | # Get your API key from: https://tavily.com 6 | TAVILY_API_KEY=your_tavily_api_key_here 7 | TAVILY_SEARCH_DEPTH=advanced # Options: basic, advanced 8 | TAVILY_MAX_RESULTS=5 -------------------------------------------------------------------------------- /api/src/app.controller.ts: -------------------------------------------------------------------------------- 1 | import { Controller, Get } from "@nestjs/common"; 2 | import { AppService } from "./app.service"; 3 | 4 | @Controller() 5 | export class AppController { 6 | constructor(private readonly appService: AppService) {} 7 | 8 | @Get() 9 | getHello(): string { 10 | return this.appService.getHello(); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /runtime/internal/util/validators.go: -------------------------------------------------------------------------------- 1 | package util 2 | 3 | // import ( 4 | // "github.com/google/uuid" 5 | // ) 6 | 7 | func ValidateUUID(id string) bool { 8 | // Always return true to allow any bot ID format (not just UUIDs) 9 | return true 10 | // Original UUID validation: 11 | // _, err := uuid.Parse(id) 12 | // return err == nil 13 | } 14 | -------------------------------------------------------------------------------- /runtime/internal/util/paritioning.go: -------------------------------------------------------------------------------- 1 | package util 2 | 3 | import ( 4 | "hash/crc32" 5 | ) 6 | 7 | func GetSegmentId(id string, maxSegments int) int32 { 8 | // Generate a segment ID based on the bot ID using a hash function 9 | hash := crc32.ChecksumIEEE([]byte(id)) 10 | segmentID := int32(hash % uint32(maxSegments)) 11 | 12 | return segmentID 13 | } 14 | -------------------------------------------------------------------------------- /docs/src/components/ui/skeleton.tsx: -------------------------------------------------------------------------------- 1 | import { cn } from "@/lib/utils"; 2 | 3 | function Skeleton({ 4 | className, 5 | ...props 6 | }: React.HTMLAttributes) { 7 | return ( 8 |
12 | ); 13 | } 14 | 15 | export { Skeleton }; 16 | -------------------------------------------------------------------------------- /docs/next.config.mjs: -------------------------------------------------------------------------------- 1 | /** @type {import('next').NextConfig} */ 2 | import withMarkdoc from "@markdoc/next.js"; 3 | 4 | const nextConfig = withMarkdoc()({ 5 | reactStrictMode: true, 6 | pageExtensions: ["md", "mdoc", "js", "jsx", "ts", "tsx"], 7 | trailingSlash: true, 8 | images: { 9 | unoptimized: true, 10 | }, 11 | }); 12 | 13 | export default nextConfig; 14 | -------------------------------------------------------------------------------- /docs/src/components/theme-provider.tsx: -------------------------------------------------------------------------------- 1 | "use client"; 2 | 3 | import * as React from "react"; 4 | import { 5 | ThemeProvider as NextThemesProvider, 6 | ThemeProviderProps, 7 | } from "next-themes"; 8 | 9 | export function ThemeProvider({ children, ...props }: ThemeProviderProps) { 10 | return {children}; 11 | } 12 | -------------------------------------------------------------------------------- /frontend/src/components/ui/skeleton.tsx: -------------------------------------------------------------------------------- 1 | import { cn } from "@/lib/utils"; 2 | 3 | function Skeleton({ 4 | className, 5 | ...props 6 | }: React.HTMLAttributes) { 7 | return ( 8 |
12 | ); 13 | } 14 | 15 | export { Skeleton }; 16 | -------------------------------------------------------------------------------- /site/src/components/theme-provider.tsx: -------------------------------------------------------------------------------- 1 | "use client"; 2 | 3 | import * as React from "react"; 4 | import { 5 | ThemeProvider as NextThemesProvider, 6 | ThemeProviderProps, 7 | } from "next-themes"; 8 | 9 | export function ThemeProvider({ children, ...props }: ThemeProviderProps) { 10 | return {children}; 11 | } 12 | -------------------------------------------------------------------------------- /frontend/src/components/theme-provider.tsx: -------------------------------------------------------------------------------- 1 | "use client"; 2 | 3 | import * as React from "react"; 4 | import { 5 | ThemeProvider as NextThemesProvider, 6 | ThemeProviderProps, 7 | } from "next-themes"; 8 | 9 | export function ThemeProvider({ children, ...props }: ThemeProviderProps) { 10 | return {children}; 11 | } 12 | -------------------------------------------------------------------------------- /frontend/src/app/settings/api-settings/page.tsx: -------------------------------------------------------------------------------- 1 | "use client"; 2 | import { ProfileSection } from "@/components/settings/profile-section"; 3 | import { withAuth } from "@/components/auth/with-auth"; 4 | import { ApiSection } from "@/components/settings/api-section"; 5 | 6 | function ApiSettings() { 7 | return ; 8 | } 9 | 10 | export default withAuth(ApiSettings); 11 | -------------------------------------------------------------------------------- /api/.dockerignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | npm-debug.log 3 | .npm 4 | .git 5 | .gitignore 6 | README.md 7 | .env 8 | .env.local 9 | .env.production.local 10 | .env.test.local 11 | .DS_Store 12 | Thumbs.db 13 | coverage 14 | .nyc_output 15 | *.log 16 | dist 17 | build 18 | .vscode 19 | .idea 20 | *.swp 21 | *.swo 22 | test 23 | *.test.ts 24 | *.spec.ts 25 | __tests__ 26 | jest.config.js 27 | .github -------------------------------------------------------------------------------- /api/src/bot/bot.repository.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from "@nestjs/common"; 2 | import { Bot } from "./entities/bot.entity"; 3 | import { RoleRepository } from "@/common/role.repository"; 4 | 5 | @Injectable() 6 | export class BotRepository extends RoleRepository { 7 | protected readonly tableName = "bots" as const; 8 | 9 | constructor() { 10 | super(); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /services/the0-ai/pytest.ini: -------------------------------------------------------------------------------- 1 | [tool:pytest] 2 | minversion = 6.0 3 | testpaths = tests 4 | python_files = test_*.py 5 | python_classes = Test* 6 | python_functions = test_* 7 | addopts = 8 | -v 9 | --tb=short 10 | --strict-markers 11 | --disable-warnings 12 | --asyncio-mode=auto 13 | markers = 14 | asyncio: mark test as async 15 | slow: mark test as slow running -------------------------------------------------------------------------------- /site/public/window.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /site/public/file.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /api/src/common/result.ts: -------------------------------------------------------------------------------- 1 | export type Result = { 2 | data: T | null; 3 | error: E | null; 4 | success: boolean; 5 | }; 6 | 7 | const Failure = (error: E): Result => ({ 8 | data: null, 9 | error, 10 | success: false, 11 | }); 12 | 13 | const Ok = (data: T): Result => ({ 14 | data, 15 | error: null, 16 | success: true, 17 | }); 18 | 19 | export { Failure, Ok }; 20 | -------------------------------------------------------------------------------- /docs/src/components/ui/collapsible.tsx: -------------------------------------------------------------------------------- 1 | "use client"; 2 | 3 | import * as CollapsiblePrimitive from "@radix-ui/react-collapsible"; 4 | 5 | const Collapsible = CollapsiblePrimitive.Root; 6 | 7 | const CollapsibleTrigger = CollapsiblePrimitive.CollapsibleTrigger; 8 | 9 | const CollapsibleContent = CollapsiblePrimitive.CollapsibleContent; 10 | 11 | export { Collapsible, CollapsibleTrigger, CollapsibleContent }; 12 | -------------------------------------------------------------------------------- /frontend/src/components/ui/collapsible.tsx: -------------------------------------------------------------------------------- 1 | "use client"; 2 | 3 | import * as CollapsiblePrimitive from "@radix-ui/react-collapsible"; 4 | 5 | const Collapsible = CollapsiblePrimitive.Root; 6 | 7 | const CollapsibleTrigger = CollapsiblePrimitive.CollapsibleTrigger; 8 | 9 | const CollapsibleContent = CollapsiblePrimitive.CollapsibleContent; 10 | 11 | export { Collapsible, CollapsibleTrigger, CollapsibleContent }; 12 | -------------------------------------------------------------------------------- /runtime/internal/metrics/segment_metrics.go: -------------------------------------------------------------------------------- 1 | package metrics 2 | 3 | // SegmentMetrics represents the metrics exposed for HPA 4 | type SegmentMetrics struct { 5 | TotalSegments int `json:"total_segments"` 6 | AssignedSegments int `json:"assigned_segments"` 7 | OrphanedSegments int `json:"orphaned_segments"` 8 | AvailableWorkers int `json:"available_workers"` 9 | SegmentBacklog int `json:"segment_backlog"` 10 | } 11 | -------------------------------------------------------------------------------- /frontend/src/lib/utils.ts: -------------------------------------------------------------------------------- 1 | import { clsx, type ClassValue } from "clsx"; 2 | import { twMerge } from "tailwind-merge"; 3 | import { CustomBotConfig } from "@/types/custom-bots"; 4 | 5 | export function cn(...inputs: ClassValue[]) { 6 | return twMerge(clsx(inputs)); 7 | } 8 | 9 | export function canBotBeBacktested(config: CustomBotConfig): boolean { 10 | return !!(config.entrypoints?.backtest && config.schema?.backtest); 11 | } 12 | -------------------------------------------------------------------------------- /runtime/internal/model/executable.go: -------------------------------------------------------------------------------- 1 | package model 2 | 3 | type Executable struct { 4 | ID string 5 | Runtime string 6 | Entrypoint string // Either `bot` or `backtest` 7 | EntrypointFiles map[string]string 8 | Config map[string]interface{} 9 | FilePath string 10 | IsLongRunning bool 11 | PersistResults bool 12 | Segment int32 // Worker segment for container labeling 13 | } 14 | -------------------------------------------------------------------------------- /site/components.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://ui.shadcn.com/schema.json", 3 | "style": "default", 4 | "rsc": true, 5 | "tsx": true, 6 | "tailwind": { 7 | "config": "tailwind.config.ts", 8 | "css": "src/app/globals.css", 9 | "baseColor": "slate", 10 | "cssVariables": true, 11 | "prefix": "" 12 | }, 13 | "aliases": { 14 | "components": "@/components", 15 | "utils": "@/lib/utils" 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /api/src/api-key/api-key.module.ts: -------------------------------------------------------------------------------- 1 | import { Module } from "@nestjs/common"; 2 | import { ApiKeyController } from "./api-key.controller"; 3 | import { ApiKeyService } from "./api-key.service"; 4 | import { ApiKeyRepository } from "./api-key.repository"; 5 | 6 | @Module({ 7 | controllers: [ApiKeyController], 8 | providers: [ApiKeyService, ApiKeyRepository], 9 | exports: [ApiKeyService, ApiKeyRepository], 10 | }) 11 | export class ApiKeyModule {} 12 | -------------------------------------------------------------------------------- /frontend/src/lib/result.ts: -------------------------------------------------------------------------------- 1 | export type Result = Success | Failure; 2 | 3 | export interface Success { 4 | data: T; 5 | success: true; 6 | } 7 | 8 | export interface Failure { 9 | error: E; 10 | success: false; 11 | } 12 | 13 | export const Ok = (data: T): Result => ({ 14 | data, 15 | success: true, 16 | }); 17 | 18 | export const Failure = (error: E): Result => ({ 19 | error, 20 | success: false, 21 | }); 22 | -------------------------------------------------------------------------------- /k8s/Chart.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v2 2 | name: the0 3 | description: A distributed trading bot platform with backtesting, bot scheduling, and security analysis 4 | type: application 5 | version: 0.1.0 6 | appVersion: "1.0.0" 7 | keywords: 8 | - trading 9 | - bots 10 | - backtesting 11 | - automation 12 | - fintech 13 | home: https://github.com/your-org/the0-oss 14 | sources: 15 | - https://github.com/your-org/the0-oss 16 | maintainers: 17 | - name: the0 Team 18 | email: team@the0.com -------------------------------------------------------------------------------- /api/src/api-key/dto/create-api-key.dto.ts: -------------------------------------------------------------------------------- 1 | import { IsString, IsNotEmpty, MaxLength, MinLength } from "class-validator"; 2 | 3 | export class CreateApiKeyDto { 4 | @IsString({ message: "name must be a string" }) 5 | @IsNotEmpty({ message: "name should not be empty" }) 6 | @MinLength(3, { 7 | message: "name must be longer than or equal to 3 characters", 8 | }) 9 | @MaxLength(50, { 10 | message: "name must be shorter than or equal to 50 characters", 11 | }) 12 | name: string; 13 | } 14 | -------------------------------------------------------------------------------- /api/src/common/repository.ts: -------------------------------------------------------------------------------- 1 | import { Result } from "./result"; 2 | 3 | export default interface Repository { 4 | create: (args: any) => Promise>; 5 | findAll: (userId: string) => Promise>; 6 | findOne: (userId: string, id: string) => Promise>; 7 | update: ( 8 | userId: string, 9 | id: string, 10 | args: any, 11 | ) => Promise>; 12 | remove: (userId: string, id: string) => Promise>; 13 | } 14 | -------------------------------------------------------------------------------- /api/src/logs/logs.module.ts: -------------------------------------------------------------------------------- 1 | import { Module } from "@nestjs/common"; 2 | import { LogsService } from "./logs.service"; 3 | import { LogsController } from "./logs.controller"; 4 | import { ConfigModule } from "@nestjs/config"; 5 | import { BotModule } from "@/bot/bot.module"; 6 | import { ApiKeyModule } from "@/api-key/api-key.module"; 7 | 8 | @Module({ 9 | imports: [ConfigModule, BotModule, ApiKeyModule], 10 | controllers: [LogsController], 11 | providers: [LogsService], 12 | }) 13 | export class LogsModule {} 14 | -------------------------------------------------------------------------------- /frontend/src/components/settings/profile-section.tsx: -------------------------------------------------------------------------------- 1 | import { ProfileForm } from "./profile-form"; 2 | import { PasswordForm } from "./password-form"; 3 | import { DeleteAccount } from "./delete-account"; 4 | import { Separator } from "@/components/ui/separator"; 5 | 6 | export function ProfileSection() { 7 | return ( 8 |
9 | 10 | 11 | 12 | 13 | 14 |
15 | ); 16 | } 17 | -------------------------------------------------------------------------------- /frontend/src/app/custom-bots/page.tsx: -------------------------------------------------------------------------------- 1 | "use client"; 2 | import React from "react"; 3 | import { withAuth } from "@/components/auth/with-auth"; 4 | import DashboardLayout from "@/components/layouts/dashboard-layout"; 5 | import CustomBotsDashboard from "@/components/custom-bots/custom-bots-dashboard"; 6 | 7 | const CustomBotsPage: React.FC = () => { 8 | return ( 9 | 10 | 11 | 12 | ); 13 | }; 14 | 15 | export default withAuth(CustomBotsPage); 16 | -------------------------------------------------------------------------------- /frontend/src/stores/ai-agent/themeStore.ts: -------------------------------------------------------------------------------- 1 | import { create } from "zustand"; 2 | import { persist } from "zustand/middleware"; 3 | 4 | interface ThemeStore { 5 | isDark: boolean; 6 | toggleTheme: () => void; 7 | } 8 | 9 | export const useThemeStore = create()( 10 | persist( 11 | (set) => ({ 12 | isDark: true, // Default to dark mode 13 | toggleTheme: () => set((state) => ({ isDark: !state.isDark })), 14 | }), 15 | { 16 | name: "theme-storage", 17 | }, 18 | ), 19 | ); 20 | -------------------------------------------------------------------------------- /runtime/pb/worker.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package botscheduler.worker.v1; 4 | option go_package = "./pb"; 5 | 6 | message Request { 7 | string data = 1; 8 | } 9 | 10 | 11 | message Response { 12 | string data = 1; 13 | } 14 | 15 | 16 | service Worker { 17 | // Client to server -> Client heartbeat to check connection 18 | rpc Heartbeat(Request) returns (Response) {}; 19 | 20 | // Server to client -> Server push to notify client 21 | rpc RebalanceSubscription(Request) returns (stream Response) {}; 22 | } -------------------------------------------------------------------------------- /frontend/src/lib/bot-type.ts: -------------------------------------------------------------------------------- 1 | export const sanitizeBotType = (botType: string): string => 2 | botType.replace(/\//g, "_"); 3 | 4 | export const splitBotType = ( 5 | botType: string, 6 | ): { 7 | vendor: string; 8 | type: string; 9 | name: string; 10 | } => { 11 | const [vendor, type, name] = botType.split("/"); 12 | if (!vendor || !type || !name) { 13 | throw new Error( 14 | "Invalid bot type format. Expected format: vendor/type/name", 15 | ); 16 | } 17 | return { vendor, type, name }; 18 | }; 19 | -------------------------------------------------------------------------------- /cli/stories/story.example.md: -------------------------------------------------------------------------------- 1 | ## FEATURE: 2 | 3 | [Insert your feature here] 4 | 5 | ## EXAMPLES: 6 | 7 | [Provide and explain examples that you have in the `examples/` folder] 8 | 9 | ## DOCUMENTATION: 10 | 11 | [List out any documentation (web pages, sources for an MCP server like Crawl4AI RAG, etc.) that will need to be referenced during development] 12 | 13 | ## OTHER CONSIDERATIONS: 14 | 15 | [Any other considerations or specific requirements - great place to include gotchas that you see AI coding assistants miss with your projects a lot] -------------------------------------------------------------------------------- /docs/components.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://ui.shadcn.com/schema.json", 3 | "style": "new-york", 4 | "rsc": true, 5 | "tsx": true, 6 | "tailwind": { 7 | "config": "tailwind.config.ts", 8 | "css": "src/app/globals.css", 9 | "baseColor": "neutral", 10 | "cssVariables": true, 11 | "prefix": "" 12 | }, 13 | "aliases": { 14 | "components": "@/components", 15 | "utils": "@/lib/utils", 16 | "ui": "@/components/ui", 17 | "lib": "@/lib", 18 | "hooks": "@/hooks" 19 | }, 20 | "iconLibrary": "lucide" 21 | } 22 | -------------------------------------------------------------------------------- /frontend/components.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://ui.shadcn.com/schema.json", 3 | "style": "new-york", 4 | "rsc": true, 5 | "tsx": true, 6 | "tailwind": { 7 | "config": "tailwind.config.ts", 8 | "css": "src/app/globals.css", 9 | "baseColor": "neutral", 10 | "cssVariables": true, 11 | "prefix": "" 12 | }, 13 | "aliases": { 14 | "components": "@/components", 15 | "utils": "@/lib/utils", 16 | "ui": "@/components/ui", 17 | "lib": "@/lib", 18 | "hooks": "@/hooks" 19 | }, 20 | "iconLibrary": "lucide" 21 | } 22 | -------------------------------------------------------------------------------- /api/src/auth/auth-combined.decorator.ts: -------------------------------------------------------------------------------- 1 | import { SetMetadata } from "@nestjs/common"; 2 | 3 | export const COMBINED_AUTH_KEY = "combinedAuth"; 4 | export const CombinedAuth = () => SetMetadata(COMBINED_AUTH_KEY, true); 5 | 6 | // src/auth/decorators/auth-type.decorator.ts 7 | import { createParamDecorator, ExecutionContext } from "@nestjs/common"; 8 | 9 | export const AuthType = createParamDecorator( 10 | (data: unknown, ctx: ExecutionContext) => { 11 | const request = ctx.switchToHttp().getRequest(); 12 | return request.user?.authType || "unknown"; 13 | }, 14 | ); 15 | -------------------------------------------------------------------------------- /api/src/bot/bot.constants.ts: -------------------------------------------------------------------------------- 1 | export const BOT_TYPE_PATTERN = 2 | /^[a-z0-9]+(-[a-z0-9]+)*\/[a-z0-9]+(-[a-z0-9]+)*$/; 3 | 4 | // NATS topics for bot events (match runtime expectations) 5 | export const BOT_TOPICS = { 6 | CREATED: "the0.bot.created", 7 | UPDATED: "the0.bot.updated", 8 | DELETED: "the0.bot.deleted", 9 | } as const; 10 | 11 | // NATS topics for scheduled bot events 12 | export const SCHEDULED_BOT_TOPICS = { 13 | CREATED: "the0.bot-schedule.created", 14 | UPDATED: "the0.bot-schedule.updated", 15 | DELETED: "the0.bot-schedule.deleted", 16 | } as const; 17 | -------------------------------------------------------------------------------- /runtime/internal/constants/database.go: -------------------------------------------------------------------------------- 1 | package constants 2 | 3 | // Database configurations for each service 4 | const ( 5 | // Separate database names to avoid conflicts 6 | BOT_RUNNER_DB_NAME = "bot_runner" 7 | BOT_RUNNER_COLLECTION = "bots" 8 | BACKTEST_RUNNER_DB_NAME = "backtest_runner" 9 | BACKTEST_COLLECTION = "backtests" 10 | BOT_SCHEDULER_DB_NAME = "bot_scheduler" 11 | BOT_SCHEDULE_COLLECTION = "bot_schedules" 12 | 13 | // Default service ports 14 | BOT_RUNNER_PORT = 50051 15 | BACKTEST_RUNNER_PORT = 50052 16 | BOT_SCHEDULER_PORT = 50053 17 | ) 18 | -------------------------------------------------------------------------------- /services/0vers33r/src/interfaces/__init__.py: -------------------------------------------------------------------------------- 1 | from typing import Protocol, Dict, Any 2 | 3 | 4 | class StorageInterface(Protocol): 5 | """Interface for storage operations""" 6 | 7 | def download_file(self, gcs_path: str) -> bytes: 8 | """Download file from storage and return bytes""" 9 | ... 10 | 11 | 12 | class DatabaseInterface(Protocol): 13 | """Interface for database operations""" 14 | 15 | def update_bot_status( 16 | self, bot_id: str, status: str, review_data: Dict[str, Any] 17 | ) -> None: 18 | """Update bot status in database""" 19 | ... 20 | -------------------------------------------------------------------------------- /api/src/logs/dto/get-logs-query.dto.ts: -------------------------------------------------------------------------------- 1 | import { IsOptional, IsString, IsInt, Min, Max } from "class-validator"; 2 | import { Transform } from "class-transformer"; 3 | 4 | export class GetLogsQueryDto { 5 | @IsOptional() 6 | @IsString() 7 | date?: string; 8 | 9 | @IsOptional() 10 | @IsString() 11 | dateRange?: string; 12 | 13 | @IsOptional() 14 | @Transform(({ value }) => parseInt(value)) 15 | @IsInt() 16 | @Min(1) 17 | @Max(1000) 18 | limit?: number; 19 | 20 | @IsOptional() 21 | @Transform(({ value }) => parseInt(value)) 22 | @IsInt() 23 | @Min(0) 24 | offset?: number; 25 | } 26 | -------------------------------------------------------------------------------- /runtime/start-application.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -xe -o pipefail 3 | 4 | # Check if docker socket is already available (Docker-in-Docker case) 5 | if [ -S /var/run/docker.sock ]; then 6 | echo "Docker socket already available, skipping dockerd startup" 7 | else 8 | echo "Starting dockerd..." 9 | # Start dockerd in background 10 | /usr/bin/dockerd --iptables=false --ip6tables=false --bridge=none -D & 11 | # Wait for Docker daemon to be ready 12 | sleep 5 13 | fi 14 | 15 | # Verify Docker is working 16 | docker info || exit 1 17 | 18 | # Start the application as worker 19 | exec ./runtime -worker -------------------------------------------------------------------------------- /site/eslint.config.mjs: -------------------------------------------------------------------------------- 1 | import { dirname } from "path"; 2 | import { fileURLToPath } from "url"; 3 | import { FlatCompat } from "@eslint/eslintrc"; 4 | 5 | const __filename = fileURLToPath(import.meta.url); 6 | const __dirname = dirname(__filename); 7 | 8 | const compat = new FlatCompat({ 9 | baseDirectory: __dirname, 10 | }); 11 | 12 | const eslintConfig = [ 13 | ...compat.extends("next/core-web-vitals", "next/typescript", "prettier"), 14 | ...compat.plugins("prettier"), 15 | { 16 | rules: { 17 | "prettier/prettier": "error", 18 | }, 19 | }, 20 | ]; 21 | 22 | export default eslintConfig; 23 | -------------------------------------------------------------------------------- /runtime/.dockerignore: -------------------------------------------------------------------------------- 1 | # Binaries 2 | *.exe 3 | *.exe~ 4 | *.dll 5 | *.so 6 | *.dylib 7 | *.test 8 | *.out 9 | 10 | # Vendor directory (if you use vendoring) 11 | vendor/ 12 | 13 | # Logs 14 | logs 15 | *.log 16 | 17 | # Build output 18 | dist/ 19 | build/ 20 | bin/ 21 | out/ 22 | 23 | # Environment files 24 | .env 25 | .env.* 26 | 27 | # OS generated files 28 | .DS_Store 29 | Thumbs.db 30 | 31 | # IDE/editor folders 32 | .idea/ 33 | .vscode/ 34 | *.swp 35 | 36 | # Docker files (optional) 37 | Dockerfile* 38 | docker-compose* 39 | 40 | # Node modules (if not used, can be removed) 41 | node_modules/ 42 | bower_components/ -------------------------------------------------------------------------------- /docs/src/app/docs/layout.tsx: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import { DocsLayout } from "@/components/docs/docs-layout"; 3 | import { Metadata } from "next"; 4 | 5 | export const metadata: Metadata = { 6 | title: "Documentation | Theo", 7 | description: "Comprehensive documentation for the Theo trading bot platform", 8 | keywords: ["trading bots", "documentation", "API", "guide", "theo"], 9 | }; 10 | 11 | interface DocsLayoutPageProps { 12 | children: React.ReactNode; 13 | } 14 | 15 | export default function DocsLayoutPage({ children }: DocsLayoutPageProps) { 16 | return {children}; 17 | } 18 | -------------------------------------------------------------------------------- /docs/public/vercel.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/public/vercel.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /api/src/database/migrations/meta/_journal.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "5", 3 | "dialect": "pg", 4 | "entries": [ 5 | { 6 | "idx": 0, 7 | "version": "5", 8 | "when": 1753488645005, 9 | "tag": "0000_tan_maginty", 10 | "breakpoints": true 11 | }, 12 | { 13 | "idx": 1, 14 | "version": "5", 15 | "when": 1753497594306, 16 | "tag": "0001_breezy_sentinels", 17 | "breakpoints": true 18 | }, 19 | { 20 | "idx": 2, 21 | "version": "5", 22 | "when": 1760273667702, 23 | "tag": "0002_petite_doctor_faustus", 24 | "breakpoints": true 25 | } 26 | ] 27 | } -------------------------------------------------------------------------------- /site/.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | /node_modules 5 | /.pnp 6 | .pnp.* 7 | .yarn/* 8 | !.yarn/patches 9 | !.yarn/plugins 10 | !.yarn/releases 11 | !.yarn/versions 12 | 13 | # testing 14 | /coverage 15 | 16 | # next.js 17 | /.next/ 18 | /out/ 19 | 20 | # production 21 | /build 22 | 23 | # misc 24 | .DS_Store 25 | *.pem 26 | 27 | # debug 28 | npm-debug.log* 29 | yarn-debug.log* 30 | yarn-error.log* 31 | .pnpm-debug.log* 32 | 33 | # env files (can opt-in for committing if needed) 34 | .env* 35 | 36 | # vercel 37 | .vercel 38 | 39 | # typescript 40 | *.tsbuildinfo 41 | next-env.d.ts 42 | -------------------------------------------------------------------------------- /docs/src/docs/terminology/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Terminology" 3 | description: "Key terms and concepts in algorithmic trading" 4 | order: 2 5 | --- 6 | 7 | # Terminology 8 | 9 | Understanding the key terms and concepts used in algorithmic trading and the the0 platform. 10 | 11 | ## Core Concepts 12 | 13 | - **[Bots](./bots)** - The core trading instances that execute strategies in the0 14 | - **[Custom Bots](./custom-bots)** - User-created trading algorithms 15 | - **[Bot Deployment](./bot-deploment)** - Creating and managing bot instances 16 | - **[Live Trading](./live-trading)** - Real money trading execution 17 | - **[Market Data](./market-data)** - Real-time and historical trading information 18 | -------------------------------------------------------------------------------- /frontend/src/app/page.tsx: -------------------------------------------------------------------------------- 1 | import { NavigationMenu } from "@/components/landing-page/navigation-menu"; 2 | import { HeroSection } from "@/components/landing-page/hero"; 3 | import { FeaturesSection } from "@/components/landing-page/features"; 4 | import { HowItWorksSection } from "@/components/landing-page/how-it-works"; 5 | import { Footer } from "@/components/landing-page/footer"; 6 | 7 | export default function LandingPage() { 8 | return ( 9 |
10 | 11 |
12 | 13 | 14 | 15 |
16 |
17 |
18 | ); 19 | } 20 | -------------------------------------------------------------------------------- /frontend/src/components/ai-agent/chat/TypingIndicator.tsx: -------------------------------------------------------------------------------- 1 | export function TypingIndicator() { 2 | return ( 3 |
4 |
5 |
6 |
10 |
14 |
15 | the0 is thinking... 16 |
17 | ); 18 | } 19 | -------------------------------------------------------------------------------- /frontend/__mocks__/react-syntax-highlighter.js: -------------------------------------------------------------------------------- 1 | // Mock for react-syntax-highlighter 2 | const { createElement } = require("react"); 3 | 4 | const SyntaxHighlighter = function ({ children, language, ...props }) { 5 | return createElement( 6 | "pre", 7 | { 8 | "data-language": language, 9 | ...props, 10 | }, 11 | createElement("code", null, children), 12 | ); 13 | }; 14 | 15 | // Export all named exports that might be used 16 | module.exports = SyntaxHighlighter; 17 | module.exports.default = SyntaxHighlighter; 18 | module.exports.Prism = SyntaxHighlighter; 19 | module.exports.Light = SyntaxHighlighter; 20 | 21 | // Mock styles 22 | module.exports.vscDarkPlus = {}; 23 | module.exports.vs = {}; 24 | -------------------------------------------------------------------------------- /api/src/app.controller.spec.ts: -------------------------------------------------------------------------------- 1 | import { Test, TestingModule } from "@nestjs/testing"; 2 | import { AppController } from "./app.controller"; 3 | import { AppService } from "./app.service"; 4 | 5 | describe("AppController", () => { 6 | let appController: AppController; 7 | 8 | beforeEach(async () => { 9 | const app: TestingModule = await Test.createTestingModule({ 10 | controllers: [AppController], 11 | providers: [AppService], 12 | }).compile(); 13 | 14 | appController = app.get(AppController); 15 | }); 16 | 17 | describe("root", () => { 18 | it('should return "Hello World!"', () => { 19 | expect(appController.getHello()).toBe("Hello World!"); 20 | }); 21 | }); 22 | }); 23 | -------------------------------------------------------------------------------- /docs/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "lib": ["dom", "dom.iterable", "esnext"], 4 | "allowJs": true, 5 | "skipLibCheck": true, 6 | "strict": true, 7 | "noEmit": true, 8 | "esModuleInterop": true, 9 | "module": "esnext", 10 | "moduleResolution": "bundler", 11 | "resolveJsonModule": true, 12 | "isolatedModules": true, 13 | "jsx": "preserve", 14 | "incremental": true, 15 | "plugins": [ 16 | { 17 | "name": "next" 18 | } 19 | ], 20 | "paths": { 21 | "@/*": ["./src/*"] 22 | }, 23 | "target": "ES2017" 24 | }, 25 | "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"], 26 | "exclude": ["node_modules"] 27 | } 28 | -------------------------------------------------------------------------------- /site/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "ES2017", 4 | "lib": ["dom", "dom.iterable", "esnext"], 5 | "allowJs": true, 6 | "skipLibCheck": true, 7 | "strict": true, 8 | "noEmit": true, 9 | "esModuleInterop": true, 10 | "module": "esnext", 11 | "moduleResolution": "bundler", 12 | "resolveJsonModule": true, 13 | "isolatedModules": true, 14 | "jsx": "preserve", 15 | "incremental": true, 16 | "plugins": [ 17 | { 18 | "name": "next" 19 | } 20 | ], 21 | "paths": { 22 | "@/*": ["./src/*"] 23 | } 24 | }, 25 | "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"], 26 | "exclude": ["node_modules"] 27 | } 28 | -------------------------------------------------------------------------------- /frontend/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "lib": ["dom", "dom.iterable", "esnext"], 4 | "allowJs": true, 5 | "skipLibCheck": true, 6 | "strict": true, 7 | "noEmit": true, 8 | "esModuleInterop": true, 9 | "module": "esnext", 10 | "moduleResolution": "bundler", 11 | "resolveJsonModule": true, 12 | "isolatedModules": true, 13 | "jsx": "preserve", 14 | "incremental": true, 15 | "plugins": [ 16 | { 17 | "name": "next" 18 | } 19 | ], 20 | "paths": { 21 | "@/*": ["./src/*"] 22 | }, 23 | "target": "ES2017" 24 | }, 25 | "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"], 26 | "exclude": ["node_modules"] 27 | } 28 | -------------------------------------------------------------------------------- /api/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "commonjs", 4 | "declaration": true, 5 | "removeComments": true, 6 | "emitDecoratorMetadata": true, 7 | "experimentalDecorators": true, 8 | "allowSyntheticDefaultImports": true, 9 | "esModuleInterop": true, 10 | "target": "es2017", 11 | "sourceMap": true, 12 | "outDir": "./dist", 13 | "baseUrl": "./", 14 | "incremental": true, 15 | "skipLibCheck": true, 16 | "strictNullChecks": false, 17 | "noImplicitAny": false, 18 | "strictBindCallApply": false, 19 | "forceConsistentCasingInFileNames": false, 20 | "noFallthroughCasesInSwitch": false, 21 | "paths": { 22 | "@/*": ["./src/*"], 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /api/test/app.e2e-spec.ts: -------------------------------------------------------------------------------- 1 | import { Test, TestingModule } from "@nestjs/testing"; 2 | import { INestApplication } from "@nestjs/common"; 3 | import * as request from "supertest"; 4 | import { AppModule } from "../src/app.module"; 5 | 6 | describe("AppController (e2e)", () => { 7 | let app: INestApplication; 8 | 9 | beforeEach(async () => { 10 | const moduleFixture: TestingModule = await Test.createTestingModule({ 11 | imports: [AppModule], 12 | }).compile(); 13 | 14 | app = moduleFixture.createNestApplication(); 15 | await app.init(); 16 | }); 17 | 18 | it("/ (GET)", () => { 19 | return request(app.getHttpServer()) 20 | .get("/") 21 | .expect(200) 22 | .expect("Hello World!"); 23 | }); 24 | }); 25 | -------------------------------------------------------------------------------- /docs/src/app/api/docs/navigation/route.ts: -------------------------------------------------------------------------------- 1 | import { NextRequest, NextResponse } from "next/server"; 2 | import { DocsFileSystem } from "@/lib/docs/file-system"; 3 | 4 | export async function GET(request: NextRequest) { 5 | try { 6 | const fileSystem = new DocsFileSystem(); 7 | const navigation = await fileSystem.getNavigationTree(); 8 | 9 | return NextResponse.json({ 10 | success: true, 11 | data: navigation, 12 | }); 13 | } catch (error: any) { 14 | console.error("Error fetching docs navigation:", error); 15 | return NextResponse.json( 16 | { 17 | success: false, 18 | error: "Failed to load documentation navigation", 19 | }, 20 | { status: 500 }, 21 | ); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /docs/src/docs/the0-CLI/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "the0 CLI" 3 | description: "Command-line interface for the0 platform" 4 | order: 3 5 | --- 6 | 7 | # the0 CLI 8 | 9 | The command-line interface for interacting with the the0 platform. Create, deploy, and manage your trading bots from the terminal. 10 | 11 | ## Getting Started 12 | 13 | - **[Installation](./installation)** - Install and set up the CLI 14 | - **[Authentication](./authentication)** - Connect to your the0 account 15 | 16 | ## Bot Management 17 | 18 | - **[Bot Commands](./bot-commands)** - Create and manage bots 19 | - **[Custom Bot Commands](./bot-commands)** - Create and manage custom bots 20 | 21 | ## CLI Reference 22 | 23 | Complete command reference and examples for all CLI operations. 24 | -------------------------------------------------------------------------------- /runtime/internal/util/cron.go: -------------------------------------------------------------------------------- 1 | package util 2 | 3 | import ( 4 | "fmt" 5 | "github.com/robfig/cron/v3" 6 | "time" 7 | ) 8 | 9 | func CalculateNextExecutionTime( 10 | cronExpr string, 11 | t time.Time, 12 | ) (time.Time, error) { 13 | // Try to parse with seconds first (6-field format) 14 | parser := cron.NewParser(cron.Second | cron.Minute | cron.Hour | cron.Dom | cron.Month | cron.Dow | cron.Descriptor) 15 | schedule, err := parser.Parse(cronExpr) 16 | if err != nil { 17 | // If that fails, try standard 5-field format (without seconds) 18 | schedule, err = cron.ParseStandard(cronExpr) 19 | if err != nil { 20 | return time.Time{}, fmt.Errorf("failed to parse cron expression: %v", err) 21 | } 22 | } 23 | 24 | return schedule.Next(t), nil 25 | } 26 | -------------------------------------------------------------------------------- /docs/src/components/ui/textarea.tsx: -------------------------------------------------------------------------------- 1 | import * as React from "react"; 2 | 3 | import { cn } from "@/lib/utils"; 4 | 5 | const Textarea = React.forwardRef< 6 | HTMLTextAreaElement, 7 | React.ComponentProps<"textarea"> 8 | >(({ className, ...props }, ref) => { 9 | return ( 10 |