* Add remove in-use toasts * Use effect-atom optimistic resources
Unified · Split
| @@ -3,7 +3,7 @@ import { useEffect, useRef, useState } from "react"; · 2 unmodified lines | ||
| 3 | 3 | import { useAtomValue, useAtomSet } from "@effect/atom-react"; |
| 4 | 4 | import * as AsyncResult from "effect/unstable/reactivity/AsyncResult"; |
| 5 | 5 | import * as Exit from "effect/Exit"; |
| 6 | −import { useSourcesWithPending } from "@executor-js/react/api/optimistic"; | |
| 6 | +import { sourcesOptimisticAtom } from "@executor-js/react/api/atoms"; | |
| 7 | 7 | import { useScope } from "@executor-js/react/api/scope-context"; |
| 8 | 8 | import { Button } from "@executor-js/react/components/button"; |
| 9 | 9 | import { Skeleton } from "@executor-js/react/components/skeleton"; |
| @@ -60,7 +60,7 @@ function NavItem(props: { to: string; label: string; active: boolean; onNavigate · 50 unmodified lines | ||
| 60 | 60 | |
| 61 | 61 | function SourceList(props: { pathname: string; onNavigate?: () => void }) { |
| 62 | 62 | const scopeId = useScope(); |
| 63 | − const sources = useSourcesWithPending(scopeId); | |
| 63 | + const sources = useAtomValue(sourcesOptimisticAtom(scopeId)); | |
| 64 | 64 | |
| 65 | 65 | return AsyncResult.match(sources, { |
| 66 | 66 | onInitial: () => ( |
| @@ -1,9 +1,8 @@ | ||
| 1 | 1 | import { Link, Outlet, useLocation } from "@tanstack/react-router"; |
| 2 | 2 | import { useCallback, useEffect, useRef, useState } from "react"; |
| 3 | −import { useAtomRefresh } from "@effect/atom-react"; | |
| 3 | +import { useAtomRefresh, useAtomValue } from "@effect/atom-react"; | |
| 4 | 4 | import * as AsyncResult from "effect/unstable/reactivity/AsyncResult"; |
| 5 | −import { sourcesAtom, toolsAtom } from "@executor-js/react/api/atoms"; | |
| 6 | −import { useSourcesWithPending } from "@executor-js/react/api/optimistic"; | |
| 5 | +import { sourcesAtom, sourcesOptimisticAtom, toolsAtom } from "@executor-js/react/api/atoms"; | |
| 7 | 6 | import { useScope, useScopeInfo } from "@executor-js/react/api/scope-context"; |
| 8 | 7 | import { Button } from "@executor-js/react/components/button"; |
| 9 | 8 | import { SourceFavicon } from "@executor-js/react/components/source-favicon"; |
| @@ -261,7 +260,7 @@ function PluginNav(props: { pathname: string; onNavigate?: () => void }) { · 251 unmodified lines | ||
| 261 | 260 | |
| 262 | 261 | function SourceList(props: { pathname: string; onNavigate?: () => void }) { |
| 263 | 262 | const scopeId = useScope(); |
| 264 | − const sources = useSourcesWithPending(scopeId); | |
| 263 | + const sources = useAtomValue(sourcesOptimisticAtom(scopeId)); | |
| 265 | 264 | |
| 266 | 265 | return AsyncResult.match(sources, { |
| 267 | 266 | onInitial: () => <div className="px-2.5 py-2 text-xs text-muted-foreground">Loading…</div>, |
| @@ -1,7 +1,8 @@ | ||
| 1 | 1 | import { useCallback, useEffect, useMemo, useRef, useState } from "react"; |
| 2 | 2 | import { useAtomSet } from "@effect/atom-react"; |
| 3 | +import * as Exit from "effect/Exit"; | |
| 4 | +import * as Option from "effect/Option"; | |
| 3 | 5 | |
| 4 | −import { usePendingSources } from "@executor-js/react/api/optimistic"; | |
| 5 | 6 | import { sourceWriteKeys } from "@executor-js/react/api/reactivity-keys"; |
| 6 | 7 | import { useScope } from "@executor-js/react/api/scope-context"; |
| 7 | 8 | import type { SecretPickerSecret } from "@executor-js/react/plugins/secret-picker"; |
| @@ -44,7 +45,7 @@ import { FloatActions } from "@executor-js/react/components/float-actions"; · 36 unmodified lines | ||
| 44 | 45 | import { Input } from "@executor-js/react/components/input"; |
| 45 | 46 | import { RadioGroup, RadioGroupItem } from "@executor-js/react/components/radio-group"; |
| 46 | 47 | import { IOSSpinner, Spinner } from "@executor-js/react/components/spinner"; |
| 47 | −import { addGoogleDiscoverySource, probeGoogleDiscovery } from "./atoms"; | |
| 48 | +import { addGoogleDiscoverySourceOptimistic, probeGoogleDiscovery } from "./atoms"; | |
| 48 | 49 | import { GOOGLE_DISCOVERY_OAUTH_POPUP_NAME, googleDiscoveryOAuthStrategy } from "./oauth"; |
| 49 | 50 | import { googleDiscoveryPresets, type GoogleDiscoveryPreset } from "../sdk/presets"; |
| 50 | 51 | |
| @@ -203,8 +204,9 @@ export default function AddGoogleDiscoverySource(props: { · 152 unmodified lines | ||
| 203 | 204 | |
| 204 | 205 | const scopeId = useScope(); |
| 205 | 206 | const doProbe = useAtomSet(probeGoogleDiscovery, { mode: "promise" }); |
| 206 | − const doAdd = useAtomSet(addGoogleDiscoverySource, { mode: "promise" }); | |
| 207 | − const { beginAdd } = usePendingSources(); | |
| 207 | + const doAdd = useAtomSet(addGoogleDiscoverySourceOptimistic(scopeId), { | |
| 208 | + mode: "promiseExit", | |
| 209 | + }); | |
| 208 | 210 | const secretList = useSecretPickerSecrets(); |
| 209 | 211 | const oauth = useOAuthPopupFlow({ |
| 210 | 212 | popupName: GOOGLE_DISCOVERY_OAUTH_POPUP_NAME, |
| @@ -326,38 +328,36 @@ export default function AddGoogleDiscoverySource(props: { · 115 unmodified lines | ||
| 326 | 328 | setError(null); |
| 327 | 329 | const displayName = identity.name.trim() || probe.name; |
| 328 | 330 | const namespace = resolvedNamespace; |
| 329 | − const placeholder = beginAdd({ | |
| 330 | − id: namespace, | |
| 331 | − name: displayName, | |
| 332 | − kind: "google-discovery", | |
| 331 | + const exit = await doAdd({ | |
| 332 | + params: { scopeId }, | |
| 333 | + payload: { | |
| 334 | + name: displayName, | |
| 335 | + discoveryUrl: discoveryUrl.trim(), | |
| 336 | + namespace, | |
| 337 | + auth: | |
| 338 | + authKind === "oauth2" && oauthAuth | |
| 339 | + ? { | |
| 340 | + kind: "oauth2" as const, | |
| 341 | + connectionId: oauthAuth.connectionId, | |
| 342 | + clientIdSecretId: oauthAuth.clientIdSecretId, | |
| 343 | + clientSecretSecretId: oauthAuth.clientSecretSecretId, | |
| 344 | + scopes: oauthAuth.scopes, | |
| 345 | + } | |
| 346 | + : { kind: "none" as const }, | |
| 347 | + }, | |
| 348 | + reactivityKeys: [...sourceWriteKeys], | |
| 333 | 349 | }); |
| 334 | − try { | |
| 335 | − await doAdd({ | |
| 336 | − params: { scopeId }, | |
| 337 | − payload: { | |
| 338 | − name: displayName, | |
| 339 | − discoveryUrl: discoveryUrl.trim(), | |
| 340 | − namespace, | |
| 341 | − auth: | |
| 342 | − authKind === "oauth2" && oauthAuth | |
| 343 | − ? { | |
| 344 | − kind: "oauth2" as const, | |
| 345 | − connectionId: oauthAuth.connectionId, | |
| 346 | − clientIdSecretId: oauthAuth.clientIdSecretId, | |
| 347 | − clientSecretSecretId: oauthAuth.clientSecretSecretId, | |
| 348 | − scopes: oauthAuth.scopes, | |
| 349 | − } | |
| 350 | − : { kind: "none" as const }, | |
| 351 | − }, | |
| 352 | − reactivityKeys: [...sourceWriteKeys], | |
| 353 | − }); | |
| 354 | − props.onComplete(); | |
| 355 | − } catch (e) { | |
| 356 | − setError(e instanceof Error ? e.message : "Failed to add source"); | |
| 350 | + if (Exit.isFailure(exit)) { | |
| 351 | + const error = Exit.findErrorOption(exit); | |
| 352 | + setError( | |
| 353 | + Option.isSome(error) && error.value instanceof Error | |
| 354 | + ? error.value.message | |
| 355 | + : "Failed to add source", | |
| 356 | + ); | |
| 357 | 357 | setAdding(false); |
| 358 | − } finally { | |
| 359 | − placeholder.done(); | |
| 358 | + return; | |
| 360 | 359 | } |
| 360 | + props.onComplete(); | |
| 361 | 361 | }, [ |
| 362 | 362 | probe, |
| 363 | 363 | doAdd, |
| @@ -367,7 +367,6 @@ export default function AddGoogleDiscoverySource(props: { · 3 unmodified lines | ||
| 367 | 367 | oauthAuth, |
| 368 | 368 | props, |
| 369 | 369 | scopeId, |
| 370 | − beginAdd, | |
| 371 | 370 | resolvedNamespace, |
| 372 | 371 | ]); |
| 373 | 372 | |
| @@ -1,4 +1,7 @@ | ||
| 1 | 1 | import type { ScopeId } from "@executor-js/sdk/core"; |
| 2 | +import * as Atom from "effect/unstable/reactivity/Atom"; | |
| 3 | +import * as AsyncResult from "effect/unstable/reactivity/AsyncResult"; | |
| 4 | +import { sourcesOptimisticAtom } from "@executor-js/react/api/atoms"; | |
| 2 | 5 | import { ReactivityKey } from "@executor-js/react/api/reactivity-keys"; |
| 3 | 6 | import { GoogleDiscoveryClient } from "./client"; |
| 4 | 7 | |
| @@ -25,6 +28,32 @@ export const addGoogleDiscoverySource = GoogleDiscoveryClient.mutation( · 20 unmodified lines | ||
| 25 | 28 | "googleDiscovery", |
| 26 | 29 | "addSource", |
| 27 | 30 | ); |
| 31 | +export const addGoogleDiscoverySourceOptimistic = Atom.family((scopeId: ScopeId) => | |
| 32 | + sourcesOptimisticAtom(scopeId).pipe( | |
| 33 | + Atom.optimisticFn({ | |
| 34 | + reducer: (current, arg) => | |
| 35 | + AsyncResult.map(current, (rows) => { | |
| 36 | + const id = arg.payload.namespace ?? `pending-${Math.random().toString(36).slice(2)}`; | |
| 37 | + const source = { | |
| 38 | + id, | |
| 39 | + scopeId, | |
| 40 | + kind: "googleDiscovery", | |
| 41 | + pluginId: "google-discovery", | |
| 42 | + name: arg.payload.name, | |
| 43 | + url: arg.payload.discoveryUrl, | |
| 44 | + canRemove: false, | |
| 45 | + canRefresh: false, | |
| 46 | + canEdit: false, | |
| 47 | + runtime: false, | |
| 48 | + }; | |
| 49 | + return [source, ...rows.filter((row) => row.id !== id)].sort((a, b) => | |
| 50 | + a.name.localeCompare(b.name), | |
| 51 | + ); | |
| 52 | + }), | |
| 53 | + fn: addGoogleDiscoverySource, | |
| 54 | + }), | |
| 55 | + ), | |
| 56 | +); | |
| 28 | 57 | export const updateGoogleDiscoverySource = GoogleDiscoveryClient.mutation( |
| 29 | 58 | "googleDiscovery", |
| 30 | 59 | "updateSource", |
| @@ -1,9 +1,10 @@ | ||
| 1 | 1 | import { useCallback, useState } from "react"; |
| 2 | 2 | import { useAtomSet } from "@effect/atom-react"; |
| 3 | +import * as Exit from "effect/Exit"; | |
| 4 | +import * as Option from "effect/Option"; | |
| 3 | 5 | |
| 4 | 6 | import { useScope } from "@executor-js/react/api/scope-context"; |
| 5 | 7 | import { sourceWriteKeys } from "@executor-js/react/api/reactivity-keys"; |
| 6 | −import { usePendingSources } from "@executor-js/react/api/optimistic"; | |
| 7 | 8 | import { |
| 8 | 9 | HttpCredentialsEditor, |
| 9 | 10 | httpCredentialsValid, |
| @@ -33,7 +34,7 @@ import { · 23 unmodified lines | ||
| 33 | 34 | import { FloatActions } from "@executor-js/react/components/float-actions"; |
| 34 | 35 | import { Input } from "@executor-js/react/components/input"; |
| 35 | 36 | import { Spinner } from "@executor-js/react/components/spinner"; |
| 36 | −import { addGraphqlSource } from "./atoms"; | |
| 37 | +import { addGraphqlSourceOptimistic } from "./atoms"; | |
| 37 | 38 | import { initialGraphqlCredentials } from "./defaults"; |
| 38 | 39 | import type { HeaderValue } from "../sdk/types"; |
| 39 | 40 | |
| @@ -55,8 +56,7 @@ export default function AddGraphqlSource(props: { · 15 unmodified lines | ||
| 55 | 56 | const [tokens, setTokens] = useState<OAuthCompletionPayload | null>(null); |
| 56 | 57 | |
| 57 | 58 | const scopeId = useScope(); |
| 58 | − const doAdd = useAtomSet(addGraphqlSource, { mode: "promise" }); | |
| 59 | − const { beginAdd } = usePendingSources(); | |
| 59 | + const doAdd = useAtomSet(addGraphqlSourceOptimistic(scopeId), { mode: "promiseExit" }); | |
| 60 | 60 | const secretList = useSecretPickerSecrets(); |
| 61 | 61 | const oauth = useOAuthPopupFlow({ |
| 62 | 62 | popupName: "graphql-oauth", |
| @@ -112,41 +112,38 @@ export default function AddGraphqlSource(props: { · 49 unmodified lines | ||
| 112 | 112 | const { headers: headerMap, queryParams } = serializeHttpCredentials(credentials); |
| 113 | 113 | |
| 114 | 114 | const { trimmedEndpoint, namespace, displayName } = sourceIdentity(); |
| 115 | − const placeholder = beginAdd({ | |
| 116 | − id: namespace, | |
| 117 | − name: displayName, | |
| 118 | − kind: "graphql", | |
| 119 | − url: trimmedEndpoint || undefined, | |
| 115 | + const exit = await doAdd({ | |
| 116 | + params: { scopeId }, | |
| 117 | + payload: { | |
| 118 | + endpoint: trimmedEndpoint, | |
| 119 | + name: displayName, | |
| 120 | + namespace, | |
| 121 | + ...(Object.keys(headerMap).length > 0 ? { headers: headerMap } : {}), | |
| 122 | + ...(Object.keys(queryParams).length > 0 | |
| 123 | + ? { queryParams: queryParams as Record<string, HeaderValue> } | |
| 124 | + : {}), | |
| 125 | + ...(authMode === "oauth2" && tokens | |
| 126 | + ? { | |
| 127 | + auth: { | |
| 128 | + kind: "oauth2" as const, | |
| 129 | + connectionId: tokens.connectionId, | |
| 130 | + }, | |
| 131 | + } | |
| 132 | + : {}), | |
| 133 | + }, | |
| 134 | + reactivityKeys: sourceWriteKeys, | |
| 120 | 135 | }); |
| 121 | − try { | |
| 122 | − await doAdd({ | |
| 123 | − params: { scopeId }, | |
| 124 | − payload: { | |
| 125 | − endpoint: trimmedEndpoint, | |
| 126 | − name: identity.name.trim() || undefined, | |
| 127 | − namespace: slugifyNamespace(identity.namespace) || undefined, | |
| 128 | − ...(Object.keys(headerMap).length > 0 ? { headers: headerMap } : {}), | |
| 129 | − ...(Object.keys(queryParams).length > 0 | |
| 130 | − ? { queryParams: queryParams as Record<string, HeaderValue> } | |
| 131 | − : {}), | |
| 132 | − ...(authMode === "oauth2" && tokens | |
| 133 | − ? { | |
| 134 | − auth: { | |
| 135 | − kind: "oauth2" as const, | |
| 136 | − connectionId: tokens.connectionId, | |
| 137 | − }, | |
| 138 | − } | |
| 139 | − : {}), | |
| 140 | − }, | |
| 141 | − reactivityKeys: sourceWriteKeys, | |
| 142 | − }); | |
| 143 | − props.onComplete(); | |
| 144 | − } catch (e) { | |
| 145 | − setAddError(e instanceof Error ? e.message : "Failed to add source"); | |
| 136 | + if (Exit.isFailure(exit)) { | |
| 137 | + const error = Exit.findErrorOption(exit); | |
| 138 | + setAddError( | |
| 139 | + Option.isSome(error) && error.value instanceof Error | |
| 140 | + ? error.value.message | |
| 141 | + : "Failed to add source", | |
| 142 | + ); | |
| 146 | 143 | setAdding(false); |
| 147 | − } finally { | |
| 148 | − placeholder.done(); | |
| 144 | + return; | |
| 149 | 145 | } |
| 146 | + props.onComplete(); | |
| 150 | 147 | }; |
| 151 | 148 | |
| 152 | 149 | return ( |
| @@ -1,4 +1,7 @@ | ||
| 1 | 1 | import type { ScopeId } from "@executor-js/sdk/core"; |
| 2 | +import * as Atom from "effect/unstable/reactivity/Atom"; | |
| 3 | +import * as AsyncResult from "effect/unstable/reactivity/AsyncResult"; | |
| 4 | +import { sourcesOptimisticAtom } from "@executor-js/react/api/atoms"; | |
| 2 | 5 | import { ReactivityKey } from "@executor-js/react/api/reactivity-keys"; |
| 3 | 6 | import { GraphqlClient } from "./client"; |
| 4 | 7 | |
| @@ -19,4 +22,31 @@ export const graphqlSourceAtom = (scopeId: ScopeId, namespace: string) => · 14 unmodified lines | ||
| 19 | 22 | |
| 20 | 23 | export const addGraphqlSource = GraphqlClient.mutation("graphql", "addSource"); |
| 21 | 24 | |
| 25 | +export const addGraphqlSourceOptimistic = Atom.family((scopeId: ScopeId) => | |
| 26 | + sourcesOptimisticAtom(scopeId).pipe( | |
| 27 | + Atom.optimisticFn({ | |
| 28 | + reducer: (current, arg) => | |
| 29 | + AsyncResult.map(current, (rows) => { | |
| 30 | + const id = arg.payload.namespace ?? `pending-${Math.random().toString(36).slice(2)}`; | |
| 31 | + const source = { | |
| 32 | + id, | |
| 33 | + scopeId, | |
| 34 | + kind: "graphql", | |
| 35 | + pluginId: "graphql", | |
| 36 | + name: arg.payload.name ?? id, | |
| 37 | + url: arg.payload.endpoint, | |
| 38 | + canRemove: false, | |
| 39 | + canRefresh: false, | |
| 40 | + canEdit: false, | |
| 41 | + runtime: false, | |
| 42 | + }; | |
| 43 | + return [source, ...rows.filter((row) => row.id !== id)].sort((a, b) => | |
| 44 | + a.name.localeCompare(b.name), | |
| 45 | + ); | |
| 46 | + }), | |
| 47 | + fn: addGraphqlSource, | |
| 48 | + }), | |
| 49 | + ), | |
| 50 | +); | |
| 51 | + | |
| 22 | 52 | export const updateGraphqlSource = GraphqlClient.mutation("graphql", "updateSource"); |
| @@ -1,5 +1,7 @@ | ||
| 1 | 1 | import { useReducer, useCallback, useEffect, useRef, useState, type ReactNode } from "react"; |
| 2 | 2 | import { useAtomSet } from "@effect/atom-react"; |
| 3 | +import * as Exit from "effect/Exit"; | |
| 4 | +import * as Option from "effect/Option"; | |
| 3 | 5 | |
| 4 | 6 | import { useScope } from "@executor-js/react/api/scope-context"; |
| 5 | 7 | import { Button } from "@executor-js/react/components/button"; |
| @@ -49,8 +51,7 @@ import { · 43 unmodified lines | ||
| 49 | 51 | |
| 50 | 52 | type RemoteAuthMode = "none" | "header" | "oauth2"; |
| 51 | 53 | import { sourceWriteKeys } from "@executor-js/react/api/reactivity-keys"; |
| 52 | −import { usePendingSources } from "@executor-js/react/api/optimistic"; | |
| 53 | −import { probeMcpEndpoint, addMcpSource } from "./atoms"; | |
| 54 | +import { probeMcpEndpoint, addMcpSourceOptimistic } from "./atoms"; | |
| 54 | 55 | import { mcpPresets, type McpPreset } from "../sdk/presets"; |
| 55 | 56 | |
| 56 | 57 | // --------------------------------------------------------------------------- |
| @@ -269,8 +270,7 @@ export default function AddMcpSource(props: { · 212 unmodified lines | ||
| 269 | 270 | |
| 270 | 271 | const scopeId = useScope(); |
| 271 | 272 | const doProbe = useAtomSet(probeMcpEndpoint, { mode: "promise" }); |
| 272 | − const doAdd = useAtomSet(addMcpSource, { mode: "promise" }); | |
| 273 | − const { beginAdd } = usePendingSources(); | |
| 273 | + const doAdd = useAtomSet(addMcpSourceOptimistic(scopeId), { mode: "promiseExit" }); | |
| 274 | 274 | const secretList = useSecretPickerSecrets(); |
| 275 | 275 | const oauth = useOAuthPopupFlow<OAuthCompletionPayload>({ |
| 276 | 276 | popupName: "mcp-oauth", |
| @@ -466,40 +466,33 @@ export default function AddMcpSource(props: { · 189 unmodified lines | ||
| 466 | 466 | }; |
| 467 | 467 | const displayName = remoteIdentity.name.trim() || probe.serverName || probe.name; |
| 468 | 468 | const slugNamespace = slugifyNamespace(remoteIdentity.namespace); |
| 469 | − const placeholderId = slugNamespace || `pending:${crypto.randomUUID()}`; | |
| 470 | − const placeholder = beginAdd({ | |
| 471 | − id: placeholderId, | |
| 472 | − name: displayName, | |
| 473 | − kind: "mcp", | |
| 474 | − url: state.url.trim(), | |
| 469 | + const exit = await doAdd({ | |
| 470 | + params: { scopeId }, | |
| 471 | + payload: { | |
| 472 | + transport: "remote" as const, | |
| 473 | + name: displayName, | |
| 474 | + namespace: slugNamespace || undefined, | |
| 475 | + endpoint: state.url.trim(), | |
| 476 | + auth, | |
| 477 | + ...(Object.keys(remoteRequestHeaders).length > 0 ? { headers: remoteRequestHeaders } : {}), | |
| 478 | + ...(Object.keys(credentials.queryParams).length > 0 | |
| 479 | + ? { queryParams: credentials.queryParams } | |
| 480 | + : {}), | |
| 481 | + }, | |
| 482 | + reactivityKeys: sourceWriteKeys, | |
| 475 | 483 | }); |
| 476 | − try { | |
| 477 | − await doAdd({ | |
| 478 | − params: { scopeId }, | |
| 479 | − payload: { | |
| 480 | − transport: "remote" as const, | |
| 481 | − name: displayName, | |
| 482 | − namespace: slugNamespace || undefined, | |
| 483 | − endpoint: state.url.trim(), | |
| 484 | − auth, | |
| 485 | − ...(Object.keys(remoteRequestHeaders).length > 0 | |
| 486 | − ? { headers: remoteRequestHeaders } | |
| 487 | − : {}), | |
| 488 | − ...(Object.keys(credentials.queryParams).length > 0 | |
| 489 | − ? { queryParams: credentials.queryParams } | |
| 490 | − : {}), | |
| 491 | − }, | |
| 492 | − reactivityKeys: sourceWriteKeys, | |
| 493 | − }); | |
| 494 | − props.onComplete(); | |
| 495 | − } catch (e) { | |
| 484 | + if (Exit.isFailure(exit)) { | |
| 485 | + const error = Exit.findErrorOption(exit); | |
| 496 | 486 | dispatch({ |
| 497 | 487 | type: "add-fail", |
| 498 | − error: e instanceof Error ? e.message : "Failed to add source", | |
| 488 | + error: | |
| 489 | + Option.isSome(error) && error.value instanceof Error | |
| 490 | + ? error.value.message | |
| 491 | + : "Failed to add source", | |
| 499 | 492 | }); |
| 500 | − } finally { | |
| 501 | − placeholder.done(); | |
| 493 | + return; | |
| 502 | 494 | } |
| 495 | + props.onComplete(); | |
| 503 | 496 | }, [ |
| 504 | 497 | probe, |
| 505 | 498 | remoteAuthMode, |
| @@ -512,7 +505,6 @@ export default function AddMcpSource(props: { · 6 unmodified lines | ||
| 512 | 505 | doAdd, |
| 513 | 506 | props, |
| 514 | 507 | scopeId, |
| 515 | − beginAdd, | |
| 516 | 508 | ]); |
| 517 | 509 | |
| 518 | 510 | // ---- Stdio actions ---- |
| @@ -547,33 +539,30 @@ export default function AddMcpSource(props: { · 28 unmodified lines | ||
| 547 | 539 | setStdioError(null); |
| 548 | 540 | const displayName = stdioIdentity.name.trim() || cmd; |
| 549 | 541 | const slugNamespace = slugifyNamespace(stdioIdentity.namespace); |
| 550 | − const placeholderId = slugNamespace || `pending:${crypto.randomUUID()}`; | |
| 551 | − const placeholder = beginAdd({ | |
| 552 | − id: placeholderId, | |
| 553 | − name: displayName, | |
| 554 | − kind: "mcp", | |
| 542 | + const exit = await doAdd({ | |
| 543 | + params: { scopeId }, | |
| 544 | + payload: { | |
| 545 | + transport: "stdio" as const, | |
| 546 | + name: displayName, | |
| 547 | + namespace: slugNamespace || undefined, | |
| 548 | + command: cmd, | |
| 549 | + args: parseStdioArgs(stdioArgs), | |
| 550 | + env: parseStdioEnv(stdioEnv), | |
| 551 | + }, | |
| 552 | + reactivityKeys: sourceWriteKeys, | |
| 555 | 553 | }); |
| 556 | − try { | |
| 557 | − await doAdd({ | |
| 558 | − params: { scopeId }, | |
| 559 | − payload: { | |
| 560 | − transport: "stdio" as const, | |
| 561 | − name: displayName, | |
| 562 | − namespace: slugNamespace || undefined, | |
| 563 | − command: cmd, | |
| 564 | − args: parseStdioArgs(stdioArgs), | |
| 565 | − env: parseStdioEnv(stdioEnv), | |
| 566 | − }, | |
| 567 | − reactivityKeys: sourceWriteKeys, | |
| 568 | − }); | |
| 569 | − props.onComplete(); | |
| 570 | − } catch (e) { | |
| 571 | − setStdioError(e instanceof Error ? e.message : "Failed to add source"); | |
| 554 | + if (Exit.isFailure(exit)) { | |
| 555 | + const error = Exit.findErrorOption(exit); | |
| 556 | + setStdioError( | |
| 557 | + Option.isSome(error) && error.value instanceof Error | |
| 558 | + ? error.value.message | |
| 559 | + : "Failed to add source", | |
| 560 | + ); | |
| 572 | 561 | setStdioAdding(false); |
| 573 | − } finally { | |
| 574 | − placeholder.done(); | |
| 562 | + return; | |
| 575 | 563 | } |
| 576 | − }, [stdioCommand, stdioArgs, stdioEnv, stdioIdentity, doAdd, scopeId, props, beginAdd]); | |
| 564 | + props.onComplete(); | |
| 565 | + }, [stdioCommand, stdioArgs, stdioEnv, stdioIdentity, doAdd, scopeId, props]); | |
| 577 | 566 | |
| 578 | 567 | // ---- Render ---- |
| 579 | 568 | |
| @@ -1,4 +1,7 @@ | ||
| 1 | 1 | import type { ScopeId } from "@executor-js/sdk/core"; |
| 2 | +import * as Atom from "effect/unstable/reactivity/Atom"; | |
| 3 | +import * as AsyncResult from "effect/unstable/reactivity/AsyncResult"; | |
| 4 | +import { sourcesOptimisticAtom } from "@executor-js/react/api/atoms"; | |
| 2 | 5 | import { ReactivityKey } from "@executor-js/react/api/reactivity-keys"; |
| 3 | 6 | import { McpClient } from "./client"; |
| 4 | 7 | |
| @@ -19,6 +22,32 @@ export const mcpSourceAtom = (scopeId: ScopeId, namespace: string) => · 14 unmodified lines | ||
| 19 | 22 | |
| 20 | 23 | export const probeMcpEndpoint = McpClient.mutation("mcp", "probeEndpoint"); |
| 21 | 24 | export const addMcpSource = McpClient.mutation("mcp", "addSource"); |
| 25 | +export const addMcpSourceOptimistic = Atom.family((scopeId: ScopeId) => | |
| 26 | + sourcesOptimisticAtom(scopeId).pipe( | |
| 27 | + Atom.optimisticFn({ | |
| 28 | + reducer: (current, arg) => | |
| 29 | + AsyncResult.map(current, (rows) => { | |
| 30 | + const id = arg.payload.namespace ?? `pending-${Math.random().toString(36).slice(2)}`; | |
| 31 | + const source = { | |
| 32 | + id, | |
| 33 | + scopeId, | |
| 34 | + kind: "mcp", | |
| 35 | + pluginId: "mcp", | |
| 36 | + name: arg.payload.name ?? id, | |
| 37 | + ...(arg.payload.transport === "remote" ? { url: arg.payload.endpoint } : {}), | |
| 38 | + canRemove: false, | |
| 39 | + canRefresh: false, | |
| 40 | + canEdit: false, | |
| 41 | + runtime: false, | |
| 42 | + }; | |
| 43 | + return [source, ...rows.filter((row) => row.id !== id)].sort((a, b) => | |
| 44 | + a.name.localeCompare(b.name), | |
| 45 | + ); | |
| 46 | + }), | |
| 47 | + fn: addMcpSource, | |
| 48 | + }), | |
| 49 | + ), | |
| 50 | +); | |
| 22 | 51 | export const removeMcpSource = McpClient.mutation("mcp", "removeSource"); |
| 23 | 52 | export const refreshMcpSource = McpClient.mutation("mcp", "refreshSource"); |
| 24 | 53 | export const updateMcpSource = McpClient.mutation("mcp", "updateSource"); |
| @@ -1,6 +1,7 @@ | ||
| 1 | 1 | import { useCallback, useEffect, useRef, useState } from "react"; |
| 2 | 2 | import { useAtomSet } from "@effect/atom-react"; |
| 3 | −import { Option } from "effect"; | |
| 3 | +import * as Exit from "effect/Exit"; | |
| 4 | +import * as Option from "effect/Option"; | |
| 4 | 5 | |
| 5 | 6 | import { ConnectionId, ScopeId, SecretId } from "@executor-js/sdk/core"; |
| 6 | 7 | import { startOAuth } from "@executor-js/react/api/atoms"; |
| @@ -14,7 +15,6 @@ import { connectionWriteKeys, sourceWriteKeys } from "@executor-js/react/api/rea · 7 unmodified lines | ||
| 14 | 15 | // state without a refresh. |
| 15 | 16 | const addSpecWriteKeys = [...sourceWriteKeys, ...connectionWriteKeys] as const; |
| 16 | 17 | const bindingWriteKeys = [...sourceWriteKeys, ...connectionWriteKeys] as const; |
| 17 | −import { usePendingSources } from "@executor-js/react/api/optimistic"; | |
| 18 | 18 | import { HeadersList } from "@executor-js/react/plugins/headers-list"; |
| 19 | 19 | import { |
| 20 | 20 | HttpCredentialsEditor, |
| @@ -65,7 +65,7 @@ import { SourceFavicon } from "@executor-js/react/components/source-favicon"; · 44 unmodified lines | ||
| 65 | 65 | import { RadioGroup, RadioGroupItem } from "@executor-js/react/components/radio-group"; |
| 66 | 66 | import { Skeleton } from "@executor-js/react/components/skeleton"; |
| 67 | 67 | import { IOSSpinner, Spinner } from "@executor-js/react/components/spinner"; |
| 68 | −import { addOpenApiSpec, previewOpenApiSpec, setOpenApiSourceBinding } from "./atoms"; | |
| 68 | +import { addOpenApiSpecOptimistic, previewOpenApiSpec, setOpenApiSourceBinding } from "./atoms"; | |
| 69 | 69 | import type { SpecPreview, HeaderPreset, OAuth2Preset } from "../sdk/preview"; |
| 70 | 70 | import { |
| 71 | 71 | headerBindingSlot, |
| @@ -243,10 +243,9 @@ export default function AddOpenApiSource(props: { · 171 unmodified lines | ||
| 243 | 243 | const scopeId = useScope(); |
| 244 | 244 | const userScope = useUserScope(); |
| 245 | 245 | const doPreview = useAtomSet(previewOpenApiSpec, { mode: "promise" }); |
| 246 | − const doAdd = useAtomSet(addOpenApiSpec, { mode: "promise" }); | |
| 246 | + const doAdd = useAtomSet(addOpenApiSpecOptimistic(scopeId), { mode: "promiseExit" }); | |
| 247 | 247 | const doStartOAuth = useAtomSet(startOAuth, { mode: "promise" }); |
| 248 | − const doSetBinding = useAtomSet(setOpenApiSourceBinding, { mode: "promise" }); | |
| 249 | − const { beginAdd } = usePendingSources(); | |
| 248 | + const doSetBinding = useAtomSet(setOpenApiSourceBinding, { mode: "promiseExit" }); | |
| 250 | 249 | const secretList = useSecretPickerSecrets(); |
| 251 | 250 | const oauth = useOAuthPopupFlow<OAuthCompletionPayload>({ |
| 252 | 251 | popupName: OPENAPI_OAUTH_POPUP_NAME, |
| @@ -615,109 +614,146 @@ export default function AddOpenApiSource(props: { · 362 unmodified lines | ||
| 615 | 614 | const displayName = |
| 616 | 615 | identity.name.trim() || |
| 617 | 616 | (preview ? Option.getOrElse(preview.title, () => namespace) : namespace); |
| 618 | − const placeholder = beginAdd({ | |
| 619 | − id: namespace, | |
| 620 | − name: displayName, | |
| 621 | − kind: "openapi", | |
| 622 | − url: resolvedBaseUrl || undefined, | |
| 617 | + const exit = await doAdd({ | |
| 618 | + params: { scopeId }, | |
| 619 | + payload: { | |
| 620 | + spec: specUrl, | |
| 621 | + specFetchCredentials: serializeHttpCredentials(specFetchCredentials), | |
| 622 | + name: displayName, | |
| 623 | + namespace, | |
| 624 | + baseUrl: resolvedBaseUrl || undefined, | |
| 625 | + ...(hasHeaders ? { headers: configuredHeaders } : {}), | |
| 626 | + ...(Object.keys(serializeHttpCredentials(runtimeCredentials).queryParams).length > 0 | |
| 627 | + ? { queryParams: serializeHttpCredentials(runtimeCredentials).queryParams } | |
| 628 | + : {}), | |
| 629 | + ...(configuredOAuth2 ? { oauth2: configuredOAuth2 } : {}), | |
| 630 | + }, | |
| 631 | + reactivityKeys: addSpecWriteKeys, | |
| 623 | 632 | }); |
| 624 | − try { | |
| 625 | − const result = await doAdd({ | |
| 633 | + if (Exit.isFailure(exit)) { | |
| 634 | + const error = Exit.findErrorOption(exit); | |
| 635 | + setAddError( | |
| 636 | + Option.isSome(error) && error.value instanceof Error | |
| 637 | + ? error.value.message | |
| 638 | + : "Failed to add source", | |
| 639 | + ); | |
| 640 | + setAdding(false); | |
| 641 | + return; | |
| 642 | + } | |
| 643 | + | |
| 644 | + const sourceId = exit.value.namespace; | |
| 645 | + const sourceScope = ScopeId.make(scopeId); | |
| 646 | + const bindingScope = ScopeId.make(userScope); | |
| 647 | + | |
| 648 | + for (const binding of headerBindings) { | |
| 649 | + const bindingExit = await doSetBinding({ | |
| 626 | 650 | params: { scopeId }, |
| 627 | 651 | payload: { |
| 628 | − spec: specUrl, | |
| 629 | − specFetchCredentials: serializeHttpCredentials(specFetchCredentials), | |
| 630 | − name: identity.name.trim() || undefined, | |
| 631 | − namespace: slugifyNamespace(identity.namespace) || undefined, | |
| 632 | − baseUrl: resolvedBaseUrl || undefined, | |
| 633 | − ...(hasHeaders ? { headers: configuredHeaders } : {}), | |
| 634 | − ...(Object.keys(serializeHttpCredentials(runtimeCredentials).queryParams).length > 0 | |
| 635 | − ? { queryParams: serializeHttpCredentials(runtimeCredentials).queryParams } | |
| 636 | − : {}), | |
| 637 | − ...(configuredOAuth2 ? { oauth2: configuredOAuth2 } : {}), | |
| 652 | + sourceId, | |
| 653 | + sourceScope, | |
| 654 | + scope: bindingScope, | |
| 655 | + slot: binding.slot, | |
| 656 | + value: { | |
| 657 | + kind: "secret", | |
| 658 | + secretId: SecretId.make(binding.secretId), | |
| 659 | + }, | |
| 638 | 660 | }, |
| 639 | − reactivityKeys: addSpecWriteKeys, | |
| 661 | + reactivityKeys: bindingWriteKeys, | |
| 640 | 662 | }); |
| 641 | − | |
| 642 | − const sourceId = result.namespace; | |
| 643 | − const sourceScope = ScopeId.make(scopeId); | |
| 644 | − const bindingScope = ScopeId.make(userScope); | |
| 645 | − | |
| 646 | − for (const binding of headerBindings) { | |
| 647 | − await doSetBinding({ | |
| 648 | − params: { scopeId }, | |
| 649 | − payload: { | |
| 650 | − sourceId, | |
| 651 | − sourceScope, | |
| 652 | − scope: bindingScope, | |
| 653 | − slot: binding.slot, | |
| 654 | − value: { | |
| 655 | − kind: "secret", | |
| 656 | − secretId: SecretId.make(binding.secretId), | |
| 657 | − }, | |
| 658 | − }, | |
| 659 | − reactivityKeys: bindingWriteKeys, | |
| 660 | − }); | |
| 663 | + if (Exit.isFailure(bindingExit)) { | |
| 664 | + const error = Exit.findErrorOption(bindingExit); | |
| 665 | + setAddError( | |
| 666 | + Option.isSome(error) && error.value instanceof Error | |
| 667 | + ? error.value.message | |
| 668 | + : "Failed to add source", | |
| 669 | + ); | |
| 670 | + setAdding(false); | |
| 671 | + return; | |
| 661 | 672 | } |
| 673 | + } | |
| 662 | 674 | |
| 663 | − if (configuredOAuth2 && oauth2ClientIdSecretId) { | |
| 664 | − await doSetBinding({ | |
| 665 | − params: { scopeId }, | |
| 666 | − payload: { | |
| 667 | − sourceId, | |
| 668 | − sourceScope, | |
| 669 | − scope: bindingScope, | |
| 670 | − slot: configuredOAuth2.clientIdSlot, | |
| 671 | − value: { | |
| 672 | − kind: "secret", | |
| 673 | − secretId: SecretId.make(oauth2ClientIdSecretId), | |
| 674 | − }, | |
| 675 | + if (configuredOAuth2 && oauth2ClientIdSecretId) { | |
| 676 | + const bindingExit = await doSetBinding({ | |
| 677 | + params: { scopeId }, | |
| 678 | + payload: { | |
| 679 | + sourceId, | |
| 680 | + sourceScope, | |
| 681 | + scope: bindingScope, | |
| 682 | + slot: configuredOAuth2.clientIdSlot, | |
| 683 | + value: { | |
| 684 | + kind: "secret", | |
| 685 | + secretId: SecretId.make(oauth2ClientIdSecretId), | |
| 675 | 686 | }, |
| 676 | − reactivityKeys: bindingWriteKeys, | |
| 677 | − }); | |
| 687 | + }, | |
| 688 | + reactivityKeys: bindingWriteKeys, | |
| 689 | + }); | |
| 690 | + if (Exit.isFailure(bindingExit)) { | |
| 691 | + const error = Exit.findErrorOption(bindingExit); | |
| 692 | + setAddError( | |
| 693 | + Option.isSome(error) && error.value instanceof Error | |
| 694 | + ? error.value.message | |
| 695 | + : "Failed to add source", | |
| 696 | + ); | |
| 697 | + setAdding(false); | |
| 698 | + return; | |
| 678 | 699 | } |
| 700 | + } | |
| 679 | 701 | |
| 680 | − if (configuredOAuth2?.clientSecretSlot && oauth2ClientSecretSecretId) { | |
| 681 | − await doSetBinding({ | |
| 682 | − params: { scopeId }, | |
| 683 | − payload: { | |
| 684 | − sourceId, | |
| 685 | − sourceScope, | |
| 686 | − scope: bindingScope, | |
| 687 | − slot: configuredOAuth2.clientSecretSlot, | |
| 688 | − value: { | |
| 689 | − kind: "secret", | |
| 690 | − secretId: SecretId.make(oauth2ClientSecretSecretId), | |
| 691 | − }, | |
| 702 | + if (configuredOAuth2?.clientSecretSlot && oauth2ClientSecretSecretId) { | |
| 703 | + const bindingExit = await doSetBinding({ | |
| 704 | + params: { scopeId }, | |
| 705 | + payload: { | |
| 706 | + sourceId, | |
| 707 | + sourceScope, | |
| 708 | + scope: bindingScope, | |
| 709 | + slot: configuredOAuth2.clientSecretSlot, | |
| 710 | + value: { | |
| 711 | + kind: "secret", | |
| 712 | + secretId: SecretId.make(oauth2ClientSecretSecretId), | |
| 692 | 713 | }, |
| 693 | − reactivityKeys: bindingWriteKeys, | |
| 694 | − }); | |
| 714 | + }, | |
| 715 | + reactivityKeys: bindingWriteKeys, | |
| 716 | + }); | |
| 717 | + if (Exit.isFailure(bindingExit)) { | |
| 718 | + const error = Exit.findErrorOption(bindingExit); | |
| 719 | + setAddError( | |
| 720 | + Option.isSome(error) && error.value instanceof Error | |
| 721 | + ? error.value.message | |
| 722 | + : "Failed to add source", | |
| 723 | + ); | |
| 724 | + setAdding(false); | |
| 725 | + return; | |
| 695 | 726 | } |
| 727 | + } | |
| 696 | 728 | |
| 697 | − if (configuredOAuth2 && oauth2Auth) { | |
| 698 | − await doSetBinding({ | |
| 699 | − params: { scopeId }, | |
| 700 | − payload: { | |
| 701 | − sourceId, | |
| 702 | − sourceScope, | |
| 703 | − scope: bindingScope, | |
| 704 | − slot: configuredOAuth2.connectionSlot, | |
| 705 | − value: { | |
| 706 | − kind: "connection", | |
| 707 | − connectionId: ConnectionId.make(oauth2Auth.connectionId), | |
| 708 | − }, | |
| 729 | + if (configuredOAuth2 && oauth2Auth) { | |
| 730 | + const bindingExit = await doSetBinding({ | |
| 731 | + params: { scopeId }, | |
| 732 | + payload: { | |
| 733 | + sourceId, | |
| 734 | + sourceScope, | |
| 735 | + scope: bindingScope, | |
| 736 | + slot: configuredOAuth2.connectionSlot, | |
| 737 | + value: { | |
| 738 | + kind: "connection", | |
| 739 | + connectionId: ConnectionId.make(oauth2Auth.connectionId), | |
| 709 | 740 | }, |
| 710 | − reactivityKeys: bindingWriteKeys, | |
| 711 | − }); | |
| 741 | + }, | |
| 742 | + reactivityKeys: bindingWriteKeys, | |
| 743 | + }); | |
| 744 | + if (Exit.isFailure(bindingExit)) { | |
| 745 | + const error = Exit.findErrorOption(bindingExit); | |
| 746 | + setAddError( | |
| 747 | + Option.isSome(error) && error.value instanceof Error | |
| 748 | + ? error.value.message | |
| 749 | + : "Failed to add source", | |
| 750 | + ); | |
| 751 | + setAdding(false); | |
| 752 | + return; | |
| 712 | 753 | } |
| 713 | − | |
| 714 | − props.onComplete(); | |
| 715 | − } catch (e) { | |
| 716 | − setAddError(e instanceof Error ? e.message : "Failed to add source"); | |
| 717 | − setAdding(false); | |
| 718 | − } finally { | |
| 719 | − placeholder.done(); | |
| 720 | 754 | } |
| 755 | + | |
| 756 | + props.onComplete(); | |
| 721 | 757 | }; |
| 722 | 758 | |
| 723 | 759 | // ---- Render ---- |
| @@ -1,4 +1,7 @@ | ||
| 1 | 1 | import type { ScopeId } from "@executor-js/sdk/core"; |
| 2 | +import * as Atom from "effect/unstable/reactivity/Atom"; | |
| 3 | +import * as AsyncResult from "effect/unstable/reactivity/AsyncResult"; | |
| 4 | +import { sourcesOptimisticAtom } from "@executor-js/react/api/atoms"; | |
| 2 | 5 | import { ReactivityKey } from "@executor-js/react/api/reactivity-keys"; |
| 3 | 6 | import { OpenApiClient } from "./client"; |
| 4 | 7 | |
| @@ -32,6 +35,33 @@ export const previewOpenApiSpec = OpenApiClient.mutation("openapi", "previewSpec · 27 unmodified lines | ||
| 32 | 35 | |
| 33 | 36 | export const addOpenApiSpec = OpenApiClient.mutation("openapi", "addSpec"); |
| 34 | 37 | |
| 38 | +export const addOpenApiSpecOptimistic = Atom.family((scopeId: ScopeId) => | |
| 39 | + sourcesOptimisticAtom(scopeId).pipe( | |
| 40 | + Atom.optimisticFn({ | |
| 41 | + reducer: (current, arg) => | |
| 42 | + AsyncResult.map(current, (rows) => { | |
| 43 | + const id = arg.payload.namespace ?? `pending-${Math.random().toString(36).slice(2)}`; | |
| 44 | + const source = { | |
| 45 | + id, | |
| 46 | + scopeId, | |
| 47 | + kind: "openapi", | |
| 48 | + pluginId: "openapi", | |
| 49 | + name: arg.payload.name ?? id, | |
| 50 | + ...(arg.payload.baseUrl ? { url: arg.payload.baseUrl } : {}), | |
| 51 | + canRemove: false, | |
| 52 | + canRefresh: false, | |
| 53 | + canEdit: false, | |
| 54 | + runtime: false, | |
| 55 | + }; | |
| 56 | + return [source, ...rows.filter((row) => row.id !== id)].sort((a, b) => | |
| 57 | + a.name.localeCompare(b.name), | |
| 58 | + ); | |
| 59 | + }), | |
| 60 | + fn: addOpenApiSpec, | |
| 61 | + }), | |
| 62 | + ), | |
| 63 | +); | |
| 64 | + | |
| 35 | 65 | export const updateOpenApiSource = OpenApiClient.mutation("openapi", "updateSource"); |
| 36 | 66 | |
| 37 | 67 | export const setOpenApiSourceBinding = OpenApiClient.mutation("openapi", "setSourceBinding"); |
| @@ -55,7 +55,10 @@ export const sourcesAtom = (scopeId: ScopeId) => · 54 unmodified lines | ||
| 55 | 55 | |
| 56 | 56 | /** Single source by id — derived from the sources list */ |
| 57 | 57 | export const sourceAtom = (sourceId: string, scopeId: ScopeId) => |
| 58 | − Atom.mapResult(sourcesAtom(scopeId), (sources) => sources.find((s) => s.id === sourceId) ?? null); | |
| 58 | + Atom.mapResult( | |
| 59 | + sourcesOptimisticAtom(scopeId), | |
| 60 | + (sources) => sources.find((s) => s.id === sourceId) ?? null, | |
| 61 | + ); | |
| 59 | 62 | |
| 60 | 63 | export const secretsAtom = (scopeId: ScopeId) => |
| 61 | 64 | ExecutorApiClient.query("secrets", "list", { |
| @@ -85,25 +88,14 @@ export const secretUsagesAtom = (scopeId: ScopeId, secretId: SecretId) => · 23 unmodified lines | ||
| 85 | 88 | // Refresh whenever any source / connection / secret changes — adding |
| 86 | 89 | // an oauth source pulls in a new connection-secret link and we want |
| 87 | 90 | // the usage list to reflect it. |
| 88 | − reactivityKeys: [ | |
| 89 | − ReactivityKey.secrets, | |
| 90 | − ReactivityKey.sources, | |
| 91 | − ReactivityKey.connections, | |
| 92 | − ], | |
| 91 | + reactivityKeys: [ReactivityKey.secrets, ReactivityKey.sources, ReactivityKey.connections], | |
| 93 | 92 | }); |
| 94 | 93 | |
| 95 | −export const connectionUsagesAtom = ( | |
| 96 | − scopeId: ScopeId, | |
| 97 | − connectionId: ConnectionId, | |
| 98 | −) => | |
| 94 | +export const connectionUsagesAtom = (scopeId: ScopeId, connectionId: ConnectionId) => | |
| 99 | 95 | ExecutorApiClient.query("connections", "usages", { |
| 100 | 96 | params: { scopeId, connectionId }, |
| 101 | 97 | timeToLive: "30 seconds", |
| 102 | − reactivityKeys: [ | |
| 103 | − ReactivityKey.connections, | |
| 104 | − ReactivityKey.sources, | |
| 105 | − ReactivityKey.secrets, | |
| 106 | − ], | |
| 98 | + reactivityKeys: [ReactivityKey.connections, ReactivityKey.sources, ReactivityKey.secrets], | |
| 107 | 99 | }); |
| 108 | 100 | |
| 109 | 101 | export const policiesAtom = (scopeId: ScopeId) => |
| @@ -153,6 +145,46 @@ export const updatePolicy = ExecutorApiClient.mutation("policies", "update"); · 43 unmodified lines | ||
| 153 | 145 | |
| 154 | 146 | export const removePolicy = ExecutorApiClient.mutation("policies", "remove"); |
| 155 | 147 | |
| 148 | +// --------------------------------------------------------------------------- | |
| 149 | +// Sources — optimistic surface. | |
| 150 | +// --------------------------------------------------------------------------- | |
| 151 | + | |
| 152 | +export const sourcesOptimisticAtom = Atom.family((scopeId: ScopeId) => | |
| 153 | + Atom.optimistic(sourcesAtom(scopeId)), | |
| 154 | +); | |
| 155 | + | |
| 156 | +export const removeSourceOptimistic = Atom.family((scopeId: ScopeId) => | |
| 157 | + sourcesOptimisticAtom(scopeId).pipe( | |
| 158 | + Atom.optimisticFn({ | |
| 159 | + reducer: (current, arg) => | |
| 160 | + AsyncResult.map(current, (rows) => | |
| 161 | + rows.filter((source) => source.id !== arg.params.sourceId), | |
| 162 | + ), | |
| 163 | + fn: removeSource, | |
| 164 | + }), | |
| 165 | + ), | |
| 166 | +); | |
| 167 | + | |
| 168 | +// --------------------------------------------------------------------------- | |
| 169 | +// Connections — optimistic removals. | |
| 170 | +// --------------------------------------------------------------------------- | |
| 171 | + | |
| 172 | +export const connectionsOptimisticAtom = Atom.family((scopeId: ScopeId) => | |
| 173 | + Atom.optimistic(connectionsAtom(scopeId)), | |
| 174 | +); | |
| 175 | + | |
| 176 | +export const removeConnectionOptimistic = Atom.family((scopeId: ScopeId) => | |
| 177 | + connectionsOptimisticAtom(scopeId).pipe( | |
| 178 | + Atom.optimisticFn({ | |
| 179 | + reducer: (current, arg) => | |
| 180 | + AsyncResult.map(current, (rows) => | |
| 181 | + rows.filter((connection) => connection.id !== arg.params.connectionId), | |
| 182 | + ), | |
| 183 | + fn: removeConnection, | |
| 184 | + }), | |
| 185 | + ), | |
| 186 | +); | |
| 187 | + | |
| 156 | 188 | // --------------------------------------------------------------------------- |
| 157 | 189 | // Secrets — optimistic removals. |
| 158 | 190 | // --------------------------------------------------------------------------- |
| @@ -1,213 +0,0 @@ | ||
| 1 | −import * as React from "react"; | |
| 2 | −import { useAtomSet, useAtomValue } from "@effect/atom-react"; | |
| 3 | −import * as Atom from "effect/unstable/reactivity/Atom"; | |
| 4 | −import * as AsyncResult from "effect/unstable/reactivity/AsyncResult"; | |
| 5 | −import type { ScopeId } from "@executor-js/sdk"; | |
| 6 | − | |
| 7 | −import { connectionsAtom, sourcesAtom } from "./atoms"; | |
| 8 | − | |
| 9 | −/** | |
| 10 | − * Client-only optimistic-update layer. | |
| 11 | − * | |
| 12 | − * Mutations that add a row return only after the server roundtrip. The | |
| 13 | − * `pendingResourceAtom` family lets a UI insert a placeholder *before* the | |
| 14 | − * mutation resolves so the sidebar/list updates instantly. Once the server | |
| 15 | − * returns and reactivity refetches the canonical list, callers should remove | |
| 16 | − * the placeholder (the dedupe in `mergePending` filters it anyway, but | |
| 17 | − * explicit removal keeps the pending set bounded on errors). | |
| 18 | − * | |
| 19 | − * Resource keys (`"sources"`, `"secrets"`, …) match the strings in | |
| 20 | − * `ReactivityKey` but are intentionally not coupled — pending state is purely | |
| 21 | − * client-side. | |
| 22 | − */ | |
| 23 | − | |
| 24 | −export const PendingResource = { | |
| 25 | − sources: "sources", | |
| 26 | − connectionRemovals: "connection-removals", | |
| 27 | −} as const; | |
| 28 | − | |
| 29 | −export interface PendingEntry<T> { | |
| 30 | − readonly id: string; | |
| 31 | − readonly value: T; | |
| 32 | −} | |
| 33 | − | |
| 34 | −const pendingFamily = Atom.family((_resource: string) => | |
| 35 | − Atom.make<ReadonlyArray<PendingEntry<unknown>>>([]), | |
| 36 | −); | |
| 37 | − | |
| 38 | −const atomFor = <T,>(resource: string) => | |
| 39 | − pendingFamily(resource) as ReturnType<typeof pendingFamily> & { | |
| 40 | − readonly __t?: T; | |
| 41 | − }; | |
| 42 | − | |
| 43 | −export const usePendingResource = <T,>(resource: string) => { | |
| 44 | − const atom = atomFor<T>(resource); | |
| 45 | − const pending = useAtomValue(atom) as ReadonlyArray<PendingEntry<T>>; | |
| 46 | − const setPending = useAtomSet(atom); | |
| 47 | − | |
| 48 | − const add = React.useCallback( | |
| 49 | − (entry: PendingEntry<T>) => | |
| 50 | − setPending((prev) => [ | |
| 51 | − ...(prev as ReadonlyArray<PendingEntry<T>>).filter((p) => p.id !== entry.id), | |
| 52 | − entry, | |
| 53 | − ]), | |
| 54 | − [setPending], | |
| 55 | − ); | |
| 56 | − | |
| 57 | − const remove = React.useCallback( | |
| 58 | − (id: string) => | |
| 59 | − setPending((prev) => (prev as ReadonlyArray<PendingEntry<T>>).filter((p) => p.id !== id)), | |
| 60 | − [setPending], | |
| 61 | − ); | |
| 62 | − | |
| 63 | − const clear = React.useCallback(() => setPending([]), [setPending]); | |
| 64 | − | |
| 65 | − return { pending, add, remove, clear }; | |
| 66 | −}; | |
| 67 | − | |
| 68 | −/** | |
| 69 | − * Merges pending entries with a server-loaded list. Pending entries whose id | |
| 70 | − * already exists on the server are dropped so we never double-render a row | |
| 71 | − * once the canonical version arrives. | |
| 72 | − */ | |
| 73 | −export const mergePending = <T, R>( | |
| 74 | − pending: ReadonlyArray<PendingEntry<T>>, | |
| 75 | − server: ReadonlyArray<R>, | |
| 76 | − serverId: (row: R) => string, | |
| 77 | − fromPending: (entry: PendingEntry<T>) => R, | |
| 78 | −): ReadonlyArray<R> => { | |
| 79 | − if (pending.length === 0) return server; | |
| 80 | − const seen = new Set(server.map(serverId)); | |
| 81 | − const extras = pending.filter((p) => !seen.has(p.id)).map(fromPending); | |
| 82 | − if (extras.length === 0) return server; | |
| 83 | − return [...extras, ...server]; | |
| 84 | −}; | |
| 85 | − | |
| 86 | −// --------------------------------------------------------------------------- | |
| 87 | −// Sources — convenience wrappers used by sidebar/list views and add forms. | |
| 88 | −// Pending entries are global (not per-scope) because the user only sees one | |
| 89 | −// scope at a time; this keeps the add-form code free of scope plumbing. | |
| 90 | −// --------------------------------------------------------------------------- | |
| 91 | − | |
| 92 | −export interface PendingSource { | |
| 93 | − readonly name: string; | |
| 94 | − readonly kind: string; | |
| 95 | − readonly url?: string; | |
| 96 | −} | |
| 97 | − | |
| 98 | −/** | |
| 99 | − * Sidebar/list helper. Reads `sourcesAtom(scopeId)` and merges any pending | |
| 100 | − * placeholder rows in, sorting the combined list by name so the placeholder | |
| 101 | − * lands in the same position the canonical row will occupy — no visual jump | |
| 102 | − * when the server confirms. | |
| 103 | − */ | |
| 104 | −export const useSourcesWithPending = (scopeId: ScopeId) => { | |
| 105 | − const result = useAtomValue(sourcesAtom(scopeId)); | |
| 106 | − const { pending } = usePendingResource<PendingSource>(PendingResource.sources); | |
| 107 | − return React.useMemo( | |
| 108 | − () => | |
| 109 | − AsyncResult.map( | |
| 110 | − result, | |
| 111 | − ( | |
| 112 | − sources: ReadonlyArray<{ | |
| 113 | − readonly id: string; | |
| 114 | − readonly name: string; | |
| 115 | − readonly kind: string; | |
| 116 | − readonly url?: string; | |
| 117 | − }>, | |
| 118 | − ) => { | |
| 119 | − const merged = mergePending( | |
| 120 | − pending, | |
| 121 | − sources, | |
| 122 | − (s: { readonly id: string }) => s.id, | |
| 123 | − (p) => ({ | |
| 124 | − id: p.id, | |
| 125 | − name: p.value.name, | |
| 126 | − kind: p.value.kind, | |
| 127 | − url: p.value.url, | |
| 128 | − // The placeholder cannot be removed/refreshed/edited until the | |
| 129 | − // server confirms it, so disable those affordances. | |
| 130 | − canRemove: false, | |
| 131 | − canRefresh: false, | |
| 132 | − canEdit: false, | |
| 133 | − }), | |
| 134 | − ); | |
| 135 | − return [...merged].sort((a, b) => a.name.localeCompare(b.name)); | |
| 136 | − }, | |
| 137 | − ), | |
| 138 | − [result, pending], | |
| 139 | − ); | |
| 140 | −}; | |
| 141 | − | |
| 142 | −/** | |
| 143 | − * Hook for an add form. Returns helpers to push and clear a pending source | |
| 144 | − * placeholder. On submit: | |
| 145 | − * const placeholder = beginAdd({ id: namespace, name, kind }); | |
| 146 | − * try { await doAdd(...); } finally { placeholder.done(); } | |
| 147 | − */ | |
| 148 | −export const usePendingSources = () => { | |
| 149 | − const { add, remove } = usePendingResource<PendingSource>(PendingResource.sources); | |
| 150 | − return React.useMemo( | |
| 151 | − () => ({ | |
| 152 | − beginAdd: (entry: { id: string } & PendingSource) => { | |
| 153 | − add({ id: entry.id, value: { name: entry.name, kind: entry.kind, url: entry.url } }); | |
| 154 | − return { done: () => remove(entry.id) }; | |
| 155 | − }, | |
| 156 | − }), | |
| 157 | − [add, remove], | |
| 158 | − ); | |
| 159 | −}; | |
| 160 | − | |
| 161 | −// --------------------------------------------------------------------------- | |
| 162 | −// Connections — optimistic removals. | |
| 163 | −// --------------------------------------------------------------------------- | |
| 164 | − | |
| 165 | −interface PendingConnectionRemoval { | |
| 166 | − readonly id: string; | |
| 167 | −} | |
| 168 | − | |
| 169 | −export const useConnectionsWithPendingRemovals = (scopeId: ScopeId) => { | |
| 170 | − const result = useAtomValue(connectionsAtom(scopeId)); | |
| 171 | − const { pending, remove } = usePendingResource<PendingConnectionRemoval>( | |
| 172 | − PendingResource.connectionRemovals, | |
| 173 | − ); | |
| 174 | − | |
| 175 | − React.useEffect(() => { | |
| 176 | − if (!AsyncResult.isSuccess(result) || pending.length === 0) return; | |
| 177 | − | |
| 178 | − const serverIds = new Set( | |
| 179 | − result.value.map((connection: { readonly id: string }) => connection.id as string), | |
| 180 | − ); | |
| 181 | − for (const entry of pending) { | |
| 182 | − if (!serverIds.has(entry.id)) remove(entry.id); | |
| 183 | − } | |
| 184 | − }, [result, pending, remove]); | |
| 185 | − | |
| 186 | − return React.useMemo( | |
| 187 | − () => | |
| 188 | − AsyncResult.map(result, (connections) => { | |
| 189 | − if (pending.length === 0) return connections; | |
| 190 | − const hiddenIds = new Set(pending.map((entry) => entry.id)); | |
| 191 | − return connections.filter( | |
| 192 | − (connection: { readonly id: string }) => !hiddenIds.has(connection.id as string), | |
| 193 | − ); | |
| 194 | − }), | |
| 195 | − [result, pending], | |
| 196 | − ); | |
| 197 | −}; | |
| 198 | − | |
| 199 | −export const usePendingConnectionRemovals = () => { | |
| 200 | − const { add, remove } = usePendingResource<PendingConnectionRemoval>( | |
| 201 | − PendingResource.connectionRemovals, | |
| 202 | − ); | |
| 203 | − | |
| 204 | − return React.useMemo( | |
| 205 | − () => ({ | |
| 206 | − beginRemove: (id: string) => { | |
| 207 | − add({ id, value: { id } }); | |
| 208 | − return { undo: () => remove(id) }; | |
| 209 | − }, | |
| 210 | − }), | |
| 211 | − [add, remove], | |
| 212 | − ); | |
| 213 | −}; | |
| @@ -4,7 +4,7 @@ import { useAtomValue } from "@effect/atom-react"; · 3 unmodified lines | ||
| 4 | 4 | import * as AsyncResult from "effect/unstable/reactivity/AsyncResult"; |
| 5 | 5 | import { PlusIcon } from "lucide-react"; |
| 6 | 6 | import { SourceFavicon } from "./source-favicon"; |
| 7 | −import { sourcesAtom } from "../api/atoms"; | |
| 7 | +import { sourcesOptimisticAtom } from "../api/atoms"; | |
| 8 | 8 | import { useScope } from "../hooks/use-scope"; |
| 9 | 9 | import { useSourcePlugins } from "@executor-js/sdk/client"; |
| 10 | 10 | import { |
| @@ -32,7 +32,7 @@ export function CommandPalette() { · 21 unmodified lines | ||
| 32 | 32 | const [open, setOpen] = useState(false); |
| 33 | 33 | const navigate = useNavigate(); |
| 34 | 34 | const scopeId = useScope(); |
| 35 | − const sourcesResult = useAtomValue(sourcesAtom(scopeId)); | |
| 35 | + const sourcesResult = useAtomValue(sourcesOptimisticAtom(scopeId)); | |
| 36 | 36 | |
| 37 | 37 | // Toggle with ⌘K / Ctrl+K |
| 38 | 38 | useEffect(() => { |
| @@ -6,8 +6,11 @@ import * as Option from "effect/Option"; · 5 unmodified lines | ||
| 6 | 6 | import { ConnectionId, ConnectionInUseError, type ScopeId } from "@executor-js/sdk"; |
| 7 | 7 | import { toast } from "sonner"; |
| 8 | 8 | |
| 9 | −import { connectionUsagesAtom, removeConnection } from "../api/atoms"; | |
| 10 | −import { useConnectionsWithPendingRemovals, usePendingConnectionRemovals } from "../api/optimistic"; | |
| 9 | +import { | |
| 10 | + connectionUsagesAtom, | |
| 11 | + connectionsOptimisticAtom, | |
| 12 | + removeConnectionOptimistic, | |
| 13 | +} from "../api/atoms"; | |
| 11 | 14 | import { connectionWriteKeys } from "../api/reactivity-keys"; |
| 12 | 15 | import { useScope, useScopeStack } from "../hooks/use-scope"; |
| 13 | 16 | import { Badge } from "../components/badge"; |
| @@ -59,13 +62,8 @@ const connectionScopeLabel = ( · 45 unmodified lines | ||
| 59 | 62 | // don't get a stray "Used by 0" line before any source binds to them. |
| 60 | 63 | // --------------------------------------------------------------------------- |
| 61 | 64 | |
| 62 | −function ConnectionUsageFooter(props: { | |
| 63 | − scopeId: ScopeId; | |
| 64 | − connectionId: ConnectionId; | |
| 65 | −}) { | |
| 66 | − const usages = useAtomValue( | |
| 67 | − connectionUsagesAtom(props.scopeId, props.connectionId), | |
| 68 | − ); | |
| 65 | +function ConnectionUsageFooter(props: { scopeId: ScopeId; connectionId: ConnectionId }) { | |
| 66 | + const usages = useAtomValue(connectionUsagesAtom(props.scopeId, props.connectionId)); | |
| 69 | 67 | return AsyncResult.match(usages, { |
| 70 | 68 | onInitial: () => null, |
| 71 | 69 | onFailure: () => null, |
| @@ -161,18 +159,15 @@ function ConnectionRow(props: { · 89 unmodified lines | ||
| 161 | 159 | export function ConnectionsPage() { |
| 162 | 160 | const scopeId = useScope(); |
| 163 | 161 | const scopeStack = useScopeStack(); |
| 164 | − const connections = useConnectionsWithPendingRemovals(scopeId); | |
| 165 | − const { beginRemove } = usePendingConnectionRemovals(); | |
| 166 | − const doRemove = useAtomSet(removeConnection, { mode: "promiseExit" }); | |
| 162 | + const connections = useAtomValue(connectionsOptimisticAtom(scopeId)); | |
| 163 | + const doRemove = useAtomSet(removeConnectionOptimistic(scopeId), { mode: "promiseExit" }); | |
| 167 | 164 | |
| 168 | 165 | const handleRemove = async (connectionId: string) => { |
| 169 | − const pending = beginRemove(connectionId); | |
| 170 | 166 | const exit = await doRemove({ |
| 171 | 167 | params: { scopeId, connectionId: ConnectionId.make(connectionId) }, |
| 172 | 168 | reactivityKeys: connectionWriteKeys, |
| 173 | 169 | }); |
| 174 | 170 | if (Exit.isFailure(exit)) { |
| 175 | − pending.undo(); | |
| 176 | 171 | const error = Exit.findErrorOption(exit); |
| 177 | 172 | if (Option.isSome(error) && error.value instanceof ConnectionInUseError) { |
| 178 | 173 | const count = error.value.usageCount; |
| @@ -6,9 +6,9 @@ import { effectivePolicyFromSorted } from "@executor-js/sdk"; · 5 unmodified lines | ||
| 6 | 6 | import { |
| 7 | 7 | policiesOptimisticAtom, |
| 8 | 8 | sourceToolsAtom, |
| 9 | − sourcesAtom, | |
| 9 | + sourcesOptimisticAtom, | |
| 10 | 10 | sourceAtom, |
| 11 | − removeSource, | |
| 11 | + removeSourceOptimistic, | |
| 12 | 12 | refreshSource, |
| 13 | 13 | } from "../api/atoms"; |
| 14 | 14 | import { sourceWriteKeys } from "../api/reactivity-keys"; |
| @@ -29,9 +29,9 @@ export function SourceDetailPage(props: { namespace: string }) { · 14 unmodified lines | ||
| 29 | 29 | const source = useAtomValue(sourceAtom(namespace, scopeId)); |
| 30 | 30 | const tools = useAtomValue(sourceToolsAtom(namespace, scopeId)); |
| 31 | 31 | const policies = useAtomValue(policiesOptimisticAtom(scopeId)); |
| 32 | − const refreshSources = useAtomRefresh(sourcesAtom(scopeId)); | |
| 32 | + const refreshSources = useAtomRefresh(sourcesOptimisticAtom(scopeId)); | |
| 33 | 33 | const refreshTools = useAtomRefresh(sourceToolsAtom(namespace, scopeId)); |
| 34 | − const doRemove = useAtomSet(removeSource, { mode: "promise" }); | |
| 34 | + const doRemove = useAtomSet(removeSourceOptimistic(scopeId), { mode: "promise" }); | |
| 35 | 35 | const doRefresh = useAtomSet(refreshSource, { mode: "promise" }); |
| 36 | 36 | const policyActions = usePolicyActions(scopeId); |
| 37 | 37 | const navigate = useNavigate(); |
| @@ -1,16 +1,11 @@ | ||
| 1 | 1 | import { Suspense, useCallback, useMemo, useState } from "react"; |
| 2 | 2 | import { Link, useNavigate } from "@tanstack/react-router"; |
| 3 | −import { useAtomSet } from "@effect/atom-react"; | |
| 3 | +import { useAtomSet, useAtomValue } from "@effect/atom-react"; | |
| 4 | 4 | import * as AsyncResult from "effect/unstable/reactivity/AsyncResult"; |
| 5 | 5 | import { PlusIcon } from "lucide-react"; |
| 6 | 6 | import type { SourceDetectionResult } from "@executor-js/sdk"; |
| 7 | −import { | |
| 8 | − useSourcePlugins, | |
| 9 | − type SourcePlugin, | |
| 10 | − type SourcePreset, | |
| 11 | −} from "@executor-js/sdk/client"; | |
| 12 | −import { detectSource } from "../api/atoms"; | |
| 13 | −import { useSourcesWithPending } from "../api/optimistic"; | |
| 7 | +import { useSourcePlugins, type SourcePlugin, type SourcePreset } from "@executor-js/sdk/client"; | |
| 8 | +import { detectSource, sourcesOptimisticAtom } from "../api/atoms"; | |
| 14 | 9 | import { useScope } from "../hooks/use-scope"; |
| 15 | 10 | import { McpInstallCard } from "../components/mcp-install-card"; |
| 16 | 11 | import { Button } from "../components/button"; |
| @@ -60,7 +55,7 @@ const bestDetection = ( · 43 unmodified lines | ||
| 60 | 55 | |
| 61 | 56 | export function SourcesPage() { |
| 62 | 57 | const scopeId = useScope(); |
| 63 | − const sources = useSourcesWithPending(scopeId); | |
| 58 | + const sources = useAtomValue(sourcesOptimisticAtom(scopeId)); | |
| 64 | 59 | const [connectOpen, setConnectOpen] = useState(false); |
| 65 | 60 | |
| 66 | 61 | return ( |
| @@ -228,10 +223,7 @@ function ConnectDialog(props: { open: boolean; onOpenChange: (open: boolean) => · 161 unmodified lines | ||
| 228 | 223 | className="flex-1" |
| 229 | 224 | /> |
| 230 | 225 | {isUrl && ( |
| 231 | − <Button | |
| 232 | − onClick={() => void handleDetect()} | |
| 233 | − disabled={detecting || !query.trim()} | |
| 234 | − > | |
| 226 | + <Button onClick={() => void handleDetect()} disabled={detecting || !query.trim()}> | |
| 235 | 227 | {detecting ? "Detecting..." : "Detect"} |
| 236 | 228 | </Button> |
| 237 | 229 | )} |
| @@ -256,11 +248,7 @@ function ConnectDialog(props: { open: boolean; onOpenChange: (open: boolean) => · 18 unmodified lines | ||
| 256 | 248 | </div> |
| 257 | 249 | </div> |
| 258 | 250 | |
| 259 | − <PresetGrid | |
| 260 | − plugins={sourcePlugins} | |
| 261 | − onPick={closeAndReset} | |
| 262 | − searchQuery={presetSearch} | |
| 263 | − /> | |
| 251 | + <PresetGrid plugins={sourcePlugins} onPick={closeAndReset} searchQuery={presetSearch} /> | |
| 264 | 252 | </div> |
| 265 | 253 | </DialogContent> |
| 266 | 254 | </Dialog> |
| @@ -324,8 +312,7 @@ function PresetGrid(props: { · 57 unmodified lines | ||
| 324 | 312 | const q = (props.searchQuery ?? "").trim().toLowerCase(); |
| 325 | 313 | if (q.length === 0) return allPresets; |
| 326 | 314 | return allPresets.filter(({ preset, pluginLabel }) => { |
| 327 | − const corpus = | |
| 328 | − `${preset.name} ${preset.summary ?? ""} ${pluginLabel}`.toLowerCase(); | |
| 315 | + const corpus = `${preset.name} ${preset.summary ?? ""} ${pluginLabel}`.toLowerCase(); | |
| 329 | 316 | return corpus.includes(q); |
| 330 | 317 | }); |
| 331 | 318 | }, [allPresets, props.searchQuery]); |
| @@ -61,17 +61,13 @@ paths = [ · 60 unmodified lines | ||
| 61 | 61 | [[skills]] |
| 62 | 62 | name = "wrdn-gha-workflows" |
| 63 | 63 | remote = "getsentry/warden-skills" |
| 64 | −paths = [ | |
| 65 | − ".github/workflows/**/*.yml", | |
| 66 | − ".github/workflows/**/*.yaml", | |
| 67 | −] | |
| 64 | +paths = [".github/workflows/**/*.yml", ".github/workflows/**/*.yaml"] | |
| 68 | 65 | |
| 69 | 66 | # Local skill — no `remote =`, resolved from `.agents/skills/<name>/SKILL.md`. |
| 70 | 67 | [[skills]] |
| 71 | 68 | name = "wrdn-effect-atom-optimistic" |
| 72 | 69 | paths = [ |
| 73 | 70 | "packages/react/src/api/atoms.tsx", |
| 74 | − "packages/react/src/api/optimistic.tsx", | |
| 75 | 71 | "packages/react/src/pages/**/*.tsx", |
| 76 | 72 | "packages/react/src/components/**/*.tsx", |
| 77 | 73 | ] |