refactor(ts): remove non-client effect run boundaries

This commit is contained in:
elpresidank 2026-06-11 07:47:44 -05:00
parent be2370ee7b
commit 174d636178
20 changed files with 126 additions and 106 deletions

View file

@ -566,13 +566,11 @@ function parseConfigValue(value: unknown): unknown {
return typeof value === "string" ? parseJsonUnknown(value) ?? value : value;
}
function parseConfigEntries<T>(raw: unknown, label: string): T[] {
function parseConfigEntries<T>(raw: unknown): T[] {
const entries: T[] = [];
for (const item of mapConfigEntries(raw)) {
const config = parseJsonUnknown(item.value);
if (config === undefined) {
Effect.runSync(Effect.logWarning(`[workbench-atoms] Failed to parse ${label}: ${item.key}`));
} else {
if (config !== undefined) {
entries.push({ key: item.key, config } as T);
}
}
@ -1751,7 +1749,7 @@ export const mcpServersAtom = queryAtom(
"mcpServers",
Effect.fn("trustgraph.workbench.mcpServers")(function*(_get, api) {
const values = yield* api.config().getValues("mcp");
return parseConfigEntries<McpServerEntry>(values, "MCP server config");
return parseConfigEntries<McpServerEntry>(values);
}),
{ reactivityKeys: ["config", "mcp"] },
).pipe(Atom.setIdleTTL("2 minutes"));
@ -1760,7 +1758,7 @@ export const mcpToolsAtom = queryAtom(
"mcpTools",
Effect.fn("trustgraph.workbench.mcpTools")(function*(_get, api) {
const values = yield* api.config().getValues("tool");
return parseConfigEntries<ToolEntry>(values, "tool config");
return parseConfigEntries<ToolEntry>(values);
}),
{ reactivityKeys: ["config", "tool"] },
).pipe(Atom.setIdleTTL("2 minutes"));

View file

@ -6,7 +6,6 @@ import {
ErrorBoundary as ReactErrorBoundary,
} from "react-error-boundary";
import { AlertTriangle, RefreshCw } from "lucide-react";
import { Effect } from "effect";
interface Props {
children: ReactNode;
@ -46,9 +45,6 @@ export function ErrorBoundary({ children, fallback }: Props) {
return (
<ReactErrorBoundary
fallbackRender={(props) => fallback ?? <DefaultFallback {...props} />}
onError={(error, info) => {
Effect.runSync(Effect.logError("[ErrorBoundary]", { error, componentStack: info.componentStack }));
}}
>
{children}
</ReactErrorBoundary>

View file

@ -1,6 +1,6 @@
import type { BaseApi, DocumentMetadata, ProcessingMetadata, StreamingMetadata, Triple } from "@trustgraph/client";
import { makeBaseApiWithRpc, } from "@trustgraph/client";
import { Clock, Effect, Match, Option, Schema as S } from "effect";
import { Match, Option, Schema as S } from "effect";
type ConfigValues = Record<string, Record<string, unknown>>;
@ -324,7 +324,7 @@ function configValues(state: MockState, type: string) {
function addDocument(state: MockState, metadata: DocumentMetadata): DocumentMetadata {
const id = metadata.id ?? `qa-doc-${state.library.documents.length + 1}`;
const currentTimeSeconds = Math.floor(Effect.runSync(Clock.currentTimeMillis) / 1000);
const currentTimeSeconds = state.library.documents.length + 1;
const document = {
...metadata,
id,