@huaweidevtools/aishell-dsh-client-credentials 0.0.19 → 0.0.21

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/index.js CHANGED
@@ -1001,6 +1001,7 @@ async function runAuth(store, deps, sessionId, signal) {
1001
1001
  if (stored !== void 0) {
1002
1002
  const verified = await verifyCredentials(stored, { region: VERIFY_REGION$1 });
1003
1003
  if (verified.ok) return describeAccount(verified);
1004
+ if (verified.status === 401 || verified.status === 403) deps.discard();
1004
1005
  }
1005
1006
  if (sessionId === void 0 || sessionId === "") throw new Error("Not authenticated with Huawei Cloud IAM, and this call is not attached to a conversation, so the credential form cannot be shown. Ask the user to open the credential form themselves, then call auth again.");
1006
1007
  for (let round = 0; round < MAX_FORM_ROUNDS; round += 1) {
@@ -2898,6 +2899,18 @@ function apply(ctx, config) {
2898
2899
  releaseForm: () => {
2899
2900
  settleFormRequest({ kind: "cancelled" });
2900
2901
  loginFlow.cancel();
2902
+ },
2903
+ discard: () => {
2904
+ clearCredentials(store);
2905
+ recordStatus([{
2906
+ op: "set",
2907
+ path: ["credentialsStored"],
2908
+ value: false
2909
+ }, {
2910
+ op: "unset",
2911
+ path: ["accessKeyIdHint"]
2912
+ }]);
2913
+ announceCredentialsChanged();
2901
2914
  }
2902
2915
  });
2903
2916
  ctx.effect(() => ctx.settings.configure({ auto: false }, ctx.fiber));
@@ -103,6 +103,17 @@ export interface AuthToolDeps {
103
103
  * an error, which is exactly why nothing else remembers to do this.
104
104
  */
105
105
  readonly releaseForm: () => void;
106
+ /**
107
+ * Remove the stored pair and tell the interface.
108
+ *
109
+ * Called when IAM refuses the pair this call was holding. The refusal is the
110
+ * fastest evidence the credential has stopped working — a temporary token
111
+ * expired, or a key deleted in the console — and both make re-entering the
112
+ * SAME pair useless. Clearing first is what turns the next form into "sign
113
+ * in from scratch" instead of a signed-in card whose only button does
114
+ * nothing.
115
+ */
116
+ readonly discard: () => void;
106
117
  }
107
118
  /**
108
119
  * Register the `auth` tool on the host's tool registry.
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.19",
4
+ "version": "0.0.21",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
@@ -42,30 +42,30 @@
42
42
  },
43
43
  "license": "Apache-2.0",
44
44
  "dependencies": {
45
- "@huaweidevtools/aishell-dsh-credentials-store": "0.0.19"
45
+ "@huaweidevtools/aishell-dsh-credentials-store": "0.0.21"
46
46
  },
47
47
  "peerDependencies": {
48
48
  "@deepseek-ai/cordis": "^4.0.4",
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 || 0.2.2-rc.1",
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 || 0.2.2-rc.1",
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 || 0.2.2-rc.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 || 0.2.2-rc.1 || 0.2.2-rc.2",
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 || 0.2.2-rc.1 || 0.2.2-rc.2",
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 || 0.2.2-rc.1 || 0.2.2-rc.2"
52
52
  },
53
53
  "devDependencies": {
54
54
  "@deepseek-ai/cordis": "^4.0.4",
55
55
  "@deepseek-ai/cordis-plugin-loader": "^1.0.5",
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 || 0.2.2-rc.1",
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 || 0.2.2-rc.1",
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 || 0.2.2-rc.1",
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 || 0.2.2-rc.1",
60
- "@deepseek-ai/dsh-client-ui-primitives": "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 || 0.2.2-rc.1",
61
- "@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 || 0.2.2-rc.1",
62
- "@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 || 0.2.2-rc.1",
63
- "@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 || 0.2.2-rc.1",
64
- "@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 || 0.2.2-rc.1",
65
- "@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 || 0.2.2-rc.1",
66
- "@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 || 0.2.2-rc.1",
67
- "@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 || 0.2.2-rc.1",
68
- "@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 || 0.2.2-rc.1",
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 || 0.2.2-rc.1 || 0.2.2-rc.2",
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 || 0.2.2-rc.1 || 0.2.2-rc.2",
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 || 0.2.2-rc.1 || 0.2.2-rc.2",
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 || 0.2.2-rc.1 || 0.2.2-rc.2",
60
+ "@deepseek-ai/dsh-client-ui-primitives": "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 || 0.2.2-rc.1 || 0.2.2-rc.2",
61
+ "@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 || 0.2.2-rc.1 || 0.2.2-rc.2",
62
+ "@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 || 0.2.2-rc.1 || 0.2.2-rc.2",
63
+ "@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 || 0.2.2-rc.1 || 0.2.2-rc.2",
64
+ "@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 || 0.2.2-rc.1 || 0.2.2-rc.2",
65
+ "@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 || 0.2.2-rc.1 || 0.2.2-rc.2",
66
+ "@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 || 0.2.2-rc.1 || 0.2.2-rc.2",
67
+ "@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 || 0.2.2-rc.1 || 0.2.2-rc.2",
68
+ "@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 || 0.2.2-rc.1 || 0.2.2-rc.2",
69
69
  "@deepseek-ai/schemastery": "3.18.4",
70
70
  "@types/react": "~18.3.1",
71
71
  "react": "^18.2.0",