@declarion/react 0.177.0 → 0.182.0
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-lib/api/access-expiry.js +28 -6
- package/dist-lib/api/agents.js +19 -8
- package/dist-lib/api/audience.js +1 -1
- package/dist-lib/api/auth.js +63 -62
- package/dist-lib/api/client.js +39 -37
- package/dist-lib/app.js +101 -101
- package/dist-lib/components/agents/AgentChatPanel.impl.js +275 -177
- package/dist-lib/components/agents/transcript-runs.js +19 -7
- package/dist-lib/components/detail-layout/EvidenceBlock.js +1 -1
- package/dist-lib/components/pages/auth/SignIn.js +4 -2
- package/dist-lib/components/pages/profile/Profile.impl.js +149 -135
- package/dist-lib/hooks/useSchema.js +15 -14
- package/dist-lib/index.d.ts +19 -1
- package/dist-lib/stores/auth.js +55 -46
- package/package.json +1 -1
package/dist-lib/index.d.ts
CHANGED
|
@@ -1993,6 +1993,11 @@ type AgentRole = "user" | "assistant" | "tool" | "system";
|
|
|
1993
1993
|
type AgentContentBlock = {
|
|
1994
1994
|
type: "text";
|
|
1995
1995
|
text: string;
|
|
1996
|
+
callback_data?: string;
|
|
1997
|
+
heard?: boolean;
|
|
1998
|
+
} | {
|
|
1999
|
+
type: "reaction";
|
|
2000
|
+
emoji?: string;
|
|
1996
2001
|
} | {
|
|
1997
2002
|
type: "tool_use";
|
|
1998
2003
|
id: string;
|
|
@@ -2054,7 +2059,17 @@ interface AgentMessage {
|
|
|
2054
2059
|
turn_id?: string | null;
|
|
2055
2060
|
created_at: string;
|
|
2056
2061
|
streaming?: boolean;
|
|
2057
|
-
|
|
2062
|
+
bot_id?: string | null;
|
|
2063
|
+
chat_id?: string | null;
|
|
2064
|
+
topic_id?: string | null;
|
|
2065
|
+
sender_external_id?: string | null;
|
|
2066
|
+
sender_user_id?: string | null;
|
|
2067
|
+
delivery_key?: string | null;
|
|
2068
|
+
delivery_status?: AgentDeliveryStatus | null;
|
|
2069
|
+
bot?: string;
|
|
2070
|
+
sender_user?: string;
|
|
2071
|
+
}
|
|
2072
|
+
type AgentDeliveryStatus = "pending" | "sent" | "failed" | "unknown";
|
|
2058
2073
|
type AgentTurnStatus = "queued" | "running" | "waiting" | "completed" | "failed" | "canceled";
|
|
2059
2074
|
interface AgentTurn {
|
|
2060
2075
|
id: string;
|
|
@@ -2111,6 +2126,9 @@ interface AgentConversation {
|
|
|
2111
2126
|
created_by?: string;
|
|
2112
2127
|
agent_id?: string;
|
|
2113
2128
|
agent?: string;
|
|
2129
|
+
chat_id?: string | null;
|
|
2130
|
+
topic_id?: string | null;
|
|
2131
|
+
updated_at?: string;
|
|
2114
2132
|
title?: string;
|
|
2115
2133
|
model?: string;
|
|
2116
2134
|
status: AgentConversationStatus;
|
package/dist-lib/stores/auth.js
CHANGED
|
@@ -1,95 +1,104 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { cancelProactiveRefresh as
|
|
4
|
-
import { sessionCaller as
|
|
5
|
-
import { isEmbedTokenMode as
|
|
6
|
-
import { warmRoutePages as
|
|
7
|
-
import { usePreferencesStore as
|
|
8
|
-
import { create as
|
|
1
|
+
import { clearSignOut as e, startOrderNow as t } from "../api/access-expiry.js";
|
|
2
|
+
import { getMe as n, listTenants as r, logout as i, probeSession as a } from "../api/auth.js";
|
|
3
|
+
import { cancelProactiveRefresh as o, endSessionInPage as s, ensureRefresh as c, isSignedOutInPage as l, scheduleProactiveRefresh as u, setLanguageReader as d } from "../api/client.js";
|
|
4
|
+
import { sessionCaller as f } from "../api/audience.js";
|
|
5
|
+
import { isEmbedTokenMode as p } from "../embed/token.js";
|
|
6
|
+
import { warmRoutePages as m } from "../lib/capabilityPrefetch.js";
|
|
7
|
+
import { usePreferencesStore as h } from "./preferences.js";
|
|
8
|
+
import { create as g } from "zustand";
|
|
9
9
|
// src/stores/auth.ts
|
|
10
|
-
async function
|
|
11
|
-
let
|
|
10
|
+
async function _(t, n, r) {
|
|
11
|
+
let i = () => t({
|
|
12
12
|
user: null,
|
|
13
13
|
isAuthenticated: !1,
|
|
14
14
|
isLoading: !1,
|
|
15
15
|
sessionPresumed: !1,
|
|
16
16
|
identitySince: performance.now()
|
|
17
17
|
});
|
|
18
|
-
if (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
18
|
+
if (l()) {
|
|
19
|
+
i();
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
let a = performance.now();
|
|
23
|
+
try {
|
|
24
|
+
let o = await r();
|
|
25
|
+
if (n().identitySince > a) return;
|
|
26
|
+
if (l()) {
|
|
27
|
+
i();
|
|
23
28
|
return;
|
|
24
29
|
}
|
|
25
|
-
|
|
26
|
-
user:
|
|
30
|
+
e(), u(o.access_expires_at), t({
|
|
31
|
+
user: o,
|
|
27
32
|
isAuthenticated: !0,
|
|
28
33
|
isLoading: !1,
|
|
29
|
-
activeTenant:
|
|
34
|
+
activeTenant: o.tenant ?? null,
|
|
30
35
|
identitySince: performance.now()
|
|
31
|
-
}),
|
|
36
|
+
}), n().loadTenants();
|
|
32
37
|
} catch {
|
|
33
|
-
|
|
38
|
+
n().identitySince <= a && i();
|
|
34
39
|
}
|
|
35
40
|
}
|
|
36
|
-
var
|
|
41
|
+
var v = g((e, o) => ({
|
|
37
42
|
user: null,
|
|
38
43
|
isAuthenticated: !1,
|
|
39
44
|
isLoading: !0,
|
|
40
45
|
activeTenant: null,
|
|
41
46
|
tenants: [],
|
|
42
47
|
sessionPresumed: !1,
|
|
48
|
+
signedOutPresumed: !1,
|
|
43
49
|
identitySince: 0,
|
|
44
50
|
initialize: async () => {
|
|
45
|
-
let
|
|
46
|
-
|
|
51
|
+
let n = t();
|
|
52
|
+
n === "refresh-first" && (n = await c().then(() => "first-wave", () => "probe-first")), e({
|
|
53
|
+
sessionPresumed: n === "first-wave",
|
|
54
|
+
signedOutPresumed: n === "probe-first" && window.location.pathname === "/login"
|
|
55
|
+
}), n === "first-wave" && m(), await _(e, o, a), n === "probe-first" && o().isAuthenticated && m();
|
|
47
56
|
},
|
|
48
|
-
reloadSession: () =>
|
|
49
|
-
recheckSession: () =>
|
|
57
|
+
reloadSession: () => _(e, o, n),
|
|
58
|
+
recheckSession: () => _(e, o, a),
|
|
50
59
|
refreshMe: async () => {
|
|
51
60
|
try {
|
|
52
|
-
let t = await
|
|
53
|
-
if (
|
|
54
|
-
let
|
|
55
|
-
|
|
61
|
+
let t = await n();
|
|
62
|
+
if (l()) return;
|
|
63
|
+
let r = o(), i = r.user?.id !== t.id || r.activeTenant?.id !== t.tenant?.id;
|
|
64
|
+
e({
|
|
56
65
|
user: t,
|
|
57
66
|
activeTenant: t.tenant ?? null,
|
|
58
|
-
...
|
|
67
|
+
...i ? { identitySince: performance.now() } : {}
|
|
59
68
|
});
|
|
60
69
|
} catch {}
|
|
61
70
|
},
|
|
62
|
-
setUser: (
|
|
63
|
-
|
|
64
|
-
user:
|
|
71
|
+
setUser: (t, n) => {
|
|
72
|
+
m(), e({
|
|
73
|
+
user: t,
|
|
65
74
|
isAuthenticated: !0,
|
|
66
75
|
isLoading: !1,
|
|
67
|
-
activeTenant:
|
|
76
|
+
activeTenant: n ?? null,
|
|
68
77
|
identitySince: performance.now()
|
|
69
78
|
});
|
|
70
79
|
},
|
|
71
80
|
loadTenants: () => {
|
|
72
|
-
|
|
73
|
-
|
|
81
|
+
r().then((t) => {
|
|
82
|
+
l() || e({ tenants: t });
|
|
74
83
|
}, () => void 0);
|
|
75
84
|
},
|
|
76
|
-
setActiveTenant: (
|
|
77
|
-
|
|
85
|
+
setActiveTenant: (t) => {
|
|
86
|
+
e({ activeTenant: t });
|
|
78
87
|
},
|
|
79
88
|
logout: async () => {
|
|
80
|
-
|
|
89
|
+
s(), e({
|
|
81
90
|
user: null,
|
|
82
91
|
isAuthenticated: !1,
|
|
83
92
|
activeTenant: null,
|
|
84
93
|
tenants: [],
|
|
85
94
|
sessionPresumed: !1,
|
|
86
95
|
identitySince: performance.now()
|
|
87
|
-
}), await
|
|
96
|
+
}), await i(), b?.postMessage(y);
|
|
88
97
|
}
|
|
89
|
-
})),
|
|
90
|
-
|
|
91
|
-
e.data ===
|
|
92
|
-
}),
|
|
93
|
-
|
|
98
|
+
})), y = "signed-out", b = typeof BroadcastChannel == "function" ? new BroadcastChannel("declarion.auth") : null;
|
|
99
|
+
b?.addEventListener("message", (e) => {
|
|
100
|
+
e.data === y && !p() && v.getState().isAuthenticated && (o(), window.location.assign("/login"));
|
|
101
|
+
}), v.subscribe((e, t) => {
|
|
102
|
+
d(f(e)), e.user?.id !== t.user?.id && h.getState().startIdentity();
|
|
94
103
|
});
|
|
95
|
-
export {
|
|
104
|
+
export { v as useAuthStore };
|