@lazyingart/agintiflow 0.20.91 → 0.20.92

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.91",
3
+ "version": "0.20.92",
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",
@@ -36,6 +36,10 @@ const dockerConfig = {
36
36
  sandboxMode: "docker-workspace",
37
37
  packageInstallPolicy: "allow",
38
38
  };
39
+ const dockerNoInstallsConfig = {
40
+ ...dockerConfig,
41
+ packageInstallPolicy: "block",
42
+ };
39
43
 
40
44
  function sleep(ms) {
41
45
  return new Promise((resolve) => setTimeout(resolve, ms));
@@ -122,6 +126,33 @@ try {
122
126
  });
123
127
  assert.equal(dockerTmuxRelativeStart.allowed, true, "Docker-mode tmux_start_session should allow workspace-relative paths");
124
128
 
129
+ const dockerTmuxRebaseStart = checkToolUse({
130
+ toolName: "tmux_start_session",
131
+ args: { name: `${session}-docker-rebase`, cwd: ".", command: "git rebase main" },
132
+ config: dockerNoInstallsConfig,
133
+ });
134
+ assert.equal(dockerTmuxRebaseStart.allowed, false, "Docker-mode tmux_start_session should not bypass git rebase guard");
135
+ assert.equal(dockerTmuxRebaseStart.category, "destructive", "Docker tmux rebase block should keep command-policy category");
136
+
137
+ const directDockerRebaseStart = await startTmuxSession(
138
+ { name: `${session}-direct-docker-rebase`, cwd: ".", command: "git rebase main" },
139
+ dockerNoInstallsConfig
140
+ );
141
+ assert.equal(directDockerRebaseStart.ok, false, "tmux_start_session direct path should enforce Docker shell policy");
142
+
143
+ const dockerTmuxRebaseSend = await sendTmuxKeys(
144
+ { target: start.target, text: "git rebase main", enter: true },
145
+ dockerNoInstallsConfig
146
+ );
147
+ assert.equal(dockerTmuxRebaseSend.ok, false, "Docker-mode tmux_send_keys should not bypass git rebase guard in shell panes");
148
+ assert.equal(dockerTmuxRebaseSend.category, "destructive", "Docker tmux send rebase block should keep command-policy category");
149
+
150
+ const dockerTmuxGitStatusSend = await sendTmuxKeys(
151
+ { target: start.target, text: "git status --short", enter: true },
152
+ dockerNoInstallsConfig
153
+ );
154
+ assert.equal(dockerTmuxGitStatusSend.ok, true, "Docker-mode tmux_send_keys should allow read-only git status in shell panes");
155
+
125
156
  const hostBroadTmuxStart = checkToolUse({
126
157
  toolName: "tmux_start_session",
127
158
  args: { name: `${session}-host-broad`, cwd: ".", command: 'echo "HOST_TMUX_STARTED"; sleep 1' },
@@ -203,6 +234,9 @@ try {
203
234
  "docker-tmux-send-outside-path-guardrail",
204
235
  "docker-tmux-start-project-path-allowed",
205
236
  "docker-tmux-start-relative-path-allowed",
237
+ "docker-tmux-start-command-policy-guardrail",
238
+ "docker-tmux-send-command-policy-guardrail",
239
+ "docker-tmux-send-readonly-command-allowed",
206
240
  "host-tmux-start-shell-policy-guardrail",
207
241
  "host-tmux-send-shell-policy-guardrail",
208
242
  "host-tmux-control-key-allowed",
@@ -894,7 +894,7 @@ async function captureSyntheticSnapshot(store, step, config) {
894
894
  : `Shell tool available in: ${config.commandCwd} on ${platformLabel(platform)}. Use OS-compatible commands; prefer WSL/Docker for bash-heavy workflows on Windows.`
895
895
  : "Shell tool disabled.",
896
896
  config.allowShellTool
897
- ? "Host tmux tools available: tmux_list_sessions, tmux_capture_pane, tmux_send_keys, tmux_start_session. Use them for long-running jobs and agent terminals; capture before sending input. Docker run_command containers are ephemeral, so tmux there will not persist. In Docker sandbox mode, tmux start/send commands must stay workspace-bound and cannot reference absolute host paths outside the project; use --sandbox-mode host for trusted whole-host work. In host mode, tmux startup/send command text follows the same host shell policy as run_command; if a broad host command is blocked, present the approval/rerun path instead of trying tmux as a workaround. For one-shot tmux commands, redirect output and exit status to a durable workspace log or keep the pane alive for capture; if capture fails because the session ended, do not infer output or exit status."
897
+ ? "Host tmux tools available: tmux_list_sessions, tmux_capture_pane, tmux_send_keys, tmux_start_session. Use them for long-running jobs and agent terminals; capture before sending input. Docker run_command containers are ephemeral, so tmux there will not persist. In Docker sandbox mode, tmux start/send commands must stay workspace-bound and cannot reference absolute host paths outside the project; when sending text into a shell pane, tmux follows the same Docker workspace command policy as run_command and is not a bypass for package installs, destructive git history rewrites, or broad shell text. Use --sandbox-mode host for trusted whole-host work. In host mode, tmux startup/send command text follows the same host shell policy as run_command; if a broad host command is blocked, present the approval/rerun path instead of trying tmux as a workaround. For one-shot tmux commands, redirect output and exit status to a durable workspace log or keep the pane alive for capture; if capture fails because the session ended, do not infer output or exit status."
898
898
  : "",
899
899
  config.allowFileTools
900
900
  ? `Workspace file tools available in: ${config.commandCwd}. Use inspect_project first for large or unfamiliar codebases, then search/read exact files before editing. Use workspace-relative paths. Use apply_patch for code edits; it supports exact single-file replacement and multi-file Codex-style/unified patches. For new standalone generated content, pick a descriptive non-conflicting filename and avoid overwriting unless explicitly requested.`
@@ -512,7 +512,7 @@ export async function createPlan(client, config, state) {
512
512
  ? `Shell tool is enabled in ${config.commandCwd}. Host platform: ${platformLabel(platform)}. In Docker, this path is mounted as /workspace with persistent /aginti-env and /aginti-cache mounts. Use relative paths or /workspace paths, not absolute host temp paths. Sandbox mode: ${config.sandboxMode}. Package install policy: ${config.packageInstallPolicy}. For npm/pip/conda/venv setup, explain the need and wait for approval unless policy is allow. Do not run npx aginti, npm exec aginti, or nested aginti diagnostics from this shell; they may resolve stale project packages or create recursive agent sessions. On native Windows host mode, prefer PowerShell/cmd-compatible commands or WSL/Docker for bash-like toolchains.`
513
513
  : "",
514
514
  config.allowShellTool
515
- ? "Host tmux tools are enabled for long-running sessions. Plan to use tmux_start_session for durable jobs, tmux_capture_pane to monitor, tmux_send_keys to interact after capture, and tmux_list_sessions to discover existing sessions. Do not install or run tmux inside Docker run_command containers; those containers are short-lived and cannot preserve tmux servers. In Docker sandbox mode, tmux startup/send commands are still workspace-bound: use relative project paths, not absolute host paths outside the workspace. In host mode, tmux startup/send command text follows the same host shell policy as run_command; if blocked, present the suggested approval/rerun path instead of trying tmux as a workaround. Ask for --sandbox-mode host --allow-destructive before trusted whole-host tmux work."
515
+ ? "Host tmux tools are enabled for long-running sessions. Plan to use tmux_start_session for durable jobs, tmux_capture_pane to monitor, tmux_send_keys to interact after capture, and tmux_list_sessions to discover existing sessions. Do not install or run tmux inside Docker run_command containers; those containers are short-lived and cannot preserve tmux servers. In Docker sandbox mode, tmux startup/send commands are still workspace-bound and shell-pane text follows the same Docker workspace command policy as run_command: use relative project paths, not absolute host paths outside the workspace, and do not use tmux as a workaround for package installs, destructive git rewrites, or broad shell commands. In host mode, tmux startup/send command text follows the same host shell policy as run_command; if blocked, present the suggested approval/rerun path instead of trying tmux as a workaround. Ask for --sandbox-mode host --allow-destructive before trusted whole-host tmux work."
516
516
  : "",
517
517
  config.allowFileTools
518
518
  ? `Workspace file tools are enabled in ${config.commandCwd}: inspect_project, list_files, read_file, search_files, write_file, apply_patch, open_workspace_file, preview_workspace. For large or unfamiliar repos, plan to call inspect_project first, then search/read AGINTI.md/AGENTS.md/README/manifests and exact files. apply_patch supports exact single-file replacements and Codex-style/unified multi-file patches; prefer it for edits after reading relevant context. Keep all paths workspace-relative, for example plot_fx.svg or docs/report.tex, and avoid secrets. For newly generated standalone prose/docs/stories/assets, choose a descriptive non-conflicting filename from the topic/language instead of generic names like story.txt or output.txt; do not overwrite existing files unless the user explicitly asked to update/replace/overwrite that file. For generated local HTML/SVG/PDF/static sites, plan to use open_workspace_file or preview_workspace rather than starting a localhost server inside Docker.`
package/src/tmux-tools.js CHANGED
@@ -153,6 +153,36 @@ function checkHostShellPolicyForTmuxText(text = "", config = {}, label = "tmux t
153
153
  };
154
154
  }
155
155
 
156
+ function shouldApplyDockerShellPolicy(config = {}) {
157
+ return Boolean(config.useDockerSandbox && config.sandboxMode === "docker-workspace");
158
+ }
159
+
160
+ function isShellPaneCommand(command = "") {
161
+ return /^(?:ba|z|fi|da|k)?sh$|^fish$/.test(String(command || "").trim());
162
+ }
163
+
164
+ async function getPaneCurrentCommand(target) {
165
+ const result = await runTmux(["display-message", "-p", "-t", target, "#{pane_current_command}"], {
166
+ timeout: 4000,
167
+ maxBuffer: 16 * 1024,
168
+ });
169
+ if (!result.ok) return "";
170
+ return String(result.stdout || "").trim();
171
+ }
172
+
173
+ function checkDockerShellPolicyForTmuxText(text = "", config = {}, label = "tmux text") {
174
+ const command = String(text || "").trim();
175
+ if (!command || !shouldApplyDockerShellPolicy(config)) return { ok: true };
176
+ const policy = evaluateCommandPolicy(command, config);
177
+ if (policy.allowed) return { ok: true, category: policy.category };
178
+ return {
179
+ ok: false,
180
+ reason: `${label} is blocked by the same Docker workspace shell policy as run_command: ${policy.reason}`,
181
+ category: policy.category || "tmux",
182
+ needsApproval: policy.needsApproval,
183
+ };
184
+ }
185
+
156
186
  function parseSessions(stdout = "") {
157
187
  return String(stdout || "")
158
188
  .split(/\r?\n/)
@@ -266,6 +296,25 @@ export async function sendTmuxKeys(args = {}, config = {}) {
266
296
  needsApproval: hostPolicy.needsApproval,
267
297
  };
268
298
  }
299
+ const keyArgsForPolicy = [...keys];
300
+ if (enter) keyArgsForPolicy.push("Enter");
301
+ if (text && keyArgsForPolicy.includes("Enter") && shouldApplyDockerShellPolicy(config)) {
302
+ const paneCommand = await getPaneCurrentCommand(target.target);
303
+ if (isShellPaneCommand(paneCommand)) {
304
+ const dockerPolicy = checkDockerShellPolicyForTmuxText(text, config, "tmux text");
305
+ if (!dockerPolicy.ok) {
306
+ return {
307
+ ok: false,
308
+ toolName: "tmux_send_keys",
309
+ blocked: true,
310
+ reason: dockerPolicy.reason,
311
+ category: dockerPolicy.category,
312
+ needsApproval: dockerPolicy.needsApproval,
313
+ paneCommand,
314
+ };
315
+ }
316
+ }
317
+ }
269
318
  for (const key of keys) {
270
319
  if (!ALLOWED_KEYS.has(key)) {
271
320
  return { ok: false, toolName: "tmux_send_keys", blocked: true, reason: `Unsupported tmux key: ${key}` };
@@ -321,6 +370,17 @@ export async function startTmuxSession(args = {}, config = {}) {
321
370
  if (!workspaceBound.ok) {
322
371
  return { ok: false, toolName: "tmux_start_session", blocked: true, reason: workspaceBound.reason };
323
372
  }
373
+ const dockerPolicy = checkDockerShellPolicyForTmuxText(command, config, "tmux startup command");
374
+ if (!dockerPolicy.ok) {
375
+ return {
376
+ ok: false,
377
+ toolName: "tmux_start_session",
378
+ blocked: true,
379
+ reason: dockerPolicy.reason,
380
+ category: dockerPolicy.category,
381
+ needsApproval: dockerPolicy.needsApproval,
382
+ };
383
+ }
324
384
  const hostPolicy = checkHostShellPolicyForTmuxText(command, config, "tmux startup command");
325
385
  if (!hostPolicy.ok) {
326
386
  return {
@@ -402,6 +462,15 @@ export function checkTmuxToolUse(toolName, args = {}, config = {}) {
402
462
  }
403
463
  const workspaceBound = checkWorkspaceBoundTmuxText(command, config, "tmux startup command");
404
464
  if (!workspaceBound.ok) return { allowed: false, reason: workspaceBound.reason, category: "tmux" };
465
+ const dockerPolicy = checkDockerShellPolicyForTmuxText(command, config, "tmux startup command");
466
+ if (!dockerPolicy.ok) {
467
+ return {
468
+ allowed: false,
469
+ reason: dockerPolicy.reason,
470
+ category: dockerPolicy.category || "tmux",
471
+ needsApproval: dockerPolicy.needsApproval,
472
+ };
473
+ }
405
474
  const hostPolicy = checkHostShellPolicyForTmuxText(command, config, "tmux startup command");
406
475
  if (!hostPolicy.ok) {
407
476
  return {