@openvulcan/dsh-vulcancode 0.0.0-stage → 0.4.3
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/LICENSE +21 -0
- package/README.md +126 -2
- package/assets/openvulcan-icon.svg +33 -0
- package/cordis.patch.yml +19 -0
- package/node_modules/@openvulcan/dsh-decision-guard/LICENSE +21 -0
- package/node_modules/@openvulcan/dsh-decision-guard/README.md +14 -0
- package/node_modules/@openvulcan/dsh-decision-guard/assets/decision-guard-icon.png +0 -0
- package/node_modules/@openvulcan/dsh-decision-guard/lib/calls.d.ts +40 -0
- package/node_modules/@openvulcan/dsh-decision-guard/lib/calls.js +150 -0
- package/node_modules/@openvulcan/dsh-decision-guard/lib/client.js +2250 -0
- package/node_modules/@openvulcan/dsh-decision-guard/lib/decide.d.ts +90 -0
- package/node_modules/@openvulcan/dsh-decision-guard/lib/decide.js +108 -0
- package/node_modules/@openvulcan/dsh-decision-guard/lib/index.d.ts +129 -0
- package/node_modules/@openvulcan/dsh-decision-guard/lib/index.js +572 -0
- package/node_modules/@openvulcan/dsh-decision-guard/lib/intent.d.ts +22 -0
- package/node_modules/@openvulcan/dsh-decision-guard/lib/intent.js +77 -0
- package/node_modules/@openvulcan/dsh-decision-guard/lib/panel.d.ts +158 -0
- package/node_modules/@openvulcan/dsh-decision-guard/lib/panel.js +340 -0
- package/node_modules/@openvulcan/dsh-decision-guard/lib/records.d.ts +133 -0
- package/node_modules/@openvulcan/dsh-decision-guard/lib/records.js +186 -0
- package/node_modules/@openvulcan/dsh-decision-guard/lib/review.d.ts +55 -0
- package/node_modules/@openvulcan/dsh-decision-guard/lib/review.js +202 -0
- package/node_modules/@openvulcan/dsh-decision-guard/lib/session-state.d.ts +62 -0
- package/node_modules/@openvulcan/dsh-decision-guard/lib/session-state.js +155 -0
- package/node_modules/@openvulcan/dsh-decision-guard/lib/version.d.ts +2 -0
- package/node_modules/@openvulcan/dsh-decision-guard/lib/version.js +4 -0
- package/node_modules/@openvulcan/dsh-decision-guard/package.json +68 -0
- package/node_modules/@openvulcan/dsh-vulcan-account/LICENSE +21 -0
- package/node_modules/@openvulcan/dsh-vulcan-account/assets/account-icon.png +0 -0
- package/node_modules/@openvulcan/dsh-vulcan-account/lib/client.js +573 -0
- package/node_modules/@openvulcan/dsh-vulcan-account/lib/index.d.ts +92 -0
- package/node_modules/@openvulcan/dsh-vulcan-account/lib/index.js +194 -0
- package/node_modules/@openvulcan/dsh-vulcan-account/package.json +57 -0
- package/node_modules/@openvulcan/dsh-vulcan-answers/LICENSE +21 -0
- package/node_modules/@openvulcan/dsh-vulcan-answers/assets/answers-icon.png +0 -0
- package/node_modules/@openvulcan/dsh-vulcan-answers/assets/prompts/answer-mode-interactive.md +79 -0
- package/node_modules/@openvulcan/dsh-vulcan-answers/assets/prompts/answer-mode-standard.md +1 -0
- package/node_modules/@openvulcan/dsh-vulcan-answers/lib/answer-model.d.ts +258 -0
- package/node_modules/@openvulcan/dsh-vulcan-answers/lib/answer-model.js +698 -0
- package/node_modules/@openvulcan/dsh-vulcan-answers/lib/client.js +671 -0
- package/node_modules/@openvulcan/dsh-vulcan-answers/lib/fences.d.ts +29 -0
- package/node_modules/@openvulcan/dsh-vulcan-answers/lib/fences.js +70 -0
- package/node_modules/@openvulcan/dsh-vulcan-answers/lib/index.d.ts +19 -0
- package/node_modules/@openvulcan/dsh-vulcan-answers/lib/index.js +52 -0
- package/node_modules/@openvulcan/dsh-vulcan-answers/lib/limits.d.ts +9 -0
- package/node_modules/@openvulcan/dsh-vulcan-answers/lib/limits.js +9 -0
- package/node_modules/@openvulcan/dsh-vulcan-answers/lib/prompt.d.ts +22 -0
- package/node_modules/@openvulcan/dsh-vulcan-answers/lib/prompt.js +39 -0
- package/node_modules/@openvulcan/dsh-vulcan-answers/lib/reply-format.d.ts +20 -0
- package/node_modules/@openvulcan/dsh-vulcan-answers/lib/reply-format.js +17 -0
- package/node_modules/@openvulcan/dsh-vulcan-answers/lib/session-state.d.ts +66 -0
- package/node_modules/@openvulcan/dsh-vulcan-answers/lib/session-state.js +118 -0
- package/node_modules/@openvulcan/dsh-vulcan-answers/package.json +59 -0
- package/node_modules/@openvulcan/dsh-vulcan-luaskills/LICENSE +21 -0
- package/node_modules/@openvulcan/dsh-vulcan-luaskills/assets/luaskills-icon.svg +1 -0
- package/node_modules/@openvulcan/dsh-vulcan-luaskills/lib/client.js +949 -0
- package/node_modules/@openvulcan/dsh-vulcan-luaskills/lib/constants.d.ts +46 -0
- package/node_modules/@openvulcan/dsh-vulcan-luaskills/lib/constants.js +51 -0
- package/node_modules/@openvulcan/dsh-vulcan-luaskills/lib/engine.d.ts +55 -0
- package/node_modules/@openvulcan/dsh-vulcan-luaskills/lib/engine.js +149 -0
- package/node_modules/@openvulcan/dsh-vulcan-luaskills/lib/hub.d.ts +49 -0
- package/node_modules/@openvulcan/dsh-vulcan-luaskills/lib/hub.js +116 -0
- package/node_modules/@openvulcan/dsh-vulcan-luaskills/lib/index.d.ts +26 -0
- package/node_modules/@openvulcan/dsh-vulcan-luaskills/lib/index.js +276 -0
- package/node_modules/@openvulcan/dsh-vulcan-luaskills/lib/protocol.d.ts +65 -0
- package/node_modules/@openvulcan/dsh-vulcan-luaskills/lib/protocol.js +2 -0
- package/node_modules/@openvulcan/dsh-vulcan-luaskills/lib/runtime.d.ts +111 -0
- package/node_modules/@openvulcan/dsh-vulcan-luaskills/lib/runtime.js +281 -0
- package/node_modules/@openvulcan/dsh-vulcan-luaskills/lib/sdk-install.d.ts +26 -0
- package/node_modules/@openvulcan/dsh-vulcan-luaskills/lib/sdk-install.js +87 -0
- package/node_modules/@openvulcan/dsh-vulcan-luaskills/lib/settings.d.ts +79 -0
- package/node_modules/@openvulcan/dsh-vulcan-luaskills/lib/settings.js +165 -0
- package/node_modules/@openvulcan/dsh-vulcan-luaskills/lib/skills.d.ts +34 -0
- package/node_modules/@openvulcan/dsh-vulcan-luaskills/lib/skills.js +61 -0
- package/node_modules/@openvulcan/dsh-vulcan-luaskills/lib/tools.d.ts +59 -0
- package/node_modules/@openvulcan/dsh-vulcan-luaskills/lib/tools.js +107 -0
- package/node_modules/@openvulcan/dsh-vulcan-luaskills/lib/worker.d.ts +10 -0
- package/node_modules/@openvulcan/dsh-vulcan-luaskills/lib/worker.js +140 -0
- package/node_modules/@openvulcan/dsh-vulcan-luaskills/package.json +57 -0
- package/node_modules/@openvulcan/dsh-vulcan-memory/LICENSE +21 -0
- package/node_modules/@openvulcan/dsh-vulcan-memory/assets/markdown-memory-guide.md +21 -0
- package/node_modules/@openvulcan/dsh-vulcan-memory/assets/memory-curator/SKILL.md +31 -0
- package/node_modules/@openvulcan/dsh-vulcan-memory/assets/memory-icon.png +0 -0
- package/node_modules/@openvulcan/dsh-vulcan-memory/lib/client.js +1090 -0
- package/node_modules/@openvulcan/dsh-vulcan-memory/lib/index.d.ts +30 -0
- package/node_modules/@openvulcan/dsh-vulcan-memory/lib/index.js +240 -0
- package/node_modules/@openvulcan/dsh-vulcan-memory/lib/inject.d.ts +30 -0
- package/node_modules/@openvulcan/dsh-vulcan-memory/lib/inject.js +46 -0
- package/node_modules/@openvulcan/dsh-vulcan-memory/lib/markdown/constants.d.ts +23 -0
- package/node_modules/@openvulcan/dsh-vulcan-memory/lib/markdown/constants.js +25 -0
- package/node_modules/@openvulcan/dsh-vulcan-memory/lib/markdown/document.d.ts +108 -0
- package/node_modules/@openvulcan/dsh-vulcan-memory/lib/markdown/document.js +373 -0
- package/node_modules/@openvulcan/dsh-vulcan-memory/lib/markdown/errors.d.ts +14 -0
- package/node_modules/@openvulcan/dsh-vulcan-memory/lib/markdown/errors.js +31 -0
- package/node_modules/@openvulcan/dsh-vulcan-memory/lib/markdown/index.d.ts +196 -0
- package/node_modules/@openvulcan/dsh-vulcan-memory/lib/markdown/index.js +204 -0
- package/node_modules/@openvulcan/dsh-vulcan-memory/lib/markdown/operations.d.ts +92 -0
- package/node_modules/@openvulcan/dsh-vulcan-memory/lib/markdown/operations.js +472 -0
- package/node_modules/@openvulcan/dsh-vulcan-memory/lib/markdown/package.d.ts +126 -0
- package/node_modules/@openvulcan/dsh-vulcan-memory/lib/markdown/package.js +553 -0
- package/node_modules/@openvulcan/dsh-vulcan-memory/lib/markdown/registry.d.ts +56 -0
- package/node_modules/@openvulcan/dsh-vulcan-memory/lib/markdown/registry.js +182 -0
- package/node_modules/@openvulcan/dsh-vulcan-memory/lib/markdown/scope.d.ts +13 -0
- package/node_modules/@openvulcan/dsh-vulcan-memory/lib/markdown/scope.js +24 -0
- package/node_modules/@openvulcan/dsh-vulcan-memory/lib/markdown/search.d.ts +65 -0
- package/node_modules/@openvulcan/dsh-vulcan-memory/lib/markdown/search.js +227 -0
- package/node_modules/@openvulcan/dsh-vulcan-memory/lib/markdown/snapshot.d.ts +34 -0
- package/node_modules/@openvulcan/dsh-vulcan-memory/lib/markdown/snapshot.js +171 -0
- package/node_modules/@openvulcan/dsh-vulcan-memory/lib/markdown/store.d.ts +72 -0
- package/node_modules/@openvulcan/dsh-vulcan-memory/lib/markdown/store.js +250 -0
- package/node_modules/@openvulcan/dsh-vulcan-memory/lib/markdown/timestamp.d.ts +6 -0
- package/node_modules/@openvulcan/dsh-vulcan-memory/lib/markdown/timestamp.js +12 -0
- package/node_modules/@openvulcan/dsh-vulcan-memory/lib/markdown/tokens.d.ts +8 -0
- package/node_modules/@openvulcan/dsh-vulcan-memory/lib/markdown/tokens.js +38 -0
- package/node_modules/@openvulcan/dsh-vulcan-memory/lib/page.d.ts +132 -0
- package/node_modules/@openvulcan/dsh-vulcan-memory/lib/page.js +235 -0
- package/node_modules/@openvulcan/dsh-vulcan-memory/lib/project.d.ts +14 -0
- package/node_modules/@openvulcan/dsh-vulcan-memory/lib/project.js +27 -0
- package/node_modules/@openvulcan/dsh-vulcan-memory/lib/settings.d.ts +29 -0
- package/node_modules/@openvulcan/dsh-vulcan-memory/lib/settings.js +62 -0
- package/node_modules/@openvulcan/dsh-vulcan-memory/package.json +63 -0
- package/node_modules/@openvulcan/dsh-vulcan-reasoning/LICENSE +21 -0
- package/node_modules/@openvulcan/dsh-vulcan-reasoning/lib/client.js +509 -0
- package/node_modules/@openvulcan/dsh-vulcan-reasoning/lib/index.d.ts +6 -0
- package/node_modules/@openvulcan/dsh-vulcan-reasoning/lib/index.js +8 -0
- package/node_modules/@openvulcan/dsh-vulcan-reasoning/package.json +42 -0
- package/node_modules/@openvulcan/dsh-vulcan-style/LICENSE +21 -0
- package/node_modules/@openvulcan/dsh-vulcan-style/assets/style-icon.png +0 -0
- package/node_modules/@openvulcan/dsh-vulcan-style/lib/client.js +1121 -0
- package/node_modules/@openvulcan/dsh-vulcan-style/lib/index.d.ts +34 -0
- package/node_modules/@openvulcan/dsh-vulcan-style/lib/index.js +42 -0
- package/node_modules/@openvulcan/dsh-vulcan-style/package.json +51 -0
- package/node_modules/@openvulcan/openvulcan-account/LICENSE +21 -0
- package/node_modules/@openvulcan/openvulcan-account/lib/account.d.ts +140 -0
- package/node_modules/@openvulcan/openvulcan-account/lib/account.js +347 -0
- package/node_modules/@openvulcan/openvulcan-account/lib/index.d.ts +1 -0
- package/node_modules/@openvulcan/openvulcan-account/lib/index.js +1 -0
- package/node_modules/@openvulcan/openvulcan-account/package.json +29 -0
- package/node_modules/@openvulcan/vulcan-decision/LICENSE +21 -0
- package/node_modules/@openvulcan/vulcan-decision/README.md +23 -0
- package/node_modules/@openvulcan/vulcan-decision/bin/vulcan-decision.js +4 -0
- package/node_modules/@openvulcan/vulcan-decision/lib/cli.d.ts +5 -0
- package/node_modules/@openvulcan/vulcan-decision/lib/cli.js +267 -0
- package/node_modules/@openvulcan/vulcan-decision/lib/cloud/edge.d.ts +211 -0
- package/node_modules/@openvulcan/vulcan-decision/lib/cloud/edge.js +594 -0
- package/node_modules/@openvulcan/vulcan-decision/lib/download.d.ts +36 -0
- package/node_modules/@openvulcan/vulcan-decision/lib/download.js +99 -0
- package/node_modules/@openvulcan/vulcan-decision/lib/engine.d.ts +37 -0
- package/node_modules/@openvulcan/vulcan-decision/lib/engine.js +39 -0
- package/node_modules/@openvulcan/vulcan-decision/lib/hardware.d.ts +105 -0
- package/node_modules/@openvulcan/vulcan-decision/lib/hardware.js +207 -0
- package/node_modules/@openvulcan/vulcan-decision/lib/home.d.ts +26 -0
- package/node_modules/@openvulcan/vulcan-decision/lib/home.js +54 -0
- package/node_modules/@openvulcan/vulcan-decision/lib/index.d.ts +17 -0
- package/node_modules/@openvulcan/vulcan-decision/lib/index.js +17 -0
- package/node_modules/@openvulcan/vulcan-decision/lib/local/engine.d.ts +54 -0
- package/node_modules/@openvulcan/vulcan-decision/lib/local/engine.js +157 -0
- package/node_modules/@openvulcan/vulcan-decision/lib/local/models.d.ts +126 -0
- package/node_modules/@openvulcan/vulcan-decision/lib/local/models.js +261 -0
- package/node_modules/@openvulcan/vulcan-decision/lib/local/packs.d.ts +102 -0
- package/node_modules/@openvulcan/vulcan-decision/lib/local/packs.js +195 -0
- package/node_modules/@openvulcan/vulcan-decision/lib/local/worker.d.ts +61 -0
- package/node_modules/@openvulcan/vulcan-decision/lib/local/worker.js +123 -0
- package/node_modules/@openvulcan/vulcan-decision/lib/protocol.d.ts +74 -0
- package/node_modules/@openvulcan/vulcan-decision/lib/protocol.js +31 -0
- package/node_modules/@openvulcan/vulcan-decision/lib/render.d.ts +15 -0
- package/node_modules/@openvulcan/vulcan-decision/lib/render.js +33 -0
- package/node_modules/@openvulcan/vulcan-decision/lib/version.d.ts +2 -0
- package/node_modules/@openvulcan/vulcan-decision/lib/version.js +4 -0
- package/node_modules/@openvulcan/vulcan-decision/package.json +40 -0
- package/node_modules/@openvulcan/vulcan-decision/python/vulcan_decision_worker.py +363 -0
- package/node_modules/@openvulcan/vulcan-decision/runtime-packs/onnx-cpu.json +627 -0
- package/node_modules/@openvulcan/vulcan-decision/runtime-packs/onnx-cuda.json +423 -0
- package/node_modules/@openvulcan/vulcan-decision/runtime-packs/torch-cpu.json +1047 -0
- package/node_modules/@openvulcan/vulcan-decision/runtime-packs/torch-cu128.json +647 -0
- package/package.json +55 -4
|
@@ -0,0 +1,573 @@
|
|
|
1
|
+
window.__ModuleLoader__.load({
|
|
2
|
+
id: "@openvulcan/dsh-vulcan-account",
|
|
3
|
+
factory: (platformRequire) => {
|
|
4
|
+
var definitions = {
|
|
5
|
+
"./dsh-client": function (module, exports, require) {
|
|
6
|
+
"use strict";
|
|
7
|
+
/**
|
|
8
|
+
* The parts of dsh's browser runtime this client half uses.
|
|
9
|
+
*
|
|
10
|
+
* dsh serves these modules from its page module table; their packages are not published at the
|
|
11
|
+
* Host's version, so the shapes are restated here from dsh 0.2.1-rc.2 source and must be checked
|
|
12
|
+
* again when the supported dsh range moves:
|
|
13
|
+
* - `packages/client/ui-plugin-manager/src/client/slot-contract.ts` (detail slots and subjects)
|
|
14
|
+
* - `packages/boot/plugin-manager/src/types.ts` (`BundleInfo`, `ChangeResult`)
|
|
15
|
+
* - `packages/client/ui-primitives/src/{Tag,Button}.tsx`, `settings-form/SettingsForm.tsx`
|
|
16
|
+
* - `packages/client/ui-settings/src/client/config-form-types.ts` (`ConfigForm`)
|
|
17
|
+
* - `packages/interaction/permission-presets/src/types.ts` (`PermissionCatalog`)
|
|
18
|
+
* - `packages/client/ui-approval/src/client/contract/slots.ts` (`PendingApproval`)
|
|
19
|
+
* - `packages/client/ui-conversation/src/client/contract/slots.ts` (composer chain, input slots)
|
|
20
|
+
* - `packages/client/ui-settings/src/client/contract/slots.ts` (`settings.section`)
|
|
21
|
+
* - `packages/client/ui-sidebar/src/client/contract/slots.ts` (`sidebar.footer.action`)
|
|
22
|
+
* - `packages/client/ui-settings-general/src/client/{index,shell-store}.ts` (`sidebar.settings` store)
|
|
23
|
+
* - `packages/client/locale/src/client/index.ts` (`bind`)
|
|
24
|
+
* - `packages/client/ui-session/src/client/index.ts` (`sessionId`, `useProjection` props)
|
|
25
|
+
* - `packages/api/session-controller/src/client/contract/{sessions,session}.ts` (`binding`, `command`)
|
|
26
|
+
* - `packages/api/session-controller/src/types.ts` (`ModelCatalog`)
|
|
27
|
+
*/
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
|
|
30
|
+
},
|
|
31
|
+
"./footer": function (module, exports, require) {
|
|
32
|
+
"use strict";
|
|
33
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
34
|
+
exports.AccountFooter = AccountFooter;
|
|
35
|
+
exports.VulcanMark = VulcanMark;
|
|
36
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
37
|
+
/**
|
|
38
|
+
* The OpenVulcan account in the sidebar foot, above Settings: who is signed in and their plan, or
|
|
39
|
+
* one-click sign-in at either site. The rail shows the mark alone and opens the account settings.
|
|
40
|
+
*/
|
|
41
|
+
const react_1 = require("react");
|
|
42
|
+
const i18n_1 = require("./i18n");
|
|
43
|
+
const shared_1 = require("./shared");
|
|
44
|
+
function AccountFooter({ wide, t, view, profile, openSettings }) {
|
|
45
|
+
const live = (0, react_1.useSyncExternalStore)(view.subscribe, view.getSnapshot);
|
|
46
|
+
const who = (0, react_1.useSyncExternalStore)(profile.subscribe, profile.getSnapshot);
|
|
47
|
+
const waiting = live != null && live.signIn !== null;
|
|
48
|
+
const signedIn = live?.account.signedIn === true;
|
|
49
|
+
const authorization = live?.account.authorizationId;
|
|
50
|
+
(0, react_1.useEffect)(() => {
|
|
51
|
+
view.refresh();
|
|
52
|
+
if (!waiting)
|
|
53
|
+
return undefined;
|
|
54
|
+
const timer = setInterval(() => { view.refresh(); }, 1000);
|
|
55
|
+
return () => { clearInterval(timer); };
|
|
56
|
+
}, [view, waiting]);
|
|
57
|
+
// The profile follows the device authorization; the Host reads it once per sign-in.
|
|
58
|
+
(0, react_1.useEffect)(() => {
|
|
59
|
+
if (signedIn)
|
|
60
|
+
profile.refresh();
|
|
61
|
+
}, [profile, signedIn, authorization]);
|
|
62
|
+
const [busy, setBusy] = (0, react_1.useState)(false);
|
|
63
|
+
const [error, setError] = (0, react_1.useState)(undefined);
|
|
64
|
+
const act = (work) => {
|
|
65
|
+
setBusy(true);
|
|
66
|
+
setError(undefined);
|
|
67
|
+
work().catch((failure) => {
|
|
68
|
+
setError((0, shared_1.messageOf)(failure));
|
|
69
|
+
}).finally(() => {
|
|
70
|
+
setBusy(false);
|
|
71
|
+
view.refresh();
|
|
72
|
+
});
|
|
73
|
+
};
|
|
74
|
+
// Without the plugin routes there is nothing to show or do here.
|
|
75
|
+
if (live === null)
|
|
76
|
+
return null;
|
|
77
|
+
const name = signedIn ? (who?.nickname || who?.username) : undefined;
|
|
78
|
+
const siteLabel = live?.account.site === undefined ? '' : t(`account.site.${live.account.site}`);
|
|
79
|
+
if (!wide) {
|
|
80
|
+
const label = signedIn ? (0, i18n_1.fill)(t('footer.signedInAs'), { name: name ?? siteLabel }) : t('footer.signedOut');
|
|
81
|
+
return ((0, jsx_runtime_1.jsxs)("button", { type: "button", className: "vac-foot rail", title: label, "aria-label": label, onClick: openSettings, children: [(0, jsx_runtime_1.jsx)(VulcanMark, {}), signedIn ? (0, jsx_runtime_1.jsx)("span", { className: "vac-foot-dot", "aria-hidden": "true" }) : null] }));
|
|
82
|
+
}
|
|
83
|
+
if (live === undefined) {
|
|
84
|
+
return (0, jsx_runtime_1.jsxs)("div", { className: "vac-foot", children: [(0, jsx_runtime_1.jsx)(VulcanMark, {}), (0, jsx_runtime_1.jsx)("span", { className: "vac-foot-sub", children: t('loading') })] });
|
|
85
|
+
}
|
|
86
|
+
if (signedIn) {
|
|
87
|
+
const label = (0, i18n_1.fill)(t('footer.signedInAs'), { name: name ?? siteLabel });
|
|
88
|
+
return ((0, jsx_runtime_1.jsxs)("button", { type: "button", className: "vac-foot", title: label, "aria-label": label, onClick: openSettings, children: [(0, jsx_runtime_1.jsx)(VulcanMark, {}), (0, jsx_runtime_1.jsxs)("span", { className: "vac-foot-text", children: [(0, jsx_runtime_1.jsx)("span", { className: "vac-foot-name", children: name ?? t('footer.brand') }), (0, jsx_runtime_1.jsx)("span", { className: "vac-foot-sub", children: siteLabel })] }), who?.plan === undefined ? null : (0, jsx_runtime_1.jsx)("span", { className: "vac-foot-plan", children: who.plan })] }));
|
|
89
|
+
}
|
|
90
|
+
if (live.signIn !== null) {
|
|
91
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: "vac-foot", children: [(0, jsx_runtime_1.jsx)(VulcanMark, {}), (0, jsx_runtime_1.jsxs)("span", { className: "vac-foot-text", children: [(0, jsx_runtime_1.jsx)("span", { className: "vac-foot-name", children: t('footer.brand') }), (0, jsx_runtime_1.jsx)("span", { className: "vac-foot-sub", children: t('footer.waiting') })] }), (0, jsx_runtime_1.jsxs)("span", { className: "vac-foot-actions", children: [(0, jsx_runtime_1.jsx)("a", { className: "vac-foot-chip", href: live.signIn.approvalUrl, target: "_blank", rel: "noopener noreferrer", children: t('footer.reopen') }), (0, jsx_runtime_1.jsx)("button", { type: "button", className: "vac-foot-chip", disabled: busy, onClick: () => { act(() => (0, shared_1.callAccount)('POST', 'signin/cancel')); }, children: t('footer.cancel') })] })] }));
|
|
92
|
+
}
|
|
93
|
+
const failure = live.signInError ?? error;
|
|
94
|
+
const note = failure !== undefined ? t('footer.failed') : live.account.reauthRequired === true ? t('footer.reauth') : t('footer.signedOut');
|
|
95
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: "vac-foot", children: [(0, jsx_runtime_1.jsxs)("button", { type: "button", className: "vac-foot-home", "aria-label": t('footer.open'), title: failure ?? t('footer.open'), onClick: openSettings, children: [(0, jsx_runtime_1.jsx)(VulcanMark, {}), (0, jsx_runtime_1.jsxs)("span", { className: "vac-foot-text", children: [(0, jsx_runtime_1.jsx)("span", { className: "vac-foot-name", children: t('footer.brand') }), (0, jsx_runtime_1.jsx)("span", { className: failure === undefined && live.account.reauthRequired !== true ? 'vac-foot-sub' : 'vac-foot-sub warn', children: note })] })] }), (0, jsx_runtime_1.jsx)("span", { className: "vac-foot-actions", children: shared_1.SITES.map(item => ((0, jsx_runtime_1.jsx)("button", { type: "button", className: "vac-foot-chip", disabled: busy, title: (0, i18n_1.fill)(t('footer.signInAt'), { site: t(`account.site.${item.site}`), domain: item.domain }), onClick: () => { act(() => (0, shared_1.startAccountSignIn)(item.site)); }, children: t(`footer.chip.${item.site}`) }, item.site))) })] }));
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Render the OpenVulcan mark with the requested square size, or use the footer dimensions when omitted.
|
|
99
|
+
* 按指定的方形尺寸渲染 OpenVulcan 标识,未指定时使用侧栏底部的尺寸。
|
|
100
|
+
*/
|
|
101
|
+
function VulcanMark({ size }) {
|
|
102
|
+
// The footer and settings can render at once, so each SVG owns its gradient reference.
|
|
103
|
+
// 侧栏底部与设置页可以同时渲染,因此每个 SVG 使用独立的渐变标识。
|
|
104
|
+
const flameId = (0, react_1.useId)();
|
|
105
|
+
return ((0, jsx_runtime_1.jsxs)("svg", { className: size === undefined ? 'vac-foot-mark' : undefined, width: size, height: size, viewBox: "32 29 232 259", "aria-hidden": "true", focusable: "false", children: [(0, jsx_runtime_1.jsx)("defs", { children: (0, jsx_runtime_1.jsxs)("linearGradient", { id: flameId, x1: "0%", y1: "100%", x2: "100%", y2: "0%", children: [(0, jsx_runtime_1.jsx)("stop", { offset: "0%", stopColor: "#FF6527" }), (0, jsx_runtime_1.jsx)("stop", { offset: "100%", stopColor: "#F44E1C" })] }) }), (0, jsx_runtime_1.jsx)("path", { d: "M 2 0 L 84 0 C 88 0 91 1 95 5 L 153 76 C 159 83 159 95 153 102 L 95 173 C 91 177 88 178 84 178 L 2 178 L 78 89 Z", fill: "currentColor", transform: "translate(30 110)" }), (0, jsx_runtime_1.jsx)("path", { d: "M 73 0 C 64 14 51 28 38 40 C 21 55 7 68 2 87 C -2 107 8 129 25 150 C 39 134 53 119 67 107 C 82 95 91 79 93 60 C 95 40 86 18 73 0 Z", fill: `url(#${flameId})`, transform: "translate(169 29)" })] }));
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
},
|
|
109
|
+
"./i18n": function (module, exports, require) {
|
|
110
|
+
"use strict";
|
|
111
|
+
/** The plugin's interface text; dsh picks the dictionary that matches its interface language. */
|
|
112
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
113
|
+
exports.en = exports.zh = exports.NAMESPACE = void 0;
|
|
114
|
+
exports.fill = fill;
|
|
115
|
+
exports.NAMESPACE = 'openvulcan-account';
|
|
116
|
+
exports.zh = {
|
|
117
|
+
'nav': 'OpenVulcan 账号',
|
|
118
|
+
'summary': 'VulcanCode 套件:OpenVulcan 账号、自动审批(Vulcan Decision)、交互式回答与 Vulcan 界面风格。账号登录一次,各插件共用。',
|
|
119
|
+
'openSettings': '账号设置',
|
|
120
|
+
'openGuard': '自动审批设置',
|
|
121
|
+
'page.title': 'OpenVulcan 账号',
|
|
122
|
+
'page.lead': '云端判定等 VulcanCode 功能使用这个账号。登录凭据保存在 dsh 的凭据存储中,退出登录会同时注销本设备。',
|
|
123
|
+
'loading': '读取中…',
|
|
124
|
+
'unavailable': '无法读取账号状态:dsh 没有向本页面提供插件接口。',
|
|
125
|
+
'account.title': '账号',
|
|
126
|
+
'account.lead': '选择账号所在站点并登录。',
|
|
127
|
+
'account.site.global': '国际站',
|
|
128
|
+
'account.site.cn': '中国站',
|
|
129
|
+
'account.signIn': '登录',
|
|
130
|
+
'account.signedIn': '已登录',
|
|
131
|
+
'account.expires': '凭据有效期至 {expires}',
|
|
132
|
+
'account.reauth': '凭据轮换中断,需要重新登录。',
|
|
133
|
+
'account.waiting': '等待浏览器授权,批准后自动完成登录。',
|
|
134
|
+
'account.openAgain': '打开授权页',
|
|
135
|
+
'account.cancel': '取消登录',
|
|
136
|
+
'account.signOut': '退出登录',
|
|
137
|
+
'account.failed': '登录失败:{error}',
|
|
138
|
+
'footer.brand': 'OpenVulcan',
|
|
139
|
+
'footer.signedOut': '未登录',
|
|
140
|
+
'footer.signedInAs': 'OpenVulcan:{name}',
|
|
141
|
+
'footer.open': '打开 OpenVulcan 账号设置',
|
|
142
|
+
'footer.signInAt': '登录{site}({domain})',
|
|
143
|
+
'footer.chip.global': '国际',
|
|
144
|
+
'footer.chip.cn': '中国',
|
|
145
|
+
'footer.waiting': '等待授权…',
|
|
146
|
+
'footer.reopen': '授权页',
|
|
147
|
+
'footer.cancel': '取消',
|
|
148
|
+
'footer.reauth': '需要重新登录',
|
|
149
|
+
'footer.failed': '登录失败',
|
|
150
|
+
};
|
|
151
|
+
exports.en = {
|
|
152
|
+
'nav': 'OpenVulcan account',
|
|
153
|
+
'summary': 'The VulcanCode suite: OpenVulcan account, auto approval (Vulcan Decision), interactive answers and the Vulcan look. Sign in once; every part uses the account.',
|
|
154
|
+
'openSettings': 'Account settings',
|
|
155
|
+
'openGuard': 'Auto approval settings',
|
|
156
|
+
'page.title': 'OpenVulcan account',
|
|
157
|
+
'page.lead': 'Cloud judging and other VulcanCode features use this account. The credential is kept in dsh\'s credential store; signing out also revokes this device.',
|
|
158
|
+
'loading': 'Loading…',
|
|
159
|
+
'unavailable': 'Cannot read the account: dsh offers this page no plugin routes.',
|
|
160
|
+
'account.title': 'Account',
|
|
161
|
+
'account.lead': 'Choose the site of your account and sign in.',
|
|
162
|
+
'account.site.global': 'Global',
|
|
163
|
+
'account.site.cn': 'China',
|
|
164
|
+
'account.signIn': 'Sign in',
|
|
165
|
+
'account.signedIn': 'Signed in',
|
|
166
|
+
'account.expires': 'Credential valid until {expires}',
|
|
167
|
+
'account.reauth': 'A credential rotation was interrupted; sign in again.',
|
|
168
|
+
'account.waiting': 'Approve in your browser to finish signing in.',
|
|
169
|
+
'account.openAgain': 'Open approval page',
|
|
170
|
+
'account.cancel': 'Cancel sign-in',
|
|
171
|
+
'account.signOut': 'Sign out',
|
|
172
|
+
'account.failed': 'Sign-in failed: {error}',
|
|
173
|
+
'footer.brand': 'OpenVulcan',
|
|
174
|
+
'footer.signedOut': 'Not signed in',
|
|
175
|
+
'footer.signedInAs': 'OpenVulcan: {name}',
|
|
176
|
+
'footer.open': 'Open the OpenVulcan account settings',
|
|
177
|
+
'footer.signInAt': 'Sign in at {site} ({domain})',
|
|
178
|
+
'footer.chip.global': 'Global',
|
|
179
|
+
'footer.chip.cn': 'China',
|
|
180
|
+
'footer.waiting': 'Waiting for approval…',
|
|
181
|
+
'footer.reopen': 'Approve',
|
|
182
|
+
'footer.cancel': 'Cancel',
|
|
183
|
+
'footer.reauth': 'Sign in again',
|
|
184
|
+
'footer.failed': 'Sign-in failed',
|
|
185
|
+
};
|
|
186
|
+
/** Replace `{name}` placeholders. */
|
|
187
|
+
function fill(text, values) {
|
|
188
|
+
return text.replace(/\{(\w+)\}/g, (match, name) => (name in values ? String(values[name]) : match));
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
},
|
|
192
|
+
"./index": function (module, exports, require) {
|
|
193
|
+
"use strict";
|
|
194
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
195
|
+
exports.inject = void 0;
|
|
196
|
+
exports.apply = apply;
|
|
197
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
198
|
+
/**
|
|
199
|
+
* Browser half of the account plugin: Settings › OpenVulcan account, and the VulcanCode suite's
|
|
200
|
+
* entry on the Plugins page. dsh loads these files as one lazy factory; they may import only
|
|
201
|
+
* modules dsh serves to plugins.
|
|
202
|
+
*/
|
|
203
|
+
const i18n_1 = require("./i18n");
|
|
204
|
+
const footer_1 = require("./footer");
|
|
205
|
+
const page_1 = require("./page");
|
|
206
|
+
const shared_1 = require("./shared");
|
|
207
|
+
const style_1 = require("./style");
|
|
208
|
+
exports.inject = ['slots', 'locale'];
|
|
209
|
+
function apply(ctx) {
|
|
210
|
+
const view = new shared_1.HostWatch(() => (0, shared_1.callAccount)('GET', 'state').catch(() => null));
|
|
211
|
+
// An unreadable profile leaves the footer naming the site instead.
|
|
212
|
+
const profile = new shared_1.HostWatch(() => (0, shared_1.callAccount)('GET', 'profile').catch(() => null));
|
|
213
|
+
const open = (section) => {
|
|
214
|
+
const shell = ctx.slots.entries('sidebar.settings')[0]?.store?.create();
|
|
215
|
+
shell?.actions.openSection(section);
|
|
216
|
+
};
|
|
217
|
+
ctx.effect(() => (0, style_1.installStyle)(), 'openvulcan-account: stylesheet');
|
|
218
|
+
ctx.effect(() => ctx.locale.register(i18n_1.NAMESPACE, { zh: i18n_1.zh, en: i18n_1.en }), 'openvulcan-account: dictionaries');
|
|
219
|
+
ctx.effect(() => {
|
|
220
|
+
const stop = ctx.on('connection/reset', () => {
|
|
221
|
+
view.refresh();
|
|
222
|
+
profile.refresh();
|
|
223
|
+
});
|
|
224
|
+
return () => {
|
|
225
|
+
stop();
|
|
226
|
+
view.close();
|
|
227
|
+
profile.close();
|
|
228
|
+
};
|
|
229
|
+
}, 'openvulcan-account: Host state');
|
|
230
|
+
// After Auto approval (22), before Market (40).
|
|
231
|
+
ctx.slots.inject('settings.section', () => ctx.slots.register({
|
|
232
|
+
name: 'settings.section',
|
|
233
|
+
id: shared_1.SETTINGS_SECTION,
|
|
234
|
+
order: 24,
|
|
235
|
+
label: () => ctx.locale.bind(i18n_1.NAMESPACE)('nav'),
|
|
236
|
+
locale: i18n_1.NAMESPACE,
|
|
237
|
+
inject: () => ({ view }),
|
|
238
|
+
}, ({ t, view: injected }) => (0, jsx_runtime_1.jsx)(page_1.AccountPage, { view: injected, t: t })));
|
|
239
|
+
// dsh 0.2.2 declares this optional slot. The injection waits on older hosts.
|
|
240
|
+
// dsh 0.2.2 声明了此可选插槽,旧版宿主上的注入会保持等待。
|
|
241
|
+
ctx.slots.inject('settings.section.icon', () => ctx.slots.register({
|
|
242
|
+
name: 'settings.section.icon',
|
|
243
|
+
id: shared_1.SETTINGS_SECTION,
|
|
244
|
+
}, footer_1.VulcanMark));
|
|
245
|
+
// Above Settings in the sidebar foot.
|
|
246
|
+
ctx.slots.inject('sidebar.footer.action', () => ctx.slots.register({
|
|
247
|
+
name: 'sidebar.footer.action',
|
|
248
|
+
id: 'openvulcan-account',
|
|
249
|
+
order: 0,
|
|
250
|
+
locale: i18n_1.NAMESPACE,
|
|
251
|
+
inject: () => ({ view, profile, open: () => { open(shared_1.SETTINGS_SECTION); } }),
|
|
252
|
+
}, ({ wide, t, view: watched, profile: who, open: openSettings }) => ((0, jsx_runtime_1.jsx)(footer_1.AccountFooter, { wide: wide, t: t, view: watched, profile: who, openSettings: openSettings }))));
|
|
253
|
+
ctx.slots.inject('plugins.bundle.config', () => ctx.slots.register({
|
|
254
|
+
name: 'plugins.bundle.config',
|
|
255
|
+
key: shared_1.SUITE_PACKAGE,
|
|
256
|
+
locale: i18n_1.NAMESPACE,
|
|
257
|
+
inject: () => ({ open }),
|
|
258
|
+
}, page_1.PluginPageSummary));
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
},
|
|
262
|
+
"./page": function (module, exports, require) {
|
|
263
|
+
"use strict";
|
|
264
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
265
|
+
exports.AccountPage = AccountPage;
|
|
266
|
+
exports.PluginPageSummary = PluginPageSummary;
|
|
267
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
268
|
+
/** Settings › OpenVulcan account: the site, the credential's expiry, sign in and sign out. */
|
|
269
|
+
const react_1 = require("react");
|
|
270
|
+
const i18n_1 = require("./i18n");
|
|
271
|
+
const shared_1 = require("./shared");
|
|
272
|
+
function AccountPage({ view, t }) {
|
|
273
|
+
const live = (0, react_1.useSyncExternalStore)(view.subscribe, view.getSnapshot);
|
|
274
|
+
const waiting = live != null && live.signIn !== null;
|
|
275
|
+
// While a sign-in waits for approval the page polls, so it turns signed-in on its own.
|
|
276
|
+
(0, react_1.useEffect)(() => {
|
|
277
|
+
view.refresh();
|
|
278
|
+
if (!waiting)
|
|
279
|
+
return undefined;
|
|
280
|
+
const timer = setInterval(() => { view.refresh(); }, 1000);
|
|
281
|
+
return () => { clearInterval(timer); };
|
|
282
|
+
}, [view, waiting]);
|
|
283
|
+
const [busy, setBusy] = (0, react_1.useState)(false);
|
|
284
|
+
const [error, setError] = (0, react_1.useState)(undefined);
|
|
285
|
+
const act = (work) => {
|
|
286
|
+
setBusy(true);
|
|
287
|
+
setError(undefined);
|
|
288
|
+
work().catch((failure) => {
|
|
289
|
+
setError((0, shared_1.messageOf)(failure));
|
|
290
|
+
}).finally(() => {
|
|
291
|
+
setBusy(false);
|
|
292
|
+
view.refresh();
|
|
293
|
+
});
|
|
294
|
+
};
|
|
295
|
+
let body;
|
|
296
|
+
if (live === undefined)
|
|
297
|
+
body = (0, jsx_runtime_1.jsx)("p", { className: "vac-hint", children: t('loading') });
|
|
298
|
+
else if (live === null)
|
|
299
|
+
body = (0, jsx_runtime_1.jsx)("div", { className: "vac-alert bad", children: t('unavailable') });
|
|
300
|
+
else if (live.account.signedIn) {
|
|
301
|
+
const account = live.account;
|
|
302
|
+
body = ((0, jsx_runtime_1.jsxs)("div", { className: "vac-between", children: [(0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsxs)("div", { className: "vac-inline", children: [(0, jsx_runtime_1.jsx)("span", { className: "vac-badge ok", children: t('account.signedIn') }), (0, jsx_runtime_1.jsx)("strong", { children: t(`account.site.${account.site ?? 'global'}`) }), (0, jsx_runtime_1.jsx)("span", { className: "vac-hint vac-mono", children: shared_1.SITES.find(item => item.site === account.site)?.domain })] }), account.expiresAt === undefined ? null : (0, jsx_runtime_1.jsx)("p", { className: "vac-hint", children: (0, i18n_1.fill)(t('account.expires'), { expires: when(account.expiresAt) }) })] }), (0, jsx_runtime_1.jsx)("button", { type: "button", className: "vac-btn", disabled: busy, onClick: () => { act(() => (0, shared_1.callAccount)('POST', 'signout')); }, children: t('account.signOut') })] }));
|
|
303
|
+
}
|
|
304
|
+
else if (live.signIn !== null) {
|
|
305
|
+
body = ((0, jsx_runtime_1.jsxs)("div", { className: "vac-between", children: [(0, jsx_runtime_1.jsx)("span", { role: "status", children: t('account.waiting') }), (0, jsx_runtime_1.jsxs)("span", { className: "vac-inline", children: [(0, jsx_runtime_1.jsx)("a", { className: "vac-link", href: live.signIn.approvalUrl, target: "_blank", rel: "noopener noreferrer", children: t('account.openAgain') }), (0, jsx_runtime_1.jsx)("button", { type: "button", className: "vac-btn sm", disabled: busy, onClick: () => { act(() => (0, shared_1.callAccount)('POST', 'signin/cancel')); }, children: t('account.cancel') })] })] }));
|
|
306
|
+
}
|
|
307
|
+
else {
|
|
308
|
+
body = ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [live.account.reauthRequired === true ? (0, jsx_runtime_1.jsx)("div", { className: "vac-alert warn", children: t('account.reauth') }) : null, (0, jsx_runtime_1.jsx)("div", { className: "vac-sites", children: shared_1.SITES.map(item => ((0, jsx_runtime_1.jsxs)("button", { type: "button", className: "vac-site", disabled: busy, onClick: () => { act(() => (0, shared_1.startAccountSignIn)(item.site)); }, children: [(0, jsx_runtime_1.jsx)("strong", { children: t(`account.site.${item.site}`) }), (0, jsx_runtime_1.jsx)("span", { children: item.domain }), (0, jsx_runtime_1.jsxs)("span", { style: { fontFamily: 'inherit', color: 'var(--vk-signal)' }, children: [t('account.signIn'), " \u2192"] })] }, item.site))) })] }));
|
|
309
|
+
}
|
|
310
|
+
const failure = live?.signInError === undefined ? error : (0, i18n_1.fill)(t('account.failed'), { error: live.signInError });
|
|
311
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: "vac vac-page", "data-vulcan-settings-width": "readable", children: [(0, jsx_runtime_1.jsxs)("header", { className: "vac-page-head", "data-vulcan-settings-header": true, children: [(0, jsx_runtime_1.jsx)("h2", { children: t('page.title') }), (0, jsx_runtime_1.jsx)("p", { className: "vac-lead", children: t('page.lead') })] }), (0, jsx_runtime_1.jsxs)("section", { className: "vac-section", children: [(0, jsx_runtime_1.jsx)("div", { className: "vac-section-head", children: (0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("h3", { className: "vac-section-title", children: t('account.title') }), live?.account.signedIn === true ? null : (0, jsx_runtime_1.jsx)("p", { className: "vac-section-lead", children: t('account.lead') })] }) }), (0, jsx_runtime_1.jsxs)("div", { className: "vac-section-body", children: [body, failure === undefined ? null : (0, jsx_runtime_1.jsx)("p", { className: "vac-error", role: "alert", children: failure })] })] })] }));
|
|
312
|
+
}
|
|
313
|
+
/** The suite's entry on the Plugins page: what it holds, and the way to its settings. */
|
|
314
|
+
function PluginPageSummary({ view, t, open }) {
|
|
315
|
+
if (view === 'summary')
|
|
316
|
+
return t('summary');
|
|
317
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: "vac", style: { display: 'flex', flexDirection: 'column', gap: 12, alignItems: 'flex-start' }, children: [(0, jsx_runtime_1.jsx)("p", { className: "vac-lead", style: { margin: 0 }, children: t('summary') }), (0, jsx_runtime_1.jsxs)("div", { className: "vac-inline", children: [(0, jsx_runtime_1.jsx)("button", { type: "button", className: "vac-btn primary", onClick: () => { open(shared_1.SETTINGS_SECTION); }, children: t('openSettings') }), (0, jsx_runtime_1.jsx)("button", { type: "button", className: "vac-btn", onClick: () => { open(shared_1.GUARD_SECTION); }, children: t('openGuard') })] })] }));
|
|
318
|
+
}
|
|
319
|
+
/** A short local date and time. */
|
|
320
|
+
function when(at) {
|
|
321
|
+
return new Intl.DateTimeFormat(undefined, { dateStyle: 'short', timeStyle: 'short' }).format(new Date(at));
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
},
|
|
325
|
+
"./shared": function (module, exports, require) {
|
|
326
|
+
"use strict";
|
|
327
|
+
/** Facts the browser half shares with the Host half. */
|
|
328
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
329
|
+
exports.HostWatch = exports.SITES = exports.GUARD_SECTION = exports.SUITE_PACKAGE = exports.SETTINGS_SECTION = exports.PACKAGE_NAME = void 0;
|
|
330
|
+
exports.callAccount = callAccount;
|
|
331
|
+
exports.startAccountSignIn = startAccountSignIn;
|
|
332
|
+
exports.messageOf = messageOf;
|
|
333
|
+
/** Checked against `package.json` by `scripts/bundle-client.mjs`. */
|
|
334
|
+
exports.PACKAGE_NAME = '@openvulcan/dsh-vulcan-account';
|
|
335
|
+
/** The Settings dialog entry this plugin adds; other VulcanCode plugins open it by this id. */
|
|
336
|
+
exports.SETTINGS_SECTION = 'vulcan-account';
|
|
337
|
+
/** The bundle the Plugins page lists; its page summary is this plugin's. */
|
|
338
|
+
exports.SUITE_PACKAGE = '@openvulcan/dsh-vulcancode';
|
|
339
|
+
/** The decision guard's Settings dialog entry. */
|
|
340
|
+
exports.GUARD_SECTION = 'vulcan-auto-approval';
|
|
341
|
+
/** Mirrors `ROUTE_PREFIX` in `src/index.ts`, below the page's origin. */
|
|
342
|
+
const ROUTE_BASE = '/api/vulcan-account/';
|
|
343
|
+
/** The two OpenVulcan sites, in the order they are offered. */
|
|
344
|
+
exports.SITES = [
|
|
345
|
+
{ site: 'global', domain: 'openvulcan.com' },
|
|
346
|
+
{ site: 'cn', domain: 'openvulcan.cn' },
|
|
347
|
+
];
|
|
348
|
+
async function callAccount(method, route) {
|
|
349
|
+
const response = await fetch(`${ROUTE_BASE}${route}`, { method });
|
|
350
|
+
const answer = await response.json().catch(() => undefined);
|
|
351
|
+
if (answer?.ok !== true)
|
|
352
|
+
throw new Error(answer?.error?.message ?? `HTTP ${response.status}`);
|
|
353
|
+
return answer.value;
|
|
354
|
+
}
|
|
355
|
+
/**
|
|
356
|
+
* Start device sign-in for the selected site and request its authorization page. Resolves after
|
|
357
|
+
* asking the browser or desktop shell to open it, and rejects if the sign-in request fails.
|
|
358
|
+
* 为所选站点发起设备登录并请求打开授权页。向浏览器或桌面壳发出打开请求后完成,登录请求失败时拒绝。
|
|
359
|
+
*/
|
|
360
|
+
async function startAccountSignIn(site) {
|
|
361
|
+
// A browser needs the click to open a tab before the asynchronous sign-in request.
|
|
362
|
+
// 浏览器需要利用点击手势在异步登录请求之前打开标签页。
|
|
363
|
+
const popup = window.open('about:blank', '_blank');
|
|
364
|
+
try {
|
|
365
|
+
// The account service validates the approval URL against the selected site and sign-in state.
|
|
366
|
+
// 账号服务会根据所选站点和登录状态验证授权地址。
|
|
367
|
+
const { approvalUrl } = await callAccount('POST', `signin?site=${site}`);
|
|
368
|
+
if (popup === null) {
|
|
369
|
+
// dsh Desktop denies the blank tab and sends HTTP(S) URLs directly to the system browser.
|
|
370
|
+
// dsh 桌面端拒绝空白标签页,并将 HTTP(S) 地址直接交给系统浏览器。
|
|
371
|
+
window.open(approvalUrl, '_blank', 'noopener,noreferrer');
|
|
372
|
+
}
|
|
373
|
+
else if (!popup.closed) {
|
|
374
|
+
popup.opener = null;
|
|
375
|
+
popup.location.replace(approvalUrl);
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
catch (failure) {
|
|
379
|
+
popup?.close();
|
|
380
|
+
throw failure;
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
function messageOf(error) {
|
|
384
|
+
return error instanceof Error ? error.message : String(error);
|
|
385
|
+
}
|
|
386
|
+
/**
|
|
387
|
+
* Latest-answer-wins view of one Host fact, shared by every rendered entry. `undefined` means
|
|
388
|
+
* unknown: before the first answer, or after a failed read, so nothing is shown as a guess.
|
|
389
|
+
*/
|
|
390
|
+
class HostWatch {
|
|
391
|
+
read;
|
|
392
|
+
#value;
|
|
393
|
+
#listeners = new Set();
|
|
394
|
+
#generation = 0;
|
|
395
|
+
constructor(read) {
|
|
396
|
+
this.read = read;
|
|
397
|
+
}
|
|
398
|
+
subscribe = (listener) => {
|
|
399
|
+
this.#listeners.add(listener);
|
|
400
|
+
return () => { this.#listeners.delete(listener); };
|
|
401
|
+
};
|
|
402
|
+
getSnapshot = () => this.#value;
|
|
403
|
+
/** Re-read the fact; an older answer never replaces a newer one. */
|
|
404
|
+
refresh() {
|
|
405
|
+
const generation = ++this.#generation;
|
|
406
|
+
this.read().then((value) => {
|
|
407
|
+
if (generation === this.#generation)
|
|
408
|
+
this.#set(value);
|
|
409
|
+
}, () => {
|
|
410
|
+
if (generation === this.#generation)
|
|
411
|
+
this.#set(undefined);
|
|
412
|
+
});
|
|
413
|
+
}
|
|
414
|
+
/** Stop publishing answers that are still in flight. */
|
|
415
|
+
close() {
|
|
416
|
+
++this.#generation;
|
|
417
|
+
this.#listeners.clear();
|
|
418
|
+
}
|
|
419
|
+
#set(value) {
|
|
420
|
+
if (Object.is(value, this.#value))
|
|
421
|
+
return;
|
|
422
|
+
this.#value = value;
|
|
423
|
+
for (const listener of this.#listeners)
|
|
424
|
+
listener();
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
exports.HostWatch = HostWatch;
|
|
428
|
+
|
|
429
|
+
},
|
|
430
|
+
"./style": function (module, exports, require) {
|
|
431
|
+
"use strict";
|
|
432
|
+
/**
|
|
433
|
+
* The plugin's look, after VulcanCode's ui-kit (`apps/vulcan-code-web/src/ui-kit/styles`): square
|
|
434
|
+
* corners, hairline borders, numbered sections with an ember corner tick, tinted badges and plain
|
|
435
|
+
* tables, for the account page. Every rule is scoped under `.vac`, so nothing leaks into dsh; dark values follow dsh's
|
|
436
|
+
* `body[data-ds-dark-theme]`.
|
|
437
|
+
*/
|
|
438
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
439
|
+
exports.installStyle = installStyle;
|
|
440
|
+
const CSS = `
|
|
441
|
+
.vac {
|
|
442
|
+
--vk-u: 4px;
|
|
443
|
+
--vk-panel: #fff; --vk-sunken: #f6f7f9; --vk-hover: #eef1f4; --vk-select: #e3e9f8;
|
|
444
|
+
--vk-line: #dde1e6; --vk-line-strong: #c3c9d1; --vk-line-soft: #eaecef;
|
|
445
|
+
--vk-ink: #14171c; --vk-ink-2: #4a515c; --vk-ink-3: #626973;
|
|
446
|
+
--vk-ember: #e2511a; --vk-signal: #2e58cc; --vk-ok: #18774a; --vk-warn: #945d09; --vk-bad: #c3303d;
|
|
447
|
+
--vk-shadow-1: 0 1px 2px rgba(20, 23, 28, 0.06);
|
|
448
|
+
--vk-shadow-2: 0 16px 40px rgba(20, 23, 28, 0.18), 0 2px 8px rgba(20, 23, 28, 0.08);
|
|
449
|
+
--vk-mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
|
|
450
|
+
font-size: 13px; line-height: 1.5; color: var(--vk-ink);
|
|
451
|
+
}
|
|
452
|
+
body[data-ds-dark-theme] .vac {
|
|
453
|
+
--vk-panel: #15181d; --vk-sunken: #0f1215; --vk-hover: #1e2329; --vk-select: #1c2537;
|
|
454
|
+
--vk-line: #23282f; --vk-line-strong: #343b45; --vk-line-soft: #1a1e24;
|
|
455
|
+
--vk-ink: #e6e9ed; --vk-ink-2: #a2aab5; --vk-ink-3: #848c97;
|
|
456
|
+
--vk-ember: #ff6a2b; --vk-signal: #7d9dff; --vk-ok: #3fc48a; --vk-warn: #e0a83a; --vk-bad: #f0646f;
|
|
457
|
+
--vk-shadow-1: 0 1px 2px rgba(0, 0, 0, 0.4);
|
|
458
|
+
--vk-shadow-2: 0 16px 40px rgba(0, 0, 0, 0.55), 0 2px 8px rgba(0, 0, 0, 0.4);
|
|
459
|
+
}
|
|
460
|
+
.vac *, .vac *::before, .vac *::after { box-sizing: border-box; }
|
|
461
|
+
.vac-page { display: flex; flex-direction: column; gap: calc(var(--vk-u) * 4); counter-reset: vac-section; padding-bottom: calc(var(--vk-u) * 2); }
|
|
462
|
+
.vac-page-head h2 { margin: 0; font-size: 16px; font-weight: 600; }
|
|
463
|
+
.vac-lead { margin: calc(var(--vk-u) * 1) 0 0; color: var(--vk-ink-2); }
|
|
464
|
+
.vac-hint { margin: 0; color: var(--vk-ink-3); font-size: 12px; }
|
|
465
|
+
.vac-error { margin: 0; color: var(--vk-bad); font-size: 12px; overflow-wrap: anywhere; }
|
|
466
|
+
|
|
467
|
+
.vac-section { position: relative; border: 1px solid var(--vk-line); background: var(--vk-panel); box-shadow: var(--vk-shadow-1); }
|
|
468
|
+
.vac-section::before { content: ""; position: absolute; left: -1px; top: -1px; width: calc(var(--vk-u) * 7); height: 2px; background: var(--vk-ember); }
|
|
469
|
+
.vac-section-head { display: flex; align-items: flex-start; justify-content: space-between; gap: calc(var(--vk-u) * 3); padding: calc(var(--vk-u) * 3.5) calc(var(--vk-u) * 4) 0; }
|
|
470
|
+
.vac-section-title { display: flex; align-items: center; gap: calc(var(--vk-u) * 2); margin: 0; font-size: 15px; font-weight: 600; }
|
|
471
|
+
.vac-section-title::before { counter-increment: vac-section; content: counter(vac-section, decimal-leading-zero); border: 1px solid var(--vk-line); color: var(--vk-ink-3); font-family: var(--vk-mono); font-size: 10px; font-weight: 400; letter-spacing: .06em; padding: 0 5px; line-height: 16px; }
|
|
472
|
+
.vac-section-lead { margin: calc(var(--vk-u) * 1) 0 0; color: var(--vk-ink-3); font-size: 12px; }
|
|
473
|
+
.vac-section-body { display: flex; flex-direction: column; gap: calc(var(--vk-u) * 3); padding: calc(var(--vk-u) * 3) calc(var(--vk-u) * 4) calc(var(--vk-u) * 4); }
|
|
474
|
+
.vac-section-body.flush { padding: calc(var(--vk-u) * 3) 0 0; gap: 0; }
|
|
475
|
+
|
|
476
|
+
.vac-inline { display: flex; align-items: center; gap: calc(var(--vk-u) * 2); flex-wrap: wrap; }
|
|
477
|
+
.vac-between { display: flex; align-items: center; justify-content: space-between; gap: calc(var(--vk-u) * 3); flex-wrap: wrap; }
|
|
478
|
+
|
|
479
|
+
.vac-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 28px; padding: 0 calc(var(--vk-u) * 3); border: 1px solid var(--vk-line-strong); background: var(--vk-panel); color: var(--vk-ink); font: inherit; font-size: 12px; font-weight: 500; cursor: pointer; white-space: nowrap; border-radius: 0; }
|
|
480
|
+
.vac-btn:hover:not(:disabled) { background: var(--vk-hover); }
|
|
481
|
+
.vac-btn:disabled { cursor: default; opacity: .55; }
|
|
482
|
+
.vac-btn.sm { height: 24px; padding: 0 calc(var(--vk-u) * 2); }
|
|
483
|
+
.vac-btn.primary { background: var(--vk-ink); border-color: var(--vk-ink); color: var(--vk-panel); }
|
|
484
|
+
.vac-btn.primary:hover:not(:disabled) { background: var(--vk-ink-2); }
|
|
485
|
+
.vac-btn.ghost { border-color: transparent; background: transparent; }
|
|
486
|
+
.vac-btn.ghost:hover:not(:disabled) { background: var(--vk-hover); }
|
|
487
|
+
.vac-link { border: 0; padding: 0; background: none; color: var(--vk-signal); font: inherit; font-size: 12px; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
|
|
488
|
+
|
|
489
|
+
.vac-btn:focus-visible, .vac-site:focus-visible { outline: 2px solid var(--vk-signal); outline-offset: 1px; }
|
|
490
|
+
|
|
491
|
+
.vac-badge { display: inline-flex; align-items: center; height: 18px; padding: 0 6px; border: 1px solid color-mix(in srgb, var(--tone, var(--vk-ink-3)) 32%, transparent); background: color-mix(in srgb, var(--tone, var(--vk-ink-3)) 9%, transparent); color: var(--tone, var(--vk-ink-2)); font-size: 11px; font-weight: 500; white-space: nowrap; }
|
|
492
|
+
.vac-badge.ok { --tone: var(--vk-ok); }
|
|
493
|
+
.vac-badge.warn { --tone: var(--vk-warn); }
|
|
494
|
+
.vac-badge.bad { --tone: var(--vk-bad); }
|
|
495
|
+
.vac-badge.info { --tone: var(--vk-signal); }
|
|
496
|
+
.vac-badge.outline { --tone: var(--vk-ink-3); background: transparent; }
|
|
497
|
+
|
|
498
|
+
.vac-alert { padding: calc(var(--vk-u) * 2.5) calc(var(--vk-u) * 3); border: 1px solid var(--vk-line); border-left: 3px solid var(--tone, var(--vk-ink-3)); background: var(--vk-sunken); color: var(--vk-ink-2); font-size: 12px; overflow-wrap: anywhere; }
|
|
499
|
+
.vac-alert.warn { --tone: var(--vk-warn); }
|
|
500
|
+
.vac-alert.bad { --tone: var(--vk-bad); }
|
|
501
|
+
|
|
502
|
+
.vac-sites { display: grid; grid-template-columns: 1fr 1fr; gap: calc(var(--vk-u) * 2); }
|
|
503
|
+
.vac-site { display: flex; flex-direction: column; gap: 2px; padding: calc(var(--vk-u) * 3); border: 1px solid var(--vk-line); background: var(--vk-panel); text-align: left; color: inherit; font: inherit; cursor: pointer; }
|
|
504
|
+
.vac-site:hover:not(:disabled) { background: var(--vk-hover); border-color: var(--vk-line-strong); }
|
|
505
|
+
.vac-site:disabled { cursor: default; opacity: .6; }
|
|
506
|
+
.vac-site strong { font-weight: 600; }
|
|
507
|
+
.vac-site span { color: var(--vk-ink-3); font-family: var(--vk-mono); font-size: 12px; }
|
|
508
|
+
|
|
509
|
+
.vac-mono { font-family: var(--vk-mono); }
|
|
510
|
+
|
|
511
|
+
.vac-between > .vac-hint:last-child { font-variant-numeric: tabular-nums; }
|
|
512
|
+
|
|
513
|
+
/* Sidebar foot row, above Settings: dsh's own sidebar colours and the Settings trigger's inset. */
|
|
514
|
+
.vac-foot {
|
|
515
|
+
display: flex; align-items: center; gap: 8px; width: 100%; min-width: 0; height: 40px; margin: 4px 0 0;
|
|
516
|
+
padding: 0 calc(var(--dsh-sidebar-row-padding, 12px) - var(--dsh-sidebar-paint-inset, 3px));
|
|
517
|
+
border: none; border-inline: var(--dsh-sidebar-paint-inset, 3px) solid transparent; background: transparent; background-clip: padding-box;
|
|
518
|
+
border-radius: var(--dsw-radius-md, 0); box-sizing: border-box;
|
|
519
|
+
color: var(--dsw-alias-label-primary, #14171c); font-family: inherit; font-size: 13px; line-height: 18px; text-align: left;
|
|
520
|
+
}
|
|
521
|
+
button.vac-foot { cursor: pointer; }
|
|
522
|
+
.vac-foot.rail { position: relative; flex: none; width: 36px; height: 36px; margin: 0; padding: 0; justify-content: center; border-inline: 0; }
|
|
523
|
+
@media (hover: hover) {
|
|
524
|
+
button.vac-foot:hover, .vac-foot-home:hover { background-color: var(--dsw-alias-interactive-bg-hover, rgba(0, 0, 0, .05)); }
|
|
525
|
+
}
|
|
526
|
+
.vac-foot-home { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; height: 100%; margin: 0 0 0 -6px; padding: 0 6px; border: none; background: transparent; color: inherit; font: inherit; text-align: left; cursor: pointer; border-radius: var(--dsw-radius-sm, 0); }
|
|
527
|
+
.vac-foot-mark { flex: none; width: 16px; height: 18px; }
|
|
528
|
+
.vac-foot-text { display: flex; flex-direction: column; flex: 1; min-width: 0; }
|
|
529
|
+
.vac-foot-name, .vac-foot-sub { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
|
|
530
|
+
.vac-foot-name { font-weight: 500; }
|
|
531
|
+
.vac-foot-sub { color: var(--dsw-alias-label-tertiary, #626973); font-size: 11px; line-height: 14px; }
|
|
532
|
+
.vac-foot-sub.warn { color: #c2410c; }
|
|
533
|
+
.vac-foot-plan {
|
|
534
|
+
flex: none; padding: 0 5px; border: 1px solid color-mix(in srgb, #e2511a 40%, transparent); color: #e2511a;
|
|
535
|
+
font-family: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 10px; line-height: 16px; letter-spacing: .06em; text-transform: uppercase;
|
|
536
|
+
}
|
|
537
|
+
.vac-foot-actions { display: flex; flex: none; gap: 4px; }
|
|
538
|
+
.vac-foot-chip {
|
|
539
|
+
display: inline-flex; align-items: center; height: 22px; padding: 0 7px; border: 1px solid var(--dsw-alias-border-l2, #dde1e6);
|
|
540
|
+
background: transparent; color: var(--dsw-alias-label-secondary, #4a515c); font: inherit; font-size: 11px; text-decoration: none; cursor: pointer; white-space: nowrap;
|
|
541
|
+
}
|
|
542
|
+
.vac-foot-chip:hover:not(:disabled) { border-color: #e2511a; color: #e2511a; }
|
|
543
|
+
.vac-foot-chip:disabled { cursor: default; opacity: .55; }
|
|
544
|
+
.vac-foot-dot { position: absolute; right: 7px; bottom: 7px; width: 6px; height: 6px; border-radius: 50%; background: var(--dsw-alias-state-success-primary, #18a058); box-shadow: 0 0 0 2px var(--dsw-specific-sidebar-fill, #fff); }
|
|
545
|
+
.vac-foot:focus-visible, .vac-foot-home:focus-visible, .vac-foot-chip:focus-visible { outline: 2px solid #2e58cc; outline-offset: -2px; }
|
|
546
|
+
`;
|
|
547
|
+
/** Add the stylesheet once per page; returns a function that removes it again. */
|
|
548
|
+
function installStyle() {
|
|
549
|
+
const existing = document.querySelector('style[data-plugin="openvulcan-account"]');
|
|
550
|
+
if (existing !== null)
|
|
551
|
+
existing.remove();
|
|
552
|
+
const tag = document.createElement('style');
|
|
553
|
+
tag.dataset['plugin'] = 'openvulcan-account';
|
|
554
|
+
tag.textContent = CSS;
|
|
555
|
+
document.head.appendChild(tag);
|
|
556
|
+
return () => { tag.remove(); };
|
|
557
|
+
}
|
|
558
|
+
|
|
559
|
+
},
|
|
560
|
+
};
|
|
561
|
+
var cache = {};
|
|
562
|
+
function load(request) {
|
|
563
|
+
if (!(request in definitions)) return platformRequire(request);
|
|
564
|
+
if (!(request in cache)) {
|
|
565
|
+
var module = { exports: {} };
|
|
566
|
+
cache[request] = module;
|
|
567
|
+
definitions[request](module, module.exports, load);
|
|
568
|
+
}
|
|
569
|
+
return cache[request].exports;
|
|
570
|
+
}
|
|
571
|
+
return load('./index');
|
|
572
|
+
}
|
|
573
|
+
});
|