@huaweidevtools/aishell-dsh-client-credentials 0.0.11 → 0.0.13
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
CHANGED
|
@@ -666,10 +666,25 @@ async function startBrowserLogin() {
|
|
|
666
666
|
/**
|
|
667
667
|
* Open a blank tab, subject to the current user gesture.
|
|
668
668
|
*
|
|
669
|
-
*
|
|
669
|
+
* `undefined` means the browser gave back no window — a blocker, a popup
|
|
670
|
+
* policy, an extension, or a runtime that does not implement `window.open` at
|
|
671
|
+
* all. The card cannot tell these apart from the return value, which is why the
|
|
672
|
+
* outcome is treated as ordinary rather than as a diagnosis: the running state's
|
|
673
|
+
* 「点击此处打开」 is a real link, and a link the person chooses to follow is not
|
|
674
|
+
* something a blocker refuses. A missing tab costs the automatic open and
|
|
675
|
+
* nothing else.
|
|
676
|
+
*
|
|
677
|
+
* ## `about:blank`, and why it is spelled out
|
|
678
|
+
*
|
|
679
|
+
* The window is opened on `about:blank` rather than on an empty string. An
|
|
680
|
+
* empty URL reads as "no document" in some implementations, where the window is
|
|
681
|
+
* refused outright or left in a state the later navigation cannot use. The
|
|
682
|
+
* shell's own sign-in popup opens `about:blank` for the same reason.
|
|
683
|
+
*
|
|
684
|
+
* @returns the handle, or `undefined` when no window was created.
|
|
670
685
|
*/
|
|
671
686
|
function openLoginWindow() {
|
|
672
|
-
const opened = window.open("", "_blank");
|
|
687
|
+
const opened = window.open("about:blank", "_blank");
|
|
673
688
|
if (opened === null) return void 0;
|
|
674
689
|
try {
|
|
675
690
|
opened.opener = null;
|
|
@@ -677,7 +692,7 @@ function openLoginWindow() {
|
|
|
677
692
|
return {
|
|
678
693
|
navigate: (url) => {
|
|
679
694
|
try {
|
|
680
|
-
opened.location.
|
|
695
|
+
opened.location.replace(url);
|
|
681
696
|
} catch {}
|
|
682
697
|
},
|
|
683
698
|
close: () => {
|
|
@@ -1037,24 +1052,21 @@ function CredentialRequestForm(props) {
|
|
|
1037
1052
|
if (phase === "running" || phase === "starting") return;
|
|
1038
1053
|
setBrowserError(void 0);
|
|
1039
1054
|
const tab = openLoginWindow();
|
|
1040
|
-
if (tab === void 0)
|
|
1041
|
-
setBrowserError(t("form.browser.blocked"));
|
|
1042
|
-
return;
|
|
1043
|
-
}
|
|
1055
|
+
if (tab === void 0) console.warn("[aishell-credentials] window.open returned null for the sign-in tab. The login continues; the link on the card is the way in.");
|
|
1044
1056
|
setPhase("starting");
|
|
1045
1057
|
const handle = await props.startBrowserLogin();
|
|
1046
1058
|
if (!mounted.current) {
|
|
1047
|
-
tab
|
|
1059
|
+
tab?.close();
|
|
1048
1060
|
handle?.cancel();
|
|
1049
1061
|
return;
|
|
1050
1062
|
}
|
|
1051
1063
|
if (handle === void 0) {
|
|
1052
|
-
tab
|
|
1064
|
+
tab?.close();
|
|
1053
1065
|
setPhase("ready");
|
|
1054
1066
|
setBrowserError(t("form.browser.startFailed"));
|
|
1055
1067
|
return;
|
|
1056
1068
|
}
|
|
1057
|
-
tab
|
|
1069
|
+
tab?.navigate(handle.loginUrl);
|
|
1058
1070
|
setLogin(handle);
|
|
1059
1071
|
setPhase("running");
|
|
1060
1072
|
const window$1 = handle.expiresInSeconds > 0 ? handle.expiresInSeconds : void 0;
|
|
@@ -1075,20 +1087,6 @@ function CredentialRequestForm(props) {
|
|
|
1075
1087
|
setPhase("ready");
|
|
1076
1088
|
setBrowserError(void 0);
|
|
1077
1089
|
}, [login]);
|
|
1078
|
-
/** Put the sign-in URL on the clipboard when the tab did not open. */
|
|
1079
|
-
const onCopyLink = () => {
|
|
1080
|
-
if (login === null || login === void 0) return;
|
|
1081
|
-
navigator.clipboard.writeText(login.loginUrl).then(
|
|
1082
|
-
() => {
|
|
1083
|
-
setBrowserError(void 0);
|
|
1084
|
-
},
|
|
1085
|
-
// A denied clipboard — no permission, or an insecure origin — leaves the
|
|
1086
|
-
// person with nothing, so say what happened rather than failing silently.
|
|
1087
|
-
() => {
|
|
1088
|
-
setBrowserError(t("form.browser.copyFailed"));
|
|
1089
|
-
}
|
|
1090
|
-
);
|
|
1091
|
-
};
|
|
1092
1090
|
const onSubmit = async (event) => {
|
|
1093
1091
|
event.preventDefault();
|
|
1094
1092
|
setSaving(true);
|
|
@@ -1289,14 +1287,6 @@ function CredentialRequestForm(props) {
|
|
|
1289
1287
|
gap: 8
|
|
1290
1288
|
},
|
|
1291
1289
|
children: [
|
|
1292
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1293
|
-
style: {
|
|
1294
|
-
fontSize: 13,
|
|
1295
|
-
fontWeight: 500,
|
|
1296
|
-
color: "var(--dsw-alias-label-secondary)"
|
|
1297
|
-
},
|
|
1298
|
-
children: t("form.browser.section")
|
|
1299
|
-
}),
|
|
1300
1290
|
phase === "running" && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
|
|
1301
1291
|
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1302
1292
|
className: DIAL_CLASS,
|
|
@@ -1367,7 +1357,7 @@ function CredentialRequestForm(props) {
|
|
|
1367
1357
|
children: t(button.label)
|
|
1368
1358
|
})
|
|
1369
1359
|
}),
|
|
1370
|
-
phase === "running" && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
1360
|
+
phase === "running" && login !== null && login !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
1371
1361
|
style: {
|
|
1372
1362
|
fontSize: 12,
|
|
1373
1363
|
lineHeight: "18px",
|
|
@@ -1375,21 +1365,17 @@ function CredentialRequestForm(props) {
|
|
|
1375
1365
|
},
|
|
1376
1366
|
children: [
|
|
1377
1367
|
t("form.browser.notOpened"),
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1368
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("a", {
|
|
1369
|
+
href: login.loginUrl,
|
|
1370
|
+
target: "_blank",
|
|
1371
|
+
rel: "noopener noreferrer",
|
|
1382
1372
|
style: {
|
|
1383
|
-
border: "none",
|
|
1384
|
-
background: "none",
|
|
1385
|
-
padding: 0,
|
|
1386
|
-
font: "inherit",
|
|
1387
1373
|
color: "var(--dsw-alias-button-primary-fill)",
|
|
1388
|
-
textDecoration: "underline"
|
|
1389
|
-
cursor: "pointer"
|
|
1374
|
+
textDecoration: "underline"
|
|
1390
1375
|
},
|
|
1391
|
-
children: t("form.browser.
|
|
1392
|
-
})
|
|
1376
|
+
children: t("form.browser.openHere")
|
|
1377
|
+
}),
|
|
1378
|
+
t("form.browser.openHereSuffix")
|
|
1393
1379
|
]
|
|
1394
1380
|
}),
|
|
1395
1381
|
browserError !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
@@ -1583,9 +1569,10 @@ function decodeRequest(raw) {
|
|
|
1583
1569
|
/**
|
|
1584
1570
|
* Build the visibility state machine.
|
|
1585
1571
|
*
|
|
1586
|
-
* @param
|
|
1572
|
+
* @param deps - publishing and navigation.
|
|
1587
1573
|
*/
|
|
1588
|
-
function createCredentialFormVisibility(
|
|
1574
|
+
function createCredentialFormVisibility(deps) {
|
|
1575
|
+
const { publish, revealSession, isStillPending } = deps;
|
|
1589
1576
|
let open;
|
|
1590
1577
|
let withdraw;
|
|
1591
1578
|
const clear = () => {
|
|
@@ -1596,7 +1583,11 @@ function createCredentialFormVisibility(publish) {
|
|
|
1596
1583
|
return {
|
|
1597
1584
|
current: () => open,
|
|
1598
1585
|
open: (sessionId) => {
|
|
1599
|
-
if (open !== void 0)
|
|
1586
|
+
if (open !== void 0 && isStillPending(open)) {
|
|
1587
|
+
if (open.sessionId !== sessionId) revealSession(open.sessionId);
|
|
1588
|
+
return;
|
|
1589
|
+
}
|
|
1590
|
+
if (open !== void 0) clear();
|
|
1600
1591
|
const interaction = credentialFormInteraction(sessionId);
|
|
1601
1592
|
open = interaction;
|
|
1602
1593
|
withdraw = publish(interaction);
|
|
@@ -1648,9 +1639,8 @@ const zh = {
|
|
|
1648
1639
|
"form.browser.cancelLabel": "取消登录",
|
|
1649
1640
|
"form.browser.runningLabel": "登录中",
|
|
1650
1641
|
"form.browser.notOpened": "若浏览器未自动打开,请",
|
|
1651
|
-
"form.browser.
|
|
1652
|
-
"form.browser.
|
|
1653
|
-
"form.browser.copyFailed": "无法复制链接,请手动从浏览器地址栏重试。",
|
|
1642
|
+
"form.browser.openHere": "点击此处",
|
|
1643
|
+
"form.browser.openHereSuffix": "打开。",
|
|
1654
1644
|
"form.browser.failed": "浏览器登录未完成。",
|
|
1655
1645
|
"form.browser.startFailed": "无法启动浏览器登录,请改用 AK/SK 或稍后重试。",
|
|
1656
1646
|
"form.browser.expired": "登录超时,请重试。",
|
|
@@ -1698,10 +1688,9 @@ const en = {
|
|
|
1698
1688
|
"form.browser.unsupported": "This environment does not support this method.",
|
|
1699
1689
|
"form.browser.cancelLabel": "Cancel sign-in",
|
|
1700
1690
|
"form.browser.runningLabel": "Signing in",
|
|
1701
|
-
"form.browser.notOpened": "If the browser did not open,",
|
|
1702
|
-
"form.browser.
|
|
1703
|
-
"form.browser.
|
|
1704
|
-
"form.browser.copyFailed": "Could not copy the link. Try again from the browser address bar.",
|
|
1691
|
+
"form.browser.notOpened": "If the browser did not open, ",
|
|
1692
|
+
"form.browser.openHere": "click here",
|
|
1693
|
+
"form.browser.openHereSuffix": " to open it.",
|
|
1705
1694
|
"form.browser.failed": "The browser sign-in did not complete.",
|
|
1706
1695
|
"form.browser.startFailed": "Could not start the browser sign-in. Use an AK/SK instead, or try again.",
|
|
1707
1696
|
"form.browser.expired": "The sign-in timed out. Try again.",
|
|
@@ -1827,7 +1816,8 @@ const inject = [
|
|
|
1827
1816
|
"slots",
|
|
1828
1817
|
"locale",
|
|
1829
1818
|
"configForms",
|
|
1830
|
-
"uiSession"
|
|
1819
|
+
"uiSession",
|
|
1820
|
+
"uiWorkspace"
|
|
1831
1821
|
];
|
|
1832
1822
|
function apply(ctx) {
|
|
1833
1823
|
ctx.effect(() => ctx.locale.register(NS, {
|
|
@@ -1863,7 +1853,13 @@ function apply(ctx) {
|
|
|
1863
1853
|
loginOutcome.set(form.getSnapshot().value?.loginOutcome ?? "");
|
|
1864
1854
|
}), "aishell-credentials: login outcome");
|
|
1865
1855
|
const publishCredentialForm = ctx.uiSession.registerPendingInteraction(() => 0);
|
|
1866
|
-
const visibility = createCredentialFormVisibility(
|
|
1856
|
+
const visibility = createCredentialFormVisibility({
|
|
1857
|
+
publish: (interaction) => publishCredentialForm(interaction, () => Promise.resolve()),
|
|
1858
|
+
revealSession: (sessionId) => {
|
|
1859
|
+
ctx.uiWorkspace.openSession(sessionId);
|
|
1860
|
+
},
|
|
1861
|
+
isStillPending: (interaction) => ctx.uiSession.sessionStatus.getSnapshot().get(interaction.sessionId)?.pendingInteraction === interaction
|
|
1862
|
+
});
|
|
1867
1863
|
/** The last request the browser acted on, so a re-read is not a re-open. */
|
|
1868
1864
|
let lastRequestToken;
|
|
1869
1865
|
/**
|
package/lib/index.js
CHANGED
|
@@ -1053,6 +1053,41 @@ var CredentialEntryCancelled = class extends Error {
|
|
|
1053
1053
|
}
|
|
1054
1054
|
};
|
|
1055
1055
|
/**
|
|
1056
|
+
* Another conversation already has the credential form open.
|
|
1057
|
+
*
|
|
1058
|
+
* ## Why this is a refusal and not a queue
|
|
1059
|
+
*
|
|
1060
|
+
* The form renders inside ONE conversation. A call in a different conversation
|
|
1061
|
+
* that waited on it would be waiting for a person looking at somewhere else —
|
|
1062
|
+
* they would see no form, and the call would hang until the turn was stopped.
|
|
1063
|
+
* Queueing would fix the display but not the wait: the second caller would sit
|
|
1064
|
+
* until the first was answered, which may never happen because nobody is
|
|
1065
|
+
* looking at the first one either.
|
|
1066
|
+
*
|
|
1067
|
+
* ## Why no timeout
|
|
1068
|
+
*
|
|
1069
|
+
* The obvious alternative — give the first request a deadline and release it —
|
|
1070
|
+
* was rejected. There is no honest number: a person fetching a key from the
|
|
1071
|
+
* console can legitimately take ten minutes, and cutting them off mid-typing is
|
|
1072
|
+
* worse than making a second conversation retry. The first request does get
|
|
1073
|
+
* released, just by a definite event rather than a clock: stopping the turn, or
|
|
1074
|
+
* answering the form.
|
|
1075
|
+
*
|
|
1076
|
+
* ## The instruction is part of the message
|
|
1077
|
+
*
|
|
1078
|
+
* Unlike {@link CredentialEntryCancelled}, this one DOES say what to do next.
|
|
1079
|
+
* That is the difference between them: a cancel is a decision the person made
|
|
1080
|
+
* and the model must not talk them out of, while a busy form is a transient
|
|
1081
|
+
* state with an obvious next move. Saying it here saves a round trip and keeps
|
|
1082
|
+
* a model from inventing a retry loop of its own.
|
|
1083
|
+
*/
|
|
1084
|
+
var CredentialFormBusy = class extends Error {
|
|
1085
|
+
constructor() {
|
|
1086
|
+
super("另一个会话已经打开了凭据表单。 / Another conversation already has the credential form open. Ask the user to finish or cancel it there, then call auth again.");
|
|
1087
|
+
this.name = "CredentialFormBusy";
|
|
1088
|
+
}
|
|
1089
|
+
};
|
|
1090
|
+
/**
|
|
1056
1091
|
* Wait for the form's answer, or for the call to be cancelled.
|
|
1057
1092
|
*
|
|
1058
1093
|
* An abandoned call must not keep a promise alive: the turn is over, and nobody
|
|
@@ -2759,7 +2794,10 @@ function apply(ctx, config) {
|
|
|
2759
2794
|
registerAuthTool(ctx, store, {
|
|
2760
2795
|
requestForm: (sessionId) => {
|
|
2761
2796
|
if (ns === void 0) return void 0;
|
|
2762
|
-
if (pendingForm !== void 0)
|
|
2797
|
+
if (pendingForm !== void 0) {
|
|
2798
|
+
if (pendingForm.request.sessionId === sessionId) return pendingForm.outcome;
|
|
2799
|
+
throw new CredentialFormBusy();
|
|
2800
|
+
}
|
|
2763
2801
|
const pending = formRequest(sessionId);
|
|
2764
2802
|
pendingForm = pending;
|
|
2765
2803
|
ctx.settings.mutate(ns, [{
|
package/lib/types/auth-tool.d.ts
CHANGED
|
@@ -81,6 +81,12 @@ export interface AuthToolDeps {
|
|
|
81
81
|
*
|
|
82
82
|
* `undefined` when there is no session to render the form in, which is the
|
|
83
83
|
* case a call running outside an agent hits.
|
|
84
|
+
*
|
|
85
|
+
* Throws {@link CredentialFormBusy} when ANOTHER conversation already has a
|
|
86
|
+
* form open. Callers in the same conversation still share one form; a second
|
|
87
|
+
* conversation cannot, because the form renders inside the first one — a
|
|
88
|
+
* caller there would wait for a person who is looking at a different
|
|
89
|
+
* conversation.
|
|
84
90
|
*/
|
|
85
91
|
readonly requestForm: (sessionId: string) => Promise<FormOutcome> | undefined;
|
|
86
92
|
/**
|
|
@@ -105,4 +111,36 @@ export interface AuthToolDeps {
|
|
|
105
111
|
* @param store - the credential store this package owns.
|
|
106
112
|
*/
|
|
107
113
|
export declare function registerAuthTool(ctx: Context, store: CredentialsStore, deps: AuthToolDeps): void;
|
|
114
|
+
/**
|
|
115
|
+
* Another conversation already has the credential form open.
|
|
116
|
+
*
|
|
117
|
+
* ## Why this is a refusal and not a queue
|
|
118
|
+
*
|
|
119
|
+
* The form renders inside ONE conversation. A call in a different conversation
|
|
120
|
+
* that waited on it would be waiting for a person looking at somewhere else —
|
|
121
|
+
* they would see no form, and the call would hang until the turn was stopped.
|
|
122
|
+
* Queueing would fix the display but not the wait: the second caller would sit
|
|
123
|
+
* until the first was answered, which may never happen because nobody is
|
|
124
|
+
* looking at the first one either.
|
|
125
|
+
*
|
|
126
|
+
* ## Why no timeout
|
|
127
|
+
*
|
|
128
|
+
* The obvious alternative — give the first request a deadline and release it —
|
|
129
|
+
* was rejected. There is no honest number: a person fetching a key from the
|
|
130
|
+
* console can legitimately take ten minutes, and cutting them off mid-typing is
|
|
131
|
+
* worse than making a second conversation retry. The first request does get
|
|
132
|
+
* released, just by a definite event rather than a clock: stopping the turn, or
|
|
133
|
+
* answering the form.
|
|
134
|
+
*
|
|
135
|
+
* ## The instruction is part of the message
|
|
136
|
+
*
|
|
137
|
+
* Unlike {@link CredentialEntryCancelled}, this one DOES say what to do next.
|
|
138
|
+
* That is the difference between them: a cancel is a decision the person made
|
|
139
|
+
* and the model must not talk them out of, while a busy form is a transient
|
|
140
|
+
* state with an obvious next move. Saying it here saves a round trip and keeps
|
|
141
|
+
* a model from inventing a retry loop of its own.
|
|
142
|
+
*/
|
|
143
|
+
export declare class CredentialFormBusy extends Error {
|
|
144
|
+
constructor();
|
|
145
|
+
}
|
|
108
146
|
//# sourceMappingURL=auth-tool.d.ts.map
|
|
@@ -37,15 +37,41 @@
|
|
|
37
37
|
import { type CredentialFormInteraction } from './CredentialFormInteraction.ts';
|
|
38
38
|
/** Publishes one interaction and returns the function that withdraws it. */
|
|
39
39
|
export type PublishInteraction = (interaction: CredentialFormInteraction) => () => void;
|
|
40
|
+
/** Select one conversation as the visible one. */
|
|
41
|
+
export type RevealSession = (sessionId: string) => void;
|
|
42
|
+
/**
|
|
43
|
+
* Whether the framework still has this interaction in front of a composer.
|
|
44
|
+
*
|
|
45
|
+
* The machine's own `open` variable is not authority for that. It is set when
|
|
46
|
+
* the interaction is published and cleared only by an explicit `close()`, while
|
|
47
|
+
* the card can leave the screen by paths that never call one — a workspace
|
|
48
|
+
* switch, a re-render that unmounts the chain. Reading the registry back is
|
|
49
|
+
* what keeps a stale record from sending someone to a conversation with no form
|
|
50
|
+
* on it.
|
|
51
|
+
*
|
|
52
|
+
* @param interaction - the interaction this machine last published.
|
|
53
|
+
*/
|
|
54
|
+
export type IsStillPending = (interaction: CredentialFormInteraction) => boolean;
|
|
40
55
|
/** Opens and closes the form on the composer's pending interaction. */
|
|
41
56
|
export interface CredentialFormVisibility {
|
|
42
57
|
/**
|
|
43
|
-
* Open the form for one session.
|
|
58
|
+
* Open the form for one session, or show the session that already has it.
|
|
59
|
+
*
|
|
60
|
+
* Three cases, and the third is why this is not just "publish if absent":
|
|
44
61
|
*
|
|
45
|
-
*
|
|
46
|
-
*
|
|
62
|
+
* - Nothing open — publish, and the form appears here.
|
|
63
|
+
* - Open in THIS conversation — no-op. The person is looking at it, and a
|
|
64
|
+
* second interaction would carry a new key, so the framework would remount
|
|
65
|
+
* the component and throw away the half-typed AK/SK.
|
|
66
|
+
* - Open in a DIFFERENT conversation — navigate there instead. The card is
|
|
67
|
+
* already on screen over there, and the form is a single process-wide
|
|
68
|
+
* thing (one login at a time, one credential store), so publishing a
|
|
69
|
+
* second card would give two conversations a live form over one store.
|
|
70
|
+
* Moving the person to the card they already have is the honest answer,
|
|
71
|
+
* and it is also what makes the chip work after a conversation switch:
|
|
72
|
+
* refusing used to leave every later click doing nothing until a reload.
|
|
47
73
|
*
|
|
48
|
-
* @param sessionId - the conversation the
|
|
74
|
+
* @param sessionId - the conversation the person is acting in.
|
|
49
75
|
*/
|
|
50
76
|
readonly open: (sessionId: string) => void;
|
|
51
77
|
/** Withdraw the open form, if any, restoring the ordinary composer. */
|
|
@@ -55,10 +81,28 @@ export interface CredentialFormVisibility {
|
|
|
55
81
|
/** Withdraw any open form. Called when the plugin fiber is disposed. */
|
|
56
82
|
readonly dispose: () => void;
|
|
57
83
|
}
|
|
84
|
+
/** How the visibility state machine reaches the rest of the product. */
|
|
85
|
+
export interface CredentialFormVisibilityDeps {
|
|
86
|
+
/** How to put an interaction in front of the composer. */
|
|
87
|
+
readonly publish: PublishInteraction;
|
|
88
|
+
/**
|
|
89
|
+
* How to select another conversation, as the sidebar does.
|
|
90
|
+
*
|
|
91
|
+
* Injected rather than imported so the decision can be tested without a UI,
|
|
92
|
+
* and so this module stays free of framework navigation types.
|
|
93
|
+
*/
|
|
94
|
+
readonly revealSession: RevealSession;
|
|
95
|
+
/**
|
|
96
|
+
* How to ask whether a published interaction is still on screen.
|
|
97
|
+
*
|
|
98
|
+
* See {@link IsStillPending} for why the machine cannot answer this itself.
|
|
99
|
+
*/
|
|
100
|
+
readonly isStillPending: IsStillPending;
|
|
101
|
+
}
|
|
58
102
|
/**
|
|
59
103
|
* Build the visibility state machine.
|
|
60
104
|
*
|
|
61
|
-
* @param
|
|
105
|
+
* @param deps - publishing and navigation.
|
|
62
106
|
*/
|
|
63
|
-
export declare function createCredentialFormVisibility(
|
|
107
|
+
export declare function createCredentialFormVisibility(deps: CredentialFormVisibilityDeps): CredentialFormVisibility;
|
|
64
108
|
//# sourceMappingURL=credential-form-visibility.d.ts.map
|
|
@@ -32,9 +32,8 @@ export declare const zh: {
|
|
|
32
32
|
readonly 'form.browser.cancelLabel': "取消登录";
|
|
33
33
|
readonly 'form.browser.runningLabel': "登录中";
|
|
34
34
|
readonly 'form.browser.notOpened': "若浏览器未自动打开,请";
|
|
35
|
-
readonly 'form.browser.
|
|
36
|
-
readonly 'form.browser.
|
|
37
|
-
readonly 'form.browser.copyFailed': "无法复制链接,请手动从浏览器地址栏重试。";
|
|
35
|
+
readonly 'form.browser.openHere': "点击此处";
|
|
36
|
+
readonly 'form.browser.openHereSuffix': "打开。";
|
|
38
37
|
readonly 'form.browser.failed': "浏览器登录未完成。";
|
|
39
38
|
readonly 'form.browser.startFailed': "无法启动浏览器登录,请改用 AK/SK 或稍后重试。";
|
|
40
39
|
readonly 'form.browser.expired': "登录超时,请重试。";
|
|
@@ -82,10 +81,9 @@ export declare const en: {
|
|
|
82
81
|
readonly 'form.browser.unsupported': "This environment does not support this method.";
|
|
83
82
|
readonly 'form.browser.cancelLabel': "Cancel sign-in";
|
|
84
83
|
readonly 'form.browser.runningLabel': "Signing in";
|
|
85
|
-
readonly 'form.browser.notOpened': "If the browser did not open,";
|
|
86
|
-
readonly 'form.browser.
|
|
87
|
-
readonly 'form.browser.
|
|
88
|
-
readonly 'form.browser.copyFailed': "Could not copy the link. Try again from the browser address bar.";
|
|
84
|
+
readonly 'form.browser.notOpened': "If the browser did not open, ";
|
|
85
|
+
readonly 'form.browser.openHere': "click here";
|
|
86
|
+
readonly 'form.browser.openHereSuffix': " to open it.";
|
|
89
87
|
readonly 'form.browser.failed': "The browser sign-in did not complete.";
|
|
90
88
|
readonly 'form.browser.startFailed': "Could not start the browser sign-in. Use an AK/SK instead, or try again.";
|
|
91
89
|
readonly 'form.browser.expired': "The sign-in timed out. Try again.";
|
|
@@ -128,7 +128,22 @@ export interface LoginWindow {
|
|
|
128
128
|
/**
|
|
129
129
|
* Open a blank tab, subject to the current user gesture.
|
|
130
130
|
*
|
|
131
|
-
*
|
|
131
|
+
* `undefined` means the browser gave back no window — a blocker, a popup
|
|
132
|
+
* policy, an extension, or a runtime that does not implement `window.open` at
|
|
133
|
+
* all. The card cannot tell these apart from the return value, which is why the
|
|
134
|
+
* outcome is treated as ordinary rather than as a diagnosis: the running state's
|
|
135
|
+
* 「点击此处打开」 is a real link, and a link the person chooses to follow is not
|
|
136
|
+
* something a blocker refuses. A missing tab costs the automatic open and
|
|
137
|
+
* nothing else.
|
|
138
|
+
*
|
|
139
|
+
* ## `about:blank`, and why it is spelled out
|
|
140
|
+
*
|
|
141
|
+
* The window is opened on `about:blank` rather than on an empty string. An
|
|
142
|
+
* empty URL reads as "no document" in some implementations, where the window is
|
|
143
|
+
* refused outright or left in a state the later navigation cannot use. The
|
|
144
|
+
* shell's own sign-in popup opens `about:blank` for the same reason.
|
|
145
|
+
*
|
|
146
|
+
* @returns the handle, or `undefined` when no window was created.
|
|
132
147
|
*/
|
|
133
148
|
export declare function openLoginWindow(): LoginWindow | undefined;
|
|
134
149
|
//# sourceMappingURL=login-flow.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@huaweidevtools/aishell-dsh-client-credentials",
|
|
3
3
|
"description": "AI Shell credentials — chip-opened web form for storing Huawei Cloud AK/SK in the credential store",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.13",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
7
7
|
},
|
|
@@ -28,10 +28,11 @@
|
|
|
28
28
|
"dsh": {
|
|
29
29
|
"client": {
|
|
30
30
|
"inject": [
|
|
31
|
-
"@deepseek-ai/dsh-
|
|
32
|
-
"@deepseek-ai/dsh-client-ui-conversation",
|
|
31
|
+
"@deepseek-ai/dsh-api-remotes",
|
|
33
32
|
"@deepseek-ai/dsh-client-locale",
|
|
34
|
-
"@deepseek-ai/dsh-
|
|
33
|
+
"@deepseek-ai/dsh-client-ui-conversation",
|
|
34
|
+
"@deepseek-ai/dsh-client-ui-settings",
|
|
35
|
+
"@deepseek-ai/dsh-client-ui-workspace"
|
|
35
36
|
],
|
|
36
37
|
"platform": "web"
|
|
37
38
|
},
|
|
@@ -41,28 +42,29 @@
|
|
|
41
42
|
},
|
|
42
43
|
"license": "Apache-2.0",
|
|
43
44
|
"dependencies": {
|
|
44
|
-
"@huaweidevtools/aishell-dsh-credentials-store": "0.0.
|
|
45
|
+
"@huaweidevtools/aishell-dsh-credentials-store": "0.0.13"
|
|
45
46
|
},
|
|
46
47
|
"peerDependencies": {
|
|
47
48
|
"@deepseek-ai/cordis": "^4.0.4",
|
|
48
|
-
"@deepseek-ai/dsh-client-connection": "0.2.0-rc.1 || 0.2.1-rc.1 || 0.2.1-rc.2 || 0.2.1",
|
|
49
|
-
"@deepseek-ai/dsh-settings": "0.2.0-rc.1 || 0.2.1-rc.1 || 0.2.1-rc.2 || 0.2.1",
|
|
50
|
-
"@deepseek-ai/dsh-tools": "0.2.0-rc.1 || 0.2.1-rc.1 || 0.2.1-rc.2 || 0.2.1"
|
|
49
|
+
"@deepseek-ai/dsh-client-connection": "0.2.0-rc.1 || 0.2.1-rc.1 || 0.2.1-rc.2 || 0.2.1-rc.3 || 0.2.1-rc.4 || 0.2.1-rc.5",
|
|
50
|
+
"@deepseek-ai/dsh-settings": "0.2.0-rc.1 || 0.2.1-rc.1 || 0.2.1-rc.2 || 0.2.1-rc.3 || 0.2.1-rc.4 || 0.2.1-rc.5",
|
|
51
|
+
"@deepseek-ai/dsh-tools": "0.2.0-rc.1 || 0.2.1-rc.1 || 0.2.1-rc.2 || 0.2.1-rc.3 || 0.2.1-rc.4 || 0.2.1-rc.5"
|
|
51
52
|
},
|
|
52
53
|
"devDependencies": {
|
|
53
54
|
"@deepseek-ai/cordis": "^4.0.4",
|
|
54
55
|
"@deepseek-ai/cordis-plugin-loader": "^1.0.5",
|
|
55
|
-
"@deepseek-ai/dsh-client-connection": "0.2.0-rc.1 || 0.2.1-rc.1 || 0.2.1-rc.2 || 0.2.1",
|
|
56
|
-
"@deepseek-ai/dsh-client-locale": "0.2.0-rc.1 || 0.2.1-rc.1 || 0.2.1-rc.2 || 0.2.1",
|
|
57
|
-
"@deepseek-ai/dsh-client-store": "0.2.0-rc.1 || 0.2.1-rc.1 || 0.2.1-rc.2 || 0.2.1",
|
|
58
|
-
"@deepseek-ai/dsh-client-ui-conversation": "0.2.0-rc.1 || 0.2.1-rc.1 || 0.2.1-rc.2 || 0.2.1",
|
|
59
|
-
"@deepseek-ai/dsh-client-ui-renderer": "0.2.0-rc.1 || 0.2.1-rc.1 || 0.2.1-rc.2 || 0.2.1",
|
|
60
|
-
"@deepseek-ai/dsh-client-ui-session": "0.2.0-rc.1 || 0.2.1-rc.1 || 0.2.1-rc.2 || 0.2.1",
|
|
61
|
-
"@deepseek-ai/dsh-client-ui-settings": "0.2.0-rc.1 || 0.2.1-rc.1 || 0.2.1-rc.2 || 0.2.1",
|
|
62
|
-
"@deepseek-ai/dsh-client-ui-slots": "0.2.0-rc.1 || 0.2.1-rc.1 || 0.2.1-rc.2 || 0.2.1",
|
|
63
|
-
"@deepseek-ai/dsh-
|
|
64
|
-
"@deepseek-ai/dsh-
|
|
65
|
-
"@deepseek-ai/dsh-
|
|
56
|
+
"@deepseek-ai/dsh-client-connection": "0.2.0-rc.1 || 0.2.1-rc.1 || 0.2.1-rc.2 || 0.2.1-rc.3 || 0.2.1-rc.4 || 0.2.1-rc.5",
|
|
57
|
+
"@deepseek-ai/dsh-client-locale": "0.2.0-rc.1 || 0.2.1-rc.1 || 0.2.1-rc.2 || 0.2.1-rc.3 || 0.2.1-rc.4 || 0.2.1-rc.5",
|
|
58
|
+
"@deepseek-ai/dsh-client-store": "0.2.0-rc.1 || 0.2.1-rc.1 || 0.2.1-rc.2 || 0.2.1-rc.3 || 0.2.1-rc.4 || 0.2.1-rc.5",
|
|
59
|
+
"@deepseek-ai/dsh-client-ui-conversation": "0.2.0-rc.1 || 0.2.1-rc.1 || 0.2.1-rc.2 || 0.2.1-rc.3 || 0.2.1-rc.4 || 0.2.1-rc.5",
|
|
60
|
+
"@deepseek-ai/dsh-client-ui-renderer": "0.2.0-rc.1 || 0.2.1-rc.1 || 0.2.1-rc.2 || 0.2.1-rc.3 || 0.2.1-rc.4 || 0.2.1-rc.5",
|
|
61
|
+
"@deepseek-ai/dsh-client-ui-session": "0.2.0-rc.1 || 0.2.1-rc.1 || 0.2.1-rc.2 || 0.2.1-rc.3 || 0.2.1-rc.4 || 0.2.1-rc.5",
|
|
62
|
+
"@deepseek-ai/dsh-client-ui-settings": "0.2.0-rc.1 || 0.2.1-rc.1 || 0.2.1-rc.2 || 0.2.1-rc.3 || 0.2.1-rc.4 || 0.2.1-rc.5",
|
|
63
|
+
"@deepseek-ai/dsh-client-ui-slots": "0.2.0-rc.1 || 0.2.1-rc.1 || 0.2.1-rc.2 || 0.2.1-rc.3 || 0.2.1-rc.4 || 0.2.1-rc.5",
|
|
64
|
+
"@deepseek-ai/dsh-client-ui-workspace": "0.2.0-rc.1 || 0.2.1-rc.1 || 0.2.1-rc.2 || 0.2.1-rc.3 || 0.2.1-rc.4 || 0.2.1-rc.5",
|
|
65
|
+
"@deepseek-ai/dsh-session": "0.2.0-rc.1 || 0.2.1-rc.1 || 0.2.1-rc.2 || 0.2.1-rc.3 || 0.2.1-rc.4 || 0.2.1-rc.5",
|
|
66
|
+
"@deepseek-ai/dsh-settings": "0.2.0-rc.1 || 0.2.1-rc.1 || 0.2.1-rc.2 || 0.2.1-rc.3 || 0.2.1-rc.4 || 0.2.1-rc.5",
|
|
67
|
+
"@deepseek-ai/dsh-tools": "0.2.0-rc.1 || 0.2.1-rc.1 || 0.2.1-rc.2 || 0.2.1-rc.3 || 0.2.1-rc.4 || 0.2.1-rc.5",
|
|
66
68
|
"@deepseek-ai/schemastery": "3.18.4",
|
|
67
69
|
"@types/react": "~18.3.1",
|
|
68
70
|
"react": "^18.2.0",
|