@lazyingart/agintiflow 0.20.68 → 0.20.69
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 +1 -1
- package/scripts/smoke-cli-chat.js +3 -2
- package/scripts/smoke-tmux-tools.js +18 -0
- package/src/agent-runner.js +1 -1
- package/src/behavior-contract.js +1 -0
- package/src/guardrails.js +26 -0
- package/src/model-client.js +2 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lazyingart/agintiflow",
|
|
3
|
-
"version": "0.20.
|
|
3
|
+
"version": "0.20.69",
|
|
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",
|
|
@@ -149,9 +149,10 @@ try {
|
|
|
149
149
|
const behaviorContract = formatBehaviorContractForPrompt();
|
|
150
150
|
if (
|
|
151
151
|
!behaviorContract.includes("name the actual environment used") ||
|
|
152
|
-
!behaviorContract.includes("Do not claim compatibility across untested runtimes")
|
|
152
|
+
!behaviorContract.includes("Do not claim compatibility across untested runtimes") ||
|
|
153
|
+
!behaviorContract.includes("Do not self-invoke AgInTiFlow")
|
|
153
154
|
) {
|
|
154
|
-
throw new Error("behavior contract must guard against host/Docker
|
|
155
|
+
throw new Error("behavior contract must guard against host/Docker, runtime-version, and recursive self-invocation overclaims");
|
|
155
156
|
}
|
|
156
157
|
const wrappedDockerCommand = dockerUserCommand("node --test 2>&1 | tail -30", {
|
|
157
158
|
category: "general-shell",
|
|
@@ -78,6 +78,22 @@ try {
|
|
|
78
78
|
});
|
|
79
79
|
assert.equal(dockerTmuxSearch.allowed, true, "Docker run_command should still allow harmless tmux text searches");
|
|
80
80
|
|
|
81
|
+
const dockerNpxAginti = checkToolUse({
|
|
82
|
+
toolName: "run_command",
|
|
83
|
+
args: { command: "npx aginti doctor --json" },
|
|
84
|
+
config: { ...config, useDockerSandbox: true, sandboxMode: "docker-workspace", packageInstallPolicy: "allow" },
|
|
85
|
+
});
|
|
86
|
+
assert.equal(dockerNpxAginti.allowed, false, "Docker run_command should block npx aginti self-invocation");
|
|
87
|
+
assert.equal(dockerNpxAginti.category, "nested-aginti", "npx aginti block should be categorized");
|
|
88
|
+
|
|
89
|
+
const dockerNestedAginti = checkToolUse({
|
|
90
|
+
toolName: "run_command",
|
|
91
|
+
args: { command: "aginti storage status" },
|
|
92
|
+
config: { ...config, useDockerSandbox: true, sandboxMode: "docker-workspace", packageInstallPolicy: "allow" },
|
|
93
|
+
});
|
|
94
|
+
assert.equal(dockerNestedAginti.allowed, false, "Docker run_command should block nested aginti CLI calls");
|
|
95
|
+
assert.equal(dockerNestedAginti.category, "nested-aginti", "nested aginti block should be categorized");
|
|
96
|
+
|
|
81
97
|
console.log(
|
|
82
98
|
JSON.stringify(
|
|
83
99
|
{
|
|
@@ -93,6 +109,8 @@ try {
|
|
|
93
109
|
"destructive-guardrail",
|
|
94
110
|
"docker-run-command-tmux-guardrail",
|
|
95
111
|
"docker-run-command-tmux-search-allowed",
|
|
112
|
+
"docker-run-command-npx-aginti-guardrail",
|
|
113
|
+
"docker-run-command-nested-aginti-guardrail",
|
|
96
114
|
],
|
|
97
115
|
},
|
|
98
116
|
null,
|
package/src/agent-runner.js
CHANGED
|
@@ -358,7 +358,7 @@ async function createInitialState(config, sessionId) {
|
|
|
358
358
|
"Treat AGINTI.md as durable project memory and operating instructions for this project. The user can edit it manually or ask you in chat to update it; use workspace file tools for that and never store secrets there.",
|
|
359
359
|
config.allowShellTool
|
|
360
360
|
? config.useDockerSandbox
|
|
361
|
-
? `A shell command tool is available inside Docker sandbox mode ${config.sandboxMode}. Docker workspace mode with approved package installs supports broader setup and network commands. The project is mounted at /workspace and the persistent agent toolchain is mounted at /aginti-env with caches under /aginti-cache.`
|
|
361
|
+
? `A shell command tool is available inside Docker sandbox mode ${config.sandboxMode}. Docker workspace mode with approved package installs supports broader setup and network commands. The project is mounted at /workspace and the persistent agent toolchain is mounted at /aginti-env with caches under /aginti-cache. Do not run npx aginti, npm exec aginti, or nested aginti diagnostics from this Docker shell; they may resolve stale project packages or create recursive agent sessions.`
|
|
362
362
|
: `A host shell command tool is available under the configured trust policy on ${platformLabel(platform)}. On native Windows, prefer PowerShell/cmd-compatible commands or switch to WSL/Docker for bash-like toolchains.`
|
|
363
363
|
: "No shell command tool is available.",
|
|
364
364
|
"Permission contract: current-workspace file writes are allowed through workspace file tools when enabled. Outside-workspace paths, host sudo, host OS package installs, destructive git/shell actions, and blocked network/setup must not be bypassed by retrying variants. If a tool result includes permissionAdvice or suggestedCommand, stop, explain the blocker, copy the exact suggestedCommand when giving a rerun path, and ask the user to approve/rerun that mode or choose a safer workspace-relative path. Never invent legacy AgInTi syntax such as `aginti run --sandbox host`; use the exact flags from permissionAdvice.",
|
package/src/behavior-contract.js
CHANGED
|
@@ -71,6 +71,7 @@ export function formatBehaviorContractForPrompt({ mode = "runtime" } = {}) {
|
|
|
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
72
|
"Keep artifacts durable and discoverable with descriptive non-conflicting names; never overwrite unless the user clearly asked.",
|
|
73
73
|
"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.",
|
|
74
|
+
"Do not self-invoke AgInTiFlow with npx/npm exec or nested aginti commands from inside the agent shell; it can resolve stale project packages or create recursive sessions. Use current runtime evidence, project/session files, or ask for a host-side diagnostic instead.",
|
|
74
75
|
].join(" ");
|
|
75
76
|
}
|
|
76
77
|
|
package/src/guardrails.js
CHANGED
|
@@ -49,6 +49,16 @@ function isDockerTmuxProcessCommand(command = "") {
|
|
|
49
49
|
].some((pattern) => pattern.test(command));
|
|
50
50
|
}
|
|
51
51
|
|
|
52
|
+
function isNpxAgintiCommand(command = "") {
|
|
53
|
+
return /\b(?:npx(?:\s+(?:-y|--yes))?|npm\s+exec|pnpm\s+dlx|yarn\s+dlx)\s+(?:@lazyingart\/agintiflow|aginti)\b/i.test(
|
|
54
|
+
command
|
|
55
|
+
);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
function isAgintiCliCommand(command = "") {
|
|
59
|
+
return /(?:^|[\s;&|('"])(?:node\s+[-\w./]*aginti-cli\.js|aginti)(?:\s|$)/i.test(command);
|
|
60
|
+
}
|
|
61
|
+
|
|
52
62
|
function normalizeDomain(hostname) {
|
|
53
63
|
return hostname.replace(/^www\./, "").toLowerCase();
|
|
54
64
|
}
|
|
@@ -137,6 +147,22 @@ export function checkToolUse({ toolName, args, snapshot, config }) {
|
|
|
137
147
|
|
|
138
148
|
if (toolName === "run_command") {
|
|
139
149
|
const command = String(args.command || "").trim();
|
|
150
|
+
if (isNpxAgintiCommand(command)) {
|
|
151
|
+
return {
|
|
152
|
+
allowed: false,
|
|
153
|
+
reason:
|
|
154
|
+
"`npx aginti`/`npm exec aginti` is blocked inside agent shell tools because it can resolve a stale project-local AgInTiFlow package, install from the network, or start a nested agent session. Use the current runtime status, project/session files, or ask the user to run a host CLI diagnostic.",
|
|
155
|
+
category: "nested-aginti",
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
if (config.useDockerSandbox && isAgintiCliCommand(command)) {
|
|
159
|
+
return {
|
|
160
|
+
allowed: false,
|
|
161
|
+
reason:
|
|
162
|
+
"Nested AgInTiFlow CLI calls are blocked in Docker run_command because the container may not have the active host CLI and may resolve stale project node_modules. Use current session evidence, workspace files, or ask the user to run host-side `aginti doctor --json`/`aginti capabilities --json`.",
|
|
163
|
+
category: "nested-aginti",
|
|
164
|
+
};
|
|
165
|
+
}
|
|
140
166
|
if (config.useDockerSandbox && isDockerTmuxProcessCommand(command)) {
|
|
141
167
|
return {
|
|
142
168
|
allowed: false,
|
package/src/model-client.js
CHANGED
|
@@ -508,7 +508,7 @@ export async function createPlan(client, config, state) {
|
|
|
508
508
|
state.startUrl ? `Suggested start URL: ${state.startUrl}` : "",
|
|
509
509
|
config.allowedDomains.length > 0 ? `Allowed domains: ${config.allowedDomains.join(", ")}` : "",
|
|
510
510
|
config.allowShellTool
|
|
511
|
-
? `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. On native Windows host mode, prefer PowerShell/cmd-compatible commands or WSL/Docker for bash-like toolchains.`
|
|
511
|
+
? `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.`
|
|
512
512
|
: "",
|
|
513
513
|
config.allowShellTool
|
|
514
514
|
? "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."
|
|
@@ -828,7 +828,7 @@ export async function requestNextStep(client, config, messages) {
|
|
|
828
828
|
function: {
|
|
829
829
|
name: "run_command",
|
|
830
830
|
description:
|
|
831
|
-
"Run a terminal command in the configured working directory under the active shell policy. Secrets
|
|
831
|
+
"Run a terminal command in the configured working directory under the active shell policy. Secrets, npm publishing, npx/npm-exec AgInTiFlow self-invocation, and recursive Docker aginti calls are blocked; Docker workspace mode with approved package installs supports broader network/setup commands, while host destructive or privileged work requires explicit trust.",
|
|
832
832
|
parameters: {
|
|
833
833
|
type: "object",
|
|
834
834
|
properties: {
|