Skip to content
Open
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
10 changes: 10 additions & 0 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ jobs:
- uses: actions/checkout@v6
- name: Install dependencies
uses: ./.github/actions/setup
- name: Build (terminal package)
run: bun run --cwd packages/terminal build
- name: Build (docker-git package)
run: bun run --cwd packages/app build
- name: Build (session sync package)
Expand Down Expand Up @@ -58,6 +60,8 @@ jobs:
- uses: actions/checkout@v6
- name: Install dependencies
uses: ./.github/actions/setup
- name: Typecheck (terminal)
run: bun run --cwd packages/terminal typecheck
- name: Typecheck (app)
run: bun run --cwd packages/app check
- name: Typecheck (session sync)
Expand All @@ -80,6 +84,8 @@ jobs:
- uses: actions/checkout@v6
- name: Install dependencies
uses: ./.github/actions/setup
- name: Lint (terminal)
run: bun run --cwd packages/terminal lint
- name: Lint (app)
run: bun run --cwd packages/app lint
- name: Lint (session sync)
Expand All @@ -103,6 +109,8 @@ jobs:
- uses: actions/checkout@v6
- name: Install dependencies
uses: ./.github/actions/setup
- name: Test (terminal)
run: bun run --cwd packages/terminal test
- name: Test (app)
run: bun run --cwd packages/app test
- name: Test (session sync)
Expand All @@ -125,6 +133,8 @@ jobs:
- uses: actions/checkout@v6
- name: Install dependencies
uses: ./.github/actions/setup
- name: Lint Effect-TS (terminal)
run: bun run --cwd packages/terminal lint:effect
- name: Lint Effect-TS (app)
run: bun run --cwd packages/app lint:effect
- name: Lint Effect-TS (session sync)
Expand Down
32 changes: 30 additions & 2 deletions bun.lock

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

15 changes: 8 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,18 @@
"packages/api",
"packages/app",
"packages/docker-git-session-sync",
"packages/lib"
"packages/lib",
"packages/terminal"
],
"scripts": {
"setup:pre-commit-hook": "bun scripts/setup-pre-commit-hook.js",
"build": "bun run --filter @prover-coder-ai/docker-git-session-sync build && bun run --filter @prover-coder-ai/docker-git build",
"build": "bun run --filter @prover-coder-ai/docker-git-session-sync build && bun run --filter @prover-coder-ai/docker-git-terminal build && bun run --filter @prover-coder-ai/docker-git build",
"api:build": "bun run --filter @effect-template/api build",
"api:start": "bun run --filter @effect-template/api start",
"api:dev": "bun run --filter @effect-template/api dev",
"api:test": "bun run --filter @effect-template/api test",
"api:typecheck": "bun run --filter @effect-template/api typecheck",
"check": "bun run --filter @prover-coder-ai/docker-git-session-sync check && bun run --filter @prover-coder-ai/docker-git check && bun run --filter @effect-template/lib typecheck",
"check": "bun run --filter @prover-coder-ai/docker-git-session-sync check && bun run --filter @prover-coder-ai/docker-git-terminal check && bun run --filter @prover-coder-ai/docker-git check && bun run --filter @effect-template/lib typecheck",
"check:dist-deps-prune": "bun node_modules/@prover-coder-ai/dist-deps-prune/dist/main.js scan --package ./packages/app/package.json --prune-dev true --silent",
"changeset": "changeset",
"changeset-publish": "bun -e \"if (!process.env.NPM_TOKEN) { console.log('Skipping publish: NPM_TOKEN is not set'); process.exit(0); }\" && changeset publish",
Expand All @@ -42,11 +43,11 @@
"web:build": "bun run --cwd packages/app build:web",
"web:preview": "bun run --cwd packages/app preview:web",
"web:serve": "bun run --cwd packages/app serve:web",
"lint": "bun run --filter @prover-coder-ai/docker-git lint && bun run --filter @effect-template/lib lint",
"lint": "bun run --filter @prover-coder-ai/docker-git-terminal lint && bun run --filter @prover-coder-ai/docker-git lint && bun run --filter @effect-template/lib lint",
"lint:tests": "bun run --filter @prover-coder-ai/docker-git lint:tests",
"lint:effect": "bun run --filter @prover-coder-ai/docker-git lint:effect && bun run --filter @effect-template/lib lint:effect",
"test": "bun run --filter @prover-coder-ai/docker-git-session-sync test && bun run --filter @prover-coder-ai/docker-git test && bun run --filter @effect-template/lib test",
"typecheck": "bun run --filter @prover-coder-ai/docker-git-session-sync typecheck && bun run --filter @prover-coder-ai/docker-git typecheck && bun run --filter @effect-template/lib typecheck",
"lint:effect": "bun run --filter @prover-coder-ai/docker-git-terminal lint:effect && bun run --filter @prover-coder-ai/docker-git lint:effect && bun run --filter @effect-template/lib lint:effect",
"test": "bun run --filter @prover-coder-ai/docker-git-session-sync test && bun run --filter @prover-coder-ai/docker-git-terminal test && bun run --filter @prover-coder-ai/docker-git test && bun run --filter @effect-template/lib test",
"typecheck": "bun run --filter @prover-coder-ai/docker-git-session-sync typecheck && bun run --filter @prover-coder-ai/docker-git-terminal typecheck && bun run --filter @prover-coder-ai/docker-git typecheck && bun run --filter @effect-template/lib typecheck",
"start": "bun run --cwd packages/app build:docker-git && bun ./packages/app/dist/src/docker-git/main.js"
},
"devDependencies": {
Expand Down
6 changes: 5 additions & 1 deletion packages/api/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,12 @@ RUN curl -fsSL https://deb.nodesource.com/setup_24.x | bash - \
FROM controller-base AS workspace-deps

COPY package.json bun.lock bunfig.toml tsconfig.base.json tsconfig.json ./
RUN mkdir -p packages/api packages/app packages/docker-git-session-sync packages/lib
RUN mkdir -p packages/api packages/app packages/docker-git-session-sync packages/lib packages/terminal
COPY packages/api/package.json ./packages/api/package.json
COPY packages/app/package.json ./packages/app/package.json
COPY packages/docker-git-session-sync/package.json ./packages/docker-git-session-sync/package.json
COPY packages/lib/package.json ./packages/lib/package.json
COPY packages/terminal/package.json ./packages/terminal/package.json

RUN set -eu; \
for attempt in 1 2 3 4 5; do \
Expand All @@ -68,6 +69,7 @@ RUN set -eu; \
--silent \
--filter @effect-template/api \
--filter @effect-template/lib \
--filter @prover-coder-ai/docker-git-terminal \
--filter @prover-coder-ai/docker-git-session-sync; then \
exit 0; \
fi; \
Expand All @@ -84,8 +86,10 @@ COPY patches ./patches
COPY scripts ./scripts
COPY packages/docker-git-session-sync ./packages/docker-git-session-sync
COPY packages/lib ./packages/lib
COPY packages/terminal ./packages/terminal

RUN bun run --cwd packages/docker-git-session-sync build
RUN bun run --cwd packages/terminal build
RUN bun run --cwd packages/lib build

FROM controller-base AS skiller-build
Expand Down
7 changes: 4 additions & 3 deletions packages/api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,20 @@
"type": "module",
"packageManager": "bun@1.3.11",
"scripts": {
"prebuild": "bun run --cwd ../lib build",
"prebuild": "bun run --cwd ../terminal build && bun run --cwd ../lib build",
"build": "tsc -p tsconfig.json",
"dev": "tsc -p tsconfig.json --watch",
"prestart": "bun run build",
"start": "bun dist/src/main.js",
"pretypecheck": "bun run --cwd ../lib build",
"pretypecheck": "bun run --cwd ../terminal build && bun run --cwd ../lib build",
"typecheck": "tsc --noEmit -p tsconfig.json",
"lint": "eslint .",
"pretest": "bun run --cwd ../lib build",
"pretest": "bun run --cwd ../terminal build && bun run --cwd ../lib build",
"test": "vitest run"
},
"dependencies": {
"@effect-template/lib": "workspace:*",
"@prover-coder-ai/docker-git-terminal": "workspace:*",
"@effect/platform": "^0.96.1",
"@effect/platform-node": "^0.106.0",
"@effect/schema": "^0.75.5",
Expand Down
19 changes: 7 additions & 12 deletions packages/api/src/services/auth-terminal-sessions.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
import * as ParseResult from "@effect/schema/ParseResult"
import * as Schema from "@effect/schema/Schema"
import {
appendTerminalOutput,
emptyTerminalOutputBuffer,
renderTerminalOutputBuffer,
type TerminalOutputBuffer
} from "@prover-coder-ai/docker-git-terminal/core"
import type { TerminalServerMessage } from "@prover-coder-ai/docker-git-terminal/contracts"
import { Either, Effect, Match } from "effect"
import { randomUUID } from "node:crypto"
import { fileURLToPath } from "node:url"
Expand All @@ -10,25 +17,13 @@ import { WebSocket, WebSocketServer, type RawData } from "ws"
import type { AuthTerminalFlow, AuthTerminalSessionRequest, TerminalSession, TerminalSessionStatus } from "../api/contracts.js"
import { ApiConflictError, ApiNotFoundError, describeUnknown } from "../api/errors.js"
import { spawnPtyBridge, type PtyBridge } from "./pty-bridge.js"
import {
appendTerminalOutput,
emptyTerminalOutputBuffer,
renderTerminalOutputBuffer,
type TerminalOutputBuffer
} from "./terminal-output-buffer.js"
import { attachWebSocketHeartbeat } from "./websocket-heartbeat.js"

type TerminalClientMessage =
| { readonly type: "input"; readonly data: string }
| { readonly type: "resize"; readonly cols: number; readonly rows: number }
| { readonly type: "close" }

type TerminalServerMessage =
| { readonly type: "ready"; readonly session: TerminalSession }
| { readonly type: "output"; readonly data: string }
| { readonly type: "exit"; readonly exitCode: number | null; readonly signal: number | null }
| { readonly type: "error"; readonly message: string }

type AuthTerminalRecord = {
attachTimeout: ReturnType<typeof setTimeout> | null
args: ReadonlyArray<string>
Expand Down
Loading
Loading