autoglm.js 0.0.9 → 0.0.10

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.
Files changed (2) hide show
  1. package/dist/index.mjs +10 -7
  2. package/package.json +3 -3
package/dist/index.mjs CHANGED
@@ -1624,6 +1624,13 @@ var ModelClient = class {
1624
1624
  }
1625
1625
  };
1626
1626
 
1627
+ //#endregion
1628
+ //#region src/utils/finishMessage.ts
1629
+ function getFinishMessage(result) {
1630
+ const actionMessage = result?.action?._metadata === "finish" ? result.action.message : void 0;
1631
+ return result?.message || actionMessage || result?.thinking || "Task completed";
1632
+ }
1633
+
1627
1634
  //#endregion
1628
1635
  //#region src/agent/index.ts
1629
1636
  var PhoneAgent = class {
@@ -1738,18 +1745,14 @@ var PhoneAgent = class {
1738
1745
  const result = await this.actionHandler.execute(action, screenshot.width, screenshot.height);
1739
1746
  this.context.push(MessageBuilder.createAssistantMessage(`<think>${response.thinking}</think><answer>${response.action}</answer>`));
1740
1747
  const finished = action._metadata === "finish" || result.should_finish;
1741
- if (finished) {
1742
- const actionMessage$1 = action._metadata === "finish" ? action.message : void 0;
1743
- const message = result.message || actionMessage$1 || "Task completed";
1744
- this.ctx.emit(EventType.TASK_COMPLETE, message);
1745
- }
1746
- const actionMessage = action._metadata === "finish" ? action.message : void 0;
1748
+ const message = getFinishMessage(result);
1749
+ if (finished) this.ctx.emit(EventType.TASK_COMPLETE, message);
1747
1750
  return {
1748
1751
  success: result.success,
1749
1752
  finished,
1750
1753
  action,
1751
1754
  thinking: response.thinking,
1752
- message: result.message || actionMessage
1755
+ message
1753
1756
  };
1754
1757
  } catch (error) {
1755
1758
  return {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "autoglm.js",
3
3
  "type": "module",
4
- "version": "0.0.9",
4
+ "version": "0.0.10",
5
5
  "private": false,
6
6
  "description": "AutoGLM.js is a JavaScript library for Open-AutoGLM",
7
7
  "author": "FliPPeDround <flippedround@qq.com>",
@@ -48,10 +48,10 @@
48
48
  "unzipper": "^0.12.3"
49
49
  },
50
50
  "optionalDependencies": {
51
- "@autoglm.js/platform-tools-darwin": "36.0.0",
52
51
  "@autoglm.js/adb-keyboard": "0.0.1",
53
52
  "@autoglm.js/platform-tools-linux": "36.0.0",
54
- "@autoglm.js/platform-tools-windows": "36.0.0"
53
+ "@autoglm.js/platform-tools-windows": "36.0.0",
54
+ "@autoglm.js/platform-tools-darwin": "36.0.0"
55
55
  },
56
56
  "devDependencies": {
57
57
  "@types/fs-extra": "^11.0.4",