fauna-api 0.0.0-stage → 1.0.679
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/brands.d.ts +2 -0
- package/dist/brands.js +2 -0
- package/dist/index.d.ts +64 -0
- package/dist/index.js +121 -0
- package/dist/src/ant/chat.d.ts +130 -0
- package/dist/src/ant/chat.js +467 -0
- package/dist/src/ant/format.d.ts +40 -0
- package/dist/src/ant/format.js +143 -0
- package/dist/src/ant/graph.d.ts +130 -0
- package/dist/src/ant/graph.js +449 -0
- package/dist/src/ant/index.d.ts +16 -0
- package/dist/src/ant/index.js +61 -0
- package/dist/src/ant/persona.d.ts +151 -0
- package/dist/src/ant/persona.js +136 -0
- package/dist/src/ant/timeline.d.ts +283 -0
- package/dist/src/ant/timeline.js +1025 -0
- package/dist/src/authentification.d.ts +45 -0
- package/dist/src/authentification.js +194 -0
- package/dist/src/billing.d.ts +135 -0
- package/dist/src/billing.js +128 -0
- package/dist/src/calendar.d.ts +83 -0
- package/dist/src/calendar.js +133 -0
- package/dist/src/chats.d.ts +113 -0
- package/dist/src/chats.js +100 -0
- package/dist/src/cicada/contacts.d.ts +31 -0
- package/dist/src/cicada/contacts.js +28 -0
- package/dist/src/cicada/conversations.d.ts +73 -0
- package/dist/src/cicada/conversations.js +236 -0
- package/dist/src/cicada/inboxes.d.ts +48 -0
- package/dist/src/cicada/inboxes.js +82 -0
- package/dist/src/cicada/index.d.ts +16 -0
- package/dist/src/cicada/index.js +61 -0
- package/dist/src/cicada/phone.d.ts +48 -0
- package/dist/src/cicada/phone.js +306 -0
- package/dist/src/drive.d.ts +80 -0
- package/dist/src/drive.js +472 -0
- package/dist/src/extensions/index.d.ts +4 -0
- package/dist/src/extensions/index.js +5 -0
- package/dist/src/extensions/web/index.d.ts +6 -0
- package/dist/src/extensions/web/index.js +7 -0
- package/dist/src/extensions/web/session.d.ts +108 -0
- package/dist/src/extensions/web/session.js +470 -0
- package/dist/src/extensions/web/tools.d.ts +13 -0
- package/dist/src/extensions/web/tools.js +72 -0
- package/dist/src/friends.d.ts +39 -0
- package/dist/src/friends.js +119 -0
- package/dist/src/groups.d.ts +82 -0
- package/dist/src/groups.js +269 -0
- package/dist/src/inbox.d.ts +11 -0
- package/dist/src/inbox.js +35 -0
- package/dist/src/integrations.d.ts +52 -0
- package/dist/src/integrations.js +205 -0
- package/dist/src/magpie/explorer.d.ts +14 -0
- package/dist/src/magpie/explorer.js +36 -0
- package/dist/src/magpie/index.d.ts +16 -0
- package/dist/src/magpie/index.js +61 -0
- package/dist/src/magpie/portfolio.d.ts +52 -0
- package/dist/src/magpie/portfolio.js +179 -0
- package/dist/src/magpie/quotes.d.ts +35 -0
- package/dist/src/magpie/quotes.js +47 -0
- package/dist/src/magpie/room.d.ts +61 -0
- package/dist/src/magpie/room.js +238 -0
- package/dist/src/maps.d.ts +159 -0
- package/dist/src/maps.js +171 -0
- package/dist/src/marmot/browser.d.ts +139 -0
- package/dist/src/marmot/browser.js +389 -0
- package/dist/src/marmot/index.d.ts +20 -0
- package/dist/src/marmot/index.js +65 -0
- package/dist/src/marmot/media.d.ts +56 -0
- package/dist/src/marmot/media.js +265 -0
- package/dist/src/marmot/research.d.ts +337 -0
- package/dist/src/marmot/research.js +1138 -0
- package/dist/src/marmot/scraper.d.ts +59 -0
- package/dist/src/marmot/scraper.js +94 -0
- package/dist/src/marmot/web.d.ts +402 -0
- package/dist/src/marmot/web.js +2586 -0
- package/dist/src/marmot/workspace.d.ts +81 -0
- package/dist/src/marmot/workspace.js +263 -0
- package/dist/src/parrot/agent.d.ts +53 -0
- package/dist/src/parrot/agent.js +93 -0
- package/dist/src/parrot/chat.d.ts +84 -0
- package/dist/src/parrot/chat.js +237 -0
- package/dist/src/parrot/format.d.ts +128 -0
- package/dist/src/parrot/format.js +639 -0
- package/dist/src/parrot/generative.d.ts +261 -0
- package/dist/src/parrot/generative.js +185 -0
- package/dist/src/parrot/index.d.ts +22 -0
- package/dist/src/parrot/index.js +67 -0
- package/dist/src/parrot/room.d.ts +225 -0
- package/dist/src/parrot/room.js +466 -0
- package/dist/src/parrot/routing.d.ts +90 -0
- package/dist/src/parrot/routing.js +78 -0
- package/dist/src/parrot/share.d.ts +126 -0
- package/dist/src/parrot/share.js +261 -0
- package/dist/src/parrot/socket.d.ts +41 -0
- package/dist/src/parrot/socket.js +478 -0
- package/dist/src/payments.d.ts +73 -0
- package/dist/src/payments.js +107 -0
- package/dist/src/private/cards.css +75 -0
- package/dist/src/rooms.d.ts +76 -0
- package/dist/src/rooms.js +168 -0
- package/dist/src/shared/schema.d.ts +24 -0
- package/dist/src/shared/schema.js +1 -0
- package/dist/src/shared/server.d.ts +65 -0
- package/dist/src/shared/server.js +302 -0
- package/dist/src/termite/environment.d.ts +110 -0
- package/dist/src/termite/environment.js +263 -0
- package/dist/src/termite/index.d.ts +14 -0
- package/dist/src/termite/index.js +59 -0
- package/dist/src/termite/os.d.ts +326 -0
- package/dist/src/termite/os.js +572 -0
- package/dist/src/termite/versioning.d.ts +94 -0
- package/dist/src/termite/versioning.js +217 -0
- package/dist/src/tickets.d.ts +43 -0
- package/dist/src/tickets.js +138 -0
- package/dist/src/travel.d.ts +85 -0
- package/dist/src/travel.js +44 -0
- package/dist/src/ui/authentification.d.ts +24 -0
- package/dist/src/ui/authentification.js +177 -0
- package/dist/src/ui/brands.css +11 -0
- package/dist/src/ui/brands.d.ts +7 -0
- package/dist/src/ui/brands.js +14 -0
- package/dist/src/ui/browser.d.ts +74 -0
- package/dist/src/ui/browser.js +470 -0
- package/dist/src/ui/chat.d.ts +183 -0
- package/dist/src/ui/chat.js +2379 -0
- package/dist/src/ui/chatPanel.d.ts +109 -0
- package/dist/src/ui/chatPanel.js +768 -0
- package/dist/src/ui/chatSequence.d.ts +36 -0
- package/dist/src/ui/chatSequence.js +42 -0
- package/dist/src/ui/crown.d.ts +19 -0
- package/dist/src/ui/crown.js +199 -0
- package/dist/src/ui/cursor.d.ts +73 -0
- package/dist/src/ui/cursor.js +175 -0
- package/dist/src/ui/device.d.ts +33 -0
- package/dist/src/ui/device.js +49 -0
- package/dist/src/ui/drive.d.ts +69 -0
- package/dist/src/ui/drive.js +1243 -0
- package/dist/src/ui/generative.d.ts +39 -0
- package/dist/src/ui/generative.js +313 -0
- package/dist/src/ui/hover.d.ts +6 -0
- package/dist/src/ui/hover.js +210 -0
- package/dist/src/ui/index.d.ts +42 -0
- package/dist/src/ui/index.js +87 -0
- package/dist/src/ui/integrations.d.ts +13 -0
- package/dist/src/ui/integrations.js +175 -0
- package/dist/src/ui/maps.d.ts +87 -0
- package/dist/src/ui/maps.js +547 -0
- package/dist/src/ui/roster.d.ts +32 -0
- package/dist/src/ui/roster.js +163 -0
- package/dist/src/ui/talk.d.ts +12 -0
- package/dist/src/ui/talk.js +560 -0
- package/dist/src/ui/tickets.d.ts +13 -0
- package/dist/src/ui/tickets.js +966 -0
- package/dist/src/ui/toast.d.ts +7 -0
- package/dist/src/ui/toast.js +258 -0
- package/dist/src/ui/tokenText.d.ts +18 -0
- package/dist/src/ui/tokenText.js +96 -0
- package/dist/src/ui/tokenized.d.ts +42 -0
- package/dist/src/ui/tokenized.js +622 -0
- package/dist/src/ui/ui.css +4763 -0
- package/dist/src/ui/view.d.ts +23 -0
- package/dist/src/ui/view.js +584 -0
- package/dist/src/view.d.ts +113 -0
- package/dist/src/view.js +386 -0
- package/dist/src/webhooks.d.ts +66 -0
- package/dist/src/webhooks.js +78 -0
- package/dist/ui.d.ts +1 -0
- package/dist/ui.js +1 -0
- package/package.json +87 -4
- package/README.md +0 -3
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useLayoutEffect, useRef, useState } from "react";
|
|
3
|
+
import { createRoot } from "react-dom/client";
|
|
4
|
+
import { gsap } from "gsap";
|
|
5
|
+
import { colorFromSeed } from "./cursor.js";
|
|
6
|
+
const AGENT_KEY = "agent";
|
|
7
|
+
function prefersReducedMotion() {
|
|
8
|
+
try {
|
|
9
|
+
return window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
10
|
+
}
|
|
11
|
+
catch {
|
|
12
|
+
return false;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
function nameOf(profile) {
|
|
16
|
+
return profile?.displayName || profile?.email?.split("@")[0] || "Guest";
|
|
17
|
+
}
|
|
18
|
+
function avatarUrl(profile) {
|
|
19
|
+
if (profile?.icon)
|
|
20
|
+
return profile.icon;
|
|
21
|
+
return `https://ui-avatars.com/api/?name=${encodeURIComponent(nameOf(profile))}&background=161617&color=E8E2DC&size=64`;
|
|
22
|
+
}
|
|
23
|
+
/** Asks before stopping an agent: taking control (`control`) or shutting down (`power`). */
|
|
24
|
+
export function AgentConfirm({ kind, onConfirm, onCancel }) {
|
|
25
|
+
const veilRef = useRef(null);
|
|
26
|
+
const panelRef = useRef(null);
|
|
27
|
+
useLayoutEffect(() => {
|
|
28
|
+
if (prefersReducedMotion())
|
|
29
|
+
return;
|
|
30
|
+
gsap.fromTo(veilRef.current, { autoAlpha: 0 }, { autoAlpha: 1, duration: 0.2, ease: "power2.out" });
|
|
31
|
+
gsap.fromTo(panelRef.current, { y: 14, autoAlpha: 0 }, { y: 0, autoAlpha: 1, duration: 0.34, ease: "power3.out" });
|
|
32
|
+
}, []);
|
|
33
|
+
useEffect(() => {
|
|
34
|
+
const onKey = (event) => { if (event.key === "Escape")
|
|
35
|
+
onCancel(); };
|
|
36
|
+
window.addEventListener("keydown", onKey);
|
|
37
|
+
return () => window.removeEventListener("keydown", onKey);
|
|
38
|
+
}, [onCancel]);
|
|
39
|
+
return (_jsx("div", { ref: veilRef, className: "fauna-confirm-veil", onPointerDown: (event) => { if (event.target === event.currentTarget)
|
|
40
|
+
onCancel(); }, children: _jsxs("div", { ref: panelRef, className: "fauna-confirm", role: "alertdialog", "aria-labelledby": "fauna-confirm-title", children: [_jsx("h2", { id: "fauna-confirm-title", className: "fauna-confirm-title", children: "An agent is using this" }), _jsx("p", { className: "fauna-confirm-body", children: kind === "power" ? "Shutting down stops the agent." : "Taking control stops the agent, and whatever started it may not finish." }), _jsxs("div", { className: "fauna-confirm-actions", children: [_jsx("button", { type: "button", className: "fauna-confirm-cancel", onClick: onCancel, children: "Cancel" }), _jsx("button", { type: "button", className: "fauna-confirm-go", autoFocus: true, onClick: onConfirm, children: kind === "power" ? "Shut down" : "Take control" })] })] }) }));
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Who's in the room, who's in control, and a click to hand control to anyone.
|
|
44
|
+
* While an agent holds the room it comes first with the ring, everyone watches,
|
|
45
|
+
* and clicking a person asks before stopping the agent.
|
|
46
|
+
*/
|
|
47
|
+
export function Roster({ self, peers, controller, agent, onHand, nudge = 0 }) {
|
|
48
|
+
// Id only: the same person twice is two seats, and both stay listed.
|
|
49
|
+
const seats = self ? [self, ...peers.filter((p) => p.id !== self.id)] : peers;
|
|
50
|
+
const pillRef = useRef(null);
|
|
51
|
+
const ringRef = useRef(null);
|
|
52
|
+
const seatRefs = useRef(new Map());
|
|
53
|
+
const seen = useRef(new Set());
|
|
54
|
+
const width = useRef(0);
|
|
55
|
+
const placed = useRef(false);
|
|
56
|
+
const [tip, setTip] = useState(null);
|
|
57
|
+
const [confirming, setConfirming] = useState(null);
|
|
58
|
+
const key = `${agent ? `${AGENT_KEY}:${agent.id}|` : ""}${seats.map((s) => s.id).join("|")}`;
|
|
59
|
+
const shown = seats.length > 1 || Boolean(agent);
|
|
60
|
+
const holder = agent ? AGENT_KEY : controller;
|
|
61
|
+
// New seats pop in, and the pill eases to its new width.
|
|
62
|
+
useLayoutEffect(() => {
|
|
63
|
+
const pill = pillRef.current;
|
|
64
|
+
if (!pill)
|
|
65
|
+
return;
|
|
66
|
+
const reduced = prefersReducedMotion();
|
|
67
|
+
for (const [id, el] of seatRefs.current) {
|
|
68
|
+
const seenId = id === AGENT_KEY && agent ? `${AGENT_KEY}:${agent.id}` : id;
|
|
69
|
+
if (seen.current.has(seenId))
|
|
70
|
+
continue;
|
|
71
|
+
seen.current.add(seenId);
|
|
72
|
+
if (!reduced)
|
|
73
|
+
gsap.fromTo(el, { scale: 0.7, autoAlpha: 0 }, { scale: 1, autoAlpha: 1, duration: 0.36, ease: "back.out(1.7)" });
|
|
74
|
+
}
|
|
75
|
+
const next = pill.offsetWidth;
|
|
76
|
+
if (width.current && width.current !== next && !reduced) {
|
|
77
|
+
gsap.fromTo(pill, { width: width.current }, { width: next, duration: 0.3, ease: "power2.out", clearProps: "width" });
|
|
78
|
+
}
|
|
79
|
+
width.current = next;
|
|
80
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
81
|
+
}, [key, shown]);
|
|
82
|
+
// The ring follows whoever holds the room: the agent, or the controller.
|
|
83
|
+
useLayoutEffect(() => {
|
|
84
|
+
const ring = ringRef.current;
|
|
85
|
+
if (!ring)
|
|
86
|
+
return;
|
|
87
|
+
const target = holder ? seatRefs.current.get(holder) : undefined;
|
|
88
|
+
if (!target) {
|
|
89
|
+
gsap.to(ring, { autoAlpha: 0, duration: 0.2 });
|
|
90
|
+
placed.current = false;
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
const to = { x: target.offsetLeft, y: target.offsetTop, width: target.offsetWidth, height: target.offsetHeight };
|
|
94
|
+
if (!placed.current || prefersReducedMotion()) {
|
|
95
|
+
gsap.set(ring, { ...to, autoAlpha: 1 });
|
|
96
|
+
placed.current = true;
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
gsap.to(ring, { ...to, autoAlpha: 1, duration: 0.5, ease: "power3.out" });
|
|
100
|
+
gsap.fromTo(ring, { boxShadow: "0 0 0 4px rgba(163, 27, 40, 0.35), 0 0 26px rgba(163, 27, 40, 0.75)" }, { boxShadow: "0 0 0 2px rgba(163, 27, 40, 0.18), 0 0 12px rgba(163, 27, 40, 0.4)", duration: 0.7, ease: "power2.out" });
|
|
101
|
+
}, [holder, key, shown]);
|
|
102
|
+
// A pulse when someone without control reaches for the room.
|
|
103
|
+
useEffect(() => {
|
|
104
|
+
const ring = ringRef.current;
|
|
105
|
+
if (!nudge || !ring || prefersReducedMotion())
|
|
106
|
+
return;
|
|
107
|
+
gsap.fromTo(ring, { scale: 1 }, { scale: 1.22, duration: 0.14, ease: "power2.out", yoyo: true, repeat: 3, transformOrigin: "50% 50%" });
|
|
108
|
+
}, [nudge]);
|
|
109
|
+
if (!shown)
|
|
110
|
+
return null;
|
|
111
|
+
const tipFor = (seat) => {
|
|
112
|
+
const mine = seat.id === self?.id;
|
|
113
|
+
if (agent)
|
|
114
|
+
return mine ? "You're watching" : `${nameOf(seat.profile)} is watching`;
|
|
115
|
+
if (seat.id === controller)
|
|
116
|
+
return mine ? "You're in control" : `${nameOf(seat.profile)} is in control`;
|
|
117
|
+
return mine ? "Take control" : `Give control to ${nameOf(seat.profile)}`;
|
|
118
|
+
};
|
|
119
|
+
const lift = (el, up) => {
|
|
120
|
+
if (!prefersReducedMotion())
|
|
121
|
+
gsap.to(el, { y: up ? -2 : 0, duration: 0.2, ease: "power2.out" });
|
|
122
|
+
};
|
|
123
|
+
const showTip = (el, text) => {
|
|
124
|
+
lift(el, true);
|
|
125
|
+
setTip({ text, x: el.offsetLeft + el.offsetWidth / 2 });
|
|
126
|
+
};
|
|
127
|
+
const hideTip = (el) => {
|
|
128
|
+
lift(el, false);
|
|
129
|
+
setTip(null);
|
|
130
|
+
};
|
|
131
|
+
const register = (id) => (el) => {
|
|
132
|
+
if (el)
|
|
133
|
+
seatRefs.current.set(id, el);
|
|
134
|
+
else
|
|
135
|
+
seatRefs.current.delete(id);
|
|
136
|
+
};
|
|
137
|
+
const hand = (seat) => {
|
|
138
|
+
const target = seat.id === self?.id ? undefined : seat.id;
|
|
139
|
+
if (agent)
|
|
140
|
+
setConfirming({ seat: target });
|
|
141
|
+
else if (seat.id !== controller)
|
|
142
|
+
onHand(target);
|
|
143
|
+
};
|
|
144
|
+
return (_jsxs("div", { className: "fauna-roster", children: [_jsxs("div", { ref: pillRef, className: "fauna-roster-pill", "aria-label": "People in this room", children: [_jsx("span", { ref: ringRef, className: "fauna-roster-ring", "aria-hidden": "true" }), agent && (_jsx("span", { ref: register(AGENT_KEY), className: "fauna-roster-seat fauna-roster-agent in-control", "aria-label": `${agent.name} is using this`, onMouseEnter: (event) => showTip(event.currentTarget, `${agent.name} is using this`), onMouseLeave: (event) => hideTip(event.currentTarget), children: agent.icon
|
|
145
|
+
? _jsx("img", { src: agent.icon, alt: "" })
|
|
146
|
+
: _jsx("span", { className: "material-symbols-outlined", "aria-hidden": "true", children: "smart_toy" }) })), seats.map((seat) => {
|
|
147
|
+
const inControl = !agent && seat.id === controller;
|
|
148
|
+
return (_jsxs("button", { ref: register(seat.id), type: "button", className: `fauna-roster-seat${inControl ? " in-control" : ""}`, style: { borderColor: colorFromSeed(seat.id) }, "aria-label": tipFor(seat), onClick: () => hand(seat), onMouseEnter: (event) => showTip(event.currentTarget, tipFor(seat)), onMouseLeave: (event) => hideTip(event.currentTarget), children: [_jsx("img", { src: avatarUrl(seat.profile), alt: "" }), inControl && (_jsx("span", { className: "fauna-roster-badge", "aria-hidden": "true", children: _jsx("span", { className: "material-symbols-outlined", children: "power_settings_new" }) }))] }, seat.id));
|
|
149
|
+
})] }), tip && _jsx("span", { className: "fauna-roster-tip", style: { left: tip.x }, children: tip.text }), confirming && (_jsx(AgentConfirm, { kind: "control", onCancel: () => setConfirming(null), onConfirm: () => {
|
|
150
|
+
const { seat } = confirming;
|
|
151
|
+
setConfirming(null);
|
|
152
|
+
onHand(seat);
|
|
153
|
+
} }))] }));
|
|
154
|
+
}
|
|
155
|
+
/** The roster for apps without React. Call `update` with new props as the room changes. */
|
|
156
|
+
export function mountRoster(el, props) {
|
|
157
|
+
const root = createRoot(el);
|
|
158
|
+
root.render(_jsx(Roster, { ...props }));
|
|
159
|
+
return {
|
|
160
|
+
update(next) { root.render(_jsx(Roster, { ...next })); },
|
|
161
|
+
destroy() { root.unmount(); },
|
|
162
|
+
};
|
|
163
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Fauna } from 'fauna-api';
|
|
2
|
+
export type TalkHandle = {
|
|
3
|
+
start: () => Promise<void>;
|
|
4
|
+
hangUp: () => void;
|
|
5
|
+
destroy: () => void;
|
|
6
|
+
};
|
|
7
|
+
export type TalkOptions = {
|
|
8
|
+
credentials: Fauna.Authentification.Credentials | Fauna.Authentification.ApiKey;
|
|
9
|
+
assistantLabel?: string;
|
|
10
|
+
onHangUp?: () => void;
|
|
11
|
+
};
|
|
12
|
+
export declare function createTalk(container: HTMLElement, options: TalkOptions): TalkHandle;
|