@huaweidevtools/aishell-dsh-client-credentials 0.0.0-stage → 0.0.1-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,45 @@
1
+ /**
2
+ * Account hint chip rendered under the composer — shows the account name the
3
+ * Host's IAM verification wrote, so the user can see at a glance which account
4
+ * their chat is signed as, without opening Settings.
5
+ *
6
+ * Reads the non-secret `accessKeyIdHint` through the shared `credentials`
7
+ * hooks compartment (a snapshot store the browser half derives from the Host
8
+ * entry's config snapshot) — the full AK never reaches the browser. When no
9
+ * credentials are stored, a muted "未配置华为云 IAM 凭据" prompt takes the
10
+ * chip's place so the user knows to set up credentials before chatting.
11
+ *
12
+ * Layout note: the host renders this entry and ContextMeter (the "N turns /
13
+ * N steps" readout) as siblings inside one block-flow dock container. We
14
+ * promote that container to a flex row with `space-between` via a layout
15
+ * effect, so ContextMeter sits left and this chip sits right on the same
16
+ * row — without relying on float (which collapses the container height).
17
+ */
18
+ import { type ReactNode } from 'react';
19
+ import type { InjectFace, PropsRuntime, PropsLocale, TranslateNS } from '@deepseek-ai/dsh-client-ui-slots';
20
+ import type { CredentialStatus } from './credential-status.ts';
21
+ import type { SnapshotStore } from '@deepseek-ai/dsh-client-store';
22
+ /** Injected handle bound in apply(). */
23
+ export interface AishellAccountHintInjected {
24
+ hooks: {
25
+ /** Credential presence + account hint, rebound by the renderer as useCredentials. */
26
+ credentials: SnapshotStore<CredentialStatus>;
27
+ };
28
+ t: TranslateNS<'aishell'>;
29
+ }
30
+ /** Full component props: dock owner share + locale seat + inject face. */
31
+ export type AishellAccountHintProps = PropsRuntime<'conversation.composer.dock'> & PropsLocale<'aishell'> & InjectFace<AishellAccountHintInjected>;
32
+ /**
33
+ * Render the current account hint, or a setup prompt when credentials are
34
+ * absent. The hooks-compartment subscription keeps the chip live: saving
35
+ * credentials in Settings publishes a new snapshot through the shared store,
36
+ * and the chip updates in place without a remount — the prompt disappears
37
+ * the moment a hint lands.
38
+ *
39
+ * A layout effect promotes the host dock container (the parent element) to
40
+ * `display:flex; justify-content:space-between` so this chip shares a row
41
+ * with ContextMeter instead of stacking above it. The effect restores the
42
+ * original display on cleanup so it never leaks into other dock entries.
43
+ */
44
+ export declare function AishellAccountHint(props: AishellAccountHintProps): ReactNode;
45
+ //# sourceMappingURL=AishellAccountHint.d.ts.map
@@ -0,0 +1,34 @@
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
@@ -0,0 +1,43 @@
1
+ /**
2
+ * Compact account + permission chip for the New-Session hero row.
3
+ *
4
+ * The composer chip lives under the input bar, which DSH does not render until
5
+ * a session exists — its slot is guarded by `variant === "composer" && input
6
+ * !== undefined && sessionId !== undefined`. A New Session therefore showed
7
+ * neither the account nor the permission mode, which are exactly the two facts
8
+ * worth checking before sending the first message.
9
+ *
10
+ * This renders into `conversation.hero.workspace`, which sits in the hero row
11
+ * beside the workspace picker and the agent-preset control: the row is the
12
+ * New-Session settings row, and these are settings. DSH passes that slot the
13
+ * workspace picker's props (`open`, `anchorRef`, `onPick`, `onClose`) because
14
+ * a picker was the expected occupant; we ignore them, and nothing else
15
+ * registers there in 0.2.0-rc.1 — the picker itself is a separate hardcoded
16
+ * component (`WorkspaceChip`), not the slot.
17
+ *
18
+ * ## Relationship to the composer chip
19
+ *
20
+ * Both chips report the same two facts — which account the session is signed
21
+ * as, and whether mutations are allowed — and a person should not have to
22
+ * learn two shapes. They carry the same mark, the same colour pair, and the
23
+ * same two affordances (open Settings, toggle the mode); they differ only in
24
+ * the width each surface affords, which is why the hero chip clamps the
25
+ * account name with `maxWidth` instead of letting it run to the row's edge.
26
+ *
27
+ * @module @huaweidevtools/aishell-dsh-client-credentials/client/AishellHeroChip
28
+ */
29
+ import { type ReactNode } from 'react';
30
+ import type { InjectFace, PropsRuntime, PropsLocale } from '@deepseek-ai/dsh-client-ui-slots';
31
+ import type { CredentialStatus } from './credential-status.ts';
32
+ import type { SnapshotStore } from '@deepseek-ai/dsh-client-store';
33
+ /** Injected handle bound in apply(). */
34
+ export interface AishellHeroChipInjected {
35
+ hooks: {
36
+ /** Credential presence + account hint, rebound by the renderer as useCredentials. */
37
+ credentials: SnapshotStore<CredentialStatus>;
38
+ };
39
+ }
40
+ /** Full component props: slot owner share + locale seat + inject face. */
41
+ export type AishellHeroChipProps = PropsRuntime<'conversation.hero.workspace'> & PropsLocale<'aishell'> & InjectFace<AishellHeroChipInjected>;
42
+ export declare function AishellHeroChip(props: AishellHeroChipProps): ReactNode;
43
+ //# sourceMappingURL=AishellHeroChip.d.ts.map
@@ -0,0 +1,67 @@
1
+ /**
2
+ * The credential form's pending interaction.
3
+ *
4
+ * `conversation.composer` is a `chain` slot whose `select` receives the
5
+ * session's `pendingInteraction`, so a component can only take the composer
6
+ * over by publishing one. This is that object: it marks the form as the
7
+ * session's live interaction.
8
+ *
9
+ * Modelled on `dsh-client-ui-approval`'s `PendingApproval`: a request that
10
+ * outlives a render needs an identity the framework can key on (`key`), and a
11
+ * kind of its own (`kind`). Unlike the approval panel this one carries no
12
+ * promise — the answer travels over the ordinary credential route, so there is
13
+ * nothing here for the browser to resolve.
14
+ *
15
+ * @module @huaweidevtools/aishell-dsh-client-credentials/client/CredentialFormInteraction
16
+ */
17
+ import type { SessionId } from '@deepseek-ai/dsh-session';
18
+ /**
19
+ * One presentation of "the MCP server needs credentials".
20
+ *
21
+ * The `key` is opaque to the framework and only has to change when the
22
+ * presentation must remount; `kind` is this domain's own discriminator, which
23
+ * nothing outside reads.
24
+ *
25
+ * An interface plus a factory rather than a class: the browser half is
26
+ * compiled by oxc, and class syntax in that half has already tripped a
27
+ * compiler panic once (see `credential-form-visibility.ts`). A plain object
28
+ * carries the same two fields.
29
+ */
30
+ export interface CredentialFormInteraction {
31
+ /** Domain discriminator, for consumers that switch on interaction kind. */
32
+ readonly kind: 'aishell-credential-form';
33
+ /** Opaque render identity; a fresh key remounts the form (clearing it). */
34
+ readonly key: string;
35
+ /**
36
+ * The conversation the form belongs to. The slot is session-scoped, so this
37
+ * is what decides where the form appears. Sent by the Host as a plain
38
+ * string; branded by a cast (see the import note).
39
+ */
40
+ readonly sessionId: SessionId;
41
+ }
42
+ /**
43
+ * Build an interaction for one session.
44
+ *
45
+ * @param sessionId - the conversation the form belongs to.
46
+ */
47
+ export declare function credentialFormInteraction(sessionId: string): CredentialFormInteraction;
48
+ /**
49
+ * Test whether a pending interaction is this domain's form.
50
+ *
51
+ * The `select` in the composer chain needs a runtime check, and this is the one
52
+ * place that knows what makes one — a kind tag rather than `instanceof`, which
53
+ * a factory-produced object cannot offer.
54
+ *
55
+ * @param value - the session's pending interaction, or `undefined`.
56
+ */
57
+ export declare function isCredentialForm(value: unknown): value is CredentialFormInteraction;
58
+ /**
59
+ * Route the Host exposes to abandon a pending credential request.
60
+ *
61
+ * Sits with the other credential routes: `clear`, `reset`, and this one all end
62
+ * a credential state, and keeping them together is what makes the route table
63
+ * readable. Without it a person who does not want to enter credentials would
64
+ * leave the blocked tool call waiting until the turn ended.
65
+ */
66
+ export declare const DISMISS_ROUTE = "api/aishell/credentials/dismiss";
67
+ //# sourceMappingURL=CredentialFormInteraction.d.ts.map
@@ -0,0 +1,47 @@
1
+ /**
2
+ * The credential form, shown when the MCP server asks for credentials.
3
+ *
4
+ * A masked AK/SK form rendered into `conversation.composer`, taking over the
5
+ * input box the way the approval panel does. It appears when ops-deploy reports
6
+ * the server is waiting for credentials, and submits through the same Host
7
+ * credential route the Settings section uses — so IAM verification, storage,
8
+ * and the account chip all behave identically, and there is one place where a
9
+ * credential is validated regardless of which surface collected it.
10
+ *
11
+ * ## Why the composer and not a modal
12
+ *
13
+ * The tool call is blocked on this answer, so the form belongs where the
14
+ * person's attention already is and where they act: the composer. It is the
15
+ * same seat the approval panel uses for the same reason — an out-of-band
16
+ * request that must be answered before work continues.
17
+ *
18
+ * ## Why masked inputs are not optional
19
+ *
20
+ * A secret key typed into a plain field is a secret on screen — in a
21
+ * screenshot, a screen-share, or over a shoulder. `type="password"` is the
22
+ * whole reason this form exists instead of reusing the question composer, whose
23
+ * free-text field is a plain `<textarea>`.
24
+ *
25
+ * @module @huaweidevtools/aishell-dsh-client-credentials/client/CredentialRequestForm
26
+ */
27
+ import { type ReactNode } from 'react';
28
+ import type { InjectFace, PropsRuntime, PropsLocale } from '@deepseek-ai/dsh-client-ui-slots';
29
+ import { type SaveVerdict } from './credential-status.ts';
30
+ /** Injected handle bound in apply(). */
31
+ export interface CredentialRequestFormInjected {
32
+ /** Store AK/SK/SecurityToken through the Host credential route. */
33
+ save: (accessKeyId: string, secretAccessKey: string, securityToken?: string) => Promise<SaveVerdict>;
34
+ /** Tell the Host the form is done, so the waiting tool call can resume or fail. */
35
+ dismiss: () => void;
36
+ }
37
+ /** Full component props: composer owner share + locale seat + inject face. */
38
+ export type CredentialRequestFormProps = PropsRuntime<'conversation.composer'> & PropsLocale<'aishell'> & InjectFace<CredentialRequestFormInjected>;
39
+ /**
40
+ * The masked credential form.
41
+ *
42
+ * Submitting saves through the Host route; the Host then tells the waiting tool
43
+ * call there is now a credential, and clears the pending flag this component
44
+ * renders from — so a successful submit does not need to unmount itself.
45
+ */
46
+ export declare function CredentialRequestForm(props: CredentialRequestFormProps): ReactNode;
47
+ //# sourceMappingURL=CredentialRequestForm.d.ts.map
@@ -0,0 +1,51 @@
1
+ /**
2
+ * Decides when the credential form is up.
3
+ *
4
+ * Kept out of the plugin body because it is the part that is easy to get
5
+ * wrong and impossible to see going wrong: an interaction that is published
6
+ * and never withdrawn leaves the form on screen over a request that no longer
7
+ * exists, and nothing throws. The plugin body wires this to the slot
8
+ * registry; this module holds only the decision.
9
+ *
10
+ * The Host is the source of truth. It publishes which session is waiting
11
+ * (`''` when none is), and this mirrors that into the one interaction the
12
+ * composer chain selects on.
13
+ *
14
+ * ## Why a closure and not a class
15
+ *
16
+ * Written as a factory because the browser half is compiled by oxc, and a
17
+ * class with private (`#`) fields makes that compiler panic
18
+ * (`oxc_transformer ... es2022/class_properties/class_details.rs:138:
19
+ * internal error: entered unreachable code`), which fails the CJS build and
20
+ * leaves `lib/client.js` unwritten — DSH then refuses to start. The state here
21
+ * is two variables either way, so the closure costs nothing and cannot trip it.
22
+ *
23
+ * @module @huaweidevtools/aishell-dsh-client-credentials/client/credential-form-visibility
24
+ */
25
+ import { type CredentialFormInteraction } from './CredentialFormInteraction.ts';
26
+ /** Publishes one interaction and returns the function that withdraws it. */
27
+ export type PublishInteraction = (interaction: CredentialFormInteraction) => () => void;
28
+ /** Mirrors "which session is waiting" onto the composer's pending interaction. */
29
+ export interface CredentialFormVisibility {
30
+ /**
31
+ * Apply the Host's current state.
32
+ *
33
+ * Idempotent: calling it with the state it already reflects changes nothing,
34
+ * which is what keeps a re-render from remounting the form and discarding
35
+ * what the person typed.
36
+ *
37
+ * @param sessionId - the session waiting for credentials, or `''` for none.
38
+ */
39
+ readonly sync: (sessionId: string) => void;
40
+ /** The interaction currently published, if any. For tests and diagnostics. */
41
+ readonly current: () => CredentialFormInteraction | undefined;
42
+ /** Withdraw any open form. Called when the plugin fiber is disposed. */
43
+ readonly dispose: () => void;
44
+ }
45
+ /**
46
+ * Build the visibility state machine.
47
+ *
48
+ * @param publish - how to put an interaction in front of the composer.
49
+ */
50
+ export declare function createCredentialFormVisibility(publish: PublishInteraction): CredentialFormVisibility;
51
+ //# sourceMappingURL=credential-form-visibility.d.ts.map
@@ -0,0 +1,53 @@
1
+ /**
2
+ * Credential vocabulary shared by the two forms that collect a credential.
3
+ *
4
+ * This module holds the parts of the credential UI that are not one component's
5
+ * presentation: the presence descriptor the Host reports, the verdict its route
6
+ * answers with, and the link to where a credential comes from.
7
+ *
8
+ * ## Why it exists
9
+ *
10
+ * Four modules need these, and every one of them used to reach into
11
+ * `AishellCredentialsSection.tsx` for them — two chips and the composer form
12
+ * importing from a component they do not render. That file is one surface's
13
+ * presentation; a shared contract living there makes the dependency arrow point
14
+ * the wrong way, and it means editing a component's imports to move a constant
15
+ * neither component owns. Same reasoning as `huawei-mark.ts` and `open-settings.ts`:
16
+ * the second consumer is when the shared part earns its own module.
17
+ *
18
+ * The paragraph that follows each is the contract the Host half implements; it
19
+ * is stated here because this file is now where both sides read it.
20
+ *
21
+ * @module @huaweidevtools/aishell-dsh-client-credentials/client/credential-status
22
+ */
23
+ /** Credential presence descriptor (values never cross the wire). */
24
+ export interface CredentialStatus {
25
+ readonly hasAccessKey: boolean;
26
+ readonly hasSecretKey: boolean;
27
+ readonly hasSecurityToken: boolean;
28
+ readonly accessKeyIdHint: string;
29
+ readonly lastError: string;
30
+ }
31
+ /** Verdict the Host credential route returns for a save or clear. */
32
+ export interface SaveVerdict {
33
+ readonly ok: boolean;
34
+ /** Verified account name; present only on success. */
35
+ readonly accountName?: string;
36
+ /** User-readable failure; present only on rejection. */
37
+ readonly error?: string;
38
+ }
39
+ /**
40
+ * Where a user obtains credentials.
41
+ *
42
+ * API Explorer's page for `CreateTemporaryAccessKeyByToken` — the operation
43
+ * that mints a temporary AK/SK/security-token triple from an IAM token. Linked
44
+ * from both forms because the alternative, a permanent access key created in
45
+ * "My Credentials", has no expiry and cannot be scoped down; steering users to
46
+ * the temporary kind is the point of showing this at all.
47
+ *
48
+ * Not fetched or validated at build time: it is a console URL whose content
49
+ * changes independently of this plugin, and a stale check would be worse than
50
+ * none.
51
+ */
52
+ export declare const CREDENTIAL_URL = "https://console.huaweicloud.com/apiexplorer/#/openapi/IAM/doc?version=v3&api=CreateTemporaryAccessKeyByToken";
53
+ //# sourceMappingURL=credential-status.d.ts.map
@@ -0,0 +1,37 @@
1
+ /**
2
+ * The Huawei mark and its brand colour, shared by both credential chips.
3
+ *
4
+ * Extracted so the composer chip and the hero chip cannot drift apart: they
5
+ * report the same thing, and a colour or path change in one must not leave the
6
+ * other behind.
7
+ *
8
+ * @module @huaweidevtools/aishell-dsh-client-credentials/client/huawei-mark
9
+ */
10
+ /** Huawei logo path (from simple-icons/huawei), drawn in a 24×24 viewBox. */
11
+ export declare const HUAWEI_LOGO_PATH = "M3.67 6.14S1.82 7.91 1.72 9.78v.35c.08 1.51 1.22 2.4 1.22 2.4 1.83 1.79 6.26 4.04 7.3 4.55 0 0 .06.03.1-.01l.02-.04v-.04C7.52 10.8 3.67 6.14 3.67 6.14zM9.65 18.6c-.02-.08-.1-.08-.1-.08l-7.38.26c.8 1.43 2.15 2.53 3.56 2.2.96-.25 3.16-1.78 3.88-2.3.06-.05.04-.09.04-.09zm.08-.78C6.49 15.63.21 12.28.21 12.28c-.15.46-.2.9-.21 1.3v.07c0 1.07.4 1.82.4 1.82.8 1.69 2.34 2.2 2.34 2.2.7.3 1.4.31 1.4.31.12.02 4.4 0 5.54 0 .05 0 .08-.05.08-.05v-.06c0-.03-.03-.05-.03-.05zM9.06 3.19a3.42 3.42 0 00-2.57 3.15v.41c.03.6.16 1.05.16 1.05.66 2.9 3.86 7.65 4.55 8.65.05.05.1.03.1.03a.1.1 0 00.06-.1c1.06-10.6-1.11-13.42-1.11-13.42-.32.02-1.19.23-1.19.23zm8.299 2.27s-.49-1.8-2.44-2.28c0 0-.57-.14-1.17-.22 0 0-2.18 2.81-1.12 13.43.01.07.06.08.06.08.07.03.1-.03.1-.03.72-1.03 3.9-5.76 4.55-8.64 0 0 .36-1.4.02-2.34zm-2.92 13.07s-.07 0-.09.05c0 0-.01.07.03.1.7.51 2.85 2 3.88 2.3 0 0 .16.05.43.06h.14c.69-.02 1.9-.37 3-2.26l-7.4-.25zm7.83-8.41c.14-2.06-1.94-3.97-1.94-3.98 0 0-3.85 4.66-6.67 10.8 0 0-.03.08.02.13l.04.01h.06c1.06-.53 5.46-2.77 7.28-4.54 0 0 1.15-.93 1.21-2.42zm1.52 2.14s-6.28 3.37-9.52 5.55c0 0-.05.04-.03.11 0 0 .03.06.07.06 1.16 0 5.56 0 5.67-.02 0 0 .57-.02 1.27-.29 0 0 1.56-.5 2.37-2.27 0 0 .73-1.45.17-3.14z";
12
+ /**
13
+ * Huawei brand red, rgb(207, 10, 44).
14
+ *
15
+ * A literal rather than a theme token: the theme's alias set carries no brand
16
+ * or danger colour (checked — no `danger`/`error`/`critical` alias exists), so
17
+ * there is nothing to reference and the value does not follow light/dark. It
18
+ * is the brand mark's own colour, so it is meant to stay fixed.
19
+ */
20
+ export declare const HUAWEI_RED = "rgb(207, 10, 44)";
21
+ /**
22
+ * Class carried by the clickable account-name control on both chips.
23
+ *
24
+ * A class rather than inline styles because `:hover` and `:focus-visible`
25
+ * cannot be expressed inline, and the two chips must look identical on both.
26
+ */
27
+ export declare const CHIP_CLASS = "aishell-account-hint";
28
+ /**
29
+ * Inject the hover/focus rule once per document.
30
+ *
31
+ * The background token matches what the ContextMeter trigger and the sidebar
32
+ * gear pill use on hover, so the affordance reads the same as the rest of the
33
+ * chrome. Guarded by an id check so a second mount (or the other chip) does
34
+ * not duplicate the rule.
35
+ */
36
+ export declare function ensureChipStyles(): void;
37
+ //# sourceMappingURL=huawei-mark.d.ts.map
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Browser-half entry: registers the AI Shell credentials section into the
3
+ * web Settings page, plus the account hint chip under the composer.
4
+ *
5
+ * Secrets never travel through the settings document. The section POSTs the
6
+ * plaintext to the Host's authenticated credential route
7
+ * (`api/aishell/credentials`), where it is verified against Huawei Cloud IAM
8
+ * and transferred into the credential store; the route answers with the
9
+ * verdict in the same round trip. Only the non-secret presence flag and the
10
+ * verified account name come back through `ctx.configForms`, which the section
11
+ * and the composer chip read.
12
+ *
13
+ * @module @huaweidevtools/aishell-dsh-client-credentials/client
14
+ */
15
+ import type { Context as ClientContext } from '@deepseek-ai/cordis';
16
+ /** Required services. */
17
+ export declare const inject: string[];
18
+ export declare function apply(ctx: ClientContext): void;
19
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,83 @@
1
+ /**
2
+ * aishell credentials locale dictionaries.
3
+ *
4
+ * @module @huaweidevtools/aishell-dsh-client-credentials/client/locales
5
+ */
6
+ /** Dictionary namespace owned by this plugin. */
7
+ export declare const NS: "aishell";
8
+ /** Simplified Chinese dictionary (the key-set source of truth). */
9
+ export declare const zh: {
10
+ readonly 'account.unconfigured': "未配置华为云 IAM 凭据";
11
+ readonly 'mode.readonly': "只读";
12
+ readonly 'mode.readwrite': "读写";
13
+ readonly 'mode.unavailable': "权限模式不可用";
14
+ readonly 'mode.readonly.hint': "当前:只读 — 只允许查询云资源,点击切换为读写";
15
+ readonly 'mode.readwrite.hint': "当前:读写 — 允许变更云资源,点击切换为只读";
16
+ readonly 'mode.unavailable.hint': "无法从 MCP 服务器读取权限模式;切换按钮暂不可用";
17
+ readonly 'mode.switchToReadonly': "切换为只读模式";
18
+ readonly 'mode.switchToReadwrite': "切换为读写模式";
19
+ readonly 'section.settings.summary': "华为云 AI Shell 设置。";
20
+ readonly 'section.credentials.title': "凭据";
21
+ readonly 'section.credentials.hint.prefix': "需要进行华为云 IAM 认证,建议从";
22
+ readonly 'section.credentials.hint.link': "API Explorer";
23
+ readonly 'section.credentials.hint.suffix': "获取临时凭据,避免使用永久凭据。";
24
+ readonly 'section.credentials.saved': "校验通过,已存入 keyring。";
25
+ readonly 'section.credentials.save': "保存";
26
+ readonly 'section.credentials.saving': "保存中…";
27
+ readonly 'section.credentials.clear': "清除";
28
+ readonly 'form.title': "需要华为云凭据";
29
+ readonly 'form.submit': "提交";
30
+ readonly 'form.dismiss': "取消";
31
+ readonly 'form.failed': "保存凭据失败";
32
+ readonly 'section.field.accessKey': "Access Key";
33
+ readonly 'section.field.accessKey.placeholder': "华为云 Access Key";
34
+ readonly 'section.field.accessKey.hint': "Access Key 与 Secret Key 须同时填写,只填其一时不会保存。";
35
+ readonly 'section.field.secretKey': "Secret Key";
36
+ readonly 'section.field.secretKey.placeholder': "华为云 Secret Key";
37
+ readonly 'section.field.secretKey.hint': "与 Access Key 配对使用,不在任何界面回显。";
38
+ readonly 'section.field.token': "Security Token(可选)";
39
+ readonly 'section.field.token.placeholder': "华为云 Security Token";
40
+ readonly 'section.field.token.hint': "仅临时凭据需要填写。";
41
+ };
42
+ /** English dictionary. */
43
+ export declare const en: {
44
+ readonly 'account.unconfigured': "No Huawei Cloud IAM credentials";
45
+ readonly 'mode.readonly': "Read-only";
46
+ readonly 'mode.readwrite': "Read-write";
47
+ readonly 'mode.unavailable': "Mode unavailable";
48
+ readonly 'mode.readonly.hint': "Read-only — cloud queries only. Click for read-write";
49
+ readonly 'mode.readwrite.hint': "Read-write — cloud changes allowed. Click for read-only";
50
+ readonly 'mode.unavailable.hint': "Could not read the permission mode from the MCP server; the toggle is unavailable";
51
+ readonly 'mode.switchToReadonly': "Switch to read-only mode";
52
+ readonly 'mode.switchToReadwrite': "Switch to read-write mode";
53
+ readonly 'section.settings.summary': "Huawei Cloud AI Shell settings.";
54
+ readonly 'section.credentials.title': "Credentials";
55
+ readonly 'section.credentials.hint.prefix': "Authenticate against Huawei Cloud IAM. Obtain temporary credentials from";
56
+ readonly 'section.credentials.hint.link': "API Explorer";
57
+ readonly 'section.credentials.hint.suffix': "and avoid permanent ones.";
58
+ readonly 'section.credentials.saved': "Verified and saved to keyring.";
59
+ readonly 'section.credentials.save': "Save";
60
+ readonly 'section.credentials.saving': "Saving…";
61
+ readonly 'section.credentials.clear': "Clear";
62
+ readonly 'form.title': "Huawei Cloud credentials required";
63
+ readonly 'form.submit': "Submit";
64
+ readonly 'form.dismiss': "Cancel";
65
+ readonly 'form.failed': "Could not save credentials";
66
+ readonly 'section.field.accessKey': "Access Key";
67
+ readonly 'section.field.accessKey.placeholder': "Huawei Access Key";
68
+ readonly 'section.field.accessKey.hint': "Access Key and Secret Key are stored as a pair; one without the other is not saved.";
69
+ readonly 'section.field.secretKey': "Secret Key";
70
+ readonly 'section.field.secretKey.placeholder': "Huawei Secret Key";
71
+ readonly 'section.field.secretKey.hint': "Used together with the Access Key; never displayed again.";
72
+ readonly 'section.field.token': "Security Token (optional)";
73
+ readonly 'section.field.token.placeholder': "Huawei Security Token";
74
+ readonly 'section.field.token.hint': "Required only for temporary credentials.";
75
+ };
76
+ /** All keys (derived from the zh dictionary, the source of truth). */
77
+ export type AishellLocaleKey = keyof typeof zh;
78
+ declare module '@deepseek-ai/dsh-client-ui-slots' {
79
+ interface LocaleNamespaceMap {
80
+ aishell: AishellLocaleKey;
81
+ }
82
+ }
83
+ //# sourceMappingURL=locales.d.ts.map
@@ -0,0 +1,27 @@
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
@@ -0,0 +1,53 @@
1
+ /**
2
+ * Client half of the permission-mode switch, shared by both chips.
3
+ *
4
+ * The mode lives in the MCP server process, not in DSH. A Host route relays to
5
+ * it over the plugin's own MCP connection; this module owns the fetch and the
6
+ * state hook so the composer chip and the hero chip cannot drift apart.
7
+ *
8
+ * @module @huaweidevtools/aishell-dsh-client-credentials/client/permission-mode
9
+ */
10
+ /**
11
+ * Host permission route, written document-relative for the same reason as the
12
+ * credential route: the served index carries `<base href="./">`, so the
13
+ * request lands on the origin that holds the browser session cookie the
14
+ * route's authentication fence requires.
15
+ */
16
+ export declare const PERMISSION_ROUTE = "api/aishell/permission";
17
+ /** The two modes, as the server spells them. */
18
+ export type PermissionMode = 'read_only' | 'read_write';
19
+ /**
20
+ * Read the current mode from the Host route.
21
+ *
22
+ * @returns the mode, or `undefined` when it could not be read — a broken link
23
+ * must not be rendered as a working lock, so an unreadable mode is
24
+ * reported as unknown, never as `read_only`.
25
+ */
26
+ export declare function readPermissionMode(): Promise<PermissionMode | undefined>;
27
+ /**
28
+ * Write the mode through the Host route.
29
+ *
30
+ * @param mode - the mode to apply.
31
+ * @returns the mode the server reports afterwards, or `undefined` on failure.
32
+ */
33
+ export declare function writePermissionMode(mode: PermissionMode): Promise<PermissionMode | undefined>;
34
+ /** State and toggle for a permission-mode control. */
35
+ export interface PermissionModeControl {
36
+ /** Mode in effect, or `undefined` while unknown. */
37
+ readonly mode: PermissionMode | undefined;
38
+ /** True while a write is in flight. */
39
+ readonly busy: boolean;
40
+ /** Flip to the other mode. No-op while unknown or busy. */
41
+ readonly toggle: () => void;
42
+ }
43
+ /**
44
+ * Subscribe a control to the permission mode.
45
+ *
46
+ * Reads once on mount. The mode is server state that only a person changes, so
47
+ * there is no poll — a second surface flipping it is not a case this handles;
48
+ * each surface re-reads on its own mount.
49
+ *
50
+ * @returns the current mode, a busy flag, and the toggle.
51
+ */
52
+ export declare function usePermissionMode(): PermissionModeControl;
53
+ //# sourceMappingURL=permission-mode.d.ts.map