@hadooppei/hwcode 1.0.6 → 1.0.7
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.
|
@@ -194,17 +194,23 @@ export function activationPrompt(state: WorkflowState): string {
|
|
|
194
194
|
`;
|
|
195
195
|
}
|
|
196
196
|
|
|
197
|
+
let approvalQueue = Promise.resolve();
|
|
197
198
|
export async function approveOperation(operation: CloudOperation, params: { command: string; args: string[]; intent: string }, state: WorkflowState, ctx: ExtensionContext): Promise<"allow" | "allow-session" | "deny"> {
|
|
198
199
|
if (operation === "read") return "allow";
|
|
199
200
|
if (!ctx.hasUI) return "deny";
|
|
200
|
-
const
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
201
|
+
const next = approvalQueue.then(async () => {
|
|
202
|
+
const details = cloudDetails(state)!;
|
|
203
|
+
const command = `${params.command} ${params.args.join(" ")}`;
|
|
204
|
+
if (operation === "delete") return await ctx.ui.confirm("确认删除云资源?", `目标:${params.intent}\n命令:${command}\n\n删除操作始终逐次确认。`) ? "allow" : "deny";
|
|
205
|
+
if (details.allowNonDeleteChanges) return "allow";
|
|
206
|
+
const choice = await ctx.ui.select("允许修改云账号内资源?", ["仅允许本次", "允许本会话后续非删除变更,不再询问", "拒绝"]);
|
|
207
|
+
if (choice === "仅允许本次") return "allow";
|
|
208
|
+
if (choice === "允许本会话后续非删除变更,不再询问") return "allow-session";
|
|
209
|
+
return "deny";
|
|
210
|
+
});
|
|
211
|
+
|
|
212
|
+
approvalQueue = next.then(() => {}, () => {});
|
|
213
|
+
return await next;
|
|
208
214
|
}
|
|
209
215
|
|
|
210
216
|
export function remoteTrustInteraction(ctx: ExtensionContext): RemoteTrustInteraction {
|