@ait-co/devtools 0.1.41 → 0.1.43

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.
@@ -1 +1 @@
1
- {"version":3,"file":"server.d.ts","names":[],"sources":["../../src/mcp/ait-source.ts","../../src/mcp/server.ts"],"mappings":";;;;;;;AAsBA;;;;;AAGA;;;;;;;;;;;;;KAHY,kBAAA;AAqBZ;AAAA,UAlBiB,UAAA;;EAEf,MAAA;EAiBiB;EAfjB,IAAA;EAwBsB;EAtBtB,SAAA;EAsByB;EApBzB,MAAA;EAuBe;EArBf,MAAA;;EAEA,KAAA;EAuBU;EArBV,QAAA,EAAU,kBAAA;AAAA;;UAIK,iBAAA;EACf,KAAA,EAAO,UAAA;AAAA;;;;;;;KASG,YAAA,GAAe,MAAA;;UAGV,yBAAA;EAW2C;EAT1D,WAAA;EAYuB;EAVvB,UAAA;AAAA;;UAIe,YAAA;EACf,uBAAA,EAAyB,iBAAA;EACzB,kBAAA,EAAoB,YAAA;EACpB,+BAAA,EAAiC,yBAAA;AAAA;AAAA,KAGvB,aAAA,SAAsB,YAAA;;;;;UAMjB,SAAA;EACf,GAAA,WAAc,aAAA,EAAe,MAAA,EAAQ,CAAA,GAAI,OAAA,CAAQ,YAAA,CAAa,CAAA;AAAA;;;UCO/C,mBAAA;EDpBY;ECsB3B,SAAA,GAAY,SAAA;AAAA;;iBAIE,eAAA,CAAgB,IAAA,GAAM,mBAAA,GAA2B,MAAA;;iBA6D3C,YAAA,CAAA,GAAgB,OAAA"}
1
+ {"version":3,"file":"server.d.ts","names":[],"sources":["../../src/mcp/ait-source.ts","../../src/mcp/server.ts"],"mappings":";;;;;;;AAsBA;;;;;AAGA;;;;;;;;;;;;;KAHY,kBAAA;AAqBZ;AAAA,UAlBiB,UAAA;;EAEf,MAAA;EAiBiB;EAfjB,IAAA;EAwBsB;EAtBtB,SAAA;EAsByB;EApBzB,MAAA;EAuBe;EArBf,MAAA;;EAEA,KAAA;EAuBU;EArBV,QAAA,EAAU,kBAAA;AAAA;;UAIK,iBAAA;EACf,KAAA,EAAO,UAAA;AAAA;;;;;;;KASG,YAAA,GAAe,MAAA;;UAGV,yBAAA;EAW2C;EAT1D,WAAA;EAYuB;EAVvB,UAAA;AAAA;;UAIe,YAAA;EACf,uBAAA,EAAyB,iBAAA;EACzB,kBAAA,EAAoB,YAAA;EACpB,+BAAA,EAAiC,yBAAA;AAAA;AAAA,KAGvB,aAAA,SAAsB,YAAA;;;;;UAMjB,SAAA;EACf,GAAA,WAAc,aAAA,EAAe,MAAA,EAAQ,CAAA,GAAI,OAAA,CAAQ,YAAA,CAAa,CAAA;AAAA;;;UCkB/C,mBAAA;ED/BY;ECiC3B,SAAA,GAAY,SAAA;AAAA;;iBAIE,eAAA,CAAgB,IAAA,GAAM,mBAAA,GAA2B,MAAA;;iBA6D3C,YAAA,CAAA,GAAgB,OAAA"}
@@ -183,7 +183,8 @@ new Set([
183
183
  type: "object",
184
184
  properties: {},
185
185
  required: []
186
- }
186
+ },
187
+ availableIn: "both"
187
188
  },
188
189
  {
189
190
  name: "list_network_requests",
@@ -192,7 +193,8 @@ new Set([
192
193
  type: "object",
193
194
  properties: {},
194
195
  required: []
195
- }
196
+ },
197
+ availableIn: "both"
196
198
  },
197
199
  {
198
200
  name: "list_pages",
@@ -201,7 +203,8 @@ new Set([
201
203
  type: "object",
202
204
  properties: {},
203
205
  required: []
204
- }
206
+ },
207
+ availableIn: "both"
205
208
  },
206
209
  {
207
210
  name: "build_attach_url",
@@ -223,7 +226,8 @@ new Set([
223
226
  }
224
227
  },
225
228
  required: ["scheme_url"]
226
- }
229
+ },
230
+ availableIn: "relay"
227
231
  },
228
232
  {
229
233
  name: "get_dom_document",
@@ -232,7 +236,8 @@ new Set([
232
236
  type: "object",
233
237
  properties: {},
234
238
  required: []
235
- }
239
+ },
240
+ availableIn: "both"
236
241
  },
237
242
  {
238
243
  name: "take_snapshot",
@@ -241,7 +246,8 @@ new Set([
241
246
  type: "object",
242
247
  properties: {},
243
248
  required: []
244
- }
249
+ },
250
+ availableIn: "both"
245
251
  },
246
252
  {
247
253
  name: "take_screenshot",
@@ -250,16 +256,18 @@ new Set([
250
256
  type: "object",
251
257
  properties: {},
252
258
  required: []
253
- }
259
+ },
260
+ availableIn: "both"
254
261
  },
255
262
  {
256
263
  name: "measure_safe_area",
257
- description: "Runs a safe-area probe on the attached mini-app page via Runtime.evaluate and returns normalized safe-area insets, viewport geometry, device pixel ratio, and User-Agent. Read-only — does not modify page state. Use in a relay session (phone attached) to get ground-truth values for upgrading a viewport preset from extrapolated/placeholder to measured. Requires the relay to be attached — call list_pages first.",
264
+ description: "Runs a safe-area probe on the attached mini-app page via Runtime.evaluate and returns normalized safe-area insets, viewport geometry, device pixel ratio, and User-Agent. Read-only — does not modify page state. Tier C per RFC #277: the same Runtime.evaluate probe runs in both `mock` (devtools panel page with window.__ait state) and `relay` (real-device WebView with window.__sdk). The result includes a `source: \"mock\" | \"relay\"` field so consumers can identify provenance without inspecting payload values. Use in a relay session (phone attached) to get ground-truth values for upgrading a viewport preset from extrapolated/placeholder to measured. Requires a page to be attached — call list_pages first.",
258
265
  inputSchema: {
259
266
  type: "object",
260
267
  properties: {},
261
268
  required: []
262
- }
269
+ },
270
+ availableIn: "both"
263
271
  },
264
272
  {
265
273
  name: "evaluate",
@@ -271,7 +279,8 @@ new Set([
271
279
  description: "JavaScript expression to evaluate in the page context."
272
280
  } },
273
281
  required: ["expression"]
274
- }
282
+ },
283
+ availableIn: "both"
275
284
  },
276
285
  {
277
286
  name: "list_exceptions",
@@ -283,7 +292,8 @@ new Set([
283
292
  description: "Maximum number of exceptions to return (default 50, max 50)."
284
293
  } },
285
294
  required: []
286
- }
295
+ },
296
+ availableIn: "both"
287
297
  },
288
298
  {
289
299
  name: "call_sdk",
@@ -302,7 +312,8 @@ new Set([
302
312
  }
303
313
  },
304
314
  required: ["name"]
305
- }
315
+ },
316
+ availableIn: "both"
306
317
  },
307
318
  {
308
319
  name: "AIT.getSdkCallHistory",
@@ -311,7 +322,8 @@ new Set([
311
322
  type: "object",
312
323
  properties: {},
313
324
  required: []
314
- }
325
+ },
326
+ availableIn: "both"
315
327
  },
316
328
  {
317
329
  name: "AIT.getMockState",
@@ -320,7 +332,8 @@ new Set([
320
332
  type: "object",
321
333
  properties: {},
322
334
  required: []
323
- }
335
+ },
336
+ availableIn: "both"
324
337
  },
325
338
  {
326
339
  name: "AIT.getOperationalEnvironment",
@@ -329,7 +342,8 @@ new Set([
329
342
  type: "object",
330
343
  properties: {},
331
344
  required: []
332
- }
345
+ },
346
+ availableIn: "both"
333
347
  }
334
348
  ].map((t) => t.name));
335
349
  `
@@ -350,17 +364,28 @@ new Set([
350
364
  };
351
365
  document.documentElement.removeChild(el);
352
366
  var sdkInsets = null;
367
+ var sdkInsetsSource = null;
353
368
  var sdkInsetsError = undefined;
354
369
  try {
355
370
  var sdk = window.__sdk;
371
+ var ait = window.__ait;
356
372
  if (sdk && sdk.SafeAreaInsets && typeof sdk.SafeAreaInsets.get === 'function') {
357
373
  sdkInsets = sdk.SafeAreaInsets.get();
374
+ sdkInsetsSource = 'window.__sdk';
358
375
  } else if (sdk && typeof sdk.getSafeAreaInsets === 'function') {
359
376
  sdkInsets = sdk.getSafeAreaInsets();
360
- } else if (!sdk) {
361
- sdkInsetsError = 'window.__sdk not available (non-dogfood bundle)';
362
- } else {
377
+ sdkInsetsSource = 'window.__sdk';
378
+ } else if (ait && ait.state && ait.state.safeAreaInsets &&
379
+ typeof ait.state.safeAreaInsets.top === 'number') {
380
+ var s = ait.state.safeAreaInsets;
381
+ sdkInsets = { top: s.top, bottom: s.bottom, left: s.left, right: s.right };
382
+ sdkInsetsSource = 'window.__ait';
383
+ } else if (!sdk && !ait) {
384
+ sdkInsetsError = 'neither window.__sdk (relay) nor window.__ait (mock) available';
385
+ } else if (sdk) {
363
386
  sdkInsetsError = 'neither SafeAreaInsets.get nor getSafeAreaInsets found on window.__sdk';
387
+ } else {
388
+ sdkInsetsError = 'window.__ait.state.safeAreaInsets is missing or malformed';
364
389
  }
365
390
  } catch(e) {
366
391
  sdkInsetsError = String(e && e.message || e);
@@ -377,6 +402,7 @@ new Set([
377
402
  var result = {
378
403
  cssEnv: cssEnv,
379
404
  sdkInsets: sdkInsets,
405
+ sdkInsetsSource: sdkInsetsSource,
380
406
  navBarHeight: navBarHeight,
381
407
  navBarHeightSource: navBarHeightSource,
382
408
  innerWidth: window.innerWidth,
@@ -447,7 +473,13 @@ function getOperationalEnvironment(source) {
447
473
  * }
448
474
  * }
449
475
  */
450
- /** Tool descriptors served by the dev-mode server. */
476
+ /**
477
+ * Tool descriptors served by the dev-mode server.
478
+ *
479
+ * All dev-mode tools are Tier C (both envs) per RFC #277 — the dev-mode server
480
+ * itself is the mock-side embodiment of those Tier C tools. `availableIn` is
481
+ * declared so the surface stays consistent with the debug-mode registry.
482
+ */
451
483
  const DEV_TOOL_DEFINITIONS = [
452
484
  {
453
485
  name: "AIT.getMockState",
@@ -456,7 +488,8 @@ const DEV_TOOL_DEFINITIONS = [
456
488
  type: "object",
457
489
  properties: {},
458
490
  required: []
459
- }
491
+ },
492
+ availableIn: "both"
460
493
  },
461
494
  {
462
495
  name: "AIT.getOperationalEnvironment",
@@ -465,7 +498,8 @@ const DEV_TOOL_DEFINITIONS = [
465
498
  type: "object",
466
499
  properties: {},
467
500
  required: []
468
- }
501
+ },
502
+ availableIn: "both"
469
503
  },
470
504
  {
471
505
  name: "AIT.getSdkCallHistory",
@@ -474,7 +508,8 @@ const DEV_TOOL_DEFINITIONS = [
474
508
  type: "object",
475
509
  properties: {},
476
510
  required: []
477
- }
511
+ },
512
+ availableIn: "both"
478
513
  },
479
514
  {
480
515
  name: "devtools_get_mock_state",
@@ -483,7 +518,8 @@ const DEV_TOOL_DEFINITIONS = [
483
518
  type: "object",
484
519
  properties: {},
485
520
  required: []
486
- }
521
+ },
522
+ availableIn: "both"
487
523
  }
488
524
  ];
489
525
  const DEV_TOOL_NAMES = new Set(DEV_TOOL_DEFINITIONS.map((t) => t.name));
@@ -493,7 +529,7 @@ function createDevServer(deps = {}) {
493
529
  const aitSource = deps.aitSource ?? new HttpAitSource({ stateEndpoint });
494
530
  const server = new Server({
495
531
  name: "ait-devtools",
496
- version: "0.1.41"
532
+ version: "0.1.43"
497
533
  }, { capabilities: { tools: {} } });
498
534
  server.setRequestHandler(ListToolsRequestSchema, () => ({ tools: DEV_TOOL_DEFINITIONS.map((tool) => ({ ...tool })) }));
499
535
  server.setRequestHandler(CallToolRequestSchema, async (request) => {