fix dmg build, enable some lsp diagnostics
This commit is contained in:
1 parent
dc530f7a7e
commit
8f6b21a12e
71 files changed
+353
-148
No files matched your search
@@ -3,7 +3,7 @@ import os from "node:os";
|
||||
import path from "node:path";
|
||||
import { execFileSync } from "node:child_process";
|
||||
|
||||
import { NodeServices } from "@effect/platform-node";
|
||||
import * as NodeServices from "@effect/platform-node/NodeServices";
|
||||
import {
|
||||
ApprovalRequestId,
|
||||
type OrchestrationEvent,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { ProviderRuntimeEvent, ProviderSessionId } from "@t3tools/contracts";
|
||||
import { ThreadId } from "@t3tools/contracts";
|
||||
import { NodeServices } from "@effect/platform-node";
|
||||
import * as NodeServices from "@effect/platform-node/NodeServices";
|
||||
import { it, assert } from "@effect/vitest";
|
||||
import { Effect, FileSystem, Layer, Path, Queue, Stream } from "effect";
|
||||
|
||||
|
||||
@@ -18,17 +18,17 @@
|
||||
"test": "vitest run"
|
||||
},
|
||||
"dependencies": {
|
||||
"@effect/platform-node": "4.0.0-beta.10",
|
||||
"@effect/sql-sqlite-bun": "4.0.0-beta.10",
|
||||
"@effect/platform-node": "catalog:",
|
||||
"@effect/sql-sqlite-bun": "catalog:",
|
||||
"@pierre/diffs": "^1.1.0-beta.16",
|
||||
"effect": "4.0.0-beta.10",
|
||||
"effect": "catalog:",
|
||||
"node-pty": "^1.1.0",
|
||||
"open": "^10.1.0",
|
||||
"ws": "^8.18.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@effect/language-service": "0.75.1",
|
||||
"@effect/vitest": "4.0.0-beta.10",
|
||||
"@effect/vitest": "catalog:",
|
||||
"@t3tools/contracts": "workspace:*",
|
||||
"@t3tools/web": "workspace:*",
|
||||
"@types/bun": "^1.3.9",
|
||||
|
||||
@@ -46,4 +46,4 @@ export interface CheckpointDiffQueryShape {
|
||||
export class CheckpointDiffQuery extends ServiceMap.Service<
|
||||
CheckpointDiffQuery,
|
||||
CheckpointDiffQueryShape
|
||||
>()("checkpointing/CheckpointDiffQuery") {}
|
||||
>()("t3/checkpointing/Services/CheckpointDiffQuery") {}
|
||||
@@ -96,5 +96,5 @@ export interface CheckpointStoreShape {
|
||||
* CheckpointStore - Service tag for checkpoint persistence and restore operations.
|
||||
*/
|
||||
export class CheckpointStore extends ServiceMap.Service<CheckpointStore, CheckpointStoreShape>()(
|
||||
"checkpointing/CheckpointStore",
|
||||
"t3/checkpointing/Services/CheckpointStore",
|
||||
) {}
|
||||
@@ -35,7 +35,7 @@ export interface ServerConfigShape {
|
||||
* ServerConfig - Service tag for server runtime configuration.
|
||||
*/
|
||||
export class ServerConfig extends ServiceMap.Service<ServerConfig, ServerConfigShape>()(
|
||||
"server/ServerConfig",
|
||||
"t3/config/ServerConfig",
|
||||
) {}
|
||||
|
||||
// Helpers
|
||||
@@ -61,7 +61,7 @@ export interface NetServiceShape {
|
||||
* NetService - Service tag for startup networking helpers.
|
||||
*/
|
||||
export class NetService extends ServiceMap.Service<NetService, NetServiceShape>()(
|
||||
"server/NetService",
|
||||
"t3/config/NetService",
|
||||
) {
|
||||
static readonly layer = Layer.succeed(NetService, {
|
||||
findAvailablePort: (preferred) =>
|
||||
@@ -102,18 +102,18 @@ export class NetService extends ServiceMap.Service<NetService, NetServiceShape>(
|
||||
|
||||
export const resolveStaticDir = Effect.fn(function* () {
|
||||
const { join, resolve } = yield* Path.Path;
|
||||
const { stat } = yield* FileSystem.FileSystem;
|
||||
const { exists } = yield* FileSystem.FileSystem;
|
||||
const bundledClient = resolve(join(import.meta.dirname, "client"));
|
||||
const bundledStat = yield* stat(join(bundledClient, "index.html")).pipe(
|
||||
Effect.orElseSucceed(() => undefined),
|
||||
const bundledStat = yield* exists(join(bundledClient, "index.html")).pipe(
|
||||
Effect.orElseSucceed(() => false),
|
||||
);
|
||||
if (bundledStat) {
|
||||
return bundledClient;
|
||||
}
|
||||
|
||||
const monorepoClient = resolve(join(import.meta.dirname, "../../web/dist"));
|
||||
const monorepoStat = yield* stat(join(monorepoClient, "index.html")).pipe(
|
||||
Effect.orElseSucceed(() => undefined),
|
||||
const monorepoStat = yield* exists(join(monorepoClient, "index.html")).pipe(
|
||||
Effect.orElseSucceed(() => false),
|
||||
);
|
||||
if (monorepoStat) {
|
||||
return monorepoClient;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { NodeServices } from "@effect/platform-node";
|
||||
import * as NodeServices from "@effect/platform-node/NodeServices";
|
||||
import { it } from "@effect/vitest";
|
||||
import { Effect, FileSystem, Layer, Path } from "effect";
|
||||
import { expect } from "vitest";
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { existsSync } from "node:fs";
|
||||
import path from "node:path";
|
||||
|
||||
import { NodeServices } from "@effect/platform-node";
|
||||
import * as NodeServices from "@effect/platform-node/NodeServices";
|
||||
import { it } from "@effect/vitest";
|
||||
import { Effect, FileSystem, Layer, PlatformError, Scope } from "effect";
|
||||
import { describe, expect, vi } from "vitest";
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import fs from "node:fs";
|
||||
import path from "node:path";
|
||||
|
||||
import { NodeServices } from "@effect/platform-node";
|
||||
import * as NodeServices from "@effect/platform-node/NodeServices";
|
||||
import { it } from "@effect/vitest";
|
||||
import { Effect, FileSystem, Layer, PlatformError, Scope } from "effect";
|
||||
import { expect } from "vitest";
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { NodeServices } from "@effect/platform-node";
|
||||
import * as NodeServices from "@effect/platform-node/NodeServices";
|
||||
import { it, assert } from "@effect/vitest";
|
||||
import { Effect, Layer } from "effect";
|
||||
|
||||
|
||||
@@ -143,4 +143,6 @@ export interface GitCoreShape {
|
||||
/**
|
||||
* GitCore - Service tag for low-level Git repository operations.
|
||||
*/
|
||||
export class GitCore extends ServiceMap.Service<GitCore, GitCoreShape>()("git/GitCore") {}
|
||||
export class GitCore extends ServiceMap.Service<GitCore, GitCoreShape>()(
|
||||
"t3/git/Services/GitCore",
|
||||
) {}
|
||||
@@ -63,4 +63,6 @@ export interface GitHubCliShape {
|
||||
/**
|
||||
* GitHubCli - Service tag for GitHub CLI process execution.
|
||||
*/
|
||||
export class GitHubCli extends ServiceMap.Service<GitHubCli, GitHubCliShape>()("git/GitHubCli") {}
|
||||
export class GitHubCli extends ServiceMap.Service<GitHubCli, GitHubCliShape>()(
|
||||
"t3/git/Services/GitHubCli",
|
||||
) {}
|
||||
@@ -23,7 +23,9 @@ export interface GitManagerShape {
|
||||
/**
|
||||
* Read current repository Git status plus open PR metadata when available.
|
||||
*/
|
||||
readonly status: (input: GitStatusInput) => Effect.Effect<GitStatusResult, GitManagerServiceError>;
|
||||
readonly status: (
|
||||
input: GitStatusInput,
|
||||
) => Effect.Effect<GitStatusResult, GitManagerServiceError>;
|
||||
|
||||
/**
|
||||
* Run a stacked Git action (`commit`, `commit_push`, `commit_push_pr`).
|
||||
@@ -37,5 +39,5 @@ export interface GitManagerShape {
|
||||
* GitManager - Service tag for stacked Git workflow orchestration.
|
||||
*/
|
||||
export class GitManager extends ServiceMap.Service<GitManager, GitManagerShape>()(
|
||||
"git/GitManager",
|
||||
"t3/git/Services/GitManager",
|
||||
) {}
|
||||
@@ -41,5 +41,5 @@ export interface GitServiceShape {
|
||||
* GitService - Service for Git command execution.
|
||||
*/
|
||||
export class GitService extends ServiceMap.Service<GitService, GitServiceShape>()(
|
||||
"git/GitService",
|
||||
"t3/git/Services/GitService",
|
||||
) {}
|
||||
@@ -67,5 +67,5 @@ export interface TextGenerationShape {
|
||||
* TextGeneration - Service tag for commit and PR text generation.
|
||||
*/
|
||||
export class TextGeneration extends ServiceMap.Service<TextGeneration, TextGenerationShape>()(
|
||||
"git/TextGeneration",
|
||||
"t3/git/Services/TextGeneration",
|
||||
) {}
|
||||
@@ -1,5 +1,5 @@
|
||||
import { KeybindingCommand, KeybindingRule, KeybindingsConfig } from "@t3tools/contracts";
|
||||
import { NodeServices } from "@effect/platform-node";
|
||||
import * as NodeServices from "@effect/platform-node/NodeServices";
|
||||
import { assert, it } from "@effect/vitest";
|
||||
import { assertFailure } from "@effect/vitest/utils";
|
||||
import { Effect, FileSystem, Layer, Logger, Path, Schema } from "effect";
|
||||
@@ -178,7 +178,10 @@ it.layer(NodeServices.layer)("keybindings", (it) => {
|
||||
return yield* keybindings.loadConfigState;
|
||||
});
|
||||
|
||||
assert.deepEqual(configState.keybindings, compileResolvedKeybindingsConfig(DEFAULT_KEYBINDINGS));
|
||||
assert.deepEqual(
|
||||
configState.keybindings,
|
||||
compileResolvedKeybindingsConfig(DEFAULT_KEYBINDINGS),
|
||||
);
|
||||
assert.deepEqual(configState.issues, [
|
||||
{
|
||||
kind: "keybindings.malformed-config",
|
||||
@@ -208,10 +211,24 @@ it.layer(NodeServices.layer)("keybindings", (it) => {
|
||||
});
|
||||
|
||||
assert.isTrue(configState.keybindings.some((entry) => entry.command === "terminal.toggle"));
|
||||
assert.isFalse(configState.keybindings.some((entry) => entry.command === "invalid.command"));
|
||||
assert.isFalse(
|
||||
configState.keybindings.some(
|
||||
(entry) =>
|
||||
// @ts-expect-error - invalid command
|
||||
entry.command === "invalid.command",
|
||||
),
|
||||
);
|
||||
assert.deepEqual(configState.issues, [
|
||||
{ kind: "keybindings.invalid-entry", index: 1, message: configState.issues[0]?.message ?? "" },
|
||||
{ kind: "keybindings.invalid-entry", index: 2, message: configState.issues[1]?.message ?? "" },
|
||||
{
|
||||
kind: "keybindings.invalid-entry",
|
||||
index: 1,
|
||||
message: configState.issues[0]?.message ?? "",
|
||||
},
|
||||
{
|
||||
kind: "keybindings.invalid-entry",
|
||||
index: 2,
|
||||
message: configState.issues[1]?.message ?? "",
|
||||
},
|
||||
]);
|
||||
}).pipe(Effect.provide(makeKeybindingsLayer())),
|
||||
);
|
||||
|
||||
@@ -498,7 +498,7 @@ export interface KeybindingsShape {
|
||||
* Keybindings - Service tag for keybinding configuration operations.
|
||||
*/
|
||||
export class Keybindings extends ServiceMap.Service<Keybindings, KeybindingsShape>()(
|
||||
"server/Keybindings",
|
||||
"t3/keybindings",
|
||||
) {}
|
||||
|
||||
const makeKeybindings = Effect.gen(function* () {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import * as Http from "node:http";
|
||||
import { NodeServices } from "@effect/platform-node";
|
||||
import * as NodeServices from "@effect/platform-node/NodeServices";
|
||||
import { assert, it, vi } from "@effect/vitest";
|
||||
import * as ConfigProvider from "effect/ConfigProvider";
|
||||
import * as Effect from "effect/Effect";
|
||||
|
||||
@@ -63,7 +63,9 @@ export interface CliConfigShape {
|
||||
/**
|
||||
* CliConfig - Service tag for startup CLI/runtime helpers.
|
||||
*/
|
||||
export class CliConfig extends ServiceMap.Service<CliConfig, CliConfigShape>()("server/CliConfig") {
|
||||
export class CliConfig extends ServiceMap.Service<CliConfig, CliConfigShape>()(
|
||||
"t3/main/CliConfig",
|
||||
) {
|
||||
static readonly layer = Layer.effect(
|
||||
CliConfig,
|
||||
Effect.gen(function* () {
|
||||
|
||||
@@ -50,7 +50,7 @@ export interface OpenShape {
|
||||
/**
|
||||
* Open - Service tag for browser/editor launch operations.
|
||||
*/
|
||||
export class Open extends ServiceMap.Service<Open, OpenShape>()("server/Open") {}
|
||||
export class Open extends ServiceMap.Service<Open, OpenShape>()("t3/open") {}
|
||||
|
||||
// ==============================
|
||||
// Implementations
|
||||
|
||||
@@ -14,7 +14,7 @@ import {
|
||||
ThreadId,
|
||||
TurnId,
|
||||
} from "@t3tools/contracts";
|
||||
import { NodeServices } from "@effect/platform-node";
|
||||
import * as NodeServices from "@effect/platform-node/NodeServices";
|
||||
import { Effect, Exit, Layer, ManagedRuntime, PubSub, Scope, Stream } from "effect";
|
||||
import { afterEach, describe, expect, it, vi } from "vitest";
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ import type {
|
||||
ThreadId,
|
||||
} from "@t3tools/contracts";
|
||||
import { OrchestrationCommand } from "@t3tools/contracts";
|
||||
import { Deferred, Effect, Layer, Option, PubSub, Queue, Stream } from "effect";
|
||||
import { Deferred, Effect, Layer, Option, PubSub, Queue, Schema, Stream } from "effect";
|
||||
import * as SqlClient from "effect/unstable/sql/SqlClient";
|
||||
|
||||
import { toPersistenceSqlError } from "../../persistence/Errors.ts";
|
||||
@@ -181,7 +181,7 @@ const makeOrchestrationEngine = Effect.gen(function* () {
|
||||
),
|
||||
);
|
||||
|
||||
if (error instanceof OrchestrationCommandInvariantError) {
|
||||
if (Schema.is(OrchestrationCommandInvariantError)(error)) {
|
||||
const aggregateRef = commandToAggregateRef(envelope.command);
|
||||
yield* commandReceiptRepository
|
||||
.upsert({
|
||||
|
||||
@@ -10,7 +10,7 @@ import {
|
||||
ThreadId,
|
||||
TurnId,
|
||||
} from "@t3tools/contracts";
|
||||
import { NodeServices } from "@effect/platform-node";
|
||||
import * as NodeServices from "@effect/platform-node/NodeServices";
|
||||
import { assert, it } from "@effect/vitest";
|
||||
import { Effect, Layer } from "effect";
|
||||
import fs from "node:fs";
|
||||
|
||||
@@ -31,4 +31,4 @@ export interface CheckpointReactorShape {
|
||||
export class CheckpointReactor extends ServiceMap.Service<
|
||||
CheckpointReactor,
|
||||
CheckpointReactorShape
|
||||
>()("orchestration/CheckpointReactor") {}
|
||||
>()("t3/orchestration/Services/CheckpointReactor") {}
|
||||
@@ -77,4 +77,4 @@ export interface OrchestrationEngineShape {
|
||||
export class OrchestrationEngineService extends ServiceMap.Service<
|
||||
OrchestrationEngineService,
|
||||
OrchestrationEngineShape
|
||||
>()("orchestration/Engine") {}
|
||||
>()("t3/orchestration/Services/OrchestrationEngine/OrchestrationEngineService") {}
|
||||
@@ -28,4 +28,4 @@ export interface OrchestrationReactorShape {
|
||||
export class OrchestrationReactor extends ServiceMap.Service<
|
||||
OrchestrationReactor,
|
||||
OrchestrationReactorShape
|
||||
>()("orchestration/OrchestrationReactor") {}
|
||||
>()("t3/orchestration/Services/OrchestrationReactor") {}
|
||||
@@ -39,4 +39,4 @@ export interface OrchestrationProjectionPipelineShape {
|
||||
export class OrchestrationProjectionPipeline extends ServiceMap.Service<
|
||||
OrchestrationProjectionPipeline,
|
||||
OrchestrationProjectionPipelineShape
|
||||
>()("orchestration/ProjectionPipeline") {}
|
||||
>()("t3/orchestration/Services/ProjectionPipeline/OrchestrationProjectionPipeline") {}
|
||||
@@ -31,4 +31,4 @@ export interface ProjectionSnapshotQueryShape {
|
||||
export class ProjectionSnapshotQuery extends ServiceMap.Service<
|
||||
ProjectionSnapshotQuery,
|
||||
ProjectionSnapshotQueryShape
|
||||
>()("orchestration/ProjectionSnapshotQuery") {}
|
||||
>()("t3/orchestration/Services/ProjectionSnapshotQuery") {}
|
||||
@@ -31,4 +31,4 @@ export interface ProviderCommandReactorShape {
|
||||
export class ProviderCommandReactor extends ServiceMap.Service<
|
||||
ProviderCommandReactor,
|
||||
ProviderCommandReactorShape
|
||||
>()("orchestration/ProviderCommandReactor") {}
|
||||
>()("t3/orchestration/Services/ProviderCommandReactor") {}
|
||||
@@ -31,4 +31,4 @@ export interface ProviderRuntimeIngestionShape {
|
||||
export class ProviderRuntimeIngestionService extends ServiceMap.Service<
|
||||
ProviderRuntimeIngestionService,
|
||||
ProviderRuntimeIngestionShape
|
||||
>()("orchestration/ProviderRuntimeIngestion") {}
|
||||
>()("t3/orchestration/Services/ProviderRuntimeIngestion/ProviderRuntimeIngestionService") {}
|
||||
@@ -1,6 +1,6 @@
|
||||
import { CommandId, EventId, ProjectId } from "@t3tools/contracts";
|
||||
import { assert, it } from "@effect/vitest";
|
||||
import { Effect, Layer, Stream } from "effect";
|
||||
import { Effect, Layer, Schema, Stream } from "effect";
|
||||
import * as SqlClient from "effect/unstable/sql/SqlClient";
|
||||
|
||||
import { PersistenceDecodeError } from "../Errors.ts";
|
||||
@@ -107,7 +107,7 @@ layer("OrchestrationEventStore", (it) => {
|
||||
);
|
||||
assert.equal(replayResult._tag, "Failure");
|
||||
if (replayResult._tag === "Failure") {
|
||||
assert.ok(replayResult.failure instanceof PersistenceDecodeError);
|
||||
assert.ok(Schema.is(PersistenceDecodeError)(replayResult.failure));
|
||||
assert.ok(
|
||||
replayResult.failure.operation.includes(
|
||||
"OrchestrationEventStore.readFromSequence:decodeRows",
|
||||
|
||||
@@ -51,14 +51,10 @@ function toValidationError(
|
||||
});
|
||||
}
|
||||
|
||||
function decodeInput<A>(
|
||||
schema: Schema.Schema<A>,
|
||||
input: unknown,
|
||||
operation: string,
|
||||
): Effect.Effect<A, ProviderSessionRepositoryValidationError> {
|
||||
function decodeInput<S extends Schema.Top>(schema: S, input: unknown, operation: string) {
|
||||
return Schema.decodeUnknownEffect(schema)(input).pipe(
|
||||
Effect.mapError((cause) => toValidationError(operation, cause)),
|
||||
) as Effect.Effect<A, ProviderSessionRepositoryValidationError>;
|
||||
);
|
||||
}
|
||||
|
||||
function toPersistenceError(
|
||||
|
||||
@@ -32,7 +32,7 @@ export type TypeId = "~local/sqlite-node/SqliteClient";
|
||||
/**
|
||||
* SqliteClient - Effect service tag for the sqlite SQL client.
|
||||
*/
|
||||
export const SqliteClient = ServiceMap.Service<Client.SqlClient>("@local/sqlite-node/SqliteClient");
|
||||
export const SqliteClient = ServiceMap.Service<Client.SqlClient>("t3/persistence/NodeSqliteClient");
|
||||
|
||||
export interface SqliteClientConfig {
|
||||
readonly filename: string;
|
||||
|
||||
@@ -66,4 +66,4 @@ export interface OrchestrationCommandReceiptRepositoryShape {
|
||||
export class OrchestrationCommandReceiptRepository extends ServiceMap.Service<
|
||||
OrchestrationCommandReceiptRepository,
|
||||
OrchestrationCommandReceiptRepositoryShape
|
||||
>()("persistence/OrchestrationCommandReceiptRepository") {}
|
||||
>()("t3/persistence/Services/OrchestrationCommandReceipts/OrchestrationCommandReceiptRepository") {}
|
||||
@@ -67,4 +67,4 @@ export interface OrchestrationEventStoreShape {
|
||||
export class OrchestrationEventStore extends ServiceMap.Service<
|
||||
OrchestrationEventStore,
|
||||
OrchestrationEventStoreShape
|
||||
>()("orchestration/EventStore") {}
|
||||
>()("t3/persistence/Services/OrchestrationEventStore") {}
|
||||
@@ -90,4 +90,4 @@ export interface ProjectionCheckpointRepositoryShape {
|
||||
export class ProjectionCheckpointRepository extends ServiceMap.Service<
|
||||
ProjectionCheckpointRepository,
|
||||
ProjectionCheckpointRepositoryShape
|
||||
>()("persistence/ProjectionCheckpointRepository") {}
|
||||
>()("t3/persistence/Services/ProjectionCheckpoints/ProjectionCheckpointRepository") {}
|
||||
@@ -88,4 +88,4 @@ export interface ProjectionPendingApprovalRepositoryShape {
|
||||
export class ProjectionPendingApprovalRepository extends ServiceMap.Service<
|
||||
ProjectionPendingApprovalRepository,
|
||||
ProjectionPendingApprovalRepositoryShape
|
||||
>()("persistence/ProjectionPendingApprovalRepository") {}
|
||||
>()("t3/persistence/Services/ProjectionPendingApprovals/ProjectionPendingApprovalRepository") {}
|
||||
@@ -76,4 +76,4 @@ export interface ProjectionProjectRepositoryShape {
|
||||
export class ProjectionProjectRepository extends ServiceMap.Service<
|
||||
ProjectionProjectRepository,
|
||||
ProjectionProjectRepositoryShape
|
||||
>()("persistence/ProjectionProjectRepository") {}
|
||||
>()("t3/persistence/Services/ProjectionProjects/ProjectionProjectRepository") {}
|
||||
@@ -61,4 +61,4 @@ export interface ProjectionStateRepositoryShape {
|
||||
export class ProjectionStateRepository extends ServiceMap.Service<
|
||||
ProjectionStateRepository,
|
||||
ProjectionStateRepositoryShape
|
||||
>()("persistence/ProjectionStateRepository") {}
|
||||
>()("t3/persistence/Services/ProjectionState/ProjectionStateRepository") {}
|
||||
@@ -77,4 +77,4 @@ export interface ProjectionThreadActivityRepositoryShape {
|
||||
export class ProjectionThreadActivityRepository extends ServiceMap.Service<
|
||||
ProjectionThreadActivityRepository,
|
||||
ProjectionThreadActivityRepositoryShape
|
||||
>()("persistence/ProjectionThreadActivityRepository") {}
|
||||
>()("t3/persistence/Services/ProjectionThreadActivities/ProjectionThreadActivityRepository") {}
|
||||
@@ -76,4 +76,4 @@ export interface ProjectionThreadMessageRepositoryShape {
|
||||
export class ProjectionThreadMessageRepository extends ServiceMap.Service<
|
||||
ProjectionThreadMessageRepository,
|
||||
ProjectionThreadMessageRepositoryShape
|
||||
>()("persistence/ProjectionThreadMessageRepository") {}
|
||||
>()("t3/persistence/Services/ProjectionThreadMessages/ProjectionThreadMessageRepository") {}
|
||||
@@ -73,4 +73,4 @@ export interface ProjectionThreadSessionRepositoryShape {
|
||||
export class ProjectionThreadSessionRepository extends ServiceMap.Service<
|
||||
ProjectionThreadSessionRepository,
|
||||
ProjectionThreadSessionRepositoryShape
|
||||
>()("persistence/ProjectionThreadSessionRepository") {}
|
||||
>()("t3/persistence/Services/ProjectionThreadSessions/ProjectionThreadSessionRepository") {}
|
||||
@@ -82,4 +82,4 @@ export interface ProjectionThreadRepositoryShape {
|
||||
export class ProjectionThreadRepository extends ServiceMap.Service<
|
||||
ProjectionThreadRepository,
|
||||
ProjectionThreadRepositoryShape
|
||||
>()("persistence/ProjectionThreadRepository") {}
|
||||
>()("t3/persistence/Services/ProjectionThreads/ProjectionThreadRepository") {}
|
||||
@@ -158,4 +158,4 @@ export interface ProjectionTurnRepositoryShape {
|
||||
export class ProjectionTurnRepository extends ServiceMap.Service<
|
||||
ProjectionTurnRepository,
|
||||
ProjectionTurnRepositoryShape
|
||||
>()("persistence/ProjectionTurnRepository") {}
|
||||
>()("t3/persistence/Services/ProjectionTurns/ProjectionTurnRepository") {}
|
||||
@@ -84,4 +84,4 @@ export interface ProviderSessionRuntimeRepositoryShape {
|
||||
export class ProviderSessionRuntimeRepository extends ServiceMap.Service<
|
||||
ProviderSessionRuntimeRepository,
|
||||
ProviderSessionRuntimeRepositoryShape
|
||||
>()("persistence/ProviderSessionRuntimeRepository") {}
|
||||
>()("t3/persistence/Services/ProviderSessionRuntime/ProviderSessionRuntimeRepository") {}
|
||||
@@ -78,4 +78,4 @@ export interface ProviderSessionRepositoryShape {
|
||||
export class ProviderSessionRepository extends ServiceMap.Service<
|
||||
ProviderSessionRepository,
|
||||
ProviderSessionRepositoryShape
|
||||
>()("persistence/ProviderSessionRepository") {}
|
||||
>()("t3/persistence/Services/ProviderSessions/ProviderSessionRepository") {}
|
||||
@@ -8,7 +8,7 @@ import { CodexAdapter, CodexAdapterShape } from "../Services/CodexAdapter.ts";
|
||||
import { ProviderAdapterRegistry } from "../Services/ProviderAdapterRegistry.ts";
|
||||
import { ProviderAdapterRegistryLive } from "./ProviderAdapterRegistry.ts";
|
||||
import { ProviderUnsupportedError } from "../Errors.ts";
|
||||
import { NodeServices } from "@effect/platform-node";
|
||||
import * as NodeServices from "@effect/platform-node/NodeServices";
|
||||
|
||||
const fakeCodexAdapter: CodexAdapterShape = {
|
||||
provider: "codex",
|
||||
|
||||
@@ -37,7 +37,7 @@ import { ProviderService } from "../Services/ProviderService.ts";
|
||||
import { ProviderSessionDirectory } from "../Services/ProviderSessionDirectory.ts";
|
||||
import { makeProviderServiceLive } from "./ProviderService.ts";
|
||||
import { ProviderSessionDirectoryLive } from "./ProviderSessionDirectory.ts";
|
||||
import { NodeServices } from "@effect/platform-node";
|
||||
import * as NodeServices from "@effect/platform-node/NodeServices";
|
||||
import { ProviderSessionRuntimeRepositoryLive } from "../../persistence/Layers/ProviderSessionRuntime.ts";
|
||||
import { ProviderSessionRuntimeRepository } from "../../persistence/Services/ProviderSessionRuntime.ts";
|
||||
import {
|
||||
|
||||
@@ -2,7 +2,7 @@ import fs from "node:fs";
|
||||
import os from "node:os";
|
||||
import path from "node:path";
|
||||
|
||||
import { NodeServices } from "@effect/platform-node";
|
||||
import * as NodeServices from "@effect/platform-node/NodeServices";
|
||||
import { ProviderSessionId, ProviderThreadId, ThreadId } from "@t3tools/contracts";
|
||||
import { it, assert } from "@effect/vitest";
|
||||
import { assertFailure, assertSome } from "@effect/vitest/utils";
|
||||
|
||||
@@ -26,5 +26,5 @@ export interface CodexAdapterShape extends ProviderAdapterShape<ProviderAdapterE
|
||||
* CodexAdapter - Service tag for Codex provider adapter operations.
|
||||
*/
|
||||
export class CodexAdapter extends ServiceMap.Service<CodexAdapter, CodexAdapterShape>()(
|
||||
"provider/CodexAdapter",
|
||||
"t3/provider/Services/CodexAdapter",
|
||||
) {}
|
||||
@@ -37,6 +37,6 @@ export interface ProviderAdapterRegistryShape {
|
||||
export class ProviderAdapterRegistry extends ServiceMap.Service<
|
||||
ProviderAdapterRegistry,
|
||||
ProviderAdapterRegistryShape
|
||||
>()("provider/ProviderAdapterRegistry") {}
|
||||
>()("t3/provider/Services/ProviderAdapterRegistry") {}
|
||||
|
||||
// Dummy comment for workflow testing.
|
||||
@@ -105,5 +105,5 @@ export interface ProviderServiceShape {
|
||||
* ProviderService - Service tag for provider orchestration.
|
||||
*/
|
||||
export class ProviderService extends ServiceMap.Service<ProviderService, ProviderServiceShape>()(
|
||||
"provider/ProviderService",
|
||||
"t3/provider/Services/ProviderService",
|
||||
) {}
|
||||
@@ -99,4 +99,4 @@ export interface ProviderSessionDirectoryShape {
|
||||
export class ProviderSessionDirectory extends ServiceMap.Service<
|
||||
ProviderSessionDirectory,
|
||||
ProviderSessionDirectoryShape
|
||||
>()("provider/ProviderSessionDirectory") {}
|
||||
>()("t3/provider/Services/ProviderSessionDirectory") {}
|
||||
@@ -1,6 +1,6 @@
|
||||
import path from "node:path";
|
||||
|
||||
import { NodeServices } from "@effect/platform-node";
|
||||
import * as NodeServices from "@effect/platform-node/NodeServices";
|
||||
import { Effect, Layer } from "effect";
|
||||
import * as SqlClient from "effect/unstable/sql/SqlClient";
|
||||
|
||||
|
||||
@@ -9,7 +9,13 @@ import {
|
||||
} from "@t3tools/contracts";
|
||||
import { afterEach, describe, expect, it } from "vitest";
|
||||
|
||||
import type { PtyAdapterShape, PtyExitEvent, PtyProcess, PtySpawnInput } from "../Services/PTY";
|
||||
import {
|
||||
PtySpawnError,
|
||||
type PtyAdapterShape,
|
||||
type PtyExitEvent,
|
||||
type PtyProcess,
|
||||
type PtySpawnInput,
|
||||
} from "../Services/PTY";
|
||||
import { TerminalManagerRuntime } from "./Manager";
|
||||
import { Effect, Encoding } from "effect";
|
||||
|
||||
@@ -69,14 +75,33 @@ class FakePtyAdapter implements PtyAdapterShape {
|
||||
readonly spawnFailures: Error[] = [];
|
||||
private nextPid = 9000;
|
||||
|
||||
spawn(input: PtySpawnInput): Effect.Effect<PtyProcess> {
|
||||
constructor(private readonly mode: "sync" | "async" = "sync") {}
|
||||
|
||||
spawn(input: PtySpawnInput): Effect.Effect<PtyProcess, PtySpawnError> {
|
||||
this.spawnInputs.push(input);
|
||||
const failure = this.spawnFailures.shift();
|
||||
if (failure) {
|
||||
throw failure;
|
||||
return Effect.fail(
|
||||
new PtySpawnError({
|
||||
adapter: "fake",
|
||||
message: "Failed to spawn PTY process",
|
||||
cause: failure,
|
||||
}),
|
||||
);
|
||||
}
|
||||
const process = new FakePtyProcess(this.nextPid++);
|
||||
this.processes.push(process);
|
||||
if (this.mode === "async") {
|
||||
return Effect.tryPromise({
|
||||
try: async () => process,
|
||||
catch: (cause) =>
|
||||
new PtySpawnError({
|
||||
adapter: "fake",
|
||||
message: "Failed to spawn PTY process",
|
||||
cause,
|
||||
}),
|
||||
});
|
||||
}
|
||||
return Effect.succeed(process);
|
||||
}
|
||||
}
|
||||
@@ -150,11 +175,12 @@ describe("TerminalManager", () => {
|
||||
subprocessPollIntervalMs?: number;
|
||||
processKillGraceMs?: number;
|
||||
maxRetainedInactiveSessions?: number;
|
||||
ptyAdapter?: FakePtyAdapter;
|
||||
} = {},
|
||||
) {
|
||||
const logsDir = fs.mkdtempSync(path.join(os.tmpdir(), "t3code-terminal-"));
|
||||
tempDirs.push(logsDir);
|
||||
const ptyAdapter = new FakePtyAdapter();
|
||||
const ptyAdapter = options.ptyAdapter ?? new FakePtyAdapter();
|
||||
const manager = new TerminalManagerRuntime({
|
||||
logsDir,
|
||||
ptyAdapter,
|
||||
@@ -189,6 +215,18 @@ describe("TerminalManager", () => {
|
||||
manager.dispose();
|
||||
});
|
||||
|
||||
it("supports asynchronous PTY spawn effects", async () => {
|
||||
const { manager, ptyAdapter } = makeManager(5, { ptyAdapter: new FakePtyAdapter("async") });
|
||||
|
||||
const snapshot = await manager.open(openInput());
|
||||
|
||||
expect(snapshot.status).toBe("running");
|
||||
expect(ptyAdapter.spawnInputs).toHaveLength(1);
|
||||
expect(ptyAdapter.processes).toHaveLength(1);
|
||||
|
||||
manager.dispose();
|
||||
});
|
||||
|
||||
it("forwards write and resize to active pty process", async () => {
|
||||
const { manager, ptyAdapter } = makeManager();
|
||||
await manager.open(openInput());
|
||||
|
||||
@@ -117,8 +117,43 @@ function resolveShellCandidates(shellResolver: () => string): ShellCandidate[] {
|
||||
}
|
||||
|
||||
function isRetryableShellSpawnError(error: unknown): boolean {
|
||||
if (!(error instanceof Error)) return false;
|
||||
const message = error.message.toLowerCase();
|
||||
const queue: unknown[] = [error];
|
||||
const seen = new Set<unknown>();
|
||||
const messages: string[] = [];
|
||||
|
||||
while (queue.length > 0) {
|
||||
const current = queue.shift();
|
||||
if (!current || seen.has(current)) {
|
||||
continue;
|
||||
}
|
||||
seen.add(current);
|
||||
|
||||
if (typeof current === "string") {
|
||||
messages.push(current);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (current instanceof Error) {
|
||||
messages.push(current.message);
|
||||
const cause = (current as { cause?: unknown }).cause;
|
||||
if (cause) {
|
||||
queue.push(cause);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
if (typeof current === "object") {
|
||||
const value = current as { message?: unknown; cause?: unknown };
|
||||
if (typeof value.message === "string") {
|
||||
messages.push(value.message);
|
||||
}
|
||||
if (value.cause) {
|
||||
queue.push(value.cause);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const message = messages.join(" ").toLowerCase();
|
||||
return (
|
||||
message.includes("posix_spawnp failed") ||
|
||||
message.includes("enoent") ||
|
||||
@@ -354,7 +389,7 @@ export class TerminalManagerRuntime extends EventEmitter<TerminalManagerEvents>
|
||||
};
|
||||
this.sessions.set(sessionKey, session);
|
||||
this.evictInactiveSessionsIfNeeded();
|
||||
this.startSession(session, { ...input, cols, rows }, "started");
|
||||
await this.startSession(session, { ...input, cols, rows }, "started");
|
||||
return this.snapshot(session);
|
||||
}
|
||||
|
||||
@@ -380,7 +415,7 @@ export class TerminalManagerRuntime extends EventEmitter<TerminalManagerEvents>
|
||||
}
|
||||
|
||||
if (!existing.process) {
|
||||
this.startSession(existing, { ...input, cols: targetCols, rows: targetRows }, "started");
|
||||
await this.startSession(existing, { ...input, cols: targetCols, rows: targetRows }, "started");
|
||||
return this.snapshot(existing);
|
||||
}
|
||||
|
||||
@@ -477,7 +512,7 @@ export class TerminalManagerRuntime extends EventEmitter<TerminalManagerEvents>
|
||||
|
||||
session.history = "";
|
||||
await this.persistHistory(input.threadId, input.terminalId, session.history);
|
||||
this.startSession(session, { ...input, cols, rows }, "restarted");
|
||||
await this.startSession(session, { ...input, cols, rows }, "restarted");
|
||||
return this.snapshot(session);
|
||||
});
|
||||
}
|
||||
@@ -528,11 +563,11 @@ export class TerminalManagerRuntime extends EventEmitter<TerminalManagerEvents>
|
||||
this.persistQueues.clear();
|
||||
}
|
||||
|
||||
private startSession(
|
||||
private async startSession(
|
||||
session: TerminalSessionState,
|
||||
input: TerminalStartInput,
|
||||
eventType: "started" | "restarted",
|
||||
): void {
|
||||
): Promise<void> {
|
||||
this.stopProcess(session);
|
||||
|
||||
session.status = "starting";
|
||||
@@ -551,26 +586,46 @@ export class TerminalManagerRuntime extends EventEmitter<TerminalManagerEvents>
|
||||
const terminalEnv = createTerminalSpawnEnv(process.env, session.runtimeEnv);
|
||||
let lastSpawnError: unknown = null;
|
||||
|
||||
for (const candidate of shellCandidates) {
|
||||
const spawnWithCandidate = (candidate: ShellCandidate) =>
|
||||
Effect.runPromise(
|
||||
this.ptyAdapter.spawn({
|
||||
shell: candidate.shell,
|
||||
...(candidate.args ? { args: candidate.args } : {}),
|
||||
cwd: session.cwd,
|
||||
cols: session.cols,
|
||||
rows: session.rows,
|
||||
env: terminalEnv,
|
||||
}),
|
||||
);
|
||||
|
||||
const trySpawn = async (
|
||||
candidates: ShellCandidate[],
|
||||
index = 0,
|
||||
): Promise<{ process: PtyProcess; shellLabel: string } | null> => {
|
||||
if (index >= candidates.length) {
|
||||
return null;
|
||||
}
|
||||
const candidate = candidates[index];
|
||||
if (!candidate) {
|
||||
return null;
|
||||
}
|
||||
|
||||
try {
|
||||
ptyProcess = Effect.runSync(
|
||||
this.ptyAdapter.spawn({
|
||||
shell: candidate.shell,
|
||||
...(candidate.args ? { args: candidate.args } : {}),
|
||||
cwd: session.cwd,
|
||||
cols: session.cols,
|
||||
rows: session.rows,
|
||||
env: terminalEnv,
|
||||
}),
|
||||
);
|
||||
startedShell = formatShellCandidate(candidate);
|
||||
break;
|
||||
const process = await spawnWithCandidate(candidate);
|
||||
return { process, shellLabel: formatShellCandidate(candidate) };
|
||||
} catch (error) {
|
||||
lastSpawnError = error;
|
||||
if (!isRetryableShellSpawnError(error)) {
|
||||
throw error;
|
||||
}
|
||||
return trySpawn(candidates, index + 1);
|
||||
}
|
||||
};
|
||||
|
||||
const spawnResult = await trySpawn(shellCandidates);
|
||||
if (spawnResult) {
|
||||
ptyProcess = spawnResult.process;
|
||||
startedShell = spawnResult.shellLabel;
|
||||
}
|
||||
|
||||
if (!ptyProcess) {
|
||||
|
||||
@@ -2,7 +2,7 @@ import { FileSystem, Path, Effect } from "effect";
|
||||
import { assert, it } from "@effect/vitest";
|
||||
|
||||
import { ensureNodePtySpawnHelperExecutable } from "./NodePTY";
|
||||
import { NodeServices } from "@effect/platform-node";
|
||||
import * as NodeServices from "@effect/platform-node/NodeServices";
|
||||
|
||||
it.layer(NodeServices.layer)("ensureNodePtySpawnHelperExecutable", (it) => {
|
||||
it.effect("adds executable bits when helper exists but is not executable", () =>
|
||||
|
||||
@@ -37,11 +37,12 @@ export const ensureNodePtySpawnHelperExecutable = Effect.fn(function* (explicitP
|
||||
didEnsureSpawnHelperExecutable = true;
|
||||
}
|
||||
|
||||
const stat = yield* fs.stat(helperPath);
|
||||
const mode = stat.mode & 0o777;
|
||||
if ((mode & 0o111) === 0) {
|
||||
yield* fs.chmod(helperPath, mode | 0o111);
|
||||
if (!(yield* fs.exists(helperPath))) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Best-effort: avoid FileSystem.stat in packaged mode where some fs metadata can be missing.
|
||||
yield* fs.chmod(helperPath, 0o755).pipe(Effect.orElseSucceed(() => undefined));
|
||||
});
|
||||
|
||||
class NodePtyProcess implements PtyProcess {
|
||||
|
||||
@@ -113,5 +113,5 @@ export interface TerminalManagerShape {
|
||||
* TerminalManager - Service tag for terminal session orchestration.
|
||||
*/
|
||||
export class TerminalManager extends ServiceMap.Service<TerminalManager, TerminalManagerShape>()(
|
||||
"terminal/TerminalManager",
|
||||
"t3/terminal/Services/Manager/TerminalManager",
|
||||
) {}
|
||||
@@ -6,7 +6,16 @@
|
||||
*
|
||||
* @module PtyAdapter
|
||||
*/
|
||||
import { Effect, ServiceMap } from "effect";
|
||||
import { Effect, Schema, ServiceMap } from "effect";
|
||||
|
||||
/**
|
||||
* PtyError - Error type for PTY adapter operations.
|
||||
*/
|
||||
export class PtySpawnError extends Schema.TaggedErrorClass<PtySpawnError>()("PtySpawnError", {
|
||||
adapter: Schema.String,
|
||||
message: Schema.String,
|
||||
cause: Schema.optional(Schema.Defect),
|
||||
}) {}
|
||||
|
||||
export interface PtyExitEvent {
|
||||
exitCode: number;
|
||||
@@ -38,12 +47,12 @@ export interface PtyAdapterShape {
|
||||
/**
|
||||
* Spawn a PTY process for a terminal session.
|
||||
*/
|
||||
spawn(input: PtySpawnInput): Effect.Effect<PtyProcess>;
|
||||
spawn(input: PtySpawnInput): Effect.Effect<PtyProcess, PtySpawnError>;
|
||||
}
|
||||
|
||||
/**
|
||||
* PtyAdapter - Service tag for PTY process integration.
|
||||
*/
|
||||
export class PtyAdapter extends ServiceMap.Service<PtyAdapter, PtyAdapterShape>()(
|
||||
"terminal/PtyAdapter",
|
||||
"t3/terminal/Services/PTY/PtyAdapter",
|
||||
) {}
|
||||
+10
-14
@@ -23,7 +23,7 @@ import {
|
||||
WsPush,
|
||||
WsResponse,
|
||||
} from "@t3tools/contracts";
|
||||
import { NodeHttpServer } from "@effect/platform-node";
|
||||
import * as NodeHttpServer from "@effect/platform-node/NodeHttpServer";
|
||||
import { Cause, Effect, Exit, Layer, Ref, Schema, Scope, ServiceMap, Stream, Struct } from "effect";
|
||||
import { WebSocketServer, type WebSocket } from "ws";
|
||||
|
||||
@@ -79,7 +79,7 @@ export interface ServerShape {
|
||||
/**
|
||||
* Server - Service tag for HTTP/WebSocket lifecycle management.
|
||||
*/
|
||||
export class Server extends ServiceMap.Service<Server, ServerShape>()("server/Server") {}
|
||||
export class Server extends ServiceMap.Service<Server, ServerShape>()("t3/wsServer/Server") {}
|
||||
|
||||
const isServerNotRunningError = (error: unknown): boolean => {
|
||||
if (!(error instanceof Error)) return false;
|
||||
@@ -320,22 +320,18 @@ export const createServer = Effect.fn(function* (): Effect.fn.Return<
|
||||
yield* Effect.addFinalizer(() => Scope.close(subscriptionsScope, Exit.void));
|
||||
|
||||
yield* Stream.runForEach(orchestrationEngine.streamDomainEvents, (event) =>
|
||||
Effect.gen(function* () {
|
||||
yield* broadcastPush({
|
||||
type: "push",
|
||||
channel: ORCHESTRATION_WS_CHANNELS.domainEvent,
|
||||
data: event,
|
||||
});
|
||||
broadcastPush({
|
||||
type: "push",
|
||||
channel: ORCHESTRATION_WS_CHANNELS.domainEvent,
|
||||
data: event,
|
||||
}),
|
||||
).pipe(Effect.forkIn(subscriptionsScope));
|
||||
|
||||
yield* Stream.runForEach(keybindingsManager.changes, (event) =>
|
||||
Effect.gen(function* () {
|
||||
yield* broadcastPush({
|
||||
type: "push",
|
||||
channel: WS_CHANNELS.serverConfigUpdated,
|
||||
data: event,
|
||||
});
|
||||
broadcastPush({
|
||||
type: "push",
|
||||
channel: WS_CHANNELS.serverConfigUpdated,
|
||||
data: event,
|
||||
}),
|
||||
).pipe(Effect.forkIn(subscriptionsScope));
|
||||
|
||||
|
||||
@@ -8,7 +8,14 @@
|
||||
"allowImportingTsExtensions": true,
|
||||
"plugins": [
|
||||
{
|
||||
"name": "@effect/language-service"
|
||||
"name": "@effect/language-service",
|
||||
"namespaceImportPackages": ["@effect/platform-node"],
|
||||
"diagnosticSeverity": {
|
||||
"importFromBarrel": "error",
|
||||
"anyUnknownInErrorContext": "warning",
|
||||
"instanceOfSchema": "warning",
|
||||
"deterministicKeys": "warning"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
"@xterm/addon-fit": "^0.11.0",
|
||||
"@xterm/xterm": "^6.0.0",
|
||||
"class-variance-authority": "^0.7.1",
|
||||
"effect": "4.0.0-beta.10",
|
||||
"effect": "catalog:",
|
||||
"highlight.js": "^11.11.1",
|
||||
"lucide-react": "^0.564.0",
|
||||
"react": "^19.0.0",
|
||||
@@ -32,6 +32,7 @@
|
||||
"tailwind-merge": "^3.4.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@effect/language-service": "catalog:",
|
||||
"@tailwindcss/vite": "^4.0.0",
|
||||
"@tanstack/router-plugin": "^1.161.0",
|
||||
"@types/react": "^19.0.0",
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { WorkerPoolContextProvider } from "@pierre/diffs/react";
|
||||
import DiffsWorker from "@pierre/diffs/worker/worker.js?worker";
|
||||
import { useMemo, type ReactNode } from "react";
|
||||
|
||||
export function DiffWorkerPoolProvider({ children }: { children?: ReactNode }) {
|
||||
@@ -11,8 +12,7 @@ export function DiffWorkerPoolProvider({ children }: { children?: ReactNode }) {
|
||||
return (
|
||||
<WorkerPoolContextProvider
|
||||
poolOptions={{
|
||||
workerFactory: () =>
|
||||
new Worker(new URL("../workers/diffs.worker.ts", import.meta.url), { type: "module" }),
|
||||
workerFactory: () => new DiffsWorker(),
|
||||
poolSize: workerPoolSize,
|
||||
totalASTLRUCacheSize: 240,
|
||||
}}
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
import "@pierre/diffs/worker/worker.js";
|
||||
+13
-1
@@ -7,7 +7,19 @@
|
||||
"types": ["vite/client"],
|
||||
"paths": {
|
||||
"~/*": ["./src/*"]
|
||||
}
|
||||
},
|
||||
"plugins": [
|
||||
{
|
||||
"name": "@effect/language-service",
|
||||
"namespaceImportPackages": ["@effect/platform-node"],
|
||||
"diagnosticSeverity": {
|
||||
"importFromBarrel": "error",
|
||||
"anyUnknownInErrorContext": "warning",
|
||||
"instanceOfSchema": "warning",
|
||||
"deterministicKeys": "warning"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"include": ["src", "vite.config.ts"]
|
||||
}
|
||||
@@ -35,17 +35,17 @@
|
||||
"t3": "./dist/index.mjs",
|
||||
},
|
||||
"dependencies": {
|
||||
"@effect/platform-node": "4.0.0-beta.10",
|
||||
"@effect/sql-sqlite-bun": "4.0.0-beta.10",
|
||||
"@effect/platform-node": "catalog:",
|
||||
"@effect/sql-sqlite-bun": "catalog:",
|
||||
"@pierre/diffs": "^1.1.0-beta.16",
|
||||
"effect": "4.0.0-beta.10",
|
||||
"effect": "catalog:",
|
||||
"node-pty": "^1.1.0",
|
||||
"open": "^10.1.0",
|
||||
"ws": "^8.18.0",
|
||||
},
|
||||
"devDependencies": {
|
||||
"@effect/language-service": "0.75.1",
|
||||
"@effect/vitest": "4.0.0-beta.10",
|
||||
"@effect/vitest": "catalog:",
|
||||
"@t3tools/contracts": "workspace:*",
|
||||
"@t3tools/web": "workspace:*",
|
||||
"@types/bun": "^1.3.9",
|
||||
@@ -70,7 +70,7 @@
|
||||
"@xterm/addon-fit": "^0.11.0",
|
||||
"@xterm/xterm": "^6.0.0",
|
||||
"class-variance-authority": "^0.7.1",
|
||||
"effect": "4.0.0-beta.10",
|
||||
"effect": "catalog:",
|
||||
"highlight.js": "^11.11.1",
|
||||
"lucide-react": "^0.564.0",
|
||||
"react": "^19.0.0",
|
||||
@@ -81,6 +81,7 @@
|
||||
"tailwind-merge": "^3.4.0",
|
||||
},
|
||||
"devDependencies": {
|
||||
"@effect/language-service": "catalog:",
|
||||
"@tailwindcss/vite": "^4.0.0",
|
||||
"@tanstack/router-plugin": "^1.161.0",
|
||||
"@types/react": "^19.0.0",
|
||||
@@ -96,16 +97,23 @@
|
||||
"name": "@t3tools/contracts",
|
||||
"version": "0.0.0",
|
||||
"dependencies": {
|
||||
"effect": "4.0.0-beta.10",
|
||||
"effect": "catalog:",
|
||||
},
|
||||
"devDependencies": {
|
||||
"@effect/language-service": "0.75.1",
|
||||
"@effect/vitest": "4.0.0-beta.10",
|
||||
"@effect/vitest": "catalog:",
|
||||
"tsdown": "^0.20.3",
|
||||
"typescript": "^5.7.3",
|
||||
},
|
||||
},
|
||||
},
|
||||
"catalog": {
|
||||
"@effect/language-service": "0.75.1",
|
||||
"@effect/platform-node": "https://pkg.pr.new/Effect-TS/effect-smol/@effect/platform-node@f591738",
|
||||
"@effect/sql-sqlite-bun": "https://pkg.pr.new/Effect-TS/effect-smol/@effect/sql-sqlite-bun@f591738",
|
||||
"@effect/vitest": "https://pkg.pr.new/Effect-TS/effect-smol/@effect/vitest@f591738",
|
||||
"effect": "https://pkg.pr.new/Effect-TS/effect-smol/effect@f591738",
|
||||
},
|
||||
"packages": {
|
||||
"@babel/code-frame": ["@babel/[email protected]", "", { "dependencies": { "@babel/helper-validator-identifier": "^7.28.5", "js-tokens": "^4.0.0", "picocolors": "^1.1.1" } }, "sha512-9NhCeYjq9+3uxgdtp20LSiJXJvN0FeCtNGpJxuMFZ1Kv3cWUNb6DOhJwUvcVCzKGR66cw4njwM6hrJLqgOwbcw=="],
|
||||
|
||||
@@ -157,13 +165,13 @@
|
||||
|
||||
"@effect/language-service": ["@effect/[email protected]", "", { "bin": { "effect-language-service": "cli.js" } }, "sha512-g9xD2tAQgRFpYC2YgpZq02VeSL5fBbFJ0B/g1o+14NuNmwtaYJc7SjiLWAA9eyhJHosNrn6h1Ye+Kx6j5mN0AA=="],
|
||||
|
||||
"@effect/platform-node": ["@effect/platform-node@4.0.0-beta.10", "", { "dependencies": { "@effect/platform-node-shared": "^4.0.0-beta.10", "mime": "^4.1.0", "undici": "^7.20.0" }, "peerDependencies": { "effect": "^4.0.0-beta.10", "ioredis": "^5.7.0" } }, "sha512-ikZ/uyos5okYAHE+wWOwZkHgriFUTY3aY8Kdqbj/ro8xw0z9YXWN4fbyQAZUWkBcieDKS36N+QfHRMPG4fEWRA=="],
|
||||
"@effect/platform-node": ["@effect/platform-node@https://pkg.pr.new/Effect-TS/effect-smol/@effect/platform-node@f591738", { "dependencies": { "@effect/platform-node-shared": "https://pkg.pr.new/Effect-TS/effect-smol/@effect/platform-node-shared@f59173885df0eb490dc2e6619ae89467feac0413", "mime": "^4.1.0", "undici": "^7.20.0" }, "peerDependencies": { "effect": "^4.0.0-beta.19", "ioredis": "^5.7.0" } }],
|
||||
|
||||
"@effect/platform-node-shared": ["@effect/platform-node-shared@4.0.0-beta.10", "", { "dependencies": { "@types/ws": "^8.18.1", "ws": "^8.19.0" }, "peerDependencies": { "effect": "^4.0.0-beta.10" } }, "sha512-gBSeOG2bfchXFdgdi5oipHKynOzSd7BlzTy5QcjFOoCUTtLP9igqohPB9hTkV3a6seWE2JJqsgsQ79VuLb7fAg=="],
|
||||
"@effect/platform-node-shared": ["@effect/platform-node-shared@https://pkg.pr.new/Effect-TS/effect-smol/@effect/platform-node-shared@f59173885df0eb490dc2e6619ae89467feac0413", { "dependencies": { "@types/ws": "^8.18.1", "ws": "^8.19.0" }, "peerDependencies": { "effect": "^4.0.0-beta.19" } }],
|
||||
|
||||
"@effect/sql-sqlite-bun": ["@effect/sql-sqlite-bun@4.0.0-beta.10", "", { "peerDependencies": { "effect": "^4.0.0-beta.10" } }, "sha512-LY1jNu2uqGYsJCVjVU73nzcZ+kAYBDsG7O8x5ddmkIXj10RmnIhjYMStWBa0NZOFg4Hsl+CadxtsDy3edaOVeA=="],
|
||||
"@effect/sql-sqlite-bun": ["@effect/sql-sqlite-bun@https://pkg.pr.new/Effect-TS/effect-smol/@effect/sql-sqlite-bun@f591738", { "peerDependencies": { "effect": "^4.0.0-beta.19" } }],
|
||||
|
||||
"@effect/vitest": ["@effect/vitest@4.0.0-beta.10", "", { "peerDependencies": { "effect": "^4.0.0-beta.10", "vitest": "^3.0.0" } }, "sha512-WmE8vCNw+eDoAq9CwwymrAdIBw1f+8hDP3AUF7jyC7/Cj/kyAYOFwkbtKmDXIFaTlf7G/2fmulEXeCO5W8j0kQ=="],
|
||||
"@effect/vitest": ["@effect/vitest@https://pkg.pr.new/Effect-TS/effect-smol/@effect/vitest@f591738", { "peerDependencies": { "effect": "^4.0.0-beta.19", "vitest": "^3.0.0" } }],
|
||||
|
||||
"@electron/get": ["@electron/[email protected]", "", { "dependencies": { "debug": "^4.1.1", "env-paths": "^2.2.0", "fs-extra": "^8.1.0", "got": "^11.8.5", "progress": "^2.0.3", "semver": "^6.2.0", "sumchecker": "^3.0.1" }, "optionalDependencies": { "global-agent": "^3.0.0" } }, "sha512-Qkzpg2s9GnVV2I2BjRksUi43U5e6+zaQMcjoJy0C+C5oxaKl+fmckGDQFtRpZpZV0NQekuZZ+tGz7EA9TVnQtQ=="],
|
||||
|
||||
@@ -729,7 +737,7 @@
|
||||
|
||||
"dunder-proto": ["[email protected]", "", { "dependencies": { "call-bind-apply-helpers": "^1.0.1", "es-errors": "^1.3.0", "gopd": "^1.2.0" } }, "sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A=="],
|
||||
|
||||
"effect": ["effect@4.0.0-beta.10", "", { "dependencies": { "@standard-schema/spec": "^1.1.0", "fast-check": "^4.5.3", "find-my-way-ts": "^0.1.6", "ini": "^6.0.0", "kubernetes-types": "^1.30.0", "msgpackr": "^1.11.8", "multipasta": "^0.2.7", "toml": "^3.0.0", "uuid": "^13.0.0", "yaml": "^2.8.2" } }, "sha512-UvxWmT0uzWZqNmQODfW7y1zb0LMlH3xtSn/UESpck2Wvv6SogxibYPWKKNcUsRMm5wwprOoW2IwItYLQyZpe8Q=="],
|
||||
"effect": ["effect@https://pkg.pr.new/Effect-TS/effect-smol/effect@f591738", { "dependencies": { "@standard-schema/spec": "^1.1.0", "fast-check": "^4.5.3", "find-my-way-ts": "^0.1.6", "ini": "^6.0.0", "kubernetes-types": "^1.30.0", "msgpackr": "^1.11.8", "multipasta": "^0.2.7", "toml": "^3.0.0", "uuid": "^13.0.0", "yaml": "^2.8.2" } }],
|
||||
|
||||
"electron": ["[email protected]", "", { "dependencies": { "@electron/get": "^2.0.0", "@types/node": "^24.9.0", "extract-zip": "^2.0.1" }, "bin": { "electron": "cli.js" } }, "sha512-ett8W+yOFGDuM0vhJMamYSkrbV3LoaffzJd9GfjI96zRAxyrNqUSKqBpf/WGbQCweDxX2pkUCUfrv4wwKpsFZA=="],
|
||||
|
||||
|
||||
+13
-4
@@ -1,10 +1,19 @@
|
||||
{
|
||||
"name": "@t3tools/monorepo",
|
||||
"private": true,
|
||||
"workspaces": [
|
||||
"apps/*",
|
||||
"packages/*"
|
||||
],
|
||||
"workspaces": {
|
||||
"packages": [
|
||||
"apps/*",
|
||||
"packages/*"
|
||||
],
|
||||
"catalog": {
|
||||
"effect": "https://pkg.pr.new/Effect-TS/effect-smol/effect@f591738",
|
||||
"@effect/platform-node": "https://pkg.pr.new/Effect-TS/effect-smol/@effect/platform-node@f591738",
|
||||
"@effect/sql-sqlite-bun": "https://pkg.pr.new/Effect-TS/effect-smol/@effect/sql-sqlite-bun@f591738",
|
||||
"@effect/vitest": "https://pkg.pr.new/Effect-TS/effect-smol/@effect/vitest@f591738",
|
||||
"@effect/language-service": "0.75.1"
|
||||
}
|
||||
},
|
||||
"scripts": {
|
||||
"dev": "bun run scripts/dev-runner.mjs dev",
|
||||
"dev:server": "bun run scripts/dev-runner.mjs dev:server",
|
||||
|
||||
@@ -24,11 +24,11 @@
|
||||
"test": "vitest run"
|
||||
},
|
||||
"dependencies": {
|
||||
"effect": "4.0.0-beta.10"
|
||||
"effect": "catalog:"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@effect/language-service": "0.75.1",
|
||||
"@effect/vitest": "4.0.0-beta.10",
|
||||
"@effect/vitest": "catalog:",
|
||||
"tsdown": "^0.20.3",
|
||||
"typescript": "^5.7.3"
|
||||
}
|
||||
|
||||
@@ -3,7 +3,14 @@
|
||||
"compilerOptions": {
|
||||
"plugins": [
|
||||
{
|
||||
"name": "@effect/language-service"
|
||||
"name": "@effect/language-service",
|
||||
"namespaceImportPackages": ["@effect/platform-node"],
|
||||
"diagnosticSeverity": {
|
||||
"importFromBarrel": "error",
|
||||
"anyUnknownInErrorContext": "warning",
|
||||
"instanceOfSchema": "warning",
|
||||
"deterministicKeys": "warning"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
@@ -206,6 +206,42 @@ async function validateBundledClientAssets(clientDir) {
|
||||
}
|
||||
}
|
||||
|
||||
function readWorkspaceCatalog(rootPackageJson) {
|
||||
const workspaces = rootPackageJson?.workspaces;
|
||||
if (!workspaces || typeof workspaces !== "object" || Array.isArray(workspaces)) {
|
||||
return {};
|
||||
}
|
||||
|
||||
const catalog = workspaces.catalog;
|
||||
if (!catalog || typeof catalog !== "object" || Array.isArray(catalog)) {
|
||||
return {};
|
||||
}
|
||||
|
||||
return catalog;
|
||||
}
|
||||
|
||||
function resolveCatalogDependencies(dependencies, catalog, dependencySourceLabel) {
|
||||
return Object.fromEntries(
|
||||
Object.entries(dependencies).map(([dependencyName, spec]) => {
|
||||
if (typeof spec !== "string" || !spec.startsWith("catalog:")) {
|
||||
return [dependencyName, spec];
|
||||
}
|
||||
|
||||
const catalogKey = spec.slice("catalog:".length).trim();
|
||||
const lookupKey = catalogKey.length > 0 ? catalogKey : dependencyName;
|
||||
const resolvedSpec = catalog[lookupKey];
|
||||
if (typeof resolvedSpec !== "string" || resolvedSpec.length === 0) {
|
||||
fail(
|
||||
`Unable to resolve '${spec}' for ${dependencySourceLabel} dependency '${dependencyName}'. ` +
|
||||
`Expected key '${lookupKey}' in root workspace catalog.`,
|
||||
);
|
||||
}
|
||||
|
||||
return [dependencyName, resolvedSpec];
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
async function main() {
|
||||
const options = parseArgs(process.argv.slice(2));
|
||||
if (options.help) {
|
||||
@@ -217,6 +253,7 @@ async function main() {
|
||||
fail("This script only builds macOS .dmg artifacts and must run on macOS.");
|
||||
}
|
||||
|
||||
const rootPkg = await readJson(path.join(repoRoot, "package.json"));
|
||||
const desktopPkg = await readJson(path.join(repoRoot, "apps/desktop/package.json"));
|
||||
const serverPkg = await readJson(path.join(repoRoot, "apps/server/package.json"));
|
||||
|
||||
@@ -229,6 +266,11 @@ async function main() {
|
||||
if (!dependencies || Object.keys(dependencies).length === 0) {
|
||||
fail("Could not resolve production dependencies from apps/server/package.json.");
|
||||
}
|
||||
const resolvedDependencies = resolveCatalogDependencies(
|
||||
dependencies,
|
||||
readWorkspaceCatalog(rootPkg),
|
||||
"apps/server",
|
||||
);
|
||||
|
||||
const appVersion = options.version ?? serverPkg.version ?? "0.1.0";
|
||||
const stageRoot = path.join(os.tmpdir(), "t3code-desktop-dmg-stage");
|
||||
@@ -291,7 +333,7 @@ async function main() {
|
||||
category: "public.app-category.developer-tools",
|
||||
},
|
||||
},
|
||||
dependencies,
|
||||
dependencies: resolvedDependencies,
|
||||
devDependencies: {
|
||||
electron: electronVersion,
|
||||
},
|
||||
|
||||
Reference in new issue
Block a user