@awiki/dsh-plugin 0.3.11-rc.3 → 0.3.12
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/lib/client.js +118 -50
- package/lib/client.js.map +1 -1
- package/lib/index.js +162 -36
- package/lib/provider.js +2 -2
- package/lib/{sdk-adapter-DpqT2en9.mjs → sdk-adapter-DFDY7Hih.mjs} +19 -2
- package/lib/typert.host.js +10 -0
- package/lib/typert.remote-client.js +10 -0
- package/lib/types/client/AwikiUpdates.d.ts.map +1 -1
- package/lib/types/client/AwikiUpdates.js +21 -10
- package/lib/types/client/AwikiUpdates.js.map +1 -1
- package/lib/types/client/controller.js +1 -1
- package/lib/types/client/controller.js.map +1 -1
- package/lib/types/client/settings-controller.d.ts +1 -0
- package/lib/types/client/settings-controller.d.ts.map +1 -1
- package/lib/types/client/settings-controller.js +24 -10
- package/lib/types/client/settings-controller.js.map +1 -1
- package/lib/types/client/settings-locales.d.ts +1 -1
- package/lib/types/client/settings-locales.d.ts.map +1 -1
- package/lib/types/client/settings-locales.js +10 -4
- package/lib/types/client/settings-locales.js.map +1 -1
- package/lib/types/desktop-distribution.d.ts +7 -3
- package/lib/types/desktop-distribution.d.ts.map +1 -1
- package/lib/types/desktop-distribution.js +27 -8
- package/lib/types/desktop-distribution.js.map +1 -1
- package/lib/types/index.d.ts +1 -1
- package/lib/types/index.d.ts.map +1 -1
- package/lib/types/index.js +20 -13
- package/lib/types/index.js.map +1 -1
- package/lib/types/listener.js +1 -1
- package/lib/types/listener.js.map +1 -1
- package/lib/types/message-target.d.ts +4 -0
- package/lib/types/message-target.d.ts.map +1 -0
- package/lib/types/message-target.js +14 -0
- package/lib/types/message-target.js.map +1 -0
- package/lib/types/package-version.generated.d.ts +2 -2
- package/lib/types/package-version.generated.d.ts.map +1 -1
- package/lib/types/package-version.generated.js +2 -2
- package/lib/types/package-version.generated.js.map +1 -1
- package/lib/types/provider.js +1 -1
- package/lib/types/provider.js.map +1 -1
- package/lib/types/sdk-adapter.d.ts.map +1 -1
- package/lib/types/sdk-adapter.js +7 -1
- package/lib/types/sdk-adapter.js.map +1 -1
- package/lib/types/settings-rpc-contract.d.ts +1 -0
- package/lib/types/settings-rpc-contract.d.ts.map +1 -1
- package/lib/types/settings-rpc-contract.js +2 -0
- package/lib/types/settings-rpc-contract.js.map +1 -1
- package/lib/types/types.d.ts +8 -1
- package/lib/types/types.d.ts.map +1 -1
- package/lib/types/types.js.map +1 -1
- package/lib/types/update-installation.d.ts +18 -0
- package/lib/types/update-installation.d.ts.map +1 -0
- package/lib/types/update-installation.js +101 -0
- package/lib/types/update-installation.js.map +1 -0
- package/lib/types/update-policy.d.ts +5 -2
- package/lib/types/update-policy.d.ts.map +1 -1
- package/lib/types/update-policy.js +14 -8
- package/lib/types/update-policy.js.map +1 -1
- package/package.json +74 -77
package/lib/client.js
CHANGED
|
@@ -8286,13 +8286,22 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
8286
8286
|
}).readonly()
|
|
8287
8287
|
})]);
|
|
8288
8288
|
const _awiki_dsh_plugin_awiki_sendAttachment_parameter_0$schema = object({
|
|
8289
|
-
"target": union([
|
|
8290
|
-
|
|
8291
|
-
|
|
8292
|
-
|
|
8293
|
-
|
|
8294
|
-
|
|
8295
|
-
|
|
8289
|
+
"target": union([
|
|
8290
|
+
object({
|
|
8291
|
+
"kind": literal("direct").readonly(),
|
|
8292
|
+
"peer": string().readonly(),
|
|
8293
|
+
"conversationId": never().readonly().optional()
|
|
8294
|
+
}),
|
|
8295
|
+
object({
|
|
8296
|
+
"kind": literal("direct").readonly(),
|
|
8297
|
+
"conversationId": intersection(string(), unknown()).readonly(),
|
|
8298
|
+
"peer": never().readonly().optional()
|
|
8299
|
+
}),
|
|
8300
|
+
object({
|
|
8301
|
+
"kind": literal("group").readonly(),
|
|
8302
|
+
"group": string().readonly()
|
|
8303
|
+
})
|
|
8304
|
+
]).readonly(),
|
|
8296
8305
|
"fileName": string().readonly(),
|
|
8297
8306
|
"mimeType": string().readonly(),
|
|
8298
8307
|
"bytesBase64": string().readonly(),
|
|
@@ -8622,13 +8631,22 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
8622
8631
|
}).readonly()
|
|
8623
8632
|
})]);
|
|
8624
8633
|
const _awiki_dsh_plugin_awiki_sendText_parameter_0$schema = object({
|
|
8625
|
-
"target": union([
|
|
8626
|
-
|
|
8627
|
-
|
|
8628
|
-
|
|
8629
|
-
|
|
8630
|
-
|
|
8631
|
-
|
|
8634
|
+
"target": union([
|
|
8635
|
+
object({
|
|
8636
|
+
"kind": literal("direct").readonly(),
|
|
8637
|
+
"peer": string().readonly(),
|
|
8638
|
+
"conversationId": never().readonly().optional()
|
|
8639
|
+
}),
|
|
8640
|
+
object({
|
|
8641
|
+
"kind": literal("direct").readonly(),
|
|
8642
|
+
"conversationId": intersection(string(), unknown()).readonly(),
|
|
8643
|
+
"peer": never().readonly().optional()
|
|
8644
|
+
}),
|
|
8645
|
+
object({
|
|
8646
|
+
"kind": literal("group").readonly(),
|
|
8647
|
+
"group": string().readonly()
|
|
8648
|
+
})
|
|
8649
|
+
]).readonly(),
|
|
8632
8650
|
"text": string().readonly(),
|
|
8633
8651
|
"idempotencyKey": string().readonly(),
|
|
8634
8652
|
"mentions": array(object({
|
|
@@ -13294,7 +13312,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
13294
13312
|
function targetOf(conversation) {
|
|
13295
13313
|
return conversation.kind === "direct" ? {
|
|
13296
13314
|
kind: "direct",
|
|
13297
|
-
|
|
13315
|
+
conversationId: conversation.id
|
|
13298
13316
|
} : {
|
|
13299
13317
|
kind: "group",
|
|
13300
13318
|
group: conversation.groupDid
|
|
@@ -20853,6 +20871,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
20853
20871
|
function AwikiUpdates(props) {
|
|
20854
20872
|
const { snapshot, t } = props;
|
|
20855
20873
|
const desktop = snapshot.desktop;
|
|
20874
|
+
const scopedDesktop = desktop?.schemaVersion === 2 && !snapshot.value.switching && desktop.tenantId === snapshot.value.activeTenantId && desktop.tenantGeneration === snapshot.value.generation && desktop.policyOrigin === snapshot.value.tenants.find((tenant) => tenant.tenantId === snapshot.value.activeTenantId)?.backendBaseUrl;
|
|
20856
20875
|
const busy = snapshot.updateStatus === "loading" || snapshot.desktopStatus === "loading";
|
|
20857
20876
|
return (0, react_jsx_runtime.jsxs)("div", {
|
|
20858
20877
|
className: _dsh_awiki_css_AwikiSettingsSection_module_css_default.panel,
|
|
@@ -20884,9 +20903,9 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
20884
20903
|
(0, react_jsx_runtime.jsx)("p", {
|
|
20885
20904
|
className: _dsh_awiki_css_AwikiSettingsSection_module_css_default.description,
|
|
20886
20905
|
role: "status",
|
|
20887
|
-
children: t(snapshot.desktopStatus === "unavailable" || desktop.state === "failed" ? "updateFailed" : desktop.state === "checking" || snapshot.desktopStatus === "loading" ? "updateLoading" : desktop.state === "unchecked" ? "updateUnchecked" : desktop.noRelease ? "desktopNoRelease" : desktop.updateAvailable ? "updateAvailable" : "updateLatest", { version: desktop.latestVersion })
|
|
20906
|
+
children: t(desktop.schemaVersion === 1 ? "desktopLegacyUpdate" : snapshot.value.switching ? "tenantSwitching" : desktop.state === "unavailable" ? "updateNoPolicy" : snapshot.desktopStatus === "unavailable" || desktop.state === "failed" ? "updateFailed" : desktop.state === "checking" || snapshot.desktopStatus === "loading" ? "updateLoading" : desktop.state === "unchecked" ? "updateUnchecked" : desktop.noRelease ? "desktopNoRelease" : desktop.updateAvailable ? "updateAvailable" : "updateLatest", { version: desktop.latestVersion })
|
|
20888
20907
|
}),
|
|
20889
|
-
desktop.latestVersion !== void 0 && !desktop.noRelease && (0, react_jsx_runtime.jsx)("p", {
|
|
20908
|
+
scopedDesktop && desktop.updateAvailable && desktop.latestVersion !== void 0 && !desktop.noRelease && (0, react_jsx_runtime.jsx)("p", {
|
|
20890
20909
|
className: _dsh_awiki_css_AwikiSettingsSection_module_css_default.description,
|
|
20891
20910
|
children: t("updateRecommended", { version: desktop.latestVersion })
|
|
20892
20911
|
}),
|
|
@@ -20898,16 +20917,15 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
20898
20917
|
className: _dsh_awiki_css_AwikiSettingsSection_module_css_default.description,
|
|
20899
20918
|
children: t("desktopInstallHelp")
|
|
20900
20919
|
}),
|
|
20901
|
-
(0, react_jsx_runtime.jsx)("a", {
|
|
20920
|
+
scopedDesktop && desktop.downloadPageUrl !== void 0 && (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [(0, react_jsx_runtime.jsx)("a", {
|
|
20902
20921
|
href: desktop.downloadPageUrl,
|
|
20903
20922
|
target: "_blank",
|
|
20904
20923
|
rel: "noopener noreferrer",
|
|
20905
20924
|
children: t("desktopDownloadPage")
|
|
20906
|
-
}),
|
|
20907
|
-
(0, react_jsx_runtime.jsx)("code", {
|
|
20925
|
+
}), (0, react_jsx_runtime.jsx)("code", {
|
|
20908
20926
|
className: _dsh_awiki_css_AwikiSettingsSection_module_css_default.updateCommand,
|
|
20909
20927
|
children: desktop.downloadPageUrl
|
|
20910
|
-
})
|
|
20928
|
+
})] })
|
|
20911
20929
|
]
|
|
20912
20930
|
}),
|
|
20913
20931
|
(0, react_jsx_runtime.jsx)(PluginUpdate, { ...props }, `${snapshot.value.activeTenantId}:${snapshot.value.generation}:${snapshot.update?.upgradeCommand ?? ""}:${desktop?.distributionId ?? ""}`)
|
|
@@ -20917,15 +20935,16 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
20917
20935
|
function PluginUpdate({ snapshot, t }) {
|
|
20918
20936
|
const [copyState, setCopyState] = (0, react.useState)("idle");
|
|
20919
20937
|
const tenant = snapshot.value.tenants.find((value) => value.tenantId === snapshot.value.activeTenantId);
|
|
20920
|
-
const update = snapshot.update?.tenantId === snapshot.value.activeTenantId ? snapshot.update : void 0;
|
|
20938
|
+
const update = snapshot.update?.tenantId === snapshot.value.activeTenantId && snapshot.update.tenantGeneration === snapshot.value.generation ? snapshot.update : void 0;
|
|
20921
20939
|
const desktop = snapshot.desktop;
|
|
20922
|
-
const
|
|
20940
|
+
const isDesktop = desktop !== void 0 || snapshot.desktopPresent === true;
|
|
20941
|
+
const command = !isDesktop && snapshot.desktopStatus === "ready" ? update?.upgradeCommand?.replace(/^dsh plugin add /u, "dsh plugin --profile YOUR_PROFILE add ") : void 0;
|
|
20923
20942
|
const switching = snapshot.value.switching;
|
|
20924
20943
|
const state = update?.checkState ?? (update === void 0 ? "unchecked" : update.offline ? "failed" : update.policyUnavailable ? "unavailable" : "ready");
|
|
20925
20944
|
let desktopResolves = false;
|
|
20926
20945
|
try {
|
|
20927
20946
|
const bundled = desktop?.bundledVersions;
|
|
20928
|
-
desktopResolves = desktop?.updateAvailable === true && bundled !== void 0 && update?.recommendedPluginVersion !== void 0 && compareVersions(bundled.plugin, update.recommendedPluginVersion) >= 0 && (update.currentModelProxyVersion === void 0 || update.recommendedModelProxyVersion !== void 0 && bundled.modelProxy !== void 0 && compareVersions(bundled.modelProxy, update.recommendedModelProxyVersion) >= 0);
|
|
20947
|
+
desktopResolves = !switching && desktop?.schemaVersion === 2 && desktop.tenantId === snapshot.value.activeTenantId && desktop.tenantGeneration === snapshot.value.generation && desktop.policyOrigin === tenant?.backendBaseUrl && desktop.updateAvailable === true && bundled !== void 0 && update?.recommendedPluginVersion !== void 0 && compareVersions(bundled.plugin, update.recommendedPluginVersion) >= 0 && (update.currentModelProxyVersion === void 0 || update.recommendedModelProxyVersion !== void 0 && bundled.modelProxy !== void 0 && compareVersions(bundled.modelProxy, update.recommendedModelProxyVersion) >= 0);
|
|
20929
20948
|
} catch {}
|
|
20930
20949
|
const copy = async () => {
|
|
20931
20950
|
if (command === void 0 || switching) return;
|
|
@@ -20949,7 +20968,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
20949
20968
|
}),
|
|
20950
20969
|
(0, react_jsx_runtime.jsx)("p", {
|
|
20951
20970
|
className: _dsh_awiki_css_AwikiSettingsSection_module_css_default.description,
|
|
20952
|
-
children: t("updateCurrent", { version: update?.currentPluginVersion ?? "0.3.
|
|
20971
|
+
children: t("updateCurrent", { version: update?.currentPluginVersion ?? "0.3.12" })
|
|
20953
20972
|
}),
|
|
20954
20973
|
update !== void 0 && (0, react_jsx_runtime.jsx)(react_jsx_runtime.Fragment, { children: update.currentModelProxyVersion !== void 0 && (0, react_jsx_runtime.jsx)("p", {
|
|
20955
20974
|
className: _dsh_awiki_css_AwikiSettingsSection_module_css_default.description,
|
|
@@ -20986,13 +21005,13 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
20986
21005
|
className: _dsh_awiki_css_AwikiSettingsSection_module_css_default.description,
|
|
20987
21006
|
children: t("updateCached")
|
|
20988
21007
|
}),
|
|
20989
|
-
|
|
21008
|
+
isDesktop && (0, react_jsx_runtime.jsx)("p", {
|
|
20990
21009
|
className: _dsh_awiki_css_AwikiSettingsSection_module_css_default.description,
|
|
20991
21010
|
children: t(desktopResolves ? "desktopResolvesPlugin" : "desktopPluginHelp")
|
|
20992
21011
|
}),
|
|
20993
|
-
state === "ready" && update?.updateAvailable && command === void 0 && (0, react_jsx_runtime.jsx)("p", {
|
|
21012
|
+
!isDesktop && state === "ready" && update?.updateAvailable && command === void 0 && (0, react_jsx_runtime.jsx)("p", {
|
|
20994
21013
|
className: _dsh_awiki_css_AwikiSettingsSection_module_css_default.description,
|
|
20995
|
-
children: t("updateNoCommand")
|
|
21014
|
+
children: t(update.upgradeBlockedReason === "host-incompatible" ? "updateHostRequired" : update.upgradeBlockedReason === "identity-incompatible" ? "updateIdentityIncompatible" : "updateNoCommand")
|
|
20996
21015
|
}),
|
|
20997
21016
|
command !== void 0 && !switching && (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
|
|
20998
21017
|
(0, react_jsx_runtime.jsx)("code", {
|
|
@@ -22467,7 +22486,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
22467
22486
|
}
|
|
22468
22487
|
var produce = new Immer2().produce;
|
|
22469
22488
|
//#endregion
|
|
22470
|
-
//#region node_modules/.pnpm/@deepseek-ai+dsh-client-store@0.1.5-rc.
|
|
22489
|
+
//#region node_modules/.pnpm/@deepseek-ai+dsh-client-store@0.1.5-rc.2_@deepseek-ai+cordis@4.0.2/node_modules/@deepseek-ai/dsh-client-store/lib/index.js
|
|
22471
22490
|
/**
|
|
22472
22491
|
* React-free snapshot store engine (zustand vanilla + immer + subscribeWithSelector +
|
|
22473
22492
|
* rafFlush middleware + opt-in persist + dev freeze) plus the declarative
|
|
@@ -22726,7 +22745,10 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
22726
22745
|
desktopNoRelease: "暂未发布适用于当前发行通道的更新。",
|
|
22727
22746
|
updateAvailable: "有可用更新。",
|
|
22728
22747
|
updateRequired: "当前组件版本不满足服务要求,请升级或切换服务。",
|
|
22729
|
-
updateNoCommand: "
|
|
22748
|
+
updateNoCommand: "当前租户未提供完整的安装兼容信息,请查看安装说明。",
|
|
22749
|
+
updateHostRequired: "当前 DSH 宿主与推荐插件不兼容,请先按安装说明升级 DSH。",
|
|
22750
|
+
updateIdentityIncompatible: "当前 Identity 插件与推荐组合不兼容,请查看安装说明;不会自动降级。",
|
|
22751
|
+
desktopLegacyUpdate: "当前桌面版不支持按租户检查更新,请从当前租户的网站获取新版安装包。",
|
|
22730
22752
|
updateCopied: "已复制升级命令。",
|
|
22731
22753
|
updateCopyFailed: "复制失败,请选中上方命令手动复制。",
|
|
22732
22754
|
updateGuide: "查看发布与安装说明",
|
|
@@ -22735,7 +22757,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
22735
22757
|
desktopUpdateTitle: "DSH Desktop · AWiki",
|
|
22736
22758
|
desktopDownloadPage: "前往桌面版下载页面",
|
|
22737
22759
|
desktopInstallHelp: "选择适合电脑的完整安装包,完成安装后重新打开应用。",
|
|
22738
|
-
desktopPluginHelp: "
|
|
22760
|
+
desktopPluginHelp: "桌面版通过完整安装包升级内置组件。当前租户未提供能够满足推荐组件要求的整包更新时,请等待兼容版本。",
|
|
22739
22761
|
desktopResolvesPlugin: "此桌面更新包含满足当前服务推荐版本要求的插件组件。",
|
|
22740
22762
|
updateModelRestricted: "当前模型组件低于最低支持版本 {minimum},AWiki 模型服务暂不可用。",
|
|
22741
22763
|
updateTitle: "插件更新",
|
|
@@ -22847,7 +22869,10 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
22847
22869
|
desktopNoRelease: "No release is currently available for this channel.",
|
|
22848
22870
|
updateAvailable: "An update is available.",
|
|
22849
22871
|
updateRequired: "Your component version is unsupported. Update or switch services.",
|
|
22850
|
-
updateNoCommand: "This
|
|
22872
|
+
updateNoCommand: "This tenant has not provided complete installation compatibility information. Read the installation guide.",
|
|
22873
|
+
updateHostRequired: "The recommended plugin requires a different DSH host. Upgrade DSH using the installation guide first.",
|
|
22874
|
+
updateIdentityIncompatible: "The installed Identity plugin is incompatible with the recommended combination. Read the installation guide; no downgrade is performed.",
|
|
22875
|
+
desktopLegacyUpdate: "This Desktop version does not support tenant-scoped updates. Get a newer installer from your current tenant’s website.",
|
|
22851
22876
|
updateCopied: "Upgrade command copied.",
|
|
22852
22877
|
updateCopyFailed: "Copy failed. Select the command above and copy it manually.",
|
|
22853
22878
|
updateGuide: "Release and installation guide",
|
|
@@ -22856,7 +22881,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
22856
22881
|
desktopUpdateTitle: "DSH Desktop · AWiki",
|
|
22857
22882
|
desktopDownloadPage: "Visit Desktop Download Page",
|
|
22858
22883
|
desktopInstallHelp: "Choose the full installer for your computer, install it, then reopen the app.",
|
|
22859
|
-
desktopPluginHelp: "
|
|
22884
|
+
desktopPluginHelp: "Upgrade bundled components using a complete Desktop installer. If this tenant has no suitable installer, wait for a compatible release.",
|
|
22860
22885
|
desktopResolvesPlugin: "This Desktop update includes components meeting the current service’s recommended versions.",
|
|
22861
22886
|
updateModelRestricted: "The model component is below the minimum version {minimum}; the AWiki model service is unavailable.",
|
|
22862
22887
|
updateTitle: "Plugin updates",
|
|
@@ -22902,18 +22927,34 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
22902
22927
|
function decodeDesktopDistribution(value) {
|
|
22903
22928
|
if (typeof value !== "object" || value === null) return void 0;
|
|
22904
22929
|
const view = value;
|
|
22905
|
-
if (view.schemaVersion !== 1 || view.distributionId !== "awiki-dsh-desktop" || typeof view.currentVersion !== "string" || view.channel !== "stable" && view.channel !== "prerelease" || typeof view.downloadPageUrl !== "string" || ![
|
|
22930
|
+
if (view.schemaVersion !== 1 && view.schemaVersion !== 2 || view.distributionId !== "awiki-dsh-desktop" || typeof view.currentVersion !== "string" || view.channel !== "stable" && view.channel !== "prerelease" || view.downloadPageUrl !== void 0 && typeof view.downloadPageUrl !== "string" || ![
|
|
22906
22931
|
"unchecked",
|
|
22907
22932
|
"checking",
|
|
22908
22933
|
"ready",
|
|
22909
|
-
"failed"
|
|
22934
|
+
"failed",
|
|
22935
|
+
"unavailable"
|
|
22910
22936
|
].includes(String(view.state)) || typeof view.updateAvailable !== "boolean" || typeof view.usedCache !== "boolean" || view.latestVersion !== void 0 && typeof view.latestVersion !== "string" || view.checkedAt !== void 0 && typeof view.checkedAt !== "string" || view.noRelease !== void 0 && typeof view.noRelease !== "boolean") return void 0;
|
|
22911
22937
|
try {
|
|
22912
22938
|
assertVersion(view.currentVersion);
|
|
22939
|
+
if (view.schemaVersion === 1) return {
|
|
22940
|
+
schemaVersion: 1,
|
|
22941
|
+
distributionId: "awiki-dsh-desktop",
|
|
22942
|
+
currentVersion: view.currentVersion,
|
|
22943
|
+
channel: view.channel,
|
|
22944
|
+
state: "unavailable",
|
|
22945
|
+
updateAvailable: false,
|
|
22946
|
+
usedCache: false
|
|
22947
|
+
};
|
|
22948
|
+
const hasTenant = view.tenantId !== void 0 || view.policyOrigin !== void 0 || view.tenantGeneration !== void 0;
|
|
22949
|
+
if (hasTenant && (typeof view.tenantId !== "string" || view.tenantId.length === 0 || typeof view.policyOrigin !== "string" || new URL(view.policyOrigin).origin !== view.policyOrigin || new URL(view.policyOrigin).protocol !== "https:" || !Number.isSafeInteger(view.tenantGeneration) || view.tenantGeneration < 0)) return void 0;
|
|
22950
|
+
if (!hasTenant && view.state !== "unavailable") return void 0;
|
|
22951
|
+
if (view.policyRevision !== void 0 && (!Number.isSafeInteger(view.policyRevision) || view.policyRevision < 1)) return void 0;
|
|
22913
22952
|
if (view.latestVersion !== void 0) assertVersion(view.latestVersion);
|
|
22914
22953
|
if (view.checkedAt !== void 0 && !Number.isFinite(Date.parse(view.checkedAt))) return void 0;
|
|
22915
|
-
|
|
22916
|
-
|
|
22954
|
+
if (typeof view.downloadPageUrl === "string") {
|
|
22955
|
+
const url = new URL(view.downloadPageUrl);
|
|
22956
|
+
if (url.protocol !== "https:" || url.username !== "" || url.password !== "" || url.origin !== view.policyOrigin) return void 0;
|
|
22957
|
+
}
|
|
22917
22958
|
} catch {
|
|
22918
22959
|
return;
|
|
22919
22960
|
}
|
|
@@ -22934,11 +22975,17 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
22934
22975
|
};
|
|
22935
22976
|
}
|
|
22936
22977
|
return {
|
|
22937
|
-
schemaVersion:
|
|
22978
|
+
schemaVersion: 2,
|
|
22938
22979
|
distributionId: "awiki-dsh-desktop",
|
|
22939
22980
|
currentVersion: view.currentVersion,
|
|
22940
22981
|
channel: view.channel,
|
|
22941
|
-
downloadPageUrl: view.downloadPageUrl,
|
|
22982
|
+
...typeof view.downloadPageUrl === "string" ? { downloadPageUrl: view.downloadPageUrl } : {},
|
|
22983
|
+
...typeof view.tenantId === "string" ? {
|
|
22984
|
+
tenantId: view.tenantId,
|
|
22985
|
+
policyOrigin: view.policyOrigin,
|
|
22986
|
+
tenantGeneration: view.tenantGeneration
|
|
22987
|
+
} : {},
|
|
22988
|
+
...typeof view.policyRevision === "number" ? { policyRevision: view.policyRevision } : {},
|
|
22942
22989
|
state: view.state,
|
|
22943
22990
|
updateAvailable: view.updateAvailable,
|
|
22944
22991
|
usedCache: view.usedCache,
|
|
@@ -23060,6 +23107,11 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
23060
23107
|
"failed"
|
|
23061
23108
|
].includes(String(value.checkState))) return void 0;
|
|
23062
23109
|
if (value.updateAvailable !== void 0 && typeof value.updateAvailable !== "boolean") return void 0;
|
|
23110
|
+
if (value.upgradeBlockedReason !== void 0 && ![
|
|
23111
|
+
"installation-unverified",
|
|
23112
|
+
"host-incompatible",
|
|
23113
|
+
"identity-incompatible"
|
|
23114
|
+
].includes(String(value.upgradeBlockedReason))) return void 0;
|
|
23063
23115
|
return value;
|
|
23064
23116
|
}
|
|
23065
23117
|
//#endregion
|
|
@@ -23108,7 +23160,8 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
23108
23160
|
this.tenantSnapshot = {
|
|
23109
23161
|
status: connection.isLoopback ? "loading" : "unavailable",
|
|
23110
23162
|
value: INITIAL_TENANTS,
|
|
23111
|
-
updateStatus: connection.isLoopback ? "loading" : "unavailable"
|
|
23163
|
+
updateStatus: connection.isLoopback ? "loading" : "unavailable",
|
|
23164
|
+
desktopStatus: connection.isLoopback ? "loading" : "unavailable"
|
|
23112
23165
|
};
|
|
23113
23166
|
this.disposeGeneration = connection.isLoopback ? connection.generation.subscribe(() => {
|
|
23114
23167
|
this.load();
|
|
@@ -23190,14 +23243,19 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
23190
23243
|
const value = result.ok ? decodeAwikiTenantRpcView(result.value) : void 0;
|
|
23191
23244
|
if (value === void 0) throw new Error("AWiki tenant catalog is unavailable");
|
|
23192
23245
|
const changed = value.activeTenantId !== this.tenantSnapshot.value.activeTenantId || value.generation !== this.tenantSnapshot.value.generation;
|
|
23193
|
-
if (changed)
|
|
23246
|
+
if (changed) {
|
|
23247
|
+
this.updateRequestVersion++;
|
|
23248
|
+
this.desktopRequestVersion++;
|
|
23249
|
+
}
|
|
23194
23250
|
this.publishTenants({
|
|
23195
23251
|
...this.tenantSnapshot,
|
|
23196
23252
|
status: "ready",
|
|
23197
23253
|
value,
|
|
23198
23254
|
...changed ? {
|
|
23199
23255
|
update: void 0,
|
|
23200
|
-
updateStatus: "loading"
|
|
23256
|
+
updateStatus: "loading",
|
|
23257
|
+
desktop: void 0,
|
|
23258
|
+
desktopStatus: "loading"
|
|
23201
23259
|
} : {}
|
|
23202
23260
|
});
|
|
23203
23261
|
} catch {
|
|
@@ -23235,7 +23293,9 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
23235
23293
|
}
|
|
23236
23294
|
}
|
|
23237
23295
|
async loadDesktopUpdate(refresh = false) {
|
|
23238
|
-
if (!this.connection.isLoopback || this.disposed) return;
|
|
23296
|
+
if (!this.connection.isLoopback || this.disposed || this.tenantSnapshot.value.switching) return;
|
|
23297
|
+
const tenantId = this.tenantSnapshot.value.activeTenantId;
|
|
23298
|
+
const generation = this.tenantSnapshot.value.generation;
|
|
23239
23299
|
const request = ++this.desktopRequestVersion;
|
|
23240
23300
|
if (refresh) this.publishTenants({
|
|
23241
23301
|
...this.tenantSnapshot,
|
|
@@ -23243,14 +23303,19 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
23243
23303
|
});
|
|
23244
23304
|
try {
|
|
23245
23305
|
const result = await this.connection.rpc.call(AWIKI_SETTINGS_RPC_CHANNEL, refresh ? AWIKI_SETTINGS_RPC_ENDPOINTS.refreshDesktopUpdate : AWIKI_SETTINGS_RPC_ENDPOINTS.describeDesktopUpdate, {}, this.abort.signal);
|
|
23246
|
-
if (this.disposed || request !== this.desktopRequestVersion) return;
|
|
23306
|
+
if (this.disposed || request !== this.desktopRequestVersion || tenantId !== this.tenantSnapshot.value.activeTenantId || generation !== this.tenantSnapshot.value.generation) return;
|
|
23247
23307
|
if (!result.ok) throw new Error("Desktop update service unavailable");
|
|
23248
23308
|
const desktop = result.value === null ? void 0 : decodeDesktopDistribution(result.value);
|
|
23249
23309
|
if (result.value !== null && desktop === void 0) throw new Error("Invalid Desktop update response");
|
|
23310
|
+
if (desktop?.schemaVersion === 2 && desktop.tenantId !== void 0) {
|
|
23311
|
+
const tenant = this.tenantSnapshot.value.tenants.find((value) => value.tenantId === tenantId);
|
|
23312
|
+
if (desktop.tenantId !== tenantId || desktop.tenantGeneration !== generation || desktop.policyOrigin !== tenant?.backendBaseUrl) throw new Error("Desktop update scope mismatch");
|
|
23313
|
+
}
|
|
23250
23314
|
this.publishTenants({
|
|
23251
23315
|
...this.tenantSnapshot,
|
|
23252
23316
|
desktopStatus: "ready",
|
|
23253
|
-
desktop
|
|
23317
|
+
desktop,
|
|
23318
|
+
desktopPresent: desktop !== void 0
|
|
23254
23319
|
});
|
|
23255
23320
|
} catch {
|
|
23256
23321
|
if (!this.disposed && request === this.desktopRequestVersion) this.publishTenants({
|
|
@@ -23351,12 +23416,15 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
23351
23416
|
if (switching) {
|
|
23352
23417
|
this.updateRequestVersion++;
|
|
23353
23418
|
this.tenantRequestVersion++;
|
|
23419
|
+
this.desktopRequestVersion++;
|
|
23354
23420
|
}
|
|
23355
23421
|
this.publishTenants({
|
|
23356
23422
|
...this.tenantSnapshot,
|
|
23357
23423
|
...switching ? {
|
|
23358
23424
|
update: void 0,
|
|
23359
|
-
updateStatus: "loading"
|
|
23425
|
+
updateStatus: "loading",
|
|
23426
|
+
desktop: void 0,
|
|
23427
|
+
desktopStatus: "loading"
|
|
23360
23428
|
} : {},
|
|
23361
23429
|
value: {
|
|
23362
23430
|
...this.tenantSnapshot.value,
|
|
@@ -23376,15 +23444,15 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
|
|
|
23376
23444
|
value
|
|
23377
23445
|
});
|
|
23378
23446
|
if (switching) {
|
|
23379
|
-
await this.loadUpdatePolicy();
|
|
23380
|
-
await this.loadUpdatePolicy(true);
|
|
23447
|
+
await Promise.all([this.loadUpdatePolicy(), this.loadDesktopUpdate()]);
|
|
23448
|
+
await Promise.all([this.loadUpdatePolicy(true), this.loadDesktopUpdate(true)]);
|
|
23381
23449
|
}
|
|
23382
23450
|
} catch (error) {
|
|
23383
23451
|
if (!this.disposed) {
|
|
23384
23452
|
await this.loadTenants();
|
|
23385
23453
|
if (switching) {
|
|
23386
|
-
await this.loadUpdatePolicy();
|
|
23387
|
-
this.
|
|
23454
|
+
await Promise.all([this.loadUpdatePolicy(), this.loadDesktopUpdate()]);
|
|
23455
|
+
this.refreshUpdatePolicy();
|
|
23388
23456
|
}
|
|
23389
23457
|
}
|
|
23390
23458
|
throw error;
|