mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-11-06 14:02:36 +01:00
Add Muse invitation, connection readiness and scoped operator controls.
Keep connection state tied to the current company, person, agent and binding. Surface failed reads and invalidate stale cleanup observations; require current authority and exact readback. Preserve Dot/Grok setup, source-trust limits and existing design tokens.
Carry actual merged backend e6dcc6b095 through a normal forward merge. Preserve its project-write authority fix, existing migration bytes and upstream idle-serving behavior; no new UI behavior is authored by this source carry. Current-head CI and substantive review remain merge gates; final canonical and deployed-provider qualification remain separate.
Refs #16450.
Co-Authored-By: Paperclip <noreply@paperclip.ing>
22 lines
1.4 KiB
TypeScript
22 lines
1.4 KiB
TypeScript
// @vitest-environment jsdom
|
|
import { afterEach, expect, it } from "vitest";
|
|
import { readMuseInvitationDraft, saveMuseInvitationDraft } from "./muse-invitation-draft";
|
|
|
|
afterEach(() => localStorage.clear());
|
|
it("retains only name and role in the exact company and operator scope", () => {
|
|
const draft = { name: "Maia", role: "researcher" as const, ticket: "secret-not-to-save", setupInstruction: "private setup" };
|
|
saveMuseInvitationDraft("company-a", "operator-a", draft);
|
|
expect(readMuseInvitationDraft("company-a", "operator-a")).toEqual({ name: "Maia", role: "researcher" });
|
|
expect(readMuseInvitationDraft("company-b", "operator-a").name).toBe("");
|
|
expect(readMuseInvitationDraft("company-a", "operator-b").name).toBe("");
|
|
expect(readMuseInvitationDraft("company-a", null).name).toBe("");
|
|
expect(localStorage.getItem(localStorage.key(0)!)).not.toContain("secret-not-to-save");
|
|
expect(localStorage.getItem(localStorage.key(0)!)).not.toContain("setupInstruction");
|
|
});
|
|
it("rejects a corrupt role and does not share a signed-out draft", () => {
|
|
saveMuseInvitationDraft("company", null, { name: "Anonymous", role: "general" });
|
|
expect(localStorage.length).toBe(0);
|
|
localStorage.setItem("paperclip.muse-invitation.company.operator", JSON.stringify({ name: "Maia", role: "invented" }));
|
|
expect(readMuseInvitationDraft("company", "operator")).toEqual({ name: "", role: "general" });
|
|
});
|