@clowder-ai/companion 0.1.0-alpha.1 → 0.1.0-alpha.2

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/manifest.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "pluginId": "official.companion",
3
- "version": "0.1.0-alpha.1",
3
+ "version": "0.1.0-alpha.2",
4
4
  "contractVersion": "0.1.0",
5
5
  "name": "猫猫球",
6
6
  "icon": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clowder-ai/companion",
3
- "version": "0.1.0-alpha.1",
3
+ "version": "0.1.0-alpha.2",
4
4
  "description": "The desktop voice body for your Clowder companion",
5
5
  "license": "MIT",
6
6
  "type": "module",
package/plugin.yaml CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "pluginId": "official.companion",
3
- "version": "0.1.0-alpha.1",
3
+ "version": "0.1.0-alpha.2",
4
4
  "contractVersion": "0.1.0",
5
5
  "name": "猫猫球",
6
6
  "icon": {
@@ -26,10 +26,6 @@ export class CompanionConversation {
26
26
  this.show('正在连接…');
27
27
  this.deadline = setTimeout(() => { if (this.current(generation)) void this.end('连接超时 · 点击开始聊天重试'); }, 60_000);
28
28
  try {
29
- const identity = await preparation;
30
- if (!this.current(generation)) return;
31
- if (identity.phase !== 'ready') throw { code: 'unavailable' };
32
- this.identity = identity;
33
29
  const peer = this.createPeer(event => {
34
30
  if (!this.current(generation)) return;
35
31
  if (event.type === 'connected') { clearTimeout(this.deadline); this.phase = 'talking'; this.show(this.listening()); }
@@ -40,8 +36,13 @@ export class CompanionConversation {
40
36
  });
41
37
  this.peer = peer;
42
38
  peer.muteMic(this.muted); peer.muteSpeaker(this.silent);
43
- await peer.connect();
44
- if (!this.current(generation)) await peer.close();
39
+ // Submit capture intent while this same click is active. The Host waits
40
+ // for its matching preparation before creating the media document.
41
+ const [identity] = await Promise.all([preparation, peer.connect()]);
42
+ if (!this.current(generation)) { await peer.close(); return; }
43
+ if (identity.phase !== 'ready') throw { code: 'unavailable' };
44
+ this.identity = identity;
45
+ this.show(this.message);
45
46
  } catch (error) {
46
47
  if (this.current(generation)) await this.end(explainError(error));
47
48
  }