Thread cacheMode through managed list refresh via SDK cache-aware verbs (#1721) (#1723)
Some checks failed
Run install, format, lint, build, and test on every push / build (push) Has been cancelled
Run install, format, lint, build, and test on every push / publish (push) Has been cancelled
Run install, format, lint, build, and test on every push / publish-github-container-registry (push) Has been cancelled
Some checks failed
Run install, format, lint, build, and test on every push / build (push) Has been cancelled
Run install, format, lint, build, and test on every push / publish (push) Has been cancelled
Run install, format, lint, build, and test on every push / publish-github-container-registry (push) Has been cancelled
* Thread cacheMode through managed list refresh via SDK cache-aware verbs (#1721) Manual/auto refresh of tools/resources/prompts now forces a cache-bypassing round trip on modern servers, delivering the raw-request cacheMode control deferred from #1628. The InspectorClient list/read path uses the SDK's single-page `client.request` verbs (for pagination debugging), which never consult the SDK response cache — so `cacheMode` was inert there. This adds a separate aggregate path that routes through the SDK's cache-aware high-level verbs, where `cacheMode` is honored: - InspectorClient: new `listAllTools/Prompts/Resources/ResourceTemplates( { cacheMode, metadata })` that call `client.listTools()` etc. (all-page aggregate + SEP-2243 x-mcp-header exclusion + cache consult/write). A shared `getCacheableRequestOptions` / `aggregateListParams` back all four. - InspectorClientProtocol: the four `listAll*` methods added. - ManagedListState: delegates page walking to the SDK verb (config `fetchPage` loop → `fetchAll`); `refresh(metadata?, cacheMode?)` threads cacheMode. A `list_changed` auto-refresh bypasses the cache (`cacheMode: "refresh"`). - Managed hooks: user-initiated `refresh()` passes `cacheMode: "refresh"`, so the existing per-tab Refresh buttons become genuinely cache-bypassing — no App wiring change. Connect-time load stays default (`'use'`). The single-page `listTools(cursor)` primitive is unchanged; the paged hooks still surface per-page `nextCursor`. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XNdjEPKLG637X8YmhDiEk5 * Single-page list pagination: sidebar toggle + server setting (#1721) Delivers the deferred single-page fetch UI: Tools/Resources/Prompts can be loaded one page at a time instead of auto-aggregating every page — a defensive option for servers with very large lists. - New `singlePageLists` server setting (persisted, server-wide), plumbed through ServerConfig/InspectorServerSettings, serverList convert/default, the node + remote settings paths, and the Server Settings form ("Fetch Lists One Page at a Time"). - New `ListPaginationControls` element (a "Single page" switch + "Load next page" button + "N pages loaded" status) rendered in each list sidebar; the toggle edits the setting live (optimistic) and persists it. - The paged state stores (PagedTools/Prompts/ResourcesState) now own loading: they auto-load page 1 on connect in single-page mode and track nextCursor + page count as observable state; the managed stores skip their all-page walk in single-page mode (so nothing is over-fetched) while still lighting the list-changed indicator. `usePaginatedList` selects the display source and pagination controls per mode — pure, no data-loading in React effects. - Refresh is mode-aware: reload page 1 in single-page mode, refetch the whole aggregate otherwise. Sidebars widened 340→360 so the controls don't crowd list entries. - Test server: `test-servers/configs/pagination-http.json` (12 tools/resources/ prompts, page size 4 → 3 pages each) exercises the flow end to end. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XNdjEPKLG637X8YmhDiEk5 * Add pr-screenshots proving single-page pagination (#1721) Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XNdjEPKLG637X8YmhDiEk5 * Address @claude review: template load, double-click guard, auth recovery (#1721) - Fix: resource templates never loaded on connect in single-page mode. The connect-time all-page skip now applies only to lists with a paged counterpart (new `deferInSinglePage` flag on ManagedListConfig; false for resource templates), so templates still aggregate on connect regardless of the setting. - Guard `PagedTools/Prompts/ResourcesState.loadPage` against a concurrent load (fast double-click on "Load next page") so the same page can't be appended twice; the in-flight load owns the cursor and the second call is a no-op. - Thread ambient auth recovery through the single-page refresh, Load-next-page, and mode-switch loads (they previously bypassed it) — usePaginatedList's onRefresh/onLoadMore now return their promises so App can wrap them. - Drop the misleading "aggregated list" wording from the paged-store docs. Tests added for each; npm run coverage green. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XNdjEPKLG637X8YmhDiEk5 * Review round 2: revert optimistic toggle when persisting the setting fails (#1721) Non-blocking review follow-up. If updateServerSettings rejects, the optimistic `singlePageListsOverride` is now cleared and the live client setting rolled back (the effect only clears the override when the persisted value changes, which doesn't happen on failure), so the UI and client reflect what's on disk rather than the failed edit. Added an App test for the revert path. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XNdjEPKLG637X8YmhDiEk5 * Fix single-page Refresh not clearing list-changed indicator + UI polish (#1721) Round-3 review fix (blocking): in single-page mode a `list_changed` lights the list-changed indicator, but the single-page Refresh reloads page 1 of the paged store and bypassed `useManaged*.refresh()`, so the indicator was never cleared. Expose `clearListChanged` from useManagedTools/Prompts/Resources and call it in the single-page branch of onRefreshTools/Prompts/Resources. Tests added. UI polish (user feedback on the sidebar control): - Rename the switch label "Single page" → "Paginated". - Put "Load next page" on the same row as the switch, space-between (switch fully left, button fully right). - Move the "N pages loaded" status to its own line below the row, centered. - Hide the whole control once the list is known to be a single page (single-page mode, page 1 loaded, no nextCursor) — nothing to paginate. pr-screenshots refreshed to the new layout. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XNdjEPKLG637X8YmhDiEk5 * Rename the singlePageLists setting to paginatedLists for clarity (#1721) `singlePageLists` read backwards from the "Paginated" switch label (it sounds like paginated=false). Rename the server setting to `paginatedLists` with the same value meaning — true = paginated/one-page-at-a-time, false = aggregate-all — and follow through on the related identifiers for consistency: - Setting field `paginatedLists` across ServerConfig / InspectorServerSettings, serverList convert/default, node + remote settings paths, and the form/modal callbacks (onPaginatedListsChange). - `usePaginatedList` / `ListPaginationControls` prop `singlePage` → `paginated`, `onSinglePageChange` → `onPaginatedChange`. - `ManagedListConfig.deferInSinglePage` → `deferWhenPaginated`. - App state (paginatedListsOverride, onTogglePaginatedLists, …) and all tests/fixtures + mode-referring comments. "single-page" wording that denotes the SDK's one-page `client.request` verb (inspectorClient) is intentionally left as-is. Purely a rename — no behavior change; unit + integration + cli + tui + coverage all green. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XNdjEPKLG637X8YmhDiEk5 * Format App.test.tsx (prettier) after the paginatedLists rename (#1721) Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XNdjEPKLG637X8YmhDiEk5 --------- Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
d552564966
commit
b3b04c6939
1 changed files with 2494 additions and 247 deletions
|
|
@ -52,6 +52,9 @@ import {
|
|||
import { ManagedToolsState } from "@inspector/core/mcp/state/managedToolsState.js";
|
||||
import { ManagedPromptsState } from "@inspector/core/mcp/state/managedPromptsState.js";
|
||||
import { ManagedResourcesState } from "@inspector/core/mcp/state/managedResourcesState.js";
|
||||
import { PagedToolsState } from "@inspector/core/mcp/state/pagedToolsState.js";
|
||||
import { PagedPromptsState } from "@inspector/core/mcp/state/pagedPromptsState.js";
|
||||
import { PagedResourcesState } from "@inspector/core/mcp/state/pagedResourcesState.js";
|
||||
import { ManagedResourceTemplatesState } from "@inspector/core/mcp/state/managedResourceTemplatesState.js";
|
||||
import { ManagedRequestorTasksState } from "@inspector/core/mcp/state/managedRequestorTasksState.js";
|
||||
import { ResourceSubscriptionsState } from "@inspector/core/mcp/state/resourceSubscriptionsState.js";
|
||||
|
|
@ -91,6 +94,11 @@ import { getWebRemoteOAuthStorage } from "./lib/remoteOAuthStorage";
|
|||
import { useManagedTools } from "@inspector/core/react/useManagedTools.js";
|
||||
import { useManagedPrompts } from "@inspector/core/react/useManagedPrompts.js";
|
||||
import { useManagedResources } from "@inspector/core/react/useManagedResources.js";
|
||||
import { usePagedTools } from "@inspector/core/react/usePagedTools.js";
|
||||
import { usePagedPrompts } from "@inspector/core/react/usePagedPrompts.js";
|
||||
import { usePagedResources } from "@inspector/core/react/usePagedResources.js";
|
||||
import { usePaginatedList } from "./hooks/usePaginatedList";
|
||||
import type { ListPaginationControlsProps } from "./components/elements/ListPaginationControls/ListPaginationControls";
|
||||
import { useManagedResourceTemplates } from "@inspector/core/react/useManagedResourceTemplates.js";
|
||||
import { useManagedRequestorTasks } from "@inspector/core/react/useManagedRequestorTasks.js";
|
||||
import { useResourceSubscriptions } from "@inspector/core/react/useResourceSubscriptions.js";
|
||||
|
|
@ -361,6 +369,7 @@ const EMPTY_SETTINGS: InspectorServerSettings = {
|
|||
requestTimeout: 0,
|
||||
taskTtl: DEFAULT_TASK_TTL_MS,
|
||||
autoRefreshOnListChanged: false,
|
||||
paginatedLists: false,
|
||||
maxFetchRequests: DEFAULT_MAX_FETCH_REQUESTS,
|
||||
roots: [],
|
||||
};
|
||||
|
|
@ -745,6 +754,14 @@ function App() {
|
|||
useState<ManagedPromptsState | null>(null);
|
||||
const [managedResourcesState, setManagedResourcesState] =
|
||||
useState<ManagedResourcesState | null>(null);
|
||||
// Paged (paginated) counterparts, used when the `paginatedLists` setting
|
||||
// is on (#1721). Created/destroyed alongside the managed states.
|
||||
const [pagedToolsState, setPagedToolsState] =
|
||||
useState<PagedToolsState | null>(null);
|
||||
const [pagedPromptsState, setPagedPromptsState] =
|
||||
useState<PagedPromptsState | null>(null);
|
||||
const [pagedResourcesState, setPagedResourcesState] =
|
||||
useState<PagedResourcesState | null>(null);
|
||||
const [managedResourceTemplatesState, setManagedResourceTemplatesState] =
|
||||
useState<ManagedResourceTemplatesState | null>(null);
|
||||
const [managedRequestorTasksState, setManagedRequestorTasksState] =
|
||||
|
|
@ -912,22 +929,93 @@ function App() {
|
|||
lastError,
|
||||
} = useInspectorClient(inspectorClient);
|
||||
const {
|
||||
tools,
|
||||
tools: managedTools,
|
||||
listChanged: toolsListChanged,
|
||||
refresh: refreshTools,
|
||||
clearListChanged: clearToolsListChanged,
|
||||
} = useManagedTools(inspectorClient, managedToolsState);
|
||||
const {
|
||||
prompts,
|
||||
prompts: managedPrompts,
|
||||
listChanged: promptsListChanged,
|
||||
refresh: refreshPrompts,
|
||||
clearListChanged: clearPromptsListChanged,
|
||||
} = useManagedPrompts(inspectorClient, managedPromptsState);
|
||||
const {
|
||||
resources,
|
||||
resources: managedResources,
|
||||
listChanged: resourcesListChanged,
|
||||
refresh: refreshResources,
|
||||
clearListChanged: clearResourcesListChanged,
|
||||
} = useManagedResources(inspectorClient, managedResourcesState);
|
||||
const { resourceTemplates, refresh: refreshResourceTemplates } =
|
||||
useManagedResourceTemplates(inspectorClient, managedResourceTemplatesState);
|
||||
// Paged (paginated) list sources. When `paginatedLists` is on the managed
|
||||
// states skip their all-page walk and these drive the sidebar instead (#1721).
|
||||
const {
|
||||
tools: pagedTools,
|
||||
nextCursor: pagedToolsCursor,
|
||||
pageCount: pagedToolsPageCount,
|
||||
loadPage: loadToolsPage,
|
||||
} = usePagedTools(inspectorClient, pagedToolsState);
|
||||
const {
|
||||
prompts: pagedPrompts,
|
||||
nextCursor: pagedPromptsCursor,
|
||||
pageCount: pagedPromptsPageCount,
|
||||
loadPage: loadPromptsPage,
|
||||
} = usePagedPrompts(inspectorClient, pagedPromptsState);
|
||||
const {
|
||||
resources: pagedResources,
|
||||
nextCursor: pagedResourcesCursor,
|
||||
pageCount: pagedResourcesPageCount,
|
||||
loadPage: loadResourcesPage,
|
||||
} = usePagedResources(inspectorClient, pagedResourcesState);
|
||||
// The active server's persisted paginated setting drives the display mode.
|
||||
// The sidebar toggle edits it (optimistically, below) and persists it.
|
||||
const persistedPaginatedLists =
|
||||
servers.find((s) => s.id === activeServerId)?.settings?.paginatedLists ??
|
||||
false;
|
||||
const [paginatedListsOverride, setPaginatedListsOverride] = useState<
|
||||
boolean | null
|
||||
>(null);
|
||||
// Drop the optimistic override once the persisted value catches up (or the
|
||||
// active server changes), so the persisted setting is the resting source.
|
||||
useEffect(() => {
|
||||
setPaginatedListsOverride(null);
|
||||
}, [persistedPaginatedLists, activeServerId]);
|
||||
const paginatedLists = paginatedListsOverride ?? persistedPaginatedLists;
|
||||
const connected = connectionStatus === "connected";
|
||||
const toolsPagination = usePaginatedList({
|
||||
connected,
|
||||
paginated: paginatedLists,
|
||||
managedItems: managedTools,
|
||||
managedRefresh: refreshTools,
|
||||
pagedItems: pagedTools,
|
||||
pagedNextCursor: pagedToolsCursor,
|
||||
pagedPageCount: pagedToolsPageCount,
|
||||
loadPage: loadToolsPage,
|
||||
});
|
||||
const promptsPagination = usePaginatedList({
|
||||
connected,
|
||||
paginated: paginatedLists,
|
||||
managedItems: managedPrompts,
|
||||
managedRefresh: refreshPrompts,
|
||||
pagedItems: pagedPrompts,
|
||||
pagedNextCursor: pagedPromptsCursor,
|
||||
pagedPageCount: pagedPromptsPageCount,
|
||||
loadPage: loadPromptsPage,
|
||||
});
|
||||
const resourcesPagination = usePaginatedList({
|
||||
connected,
|
||||
paginated: paginatedLists,
|
||||
managedItems: managedResources,
|
||||
managedRefresh: refreshResources,
|
||||
pagedItems: pagedResources,
|
||||
pagedNextCursor: pagedResourcesCursor,
|
||||
pagedPageCount: pagedResourcesPageCount,
|
||||
loadPage: loadResourcesPage,
|
||||
});
|
||||
const tools = toolsPagination.items;
|
||||
const prompts = promptsPagination.items;
|
||||
const resources = resourcesPagination.items;
|
||||
const {
|
||||
tasks,
|
||||
refresh: refreshTasks,
|
||||
|
|
@ -2067,6 +2155,9 @@ function App() {
|
|||
managedToolsState?.destroy();
|
||||
managedPromptsState?.destroy();
|
||||
managedResourcesState?.destroy();
|
||||
pagedToolsState?.destroy();
|
||||
pagedPromptsState?.destroy();
|
||||
pagedResourcesState?.destroy();
|
||||
managedResourceTemplatesState?.destroy();
|
||||
managedRequestorTasksState?.destroy();
|
||||
resourceSubscriptionsState?.destroy();
|
||||
|
|
@ -2166,6 +2257,9 @@ function App() {
|
|||
|
||||
setInspectorClient(client);
|
||||
setManagedToolsState(new ManagedToolsState(client));
|
||||
setPagedToolsState(new PagedToolsState(client));
|
||||
setPagedPromptsState(new PagedPromptsState(client));
|
||||
setPagedResourcesState(new PagedResourcesState(client));
|
||||
setManagedPromptsState(new ManagedPromptsState(client));
|
||||
const nextResourcesState = new ManagedResourcesState(client);
|
||||
setManagedResourcesState(nextResourcesState);
|
||||
|
|
@ -2204,6 +2298,9 @@ function App() {
|
|||
managedToolsState,
|
||||
managedPromptsState,
|
||||
managedResourcesState,
|
||||
pagedToolsState,
|
||||
pagedPromptsState,
|
||||
pagedResourcesState,
|
||||
managedResourceTemplatesState,
|
||||
managedRequestorTasksState,
|
||||
resourceSubscriptionsState,
|
||||
|
|
@ -3146,18 +3243,189 @@ function App() {
|
|||
[inspectorClient, runWithCommandAuthRecovery],
|
||||
);
|
||||
|
||||
// Refresh acts per pagination mode: in paginated mode reload page 1 (the
|
||||
// paged state); in all-pages mode re-fetch the whole aggregate with auth
|
||||
// recovery (the pre-existing path). See usePaginatedList / #1721.
|
||||
const onRefreshTools = useCallback(() => {
|
||||
void runWithCommandAuthRecovery(() => refreshTools(), "ambient");
|
||||
}, [refreshTools, runWithCommandAuthRecovery]);
|
||||
if (paginatedLists) {
|
||||
// Paginated refresh reloads page 1 of the paged store, bypassing the
|
||||
// managed hook's refresh — so acknowledge the list-changed indicator here
|
||||
// (the managed state lit it on `list_changed`; nothing else clears it in
|
||||
// paginated mode) (#1721).
|
||||
clearToolsListChanged();
|
||||
void runWithCommandAuthRecovery(
|
||||
() => toolsPagination.onRefresh(),
|
||||
"ambient",
|
||||
);
|
||||
} else {
|
||||
void runWithCommandAuthRecovery(() => refreshTools(), "ambient");
|
||||
}
|
||||
}, [
|
||||
paginatedLists,
|
||||
toolsPagination,
|
||||
refreshTools,
|
||||
clearToolsListChanged,
|
||||
runWithCommandAuthRecovery,
|
||||
]);
|
||||
const onRefreshPrompts = useCallback(() => {
|
||||
void runWithCommandAuthRecovery(() => refreshPrompts(), "ambient");
|
||||
}, [refreshPrompts, runWithCommandAuthRecovery]);
|
||||
if (paginatedLists) {
|
||||
clearPromptsListChanged();
|
||||
void runWithCommandAuthRecovery(
|
||||
() => promptsPagination.onRefresh(),
|
||||
"ambient",
|
||||
);
|
||||
} else {
|
||||
void runWithCommandAuthRecovery(() => refreshPrompts(), "ambient");
|
||||
}
|
||||
}, [
|
||||
paginatedLists,
|
||||
promptsPagination,
|
||||
refreshPrompts,
|
||||
clearPromptsListChanged,
|
||||
runWithCommandAuthRecovery,
|
||||
]);
|
||||
const onRefreshResources = useCallback(() => {
|
||||
void runWithCommandAuthRecovery(async () => {
|
||||
await refreshResources();
|
||||
await refreshResourceTemplates();
|
||||
}, "ambient");
|
||||
}, [refreshResources, refreshResourceTemplates, runWithCommandAuthRecovery]);
|
||||
if (paginatedLists) {
|
||||
clearResourcesListChanged();
|
||||
void runWithCommandAuthRecovery(
|
||||
() => resourcesPagination.onRefresh(),
|
||||
"ambient",
|
||||
);
|
||||
// Resource templates always use the managed (aggregate) path.
|
||||
void runWithCommandAuthRecovery(
|
||||
() => refreshResourceTemplates(),
|
||||
"ambient",
|
||||
);
|
||||
} else {
|
||||
void runWithCommandAuthRecovery(async () => {
|
||||
await refreshResources();
|
||||
await refreshResourceTemplates();
|
||||
}, "ambient");
|
||||
}
|
||||
}, [
|
||||
paginatedLists,
|
||||
resourcesPagination,
|
||||
refreshResources,
|
||||
refreshResourceTemplates,
|
||||
clearResourcesListChanged,
|
||||
runWithCommandAuthRecovery,
|
||||
]);
|
||||
// The per-list sidebar toggle edits the server-wide `paginatedLists` setting:
|
||||
// optimistic override for an instant flip, live push so the managed state's
|
||||
// gating reads it now, and a persisted PUT so it survives reconnects (#1721).
|
||||
const onTogglePaginatedLists = useCallback(
|
||||
(value: boolean) => {
|
||||
setPaginatedListsOverride(value);
|
||||
const current = servers.find((s) => s.id === activeServerId);
|
||||
if (!current || activeServerId === undefined) return;
|
||||
const prevSettings = current.settings ?? EMPTY_SETTINGS;
|
||||
const next: InspectorServerSettings = {
|
||||
...prevSettings,
|
||||
paginatedLists: value,
|
||||
};
|
||||
inspectorClient?.setServerSettings(next);
|
||||
// Drive the load that the mode change implies (data-loading stays out of
|
||||
// React effects; the paged stores own only the connect-time load). To
|
||||
// paginated: pull page 1 into each paged store. To all-pages: refetch
|
||||
// each managed aggregate that was gated off. Only when connected.
|
||||
if (connected) {
|
||||
// Wrap in ambient auth recovery so a mid-session 401 triggers re-auth
|
||||
// rather than surfacing raw, matching the all-pages refresh path.
|
||||
if (value) {
|
||||
void runWithCommandAuthRecovery(
|
||||
() => loadToolsPage(undefined),
|
||||
"ambient",
|
||||
);
|
||||
void runWithCommandAuthRecovery(
|
||||
() => loadPromptsPage(undefined),
|
||||
"ambient",
|
||||
);
|
||||
void runWithCommandAuthRecovery(
|
||||
() => loadResourcesPage(undefined),
|
||||
"ambient",
|
||||
);
|
||||
} else {
|
||||
void runWithCommandAuthRecovery(() => refreshTools(), "ambient");
|
||||
void runWithCommandAuthRecovery(() => refreshPrompts(), "ambient");
|
||||
void runWithCommandAuthRecovery(() => refreshResources(), "ambient");
|
||||
}
|
||||
}
|
||||
void updateServerSettings(activeServerId, next).catch((err: unknown) => {
|
||||
// Persist failed: revert the optimistic override (the effect only
|
||||
// clears it when the persisted value changes, which won't happen here)
|
||||
// and roll the live client setting back, so the UI and client reflect
|
||||
// the value that's actually on disk rather than the failed edit (#1721).
|
||||
setPaginatedListsOverride(null);
|
||||
inspectorClient?.setServerSettings(prevSettings);
|
||||
notifications.show({
|
||||
title: "Failed to save pagination setting",
|
||||
message: err instanceof Error ? err.message : String(err),
|
||||
color: "red",
|
||||
});
|
||||
});
|
||||
},
|
||||
[
|
||||
servers,
|
||||
activeServerId,
|
||||
inspectorClient,
|
||||
updateServerSettings,
|
||||
connected,
|
||||
loadToolsPage,
|
||||
loadPromptsPage,
|
||||
loadResourcesPage,
|
||||
refreshTools,
|
||||
refreshPrompts,
|
||||
refreshResources,
|
||||
runWithCommandAuthRecovery,
|
||||
],
|
||||
);
|
||||
// Wrap Load-next-page in ambient auth recovery too, so a paginated
|
||||
// paginated fetch that hits a 401 recovers like the all-pages path (#1721).
|
||||
const onLoadMoreTools = useCallback(
|
||||
() =>
|
||||
void runWithCommandAuthRecovery(
|
||||
() => toolsPagination.onLoadMore(),
|
||||
"ambient",
|
||||
),
|
||||
[toolsPagination, runWithCommandAuthRecovery],
|
||||
);
|
||||
const onLoadMorePrompts = useCallback(
|
||||
() =>
|
||||
void runWithCommandAuthRecovery(
|
||||
() => promptsPagination.onLoadMore(),
|
||||
"ambient",
|
||||
),
|
||||
[promptsPagination, runWithCommandAuthRecovery],
|
||||
);
|
||||
const onLoadMoreResources = useCallback(
|
||||
() =>
|
||||
void runWithCommandAuthRecovery(
|
||||
() => resourcesPagination.onLoadMore(),
|
||||
"ambient",
|
||||
),
|
||||
[resourcesPagination, runWithCommandAuthRecovery],
|
||||
);
|
||||
const toolsPaginationControls: ListPaginationControlsProps = {
|
||||
paginated: toolsPagination.paginated,
|
||||
onPaginatedChange: onTogglePaginatedLists,
|
||||
canLoadMore: toolsPagination.canLoadMore,
|
||||
loadedPages: toolsPagination.loadedPages,
|
||||
onLoadMore: onLoadMoreTools,
|
||||
};
|
||||
const promptsPaginationControls: ListPaginationControlsProps = {
|
||||
paginated: promptsPagination.paginated,
|
||||
onPaginatedChange: onTogglePaginatedLists,
|
||||
canLoadMore: promptsPagination.canLoadMore,
|
||||
loadedPages: promptsPagination.loadedPages,
|
||||
onLoadMore: onLoadMorePrompts,
|
||||
};
|
||||
const resourcesPaginationControls: ListPaginationControlsProps = {
|
||||
paginated: resourcesPagination.paginated,
|
||||
onPaginatedChange: onTogglePaginatedLists,
|
||||
canLoadMore: resourcesPagination.canLoadMore,
|
||||
loadedPages: resourcesPagination.loadedPages,
|
||||
onLoadMore: onLoadMoreResources,
|
||||
};
|
||||
const onRefreshTasks = useCallback(() => {
|
||||
void runWithCommandAuthRecovery(() => refreshTasks(), "ambient")?.catch(
|
||||
(err: unknown) => {
|
||||
|
|
@ -3339,6 +3607,9 @@ function App() {
|
|||
managedToolsState?.destroy();
|
||||
managedPromptsState?.destroy();
|
||||
managedResourcesState?.destroy();
|
||||
pagedToolsState?.destroy();
|
||||
pagedPromptsState?.destroy();
|
||||
pagedResourcesState?.destroy();
|
||||
managedResourceTemplatesState?.destroy();
|
||||
managedRequestorTasksState?.destroy();
|
||||
resourceSubscriptionsState?.destroy();
|
||||
|
|
@ -3349,6 +3620,9 @@ function App() {
|
|||
setManagedToolsState(null);
|
||||
setManagedPromptsState(null);
|
||||
setManagedResourcesState(null);
|
||||
setPagedToolsState(null);
|
||||
setPagedPromptsState(null);
|
||||
setPagedResourcesState(null);
|
||||
setManagedResourceTemplatesState(null);
|
||||
setManagedRequestorTasksState(null);
|
||||
setResourceSubscriptionsState(null);
|
||||
|
|
@ -3366,6 +3640,9 @@ function App() {
|
|||
managedToolsState,
|
||||
managedPromptsState,
|
||||
managedResourcesState,
|
||||
pagedToolsState,
|
||||
pagedPromptsState,
|
||||
pagedResourcesState,
|
||||
managedResourceTemplatesState,
|
||||
managedRequestorTasksState,
|
||||
resourceSubscriptionsState,
|
||||
|
|
@ -3962,6 +4239,9 @@ function App() {
|
|||
onClearToolResult={onClearToolResult}
|
||||
onReadResourceContents={onReadResourceContents}
|
||||
onRefreshTools={onRefreshTools}
|
||||
toolsPagination={toolsPaginationControls}
|
||||
promptsPagination={promptsPaginationControls}
|
||||
resourcesPagination={resourcesPaginationControls}
|
||||
onPromptsUiChange={setPromptsUi}
|
||||
onGetPrompt={(name, args) => {
|
||||
void onGetPrompt(name, args);
|
||||
|
|
|
|||
Loading…
Reference in a new issue