toolcraft 0.0.224 → 0.0.225

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.
Files changed (64) hide show
  1. package/README.md +20 -3
  2. package/composition.json +4 -4
  3. package/dist/composition.json +4 -4
  4. package/node_modules/@poe-code/config-mutations/README.md +7 -0
  5. package/node_modules/@poe-code/frontmatter/README.md +2 -0
  6. package/node_modules/@poe-code/process-runner/README.md +2 -0
  7. package/node_modules/@poe-code/task-list/README.md +11 -0
  8. package/node_modules/smol-toml/README.md +249 -84
  9. package/node_modules/smol-toml/dist/date.d.ts +1 -0
  10. package/node_modules/smol-toml/dist/date.d.ts.map +1 -0
  11. package/node_modules/smol-toml/dist/date.js +1 -0
  12. package/node_modules/smol-toml/dist/date.js.map +1 -0
  13. package/node_modules/smol-toml/dist/error.d.ts +1 -0
  14. package/node_modules/smol-toml/dist/error.d.ts.map +1 -0
  15. package/node_modules/smol-toml/dist/error.js +1 -0
  16. package/node_modules/smol-toml/dist/error.js.map +1 -0
  17. package/node_modules/smol-toml/dist/extract.d.ts +1 -0
  18. package/node_modules/smol-toml/dist/extract.d.ts.map +1 -0
  19. package/node_modules/smol-toml/dist/extract.js +11 -10
  20. package/node_modules/smol-toml/dist/extract.js.map +1 -0
  21. package/node_modules/smol-toml/dist/index.cjs +658 -847
  22. package/node_modules/smol-toml/dist/index.cjs.map +1 -0
  23. package/node_modules/smol-toml/dist/index.d.ts +2 -1
  24. package/node_modules/smol-toml/dist/index.d.ts.map +1 -0
  25. package/node_modules/smol-toml/dist/index.js +1 -0
  26. package/node_modules/smol-toml/dist/index.js.map +1 -0
  27. package/node_modules/smol-toml/dist/parse.d.ts +1 -0
  28. package/node_modules/smol-toml/dist/parse.d.ts.map +1 -0
  29. package/node_modules/smol-toml/dist/parse.js +4 -4
  30. package/node_modules/smol-toml/dist/parse.js.map +1 -0
  31. package/node_modules/smol-toml/dist/primitive.d.ts +2 -1
  32. package/node_modules/smol-toml/dist/primitive.d.ts.map +1 -0
  33. package/node_modules/smol-toml/dist/primitive.js +130 -72
  34. package/node_modules/smol-toml/dist/primitive.js.map +1 -0
  35. package/node_modules/smol-toml/dist/stringify.d.ts +1 -0
  36. package/node_modules/smol-toml/dist/stringify.d.ts.map +1 -0
  37. package/node_modules/smol-toml/dist/stringify.js +2 -1
  38. package/node_modules/smol-toml/dist/stringify.js.map +1 -0
  39. package/node_modules/smol-toml/dist/struct.d.ts +1 -0
  40. package/node_modules/smol-toml/dist/struct.d.ts.map +1 -0
  41. package/node_modules/smol-toml/dist/struct.js +6 -11
  42. package/node_modules/smol-toml/dist/struct.js.map +1 -0
  43. package/node_modules/smol-toml/dist/util.d.ts +1 -1
  44. package/node_modules/smol-toml/dist/util.d.ts.map +1 -0
  45. package/node_modules/smol-toml/dist/util.js +3 -28
  46. package/node_modules/smol-toml/dist/util.js.map +1 -0
  47. package/node_modules/smol-toml/package.json +44 -34
  48. package/node_modules/smol-toml/src/date.ts +152 -0
  49. package/node_modules/smol-toml/src/error.ts +77 -0
  50. package/node_modules/smol-toml/src/extract.ts +112 -0
  51. package/node_modules/smol-toml/src/index.ts +42 -0
  52. package/node_modules/smol-toml/src/parse.ts +184 -0
  53. package/node_modules/smol-toml/src/primitive.ts +247 -0
  54. package/node_modules/smol-toml/src/stringify.ts +191 -0
  55. package/node_modules/smol-toml/src/struct.ts +199 -0
  56. package/node_modules/smol-toml/src/util.ts +101 -0
  57. package/node_modules/tiny-http-mcp-server/dist/composition.json +1 -1
  58. package/node_modules/tiny-http-mcp-server/package.json +1 -1
  59. package/node_modules/tiny-stdio-mcp-server/README.md +19 -3
  60. package/node_modules/tiny-stdio-mcp-server/dist/composition.json +1 -1
  61. package/node_modules/toolcraft-design/README.md +3 -3
  62. package/node_modules/toolcraft-schema/README.md +8 -5
  63. package/node_modules/toolcraft-schema/package.json +1 -1
  64. package/package.json +2 -2
@@ -0,0 +1,101 @@
1
+ /*!
2
+ * Copyright (c) Squirrel Chat et al., All rights reserved.
3
+ * SPDX-License-Identifier: BSD-3-Clause
4
+ *
5
+ * Redistribution and use in source and binary forms, with or without
6
+ * modification, are permitted provided that the following conditions are met:
7
+ *
8
+ * 1. Redistributions of source code must retain the above copyright notice, this
9
+ * list of conditions and the following disclaimer.
10
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
11
+ * this list of conditions and the following disclaimer in the
12
+ * documentation and/or other materials provided with the distribution.
13
+ * 3. Neither the name of the copyright holder nor the names of its contributors
14
+ * may be used to endorse or promote products derived from this software without
15
+ * specific prior written permission.
16
+ *
17
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
21
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
23
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
24
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
25
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
+ */
28
+
29
+ import type { TomlDate } from './date.js'
30
+ import { TomlError } from './error.js'
31
+
32
+ export type TomlPrimitive = string | number | bigint | boolean | TomlDate
33
+ export type TomlTable = { [key: string]: TomlValue }
34
+ export type TomlValue = TomlPrimitive | TomlValue[] | TomlTable
35
+
36
+ export type TomlTableWithoutBigInt = { [key: string]: TomlValueWithoutBigInt }
37
+ export type TomlValueWithoutBigInt = Exclude<TomlPrimitive, bigint> | TomlValueWithoutBigInt[] | TomlTableWithoutBigInt
38
+
39
+ export function indexOfNewline(str: string, start = 0, end = str.length) {
40
+ let idx = str.indexOf('\n', start)
41
+ if (str[idx - 1] === '\r') idx--
42
+ return idx <= end ? idx : -1
43
+ }
44
+
45
+ export function skipComment(str: string, ptr: number) {
46
+ for (let i = ptr; i < str.length; i++) {
47
+ let c = str[i]!
48
+ if (c === '\n')
49
+ return i
50
+
51
+ if (c === '\r' && str[i + 1] === '\n')
52
+ return i + 1
53
+
54
+ if ((c < '\x20' && c !== '\t') || c === '\x7f') {
55
+ throw new TomlError('control characters are not allowed in comments', {
56
+ toml: str,
57
+ ptr: ptr,
58
+ })
59
+ }
60
+ }
61
+
62
+ return str.length
63
+ }
64
+
65
+ export function skipVoid(str: string, ptr: number, banNewLines?: boolean, banComments?: boolean): number {
66
+ let c
67
+ while (1) {
68
+ while ((c = str[ptr]) === ' ' || c === '\t' || (!banNewLines && (c === '\n' || (c === '\r' && str[ptr + 1] === '\n')))) ptr++
69
+
70
+ // Tucking the return statement here would save 5 characters >:)
71
+ // But TypeScript fails to detect there is no way to exit the loop so it complains about the lack of final return
72
+ if (banComments || c !== '#') break
73
+
74
+ ptr = skipComment(str, ptr)
75
+ }
76
+
77
+ return ptr
78
+ }
79
+
80
+ export function skipUntil(str: string, ptr: number, sep: string, end?: string, banNewLines: boolean = false) {
81
+ if (!end) {
82
+ ptr = indexOfNewline(str, ptr)
83
+ return ptr < 0 ? str.length : ptr
84
+ }
85
+
86
+ for (let i = ptr; i < str.length; i++) {
87
+ let c = str[i]
88
+ if (c === '#') {
89
+ i = indexOfNewline(str, i)
90
+ } else if (c === sep) {
91
+ return i + 1
92
+ } else if (c === end || (banNewLines && (c === '\n' || (c === '\r' && str[i + 1] === '\n')))) {
93
+ return i
94
+ }
95
+ }
96
+
97
+ throw new TomlError('cannot find end of structure', {
98
+ toml: str,
99
+ ptr: ptr,
100
+ })
101
+ }
@@ -18,7 +18,7 @@
18
18
  },
19
19
  {
20
20
  "name": "tiny-http-mcp-server",
21
- "version": "0.1.15",
21
+ "version": "0.1.16",
22
22
  "license": "MIT"
23
23
  },
24
24
  {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tiny-http-mcp-server",
3
- "version": "0.1.15",
3
+ "version": "0.1.16",
4
4
  "description": "Minimal MCP server over HTTP built on tiny-stdio-mcp-server",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -95,6 +95,8 @@ Successful structured results must satisfy `outputSchema`. Validation failures u
95
95
 
96
96
  Tools whose natural result is prose, images, audio, files, or other content blocks should omit `outputSchema` and keep returning content.
97
97
 
98
+ Handlers can throw `ToolError` to return a JSON-RPC tool error with a specific code, message, and optional structured `data` payload. The server forwards that `data` field in the JSON-RPC error response so clients can inspect machine-readable failure details.
99
+
98
100
  ### `.listen()`
99
101
 
100
102
  Start listening on stdin/stdout (standard MCP stdio transport).
@@ -158,7 +160,7 @@ import { Image } from "tiny-stdio-mcp-server";
158
160
 
159
161
  server.tool("screenshot", "Take a screenshot", schema, async () => {
160
162
  return Image.fromBase64(base64Data, "image/png");
161
- // or: await Image.fromUrl("https://example.com/image.png")
163
+ // or: await Image.fromUrl("https://example.com/image.png", { maxBytes: 2 * 1024 * 1024 })
162
164
  // or: Image.fromBytes(uint8Array)
163
165
  });
164
166
  ```
@@ -172,13 +174,17 @@ import { Audio } from "tiny-stdio-mcp-server";
172
174
 
173
175
  server.tool("speak", "Text to speech", schema, async () => {
174
176
  return Audio.fromBase64(base64Data, "audio/mpeg");
175
- // or: await Audio.fromUrl("https://example.com/audio.mp3")
177
+ // or: await Audio.fromUrl("https://example.com/audio.mp3", { maxBytes: 2 * 1024 * 1024 })
176
178
  // or: Audio.fromBytes(uint8Array, "mp3")
177
179
  });
178
180
  ```
179
181
 
180
182
  Supported formats: MP3, WAV, OGG, M4A.
181
183
 
184
+ Remote helpers (`Image.fromUrl`, `Audio.fromUrl`, and `File.fromUrl`) cap downloads at
185
+ `DEFAULT_FROM_URL_MAX_BYTES` (5 MiB). Pass `{ maxBytes }` to set a positive integer byte limit per
186
+ call; responses that exceed the limit are rejected before being converted to content blocks.
187
+
182
188
  ### Files
183
189
 
184
190
  ```ts
@@ -187,7 +193,7 @@ import { File } from "tiny-stdio-mcp-server";
187
193
  server.tool("export", "Export data", schema, async () => {
188
194
  return File.fromText(csvContent, "text/csv");
189
195
  // or: File.fromBytes(uint8Array, "application/pdf")
190
- // or: await File.fromUrl("https://example.com/report.pdf")
196
+ // or: await File.fromUrl("https://example.com/report.pdf", { maxBytes: 2 * 1024 * 1024 })
191
197
  });
192
198
  ```
193
199
 
@@ -226,6 +232,16 @@ await cleanup();
226
232
 
227
233
  Requires `@modelcontextprotocol/sdk` as a dev dependency.
228
234
 
235
+ ## Environment variables
236
+
237
+ This package exposes no environment variables. Remote content helpers use the runtime `fetch`
238
+ implementation and do not read package-level configuration.
239
+
240
+ ## Configuration
241
+
242
+ There are no package-level config files. Configure each server in code with `createServer(options)`,
243
+ per-tool schemas, and per-call content helper options such as `maxBytes` for remote files.
244
+
229
245
  ## License
230
246
 
231
247
  MIT
@@ -8,7 +8,7 @@
8
8
  },
9
9
  {
10
10
  "name": "toolcraft-schema",
11
- "version": "0.0.224",
11
+ "version": "0.0.225",
12
12
  "license": "MIT"
13
13
  }
14
14
  ]
@@ -54,7 +54,7 @@ import { renderTable } from "toolcraft-design/render-table";
54
54
  - `helpFormatter`, `helpFormatterPlain`: styled and plain help formatting APIs.
55
55
  - `formatColumns`, `formatCommand`, `formatUsage`, `formatOption`, `formatCommandList`, `formatOptionList`: individual help-formatting functions.
56
56
  - `formatCommandNotFound`, `formatCommandNotFoundPanel`: command error rendering.
57
- - `renderTable`, `renderDetailCard`: tabular and detail-card rendering.
57
+ - `renderTable`, `renderDetailCard`, `renderInspectorCard`, `renderResourceBrowser`: tabular, detail-card, inspector-panel, and grouped resource-browser rendering.
58
58
  - `getTemplatePartialNames`, `renderTemplate`, `resolveTemplatePartials`: template rendering utilities.
59
59
  - `openExternal`: opens a URL or file with the platform browser command.
60
60
  - Types: `Color`, `LoggerOutput`, `CommandInfo`, `OptionInfo`, `FormatColumnsOptions`, `TableColumn`, `RenderTableOptions`, `DetailCardRow`, `DetailCardSection`, `RenderDetailCardOptions`, `RenderTemplateOptions`, `TemplateEscape`.
@@ -79,8 +79,8 @@ import { renderTable } from "toolcraft-design/render-table";
79
79
  ### Explorer
80
80
 
81
81
  - `explorer`: namespace containing the complete explorer API.
82
- - `runExplorer`, `singleDetail`: root-level explorer exports.
83
- - Root-level types: `Row`, `DetailItem`, `Detail`, `DetailCtx`, `Action`, `ActionContext`, `ExplorerConfig`, `ReorderContext`, `Tone`.
82
+ - `runExplorer`, `runTwoPaneExplorer`, `singleDetail`: root-level explorer exports.
83
+ - Root-level types: `Row`, `DetailItem`, `Detail`, `DetailCtx`, `Action`, `ActionContext`, `ExplorerConfig`, `ReorderContext`, `Tone`, `TwoPaneExplorerConfig`, `TwoPaneRow`, `TwoPaneAction`, `TwoPaneActionContext`.
84
84
  - The namespace also exports `createInitialState`, `resolveBindings`, and the remaining explorer event, binding, layout, size, state, and effect types.
85
85
 
86
86
  Explorers declare one to three list or detail panes. Printable input always filters; actions use optional Ctrl accelerators:
@@ -19,10 +19,10 @@ import { S, toJsonSchema, toJsonSchemaDocument, validateValue } from "toolcraft-
19
19
  import type { Static } from "toolcraft-schema";
20
20
 
21
21
  const schema = S.Object({
22
- name: S.String({ description: "User name" }),
23
- retries: S.Optional(S.Number({ default: 3 })),
22
+ name: S.String({ description: "User name", minLength: 1 }),
23
+ retries: S.Optional(S.Number({ default: 3, minimum: 0, jsonType: "integer" })),
24
24
  mode: S.Enum(["fast", "safe"] as const, { default: "safe" }),
25
- tags: S.Array(S.String(), { default: [] })
25
+ tags: S.Array(S.String(), { default: [], maxItems: 5 })
26
26
  });
27
27
 
28
28
  type Input = Static<typeof schema>;
@@ -64,15 +64,18 @@ const validation = validateValue(schema, {
64
64
 
65
65
  - `Static<typeof schema>` infers the runtime TypeScript shape for a schema descriptor.
66
66
  - Object properties wrapped in `S.Optional(...)` become optional properties in `Static`.
67
+ - Schemas declared with `nullable: true` infer `null` in `Static` and emit `nullable: true` in JSON Schema.
67
68
 
68
69
  ### JSON Schema generation
69
70
 
70
71
  - `toJsonSchema(schema)` converts any schema descriptor to standard JSON Schema.
71
72
  - `toJsonSchemaDocument(schema, options)` wraps `toJsonSchema(schema)` in a full JSON Schema document with `$schema`, optional `$id`, `title`, and `description`.
72
73
  - Object properties not wrapped in `S.Optional(...)` are emitted in `required`.
73
- - Defaults provided to schema builders are emitted as JSON Schema `default`.
74
- - Nested `S.Object(...)` schemas produce nested JSON Schema objects.
74
+ - Defaults provided to schema builders are emitted as JSON Schema `default` and must satisfy the schema.
75
+ - String, number, and array constraints are emitted as JSON Schema validation keywords.
76
+ - Nested `S.Object(...)` schemas produce nested JSON Schema objects. Object schemas default to `additionalProperties: false`; pass `additionalProperties: true` to allow unknown keys.
75
77
  - `S.Enum(...)` rejects empty or duplicate values at runtime for JavaScript callers.
78
+ - Invalid builder configuration fails fast, including invalid regex patterns, negative lengths/counts, inverted min/max pairs, non-finite numeric bounds, and integer schemas with non-integer defaults.
76
79
 
77
80
  ### Runtime validation
78
81
 
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "toolcraft-schema",
3
- "version": "0.0.224",
3
+ "version": "0.0.225",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "toolcraft",
3
- "version": "0.0.224",
3
+ "version": "0.0.225",
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.224",
161
+ "toolcraft-schema": "0.0.225",
162
162
  "toolcraft-design": "*",
163
163
  "@poe-code/frontmatter": "*",
164
164
  "@poe-code/agent-mcp-config": "*",