toolcraft 0.0.307 → 0.0.308
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/composition.json +3 -3
- package/dist/composition.json +3 -3
- package/node_modules/tiny-http-mcp-server/dist/composition.json +1 -1
- package/node_modules/tiny-http-mcp-server/package.json +1 -1
- package/node_modules/tiny-mcp-client/dist/index.js +9 -3
- package/node_modules/tiny-stdio-mcp-server/dist/composition.json +1 -1
- package/node_modules/toolcraft-schema/README.md +7 -0
- package/node_modules/toolcraft-schema/dist/index.d.ts +1 -0
- package/node_modules/toolcraft-schema/dist/json.d.ts +5 -1
- package/node_modules/toolcraft-schema/dist/json.js +9 -3
- package/node_modules/toolcraft-schema/package.json +1 -1
- package/package.json +2 -2
package/composition.json
CHANGED
|
@@ -98,7 +98,7 @@
|
|
|
98
98
|
},
|
|
99
99
|
{
|
|
100
100
|
"name": "tiny-http-mcp-server",
|
|
101
|
-
"version": "0.1.
|
|
101
|
+
"version": "0.1.23",
|
|
102
102
|
"license": "MIT"
|
|
103
103
|
},
|
|
104
104
|
{
|
|
@@ -113,7 +113,7 @@
|
|
|
113
113
|
},
|
|
114
114
|
{
|
|
115
115
|
"name": "toolcraft",
|
|
116
|
-
"version": "0.0.
|
|
116
|
+
"version": "0.0.308",
|
|
117
117
|
"license": "MIT"
|
|
118
118
|
},
|
|
119
119
|
{
|
|
@@ -123,7 +123,7 @@
|
|
|
123
123
|
},
|
|
124
124
|
{
|
|
125
125
|
"name": "toolcraft-schema",
|
|
126
|
-
"version": "0.0.
|
|
126
|
+
"version": "0.0.308",
|
|
127
127
|
"license": "MIT"
|
|
128
128
|
},
|
|
129
129
|
{
|
package/dist/composition.json
CHANGED
|
@@ -98,7 +98,7 @@
|
|
|
98
98
|
},
|
|
99
99
|
{
|
|
100
100
|
"name": "tiny-http-mcp-server",
|
|
101
|
-
"version": "0.1.
|
|
101
|
+
"version": "0.1.23",
|
|
102
102
|
"license": "MIT"
|
|
103
103
|
},
|
|
104
104
|
{
|
|
@@ -113,7 +113,7 @@
|
|
|
113
113
|
},
|
|
114
114
|
{
|
|
115
115
|
"name": "toolcraft",
|
|
116
|
-
"version": "0.0.
|
|
116
|
+
"version": "0.0.308",
|
|
117
117
|
"license": "MIT"
|
|
118
118
|
},
|
|
119
119
|
{
|
|
@@ -123,7 +123,7 @@
|
|
|
123
123
|
},
|
|
124
124
|
{
|
|
125
125
|
"name": "toolcraft-schema",
|
|
126
|
-
"version": "0.0.
|
|
126
|
+
"version": "0.0.308",
|
|
127
127
|
"license": "MIT"
|
|
128
128
|
},
|
|
129
129
|
{
|
|
@@ -152,11 +152,17 @@ var HttpResponseMessages = class {
|
|
|
152
152
|
};
|
|
153
153
|
|
|
154
154
|
// ../toolcraft-schema/dist/json.js
|
|
155
|
-
function isJsonValue(value) {
|
|
155
|
+
function isJsonValue(value, options = {}) {
|
|
156
|
+
const maxNodes = options.maxNodes ?? 1e4;
|
|
157
|
+
const maxDepth = options.maxDepth ?? 64;
|
|
158
|
+
if (!Number.isSafeInteger(maxNodes) || maxNodes < 1)
|
|
159
|
+
throw new Error("maxNodes must be a positive safe integer");
|
|
160
|
+
if (!Number.isSafeInteger(maxDepth) || maxDepth < 0 || maxDepth > 256)
|
|
161
|
+
throw new Error("maxDepth must be an integer between 0 and 256");
|
|
156
162
|
const ancestors = /* @__PURE__ */ new Set();
|
|
157
163
|
let nodes = 0;
|
|
158
164
|
const visit = (item, depth) => {
|
|
159
|
-
if (++nodes >
|
|
165
|
+
if (++nodes > maxNodes || depth > maxDepth)
|
|
160
166
|
return false;
|
|
161
167
|
if (item === null || typeof item === "string" || typeof item === "boolean")
|
|
162
168
|
return true;
|
|
@@ -182,7 +188,7 @@ function isJsonValue(value) {
|
|
|
182
188
|
ancestors.add(item);
|
|
183
189
|
let valid = true;
|
|
184
190
|
if (Array.isArray(item)) {
|
|
185
|
-
if (item.length >
|
|
191
|
+
if (item.length > maxNodes)
|
|
186
192
|
valid = false;
|
|
187
193
|
else
|
|
188
194
|
for (let index = 0; index < item.length; index++) {
|
|
@@ -94,6 +94,13 @@ validate the complete object to enforce branch-dependent and combined constraint
|
|
|
94
94
|
Both functions accept a `registry` for external schema documents without network
|
|
95
95
|
fetching.
|
|
96
96
|
|
|
97
|
+
`isJsonValue(value, options)` checks JSON data without invoking getters or
|
|
98
|
+
serialization hooks. It rejects cycles, sparse arrays, non-finite numbers and
|
|
99
|
+
non-JSON prototypes. Defaults bound the tree to 10,000 nodes and depth 64.
|
|
100
|
+
Use `maxNodes` for larger bounded documents, or `maxDepth` (0–256) to choose a
|
|
101
|
+
depth budget. Shared objects count once for each occurrence in the JSON tree;
|
|
102
|
+
options never change other calls' budgets.
|
|
103
|
+
|
|
97
104
|
## Environment Variables
|
|
98
105
|
|
|
99
106
|
This package exposes no environment variables.
|
|
@@ -182,6 +182,7 @@ export declare function toJsonSchema(schema: AnySchema): JsonSchema;
|
|
|
182
182
|
export declare function toJsonSchemaDocument(schema: AnySchema, options?: JsonSchemaDocumentOptions): JsonSchemaDocument;
|
|
183
183
|
export { Json, OneOf, RecordBuilder as Record, Union, isPlainRecord, validate };
|
|
184
184
|
export { isJsonValue } from "./json.js";
|
|
185
|
+
export type { JsonValueValidationOptions } from "./json.js";
|
|
185
186
|
export { cloneDefaultValue } from "./clone-default.js";
|
|
186
187
|
export { unicodeLength } from "./json-schema/utils.js";
|
|
187
188
|
export { compileJsonSchema, formatIssues } from "./json-schema/index.js";
|
|
@@ -9,5 +9,9 @@ export interface JsonValueSchema extends SchemaBase<"json", JsonValue> {
|
|
|
9
9
|
readonly enum?: readonly JsonValue[];
|
|
10
10
|
}
|
|
11
11
|
export declare function Json(options?: Omit<JsonValueSchema, "kind">): JsonValueSchema;
|
|
12
|
-
export
|
|
12
|
+
export interface JsonValueValidationOptions {
|
|
13
|
+
readonly maxNodes?: number;
|
|
14
|
+
readonly maxDepth?: number;
|
|
15
|
+
}
|
|
16
|
+
export declare function isJsonValue(value: unknown, options?: JsonValueValidationOptions): boolean;
|
|
13
17
|
export {};
|
|
@@ -4,11 +4,17 @@ export function Json(options = {}) {
|
|
|
4
4
|
...options,
|
|
5
5
|
};
|
|
6
6
|
}
|
|
7
|
-
export function isJsonValue(value) {
|
|
7
|
+
export function isJsonValue(value, options = {}) {
|
|
8
|
+
const maxNodes = options.maxNodes ?? 10_000;
|
|
9
|
+
const maxDepth = options.maxDepth ?? 64;
|
|
10
|
+
if (!Number.isSafeInteger(maxNodes) || maxNodes < 1)
|
|
11
|
+
throw new Error("maxNodes must be a positive safe integer");
|
|
12
|
+
if (!Number.isSafeInteger(maxDepth) || maxDepth < 0 || maxDepth > 256)
|
|
13
|
+
throw new Error("maxDepth must be an integer between 0 and 256");
|
|
8
14
|
const ancestors = new Set();
|
|
9
15
|
let nodes = 0;
|
|
10
16
|
const visit = (item, depth) => {
|
|
11
|
-
if (++nodes >
|
|
17
|
+
if (++nodes > maxNodes || depth > maxDepth)
|
|
12
18
|
return false;
|
|
13
19
|
if (item === null || typeof item === "string" || typeof item === "boolean")
|
|
14
20
|
return true;
|
|
@@ -35,7 +41,7 @@ export function isJsonValue(value) {
|
|
|
35
41
|
ancestors.add(item);
|
|
36
42
|
let valid = true;
|
|
37
43
|
if (Array.isArray(item)) {
|
|
38
|
-
if (item.length >
|
|
44
|
+
if (item.length > maxNodes)
|
|
39
45
|
valid = false;
|
|
40
46
|
else
|
|
41
47
|
for (let index = 0; index < item.length; index++) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "toolcraft",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.308",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -158,7 +158,7 @@
|
|
|
158
158
|
"yaml"
|
|
159
159
|
],
|
|
160
160
|
"optionalDependencies": {
|
|
161
|
-
"toolcraft-schema": "0.0.
|
|
161
|
+
"toolcraft-schema": "0.0.308",
|
|
162
162
|
"toolcraft-design": "*",
|
|
163
163
|
"@poe-code/frontmatter": "*",
|
|
164
164
|
"@poe-code/agent-mcp-config": "*",
|