@huaweidevtools/aishell-dsh-client-credentials 0.0.1-beta.2 → 0.0.1-beta.4
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 +1 -1
- package/lib/client.js +333 -542
- package/lib/index.js +528 -121
- package/lib/types/auth-tool.d.ts +94 -0
- package/lib/types/client/AishellAccountHint.d.ts +10 -3
- package/lib/types/client/AishellHeroChip.d.ts +22 -11
- package/lib/types/client/CredentialFormInteraction.d.ts +4 -12
- package/lib/types/client/CredentialRequestForm.d.ts +53 -16
- package/lib/types/client/credential-form-visibility.d.ts +30 -17
- package/lib/types/client/credential-status.d.ts +5 -6
- package/lib/types/client/huawei-mark.d.ts +18 -6
- package/lib/types/client/index.d.ts +9 -5
- package/lib/types/client/locales.d.ts +14 -14
- package/lib/types/client/permission-mode.d.ts +3 -3
- package/lib/types/form-request.d.ts +118 -0
- package/lib/types/index.d.ts +13 -50
- package/lib/types/reconcile.d.ts +80 -0
- package/package.json +17 -14
- package/lib/types/client/AishellCredentialsSection.d.ts +0 -34
- package/lib/types/client/open-settings.d.ts +0 -27
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The credential form's Host-side control.
|
|
3
|
+
*
|
|
4
|
+
* ## What this is for
|
|
5
|
+
*
|
|
6
|
+
* `aishell__auth` needs credentials that are not there. It cannot collect them
|
|
7
|
+
* — a credential a tool returns is a credential in the transcript — so it asks
|
|
8
|
+
* for the form to be put on screen, the person fills it, and the model calls
|
|
9
|
+
* `auth` again.
|
|
10
|
+
*
|
|
11
|
+
* ## Why the settings document carries the request
|
|
12
|
+
*
|
|
13
|
+
* The two halves live apart: the tool runs on the host, the form is browser
|
|
14
|
+
* code. The host cannot reach the browser over the fetch channel — that channel
|
|
15
|
+
* is browser→host only — so the request has to ride something the browser
|
|
16
|
+
* already watches. The settings document is exactly that: the browser half
|
|
17
|
+
* subscribes to this entry's config through `configForms`, and a volatile field
|
|
18
|
+
* written by the host shows up there.
|
|
19
|
+
*
|
|
20
|
+
* The document carries **only** a request token and a session id. Never a
|
|
21
|
+
* credential, never a verdict — those travel the other way, over the
|
|
22
|
+
* credential route, and the browser never receives a stored secret at all.
|
|
23
|
+
*
|
|
24
|
+
* ## Why the token, not a boolean
|
|
25
|
+
*
|
|
26
|
+
* The browser has to tell "a new request" from "the request it already opened".
|
|
27
|
+
* With a boolean, a second `auth` failure while the form is up would look
|
|
28
|
+
* identical to the first and the form would not re-open after the person
|
|
29
|
+
* cancelled it. The token changes on every request, and the browser compares it
|
|
30
|
+
* to the last one it acted on.
|
|
31
|
+
*
|
|
32
|
+
* ## Why nothing is awaited
|
|
33
|
+
*
|
|
34
|
+
* The tool cannot wait for the person — a tool call has no way to be paused for
|
|
35
|
+
* a human. So `auth` fails, the form appears, and the model calls again. That
|
|
36
|
+
* round trip is the whole protocol, and it is why the failure message and the
|
|
37
|
+
* form are worded as a pair.
|
|
38
|
+
*
|
|
39
|
+
* @module @huaweidevtools/aishell-dsh-client-credentials/form-request
|
|
40
|
+
*/
|
|
41
|
+
/** Field of this entry's config that carries one pending request. */
|
|
42
|
+
export declare const FORM_REQUEST_FIELD = "credentialFormRequest";
|
|
43
|
+
/** What the browser reads out of that field. */
|
|
44
|
+
export interface CredentialFormRequest {
|
|
45
|
+
/**
|
|
46
|
+
* Identity of this request; a fresh value means "open the form again even if
|
|
47
|
+
* you opened one before".
|
|
48
|
+
*/
|
|
49
|
+
readonly token: string;
|
|
50
|
+
/** Conversation to render the form in. */
|
|
51
|
+
readonly sessionId: string;
|
|
52
|
+
}
|
|
53
|
+
/** Writes one path-addressed edit into this entry's settings document. */
|
|
54
|
+
export type RecordField = (value: string) => void;
|
|
55
|
+
/**
|
|
56
|
+
* How one form request ended.
|
|
57
|
+
*
|
|
58
|
+
* `submitted` carries no credential: the form posts to the credential route,
|
|
59
|
+
* which verifies and writes the store, so the tool reads the store afterwards.
|
|
60
|
+
* Nothing about this answer is secret, which is what lets it cross the host
|
|
61
|
+
* without a second review of the leak surface.
|
|
62
|
+
*/
|
|
63
|
+
export type FormOutcome =
|
|
64
|
+
/** The person submitted. The store may or may not hold a usable pair. */
|
|
65
|
+
{
|
|
66
|
+
readonly kind: 'submitted';
|
|
67
|
+
}
|
|
68
|
+
/** The person cancelled. */
|
|
69
|
+
| {
|
|
70
|
+
readonly kind: 'cancelled';
|
|
71
|
+
};
|
|
72
|
+
/**
|
|
73
|
+
* Build a request for one session, minting its token.
|
|
74
|
+
*
|
|
75
|
+
* The token is minted here rather than by the caller so a request cannot be
|
|
76
|
+
* recorded without one — the browser's "is this new?" test would then be
|
|
77
|
+
* comparing against nothing, and the form would not reopen after a cancel.
|
|
78
|
+
*
|
|
79
|
+
* @param sessionId - the conversation the form should render in.
|
|
80
|
+
* @returns the request, and its encoded form for the settings document.
|
|
81
|
+
*/
|
|
82
|
+
export declare function formRequest(sessionId: string): PendingFormRequest;
|
|
83
|
+
/**
|
|
84
|
+
* One request, and the promise its waiting caller is blocked on.
|
|
85
|
+
*
|
|
86
|
+
* The token is what a submit or a cancel names when it answers, so an answer
|
|
87
|
+
* for a superseded request cannot settle the current one.
|
|
88
|
+
*/
|
|
89
|
+
export interface PendingFormRequest {
|
|
90
|
+
readonly request: CredentialFormRequest;
|
|
91
|
+
readonly encoded: string;
|
|
92
|
+
/** Resolves when the person submits or cancels. */
|
|
93
|
+
readonly outcome: Promise<FormOutcome>;
|
|
94
|
+
/** Answer this request. Idempotent: a second call is ignored by `Promise`. */
|
|
95
|
+
readonly settle: (outcome: FormOutcome) => void;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Serialize a request for the settings document.
|
|
99
|
+
*
|
|
100
|
+
* The document holds strings — a volatile `string` field is what the browser
|
|
101
|
+
* half reads through `configForms` — so the request is JSON. Encoding rather
|
|
102
|
+
* than reshaping the config into several fields keeps the request atomic: the
|
|
103
|
+
* browser cannot observe a new token with an old session.
|
|
104
|
+
*
|
|
105
|
+
* @param request - the request to encode.
|
|
106
|
+
*/
|
|
107
|
+
export declare function encodeRequest(request: CredentialFormRequest): string;
|
|
108
|
+
/**
|
|
109
|
+
* Read a request back out of the document.
|
|
110
|
+
*
|
|
111
|
+
* Anything unreadable reads as no request: a corrupt field should show nothing,
|
|
112
|
+
* not open a form bound to a session that does not exist.
|
|
113
|
+
*
|
|
114
|
+
* @param raw - the stored string, if any.
|
|
115
|
+
* @returns the request, or `undefined` when there is none usable.
|
|
116
|
+
*/
|
|
117
|
+
export declare function decodeRequest(raw: string | undefined): CredentialFormRequest | undefined;
|
|
118
|
+
//# sourceMappingURL=form-request.d.ts.map
|
package/lib/types/index.d.ts
CHANGED
|
@@ -31,15 +31,15 @@ export interface Config {
|
|
|
31
31
|
/** Readable verification failure the client form displays; set when the IAM check rejects. */
|
|
32
32
|
lastError: Volatile<string>;
|
|
33
33
|
/**
|
|
34
|
-
*
|
|
34
|
+
* A pending request to open the credential form, or `''`.
|
|
35
35
|
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
36
|
+
* Written by `aishell__auth` when it finds no credentials; read by the
|
|
37
|
+
* browser half, which opens the form in the named session. A JSON token plus
|
|
38
|
+
* session id — see `./form-request.ts` for why it is a token and not a
|
|
39
|
+
* boolean, and why it travels the settings document rather than the fetch
|
|
40
|
+
* channel.
|
|
41
41
|
*/
|
|
42
|
-
|
|
42
|
+
credentialFormRequest: Volatile<string>;
|
|
43
43
|
}
|
|
44
44
|
/**
|
|
45
45
|
* Settings schema for this entry. Secrets are deliberately absent: they travel
|
|
@@ -50,50 +50,13 @@ export declare const Config: z<Schemastery.ObjectS<NoInfer<{
|
|
|
50
50
|
credentialsStored: z<boolean, boolean, "volatile-defined">;
|
|
51
51
|
accessKeyIdHint: z<string, string, "volatile-defined">;
|
|
52
52
|
lastError: z<string, string, "volatile-defined">;
|
|
53
|
-
|
|
53
|
+
credentialFormRequest: z<string, string, "volatile-defined">;
|
|
54
54
|
}>>, Schemastery.ObjectT<NoInfer<{
|
|
55
55
|
credentialsStored: z<boolean, boolean, "volatile-defined">;
|
|
56
56
|
accessKeyIdHint: z<string, string, "volatile-defined">;
|
|
57
57
|
lastError: z<string, string, "volatile-defined">;
|
|
58
|
-
|
|
58
|
+
credentialFormRequest: z<string, string, "volatile-defined">;
|
|
59
59
|
}>>, "plain">;
|
|
60
|
-
/**
|
|
61
|
-
* What the credential form collects, as the asking package expects it back.
|
|
62
|
-
*
|
|
63
|
-
* Declared here rather than imported from `aishell-ops-deploy`: the two
|
|
64
|
-
* packages communicate over a Cordis event, not an import (see the event
|
|
65
|
-
* declaration below), and the form has no business depending on the MCP
|
|
66
|
-
* plugin's types. The shape is the contract; both sides state it.
|
|
67
|
-
*
|
|
68
|
-
* No region: the credential store holds none, and the region belongs to
|
|
69
|
-
* whoever is calling. The asking package adds its own when the answer reaches
|
|
70
|
-
* it.
|
|
71
|
-
*/
|
|
72
|
-
interface SuppliedCredentials {
|
|
73
|
-
readonly ak: string;
|
|
74
|
-
readonly sk: string;
|
|
75
|
-
/** Present only for STS credentials. */
|
|
76
|
-
readonly securityToken?: string;
|
|
77
|
-
}
|
|
78
|
-
declare module '@deepseek-ai/cordis' {
|
|
79
|
-
interface Events {
|
|
80
|
-
/**
|
|
81
|
-
* The MCP server asked for credentials and the store has none: show the
|
|
82
|
-
* form, and call `settle` when the person is done.
|
|
83
|
-
*
|
|
84
|
-
* Declared (not imported) on both sides because it is the whole interface
|
|
85
|
-
* between the credentials UI and the MCP plugin — the same shape the
|
|
86
|
-
* permission switch's route uses, one step less direct.
|
|
87
|
-
*
|
|
88
|
-
* @mode emit
|
|
89
|
-
*/
|
|
90
|
-
'aishell/credential-request'(request: {
|
|
91
|
-
readonly settle: (credentials: SuppliedCredentials | undefined) => void;
|
|
92
|
-
readonly signal: AbortSignal | undefined;
|
|
93
|
-
readonly sessionId: string | undefined;
|
|
94
|
-
}): void;
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
60
|
declare module '@deepseek-ai/cordis' {
|
|
98
61
|
interface Events {
|
|
99
62
|
/**
|
|
@@ -122,9 +85,10 @@ export interface CredentialRoutesDeps {
|
|
|
122
85
|
/** Reads the cached account-name hint for the status response. */
|
|
123
86
|
readonly hint: () => string;
|
|
124
87
|
/**
|
|
125
|
-
* Announces that the stored credentials changed, so consumers that
|
|
126
|
-
*
|
|
127
|
-
* the store actually changed — a rejected save
|
|
88
|
+
* Announces that the stored credentials changed, so consumers that cached
|
|
89
|
+
* something derived from them (a resolved account identity, a sandbox key)
|
|
90
|
+
* can drop it. Called only after the store actually changed — a rejected save
|
|
91
|
+
* stores nothing and stays silent.
|
|
128
92
|
*/
|
|
129
93
|
readonly notifyChanged: () => void;
|
|
130
94
|
}
|
|
@@ -144,5 +108,4 @@ export declare function createCredentialRoutes(deps: CredentialRoutesDeps): {
|
|
|
144
108
|
export declare const name = "aishell-client-credentials";
|
|
145
109
|
export declare const inject: string[];
|
|
146
110
|
export declare function apply(ctx: Context, config: Config): void;
|
|
147
|
-
export {};
|
|
148
111
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Idempotent credential-status reconcile.
|
|
3
|
+
*
|
|
4
|
+
* The replacement for the old one-shot boot check in `apply()`. That check was
|
|
5
|
+
* an else-if chain: the "set `credentialsStored`" branch and the "verify and
|
|
6
|
+
* record the account name" branch were mutually exclusive, so on the boot where
|
|
7
|
+
* `credentialsStored` flipped to true the hint branch was unreachable — the
|
|
8
|
+
* account chips kept showing "unconfigured" until a second restart. Nothing
|
|
9
|
+
* ever re-read the store after boot either, so credentials written after boot
|
|
10
|
+
* (the env's `sync-hw-creds` writes them every minute) stayed invisible to the
|
|
11
|
+
* UI. Independent branches fix the former; the caller's timer and GET-route
|
|
12
|
+
* hook fix the latter.
|
|
13
|
+
*
|
|
14
|
+
* Kept as a factory — not inlined in `apply()` — so the whole decision table
|
|
15
|
+
* is drivable from a spec with a `MemoryBackend` and a fake verifier, never a
|
|
16
|
+
* real keyring or IAM call (see `docs/memory.md` §15).
|
|
17
|
+
*
|
|
18
|
+
* @module @huaweidevtools/aishell-dsh-client-credentials/reconcile
|
|
19
|
+
*/
|
|
20
|
+
import type { SignCredentials } from '@huaweidevtools/aishell-dsh-credentials-store/signer';
|
|
21
|
+
import type { SettingsPathOp } from '@deepseek-ai/dsh-settings';
|
|
22
|
+
/** One path-addressed status edit, shaped as `ctx.settings.mutate` takes. */
|
|
23
|
+
export type StatusOp = SettingsPathOp;
|
|
24
|
+
/** Records non-secret status the browser half reads; a refused write only logs. */
|
|
25
|
+
export type RecordStatus = (ops: readonly StatusOp[]) => void;
|
|
26
|
+
/** Verifies AK/SK (and optional token) against Huawei Cloud IAM; resolves the account name. */
|
|
27
|
+
export type VerifyCredentials = (ak: string, sk: string, token?: string) => Promise<string>;
|
|
28
|
+
/** Reads the recorded presence flag this plugin last wrote. */
|
|
29
|
+
export type ReadStored = () => boolean;
|
|
30
|
+
/** Reads the recorded account-name hint this plugin last wrote, or `null` when none. */
|
|
31
|
+
export type ReadHint = () => string | null;
|
|
32
|
+
/** Collaborators the reconciler runs against; injected so they are testable. */
|
|
33
|
+
export interface CredentialReconcilerDeps {
|
|
34
|
+
/** Verifies against IAM; resolves the account (domain) name. */
|
|
35
|
+
readonly verify: VerifyCredentials;
|
|
36
|
+
/** Records the non-secret status the browser half reads. */
|
|
37
|
+
readonly recordStatus: RecordStatus;
|
|
38
|
+
/** Read the recorded `credentialsStored` mirror this plugin owns. */
|
|
39
|
+
readonly readStored: ReadStored;
|
|
40
|
+
/** Read the recorded `accessKeyIdHint` mirror this plugin owns. */
|
|
41
|
+
readonly readHint: ReadHint;
|
|
42
|
+
/** Reads the stored pair; the bundle entry is decoded inside it. */
|
|
43
|
+
readonly readPair: () => SignCredentials | undefined;
|
|
44
|
+
}
|
|
45
|
+
/** The reconcile state machine; driven by a timer and the GET-route hook. */
|
|
46
|
+
export interface CredentialReconciler {
|
|
47
|
+
/**
|
|
48
|
+
* Re-derive the status from the store. Idempotent at steady state: when
|
|
49
|
+
* nothing changed it records nothing and verifies nothing. Call this on boot,
|
|
50
|
+
* on a timer, and on every GET to the status route.
|
|
51
|
+
*/
|
|
52
|
+
readonly reconcile: () => void;
|
|
53
|
+
/**
|
|
54
|
+
* Drop the verify baseline so an in-flight verification's late result is
|
|
55
|
+
* discarded. Call this from the `clear` route: a verify that resolves after
|
|
56
|
+
* the store was emptied must not record a hint for credentials that are gone.
|
|
57
|
+
*/
|
|
58
|
+
readonly resetVerifyBaseline: () => void;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Build the reconcile state machine.
|
|
62
|
+
*
|
|
63
|
+
* Two facts are reconciled independently, because they are independent:
|
|
64
|
+
* - `credentialsStored` — are AK/SK in the store right now?
|
|
65
|
+
* - `accessKeyIdHint` — what account name did IAM verification return?
|
|
66
|
+
*
|
|
67
|
+
* The hint is re-derived only when the credential material changed since the
|
|
68
|
+
* last verification. That single trigger covers both reasons to re-verify — a
|
|
69
|
+
* first-seen credential (the material has never been fingerprinted) and a
|
|
70
|
+
* rotation (the material differs from the last verified set) — and it keeps a
|
|
71
|
+
* failing verification (expired STS, IAM outage) from retrying every tick: the
|
|
72
|
+
* retry keys on the material changing, not on time alone, and a failed verify
|
|
73
|
+
* still records the fingerprint. Cleared by `resetVerifyBaseline` so a
|
|
74
|
+
* clear-then-rotate re-verifies from scratch.
|
|
75
|
+
*
|
|
76
|
+
* @param deps - collaborators. `readStored`/`readHint` read this plugin's own
|
|
77
|
+
* mirror so reconcile never depends on config flow-back timing.
|
|
78
|
+
*/
|
|
79
|
+
export declare function createCredentialReconciler(deps: CredentialReconcilerDeps): CredentialReconciler;
|
|
80
|
+
//# sourceMappingURL=reconcile.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@huaweidevtools/aishell-dsh-client-credentials",
|
|
3
|
-
"description": "AI Shell credentials
|
|
4
|
-
"version": "0.0.1-beta.
|
|
3
|
+
"description": "AI Shell credentials — chip-opened web form for storing Huawei Cloud AK/SK in the credential store",
|
|
4
|
+
"version": "0.0.1-beta.4",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
7
7
|
},
|
|
@@ -41,25 +41,28 @@
|
|
|
41
41
|
},
|
|
42
42
|
"license": "Apache-2.0",
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"@huaweidevtools/aishell-dsh-credentials-store": "0.0.1-beta.
|
|
44
|
+
"@huaweidevtools/aishell-dsh-credentials-store": "0.0.1-beta.4"
|
|
45
45
|
},
|
|
46
46
|
"peerDependencies": {
|
|
47
47
|
"@deepseek-ai/cordis": "^4.0.4",
|
|
48
|
-
"@deepseek-ai/dsh-
|
|
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
51
|
},
|
|
50
52
|
"devDependencies": {
|
|
51
53
|
"@deepseek-ai/cordis": "^4.0.4",
|
|
52
54
|
"@deepseek-ai/cordis-plugin-loader": "^1.0.5",
|
|
53
|
-
"@deepseek-ai/dsh-client-connection": "
|
|
54
|
-
"@deepseek-ai/dsh-client-locale": "
|
|
55
|
-
"@deepseek-ai/dsh-client-store": "
|
|
56
|
-
"@deepseek-ai/dsh-client-ui-conversation": "
|
|
57
|
-
"@deepseek-ai/dsh-client-ui-renderer": "
|
|
58
|
-
"@deepseek-ai/dsh-client-ui-session": "
|
|
59
|
-
"@deepseek-ai/dsh-client-ui-settings": "
|
|
60
|
-
"@deepseek-ai/dsh-client-ui-slots": "
|
|
61
|
-
"@deepseek-ai/dsh-session": "
|
|
62
|
-
"@deepseek-ai/dsh-settings": "
|
|
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-session": "0.2.0-rc.1 || 0.2.1-rc.1 || 0.2.1-rc.2 || 0.2.1",
|
|
64
|
+
"@deepseek-ai/dsh-settings": "0.2.0-rc.1 || 0.2.1-rc.1 || 0.2.1-rc.2 || 0.2.1",
|
|
65
|
+
"@deepseek-ai/dsh-tools": "0.2.0-rc.1 || 0.2.1-rc.1 || 0.2.1-rc.2 || 0.2.1",
|
|
63
66
|
"@deepseek-ai/schemastery": "3.18.4",
|
|
64
67
|
"@types/react": "~18.3.1",
|
|
65
68
|
"react": "^18.2.0",
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* AI Shell credentials settings section.
|
|
3
|
-
*
|
|
4
|
-
* Renders three password inputs (Access Key ID, Secret Access Key, optional
|
|
5
|
-
* Security Token) with a save button. The plaintext goes straight to the
|
|
6
|
-
* Host's authenticated credential route, which verifies it against Huawei
|
|
7
|
-
* Cloud IAM and transfers it into the credential store; the route answers with
|
|
8
|
-
* the verdict in that same round trip, so no polling is needed. Presence of
|
|
9
|
-
* already-stored credentials arrives through the `credentials` hooks
|
|
10
|
-
* compartment as the Host-written non-secret fields — values never cross the
|
|
11
|
-
* wire in either direction.
|
|
12
|
-
*/
|
|
13
|
-
import { type ReactNode } from 'react';
|
|
14
|
-
import type { SnapshotStore } from '@deepseek-ai/dsh-client-store';
|
|
15
|
-
import type { InjectFace, PropsLocale, PropsRuntime, TranslateNS } from '@deepseek-ai/dsh-client-ui-slots';
|
|
16
|
-
import { type CredentialStatus, type SaveVerdict } from './credential-status.ts';
|
|
17
|
-
/** Injected callbacks bound in apply() and spread as props by the renderer. */
|
|
18
|
-
export interface AishellCredentialsInjected {
|
|
19
|
-
hooks: {
|
|
20
|
-
/** Credential presence + verification verdict, rebound by the renderer as useCredentials. */
|
|
21
|
-
credentials: SnapshotStore<CredentialStatus>;
|
|
22
|
-
};
|
|
23
|
-
/** Translator bound to the `aishell` namespace. */
|
|
24
|
-
t: TranslateNS<'aishell'>;
|
|
25
|
-
/** Store AK/SK/SecurityToken through the Host credential route (Host verifies against IAM, then transfers to the credential store). */
|
|
26
|
-
save: (accessKeyId: string, secretAccessKey: string, securityToken?: string) => Promise<SaveVerdict>;
|
|
27
|
-
/** Clear all credentials from the credential store. */
|
|
28
|
-
clear: () => Promise<SaveVerdict>;
|
|
29
|
-
}
|
|
30
|
-
/** Full component props: section owner share + locale seat + inject face. */
|
|
31
|
-
export type AishellCredentialsSectionProps = PropsRuntime<'settings.section'> & PropsLocale<'aishell'> & InjectFace<AishellCredentialsInjected>;
|
|
32
|
-
/** Render the credentials form. */
|
|
33
|
-
export declare function AishellCredentialsSection(props: AishellCredentialsSectionProps): ReactNode;
|
|
34
|
-
//# sourceMappingURL=AishellCredentialsSection.d.ts.map
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Open DSH's Settings modal.
|
|
3
|
-
*
|
|
4
|
-
* DSH exposes no service API for this — the modal's open state is
|
|
5
|
-
* component-local inside `SettingsRoot`, toggled only by its trigger button.
|
|
6
|
-
* The trigger is the `button[aria-haspopup="dialog"]` inside the
|
|
7
|
-
* `[data-slot="sidebar.settings"]` outlet, which is a stable, slot-key + ARIA
|
|
8
|
-
* based selector rather than a hashed CSS-module class. Clicking it is the
|
|
9
|
-
* same gesture the sidebar gear makes.
|
|
10
|
-
*
|
|
11
|
-
* Shared by both credential chips so they cannot diverge; the hero chip opens
|
|
12
|
-
* Settings from the same affordance the composer chip uses.
|
|
13
|
-
*
|
|
14
|
-
* @module @huaweidevtools/aishell-dsh-client-credentials/client/open-settings
|
|
15
|
-
*/
|
|
16
|
-
/**
|
|
17
|
-
* Click DSH's Settings trigger on the user's behalf.
|
|
18
|
-
*
|
|
19
|
-
* A missing trigger is reported on the console rather than thrown. There is
|
|
20
|
-
* nothing to click when the sidebar has not mounted, and throwing inside a
|
|
21
|
-
* click handler would surface as an unhandled rejection; but staying silent
|
|
22
|
-
* would make a selector drift indistinguishable from a dead click, since a
|
|
23
|
-
* `??=`-style no-op leaves no trace anywhere. The warning is the only signal
|
|
24
|
-
* that this selector needs updating.
|
|
25
|
-
*/
|
|
26
|
-
export declare function openSettings(): void;
|
|
27
|
-
//# sourceMappingURL=open-settings.d.ts.map
|