@intutic/mcp-governance-proxy 1.10.0 → 1.10.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.
- package/README.md +28 -0
- package/dist/anomaly/detectors.d.ts +129 -0
- package/dist/anomaly/detectors.d.ts.map +1 -0
- package/dist/anomaly/detectors.js +368 -0
- package/dist/anomaly/detectors.js.map +1 -0
- package/dist/anomaly/index.d.ts +52 -0
- package/dist/anomaly/index.d.ts.map +1 -0
- package/dist/anomaly/index.js +71 -0
- package/dist/anomaly/index.js.map +1 -0
- package/dist/config.d.ts +107 -1
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +129 -6
- package/dist/config.js.map +1 -1
- package/dist/daemon/healthMonitor.d.ts.map +1 -1
- package/dist/daemon/healthMonitor.js +45 -46
- package/dist/daemon/healthMonitor.js.map +1 -1
- package/dist/daemon/index.d.ts +15 -1
- package/dist/daemon/index.d.ts.map +1 -1
- package/dist/daemon/index.js +78 -9
- package/dist/daemon/index.js.map +1 -1
- package/dist/daemon/instrumentation.d.ts +20 -0
- package/dist/daemon/instrumentation.d.ts.map +1 -0
- package/dist/daemon/instrumentation.js +61 -0
- package/dist/daemon/instrumentation.js.map +1 -0
- package/dist/daemon/policyCache.d.ts +83 -0
- package/dist/daemon/policyCache.d.ts.map +1 -1
- package/dist/daemon/policyCache.js +280 -11
- package/dist/daemon/policyCache.js.map +1 -1
- package/dist/daemon/statusReporter.d.ts +12 -0
- package/dist/daemon/statusReporter.d.ts.map +1 -0
- package/dist/daemon/statusReporter.js +130 -0
- package/dist/daemon/statusReporter.js.map +1 -0
- package/dist/daemon/telemetryBatcher.d.ts +3 -1
- package/dist/daemon/telemetryBatcher.d.ts.map +1 -1
- package/dist/daemon/telemetryBatcher.js +56 -13
- package/dist/daemon/telemetryBatcher.js.map +1 -1
- package/dist/daemonClient.d.ts +1 -1
- package/dist/daemonClient.d.ts.map +1 -1
- package/dist/daemonClient.js +0 -2
- package/dist/daemonClient.js.map +1 -1
- package/dist/dlp.d.ts +19 -0
- package/dist/dlp.d.ts.map +1 -1
- package/dist/dlp.js +95 -18
- package/dist/dlp.js.map +1 -1
- package/dist/emitter.d.ts +40 -2
- package/dist/emitter.d.ts.map +1 -1
- package/dist/emitter.js +27 -5
- package/dist/emitter.js.map +1 -1
- package/dist/index.js +13 -2
- package/dist/index.js.map +1 -1
- package/dist/injection.d.ts +46 -0
- package/dist/injection.d.ts.map +1 -0
- package/dist/injection.js +147 -0
- package/dist/injection.js.map +1 -0
- package/dist/interceptor.d.ts +131 -1
- package/dist/interceptor.d.ts.map +1 -1
- package/dist/interceptor.js +301 -5
- package/dist/interceptor.js.map +1 -1
- package/dist/policy.d.ts +110 -2
- package/dist/policy.d.ts.map +1 -1
- package/dist/policy.js +206 -5
- package/dist/policy.js.map +1 -1
- package/dist/proxy.d.ts +205 -0
- package/dist/proxy.d.ts.map +1 -1
- package/dist/proxy.js +572 -65
- package/dist/proxy.js.map +1 -1
- package/dist/remoteBridge.d.ts +51 -0
- package/dist/remoteBridge.d.ts.map +1 -0
- package/dist/remoteBridge.js +182 -0
- package/dist/remoteBridge.js.map +1 -0
- package/dist/session.d.ts +158 -0
- package/dist/session.d.ts.map +1 -0
- package/dist/session.js +206 -0
- package/dist/session.js.map +1 -0
- package/dist/sessionScope.d.ts +51 -0
- package/dist/sessionScope.d.ts.map +1 -0
- package/dist/sessionScope.js +94 -0
- package/dist/sessionScope.js.map +1 -0
- package/dist/sessionStore.d.ts +69 -0
- package/dist/sessionStore.d.ts.map +1 -0
- package/dist/sessionStore.js +143 -0
- package/dist/sessionStore.js.map +1 -0
- package/dist/tofu.d.ts +112 -0
- package/dist/tofu.d.ts.map +1 -0
- package/dist/tofu.js +180 -0
- package/dist/tofu.js.map +1 -0
- package/dist/toolPoison.d.ts +32 -0
- package/dist/toolPoison.d.ts.map +1 -0
- package/dist/toolPoison.js +81 -0
- package/dist/toolPoison.js.map +1 -0
- package/dist/valkeyErrors.d.ts +17 -0
- package/dist/valkeyErrors.d.ts.map +1 -0
- package/dist/valkeyErrors.js +24 -0
- package/dist/valkeyErrors.js.map +1 -0
- package/dist/wasm/context.d.ts +57 -0
- package/dist/wasm/context.d.ts.map +1 -0
- package/dist/wasm/context.js +59 -0
- package/dist/wasm/context.js.map +1 -0
- package/dist/wasm/hostImports.d.ts +43 -0
- package/dist/wasm/hostImports.d.ts.map +1 -0
- package/dist/wasm/hostImports.js +158 -0
- package/dist/wasm/hostImports.js.map +1 -0
- package/dist/wasm/loader.d.ts +95 -0
- package/dist/wasm/loader.d.ts.map +1 -0
- package/dist/wasm/loader.js +198 -0
- package/dist/wasm/loader.js.map +1 -0
- package/dist/wasm/referencedFiles.d.ts +115 -0
- package/dist/wasm/referencedFiles.d.ts.map +1 -0
- package/dist/wasm/referencedFiles.js +366 -0
- package/dist/wasm/referencedFiles.js.map +1 -0
- package/dist/wasm/runner.d.ts +91 -0
- package/dist/wasm/runner.d.ts.map +1 -0
- package/dist/wasm/runner.js +308 -0
- package/dist/wasm/runner.js.map +1 -0
- package/dist/wasm/watch.d.ts +5 -0
- package/dist/wasm/watch.d.ts.map +1 -0
- package/dist/wasm/watch.js +54 -0
- package/dist/wasm/watch.js.map +1 -0
- package/dist/wasm/worker.d.ts +39 -0
- package/dist/wasm/worker.d.ts.map +1 -0
- package/dist/wasm/worker.js +245 -0
- package/dist/wasm/worker.js.map +1 -0
- package/package.json +14 -4
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* wasm/worker.ts — The ONE dedicated `worker_threads` worker hosting every
|
|
3
|
+
* compiled WASM governance rule.
|
|
4
|
+
*
|
|
5
|
+
* Runs in its own thread (spawned by `wasm/runner.ts`). Owns a
|
|
6
|
+
* `Map<ruleId, WebAssembly.Module>` — compiled ONCE per file and cached here
|
|
7
|
+
* — but instantiates a FRESH `WebAssembly.Instance` (fresh guest memory) for
|
|
8
|
+
* every `evaluate` message, mirroring the Rust runner's actual per-evaluation
|
|
9
|
+
* `Store` and preventing any cross-request state leakage between calls that
|
|
10
|
+
* happen to share a rule.
|
|
11
|
+
*
|
|
12
|
+
* Protocol (see `runner.ts` for the main-thread side):
|
|
13
|
+
* compile { type:'compile', id, ruleId, bytes } -> { type:'compile-result', id, ruleId, ok, unsupportedImports?, readsReferencedFiles?, error? }
|
|
14
|
+
* remove { type:'remove', ruleId } (no reply)
|
|
15
|
+
* evaluate { type:'evaluate', id, ruleId, bytes, files? } -> { type:'evaluate-result', id, ruleId, ok, code?, reason?, error? }
|
|
16
|
+
*
|
|
17
|
+
* `files` is the per-evaluation referenced-files table (TD-441), posted only
|
|
18
|
+
* to a rule that imports `read_referenced_file`; it is rebuilt here into the
|
|
19
|
+
* host-import state, so the main thread never shares memory with the guest.
|
|
20
|
+
*
|
|
21
|
+
* A guest `abort` call is inert (hostImports.ts logs and returns); an
|
|
22
|
+
* uncaught exception or trap during instantiation/evaluation is caught here
|
|
23
|
+
* and reported as `ok:false` — the caller (runner.ts) treats that as
|
|
24
|
+
* fail-open ALLOW, exactly like a timeout, never a crash.
|
|
25
|
+
*
|
|
26
|
+
* @module
|
|
27
|
+
*/
|
|
28
|
+
import { parentPort } from 'node:worker_threads';
|
|
29
|
+
import { unsupportedWasmImports, WASM_HOST_IMPORTS } from '@intutic/shared-types';
|
|
30
|
+
import { createHostImports, newHostImportState } from './hostImports.js';
|
|
31
|
+
import { ReferencedFiles } from './referencedFiles.js';
|
|
32
|
+
/**
|
|
33
|
+
* Guest memory ceiling, `runner.rs`'s 16MB `StoreLimits` (TD-440). V8 offers
|
|
34
|
+
* no grow hook on a memory the module itself exports and `unsupportedWasmImports`
|
|
35
|
+
* refuses an imported one, so this is enforced AFTER the call: a rule whose
|
|
36
|
+
* memory grew past the ceiling has its verdict discarded and reported as a
|
|
37
|
+
* failure (fail-open, like a trap), rather than being stopped mid-growth.
|
|
38
|
+
* What it cannot do is bound the growth itself; that remainder stays in
|
|
39
|
+
* TD-440. Checked before the call too, so a module that declares more than
|
|
40
|
+
* the ceiling as its initial size never runs.
|
|
41
|
+
*/
|
|
42
|
+
export const MAX_GUEST_MEMORY_BYTES = 16 * 1024 * 1024;
|
|
43
|
+
/**
|
|
44
|
+
* Longest reason a guest may return — ported from `runner.rs`'s
|
|
45
|
+
* `MAX_GUEST_REASON` (confirmed: `const MAX_GUEST_REASON: usize = 480;`).
|
|
46
|
+
*/
|
|
47
|
+
const MAX_GUEST_REASON = 480;
|
|
48
|
+
/**
|
|
49
|
+
* Highest code point treated as a control character for the purpose of
|
|
50
|
+
* stripping a guest-supplied reason string, plus the DEL character — the
|
|
51
|
+
* ASCII-control-range equivalent of Rust's `char::is_control`, which
|
|
52
|
+
* `runner.rs`'s `read_guest_reason` filters out for the same reason (a
|
|
53
|
+
* control character would corrupt a log line or an HTTP header downstream).
|
|
54
|
+
* Implemented as an explicit char-code filter rather than a regex literal,
|
|
55
|
+
* to keep raw control bytes out of this file's own source text.
|
|
56
|
+
*/
|
|
57
|
+
const MAX_C0_CONTROL_CODE = 0x1f;
|
|
58
|
+
const DEL_CODE = 0x7f;
|
|
59
|
+
function stripControlCharacters(text) {
|
|
60
|
+
let out = '';
|
|
61
|
+
for (const ch of text) {
|
|
62
|
+
const code = ch.codePointAt(0) ?? 0;
|
|
63
|
+
if (code <= MAX_C0_CONTROL_CODE || code === DEL_CODE)
|
|
64
|
+
continue;
|
|
65
|
+
out += ch;
|
|
66
|
+
}
|
|
67
|
+
return out;
|
|
68
|
+
}
|
|
69
|
+
const modules = new Map();
|
|
70
|
+
function importsUsingReadReferencedFile(module) {
|
|
71
|
+
return WebAssembly.Module.imports(module).some((i) => i.module === 'env' && i.name === 'read_referenced_file' && i.kind === 'function');
|
|
72
|
+
}
|
|
73
|
+
function handleCompile(msg) {
|
|
74
|
+
try {
|
|
75
|
+
const module = new WebAssembly.Module(new Uint8Array(msg.bytes));
|
|
76
|
+
const unsupported = unsupportedWasmImports(module);
|
|
77
|
+
if (unsupported.length > 0) {
|
|
78
|
+
parentPort?.postMessage({
|
|
79
|
+
type: 'compile-result',
|
|
80
|
+
id: msg.id,
|
|
81
|
+
ruleId: msg.ruleId,
|
|
82
|
+
ok: false,
|
|
83
|
+
unsupportedImports: unsupported,
|
|
84
|
+
});
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
modules.set(msg.ruleId, module);
|
|
88
|
+
parentPort?.postMessage({
|
|
89
|
+
type: 'compile-result',
|
|
90
|
+
id: msg.id,
|
|
91
|
+
ruleId: msg.ruleId,
|
|
92
|
+
ok: true,
|
|
93
|
+
readsReferencedFiles: importsUsingReadReferencedFile(module),
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
catch (err) {
|
|
97
|
+
parentPort?.postMessage({
|
|
98
|
+
type: 'compile-result',
|
|
99
|
+
id: msg.id,
|
|
100
|
+
ruleId: msg.ruleId,
|
|
101
|
+
ok: false,
|
|
102
|
+
error: err instanceof Error ? err.message : String(err),
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
function handleRemove(msg) {
|
|
107
|
+
modules.delete(msg.ruleId);
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Ported from `runner.rs`'s `read_guest_reason`: two OPTIONAL zero-arg
|
|
111
|
+
* exports, `reason_ptr()`/`reason_len()`, read only together. Every failure
|
|
112
|
+
* path returns `undefined` and the caller falls back to a built-in string —
|
|
113
|
+
* a guest that lies about its own memory is ignored, not trusted. Bounds are
|
|
114
|
+
* checked against actual memory size, the length is capped at
|
|
115
|
+
* `MAX_GUEST_REASON`, invalid UTF-8 is discarded (never lossily patched),
|
|
116
|
+
* and control characters are stripped (they would corrupt a log line or an
|
|
117
|
+
* HTTP header downstream) — the same discipline, in the same order, as the
|
|
118
|
+
* Rust source.
|
|
119
|
+
*/
|
|
120
|
+
function readGuestReason(exportsObj, memory) {
|
|
121
|
+
const ptrFn = exportsObj['reason_ptr'];
|
|
122
|
+
const lenFn = exportsObj['reason_len'];
|
|
123
|
+
if (typeof ptrFn !== 'function' || typeof lenFn !== 'function')
|
|
124
|
+
return undefined;
|
|
125
|
+
let ptr;
|
|
126
|
+
let len;
|
|
127
|
+
try {
|
|
128
|
+
ptr = ptrFn();
|
|
129
|
+
len = lenFn();
|
|
130
|
+
}
|
|
131
|
+
catch {
|
|
132
|
+
return undefined;
|
|
133
|
+
}
|
|
134
|
+
if (typeof ptr !== 'number' || typeof len !== 'number')
|
|
135
|
+
return undefined;
|
|
136
|
+
if (ptr <= 0 || len <= 0)
|
|
137
|
+
return undefined;
|
|
138
|
+
const cappedLen = Math.min(len, MAX_GUEST_REASON);
|
|
139
|
+
const end = ptr + cappedLen;
|
|
140
|
+
const bytes = new Uint8Array(memory.buffer);
|
|
141
|
+
if (end > bytes.length)
|
|
142
|
+
return undefined;
|
|
143
|
+
let text;
|
|
144
|
+
try {
|
|
145
|
+
text = new TextDecoder('utf-8', { fatal: true }).decode(bytes.subarray(ptr, end));
|
|
146
|
+
}
|
|
147
|
+
catch {
|
|
148
|
+
return undefined;
|
|
149
|
+
}
|
|
150
|
+
text = text.trim();
|
|
151
|
+
if (text.length === 0)
|
|
152
|
+
return undefined;
|
|
153
|
+
const stripped = stripControlCharacters(text);
|
|
154
|
+
return stripped.length > 0 ? stripped : undefined;
|
|
155
|
+
}
|
|
156
|
+
function handleEvaluate(msg) {
|
|
157
|
+
const module = modules.get(msg.ruleId);
|
|
158
|
+
if (!module) {
|
|
159
|
+
parentPort?.postMessage({ type: 'evaluate-result', id: msg.id, ruleId: msg.ruleId, ok: false, error: 'rule not loaded' });
|
|
160
|
+
return;
|
|
161
|
+
}
|
|
162
|
+
try {
|
|
163
|
+
// A holder object, not a reassigned `let`: the import object (needed by
|
|
164
|
+
// `WebAssembly.Instance` below) has to exist BEFORE the instance's own
|
|
165
|
+
// `memory` export does, so `createHostImports`'s closure reads through
|
|
166
|
+
// one indirection that gets filled in once, right after instantiation.
|
|
167
|
+
const memoryHolder = { current: undefined };
|
|
168
|
+
const hostState = newHostImportState(ReferencedFiles.fromTable(msg.files));
|
|
169
|
+
const env = createHostImports(() => memoryHolder.current, hostState);
|
|
170
|
+
const instance = new WebAssembly.Instance(module, { env });
|
|
171
|
+
const exportsObj = instance.exports;
|
|
172
|
+
const memExport = exportsObj['memory'];
|
|
173
|
+
if (!(memExport instanceof WebAssembly.Memory)) {
|
|
174
|
+
throw new Error("WASM module missing 'memory' export");
|
|
175
|
+
}
|
|
176
|
+
memoryHolder.current = memExport;
|
|
177
|
+
const memory = memExport;
|
|
178
|
+
if (memory.buffer.byteLength > MAX_GUEST_MEMORY_BYTES) {
|
|
179
|
+
throw new Error(`WASM module declares ${memory.buffer.byteLength} bytes of initial memory, over the ${MAX_GUEST_MEMORY_BYTES}-byte ceiling`);
|
|
180
|
+
}
|
|
181
|
+
const contextBytes = new Uint8Array(msg.bytes);
|
|
182
|
+
// allocate() primary, __new(size, id) AssemblyScript fallback — same
|
|
183
|
+
// fallback order as runner.rs.
|
|
184
|
+
let offset;
|
|
185
|
+
const allocateFn = exportsObj['allocate'];
|
|
186
|
+
const newFn = exportsObj['__new'];
|
|
187
|
+
if (typeof allocateFn === 'function') {
|
|
188
|
+
offset = allocateFn(contextBytes.length);
|
|
189
|
+
}
|
|
190
|
+
else if (typeof newFn === 'function') {
|
|
191
|
+
offset = newFn(contextBytes.length, 0);
|
|
192
|
+
}
|
|
193
|
+
else {
|
|
194
|
+
throw new Error("WASM module missing 'allocate' or '__new' export");
|
|
195
|
+
}
|
|
196
|
+
// Re-read the memory view after allocate — it can grow memory, which
|
|
197
|
+
// detaches any Uint8Array view taken before the call.
|
|
198
|
+
new Uint8Array(memory.buffer, offset, contextBytes.length).set(contextBytes);
|
|
199
|
+
const evaluateFn = exportsObj['evaluate'];
|
|
200
|
+
if (typeof evaluateFn !== 'function') {
|
|
201
|
+
throw new Error("WASM module missing 'evaluate' export");
|
|
202
|
+
}
|
|
203
|
+
const code = evaluateFn(offset, contextBytes.length);
|
|
204
|
+
// Read inside the same call, deliberately: a guest that returns a
|
|
205
|
+
// hostile length must not be able to buy extra time by doing so after
|
|
206
|
+
// the verdict — same reasoning runner.rs states for its own placement.
|
|
207
|
+
const reason = readGuestReason(exportsObj, memory);
|
|
208
|
+
if (memory.buffer.byteLength > MAX_GUEST_MEMORY_BYTES) {
|
|
209
|
+
throw new Error(`WASM rule grew guest memory to ${memory.buffer.byteLength} bytes, over the ${MAX_GUEST_MEMORY_BYTES}-byte ceiling; verdict discarded`);
|
|
210
|
+
}
|
|
211
|
+
parentPort?.postMessage({ type: 'evaluate-result', id: msg.id, ruleId: msg.ruleId, ok: true, code, reason });
|
|
212
|
+
}
|
|
213
|
+
catch (err) {
|
|
214
|
+
// A guest trap (including one following an `abort` call) lands here.
|
|
215
|
+
// Reported as a failure, never re-thrown — the worker process must
|
|
216
|
+
// survive one hostile or buggy rule to keep evaluating every other one.
|
|
217
|
+
parentPort?.postMessage({
|
|
218
|
+
type: 'evaluate-result',
|
|
219
|
+
id: msg.id,
|
|
220
|
+
ruleId: msg.ruleId,
|
|
221
|
+
ok: false,
|
|
222
|
+
error: err instanceof Error ? err.message : String(err),
|
|
223
|
+
});
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
parentPort?.on('message', (msg) => {
|
|
227
|
+
switch (msg.type) {
|
|
228
|
+
case 'compile':
|
|
229
|
+
handleCompile(msg);
|
|
230
|
+
break;
|
|
231
|
+
case 'remove':
|
|
232
|
+
handleRemove(msg);
|
|
233
|
+
break;
|
|
234
|
+
case 'evaluate':
|
|
235
|
+
handleEvaluate(msg);
|
|
236
|
+
break;
|
|
237
|
+
}
|
|
238
|
+
});
|
|
239
|
+
// Referenced so a future accidental removal of the import in hostImports.ts
|
|
240
|
+
// is caught by a type error here, not by a rule silently linking a fifth
|
|
241
|
+
// host function this worker forgot to register — `createHostImports`
|
|
242
|
+
// already builds against `WASM_HOST_IMPORTS`' exact 4 names via
|
|
243
|
+
// `@intutic/shared-types`'s frozen list, imported above.
|
|
244
|
+
void WASM_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,CAAC,CAAA;YACjB,MAAK;QACP,KAAK,UAAU;YACb,cAAc,CAAC,GAAG,CAAC,CAAA;YACnB,MAAK;IACT,CAAC;AACH,CAAC,CAAC,CAAA;AAEF,4EAA4E;AAC5E,yEAAyE;AACzE,qEAAqE;AACrE,gEAAgE;AAChE,yDAAyD;AACzD,KAAK,iBAAiB,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@intutic/mcp-governance-proxy",
|
|
3
|
-
"version": "1.10.
|
|
3
|
+
"version": "1.10.1",
|
|
4
4
|
"description": "Intutic MCP Governance Proxy — transparent stdio proxy that intercepts all tools/call JSON-RPC messages and applies workspace SOP policy before forwarding to real MCP servers",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -23,21 +23,31 @@
|
|
|
23
23
|
],
|
|
24
24
|
"dependencies": {
|
|
25
25
|
"@modelcontextprotocol/sdk": "^1.30.0",
|
|
26
|
+
"@opentelemetry/api": "^1.9.1",
|
|
27
|
+
"@opentelemetry/auto-instrumentations-node": "^0.79.0",
|
|
28
|
+
"@opentelemetry/exporter-metrics-otlp-http": "^0.221.0",
|
|
29
|
+
"@opentelemetry/exporter-trace-otlp-http": "^0.221.0",
|
|
30
|
+
"@opentelemetry/resources": "^2.10.0",
|
|
31
|
+
"@opentelemetry/sdk-metrics": "^2.10.0",
|
|
32
|
+
"@opentelemetry/sdk-node": "^0.221.0",
|
|
33
|
+
"@opentelemetry/semantic-conventions": "^1.43.0",
|
|
26
34
|
"ioredis": "^5",
|
|
27
35
|
"zod": "^3",
|
|
28
|
-
"@intutic/id": "1.10.
|
|
29
|
-
"@intutic/
|
|
36
|
+
"@intutic/id": "1.10.1",
|
|
37
|
+
"@intutic/shared-types": "1.10.1",
|
|
38
|
+
"@intutic/logger": "1.10.1"
|
|
30
39
|
},
|
|
31
40
|
"devDependencies": {
|
|
32
41
|
"@types/node": "^22",
|
|
33
42
|
"tsx": "^4",
|
|
34
43
|
"typescript": "^5.5",
|
|
35
|
-
"vitest": "^
|
|
44
|
+
"vitest": "^4"
|
|
36
45
|
},
|
|
37
46
|
"engines": {
|
|
38
47
|
"node": ">=18"
|
|
39
48
|
},
|
|
40
49
|
"scripts": {
|
|
50
|
+
"lint": "eslint src",
|
|
41
51
|
"build": "tsc",
|
|
42
52
|
"dev": "tsx src/index.ts",
|
|
43
53
|
"typecheck": "tsc --noEmit",
|