@bolloon/bolloon-agent 0.3.25 → 0.3.26

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.
@@ -6046,7 +6046,10 @@ ${data.error || "channel not found"}`, "error");
6046
6046
  autoInvokeTools
6047
6047
  })
6048
6048
  });
6049
- if (!res.ok) throw new Error("create failed");
6049
+ if (!res.ok) {
6050
+ const errData = await res.json().catch(() => ({}));
6051
+ throw new Error(errData.error || `HTTP ${res.status}`);
6052
+ }
6050
6053
  const channel = await res.json();
6051
6054
  channels.push(channel);
6052
6055
  renderChannels();
@@ -3698,6 +3698,14 @@ ${goalDesc}
3698
3698
  return res.status(400).json({ error: 'name and agentId required' });
3699
3699
  }
3700
3700
  const channels = await loadChannels();
3701
+ // 2026-08-02 fix: 同 agentId 下禁止重名 — 之前用户连点两次"新建智能体"生成两个同名
3702
+ // "智能体" channel, UI 无法区分 (分享栏名字对不上 id). 同 agentId 同名直接拒绝.
3703
+ const dupName = channels.find(c => c.agentId === agentId && c.name === name.trim());
3704
+ if (dupName) {
3705
+ return res.status(400).json({
3706
+ error: `同名智能体已存在 (${dupName.name}, id=${dupName.id}), 请换一个名字`
3707
+ });
3708
+ }
3701
3709
  const id = `ch_${Date.now()}_${Math.random().toString(36).substring(2, 8)}`;
3702
3710
  // 校验钱包地址格式 (粗校验: 0x + 40 hex / Solana base58 / Sui 0x+64)
3703
3711
  const validWallet = isValidWalletAddress(walletAddress);
@@ -4096,12 +4104,31 @@ ${goalDesc}
4096
4104
  console.log(`[Channel ${channelId}] 自动生成 share_id: ${channel.share_id}`);
4097
4105
  }
4098
4106
  channel.updatedAt = new Date().toISOString();
4099
- // 2026-08-02 fix: 原子写入
4107
+ // 2026-08-02 fix: 原子写入 — 之前回调只写 shared_with_peers/share_id, name 等字段
4108
+ // 只改了外层内存对象, 磁盘没落 → 改名后重启名字回退 / 与 UI 显示不一致 ("改名没修好")
4100
4109
  await updateChannels((chs) => {
4101
4110
  const c = chs.find(x => x.id === channelId);
4102
4111
  if (c) {
4112
+ if (typeof name === 'string' && name.trim())
4113
+ c.name = name.trim();
4114
+ if (persona !== undefined) {
4115
+ if (persona === null)
4116
+ c.persona = undefined;
4117
+ else if (typeof persona === 'object')
4118
+ c.persona = channel.persona;
4119
+ }
4120
+ if (Array.isArray(linkedDocumentIds))
4121
+ c.linkedDocumentIds = channel.linkedDocumentIds;
4122
+ if (walletAddress !== undefined) {
4123
+ c.walletAddress = channel.walletAddress;
4124
+ c.walletRegisteredAt = channel.walletRegisteredAt;
4125
+ }
4126
+ if (typeof autoInvokeTools === 'boolean')
4127
+ c.autoInvokeTools = channel.autoInvokeTools;
4128
+ if (bound_judgment_ids !== undefined)
4129
+ c.bound_judgment_ids = channel.bound_judgment_ids;
4103
4130
  if (shared_with_peers !== undefined)
4104
- c.shared_with_peers = shared_with_peers;
4131
+ c.shared_with_peers = channel.shared_with_peers;
4105
4132
  if (!c.share_id)
4106
4133
  c.share_id = channel.share_id;
4107
4134
  c.updatedAt = new Date().toISOString();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bolloon/bolloon-agent",
3
- "version": "0.3.25",
3
+ "version": "0.3.26",
4
4
  "type": "module",
5
5
  "description": "P2P AI Document Agent - 全局安装后执行 `bolloon` 启动产品",
6
6
  "main": "dist/cli-entry.js",