doubao-cli 0.2.1 → 0.2.3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "doubao-cli",
3
- "version": "0.2.1",
3
+ "version": "0.2.3",
4
4
  "description": "Programmatic control for local Doubao desktop sessions on macOS",
5
5
  "type": "module",
6
6
  "bin": {
@@ -105,7 +105,17 @@ export async function sendMessage(id, message, options = {}) {
105
105
  messages = await readFromClient(client);
106
106
  const assistantMessages = messages.filter((item) => item.role === 'assistant');
107
107
  const reply = assistantMessages.length > assistantCountBefore ? assistantMessages.at(-1) : null;
108
- const generating = await client.evaluate(`Boolean(document.querySelector('[data-testid="chat_input_local_break_button"], [data-testid="chat_input_end_button"]'))`);
108
+ const generating = await client.evaluate(`[
109
+ ...document.querySelectorAll('[data-testid="chat_input_local_break_button"], [data-testid="chat_input_end_button"]'),
110
+ ].some((element) => {
111
+ const style = getComputedStyle(element);
112
+ const rect = element.getBoundingClientRect();
113
+ return style.display !== 'none'
114
+ && style.visibility !== 'hidden'
115
+ && Number(style.opacity) !== 0
116
+ && rect.width > 0
117
+ && rect.height > 0;
118
+ })`);
109
119
  if (reply?.text && reply.text === stableText && !generating) stablePolls += 1;
110
120
  else stablePolls = 0;
111
121
  stableText = reply?.text || '';
package/src/cli.mjs CHANGED
@@ -6,7 +6,7 @@ import { cdpStatus } from './cdp.mjs';
6
6
  import { openConversation, readConversation, sendMessage } from './automation.mjs';
7
7
 
8
8
  const DEFAULT_APP = '/Applications/Doubao.app';
9
- const CLI_VERSION = '0.2.0';
9
+ const CLI_VERSION = JSON.parse(fs.readFileSync(new URL('../package.json', import.meta.url), 'utf8')).version;
10
10
 
11
11
  const HELP = `Usage:
12
12
  doubao status [--profile <name>] [--json]