functionalscript 0.36.0 → 0.37.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.
Files changed (255) hide show
  1. package/fs/asn.1/module.f.js +1 -1
  2. package/fs/asserts/proof.f.js +1 -1
  3. package/fs/base_n/module.f.js +3 -3
  4. package/fs/base_n/proof.f.js +3 -3
  5. package/fs/{base128 → basen/base128}/module.f.d.ts +1 -1
  6. package/fs/{base128 → basen/base128}/module.f.js +1 -1
  7. package/fs/{base128 → basen/base128}/proof.f.js +3 -3
  8. package/fs/{base64 → basen/base64}/module.f.d.ts +2 -2
  9. package/fs/{base64 → basen/base64}/module.f.js +25 -15
  10. package/fs/{base64 → basen/base64}/proof.f.d.ts +1 -0
  11. package/fs/{base64 → basen/base64}/proof.f.js +11 -5
  12. package/fs/{cbase32 → basen/cbase32}/module.f.d.ts +2 -2
  13. package/fs/{cbase32 → basen/cbase32}/module.f.js +2 -2
  14. package/fs/{cbase32 → basen/cbase32}/proof.f.js +1 -1
  15. package/fs/bnf/data/module.f.js +4 -4
  16. package/fs/bnf/data/proof.f.js +6 -6
  17. package/fs/bnf/descent/module.f.js +6 -6
  18. package/fs/bnf/descent/proof.f.js +6 -6
  19. package/fs/bnf/ll1/module.f.js +9 -9
  20. package/fs/bnf/ll1/proof.f.js +6 -6
  21. package/fs/bnf/module.f.js +4 -4
  22. package/fs/bnf/proof.f.js +2 -2
  23. package/fs/bnf/testlib.f.js +1 -1
  24. package/fs/cas/cli/module.f.js +7 -7
  25. package/fs/cas/cli/proof.f.js +8 -8
  26. package/fs/cas/mcp/module.f.js +95 -55
  27. package/fs/cas/mcp/proof.f.d.ts +3 -1
  28. package/fs/cas/mcp/proof.f.js +79 -51
  29. package/fs/cas/module.f.js +10 -10
  30. package/fs/cas/proof.f.d.ts +4 -2
  31. package/fs/cas/proof.f.js +10 -10
  32. package/fs/ci/bun/module.f.js +2 -2
  33. package/fs/ci/common/module.f.d.ts +2 -2
  34. package/fs/ci/common/module.f.js +4 -4
  35. package/fs/ci/config/module.f.d.ts +19 -20
  36. package/fs/ci/config/module.f.js +3 -5
  37. package/fs/ci/deno/module.f.js +8 -4
  38. package/fs/ci/module.f.js +9 -9
  39. package/fs/ci/node/module.f.d.ts +1 -1
  40. package/fs/ci/node/module.f.js +3 -5
  41. package/fs/ci/playwright/module.f.js +3 -3
  42. package/fs/ci/proof.f.js +14 -14
  43. package/fs/ci/rust/module.f.js +2 -2
  44. package/fs/cli/module.f.js +3 -3
  45. package/fs/cli/proof.f.js +3 -3
  46. package/fs/{types → common}/monoid/module.f.d.ts +1 -1
  47. package/fs/crypto/hmac/module.f.js +2 -2
  48. package/fs/crypto/hmac/proof.f.js +5 -5
  49. package/fs/crypto/pow/module.f.js +3 -3
  50. package/fs/crypto/pow/proof.f.js +4 -4
  51. package/fs/crypto/secp/module.f.js +2 -2
  52. package/fs/crypto/secp/proof.f.js +3 -3
  53. package/fs/crypto/sha2/module.f.js +2 -2
  54. package/fs/crypto/sha2/proof.f.js +6 -6
  55. package/fs/crypto/sign/module.f.js +4 -4
  56. package/fs/crypto/vdf/module.f.js +1 -1
  57. package/fs/crypto/vdf/proof.f.js +1 -1
  58. package/fs/dev/module.f.js +6 -6
  59. package/fs/dev/package_json/module.f.js +6 -6
  60. package/fs/dev/package_json/proof.f.js +3 -3
  61. package/fs/dev/proof.f.js +2 -2
  62. package/fs/djs/ast/module.f.js +2 -2
  63. package/fs/djs/ast/proof.f.js +4 -4
  64. package/fs/djs/examples/m.f.d.ts +1 -1
  65. package/fs/djs/module.f.d.ts +1 -1
  66. package/fs/djs/module.f.js +5 -5
  67. package/fs/djs/parser/module.f.js +4 -4
  68. package/fs/djs/parser/proof.f.js +7 -7
  69. package/fs/djs/proof.f.js +3 -3
  70. package/fs/djs/serializer/module.f.js +6 -6
  71. package/fs/djs/serializer/proof.f.js +4 -4
  72. package/fs/djs/tokenizer/module.f.js +3 -3
  73. package/fs/djs/tokenizer/proof.f.js +5 -5
  74. package/fs/djs/tokenizer-new/proof.f.js +6 -6
  75. package/fs/djs/transpiler/module.f.d.ts +5 -0
  76. package/fs/djs/transpiler/module.f.js +21 -11
  77. package/fs/djs/transpiler/proof.f.js +5 -5
  78. package/fs/effects/memory/module.f.js +4 -4
  79. package/fs/effects/memory/proof.f.js +3 -3
  80. package/fs/effects/module.f.js +1 -1
  81. package/fs/effects/node/memory/module.js +2 -2
  82. package/fs/effects/node/memory/proof.js +3 -3
  83. package/fs/effects/node/module.f.js +7 -7
  84. package/fs/effects/node/module.js +10 -10
  85. package/fs/effects/node/virtual/module.f.js +7 -7
  86. package/fs/effects/node/virtual/proof.f.d.ts +1 -0
  87. package/fs/effects/node/virtual/proof.f.js +11 -4
  88. package/fs/effects/proof.f.js +2 -2
  89. package/fs/emergent_testing/all.test.js +2 -2
  90. package/fs/emergent_testing/example.f.d.ts +1 -1
  91. package/fs/emergent_testing/module.f.js +6 -6
  92. package/fs/emergent_testing/proof.f.d.ts +19 -17
  93. package/fs/emergent_testing/proof.f.js +7 -7
  94. package/fs/emergent_testing/scenarios/all.js +1 -1
  95. package/fs/fsc/bnf.f.js +2 -2
  96. package/fs/fsc/json.f.js +1 -1
  97. package/fs/fsc/module.f.js +7 -7
  98. package/fs/fsc/proof.f.js +4 -4
  99. package/fs/fsm/module.f.js +9 -9
  100. package/fs/fsm/proof.f.js +7 -7
  101. package/fs/js/tokenizer/module.f.js +7 -7
  102. package/fs/js/tokenizer/proof.f.js +5 -5
  103. package/fs/mcp/module.f.d.ts +13 -13
  104. package/fs/mcp/module.f.js +8 -8
  105. package/fs/mcp/proof.f.js +5 -5
  106. package/fs/mcp/stdio/module.f.d.ts +2 -2
  107. package/fs/mcp/stdio/module.f.js +10 -10
  108. package/fs/mcp/stdio/proof.f.js +10 -10
  109. package/fs/{html → media/html}/module.f.d.ts +3 -3
  110. package/fs/{html → media/html}/module.f.js +9 -9
  111. package/fs/media/json/module.f.d.ts +50 -0
  112. package/fs/{json → media/json}/module.f.js +7 -7
  113. package/fs/{json → media/json}/parser/module.f.d.ts +2 -2
  114. package/fs/{json → media/json}/parser/module.f.js +7 -7
  115. package/fs/{json → media/json}/parser/proof.f.js +6 -6
  116. package/fs/{json → media/json}/proof.f.js +4 -4
  117. package/fs/media/json/rpc/module.f.d.ts +114 -0
  118. package/fs/{json → media/json}/rpc/module.f.js +3 -3
  119. package/fs/{json → media/json}/rpc/proof.f.js +4 -4
  120. package/fs/media/json/schema/module.f.d.ts +78 -0
  121. package/fs/{json → media/json}/schema/module.f.js +2 -2
  122. package/fs/{json → media/json}/schema/proof.f.js +3 -3
  123. package/fs/{json → media/json}/serializer/module.f.d.ts +1 -1
  124. package/fs/{json → media/json}/serializer/module.f.js +2 -2
  125. package/fs/{json → media/json}/serializer/proof.f.js +2 -2
  126. package/fs/{json → media/json}/tokenizer/module.f.d.ts +2 -2
  127. package/fs/{json → media/json}/tokenizer/module.f.js +4 -4
  128. package/fs/{json → media/json}/tokenizer/proof.f.js +5 -5
  129. package/fs/media/module.f.d.ts +37 -0
  130. package/fs/media/module.f.js +24 -0
  131. package/fs/media/proof.f.d.ts +9 -0
  132. package/fs/media/proof.f.js +57 -0
  133. package/fs/media/revision/module.f.d.ts +51 -0
  134. package/fs/media/revision/module.f.js +110 -0
  135. package/fs/media/revision/proof.f.d.ts +29 -0
  136. package/fs/media/revision/proof.f.js +119 -0
  137. package/fs/{mime → media/type}/module.f.d.ts +6 -6
  138. package/fs/{mime → media/type}/module.f.js +6 -6
  139. package/fs/{mime → media/type}/proof.f.js +6 -6
  140. package/fs/module.f.d.ts +2 -0
  141. package/fs/{fjs/module.f.js → module.f.js} +8 -8
  142. package/fs/module.js +4 -0
  143. package/fs/path/module.f.js +2 -2
  144. package/fs/{fjs/proof.f.js → proof.f.js} +4 -4
  145. package/fs/sul/id/module.f.js +9 -9
  146. package/fs/sul/id/proof.f.js +5 -5
  147. package/fs/sul/level/hash/module.f.js +3 -3
  148. package/fs/sul/level/hash/proof.f.js +3 -3
  149. package/fs/sul/level/literal/module.f.js +5 -5
  150. package/fs/sul/level/literal/proof.f.js +3 -3
  151. package/fs/sul/module.f.js +3 -3
  152. package/fs/sul/proof.f.js +3 -3
  153. package/fs/text/ascii/proof.f.js +3 -3
  154. package/fs/text/code_point/module.f.js +2 -2
  155. package/fs/text/code_point/proof.f.js +1 -1
  156. package/fs/text/module.f.js +5 -5
  157. package/fs/text/proof.f.js +4 -4
  158. package/fs/text/sgr/module.f.js +2 -2
  159. package/fs/text/sgr/proof.f.js +2 -2
  160. package/fs/text/utf16/module.f.js +5 -5
  161. package/fs/text/utf16/proof.f.js +4 -4
  162. package/fs/text/utf8/module.f.js +22 -17
  163. package/fs/text/utf8/proof.f.js +5 -5
  164. package/fs/types/array/module.f.js +1 -1
  165. package/fs/types/array/proof.f.js +3 -3
  166. package/fs/types/bigfloat/module.f.js +1 -1
  167. package/fs/types/bigfloat/proof.f.js +1 -1
  168. package/fs/types/bigint/module.f.js +2 -2
  169. package/fs/types/bigint/proof.f.js +3 -3
  170. package/fs/types/bit_vec/module.f.js +8 -8
  171. package/fs/types/bit_vec/proof.f.js +5 -5
  172. package/fs/types/btree/find/module.f.js +1 -1
  173. package/fs/types/btree/find/proof.f.d.ts +3 -1
  174. package/fs/types/btree/find/proof.f.js +7 -7
  175. package/fs/types/btree/module.f.js +2 -2
  176. package/fs/types/btree/proof.f.d.ts +11 -5
  177. package/fs/types/btree/proof.f.js +7 -7
  178. package/fs/types/btree/remove/module.f.js +4 -4
  179. package/fs/types/btree/remove/proof.f.d.ts +5 -2
  180. package/fs/types/btree/remove/proof.f.js +5 -5
  181. package/fs/types/btree/set/module.f.js +3 -3
  182. package/fs/types/btree/set/proof.f.js +4 -4
  183. package/fs/types/byte_set/module.f.js +2 -2
  184. package/fs/types/byte_set/proof.f.js +4 -4
  185. package/fs/types/function/compare/proof.f.js +1 -1
  186. package/fs/types/function/operator/proof.f.d.ts +21 -10
  187. package/fs/types/function/operator/proof.f.js +1 -1
  188. package/fs/types/function/proof.f.js +1 -1
  189. package/fs/types/list/module.f.js +2 -2
  190. package/fs/types/list/proof.f.d.ts +15 -7
  191. package/fs/types/list/proof.f.js +4 -4
  192. package/fs/types/map/proof.f.js +2 -2
  193. package/fs/types/nibble_set/proof.f.js +2 -2
  194. package/fs/types/nullable/module.f.js +2 -2
  195. package/fs/types/nullable/proof.f.js +1 -1
  196. package/fs/types/number/module.f.js +5 -5
  197. package/fs/types/number/proof.f.js +1 -1
  198. package/fs/types/object/module.f.js +4 -4
  199. package/fs/types/object/proof.f.js +1 -1
  200. package/fs/types/ordered_map/module.f.js +6 -6
  201. package/fs/types/ordered_map/proof.f.js +3 -3
  202. package/fs/types/patricia_trie/proof.f.d.ts +11 -5
  203. package/fs/types/patricia_trie/proof.f.js +2 -2
  204. package/fs/types/prime_field/module.f.js +2 -2
  205. package/fs/types/prime_field/proof.f.js +2 -2
  206. package/fs/types/range/proof.f.js +1 -1
  207. package/fs/types/range_map/module.f.js +4 -4
  208. package/fs/types/range_map/proof.f.js +7 -7
  209. package/fs/types/result/module.js +1 -1
  210. package/fs/types/result/proof.f.d.ts +9 -4
  211. package/fs/types/rtti/common/module.f.js +4 -4
  212. package/fs/types/rtti/module.f.d.ts +2 -2
  213. package/fs/types/rtti/module.f.js +1 -1
  214. package/fs/types/rtti/parse/module.f.js +5 -5
  215. package/fs/types/rtti/parse/proof.f.js +2 -2
  216. package/fs/types/rtti/ts/module.f.js +1 -1
  217. package/fs/types/rtti/ts/proof.f.js +2 -2
  218. package/fs/types/rtti/validate/module.f.js +4 -4
  219. package/fs/types/rtti/validate/proof.f.js +2 -2
  220. package/fs/types/sorted_list/module.f.js +3 -3
  221. package/fs/types/sorted_list/proof.f.js +6 -6
  222. package/fs/types/sorted_set/module.f.js +1 -1
  223. package/fs/types/sorted_set/proof.f.js +6 -6
  224. package/fs/types/string/module.f.js +4 -4
  225. package/fs/types/string/proof.f.js +2 -2
  226. package/fs/types/string_set/module.f.js +6 -6
  227. package/fs/types/string_set/proof.f.js +1 -1
  228. package/fs/types/ts/proof.f.d.ts +18 -18
  229. package/fs/types/ts/proof.f.js +1 -1
  230. package/fs/types/uint8array/module.f.js +4 -4
  231. package/fs/types/uint8array/proof.f.js +4 -4
  232. package/fs/website/module.f.js +3 -3
  233. package/fs/website/proof.f.js +3 -3
  234. package/package.json +8 -8
  235. package/fs/fjs/module.f.d.ts +0 -2
  236. package/fs/fjs/module.js +0 -4
  237. package/fs/json/module.f.d.ts +0 -50
  238. package/fs/json/rpc/module.f.d.ts +0 -114
  239. package/fs/json/schema/module.f.d.ts +0 -77
  240. /package/fs/{base128 → basen/base128}/proof.f.d.ts +0 -0
  241. /package/fs/{cbase32 → basen/cbase32}/proof.f.d.ts +0 -0
  242. /package/fs/{types → common}/monoid/module.f.js +0 -0
  243. /package/fs/{types → common}/monoid/proof.f.d.ts +0 -0
  244. /package/fs/{types → common}/monoid/proof.f.js +0 -0
  245. /package/fs/{html → media/html}/proof.f.d.ts +0 -0
  246. /package/fs/{html → media/html}/proof.f.js +0 -0
  247. /package/fs/{json → media/json}/parser/proof.f.d.ts +0 -0
  248. /package/fs/{json → media/json}/proof.f.d.ts +0 -0
  249. /package/fs/{json → media/json}/rpc/proof.f.d.ts +0 -0
  250. /package/fs/{json → media/json}/schema/proof.f.d.ts +0 -0
  251. /package/fs/{json → media/json}/serializer/proof.f.d.ts +0 -0
  252. /package/fs/{json → media/json}/tokenizer/proof.f.d.ts +0 -0
  253. /package/fs/{mime → media/type}/proof.f.d.ts +0 -0
  254. /package/fs/{fjs/module.d.ts → module.d.ts} +0 -0
  255. /package/fs/{fjs/proof.f.d.ts → proof.f.d.ts} +0 -0
@@ -1,8 +1,8 @@
1
- import { type Unknown } from '../json/module.f.ts';
1
+ import { unknown, type Unknown } from '../media/json/module.f.ts';
2
2
  import type { Ts } from '../types/rtti/ts/module.f.ts';
3
3
  import { type Operation, type Effect } from '../effects/module.f.ts';
4
4
  import { type Key, type MemOp } from '../effects/memory/module.f.ts';
5
- import { type Response } from '../json/rpc/module.f.ts';
5
+ import { type Response } from '../media/json/rpc/module.f.ts';
6
6
  import type { Type } from '../types/rtti/module.f.ts';
7
7
  /** Name + version pair sent in `initialize` requests and responses. */
8
8
  export declare const implementation: {
@@ -20,7 +20,7 @@ export type ServerCapabilities = Ts<typeof serverCapabilities>;
20
20
  /** Params for the `initialize` request. */
21
21
  export declare const initializeParams: {
22
22
  readonly protocolVersion: import("../types/rtti/module.f.ts").String;
23
- readonly capabilities: () => readonly ["or", import("../types/rtti/module.f.ts").Or<[null, import("../types/rtti/module.f.ts").Boolean, import("../types/rtti/module.f.ts").Number, import("../types/rtti/module.f.ts").String]>, import("../types/rtti/module.f.ts").Type1<"record", /*elided*/ any>, import("../types/rtti/module.f.ts").Type1<"array", /*elided*/ any>];
23
+ readonly capabilities: typeof unknown;
24
24
  readonly clientInfo: {
25
25
  readonly name: import("../types/rtti/module.f.ts").String;
26
26
  readonly version: import("../types/rtti/module.f.ts").String;
@@ -44,7 +44,7 @@ export declare const initializeResult: {
44
44
  export type InitializeResult = Ts<typeof initializeResult>;
45
45
  /** Plain-text content item returned by a tool call. */
46
46
  export declare const textContent: {
47
- readonly type: "text";
47
+ readonly type: 'text';
48
48
  readonly text: import("../types/rtti/module.f.ts").String;
49
49
  };
50
50
  export type TextContent = Ts<typeof textContent>;
@@ -62,7 +62,7 @@ export declare const blobResource: {
62
62
  export type BlobResource = Ts<typeof blobResource>;
63
63
  /** An `EmbeddedResource` content item wrapping a {@link blobResource}. */
64
64
  export declare const embeddedResource: {
65
- readonly type: "resource";
65
+ readonly type: 'resource';
66
66
  readonly resource: {
67
67
  readonly uri: import("../types/rtti/module.f.ts").String;
68
68
  readonly mimeType: import("../types/rtti/module.f.ts").Or<readonly [import("../types/rtti/module.f.ts").String, undefined]>;
@@ -76,10 +76,10 @@ export type EmbeddedResource = Ts<typeof embeddedResource>;
76
76
  * `image` and `audio` variants are not modelled yet.
77
77
  */
78
78
  export declare const contentItem: import("../types/rtti/module.f.ts").Or<[{
79
- readonly type: "text";
79
+ readonly type: 'text';
80
80
  readonly text: import("../types/rtti/module.f.ts").String;
81
81
  }, {
82
- readonly type: "resource";
82
+ readonly type: 'resource';
83
83
  readonly resource: {
84
84
  readonly uri: import("../types/rtti/module.f.ts").String;
85
85
  readonly mimeType: import("../types/rtti/module.f.ts").Or<readonly [import("../types/rtti/module.f.ts").String, undefined]>;
@@ -95,7 +95,7 @@ export type ContentItem = Ts<typeof contentItem>;
95
95
  export declare const tool: {
96
96
  readonly name: import("../types/rtti/module.f.ts").String;
97
97
  readonly description: import("../types/rtti/module.f.ts").Or<readonly [import("../types/rtti/module.f.ts").String, undefined]>;
98
- readonly inputSchema: () => readonly ["or", import("../types/rtti/module.f.ts").Or<[null, import("../types/rtti/module.f.ts").Boolean, import("../types/rtti/module.f.ts").Number, import("../types/rtti/module.f.ts").String]>, import("../types/rtti/module.f.ts").Type1<"record", /*elided*/ any>, import("../types/rtti/module.f.ts").Type1<"array", /*elided*/ any>];
98
+ readonly inputSchema: typeof unknown;
99
99
  };
100
100
  export type Tool = Ts<typeof tool>;
101
101
  /**
@@ -110,22 +110,22 @@ export declare const toolsListResult: {
110
110
  readonly tools: import("../types/rtti/module.f.ts").Type1<"array", {
111
111
  readonly name: import("../types/rtti/module.f.ts").String;
112
112
  readonly description: import("../types/rtti/module.f.ts").Or<readonly [import("../types/rtti/module.f.ts").String, undefined]>;
113
- readonly inputSchema: () => readonly ["or", import("../types/rtti/module.f.ts").Or<[null, import("../types/rtti/module.f.ts").Boolean, import("../types/rtti/module.f.ts").Number, import("../types/rtti/module.f.ts").String]>, import("../types/rtti/module.f.ts").Type1<"record", /*elided*/ any>, import("../types/rtti/module.f.ts").Type1<"array", /*elided*/ any>];
113
+ readonly inputSchema: typeof unknown;
114
114
  }>;
115
115
  readonly nextCursor: import("../types/rtti/module.f.ts").Or<readonly [import("../types/rtti/module.f.ts").String, undefined]>;
116
116
  };
117
117
  export type ToolsListResult = Ts<typeof toolsListResult>;
118
118
  export declare const toolsCallParams: {
119
119
  readonly name: import("../types/rtti/module.f.ts").String;
120
- readonly arguments: import("../types/rtti/module.f.ts").Or<readonly [import("../types/rtti/module.f.ts").Type1<"record", () => readonly ["or", import("../types/rtti/module.f.ts").Or<[null, import("../types/rtti/module.f.ts").Boolean, import("../types/rtti/module.f.ts").Number, import("../types/rtti/module.f.ts").String]>, import("../types/rtti/module.f.ts").Type1<"record", /*elided*/ any>, import("../types/rtti/module.f.ts").Type1<"array", /*elided*/ any>]>, undefined]>;
120
+ readonly arguments: import("../types/rtti/module.f.ts").Or<readonly [import("../types/rtti/module.f.ts").Type1<"record", typeof unknown>, undefined]>;
121
121
  };
122
122
  export type ToolsCallParams = Ts<typeof toolsCallParams>;
123
123
  export declare const toolsCallResult: {
124
124
  readonly content: import("../types/rtti/module.f.ts").Type1<"array", import("../types/rtti/module.f.ts").Or<[{
125
- readonly type: "text";
125
+ readonly type: 'text';
126
126
  readonly text: import("../types/rtti/module.f.ts").String;
127
127
  }, {
128
- readonly type: "resource";
128
+ readonly type: 'resource';
129
129
  readonly resource: {
130
130
  readonly uri: import("../types/rtti/module.f.ts").String;
131
131
  readonly mimeType: import("../types/rtti/module.f.ts").Or<readonly [import("../types/rtti/module.f.ts").String, undefined]>;
@@ -191,7 +191,7 @@ export type Handle<O extends Operation> = (value: Unknown) => Effect<O, Response
191
191
  export declare const notInitialized: import("../types/rtti/ts/module.f.ts").StructTs<{
192
192
  readonly code: import("../types/rtti/module.f.ts").Number;
193
193
  readonly message: import("../types/rtti/module.f.ts").String;
194
- readonly data: import("../types/rtti/module.f.ts").Or<readonly [() => readonly ["or", import("../types/rtti/module.f.ts").Or<[null, import("../types/rtti/module.f.ts").Boolean, import("../types/rtti/module.f.ts").Number, import("../types/rtti/module.f.ts").String]>, import("../types/rtti/module.f.ts").Type1<"record", /*elided*/ any>, import("../types/rtti/module.f.ts").Type1<"array", /*elided*/ any>], undefined]>;
194
+ readonly data: import("../types/rtti/module.f.ts").Or<readonly [typeof unknown, undefined]>;
195
195
  }>;
196
196
  /** State carried before the peer sends `initialize`. */
197
197
  export type Uninitialized = readonly ['uninitialized'];
@@ -9,17 +9,17 @@
9
9
  *
10
10
  * Each schema is both a runtime decoder (`validate(schema)`) and a static
11
11
  * TypeScript type (`Ts<typeof schema>`). Transport framing (stdio) and the
12
- * JSON-RPC dispatcher are in `fs/json/rpc/module.f.ts`.
12
+ * JSON-RPC dispatcher are in `fs/media/json/rpc/module.f.ts`.
13
13
  *
14
14
  * @module
15
15
  */
16
- import { boolean, string, option, array, record, or } from "../types/rtti/module.f.js";
17
- import { unknown } from "../json/module.f.js";
18
- import { pure } from "../effects/module.f.js";
19
- import { read, write } from "../effects/memory/module.f.js";
20
- import { decodeRequest, rpcError, invalidRequest, invalidParams, methodNotFound, jsonrpc, } from "../json/rpc/module.f.js";
21
- import { validate } from "../types/rtti/validate/module.f.js";
22
- import { toJsonSchema } from "../json/schema/module.f.js";
16
+ import { boolean, string, option, array, record, or } from '../types/rtti/module.f.js';
17
+ import { unknown } from '../media/json/module.f.js';
18
+ import { pure } from '../effects/module.f.js';
19
+ import { read, write } from '../effects/memory/module.f.js';
20
+ import { decodeRequest, rpcError, invalidRequest, invalidParams, methodNotFound, jsonrpc, } from '../media/json/rpc/module.f.js';
21
+ import { validate } from '../types/rtti/validate/module.f.js';
22
+ import { toJsonSchema } from '../media/json/schema/module.f.js';
23
23
  // ── Shared ─────────────────────────────────────────────────────────────────────
24
24
  /** Name + version pair sent in `initialize` requests and responses. */
25
25
  export const implementation = {
package/fs/mcp/proof.f.js CHANGED
@@ -1,8 +1,8 @@
1
- import { assert, assertEq } from "../asserts/module.f.js";
2
- import { pure } from "../effects/module.f.js";
3
- import { run } from "../effects/mock/module.f.js";
4
- import { asBase, asNominal, create, read } from "../effects/memory/module.f.js";
5
- import { uninitializedState, mcpStep, notInitialized, } from "./module.f.js";
1
+ import { assert, assertEq } from '../asserts/module.f.js';
2
+ import { pure } from '../effects/module.f.js';
3
+ import { run } from '../effects/mock/module.f.js';
4
+ import { asBase, asNominal, create, read } from '../effects/memory/module.f.js';
5
+ import { uninitializedState, mcpStep, notInitialized, } from './module.f.js';
6
6
  const initial = { next: 0, values: {} };
7
7
  const mock = {
8
8
  memCreate: value => state => {
@@ -31,8 +31,8 @@
31
31
  */
32
32
  import { type Effect, type Operation } from '../../effects/module.f.ts';
33
33
  import { type Read, type Write } from '../../effects/node/module.f.ts';
34
- import { type Unknown } from '../../json/module.f.ts';
35
- import { type Response } from '../../json/rpc/module.f.ts';
34
+ import { type Unknown } from '../../media/json/module.f.ts';
35
+ import { type Response } from '../../media/json/rpc/module.f.ts';
36
36
  /**
37
37
  * A transport step: maps one parsed JSON-RPC message to a response, or `null`
38
38
  * for a notification that needs no reply. The shape of `mcpStep(config)(handlers)(key)`.
@@ -29,16 +29,16 @@
29
29
  *
30
30
  * @module
31
31
  */
32
- import { pure } from "../../effects/module.f.js";
33
- import { readLine, write } from "../../effects/node/module.f.js";
34
- import { tryUtf8 } from "../../text/module.f.js";
35
- import { stringToList } from "../../text/utf16/module.f.js";
36
- import { stringify } from "../../json/module.f.js";
37
- import { tokenize } from "../../json/tokenizer/module.f.js";
38
- import { parse } from "../../json/parser/module.f.js";
39
- import { sort } from "../../types/object/module.f.js";
40
- import { internalError, jsonrpc, parseError } from "../../json/rpc/module.f.js";
41
- import { error, ok } from "../../types/result/module.f.js";
32
+ import { pure } from '../../effects/module.f.js';
33
+ import { readLine, write } from '../../effects/node/module.f.js';
34
+ import { tryUtf8 } from '../../text/module.f.js';
35
+ import { stringToList } from '../../text/utf16/module.f.js';
36
+ import { stringify } from '../../media/json/module.f.js';
37
+ import { tokenize } from '../../media/json/tokenizer/module.f.js';
38
+ import { parse } from '../../media/json/parser/module.f.js';
39
+ import { sort } from '../../types/object/module.f.js';
40
+ import { internalError, jsonrpc, parseError } from '../../media/json/rpc/module.f.js';
41
+ import { error, ok } from '../../types/result/module.f.js';
42
42
  const stringifyJson = stringify(sort);
43
43
  /** The parse-error response (`-32700`, `id: null`) for a malformed input line. */
44
44
  const parseErrorResponse = { jsonrpc, error: parseError, id: null };
@@ -1,13 +1,13 @@
1
- import { assertEq } from "../../asserts/module.f.js";
2
- import { pure } from "../../effects/module.f.js";
3
- import { emptyState, virtual } from "../../effects/node/virtual/module.f.js";
4
- import { stringify } from "../../json/module.f.js";
5
- import { utf8 } from "../../text/module.f.js";
6
- import { fromVec } from "../../types/uint8array/module.f.js";
7
- import { maxLengthBytes } from "../../types/bit_vec/module.f.js";
8
- import { sort } from "../../types/object/module.f.js";
9
- import { internalError, jsonrpc, parseError } from "../../json/rpc/module.f.js";
10
- import { stdioTransport } from "./module.f.js";
1
+ import { assertEq } from '../../asserts/module.f.js';
2
+ import { pure } from '../../effects/module.f.js';
3
+ import { emptyState, virtual } from '../../effects/node/virtual/module.f.js';
4
+ import { stringify } from '../../media/json/module.f.js';
5
+ import { utf8 } from '../../text/module.f.js';
6
+ import { fromVec } from '../../types/uint8array/module.f.js';
7
+ import { maxLengthBytes } from '../../types/bit_vec/module.f.js';
8
+ import { sort } from '../../types/object/module.f.js';
9
+ import { internalError, jsonrpc, parseError } from '../../media/json/rpc/module.f.js';
10
+ import { stdioTransport } from './module.f.js';
11
11
  const stringifyJson = stringify(sort);
12
12
  // Extracts the request `id` (a request has one; a notification does not).
13
13
  const idOf = (value) => value !== null && typeof value === 'object' && !(value instanceof Array)
@@ -4,9 +4,9 @@
4
4
  *
5
5
  * @module
6
6
  */
7
- import { type List } from '../types/list/module.f.ts';
8
- import { type StringMap } from '../types/object/module.f.ts';
9
- import { type Vec } from '../types/bit_vec/module.f.ts';
7
+ import { type List } from '../../types/list/module.f.ts';
8
+ import { type StringMap } from '../../types/object/module.f.ts';
9
+ import { type Vec } from '../../types/bit_vec/module.f.ts';
10
10
  type Tag = string;
11
11
  type Element1 = readonly [Tag, ...Node[]];
12
12
  type Element2 = readonly [Tag, Attributes, ...Node[]];
@@ -4,15 +4,15 @@
4
4
  *
5
5
  * @module
6
6
  */
7
- import { map, flatMap, flat, concat as listConcat } from "../types/list/module.f.js";
8
- import { concat, concat as stringConcat } from "../types/string/module.f.js";
9
- import { definedEntries } from "../types/object/module.f.js";
10
- import { compose } from "../types/function/module.f.js";
11
- import { stringToList } from "../text/utf16/module.f.js";
12
- import { includes } from "../types/array/module.f.js";
13
- import {} from "../types/bit_vec/module.f.js";
14
- import { utf8 } from "../text/module.f.js";
15
- import { quotationMark, ampersand, lessThanSign, greaterThanSign } from "../text/ascii/module.f.js";
7
+ import { map, flatMap, flat, concat as listConcat } from '../../types/list/module.f.js';
8
+ import { concat, concat as stringConcat } from '../../types/string/module.f.js';
9
+ import { definedEntries } from '../../types/object/module.f.js';
10
+ import { compose } from '../../types/function/module.f.js';
11
+ import { stringToList } from '../../text/utf16/module.f.js';
12
+ import { includes } from '../../types/array/module.f.js';
13
+ import {} from '../../types/bit_vec/module.f.js';
14
+ import { utf8 } from '../../text/module.f.js';
15
+ import { quotationMark, ampersand, lessThanSign, greaterThanSign } from '../../text/ascii/module.f.js';
16
16
  const { fromCharCode } = String;
17
17
  /**
18
18
  * Void Elements
@@ -0,0 +1,50 @@
1
+ /**
2
+ * JSON value types, rtti schemas, and utilities: `serialize`, `stringify`,
3
+ * `parse`, and `setProperty` for immutable nested updates.
4
+ *
5
+ * The JSON value types (`Unknown`, `Primitive`) are derived from the rtti
6
+ * schemas defined here, so the schema is the single source of truth — no
7
+ * hand-written types to keep in sync.
8
+ *
9
+ * @module
10
+ */
11
+ import { type List } from '../../types/list/module.f.ts';
12
+ import { type Entry as ObjectEntry } from '../../types/object/module.f.ts';
13
+ import type { Ts } from '../../types/rtti/ts/module.f.ts';
14
+ /** rtti schema matching any JSON primitive: `null`, `boolean`, `number`, or `string`. */
15
+ export declare const primitive: import("../../types/rtti/module.f.ts").Or<[null, import("../../types/rtti/module.f.ts").Boolean, import("../../types/rtti/module.f.ts").Number, import("../../types/rtti/module.f.ts").String]>;
16
+ /**
17
+ * rtti schema matching any JSON value: a primitive, an array of JSON values,
18
+ * or an object whose values are JSON values. Self-referential via a thunk;
19
+ * rtti instantiates array/record item validators lazily so recursion terminates
20
+ * on acyclic input.
21
+ *
22
+ * A struct field typed `unknown` is **required when present** — unlike rtti
23
+ * core's `unknown`, the JSON `unknown` excludes `undefined`.
24
+ */
25
+ export declare const unknown: () => readonly ['or', import("../../types/rtti/module.f.ts").Or<[null, import("../../types/rtti/module.f.ts").Boolean, import("../../types/rtti/module.f.ts").Number, import("../../types/rtti/module.f.ts").String]>, import("../../types/rtti/module.f.ts").Type1<"record", () => readonly ['or', import("../../types/rtti/module.f.ts").Or<[null, import("../../types/rtti/module.f.ts").Boolean, import("../../types/rtti/module.f.ts").Number, import("../../types/rtti/module.f.ts").String]>, import("../../types/rtti/module.f.ts").Type1<"record", /*elided*/ any>, import("../../types/rtti/module.f.ts").Type1<"array", /*elided*/ any>]>, import("../../types/rtti/module.f.ts").Type1<"array", () => readonly ['or', import("../../types/rtti/module.f.ts").Or<[null, import("../../types/rtti/module.f.ts").Boolean, import("../../types/rtti/module.f.ts").Number, import("../../types/rtti/module.f.ts").String]>, import("../../types/rtti/module.f.ts").Type1<"record", any>, import("../../types/rtti/module.f.ts").Type1<"array", any>]>];
26
+ /**
27
+ * rtti schema matching a JSON object: `{ readonly [k: string]?: Unknown }`.
28
+ */
29
+ export declare const object: import("../../types/rtti/module.f.ts").Type1<"record", typeof unknown>;
30
+ /** rtti schema matching a JSON array: `readonly Unknown[]`. */
31
+ export declare const array: import("../../types/rtti/module.f.ts").Type1<"array", typeof unknown>;
32
+ export type Primitive = Ts<typeof primitive>;
33
+ export type Unknown = Object | Array | Primitive;
34
+ export type Object = {
35
+ readonly [k in string]?: Unknown;
36
+ };
37
+ export type Array = readonly Unknown[];
38
+ export declare const setProperty: (value: Unknown) => (path: List<string>) => (src: Unknown) => Unknown;
39
+ export type Entry = ObjectEntry<Unknown>;
40
+ type Entries = List<Entry>;
41
+ type MapEntries = (entries: Entries) => Entries;
42
+ export declare const serialize: (mapEntries: MapEntries) => (value: Unknown) => List<string>;
43
+ /**
44
+ * The standard `JSON.stringify` rules determined by
45
+ * https://262.ecma-international.org/6.0/#sec-ordinary-object-internal-methods-and-internal-slots-ownpropertykeys
46
+ * https://tc39.es/ecma262/#sec-serializejsonproperty
47
+ */
48
+ export declare const stringify: (mapEntries: MapEntries) => (value: Unknown) => string;
49
+ export declare const parse: (value: string) => Unknown;
50
+ export {};
@@ -8,12 +8,12 @@
8
8
  *
9
9
  * @module
10
10
  */
11
- import { next, flat, map } from "../types/list/module.f.js";
12
- import { concat } from "../types/string/module.f.js";
13
- import { at, definedEntries } from "../types/object/module.f.js";
14
- import { compose, fn } from "../types/function/module.f.js";
15
- import { objectWrap, arrayWrap, stringSerialize, numberSerialize, nullSerialize, boolSerialize } from "./serializer/module.f.js";
16
- import { boolean as rttiBoolean, number as rttiNumber, string as rttiString, or, record, array as rttiArray } from "../types/rtti/module.f.js";
11
+ import { next, flat, map } from '../../types/list/module.f.js';
12
+ import { concat } from '../../types/string/module.f.js';
13
+ import { at, definedEntries } from '../../types/object/module.f.js';
14
+ import { compose, fn } from '../../types/function/module.f.js';
15
+ import { objectWrap, arrayWrap, stringSerialize, numberSerialize, nullSerialize, boolSerialize } from './serializer/module.f.js';
16
+ import { boolean as rttiBoolean, number as rttiNumber, string as rttiString, or, record, array as rttiArray } from '../../types/rtti/module.f.js';
17
17
  // ── rtti schemas ──────────────────────────────────────────────────────────────
18
18
  /** rtti schema matching any JSON primitive: `null`, `boolean`, `number`, or `string`. */
19
19
  export const primitive = or(null, rttiBoolean, rttiNumber, rttiString);
@@ -54,7 +54,7 @@ export const serialize = sort => {
54
54
  f(v)
55
55
  ]);
56
56
  const mapPropertySerialize = map(propertySerialize);
57
- const objectSerialize = fn((definedEntries))
57
+ const objectSerialize = fn(definedEntries)
58
58
  .map(sort)
59
59
  .map(mapPropertySerialize)
60
60
  .map(objectWrap)
@@ -3,8 +3,8 @@
3
3
  *
4
4
  * @module
5
5
  */
6
- import { type Result } from '../../types/result/module.f.ts';
7
- import { type List } from '../../types/list/module.f.ts';
6
+ import { type Result } from '../../../types/result/module.f.ts';
7
+ import { type List } from '../../../types/list/module.f.ts';
8
8
  import { type JsonToken } from '../tokenizer/module.f.ts';
9
9
  import { type Unknown } from '../module.f.ts';
10
10
  /**
@@ -3,13 +3,13 @@
3
3
  *
4
4
  * @module
5
5
  */
6
- import { error, ok } from "../../types/result/module.f.js";
7
- import { fold, first, drop, toArray, concat } from "../../types/list/module.f.js";
8
- import {} from "../../types/function/operator/module.f.js";
9
- import {} from "../tokenizer/module.f.js";
10
- import { setReplace } from "../../types/ordered_map/module.f.js";
11
- import {} from "../module.f.js";
12
- import { fromMap } from "../../types/object/module.f.js";
6
+ import { error, ok } from '../../../types/result/module.f.js';
7
+ import { fold, first, drop, toArray, concat } from '../../../types/list/module.f.js';
8
+ import {} from '../../../types/function/operator/module.f.js';
9
+ import {} from '../tokenizer/module.f.js';
10
+ import { setReplace } from '../../../types/ordered_map/module.f.js';
11
+ import {} from '../module.f.js';
12
+ import { fromMap } from '../../../types/object/module.f.js';
13
13
  const addKeyToObject = obj => key => ({ kind: 'object', values: obj.values, key: key });
14
14
  const addValueToObject = obj => value => ({ kind: 'object', values: setReplace(obj.key)(value)(obj.values), key: '' });
15
15
  const addToArray = array => value => ({ kind: 'array', values: concat(array.values)([value]) });
@@ -1,9 +1,9 @@
1
- import { parse } from "./module.f.js";
2
- import { tokenize } from "../tokenizer/module.f.js";
3
- import { toArray } from "../../types/list/module.f.js";
4
- import { stringify as jsonStringify } from "../module.f.js";
5
- import { sort } from "../../types/object/module.f.js";
6
- import { stringToList } from "../../text/utf16/module.f.js";
1
+ import { parse } from './module.f.js';
2
+ import { tokenize } from '../tokenizer/module.f.js';
3
+ import { toArray } from '../../../types/list/module.f.js';
4
+ import { stringify as jsonStringify } from '../module.f.js';
5
+ import { sort } from '../../../types/object/module.f.js';
6
+ import { stringToList } from '../../../text/utf16/module.f.js';
7
7
  const tokenizeString = s => toArray(tokenize(stringToList(s)));
8
8
  const stringify = jsonStringify(sort);
9
9
  export const proof = {
@@ -1,7 +1,7 @@
1
- import { setProperty, stringify } from "./module.f.js";
2
- import { sort } from "../types/object/module.f.js";
3
- import { identity } from "../types/function/module.f.js";
4
- import { assertEq } from "../asserts/module.f.js";
1
+ import { setProperty, stringify } from './module.f.js';
2
+ import { sort } from '../../types/object/module.f.js';
3
+ import { identity } from '../../types/function/module.f.js';
4
+ import { assertEq } from '../../asserts/module.f.js';
5
5
  export const proof = {
6
6
  setProperty: [
7
7
  () => {
@@ -0,0 +1,114 @@
1
+ import type { Ts } from '../../../types/rtti/ts/module.f.ts';
2
+ import type { Result } from '../../../types/result/module.f.ts';
3
+ import { unknown, type Unknown } from '../module.f.ts';
4
+ export declare const jsonrpc: '2.0';
5
+ /** Request/response identifier: a string, a number, or `null`. */
6
+ declare const id: import("../../../types/rtti/module.f.ts").Or<[import("../../../types/rtti/module.f.ts").String, import("../../../types/rtti/module.f.ts").Number, null]>;
7
+ /**
8
+ * A request or notification envelope. `id` present → request (a response is
9
+ * expected); `id` absent → notification (no response). `params` is optional.
10
+ *
11
+ * https://www.jsonrpc.org/specification#request_object
12
+ */
13
+ export declare const request: {
14
+ readonly jsonrpc: "2.0";
15
+ readonly method: import("../../../types/rtti/module.f.ts").String;
16
+ readonly params: import("../../../types/rtti/module.f.ts").Or<readonly [typeof unknown, undefined]>;
17
+ readonly id: import("../../../types/rtti/module.f.ts").Or<readonly [import("../../../types/rtti/module.f.ts").Or<[import("../../../types/rtti/module.f.ts").String, import("../../../types/rtti/module.f.ts").Number, null]>, undefined]>;
18
+ };
19
+ /** The JSON-RPC error object. */
20
+ export declare const error: {
21
+ readonly code: import("../../../types/rtti/module.f.ts").Number;
22
+ readonly message: import("../../../types/rtti/module.f.ts").String;
23
+ readonly data: import("../../../types/rtti/module.f.ts").Or<readonly [typeof unknown, undefined]>;
24
+ };
25
+ export type Id = Ts<typeof id>;
26
+ export type Request = Ts<typeof request>;
27
+ export type RpcError = Ts<typeof error>;
28
+ export declare const successResponse: {
29
+ readonly jsonrpc: "2.0";
30
+ readonly result: typeof unknown;
31
+ readonly id: import("../../../types/rtti/module.f.ts").Or<[import("../../../types/rtti/module.f.ts").String, import("../../../types/rtti/module.f.ts").Number, null]>;
32
+ };
33
+ export declare const errorResponse: {
34
+ readonly jsonrpc: "2.0";
35
+ readonly error: {
36
+ readonly code: import("../../../types/rtti/module.f.ts").Number;
37
+ readonly message: import("../../../types/rtti/module.f.ts").String;
38
+ readonly data: import("../../../types/rtti/module.f.ts").Or<readonly [typeof unknown, undefined]>;
39
+ };
40
+ readonly id: import("../../../types/rtti/module.f.ts").Or<[import("../../../types/rtti/module.f.ts").String, import("../../../types/rtti/module.f.ts").Number, null]>;
41
+ };
42
+ /**
43
+ * A response envelope: either a success (`result`) or an error (`error`).
44
+ * Derived from the rtti schema via `Ts<>` — the same declaration is the
45
+ * runtime decoder and the static type, with no drift. rtti structs are open
46
+ * (extra keys allowed), so "result XOR error" is not enforced at runtime; in
47
+ * practice the dispatcher only ever constructs one or the other.
48
+ *
49
+ * https://www.jsonrpc.org/specification#response_object
50
+ */
51
+ export declare const response: import("../../../types/rtti/module.f.ts").Or<[{
52
+ readonly jsonrpc: "2.0";
53
+ readonly result: typeof unknown;
54
+ readonly id: import("../../../types/rtti/module.f.ts").Or<[import("../../../types/rtti/module.f.ts").String, import("../../../types/rtti/module.f.ts").Number, null]>;
55
+ }, {
56
+ readonly jsonrpc: "2.0";
57
+ readonly error: {
58
+ readonly code: import("../../../types/rtti/module.f.ts").Number;
59
+ readonly message: import("../../../types/rtti/module.f.ts").String;
60
+ readonly data: import("../../../types/rtti/module.f.ts").Or<readonly [typeof unknown, undefined]>;
61
+ };
62
+ readonly id: import("../../../types/rtti/module.f.ts").Or<[import("../../../types/rtti/module.f.ts").String, import("../../../types/rtti/module.f.ts").Number, null]>;
63
+ }]>;
64
+ export type Response = Ts<typeof response>;
65
+ /** Decodes an untrusted value as a JSON-RPC request / notification. */
66
+ export declare const decodeRequest: import("../../../types/rtti/common/module.f.ts").Validate<{
67
+ readonly jsonrpc: "2.0";
68
+ readonly method: import("../../../types/rtti/module.f.ts").String;
69
+ readonly params: import("../../../types/rtti/module.f.ts").Or<readonly [typeof unknown, undefined]>;
70
+ readonly id: import("../../../types/rtti/module.f.ts").Or<readonly [import("../../../types/rtti/module.f.ts").Or<[import("../../../types/rtti/module.f.ts").String, import("../../../types/rtti/module.f.ts").Number, null]>, undefined]>;
71
+ }>;
72
+ /** A method implementation: maps `params` to a result or an `RpcError`. */
73
+ export type Handler = (params: Unknown | undefined) => Result<Unknown, RpcError>;
74
+ /** A `method` name → `Handler` map. */
75
+ export type Handlers = {
76
+ readonly [method: string]: Handler;
77
+ };
78
+ /** Builds an `RpcError` with the given `code` and `message` (no `data`). */
79
+ export declare const rpcError: (code: number) => (message: string) => RpcError;
80
+ export declare const parseError: import("../../../types/rtti/ts/module.f.ts").StructTs<{
81
+ readonly code: import("../../../types/rtti/module.f.ts").Number;
82
+ readonly message: import("../../../types/rtti/module.f.ts").String;
83
+ readonly data: import("../../../types/rtti/module.f.ts").Or<readonly [typeof unknown, undefined]>;
84
+ }>;
85
+ export declare const invalidRequest: import("../../../types/rtti/ts/module.f.ts").StructTs<{
86
+ readonly code: import("../../../types/rtti/module.f.ts").Number;
87
+ readonly message: import("../../../types/rtti/module.f.ts").String;
88
+ readonly data: import("../../../types/rtti/module.f.ts").Or<readonly [typeof unknown, undefined]>;
89
+ }>;
90
+ export declare const methodNotFound: import("../../../types/rtti/ts/module.f.ts").StructTs<{
91
+ readonly code: import("../../../types/rtti/module.f.ts").Number;
92
+ readonly message: import("../../../types/rtti/module.f.ts").String;
93
+ readonly data: import("../../../types/rtti/module.f.ts").Or<readonly [typeof unknown, undefined]>;
94
+ }>;
95
+ export declare const invalidParams: import("../../../types/rtti/ts/module.f.ts").StructTs<{
96
+ readonly code: import("../../../types/rtti/module.f.ts").Number;
97
+ readonly message: import("../../../types/rtti/module.f.ts").String;
98
+ readonly data: import("../../../types/rtti/module.f.ts").Or<readonly [typeof unknown, undefined]>;
99
+ }>;
100
+ export declare const internalError: import("../../../types/rtti/ts/module.f.ts").StructTs<{
101
+ readonly code: import("../../../types/rtti/module.f.ts").Number;
102
+ readonly message: import("../../../types/rtti/module.f.ts").String;
103
+ readonly data: import("../../../types/rtti/module.f.ts").Or<readonly [typeof unknown, undefined]>;
104
+ }>;
105
+ /**
106
+ * Dispatches an already-parsed JSON-RPC value against `handlers`.
107
+ *
108
+ * - invalid envelope → `Invalid Request` (`-32600`) with `id: null`
109
+ * - notification (no `id`) → `null` (never a response)
110
+ * - unknown method → `Method not found` (`-32601`)
111
+ * - otherwise the handler's `ok` / `error` result becomes a success / error response
112
+ */
113
+ export declare const dispatch: (handlers: Handlers) => (value: Unknown) => Response | null;
114
+ export {};
@@ -14,9 +14,9 @@
14
14
  *
15
15
  * @module
16
16
  */
17
- import { number, string, or, option } from "../../types/rtti/module.f.js";
18
- import { validate } from "../../types/rtti/validate/module.f.js";
19
- import { unknown } from "../module.f.js";
17
+ import { number, string, or, option } from '../../../types/rtti/module.f.js';
18
+ import { validate } from '../../../types/rtti/validate/module.f.js';
19
+ import { unknown } from '../module.f.js';
20
20
  export const jsonrpc = '2.0';
21
21
  /** Request/response identifier: a string, a number, or `null`. */
22
22
  const id = or(string, number, null);
@@ -1,7 +1,7 @@
1
- import { assert, assertEq } from "../../asserts/module.f.js";
2
- import { ok, error } from "../../types/result/module.f.js";
3
- import { validate } from "../../types/rtti/validate/module.f.js";
4
- import { error as errorSchema, decodeRequest, dispatch, rpcError, parseError, invalidRequest, methodNotFound, invalidParams, internalError, } from "./module.f.js";
1
+ import { assert, assertEq } from '../../../asserts/module.f.js';
2
+ import { ok, error } from '../../../types/result/module.f.js';
3
+ import { validate } from '../../../types/rtti/validate/module.f.js';
4
+ import { error as errorSchema, decodeRequest, dispatch, rpcError, parseError, invalidRequest, methodNotFound, invalidParams, internalError, } from './module.f.js';
5
5
  const isOk = (r) => r[0] === 'ok';
6
6
  const handlers = {
7
7
  ping: () => ok('pong'),