Migrate TypeScript checks to Effect TSGo (#2851)
This commit is contained in:
1 parent
83f0cc9e31
commit
6b3050ee74
102 files changed
+824
-828
No files matched your search
@@ -10,7 +10,7 @@
|
||||
"dev:electron": "node scripts/dev-electron.mjs",
|
||||
"build": "tsdown",
|
||||
"start": "node scripts/start-electron.mjs",
|
||||
"typecheck": "tsc --noEmit",
|
||||
"typecheck": "tsgo --noEmit",
|
||||
"test": "vitest run --passWithNoTests",
|
||||
"smoke-test": "node scripts/smoke-test.mjs"
|
||||
},
|
||||
@@ -25,11 +25,9 @@
|
||||
"electron-updater": "^6.6.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@effect/language-service": "catalog:",
|
||||
"@effect/vitest": "catalog:",
|
||||
"@types/node": "catalog:",
|
||||
"tsdown": "catalog:",
|
||||
"typescript": "catalog:",
|
||||
"vitest": "catalog:"
|
||||
},
|
||||
"productName": "T3 Code (Alpha)"
|
||||
|
||||
@@ -26,7 +26,7 @@ export interface DesktopAppIdentityShape {
|
||||
export class DesktopAppIdentity extends Context.Service<
|
||||
DesktopAppIdentity,
|
||||
DesktopAppIdentityShape
|
||||
>()("t3/desktop/AppIdentity") {}
|
||||
>()("@t3tools/desktop/app/DesktopAppIdentity") {}
|
||||
|
||||
const normalizeCommitHash = (value: string): Option.Option<string> => {
|
||||
const trimmed = value.trim();
|
||||
|
||||
@@ -18,7 +18,7 @@ export interface DesktopAssetsShape {
|
||||
}
|
||||
|
||||
export class DesktopAssets extends Context.Service<DesktopAssets, DesktopAssetsShape>()(
|
||||
"t3/desktop/Assets",
|
||||
"@t3tools/desktop/app/DesktopAssets",
|
||||
) {}
|
||||
|
||||
const resolveResourcePath = Effect.fn("desktop.assets.resolveResourcePath")(function* (
|
||||
|
||||
@@ -32,9 +32,7 @@ const makeEnvironment = (
|
||||
overrides: Partial<DesktopEnvironment.MakeDesktopEnvironmentInput> = {},
|
||||
env: Record<string, string | undefined> = {},
|
||||
) =>
|
||||
Effect.gen(function* () {
|
||||
return yield* DesktopEnvironment.DesktopEnvironment;
|
||||
}).pipe(Effect.provide(makeEnvironmentLayer(overrides, env)));
|
||||
DesktopEnvironment.DesktopEnvironment.pipe(Effect.provide(makeEnvironmentLayer(overrides, env)));
|
||||
|
||||
describe("DesktopEnvironment", () => {
|
||||
it.effect("derives state paths and development identity inside Effect", () =>
|
||||
|
||||
@@ -78,7 +78,7 @@ export interface DesktopEnvironmentShape {
|
||||
export class DesktopEnvironment extends Context.Service<
|
||||
DesktopEnvironment,
|
||||
DesktopEnvironmentShape
|
||||
>()("t3/desktop/Environment") {}
|
||||
>()("@t3tools/desktop/app/DesktopEnvironment") {}
|
||||
|
||||
const APP_BASE_NAME = "T3 Code";
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ export interface DesktopShutdownShape {
|
||||
}
|
||||
|
||||
export class DesktopShutdown extends Context.Service<DesktopShutdown, DesktopShutdownShape>()(
|
||||
"t3/desktop/Shutdown",
|
||||
"@t3tools/desktop/app/DesktopLifecycle/DesktopShutdown",
|
||||
) {}
|
||||
|
||||
const makeShutdown = Effect.gen(function* () {
|
||||
@@ -61,8 +61,11 @@ export interface DesktopLifecycleShape {
|
||||
readonly register: Effect.Effect<void, never, Scope.Scope | DesktopLifecycleRuntimeServices>;
|
||||
}
|
||||
|
||||
/**
|
||||
* @effect-expect-leaking DesktopEnvironment | DesktopShutdown | DesktopState | DesktopWindow | ElectronApp | ElectronTheme
|
||||
*/
|
||||
export class DesktopLifecycle extends Context.Service<DesktopLifecycle, DesktopLifecycleShape>()(
|
||||
"t3/desktop/Lifecycle",
|
||||
"@t3tools/desktop/app/DesktopLifecycle",
|
||||
) {}
|
||||
|
||||
const { logInfo: logLifecycleInfo, logError: logLifecycleError } =
|
||||
|
||||
@@ -43,7 +43,7 @@ export interface DesktopBackendOutputLogShape {
|
||||
export class DesktopBackendOutputLog extends Context.Service<
|
||||
DesktopBackendOutputLog,
|
||||
DesktopBackendOutputLogShape
|
||||
>()("t3/desktop/BackendOutputLog") {}
|
||||
>()("@t3tools/desktop/app/DesktopObservability/DesktopBackendOutputLog") {}
|
||||
|
||||
const textEncoder = new TextEncoder();
|
||||
const textDecoder = new TextDecoder();
|
||||
|
||||
@@ -9,7 +9,7 @@ export interface DesktopStateShape {
|
||||
}
|
||||
|
||||
export class DesktopState extends Context.Service<DesktopState, DesktopStateShape>()(
|
||||
"t3/desktop/State",
|
||||
"@t3tools/desktop/app/DesktopState",
|
||||
) {}
|
||||
|
||||
export const layer = Layer.effect(
|
||||
|
||||
@@ -24,7 +24,7 @@ export interface DesktopBackendConfigurationShape {
|
||||
export class DesktopBackendConfiguration extends Context.Service<
|
||||
DesktopBackendConfiguration,
|
||||
DesktopBackendConfigurationShape
|
||||
>()("t3/desktop/BackendConfiguration") {}
|
||||
>()("@t3tools/desktop/backend/DesktopBackendConfiguration") {}
|
||||
|
||||
interface BackendObservabilitySettings {
|
||||
readonly otlpTracesUrl: Option.Option<string>;
|
||||
|
||||
@@ -116,7 +116,7 @@ export interface DesktopBackendManagerShape {
|
||||
export class DesktopBackendManager extends Context.Service<
|
||||
DesktopBackendManager,
|
||||
DesktopBackendManagerShape
|
||||
>()("t3/desktop/BackendManager") {}
|
||||
>()("@t3tools/desktop/backend/DesktopBackendManager") {}
|
||||
|
||||
const { logWarning: logBackendManagerWarning, logError: logBackendManagerError } =
|
||||
DesktopObservability.makeComponentLogger("desktop-backend-manager");
|
||||
|
||||
@@ -275,7 +275,7 @@ export interface DesktopServerExposureShape {
|
||||
export class DesktopServerExposure extends Context.Service<
|
||||
DesktopServerExposure,
|
||||
DesktopServerExposureShape
|
||||
>()("t3/desktop/ServerExposure") {}
|
||||
>()("@t3tools/desktop/backend/DesktopServerExposure") {}
|
||||
|
||||
export interface DesktopNetworkInterfacesServiceShape {
|
||||
readonly read: Effect.Effect<DesktopNetworkInterfaces>;
|
||||
@@ -284,7 +284,7 @@ export interface DesktopNetworkInterfacesServiceShape {
|
||||
export class DesktopNetworkInterfacesService extends Context.Service<
|
||||
DesktopNetworkInterfacesService,
|
||||
DesktopNetworkInterfacesServiceShape
|
||||
>()("t3/desktop/ServerExposure/NetworkInterfaces") {}
|
||||
>()("@t3tools/desktop/backend/DesktopServerExposure/DesktopNetworkInterfacesService") {}
|
||||
|
||||
interface RuntimeState {
|
||||
readonly requestedMode: DesktopServerExposureMode;
|
||||
|
||||
@@ -39,7 +39,7 @@ export interface ElectronAppShape {
|
||||
}
|
||||
|
||||
export class ElectronApp extends Context.Service<ElectronApp, ElectronAppShape>()(
|
||||
"t3/desktop/electron/App",
|
||||
"@t3tools/desktop/electron/ElectronApp",
|
||||
) {}
|
||||
|
||||
const addScopedAppListener = <Args extends ReadonlyArray<unknown>>(
|
||||
|
||||
@@ -29,7 +29,7 @@ export interface ElectronDialogShape {
|
||||
}
|
||||
|
||||
export class ElectronDialog extends Context.Service<ElectronDialog, ElectronDialogShape>()(
|
||||
"t3/desktop/electron/Dialog",
|
||||
"@t3tools/desktop/electron/ElectronDialog",
|
||||
) {}
|
||||
|
||||
const make = ElectronDialog.of({
|
||||
|
||||
@@ -33,7 +33,7 @@ export interface ElectronMenuShape {
|
||||
}
|
||||
|
||||
export class ElectronMenu extends Context.Service<ElectronMenu, ElectronMenuShape>()(
|
||||
"t3/desktop/electron/Menu",
|
||||
"@t3tools/desktop/electron/ElectronMenu",
|
||||
) {}
|
||||
|
||||
function normalizeContextMenuItems(source: readonly ContextMenuItem[]): ContextMenuItem[] {
|
||||
|
||||
@@ -52,7 +52,7 @@ export interface ElectronProtocolShape {
|
||||
}
|
||||
|
||||
export class ElectronProtocol extends Context.Service<ElectronProtocol, ElectronProtocolShape>()(
|
||||
"t3/desktop/electron/Protocol",
|
||||
"@t3tools/desktop/electron/ElectronProtocol",
|
||||
) {}
|
||||
|
||||
export function normalizeDesktopProtocolPathname(rawPath: string): Option.Option<string> {
|
||||
|
||||
@@ -48,7 +48,7 @@ export interface ElectronSafeStorageShape {
|
||||
export class ElectronSafeStorage extends Context.Service<
|
||||
ElectronSafeStorage,
|
||||
ElectronSafeStorageShape
|
||||
>()("@t3tools/desktop/ElectronSafeStorage") {}
|
||||
>()("@t3tools/desktop/electron/ElectronSafeStorage") {}
|
||||
|
||||
const make = ElectronSafeStorage.of({
|
||||
isEncryptionAvailable: Effect.try({
|
||||
|
||||
@@ -26,7 +26,7 @@ export interface ElectronShellShape {
|
||||
}
|
||||
|
||||
export class ElectronShell extends Context.Service<ElectronShell, ElectronShellShape>()(
|
||||
"t3/desktop/electron/Shell",
|
||||
"@t3tools/desktop/electron/ElectronShell",
|
||||
) {}
|
||||
|
||||
const make = ElectronShell.of({
|
||||
|
||||
@@ -13,7 +13,7 @@ export interface ElectronThemeShape {
|
||||
}
|
||||
|
||||
export class ElectronTheme extends Context.Service<ElectronTheme, ElectronThemeShape>()(
|
||||
"t3/desktop/electron/Theme",
|
||||
"@t3tools/desktop/electron/ElectronTheme",
|
||||
) {}
|
||||
|
||||
const make = ElectronTheme.of({
|
||||
|
||||
@@ -67,7 +67,7 @@ export interface ElectronUpdaterShape {
|
||||
}
|
||||
|
||||
export class ElectronUpdater extends Context.Service<ElectronUpdater, ElectronUpdaterShape>()(
|
||||
"t3/desktop/electron/Updater",
|
||||
"@t3tools/desktop/electron/ElectronUpdater",
|
||||
) {}
|
||||
|
||||
export const layer = Layer.succeed(ElectronUpdater, {
|
||||
|
||||
@@ -33,7 +33,7 @@ export interface ElectronWindowShape {
|
||||
}
|
||||
|
||||
export class ElectronWindow extends Context.Service<ElectronWindow, ElectronWindowShape>()(
|
||||
"t3/desktop/electron/Window",
|
||||
"@t3tools/desktop/electron/ElectronWindow",
|
||||
) {}
|
||||
|
||||
const make = Effect.gen(function* () {
|
||||
|
||||
@@ -42,7 +42,9 @@ export interface DesktopIpcShape {
|
||||
) => Effect.Effect<void, never, R | Scope.Scope>;
|
||||
}
|
||||
|
||||
export class DesktopIpc extends Context.Service<DesktopIpc, DesktopIpcShape>()("t3/desktop/Ipc") {}
|
||||
export class DesktopIpc extends Context.Service<DesktopIpc, DesktopIpcShape>()(
|
||||
"@t3tools/desktop/ipc/DesktopIpc",
|
||||
) {}
|
||||
|
||||
export const make = (ipcMain: DesktopIpcMain): DesktopIpcShape =>
|
||||
DesktopIpc.of({
|
||||
|
||||
@@ -89,7 +89,7 @@ export interface DesktopAppSettingsShape {
|
||||
export class DesktopAppSettings extends Context.Service<
|
||||
DesktopAppSettings,
|
||||
DesktopAppSettingsShape
|
||||
>()("t3/desktop/AppSettings") {}
|
||||
>()("@t3tools/desktop/settings/DesktopAppSettings") {}
|
||||
|
||||
export function resolveDefaultDesktopSettings(appVersion: string): DesktopSettings {
|
||||
return {
|
||||
|
||||
@@ -49,7 +49,7 @@ export interface DesktopClientSettingsShape {
|
||||
export class DesktopClientSettings extends Context.Service<
|
||||
DesktopClientSettings,
|
||||
DesktopClientSettingsShape
|
||||
>()("t3/desktop/ClientSettings") {}
|
||||
>()("@t3tools/desktop/settings/DesktopClientSettings") {}
|
||||
|
||||
const readClientSettings = (
|
||||
fileSystem: FileSystem.FileSystem,
|
||||
|
||||
@@ -121,7 +121,7 @@ export interface DesktopSavedEnvironmentsShape {
|
||||
export class DesktopSavedEnvironments extends Context.Service<
|
||||
DesktopSavedEnvironments,
|
||||
DesktopSavedEnvironmentsShape
|
||||
>()("t3/desktop/SavedEnvironments") {}
|
||||
>()("@t3tools/desktop/settings/DesktopSavedEnvironments") {}
|
||||
|
||||
function toPersistedSavedEnvironmentRecord(
|
||||
record: PersistedSavedEnvironmentStorageRecord,
|
||||
|
||||
@@ -26,7 +26,7 @@ export interface DesktopShellEnvironmentShape {
|
||||
export class DesktopShellEnvironment extends Context.Service<
|
||||
DesktopShellEnvironment,
|
||||
DesktopShellEnvironmentShape
|
||||
>()("t3/desktop/ShellEnvironment") {}
|
||||
>()("@t3tools/desktop/shell/DesktopShellEnvironment") {}
|
||||
|
||||
const LOGIN_SHELL_ENV_NAMES = [
|
||||
"PATH",
|
||||
|
||||
@@ -68,7 +68,7 @@ export interface DesktopSshEnvironmentShape {
|
||||
export class DesktopSshEnvironment extends Context.Service<
|
||||
DesktopSshEnvironment,
|
||||
DesktopSshEnvironmentShape
|
||||
>()("t3/desktop/SshEnvironment") {}
|
||||
>()("@t3tools/desktop/ssh/DesktopSshEnvironment") {}
|
||||
|
||||
export interface DesktopSshEnvironmentLayerOptions {
|
||||
readonly resolveCliPackageSpec?: () => string;
|
||||
|
||||
@@ -129,7 +129,7 @@ export interface DesktopSshPasswordPromptsShape {
|
||||
export class DesktopSshPasswordPrompts extends Context.Service<
|
||||
DesktopSshPasswordPrompts,
|
||||
DesktopSshPasswordPromptsShape
|
||||
>()("t3/desktop/SshPasswordPrompts") {}
|
||||
>()("@t3tools/desktop/ssh/DesktopSshPasswordPrompts") {}
|
||||
|
||||
interface PendingSshPasswordPrompt {
|
||||
readonly requestId: string;
|
||||
|
||||
@@ -53,7 +53,7 @@ export interface DesktopSshRemoteApiShape {
|
||||
export class DesktopSshRemoteApi extends Context.Service<
|
||||
DesktopSshRemoteApi,
|
||||
DesktopSshRemoteApiShape
|
||||
>()("t3/desktop/SshRemoteApi") {}
|
||||
>()("@t3tools/desktop/ssh/DesktopSshRemoteApi") {}
|
||||
|
||||
const decodeExecutionEnvironmentDescriptor = Schema.decodeUnknownEffect(
|
||||
ExecutionEnvironmentDescriptor,
|
||||
|
||||
@@ -100,7 +100,7 @@ export interface DesktopUpdatesShape {
|
||||
}
|
||||
|
||||
export class DesktopUpdates extends Context.Service<DesktopUpdates, DesktopUpdatesShape>()(
|
||||
"t3/desktop/Updates",
|
||||
"@t3tools/desktop/updates/DesktopUpdates",
|
||||
) {}
|
||||
|
||||
const {
|
||||
|
||||
@@ -21,7 +21,7 @@ export interface DesktopApplicationMenuShape {
|
||||
export class DesktopApplicationMenu extends Context.Service<
|
||||
DesktopApplicationMenu,
|
||||
DesktopApplicationMenuShape
|
||||
>()("t3/desktop/ApplicationMenu") {}
|
||||
>()("@t3tools/desktop/window/DesktopApplicationMenu") {}
|
||||
|
||||
type DesktopApplicationMenuRuntimeServices =
|
||||
| DesktopUpdates.DesktopUpdates
|
||||
|
||||
@@ -62,7 +62,7 @@ export interface DesktopWindowShape {
|
||||
}
|
||||
|
||||
export class DesktopWindow extends Context.Service<DesktopWindow, DesktopWindowShape>()(
|
||||
"t3/desktop/Window",
|
||||
"@t3tools/desktop/window/DesktopWindow",
|
||||
) {}
|
||||
|
||||
const { logInfo: logWindowInfo, logWarning: logWindowWarning } =
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
"build": "node scripts/cli.ts build",
|
||||
"build:bundle": "tsdown",
|
||||
"start": "node dist/bin.mjs",
|
||||
"typecheck": "tsc --noEmit",
|
||||
"typecheck": "tsgo --noEmit",
|
||||
"test": "vitest run"
|
||||
},
|
||||
"dependencies": {
|
||||
@@ -34,7 +34,6 @@
|
||||
"node-pty": "^1.1.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@effect/language-service": "catalog:",
|
||||
"@effect/vitest": "catalog:",
|
||||
"@t3tools/contracts": "workspace:*",
|
||||
"@t3tools/shared": "workspace:*",
|
||||
@@ -45,7 +44,6 @@
|
||||
"effect-acp": "workspace:*",
|
||||
"effect-codex-app-server": "workspace:*",
|
||||
"tsdown": "catalog:",
|
||||
"typescript": "catalog:",
|
||||
"vitest": "catalog:"
|
||||
},
|
||||
"engines": {
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import type { AuthPairingLink } from "@t3tools/contracts";
|
||||
import * as Crypto from "effect/Crypto";
|
||||
import * as DateTime from "effect/DateTime";
|
||||
import * as Duration from "effect/Duration";
|
||||
import * as Effect from "effect/Effect";
|
||||
@@ -46,6 +47,7 @@ const generatePairingToken = (): string => {
|
||||
};
|
||||
|
||||
export const makeBootstrapCredentialService = Effect.gen(function* () {
|
||||
const crypto = yield* Crypto.Crypto;
|
||||
const config = yield* ServerConfig;
|
||||
const pairingLinks = yield* AuthPairingLinkRepository;
|
||||
const seededGrantsRef = yield* Ref.make(new Map<string, StoredBootstrapGrant>());
|
||||
@@ -141,7 +143,7 @@ export const makeBootstrapCredentialService = Effect.gen(function* () {
|
||||
|
||||
const issueOneTimeToken: BootstrapCredentialServiceShape["issueOneTimeToken"] = (input) =>
|
||||
Effect.gen(function* () {
|
||||
const id = crypto.randomUUID();
|
||||
const id = yield* crypto.randomUUIDv4;
|
||||
const credential = generatePairingToken();
|
||||
const ttl = input?.ttl ?? DEFAULT_ONE_TIME_TOKEN_TTL_MINUTES;
|
||||
const now = yield* DateTime.now;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { AuthSessionId, type AuthClientMetadata, type AuthClientSession } from "@t3tools/contracts";
|
||||
import * as Clock from "effect/Clock";
|
||||
import * as Crypto from "effect/Crypto";
|
||||
import * as DateTime from "effect/DateTime";
|
||||
import * as Duration from "effect/Duration";
|
||||
import * as Effect from "effect/Effect";
|
||||
@@ -90,6 +91,7 @@ function toAuthClientSession(input: Omit<AuthClientSession, "current">): AuthCli
|
||||
}
|
||||
|
||||
export const makeSessionCredentialService = Effect.gen(function* () {
|
||||
const crypto = yield* Crypto.Crypto;
|
||||
const serverConfig = yield* ServerConfig;
|
||||
const secretStore = yield* ServerSecretStore;
|
||||
const authSessions = yield* AuthSessionRepository;
|
||||
@@ -203,7 +205,7 @@ export const makeSessionCredentialService = Effect.gen(function* () {
|
||||
const encodeClaims = Schema.encodeEffect(Schema.fromJsonString(SessionClaims));
|
||||
const issue: SessionCredentialServiceShape["issue"] = (input) =>
|
||||
Effect.gen(function* () {
|
||||
const sessionId = AuthSessionId.make(crypto.randomUUID());
|
||||
const sessionId = AuthSessionId.make(yield* crypto.randomUUIDv4);
|
||||
const issuedAt = yield* DateTime.now;
|
||||
const expiresAt = DateTime.add(issuedAt, {
|
||||
milliseconds: Duration.toMillis(input?.ttl ?? DEFAULT_SESSION_TTL),
|
||||
|
||||
@@ -69,5 +69,5 @@ export interface AuthControlPlaneShape {
|
||||
}
|
||||
|
||||
export class AuthControlPlane extends Context.Service<AuthControlPlane, AuthControlPlaneShape>()(
|
||||
"t3/AuthControlPlane",
|
||||
"t3/auth/Services/AuthControlPlane",
|
||||
) {}
|
||||
@@ -1,4 +1,4 @@
|
||||
// @effect-diagnostics-next-line nodeBuiltinImport:off - NodeHttpServer.layer takes `NodeHttp.createServer` as arg
|
||||
// @effect-diagnostics nodeBuiltinImport:off - CLI integration exercises Node HTTP and filesystem boundaries.
|
||||
import * as NodeHttp from "node:http";
|
||||
import { mkdtempSync } from "node:fs";
|
||||
import { tmpdir } from "node:os";
|
||||
|
||||
@@ -9,10 +9,12 @@ import {
|
||||
type ProviderRuntimeEvent,
|
||||
} from "@t3tools/contracts";
|
||||
import * as Cause from "effect/Cause";
|
||||
import * as Crypto from "effect/Crypto";
|
||||
import * as DateTime from "effect/DateTime";
|
||||
import * as Effect from "effect/Effect";
|
||||
import * as Layer from "effect/Layer";
|
||||
import * as Option from "effect/Option";
|
||||
import type * as PlatformError from "effect/PlatformError";
|
||||
import * as Stream from "effect/Stream";
|
||||
import { makeDrainableWorker } from "@t3tools/shared/DrainableWorker";
|
||||
|
||||
@@ -69,10 +71,12 @@ function checkpointStatusFromRuntime(status: string | undefined): "ready" | "mis
|
||||
}
|
||||
}
|
||||
|
||||
const serverCommandId = (tag: string): CommandId =>
|
||||
CommandId.make(`server:${tag}:${crypto.randomUUID()}`);
|
||||
|
||||
const make = Effect.gen(function* () {
|
||||
const crypto = yield* Crypto.Crypto;
|
||||
const randomUUID = crypto.randomUUIDv4;
|
||||
const serverEventId = randomUUID.pipe(Effect.map(EventId.make));
|
||||
const serverCommandId = (tag: string) =>
|
||||
randomUUID.pipe(Effect.map((uuid) => CommandId.make(`server:${tag}:${uuid}`)));
|
||||
const orchestrationEngine = yield* OrchestrationEngineService;
|
||||
const projectionSnapshotQuery = yield* ProjectionSnapshotQuery;
|
||||
const providerService = yield* ProviderService;
|
||||
@@ -87,24 +91,31 @@ const make = Effect.gen(function* () {
|
||||
readonly detail: string;
|
||||
readonly createdAt: string;
|
||||
}) =>
|
||||
orchestrationEngine.dispatch({
|
||||
type: "thread.activity.append",
|
||||
Effect.all({
|
||||
commandId: serverCommandId("checkpoint-revert-failure"),
|
||||
threadId: input.threadId,
|
||||
activity: {
|
||||
id: EventId.make(crypto.randomUUID()),
|
||||
tone: "error",
|
||||
kind: "checkpoint.revert.failed",
|
||||
summary: "Checkpoint revert failed",
|
||||
payload: {
|
||||
turnCount: input.turnCount,
|
||||
detail: input.detail,
|
||||
},
|
||||
turnId: null,
|
||||
createdAt: input.createdAt,
|
||||
},
|
||||
createdAt: input.createdAt,
|
||||
});
|
||||
activityId: serverEventId,
|
||||
}).pipe(
|
||||
Effect.flatMap(({ commandId, activityId }) =>
|
||||
orchestrationEngine.dispatch({
|
||||
type: "thread.activity.append",
|
||||
commandId,
|
||||
threadId: input.threadId,
|
||||
activity: {
|
||||
id: activityId,
|
||||
tone: "error",
|
||||
kind: "checkpoint.revert.failed",
|
||||
summary: "Checkpoint revert failed",
|
||||
payload: {
|
||||
turnCount: input.turnCount,
|
||||
detail: input.detail,
|
||||
},
|
||||
turnId: null,
|
||||
createdAt: input.createdAt,
|
||||
},
|
||||
createdAt: input.createdAt,
|
||||
}),
|
||||
),
|
||||
);
|
||||
|
||||
const appendCaptureFailureActivity = (input: {
|
||||
readonly threadId: ThreadId;
|
||||
@@ -112,23 +123,30 @@ const make = Effect.gen(function* () {
|
||||
readonly detail: string;
|
||||
readonly createdAt: string;
|
||||
}) =>
|
||||
orchestrationEngine.dispatch({
|
||||
type: "thread.activity.append",
|
||||
Effect.all({
|
||||
commandId: serverCommandId("checkpoint-capture-failure"),
|
||||
threadId: input.threadId,
|
||||
activity: {
|
||||
id: EventId.make(crypto.randomUUID()),
|
||||
tone: "error",
|
||||
kind: "checkpoint.capture.failed",
|
||||
summary: "Checkpoint capture failed",
|
||||
payload: {
|
||||
detail: input.detail,
|
||||
},
|
||||
turnId: input.turnId,
|
||||
createdAt: input.createdAt,
|
||||
},
|
||||
createdAt: input.createdAt,
|
||||
});
|
||||
activityId: serverEventId,
|
||||
}).pipe(
|
||||
Effect.flatMap(({ commandId, activityId }) =>
|
||||
orchestrationEngine.dispatch({
|
||||
type: "thread.activity.append",
|
||||
commandId,
|
||||
threadId: input.threadId,
|
||||
activity: {
|
||||
id: activityId,
|
||||
tone: "error",
|
||||
kind: "checkpoint.capture.failed",
|
||||
summary: "Checkpoint capture failed",
|
||||
payload: {
|
||||
detail: input.detail,
|
||||
},
|
||||
turnId: input.turnId,
|
||||
createdAt: input.createdAt,
|
||||
},
|
||||
createdAt: input.createdAt,
|
||||
}),
|
||||
),
|
||||
);
|
||||
|
||||
const resolveSessionRuntimeForThread = Effect.fn("resolveSessionRuntimeForThread")(function* (
|
||||
threadId: ThreadId,
|
||||
@@ -281,7 +299,7 @@ const make = Effect.gen(function* () {
|
||||
|
||||
yield* orchestrationEngine.dispatch({
|
||||
type: "thread.turn.diff.complete",
|
||||
commandId: serverCommandId("checkpoint-turn-diff-complete"),
|
||||
commandId: yield* serverCommandId("checkpoint-turn-diff-complete"),
|
||||
threadId: input.threadId,
|
||||
turnId: input.turnId,
|
||||
completedAt: input.createdAt,
|
||||
@@ -311,10 +329,10 @@ const make = Effect.gen(function* () {
|
||||
|
||||
yield* orchestrationEngine.dispatch({
|
||||
type: "thread.activity.append",
|
||||
commandId: serverCommandId("checkpoint-captured-activity"),
|
||||
commandId: yield* serverCommandId("checkpoint-captured-activity"),
|
||||
threadId: input.threadId,
|
||||
activity: {
|
||||
id: EventId.make(crypto.randomUUID()),
|
||||
id: EventId.make(yield* randomUUID),
|
||||
tone: "info",
|
||||
kind: "checkpoint.captured",
|
||||
summary: "Checkpoint captured",
|
||||
@@ -697,7 +715,7 @@ const make = Effect.gen(function* () {
|
||||
yield* orchestrationEngine
|
||||
.dispatch({
|
||||
type: "thread.revert.complete",
|
||||
commandId: serverCommandId("checkpoint-revert-complete"),
|
||||
commandId: yield* serverCommandId("checkpoint-revert-complete"),
|
||||
threadId: event.payload.threadId,
|
||||
turnCount: event.payload.turnCount,
|
||||
createdAt: now,
|
||||
@@ -787,7 +805,11 @@ const make = Effect.gen(function* () {
|
||||
|
||||
const processInput = (
|
||||
input: ReactorInput,
|
||||
): Effect.Effect<void, CheckpointStoreError | OrchestrationDispatchError, never> =>
|
||||
): Effect.Effect<
|
||||
void,
|
||||
CheckpointStoreError | OrchestrationDispatchError | PlatformError.PlatformError,
|
||||
never
|
||||
> =>
|
||||
input.source === "domain" ? processDomainEvent(input.event) : processRuntimeEvent(input.event);
|
||||
|
||||
const processInputSafely = (input: ReactorInput) =>
|
||||
|
||||
@@ -58,8 +58,10 @@ export const orchestrationSnapshotRouteLayer = HttpRouter.add(
|
||||
status: 200,
|
||||
});
|
||||
}).pipe(
|
||||
Effect.catchTag("OrchestrationDispatchCommandError", respondToOrchestrationHttpError),
|
||||
Effect.catchTag("OrchestrationGetSnapshotError", respondToOrchestrationHttpError),
|
||||
Effect.catchTags({
|
||||
OrchestrationDispatchCommandError: respondToOrchestrationHttpError,
|
||||
OrchestrationGetSnapshotError: respondToOrchestrationHttpError,
|
||||
}),
|
||||
),
|
||||
);
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ const AuthSessionDbRow = Schema.Struct({
|
||||
revokedAt: Schema.NullOr(Schema.DateTimeUtcFromString),
|
||||
});
|
||||
|
||||
function toAuthSessionRecord(row: typeof AuthSessionDbRow.Type): typeof AuthSessionRecord.Type {
|
||||
function toAuthSessionRecord(row: typeof AuthSessionDbRow.Type): AuthSessionRecord {
|
||||
return {
|
||||
sessionId: row.sessionId,
|
||||
subject: row.subject,
|
||||
|
||||
@@ -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);
|
||||
@@ -257,7 +257,7 @@ export interface ExternalLauncherShape {
|
||||
* ExternalLauncher - Service tag for browser/editor launch operations.
|
||||
*/
|
||||
export class ExternalLauncher extends Context.Service<ExternalLauncher, ExternalLauncherShape>()(
|
||||
"t3/process/ExternalLauncher",
|
||||
"t3/process/externalLauncher",
|
||||
) {}
|
||||
|
||||
// ==============================
|
||||
|
||||
@@ -90,7 +90,7 @@ export interface ProcessRunnerShape {
|
||||
}
|
||||
|
||||
export class ProcessRunner extends Context.Service<ProcessRunner, ProcessRunnerShape>()(
|
||||
"t3/process/ProcessRunner",
|
||||
"t3/processRunner",
|
||||
) {}
|
||||
|
||||
const DEFAULT_TIMEOUT = "60 seconds";
|
||||
|
||||
@@ -41,4 +41,4 @@ export interface ProjectSetupScriptRunnerShape {
|
||||
export class ProjectSetupScriptRunner extends Context.Service<
|
||||
ProjectSetupScriptRunner,
|
||||
ProjectSetupScriptRunnerShape
|
||||
>()("t3/project/ProjectSetupScriptRunner") {}
|
||||
>()("t3/project/Services/ProjectSetupScriptRunner") {}
|
||||
@@ -42,7 +42,7 @@ const decodeClaudeSettings = Schema.decodeSync(ClaudeSettings);
|
||||
|
||||
// Test-local service tag so the rest of the file can keep using `yield* ClaudeAdapter`.
|
||||
class ClaudeAdapter extends Context.Service<ClaudeAdapter, ClaudeAdapterShape>()(
|
||||
"test/ClaudeAdapter",
|
||||
"t3/provider/Layers/ClaudeAdapter.test/ClaudeAdapter",
|
||||
) {}
|
||||
|
||||
class FakeClaudeQuery implements AsyncIterable<SDKMessage> {
|
||||
|
||||
@@ -50,7 +50,7 @@ const decodeCodexSettings = Schema.decodeSync(CodexSettings);
|
||||
|
||||
// Test-local service tag so the rest of the file can keep using `yield* CodexAdapter`.
|
||||
class CodexAdapter extends Context.Service<CodexAdapter, CodexAdapterShape>()(
|
||||
"test/CodexAdapter",
|
||||
"t3/provider/Layers/CodexAdapter.test/CodexAdapter",
|
||||
) {}
|
||||
|
||||
const asThreadId = (value: string): ThreadId => ThreadId.make(value);
|
||||
|
||||
@@ -32,7 +32,7 @@ const decodeCursorSettings = Schema.decodeSync(CursorSettings);
|
||||
|
||||
// Test-local service tag so the rest of the file can keep using `yield* CursorAdapter`.
|
||||
class CursorAdapter extends Context.Service<CursorAdapter, CursorAdapterShape>()(
|
||||
"test/CursorAdapter",
|
||||
"t3/provider/Layers/CursorAdapter.test/CursorAdapter",
|
||||
) {}
|
||||
|
||||
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
||||
|
||||
@@ -97,7 +97,7 @@ export interface CursorAdapterLiveOptions {
|
||||
* Selections are honored when `modelSelection.instanceId` matches this value.
|
||||
* Defaults to the legacy built-in instance id (`cursor`).
|
||||
*/
|
||||
readonly instanceId?: typeof ProviderInstanceId.Type;
|
||||
readonly instanceId?: ProviderInstanceId;
|
||||
/**
|
||||
* Optional per-session settings resolver. When provided the adapter yields
|
||||
* this effect at the start of every session and uses the result instead of
|
||||
|
||||
@@ -14,6 +14,7 @@ import { RotatingFileSink } from "@t3tools/shared/logging";
|
||||
import * as Effect from "effect/Effect";
|
||||
import * as Exit from "effect/Exit";
|
||||
import * as Logger from "effect/Logger";
|
||||
import * as Schema from "effect/Schema";
|
||||
import * as Scope from "effect/Scope";
|
||||
import * as SynchronizedRef from "effect/SynchronizedRef";
|
||||
|
||||
@@ -24,6 +25,7 @@ const DEFAULT_MAX_FILES = 10;
|
||||
const DEFAULT_BATCH_WINDOW_MS = 200;
|
||||
const GLOBAL_THREAD_SEGMENT = "_global";
|
||||
const LOG_SCOPE = "provider-observability";
|
||||
const encodeUnknownJsonString = Schema.encodeUnknownEffect(Schema.UnknownFromJsonString);
|
||||
|
||||
export type EventNdjsonStream = "native" | "canonical" | "orchestration";
|
||||
|
||||
@@ -87,26 +89,13 @@ function resolveStreamLabel(stream: EventNdjsonStream): string {
|
||||
const toLogMessage = Effect.fn("toLogMessage")(function* (
|
||||
event: unknown,
|
||||
): Effect.fn.Return<string | undefined> {
|
||||
const serialized = yield* Effect.sync(() => {
|
||||
try {
|
||||
return { ok: true as const, value: JSON.stringify(event) };
|
||||
} catch (error) {
|
||||
return { ok: false as const, error };
|
||||
}
|
||||
});
|
||||
|
||||
if (!serialized.ok) {
|
||||
yield* logWarning("failed to serialize provider event log record", {
|
||||
error: serialized.error,
|
||||
});
|
||||
return undefined;
|
||||
}
|
||||
|
||||
if (typeof serialized.value !== "string") {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
return serialized.value;
|
||||
return yield* encodeUnknownJsonString(event).pipe(
|
||||
Effect.catch((error) =>
|
||||
logWarning("failed to serialize provider event log record", { error }).pipe(
|
||||
Effect.as(undefined),
|
||||
),
|
||||
),
|
||||
);
|
||||
});
|
||||
|
||||
const makeThreadWriter = Effect.fn("makeThreadWriter")(function* (input: {
|
||||
|
||||
@@ -37,7 +37,7 @@ import {
|
||||
|
||||
// Test-local service tag so the rest of the file can keep using `yield* OpenCodeAdapter`.
|
||||
class OpenCodeAdapter extends Context.Service<OpenCodeAdapter, OpenCodeAdapterShape>()(
|
||||
"test/OpenCodeAdapter",
|
||||
"t3/provider/Layers/OpenCodeAdapter.test/OpenCodeAdapter",
|
||||
) {}
|
||||
|
||||
const asThreadId = (value: string): ThreadId => ThreadId.make(value);
|
||||
|
||||
@@ -408,35 +408,25 @@ export const checkOpenCodeProviderStatus = Effect.fn("checkOpenCodeProviderStatu
|
||||
const inventoryExit = yield* Effect.exit(
|
||||
Effect.scoped(
|
||||
Effect.gen(function* () {
|
||||
const server = yield* openCodeRuntime
|
||||
.connectToOpenCodeServer({
|
||||
binaryPath: openCodeSettings.binaryPath,
|
||||
serverUrl: openCodeSettings.serverUrl,
|
||||
environment,
|
||||
})
|
||||
.pipe(
|
||||
Effect.mapError(
|
||||
(cause) =>
|
||||
new OpenCodeProbeError({ cause, detail: openCodeRuntimeErrorDetail(cause) }),
|
||||
),
|
||||
);
|
||||
return yield* openCodeRuntime
|
||||
.loadOpenCodeInventory(
|
||||
openCodeRuntime.createOpenCodeSdkClient({
|
||||
baseUrl: server.url,
|
||||
directory: cwd,
|
||||
...(isExternalServer && openCodeSettings.serverPassword
|
||||
? { serverPassword: openCodeSettings.serverPassword }
|
||||
: {}),
|
||||
}),
|
||||
)
|
||||
.pipe(
|
||||
Effect.mapError(
|
||||
(cause) =>
|
||||
new OpenCodeProbeError({ cause, detail: openCodeRuntimeErrorDetail(cause) }),
|
||||
),
|
||||
);
|
||||
}),
|
||||
const server = yield* openCodeRuntime.connectToOpenCodeServer({
|
||||
binaryPath: openCodeSettings.binaryPath,
|
||||
serverUrl: openCodeSettings.serverUrl,
|
||||
environment,
|
||||
});
|
||||
return yield* openCodeRuntime.loadOpenCodeInventory(
|
||||
openCodeRuntime.createOpenCodeSdkClient({
|
||||
baseUrl: server.url,
|
||||
directory: cwd,
|
||||
...(isExternalServer && openCodeSettings.serverPassword
|
||||
? { serverPassword: openCodeSettings.serverPassword }
|
||||
: {}),
|
||||
}),
|
||||
);
|
||||
}).pipe(
|
||||
Effect.mapError(
|
||||
(cause) => new OpenCodeProbeError({ cause, detail: openCodeRuntimeErrorDetail(cause) }),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
if (inventoryExit._tag === "Failure") {
|
||||
|
||||
@@ -50,7 +50,7 @@ export interface ProviderEventLoggersShape {
|
||||
export class ProviderEventLoggers extends Context.Service<
|
||||
ProviderEventLoggers,
|
||||
ProviderEventLoggersShape
|
||||
>()("t3/provider/ProviderEventLoggers") {}
|
||||
>()("t3/provider/Layers/ProviderEventLoggers") {}
|
||||
|
||||
/**
|
||||
* Constant value used by tests / boot layers that want to opt out of native
|
||||
|
||||
@@ -346,9 +346,7 @@ it.effect("ProviderServiceLive catches stopAll failures during shutdown", () =>
|
||||
const scope = yield* Scope.make();
|
||||
const runtimeServices = yield* Layer.build(providerLayer).pipe(Scope.provide(scope));
|
||||
|
||||
yield* Effect.gen(function* () {
|
||||
yield* ProviderService;
|
||||
}).pipe(Effect.provide(runtimeServices));
|
||||
yield* ProviderService.pipe(Effect.provide(runtimeServices));
|
||||
const closeExit = yield* Scope.close(scope, Exit.void).pipe(Effect.exit);
|
||||
|
||||
assert.equal(Exit.isSuccess(closeExit), true);
|
||||
@@ -636,9 +634,7 @@ it.effect("ProviderServiceLive keeps persisted resumable sessions on startup", (
|
||||
Layer.provide(Layer.succeed(ProviderEventLoggers, NoOpProviderEventLoggers)),
|
||||
);
|
||||
|
||||
yield* Effect.gen(function* () {
|
||||
yield* ProviderService;
|
||||
}).pipe(Effect.provide(providerLayer));
|
||||
yield* ProviderService.pipe(Effect.provide(providerLayer));
|
||||
|
||||
const persistedProvider = yield* Effect.gen(function* () {
|
||||
const directory = yield* ProviderSessionDirectory;
|
||||
|
||||
@@ -544,7 +544,7 @@ const makeOpenCodeRuntime = Effect.gen(function* () {
|
||||
});
|
||||
|
||||
export class OpenCodeRuntime extends Context.Service<OpenCodeRuntime, OpenCodeRuntimeShape>()(
|
||||
"t3/provider/OpenCodeRuntime",
|
||||
"t3/provider/opencodeRuntime",
|
||||
) {}
|
||||
|
||||
export const OpenCodeRuntimeLive = Layer.effect(OpenCodeRuntime, makeOpenCodeRuntime).pipe(
|
||||
|
||||
@@ -53,7 +53,7 @@ export interface ProviderMaintenanceRunnerShape {
|
||||
export class ProviderMaintenanceRunner extends Context.Service<
|
||||
ProviderMaintenanceRunner,
|
||||
ProviderMaintenanceRunnerShape
|
||||
>()("t3/provider/ProviderMaintenanceRunner") {}
|
||||
>()("t3/provider/providerMaintenanceRunner") {}
|
||||
|
||||
class ProviderMaintenanceCommandError extends Data.TaggedError("ProviderMaintenanceCommandError")<{
|
||||
readonly message: string;
|
||||
|
||||
+126
-221
@@ -40,6 +40,7 @@ import * as Path from "effect/Path";
|
||||
import * as Stream from "effect/Stream";
|
||||
import { ChildProcessSpawner } from "effect/unstable/process";
|
||||
import {
|
||||
Cookies,
|
||||
FetchHttpClient,
|
||||
HttpBody,
|
||||
HttpClient,
|
||||
@@ -780,13 +781,6 @@ const appendSessionCookieToWsUrl = (url: string, sessionCookieHeader: string) =>
|
||||
return isAbsoluteUrl ? next.toString() : `${next.pathname}${next.search}${next.hash}`;
|
||||
};
|
||||
|
||||
const getHttpServerUrl = (pathname = "") =>
|
||||
Effect.gen(function* () {
|
||||
const server = yield* HttpServer.HttpServer;
|
||||
const address = server.address as HttpServer.TcpAddress;
|
||||
return `http://127.0.0.1:${address.port}${pathname}`;
|
||||
});
|
||||
|
||||
const bootstrapBrowserSession = (
|
||||
credential = defaultDesktopBootstrapToken,
|
||||
options?: {
|
||||
@@ -794,20 +788,11 @@ const bootstrapBrowserSession = (
|
||||
},
|
||||
) =>
|
||||
Effect.gen(function* () {
|
||||
const bootstrapUrl = yield* getHttpServerUrl("/api/auth/bootstrap");
|
||||
const response = yield* Effect.promise(() =>
|
||||
fetch(bootstrapUrl, {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"content-type": "application/json",
|
||||
...options?.headers,
|
||||
},
|
||||
body: JSON.stringify({
|
||||
credential,
|
||||
}),
|
||||
}),
|
||||
);
|
||||
const body = (yield* Effect.promise(() => response.json())) as {
|
||||
const response = yield* HttpClient.post("/api/auth/bootstrap", {
|
||||
headers: options?.headers,
|
||||
body: yield* HttpBody.json({ credential }),
|
||||
});
|
||||
const body = (yield* response.json) as {
|
||||
readonly authenticated: boolean;
|
||||
readonly sessionMethod: string;
|
||||
readonly expiresAt: string;
|
||||
@@ -815,7 +800,7 @@ const bootstrapBrowserSession = (
|
||||
return {
|
||||
response,
|
||||
body,
|
||||
cookie: response.headers.get("set-cookie"),
|
||||
cookie: Cookies.toSetCookieHeaders(response.cookies)[0] ?? null,
|
||||
};
|
||||
});
|
||||
|
||||
@@ -826,20 +811,11 @@ const bootstrapBearerSession = (
|
||||
},
|
||||
) =>
|
||||
Effect.gen(function* () {
|
||||
const bootstrapUrl = yield* getHttpServerUrl("/api/auth/bootstrap/bearer");
|
||||
const response = yield* Effect.promise(() =>
|
||||
fetch(bootstrapUrl, {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"content-type": "application/json",
|
||||
...options?.headers,
|
||||
},
|
||||
body: JSON.stringify({
|
||||
credential,
|
||||
}),
|
||||
}),
|
||||
);
|
||||
const body = (yield* Effect.promise(() => response.json())) as {
|
||||
const response = yield* HttpClient.post("/api/auth/bootstrap/bearer", {
|
||||
headers: options?.headers,
|
||||
body: yield* HttpBody.json({ credential }),
|
||||
});
|
||||
const body = (yield* response.json) as {
|
||||
readonly authenticated: boolean;
|
||||
readonly sessionMethod: string;
|
||||
readonly expiresAt: string;
|
||||
@@ -859,7 +835,7 @@ class AuthenticationGetterError extends Data.TaggedError("AuthenticationGetterEr
|
||||
const getAuthenticatedSessionCookieHeader = (credential = defaultDesktopBootstrapToken) =>
|
||||
Effect.gen(function* () {
|
||||
const { response, cookie } = yield* bootstrapBrowserSession(credential);
|
||||
if (!response.ok) {
|
||||
if (response.status !== 200) {
|
||||
return yield* new AuthenticationGetterError({
|
||||
message: `Expected bootstrap session response to succeed, got ${response.status}`,
|
||||
});
|
||||
@@ -877,7 +853,7 @@ const getAuthenticatedSessionCookieHeader = (credential = defaultDesktopBootstra
|
||||
const getAuthenticatedBearerSessionToken = (credential = defaultDesktopBootstrapToken) =>
|
||||
Effect.gen(function* () {
|
||||
const { response, body } = yield* bootstrapBearerSession(credential);
|
||||
if (!response.ok) {
|
||||
if (response.status !== 200) {
|
||||
return yield* new AuthenticationGetterError({
|
||||
message: `Expected bearer bootstrap response to succeed, got ${response.status}`,
|
||||
});
|
||||
@@ -908,14 +884,14 @@ const splitHeaderTokens = (value: string | null) =>
|
||||
.filter((token) => token.length > 0)
|
||||
.toSorted();
|
||||
|
||||
const assertBrowserApiCorsHeaders = (headers: Headers) => {
|
||||
assert.equal(headers.get("access-control-allow-origin"), "*");
|
||||
assert.deepEqual(splitHeaderTokens(headers.get("access-control-allow-methods")), [
|
||||
const assertBrowserApiCorsHeaders = (headers: Readonly<Record<string, string | undefined>>) => {
|
||||
assert.equal(headers["access-control-allow-origin"], "*");
|
||||
assert.deepEqual(splitHeaderTokens(headers["access-control-allow-methods"] ?? null), [
|
||||
"GET",
|
||||
"OPTIONS",
|
||||
"POST",
|
||||
]);
|
||||
assert.deepEqual(splitHeaderTokens(headers.get("access-control-allow-headers")), [
|
||||
assert.deepEqual(splitHeaderTokens(headers["access-control-allow-headers"] ?? null), [
|
||||
"authorization",
|
||||
"b3",
|
||||
"content-type",
|
||||
@@ -964,14 +940,12 @@ it.layer(NodeServices.layer)("server router seam", (it) => {
|
||||
config: { devUrl: new URL("http://127.0.0.1:5173") },
|
||||
});
|
||||
|
||||
const url = yield* getHttpServerUrl("/foo/bar?token=test-token");
|
||||
const response = yield* Effect.promise(() => fetch(url, { redirect: "manual" }));
|
||||
const response = yield* HttpClient.get("/foo/bar?token=test-token").pipe(
|
||||
Effect.provideService(FetchHttpClient.RequestInit, { redirect: "manual" }),
|
||||
);
|
||||
|
||||
assert.equal(response.status, 302);
|
||||
assert.equal(
|
||||
response.headers.get("location"),
|
||||
"http://127.0.0.1:5173/foo/bar?token=test-token",
|
||||
);
|
||||
assert.equal(response.headers.location, "http://127.0.0.1:5173/foo/bar?token=test-token");
|
||||
}).pipe(Effect.provide(NodeHttpServer.layerTest)),
|
||||
);
|
||||
|
||||
@@ -1034,11 +1008,8 @@ it.layer(NodeServices.layer)("server router seam", (it) => {
|
||||
Effect.gen(function* () {
|
||||
yield* buildAppUnderTest();
|
||||
|
||||
const url = yield* getHttpServerUrl("/.well-known/t3/environment");
|
||||
const response = yield* Effect.promise(() => fetch(url));
|
||||
const body = (yield* Effect.promise(() =>
|
||||
response.json(),
|
||||
)) as typeof testEnvironmentDescriptor;
|
||||
const response = yield* HttpClient.get("/.well-known/t3/environment");
|
||||
const body = (yield* response.json) as typeof testEnvironmentDescriptor;
|
||||
|
||||
assert.equal(response.status, 200);
|
||||
assert.deepEqual(body, testEnvironmentDescriptor);
|
||||
@@ -1049,17 +1020,12 @@ it.layer(NodeServices.layer)("server router seam", (it) => {
|
||||
Effect.gen(function* () {
|
||||
yield* buildAppUnderTest();
|
||||
|
||||
const url = yield* getHttpServerUrl("/.well-known/t3/environment");
|
||||
const response = yield* Effect.promise(() =>
|
||||
fetch(url, {
|
||||
headers: {
|
||||
origin: crossOriginClientOrigin,
|
||||
},
|
||||
}),
|
||||
);
|
||||
const body = (yield* Effect.promise(() =>
|
||||
response.json(),
|
||||
)) as typeof testEnvironmentDescriptor;
|
||||
const response = yield* HttpClient.get("/.well-known/t3/environment", {
|
||||
headers: {
|
||||
origin: crossOriginClientOrigin,
|
||||
},
|
||||
});
|
||||
const body = (yield* response.json) as typeof testEnvironmentDescriptor;
|
||||
|
||||
assert.equal(response.status, 200);
|
||||
assertBrowserApiCorsHeaders(response.headers);
|
||||
@@ -1071,9 +1037,8 @@ it.layer(NodeServices.layer)("server router seam", (it) => {
|
||||
Effect.gen(function* () {
|
||||
yield* buildAppUnderTest();
|
||||
|
||||
const url = yield* getHttpServerUrl("/api/auth/session");
|
||||
const response = yield* Effect.promise(() => fetch(url));
|
||||
const body = (yield* Effect.promise(() => response.json())) as {
|
||||
const response = yield* HttpClient.get("/api/auth/session");
|
||||
const body = (yield* response.json) as {
|
||||
readonly authenticated: boolean;
|
||||
readonly auth: {
|
||||
readonly policy: string;
|
||||
@@ -1111,15 +1076,12 @@ it.layer(NodeServices.layer)("server router seam", (it) => {
|
||||
assert.isUndefined((bootstrapBody as { readonly sessionToken?: string }).sessionToken);
|
||||
assert.isDefined(setCookie);
|
||||
|
||||
const sessionUrl = yield* getHttpServerUrl("/api/auth/session");
|
||||
const sessionResponse = yield* Effect.promise(() =>
|
||||
fetch(sessionUrl, {
|
||||
headers: {
|
||||
cookie: setCookie?.split(";")[0] ?? "",
|
||||
},
|
||||
}),
|
||||
);
|
||||
const sessionBody = (yield* Effect.promise(() => sessionResponse.json())) as {
|
||||
const sessionResponse = yield* HttpClient.get("/api/auth/session", {
|
||||
headers: {
|
||||
cookie: setCookie?.split(";")[0] ?? "",
|
||||
},
|
||||
});
|
||||
const sessionBody = (yield* sessionResponse.json) as {
|
||||
readonly authenticated: boolean;
|
||||
readonly sessionMethod?: string;
|
||||
};
|
||||
@@ -1145,15 +1107,12 @@ it.layer(NodeServices.layer)("server router seam", (it) => {
|
||||
assert.equal(typeof bootstrapBody.sessionToken, "string");
|
||||
assert.isTrue((bootstrapBody.sessionToken?.length ?? 0) > 0);
|
||||
|
||||
const sessionUrl = yield* getHttpServerUrl("/api/auth/session");
|
||||
const sessionResponse = yield* Effect.promise(() =>
|
||||
fetch(sessionUrl, {
|
||||
headers: {
|
||||
authorization: `Bearer ${bootstrapBody.sessionToken ?? ""}`,
|
||||
},
|
||||
}),
|
||||
);
|
||||
const sessionBody = (yield* Effect.promise(() => sessionResponse.json())) as {
|
||||
const sessionResponse = yield* HttpClient.get("/api/auth/session", {
|
||||
headers: {
|
||||
authorization: `Bearer ${bootstrapBody.sessionToken ?? ""}`,
|
||||
},
|
||||
});
|
||||
const sessionBody = (yield* sessionResponse.json) as {
|
||||
readonly authenticated: boolean;
|
||||
readonly sessionMethod?: string;
|
||||
};
|
||||
@@ -1169,16 +1128,12 @@ it.layer(NodeServices.layer)("server router seam", (it) => {
|
||||
yield* buildAppUnderTest();
|
||||
|
||||
const bearerToken = yield* getAuthenticatedBearerSessionToken();
|
||||
const wsTokenUrl = yield* getHttpServerUrl("/api/auth/ws-token");
|
||||
const wsTokenResponse = yield* Effect.promise(() =>
|
||||
fetch(wsTokenUrl, {
|
||||
method: "POST",
|
||||
headers: {
|
||||
authorization: `Bearer ${bearerToken}`,
|
||||
},
|
||||
}),
|
||||
);
|
||||
const wsTokenBody = (yield* Effect.promise(() => wsTokenResponse.json())) as {
|
||||
const wsTokenResponse = yield* HttpClient.post("/api/auth/ws-token", {
|
||||
headers: {
|
||||
authorization: `Bearer ${bearerToken}`,
|
||||
},
|
||||
});
|
||||
const wsTokenBody = (yield* wsTokenResponse.json) as {
|
||||
readonly token: string;
|
||||
readonly expiresAt: string;
|
||||
};
|
||||
@@ -1207,16 +1162,13 @@ it.layer(NodeServices.layer)("server router seam", (it) => {
|
||||
assert.equal(bootstrapBody.authenticated, true);
|
||||
assert.equal(typeof bootstrapBody.sessionToken, "string");
|
||||
|
||||
const sessionUrl = yield* getHttpServerUrl("/api/auth/session");
|
||||
const sessionResponse = yield* Effect.promise(() =>
|
||||
fetch(sessionUrl, {
|
||||
headers: {
|
||||
authorization: `Bearer ${bootstrapBody.sessionToken ?? ""}`,
|
||||
origin,
|
||||
},
|
||||
}),
|
||||
);
|
||||
const sessionBody = (yield* Effect.promise(() => sessionResponse.json())) as {
|
||||
const sessionResponse = yield* HttpClient.get("/api/auth/session", {
|
||||
headers: {
|
||||
authorization: `Bearer ${bootstrapBody.sessionToken ?? ""}`,
|
||||
origin,
|
||||
},
|
||||
});
|
||||
const sessionBody = (yield* sessionResponse.json) as {
|
||||
readonly authenticated: boolean;
|
||||
readonly sessionMethod?: string;
|
||||
};
|
||||
@@ -1226,17 +1178,13 @@ it.layer(NodeServices.layer)("server router seam", (it) => {
|
||||
assert.equal(sessionBody.authenticated, true);
|
||||
assert.equal(sessionBody.sessionMethod, "bearer-session-token");
|
||||
|
||||
const wsTokenUrl = yield* getHttpServerUrl("/api/auth/ws-token");
|
||||
const wsTokenResponse = yield* Effect.promise(() =>
|
||||
fetch(wsTokenUrl, {
|
||||
method: "POST",
|
||||
headers: {
|
||||
authorization: `Bearer ${bootstrapBody.sessionToken ?? ""}`,
|
||||
origin,
|
||||
},
|
||||
}),
|
||||
);
|
||||
const wsTokenBody = (yield* Effect.promise(() => wsTokenResponse.json())) as {
|
||||
const wsTokenResponse = yield* HttpClient.post("/api/auth/ws-token", {
|
||||
headers: {
|
||||
authorization: `Bearer ${bootstrapBody.sessionToken ?? ""}`,
|
||||
origin,
|
||||
},
|
||||
});
|
||||
const wsTokenBody = (yield* wsTokenResponse.json) as {
|
||||
readonly token: string;
|
||||
};
|
||||
|
||||
@@ -1252,17 +1200,13 @@ it.layer(NodeServices.layer)("server router seam", (it) => {
|
||||
Effect.gen(function* () {
|
||||
yield* buildAppUnderTest();
|
||||
|
||||
const wsTokenUrl = yield* getHttpServerUrl("/api/auth/ws-token");
|
||||
const response = yield* Effect.promise(() =>
|
||||
fetch(wsTokenUrl, {
|
||||
method: "OPTIONS",
|
||||
headers: {
|
||||
origin: crossOriginClientOrigin,
|
||||
"access-control-request-method": "POST",
|
||||
"access-control-request-headers": "authorization",
|
||||
},
|
||||
}),
|
||||
);
|
||||
const response = yield* HttpClient.options("/api/auth/ws-token", {
|
||||
headers: {
|
||||
origin: crossOriginClientOrigin,
|
||||
"access-control-request-method": "POST",
|
||||
"access-control-request-headers": "authorization",
|
||||
},
|
||||
});
|
||||
|
||||
assert.equal(response.status, 204);
|
||||
assertBrowserApiCorsHeaders(response.headers);
|
||||
@@ -1273,16 +1217,12 @@ it.layer(NodeServices.layer)("server router seam", (it) => {
|
||||
Effect.gen(function* () {
|
||||
yield* buildAppUnderTest();
|
||||
|
||||
const wsTokenUrl = yield* getHttpServerUrl("/api/auth/ws-token");
|
||||
const response = yield* Effect.promise(() =>
|
||||
fetch(wsTokenUrl, {
|
||||
method: "POST",
|
||||
headers: {
|
||||
origin: crossOriginClientOrigin,
|
||||
},
|
||||
}),
|
||||
);
|
||||
const body = (yield* Effect.promise(() => response.json())) as {
|
||||
const response = yield* HttpClient.post("/api/auth/ws-token", {
|
||||
headers: {
|
||||
origin: crossOriginClientOrigin,
|
||||
},
|
||||
});
|
||||
const body = (yield* response.json) as {
|
||||
readonly error?: string;
|
||||
};
|
||||
|
||||
@@ -1357,17 +1297,12 @@ it.layer(NodeServices.layer)("server router seam", (it) => {
|
||||
readonly credential: string;
|
||||
}>;
|
||||
|
||||
const revokeUrl = yield* getHttpServerUrl("/api/auth/pairing-links/revoke");
|
||||
const revokeResponse = yield* Effect.promise(() =>
|
||||
fetch(revokeUrl, {
|
||||
method: "POST",
|
||||
headers: {
|
||||
cookie: ownerCookie,
|
||||
"content-type": "application/json",
|
||||
},
|
||||
body: JSON.stringify({ id: createdBody.id }),
|
||||
}),
|
||||
);
|
||||
const revokeResponse = yield* HttpClient.post("/api/auth/pairing-links/revoke", {
|
||||
headers: {
|
||||
cookie: ownerCookie,
|
||||
},
|
||||
body: yield* HttpBody.json({ id: createdBody.id }),
|
||||
});
|
||||
const revokedBootstrap = yield* bootstrapBrowserSession(createdBody.credential);
|
||||
|
||||
assert.equal(createdResponse.status, 200);
|
||||
@@ -1420,20 +1355,13 @@ it.layer(NodeServices.layer)("server router seam", (it) => {
|
||||
});
|
||||
|
||||
const ownerCookie = yield* getAuthenticatedSessionCookieHeader();
|
||||
const pairingTokenUrl = yield* getHttpServerUrl("/api/auth/pairing-token");
|
||||
const ownerPairingResponse = yield* Effect.promise(() =>
|
||||
fetch(pairingTokenUrl, {
|
||||
method: "POST",
|
||||
headers: {
|
||||
cookie: ownerCookie,
|
||||
"content-type": "application/json",
|
||||
},
|
||||
body: JSON.stringify({
|
||||
label: "Julius iPhone",
|
||||
}),
|
||||
}),
|
||||
);
|
||||
const ownerPairingBody = (yield* Effect.promise(() => ownerPairingResponse.json())) as {
|
||||
const ownerPairingResponse = yield* HttpClient.post("/api/auth/pairing-token", {
|
||||
headers: {
|
||||
cookie: ownerCookie,
|
||||
},
|
||||
body: yield* HttpBody.json({ label: "Julius iPhone" }),
|
||||
});
|
||||
const ownerPairingBody = (yield* ownerPairingResponse.json) as {
|
||||
readonly credential: string;
|
||||
readonly label?: string;
|
||||
};
|
||||
@@ -1448,17 +1376,12 @@ it.layer(NodeServices.layer)("server router seam", (it) => {
|
||||
assert.isDefined(pairedSessionCookie);
|
||||
|
||||
const pairedSessionCookieHeader = pairedSessionCookie ?? "";
|
||||
const listClientsUrl = yield* getHttpServerUrl("/api/auth/clients");
|
||||
const listBeforeResponse = yield* Effect.promise(() =>
|
||||
fetch(listClientsUrl, {
|
||||
headers: {
|
||||
cookie: ownerCookie,
|
||||
},
|
||||
}),
|
||||
);
|
||||
const clientsBefore = (yield* Effect.promise(() =>
|
||||
listBeforeResponse.json(),
|
||||
)) as ReadonlyArray<{
|
||||
const listBeforeResponse = yield* HttpClient.get("/api/auth/clients", {
|
||||
headers: {
|
||||
cookie: ownerCookie,
|
||||
},
|
||||
});
|
||||
const clientsBefore = (yield* listBeforeResponse.json) as ReadonlyArray<{
|
||||
readonly sessionId: string;
|
||||
readonly current: boolean;
|
||||
readonly client: {
|
||||
@@ -1555,17 +1478,12 @@ it.layer(NodeServices.layer)("server router seam", (it) => {
|
||||
const pairedSessionId = clients.find((entry) => !entry.current)?.sessionId;
|
||||
assert.isDefined(pairedSessionId);
|
||||
|
||||
const revokeUrl = yield* getHttpServerUrl("/api/auth/clients/revoke");
|
||||
const revokeResponse = yield* Effect.promise(() =>
|
||||
fetch(revokeUrl, {
|
||||
method: "POST",
|
||||
headers: {
|
||||
cookie: ownerCookie,
|
||||
"content-type": "application/json",
|
||||
},
|
||||
body: JSON.stringify({ sessionId: pairedSessionId }),
|
||||
}),
|
||||
);
|
||||
const revokeResponse = yield* HttpClient.post("/api/auth/clients/revoke", {
|
||||
headers: {
|
||||
cookie: ownerCookie,
|
||||
},
|
||||
body: yield* HttpBody.json({ sessionId: pairedSessionId }),
|
||||
});
|
||||
const pairedClientPairingResponse = yield* HttpClient.post("/api/auth/pairing-token", {
|
||||
headers: {
|
||||
cookie: pairedSessionCookie,
|
||||
@@ -1665,16 +1583,12 @@ it.layer(NodeServices.layer)("server router seam", (it) => {
|
||||
yield* buildAppUnderTest();
|
||||
|
||||
const bearerToken = yield* getAuthenticatedBearerSessionToken();
|
||||
const wsTokenUrl = yield* getHttpServerUrl("/api/auth/ws-token");
|
||||
const wsTokenResponse = yield* Effect.promise(() =>
|
||||
fetch(wsTokenUrl, {
|
||||
method: "POST",
|
||||
headers: {
|
||||
authorization: `Bearer ${bearerToken}`,
|
||||
},
|
||||
}),
|
||||
);
|
||||
const wsTokenBody = (yield* Effect.promise(() => wsTokenResponse.json())) as {
|
||||
const wsTokenResponse = yield* HttpClient.post("/api/auth/ws-token", {
|
||||
headers: {
|
||||
authorization: `Bearer ${bearerToken}`,
|
||||
},
|
||||
});
|
||||
const wsTokenBody = (yield* wsTokenResponse.json) as {
|
||||
readonly token: string;
|
||||
};
|
||||
const wsUrl = `${yield* getWsServerUrl("/ws", { authenticated: false })}?wsToken=${encodeURIComponent(wsTokenBody.token)}`;
|
||||
@@ -1876,8 +1790,7 @@ it.layer(NodeServices.layer)("server router seam", (it) => {
|
||||
"content-type": "application/json",
|
||||
origin: "http://localhost:5733",
|
||||
},
|
||||
// @effect-diagnostics-next-line preferSchemaOverJson:off
|
||||
body: HttpBody.text(JSON.stringify(payload), "application/json"),
|
||||
body: yield* HttpBody.json(payload),
|
||||
});
|
||||
|
||||
assert.equal(response.status, 204);
|
||||
@@ -1934,31 +1847,24 @@ it.layer(NodeServices.layer)("server router seam", (it) => {
|
||||
Effect.gen(function* () {
|
||||
yield* buildAppUnderTest();
|
||||
|
||||
const url = yield* getHttpServerUrl("/api/observability/v1/traces");
|
||||
const response = yield* Effect.promise(() =>
|
||||
fetch(url, {
|
||||
method: "OPTIONS",
|
||||
headers: {
|
||||
origin: "http://localhost:5733",
|
||||
"access-control-request-method": "POST",
|
||||
"access-control-request-headers": "content-type",
|
||||
},
|
||||
}),
|
||||
);
|
||||
const response = yield* HttpClient.options("/api/observability/v1/traces", {
|
||||
headers: {
|
||||
origin: "http://localhost:5733",
|
||||
"access-control-request-method": "POST",
|
||||
"access-control-request-headers": "content-type",
|
||||
},
|
||||
});
|
||||
|
||||
assert.equal(response.status, 204);
|
||||
assert.equal(response.headers.get("access-control-allow-origin"), "*");
|
||||
assert.deepEqual(splitHeaderTokens(response.headers.get("access-control-allow-methods")), [
|
||||
"GET",
|
||||
"OPTIONS",
|
||||
"POST",
|
||||
]);
|
||||
assert.deepEqual(splitHeaderTokens(response.headers.get("access-control-allow-headers")), [
|
||||
"authorization",
|
||||
"b3",
|
||||
"content-type",
|
||||
"traceparent",
|
||||
]);
|
||||
assert.equal(response.headers["access-control-allow-origin"], "*");
|
||||
assert.deepEqual(
|
||||
splitHeaderTokens(response.headers["access-control-allow-methods"] ?? null),
|
||||
["GET", "OPTIONS", "POST"],
|
||||
);
|
||||
assert.deepEqual(
|
||||
splitHeaderTokens(response.headers["access-control-allow-headers"] ?? null),
|
||||
["authorization", "b3", "content-type", "traceparent"],
|
||||
);
|
||||
}).pipe(Effect.provide(NodeHttpServer.layerTest)),
|
||||
);
|
||||
|
||||
@@ -1995,8 +1901,7 @@ it.layer(NodeServices.layer)("server router seam", (it) => {
|
||||
cookie: yield* getAuthenticatedSessionCookieHeader(),
|
||||
"content-type": "application/json",
|
||||
},
|
||||
// @effect-diagnostics-next-line preferSchemaOverJson:off
|
||||
body: HttpBody.text(JSON.stringify(payload), "application/json"),
|
||||
body: yield* HttpBody.json(payload),
|
||||
});
|
||||
|
||||
assert.equal(response.status, 204);
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
import * as NodeServices from "@effect/platform-node/NodeServices";
|
||||
import { DEFAULT_MODEL, ProjectId, ProviderInstanceId, ThreadId } from "@t3tools/contracts";
|
||||
import { assert, it } from "@effect/vitest";
|
||||
import * as Crypto from "effect/Crypto";
|
||||
import * as Deferred from "effect/Deferred";
|
||||
import * as Effect from "effect/Effect";
|
||||
import * as Fiber from "effect/Fiber";
|
||||
import * as Option from "effect/Option";
|
||||
import * as PlatformError from "effect/PlatformError";
|
||||
import * as Ref from "effect/Ref";
|
||||
import * as Stream from "effect/Stream";
|
||||
|
||||
@@ -222,3 +224,54 @@ it.effect("resolveAutoBootstrapWelcomeTargets creates a project and thread when
|
||||
assert.deepStrictEqual(yield* Ref.get(dispatchCalls), ["project.create", "thread.create"]);
|
||||
}),
|
||||
);
|
||||
|
||||
it.effect("resolveAutoBootstrapWelcomeTargets preserves typed UUID generation failures", () =>
|
||||
Effect.gen(function* () {
|
||||
const crypto = yield* Crypto.Crypto;
|
||||
const uuidError = PlatformError.systemError({
|
||||
_tag: "Unknown",
|
||||
module: "Crypto",
|
||||
method: "randomUUIDv4",
|
||||
description: "UUID generation unavailable",
|
||||
});
|
||||
const dispatchCalls = yield* Ref.make<ReadonlyArray<string>>([]);
|
||||
|
||||
const error = yield* resolveAutoBootstrapWelcomeTargets.pipe(
|
||||
Effect.provideService(ServerConfig, {
|
||||
cwd: "/tmp/startup-project",
|
||||
autoBootstrapProjectFromCwd: true,
|
||||
} as never),
|
||||
Effect.provideService(ProjectionSnapshotQuery, {
|
||||
getCommandReadModel: () => Effect.die("unused"),
|
||||
getSnapshot: () => Effect.die("unused"),
|
||||
getShellSnapshot: () => Effect.die("unused"),
|
||||
getArchivedShellSnapshot: () => Effect.die("unused"),
|
||||
getSnapshotSequence: () => Effect.die("unused"),
|
||||
getCounts: () => Effect.die("unused"),
|
||||
getActiveProjectByWorkspaceRoot: () => Effect.succeed(Option.none()),
|
||||
getProjectShellById: () => Effect.die("unused"),
|
||||
getFirstActiveThreadIdByProjectId: () => Effect.succeed(Option.none()),
|
||||
getThreadCheckpointContext: () => Effect.succeed(Option.none()),
|
||||
getFullThreadDiffContext: () => Effect.succeed(Option.none()),
|
||||
getThreadShellById: () => Effect.die("unused"),
|
||||
getThreadDetailById: () => Effect.die("unused"),
|
||||
}),
|
||||
Effect.provideService(OrchestrationEngineService, {
|
||||
readEvents: () => Stream.empty,
|
||||
dispatch: (command) =>
|
||||
Ref.update(dispatchCalls, (calls) => [...calls, command.type]).pipe(
|
||||
Effect.as({ sequence: 1 }),
|
||||
),
|
||||
streamDomainEvents: Stream.empty,
|
||||
} satisfies OrchestrationEngineShape),
|
||||
Effect.provideService(Crypto.Crypto, {
|
||||
...crypto,
|
||||
randomUUIDv4: Effect.fail(uuidError),
|
||||
}),
|
||||
Effect.flip,
|
||||
);
|
||||
|
||||
assert.strictEqual(error, uuidError);
|
||||
assert.deepStrictEqual(yield* Ref.get(dispatchCalls), []);
|
||||
}).pipe(Effect.provide(NodeServices.layer)),
|
||||
);
|
||||
@@ -19,6 +19,7 @@ import * as Ref from "effect/Ref";
|
||||
import * as Scope from "effect/Scope";
|
||||
import * as Context from "effect/Context";
|
||||
import * as Console from "effect/Console";
|
||||
import * as Crypto from "effect/Crypto";
|
||||
import * as DateTime from "effect/DateTime";
|
||||
|
||||
import { ServerConfig } from "./config.ts";
|
||||
@@ -170,6 +171,8 @@ export const resolveWelcomeBase = Effect.gen(function* () {
|
||||
});
|
||||
|
||||
export const resolveAutoBootstrapWelcomeTargets = Effect.gen(function* () {
|
||||
const crypto = yield* Crypto.Crypto;
|
||||
const randomUUID = crypto.randomUUIDv4;
|
||||
const serverConfig = yield* ServerConfig;
|
||||
const projectionReadModelQuery = yield* ProjectionSnapshotQuery;
|
||||
const orchestrationEngine = yield* OrchestrationEngineService;
|
||||
@@ -188,12 +191,12 @@ export const resolveAutoBootstrapWelcomeTargets = Effect.gen(function* () {
|
||||
|
||||
if (Option.isNone(existingProject)) {
|
||||
const createdAt = DateTime.formatIso(yield* DateTime.now);
|
||||
nextProjectId = ProjectId.make(crypto.randomUUID());
|
||||
nextProjectId = ProjectId.make(yield* randomUUID);
|
||||
const bootstrapProjectTitle = path.basename(serverConfig.cwd) || "project";
|
||||
nextProjectDefaultModelSelection = getAutoBootstrapDefaultModelSelection();
|
||||
yield* orchestrationEngine.dispatch({
|
||||
type: "project.create",
|
||||
commandId: CommandId.make(crypto.randomUUID()),
|
||||
commandId: CommandId.make(yield* randomUUID),
|
||||
projectId: nextProjectId,
|
||||
title: bootstrapProjectTitle,
|
||||
workspaceRoot: serverConfig.cwd,
|
||||
@@ -210,10 +213,10 @@ export const resolveAutoBootstrapWelcomeTargets = Effect.gen(function* () {
|
||||
yield* projectionReadModelQuery.getFirstActiveThreadIdByProjectId(nextProjectId);
|
||||
if (Option.isNone(existingThreadId)) {
|
||||
const createdAt = DateTime.formatIso(yield* DateTime.now);
|
||||
const createdThreadId = ThreadId.make(crypto.randomUUID());
|
||||
const createdThreadId = ThreadId.make(yield* randomUUID);
|
||||
yield* orchestrationEngine.dispatch({
|
||||
type: "thread.create",
|
||||
commandId: CommandId.make(crypto.randomUUID()),
|
||||
commandId: CommandId.make(yield* randomUUID),
|
||||
threadId: createdThreadId,
|
||||
projectId: nextProjectId,
|
||||
title: "New thread",
|
||||
|
||||
@@ -16,6 +16,9 @@ import * as Schema from "effect/Schema";
|
||||
import { ServerConfig } from "./config.ts";
|
||||
import { ServerSettingsLive, ServerSettingsService } from "./serverSettings.ts";
|
||||
|
||||
const decodeSettingsPatch = Schema.decodeUnknownEffect(ServerSettingsPatch);
|
||||
const decodeServerSettings = Schema.decodeUnknownEffect(ServerSettings);
|
||||
|
||||
const makeServerSettingsLayer = () =>
|
||||
ServerSettingsLive.pipe(
|
||||
Layer.provideMerge(
|
||||
@@ -29,15 +32,16 @@ const makeServerSettingsLayer = () =>
|
||||
|
||||
it.layer(NodeServices.layer)("server settings", (it) => {
|
||||
it.effect("decodes nested settings patches", () =>
|
||||
Effect.sync(() => {
|
||||
const decodePatch = Schema.decodeUnknownSync(ServerSettingsPatch);
|
||||
|
||||
assert.deepEqual(decodePatch({ providers: { codex: { binaryPath: "/tmp/codex" } } }), {
|
||||
providers: { codex: { binaryPath: "/tmp/codex" } },
|
||||
});
|
||||
Effect.gen(function* () {
|
||||
assert.deepEqual(
|
||||
yield* decodeSettingsPatch({ providers: { codex: { binaryPath: "/tmp/codex" } } }),
|
||||
{
|
||||
providers: { codex: { binaryPath: "/tmp/codex" } },
|
||||
},
|
||||
);
|
||||
|
||||
assert.deepEqual(
|
||||
decodePatch({
|
||||
yield* decodeSettingsPatch({
|
||||
textGenerationModelSelection: {
|
||||
options: [{ id: "fastMode", value: false }],
|
||||
},
|
||||
@@ -54,10 +58,8 @@ it.layer(NodeServices.layer)("server settings", (it) => {
|
||||
it.effect(
|
||||
"decodes legacy object-shaped textGenerationModelSelection.options from settings.json",
|
||||
() =>
|
||||
Effect.sync(() => {
|
||||
const decode = Schema.decodeUnknownSync(ServerSettings);
|
||||
|
||||
const decoded = decode({
|
||||
Effect.gen(function* () {
|
||||
const decoded = yield* decodeServerSettings({
|
||||
textGenerationModelSelection: {
|
||||
provider: ProviderDriverKind.make("codex"),
|
||||
model: "gpt-5.4-mini",
|
||||
|
||||
@@ -94,7 +94,7 @@ export interface AzureDevOpsCliShape {
|
||||
}
|
||||
|
||||
export class AzureDevOpsCli extends Context.Service<AzureDevOpsCli, AzureDevOpsCliShape>()(
|
||||
"t3/source-control/AzureDevOpsCli",
|
||||
"t3/sourceControl/AzureDevOpsCli",
|
||||
) {}
|
||||
|
||||
function errorText(error: VcsError | unknown): string {
|
||||
|
||||
@@ -154,7 +154,7 @@ export interface BitbucketApiShape {
|
||||
}
|
||||
|
||||
export class BitbucketApi extends Context.Service<BitbucketApi, BitbucketApiShape>()(
|
||||
"t3/source-control/BitbucketApi",
|
||||
"t3/sourceControl/BitbucketApi",
|
||||
) {}
|
||||
|
||||
function nonEmpty(value: string | undefined): Option.Option<string> {
|
||||
|
||||
@@ -93,7 +93,7 @@ export interface GitHubCliShape {
|
||||
}
|
||||
|
||||
export class GitHubCli extends Context.Service<GitHubCli, GitHubCliShape>()(
|
||||
"t3/source-control/GitHubCli",
|
||||
"t3/sourceControl/GitHubCli",
|
||||
) {}
|
||||
|
||||
function errorText(error: VcsError | unknown): string {
|
||||
|
||||
@@ -97,7 +97,7 @@ export interface GitLabCliShape {
|
||||
}
|
||||
|
||||
export class GitLabCli extends Context.Service<GitLabCli, GitLabCliShape>()(
|
||||
"t3/source-control/GitLabCli",
|
||||
"t3/sourceControl/GitLabCli",
|
||||
) {}
|
||||
|
||||
function isVcsProcessSpawnError(error: unknown): boolean {
|
||||
|
||||
@@ -64,7 +64,7 @@ export interface SourceControlDiscoveryShape {
|
||||
export class SourceControlDiscovery extends Context.Service<
|
||||
SourceControlDiscovery,
|
||||
SourceControlDiscoveryShape
|
||||
>()("t3/source-control/SourceControlDiscovery") {}
|
||||
>()("t3/sourceControl/SourceControlDiscovery") {}
|
||||
|
||||
export const layer = Layer.effect(
|
||||
SourceControlDiscovery,
|
||||
|
||||
@@ -99,4 +99,4 @@ export interface SourceControlProviderShape {
|
||||
export class SourceControlProvider extends Context.Service<
|
||||
SourceControlProvider,
|
||||
SourceControlProviderShape
|
||||
>()("t3/source-control/SourceControlProvider") {}
|
||||
>()("t3/sourceControl/SourceControlProvider") {}
|
||||
@@ -51,7 +51,7 @@ export interface SourceControlProviderRegistryShape {
|
||||
export class SourceControlProviderRegistry extends Context.Service<
|
||||
SourceControlProviderRegistry,
|
||||
SourceControlProviderRegistryShape
|
||||
>()("t3/source-control/SourceControlProviderRegistry") {}
|
||||
>()("t3/sourceControl/SourceControlProviderRegistry") {}
|
||||
|
||||
function unsupportedProvider(
|
||||
kind: SourceControlProviderKind,
|
||||
|
||||
@@ -39,7 +39,7 @@ export interface SourceControlRepositoryServiceShape {
|
||||
export class SourceControlRepositoryService extends Context.Service<
|
||||
SourceControlRepositoryService,
|
||||
SourceControlRepositoryServiceShape
|
||||
>()("t3/source-control/SourceControlRepositoryService") {}
|
||||
>()("t3/sourceControl/SourceControlRepositoryService") {}
|
||||
|
||||
function detailFromUnknown(cause: unknown): string {
|
||||
if (typeof cause === "object" && cause !== null) {
|
||||
|
||||
@@ -76,24 +76,22 @@ export const makeCodexTextGeneration = Effect.fn("makeCodexTextGeneration")(func
|
||||
operation: string,
|
||||
prefix: string,
|
||||
content: string,
|
||||
): Effect.Effect<string, TextGenerationError, Scope.Scope> => {
|
||||
return Effect.gen(function* () {
|
||||
return yield* fileSystem
|
||||
.makeTempFileScoped({
|
||||
prefix: `t3code-${prefix}-${process.pid}-`,
|
||||
})
|
||||
.pipe(Effect.tap((filePath) => fileSystem.writeFileString(filePath, content)));
|
||||
}).pipe(
|
||||
Effect.mapError(
|
||||
(cause) =>
|
||||
new TextGenerationError({
|
||||
operation,
|
||||
detail: `Failed to write temp file`,
|
||||
cause,
|
||||
}),
|
||||
),
|
||||
);
|
||||
};
|
||||
): Effect.Effect<string, TextGenerationError, Scope.Scope> =>
|
||||
fileSystem
|
||||
.makeTempFileScoped({
|
||||
prefix: `t3code-${prefix}-${process.pid}-`,
|
||||
})
|
||||
.pipe(
|
||||
Effect.tap((filePath) => fileSystem.writeFileString(filePath, content)),
|
||||
Effect.mapError(
|
||||
(cause) =>
|
||||
new TextGenerationError({
|
||||
operation,
|
||||
detail: `Failed to write temp file`,
|
||||
cause,
|
||||
}),
|
||||
),
|
||||
);
|
||||
|
||||
const safeUnlink = (filePath: string): Effect.Effect<void, never> =>
|
||||
fileSystem.remove(filePath).pipe(Effect.catch(() => Effect.void));
|
||||
|
||||
@@ -116,7 +116,7 @@ export interface TextGenerationShape {
|
||||
* TextGeneration - Service tag for commit and PR text generation.
|
||||
*/
|
||||
export class TextGeneration extends Context.Service<TextGeneration, TextGenerationShape>()(
|
||||
"t3/text-generation/TextGeneration",
|
||||
"t3/textGeneration/TextGeneration",
|
||||
) {}
|
||||
|
||||
type TextGenerationOp =
|
||||
|
||||
+49
-32
@@ -1,4 +1,5 @@
|
||||
import * as Cause from "effect/Cause";
|
||||
import * as Crypto from "effect/Crypto";
|
||||
import * as DateTime from "effect/DateTime";
|
||||
import * as Duration from "effect/Duration";
|
||||
import * as Effect from "effect/Effect";
|
||||
@@ -160,6 +161,7 @@ function toAuthAccessStreamEvent(
|
||||
const makeWsRpcLayer = (currentSessionId: AuthSessionId) =>
|
||||
WsRpcGroup.toLayer(
|
||||
Effect.gen(function* () {
|
||||
const crypto = yield* Crypto.Crypto;
|
||||
const projectionSnapshotQuery = yield* ProjectionSnapshotQuery;
|
||||
const orchestrationEngine = yield* OrchestrationEngineService;
|
||||
const checkpointDiffQuery = yield* CheckpointDiffQuery;
|
||||
@@ -195,8 +197,21 @@ const makeWsRpcLayer = (currentSessionId: AuthSessionId) =>
|
||||
const sessions = yield* SessionCredentialService;
|
||||
const processDiagnostics = yield* ProcessDiagnostics.ProcessDiagnostics;
|
||||
const processResourceMonitor = yield* ProcessResourceMonitor.ProcessResourceMonitor;
|
||||
const toDispatchCommandError = (cause: unknown, fallbackMessage: string) =>
|
||||
isOrchestrationDispatchCommandError(cause)
|
||||
? cause
|
||||
: new OrchestrationDispatchCommandError({
|
||||
message: cause instanceof Error ? cause.message : fallbackMessage,
|
||||
cause,
|
||||
});
|
||||
const randomUUID = crypto.randomUUIDv4.pipe(
|
||||
Effect.mapError((cause) =>
|
||||
toDispatchCommandError(cause, "Failed to generate orchestration command identifier."),
|
||||
),
|
||||
);
|
||||
const serverEventId = randomUUID.pipe(Effect.map(EventId.make));
|
||||
const serverCommandId = (tag: string) =>
|
||||
CommandId.make(`server:${tag}:${crypto.randomUUID()}`);
|
||||
randomUUID.pipe(Effect.map((uuid) => CommandId.make(`server:${tag}:${uuid}`)));
|
||||
|
||||
const loadAuthAccessSnapshot = () =>
|
||||
Effect.all({
|
||||
@@ -212,29 +227,28 @@ const makeWsRpcLayer = (currentSessionId: AuthSessionId) =>
|
||||
readonly payload: Record<string, unknown>;
|
||||
readonly tone: "info" | "error";
|
||||
}) =>
|
||||
orchestrationEngine.dispatch({
|
||||
type: "thread.activity.append",
|
||||
Effect.all({
|
||||
commandId: serverCommandId("setup-script-activity"),
|
||||
threadId: input.threadId,
|
||||
activity: {
|
||||
id: EventId.make(crypto.randomUUID()),
|
||||
tone: input.tone,
|
||||
kind: input.kind,
|
||||
summary: input.summary,
|
||||
payload: input.payload,
|
||||
turnId: null,
|
||||
createdAt: input.createdAt,
|
||||
},
|
||||
createdAt: input.createdAt,
|
||||
});
|
||||
|
||||
const toDispatchCommandError = (cause: unknown, fallbackMessage: string) =>
|
||||
isOrchestrationDispatchCommandError(cause)
|
||||
? cause
|
||||
: new OrchestrationDispatchCommandError({
|
||||
message: cause instanceof Error ? cause.message : fallbackMessage,
|
||||
cause,
|
||||
});
|
||||
activityId: serverEventId,
|
||||
}).pipe(
|
||||
Effect.flatMap(({ commandId, activityId }) =>
|
||||
orchestrationEngine.dispatch({
|
||||
type: "thread.activity.append",
|
||||
commandId,
|
||||
threadId: input.threadId,
|
||||
activity: {
|
||||
id: activityId,
|
||||
tone: input.tone,
|
||||
kind: input.kind,
|
||||
summary: input.summary,
|
||||
payload: input.payload,
|
||||
turnId: null,
|
||||
createdAt: input.createdAt,
|
||||
},
|
||||
createdAt: input.createdAt,
|
||||
}),
|
||||
),
|
||||
);
|
||||
|
||||
const toBootstrapDispatchCommandCauseError = (cause: Cause.Cause<unknown>) => {
|
||||
const error = Cause.squash(cause);
|
||||
@@ -370,13 +384,16 @@ const makeWsRpcLayer = (currentSessionId: AuthSessionId) =>
|
||||
|
||||
const cleanupCreatedThread = () =>
|
||||
createdThread
|
||||
? orchestrationEngine
|
||||
.dispatch({
|
||||
type: "thread.delete",
|
||||
commandId: serverCommandId("bootstrap-thread-delete"),
|
||||
threadId: command.threadId,
|
||||
})
|
||||
.pipe(Effect.ignoreCause({ log: true }))
|
||||
? serverCommandId("bootstrap-thread-delete").pipe(
|
||||
Effect.flatMap((commandId) =>
|
||||
orchestrationEngine.dispatch({
|
||||
type: "thread.delete",
|
||||
commandId,
|
||||
threadId: command.threadId,
|
||||
}),
|
||||
),
|
||||
Effect.ignoreCause({ log: true }),
|
||||
)
|
||||
: Effect.void;
|
||||
|
||||
const recordSetupScriptLaunchFailure = (input: {
|
||||
@@ -499,7 +516,7 @@ const makeWsRpcLayer = (currentSessionId: AuthSessionId) =>
|
||||
if (bootstrap?.createThread) {
|
||||
yield* orchestrationEngine.dispatch({
|
||||
type: "thread.create",
|
||||
commandId: serverCommandId("bootstrap-thread-create"),
|
||||
commandId: yield* serverCommandId("bootstrap-thread-create"),
|
||||
threadId: command.threadId,
|
||||
projectId: bootstrap.createThread.projectId,
|
||||
title: bootstrap.createThread.title,
|
||||
@@ -523,7 +540,7 @@ const makeWsRpcLayer = (currentSessionId: AuthSessionId) =>
|
||||
targetWorktreePath = worktree.worktree.path;
|
||||
yield* orchestrationEngine.dispatch({
|
||||
type: "thread.meta.update",
|
||||
commandId: serverCommandId("bootstrap-thread-meta-update"),
|
||||
commandId: yield* serverCommandId("bootstrap-thread-meta-update"),
|
||||
threadId: command.threadId,
|
||||
branch: worktree.worktree.refName,
|
||||
worktreePath: targetWorktreePath,
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
{
|
||||
"extends": "../../tsconfig.base.json",
|
||||
"compilerOptions": {
|
||||
"composite": true,
|
||||
"types": ["node", "bun"],
|
||||
"lib": ["ESNext", "esnext.disposable"]
|
||||
},
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
"dev": "vite",
|
||||
"build": "vite build",
|
||||
"preview": "vite preview",
|
||||
"typecheck": "tsc --noEmit",
|
||||
"typecheck": "tsgo --noEmit",
|
||||
"test": "vitest run --passWithNoTests",
|
||||
"test:browser": "vitest run --config vitest.browser.config.ts",
|
||||
"test:browser:install": "playwright install --with-deps chromium"
|
||||
@@ -43,7 +43,6 @@
|
||||
"zustand": "^5.0.11"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@effect/language-service": "catalog:",
|
||||
"@rolldown/plugin-babel": "^0.2.0",
|
||||
"@tailwindcss/vite": "^4.0.0",
|
||||
"@tanstack/router-plugin": "^1.161.0",
|
||||
@@ -57,7 +56,6 @@
|
||||
"msw": "2.12.11",
|
||||
"playwright": "^1.58.2",
|
||||
"tailwindcss": "^4.0.0",
|
||||
"typescript": "catalog:",
|
||||
"vite": "^8.0.0",
|
||||
"vitest": "catalog:",
|
||||
"vitest-browser-react": "^2.0.5"
|
||||
|
||||
@@ -22,6 +22,8 @@ import {
|
||||
isLatestTurnSettled,
|
||||
} from "./session-logic";
|
||||
|
||||
let nextActivityId = 0;
|
||||
|
||||
function makeActivity(overrides: {
|
||||
id?: string;
|
||||
createdAt?: string;
|
||||
@@ -34,7 +36,7 @@ function makeActivity(overrides: {
|
||||
}): OrchestrationThreadActivity {
|
||||
const payload = overrides.payload ?? {};
|
||||
return {
|
||||
id: EventId.make(overrides.id ?? crypto.randomUUID()),
|
||||
id: EventId.make(overrides.id ?? `activity-${nextActivityId++}`),
|
||||
createdAt: overrides.createdAt ?? "2026-02-23T00:00:00.000Z",
|
||||
kind: overrides.kind ?? "tool.started",
|
||||
summary: overrides.summary ?? "Tool call",
|
||||
|
||||
+6
-15
@@ -15,22 +15,13 @@
|
||||
"plugins": [
|
||||
{
|
||||
"name": "@effect/language-service",
|
||||
"namespaceImportPackages": ["@effect/platform-node", "effect"],
|
||||
// Diagnostic severities are deep-merged with tsconfig.base.json; list only web-specific overrides here.
|
||||
"diagnosticSeverity": {
|
||||
"importFromBarrel": "error",
|
||||
"anyUnknownInErrorContext": "error",
|
||||
"unsafeEffectTypeAssertion": "error",
|
||||
"instanceOfSchema": "error",
|
||||
"deterministicKeys": "error",
|
||||
"strictEffectProvide": "off",
|
||||
"missingEffectServiceDependency": "error",
|
||||
"leakingRequirements": "error",
|
||||
"globalErrorInEffectCatch": "error",
|
||||
"globalErrorInEffectFailure": "error",
|
||||
"unknownInEffectCatch": "error",
|
||||
"strictBooleanExpressions": "off",
|
||||
"preferSchemaOverJson": "error",
|
||||
"schemaSyncInEffect": "error"
|
||||
"globalDate": "off",
|
||||
"globalConsole": "off",
|
||||
"globalRandom": "off",
|
||||
"globalTimers": "off",
|
||||
"globalFetch": "off"
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
@@ -5,13 +5,13 @@
|
||||
"": {
|
||||
"name": "@t3tools/monorepo",
|
||||
"devDependencies": {
|
||||
"@effect/language-service": "catalog:",
|
||||
"@effect/tsgo": "catalog:",
|
||||
"@oxlint/plugins": "^1.63.0",
|
||||
"@types/node": "catalog:",
|
||||
"@typescript/native-preview": "catalog:",
|
||||
"oxfmt": "^0.40.0",
|
||||
"oxlint": "^1.63.0",
|
||||
"turbo": "^2.3.3",
|
||||
"typescript": "catalog:",
|
||||
"vitest": "catalog:",
|
||||
},
|
||||
},
|
||||
@@ -29,11 +29,9 @@
|
||||
"electron-updater": "^6.6.2",
|
||||
},
|
||||
"devDependencies": {
|
||||
"@effect/language-service": "catalog:",
|
||||
"@effect/vitest": "catalog:",
|
||||
"@types/node": "catalog:",
|
||||
"tsdown": "catalog:",
|
||||
"typescript": "catalog:",
|
||||
"vitest": "catalog:",
|
||||
},
|
||||
},
|
||||
@@ -66,7 +64,6 @@
|
||||
"node-pty": "^1.1.0",
|
||||
},
|
||||
"devDependencies": {
|
||||
"@effect/language-service": "catalog:",
|
||||
"@effect/vitest": "catalog:",
|
||||
"@t3tools/contracts": "workspace:*",
|
||||
"@t3tools/shared": "workspace:*",
|
||||
@@ -77,7 +74,6 @@
|
||||
"effect-acp": "workspace:*",
|
||||
"effect-codex-app-server": "workspace:*",
|
||||
"tsdown": "catalog:",
|
||||
"typescript": "catalog:",
|
||||
"vitest": "catalog:",
|
||||
},
|
||||
},
|
||||
@@ -115,7 +111,6 @@
|
||||
"zustand": "^5.0.11",
|
||||
},
|
||||
"devDependencies": {
|
||||
"@effect/language-service": "catalog:",
|
||||
"@rolldown/plugin-babel": "^0.2.0",
|
||||
"@tailwindcss/vite": "^4.0.0",
|
||||
"@tanstack/router-plugin": "^1.161.0",
|
||||
@@ -129,7 +124,6 @@
|
||||
"msw": "2.12.11",
|
||||
"playwright": "^1.58.2",
|
||||
"tailwindcss": "^4.0.0",
|
||||
"typescript": "catalog:",
|
||||
"vite": "^8.0.0",
|
||||
"vitest": "catalog:",
|
||||
"vitest-browser-react": "^2.0.5",
|
||||
@@ -143,10 +137,8 @@
|
||||
"effect": "catalog:",
|
||||
},
|
||||
"devDependencies": {
|
||||
"@effect/language-service": "catalog:",
|
||||
"@effect/vitest": "catalog:",
|
||||
"@types/bun": "catalog:",
|
||||
"typescript": "catalog:",
|
||||
"vitest": "catalog:",
|
||||
},
|
||||
},
|
||||
@@ -158,8 +150,6 @@
|
||||
"effect": "catalog:",
|
||||
},
|
||||
"devDependencies": {
|
||||
"@effect/language-service": "catalog:",
|
||||
"typescript": "catalog:",
|
||||
"vitest": "catalog:",
|
||||
},
|
||||
},
|
||||
@@ -170,9 +160,7 @@
|
||||
"effect": "catalog:",
|
||||
},
|
||||
"devDependencies": {
|
||||
"@effect/language-service": "catalog:",
|
||||
"@effect/vitest": "catalog:",
|
||||
"typescript": "catalog:",
|
||||
"vitest": "catalog:",
|
||||
},
|
||||
},
|
||||
@@ -182,11 +170,10 @@
|
||||
"effect": "catalog:",
|
||||
},
|
||||
"devDependencies": {
|
||||
"@effect/language-service": "catalog:",
|
||||
"@effect/openapi-generator": "catalog:",
|
||||
"@effect/platform-node": "catalog:",
|
||||
"@effect/vitest": "catalog:",
|
||||
"typescript": "catalog:",
|
||||
"@types/node": "catalog:",
|
||||
"vitest": "catalog:",
|
||||
},
|
||||
},
|
||||
@@ -196,11 +183,10 @@
|
||||
"effect": "catalog:",
|
||||
},
|
||||
"devDependencies": {
|
||||
"@effect/language-service": "catalog:",
|
||||
"@effect/openapi-generator": "catalog:",
|
||||
"@effect/platform-node": "catalog:",
|
||||
"@effect/vitest": "catalog:",
|
||||
"typescript": "catalog:",
|
||||
"@types/node": "catalog:",
|
||||
"vitest": "catalog:",
|
||||
},
|
||||
},
|
||||
@@ -211,11 +197,9 @@
|
||||
"effect": "catalog:",
|
||||
},
|
||||
"devDependencies": {
|
||||
"@effect/language-service": "catalog:",
|
||||
"@effect/platform-node": "catalog:",
|
||||
"@effect/vitest": "catalog:",
|
||||
"@types/node": "catalog:",
|
||||
"typescript": "catalog:",
|
||||
"vitest": "catalog:",
|
||||
},
|
||||
},
|
||||
@@ -227,11 +211,9 @@
|
||||
"effect": "catalog:",
|
||||
},
|
||||
"devDependencies": {
|
||||
"@effect/language-service": "catalog:",
|
||||
"@effect/platform-node": "catalog:",
|
||||
"@effect/vitest": "catalog:",
|
||||
"@types/node": "catalog:",
|
||||
"typescript": "catalog:",
|
||||
"vitest": "catalog:",
|
||||
},
|
||||
},
|
||||
@@ -242,10 +224,8 @@
|
||||
"effect": "catalog:",
|
||||
},
|
||||
"devDependencies": {
|
||||
"@effect/language-service": "catalog:",
|
||||
"@effect/vitest": "catalog:",
|
||||
"@types/node": "catalog:",
|
||||
"typescript": "catalog:",
|
||||
"vitest": "catalog:",
|
||||
},
|
||||
},
|
||||
@@ -259,10 +239,8 @@
|
||||
"effect": "catalog:",
|
||||
},
|
||||
"devDependencies": {
|
||||
"@effect/language-service": "catalog:",
|
||||
"@effect/vitest": "catalog:",
|
||||
"@types/bun": "catalog:",
|
||||
"typescript": "catalog:",
|
||||
"vitest": "catalog:",
|
||||
},
|
||||
},
|
||||
@@ -286,19 +264,20 @@
|
||||
},
|
||||
"catalog": {
|
||||
"@effect/atom-react": "4.0.0-beta.73",
|
||||
"@effect/language-service": "0.84.2",
|
||||
"@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-sqlite-bun": "4.0.0-beta.73",
|
||||
"@effect/tsgo": "0.11.4",
|
||||
"@effect/vitest": "4.0.0-beta.73",
|
||||
"@pierre/diffs": "1.1.20",
|
||||
"@types/bun": "^1.3.11",
|
||||
"@types/node": "^24.10.13",
|
||||
"@typescript/native-preview": "7.0.0-dev.20260527.2",
|
||||
"effect": "4.0.0-beta.73",
|
||||
"tsdown": "^0.20.3",
|
||||
"typescript": "^5.7.3",
|
||||
"typescript": "~6.0.3",
|
||||
"vitest": "^4.0.0",
|
||||
},
|
||||
"packages": {
|
||||
@@ -402,8 +381,6 @@
|
||||
|
||||
"@effect/atom-react": ["@effect/[email protected]", "", { "peerDependencies": { "effect": "^4.0.0-beta.73", "react": "^19.2.4", "scheduler": "*" } }, "sha512-RjNqEMV3z3iEFRBtJ1RVuxBNFMYxhDo2iRwck3kBYjrBuXWrKIRyqnunWJdL2KX97Gqp0orxaujG7qnIA5aIEA=="],
|
||||
|
||||
"@effect/language-service": ["@effect/[email protected]", "", { "bin": { "effect-language-service": "cli.js" } }, "sha512-l04qNxpiA8rY5yXWckRPJ7Mk5MNerXuNymSFf+IdflfI5i8jgL1bpBNLuP6ijg7wgjdHc/KmTnCj2kT0SCntuA=="],
|
||||
|
||||
"@effect/openapi-generator": ["@effect/[email protected]", "", { "peerDependencies": { "@effect/platform-node": "^4.0.0-beta.73", "effect": "^4.0.0-beta.73" }, "bin": { "openapigen": "dist/bin.js" } }, "sha512-tN1mKreMo6kypkuPy8Jt3eGoI0DberzD2/5XxEh17lTdyLg7/SUZv3LssRxtzO5+uIYzLNIHfT2zESz7gjCnwA=="],
|
||||
|
||||
"@effect/platform-bun": ["@effect/[email protected]", "", { "dependencies": { "@effect/platform-node-shared": "^4.0.0-beta.73" }, "peerDependencies": { "effect": "^4.0.0-beta.73" } }, "sha512-AQcE89eEVp0xA3SafaswiHPfo6V2YPg7T6PQbQqYK4/S2Sia5cadCm/6y7pfRmuOd4jkWI6VMbNtEDkM0NOBpw=="],
|
||||
@@ -414,6 +391,22 @@
|
||||
|
||||
"@effect/sql-sqlite-bun": ["@effect/[email protected]", "", { "peerDependencies": { "effect": "^4.0.0-beta.73" } }, "sha512-dkTDDeBLjaKo7h1IE049Oj2BDKQOT+Kc57KbBVaSk36dRdsEmVspRMP7OGbZj3etJU3lL1GJi1BIfnb4N3uMRw=="],
|
||||
|
||||
"@effect/tsgo": ["@effect/[email protected]", "", { "optionalDependencies": { "@effect/tsgo-darwin-arm64": "0.11.4", "@effect/tsgo-darwin-x64": "0.11.4", "@effect/tsgo-linux-arm": "0.11.4", "@effect/tsgo-linux-arm64": "0.11.4", "@effect/tsgo-linux-x64": "0.11.4", "@effect/tsgo-win32-arm64": "0.11.4", "@effect/tsgo-win32-x64": "0.11.4" }, "bin": { "effect-tsgo": "dist/effect-tsgo.js" } }, "sha512-wliq5Dis2gLoIUKoCRT3Iv5kpO+fKrUBJPPxIsHADeirk9HMQevKvYaBpGS3Khw1tNLmoQWsSX559owJAdHgBA=="],
|
||||
|
||||
"@effect/tsgo-darwin-arm64": ["@effect/[email protected]", "", { "os": "darwin", "cpu": "arm64" }, "sha512-rslT4W8tWY8pdd48kDpY7Q+yo0xkrmcEySG1+sJfb06w7TwbywjHsGlC0BmcUaQt0qmLY+BApbWWDfZw7fgwjw=="],
|
||||
|
||||
"@effect/tsgo-darwin-x64": ["@effect/[email protected]", "", { "os": "darwin", "cpu": "x64" }, "sha512-p3v3j+zp7L7yx5ctjvA1W85I4WjOpbOcga8kUu5MFEKfYfsApxUHXwsunCVbUKwrpXqcTc0sw9AjnCNs6i6GRw=="],
|
||||
|
||||
"@effect/tsgo-linux-arm": ["@effect/[email protected]", "", { "os": "linux", "cpu": "arm" }, "sha512-uXsw+IbO+ltn/fbhOWWqXK8ZW3Qa5EZD+wnGbF3gIGWINthbF+/7X+CgRzvcgLBWeBfV6F83hAmOaEZ4hQmd+w=="],
|
||||
|
||||
"@effect/tsgo-linux-arm64": ["@effect/[email protected]", "", { "os": "linux", "cpu": "arm64" }, "sha512-dz5ZIQUnRzN9mpVcELYCmVERpmstes5rVHbKUb7DOWCbrbupT3tV1LCzOaNX9sIsoBKmpvdGvAWEPLHgymSgTQ=="],
|
||||
|
||||
"@effect/tsgo-linux-x64": ["@effect/[email protected]", "", { "os": "linux", "cpu": "x64" }, "sha512-P3m7Y4FJtziL13Muffyb99AnQeTRvo0/knfYRqoHKNwYUaNM59RO3qFi5y57Hasgd8rKat0xTPmUkK6koZPPFQ=="],
|
||||
|
||||
"@effect/tsgo-win32-arm64": ["@effect/[email protected]", "", { "os": "win32", "cpu": "arm64" }, "sha512-FKLm9Y+luZSdLpfkbdw8VXa8xy0zR+Asg078qemqHHGwRQLDVGjvIk7tj1HxBM6VQN+TwsofDd225ht83kMk8w=="],
|
||||
|
||||
"@effect/tsgo-win32-x64": ["@effect/[email protected]", "", { "os": "win32", "cpu": "x64" }, "sha512-oc4Y8TbLlv0b1deAILAEep1N6pnSS1d4pk7gJJM4NDXrTKWDyEulO6tXwRQ6vWkO2lhLTUVWHDFfzmMJj3HxPQ=="],
|
||||
|
||||
"@effect/vitest": ["@effect/[email protected]", "", { "peerDependencies": { "effect": "^4.0.0-beta.73", "vitest": "^3.0.0 || ^4.0.0" } }, "sha512-HIZa0aekh0ak1YfzCv8GTN75Vbvxp8g+W+z9KczvtUT+LvitX3i9nhLWZLKRrUP1LaJFLPJS2UG9ZGXjxgbjBg=="],
|
||||
|
||||
"@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=="],
|
||||
@@ -934,6 +927,22 @@
|
||||
|
||||
"@types/yauzl": ["@types/[email protected]", "", { "dependencies": { "@types/node": "*" } }, "sha512-oJoftv0LSuaDZE3Le4DbKX+KS9G36NzOeSap90UIK0yMA/NhKJhqlSGtNDORNRaIbQfzjXDrQa0ytJ6mNRGz/Q=="],
|
||||
|
||||
"@typescript/native-preview": ["@typescript/[email protected]", "", { "optionalDependencies": { "@typescript/native-preview-darwin-arm64": "7.0.0-dev.20260527.2", "@typescript/native-preview-darwin-x64": "7.0.0-dev.20260527.2", "@typescript/native-preview-linux-arm": "7.0.0-dev.20260527.2", "@typescript/native-preview-linux-arm64": "7.0.0-dev.20260527.2", "@typescript/native-preview-linux-x64": "7.0.0-dev.20260527.2", "@typescript/native-preview-win32-arm64": "7.0.0-dev.20260527.2", "@typescript/native-preview-win32-x64": "7.0.0-dev.20260527.2" }, "bin": { "tsgo": "bin/tsgo.js" } }, "sha512-piqkDwikVeizCFqA1lcwI5F4wOAtBdxuliWe77ApBNRyBPPvfCJB+u/HYi9/8t5nd0sWvFs6/qt/AzJ1CCoykQ=="],
|
||||
|
||||
"@typescript/native-preview-darwin-arm64": ["@typescript/[email protected]", "", { "os": "darwin", "cpu": "arm64" }, "sha512-3LqSu4DlxkEfeC/Z/29QMCJn5jjkDtXI7LYuxfmjdmAatS6umDKqm8J17fnP/7fyrZUMBTIYRwSDpChGV3G1ew=="],
|
||||
|
||||
"@typescript/native-preview-darwin-x64": ["@typescript/[email protected]", "", { "os": "darwin", "cpu": "x64" }, "sha512-H4+sxE9qaBbLF83wMdWE0FsgfK0Pom+/O+/oxqyGzhVkDJlNt3vfpgQZMit48/Gm44AacGfBggJ9Dhbi3aeSFw=="],
|
||||
|
||||
"@typescript/native-preview-linux-arm": ["@typescript/[email protected]", "", { "os": "linux", "cpu": "arm" }, "sha512-6I9Cv9ozwfS9zB9vRQDPIYseLX3artEO9jl3yVgLj4ishwlSF4cWAbIsjl5IztPaEgHv8coej/6tX1D0uaBzXg=="],
|
||||
|
||||
"@typescript/native-preview-linux-arm64": ["@typescript/[email protected]", "", { "os": "linux", "cpu": "arm64" }, "sha512-BGUDMjC2Z3TTdZRkGGwhBLelkP5UYgO2rbep8aF4dS3fu7T5lFPPrnfS6EgqJgie+cF5Fsev7xEq8wWyBDM+lg=="],
|
||||
|
||||
"@typescript/native-preview-linux-x64": ["@typescript/[email protected]", "", { "os": "linux", "cpu": "x64" }, "sha512-vpazOu+ozlxBo8U57YJMzsOPuxAV8H7fu36KJ8ea8At/D8pdGmOAy5TuB+9OBQV9JDe0OXJMy2kmbhOpmkTAmA=="],
|
||||
|
||||
"@typescript/native-preview-win32-arm64": ["@typescript/[email protected]", "", { "os": "win32", "cpu": "arm64" }, "sha512-DBFnFE3V6AITkPO1K1VxXf3yEZKjU2FwtXlNwRqhzDu0rrL2SsJHOSrBDX+OacTxQFzZMxFcpiuhV8jHZALPEg=="],
|
||||
|
||||
"@typescript/native-preview-win32-x64": ["@typescript/[email protected]", "", { "os": "win32", "cpu": "x64" }, "sha512-1tBlErMvQgcMqqYwsx4tytupcjCJcOUXD3vBn1Wb/kAvus1FzWQAFE0fcKBvLfcqLQfTiiEwKKEtbLjGmakqqg=="],
|
||||
|
||||
"@ungap/structured-clone": ["@ungap/[email protected]", "", {}, "sha512-WmoN8qaIAo7WTYWbAZuG8PYEhn5fkz7dZrqTBZ7dtt//lL2Gwms1IcnQ5yHqjDfX8Ft5j4YzDM23f87zBfDe9g=="],
|
||||
|
||||
"@vercel/config": ["@vercel/[email protected]", "", { "dependencies": { "@vercel/routing-utils": "6.2.0", "pretty-cache-header": "^1.0.0", "zod": "^3.22.0" }, "bin": { "config": "dist/cli.js" } }, "sha512-Tf5k5y2F478oTiQcU5R8Ntix1UejE6NdduZnI7aa1XXxjCtifX1XdRS/D2uTjiQAwIL3pLa1LSAN80ABbba+TQ=="],
|
||||
@@ -1982,7 +1991,7 @@
|
||||
|
||||
"typesafe-path": ["[email protected]", "", {}, "sha512-OJabfkAg1WLZSqJAJ0Z6Sdt3utnbzr/jh+NAHoyWHJe8CMSy79Gm085094M9nvTPy22KzTVn5Zq5mbapCI/hPA=="],
|
||||
|
||||
"typescript": ["typescript@5.9.3", "", { "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" } }, "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw=="],
|
||||
"typescript": ["typescript@6.0.3", "", { "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" } }, "sha512-y2TvuxSZPDyQakkFRPZHKFm+KKVqIisdg9/CZwm9ftvKXLP8NRWj38/ODjNbr43SsoXqNuAisEf1GdCxqWcdBw=="],
|
||||
|
||||
"typescript-auto-import-cache": ["[email protected]", "", { "dependencies": { "semver": "^7.3.8" } }, "sha512-RpuHXrknHdVdK7wv/8ug3Fr0WNsNi5l5aB8MYYuXhq2UH5lnEB1htJ1smhtD5VeCsGr2p8mUDtd83LCQDFVgjQ=="],
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"typecheck": "tsc --noEmit",
|
||||
"typecheck": "tsgo --noEmit",
|
||||
"test": "vitest run"
|
||||
},
|
||||
"dependencies": {
|
||||
@@ -12,10 +12,8 @@
|
||||
"effect": "catalog:"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@effect/language-service": "catalog:",
|
||||
"@effect/vitest": "catalog:",
|
||||
"@types/bun": "catalog:",
|
||||
"typescript": "catalog:",
|
||||
"vitest": "catalog:"
|
||||
}
|
||||
}
|
||||
+6
-5
@@ -17,18 +17,19 @@
|
||||
"@effect/platform-node-shared": "4.0.0-beta.73",
|
||||
"@effect/sql-sqlite-bun": "4.0.0-beta.73",
|
||||
"@effect/vitest": "4.0.0-beta.73",
|
||||
"@effect/language-service": "0.84.2",
|
||||
"@effect/tsgo": "0.11.4",
|
||||
"@pierre/diffs": "1.1.20",
|
||||
"@types/bun": "^1.3.11",
|
||||
"@types/node": "^24.10.13",
|
||||
"@typescript/native-preview": "7.0.0-dev.20260527.2",
|
||||
"tsdown": "^0.20.3",
|
||||
"typescript": "^5.7.3",
|
||||
"typescript": "~6.0.3",
|
||||
"vitest": "^4.0.0"
|
||||
}
|
||||
},
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"prepare": "effect-language-service patch",
|
||||
"prepare": "effect-tsgo patch",
|
||||
"dev": "node scripts/dev-runner.ts dev",
|
||||
"dev:server": "node scripts/dev-runner.ts dev:server",
|
||||
"dev:web": "node scripts/dev-runner.ts dev:web",
|
||||
@@ -61,13 +62,13 @@
|
||||
"sync:vscode-icons": "node scripts/sync-vscode-icons.mjs"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@effect/language-service": "catalog:",
|
||||
"@effect/tsgo": "catalog:",
|
||||
"@oxlint/plugins": "^1.63.0",
|
||||
"@types/node": "catalog:",
|
||||
"@typescript/native-preview": "catalog:",
|
||||
"oxfmt": "^0.40.0",
|
||||
"oxlint": "^1.63.0",
|
||||
"turbo": "^2.3.3",
|
||||
"typescript": "catalog:",
|
||||
"vitest": "catalog:"
|
||||
},
|
||||
"overrides": {
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
}
|
||||
},
|
||||
"scripts": {
|
||||
"typecheck": "tsc --noEmit",
|
||||
"typecheck": "tsgo --noEmit",
|
||||
"test": "vitest run"
|
||||
},
|
||||
"dependencies": {
|
||||
@@ -18,8 +18,6 @@
|
||||
"effect": "catalog:"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@effect/language-service": "catalog:",
|
||||
"typescript": "catalog:",
|
||||
"vitest": "catalog:"
|
||||
}
|
||||
}
|
||||
@@ -17,16 +17,14 @@
|
||||
}
|
||||
},
|
||||
"scripts": {
|
||||
"typecheck": "tsc --noEmit",
|
||||
"typecheck": "tsgo --noEmit",
|
||||
"test": "vitest run"
|
||||
},
|
||||
"dependencies": {
|
||||
"effect": "catalog:"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@effect/language-service": "catalog:",
|
||||
"@effect/vitest": "catalog:",
|
||||
"typescript": "catalog:",
|
||||
"vitest": "catalog:"
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,4 @@
|
||||
import assert from "node:assert/strict";
|
||||
import { it } from "@effect/vitest";
|
||||
import { assert, it } from "@effect/vitest";
|
||||
import * as Effect from "effect/Effect";
|
||||
import * as Schema from "effect/Schema";
|
||||
|
||||
@@ -379,7 +378,9 @@ it.effect("decodes thread archived and unarchived events", () =>
|
||||
},
|
||||
});
|
||||
|
||||
assert.strictEqual(archived.type, "thread.archived");
|
||||
if (archived.type !== "thread.archived") {
|
||||
assert.fail(`Expected thread.archived event, received ${archived.type}.`);
|
||||
}
|
||||
assert.strictEqual(archived.payload.archivedAt, "2026-01-01T00:00:00.000Z");
|
||||
assert.strictEqual(unarchived.type, "thread.unarchived");
|
||||
}),
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
}
|
||||
},
|
||||
"scripts": {
|
||||
"typecheck": "tsc --noEmit",
|
||||
"typecheck": "tsgo --noEmit",
|
||||
"test": "vitest run",
|
||||
"generate": "bun run scripts/generate.ts"
|
||||
},
|
||||
@@ -41,11 +41,10 @@
|
||||
"effect": "catalog:"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@effect/language-service": "catalog:",
|
||||
"@effect/openapi-generator": "catalog:",
|
||||
"@effect/platform-node": "catalog:",
|
||||
"@effect/vitest": "catalog:",
|
||||
"typescript": "catalog:",
|
||||
"@types/node": "catalog:",
|
||||
"vitest": "catalog:"
|
||||
}
|
||||
}
|
||||
@@ -146,7 +146,7 @@ function collectSchemaEntries(
|
||||
return entries;
|
||||
}
|
||||
|
||||
function normalizeNullableTypes(value: typeof Schema.Json.Type): typeof Schema.Json.Type {
|
||||
function normalizeNullableTypes(value: Schema.Json): Schema.Json {
|
||||
if (Array.isArray(value)) {
|
||||
return value.map(normalizeNullableTypes);
|
||||
}
|
||||
@@ -158,10 +158,7 @@ function normalizeNullableTypes(value: typeof Schema.Json.Type): typeof Schema.J
|
||||
key,
|
||||
normalizeNullableTypes(child),
|
||||
]);
|
||||
const normalizedObject = Object.fromEntries(normalizedEntries) as Record<
|
||||
string,
|
||||
typeof Schema.Json.Type
|
||||
>;
|
||||
const normalizedObject = Object.fromEntries(normalizedEntries) as Record<string, Schema.Json>;
|
||||
const typeValue = normalizedObject.type;
|
||||
|
||||
if (!Array.isArray(typeValue)) {
|
||||
@@ -179,7 +176,7 @@ function normalizeNullableTypes(value: typeof Schema.Json.Type): typeof Schema.J
|
||||
}
|
||||
const nonNullType = nonNullTypes[0]!;
|
||||
|
||||
const nextObject: Record<string, typeof Schema.Json.Type> = {};
|
||||
const nextObject: Record<string, Schema.Json> = {};
|
||||
for (const [key, child] of Object.entries(normalizedObject)) {
|
||||
if (key !== "type") {
|
||||
nextObject[key] = child;
|
||||
|
||||
@@ -207,7 +207,9 @@ export interface AcpAgentShape {
|
||||
) => Effect.Effect<void>;
|
||||
}
|
||||
|
||||
export class AcpAgent extends Context.Service<AcpAgent, AcpAgentShape>()("effect-acp/AcpAgent") {}
|
||||
export class AcpAgent extends Context.Service<AcpAgent, AcpAgentShape>()(
|
||||
"effect-acp/agent/AcpAgent",
|
||||
) {}
|
||||
|
||||
interface AcpCoreAgentRequestHandlers {
|
||||
initialize?: (
|
||||
|
||||
@@ -263,7 +263,7 @@ export interface AcpClientShape {
|
||||
}
|
||||
|
||||
export class AcpClient extends Context.Service<AcpClient, AcpClientShape>()(
|
||||
"effect-acp/AcpClient",
|
||||
"effect-acp/client/AcpClient",
|
||||
) {}
|
||||
|
||||
interface AcpCoreRequestHandlers {
|
||||
|
||||
@@ -29,12 +29,12 @@ export type AcpIncomingNotification =
|
||||
| {
|
||||
readonly _tag: "SessionUpdate";
|
||||
readonly method: typeof CLIENT_METHODS.session_update;
|
||||
readonly params: typeof AcpSchema.SessionNotification.Type;
|
||||
readonly params: AcpSchema.SessionNotification;
|
||||
}
|
||||
| {
|
||||
readonly _tag: "ElicitationComplete";
|
||||
readonly method: typeof CLIENT_METHODS.session_elicitation_complete;
|
||||
readonly params: typeof AcpSchema.ElicitationCompleteNotification.Type;
|
||||
readonly params: AcpSchema.ElicitationCompleteNotification;
|
||||
}
|
||||
| {
|
||||
readonly _tag: "ExtNotification";
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
{
|
||||
"extends": "../../tsconfig.base.json",
|
||||
"compilerOptions": {},
|
||||
"compilerOptions": {
|
||||
"types": ["node"]
|
||||
},
|
||||
"include": ["src", "scripts", "test"]
|
||||
}
|
||||
@@ -25,7 +25,7 @@
|
||||
}
|
||||
},
|
||||
"scripts": {
|
||||
"typecheck": "tsc --noEmit",
|
||||
"typecheck": "tsgo --noEmit",
|
||||
"test": "vitest run",
|
||||
"generate": "bun run scripts/generate.ts",
|
||||
"probe": "bun run test/examples/codex-app-server-probe.ts"
|
||||
@@ -34,11 +34,10 @@
|
||||
"effect": "catalog:"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@effect/language-service": "catalog:",
|
||||
"@effect/openapi-generator": "catalog:",
|
||||
"@effect/platform-node": "catalog:",
|
||||
"@effect/vitest": "catalog:",
|
||||
"typescript": "catalog:",
|
||||
"@types/node": "catalog:",
|
||||
"vitest": "catalog:"
|
||||
}
|
||||
}
|
||||
@@ -70,7 +70,7 @@ class GeneratorError extends Schema.TaggedErrorClass<GeneratorError>()("Generato
|
||||
}
|
||||
}
|
||||
|
||||
const ManualSchemas: Record<string, typeof Schema.Json.Type> = {
|
||||
const ManualSchemas: Record<string, Schema.Json> = {
|
||||
GetAuthStatusParams: {
|
||||
type: "object",
|
||||
title: "GetAuthStatusParams",
|
||||
@@ -218,7 +218,7 @@ function collectSchemaEntries(
|
||||
return entries;
|
||||
}
|
||||
|
||||
function normalizeNullableTypes(value: typeof Schema.Json.Type): typeof Schema.Json.Type {
|
||||
function normalizeNullableTypes(value: Schema.Json): Schema.Json {
|
||||
if (Array.isArray(value)) {
|
||||
return value.map(normalizeNullableTypes);
|
||||
}
|
||||
@@ -230,10 +230,7 @@ function normalizeNullableTypes(value: typeof Schema.Json.Type): typeof Schema.J
|
||||
key,
|
||||
normalizeNullableTypes(child),
|
||||
]);
|
||||
const normalizedObject = Object.fromEntries(normalizedEntries) as Record<
|
||||
string,
|
||||
typeof Schema.Json.Type
|
||||
>;
|
||||
const normalizedObject = Object.fromEntries(normalizedEntries) as Record<string, Schema.Json>;
|
||||
const typeValue = normalizedObject.type;
|
||||
|
||||
if (!Array.isArray(typeValue)) {
|
||||
@@ -251,7 +248,7 @@ function normalizeNullableTypes(value: typeof Schema.Json.Type): typeof Schema.J
|
||||
}
|
||||
const nonNullType = nonNullTypes[0]!;
|
||||
|
||||
const nextObject: Record<string, typeof Schema.Json.Type> = {};
|
||||
const nextObject: Record<string, Schema.Json> = {};
|
||||
for (const [key, child] of Object.entries(normalizedObject)) {
|
||||
if (key !== "type") {
|
||||
nextObject[key] = child;
|
||||
@@ -269,7 +266,7 @@ function normalizeNullableTypes(value: typeof Schema.Json.Type): typeof Schema.J
|
||||
};
|
||||
}
|
||||
|
||||
function stripNullDefaults(value: typeof Schema.Json.Type): typeof Schema.Json.Type {
|
||||
function stripNullDefaults(value: Schema.Json): Schema.Json {
|
||||
if (Array.isArray(value)) {
|
||||
return value.map(stripNullDefaults);
|
||||
}
|
||||
@@ -281,7 +278,7 @@ function stripNullDefaults(value: typeof Schema.Json.Type): typeof Schema.Json.T
|
||||
Object.entries(value)
|
||||
.filter(([key, child]) => !(key === "default" && child === null))
|
||||
.map(([key, child]) => [key, stripNullDefaults(child)]),
|
||||
) as typeof Schema.Json.Type;
|
||||
) as Schema.Json;
|
||||
}
|
||||
|
||||
function toPascalCaseMethod(method: string) {
|
||||
@@ -417,7 +414,7 @@ function renderSchemaMap(
|
||||
}
|
||||
|
||||
function renderSchemaTypeReference(schemaName: string) {
|
||||
return schemaName === "undefined" ? "undefined" : `typeof CodexSchema.${schemaName}.Type`;
|
||||
return schemaName === "undefined" ? "undefined" : `CodexSchema.${schemaName}`;
|
||||
}
|
||||
|
||||
function exportNameForPath(filePath: string): string {
|
||||
@@ -468,11 +465,11 @@ function buildJsonSchemaFiles(
|
||||
}
|
||||
|
||||
function rewriteExternalRefs(
|
||||
value: typeof Schema.Json.Type,
|
||||
value: Schema.Json,
|
||||
localDefinitionNames: ReadonlyMap<string, string>,
|
||||
currentNamespace: string | undefined,
|
||||
exportNameByQualifiedName: ReadonlyMap<string, string>,
|
||||
): typeof Schema.Json.Type {
|
||||
): Schema.Json {
|
||||
if (Array.isArray(value)) {
|
||||
return value.map((entry) =>
|
||||
rewriteExternalRefs(entry, localDefinitionNames, currentNamespace, exportNameByQualifiedName),
|
||||
@@ -522,7 +519,7 @@ function rewriteExternalRefs(
|
||||
),
|
||||
];
|
||||
}),
|
||||
) as typeof Schema.Json.Type;
|
||||
) as Schema.Json;
|
||||
}
|
||||
|
||||
const generateFiles = Effect.fn("generateFiles")(function* () {
|
||||
@@ -543,7 +540,7 @@ const generateFiles = Effect.fn("generateFiles")(function* () {
|
||||
const exportNameByQualifiedName = new Map(
|
||||
jsonSchemaFiles.map((file) => [file.qualifiedName, file.exportName]),
|
||||
);
|
||||
const aggregateSchemas: Record<string, typeof Schema.Json.Type> = {};
|
||||
const aggregateSchemas: Record<string, Schema.Json> = {};
|
||||
|
||||
for (const file of jsonSchemaFiles) {
|
||||
const raw = yield* fetchText(file.downloadUrl);
|
||||
@@ -568,7 +565,7 @@ const generateFiles = Effect.fn("generateFiles")(function* () {
|
||||
);
|
||||
}
|
||||
|
||||
const topLevelSchema: Record<string, typeof Schema.Json.Type> = {};
|
||||
const topLevelSchema: Record<string, Schema.Json> = {};
|
||||
for (const [key, value] of Object.entries(parsed)) {
|
||||
if (key !== "definitions") {
|
||||
topLevelSchema[key] = value;
|
||||
|
||||
@@ -173,165 +173,165 @@ export type ServerRequestMethod = keyof typeof SERVER_REQUEST_METHODS;
|
||||
export type ServerNotificationMethod = keyof typeof SERVER_NOTIFICATION_METHODS;
|
||||
|
||||
export interface ClientRequestParamsByMethod {
|
||||
readonly initialize: typeof CodexSchema.V1InitializeParams.Type;
|
||||
readonly "thread/start": typeof CodexSchema.V2ThreadStartParams.Type;
|
||||
readonly "thread/resume": typeof CodexSchema.V2ThreadResumeParams.Type;
|
||||
readonly "thread/fork": typeof CodexSchema.V2ThreadForkParams.Type;
|
||||
readonly "thread/archive": typeof CodexSchema.V2ThreadArchiveParams.Type;
|
||||
readonly "thread/unsubscribe": typeof CodexSchema.V2ThreadUnsubscribeParams.Type;
|
||||
readonly "thread/name/set": typeof CodexSchema.V2ThreadSetNameParams.Type;
|
||||
readonly "thread/metadata/update": typeof CodexSchema.V2ThreadMetadataUpdateParams.Type;
|
||||
readonly "thread/unarchive": typeof CodexSchema.V2ThreadUnarchiveParams.Type;
|
||||
readonly "thread/compact/start": typeof CodexSchema.V2ThreadCompactStartParams.Type;
|
||||
readonly "thread/shellCommand": typeof CodexSchema.V2ThreadShellCommandParams.Type;
|
||||
readonly "thread/approveGuardianDeniedAction": typeof CodexSchema.V2ThreadApproveGuardianDeniedActionParams.Type;
|
||||
readonly "thread/rollback": typeof CodexSchema.V2ThreadRollbackParams.Type;
|
||||
readonly "thread/list": typeof CodexSchema.V2ThreadListParams.Type;
|
||||
readonly "thread/loaded/list": typeof CodexSchema.V2ThreadLoadedListParams.Type;
|
||||
readonly "thread/read": typeof CodexSchema.V2ThreadReadParams.Type;
|
||||
readonly "thread/inject_items": typeof CodexSchema.V2ThreadInjectItemsParams.Type;
|
||||
readonly "skills/list": typeof CodexSchema.V2SkillsListParams.Type;
|
||||
readonly "hooks/list": typeof CodexSchema.V2HooksListParams.Type;
|
||||
readonly "marketplace/add": typeof CodexSchema.V2MarketplaceAddParams.Type;
|
||||
readonly "marketplace/remove": typeof CodexSchema.V2MarketplaceRemoveParams.Type;
|
||||
readonly "marketplace/upgrade": typeof CodexSchema.V2MarketplaceUpgradeParams.Type;
|
||||
readonly "plugin/list": typeof CodexSchema.V2PluginListParams.Type;
|
||||
readonly "plugin/read": typeof CodexSchema.V2PluginReadParams.Type;
|
||||
readonly "plugin/skill/read": typeof CodexSchema.V2PluginSkillReadParams.Type;
|
||||
readonly "plugin/share/save": typeof CodexSchema.V2PluginShareSaveParams.Type;
|
||||
readonly "plugin/share/updateTargets": typeof CodexSchema.V2PluginShareUpdateTargetsParams.Type;
|
||||
readonly "plugin/share/list": typeof CodexSchema.V2PluginShareListParams.Type;
|
||||
readonly "plugin/share/delete": typeof CodexSchema.V2PluginShareDeleteParams.Type;
|
||||
readonly "app/list": typeof CodexSchema.V2AppsListParams.Type;
|
||||
readonly "fs/readFile": typeof CodexSchema.V2FsReadFileParams.Type;
|
||||
readonly "fs/writeFile": typeof CodexSchema.V2FsWriteFileParams.Type;
|
||||
readonly "fs/createDirectory": typeof CodexSchema.V2FsCreateDirectoryParams.Type;
|
||||
readonly "fs/getMetadata": typeof CodexSchema.V2FsGetMetadataParams.Type;
|
||||
readonly "fs/readDirectory": typeof CodexSchema.V2FsReadDirectoryParams.Type;
|
||||
readonly "fs/remove": typeof CodexSchema.V2FsRemoveParams.Type;
|
||||
readonly "fs/copy": typeof CodexSchema.V2FsCopyParams.Type;
|
||||
readonly "fs/watch": typeof CodexSchema.V2FsWatchParams.Type;
|
||||
readonly "fs/unwatch": typeof CodexSchema.V2FsUnwatchParams.Type;
|
||||
readonly "skills/config/write": typeof CodexSchema.V2SkillsConfigWriteParams.Type;
|
||||
readonly "plugin/install": typeof CodexSchema.V2PluginInstallParams.Type;
|
||||
readonly "plugin/uninstall": typeof CodexSchema.V2PluginUninstallParams.Type;
|
||||
readonly "turn/start": typeof CodexSchema.V2TurnStartParams.Type;
|
||||
readonly "turn/steer": typeof CodexSchema.V2TurnSteerParams.Type;
|
||||
readonly "turn/interrupt": typeof CodexSchema.V2TurnInterruptParams.Type;
|
||||
readonly "review/start": typeof CodexSchema.V2ReviewStartParams.Type;
|
||||
readonly "model/list": typeof CodexSchema.V2ModelListParams.Type;
|
||||
readonly "modelProvider/capabilities/read": typeof CodexSchema.V2ModelProviderCapabilitiesReadParams.Type;
|
||||
readonly "experimentalFeature/list": typeof CodexSchema.V2ExperimentalFeatureListParams.Type;
|
||||
readonly "experimentalFeature/enablement/set": typeof CodexSchema.V2ExperimentalFeatureEnablementSetParams.Type;
|
||||
readonly "mcpServer/oauth/login": typeof CodexSchema.V2McpServerOauthLoginParams.Type;
|
||||
readonly initialize: CodexSchema.V1InitializeParams;
|
||||
readonly "thread/start": CodexSchema.V2ThreadStartParams;
|
||||
readonly "thread/resume": CodexSchema.V2ThreadResumeParams;
|
||||
readonly "thread/fork": CodexSchema.V2ThreadForkParams;
|
||||
readonly "thread/archive": CodexSchema.V2ThreadArchiveParams;
|
||||
readonly "thread/unsubscribe": CodexSchema.V2ThreadUnsubscribeParams;
|
||||
readonly "thread/name/set": CodexSchema.V2ThreadSetNameParams;
|
||||
readonly "thread/metadata/update": CodexSchema.V2ThreadMetadataUpdateParams;
|
||||
readonly "thread/unarchive": CodexSchema.V2ThreadUnarchiveParams;
|
||||
readonly "thread/compact/start": CodexSchema.V2ThreadCompactStartParams;
|
||||
readonly "thread/shellCommand": CodexSchema.V2ThreadShellCommandParams;
|
||||
readonly "thread/approveGuardianDeniedAction": CodexSchema.V2ThreadApproveGuardianDeniedActionParams;
|
||||
readonly "thread/rollback": CodexSchema.V2ThreadRollbackParams;
|
||||
readonly "thread/list": CodexSchema.V2ThreadListParams;
|
||||
readonly "thread/loaded/list": CodexSchema.V2ThreadLoadedListParams;
|
||||
readonly "thread/read": CodexSchema.V2ThreadReadParams;
|
||||
readonly "thread/inject_items": CodexSchema.V2ThreadInjectItemsParams;
|
||||
readonly "skills/list": CodexSchema.V2SkillsListParams;
|
||||
readonly "hooks/list": CodexSchema.V2HooksListParams;
|
||||
readonly "marketplace/add": CodexSchema.V2MarketplaceAddParams;
|
||||
readonly "marketplace/remove": CodexSchema.V2MarketplaceRemoveParams;
|
||||
readonly "marketplace/upgrade": CodexSchema.V2MarketplaceUpgradeParams;
|
||||
readonly "plugin/list": CodexSchema.V2PluginListParams;
|
||||
readonly "plugin/read": CodexSchema.V2PluginReadParams;
|
||||
readonly "plugin/skill/read": CodexSchema.V2PluginSkillReadParams;
|
||||
readonly "plugin/share/save": CodexSchema.V2PluginShareSaveParams;
|
||||
readonly "plugin/share/updateTargets": CodexSchema.V2PluginShareUpdateTargetsParams;
|
||||
readonly "plugin/share/list": CodexSchema.V2PluginShareListParams;
|
||||
readonly "plugin/share/delete": CodexSchema.V2PluginShareDeleteParams;
|
||||
readonly "app/list": CodexSchema.V2AppsListParams;
|
||||
readonly "fs/readFile": CodexSchema.V2FsReadFileParams;
|
||||
readonly "fs/writeFile": CodexSchema.V2FsWriteFileParams;
|
||||
readonly "fs/createDirectory": CodexSchema.V2FsCreateDirectoryParams;
|
||||
readonly "fs/getMetadata": CodexSchema.V2FsGetMetadataParams;
|
||||
readonly "fs/readDirectory": CodexSchema.V2FsReadDirectoryParams;
|
||||
readonly "fs/remove": CodexSchema.V2FsRemoveParams;
|
||||
readonly "fs/copy": CodexSchema.V2FsCopyParams;
|
||||
readonly "fs/watch": CodexSchema.V2FsWatchParams;
|
||||
readonly "fs/unwatch": CodexSchema.V2FsUnwatchParams;
|
||||
readonly "skills/config/write": CodexSchema.V2SkillsConfigWriteParams;
|
||||
readonly "plugin/install": CodexSchema.V2PluginInstallParams;
|
||||
readonly "plugin/uninstall": CodexSchema.V2PluginUninstallParams;
|
||||
readonly "turn/start": CodexSchema.V2TurnStartParams;
|
||||
readonly "turn/steer": CodexSchema.V2TurnSteerParams;
|
||||
readonly "turn/interrupt": CodexSchema.V2TurnInterruptParams;
|
||||
readonly "review/start": CodexSchema.V2ReviewStartParams;
|
||||
readonly "model/list": CodexSchema.V2ModelListParams;
|
||||
readonly "modelProvider/capabilities/read": CodexSchema.V2ModelProviderCapabilitiesReadParams;
|
||||
readonly "experimentalFeature/list": CodexSchema.V2ExperimentalFeatureListParams;
|
||||
readonly "experimentalFeature/enablement/set": CodexSchema.V2ExperimentalFeatureEnablementSetParams;
|
||||
readonly "mcpServer/oauth/login": CodexSchema.V2McpServerOauthLoginParams;
|
||||
readonly "config/mcpServer/reload": undefined;
|
||||
readonly "mcpServerStatus/list": typeof CodexSchema.V2ListMcpServerStatusParams.Type;
|
||||
readonly "mcpServer/resource/read": typeof CodexSchema.V2McpResourceReadParams.Type;
|
||||
readonly "mcpServer/tool/call": typeof CodexSchema.V2McpServerToolCallParams.Type;
|
||||
readonly "windowsSandbox/setupStart": typeof CodexSchema.V2WindowsSandboxSetupStartParams.Type;
|
||||
readonly "mcpServerStatus/list": CodexSchema.V2ListMcpServerStatusParams;
|
||||
readonly "mcpServer/resource/read": CodexSchema.V2McpResourceReadParams;
|
||||
readonly "mcpServer/tool/call": CodexSchema.V2McpServerToolCallParams;
|
||||
readonly "windowsSandbox/setupStart": CodexSchema.V2WindowsSandboxSetupStartParams;
|
||||
readonly "windowsSandbox/readiness": undefined;
|
||||
readonly "account/login/start": typeof CodexSchema.V2LoginAccountParams.Type;
|
||||
readonly "account/login/cancel": typeof CodexSchema.V2CancelLoginAccountParams.Type;
|
||||
readonly "account/login/start": CodexSchema.V2LoginAccountParams;
|
||||
readonly "account/login/cancel": CodexSchema.V2CancelLoginAccountParams;
|
||||
readonly "account/logout": undefined;
|
||||
readonly "account/rateLimits/read": undefined;
|
||||
readonly "account/sendAddCreditsNudgeEmail": typeof CodexSchema.V2SendAddCreditsNudgeEmailParams.Type;
|
||||
readonly "feedback/upload": typeof CodexSchema.V2FeedbackUploadParams.Type;
|
||||
readonly "command/exec": typeof CodexSchema.V2CommandExecParams.Type;
|
||||
readonly "command/exec/write": typeof CodexSchema.V2CommandExecWriteParams.Type;
|
||||
readonly "command/exec/terminate": typeof CodexSchema.V2CommandExecTerminateParams.Type;
|
||||
readonly "command/exec/resize": typeof CodexSchema.V2CommandExecResizeParams.Type;
|
||||
readonly "config/read": typeof CodexSchema.V2ConfigReadParams.Type;
|
||||
readonly "externalAgentConfig/detect": typeof CodexSchema.V2ExternalAgentConfigDetectParams.Type;
|
||||
readonly "externalAgentConfig/import": typeof CodexSchema.V2ExternalAgentConfigImportParams.Type;
|
||||
readonly "config/value/write": typeof CodexSchema.V2ConfigValueWriteParams.Type;
|
||||
readonly "config/batchWrite": typeof CodexSchema.V2ConfigBatchWriteParams.Type;
|
||||
readonly "account/sendAddCreditsNudgeEmail": CodexSchema.V2SendAddCreditsNudgeEmailParams;
|
||||
readonly "feedback/upload": CodexSchema.V2FeedbackUploadParams;
|
||||
readonly "command/exec": CodexSchema.V2CommandExecParams;
|
||||
readonly "command/exec/write": CodexSchema.V2CommandExecWriteParams;
|
||||
readonly "command/exec/terminate": CodexSchema.V2CommandExecTerminateParams;
|
||||
readonly "command/exec/resize": CodexSchema.V2CommandExecResizeParams;
|
||||
readonly "config/read": CodexSchema.V2ConfigReadParams;
|
||||
readonly "externalAgentConfig/detect": CodexSchema.V2ExternalAgentConfigDetectParams;
|
||||
readonly "externalAgentConfig/import": CodexSchema.V2ExternalAgentConfigImportParams;
|
||||
readonly "config/value/write": CodexSchema.V2ConfigValueWriteParams;
|
||||
readonly "config/batchWrite": CodexSchema.V2ConfigBatchWriteParams;
|
||||
readonly "configRequirements/read": undefined;
|
||||
readonly "account/read": typeof CodexSchema.V2GetAccountParams.Type;
|
||||
readonly getConversationSummary: typeof CodexSchema.GetConversationSummaryParams.Type;
|
||||
readonly gitDiffToRemote: typeof CodexSchema.GitDiffToRemoteParams.Type;
|
||||
readonly getAuthStatus: typeof CodexSchema.GetAuthStatusParams.Type;
|
||||
readonly fuzzyFileSearch: typeof CodexSchema.FuzzyFileSearchParams.Type;
|
||||
readonly "account/read": CodexSchema.V2GetAccountParams;
|
||||
readonly getConversationSummary: CodexSchema.GetConversationSummaryParams;
|
||||
readonly gitDiffToRemote: CodexSchema.GitDiffToRemoteParams;
|
||||
readonly getAuthStatus: CodexSchema.GetAuthStatusParams;
|
||||
readonly fuzzyFileSearch: CodexSchema.FuzzyFileSearchParams;
|
||||
}
|
||||
|
||||
export interface ClientRequestResponsesByMethod {
|
||||
readonly initialize: typeof CodexSchema.V1InitializeResponse.Type;
|
||||
readonly "thread/start": typeof CodexSchema.V2ThreadStartResponse.Type;
|
||||
readonly "thread/resume": typeof CodexSchema.V2ThreadResumeResponse.Type;
|
||||
readonly "thread/fork": typeof CodexSchema.V2ThreadForkResponse.Type;
|
||||
readonly "thread/archive": typeof CodexSchema.V2ThreadArchiveResponse.Type;
|
||||
readonly "thread/unsubscribe": typeof CodexSchema.V2ThreadUnsubscribeResponse.Type;
|
||||
readonly "thread/name/set": typeof CodexSchema.V2ThreadSetNameResponse.Type;
|
||||
readonly "thread/metadata/update": typeof CodexSchema.V2ThreadMetadataUpdateResponse.Type;
|
||||
readonly "thread/unarchive": typeof CodexSchema.V2ThreadUnarchiveResponse.Type;
|
||||
readonly "thread/compact/start": typeof CodexSchema.V2ThreadCompactStartResponse.Type;
|
||||
readonly "thread/shellCommand": typeof CodexSchema.V2ThreadShellCommandResponse.Type;
|
||||
readonly "thread/approveGuardianDeniedAction": typeof CodexSchema.V2ThreadApproveGuardianDeniedActionResponse.Type;
|
||||
readonly "thread/rollback": typeof CodexSchema.V2ThreadRollbackResponse.Type;
|
||||
readonly "thread/list": typeof CodexSchema.V2ThreadListResponse.Type;
|
||||
readonly "thread/loaded/list": typeof CodexSchema.V2ThreadLoadedListResponse.Type;
|
||||
readonly "thread/read": typeof CodexSchema.V2ThreadReadResponse.Type;
|
||||
readonly "thread/inject_items": typeof CodexSchema.V2ThreadInjectItemsResponse.Type;
|
||||
readonly "skills/list": typeof CodexSchema.V2SkillsListResponse.Type;
|
||||
readonly "hooks/list": typeof CodexSchema.V2HooksListResponse.Type;
|
||||
readonly "marketplace/add": typeof CodexSchema.V2MarketplaceAddResponse.Type;
|
||||
readonly "marketplace/remove": typeof CodexSchema.V2MarketplaceRemoveResponse.Type;
|
||||
readonly "marketplace/upgrade": typeof CodexSchema.V2MarketplaceUpgradeResponse.Type;
|
||||
readonly "plugin/list": typeof CodexSchema.V2PluginListResponse.Type;
|
||||
readonly "plugin/read": typeof CodexSchema.V2PluginReadResponse.Type;
|
||||
readonly "plugin/skill/read": typeof CodexSchema.V2PluginSkillReadResponse.Type;
|
||||
readonly "plugin/share/save": typeof CodexSchema.V2PluginShareSaveResponse.Type;
|
||||
readonly "plugin/share/updateTargets": typeof CodexSchema.V2PluginShareUpdateTargetsResponse.Type;
|
||||
readonly "plugin/share/list": typeof CodexSchema.V2PluginShareListResponse.Type;
|
||||
readonly "plugin/share/delete": typeof CodexSchema.V2PluginShareDeleteResponse.Type;
|
||||
readonly "app/list": typeof CodexSchema.V2AppsListResponse.Type;
|
||||
readonly "fs/readFile": typeof CodexSchema.V2FsReadFileResponse.Type;
|
||||
readonly "fs/writeFile": typeof CodexSchema.V2FsWriteFileResponse.Type;
|
||||
readonly "fs/createDirectory": typeof CodexSchema.V2FsCreateDirectoryResponse.Type;
|
||||
readonly "fs/getMetadata": typeof CodexSchema.V2FsGetMetadataResponse.Type;
|
||||
readonly "fs/readDirectory": typeof CodexSchema.V2FsReadDirectoryResponse.Type;
|
||||
readonly "fs/remove": typeof CodexSchema.V2FsRemoveResponse.Type;
|
||||
readonly "fs/copy": typeof CodexSchema.V2FsCopyResponse.Type;
|
||||
readonly "fs/watch": typeof CodexSchema.V2FsWatchResponse.Type;
|
||||
readonly "fs/unwatch": typeof CodexSchema.V2FsUnwatchResponse.Type;
|
||||
readonly "skills/config/write": typeof CodexSchema.V2SkillsConfigWriteResponse.Type;
|
||||
readonly "plugin/install": typeof CodexSchema.V2PluginInstallResponse.Type;
|
||||
readonly "plugin/uninstall": typeof CodexSchema.V2PluginUninstallResponse.Type;
|
||||
readonly "turn/start": typeof CodexSchema.V2TurnStartResponse.Type;
|
||||
readonly "turn/steer": typeof CodexSchema.V2TurnSteerResponse.Type;
|
||||
readonly "turn/interrupt": typeof CodexSchema.V2TurnInterruptResponse.Type;
|
||||
readonly "review/start": typeof CodexSchema.V2ReviewStartResponse.Type;
|
||||
readonly "model/list": typeof CodexSchema.V2ModelListResponse.Type;
|
||||
readonly "modelProvider/capabilities/read": typeof CodexSchema.V2ModelProviderCapabilitiesReadResponse.Type;
|
||||
readonly "experimentalFeature/list": typeof CodexSchema.V2ExperimentalFeatureListResponse.Type;
|
||||
readonly "experimentalFeature/enablement/set": typeof CodexSchema.V2ExperimentalFeatureEnablementSetResponse.Type;
|
||||
readonly "mcpServer/oauth/login": typeof CodexSchema.V2McpServerOauthLoginResponse.Type;
|
||||
readonly "config/mcpServer/reload": typeof CodexSchema.V2McpServerRefreshResponse.Type;
|
||||
readonly "mcpServerStatus/list": typeof CodexSchema.V2ListMcpServerStatusResponse.Type;
|
||||
readonly "mcpServer/resource/read": typeof CodexSchema.V2McpResourceReadResponse.Type;
|
||||
readonly "mcpServer/tool/call": typeof CodexSchema.V2McpServerToolCallResponse.Type;
|
||||
readonly "windowsSandbox/setupStart": typeof CodexSchema.V2WindowsSandboxSetupStartResponse.Type;
|
||||
readonly "windowsSandbox/readiness": typeof CodexSchema.V2WindowsSandboxReadinessResponse.Type;
|
||||
readonly "account/login/start": typeof CodexSchema.V2LoginAccountResponse.Type;
|
||||
readonly "account/login/cancel": typeof CodexSchema.V2CancelLoginAccountResponse.Type;
|
||||
readonly "account/logout": typeof CodexSchema.V2LogoutAccountResponse.Type;
|
||||
readonly "account/rateLimits/read": typeof CodexSchema.V2GetAccountRateLimitsResponse.Type;
|
||||
readonly "account/sendAddCreditsNudgeEmail": typeof CodexSchema.V2SendAddCreditsNudgeEmailResponse.Type;
|
||||
readonly "feedback/upload": typeof CodexSchema.V2FeedbackUploadResponse.Type;
|
||||
readonly "command/exec": typeof CodexSchema.V2CommandExecResponse.Type;
|
||||
readonly "command/exec/write": typeof CodexSchema.V2CommandExecWriteResponse.Type;
|
||||
readonly "command/exec/terminate": typeof CodexSchema.V2CommandExecTerminateResponse.Type;
|
||||
readonly "command/exec/resize": typeof CodexSchema.V2CommandExecResizeResponse.Type;
|
||||
readonly "config/read": typeof CodexSchema.V2ConfigReadResponse.Type;
|
||||
readonly "externalAgentConfig/detect": typeof CodexSchema.V2ExternalAgentConfigDetectResponse.Type;
|
||||
readonly "externalAgentConfig/import": typeof CodexSchema.V2ExternalAgentConfigImportResponse.Type;
|
||||
readonly "config/value/write": typeof CodexSchema.V2ConfigWriteResponse.Type;
|
||||
readonly "config/batchWrite": typeof CodexSchema.V2ConfigWriteResponse.Type;
|
||||
readonly "configRequirements/read": typeof CodexSchema.V2ConfigRequirementsReadResponse.Type;
|
||||
readonly "account/read": typeof CodexSchema.V2GetAccountResponse.Type;
|
||||
readonly getConversationSummary: typeof CodexSchema.GetConversationSummaryResponse.Type;
|
||||
readonly gitDiffToRemote: typeof CodexSchema.GitDiffToRemoteResponse.Type;
|
||||
readonly getAuthStatus: typeof CodexSchema.GetAuthStatusResponse.Type;
|
||||
readonly fuzzyFileSearch: typeof CodexSchema.FuzzyFileSearchResponse.Type;
|
||||
readonly initialize: CodexSchema.V1InitializeResponse;
|
||||
readonly "thread/start": CodexSchema.V2ThreadStartResponse;
|
||||
readonly "thread/resume": CodexSchema.V2ThreadResumeResponse;
|
||||
readonly "thread/fork": CodexSchema.V2ThreadForkResponse;
|
||||
readonly "thread/archive": CodexSchema.V2ThreadArchiveResponse;
|
||||
readonly "thread/unsubscribe": CodexSchema.V2ThreadUnsubscribeResponse;
|
||||
readonly "thread/name/set": CodexSchema.V2ThreadSetNameResponse;
|
||||
readonly "thread/metadata/update": CodexSchema.V2ThreadMetadataUpdateResponse;
|
||||
readonly "thread/unarchive": CodexSchema.V2ThreadUnarchiveResponse;
|
||||
readonly "thread/compact/start": CodexSchema.V2ThreadCompactStartResponse;
|
||||
readonly "thread/shellCommand": CodexSchema.V2ThreadShellCommandResponse;
|
||||
readonly "thread/approveGuardianDeniedAction": CodexSchema.V2ThreadApproveGuardianDeniedActionResponse;
|
||||
readonly "thread/rollback": CodexSchema.V2ThreadRollbackResponse;
|
||||
readonly "thread/list": CodexSchema.V2ThreadListResponse;
|
||||
readonly "thread/loaded/list": CodexSchema.V2ThreadLoadedListResponse;
|
||||
readonly "thread/read": CodexSchema.V2ThreadReadResponse;
|
||||
readonly "thread/inject_items": CodexSchema.V2ThreadInjectItemsResponse;
|
||||
readonly "skills/list": CodexSchema.V2SkillsListResponse;
|
||||
readonly "hooks/list": CodexSchema.V2HooksListResponse;
|
||||
readonly "marketplace/add": CodexSchema.V2MarketplaceAddResponse;
|
||||
readonly "marketplace/remove": CodexSchema.V2MarketplaceRemoveResponse;
|
||||
readonly "marketplace/upgrade": CodexSchema.V2MarketplaceUpgradeResponse;
|
||||
readonly "plugin/list": CodexSchema.V2PluginListResponse;
|
||||
readonly "plugin/read": CodexSchema.V2PluginReadResponse;
|
||||
readonly "plugin/skill/read": CodexSchema.V2PluginSkillReadResponse;
|
||||
readonly "plugin/share/save": CodexSchema.V2PluginShareSaveResponse;
|
||||
readonly "plugin/share/updateTargets": CodexSchema.V2PluginShareUpdateTargetsResponse;
|
||||
readonly "plugin/share/list": CodexSchema.V2PluginShareListResponse;
|
||||
readonly "plugin/share/delete": CodexSchema.V2PluginShareDeleteResponse;
|
||||
readonly "app/list": CodexSchema.V2AppsListResponse;
|
||||
readonly "fs/readFile": CodexSchema.V2FsReadFileResponse;
|
||||
readonly "fs/writeFile": CodexSchema.V2FsWriteFileResponse;
|
||||
readonly "fs/createDirectory": CodexSchema.V2FsCreateDirectoryResponse;
|
||||
readonly "fs/getMetadata": CodexSchema.V2FsGetMetadataResponse;
|
||||
readonly "fs/readDirectory": CodexSchema.V2FsReadDirectoryResponse;
|
||||
readonly "fs/remove": CodexSchema.V2FsRemoveResponse;
|
||||
readonly "fs/copy": CodexSchema.V2FsCopyResponse;
|
||||
readonly "fs/watch": CodexSchema.V2FsWatchResponse;
|
||||
readonly "fs/unwatch": CodexSchema.V2FsUnwatchResponse;
|
||||
readonly "skills/config/write": CodexSchema.V2SkillsConfigWriteResponse;
|
||||
readonly "plugin/install": CodexSchema.V2PluginInstallResponse;
|
||||
readonly "plugin/uninstall": CodexSchema.V2PluginUninstallResponse;
|
||||
readonly "turn/start": CodexSchema.V2TurnStartResponse;
|
||||
readonly "turn/steer": CodexSchema.V2TurnSteerResponse;
|
||||
readonly "turn/interrupt": CodexSchema.V2TurnInterruptResponse;
|
||||
readonly "review/start": CodexSchema.V2ReviewStartResponse;
|
||||
readonly "model/list": CodexSchema.V2ModelListResponse;
|
||||
readonly "modelProvider/capabilities/read": CodexSchema.V2ModelProviderCapabilitiesReadResponse;
|
||||
readonly "experimentalFeature/list": CodexSchema.V2ExperimentalFeatureListResponse;
|
||||
readonly "experimentalFeature/enablement/set": CodexSchema.V2ExperimentalFeatureEnablementSetResponse;
|
||||
readonly "mcpServer/oauth/login": CodexSchema.V2McpServerOauthLoginResponse;
|
||||
readonly "config/mcpServer/reload": CodexSchema.V2McpServerRefreshResponse;
|
||||
readonly "mcpServerStatus/list": CodexSchema.V2ListMcpServerStatusResponse;
|
||||
readonly "mcpServer/resource/read": CodexSchema.V2McpResourceReadResponse;
|
||||
readonly "mcpServer/tool/call": CodexSchema.V2McpServerToolCallResponse;
|
||||
readonly "windowsSandbox/setupStart": CodexSchema.V2WindowsSandboxSetupStartResponse;
|
||||
readonly "windowsSandbox/readiness": CodexSchema.V2WindowsSandboxReadinessResponse;
|
||||
readonly "account/login/start": CodexSchema.V2LoginAccountResponse;
|
||||
readonly "account/login/cancel": CodexSchema.V2CancelLoginAccountResponse;
|
||||
readonly "account/logout": CodexSchema.V2LogoutAccountResponse;
|
||||
readonly "account/rateLimits/read": CodexSchema.V2GetAccountRateLimitsResponse;
|
||||
readonly "account/sendAddCreditsNudgeEmail": CodexSchema.V2SendAddCreditsNudgeEmailResponse;
|
||||
readonly "feedback/upload": CodexSchema.V2FeedbackUploadResponse;
|
||||
readonly "command/exec": CodexSchema.V2CommandExecResponse;
|
||||
readonly "command/exec/write": CodexSchema.V2CommandExecWriteResponse;
|
||||
readonly "command/exec/terminate": CodexSchema.V2CommandExecTerminateResponse;
|
||||
readonly "command/exec/resize": CodexSchema.V2CommandExecResizeResponse;
|
||||
readonly "config/read": CodexSchema.V2ConfigReadResponse;
|
||||
readonly "externalAgentConfig/detect": CodexSchema.V2ExternalAgentConfigDetectResponse;
|
||||
readonly "externalAgentConfig/import": CodexSchema.V2ExternalAgentConfigImportResponse;
|
||||
readonly "config/value/write": CodexSchema.V2ConfigWriteResponse;
|
||||
readonly "config/batchWrite": CodexSchema.V2ConfigWriteResponse;
|
||||
readonly "configRequirements/read": CodexSchema.V2ConfigRequirementsReadResponse;
|
||||
readonly "account/read": CodexSchema.V2GetAccountResponse;
|
||||
readonly getConversationSummary: CodexSchema.GetConversationSummaryResponse;
|
||||
readonly gitDiffToRemote: CodexSchema.GitDiffToRemoteResponse;
|
||||
readonly getAuthStatus: CodexSchema.GetAuthStatusResponse;
|
||||
readonly fuzzyFileSearch: CodexSchema.FuzzyFileSearchResponse;
|
||||
}
|
||||
|
||||
export interface ClientNotificationParamsByMethod {
|
||||
@@ -339,94 +339,94 @@ export interface ClientNotificationParamsByMethod {
|
||||
}
|
||||
|
||||
export interface ServerRequestParamsByMethod {
|
||||
readonly "item/commandExecution/requestApproval": typeof CodexSchema.CommandExecutionRequestApprovalParams.Type;
|
||||
readonly "item/fileChange/requestApproval": typeof CodexSchema.FileChangeRequestApprovalParams.Type;
|
||||
readonly "item/tool/requestUserInput": typeof CodexSchema.ToolRequestUserInputParams.Type;
|
||||
readonly "mcpServer/elicitation/request": typeof CodexSchema.McpServerElicitationRequestParams.Type;
|
||||
readonly "item/permissions/requestApproval": typeof CodexSchema.PermissionsRequestApprovalParams.Type;
|
||||
readonly "item/tool/call": typeof CodexSchema.DynamicToolCallParams.Type;
|
||||
readonly "account/chatgptAuthTokens/refresh": typeof CodexSchema.ChatgptAuthTokensRefreshParams.Type;
|
||||
readonly applyPatchApproval: typeof CodexSchema.ApplyPatchApprovalParams.Type;
|
||||
readonly execCommandApproval: typeof CodexSchema.ExecCommandApprovalParams.Type;
|
||||
readonly "item/commandExecution/requestApproval": CodexSchema.CommandExecutionRequestApprovalParams;
|
||||
readonly "item/fileChange/requestApproval": CodexSchema.FileChangeRequestApprovalParams;
|
||||
readonly "item/tool/requestUserInput": CodexSchema.ToolRequestUserInputParams;
|
||||
readonly "mcpServer/elicitation/request": CodexSchema.McpServerElicitationRequestParams;
|
||||
readonly "item/permissions/requestApproval": CodexSchema.PermissionsRequestApprovalParams;
|
||||
readonly "item/tool/call": CodexSchema.DynamicToolCallParams;
|
||||
readonly "account/chatgptAuthTokens/refresh": CodexSchema.ChatgptAuthTokensRefreshParams;
|
||||
readonly applyPatchApproval: CodexSchema.ApplyPatchApprovalParams;
|
||||
readonly execCommandApproval: CodexSchema.ExecCommandApprovalParams;
|
||||
}
|
||||
|
||||
export interface ServerRequestResponsesByMethod {
|
||||
readonly "item/commandExecution/requestApproval": typeof CodexSchema.CommandExecutionRequestApprovalResponse.Type;
|
||||
readonly "item/fileChange/requestApproval": typeof CodexSchema.FileChangeRequestApprovalResponse.Type;
|
||||
readonly "item/tool/requestUserInput": typeof CodexSchema.ToolRequestUserInputResponse.Type;
|
||||
readonly "mcpServer/elicitation/request": typeof CodexSchema.McpServerElicitationRequestResponse.Type;
|
||||
readonly "item/permissions/requestApproval": typeof CodexSchema.PermissionsRequestApprovalResponse.Type;
|
||||
readonly "item/tool/call": typeof CodexSchema.DynamicToolCallResponse.Type;
|
||||
readonly "account/chatgptAuthTokens/refresh": typeof CodexSchema.ChatgptAuthTokensRefreshResponse.Type;
|
||||
readonly applyPatchApproval: typeof CodexSchema.ApplyPatchApprovalResponse.Type;
|
||||
readonly execCommandApproval: typeof CodexSchema.ExecCommandApprovalResponse.Type;
|
||||
readonly "item/commandExecution/requestApproval": CodexSchema.CommandExecutionRequestApprovalResponse;
|
||||
readonly "item/fileChange/requestApproval": CodexSchema.FileChangeRequestApprovalResponse;
|
||||
readonly "item/tool/requestUserInput": CodexSchema.ToolRequestUserInputResponse;
|
||||
readonly "mcpServer/elicitation/request": CodexSchema.McpServerElicitationRequestResponse;
|
||||
readonly "item/permissions/requestApproval": CodexSchema.PermissionsRequestApprovalResponse;
|
||||
readonly "item/tool/call": CodexSchema.DynamicToolCallResponse;
|
||||
readonly "account/chatgptAuthTokens/refresh": CodexSchema.ChatgptAuthTokensRefreshResponse;
|
||||
readonly applyPatchApproval: CodexSchema.ApplyPatchApprovalResponse;
|
||||
readonly execCommandApproval: CodexSchema.ExecCommandApprovalResponse;
|
||||
}
|
||||
|
||||
export interface ServerNotificationParamsByMethod {
|
||||
readonly error: typeof CodexSchema.V2ErrorNotification.Type;
|
||||
readonly "thread/started": typeof CodexSchema.V2ThreadStartedNotification.Type;
|
||||
readonly "thread/status/changed": typeof CodexSchema.V2ThreadStatusChangedNotification.Type;
|
||||
readonly "thread/archived": typeof CodexSchema.V2ThreadArchivedNotification.Type;
|
||||
readonly "thread/unarchived": typeof CodexSchema.V2ThreadUnarchivedNotification.Type;
|
||||
readonly "thread/closed": typeof CodexSchema.V2ThreadClosedNotification.Type;
|
||||
readonly "skills/changed": typeof CodexSchema.V2SkillsChangedNotification.Type;
|
||||
readonly "thread/name/updated": typeof CodexSchema.V2ThreadNameUpdatedNotification.Type;
|
||||
readonly "thread/goal/updated": typeof CodexSchema.V2ThreadGoalUpdatedNotification.Type;
|
||||
readonly "thread/goal/cleared": typeof CodexSchema.V2ThreadGoalClearedNotification.Type;
|
||||
readonly "thread/tokenUsage/updated": typeof CodexSchema.V2ThreadTokenUsageUpdatedNotification.Type;
|
||||
readonly "turn/started": typeof CodexSchema.V2TurnStartedNotification.Type;
|
||||
readonly "hook/started": typeof CodexSchema.V2HookStartedNotification.Type;
|
||||
readonly "turn/completed": typeof CodexSchema.V2TurnCompletedNotification.Type;
|
||||
readonly "hook/completed": typeof CodexSchema.V2HookCompletedNotification.Type;
|
||||
readonly "turn/diff/updated": typeof CodexSchema.V2TurnDiffUpdatedNotification.Type;
|
||||
readonly "turn/plan/updated": typeof CodexSchema.V2TurnPlanUpdatedNotification.Type;
|
||||
readonly "item/started": typeof CodexSchema.V2ItemStartedNotification.Type;
|
||||
readonly "item/autoApprovalReview/started": typeof CodexSchema.V2ItemGuardianApprovalReviewStartedNotification.Type;
|
||||
readonly "item/autoApprovalReview/completed": typeof CodexSchema.V2ItemGuardianApprovalReviewCompletedNotification.Type;
|
||||
readonly "item/completed": typeof CodexSchema.V2ItemCompletedNotification.Type;
|
||||
readonly "rawResponseItem/completed": typeof CodexSchema.V2RawResponseItemCompletedNotification.Type;
|
||||
readonly "item/agentMessage/delta": typeof CodexSchema.V2AgentMessageDeltaNotification.Type;
|
||||
readonly "item/plan/delta": typeof CodexSchema.V2PlanDeltaNotification.Type;
|
||||
readonly "command/exec/outputDelta": typeof CodexSchema.V2CommandExecOutputDeltaNotification.Type;
|
||||
readonly "process/outputDelta": typeof CodexSchema.V2ProcessOutputDeltaNotification.Type;
|
||||
readonly "process/exited": typeof CodexSchema.V2ProcessExitedNotification.Type;
|
||||
readonly "item/commandExecution/outputDelta": typeof CodexSchema.V2CommandExecutionOutputDeltaNotification.Type;
|
||||
readonly "item/commandExecution/terminalInteraction": typeof CodexSchema.V2TerminalInteractionNotification.Type;
|
||||
readonly "item/fileChange/outputDelta": typeof CodexSchema.V2FileChangeOutputDeltaNotification.Type;
|
||||
readonly "item/fileChange/patchUpdated": typeof CodexSchema.V2FileChangePatchUpdatedNotification.Type;
|
||||
readonly "serverRequest/resolved": typeof CodexSchema.V2ServerRequestResolvedNotification.Type;
|
||||
readonly "item/mcpToolCall/progress": typeof CodexSchema.V2McpToolCallProgressNotification.Type;
|
||||
readonly "mcpServer/oauthLogin/completed": typeof CodexSchema.V2McpServerOauthLoginCompletedNotification.Type;
|
||||
readonly "mcpServer/startupStatus/updated": typeof CodexSchema.V2McpServerStatusUpdatedNotification.Type;
|
||||
readonly "account/updated": typeof CodexSchema.V2AccountUpdatedNotification.Type;
|
||||
readonly "account/rateLimits/updated": typeof CodexSchema.V2AccountRateLimitsUpdatedNotification.Type;
|
||||
readonly "app/list/updated": typeof CodexSchema.V2AppListUpdatedNotification.Type;
|
||||
readonly "remoteControl/status/changed": typeof CodexSchema.V2RemoteControlStatusChangedNotification.Type;
|
||||
readonly "externalAgentConfig/import/completed": typeof CodexSchema.V2ExternalAgentConfigImportCompletedNotification.Type;
|
||||
readonly "fs/changed": typeof CodexSchema.V2FsChangedNotification.Type;
|
||||
readonly "item/reasoning/summaryTextDelta": typeof CodexSchema.V2ReasoningSummaryTextDeltaNotification.Type;
|
||||
readonly "item/reasoning/summaryPartAdded": typeof CodexSchema.V2ReasoningSummaryPartAddedNotification.Type;
|
||||
readonly "item/reasoning/textDelta": typeof CodexSchema.V2ReasoningTextDeltaNotification.Type;
|
||||
readonly "thread/compacted": typeof CodexSchema.V2ContextCompactedNotification.Type;
|
||||
readonly "model/rerouted": typeof CodexSchema.V2ModelReroutedNotification.Type;
|
||||
readonly "model/verification": typeof CodexSchema.V2ModelVerificationNotification.Type;
|
||||
readonly warning: typeof CodexSchema.V2WarningNotification.Type;
|
||||
readonly guardianWarning: typeof CodexSchema.V2GuardianWarningNotification.Type;
|
||||
readonly deprecationNotice: typeof CodexSchema.V2DeprecationNoticeNotification.Type;
|
||||
readonly configWarning: typeof CodexSchema.V2ConfigWarningNotification.Type;
|
||||
readonly "fuzzyFileSearch/sessionUpdated": typeof CodexSchema.FuzzyFileSearchSessionUpdatedNotification.Type;
|
||||
readonly "fuzzyFileSearch/sessionCompleted": typeof CodexSchema.FuzzyFileSearchSessionCompletedNotification.Type;
|
||||
readonly "thread/realtime/started": typeof CodexSchema.V2ThreadRealtimeStartedNotification.Type;
|
||||
readonly "thread/realtime/itemAdded": typeof CodexSchema.V2ThreadRealtimeItemAddedNotification.Type;
|
||||
readonly "thread/realtime/transcript/delta": typeof CodexSchema.V2ThreadRealtimeTranscriptDeltaNotification.Type;
|
||||
readonly "thread/realtime/transcript/done": typeof CodexSchema.V2ThreadRealtimeTranscriptDoneNotification.Type;
|
||||
readonly "thread/realtime/outputAudio/delta": typeof CodexSchema.V2ThreadRealtimeOutputAudioDeltaNotification.Type;
|
||||
readonly "thread/realtime/sdp": typeof CodexSchema.V2ThreadRealtimeSdpNotification.Type;
|
||||
readonly "thread/realtime/error": typeof CodexSchema.V2ThreadRealtimeErrorNotification.Type;
|
||||
readonly "thread/realtime/closed": typeof CodexSchema.V2ThreadRealtimeClosedNotification.Type;
|
||||
readonly "windows/worldWritableWarning": typeof CodexSchema.V2WindowsWorldWritableWarningNotification.Type;
|
||||
readonly "windowsSandbox/setupCompleted": typeof CodexSchema.V2WindowsSandboxSetupCompletedNotification.Type;
|
||||
readonly "account/login/completed": typeof CodexSchema.V2AccountLoginCompletedNotification.Type;
|
||||
readonly error: CodexSchema.V2ErrorNotification;
|
||||
readonly "thread/started": CodexSchema.V2ThreadStartedNotification;
|
||||
readonly "thread/status/changed": CodexSchema.V2ThreadStatusChangedNotification;
|
||||
readonly "thread/archived": CodexSchema.V2ThreadArchivedNotification;
|
||||
readonly "thread/unarchived": CodexSchema.V2ThreadUnarchivedNotification;
|
||||
readonly "thread/closed": CodexSchema.V2ThreadClosedNotification;
|
||||
readonly "skills/changed": CodexSchema.V2SkillsChangedNotification;
|
||||
readonly "thread/name/updated": CodexSchema.V2ThreadNameUpdatedNotification;
|
||||
readonly "thread/goal/updated": CodexSchema.V2ThreadGoalUpdatedNotification;
|
||||
readonly "thread/goal/cleared": CodexSchema.V2ThreadGoalClearedNotification;
|
||||
readonly "thread/tokenUsage/updated": CodexSchema.V2ThreadTokenUsageUpdatedNotification;
|
||||
readonly "turn/started": CodexSchema.V2TurnStartedNotification;
|
||||
readonly "hook/started": CodexSchema.V2HookStartedNotification;
|
||||
readonly "turn/completed": CodexSchema.V2TurnCompletedNotification;
|
||||
readonly "hook/completed": CodexSchema.V2HookCompletedNotification;
|
||||
readonly "turn/diff/updated": CodexSchema.V2TurnDiffUpdatedNotification;
|
||||
readonly "turn/plan/updated": CodexSchema.V2TurnPlanUpdatedNotification;
|
||||
readonly "item/started": CodexSchema.V2ItemStartedNotification;
|
||||
readonly "item/autoApprovalReview/started": CodexSchema.V2ItemGuardianApprovalReviewStartedNotification;
|
||||
readonly "item/autoApprovalReview/completed": CodexSchema.V2ItemGuardianApprovalReviewCompletedNotification;
|
||||
readonly "item/completed": CodexSchema.V2ItemCompletedNotification;
|
||||
readonly "rawResponseItem/completed": CodexSchema.V2RawResponseItemCompletedNotification;
|
||||
readonly "item/agentMessage/delta": CodexSchema.V2AgentMessageDeltaNotification;
|
||||
readonly "item/plan/delta": CodexSchema.V2PlanDeltaNotification;
|
||||
readonly "command/exec/outputDelta": CodexSchema.V2CommandExecOutputDeltaNotification;
|
||||
readonly "process/outputDelta": CodexSchema.V2ProcessOutputDeltaNotification;
|
||||
readonly "process/exited": CodexSchema.V2ProcessExitedNotification;
|
||||
readonly "item/commandExecution/outputDelta": CodexSchema.V2CommandExecutionOutputDeltaNotification;
|
||||
readonly "item/commandExecution/terminalInteraction": CodexSchema.V2TerminalInteractionNotification;
|
||||
readonly "item/fileChange/outputDelta": CodexSchema.V2FileChangeOutputDeltaNotification;
|
||||
readonly "item/fileChange/patchUpdated": CodexSchema.V2FileChangePatchUpdatedNotification;
|
||||
readonly "serverRequest/resolved": CodexSchema.V2ServerRequestResolvedNotification;
|
||||
readonly "item/mcpToolCall/progress": CodexSchema.V2McpToolCallProgressNotification;
|
||||
readonly "mcpServer/oauthLogin/completed": CodexSchema.V2McpServerOauthLoginCompletedNotification;
|
||||
readonly "mcpServer/startupStatus/updated": CodexSchema.V2McpServerStatusUpdatedNotification;
|
||||
readonly "account/updated": CodexSchema.V2AccountUpdatedNotification;
|
||||
readonly "account/rateLimits/updated": CodexSchema.V2AccountRateLimitsUpdatedNotification;
|
||||
readonly "app/list/updated": CodexSchema.V2AppListUpdatedNotification;
|
||||
readonly "remoteControl/status/changed": CodexSchema.V2RemoteControlStatusChangedNotification;
|
||||
readonly "externalAgentConfig/import/completed": CodexSchema.V2ExternalAgentConfigImportCompletedNotification;
|
||||
readonly "fs/changed": CodexSchema.V2FsChangedNotification;
|
||||
readonly "item/reasoning/summaryTextDelta": CodexSchema.V2ReasoningSummaryTextDeltaNotification;
|
||||
readonly "item/reasoning/summaryPartAdded": CodexSchema.V2ReasoningSummaryPartAddedNotification;
|
||||
readonly "item/reasoning/textDelta": CodexSchema.V2ReasoningTextDeltaNotification;
|
||||
readonly "thread/compacted": CodexSchema.V2ContextCompactedNotification;
|
||||
readonly "model/rerouted": CodexSchema.V2ModelReroutedNotification;
|
||||
readonly "model/verification": CodexSchema.V2ModelVerificationNotification;
|
||||
readonly warning: CodexSchema.V2WarningNotification;
|
||||
readonly guardianWarning: CodexSchema.V2GuardianWarningNotification;
|
||||
readonly deprecationNotice: CodexSchema.V2DeprecationNoticeNotification;
|
||||
readonly configWarning: CodexSchema.V2ConfigWarningNotification;
|
||||
readonly "fuzzyFileSearch/sessionUpdated": CodexSchema.FuzzyFileSearchSessionUpdatedNotification;
|
||||
readonly "fuzzyFileSearch/sessionCompleted": CodexSchema.FuzzyFileSearchSessionCompletedNotification;
|
||||
readonly "thread/realtime/started": CodexSchema.V2ThreadRealtimeStartedNotification;
|
||||
readonly "thread/realtime/itemAdded": CodexSchema.V2ThreadRealtimeItemAddedNotification;
|
||||
readonly "thread/realtime/transcript/delta": CodexSchema.V2ThreadRealtimeTranscriptDeltaNotification;
|
||||
readonly "thread/realtime/transcript/done": CodexSchema.V2ThreadRealtimeTranscriptDoneNotification;
|
||||
readonly "thread/realtime/outputAudio/delta": CodexSchema.V2ThreadRealtimeOutputAudioDeltaNotification;
|
||||
readonly "thread/realtime/sdp": CodexSchema.V2ThreadRealtimeSdpNotification;
|
||||
readonly "thread/realtime/error": CodexSchema.V2ThreadRealtimeErrorNotification;
|
||||
readonly "thread/realtime/closed": CodexSchema.V2ThreadRealtimeClosedNotification;
|
||||
readonly "windows/worldWritableWarning": CodexSchema.V2WindowsWorldWritableWarningNotification;
|
||||
readonly "windowsSandbox/setupCompleted": CodexSchema.V2WindowsSandboxSetupCompletedNotification;
|
||||
readonly "account/login/completed": CodexSchema.V2AccountLoginCompletedNotification;
|
||||
}
|
||||
|
||||
export const CLIENT_REQUEST_PARAMS = {
|
||||
|
||||
@@ -75,7 +75,7 @@ export interface CodexAppServerClientShape {
|
||||
export class CodexAppServerClient extends Context.Service<
|
||||
CodexAppServerClient,
|
||||
CodexAppServerClientShape
|
||||
>()("effect-codex-app-server/CodexAppServerClient") {}
|
||||
>()("effect-codex-app-server/client/CodexAppServerClient") {}
|
||||
|
||||
type ServerRequestHandler = (
|
||||
payload: unknown,
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
{
|
||||
"extends": "../../tsconfig.base.json",
|
||||
"compilerOptions": {},
|
||||
"compilerOptions": {
|
||||
"types": ["node"]
|
||||
},
|
||||
"include": ["src", "scripts", "test"]
|
||||
}
|
||||
@@ -93,7 +93,7 @@
|
||||
}
|
||||
},
|
||||
"scripts": {
|
||||
"typecheck": "tsc --noEmit",
|
||||
"typecheck": "tsgo --noEmit",
|
||||
"test": "vitest run"
|
||||
},
|
||||
"dependencies": {
|
||||
@@ -101,11 +101,9 @@
|
||||
"effect": "catalog:"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@effect/language-service": "catalog:",
|
||||
"@effect/platform-node": "catalog:",
|
||||
"@effect/vitest": "catalog:",
|
||||
"@types/node": "catalog:",
|
||||
"typescript": "catalog:",
|
||||
"vitest": "catalog:"
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,9 @@
|
||||
import * as Schema from "effect/Schema";
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
import { extractJsonObject } from "./schemaJson.ts";
|
||||
import { extractJsonObject, fromLenientJson } from "./schemaJson.ts";
|
||||
|
||||
const decodeLenientJson = Schema.decodeUnknownSync(fromLenientJson(Schema.Unknown));
|
||||
|
||||
describe("schemaJson helpers", () => {
|
||||
it("extracts a balanced JSON object from surrounding text", () => {
|
||||
@@ -28,4 +31,21 @@ Done.`),
|
||||
it("returns trimmed input when no JSON object starts", () => {
|
||||
expect(extractJsonObject(" no structured output ")).toBe("no structured output");
|
||||
});
|
||||
|
||||
it("decodes JSON with comments and trailing commas", () => {
|
||||
expect(
|
||||
decodeLenientJson(`{
|
||||
// Comments are valid in settings files.
|
||||
"enabled": true,
|
||||
"values": [1, 2,],
|
||||
}`),
|
||||
).toEqual({
|
||||
enabled: true,
|
||||
values: [1, 2],
|
||||
});
|
||||
});
|
||||
|
||||
it("rejects malformed JSON after lenient preprocessing", () => {
|
||||
expect(() => decodeLenientJson('{ "enabled": true,, }')).toThrow();
|
||||
});
|
||||
});
|
||||
@@ -45,32 +45,33 @@ export const formatSchemaError = (cause: Cause.Cause<Schema.SchemaError>) => {
|
||||
* A `Getter` that parses a lenient JSON string (tolerating trailing commas
|
||||
* and JS-style comments) into an unknown value.
|
||||
*
|
||||
* Mirrors `SchemaGetter.parseJson()` but uses `parseLenientJson` instead
|
||||
* of `JSON.parse`.
|
||||
* Mirrors `SchemaGetter.parseJson()` but strips JSONC syntax before parsing.
|
||||
*/
|
||||
const parseLenientJsonGetter = SchemaGetter.onSome((input: string) =>
|
||||
Effect.try({
|
||||
try: () => {
|
||||
// Strip single-line comments — alternation preserves quoted strings.
|
||||
let stripped = input.replace(
|
||||
/("(?:[^"\\]|\\.)*")|\/\/[^\n]*/g,
|
||||
(match, stringLiteral: string | undefined) => (stringLiteral ? match : ""),
|
||||
);
|
||||
const decodeJsonString = Schema.decodeEffect(Schema.UnknownFromJsonString);
|
||||
|
||||
// Strip multi-line comments.
|
||||
stripped = stripped.replace(
|
||||
/("(?:[^"\\]|\\.)*")|\/\*[\s\S]*?\*\//g,
|
||||
(match, stringLiteral: string | undefined) => (stringLiteral ? match : ""),
|
||||
);
|
||||
const parseLenientJsonGetter = SchemaGetter.onSome((input: string) => {
|
||||
// Strip single-line comments - alternation preserves quoted strings.
|
||||
let stripped = input.replace(
|
||||
/("(?:[^"\\]|\\.)*")|\/\/[^\n]*/g,
|
||||
(match, stringLiteral: string | undefined) => (stringLiteral ? match : ""),
|
||||
);
|
||||
|
||||
// Strip trailing commas before `}` or `]`.
|
||||
stripped = stripped.replace(/,(\s*[}\]])/g, "$1");
|
||||
// Strip multi-line comments.
|
||||
stripped = stripped.replace(
|
||||
/("(?:[^"\\]|\\.)*")|\/\*[\s\S]*?\*\//g,
|
||||
(match, stringLiteral: string | undefined) => (stringLiteral ? match : ""),
|
||||
);
|
||||
|
||||
return Option.some(JSON.parse(stripped));
|
||||
},
|
||||
catch: (e) => new SchemaIssue.InvalidValue(Option.some(input), { message: String(e) }),
|
||||
}),
|
||||
);
|
||||
// Strip trailing commas before `}` or `]`.
|
||||
stripped = stripped.replace(/,(\s*[}\]])/g, "$1");
|
||||
|
||||
return decodeJsonString(stripped).pipe(
|
||||
Effect.map(Option.some),
|
||||
Effect.mapError(
|
||||
(error) => new SchemaIssue.InvalidValue(Option.some(input), { message: String(error) }),
|
||||
),
|
||||
);
|
||||
});
|
||||
|
||||
/**
|
||||
* Schema transformation: lenient JSONC string ↔ unknown.
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
{
|
||||
"extends": "../../tsconfig.base.json",
|
||||
"compilerOptions": {},
|
||||
"compilerOptions": {
|
||||
"types": ["node"]
|
||||
},
|
||||
"include": ["src"]
|
||||
}
|
||||
@@ -25,7 +25,7 @@
|
||||
}
|
||||
},
|
||||
"scripts": {
|
||||
"typecheck": "tsc --noEmit",
|
||||
"typecheck": "tsgo --noEmit",
|
||||
"test": "vitest run"
|
||||
},
|
||||
"dependencies": {
|
||||
@@ -34,11 +34,9 @@
|
||||
"effect": "catalog:"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@effect/language-service": "catalog:",
|
||||
"@effect/platform-node": "catalog:",
|
||||
"@effect/vitest": "catalog:",
|
||||
"@types/node": "catalog:",
|
||||
"typescript": "catalog:",
|
||||
"vitest": "catalog:"
|
||||
}
|
||||
}
|
||||
@@ -39,7 +39,7 @@ export interface SshPasswordPromptShape {
|
||||
}
|
||||
|
||||
export class SshPasswordPrompt extends Context.Service<SshPasswordPrompt, SshPasswordPromptShape>()(
|
||||
"@t3tools/ssh/SshPasswordPrompt",
|
||||
"@t3tools/ssh/auth/SshPasswordPrompt",
|
||||
) {
|
||||
static readonly disabledLayer = Layer.succeed(
|
||||
SshPasswordPrompt,
|
||||
|
||||
@@ -1753,10 +1753,13 @@ const makeSshEnvironmentManager = Effect.fn("ssh/tunnel.SshEnvironmentManager.ma
|
||||
return SshEnvironmentManager.of({ ensureEnvironment, disconnectEnvironment });
|
||||
});
|
||||
|
||||
/**
|
||||
* @effect-expect-leaking ChildProcessSpawner | FileSystem | HttpClient | NetService | Path | SshPasswordPrompt
|
||||
*/
|
||||
export class SshEnvironmentManager extends Context.Service<
|
||||
SshEnvironmentManager,
|
||||
SshEnvironmentManagerShape
|
||||
>()("@t3tools/ssh/SshEnvironmentManager") {
|
||||
>()("@t3tools/ssh/tunnel/SshEnvironmentManager") {
|
||||
static readonly layer = (options: SshEnvironmentManagerOptions = {}) =>
|
||||
Layer.effect(SshEnvironmentManager, makeSshEnvironmentManager(options));
|
||||
}
|
||||
@@ -1,5 +1,7 @@
|
||||
{
|
||||
"extends": "../../tsconfig.base.json",
|
||||
"compilerOptions": {},
|
||||
"compilerOptions": {
|
||||
"types": ["node"]
|
||||
},
|
||||
"include": ["src"]
|
||||
}
|
||||
@@ -9,7 +9,7 @@
|
||||
}
|
||||
},
|
||||
"scripts": {
|
||||
"typecheck": "tsc --noEmit",
|
||||
"typecheck": "tsgo --noEmit",
|
||||
"test": "vitest run"
|
||||
},
|
||||
"dependencies": {
|
||||
@@ -17,10 +17,8 @@
|
||||
"effect": "catalog:"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@effect/language-service": "catalog:",
|
||||
"@effect/vitest": "catalog:",
|
||||
"@types/node": "catalog:",
|
||||
"typescript": "catalog:",
|
||||
"vitest": "catalog:"
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,7 @@
|
||||
{
|
||||
"extends": "../../tsconfig.base.json",
|
||||
"compilerOptions": {},
|
||||
"compilerOptions": {
|
||||
"types": ["node"]
|
||||
},
|
||||
"include": ["src"]
|
||||
}
|
||||
Loaded 100 of 102 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user