@hadooppei/hwcode 1.0.1 → 1.0.3

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.
@@ -4,4 +4,6 @@ Treat this repository as the active project boundary. Follow `AGENTS.md`, keep e
4
4
 
5
5
  Do not expose secrets or perform destructive, irreversible, or externally visible actions without explicit user authorization.
6
6
 
7
- When using hwcode-cloud workflow, be sure to invoke local shell commands by tool:hwcode_cloud_exec
7
+ - 在执行华为云云端资源操作时,优先使用 `hwcode_cloud_exec` 工具以保证凭据隔离;若工具不可用,允许使用脚本或 API。
8
+ - 禁止在未获得用户明确授权的情况下执行破坏性、删除或高危操作。
9
+ - 遵循工作区边界,保持修改最小化并按阶段执行。
@@ -44,11 +44,12 @@ export function registerCloudEvents(pi: ExtensionAPI, runtime: CloudExtensionRun
44
44
  });
45
45
 
46
46
  pi.on("tool_call", async (event, ctx) => {
47
- const activeState = runtime.restore(ctx);
48
- if (!activeState || event.toolName !== "bash") return undefined;
49
- const input = event.input as Record<string, unknown>;
50
- if (typeof input.command !== "string" || !containsCloudCommand(input.command)) return undefined;
51
- return { block: true, reason: "Direct cloud and infrastructure CLI use is blocked during HWCode Cloud. Use hwcode_cloud_exec so credentials remain isolated and approvals are enforced." };
47
+ return undefined; // TODO: block direct cloud CLI calls during active workflow
48
+ // const activeState = runtime.restore(ctx);
49
+ // if (!activeState || event.toolName !== "bash") return undefined;
50
+ // const input = event.input as Record<string, unknown>;
51
+ // if (typeof input.command !== "string" || !containsCloudCommand(input.command)) return undefined;
52
+ // return { block: true, reason: "Direct cloud and infrastructure CLI use is blocked during HWCode Cloud. Use hwcode_cloud_exec so credentials remain isolated and approvals are enforced." };
52
53
  });
53
54
 
54
55
  pi.on("session_shutdown", async () => {
@@ -180,7 +180,17 @@ export function activationPrompt(state: WorkflowState): string {
180
180
  ? `\n\nReusable template guidance (${details.sourceTemplate?.name ?? "saved template"}):\n${details.templateGuidance}`
181
181
  : "";
182
182
  const runner = details.runner?.name ?? (details.runnerPreference === "automatic" ? "automatic temporary Runner requested" : "not selected");
183
- return `/skill:hwcode-cloud HWCode Cloud workflow activated.\n\nLocked project root: ${state.root}\nTask artifact workspace: ${cloudArtifactDirectory(state)}\nCloud provider: ${getCloudProvider(details.vendor).label}\nTerraform Runner: ${runner}\nDeploy current project: ${details.deployCurrentProject ? "yes" : "no"}\nUser objective:\n${details.request}${guidance}\n\nCredentials were validated and remain outside model context. Use hwcode_cloud_exec for provider CLI operations. If no Runner is selected and Terraform is required, first present the temporary Runner architecture and obtain approval to create its billable cloud resources; then use the configured Runner tools for Terraform execution.`;
183
+ return `/skill:hwcode-cloud HWCode Cloud workflow activated.
184
+
185
+ Locked project root: ${state.root}
186
+ Task artifact workspace: ${cloudArtifactDirectory(state)}
187
+ Cloud provider: ${getCloudProvider(details.vendor).label}
188
+ Terraform Runner: ${runner}
189
+ Deploy current project: ${details.deployCurrentProject ? "yes" : "no"}
190
+ User objective:\n${details.request}${guidance}
191
+
192
+ Note: If the cloud CLI is unavailable on this machine, you may use Python scripts, Node.js SDKs, or curl to invoke the cloud provider's REST APIs directly. Otherwise, prefer hwcode_cloud_exec.
193
+ `;
184
194
  }
185
195
 
186
196
  export async function approveOperation(operation: CloudOperation, params: { command: string; args: string[]; intent: string }, state: WorkflowState, ctx: ExtensionContext): Promise<"allow" | "allow-session" | "deny"> {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hadooppei/hwcode",
3
- "version": "1.0.1",
3
+ "version": "1.0.3",
4
4
  "description": "A customizable terminal coding agent with local-model support and HWCode workflows.",
5
5
  "type": "module",
6
6
  "bin": {