@dxos/shell 0.6.1-main.e05b43b → 0.6.1-main.ff751ec
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/bundle/shell.mjs +188 -111
- package/dist/bundle/shell.mjs.map +1 -1
- package/dist/bundle/shell.umd.js +5 -5
- package/dist/bundle/shell.umd.js.map +1 -1
- package/dist/bundle/style.css +1 -1
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/react.mjs +171 -115
- package/dist/lib/browser/react.mjs.map +3 -3
- package/dist/types/src/components/AgentConfig.d.ts +1 -1
- package/dist/types/src/components/AgentConfig.d.ts.map +1 -1
- package/dist/types/src/components/AgentConfig.js +36 -24
- package/dist/types/src/components/AgentConfig.js.map +1 -1
- package/dist/types/src/components/DeviceList/DeviceList.d.ts +2 -2
- package/dist/types/src/components/DeviceList/DeviceList.d.ts.map +1 -1
- package/dist/types/src/components/DeviceList/DeviceList.js +2 -2
- package/dist/types/src/components/DeviceList/DeviceList.js.map +1 -1
- package/dist/types/src/components/DeviceList/DeviceListItem.d.ts +2 -2
- package/dist/types/src/components/DeviceList/DeviceListItem.d.ts.map +1 -1
- package/dist/types/src/components/DeviceList/DeviceListItem.js +11 -5
- package/dist/types/src/components/DeviceList/DeviceListItem.js.map +1 -1
- package/dist/types/src/components/DeviceList/DeviceListProps.d.ts +6 -7
- package/dist/types/src/components/DeviceList/DeviceListProps.d.ts.map +1 -1
- package/dist/types/src/panels/IdentityPanel/IdentityPanel.d.ts.map +1 -1
- package/dist/types/src/panels/IdentityPanel/IdentityPanel.js +2 -5
- package/dist/types/src/panels/IdentityPanel/IdentityPanel.js.map +1 -1
- package/dist/types/src/panels/IdentityPanel/IdentityPanelProps.d.ts +0 -1
- package/dist/types/src/panels/IdentityPanel/IdentityPanelProps.d.ts.map +1 -1
- package/dist/types/src/panels/IdentityPanel/steps/IdentityActionChooser.d.ts +1 -1
- package/dist/types/src/panels/IdentityPanel/steps/IdentityActionChooser.d.ts.map +1 -1
- package/dist/types/src/panels/IdentityPanel/steps/IdentityActionChooser.js +5 -5
- package/dist/types/src/panels/IdentityPanel/steps/IdentityActionChooser.js.map +1 -1
- package/dist/types/src/panels/IdentityPanel/useAgentHandlers.d.ts +2 -7
- package/dist/types/src/panels/IdentityPanel/useAgentHandlers.d.ts.map +1 -1
- package/dist/types/src/panels/IdentityPanel/useAgentHandlers.js +78 -43
- package/dist/types/src/panels/IdentityPanel/useAgentHandlers.js.map +1 -1
- package/dist/types/src/translations/locales/en-US.d.ts +5 -0
- package/dist/types/src/translations/locales/en-US.d.ts.map +1 -1
- package/dist/types/src/translations/locales/en-US.js +5 -0
- package/dist/types/src/translations/locales/en-US.js.map +1 -1
- package/package.json +23 -23
- package/src/components/AgentConfig.tsx +100 -48
- package/src/components/DeviceList/DeviceList.tsx +4 -3
- package/src/components/DeviceList/DeviceListItem.tsx +66 -28
- package/src/components/DeviceList/DeviceListProps.ts +6 -7
- package/src/panels/IdentityPanel/IdentityPanel.tsx +2 -5
- package/src/panels/IdentityPanel/IdentityPanelProps.ts +0 -1
- package/src/panels/IdentityPanel/steps/IdentityActionChooser.tsx +7 -15
- package/src/panels/IdentityPanel/useAgentHandlers.ts +77 -41
- package/src/translations/locales/en-US.ts +6 -0
|
@@ -3,19 +3,23 @@ import {
|
|
|
3
3
|
} from "./chunk-ZSTKOCBT.mjs";
|
|
4
4
|
|
|
5
5
|
// packages/sdk/shell/src/components/AgentConfig.tsx
|
|
6
|
-
import { Database, Plus, Power } from "@phosphor-icons/react";
|
|
6
|
+
import { ArrowsClockwise, Database, Plus, Power } from "@phosphor-icons/react";
|
|
7
7
|
import React from "react";
|
|
8
8
|
import { Avatar, Button, Link, Tooltip, Trans, useTranslation } from "@dxos/react-ui";
|
|
9
|
-
import { descriptionText, getSize, mx } from "@dxos/react-ui-theme";
|
|
10
|
-
var AgentConfig = ({
|
|
9
|
+
import { descriptionText, getSize, mx, valenceColorText } from "@dxos/react-ui-theme";
|
|
10
|
+
var AgentConfig = ({ agentStatus, validationMessage, onAgentDestroy, onAgentCreate, onAgentRefresh }) => {
|
|
11
11
|
const { t } = useTranslation("os");
|
|
12
12
|
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("h2", {
|
|
13
13
|
className: mx(descriptionText, "text-center mbs-4")
|
|
14
|
-
}, t("agent heading")),
|
|
14
|
+
}, t("agent heading")), validationMessage && /* @__PURE__ */ React.createElement("p", {
|
|
15
|
+
role: "alert",
|
|
16
|
+
className: mx(valenceColorText("error"), "mlb-2")
|
|
17
|
+
}, validationMessage), agentStatus === "created" || agentStatus === "creating" || agentStatus === "getting" || agentStatus === "destroying" ? /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("div", {
|
|
15
18
|
role: "group",
|
|
16
|
-
className: "flex gap-2 items-center"
|
|
19
|
+
className: "mlb-2 flex gap-2 items-center",
|
|
20
|
+
"aria-describedby": "devices-panel.create-agent.description"
|
|
17
21
|
}, /* @__PURE__ */ React.createElement(Avatar.Root, {
|
|
18
|
-
status: agentStatus ? "
|
|
22
|
+
status: agentStatus === "created" ? "warning" : "inactive",
|
|
19
23
|
variant: "square"
|
|
20
24
|
}, /* @__PURE__ */ React.createElement(Avatar.Frame, {
|
|
21
25
|
classNames: "place-self-center"
|
|
@@ -24,10 +28,13 @@ var AgentConfig = ({ agentActive, agentStatus, onAgentDestroy, onAgentCreate })
|
|
|
24
28
|
width: 24,
|
|
25
29
|
height: 24,
|
|
26
30
|
x: 8,
|
|
27
|
-
y: 8
|
|
31
|
+
y: 8,
|
|
32
|
+
...agentStatus !== "created" && {
|
|
33
|
+
className: "opacity-50"
|
|
34
|
+
}
|
|
28
35
|
})), /* @__PURE__ */ React.createElement(Avatar.Label, {
|
|
29
36
|
classNames: "flex-1 text-sm truncate"
|
|
30
|
-
}, t("agent
|
|
37
|
+
}, t(agentStatus === "created" ? "agent requested label" : agentStatus === "creating" ? "creating agent label" : agentStatus === "destroying" ? "destroying agent label" : "getting agent label"))), agentStatus === "created" && /* @__PURE__ */ React.createElement(Tooltip.Root, null, /* @__PURE__ */ React.createElement(Tooltip.Trigger, {
|
|
31
38
|
asChild: true
|
|
32
39
|
}, /* @__PURE__ */ React.createElement(Button, {
|
|
33
40
|
variant: "ghost",
|
|
@@ -41,23 +48,32 @@ var AgentConfig = ({ agentActive, agentStatus, onAgentDestroy, onAgentCreate })
|
|
|
41
48
|
}))), /* @__PURE__ */ React.createElement(Tooltip.Portal, null, /* @__PURE__ */ React.createElement(Tooltip.Content, {
|
|
42
49
|
side: "bottom",
|
|
43
50
|
classNames: "z-50"
|
|
44
|
-
}, t("destroy agent label")))))
|
|
51
|
+
}, t("destroy agent label"))))), agentStatus === "created" && /* @__PURE__ */ React.createElement("p", {
|
|
52
|
+
id: "devices-panel.create-agent.description",
|
|
53
|
+
className: mx(descriptionText, "mlb-2")
|
|
54
|
+
}, t("agent requested description"))) : /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Button, {
|
|
45
55
|
variant: "ghost",
|
|
46
56
|
classNames: "mlb-2 is-full justify-start gap-2 !pis-0 !pie-3",
|
|
47
|
-
"data-testid": "devices-panel.create-agent",
|
|
48
|
-
onClick: onAgentCreate,
|
|
57
|
+
"data-testid": agentStatus === "creatable" ? "devices-panel.create-agent" : "devices-panel.agent-error",
|
|
58
|
+
onClick: agentStatus === "creatable" ? onAgentCreate : onAgentRefresh,
|
|
49
59
|
"aria-describedby": "devices-panel.create-agent.description"
|
|
50
60
|
}, /* @__PURE__ */ React.createElement("div", {
|
|
51
61
|
role: "img",
|
|
52
62
|
className: mx(getSize(8), "m-1 rounded-sm surface-input grid place-items-center")
|
|
53
|
-
}, /* @__PURE__ */ React.createElement(Plus, {
|
|
63
|
+
}, agentStatus === "creatable" ? /* @__PURE__ */ React.createElement(Plus, {
|
|
64
|
+
weight: "light",
|
|
65
|
+
className: getSize(6)
|
|
66
|
+
}) : /* @__PURE__ */ React.createElement(ArrowsClockwise, {
|
|
54
67
|
weight: "light",
|
|
55
68
|
className: getSize(6)
|
|
56
69
|
})), /* @__PURE__ */ React.createElement("span", {
|
|
57
70
|
className: "grow font-medium text-start"
|
|
58
|
-
}, t("create agent label"))), /* @__PURE__ */ React.createElement("
|
|
59
|
-
|
|
60
|
-
className:
|
|
71
|
+
}, t(agentStatus === "creatable" ? "create agent label" : ""))), agentStatus === "creatable" && /* @__PURE__ */ React.createElement("div", {
|
|
72
|
+
role: "none",
|
|
73
|
+
className: "space-y-2",
|
|
74
|
+
id: "devices-panel.create-agent.description"
|
|
75
|
+
}, /* @__PURE__ */ React.createElement("p", {
|
|
76
|
+
className: descriptionText
|
|
61
77
|
}, /* @__PURE__ */ React.createElement(Trans, {
|
|
62
78
|
t,
|
|
63
79
|
i18nKey: "create agent clickwrap",
|
|
@@ -68,9 +84,8 @@ var AgentConfig = ({ agentActive, agentStatus, onAgentDestroy, onAgentCreate })
|
|
|
68
84
|
})
|
|
69
85
|
}
|
|
70
86
|
})), /* @__PURE__ */ React.createElement("p", {
|
|
71
|
-
id: "devices-panel.create-agent.description",
|
|
72
87
|
className: descriptionText
|
|
73
|
-
}, t("create agent description"))));
|
|
88
|
+
}, t("create agent description")))));
|
|
74
89
|
};
|
|
75
90
|
|
|
76
91
|
// packages/sdk/shell/src/components/Clipboard/CopyButton.tsx
|
|
@@ -556,12 +571,12 @@ import { Button as Button6, List as List2, useTranslation as useTranslation7 } f
|
|
|
556
571
|
import { descriptionText as descriptionText4, getSize as getSize6, mx as mx7 } from "@dxos/react-ui-theme";
|
|
557
572
|
|
|
558
573
|
// packages/sdk/shell/src/components/DeviceList/DeviceListItem.tsx
|
|
559
|
-
import { Compass, Desktop, DeviceMobile, Devices, DotsThree, ShareFat, Power as Power2, Robot } from "@phosphor-icons/react";
|
|
574
|
+
import { Compass, Desktop, DeviceMobile, Devices, DotsThree, ShareFat, Power as Power2, Robot, Database as Database2 } from "@phosphor-icons/react";
|
|
560
575
|
import React9, { forwardRef as forwardRef2 } from "react";
|
|
561
576
|
import { generateName as generateName2 } from "@dxos/display-name";
|
|
562
577
|
import { Device, DeviceType, DeviceKind } from "@dxos/react-client/halo";
|
|
563
578
|
import { ConnectionState } from "@dxos/react-client/mesh";
|
|
564
|
-
import { ListItem as ListItem2, Avatar as Avatar3, useId as useId3, Tag, useTranslation as useTranslation6, DropdownMenu as DropdownMenu2, Button as Button5 } from "@dxos/react-ui";
|
|
579
|
+
import { ListItem as ListItem2, Avatar as Avatar3, useId as useId3, Tag, useTranslation as useTranslation6, DropdownMenu as DropdownMenu2, Button as Button5, Tooltip as Tooltip5 } from "@dxos/react-ui";
|
|
565
580
|
import { getSize as getSize5 } from "@dxos/react-ui-theme";
|
|
566
581
|
import { keyToFallback as keyToFallback2 } from "@dxos/util";
|
|
567
582
|
var iconProps = {
|
|
@@ -571,7 +586,7 @@ var iconProps = {
|
|
|
571
586
|
x: 8,
|
|
572
587
|
y: 8
|
|
573
588
|
};
|
|
574
|
-
var DeviceListItem = /* @__PURE__ */ forwardRef2(({ device, onClickAdd, onClickEdit, onClickReset, onClickJoinExisting, classNames, connectionState, ...props }, forwardedRef) => {
|
|
589
|
+
var DeviceListItem = /* @__PURE__ */ forwardRef2(({ device, onClickAdd, onClickEdit, onClickReset, onClickJoinExisting, classNames, connectionState, onAgentDestroy, ...props }, forwardedRef) => {
|
|
575
590
|
const { t } = useTranslation6("os");
|
|
576
591
|
const fallbackValue = keyToFallback2(device.deviceKey);
|
|
577
592
|
const labelId = useId3("identityListItem__label");
|
|
@@ -596,7 +611,7 @@ var DeviceListItem = /* @__PURE__ */ forwardRef2(({ device, onClickAdd, onClickE
|
|
|
596
611
|
variant: "square"
|
|
597
612
|
}, /* @__PURE__ */ React9.createElement(Avatar3.Frame, {
|
|
598
613
|
classNames: "place-self-center"
|
|
599
|
-
}, device.profile?.type ? device.profile.type === DeviceType.BROWSER ? /* @__PURE__ */ React9.createElement(Compass, iconProps) : device.profile.type === DeviceType.NATIVE ? /* @__PURE__ */ React9.createElement(Desktop, iconProps) : [
|
|
614
|
+
}, device.profile?.type ? device.profile.type === DeviceType.AGENT_MANAGED ? /* @__PURE__ */ React9.createElement(Database2, iconProps) : device.profile.type === DeviceType.BROWSER ? /* @__PURE__ */ React9.createElement(Compass, iconProps) : device.profile.type === DeviceType.NATIVE ? /* @__PURE__ */ React9.createElement(Desktop, iconProps) : [
|
|
600
615
|
DeviceType.AGENT,
|
|
601
616
|
DeviceType.AGENT_MANAGED
|
|
602
617
|
].includes(device.profile.type) ? /* @__PURE__ */ React9.createElement(Robot, iconProps) : device.profile.type === DeviceType.MOBILE ? /* @__PURE__ */ React9.createElement(DeviceMobile, iconProps) : /* @__PURE__ */ React9.createElement(Devices, iconProps) : /* @__PURE__ */ React9.createElement(Avatar3.Fallback, {
|
|
@@ -605,7 +620,21 @@ var DeviceListItem = /* @__PURE__ */ forwardRef2(({ device, onClickAdd, onClickE
|
|
|
605
620
|
classNames: "flex-1 text-sm truncate"
|
|
606
621
|
}, displayName), isCurrent && /* @__PURE__ */ React9.createElement(Tag, {
|
|
607
622
|
color: "primary"
|
|
608
|
-
}, t("current device tag label")), device.
|
|
623
|
+
}, t("current device tag label")), device.profile?.type === DeviceType.AGENT_MANAGED ? /* @__PURE__ */ React9.createElement(Tooltip5.Root, null, /* @__PURE__ */ React9.createElement(Tooltip5.Trigger, {
|
|
624
|
+
asChild: true
|
|
625
|
+
}, /* @__PURE__ */ React9.createElement(Button5, {
|
|
626
|
+
variant: "ghost",
|
|
627
|
+
classNames: "pli-0 is-[--rail-action] bs-[--rail-action]",
|
|
628
|
+
"data-testid": "agent.destroy",
|
|
629
|
+
onClick: onAgentDestroy
|
|
630
|
+
}, /* @__PURE__ */ React9.createElement("span", {
|
|
631
|
+
className: "sr-only"
|
|
632
|
+
}, t("destroy agent label")), /* @__PURE__ */ React9.createElement(Power2, {
|
|
633
|
+
className: getSize5(5)
|
|
634
|
+
}))), /* @__PURE__ */ React9.createElement(Tooltip5.Portal, null, /* @__PURE__ */ React9.createElement(Tooltip5.Content, {
|
|
635
|
+
side: "bottom",
|
|
636
|
+
classNames: "z-50"
|
|
637
|
+
}, t("destroy agent label")))) : device.kind === DeviceKind.CURRENT && /* @__PURE__ */ React9.createElement(DropdownMenu2.Root, null, /* @__PURE__ */ React9.createElement(DropdownMenu2.Trigger, {
|
|
609
638
|
asChild: true
|
|
610
639
|
}, /* @__PURE__ */ React9.createElement(Button5, {
|
|
611
640
|
variant: "ghost",
|
|
@@ -629,7 +658,7 @@ var DeviceListItem = /* @__PURE__ */ forwardRef2(({ device, onClickAdd, onClickE
|
|
|
629
658
|
});
|
|
630
659
|
|
|
631
660
|
// packages/sdk/shell/src/components/DeviceList/DeviceList.tsx
|
|
632
|
-
var DeviceList = ({ devices, connectionState, onClickAdd, onClickEdit, onClickReset, onClickJoinExisting }) => {
|
|
661
|
+
var DeviceList = ({ devices, connectionState, onClickAdd, onClickEdit, onClickReset, onClickJoinExisting, onAgentDestroy }) => {
|
|
633
662
|
const { t } = useTranslation7("os");
|
|
634
663
|
return /* @__PURE__ */ React10.createElement(React10.Fragment, null, /* @__PURE__ */ React10.createElement("h2", {
|
|
635
664
|
className: mx7(descriptionText4, "text-center mbs-4")
|
|
@@ -640,7 +669,8 @@ var DeviceList = ({ devices, connectionState, onClickAdd, onClickEdit, onClickRe
|
|
|
640
669
|
onClickEdit: () => onClickEdit?.(device),
|
|
641
670
|
onClickReset,
|
|
642
671
|
onClickJoinExisting,
|
|
643
|
-
connectionState
|
|
672
|
+
connectionState,
|
|
673
|
+
onAgentDestroy
|
|
644
674
|
});
|
|
645
675
|
})), /* @__PURE__ */ React10.createElement(Button6, {
|
|
646
676
|
variant: "ghost",
|
|
@@ -666,7 +696,7 @@ import { X } from "@phosphor-icons/react";
|
|
|
666
696
|
import { formatDistanceToNow } from "date-fns";
|
|
667
697
|
import React12, { useCallback as useCallback2 } from "react";
|
|
668
698
|
import { Invitation, useInvitationStatus } from "@dxos/react-client/invitations";
|
|
669
|
-
import { Button as Button7, ListItem as ListItem3, useTranslation as useTranslation8, Avatar as Avatar4, useThemeContext as useThemeContext4, Tooltip as
|
|
699
|
+
import { Button as Button7, ListItem as ListItem3, useTranslation as useTranslation8, Avatar as Avatar4, useThemeContext as useThemeContext4, Tooltip as Tooltip6 } from "@dxos/react-ui";
|
|
670
700
|
import { focusRing, getSize as getSize7, mx as mx9 } from "@dxos/react-ui-theme";
|
|
671
701
|
import { hexToEmoji } from "@dxos/util";
|
|
672
702
|
|
|
@@ -786,11 +816,11 @@ var InvitationListItemImpl = ({ invitation, invitationStatus: propsInvitationSta
|
|
|
786
816
|
status: avatarStatus,
|
|
787
817
|
animation: avatarAnimation,
|
|
788
818
|
reverseEffects
|
|
789
|
-
}), /* @__PURE__ */ React12.createElement(
|
|
819
|
+
}), /* @__PURE__ */ React12.createElement(Tooltip6.Root, null, /* @__PURE__ */ React12.createElement(Avatar4.Root, {
|
|
790
820
|
...avatarProps,
|
|
791
821
|
animation: avatarAnimation,
|
|
792
822
|
status: avatarStatus
|
|
793
|
-
}, /* @__PURE__ */ React12.createElement(
|
|
823
|
+
}, /* @__PURE__ */ React12.createElement(Tooltip6.Trigger, {
|
|
794
824
|
asChild: true
|
|
795
825
|
}, /* @__PURE__ */ React12.createElement(Avatar4.Frame, {
|
|
796
826
|
tabIndex: 0,
|
|
@@ -800,10 +830,10 @@ var InvitationListItemImpl = ({ invitation, invitationStatus: propsInvitationSta
|
|
|
800
830
|
]
|
|
801
831
|
}, /* @__PURE__ */ React12.createElement(Avatar4.Fallback, {
|
|
802
832
|
text: hexToEmoji(invitationId)
|
|
803
|
-
})))), /* @__PURE__ */ React12.createElement(
|
|
833
|
+
})))), /* @__PURE__ */ React12.createElement(Tooltip6.Portal, null, /* @__PURE__ */ React12.createElement(Tooltip6.Content, {
|
|
804
834
|
side: "left",
|
|
805
835
|
classNames: "z-[70]"
|
|
806
|
-
}, t(multiUse ? "invite many qr label" : "invite one qr label"), /* @__PURE__ */ React12.createElement(
|
|
836
|
+
}, t(multiUse ? "invite many qr label" : "invite one qr label"), /* @__PURE__ */ React12.createElement(Tooltip6.Arrow, null)))), showShare && invitationUrl ? /* @__PURE__ */ React12.createElement(Tooltip6.Root, null, /* @__PURE__ */ React12.createElement(React12.Fragment, null, /* @__PURE__ */ React12.createElement(Tooltip6.Trigger, {
|
|
807
837
|
asChild: true
|
|
808
838
|
}, /* @__PURE__ */ React12.createElement(Button7, {
|
|
809
839
|
variant: "ghost",
|
|
@@ -816,7 +846,7 @@ var InvitationListItemImpl = ({ invitation, invitationStatus: propsInvitationSta
|
|
|
816
846
|
}, /* @__PURE__ */ React12.createElement("span", null, t("open share panel label")))), /* @__PURE__ */ React12.createElement(CopyButtonIconOnly, {
|
|
817
847
|
variant: "ghost",
|
|
818
848
|
value: invitationUrl
|
|
819
|
-
})), /* @__PURE__ */ React12.createElement(
|
|
849
|
+
})), /* @__PURE__ */ React12.createElement(Tooltip6.Portal, null, /* @__PURE__ */ React12.createElement(Tooltip6.Content, {
|
|
820
850
|
side: "left",
|
|
821
851
|
classNames: "z-[70]"
|
|
822
852
|
}, invitationHasLifetime && /* @__PURE__ */ React12.createElement("span", null, "Expires ", invitationTimeLeft)))) : showAuthCode ? /* @__PURE__ */ React12.createElement(AuthCode, {
|
|
@@ -1202,7 +1232,7 @@ import { useClient as useClient4 } from "@dxos/react-client";
|
|
|
1202
1232
|
import { useIdentity, useDevices, useHaloInvitations as useHaloInvitations2 } from "@dxos/react-client/halo";
|
|
1203
1233
|
import { useInvitationStatus as useInvitationStatus2 } from "@dxos/react-client/invitations";
|
|
1204
1234
|
import { useNetworkStatus, ConnectionState as ConnectionState2 } from "@dxos/react-client/mesh";
|
|
1205
|
-
import { Avatar as Avatar6, DensityProvider, Input as Input2, Toolbar as Toolbar3, Tooltip as
|
|
1235
|
+
import { Avatar as Avatar6, DensityProvider, Input as Input2, Toolbar as Toolbar3, Tooltip as Tooltip7, useId as useId6, useTranslation as useTranslation14 } from "@dxos/react-ui";
|
|
1206
1236
|
import { getSize as getSize13 } from "@dxos/react-ui-theme";
|
|
1207
1237
|
import { hexToEmoji as hexToEmoji4, hexToHue as hexToHue2, keyToFallback as keyToFallback3 } from "@dxos/util";
|
|
1208
1238
|
|
|
@@ -1316,15 +1346,14 @@ var useIdentityMachine = (client, options) => {
|
|
|
1316
1346
|
// packages/sdk/shell/src/panels/IdentityPanel/steps/IdentityActionChooser.tsx
|
|
1317
1347
|
import React25, { useCallback as useCallback4 } from "react";
|
|
1318
1348
|
import { log as log2 } from "@dxos/log";
|
|
1319
|
-
import {
|
|
1320
|
-
import { useHaloInvitations } from "@dxos/react-client/halo";
|
|
1349
|
+
import { useClient as useClient2 } from "@dxos/react-client";
|
|
1350
|
+
import { useHaloInvitations, DeviceType as DeviceType2 } from "@dxos/react-client/halo";
|
|
1321
1351
|
import { Invitation as Invitation2, InvitationEncoder } from "@dxos/react-client/invitations";
|
|
1322
1352
|
var __dxlog_file2 = "/home/runner/work/dxos/dxos/packages/sdk/shell/src/panels/IdentityPanel/steps/IdentityActionChooser.tsx";
|
|
1323
1353
|
var IdentityActionChooser = (props) => {
|
|
1324
1354
|
const { send } = props;
|
|
1325
1355
|
const client = useClient2();
|
|
1326
1356
|
const invitations = useHaloInvitations();
|
|
1327
|
-
const agentHostingProviderClient = useAgentHostingClient();
|
|
1328
1357
|
const onInvitationEvent = useCallback4((invitation) => {
|
|
1329
1358
|
const invitationCode = InvitationEncoder.encode(invitation);
|
|
1330
1359
|
if (invitation.state === Invitation2.State.CONNECTING) {
|
|
@@ -1333,7 +1362,7 @@ var IdentityActionChooser = (props) => {
|
|
|
1333
1362
|
authCode: invitation.authCode
|
|
1334
1363
|
}), void 0, {
|
|
1335
1364
|
F: __dxlog_file2,
|
|
1336
|
-
L:
|
|
1365
|
+
L: 24,
|
|
1337
1366
|
S: void 0,
|
|
1338
1367
|
C: (f, a) => f(...a)
|
|
1339
1368
|
});
|
|
@@ -1352,11 +1381,11 @@ var IdentityActionChooser = (props) => {
|
|
|
1352
1381
|
};
|
|
1353
1382
|
return /* @__PURE__ */ React25.createElement(IdentityActionChooserImpl, {
|
|
1354
1383
|
...props,
|
|
1355
|
-
onCreateInvitationClick: createInvitation
|
|
1356
|
-
agentHostingEnabled: !!agentHostingProviderClient
|
|
1384
|
+
onCreateInvitationClick: createInvitation
|
|
1357
1385
|
});
|
|
1358
1386
|
};
|
|
1359
|
-
var IdentityActionChooserImpl = ({ send, onCreateInvitationClick, devices, connectionState,
|
|
1387
|
+
var IdentityActionChooserImpl = ({ send, onCreateInvitationClick, devices, connectionState, agentHostingEnabled, ...agentProps }) => {
|
|
1388
|
+
const managedDeviceAvailable = devices.find((device) => device.profile?.type === DeviceType2.AGENT_MANAGED);
|
|
1360
1389
|
return /* @__PURE__ */ React25.createElement("div", {
|
|
1361
1390
|
role: "none",
|
|
1362
1391
|
className: "bs-40 grow overflow-y-auto overflow-x-hidden"
|
|
@@ -1369,13 +1398,9 @@ var IdentityActionChooserImpl = ({ send, onCreateInvitationClick, devices, conne
|
|
|
1369
1398
|
}),
|
|
1370
1399
|
onClickReset: () => send?.({
|
|
1371
1400
|
type: "chooseResetStorage"
|
|
1372
|
-
})
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
agentStatus,
|
|
1376
|
-
onAgentDestroy,
|
|
1377
|
-
onAgentCreate
|
|
1378
|
-
}));
|
|
1401
|
+
}),
|
|
1402
|
+
onAgentDestroy: agentProps.onAgentDestroy
|
|
1403
|
+
}), !managedDeviceAvailable && agentHostingEnabled && /* @__PURE__ */ React25.createElement(AgentConfig, agentProps));
|
|
1379
1404
|
};
|
|
1380
1405
|
|
|
1381
1406
|
// packages/sdk/shell/src/panels/IdentityPanel/steps/ProfileForm.tsx
|
|
@@ -1388,31 +1413,90 @@ import { hexToEmoji as hexToEmoji2, hexToHue } from "@dxos/util";
|
|
|
1388
1413
|
import { useCallback as useCallback5, useEffect as useEffect2, useState as useState6 } from "react";
|
|
1389
1414
|
import { invariant } from "@dxos/invariant";
|
|
1390
1415
|
import { log as log4 } from "@dxos/log";
|
|
1391
|
-
import { useAgentHostingClient
|
|
1416
|
+
import { useAgentHostingClient, useClient as useClient3 } from "@dxos/react-client";
|
|
1392
1417
|
import { Invitation as Invitation3, InvitationEncoder as InvitationEncoder2 } from "@dxos/react-client/invitations";
|
|
1393
1418
|
var __dxlog_file3 = "/home/runner/work/dxos/dxos/packages/sdk/shell/src/panels/IdentityPanel/useAgentHandlers.ts";
|
|
1394
1419
|
var useAgentHandlers = ({ invitations, identity }) => {
|
|
1395
1420
|
const [validationMessage, setValidationMessage] = useState6("");
|
|
1396
|
-
const [agentStatus, setAgentStatus] = useState6("");
|
|
1397
|
-
const
|
|
1398
|
-
const agentHostingProviderClient = useAgentHostingClient2();
|
|
1421
|
+
const [agentStatus, setAgentStatus] = useState6("getting");
|
|
1422
|
+
const agentHostingProviderClient = useAgentHostingClient();
|
|
1399
1423
|
const client = useClient3();
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
setAgentStatus(
|
|
1424
|
+
const updateAgentStatus = async () => {
|
|
1425
|
+
if (agentHostingProviderClient) {
|
|
1426
|
+
setAgentStatus("getting");
|
|
1427
|
+
try {
|
|
1428
|
+
const agentId = await agentHostingProviderClient?.getAgent(identity?.identityKey.truncate() ?? "never");
|
|
1429
|
+
if (agentId) {
|
|
1430
|
+
setAgentStatus("created");
|
|
1407
1431
|
} else {
|
|
1408
|
-
|
|
1409
|
-
setValidationMessage("No agent deployed via provider.");
|
|
1432
|
+
setAgentStatus("creatable");
|
|
1410
1433
|
}
|
|
1411
|
-
}
|
|
1412
|
-
|
|
1434
|
+
} catch (err) {
|
|
1435
|
+
setAgentStatus("error");
|
|
1436
|
+
setValidationMessage(`Couldn\u2019t check agent status: ${err.message}`);
|
|
1413
1437
|
}
|
|
1414
|
-
}
|
|
1415
|
-
|
|
1438
|
+
} else {
|
|
1439
|
+
setAgentStatus("error");
|
|
1440
|
+
setValidationMessage("No agent provider configured.");
|
|
1441
|
+
}
|
|
1442
|
+
};
|
|
1443
|
+
const createAgent = async (invitationCode) => {
|
|
1444
|
+
invariant(identity, "Identity not found", {
|
|
1445
|
+
F: __dxlog_file3,
|
|
1446
|
+
L: 50,
|
|
1447
|
+
S: void 0,
|
|
1448
|
+
A: [
|
|
1449
|
+
"identity",
|
|
1450
|
+
"'Identity not found'"
|
|
1451
|
+
]
|
|
1452
|
+
});
|
|
1453
|
+
if (agentHostingProviderClient) {
|
|
1454
|
+
setAgentStatus("creating");
|
|
1455
|
+
setValidationMessage("");
|
|
1456
|
+
try {
|
|
1457
|
+
const agentId = await agentHostingProviderClient?.createAgent(invitationCode, identity.identityKey.truncate());
|
|
1458
|
+
if (agentId) {
|
|
1459
|
+
setAgentStatus("created");
|
|
1460
|
+
} else {
|
|
1461
|
+
setAgentStatus("creatable");
|
|
1462
|
+
setValidationMessage("Error creating agent.");
|
|
1463
|
+
}
|
|
1464
|
+
} catch (err) {
|
|
1465
|
+
setValidationMessage(`Error creating agent: ${err.message}`);
|
|
1466
|
+
return updateAgentStatus();
|
|
1467
|
+
}
|
|
1468
|
+
} else {
|
|
1469
|
+
setAgentStatus("error");
|
|
1470
|
+
setValidationMessage("No agent provider configured.");
|
|
1471
|
+
}
|
|
1472
|
+
};
|
|
1473
|
+
const destroyAgent = async () => {
|
|
1474
|
+
invariant(identity, "Identity not found", {
|
|
1475
|
+
F: __dxlog_file3,
|
|
1476
|
+
L: 73,
|
|
1477
|
+
S: void 0,
|
|
1478
|
+
A: [
|
|
1479
|
+
"identity",
|
|
1480
|
+
"'Identity not found'"
|
|
1481
|
+
]
|
|
1482
|
+
});
|
|
1483
|
+
if (agentHostingProviderClient) {
|
|
1484
|
+
setAgentStatus("destroying");
|
|
1485
|
+
setValidationMessage("");
|
|
1486
|
+
try {
|
|
1487
|
+
await agentHostingProviderClient?.destroyAgent(identity.identityKey.truncate());
|
|
1488
|
+
setAgentStatus("creatable");
|
|
1489
|
+
} catch (err) {
|
|
1490
|
+
setValidationMessage(`Error destroying agent: ${err.message}`);
|
|
1491
|
+
return updateAgentStatus();
|
|
1492
|
+
}
|
|
1493
|
+
} else {
|
|
1494
|
+
setAgentStatus("error");
|
|
1495
|
+
setValidationMessage("No agent provider configured.");
|
|
1496
|
+
}
|
|
1497
|
+
};
|
|
1498
|
+
useEffect2(() => {
|
|
1499
|
+
void updateAgentStatus();
|
|
1416
1500
|
}, []);
|
|
1417
1501
|
const handleAgentCreate = useCallback5(async (invitation) => {
|
|
1418
1502
|
const invitationCode = InvitationEncoder2.encode(invitation);
|
|
@@ -1422,29 +1506,11 @@ var useAgentHandlers = ({ invitations, identity }) => {
|
|
|
1422
1506
|
authCode: invitation.authCode
|
|
1423
1507
|
}), void 0, {
|
|
1424
1508
|
F: __dxlog_file3,
|
|
1425
|
-
L:
|
|
1509
|
+
L: 97,
|
|
1426
1510
|
S: void 0,
|
|
1427
1511
|
C: (f, a) => f(...a)
|
|
1428
1512
|
});
|
|
1429
|
-
|
|
1430
|
-
F: __dxlog_file3,
|
|
1431
|
-
L: 50,
|
|
1432
|
-
S: void 0,
|
|
1433
|
-
A: [
|
|
1434
|
-
"identity",
|
|
1435
|
-
"'Identity not found'"
|
|
1436
|
-
]
|
|
1437
|
-
});
|
|
1438
|
-
if (agentHostingProviderClient) {
|
|
1439
|
-
try {
|
|
1440
|
-
const res = await agentHostingProviderClient?.createAgent(invitationCode, identity.identityKey.truncate());
|
|
1441
|
-
setAgentStatus(res);
|
|
1442
|
-
setAgentActive(true);
|
|
1443
|
-
setValidationMessage("");
|
|
1444
|
-
} catch (err) {
|
|
1445
|
-
setValidationMessage(`error creating agent: ${err.message}`);
|
|
1446
|
-
}
|
|
1447
|
-
}
|
|
1513
|
+
return createAgent(invitationCode);
|
|
1448
1514
|
}
|
|
1449
1515
|
}, []);
|
|
1450
1516
|
const onAgentCreate = async () => {
|
|
@@ -1456,32 +1522,17 @@ var useAgentHandlers = ({ invitations, identity }) => {
|
|
|
1456
1522
|
});
|
|
1457
1523
|
invitation.subscribe(handleAgentCreate);
|
|
1458
1524
|
};
|
|
1459
|
-
const
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
F: __dxlog_file3,
|
|
1463
|
-
L: 80,
|
|
1464
|
-
S: void 0,
|
|
1465
|
-
A: [
|
|
1466
|
-
"identity",
|
|
1467
|
-
"'Identity not found'"
|
|
1468
|
-
]
|
|
1469
|
-
});
|
|
1470
|
-
try {
|
|
1471
|
-
await agentHostingProviderClient?.destroyAgent(identity2.identityKey.truncate());
|
|
1472
|
-
setValidationMessage("No agent deployed via provider.");
|
|
1473
|
-
setAgentStatus("");
|
|
1474
|
-
setAgentActive(false);
|
|
1475
|
-
} catch (err) {
|
|
1476
|
-
setValidationMessage(`error destroying agent: ${err.message}`);
|
|
1477
|
-
}
|
|
1525
|
+
const onAgentRefresh = async () => {
|
|
1526
|
+
setValidationMessage("");
|
|
1527
|
+
await updateAgentStatus();
|
|
1478
1528
|
};
|
|
1479
1529
|
return {
|
|
1480
1530
|
onAgentCreate,
|
|
1481
|
-
onAgentDestroy,
|
|
1531
|
+
onAgentDestroy: destroyAgent,
|
|
1532
|
+
onAgentRefresh,
|
|
1482
1533
|
validationMessage,
|
|
1483
1534
|
agentStatus,
|
|
1484
|
-
|
|
1535
|
+
agentHostingEnabled: !!agentHostingProviderClient
|
|
1485
1536
|
};
|
|
1486
1537
|
};
|
|
1487
1538
|
|
|
@@ -1763,24 +1814,24 @@ var IdentityHeading = ({ titleId, title, identity, onDone, onUpdateProfile, conn
|
|
|
1763
1814
|
hue,
|
|
1764
1815
|
onChangeHue: setHue,
|
|
1765
1816
|
classNames: "bs-[--rail-action]"
|
|
1766
|
-
}), debug && /* @__PURE__ */ React29.createElement(React29.Fragment, null, /* @__PURE__ */ React29.createElement(
|
|
1817
|
+
}), debug && /* @__PURE__ */ React29.createElement(React29.Fragment, null, /* @__PURE__ */ React29.createElement(Tooltip7.Root, null, /* @__PURE__ */ React29.createElement(Tooltip7.Trigger, {
|
|
1767
1818
|
asChild: true
|
|
1768
1819
|
}, /* @__PURE__ */ React29.createElement(Toolbar3.Button, {
|
|
1769
|
-
classNames: "bs-[--rail-action]
|
|
1820
|
+
classNames: "bs-[--rail-action]",
|
|
1770
1821
|
"data-testid": "update-profile-form-copy-key",
|
|
1771
1822
|
onClick: () => setTextValue(identityHex)
|
|
1772
1823
|
}, /* @__PURE__ */ React29.createElement("span", {
|
|
1773
1824
|
className: "sr-only"
|
|
1774
1825
|
}, t(copied ? "copy success label" : "copy self public key label")), /* @__PURE__ */ React29.createElement(Key, {
|
|
1775
1826
|
className: getSize13(5)
|
|
1776
|
-
}))), /* @__PURE__ */ React29.createElement(
|
|
1827
|
+
}))), /* @__PURE__ */ React29.createElement(Tooltip7.Portal, null, /* @__PURE__ */ React29.createElement(Tooltip7.Content, {
|
|
1777
1828
|
side: "bottom",
|
|
1778
1829
|
classNames: "z-50"
|
|
1779
|
-
}, t(copied ? "copy success label" : "copy self public key label"), /* @__PURE__ */ React29.createElement(
|
|
1830
|
+
}, t(copied ? "copy success label" : "copy self public key label"), /* @__PURE__ */ React29.createElement(Tooltip7.Arrow, null))), /* @__PURE__ */ React29.createElement(Tooltip7.Root, null, /* @__PURE__ */ React29.createElement(Tooltip7.Trigger, {
|
|
1780
1831
|
asChild: true
|
|
1781
1832
|
}, /* @__PURE__ */ React29.createElement(Toolbar3.Button, {
|
|
1782
1833
|
classNames: [
|
|
1783
|
-
"bs-[--rail-action]
|
|
1834
|
+
"bs-[--rail-action]",
|
|
1784
1835
|
!isConnected && "text-error-500"
|
|
1785
1836
|
],
|
|
1786
1837
|
onClick: () => onChangeConnectionState?.(isConnected ? ConnectionState2.OFFLINE : ConnectionState2.ONLINE)
|
|
@@ -1790,10 +1841,10 @@ var IdentityHeading = ({ titleId, title, identity, onDone, onUpdateProfile, conn
|
|
|
1790
1841
|
className: getSize13(5)
|
|
1791
1842
|
}) : /* @__PURE__ */ React29.createElement(Plugs, {
|
|
1792
1843
|
className: getSize13(5)
|
|
1793
|
-
}))), /* @__PURE__ */ React29.createElement(
|
|
1844
|
+
}))), /* @__PURE__ */ React29.createElement(Tooltip7.Portal, null, /* @__PURE__ */ React29.createElement(Tooltip7.Content, {
|
|
1794
1845
|
side: "bottom",
|
|
1795
1846
|
classNames: "z-50"
|
|
1796
|
-
}, t(isConnected ? "disconnect label" : "connect label"), /* @__PURE__ */ React29.createElement(
|
|
1847
|
+
}, t(isConnected ? "disconnect label" : "connect label"), /* @__PURE__ */ React29.createElement(Tooltip7.Arrow, null)))))))));
|
|
1797
1848
|
};
|
|
1798
1849
|
var IdentityPanelImpl = (props) => {
|
|
1799
1850
|
const { identity, titleId, activeView, onUpdateProfile, onResetStorage, onJoinNewIdentity, IdentityActionChooser: IdentityActionChooserComponent = IdentityActionChooser, InvitationManager: InvitationManagerComponent = InvitationManager, connectionState, onChangeConnectionState, onDone, ...rest } = props;
|
|
@@ -1876,7 +1927,7 @@ var IdentityPanel = ({ titleId: propsTitleId, createInvitationUrl = (code) => co
|
|
|
1876
1927
|
if (!identity) {
|
|
1877
1928
|
log6.error("IdentityPanel rendered with no active identity.", void 0, {
|
|
1878
1929
|
F: __dxlog_file5,
|
|
1879
|
-
L:
|
|
1930
|
+
L: 246,
|
|
1880
1931
|
S: void 0,
|
|
1881
1932
|
C: (f, a) => f(...a)
|
|
1882
1933
|
});
|
|
@@ -1893,7 +1944,7 @@ var IdentityPanel = ({ titleId: propsTitleId, createInvitationUrl = (code) => co
|
|
|
1893
1944
|
const subscription = identityService.subscribe((state) => {
|
|
1894
1945
|
log6("[state]", state, {
|
|
1895
1946
|
F: __dxlog_file5,
|
|
1896
|
-
L:
|
|
1947
|
+
L: 259,
|
|
1897
1948
|
S: void 0,
|
|
1898
1949
|
C: (f, a) => f(...a)
|
|
1899
1950
|
});
|
|
@@ -3788,7 +3839,7 @@ import React47, { StrictMode } from "react";
|
|
|
3788
3839
|
import { createRoot } from "react-dom/client";
|
|
3789
3840
|
import { DEFAULT_CLIENT_CHANNEL, DEFAULT_SHELL_CHANNEL } from "@dxos/client-protocol";
|
|
3790
3841
|
import { AgentHostingProvider, Client, ClientContext, ClientServicesProxy, Config, ShellDisplay as ShellDisplay2, SystemStatus } from "@dxos/react-client";
|
|
3791
|
-
import { Button as Button11, Dialog as Dialog3, ThemeProvider, Tooltip as
|
|
3842
|
+
import { Button as Button11, Dialog as Dialog3, ThemeProvider, Tooltip as Tooltip8, useTranslation as useTranslation26 } from "@dxos/react-ui";
|
|
3792
3843
|
import { defaultTx } from "@dxos/react-ui-theme";
|
|
3793
3844
|
import { createIFramePort } from "@dxos/rpc-tunnel";
|
|
3794
3845
|
|
|
@@ -4236,7 +4287,12 @@ var os = {
|
|
|
4236
4287
|
"create agent label": "Start an agent",
|
|
4237
4288
|
"destroy agent label": "Shut down agent",
|
|
4238
4289
|
"agent device label": "Your agent",
|
|
4239
|
-
"shell fallback title": "Shell failed to connect"
|
|
4290
|
+
"shell fallback title": "Shell failed to connect",
|
|
4291
|
+
"creating agent label": "Starting agent\u2026",
|
|
4292
|
+
"destroying agent label": "Stopping agent\u2026",
|
|
4293
|
+
"getting agent label": "Checking agent status\u2026",
|
|
4294
|
+
"agent requested label": "Agent requested",
|
|
4295
|
+
"agent requested description": "The agent service is creating an agent for you. Once the agent connects, it will display in the devices list."
|
|
4240
4296
|
};
|
|
4241
4297
|
|
|
4242
4298
|
// packages/sdk/shell/src/translations/index.ts
|
|
@@ -4269,7 +4325,7 @@ var runShell = async (config = new Config()) => {
|
|
|
4269
4325
|
client,
|
|
4270
4326
|
status: SystemStatus.ACTIVE
|
|
4271
4327
|
}
|
|
4272
|
-
}, /* @__PURE__ */ React47.createElement(ClipboardProvider, null, /* @__PURE__ */ React47.createElement(
|
|
4328
|
+
}, /* @__PURE__ */ React47.createElement(ClipboardProvider, null, /* @__PURE__ */ React47.createElement(Tooltip8.Provider, null, /* @__PURE__ */ React47.createElement(AgentHostingProvider, null, /* @__PURE__ */ React47.createElement(Shell, {
|
|
4273
4329
|
runtime
|
|
4274
4330
|
}))))))));
|
|
4275
4331
|
} catch {
|