Refactor session handling and protocol flow

This commit is contained in:
Julius Marminge committed 2026-06-04 19:48:37 -07:00
1 parent 74a0d90c54
commit f438a94453
36 files changed
+643 -997

No files matched your search

@@ -161,7 +161,7 @@ class OrchestrationHarnessRuntimeError extends Schema.TaggedErrorClass<Orchestra
"OrchestrationHarnessRuntimeError",
{
operation: Schema.String,
cause: Schema.optional(Schema.Defect),
cause: Schema.optional(Schema.Defect()),
},
) {}
+2 -2
View File
@@ -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 {
@@ -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 {
@@ -47,7 +47,7 @@ class ProcessDiagnosticsError extends Schema.TaggedErrorClass<ProcessDiagnostics
"ProcessDiagnosticsError",
{
message: Schema.String,
cause: Schema.optional(Schema.Defect),
cause: Schema.optional(Schema.Defect()),
},
) {}
const isProcessDiagnosticsError = Schema.is(ProcessDiagnosticsError);
+6 -6
View File
@@ -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 {
@@ -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 {
@@ -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 {
@@ -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 {
@@ -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 {
@@ -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 {
+4 -4
View File
@@ -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 {
@@ -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 {
@@ -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 {
@@ -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 {
+11 -11
View File
@@ -11,7 +11,7 @@ export class ProviderAdapterValidationError extends Schema.TaggedErrorClass<Prov
provider: Schema.String,
operation: Schema.String,
issue: Schema.String,
cause: Schema.optional(Schema.Defect),
cause: Schema.optional(Schema.Defect()),
},
) {
override get message(): string {
@@ -27,7 +27,7 @@ export class ProviderAdapterSessionNotFoundError extends Schema.TaggedErrorClass
{
provider: Schema.String,
threadId: Schema.String,
cause: Schema.optional(Schema.Defect),
cause: Schema.optional(Schema.Defect()),
},
) {
override get message(): string {
@@ -43,7 +43,7 @@ export class ProviderAdapterSessionClosedError extends Schema.TaggedErrorClass<P
{
provider: Schema.String,
threadId: Schema.String,
cause: Schema.optional(Schema.Defect),
cause: Schema.optional(Schema.Defect()),
},
) {
override get message(): string {
@@ -60,7 +60,7 @@ export class ProviderAdapterRequestError extends Schema.TaggedErrorClass<Provide
provider: Schema.String,
method: Schema.String,
detail: Schema.String,
cause: Schema.optional(Schema.Defect),
cause: Schema.optional(Schema.Defect()),
},
) {
override get message(): string {
@@ -77,7 +77,7 @@ export class ProviderAdapterProcessError extends Schema.TaggedErrorClass<Provide
provider: Schema.String,
threadId: Schema.String,
detail: Schema.String,
cause: Schema.optional(Schema.Defect),
cause: Schema.optional(Schema.Defect()),
},
) {
override get message(): string {
@@ -93,7 +93,7 @@ export class ProviderValidationError extends Schema.TaggedErrorClass<ProviderVal
{
operation: Schema.String,
issue: Schema.String,
cause: Schema.optional(Schema.Defect),
cause: Schema.optional(Schema.Defect()),
},
) {
override get message(): string {
@@ -108,7 +108,7 @@ export class ProviderUnsupportedError extends Schema.TaggedErrorClass<ProviderUn
"ProviderUnsupportedError",
{
provider: Schema.String,
cause: Schema.optional(Schema.Defect),
cause: Schema.optional(Schema.Defect()),
},
) {
override get message(): string {
@@ -129,7 +129,7 @@ export class ProviderInstanceNotFoundError extends Schema.TaggedErrorClass<Provi
"ProviderInstanceNotFoundError",
{
instanceId: Schema.String,
cause: Schema.optional(Schema.Defect),
cause: Schema.optional(Schema.Defect()),
},
) {
override get message(): string {
@@ -148,7 +148,7 @@ export class ProviderDriverError extends Schema.TaggedErrorClass<ProviderDriverE
driver: Schema.String,
instanceId: Schema.String,
detail: Schema.String,
cause: Schema.optional(Schema.Defect),
cause: Schema.optional(Schema.Defect()),
},
) {
override get message(): string {
@@ -163,7 +163,7 @@ export class ProviderSessionNotFoundError extends Schema.TaggedErrorClass<Provid
"ProviderSessionNotFoundError",
{
threadId: Schema.String,
cause: Schema.optional(Schema.Defect),
cause: Schema.optional(Schema.Defect()),
},
) {
override get message(): string {
@@ -179,7 +179,7 @@ export class ProviderSessionDirectoryPersistenceError extends Schema.TaggedError
{
operation: Schema.String,
detail: Schema.String,
cause: Schema.optional(Schema.Defect),
cause: Schema.optional(Schema.Defect()),
},
) {
override get message(): string {
@@ -21,7 +21,7 @@ export class AzureDevOpsCliError extends Schema.TaggedErrorClass<AzureDevOpsCliE
{
operation: Schema.String,
detail: Schema.String,
cause: Schema.optional(Schema.Defect),
cause: Schema.optional(Schema.Defect()),
},
) {
override get message(): string {
@@ -37,7 +37,7 @@ export class BitbucketApiError extends Schema.TaggedErrorClass<BitbucketApiError
operation: Schema.String,
detail: Schema.String,
status: Schema.optional(Schema.Number),
cause: Schema.optional(Schema.Defect),
cause: Schema.optional(Schema.Defect()),
},
) {
override get message(): string {
+1 -1
View File
@@ -19,7 +19,7 @@ const DEFAULT_TIMEOUT_MS = 30_000;
export class GitHubCliError extends Schema.TaggedErrorClass<GitHubCliError>()("GitHubCliError", {
operation: Schema.String,
detail: Schema.String,
cause: Schema.optional(Schema.Defect),
cause: Schema.optional(Schema.Defect()),
}) {
override get message(): string {
return `GitHub CLI failed in ${this.operation}: ${this.detail}`;
+1 -1
View File
@@ -18,7 +18,7 @@ const DEFAULT_TIMEOUT_MS = 30_000;
export class GitLabCliError extends Schema.TaggedErrorClass<GitLabCliError>()("GitLabCliError", {
operation: Schema.String,
detail: Schema.String,
cause: Schema.optional(Schema.Defect),
cause: Schema.optional(Schema.Defect()),
}) {
override get message(): string {
return `GitLab CLI failed in ${this.operation}: ${this.detail}`;
+1 -1
View File
@@ -19,7 +19,7 @@ const ClaudeJsonSchema = Schema.Struct({
class IdentifyUserError extends Schema.TaggedErrorClass<IdentifyUserError>()("IdentifyUserError", {
message: Schema.String,
cause: Schema.optional(Schema.Defect),
cause: Schema.optional(Schema.Defect()),
}) {}
const hash = (value: string) =>
+2 -2
View File
@@ -64,7 +64,7 @@ class TerminalSubprocessCheckError extends Schema.TaggedErrorClass<TerminalSubpr
"TerminalSubprocessCheckError",
{
message: Schema.String,
cause: Schema.optional(Schema.Defect),
cause: Schema.optional(Schema.Defect()),
terminalPid: Schema.Number,
command: Schema.Literals(["powershell", "pgrep", "ps"]),
},
@@ -74,7 +74,7 @@ class TerminalProcessSignalError extends Schema.TaggedErrorClass<TerminalProcess
"TerminalProcessSignalError",
{
message: Schema.String,
cause: Schema.optional(Schema.Defect),
cause: Schema.optional(Schema.Defect()),
signal: Schema.Literals(["SIGTERM", "SIGKILL"]),
},
) {}
+1 -1
View File
@@ -16,7 +16,7 @@ import * as Context from "effect/Context";
export class PtySpawnError extends Schema.TaggedErrorClass<PtySpawnError>()("PtySpawnError", {
adapter: Schema.String,
message: Schema.String,
cause: Schema.optional(Schema.Defect),
cause: Schema.optional(Schema.Defect()),
}) {}
export interface PtyExitEvent {
@@ -23,7 +23,7 @@ export class WorkspaceEntriesError extends Schema.TaggedErrorClass<WorkspaceEntr
cwd: Schema.String,
operation: Schema.String,
detail: Schema.String,
cause: Schema.optional(Schema.Defect),
cause: Schema.optional(Schema.Defect()),
},
) {}
@@ -34,7 +34,7 @@ export class WorkspaceEntriesBrowseError extends Schema.TaggedErrorClass<Workspa
partialPath: Schema.String,
operation: Schema.String,
detail: Schema.String,
cause: Schema.optional(Schema.Defect),
cause: Schema.optional(Schema.Defect()),
},
) {}
@@ -20,7 +20,7 @@ export class WorkspaceFileSystemError extends Schema.TaggedErrorClass<WorkspaceF
relativePath: Schema.optional(Schema.String),
operation: Schema.String,
detail: Schema.String,
cause: Schema.optional(Schema.Defect),
cause: Schema.optional(Schema.Defect()),
},
) {}
+1 -1
View File
@@ -14,7 +14,7 @@
"@t3tools/client-runtime": "workspace:*",
"@t3tools/contracts": "workspace:*",
"@t3tools/shared": "workspace:*",
"alchemy": "2.0.0-beta.49",
"alchemy": "https://pkg.ing/alchemy/8b9c241",
"drizzle-orm": "1.0.0-rc.3",
"effect": "catalog:"
},
+1 -1
View File
@@ -54,6 +54,6 @@ export class ExternalLauncherError extends Schema.TaggedErrorClass<ExternalLaunc
"ExternalLauncherError",
{
message: Schema.String,
cause: Schema.optional(Schema.Defect),
cause: Schema.optional(Schema.Defect()),
},
) {}
+1 -1
View File
@@ -25,6 +25,6 @@ export class FilesystemBrowseError extends Schema.TaggedErrorClass<FilesystemBro
"FilesystemBrowseError",
{
message: TrimmedNonEmptyString,
cause: Schema.optional(Schema.Defect),
cause: Schema.optional(Schema.Defect()),
},
) {}
+3 -3
View File
@@ -322,7 +322,7 @@ export class GitCommandError extends Schema.TaggedErrorClass<GitCommandError>()(
command: Schema.String,
cwd: Schema.String,
detail: Schema.String,
cause: Schema.optional(Schema.Defect),
cause: Schema.optional(Schema.Defect()),
}) {
override get message(): string {
return `Git command failed in ${this.operation}: ${this.command} (${this.cwd}) - ${this.detail}`;
@@ -334,7 +334,7 @@ export class TextGenerationError extends Schema.TaggedErrorClass<TextGenerationE
{
operation: Schema.String,
detail: Schema.String,
cause: Schema.optional(Schema.Defect),
cause: Schema.optional(Schema.Defect()),
},
) {
override get message(): string {
@@ -345,7 +345,7 @@ export class TextGenerationError extends Schema.TaggedErrorClass<TextGenerationE
export class GitManagerError extends Schema.TaggedErrorClass<GitManagerError>()("GitManagerError", {
operation: Schema.String,
detail: Schema.String,
cause: Schema.optional(Schema.Defect),
cause: Schema.optional(Schema.Defect()),
}) {
override get message(): string {
return `Git manager failed in ${this.operation}: ${this.detail}`;
+1 -1
View File
@@ -153,7 +153,7 @@ export class KeybindingsConfigError extends Schema.TaggedErrorClass<KeybindingsC
{
configPath: Schema.String,
detail: Schema.String,
cause: Schema.optional(Schema.Defect),
cause: Schema.optional(Schema.Defect()),
},
) {
override get message(): string {
+5 -5
View File
@@ -1241,7 +1241,7 @@ export class OrchestrationGetSnapshotError extends Schema.TaggedErrorClass<Orche
"OrchestrationGetSnapshotError",
{
message: TrimmedNonEmptyString,
cause: Schema.optional(Schema.Defect),
cause: Schema.optional(Schema.Defect()),
},
) {}
@@ -1249,7 +1249,7 @@ export class OrchestrationDispatchCommandError extends Schema.TaggedErrorClass<O
"OrchestrationDispatchCommandError",
{
message: TrimmedNonEmptyString,
cause: Schema.optional(Schema.Defect),
cause: Schema.optional(Schema.Defect()),
},
) {}
@@ -1257,7 +1257,7 @@ export class OrchestrationGetTurnDiffError extends Schema.TaggedErrorClass<Orche
"OrchestrationGetTurnDiffError",
{
message: TrimmedNonEmptyString,
cause: Schema.optional(Schema.Defect),
cause: Schema.optional(Schema.Defect()),
},
) {}
@@ -1265,7 +1265,7 @@ export class OrchestrationGetFullThreadDiffError extends Schema.TaggedErrorClass
"OrchestrationGetFullThreadDiffError",
{
message: TrimmedNonEmptyString,
cause: Schema.optional(Schema.Defect),
cause: Schema.optional(Schema.Defect()),
},
) {}
@@ -1273,6 +1273,6 @@ export class OrchestrationReplayEventsError extends Schema.TaggedErrorClass<Orch
"OrchestrationReplayEventsError",
{
message: TrimmedNonEmptyString,
cause: Schema.optional(Schema.Defect),
cause: Schema.optional(Schema.Defect()),
},
) {}
+2 -2
View File
@@ -30,7 +30,7 @@ export class ProjectSearchEntriesError extends Schema.TaggedErrorClass<ProjectSe
"ProjectSearchEntriesError",
{
message: TrimmedNonEmptyString,
cause: Schema.optional(Schema.Defect),
cause: Schema.optional(Schema.Defect()),
},
) {}
@@ -50,6 +50,6 @@ export class ProjectWriteFileError extends Schema.TaggedErrorClass<ProjectWriteF
"ProjectWriteFileError",
{
message: TrimmedNonEmptyString,
cause: Schema.optional(Schema.Defect),
cause: Schema.optional(Schema.Defect()),
},
) {}
+1 -1
View File
@@ -550,7 +550,7 @@ export class ServerProviderUpdateError extends Schema.TaggedErrorClass<ServerPro
{
provider: ProviderDriverKind,
reason: TrimmedNonEmptyString,
cause: Schema.optional(Schema.Defect),
cause: Schema.optional(Schema.Defect()),
},
) {
override get message(): string {
+1 -1
View File
@@ -390,7 +390,7 @@ export class ServerSettingsError extends Schema.TaggedErrorClass<ServerSettingsE
{
settingsPath: Schema.String,
detail: Schema.String,
cause: Schema.optional(Schema.Defect),
cause: Schema.optional(Schema.Defect()),
},
) {
override get message(): string {
+2 -2
View File
@@ -156,7 +156,7 @@ export class SourceControlProviderError extends Schema.TaggedErrorClass<SourceCo
provider: SourceControlProviderKind,
operation: Schema.String,
detail: Schema.String,
cause: Schema.optional(Schema.Defect),
cause: Schema.optional(Schema.Defect()),
},
) {
override get message(): string {
@@ -170,7 +170,7 @@ export class SourceControlRepositoryError extends Schema.TaggedErrorClass<Source
provider: SourceControlProviderKind,
operation: Schema.String,
detail: Schema.String,
cause: Schema.optional(Schema.Defect),
cause: Schema.optional(Schema.Defect()),
},
) {
override get message(): string {
+2 -2
View File
@@ -237,7 +237,7 @@ export class TerminalCwdError extends Schema.TaggedErrorClass<TerminalCwdError>(
{
cwd: Schema.String,
reason: Schema.Literals(["notFound", "notDirectory", "statFailed"]),
cause: Schema.optional(Schema.Defect),
cause: Schema.optional(Schema.Defect()),
},
) {
override get message() {
@@ -266,7 +266,7 @@ export class TerminalHistoryError extends Schema.TaggedErrorClass<TerminalHistor
operation: Schema.Literals(["read", "truncate", "migrate"]),
threadId: Schema.String,
terminalId: Schema.String,
cause: Schema.optional(Schema.Defect),
cause: Schema.optional(Schema.Defect()),
},
) {
override get message() {
+3 -3
View File
@@ -92,7 +92,7 @@ export class VcsProcessSpawnError extends Schema.TaggedErrorClass<VcsProcessSpaw
operation: Schema.String,
command: Schema.String,
cwd: Schema.String,
cause: Schema.Defect,
cause: Schema.Defect(),
},
) {
override get message(): string {
@@ -150,7 +150,7 @@ export class VcsOutputDecodeError extends Schema.TaggedErrorClass<VcsOutputDecod
command: Schema.String,
cwd: Schema.String,
detail: Schema.String,
cause: Schema.optional(Schema.Defect),
cause: Schema.optional(Schema.Defect()),
},
) {
override get message(): string {
@@ -200,7 +200,7 @@ export class VcsRepositoryDetectionError extends Schema.TaggedErrorClass<VcsRepo
operation: Schema.String,
cwd: Schema.String,
detail: Schema.String,
cause: Schema.optional(Schema.Defect),
cause: Schema.optional(Schema.Defect()),
},
) {
override get message(): string {
+4 -4
View File
@@ -4,7 +4,7 @@ import * as AcpSchema from "./_generated/schema.gen.ts";
export class AcpSpawnError extends Schema.TaggedErrorClass<AcpSpawnError>()("AcpSpawnError", {
command: Schema.optional(Schema.String),
cause: Schema.Defect,
cause: Schema.Defect(),
}) {
override get message() {
return this.command
@@ -17,7 +17,7 @@ export class AcpProcessExitedError extends Schema.TaggedErrorClass<AcpProcessExi
"AcpProcessExitedError",
{
code: Schema.optional(Schema.Number),
cause: Schema.optional(Schema.Defect),
cause: Schema.optional(Schema.Defect()),
},
) {
override get message() {
@@ -31,7 +31,7 @@ export class AcpProtocolParseError extends Schema.TaggedErrorClass<AcpProtocolPa
"AcpProtocolParseError",
{
detail: Schema.String,
cause: Schema.optional(Schema.Defect),
cause: Schema.optional(Schema.Defect()),
},
) {
override get message() {
@@ -43,7 +43,7 @@ export class AcpTransportError extends Schema.TaggedErrorClass<AcpTransportError
"AcpTransportError",
{
detail: Schema.String,
cause: Schema.Defect,
cause: Schema.Defect(),
},
) {}
@@ -63,7 +63,7 @@ interface JsonSchemaFile {
class GeneratorError extends Schema.TaggedErrorClass<GeneratorError>()("GeneratorError", {
detail: Schema.String,
cause: Schema.optional(Schema.Defect),
cause: Schema.optional(Schema.Defect()),
}) {
override get message() {
return this.detail;
@@ -10,7 +10,7 @@ export class CodexAppServerSpawnError extends Schema.TaggedErrorClass<CodexAppSe
"CodexAppServerSpawnError",
{
command: Schema.optional(Schema.String),
cause: Schema.Defect,
cause: Schema.Defect(),
},
) {
override get message() {
@@ -24,7 +24,7 @@ export class CodexAppServerProcessExitedError extends Schema.TaggedErrorClass<Co
"CodexAppServerProcessExitedError",
{
code: Schema.optional(Schema.Number),
cause: Schema.optional(Schema.Defect),
cause: Schema.optional(Schema.Defect()),
},
) {
override get message() {
@@ -38,7 +38,7 @@ export class CodexAppServerProtocolParseError extends Schema.TaggedErrorClass<Co
"CodexAppServerProtocolParseError",
{
detail: Schema.String,
cause: Schema.optional(Schema.Defect),
cause: Schema.optional(Schema.Defect()),
},
) {
override get message() {
@@ -50,7 +50,7 @@ export class CodexAppServerTransportError extends Schema.TaggedErrorClass<CodexA
"CodexAppServerTransportError",
{
detail: Schema.String,
cause: Schema.Defect,
cause: Schema.Defect(),
},
) {
override get message() {
+1 -1
View File
@@ -8,7 +8,7 @@ import * as Layer from "effect/Layer";
import * as Result from "effect/Result";
import * as Sink from "effect/Sink";
import * as Stream from "effect/Stream";
import * as TestClock from "effect/testing/TestClock";
import { TestClock } from "effect/testing";
import { HttpClient, HttpClientResponse } from "effect/unstable/http";
import { ChildProcess, ChildProcessSpawner } from "effect/unstable/process";
-356
View File
@@ -1,356 +0,0 @@
diff --git a/bin/exec.js b/bin/exec.js
index 9cd9f8059..8317c57be 100644
--- a/bin/exec.js
+++ b/bin/exec.js
@@ -366,6 +366,7 @@ const of = (resource) => {
const asOutput = (t) => isOutput(t) ? t : Effect.isEffect(t) ? new EffectExpr(VoidExpr, () => t) : new LiteralExpr(t);
const isOutput = (value) => value && (typeof value === "object" || typeof value === "function") && ExprSymbol in value;
const ExprSymbol = Symbol.for("alchemy/Expr");
+const exprKind = (node) => node?.[ExprSymbol]?.kind ?? node?.kind;
const isExpr = (value) => value && (typeof value === "object" || typeof value === "function") && ExprSymbol in value;
var BaseExpr = class {
constructor() {}
@@ -389,7 +390,7 @@ var BaseExpr = class {
return this[inspect]();
}
};
-const isResourceExpr = (node) => node?.kind === "ResourceExpr";
+const isResourceExpr = (node) => exprKind(node) === "ResourceExpr";
var ResourceExpr = class extends BaseExpr {
src;
stables;
@@ -404,7 +405,7 @@ var ResourceExpr = class extends BaseExpr {
return this.src.LogicalId;
}
};
-const isPropExpr = (node) => node?.kind === "PropExpr";
+const isPropExpr = (node) => exprKind(node) === "PropExpr";
var PropExpr = class extends BaseExpr {
expr;
identifier;
@@ -419,7 +420,7 @@ var PropExpr = class extends BaseExpr {
return `${this.expr[inspect]()}.${this.identifier.toString()}`;
}
};
-const isLiteralExpr = (node) => node?.kind === "LiteralExpr";
+const isLiteralExpr = (node) => exprKind(node) === "LiteralExpr";
var LiteralExpr = class extends BaseExpr {
value;
kind = "LiteralExpr";
@@ -433,7 +434,7 @@ var LiteralExpr = class extends BaseExpr {
}
};
const VoidExpr = new LiteralExpr(void 0);
-const isApplyExpr = (node) => node?.kind === "ApplyExpr";
+const isApplyExpr = (node) => exprKind(node) === "ApplyExpr";
var ApplyExpr = class extends BaseExpr {
expr;
f;
@@ -448,7 +449,7 @@ var ApplyExpr = class extends BaseExpr {
return `${this.expr[inspect]()}.map(${this.f.toString()})`;
}
};
-const isFlatMapExpr = (node) => node?.kind === "FlatMapExpr";
+const isFlatMapExpr = (node) => exprKind(node) === "FlatMapExpr";
var FlatMapExpr = class extends BaseExpr {
expr;
f;
@@ -463,7 +464,7 @@ var FlatMapExpr = class extends BaseExpr {
return `${this.expr[inspect]()}.flatMap(${this.f.toString()})`;
}
};
-const isEffectExpr = (node) => node?.kind === "EffectExpr";
+const isEffectExpr = (node) => exprKind(node) === "EffectExpr";
var EffectExpr = class extends BaseExpr {
expr;
f;
@@ -478,7 +479,7 @@ var EffectExpr = class extends BaseExpr {
return `${this.expr[inspect]()}.mapEffect(${this.f.toString()})`;
}
};
-const isNamedExpr = (node) => node?.kind === "NamedExpr";
+const isNamedExpr = (node) => exprKind(node) === "NamedExpr";
/**
* Wraps another `Expr` and overrides its `toString()` / inspect output.
*
@@ -500,7 +501,7 @@ var NamedExpr = class extends BaseExpr {
return this.bindingName;
}
};
-const isAllExpr = (node) => node?.kind === "AllExpr";
+const isAllExpr = (node) => exprKind(node) === "AllExpr";
var AllExpr = class extends BaseExpr {
outs;
kind = "AllExpr";
@@ -513,7 +514,7 @@ var AllExpr = class extends BaseExpr {
return `all(${this.outs.map((out) => out[inspect]()).join(", ")})`;
}
};
-const isRefExpr = (node) => node?.kind === "RefExpr";
+const isRefExpr = (node) => exprKind(node) === "RefExpr";
var RefExpr = class extends BaseExpr {
stack;
stage;
@@ -530,7 +531,7 @@ var RefExpr = class extends BaseExpr {
return `ref(${this.resourceId}, { stack: ${this.stack}, stage: ${this.stage} })`;
}
};
-const isStackRefExpr = (node) => node?.kind === "StackRefExpr";
+const isStackRefExpr = (node) => exprKind(node) === "StackRefExpr";
/**
* A reference to the persisted output of a Stack at `(stack, stage)`.
*
diff --git a/lib/Drizzle/Schema.js b/lib/Drizzle/Schema.js
index 95aa38b5d..963ec8534 100644
--- a/lib/Drizzle/Schema.js
+++ b/lib/Drizzle/Schema.js
@@ -99,11 +99,11 @@ export const SchemaProvider = () => Provider.effect(Schema, Effect.gen(function*
const dialect = props.dialect ?? "postgres";
const kit = yield* loadKit(dialect);
const schemaModule = yield* loadSchemaModule(props);
+ const prevEntry = yield* readLatestSnapshot(out);
const cur = yield* Effect.tryPromise({
- try: () => kit.generateDrizzleJson(schemaModule),
+ try: () => kit.generateDrizzleJson(schemaModule, prevEntry?.snapshot?.id),
catch: (cause) => new Error(`drizzle-kit generateDrizzleJson failed: ${cause}`),
});
- const prevEntry = yield* readLatestSnapshot(out);
// For the initial migration, drizzle-kit needs an *empty* snapshot
// produced by `generateDrizzleJson({})`, not a bare `{}` — the
// snapshot has internal fields (`ddl`, etc.) that the differ reads.
@@ -181,4 +181,4 @@ export const SchemaProvider = () => Provider.effect(Schema, Effect.gen(function*
}),
};
}));
-//# sourceMappingURL=Schema.js.map
\ No newline at end of file
+//# sourceMappingURL=Schema.js.map
diff --git a/lib/Output.js b/lib/Output.js
index ce26480d1..e3862cce7 100644
--- a/lib/Output.js
+++ b/lib/Output.js
@@ -28,6 +28,7 @@ export const isOutput = (value) => value &&
(typeof value === "object" || typeof value === "function") &&
ExprSymbol in value;
export const ExprSymbol = Symbol.for("alchemy/Expr");
+const exprKind = (node) => node?.[ExprSymbol]?.kind ?? node?.kind;
export const isExpr = (value) => value &&
(typeof value === "object" || typeof value === "function") &&
ExprSymbol in value;
@@ -57,7 +58,7 @@ export class BaseExpr {
return this[inspect]();
}
}
-export const isResourceExpr = (node) => node?.kind === "ResourceExpr";
+export const isResourceExpr = (node) => exprKind(node) === "ResourceExpr";
export class ResourceExpr extends BaseExpr {
src;
stables;
@@ -72,7 +73,7 @@ export class ResourceExpr extends BaseExpr {
return this.src.LogicalId;
}
}
-export const isPropExpr = (node) => node?.kind === "PropExpr";
+export const isPropExpr = (node) => exprKind(node) === "PropExpr";
export class PropExpr extends BaseExpr {
expr;
identifier;
@@ -88,7 +89,7 @@ export class PropExpr extends BaseExpr {
}
}
export const literal = (value) => new LiteralExpr(value);
-export const isLiteralExpr = (node) => node?.kind === "LiteralExpr";
+export const isLiteralExpr = (node) => exprKind(node) === "LiteralExpr";
export class LiteralExpr extends BaseExpr {
value;
kind = "LiteralExpr";
@@ -106,7 +107,7 @@ export const map = ((...args) => args.length === 1
? (output) => new ApplyExpr(output, args[0])
: new ApplyExpr(args[0], args[1]));
//Output.ApplyExpr<any, any, ResourceLike, any>
-export const isApplyExpr = (node) => node?.kind === "ApplyExpr";
+export const isApplyExpr = (node) => exprKind(node) === "ApplyExpr";
export class ApplyExpr extends BaseExpr {
expr;
f;
@@ -125,7 +126,7 @@ export const mapEffect = (fn) => (output) => new EffectExpr(output, fn);
export const flatMap = ((...args) => args.length === 1
? (output) => new FlatMapExpr(output, args[0])
: new FlatMapExpr(args[0], args[1]));
-export const isFlatMapExpr = (node) => node?.kind === "FlatMapExpr";
+export const isFlatMapExpr = (node) => exprKind(node) === "FlatMapExpr";
export class FlatMapExpr extends BaseExpr {
expr;
f;
@@ -140,7 +141,7 @@ export class FlatMapExpr extends BaseExpr {
return `${this.expr[inspect]()}.flatMap(${this.f.toString()})`;
}
}
-export const isEffectExpr = (node) => node?.kind === "EffectExpr";
+export const isEffectExpr = (node) => exprKind(node) === "EffectExpr";
export class EffectExpr extends BaseExpr {
expr;
f;
@@ -155,7 +156,7 @@ export class EffectExpr extends BaseExpr {
return `${this.expr[inspect]()}.mapEffect(${this.f.toString()})`;
}
}
-export const isNamedExpr = (node) => node?.kind === "NamedExpr";
+export const isNamedExpr = (node) => exprKind(node) === "NamedExpr";
/**
* Wraps another `Expr` and overrides its `toString()` / inspect output.
*
@@ -179,7 +180,7 @@ export class NamedExpr extends BaseExpr {
}
export const named = (expr, name) => new NamedExpr(expr, name);
export const all = (...outs) => new AllExpr(outs);
-export const isAllExpr = (node) => node?.kind === "AllExpr";
+export const isAllExpr = (node) => exprKind(node) === "AllExpr";
export class AllExpr extends BaseExpr {
outs;
kind = "AllExpr";
@@ -192,7 +193,7 @@ export class AllExpr extends BaseExpr {
return `all(${this.outs.map((out) => out[inspect]()).join(", ")})`;
}
}
-export const isRefExpr = (node) => node?.kind === "RefExpr";
+export const isRefExpr = (node) => exprKind(node) === "RefExpr";
export class RefExpr extends BaseExpr {
stack;
stage;
@@ -209,7 +210,7 @@ export class RefExpr extends BaseExpr {
return `ref(${this.resourceId}, { stack: ${this.stack}, stage: ${this.stage} })`;
}
}
-export const isStackRefExpr = (node) => node?.kind === "StackRefExpr";
+export const isStackRefExpr = (node) => exprKind(node) === "StackRefExpr";
/**
* A reference to the persisted output of a Stack at `(stack, stage)`.
*
diff --git a/src/Drizzle/Schema.ts b/src/Drizzle/Schema.ts
index 07adafc9f..601b06b24 100644
--- a/src/Drizzle/Schema.ts
+++ b/src/Drizzle/Schema.ts
@@ -181,13 +181,17 @@ export const SchemaProvider = () =>
const dialect = props.dialect ?? "postgres";
const kit = yield* loadKit(dialect);
const schemaModule = yield* loadSchemaModule(props);
+ const prevEntry = yield* readLatestSnapshot(out);
const cur = yield* Effect.tryPromise({
- try: () => kit.generateDrizzleJson(schemaModule),
+ try: () =>
+ kit.generateDrizzleJson(
+ schemaModule,
+ (prevEntry?.snapshot as { id?: string } | undefined)?.id,
+ ),
catch: (cause) =>
new Error(`drizzle-kit generateDrizzleJson failed: ${cause}`),
});
- const prevEntry = yield* readLatestSnapshot(out);
// For the initial migration, drizzle-kit needs an *empty* snapshot
// produced by `generateDrizzleJson({})`, not a bare `{}` — the
// snapshot has internal fields (`ddl`, etc.) that the differ reads.
diff --git a/src/Output.ts b/src/Output.ts
index 967d27d8f..46e4622e3 100644
--- a/src/Output.ts
+++ b/src/Output.ts
@@ -72,6 +72,8 @@ export type ToOutput<A, Req = never> = [Extract<A, object>] extends [never]
export const ExprSymbol = Symbol.for("alchemy/Expr");
+const exprKind = (node: any): unknown => node?.[ExprSymbol]?.kind ?? node?.kind;
+
export const isExpr = (value: any): value is Expr<any> =>
value &&
(typeof value === "object" || typeof value === "function") &&
@@ -145,7 +147,7 @@ export type ArrayExpr<A extends any[], Req = any> = Output<A, Req> & {
export const isResourceExpr = <Value = any, Req = any>(
node: Expr<Value, Req> | any,
-): node is ResourceExpr<Value, Req> => node?.kind === "ResourceExpr";
+): node is ResourceExpr<Value, Req> => exprKind(node) === "ResourceExpr";
export class ResourceExpr<Value, Req = never> extends BaseExpr<Value, Req> {
readonly kind = "ResourceExpr";
@@ -163,7 +165,7 @@ export class ResourceExpr<Value, Req = never> extends BaseExpr<Value, Req> {
export const isPropExpr = <A = any, Prop extends keyof A = keyof A, Req = any>(
node: any,
-): node is PropExpr<A, Prop, Req> => node?.kind === "PropExpr";
+): node is PropExpr<A, Prop, Req> => exprKind(node) === "PropExpr";
export class PropExpr<
A = any,
@@ -186,7 +188,7 @@ export class PropExpr<
export const literal = <A>(value: A) => new LiteralExpr(value);
export const isLiteralExpr = <A = any>(node: any): node is LiteralExpr<A> =>
- node?.kind === "LiteralExpr";
+ exprKind(node) === "LiteralExpr";
export class LiteralExpr<A> extends BaseExpr<A, never> {
readonly kind = "LiteralExpr";
@@ -217,7 +219,7 @@ export const map: {
//Output.ApplyExpr<any, any, ResourceLike, any>
export const isApplyExpr = <In = any, Out = any, Req = any>(
node: Output<Out, Req>,
-): node is ApplyExpr<In, Out, Req> => node?.kind === "ApplyExpr";
+): node is ApplyExpr<In, Out, Req> => exprKind(node) === "ApplyExpr";
export class ApplyExpr<A, B, Req = never> extends BaseExpr<B, Req> {
readonly kind = "ApplyExpr";
@@ -259,7 +261,7 @@ export const flatMap: {
export const isFlatMapExpr = <In = any, Out = any, Req = any, Req2 = any>(
node: any,
-): node is FlatMapExpr<In, Out, Req, Req2> => node?.kind === "FlatMapExpr";
+): node is FlatMapExpr<In, Out, Req, Req2> => exprKind(node) === "FlatMapExpr";
export class FlatMapExpr<A, B, Req = never, Req2 = never> extends BaseExpr<
B,
@@ -280,7 +282,7 @@ export class FlatMapExpr<A, B, Req = never, Req2 = never> extends BaseExpr<
export const isEffectExpr = <In = any, Out = any, Req = any, Req2 = any>(
node: any,
-): node is EffectExpr<In, Out, Req, Req2> => node?.kind === "EffectExpr";
+): node is EffectExpr<In, Out, Req, Req2> => exprKind(node) === "EffectExpr";
export class EffectExpr<A, B, Req = never, Req2 = never> extends BaseExpr<
B,
@@ -301,7 +303,7 @@ export class EffectExpr<A, B, Req = never, Req2 = never> extends BaseExpr<
export const isNamedExpr = <A = any, Req = any>(
node: any,
-): node is NamedExpr<A, Req> => node?.kind === "NamedExpr";
+): node is NamedExpr<A, Req> => exprKind(node) === "NamedExpr";
/**
* Wraps another `Expr` and overrides its `toString()` / inspect output.
@@ -352,7 +354,7 @@ type Tuple<
export const isAllExpr = <Outs extends Expr[] = Expr[]>(
node: any,
-): node is AllExpr<Outs> => node?.kind === "AllExpr";
+): node is AllExpr<Outs> => exprKind(node) === "AllExpr";
export class AllExpr<Outs extends Expr[]> extends BaseExpr<Outs> {
readonly kind = "AllExpr";
@@ -366,7 +368,7 @@ export class AllExpr<Outs extends Expr[]> extends BaseExpr<Outs> {
}
export const isRefExpr = <A = any>(node: any): node is RefExpr<A> =>
- node?.kind === "RefExpr";
+ exprKind(node) === "RefExpr";
export class RefExpr<A> extends BaseExpr<A, never> {
readonly kind = "RefExpr";
@@ -384,7 +386,7 @@ export class RefExpr<A> extends BaseExpr<A, never> {
}
export const isStackRefExpr = <A = any>(node: any): node is StackRefExpr<A> =>
- node?.kind === "StackRefExpr";
+ exprKind(node) === "StackRefExpr";
/**
* A reference to the persisted output of a Stack at `(stack, stage)`.
@@ -59,7 +59,7 @@ index b0f61df..ead663e 100644
\ No newline at end of file
+//# sourceMappingURL=RpcClient.d.ts.map
diff --git a/dist/unstable/rpc/RpcClient.js b/dist/unstable/rpc/RpcClient.js
index 811a8a8..f9cf2eb 100644
index a3161eb..0cb81f3 100644
--- a/dist/unstable/rpc/RpcClient.js
+++ b/dist/unstable/rpc/RpcClient.js
@@ -46,6 +46,7 @@ export const makeNoSerialization = /*#__PURE__*/Effect.fnUntraced(function* (gro
@@ -285,7 +285,7 @@ index 811a8a8..f9cf2eb 100644
@@ -835,4 +869,4 @@ export const layerProtocolWorker = /*#__PURE__*/flow(makeProtocolWorker, /*#__PU
export class ConnectionHooks extends /*#__PURE__*/Context.Service()("effect/rpc/RpcClient/ConnectionHooks") {}
// internal
const decodeDefect = /*#__PURE__*/Schema.decodeSync(Schema.Defect);
const decodeDefect = /*#__PURE__*/Schema.decodeSync(/*#__PURE__*/Schema.Defect());
-//# sourceMappingURL=RpcClient.js.map
\ No newline at end of file
+//# sourceMappingURL=RpcClient.js.map
+555 -559
View File
File diff suppressed because it is too large. Load diff
+10 -11
View File
@@ -16,15 +16,15 @@ ignoredBuiltDependencies:
- msw
catalog:
effect: 4.0.0-beta.73
"@effect/atom-react": 4.0.0-beta.73
"@effect/openapi-generator": 4.0.0-beta.73
"@effect/platform-bun": 4.0.0-beta.73
"@effect/platform-node": 4.0.0-beta.73
"@effect/platform-node-shared": 4.0.0-beta.73
"@effect/sql-pg": 4.0.0-beta.73
"@effect/sql-sqlite-bun": 4.0.0-beta.73
"@effect/vitest": 4.0.0-beta.73
effect: 4.0.0-beta.78
"@effect/atom-react": 4.0.0-beta.78
"@effect/openapi-generator": 4.0.0-beta.78
"@effect/platform-bun": 4.0.0-beta.78
"@effect/platform-node": 4.0.0-beta.78
"@effect/platform-node-shared": 4.0.0-beta.78
"@effect/sql-pg": 4.0.0-beta.78
"@effect/sql-sqlite-bun": 4.0.0-beta.78
"@effect/vitest": 4.0.0-beta.78
"@effect/tsgo": 0.11.4
"@noble/curves": 1.9.1
"@noble/hashes": 1.8.0
@@ -75,6 +75,5 @@ packageExtensions:
patchedDependencies:
"@expo/[email protected]": patches/@expo%[email protected]
"@pierre/[email protected]": patches/@pierre%[email protected]
alchemy@2.0.0-beta.49: patches/alchemy@2.0.0-beta.49.patch
[email protected]: patches/[email protected]
effect@4.0.0-beta.78: patches/effect@4.0.0-beta.78.patch
[email protected]: patches/[email protected]
+7
View File
@@ -4,6 +4,13 @@ import { defineConfig } from "vite-plus";
export default defineConfig({
test: {
environment: "node",
exclude: [
"**/.repos/**",
"**/node_modules/**",
"**/dist/**",
"**/dist-electron/**",
"**/.{idea,git,cache,output,temp}/**",
],
hookTimeout: 60_000,
testTimeout: 60_000,
},