@casys/mcp-server 0.27.0 → 0.27.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (253) hide show
  1. package/CHANGELOG.md +6 -1770
  2. package/README.md +10 -638
  3. package/esm/mod.d.ts +1 -102
  4. package/esm/mod.js +1 -103
  5. package/package.json +17 -25
  6. package/esm/_dnt.polyfills.d.ts +0 -12
  7. package/esm/_dnt.polyfills.d.ts.map +0 -1
  8. package/esm/_dnt.polyfills.js +0 -15
  9. package/esm/_dnt.shims.d.ts +0 -2
  10. package/esm/_dnt.shims.d.ts.map +0 -1
  11. package/esm/_dnt.shims.js +0 -57
  12. package/esm/deps/jsr.io/@std/yaml/1.2.0/_chars.d.ts +0 -33
  13. package/esm/deps/jsr.io/@std/yaml/1.2.0/_chars.d.ts.map +0 -1
  14. package/esm/deps/jsr.io/@std/yaml/1.2.0/_chars.js +0 -48
  15. package/esm/deps/jsr.io/@std/yaml/1.2.0/_dumper_state.d.ts +0 -106
  16. package/esm/deps/jsr.io/@std/yaml/1.2.0/_dumper_state.d.ts.map +0 -1
  17. package/esm/deps/jsr.io/@std/yaml/1.2.0/_dumper_state.js +0 -636
  18. package/esm/deps/jsr.io/@std/yaml/1.2.0/_loader_state.d.ts +0 -67
  19. package/esm/deps/jsr.io/@std/yaml/1.2.0/_loader_state.d.ts.map +0 -1
  20. package/esm/deps/jsr.io/@std/yaml/1.2.0/_loader_state.js +0 -1393
  21. package/esm/deps/jsr.io/@std/yaml/1.2.0/_schema.d.ts +0 -44
  22. package/esm/deps/jsr.io/@std/yaml/1.2.0/_schema.d.ts.map +0 -1
  23. package/esm/deps/jsr.io/@std/yaml/1.2.0/_schema.js +0 -117
  24. package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/binary.d.ts +0 -3
  25. package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/binary.d.ts.map +0 -1
  26. package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/binary.js +0 -103
  27. package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/bool.d.ts +0 -3
  28. package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/bool.d.ts.map +0 -1
  29. package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/bool.js +0 -32
  30. package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/float.d.ts +0 -3
  31. package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/float.d.ts.map +0 -1
  32. package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/float.js +0 -96
  33. package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/int.d.ts +0 -3
  34. package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/int.d.ts.map +0 -1
  35. package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/int.js +0 -159
  36. package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/map.d.ts +0 -3
  37. package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/map.d.ts.map +0 -1
  38. package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/map.js +0 -14
  39. package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/merge.d.ts +0 -3
  40. package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/merge.d.ts.map +0 -1
  41. package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/merge.js +0 -10
  42. package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/nil.d.ts +0 -3
  43. package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/nil.d.ts.map +0 -1
  44. package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/nil.js +0 -22
  45. package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/omap.d.ts +0 -3
  46. package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/omap.d.ts.map +0 -1
  47. package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/omap.js +0 -29
  48. package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/pairs.d.ts +0 -3
  49. package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/pairs.d.ts.map +0 -1
  50. package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/pairs.js +0 -19
  51. package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/regexp.d.ts +0 -3
  52. package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/regexp.d.ts.map +0 -1
  53. package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/regexp.js +0 -30
  54. package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/seq.d.ts +0 -3
  55. package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/seq.d.ts.map +0 -1
  56. package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/seq.js +0 -10
  57. package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/set.d.ts +0 -3
  58. package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/set.d.ts.map +0 -1
  59. package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/set.js +0 -14
  60. package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/str.d.ts +0 -3
  61. package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/str.d.ts.map +0 -1
  62. package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/str.js +0 -9
  63. package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/timestamp.d.ts +0 -3
  64. package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/timestamp.d.ts.map +0 -1
  65. package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/timestamp.js +0 -81
  66. package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/undefined.d.ts +0 -3
  67. package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/undefined.d.ts.map +0 -1
  68. package/esm/deps/jsr.io/@std/yaml/1.2.0/_type/undefined.js +0 -20
  69. package/esm/deps/jsr.io/@std/yaml/1.2.0/_type.d.ts +0 -32
  70. package/esm/deps/jsr.io/@std/yaml/1.2.0/_type.d.ts.map +0 -1
  71. package/esm/deps/jsr.io/@std/yaml/1.2.0/_type.js +0 -6
  72. package/esm/deps/jsr.io/@std/yaml/1.2.0/_utils.d.ts +0 -4
  73. package/esm/deps/jsr.io/@std/yaml/1.2.0/_utils.d.ts.map +0 -1
  74. package/esm/deps/jsr.io/@std/yaml/1.2.0/_utils.js +0 -13
  75. package/esm/deps/jsr.io/@std/yaml/1.2.0/mod.d.ts +0 -51
  76. package/esm/deps/jsr.io/@std/yaml/1.2.0/mod.d.ts.map +0 -1
  77. package/esm/deps/jsr.io/@std/yaml/1.2.0/mod.js +0 -53
  78. package/esm/deps/jsr.io/@std/yaml/1.2.0/parse.d.ts +0 -79
  79. package/esm/deps/jsr.io/@std/yaml/1.2.0/parse.d.ts.map +0 -1
  80. package/esm/deps/jsr.io/@std/yaml/1.2.0/parse.js +0 -91
  81. package/esm/deps/jsr.io/@std/yaml/1.2.0/stringify.d.ts +0 -100
  82. package/esm/deps/jsr.io/@std/yaml/1.2.0/stringify.d.ts.map +0 -1
  83. package/esm/deps/jsr.io/@std/yaml/1.2.0/stringify.js +0 -33
  84. package/esm/deps/jsr.io/@std/yaml/1.2.0/types.d.ts +0 -111
  85. package/esm/deps/jsr.io/@std/yaml/1.2.0/types.d.ts.map +0 -1
  86. package/esm/deps/jsr.io/@std/yaml/1.2.0/types.js +0 -104
  87. package/esm/mod.d.ts.map +0 -1
  88. package/esm/package.json +0 -3
  89. package/esm/src/auth/as-metadata-proxy.d.ts +0 -112
  90. package/esm/src/auth/as-metadata-proxy.d.ts.map +0 -1
  91. package/esm/src/auth/as-metadata-proxy.js +0 -171
  92. package/esm/src/auth/config.d.ts +0 -117
  93. package/esm/src/auth/config.d.ts.map +0 -1
  94. package/esm/src/auth/config.js +0 -219
  95. package/esm/src/auth/jwt-provider.d.ts +0 -157
  96. package/esm/src/auth/jwt-provider.d.ts.map +0 -1
  97. package/esm/src/auth/jwt-provider.js +0 -187
  98. package/esm/src/auth/middleware.d.ts +0 -61
  99. package/esm/src/auth/middleware.d.ts.map +0 -1
  100. package/esm/src/auth/middleware.js +0 -209
  101. package/esm/src/auth/mod.d.ts +0 -23
  102. package/esm/src/auth/mod.d.ts.map +0 -1
  103. package/esm/src/auth/mod.js +0 -27
  104. package/esm/src/auth/multi-tenant-middleware.d.ts +0 -131
  105. package/esm/src/auth/multi-tenant-middleware.d.ts.map +0 -1
  106. package/esm/src/auth/multi-tenant-middleware.js +0 -128
  107. package/esm/src/auth/presets.d.ts +0 -231
  108. package/esm/src/auth/presets.d.ts.map +0 -1
  109. package/esm/src/auth/presets.js +0 -223
  110. package/esm/src/auth/provider.d.ts +0 -47
  111. package/esm/src/auth/provider.d.ts.map +0 -1
  112. package/esm/src/auth/provider.js +0 -34
  113. package/esm/src/auth/scope-middleware.d.ts +0 -30
  114. package/esm/src/auth/scope-middleware.d.ts.map +0 -1
  115. package/esm/src/auth/scope-middleware.js +0 -48
  116. package/esm/src/auth/static-token-provider.d.ts +0 -155
  117. package/esm/src/auth/static-token-provider.d.ts.map +0 -1
  118. package/esm/src/auth/static-token-provider.js +0 -256
  119. package/esm/src/auth/types.d.ts +0 -151
  120. package/esm/src/auth/types.d.ts.map +0 -1
  121. package/esm/src/auth/types.js +0 -64
  122. package/esm/src/client-auth/callback-server.d.ts +0 -34
  123. package/esm/src/client-auth/callback-server.d.ts.map +0 -1
  124. package/esm/src/client-auth/callback-server.js +0 -141
  125. package/esm/src/client-auth/client-id-metadata.d.ts +0 -29
  126. package/esm/src/client-auth/client-id-metadata.d.ts.map +0 -1
  127. package/esm/src/client-auth/client-id-metadata.js +0 -149
  128. package/esm/src/client-auth/connect.d.ts +0 -32
  129. package/esm/src/client-auth/connect.d.ts.map +0 -1
  130. package/esm/src/client-auth/connect.js +0 -47
  131. package/esm/src/client-auth/mod.d.ts +0 -19
  132. package/esm/src/client-auth/mod.d.ts.map +0 -1
  133. package/esm/src/client-auth/mod.js +0 -19
  134. package/esm/src/client-auth/provider.d.ts +0 -78
  135. package/esm/src/client-auth/provider.d.ts.map +0 -1
  136. package/esm/src/client-auth/provider.js +0 -246
  137. package/esm/src/client-auth/token-store/file-store.d.ts +0 -20
  138. package/esm/src/client-auth/token-store/file-store.d.ts.map +0 -1
  139. package/esm/src/client-auth/token-store/file-store.js +0 -62
  140. package/esm/src/client-auth/token-store/memory-store.d.ts +0 -14
  141. package/esm/src/client-auth/token-store/memory-store.d.ts.map +0 -1
  142. package/esm/src/client-auth/token-store/memory-store.js +0 -25
  143. package/esm/src/client-auth/types.d.ts +0 -89
  144. package/esm/src/client-auth/types.d.ts.map +0 -1
  145. package/esm/src/client-auth/types.js +0 -10
  146. package/esm/src/concurrency/rate-limiter.d.ts +0 -87
  147. package/esm/src/concurrency/rate-limiter.d.ts.map +0 -1
  148. package/esm/src/concurrency/rate-limiter.js +0 -165
  149. package/esm/src/concurrency/request-queue.d.ts +0 -71
  150. package/esm/src/concurrency/request-queue.d.ts.map +0 -1
  151. package/esm/src/concurrency/request-queue.js +0 -128
  152. package/esm/src/http/body.d.ts +0 -20
  153. package/esm/src/http/body.d.ts.map +0 -1
  154. package/esm/src/http/body.js +0 -63
  155. package/esm/src/http/request-guards.d.ts +0 -54
  156. package/esm/src/http/request-guards.d.ts.map +0 -1
  157. package/esm/src/http/request-guards.js +0 -114
  158. package/esm/src/http/wire.d.ts +0 -26
  159. package/esm/src/http/wire.d.ts.map +0 -1
  160. package/esm/src/http/wire.js +0 -35
  161. package/esm/src/inspector/launcher.d.ts +0 -48
  162. package/esm/src/inspector/launcher.d.ts.map +0 -1
  163. package/esm/src/inspector/launcher.js +0 -100
  164. package/esm/src/mcp-app.d.ts +0 -728
  165. package/esm/src/mcp-app.d.ts.map +0 -1
  166. package/esm/src/mcp-app.js +0 -3530
  167. package/esm/src/middleware/backpressure.d.ts +0 -24
  168. package/esm/src/middleware/backpressure.d.ts.map +0 -1
  169. package/esm/src/middleware/backpressure.js +0 -31
  170. package/esm/src/middleware/mod.d.ts +0 -11
  171. package/esm/src/middleware/mod.d.ts.map +0 -1
  172. package/esm/src/middleware/mod.js +0 -11
  173. package/esm/src/middleware/rate-limit.d.ts +0 -22
  174. package/esm/src/middleware/rate-limit.d.ts.map +0 -1
  175. package/esm/src/middleware/rate-limit.js +0 -33
  176. package/esm/src/middleware/runner.d.ts +0 -32
  177. package/esm/src/middleware/runner.d.ts.map +0 -1
  178. package/esm/src/middleware/runner.js +0 -49
  179. package/esm/src/middleware/types.d.ts +0 -76
  180. package/esm/src/middleware/types.d.ts.map +0 -1
  181. package/esm/src/middleware/types.js +0 -9
  182. package/esm/src/middleware/validation.d.ts +0 -24
  183. package/esm/src/middleware/validation.d.ts.map +0 -1
  184. package/esm/src/middleware/validation.js +0 -30
  185. package/esm/src/mrtr/capability-check.d.ts +0 -75
  186. package/esm/src/mrtr/capability-check.d.ts.map +0 -1
  187. package/esm/src/mrtr/capability-check.js +0 -233
  188. package/esm/src/mrtr/mod.d.ts +0 -18
  189. package/esm/src/mrtr/mod.d.ts.map +0 -1
  190. package/esm/src/mrtr/mod.js +0 -12
  191. package/esm/src/mrtr/replay-store.d.ts +0 -50
  192. package/esm/src/mrtr/replay-store.d.ts.map +0 -1
  193. package/esm/src/mrtr/replay-store.js +0 -61
  194. package/esm/src/mrtr/request-state.d.ts +0 -181
  195. package/esm/src/mrtr/request-state.d.ts.map +0 -1
  196. package/esm/src/mrtr/request-state.js +0 -313
  197. package/esm/src/mrtr/retry-guard.d.ts +0 -61
  198. package/esm/src/mrtr/retry-guard.d.ts.map +0 -1
  199. package/esm/src/mrtr/retry-guard.js +0 -53
  200. package/esm/src/mrtr/types.d.ts +0 -99
  201. package/esm/src/mrtr/types.d.ts.map +0 -1
  202. package/esm/src/mrtr/types.js +0 -14
  203. package/esm/src/observability/metrics.d.ts +0 -104
  204. package/esm/src/observability/metrics.d.ts.map +0 -1
  205. package/esm/src/observability/metrics.js +0 -207
  206. package/esm/src/observability/mod.d.ts +0 -12
  207. package/esm/src/observability/mod.d.ts.map +0 -1
  208. package/esm/src/observability/mod.js +0 -11
  209. package/esm/src/observability/otel.d.ts +0 -73
  210. package/esm/src/observability/otel.d.ts.map +0 -1
  211. package/esm/src/observability/otel.js +0 -260
  212. package/esm/src/runtime/runtime.d.ts +0 -10
  213. package/esm/src/runtime/runtime.d.ts.map +0 -1
  214. package/esm/src/runtime/runtime.deno.d.ts +0 -50
  215. package/esm/src/runtime/runtime.deno.d.ts.map +0 -1
  216. package/esm/src/runtime/runtime.deno.js +0 -120
  217. package/esm/src/runtime/runtime.js +0 -41
  218. package/esm/src/runtime/runtime.node.d.ts +0 -51
  219. package/esm/src/runtime/runtime.node.d.ts.map +0 -1
  220. package/esm/src/runtime/runtime.node.js +0 -268
  221. package/esm/src/runtime/types.d.ts +0 -107
  222. package/esm/src/runtime/types.d.ts.map +0 -1
  223. package/esm/src/runtime/types.js +0 -12
  224. package/esm/src/security/channel-hmac.d.ts +0 -43
  225. package/esm/src/security/channel-hmac.d.ts.map +0 -1
  226. package/esm/src/security/channel-hmac.js +0 -135
  227. package/esm/src/security/csp.d.ts +0 -50
  228. package/esm/src/security/csp.d.ts.map +0 -1
  229. package/esm/src/security/csp.js +0 -63
  230. package/esm/src/security/message-signer.d.ts +0 -88
  231. package/esm/src/security/message-signer.d.ts.map +0 -1
  232. package/esm/src/security/message-signer.js +0 -166
  233. package/esm/src/subscriptions/subscription-registry.d.ts +0 -256
  234. package/esm/src/subscriptions/subscription-registry.d.ts.map +0 -1
  235. package/esm/src/subscriptions/subscription-registry.js +0 -406
  236. package/esm/src/tasks/mod.d.ts +0 -13
  237. package/esm/src/tasks/mod.d.ts.map +0 -1
  238. package/esm/src/tasks/mod.js +0 -11
  239. package/esm/src/tasks/task-store.d.ts +0 -342
  240. package/esm/src/tasks/task-store.d.ts.map +0 -1
  241. package/esm/src/tasks/task-store.js +0 -649
  242. package/esm/src/transport/request-headers.d.ts +0 -145
  243. package/esm/src/transport/request-headers.d.ts.map +0 -1
  244. package/esm/src/transport/request-headers.js +0 -525
  245. package/esm/src/types.d.ts +0 -776
  246. package/esm/src/types.d.ts.map +0 -1
  247. package/esm/src/types.js +0 -92
  248. package/esm/src/ui/viewer-utils.d.ts +0 -45
  249. package/esm/src/ui/viewer-utils.d.ts.map +0 -1
  250. package/esm/src/ui/viewer-utils.js +0 -97
  251. package/esm/src/validation/schema-validator.d.ts +0 -115
  252. package/esm/src/validation/schema-validator.d.ts.map +0 -1
  253. package/esm/src/validation/schema-validator.js +0 -249
@@ -1,207 +0,0 @@
1
- /**
2
- * Server Metrics Collector for @casys/mcp-server
3
- *
4
- * In-memory counters, histograms, and gauges with Prometheus text format export.
5
- * Designed to be embedded in McpApp — no external dependencies.
6
- *
7
- * @module lib/server/observability/metrics
8
- */
9
- /**
10
- * Default histogram buckets (milliseconds)
11
- */
12
- const DEFAULT_BUCKETS = [5, 10, 25, 50, 100, 250, 500, 1000, 2500, 5000, 10000];
13
- function createHistogram(buckets = DEFAULT_BUCKETS) {
14
- return {
15
- buckets: buckets.map((le) => ({ le, count: 0 })),
16
- sum: 0,
17
- count: 0,
18
- };
19
- }
20
- function observeHistogram(histogram, value) {
21
- histogram.sum += value;
22
- histogram.count++;
23
- for (const bucket of histogram.buckets) {
24
- if (value <= bucket.le) {
25
- bucket.count++;
26
- }
27
- }
28
- }
29
- /**
30
- * Server metrics collector.
31
- *
32
- * @example
33
- * ```typescript
34
- * const metrics = new ServerMetrics();
35
- * metrics.recordToolCall("my_tool", true, 42);
36
- * console.log(metrics.toPrometheusFormat());
37
- * ```
38
- */
39
- export class ServerMetrics {
40
- startTime = Date.now();
41
- // Counters
42
- toolCallsTotal = 0;
43
- toolCallsSuccess = 0;
44
- toolCallsFailed = 0;
45
- requestsRateLimited = 0;
46
- requestsRejectedBackpressure = 0;
47
- authSuccess = 0;
48
- authFailed = 0;
49
- authCacheHits = 0;
50
- // Histogram
51
- toolCallDuration = createHistogram();
52
- // Per-tool breakdown
53
- perTool = new Map();
54
- // Gauges (set externally via setGauge)
55
- activeRequests = 0;
56
- queuedRequests = 0;
57
- rateLimiterKeys = 0;
58
- /**
59
- * Record a completed tool call
60
- */
61
- recordToolCall(toolName, success, durationMs) {
62
- this.toolCallsTotal++;
63
- if (success) {
64
- this.toolCallsSuccess++;
65
- }
66
- else {
67
- this.toolCallsFailed++;
68
- }
69
- observeHistogram(this.toolCallDuration, durationMs);
70
- // Per-tool
71
- let pt = this.perTool.get(toolName);
72
- if (!pt) {
73
- pt = { calls: 0, success: 0, failed: 0, totalDurationMs: 0 };
74
- this.perTool.set(toolName, pt);
75
- }
76
- pt.calls++;
77
- if (success)
78
- pt.success++;
79
- else
80
- pt.failed++;
81
- pt.totalDurationMs += durationMs;
82
- }
83
- recordRateLimited() {
84
- this.requestsRateLimited++;
85
- }
86
- recordBackpressureRejected() {
87
- this.requestsRejectedBackpressure++;
88
- }
89
- recordAuth(success) {
90
- if (success)
91
- this.authSuccess++;
92
- else
93
- this.authFailed++;
94
- }
95
- recordAuthCacheHit() {
96
- this.authCacheHits++;
97
- }
98
- /**
99
- * Update gauge values (called periodically or on-demand)
100
- */
101
- setGauges(gauges) {
102
- if (gauges.activeRequests !== undefined) {
103
- this.activeRequests = gauges.activeRequests;
104
- }
105
- if (gauges.queuedRequests !== undefined) {
106
- this.queuedRequests = gauges.queuedRequests;
107
- }
108
- if (gauges.rateLimiterKeys !== undefined) {
109
- this.rateLimiterKeys = gauges.rateLimiterKeys;
110
- }
111
- }
112
- /**
113
- * Get current metrics snapshot
114
- */
115
- getSnapshot() {
116
- return {
117
- counters: {
118
- tool_calls_total: this.toolCallsTotal,
119
- tool_calls_success: this.toolCallsSuccess,
120
- tool_calls_failed: this.toolCallsFailed,
121
- requests_rate_limited: this.requestsRateLimited,
122
- requests_rejected_backpressure: this.requestsRejectedBackpressure,
123
- auth_success: this.authSuccess,
124
- auth_failed: this.authFailed,
125
- auth_cache_hits: this.authCacheHits,
126
- },
127
- histograms: {
128
- tool_call_duration_ms: { ...this.toolCallDuration },
129
- },
130
- gauges: {
131
- active_requests: this.activeRequests,
132
- queued_requests: this.queuedRequests,
133
- rate_limiter_keys: this.rateLimiterKeys,
134
- },
135
- collected_at: Date.now(),
136
- uptime_seconds: Math.floor((Date.now() - this.startTime) / 1000),
137
- };
138
- }
139
- /**
140
- * Prometheus text format export
141
- */
142
- toPrometheusFormat(prefix = "mcp_server") {
143
- const m = this.getSnapshot();
144
- const lines = [];
145
- // --- Counters ---
146
- const counter = (name, help, value) => {
147
- lines.push(`# HELP ${prefix}_${name} ${help}`);
148
- lines.push(`# TYPE ${prefix}_${name} counter`);
149
- lines.push(`${prefix}_${name} ${value}`);
150
- };
151
- counter("tool_calls_total", "Total tool calls", m.counters.tool_calls_total);
152
- counter("tool_calls_success_total", "Successful tool calls", m.counters.tool_calls_success);
153
- counter("tool_calls_failed_total", "Failed tool calls", m.counters.tool_calls_failed);
154
- counter("requests_rate_limited_total", "Requests rejected by rate limiter", m.counters.requests_rate_limited);
155
- counter("requests_backpressure_total", "Requests rejected by backpressure", m.counters.requests_rejected_backpressure);
156
- counter("auth_success_total", "Successful auth verifications", m.counters.auth_success);
157
- counter("auth_failed_total", "Failed auth verifications", m.counters.auth_failed);
158
- counter("auth_cache_hits_total", "Auth token cache hits", m.counters.auth_cache_hits);
159
- // --- Per-tool counters ---
160
- lines.push(`# HELP ${prefix}_tool_calls_by_name Tool calls by tool name`);
161
- lines.push(`# TYPE ${prefix}_tool_calls_by_name counter`);
162
- for (const [name, pt] of this.perTool) {
163
- lines.push(`${prefix}_tool_calls_by_name{tool="${name}",status="success"} ${pt.success}`);
164
- lines.push(`${prefix}_tool_calls_by_name{tool="${name}",status="failed"} ${pt.failed}`);
165
- }
166
- // --- Histogram ---
167
- const h = m.histograms.tool_call_duration_ms;
168
- lines.push(`# HELP ${prefix}_tool_call_duration_ms Tool call duration in milliseconds`);
169
- lines.push(`# TYPE ${prefix}_tool_call_duration_ms histogram`);
170
- for (const bucket of h.buckets) {
171
- lines.push(`${prefix}_tool_call_duration_ms_bucket{le="${bucket.le}"} ${bucket.count}`);
172
- }
173
- lines.push(`${prefix}_tool_call_duration_ms_bucket{le="+Inf"} ${h.count}`);
174
- lines.push(`${prefix}_tool_call_duration_ms_sum ${h.sum}`);
175
- lines.push(`${prefix}_tool_call_duration_ms_count ${h.count}`);
176
- // --- Gauges ---
177
- const gauge = (name, help, value) => {
178
- lines.push(`# HELP ${prefix}_${name} ${help}`);
179
- lines.push(`# TYPE ${prefix}_${name} gauge`);
180
- lines.push(`${prefix}_${name} ${value}`);
181
- };
182
- gauge("active_requests", "Currently executing requests", m.gauges.active_requests);
183
- gauge("queued_requests", "Requests waiting in queue", m.gauges.queued_requests);
184
- gauge("rate_limiter_keys", "Tracked rate limiter keys", m.gauges.rate_limiter_keys);
185
- gauge("uptime_seconds", "Server uptime in seconds", m.uptime_seconds);
186
- return lines.join("\n") + "\n";
187
- }
188
- /**
189
- * Reset all metrics
190
- */
191
- reset() {
192
- this.toolCallsTotal = 0;
193
- this.toolCallsSuccess = 0;
194
- this.toolCallsFailed = 0;
195
- this.requestsRateLimited = 0;
196
- this.requestsRejectedBackpressure = 0;
197
- this.authSuccess = 0;
198
- this.authFailed = 0;
199
- this.authCacheHits = 0;
200
- this.toolCallDuration = createHistogram();
201
- this.perTool.clear();
202
- this.activeRequests = 0;
203
- this.queuedRequests = 0;
204
- this.rateLimiterKeys = 0;
205
- this.startTime = Date.now();
206
- }
207
- }
@@ -1,12 +0,0 @@
1
- /**
2
- * Observability module for @casys/mcp-server
3
- *
4
- * - OTel tracing (spans on tool calls, auth events)
5
- * - Metrics collection (counters, histograms, gauges)
6
- * - Prometheus text format export
7
- *
8
- * @module lib/server/observability
9
- */
10
- export { endToolCallSpan, getServerTracer, isOtelEnabled, parseTraceParent, recordAuthEvent, startToolCallSpan, type ToolCallSpanAttributes, } from "./otel.js";
11
- export { ServerMetrics, type ServerMetricsSnapshot } from "./metrics.js";
12
- //# sourceMappingURL=mod.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../../src/src/observability/mod.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EACL,eAAe,EACf,eAAe,EACf,aAAa,EACb,gBAAgB,EAChB,eAAe,EACf,iBAAiB,EACjB,KAAK,sBAAsB,GAC5B,MAAM,WAAW,CAAC;AAEnB,OAAO,EAAE,aAAa,EAAE,KAAK,qBAAqB,EAAE,MAAM,cAAc,CAAC"}
@@ -1,11 +0,0 @@
1
- /**
2
- * Observability module for @casys/mcp-server
3
- *
4
- * - OTel tracing (spans on tool calls, auth events)
5
- * - Metrics collection (counters, histograms, gauges)
6
- * - Prometheus text format export
7
- *
8
- * @module lib/server/observability
9
- */
10
- export { endToolCallSpan, getServerTracer, isOtelEnabled, parseTraceParent, recordAuthEvent, startToolCallSpan, } from "./otel.js";
11
- export { ServerMetrics } from "./metrics.js";
@@ -1,73 +0,0 @@
1
- /**
2
- * OpenTelemetry Integration for @casys/mcp-server
3
- *
4
- * Provides tracing for tool calls, auth, and middleware pipeline.
5
- *
6
- * Enable with:
7
- * - Deno: OTEL_DENO=true deno run --unstable-otel ...
8
- * - Node.js: OTEL_ENABLED=true node ...
9
- *
10
- * @module lib/server/observability/otel
11
- */
12
- import { type Span, type SpanContext, type Tracer } from "@opentelemetry/api";
13
- /**
14
- * Parse a W3C trace context into an OTel `SpanContext` (spec 2026-07-28).
15
- *
16
- * The revision documents `traceparent` / `tracestate` / `baggage` as `_meta`
17
- * keys so a tool call joins the caller's trace instead of starting a detached
18
- * one. Returns `undefined` for anything malformed — a bad header leaves the span
19
- * unparented, it never fails the call.
20
- *
21
- * Version handling follows the W3C forward-compatibility rule, which is not
22
- * "reject anything unfamiliar":
23
- *
24
- * - `ff` is forbidden outright.
25
- * - `00` is a fixed 55-character format; anything longer is malformed.
26
- * - a higher version MAY carry fields this implementation does not know. The
27
- * receiver parses the first 55 characters and ignores the rest, provided the
28
- * next character is a `-`. Rejecting those would make this server drop trace
29
- * context the day a new version ships — the exact breakage the rule exists to
30
- * prevent.
31
- */
32
- export declare function parseTraceParent(traceparent: unknown, tracestate?: unknown): SpanContext | undefined;
33
- /**
34
- * Get or create the MCP server tracer
35
- */
36
- export declare function getServerTracer(): Tracer;
37
- /**
38
- * Span attributes for MCP tool calls
39
- */
40
- export interface ToolCallSpanAttributes {
41
- "mcp.tool.name": string;
42
- "mcp.server.name"?: string;
43
- "mcp.transport"?: string;
44
- "mcp.session.id"?: string;
45
- "mcp.auth.subject"?: string;
46
- "mcp.auth.client_id"?: string;
47
- [key: string]: string | number | boolean | undefined;
48
- }
49
- /**
50
- * Start a span for a tool call.
51
- * Caller MUST call span.end() when done.
52
- *
53
- * `remoteParent` is the caller's trace context, read from the request's `_meta`
54
- * (spec 2026-07-28). With it the span joins the caller's trace; without it the
55
- * span falls back to the active context, which is what every call produced
56
- * before the `_meta` keys were wired in — a server-side trace nobody could
57
- * correlate to the client that caused it.
58
- */
59
- export declare function startToolCallSpan(toolName: string, attributes: ToolCallSpanAttributes, remoteParent?: SpanContext): Span;
60
- /**
61
- * Record a tool call result on a span and end it.
62
- */
63
- export declare function endToolCallSpan(span: Span, success: boolean, durationMs: number, error?: string): void;
64
- /**
65
- * Record an auth event as a fire-and-forget span.
66
- */
67
- export declare function recordAuthEvent(event: "verify" | "reject" | "cache_hit", attributes: Record<string, string | number | boolean | undefined>): void;
68
- /**
69
- * Check if OTEL is enabled.
70
- * Deno: OTEL_DENO=true | Node.js: OTEL_ENABLED=true
71
- */
72
- export declare function isOtelEnabled(): boolean;
73
- //# sourceMappingURL=otel.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"otel.d.ts","sourceRoot":"","sources":["../../../src/src/observability/otel.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAGL,KAAK,IAAI,EACT,KAAK,WAAW,EAIhB,KAAK,MAAM,EAEZ,MAAM,oBAAoB,CAAC;AAwI5B;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,gBAAgB,CAC9B,WAAW,EAAE,OAAO,EACpB,UAAU,CAAC,EAAE,OAAO,GACnB,WAAW,GAAG,SAAS,CAqCzB;AAgBD;;GAEG;AACH,wBAAgB,eAAe,IAAI,MAAM,CAKxC;AAED;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC,eAAe,EAAE,MAAM,CAAC;IACxB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC;CACtD;AAED;;;;;;;;;GASG;AACH,wBAAgB,iBAAiB,CAC/B,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,sBAAsB,EAClC,YAAY,CAAC,EAAE,WAAW,GACzB,IAAI,CAON;AAED;;GAEG;AACH,wBAAgB,eAAe,CAC7B,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,OAAO,EAChB,UAAU,EAAE,MAAM,EAClB,KAAK,CAAC,EAAE,MAAM,GACb,IAAI,CAcN;AAED;;GAEG;AACH,wBAAgB,eAAe,CAC7B,KAAK,EAAE,QAAQ,GAAG,QAAQ,GAAG,WAAW,EACxC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC,GAChE,IAAI,CAQN;AAED;;;GAGG;AACH,wBAAgB,aAAa,IAAI,OAAO,CAOvC"}
@@ -1,260 +0,0 @@
1
- /**
2
- * OpenTelemetry Integration for @casys/mcp-server
3
- *
4
- * Provides tracing for tool calls, auth, and middleware pipeline.
5
- *
6
- * Enable with:
7
- * - Deno: OTEL_DENO=true deno run --unstable-otel ...
8
- * - Node.js: OTEL_ENABLED=true node ...
9
- *
10
- * @module lib/server/observability/otel
11
- */
12
- import { context as otelContext, SpanStatusCode, trace, TraceFlags, } from "@opentelemetry/api";
13
- import { env } from "../runtime/runtime.js";
14
- let serverTracer = null;
15
- /**
16
- * W3C `traceparent`: `<2 hex version>-<32 hex trace-id>-<16 hex parent-id>-<2 hex flags>`.
17
- *
18
- * Matches the 55-character prefix only — the trailing-content rule depends on
19
- * the version and is applied separately, see {@link parseTraceParent}.
20
- *
21
- * Case-sensitive on purpose. The spec mandates lowercase hex, and accepting
22
- * uppercase produces a trace id that will not match the same trace elsewhere in
23
- * the pipeline: a silently broken join is worse than a dropped header.
24
- */
25
- const TRACEPARENT = /^([0-9a-f]{2})-([0-9a-f]{32})-([0-9a-f]{16})-([0-9a-f]{2})/;
26
- /** `00-` + 32 + `-` + 16 + `-` + 2 = 55. */
27
- const TRACEPARENT_PREFIX_LENGTH = 55;
28
- /** All-zero ids are explicitly invalid in the W3C spec. */
29
- const INVALID_TRACE_ID = "0".repeat(32);
30
- const INVALID_SPAN_ID = "0".repeat(16);
31
- /** W3C caps `tracestate` at 32 list members; the rest are dropped. */
32
- const TRACESTATE_MAX_MEMBERS = 32;
33
- /**
34
- * W3C `tracestate` key, both forms of the ABNF:
35
- * - simple: `lcalpha 0*255(lcalpha / DIGIT / "_" / "-" / "*" / "/")`
36
- * - multi-tenant: `tenant-id "@" system-id`
37
- */
38
- const TRACESTATE_KEY = /^(?:[a-z][a-z0-9_\-*/]{0,255}|[a-z0-9][a-z0-9_\-*/]{0,240}@[a-z][a-z0-9_\-*/]{0,13})$/;
39
- /**
40
- * W3C `tracestate` value — the ABNF is `0*255(chr) nblk-chr`:
41
- *
42
- * - `chr` is printable ASCII except comma and equals. `=` inside a value is
43
- * forbidden, so a member carrying one is malformed, not a value to preserve.
44
- * - the final character is `nblk-chr`, which additionally excludes SP. That
45
- * makes the value **non-empty** and forbids a trailing space, so `vendor=`
46
- * is not a valid member.
47
- */
48
- const TRACESTATE_VALUE = /^[\x20-\x2B\x2D-\x3C\x3E-\x7E]{0,255}[\x21-\x2B\x2D-\x3C\x3E-\x7E]$/;
49
- /**
50
- * The grammar's optional whitespace around a list member is SP and HTAB only.
51
- * `String.trim()` also eats CR, LF, FF, VT and Unicode spaces — none of which
52
- * are legal separators here, so trimming with it would silently accept a
53
- * malformed list.
54
- */
55
- function trimOws(member) {
56
- return member.replace(/^[ \t]+/, "").replace(/[ \t]+$/, "");
57
- }
58
- /**
59
- * `tracestate` carried to the next hop.
60
- *
61
- * `@opentelemetry/api` declares the interface but ships no implementation —
62
- * that lives in `@opentelemetry/core`. Pulling in the SDK package for one
63
- * key/value list would put a second OTel dependency in the public API, so this
64
- * is the minimum that satisfies the interface.
65
- *
66
- * Members are validated against the W3C ABNF rather than passed through: the
67
- * spec permits discarding invalid entries, and this list is re-serialised onto
68
- * the next hop — accepting a malformed member here means emitting a malformed
69
- * `tracestate` downstream, turning one peer's bug into ours.
70
- */
71
- class ListTraceState {
72
- #entries;
73
- constructor(entries) {
74
- this.#entries = entries;
75
- }
76
- static #isValid(key, value) {
77
- return TRACESTATE_KEY.test(key) && TRACESTATE_VALUE.test(value);
78
- }
79
- static parse(raw) {
80
- const seen = new Set();
81
- const entries = [];
82
- for (const member of raw.split(",")) {
83
- // Optional whitespace around a list member is part of the grammar; the
84
- // key and value themselves are matched exactly.
85
- const trimmed = trimOws(member);
86
- if (trimmed.length === 0)
87
- continue;
88
- const at = trimmed.indexOf("=");
89
- if (at <= 0)
90
- continue;
91
- const key = trimmed.slice(0, at);
92
- const value = trimmed.slice(at + 1);
93
- // Duplicate keys are invalid; the first occurrence is the live one.
94
- if (seen.has(key))
95
- continue;
96
- if (!ListTraceState.#isValid(key, value))
97
- continue;
98
- seen.add(key);
99
- entries.push([key, value]);
100
- if (entries.length === TRACESTATE_MAX_MEMBERS)
101
- break;
102
- }
103
- return entries.length > 0 ? new ListTraceState(entries) : undefined;
104
- }
105
- get(key) {
106
- return this.#entries.find(([k]) => k === key)?.[1];
107
- }
108
- set(key, value) {
109
- // Returns the state unchanged rather than throwing. The OpenTelemetry
110
- // specification is explicit that "API methods MUST NOT throw unhandled
111
- // exceptions when used incorrectly by end users" — telemetry is not worth
112
- // taking an application down for. Rejecting the mutation still keeps the
113
- // invalid member off the wire, which is the property that matters.
114
- if (!ListTraceState.#isValid(key, value))
115
- return this;
116
- // W3C: a mutated key moves to the front of the list.
117
- return new ListTraceState([
118
- [key, value],
119
- ...this.#entries.filter(([k]) => k !== key),
120
- ].slice(0, TRACESTATE_MAX_MEMBERS));
121
- }
122
- unset(key) {
123
- return new ListTraceState(this.#entries.filter(([k]) => k !== key));
124
- }
125
- serialize() {
126
- return this.#entries.map(([k, v]) => `${k}=${v}`).join(",");
127
- }
128
- }
129
- /**
130
- * Parse a W3C trace context into an OTel `SpanContext` (spec 2026-07-28).
131
- *
132
- * The revision documents `traceparent` / `tracestate` / `baggage` as `_meta`
133
- * keys so a tool call joins the caller's trace instead of starting a detached
134
- * one. Returns `undefined` for anything malformed — a bad header leaves the span
135
- * unparented, it never fails the call.
136
- *
137
- * Version handling follows the W3C forward-compatibility rule, which is not
138
- * "reject anything unfamiliar":
139
- *
140
- * - `ff` is forbidden outright.
141
- * - `00` is a fixed 55-character format; anything longer is malformed.
142
- * - a higher version MAY carry fields this implementation does not know. The
143
- * receiver parses the first 55 characters and ignores the rest, provided the
144
- * next character is a `-`. Rejecting those would make this server drop trace
145
- * context the day a new version ships — the exact breakage the rule exists to
146
- * prevent.
147
- */
148
- export function parseTraceParent(traceparent, tracestate) {
149
- if (typeof traceparent !== "string")
150
- return undefined;
151
- if (traceparent.length < TRACEPARENT_PREFIX_LENGTH)
152
- return undefined;
153
- const match = TRACEPARENT.exec(traceparent);
154
- if (!match)
155
- return undefined;
156
- const [, version, traceId, spanId, flags] = match;
157
- if (version === "ff")
158
- return undefined;
159
- if (version === "00") {
160
- if (traceparent.length !== TRACEPARENT_PREFIX_LENGTH)
161
- return undefined;
162
- }
163
- else if (traceparent.length > TRACEPARENT_PREFIX_LENGTH &&
164
- traceparent[TRACEPARENT_PREFIX_LENGTH] !== "-") {
165
- // Longer, but not a well-formed continuation: the extra characters are not
166
- // a new field, so the whole header is suspect.
167
- return undefined;
168
- }
169
- if (traceId === INVALID_TRACE_ID || spanId === INVALID_SPAN_ID) {
170
- return undefined;
171
- }
172
- const traceState = typeof tracestate === "string"
173
- ? ListTraceState.parse(tracestate)
174
- : undefined;
175
- return {
176
- traceId,
177
- spanId,
178
- // Only the sampled bit is defined; the rest of the byte is reserved.
179
- traceFlags: (parseInt(flags, 16) & TraceFlags.SAMPLED),
180
- isRemote: true,
181
- ...(traceState ? { traceState } : {}),
182
- };
183
- }
184
- /**
185
- * The OTel context a remote `SpanContext` should parent, or the active one.
186
- *
187
- * Note the fallback is the *active* context, not `ROOT_CONTEXT`: with no
188
- * caller-supplied trace context the span attaches to whatever span is active in
189
- * this process, and only becomes a root when there is none. That is the right
190
- * default — it preserves in-process nesting — but it means "no traceparent" and
191
- * "root span" are not synonyms.
192
- */
193
- function parentContext(remote) {
194
- const active = otelContext.active();
195
- return remote ? trace.setSpanContext(active, remote) : active;
196
- }
197
- /**
198
- * Get or create the MCP server tracer
199
- */
200
- export function getServerTracer() {
201
- if (!serverTracer) {
202
- serverTracer = trace.getTracer("mcp.server", "0.8.0");
203
- }
204
- return serverTracer;
205
- }
206
- /**
207
- * Start a span for a tool call.
208
- * Caller MUST call span.end() when done.
209
- *
210
- * `remoteParent` is the caller's trace context, read from the request's `_meta`
211
- * (spec 2026-07-28). With it the span joins the caller's trace; without it the
212
- * span falls back to the active context, which is what every call produced
213
- * before the `_meta` keys were wired in — a server-side trace nobody could
214
- * correlate to the client that caused it.
215
- */
216
- export function startToolCallSpan(toolName, attributes, remoteParent) {
217
- const tracer = getServerTracer();
218
- return tracer.startSpan(`mcp.tool.call ${toolName}`, { attributes }, parentContext(remoteParent));
219
- }
220
- /**
221
- * Record a tool call result on a span and end it.
222
- */
223
- export function endToolCallSpan(span, success, durationMs, error) {
224
- span.setAttribute("mcp.tool.duration_ms", durationMs);
225
- span.setAttribute("mcp.tool.success", success);
226
- if (error) {
227
- span.setAttribute("mcp.tool.error", error);
228
- span.recordException(new Error(error));
229
- }
230
- span.setStatus({
231
- code: success ? SpanStatusCode.OK : SpanStatusCode.ERROR,
232
- message: error,
233
- });
234
- span.end();
235
- }
236
- /**
237
- * Record an auth event as a fire-and-forget span.
238
- */
239
- export function recordAuthEvent(event, attributes) {
240
- const tracer = getServerTracer();
241
- tracer.startActiveSpan(`mcp.auth.${event}`, { attributes }, (span) => {
242
- span.setStatus({
243
- code: event === "reject" ? SpanStatusCode.ERROR : SpanStatusCode.OK,
244
- });
245
- span.end();
246
- });
247
- }
248
- /**
249
- * Check if OTEL is enabled.
250
- * Deno: OTEL_DENO=true | Node.js: OTEL_ENABLED=true
251
- */
252
- export function isOtelEnabled() {
253
- try {
254
- return env("OTEL_DENO") === "true" || env("OTEL_ENABLED") === "true";
255
- }
256
- catch {
257
- // Deno without --allow-env throws NotCapable
258
- return false;
259
- }
260
- }
@@ -1,10 +0,0 @@
1
- export type { FetchHandler, ServeHandle, ServeOptions } from "./types.js";
2
- export declare const env: import("./types.js").EnvFn;
3
- export declare const readTextFile: import("./types.js").ReadTextFileFn;
4
- export declare const writeTextFile: import("./types.js").WriteTextFileFn;
5
- export declare const mkdir: import("./types.js").MkdirFn;
6
- export declare const remove: import("./types.js").RemoveFn;
7
- export declare const readDir: import("./types.js").ReadDirFn;
8
- export declare const serve: import("./types.js").ServeFn;
9
- export declare const unrefTimer: import("./types.js").UnrefTimerFn;
10
- //# sourceMappingURL=runtime.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../../../src/src/runtime/runtime.ts"],"names":[],"mappings":"AA+BA,YAAY,EAAE,YAAY,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAa1E,eAAO,MAAM,GAAG,4BAAW,CAAC;AAC5B,eAAO,MAAM,YAAY,qCAAoB,CAAC;AAC9C,eAAO,MAAM,aAAa,sCAAqB,CAAC;AAChD,eAAO,MAAM,KAAK,8BAAa,CAAC;AAChC,eAAO,MAAM,MAAM,+BAAc,CAAC;AAClC,eAAO,MAAM,OAAO,gCAAe,CAAC;AACpC,eAAO,MAAM,KAAK,8BAAa,CAAC;AAChC,eAAO,MAAM,UAAU,mCAAkB,CAAC"}
@@ -1,50 +0,0 @@
1
- /**
2
- * Runtime adapter — Deno implementation
3
- *
4
- * Implements the RuntimePort contract for Deno.
5
- * Selected automatically by runtime.ts (the selector) when running under Deno.
6
- *
7
- * @see types.ts for the port contract
8
- * @module lib/server/runtime.deno
9
- */
10
- import type { FetchHandler, ServeHandle, ServeOptions } from "./types.js";
11
- export type { FetchHandler, ServeHandle, ServeOptions } from "./types.js";
12
- /**
13
- * Get an environment variable.
14
- */
15
- export declare function env(key: string): string | undefined;
16
- /**
17
- * Read a UTF-8 text file.
18
- * Returns null if the file does not exist.
19
- */
20
- export declare function readTextFile(path: string): Promise<string | null>;
21
- /**
22
- * Write a UTF-8 text file.
23
- */
24
- export declare function writeTextFile(path: string, content: string, opts?: {
25
- mode?: number;
26
- }): Promise<void>;
27
- /**
28
- * Create a directory.
29
- */
30
- export declare function mkdir(path: string, opts?: {
31
- recursive?: boolean;
32
- mode?: number;
33
- }): Promise<void>;
34
- /**
35
- * Remove a file or empty directory. No-op if absent.
36
- */
37
- export declare function remove(path: string): Promise<void>;
38
- /**
39
- * Read directory entry names. Returns [] if absent.
40
- */
41
- export declare function readDir(path: string): Promise<string[]>;
42
- /**
43
- * Start an HTTP server with a fetch-style handler.
44
- */
45
- export declare function serve(options: ServeOptions, handler: FetchHandler): ServeHandle;
46
- /**
47
- * Unref a timer so it doesn't block process exit.
48
- */
49
- export declare function unrefTimer(id: number): void;
50
- //# sourceMappingURL=runtime.deno.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"runtime.deno.d.ts","sourceRoot":"","sources":["../../../src/src/runtime/runtime.deno.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EACV,YAAY,EAEZ,WAAW,EACX,YAAY,EACb,MAAM,YAAY,CAAC;AAGpB,YAAY,EAAE,YAAY,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE1E;;GAEG;AACH,wBAAgB,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAEnD;AAED;;;GAGG;AACH,wBAAsB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CASvE;AAED;;GAEG;AACH,wBAAsB,aAAa,CACjC,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,MAAM,EACf,IAAI,CAAC,EAAE;IAAE,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,GACvB,OAAO,CAAC,IAAI,CAAC,CAEf;AAED;;GAEG;AACH,wBAAsB,KAAK,CACzB,IAAI,EAAE,MAAM,EACZ,IAAI,CAAC,EAAE;IAAE,SAAS,CAAC,EAAE,OAAO,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,GAC5C,OAAO,CAAC,IAAI,CAAC,CAEf;AAED;;GAEG;AACH,wBAAsB,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CASxD;AAED;;GAEG;AACH,wBAAsB,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAa7D;AAED;;GAEG;AACH,wBAAgB,KAAK,CACnB,OAAO,EAAE,YAAY,EACrB,OAAO,EAAE,YAAY,GACpB,WAAW,CAwBb;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,CAE3C"}