@xenosystem/agent-interface-ui 0.1.189 → 0.1.190
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/dist/components/agent/AgentAuthGate.d.ts.map +1 -1
- package/dist/components/agent/AgentAuthGate.js +18 -3
- package/dist/components/agent/AgentAuthGate.js.map +1 -1
- package/dist/components/agent/AgentInterface.d.ts.map +1 -1
- package/dist/components/agent/AgentInterface.js +5 -3
- package/dist/components/agent/AgentInterface.js.map +1 -1
- package/dist/components/agent/sidebarAccount.d.ts +17 -0
- package/dist/components/agent/sidebarAccount.d.ts.map +1 -0
- package/dist/components/agent/sidebarAccount.js +52 -0
- package/dist/components/agent/sidebarAccount.js.map +1 -0
- package/package.json +6 -6
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export interface SidebarHostAccount {
|
|
2
|
+
displayName?: string | null;
|
|
3
|
+
email?: string | null;
|
|
4
|
+
}
|
|
5
|
+
export interface SidebarLegacyUser {
|
|
6
|
+
display_name?: string | null;
|
|
7
|
+
username?: string | null;
|
|
8
|
+
credits?: number | null;
|
|
9
|
+
}
|
|
10
|
+
export declare function sidebarAccountLine(account: SidebarHostAccount | null | undefined, legacy: SidebarLegacyUser | null | undefined): {
|
|
11
|
+
name: string;
|
|
12
|
+
detail: string;
|
|
13
|
+
signedIn: boolean;
|
|
14
|
+
};
|
|
15
|
+
/** The host's signed-in account, or null. Re-read when the window regains focus and every 30 s, so sign-out shows. */
|
|
16
|
+
export declare function useHostAccount(): SidebarHostAccount | null;
|
|
17
|
+
//# sourceMappingURL=sidebarAccount.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sidebarAccount.d.ts","sourceRoot":"","sources":["../../../src/components/agent/sidebarAccount.ts"],"names":[],"mappings":"AAWA,MAAM,WAAW,kBAAkB;IAAG,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE;AAC1F,MAAM,WAAW,iBAAiB;IAAG,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE;AAEtH,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,kBAAkB,GAAG,IAAI,GAAG,SAAS,EAC9C,MAAM,EAAE,iBAAiB,GAAG,IAAI,GAAG,SAAS,GAC3C;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,OAAO,CAAA;CAAE,CAarD;AAID,sHAAsH;AACtH,wBAAgB,cAAc,IAAI,kBAAkB,GAAG,IAAI,CAqB1D"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Who the sidebar's account row shows.
|
|
3
|
+
*
|
|
4
|
+
* 🔴 The row used to read only the legacy web-token auth store, which the desktop app never fills: its account
|
|
5
|
+
* lives in the Agent host's account service. So the row said "Not signed in / Sign in" while Settings › Account
|
|
6
|
+
* showed the signed-in person (owner's report, 2026-11-10: "it says I am logged in but it said not signed in").
|
|
7
|
+
* The host's account is the source; the legacy store is used only where a host has no account service.
|
|
8
|
+
*/
|
|
9
|
+
import { useEffect, useState } from 'react';
|
|
10
|
+
import { getOptionalAgentPlatformBridge } from '@xenosystem/agent-conversation/platformBridge';
|
|
11
|
+
export function sidebarAccountLine(account, legacy) {
|
|
12
|
+
const credits = legacy
|
|
13
|
+
? `${Number(legacy.credits ?? 0).toLocaleString(undefined, { maximumFractionDigits: 2 })} credits`
|
|
14
|
+
: undefined;
|
|
15
|
+
if (account) {
|
|
16
|
+
const name = account.displayName?.trim() || account.email?.trim() || 'Signed in';
|
|
17
|
+
const email = account.email?.trim();
|
|
18
|
+
return { name, detail: credits ?? (email && email !== name ? email : 'Signed in'), signedIn: true };
|
|
19
|
+
}
|
|
20
|
+
if (legacy) {
|
|
21
|
+
return { name: legacy.display_name?.trim() || legacy.username || 'Signed in', detail: credits, signedIn: true };
|
|
22
|
+
}
|
|
23
|
+
return { name: 'Not signed in', detail: 'Sign in', signedIn: false };
|
|
24
|
+
}
|
|
25
|
+
const REFRESH_MS = 30_000;
|
|
26
|
+
/** The host's signed-in account, or null. Re-read when the window regains focus and every 30 s, so sign-out shows. */
|
|
27
|
+
export function useHostAccount() {
|
|
28
|
+
const [account, setAccount] = useState(null);
|
|
29
|
+
useEffect(() => {
|
|
30
|
+
let alive = true;
|
|
31
|
+
const read = async () => {
|
|
32
|
+
const bridge = getOptionalAgentPlatformBridge()?.account;
|
|
33
|
+
if (!bridge)
|
|
34
|
+
return;
|
|
35
|
+
try {
|
|
36
|
+
const result = await bridge.request({ action: 'status' });
|
|
37
|
+
const status = result?.status;
|
|
38
|
+
if (!alive || !result?.success || !status)
|
|
39
|
+
return;
|
|
40
|
+
setAccount(status.state === 'signed-in' ? (status.account ?? {}) : null);
|
|
41
|
+
}
|
|
42
|
+
catch { /* the host is restarting; keep what we showed and ask again on the next tick */ }
|
|
43
|
+
};
|
|
44
|
+
void read();
|
|
45
|
+
const timer = window.setInterval(() => { void read(); }, REFRESH_MS);
|
|
46
|
+
const onFocus = () => { void read(); };
|
|
47
|
+
window.addEventListener('focus', onFocus);
|
|
48
|
+
return () => { alive = false; window.clearInterval(timer); window.removeEventListener('focus', onFocus); };
|
|
49
|
+
}, []);
|
|
50
|
+
return account;
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=sidebarAccount.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sidebarAccount.js","sourceRoot":"","sources":["../../../src/components/agent/sidebarAccount.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAC3C,OAAO,EAAE,8BAA8B,EAAE,MAAM,+CAA+C,CAA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ent-interface-ui",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.190",
|
|
4
4
|
"license": "UNLICENSED",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -48,11 +48,11 @@
|
|
|
48
48
|
"remark-gfm": "^4.0.1",
|
|
49
49
|
"uqr": "0.1.2",
|
|
50
50
|
"zustand": "^5.0.2",
|
|
51
|
-
"@xenosystem/agent-conversation": "0.1.
|
|
52
|
-
"@xenosystem/agent-interface-
|
|
53
|
-
"@xenosystem/agent-interface-contract": "0.1.
|
|
54
|
-
"@xenosystem/agent-interface-
|
|
55
|
-
"@xenosystem/agent-interface-
|
|
51
|
+
"@xenosystem/agent-conversation": "0.1.190",
|
|
52
|
+
"@xenosystem/agent-interface-client": "0.1.190",
|
|
53
|
+
"@xenosystem/agent-interface-contract": "0.1.190",
|
|
54
|
+
"@xenosystem/agent-interface-core": "0.1.190",
|
|
55
|
+
"@xenosystem/agent-interface-hub-adapter": "0.1.190"
|
|
56
56
|
},
|
|
57
57
|
"peerDependencies": {
|
|
58
58
|
"react": "^19.0.0",
|