@huaweidevtools/aishell-dsh-deploy 0.0.20 → 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
@@ -7,7 +7,7 @@ import { fileURLToPath } from "node:url";
7
7
  import { dshHome } from "@huaweidevtools/aishell-dsh-credentials-store/paths";
8
8
  import { spawn } from "node:child_process";
9
9
  import { homedir, tmpdir } from "node:os";
10
- import { readStoredPair } from "@huaweidevtools/aishell-dsh-credentials-store/accounts";
10
+ import { clearCredentials, readStoredPair } from "@huaweidevtools/aishell-dsh-credentials-store/accounts";
11
11
  import { verifyCredentials } from "@huaweidevtools/aishell-dsh-credentials-store/verify";
12
12
  import { createHash, createHmac } from "node:crypto";
13
13
  import { createRequire } from "node:module";
@@ -1691,7 +1691,7 @@ function withAnchoredPaths(args, ctx) {
1691
1691
  * written by earlier releases carry it — so it is kept even though there is no
1692
1692
  * server.
1693
1693
  */
1694
- const SERVER_VERSION = "aishell-deploy 0.0.20";
1694
+ const SERVER_VERSION = "aishell-deploy 0.0.21";
1695
1695
 
1696
1696
  //#endregion
1697
1697
  //#region src/deployment-state.ts
@@ -2019,6 +2019,7 @@ async function loadAccount() {
2019
2019
  const result = await verifyCredentials(credentials, { region: "global" });
2020
2020
  if (!result.ok) {
2021
2021
  if (result.status === 0 || result.status >= 500) throw new Error(`${result.message} The stored credentials were not rejected — retry.`);
2022
+ source?.onRejected?.();
2022
2023
  return void 0;
2023
2024
  }
2024
2025
  cachedAccount = {
@@ -10679,6 +10680,11 @@ function apply(ctx, config) {
10679
10680
  store,
10680
10681
  get region() {
10681
10682
  return config.defaultRegion.get();
10683
+ },
10684
+ onRejected: () => {
10685
+ clearCredentials(store);
10686
+ forgetAccount();
10687
+ ctx.emit("aishell/credentials-updated");
10682
10688
  }
10683
10689
  });
10684
10690
  const { registrar, captured } = createRegistrar();
@@ -72,6 +72,21 @@ export interface CredentialSource {
72
72
  readonly store: CredentialsStore;
73
73
  /** The fallback region an operator configured, if any. */
74
74
  readonly region?: string | undefined;
75
+ /**
76
+ * Told when IAM refuses the stored credential.
77
+ *
78
+ * A tool call reaching IAM and being refused is the FASTEST evidence this
79
+ * plugin can get that the credential has stopped working — faster than any
80
+ * poll, because it happens exactly when someone is waiting. The owner of the
81
+ * store is the only party that can act on it: it clears the pair and tells
82
+ * the interface, which is what returns the credential card to its
83
+ * not-signed-in state.
84
+ *
85
+ * Not called for a transient failure. `status === 0` and a 5xx mean the
86
+ * question never reached IAM, and clearing on those would log a person out
87
+ * because their network blipped.
88
+ */
89
+ readonly onRejected?: () => void;
75
90
  }
76
91
  /**
77
92
  * Bind the credential source. Called once from the plugin's `apply()`.
@@ -18,5 +18,5 @@
18
18
  * written by earlier releases carry it — so it is kept even though there is no
19
19
  * server.
20
20
  */
21
- export declare const SERVER_VERSION = "aishell-deploy 0.0.20";
21
+ export declare const SERVER_VERSION = "aishell-deploy 0.0.21";
22
22
  //# sourceMappingURL=version.d.ts.map
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@huaweidevtools/aishell-dsh-deploy",
3
3
  "description": "Huawei Cloud infrastructure tools for DSH — Terraform, OpenAPI, resource inventory, cost estimates",
4
- "version": "0.0.20",
4
+ "version": "0.0.21",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
@@ -31,7 +31,7 @@
31
31
  "hcl2-parser": "^1.0.3",
32
32
  "jsonpath-plus": "^10.4.0",
33
33
  "zod": "^4.2.0",
34
- "@huaweidevtools/aishell-dsh-credentials-store": "0.0.20"
34
+ "@huaweidevtools/aishell-dsh-credentials-store": "0.0.21"
35
35
  },
36
36
  "peerDependencies": {
37
37
  "@deepseek-ai/cordis": "^4.0.4",