@oyerinde/caliper 0.2.1 → 0.2.3
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/CHANGELOG.md +19 -1
- package/README.md +0 -4
- package/dist/bridge.cjs +12 -12
- package/dist/bridge.d.cts +1 -1
- package/dist/bridge.d.ts +1 -1
- package/dist/bridge.js +1 -1
- package/dist/{chunk-PYAVLOZM.cjs → chunk-2SVFU7M3.cjs} +71 -29
- package/dist/{chunk-MTIWXK3P.js → chunk-EFX4HXVN.js} +57 -33
- package/dist/{chunk-P37B6G5P.cjs → chunk-L727OFLU.cjs} +57 -33
- package/dist/{chunk-L47FGEH6.js → chunk-PRUCSUJA.js} +72 -30
- package/dist/index.cjs +6 -6
- package/dist/index.global.js +13 -13
- package/dist/index.global.js.map +1 -1
- package/dist/index.global.min.js +3 -3
- package/dist/index.global.min.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/mcp.cjs +88 -52
- package/dist/mcp.js +89 -53
- package/dist/preset.cjs +6 -6
- package/dist/preset.d.cts +1 -1
- package/dist/preset.d.ts +1 -1
- package/dist/preset.js +3 -3
- package/dist/version.json +2 -2
- package/package.json +5 -5
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { JSONRPCErrorResponseSchema as JSONRPCErrorResponseSchema$1
|
|
2
|
+
import { JSONRPCErrorResponseSchema as JSONRPCErrorResponseSchema$1 } from '@modelcontextprotocol/sdk/types.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* @name @oyerinde/caliper
|
|
@@ -228,7 +228,6 @@ var WalkOptionsSchema = z.object({
|
|
|
228
228
|
minElementSize: z.number().optional(),
|
|
229
229
|
ignoreSelectors: z.array(z.string()).optional()
|
|
230
230
|
});
|
|
231
|
-
var JSONRPCResultResponseSchema = JSONRPCResultResponseSchema$1;
|
|
232
231
|
var JSONRPCErrorResponseSchema = JSONRPCErrorResponseSchema$1;
|
|
233
232
|
var ViewportSchema = z.object({
|
|
234
233
|
width: z.number(),
|
|
@@ -288,8 +287,20 @@ var SourceHintsSchema = z.object({
|
|
|
288
287
|
tagName: z.string()
|
|
289
288
|
});
|
|
290
289
|
var CaliperActionResultSchema = z.union([
|
|
291
|
-
z.object({
|
|
292
|
-
|
|
290
|
+
z.object({
|
|
291
|
+
success: z.literal(true),
|
|
292
|
+
method: z.literal(CALIPER_METHODS.SELECT),
|
|
293
|
+
selector: z.string(),
|
|
294
|
+
selection: SelectionMetadataSchema,
|
|
295
|
+
timestamp: z.number()
|
|
296
|
+
}),
|
|
297
|
+
z.object({
|
|
298
|
+
success: z.literal(true),
|
|
299
|
+
method: z.literal(CALIPER_METHODS.MEASURE),
|
|
300
|
+
selector: z.string(),
|
|
301
|
+
measurement: MeasurementResultSchema,
|
|
302
|
+
timestamp: z.number()
|
|
303
|
+
}),
|
|
293
304
|
z.object({
|
|
294
305
|
success: z.literal(true),
|
|
295
306
|
method: z.literal(CALIPER_METHODS.INSPECT),
|
|
@@ -310,8 +321,16 @@ var CaliperActionResultSchema = z.union([
|
|
|
310
321
|
sourceHints: SourceHintsSchema.optional(),
|
|
311
322
|
timestamp: z.number()
|
|
312
323
|
}),
|
|
313
|
-
z.object({
|
|
314
|
-
|
|
324
|
+
z.object({
|
|
325
|
+
success: z.literal(true),
|
|
326
|
+
method: z.literal(CALIPER_METHODS.FREEZE),
|
|
327
|
+
timestamp: z.number()
|
|
328
|
+
}),
|
|
329
|
+
z.object({
|
|
330
|
+
success: z.literal(true),
|
|
331
|
+
method: z.literal(CALIPER_METHODS.CLEAR),
|
|
332
|
+
timestamp: z.number()
|
|
333
|
+
}),
|
|
315
334
|
z.object({
|
|
316
335
|
success: z.literal(true),
|
|
317
336
|
method: z.literal(CALIPER_METHODS.WALK_DOM),
|
|
@@ -398,11 +417,7 @@ var CaliperNotificationSchema = z.union([
|
|
|
398
417
|
params: CaliperAgentStateSchema
|
|
399
418
|
})
|
|
400
419
|
]);
|
|
401
|
-
z.union([
|
|
402
|
-
CaliperResponseSchema,
|
|
403
|
-
CaliperNotificationSchema,
|
|
404
|
-
JSONRPCResultResponseSchema
|
|
405
|
-
]);
|
|
420
|
+
z.union([CaliperResponseSchema, CaliperNotificationSchema]);
|
|
406
421
|
var CaliperSelectPayloadSchema = z.object({
|
|
407
422
|
selector: z.string()
|
|
408
423
|
});
|
|
@@ -1360,10 +1375,12 @@ var Logger = class {
|
|
|
1360
1375
|
isGlobalEnabled = enabled;
|
|
1361
1376
|
}
|
|
1362
1377
|
debug(...args) {
|
|
1363
|
-
return;
|
|
1378
|
+
if (!isGlobalEnabled) return;
|
|
1379
|
+
console.debug(this.prefix, ...args);
|
|
1364
1380
|
}
|
|
1365
1381
|
info(...args) {
|
|
1366
|
-
return;
|
|
1382
|
+
if (!isGlobalEnabled) return;
|
|
1383
|
+
console.info(this.prefix, ...args);
|
|
1367
1384
|
}
|
|
1368
1385
|
warn(...args) {
|
|
1369
1386
|
if (!isGlobalEnabled) return;
|
|
@@ -1374,7 +1391,8 @@ var Logger = class {
|
|
|
1374
1391
|
console.error(this.prefix, ...args);
|
|
1375
1392
|
}
|
|
1376
1393
|
log(...args) {
|
|
1377
|
-
return;
|
|
1394
|
+
if (!isGlobalEnabled) return;
|
|
1395
|
+
console.log(this.prefix, ...args);
|
|
1378
1396
|
}
|
|
1379
1397
|
};
|
|
1380
1398
|
new Logger({ prefix: "Caliper" });
|
|
@@ -15072,7 +15090,7 @@ var JSONRPCNotificationSchema = object({
|
|
|
15072
15090
|
jsonrpc: literal(JSONRPC_VERSION),
|
|
15073
15091
|
...NotificationSchema.shape
|
|
15074
15092
|
}).strict();
|
|
15075
|
-
var
|
|
15093
|
+
var JSONRPCResultResponseSchema = object({
|
|
15076
15094
|
jsonrpc: literal(JSONRPC_VERSION),
|
|
15077
15095
|
id: RequestIdSchema,
|
|
15078
15096
|
result: ResultSchema
|
|
@@ -15109,10 +15127,10 @@ var JSONRPCErrorResponseSchema2 = object({
|
|
|
15109
15127
|
union([
|
|
15110
15128
|
JSONRPCRequestSchema,
|
|
15111
15129
|
JSONRPCNotificationSchema,
|
|
15112
|
-
|
|
15130
|
+
JSONRPCResultResponseSchema,
|
|
15113
15131
|
JSONRPCErrorResponseSchema2
|
|
15114
15132
|
]);
|
|
15115
|
-
union([
|
|
15133
|
+
union([JSONRPCResultResponseSchema, JSONRPCErrorResponseSchema2]);
|
|
15116
15134
|
var EmptyResultSchema = ResultSchema.strict();
|
|
15117
15135
|
var CancelledNotificationParamsSchema = NotificationsParamsSchema.extend({
|
|
15118
15136
|
/**
|
|
@@ -16676,7 +16694,7 @@ var WalkOptionsSchema2 = external_exports.object({
|
|
|
16676
16694
|
});
|
|
16677
16695
|
var JSONRPCRequestSchema2 = JSONRPCRequestSchema;
|
|
16678
16696
|
var JSONRPCNotificationSchema2 = JSONRPCNotificationSchema;
|
|
16679
|
-
var
|
|
16697
|
+
var JSONRPCResultResponseSchema2 = JSONRPCResultResponseSchema;
|
|
16680
16698
|
var JSONRPCErrorResponseSchema22 = JSONRPCErrorResponseSchema2;
|
|
16681
16699
|
var ViewportSchema2 = external_exports.object({
|
|
16682
16700
|
width: external_exports.number(),
|
|
@@ -16736,8 +16754,20 @@ var SourceHintsSchema2 = external_exports.object({
|
|
|
16736
16754
|
tagName: external_exports.string()
|
|
16737
16755
|
});
|
|
16738
16756
|
var CaliperActionResultSchema2 = external_exports.union([
|
|
16739
|
-
external_exports.object({
|
|
16740
|
-
|
|
16757
|
+
external_exports.object({
|
|
16758
|
+
success: external_exports.literal(true),
|
|
16759
|
+
method: external_exports.literal(CALIPER_METHODS2.SELECT),
|
|
16760
|
+
selector: external_exports.string(),
|
|
16761
|
+
selection: SelectionMetadataSchema2,
|
|
16762
|
+
timestamp: external_exports.number()
|
|
16763
|
+
}),
|
|
16764
|
+
external_exports.object({
|
|
16765
|
+
success: external_exports.literal(true),
|
|
16766
|
+
method: external_exports.literal(CALIPER_METHODS2.MEASURE),
|
|
16767
|
+
selector: external_exports.string(),
|
|
16768
|
+
measurement: MeasurementResultSchema2,
|
|
16769
|
+
timestamp: external_exports.number()
|
|
16770
|
+
}),
|
|
16741
16771
|
external_exports.object({
|
|
16742
16772
|
success: external_exports.literal(true),
|
|
16743
16773
|
method: external_exports.literal(CALIPER_METHODS2.INSPECT),
|
|
@@ -16758,8 +16788,16 @@ var CaliperActionResultSchema2 = external_exports.union([
|
|
|
16758
16788
|
sourceHints: SourceHintsSchema2.optional(),
|
|
16759
16789
|
timestamp: external_exports.number()
|
|
16760
16790
|
}),
|
|
16761
|
-
external_exports.object({
|
|
16762
|
-
|
|
16791
|
+
external_exports.object({
|
|
16792
|
+
success: external_exports.literal(true),
|
|
16793
|
+
method: external_exports.literal(CALIPER_METHODS2.FREEZE),
|
|
16794
|
+
timestamp: external_exports.number()
|
|
16795
|
+
}),
|
|
16796
|
+
external_exports.object({
|
|
16797
|
+
success: external_exports.literal(true),
|
|
16798
|
+
method: external_exports.literal(CALIPER_METHODS2.CLEAR),
|
|
16799
|
+
timestamp: external_exports.number()
|
|
16800
|
+
}),
|
|
16763
16801
|
external_exports.object({
|
|
16764
16802
|
success: external_exports.literal(true),
|
|
16765
16803
|
method: external_exports.literal(CALIPER_METHODS2.WALK_DOM),
|
|
@@ -16819,13 +16857,21 @@ var RpcFactory = class {
|
|
|
16819
16857
|
return JSONRPCRequestSchema2.parse({ jsonrpc: "2.0", method, params, id });
|
|
16820
16858
|
}
|
|
16821
16859
|
static response(id, result) {
|
|
16822
|
-
return
|
|
16860
|
+
return JSONRPCResultResponseSchema2.parse({ jsonrpc: "2.0", id, result });
|
|
16823
16861
|
}
|
|
16824
16862
|
static error(id, code, message, data) {
|
|
16825
|
-
return JSONRPCErrorResponseSchema22.parse({
|
|
16863
|
+
return JSONRPCErrorResponseSchema22.parse({
|
|
16864
|
+
jsonrpc: "2.0",
|
|
16865
|
+
id,
|
|
16866
|
+
error: { code, message, data }
|
|
16867
|
+
});
|
|
16826
16868
|
}
|
|
16827
16869
|
static notification(method, params) {
|
|
16828
|
-
return JSONRPCNotificationSchema2.parse({
|
|
16870
|
+
return JSONRPCNotificationSchema2.parse({
|
|
16871
|
+
jsonrpc: "2.0",
|
|
16872
|
+
method,
|
|
16873
|
+
params
|
|
16874
|
+
});
|
|
16829
16875
|
}
|
|
16830
16876
|
};
|
|
16831
16877
|
var CaliperResponseSchema2 = external_exports.union([
|
|
@@ -16860,11 +16906,7 @@ var CaliperNotificationSchema2 = external_exports.union([
|
|
|
16860
16906
|
params: CaliperAgentStateSchema2
|
|
16861
16907
|
})
|
|
16862
16908
|
]);
|
|
16863
|
-
external_exports.union([
|
|
16864
|
-
CaliperResponseSchema2,
|
|
16865
|
-
CaliperNotificationSchema2,
|
|
16866
|
-
JSONRPCResultResponseSchema22
|
|
16867
|
-
]);
|
|
16909
|
+
external_exports.union([CaliperResponseSchema2, CaliperNotificationSchema2]);
|
|
16868
16910
|
external_exports.object({
|
|
16869
16911
|
selector: external_exports.string()
|
|
16870
16912
|
});
|
package/dist/index.cjs
CHANGED
|
@@ -1,26 +1,26 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkL727OFLU_cjs = require('./chunk-L727OFLU.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
Object.defineProperty(exports, "VERSION", {
|
|
8
8
|
enumerable: true,
|
|
9
|
-
get: function () { return
|
|
9
|
+
get: function () { return chunkL727OFLU_cjs.VERSION; }
|
|
10
10
|
});
|
|
11
11
|
Object.defineProperty(exports, "caliperProps", {
|
|
12
12
|
enumerable: true,
|
|
13
|
-
get: function () { return
|
|
13
|
+
get: function () { return chunkL727OFLU_cjs.caliperProps; }
|
|
14
14
|
});
|
|
15
15
|
Object.defineProperty(exports, "getConfig", {
|
|
16
16
|
enumerable: true,
|
|
17
|
-
get: function () { return
|
|
17
|
+
get: function () { return chunkL727OFLU_cjs.getConfig; }
|
|
18
18
|
});
|
|
19
19
|
Object.defineProperty(exports, "init", {
|
|
20
20
|
enumerable: true,
|
|
21
|
-
get: function () { return
|
|
21
|
+
get: function () { return chunkL727OFLU_cjs.createOverlay; }
|
|
22
22
|
});
|
|
23
23
|
Object.defineProperty(exports, "setConfig", {
|
|
24
24
|
enumerable: true,
|
|
25
|
-
get: function () { return
|
|
25
|
+
get: function () { return chunkL727OFLU_cjs.setConfig; }
|
|
26
26
|
});
|