@lazyingart/agintiflow 0.20.75 → 0.20.77

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lazyingart/agintiflow",
3
- "version": "0.20.75",
3
+ "version": "0.20.77",
4
4
  "type": "module",
5
5
  "description": "Low-cost, project-aware Web and CLI agents with DeepSeek/Venice/OpenAI routing, visible tool calls, durable sessions, scouts, AAPS, SCS, and guarded local execution.",
6
6
  "license": "Apache-2.0",
@@ -279,6 +279,32 @@ try {
279
279
  });
280
280
  assert(permissionAdvice.suggestedCommand.includes("coding-policy-smoke"), "permission advice did not include resume session id");
281
281
  assert(permissionAdvice.suggestedCommand.includes("--sandbox-mode docker-workspace"), "permission advice did not suggest docker-workspace recovery");
282
+ const destructiveAdvice = buildPermissionAdvice({
283
+ toolName: "run_command",
284
+ args: { command: "rm -rf reports && git reset --hard" },
285
+ guard: { category: "destructive", reason: "Destructive shell commands require Allow destructive actions." },
286
+ config: dockerWorkspacePolicy,
287
+ state: { sessionId: "coding-destructive-smoke" },
288
+ });
289
+ const destructiveAdviceText = [
290
+ destructiveAdvice.summary,
291
+ ...(destructiveAdvice.options || []),
292
+ destructiveAdvice.suggestedCommand,
293
+ destructiveAdvice.destructiveApprovalCommand,
294
+ ].join("\n");
295
+ assert(/dry-run|inspect-only/i.test(destructiveAdviceText), "destructive advice did not lead with dry-run or inspect-only alternatives");
296
+ assert(
297
+ /Do not include executable delete\/reset\/clean commands/.test(destructiveAdviceText),
298
+ "destructive advice did not prohibit destructive commands inside safe cleanup instructions"
299
+ );
300
+ assert(
301
+ !destructiveAdvice.suggestedCommand.includes("--allow-destructive"),
302
+ "default destructive advice suggested command should not enable destructive mode"
303
+ );
304
+ assert(
305
+ destructiveAdvice.destructiveApprovalCommand.includes("--allow-destructive"),
306
+ "destructive advice did not provide an explicit approval command"
307
+ );
282
308
  const failedNetworkAdvice = buildFailedCommandAdvice({
283
309
  args: { command: "git clone https://github.com/lazyingart/AgInTiFlow.git" },
284
310
  commandPolicy: clonePolicy,
@@ -69,6 +69,8 @@ export function formatBehaviorContractForPrompt({ mode = "runtime" } = {}) {
69
69
  "Make surgical edits: no drive-by refactors, unrelated formatting churn, or deletion of code you did not need to touch.",
70
70
  "Define or infer concrete success criteria for non-trivial work, then run focused checks or state why checks are unavailable.",
71
71
  "Respect the permission contract: if a tool is blocked or returns permissionAdvice, stop and present the exact suggestedCommand/approval path instead of retrying variants or inventing CLI flags.",
72
+ "When destructive cleanup is blocked, lead with inspect-only or dry-run evidence (`git status`, `git clean -nd`, targeted file lists). Do not call delete/reset/clean commands safe unless they are clearly labeled as requiring explicit user approval.",
73
+ "Reports after destructive blocks must not place executable destructive commands (`rm -rf`, `git reset --hard`, `git clean -fd`, `find ... -delete`, broad `git checkout -- .`) inside safe or non-destructive cleanup sections. Omit exact destructive commands or put them only in a separate explicit-approval section.",
72
74
  "Protect secrets aggressively: never repeat token/key/password/secret values from prompts, files, tool output, plans, final answers, reports, diffs, or artifacts. Redact the value as [REDACTED] and use dedicated key storage such as `aginti keys set` when credentials are needed.",
73
75
  "Keep artifacts durable and discoverable with descriptive non-conflicting names; never overwrite unless the user clearly asked.",
74
76
  "When reporting shell, language, runtime, build, or test results, name the actual environment used (host vs Docker, relevant interpreter/tool path/version when it matters). Do not claim compatibility across untested runtimes, hosts, containers, or language versions; state the caveat or run an explicit check.",
@@ -135,7 +135,40 @@ function adviceForCategory(category = "", { toolName = "", args = {}, config = {
135
135
  };
136
136
  }
137
137
 
138
- if (category === "destructive" || category === "permission-change" || category === "general-shell") {
138
+ if (category === "destructive") {
139
+ return {
140
+ ...base,
141
+ summary:
142
+ "This command is destructive and was blocked. Do not retry variants. First offer inspect-only or dry-run cleanup evidence; destructive cleanup requires explicit user approval.",
143
+ options: [
144
+ "Inspect only: run non-destructive checks such as `git status --short`, `git clean -nd`, `find <path> -maxdepth ... -print`, or targeted file listings.",
145
+ "Safer cleanup plan: write a report listing exact files that would be removed. Do not include executable delete/reset/clean commands in the safe or non-destructive section.",
146
+ "Explicit destructive approval: only after the user accepts data-loss risk, provide a separate approval path such as a rerun command with --allow-destructive.",
147
+ ],
148
+ suggestedCommand: resumeCommand({
149
+ config,
150
+ state,
151
+ sandboxMode: "docker-workspace",
152
+ prompt: "Continue with inspect-only or dry-run cleanup evidence. Do not delete, reset, clean, overwrite, or include executable destructive cleanup commands in safe/non-destructive instructions unless the user explicitly approves destructive actions.",
153
+ }),
154
+ destructiveApprovalCommand: resumeCommand({
155
+ config,
156
+ state,
157
+ sandboxMode: "docker-workspace",
158
+ destructive: true,
159
+ prompt: "Continue after the user explicitly approved destructive project-local cleanup. Inspect first, delete only the named targets, and verify git status afterwards.",
160
+ }),
161
+ trustedHostCommand: resumeCommand({
162
+ config,
163
+ state,
164
+ sandboxMode: "host",
165
+ destructive: true,
166
+ prompt: "Continue after the user explicitly approved trusted host destructive execution. Inspect first, avoid unrelated files, and keep git status understandable.",
167
+ }),
168
+ };
169
+ }
170
+
171
+ if (category === "permission-change" || category === "general-shell") {
139
172
  return {
140
173
  ...base,
141
174
  summary: