Compare commits
5
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
412962ec46 | ||
|
|
60b546cf01 | ||
|
|
4b73827334 | ||
|
|
a5efb7cb6b | ||
|
|
8f9911f79d |
No files matched your search
@@ -0,0 +1,31 @@
|
||||
import { describe, expect, it } from "vite-plus/test";
|
||||
|
||||
import { scaleContextMenuPositionForElectron } from "./contextMenuPosition.ts";
|
||||
|
||||
describe("scaleContextMenuPositionForElectron", () => {
|
||||
it("scales CSS pixel positions by the renderer zoom factor", () => {
|
||||
expect(scaleContextMenuPositionForElectron({ x: 120, y: 80 }, 0.8)).toEqual({
|
||||
x: 96,
|
||||
y: 64,
|
||||
});
|
||||
expect(scaleContextMenuPositionForElectron({ x: 120, y: 80 }, 1.25)).toEqual({
|
||||
x: 150,
|
||||
y: 100,
|
||||
});
|
||||
});
|
||||
|
||||
it("leaves missing positions missing", () => {
|
||||
expect(scaleContextMenuPositionForElectron(undefined, 0.8)).toBeUndefined();
|
||||
});
|
||||
|
||||
it("falls back to unscaled coordinates for invalid zoom factors", () => {
|
||||
expect(scaleContextMenuPositionForElectron({ x: 120, y: 80 }, 0)).toEqual({
|
||||
x: 120,
|
||||
y: 80,
|
||||
});
|
||||
expect(scaleContextMenuPositionForElectron({ x: 120, y: 80 }, Number.NaN)).toEqual({
|
||||
x: 120,
|
||||
y: 80,
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,19 @@
|
||||
export interface ContextMenuPosition {
|
||||
readonly x: number;
|
||||
readonly y: number;
|
||||
}
|
||||
|
||||
export function scaleContextMenuPositionForElectron(
|
||||
position: ContextMenuPosition | undefined,
|
||||
zoomFactor: number,
|
||||
): ContextMenuPosition | undefined {
|
||||
if (position === undefined) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
const normalizedZoomFactor = Number.isFinite(zoomFactor) && zoomFactor > 0 ? zoomFactor : 1;
|
||||
return {
|
||||
x: position.x * normalizedZoomFactor,
|
||||
y: position.y * normalizedZoomFactor,
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
import { describe, expect, it } from "vite-plus/test";
|
||||
|
||||
import { normalizeDesktopZoomFactor, resolveDesktopZoomCssVariables } from "./desktopZoom.ts";
|
||||
|
||||
describe("desktopZoom", () => {
|
||||
it("gradually reduces zoomed-out titlebar leading spacing", () => {
|
||||
expect(resolveDesktopZoomCssVariables(0.8)).toEqual({
|
||||
titlebarHeight: "65px",
|
||||
titlebarLeadingOffset: "106.5px",
|
||||
});
|
||||
expect(resolveDesktopZoomCssVariables(0.6)).toEqual({
|
||||
titlebarHeight: "86.66666666666667px",
|
||||
titlebarLeadingOffset: "136.66666666666669px",
|
||||
});
|
||||
});
|
||||
|
||||
it("keeps a minimum leading offset clear of the traffic lights", () => {
|
||||
expect(resolveDesktopZoomCssVariables(0.4)).toEqual({
|
||||
titlebarHeight: "130px",
|
||||
titlebarLeadingOffset: "205px",
|
||||
});
|
||||
});
|
||||
|
||||
it("compensates titlebar spacing when zoomed in", () => {
|
||||
expect(resolveDesktopZoomCssVariables(1.25)).toEqual({
|
||||
titlebarHeight: "41.6px",
|
||||
titlebarLeadingOffset: "72px",
|
||||
});
|
||||
});
|
||||
|
||||
it("normalizes invalid zoom factors", () => {
|
||||
expect(normalizeDesktopZoomFactor(0)).toBe(1);
|
||||
expect(normalizeDesktopZoomFactor(Number.NaN)).toBe(1);
|
||||
expect(resolveDesktopZoomCssVariables(0)).toEqual({
|
||||
titlebarHeight: "52px",
|
||||
titlebarLeadingOffset: "90px",
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,30 @@
|
||||
export interface DesktopZoomCssVariables {
|
||||
readonly titlebarHeight: string;
|
||||
readonly titlebarLeadingOffset: string;
|
||||
}
|
||||
|
||||
export const DESKTOP_TITLEBAR_HEIGHT_PX = 52;
|
||||
export const DESKTOP_TITLEBAR_LEADING_OFFSET_PX = 90;
|
||||
export const DESKTOP_TITLEBAR_MIN_SCREEN_LEADING_OFFSET_PX = 82;
|
||||
export const DESKTOP_TITLEBAR_ZOOM_OUT_SCREEN_OFFSET_STEP_PX = 24;
|
||||
|
||||
export function normalizeDesktopZoomFactor(zoomFactor: number): number {
|
||||
return Number.isFinite(zoomFactor) && zoomFactor > 0 ? zoomFactor : 1;
|
||||
}
|
||||
|
||||
export function resolveDesktopZoomCssVariables(zoomFactor: number): DesktopZoomCssVariables {
|
||||
const normalizedZoomFactor = normalizeDesktopZoomFactor(zoomFactor);
|
||||
const screenLeadingOffset =
|
||||
normalizedZoomFactor >= 1
|
||||
? DESKTOP_TITLEBAR_LEADING_OFFSET_PX
|
||||
: Math.max(
|
||||
DESKTOP_TITLEBAR_MIN_SCREEN_LEADING_OFFSET_PX,
|
||||
DESKTOP_TITLEBAR_LEADING_OFFSET_PX -
|
||||
(1 - normalizedZoomFactor) * DESKTOP_TITLEBAR_ZOOM_OUT_SCREEN_OFFSET_STEP_PX,
|
||||
);
|
||||
|
||||
return {
|
||||
titlebarHeight: `${DESKTOP_TITLEBAR_HEIGHT_PX / normalizedZoomFactor}px`,
|
||||
titlebarLeadingOffset: `${screenLeadingOffset / normalizedZoomFactor}px`,
|
||||
};
|
||||
}
|
||||
@@ -10,6 +10,7 @@ export const CLEAR_CLOUD_AUTH_TOKEN_CHANNEL = "desktop:clear-cloud-auth-token";
|
||||
export const FETCH_CLOUD_AUTH_CHANNEL = "desktop:fetch-cloud-auth";
|
||||
export const CLOUD_AUTH_CALLBACK_CHANNEL = "desktop:cloud-auth-callback";
|
||||
export const MENU_ACTION_CHANNEL = "desktop:menu-action";
|
||||
export const ZOOM_FACTOR_CHANGED_CHANNEL = "desktop:zoom-factor-changed";
|
||||
export const UPDATE_STATE_CHANNEL = "desktop:update-state";
|
||||
export const UPDATE_GET_STATE_CHANNEL = "desktop:update-get-state";
|
||||
export const UPDATE_SET_CHANNEL_CHANNEL = "desktop:update-set-channel";
|
||||
|
||||
@@ -4,9 +4,57 @@ import type {
|
||||
DesktopPreviewRecordingFrame,
|
||||
DesktopPreviewTabState,
|
||||
} from "@t3tools/contracts";
|
||||
import { contextBridge, ipcRenderer } from "electron";
|
||||
import { contextBridge, ipcRenderer, webFrame } from "electron";
|
||||
|
||||
import { normalizeDesktopZoomFactor, resolveDesktopZoomCssVariables } from "./desktopZoom.ts";
|
||||
import * as IpcChannels from "./ipc/channels.ts";
|
||||
import { scaleContextMenuPositionForElectron } from "./contextMenuPosition.ts";
|
||||
|
||||
let lastAppliedDesktopZoomFactor: number | undefined;
|
||||
let pendingDesktopZoomSyncFrame: number | null = null;
|
||||
|
||||
function applyDesktopZoomCssVariables(zoomFactor: number) {
|
||||
const normalizedZoomFactor = normalizeDesktopZoomFactor(zoomFactor);
|
||||
if (lastAppliedDesktopZoomFactor === normalizedZoomFactor) {
|
||||
return;
|
||||
}
|
||||
lastAppliedDesktopZoomFactor = normalizedZoomFactor;
|
||||
|
||||
const variables = resolveDesktopZoomCssVariables(normalizedZoomFactor);
|
||||
document.documentElement.style.setProperty("--desktop-zoom-factor", String(normalizedZoomFactor));
|
||||
document.documentElement.style.setProperty("--desktop-titlebar-height", variables.titlebarHeight);
|
||||
document.documentElement.style.setProperty(
|
||||
"--desktop-titlebar-leading-offset",
|
||||
variables.titlebarLeadingOffset,
|
||||
);
|
||||
}
|
||||
|
||||
function syncDesktopZoomCssVariables() {
|
||||
applyDesktopZoomCssVariables(webFrame.getZoomFactor());
|
||||
}
|
||||
|
||||
function scheduleDesktopZoomCssVariableSync() {
|
||||
if (pendingDesktopZoomSyncFrame !== null) {
|
||||
return;
|
||||
}
|
||||
pendingDesktopZoomSyncFrame = window.requestAnimationFrame(() => {
|
||||
pendingDesktopZoomSyncFrame = null;
|
||||
syncDesktopZoomCssVariables();
|
||||
});
|
||||
}
|
||||
|
||||
if (document.readyState === "loading") {
|
||||
document.addEventListener("DOMContentLoaded", syncDesktopZoomCssVariables, { once: true });
|
||||
} else {
|
||||
syncDesktopZoomCssVariables();
|
||||
}
|
||||
window.addEventListener("resize", scheduleDesktopZoomCssVariableSync);
|
||||
window.visualViewport?.addEventListener("resize", scheduleDesktopZoomCssVariableSync);
|
||||
|
||||
ipcRenderer.on(IpcChannels.ZOOM_FACTOR_CHANGED_CHANNEL, (_event, zoomFactor: unknown) => {
|
||||
if (typeof zoomFactor !== "number") return;
|
||||
applyDesktopZoomCssVariables(zoomFactor);
|
||||
});
|
||||
|
||||
function unwrapEnsureSshEnvironmentResult(result: unknown) {
|
||||
if (
|
||||
@@ -98,7 +146,9 @@ contextBridge.exposeInMainWorld("desktopBridge", {
|
||||
showContextMenu: (items, position) =>
|
||||
ipcRenderer.invoke(IpcChannels.CONTEXT_MENU_CHANNEL, {
|
||||
items,
|
||||
...(position === undefined ? {} : { position }),
|
||||
...(position === undefined
|
||||
? {}
|
||||
: { position: scaleContextMenuPositionForElectron(position, webFrame.getZoomFactor()) }),
|
||||
}),
|
||||
openExternal: (url: string) => ipcRenderer.invoke(IpcChannels.OPEN_EXTERNAL_CHANNEL, url),
|
||||
createCloudAuthRequest: () => ipcRenderer.invoke(IpcChannels.CREATE_CLOUD_AUTH_REQUEST_CHANNEL),
|
||||
|
||||
@@ -55,6 +55,7 @@ function makeFakeBrowserWindow() {
|
||||
openDevTools: vi.fn(),
|
||||
replaceMisspelling: vi.fn(),
|
||||
send: vi.fn(),
|
||||
getZoomFactor: vi.fn(() => 1),
|
||||
setWindowOpenHandler: vi.fn(),
|
||||
};
|
||||
|
||||
|
||||
@@ -274,6 +274,16 @@ const make = Effect.gen(function* () {
|
||||
void runPromise(electronMenu.popupTemplate({ window, template: menuTemplate }));
|
||||
});
|
||||
|
||||
const syncZoomCssVariables = () => {
|
||||
if (window.isDestroyed()) return;
|
||||
window.webContents.send(
|
||||
IpcChannels.ZOOM_FACTOR_CHANGED_CHANNEL,
|
||||
window.webContents.getZoomFactor(),
|
||||
);
|
||||
};
|
||||
window.webContents.on("zoom-changed", syncZoomCssVariables);
|
||||
window.webContents.on("did-finish-load", syncZoomCssVariables);
|
||||
|
||||
window.webContents.setWindowOpenHandler(({ url }) => {
|
||||
if (Option.isSome(ElectronShell.parseSafeExternalUrl(url))) {
|
||||
void runPromise(electronShell.openExternal(url));
|
||||
|
||||
@@ -1,191 +0,0 @@
|
||||
import { assert, describe, it } from "@effect/vitest";
|
||||
import {
|
||||
AuthSessionId,
|
||||
RpcClientId,
|
||||
type HostPowerSnapshot,
|
||||
type ClientActivityReportInput,
|
||||
} from "@t3tools/contracts";
|
||||
import * as DateTime from "effect/DateTime";
|
||||
import * as Effect from "effect/Effect";
|
||||
import * as Layer from "effect/Layer";
|
||||
import * as PubSub from "effect/PubSub";
|
||||
import * as Stream from "effect/Stream";
|
||||
|
||||
import { ServerSettingsService } from "../serverSettings.ts";
|
||||
import * as BackgroundPolicy from "./BackgroundPolicy.ts";
|
||||
import * as HostPowerMonitor from "./HostPowerMonitor.ts";
|
||||
|
||||
const TEST_NOW = DateTime.makeUnsafe("2026-05-13T00:00:00.000Z");
|
||||
|
||||
const nominalHostPower: HostPowerSnapshot = {
|
||||
source: "unknown",
|
||||
idle: "unknown",
|
||||
idleSeconds: null,
|
||||
locked: "unknown",
|
||||
suspended: false,
|
||||
onBattery: "unknown",
|
||||
lowPowerMode: "unknown",
|
||||
thermalState: "unknown",
|
||||
stale: true,
|
||||
updatedAt: TEST_NOW,
|
||||
};
|
||||
|
||||
const constrainedHostPower: HostPowerSnapshot = {
|
||||
...nominalHostPower,
|
||||
lowPowerMode: "true",
|
||||
stale: false,
|
||||
};
|
||||
|
||||
function makeReport(overrides: Partial<ClientActivityReportInput> = {}): ClientActivityReportInput {
|
||||
return {
|
||||
clientId: "client-1",
|
||||
clientKind: "web",
|
||||
visible: true,
|
||||
focused: true,
|
||||
recentlyInteracted: true,
|
||||
scopes: [{ type: "vcs-status", cwd: "/repo" }],
|
||||
ttlMs: 45_000,
|
||||
observedAt: TEST_NOW,
|
||||
...overrides,
|
||||
};
|
||||
}
|
||||
|
||||
function makeLayer(
|
||||
hostPower: HostPowerSnapshot,
|
||||
settingsOverrides: Parameters<typeof ServerSettingsService.layerTest>[0] = {},
|
||||
) {
|
||||
const hostLayer = Layer.effect(
|
||||
HostPowerMonitor.HostPowerMonitor,
|
||||
Effect.gen(function* () {
|
||||
const changes = yield* PubSub.sliding<HostPowerSnapshot>(1);
|
||||
let snapshot = hostPower;
|
||||
return HostPowerMonitor.HostPowerMonitor.of({
|
||||
snapshot: Effect.sync(() => snapshot),
|
||||
report: (next) =>
|
||||
Effect.sync(() => {
|
||||
snapshot = next;
|
||||
}).pipe(Effect.andThen(PubSub.publish(changes, next)), Effect.asVoid),
|
||||
setDemandActive: () => Effect.void,
|
||||
streamChanges: Stream.fromPubSub(changes),
|
||||
});
|
||||
}),
|
||||
);
|
||||
return BackgroundPolicy.layer.pipe(
|
||||
Layer.provide(Layer.merge(hostLayer, ServerSettingsService.layerTest(settingsOverrides))),
|
||||
);
|
||||
}
|
||||
|
||||
describe("BackgroundPolicy", () => {
|
||||
it.effect("records foreground scoped client demand", () =>
|
||||
Effect.gen(function* () {
|
||||
const policy = yield* BackgroundPolicy.BackgroundPolicy;
|
||||
yield* policy.reportClientActivity(
|
||||
AuthSessionId.make("session-1"),
|
||||
RpcClientId.make(1),
|
||||
makeReport(),
|
||||
);
|
||||
|
||||
const snapshot = yield* policy.snapshot;
|
||||
assert.equal(snapshot.activeForegroundLeaseCount, 1);
|
||||
assert.deepStrictEqual(snapshot.activeScopeKeys, ["vcs-status:/repo"]);
|
||||
assert.equal(snapshot.shouldRunOpportunisticWork, true);
|
||||
assert.equal(yield* policy.hasDemand({ type: "vcs-status", cwd: "/repo" }), true);
|
||||
assert.equal(yield* policy.hasDemand({ type: "vcs-status", cwd: "/other" }), false);
|
||||
assert.equal(yield* policy.shouldRunScopeWork({ type: "vcs-status", cwd: "/repo" }), true);
|
||||
assert.equal(yield* policy.shouldRunScopeWork({ type: "vcs-status", cwd: "/other" }), false);
|
||||
}).pipe(Effect.provide(makeLayer(nominalHostPower))),
|
||||
);
|
||||
|
||||
it.effect("removes all leases for a disconnected websocket connection", () =>
|
||||
Effect.gen(function* () {
|
||||
const policy = yield* BackgroundPolicy.BackgroundPolicy;
|
||||
yield* policy.reportClientActivity(
|
||||
AuthSessionId.make("session-1"),
|
||||
RpcClientId.make(1),
|
||||
makeReport(),
|
||||
);
|
||||
yield* policy.removeRpcClient(RpcClientId.make(1));
|
||||
|
||||
const snapshot = yield* policy.snapshot;
|
||||
assert.equal(snapshot.activeForegroundLeaseCount, 0);
|
||||
assert.deepStrictEqual(snapshot.activeScopeKeys, []);
|
||||
assert.equal(snapshot.shouldRunOpportunisticWork, false);
|
||||
}).pipe(Effect.provide(makeLayer(nominalHostPower))),
|
||||
);
|
||||
|
||||
it.effect("host low power mode disables opportunistic work without dropping scoped demand", () =>
|
||||
Effect.gen(function* () {
|
||||
const policy = yield* BackgroundPolicy.BackgroundPolicy;
|
||||
yield* policy.reportClientActivity(
|
||||
AuthSessionId.make("session-1"),
|
||||
RpcClientId.make(1),
|
||||
makeReport(),
|
||||
);
|
||||
|
||||
const snapshot = yield* policy.snapshot;
|
||||
assert.equal(snapshot.activeForegroundLeaseCount, 1);
|
||||
assert.deepStrictEqual(snapshot.activeScopeKeys, ["vcs-status:/repo"]);
|
||||
assert.equal(snapshot.shouldRunOpportunisticWork, false);
|
||||
assert.equal(yield* policy.hasDemand({ type: "vcs-status", cwd: "/repo" }), true);
|
||||
assert.equal(yield* policy.shouldRunScopeWork({ type: "vcs-status", cwd: "/repo" }), false);
|
||||
}).pipe(Effect.provide(makeLayer(constrainedHostPower))),
|
||||
);
|
||||
|
||||
it.effect("keeps background demand visible while preventing scoped work", () =>
|
||||
Effect.gen(function* () {
|
||||
const policy = yield* BackgroundPolicy.BackgroundPolicy;
|
||||
yield* policy.reportClientActivity(
|
||||
AuthSessionId.make("session-1"),
|
||||
RpcClientId.make(1),
|
||||
makeReport({ focused: false, visible: false }),
|
||||
);
|
||||
|
||||
const snapshot = yield* policy.snapshot;
|
||||
assert.equal(snapshot.activeForegroundLeaseCount, 0);
|
||||
assert.deepStrictEqual(snapshot.activeScopeKeys, ["vcs-status:/repo"]);
|
||||
assert.equal(yield* policy.hasDemand({ type: "vcs-status", cwd: "/repo" }), true);
|
||||
assert.equal(yield* policy.shouldRunScopeWork({ type: "vcs-status", cwd: "/repo" }), false);
|
||||
}).pipe(Effect.provide(makeLayer(nominalHostPower))),
|
||||
);
|
||||
|
||||
it.effect(
|
||||
"performance profile allows background scoped work while a scoped lease is active",
|
||||
() =>
|
||||
Effect.gen(function* () {
|
||||
const policy = yield* BackgroundPolicy.BackgroundPolicy;
|
||||
yield* policy.reportClientActivity(
|
||||
AuthSessionId.make("session-1"),
|
||||
RpcClientId.make(1),
|
||||
makeReport({ focused: false, visible: false }),
|
||||
);
|
||||
|
||||
assert.equal(yield* policy.shouldRunScopeWork({ type: "vcs-status", cwd: "/repo" }), true);
|
||||
}).pipe(
|
||||
Effect.provide(makeLayer(nominalHostPower, { backgroundActivityProfile: "performance" })),
|
||||
),
|
||||
);
|
||||
|
||||
it.effect("battery saver profile pauses scoped work on battery", () =>
|
||||
Effect.gen(function* () {
|
||||
const policy = yield* BackgroundPolicy.BackgroundPolicy;
|
||||
yield* policy.reportClientActivity(
|
||||
AuthSessionId.make("session-1"),
|
||||
RpcClientId.make(1),
|
||||
makeReport(),
|
||||
);
|
||||
|
||||
assert.equal(yield* policy.shouldRunScopeWork({ type: "vcs-status", cwd: "/repo" }), false);
|
||||
}).pipe(
|
||||
Effect.provide(
|
||||
makeLayer(
|
||||
{
|
||||
...nominalHostPower,
|
||||
onBattery: "true",
|
||||
stale: false,
|
||||
},
|
||||
{ backgroundActivityProfile: "battery-saver" },
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
});
|
||||
@@ -1,289 +0,0 @@
|
||||
import {
|
||||
type AuthSessionId,
|
||||
type BackgroundPolicySnapshot,
|
||||
type BackgroundScope,
|
||||
type ClientActivityLease,
|
||||
type ClientActivityReportInput,
|
||||
type HostPowerSnapshot,
|
||||
type RpcClientId,
|
||||
} from "@t3tools/contracts";
|
||||
import {
|
||||
getBackgroundActivityPresetSettings,
|
||||
resolveServerBackgroundActivitySettings,
|
||||
type ResolvedBackgroundActivitySettings,
|
||||
} from "@t3tools/shared/backgroundActivitySettings";
|
||||
import * as DateTime from "effect/DateTime";
|
||||
import * as Context from "effect/Context";
|
||||
import * as Effect from "effect/Effect";
|
||||
import * as Layer from "effect/Layer";
|
||||
import * as PubSub from "effect/PubSub";
|
||||
import * as Ref from "effect/Ref";
|
||||
import * as Stream from "effect/Stream";
|
||||
|
||||
import { ServerSettingsService } from "../serverSettings.ts";
|
||||
import * as HostPowerMonitor from "./HostPowerMonitor.ts";
|
||||
|
||||
export interface BackgroundPolicyShape {
|
||||
readonly reportClientActivity: (
|
||||
sessionId: AuthSessionId,
|
||||
rpcClientId: RpcClientId,
|
||||
input: ClientActivityReportInput,
|
||||
) => Effect.Effect<void>;
|
||||
readonly removeRpcClient: (rpcClientId: RpcClientId) => Effect.Effect<void>;
|
||||
readonly removeSession: (sessionId: AuthSessionId) => Effect.Effect<void>;
|
||||
readonly reportHostPowerState: (snapshot: HostPowerSnapshot) => Effect.Effect<void>;
|
||||
readonly snapshot: Effect.Effect<BackgroundPolicySnapshot>;
|
||||
readonly streamChanges: Stream.Stream<BackgroundPolicySnapshot>;
|
||||
readonly hasDemand: (scope: BackgroundScope) => Effect.Effect<boolean>;
|
||||
readonly shouldRunScopeWork: (scope: BackgroundScope) => Effect.Effect<boolean>;
|
||||
readonly shouldRunOpportunisticWork: Effect.Effect<boolean>;
|
||||
}
|
||||
|
||||
export class BackgroundPolicy extends Context.Service<BackgroundPolicy, BackgroundPolicyShape>()(
|
||||
"t3/background/BackgroundPolicy",
|
||||
) {}
|
||||
|
||||
const DEFAULT_LEASE_TTL_MS = 45_000;
|
||||
const MAX_LEASE_TTL_MS = 120_000;
|
||||
|
||||
function scopeKey(scope: BackgroundScope): string {
|
||||
switch (scope.type) {
|
||||
case "server-config":
|
||||
case "diagnostics":
|
||||
return scope.type;
|
||||
case "provider-status":
|
||||
return scope.instanceId ? `${scope.type}:${scope.instanceId}` : scope.type;
|
||||
case "vcs-status":
|
||||
case "git-refs":
|
||||
return `${scope.type}:${scope.cwd}`;
|
||||
case "thread":
|
||||
return `${scope.type}:${scope.threadId}`;
|
||||
}
|
||||
}
|
||||
|
||||
function isLeaseActive(lease: ClientActivityLease, now: DateTime.Utc): boolean {
|
||||
return DateTime.isGreaterThan(lease.expiresAt, now);
|
||||
}
|
||||
|
||||
function isForegroundLease(lease: ClientActivityLease, now: DateTime.Utc): boolean {
|
||||
return isLeaseActive(lease, now) && lease.visible && lease.focused;
|
||||
}
|
||||
|
||||
function leaseHasScope(lease: ClientActivityLease, scope: BackgroundScope): boolean {
|
||||
const key = scopeKey(scope);
|
||||
return lease.scopes.some((leaseScope) => scopeKey(leaseScope) === key);
|
||||
}
|
||||
|
||||
function hasThermalPressure(hostPower: HostPowerSnapshot): boolean {
|
||||
return hostPower.thermalState === "serious" || hostPower.thermalState === "critical";
|
||||
}
|
||||
|
||||
function isHostConstrained(
|
||||
hostPower: HostPowerSnapshot,
|
||||
settings: ResolvedBackgroundActivitySettings,
|
||||
): boolean {
|
||||
if (
|
||||
(settings.pauseWhenHostLocked && hostPower.locked === "true") ||
|
||||
hasThermalPressure(hostPower)
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
if (settings.pauseWhenHostLowPower && hostPower.lowPowerMode === "true") return true;
|
||||
return settings.pauseWhenOnBattery && hostPower.onBattery === "true";
|
||||
}
|
||||
|
||||
function isClientConstrained(
|
||||
lease: ClientActivityLease,
|
||||
settings: ResolvedBackgroundActivitySettings,
|
||||
): boolean {
|
||||
if (settings.pauseWhenClientLowPower && lease.lowPowerMode === "true") return true;
|
||||
return settings.pauseWhenOnBattery && lease.batteryState === "unplugged";
|
||||
}
|
||||
|
||||
function leaseMayRunScopedWork(
|
||||
lease: ClientActivityLease,
|
||||
scope: BackgroundScope,
|
||||
now: DateTime.Utc,
|
||||
settings: ResolvedBackgroundActivitySettings,
|
||||
): boolean {
|
||||
const activeWithScope = isLeaseActive(lease, now) && leaseHasScope(lease, scope);
|
||||
if (!activeWithScope || isClientConstrained(lease, settings)) {
|
||||
return false;
|
||||
}
|
||||
if (settings.profile === "performance") {
|
||||
return true;
|
||||
}
|
||||
return isForegroundLease(lease, now);
|
||||
}
|
||||
|
||||
function computeSnapshot(input: {
|
||||
readonly hostPower: HostPowerSnapshot;
|
||||
readonly leases: ReadonlyMap<string, ClientActivityLease>;
|
||||
readonly now: DateTime.Utc;
|
||||
readonly settings: ResolvedBackgroundActivitySettings;
|
||||
readonly updatedAt: DateTime.Utc;
|
||||
}): BackgroundPolicySnapshot {
|
||||
const activeLeases = [...input.leases.values()].filter((lease) =>
|
||||
isLeaseActive(lease, input.now),
|
||||
);
|
||||
const foregroundLeases = activeLeases.filter((lease) => isForegroundLease(lease, input.now));
|
||||
const activeScopeKeys = new Set<string>();
|
||||
for (const lease of activeLeases) {
|
||||
for (const scope of lease.scopes) {
|
||||
activeScopeKeys.add(scopeKey(scope));
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
hostPower: input.hostPower,
|
||||
leases: activeLeases,
|
||||
activeForegroundLeaseCount: foregroundLeases.length,
|
||||
activeScopeKeys: [...activeScopeKeys].toSorted(),
|
||||
shouldRunOpportunisticWork:
|
||||
foregroundLeases.some((lease) => !isClientConstrained(lease, input.settings)) &&
|
||||
!isHostConstrained(input.hostPower, input.settings),
|
||||
updatedAt: input.updatedAt,
|
||||
};
|
||||
}
|
||||
|
||||
export const make = Effect.fn("background.policy.make")(function* () {
|
||||
const hostPowerMonitor = yield* HostPowerMonitor.HostPowerMonitor;
|
||||
const serverSettings = yield* ServerSettingsService;
|
||||
const leasesRef = yield* Ref.make(new Map<string, ClientActivityLease>());
|
||||
const changes = yield* PubSub.sliding<BackgroundPolicySnapshot>(1);
|
||||
|
||||
const backgroundActivitySettings = serverSettings.getSettings.pipe(
|
||||
Effect.map(resolveServerBackgroundActivitySettings),
|
||||
Effect.catch(() => Effect.succeed(getBackgroundActivityPresetSettings("balanced"))),
|
||||
);
|
||||
|
||||
const snapshot = Effect.gen(function* () {
|
||||
const [hostPower, leases, now, settings] = yield* Effect.all([
|
||||
hostPowerMonitor.snapshot,
|
||||
Ref.get(leasesRef),
|
||||
DateTime.now,
|
||||
backgroundActivitySettings,
|
||||
]);
|
||||
return computeSnapshot({ hostPower, leases, now, settings, updatedAt: now });
|
||||
});
|
||||
|
||||
const publishSnapshot = snapshot.pipe(
|
||||
Effect.tap((next) => hostPowerMonitor.setDemandActive(next.activeForegroundLeaseCount > 0)),
|
||||
Effect.flatMap((next) => PubSub.publish(changes, next)),
|
||||
);
|
||||
|
||||
const reportClientActivity: BackgroundPolicyShape["reportClientActivity"] = (
|
||||
sessionId,
|
||||
rpcClientId,
|
||||
input,
|
||||
) =>
|
||||
Effect.gen(function* () {
|
||||
const ttlMs = Math.min(
|
||||
Math.max(input.ttlMs ?? DEFAULT_LEASE_TTL_MS, 1_000),
|
||||
MAX_LEASE_TTL_MS,
|
||||
);
|
||||
const now = yield* DateTime.now;
|
||||
const expiresAt = DateTime.add(now, { milliseconds: ttlMs });
|
||||
const lease: ClientActivityLease = {
|
||||
sessionId,
|
||||
rpcClientId,
|
||||
clientId: input.clientId,
|
||||
clientKind: input.clientKind,
|
||||
visible: input.visible,
|
||||
focused: input.focused,
|
||||
recentlyInteracted: input.recentlyInteracted,
|
||||
...(input.appState !== undefined ? { appState: input.appState } : {}),
|
||||
...(input.lowPowerMode !== undefined ? { lowPowerMode: input.lowPowerMode } : {}),
|
||||
...(input.batteryState !== undefined ? { batteryState: input.batteryState } : {}),
|
||||
...(input.networkType !== undefined ? { networkType: input.networkType } : {}),
|
||||
scopes: input.scopes,
|
||||
updatedAt: now,
|
||||
expiresAt,
|
||||
};
|
||||
yield* Ref.update(leasesRef, (leases) => {
|
||||
const next = new Map(leases);
|
||||
next.set(`${rpcClientId}:${input.clientId}`, lease);
|
||||
return next;
|
||||
});
|
||||
yield* publishSnapshot;
|
||||
});
|
||||
|
||||
const removeRpcClient: BackgroundPolicyShape["removeRpcClient"] = (rpcClientId) =>
|
||||
Ref.update(leasesRef, (leases) => {
|
||||
const next = new Map(leases);
|
||||
for (const key of next.keys()) {
|
||||
if (key.startsWith(`${rpcClientId}:`)) {
|
||||
next.delete(key);
|
||||
}
|
||||
}
|
||||
return next;
|
||||
}).pipe(Effect.andThen(publishSnapshot), Effect.asVoid);
|
||||
|
||||
const removeSession: BackgroundPolicyShape["removeSession"] = (sessionId) =>
|
||||
Ref.update(leasesRef, (leases) => {
|
||||
const next = new Map(leases);
|
||||
for (const [key, lease] of next) {
|
||||
if (lease.sessionId === sessionId) {
|
||||
next.delete(key);
|
||||
}
|
||||
}
|
||||
return next;
|
||||
}).pipe(Effect.andThen(publishSnapshot), Effect.asVoid);
|
||||
|
||||
const hasDemand: BackgroundPolicyShape["hasDemand"] = (scope) =>
|
||||
Effect.map(snapshot, (current) => current.activeScopeKeys.includes(scopeKey(scope)));
|
||||
|
||||
const shouldRunScopeWork: BackgroundPolicyShape["shouldRunScopeWork"] = (scope) =>
|
||||
Effect.gen(function* () {
|
||||
const [current, settings] = yield* Effect.all([snapshot, backgroundActivitySettings]);
|
||||
if (isHostConstrained(current.hostPower, settings)) {
|
||||
return false;
|
||||
}
|
||||
return current.leases.some((lease) =>
|
||||
leaseMayRunScopedWork(lease, scope, current.updatedAt, settings),
|
||||
);
|
||||
});
|
||||
|
||||
const shouldRunOpportunisticWork = Effect.map(
|
||||
snapshot,
|
||||
(current) => current.shouldRunOpportunisticWork,
|
||||
);
|
||||
|
||||
yield* Stream.runForEach(hostPowerMonitor.streamChanges, () => publishSnapshot).pipe(
|
||||
Effect.forkScoped,
|
||||
);
|
||||
|
||||
yield* Effect.forever(
|
||||
Effect.sleep("15 seconds").pipe(
|
||||
Effect.andThen(
|
||||
Effect.gen(function* () {
|
||||
const now = yield* DateTime.now;
|
||||
yield* Ref.update(leasesRef, (leases) => {
|
||||
const next = new Map(leases);
|
||||
for (const [key, lease] of next) {
|
||||
if (!isLeaseActive(lease, now)) {
|
||||
next.delete(key);
|
||||
}
|
||||
}
|
||||
return next;
|
||||
});
|
||||
}),
|
||||
),
|
||||
Effect.andThen(publishSnapshot),
|
||||
),
|
||||
).pipe(Effect.forkScoped);
|
||||
|
||||
return BackgroundPolicy.of({
|
||||
reportClientActivity,
|
||||
removeRpcClient,
|
||||
removeSession,
|
||||
reportHostPowerState: hostPowerMonitor.report,
|
||||
snapshot,
|
||||
streamChanges: Stream.fromPubSub(changes),
|
||||
hasDemand,
|
||||
shouldRunScopeWork,
|
||||
shouldRunOpportunisticWork,
|
||||
});
|
||||
});
|
||||
|
||||
export const layer = Layer.effect(BackgroundPolicy, make());
|
||||
@@ -1,211 +0,0 @@
|
||||
import {
|
||||
type BackgroundBooleanState,
|
||||
type HostPowerSnapshot,
|
||||
type HostPowerThermalState,
|
||||
} from "@t3tools/contracts";
|
||||
import {
|
||||
getBackgroundActivityPresetSettings,
|
||||
resolveServerBackgroundActivitySettings,
|
||||
} from "@t3tools/shared/backgroundActivitySettings";
|
||||
import { HostProcessPlatform } from "@t3tools/shared/hostProcess";
|
||||
import * as Context from "effect/Context";
|
||||
import * as DateTime from "effect/DateTime";
|
||||
import * as Duration from "effect/Duration";
|
||||
import * as Effect from "effect/Effect";
|
||||
import * as Layer from "effect/Layer";
|
||||
import * as PubSub from "effect/PubSub";
|
||||
import * as Ref from "effect/Ref";
|
||||
import * as Stream from "effect/Stream";
|
||||
|
||||
import * as ProcessRunner from "../processRunner.ts";
|
||||
import { ServerSettingsService } from "../serverSettings.ts";
|
||||
|
||||
export interface HostPowerMonitorShape {
|
||||
readonly snapshot: Effect.Effect<HostPowerSnapshot>;
|
||||
readonly report: (snapshot: HostPowerSnapshot) => Effect.Effect<void>;
|
||||
readonly setDemandActive: (active: boolean) => Effect.Effect<void>;
|
||||
readonly streamChanges: Stream.Stream<HostPowerSnapshot>;
|
||||
}
|
||||
|
||||
export class HostPowerMonitor extends Context.Service<HostPowerMonitor, HostPowerMonitorShape>()(
|
||||
"t3/background/HostPowerMonitor",
|
||||
) {}
|
||||
|
||||
const COMMAND_TIMEOUT = Duration.seconds(3);
|
||||
|
||||
export const makeUnknownSnapshot = (
|
||||
source: HostPowerSnapshot["source"],
|
||||
updatedAt: HostPowerSnapshot["updatedAt"],
|
||||
): HostPowerSnapshot => ({
|
||||
source,
|
||||
idle: "unknown",
|
||||
idleSeconds: null,
|
||||
locked: "unknown",
|
||||
suspended: false,
|
||||
onBattery: "unknown",
|
||||
lowPowerMode: "unknown",
|
||||
thermalState: "unknown",
|
||||
stale: true,
|
||||
updatedAt,
|
||||
});
|
||||
|
||||
function boolState(value: boolean | null): BackgroundBooleanState {
|
||||
if (value === null) return "unknown";
|
||||
return value ? "true" : "false";
|
||||
}
|
||||
|
||||
function parseIdleSeconds(ioregOutput: string): number | null {
|
||||
const match = /"HIDIdleTime"\s*=\s*(\d+)/u.exec(ioregOutput);
|
||||
if (!match) return null;
|
||||
const nanoseconds = Number(match[1]);
|
||||
return Number.isFinite(nanoseconds) ? Math.floor(nanoseconds / 1_000_000_000) : null;
|
||||
}
|
||||
|
||||
function parseOnBattery(pmsetBatteryOutput: string): boolean | null {
|
||||
if (/Now drawing from 'Battery Power'/iu.test(pmsetBatteryOutput)) return true;
|
||||
if (/Now drawing from 'AC Power'/iu.test(pmsetBatteryOutput)) return false;
|
||||
return null;
|
||||
}
|
||||
|
||||
function parseLowPowerMode(pmsetOutput: string): boolean | null {
|
||||
const match = /^\s*lowpowermode\s+([01])\s*$/imu.exec(pmsetOutput);
|
||||
if (!match) return null;
|
||||
return match[1] === "1";
|
||||
}
|
||||
|
||||
function parseThermalState(_output: string): HostPowerThermalState {
|
||||
// The stable shell adapter intentionally does not parse `pmset thermlog`;
|
||||
// native adapters can provide this without depending on human-formatted text.
|
||||
return "unknown";
|
||||
}
|
||||
|
||||
function runOptional(
|
||||
runner: ProcessRunner.ProcessRunnerShape,
|
||||
command: string,
|
||||
args: ReadonlyArray<string>,
|
||||
) {
|
||||
return runner
|
||||
.run({
|
||||
command,
|
||||
args,
|
||||
timeout: COMMAND_TIMEOUT,
|
||||
timeoutBehavior: "timedOutResult",
|
||||
outputMode: "truncate",
|
||||
maxOutputBytes: 32_000,
|
||||
})
|
||||
.pipe(Effect.option);
|
||||
}
|
||||
|
||||
const readMacShellSnapshot = Effect.fn("background.hostPower.readMacShellSnapshot")(function* () {
|
||||
const runner = yield* ProcessRunner.ProcessRunner;
|
||||
const updatedAt = yield* DateTime.now;
|
||||
const [idleOutput, batteryOutput, pmsetOutput] = yield* Effect.all(
|
||||
[
|
||||
runOptional(runner, "ioreg", ["-c", "IOHIDSystem"]),
|
||||
runOptional(runner, "pmset", ["-g", "batt"]),
|
||||
runOptional(runner, "pmset", ["-g"]),
|
||||
],
|
||||
{ concurrency: "unbounded" },
|
||||
);
|
||||
|
||||
const idleSeconds = idleOutput._tag === "Some" ? parseIdleSeconds(idleOutput.value.stdout) : null;
|
||||
const onBattery =
|
||||
batteryOutput._tag === "Some" ? parseOnBattery(batteryOutput.value.stdout) : null;
|
||||
const lowPowerMode =
|
||||
pmsetOutput._tag === "Some" ? parseLowPowerMode(pmsetOutput.value.stdout) : null;
|
||||
|
||||
return {
|
||||
source: "node-macos-shell",
|
||||
idle: boolState(idleSeconds === null ? null : idleSeconds >= 60),
|
||||
idleSeconds,
|
||||
locked: "unknown",
|
||||
suspended: false,
|
||||
onBattery: boolState(onBattery),
|
||||
lowPowerMode: boolState(lowPowerMode),
|
||||
thermalState: parseThermalState(""),
|
||||
stale: false,
|
||||
updatedAt,
|
||||
} satisfies HostPowerSnapshot;
|
||||
});
|
||||
|
||||
export const make = Effect.fn("background.hostPower.make")(function* (
|
||||
initialSource: HostPowerSnapshot["source"] = "unknown",
|
||||
) {
|
||||
const initial = makeUnknownSnapshot(initialSource, yield* DateTime.now);
|
||||
const latestRef = yield* Ref.make(initial);
|
||||
const demandActiveRef = yield* Ref.make(false);
|
||||
const changes = yield* PubSub.sliding<HostPowerSnapshot>(1);
|
||||
|
||||
const report: HostPowerMonitorShape["report"] = (snapshot) =>
|
||||
Ref.set(latestRef, snapshot).pipe(
|
||||
Effect.andThen(PubSub.publish(changes, snapshot)),
|
||||
Effect.asVoid,
|
||||
);
|
||||
|
||||
return HostPowerMonitor.of({
|
||||
snapshot: Ref.get(latestRef),
|
||||
report,
|
||||
setDemandActive: (active) => Ref.set(demandActiveRef, active),
|
||||
streamChanges: Stream.fromPubSub(changes),
|
||||
});
|
||||
});
|
||||
|
||||
const unknownLayer = Layer.effect(HostPowerMonitor, make("unknown"));
|
||||
const linuxLayer = Layer.effect(HostPowerMonitor, make("node-linux"));
|
||||
const windowsLayer = Layer.effect(HostPowerMonitor, make("node-windows"));
|
||||
|
||||
const macShellLayer = Layer.effect(
|
||||
HostPowerMonitor,
|
||||
Effect.gen(function* () {
|
||||
const serverSettings = yield* ServerSettingsService;
|
||||
const monitor = yield* make("node-macos-shell");
|
||||
const demandActiveRef = yield* Ref.make(true);
|
||||
const setDemandActive: HostPowerMonitorShape["setDemandActive"] = (active) =>
|
||||
Ref.set(demandActiveRef, active);
|
||||
const getPollInterval = Effect.gen(function* () {
|
||||
const demandActive = yield* Ref.get(demandActiveRef);
|
||||
const settings = yield* serverSettings.getSettings.pipe(
|
||||
Effect.map(resolveServerBackgroundActivitySettings),
|
||||
Effect.catch(() => Effect.succeed(getBackgroundActivityPresetSettings("balanced"))),
|
||||
);
|
||||
return demandActive
|
||||
? settings.hostPowerMonitorActiveInterval
|
||||
: settings.hostPowerMonitorIdleInterval;
|
||||
});
|
||||
const adaptiveMonitor = HostPowerMonitor.of({
|
||||
snapshot: monitor.snapshot,
|
||||
report: monitor.report,
|
||||
setDemandActive,
|
||||
streamChanges: monitor.streamChanges,
|
||||
});
|
||||
yield* readMacShellSnapshot().pipe(
|
||||
Effect.flatMap(adaptiveMonitor.report),
|
||||
Effect.ignoreCause({ log: true }),
|
||||
);
|
||||
yield* Effect.forever(
|
||||
getPollInterval.pipe(
|
||||
Effect.flatMap((interval) => Effect.sleep(Duration.max(interval, Duration.seconds(5)))),
|
||||
Effect.andThen(readMacShellSnapshot()),
|
||||
Effect.flatMap(adaptiveMonitor.report),
|
||||
Effect.ignoreCause({ log: true }),
|
||||
),
|
||||
).pipe(Effect.forkScoped);
|
||||
return adaptiveMonitor;
|
||||
}),
|
||||
).pipe(Layer.provide(ProcessRunner.layer));
|
||||
|
||||
export const layer = Layer.unwrap(
|
||||
Effect.gen(function* () {
|
||||
const platform = yield* HostProcessPlatform;
|
||||
switch (platform) {
|
||||
case "darwin":
|
||||
return macShellLayer;
|
||||
case "linux":
|
||||
return linuxLayer;
|
||||
case "win32":
|
||||
return windowsLayer;
|
||||
default:
|
||||
return unknownLayer;
|
||||
}
|
||||
}),
|
||||
);
|
||||
@@ -1361,7 +1361,9 @@ export const makeGitManager = Effect.fn("makeGitManager")(function* () {
|
||||
},
|
||||
);
|
||||
const status: GitManagerShape["status"] = Effect.fn("status")(function* (input) {
|
||||
const [local, remote] = yield* Effect.all([localStatus(input), remoteStatus(input)]);
|
||||
const [local, remote] = yield* Effect.all([localStatus(input), remoteStatus(input)], {
|
||||
concurrency: "unbounded",
|
||||
});
|
||||
return mergeGitStatusParts(local, remote);
|
||||
});
|
||||
const invalidateLocalStatus: GitManagerShape["invalidateLocalStatus"] = Effect.fn(
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
import { expect, it } from "@effect/vitest";
|
||||
import { NodeHttpServer } from "@effect/platform-node";
|
||||
import { EnvironmentId, PreviewTabId, ProviderInstanceId, ThreadId } from "@t3tools/contracts";
|
||||
import * as Effect from "effect/Effect";
|
||||
import * as Layer from "effect/Layer";
|
||||
import * as Stream from "effect/Stream";
|
||||
import { McpSchema, McpServer } from "effect/unstable/ai";
|
||||
import { HttpServerResponse } from "effect/unstable/http";
|
||||
import { HttpBody, HttpClient, HttpRouter, HttpServerResponse } from "effect/unstable/http";
|
||||
|
||||
import * as McpHttpServer from "./McpHttpServer.ts";
|
||||
import * as McpInvocationContext from "./McpInvocationContext.ts";
|
||||
@@ -48,6 +49,59 @@ it("normalizes empty successful notification responses to accepted", () => {
|
||||
expect(resultResponse.status).toBe(200);
|
||||
});
|
||||
|
||||
it.effect("terminates HTTP MCP sessions with DELETE", () =>
|
||||
Effect.scoped(
|
||||
Effect.gen(function* () {
|
||||
const serverLayer = McpServer.layerHttp({
|
||||
name: "MCP termination test",
|
||||
version: "1.0.0",
|
||||
path: "/mcp",
|
||||
});
|
||||
yield* HttpRouter.serve(serverLayer, {
|
||||
disableListenLog: true,
|
||||
disableLogger: true,
|
||||
}).pipe(Layer.build);
|
||||
const httpClient = yield* HttpClient.HttpClient;
|
||||
|
||||
const initializeResponse = yield* httpClient.post("/mcp", {
|
||||
headers: { accept: "application/json, text/event-stream" },
|
||||
body: HttpBody.text(
|
||||
`{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-06-18","capabilities":{},"clientInfo":{"name":"mcp-test","version":"1.0.0"}}}`,
|
||||
"application/json",
|
||||
),
|
||||
});
|
||||
const sessionId = initializeResponse.headers["mcp-session-id"];
|
||||
expect(initializeResponse.status).toBe(200);
|
||||
expect(sessionId).not.toBeNull();
|
||||
|
||||
const missingSessionResponse = yield* httpClient.del("/mcp");
|
||||
expect(missingSessionResponse.status).toBe(400);
|
||||
|
||||
const unknownSessionResponse = yield* httpClient.del("/mcp", {
|
||||
headers: { "mcp-session-id": "unknown-session" },
|
||||
});
|
||||
expect(unknownSessionResponse.status).toBe(404);
|
||||
|
||||
const terminateResponse = yield* httpClient.del("/mcp", {
|
||||
headers: { "mcp-session-id": sessionId! },
|
||||
});
|
||||
expect(terminateResponse.status).toBe(204);
|
||||
|
||||
const reusedSessionResponse = yield* httpClient.post("/mcp", {
|
||||
headers: {
|
||||
accept: "application/json, text/event-stream",
|
||||
"mcp-session-id": sessionId!,
|
||||
},
|
||||
body: HttpBody.text(
|
||||
`{"jsonrpc":"2.0","id":2,"method":"ping","params":{}}`,
|
||||
"application/json",
|
||||
),
|
||||
});
|
||||
expect(reusedSessionResponse.status).toBe(404);
|
||||
}),
|
||||
).pipe(Effect.provide(NodeHttpServer.layerTest)),
|
||||
);
|
||||
|
||||
it.effect("registers annotated tools and preserves authenticated request context", () =>
|
||||
Effect.scoped(
|
||||
Effect.gen(function* () {
|
||||
|
||||
@@ -25,9 +25,7 @@ import { HttpClient } from "effect/unstable/http";
|
||||
import { ChildProcessSpawner } from "effect/unstable/process";
|
||||
|
||||
import { makeClaudeTextGeneration } from "../../textGeneration/ClaudeTextGeneration.ts";
|
||||
import * as BackgroundPolicy from "../../background/BackgroundPolicy.ts";
|
||||
import { ServerConfig } from "../../config.ts";
|
||||
import { ServerSettingsService } from "../../serverSettings.ts";
|
||||
import { ProviderDriverError } from "../Errors.ts";
|
||||
import { makeClaudeAdapter } from "../Layers/ClaudeAdapter.ts";
|
||||
import {
|
||||
@@ -54,6 +52,7 @@ import { makeClaudeCapabilitiesCacheKey, makeClaudeContinuationGroupKey } from "
|
||||
const decodeClaudeSettings = Schema.decodeSync(ClaudeSettings);
|
||||
|
||||
const DRIVER_KIND = ProviderDriverKind.make("claudeAgent");
|
||||
const SNAPSHOT_REFRESH_INTERVAL = Duration.minutes(5);
|
||||
const CAPABILITIES_PROBE_TTL = Duration.minutes(5);
|
||||
|
||||
function isClaudeNativeCommandPath(commandPath: string): boolean {
|
||||
@@ -78,15 +77,13 @@ const UPDATE = makePackageManagedProviderMaintenanceResolver({
|
||||
});
|
||||
|
||||
export type ClaudeDriverEnv =
|
||||
| BackgroundPolicy.BackgroundPolicy
|
||||
| ChildProcessSpawner.ChildProcessSpawner
|
||||
| Crypto.Crypto
|
||||
| FileSystem.FileSystem
|
||||
| HttpClient.HttpClient
|
||||
| Path.Path
|
||||
| ProviderEventLoggers
|
||||
| ServerConfig
|
||||
| ServerSettingsService;
|
||||
| ServerConfig;
|
||||
|
||||
const withInstanceIdentity =
|
||||
(input: {
|
||||
@@ -179,6 +176,7 @@ export const ClaudeDriver: ProviderDriver<ClaudeSettings, ClaudeDriverEnv> = {
|
||||
Effect.provideService(HttpClient.HttpClient, httpClient),
|
||||
Effect.flatMap((enrichedSnapshot) => publishSnapshot(enrichedSnapshot)),
|
||||
),
|
||||
refreshInterval: SNAPSHOT_REFRESH_INTERVAL,
|
||||
}).pipe(
|
||||
Effect.mapError(
|
||||
(cause) =>
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
* @module provider/Drivers/CodexDriver
|
||||
*/
|
||||
import { CodexSettings, ProviderDriverKind, type ServerProvider } from "@t3tools/contracts";
|
||||
import * as Duration from "effect/Duration";
|
||||
import * as Crypto from "effect/Crypto";
|
||||
import * as Effect from "effect/Effect";
|
||||
import * as FileSystem from "effect/FileSystem";
|
||||
@@ -32,9 +33,7 @@ import { HttpClient } from "effect/unstable/http";
|
||||
import { ChildProcessSpawner } from "effect/unstable/process";
|
||||
|
||||
import { makeCodexTextGeneration } from "../../textGeneration/CodexTextGeneration.ts";
|
||||
import * as BackgroundPolicy from "../../background/BackgroundPolicy.ts";
|
||||
import { ServerConfig } from "../../config.ts";
|
||||
import { ServerSettingsService } from "../../serverSettings.ts";
|
||||
import { ProviderDriverError } from "../Errors.ts";
|
||||
import { makeCodexAdapter } from "../Layers/CodexAdapter.ts";
|
||||
import { checkCodexProviderStatus, makePendingCodexProvider } from "../Layers/CodexProvider.ts";
|
||||
@@ -56,6 +55,7 @@ import {
|
||||
const decodeCodexSettings = Schema.decodeSync(CodexSettings);
|
||||
|
||||
const DRIVER_KIND = ProviderDriverKind.make("codex");
|
||||
const SNAPSHOT_REFRESH_INTERVAL = Duration.minutes(5);
|
||||
const UPDATE = makePackageManagedProviderMaintenanceResolver({
|
||||
provider: DRIVER_KIND,
|
||||
npmPackageName: "@openai/codex",
|
||||
@@ -69,15 +69,13 @@ const UPDATE = makePackageManagedProviderMaintenanceResolver({
|
||||
* registered driver and the runtime satisfies them once.
|
||||
*/
|
||||
export type CodexDriverEnv =
|
||||
| BackgroundPolicy.BackgroundPolicy
|
||||
| ChildProcessSpawner.ChildProcessSpawner
|
||||
| Crypto.Crypto
|
||||
| FileSystem.FileSystem
|
||||
| HttpClient.HttpClient
|
||||
| Path.Path
|
||||
| ProviderEventLoggers
|
||||
| ServerConfig
|
||||
| ServerSettingsService;
|
||||
| ServerConfig;
|
||||
|
||||
/**
|
||||
* Stamp instance identity onto a `ServerProvider` snapshot produced by the
|
||||
@@ -178,6 +176,7 @@ export const CodexDriver: ProviderDriver<CodexSettings, CodexDriverEnv> = {
|
||||
Effect.provideService(HttpClient.HttpClient, httpClient),
|
||||
Effect.flatMap((enrichedSnapshot) => publishSnapshot(enrichedSnapshot)),
|
||||
),
|
||||
refreshInterval: SNAPSHOT_REFRESH_INTERVAL,
|
||||
}).pipe(
|
||||
Effect.mapError(
|
||||
(cause) =>
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
* @module provider/Drivers/CursorDriver
|
||||
*/
|
||||
import { CursorSettings, ProviderDriverKind, type ServerProvider } from "@t3tools/contracts";
|
||||
import * as Duration from "effect/Duration";
|
||||
import * as Crypto from "effect/Crypto";
|
||||
import * as Effect from "effect/Effect";
|
||||
import * as FileSystem from "effect/FileSystem";
|
||||
@@ -22,8 +23,6 @@ import { HttpClient } from "effect/unstable/http";
|
||||
import { ChildProcessSpawner } from "effect/unstable/process";
|
||||
|
||||
import { ServerConfig } from "../../config.ts";
|
||||
import * as BackgroundPolicy from "../../background/BackgroundPolicy.ts";
|
||||
import { ServerSettingsService } from "../../serverSettings.ts";
|
||||
import { makeCursorTextGeneration } from "../../textGeneration/CursorTextGeneration.ts";
|
||||
import { ProviderDriverError } from "../Errors.ts";
|
||||
import { makeCursorAdapter } from "../Layers/CursorAdapter.ts";
|
||||
@@ -49,6 +48,7 @@ import {
|
||||
const decodeCursorSettings = Schema.decodeSync(CursorSettings);
|
||||
|
||||
const DRIVER_KIND = ProviderDriverKind.make("cursor");
|
||||
const SNAPSHOT_REFRESH_INTERVAL = Duration.minutes(5);
|
||||
const UPDATE = makeStaticProviderMaintenanceResolver(
|
||||
makeProviderMaintenanceCapabilities({
|
||||
provider: DRIVER_KIND,
|
||||
@@ -60,15 +60,13 @@ const UPDATE = makeStaticProviderMaintenanceResolver(
|
||||
);
|
||||
|
||||
export type CursorDriverEnv =
|
||||
| BackgroundPolicy.BackgroundPolicy
|
||||
| ChildProcessSpawner.ChildProcessSpawner
|
||||
| Crypto.Crypto
|
||||
| FileSystem.FileSystem
|
||||
| HttpClient.HttpClient
|
||||
| Path.Path
|
||||
| ProviderEventLoggers
|
||||
| ServerConfig
|
||||
| ServerSettingsService;
|
||||
| ServerConfig;
|
||||
|
||||
const withInstanceIdentity =
|
||||
(input: {
|
||||
@@ -150,7 +148,8 @@ export const CursorDriver: ProviderDriver<CursorSettings, CursorDriverEnv> = {
|
||||
publishSnapshot,
|
||||
stampIdentity,
|
||||
httpClient,
|
||||
}).pipe(Effect.provideService(ChildProcessSpawner.ChildProcessSpawner, spawner)),
|
||||
}),
|
||||
refreshInterval: SNAPSHOT_REFRESH_INTERVAL,
|
||||
}).pipe(
|
||||
Effect.mapError(
|
||||
(cause) =>
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { GrokSettings, ProviderDriverKind, type ServerProvider } from "@t3tools/contracts";
|
||||
import * as Duration from "effect/Duration";
|
||||
import * as Crypto from "effect/Crypto";
|
||||
import * as Effect from "effect/Effect";
|
||||
import * as FileSystem from "effect/FileSystem";
|
||||
@@ -8,9 +9,7 @@ import * as Stream from "effect/Stream";
|
||||
import { HttpClient } from "effect/unstable/http";
|
||||
import { ChildProcessSpawner } from "effect/unstable/process";
|
||||
|
||||
import * as BackgroundPolicy from "../../background/BackgroundPolicy.ts";
|
||||
import { ServerConfig } from "../../config.ts";
|
||||
import { ServerSettingsService } from "../../serverSettings.ts";
|
||||
import { makeGrokTextGeneration } from "../../textGeneration/GrokTextGeneration.ts";
|
||||
import { ProviderDriverError } from "../Errors.ts";
|
||||
import { makeGrokAdapter } from "../Layers/GrokAdapter.ts";
|
||||
@@ -36,6 +35,7 @@ import {
|
||||
const decodeGrokSettings = Schema.decodeSync(GrokSettings);
|
||||
|
||||
const DRIVER_KIND = ProviderDriverKind.make("grok");
|
||||
const SNAPSHOT_REFRESH_INTERVAL = Duration.minutes(5);
|
||||
const UPDATE = makeStaticProviderMaintenanceResolver(
|
||||
makeManualOnlyProviderMaintenanceCapabilities({
|
||||
provider: DRIVER_KIND,
|
||||
@@ -44,15 +44,13 @@ const UPDATE = makeStaticProviderMaintenanceResolver(
|
||||
);
|
||||
|
||||
export type GrokDriverEnv =
|
||||
| BackgroundPolicy.BackgroundPolicy
|
||||
| ChildProcessSpawner.ChildProcessSpawner
|
||||
| Crypto.Crypto
|
||||
| FileSystem.FileSystem
|
||||
| HttpClient.HttpClient
|
||||
| Path.Path
|
||||
| ProviderEventLoggers
|
||||
| ServerConfig
|
||||
| ServerSettingsService;
|
||||
| ServerConfig;
|
||||
|
||||
const withInstanceIdentity =
|
||||
(input: {
|
||||
@@ -127,6 +125,7 @@ export const GrokDriver: ProviderDriver<GrokSettings, GrokDriverEnv> = {
|
||||
publishSnapshot,
|
||||
httpClient,
|
||||
}),
|
||||
refreshInterval: SNAPSHOT_REFRESH_INTERVAL,
|
||||
}).pipe(
|
||||
Effect.mapError(
|
||||
(cause) =>
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
* @module provider/Drivers/OpenCodeDriver
|
||||
*/
|
||||
import { OpenCodeSettings, ProviderDriverKind, type ServerProvider } from "@t3tools/contracts";
|
||||
import * as Duration from "effect/Duration";
|
||||
import * as Crypto from "effect/Crypto";
|
||||
import * as Effect from "effect/Effect";
|
||||
import * as FileSystem from "effect/FileSystem";
|
||||
@@ -23,9 +24,7 @@ import { HttpClient } from "effect/unstable/http";
|
||||
import { ChildProcessSpawner } from "effect/unstable/process";
|
||||
|
||||
import { makeOpenCodeTextGeneration } from "../../textGeneration/OpenCodeTextGeneration.ts";
|
||||
import * as BackgroundPolicy from "../../background/BackgroundPolicy.ts";
|
||||
import { ServerConfig } from "../../config.ts";
|
||||
import { ServerSettingsService } from "../../serverSettings.ts";
|
||||
import { ProviderDriverError } from "../Errors.ts";
|
||||
import { makeOpenCodeAdapter } from "../Layers/OpenCodeAdapter.ts";
|
||||
import {
|
||||
@@ -51,6 +50,7 @@ import {
|
||||
const decodeOpenCodeSettings = Schema.decodeSync(OpenCodeSettings);
|
||||
|
||||
const DRIVER_KIND = ProviderDriverKind.make("opencode");
|
||||
const SNAPSHOT_REFRESH_INTERVAL = Duration.minutes(5);
|
||||
|
||||
function isOpenCodeNativeCommandPath(commandPath: string): boolean {
|
||||
const normalized = normalizeCommandPath(commandPath);
|
||||
@@ -73,7 +73,6 @@ const UPDATE = makePackageManagedProviderMaintenanceResolver({
|
||||
});
|
||||
|
||||
export type OpenCodeDriverEnv =
|
||||
| BackgroundPolicy.BackgroundPolicy
|
||||
| ChildProcessSpawner.ChildProcessSpawner
|
||||
| Crypto.Crypto
|
||||
| FileSystem.FileSystem
|
||||
@@ -81,8 +80,7 @@ export type OpenCodeDriverEnv =
|
||||
| OpenCodeRuntime
|
||||
| Path.Path
|
||||
| ProviderEventLoggers
|
||||
| ServerConfig
|
||||
| ServerSettingsService;
|
||||
| ServerConfig;
|
||||
|
||||
const withInstanceIdentity =
|
||||
(input: {
|
||||
@@ -157,6 +155,7 @@ export const OpenCodeDriver: ProviderDriver<OpenCodeSettings, OpenCodeDriverEnv>
|
||||
Effect.provideService(HttpClient.HttpClient, httpClient),
|
||||
Effect.flatMap((enrichedSnapshot) => publishSnapshot(enrichedSnapshot)),
|
||||
),
|
||||
refreshInterval: SNAPSHOT_REFRESH_INTERVAL,
|
||||
}).pipe(
|
||||
Effect.mapError(
|
||||
(cause) =>
|
||||
|
||||
@@ -34,15 +34,11 @@ import {
|
||||
type ProviderInstanceConfigMap,
|
||||
ProviderInstanceId,
|
||||
} from "@t3tools/contracts";
|
||||
import * as DateTime from "effect/DateTime";
|
||||
import * as Effect from "effect/Effect";
|
||||
import * as Layer from "effect/Layer";
|
||||
import * as Stream from "effect/Stream";
|
||||
import { HttpClient, HttpClientResponse } from "effect/unstable/http";
|
||||
|
||||
import * as BackgroundPolicy from "../../background/BackgroundPolicy.ts";
|
||||
import { ServerConfig } from "../../config.ts";
|
||||
import { ServerSettingsService } from "../../serverSettings.ts";
|
||||
import { ClaudeDriver } from "../Drivers/ClaudeDriver.ts";
|
||||
import { CodexDriver } from "../Drivers/CodexDriver.ts";
|
||||
import { CursorDriver } from "../Drivers/CursorDriver.ts";
|
||||
@@ -59,38 +55,6 @@ const TestHttpClientLive = Layer.succeed(
|
||||
),
|
||||
);
|
||||
|
||||
const TEST_EPOCH = DateTime.makeUnsafe("1970-01-01T00:00:00.000Z");
|
||||
|
||||
const BackgroundPolicyAlwaysRunLayer = Layer.mock(BackgroundPolicy.BackgroundPolicy)({
|
||||
reportClientActivity: () => Effect.void,
|
||||
removeRpcClient: () => Effect.void,
|
||||
removeSession: () => Effect.void,
|
||||
reportHostPowerState: () => Effect.void,
|
||||
snapshot: Effect.succeed({
|
||||
hostPower: {
|
||||
source: "unknown",
|
||||
idle: "unknown",
|
||||
idleSeconds: null,
|
||||
locked: "unknown",
|
||||
suspended: false,
|
||||
onBattery: "unknown",
|
||||
lowPowerMode: "unknown",
|
||||
thermalState: "unknown",
|
||||
stale: true,
|
||||
updatedAt: TEST_EPOCH,
|
||||
},
|
||||
leases: [],
|
||||
activeForegroundLeaseCount: 0,
|
||||
activeScopeKeys: [],
|
||||
shouldRunOpportunisticWork: true,
|
||||
updatedAt: TEST_EPOCH,
|
||||
}),
|
||||
streamChanges: Stream.empty,
|
||||
hasDemand: () => Effect.succeed(true),
|
||||
shouldRunScopeWork: () => Effect.succeed(true),
|
||||
shouldRunOpportunisticWork: Effect.succeed(true),
|
||||
});
|
||||
|
||||
const makeCodexConfig = (overrides: Partial<CodexSettings>): CodexSettings => ({
|
||||
enabled: false,
|
||||
binaryPath: "codex",
|
||||
@@ -143,8 +107,6 @@ describe("ProviderInstanceRegistryLive — multi-instance codex slice", () => {
|
||||
prefix: "provider-instance-registry-test",
|
||||
}).pipe(
|
||||
Layer.provideMerge(NodeServices.layer),
|
||||
Layer.provideMerge(BackgroundPolicyAlwaysRunLayer),
|
||||
Layer.provideMerge(ServerSettingsService.layerTest()),
|
||||
Layer.provideMerge(TestHttpClientLive),
|
||||
Layer.provideMerge(Layer.succeed(ProviderEventLoggers, NoOpProviderEventLoggers)),
|
||||
);
|
||||
@@ -282,8 +244,6 @@ describe("ProviderInstanceRegistryLive — all drivers slice", () => {
|
||||
prefix: "provider-instance-registry-all-drivers-test",
|
||||
}).pipe(
|
||||
Layer.provideMerge(infraLayer),
|
||||
Layer.provideMerge(BackgroundPolicyAlwaysRunLayer),
|
||||
Layer.provideMerge(ServerSettingsService.layerTest()),
|
||||
Layer.provideMerge(TestHttpClientLive),
|
||||
Layer.provideMerge(Layer.succeed(ProviderEventLoggers, NoOpProviderEventLoggers)),
|
||||
);
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import * as NodeServices from "@effect/platform-node/NodeServices";
|
||||
import { describe, it, assert } from "@effect/vitest";
|
||||
import * as DateTime from "effect/DateTime";
|
||||
import * as Effect from "effect/Effect";
|
||||
import * as Exit from "effect/Exit";
|
||||
import * as Fiber from "effect/Fiber";
|
||||
@@ -33,7 +32,6 @@ import { applyServerSettingsPatch } from "@t3tools/shared/serverSettings";
|
||||
|
||||
import { checkCodexProviderStatus, type CodexAppServerProviderSnapshot } from "./CodexProvider.ts";
|
||||
import { checkClaudeProviderStatus } from "./ClaudeProvider.ts";
|
||||
import * as BackgroundPolicy from "../../background/BackgroundPolicy.ts";
|
||||
import { OpenCodeRuntimeLive } from "../opencodeRuntime.ts";
|
||||
import { NoOpProviderEventLoggers, ProviderEventLoggers } from "./ProviderEventLoggers.ts";
|
||||
import { ProviderInstanceRegistryHydrationLive } from "./ProviderInstanceRegistryHydration.ts";
|
||||
@@ -66,7 +64,6 @@ process.env.T3CODE_CURSOR_ENABLED = "1";
|
||||
// ── Test helpers ────────────────────────────────────────────────────
|
||||
|
||||
const encoder = new TextEncoder();
|
||||
const TEST_EPOCH = DateTime.makeUnsafe("1970-01-01T00:00:00.000Z");
|
||||
|
||||
const TestHttpClientLive = Layer.succeed(
|
||||
HttpClient.HttpClient,
|
||||
@@ -75,36 +72,6 @@ const TestHttpClientLive = Layer.succeed(
|
||||
),
|
||||
);
|
||||
|
||||
const BackgroundPolicyAlwaysRunLayer = Layer.mock(BackgroundPolicy.BackgroundPolicy)({
|
||||
reportClientActivity: () => Effect.void,
|
||||
removeRpcClient: () => Effect.void,
|
||||
removeSession: () => Effect.void,
|
||||
reportHostPowerState: () => Effect.void,
|
||||
snapshot: Effect.succeed({
|
||||
hostPower: {
|
||||
source: "unknown",
|
||||
idle: "unknown",
|
||||
idleSeconds: null,
|
||||
locked: "unknown",
|
||||
suspended: false,
|
||||
onBattery: "unknown",
|
||||
lowPowerMode: "unknown",
|
||||
thermalState: "unknown",
|
||||
stale: true,
|
||||
updatedAt: TEST_EPOCH,
|
||||
},
|
||||
leases: [],
|
||||
activeForegroundLeaseCount: 0,
|
||||
activeScopeKeys: [],
|
||||
shouldRunOpportunisticWork: true,
|
||||
updatedAt: TEST_EPOCH,
|
||||
}),
|
||||
streamChanges: Stream.empty,
|
||||
hasDemand: () => Effect.succeed(true),
|
||||
shouldRunScopeWork: () => Effect.succeed(true),
|
||||
shouldRunOpportunisticWork: Effect.succeed(true),
|
||||
});
|
||||
|
||||
function selectDescriptor(
|
||||
id: string,
|
||||
label: string,
|
||||
@@ -839,7 +806,6 @@ it.layer(Layer.mergeAll(NodeServices.layer, ServerSettingsService.layerTest(), T
|
||||
prefix: "t3-provider-registry-merged-persist-",
|
||||
}),
|
||||
),
|
||||
Layer.provideMerge(BackgroundPolicyAlwaysRunLayer),
|
||||
Layer.provideMerge(NodeServices.layer),
|
||||
),
|
||||
).pipe(Scope.provide(scope));
|
||||
@@ -934,7 +900,6 @@ it.layer(Layer.mergeAll(NodeServices.layer, ServerSettingsService.layerTest(), T
|
||||
prefix: "t3-provider-registry-refresh-failure-",
|
||||
}),
|
||||
),
|
||||
Layer.provideMerge(BackgroundPolicyAlwaysRunLayer),
|
||||
Layer.provideMerge(NodeServices.layer),
|
||||
),
|
||||
).pipe(Scope.provide(scope));
|
||||
@@ -1039,7 +1004,6 @@ it.layer(Layer.mergeAll(NodeServices.layer, ServerSettingsService.layerTest(), T
|
||||
prefix: "t3-provider-registry-sync-failure-",
|
||||
}),
|
||||
),
|
||||
Layer.provideMerge(BackgroundPolicyAlwaysRunLayer),
|
||||
Layer.provideMerge(NodeServices.layer),
|
||||
),
|
||||
).pipe(Scope.provide(scope));
|
||||
@@ -1137,7 +1101,6 @@ it.layer(Layer.mergeAll(NodeServices.layer, ServerSettingsService.layerTest(), T
|
||||
Layer.provideMerge(TestHttpClientLive),
|
||||
Layer.provideMerge(Layer.succeed(ProviderEventLoggers, NoOpProviderEventLoggers)),
|
||||
Layer.provideMerge(OpenCodeRuntimeLive),
|
||||
Layer.provideMerge(BackgroundPolicyAlwaysRunLayer),
|
||||
// NO spawner mock — `ChildProcessSpawner` is supplied by the
|
||||
// outer `NodeServices.layer` on `it.layer(...)` and will
|
||||
// genuinely spawn a subprocess. The missing-binary ENOENT is
|
||||
@@ -1230,7 +1193,6 @@ it.layer(Layer.mergeAll(NodeServices.layer, ServerSettingsService.layerTest(), T
|
||||
}),
|
||||
),
|
||||
Layer.provideMerge(NodeServices.layer),
|
||||
Layer.provideMerge(BackgroundPolicyAlwaysRunLayer),
|
||||
);
|
||||
const runtimeServices = yield* Layer.build(providerRegistryLayer).pipe(
|
||||
Scope.provide(scope),
|
||||
@@ -1339,7 +1301,6 @@ it.layer(Layer.mergeAll(NodeServices.layer, ServerSettingsService.layerTest(), T
|
||||
Layer.provideMerge(Layer.succeed(ProviderEventLoggers, NoOpProviderEventLoggers)),
|
||||
Layer.provideMerge(OpenCodeRuntimeLive),
|
||||
Layer.provideMerge(NodeServices.layer),
|
||||
Layer.provideMerge(BackgroundPolicyAlwaysRunLayer),
|
||||
);
|
||||
const runtimeServices = yield* Layer.build(providerRegistryLayer).pipe(
|
||||
Scope.provide(scope),
|
||||
@@ -1393,7 +1354,6 @@ it.layer(Layer.mergeAll(NodeServices.layer, ServerSettingsService.layerTest(), T
|
||||
Layer.provideMerge(TestHttpClientLive),
|
||||
Layer.provideMerge(Layer.succeed(ProviderEventLoggers, NoOpProviderEventLoggers)),
|
||||
Layer.provideMerge(OpenCodeRuntimeLive),
|
||||
Layer.provideMerge(BackgroundPolicyAlwaysRunLayer),
|
||||
Layer.provideMerge(
|
||||
mockCommandSpawnerLayer((command, args) => {
|
||||
if (command === "agent") {
|
||||
|
||||
@@ -1,22 +1,16 @@
|
||||
import { describe, it, assert } from "@effect/vitest";
|
||||
import { ProviderDriverKind, ProviderInstanceId, type ServerProvider } from "@t3tools/contracts";
|
||||
import { createModelCapabilities } from "@t3tools/shared/model";
|
||||
import * as DateTime from "effect/DateTime";
|
||||
import * as Deferred from "effect/Deferred";
|
||||
import * as Effect from "effect/Effect";
|
||||
import * as Fiber from "effect/Fiber";
|
||||
import * as Layer from "effect/Layer";
|
||||
import * as PubSub from "effect/PubSub";
|
||||
import * as Ref from "effect/Ref";
|
||||
import * as Stream from "effect/Stream";
|
||||
import { TestClock } from "effect/testing";
|
||||
|
||||
import * as BackgroundPolicy from "../background/BackgroundPolicy.ts";
|
||||
import { ServerSettingsService } from "../serverSettings.ts";
|
||||
import { makeManagedServerProvider } from "./makeManagedServerProvider.ts";
|
||||
|
||||
const emptyCapabilities = createModelCapabilities({ optionDescriptors: [] });
|
||||
const TEST_EPOCH = DateTime.makeUnsafe("1970-01-01T00:00:00.000Z");
|
||||
const fastModeCapabilities = createModelCapabilities({
|
||||
optionDescriptors: [
|
||||
{
|
||||
@@ -93,44 +87,6 @@ const refreshedSnapshotSecond: ServerProvider = {
|
||||
message: "Refreshed provider availability again.",
|
||||
};
|
||||
|
||||
function makeBackgroundPolicyLayer(shouldRunScopeWork: boolean) {
|
||||
return Layer.mock(BackgroundPolicy.BackgroundPolicy)({
|
||||
reportClientActivity: () => Effect.void,
|
||||
removeRpcClient: () => Effect.void,
|
||||
removeSession: () => Effect.void,
|
||||
reportHostPowerState: () => Effect.void,
|
||||
snapshot: Effect.succeed({
|
||||
hostPower: {
|
||||
source: "unknown",
|
||||
idle: "unknown",
|
||||
idleSeconds: null,
|
||||
locked: "unknown",
|
||||
suspended: false,
|
||||
onBattery: "unknown",
|
||||
lowPowerMode: "unknown",
|
||||
thermalState: "unknown",
|
||||
stale: true,
|
||||
updatedAt: TEST_EPOCH,
|
||||
},
|
||||
leases: [],
|
||||
activeForegroundLeaseCount: 0,
|
||||
activeScopeKeys: [],
|
||||
shouldRunOpportunisticWork: true,
|
||||
updatedAt: TEST_EPOCH,
|
||||
}),
|
||||
streamChanges: Stream.empty,
|
||||
hasDemand: () => Effect.succeed(shouldRunScopeWork),
|
||||
shouldRunScopeWork: () => Effect.succeed(shouldRunScopeWork),
|
||||
shouldRunOpportunisticWork: Effect.succeed(shouldRunScopeWork),
|
||||
});
|
||||
}
|
||||
|
||||
const BackgroundPolicyAlwaysRunLayer = makeBackgroundPolicyLayer(true);
|
||||
const BackgroundPolicyNeverRunLayer = makeBackgroundPolicyLayer(false);
|
||||
const ServerSettingsTestLayer = ServerSettingsService.layerTest();
|
||||
const AlwaysRunTestLayer = Layer.merge(BackgroundPolicyAlwaysRunLayer, ServerSettingsTestLayer);
|
||||
const NeverRunTestLayer = Layer.merge(BackgroundPolicyNeverRunLayer, ServerSettingsTestLayer);
|
||||
|
||||
const enrichedSnapshotSecond: ServerProvider = {
|
||||
...refreshedSnapshotSecond,
|
||||
checkedAt: "2026-04-10T00:00:04.000Z",
|
||||
@@ -184,38 +140,7 @@ describe("makeManagedServerProvider", () => {
|
||||
assert.deepStrictEqual(latest, refreshedSnapshot);
|
||||
assert.strictEqual(yield* Ref.get(checkCalls), 1);
|
||||
}),
|
||||
).pipe(Effect.provide(AlwaysRunTestLayer)),
|
||||
);
|
||||
|
||||
it.effect("skips periodic provider refreshes without foreground provider-status demand", () =>
|
||||
Effect.scoped(
|
||||
Effect.gen(function* () {
|
||||
const checkCalls = yield* Ref.make(0);
|
||||
const initialCheckDone = yield* Deferred.make<void>();
|
||||
yield* makeManagedServerProvider<TestSettings>({
|
||||
maintenanceCapabilities,
|
||||
getSettings: Effect.succeed({ enabled: true }),
|
||||
streamSettings: Stream.empty,
|
||||
haveSettingsChanged: (previous, next) => previous.enabled !== next.enabled,
|
||||
initialSnapshot: () => Effect.succeed(initialSnapshot),
|
||||
checkProvider: Ref.updateAndGet(checkCalls, (count) => count + 1).pipe(
|
||||
Effect.tap((count) =>
|
||||
count === 1
|
||||
? Deferred.succeed(initialCheckDone, undefined).pipe(Effect.ignore)
|
||||
: Effect.void,
|
||||
),
|
||||
Effect.as(refreshedSnapshot),
|
||||
),
|
||||
refreshInterval: "1 second",
|
||||
});
|
||||
|
||||
yield* Deferred.await(initialCheckDone);
|
||||
yield* TestClock.adjust("1 second");
|
||||
yield* Effect.yieldNow;
|
||||
|
||||
assert.strictEqual(yield* Ref.get(checkCalls), 1);
|
||||
}),
|
||||
).pipe(Effect.provide(Layer.mergeAll(NeverRunTestLayer, TestClock.layer()))),
|
||||
),
|
||||
);
|
||||
|
||||
it.effect("reruns the provider check when streamed settings change", () =>
|
||||
@@ -260,7 +185,7 @@ describe("makeManagedServerProvider", () => {
|
||||
assert.deepStrictEqual(latest, refreshedSnapshotSecond);
|
||||
assert.strictEqual(yield* Ref.get(checkCalls), 2);
|
||||
}),
|
||||
).pipe(Effect.provide(AlwaysRunTestLayer)),
|
||||
),
|
||||
);
|
||||
|
||||
it.effect("streams supplemental snapshot updates after the base provider check completes", () =>
|
||||
@@ -298,7 +223,7 @@ describe("makeManagedServerProvider", () => {
|
||||
assert.deepStrictEqual(updates, [refreshedSnapshot, enrichedSnapshot]);
|
||||
assert.deepStrictEqual(latest, enrichedSnapshot);
|
||||
}),
|
||||
).pipe(Effect.provide(AlwaysRunTestLayer)),
|
||||
),
|
||||
);
|
||||
|
||||
it.effect("ignores stale enrichment callbacks after a newer refresh advances generation", () =>
|
||||
@@ -359,6 +284,6 @@ describe("makeManagedServerProvider", () => {
|
||||
]);
|
||||
assert.deepStrictEqual(latest, enrichedSnapshotSecond);
|
||||
}),
|
||||
).pipe(Effect.provide(AlwaysRunTestLayer)),
|
||||
),
|
||||
);
|
||||
});
|
||||
@@ -1,9 +1,4 @@
|
||||
import {
|
||||
DEFAULT_PROVIDER_HEALTH_REFRESH_INTERVAL,
|
||||
type ServerProvider,
|
||||
ServerSettingsError,
|
||||
} from "@t3tools/contracts";
|
||||
import { resolveServerBackgroundActivitySettings } from "@t3tools/shared/backgroundActivitySettings";
|
||||
import type { ServerProvider } from "@t3tools/contracts";
|
||||
import * as Duration from "effect/Duration";
|
||||
import * as Effect from "effect/Effect";
|
||||
import * as Equal from "effect/Equal";
|
||||
@@ -14,9 +9,8 @@ import * as Scope from "effect/Scope";
|
||||
import * as Stream from "effect/Stream";
|
||||
import * as Semaphore from "effect/Semaphore";
|
||||
|
||||
import * as BackgroundPolicy from "../background/BackgroundPolicy.ts";
|
||||
import { ServerSettingsService } from "../serverSettings.ts";
|
||||
import type { ServerProviderShape } from "./Services/ServerProvider.ts";
|
||||
import { ServerSettingsError } from "@t3tools/contracts";
|
||||
|
||||
interface ProviderSnapshotState {
|
||||
readonly snapshot: ServerProvider;
|
||||
@@ -39,13 +33,7 @@ export const makeManagedServerProvider = Effect.fn("makeManagedServerProvider")(
|
||||
readonly publishSnapshot: (snapshot: ServerProvider) => Effect.Effect<void>;
|
||||
}) => Effect.Effect<void>;
|
||||
readonly refreshInterval?: Duration.Input;
|
||||
}): Effect.fn.Return<
|
||||
ServerProviderShape,
|
||||
ServerSettingsError,
|
||||
Scope.Scope | BackgroundPolicy.BackgroundPolicy | ServerSettingsService
|
||||
> {
|
||||
const backgroundPolicy = yield* BackgroundPolicy.BackgroundPolicy;
|
||||
const serverSettings = yield* ServerSettingsService;
|
||||
}): Effect.fn.Return<ServerProviderShape, ServerSettingsError, Scope.Scope> {
|
||||
const refreshSemaphore = yield* Semaphore.make(1);
|
||||
const changesPubSub = yield* Effect.acquireRelease(
|
||||
PubSub.unbounded<ServerProvider>(),
|
||||
@@ -146,45 +134,13 @@ export const makeManagedServerProvider = Effect.fn("makeManagedServerProvider")(
|
||||
return yield* applySnapshot(nextSettings, { forceRefresh: true });
|
||||
});
|
||||
|
||||
const hasProviderStatusDemand = Effect.gen(function* () {
|
||||
const state = yield* Ref.get(snapshotStateRef);
|
||||
const instanceId = state.snapshot.instanceId;
|
||||
const [genericDemand, instanceDemand] = yield* Effect.all([
|
||||
backgroundPolicy.shouldRunScopeWork({ type: "provider-status" }),
|
||||
backgroundPolicy.shouldRunScopeWork({ type: "provider-status", instanceId }),
|
||||
]);
|
||||
return genericDemand || instanceDemand;
|
||||
});
|
||||
|
||||
const getRefreshInterval = input.refreshInterval
|
||||
? Effect.succeed(input.refreshInterval)
|
||||
: serverSettings.getSettings.pipe(
|
||||
Effect.map(
|
||||
(settings) =>
|
||||
resolveServerBackgroundActivitySettings(settings).providerHealthRefreshInterval,
|
||||
),
|
||||
Effect.catch(() => Effect.succeed(DEFAULT_PROVIDER_HEALTH_REFRESH_INTERVAL)),
|
||||
);
|
||||
|
||||
yield* Stream.runForEach(input.streamSettings, (nextSettings) =>
|
||||
Effect.asVoid(applySnapshot(nextSettings)),
|
||||
).pipe(Effect.forkScoped);
|
||||
|
||||
yield* Effect.forever(
|
||||
getRefreshInterval.pipe(
|
||||
Effect.flatMap((refreshInterval) =>
|
||||
Duration.toMillis(Duration.fromInputUnsafe(refreshInterval)) <= 0
|
||||
? Effect.sleep("60 seconds")
|
||||
: Effect.sleep(refreshInterval).pipe(
|
||||
Effect.flatMap(() =>
|
||||
hasProviderStatusDemand.pipe(
|
||||
Effect.flatMap((shouldRefresh) =>
|
||||
shouldRefresh ? refreshSnapshot().pipe(Effect.asVoid) : Effect.void,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
Effect.sleep(input.refreshInterval ?? "60 seconds").pipe(
|
||||
Effect.flatMap(() => refreshSnapshot()),
|
||||
Effect.ignoreCause({ log: true }),
|
||||
),
|
||||
).pipe(Effect.forkScoped);
|
||||
|
||||
@@ -69,7 +69,6 @@ import { vi } from "vite-plus/test";
|
||||
|
||||
const TEST_EPOCH = DateTime.makeUnsafe("1970-01-01T00:00:00.000Z");
|
||||
|
||||
import * as BackgroundPolicy from "./background/BackgroundPolicy.ts";
|
||||
import type { ServerConfigShape } from "./config.ts";
|
||||
import { deriveServerPaths, ServerConfig } from "./config.ts";
|
||||
import { makeRoutesLayer } from "./server.ts";
|
||||
@@ -773,37 +772,6 @@ const buildAppUnderTest = (options?: {
|
||||
...options?.layers?.serverRuntimeStartup,
|
||||
}),
|
||||
),
|
||||
Layer.provide(
|
||||
Layer.mock(BackgroundPolicy.BackgroundPolicy)({
|
||||
reportClientActivity: () => Effect.void,
|
||||
removeRpcClient: () => Effect.void,
|
||||
removeSession: () => Effect.void,
|
||||
reportHostPowerState: () => Effect.void,
|
||||
snapshot: Effect.succeed({
|
||||
hostPower: {
|
||||
source: "unknown",
|
||||
idle: "unknown",
|
||||
idleSeconds: null,
|
||||
locked: "unknown",
|
||||
suspended: false,
|
||||
onBattery: "unknown",
|
||||
lowPowerMode: "unknown",
|
||||
thermalState: "unknown",
|
||||
stale: true,
|
||||
updatedAt: TEST_EPOCH,
|
||||
},
|
||||
leases: [],
|
||||
activeForegroundLeaseCount: 0,
|
||||
activeScopeKeys: [],
|
||||
shouldRunOpportunisticWork: false,
|
||||
updatedAt: TEST_EPOCH,
|
||||
}),
|
||||
streamChanges: Stream.empty,
|
||||
hasDemand: () => Effect.succeed(false),
|
||||
shouldRunScopeWork: () => Effect.succeed(false),
|
||||
shouldRunOpportunisticWork: Effect.succeed(false),
|
||||
}),
|
||||
),
|
||||
Layer.provide(
|
||||
Layer.mock(ServerEnvironment)({
|
||||
getEnvironmentId: Effect.succeed(testEnvironmentDescriptor.environmentId),
|
||||
|
||||
@@ -5,8 +5,6 @@ import { FetchHttpClient, HttpRouter, HttpServer } from "effect/unstable/http";
|
||||
import * as HttpApiBuilder from "effect/unstable/httpapi/HttpApiBuilder";
|
||||
|
||||
import { ServerConfig } from "./config.ts";
|
||||
import * as BackgroundPolicy from "./background/BackgroundPolicy.ts";
|
||||
import * as HostPowerMonitor from "./background/HostPowerMonitor.ts";
|
||||
import {
|
||||
otlpTracesProxyRouteLayer,
|
||||
assetRouteLayer,
|
||||
@@ -112,11 +110,6 @@ const PtyAdapterLive = Layer.unwrap(
|
||||
}),
|
||||
);
|
||||
|
||||
const BackgroundLayerLive = BackgroundPolicy.layer.pipe(
|
||||
Layer.provide(HostPowerMonitor.layer),
|
||||
Layer.provideMerge(ServerSettingsLive),
|
||||
);
|
||||
|
||||
const RelayClientLive = Layer.unwrap(
|
||||
Effect.gen(function* () {
|
||||
const config = yield* ServerConfig;
|
||||
@@ -292,7 +285,6 @@ const ProviderRuntimeLayerLive = ProviderSessionReaperLive.pipe(
|
||||
|
||||
const RuntimeCoreDependenciesLive = ReactorLayerLive.pipe(
|
||||
// Core Services
|
||||
Layer.provideMerge(ServerSettingsLive),
|
||||
Layer.provideMerge(CheckpointingLayerLive),
|
||||
Layer.provideMerge(SourceControlProviderRegistryLayerLive),
|
||||
Layer.provideMerge(GitLayerLive),
|
||||
@@ -320,6 +312,7 @@ const RuntimeCoreDependenciesLive = ReactorLayerLive.pipe(
|
||||
// no longer transitively provides it. Exposing it at the runtime level
|
||||
// keeps a single Live for all opencode consumers.
|
||||
Layer.provideMerge(OpenCodeRuntimeLive),
|
||||
Layer.provideMerge(ServerSettingsLive),
|
||||
Layer.provideMerge(WorkspaceLayerLive),
|
||||
Layer.provideMerge(ProjectFaviconResolverLayerLive),
|
||||
Layer.provideMerge(RepositoryIdentityResolverLive),
|
||||
@@ -336,7 +329,6 @@ const RuntimeCoreDependenciesLive = ReactorLayerLive.pipe(
|
||||
|
||||
const RuntimeDependenciesLive = RuntimeCoreDependenciesLive.pipe(
|
||||
// Misc.
|
||||
Layer.provideMerge(BackgroundLayerLive),
|
||||
Layer.provideMerge(ProcessDiagnostics.layer),
|
||||
Layer.provideMerge(ProcessResourceMonitor.layer),
|
||||
Layer.provideMerge(TraceDiagnostics.layer),
|
||||
|
||||
@@ -462,14 +462,6 @@ it.layer(NodeServices.layer)("server settings", (it) => {
|
||||
serverPassword: "secret-password",
|
||||
},
|
||||
},
|
||||
backgroundActivity: {
|
||||
schemaVersion: 1,
|
||||
profile: "custom",
|
||||
baseProfile: "balanced",
|
||||
overrides: {
|
||||
automaticGitFetchInterval: 10_000,
|
||||
},
|
||||
},
|
||||
automaticGitFetchInterval: 10_000,
|
||||
});
|
||||
}).pipe(Effect.provide(makeServerSettingsLayer())),
|
||||
|
||||
@@ -135,17 +135,13 @@ export class ServerSettingsService extends Context.Service<
|
||||
Layer.effect(
|
||||
ServerSettingsService,
|
||||
Effect.gen(function* () {
|
||||
const { automaticGitFetchInterval, providerHealthRefreshInterval, ...overridesForMerge } =
|
||||
overrides;
|
||||
const { automaticGitFetchInterval, ...overridesForMerge } = overrides;
|
||||
const merged = deepMerge(DEFAULT_SERVER_SETTINGS, overridesForMerge);
|
||||
const initialSettings = yield* normalizeServerSettings({
|
||||
...merged,
|
||||
...(automaticGitFetchInterval !== undefined
|
||||
? { automaticGitFetchInterval: automaticGitFetchInterval as Duration.Duration }
|
||||
: {}),
|
||||
...(providerHealthRefreshInterval !== undefined
|
||||
? { providerHealthRefreshInterval: providerHealthRefreshInterval as Duration.Duration }
|
||||
: {}),
|
||||
});
|
||||
const currentSettingsRef = yield* Ref.make<ServerSettings>(initialSettings);
|
||||
|
||||
@@ -220,9 +216,7 @@ function fallbackTextGenerationProvider(settings: ServerSettings): ServerSetting
|
||||
|
||||
// Values under these keys are compared as a whole — never stripped field-by-field.
|
||||
const ATOMIC_SETTINGS_KEYS: ReadonlySet<string> = new Set([
|
||||
"backgroundActivity",
|
||||
"automaticGitFetchInterval",
|
||||
"providerHealthRefreshInterval",
|
||||
"textGenerationModelSelection",
|
||||
]);
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import { assert, it, describe } from "@effect/vitest";
|
||||
import * as NodeServices from "@effect/platform-node/NodeServices";
|
||||
import * as Deferred from "effect/Deferred";
|
||||
import * as DateTime from "effect/DateTime";
|
||||
import * as Duration from "effect/Duration";
|
||||
import * as Effect from "effect/Effect";
|
||||
import * as Exit from "effect/Exit";
|
||||
@@ -13,19 +12,16 @@ import * as Scope from "effect/Scope";
|
||||
import * as Stream from "effect/Stream";
|
||||
import * as TestClock from "effect/testing/TestClock";
|
||||
import type {
|
||||
BackgroundScope,
|
||||
VcsStatusLocalResult,
|
||||
VcsStatusRemoteResult,
|
||||
VcsStatusResult,
|
||||
VcsStatusStreamEvent,
|
||||
} from "@t3tools/contracts";
|
||||
import { GitManagerError } from "@t3tools/contracts";
|
||||
|
||||
import * as VcsStatusBroadcaster from "./VcsStatusBroadcaster.ts";
|
||||
import * as BackgroundPolicy from "../background/BackgroundPolicy.ts";
|
||||
import * as GitWorkflowService from "../git/GitWorkflowService.ts";
|
||||
|
||||
const TEST_EPOCH = DateTime.makeUnsafe("1970-01-01T00:00:00.000Z");
|
||||
|
||||
const baseLocalStatus: VcsStatusLocalResult = {
|
||||
isRepo: true,
|
||||
sourceControlProvider: {
|
||||
@@ -62,7 +58,6 @@ function makeTestLayer(state: {
|
||||
}) {
|
||||
return VcsStatusBroadcaster.layer.pipe(
|
||||
Layer.provideMerge(NodeServices.layer),
|
||||
Layer.provide(makeBackgroundPolicyLayer(() => true)),
|
||||
Layer.provide(
|
||||
Layer.mock(GitWorkflowService.GitWorkflowService)({
|
||||
localStatus: () =>
|
||||
@@ -88,38 +83,6 @@ function makeTestLayer(state: {
|
||||
);
|
||||
}
|
||||
|
||||
function makeBackgroundPolicyLayer(shouldRunScopeWork: (scope: BackgroundScope) => boolean) {
|
||||
return Layer.mock(BackgroundPolicy.BackgroundPolicy)({
|
||||
reportClientActivity: () => Effect.void,
|
||||
removeRpcClient: () => Effect.void,
|
||||
removeSession: () => Effect.void,
|
||||
reportHostPowerState: () => Effect.void,
|
||||
snapshot: Effect.succeed({
|
||||
hostPower: {
|
||||
source: "unknown",
|
||||
idle: "unknown",
|
||||
idleSeconds: null,
|
||||
locked: "unknown",
|
||||
suspended: false,
|
||||
onBattery: "unknown",
|
||||
lowPowerMode: "unknown",
|
||||
thermalState: "unknown",
|
||||
stale: true,
|
||||
updatedAt: TEST_EPOCH,
|
||||
},
|
||||
leases: [],
|
||||
activeForegroundLeaseCount: 0,
|
||||
activeScopeKeys: [],
|
||||
shouldRunOpportunisticWork: false,
|
||||
updatedAt: TEST_EPOCH,
|
||||
}),
|
||||
streamChanges: Stream.empty,
|
||||
hasDemand: () => Effect.succeed(true),
|
||||
shouldRunScopeWork: (scope) => Effect.sync(() => shouldRunScopeWork(scope)),
|
||||
shouldRunOpportunisticWork: Effect.succeed(true),
|
||||
});
|
||||
}
|
||||
|
||||
describe("VcsStatusBroadcaster", () => {
|
||||
it.effect("reuses the cached VCS status across repeated reads", () => {
|
||||
const state = {
|
||||
@@ -187,6 +150,71 @@ describe("VcsStatusBroadcaster", () => {
|
||||
}).pipe(Effect.provide(makeTestLayer(state)));
|
||||
});
|
||||
|
||||
it.effect("keeps the cached snapshot unchanged when a refresh branch fails", () => {
|
||||
const state = {
|
||||
currentLocalStatus: baseLocalStatus,
|
||||
currentRemoteStatus: baseRemoteStatus,
|
||||
localStatusCalls: 0,
|
||||
remoteStatusCalls: 0,
|
||||
localInvalidationCalls: 0,
|
||||
remoteInvalidationCalls: 0,
|
||||
failRemoteStatus: false,
|
||||
};
|
||||
const testLayer = VcsStatusBroadcaster.layer.pipe(
|
||||
Layer.provideMerge(NodeServices.layer),
|
||||
Layer.provide(
|
||||
Layer.mock(GitWorkflowService.GitWorkflowService)({
|
||||
localStatus: () =>
|
||||
Effect.sync(() => {
|
||||
state.localStatusCalls += 1;
|
||||
return state.currentLocalStatus;
|
||||
}),
|
||||
remoteStatus: () =>
|
||||
Effect.suspend(() => {
|
||||
state.remoteStatusCalls += 1;
|
||||
return state.failRemoteStatus
|
||||
? Effect.fail(
|
||||
new GitManagerError({
|
||||
operation: "VcsStatusBroadcaster.test",
|
||||
detail: "remote status failed",
|
||||
}),
|
||||
)
|
||||
: Effect.succeed(state.currentRemoteStatus);
|
||||
}),
|
||||
invalidateLocalStatus: () =>
|
||||
Effect.sync(() => {
|
||||
state.localInvalidationCalls += 1;
|
||||
}),
|
||||
invalidateRemoteStatus: () =>
|
||||
Effect.sync(() => {
|
||||
state.remoteInvalidationCalls += 1;
|
||||
}),
|
||||
}),
|
||||
),
|
||||
);
|
||||
|
||||
return Effect.gen(function* () {
|
||||
const broadcaster = yield* VcsStatusBroadcaster.VcsStatusBroadcaster;
|
||||
yield* broadcaster.getStatus({ cwd: "/repo" });
|
||||
|
||||
state.currentLocalStatus = {
|
||||
...baseLocalStatus,
|
||||
refName: "feature/partial-refresh",
|
||||
};
|
||||
state.currentRemoteStatus = {
|
||||
...baseRemoteStatus,
|
||||
aheadCount: 3,
|
||||
};
|
||||
state.failRemoteStatus = true;
|
||||
|
||||
const refreshExit = yield* broadcaster.refreshStatus("/repo").pipe(Effect.exit);
|
||||
const cached = yield* broadcaster.getStatus({ cwd: "/repo" });
|
||||
|
||||
assert.isTrue(Exit.isFailure(refreshExit));
|
||||
assert.deepStrictEqual(cached, baseStatus);
|
||||
}).pipe(Effect.provide(testLayer));
|
||||
});
|
||||
|
||||
it.effect("refreshes only the cached local snapshot when requested", () => {
|
||||
const state = {
|
||||
currentLocalStatus: baseLocalStatus,
|
||||
@@ -235,7 +263,6 @@ describe("VcsStatusBroadcaster", () => {
|
||||
};
|
||||
const testLayer = VcsStatusBroadcaster.layer.pipe(
|
||||
Layer.provideMerge(NodeServices.layer),
|
||||
Layer.provide(makeBackgroundPolicyLayer(() => true)),
|
||||
Layer.provide(
|
||||
Layer.mock(GitWorkflowService.GitWorkflowService)({
|
||||
localStatus: (input) =>
|
||||
@@ -415,57 +442,6 @@ describe("VcsStatusBroadcaster", () => {
|
||||
);
|
||||
});
|
||||
|
||||
it.effect("does not start automatic remote refreshes without foreground client demand", () => {
|
||||
const state = {
|
||||
currentLocalStatus: baseLocalStatus,
|
||||
currentRemoteStatus: baseRemoteStatus,
|
||||
localStatusCalls: 0,
|
||||
remoteStatusCalls: 0,
|
||||
localInvalidationCalls: 0,
|
||||
remoteInvalidationCalls: 0,
|
||||
};
|
||||
const testLayer = VcsStatusBroadcaster.layer.pipe(
|
||||
Layer.provideMerge(NodeServices.layer),
|
||||
Layer.provide(makeBackgroundPolicyLayer(() => false)),
|
||||
Layer.provide(
|
||||
Layer.mock(GitWorkflowService.GitWorkflowService)({
|
||||
localStatus: () =>
|
||||
Effect.sync(() => {
|
||||
state.localStatusCalls += 1;
|
||||
return state.currentLocalStatus;
|
||||
}),
|
||||
remoteStatus: () =>
|
||||
Effect.sync(() => {
|
||||
state.remoteStatusCalls += 1;
|
||||
return state.currentRemoteStatus;
|
||||
}),
|
||||
invalidateLocalStatus: () =>
|
||||
Effect.sync(() => {
|
||||
state.localInvalidationCalls += 1;
|
||||
}),
|
||||
invalidateRemoteStatus: () =>
|
||||
Effect.sync(() => {
|
||||
state.remoteInvalidationCalls += 1;
|
||||
}),
|
||||
} satisfies Partial<GitWorkflowService.GitWorkflowServiceShape>),
|
||||
),
|
||||
);
|
||||
|
||||
return Effect.gen(function* () {
|
||||
const broadcaster = yield* VcsStatusBroadcaster.VcsStatusBroadcaster;
|
||||
const snapshot = yield* Stream.runHead(
|
||||
broadcaster.streamStatus(
|
||||
{ cwd: "/repo" },
|
||||
{ automaticRemoteRefreshInterval: Effect.succeed(Duration.seconds(1)) },
|
||||
),
|
||||
);
|
||||
|
||||
assert.isTrue(Option.isSome(snapshot));
|
||||
assert.equal(state.remoteStatusCalls, 0);
|
||||
assert.equal(state.remoteInvalidationCalls, 0);
|
||||
}).pipe(Effect.provide(testLayer));
|
||||
});
|
||||
|
||||
it.effect("stops the remote poller after the last stream subscriber disconnects", () => {
|
||||
const state = {
|
||||
currentLocalStatus: baseLocalStatus,
|
||||
@@ -479,7 +455,6 @@ describe("VcsStatusBroadcaster", () => {
|
||||
let remoteStartedDeferred: Deferred.Deferred<void, never> | null = null;
|
||||
const testLayer = VcsStatusBroadcaster.layer.pipe(
|
||||
Layer.provideMerge(NodeServices.layer),
|
||||
Layer.provide(makeBackgroundPolicyLayer(() => true)),
|
||||
Layer.provide(
|
||||
Layer.mock(GitWorkflowService.GitWorkflowService)({
|
||||
localStatus: () =>
|
||||
|
||||
@@ -21,7 +21,6 @@ import type {
|
||||
} from "@t3tools/contracts";
|
||||
import { mergeGitStatusParts } from "@t3tools/shared/git";
|
||||
|
||||
import * as BackgroundPolicy from "../background/BackgroundPolicy.ts";
|
||||
import * as GitWorkflowService from "../git/GitWorkflowService.ts";
|
||||
|
||||
const DEFAULT_VCS_STATUS_REFRESH_INTERVAL = Duration.seconds(30);
|
||||
@@ -99,7 +98,6 @@ export const layer = Layer.effect(
|
||||
VcsStatusBroadcaster,
|
||||
Effect.gen(function* () {
|
||||
const workflow = yield* GitWorkflowService.GitWorkflowService;
|
||||
const backgroundPolicy = yield* BackgroundPolicy.BackgroundPolicy;
|
||||
const fs = yield* FileSystem.FileSystem;
|
||||
const changesPubSub = yield* Effect.acquireRelease(
|
||||
PubSub.unbounded<VcsStatusChange>(),
|
||||
@@ -181,6 +179,48 @@ export const layer = Layer.effect(
|
||||
},
|
||||
);
|
||||
|
||||
const updateCachedStatus = Effect.fn("VcsStatusBroadcaster.updateCachedStatus")(function* (
|
||||
cwd: string,
|
||||
local: VcsStatusLocalResult,
|
||||
remote: VcsStatusRemoteResult | null,
|
||||
options?: { publish?: boolean },
|
||||
) {
|
||||
const nextLocal = {
|
||||
fingerprint: fingerprintStatusPart(local),
|
||||
value: local,
|
||||
} satisfies CachedValue<VcsStatusLocalResult>;
|
||||
const nextRemote = {
|
||||
fingerprint: fingerprintStatusPart(remote),
|
||||
value: remote,
|
||||
} satisfies CachedValue<VcsStatusRemoteResult | null>;
|
||||
const shouldPublish = yield* Ref.modify(cacheRef, (cache) => {
|
||||
const previous = cache.get(cwd) ?? { local: null, remote: null };
|
||||
const nextCache = new Map(cache);
|
||||
nextCache.set(cwd, {
|
||||
local: nextLocal,
|
||||
remote: nextRemote,
|
||||
});
|
||||
return [
|
||||
previous.local?.fingerprint !== nextLocal.fingerprint ||
|
||||
previous.remote?.fingerprint !== nextRemote.fingerprint,
|
||||
nextCache,
|
||||
] as const;
|
||||
});
|
||||
|
||||
if (options?.publish && shouldPublish) {
|
||||
yield* PubSub.publish(changesPubSub, {
|
||||
cwd,
|
||||
event: {
|
||||
_tag: "snapshot",
|
||||
local,
|
||||
remote,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
return mergeGitStatusParts(local, remote);
|
||||
});
|
||||
|
||||
const loadLocalStatus = Effect.fn("VcsStatusBroadcaster.loadLocalStatus")(function* (
|
||||
cwd: string,
|
||||
) {
|
||||
@@ -188,13 +228,6 @@ export const layer = Layer.effect(
|
||||
return yield* updateCachedLocalStatus(cwd, local);
|
||||
});
|
||||
|
||||
const loadRemoteStatus = Effect.fn("VcsStatusBroadcaster.loadRemoteStatus")(function* (
|
||||
cwd: string,
|
||||
) {
|
||||
const remote = yield* workflow.remoteStatus({ cwd });
|
||||
return yield* updateCachedRemoteStatus(cwd, remote);
|
||||
});
|
||||
|
||||
const getOrLoadLocalStatus = Effect.fn("VcsStatusBroadcaster.getOrLoadLocalStatus")(function* (
|
||||
cwd: string,
|
||||
) {
|
||||
@@ -205,36 +238,39 @@ export const layer = Layer.effect(
|
||||
return yield* loadLocalStatus(cwd);
|
||||
});
|
||||
|
||||
const getOrLoadRemoteStatus = Effect.fn("VcsStatusBroadcaster.getOrLoadRemoteStatus")(
|
||||
function* (cwd: string) {
|
||||
const cached = yield* getCachedStatus(cwd);
|
||||
if (cached?.remote) {
|
||||
return cached.remote.value;
|
||||
}
|
||||
return yield* loadRemoteStatus(cwd);
|
||||
},
|
||||
);
|
||||
|
||||
const withFileSystem = Effect.provideService(FileSystem.FileSystem, fs);
|
||||
|
||||
const getStatus: VcsStatusBroadcasterShape["getStatus"] = Effect.fn(
|
||||
"VcsStatusBroadcaster.getStatus",
|
||||
)(function* (input) {
|
||||
const cwd = yield* withFileSystem(normalizeCwd(input.cwd));
|
||||
const [local, remote] = yield* Effect.all([
|
||||
getOrLoadLocalStatus(cwd),
|
||||
getOrLoadRemoteStatus(cwd),
|
||||
]);
|
||||
return mergeGitStatusParts(local, remote);
|
||||
const cached = yield* getCachedStatus(cwd);
|
||||
if (cached?.local && cached.remote) {
|
||||
return mergeGitStatusParts(cached.local.value, cached.remote.value);
|
||||
}
|
||||
const [local, remote] = yield* Effect.all(
|
||||
[
|
||||
cached?.local ? Effect.succeed(cached.local.value) : workflow.localStatus({ cwd }),
|
||||
cached?.remote ? Effect.succeed(cached.remote.value) : workflow.remoteStatus({ cwd }),
|
||||
],
|
||||
{ concurrency: "unbounded" },
|
||||
);
|
||||
return yield* updateCachedStatus(cwd, local, remote);
|
||||
});
|
||||
|
||||
const refreshLocalStatusCore = Effect.fn("VcsStatusBroadcaster.refreshLocalStatusCore")(
|
||||
function* (cwd: string) {
|
||||
yield* workflow.invalidateLocalStatus(cwd);
|
||||
const local = yield* workflow.localStatus({ cwd });
|
||||
return yield* updateCachedLocalStatus(cwd, local, { publish: true });
|
||||
},
|
||||
);
|
||||
|
||||
const refreshLocalStatus: VcsStatusBroadcasterShape["refreshLocalStatus"] = Effect.fn(
|
||||
"VcsStatusBroadcaster.refreshLocalStatus",
|
||||
)(function* (rawCwd) {
|
||||
const cwd = yield* withFileSystem(normalizeCwd(rawCwd));
|
||||
yield* workflow.invalidateLocalStatus(cwd);
|
||||
const local = yield* workflow.localStatus({ cwd });
|
||||
return yield* updateCachedLocalStatus(cwd, local, { publish: true });
|
||||
return yield* refreshLocalStatusCore(cwd);
|
||||
});
|
||||
|
||||
const refreshRemoteStatus = Effect.fn("VcsStatusBroadcaster.refreshRemoteStatus")(function* (
|
||||
@@ -249,16 +285,19 @@ export const layer = Layer.effect(
|
||||
"VcsStatusBroadcaster.refreshStatus",
|
||||
)(function* (rawCwd) {
|
||||
const cwd = yield* withFileSystem(normalizeCwd(rawCwd));
|
||||
const [local, remote] = yield* Effect.all([
|
||||
refreshLocalStatus(cwd),
|
||||
refreshRemoteStatus(cwd),
|
||||
]);
|
||||
return mergeGitStatusParts(local, remote);
|
||||
yield* Effect.all(
|
||||
[workflow.invalidateLocalStatus(cwd), workflow.invalidateRemoteStatus(cwd)],
|
||||
{ concurrency: "unbounded", discard: true },
|
||||
);
|
||||
const [local, remote] = yield* Effect.all(
|
||||
[workflow.localStatus({ cwd }), workflow.remoteStatus({ cwd })],
|
||||
{ concurrency: "unbounded" },
|
||||
);
|
||||
return yield* updateCachedStatus(cwd, local, remote, { publish: true });
|
||||
});
|
||||
|
||||
const makeRemoteRefreshLoop = (
|
||||
cwd: string,
|
||||
scopeCwd: string,
|
||||
automaticRemoteRefreshInterval: Effect.Effect<Duration.Duration, never>,
|
||||
refreshImmediately: boolean,
|
||||
) => {
|
||||
@@ -273,14 +312,6 @@ export const layer = Layer.effect(
|
||||
return activeInterval;
|
||||
}
|
||||
|
||||
const shouldRun = yield* backgroundPolicy.shouldRunScopeWork({
|
||||
type: "vcs-status",
|
||||
cwd: scopeCwd,
|
||||
});
|
||||
if (!shouldRun) {
|
||||
return activeInterval;
|
||||
}
|
||||
|
||||
const exit = yield* refreshRemoteStatus(cwd).pipe(Effect.exit);
|
||||
if (Exit.isSuccess(exit)) {
|
||||
yield* Ref.set(consecutiveFailuresRef, 0);
|
||||
@@ -323,7 +354,6 @@ export const layer = Layer.effect(
|
||||
|
||||
const retainRemotePoller = Effect.fn("VcsStatusBroadcaster.retainRemotePoller")(function* (
|
||||
cwd: string,
|
||||
scopeCwd: string,
|
||||
automaticRemoteRefreshInterval: Effect.Effect<Duration.Duration, never>,
|
||||
refreshImmediately: boolean,
|
||||
) {
|
||||
@@ -338,12 +368,7 @@ export const layer = Layer.effect(
|
||||
return Effect.succeed([undefined, nextPollers] as const);
|
||||
}
|
||||
|
||||
return makeRemoteRefreshLoop(
|
||||
cwd,
|
||||
scopeCwd,
|
||||
automaticRemoteRefreshInterval,
|
||||
refreshImmediately,
|
||||
).pipe(
|
||||
return makeRemoteRefreshLoop(cwd, automaticRemoteRefreshInterval, refreshImmediately).pipe(
|
||||
Effect.forkIn(broadcasterScope),
|
||||
Effect.map((fiber) => {
|
||||
const nextPollers = new Map(activePollers);
|
||||
@@ -395,7 +420,6 @@ export const layer = Layer.effect(
|
||||
const initialRemote = cachedStatus?.remote?.value ?? null;
|
||||
yield* retainRemotePoller(
|
||||
cwd,
|
||||
input.cwd,
|
||||
options?.automaticRemoteRefreshInterval ??
|
||||
Effect.succeed(DEFAULT_VCS_STATUS_REFRESH_INTERVAL),
|
||||
cachedStatus?.remote === null || cachedStatus?.remote === undefined,
|
||||
|
||||
+2
-42
@@ -42,7 +42,6 @@ import {
|
||||
type RelayClientInstallProgressEvent,
|
||||
OrchestrationReplayEventsError,
|
||||
FilesystemBrowseError,
|
||||
RpcClientId,
|
||||
AssetAccessError,
|
||||
EnvironmentAuthorizationError,
|
||||
ThreadId,
|
||||
@@ -53,7 +52,6 @@ import {
|
||||
WS_METHODS,
|
||||
WsRpcGroup,
|
||||
} from "@t3tools/contracts";
|
||||
import { resolveServerBackgroundActivitySettings } from "@t3tools/shared/backgroundActivitySettings";
|
||||
import { clamp } from "effect/Number";
|
||||
import { HttpRouter, HttpServerRequest, HttpServerRespondable } from "effect/unstable/http";
|
||||
import { RpcSerialization, RpcServer } from "effect/unstable/rpc";
|
||||
@@ -90,7 +88,6 @@ import { ReviewService } from "./review/ReviewService.ts";
|
||||
import { ProjectSetupScriptRunner } from "./project/Services/ProjectSetupScriptRunner.ts";
|
||||
import { RepositoryIdentityResolver } from "./project/Services/RepositoryIdentityResolver.ts";
|
||||
import { ServerEnvironment } from "./environment/Services/ServerEnvironment.ts";
|
||||
import * as BackgroundPolicy from "./background/BackgroundPolicy.ts";
|
||||
import * as EnvironmentAuth from "./auth/EnvironmentAuth.ts";
|
||||
import type { AuthenticatedSession } from "./auth/EnvironmentAuth.ts";
|
||||
import * as ProcessDiagnostics from "./diagnostics/ProcessDiagnostics.ts";
|
||||
@@ -280,13 +277,10 @@ const makeWsRpcLayer = (currentSession: AuthenticatedSession) =>
|
||||
const projectSetupScriptRunner = yield* ProjectSetupScriptRunner;
|
||||
const repositoryIdentityResolver = yield* RepositoryIdentityResolver;
|
||||
const serverEnvironment = yield* ServerEnvironment;
|
||||
const backgroundPolicy = yield* BackgroundPolicy.BackgroundPolicy;
|
||||
const serverAuth = yield* EnvironmentAuth.EnvironmentAuth;
|
||||
const sourceControlDiscovery = yield* SourceControlDiscoveryLayer.SourceControlDiscovery;
|
||||
const automaticGitFetchInterval = serverSettings.getSettings.pipe(
|
||||
Effect.map(
|
||||
(settings) => resolveServerBackgroundActivitySettings(settings).automaticGitFetchInterval,
|
||||
),
|
||||
Effect.map((settings) => settings.automaticGitFetchInterval),
|
||||
Effect.catch((cause) =>
|
||||
Effect.logWarning("Failed to read automatic Git fetch interval setting", {
|
||||
detail: cause.message,
|
||||
@@ -1109,26 +1103,6 @@ const makeWsRpcLayer = (currentSession: AuthenticatedSession) =>
|
||||
observeRpcEffect(WS_METHODS.serverSignalProcess, processDiagnostics.signal(input), {
|
||||
"rpc.aggregate": "server",
|
||||
}),
|
||||
[WS_METHODS.serverReportClientActivity]: (input, metadata) =>
|
||||
observeRpcEffect(
|
||||
WS_METHODS.serverReportClientActivity,
|
||||
backgroundPolicy.reportClientActivity(
|
||||
currentSessionId,
|
||||
RpcClientId.make(metadata.client.id),
|
||||
input,
|
||||
),
|
||||
{ "rpc.aggregate": "server" },
|
||||
),
|
||||
[WS_METHODS.serverReportHostPowerState]: (input) =>
|
||||
observeRpcEffect(
|
||||
WS_METHODS.serverReportHostPowerState,
|
||||
backgroundPolicy.reportHostPowerState(input),
|
||||
{ "rpc.aggregate": "server" },
|
||||
),
|
||||
[WS_METHODS.serverGetBackgroundPolicy]: (_input) =>
|
||||
observeRpcEffect(WS_METHODS.serverGetBackgroundPolicy, backgroundPolicy.snapshot, {
|
||||
"rpc.aggregate": "server",
|
||||
}),
|
||||
[WS_METHODS.cloudGetRelayClientStatus]: (_input) =>
|
||||
observeRpcEffect(WS_METHODS.cloudGetRelayClientStatus, relayClient.resolve, {
|
||||
"rpc.aggregate": "cloud",
|
||||
@@ -1647,15 +1621,6 @@ const makeWsRpcLayer = (currentSession: AuthenticatedSession) =>
|
||||
}),
|
||||
{ "rpc.aggregate": "auth" },
|
||||
),
|
||||
[WS_METHODS.subscribeBackgroundPolicy]: (_input) =>
|
||||
observeRpcStream(
|
||||
WS_METHODS.subscribeBackgroundPolicy,
|
||||
Stream.concat(
|
||||
Stream.unwrap(Effect.map(backgroundPolicy.snapshot, Stream.make)),
|
||||
backgroundPolicy.streamChanges,
|
||||
),
|
||||
{ "rpc.aggregate": "server" },
|
||||
),
|
||||
});
|
||||
}),
|
||||
);
|
||||
@@ -1669,7 +1634,6 @@ export const websocketRpcRouteLayer = Layer.unwrap(
|
||||
const request = yield* HttpServerRequest.HttpServerRequest;
|
||||
const serverAuth = yield* EnvironmentAuth.EnvironmentAuth;
|
||||
const sessions = yield* SessionStore.SessionStore;
|
||||
const backgroundPolicy = yield* BackgroundPolicy.BackgroundPolicy;
|
||||
const session = yield* serverAuth.authenticateWebSocketUpgrade(request).pipe(
|
||||
Effect.catchTags({
|
||||
ServerAuthInvalidCredentialError: (error) => failEnvironmentAuthInvalid(error.reason),
|
||||
@@ -1711,11 +1675,7 @@ export const websocketRpcRouteLayer = Layer.unwrap(
|
||||
return yield* Effect.acquireUseRelease(
|
||||
sessions.markConnected(session.sessionId),
|
||||
() => rpcWebSocketHttpEffect,
|
||||
() =>
|
||||
Effect.all([
|
||||
sessions.markDisconnected(session.sessionId),
|
||||
backgroundPolicy.removeSession(session.sessionId),
|
||||
]).pipe(Effect.asVoid),
|
||||
() => sessions.markDisconnected(session.sessionId),
|
||||
);
|
||||
}).pipe(
|
||||
Effect.catchTags({
|
||||
|
||||
@@ -0,0 +1,255 @@
|
||||
import "../index.css";
|
||||
|
||||
import { EnvironmentId, ProjectId, ThreadId } from "@t3tools/contracts";
|
||||
import { useCallback, useRef, useState } from "react";
|
||||
import { afterEach, beforeEach, describe, expect, it, vi } from "vite-plus/test";
|
||||
import { page, userEvent } from "vite-plus/test/browser";
|
||||
import { cleanup, render } from "vitest-browser-react";
|
||||
|
||||
import { AppAtomRegistryProvider } from "../rpc/atomRegistry";
|
||||
import { DEFAULT_INTERACTION_MODE } from "../types";
|
||||
import type { SidebarThreadSummary } from "../types";
|
||||
import { SidebarThreadRow } from "./Sidebar";
|
||||
|
||||
// Double-click-to-rename is a desktop affordance; force the non-mobile path so
|
||||
// the rename input is reachable regardless of the test browser viewport.
|
||||
vi.mock("~/hooks/useMediaQuery", () => ({
|
||||
useIsMobile: () => false,
|
||||
useMediaQuery: () => false,
|
||||
}));
|
||||
|
||||
const THREAD_ID = ThreadId.make("thread-1");
|
||||
const ENVIRONMENT_ID = EnvironmentId.make("environment-local");
|
||||
const PROJECT_ID = ProjectId.make("project-1");
|
||||
const INITIAL_TITLE = "Original title";
|
||||
|
||||
const ROW_TESTID = `thread-row-${THREAD_ID}`;
|
||||
const TITLE_TESTID = `thread-title-${THREAD_ID}`;
|
||||
|
||||
// Spies live at module scope so their call history survives the row's
|
||||
// re-renders; reset between tests.
|
||||
const spies = {
|
||||
handleThreadClick: vi.fn(),
|
||||
startThreadRename: vi.fn(),
|
||||
navigateToThread: vi.fn(),
|
||||
handleMultiSelectContextMenu: vi.fn(async () => {}),
|
||||
handleThreadContextMenu: vi.fn(async () => {}),
|
||||
clearSelection: vi.fn(),
|
||||
commitRename: vi.fn(),
|
||||
attemptArchiveThread: vi.fn(async () => {}),
|
||||
openPrLink: vi.fn(),
|
||||
};
|
||||
|
||||
function buildThread(title: string): SidebarThreadSummary {
|
||||
return {
|
||||
id: THREAD_ID,
|
||||
environmentId: ENVIRONMENT_ID,
|
||||
projectId: PROJECT_ID,
|
||||
title,
|
||||
interactionMode: DEFAULT_INTERACTION_MODE,
|
||||
session: null,
|
||||
createdAt: "2024-01-01T00:00:00.000Z",
|
||||
archivedAt: null,
|
||||
updatedAt: undefined,
|
||||
latestTurn: null,
|
||||
branch: null,
|
||||
worktreePath: null,
|
||||
latestUserMessageAt: null,
|
||||
hasPendingApprovals: false,
|
||||
hasPendingUserInput: false,
|
||||
hasActionableProposedPlan: false,
|
||||
};
|
||||
}
|
||||
|
||||
// Mirrors the real parent (`SidebarProjectItem`): holds the rename state, wires
|
||||
// `startThreadRename`, and commits by clearing the rename state and persisting
|
||||
// the new title back onto the thread so the row re-renders with it.
|
||||
function Harness() {
|
||||
const [title, setTitle] = useState(INITIAL_TITLE);
|
||||
const [renamingThreadKey, setRenamingThreadKey] = useState<string | null>(null);
|
||||
const [renamingTitle, setRenamingTitle] = useState("");
|
||||
const [confirmingArchiveThreadKey, setConfirmingArchiveThreadKey] = useState<string | null>(null);
|
||||
const renamingInputRef = useRef<HTMLInputElement | null>(null);
|
||||
const renamingCommittedRef = useRef(false);
|
||||
const confirmArchiveButtonRefs = useRef(new Map<string, HTMLButtonElement>());
|
||||
|
||||
const startThreadRename = useCallback((threadKey: string, nextTitle: string) => {
|
||||
spies.startThreadRename(threadKey, nextTitle);
|
||||
setRenamingThreadKey(threadKey);
|
||||
setRenamingTitle(nextTitle);
|
||||
renamingCommittedRef.current = false;
|
||||
}, []);
|
||||
|
||||
const commitRename = useCallback(
|
||||
async (threadRef: unknown, newTitle: string, originalTitle: string) => {
|
||||
spies.commitRename(threadRef, newTitle, originalTitle);
|
||||
const trimmed = newTitle.trim();
|
||||
if (trimmed.length > 0) {
|
||||
setTitle(trimmed);
|
||||
}
|
||||
setRenamingThreadKey(null);
|
||||
renamingInputRef.current = null;
|
||||
},
|
||||
[],
|
||||
);
|
||||
|
||||
const cancelRename = useCallback(() => {
|
||||
setRenamingThreadKey(null);
|
||||
renamingInputRef.current = null;
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<AppAtomRegistryProvider>
|
||||
<ul>
|
||||
<SidebarThreadRow
|
||||
thread={buildThread(title)}
|
||||
projectCwd={null}
|
||||
orderedProjectThreadKeys={[]}
|
||||
isActive={false}
|
||||
jumpLabel={null}
|
||||
appSettingsConfirmThreadArchive={false}
|
||||
renamingThreadKey={renamingThreadKey}
|
||||
renamingTitle={renamingTitle}
|
||||
setRenamingTitle={setRenamingTitle}
|
||||
startThreadRename={startThreadRename}
|
||||
renamingInputRef={renamingInputRef}
|
||||
renamingCommittedRef={renamingCommittedRef}
|
||||
confirmingArchiveThreadKey={confirmingArchiveThreadKey}
|
||||
setConfirmingArchiveThreadKey={setConfirmingArchiveThreadKey}
|
||||
confirmArchiveButtonRefs={confirmArchiveButtonRefs}
|
||||
handleThreadClick={spies.handleThreadClick}
|
||||
navigateToThread={spies.navigateToThread}
|
||||
handleMultiSelectContextMenu={spies.handleMultiSelectContextMenu}
|
||||
handleThreadContextMenu={spies.handleThreadContextMenu}
|
||||
clearSelection={spies.clearSelection}
|
||||
commitRename={commitRename}
|
||||
cancelRename={cancelRename}
|
||||
attemptArchiveThread={spies.attemptArchiveThread}
|
||||
openPrLink={spies.openPrLink}
|
||||
/>
|
||||
</ul>
|
||||
</AppAtomRegistryProvider>
|
||||
);
|
||||
}
|
||||
|
||||
describe("SidebarThreadRow double-click rename", () => {
|
||||
beforeEach(() => {
|
||||
for (const spy of Object.values(spies)) spy.mockClear();
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
cleanup();
|
||||
});
|
||||
|
||||
it("double-clicking a row starts the inline rename, focused with text selected", async () => {
|
||||
render(<Harness />);
|
||||
|
||||
await expect.element(page.getByTestId(TITLE_TESTID)).toBeVisible();
|
||||
|
||||
await userEvent.dblClick(page.getByTestId(ROW_TESTID));
|
||||
|
||||
const input = page.getByRole("textbox");
|
||||
await expect.element(input).toBeVisible();
|
||||
|
||||
const element = input.element() as HTMLInputElement;
|
||||
expect(element.value).toBe(INITIAL_TITLE);
|
||||
// The existing rename-input ref focuses + selects the whole title.
|
||||
expect(document.activeElement).toBe(element);
|
||||
expect(element.selectionStart).toBe(0);
|
||||
expect(element.selectionEnd).toBe(INITIAL_TITLE.length);
|
||||
});
|
||||
|
||||
it("Enter commits the rename and the new title persists on the row", async () => {
|
||||
render(<Harness />);
|
||||
|
||||
await userEvent.dblClick(page.getByTestId(ROW_TESTID));
|
||||
const input = page.getByRole("textbox");
|
||||
await expect.element(input).toBeVisible();
|
||||
|
||||
await userEvent.fill(input, "Renamed thread");
|
||||
await userEvent.keyboard("{Enter}");
|
||||
|
||||
// commitRename was invoked with (threadRef, newTitle, originalTitle).
|
||||
expect(spies.commitRename).toHaveBeenCalledTimes(1);
|
||||
expect(spies.commitRename).toHaveBeenCalledWith(
|
||||
expect.anything(),
|
||||
"Renamed thread",
|
||||
INITIAL_TITLE,
|
||||
);
|
||||
|
||||
// Input is gone and the row now shows the persisted title.
|
||||
const title = page.getByTestId(TITLE_TESTID);
|
||||
await expect.element(title).toBeVisible();
|
||||
await expect.element(title).toHaveTextContent("Renamed thread");
|
||||
});
|
||||
|
||||
it("Escape cancels the rename without committing", async () => {
|
||||
render(<Harness />);
|
||||
|
||||
await userEvent.dblClick(page.getByTestId(ROW_TESTID));
|
||||
await expect.element(page.getByRole("textbox")).toBeVisible();
|
||||
|
||||
await userEvent.keyboard("{Escape}");
|
||||
|
||||
expect(spies.commitRename).not.toHaveBeenCalled();
|
||||
const title = page.getByTestId(TITLE_TESTID);
|
||||
await expect.element(title).toBeVisible();
|
||||
await expect.element(title).toHaveTextContent(INITIAL_TITLE);
|
||||
});
|
||||
|
||||
it("double-clicking inside the rename input keeps the edit (does not reset to the title)", async () => {
|
||||
render(<Harness />);
|
||||
|
||||
await userEvent.dblClick(page.getByTestId(ROW_TESTID));
|
||||
const input = page.getByRole("textbox");
|
||||
await expect.element(input).toBeVisible();
|
||||
|
||||
await userEvent.fill(input, "Edited but not committed");
|
||||
// Double-clicking inside the input (e.g. to select a word) must not bubble
|
||||
// to the row and restart the rename, which would wipe the edit.
|
||||
await userEvent.dblClick(input);
|
||||
|
||||
expect((input.element() as HTMLInputElement).value).toBe("Edited but not committed");
|
||||
expect(spies.commitRename).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("double-clicking the row chrome while already renaming does not restart/reset it", async () => {
|
||||
render(<Harness />);
|
||||
|
||||
await userEvent.dblClick(page.getByTestId(ROW_TESTID));
|
||||
const input = page.getByRole("textbox");
|
||||
await expect.element(input).toBeVisible();
|
||||
await userEvent.fill(input, "Edited");
|
||||
expect(spies.startThreadRename).toHaveBeenCalledTimes(1);
|
||||
|
||||
// Double-click the row element itself (chrome, not the input).
|
||||
const rowEl = page.getByTestId(ROW_TESTID).element();
|
||||
rowEl.dispatchEvent(new MouseEvent("dblclick", { bubbles: true, cancelable: true, detail: 2 }));
|
||||
|
||||
// Guard short-circuits: rename is not restarted and the edit is preserved.
|
||||
expect(spies.startThreadRename).toHaveBeenCalledTimes(1);
|
||||
expect((input.element() as HTMLInputElement).value).toBe("Edited");
|
||||
});
|
||||
|
||||
it("modifier double-click is multi-select intent and does not start a rename", async () => {
|
||||
render(<Harness />);
|
||||
|
||||
await userEvent.keyboard("{Shift>}");
|
||||
await userEvent.dblClick(page.getByTestId(ROW_TESTID));
|
||||
await userEvent.keyboard("{/Shift}");
|
||||
|
||||
await expect.element(page.getByTestId(TITLE_TESTID)).toBeVisible();
|
||||
expect(page.getByRole("textbox").elements()).toHaveLength(0);
|
||||
});
|
||||
|
||||
it("single click routes through the navigation handler and does not start a rename", async () => {
|
||||
render(<Harness />);
|
||||
|
||||
await userEvent.click(page.getByTestId(ROW_TESTID));
|
||||
|
||||
expect(spies.handleThreadClick).toHaveBeenCalledTimes(1);
|
||||
// No rename input: the title span is still shown.
|
||||
await expect.element(page.getByTestId(TITLE_TESTID)).toBeVisible();
|
||||
expect(page.getByRole("textbox").elements()).toHaveLength(0);
|
||||
});
|
||||
});
|
||||
@@ -11,6 +11,7 @@ import {
|
||||
getProjectSortTimestamp,
|
||||
hasUnseenCompletion,
|
||||
isContextMenuPointerDown,
|
||||
isTrailingDoubleClick,
|
||||
orderItemsByPreferredIds,
|
||||
resolveProjectStatusIndicator,
|
||||
resolveSidebarNewThreadSeedContext,
|
||||
@@ -171,6 +172,24 @@ describe("shouldClearThreadSelectionOnMouseDown", () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe("isTrailingDoubleClick", () => {
|
||||
it("treats a single click as a normal activation", () => {
|
||||
expect(isTrailingDoubleClick(1)).toBe(false);
|
||||
});
|
||||
|
||||
it("treats synthetic/keyboard activations (detail 0) as a normal activation", () => {
|
||||
expect(isTrailingDoubleClick(0)).toBe(false);
|
||||
});
|
||||
|
||||
it("ignores the second click of a double-click so it does not navigate", () => {
|
||||
expect(isTrailingDoubleClick(2)).toBe(true);
|
||||
});
|
||||
|
||||
it("ignores further clicks of a triple-click", () => {
|
||||
expect(isTrailingDoubleClick(3)).toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
describe("resolveSidebarNewThreadEnvMode", () => {
|
||||
it("uses the app default when the caller does not request a specific mode", () => {
|
||||
expect(
|
||||
|
||||
@@ -160,6 +160,15 @@ export function shouldClearThreadSelectionOnMouseDown(target: HTMLElement | null
|
||||
return !target.closest(THREAD_SELECTION_SAFE_SELECTOR);
|
||||
}
|
||||
|
||||
// A double-click dispatches two `click` events before `dblclick`: the first has
|
||||
// `detail === 1`, the second `detail === 2`. The second click must not run the
|
||||
// row's single-click navigation, otherwise double-click-to-rename would also
|
||||
// navigate. `MouseEvent.detail` is 0 for synthetic/keyboard activations, which
|
||||
// still count as a normal single activation.
|
||||
export function isTrailingDoubleClick(detail: number): boolean {
|
||||
return detail > 1;
|
||||
}
|
||||
|
||||
export function resolveSidebarNewThreadEnvMode(input: {
|
||||
requestedEnvMode?: SidebarNewThreadEnvMode;
|
||||
defaultEnvMode: SidebarNewThreadEnvMode;
|
||||
|
||||
@@ -20,7 +20,15 @@ import {
|
||||
} from "./ThreadStatusIndicators";
|
||||
import { ProjectFavicon } from "./ProjectFavicon";
|
||||
import { autoAnimate } from "@formkit/auto-animate";
|
||||
import React, { useCallback, useEffect, memo, useMemo, useRef, useState } from "react";
|
||||
import React, {
|
||||
useCallback,
|
||||
useEffect,
|
||||
useLayoutEffect,
|
||||
memo,
|
||||
useMemo,
|
||||
useRef,
|
||||
useState,
|
||||
} from "react";
|
||||
import { useShallow } from "zustand/react/shallow";
|
||||
import {
|
||||
DndContext,
|
||||
@@ -164,6 +172,7 @@ import {
|
||||
getSidebarThreadIdsToPrewarm,
|
||||
resolveAdjacentThreadId,
|
||||
isContextMenuPointerDown,
|
||||
isTrailingDoubleClick,
|
||||
resolveProjectStatusIndicator,
|
||||
resolveSidebarNewThreadSeedContext,
|
||||
resolveSidebarNewThreadEnvMode,
|
||||
@@ -178,6 +187,7 @@ import {
|
||||
import { sortThreads } from "../lib/threadSort";
|
||||
import { SidebarUpdatePill } from "./sidebar/SidebarUpdatePill";
|
||||
import { useCopyToClipboard } from "~/hooks/useCopyToClipboard";
|
||||
import { useIsMobile } from "~/hooks/useMediaQuery";
|
||||
import { CommandDialogTrigger } from "./ui/command";
|
||||
import { readEnvironmentApi } from "../environmentApi";
|
||||
import { useSettings, useUpdateSettings } from "~/hooks/useSettings";
|
||||
@@ -292,6 +302,7 @@ interface SidebarThreadRowProps {
|
||||
renamingThreadKey: string | null;
|
||||
renamingTitle: string;
|
||||
setRenamingTitle: (title: string) => void;
|
||||
startThreadRename: (threadKey: string, title: string) => void;
|
||||
renamingInputRef: React.RefObject<HTMLInputElement | null>;
|
||||
renamingCommittedRef: React.RefObject<boolean>;
|
||||
confirmingArchiveThreadKey: string | null;
|
||||
@@ -319,7 +330,7 @@ interface SidebarThreadRowProps {
|
||||
openPrLink: (event: React.MouseEvent<HTMLElement>, prUrl: string) => void;
|
||||
}
|
||||
|
||||
const SidebarThreadRow = memo(function SidebarThreadRow(props: SidebarThreadRowProps) {
|
||||
export const SidebarThreadRow = memo(function SidebarThreadRow(props: SidebarThreadRowProps) {
|
||||
const {
|
||||
orderedProjectThreadKeys,
|
||||
isActive,
|
||||
@@ -328,6 +339,7 @@ const SidebarThreadRow = memo(function SidebarThreadRow(props: SidebarThreadRowP
|
||||
renamingThreadKey,
|
||||
renamingTitle,
|
||||
setRenamingTitle,
|
||||
startThreadRename,
|
||||
renamingInputRef,
|
||||
renamingCommittedRef,
|
||||
confirmingArchiveThreadKey,
|
||||
@@ -352,6 +364,7 @@ const SidebarThreadRow = memo(function SidebarThreadRow(props: SidebarThreadRowP
|
||||
environmentId: thread.environmentId,
|
||||
threadId: thread.id,
|
||||
});
|
||||
const isMobile = useIsMobile();
|
||||
const discoveredPorts = useThreadDiscoveredPorts({
|
||||
environmentId: thread.environmentId,
|
||||
threadId: thread.id,
|
||||
@@ -437,6 +450,24 @@ const SidebarThreadRow = memo(function SidebarThreadRow(props: SidebarThreadRowP
|
||||
},
|
||||
[discoveredPorts, navigateToThread, threadRef],
|
||||
);
|
||||
const handleRowDoubleClick = useCallback(
|
||||
(event: React.MouseEvent) => {
|
||||
// Already renaming this row: a double-click on the row chrome (outside the
|
||||
// input) must not restart and discard the in-progress edit.
|
||||
if (renamingThreadKey === threadKey) return;
|
||||
// On mobile the first tap navigates and closes the sidebar sheet, so the
|
||||
// inline rename can't be shown. Renaming there stays on the context menu.
|
||||
if (isMobile) return;
|
||||
// cmd/ctrl/shift double-clicks are multi-select intent, not rename.
|
||||
if (event.metaKey || event.ctrlKey || event.shiftKey || event.altKey) return;
|
||||
// Ignore double-clicks bubbling from nested controls (PR status, port,
|
||||
// archive buttons) — only the row body should enter inline rename.
|
||||
if ((event.target as HTMLElement).closest("button, a")) return;
|
||||
event.preventDefault();
|
||||
startThreadRename(threadKey, thread.title);
|
||||
},
|
||||
[isMobile, renamingThreadKey, startThreadRename, threadKey, thread.title],
|
||||
);
|
||||
const handleRowKeyDown = useCallback(
|
||||
(event: React.KeyboardEvent) => {
|
||||
if (event.key !== "Enter" && event.key !== " ") return;
|
||||
@@ -510,6 +541,9 @@ const SidebarThreadRow = memo(function SidebarThreadRow(props: SidebarThreadRowP
|
||||
void commitRename(threadRef, renamingTitle, thread.title);
|
||||
}
|
||||
}, [commitRename, renamingCommittedRef, renamingTitle, thread.title, threadRef]);
|
||||
// Keep clicks/double-clicks inside the rename input from bubbling to the row.
|
||||
// Without stopping `dblclick`, double-clicking to select a word would re-fire
|
||||
// the row's rename handler and reset the in-progress edit back to the title.
|
||||
const handleRenameInputClick = useCallback((event: React.MouseEvent<HTMLInputElement>) => {
|
||||
event.stopPropagation();
|
||||
}, []);
|
||||
@@ -576,6 +610,7 @@ const SidebarThreadRow = memo(function SidebarThreadRow(props: SidebarThreadRowP
|
||||
isSelected,
|
||||
})} relative isolate`}
|
||||
onClick={handleRowClick}
|
||||
onDoubleClick={handleRowDoubleClick}
|
||||
onKeyDown={handleRowKeyDown}
|
||||
onContextMenu={handleRowContextMenu}
|
||||
>
|
||||
@@ -607,6 +642,7 @@ const SidebarThreadRow = memo(function SidebarThreadRow(props: SidebarThreadRowP
|
||||
onKeyDown={handleRenameInputKeyDown}
|
||||
onBlur={handleRenameInputBlur}
|
||||
onClick={handleRenameInputClick}
|
||||
onDoubleClick={handleRenameInputClick}
|
||||
/>
|
||||
) : (
|
||||
<Tooltip>
|
||||
@@ -789,6 +825,7 @@ interface SidebarProjectThreadListProps {
|
||||
renamingThreadKey: string | null;
|
||||
renamingTitle: string;
|
||||
setRenamingTitle: (title: string) => void;
|
||||
startThreadRename: (threadKey: string, title: string) => void;
|
||||
renamingInputRef: React.RefObject<HTMLInputElement | null>;
|
||||
renamingCommittedRef: React.RefObject<boolean>;
|
||||
confirmingArchiveThreadKey: string | null;
|
||||
@@ -839,6 +876,7 @@ const SidebarProjectThreadList = memo(function SidebarProjectThreadList(
|
||||
renamingThreadKey,
|
||||
renamingTitle,
|
||||
setRenamingTitle,
|
||||
startThreadRename,
|
||||
renamingInputRef,
|
||||
renamingCommittedRef,
|
||||
confirmingArchiveThreadKey,
|
||||
@@ -890,6 +928,7 @@ const SidebarProjectThreadList = memo(function SidebarProjectThreadList(
|
||||
renamingThreadKey={renamingThreadKey}
|
||||
renamingTitle={renamingTitle}
|
||||
setRenamingTitle={setRenamingTitle}
|
||||
startThreadRename={startThreadRename}
|
||||
renamingInputRef={renamingInputRef}
|
||||
renamingCommittedRef={renamingCommittedRef}
|
||||
confirmingArchiveThreadKey={confirmingArchiveThreadKey}
|
||||
@@ -1626,6 +1665,13 @@ const SidebarProjectItem = memo(function SidebarProjectItem(props: SidebarProjec
|
||||
return;
|
||||
}
|
||||
|
||||
// Ignore the trailing click of a plain double-click so it doesn't navigate
|
||||
// while a double-click is starting an inline rename. Placed after the
|
||||
// modifier branches so cmd/shift selection still processes every click.
|
||||
if (isTrailingDoubleClick(event.detail)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (currentSelectionCount > 0) {
|
||||
clearSelection();
|
||||
}
|
||||
@@ -1820,6 +1866,12 @@ const SidebarProjectItem = memo(function SidebarProjectItem(props: SidebarProjec
|
||||
renamingInputRef.current = null;
|
||||
}, []);
|
||||
|
||||
const startThreadRename = useCallback((threadKey: string, title: string) => {
|
||||
setRenamingThreadKey(threadKey);
|
||||
setRenamingTitle(title);
|
||||
renamingCommittedRef.current = false;
|
||||
}, []);
|
||||
|
||||
const commitRename = useCallback(
|
||||
async (threadRef: ScopedThreadRef, newTitle: string, originalTitle: string) => {
|
||||
const threadKey = scopedThreadKey(threadRef);
|
||||
@@ -1979,9 +2031,7 @@ const SidebarProjectItem = memo(function SidebarProjectItem(props: SidebarProjec
|
||||
);
|
||||
|
||||
if (clicked === "rename") {
|
||||
setRenamingThreadKey(threadKey);
|
||||
setRenamingTitle(thread.title);
|
||||
renamingCommittedRef.current = false;
|
||||
startThreadRename(threadKey, thread.title);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2029,6 +2079,7 @@ const SidebarProjectItem = memo(function SidebarProjectItem(props: SidebarProjec
|
||||
markThreadUnread,
|
||||
memberProjectByScopedKey,
|
||||
project.cwd,
|
||||
startThreadRename,
|
||||
],
|
||||
);
|
||||
|
||||
@@ -2151,6 +2202,7 @@ const SidebarProjectItem = memo(function SidebarProjectItem(props: SidebarProjec
|
||||
renamingThreadKey={renamingThreadKey}
|
||||
renamingTitle={renamingTitle}
|
||||
setRenamingTitle={setRenamingTitle}
|
||||
startThreadRename={startThreadRename}
|
||||
renamingInputRef={renamingInputRef}
|
||||
renamingCommittedRef={renamingCommittedRef}
|
||||
confirmingArchiveThreadKey={confirmingArchiveThreadKey}
|
||||
@@ -2511,8 +2563,70 @@ const SidebarChromeHeader = memo(function SidebarChromeHeader({
|
||||
}: {
|
||||
isElectron: boolean;
|
||||
}) {
|
||||
const headerRef = useRef<HTMLDivElement | null>(null);
|
||||
const wordmarkRef = useRef<HTMLDivElement | null>(null);
|
||||
const [isWordmarkVisible, setIsWordmarkVisible] = useState(true);
|
||||
|
||||
useLayoutEffect(() => {
|
||||
if (!isElectron) {
|
||||
setIsWordmarkVisible(true);
|
||||
return;
|
||||
}
|
||||
|
||||
const headerElement = headerRef.current;
|
||||
const wordmarkElement = wordmarkRef.current;
|
||||
if (!headerElement || !wordmarkElement) {
|
||||
return;
|
||||
}
|
||||
|
||||
let frame: number | null = null;
|
||||
const updateWordmarkVisibility = () => {
|
||||
frame = null;
|
||||
const style = window.getComputedStyle(headerElement);
|
||||
const availableWidth =
|
||||
headerElement.clientWidth -
|
||||
(Number.parseFloat(style.paddingLeft) || 0) -
|
||||
(Number.parseFloat(style.paddingRight) || 0);
|
||||
const requiredWidth = wordmarkElement.getBoundingClientRect().width;
|
||||
setIsWordmarkVisible(requiredWidth <= availableWidth + 1);
|
||||
};
|
||||
|
||||
const scheduleUpdate = () => {
|
||||
if (frame !== null) {
|
||||
return;
|
||||
}
|
||||
frame = window.requestAnimationFrame(updateWordmarkVisibility);
|
||||
};
|
||||
|
||||
scheduleUpdate();
|
||||
const resizeObserver =
|
||||
typeof ResizeObserver === "undefined"
|
||||
? null
|
||||
: new ResizeObserver(() => {
|
||||
scheduleUpdate();
|
||||
});
|
||||
resizeObserver?.observe(headerElement);
|
||||
resizeObserver?.observe(wordmarkElement);
|
||||
window.addEventListener("resize", scheduleUpdate);
|
||||
window.visualViewport?.addEventListener("resize", scheduleUpdate);
|
||||
|
||||
return () => {
|
||||
if (frame !== null) {
|
||||
window.cancelAnimationFrame(frame);
|
||||
}
|
||||
resizeObserver?.disconnect();
|
||||
window.removeEventListener("resize", scheduleUpdate);
|
||||
window.visualViewport?.removeEventListener("resize", scheduleUpdate);
|
||||
};
|
||||
}, [isElectron]);
|
||||
|
||||
const wordmark = (
|
||||
<div className="flex items-center gap-2">
|
||||
<div
|
||||
ref={wordmarkRef}
|
||||
className={`flex items-center gap-2 ${
|
||||
isWordmarkVisible ? "" : "invisible pointer-events-none"
|
||||
}`}
|
||||
>
|
||||
<SidebarTrigger className="shrink-0 md:hidden" />
|
||||
<Tooltip>
|
||||
<TooltipTrigger
|
||||
@@ -2540,7 +2654,10 @@ const SidebarChromeHeader = memo(function SidebarChromeHeader({
|
||||
);
|
||||
|
||||
return isElectron ? (
|
||||
<SidebarHeader className="drag-region h-[52px] flex-row items-center gap-2 px-4 py-0 pl-[90px] wco:h-[env(titlebar-area-height)] wco:pl-[calc(env(titlebar-area-x)+1em)]">
|
||||
<SidebarHeader
|
||||
ref={headerRef}
|
||||
className="drag-region h-[var(--desktop-titlebar-height,52px)] flex-row items-center gap-2 px-4 py-0 pl-[var(--desktop-titlebar-leading-offset,90px)] wco:h-[env(titlebar-area-height)] wco:pl-[calc(env(titlebar-area-x)+1em)]"
|
||||
>
|
||||
{wordmark}
|
||||
</SidebarHeader>
|
||||
) : (
|
||||
|
||||
@@ -19,7 +19,6 @@ import {
|
||||
type SourceControlDiscoveryResult,
|
||||
} from "@t3tools/contracts";
|
||||
import * as DateTime from "effect/DateTime";
|
||||
import * as Duration from "effect/Duration";
|
||||
import * as Option from "effect/Option";
|
||||
import { page } from "vite-plus/test/browser";
|
||||
import { afterEach, beforeEach, describe, expect, it, vi } from "vite-plus/test";
|
||||
@@ -790,41 +789,6 @@ describe("GeneralSettingsPanel observability", () => {
|
||||
.toBeInTheDocument();
|
||||
});
|
||||
|
||||
it("shows advanced background activity controls when background intervals are customized", async () => {
|
||||
setServerConfigSnapshot({
|
||||
...createBaseServerConfig(),
|
||||
settings: {
|
||||
...DEFAULT_SERVER_SETTINGS,
|
||||
backgroundActivity: {
|
||||
schemaVersion: 1,
|
||||
profile: "custom",
|
||||
baseProfile: "balanced",
|
||||
overrides: {
|
||||
automaticGitFetchInterval: Duration.seconds(15),
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
mounted = await renderWithTestRouter(
|
||||
<AppAtomRegistryProvider>
|
||||
<GeneralSettingsPanel />
|
||||
</AppAtomRegistryProvider>,
|
||||
);
|
||||
|
||||
await expect.element(page.getByText("Advanced", { exact: true })).toBeInTheDocument();
|
||||
|
||||
await page.getByRole("button", { name: "Configure advanced background activity" }).click();
|
||||
|
||||
const dialog = page.getByRole("dialog", { name: "Background Activity" });
|
||||
await expect.element(dialog).toBeInTheDocument();
|
||||
await expect.element(dialog.getByText("Shared policy")).toBeInTheDocument();
|
||||
await expect.element(dialog.getByText("Git fetch interval")).toBeInTheDocument();
|
||||
await expect.element(dialog.getByText("Provider health interval")).toBeInTheDocument();
|
||||
await expect.element(dialog.getByText("Host power monitor")).toBeInTheDocument();
|
||||
await expect.element(dialog.getByText("Idle host monitor")).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it("creates and shows a pairing link when network access is enabled", async () => {
|
||||
window.desktopBridge = createDesktopBridgeStub({
|
||||
serverExposureState: {
|
||||
|
||||
@@ -1,19 +1,9 @@
|
||||
import {
|
||||
ArchiveIcon,
|
||||
ArchiveX,
|
||||
InfoIcon,
|
||||
LoaderIcon,
|
||||
PlusIcon,
|
||||
RefreshCwIcon,
|
||||
SettingsIcon,
|
||||
} from "lucide-react";
|
||||
import { ArchiveIcon, ArchiveX, LoaderIcon, PlusIcon, RefreshCwIcon } from "lucide-react";
|
||||
import { useQueryClient } from "@tanstack/react-query";
|
||||
import { Link } from "@tanstack/react-router";
|
||||
import { useCallback, useMemo, useRef, useState } from "react";
|
||||
import {
|
||||
defaultInstanceIdForDriver,
|
||||
type BackgroundActivityProfile,
|
||||
type BackgroundActivitySettings,
|
||||
type DesktopUpdateChannel,
|
||||
PROVIDER_DISPLAY_NAMES,
|
||||
ProviderDriverKind,
|
||||
@@ -23,11 +13,6 @@ import {
|
||||
} from "@t3tools/contracts";
|
||||
import { scopeThreadRef } from "@t3tools/client-runtime";
|
||||
import { DEFAULT_UNIFIED_SETTINGS } from "@t3tools/contracts/settings";
|
||||
import {
|
||||
getBackgroundActivityBaseProfile,
|
||||
getBackgroundActivityPresetSettings,
|
||||
resolveServerBackgroundActivitySettings,
|
||||
} from "@t3tools/shared/backgroundActivitySettings";
|
||||
import { createModelSelection } from "@t3tools/shared/model";
|
||||
import * as Arr from "effect/Array";
|
||||
import * as Duration from "effect/Duration";
|
||||
@@ -66,23 +51,7 @@ import { selectProjectsAcrossEnvironments, useStore } from "../../store";
|
||||
import { useArchivedThreadSnapshots } from "../../lib/archivedThreadsState";
|
||||
import { formatRelativeTime, formatRelativeTimeLabel } from "../../timestampFormat";
|
||||
import { Button } from "../ui/button";
|
||||
import {
|
||||
Dialog,
|
||||
DialogDescription,
|
||||
DialogFooter,
|
||||
DialogHeader,
|
||||
DialogPanel,
|
||||
DialogPopup,
|
||||
DialogTitle,
|
||||
} from "../ui/dialog";
|
||||
import { DraftInput } from "../ui/draft-input";
|
||||
import {
|
||||
NumberField,
|
||||
NumberFieldDecrement,
|
||||
NumberFieldGroup,
|
||||
NumberFieldIncrement,
|
||||
NumberFieldInput,
|
||||
} from "../ui/number-field";
|
||||
import { Select, SelectItem, SelectPopup, SelectTrigger, SelectValue } from "../ui/select";
|
||||
import { Switch } from "../ui/switch";
|
||||
import { stackedThreadToast, toastManager } from "../ui/toast";
|
||||
@@ -132,128 +101,7 @@ const TIMESTAMP_FORMAT_LABELS = {
|
||||
"24-hour": "24-hour",
|
||||
} as const;
|
||||
|
||||
const BACKGROUND_ACTIVITY_PROFILE_LABELS: Record<BackgroundActivityProfile, string> = {
|
||||
balanced: "Balanced",
|
||||
performance: "Performance",
|
||||
"battery-saver": "Battery saver",
|
||||
};
|
||||
|
||||
type BackgroundActivityProfileOption = BackgroundActivityProfile | "advanced";
|
||||
type BackgroundActivityOverridePatch = Partial<{
|
||||
[K in keyof BackgroundActivitySettings["overrides"]]:
|
||||
| BackgroundActivitySettings["overrides"][K]
|
||||
| undefined;
|
||||
}>;
|
||||
|
||||
const BACKGROUND_ACTIVITY_PROFILE_OPTION_LABELS: Record<BackgroundActivityProfileOption, string> = {
|
||||
...BACKGROUND_ACTIVITY_PROFILE_LABELS,
|
||||
advanced: "Advanced",
|
||||
};
|
||||
|
||||
const BACKGROUND_ACTIVITY_PROFILE_DESCRIPTIONS: Record<BackgroundActivityProfile, string> = {
|
||||
balanced:
|
||||
"Pauses background probes when clients are idle, the host is locked, or low power mode is active.",
|
||||
performance: "Allows scoped background probes while any subscribed client remains connected.",
|
||||
"battery-saver": "Also pauses background probes when the host or client is on battery.",
|
||||
};
|
||||
|
||||
const ADVANCED_BACKGROUND_ACTIVITY_DESCRIPTION =
|
||||
"Uses custom background intervals with the selected shared power policy.";
|
||||
|
||||
const PROVIDER_HEALTH_INTERVAL_STEP_SECONDS = 30;
|
||||
const DEFAULT_DRIVER_KIND = ProviderDriverKind.make("codex");
|
||||
const BACKGROUND_ACTIVITY_BOOLEAN_OVERRIDES: ReadonlyArray<{
|
||||
readonly key:
|
||||
| "pauseWhenHostLocked"
|
||||
| "pauseWhenHostLowPower"
|
||||
| "pauseWhenClientLowPower"
|
||||
| "pauseWhenOnBattery";
|
||||
readonly label: string;
|
||||
}> = [
|
||||
{ key: "pauseWhenHostLocked", label: "Pause when host is locked" },
|
||||
{ key: "pauseWhenHostLowPower", label: "Pause on host low power" },
|
||||
{ key: "pauseWhenClientLowPower", label: "Pause on client low power" },
|
||||
{ key: "pauseWhenOnBattery", label: "Pause on battery" },
|
||||
];
|
||||
|
||||
function durationToSeconds(duration: Duration.Duration): number {
|
||||
return Math.round(Duration.toMillis(duration) / 1_000);
|
||||
}
|
||||
|
||||
function normalizeIntervalSeconds(value: number | null): number {
|
||||
if (value === null || !Number.isFinite(value)) {
|
||||
return 0;
|
||||
}
|
||||
return Math.max(0, Math.round(value));
|
||||
}
|
||||
|
||||
function resolveBackgroundActivityProfileOption(settings: {
|
||||
readonly backgroundActivity: BackgroundActivitySettings;
|
||||
}): BackgroundActivityProfileOption {
|
||||
return settings.backgroundActivity.profile === "custom"
|
||||
? "advanced"
|
||||
: settings.backgroundActivity.profile;
|
||||
}
|
||||
|
||||
function resetBackgroundActivitySettings() {
|
||||
return {
|
||||
backgroundActivity: DEFAULT_UNIFIED_SETTINGS.backgroundActivity,
|
||||
};
|
||||
}
|
||||
|
||||
function backgroundActivityProfileSettings(profile: BackgroundActivityProfile) {
|
||||
return {
|
||||
backgroundActivity: {
|
||||
schemaVersion: 1 as const,
|
||||
profile,
|
||||
overrides: {},
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
function backgroundActivityOverrideSettings(
|
||||
current: BackgroundActivitySettings,
|
||||
overrides: BackgroundActivityOverridePatch,
|
||||
) {
|
||||
const nextOverrides: BackgroundActivityOverridePatch = {
|
||||
...current.overrides,
|
||||
...overrides,
|
||||
};
|
||||
for (const [key, value] of Object.entries(nextOverrides)) {
|
||||
if (value === undefined) {
|
||||
delete nextOverrides[key as keyof typeof nextOverrides];
|
||||
}
|
||||
}
|
||||
return {
|
||||
backgroundActivity: {
|
||||
schemaVersion: 1 as const,
|
||||
profile: "custom" as const,
|
||||
baseProfile: getBackgroundActivityBaseProfile(current),
|
||||
overrides: nextOverrides as BackgroundActivitySettings["overrides"],
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
function PolicyTooltip({ children }: { readonly children: string }) {
|
||||
return (
|
||||
<Tooltip>
|
||||
<TooltipTrigger
|
||||
render={
|
||||
<button
|
||||
type="button"
|
||||
className="inline-flex size-5 items-center justify-center rounded-sm text-muted-foreground hover:text-foreground"
|
||||
aria-label="Background policy details"
|
||||
>
|
||||
<InfoIcon className="size-3.5" />
|
||||
</button>
|
||||
}
|
||||
/>
|
||||
<TooltipPopup side="top" className="max-w-72">
|
||||
{children}
|
||||
</TooltipPopup>
|
||||
</Tooltip>
|
||||
);
|
||||
}
|
||||
|
||||
function withoutProviderInstanceKey<V>(
|
||||
record: Readonly<Record<ProviderInstanceId, V>> | undefined,
|
||||
@@ -562,8 +410,9 @@ export function useSettingsRestore(onRestored?: () => void) {
|
||||
...(settings.enableAssistantStreaming !== DEFAULT_UNIFIED_SETTINGS.enableAssistantStreaming
|
||||
? ["Assistant output"]
|
||||
: []),
|
||||
...(!Equal.equals(settings.backgroundActivity, DEFAULT_UNIFIED_SETTINGS.backgroundActivity)
|
||||
? ["Background activity"]
|
||||
...(Duration.toMillis(settings.automaticGitFetchInterval) !==
|
||||
Duration.toMillis(DEFAULT_UNIFIED_SETTINGS.automaticGitFetchInterval)
|
||||
? ["Automatic Git fetch interval"]
|
||||
: []),
|
||||
...(settings.defaultThreadEnvMode !== DEFAULT_UNIFIED_SETTINGS.defaultThreadEnvMode
|
||||
? ["New thread mode"]
|
||||
@@ -588,7 +437,7 @@ export function useSettingsRestore(onRestored?: () => void) {
|
||||
settings.defaultThreadEnvMode,
|
||||
settings.diffIgnoreWhitespace,
|
||||
settings.diffWordWrap,
|
||||
settings.backgroundActivity,
|
||||
settings.automaticGitFetchInterval,
|
||||
settings.enableAssistantStreaming,
|
||||
settings.sidebarThreadPreviewCount,
|
||||
settings.timestampFormat,
|
||||
@@ -614,7 +463,7 @@ export function useSettingsRestore(onRestored?: () => void) {
|
||||
sidebarThreadPreviewCount: DEFAULT_UNIFIED_SETTINGS.sidebarThreadPreviewCount,
|
||||
autoOpenPlanSidebar: DEFAULT_UNIFIED_SETTINGS.autoOpenPlanSidebar,
|
||||
enableAssistantStreaming: DEFAULT_UNIFIED_SETTINGS.enableAssistantStreaming,
|
||||
backgroundActivity: DEFAULT_UNIFIED_SETTINGS.backgroundActivity,
|
||||
automaticGitFetchInterval: DEFAULT_UNIFIED_SETTINGS.automaticGitFetchInterval,
|
||||
defaultThreadEnvMode: DEFAULT_UNIFIED_SETTINGS.defaultThreadEnvMode,
|
||||
addProjectBaseDirectory: DEFAULT_UNIFIED_SETTINGS.addProjectBaseDirectory,
|
||||
confirmThreadArchive: DEFAULT_UNIFIED_SETTINGS.confirmThreadArchive,
|
||||
@@ -630,262 +479,10 @@ export function useSettingsRestore(onRestored?: () => void) {
|
||||
};
|
||||
}
|
||||
|
||||
function BackgroundActivityAdvancedDialog({
|
||||
open,
|
||||
onOpenChange,
|
||||
}: {
|
||||
readonly open: boolean;
|
||||
readonly onOpenChange: (open: boolean) => void;
|
||||
}) {
|
||||
const settings = useSettings();
|
||||
const { updateSettings } = useUpdateSettings();
|
||||
const resolvedBackgroundActivity = resolveServerBackgroundActivitySettings(settings);
|
||||
const activeProfile = getBackgroundActivityBaseProfile(settings.backgroundActivity);
|
||||
const automaticGitFetchIntervalSeconds = durationToSeconds(
|
||||
resolvedBackgroundActivity.automaticGitFetchInterval,
|
||||
);
|
||||
const providerHealthRefreshIntervalSeconds = durationToSeconds(
|
||||
resolvedBackgroundActivity.providerHealthRefreshInterval,
|
||||
);
|
||||
const hostPowerMonitorActiveIntervalSeconds = durationToSeconds(
|
||||
resolvedBackgroundActivity.hostPowerMonitorActiveInterval,
|
||||
);
|
||||
const hostPowerMonitorIdleIntervalSeconds = durationToSeconds(
|
||||
resolvedBackgroundActivity.hostPowerMonitorIdleInterval,
|
||||
);
|
||||
|
||||
return (
|
||||
<Dialog open={open} onOpenChange={onOpenChange}>
|
||||
<DialogPopup className="max-w-xl">
|
||||
<DialogHeader>
|
||||
<DialogTitle>Background Activity</DialogTitle>
|
||||
<DialogDescription>
|
||||
Tune the shared power policy and the background intervals that feed it.
|
||||
</DialogDescription>
|
||||
</DialogHeader>
|
||||
<DialogPanel className="space-y-0 px-6 pb-5">
|
||||
<div className="overflow-hidden rounded-xl border bg-card text-card-foreground">
|
||||
<div className="flex flex-col gap-3 border-b px-4 py-3 sm:flex-row sm:items-center sm:justify-between">
|
||||
<div className="min-w-0 space-y-1">
|
||||
<div className="text-sm font-medium">Shared policy</div>
|
||||
<p className="text-xs leading-relaxed text-muted-foreground">
|
||||
Controls whether background work may run after a subscribed interval fires.
|
||||
</p>
|
||||
</div>
|
||||
<Select
|
||||
value={activeProfile}
|
||||
onValueChange={(value) => {
|
||||
if (
|
||||
value === "balanced" ||
|
||||
value === "performance" ||
|
||||
value === "battery-saver"
|
||||
) {
|
||||
updateSettings({
|
||||
backgroundActivity: {
|
||||
schemaVersion: 1 as const,
|
||||
profile: "custom" as const,
|
||||
baseProfile: value,
|
||||
overrides: settings.backgroundActivity.overrides,
|
||||
},
|
||||
});
|
||||
}
|
||||
}}
|
||||
>
|
||||
<SelectTrigger className="w-full sm:w-40" aria-label="Shared background policy">
|
||||
<SelectValue>{BACKGROUND_ACTIVITY_PROFILE_LABELS[activeProfile]}</SelectValue>
|
||||
</SelectTrigger>
|
||||
<SelectPopup align="end" alignItemWithTrigger={false}>
|
||||
<SelectItem hideIndicator value="balanced">
|
||||
{BACKGROUND_ACTIVITY_PROFILE_LABELS.balanced}
|
||||
</SelectItem>
|
||||
<SelectItem hideIndicator value="performance">
|
||||
{BACKGROUND_ACTIVITY_PROFILE_LABELS.performance}
|
||||
</SelectItem>
|
||||
<SelectItem hideIndicator value="battery-saver">
|
||||
{BACKGROUND_ACTIVITY_PROFILE_LABELS["battery-saver"]}
|
||||
</SelectItem>
|
||||
</SelectPopup>
|
||||
</Select>
|
||||
</div>
|
||||
|
||||
<div className="flex flex-col gap-3 border-b px-4 py-3 sm:flex-row sm:items-center sm:justify-between">
|
||||
<div className="min-w-0 space-y-1">
|
||||
<div className="text-sm font-medium">Git fetch interval</div>
|
||||
<p className="text-xs leading-relaxed text-muted-foreground">
|
||||
Refresh remote branch status in the background.
|
||||
</p>
|
||||
</div>
|
||||
<div className="flex shrink-0 items-center gap-2">
|
||||
<NumberField
|
||||
value={automaticGitFetchIntervalSeconds}
|
||||
min={0}
|
||||
step={5}
|
||||
size="sm"
|
||||
className="w-32"
|
||||
onValueChange={(value) =>
|
||||
updateSettings(
|
||||
backgroundActivityOverrideSettings(settings.backgroundActivity, {
|
||||
automaticGitFetchInterval: Duration.seconds(
|
||||
normalizeIntervalSeconds(value),
|
||||
),
|
||||
}),
|
||||
)
|
||||
}
|
||||
>
|
||||
<NumberFieldGroup>
|
||||
<NumberFieldDecrement aria-label="Decrease Git fetch interval" />
|
||||
<NumberFieldInput aria-label="Git fetch interval in seconds" />
|
||||
<NumberFieldIncrement aria-label="Increase Git fetch interval" />
|
||||
</NumberFieldGroup>
|
||||
</NumberField>
|
||||
<span className="text-xs text-muted-foreground">seconds</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="flex flex-col gap-3 px-4 py-3 sm:flex-row sm:items-center sm:justify-between">
|
||||
<div className="min-w-0 space-y-1">
|
||||
<div className="text-sm font-medium">Provider health interval</div>
|
||||
<p className="text-xs leading-relaxed text-muted-foreground">
|
||||
Refresh provider availability, versions, auth state, and model metadata.
|
||||
</p>
|
||||
</div>
|
||||
<div className="flex shrink-0 items-center gap-2">
|
||||
<NumberField
|
||||
value={providerHealthRefreshIntervalSeconds}
|
||||
min={0}
|
||||
step={PROVIDER_HEALTH_INTERVAL_STEP_SECONDS}
|
||||
size="sm"
|
||||
className="w-32"
|
||||
onValueChange={(value) =>
|
||||
updateSettings(
|
||||
backgroundActivityOverrideSettings(settings.backgroundActivity, {
|
||||
providerHealthRefreshInterval: Duration.seconds(
|
||||
normalizeIntervalSeconds(value),
|
||||
),
|
||||
}),
|
||||
)
|
||||
}
|
||||
>
|
||||
<NumberFieldGroup>
|
||||
<NumberFieldDecrement aria-label="Decrease provider health interval" />
|
||||
<NumberFieldInput aria-label="Provider health interval in seconds" />
|
||||
<NumberFieldIncrement aria-label="Increase provider health interval" />
|
||||
</NumberFieldGroup>
|
||||
</NumberField>
|
||||
<span className="text-xs text-muted-foreground">seconds</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="flex flex-col gap-3 border-t px-4 py-3 sm:flex-row sm:items-center sm:justify-between">
|
||||
<div className="min-w-0 space-y-1">
|
||||
<div className="text-sm font-medium">Host power monitor</div>
|
||||
<p className="text-xs leading-relaxed text-muted-foreground">
|
||||
Poll host power state while clients are active.
|
||||
</p>
|
||||
</div>
|
||||
<div className="flex shrink-0 items-center gap-2">
|
||||
<NumberField
|
||||
value={hostPowerMonitorActiveIntervalSeconds}
|
||||
min={5}
|
||||
step={5}
|
||||
size="sm"
|
||||
className="w-32"
|
||||
onValueChange={(value) =>
|
||||
updateSettings(
|
||||
backgroundActivityOverrideSettings(settings.backgroundActivity, {
|
||||
hostPowerMonitorActiveInterval: Duration.seconds(
|
||||
normalizeIntervalSeconds(value),
|
||||
),
|
||||
}),
|
||||
)
|
||||
}
|
||||
>
|
||||
<NumberFieldGroup>
|
||||
<NumberFieldDecrement aria-label="Decrease active host power interval" />
|
||||
<NumberFieldInput aria-label="Active host power interval in seconds" />
|
||||
<NumberFieldIncrement aria-label="Increase active host power interval" />
|
||||
</NumberFieldGroup>
|
||||
</NumberField>
|
||||
<span className="text-xs text-muted-foreground">seconds</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="flex flex-col gap-3 border-t px-4 py-3 sm:flex-row sm:items-center sm:justify-between">
|
||||
<div className="min-w-0 space-y-1">
|
||||
<div className="text-sm font-medium">Idle host monitor</div>
|
||||
<p className="text-xs leading-relaxed text-muted-foreground">
|
||||
Poll host power state when no foreground client is active.
|
||||
</p>
|
||||
</div>
|
||||
<div className="flex shrink-0 items-center gap-2">
|
||||
<NumberField
|
||||
value={hostPowerMonitorIdleIntervalSeconds}
|
||||
min={5}
|
||||
step={30}
|
||||
size="sm"
|
||||
className="w-32"
|
||||
onValueChange={(value) =>
|
||||
updateSettings(
|
||||
backgroundActivityOverrideSettings(settings.backgroundActivity, {
|
||||
hostPowerMonitorIdleInterval: Duration.seconds(
|
||||
normalizeIntervalSeconds(value),
|
||||
),
|
||||
}),
|
||||
)
|
||||
}
|
||||
>
|
||||
<NumberFieldGroup>
|
||||
<NumberFieldDecrement aria-label="Decrease idle host power interval" />
|
||||
<NumberFieldInput aria-label="Idle host power interval in seconds" />
|
||||
<NumberFieldIncrement aria-label="Increase idle host power interval" />
|
||||
</NumberFieldGroup>
|
||||
</NumberField>
|
||||
<span className="text-xs text-muted-foreground">seconds</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="grid gap-0 border-t sm:grid-cols-2">
|
||||
{BACKGROUND_ACTIVITY_BOOLEAN_OVERRIDES.map(({ key, label }) => (
|
||||
<label
|
||||
key={key}
|
||||
className="flex items-center justify-between gap-3 border-b px-4 py-3 last:border-b-0 sm:border-r sm:even:border-r-0"
|
||||
>
|
||||
<span className="text-sm font-medium">{label}</span>
|
||||
<Switch
|
||||
checked={resolvedBackgroundActivity[key]}
|
||||
onCheckedChange={(checked) =>
|
||||
updateSettings(
|
||||
backgroundActivityOverrideSettings(settings.backgroundActivity, {
|
||||
[key]: Boolean(checked),
|
||||
}),
|
||||
)
|
||||
}
|
||||
aria-label={label}
|
||||
/>
|
||||
</label>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
</DialogPanel>
|
||||
<DialogFooter>
|
||||
<Button
|
||||
variant="outline"
|
||||
onClick={() => updateSettings(resetBackgroundActivitySettings())}
|
||||
>
|
||||
Reset all
|
||||
</Button>
|
||||
<Button onClick={() => onOpenChange(false)}>Done</Button>
|
||||
</DialogFooter>
|
||||
</DialogPopup>
|
||||
</Dialog>
|
||||
);
|
||||
}
|
||||
|
||||
export function GeneralSettingsPanel() {
|
||||
const { theme, setTheme } = useTheme();
|
||||
const settings = useSettings();
|
||||
const { updateSettings } = useUpdateSettings();
|
||||
const [backgroundActivityDialogOpen, setBackgroundActivityDialogOpen] = useState(false);
|
||||
const observability = useServerObservability();
|
||||
const serverProviders = useServerProviders();
|
||||
const diagnosticsDescription = formatDiagnosticsDescription({
|
||||
@@ -918,21 +515,6 @@ export function GeneralSettingsPanel() {
|
||||
settings.textGenerationModelSelection ?? null,
|
||||
DEFAULT_UNIFIED_SETTINGS.textGenerationModelSelection ?? null,
|
||||
);
|
||||
const resolvedBackgroundActivity = resolveServerBackgroundActivitySettings(settings);
|
||||
const activeBackgroundActivityProfile = getBackgroundActivityBaseProfile(
|
||||
settings.backgroundActivity,
|
||||
);
|
||||
const backgroundActivityProfileOption = resolveBackgroundActivityProfileOption(settings);
|
||||
const backgroundActivityDescription =
|
||||
backgroundActivityProfileOption === "advanced"
|
||||
? `${ADVANCED_BACKGROUND_ACTIVITY_DESCRIPTION} Current shared policy: ${
|
||||
BACKGROUND_ACTIVITY_PROFILE_LABELS[activeBackgroundActivityProfile]
|
||||
}.`
|
||||
: BACKGROUND_ACTIVITY_PROFILE_DESCRIPTIONS[resolvedBackgroundActivity.profile];
|
||||
const canResetBackgroundActivity = !Equal.equals(
|
||||
settings.backgroundActivity,
|
||||
DEFAULT_UNIFIED_SETTINGS.backgroundActivity,
|
||||
);
|
||||
|
||||
return (
|
||||
<SettingsPageContainer>
|
||||
@@ -1089,88 +671,6 @@ export function GeneralSettingsPanel() {
|
||||
}
|
||||
/>
|
||||
|
||||
<SettingsRow
|
||||
title={
|
||||
<span className="inline-flex items-center gap-1.5">
|
||||
Background activity
|
||||
<PolicyTooltip>
|
||||
This shared policy gates background work such as Git refreshes and provider health
|
||||
probes after their individual intervals elapse.
|
||||
</PolicyTooltip>
|
||||
</span>
|
||||
}
|
||||
description={backgroundActivityDescription}
|
||||
resetAction={
|
||||
canResetBackgroundActivity ? (
|
||||
<SettingResetButton
|
||||
label="background activity"
|
||||
onClick={() => updateSettings(resetBackgroundActivitySettings())}
|
||||
/>
|
||||
) : null
|
||||
}
|
||||
control={
|
||||
<>
|
||||
<Select
|
||||
value={backgroundActivityProfileOption}
|
||||
onValueChange={(value) => {
|
||||
if (value === "advanced") {
|
||||
setBackgroundActivityDialogOpen(true);
|
||||
return;
|
||||
}
|
||||
if (
|
||||
value === "balanced" ||
|
||||
value === "performance" ||
|
||||
value === "battery-saver"
|
||||
) {
|
||||
updateSettings(backgroundActivityProfileSettings(value));
|
||||
}
|
||||
}}
|
||||
>
|
||||
<SelectTrigger className="w-full sm:w-40" aria-label="Background activity profile">
|
||||
<SelectValue>
|
||||
{BACKGROUND_ACTIVITY_PROFILE_OPTION_LABELS[backgroundActivityProfileOption]}
|
||||
</SelectValue>
|
||||
</SelectTrigger>
|
||||
<SelectPopup align="end" alignItemWithTrigger={false}>
|
||||
<SelectItem hideIndicator value="balanced">
|
||||
{BACKGROUND_ACTIVITY_PROFILE_LABELS.balanced}
|
||||
</SelectItem>
|
||||
<SelectItem hideIndicator value="performance">
|
||||
{BACKGROUND_ACTIVITY_PROFILE_LABELS.performance}
|
||||
</SelectItem>
|
||||
<SelectItem hideIndicator value="battery-saver">
|
||||
{BACKGROUND_ACTIVITY_PROFILE_LABELS["battery-saver"]}
|
||||
</SelectItem>
|
||||
<SelectItem hideIndicator value="advanced">
|
||||
{BACKGROUND_ACTIVITY_PROFILE_OPTION_LABELS.advanced}
|
||||
</SelectItem>
|
||||
</SelectPopup>
|
||||
</Select>
|
||||
{backgroundActivityProfileOption === "advanced" ? (
|
||||
<Tooltip>
|
||||
<TooltipTrigger
|
||||
render={
|
||||
<Button
|
||||
size="icon-sm"
|
||||
variant="outline"
|
||||
aria-label="Configure advanced background activity"
|
||||
onClick={() => setBackgroundActivityDialogOpen(true)}
|
||||
>
|
||||
<SettingsIcon className="size-4" />
|
||||
</Button>
|
||||
}
|
||||
/>
|
||||
<TooltipPopup side="top">Configure background activity</TooltipPopup>
|
||||
</Tooltip>
|
||||
) : null}
|
||||
<BackgroundActivityAdvancedDialog
|
||||
open={backgroundActivityDialogOpen}
|
||||
onOpenChange={setBackgroundActivityDialogOpen}
|
||||
/>
|
||||
</>
|
||||
}
|
||||
/>
|
||||
|
||||
<SettingsRow
|
||||
title="Auto-open task panel"
|
||||
description="Open the right-side plan and task panel automatically when steps appear."
|
||||
@@ -1446,14 +946,6 @@ export function ProviderSettingsPanel() {
|
||||
);
|
||||
const textGenerationModelSelection = resolveAppModelSelectionState(settings, serverProviders);
|
||||
const textGenInstanceId = textGenerationModelSelection.instanceId;
|
||||
const resolvedBackgroundActivity = resolveServerBackgroundActivitySettings(settings);
|
||||
const providerHealthPreset = getBackgroundActivityPresetSettings(
|
||||
getBackgroundActivityBaseProfile(settings.backgroundActivity),
|
||||
).providerHealthRefreshInterval;
|
||||
const providerHealthRefreshIntervalSeconds = durationToSeconds(
|
||||
resolvedBackgroundActivity.providerHealthRefreshInterval,
|
||||
);
|
||||
const defaultProviderHealthRefreshIntervalSeconds = durationToSeconds(providerHealthPreset);
|
||||
const lastCheckedAt =
|
||||
serverProviders.length > 0
|
||||
? serverProviders.reduce(
|
||||
@@ -1738,61 +1230,6 @@ export function ProviderSettingsPanel() {
|
||||
</div>
|
||||
}
|
||||
>
|
||||
<SettingsRow
|
||||
title={
|
||||
<span className="inline-flex items-center gap-1.5">
|
||||
Health check interval
|
||||
<PolicyTooltip>
|
||||
This interval is configured here, then the shared Background activity policy decides
|
||||
whether provider probes may run when the timer fires. Custom intervals appear as
|
||||
Advanced in General settings.
|
||||
</PolicyTooltip>
|
||||
</span>
|
||||
}
|
||||
description="Refresh provider availability, versions, auth state, and model metadata in the background. Set this to 0 seconds to rely on manual refreshes."
|
||||
resetAction={
|
||||
providerHealthRefreshIntervalSeconds !== defaultProviderHealthRefreshIntervalSeconds ? (
|
||||
<SettingResetButton
|
||||
label="provider health check interval"
|
||||
onClick={() =>
|
||||
updateSettings(
|
||||
backgroundActivityOverrideSettings(settings.backgroundActivity, {
|
||||
providerHealthRefreshInterval: undefined,
|
||||
}),
|
||||
)
|
||||
}
|
||||
/>
|
||||
) : null
|
||||
}
|
||||
control={
|
||||
<div className="flex shrink-0 items-center gap-2">
|
||||
<NumberField
|
||||
value={providerHealthRefreshIntervalSeconds}
|
||||
min={0}
|
||||
step={PROVIDER_HEALTH_INTERVAL_STEP_SECONDS}
|
||||
size="sm"
|
||||
className="w-32"
|
||||
onValueChange={(value) =>
|
||||
updateSettings(
|
||||
backgroundActivityOverrideSettings(settings.backgroundActivity, {
|
||||
providerHealthRefreshInterval: Duration.seconds(
|
||||
normalizeIntervalSeconds(value),
|
||||
),
|
||||
}),
|
||||
)
|
||||
}
|
||||
>
|
||||
<NumberFieldGroup>
|
||||
<NumberFieldDecrement aria-label="Decrease provider health check interval" />
|
||||
<NumberFieldInput aria-label="Provider health check interval in seconds" />
|
||||
<NumberFieldIncrement aria-label="Increase provider health check interval" />
|
||||
</NumberFieldGroup>
|
||||
</NumberField>
|
||||
<span className="text-xs text-muted-foreground">seconds</span>
|
||||
</div>
|
||||
}
|
||||
/>
|
||||
|
||||
{rows.map((row) => {
|
||||
const driverOption = getDriverOption(row.driver);
|
||||
const liveProvider = serverProviders.find(
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
import { ChevronDownIcon, GitPullRequestIcon, InfoIcon, RefreshCwIcon } from "lucide-react";
|
||||
import { ChevronDownIcon, GitPullRequestIcon, RefreshCwIcon } from "lucide-react";
|
||||
import * as Duration from "effect/Duration";
|
||||
import * as Option from "effect/Option";
|
||||
import { useState, type ReactNode } from "react";
|
||||
import type {
|
||||
BackgroundActivitySettings,
|
||||
SourceControlProviderKind,
|
||||
SourceControlDiscoveryResult,
|
||||
SourceControlProviderAuth,
|
||||
@@ -11,11 +10,7 @@ import type {
|
||||
VcsDriverKind,
|
||||
VcsDiscoveryItem,
|
||||
} from "@t3tools/contracts";
|
||||
import {
|
||||
getBackgroundActivityBaseProfile,
|
||||
getBackgroundActivityPresetSettings,
|
||||
resolveServerBackgroundActivitySettings,
|
||||
} from "@t3tools/shared/backgroundActivitySettings";
|
||||
import { DEFAULT_UNIFIED_SETTINGS } from "@t3tools/contracts/settings";
|
||||
|
||||
import { useSettings, useUpdateSettings } from "../../hooks/useSettings";
|
||||
import { cn } from "../../lib/utils";
|
||||
@@ -75,11 +70,6 @@ const VCS_ICONS: Partial<Record<VcsDriverKind, Icon>> = {
|
||||
|
||||
const SOURCE_CONTROL_SKELETON_ROWS = ["primary", "secondary"] as const;
|
||||
const GIT_FETCH_INTERVAL_STEP_SECONDS = 5;
|
||||
type BackgroundActivityOverridePatch = Partial<{
|
||||
[K in keyof BackgroundActivitySettings["overrides"]]:
|
||||
| BackgroundActivitySettings["overrides"][K]
|
||||
| undefined;
|
||||
}>;
|
||||
|
||||
function durationToSeconds(duration: Duration.Duration): number {
|
||||
return Math.round(Duration.toMillis(duration) / 1_000);
|
||||
@@ -92,27 +82,6 @@ function normalizeFetchIntervalSeconds(value: number | null): number {
|
||||
return Math.max(0, Math.round(value));
|
||||
}
|
||||
|
||||
function BackgroundPolicyTooltip({ children }: { readonly children: string }) {
|
||||
return (
|
||||
<Tooltip>
|
||||
<TooltipTrigger
|
||||
render={
|
||||
<button
|
||||
type="button"
|
||||
className="inline-flex size-5 items-center justify-center rounded-sm text-muted-foreground hover:text-foreground"
|
||||
aria-label="Background policy details"
|
||||
>
|
||||
<InfoIcon className="size-3.5" />
|
||||
</button>
|
||||
}
|
||||
/>
|
||||
<TooltipPopup side="top" className="max-w-72">
|
||||
{children}
|
||||
</TooltipPopup>
|
||||
</Tooltip>
|
||||
);
|
||||
}
|
||||
|
||||
function optionLabel(value: Option.Option<string>): string | null {
|
||||
return Option.getOrNull(value);
|
||||
}
|
||||
@@ -323,41 +292,14 @@ function DiscoveryItemRow({
|
||||
}
|
||||
|
||||
function GitFetchIntervalSettings() {
|
||||
const settings = useSettings();
|
||||
const automaticGitFetchInterval = useSettings((settings) => settings.automaticGitFetchInterval);
|
||||
const { updateSettings } = useUpdateSettings();
|
||||
const resolvedBackgroundActivity = resolveServerBackgroundActivitySettings(settings);
|
||||
const automaticGitFetchIntervalSeconds = durationToSeconds(
|
||||
resolvedBackgroundActivity.automaticGitFetchInterval,
|
||||
);
|
||||
const automaticGitFetchIntervalSeconds = durationToSeconds(automaticGitFetchInterval);
|
||||
const defaultAutomaticGitFetchIntervalSeconds = durationToSeconds(
|
||||
getBackgroundActivityPresetSettings(
|
||||
getBackgroundActivityBaseProfile(settings.backgroundActivity),
|
||||
).automaticGitFetchInterval,
|
||||
DEFAULT_UNIFIED_SETTINGS.automaticGitFetchInterval,
|
||||
);
|
||||
const canResetFetchInterval =
|
||||
automaticGitFetchIntervalSeconds !== defaultAutomaticGitFetchIntervalSeconds;
|
||||
const backgroundActivityOverrideSettings = (
|
||||
current: BackgroundActivitySettings,
|
||||
overrides: BackgroundActivityOverridePatch,
|
||||
) => {
|
||||
const nextOverrides: BackgroundActivityOverridePatch = {
|
||||
...current.overrides,
|
||||
...overrides,
|
||||
};
|
||||
for (const [key, value] of Object.entries(nextOverrides)) {
|
||||
if (value === undefined) {
|
||||
delete nextOverrides[key as keyof typeof nextOverrides];
|
||||
}
|
||||
}
|
||||
return {
|
||||
backgroundActivity: {
|
||||
schemaVersion: 1 as const,
|
||||
profile: "custom" as const,
|
||||
baseProfile: getBackgroundActivityBaseProfile(current),
|
||||
overrides: nextOverrides as BackgroundActivitySettings["overrides"],
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="grid gap-3">
|
||||
@@ -365,11 +307,6 @@ function GitFetchIntervalSettings() {
|
||||
<div className="min-w-0 space-y-1">
|
||||
<div className="flex min-w-0 items-center gap-1">
|
||||
<span className="text-xs font-medium text-foreground">Fetch interval</span>
|
||||
<BackgroundPolicyTooltip>
|
||||
This interval is configured for Git only. The shared Background activity policy still
|
||||
decides whether Git refreshes may run when the timer fires. Custom intervals appear as
|
||||
Advanced in General settings.
|
||||
</BackgroundPolicyTooltip>
|
||||
<span
|
||||
className={cn(
|
||||
"inline-flex size-5 shrink-0 items-center justify-center transition-opacity",
|
||||
@@ -381,11 +318,9 @@ function GitFetchIntervalSettings() {
|
||||
<SettingResetButton
|
||||
label="fetch interval"
|
||||
onClick={() =>
|
||||
updateSettings(
|
||||
backgroundActivityOverrideSettings(settings.backgroundActivity, {
|
||||
automaticGitFetchInterval: undefined,
|
||||
}),
|
||||
)
|
||||
updateSettings({
|
||||
automaticGitFetchInterval: DEFAULT_UNIFIED_SETTINGS.automaticGitFetchInterval,
|
||||
})
|
||||
}
|
||||
/>
|
||||
) : null}
|
||||
@@ -404,11 +339,9 @@ function GitFetchIntervalSettings() {
|
||||
size="sm"
|
||||
className="w-32"
|
||||
onValueChange={(value) =>
|
||||
updateSettings(
|
||||
backgroundActivityOverrideSettings(settings.backgroundActivity, {
|
||||
automaticGitFetchInterval: Duration.seconds(normalizeFetchIntervalSeconds(value)),
|
||||
}),
|
||||
)
|
||||
updateSettings({
|
||||
automaticGitFetchInterval: Duration.seconds(normalizeFetchIntervalSeconds(value)),
|
||||
})
|
||||
}
|
||||
>
|
||||
<NumberFieldGroup>
|
||||
|
||||
@@ -173,10 +173,6 @@ vi.mock("@t3tools/client-runtime", async (importOriginal) => {
|
||||
getProcessDiagnostics: vi.fn(),
|
||||
getProcessResourceHistory: vi.fn(),
|
||||
signalProcess: vi.fn(),
|
||||
reportClientActivity: vi.fn(),
|
||||
reportHostPowerState: vi.fn(),
|
||||
getBackgroundPolicy: vi.fn(),
|
||||
subscribeBackgroundPolicy: vi.fn(() => () => undefined),
|
||||
},
|
||||
};
|
||||
return {
|
||||
|
||||
@@ -92,7 +92,6 @@ import {
|
||||
|
||||
const decodeIssuedBearerScopes = Schema.decodeUnknownSync(Schema.Array(AuthEnvironmentScope));
|
||||
import { getClientSettings } from "~/hooks/useSettings";
|
||||
import { startBackgroundActivityReporter } from "~/lib/backgroundActivityReporter";
|
||||
import { subscribeTerminalMetadata, terminalSessionManager } from "../../terminalSessionState";
|
||||
import { subscribePortDiscovery, usePortDiscoveryStore } from "../../portDiscoveryState";
|
||||
import { resetWsReconnectBackoff } from "~/rpc/wsConnectionState";
|
||||
@@ -2055,10 +2054,6 @@ export function startEnvironmentConnectionService(queryClient: QueryClient): ()
|
||||
.catch(() => undefined);
|
||||
|
||||
const unsubscribeBrowserResumeReconnects = subscribeBrowserResumeReconnects();
|
||||
const stopBackgroundActivityReporter = startBackgroundActivityReporter({
|
||||
getConnections: listEnvironmentConnections,
|
||||
subscribeConnections: subscribeEnvironmentConnections,
|
||||
});
|
||||
|
||||
activeService = {
|
||||
queryClient,
|
||||
@@ -2067,7 +2062,6 @@ export function startEnvironmentConnectionService(queryClient: QueryClient): ()
|
||||
stop: () => {
|
||||
unsubscribeSavedEnvironments();
|
||||
unsubscribeBrowserResumeReconnects();
|
||||
stopBackgroundActivityReporter();
|
||||
queryInvalidationThrottler.cancel();
|
||||
},
|
||||
};
|
||||
|
||||
@@ -1,39 +0,0 @@
|
||||
import { DEFAULT_SERVER_SETTINGS } from "@t3tools/contracts";
|
||||
import * as Duration from "effect/Duration";
|
||||
import { describe, expect, it, vi } from "vite-plus/test";
|
||||
import { createServerSettingsWriteQueue } from "./serverSettingsWriteQueue";
|
||||
|
||||
describe("serverSettingsWriteQueue", () => {
|
||||
it("serializes server settings writes so later calls cannot be overtaken", async () => {
|
||||
const applied: Array<number> = [];
|
||||
const updateSettings = vi
|
||||
.fn()
|
||||
.mockImplementationOnce(async () => ({
|
||||
...DEFAULT_SERVER_SETTINGS,
|
||||
automaticGitFetchInterval: Duration.seconds(10),
|
||||
}))
|
||||
.mockImplementationOnce(async () => ({
|
||||
...DEFAULT_SERVER_SETTINGS,
|
||||
automaticGitFetchInterval: Duration.seconds(25),
|
||||
}));
|
||||
const queue = createServerSettingsWriteQueue({
|
||||
updateSettings,
|
||||
applySettings: (settings) => {
|
||||
applied.push(Duration.toMillis(settings.automaticGitFetchInterval));
|
||||
},
|
||||
onError: vi.fn(),
|
||||
});
|
||||
|
||||
queue.enqueue({ automaticGitFetchInterval: Duration.seconds(10) });
|
||||
queue.enqueue({ automaticGitFetchInterval: Duration.seconds(25) });
|
||||
await queue.drain();
|
||||
|
||||
expect(updateSettings).toHaveBeenNthCalledWith(1, {
|
||||
automaticGitFetchInterval: Duration.seconds(10),
|
||||
});
|
||||
expect(updateSettings).toHaveBeenNthCalledWith(2, {
|
||||
automaticGitFetchInterval: Duration.seconds(25),
|
||||
});
|
||||
expect(applied).toEqual([10_000, 25_000]);
|
||||
});
|
||||
});
|
||||
@@ -1,31 +0,0 @@
|
||||
import type { ServerSettings, ServerSettingsPatch } from "@t3tools/contracts";
|
||||
|
||||
export interface ServerSettingsWriteQueue {
|
||||
readonly enqueue: (patch: ServerSettingsPatch) => void;
|
||||
readonly reset: () => void;
|
||||
readonly drain: () => Promise<void>;
|
||||
}
|
||||
|
||||
export function createServerSettingsWriteQueue(input: {
|
||||
readonly updateSettings: (patch: ServerSettingsPatch) => Promise<ServerSettings>;
|
||||
readonly applySettings: (settings: ServerSettings) => void;
|
||||
readonly onError: (error: unknown) => void;
|
||||
}): ServerSettingsWriteQueue {
|
||||
let queue: Promise<void> = Promise.resolve();
|
||||
|
||||
return {
|
||||
enqueue: (patch) => {
|
||||
queue = queue
|
||||
.catch(() => undefined)
|
||||
.then(async () => {
|
||||
const settings = await input.updateSettings(patch);
|
||||
input.applySettings(settings);
|
||||
})
|
||||
.catch(input.onError);
|
||||
},
|
||||
reset: () => {
|
||||
queue = Promise.resolve();
|
||||
},
|
||||
drain: () => queue,
|
||||
};
|
||||
}
|
||||
@@ -22,7 +22,6 @@ import { ensureLocalApi } from "~/localApi";
|
||||
import * as Struct from "effect/Struct";
|
||||
import { applyServerSettingsPatch } from "@t3tools/shared/serverSettings";
|
||||
import { applySettingsUpdated, getServerConfig, useServerSettings } from "~/rpc/serverState";
|
||||
import { createServerSettingsWriteQueue } from "./serverSettingsWriteQueue";
|
||||
|
||||
const CLIENT_SETTINGS_PERSISTENCE_ERROR_SCOPE = "[CLIENT_SETTINGS]";
|
||||
|
||||
@@ -31,13 +30,6 @@ const clientSettingsHydrationListeners = new Set<() => void>();
|
||||
let clientSettingsSnapshot = DEFAULT_CLIENT_SETTINGS;
|
||||
let clientSettingsHydrated = false;
|
||||
let clientSettingsHydrationPromise: Promise<void> | null = null;
|
||||
const serverSettingsWriteQueue = createServerSettingsWriteQueue({
|
||||
updateSettings: (patch) => ensureLocalApi().server.updateSettings(patch),
|
||||
applySettings: applySettingsUpdated,
|
||||
onError: (error) => {
|
||||
console.error("[SERVER_SETTINGS] update failed", error);
|
||||
},
|
||||
});
|
||||
|
||||
function emitClientSettingsChange() {
|
||||
for (const listener of clientSettingsListeners) {
|
||||
@@ -151,10 +143,6 @@ function splitPatch(patch: Partial<UnifiedSettings>): {
|
||||
};
|
||||
}
|
||||
|
||||
function enqueueServerSettingsUpdate(serverPatch: ServerSettingsPatch): void {
|
||||
serverSettingsWriteQueue.enqueue(serverPatch);
|
||||
}
|
||||
|
||||
// ── Hooks ────────────────────────────────────────────────────────────
|
||||
|
||||
/**
|
||||
@@ -213,7 +201,8 @@ export function useUpdateSettings() {
|
||||
if (currentServerConfig) {
|
||||
applySettingsUpdated(applyServerSettingsPatch(currentServerConfig.settings, serverPatch));
|
||||
}
|
||||
enqueueServerSettingsUpdate(serverPatch);
|
||||
// Fire-and-forget RPC — push will reconcile on success
|
||||
void ensureLocalApi().server.updateSettings(serverPatch);
|
||||
}
|
||||
|
||||
if (Object.keys(clientPatch).length > 0) {
|
||||
@@ -238,7 +227,6 @@ export function __resetClientSettingsPersistenceForTests(): void {
|
||||
clientSettingsSnapshot = DEFAULT_CLIENT_SETTINGS;
|
||||
clientSettingsHydrated = false;
|
||||
clientSettingsHydrationPromise = null;
|
||||
serverSettingsWriteQueue.reset();
|
||||
clientSettingsListeners.clear();
|
||||
clientSettingsHydrationListeners.clear();
|
||||
}
|
||||
@@ -1,160 +0,0 @@
|
||||
import type { BackgroundScope, ClientActivityReportInput } from "@t3tools/contracts";
|
||||
import * as DateTime from "effect/DateTime";
|
||||
|
||||
import type { EnvironmentConnection } from "../environments/runtime/connection";
|
||||
import { randomUUID } from "./utils";
|
||||
|
||||
const CLIENT_ID_STORAGE_KEY = "t3.backgroundActivity.clientId";
|
||||
const REPORT_INTERVAL_MS = 25_000;
|
||||
const LEASE_TTL_MS = 45_000;
|
||||
const BASELINE_SCOPES: ReadonlyArray<BackgroundScope> = [{ type: "provider-status" }];
|
||||
|
||||
interface RetainedScope {
|
||||
readonly scope: BackgroundScope;
|
||||
refCount: number;
|
||||
}
|
||||
|
||||
interface BackgroundActivityReporterOptions {
|
||||
readonly getConnections: () => ReadonlyArray<EnvironmentConnection>;
|
||||
readonly subscribeConnections: (listener: () => void) => () => void;
|
||||
}
|
||||
|
||||
const retainedScopes = new Map<string, RetainedScope>();
|
||||
const retainedScopeListeners = new Set<() => void>();
|
||||
|
||||
function notifyRetainedScopesChanged(): void {
|
||||
for (const listener of retainedScopeListeners) {
|
||||
listener();
|
||||
}
|
||||
}
|
||||
|
||||
function stableScopeKey(scope: BackgroundScope): string {
|
||||
switch (scope.type) {
|
||||
case "server-config":
|
||||
case "diagnostics":
|
||||
return scope.type;
|
||||
case "provider-status":
|
||||
return scope.instanceId ? `${scope.type}:${scope.instanceId}` : scope.type;
|
||||
case "vcs-status":
|
||||
case "git-refs":
|
||||
return `${scope.type}:${scope.cwd}`;
|
||||
case "thread":
|
||||
return `${scope.type}:${scope.threadId}`;
|
||||
}
|
||||
}
|
||||
|
||||
function getClientId(): string {
|
||||
try {
|
||||
const existing = window.localStorage.getItem(CLIENT_ID_STORAGE_KEY);
|
||||
if (existing) return existing;
|
||||
const next = randomUUID();
|
||||
window.localStorage.setItem(CLIENT_ID_STORAGE_KEY, next);
|
||||
return next;
|
||||
} catch {
|
||||
return "ephemeral-browser-client";
|
||||
}
|
||||
}
|
||||
|
||||
function resolveClientKind(): ClientActivityReportInput["clientKind"] {
|
||||
return window.desktopBridge ? "desktop-renderer" : "web";
|
||||
}
|
||||
|
||||
function createActivityReport(): ClientActivityReportInput {
|
||||
return {
|
||||
clientId: getClientId(),
|
||||
clientKind: resolveClientKind(),
|
||||
visible: document.visibilityState === "visible",
|
||||
focused: document.hasFocus(),
|
||||
recentlyInteracted: document.hasFocus(),
|
||||
appState: document.visibilityState === "visible" ? "active" : "background",
|
||||
scopes: [...BASELINE_SCOPES, ...[...retainedScopes.values()].map((entry) => entry.scope)],
|
||||
ttlMs: LEASE_TTL_MS,
|
||||
observedAt: DateTime.makeUnsafe(new Date().toISOString()),
|
||||
};
|
||||
}
|
||||
|
||||
async function reportToConnections(
|
||||
connections: ReadonlyArray<EnvironmentConnection>,
|
||||
): Promise<void> {
|
||||
if (connections.length === 0) return;
|
||||
const report = createActivityReport();
|
||||
await Promise.allSettled(
|
||||
connections.map((connection) => connection.client.server.reportClientActivity(report)),
|
||||
);
|
||||
}
|
||||
|
||||
export function startBackgroundActivityReporter(
|
||||
options: BackgroundActivityReporterOptions,
|
||||
): () => void {
|
||||
if (
|
||||
typeof window === "undefined" ||
|
||||
typeof document === "undefined" ||
|
||||
typeof window.setInterval !== "function"
|
||||
) {
|
||||
return () => {};
|
||||
}
|
||||
|
||||
let disposed = false;
|
||||
let reportTimer: number | null = null;
|
||||
|
||||
const report = () => {
|
||||
if (disposed) return;
|
||||
void reportToConnections(options.getConnections());
|
||||
};
|
||||
|
||||
const scheduleReport = () => {
|
||||
if (disposed) return;
|
||||
if (reportTimer !== null) {
|
||||
window.clearTimeout(reportTimer);
|
||||
}
|
||||
reportTimer = window.setTimeout(() => {
|
||||
reportTimer = null;
|
||||
report();
|
||||
}, 250);
|
||||
};
|
||||
|
||||
const interval = window.setInterval(report, REPORT_INTERVAL_MS);
|
||||
const unsubscribeConnections = options.subscribeConnections(scheduleReport);
|
||||
retainedScopeListeners.add(scheduleReport);
|
||||
document.addEventListener("visibilitychange", scheduleReport);
|
||||
window.addEventListener("focus", scheduleReport);
|
||||
window.addEventListener("blur", scheduleReport);
|
||||
window.addEventListener("online", scheduleReport);
|
||||
|
||||
scheduleReport();
|
||||
|
||||
return () => {
|
||||
disposed = true;
|
||||
if (reportTimer !== null) {
|
||||
window.clearTimeout(reportTimer);
|
||||
}
|
||||
window.clearInterval(interval);
|
||||
unsubscribeConnections();
|
||||
retainedScopeListeners.delete(scheduleReport);
|
||||
document.removeEventListener("visibilitychange", scheduleReport);
|
||||
window.removeEventListener("focus", scheduleReport);
|
||||
window.removeEventListener("blur", scheduleReport);
|
||||
window.removeEventListener("online", scheduleReport);
|
||||
};
|
||||
}
|
||||
|
||||
export function retainBackgroundScope(scope: BackgroundScope): () => void {
|
||||
const key = stableScopeKey(scope);
|
||||
const existing = retainedScopes.get(key);
|
||||
if (existing) {
|
||||
existing.refCount += 1;
|
||||
} else {
|
||||
retainedScopes.set(key, { scope, refCount: 1 });
|
||||
notifyRetainedScopesChanged();
|
||||
}
|
||||
|
||||
return () => {
|
||||
const current = retainedScopes.get(key);
|
||||
if (!current) return;
|
||||
current.refCount -= 1;
|
||||
if (current.refCount <= 0) {
|
||||
retainedScopes.delete(key);
|
||||
notifyRetainedScopesChanged();
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -18,7 +18,6 @@ import {
|
||||
subscribeEnvironmentConnections,
|
||||
} from "../environments/runtime";
|
||||
import { appAtomRegistry } from "../rpc/atomRegistry";
|
||||
import { retainBackgroundScope } from "./backgroundActivityReporter";
|
||||
|
||||
export type { VcsStatusState, VcsStatusTarget };
|
||||
export { getVcsStatusDataForTarget };
|
||||
@@ -41,15 +40,7 @@ export function getVcsStatusSnapshot(target: VcsStatusTarget): VcsStatusState {
|
||||
}
|
||||
|
||||
export function watchVcsStatus(target: VcsStatusTarget, client?: VcsStatusClient): () => void {
|
||||
if (target.cwd === null) {
|
||||
return manager.watch(target, client);
|
||||
}
|
||||
const releaseScope = retainBackgroundScope({ type: "vcs-status", cwd: target.cwd });
|
||||
const unwatch = manager.watch(target, client);
|
||||
return () => {
|
||||
unwatch();
|
||||
releaseScope();
|
||||
};
|
||||
return manager.watch(target, client);
|
||||
}
|
||||
|
||||
export function refreshVcsStatus(target: VcsStatusTarget, client?: VcsStatusClient) {
|
||||
@@ -63,7 +54,7 @@ export function resetVcsStatusStateForTests(): void {
|
||||
export function useVcsStatus(target: VcsStatusTarget): VcsStatusState {
|
||||
const targetKey = getVcsStatusTargetKey(target);
|
||||
useEffect(
|
||||
() => watchVcsStatus({ environmentId: target.environmentId, cwd: target.cwd }),
|
||||
() => manager.watch({ environmentId: target.environmentId, cwd: target.cwd }),
|
||||
[target.environmentId, target.cwd],
|
||||
);
|
||||
|
||||
|
||||
@@ -172,12 +172,6 @@ export interface WsRpcClient {
|
||||
typeof WS_METHODS.serverGetProcessResourceHistory
|
||||
>;
|
||||
readonly signalProcess: RpcUnaryMethod<typeof WS_METHODS.serverSignalProcess>;
|
||||
readonly reportClientActivity: RpcUnaryMethod<typeof WS_METHODS.serverReportClientActivity>;
|
||||
readonly reportHostPowerState: RpcUnaryMethod<typeof WS_METHODS.serverReportHostPowerState>;
|
||||
readonly getBackgroundPolicy: RpcUnaryNoArgMethod<typeof WS_METHODS.serverGetBackgroundPolicy>;
|
||||
readonly subscribeBackgroundPolicy: RpcStreamMethod<
|
||||
typeof WS_METHODS.subscribeBackgroundPolicy
|
||||
>;
|
||||
};
|
||||
readonly cloud: {
|
||||
readonly getRelayClientStatus: RpcUnaryNoArgMethod<typeof WS_METHODS.cloudGetRelayClientStatus>;
|
||||
@@ -397,18 +391,6 @@ export function createWsRpcClient(
|
||||
transport.request((client) => client[WS_METHODS.serverGetProcessResourceHistory](input)),
|
||||
signalProcess: (input) =>
|
||||
transport.request((client) => client[WS_METHODS.serverSignalProcess](input)),
|
||||
reportClientActivity: (input) =>
|
||||
transport.request((client) => client[WS_METHODS.serverReportClientActivity](input)),
|
||||
reportHostPowerState: (input) =>
|
||||
transport.request((client) => client[WS_METHODS.serverReportHostPowerState](input)),
|
||||
getBackgroundPolicy: () =>
|
||||
transport.request((client) => client[WS_METHODS.serverGetBackgroundPolicy]({})),
|
||||
subscribeBackgroundPolicy: (listener, options) =>
|
||||
transport.subscribe(
|
||||
(client) => client[WS_METHODS.subscribeBackgroundPolicy]({}),
|
||||
listener,
|
||||
subscriptionOptions(options, WS_METHODS.subscribeBackgroundPolicy),
|
||||
),
|
||||
},
|
||||
cloud: {
|
||||
getRelayClientStatus: () =>
|
||||
|
||||
@@ -1,101 +0,0 @@
|
||||
import * as Schema from "effect/Schema";
|
||||
|
||||
import { AuthSessionId, EnvironmentId, RpcClientId, ThreadId } from "./baseSchemas.ts";
|
||||
import { ProviderInstanceId } from "./providerInstance.ts";
|
||||
|
||||
export const BackgroundBooleanState = Schema.Literals(["true", "false", "unknown"]);
|
||||
export type BackgroundBooleanState = typeof BackgroundBooleanState.Type;
|
||||
|
||||
export const HostPowerThermalState = Schema.Literals([
|
||||
"unknown",
|
||||
"nominal",
|
||||
"fair",
|
||||
"serious",
|
||||
"critical",
|
||||
]);
|
||||
export type HostPowerThermalState = typeof HostPowerThermalState.Type;
|
||||
|
||||
export const HostPowerSource = Schema.Literals([
|
||||
"unknown",
|
||||
"node-macos-shell",
|
||||
"node-macos-native",
|
||||
"node-linux",
|
||||
"node-windows",
|
||||
"electron-main",
|
||||
]);
|
||||
export type HostPowerSource = typeof HostPowerSource.Type;
|
||||
|
||||
export const HostPowerSnapshot = Schema.Struct({
|
||||
source: HostPowerSource,
|
||||
idle: BackgroundBooleanState,
|
||||
idleSeconds: Schema.NullOr(Schema.Number),
|
||||
locked: BackgroundBooleanState,
|
||||
suspended: Schema.Boolean,
|
||||
onBattery: BackgroundBooleanState,
|
||||
lowPowerMode: BackgroundBooleanState,
|
||||
thermalState: HostPowerThermalState,
|
||||
stale: Schema.Boolean,
|
||||
updatedAt: Schema.DateTimeUtc,
|
||||
});
|
||||
export type HostPowerSnapshot = typeof HostPowerSnapshot.Type;
|
||||
|
||||
export const BackgroundScope = Schema.Union([
|
||||
Schema.Struct({ type: Schema.Literal("server-config") }),
|
||||
Schema.Struct({
|
||||
type: Schema.Literal("provider-status"),
|
||||
instanceId: Schema.optionalKey(ProviderInstanceId),
|
||||
}),
|
||||
Schema.Struct({ type: Schema.Literal("vcs-status"), cwd: Schema.String }),
|
||||
Schema.Struct({ type: Schema.Literal("git-refs"), cwd: Schema.String }),
|
||||
Schema.Struct({ type: Schema.Literal("diagnostics") }),
|
||||
Schema.Struct({ type: Schema.Literal("thread"), threadId: ThreadId }),
|
||||
]);
|
||||
export type BackgroundScope = typeof BackgroundScope.Type;
|
||||
|
||||
export const ClientKind = Schema.Literals(["web", "desktop-renderer", "mobile", "unknown"]);
|
||||
export type ClientKind = typeof ClientKind.Type;
|
||||
|
||||
export const ClientActivityReportInput = Schema.Struct({
|
||||
environmentId: Schema.optionalKey(EnvironmentId),
|
||||
clientId: Schema.String,
|
||||
clientKind: ClientKind,
|
||||
visible: Schema.Boolean,
|
||||
focused: Schema.Boolean,
|
||||
recentlyInteracted: Schema.Boolean,
|
||||
appState: Schema.optionalKey(Schema.Literals(["active", "inactive", "background", "unknown"])),
|
||||
lowPowerMode: Schema.optionalKey(BackgroundBooleanState),
|
||||
batteryState: Schema.optionalKey(Schema.Literals(["unknown", "unplugged", "charging", "full"])),
|
||||
networkType: Schema.optionalKey(Schema.String),
|
||||
scopes: Schema.Array(BackgroundScope),
|
||||
ttlMs: Schema.optionalKey(Schema.Number),
|
||||
observedAt: Schema.DateTimeUtc,
|
||||
});
|
||||
export type ClientActivityReportInput = typeof ClientActivityReportInput.Type;
|
||||
|
||||
export const ClientActivityLease = Schema.Struct({
|
||||
sessionId: AuthSessionId,
|
||||
rpcClientId: RpcClientId,
|
||||
clientId: Schema.String,
|
||||
clientKind: ClientKind,
|
||||
visible: Schema.Boolean,
|
||||
focused: Schema.Boolean,
|
||||
recentlyInteracted: Schema.Boolean,
|
||||
appState: Schema.optionalKey(Schema.Literals(["active", "inactive", "background", "unknown"])),
|
||||
lowPowerMode: Schema.optionalKey(BackgroundBooleanState),
|
||||
batteryState: Schema.optionalKey(Schema.Literals(["unknown", "unplugged", "charging", "full"])),
|
||||
networkType: Schema.optionalKey(Schema.String),
|
||||
scopes: Schema.Array(BackgroundScope),
|
||||
updatedAt: Schema.DateTimeUtc,
|
||||
expiresAt: Schema.DateTimeUtc,
|
||||
});
|
||||
export type ClientActivityLease = typeof ClientActivityLease.Type;
|
||||
|
||||
export const BackgroundPolicySnapshot = Schema.Struct({
|
||||
hostPower: HostPowerSnapshot,
|
||||
leases: Schema.Array(ClientActivityLease),
|
||||
activeForegroundLeaseCount: Schema.Number,
|
||||
activeScopeKeys: Schema.Array(Schema.String),
|
||||
shouldRunOpportunisticWork: Schema.Boolean,
|
||||
updatedAt: Schema.DateTimeUtc,
|
||||
});
|
||||
export type BackgroundPolicySnapshot = typeof BackgroundPolicySnapshot.Type;
|
||||
@@ -43,8 +43,6 @@ export const TurnId = makeEntityId("TurnId");
|
||||
export type TurnId = typeof TurnId.Type;
|
||||
export const AuthSessionId = makeEntityId("AuthSessionId");
|
||||
export type AuthSessionId = typeof AuthSessionId.Type;
|
||||
export const RpcClientId = NonNegativeInt.pipe(Schema.brand("RpcClientId"));
|
||||
export type RpcClientId = typeof RpcClientId.Type;
|
||||
|
||||
export const ProviderItemId = makeEntityId("ProviderItemId");
|
||||
export type ProviderItemId = typeof ProviderItemId.Type;
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
export * from "./baseSchemas.ts";
|
||||
export * from "./background.ts";
|
||||
export * from "./auth.ts";
|
||||
export * from "./environment.ts";
|
||||
export * from "./environmentHttp.ts";
|
||||
|
||||
@@ -8,11 +8,6 @@ import {
|
||||
AuthAccessStreamEvent,
|
||||
EnvironmentAuthorizationError,
|
||||
} from "./auth.ts";
|
||||
import {
|
||||
BackgroundPolicySnapshot,
|
||||
ClientActivityReportInput,
|
||||
HostPowerSnapshot,
|
||||
} from "./background.ts";
|
||||
import {
|
||||
FilesystemBrowseInput,
|
||||
FilesystemBrowseResult,
|
||||
@@ -216,9 +211,6 @@ export const WS_METHODS = {
|
||||
serverGetProcessDiagnostics: "server.getProcessDiagnostics",
|
||||
serverGetProcessResourceHistory: "server.getProcessResourceHistory",
|
||||
serverSignalProcess: "server.signalProcess",
|
||||
serverReportClientActivity: "server.reportClientActivity",
|
||||
serverReportHostPowerState: "server.reportHostPowerState",
|
||||
serverGetBackgroundPolicy: "server.getBackgroundPolicy",
|
||||
|
||||
// Cloud environment methods
|
||||
cloudGetRelayClientStatus: "cloud.getRelayClientStatus",
|
||||
@@ -238,7 +230,6 @@ export const WS_METHODS = {
|
||||
subscribeServerConfig: "subscribeServerConfig",
|
||||
subscribeServerLifecycle: "subscribeServerLifecycle",
|
||||
subscribeAuthAccess: "subscribeAuthAccess",
|
||||
subscribeBackgroundPolicy: "subscribeBackgroundPolicy",
|
||||
} as const;
|
||||
|
||||
export const WsServerUpsertKeybindingRpc = Rpc.make(WS_METHODS.serverUpsertKeybinding, {
|
||||
@@ -337,22 +328,6 @@ export const WsCloudInstallRelayClientRpc = Rpc.make(WS_METHODS.cloudInstallRela
|
||||
stream: true,
|
||||
});
|
||||
|
||||
export const WsServerReportClientActivityRpc = Rpc.make(WS_METHODS.serverReportClientActivity, {
|
||||
payload: ClientActivityReportInput,
|
||||
error: EnvironmentAuthorizationError,
|
||||
});
|
||||
|
||||
export const WsServerReportHostPowerStateRpc = Rpc.make(WS_METHODS.serverReportHostPowerState, {
|
||||
payload: HostPowerSnapshot,
|
||||
error: EnvironmentAuthorizationError,
|
||||
});
|
||||
|
||||
export const WsServerGetBackgroundPolicyRpc = Rpc.make(WS_METHODS.serverGetBackgroundPolicy, {
|
||||
payload: Schema.Struct({}),
|
||||
success: BackgroundPolicySnapshot,
|
||||
error: EnvironmentAuthorizationError,
|
||||
});
|
||||
|
||||
export const WsSourceControlLookupRepositoryRpc = Rpc.make(
|
||||
WS_METHODS.sourceControlLookupRepository,
|
||||
{
|
||||
@@ -703,13 +678,6 @@ export const WsSubscribeAuthAccessRpc = Rpc.make(WS_METHODS.subscribeAuthAccess,
|
||||
stream: true,
|
||||
});
|
||||
|
||||
export const WsSubscribeBackgroundPolicyRpc = Rpc.make(WS_METHODS.subscribeBackgroundPolicy, {
|
||||
payload: Schema.Struct({}),
|
||||
success: BackgroundPolicySnapshot,
|
||||
error: EnvironmentAuthorizationError,
|
||||
stream: true,
|
||||
});
|
||||
|
||||
export const WsRpcGroup = RpcGroup.make(
|
||||
WsServerGetConfigRpc,
|
||||
WsServerRefreshProvidersRpc,
|
||||
@@ -723,9 +691,6 @@ export const WsRpcGroup = RpcGroup.make(
|
||||
WsServerGetProcessDiagnosticsRpc,
|
||||
WsServerGetProcessResourceHistoryRpc,
|
||||
WsServerSignalProcessRpc,
|
||||
WsServerReportClientActivityRpc,
|
||||
WsServerReportHostPowerStateRpc,
|
||||
WsServerGetBackgroundPolicyRpc,
|
||||
WsCloudGetRelayClientStatusRpc,
|
||||
WsCloudInstallRelayClientRpc,
|
||||
WsSourceControlLookupRepositoryRpc,
|
||||
@@ -775,7 +740,6 @@ export const WsRpcGroup = RpcGroup.make(
|
||||
WsSubscribeServerConfigRpc,
|
||||
WsSubscribeServerLifecycleRpc,
|
||||
WsSubscribeAuthAccessRpc,
|
||||
WsSubscribeBackgroundPolicyRpc,
|
||||
WsOrchestrationDispatchCommandRpc,
|
||||
WsOrchestrationGetTurnDiffRpc,
|
||||
WsOrchestrationGetFullThreadDiffRpc,
|
||||
|
||||
@@ -40,7 +40,7 @@ export type SidebarThreadPreviewCount = typeof SidebarThreadPreviewCount.Type;
|
||||
export const DEFAULT_SIDEBAR_THREAD_PREVIEW_COUNT: SidebarThreadPreviewCount = 6;
|
||||
|
||||
export const ClientSettingsSchema = Schema.Struct({
|
||||
autoOpenPlanSidebar: Schema.Boolean.pipe(Schema.withDecodingDefault(Effect.succeed(true))),
|
||||
autoOpenPlanSidebar: Schema.Boolean.pipe(Schema.withDecodingDefault(Effect.succeed(false))),
|
||||
confirmThreadArchive: Schema.Boolean.pipe(Schema.withDecodingDefault(Effect.succeed(false))),
|
||||
confirmThreadDelete: Schema.Boolean.pipe(Schema.withDecodingDefault(Effect.succeed(true))),
|
||||
dismissedProviderUpdateNotificationKeys: Schema.Array(TrimmedNonEmptyString).pipe(
|
||||
@@ -362,65 +362,14 @@ export const ObservabilitySettings = Schema.Struct({
|
||||
export type ObservabilitySettings = typeof ObservabilitySettings.Type;
|
||||
|
||||
export const DEFAULT_AUTOMATIC_GIT_FETCH_INTERVAL = Duration.seconds(30);
|
||||
export const DEFAULT_PROVIDER_HEALTH_REFRESH_INTERVAL = Duration.minutes(5);
|
||||
|
||||
export const BackgroundActivityProfile = Schema.Literals([
|
||||
"balanced",
|
||||
"performance",
|
||||
"battery-saver",
|
||||
]);
|
||||
export type BackgroundActivityProfile = typeof BackgroundActivityProfile.Type;
|
||||
export const DEFAULT_BACKGROUND_ACTIVITY_PROFILE: BackgroundActivityProfile = "balanced";
|
||||
|
||||
export const BackgroundActivityProfileSelection = Schema.Literals([
|
||||
"balanced",
|
||||
"performance",
|
||||
"battery-saver",
|
||||
"custom",
|
||||
]);
|
||||
export type BackgroundActivityProfileSelection = typeof BackgroundActivityProfileSelection.Type;
|
||||
|
||||
export const BackgroundActivityOverrides = Schema.Struct({
|
||||
automaticGitFetchInterval: Schema.optionalKey(Schema.DurationFromMillis),
|
||||
providerHealthRefreshInterval: Schema.optionalKey(Schema.DurationFromMillis),
|
||||
hostPowerMonitorActiveInterval: Schema.optionalKey(Schema.DurationFromMillis),
|
||||
hostPowerMonitorIdleInterval: Schema.optionalKey(Schema.DurationFromMillis),
|
||||
idleClientTtl: Schema.optionalKey(Schema.DurationFromMillis),
|
||||
pauseWhenHostLocked: Schema.optionalKey(Schema.Boolean),
|
||||
pauseWhenHostLowPower: Schema.optionalKey(Schema.Boolean),
|
||||
pauseWhenClientLowPower: Schema.optionalKey(Schema.Boolean),
|
||||
pauseWhenOnBattery: Schema.optionalKey(Schema.Boolean),
|
||||
});
|
||||
export type BackgroundActivityOverrides = typeof BackgroundActivityOverrides.Type;
|
||||
|
||||
export const BackgroundActivitySettings = Schema.Struct({
|
||||
schemaVersion: Schema.Literal(1).pipe(Schema.withDecodingDefault(Effect.succeed(1 as const))),
|
||||
profile: BackgroundActivityProfileSelection.pipe(
|
||||
Schema.withDecodingDefault(Effect.succeed(DEFAULT_BACKGROUND_ACTIVITY_PROFILE)),
|
||||
),
|
||||
baseProfile: Schema.optionalKey(BackgroundActivityProfile),
|
||||
overrides: BackgroundActivityOverrides.pipe(Schema.withDecodingDefault(Effect.succeed({}))),
|
||||
}).pipe(Schema.withDecodingDefault(Effect.succeed({})));
|
||||
export type BackgroundActivitySettings = typeof BackgroundActivitySettings.Type;
|
||||
|
||||
export const ServerSettings = Schema.Struct({
|
||||
enableAssistantStreaming: Schema.Boolean.pipe(Schema.withDecodingDefault(Effect.succeed(false))),
|
||||
backgroundActivity: BackgroundActivitySettings,
|
||||
// Legacy flat fields retained for old settings files and old clients. New
|
||||
// consumers should resolve `backgroundActivity` instead.
|
||||
automaticGitFetchInterval: Schema.DurationFromMillis.pipe(
|
||||
Schema.withDecodingDefault(
|
||||
Effect.succeed(Duration.toMillis(DEFAULT_AUTOMATIC_GIT_FETCH_INTERVAL)),
|
||||
),
|
||||
),
|
||||
providerHealthRefreshInterval: Schema.DurationFromMillis.pipe(
|
||||
Schema.withDecodingDefault(
|
||||
Effect.succeed(Duration.toMillis(DEFAULT_PROVIDER_HEALTH_REFRESH_INTERVAL)),
|
||||
),
|
||||
),
|
||||
backgroundActivityProfile: BackgroundActivityProfile.pipe(
|
||||
Schema.withDecodingDefault(Effect.succeed(DEFAULT_BACKGROUND_ACTIVITY_PROFILE)),
|
||||
),
|
||||
defaultThreadEnvMode: ThreadEnvMode.pipe(
|
||||
Schema.withDecodingDefault(Effect.succeed("local" as const satisfies ThreadEnvMode)),
|
||||
),
|
||||
@@ -530,17 +479,7 @@ const OpenCodeSettingsPatch = Schema.Struct({
|
||||
export const ServerSettingsPatch = Schema.Struct({
|
||||
// Server settings
|
||||
enableAssistantStreaming: Schema.optionalKey(Schema.Boolean),
|
||||
backgroundActivity: Schema.optionalKey(
|
||||
Schema.Struct({
|
||||
schemaVersion: Schema.optionalKey(Schema.Literal(1)),
|
||||
profile: Schema.optionalKey(BackgroundActivityProfileSelection),
|
||||
baseProfile: Schema.optionalKey(BackgroundActivityProfile),
|
||||
overrides: Schema.optionalKey(BackgroundActivityOverrides),
|
||||
}),
|
||||
),
|
||||
automaticGitFetchInterval: Schema.optionalKey(Schema.DurationFromMillis),
|
||||
providerHealthRefreshInterval: Schema.optionalKey(Schema.DurationFromMillis),
|
||||
backgroundActivityProfile: Schema.optionalKey(BackgroundActivityProfile),
|
||||
defaultThreadEnvMode: Schema.optionalKey(ThreadEnvMode),
|
||||
addProjectBaseDirectory: Schema.optionalKey(TrimmedString),
|
||||
textGenerationModelSelection: Schema.optionalKey(ModelSelectionPatch),
|
||||
|
||||
@@ -75,10 +75,6 @@
|
||||
"types": "./src/serverSettings.ts",
|
||||
"import": "./src/serverSettings.ts"
|
||||
},
|
||||
"./backgroundActivitySettings": {
|
||||
"types": "./src/backgroundActivitySettings.ts",
|
||||
"import": "./src/backgroundActivitySettings.ts"
|
||||
},
|
||||
"./String": {
|
||||
"types": "./src/String.ts",
|
||||
"import": "./src/String.ts"
|
||||
|
||||
@@ -1,248 +0,0 @@
|
||||
import {
|
||||
type BackgroundActivityProfile,
|
||||
type BackgroundActivitySettings,
|
||||
DEFAULT_BACKGROUND_ACTIVITY_PROFILE,
|
||||
DEFAULT_AUTOMATIC_GIT_FETCH_INTERVAL,
|
||||
DEFAULT_PROVIDER_HEALTH_REFRESH_INTERVAL,
|
||||
type ServerSettings,
|
||||
} from "@t3tools/contracts";
|
||||
import * as Duration from "effect/Duration";
|
||||
|
||||
export interface ResolvedBackgroundActivitySettings {
|
||||
readonly profile: BackgroundActivityProfile;
|
||||
readonly automaticGitFetchInterval: Duration.Duration;
|
||||
readonly providerHealthRefreshInterval: Duration.Duration;
|
||||
readonly hostPowerMonitorActiveInterval: Duration.Duration;
|
||||
readonly hostPowerMonitorIdleInterval: Duration.Duration;
|
||||
readonly idleClientTtl: Duration.Duration;
|
||||
readonly pauseWhenHostLocked: boolean;
|
||||
readonly pauseWhenHostLowPower: boolean;
|
||||
readonly pauseWhenClientLowPower: boolean;
|
||||
readonly pauseWhenOnBattery: boolean;
|
||||
}
|
||||
|
||||
const PRESET_SETTINGS: Record<BackgroundActivityProfile, ResolvedBackgroundActivitySettings> = {
|
||||
performance: {
|
||||
profile: "performance",
|
||||
automaticGitFetchInterval: Duration.seconds(15),
|
||||
providerHealthRefreshInterval: Duration.minutes(1),
|
||||
hostPowerMonitorActiveInterval: Duration.seconds(30),
|
||||
hostPowerMonitorIdleInterval: Duration.minutes(2),
|
||||
idleClientTtl: Duration.seconds(45),
|
||||
pauseWhenHostLocked: true,
|
||||
pauseWhenHostLowPower: false,
|
||||
pauseWhenClientLowPower: false,
|
||||
pauseWhenOnBattery: false,
|
||||
},
|
||||
balanced: {
|
||||
profile: "balanced",
|
||||
automaticGitFetchInterval: DEFAULT_AUTOMATIC_GIT_FETCH_INTERVAL,
|
||||
providerHealthRefreshInterval: DEFAULT_PROVIDER_HEALTH_REFRESH_INTERVAL,
|
||||
hostPowerMonitorActiveInterval: Duration.seconds(30),
|
||||
hostPowerMonitorIdleInterval: Duration.minutes(5),
|
||||
idleClientTtl: Duration.seconds(45),
|
||||
pauseWhenHostLocked: true,
|
||||
pauseWhenHostLowPower: true,
|
||||
pauseWhenClientLowPower: true,
|
||||
pauseWhenOnBattery: false,
|
||||
},
|
||||
"battery-saver": {
|
||||
profile: "battery-saver",
|
||||
automaticGitFetchInterval: Duration.seconds(0),
|
||||
providerHealthRefreshInterval: Duration.minutes(15),
|
||||
hostPowerMonitorActiveInterval: Duration.minutes(1),
|
||||
hostPowerMonitorIdleInterval: Duration.minutes(10),
|
||||
idleClientTtl: Duration.seconds(45),
|
||||
pauseWhenHostLocked: true,
|
||||
pauseWhenHostLowPower: true,
|
||||
pauseWhenClientLowPower: true,
|
||||
pauseWhenOnBattery: true,
|
||||
},
|
||||
};
|
||||
|
||||
export function getBackgroundActivityPresetSettings(
|
||||
profile: BackgroundActivityProfile,
|
||||
): ResolvedBackgroundActivitySettings {
|
||||
return PRESET_SETTINGS[profile];
|
||||
}
|
||||
|
||||
export function getBackgroundActivityBaseProfile(
|
||||
backgroundActivity: BackgroundActivitySettings,
|
||||
): BackgroundActivityProfile {
|
||||
if (backgroundActivity.profile === "custom") {
|
||||
return backgroundActivity.baseProfile ?? DEFAULT_BACKGROUND_ACTIVITY_PROFILE;
|
||||
}
|
||||
return backgroundActivity.profile;
|
||||
}
|
||||
|
||||
export function resolveBackgroundActivitySettings(
|
||||
backgroundActivity: BackgroundActivitySettings,
|
||||
): ResolvedBackgroundActivitySettings {
|
||||
const baseProfile = getBackgroundActivityBaseProfile(backgroundActivity);
|
||||
const preset = PRESET_SETTINGS[baseProfile];
|
||||
const { overrides } = backgroundActivity;
|
||||
return {
|
||||
profile: baseProfile,
|
||||
automaticGitFetchInterval:
|
||||
overrides.automaticGitFetchInterval ?? preset.automaticGitFetchInterval,
|
||||
providerHealthRefreshInterval:
|
||||
overrides.providerHealthRefreshInterval ?? preset.providerHealthRefreshInterval,
|
||||
hostPowerMonitorActiveInterval:
|
||||
overrides.hostPowerMonitorActiveInterval ?? preset.hostPowerMonitorActiveInterval,
|
||||
hostPowerMonitorIdleInterval:
|
||||
overrides.hostPowerMonitorIdleInterval ?? preset.hostPowerMonitorIdleInterval,
|
||||
idleClientTtl: overrides.idleClientTtl ?? preset.idleClientTtl,
|
||||
pauseWhenHostLocked: overrides.pauseWhenHostLocked ?? preset.pauseWhenHostLocked,
|
||||
pauseWhenHostLowPower: overrides.pauseWhenHostLowPower ?? preset.pauseWhenHostLowPower,
|
||||
pauseWhenClientLowPower: overrides.pauseWhenClientLowPower ?? preset.pauseWhenClientLowPower,
|
||||
pauseWhenOnBattery: overrides.pauseWhenOnBattery ?? preset.pauseWhenOnBattery,
|
||||
};
|
||||
}
|
||||
|
||||
function durationsEqual(a: Duration.Duration, b: Duration.Duration): boolean {
|
||||
return Duration.toMillis(a) === Duration.toMillis(b);
|
||||
}
|
||||
|
||||
function resolvedSettingsEqual(
|
||||
a: ResolvedBackgroundActivitySettings,
|
||||
b: ResolvedBackgroundActivitySettings,
|
||||
): boolean {
|
||||
return (
|
||||
durationsEqual(a.automaticGitFetchInterval, b.automaticGitFetchInterval) &&
|
||||
durationsEqual(a.providerHealthRefreshInterval, b.providerHealthRefreshInterval) &&
|
||||
durationsEqual(a.hostPowerMonitorActiveInterval, b.hostPowerMonitorActiveInterval) &&
|
||||
durationsEqual(a.hostPowerMonitorIdleInterval, b.hostPowerMonitorIdleInterval) &&
|
||||
durationsEqual(a.idleClientTtl, b.idleClientTtl) &&
|
||||
a.pauseWhenHostLocked === b.pauseWhenHostLocked &&
|
||||
a.pauseWhenHostLowPower === b.pauseWhenHostLowPower &&
|
||||
a.pauseWhenClientLowPower === b.pauseWhenClientLowPower &&
|
||||
a.pauseWhenOnBattery === b.pauseWhenOnBattery
|
||||
);
|
||||
}
|
||||
|
||||
export function normalizeBackgroundActivitySettings(
|
||||
backgroundActivity: BackgroundActivitySettings,
|
||||
): BackgroundActivitySettings {
|
||||
if (backgroundActivity.profile !== "custom") {
|
||||
return {
|
||||
schemaVersion: 1,
|
||||
profile: backgroundActivity.profile,
|
||||
overrides: {},
|
||||
};
|
||||
}
|
||||
|
||||
const resolved = resolveBackgroundActivitySettings(backgroundActivity);
|
||||
const profiles: ReadonlyArray<BackgroundActivityProfile> = [
|
||||
getBackgroundActivityBaseProfile(backgroundActivity),
|
||||
"balanced",
|
||||
"performance",
|
||||
"battery-saver",
|
||||
];
|
||||
for (const profile of profiles) {
|
||||
if (resolvedSettingsEqual(resolved, PRESET_SETTINGS[profile])) {
|
||||
return {
|
||||
schemaVersion: 1,
|
||||
profile,
|
||||
overrides: {},
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
const baseProfile = getBackgroundActivityBaseProfile(backgroundActivity);
|
||||
const preset = PRESET_SETTINGS[baseProfile];
|
||||
const overrides: BackgroundActivitySettings["overrides"] = {
|
||||
...(!durationsEqual(resolved.automaticGitFetchInterval, preset.automaticGitFetchInterval)
|
||||
? { automaticGitFetchInterval: resolved.automaticGitFetchInterval }
|
||||
: {}),
|
||||
...(!durationsEqual(
|
||||
resolved.providerHealthRefreshInterval,
|
||||
preset.providerHealthRefreshInterval,
|
||||
)
|
||||
? { providerHealthRefreshInterval: resolved.providerHealthRefreshInterval }
|
||||
: {}),
|
||||
...(!durationsEqual(
|
||||
resolved.hostPowerMonitorActiveInterval,
|
||||
preset.hostPowerMonitorActiveInterval,
|
||||
)
|
||||
? { hostPowerMonitorActiveInterval: resolved.hostPowerMonitorActiveInterval }
|
||||
: {}),
|
||||
...(!durationsEqual(resolved.hostPowerMonitorIdleInterval, preset.hostPowerMonitorIdleInterval)
|
||||
? { hostPowerMonitorIdleInterval: resolved.hostPowerMonitorIdleInterval }
|
||||
: {}),
|
||||
...(!durationsEqual(resolved.idleClientTtl, preset.idleClientTtl)
|
||||
? { idleClientTtl: resolved.idleClientTtl }
|
||||
: {}),
|
||||
...(resolved.pauseWhenHostLocked !== preset.pauseWhenHostLocked
|
||||
? { pauseWhenHostLocked: resolved.pauseWhenHostLocked }
|
||||
: {}),
|
||||
...(resolved.pauseWhenHostLowPower !== preset.pauseWhenHostLowPower
|
||||
? { pauseWhenHostLowPower: resolved.pauseWhenHostLowPower }
|
||||
: {}),
|
||||
...(resolved.pauseWhenClientLowPower !== preset.pauseWhenClientLowPower
|
||||
? { pauseWhenClientLowPower: resolved.pauseWhenClientLowPower }
|
||||
: {}),
|
||||
...(resolved.pauseWhenOnBattery !== preset.pauseWhenOnBattery
|
||||
? { pauseWhenOnBattery: resolved.pauseWhenOnBattery }
|
||||
: {}),
|
||||
};
|
||||
|
||||
return {
|
||||
schemaVersion: 1,
|
||||
profile: "custom",
|
||||
baseProfile,
|
||||
overrides,
|
||||
};
|
||||
}
|
||||
|
||||
export function resolveServerBackgroundActivitySettings(
|
||||
settings: ServerSettings,
|
||||
): ResolvedBackgroundActivitySettings {
|
||||
const defaultBackgroundActivity: BackgroundActivitySettings = {
|
||||
schemaVersion: 1,
|
||||
profile: DEFAULT_BACKGROUND_ACTIVITY_PROFILE,
|
||||
overrides: {},
|
||||
};
|
||||
const backgroundActivityIsDefault =
|
||||
settings.backgroundActivity.profile === defaultBackgroundActivity.profile &&
|
||||
settings.backgroundActivity.baseProfile === undefined &&
|
||||
Object.keys(settings.backgroundActivity.overrides).length === 0;
|
||||
const legacyProfile = settings.backgroundActivityProfile;
|
||||
const hasLegacyOverrides =
|
||||
legacyProfile !== DEFAULT_BACKGROUND_ACTIVITY_PROFILE ||
|
||||
Duration.toMillis(settings.automaticGitFetchInterval) !==
|
||||
Duration.toMillis(DEFAULT_AUTOMATIC_GIT_FETCH_INTERVAL) ||
|
||||
Duration.toMillis(settings.providerHealthRefreshInterval) !==
|
||||
Duration.toMillis(DEFAULT_PROVIDER_HEALTH_REFRESH_INTERVAL);
|
||||
if (backgroundActivityIsDefault && hasLegacyOverrides) {
|
||||
return resolveBackgroundActivitySettings({
|
||||
schemaVersion: 1,
|
||||
profile:
|
||||
Duration.toMillis(settings.automaticGitFetchInterval) ===
|
||||
Duration.toMillis(
|
||||
getBackgroundActivityPresetSettings(legacyProfile).automaticGitFetchInterval,
|
||||
) &&
|
||||
Duration.toMillis(settings.providerHealthRefreshInterval) ===
|
||||
Duration.toMillis(
|
||||
getBackgroundActivityPresetSettings(legacyProfile).providerHealthRefreshInterval,
|
||||
)
|
||||
? legacyProfile
|
||||
: "custom",
|
||||
baseProfile: legacyProfile,
|
||||
overrides: {
|
||||
...(Duration.toMillis(settings.automaticGitFetchInterval) !==
|
||||
Duration.toMillis(
|
||||
getBackgroundActivityPresetSettings(legacyProfile).automaticGitFetchInterval,
|
||||
)
|
||||
? { automaticGitFetchInterval: settings.automaticGitFetchInterval }
|
||||
: {}),
|
||||
...(Duration.toMillis(settings.providerHealthRefreshInterval) !==
|
||||
Duration.toMillis(
|
||||
getBackgroundActivityPresetSettings(legacyProfile).providerHealthRefreshInterval,
|
||||
)
|
||||
? { providerHealthRefreshInterval: settings.providerHealthRefreshInterval }
|
||||
: {}),
|
||||
},
|
||||
});
|
||||
}
|
||||
return resolveBackgroundActivitySettings(settings.backgroundActivity);
|
||||
}
|
||||
@@ -3,9 +3,7 @@ import {
|
||||
ProviderDriverKind,
|
||||
ProviderInstanceId,
|
||||
} from "@t3tools/contracts";
|
||||
import * as Duration from "effect/Duration";
|
||||
import { describe, expect, it } from "vite-plus/test";
|
||||
import { resolveServerBackgroundActivitySettings } from "./backgroundActivitySettings.ts";
|
||||
import { createModelSelection } from "./model.ts";
|
||||
import {
|
||||
applyServerSettingsPatch,
|
||||
@@ -196,80 +194,4 @@ describe("serverSettings helpers", () => {
|
||||
config: { homePath: "~/.codex" },
|
||||
});
|
||||
});
|
||||
|
||||
it("stores background activity profiles as a versioned object and syncs legacy aliases", () => {
|
||||
const next = applyServerSettingsPatch(DEFAULT_SERVER_SETTINGS, {
|
||||
backgroundActivity: {
|
||||
schemaVersion: 1,
|
||||
profile: "battery-saver",
|
||||
overrides: {},
|
||||
},
|
||||
});
|
||||
|
||||
expect(next.backgroundActivity).toEqual({
|
||||
schemaVersion: 1,
|
||||
profile: "battery-saver",
|
||||
overrides: {},
|
||||
});
|
||||
expect(next.backgroundActivityProfile).toBe("battery-saver");
|
||||
expect(Duration.toMillis(next.automaticGitFetchInterval)).toBe(0);
|
||||
expect(Duration.toMillis(next.providerHealthRefreshInterval)).toBe(
|
||||
Duration.toMillis(Duration.minutes(15)),
|
||||
);
|
||||
});
|
||||
|
||||
it("turns legacy interval patches into custom background activity overrides", () => {
|
||||
const next = applyServerSettingsPatch(DEFAULT_SERVER_SETTINGS, {
|
||||
automaticGitFetchInterval: Duration.seconds(15),
|
||||
});
|
||||
|
||||
expect(next.backgroundActivity).toEqual({
|
||||
schemaVersion: 1,
|
||||
profile: "custom",
|
||||
baseProfile: "balanced",
|
||||
overrides: {
|
||||
automaticGitFetchInterval: Duration.seconds(15),
|
||||
},
|
||||
});
|
||||
expect(resolveServerBackgroundActivitySettings(next).profile).toBe("balanced");
|
||||
expect(
|
||||
Duration.toMillis(resolveServerBackgroundActivitySettings(next).automaticGitFetchInterval),
|
||||
).toBe(15_000);
|
||||
});
|
||||
|
||||
it("reconciles custom background activity back to a preset when overrides match the preset", () => {
|
||||
const custom = applyServerSettingsPatch(DEFAULT_SERVER_SETTINGS, {
|
||||
automaticGitFetchInterval: Duration.seconds(15),
|
||||
});
|
||||
const next = applyServerSettingsPatch(custom, {
|
||||
automaticGitFetchInterval: Duration.seconds(30),
|
||||
});
|
||||
|
||||
expect(next.backgroundActivity).toEqual({
|
||||
schemaVersion: 1,
|
||||
profile: "balanced",
|
||||
overrides: {},
|
||||
});
|
||||
expect(next.backgroundActivityProfile).toBe("balanced");
|
||||
expect(Duration.toMillis(next.automaticGitFetchInterval)).toBe(30_000);
|
||||
});
|
||||
|
||||
it("drops custom overrides that duplicate the base profile", () => {
|
||||
const next = applyServerSettingsPatch(DEFAULT_SERVER_SETTINGS, {
|
||||
backgroundActivity: {
|
||||
schemaVersion: 1,
|
||||
profile: "custom",
|
||||
baseProfile: "balanced",
|
||||
overrides: {
|
||||
automaticGitFetchInterval: Duration.seconds(30),
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
expect(next.backgroundActivity).toEqual({
|
||||
schemaVersion: 1,
|
||||
profile: "balanced",
|
||||
overrides: {},
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -4,11 +4,6 @@ import * as Schema from "effect/Schema";
|
||||
import { deepMerge } from "./Struct.ts";
|
||||
import { fromLenientJson } from "./schemaJson.ts";
|
||||
import { createModelSelection } from "./model.ts";
|
||||
import {
|
||||
getBackgroundActivityBaseProfile,
|
||||
normalizeBackgroundActivitySettings,
|
||||
resolveBackgroundActivitySettings,
|
||||
} from "./backgroundActivitySettings.ts";
|
||||
|
||||
const ServerSettingsJson = fromLenientJson(ServerSettings);
|
||||
const decodeServerSettingsJson = Schema.decodeUnknownOption(ServerSettingsJson);
|
||||
@@ -81,61 +76,14 @@ export function applyServerSettingsPatch(
|
||||
patch: ServerSettingsPatch,
|
||||
): ServerSettings {
|
||||
const selectionPatch = patch.textGenerationModelSelection;
|
||||
const {
|
||||
automaticGitFetchInterval,
|
||||
providerHealthRefreshInterval,
|
||||
backgroundActivityProfile,
|
||||
backgroundActivity,
|
||||
...patchForMerge
|
||||
} = patch;
|
||||
const backgroundActivityPatch =
|
||||
backgroundActivityProfile !== undefined
|
||||
? {
|
||||
schemaVersion: 1 as const,
|
||||
profile: backgroundActivityProfile,
|
||||
overrides: {},
|
||||
}
|
||||
: automaticGitFetchInterval !== undefined || providerHealthRefreshInterval !== undefined
|
||||
? {
|
||||
schemaVersion: 1 as const,
|
||||
profile: "custom" as const,
|
||||
baseProfile: getBackgroundActivityBaseProfile(current.backgroundActivity),
|
||||
overrides: {
|
||||
...current.backgroundActivity.overrides,
|
||||
...(automaticGitFetchInterval !== undefined ? { automaticGitFetchInterval } : {}),
|
||||
...(providerHealthRefreshInterval !== undefined
|
||||
? { providerHealthRefreshInterval }
|
||||
: {}),
|
||||
},
|
||||
}
|
||||
: undefined;
|
||||
const { automaticGitFetchInterval, ...patchForMerge } = patch;
|
||||
const next = deepMerge(current, patchForMerge);
|
||||
const nextWithReplacementsBase = {
|
||||
const nextWithReplacements = {
|
||||
...next,
|
||||
...(backgroundActivity !== undefined
|
||||
? { backgroundActivity: deepMerge(current.backgroundActivity, backgroundActivity) }
|
||||
: {}),
|
||||
...(backgroundActivityPatch !== undefined
|
||||
? { backgroundActivity: backgroundActivityPatch }
|
||||
: {}),
|
||||
...(patch.providerInstances !== undefined
|
||||
? { providerInstances: patch.providerInstances }
|
||||
: {}),
|
||||
...(automaticGitFetchInterval !== undefined ? { automaticGitFetchInterval } : {}),
|
||||
...(providerHealthRefreshInterval !== undefined ? { providerHealthRefreshInterval } : {}),
|
||||
};
|
||||
const normalizedBackgroundActivity = normalizeBackgroundActivitySettings(
|
||||
nextWithReplacementsBase.backgroundActivity,
|
||||
);
|
||||
const resolvedBackgroundActivity = resolveBackgroundActivitySettings(
|
||||
normalizedBackgroundActivity,
|
||||
);
|
||||
const nextWithReplacements = {
|
||||
...nextWithReplacementsBase,
|
||||
backgroundActivity: normalizedBackgroundActivity,
|
||||
automaticGitFetchInterval: resolvedBackgroundActivity.automaticGitFetchInterval,
|
||||
providerHealthRefreshInterval: resolvedBackgroundActivity.providerHealthRefreshInterval,
|
||||
backgroundActivityProfile: resolvedBackgroundActivity.profile,
|
||||
};
|
||||
if (!selectionPatch) {
|
||||
return nextWithReplacements;
|
||||
|
||||
@@ -1,3 +1,34 @@
|
||||
diff --git a/dist/unstable/ai/McpServer.js b/dist/unstable/ai/McpServer.js
|
||||
index 4819ff0..f5e0f60 100644
|
||||
--- a/dist/unstable/ai/McpServer.js
|
||||
+++ b/dist/unstable/ai/McpServer.js
|
||||
@@ -235,6 +235,26 @@ export const run = /*#__PURE__*/Effect.fnUntraced(function* (options) {
|
||||
const server = yield* McpServer;
|
||||
const isHttp = Option.isSome(yield* Effect.serviceOption(HttpRouter.HttpRouter));
|
||||
const clientSessions = new Map();
|
||||
+ if (isHttp && options.path !== undefined) {
|
||||
+ const router = yield* HttpRouter.HttpRouter;
|
||||
+ yield* router.add("DELETE", options.path, Effect.gen(function* () {
|
||||
+ const request = yield* HttpServerRequest.HttpServerRequest;
|
||||
+ const sessionId = request.headers[mcpSessionIdHeader];
|
||||
+ if (sessionId === undefined) {
|
||||
+ return HttpServerResponse.empty({
|
||||
+ status: 400
|
||||
+ });
|
||||
+ }
|
||||
+ if (!clientSessions.delete(sessionId)) {
|
||||
+ return HttpServerResponse.empty({
|
||||
+ status: 404
|
||||
+ });
|
||||
+ }
|
||||
+ return HttpServerResponse.empty({
|
||||
+ status: 204
|
||||
+ });
|
||||
+ }));
|
||||
+ }
|
||||
const handlers = yield* Layer.build(layerHandlers(options, {
|
||||
clientSessions
|
||||
}));
|
||||
diff --git a/dist/unstable/rpc/RpcClient.d.ts b/dist/unstable/rpc/RpcClient.d.ts
|
||||
index b0f61df..ead663e 100644
|
||||
--- a/dist/unstable/rpc/RpcClient.d.ts
|
||||
|
||||
Generated
+118
-118
@@ -73,7 +73,7 @@ patchedDependencies:
|
||||
hash: f5d41705ce94bbafc731d92e9cb1671db710df046dd135cb894e3e3e9164a75b
|
||||
path: patches/@pierre%[email protected]
|
||||
[email protected]:
|
||||
hash: 883249d8efbb462e928e21fefef96027b66aec50751178cafdce45f08eee3754
|
||||
hash: c502bc684210b707dfceb87d8fe6ad6843395af6e19cfc02cd65854898bde2c5
|
||||
path: patches/[email protected]
|
||||
[email protected]:
|
||||
hash: 825622aae63a8fb5b904f3c77908a0e216261d727ea171709f2c0b6088422675
|
||||
@@ -106,7 +106,7 @@ importers:
|
||||
dependencies:
|
||||
'@effect/platform-node':
|
||||
specifier: 4.0.0-beta.78
|
||||
version: 4.0.0-beta.78([email protected])([email protected](patch_hash=883249d8efbb462e928e21fefef96027b66aec50751178cafdce45f08eee3754))([email protected])([email protected])
|
||||
version: 4.0.0-beta.78([email protected])([email protected](patch_hash=c502bc684210b707dfceb87d8fe6ad6843395af6e19cfc02cd65854898bde2c5))([email protected])([email protected])
|
||||
'@t3tools/client-runtime':
|
||||
specifier: workspace:*
|
||||
version: link:../../packages/client-runtime
|
||||
@@ -124,7 +124,7 @@ importers:
|
||||
version: link:../../packages/tailscale
|
||||
effect:
|
||||
specifier: 4.0.0-beta.78
|
||||
version: 4.0.0-beta.78(patch_hash=883249d8efbb462e928e21fefef96027b66aec50751178cafdce45f08eee3754)
|
||||
version: 4.0.0-beta.78(patch_hash=c502bc684210b707dfceb87d8fe6ad6843395af6e19cfc02cd65854898bde2c5)
|
||||
electron:
|
||||
specifier: 41.5.0
|
||||
version: 41.5.0
|
||||
@@ -140,7 +140,7 @@ importers:
|
||||
devDependencies:
|
||||
'@effect/vitest':
|
||||
specifier: 4.0.0-beta.78
|
||||
version: 4.0.0-beta.78(patch_hash=42b87cc47e70d74e62496e7a8261b3fd298ecad4464d209348ab04b96f853a5f)([email protected](patch_hash=883249d8efbb462e928e21fefef96027b66aec50751178cafdce45f08eee3754))
|
||||
version: 4.0.0-beta.78(patch_hash=42b87cc47e70d74e62496e7a8261b3fd298ecad4464d209348ab04b96f853a5f)([email protected](patch_hash=c502bc684210b707dfceb87d8fe6ad6843395af6e19cfc02cd65854898bde2c5))
|
||||
'@types/node':
|
||||
specifier: 24.12.4
|
||||
version: 24.12.4
|
||||
@@ -183,7 +183,7 @@ importers:
|
||||
version: 3.4.1([email protected]([email protected])([email protected](@babel/[email protected])(@react-native/[email protected](@babel/[email protected]))(@types/[email protected])([email protected])([email protected])([email protected]))([email protected]))([email protected])([email protected]([email protected]))([email protected]([email protected]))([email protected]([email protected])([email protected](@babel/[email protected])(@react-native/[email protected](@babel/[email protected]))(@types/[email protected])([email protected])([email protected])([email protected])))([email protected])([email protected]([email protected]))([email protected](@babel/[email protected])(@react-native/[email protected](@babel/[email protected]))(@types/[email protected])([email protected])([email protected])([email protected]))([email protected])
|
||||
'@effect/atom-react':
|
||||
specifier: 4.0.0-beta.78
|
||||
version: 4.0.0-beta.78([email protected](patch_hash=883249d8efbb462e928e21fefef96027b66aec50751178cafdce45f08eee3754))([email protected])([email protected])
|
||||
version: 4.0.0-beta.78([email protected](patch_hash=c502bc684210b707dfceb87d8fe6ad6843395af6e19cfc02cd65854898bde2c5))([email protected])([email protected])
|
||||
'@expo-google-fonts/dm-sans':
|
||||
specifier: ^0.4.2
|
||||
version: 0.4.2
|
||||
@@ -243,7 +243,7 @@ importers:
|
||||
version: 8.0.3
|
||||
effect:
|
||||
specifier: 4.0.0-beta.78
|
||||
version: 4.0.0-beta.78(patch_hash=883249d8efbb462e928e21fefef96027b66aec50751178cafdce45f08eee3754)
|
||||
version: 4.0.0-beta.78(patch_hash=c502bc684210b707dfceb87d8fe6ad6843395af6e19cfc02cd65854898bde2c5)
|
||||
expo:
|
||||
specifier: ^56.0.0
|
||||
version: 56.0.8(@babel/[email protected])(@expo/[email protected])(@expo/[email protected])([email protected])([email protected])([email protected])([email protected]([email protected]))([email protected](@babel/[email protected])(@react-native/[email protected](@babel/[email protected]))([email protected](@babel/[email protected])(@react-native/[email protected](@babel/[email protected]))(@types/[email protected])([email protected])([email protected])([email protected]))([email protected]))([email protected](@babel/[email protected])(@react-native/[email protected](@babel/[email protected]))(@types/[email protected])([email protected])([email protected])([email protected]))([email protected])([email protected])([email protected])
|
||||
@@ -373,7 +373,7 @@ importers:
|
||||
devDependencies:
|
||||
'@effect/vitest':
|
||||
specifier: 4.0.0-beta.78
|
||||
version: 4.0.0-beta.78(patch_hash=42b87cc47e70d74e62496e7a8261b3fd298ecad4464d209348ab04b96f853a5f)([email protected](patch_hash=883249d8efbb462e928e21fefef96027b66aec50751178cafdce45f08eee3754))
|
||||
version: 4.0.0-beta.78(patch_hash=42b87cc47e70d74e62496e7a8261b3fd298ecad4464d209348ab04b96f853a5f)([email protected](patch_hash=c502bc684210b707dfceb87d8fe6ad6843395af6e19cfc02cd65854898bde2c5))
|
||||
'@pierre/trees':
|
||||
specifier: 1.0.0-beta.4
|
||||
version: 1.0.0-beta.4([email protected]([email protected]))([email protected])
|
||||
@@ -397,16 +397,16 @@ importers:
|
||||
version: 0.3.170(@anthropic-ai/[email protected]([email protected]))(@modelcontextprotocol/[email protected]([email protected]))([email protected])
|
||||
'@effect/platform-bun':
|
||||
specifier: 4.0.0-beta.78
|
||||
version: 4.0.0-beta.78([email protected])([email protected](patch_hash=883249d8efbb462e928e21fefef96027b66aec50751178cafdce45f08eee3754))([email protected])
|
||||
version: 4.0.0-beta.78([email protected])([email protected](patch_hash=c502bc684210b707dfceb87d8fe6ad6843395af6e19cfc02cd65854898bde2c5))([email protected])
|
||||
'@effect/platform-node':
|
||||
specifier: 4.0.0-beta.78
|
||||
version: 4.0.0-beta.78([email protected])([email protected](patch_hash=883249d8efbb462e928e21fefef96027b66aec50751178cafdce45f08eee3754))([email protected])([email protected])
|
||||
version: 4.0.0-beta.78([email protected])([email protected](patch_hash=c502bc684210b707dfceb87d8fe6ad6843395af6e19cfc02cd65854898bde2c5))([email protected])([email protected])
|
||||
'@effect/platform-node-shared':
|
||||
specifier: 4.0.0-beta.78
|
||||
version: 4.0.0-beta.78([email protected])([email protected](patch_hash=883249d8efbb462e928e21fefef96027b66aec50751178cafdce45f08eee3754))([email protected])
|
||||
version: 4.0.0-beta.78([email protected])([email protected](patch_hash=c502bc684210b707dfceb87d8fe6ad6843395af6e19cfc02cd65854898bde2c5))([email protected])
|
||||
'@effect/sql-sqlite-bun':
|
||||
specifier: 4.0.0-beta.78
|
||||
version: 4.0.0-beta.78([email protected](patch_hash=883249d8efbb462e928e21fefef96027b66aec50751178cafdce45f08eee3754))
|
||||
version: 4.0.0-beta.78([email protected](patch_hash=c502bc684210b707dfceb87d8fe6ad6843395af6e19cfc02cd65854898bde2c5))
|
||||
'@ff-labs/fff-node':
|
||||
specifier: 0.9.4
|
||||
version: 0.9.4(patch_hash=2b16019ce7ab61aec6478dd02f79ef468cc1d5c51e9d00764f7d2ab8167210c8)
|
||||
@@ -418,14 +418,14 @@ importers:
|
||||
version: 1.3.0-beta.4(patch_hash=f5d41705ce94bbafc731d92e9cb1671db710df046dd135cb894e3e3e9164a75b)(@shikijs/[email protected])([email protected]([email protected]))([email protected])
|
||||
effect:
|
||||
specifier: 4.0.0-beta.78
|
||||
version: 4.0.0-beta.78(patch_hash=883249d8efbb462e928e21fefef96027b66aec50751178cafdce45f08eee3754)
|
||||
version: 4.0.0-beta.78(patch_hash=c502bc684210b707dfceb87d8fe6ad6843395af6e19cfc02cd65854898bde2c5)
|
||||
node-pty:
|
||||
specifier: ^1.1.0
|
||||
version: 1.1.0
|
||||
devDependencies:
|
||||
'@effect/vitest':
|
||||
specifier: 4.0.0-beta.78
|
||||
version: 4.0.0-beta.78(patch_hash=42b87cc47e70d74e62496e7a8261b3fd298ecad4464d209348ab04b96f853a5f)([email protected](patch_hash=883249d8efbb462e928e21fefef96027b66aec50751178cafdce45f08eee3754))
|
||||
version: 4.0.0-beta.78(patch_hash=42b87cc47e70d74e62496e7a8261b3fd298ecad4464d209348ab04b96f853a5f)([email protected](patch_hash=c502bc684210b707dfceb87d8fe6ad6843395af6e19cfc02cd65854898bde2c5))
|
||||
'@t3tools/contracts':
|
||||
specifier: workspace:*
|
||||
version: link:../../packages/contracts
|
||||
@@ -479,7 +479,7 @@ importers:
|
||||
version: 3.2.2([email protected])
|
||||
'@effect/atom-react':
|
||||
specifier: 4.0.0-beta.78
|
||||
version: 4.0.0-beta.78([email protected](patch_hash=883249d8efbb462e928e21fefef96027b66aec50751178cafdce45f08eee3754))([email protected])([email protected])
|
||||
version: 4.0.0-beta.78([email protected](patch_hash=c502bc684210b707dfceb87d8fe6ad6843395af6e19cfc02cd65854898bde2c5))([email protected])([email protected])
|
||||
'@fontsource-variable/dm-sans':
|
||||
specifier: ^5.2.8
|
||||
version: 5.2.8
|
||||
@@ -530,7 +530,7 @@ importers:
|
||||
version: 0.7.1
|
||||
effect:
|
||||
specifier: 4.0.0-beta.78
|
||||
version: 4.0.0-beta.78(patch_hash=883249d8efbb462e928e21fefef96027b66aec50751178cafdce45f08eee3754)
|
||||
version: 4.0.0-beta.78(patch_hash=c502bc684210b707dfceb87d8fe6ad6843395af6e19cfc02cd65854898bde2c5)
|
||||
jose:
|
||||
specifier: 'catalog:'
|
||||
version: 6.2.2
|
||||
@@ -570,10 +570,10 @@ importers:
|
||||
devDependencies:
|
||||
'@effect/platform-node':
|
||||
specifier: 4.0.0-beta.78
|
||||
version: 4.0.0-beta.78([email protected])([email protected](patch_hash=883249d8efbb462e928e21fefef96027b66aec50751178cafdce45f08eee3754))([email protected])([email protected])
|
||||
version: 4.0.0-beta.78([email protected])([email protected](patch_hash=c502bc684210b707dfceb87d8fe6ad6843395af6e19cfc02cd65854898bde2c5))([email protected])([email protected])
|
||||
'@effect/vitest':
|
||||
specifier: 4.0.0-beta.78
|
||||
version: 4.0.0-beta.78(patch_hash=42b87cc47e70d74e62496e7a8261b3fd298ecad4464d209348ab04b96f853a5f)([email protected](patch_hash=883249d8efbb462e928e21fefef96027b66aec50751178cafdce45f08eee3754))
|
||||
version: 4.0.0-beta.78(patch_hash=42b87cc47e70d74e62496e7a8261b3fd298ecad4464d209348ab04b96f853a5f)([email protected](patch_hash=c502bc684210b707dfceb87d8fe6ad6843395af6e19cfc02cd65854898bde2c5))
|
||||
'@rolldown/plugin-babel':
|
||||
specifier: ^0.2.0
|
||||
version: 0.2.3(@babel/[email protected])(@babel/[email protected](@babel/[email protected]))(@babel/[email protected])(@voidzero-dev/[email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected]))([email protected])
|
||||
@@ -627,7 +627,7 @@ importers:
|
||||
version: 3.6.1([email protected]([email protected]))([email protected])
|
||||
'@effect/sql-pg':
|
||||
specifier: 4.0.0-beta.78
|
||||
version: 4.0.0-beta.78([email protected](patch_hash=883249d8efbb462e928e21fefef96027b66aec50751178cafdce45f08eee3754))
|
||||
version: 4.0.0-beta.78([email protected](patch_hash=c502bc684210b707dfceb87d8fe6ad6843395af6e19cfc02cd65854898bde2c5))
|
||||
'@t3tools/client-runtime':
|
||||
specifier: workspace:*
|
||||
version: link:../../packages/client-runtime
|
||||
@@ -639,23 +639,23 @@ importers:
|
||||
version: link:../../packages/shared
|
||||
alchemy:
|
||||
specifier: https://pkg.ing/alchemy/078ff00
|
||||
version: https://pkg.ing/alchemy/078ff00(044daa5923befe9f328e27c790bb74e1)
|
||||
version: https://pkg.ing/alchemy/078ff00(c6ed9425e2527ee8a94fe8655db2a250)
|
||||
drizzle-orm:
|
||||
specifier: 1.0.0-rc.3
|
||||
version: 1.0.0-rc.3(@cloudflare/[email protected])(@effect/[email protected]([email protected](patch_hash=883249d8efbb462e928e21fefef96027b66aec50751178cafdce45f08eee3754)))(@libsql/[email protected]([email protected])([email protected]))([email protected])([email protected](patch_hash=883249d8efbb462e928e21fefef96027b66aec50751178cafdce45f08eee3754))([email protected](@types/[email protected]))([email protected])([email protected])
|
||||
version: 1.0.0-rc.3(@cloudflare/[email protected])(@effect/[email protected]([email protected](patch_hash=c502bc684210b707dfceb87d8fe6ad6843395af6e19cfc02cd65854898bde2c5)))(@libsql/[email protected]([email protected])([email protected]))([email protected])([email protected](patch_hash=c502bc684210b707dfceb87d8fe6ad6843395af6e19cfc02cd65854898bde2c5))([email protected](@types/[email protected]))([email protected])([email protected])
|
||||
effect:
|
||||
specifier: 4.0.0-beta.78
|
||||
version: 4.0.0-beta.78(patch_hash=883249d8efbb462e928e21fefef96027b66aec50751178cafdce45f08eee3754)
|
||||
version: 4.0.0-beta.78(patch_hash=c502bc684210b707dfceb87d8fe6ad6843395af6e19cfc02cd65854898bde2c5)
|
||||
devDependencies:
|
||||
'@cloudflare/workers-types':
|
||||
specifier: ^4.20260601.1
|
||||
version: 4.20260604.1
|
||||
'@effect/platform-node':
|
||||
specifier: 4.0.0-beta.78
|
||||
version: 4.0.0-beta.78([email protected])([email protected](patch_hash=883249d8efbb462e928e21fefef96027b66aec50751178cafdce45f08eee3754))([email protected])([email protected])
|
||||
version: 4.0.0-beta.78([email protected])([email protected](patch_hash=c502bc684210b707dfceb87d8fe6ad6843395af6e19cfc02cd65854898bde2c5))([email protected])([email protected])
|
||||
'@effect/vitest':
|
||||
specifier: 4.0.0-beta.78
|
||||
version: 4.0.0-beta.78(patch_hash=42b87cc47e70d74e62496e7a8261b3fd298ecad4464d209348ab04b96f853a5f)([email protected](patch_hash=883249d8efbb462e928e21fefef96027b66aec50751178cafdce45f08eee3754))
|
||||
version: 4.0.0-beta.78(patch_hash=42b87cc47e70d74e62496e7a8261b3fd298ecad4464d209348ab04b96f853a5f)([email protected](patch_hash=c502bc684210b707dfceb87d8fe6ad6843395af6e19cfc02cd65854898bde2c5))
|
||||
'@types/node':
|
||||
specifier: 24.12.4
|
||||
version: 24.12.4
|
||||
@@ -673,17 +673,17 @@ importers:
|
||||
dependencies:
|
||||
'@effect/platform-node':
|
||||
specifier: 4.0.0-beta.78
|
||||
version: 4.0.0-beta.78([email protected])([email protected](patch_hash=883249d8efbb462e928e21fefef96027b66aec50751178cafdce45f08eee3754))([email protected])([email protected])
|
||||
version: 4.0.0-beta.78([email protected])([email protected](patch_hash=c502bc684210b707dfceb87d8fe6ad6843395af6e19cfc02cd65854898bde2c5))([email protected])([email protected])
|
||||
'@oxlint/plugins':
|
||||
specifier: ^1.63.0
|
||||
version: 1.68.0
|
||||
effect:
|
||||
specifier: 4.0.0-beta.78
|
||||
version: 4.0.0-beta.78(patch_hash=883249d8efbb462e928e21fefef96027b66aec50751178cafdce45f08eee3754)
|
||||
version: 4.0.0-beta.78(patch_hash=c502bc684210b707dfceb87d8fe6ad6843395af6e19cfc02cd65854898bde2c5)
|
||||
devDependencies:
|
||||
'@effect/vitest':
|
||||
specifier: 4.0.0-beta.78
|
||||
version: 4.0.0-beta.78(patch_hash=42b87cc47e70d74e62496e7a8261b3fd298ecad4464d209348ab04b96f853a5f)([email protected](patch_hash=883249d8efbb462e928e21fefef96027b66aec50751178cafdce45f08eee3754))
|
||||
version: 4.0.0-beta.78(patch_hash=42b87cc47e70d74e62496e7a8261b3fd298ecad4464d209348ab04b96f853a5f)([email protected](patch_hash=c502bc684210b707dfceb87d8fe6ad6843395af6e19cfc02cd65854898bde2c5))
|
||||
vite-plus:
|
||||
specifier: 'catalog:'
|
||||
version: 0.1.24(@types/[email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])
|
||||
@@ -698,11 +698,11 @@ importers:
|
||||
version: link:../shared
|
||||
effect:
|
||||
specifier: 4.0.0-beta.78
|
||||
version: 4.0.0-beta.78(patch_hash=883249d8efbb462e928e21fefef96027b66aec50751178cafdce45f08eee3754)
|
||||
version: 4.0.0-beta.78(patch_hash=c502bc684210b707dfceb87d8fe6ad6843395af6e19cfc02cd65854898bde2c5)
|
||||
devDependencies:
|
||||
'@effect/vitest':
|
||||
specifier: 4.0.0-beta.78
|
||||
version: 4.0.0-beta.78(patch_hash=42b87cc47e70d74e62496e7a8261b3fd298ecad4464d209348ab04b96f853a5f)([email protected](patch_hash=883249d8efbb462e928e21fefef96027b66aec50751178cafdce45f08eee3754))
|
||||
version: 4.0.0-beta.78(patch_hash=42b87cc47e70d74e62496e7a8261b3fd298ecad4464d209348ab04b96f853a5f)([email protected](patch_hash=c502bc684210b707dfceb87d8fe6ad6843395af6e19cfc02cd65854898bde2c5))
|
||||
vite-plus:
|
||||
specifier: 'catalog:'
|
||||
version: 0.1.24(@types/[email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])
|
||||
@@ -711,11 +711,11 @@ importers:
|
||||
dependencies:
|
||||
effect:
|
||||
specifier: 4.0.0-beta.78
|
||||
version: 4.0.0-beta.78(patch_hash=883249d8efbb462e928e21fefef96027b66aec50751178cafdce45f08eee3754)
|
||||
version: 4.0.0-beta.78(patch_hash=c502bc684210b707dfceb87d8fe6ad6843395af6e19cfc02cd65854898bde2c5)
|
||||
devDependencies:
|
||||
'@effect/vitest':
|
||||
specifier: 4.0.0-beta.78
|
||||
version: 4.0.0-beta.78(patch_hash=42b87cc47e70d74e62496e7a8261b3fd298ecad4464d209348ab04b96f853a5f)([email protected](patch_hash=883249d8efbb462e928e21fefef96027b66aec50751178cafdce45f08eee3754))
|
||||
version: 4.0.0-beta.78(patch_hash=42b87cc47e70d74e62496e7a8261b3fd298ecad4464d209348ab04b96f853a5f)([email protected](patch_hash=c502bc684210b707dfceb87d8fe6ad6843395af6e19cfc02cd65854898bde2c5))
|
||||
vite-plus:
|
||||
specifier: 'catalog:'
|
||||
version: 0.1.24(@types/[email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])
|
||||
@@ -724,17 +724,17 @@ importers:
|
||||
dependencies:
|
||||
effect:
|
||||
specifier: 4.0.0-beta.78
|
||||
version: 4.0.0-beta.78(patch_hash=883249d8efbb462e928e21fefef96027b66aec50751178cafdce45f08eee3754)
|
||||
version: 4.0.0-beta.78(patch_hash=c502bc684210b707dfceb87d8fe6ad6843395af6e19cfc02cd65854898bde2c5)
|
||||
devDependencies:
|
||||
'@effect/openapi-generator':
|
||||
specifier: 'catalog:'
|
||||
version: 4.0.0-beta.78(@effect/[email protected]([email protected])([email protected](patch_hash=883249d8efbb462e928e21fefef96027b66aec50751178cafdce45f08eee3754))([email protected])([email protected]))([email protected](patch_hash=883249d8efbb462e928e21fefef96027b66aec50751178cafdce45f08eee3754))
|
||||
version: 4.0.0-beta.78(@effect/[email protected]([email protected])([email protected](patch_hash=c502bc684210b707dfceb87d8fe6ad6843395af6e19cfc02cd65854898bde2c5))([email protected])([email protected]))([email protected](patch_hash=c502bc684210b707dfceb87d8fe6ad6843395af6e19cfc02cd65854898bde2c5))
|
||||
'@effect/platform-node':
|
||||
specifier: 4.0.0-beta.78
|
||||
version: 4.0.0-beta.78([email protected])([email protected](patch_hash=883249d8efbb462e928e21fefef96027b66aec50751178cafdce45f08eee3754))([email protected])([email protected])
|
||||
version: 4.0.0-beta.78([email protected])([email protected](patch_hash=c502bc684210b707dfceb87d8fe6ad6843395af6e19cfc02cd65854898bde2c5))([email protected])([email protected])
|
||||
'@effect/vitest':
|
||||
specifier: 4.0.0-beta.78
|
||||
version: 4.0.0-beta.78(patch_hash=42b87cc47e70d74e62496e7a8261b3fd298ecad4464d209348ab04b96f853a5f)([email protected](patch_hash=883249d8efbb462e928e21fefef96027b66aec50751178cafdce45f08eee3754))
|
||||
version: 4.0.0-beta.78(patch_hash=42b87cc47e70d74e62496e7a8261b3fd298ecad4464d209348ab04b96f853a5f)([email protected](patch_hash=c502bc684210b707dfceb87d8fe6ad6843395af6e19cfc02cd65854898bde2c5))
|
||||
'@types/node':
|
||||
specifier: 24.12.4
|
||||
version: 24.12.4
|
||||
@@ -746,17 +746,17 @@ importers:
|
||||
dependencies:
|
||||
effect:
|
||||
specifier: 4.0.0-beta.78
|
||||
version: 4.0.0-beta.78(patch_hash=883249d8efbb462e928e21fefef96027b66aec50751178cafdce45f08eee3754)
|
||||
version: 4.0.0-beta.78(patch_hash=c502bc684210b707dfceb87d8fe6ad6843395af6e19cfc02cd65854898bde2c5)
|
||||
devDependencies:
|
||||
'@effect/openapi-generator':
|
||||
specifier: 'catalog:'
|
||||
version: 4.0.0-beta.78(@effect/[email protected]([email protected])([email protected](patch_hash=883249d8efbb462e928e21fefef96027b66aec50751178cafdce45f08eee3754))([email protected])([email protected]))([email protected](patch_hash=883249d8efbb462e928e21fefef96027b66aec50751178cafdce45f08eee3754))
|
||||
version: 4.0.0-beta.78(@effect/[email protected]([email protected])([email protected](patch_hash=c502bc684210b707dfceb87d8fe6ad6843395af6e19cfc02cd65854898bde2c5))([email protected])([email protected]))([email protected](patch_hash=c502bc684210b707dfceb87d8fe6ad6843395af6e19cfc02cd65854898bde2c5))
|
||||
'@effect/platform-node':
|
||||
specifier: 4.0.0-beta.78
|
||||
version: 4.0.0-beta.78([email protected])([email protected](patch_hash=883249d8efbb462e928e21fefef96027b66aec50751178cafdce45f08eee3754))([email protected])([email protected])
|
||||
version: 4.0.0-beta.78([email protected])([email protected](patch_hash=c502bc684210b707dfceb87d8fe6ad6843395af6e19cfc02cd65854898bde2c5))([email protected])([email protected])
|
||||
'@effect/vitest':
|
||||
specifier: 4.0.0-beta.78
|
||||
version: 4.0.0-beta.78(patch_hash=42b87cc47e70d74e62496e7a8261b3fd298ecad4464d209348ab04b96f853a5f)([email protected](patch_hash=883249d8efbb462e928e21fefef96027b66aec50751178cafdce45f08eee3754))
|
||||
version: 4.0.0-beta.78(patch_hash=42b87cc47e70d74e62496e7a8261b3fd298ecad4464d209348ab04b96f853a5f)([email protected](patch_hash=c502bc684210b707dfceb87d8fe6ad6843395af6e19cfc02cd65854898bde2c5))
|
||||
'@types/node':
|
||||
specifier: 24.12.4
|
||||
version: 24.12.4
|
||||
@@ -777,7 +777,7 @@ importers:
|
||||
version: link:../contracts
|
||||
effect:
|
||||
specifier: 4.0.0-beta.78
|
||||
version: 4.0.0-beta.78(patch_hash=883249d8efbb462e928e21fefef96027b66aec50751178cafdce45f08eee3754)
|
||||
version: 4.0.0-beta.78(patch_hash=c502bc684210b707dfceb87d8fe6ad6843395af6e19cfc02cd65854898bde2c5)
|
||||
jose:
|
||||
specifier: 'catalog:'
|
||||
version: 6.2.2
|
||||
@@ -787,10 +787,10 @@ importers:
|
||||
devDependencies:
|
||||
'@effect/platform-node':
|
||||
specifier: 4.0.0-beta.78
|
||||
version: 4.0.0-beta.78([email protected])([email protected](patch_hash=883249d8efbb462e928e21fefef96027b66aec50751178cafdce45f08eee3754))([email protected])([email protected])
|
||||
version: 4.0.0-beta.78([email protected])([email protected](patch_hash=c502bc684210b707dfceb87d8fe6ad6843395af6e19cfc02cd65854898bde2c5))([email protected])([email protected])
|
||||
'@effect/vitest':
|
||||
specifier: 4.0.0-beta.78
|
||||
version: 4.0.0-beta.78(patch_hash=42b87cc47e70d74e62496e7a8261b3fd298ecad4464d209348ab04b96f853a5f)([email protected](patch_hash=883249d8efbb462e928e21fefef96027b66aec50751178cafdce45f08eee3754))
|
||||
version: 4.0.0-beta.78(patch_hash=42b87cc47e70d74e62496e7a8261b3fd298ecad4464d209348ab04b96f853a5f)([email protected](patch_hash=c502bc684210b707dfceb87d8fe6ad6843395af6e19cfc02cd65854898bde2c5))
|
||||
'@types/node':
|
||||
specifier: 24.12.4
|
||||
version: 24.12.4
|
||||
@@ -808,14 +808,14 @@ importers:
|
||||
version: link:../shared
|
||||
effect:
|
||||
specifier: 4.0.0-beta.78
|
||||
version: 4.0.0-beta.78(patch_hash=883249d8efbb462e928e21fefef96027b66aec50751178cafdce45f08eee3754)
|
||||
version: 4.0.0-beta.78(patch_hash=c502bc684210b707dfceb87d8fe6ad6843395af6e19cfc02cd65854898bde2c5)
|
||||
devDependencies:
|
||||
'@effect/platform-node':
|
||||
specifier: 4.0.0-beta.78
|
||||
version: 4.0.0-beta.78([email protected])([email protected](patch_hash=883249d8efbb462e928e21fefef96027b66aec50751178cafdce45f08eee3754))([email protected])([email protected])
|
||||
version: 4.0.0-beta.78([email protected])([email protected](patch_hash=c502bc684210b707dfceb87d8fe6ad6843395af6e19cfc02cd65854898bde2c5))([email protected])([email protected])
|
||||
'@effect/vitest':
|
||||
specifier: 4.0.0-beta.78
|
||||
version: 4.0.0-beta.78(patch_hash=42b87cc47e70d74e62496e7a8261b3fd298ecad4464d209348ab04b96f853a5f)([email protected](patch_hash=883249d8efbb462e928e21fefef96027b66aec50751178cafdce45f08eee3754))
|
||||
version: 4.0.0-beta.78(patch_hash=42b87cc47e70d74e62496e7a8261b3fd298ecad4464d209348ab04b96f853a5f)([email protected](patch_hash=c502bc684210b707dfceb87d8fe6ad6843395af6e19cfc02cd65854898bde2c5))
|
||||
'@types/node':
|
||||
specifier: 24.12.4
|
||||
version: 24.12.4
|
||||
@@ -827,17 +827,17 @@ importers:
|
||||
dependencies:
|
||||
'@effect/platform-node':
|
||||
specifier: 4.0.0-beta.78
|
||||
version: 4.0.0-beta.78([email protected])([email protected](patch_hash=883249d8efbb462e928e21fefef96027b66aec50751178cafdce45f08eee3754))([email protected])([email protected])
|
||||
version: 4.0.0-beta.78([email protected])([email protected](patch_hash=c502bc684210b707dfceb87d8fe6ad6843395af6e19cfc02cd65854898bde2c5))([email protected])([email protected])
|
||||
'@t3tools/shared':
|
||||
specifier: workspace:*
|
||||
version: link:../shared
|
||||
effect:
|
||||
specifier: 4.0.0-beta.78
|
||||
version: 4.0.0-beta.78(patch_hash=883249d8efbb462e928e21fefef96027b66aec50751178cafdce45f08eee3754)
|
||||
version: 4.0.0-beta.78(patch_hash=c502bc684210b707dfceb87d8fe6ad6843395af6e19cfc02cd65854898bde2c5)
|
||||
devDependencies:
|
||||
'@effect/vitest':
|
||||
specifier: 4.0.0-beta.78
|
||||
version: 4.0.0-beta.78(patch_hash=42b87cc47e70d74e62496e7a8261b3fd298ecad4464d209348ab04b96f853a5f)([email protected](patch_hash=883249d8efbb462e928e21fefef96027b66aec50751178cafdce45f08eee3754))
|
||||
version: 4.0.0-beta.78(patch_hash=42b87cc47e70d74e62496e7a8261b3fd298ecad4464d209348ab04b96f853a5f)([email protected](patch_hash=c502bc684210b707dfceb87d8fe6ad6843395af6e19cfc02cd65854898bde2c5))
|
||||
'@types/node':
|
||||
specifier: 24.12.4
|
||||
version: 24.12.4
|
||||
@@ -849,7 +849,7 @@ importers:
|
||||
dependencies:
|
||||
'@effect/platform-node':
|
||||
specifier: 4.0.0-beta.78
|
||||
version: 4.0.0-beta.78([email protected])([email protected](patch_hash=883249d8efbb462e928e21fefef96027b66aec50751178cafdce45f08eee3754))([email protected])([email protected])
|
||||
version: 4.0.0-beta.78([email protected])([email protected](patch_hash=c502bc684210b707dfceb87d8fe6ad6843395af6e19cfc02cd65854898bde2c5))([email protected])([email protected])
|
||||
'@t3tools/contracts':
|
||||
specifier: workspace:*
|
||||
version: link:../packages/contracts
|
||||
@@ -858,14 +858,14 @@ importers:
|
||||
version: link:../packages/shared
|
||||
effect:
|
||||
specifier: 4.0.0-beta.78
|
||||
version: 4.0.0-beta.78(patch_hash=883249d8efbb462e928e21fefef96027b66aec50751178cafdce45f08eee3754)
|
||||
version: 4.0.0-beta.78(patch_hash=c502bc684210b707dfceb87d8fe6ad6843395af6e19cfc02cd65854898bde2c5)
|
||||
yaml:
|
||||
specifier: ^2.9.0
|
||||
version: 2.9.0
|
||||
devDependencies:
|
||||
'@effect/vitest':
|
||||
specifier: 4.0.0-beta.78
|
||||
version: 4.0.0-beta.78(patch_hash=42b87cc47e70d74e62496e7a8261b3fd298ecad4464d209348ab04b96f853a5f)([email protected](patch_hash=883249d8efbb462e928e21fefef96027b66aec50751178cafdce45f08eee3754))
|
||||
version: 4.0.0-beta.78(patch_hash=42b87cc47e70d74e62496e7a8261b3fd298ecad4464d209348ab04b96f853a5f)([email protected](patch_hash=c502bc684210b707dfceb87d8fe6ad6843395af6e19cfc02cd65854898bde2c5))
|
||||
vite-plus:
|
||||
specifier: 'catalog:'
|
||||
version: 0.1.24(@types/[email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])
|
||||
@@ -10975,24 +10975,24 @@ snapshots:
|
||||
ajv: 6.15.0
|
||||
ajv-keywords: 3.5.2([email protected])
|
||||
|
||||
'@distilled.cloud/[email protected]([email protected](patch_hash=883249d8efbb462e928e21fefef96027b66aec50751178cafdce45f08eee3754))':
|
||||
'@distilled.cloud/[email protected]([email protected](patch_hash=c502bc684210b707dfceb87d8fe6ad6843395af6e19cfc02cd65854898bde2c5))':
|
||||
dependencies:
|
||||
'@aws-crypto/crc32': 5.2.0
|
||||
'@aws-crypto/util': 5.2.0
|
||||
'@aws-sdk/credential-providers': 3.1062.0
|
||||
'@aws-sdk/types': 3.973.10
|
||||
'@distilled.cloud/core': 0.23.1([email protected](patch_hash=883249d8efbb462e928e21fefef96027b66aec50751178cafdce45f08eee3754))
|
||||
'@distilled.cloud/core': 0.23.1([email protected](patch_hash=c502bc684210b707dfceb87d8fe6ad6843395af6e19cfc02cd65854898bde2c5))
|
||||
'@smithy/shared-ini-file-loader': 4.5.6
|
||||
'@smithy/types': 4.14.3
|
||||
'@smithy/util-base64': 4.4.6
|
||||
aws4fetch: 1.0.20
|
||||
effect: 4.0.0-beta.78(patch_hash=883249d8efbb462e928e21fefef96027b66aec50751178cafdce45f08eee3754)
|
||||
effect: 4.0.0-beta.78(patch_hash=c502bc684210b707dfceb87d8fe6ad6843395af6e19cfc02cd65854898bde2c5)
|
||||
fast-xml-parser: 5.8.0
|
||||
|
||||
'@distilled.cloud/[email protected]([email protected](patch_hash=883249d8efbb462e928e21fefef96027b66aec50751178cafdce45f08eee3754))':
|
||||
'@distilled.cloud/[email protected]([email protected](patch_hash=c502bc684210b707dfceb87d8fe6ad6843395af6e19cfc02cd65854898bde2c5))':
|
||||
dependencies:
|
||||
'@distilled.cloud/core': 0.23.1([email protected](patch_hash=883249d8efbb462e928e21fefef96027b66aec50751178cafdce45f08eee3754))
|
||||
effect: 4.0.0-beta.78(patch_hash=883249d8efbb462e928e21fefef96027b66aec50751178cafdce45f08eee3754)
|
||||
'@distilled.cloud/core': 0.23.1([email protected](patch_hash=c502bc684210b707dfceb87d8fe6ad6843395af6e19cfc02cd65854898bde2c5))
|
||||
effect: 4.0.0-beta.78(patch_hash=c502bc684210b707dfceb87d8fe6ad6843395af6e19cfc02cd65854898bde2c5)
|
||||
|
||||
'@distilled.cloud/[email protected]([email protected])([email protected])':
|
||||
dependencies:
|
||||
@@ -11004,51 +11004,51 @@ snapshots:
|
||||
transitivePeerDependencies:
|
||||
- workerd
|
||||
|
||||
'@distilled.cloud/[email protected](@distilled.cloud/[email protected]([email protected](patch_hash=883249d8efbb462e928e21fefef96027b66aec50751178cafdce45f08eee3754)))(@effect/[email protected]([email protected])([email protected](patch_hash=883249d8efbb462e928e21fefef96027b66aec50751178cafdce45f08eee3754))([email protected]))(@effect/[email protected]([email protected])([email protected](patch_hash=883249d8efbb462e928e21fefef96027b66aec50751178cafdce45f08eee3754))([email protected])([email protected]))([email protected](patch_hash=883249d8efbb462e928e21fefef96027b66aec50751178cafdce45f08eee3754))':
|
||||
'@distilled.cloud/[email protected](@distilled.cloud/[email protected]([email protected](patch_hash=c502bc684210b707dfceb87d8fe6ad6843395af6e19cfc02cd65854898bde2c5)))(@effect/[email protected]([email protected])([email protected](patch_hash=c502bc684210b707dfceb87d8fe6ad6843395af6e19cfc02cd65854898bde2c5))([email protected]))(@effect/[email protected]([email protected])([email protected](patch_hash=c502bc684210b707dfceb87d8fe6ad6843395af6e19cfc02cd65854898bde2c5))([email protected])([email protected]))([email protected](patch_hash=c502bc684210b707dfceb87d8fe6ad6843395af6e19cfc02cd65854898bde2c5))':
|
||||
dependencies:
|
||||
'@alchemy.run/node-utils': 0.0.4
|
||||
'@distilled.cloud/cloudflare': 0.23.1([email protected](patch_hash=883249d8efbb462e928e21fefef96027b66aec50751178cafdce45f08eee3754))
|
||||
'@distilled.cloud/cloudflare': 0.23.1([email protected](patch_hash=c502bc684210b707dfceb87d8fe6ad6843395af6e19cfc02cd65854898bde2c5))
|
||||
capnweb: 0.7.0
|
||||
chokidar: 4.0.3
|
||||
effect: 4.0.0-beta.78(patch_hash=883249d8efbb462e928e21fefef96027b66aec50751178cafdce45f08eee3754)
|
||||
effect: 4.0.0-beta.78(patch_hash=c502bc684210b707dfceb87d8fe6ad6843395af6e19cfc02cd65854898bde2c5)
|
||||
workerd: 1.20260526.1
|
||||
xdg-app-paths: 8.3.0
|
||||
optionalDependencies:
|
||||
'@effect/platform-bun': 4.0.0-beta.78([email protected])([email protected](patch_hash=883249d8efbb462e928e21fefef96027b66aec50751178cafdce45f08eee3754))([email protected])
|
||||
'@effect/platform-node': 4.0.0-beta.78([email protected])([email protected](patch_hash=883249d8efbb462e928e21fefef96027b66aec50751178cafdce45f08eee3754))([email protected])([email protected])
|
||||
'@effect/platform-bun': 4.0.0-beta.78([email protected])([email protected](patch_hash=c502bc684210b707dfceb87d8fe6ad6843395af6e19cfc02cd65854898bde2c5))([email protected])
|
||||
'@effect/platform-node': 4.0.0-beta.78([email protected])([email protected](patch_hash=c502bc684210b707dfceb87d8fe6ad6843395af6e19cfc02cd65854898bde2c5))([email protected])([email protected])
|
||||
|
||||
'@distilled.cloud/[email protected](874b2206c1318ea354f257cb5515510e)':
|
||||
'@distilled.cloud/[email protected](1a78211785aa6331880fcdb516c7c682)':
|
||||
dependencies:
|
||||
'@distilled.cloud/cloudflare': 0.23.1([email protected](patch_hash=883249d8efbb462e928e21fefef96027b66aec50751178cafdce45f08eee3754))
|
||||
'@distilled.cloud/cloudflare': 0.23.1([email protected](patch_hash=c502bc684210b707dfceb87d8fe6ad6843395af6e19cfc02cd65854898bde2c5))
|
||||
'@distilled.cloud/cloudflare-rolldown-plugin': 0.10.5([email protected])([email protected])
|
||||
'@distilled.cloud/cloudflare-runtime': 0.10.5(@distilled.cloud/[email protected]([email protected](patch_hash=883249d8efbb462e928e21fefef96027b66aec50751178cafdce45f08eee3754)))(@effect/[email protected]([email protected])([email protected](patch_hash=883249d8efbb462e928e21fefef96027b66aec50751178cafdce45f08eee3754))([email protected]))(@effect/[email protected]([email protected])([email protected](patch_hash=883249d8efbb462e928e21fefef96027b66aec50751178cafdce45f08eee3754))([email protected])([email protected]))([email protected](patch_hash=883249d8efbb462e928e21fefef96027b66aec50751178cafdce45f08eee3754))
|
||||
effect: 4.0.0-beta.78(patch_hash=883249d8efbb462e928e21fefef96027b66aec50751178cafdce45f08eee3754)
|
||||
'@distilled.cloud/cloudflare-runtime': 0.10.5(@distilled.cloud/[email protected]([email protected](patch_hash=c502bc684210b707dfceb87d8fe6ad6843395af6e19cfc02cd65854898bde2c5)))(@effect/[email protected]([email protected])([email protected](patch_hash=c502bc684210b707dfceb87d8fe6ad6843395af6e19cfc02cd65854898bde2c5))([email protected]))(@effect/[email protected]([email protected])([email protected](patch_hash=c502bc684210b707dfceb87d8fe6ad6843395af6e19cfc02cd65854898bde2c5))([email protected])([email protected]))([email protected](patch_hash=c502bc684210b707dfceb87d8fe6ad6843395af6e19cfc02cd65854898bde2c5))
|
||||
effect: 4.0.0-beta.78(patch_hash=c502bc684210b707dfceb87d8fe6ad6843395af6e19cfc02cd65854898bde2c5)
|
||||
vite: '@voidzero-dev/[email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])'
|
||||
optionalDependencies:
|
||||
'@effect/platform-bun': 4.0.0-beta.78([email protected])([email protected](patch_hash=883249d8efbb462e928e21fefef96027b66aec50751178cafdce45f08eee3754))([email protected])
|
||||
'@effect/platform-node': 4.0.0-beta.78([email protected])([email protected](patch_hash=883249d8efbb462e928e21fefef96027b66aec50751178cafdce45f08eee3754))([email protected])([email protected])
|
||||
'@effect/platform-bun': 4.0.0-beta.78([email protected])([email protected](patch_hash=c502bc684210b707dfceb87d8fe6ad6843395af6e19cfc02cd65854898bde2c5))([email protected])
|
||||
'@effect/platform-node': 4.0.0-beta.78([email protected])([email protected](patch_hash=c502bc684210b707dfceb87d8fe6ad6843395af6e19cfc02cd65854898bde2c5))([email protected])([email protected])
|
||||
transitivePeerDependencies:
|
||||
- rolldown
|
||||
- workerd
|
||||
|
||||
'@distilled.cloud/[email protected]([email protected](patch_hash=883249d8efbb462e928e21fefef96027b66aec50751178cafdce45f08eee3754))':
|
||||
'@distilled.cloud/[email protected]([email protected](patch_hash=c502bc684210b707dfceb87d8fe6ad6843395af6e19cfc02cd65854898bde2c5))':
|
||||
dependencies:
|
||||
'@distilled.cloud/core': 0.23.1([email protected](patch_hash=883249d8efbb462e928e21fefef96027b66aec50751178cafdce45f08eee3754))
|
||||
effect: 4.0.0-beta.78(patch_hash=883249d8efbb462e928e21fefef96027b66aec50751178cafdce45f08eee3754)
|
||||
'@distilled.cloud/core': 0.23.1([email protected](patch_hash=c502bc684210b707dfceb87d8fe6ad6843395af6e19cfc02cd65854898bde2c5))
|
||||
effect: 4.0.0-beta.78(patch_hash=c502bc684210b707dfceb87d8fe6ad6843395af6e19cfc02cd65854898bde2c5)
|
||||
|
||||
'@distilled.cloud/[email protected]([email protected](patch_hash=883249d8efbb462e928e21fefef96027b66aec50751178cafdce45f08eee3754))':
|
||||
'@distilled.cloud/[email protected]([email protected](patch_hash=c502bc684210b707dfceb87d8fe6ad6843395af6e19cfc02cd65854898bde2c5))':
|
||||
dependencies:
|
||||
effect: 4.0.0-beta.78(patch_hash=883249d8efbb462e928e21fefef96027b66aec50751178cafdce45f08eee3754)
|
||||
effect: 4.0.0-beta.78(patch_hash=c502bc684210b707dfceb87d8fe6ad6843395af6e19cfc02cd65854898bde2c5)
|
||||
|
||||
'@distilled.cloud/[email protected]([email protected](patch_hash=883249d8efbb462e928e21fefef96027b66aec50751178cafdce45f08eee3754))':
|
||||
'@distilled.cloud/[email protected]([email protected](patch_hash=c502bc684210b707dfceb87d8fe6ad6843395af6e19cfc02cd65854898bde2c5))':
|
||||
dependencies:
|
||||
'@distilled.cloud/core': 0.23.1([email protected](patch_hash=883249d8efbb462e928e21fefef96027b66aec50751178cafdce45f08eee3754))
|
||||
effect: 4.0.0-beta.78(patch_hash=883249d8efbb462e928e21fefef96027b66aec50751178cafdce45f08eee3754)
|
||||
'@distilled.cloud/core': 0.23.1([email protected](patch_hash=c502bc684210b707dfceb87d8fe6ad6843395af6e19cfc02cd65854898bde2c5))
|
||||
effect: 4.0.0-beta.78(patch_hash=c502bc684210b707dfceb87d8fe6ad6843395af6e19cfc02cd65854898bde2c5)
|
||||
|
||||
'@distilled.cloud/[email protected]([email protected](patch_hash=883249d8efbb462e928e21fefef96027b66aec50751178cafdce45f08eee3754))':
|
||||
'@distilled.cloud/[email protected]([email protected](patch_hash=c502bc684210b707dfceb87d8fe6ad6843395af6e19cfc02cd65854898bde2c5))':
|
||||
dependencies:
|
||||
'@distilled.cloud/core': 0.23.1([email protected](patch_hash=883249d8efbb462e928e21fefef96027b66aec50751178cafdce45f08eee3754))
|
||||
effect: 4.0.0-beta.78(patch_hash=883249d8efbb462e928e21fefef96027b66aec50751178cafdce45f08eee3754)
|
||||
'@distilled.cloud/core': 0.23.1([email protected](patch_hash=c502bc684210b707dfceb87d8fe6ad6843395af6e19cfc02cd65854898bde2c5))
|
||||
effect: 4.0.0-beta.78(patch_hash=c502bc684210b707dfceb87d8fe6ad6843395af6e19cfc02cd65854898bde2c5)
|
||||
|
||||
'@dnd-kit/[email protected]([email protected])':
|
||||
dependencies:
|
||||
@@ -11084,44 +11084,44 @@ snapshots:
|
||||
|
||||
'@drizzle-team/[email protected]': {}
|
||||
|
||||
'@effect/[email protected]([email protected](patch_hash=883249d8efbb462e928e21fefef96027b66aec50751178cafdce45f08eee3754))([email protected])([email protected])':
|
||||
'@effect/[email protected]([email protected](patch_hash=c502bc684210b707dfceb87d8fe6ad6843395af6e19cfc02cd65854898bde2c5))([email protected])([email protected])':
|
||||
dependencies:
|
||||
effect: 4.0.0-beta.78(patch_hash=883249d8efbb462e928e21fefef96027b66aec50751178cafdce45f08eee3754)
|
||||
effect: 4.0.0-beta.78(patch_hash=c502bc684210b707dfceb87d8fe6ad6843395af6e19cfc02cd65854898bde2c5)
|
||||
react: 19.2.3
|
||||
scheduler: 0.27.0
|
||||
|
||||
'@effect/[email protected]([email protected](patch_hash=883249d8efbb462e928e21fefef96027b66aec50751178cafdce45f08eee3754))([email protected])([email protected])':
|
||||
'@effect/[email protected]([email protected](patch_hash=c502bc684210b707dfceb87d8fe6ad6843395af6e19cfc02cd65854898bde2c5))([email protected])([email protected])':
|
||||
dependencies:
|
||||
effect: 4.0.0-beta.78(patch_hash=883249d8efbb462e928e21fefef96027b66aec50751178cafdce45f08eee3754)
|
||||
effect: 4.0.0-beta.78(patch_hash=c502bc684210b707dfceb87d8fe6ad6843395af6e19cfc02cd65854898bde2c5)
|
||||
react: 19.2.6
|
||||
scheduler: 0.27.0
|
||||
|
||||
'@effect/[email protected](@effect/[email protected]([email protected])([email protected](patch_hash=883249d8efbb462e928e21fefef96027b66aec50751178cafdce45f08eee3754))([email protected])([email protected]))([email protected](patch_hash=883249d8efbb462e928e21fefef96027b66aec50751178cafdce45f08eee3754))':
|
||||
'@effect/[email protected](@effect/[email protected]([email protected])([email protected](patch_hash=c502bc684210b707dfceb87d8fe6ad6843395af6e19cfc02cd65854898bde2c5))([email protected])([email protected]))([email protected](patch_hash=c502bc684210b707dfceb87d8fe6ad6843395af6e19cfc02cd65854898bde2c5))':
|
||||
dependencies:
|
||||
'@effect/platform-node': 4.0.0-beta.78([email protected])([email protected](patch_hash=883249d8efbb462e928e21fefef96027b66aec50751178cafdce45f08eee3754))([email protected])([email protected])
|
||||
effect: 4.0.0-beta.78(patch_hash=883249d8efbb462e928e21fefef96027b66aec50751178cafdce45f08eee3754)
|
||||
'@effect/platform-node': 4.0.0-beta.78([email protected])([email protected](patch_hash=c502bc684210b707dfceb87d8fe6ad6843395af6e19cfc02cd65854898bde2c5))([email protected])([email protected])
|
||||
effect: 4.0.0-beta.78(patch_hash=c502bc684210b707dfceb87d8fe6ad6843395af6e19cfc02cd65854898bde2c5)
|
||||
|
||||
'@effect/[email protected]([email protected])([email protected](patch_hash=883249d8efbb462e928e21fefef96027b66aec50751178cafdce45f08eee3754))([email protected])':
|
||||
'@effect/[email protected]([email protected])([email protected](patch_hash=c502bc684210b707dfceb87d8fe6ad6843395af6e19cfc02cd65854898bde2c5))([email protected])':
|
||||
dependencies:
|
||||
'@effect/platform-node-shared': 4.0.0-beta.78([email protected])([email protected](patch_hash=883249d8efbb462e928e21fefef96027b66aec50751178cafdce45f08eee3754))([email protected])
|
||||
effect: 4.0.0-beta.78(patch_hash=883249d8efbb462e928e21fefef96027b66aec50751178cafdce45f08eee3754)
|
||||
'@effect/platform-node-shared': 4.0.0-beta.78([email protected])([email protected](patch_hash=c502bc684210b707dfceb87d8fe6ad6843395af6e19cfc02cd65854898bde2c5))([email protected])
|
||||
effect: 4.0.0-beta.78(patch_hash=c502bc684210b707dfceb87d8fe6ad6843395af6e19cfc02cd65854898bde2c5)
|
||||
transitivePeerDependencies:
|
||||
- bufferutil
|
||||
- utf-8-validate
|
||||
|
||||
'@effect/[email protected]([email protected])([email protected](patch_hash=883249d8efbb462e928e21fefef96027b66aec50751178cafdce45f08eee3754))([email protected])':
|
||||
'@effect/[email protected]([email protected])([email protected](patch_hash=c502bc684210b707dfceb87d8fe6ad6843395af6e19cfc02cd65854898bde2c5))([email protected])':
|
||||
dependencies:
|
||||
'@types/ws': 8.18.1
|
||||
effect: 4.0.0-beta.78(patch_hash=883249d8efbb462e928e21fefef96027b66aec50751178cafdce45f08eee3754)
|
||||
effect: 4.0.0-beta.78(patch_hash=c502bc684210b707dfceb87d8fe6ad6843395af6e19cfc02cd65854898bde2c5)
|
||||
ws: 8.21.0([email protected])([email protected])
|
||||
transitivePeerDependencies:
|
||||
- bufferutil
|
||||
- utf-8-validate
|
||||
|
||||
'@effect/[email protected]([email protected])([email protected](patch_hash=883249d8efbb462e928e21fefef96027b66aec50751178cafdce45f08eee3754))([email protected])([email protected])':
|
||||
'@effect/[email protected]([email protected])([email protected](patch_hash=c502bc684210b707dfceb87d8fe6ad6843395af6e19cfc02cd65854898bde2c5))([email protected])([email protected])':
|
||||
dependencies:
|
||||
'@effect/platform-node-shared': 4.0.0-beta.78([email protected])([email protected](patch_hash=883249d8efbb462e928e21fefef96027b66aec50751178cafdce45f08eee3754))([email protected])
|
||||
effect: 4.0.0-beta.78(patch_hash=883249d8efbb462e928e21fefef96027b66aec50751178cafdce45f08eee3754)
|
||||
'@effect/platform-node-shared': 4.0.0-beta.78([email protected])([email protected](patch_hash=c502bc684210b707dfceb87d8fe6ad6843395af6e19cfc02cd65854898bde2c5))([email protected])
|
||||
effect: 4.0.0-beta.78(patch_hash=c502bc684210b707dfceb87d8fe6ad6843395af6e19cfc02cd65854898bde2c5)
|
||||
ioredis: 5.11.0
|
||||
mime: 4.1.0
|
||||
undici: 8.3.0
|
||||
@@ -11129,9 +11129,9 @@ snapshots:
|
||||
- bufferutil
|
||||
- utf-8-validate
|
||||
|
||||
'@effect/[email protected]([email protected](patch_hash=883249d8efbb462e928e21fefef96027b66aec50751178cafdce45f08eee3754))':
|
||||
'@effect/[email protected]([email protected](patch_hash=c502bc684210b707dfceb87d8fe6ad6843395af6e19cfc02cd65854898bde2c5))':
|
||||
dependencies:
|
||||
effect: 4.0.0-beta.78(patch_hash=883249d8efbb462e928e21fefef96027b66aec50751178cafdce45f08eee3754)
|
||||
effect: 4.0.0-beta.78(patch_hash=c502bc684210b707dfceb87d8fe6ad6843395af6e19cfc02cd65854898bde2c5)
|
||||
pg: 8.21.0
|
||||
pg-connection-string: 2.12.0
|
||||
pg-cursor: 2.20.0([email protected])
|
||||
@@ -11140,9 +11140,9 @@ snapshots:
|
||||
transitivePeerDependencies:
|
||||
- pg-native
|
||||
|
||||
'@effect/[email protected]([email protected](patch_hash=883249d8efbb462e928e21fefef96027b66aec50751178cafdce45f08eee3754))':
|
||||
'@effect/[email protected]([email protected](patch_hash=c502bc684210b707dfceb87d8fe6ad6843395af6e19cfc02cd65854898bde2c5))':
|
||||
dependencies:
|
||||
effect: 4.0.0-beta.78(patch_hash=883249d8efbb462e928e21fefef96027b66aec50751178cafdce45f08eee3754)
|
||||
effect: 4.0.0-beta.78(patch_hash=c502bc684210b707dfceb87d8fe6ad6843395af6e19cfc02cd65854898bde2c5)
|
||||
|
||||
'@effect/[email protected]':
|
||||
optional: true
|
||||
@@ -11175,9 +11175,9 @@ snapshots:
|
||||
'@effect/tsgo-win32-arm64': 0.13.2
|
||||
'@effect/tsgo-win32-x64': 0.13.2
|
||||
|
||||
'@effect/[email protected](patch_hash=42b87cc47e70d74e62496e7a8261b3fd298ecad4464d209348ab04b96f853a5f)([email protected](patch_hash=883249d8efbb462e928e21fefef96027b66aec50751178cafdce45f08eee3754))':
|
||||
'@effect/[email protected](patch_hash=42b87cc47e70d74e62496e7a8261b3fd298ecad4464d209348ab04b96f853a5f)([email protected](patch_hash=c502bc684210b707dfceb87d8fe6ad6843395af6e19cfc02cd65854898bde2c5))':
|
||||
dependencies:
|
||||
effect: 4.0.0-beta.78(patch_hash=883249d8efbb462e928e21fefef96027b66aec50751178cafdce45f08eee3754)
|
||||
effect: 4.0.0-beta.78(patch_hash=c502bc684210b707dfceb87d8fe6ad6843395af6e19cfc02cd65854898bde2c5)
|
||||
|
||||
'@egjs/[email protected]':
|
||||
dependencies:
|
||||
@@ -14229,21 +14229,21 @@ snapshots:
|
||||
json-schema-traverse: 1.0.0
|
||||
require-from-string: 2.0.2
|
||||
|
||||
alchemy@https://pkg.ing/alchemy/078ff00(044daa5923befe9f328e27c790bb74e1):
|
||||
alchemy@https://pkg.ing/alchemy/078ff00(c6ed9425e2527ee8a94fe8655db2a250):
|
||||
dependencies:
|
||||
'@alchemy.run/node-utils': 0.0.4
|
||||
'@aws-sdk/credential-providers': 3.1062.0
|
||||
'@clack/prompts': 0.11.0
|
||||
'@distilled.cloud/aws': 0.23.1([email protected](patch_hash=883249d8efbb462e928e21fefef96027b66aec50751178cafdce45f08eee3754))
|
||||
'@distilled.cloud/axiom': 0.23.1([email protected](patch_hash=883249d8efbb462e928e21fefef96027b66aec50751178cafdce45f08eee3754))
|
||||
'@distilled.cloud/cloudflare': 0.23.1([email protected](patch_hash=883249d8efbb462e928e21fefef96027b66aec50751178cafdce45f08eee3754))
|
||||
'@distilled.cloud/aws': 0.23.1([email protected](patch_hash=c502bc684210b707dfceb87d8fe6ad6843395af6e19cfc02cd65854898bde2c5))
|
||||
'@distilled.cloud/axiom': 0.23.1([email protected](patch_hash=c502bc684210b707dfceb87d8fe6ad6843395af6e19cfc02cd65854898bde2c5))
|
||||
'@distilled.cloud/cloudflare': 0.23.1([email protected](patch_hash=c502bc684210b707dfceb87d8fe6ad6843395af6e19cfc02cd65854898bde2c5))
|
||||
'@distilled.cloud/cloudflare-rolldown-plugin': 0.10.5([email protected])([email protected])
|
||||
'@distilled.cloud/cloudflare-runtime': 0.10.5(@distilled.cloud/[email protected]([email protected](patch_hash=883249d8efbb462e928e21fefef96027b66aec50751178cafdce45f08eee3754)))(@effect/[email protected]([email protected])([email protected](patch_hash=883249d8efbb462e928e21fefef96027b66aec50751178cafdce45f08eee3754))([email protected]))(@effect/[email protected]([email protected])([email protected](patch_hash=883249d8efbb462e928e21fefef96027b66aec50751178cafdce45f08eee3754))([email protected])([email protected]))([email protected](patch_hash=883249d8efbb462e928e21fefef96027b66aec50751178cafdce45f08eee3754))
|
||||
'@distilled.cloud/cloudflare-vite-plugin': 0.10.5(874b2206c1318ea354f257cb5515510e)
|
||||
'@distilled.cloud/core': 0.23.1([email protected](patch_hash=883249d8efbb462e928e21fefef96027b66aec50751178cafdce45f08eee3754))
|
||||
'@distilled.cloud/neon': 0.23.1([email protected](patch_hash=883249d8efbb462e928e21fefef96027b66aec50751178cafdce45f08eee3754))
|
||||
'@distilled.cloud/planetscale': 0.23.1([email protected](patch_hash=883249d8efbb462e928e21fefef96027b66aec50751178cafdce45f08eee3754))
|
||||
'@effect/vitest': 4.0.0-beta.78(patch_hash=42b87cc47e70d74e62496e7a8261b3fd298ecad4464d209348ab04b96f853a5f)([email protected](patch_hash=883249d8efbb462e928e21fefef96027b66aec50751178cafdce45f08eee3754))
|
||||
'@distilled.cloud/cloudflare-runtime': 0.10.5(@distilled.cloud/[email protected]([email protected](patch_hash=c502bc684210b707dfceb87d8fe6ad6843395af6e19cfc02cd65854898bde2c5)))(@effect/[email protected]([email protected])([email protected](patch_hash=c502bc684210b707dfceb87d8fe6ad6843395af6e19cfc02cd65854898bde2c5))([email protected]))(@effect/[email protected]([email protected])([email protected](patch_hash=c502bc684210b707dfceb87d8fe6ad6843395af6e19cfc02cd65854898bde2c5))([email protected])([email protected]))([email protected](patch_hash=c502bc684210b707dfceb87d8fe6ad6843395af6e19cfc02cd65854898bde2c5))
|
||||
'@distilled.cloud/cloudflare-vite-plugin': 0.10.5(1a78211785aa6331880fcdb516c7c682)
|
||||
'@distilled.cloud/core': 0.23.1([email protected](patch_hash=c502bc684210b707dfceb87d8fe6ad6843395af6e19cfc02cd65854898bde2c5))
|
||||
'@distilled.cloud/neon': 0.23.1([email protected](patch_hash=c502bc684210b707dfceb87d8fe6ad6843395af6e19cfc02cd65854898bde2c5))
|
||||
'@distilled.cloud/planetscale': 0.23.1([email protected](patch_hash=c502bc684210b707dfceb87d8fe6ad6843395af6e19cfc02cd65854898bde2c5))
|
||||
'@effect/vitest': 4.0.0-beta.78(patch_hash=42b87cc47e70d74e62496e7a8261b3fd298ecad4464d209348ab04b96f853a5f)([email protected](patch_hash=c502bc684210b707dfceb87d8fe6ad6843395af6e19cfc02cd65854898bde2c5))
|
||||
'@libsql/client': 0.17.3([email protected])([email protected])
|
||||
'@octokit/rest': 22.0.1
|
||||
'@smithy/node-config-provider': 4.4.6
|
||||
@@ -14252,7 +14252,7 @@ snapshots:
|
||||
'@types/aws-lambda': 8.10.161
|
||||
aws4fetch: 1.0.20
|
||||
capnweb: 0.6.1
|
||||
effect: 4.0.0-beta.78(patch_hash=883249d8efbb462e928e21fefef96027b66aec50751178cafdce45f08eee3754)
|
||||
effect: 4.0.0-beta.78(patch_hash=c502bc684210b707dfceb87d8fe6ad6843395af6e19cfc02cd65854898bde2c5)
|
||||
fast-glob: 3.3.3
|
||||
fast-xml-parser: 5.8.0
|
||||
ink: 6.8.0(@types/[email protected])([email protected])([email protected]([email protected])([email protected]))([email protected])([email protected])
|
||||
@@ -14268,11 +14268,11 @@ snapshots:
|
||||
undici: 7.27.1
|
||||
yaml: 2.9.0
|
||||
optionalDependencies:
|
||||
'@effect/platform-bun': 4.0.0-beta.78([email protected])([email protected](patch_hash=883249d8efbb462e928e21fefef96027b66aec50751178cafdce45f08eee3754))([email protected])
|
||||
'@effect/platform-node': 4.0.0-beta.78([email protected])([email protected](patch_hash=883249d8efbb462e928e21fefef96027b66aec50751178cafdce45f08eee3754))([email protected])([email protected])
|
||||
'@effect/sql-pg': 4.0.0-beta.78([email protected](patch_hash=883249d8efbb462e928e21fefef96027b66aec50751178cafdce45f08eee3754))
|
||||
'@effect/platform-bun': 4.0.0-beta.78([email protected])([email protected](patch_hash=c502bc684210b707dfceb87d8fe6ad6843395af6e19cfc02cd65854898bde2c5))([email protected])
|
||||
'@effect/platform-node': 4.0.0-beta.78([email protected])([email protected](patch_hash=c502bc684210b707dfceb87d8fe6ad6843395af6e19cfc02cd65854898bde2c5))([email protected])([email protected])
|
||||
'@effect/sql-pg': 4.0.0-beta.78([email protected](patch_hash=c502bc684210b707dfceb87d8fe6ad6843395af6e19cfc02cd65854898bde2c5))
|
||||
drizzle-kit: 1.0.0-rc.3
|
||||
drizzle-orm: 1.0.0-rc.3(@cloudflare/[email protected])(@effect/[email protected]([email protected](patch_hash=883249d8efbb462e928e21fefef96027b66aec50751178cafdce45f08eee3754)))(@libsql/[email protected]([email protected])([email protected]))([email protected])([email protected](patch_hash=883249d8efbb462e928e21fefef96027b66aec50751178cafdce45f08eee3754))([email protected](@types/[email protected]))([email protected])([email protected])
|
||||
drizzle-orm: 1.0.0-rc.3(@cloudflare/[email protected])(@effect/[email protected]([email protected](patch_hash=c502bc684210b707dfceb87d8fe6ad6843395af6e19cfc02cd65854898bde2c5)))(@libsql/[email protected]([email protected])([email protected]))([email protected])([email protected](patch_hash=c502bc684210b707dfceb87d8fe6ad6843395af6e19cfc02cd65854898bde2c5))([email protected](@types/[email protected]))([email protected])([email protected])
|
||||
vite: '@voidzero-dev/[email protected](@types/[email protected])([email protected])([email protected])([email protected])([email protected])([email protected])([email protected])'
|
||||
ws: 8.21.0([email protected])([email protected])
|
||||
transitivePeerDependencies:
|
||||
@@ -15215,13 +15215,13 @@ snapshots:
|
||||
get-tsconfig: 4.14.0
|
||||
jiti: 2.7.0
|
||||
|
||||
[email protected](@cloudflare/[email protected])(@effect/[email protected]([email protected](patch_hash=883249d8efbb462e928e21fefef96027b66aec50751178cafdce45f08eee3754)))(@libsql/[email protected]([email protected])([email protected]))([email protected])([email protected](patch_hash=883249d8efbb462e928e21fefef96027b66aec50751178cafdce45f08eee3754))([email protected](@types/[email protected]))([email protected])([email protected]):
|
||||
[email protected](@cloudflare/[email protected])(@effect/[email protected]([email protected](patch_hash=c502bc684210b707dfceb87d8fe6ad6843395af6e19cfc02cd65854898bde2c5)))(@libsql/[email protected]([email protected])([email protected]))([email protected])([email protected](patch_hash=c502bc684210b707dfceb87d8fe6ad6843395af6e19cfc02cd65854898bde2c5))([email protected](@types/[email protected]))([email protected])([email protected]):
|
||||
optionalDependencies:
|
||||
'@cloudflare/workers-types': 4.20260604.1
|
||||
'@effect/sql-pg': 4.0.0-beta.78([email protected](patch_hash=883249d8efbb462e928e21fefef96027b66aec50751178cafdce45f08eee3754))
|
||||
'@effect/sql-pg': 4.0.0-beta.78([email protected](patch_hash=c502bc684210b707dfceb87d8fe6ad6843395af6e19cfc02cd65854898bde2c5))
|
||||
'@libsql/client': 0.17.3([email protected])([email protected])
|
||||
bun-types: 1.3.14
|
||||
effect: 4.0.0-beta.78(patch_hash=883249d8efbb462e928e21fefef96027b66aec50751178cafdce45f08eee3754)
|
||||
effect: 4.0.0-beta.78(patch_hash=c502bc684210b707dfceb87d8fe6ad6843395af6e19cfc02cd65854898bde2c5)
|
||||
mysql2: 3.22.4(@types/[email protected])
|
||||
pg: 8.21.0
|
||||
zod: 4.4.3
|
||||
@@ -15236,7 +15236,7 @@ snapshots:
|
||||
|
||||
[email protected]: {}
|
||||
|
||||
[email protected](patch_hash=883249d8efbb462e928e21fefef96027b66aec50751178cafdce45f08eee3754):
|
||||
[email protected](patch_hash=c502bc684210b707dfceb87d8fe6ad6843395af6e19cfc02cd65854898bde2c5):
|
||||
dependencies:
|
||||
'@standard-schema/spec': 1.1.0
|
||||
fast-check: 4.8.0
|
||||
|
||||
Reference in new issue
Block a user