feat(sessions): label lookup tightening (#570) (thanks @azade-c)

This commit is contained in:
Peter Steinberger
2026-01-09 16:39:59 +01:00
parent 09b602b4ec
commit 7d518e336e
8 changed files with 343 additions and 598 deletions

View File

@@ -158,6 +158,12 @@ describe("gateway server sessions", () => {
expect(labelPatched.ok).toBe(true);
expect(labelPatched.payload?.entry.label).toBe("Briefing");
const labelPatchedDuplicate = await rpcReq(ws, "sessions.patch", {
key: "agent:main:discord:group:dev",
label: "Briefing",
});
expect(labelPatchedDuplicate.ok).toBe(false);
const list2 = await rpcReq<{
sessions: Array<{
key: string;
@@ -179,6 +185,18 @@ describe("gateway server sessions", () => {
);
expect(subagent?.label).toBe("Briefing");
const listByLabel = await rpcReq<{
sessions: Array<{ key: string }>;
}>(ws, "sessions.list", {
includeGlobal: false,
includeUnknown: false,
label: "Briefing",
});
expect(listByLabel.ok).toBe(true);
expect(listByLabel.payload?.sessions.map((s) => s.key)).toEqual([
"agent:main:subagent:one",
]);
const spawnedOnly = await rpcReq<{
sessions: Array<{ key: string }>;
}>(ws, "sessions.list", {