Adopt Node-native TypeScript for desktop and server (#2098)
This commit is contained in:
1 parent
ed6b7fbf27
commit
8dba2d6484
140 files changed
+2149
-1604
No files matched your search
@@ -71,8 +71,8 @@ jobs:
|
||||
|
||||
- name: Verify preload bundle output
|
||||
run: |
|
||||
test -f apps/desktop/dist-electron/preload.js
|
||||
grep -nE "desktopBridge|getLocalEnvironmentBootstrap|PICK_FOLDER_CHANNEL|wsUrl" apps/desktop/dist-electron/preload.js
|
||||
test -f apps/desktop/dist-electron/preload.cjs
|
||||
grep -nE "desktopBridge|getLocalEnvironmentBootstrap|PICK_FOLDER_CHANNEL|wsUrl" apps/desktop/dist-electron/preload.cjs
|
||||
|
||||
release_smoke:
|
||||
name: Release Smoke
|
||||
|
||||
@@ -2,13 +2,14 @@
|
||||
"name": "@t3tools/desktop",
|
||||
"version": "0.0.20",
|
||||
"private": true,
|
||||
"main": "dist-electron/main.js",
|
||||
"type": "module",
|
||||
"main": "dist-electron/main.cjs",
|
||||
"scripts": {
|
||||
"dev": "bun run --parallel dev:bundle dev:electron",
|
||||
"dev:bundle": "tsdown --watch",
|
||||
"dev:electron": "bun run scripts/dev-electron.mjs",
|
||||
"dev:electron": "node scripts/dev-electron.mjs",
|
||||
"build": "tsdown",
|
||||
"start": "bun run scripts/start-electron.mjs",
|
||||
"start": "node scripts/start-electron.mjs",
|
||||
"typecheck": "tsc --noEmit",
|
||||
"test": "vitest run --passWithNoTests",
|
||||
"smoke-test": "node scripts/smoke-test.mjs"
|
||||
|
||||
@@ -17,12 +17,12 @@ if (!Number.isInteger(port) || port <= 0) {
|
||||
}
|
||||
|
||||
const requiredFiles = [
|
||||
"dist-electron/main.js",
|
||||
"dist-electron/preload.js",
|
||||
"dist-electron/main.cjs",
|
||||
"dist-electron/preload.cjs",
|
||||
"../server/dist/bin.mjs",
|
||||
];
|
||||
const watchedDirectories = [
|
||||
{ directory: "dist-electron", files: new Set(["main.js", "preload.js"]) },
|
||||
{ directory: "dist-electron", files: new Set(["main.cjs", "preload.cjs"]) },
|
||||
{ directory: "../server/dist", files: new Set(["bin.mjs"]) },
|
||||
];
|
||||
const forcedShutdownTimeoutMs = 1_500;
|
||||
@@ -69,7 +69,7 @@ function startApp() {
|
||||
|
||||
const app = spawn(
|
||||
resolveElectronPath(),
|
||||
[`--t3code-dev-root=${desktopDir}`, "dist-electron/main.js"],
|
||||
[`--t3code-dev-root=${desktopDir}`, "dist-electron/main.cjs"],
|
||||
{
|
||||
cwd: desktopDir,
|
||||
env: childEnv,
|
||||
|
||||
@@ -8,7 +8,6 @@ import {
|
||||
mkdirSync,
|
||||
mkdtempSync,
|
||||
readFileSync,
|
||||
readdirSync,
|
||||
rmSync,
|
||||
statSync,
|
||||
writeFileSync,
|
||||
@@ -20,7 +19,7 @@ import { fileURLToPath } from "node:url";
|
||||
const isDevelopment = Boolean(process.env.VITE_DEV_SERVER_URL);
|
||||
const APP_DISPLAY_NAME = isDevelopment ? "T3 Code (Dev)" : "T3 Code (Alpha)";
|
||||
const APP_BUNDLE_ID = isDevelopment ? "com.t3tools.t3code.dev" : "com.t3tools.t3code";
|
||||
const LAUNCHER_VERSION = 1;
|
||||
const LAUNCHER_VERSION = 2;
|
||||
|
||||
const __dirname = dirname(fileURLToPath(import.meta.url));
|
||||
export const desktopDir = resolve(__dirname, "..");
|
||||
@@ -121,40 +120,6 @@ function patchMainBundleInfoPlist(appBundlePath, iconPath) {
|
||||
copyFileSync(iconPath, join(resourcesDir, "electron.icns"));
|
||||
}
|
||||
|
||||
function patchHelperBundleInfoPlists(appBundlePath) {
|
||||
const frameworksDir = join(appBundlePath, "Contents", "Frameworks");
|
||||
if (!existsSync(frameworksDir)) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (const entry of readdirSync(frameworksDir, { withFileTypes: true })) {
|
||||
if (!entry.isDirectory() || !entry.name.endsWith(".app")) {
|
||||
continue;
|
||||
}
|
||||
if (!entry.name.startsWith("Electron Helper")) {
|
||||
continue;
|
||||
}
|
||||
|
||||
const helperPlistPath = join(frameworksDir, entry.name, "Contents", "Info.plist");
|
||||
if (!existsSync(helperPlistPath)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
const suffix = entry.name.replace("Electron Helper", "").replace(".app", "").trim();
|
||||
const helperName = suffix
|
||||
? `${APP_DISPLAY_NAME} Helper ${suffix}`
|
||||
: `${APP_DISPLAY_NAME} Helper`;
|
||||
const helperIdSuffix = suffix.replace(/[()]/g, "").trim().toLowerCase().replace(/\s+/g, "-");
|
||||
const helperBundleId = helperIdSuffix
|
||||
? `${APP_BUNDLE_ID}.helper.${helperIdSuffix}`
|
||||
: `${APP_BUNDLE_ID}.helper`;
|
||||
|
||||
setPlistString(helperPlistPath, "CFBundleDisplayName", helperName);
|
||||
setPlistString(helperPlistPath, "CFBundleName", helperName);
|
||||
setPlistString(helperPlistPath, "CFBundleIdentifier", helperBundleId);
|
||||
}
|
||||
}
|
||||
|
||||
function readJson(path) {
|
||||
try {
|
||||
return JSON.parse(readFileSync(path, "utf8"));
|
||||
@@ -192,7 +157,6 @@ function buildMacLauncher(electronBinaryPath) {
|
||||
rmSync(targetAppBundlePath, { recursive: true, force: true });
|
||||
cpSync(sourceAppBundlePath, targetAppBundlePath, { recursive: true });
|
||||
patchMainBundleInfoPlist(targetAppBundlePath, iconPath);
|
||||
patchHelperBundleInfoPlists(targetAppBundlePath);
|
||||
writeFileSync(metadataPath, `${JSON.stringify(expectedMetadata, null, 2)}\n`);
|
||||
|
||||
return targetBinaryPath;
|
||||
@@ -206,5 +170,11 @@ export function resolveElectronPath() {
|
||||
return electronBinaryPath;
|
||||
}
|
||||
|
||||
// Dev launches do not need a renamed app bundle badly enough to risk breaking
|
||||
// Electron helper resource lookup on macOS.
|
||||
if (isDevelopment) {
|
||||
return electronBinaryPath;
|
||||
}
|
||||
|
||||
return buildMacLauncher(electronBinaryPath);
|
||||
}
|
||||
@@ -5,7 +5,7 @@ import { fileURLToPath } from "node:url";
|
||||
const __dirname = dirname(fileURLToPath(import.meta.url));
|
||||
const desktopDir = resolve(__dirname, "..");
|
||||
const electronBin = resolve(desktopDir, "node_modules/.bin/electron");
|
||||
const mainJs = resolve(desktopDir, "dist-electron/main.js");
|
||||
const mainJs = resolve(desktopDir, "dist-electron/main.cjs");
|
||||
|
||||
console.log("\nLaunching Electron smoke test...");
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ import { desktopDir, resolveElectronPath } from "./electron-launcher.mjs";
|
||||
const childEnv = { ...process.env };
|
||||
delete childEnv.ELECTRON_RUN_AS_NODE;
|
||||
|
||||
const child = spawn(resolveElectronPath(), ["dist-electron/main.js"], {
|
||||
const child = spawn(resolveElectronPath(), ["dist-electron/main.cjs"], {
|
||||
stdio: "inherit",
|
||||
cwd: desktopDir,
|
||||
env: childEnv,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
import { resolveDesktopAppBranding, resolveDesktopAppStageLabel } from "./appBranding";
|
||||
import { resolveDesktopAppBranding, resolveDesktopAppStageLabel } from "./appBranding.ts";
|
||||
|
||||
describe("resolveDesktopAppStageLabel", () => {
|
||||
it("uses Dev in desktop development", () => {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { DesktopAppBranding, DesktopAppStageLabel } from "@t3tools/contracts";
|
||||
|
||||
import { isNightlyDesktopVersion } from "./updateChannels";
|
||||
import { isNightlyDesktopVersion } from "./updateChannels.ts";
|
||||
|
||||
const APP_BASE_NAME = "T3 Code";
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { describe, expect, it, vi } from "vitest";
|
||||
|
||||
import { resolveDesktopBackendPort } from "./backendPort";
|
||||
import { resolveDesktopBackendPort } from "./backendPort.ts";
|
||||
|
||||
describe("resolveDesktopBackendPort", () => {
|
||||
it("returns the starting port when it is available", async () => {
|
||||
|
||||
@@ -4,7 +4,7 @@ import {
|
||||
BackendReadinessAbortedError,
|
||||
isBackendReadinessAborted,
|
||||
waitForHttpReady,
|
||||
} from "./backendReadiness";
|
||||
} from "./backendReadiness.ts";
|
||||
|
||||
describe("waitForHttpReady", () => {
|
||||
it("returns once the backend serves the requested readiness path", async () => {
|
||||
|
||||
@@ -18,7 +18,7 @@ import {
|
||||
writeSavedEnvironmentRegistry,
|
||||
writeSavedEnvironmentSecret,
|
||||
type DesktopSecretStorage,
|
||||
} from "./clientPersistence";
|
||||
} from "./clientPersistence.ts";
|
||||
|
||||
const tempDirectories: string[] = [];
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ vi.mock("electron", () => ({
|
||||
},
|
||||
}));
|
||||
|
||||
import { showDesktopConfirmDialog } from "./confirmDialog";
|
||||
import { showDesktopConfirmDialog } from "./confirmDialog.ts";
|
||||
|
||||
describe("showDesktopConfirmDialog", () => {
|
||||
beforeEach(() => {
|
||||
|
||||
@@ -11,7 +11,7 @@ import {
|
||||
setDesktopServerExposurePreference,
|
||||
setDesktopUpdateChannelPreference,
|
||||
writeDesktopSettings,
|
||||
} from "./desktopSettings";
|
||||
} from "./desktopSettings.ts";
|
||||
|
||||
const tempDirectories: string[] = [];
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ import * as FS from "node:fs";
|
||||
import * as Path from "node:path";
|
||||
import type { DesktopServerExposureMode, DesktopUpdateChannel } from "@t3tools/contracts";
|
||||
|
||||
import { resolveDefaultDesktopUpdateChannel } from "./updateChannels";
|
||||
import { resolveDefaultDesktopUpdateChannel } from "./updateChannels.ts";
|
||||
|
||||
export interface DesktopSettings {
|
||||
readonly serverExposureMode: DesktopServerExposureMode;
|
||||
|
||||
+14
-14
@@ -36,14 +36,14 @@ import { autoUpdater } from "electron-updater";
|
||||
import type { ContextMenuItem } from "@t3tools/contracts";
|
||||
import { RotatingFileSink } from "@t3tools/shared/logging";
|
||||
import { parsePersistedServerObservabilitySettings } from "@t3tools/shared/serverSettings";
|
||||
import { DEFAULT_DESKTOP_BACKEND_PORT, resolveDesktopBackendPort } from "./backendPort";
|
||||
import { DEFAULT_DESKTOP_BACKEND_PORT, resolveDesktopBackendPort } from "./backendPort.ts";
|
||||
import {
|
||||
DEFAULT_DESKTOP_SETTINGS,
|
||||
readDesktopSettings,
|
||||
setDesktopServerExposurePreference,
|
||||
setDesktopUpdateChannelPreference,
|
||||
writeDesktopSettings,
|
||||
} from "./desktopSettings";
|
||||
} from "./desktopSettings.ts";
|
||||
import {
|
||||
readClientSettings,
|
||||
readSavedEnvironmentRegistry,
|
||||
@@ -52,14 +52,14 @@ import {
|
||||
writeClientSettings,
|
||||
writeSavedEnvironmentRegistry,
|
||||
writeSavedEnvironmentSecret,
|
||||
} from "./clientPersistence";
|
||||
import { isBackendReadinessAborted, waitForHttpReady } from "./backendReadiness";
|
||||
import { showDesktopConfirmDialog } from "./confirmDialog";
|
||||
import { resolveDesktopServerExposure } from "./serverExposure";
|
||||
import { syncShellEnvironment } from "./syncShellEnvironment";
|
||||
import { getAutoUpdateDisabledReason, shouldBroadcastDownloadProgress } from "./updateState";
|
||||
import { doesVersionMatchDesktopUpdateChannel } from "./updateChannels";
|
||||
import { ServerListeningDetector } from "./serverListeningDetector";
|
||||
} from "./clientPersistence.ts";
|
||||
import { isBackendReadinessAborted, waitForHttpReady } from "./backendReadiness.ts";
|
||||
import { showDesktopConfirmDialog } from "./confirmDialog.ts";
|
||||
import { resolveDesktopServerExposure } from "./serverExposure.ts";
|
||||
import { syncShellEnvironment } from "./syncShellEnvironment.ts";
|
||||
import { getAutoUpdateDisabledReason, shouldBroadcastDownloadProgress } from "./updateState.ts";
|
||||
import { doesVersionMatchDesktopUpdateChannel } from "./updateChannels.ts";
|
||||
import { ServerListeningDetector } from "./serverListeningDetector.ts";
|
||||
import {
|
||||
createInitialDesktopUpdateState,
|
||||
reduceDesktopUpdateStateOnCheckFailure,
|
||||
@@ -71,9 +71,9 @@ import {
|
||||
reduceDesktopUpdateStateOnInstallFailure,
|
||||
reduceDesktopUpdateStateOnNoUpdate,
|
||||
reduceDesktopUpdateStateOnUpdateAvailable,
|
||||
} from "./updateMachine";
|
||||
import { isArm64HostRunningIntelBuild, resolveDesktopRuntimeInfo } from "./runtimeArch";
|
||||
import { resolveDesktopAppBranding } from "./appBranding";
|
||||
} from "./updateMachine.ts";
|
||||
import { isArm64HostRunningIntelBuild, resolveDesktopRuntimeInfo } from "./runtimeArch.ts";
|
||||
import { resolveDesktopAppBranding } from "./appBranding.ts";
|
||||
|
||||
syncShellEnvironment();
|
||||
|
||||
@@ -1967,7 +1967,7 @@ function createWindow(): BrowserWindow {
|
||||
title: APP_DISPLAY_NAME,
|
||||
...getWindowTitleBarOptions(),
|
||||
webPreferences: {
|
||||
preload: Path.join(__dirname, "preload.js"),
|
||||
preload: Path.join(__dirname, "preload.cjs"),
|
||||
contextIsolation: true,
|
||||
nodeIntegration: false,
|
||||
sandbox: true,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
import { isArm64HostRunningIntelBuild, resolveDesktopRuntimeInfo } from "./runtimeArch";
|
||||
import { isArm64HostRunningIntelBuild, resolveDesktopRuntimeInfo } from "./runtimeArch.ts";
|
||||
|
||||
describe("resolveDesktopRuntimeInfo", () => {
|
||||
it("detects Rosetta-translated Intel builds on Apple Silicon", () => {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
import { resolveDesktopServerExposure, resolveLanAdvertisedHost } from "./serverExposure";
|
||||
import { resolveDesktopServerExposure, resolveLanAdvertisedHost } from "./serverExposure.ts";
|
||||
|
||||
describe("resolveLanAdvertisedHost", () => {
|
||||
it("prefers an explicit host override", () => {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
import { ServerListeningDetector } from "./serverListeningDetector";
|
||||
import { ServerListeningDetector } from "./serverListeningDetector.ts";
|
||||
|
||||
describe("ServerListeningDetector", () => {
|
||||
it("resolves when the server logs the listening line", async () => {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { describe, expect, it, vi } from "vitest";
|
||||
|
||||
import { syncShellEnvironment } from "./syncShellEnvironment";
|
||||
import { syncShellEnvironment } from "./syncShellEnvironment.ts";
|
||||
|
||||
describe("syncShellEnvironment", () => {
|
||||
it("hydrates PATH and missing SSH_AUTH_SOCK from the login shell on macOS", () => {
|
||||
|
||||
@@ -3,8 +3,8 @@ import {
|
||||
mergePathEntries,
|
||||
readPathFromLaunchctl,
|
||||
readEnvironmentFromLoginShell,
|
||||
ShellEnvironmentReader,
|
||||
} from "@t3tools/shared/shell";
|
||||
import type { ShellEnvironmentReader } from "@t3tools/shared/shell";
|
||||
|
||||
const LOGIN_SHELL_ENV_NAMES = [
|
||||
"PATH",
|
||||
|
||||
@@ -4,7 +4,7 @@ import {
|
||||
doesVersionMatchDesktopUpdateChannel,
|
||||
isNightlyDesktopVersion,
|
||||
resolveDefaultDesktopUpdateChannel,
|
||||
} from "./updateChannels";
|
||||
} from "./updateChannels.ts";
|
||||
|
||||
describe("isNightlyDesktopVersion", () => {
|
||||
it("detects packaged nightly versions", () => {
|
||||
|
||||
@@ -11,7 +11,7 @@ import {
|
||||
reduceDesktopUpdateStateOnInstallFailure,
|
||||
reduceDesktopUpdateStateOnNoUpdate,
|
||||
reduceDesktopUpdateStateOnUpdateAvailable,
|
||||
} from "./updateMachine";
|
||||
} from "./updateMachine.ts";
|
||||
|
||||
const runtimeInfo = {
|
||||
hostArch: "x64",
|
||||
|
||||
@@ -4,7 +4,7 @@ import type {
|
||||
DesktopUpdateState,
|
||||
} from "@t3tools/contracts";
|
||||
|
||||
import { getCanRetryAfterDownloadFailure, nextStatusAfterDownloadFailure } from "./updateState";
|
||||
import { getCanRetryAfterDownloadFailure, nextStatusAfterDownloadFailure } from "./updateState.ts";
|
||||
|
||||
export function createInitialDesktopUpdateState(
|
||||
currentVersion: string,
|
||||
|
||||
@@ -6,7 +6,7 @@ import {
|
||||
getAutoUpdateDisabledReason,
|
||||
nextStatusAfterDownloadFailure,
|
||||
shouldBroadcastDownloadProgress,
|
||||
} from "./updateState";
|
||||
} from "./updateState.ts";
|
||||
|
||||
const baseState: DesktopUpdateState = {
|
||||
enabled: true,
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
"compilerOptions": {
|
||||
"composite": true,
|
||||
"types": ["node", "electron"],
|
||||
"lib": ["ES2023", "DOM", "esnext.disposable"]
|
||||
"lib": ["ESNext", "DOM", "esnext.disposable"]
|
||||
},
|
||||
"include": ["src", "tsdown.config.ts"]
|
||||
}
|
||||
@@ -4,7 +4,7 @@ const shared = {
|
||||
format: "cjs" as const,
|
||||
outDir: "dist-electron",
|
||||
sourcemap: true,
|
||||
outExtensions: () => ({ js: ".js" }),
|
||||
outExtensions: () => ({ js: ".cjs" }),
|
||||
};
|
||||
|
||||
export default defineConfig([
|
||||
|
||||
@@ -15,8 +15,9 @@
|
||||
],
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "bun run src/bin.ts",
|
||||
"dev": "node --watch src/bin.ts",
|
||||
"build": "node scripts/cli.ts build",
|
||||
"build:bundle": "tsdown",
|
||||
"start": "node dist/bin.mjs",
|
||||
"prepare": "effect-language-service patch",
|
||||
"typecheck": "tsc --noEmit",
|
||||
|
||||
+15
-20
@@ -147,13 +147,13 @@ const buildCmd = Command.make(
|
||||
|
||||
yield* Effect.log("[cli] Running tsdown...");
|
||||
yield* runCommand(
|
||||
ChildProcess.make({
|
||||
ChildProcess.make(process.execPath, ["--run", "build:bundle"], {
|
||||
cwd: serverDir,
|
||||
stdout: config.verbose ? "inherit" : "ignore",
|
||||
stderr: "inherit",
|
||||
// Windows needs shell mode to resolve .cmd shims (e.g. bun.cmd).
|
||||
// Windows needs shell mode to resolve `.cmd` shims on PATH.
|
||||
shell: process.platform === "win32",
|
||||
})`bun tsdown`,
|
||||
}),
|
||||
);
|
||||
|
||||
const webDist = path.join(repoRoot, "apps/web/dist");
|
||||
@@ -203,10 +203,8 @@ const publishCmd = Command.make(
|
||||
}
|
||||
|
||||
yield* Effect.acquireUseRelease(
|
||||
// Acquire: backup package.json, resolve catalog: deps, strip devDependencies/scripts
|
||||
// Acquire: backup package.json, resolve catalog dependencies, and strip devDependencies/scripts
|
||||
Effect.gen(function* () {
|
||||
// Resolve catalog dependencies before any file mutations. If this throws,
|
||||
// acquire fails and no release hook runs, so filesystem must still be untouched.
|
||||
const version = Option.getOrElse(config.appVersion, () => serverPackageJson.version);
|
||||
const pkg: PackageJson = {
|
||||
name: serverPackageJson.name,
|
||||
@@ -216,25 +214,22 @@ const publishCmd = Command.make(
|
||||
version,
|
||||
engines: serverPackageJson.engines,
|
||||
files: serverPackageJson.files,
|
||||
dependencies: serverPackageJson.dependencies,
|
||||
overrides: rootPackageJson.overrides,
|
||||
dependencies: resolveCatalogDependencies(
|
||||
serverPackageJson.dependencies,
|
||||
rootPackageJson.workspaces.catalog,
|
||||
"apps/server",
|
||||
),
|
||||
overrides: resolveCatalogDependencies(
|
||||
rootPackageJson.overrides,
|
||||
rootPackageJson.workspaces.catalog,
|
||||
"apps/server",
|
||||
),
|
||||
};
|
||||
|
||||
pkg.dependencies = resolveCatalogDependencies(
|
||||
pkg.dependencies,
|
||||
rootPackageJson.workspaces.catalog,
|
||||
"apps/server dependencies",
|
||||
);
|
||||
pkg.overrides = resolveCatalogDependencies(
|
||||
pkg.overrides,
|
||||
rootPackageJson.workspaces.catalog,
|
||||
"root overrides",
|
||||
);
|
||||
|
||||
const original = yield* fs.readFileString(packageJsonPath);
|
||||
yield* fs.writeFileString(backupPath, original);
|
||||
yield* fs.writeFileString(packageJsonPath, `${JSON.stringify(pkg, null, 2)}\n`);
|
||||
yield* Effect.log("[cli] Resolved package.json for publish");
|
||||
yield* Effect.log("[cli] Prepared package.json for publish");
|
||||
|
||||
const iconBackups = yield* applyPublishIconOverrides(repoRoot, serverDir);
|
||||
return { iconBackups };
|
||||
|
||||
@@ -2,7 +2,7 @@ import * as NodeServices from "@effect/platform-node/NodeServices";
|
||||
import { expect, it } from "@effect/vitest";
|
||||
import { Effect, Layer } from "effect";
|
||||
|
||||
import { ServerConfigShape } from "../../config.ts";
|
||||
import type { ServerConfigShape } from "../../config.ts";
|
||||
import { ServerConfig } from "../../config.ts";
|
||||
import { BootstrapCredentialServiceLive } from "./BootstrapCredentialService.ts";
|
||||
import { ServerSecretStoreLive } from "./ServerSecretStore.ts";
|
||||
|
||||
@@ -10,8 +10,10 @@ import { layerConfig as SqlitePersistenceLayerLive } from "../../persistence/Lay
|
||||
import {
|
||||
AuthControlPlane,
|
||||
AuthControlPlaneError,
|
||||
AuthControlPlaneShape,
|
||||
DEFAULT_SESSION_SUBJECT,
|
||||
} from "../Services/AuthControlPlane.ts";
|
||||
import type {
|
||||
AuthControlPlaneShape,
|
||||
IssuedBearerSession,
|
||||
IssuedPairingLink,
|
||||
} from "../Services/AuthControlPlane.ts";
|
||||
|
||||
@@ -5,7 +5,7 @@ import type {
|
||||
AuthSessionId,
|
||||
} from "@t3tools/contracts";
|
||||
import { Data, DateTime, Duration, Effect, Context } from "effect";
|
||||
import { SessionRole } from "./SessionCredentialService";
|
||||
import type { SessionRole } from "./SessionCredentialService.ts";
|
||||
|
||||
export const DEFAULT_SESSION_SUBJECT = "cli-issued-session";
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
import { deriveAuthClientMetadata } from "./utils";
|
||||
import { deriveAuthClientMetadata } from "./utils.ts";
|
||||
|
||||
describe("deriveAuthClientMetadata", () => {
|
||||
it("labels Electron user agents as Electron instead of Chrome", () => {
|
||||
|
||||
@@ -5,12 +5,12 @@ import * as Layer from "effect/Layer";
|
||||
import { Command } from "effect/unstable/cli";
|
||||
|
||||
import { NetService } from "@t3tools/shared/Net";
|
||||
import { cli } from "./cli";
|
||||
import { version } from "../package.json" with { type: "json" };
|
||||
import { cli } from "./cli.ts";
|
||||
import packageJson from "../package.json" with { type: "json" };
|
||||
|
||||
const CliRuntimeLayer = Layer.mergeAll(NodeServices.layer, NetService.layer);
|
||||
|
||||
Command.run(cli, { version }).pipe(
|
||||
Command.run(cli, { version: packageJson.version }).pipe(
|
||||
Effect.scoped,
|
||||
Effect.provide(CliRuntimeLayer),
|
||||
NodeRuntime.runMain,
|
||||
|
||||
@@ -10,7 +10,7 @@ import * as Fiber from "effect/Fiber";
|
||||
import { TestClock } from "effect/testing";
|
||||
import { vi } from "vitest";
|
||||
|
||||
import { readBootstrapEnvelope, resolveFdPath } from "./bootstrap";
|
||||
import { readBootstrapEnvelope, resolveFdPath } from "./bootstrap.ts";
|
||||
import { assertNone, assertSome } from "@effect/vitest/utils";
|
||||
|
||||
const openSyncInterceptor = vi.hoisted(() => ({ failPath: null as string | null }));
|
||||
|
||||
@@ -5,8 +5,8 @@ import { ConfigProvider, Effect, FileSystem, Layer, Option, Path } from "effect"
|
||||
|
||||
import { NetService } from "@t3tools/shared/Net";
|
||||
import * as NodeServices from "@effect/platform-node/NodeServices";
|
||||
import { deriveServerPaths } from "./config";
|
||||
import { resolveServerConfig } from "./cli";
|
||||
import { deriveServerPaths } from "./config.ts";
|
||||
import { resolveServerConfig } from "./cli.ts";
|
||||
|
||||
it.layer(NodeServices.layer)("cli config resolution", (it) => {
|
||||
const defaultObservabilityConfig = {
|
||||
|
||||
+12
-11
@@ -40,30 +40,31 @@ import {
|
||||
RuntimeMode,
|
||||
type ServerConfigShape,
|
||||
type StartupPresentation,
|
||||
} from "./config";
|
||||
import { readBootstrapEnvelope } from "./bootstrap";
|
||||
import { expandHomePath, resolveBaseDir } from "./os-jank";
|
||||
import { runServer } from "./server";
|
||||
} from "./config.ts";
|
||||
import { readBootstrapEnvelope } from "./bootstrap.ts";
|
||||
import { expandHomePath, resolveBaseDir } from "./os-jank.ts";
|
||||
import { runServer } from "./server.ts";
|
||||
import { AuthControlPlaneRuntimeLive } from "./auth/Layers/AuthControlPlane.ts";
|
||||
import {
|
||||
formatIssuedPairingCredential,
|
||||
formatIssuedSession,
|
||||
formatPairingCredentialList,
|
||||
formatSessionList,
|
||||
} from "./cliAuthFormat";
|
||||
import { AuthControlPlane, AuthControlPlaneShape } from "./auth/Services/AuthControlPlane.ts";
|
||||
} from "./cliAuthFormat.ts";
|
||||
import { AuthControlPlane } from "./auth/Services/AuthControlPlane.ts";
|
||||
import type { AuthControlPlaneShape } from "./auth/Services/AuthControlPlane.ts";
|
||||
import { OrchestrationEngineService } from "./orchestration/Services/OrchestrationEngine.ts";
|
||||
import { ProjectionSnapshotQuery } from "./orchestration/Services/ProjectionSnapshotQuery.ts";
|
||||
import { OrchestrationLayerLive } from "./orchestration/runtimeLayer";
|
||||
import { OrchestrationLayerLive } from "./orchestration/runtimeLayer.ts";
|
||||
import { layerConfig as SqlitePersistenceLayerLive } from "./persistence/Layers/Sqlite.ts";
|
||||
import { RepositoryIdentityResolverLive } from "./project/Layers/RepositoryIdentityResolver.ts";
|
||||
import { getAutoBootstrapDefaultModelSelection } from "./serverRuntimeStartup";
|
||||
import { getAutoBootstrapDefaultModelSelection } from "./serverRuntimeStartup.ts";
|
||||
import {
|
||||
clearPersistedServerRuntimeState,
|
||||
readPersistedServerRuntimeState,
|
||||
} from "./serverRuntimeState";
|
||||
import { WorkspacePaths } from "./workspace/Services/WorkspacePaths";
|
||||
import { WorkspacePathsLive } from "./workspace/Layers/WorkspacePaths";
|
||||
} from "./serverRuntimeState.ts";
|
||||
import { WorkspacePaths } from "./workspace/Services/WorkspacePaths.ts";
|
||||
import { WorkspacePathsLive } from "./workspace/Layers/WorkspacePaths.ts";
|
||||
|
||||
const PortSchema = Schema.Int.check(Schema.isBetween({ minimum: 1, maximum: 65535 }));
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ import {
|
||||
normalizeCodexModelSlug,
|
||||
readCodexAccountSnapshot,
|
||||
resolveCodexModelForAccount,
|
||||
} from "./codexAppServerManager";
|
||||
} from "./codexAppServerManager.ts";
|
||||
|
||||
const asThreadId = (value: string): ThreadId => ThreadId.make(value);
|
||||
|
||||
|
||||
@@ -25,16 +25,16 @@ import {
|
||||
formatCodexCliUpgradeMessage,
|
||||
isCodexCliVersionSupported,
|
||||
parseCodexCliVersion,
|
||||
} from "./provider/codexCliVersion";
|
||||
} from "./provider/codexCliVersion.ts";
|
||||
import {
|
||||
readCodexAccountSnapshot,
|
||||
resolveCodexModelForAccount,
|
||||
type CodexAccountSnapshot,
|
||||
} from "./provider/codexAccount";
|
||||
import { buildCodexInitializeParams, killCodexChildProcess } from "./provider/codexAppServer";
|
||||
} from "./provider/codexAccount.ts";
|
||||
import { buildCodexInitializeParams, killCodexChildProcess } from "./provider/codexAppServer.ts";
|
||||
|
||||
export { buildCodexInitializeParams } from "./provider/codexAppServer";
|
||||
export { readCodexAccountSnapshot, resolveCodexModelForAccount } from "./provider/codexAccount";
|
||||
export { buildCodexInitializeParams } from "./provider/codexAppServer.ts";
|
||||
export { readCodexAccountSnapshot, resolveCodexModelForAccount } from "./provider/codexAccount.ts";
|
||||
|
||||
type PendingRequestKey = string;
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ import { Effect, FileSystem, Layer, Path, Random } from "effect";
|
||||
|
||||
import { ServerConfig } from "../../config.ts";
|
||||
import { ServerEnvironment, type ServerEnvironmentShape } from "../Services/ServerEnvironment.ts";
|
||||
import { version } from "../../../package.json" with { type: "json" };
|
||||
import packageJson from "../../../package.json" with { type: "json" };
|
||||
import { resolveServerEnvironmentLabel } from "./ServerEnvironmentLabel.ts";
|
||||
|
||||
function platformOs(): ExecutionEnvironmentDescriptor["platform"]["os"] {
|
||||
@@ -77,7 +77,7 @@ export const makeServerEnvironment = Effect.fn("makeServerEnvironment")(function
|
||||
os: platformOs(),
|
||||
arch: platformArch(),
|
||||
},
|
||||
serverVersion: version,
|
||||
serverVersion: packageJson.version,
|
||||
capabilities: {
|
||||
repositoryIdentity: true,
|
||||
},
|
||||
|
||||
@@ -6,7 +6,7 @@ vi.mock("../../processRunner", () => ({
|
||||
runProcess: vi.fn(),
|
||||
}));
|
||||
|
||||
import { runProcess } from "../../processRunner";
|
||||
import { runProcess } from "../../processRunner.ts";
|
||||
import { GitHubCli } from "../Services/GitHubCli.ts";
|
||||
import { GitHubCliLive } from "./GitHubCli.ts";
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Effect, Layer, Result, Schema, SchemaIssue } from "effect";
|
||||
import { TrimmedNonEmptyString } from "@t3tools/contracts";
|
||||
|
||||
import { runProcess } from "../../processRunner";
|
||||
import { runProcess } from "../../processRunner.ts";
|
||||
import { GitHubCliError } from "@t3tools/contracts";
|
||||
import {
|
||||
GitHubCli,
|
||||
|
||||
@@ -38,7 +38,8 @@ import {
|
||||
type GitManagerShape,
|
||||
type GitRunStackedActionOptions,
|
||||
} from "../Services/GitManager.ts";
|
||||
import { GitCore, GitStatusDetails } from "../Services/GitCore.ts";
|
||||
import { GitCore } from "../Services/GitCore.ts";
|
||||
import type { GitStatusDetails } from "../Services/GitCore.ts";
|
||||
import { GitHubCli, type GitHubPullRequestSummary } from "../Services/GitHubCli.ts";
|
||||
import { TextGeneration } from "../Services/TextGeneration.ts";
|
||||
import { ProjectSetupScriptRunner } from "../../project/Services/ProjectSetupScriptRunner.ts";
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
import { Context } from "effect";
|
||||
import type { Effect } from "effect";
|
||||
|
||||
import type { ProcessRunResult } from "../../processRunner";
|
||||
import type { ProcessRunResult } from "../../processRunner.ts";
|
||||
import type { GitHubCliError } from "@t3tools/contracts";
|
||||
|
||||
export interface GitHubPullRequestSummary {
|
||||
|
||||
@@ -15,12 +15,12 @@ import {
|
||||
ATTACHMENTS_ROUTE_PREFIX,
|
||||
normalizeAttachmentRelativePath,
|
||||
resolveAttachmentRelativePath,
|
||||
} from "./attachmentPaths";
|
||||
import { resolveAttachmentPathById } from "./attachmentStore";
|
||||
import { resolveStaticDir, ServerConfig } from "./config";
|
||||
} from "./attachmentPaths.ts";
|
||||
import { resolveAttachmentPathById } from "./attachmentStore.ts";
|
||||
import { resolveStaticDir, ServerConfig } from "./config.ts";
|
||||
import { decodeOtlpTraceRecords } from "./observability/TraceRecord.ts";
|
||||
import { BrowserTraceCollector } from "./observability/Services/BrowserTraceCollector.ts";
|
||||
import { ProjectFaviconResolver } from "./project/Services/ProjectFaviconResolver";
|
||||
import { ProjectFaviconResolver } from "./project/Services/ProjectFaviconResolver.ts";
|
||||
import { ServerAuth } from "./auth/Services/ServerAuth.ts";
|
||||
import { respondToAuthError } from "./auth/http.ts";
|
||||
import { ServerEnvironment } from "./environment/Services/ServerEnvironment.ts";
|
||||
|
||||
@@ -3,7 +3,7 @@ import * as NodeServices from "@effect/platform-node/NodeServices";
|
||||
import { assert, it } from "@effect/vitest";
|
||||
import { assertFailure } from "@effect/vitest/utils";
|
||||
import { Cause, Effect, FileSystem, Layer, Logger, Path, Schema } from "effect";
|
||||
import { ServerConfig } from "./config";
|
||||
import { ServerConfig } from "./config.ts";
|
||||
|
||||
import {
|
||||
DEFAULT_KEYBINDINGS,
|
||||
@@ -13,7 +13,7 @@ import {
|
||||
compileResolvedKeybindingRule,
|
||||
compileResolvedKeybindingsConfig,
|
||||
parseKeybindingShortcut,
|
||||
} from "./keybindings";
|
||||
} from "./keybindings.ts";
|
||||
import { KeybindingsConfigError } from "@t3tools/contracts";
|
||||
|
||||
const KeybindingsConfigJson = Schema.fromJsonString(KeybindingsConfig);
|
||||
|
||||
@@ -19,7 +19,7 @@ import {
|
||||
THREAD_JUMP_KEYBINDING_COMMANDS,
|
||||
type ServerConfigIssue,
|
||||
} from "@t3tools/contracts";
|
||||
import { Mutable } from "effect/Types";
|
||||
import type { Mutable } from "effect/Types";
|
||||
import {
|
||||
Array,
|
||||
Cache,
|
||||
@@ -44,7 +44,7 @@ import {
|
||||
Stream,
|
||||
} from "effect";
|
||||
import * as Semaphore from "effect/Semaphore";
|
||||
import { ServerConfig } from "./config";
|
||||
import { ServerConfig } from "./config.ts";
|
||||
import { fromLenientJson } from "@t3tools/shared/schemaJson";
|
||||
|
||||
type WhenToken =
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
import type * as Exit from "effect/Exit";
|
||||
import { Effect, Option, Tracer } from "effect";
|
||||
|
||||
import { EffectTraceRecord, spanToTraceRecord } from "./TraceRecord.ts";
|
||||
import { spanToTraceRecord } from "./TraceRecord.ts";
|
||||
import type { EffectTraceRecord } from "./TraceRecord.ts";
|
||||
import { makeTraceSink, type TraceSink } from "./TraceSink.ts";
|
||||
|
||||
export interface LocalFileTracerOptions {
|
||||
@@ -27,12 +28,16 @@ class LocalFileSpan implements Tracer.Span {
|
||||
status: Tracer.SpanStatus;
|
||||
attributes: Map<string, unknown>;
|
||||
events: Array<[name: string, startTime: bigint, attributes: Record<string, unknown>]>;
|
||||
private readonly delegate: Tracer.Span;
|
||||
private readonly push: (record: EffectTraceRecord) => void;
|
||||
|
||||
constructor(
|
||||
options: Parameters<Tracer.Tracer["span"]>[0],
|
||||
private readonly delegate: Tracer.Span,
|
||||
private readonly push: (record: EffectTraceRecord) => void,
|
||||
delegate: Tracer.Span,
|
||||
push: (record: EffectTraceRecord) => void,
|
||||
) {
|
||||
this.delegate = delegate;
|
||||
this.push = push;
|
||||
this.name = delegate.name;
|
||||
this.spanId = delegate.spanId;
|
||||
this.traceId = delegate.traceId;
|
||||
|
||||
@@ -8,7 +8,7 @@ import {
|
||||
launchDetached,
|
||||
resolveAvailableEditors,
|
||||
resolveEditorLaunch,
|
||||
} from "./open";
|
||||
} from "./open.ts";
|
||||
|
||||
it.layer(NodeServices.layer)("resolveEditorLaunch", (it) => {
|
||||
it.effect("returns commands for command-based editors", () =>
|
||||
|
||||
@@ -21,8 +21,8 @@ import { ProviderService } from "../../provider/Services/ProviderService.ts";
|
||||
import { CheckpointReactor, type CheckpointReactorShape } from "../Services/CheckpointReactor.ts";
|
||||
import { OrchestrationEngineService } from "../Services/OrchestrationEngine.ts";
|
||||
import { RuntimeReceiptBus } from "../Services/RuntimeReceiptBus.ts";
|
||||
import { CheckpointStoreError } from "../../checkpointing/Errors.ts";
|
||||
import { OrchestrationDispatchError } from "../Errors.ts";
|
||||
import type { CheckpointStoreError } from "../../checkpointing/Errors.ts";
|
||||
import type { OrchestrationDispatchError } from "../Errors.ts";
|
||||
import { isGitRepository } from "../../git/Utils.ts";
|
||||
import { GitStatusBroadcaster } from "../../git/Services/GitStatusBroadcaster.ts";
|
||||
import { WorkspaceEntries } from "../../workspace/Services/WorkspaceEntries.ts";
|
||||
|
||||
@@ -19,7 +19,8 @@ import { resolveThreadWorkspaceCwd } from "../../checkpointing/Utils.ts";
|
||||
import { GitCore } from "../../git/Services/GitCore.ts";
|
||||
import { GitStatusBroadcaster } from "../../git/Services/GitStatusBroadcaster.ts";
|
||||
import { increment, orchestrationEventsProcessedTotal } from "../../observability/Metrics.ts";
|
||||
import { ProviderAdapterRequestError, ProviderServiceError } from "../../provider/Errors.ts";
|
||||
import { ProviderAdapterRequestError } from "../../provider/Errors.ts";
|
||||
import type { ProviderServiceError } from "../../provider/Errors.ts";
|
||||
import { TextGeneration } from "../../git/Services/TextGeneration.ts";
|
||||
import { ProviderService } from "../../provider/Services/ProviderService.ts";
|
||||
import { OrchestrationEngineService } from "../Services/OrchestrationEngine.ts";
|
||||
|
||||
@@ -6,10 +6,10 @@ import {
|
||||
PROVIDER_SEND_TURN_MAX_IMAGE_BYTES,
|
||||
} from "@t3tools/contracts";
|
||||
|
||||
import { createAttachmentId, resolveAttachmentPath } from "../attachmentStore";
|
||||
import { ServerConfig } from "../config";
|
||||
import { parseBase64DataUrl } from "../imageMime";
|
||||
import { WorkspacePaths } from "../workspace/Services/WorkspacePaths";
|
||||
import { createAttachmentId, resolveAttachmentPath } from "../attachmentStore.ts";
|
||||
import { ServerConfig } from "../config.ts";
|
||||
import { parseBase64DataUrl } from "../imageMime.ts";
|
||||
import { WorkspacePaths } from "../workspace/Services/WorkspacePaths.ts";
|
||||
|
||||
export const normalizeDispatchCommand = (command: ClientOrchestrationCommand) =>
|
||||
Effect.gen(function* () {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { describe, expect, it, vi } from "vitest";
|
||||
|
||||
import { fixPath } from "./os-jank";
|
||||
import { fixPath } from "./os-jank.ts";
|
||||
|
||||
describe("fixPath", () => {
|
||||
it("hydrates PATH on linux using the resolved login shell", () => {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
import { runProcess } from "./processRunner";
|
||||
import { runProcess } from "./processRunner.ts";
|
||||
|
||||
describe("runProcess", () => {
|
||||
it("fails when output exceeds max buffer in default mode", async () => {
|
||||
|
||||
@@ -17,7 +17,7 @@ import {
|
||||
type SDKResultMessage,
|
||||
type SettingSource,
|
||||
type SDKUserMessage,
|
||||
ModelUsage,
|
||||
type ModelUsage,
|
||||
} from "@anthropic-ai/claude-agent-sdk";
|
||||
import { parseCliArgs } from "@t3tools/shared/cliArgs";
|
||||
import {
|
||||
|
||||
@@ -25,11 +25,11 @@ import {
|
||||
providerModelsFromSettings,
|
||||
spawnAndCollect,
|
||||
type CommandResult,
|
||||
} from "../providerSnapshot";
|
||||
import { compareCliVersions } from "../cliVersion";
|
||||
import { makeManagedServerProvider } from "../makeManagedServerProvider";
|
||||
import { ClaudeProvider } from "../Services/ClaudeProvider";
|
||||
import { ServerSettingsService } from "../../serverSettings";
|
||||
} from "../providerSnapshot.ts";
|
||||
import { compareCliVersions } from "../cliVersion.ts";
|
||||
import { makeManagedServerProvider } from "../makeManagedServerProvider.ts";
|
||||
import { ClaudeProvider } from "../Services/ClaudeProvider.ts";
|
||||
import { ServerSettingsService } from "../../serverSettings.ts";
|
||||
import { ServerSettingsError } from "@t3tools/contracts";
|
||||
|
||||
const DEFAULT_CLAUDE_MODEL_CAPABILITIES: ModelCapabilities = {
|
||||
|
||||
@@ -32,22 +32,22 @@ import {
|
||||
providerModelsFromSettings,
|
||||
spawnAndCollect,
|
||||
type CommandResult,
|
||||
} from "../providerSnapshot";
|
||||
import { makeManagedServerProvider } from "../makeManagedServerProvider";
|
||||
} from "../providerSnapshot.ts";
|
||||
import { makeManagedServerProvider } from "../makeManagedServerProvider.ts";
|
||||
import {
|
||||
formatCodexCliUpgradeMessage,
|
||||
isCodexCliVersionSupported,
|
||||
parseCodexCliVersion,
|
||||
} from "../codexCliVersion";
|
||||
} from "../codexCliVersion.ts";
|
||||
import {
|
||||
adjustCodexModelsForAccount,
|
||||
codexAuthSubLabel,
|
||||
codexAuthSubType,
|
||||
type CodexAccountSnapshot,
|
||||
} from "../codexAccount";
|
||||
import { probeCodexDiscovery } from "../codexAppServer";
|
||||
import { CodexProvider } from "../Services/CodexProvider";
|
||||
import { ServerSettingsService } from "../../serverSettings";
|
||||
} from "../codexAccount.ts";
|
||||
import { probeCodexDiscovery } from "../codexAppServer.ts";
|
||||
import { CodexProvider } from "../Services/CodexProvider.ts";
|
||||
import { ServerSettingsService } from "../../serverSettings.ts";
|
||||
import { ServerSettingsError } from "@t3tools/contracts";
|
||||
|
||||
const DEFAULT_CODEX_MODEL_CAPABILITIES: ModelCapabilities = {
|
||||
|
||||
@@ -4,8 +4,10 @@ import { assertFailure } from "@effect/vitest/utils";
|
||||
|
||||
import { Effect, Layer, Stream } from "effect";
|
||||
|
||||
import { ClaudeAdapter, ClaudeAdapterShape } from "../Services/ClaudeAdapter.ts";
|
||||
import { CodexAdapter, CodexAdapterShape } from "../Services/CodexAdapter.ts";
|
||||
import { ClaudeAdapter } from "../Services/ClaudeAdapter.ts";
|
||||
import type { ClaudeAdapterShape } from "../Services/ClaudeAdapter.ts";
|
||||
import { CodexAdapter } from "../Services/CodexAdapter.ts";
|
||||
import type { CodexAdapterShape } from "../Services/CodexAdapter.ts";
|
||||
import { ProviderAdapterRegistry } from "../Services/ProviderAdapterRegistry.ts";
|
||||
import { ProviderAdapterRegistryLive } from "./ProviderAdapterRegistry.ts";
|
||||
import { ProviderUnsupportedError } from "../Errors.ts";
|
||||
|
||||
@@ -28,12 +28,12 @@ import {
|
||||
hasCustomModelProvider,
|
||||
parseAuthStatusFromOutput,
|
||||
readCodexConfigModelProvider,
|
||||
} from "./CodexProvider";
|
||||
import { checkClaudeProviderStatus, parseClaudeAuthStatusFromOutput } from "./ClaudeProvider";
|
||||
import { haveProvidersChanged, ProviderRegistryLive } from "./ProviderRegistry";
|
||||
import { ServerConfig } from "../../config";
|
||||
import { ServerSettingsService, type ServerSettingsShape } from "../../serverSettings";
|
||||
import { ProviderRegistry } from "../Services/ProviderRegistry";
|
||||
} from "./CodexProvider.ts";
|
||||
import { checkClaudeProviderStatus, parseClaudeAuthStatusFromOutput } from "./ClaudeProvider.ts";
|
||||
import { haveProvidersChanged, ProviderRegistryLive } from "./ProviderRegistry.ts";
|
||||
import { ServerConfig } from "../../config.ts";
|
||||
import { ServerSettingsService, type ServerSettingsShape } from "../../serverSettings.ts";
|
||||
import { ProviderRegistry } from "../Services/ProviderRegistry.ts";
|
||||
|
||||
// ── Test helpers ────────────────────────────────────────────────────
|
||||
|
||||
|
||||
@@ -6,14 +6,14 @@
|
||||
import type { ProviderKind, ServerProvider } from "@t3tools/contracts";
|
||||
import { Effect, Equal, FileSystem, Layer, Path, PubSub, Ref, Stream } from "effect";
|
||||
|
||||
import { ServerConfig } from "../../config";
|
||||
import { ClaudeProviderLive } from "./ClaudeProvider";
|
||||
import { CodexProviderLive } from "./CodexProvider";
|
||||
import type { ClaudeProviderShape } from "../Services/ClaudeProvider";
|
||||
import { ClaudeProvider } from "../Services/ClaudeProvider";
|
||||
import type { CodexProviderShape } from "../Services/CodexProvider";
|
||||
import { CodexProvider } from "../Services/CodexProvider";
|
||||
import { ProviderRegistry, type ProviderRegistryShape } from "../Services/ProviderRegistry";
|
||||
import { ServerConfig } from "../../config.ts";
|
||||
import { ClaudeProviderLive } from "./ClaudeProvider.ts";
|
||||
import { CodexProviderLive } from "./CodexProvider.ts";
|
||||
import type { ClaudeProviderShape } from "../Services/ClaudeProvider.ts";
|
||||
import { ClaudeProvider } from "../Services/ClaudeProvider.ts";
|
||||
import type { CodexProviderShape } from "../Services/CodexProvider.ts";
|
||||
import { CodexProvider } from "../Services/CodexProvider.ts";
|
||||
import { ProviderRegistry, type ProviderRegistryShape } from "../Services/ProviderRegistry.ts";
|
||||
import {
|
||||
hydrateCachedProvider,
|
||||
PROVIDER_CACHE_IDS,
|
||||
@@ -21,7 +21,7 @@ import {
|
||||
readProviderStatusCache,
|
||||
resolveProviderStatusCachePath,
|
||||
writeProviderStatusCache,
|
||||
} from "../providerStatusCache";
|
||||
} from "../providerStatusCache.ts";
|
||||
|
||||
const loadProviders = (
|
||||
codexProvider: CodexProviderShape,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Context } from "effect";
|
||||
|
||||
import type { ServerProviderShape } from "./ServerProvider";
|
||||
import type { ServerProviderShape } from "./ServerProvider.ts";
|
||||
|
||||
export interface ClaudeProviderShape extends ServerProviderShape {}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Context } from "effect";
|
||||
|
||||
import type { ServerProviderShape } from "./ServerProvider";
|
||||
import type { ServerProviderShape } from "./ServerProvider.ts";
|
||||
|
||||
export interface CodexProviderShape extends ServerProviderShape {}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { assert, describe, it } from "@effect/vitest";
|
||||
|
||||
import { compareCliVersions, normalizeCliVersion } from "./cliVersion";
|
||||
import { compareCliVersions, normalizeCliVersion } from "./cliVersion.ts";
|
||||
|
||||
describe("cliVersion", () => {
|
||||
it("normalizes versions with a missing patch segment", () => {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { spawn, spawnSync, type ChildProcessWithoutNullStreams } from "node:child_process";
|
||||
import readline from "node:readline";
|
||||
import type { ServerProviderSkill } from "@t3tools/contracts";
|
||||
import { readCodexAccountSnapshot, type CodexAccountSnapshot } from "./codexAccount";
|
||||
import { readCodexAccountSnapshot, type CodexAccountSnapshot } from "./codexAccount.ts";
|
||||
|
||||
interface JsonRpcProbeResponse {
|
||||
readonly id?: unknown;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { compareCliVersions, normalizeCliVersion } from "./cliVersion";
|
||||
import { compareCliVersions, normalizeCliVersion } from "./cliVersion.ts";
|
||||
|
||||
const CODEX_VERSION_PATTERN = /\bv?(\d+\.\d+(?:\.\d+)?(?:-[0-9A-Za-z.-]+)?)\b/;
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ import type { ServerProvider } from "@t3tools/contracts";
|
||||
import { Duration, Effect, PubSub, Ref, Scope, Stream } from "effect";
|
||||
import * as Semaphore from "effect/Semaphore";
|
||||
|
||||
import type { ServerProviderShape } from "./Services/ServerProvider";
|
||||
import type { ServerProviderShape } from "./Services/ServerProvider.ts";
|
||||
import { ServerSettingsError } from "@t3tools/contracts";
|
||||
|
||||
export const makeManagedServerProvider = Effect.fn("makeManagedServerProvider")(function* <
|
||||
|
||||
@@ -10,7 +10,7 @@ import type {
|
||||
import { Effect, Stream } from "effect";
|
||||
import { ChildProcess, ChildProcessSpawner } from "effect/unstable/process";
|
||||
import { normalizeModelSlug } from "@t3tools/shared/model";
|
||||
import { isWindowsCommandNotFound } from "../processRunner";
|
||||
import { isWindowsCommandNotFound } from "../processRunner.ts";
|
||||
|
||||
export const DEFAULT_TIMEOUT_MS = 4_000;
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ import {
|
||||
readProviderStatusCache,
|
||||
resolveProviderStatusCachePath,
|
||||
writeProviderStatusCache,
|
||||
} from "./providerStatusCache";
|
||||
} from "./providerStatusCache.ts";
|
||||
|
||||
const makeProvider = (
|
||||
provider: ServerProvider["provider"],
|
||||
|
||||
+49
-49
@@ -1,7 +1,7 @@
|
||||
import { Effect, Layer } from "effect";
|
||||
import { FetchHttpClient, HttpRouter, HttpServer } from "effect/unstable/http";
|
||||
|
||||
import { ServerConfig } from "./config";
|
||||
import { ServerConfig } from "./config.ts";
|
||||
import {
|
||||
attachmentsRouteLayer,
|
||||
otlpTracesProxyRouteLayer,
|
||||
@@ -9,46 +9,46 @@ import {
|
||||
serverEnvironmentRouteLayer,
|
||||
staticAndDevRouteLayer,
|
||||
browserApiCorsLayer,
|
||||
} from "./http";
|
||||
import { fixPath } from "./os-jank";
|
||||
import { websocketRpcRouteLayer } from "./ws";
|
||||
import { OpenLive } from "./open";
|
||||
import { layerConfig as SqlitePersistenceLayerLive } from "./persistence/Layers/Sqlite";
|
||||
import { ServerLifecycleEventsLive } from "./serverLifecycleEvents";
|
||||
import { AnalyticsServiceLayerLive } from "./telemetry/Layers/AnalyticsService";
|
||||
import { makeEventNdjsonLogger } from "./provider/Layers/EventNdjsonLogger";
|
||||
import { ProviderSessionDirectoryLive } from "./provider/Layers/ProviderSessionDirectory";
|
||||
import { ProviderSessionRuntimeRepositoryLive } from "./persistence/Layers/ProviderSessionRuntime";
|
||||
import { makeCodexAdapterLive } from "./provider/Layers/CodexAdapter";
|
||||
import { makeClaudeAdapterLive } from "./provider/Layers/ClaudeAdapter";
|
||||
import { ProviderAdapterRegistryLive } from "./provider/Layers/ProviderAdapterRegistry";
|
||||
import { makeProviderServiceLive } from "./provider/Layers/ProviderService";
|
||||
import { ProviderSessionReaperLive } from "./provider/Layers/ProviderSessionReaper";
|
||||
import { CheckpointDiffQueryLive } from "./checkpointing/Layers/CheckpointDiffQuery";
|
||||
import { CheckpointStoreLive } from "./checkpointing/Layers/CheckpointStore";
|
||||
import { GitCoreLive } from "./git/Layers/GitCore";
|
||||
import { GitHubCliLive } from "./git/Layers/GitHubCli";
|
||||
import { GitStatusBroadcasterLive } from "./git/Layers/GitStatusBroadcaster";
|
||||
import { RoutingTextGenerationLive } from "./git/Layers/RoutingTextGeneration";
|
||||
import { TerminalManagerLive } from "./terminal/Layers/Manager";
|
||||
import { GitManagerLive } from "./git/Layers/GitManager";
|
||||
import { KeybindingsLive } from "./keybindings";
|
||||
import { ServerRuntimeStartup, ServerRuntimeStartupLive } from "./serverRuntimeStartup";
|
||||
import { OrchestrationReactorLive } from "./orchestration/Layers/OrchestrationReactor";
|
||||
import { RuntimeReceiptBusLive } from "./orchestration/Layers/RuntimeReceiptBus";
|
||||
import { ProviderRuntimeIngestionLive } from "./orchestration/Layers/ProviderRuntimeIngestion";
|
||||
import { ProviderCommandReactorLive } from "./orchestration/Layers/ProviderCommandReactor";
|
||||
import { CheckpointReactorLive } from "./orchestration/Layers/CheckpointReactor";
|
||||
import { ProviderRegistryLive } from "./provider/Layers/ProviderRegistry";
|
||||
import { ServerSettingsLive } from "./serverSettings";
|
||||
import { ProjectFaviconResolverLive } from "./project/Layers/ProjectFaviconResolver";
|
||||
import { RepositoryIdentityResolverLive } from "./project/Layers/RepositoryIdentityResolver";
|
||||
import { WorkspaceEntriesLive } from "./workspace/Layers/WorkspaceEntries";
|
||||
import { WorkspaceFileSystemLive } from "./workspace/Layers/WorkspaceFileSystem";
|
||||
import { WorkspacePathsLive } from "./workspace/Layers/WorkspacePaths";
|
||||
import { ProjectSetupScriptRunnerLive } from "./project/Layers/ProjectSetupScriptRunner";
|
||||
import { ObservabilityLive } from "./observability/Layers/Observability";
|
||||
import { ServerEnvironmentLive } from "./environment/Layers/ServerEnvironment";
|
||||
} from "./http.ts";
|
||||
import { fixPath } from "./os-jank.ts";
|
||||
import { websocketRpcRouteLayer } from "./ws.ts";
|
||||
import { OpenLive } from "./open.ts";
|
||||
import { layerConfig as SqlitePersistenceLayerLive } from "./persistence/Layers/Sqlite.ts";
|
||||
import { ServerLifecycleEventsLive } from "./serverLifecycleEvents.ts";
|
||||
import { AnalyticsServiceLayerLive } from "./telemetry/Layers/AnalyticsService.ts";
|
||||
import { makeEventNdjsonLogger } from "./provider/Layers/EventNdjsonLogger.ts";
|
||||
import { ProviderSessionDirectoryLive } from "./provider/Layers/ProviderSessionDirectory.ts";
|
||||
import { ProviderSessionRuntimeRepositoryLive } from "./persistence/Layers/ProviderSessionRuntime.ts";
|
||||
import { makeCodexAdapterLive } from "./provider/Layers/CodexAdapter.ts";
|
||||
import { makeClaudeAdapterLive } from "./provider/Layers/ClaudeAdapter.ts";
|
||||
import { ProviderAdapterRegistryLive } from "./provider/Layers/ProviderAdapterRegistry.ts";
|
||||
import { makeProviderServiceLive } from "./provider/Layers/ProviderService.ts";
|
||||
import { ProviderSessionReaperLive } from "./provider/Layers/ProviderSessionReaper.ts";
|
||||
import { CheckpointDiffQueryLive } from "./checkpointing/Layers/CheckpointDiffQuery.ts";
|
||||
import { CheckpointStoreLive } from "./checkpointing/Layers/CheckpointStore.ts";
|
||||
import { GitCoreLive } from "./git/Layers/GitCore.ts";
|
||||
import { GitHubCliLive } from "./git/Layers/GitHubCli.ts";
|
||||
import { GitStatusBroadcasterLive } from "./git/Layers/GitStatusBroadcaster.ts";
|
||||
import { RoutingTextGenerationLive } from "./git/Layers/RoutingTextGeneration.ts";
|
||||
import { TerminalManagerLive } from "./terminal/Layers/Manager.ts";
|
||||
import { GitManagerLive } from "./git/Layers/GitManager.ts";
|
||||
import { KeybindingsLive } from "./keybindings.ts";
|
||||
import { ServerRuntimeStartup, ServerRuntimeStartupLive } from "./serverRuntimeStartup.ts";
|
||||
import { OrchestrationReactorLive } from "./orchestration/Layers/OrchestrationReactor.ts";
|
||||
import { RuntimeReceiptBusLive } from "./orchestration/Layers/RuntimeReceiptBus.ts";
|
||||
import { ProviderRuntimeIngestionLive } from "./orchestration/Layers/ProviderRuntimeIngestion.ts";
|
||||
import { ProviderCommandReactorLive } from "./orchestration/Layers/ProviderCommandReactor.ts";
|
||||
import { CheckpointReactorLive } from "./orchestration/Layers/CheckpointReactor.ts";
|
||||
import { ProviderRegistryLive } from "./provider/Layers/ProviderRegistry.ts";
|
||||
import { ServerSettingsLive } from "./serverSettings.ts";
|
||||
import { ProjectFaviconResolverLive } from "./project/Layers/ProjectFaviconResolver.ts";
|
||||
import { RepositoryIdentityResolverLive } from "./project/Layers/RepositoryIdentityResolver.ts";
|
||||
import { WorkspaceEntriesLive } from "./workspace/Layers/WorkspaceEntries.ts";
|
||||
import { WorkspaceFileSystemLive } from "./workspace/Layers/WorkspaceFileSystem.ts";
|
||||
import { WorkspacePathsLive } from "./workspace/Layers/WorkspacePaths.ts";
|
||||
import { ProjectSetupScriptRunnerLive } from "./project/Layers/ProjectSetupScriptRunner.ts";
|
||||
import { ObservabilityLive } from "./observability/Layers/Observability.ts";
|
||||
import { ServerEnvironmentLive } from "./environment/Layers/ServerEnvironment.ts";
|
||||
import {
|
||||
authBearerBootstrapRouteLayer,
|
||||
authBootstrapRouteLayer,
|
||||
@@ -60,27 +60,27 @@ import {
|
||||
authPairingCredentialRouteLayer,
|
||||
authSessionRouteLayer,
|
||||
authWebSocketTokenRouteLayer,
|
||||
} from "./auth/http";
|
||||
import { ServerSecretStoreLive } from "./auth/Layers/ServerSecretStore";
|
||||
import { ServerAuthLive } from "./auth/Layers/ServerAuth";
|
||||
import { OrchestrationLayerLive } from "./orchestration/runtimeLayer";
|
||||
} from "./auth/http.ts";
|
||||
import { ServerSecretStoreLive } from "./auth/Layers/ServerSecretStore.ts";
|
||||
import { ServerAuthLive } from "./auth/Layers/ServerAuth.ts";
|
||||
import { OrchestrationLayerLive } from "./orchestration/runtimeLayer.ts";
|
||||
import {
|
||||
clearPersistedServerRuntimeState,
|
||||
makePersistedServerRuntimeState,
|
||||
persistServerRuntimeState,
|
||||
} from "./serverRuntimeState";
|
||||
} from "./serverRuntimeState.ts";
|
||||
import {
|
||||
orchestrationDispatchRouteLayer,
|
||||
orchestrationSnapshotRouteLayer,
|
||||
} from "./orchestration/http";
|
||||
} from "./orchestration/http.ts";
|
||||
|
||||
const PtyAdapterLive = Layer.unwrap(
|
||||
Effect.gen(function* () {
|
||||
if (typeof Bun !== "undefined") {
|
||||
const BunPTY = yield* Effect.promise(() => import("./terminal/Layers/BunPTY"));
|
||||
const BunPTY = yield* Effect.promise(() => import("./terminal/Layers/BunPTY.ts"));
|
||||
return BunPTY.layer;
|
||||
} else {
|
||||
const NodePTY = yield* Effect.promise(() => import("./terminal/Layers/NodePTY"));
|
||||
const NodePTY = yield* Effect.promise(() => import("./terminal/Layers/NodePTY.ts"));
|
||||
return NodePTY.layer;
|
||||
}
|
||||
}),
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Effect, Logger, References, Layer } from "effect";
|
||||
|
||||
import { ServerConfig } from "./config";
|
||||
import { ServerConfig } from "./config.ts";
|
||||
|
||||
export const ServerLoggerLive = Effect.gen(function* () {
|
||||
const config = yield* ServerConfig;
|
||||
|
||||
@@ -21,24 +21,24 @@ import {
|
||||
Console,
|
||||
} from "effect";
|
||||
|
||||
import { ServerConfig } from "./config";
|
||||
import { Keybindings } from "./keybindings";
|
||||
import { Open } from "./open";
|
||||
import { OrchestrationEngineService } from "./orchestration/Services/OrchestrationEngine";
|
||||
import { ProjectionSnapshotQuery } from "./orchestration/Services/ProjectionSnapshotQuery";
|
||||
import { OrchestrationReactor } from "./orchestration/Services/OrchestrationReactor";
|
||||
import { ServerLifecycleEvents } from "./serverLifecycleEvents";
|
||||
import { ServerSettingsService } from "./serverSettings";
|
||||
import { ServerEnvironment } from "./environment/Services/ServerEnvironment";
|
||||
import { AnalyticsService } from "./telemetry/Services/AnalyticsService";
|
||||
import { ServerAuth } from "./auth/Services/ServerAuth";
|
||||
import { ProviderSessionReaper } from "./provider/Services/ProviderSessionReaper";
|
||||
import { ServerConfig } from "./config.ts";
|
||||
import { Keybindings } from "./keybindings.ts";
|
||||
import { Open } from "./open.ts";
|
||||
import { OrchestrationEngineService } from "./orchestration/Services/OrchestrationEngine.ts";
|
||||
import { ProjectionSnapshotQuery } from "./orchestration/Services/ProjectionSnapshotQuery.ts";
|
||||
import { OrchestrationReactor } from "./orchestration/Services/OrchestrationReactor.ts";
|
||||
import { ServerLifecycleEvents } from "./serverLifecycleEvents.ts";
|
||||
import { ServerSettingsService } from "./serverSettings.ts";
|
||||
import { ServerEnvironment } from "./environment/Services/ServerEnvironment.ts";
|
||||
import { AnalyticsService } from "./telemetry/Services/AnalyticsService.ts";
|
||||
import { ServerAuth } from "./auth/Services/ServerAuth.ts";
|
||||
import { ProviderSessionReaper } from "./provider/Services/ProviderSessionReaper.ts";
|
||||
import {
|
||||
formatHeadlessServeOutput,
|
||||
formatHostForUrl,
|
||||
isWildcardHost,
|
||||
issueHeadlessServeAccessInfo,
|
||||
} from "./startupAccess";
|
||||
} from "./startupAccess.ts";
|
||||
|
||||
export class ServerRuntimeStartupError extends Data.TaggedError("ServerRuntimeStartupError")<{
|
||||
readonly message: string;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Effect, FileSystem, Option, Path, Schema } from "effect";
|
||||
|
||||
import { type ServerConfigShape } from "./config";
|
||||
import { formatHostForUrl, isWildcardHost } from "./startupAccess";
|
||||
import { type ServerConfigShape } from "./config.ts";
|
||||
import { formatHostForUrl, isWildcardHost } from "./startupAccess.ts";
|
||||
|
||||
export const PersistedServerRuntimeState = Schema.Struct({
|
||||
version: Schema.Literal(1),
|
||||
|
||||
@@ -2,8 +2,8 @@ import * as NodeServices from "@effect/platform-node/NodeServices";
|
||||
import { DEFAULT_SERVER_SETTINGS, ServerSettingsPatch } from "@t3tools/contracts";
|
||||
import { assert, it } from "@effect/vitest";
|
||||
import { Effect, FileSystem, Layer, Schema } from "effect";
|
||||
import { ServerConfig } from "./config";
|
||||
import { ServerSettingsLive, ServerSettingsService } from "./serverSettings";
|
||||
import { ServerConfig } from "./config.ts";
|
||||
import { ServerSettingsLive, ServerSettingsService } from "./serverSettings.ts";
|
||||
|
||||
const makeServerSettingsLayer = () =>
|
||||
ServerSettingsLive.pipe(
|
||||
|
||||
@@ -39,7 +39,7 @@ import {
|
||||
Cause,
|
||||
} from "effect";
|
||||
import * as Semaphore from "effect/Semaphore";
|
||||
import { ServerConfig } from "./config";
|
||||
import { ServerConfig } from "./config.ts";
|
||||
import { type DeepPartial, deepMerge } from "@t3tools/shared/Struct";
|
||||
import { fromLenientJson } from "@t3tools/shared/schemaJson";
|
||||
import { applyServerSettingsPatch } from "@t3tools/shared/serverSettings";
|
||||
|
||||
@@ -7,7 +7,7 @@ import {
|
||||
resolveHeadlessConnectionHost,
|
||||
resolveHeadlessConnectionString,
|
||||
resolveListeningPort,
|
||||
} from "./startupAccess";
|
||||
} from "./startupAccess.ts";
|
||||
|
||||
it("prefers localhost when no explicit host is configured", () => {
|
||||
expect(resolveHeadlessConnectionHost(undefined)).toBe("localhost");
|
||||
|
||||
@@ -4,8 +4,8 @@ import { QrCode } from "@t3tools/shared/qrCode";
|
||||
import { Effect } from "effect";
|
||||
import { HttpServer } from "effect/unstable/http";
|
||||
|
||||
import { ServerConfig } from "./config";
|
||||
import { ServerAuth } from "./auth/Services/ServerAuth";
|
||||
import { ServerConfig } from "./config.ts";
|
||||
import { ServerAuth } from "./auth/Services/ServerAuth.ts";
|
||||
|
||||
export interface HeadlessServeAccessInfo {
|
||||
readonly connectionString: string;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Effect, FileSystem, Path, Random, Schema } from "effect";
|
||||
import * as Crypto from "node:crypto";
|
||||
import { homedir } from "node:os";
|
||||
import { ServerConfig } from "../config";
|
||||
import { ServerConfig } from "../config.ts";
|
||||
|
||||
const CodexAuthJsonSchema = Schema.Struct({
|
||||
tokens: Schema.Struct({
|
||||
|
||||
@@ -13,7 +13,7 @@ import { HttpClient, HttpClientRequest, HttpClientResponse } from "effect/unstab
|
||||
import { ServerConfig } from "../../config.ts";
|
||||
import { AnalyticsService, type AnalyticsServiceShape } from "../Services/AnalyticsService.ts";
|
||||
import { getTelemetryIdentifier } from "../Identify.ts";
|
||||
import { version } from "../../../package.json" with { type: "json" };
|
||||
import packageJson from "../../../package.json" with { type: "json" };
|
||||
|
||||
interface BufferedAnalyticsEvent {
|
||||
readonly event: string;
|
||||
@@ -86,7 +86,7 @@ const makeAnalyticsService = Effect.gen(function* () {
|
||||
platform: process.platform,
|
||||
wsl: process.env.WSL_DISTRO_NAME,
|
||||
arch: process.arch,
|
||||
t3CodeVersion: version,
|
||||
t3CodeVersion: packageJson.version,
|
||||
clientType,
|
||||
},
|
||||
timestamp: event.capturedAt,
|
||||
|
||||
@@ -1,13 +1,16 @@
|
||||
import { Effect, Layer } from "effect";
|
||||
import { PtyAdapter, PtyAdapterShape, PtyExitEvent, PtyProcess } from "../Services/PTY";
|
||||
import { PtyAdapter } from "../Services/PTY.ts";
|
||||
import type { PtyAdapterShape, PtyExitEvent, PtyProcess } from "../Services/PTY.ts";
|
||||
|
||||
class BunPtyProcess implements PtyProcess {
|
||||
private readonly dataListeners = new Set<(data: string) => void>();
|
||||
private readonly exitListeners = new Set<(event: PtyExitEvent) => void>();
|
||||
private readonly decoder = new TextDecoder();
|
||||
private readonly process: Bun.Subprocess;
|
||||
private didExit = false;
|
||||
|
||||
constructor(private readonly process: Bun.Subprocess) {
|
||||
constructor(process: Bun.Subprocess) {
|
||||
this.process = process;
|
||||
void this.process.exited
|
||||
.then((exitCode) => {
|
||||
this.emitExit({
|
||||
|
||||
@@ -24,25 +24,28 @@ import {
|
||||
import { TestClock } from "effect/testing";
|
||||
import { expect } from "vitest";
|
||||
|
||||
import type { TerminalManagerShape } from "../Services/Manager";
|
||||
import type { TerminalManagerShape } from "../Services/Manager.ts";
|
||||
import {
|
||||
type PtyAdapterShape,
|
||||
type PtyExitEvent,
|
||||
type PtyProcess,
|
||||
type PtySpawnInput,
|
||||
PtySpawnError,
|
||||
} from "../Services/PTY";
|
||||
import { makeTerminalManagerWithOptions } from "./Manager";
|
||||
} from "../Services/PTY.ts";
|
||||
import { makeTerminalManagerWithOptions } from "./Manager.ts";
|
||||
|
||||
class FakePtyProcess implements PtyProcess {
|
||||
readonly writes: string[] = [];
|
||||
readonly resizeCalls: Array<{ cols: number; rows: number }> = [];
|
||||
readonly killSignals: Array<string | undefined> = [];
|
||||
readonly pid: number;
|
||||
private readonly dataListeners = new Set<(data: string) => void>();
|
||||
private readonly exitListeners = new Set<(event: PtyExitEvent) => void>();
|
||||
killed = false;
|
||||
|
||||
constructor(readonly pid: number) {}
|
||||
constructor(pid: number) {
|
||||
this.pid = pid;
|
||||
}
|
||||
|
||||
write(data: string): void {
|
||||
this.writes.push(data);
|
||||
@@ -88,9 +91,12 @@ class FakePtyAdapter implements PtyAdapterShape {
|
||||
readonly spawnInputs: PtySpawnInput[] = [];
|
||||
readonly processes: FakePtyProcess[] = [];
|
||||
readonly spawnFailures: Error[] = [];
|
||||
private readonly mode: "sync" | "async";
|
||||
private nextPid = 9000;
|
||||
|
||||
constructor(private readonly mode: "sync" | "async" = "sync") {}
|
||||
constructor(mode: "sync" | "async" = "sync") {
|
||||
this.mode = mode;
|
||||
}
|
||||
|
||||
spawn(input: PtySpawnInput): Effect.Effect<PtyProcess, PtySpawnError> {
|
||||
this.spawnInputs.push(input);
|
||||
|
||||
@@ -22,13 +22,13 @@ import {
|
||||
SynchronizedRef,
|
||||
} from "effect";
|
||||
|
||||
import { ServerConfig } from "../../config";
|
||||
import { ServerConfig } from "../../config.ts";
|
||||
import {
|
||||
increment,
|
||||
terminalRestartsTotal,
|
||||
terminalSessionsTotal,
|
||||
} from "../../observability/Metrics";
|
||||
import { runProcess } from "../../processRunner";
|
||||
} from "../../observability/Metrics.ts";
|
||||
import { runProcess } from "../../processRunner.ts";
|
||||
import {
|
||||
TerminalCwdError,
|
||||
TerminalHistoryError,
|
||||
@@ -36,14 +36,14 @@ import {
|
||||
TerminalNotRunningError,
|
||||
TerminalSessionLookupError,
|
||||
type TerminalManagerShape,
|
||||
} from "../Services/Manager";
|
||||
} from "../Services/Manager.ts";
|
||||
import {
|
||||
PtyAdapter,
|
||||
PtySpawnError,
|
||||
type PtyAdapterShape,
|
||||
type PtyExitEvent,
|
||||
type PtyProcess,
|
||||
} from "../Services/PTY";
|
||||
} from "../Services/PTY.ts";
|
||||
|
||||
const DEFAULT_HISTORY_LINE_LIMIT = 5_000;
|
||||
const DEFAULT_PERSIST_DEBOUNCE_MS = 40;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { FileSystem, Path, Effect } from "effect";
|
||||
import { assert, it } from "@effect/vitest";
|
||||
|
||||
import { ensureNodePtySpawnHelperExecutable } from "./NodePTY";
|
||||
import { ensureNodePtySpawnHelperExecutable } from "./NodePTY.ts";
|
||||
import * as NodeServices from "@effect/platform-node/NodeServices";
|
||||
|
||||
it.layer(NodeServices.layer)("ensureNodePtySpawnHelperExecutable", (it) => {
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
import { createRequire } from "node:module";
|
||||
|
||||
import { Effect, FileSystem, Layer, Path } from "effect";
|
||||
import { PtyAdapter, PtyAdapterShape, PtyExitEvent, PtyProcess } from "../Services/PTY";
|
||||
import { PtyAdapter } from "../Services/PTY.ts";
|
||||
import type { PtyAdapterShape, PtyExitEvent, PtyProcess } from "../Services/PTY.ts";
|
||||
|
||||
let didEnsureSpawnHelperExecutable = false;
|
||||
|
||||
@@ -46,7 +47,11 @@ export const ensureNodePtySpawnHelperExecutable = Effect.fn(function* (explicitP
|
||||
});
|
||||
|
||||
class NodePtyProcess implements PtyProcess {
|
||||
constructor(private readonly process: import("node-pty").IPty) {}
|
||||
private readonly process: import("node-pty").IPty;
|
||||
|
||||
constructor(process: import("node-pty").IPty) {
|
||||
this.process = process;
|
||||
}
|
||||
|
||||
get pid(): number {
|
||||
return this.process.pid;
|
||||
|
||||
@@ -22,7 +22,7 @@ import {
|
||||
TerminalSessionStatus,
|
||||
TerminalWriteInput,
|
||||
} from "@t3tools/contracts";
|
||||
import { PtyProcess } from "./PTY";
|
||||
import type { PtyProcess } from "./PTY.ts";
|
||||
import { Effect, Context } from "effect";
|
||||
|
||||
export {
|
||||
|
||||
+26
-26
@@ -27,42 +27,42 @@ import { clamp } from "effect/Number";
|
||||
import { HttpRouter, HttpServerRequest } from "effect/unstable/http";
|
||||
import { RpcSerialization, RpcServer } from "effect/unstable/rpc";
|
||||
|
||||
import { CheckpointDiffQuery } from "./checkpointing/Services/CheckpointDiffQuery";
|
||||
import { ServerConfig } from "./config";
|
||||
import { GitCore } from "./git/Services/GitCore";
|
||||
import { GitManager } from "./git/Services/GitManager";
|
||||
import { GitStatusBroadcaster } from "./git/Services/GitStatusBroadcaster";
|
||||
import { Keybindings } from "./keybindings";
|
||||
import { Open, resolveAvailableEditors } from "./open";
|
||||
import { normalizeDispatchCommand } from "./orchestration/Normalizer";
|
||||
import { OrchestrationEngineService } from "./orchestration/Services/OrchestrationEngine";
|
||||
import { ProjectionSnapshotQuery } from "./orchestration/Services/ProjectionSnapshotQuery";
|
||||
import { CheckpointDiffQuery } from "./checkpointing/Services/CheckpointDiffQuery.ts";
|
||||
import { ServerConfig } from "./config.ts";
|
||||
import { GitCore } from "./git/Services/GitCore.ts";
|
||||
import { GitManager } from "./git/Services/GitManager.ts";
|
||||
import { GitStatusBroadcaster } from "./git/Services/GitStatusBroadcaster.ts";
|
||||
import { Keybindings } from "./keybindings.ts";
|
||||
import { Open, resolveAvailableEditors } from "./open.ts";
|
||||
import { normalizeDispatchCommand } from "./orchestration/Normalizer.ts";
|
||||
import { OrchestrationEngineService } from "./orchestration/Services/OrchestrationEngine.ts";
|
||||
import { ProjectionSnapshotQuery } from "./orchestration/Services/ProjectionSnapshotQuery.ts";
|
||||
import {
|
||||
observeRpcEffect,
|
||||
observeRpcStream,
|
||||
observeRpcStreamEffect,
|
||||
} from "./observability/RpcInstrumentation";
|
||||
import { ProviderRegistry } from "./provider/Services/ProviderRegistry";
|
||||
import { ServerLifecycleEvents } from "./serverLifecycleEvents";
|
||||
import { ServerRuntimeStartup } from "./serverRuntimeStartup";
|
||||
import { ServerSettingsService } from "./serverSettings";
|
||||
import { TerminalManager } from "./terminal/Services/Manager";
|
||||
import { WorkspaceEntries } from "./workspace/Services/WorkspaceEntries";
|
||||
import { WorkspaceFileSystem } from "./workspace/Services/WorkspaceFileSystem";
|
||||
import { WorkspacePathOutsideRootError } from "./workspace/Services/WorkspacePaths";
|
||||
import { ProjectSetupScriptRunner } from "./project/Services/ProjectSetupScriptRunner";
|
||||
import { RepositoryIdentityResolver } from "./project/Services/RepositoryIdentityResolver";
|
||||
import { ServerEnvironment } from "./environment/Services/ServerEnvironment";
|
||||
import { ServerAuth } from "./auth/Services/ServerAuth";
|
||||
} from "./observability/RpcInstrumentation.ts";
|
||||
import { ProviderRegistry } from "./provider/Services/ProviderRegistry.ts";
|
||||
import { ServerLifecycleEvents } from "./serverLifecycleEvents.ts";
|
||||
import { ServerRuntimeStartup } from "./serverRuntimeStartup.ts";
|
||||
import { ServerSettingsService } from "./serverSettings.ts";
|
||||
import { TerminalManager } from "./terminal/Services/Manager.ts";
|
||||
import { WorkspaceEntries } from "./workspace/Services/WorkspaceEntries.ts";
|
||||
import { WorkspaceFileSystem } from "./workspace/Services/WorkspaceFileSystem.ts";
|
||||
import { WorkspacePathOutsideRootError } from "./workspace/Services/WorkspacePaths.ts";
|
||||
import { ProjectSetupScriptRunner } from "./project/Services/ProjectSetupScriptRunner.ts";
|
||||
import { RepositoryIdentityResolver } from "./project/Services/RepositoryIdentityResolver.ts";
|
||||
import { ServerEnvironment } from "./environment/Services/ServerEnvironment.ts";
|
||||
import { ServerAuth } from "./auth/Services/ServerAuth.ts";
|
||||
import {
|
||||
BootstrapCredentialService,
|
||||
type BootstrapCredentialChange,
|
||||
} from "./auth/Services/BootstrapCredentialService";
|
||||
} from "./auth/Services/BootstrapCredentialService.ts";
|
||||
import {
|
||||
SessionCredentialService,
|
||||
type SessionCredentialChange,
|
||||
} from "./auth/Services/SessionCredentialService";
|
||||
import { respondToAuthError } from "./auth/http";
|
||||
} from "./auth/Services/SessionCredentialService.ts";
|
||||
import { respondToAuthError } from "./auth/http.ts";
|
||||
|
||||
function isThreadDetailEvent(event: OrchestrationEvent): event is Extract<
|
||||
OrchestrationEvent,
|
||||
|
||||
@@ -3,9 +3,7 @@
|
||||
"compilerOptions": {
|
||||
"composite": true,
|
||||
"types": ["node", "bun"],
|
||||
"lib": ["ES2023", "esnext.disposable"],
|
||||
"noEmit": true,
|
||||
"allowImportingTsExtensions": true,
|
||||
"lib": ["ESNext", "esnext.disposable"],
|
||||
"plugins": [
|
||||
{
|
||||
"name": "@effect/language-service",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { defineConfig, mergeConfig } from "vitest/config";
|
||||
|
||||
import baseConfig from "../../vitest.config";
|
||||
import baseConfig from "../../vitest.config.ts";
|
||||
|
||||
export default mergeConfig(
|
||||
baseConfig,
|
||||
|
||||
@@ -2,6 +2,10 @@
|
||||
"extends": "../../tsconfig.base.json",
|
||||
"compilerOptions": {
|
||||
"composite": true,
|
||||
"module": "Preserve",
|
||||
"moduleResolution": "Bundler",
|
||||
"erasableSyntaxOnly": false,
|
||||
"verbatimModuleSyntax": false,
|
||||
"jsx": "react-jsx",
|
||||
"lib": ["ES2023", "DOM", "DOM.Iterable"],
|
||||
"types": ["vite/client"],
|
||||
|
||||
@@ -69,11 +69,11 @@ npx t3
|
||||
```
|
||||
|
||||
```bash
|
||||
bun dev
|
||||
node --run dev
|
||||
```
|
||||
|
||||
```bash
|
||||
bun dev:desktop
|
||||
node --run dev:desktop
|
||||
```
|
||||
|
||||
### Option 2: Run With A Local LGTM Stack
|
||||
@@ -122,13 +122,13 @@ npx t3
|
||||
Monorepo web/server dev:
|
||||
|
||||
```bash
|
||||
bun dev
|
||||
node --run dev
|
||||
```
|
||||
|
||||
Monorepo desktop dev:
|
||||
|
||||
```bash
|
||||
bun dev:desktop
|
||||
node --run dev:desktop
|
||||
```
|
||||
|
||||
Packaged desktop app:
|
||||
|
||||
+1
-2
@@ -33,14 +33,13 @@
|
||||
"start": "turbo run start --filter=t3",
|
||||
"start:desktop": "turbo run start --filter=@t3tools/desktop",
|
||||
"start:marketing": "turbo run preview --filter=@t3tools/marketing",
|
||||
"start:mock-update-server": "bun run scripts/mock-update-server.ts",
|
||||
"start:mock-update-server": "node scripts/mock-update-server.ts",
|
||||
"build": "turbo run build",
|
||||
"build:marketing": "turbo run build --filter=@t3tools/marketing",
|
||||
"build:desktop": "turbo run build --filter=@t3tools/desktop --filter=t3",
|
||||
"typecheck": "turbo run typecheck",
|
||||
"lint": "oxlint --report-unused-disable-directives",
|
||||
"test": "turbo run test",
|
||||
"test:process-reaper": "bun run --cwd apps/server test:process-reaper",
|
||||
"test:desktop-smoke": "turbo run smoke-test --filter=@t3tools/desktop",
|
||||
"fmt": "oxfmt",
|
||||
"fmt:check": "oxfmt --check",
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
export * from "./knownEnvironment";
|
||||
export * from "./scoped";
|
||||
export * from "./knownEnvironment.ts";
|
||||
export * from "./scoped.ts";
|
||||
@@ -1,7 +1,7 @@
|
||||
import { EnvironmentId, ProjectId, ThreadId } from "@t3tools/contracts";
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
import { createKnownEnvironment, getKnownEnvironmentHttpBaseUrl } from "./knownEnvironment";
|
||||
import { createKnownEnvironment, getKnownEnvironmentHttpBaseUrl } from "./knownEnvironment.ts";
|
||||
import {
|
||||
parseScopedProjectKey,
|
||||
parseScopedThreadKey,
|
||||
@@ -10,7 +10,7 @@ import {
|
||||
scopedThreadKey,
|
||||
scopeProjectRef,
|
||||
scopeThreadRef,
|
||||
} from "./scoped";
|
||||
} from "./scoped.ts";
|
||||
|
||||
describe("known environment bootstrap helpers", () => {
|
||||
it("creates known environments from explicit server base urls", () => {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Schema } from "effect";
|
||||
|
||||
import { AuthSessionId, TrimmedNonEmptyString } from "./baseSchemas";
|
||||
import { AuthSessionId, TrimmedNonEmptyString } from "./baseSchemas.ts";
|
||||
|
||||
/**
|
||||
* Declares the server's overall authentication posture.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Schema } from "effect";
|
||||
import { TrimmedNonEmptyString } from "./baseSchemas";
|
||||
import { TrimmedNonEmptyString } from "./baseSchemas.ts";
|
||||
|
||||
export const EditorLaunchStyle = Schema.Literals(["direct-path", "goto", "line-column"]);
|
||||
export type EditorLaunchStyle = typeof EditorLaunchStyle.Type;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Effect, Schema } from "effect";
|
||||
|
||||
import { EnvironmentId, ProjectId, ThreadId, TrimmedNonEmptyString } from "./baseSchemas";
|
||||
import { EnvironmentId, ProjectId, ThreadId, TrimmedNonEmptyString } from "./baseSchemas.ts";
|
||||
|
||||
export const ExecutionEnvironmentPlatformOs = Schema.Literals([
|
||||
"darwin",
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Schema } from "effect";
|
||||
import { TrimmedNonEmptyString } from "./baseSchemas";
|
||||
import { TrimmedNonEmptyString } from "./baseSchemas.ts";
|
||||
|
||||
const FILESYSTEM_PATH_MAX_LENGTH = 512;
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ import {
|
||||
GitRunStackedActionResult,
|
||||
GitRunStackedActionInput,
|
||||
GitResolvePullRequestResult,
|
||||
} from "./git";
|
||||
} from "./git.ts";
|
||||
|
||||
const decodeCreateWorktreeInput = Schema.decodeUnknownSync(GitCreateWorktreeInput);
|
||||
const decodePreparePullRequestThreadInput = Schema.decodeUnknownSync(
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Schema } from "effect";
|
||||
import { NonNegativeInt, PositiveInt, ThreadId, TrimmedNonEmptyString } from "./baseSchemas";
|
||||
import { NonNegativeInt, PositiveInt, ThreadId, TrimmedNonEmptyString } from "./baseSchemas.ts";
|
||||
|
||||
const TrimmedNonEmptyStringSchema = TrimmedNonEmptyString;
|
||||
const GIT_LIST_BRANCHES_MAX_LIMIT = 200;
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
export * from "./baseSchemas";
|
||||
export * from "./auth";
|
||||
export * from "./environment";
|
||||
export * from "./ipc";
|
||||
export * from "./terminal";
|
||||
export * from "./provider";
|
||||
export * from "./providerRuntime";
|
||||
export * from "./model";
|
||||
export * from "./keybindings";
|
||||
export * from "./server";
|
||||
export * from "./settings";
|
||||
export * from "./git";
|
||||
export * from "./orchestration";
|
||||
export * from "./editor";
|
||||
export * from "./project";
|
||||
export * from "./filesystem";
|
||||
export * from "./rpc";
|
||||
export * from "./baseSchemas.ts";
|
||||
export * from "./auth.ts";
|
||||
export * from "./environment.ts";
|
||||
export * from "./ipc.ts";
|
||||
export * from "./terminal.ts";
|
||||
export * from "./provider.ts";
|
||||
export * from "./providerRuntime.ts";
|
||||
export * from "./model.ts";
|
||||
export * from "./keybindings.ts";
|
||||
export * from "./server.ts";
|
||||
export * from "./settings.ts";
|
||||
export * from "./git.ts";
|
||||
export * from "./orchestration.ts";
|
||||
export * from "./editor.ts";
|
||||
export * from "./project.ts";
|
||||
export * from "./filesystem.ts";
|
||||
export * from "./rpc.ts";
|
||||
@@ -17,19 +17,19 @@ import type {
|
||||
GitStatusInput,
|
||||
GitStatusResult,
|
||||
GitCreateBranchResult,
|
||||
} from "./git";
|
||||
import type { FilesystemBrowseInput, FilesystemBrowseResult } from "./filesystem";
|
||||
} from "./git.ts";
|
||||
import type { FilesystemBrowseInput, FilesystemBrowseResult } from "./filesystem.ts";
|
||||
import type {
|
||||
ProjectSearchEntriesInput,
|
||||
ProjectSearchEntriesResult,
|
||||
ProjectWriteFileInput,
|
||||
ProjectWriteFileResult,
|
||||
} from "./project";
|
||||
} from "./project.ts";
|
||||
import type {
|
||||
ServerConfig,
|
||||
ServerProviderUpdatedPayload,
|
||||
ServerUpsertKeybindingResult,
|
||||
} from "./server";
|
||||
} from "./server.ts";
|
||||
import type {
|
||||
TerminalClearInput,
|
||||
TerminalCloseInput,
|
||||
@@ -39,8 +39,8 @@ import type {
|
||||
TerminalRestartInput,
|
||||
TerminalSessionSnapshot,
|
||||
TerminalWriteInput,
|
||||
} from "./terminal";
|
||||
import type { ServerUpsertKeybindingInput } from "./server";
|
||||
} from "./terminal.ts";
|
||||
import type { ServerUpsertKeybindingInput } from "./server.ts";
|
||||
import type {
|
||||
ClientOrchestrationCommand,
|
||||
OrchestrationGetFullThreadDiffInput,
|
||||
@@ -50,10 +50,10 @@ import type {
|
||||
OrchestrationShellStreamItem,
|
||||
OrchestrationSubscribeThreadInput,
|
||||
OrchestrationThreadStreamItem,
|
||||
} from "./orchestration";
|
||||
import type { EnvironmentId } from "./baseSchemas";
|
||||
import { EditorId } from "./editor";
|
||||
import { ClientSettings, ServerSettings, ServerSettingsPatch } from "./settings";
|
||||
} from "./orchestration.ts";
|
||||
import type { EnvironmentId } from "./baseSchemas.ts";
|
||||
import { EditorId } from "./editor.ts";
|
||||
import { ServerSettings, type ClientSettings, type ServerSettingsPatch } from "./settings.ts";
|
||||
|
||||
export interface ContextMenuItem<T extends string = string> {
|
||||
id: T;
|
||||
|
||||
@@ -7,7 +7,7 @@ import {
|
||||
KeybindingRule,
|
||||
ResolvedKeybindingRule,
|
||||
ResolvedKeybindingsConfig,
|
||||
} from "./keybindings";
|
||||
} from "./keybindings.ts";
|
||||
|
||||
const decode = <S extends Schema.Top>(
|
||||
schema: S,
|
||||
|
||||
Loaded 100 of 140 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user