@tooluminati/state 0.1.0
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/LICENSE +21 -0
- package/dist/apollo.d.ts +14 -0
- package/dist/apollo.d.ts.map +1 -0
- package/dist/apollo.js +13 -0
- package/dist/index.cjs +195 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +163 -0
- package/dist/jotai.d.ts +7 -0
- package/dist/jotai.d.ts.map +1 -0
- package/dist/jotai.js +11 -0
- package/dist/redux-toolkit.d.ts +13 -0
- package/dist/redux-toolkit.d.ts.map +1 -0
- package/dist/redux-toolkit.js +27 -0
- package/dist/selector-tool.d.ts +4 -0
- package/dist/selector-tool.d.ts.map +1 -0
- package/dist/selector-tool.js +16 -0
- package/dist/tanstack-query.d.ts +33 -0
- package/dist/tanstack-query.d.ts.map +1 -0
- package/dist/tanstack-query.js +66 -0
- package/dist/tanstack-query.test.d.ts +2 -0
- package/dist/tanstack-query.test.d.ts.map +1 -0
- package/dist/tanstack-query.test.js +64 -0
- package/dist/types.d.ts +19 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +1 -0
- package/dist/zustand.d.ts +11 -0
- package/dist/zustand.d.ts.map +1 -0
- package/dist/zustand.js +11 -0
- package/package.json +50 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 jitterbox
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/dist/apollo.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { WebMcpToolDescriptor } from '@tooluminati/core';
|
|
2
|
+
export interface ApolloQuerySummary {
|
|
3
|
+
name?: string;
|
|
4
|
+
networkStatus?: string | number;
|
|
5
|
+
loading?: boolean;
|
|
6
|
+
error?: string;
|
|
7
|
+
}
|
|
8
|
+
export declare function createApolloSummaryTool(options: {
|
|
9
|
+
getQueries: () => ApolloQuerySummary[];
|
|
10
|
+
name?: string;
|
|
11
|
+
}): WebMcpToolDescriptor<Record<string, never>, {
|
|
12
|
+
queries: ApolloQuerySummary[];
|
|
13
|
+
}>;
|
|
14
|
+
//# sourceMappingURL=apollo.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"apollo.d.ts","sourceRoot":"","sources":["../src/apollo.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAE9D,MAAM,WAAW,kBAAkB;IACjC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,aAAa,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAChC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,wBAAgB,uBAAuB,CAAC,OAAO,EAAE;IAC/C,UAAU,EAAE,MAAM,kBAAkB,EAAE,CAAC;IACvC,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,GAAG,oBAAoB,CAAC,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,EAAE;IAAE,OAAO,EAAE,kBAAkB,EAAE,CAAA;CAAE,CAAC,CAajF"}
|
package/dist/apollo.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export function createApolloSummaryTool(options) {
|
|
2
|
+
return {
|
|
3
|
+
name: options.name ?? 'get_apollo_query_summary',
|
|
4
|
+
description: 'Returns allowlisted Apollo query loading, network, and error summaries.',
|
|
5
|
+
inputSchema: {
|
|
6
|
+
type: 'object',
|
|
7
|
+
properties: {},
|
|
8
|
+
additionalProperties: false,
|
|
9
|
+
},
|
|
10
|
+
annotations: { readOnlyHint: true },
|
|
11
|
+
execute: () => ({ queries: options.getQueries() }),
|
|
12
|
+
};
|
|
13
|
+
}
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/index.ts
|
|
21
|
+
var index_exports = {};
|
|
22
|
+
__export(index_exports, {
|
|
23
|
+
createApolloSummaryTool: () => createApolloSummaryTool,
|
|
24
|
+
createJotaiStateSummaryTool: () => createJotaiStateSummaryTool,
|
|
25
|
+
createQueryCacheSummaryTool: () => createQueryCacheSummaryTool,
|
|
26
|
+
createReduxStateSummaryTool: () => createReduxStateSummaryTool,
|
|
27
|
+
createStateSummaryTool: () => createStateSummaryTool,
|
|
28
|
+
createZustandStateSummaryTool: () => createZustandStateSummaryTool
|
|
29
|
+
});
|
|
30
|
+
module.exports = __toCommonJS(index_exports);
|
|
31
|
+
|
|
32
|
+
// src/apollo.ts
|
|
33
|
+
function createApolloSummaryTool(options) {
|
|
34
|
+
return {
|
|
35
|
+
name: options.name ?? "get_apollo_query_summary",
|
|
36
|
+
description: "Returns allowlisted Apollo query loading, network, and error summaries.",
|
|
37
|
+
inputSchema: {
|
|
38
|
+
type: "object",
|
|
39
|
+
properties: {},
|
|
40
|
+
additionalProperties: false
|
|
41
|
+
},
|
|
42
|
+
annotations: { readOnlyHint: true },
|
|
43
|
+
execute: () => ({ queries: options.getQueries() })
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
// src/selector-tool.ts
|
|
48
|
+
function createStateSummaryTool({
|
|
49
|
+
name,
|
|
50
|
+
description,
|
|
51
|
+
getState,
|
|
52
|
+
selector,
|
|
53
|
+
redact
|
|
54
|
+
}) {
|
|
55
|
+
return {
|
|
56
|
+
name,
|
|
57
|
+
description,
|
|
58
|
+
inputSchema: {
|
|
59
|
+
type: "object",
|
|
60
|
+
properties: {},
|
|
61
|
+
additionalProperties: false
|
|
62
|
+
},
|
|
63
|
+
annotations: { readOnlyHint: true },
|
|
64
|
+
execute: () => {
|
|
65
|
+
const summary = selector(getState());
|
|
66
|
+
return redact ? redact(summary) : summary;
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
// src/jotai.ts
|
|
72
|
+
function createJotaiStateSummaryTool(options) {
|
|
73
|
+
return createStateSummaryTool({
|
|
74
|
+
name: options.name ?? "get_jotai_state_summary",
|
|
75
|
+
description: options.description ?? "Returns an explicit summary from allowlisted Jotai atoms.",
|
|
76
|
+
getState: options.getSummary,
|
|
77
|
+
selector: (summary) => summary,
|
|
78
|
+
redact: options.redact
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
// src/redux-toolkit.ts
|
|
83
|
+
var import_core = require("@tooluminati/core");
|
|
84
|
+
function getPathValue(state, path) {
|
|
85
|
+
return path.split(".").reduce((current, segment) => {
|
|
86
|
+
if (current && typeof current === "object") {
|
|
87
|
+
return current[segment];
|
|
88
|
+
}
|
|
89
|
+
return void 0;
|
|
90
|
+
}, state);
|
|
91
|
+
}
|
|
92
|
+
function pickAllowlistedPaths(state, paths) {
|
|
93
|
+
return Object.fromEntries(
|
|
94
|
+
paths.map((path) => [path, getPathValue(state, path)])
|
|
95
|
+
);
|
|
96
|
+
}
|
|
97
|
+
function createReduxStateSummaryTool(options) {
|
|
98
|
+
const selector = options.pathAllowlist?.length ? (state) => pickAllowlistedPaths(state, options.pathAllowlist) : options.selector;
|
|
99
|
+
return createStateSummaryTool({
|
|
100
|
+
name: options.name ?? "get_redux_state_summary",
|
|
101
|
+
description: options.description ?? "Returns an explicit, redacted summary of allowlisted Redux state.",
|
|
102
|
+
getState: () => options.store.getState(),
|
|
103
|
+
selector,
|
|
104
|
+
redact: options.redact ?? ((summary) => (0, import_core.redactObject)(summary))
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
// src/tanstack-query.ts
|
|
109
|
+
function summarizeShape(value) {
|
|
110
|
+
if (Array.isArray(value)) {
|
|
111
|
+
return { type: "array", length: value.length };
|
|
112
|
+
}
|
|
113
|
+
if (value && typeof value === "object") {
|
|
114
|
+
return {
|
|
115
|
+
type: "object",
|
|
116
|
+
keys: Object.keys(value).slice(0, 20)
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
return { type: typeof value };
|
|
120
|
+
}
|
|
121
|
+
function getRetryCount(query) {
|
|
122
|
+
const state = query.state;
|
|
123
|
+
return state.fetchFailureCount ?? state.failureCount;
|
|
124
|
+
}
|
|
125
|
+
function createQueryCacheSummaryTool({
|
|
126
|
+
queryClient,
|
|
127
|
+
allowKeys,
|
|
128
|
+
includeDataShape = true,
|
|
129
|
+
includeData = false,
|
|
130
|
+
redact,
|
|
131
|
+
name = "get_query_cache_summary"
|
|
132
|
+
}) {
|
|
133
|
+
return {
|
|
134
|
+
name,
|
|
135
|
+
description: "Returns allowlisted query status, fetch state, stale state, errors, and data shape summaries.",
|
|
136
|
+
inputSchema: {
|
|
137
|
+
type: "object",
|
|
138
|
+
properties: {},
|
|
139
|
+
additionalProperties: false
|
|
140
|
+
},
|
|
141
|
+
annotations: { readOnlyHint: true },
|
|
142
|
+
execute: () => {
|
|
143
|
+
if (!allowKeys?.length) {
|
|
144
|
+
throw new Error(
|
|
145
|
+
"allowKeys is required for query cache summary tool. Provide an explicit allowlist of query keys."
|
|
146
|
+
);
|
|
147
|
+
}
|
|
148
|
+
if (includeData && !redact) {
|
|
149
|
+
throw new Error(
|
|
150
|
+
"redact is required when includeData is true for query cache summary tool."
|
|
151
|
+
);
|
|
152
|
+
}
|
|
153
|
+
const allowed = new Set(allowKeys.map((key) => JSON.stringify(key)));
|
|
154
|
+
const queries = queryClient.getQueryCache().findAll().filter((query) => allowed.has(JSON.stringify(query.queryKey))).map((query) => {
|
|
155
|
+
const summary = {
|
|
156
|
+
key: query.queryKey,
|
|
157
|
+
status: query.state.status,
|
|
158
|
+
fetchStatus: query.state.fetchStatus,
|
|
159
|
+
stale: query.isStale?.(),
|
|
160
|
+
updatedAt: query.state.dataUpdatedAt,
|
|
161
|
+
error: query.state.error ? query.state.error instanceof Error ? query.state.error.message : String(query.state.error) : void 0,
|
|
162
|
+
retryCount: getRetryCount(query)
|
|
163
|
+
};
|
|
164
|
+
if (includeDataShape) {
|
|
165
|
+
summary.dataShape = summarizeShape(query.state.data);
|
|
166
|
+
}
|
|
167
|
+
if (includeData && redact) {
|
|
168
|
+
summary.data = redact(query.state.data);
|
|
169
|
+
}
|
|
170
|
+
return summary;
|
|
171
|
+
});
|
|
172
|
+
return { queries };
|
|
173
|
+
}
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
// src/zustand.ts
|
|
178
|
+
function createZustandStateSummaryTool(options) {
|
|
179
|
+
return createStateSummaryTool({
|
|
180
|
+
name: options.name ?? "get_zustand_state_summary",
|
|
181
|
+
description: options.description ?? "Returns an explicit summary from an allowlisted Zustand selector.",
|
|
182
|
+
getState: () => options.store.getState(),
|
|
183
|
+
selector: options.selector,
|
|
184
|
+
redact: options.redact
|
|
185
|
+
});
|
|
186
|
+
}
|
|
187
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
188
|
+
0 && (module.exports = {
|
|
189
|
+
createApolloSummaryTool,
|
|
190
|
+
createJotaiStateSummaryTool,
|
|
191
|
+
createQueryCacheSummaryTool,
|
|
192
|
+
createReduxStateSummaryTool,
|
|
193
|
+
createStateSummaryTool,
|
|
194
|
+
createZustandStateSummaryTool
|
|
195
|
+
});
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @experimental Tooluminati state adapters — public APIs may change.
|
|
3
|
+
*/
|
|
4
|
+
export * from './apollo';
|
|
5
|
+
export * from './jotai';
|
|
6
|
+
export * from './redux-toolkit';
|
|
7
|
+
export * from './selector-tool';
|
|
8
|
+
export * from './tanstack-query';
|
|
9
|
+
export * from './types';
|
|
10
|
+
export * from './zustand';
|
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
// src/apollo.ts
|
|
2
|
+
function createApolloSummaryTool(options) {
|
|
3
|
+
return {
|
|
4
|
+
name: options.name ?? "get_apollo_query_summary",
|
|
5
|
+
description: "Returns allowlisted Apollo query loading, network, and error summaries.",
|
|
6
|
+
inputSchema: {
|
|
7
|
+
type: "object",
|
|
8
|
+
properties: {},
|
|
9
|
+
additionalProperties: false
|
|
10
|
+
},
|
|
11
|
+
annotations: { readOnlyHint: true },
|
|
12
|
+
execute: () => ({ queries: options.getQueries() })
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
// src/selector-tool.ts
|
|
17
|
+
function createStateSummaryTool({
|
|
18
|
+
name,
|
|
19
|
+
description,
|
|
20
|
+
getState,
|
|
21
|
+
selector,
|
|
22
|
+
redact
|
|
23
|
+
}) {
|
|
24
|
+
return {
|
|
25
|
+
name,
|
|
26
|
+
description,
|
|
27
|
+
inputSchema: {
|
|
28
|
+
type: "object",
|
|
29
|
+
properties: {},
|
|
30
|
+
additionalProperties: false
|
|
31
|
+
},
|
|
32
|
+
annotations: { readOnlyHint: true },
|
|
33
|
+
execute: () => {
|
|
34
|
+
const summary = selector(getState());
|
|
35
|
+
return redact ? redact(summary) : summary;
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// src/jotai.ts
|
|
41
|
+
function createJotaiStateSummaryTool(options) {
|
|
42
|
+
return createStateSummaryTool({
|
|
43
|
+
name: options.name ?? "get_jotai_state_summary",
|
|
44
|
+
description: options.description ?? "Returns an explicit summary from allowlisted Jotai atoms.",
|
|
45
|
+
getState: options.getSummary,
|
|
46
|
+
selector: (summary) => summary,
|
|
47
|
+
redact: options.redact
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// src/redux-toolkit.ts
|
|
52
|
+
import { redactObject } from "@tooluminati/core";
|
|
53
|
+
function getPathValue(state, path) {
|
|
54
|
+
return path.split(".").reduce((current, segment) => {
|
|
55
|
+
if (current && typeof current === "object") {
|
|
56
|
+
return current[segment];
|
|
57
|
+
}
|
|
58
|
+
return void 0;
|
|
59
|
+
}, state);
|
|
60
|
+
}
|
|
61
|
+
function pickAllowlistedPaths(state, paths) {
|
|
62
|
+
return Object.fromEntries(
|
|
63
|
+
paths.map((path) => [path, getPathValue(state, path)])
|
|
64
|
+
);
|
|
65
|
+
}
|
|
66
|
+
function createReduxStateSummaryTool(options) {
|
|
67
|
+
const selector = options.pathAllowlist?.length ? (state) => pickAllowlistedPaths(state, options.pathAllowlist) : options.selector;
|
|
68
|
+
return createStateSummaryTool({
|
|
69
|
+
name: options.name ?? "get_redux_state_summary",
|
|
70
|
+
description: options.description ?? "Returns an explicit, redacted summary of allowlisted Redux state.",
|
|
71
|
+
getState: () => options.store.getState(),
|
|
72
|
+
selector,
|
|
73
|
+
redact: options.redact ?? ((summary) => redactObject(summary))
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
// src/tanstack-query.ts
|
|
78
|
+
function summarizeShape(value) {
|
|
79
|
+
if (Array.isArray(value)) {
|
|
80
|
+
return { type: "array", length: value.length };
|
|
81
|
+
}
|
|
82
|
+
if (value && typeof value === "object") {
|
|
83
|
+
return {
|
|
84
|
+
type: "object",
|
|
85
|
+
keys: Object.keys(value).slice(0, 20)
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
return { type: typeof value };
|
|
89
|
+
}
|
|
90
|
+
function getRetryCount(query) {
|
|
91
|
+
const state = query.state;
|
|
92
|
+
return state.fetchFailureCount ?? state.failureCount;
|
|
93
|
+
}
|
|
94
|
+
function createQueryCacheSummaryTool({
|
|
95
|
+
queryClient,
|
|
96
|
+
allowKeys,
|
|
97
|
+
includeDataShape = true,
|
|
98
|
+
includeData = false,
|
|
99
|
+
redact,
|
|
100
|
+
name = "get_query_cache_summary"
|
|
101
|
+
}) {
|
|
102
|
+
return {
|
|
103
|
+
name,
|
|
104
|
+
description: "Returns allowlisted query status, fetch state, stale state, errors, and data shape summaries.",
|
|
105
|
+
inputSchema: {
|
|
106
|
+
type: "object",
|
|
107
|
+
properties: {},
|
|
108
|
+
additionalProperties: false
|
|
109
|
+
},
|
|
110
|
+
annotations: { readOnlyHint: true },
|
|
111
|
+
execute: () => {
|
|
112
|
+
if (!allowKeys?.length) {
|
|
113
|
+
throw new Error(
|
|
114
|
+
"allowKeys is required for query cache summary tool. Provide an explicit allowlist of query keys."
|
|
115
|
+
);
|
|
116
|
+
}
|
|
117
|
+
if (includeData && !redact) {
|
|
118
|
+
throw new Error(
|
|
119
|
+
"redact is required when includeData is true for query cache summary tool."
|
|
120
|
+
);
|
|
121
|
+
}
|
|
122
|
+
const allowed = new Set(allowKeys.map((key) => JSON.stringify(key)));
|
|
123
|
+
const queries = queryClient.getQueryCache().findAll().filter((query) => allowed.has(JSON.stringify(query.queryKey))).map((query) => {
|
|
124
|
+
const summary = {
|
|
125
|
+
key: query.queryKey,
|
|
126
|
+
status: query.state.status,
|
|
127
|
+
fetchStatus: query.state.fetchStatus,
|
|
128
|
+
stale: query.isStale?.(),
|
|
129
|
+
updatedAt: query.state.dataUpdatedAt,
|
|
130
|
+
error: query.state.error ? query.state.error instanceof Error ? query.state.error.message : String(query.state.error) : void 0,
|
|
131
|
+
retryCount: getRetryCount(query)
|
|
132
|
+
};
|
|
133
|
+
if (includeDataShape) {
|
|
134
|
+
summary.dataShape = summarizeShape(query.state.data);
|
|
135
|
+
}
|
|
136
|
+
if (includeData && redact) {
|
|
137
|
+
summary.data = redact(query.state.data);
|
|
138
|
+
}
|
|
139
|
+
return summary;
|
|
140
|
+
});
|
|
141
|
+
return { queries };
|
|
142
|
+
}
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
// src/zustand.ts
|
|
147
|
+
function createZustandStateSummaryTool(options) {
|
|
148
|
+
return createStateSummaryTool({
|
|
149
|
+
name: options.name ?? "get_zustand_state_summary",
|
|
150
|
+
description: options.description ?? "Returns an explicit summary from an allowlisted Zustand selector.",
|
|
151
|
+
getState: () => options.store.getState(),
|
|
152
|
+
selector: options.selector,
|
|
153
|
+
redact: options.redact
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
export {
|
|
157
|
+
createApolloSummaryTool,
|
|
158
|
+
createJotaiStateSummaryTool,
|
|
159
|
+
createQueryCacheSummaryTool,
|
|
160
|
+
createReduxStateSummaryTool,
|
|
161
|
+
createStateSummaryTool,
|
|
162
|
+
createZustandStateSummaryTool
|
|
163
|
+
};
|
package/dist/jotai.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare function createJotaiStateSummaryTool<TSummary>(options: {
|
|
2
|
+
getSummary: () => TSummary;
|
|
3
|
+
name?: string;
|
|
4
|
+
description?: string;
|
|
5
|
+
redact?: (summary: TSummary) => unknown;
|
|
6
|
+
}): import("@tooluminati/core").WebMcpToolDescriptor<Record<string, never>, unknown>;
|
|
7
|
+
//# sourceMappingURL=jotai.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jotai.d.ts","sourceRoot":"","sources":["../src/jotai.ts"],"names":[],"mappings":"AAEA,wBAAgB,2BAA2B,CAAC,QAAQ,EAAE,OAAO,EAAE;IAC7D,UAAU,EAAE,MAAM,QAAQ,CAAC;IAC3B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,QAAQ,KAAK,OAAO,CAAC;CACzC,oFAUA"}
|
package/dist/jotai.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { createStateSummaryTool } from './selector-tool';
|
|
2
|
+
export function createJotaiStateSummaryTool(options) {
|
|
3
|
+
return createStateSummaryTool({
|
|
4
|
+
name: options.name ?? 'get_jotai_state_summary',
|
|
5
|
+
description: options.description ??
|
|
6
|
+
'Returns an explicit summary from allowlisted Jotai atoms.',
|
|
7
|
+
getState: options.getSummary,
|
|
8
|
+
selector: (summary) => summary,
|
|
9
|
+
redact: options.redact,
|
|
10
|
+
});
|
|
11
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export interface ReduxStoreLike<TState> {
|
|
2
|
+
getState(): TState;
|
|
3
|
+
}
|
|
4
|
+
/** @experimental */
|
|
5
|
+
export declare function createReduxStateSummaryTool<TState, TSummary>(options: {
|
|
6
|
+
store: ReduxStoreLike<TState>;
|
|
7
|
+
selector: (state: TState) => TSummary;
|
|
8
|
+
name?: string;
|
|
9
|
+
description?: string;
|
|
10
|
+
redact?: (summary: TSummary) => unknown;
|
|
11
|
+
pathAllowlist?: string[];
|
|
12
|
+
}): import("@tooluminati/core").WebMcpToolDescriptor<Record<string, never>, unknown>;
|
|
13
|
+
//# sourceMappingURL=redux-toolkit.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"redux-toolkit.d.ts","sourceRoot":"","sources":["../src/redux-toolkit.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,cAAc,CAAC,MAAM;IACpC,QAAQ,IAAI,MAAM,CAAC;CACpB;AAqBD,oBAAoB;AACpB,wBAAgB,2BAA2B,CAAC,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE;IACrE,KAAK,EAAE,cAAc,CAAC,MAAM,CAAC,CAAC;IAC9B,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,QAAQ,CAAC;IACtC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,QAAQ,KAAK,OAAO,CAAC;IACxC,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;CAC1B,oFAeA"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { redactObject } from '@tooluminati/core';
|
|
2
|
+
import { createStateSummaryTool } from './selector-tool';
|
|
3
|
+
function getPathValue(state, path) {
|
|
4
|
+
return path.split('.').reduce((current, segment) => {
|
|
5
|
+
if (current && typeof current === 'object') {
|
|
6
|
+
return current[segment];
|
|
7
|
+
}
|
|
8
|
+
return undefined;
|
|
9
|
+
}, state);
|
|
10
|
+
}
|
|
11
|
+
function pickAllowlistedPaths(state, paths) {
|
|
12
|
+
return Object.fromEntries(paths.map((path) => [path, getPathValue(state, path)]));
|
|
13
|
+
}
|
|
14
|
+
/** @experimental */
|
|
15
|
+
export function createReduxStateSummaryTool(options) {
|
|
16
|
+
const selector = options.pathAllowlist?.length
|
|
17
|
+
? (state) => pickAllowlistedPaths(state, options.pathAllowlist)
|
|
18
|
+
: options.selector;
|
|
19
|
+
return createStateSummaryTool({
|
|
20
|
+
name: options.name ?? 'get_redux_state_summary',
|
|
21
|
+
description: options.description ??
|
|
22
|
+
'Returns an explicit, redacted summary of allowlisted Redux state.',
|
|
23
|
+
getState: () => options.store.getState(),
|
|
24
|
+
selector,
|
|
25
|
+
redact: options.redact ?? ((summary) => redactObject(summary)),
|
|
26
|
+
});
|
|
27
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { WebMcpToolDescriptor } from '@tooluminati/core';
|
|
2
|
+
import type { StateSummaryToolOptions } from './types';
|
|
3
|
+
export declare function createStateSummaryTool<TState, TSummary>({ name, description, getState, selector, redact, }: StateSummaryToolOptions<TState, TSummary>): WebMcpToolDescriptor<Record<string, never>, unknown>;
|
|
4
|
+
//# sourceMappingURL=selector-tool.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"selector-tool.d.ts","sourceRoot":"","sources":["../src/selector-tool.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAC9D,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,SAAS,CAAC;AAEvD,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,QAAQ,EAAE,EACvD,IAAI,EACJ,WAAW,EACX,QAAQ,EACR,QAAQ,EACR,MAAM,GACP,EAAE,uBAAuB,CAAC,MAAM,EAAE,QAAQ,CAAC,GAAG,oBAAoB,CACjE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,EACrB,OAAO,CACR,CAeA"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export function createStateSummaryTool({ name, description, getState, selector, redact, }) {
|
|
2
|
+
return {
|
|
3
|
+
name,
|
|
4
|
+
description,
|
|
5
|
+
inputSchema: {
|
|
6
|
+
type: 'object',
|
|
7
|
+
properties: {},
|
|
8
|
+
additionalProperties: false,
|
|
9
|
+
},
|
|
10
|
+
annotations: { readOnlyHint: true },
|
|
11
|
+
execute: () => {
|
|
12
|
+
const summary = selector(getState());
|
|
13
|
+
return redact ? redact(summary) : summary;
|
|
14
|
+
},
|
|
15
|
+
};
|
|
16
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { WebMcpToolDescriptor } from '@tooluminati/core';
|
|
2
|
+
import type { QuerySummary } from './types';
|
|
3
|
+
export interface QueryLike {
|
|
4
|
+
queryKey: unknown;
|
|
5
|
+
state: {
|
|
6
|
+
status?: string;
|
|
7
|
+
fetchStatus?: string;
|
|
8
|
+
dataUpdatedAt?: number;
|
|
9
|
+
error?: unknown;
|
|
10
|
+
data?: unknown;
|
|
11
|
+
fetchFailureCount?: number;
|
|
12
|
+
failureCount?: number;
|
|
13
|
+
};
|
|
14
|
+
isStale?: () => boolean;
|
|
15
|
+
}
|
|
16
|
+
export interface QueryClientLike {
|
|
17
|
+
getQueryCache(): {
|
|
18
|
+
findAll(): QueryLike[];
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
export interface QueryCacheSummaryOptions {
|
|
22
|
+
queryClient: QueryClientLike;
|
|
23
|
+
allowKeys: unknown[];
|
|
24
|
+
includeDataShape?: boolean;
|
|
25
|
+
includeData?: boolean;
|
|
26
|
+
redact?: (data: unknown) => unknown;
|
|
27
|
+
name?: string;
|
|
28
|
+
}
|
|
29
|
+
/** @experimental */
|
|
30
|
+
export declare function createQueryCacheSummaryTool({ queryClient, allowKeys, includeDataShape, includeData, redact, name, }: QueryCacheSummaryOptions): WebMcpToolDescriptor<Record<string, never>, {
|
|
31
|
+
queries: QuerySummary[];
|
|
32
|
+
}>;
|
|
33
|
+
//# sourceMappingURL=tanstack-query.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tanstack-query.d.ts","sourceRoot":"","sources":["../src/tanstack-query.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAC9D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAE5C,MAAM,WAAW,SAAS;IACxB,QAAQ,EAAE,OAAO,CAAC;IAClB,KAAK,EAAE;QACL,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,aAAa,CAAC,EAAE,MAAM,CAAC;QACvB,KAAK,CAAC,EAAE,OAAO,CAAC;QAChB,IAAI,CAAC,EAAE,OAAO,CAAC;QACf,iBAAiB,CAAC,EAAE,MAAM,CAAC;QAC3B,YAAY,CAAC,EAAE,MAAM,CAAC;KACvB,CAAC;IACF,OAAO,CAAC,EAAE,MAAM,OAAO,CAAC;CACzB;AAED,MAAM,WAAW,eAAe;IAC9B,aAAa,IAAI;QACf,OAAO,IAAI,SAAS,EAAE,CAAC;KACxB,CAAC;CACH;AAED,MAAM,WAAW,wBAAwB;IACvC,WAAW,EAAE,eAAe,CAAC;IAC7B,SAAS,EAAE,OAAO,EAAE,CAAC;IACrB,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,OAAO,CAAC;IACpC,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAsBD,oBAAoB;AACpB,wBAAgB,2BAA2B,CAAC,EAC1C,WAAW,EACX,SAAS,EACT,gBAAuB,EACvB,WAAmB,EACnB,MAAM,EACN,IAAgC,GACjC,EAAE,wBAAwB,GAAG,oBAAoB,CAChD,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,EACrB;IAAE,OAAO,EAAE,YAAY,EAAE,CAAA;CAAE,CAC5B,CA2DA"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
function summarizeShape(value) {
|
|
2
|
+
if (Array.isArray(value)) {
|
|
3
|
+
return { type: 'array', length: value.length };
|
|
4
|
+
}
|
|
5
|
+
if (value && typeof value === 'object') {
|
|
6
|
+
return {
|
|
7
|
+
type: 'object',
|
|
8
|
+
keys: Object.keys(value).slice(0, 20),
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
return { type: typeof value };
|
|
12
|
+
}
|
|
13
|
+
function getRetryCount(query) {
|
|
14
|
+
const state = query.state;
|
|
15
|
+
return state.fetchFailureCount ?? state.failureCount;
|
|
16
|
+
}
|
|
17
|
+
/** @experimental */
|
|
18
|
+
export function createQueryCacheSummaryTool({ queryClient, allowKeys, includeDataShape = true, includeData = false, redact, name = 'get_query_cache_summary', }) {
|
|
19
|
+
return {
|
|
20
|
+
name,
|
|
21
|
+
description: 'Returns allowlisted query status, fetch state, stale state, errors, and data shape summaries.',
|
|
22
|
+
inputSchema: {
|
|
23
|
+
type: 'object',
|
|
24
|
+
properties: {},
|
|
25
|
+
additionalProperties: false,
|
|
26
|
+
},
|
|
27
|
+
annotations: { readOnlyHint: true },
|
|
28
|
+
execute: () => {
|
|
29
|
+
if (!allowKeys?.length) {
|
|
30
|
+
throw new Error('allowKeys is required for query cache summary tool. ' +
|
|
31
|
+
'Provide an explicit allowlist of query keys.');
|
|
32
|
+
}
|
|
33
|
+
if (includeData && !redact) {
|
|
34
|
+
throw new Error('redact is required when includeData is true for query cache summary tool.');
|
|
35
|
+
}
|
|
36
|
+
const allowed = new Set(allowKeys.map((key) => JSON.stringify(key)));
|
|
37
|
+
const queries = queryClient
|
|
38
|
+
.getQueryCache()
|
|
39
|
+
.findAll()
|
|
40
|
+
.filter((query) => allowed.has(JSON.stringify(query.queryKey)))
|
|
41
|
+
.map((query) => {
|
|
42
|
+
const summary = {
|
|
43
|
+
key: query.queryKey,
|
|
44
|
+
status: query.state.status,
|
|
45
|
+
fetchStatus: query.state.fetchStatus,
|
|
46
|
+
stale: query.isStale?.(),
|
|
47
|
+
updatedAt: query.state.dataUpdatedAt,
|
|
48
|
+
error: query.state.error
|
|
49
|
+
? query.state.error instanceof Error
|
|
50
|
+
? query.state.error.message
|
|
51
|
+
: String(query.state.error)
|
|
52
|
+
: undefined,
|
|
53
|
+
retryCount: getRetryCount(query),
|
|
54
|
+
};
|
|
55
|
+
if (includeDataShape) {
|
|
56
|
+
summary.dataShape = summarizeShape(query.state.data);
|
|
57
|
+
}
|
|
58
|
+
if (includeData && redact) {
|
|
59
|
+
summary.data = redact(query.state.data);
|
|
60
|
+
}
|
|
61
|
+
return summary;
|
|
62
|
+
});
|
|
63
|
+
return { queries };
|
|
64
|
+
},
|
|
65
|
+
};
|
|
66
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tanstack-query.test.d.ts","sourceRoot":"","sources":["../src/tanstack-query.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { describe, expect, it } from 'vitest';
|
|
2
|
+
import { redactObject } from '@tooluminati/core';
|
|
3
|
+
import { createQueryCacheSummaryTool } from './tanstack-query';
|
|
4
|
+
describe('createQueryCacheSummaryTool security', () => {
|
|
5
|
+
const queryClient = {
|
|
6
|
+
getQueryCache: () => ({
|
|
7
|
+
findAll: () => [
|
|
8
|
+
{
|
|
9
|
+
queryKey: ['users'],
|
|
10
|
+
state: {
|
|
11
|
+
status: 'success',
|
|
12
|
+
data: { token: 'secret', name: 'Ada' },
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
queryKey: ['posts'],
|
|
17
|
+
state: {
|
|
18
|
+
status: 'success',
|
|
19
|
+
data: { title: 'Hello' },
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
],
|
|
23
|
+
}),
|
|
24
|
+
};
|
|
25
|
+
it('throws when allowKeys is omitted or empty', () => {
|
|
26
|
+
const tool = createQueryCacheSummaryTool({
|
|
27
|
+
queryClient,
|
|
28
|
+
allowKeys: [],
|
|
29
|
+
});
|
|
30
|
+
expect(() => tool.execute({}, {})).toThrow(/allowKeys is required/);
|
|
31
|
+
});
|
|
32
|
+
it('does not dump the full cache without explicit allowKeys', () => {
|
|
33
|
+
const tool = createQueryCacheSummaryTool({
|
|
34
|
+
queryClient,
|
|
35
|
+
allowKeys: [['users']],
|
|
36
|
+
});
|
|
37
|
+
const result = tool.execute({}, {});
|
|
38
|
+
expect(result.queries).toHaveLength(1);
|
|
39
|
+
expect(result.queries[0]?.key).toEqual(['users']);
|
|
40
|
+
expect(result.queries[0]?.data).toBeUndefined();
|
|
41
|
+
});
|
|
42
|
+
it('requires redact when includeData is true', () => {
|
|
43
|
+
const tool = createQueryCacheSummaryTool({
|
|
44
|
+
queryClient,
|
|
45
|
+
allowKeys: [['users']],
|
|
46
|
+
includeData: true,
|
|
47
|
+
});
|
|
48
|
+
expect(() => tool.execute({}, {})).toThrow(/redact is required/);
|
|
49
|
+
});
|
|
50
|
+
it('returns redacted data only for allowlisted keys', () => {
|
|
51
|
+
const tool = createQueryCacheSummaryTool({
|
|
52
|
+
queryClient,
|
|
53
|
+
allowKeys: [['users']],
|
|
54
|
+
includeData: true,
|
|
55
|
+
includeDataShape: false,
|
|
56
|
+
redact: (data) => redactObject(data),
|
|
57
|
+
});
|
|
58
|
+
const result = tool.execute({}, {});
|
|
59
|
+
expect(result.queries[0]?.data).toEqual({
|
|
60
|
+
token: '[REDACTED]',
|
|
61
|
+
name: 'Ada',
|
|
62
|
+
});
|
|
63
|
+
});
|
|
64
|
+
});
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export interface StateSummaryToolOptions<TState, TSummary> {
|
|
2
|
+
name: string;
|
|
3
|
+
description: string;
|
|
4
|
+
getState: () => TState;
|
|
5
|
+
selector: (state: TState) => TSummary;
|
|
6
|
+
redact?: ((summary: TSummary) => unknown) | undefined;
|
|
7
|
+
}
|
|
8
|
+
export interface QuerySummary {
|
|
9
|
+
key: unknown;
|
|
10
|
+
status?: string | undefined;
|
|
11
|
+
fetchStatus?: string | undefined;
|
|
12
|
+
stale?: boolean | undefined;
|
|
13
|
+
updatedAt?: number | undefined;
|
|
14
|
+
error?: string | undefined;
|
|
15
|
+
retryCount?: number | undefined;
|
|
16
|
+
dataShape?: unknown;
|
|
17
|
+
data?: unknown;
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,uBAAuB,CAAC,MAAM,EAAE,QAAQ;IACvD,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,MAAM,CAAC;IACvB,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,QAAQ,CAAC;IACtC,MAAM,CAAC,EAAE,CAAC,CAAC,OAAO,EAAE,QAAQ,KAAK,OAAO,CAAC,GAAG,SAAS,CAAC;CACvD;AAED,MAAM,WAAW,YAAY;IAC3B,GAAG,EAAE,OAAO,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACjC,KAAK,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAC5B,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC/B,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B,UAAU,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAChC,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB"}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export interface ZustandStoreLike<TState> {
|
|
2
|
+
getState(): TState;
|
|
3
|
+
}
|
|
4
|
+
export declare function createZustandStateSummaryTool<TState, TSummary>(options: {
|
|
5
|
+
store: ZustandStoreLike<TState>;
|
|
6
|
+
selector: (state: TState) => TSummary;
|
|
7
|
+
name?: string;
|
|
8
|
+
description?: string;
|
|
9
|
+
redact?: (summary: TSummary) => unknown;
|
|
10
|
+
}): import("@tooluminati/core").WebMcpToolDescriptor<Record<string, never>, unknown>;
|
|
11
|
+
//# sourceMappingURL=zustand.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"zustand.d.ts","sourceRoot":"","sources":["../src/zustand.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,gBAAgB,CAAC,MAAM;IACtC,QAAQ,IAAI,MAAM,CAAC;CACpB;AAED,wBAAgB,6BAA6B,CAAC,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE;IACvE,KAAK,EAAE,gBAAgB,CAAC,MAAM,CAAC,CAAC;IAChC,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,QAAQ,CAAC;IACtC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,QAAQ,KAAK,OAAO,CAAC;CACzC,oFAUA"}
|
package/dist/zustand.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { createStateSummaryTool } from './selector-tool';
|
|
2
|
+
export function createZustandStateSummaryTool(options) {
|
|
3
|
+
return createStateSummaryTool({
|
|
4
|
+
name: options.name ?? 'get_zustand_state_summary',
|
|
5
|
+
description: options.description ??
|
|
6
|
+
'Returns an explicit summary from an allowlisted Zustand selector.',
|
|
7
|
+
getState: () => options.store.getState(),
|
|
8
|
+
selector: options.selector,
|
|
9
|
+
redact: options.redact,
|
|
10
|
+
});
|
|
11
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@tooluminati/state",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Safe state and data-cache summaries for Tooluminati.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"sideEffects": false,
|
|
7
|
+
"main": "./dist/index.cjs",
|
|
8
|
+
"module": "./dist/index.js",
|
|
9
|
+
"types": "./dist/index.d.ts",
|
|
10
|
+
"exports": {
|
|
11
|
+
".": {
|
|
12
|
+
"types": "./dist/index.d.ts",
|
|
13
|
+
"import": "./dist/index.js",
|
|
14
|
+
"require": "./dist/index.cjs"
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
"dependencies": {
|
|
18
|
+
"@tooluminati/core": "0.1.0"
|
|
19
|
+
},
|
|
20
|
+
"files": [
|
|
21
|
+
"dist"
|
|
22
|
+
],
|
|
23
|
+
"license": "MIT",
|
|
24
|
+
"publishConfig": {
|
|
25
|
+
"access": "public"
|
|
26
|
+
},
|
|
27
|
+
"repository": {
|
|
28
|
+
"type": "git",
|
|
29
|
+
"url": "git+https://github.com/jitterbox/Tooluminati.git",
|
|
30
|
+
"directory": "packages/state"
|
|
31
|
+
},
|
|
32
|
+
"bugs": {
|
|
33
|
+
"url": "https://github.com/jitterbox/Tooluminati/issues"
|
|
34
|
+
},
|
|
35
|
+
"homepage": "https://github.com/jitterbox/Tooluminati#readme",
|
|
36
|
+
"keywords": [
|
|
37
|
+
"tooluminati",
|
|
38
|
+
"webmcp",
|
|
39
|
+
"react",
|
|
40
|
+
"redux",
|
|
41
|
+
"tanstack-query"
|
|
42
|
+
],
|
|
43
|
+
"engines": {
|
|
44
|
+
"node": ">=18"
|
|
45
|
+
},
|
|
46
|
+
"scripts": {
|
|
47
|
+
"build": "tsup src/index.ts --format esm,cjs && tsc -p tsconfig.json --emitDeclarationOnly",
|
|
48
|
+
"typecheck": "tsc --noEmit"
|
|
49
|
+
}
|
|
50
|
+
}
|