├── apps ├── server │ ├── src │ │ ├── db │ │ │ ├── index.ts │ │ │ ├── conn.ts │ │ │ └── schema.ts │ │ ├── endpoints │ │ │ ├── openai │ │ │ │ └── index.ts │ │ │ ├── index.ts │ │ │ └── health.ts │ │ ├── types │ │ │ ├── user.ts │ │ │ ├── openai │ │ │ │ └── index.ts │ │ │ └── routeHandler.ts │ │ ├── utils │ │ │ ├── uuid.ts │ │ │ ├── url.ts │ │ │ └── strings.ts │ │ ├── middleware │ │ │ └── logging.ts │ │ ├── lib │ │ │ ├── route.ts │ │ │ └── env.ts │ │ └── composeServices.ts │ ├── biome.json │ ├── .dockerignore │ ├── drizzle │ │ ├── 0000_nostalgic_shinobi_shaw.sql │ │ └── meta │ │ │ ├── _journal.json │ │ │ └── 0000_snapshot.json │ ├── README.md │ ├── drizzle.config.ts │ ├── .env.example │ ├── e2e │ │ └── __fixtures__ │ │ │ ├── ea9945bfd32bfac420d5b8795def2487.json │ │ │ ├── 6400f52a21e3388d7cd03532b6e7ec3b.json │ │ │ ├── 024fa5038122d0e62ef465fbeee98270.json │ │ │ ├── 4f53ffee508f4d258fef94eaadfdacde.json │ │ │ ├── 02f1c40a91dcdb4c30d6bd7c4b8225a5.json │ │ │ ├── 66f386860154a80d785d36500420ab6a.json │ │ │ ├── e3aee58cc710028f794f060c060181e5.json │ │ │ ├── 2961c6901bcd4464f31210976ee29f29.json │ │ │ ├── 2b2f6856e65186d94ec73658381d3a60.json │ │ │ ├── 600bd61fde445a13e6d568dd04709a81.json │ │ │ ├── 21a14e366e37b9d00705061f0d8a5dbc.json │ │ │ ├── 48832ea3ed31ac27d4e15027cfed2c63.json │ │ │ ├── 9429645e33f26cce4a865c05f4be5875.json │ │ │ └── db7313697c786dc8c0fde05c269e141a.json │ ├── tsconfig.json │ └── package.json ├── aiml-ui │ ├── .env.example │ ├── biome.json │ ├── src │ │ ├── vite-env.d.ts │ │ ├── app │ │ │ ├── metadata.ts │ │ │ ├── page.tsx │ │ │ ├── agents │ │ │ │ └── [agentId] │ │ │ │ │ ├── page.tsx │ │ │ │ │ ├── layout.tsx │ │ │ │ │ ├── evals │ │ │ │ │ └── page.tsx │ │ │ │ │ └── traces │ │ │ │ │ └── page.tsx │ │ │ ├── layout.tsx │ │ │ ├── api │ │ │ │ ├── tools │ │ │ │ │ ├── route.ts │ │ │ │ │ └── [toolId] │ │ │ │ │ │ └── route.ts │ │ │ │ ├── agents │ │ │ │ │ ├── route.ts │ │ │ │ │ └── [agentId] │ │ │ │ │ │ └── route.ts │ │ │ │ ├── workflows │ │ │ │ │ ├── [workflowId] │ │ │ │ │ │ ├── execute │ │ │ │ │ │ │ └── route.ts │ │ │ │ │ │ ├── resume │ │ │ │ │ │ │ └── route.ts │ │ │ │ │ │ └── watch │ │ │ │ │ │ │ └── route.ts │ │ │ │ │ └── route.ts │ │ │ │ └── telemetry │ │ │ │ │ └── route.ts │ │ │ ├── workflows │ │ │ │ └── [workflowId] │ │ │ │ │ ├── layout.tsx │ │ │ │ │ └── traces │ │ │ │ │ └── page.tsx │ │ │ └── tools │ │ │ │ ├── all │ │ │ │ └── [toolId] │ │ │ │ │ └── page.tsx │ │ │ │ └── [agentId] │ │ │ │ └── [toolId] │ │ │ │ └── page.tsx │ │ ├── components │ │ │ ├── ui │ │ │ │ ├── score-indicator.tsx │ │ │ │ ├── skeleton.tsx │ │ │ │ ├── collapsible.tsx │ │ │ │ ├── syntax-highlighter.ts │ │ │ │ ├── typing-indicator.tsx │ │ │ │ ├── header.tsx │ │ │ │ ├── formatted-date.tsx │ │ │ │ ├── label.tsx │ │ │ │ ├── textarea.tsx │ │ │ │ ├── prompt-suggestions.tsx │ │ │ │ ├── sonner.tsx │ │ │ │ ├── copyable-content.tsx │ │ │ │ ├── progress.tsx │ │ │ │ ├── copy-button.tsx │ │ │ │ ├── message-list.tsx │ │ │ │ ├── badge.tsx │ │ │ │ ├── switch.tsx │ │ │ │ ├── tooltip.tsx │ │ │ │ ├── text.tsx │ │ │ │ ├── code-block.tsx │ │ │ │ ├── popover.tsx │ │ │ │ └── theme-provider.tsx │ │ │ ├── dynamic-form │ │ │ │ ├── fields │ │ │ │ │ ├── index.ts │ │ │ │ │ ├── boolean-field.tsx │ │ │ │ │ ├── date-field.tsx │ │ │ │ │ ├── number-field.tsx │ │ │ │ │ ├── string-field.tsx │ │ │ │ │ └── enum-field.tsx │ │ │ │ ├── utils.ts │ │ │ │ └── resolvers │ │ │ │ │ └── index.ts │ │ │ ├── layout.tsx │ │ │ ├── assistant-ui │ │ │ │ └── tooltip-icon-button.tsx │ │ │ └── syntax-highlighter.tsx │ │ ├── types │ │ │ └── tool.ts │ │ ├── domains │ │ │ ├── workflows │ │ │ │ ├── workflow-chat.tsx │ │ │ │ └── workflow-endpoints.tsx │ │ │ ├── agents │ │ │ │ ├── agent-layout.tsx │ │ │ │ └── components │ │ │ │ │ └── version-actions.tsx │ │ │ └── traces │ │ │ │ └── trace-span-view.tsx │ │ ├── lib │ │ │ └── utils.ts │ │ ├── hooks │ │ │ ├── use-execute-agent-tool.ts │ │ │ ├── use-copy-to-clipboard.ts │ │ │ ├── use-execute-tool.ts │ │ │ └── use-autosize-textarea.ts │ │ └── types.ts │ ├── postcss.config.js │ ├── vite.config.ts │ ├── components.json │ ├── tsconfig.node.json │ ├── tsconfig.json │ ├── tsconfig.app.json │ └── public │ │ └── vite.svg └── landing-page │ ├── biome.json │ ├── app │ ├── api │ │ └── search │ │ │ └── route.ts │ ├── docs │ │ ├── layout.tsx │ │ ├── globals.css │ │ ├── layout.config.tsx │ │ ├── [[...slug]] │ │ │ ├── layout.tsx │ │ │ └── page.tsx │ │ └── llm.txt │ │ │ └── route.ts │ ├── docs-og │ │ └── [...slug] │ │ │ └── route.ts │ ├── layout.tsx │ ├── tailwind-v3-compat.css │ └── llm.txt │ │ └── route.ts │ ├── postcss.config.mjs │ ├── lib │ ├── utils.ts │ ├── source.ts │ └── metadata.ts │ ├── components │ ├── ui │ │ ├── aspect-ratio.tsx │ │ ├── skeleton.tsx │ │ ├── collapsible.tsx │ │ ├── use-mobile.tsx │ │ ├── textarea.tsx │ │ ├── label.tsx │ │ ├── input.tsx │ │ ├── separator.tsx │ │ ├── progress.tsx │ │ ├── toaster.tsx │ │ ├── sonner.tsx │ │ ├── checkbox.tsx │ │ ├── slider.tsx │ │ ├── switch.tsx │ │ ├── tooltip.tsx │ │ ├── badge.tsx │ │ ├── hover-card.tsx │ │ └── popover.tsx │ ├── theme-provider.tsx │ └── mdx-components.tsx │ ├── source.config.ts │ ├── .gitignore │ ├── components.json │ ├── public │ ├── placeholder-logo.png │ ├── placeholder.jpg │ └── mark.svg │ ├── hooks │ └── use-mobile.tsx │ ├── tsconfig.json │ └── next.config.mjs ├── .env.development ├── packages ├── shared │ ├── src │ │ ├── element-configs │ │ │ ├── utils │ │ │ │ └── zod.ts │ │ │ └── nodeDefinitions.ts │ │ ├── types │ │ │ ├── utils.ts │ │ │ ├── openai.ts │ │ │ ├── diagnostics.ts │ │ │ └── datamodel.ts │ │ ├── index.ts │ │ ├── utils │ │ │ ├── set.ts │ │ │ └── errorCodes.ts │ │ ├── errors.ts │ │ └── execution │ │ │ └── expression-evaluation.ts │ ├── biome.json │ ├── tsup.config.ts │ ├── tsconfig.json │ └── package.json ├── vscode │ ├── client │ │ ├── testFixture │ │ │ ├── completion.txt │ │ │ └── diagnostics.txt │ │ ├── tsconfig.json │ │ ├── package.json │ │ └── src │ │ │ └── test │ │ │ ├── index.ts │ │ │ └── runTest.ts │ ├── biome.json │ ├── CHANGELOG.md │ ├── assets │ │ ├── aiml.jpg │ │ └── file-icon.svg │ ├── vscode-aiml-0.0.1.vsix │ ├── scripts │ │ └── e2e.sh │ ├── .vscodeignore │ ├── tsconfig.json │ ├── server │ │ ├── tsconfig.json │ │ └── package.json │ ├── tsconfig.schema.json │ ├── LICENSE │ └── language-configuration.json ├── parser │ ├── biome.json │ ├── dev.tsconfig.json │ ├── tsconfig.json │ ├── tsdown.config.ts │ ├── .swcrc │ ├── src │ │ ├── validateConfig.test.ts │ │ ├── astToElements │ │ │ ├── processHeaderInformation.ts │ │ │ ├── setInitialStateIfNeeded.ts │ │ │ ├── ensureWorkflowNode.ts │ │ │ └── assignCommentsToElement.ts │ │ ├── utils │ │ │ ├── fuzzySearchTags.ts │ │ │ └── compiler-config.ts │ │ ├── ast │ │ │ └── aiml │ │ │ │ └── __fixtures__ │ │ │ │ └── justmd.aiml │ │ └── types.ts │ └── test │ │ └── complex-attributes.mdx ├── runtime │ ├── biome.json │ ├── src │ │ ├── elements │ │ │ ├── ai │ │ │ │ └── index.ts │ │ │ ├── context │ │ │ │ ├── index.ts │ │ │ │ ├── DataModelElement.ts │ │ │ │ └── DataElement.ts │ │ │ ├── states │ │ │ │ ├── index.ts │ │ │ │ ├── FinalElement.ts │ │ │ │ ├── ParallelElement.ts │ │ │ │ └── HistoryElement.ts │ │ │ ├── control-flow │ │ │ │ ├── OnExitElement.ts │ │ │ │ ├── OnEntryElement.ts │ │ │ │ ├── index.ts │ │ │ │ ├── ElseIfElement.ts │ │ │ │ ├── ForEachElement.ts │ │ │ │ ├── IfElement.ts │ │ │ │ └── ElseElement.ts │ │ │ ├── actions │ │ │ │ ├── index.ts │ │ │ │ ├── RaiseElement.ts │ │ │ │ └── LogElement.ts │ │ │ └── index.ts │ │ ├── index.ts │ │ ├── utils.ts │ │ └── ElementExecutionContext │ │ │ └── index.test.ts │ ├── tsup.config.ts │ ├── tsconfig.json │ └── package.json └── tsconfig │ ├── package.json │ ├── node.json │ ├── react.json │ ├── tsdown.config.base.ts │ ├── tsup.config.base.ts │ ├── library.json │ ├── tsconfig_main_instructions.txt │ └── base.json ├── .cursorignore ├── .cursor └── rules │ ├── core-rules │ └── readme.md │ ├── ts-rules │ └── readme.md │ ├── app-rules │ ├── vscode-plugin-agent.mdc │ ├── landing-page-agent.mdc │ ├── aiml-ui-agent.mdc │ └── server-agent.mdc │ ├── tool-rules │ ├── readme.md │ └── bun-usage-agent.mdc │ ├── ui-rules │ └── readme.md │ └── global-rules │ ├── readme.md │ └── emoji-communication-always.mdc ├── docs ├── packages │ └── vscode.md ├── elements │ ├── stream │ │ └── index.mdx │ └── index.mdx ├── examples │ ├── simple-chat.mdx │ └── chain-of-thought.mdx ├── meta.json └── editor-plugins.mdx ├── .dockerignore ├── .cursorindexingignore ├── examples ├── JustPrompt │ └── index.aiml ├── SimpleChain │ └── index.aiml ├── SimpleRouter │ └── index.aiml ├── InvestmentAdvisor │ └── states │ │ ├── PresentRecommendation.aiml │ │ ├── MarketAnalysis.aiml │ │ └── ProfileAssessment.aiml └── FinalStateTest │ └── index.aiml ├── .changeset ├── config.json └── README.md ├── .env.example ├── requirements.txt └── .github └── workflows └── deploy-image.yml /apps/server/src/db/index.ts: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.env.development: -------------------------------------------------------------------------------- 1 | OPENAI_API_KEY=your-api-key 2 | -------------------------------------------------------------------------------- /packages/shared/src/element-configs/utils/zod.ts: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /packages/vscode/client/testFixture/completion.txt: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.cursorignore: -------------------------------------------------------------------------------- 1 | # Project notes and templates 2 | xnotes/ 3 | -------------------------------------------------------------------------------- /apps/aiml-ui/.env.example: -------------------------------------------------------------------------------- 1 | FIREWORK_API_KEY=fw_********************* -------------------------------------------------------------------------------- /apps/aiml-ui/biome.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": ["../../biome.json"] 3 | } 4 | -------------------------------------------------------------------------------- /apps/aiml-ui/src/vite-env.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | -------------------------------------------------------------------------------- /apps/server/biome.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": ["../../biome.json"] 3 | } 4 | -------------------------------------------------------------------------------- /packages/vscode/client/testFixture/diagnostics.txt: -------------------------------------------------------------------------------- 1 | ANY browsers, ANY OS. -------------------------------------------------------------------------------- /apps/landing-page/biome.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": ["../../biome.json"] 3 | } 4 | -------------------------------------------------------------------------------- /packages/parser/biome.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": ["../../biome.json"] 3 | } 4 | -------------------------------------------------------------------------------- /packages/runtime/biome.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": ["../../biome.json"] 3 | } 4 | -------------------------------------------------------------------------------- /packages/shared/biome.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": ["../../biome.json"] 3 | } 4 | -------------------------------------------------------------------------------- /packages/vscode/biome.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": ["../../biome.json"] 3 | } 4 | -------------------------------------------------------------------------------- /.cursor/rules/core-rules/readme.md: -------------------------------------------------------------------------------- 1 | Core rules related to cursor or rule generation 2 | -------------------------------------------------------------------------------- /.cursor/rules/ts-rules/readme.md: -------------------------------------------------------------------------------- 1 | TypeScript Specific Rules belong in this folder 2 | -------------------------------------------------------------------------------- /docs/packages/vscode.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: VSCode Plugin Documentation 3 | --- 4 | 5 | ## Overview 6 | -------------------------------------------------------------------------------- /packages/runtime/src/elements/ai/index.ts: -------------------------------------------------------------------------------- 1 | // Export all AI elements 2 | export * from './LLMElement'; 3 | -------------------------------------------------------------------------------- /packages/vscode/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | ## 0.0.1 4 | 5 | ### Patch Changes 6 | 7 | - Init 8 | -------------------------------------------------------------------------------- /.cursor/rules/app-rules/vscode-plugin-agent.mdc: -------------------------------------------------------------------------------- 1 | --- 2 | description: 3 | globs: 4 | alwaysApply: false 5 | --- 6 | -------------------------------------------------------------------------------- /packages/vscode/assets/aiml.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/subtleGradient/aiml/main/packages/vscode/assets/aiml.jpg -------------------------------------------------------------------------------- /.dockerignore: -------------------------------------------------------------------------------- 1 | **/node_modules 2 | .env* 3 | dist 4 | *.log 5 | .DS_Store 6 | docs/ 7 | **/aiml-ui 8 | **/landing-page 9 | **/vscode -------------------------------------------------------------------------------- /packages/vscode/vscode-aiml-0.0.1.vsix: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/subtleGradient/aiml/main/packages/vscode/vscode-aiml-0.0.1.vsix -------------------------------------------------------------------------------- /.cursor/rules/tool-rules/readme.md: -------------------------------------------------------------------------------- 1 | Rules specific to different tools, such as git, linux commands, direction of usage of MCP tools. 2 | -------------------------------------------------------------------------------- /.cursor/rules/ui-rules/readme.md: -------------------------------------------------------------------------------- 1 | Any rules related to react, html, css, angular, frontend development, etc... belong in this folder. 2 | -------------------------------------------------------------------------------- /apps/aiml-ui/postcss.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | plugins: { 3 | tailwindcss: {}, 4 | autoprefixer: {}, 5 | }, 6 | }; 7 | -------------------------------------------------------------------------------- /apps/aiml-ui/src/app/metadata.ts: -------------------------------------------------------------------------------- 1 | export const metadata = { 2 | title: 'AIML UI', 3 | description: 'AI/ML User Interface', 4 | }; 5 | -------------------------------------------------------------------------------- /.cursorindexingignore: -------------------------------------------------------------------------------- 1 | /xnotes 2 | .cursor/templates/*.md 3 | /node_modules 4 | .cursor/rules/* 5 | .cursor/modes.json 6 | .cursor/mcp.json 7 | -------------------------------------------------------------------------------- /apps/server/.dockerignore: -------------------------------------------------------------------------------- 1 | **/node_modules 2 | .env* 3 | dist 4 | *.log 5 | .DS_Store 6 | docs/ 7 | **/aiml-ui 8 | **/landing-page 9 | **/vscode -------------------------------------------------------------------------------- /apps/server/src/endpoints/openai/index.ts: -------------------------------------------------------------------------------- 1 | import { openaiChat } from "./openai.chat"; 2 | 3 | export const openaiRoutes = [openaiChat]; 4 | -------------------------------------------------------------------------------- /packages/runtime/tsup.config.ts: -------------------------------------------------------------------------------- 1 | import baseConfig from '../tsconfig/tsup.config.base'; 2 | 3 | export default { 4 | ...baseConfig, 5 | }; 6 | -------------------------------------------------------------------------------- /apps/server/src/types/user.ts: -------------------------------------------------------------------------------- 1 | export type User = { 2 | username: string; 3 | email: string; 4 | accountId: string; 5 | apiKey: string; 6 | }; 7 | -------------------------------------------------------------------------------- /docs/elements/stream/index.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | title: Stream Management 3 | description: Elements for stream management 4 | --- 5 | 6 | # Stream Management 7 | -------------------------------------------------------------------------------- /apps/aiml-ui/src/app/page.tsx: -------------------------------------------------------------------------------- 1 | import { redirect } from "next/navigation"; 2 | 3 | export default function Home() { 4 | redirect("/workflows"); 5 | } 6 | -------------------------------------------------------------------------------- /packages/runtime/src/elements/context/index.ts: -------------------------------------------------------------------------------- 1 | // Export all context elements 2 | export * from "./DataElement"; 3 | export * from "./DataModelElement"; 4 | -------------------------------------------------------------------------------- /apps/server/src/endpoints/index.ts: -------------------------------------------------------------------------------- 1 | import { getHealth } from "./health"; 2 | import { openaiRoutes } from "./openai"; 3 | 4 | export const endpoints = [getHealth, ...openaiRoutes]; 5 | -------------------------------------------------------------------------------- /packages/tsconfig/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@aiml/tsconfig", 3 | "version": "0.1.0", 4 | "private": true, 5 | "files": ["base.json", "node.json", "react.json", "library.json"] 6 | } 7 | -------------------------------------------------------------------------------- /apps/server/drizzle/0000_nostalgic_shinobi_shaw.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE "agents" ( 2 | "id" serial PRIMARY KEY NOT NULL, 3 | "name" text NOT NULL, 4 | "created_at" timestamp DEFAULT now() NOT NULL 5 | ); 6 | -------------------------------------------------------------------------------- /apps/landing-page/app/api/search/route.ts: -------------------------------------------------------------------------------- 1 | import { source } from "@/lib/source"; 2 | import { createFromSource } from "fumadocs-core/search/server"; 3 | 4 | export const { GET } = createFromSource(source); 5 | -------------------------------------------------------------------------------- /examples/JustPrompt/index.aiml: -------------------------------------------------------------------------------- 1 | This is a basic prompt, its just text! 2 | 3 | It can even include tags that are not special, and it works just fine! 4 | 5 | 6 | text inside 7 | -------------------------------------------------------------------------------- /packages/vscode/scripts/e2e.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | export CODE_TESTS_PATH="$(pwd)/client/out/test" 4 | export CODE_TESTS_WORKSPACE="$(pwd)/client/testFixture" 5 | 6 | node "$(pwd)/client/out/test/runTest" -------------------------------------------------------------------------------- /apps/landing-page/postcss.config.mjs: -------------------------------------------------------------------------------- 1 | /** @type {import('postcss-load-config').Config} */ 2 | const config = { 3 | plugins: { 4 | "@tailwindcss/postcss": {}, 5 | }, 6 | }; 7 | 8 | export default config; 9 | -------------------------------------------------------------------------------- /apps/server/src/types/openai/index.ts: -------------------------------------------------------------------------------- 1 | // Export all types from the OpenAI types directory 2 | export * from "./chat"; 3 | export * from "./completions"; 4 | export * from "./shared"; 5 | export * from "./chatZod"; 6 | -------------------------------------------------------------------------------- /apps/landing-page/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 | -------------------------------------------------------------------------------- /packages/runtime/src/elements/states/index.ts: -------------------------------------------------------------------------------- 1 | // Export all state elements 2 | export * from './StateElement'; 3 | export * from './ParallelElement'; 4 | export * from './FinalElement'; 5 | export * from './WorkflowElement'; 6 | -------------------------------------------------------------------------------- /apps/aiml-ui/src/components/ui/score-indicator.tsx: -------------------------------------------------------------------------------- 1 | import { Badge } from './badge'; 2 | 3 | export function ScoreIndicator({ score }: { score: number }) { 4 | return {score.toFixed(2)}; 5 | } 6 | -------------------------------------------------------------------------------- /apps/landing-page/components/ui/aspect-ratio.tsx: -------------------------------------------------------------------------------- 1 | "use client" 2 | 3 | import * as AspectRatioPrimitive from "@radix-ui/react-aspect-ratio" 4 | 5 | const AspectRatio = AspectRatioPrimitive.Root 6 | 7 | export { AspectRatio } 8 | -------------------------------------------------------------------------------- /apps/landing-page/lib/source.ts: -------------------------------------------------------------------------------- 1 | import { docs } from "@/.source"; 2 | import { loader } from "fumadocs-core/source"; 3 | 4 | export const source = loader({ 5 | baseUrl: "/docs", 6 | source: docs.toFumadocsSource(), 7 | }); 8 | -------------------------------------------------------------------------------- /packages/shared/tsup.config.ts: -------------------------------------------------------------------------------- 1 | import baseConfig from "../tsconfig/tsup.config.base"; 2 | 3 | export default { 4 | ...baseConfig, 5 | // Disable dts generation in tsup, we'll use tsc for that 6 | entry: ["src/index.ts"], 7 | }; 8 | -------------------------------------------------------------------------------- /apps/aiml-ui/src/types/tool.ts: -------------------------------------------------------------------------------- 1 | import type { Tool as BaseTool } from '@mastra/core/tools'; 2 | 3 | export interface ToolResponse extends BaseTool { 4 | id: string; 5 | name: string; 6 | description: string; 7 | } 8 | -------------------------------------------------------------------------------- /apps/server/src/endpoints/health.ts: -------------------------------------------------------------------------------- 1 | import type { Context } from "hono"; 2 | export const getHealth = { 3 | method: "GET", 4 | path: "/health", 5 | handler: async (c: Context) => { 6 | return c.json({ status: "ok" }); 7 | }, 8 | }; 9 | -------------------------------------------------------------------------------- /apps/landing-page/lib/metadata.ts: -------------------------------------------------------------------------------- 1 | import { createMetadataImage } from "fumadocs-core/server"; 2 | import { source } from "@/lib/source"; 3 | 4 | export const metadataImage = createMetadataImage({ 5 | imageRoute: "/docs-og", 6 | source, 7 | }); 8 | -------------------------------------------------------------------------------- /apps/landing-page/app/docs/layout.tsx: -------------------------------------------------------------------------------- 1 | import "./globals.css"; 2 | import { RootProvider } from "fumadocs-ui/provider"; 3 | export default function Layout({ children }: { children: React.ReactNode }) { 4 | return {children}; 5 | } 6 | -------------------------------------------------------------------------------- /packages/runtime/src/elements/control-flow/OnExitElement.ts: -------------------------------------------------------------------------------- 1 | import { onExitConfig } from "@aiml/shared"; 2 | import { createElementDefinition } from "../createElementFactory"; 3 | 4 | export const OnExit = createElementDefinition({ 5 | ...onExitConfig, 6 | }); 7 | -------------------------------------------------------------------------------- /packages/runtime/src/elements/control-flow/OnEntryElement.ts: -------------------------------------------------------------------------------- 1 | import { onEntryConfig } from "@aiml/shared"; 2 | import { createElementDefinition } from "../createElementFactory"; 3 | 4 | export const OnEntry = createElementDefinition({ 5 | ...onEntryConfig, 6 | }); 7 | -------------------------------------------------------------------------------- /apps/landing-page/app/docs/globals.css: -------------------------------------------------------------------------------- 1 | @import "tailwindcss"; 2 | @import "fumadocs-ui/css/neutral.css"; 3 | @import "fumadocs-ui/css/preset.css"; 4 | 5 | /* path of `fumadocs-ui` relative to the CSS file */ 6 | @source "../../../../node_modules/fumadocs-ui/dist/**/*.js"; 7 | -------------------------------------------------------------------------------- /packages/runtime/src/index.ts: -------------------------------------------------------------------------------- 1 | // Export all runtime functionality 2 | export * from "./graphBuilder"; 3 | export * from "./ElementExecutionContext"; 4 | export * from "./workflow"; 5 | export * from "./hydrateElementTree"; 6 | export * from "./utils"; 7 | export * from "./RunValue"; 8 | -------------------------------------------------------------------------------- /packages/runtime/src/elements/actions/index.ts: -------------------------------------------------------------------------------- 1 | // Export all action elements 2 | export * from './AssignElement'; 3 | export * from './LogElement'; 4 | export * from './RaiseElement'; 5 | export * from './ScriptElement'; 6 | export * from './SendElement'; 7 | export * from './CancelElement'; 8 | -------------------------------------------------------------------------------- /apps/landing-page/source.config.ts: -------------------------------------------------------------------------------- 1 | import { defineDocs } from "fumadocs-mdx/config"; 2 | 3 | export const docs = defineDocs({ 4 | dir: "../../docs", 5 | docs: { 6 | // options for `doc` collection 7 | }, 8 | meta: { 9 | // options for `meta` collection 10 | }, 11 | }); 12 | -------------------------------------------------------------------------------- /packages/vscode/.vscodeignore: -------------------------------------------------------------------------------- 1 | # Workaround for https://github.com/microsoft/vscode-vsce/issues/580 2 | ../../ 3 | 4 | .* 5 | .*/ 6 | *.log 7 | *.map 8 | *.ts 9 | *.tsbuildinfo 10 | node_modules/** 11 | !node_modules/@mdx-js/typescript-plugin.js 12 | fixtures/ 13 | packages/ 14 | script/ 15 | -------------------------------------------------------------------------------- /apps/aiml-ui/src/components/ui/skeleton.tsx: -------------------------------------------------------------------------------- 1 | import { cn } from '../../lib/utils'; 2 | 3 | function Skeleton({ className, ...props }: React.HTMLAttributes) { 4 | return
; 5 | } 6 | 7 | export { Skeleton }; 8 | -------------------------------------------------------------------------------- /apps/server/drizzle/meta/_journal.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "7", 3 | "dialect": "postgresql", 4 | "entries": [ 5 | { 6 | "idx": 0, 7 | "version": "7", 8 | "when": 1747859729725, 9 | "tag": "0000_nostalgic_shinobi_shaw", 10 | "breakpoints": true 11 | } 12 | ] 13 | } -------------------------------------------------------------------------------- /apps/server/README.md: -------------------------------------------------------------------------------- 1 | # server 2 | 3 | To install dependencies: 4 | 5 | ```bash 6 | bun install 7 | ``` 8 | 9 | To run: 10 | 11 | ```bash 12 | bun run src/index.ts 13 | ``` 14 | 15 | This project was created using `bun init` in bun v1.1.42. [Bun](https://bun.sh) is a fast all-in-one JavaScript runtime. 16 | -------------------------------------------------------------------------------- /apps/server/drizzle.config.ts: -------------------------------------------------------------------------------- 1 | import 'dotenv/config'; 2 | import { defineConfig } from 'drizzle-kit'; 3 | export default defineConfig({ 4 | out: './drizzle', 5 | schema: './src/db/schema.ts', 6 | dialect: 'postgresql', 7 | dbCredentials: { 8 | url: process.env.DATABASE_URL!, 9 | }, 10 | }); 11 | -------------------------------------------------------------------------------- /packages/runtime/src/elements/context/DataModelElement.ts: -------------------------------------------------------------------------------- 1 | import { dataModelConfig } from "@aiml/shared"; 2 | import { createElementDefinition } from "../createElementFactory"; 3 | 4 | export const DataModel = createElementDefinition({ 5 | ...dataModelConfig, 6 | onExecutionGraphConstruction: (ctx) => {}, 7 | }); 8 | -------------------------------------------------------------------------------- /packages/tsconfig/node.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json.schemastore.org/tsconfig", 3 | "display": "Node", 4 | "extends": "./base.json", 5 | "compilerOptions": { 6 | "lib": ["ESNext"], 7 | "module": "ESNext", 8 | "target": "ESNext", 9 | "moduleResolution": "Bundler" 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /apps/landing-page/app/docs/layout.config.tsx: -------------------------------------------------------------------------------- 1 | import type { BaseLayoutProps } from "fumadocs-ui/layouts/shared"; 2 | 3 | export const baseOptions: BaseLayoutProps = { 4 | nav: { 5 | title: "AIML Docs", 6 | }, 7 | themeSwitch: { 8 | enabled: true, 9 | mode: "light-dark-system", 10 | }, 11 | }; 12 | -------------------------------------------------------------------------------- /apps/aiml-ui/src/app/agents/[agentId]/page.tsx: -------------------------------------------------------------------------------- 1 | import { redirect } from 'next/navigation'; 2 | import * as React from 'react'; 3 | 4 | export default async function AgentPage({ params }: any) { 5 | const resolvedParams = React.use(params); 6 | redirect(`/agents/${(resolvedParams as any).agentId as string}/chat`); 7 | } 8 | -------------------------------------------------------------------------------- /packages/runtime/src/elements/index.ts: -------------------------------------------------------------------------------- 1 | // Export all element implementations 2 | export * from './actions'; 3 | export * from './control-flow'; 4 | export * from './states'; 5 | export * from './context'; 6 | export * from './ai'; 7 | 8 | // Re-export BaseElement from element-core 9 | export { BaseElement } from './BaseElement'; 10 | -------------------------------------------------------------------------------- /apps/landing-page/components/theme-provider.tsx: -------------------------------------------------------------------------------- 1 | 'use client' 2 | import { 3 | ThemeProvider as NextThemesProvider, 4 | type ThemeProviderProps, 5 | } from 'next-themes' 6 | 7 | export function ThemeProvider({ children, ...props }: ThemeProviderProps) { 8 | return {children} 9 | } 10 | -------------------------------------------------------------------------------- /packages/runtime/src/elements/control-flow/index.ts: -------------------------------------------------------------------------------- 1 | // Export all control flow elements 2 | export * from './IfElement'; 3 | export * from './ElseElement'; 4 | export * from './ElseIfElement'; 5 | export * from './ForEachElement'; 6 | export * from './OnEntryElement'; 7 | export * from './OnExitElement'; 8 | export * from './TransitionElement'; 9 | -------------------------------------------------------------------------------- /packages/shared/src/types/utils.ts: -------------------------------------------------------------------------------- 1 | import { aimlElements } from "./elements"; 2 | 3 | export function isAIMLElement(nodeName: string): boolean { 4 | return aimlElements.includes(nodeName as (typeof aimlElements)[number]); 5 | } 6 | 7 | export type Unpack = { 8 | [K in keyof T]: T[K] extends object ? Unpack : T[K]; 9 | }; 10 | -------------------------------------------------------------------------------- /packages/shared/src/index.ts: -------------------------------------------------------------------------------- 1 | // Export all element core functionality 2 | export * from "./utils/errorCodes"; 3 | export * from "./utils/streams"; 4 | export * from "./utils/set"; 5 | export * from "./execution/expression-evaluation"; 6 | export * from "./validation/data-validation"; 7 | export * from "./types"; 8 | export * from "./element-configs"; 9 | -------------------------------------------------------------------------------- /.changeset/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://unpkg.com/@changesets/config@3.1.1/schema.json", 3 | "changelog": "@changesets/cli/changelog", 4 | "commit": true, 5 | "fixed": [], 6 | "linked": [], 7 | "access": "restricted", 8 | "baseBranch": "main", 9 | "updateInternalDependencies": "patch", 10 | "ignore": ["landing-page"] 11 | } 12 | -------------------------------------------------------------------------------- /.cursor/rules/global-rules/readme.md: -------------------------------------------------------------------------------- 1 | All globally applying always on rules that will bloat every chat and cmd-k context go here. 2 | 3 | Rules in this folder will have alwaysApply: true with blank descriptions and globs. 4 | 5 | These are equivalent to the root project .cursorrules files (which are now deprecated and may be removed in a future cursor version) 6 | -------------------------------------------------------------------------------- /packages/tsconfig/react.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json.schemastore.org/tsconfig", 3 | "display": "React", 4 | "extends": "./base.json", 5 | "compilerOptions": { 6 | "jsx": "preserve", 7 | "lib": ["ESNext", "DOM", "DOM.Iterable"], 8 | "module": "ESNext", 9 | "target": "ESNext", 10 | "moduleResolution": "Bundler" 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /packages/tsconfig/tsdown.config.base.ts: -------------------------------------------------------------------------------- 1 | import { defineConfig } from 'tsdown'; 2 | 3 | export default defineConfig({ 4 | entry: ['src/index.ts'], 5 | dts: true, // Generate declaration files 6 | sourcemap: true, 7 | clean: true, // Clean output directory before build 8 | minify: false, // No minification in development 9 | outDir: 'dist', 10 | }); 11 | -------------------------------------------------------------------------------- /apps/landing-page/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 | -------------------------------------------------------------------------------- /apps/server/src/types/routeHandler.ts: -------------------------------------------------------------------------------- 1 | import type { 2 | RouteHandler as OpenAPIRouteHandler, 3 | createRoute, 4 | } from "@hono/zod-openapi"; 5 | import type { ContextEnv } from "@/lib/env"; 6 | 7 | export type RouteConfig = Parameters[0]; 8 | 9 | export type ResponseHandler = OpenAPIRouteHandler< 10 | R, 11 | ContextEnv 12 | >; 13 | -------------------------------------------------------------------------------- /packages/parser/dev.tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "include": ["src/**/*.ts", "src/**/*.tsx", "src/**/*.mdx", "src/**/*.md", "src/**/*.jsx", "src/**/*.js"], 4 | "compilerOptions": { 5 | "noEmit": false, 6 | "declaration": true, 7 | "emitDeclarationOnly": true, 8 | "outDir": "dist" 9 | }, 10 | "exclude": ["**/__tests__/**"] 11 | } 12 | -------------------------------------------------------------------------------- /apps/aiml-ui/src/app/layout.tsx: -------------------------------------------------------------------------------- 1 | "use client"; 2 | 3 | import { Layout } from "@/components/layout"; 4 | import "./globals.css"; 5 | 6 | export default function RootLayout({ 7 | children, 8 | }: { 9 | children: React.ReactNode; 10 | }) { 11 | return ( 12 | 13 | 14 | {children} 15 | 16 | 17 | ); 18 | } 19 | -------------------------------------------------------------------------------- /packages/parser/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "@aiml/tsconfig/library.json", 3 | "exclude": ["node_modules", "dist", "src/**/*.test.ts", "src/**/*.test.tsx", "src/**/*.d.ts"], 4 | "include": ["src/**/*.ts", "src/**/*.tsx", "src/**/*.json"], 5 | "compilerOptions": { 6 | "outDir": "./dist", 7 | "rootDir": "./src", 8 | "noEmit": true, 9 | "module": "NodeNext" 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /.env.example: -------------------------------------------------------------------------------- 1 | # Get your Fireworks API key from https://fireworks.ai/settings/users/api-keys 2 | FIREWORKS_API_KEY=API_KEY_HERE 3 | 4 | # Use the URL of your Postgres database 5 | # You can use a local Postgres database by installing Postgres locally 6 | # == OR == 7 | #Using a cloud based Postgres database such as Neon https://neon.tech 8 | DATABASE_URL=postgresql://postgres:postgres@0.0.0.0:5432/aiml-server 9 | -------------------------------------------------------------------------------- /apps/aiml-ui/src/app/api/tools/route.ts: -------------------------------------------------------------------------------- 1 | import { NextResponse } from 'next/server'; 2 | 3 | export async function GET() { 4 | // Mock data for now - replace with actual API call 5 | return NextResponse.json({ 6 | tool1: { 7 | id: 'tool1', 8 | name: 'Test Tool', 9 | description: 'A test tool', 10 | type: 'default', 11 | config: {}, 12 | }, 13 | }); 14 | } 15 | -------------------------------------------------------------------------------- /packages/parser/tsdown.config.ts: -------------------------------------------------------------------------------- 1 | import baseConfig from '../tsconfig/tsdown.config.base'; 2 | import { importAsString } from 'rollup-plugin-string-import'; 3 | 4 | export default { 5 | ...baseConfig, 6 | // Disable dts generation in tsdown, we'll use tsc for that 7 | entry: ['src/index.ts'], 8 | plugins: [importAsString({ 9 | include: ['**/*.aiml', '**/*.ohm'], 10 | })], 11 | }; 12 | 13 | -------------------------------------------------------------------------------- /packages/runtime/src/elements/control-flow/ElseIfElement.ts: -------------------------------------------------------------------------------- 1 | import { elseIfConfig } from "@aiml/shared"; 2 | import { createElementDefinition } from "../createElementFactory"; 3 | 4 | export const ElseIf = createElementDefinition({ 5 | ...elseIfConfig, 6 | onExecutionGraphConstruction(buildContext) { 7 | buildContext.graphBuilder.elseIf(buildContext.attributes.condition); 8 | }, 9 | }); 10 | -------------------------------------------------------------------------------- /apps/server/src/db/conn.ts: -------------------------------------------------------------------------------- 1 | import { drizzle } from "drizzle-orm/postgres-js"; 2 | import postgres from "postgres"; 3 | export const migrationClient = postgres( 4 | "postgres://postgres:postgres@0.0.0.0:6782/postgres", 5 | { max: 1 } 6 | ); 7 | export const postgresClient = postgres( 8 | "postgres://postgres:postgres@0.0.0.0:6782/postgres" 9 | ); 10 | export const dbConn = drizzle(postgresClient); 11 | -------------------------------------------------------------------------------- /apps/server/src/utils/uuid.ts: -------------------------------------------------------------------------------- 1 | export function uuid(): string { 2 | const uuid = new Array(36); 3 | for (let i = 0; i < 36; i++) { 4 | uuid[i] = Math.floor(Math.random() * 16); 5 | } 6 | uuid[14] = 4; 7 | uuid[19] = uuid[19] &= ~(1 << 2); 8 | uuid[19] = uuid[19] |= 1 << 3; 9 | uuid[8] = uuid[13] = uuid[18] = uuid[23] = '-'; 10 | return uuid.map((x) => x.toString(16)).join(''); 11 | } 12 | -------------------------------------------------------------------------------- /apps/server/.env.example: -------------------------------------------------------------------------------- 1 | # Get your Fireworks API key from https://fireworks.ai/settings/users/api-keys 2 | FIREWORKS_API_KEY=API_KEY_HERE 3 | 4 | # Use the URL of your Postgres database 5 | # You can use a local Postgres database by installing Postgres locally 6 | # == OR == 7 | #Using a cloud based Postgres database such as Neon https://neon.tech 8 | DATABASE_URL=postgresql://postgres:postgres@0.0.0.0:5432/aiml-server 9 | -------------------------------------------------------------------------------- /apps/landing-page/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 | -------------------------------------------------------------------------------- /packages/shared/src/types/openai.ts: -------------------------------------------------------------------------------- 1 | import type { ChatCompletion, ChatCompletionChunk } from 'openai/resources/chat/completions/completions'; 2 | import type { ResponseStreamEvent } from 'openai/resources/responses/responses'; 3 | 4 | export type OpenAIResponseStreamEvent = ResponseStreamEvent; 5 | 6 | export type OpenAIChatCompletionChunk = ChatCompletionChunk; 7 | 8 | export type OpenAIChatCompletion = ChatCompletion; 9 | -------------------------------------------------------------------------------- /apps/aiml-ui/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 | -------------------------------------------------------------------------------- /apps/aiml-ui/src/domains/workflows/workflow-chat.tsx: -------------------------------------------------------------------------------- 1 | import { Thread } from '@/components/assistant-ui/thread'; 2 | 3 | export function WorkflowChat({ 4 | workflowId, 5 | setRunId, 6 | }: { 7 | workflowId: string; 8 | setRunId: (runId: string) => void; 9 | }) { 10 | return ( 11 |
12 | 13 |
14 | ); 15 | } 16 | -------------------------------------------------------------------------------- /packages/shared/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "@aiml/tsconfig/library.json", 3 | "compilerOptions": { 4 | "outDir": "./dist", 5 | "rootDir": "./src", 6 | "skipLibCheck": true, 7 | "module": "esnext", 8 | "moduleResolution": "bundler", 9 | "declaration": true, 10 | "declarationMap": true 11 | }, 12 | "include": ["src/**/*.ts", "src/**/*.tsx"], 13 | "exclude": ["node_modules", "dist"] 14 | } 15 | -------------------------------------------------------------------------------- /apps/aiml-ui/src/app/api/agents/route.ts: -------------------------------------------------------------------------------- 1 | import { NextResponse } from 'next/server'; 2 | 3 | export async function GET() { 4 | // Mock data for now - replace with actual API call 5 | return NextResponse.json({ 6 | agent1: { 7 | id: 'agent1', 8 | name: 'Test Agent', 9 | description: 'A test agent', 10 | tools: {}, 11 | provider: 'openai', 12 | modelId: 'gpt-4', 13 | }, 14 | }); 15 | } 16 | -------------------------------------------------------------------------------- /packages/tsconfig/tsup.config.base.ts: -------------------------------------------------------------------------------- 1 | import { defineConfig } from 'tsup'; 2 | 3 | export default defineConfig({ 4 | entry: ['src/index.ts'], 5 | format: ['esm', 'cjs'], // Generate both ESM and CommonJS 6 | dts: true, // Generate declaration files 7 | splitting: false, 8 | sourcemap: true, 9 | clean: true, // Clean output directory before build 10 | minify: false, // No minification in development 11 | outDir: 'dist', 12 | }); 13 | -------------------------------------------------------------------------------- /.cursor/rules/app-rules/landing-page-agent.mdc: -------------------------------------------------------------------------------- 1 | # Landing Page Application Rules (landing-page) 2 | 3 | ## Critical Rules 4 | 5 | * (TODO: Add rules specific to the landing-page application, e.g., content guidelines, SEO practices, component usage) 6 | 7 | ## Examples 8 | 9 | 10 | // (TODO: Add a valid example of applying a rule) 11 | 12 | 13 | 14 | // (TODO: Add an invalid example) 15 | -------------------------------------------------------------------------------- /.cursor/rules/app-rules/aiml-ui-agent.mdc: -------------------------------------------------------------------------------- 1 | # AIML UI Application Rules (@aiml/aiml-ui) 2 | 3 | ## Critical Rules 4 | 5 | * (TODO: Add rules specific to the aiml-ui application, e.g., state management patterns, component structure, styling guidelines) 6 | 7 | ## Examples 8 | 9 | 10 | // (TODO: Add a valid example of applying a rule) 11 | 12 | 13 | 14 | // (TODO: Add an invalid example) 15 | 16 | -------------------------------------------------------------------------------- /apps/landing-page/.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | /node_modules 5 | 6 | # next.js 7 | /.next/ 8 | /out/ 9 | 10 | # production 11 | /build 12 | 13 | # debug 14 | npm-debug.log* 15 | yarn-debug.log* 16 | yarn-error.log* 17 | .pnpm-debug.log* 18 | 19 | # env files 20 | .env* 21 | 22 | # vercel 23 | .vercel 24 | 25 | # typescript 26 | *.tsbuildinfo 27 | next-env.d.ts -------------------------------------------------------------------------------- /apps/landing-page/app/docs/[[...slug]]/layout.tsx: -------------------------------------------------------------------------------- 1 | import { source } from "@/lib/source"; 2 | import { DocsLayout } from "fumadocs-ui/layouts/docs"; 3 | import type { ReactNode } from "react"; 4 | import { baseOptions } from "../layout.config"; 5 | 6 | export default function Layout({ children }: { children: ReactNode }) { 7 | return ( 8 | 9 | {children} 10 | 11 | ); 12 | } 13 | -------------------------------------------------------------------------------- /packages/vscode/client/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "commonjs", 4 | "target": "es2020", 5 | "lib": ["es2020", "dom"], 6 | "outDir": "out", 7 | "rootDir": "src", 8 | "sourceMap": true, 9 | "composite": true, 10 | "skipLibCheck": true, 11 | "esModuleInterop": true 12 | }, 13 | "include": ["src"], 14 | "exclude": ["node_modules", ".vscode-test", "../../node_modules/*"] 15 | } 16 | -------------------------------------------------------------------------------- /.cursor/rules/app-rules/server-agent.mdc: -------------------------------------------------------------------------------- 1 | # Server Application Rules (server) 2 | 3 | ## Critical Rules 4 | 5 | * (TODO: Add rules specific to the server application, e.g., API endpoint conventions, error handling, authentication/authorization, database query patterns) 6 | 7 | ## Examples 8 | 9 | 10 | // (TODO: Add a valid example of applying a rule) 11 | 12 | 13 | 14 | // (TODO: Add an invalid example) 15 | -------------------------------------------------------------------------------- /apps/landing-page/components/mdx-components.tsx: -------------------------------------------------------------------------------- 1 | import defaultMdxComponents from "fumadocs-ui/mdx"; 2 | import { TypeTable } from "fumadocs-ui/components/type-table"; 3 | import type { MDXComponents } from "mdx/types"; 4 | import { Mermaid } from "./mdx/mermaid"; 5 | export function getMDXComponents(components?: MDXComponents): MDXComponents { 6 | return { 7 | ...defaultMdxComponents, 8 | Mermaid, 9 | TypeTable, 10 | ...components, 11 | }; 12 | } 13 | -------------------------------------------------------------------------------- /docs/examples/simple-chat.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | title: Simple Chat Agent 3 | description: A basic chat agent that responds to user input 4 | --- 5 | 6 | # Simple Chat Agent 7 | 8 | A basic chat agent that responds to user input: 9 | 10 | ```mdx 11 | --- 12 | model: account/fireworks/model/deepseek-v3 13 | --- 14 | 15 | You are a friendly and helpful assistant. 16 | 17 | 18 | 19 | {({userInput}) => userInput.message} 20 | 21 | 22 | -------------------------------------------------------------------------------- /packages/runtime/src/elements/states/FinalElement.ts: -------------------------------------------------------------------------------- 1 | import { z } from "zod"; 2 | import { finalConfig } from "@aiml/shared"; 3 | import { createElementDefinition } from "../createElementFactory"; 4 | 5 | const finalSchema = z.object({ 6 | id: z.string().optional(), 7 | }); 8 | 9 | export const Final = createElementDefinition({ 10 | ...finalConfig, 11 | onExecutionGraphConstruction(buildContext) { 12 | buildContext.graphBuilder.then(); 13 | }, 14 | }); 15 | -------------------------------------------------------------------------------- /apps/aiml-ui/src/app/agents/[agentId]/layout.tsx: -------------------------------------------------------------------------------- 1 | 'use client'; 2 | 3 | import * as React from 'react'; 4 | 5 | import { AgentLayout } from '@/domains/agents/agent-layout'; 6 | 7 | export default function Layout({ 8 | children, 9 | params, 10 | }: { 11 | children: React.ReactNode; 12 | params: Promise<{ agentId: string }>; 13 | }) { 14 | const resolvedParams = React.use(params); 15 | return {children}; 16 | } 17 | -------------------------------------------------------------------------------- /packages/vscode/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "exclude": ["out", "./node_modules", "../../node_modules/*", ".vscode-test"], 3 | "compilerOptions": { 4 | "module": "commonjs", 5 | "target": "es2020", 6 | "lib": ["es2020", "dom"], 7 | "noEmit": true, 8 | "rootDir": "src", 9 | "skipLibCheck": true, 10 | "outDir": "out", 11 | "esModuleInterop": true 12 | }, 13 | "include": ["src"], 14 | "references": [{ "path": "./client" }, { "path": "./server" }] 15 | } 16 | -------------------------------------------------------------------------------- /apps/landing-page/app/docs-og/[...slug]/route.ts: -------------------------------------------------------------------------------- 1 | import { generateOGImage } from "fumadocs-ui/og"; 2 | import { metadataImage } from "@/lib/metadata"; 3 | 4 | export const GET = metadataImage.createAPI((page) => { 5 | return generateOGImage({ 6 | title: page.data.title, 7 | description: page.data.description, 8 | site: "AIML - Agentic Prompting Docs", 9 | }); 10 | }); 11 | 12 | export function generateStaticParams() { 13 | return metadataImage.generateParams(); 14 | } 15 | -------------------------------------------------------------------------------- /apps/server/e2e/__fixtures__/ea9945bfd32bfac420d5b8795def2487.json: -------------------------------------------------------------------------------- 1 | {"timestamp":1746809101600,"data":[{"type":"response-metadata","id":"fd57c677-25c7-4046-b0da-1cfec03f8759","modelId":"accounts/fireworks/models/llama-v3p1-70b-instruct","timestamp":"2025-05-09T16:45:02.000Z"},{"type":"text-delta","textDelta":"What do"},{"type":"text-delta","textDelta":" you need assistance with?"},{"type":"finish","finishReason":"stop","usage":{"promptTokens":22,"completionTokens":8},"providerMetadata":{"openai":{}}}]} -------------------------------------------------------------------------------- /apps/aiml-ui/src/app/agents/[agentId]/evals/page.tsx: -------------------------------------------------------------------------------- 1 | 'use client'; 2 | 3 | import * as React from 'react'; 4 | 5 | import { AgentEvals } from '@/domains/agents/agent-evals'; 6 | 7 | export default function AgentEvalsPage({ 8 | params, 9 | }: { 10 | params: Promise<{ agentId: string }>; 11 | }) { 12 | const resolvedParams = React.use(params); 13 | return ( 14 |
15 | 16 |
17 | ); 18 | } 19 | -------------------------------------------------------------------------------- /apps/aiml-ui/src/app/api/tools/[toolId]/route.ts: -------------------------------------------------------------------------------- 1 | import { NextResponse } from 'next/server'; 2 | 3 | export async function GET(request: Request, { params }: { params: Promise<{ toolId: string }> }) { 4 | const resolvedParams = await params; 5 | // Mock data for now - replace with actual API call 6 | return NextResponse.json({ 7 | id: resolvedParams.toolId, 8 | name: 'Test Tool', 9 | description: 'A test tool', 10 | type: 'default', 11 | config: {}, 12 | }); 13 | } 14 | -------------------------------------------------------------------------------- /packages/shared/src/utils/set.ts: -------------------------------------------------------------------------------- 1 | export class ObjectSet extends Set { 2 | private uniqueField: keyof T; 3 | constructor(items: T[] = [], uniqueField: keyof T) { 4 | super(items); 5 | this.uniqueField = uniqueField; 6 | } 7 | 8 | add(item: T) { 9 | const existingItem = Array.from(this.values()).find( 10 | (i) => i[this.uniqueField] === item[this.uniqueField] 11 | ); 12 | if (existingItem) { 13 | return this; 14 | } 15 | return super.add(item); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /packages/vscode/server/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es2020", 4 | "lib": ["es2020", "dom"], 5 | "module": "commonjs", 6 | "moduleResolution": "node", 7 | "sourceMap": true, 8 | "strict": true, 9 | "outDir": "out", 10 | "rootDir": "src", 11 | "composite": true, 12 | "skipLibCheck": true, 13 | "esModuleInterop": true 14 | }, 15 | "include": ["src"], 16 | "exclude": ["node_modules", ".vscode-test", "../../node_modules/*"] 17 | } 18 | -------------------------------------------------------------------------------- /packages/vscode/tsconfig.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "properties": { 3 | "aiml": { 4 | "title": "AIML language server options", 5 | "properties": { 6 | "checkAiml": { 7 | "type": "boolean", 8 | "default": false, 9 | "markdownDescription": "Enable error reporting in type-checked AIML files." 10 | }, 11 | "plugins": { 12 | "$ref": "https://json.schemastore.org/remarkrc.json#/properties/plugins" 13 | } 14 | } 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /apps/aiml-ui/vite.config.ts: -------------------------------------------------------------------------------- 1 | import path from 'path'; 2 | import react from '@vitejs/plugin-react'; 3 | import { defineConfig } from 'vite'; 4 | 5 | export default defineConfig({ 6 | plugins: [react()], 7 | resolve: { 8 | alias: { 9 | '@': path.resolve(__dirname, './src'), 10 | }, 11 | }, 12 | optimizeDeps: { 13 | include: ['@tailwind-config'], 14 | }, 15 | build: { 16 | cssCodeSplit: false, 17 | }, 18 | server: { 19 | fs: { 20 | allow: ['..'], 21 | }, 22 | }, 23 | }); 24 | -------------------------------------------------------------------------------- /docs/meta.json: -------------------------------------------------------------------------------- 1 | { 2 | "title": "AIML", 3 | "description": "The agentic runtime language", 4 | "icon": "Building2", 5 | "root": true, 6 | "pages": [ 7 | "---Introduction---", 8 | "index", 9 | "getting-started", 10 | "using-with-fireworks", 11 | "aiml-syntax", 12 | "debugging-and-observability", 13 | "editor-plugins", 14 | "---Intgrations & MCP---", 15 | "...mcp", 16 | "---Elements---", 17 | "...elements", 18 | "---Examples---", 19 | "...examples" 20 | ] 21 | } 22 | -------------------------------------------------------------------------------- /apps/aiml-ui/src/app/api/agents/[agentId]/route.ts: -------------------------------------------------------------------------------- 1 | import { NextResponse } from 'next/server'; 2 | 3 | export async function GET(request: Request, { params }: { params: Promise<{ agentId: string }> }) { 4 | const resolvedParams = await params; 5 | // Mock data for now - replace with actual API call 6 | return NextResponse.json({ 7 | id: resolvedParams.agentId, 8 | name: 'Test Agent', 9 | description: 'A test agent', 10 | tools: {}, 11 | provider: 'openai', 12 | modelId: 'gpt-4', 13 | }); 14 | } 15 | -------------------------------------------------------------------------------- /apps/aiml-ui/src/components/ui/syntax-highlighter.ts: -------------------------------------------------------------------------------- 1 | export async function highlight(code: string, language: string) { 2 | const { codeToTokens, bundledLanguages } = await import('shiki'); 3 | 4 | if (!(language in bundledLanguages)) return null; 5 | 6 | const { tokens } = await codeToTokens(code, { 7 | lang: language as keyof typeof bundledLanguages, 8 | defaultColor: false, 9 | themes: { 10 | light: 'github-light', 11 | dark: 'github-dark', 12 | }, 13 | }); 14 | 15 | return tokens; 16 | } 17 | -------------------------------------------------------------------------------- /.changeset/README.md: -------------------------------------------------------------------------------- 1 | # Changesets 2 | 3 | Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works 4 | with multi-package repos, or single-package repos to help you version and publish your code. You can 5 | find the full documentation for it [in our repository](https://github.com/changesets/changesets) 6 | 7 | We have a quick list of common questions to get you started engaging with this project in 8 | [our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md) 9 | -------------------------------------------------------------------------------- /apps/aiml-ui/src/components/dynamic-form/fields/index.ts: -------------------------------------------------------------------------------- 1 | export { ArrayField } from './array-field'; 2 | export { BooleanField } from './boolean-field'; 3 | export { CreatableField } from './creatable-field'; 4 | export { DateField } from './date-field'; 5 | export { EnumField } from './enum-field'; 6 | export { StringField } from './string-field'; 7 | export { UnionField } from './union-field'; 8 | export { ObjectField } from './object-field'; 9 | export { NumberField } from './number-field'; 10 | export { RecordField } from './record-field'; 11 | -------------------------------------------------------------------------------- /apps/aiml-ui/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/index.css", 9 | "baseColor": "slate", 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 | -------------------------------------------------------------------------------- /apps/landing-page/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": "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 | } -------------------------------------------------------------------------------- /apps/server/e2e/__fixtures__/6400f52a21e3388d7cd03532b6e7ec3b.json: -------------------------------------------------------------------------------- 1 | {"timestamp":1746809103312,"data":[{"type":"response-metadata","id":"b1842f56-347e-486b-985d-dab020016cb9","modelId":"accounts/fireworks/models/llama-v3p1-8b-instruct","timestamp":"2025-05-09T16:45:03.000Z"},{"type":"text-delta","textDelta":"I'd"},{"type":"text-delta","textDelta":" be happy to help you with whatever you need. What's on your"},{"type":"text-delta","textDelta":" mind?"},{"type":"finish","finishReason":"stop","usage":{"promptTokens":61,"completionTokens":19},"providerMetadata":{"openai":{}}}]} -------------------------------------------------------------------------------- /docs/elements/index.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | title: Elements Reference 3 | description: Complete reference guide for all AIML elements 4 | --- 5 | 6 | # Elements Reference 7 | 8 | AIML provides a comprehensive set of elements for building AI-powered workflows. These elements are organized into categories based on their functionality. 9 | 10 | 11 | ## Next Steps 12 | 13 | - Explore [Advanced Features](./advanced/index) 14 | - See [Examples](../examples/index) 15 | - Learn about [State Management](./state-management) 16 | - Review [Best Practices](./best-practices) 17 | -------------------------------------------------------------------------------- /packages/runtime/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "@aiml/tsconfig/base.json", 3 | "exclude": ["node_modules", "dist", "**/*.test.ts", "**/*.test.tsx", "**/*.d.ts"], 4 | "include": ["src/**/*.ts", "src/**/*.tsx", "src/**/*.mts", "src/**/*.mtsx", "src/**/*.json"], 5 | "compilerOptions": { 6 | "outDir": "./dist", 7 | "rootDir": "./src", 8 | "declaration": true, 9 | "declarationMap": true, 10 | "emitDeclarationOnly": false, 11 | "skipLibCheck": true, 12 | "moduleResolution": "bundler", 13 | "module": "esnext" 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /packages/shared/src/types/diagnostics.ts: -------------------------------------------------------------------------------- 1 | // Define diagnostics types 2 | export enum DiagnosticSeverity { 3 | Error = 'error', 4 | Warning = 'warning', 5 | Information = 'information', 6 | Hint = 'hint', 7 | } 8 | 9 | export interface DiagnosticPosition { 10 | line: number; 11 | column: number; 12 | } 13 | 14 | export interface Diagnostic { 15 | message: string; 16 | severity: DiagnosticSeverity; 17 | code?: string; 18 | source?: string; 19 | range: { 20 | start: DiagnosticPosition; 21 | end: DiagnosticPosition; 22 | }; 23 | } 24 | -------------------------------------------------------------------------------- /apps/server/src/utils/url.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Take a URL with potentially extra slashes, or trailing slashes and remove them as they can break CF fetch calls 3 | * e.g. https://api.fireworks.ai/v1//completions/ -> https://api.fireworks.ai/v1/completions 4 | * 5 | * @param url 6 | */ 7 | export function getNormalizedURLPath(url: string, options?: { apiBaseUrl?: string }): string { 8 | const reqUrl = new URL(url); 9 | 10 | reqUrl.pathname = reqUrl.pathname.replace(/\/+$/, ''); 11 | return `${options?.apiBaseUrl || reqUrl.origin}${reqUrl.pathname}${reqUrl.search}`; 12 | } 13 | -------------------------------------------------------------------------------- /apps/aiml-ui/src/app/api/workflows/[workflowId]/execute/route.ts: -------------------------------------------------------------------------------- 1 | import { NextResponse } from 'next/server'; 2 | 3 | export async function POST(request: Request, { params }: { params: Promise<{ workflowId: string }> }) { 4 | const resolvedParams = await params; 5 | const input = await request.json(); 6 | 7 | // Mock data for now - replace with actual API call 8 | return NextResponse.json({ 9 | id: resolvedParams.workflowId, 10 | status: 'completed', 11 | result: { 12 | output: 'Workflow executed successfully', 13 | input, 14 | }, 15 | }); 16 | } 17 | -------------------------------------------------------------------------------- /apps/server/e2e/__fixtures__/024fa5038122d0e62ef465fbeee98270.json: -------------------------------------------------------------------------------- 1 | {"timestamp":1746809107513,"data":[{"type":"response-metadata","id":"8fed916f-206f-475e-b593-99ab6f78d210","modelId":"accounts/fireworks/models/llama-v3p1-8b-instruct","timestamp":"2025-05-09T16:45:07.000Z"},{"type":"text-delta","textDelta":"It looks"},{"type":"text-delta","textDelta":" like you just entered a single letter \"H\". Is there something else I can help"},{"type":"text-delta","textDelta":" you with?"},{"type":"finish","finishReason":"stop","usage":{"promptTokens":55,"completionTokens":23},"providerMetadata":{"openai":{}}}]} -------------------------------------------------------------------------------- /apps/landing-page/public/placeholder-logo.png: -------------------------------------------------------------------------------- 1 | �PNG 2 |  3 | IHDR�M��0PLTEZ? tRNS� �@��`P0p���w �IDATx��ؽJ3Q�7'��%�|?� ���E�l�7���(X�D������w`����[�*t����D���mD�}��4; ;�DDDDDDDDDDDD_�_İ��!�y�`�_�:�� ;Ļ�'|� ��;.I"����3*5����J�1�� �T��FI�� ��=��3܃�2~�b���0��U9\��]�4�#w0��Gt\&1 �?21,���o!e�m��ĻR�����5�� ؽAJ�9��R)�5�0.FFASaǃ�T�#|�K���I�������1� 4 | M������N"��$����G�V�T� ��T^^��A�$S��h(�������G]co"J׸^^�'�=���%� �W�6Ы�W��w�a�߇*�^^�YG�c���`'F����������������^5_�,�S�%IEND�B`� -------------------------------------------------------------------------------- /packages/tsconfig/library.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json.schemastore.org/tsconfig", 3 | "display": "Library", 4 | "extends": "./base.json", 5 | "compilerOptions": { 6 | "lib": ["DOM", "DOM.Iterable", "ESNext"], 7 | "module": "Node16", 8 | "moduleResolution": "nodenext", 9 | "target": "ESNext", 10 | "jsx": "preserve", 11 | "noFallthroughCasesInSwitch": false, 12 | "noUncheckedIndexedAccess": false, 13 | "noImplicitReturns": false, 14 | "noImplicitOverride": false, 15 | "noUnusedLocals": false, 16 | "noUnusedParameters": false 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /apps/server/src/middleware/logging.ts: -------------------------------------------------------------------------------- 1 | import { createMiddleware } from "hono/factory"; 2 | import type { ContextEnv } from "@/lib/env"; 3 | 4 | export const requestLoggingMiddleware = createMiddleware( 5 | async (context, next) => { 6 | // TODO implement request logging 7 | 8 | // catch errors downstream to ensure we log the --inference-request-log-- 9 | const ctx = await next().catch((err) => err); 10 | 11 | // re-throw the error if there is one now that we've logged the request log 12 | if (ctx instanceof Error) { 13 | throw ctx; 14 | } 15 | } 16 | ); 17 | -------------------------------------------------------------------------------- /packages/runtime/src/elements/control-flow/ForEachElement.ts: -------------------------------------------------------------------------------- 1 | import { foreachConfig } from "@aiml/shared"; 2 | import { createElementDefinition } from "../createElementFactory"; 3 | 4 | export const ForEach = createElementDefinition({ 5 | ...foreachConfig, 6 | onExecutionGraphConstruction: (buildContext) => { 7 | return { 8 | id: buildContext.attributes.id, 9 | key: buildContext.elementKey, 10 | type: "action", 11 | tag: "foreach", 12 | scope: buildContext.scope, 13 | attributes: buildContext.attributes, 14 | next: [], 15 | }; 16 | }, 17 | }); 18 | -------------------------------------------------------------------------------- /packages/runtime/src/elements/control-flow/IfElement.ts: -------------------------------------------------------------------------------- 1 | import { ifConfig } from "@aiml/shared"; 2 | import { createElementDefinition } from "../createElementFactory"; 3 | 4 | export const If = createElementDefinition({ 5 | ...ifConfig, 6 | onExecutionGraphConstruction(buildContext) { 7 | buildContext.graphBuilder.if(buildContext.attributes.condition); 8 | buildContext.children.forEach((child) => { 9 | child.onExecutionGraphConstruction( 10 | buildContext.createNewContextForChild(child) 11 | ); 12 | }); 13 | buildContext.graphBuilder.endIf(); 14 | }, 15 | }); 16 | -------------------------------------------------------------------------------- /packages/vscode/server/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "aiml-lsp-server", 3 | "description": "AIML Language Server Protocol Server", 4 | "version": "1.0.0", 5 | "author": "Fireworks AI", 6 | "license": "MIT", 7 | "engines": { 8 | "node": "*" 9 | }, 10 | "repository": { 11 | "type": "git", 12 | "url": "https://github.com/fw-ai-external/aiml" 13 | }, 14 | "dependencies": { 15 | "@aiml/parser": "workspace:*", 16 | "@aiml/shared": "workspace:*", 17 | "vscode-languageserver": "^9.0.1", 18 | "vscode-languageserver-textdocument": "^1.0.11" 19 | }, 20 | "scripts": {} 21 | } 22 | -------------------------------------------------------------------------------- /apps/aiml-ui/src/components/ui/typing-indicator.tsx: -------------------------------------------------------------------------------- 1 | import { Dot } from 'lucide-react'; 2 | 3 | export function TypingIndicator() { 4 | return ( 5 |
6 |
7 |
8 | 9 | 10 | 11 |
12 |
13 |
14 | ); 15 | } 16 | -------------------------------------------------------------------------------- /packages/tsconfig/tsconfig_main_instructions.txt: -------------------------------------------------------------------------------- 1 | ---KEY_DEFINITIONS_START--- 2 | Key Definitions: 3 | 1A: packages/tsconfig 4 | 1A1: packages/tsconfig/base.json 5 | 1A2: packages/tsconfig/library.json 6 | 1A3: packages/tsconfig/node.json 7 | 1A4: packages/tsconfig/package.json 8 | 1A5: packages/tsconfig/react.json 9 | 1A6: packages/tsconfig/tsup.config.base.ts 10 | ---KEY_DEFINITIONS_END--- 11 | last_KEY_edit: 1A6 12 | last_GRID_edit: 13 | ---GRID_START--- 14 | X 1A 1A1 1A2 1A3 1A4 1A5 1A6 15 | 1A = op6 16 | 1A1 = pop5 17 | 1A2 = ppop4 18 | 1A3 = p3op3 19 | 1A4 = p4opp 20 | 1A5 = p5op 21 | 1A6 = p6o 22 | ---GRID_END--- 23 | -------------------------------------------------------------------------------- /packages/vscode/client/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "lsp-sample-client", 3 | "description": "VSCode part of a language server", 4 | "author": "Microsoft Corporation", 5 | "license": "MIT", 6 | "version": "0.0.1", 7 | "publisher": "vscode", 8 | "repository": { 9 | "type": "git", 10 | "url": "https://github.com/Microsoft/vscode-extension-samples" 11 | }, 12 | "engines": { 13 | "vscode": "^1.75.0" 14 | }, 15 | "dependencies": { 16 | "glob": "^11.0.0", 17 | "vscode-languageclient": "^9.0.1" 18 | }, 19 | "devDependencies": { 20 | "@types/vscode": "^1.75.1", 21 | "@vscode/test-electron": "^2.3.9" 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /apps/aiml-ui/src/app/api/workflows/route.ts: -------------------------------------------------------------------------------- 1 | import { NextResponse } from 'next/server'; 2 | 3 | export async function GET() { 4 | // Mock data for now - replace with actual API call 5 | return NextResponse.json({ 6 | workflow1: { 7 | id: 'workflow1', 8 | name: 'Test Workflow', 9 | description: 'A test workflow', 10 | stepGraph: { 11 | initial: [ 12 | { 13 | step: { 14 | id: 'step1', 15 | description: 'First step', 16 | }, 17 | }, 18 | ], 19 | }, 20 | stepSubscriberGraph: {}, 21 | }, 22 | }); 23 | } 24 | -------------------------------------------------------------------------------- /packages/runtime/src/elements/context/DataElement.ts: -------------------------------------------------------------------------------- 1 | import { createElementDefinition } from "../createElementFactory"; 2 | 3 | import { 4 | type DataElementMetadata as ImportedDataElementMetadata, 5 | type JSONSchema as ImportedJSONSchema, 6 | ValueType, 7 | dataConfig, 8 | } from "@aiml/shared"; 9 | 10 | // Re-export for backward compatibility 11 | export { ValueType }; 12 | export type DataElementMetadata = ImportedDataElementMetadata; 13 | export type JSONSchema = ImportedJSONSchema; 14 | 15 | export const Data = createElementDefinition({ 16 | ...dataConfig, 17 | onExecutionGraphConstruction: (ctx) => {}, 18 | }); 19 | -------------------------------------------------------------------------------- /apps/aiml-ui/src/app/api/workflows/[workflowId]/resume/route.ts: -------------------------------------------------------------------------------- 1 | import { NextResponse } from 'next/server'; 2 | 3 | export async function POST(request: Request, { params }: { params: Promise<{ workflowId: string }> }) { 4 | const resolvedParams = await params; 5 | const { stepId, runId, context } = await request.json(); 6 | 7 | // Mock data for now - replace with actual API call 8 | return NextResponse.json({ 9 | id: resolvedParams.workflowId, 10 | status: 'resumed', 11 | result: { 12 | stepId, 13 | runId, 14 | context, 15 | output: 'Workflow resumed successfully', 16 | }, 17 | }); 18 | } 19 | -------------------------------------------------------------------------------- /apps/server/e2e/__fixtures__/4f53ffee508f4d258fef94eaadfdacde.json: -------------------------------------------------------------------------------- 1 | {"timestamp":1746809103645,"data":[{"type":"response-metadata","id":"37f22477-8a53-4a20-a99c-bea1966b35f2","modelId":"accounts/fireworks/models/llama-v3p1-8b-instruct","timestamp":"2025-05-09T16:45:03.000Z"},{"type":"text-delta","textDelta":"I'd"},{"type":"text-delta","textDelta":" be happy to help you with whatever you need. What's on"},{"type":"text-delta","textDelta":" your mind? Do you have a question or a task you'd"},{"type":"text-delta","textDelta":" like some assistance with?"},{"type":"finish","finishReason":"stop","usage":{"promptTokens":63,"completionTokens":34},"providerMetadata":{"openai":{}}}]} -------------------------------------------------------------------------------- /apps/server/e2e/__fixtures__/02f1c40a91dcdb4c30d6bd7c4b8225a5.json: -------------------------------------------------------------------------------- 1 | {"timestamp":1746809107826,"data":[{"type":"response-metadata","id":"9bbc2ffb-e851-4b29-b227-2294a6bd2986","modelId":"accounts/fireworks/models/llama-v3p1-8b-instruct","timestamp":"2025-05-09T16:45:08.000Z"},{"type":"text-delta","textDelta":"I'm"},{"type":"text-delta","textDelta":" not sure what to make of that! Can you give"},{"type":"text-delta","textDelta":" me a bit more information? Do you have a favorite team or player in"},{"type":"text-delta","textDelta":" either football or basketball?"},{"type":"finish","finishReason":"stop","usage":{"promptTokens":57,"completionTokens":34},"providerMetadata":{"openai":{}}}]} -------------------------------------------------------------------------------- /apps/landing-page/hooks/use-mobile.tsx: -------------------------------------------------------------------------------- 1 | import * as React from "react" 2 | 3 | const MOBILE_BREAKPOINT = 768 4 | 5 | export function useIsMobile() { 6 | const [isMobile, setIsMobile] = React.useState(undefined) 7 | 8 | React.useEffect(() => { 9 | const mql = window.matchMedia(`(max-width: ${MOBILE_BREAKPOINT - 1}px)`) 10 | const onChange = () => { 11 | setIsMobile(window.innerWidth < MOBILE_BREAKPOINT) 12 | } 13 | mql.addEventListener("change", onChange) 14 | setIsMobile(window.innerWidth < MOBILE_BREAKPOINT) 15 | return () => mql.removeEventListener("change", onChange) 16 | }, []) 17 | 18 | return !!isMobile 19 | } 20 | -------------------------------------------------------------------------------- /apps/server/e2e/__fixtures__/66f386860154a80d785d36500420ab6a.json: -------------------------------------------------------------------------------- 1 | {"timestamp":1746809105746,"data":[{"type":"response-metadata","id":"954aea4f-2409-48a6-b621-1c13190cbd6b","modelId":"accounts/fireworks/models/llama-v3p1-70b-instruct","timestamp":"2025-05-09T16:45:06.000Z"},{"type":"text-delta","textDelta":"It seems"},{"type":"text-delta","textDelta":" I made a mistake! I didn't enter anything"},{"type":"text-delta","textDelta":", actually. This conversation just"},{"type":"text-delta","textDelta":" started, and I'm ready to chat with you. How can I assist you today?"},{"type":"finish","finishReason":"stop","usage":{"promptTokens":58,"completionTokens":37},"providerMetadata":{"openai":{}}}]} -------------------------------------------------------------------------------- /apps/landing-page/components/ui/use-mobile.tsx: -------------------------------------------------------------------------------- 1 | import * as React from "react" 2 | 3 | const MOBILE_BREAKPOINT = 768 4 | 5 | export function useIsMobile() { 6 | const [isMobile, setIsMobile] = React.useState(undefined) 7 | 8 | React.useEffect(() => { 9 | const mql = window.matchMedia(`(max-width: ${MOBILE_BREAKPOINT - 1}px)`) 10 | const onChange = () => { 11 | setIsMobile(window.innerWidth < MOBILE_BREAKPOINT) 12 | } 13 | mql.addEventListener("change", onChange) 14 | setIsMobile(window.innerWidth < MOBILE_BREAKPOINT) 15 | return () => mql.removeEventListener("change", onChange) 16 | }, []) 17 | 18 | return !!isMobile 19 | } 20 | -------------------------------------------------------------------------------- /packages/shared/src/errors.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Base error class for all runtime errors 3 | */ 4 | export class RuntimeError extends Error { 5 | constructor(message: string) { 6 | super(message); 7 | this.name = 'RuntimeError'; 8 | } 9 | } 10 | 11 | /** 12 | * Error thrown during run step execution 13 | */ 14 | export class RunStepError extends RuntimeError { 15 | constructor(message: string) { 16 | super(message); 17 | this.name = 'RunStepError'; 18 | } 19 | } 20 | 21 | /** 22 | * Error thrown for internal errors 23 | */ 24 | export class InternalError extends RuntimeError { 25 | constructor(message: string) { 26 | super(message); 27 | this.name = 'InternalError'; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /apps/aiml-ui/tsconfig.node.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo", 4 | "incremental": true, 5 | "target": "ES2022", 6 | "lib": ["ES2023"], 7 | "module": "ESNext", 8 | "skipLibCheck": true, 9 | /* Bundler mode */ 10 | "moduleResolution": "bundler", 11 | "allowImportingTsExtensions": true, 12 | "isolatedModules": true, 13 | "moduleDetection": "force", 14 | "noEmit": true, 15 | /* Linting */ 16 | "strict": true, 17 | "noUnusedLocals": true, 18 | "noUnusedParameters": true, 19 | "noFallthroughCasesInSwitch": true, 20 | "types": ["vite/client"] 21 | }, 22 | "include": ["vite.config.ts"] 23 | } 24 | -------------------------------------------------------------------------------- /apps/aiml-ui/src/app/workflows/[workflowId]/layout.tsx: -------------------------------------------------------------------------------- 1 | import type * as React from 'react'; 2 | 3 | import { WorkflowHeader } from '@/domains/workflows/workflow-header'; 4 | import { WorkflowProvider } from '@/hooks/use-workflows'; 5 | 6 | export default async function WorkflowLayout({ 7 | children, 8 | params, 9 | }: { 10 | children: React.ReactNode; 11 | params: Promise<{ workflowId: string }>; 12 | }) { 13 | const { workflowId } = await params; 14 | 15 | return ( 16 | 17 |
18 | 19 | 20 | {children} 21 |
22 |
23 | ); 24 | } 25 | -------------------------------------------------------------------------------- /packages/runtime/src/elements/control-flow/ElseElement.ts: -------------------------------------------------------------------------------- 1 | import { z } from "zod"; 2 | import { elseConfig } from "@aiml/shared"; 3 | import { createElementDefinition } from "../createElementFactory"; 4 | 5 | const elseSchema = z.object({ 6 | id: z.string().optional(), 7 | }); 8 | 9 | type ElseProps = z.infer; 10 | 11 | export const Else = createElementDefinition({ 12 | ...elseConfig, 13 | onExecutionGraphConstruction(buildContext) { 14 | buildContext.graphBuilder.else(); 15 | buildContext.children.forEach((child) => { 16 | child.onExecutionGraphConstruction( 17 | buildContext.createNewContextForChild(child) 18 | ); 19 | }); 20 | buildContext.graphBuilder.endIf(); 21 | }, 22 | }); 23 | -------------------------------------------------------------------------------- /apps/aiml-ui/src/components/ui/header.tsx: -------------------------------------------------------------------------------- 1 | export const Header = ({ 2 | title, 3 | rightElement, 4 | children, 5 | }: { 6 | title: string | React.ReactNode; 7 | rightElement?: React.ReactNode; 8 | children?: React.ReactNode; 9 | }) => { 10 | return ( 11 |
12 |
13 |
14 |

{title}

15 | {children} 16 |
{rightElement}
17 |
18 |
19 |
20 | ); 21 | }; 22 | -------------------------------------------------------------------------------- /packages/parser/.swcrc: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://json.schemastore.org/swcrc", 3 | "jsc": { 4 | "parser": { 5 | "syntax": "typescript", 6 | "dynamicImport": false, 7 | "decorators": false, 8 | "declaration": true, 9 | "declarationMap": true 10 | }, 11 | "transform": { 12 | "react": { 13 | "useBuiltins": true, 14 | "runtime": "automatic" 15 | } 16 | }, 17 | "loose": false, 18 | "externalHelpers": true, 19 | // Requires v1.2.50 or upper and requires target to be es2016 or upper. 20 | "keepClassNames": false, 21 | "target": "es2022", 22 | "paths": { 23 | "~/*": ["./src/*"] 24 | }, 25 | "baseUrl": "./" 26 | }, 27 | "minify": false 28 | } 29 | -------------------------------------------------------------------------------- /apps/landing-page/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "lib": ["dom", "dom.iterable", "esnext"], 4 | "allowJs": true, 5 | "target": "ES6", 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 | "@/*": ["./*"] 23 | } 24 | }, 25 | "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"], 26 | "exclude": ["node_modules", ".sources", ".next"] 27 | } 28 | -------------------------------------------------------------------------------- /packages/parser/src/validateConfig.test.ts: -------------------------------------------------------------------------------- 1 | import { describe, expect, it } from "bun:test"; 2 | import type { SerializedBaseElement } from "@aiml/shared"; 3 | import { validateConfig } from "./validateConfig"; 4 | 5 | describe("validateConfig", () => { 6 | it("should validate the config", () => { 7 | const config: SerializedBaseElement = { 8 | type: "element", 9 | key: "parent" as any, 10 | tag: "scxml", 11 | role: "state", 12 | attributes: {}, 13 | children: [], 14 | lineStart: 0, 15 | lineEnd: 0, 16 | columnStart: 0, 17 | columnEnd: 0, 18 | }; 19 | expect(validateConfig(config as any)).toEqual({ 20 | errors: [], 21 | config: config as any, 22 | }); 23 | }); 24 | }); 25 | -------------------------------------------------------------------------------- /apps/server/e2e/__fixtures__/e3aee58cc710028f794f060c060181e5.json: -------------------------------------------------------------------------------- 1 | {"timestamp":1746809105391,"data":[{"type":"response-metadata","id":"a3d9668a-3398-47ca-8643-66f32dd64992","modelId":"accounts/fireworks/models/llama-v3p1-70b-instruct","timestamp":"2025-05-09T16:45:05.000Z"},{"type":"text-delta","textDelta":"It seems"},{"type":"text-delta","textDelta":" like you've entered a single letter \"H\"."},{"type":"text-delta","textDelta":" Could you please provide more context or clarify what"},{"type":"text-delta","textDelta":" you're trying to communicate? I'm"},{"type":"text-delta","textDelta":" here to help with any questions or topics you'd like to discuss!"},{"type":"finish","finishReason":"stop","usage":{"promptTokens":16,"completionTokens":44},"providerMetadata":{"openai":{}}}]} -------------------------------------------------------------------------------- /apps/aiml-ui/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "baseUrl": ".", 4 | "paths": { 5 | "@/*": ["./src/*"] 6 | }, 7 | "target": "ES2017", 8 | "lib": ["dom", "dom.iterable", "esnext"], 9 | "allowJs": true, 10 | "skipLibCheck": true, 11 | "strict": true, 12 | "noEmit": true, 13 | "incremental": true, 14 | "esModuleInterop": true, 15 | "module": "esnext", 16 | "moduleResolution": "bundler", 17 | "resolveJsonModule": true, 18 | "isolatedModules": true, 19 | "jsx": "preserve", 20 | "plugins": [ 21 | { 22 | "name": "next" 23 | } 24 | ] 25 | }, 26 | "include": ["next-env.d.ts", ".next/types/**/*.ts", "**/*.ts", "**/*.tsx"], 27 | "exclude": ["node_modules"] 28 | } 29 | -------------------------------------------------------------------------------- /packages/runtime/src/utils.ts: -------------------------------------------------------------------------------- 1 | import { BaseElement } from "./elements/BaseElement"; 2 | import { BuildContext } from "./graphBuilder/Context"; 3 | 4 | export const defaultStepExecutionGraphMapper = (buildContext: BuildContext) => { 5 | buildContext.graphBuilder.then(); 6 | 7 | buildContext.children.map((child) => { 8 | if (!(child instanceof BaseElement)) { 9 | // console.log("child is not a BaseElement", child); 10 | // TODO: handle as value in parser 11 | return; 12 | } 13 | child.onExecutionGraphConstruction( 14 | new BuildContext( 15 | child, 16 | child.attributes, 17 | buildContext.conditions, 18 | child, 19 | child, 20 | buildContext.graphBuilder 21 | ) 22 | ); 23 | }); 24 | }; 25 | -------------------------------------------------------------------------------- /apps/server/src/lib/route.ts: -------------------------------------------------------------------------------- 1 | import { createRoute, type RouteConfig } from "@hono/zod-openapi"; 2 | import type { Context, HonoRequest } from "hono"; 3 | import type { ContextEnv } from "@/lib/env"; 4 | 5 | export function createRouteconfig< 6 | P extends string, 7 | R extends Omit & { 8 | path: P; 9 | }, 10 | Config extends R & { 11 | handler: ( 12 | c: Context & { 13 | get req(): Context["req"] & 14 | Omit, "json"> & { 15 | json(): Promise; 16 | }; 17 | } 18 | ) => Promise; 19 | }, 20 | >({ handler, ...routeConfig }: Config) { 21 | const route = createRoute(routeConfig); 22 | 23 | return { 24 | ...route, 25 | handler, 26 | }; 27 | } 28 | -------------------------------------------------------------------------------- /packages/runtime/src/elements/actions/RaiseElement.ts: -------------------------------------------------------------------------------- 1 | import { raiseConfig } from "@aiml/shared"; 2 | import { createElementDefinition } from "../createElementFactory"; 3 | 4 | export const Raise = createElementDefinition({ 5 | ...raiseConfig, 6 | 7 | async execute(ctx) { 8 | const { event } = ctx.props; 9 | 10 | if (!event) { 11 | throw new Error("Raise element requires an 'event' attribute"); 12 | } 13 | 14 | try { 15 | // Send the event using the context's sendEvent method 16 | // @ts-expect-error until we fix it lol 17 | ctx.sendEvent(event); 18 | 19 | return { 20 | result: ctx.input, 21 | }; 22 | } catch (error) { 23 | console.error(`Error in raise element (${event}):`, error); 24 | throw error; 25 | } 26 | }, 27 | }); 28 | -------------------------------------------------------------------------------- /apps/aiml-ui/src/domains/agents/agent-layout.tsx: -------------------------------------------------------------------------------- 1 | import { Header } from '@/components/ui/header'; 2 | import { Skeleton } from '@/components/ui/skeleton'; 3 | 4 | import { useAgent } from '@/hooks/use-agents'; 5 | 6 | import { AgentHeader } from './agent-header'; 7 | 8 | export const AgentLayout = ({ 9 | children, 10 | agentId, 11 | }: { 12 | children: React.ReactNode; 13 | agentId: string; 14 | }) => { 15 | const { agent, isLoading: isAgentLoading } = useAgent(agentId); 16 | return ( 17 |
18 | {isAgentLoading ? ( 19 |
} /> 20 | ) : ( 21 | 22 | )} 23 | {children} 24 |
25 | ); 26 | }; 27 | -------------------------------------------------------------------------------- /apps/landing-page/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 |