@swmansion/argent 0.34.1-next.90 → 0.34.1-next.91
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/dist/tool-server.cjs +75 -47
- package/package.json +2 -2
package/dist/tool-server.cjs
CHANGED
|
@@ -93455,6 +93455,8 @@ var SCREENSHOT_TRACK = "screenshot";
|
|
|
93455
93455
|
var KEYS_TRACK = "keys";
|
|
93456
93456
|
var TOUCH_TRACK = "touch";
|
|
93457
93457
|
var TRACK_FALLBACK_GRACE_MS = 2e3;
|
|
93458
|
+
var ORDERED_GROUP_FRAMES = 256;
|
|
93459
|
+
var ORDERED_GROUP_MIN_AGE_MS = 1e3;
|
|
93458
93460
|
function frame(payload) {
|
|
93459
93461
|
return { payload, timestamp: time_exports.Timestamp.now() };
|
|
93460
93462
|
}
|
|
@@ -93471,7 +93473,11 @@ var MoqDeviceSession = class {
|
|
|
93471
93473
|
trackWaiters = /* @__PURE__ */ new Map();
|
|
93472
93474
|
requestPumpDone = false;
|
|
93473
93475
|
controlTrack = null;
|
|
93474
|
-
|
|
93476
|
+
orderedTrack = null;
|
|
93477
|
+
orderedGroup = null;
|
|
93478
|
+
orderedGroupFrames = 0;
|
|
93479
|
+
orderedGroupOpenedAt = 0;
|
|
93480
|
+
orderedQueue = Promise.resolve();
|
|
93475
93481
|
touchTrack = null;
|
|
93476
93482
|
/** Last snapshot applied through the legacy fallback, for diffing. */
|
|
93477
93483
|
legacyTouchApplied = [];
|
|
@@ -93491,22 +93497,30 @@ var MoqDeviceSession = class {
|
|
|
93491
93497
|
const track2 = await this.resolveControlTrack();
|
|
93492
93498
|
track2.writeFrame(frame(payload));
|
|
93493
93499
|
}
|
|
93494
|
-
/**
|
|
93495
|
-
|
|
93500
|
+
/**
|
|
93501
|
+
* Snapshots go to "touch", screenshot and wheel to "control", everything with
|
|
93502
|
+
* a Down/Up pair to the ordered "keys" group. Tracks are unordered relative to
|
|
93503
|
+
* each other, so do not mix `touchState` and `touch` within one gesture.
|
|
93504
|
+
*/
|
|
93505
|
+
async sendInput(message) {
|
|
93496
93506
|
switch (message.type) {
|
|
93497
93507
|
case "touchState":
|
|
93498
93508
|
return this.touchState(message.pointers);
|
|
93499
|
-
case "
|
|
93500
|
-
|
|
93501
|
-
default:
|
|
93509
|
+
case "screenshot":
|
|
93510
|
+
case "wheel":
|
|
93502
93511
|
return this.sendControl(encodeInput(message));
|
|
93512
|
+
case "key":
|
|
93513
|
+
case "touch":
|
|
93514
|
+
case "button":
|
|
93515
|
+
case "rotate":
|
|
93516
|
+
return this.sendOrdered(encodeInput(message));
|
|
93517
|
+
default: {
|
|
93518
|
+
const unreachable = message;
|
|
93519
|
+
throw new Error(`unknown input message ${JSON.stringify(unreachable)}`);
|
|
93520
|
+
}
|
|
93503
93521
|
}
|
|
93504
93522
|
}
|
|
93505
|
-
/**
|
|
93506
|
-
* Sends a full snapshot of the active touch pointers. Prefer this over
|
|
93507
|
-
* `touch`: snapshots ride the latest-wins "touch" track, where a dropped
|
|
93508
|
-
* intermediate frame cannot lose a down/up transition.
|
|
93509
|
-
*/
|
|
93523
|
+
/** Full snapshot of the active pointers. For interactive gestures; programmatic taps use `touch`. */
|
|
93510
93524
|
async touchState(pointers) {
|
|
93511
93525
|
const track2 = await this.resolveTouchTrack();
|
|
93512
93526
|
if (track2) {
|
|
@@ -93519,24 +93533,44 @@ var MoqDeviceSession = class {
|
|
|
93519
93533
|
await this.sendControl(encodeInput(message));
|
|
93520
93534
|
}
|
|
93521
93535
|
}
|
|
93522
|
-
/** @deprecated Use `touchState`; per-event touch frames can be dropped in transit. */
|
|
93523
93536
|
touch(action, x, y, secondX, secondY) {
|
|
93524
|
-
return this.
|
|
93525
|
-
|
|
93526
|
-
|
|
93537
|
+
return this.sendInput({ type: "touch", action, x, y, secondX, secondY });
|
|
93538
|
+
}
|
|
93539
|
+
key(action, code) {
|
|
93540
|
+
return this.sendInput({ type: "key", action, code });
|
|
93527
93541
|
}
|
|
93528
93542
|
/**
|
|
93529
|
-
*
|
|
93530
|
-
*
|
|
93543
|
+
* Writes run one at a time in call order, so a roll that waits for the
|
|
93544
|
+
* group's age holds everything behind it. A reader the wire layer drops
|
|
93545
|
+
* mid-session (stream reset) is not recovered.
|
|
93531
93546
|
*/
|
|
93532
|
-
|
|
93533
|
-
const
|
|
93534
|
-
|
|
93535
|
-
|
|
93536
|
-
|
|
93537
|
-
|
|
93547
|
+
sendOrdered(payload) {
|
|
93548
|
+
const send = this.orderedQueue.then(() => this.writeOrdered(payload));
|
|
93549
|
+
this.orderedQueue = send.catch(() => {
|
|
93550
|
+
});
|
|
93551
|
+
return send;
|
|
93552
|
+
}
|
|
93553
|
+
/** The current ordered group, or the control track against a server without "keys". */
|
|
93554
|
+
async writeOrdered(payload) {
|
|
93555
|
+
const track2 = await this.resolveOrderedTrack();
|
|
93556
|
+
if (!track2) {
|
|
93538
93557
|
await this.sendControl(payload);
|
|
93558
|
+
return;
|
|
93559
|
+
}
|
|
93560
|
+
if (this.orderedGroup && this.orderedGroupFrames >= ORDERED_GROUP_FRAMES) {
|
|
93561
|
+
const wait = this.orderedGroupOpenedAt + ORDERED_GROUP_MIN_AGE_MS - Date.now();
|
|
93562
|
+
if (wait > 0) await new Promise((resolve21) => setTimeout(resolve21, wait));
|
|
93563
|
+
this.orderedGroup.close();
|
|
93564
|
+
this.orderedGroup = null;
|
|
93539
93565
|
}
|
|
93566
|
+
if (this.disposed) throw new Error("MoQ session is closed");
|
|
93567
|
+
if (!this.orderedGroup) {
|
|
93568
|
+
this.orderedGroup = track2.appendGroup();
|
|
93569
|
+
this.orderedGroupFrames = 0;
|
|
93570
|
+
this.orderedGroupOpenedAt = Date.now();
|
|
93571
|
+
}
|
|
93572
|
+
this.orderedGroup.writeFrame(frame(payload));
|
|
93573
|
+
this.orderedGroupFrames += 1;
|
|
93540
93574
|
}
|
|
93541
93575
|
button(action, button) {
|
|
93542
93576
|
return this.sendInput({ type: "button", action, button });
|
|
@@ -93620,10 +93654,9 @@ var MoqDeviceSession = class {
|
|
|
93620
93654
|
});
|
|
93621
93655
|
}
|
|
93622
93656
|
/**
|
|
93623
|
-
*
|
|
93624
|
-
*
|
|
93625
|
-
*
|
|
93626
|
-
* longer only means it never will. Null means "fall back to control".
|
|
93657
|
+
* The track once the server subscribes it, or null if it has not within the
|
|
93658
|
+
* grace period after the control subscription: a server that speaks the split
|
|
93659
|
+
* protocol subscribes all tracks together.
|
|
93627
93660
|
*/
|
|
93628
93661
|
waitForOptionalTrack(name) {
|
|
93629
93662
|
return new Promise((resolve21) => {
|
|
@@ -93655,12 +93688,9 @@ var MoqDeviceSession = class {
|
|
|
93655
93688
|
});
|
|
93656
93689
|
return this.controlTrack;
|
|
93657
93690
|
}
|
|
93658
|
-
|
|
93659
|
-
|
|
93660
|
-
|
|
93661
|
-
(track2) => track2?.appendGroup() ?? null
|
|
93662
|
-
);
|
|
93663
|
-
return this.keysGroup;
|
|
93691
|
+
resolveOrderedTrack() {
|
|
93692
|
+
this.orderedTrack ??= this.waitForOptionalTrack(KEYS_TRACK);
|
|
93693
|
+
return this.orderedTrack;
|
|
93664
93694
|
}
|
|
93665
93695
|
resolveTouchTrack() {
|
|
93666
93696
|
this.touchTrack ??= this.waitForOptionalTrack(TOUCH_TRACK);
|
|
@@ -93882,8 +93912,7 @@ async function openMoqClientFromInfo(info) {
|
|
|
93882
93912
|
disposeWhenTransportDies(session, () => closed = true);
|
|
93883
93913
|
const refuseClosed = (send) => closed ? Promise.reject(new Error("MoQ session is closed")) : send();
|
|
93884
93914
|
return {
|
|
93885
|
-
|
|
93886
|
-
key: (action, code) => refuseClosed(() => session.key(action, code)),
|
|
93915
|
+
sendInput: (message) => refuseClosed(() => session.sendInput(message)),
|
|
93887
93916
|
async screenshot(opts) {
|
|
93888
93917
|
return Buffer.from(await session.screenshot({ scale: opts?.scale }));
|
|
93889
93918
|
},
|
|
@@ -95179,27 +95208,26 @@ function createMoqTransport(moq, options) {
|
|
|
95179
95208
|
};
|
|
95180
95209
|
return {
|
|
95181
95210
|
async touch(opts) {
|
|
95182
|
-
await moq.
|
|
95183
|
-
|
|
95184
|
-
|
|
95185
|
-
|
|
95186
|
-
|
|
95187
|
-
|
|
95188
|
-
|
|
95189
|
-
|
|
95190
|
-
);
|
|
95211
|
+
await moq.sendInput({
|
|
95212
|
+
type: "touch",
|
|
95213
|
+
action: opts.type,
|
|
95214
|
+
x: opts.x,
|
|
95215
|
+
y: opts.y,
|
|
95216
|
+
secondX: opts.secondX,
|
|
95217
|
+
secondY: opts.secondY
|
|
95218
|
+
});
|
|
95191
95219
|
},
|
|
95192
95220
|
async button(opts) {
|
|
95193
|
-
await moq.
|
|
95221
|
+
await moq.sendInput({ type: "button", action: opts.direction, button: opts.button });
|
|
95194
95222
|
},
|
|
95195
95223
|
async rotate(direction) {
|
|
95196
|
-
await moq.
|
|
95224
|
+
await moq.sendInput({ type: "rotate", direction });
|
|
95197
95225
|
},
|
|
95198
95226
|
async paste(text) {
|
|
95199
95227
|
await options.pasteText(text);
|
|
95200
95228
|
},
|
|
95201
95229
|
async pressKey(direction, keyCode) {
|
|
95202
|
-
await moq.key
|
|
95230
|
+
await moq.sendInput({ type: "key", action: direction, code: keyCode });
|
|
95203
95231
|
},
|
|
95204
95232
|
async screenshot(opts) {
|
|
95205
95233
|
const scale = opts?.scale ?? getScreenshotScale();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@swmansion/argent",
|
|
3
|
-
"version": "0.34.1-next.
|
|
3
|
+
"version": "0.34.1-next.91",
|
|
4
4
|
"mcpName": "io.github.software-mansion/argent",
|
|
5
5
|
"description": "MCP server for iOS Simulator, Android Emulator, Chromium app and Mac app control",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -98,5 +98,5 @@
|
|
|
98
98
|
"vitest": "^5.0.5",
|
|
99
99
|
"yaml": "^2.9.1"
|
|
100
100
|
},
|
|
101
|
-
"gitHead": "
|
|
101
|
+
"gitHead": "ff986ef605bbb86395f98fb4aa81e82de0ca1760"
|
|
102
102
|
}
|