@modelnex/sdk 0.5.41 → 0.5.42
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/index.js +25 -5
- package/dist/index.mjs +25 -5
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -3933,6 +3933,9 @@ function isEditableWaitTarget(element) {
|
|
|
3933
3933
|
const target = resolveWaitTargetElement(element);
|
|
3934
3934
|
return isValueBearingElement(target) || target.isContentEditable || target.getAttribute("role") === "textbox" || target.getAttribute("role") === "combobox";
|
|
3935
3935
|
}
|
|
3936
|
+
function shouldPreferHighlightedWaitTargetForInputWait(options) {
|
|
3937
|
+
return options.inputLikeWait && options.resolvedTargetExists && !options.resolvedTargetMatchesPreferred && options.preferredTargetEditable;
|
|
3938
|
+
}
|
|
3936
3939
|
function createManualWaitForTarget(rawTarget, eventName, step, options = {}) {
|
|
3937
3940
|
const target = resolveWaitTargetElement(rawTarget);
|
|
3938
3941
|
const completionTranscript = buildManualCompletionTranscript(step, eventName);
|
|
@@ -4618,9 +4621,14 @@ function useTourPlayback({
|
|
|
4618
4621
|
clearPendingManualInputSync();
|
|
4619
4622
|
if (waitTargetHints) {
|
|
4620
4623
|
let manualWaitTarget = await resolveTargetElement2(waitTargetHints, currentStep);
|
|
4621
|
-
if (
|
|
4624
|
+
if (shouldPreferHighlightedWaitTargetForInputWait({
|
|
4625
|
+
inputLikeWait,
|
|
4626
|
+
resolvedTargetExists: Boolean(manualWaitTarget),
|
|
4627
|
+
resolvedTargetMatchesPreferred: manualWaitTarget === preferredWaitTarget,
|
|
4628
|
+
preferredTargetEditable: isEditableWaitTarget(preferredWaitTarget)
|
|
4629
|
+
})) {
|
|
4622
4630
|
manualWaitTarget = preferredWaitTarget;
|
|
4623
|
-
emitSdkDebugLog("[TourClient] wait_for_input
|
|
4631
|
+
emitSdkDebugLog("[TourClient] wait_for_input preferring highlighted editable target over recorded target", {
|
|
4624
4632
|
stepIndex: stepIndexRef.current,
|
|
4625
4633
|
event: waitEvent
|
|
4626
4634
|
}, { devMode: devModeRef.current });
|
|
@@ -4706,14 +4714,26 @@ function useTourPlayback({
|
|
|
4706
4714
|
if (!transcript) {
|
|
4707
4715
|
return;
|
|
4708
4716
|
}
|
|
4709
|
-
|
|
4710
|
-
|
|
4711
|
-
|
|
4717
|
+
try {
|
|
4718
|
+
const { waitForDomSettle: waitForDomSettle2 } = await Promise.resolve().then(() => (init_dom_sync(), dom_sync_exports));
|
|
4719
|
+
await waitForDomSettle2({ timeoutMs: 1500, debounceMs: 200 });
|
|
4720
|
+
await syncAOM();
|
|
4721
|
+
} catch (error) {
|
|
4722
|
+
emitSdkDebugLog("[TourClient] Failed to sync DOM before sending wait_for_input transcript", {
|
|
4723
|
+
stepIndex: stepIndexRef.current,
|
|
4724
|
+
error: error instanceof Error ? error.message : String(error)
|
|
4725
|
+
}, { devMode: devModeRef.current });
|
|
4726
|
+
}
|
|
4712
4727
|
emitIfOpen("tour:user_input", {
|
|
4713
4728
|
transcript,
|
|
4714
4729
|
runId: runIdRef.current,
|
|
4715
4730
|
turnId: turnIdRef.current
|
|
4716
4731
|
});
|
|
4732
|
+
}).catch((error) => {
|
|
4733
|
+
emitSdkDebugLog("[TourClient] wait_for_input listener rejected", {
|
|
4734
|
+
stepIndex: stepIndexRef.current,
|
|
4735
|
+
error: error instanceof Error ? error.message : String(error)
|
|
4736
|
+
}, { devMode: devModeRef.current });
|
|
4717
4737
|
});
|
|
4718
4738
|
return;
|
|
4719
4739
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -3556,6 +3556,9 @@ function isEditableWaitTarget(element) {
|
|
|
3556
3556
|
const target = resolveWaitTargetElement(element);
|
|
3557
3557
|
return isValueBearingElement(target) || target.isContentEditable || target.getAttribute("role") === "textbox" || target.getAttribute("role") === "combobox";
|
|
3558
3558
|
}
|
|
3559
|
+
function shouldPreferHighlightedWaitTargetForInputWait(options) {
|
|
3560
|
+
return options.inputLikeWait && options.resolvedTargetExists && !options.resolvedTargetMatchesPreferred && options.preferredTargetEditable;
|
|
3561
|
+
}
|
|
3559
3562
|
function createManualWaitForTarget(rawTarget, eventName, step, options = {}) {
|
|
3560
3563
|
const target = resolveWaitTargetElement(rawTarget);
|
|
3561
3564
|
const completionTranscript = buildManualCompletionTranscript(step, eventName);
|
|
@@ -4241,9 +4244,14 @@ function useTourPlayback({
|
|
|
4241
4244
|
clearPendingManualInputSync();
|
|
4242
4245
|
if (waitTargetHints) {
|
|
4243
4246
|
let manualWaitTarget = await resolveTargetElement2(waitTargetHints, currentStep);
|
|
4244
|
-
if (
|
|
4247
|
+
if (shouldPreferHighlightedWaitTargetForInputWait({
|
|
4248
|
+
inputLikeWait,
|
|
4249
|
+
resolvedTargetExists: Boolean(manualWaitTarget),
|
|
4250
|
+
resolvedTargetMatchesPreferred: manualWaitTarget === preferredWaitTarget,
|
|
4251
|
+
preferredTargetEditable: isEditableWaitTarget(preferredWaitTarget)
|
|
4252
|
+
})) {
|
|
4245
4253
|
manualWaitTarget = preferredWaitTarget;
|
|
4246
|
-
emitSdkDebugLog("[TourClient] wait_for_input
|
|
4254
|
+
emitSdkDebugLog("[TourClient] wait_for_input preferring highlighted editable target over recorded target", {
|
|
4247
4255
|
stepIndex: stepIndexRef.current,
|
|
4248
4256
|
event: waitEvent
|
|
4249
4257
|
}, { devMode: devModeRef.current });
|
|
@@ -4329,14 +4337,26 @@ function useTourPlayback({
|
|
|
4329
4337
|
if (!transcript) {
|
|
4330
4338
|
return;
|
|
4331
4339
|
}
|
|
4332
|
-
|
|
4333
|
-
|
|
4334
|
-
|
|
4340
|
+
try {
|
|
4341
|
+
const { waitForDomSettle } = await import("./dom-sync-GABDEODR.mjs");
|
|
4342
|
+
await waitForDomSettle({ timeoutMs: 1500, debounceMs: 200 });
|
|
4343
|
+
await syncAOM();
|
|
4344
|
+
} catch (error) {
|
|
4345
|
+
emitSdkDebugLog("[TourClient] Failed to sync DOM before sending wait_for_input transcript", {
|
|
4346
|
+
stepIndex: stepIndexRef.current,
|
|
4347
|
+
error: error instanceof Error ? error.message : String(error)
|
|
4348
|
+
}, { devMode: devModeRef.current });
|
|
4349
|
+
}
|
|
4335
4350
|
emitIfOpen("tour:user_input", {
|
|
4336
4351
|
transcript,
|
|
4337
4352
|
runId: runIdRef.current,
|
|
4338
4353
|
turnId: turnIdRef.current
|
|
4339
4354
|
});
|
|
4355
|
+
}).catch((error) => {
|
|
4356
|
+
emitSdkDebugLog("[TourClient] wait_for_input listener rejected", {
|
|
4357
|
+
stepIndex: stepIndexRef.current,
|
|
4358
|
+
error: error instanceof Error ? error.message : String(error)
|
|
4359
|
+
}, { devMode: devModeRef.current });
|
|
4340
4360
|
});
|
|
4341
4361
|
return;
|
|
4342
4362
|
}
|