Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .changeset/extract-base-adapter.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
"@perstack/core": patch
"@perstack/docker": patch
"@perstack/claude-code": patch
"@perstack/cursor": patch
"@perstack/gemini": patch
"@perstack/runtime": patch
---

refactor: extract BaseAdapter from @perstack/core to @perstack/adapter-base

This makes @perstack/core client-safe by removing child_process dependency.
1 change: 1 addition & 0 deletions apps/runtime/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
"@ai-sdk/openai": "^2.0.0",
"@modelcontextprotocol/sdk": "^1.25.1",
"@paralleldrive/cuid2": "^3.0.4",
"@perstack/adapter-base": "workspace:*",
"@perstack/api-client": "workspace:*",
"@perstack/base": "workspace:*",
"@perstack/core": "workspace:*",
Expand Down
3 changes: 2 additions & 1 deletion apps/runtime/src/perstack-adapter.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import type { ChildProcess } from "node:child_process"
import { spawn } from "node:child_process"
import { BaseAdapter } from "@perstack/adapter-base"
import type {
AdapterRunParams,
AdapterRunResult,
Expand All @@ -11,7 +12,7 @@ import type {
RuntimeEvent,
RuntimeExpertConfig,
} from "@perstack/core"
import { BaseAdapter, checkpointSchema, getFilteredEnv } from "@perstack/core"
import { checkpointSchema, getFilteredEnv } from "@perstack/core"
import { findLockfile, loadLockfile } from "./helpers/index.js"
import { run as perstackRun } from "./run.js"

Expand Down
1 change: 0 additions & 1 deletion packages/core/src/adapters/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
export { BaseAdapter, type ExecResult } from "./base-adapter.js"
export {
type CreateCheckpointParams,
createCallToolsEvent,
Expand Down
42 changes: 42 additions & 0 deletions packages/runtimes/adapter-base/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
"private": true,
"version": "0.0.1",
"name": "@perstack/adapter-base",
"description": "Base adapter class for Perstack runtime adapters",
"author": "Wintermute Technologies, Inc.",
"license": "Apache-2.0",
"type": "module",
"exports": {
".": "./src/index.ts"
},
"publishConfig": {
"access": "public",
"exports": {
".": {
"types": "./dist/src/index.d.ts",
"import": "./dist/src/index.js"
}
}
},
"files": [
"dist"
],
"scripts": {
"clean": "rm -rf dist",
"build": "pnpm run clean && tsup --config ../../../tsup.config.ts",
"typecheck": "tsc --noEmit"
},
"dependencies": {
"@perstack/core": "workspace:*"
},
"devDependencies": {
"@tsconfig/node22": "^22.0.5",
"@types/node": "^25.0.3",
"tsup": "^8.5.1",
"typescript": "^5.9.3",
"vitest": "^4.0.16"
},
"engines": {
"node": ">=22.0.0"
}
}
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import type { ChildProcess } from "node:child_process"
import { spawn } from "node:child_process"
import type { Expert } from "../schemas/expert.js"
import type {
AdapterRunParams,
AdapterRunResult,
Expert,
PrerequisiteResult,
RuntimeAdapter,
RuntimeExpertConfig,
} from "./types.js"
} from "@perstack/core"

export type ExecResult = {
stdout: string
Expand Down
1 change: 1 addition & 0 deletions packages/runtimes/adapter-base/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { BaseAdapter, type ExecResult } from "./base-adapter.js"
20 changes: 20 additions & 0 deletions packages/runtimes/adapter-base/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"extends": "@tsconfig/node22/tsconfig.json",
"compilerOptions": {
"outDir": "./dist",
"rootDir": ".",
"declaration": true,
"declarationMap": true,
"sourceMap": true,
"strict": true,
"esModuleInterop": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true,
"moduleResolution": "bundler",
"module": "ESNext",
"target": "ESNext",
"resolveJsonModule": true
},
"include": ["src/**/*"],
"exclude": ["node_modules", "dist"]
}
1 change: 1 addition & 0 deletions packages/runtimes/claude-code/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
},
"dependencies": {
"@paralleldrive/cuid2": "^3.0.4",
"@perstack/adapter-base": "workspace:*",
"@perstack/core": "workspace:*"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/runtimes/claude-code/src/claude-code-adapter.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import type { ChildProcess } from "node:child_process"
import { spawn } from "node:child_process"
import { createId } from "@paralleldrive/cuid2"
import { BaseAdapter } from "@perstack/adapter-base"
import type {
AdapterRunParams,
AdapterRunResult,
Expand All @@ -13,7 +14,6 @@ import type {
ToolMessage,
} from "@perstack/core"
import {
BaseAdapter,
createCallToolsEvent,
createCompleteRunEvent,
createEmptyUsage,
Expand Down
1 change: 1 addition & 0 deletions packages/runtimes/cursor/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
},
"dependencies": {
"@paralleldrive/cuid2": "^3.0.4",
"@perstack/adapter-base": "workspace:*",
"@perstack/core": "workspace:*"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/runtimes/cursor/src/cursor-adapter.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import type { ChildProcess } from "node:child_process"
import { spawn } from "node:child_process"
import { createId } from "@paralleldrive/cuid2"
import { BaseAdapter } from "@perstack/adapter-base"
import type {
AdapterRunParams,
AdapterRunResult,
Expand All @@ -13,7 +14,6 @@ import type {
ToolMessage,
} from "@perstack/core"
import {
BaseAdapter,
createCallToolsEvent,
createCompleteRunEvent,
createEmptyUsage,
Expand Down
1 change: 1 addition & 0 deletions packages/runtimes/docker/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
"test": "vitest run"
},
"dependencies": {
"@perstack/adapter-base": "workspace:*",
"@perstack/core": "workspace:*",
"smol-toml": "^1.5.2"
},
Expand Down
3 changes: 2 additions & 1 deletion packages/runtimes/docker/src/docker-adapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import type { ChildProcess, SpawnOptions } from "node:child_process"
import * as fs from "node:fs"
import * as os from "node:os"
import * as path from "node:path"
import { BaseAdapter } from "@perstack/adapter-base"
import type {
AdapterRunParams,
AdapterRunResult,
Expand All @@ -13,7 +14,7 @@ import type {
RuntimeEvent,
RuntimeExpertConfig,
} from "@perstack/core"
import { BaseAdapter, createRuntimeEvent } from "@perstack/core"
import { createRuntimeEvent } from "@perstack/core"
import { generateBuildContext } from "./compose-generator.js"
import { extractRequiredEnvVars, resolveEnvValues } from "./env-resolver.js"
import { selectBuildStrategy } from "./lib/build-strategy.js"
Expand Down
3 changes: 2 additions & 1 deletion packages/runtimes/docker/src/lib/build-strategy.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import * as path from "node:path"
import type { ExecResult, RunEvent, RuntimeEvent } from "@perstack/core"
import type { ExecResult } from "@perstack/adapter-base"
import type { RunEvent, RuntimeEvent } from "@perstack/core"
import { createRuntimeEvent } from "@perstack/core"
import { parseBuildOutputLine } from "./output-parser.js"
import type { ProcessFactory } from "./process-factory.js"
Expand Down
3 changes: 2 additions & 1 deletion packages/runtimes/docker/src/lib/test-utils.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import type { ChildProcess, SpawnOptions } from "node:child_process"
import { EventEmitter } from "node:events"
import type { ExecResult, RunEvent, RuntimeEvent } from "@perstack/core"
import type { ExecResult } from "@perstack/adapter-base"
import type { RunEvent, RuntimeEvent } from "@perstack/core"
import { vi } from "vitest"
import { DockerAdapter } from "../docker-adapter.js"
import type { ProcessFactory } from "./process-factory.js"
Expand Down
1 change: 1 addition & 0 deletions packages/runtimes/gemini/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
},
"dependencies": {
"@paralleldrive/cuid2": "^3.0.4",
"@perstack/adapter-base": "workspace:*",
"@perstack/core": "workspace:*"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/runtimes/gemini/src/gemini-adapter.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import type { ChildProcess } from "node:child_process"
import { spawn } from "node:child_process"
import { createId } from "@paralleldrive/cuid2"
import { BaseAdapter } from "@perstack/adapter-base"
import type {
AdapterRunParams,
AdapterRunResult,
Expand All @@ -13,7 +14,6 @@ import type {
ToolMessage,
} from "@perstack/core"
import {
BaseAdapter,
createCallToolsEvent,
createCompleteRunEvent,
createEmptyUsage,
Expand Down
37 changes: 37 additions & 0 deletions pnpm-lock.yaml

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