autoglm.js 0.0.11 → 0.0.12
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.mjs +9 -5
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1178,7 +1178,7 @@ var ActionHandler = class {
|
|
|
1178
1178
|
return {
|
|
1179
1179
|
success: false,
|
|
1180
1180
|
should_finish: true,
|
|
1181
|
-
message:
|
|
1181
|
+
message: action.reason
|
|
1182
1182
|
};
|
|
1183
1183
|
}
|
|
1184
1184
|
};
|
|
@@ -1644,6 +1644,7 @@ var PhoneAgent = class {
|
|
|
1644
1644
|
context = [];
|
|
1645
1645
|
stepCount = 0;
|
|
1646
1646
|
abortController = null;
|
|
1647
|
+
externalSignal;
|
|
1647
1648
|
isAborted = false;
|
|
1648
1649
|
constructor(context, confirmationCallback, takeoverCallback) {
|
|
1649
1650
|
this.ctx = context;
|
|
@@ -1676,9 +1677,7 @@ var PhoneAgent = class {
|
|
|
1676
1677
|
}
|
|
1677
1678
|
this.abortController = new AbortController();
|
|
1678
1679
|
this.isAborted = false;
|
|
1679
|
-
|
|
1680
|
-
this.abort(signal.reason || "External signal aborted");
|
|
1681
|
-
});
|
|
1680
|
+
this.externalSignal = signal;
|
|
1682
1681
|
try {
|
|
1683
1682
|
this.reset();
|
|
1684
1683
|
let result = await this._executeStep(task, true);
|
|
@@ -1691,6 +1690,7 @@ var PhoneAgent = class {
|
|
|
1691
1690
|
throw new Error("Max steps reached");
|
|
1692
1691
|
} finally {
|
|
1693
1692
|
this.abortController = null;
|
|
1693
|
+
this.externalSignal = void 0;
|
|
1694
1694
|
}
|
|
1695
1695
|
}
|
|
1696
1696
|
/**
|
|
@@ -1737,7 +1737,11 @@ var PhoneAgent = class {
|
|
|
1737
1737
|
this.context.push(MessageBuilder.createUserMessage(textContent, screenshot.base64Data));
|
|
1738
1738
|
}
|
|
1739
1739
|
try {
|
|
1740
|
-
const
|
|
1740
|
+
const signals = [new AbortController().signal];
|
|
1741
|
+
if (this.abortController) signals.push(this.abortController.signal);
|
|
1742
|
+
if (this.externalSignal) signals.push(this.externalSignal);
|
|
1743
|
+
const combinedSignal = AbortSignal.any(signals);
|
|
1744
|
+
const response = await this.modelClient.request(this.context, { signal: combinedSignal });
|
|
1741
1745
|
let action;
|
|
1742
1746
|
try {
|
|
1743
1747
|
action = parseAction(response.action);
|