nolo-cli 0.189.0-alpha.1 → 0.189.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/{_executeModel-7GFCTOFY.js → _executeModel-QOFXEPSS.js} +25 -25
- package/{action-HQXK4ZT4.js → action-BHWB4MOK.js} +2 -2
- package/{addContentAction-3WAN3OWY.js → addContentAction-BY375D35.js} +3 -3
- package/{addDialogAgentAction-WNQBFR5G.js → addDialogAgentAction-HOZYOCWC.js} +2 -2
- package/{agentDeleteCommand-GXYAEUFQ.js → agentDeleteCommand-LRSEXEB6.js} +27 -27
- package/{agentEmailCommands-WYZKZBPZ.js → agentEmailCommands-2DA2QEMT.js} +28 -28
- package/{agentListCommands-POWEO3US.js → agentListCommands-QPK6UASU.js} +11 -11
- package/{agentMachineCommands-LD4UKJ47.js → agentMachineCommands-ZJRERHQH.js} +8 -8
- package/{agentRecordCommands-O6SOBL37.js → agentRecordCommands-GCX7AEMX.js} +27 -27
- package/{agentRunCommand-JZ5CH3DL.js → agentRunCommand-4SK32PJ3.js} +28 -28
- package/{agentRuntimeLocal-G4KEXO5D.js → agentRuntimeLocal-3U5XRLAK.js} +5 -5
- package/{agentSlice-STUDWJJZ.js → agentSlice-65HNASAY.js} +3 -3
- package/{appDeleteCommands-GZPGKI2Z.js → appDeleteCommands-SHM3KTWX.js} +10 -10
- package/{appDeployCommands-5UU3V5OK.js → appDeployCommands-WT5PP4UE.js} +10 -10
- package/{appDeployStatusCommands-2ZB2QZ22.js → appDeployStatusCommands-QTJB5BD5.js} +10 -10
- package/{appGetCommands-YSZFBV5G.js → appGetCommands-XYTHPEAY.js} +10 -10
- package/{appListCommands-W6D7XIFX.js → appListCommands-2XJ33HSC.js} +10 -10
- package/{authCommand-L6C4LLOU.js → authCommand-RV5MQDWN.js} +3 -3
- package/{authCommands-RFLKIPBT.js → authCommands-MZUXPRYJ.js} +2 -2
- package/{builtinSkillRegistry-2VN6JG4U.js → builtinSkillRegistry-7MBUY5EY.js} +3 -3
- package/{chromeOpsCommands-BTIWDYLA.js → chromeOpsCommands-BA6CS4DI.js} +5 -1
- package/{chunk-3QFOYFJW.js → chunk-4ITFEPCV.js} +4 -4
- package/{chunk-XTM23OUX.js → chunk-4OB2TWTW.js} +2 -2
- package/{chunk-GSX7Z46F.js → chunk-5HAPEKNH.js} +1 -1
- package/{chunk-PVZ3GB25.js → chunk-5IWKNSOS.js} +5 -5
- package/{chunk-53RSTB7T.js → chunk-5N5FMA7J.js} +1 -1
- package/{chunk-RANCLEEC.js → chunk-5TAX33Z3.js} +10 -10
- package/{chunk-O2MBTX37.js → chunk-6XWKAFHB.js} +4 -4
- package/{chunk-H6FUDBS3.js → chunk-7DQTUEMG.js} +5 -5
- package/{chunk-JOOWHDGM.js → chunk-A5BLRE3G.js} +1 -1
- package/{chunk-Y2ZDNW2H.js → chunk-B2N5GZBU.js} +2 -2
- package/{chunk-7SJG5ZNX.js → chunk-B6EZB6DW.js} +1 -1
- package/{chunk-4OTMONZL.js → chunk-BPQ7HF7B.js} +9 -9
- package/{chunk-CLGAGPEM.js → chunk-CNMQATUF.js} +1 -1
- package/{chunk-6G5V4Y3V.js → chunk-CNWXWENP.js} +67 -43
- package/{chunk-KOIGM3KU.js → chunk-CWHFD46Z.js} +1 -1
- package/{chunk-ER4UTWWS.js → chunk-DFF6B7P7.js} +1 -1
- package/{chunk-PCPQWTXJ.js → chunk-DM6EHCHZ.js} +1 -1
- package/{chunk-WMHWFFTE.js → chunk-ECX3NKRD.js} +46 -0
- package/{chunk-R6AJKHEU.js → chunk-FWWNKGI2.js} +3 -3
- package/{chunk-WBCYL63M.js → chunk-GFTVBBN3.js} +2 -2
- package/{chunk-J6ACCFU6.js → chunk-GU6DMIHV.js} +5 -5
- package/{chunk-7N6C3IHF.js → chunk-HDAK6PC4.js} +2 -2
- package/{chunk-OKFKGCTS.js → chunk-HTLIKE5U.js} +2 -2
- package/{chunk-J7QGWFT6.js → chunk-HV7UAV6R.js} +39 -14
- package/{chunk-LOQYQUM2.js → chunk-JGJVDP2W.js} +17 -17
- package/{chunk-S4W4GV3B.js → chunk-K6TZSON4.js} +1 -1
- package/{chunk-RGTPR57U.js → chunk-KKUMQLZV.js} +4 -4
- package/{chunk-MMOISK6N.js → chunk-KZMDPBOW.js} +4 -4
- package/{chunk-4MZCYEK5.js → chunk-LRIMG3ZZ.js} +2 -2
- package/{chunk-HVV4B6OL.js → chunk-MEJLTHBK.js} +214 -47
- package/{chunk-UBLITLAZ.js → chunk-NABJEYPJ.js} +1 -0
- package/{chunk-I3HWJODB.js → chunk-OWCWVNX2.js} +1 -1
- package/{chunk-OXOXPREC.js → chunk-SM56M7N7.js} +1 -1
- package/{chunk-TNVE3CAV.js → chunk-UF3YPO4W.js} +5 -5
- package/{chunk-IFN7MHWL.js → chunk-UGCQKKXW.js} +1 -1
- package/{chunk-63RO7QWZ.js → chunk-UNOILAZP.js} +10 -0
- package/{chunk-7GXK3WTO.js → chunk-WAZ6BTSC.js} +1 -1
- package/{chunk-5LVGXDSL.js → chunk-WDJMTI5S.js} +2 -2
- package/{chunk-ZIOYHDYW.js → chunk-WXJBMIJG.js} +2 -2
- package/{chunk-RJ3EYB5G.js → chunk-X3RWBJDQ.js} +1 -1
- package/{chunk-YUZIPPER.js → chunk-YEFDL5BJ.js} +9 -3
- package/{chunk-RBVR7P3M.js → chunk-Z6L7XGF3.js} +18 -18
- package/{chunk-2SUNC7EM.js → chunk-ZZHMEFIF.js} +12 -12
- package/{commandRegistry-AXZLPIPP.js → commandRegistry-C47OOI5Q.js} +61 -61
- package/{contentThunks-E4DHXF3M.js → contentThunks-XEJIAVHB.js} +8 -8
- package/{cooldownCommands-ZERBBSWJ.js → cooldownCommands-4XKJFEBW.js} +1 -1
- package/{createAgentAutomationAction-2P2II7B3.js → createAgentAutomationAction-3DJQXHA2.js} +8 -8
- package/{createDialogAction-MFZGE5EO.js → createDialogAction-25VQQSAD.js} +10 -10
- package/{createPageAction-SBU2YCNR.js → createPageAction-EPTJF4F2.js} +8 -8
- package/{dbSlice-2O3YBVPP.js → dbSlice-QAUXABCC.js} +2 -2
- package/{dialogCommands-AQLB3TG2.js → dialogCommands-5RJ2ZD6I.js} +10 -10
- package/{dialogSlice-GKPCUQWM.js → dialogSlice-HYSCQTOK.js} +7 -7
- package/{dialogUsageCommand-44XMU6DD.js → dialogUsageCommand-QTG6ILEJ.js} +58 -5
- package/{docCreateCommands-AND3EMIY.js → docCreateCommands-F7IOVRUN.js} +9 -9
- package/{docDeleteCommands-WA7CPPN3.js → docDeleteCommands-YM75VYQH.js} +10 -10
- package/{docReadCommands-A4JLU4WF.js → docReadCommands-B6OOQQ2K.js} +9 -9
- package/{docStore-DOZVBVKZ.js → docStore-XW4O276W.js} +3 -3
- package/{docUpdateCommands-33PDSHS3.js → docUpdateCommands-WP6N64X5.js} +9 -9
- package/{fetchMessages-QLW7INJJ.js → fetchMessages-HWBVATSE.js} +1 -1
- package/{handleSendMessageAction-FY4RBJEA.js → handleSendMessageAction-AJQAPKZG.js} +15 -15
- package/index.js +6 -6
- package/{keys-N6HQICY5.js → keys-P4ZDOVJW.js} +11 -1
- package/{localDialogRead-55YDVPNU.js → localDialogRead-CT5HGDMC.js} +1 -1
- package/{localRuntimeAdapter-VOTHX3NK.js → localRuntimeAdapter-ZNBHLFHQ.js} +25 -25
- package/{machineCommands-FDTN3A5S.js → machineCommands-OJL3YYC7.js} +26 -26
- package/{machineWsRunDispatch-PPVYOERM.js → machineWsRunDispatch-HVHO5FF7.js} +26 -26
- package/{memberThunks-VXT36MZP.js → memberThunks-QWAAGQBS.js} +155 -52
- package/package.json +1 -1
- package/{readlineWorkspace-6SU3QTTY.js → readlineWorkspace-RXUSSWVA.js} +87 -41
- package/{removeDialogAgentAction-PK24DJ2J.js → removeDialogAgentAction-YEPO5AYI.js} +3 -3
- package/{runAgentClientLoop-CFIM6MXT.js → runAgentClientLoop-45RESAY7.js} +23 -23
- package/{secretCommands-UYVNIQIN.js → secretCommands-N6CMCJDZ.js} +1 -1
- package/{setDialogExtraReferencesAction-BN4IBUO6.js → setDialogExtraReferencesAction-EH5GWDAJ.js} +3 -3
- package/{setPrimaryDialogAgentAction-JR5SMLZY.js → setPrimaryDialogAgentAction-PNWRK6IY.js} +3 -3
- package/{settingThunks-RJZQHL7H.js → settingThunks-7VCWB6P7.js} +2 -2
- package/{spaceCommands-BI3TRIAK.js → spaceCommands-KW4V3QIE.js} +8 -8
- package/{streamAgentChatTurn-3BS7IAFR.js → streamAgentChatTurn-INSFKUQL.js} +25 -25
- package/{switchDialogAgentAction-TSIXBNRH.js → switchDialogAgentAction-23BFWJMV.js} +2 -2
- package/{tools-PCTUYG54.js → tools-WRQ4V7ML.js} +19 -19
- package/{updateCommands-6GKGM7NR.js → updateCommands-KE6LP3QX.js} +3 -3
- package/{updateDialogTitleAction-ZHFIMEQL.js → updateDialogTitleAction-Q3Z2YFIU.js} +8 -8
- package/{windowsSelfUpdate-4N7JCG2M.js → windowsSelfUpdate-26TSFXEZ.js} +2 -2
|
@@ -11,13 +11,13 @@ import {
|
|
|
11
11
|
runtimeWorkspacePermissionPolicy,
|
|
12
12
|
scopePermissionPolicyToRuntimeWorkspace,
|
|
13
13
|
summarizeAgentConfigForLogs
|
|
14
|
-
} from "./chunk-
|
|
15
|
-
import "./chunk-
|
|
14
|
+
} from "./chunk-UF3YPO4W.js";
|
|
15
|
+
import "./chunk-HV7UAV6R.js";
|
|
16
16
|
import "./chunk-DYQXB46J.js";
|
|
17
17
|
import "./chunk-VP3BINY7.js";
|
|
18
18
|
import "./chunk-R4BMKAR5.js";
|
|
19
19
|
import "./chunk-LKZPX6YH.js";
|
|
20
|
-
import "./chunk-
|
|
20
|
+
import "./chunk-X3RWBJDQ.js";
|
|
21
21
|
import "./chunk-NBTY7YJF.js";
|
|
22
22
|
import "./chunk-VIWDGTDA.js";
|
|
23
23
|
import "./chunk-HGDKT2D6.js";
|
|
@@ -27,40 +27,40 @@ import "./chunk-VL5KOY2C.js";
|
|
|
27
27
|
import "./chunk-ZEZC7IIM.js";
|
|
28
28
|
import "./chunk-ATNTHIZI.js";
|
|
29
29
|
import "./chunk-INFHX73M.js";
|
|
30
|
-
import "./chunk-
|
|
30
|
+
import "./chunk-WXJBMIJG.js";
|
|
31
31
|
import "./chunk-HS7MLR74.js";
|
|
32
|
-
import "./chunk-
|
|
32
|
+
import "./chunk-CNWXWENP.js";
|
|
33
33
|
import "./chunk-KFHREHUQ.js";
|
|
34
|
-
import "./chunk-
|
|
34
|
+
import "./chunk-5N5FMA7J.js";
|
|
35
35
|
import "./chunk-OXME3PEE.js";
|
|
36
36
|
import "./chunk-KSTEXKL6.js";
|
|
37
37
|
import "./chunk-VF4K2QE6.js";
|
|
38
|
-
import "./chunk-
|
|
39
|
-
import "./chunk-
|
|
38
|
+
import "./chunk-JGJVDP2W.js";
|
|
39
|
+
import "./chunk-6XWKAFHB.js";
|
|
40
40
|
import "./chunk-NF64D32W.js";
|
|
41
41
|
import "./chunk-3L2WKC3W.js";
|
|
42
42
|
import "./chunk-VYNMQ6HW.js";
|
|
43
|
-
import "./chunk-
|
|
43
|
+
import "./chunk-FWWNKGI2.js";
|
|
44
44
|
import "./chunk-MYOH447Z.js";
|
|
45
|
-
import "./chunk-
|
|
45
|
+
import "./chunk-DFF6B7P7.js";
|
|
46
46
|
import "./chunk-YIRADHSY.js";
|
|
47
47
|
import "./chunk-AGIM7IMJ.js";
|
|
48
48
|
import "./chunk-ZBCBFOWC.js";
|
|
49
49
|
import "./chunk-VIDPVFP3.js";
|
|
50
50
|
import "./chunk-63W5N6P3.js";
|
|
51
|
-
import "./chunk-
|
|
52
|
-
import "./chunk-
|
|
51
|
+
import "./chunk-7DQTUEMG.js";
|
|
52
|
+
import "./chunk-KKUMQLZV.js";
|
|
53
53
|
import "./chunk-5XBUWM6I.js";
|
|
54
|
-
import "./chunk-
|
|
54
|
+
import "./chunk-Z6L7XGF3.js";
|
|
55
55
|
import "./chunk-TZXPT53C.js";
|
|
56
56
|
import "./chunk-LEC5ALIN.js";
|
|
57
57
|
import "./chunk-523DITKR.js";
|
|
58
|
-
import "./chunk-
|
|
58
|
+
import "./chunk-5IWKNSOS.js";
|
|
59
59
|
import "./chunk-BYXBJQAS.js";
|
|
60
60
|
import "./chunk-QYPE3TS3.js";
|
|
61
|
-
import "./chunk-
|
|
61
|
+
import "./chunk-A5BLRE3G.js";
|
|
62
62
|
import "./chunk-4JH2UMJR.js";
|
|
63
|
-
import "./chunk-
|
|
63
|
+
import "./chunk-B6EZB6DW.js";
|
|
64
64
|
import "./chunk-UAD2WT54.js";
|
|
65
65
|
import "./chunk-5RGU3J7P.js";
|
|
66
66
|
import "./chunk-ZRAU6T47.js";
|
|
@@ -69,9 +69,9 @@ import "./chunk-OWYYDMGJ.js";
|
|
|
69
69
|
import "./chunk-YDH3FDFQ.js";
|
|
70
70
|
import "./chunk-P64WRQYV.js";
|
|
71
71
|
import "./chunk-GLKOYSRU.js";
|
|
72
|
-
import "./chunk-
|
|
72
|
+
import "./chunk-CNMQATUF.js";
|
|
73
73
|
import "./chunk-32ZKZET7.js";
|
|
74
|
-
import "./chunk-
|
|
74
|
+
import "./chunk-B2N5GZBU.js";
|
|
75
75
|
import "./chunk-3PVYUPXK.js";
|
|
76
76
|
import "./chunk-BA2FHPS4.js";
|
|
77
77
|
import "./chunk-LBXUNNDS.js";
|
|
@@ -84,13 +84,13 @@ import "./chunk-OW765XBU.js";
|
|
|
84
84
|
import "./chunk-PXYBUFDB.js";
|
|
85
85
|
import "./chunk-ZSO5B6SW.js";
|
|
86
86
|
import "./chunk-D2MDMY2M.js";
|
|
87
|
-
import "./chunk-
|
|
88
|
-
import "./chunk-
|
|
87
|
+
import "./chunk-5HAPEKNH.js";
|
|
88
|
+
import "./chunk-SM56M7N7.js";
|
|
89
89
|
import "./chunk-EUGTFFO6.js";
|
|
90
90
|
import "./chunk-AETZ7AD6.js";
|
|
91
91
|
import "./chunk-Y6ORVLSS.js";
|
|
92
92
|
import "./chunk-KHCLMKZZ.js";
|
|
93
|
-
import "./chunk-
|
|
93
|
+
import "./chunk-MEJLTHBK.js";
|
|
94
94
|
import "./chunk-ZNFJWEN4.js";
|
|
95
95
|
import "./chunk-IIX6VWLW.js";
|
|
96
96
|
import "./chunk-NVOYW6H4.js";
|
|
@@ -103,15 +103,15 @@ import "./chunk-2WZXXAQD.js";
|
|
|
103
103
|
import "./chunk-PVD7CRYV.js";
|
|
104
104
|
import "./chunk-G6OOUQWJ.js";
|
|
105
105
|
import "./chunk-56GBUMO5.js";
|
|
106
|
-
import "./chunk-
|
|
106
|
+
import "./chunk-OWCWVNX2.js";
|
|
107
107
|
import "./chunk-OHRDHS4N.js";
|
|
108
108
|
import "./chunk-E2BESSAW.js";
|
|
109
|
-
import "./chunk-
|
|
109
|
+
import "./chunk-NABJEYPJ.js";
|
|
110
110
|
import "./chunk-JLR5NWP2.js";
|
|
111
111
|
import "./chunk-WJZOQR2J.js";
|
|
112
112
|
import "./chunk-WFUIXNKC.js";
|
|
113
113
|
import "./chunk-2MBTWINN.js";
|
|
114
|
-
import "./chunk-
|
|
114
|
+
import "./chunk-K6TZSON4.js";
|
|
115
115
|
import "./chunk-5ZUL4CUO.js";
|
|
116
116
|
import "./chunk-JIFYXQRD.js";
|
|
117
117
|
import "./chunk-H57T64RA.js";
|
|
@@ -147,8 +147,8 @@ import "./chunk-4SN6J65J.js";
|
|
|
147
147
|
import "./chunk-CF7PE763.js";
|
|
148
148
|
import "./chunk-R5GO3YZP.js";
|
|
149
149
|
import "./chunk-Y6ROFCZO.js";
|
|
150
|
-
import "./chunk-
|
|
151
|
-
import "./chunk-
|
|
150
|
+
import "./chunk-UNOILAZP.js";
|
|
151
|
+
import "./chunk-ECX3NKRD.js";
|
|
152
152
|
import "./chunk-XJWWBO34.js";
|
|
153
153
|
import "./chunk-I42VC5KR.js";
|
|
154
154
|
import "./chunk-U6VC4MU4.js";
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import {
|
|
2
|
+
addMemberSpace,
|
|
2
3
|
appendRecoveredMemberships,
|
|
4
|
+
applyFetchSpaceFulfilled,
|
|
3
5
|
fetchRemoteSpace,
|
|
4
6
|
fetchRemoteUserSpaceMemberships,
|
|
5
|
-
getMemberSpaces,
|
|
6
|
-
hydrateMemberSpacesFromLocal,
|
|
7
7
|
membershipBelongsToUser,
|
|
8
8
|
selectSpaceRemoteAuth,
|
|
9
9
|
setMemberSpaces,
|
|
10
10
|
setMembershipLoading,
|
|
11
11
|
setMembershipRejected,
|
|
12
12
|
spaceListsUser
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-JGJVDP2W.js";
|
|
14
14
|
import {
|
|
15
15
|
getCurrentSpaceIdRaw,
|
|
16
16
|
updateCurrentSpaceIfMatch
|
|
@@ -25,7 +25,7 @@ import {
|
|
|
25
25
|
read,
|
|
26
26
|
remove,
|
|
27
27
|
write
|
|
28
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-B2N5GZBU.js";
|
|
29
29
|
import "./chunk-3PVYUPXK.js";
|
|
30
30
|
import "./chunk-BA2FHPS4.js";
|
|
31
31
|
import {
|
|
@@ -41,7 +41,8 @@ import {
|
|
|
41
41
|
createAsyncThunk
|
|
42
42
|
} from "./chunk-WRCZXJ4N.js";
|
|
43
43
|
import {
|
|
44
|
-
logger
|
|
44
|
+
logger,
|
|
45
|
+
normalizeTimeFields
|
|
45
46
|
} from "./chunk-6Q7UTJKR.js";
|
|
46
47
|
import "./chunk-QQ56R7KS.js";
|
|
47
48
|
import "./chunk-OW765XBU.js";
|
|
@@ -62,7 +63,7 @@ import "./chunk-4SN6J65J.js";
|
|
|
62
63
|
import "./chunk-CF7PE763.js";
|
|
63
64
|
import {
|
|
64
65
|
DB_PREFIX
|
|
65
|
-
} from "./chunk-
|
|
66
|
+
} from "./chunk-ECX3NKRD.js";
|
|
66
67
|
import "./chunk-XJWWBO34.js";
|
|
67
68
|
import "./chunk-I42VC5KR.js";
|
|
68
69
|
import "./chunk-U6VC4MU4.js";
|
|
@@ -111,26 +112,6 @@ var readLocalSpaceData = async (db, spaceId) => {
|
|
|
111
112
|
}
|
|
112
113
|
};
|
|
113
114
|
var membershipCheckUserId = (membership, activeUserId) => isDeviceLocalSpaceMembership(membership) ? DEVICE_LOCAL_OWNER_ID : activeUserId;
|
|
114
|
-
var buildLocalMembershipPreview = async (userId, db, memberships) => {
|
|
115
|
-
const preview = await Promise.all(
|
|
116
|
-
memberships.map(async (membership) => {
|
|
117
|
-
if (isTombstoneRecord(membership)) return null;
|
|
118
|
-
const checkUserId = membershipCheckUserId(membership, userId);
|
|
119
|
-
if (!membershipBelongsToUser(membership, checkUserId)) return null;
|
|
120
|
-
const normalizedSpaceId = normalizeSpaceId(membership.spaceId);
|
|
121
|
-
const localSpaceData = await readLocalSpaceData(db, normalizedSpaceId);
|
|
122
|
-
if (!localSpaceData || isTombstoneRecord(localSpaceData)) return null;
|
|
123
|
-
if (!spaceListsUser(localSpaceData, checkUserId)) return null;
|
|
124
|
-
return {
|
|
125
|
-
...membership,
|
|
126
|
-
spaceId: normalizedSpaceId
|
|
127
|
-
};
|
|
128
|
-
})
|
|
129
|
-
);
|
|
130
|
-
return preview.filter(
|
|
131
|
-
(membership) => !!membership
|
|
132
|
-
);
|
|
133
|
-
};
|
|
134
115
|
var fetchLocalForUser = async (userId, db) => {
|
|
135
116
|
try {
|
|
136
117
|
const memberships = [];
|
|
@@ -255,23 +236,12 @@ var fetchUserSpaceMembershipsAction = async (userId, thunkAPI) => {
|
|
|
255
236
|
const db = thunkAPI.extra.db;
|
|
256
237
|
const { token, servers } = selectSpaceRemoteAuth(state);
|
|
257
238
|
const isLocalActor = isDeviceLocalOwnerId(userId);
|
|
258
|
-
const localMembershipsPromise = fetchLocalUnion(userId, db);
|
|
259
239
|
const remoteResultsPromise = isLocalActor ? Promise.resolve([]) : Promise.all(
|
|
260
240
|
servers.map(
|
|
261
241
|
(server) => fetchRemoteUserSpaceMemberships(server, token, userId)
|
|
262
242
|
)
|
|
263
243
|
);
|
|
264
|
-
const localMemberships = await
|
|
265
|
-
if (getMemberSpaces() === null && localMemberships.length > 0) {
|
|
266
|
-
const localPreview = await buildLocalMembershipPreview(
|
|
267
|
-
userId,
|
|
268
|
-
db,
|
|
269
|
-
localMemberships
|
|
270
|
-
);
|
|
271
|
-
if (localPreview.length > 0) {
|
|
272
|
-
hydrateMemberSpacesFromLocal(localPreview);
|
|
273
|
-
}
|
|
274
|
-
}
|
|
244
|
+
const localMemberships = isLocalActor ? await fetchLocalUnion(userId, db) : [];
|
|
275
245
|
const remoteResults = await remoteResultsPromise;
|
|
276
246
|
const successfulRemoteResults = remoteResults.filter((result) => result.ok);
|
|
277
247
|
const successfulRemoteMemberships = successfulRemoteResults.flatMap(
|
|
@@ -287,6 +257,11 @@ var fetchUserSpaceMembershipsAction = async (userId, thunkAPI) => {
|
|
|
287
257
|
`${SPACE_MEMBERSHIP_REMOTE_UNAVAILABLE}: unable to refresh memberships from ${servers.join(", ")}`
|
|
288
258
|
);
|
|
289
259
|
}
|
|
260
|
+
if (!isLocalActor && !hasRemoteAuthority) {
|
|
261
|
+
throw new Error(
|
|
262
|
+
`${SPACE_MEMBERSHIP_REMOTE_UNAVAILABLE}: no remote authority for ${userId}`
|
|
263
|
+
);
|
|
264
|
+
}
|
|
290
265
|
const remoteSpaceIds = new Set(
|
|
291
266
|
successfulRemoteMemberships.map(
|
|
292
267
|
(membership) => normalizeSpaceId(membership.spaceId)
|
|
@@ -326,11 +301,20 @@ var fetchUserSpaceMembershipsAction = async (userId, thunkAPI) => {
|
|
|
326
301
|
const checkUserId = membershipCheckUserId(membership, userId);
|
|
327
302
|
if (!membershipBelongsToUser(membership, checkUserId)) return null;
|
|
328
303
|
const normalizedSpaceId = normalizeSpaceId(membership.spaceId);
|
|
329
|
-
const localSpaceData = await readLocalSpaceData(db, normalizedSpaceId);
|
|
330
304
|
const isDeviceLocal = membership.deviceLocal || isDeviceLocalSpaceMembership(membership);
|
|
305
|
+
let localSpaceDataLoaded = false;
|
|
306
|
+
let localSpaceDataCache = null;
|
|
307
|
+
const loadLocalSpaceData = async () => {
|
|
308
|
+
if (!localSpaceDataLoaded) {
|
|
309
|
+
localSpaceDataCache = await readLocalSpaceData(db, normalizedSpaceId);
|
|
310
|
+
localSpaceDataLoaded = true;
|
|
311
|
+
}
|
|
312
|
+
return localSpaceDataCache;
|
|
313
|
+
};
|
|
331
314
|
if (isDeviceLocal) {
|
|
332
|
-
|
|
333
|
-
if (!
|
|
315
|
+
const localSpaceData2 = await loadLocalSpaceData();
|
|
316
|
+
if (!localSpaceData2 || isTombstoneRecord(localSpaceData2)) return null;
|
|
317
|
+
if (!spaceListsUser(localSpaceData2, checkUserId)) {
|
|
334
318
|
return null;
|
|
335
319
|
}
|
|
336
320
|
const {
|
|
@@ -345,15 +329,16 @@ var fetchUserSpaceMembershipsAction = async (userId, thunkAPI) => {
|
|
|
345
329
|
userId: DEVICE_LOCAL_OWNER_ID
|
|
346
330
|
};
|
|
347
331
|
}
|
|
332
|
+
if (membership.sourceServer && !membership.requiresRemoteSpaceVerification) {
|
|
333
|
+
const { sourceServer: _ss, ...verifiedMembership } = membership;
|
|
334
|
+
return {
|
|
335
|
+
...verifiedMembership,
|
|
336
|
+
spaceId: normalizedSpaceId
|
|
337
|
+
};
|
|
338
|
+
}
|
|
348
339
|
if (membership.sourceServer || membership.requiresRemoteSpaceVerification) {
|
|
349
|
-
|
|
350
|
-
if (
|
|
351
|
-
const { sourceServer: _ss, ...verifiedMembership } = membership;
|
|
352
|
-
return {
|
|
353
|
-
...verifiedMembership,
|
|
354
|
-
spaceId: normalizedSpaceId
|
|
355
|
-
};
|
|
356
|
-
}
|
|
340
|
+
const localSpaceData2 = await loadLocalSpaceData();
|
|
341
|
+
if (localSpaceData2 && isTombstoneRecord(localSpaceData2)) return null;
|
|
357
342
|
try {
|
|
358
343
|
const remoteSpaceServers = Array.from(
|
|
359
344
|
new Set(
|
|
@@ -385,6 +370,7 @@ var fetchUserSpaceMembershipsAction = async (userId, thunkAPI) => {
|
|
|
385
370
|
return null;
|
|
386
371
|
}
|
|
387
372
|
}
|
|
373
|
+
const localSpaceData = await loadLocalSpaceData();
|
|
388
374
|
if (localSpaceData) {
|
|
389
375
|
return !spaceListsUser(localSpaceData, userId) ? null : {
|
|
390
376
|
...membership,
|
|
@@ -486,6 +472,88 @@ var fetchUserSpaceMembershipsAction = async (userId, thunkAPI) => {
|
|
|
486
472
|
var dbThunkState = (thunkApi) => thunkApi.getState();
|
|
487
473
|
var dbThunkExtra = (thunkApi) => thunkApi.extra;
|
|
488
474
|
|
|
475
|
+
// packages/create/space/member/submitAddSpaceMember.ts
|
|
476
|
+
var ADD_SPACE_MEMBER_TIMEOUT_MS = 1e4;
|
|
477
|
+
var pendingOperations = /* @__PURE__ */ new Map();
|
|
478
|
+
var newOperationId = () => {
|
|
479
|
+
const uuid = globalThis.crypto?.randomUUID;
|
|
480
|
+
if (typeof uuid === "function") return uuid.call(globalThis.crypto);
|
|
481
|
+
return `op-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 10)}`;
|
|
482
|
+
};
|
|
483
|
+
var messageForErrorCode = (code, fallback) => {
|
|
484
|
+
switch (code) {
|
|
485
|
+
case "conflict":
|
|
486
|
+
return "\u8FD9\u6B21\u64CD\u4F5C\u4E0E\u4E4B\u524D\u7684\u63D0\u4EA4\u51B2\u7A81\uFF0C\u8BF7\u5237\u65B0\u7A7A\u95F4\u540E\u91CD\u8BD5";
|
|
487
|
+
case "forbidden":
|
|
488
|
+
return "\u4F60\u6CA1\u6709\u6743\u9650\u7ED9\u8FD9\u4E2A\u7A7A\u95F4\u6DFB\u52A0\u6210\u5458";
|
|
489
|
+
case "not_found":
|
|
490
|
+
return "\u7A7A\u95F4\u4E0D\u5B58\u5728\u6216\u5DF2\u88AB\u5220\u9664";
|
|
491
|
+
case "invalid_input":
|
|
492
|
+
return "\u52A0\u6210\u5458\u53C2\u6570\u4E0D\u5B8C\u6574";
|
|
493
|
+
default:
|
|
494
|
+
return fallback;
|
|
495
|
+
}
|
|
496
|
+
};
|
|
497
|
+
var submitAddSpaceMember = async (options) => {
|
|
498
|
+
const { token, servers } = selectSpaceRemoteAuth(options.state);
|
|
499
|
+
if (!token || servers.length === 0) {
|
|
500
|
+
return {
|
|
501
|
+
ok: false,
|
|
502
|
+
code: "no-server",
|
|
503
|
+
message: "\u6CA1\u6709\u53EF\u7528\u7684\u670D\u52A1\u5668\uFF0C\u6210\u5458\u5173\u7CFB\u672A\u63D0\u4EA4"
|
|
504
|
+
};
|
|
505
|
+
}
|
|
506
|
+
const operationKey = `${options.spaceId}:${options.targetUserId}`;
|
|
507
|
+
const operationId = options.operationId ?? pendingOperations.get(operationKey) ?? newOperationId();
|
|
508
|
+
if (!options.operationId && !pendingOperations.has(operationKey)) {
|
|
509
|
+
pendingOperations.set(operationKey, operationId);
|
|
510
|
+
}
|
|
511
|
+
const timeoutMs = options.timeoutMs ?? ADD_SPACE_MEMBER_TIMEOUT_MS;
|
|
512
|
+
const doFetch = options.fetchImpl ?? fetch;
|
|
513
|
+
const controller = new AbortController();
|
|
514
|
+
const timer = setTimeout(() => controller.abort(), timeoutMs);
|
|
515
|
+
try {
|
|
516
|
+
const response = await doFetch(`${servers[0]}/rpc/addSpaceMember`, {
|
|
517
|
+
method: "POST",
|
|
518
|
+
headers: {
|
|
519
|
+
"Content-Type": "application/json",
|
|
520
|
+
Authorization: `Bearer ${token}`
|
|
521
|
+
},
|
|
522
|
+
body: JSON.stringify({
|
|
523
|
+
spaceId: options.spaceId,
|
|
524
|
+
targetUserId: options.targetUserId,
|
|
525
|
+
operationId,
|
|
526
|
+
...options.role ? { role: options.role } : null
|
|
527
|
+
}),
|
|
528
|
+
signal: controller.signal
|
|
529
|
+
});
|
|
530
|
+
if (!response.ok) {
|
|
531
|
+
const payload = await response.json().catch(() => null);
|
|
532
|
+
const raw = payload && typeof payload === "object" ? payload : null;
|
|
533
|
+
pendingOperations.delete(operationKey);
|
|
534
|
+
return {
|
|
535
|
+
ok: false,
|
|
536
|
+
code: "rejected",
|
|
537
|
+
message: messageForErrorCode(
|
|
538
|
+
raw?.code,
|
|
539
|
+
raw?.message || "\u670D\u52A1\u7AEF\u62D2\u7EDD\u4E86\u8FD9\u6B21\u52A0\u6210\u5458\u64CD\u4F5C"
|
|
540
|
+
)
|
|
541
|
+
};
|
|
542
|
+
}
|
|
543
|
+
const result = await response.json();
|
|
544
|
+
pendingOperations.delete(operationKey);
|
|
545
|
+
return { ok: true, result };
|
|
546
|
+
} catch (error) {
|
|
547
|
+
return {
|
|
548
|
+
ok: false,
|
|
549
|
+
code: "unconfirmed",
|
|
550
|
+
message: `\u6210\u5458\u5173\u7CFB\u63D0\u4EA4\u7ED3\u679C\u672A\u786E\u8BA4\uFF08${operationId}\uFF09\uFF1A\u7F51\u7EDC\u6216\u670D\u52A1\u7AEF\u672A\u5728\u65F6\u9650\u5185\u54CD\u5E94\uFF0C\u8BF7\u91CD\u8BD5`
|
|
551
|
+
};
|
|
552
|
+
} finally {
|
|
553
|
+
clearTimeout(timer);
|
|
554
|
+
}
|
|
555
|
+
};
|
|
556
|
+
|
|
489
557
|
// packages/create/space/member/addMemberAction.ts
|
|
490
558
|
var addMemberAction = async (input, thunkAPI) => {
|
|
491
559
|
const { spaceId, memberId, role = "member" /* MEMBER */ } = input;
|
|
@@ -515,9 +583,6 @@ var addMemberAction = async (input, thunkAPI) => {
|
|
|
515
583
|
members: [...spaceData.members, resolvedMemberId],
|
|
516
584
|
updatedAt: Date.now()
|
|
517
585
|
};
|
|
518
|
-
await dispatch(
|
|
519
|
-
write({ data: updatedSpaceData, customKey: spaceKey })
|
|
520
|
-
).unwrap();
|
|
521
586
|
const now = Date.now();
|
|
522
587
|
const spaceMemberData = {
|
|
523
588
|
userId: resolvedMemberId,
|
|
@@ -534,6 +599,44 @@ var addMemberAction = async (input, thunkAPI) => {
|
|
|
534
599
|
// 添加 type 字段
|
|
535
600
|
};
|
|
536
601
|
const spaceMemberKey = createSpaceKey.member(resolvedMemberId, spaceId);
|
|
602
|
+
if (currentUserId && !isDeviceLocalOwnerId(currentUserId)) {
|
|
603
|
+
const submitted = await submitAddSpaceMember({
|
|
604
|
+
spaceId,
|
|
605
|
+
targetUserId: resolvedMemberId,
|
|
606
|
+
role,
|
|
607
|
+
state
|
|
608
|
+
});
|
|
609
|
+
if (!submitted.ok) {
|
|
610
|
+
throw new Error(submitted.message);
|
|
611
|
+
}
|
|
612
|
+
const authoritativeSpace = submitted.result?.space ?? updatedSpaceData;
|
|
613
|
+
applyFetchSpaceFulfilled({ spaceId, spaceData: authoritativeSpace });
|
|
614
|
+
if (db) {
|
|
615
|
+
try {
|
|
616
|
+
await db.put(
|
|
617
|
+
spaceKey,
|
|
618
|
+
normalizeTimeFields({
|
|
619
|
+
...authoritativeSpace,
|
|
620
|
+
dbKey: spaceKey,
|
|
621
|
+
userId: currentUserId
|
|
622
|
+
})
|
|
623
|
+
);
|
|
624
|
+
} catch (error) {
|
|
625
|
+
logger.warn(
|
|
626
|
+
{ error },
|
|
627
|
+
"[addMemberAction] \u672C\u5730\u5E94\u7528\u670D\u52A1\u7AEF\u8FD4\u56DE\u7684\u7A7A\u95F4\u6570\u636E\u5931\u8D25"
|
|
628
|
+
);
|
|
629
|
+
}
|
|
630
|
+
}
|
|
631
|
+
const returnedMembership = submitted.result?.membership;
|
|
632
|
+
if (returnedMembership && returnedMembership.userId === currentUserId) {
|
|
633
|
+
addMemberSpace(returnedMembership);
|
|
634
|
+
}
|
|
635
|
+
return { spaceId, updatedSpaceData: authoritativeSpace };
|
|
636
|
+
}
|
|
637
|
+
await dispatch(
|
|
638
|
+
write({ data: updatedSpaceData, customKey: spaceKey })
|
|
639
|
+
).unwrap();
|
|
537
640
|
await dispatch(
|
|
538
641
|
write({
|
|
539
642
|
data: spaceMemberData,
|