diff --git a/apps/open-swe/package.json b/apps/open-swe/package.json index 3b11fc45..2e591258 100644 --- a/apps/open-swe/package.json +++ b/apps/open-swe/package.json @@ -28,6 +28,7 @@ "@langchain/langgraph-sdk": "^0.0.78", "@langchain/openai": "^0.5.10", "@octokit/rest": "^22.0.0", + "@open-swe/shared": "workspace:*", "diff": "^8.0.1", "langchain": "^0.3.26", "langsmith": "^0.3.29", diff --git a/apps/open-swe/src/index.ts b/apps/open-swe/src/index.ts index b6039813..6b1d6557 100644 --- a/apps/open-swe/src/index.ts +++ b/apps/open-swe/src/index.ts @@ -1,5 +1,9 @@ import { END, START, StateGraph } from "@langchain/langgraph"; -import { GraphAnnotation, GraphConfiguration, GraphState } from "./types.js"; +import { + GraphAnnotation, + GraphConfiguration, + GraphState, +} from "@open-swe/shared/open-swe/types"; import { initialize, generateAction, diff --git a/apps/open-swe/src/nodes/diagnose-error.ts b/apps/open-swe/src/nodes/diagnose-error.ts index bee2766c..6a723fad 100644 --- a/apps/open-swe/src/nodes/diagnose-error.ts +++ b/apps/open-swe/src/nodes/diagnose-error.ts @@ -3,7 +3,12 @@ import { isToolMessage, ToolMessage, } from "@langchain/core/messages"; -import { GraphConfig, GraphState, GraphUpdate, PlanItem } from "../types.js"; +import { + GraphConfig, + GraphState, + GraphUpdate, + PlanItem, +} from "@open-swe/shared/open-swe/types"; import { formatPlanPromptWithSummaries } from "../utils/plan-prompt.js"; import { getMessageContentString, diff --git a/apps/open-swe/src/nodes/generate-conclusion.ts b/apps/open-swe/src/nodes/generate-conclusion.ts index d45ae9e7..dbd1394f 100644 --- a/apps/open-swe/src/nodes/generate-conclusion.ts +++ b/apps/open-swe/src/nodes/generate-conclusion.ts @@ -1,4 +1,9 @@ -import { GraphConfig, GraphState, GraphUpdate, PlanItem } from "../types.js"; +import { + GraphConfig, + GraphState, + GraphUpdate, + PlanItem, +} from "@open-swe/shared/open-swe/types"; import { loadModel, Task } from "../utils/load-model.js"; import { getMessageContentString, diff --git a/apps/open-swe/src/nodes/generate-message.ts b/apps/open-swe/src/nodes/generate-message.ts index 9fa0e24d..4f7f3afa 100644 --- a/apps/open-swe/src/nodes/generate-message.ts +++ b/apps/open-swe/src/nodes/generate-message.ts @@ -1,4 +1,8 @@ -import { GraphState, GraphConfig, GraphUpdate } from "../types.js"; +import { + GraphState, + GraphConfig, + GraphUpdate, +} from "@open-swe/shared/open-swe/types"; import { loadModel, Task } from "../utils/load-model.js"; import { shellTool, @@ -12,7 +16,7 @@ import { createLogger, LogLevel } from "../utils/logger.js"; import { getCurrentPlanItem } from "../utils/current-task.js"; import { getMessageContentString } from "../utils/message/content.js"; import { getActivePlanItems } from "../utils/task-plan.js"; -import { SANDBOX_ROOT_DIR } from "../constants.js"; +import { SANDBOX_ROOT_DIR } from "@open-swe/shared/constants"; const logger = createLogger(LogLevel.INFO, "GenerateMessageNode"); diff --git a/apps/open-swe/src/nodes/initialize.ts b/apps/open-swe/src/nodes/initialize.ts index aa0da385..aa9e0809 100644 --- a/apps/open-swe/src/nodes/initialize.ts +++ b/apps/open-swe/src/nodes/initialize.ts @@ -1,5 +1,9 @@ import { createLogger, LogLevel } from "../utils/logger.js"; -import { GraphState, GraphConfig, GraphUpdate } from "../types.js"; +import { + GraphState, + GraphConfig, + GraphUpdate, +} from "@open-swe/shared/open-swe/types"; import { checkoutBranch, cloneRepo, @@ -9,7 +13,7 @@ import { pullLatestChanges, } from "../utils/git.js"; import { daytonaClient } from "../utils/sandbox.js"; -import { SNAPSHOT_NAME } from "../constants.js"; +import { SNAPSHOT_NAME } from "@open-swe/shared/constants"; import { getGitHubTokensFromConfig } from "../utils/github-tokens.js"; import { getCodebaseTree } from "../utils/tree.js"; diff --git a/apps/open-swe/src/nodes/interrupt-plan.ts b/apps/open-swe/src/nodes/interrupt-plan.ts index a1192796..44169f3a 100644 --- a/apps/open-swe/src/nodes/interrupt-plan.ts +++ b/apps/open-swe/src/nodes/interrupt-plan.ts @@ -1,5 +1,5 @@ import { Command, END, interrupt } from "@langchain/langgraph"; -import { GraphState, GraphUpdate } from "../types.js"; +import { GraphState, GraphUpdate } from "@open-swe/shared/open-swe/types"; import { ActionRequest, HumanInterrupt, diff --git a/apps/open-swe/src/nodes/open-pr.ts b/apps/open-swe/src/nodes/open-pr.ts index b503e66d..9d02a4bc 100644 --- a/apps/open-swe/src/nodes/open-pr.ts +++ b/apps/open-swe/src/nodes/open-pr.ts @@ -1,4 +1,9 @@ -import { GraphConfig, GraphState, GraphUpdate, PlanItem } from "../types.js"; +import { + GraphConfig, + GraphState, + GraphUpdate, + PlanItem, +} from "@open-swe/shared/open-swe/types"; import { checkoutBranchAndCommit, createPullRequest, diff --git a/apps/open-swe/src/nodes/progress-plan-step.ts b/apps/open-swe/src/nodes/progress-plan-step.ts index fded9edd..5002d139 100644 --- a/apps/open-swe/src/nodes/progress-plan-step.ts +++ b/apps/open-swe/src/nodes/progress-plan-step.ts @@ -1,6 +1,11 @@ import { z } from "zod"; import { createLogger, LogLevel } from "../utils/logger.js"; -import { GraphConfig, GraphState, GraphUpdate, PlanItem } from "../types.js"; +import { + GraphConfig, + GraphState, + GraphUpdate, + PlanItem, +} from "@open-swe/shared/open-swe/types"; import { loadModel, Task } from "../utils/load-model.js"; import { formatPlanPrompt } from "../utils/plan-prompt.js"; import { Command } from "@langchain/langgraph"; diff --git a/apps/open-swe/src/nodes/request-help.ts b/apps/open-swe/src/nodes/request-help.ts index e96e4e77..5c396bd3 100644 --- a/apps/open-swe/src/nodes/request-help.ts +++ b/apps/open-swe/src/nodes/request-help.ts @@ -1,5 +1,5 @@ import { isAIMessage, ToolMessage } from "@langchain/core/messages"; -import { GraphState, GraphUpdate } from "../types.js"; +import { GraphState, GraphUpdate } from "@open-swe/shared/open-swe/types"; import { HumanInterrupt, HumanResponse } from "@langchain/langgraph/prebuilt"; import { END, interrupt, Command } from "@langchain/langgraph"; import { stopSandbox, startSandbox } from "../utils/sandbox.js"; diff --git a/apps/open-swe/src/nodes/rewrite-plan.ts b/apps/open-swe/src/nodes/rewrite-plan.ts index 6aa23b70..f3f70ad1 100644 --- a/apps/open-swe/src/nodes/rewrite-plan.ts +++ b/apps/open-swe/src/nodes/rewrite-plan.ts @@ -1,4 +1,9 @@ -import { GraphState, GraphConfig, GraphUpdate, PlanItem } from "../types.js"; +import { + GraphState, + GraphConfig, + GraphUpdate, + PlanItem, +} from "@open-swe/shared/open-swe/types"; import { loadModel, Task } from "../utils/load-model.js"; import { z } from "zod"; import { tool } from "@langchain/core/tools"; diff --git a/apps/open-swe/src/nodes/summarize-task-steps.ts b/apps/open-swe/src/nodes/summarize-task-steps.ts index 40b6d1c5..d934277d 100644 --- a/apps/open-swe/src/nodes/summarize-task-steps.ts +++ b/apps/open-swe/src/nodes/summarize-task-steps.ts @@ -1,5 +1,10 @@ import { v4 as uuidv4 } from "uuid"; -import { GraphConfig, GraphState, GraphUpdate, PlanItem } from "../types.js"; +import { + GraphConfig, + GraphState, + GraphUpdate, + PlanItem, +} from "@open-swe/shared/open-swe/types"; import { loadModel, Task } from "../utils/load-model.js"; import { AIMessage, BaseMessage } from "@langchain/core/messages"; import { formatPlanPrompt } from "../utils/plan-prompt.js"; diff --git a/apps/open-swe/src/nodes/take-action.ts b/apps/open-swe/src/nodes/take-action.ts index 12f536af..1b63d91f 100644 --- a/apps/open-swe/src/nodes/take-action.ts +++ b/apps/open-swe/src/nodes/take-action.ts @@ -5,7 +5,7 @@ import { } from "@langchain/core/messages"; import { createLogger, LogLevel } from "../utils/logger.js"; import { applyPatchTool, shellTool } from "../tools/index.js"; -import { GraphState, GraphConfig } from "../types.js"; +import { GraphState, GraphConfig } from "@open-swe/shared/open-swe/types"; import { checkoutBranchAndCommit, getChangedFilesStatus, diff --git a/apps/open-swe/src/subgraphs/planner/index.ts b/apps/open-swe/src/subgraphs/planner/index.ts index 324c9df6..d24541f2 100644 --- a/apps/open-swe/src/subgraphs/planner/index.ts +++ b/apps/open-swe/src/subgraphs/planner/index.ts @@ -11,7 +11,10 @@ import { PlannerGraphStateObj, PlannerGraphUpdate, } from "./types.js"; -import { GraphConfig, GraphConfiguration } from "../../types.js"; +import { + GraphConfig, + GraphConfiguration, +} from "@open-swe/shared/open-swe/types"; import { generateAction, generatePlan, diff --git a/apps/open-swe/src/subgraphs/planner/nodes/generate-message.ts b/apps/open-swe/src/subgraphs/planner/nodes/generate-message.ts index 9a76c9a6..1e66ae00 100644 --- a/apps/open-swe/src/subgraphs/planner/nodes/generate-message.ts +++ b/apps/open-swe/src/subgraphs/planner/nodes/generate-message.ts @@ -1,14 +1,14 @@ import { loadModel, Task } from "../../../utils/load-model.js"; import { shellTool } from "../../../tools/index.js"; import { PlannerGraphState, PlannerGraphUpdate } from "../types.js"; -import { GraphConfig } from "../../../types.js"; +import { GraphConfig } from "@open-swe/shared/open-swe/types"; import { createLogger, LogLevel } from "../../../utils/logger.js"; import { getMessageContentString } from "../../../utils/message/content.js"; import { getUserRequest } from "../../../utils/user-request.js"; import { isHumanMessage } from "@langchain/core/messages"; import { formatFollowupMessagePrompt } from "../utils/followup-prompt.js"; import { getRepoAbsolutePath } from "../../../utils/git.js"; -import { SANDBOX_ROOT_DIR } from "../../../constants.js"; +import { SANDBOX_ROOT_DIR } from "@open-swe/shared/constants"; const logger = createLogger(LogLevel.INFO, "GeneratePlanningMessageNode"); diff --git a/apps/open-swe/src/subgraphs/planner/nodes/generate-plan.ts b/apps/open-swe/src/subgraphs/planner/nodes/generate-plan.ts index 8e3372a5..6be84cb5 100644 --- a/apps/open-swe/src/subgraphs/planner/nodes/generate-plan.ts +++ b/apps/open-swe/src/subgraphs/planner/nodes/generate-plan.ts @@ -4,7 +4,7 @@ import { ToolMessage, } from "@langchain/core/messages"; import { sessionPlanTool } from "../../../tools/index.js"; -import { GraphConfig } from "../../../types.js"; +import { GraphConfig } from "@open-swe/shared/open-swe/types"; import { loadModel, Task } from "../../../utils/load-model.js"; import { PlannerGraphState, PlannerGraphUpdate } from "../types.js"; import { getUserRequest } from "../../../utils/user-request.js"; diff --git a/apps/open-swe/src/subgraphs/planner/nodes/summarizer.ts b/apps/open-swe/src/subgraphs/planner/nodes/summarizer.ts index 670f5a61..8a85fb01 100644 --- a/apps/open-swe/src/subgraphs/planner/nodes/summarizer.ts +++ b/apps/open-swe/src/subgraphs/planner/nodes/summarizer.ts @@ -1,5 +1,5 @@ import { z } from "zod"; -import { GraphConfig } from "../../../types.js"; +import { GraphConfig } from "@open-swe/shared/open-swe/types"; import { PlannerGraphState, PlannerGraphUpdate } from "../types.js"; import { loadModel, Task } from "../../../utils/load-model.js"; import { getMessageString } from "../../../utils/message/content.js"; diff --git a/apps/open-swe/src/subgraphs/planner/nodes/take-action.ts b/apps/open-swe/src/subgraphs/planner/nodes/take-action.ts index 2789a7e6..0d2c41f5 100644 --- a/apps/open-swe/src/subgraphs/planner/nodes/take-action.ts +++ b/apps/open-swe/src/subgraphs/planner/nodes/take-action.ts @@ -1,6 +1,6 @@ import { isAIMessage, ToolMessage } from "@langchain/core/messages"; import { shellTool } from "../../../tools/index.js"; -import { GraphConfig } from "../../../types.js"; +import { GraphConfig } from "@open-swe/shared/open-swe/types"; import { PlannerGraphState, PlannerGraphUpdate } from "../types.js"; import { createLogger, LogLevel } from "../../../utils/logger.js"; import { zodSchemaToString } from "../../../utils/zod-to-string.js"; diff --git a/apps/open-swe/src/subgraphs/planner/types.ts b/apps/open-swe/src/subgraphs/planner/types.ts index 6dbcc184..051a4fc6 100644 --- a/apps/open-swe/src/subgraphs/planner/types.ts +++ b/apps/open-swe/src/subgraphs/planner/types.ts @@ -2,7 +2,7 @@ import "@langchain/langgraph/zod"; import { z } from "zod"; import { addMessages, Messages } from "@langchain/langgraph"; import { BaseMessage } from "@langchain/core/messages"; -import { GraphAnnotation } from "../../types.js"; +import { GraphAnnotation } from "@open-swe/shared/open-swe/types"; export const PlannerGraphStateObj = GraphAnnotation.extend({ plannerMessages: z diff --git a/apps/open-swe/src/subgraphs/planner/utils/followup-prompt.ts b/apps/open-swe/src/subgraphs/planner/utils/followup-prompt.ts index 3060f394..afaf5f86 100644 --- a/apps/open-swe/src/subgraphs/planner/utils/followup-prompt.ts +++ b/apps/open-swe/src/subgraphs/planner/utils/followup-prompt.ts @@ -1,4 +1,4 @@ -import { TaskPlan } from "../../../types.js"; +import { TaskPlan } from "@open-swe/shared/open-swe/types"; const followupMessagePrompt = ` The user is sending a followup request for you to generate a plan for. You are provided with the following context to aid in your new plan context gathering steps: diff --git a/apps/open-swe/src/tools/apply-patch.ts b/apps/open-swe/src/tools/apply-patch.ts index fcd85fed..7f4c4acf 100644 --- a/apps/open-swe/src/tools/apply-patch.ts +++ b/apps/open-swe/src/tools/apply-patch.ts @@ -1,13 +1,13 @@ import { tool } from "@langchain/core/tools"; import { z } from "zod"; import { applyPatch } from "diff"; -import { GraphState } from "../types.js"; +import { GraphState } from "@open-swe/shared/open-swe/types"; import { readFile, writeFile } from "../utils/read-write.js"; import { getCurrentTaskInput } from "@langchain/langgraph"; import { fixGitPatch } from "../utils/diff.js"; import { createLogger, LogLevel } from "../utils/logger.js"; import { daytonaClient } from "../utils/sandbox.js"; -import { SANDBOX_ROOT_DIR } from "../constants.js"; +import { SANDBOX_ROOT_DIR } from "@open-swe/shared/constants"; const logger = createLogger(LogLevel.INFO, "ApplyPatchTool"); diff --git a/apps/open-swe/src/tools/shell.ts b/apps/open-swe/src/tools/shell.ts index 55ab93ab..3dcbc41a 100644 --- a/apps/open-swe/src/tools/shell.ts +++ b/apps/open-swe/src/tools/shell.ts @@ -1,12 +1,12 @@ import { tool } from "@langchain/core/tools"; import { z } from "zod"; import { Sandbox } from "@daytonaio/sdk"; -import { GraphState } from "../types.js"; +import { GraphState } from "@open-swe/shared/open-swe/types"; import { getCurrentTaskInput } from "@langchain/langgraph"; import { getSandboxErrorFields } from "../utils/sandbox-error-fields.js"; import { createLogger, LogLevel } from "../utils/logger.js"; import { daytonaClient } from "../utils/sandbox.js"; -import { SANDBOX_ROOT_DIR, TIMEOUT_SEC } from "../constants.js"; +import { SANDBOX_ROOT_DIR, TIMEOUT_SEC } from "@open-swe/shared/constants"; const logger = createLogger(LogLevel.INFO, "ShellTool"); diff --git a/apps/open-swe/src/utils/current-task.ts b/apps/open-swe/src/utils/current-task.ts index 8f6d936a..15e634a7 100644 --- a/apps/open-swe/src/utils/current-task.ts +++ b/apps/open-swe/src/utils/current-task.ts @@ -1,4 +1,4 @@ -import { PlanItem } from "../types.js"; +import { PlanItem } from "@open-swe/shared/open-swe/types"; export function getCurrentPlanItem(plan: PlanItem[]): PlanItem { return ( diff --git a/apps/open-swe/src/utils/git.ts b/apps/open-swe/src/utils/git.ts index 2098f7a1..ac375213 100644 --- a/apps/open-swe/src/utils/git.ts +++ b/apps/open-swe/src/utils/git.ts @@ -1,8 +1,8 @@ import { Octokit } from "@octokit/rest"; import { Sandbox } from "@daytonaio/sdk"; import { createLogger, LogLevel } from "./logger.js"; -import { GraphConfig, TargetRepository } from "../types.js"; -import { TIMEOUT_SEC, SANDBOX_ROOT_DIR } from "../constants.js"; +import { GraphConfig, TargetRepository } from "@open-swe/shared/open-swe/types"; +import { TIMEOUT_SEC, SANDBOX_ROOT_DIR } from "@open-swe/shared/constants"; import { getSandboxErrorFields } from "./sandbox-error-fields.js"; import { ExecuteResponse } from "@daytonaio/sdk/dist/types/ExecuteResponse.js"; diff --git a/apps/open-swe/src/utils/github-tokens.ts b/apps/open-swe/src/utils/github-tokens.ts index d81bb6a2..87a91f4e 100644 --- a/apps/open-swe/src/utils/github-tokens.ts +++ b/apps/open-swe/src/utils/github-tokens.ts @@ -1,4 +1,4 @@ -import { GraphConfig } from "../types.js"; +import { GraphConfig } from "@open-swe/shared/open-swe/types"; export function getGitHubTokensFromConfig(config: GraphConfig): { githubToken: string; diff --git a/apps/open-swe/src/utils/load-model.ts b/apps/open-swe/src/utils/load-model.ts index e71df9f6..163738b1 100644 --- a/apps/open-swe/src/utils/load-model.ts +++ b/apps/open-swe/src/utils/load-model.ts @@ -1,5 +1,5 @@ import { initChatModel } from "langchain/chat_models/universal"; -import { GraphConfig } from "../types.js"; +import { GraphConfig } from "@open-swe/shared/open-swe/types"; export enum Task { PLANNER = "planner", diff --git a/apps/open-swe/src/utils/plan-prompt.ts b/apps/open-swe/src/utils/plan-prompt.ts index a98d09a9..9df45c93 100644 --- a/apps/open-swe/src/utils/plan-prompt.ts +++ b/apps/open-swe/src/utils/plan-prompt.ts @@ -1,4 +1,4 @@ -import { PlanItem } from "../types.js"; +import { PlanItem } from "@open-swe/shared/open-swe/types"; export const PLAN_PROMPT = `## Completed Tasks {COMPLETED_TASKS} diff --git a/apps/open-swe/src/utils/task-plan.ts b/apps/open-swe/src/utils/task-plan.ts index a884c6ff..241792f8 100644 --- a/apps/open-swe/src/utils/task-plan.ts +++ b/apps/open-swe/src/utils/task-plan.ts @@ -1,5 +1,10 @@ import { v4 as uuidv4 } from "uuid"; -import { PlanItem, Task, TaskPlan, PlanRevision } from "../types.js"; +import { + PlanItem, + Task, + TaskPlan, + PlanRevision, +} from "@open-swe/shared/open-swe/types"; /** * Creates a new task with the provided plan items. diff --git a/apps/open-swe/src/utils/tree.ts b/apps/open-swe/src/utils/tree.ts index 10d2390a..3e96fe56 100644 --- a/apps/open-swe/src/utils/tree.ts +++ b/apps/open-swe/src/utils/tree.ts @@ -1,9 +1,9 @@ import { getCurrentTaskInput } from "@langchain/langgraph"; -import { GraphState } from "../types.js"; +import { GraphState } from "@open-swe/shared/open-swe/types"; import { daytonaClient } from "./sandbox.js"; import { createLogger, LogLevel } from "./logger.js"; import path from "node:path"; -import { SANDBOX_ROOT_DIR, TIMEOUT_SEC } from "../constants.js"; +import { SANDBOX_ROOT_DIR, TIMEOUT_SEC } from "@open-swe/shared/constants"; const logger = createLogger(LogLevel.INFO, "Tree"); diff --git a/package.json b/package.json index bdfc4c16..50dc9752 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,8 @@ "author": "LangChain", "private": true, "workspaces": [ - "apps/*" + "apps/*", + "packages/*" ], "scripts": { "dev": "turbo dev", diff --git a/packages/shared/.codespellignore b/packages/shared/.codespellignore new file mode 100644 index 00000000..e69de29b diff --git a/packages/shared/.dockerignore b/packages/shared/.dockerignore new file mode 100644 index 00000000..d97359f1 --- /dev/null +++ b/packages/shared/.dockerignore @@ -0,0 +1,4 @@ +node_modules +.next +.git +.env \ No newline at end of file diff --git a/packages/shared/.gitignore b/packages/shared/.gitignore new file mode 100644 index 00000000..494dcfd9 --- /dev/null +++ b/packages/shared/.gitignore @@ -0,0 +1,28 @@ +# Logs +logs +*.log +npm-debug.log* +yarn-debug.log* +yarn-error.log* +pnpm-debug.log* +lerna-debug.log* + +node_modules +dist +dist-ssr +*.local + +# Editor directories and files +.vscode/* +!.vscode/extensions.json +.idea +.DS_Store +*.suo +*.ntvs* +*.njsproj +*.sln +*.sw? + +# LangGraph API +.langgraph_api +.env \ No newline at end of file diff --git a/packages/shared/.prettierrc b/packages/shared/.prettierrc new file mode 100644 index 00000000..222861c3 --- /dev/null +++ b/packages/shared/.prettierrc @@ -0,0 +1,4 @@ +{ + "tabWidth": 2, + "useTabs": false +} diff --git a/packages/shared/eslint.config.js b/packages/shared/eslint.config.js new file mode 100644 index 00000000..28e5f3a3 --- /dev/null +++ b/packages/shared/eslint.config.js @@ -0,0 +1,28 @@ +import js from "@eslint/js"; +import globals from "globals"; +import tseslint from "typescript-eslint"; + +export default tseslint.config( + { ignores: ["dist"] }, + { + extends: [js.configs.recommended, ...tseslint.configs.recommended], + files: ["**/*.{ts,tsx}"], + languageOptions: { + ecmaVersion: 2020, + globals: globals.node, + }, + rules: { + "@typescript-eslint/no-explicit-any": 0, + "@typescript-eslint/no-unused-vars": [ + "error", + { + args: "none", + argsIgnorePattern: "^_", + varsIgnorePattern: "^_", + caughtErrorsIgnorePattern: "^_", + }, + ], + "no-console": ["error"], + }, + }, +); diff --git a/packages/shared/package.json b/packages/shared/package.json new file mode 100644 index 00000000..e2a49272 --- /dev/null +++ b/packages/shared/package.json @@ -0,0 +1,59 @@ +{ + "name": "@open-swe/shared", + "homepage": "https://github.com/langchain-ai/open-swe/blob/main/README.md", + "repository": { + "type": "git", + "url": "https://github.com/langchain-ai/open-swe.git" + }, + "private": true, + "version": "0.0.0", + "type": "module", + "scripts": { + "clean": "rm -rf ./dist .turbo || true", + "build": "yarn clean && tsc", + "lint": "eslint .", + "lint:fix": "eslint . --fix", + "format": "prettier --write .", + "format:check": "prettier --check ." + }, + "dependencies": { + "@langchain/core": "^0.3.56", + "@langchain/langgraph": "^0.2.73", + "zod": "^3.23.8" + }, + "devDependencies": { + "@eslint/eslintrc": "^3.1.0", + "@eslint/js": "^9.19.0", + "@tsconfig/recommended": "^1.0.8", + "@types/node": "^22.13.5", + "dotenv": "^16.4.7", + "eslint": "^9.19.0", + "eslint-config-prettier": "^8.8.0", + "eslint-plugin-import": "^2.27.5", + "eslint-plugin-no-instanceof": "^1.0.1", + "eslint-plugin-prettier": "^4.2.1", + "prettier": "^3.5.2", + "typescript": "~5.7.2", + "typescript-eslint": "^8.22.0" + }, + "packageManager": "yarn@3.5.1", + "main": "dist/index.js", + "module": "dist/index.mjs", + "types": "dist/index.d.ts", + "exports": { + ".": { + "types": "./dist/index.d.ts", + "import": "./dist/index.js", + "require": "./dist/index.js" + }, + "./*": { + "types": "./dist/*.d.ts", + "import": "./dist/*.js", + "require": "./dist/*.js" + }, + "./package.json": "./package.json" + }, + "files": [ + "dist/**/*" + ] +} diff --git a/apps/open-swe/src/constants.ts b/packages/shared/src/constants.ts similarity index 100% rename from apps/open-swe/src/constants.ts rename to packages/shared/src/constants.ts diff --git a/packages/shared/src/index.ts b/packages/shared/src/index.ts new file mode 100644 index 00000000..187292cc --- /dev/null +++ b/packages/shared/src/index.ts @@ -0,0 +1,2 @@ +// no-op file +export {}; diff --git a/apps/open-swe/src/types.ts b/packages/shared/src/open-swe/types.ts similarity index 100% rename from apps/open-swe/src/types.ts rename to packages/shared/src/open-swe/types.ts diff --git a/packages/shared/tsconfig.json b/packages/shared/tsconfig.json new file mode 100644 index 00000000..fa10e748 --- /dev/null +++ b/packages/shared/tsconfig.json @@ -0,0 +1,25 @@ +{ + "extends": "@tsconfig/recommended", + "compilerOptions": { + "target": "ES2021", + "lib": ["ES2023"], + "module": "NodeNext", + "moduleResolution": "nodenext", + "esModuleInterop": true, + "noImplicitReturns": true, + "declaration": true, + "noFallthroughCasesInSwitch": true, + "noUnusedLocals": true, + "noUnusedParameters": true, + "useDefineForClassFields": true, + "strictPropertyInitialization": false, + "allowJs": true, + "strict": true, + "strictFunctionTypes": false, + "outDir": "dist", + "types": ["jest", "node"], + "resolveJsonModule": true + }, + "include": ["src/**/*.ts", "src/*.ts"], + "exclude": ["node_modules", "dist"] +} diff --git a/packages/shared/turbo.json b/packages/shared/turbo.json new file mode 100644 index 00000000..bf79edc4 --- /dev/null +++ b/packages/shared/turbo.json @@ -0,0 +1,11 @@ +{ + "extends": ["//"], + "tasks": { + "build": { + "outputs": ["dist/**"] + }, + "dev": { + "dependsOn": ["^dev"] + } + } +} diff --git a/yarn.lock b/yarn.lock index 3cf230ae..24954631 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1918,6 +1918,7 @@ __metadata: "@langchain/langgraph-sdk": ^0.0.78 "@langchain/openai": ^0.5.10 "@octokit/rest": ^22.0.0 + "@open-swe/shared": "workspace:*" "@tsconfig/recommended": ^1.0.8 "@types/jest": ^29.5.0 "@types/node": ^22.13.5 @@ -1940,6 +1941,29 @@ __metadata: languageName: unknown linkType: soft +"@open-swe/shared@workspace:*, @open-swe/shared@workspace:packages/shared": + version: 0.0.0-use.local + resolution: "@open-swe/shared@workspace:packages/shared" + dependencies: + "@eslint/eslintrc": ^3.1.0 + "@eslint/js": ^9.19.0 + "@langchain/core": ^0.3.56 + "@langchain/langgraph": ^0.2.73 + "@tsconfig/recommended": ^1.0.8 + "@types/node": ^22.13.5 + dotenv: ^16.4.7 + eslint: ^9.19.0 + eslint-config-prettier: ^8.8.0 + eslint-plugin-import: ^2.27.5 + eslint-plugin-no-instanceof: ^1.0.1 + eslint-plugin-prettier: ^4.2.1 + prettier: ^3.5.2 + typescript: ~5.7.2 + typescript-eslint: ^8.22.0 + zod: ^3.23.8 + languageName: unknown + linkType: soft + "@open-swe/web@workspace:apps/web": version: 0.0.0-use.local resolution: "@open-swe/web@workspace:apps/web"