@rozenite/tanstack-query-plugin 1.7.0 → 1.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +30 -0
- package/dist/devtools/assets/{CXEL7IU7-OLImOSaA.js → CXEL7IU7-DmbowaBr.js} +1 -1
- package/dist/devtools/assets/{tanstack-query-Dk7i2Fss.js → tanstack-query-DRBLkSCy.js} +10 -10
- package/dist/devtools/tanstack-query.html +1 -1
- package/dist/react-native/chunks/useTanStackQueryDevTools.require.cjs +1 -1
- package/dist/react-native/chunks/useTanStackQueryDevTools.require.js +324 -295
- package/dist/rozenite.json +1 -1
- package/dist/sdk/index.cjs +1 -0
- package/dist/sdk/index.d.ts +1939 -0
- package/dist/sdk/index.js +167 -0
- package/package.json +13 -6
- package/sdk.ts +55 -0
- package/src/react-native/agent/__tests__/tanstack-query-agent.test.ts +8 -2
- package/src/react-native/agent/tanstack-query-agent.ts +33 -235
- package/src/react-native/agent/useTanStackQueryAgentTools.ts +39 -65
- package/src/shared/agent-tools.ts +403 -0
- package/tsconfig.json +4 -1
- package/vite.config.ts +7 -0
|
@@ -2,29 +2,12 @@ import { useEffect, useMemo } from 'react';
|
|
|
2
2
|
import { QueryClient } from '@tanstack/react-query';
|
|
3
3
|
import { useRozenitePluginAgentTool } from '@rozenite/agent-bridge';
|
|
4
4
|
import {
|
|
5
|
-
clearMutationCacheTool,
|
|
6
|
-
clearQueryCacheTool,
|
|
7
5
|
createTanStackQueryAgentController,
|
|
8
|
-
getCacheSummaryTool,
|
|
9
|
-
getMutationDetailsTool,
|
|
10
|
-
getOnlineStatusTool,
|
|
11
|
-
getQueryDetailsTool,
|
|
12
|
-
invalidateQueryTool,
|
|
13
|
-
listMutationsTool,
|
|
14
|
-
listQueriesTool,
|
|
15
|
-
refetchQueryTool,
|
|
16
|
-
removeQueryTool,
|
|
17
|
-
resetQueryTool,
|
|
18
|
-
setQueryErrorTool,
|
|
19
|
-
setQueryLoadingTool,
|
|
20
|
-
TANSTACK_QUERY_AGENT_PLUGIN_ID,
|
|
21
|
-
type TanStackQueryAgentMutationIdInput,
|
|
22
|
-
type TanStackQueryAgentOnlineStatusInput,
|
|
23
|
-
type TanStackQueryAgentPaginationInput,
|
|
24
|
-
type TanStackQueryAgentQueryHashInput,
|
|
25
|
-
type TanStackQueryAgentQueryToggleInput,
|
|
26
|
-
setOnlineStatusTool,
|
|
27
6
|
} from './tanstack-query-agent';
|
|
7
|
+
import {
|
|
8
|
+
TANSTACK_QUERY_AGENT_PLUGIN_ID,
|
|
9
|
+
tanstackQueryToolDefinitions,
|
|
10
|
+
} from '../../shared/agent-tools';
|
|
28
11
|
|
|
29
12
|
export const useTanStackQueryAgentTools = (queryClient: QueryClient) => {
|
|
30
13
|
const controller = useMemo(
|
|
@@ -48,100 +31,91 @@ export const useTanStackQueryAgentTools = (queryClient: QueryClient) => {
|
|
|
48
31
|
|
|
49
32
|
useRozenitePluginAgentTool({
|
|
50
33
|
pluginId: TANSTACK_QUERY_AGENT_PLUGIN_ID,
|
|
51
|
-
tool:
|
|
34
|
+
tool: tanstackQueryToolDefinitions.getCacheSummary,
|
|
52
35
|
handler: () => controller.getCacheSummary(),
|
|
53
36
|
});
|
|
54
37
|
|
|
55
38
|
useRozenitePluginAgentTool({
|
|
56
39
|
pluginId: TANSTACK_QUERY_AGENT_PLUGIN_ID,
|
|
57
|
-
tool:
|
|
40
|
+
tool: tanstackQueryToolDefinitions.getOnlineStatus,
|
|
58
41
|
handler: () => controller.getOnlineStatus(),
|
|
59
42
|
});
|
|
60
43
|
|
|
61
|
-
useRozenitePluginAgentTool
|
|
44
|
+
useRozenitePluginAgentTool({
|
|
62
45
|
pluginId: TANSTACK_QUERY_AGENT_PLUGIN_ID,
|
|
63
|
-
tool:
|
|
64
|
-
handler: (input
|
|
65
|
-
controller.setOnlineStatus(input),
|
|
46
|
+
tool: tanstackQueryToolDefinitions.setOnlineStatus,
|
|
47
|
+
handler: (input) => controller.setOnlineStatus(input),
|
|
66
48
|
});
|
|
67
49
|
|
|
68
|
-
useRozenitePluginAgentTool
|
|
50
|
+
useRozenitePluginAgentTool({
|
|
69
51
|
pluginId: TANSTACK_QUERY_AGENT_PLUGIN_ID,
|
|
70
|
-
tool:
|
|
52
|
+
tool: tanstackQueryToolDefinitions.listQueries,
|
|
71
53
|
handler: (input = {}) => controller.listQueries(input),
|
|
72
54
|
});
|
|
73
55
|
|
|
74
|
-
useRozenitePluginAgentTool
|
|
56
|
+
useRozenitePluginAgentTool({
|
|
75
57
|
pluginId: TANSTACK_QUERY_AGENT_PLUGIN_ID,
|
|
76
|
-
tool:
|
|
77
|
-
handler: (input
|
|
78
|
-
controller.getQueryDetails(input),
|
|
58
|
+
tool: tanstackQueryToolDefinitions.getQueryDetails,
|
|
59
|
+
handler: (input) => controller.getQueryDetails(input),
|
|
79
60
|
});
|
|
80
61
|
|
|
81
|
-
useRozenitePluginAgentTool
|
|
62
|
+
useRozenitePluginAgentTool({
|
|
82
63
|
pluginId: TANSTACK_QUERY_AGENT_PLUGIN_ID,
|
|
83
|
-
tool:
|
|
84
|
-
handler: (input
|
|
85
|
-
controller.refetchQuery(input),
|
|
64
|
+
tool: tanstackQueryToolDefinitions.refetchQuery,
|
|
65
|
+
handler: (input) => controller.refetchQuery(input),
|
|
86
66
|
});
|
|
87
67
|
|
|
88
|
-
useRozenitePluginAgentTool
|
|
68
|
+
useRozenitePluginAgentTool({
|
|
89
69
|
pluginId: TANSTACK_QUERY_AGENT_PLUGIN_ID,
|
|
90
|
-
tool:
|
|
91
|
-
handler: (input
|
|
92
|
-
controller.setQueryLoading(input),
|
|
70
|
+
tool: tanstackQueryToolDefinitions.setQueryLoading,
|
|
71
|
+
handler: (input) => controller.setQueryLoading(input),
|
|
93
72
|
});
|
|
94
73
|
|
|
95
|
-
useRozenitePluginAgentTool
|
|
74
|
+
useRozenitePluginAgentTool({
|
|
96
75
|
pluginId: TANSTACK_QUERY_AGENT_PLUGIN_ID,
|
|
97
|
-
tool:
|
|
98
|
-
handler: (input
|
|
99
|
-
controller.setQueryError(input),
|
|
76
|
+
tool: tanstackQueryToolDefinitions.setQueryError,
|
|
77
|
+
handler: (input) => controller.setQueryError(input),
|
|
100
78
|
});
|
|
101
79
|
|
|
102
|
-
useRozenitePluginAgentTool
|
|
80
|
+
useRozenitePluginAgentTool({
|
|
103
81
|
pluginId: TANSTACK_QUERY_AGENT_PLUGIN_ID,
|
|
104
|
-
tool:
|
|
105
|
-
handler: (input
|
|
106
|
-
controller.invalidateQuery(input),
|
|
82
|
+
tool: tanstackQueryToolDefinitions.invalidateQuery,
|
|
83
|
+
handler: (input) => controller.invalidateQuery(input),
|
|
107
84
|
});
|
|
108
85
|
|
|
109
|
-
useRozenitePluginAgentTool
|
|
86
|
+
useRozenitePluginAgentTool({
|
|
110
87
|
pluginId: TANSTACK_QUERY_AGENT_PLUGIN_ID,
|
|
111
|
-
tool:
|
|
112
|
-
handler: (input
|
|
113
|
-
controller.resetQuery(input),
|
|
88
|
+
tool: tanstackQueryToolDefinitions.resetQuery,
|
|
89
|
+
handler: (input) => controller.resetQuery(input),
|
|
114
90
|
});
|
|
115
91
|
|
|
116
|
-
useRozenitePluginAgentTool
|
|
92
|
+
useRozenitePluginAgentTool({
|
|
117
93
|
pluginId: TANSTACK_QUERY_AGENT_PLUGIN_ID,
|
|
118
|
-
tool:
|
|
119
|
-
handler: (input
|
|
120
|
-
controller.removeQuery(input),
|
|
94
|
+
tool: tanstackQueryToolDefinitions.removeQuery,
|
|
95
|
+
handler: (input) => controller.removeQuery(input),
|
|
121
96
|
});
|
|
122
97
|
|
|
123
98
|
useRozenitePluginAgentTool({
|
|
124
99
|
pluginId: TANSTACK_QUERY_AGENT_PLUGIN_ID,
|
|
125
|
-
tool:
|
|
100
|
+
tool: tanstackQueryToolDefinitions.clearQueryCache,
|
|
126
101
|
handler: () => controller.clearQueryCache(),
|
|
127
102
|
});
|
|
128
103
|
|
|
129
|
-
useRozenitePluginAgentTool
|
|
104
|
+
useRozenitePluginAgentTool({
|
|
130
105
|
pluginId: TANSTACK_QUERY_AGENT_PLUGIN_ID,
|
|
131
|
-
tool:
|
|
106
|
+
tool: tanstackQueryToolDefinitions.listMutations,
|
|
132
107
|
handler: (input = {}) => controller.listMutations(input),
|
|
133
108
|
});
|
|
134
109
|
|
|
135
|
-
useRozenitePluginAgentTool
|
|
110
|
+
useRozenitePluginAgentTool({
|
|
136
111
|
pluginId: TANSTACK_QUERY_AGENT_PLUGIN_ID,
|
|
137
|
-
tool:
|
|
138
|
-
handler: (input
|
|
139
|
-
controller.getMutationDetails(input),
|
|
112
|
+
tool: tanstackQueryToolDefinitions.getMutationDetails,
|
|
113
|
+
handler: (input) => controller.getMutationDetails(input),
|
|
140
114
|
});
|
|
141
115
|
|
|
142
116
|
useRozenitePluginAgentTool({
|
|
143
117
|
pluginId: TANSTACK_QUERY_AGENT_PLUGIN_ID,
|
|
144
|
-
tool:
|
|
118
|
+
tool: tanstackQueryToolDefinitions.clearMutationCache,
|
|
145
119
|
handler: () => controller.clearMutationCache(),
|
|
146
120
|
});
|
|
147
121
|
};
|
|
@@ -0,0 +1,403 @@
|
|
|
1
|
+
import {
|
|
2
|
+
defineAgentToolContract,
|
|
3
|
+
type AgentToolContract,
|
|
4
|
+
type JSONSchema7,
|
|
5
|
+
} from '@rozenite/agent-shared';
|
|
6
|
+
import type { FetchStatus, MutationStatus, QueryStatus } from '@tanstack/react-query';
|
|
7
|
+
import type { applyTanStackQueryDevtoolsAction } from '../react-native/devtools-actions';
|
|
8
|
+
|
|
9
|
+
export const TANSTACK_QUERY_AGENT_PLUGIN_ID = '@rozenite/tanstack-query-plugin';
|
|
10
|
+
|
|
11
|
+
export type TanStackQueryAgentPaginationInput = {
|
|
12
|
+
limit?: number;
|
|
13
|
+
cursor?: string;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export type TanStackQueryAgentQueryHashInput = {
|
|
17
|
+
queryHash: string;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export type TanStackQueryAgentQueryToggleInput =
|
|
21
|
+
TanStackQueryAgentQueryHashInput & {
|
|
22
|
+
enabled: boolean;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export type TanStackQueryAgentMutationIdInput = {
|
|
26
|
+
mutationId: number;
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export type TanStackQueryAgentOnlineStatusInput = {
|
|
30
|
+
online: boolean;
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export type TanStackQueryAgentSafeValue =
|
|
34
|
+
| null
|
|
35
|
+
| boolean
|
|
36
|
+
| number
|
|
37
|
+
| string
|
|
38
|
+
| TanStackQueryAgentSafeValue[]
|
|
39
|
+
| { [key: string]: TanStackQueryAgentSafeValue };
|
|
40
|
+
|
|
41
|
+
export type TanStackQueryCacheSummary = {
|
|
42
|
+
online: boolean;
|
|
43
|
+
queries: {
|
|
44
|
+
total: number;
|
|
45
|
+
active: number;
|
|
46
|
+
fetching: number;
|
|
47
|
+
pending: number;
|
|
48
|
+
success: number;
|
|
49
|
+
error: number;
|
|
50
|
+
invalidated: number;
|
|
51
|
+
};
|
|
52
|
+
mutations: {
|
|
53
|
+
total: number;
|
|
54
|
+
pending: number;
|
|
55
|
+
success: number;
|
|
56
|
+
error: number;
|
|
57
|
+
paused: number;
|
|
58
|
+
};
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
export type TanStackQueryPage = {
|
|
62
|
+
limit: number;
|
|
63
|
+
hasMore: boolean;
|
|
64
|
+
nextCursor?: string;
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
export type TanStackQueryQuerySummary = {
|
|
68
|
+
queryHash: string;
|
|
69
|
+
queryKey: TanStackQueryAgentSafeValue;
|
|
70
|
+
status: QueryStatus;
|
|
71
|
+
fetchStatus: FetchStatus;
|
|
72
|
+
observersCount: number;
|
|
73
|
+
isInvalidated: boolean;
|
|
74
|
+
dataUpdatedAt: number;
|
|
75
|
+
errorUpdatedAt: number;
|
|
76
|
+
hasData: boolean;
|
|
77
|
+
hasError: boolean;
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
export type TanStackQueryObserverOptionsSummary = {
|
|
81
|
+
enabled: TanStackQueryAgentSafeValue;
|
|
82
|
+
networkMode: TanStackQueryAgentSafeValue;
|
|
83
|
+
staleTime: TanStackQueryAgentSafeValue;
|
|
84
|
+
gcTime: TanStackQueryAgentSafeValue;
|
|
85
|
+
retry: TanStackQueryAgentSafeValue;
|
|
86
|
+
retryDelay: TanStackQueryAgentSafeValue;
|
|
87
|
+
refetchInterval: TanStackQueryAgentSafeValue;
|
|
88
|
+
refetchOnMount: TanStackQueryAgentSafeValue;
|
|
89
|
+
refetchOnReconnect: TanStackQueryAgentSafeValue;
|
|
90
|
+
refetchOnWindowFocus: TanStackQueryAgentSafeValue;
|
|
91
|
+
subscribed: TanStackQueryAgentSafeValue;
|
|
92
|
+
meta: TanStackQueryAgentSafeValue;
|
|
93
|
+
hasQueryFn: boolean;
|
|
94
|
+
hasSelect: boolean;
|
|
95
|
+
hasPlaceholderData: boolean;
|
|
96
|
+
hasInitialData: boolean;
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
export type TanStackQueryListQueriesResult = TanStackQueryCacheSummary & {
|
|
100
|
+
total: number;
|
|
101
|
+
items: TanStackQueryQuerySummary[];
|
|
102
|
+
page: TanStackQueryPage;
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
export type TanStackQueryGetQueryDetailsResult = {
|
|
106
|
+
summary: TanStackQueryCacheSummary;
|
|
107
|
+
query: TanStackQueryQuerySummary & {
|
|
108
|
+
data: TanStackQueryAgentSafeValue;
|
|
109
|
+
error: TanStackQueryAgentSafeValue;
|
|
110
|
+
observers: Array<{
|
|
111
|
+
queryHash: string;
|
|
112
|
+
options: TanStackQueryObserverOptionsSummary | null;
|
|
113
|
+
}>;
|
|
114
|
+
};
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
export type TanStackQueryActionResult = Awaited<
|
|
118
|
+
ReturnType<typeof applyTanStackQueryDevtoolsAction>
|
|
119
|
+
>;
|
|
120
|
+
|
|
121
|
+
export type TanStackQueryMutationSummary = {
|
|
122
|
+
mutationId: number;
|
|
123
|
+
mutationKey: TanStackQueryAgentSafeValue;
|
|
124
|
+
status: MutationStatus;
|
|
125
|
+
isPaused: boolean;
|
|
126
|
+
submittedAt: number;
|
|
127
|
+
failureCount: number;
|
|
128
|
+
hasData: boolean;
|
|
129
|
+
hasError: boolean;
|
|
130
|
+
};
|
|
131
|
+
|
|
132
|
+
export type TanStackQueryMutationOptionsSummary = {
|
|
133
|
+
mutationKey: TanStackQueryAgentSafeValue;
|
|
134
|
+
networkMode: TanStackQueryAgentSafeValue;
|
|
135
|
+
gcTime: TanStackQueryAgentSafeValue;
|
|
136
|
+
retry: TanStackQueryAgentSafeValue;
|
|
137
|
+
retryDelay: TanStackQueryAgentSafeValue;
|
|
138
|
+
meta: TanStackQueryAgentSafeValue;
|
|
139
|
+
scope: TanStackQueryAgentSafeValue;
|
|
140
|
+
hasMutationFn: boolean;
|
|
141
|
+
hasOnMutate: boolean;
|
|
142
|
+
hasOnSuccess: boolean;
|
|
143
|
+
hasOnError: boolean;
|
|
144
|
+
hasOnSettled: boolean;
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
export type TanStackQueryListMutationsResult = TanStackQueryCacheSummary & {
|
|
148
|
+
total: number;
|
|
149
|
+
items: TanStackQueryMutationSummary[];
|
|
150
|
+
page: TanStackQueryPage;
|
|
151
|
+
};
|
|
152
|
+
|
|
153
|
+
export type TanStackQueryGetMutationDetailsResult = {
|
|
154
|
+
summary: TanStackQueryCacheSummary;
|
|
155
|
+
mutation: TanStackQueryMutationSummary & {
|
|
156
|
+
variables: TanStackQueryAgentSafeValue;
|
|
157
|
+
data: TanStackQueryAgentSafeValue;
|
|
158
|
+
error: TanStackQueryAgentSafeValue;
|
|
159
|
+
context: TanStackQueryAgentSafeValue;
|
|
160
|
+
failureReason: TanStackQueryAgentSafeValue;
|
|
161
|
+
options: TanStackQueryMutationOptionsSummary;
|
|
162
|
+
};
|
|
163
|
+
};
|
|
164
|
+
|
|
165
|
+
export type TanStackQueryGetCacheSummaryArgs = undefined;
|
|
166
|
+
export type TanStackQueryGetCacheSummaryResult = TanStackQueryCacheSummary;
|
|
167
|
+
export type TanStackQueryGetOnlineStatusArgs = undefined;
|
|
168
|
+
export type TanStackQueryGetOnlineStatusResult = { online: boolean };
|
|
169
|
+
export type TanStackQuerySetOnlineStatusArgs = TanStackQueryAgentOnlineStatusInput;
|
|
170
|
+
export type TanStackQuerySetOnlineStatusResult = { online: boolean };
|
|
171
|
+
export type TanStackQueryListQueriesArgs = TanStackQueryAgentPaginationInput;
|
|
172
|
+
export type TanStackQueryGetQueryDetailsArgs = TanStackQueryAgentQueryHashInput;
|
|
173
|
+
export type TanStackQueryRefetchQueryArgs = TanStackQueryAgentQueryHashInput;
|
|
174
|
+
export type TanStackQuerySetQueryLoadingArgs = TanStackQueryAgentQueryToggleInput;
|
|
175
|
+
export type TanStackQuerySetQueryErrorArgs = TanStackQueryAgentQueryToggleInput;
|
|
176
|
+
export type TanStackQueryInvalidateQueryArgs = TanStackQueryAgentQueryHashInput;
|
|
177
|
+
export type TanStackQueryResetQueryArgs = TanStackQueryAgentQueryHashInput;
|
|
178
|
+
export type TanStackQueryRemoveQueryArgs = TanStackQueryAgentQueryHashInput;
|
|
179
|
+
export type TanStackQueryClearQueryCacheArgs = undefined;
|
|
180
|
+
export type TanStackQueryClearQueryCacheResult = TanStackQueryActionResult;
|
|
181
|
+
export type TanStackQueryListMutationsArgs = TanStackQueryAgentPaginationInput;
|
|
182
|
+
export type TanStackQueryGetMutationDetailsArgs = TanStackQueryAgentMutationIdInput;
|
|
183
|
+
export type TanStackQueryClearMutationCacheArgs = undefined;
|
|
184
|
+
export type TanStackQueryClearMutationCacheResult = TanStackQueryActionResult;
|
|
185
|
+
|
|
186
|
+
const queryActionProperties = {
|
|
187
|
+
queryHash: {
|
|
188
|
+
type: 'string',
|
|
189
|
+
description: 'TanStack Query queryHash identifying the query.',
|
|
190
|
+
},
|
|
191
|
+
} satisfies Record<string, JSONSchema7>;
|
|
192
|
+
|
|
193
|
+
const mutationActionProperties = {
|
|
194
|
+
mutationId: {
|
|
195
|
+
type: 'number',
|
|
196
|
+
description: 'TanStack Query mutationId identifying the mutation.',
|
|
197
|
+
},
|
|
198
|
+
} satisfies Record<string, JSONSchema7>;
|
|
199
|
+
|
|
200
|
+
const paginationProperties = {
|
|
201
|
+
limit: {
|
|
202
|
+
type: 'number',
|
|
203
|
+
description: 'Maximum number of items to return. Defaults to 20. Maximum 100.',
|
|
204
|
+
},
|
|
205
|
+
cursor: {
|
|
206
|
+
type: 'string',
|
|
207
|
+
description: 'Opaque pagination cursor from a previous list call.',
|
|
208
|
+
},
|
|
209
|
+
} satisfies Record<string, JSONSchema7>;
|
|
210
|
+
|
|
211
|
+
const emptyInputSchema: JSONSchema7 = {
|
|
212
|
+
type: 'object',
|
|
213
|
+
properties: {},
|
|
214
|
+
};
|
|
215
|
+
|
|
216
|
+
export const tanstackQueryToolDefinitions = {
|
|
217
|
+
getCacheSummary: defineAgentToolContract<
|
|
218
|
+
TanStackQueryGetCacheSummaryArgs,
|
|
219
|
+
TanStackQueryGetCacheSummaryResult
|
|
220
|
+
>({
|
|
221
|
+
name: 'get-cache-summary',
|
|
222
|
+
description:
|
|
223
|
+
'Return aggregate TanStack Query cache health and count information.',
|
|
224
|
+
inputSchema: emptyInputSchema,
|
|
225
|
+
}),
|
|
226
|
+
getOnlineStatus: defineAgentToolContract<
|
|
227
|
+
TanStackQueryGetOnlineStatusArgs,
|
|
228
|
+
TanStackQueryGetOnlineStatusResult
|
|
229
|
+
>({
|
|
230
|
+
name: 'get-online-status',
|
|
231
|
+
description: 'Return the current TanStack Query onlineManager status.',
|
|
232
|
+
inputSchema: emptyInputSchema,
|
|
233
|
+
}),
|
|
234
|
+
setOnlineStatus: defineAgentToolContract<
|
|
235
|
+
TanStackQuerySetOnlineStatusArgs,
|
|
236
|
+
TanStackQuerySetOnlineStatusResult
|
|
237
|
+
>({
|
|
238
|
+
name: 'set-online-status',
|
|
239
|
+
description:
|
|
240
|
+
'Set the TanStack Query onlineManager status for testing offline/online behavior.',
|
|
241
|
+
inputSchema: {
|
|
242
|
+
type: 'object',
|
|
243
|
+
properties: {
|
|
244
|
+
online: {
|
|
245
|
+
type: 'boolean',
|
|
246
|
+
description: 'Whether the TanStack Query onlineManager should be online.',
|
|
247
|
+
},
|
|
248
|
+
},
|
|
249
|
+
required: ['online'],
|
|
250
|
+
},
|
|
251
|
+
}),
|
|
252
|
+
listQueries: defineAgentToolContract<
|
|
253
|
+
TanStackQueryListQueriesArgs,
|
|
254
|
+
TanStackQueryListQueriesResult
|
|
255
|
+
>({
|
|
256
|
+
name: 'list-queries',
|
|
257
|
+
description: 'List TanStack Query query summaries using cursor pagination.',
|
|
258
|
+
inputSchema: {
|
|
259
|
+
type: 'object',
|
|
260
|
+
properties: paginationProperties,
|
|
261
|
+
},
|
|
262
|
+
}),
|
|
263
|
+
getQueryDetails: defineAgentToolContract<
|
|
264
|
+
TanStackQueryGetQueryDetailsArgs,
|
|
265
|
+
TanStackQueryGetQueryDetailsResult
|
|
266
|
+
>({
|
|
267
|
+
name: 'get-query-details',
|
|
268
|
+
description:
|
|
269
|
+
'Return a JSON-safe TanStack Query query snapshot and observer summary.',
|
|
270
|
+
inputSchema: {
|
|
271
|
+
type: 'object',
|
|
272
|
+
properties: queryActionProperties,
|
|
273
|
+
required: ['queryHash'],
|
|
274
|
+
},
|
|
275
|
+
}),
|
|
276
|
+
refetchQuery: defineAgentToolContract<
|
|
277
|
+
TanStackQueryRefetchQueryArgs,
|
|
278
|
+
TanStackQueryActionResult
|
|
279
|
+
>({
|
|
280
|
+
name: 'refetch-query',
|
|
281
|
+
description: 'Refetch a TanStack Query query by queryHash.',
|
|
282
|
+
inputSchema: {
|
|
283
|
+
type: 'object',
|
|
284
|
+
properties: queryActionProperties,
|
|
285
|
+
required: ['queryHash'],
|
|
286
|
+
},
|
|
287
|
+
}),
|
|
288
|
+
setQueryLoading: defineAgentToolContract<
|
|
289
|
+
TanStackQuerySetQueryLoadingArgs,
|
|
290
|
+
TanStackQueryActionResult
|
|
291
|
+
>({
|
|
292
|
+
name: 'set-query-loading',
|
|
293
|
+
description:
|
|
294
|
+
'Enable or disable TanStack Query loading-state simulation for a query by queryHash.',
|
|
295
|
+
inputSchema: {
|
|
296
|
+
type: 'object',
|
|
297
|
+
properties: {
|
|
298
|
+
...queryActionProperties,
|
|
299
|
+
enabled: {
|
|
300
|
+
type: 'boolean',
|
|
301
|
+
description:
|
|
302
|
+
'Whether the loading-state simulation should be enabled.',
|
|
303
|
+
},
|
|
304
|
+
},
|
|
305
|
+
required: ['queryHash', 'enabled'],
|
|
306
|
+
},
|
|
307
|
+
}),
|
|
308
|
+
setQueryError: defineAgentToolContract<
|
|
309
|
+
TanStackQuerySetQueryErrorArgs,
|
|
310
|
+
TanStackQueryActionResult
|
|
311
|
+
>({
|
|
312
|
+
name: 'set-query-error',
|
|
313
|
+
description:
|
|
314
|
+
'Enable or disable TanStack Query error-state simulation for a query by queryHash.',
|
|
315
|
+
inputSchema: {
|
|
316
|
+
type: 'object',
|
|
317
|
+
properties: {
|
|
318
|
+
...queryActionProperties,
|
|
319
|
+
enabled: {
|
|
320
|
+
type: 'boolean',
|
|
321
|
+
description: 'Whether the error-state simulation should be enabled.',
|
|
322
|
+
},
|
|
323
|
+
},
|
|
324
|
+
required: ['queryHash', 'enabled'],
|
|
325
|
+
},
|
|
326
|
+
}),
|
|
327
|
+
invalidateQuery: defineAgentToolContract<
|
|
328
|
+
TanStackQueryInvalidateQueryArgs,
|
|
329
|
+
TanStackQueryActionResult
|
|
330
|
+
>({
|
|
331
|
+
name: 'invalidate-query',
|
|
332
|
+
description: 'Invalidate a TanStack Query query by queryHash.',
|
|
333
|
+
inputSchema: {
|
|
334
|
+
type: 'object',
|
|
335
|
+
properties: queryActionProperties,
|
|
336
|
+
required: ['queryHash'],
|
|
337
|
+
},
|
|
338
|
+
}),
|
|
339
|
+
resetQuery: defineAgentToolContract<
|
|
340
|
+
TanStackQueryResetQueryArgs,
|
|
341
|
+
TanStackQueryActionResult
|
|
342
|
+
>({
|
|
343
|
+
name: 'reset-query',
|
|
344
|
+
description: 'Reset a TanStack Query query by queryHash.',
|
|
345
|
+
inputSchema: {
|
|
346
|
+
type: 'object',
|
|
347
|
+
properties: queryActionProperties,
|
|
348
|
+
required: ['queryHash'],
|
|
349
|
+
},
|
|
350
|
+
}),
|
|
351
|
+
removeQuery: defineAgentToolContract<
|
|
352
|
+
TanStackQueryRemoveQueryArgs,
|
|
353
|
+
TanStackQueryActionResult
|
|
354
|
+
>({
|
|
355
|
+
name: 'remove-query',
|
|
356
|
+
description: 'Remove a TanStack Query query from the cache by queryHash.',
|
|
357
|
+
inputSchema: {
|
|
358
|
+
type: 'object',
|
|
359
|
+
properties: queryActionProperties,
|
|
360
|
+
required: ['queryHash'],
|
|
361
|
+
},
|
|
362
|
+
}),
|
|
363
|
+
clearQueryCache: defineAgentToolContract<
|
|
364
|
+
TanStackQueryClearQueryCacheArgs,
|
|
365
|
+
TanStackQueryClearQueryCacheResult
|
|
366
|
+
>({
|
|
367
|
+
name: 'clear-query-cache',
|
|
368
|
+
description: 'Clear the full TanStack Query query cache.',
|
|
369
|
+
inputSchema: emptyInputSchema,
|
|
370
|
+
}),
|
|
371
|
+
listMutations: defineAgentToolContract<
|
|
372
|
+
TanStackQueryListMutationsArgs,
|
|
373
|
+
TanStackQueryListMutationsResult
|
|
374
|
+
>({
|
|
375
|
+
name: 'list-mutations',
|
|
376
|
+
description: 'List TanStack Query mutation summaries using cursor pagination.',
|
|
377
|
+
inputSchema: {
|
|
378
|
+
type: 'object',
|
|
379
|
+
properties: paginationProperties,
|
|
380
|
+
},
|
|
381
|
+
}),
|
|
382
|
+
getMutationDetails: defineAgentToolContract<
|
|
383
|
+
TanStackQueryGetMutationDetailsArgs,
|
|
384
|
+
TanStackQueryGetMutationDetailsResult
|
|
385
|
+
>({
|
|
386
|
+
name: 'get-mutation-details',
|
|
387
|
+
description:
|
|
388
|
+
'Return a JSON-safe TanStack Query mutation snapshot for a mutationId.',
|
|
389
|
+
inputSchema: {
|
|
390
|
+
type: 'object',
|
|
391
|
+
properties: mutationActionProperties,
|
|
392
|
+
required: ['mutationId'],
|
|
393
|
+
},
|
|
394
|
+
}),
|
|
395
|
+
clearMutationCache: defineAgentToolContract<
|
|
396
|
+
TanStackQueryClearMutationCacheArgs,
|
|
397
|
+
TanStackQueryClearMutationCacheResult
|
|
398
|
+
>({
|
|
399
|
+
name: 'clear-mutation-cache',
|
|
400
|
+
description: 'Clear the full TanStack Query mutation cache.',
|
|
401
|
+
inputSchema: emptyInputSchema,
|
|
402
|
+
}),
|
|
403
|
+
} as const satisfies Record<string, AgentToolContract<unknown, unknown>>;
|
package/tsconfig.json
CHANGED
|
@@ -11,12 +11,15 @@
|
|
|
11
11
|
"noFallthroughCasesInSwitch": true,
|
|
12
12
|
"module": "ESNext",
|
|
13
13
|
"moduleResolution": "bundler",
|
|
14
|
+
"paths": {
|
|
15
|
+
"@rozenite/agent-shared": ["../agent-shared/src/index.ts"]
|
|
16
|
+
},
|
|
14
17
|
"resolveJsonModule": true,
|
|
15
18
|
"isolatedModules": true,
|
|
16
19
|
"noEmit": true,
|
|
17
20
|
"jsx": "react-jsx"
|
|
18
21
|
},
|
|
19
|
-
"include": ["src/**/*", "react-native.ts", "rozenite.config.ts"],
|
|
22
|
+
"include": ["src/**/*", "react-native.ts", "sdk.ts", "rozenite.config.ts"],
|
|
20
23
|
"exclude": ["node_modules", "dist", "build"],
|
|
21
24
|
"references": [
|
|
22
25
|
{
|
package/vite.config.ts
CHANGED
|
@@ -1,10 +1,17 @@
|
|
|
1
1
|
/// <reference types='vitest' />
|
|
2
|
+
import { resolve } from 'node:path';
|
|
2
3
|
import { defineConfig } from 'vite';
|
|
3
4
|
import { rozenitePlugin } from '@rozenite/vite-plugin';
|
|
4
5
|
|
|
5
6
|
export default defineConfig({
|
|
6
7
|
root: __dirname,
|
|
7
8
|
plugins: [rozenitePlugin()],
|
|
9
|
+
test: {
|
|
10
|
+
passWithNoTests: true,
|
|
11
|
+
alias: {
|
|
12
|
+
'@rozenite/agent-shared': resolve(__dirname, '../agent-shared/src/index.ts'),
|
|
13
|
+
},
|
|
14
|
+
},
|
|
8
15
|
base: './',
|
|
9
16
|
build: {
|
|
10
17
|
outDir: './dist',
|