@clawchatsai/connector 0.2.4 → 0.2.6

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.
@@ -251,6 +251,18 @@ test('a team chat needs two agents; removing down to one is refused', async () =
251
251
  assert.deepEqual((await h.team.removeAgent(roomKey, 'dev')).agents.map(a => a.agentId), ['atlas', 'main']);
252
252
  });
253
253
 
254
+ test('an agent added on the gateway a moment ago can join right away (agents.list cache refreshed on a miss)', async () => {
255
+ const agents = [...AGENTS];
256
+ const h = harness(() => 'x', { agents });
257
+ const { roomKey } = await h.team.createRoom({ agentIds: ['dev', 'atlas'] }); // fills the cache
258
+ agents.push({ id: 'helper', identity: { name: 'Helper' } }, { id: 'ops', identity: {} });
259
+ assert.deepEqual((await h.team.createRoom({ agentIds: ['main', 'helper'] })).agents.map(a => a.agentId), ['main', 'helper']);
260
+ assert.deepEqual((await h.team.addAgent(roomKey, 'ops')).agents.map(a => a.agentId), ['dev', 'atlas', 'ops']);
261
+ const lists = h.calls.filter(c => c.method === 'agents.list').length;
262
+ await assert.rejects(h.team.createRoom({ agentIds: ['main', 'nobody'] }), /unknown agent: nobody/);
263
+ assert.equal(h.calls.filter(c => c.method === 'agents.list').length, lists + 1); // one re-read, then refused
264
+ });
265
+
254
266
  test('stop: a partial reply is posted marked stopped; a reply that finished anyway is posted', async () => {
255
267
  const pending = [];
256
268
  const h = harness(agent => new Promise(resolve => pending.push({ agent, resolve })));