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

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions apps/server/src/atomicWrite.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import * as Effect from "effect/Effect";
import * as FileSystem from "effect/FileSystem";
import * as Path from "effect/Path";
import * as Random from "effect/Random";

export const writeFileStringAtomically = (input: {
readonly filePath: string;
Expand All @@ -15,7 +14,6 @@ export const writeFileStringAtomically = (input: {
Effect.gen(function* () {
const fs = yield* FileSystem.FileSystem;
const path = yield* Path.Path;
const tempFileId = yield* Random.nextUUIDv4;
const targetDirectory = path.dirname(input.filePath);

yield* fs.makeDirectory(targetDirectory, { recursive: true });
Expand All @@ -26,7 +24,7 @@ export const writeFileStringAtomically = (input: {
directory: targetDirectory,
prefix: `${path.basename(input.filePath)}.`,
});
const tempPath = path.join(tempDirectory, `${tempFileId}.tmp`);
const tempPath = path.join(tempDirectory, "contents.tmp");

yield* fs.writeFileString(tempPath, input.contents);
if (input.mode !== undefined) {
Expand Down
2 changes: 1 addition & 1 deletion apps/server/src/auth/Services/AuthControlPlane.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,5 +69,5 @@ export interface AuthControlPlaneShape {
}

export class AuthControlPlane extends Context.Service<AuthControlPlane, AuthControlPlaneShape>()(
"t3/AuthControlPlane",
"@ru-code/ru-code/auth/Services/AuthControlPlane",
) {}
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,4 @@ export interface BootstrapCredentialServiceShape {
export class BootstrapCredentialService extends Context.Service<
BootstrapCredentialService,
BootstrapCredentialServiceShape
>()("t3/auth/Services/BootstrapCredentialService") {}
>()("@ru-code/ru-code/auth/Services/BootstrapCredentialService") {}
2 changes: 1 addition & 1 deletion apps/server/src/auth/Services/ServerAuth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,5 +92,5 @@ export interface ServerAuthShape {
}

export class ServerAuth extends Context.Service<ServerAuth, ServerAuthShape>()(
"t3/auth/Services/ServerAuth",
"@ru-code/ru-code/auth/Services/ServerAuth",
) {}
2 changes: 1 addition & 1 deletion apps/server/src/auth/Services/ServerAuthPolicy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ export interface ServerAuthPolicyShape {
}

export class ServerAuthPolicy extends Context.Service<ServerAuthPolicy, ServerAuthPolicyShape>()(
"t3/auth/Services/ServerAuthPolicy",
"@ru-code/ru-code/auth/Services/ServerAuthPolicy",
) {}
2 changes: 1 addition & 1 deletion apps/server/src/auth/Services/ServerSecretStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,5 @@ export interface ServerSecretStoreShape {
}

export class ServerSecretStore extends Context.Service<ServerSecretStore, ServerSecretStoreShape>()(
"t3/auth/Services/ServerSecretStore",
"@ru-code/ru-code/auth/Services/ServerSecretStore",
) {}
2 changes: 1 addition & 1 deletion apps/server/src/auth/Services/SessionCredentialService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,4 +88,4 @@ export interface SessionCredentialServiceShape {
export class SessionCredentialService extends Context.Service<
SessionCredentialService,
SessionCredentialServiceShape
>()("t3/auth/Services/SessionCredentialService") {}
>()("@ru-code/ru-code/auth/Services/SessionCredentialService") {}
4 changes: 2 additions & 2 deletions apps/server/src/checkpointing/Errors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export class CheckpointUnavailableError extends Schema.TaggedErrorClass<Checkpoi
threadId: Schema.String,
turnCount: Schema.Number,
detail: Schema.String,
cause: Schema.optional(Schema.Defect),
cause: Schema.optional(Schema.Defect()),
},
) {
override get message(): string {
Expand All @@ -27,7 +27,7 @@ export class CheckpointInvariantError extends Schema.TaggedErrorClass<Checkpoint
{
operation: Schema.String,
detail: Schema.String,
cause: Schema.optional(Schema.Defect),
cause: Schema.optional(Schema.Defect()),
},
) {
override get message(): string {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,4 @@ export interface CheckpointDiffQueryShape {
export class CheckpointDiffQuery extends Context.Service<
CheckpointDiffQuery,
CheckpointDiffQueryShape
>()("t3/checkpointing/Services/CheckpointDiffQuery") {}
>()("@ru-code/ru-code/checkpointing/Services/CheckpointDiffQuery") {}
2 changes: 1 addition & 1 deletion apps/server/src/checkpointing/Services/CheckpointStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,5 +97,5 @@ export interface CheckpointStoreShape {
* CheckpointStore - Service tag for checkpoint persistence and restore operations.
*/
export class CheckpointStore extends Context.Service<CheckpointStore, CheckpointStoreShape>()(
"t3/checkpointing/Services/CheckpointStore",
"@ru-code/ru-code/checkpointing/Services/CheckpointStore",
) {}
2 changes: 1 addition & 1 deletion apps/server/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ export const ensureServerDirectories = Effect.fn(function* (derivedPaths: Server
* ServerConfig - Service tag for server runtime configuration.
*/
export class ServerConfig extends Context.Service<ServerConfig, ServerConfigShape>()(
"t3/config/ServerConfig",
"@ru-code/ru-code/config/ServerConfig",
) {
static readonly layerTest = (cwd: string, baseDirOrPrefix: string | { prefix: string }) =>
Layer.effect(
Expand Down
5 changes: 3 additions & 2 deletions apps/server/src/environment/Layers/ServerEnvironment.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { EnvironmentId, type ExecutionEnvironmentDescriptor } from "@t3tools/contracts";
import * as Crypto from "effect/Crypto";
import * as Effect from "effect/Effect";
import * as FileSystem from "effect/FileSystem";
import * as Layer from "effect/Layer";
import * as Path from "effect/Path";
import * as Random from "effect/Random";

import * as ProcessRunner from "../../processRunner.ts";
import { ServerConfig } from "../../config.ts";
Expand Down Expand Up @@ -39,6 +39,7 @@ export const makeServerEnvironment = Effect.fn("makeServerEnvironment")(function
const fileSystem = yield* FileSystem.FileSystem;
const path = yield* Path.Path;
const serverConfig = yield* ServerConfig;
const crypto = yield* Crypto.Crypto;

const readPersistedEnvironmentId = Effect.gen(function* () {
const exists = yield* fileSystem
Expand All @@ -64,7 +65,7 @@ export const makeServerEnvironment = Effect.fn("makeServerEnvironment")(function
return persisted;
}

const generated = yield* Random.nextUUIDv4;
const generated = yield* crypto.randomUUIDv4;
yield* persistEnvironmentId(generated);
return generated;
});
Expand Down
2 changes: 1 addition & 1 deletion apps/server/src/environment/Services/ServerEnvironment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ export interface ServerEnvironmentShape {
}

export class ServerEnvironment extends Context.Service<ServerEnvironment, ServerEnvironmentShape>()(
"t3/environment/Services/ServerEnvironment",
"@ru-code/ru-code/environment/Services/ServerEnvironment",
) {}
2 changes: 1 addition & 1 deletion apps/server/src/git/GitManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ export interface GitManagerShape {
}

export class GitManager extends Context.Service<GitManager, GitManagerShape>()(
"t3/git/GitManager",
"@ru-code/ru-code/git/GitManager",
) {}

const MAX_PROGRESS_TEXT_LENGTH = 500;
Expand Down
2 changes: 1 addition & 1 deletion apps/server/src/git/GitWorkflowService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ export interface GitWorkflowServiceShape {
export class GitWorkflowService extends Context.Service<
GitWorkflowService,
GitWorkflowServiceShape
>()("t3/git/GitWorkflowService") {}
>()("@ru-code/ru-code/git/GitWorkflowService") {}

const unsupportedGitWorkflow = (operation: string, cwd: string, detail: string) =>
new GitManagerError({
Expand Down
2 changes: 1 addition & 1 deletion apps/server/src/keybindings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ export interface KeybindingsShape {
* Keybindings - Service tag for keybinding configuration operations.
*/
export class Keybindings extends Context.Service<Keybindings, KeybindingsShape>()(
"t3/keybindings",
"@ru-code/ru-code/keybindings",
) {}

const makeKeybindings = Effect.gen(function* () {
Expand Down
2 changes: 1 addition & 1 deletion apps/server/src/open.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ export interface OpenShape {
/**
* Open - Service tag for browser/editor launch operations.
*/
export class Open extends Context.Service<Open, OpenShape>()("t3/open") {}
export class Open extends Context.Service<Open, OpenShape>()("@ru-code/ru-code/open") {}

// ==============================
// Implementations
Expand Down
12 changes: 6 additions & 6 deletions apps/server/src/orchestration/Errors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export class OrchestrationCommandJsonParseError extends Schema.TaggedErrorClass<
"OrchestrationCommandJsonParseError",
{
detail: Schema.String,
cause: Schema.optional(Schema.Defect),
cause: Schema.optional(Schema.Defect()),
},
) {
override get message(): string {
Expand All @@ -19,7 +19,7 @@ export class OrchestrationCommandDecodeError extends Schema.TaggedErrorClass<Orc
"OrchestrationCommandDecodeError",
{
issue: Schema.String,
cause: Schema.optional(Schema.Defect),
cause: Schema.optional(Schema.Defect()),
},
) {
override get message(): string {
Expand All @@ -32,7 +32,7 @@ export class OrchestrationCommandInvariantError extends Schema.TaggedErrorClass<
{
commandType: Schema.String,
detail: Schema.String,
cause: Schema.optional(Schema.Defect),
cause: Schema.optional(Schema.Defect()),
},
) {
override get message(): string {
Expand All @@ -45,7 +45,7 @@ export class OrchestrationCommandPreviouslyRejectedError extends Schema.TaggedEr
{
commandId: Schema.String,
detail: Schema.String,
cause: Schema.optional(Schema.Defect),
cause: Schema.optional(Schema.Defect()),
},
) {
override get message(): string {
Expand All @@ -58,7 +58,7 @@ export class OrchestrationProjectorDecodeError extends Schema.TaggedErrorClass<O
{
eventType: Schema.String,
issue: Schema.String,
cause: Schema.optional(Schema.Defect),
cause: Schema.optional(Schema.Defect()),
},
) {
override get message(): string {
Expand All @@ -71,7 +71,7 @@ export class OrchestrationListenerCallbackError extends Schema.TaggedErrorClass<
{
listener: Schema.Literals(["read-model", "domain-event"]),
detail: Schema.String,
cause: Schema.optional(Schema.Defect),
cause: Schema.optional(Schema.Defect()),
},
) {
override get message(): string {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,5 @@ export interface CheckpointReactorShape {
* CheckpointReactor - Service tag for checkpoint reactor workers.
*/
export class CheckpointReactor extends Context.Service<CheckpointReactor, CheckpointReactorShape>()(
"t3/orchestration/Services/CheckpointReactor",
"@ru-code/ru-code/orchestration/Services/CheckpointReactor",
) {}
Original file line number Diff line number Diff line change
Expand Up @@ -67,4 +67,4 @@ export interface OrchestrationEngineShape {
export class OrchestrationEngineService extends Context.Service<
OrchestrationEngineService,
OrchestrationEngineShape
>()("t3/orchestration/Services/OrchestrationEngine/OrchestrationEngineService") {}
>()("@ru-code/ru-code/orchestration/Services/OrchestrationEngine/OrchestrationEngineService") {}
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@ export interface OrchestrationReactorShape {
export class OrchestrationReactor extends Context.Service<
OrchestrationReactor,
OrchestrationReactorShape
>()("t3/orchestration/Services/OrchestrationReactor") {}
>()("@ru-code/ru-code/orchestration/Services/OrchestrationReactor") {}
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,4 @@ export interface OrchestrationProjectionPipelineShape {
export class OrchestrationProjectionPipeline extends Context.Service<
OrchestrationProjectionPipeline,
OrchestrationProjectionPipelineShape
>()("t3/orchestration/Services/ProjectionPipeline/OrchestrationProjectionPipeline") {}
>()("@ru-code/ru-code/orchestration/Services/ProjectionPipeline/OrchestrationProjectionPipeline") {}
Original file line number Diff line number Diff line change
Expand Up @@ -146,4 +146,4 @@ export interface ProjectionSnapshotQueryShape {
export class ProjectionSnapshotQuery extends Context.Service<
ProjectionSnapshotQuery,
ProjectionSnapshotQueryShape
>()("t3/orchestration/Services/ProjectionSnapshotQuery") {}
>()("@ru-code/ru-code/orchestration/Services/ProjectionSnapshotQuery") {}
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,4 @@ export interface ProviderCommandReactorShape {
export class ProviderCommandReactor extends Context.Service<
ProviderCommandReactor,
ProviderCommandReactorShape
>()("t3/orchestration/Services/ProviderCommandReactor") {}
>()("@ru-code/ru-code/orchestration/Services/ProviderCommandReactor") {}
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,4 @@ export interface ProviderRuntimeIngestionShape {
export class ProviderRuntimeIngestionService extends Context.Service<
ProviderRuntimeIngestionService,
ProviderRuntimeIngestionShape
>()("t3/orchestration/Services/ProviderRuntimeIngestion/ProviderRuntimeIngestionService") {}
>()("@ru-code/ru-code/orchestration/Services/ProviderRuntimeIngestion/ProviderRuntimeIngestionService") {}
Original file line number Diff line number Diff line change
Expand Up @@ -62,5 +62,5 @@ export interface RuntimeReceiptBusShape {
}

export class RuntimeReceiptBus extends Context.Service<RuntimeReceiptBus, RuntimeReceiptBusShape>()(
"t3/orchestration/Services/RuntimeReceiptBus",
"@ru-code/ru-code/orchestration/Services/RuntimeReceiptBus",
) {}
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,4 @@ export interface ThreadDeletionReactorShape {
export class ThreadDeletionReactor extends Context.Service<
ThreadDeletionReactor,
ThreadDeletionReactorShape
>()("t3/orchestration/Services/ThreadDeletionReactor") {}
>()("@ru-code/ru-code/orchestration/Services/ThreadDeletionReactor") {}
8 changes: 4 additions & 4 deletions apps/server/src/persistence/Errors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export class PersistenceSqlError extends Schema.TaggedErrorClass<PersistenceSqlE
{
operation: Schema.String,
detail: Schema.String,
cause: Schema.optional(Schema.Defect),
cause: Schema.optional(Schema.Defect()),
},
) {
override get message(): string {
Expand All @@ -23,7 +23,7 @@ export class PersistenceDecodeError extends Schema.TaggedErrorClass<PersistenceD
{
operation: Schema.String,
issue: Schema.String,
cause: Schema.optional(Schema.Defect),
cause: Schema.optional(Schema.Defect()),
},
) {
override get message(): string {
Expand Down Expand Up @@ -72,7 +72,7 @@ export class ProviderSessionRepositoryValidationError extends Schema.TaggedError
{
operation: Schema.String,
issue: Schema.String,
cause: Schema.optional(Schema.Defect),
cause: Schema.optional(Schema.Defect()),
},
) {
override get message(): string {
Expand All @@ -85,7 +85,7 @@ export class ProviderSessionRepositoryPersistenceError extends Schema.TaggedErro
{
operation: Schema.String,
detail: Schema.String,
cause: Schema.optional(Schema.Defect),
cause: Schema.optional(Schema.Defect()),
},
) {
override get message(): string {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import * as SqlClient from "effect/unstable/sql/SqlClient";
import * as Effect from "effect/Effect";

export default Effect.gen(function* () {
yield* SqlClient.SqlClient;
});
export default Effect.asVoid(SqlClient.SqlClient);
12 changes: 5 additions & 7 deletions apps/server/src/persistence/NodeSqliteClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -252,14 +252,12 @@ export const layerConfig = (
config: Config.Wrap<SqliteClientConfig>,
): Layer.Layer<Client.SqlClient, Config.ConfigError> =>
Layer.effectContext(
Config.unwrap(config)
.asEffect()
.pipe(
Effect.flatMap(make),
Effect.map((client) =>
Context.make(SqliteClient, client).pipe(Context.add(Client.SqlClient, client)),
),
Config.unwrap(config).pipe(
Effect.flatMap(make),
Effect.map((client) =>
Context.make(SqliteClient, client).pipe(Context.add(Client.SqlClient, client)),
),
),
).pipe(Layer.provide(Reactivity.layer));

export const layer = (config: SqliteClientConfig): Layer.Layer<Client.SqlClient> =>
Expand Down
2 changes: 1 addition & 1 deletion apps/server/src/persistence/Services/AuthPairingLinks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,4 +75,4 @@ export interface AuthPairingLinkRepositoryShape {
export class AuthPairingLinkRepository extends Context.Service<
AuthPairingLinkRepository,
AuthPairingLinkRepositoryShape
>()("t3/persistence/Services/AuthPairingLinks/AuthPairingLinkRepository") {}
>()("@ru-code/ru-code/persistence/Services/AuthPairingLinks/AuthPairingLinkRepository") {}
2 changes: 1 addition & 1 deletion apps/server/src/persistence/Services/AuthSessions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,4 +92,4 @@ export interface AuthSessionRepositoryShape {
export class AuthSessionRepository extends Context.Service<
AuthSessionRepository,
AuthSessionRepositoryShape
>()("t3/persistence/Services/AuthSessions/AuthSessionRepository") {}
>()("@ru-code/ru-code/persistence/Services/AuthSessions/AuthSessionRepository") {}
2 changes: 1 addition & 1 deletion apps/server/src/persistence/Services/McpBinding.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,4 @@ export interface McpBindingRepositoryShape {
export class McpBindingRepository extends Context.Service<
McpBindingRepository,
McpBindingRepositoryShape
>()("ru-fork/persistence/Services/McpBinding/McpBindingRepository") {}
>()("@ru-code/ru-code/persistence/Services/McpBinding/McpBindingRepository") {}
2 changes: 1 addition & 1 deletion apps/server/src/persistence/Services/McpCatalog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ export interface McpCatalogRepositoryShape {
export class McpCatalogRepository extends Context.Service<
McpCatalogRepository,
McpCatalogRepositoryShape
>()("ru-fork/persistence/Services/McpCatalog/McpCatalogRepository") {}
>()("@ru-code/ru-code/persistence/Services/McpCatalog/McpCatalogRepository") {}
2 changes: 1 addition & 1 deletion apps/server/src/persistence/Services/McpProbeCache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@ export interface McpProbeCacheRepositoryShape {
export class McpProbeCacheRepository extends Context.Service<
McpProbeCacheRepository,
McpProbeCacheRepositoryShape
>()("ru-fork/persistence/Services/McpProbeCache/McpProbeCacheRepository") {}
>()("@ru-code/ru-code/persistence/Services/McpProbeCache/McpProbeCacheRepository") {}
Original file line number Diff line number Diff line change
Expand Up @@ -69,4 +69,4 @@ export interface OrchestrationCommandReceiptRepositoryShape {
export class OrchestrationCommandReceiptRepository extends Context.Service<
OrchestrationCommandReceiptRepository,
OrchestrationCommandReceiptRepositoryShape
>()("t3/persistence/Services/OrchestrationCommandReceipts/OrchestrationCommandReceiptRepository") {}
>()("@ru-code/ru-code/persistence/Services/OrchestrationCommandReceipts/OrchestrationCommandReceiptRepository") {}
Original file line number Diff line number Diff line change
Expand Up @@ -68,4 +68,4 @@ export interface OrchestrationEventStoreShape {
export class OrchestrationEventStore extends Context.Service<
OrchestrationEventStore,
OrchestrationEventStoreShape
>()("t3/persistence/Services/OrchestrationEventStore") {}
>()("@ru-code/ru-code/persistence/Services/OrchestrationEventStore") {}
Original file line number Diff line number Diff line change
Expand Up @@ -92,4 +92,4 @@ export interface ProjectionCheckpointRepositoryShape {
export class ProjectionCheckpointRepository extends Context.Service<
ProjectionCheckpointRepository,
ProjectionCheckpointRepositoryShape
>()("t3/persistence/Services/ProjectionCheckpoints/ProjectionCheckpointRepository") {}
>()("@ru-code/ru-code/persistence/Services/ProjectionCheckpoints/ProjectionCheckpointRepository") {}
Loading
Loading