refactor: rename bot to agent (#44)

This commit is contained in:
sigoden
2024-06-22 06:52:45 +08:00
committed by GitHub
parent a799428b39
commit adfb7c2b49
12 changed files with 192 additions and 192 deletions
+1 -1
View File
@@ -1,7 +1,7 @@
/tmp
functions.txt
tools.txt
bots.txt
agents.txt
functions.json
/bin
/cache
+96 -96
View File
@@ -32,17 +32,17 @@ run@tool() {
"$BIN_DIR/$argc_cmd$ext" "$argc_json"
}
# @cmd Run the bot
# @alias bot:run
# @arg cmd![`_choice_bot`] The bot command
# @arg action![`_choice_bot_action`] The bot action
# @cmd Run the agent
# @alias agent:run
# @arg cmd![`_choice_agent`] The agent command
# @arg action![`_choice_agent_action`] The agent action
# @arg json The json data
run@bot() {
run@agent() {
if _is_win; then
ext=".cmd"
fi
if [[ -z "$argc_json" ]]; then
functions_path="bots/$argc_cmd/functions.json"
functions_path="agents/$argc_cmd/functions.json"
if [[ -f "$functions_path" ]]; then
declaration="$(jq --arg name "$argc_action" '.[] | select(.name == $name)' "$functions_path")"
if [[ -n "$declaration" ]]; then
@@ -63,10 +63,10 @@ build() {
else
echo 'Skipped building tools sine tools.txt is missing'
fi
if [[ -f bots.txt ]]; then
argc build@bot
if [[ -f agents.txt ]]; then
argc build@agent
else
echo 'Skipped building bots sine bots.txt is missing'
echo 'Skipped building agents sine agents.txt is missing'
fi
}
@@ -180,33 +180,33 @@ generate-declarations@tool() {
"$cmd" "scripts/build-declarations.$lang" "tools/$1"
}
# @cmd Build bots
# @alias bot:build
# @option --names-file=bots.txt Path to a file containing bot filenames, one per line.
# @cmd Build agents
# @alias agent:build
# @option --names-file=agents.txt Path to a file containing agent filenames, one per line.
# Example:
# hackernews
# spotify
# @arg bots*[`_choice_bot`] The bot filenames
build@bot() {
if [[ "${#argc_bots[@]}" -gt 0 ]]; then
# @arg agents*[`_choice_agent`] The agent filenames
build@agent() {
if [[ "${#argc_agents[@]}" -gt 0 ]]; then
mkdir -p "$TMP_DIR"
argc_names_file="$TMP_DIR/bots.txt"
printf "%s\n" "${argc_bots[@]}" > "$argc_names_file"
argc_names_file="$TMP_DIR/agents.txt"
printf "%s\n" "${argc_agents[@]}" > "$argc_names_file"
else
argc clean@bot
argc clean@agent
fi
argc build-declarations@bot --names-file "${argc_names_file}"
argc build-bin@bot --names-file "${argc_names_file}"
argc build-declarations@agent --names-file "${argc_names_file}"
argc build-bin@agent --names-file "${argc_names_file}"
}
# @cmd Build bots to bin
# @alias bot:build-bin
# @option --names-file=bots.txt Path to a file containing bot dirs, one per line.
# @arg bots*[`_choice_bot`] The bot names
build-bin@bot() {
# @cmd Build agents to bin
# @alias agent:build-bin
# @option --names-file=agents.txt Path to a file containing agent dirs, one per line.
# @arg agents*[`_choice_agent`] The agent names
build-bin@agent() {
mkdir -p "$BIN_DIR"
if [[ "${#argc_bots[@]}" -gt 0 ]]; then
names=("${argc_bots[@]}" )
if [[ "${#argc_agents[@]}" -gt 0 ]]; then
names=("${argc_agents[@]}" )
elif [[ -f "$argc_names_file" ]]; then
names=($(cat "$argc_names_file"))
if [[ "${#names[@]}" -gt 0 ]]; then
@@ -214,88 +214,88 @@ build-bin@bot() {
fi
fi
if [[ -z "$names" ]]; then
_die "error: not input bots, not found '$argc_names_file', please create it add some tools."
_die "error: not input agents, not found '$argc_names_file', please create it add some tools."
fi
not_found_bots=()
not_found_agents=()
for name in "${names[@]}"; do
bot_dir="bots/$name"
agent_dir="agents/$name"
found=false
for item in "${LANG_CMDS[@]}"; do
lang="${item%:*}"
bot_tools_file="$bot_dir/tools.$lang"
if [[ -f "$bot_tools_file" ]]; then
agent_tools_file="$agent_dir/tools.$lang"
if [[ -f "$agent_tools_file" ]]; then
found=true
if _is_win; then
bin_file="$BIN_DIR/$name.cmd"
_build_win_shim bot $lang > "$bin_file"
_build_win_shim agent $lang > "$bin_file"
else
bin_file="$BIN_DIR/$name"
ln -s -f "$PWD/scripts/run-bot.$lang" "$bin_file"
ln -s -f "$PWD/scripts/run-agent.$lang" "$bin_file"
fi
echo "Build bot $name"
echo "Build agent $name"
fi
done
if [[ "$found" = "false" ]]; then
not_found_bots+=("$name")
not_found_agents+=("$name")
fi
done
if [[ -n "$not_found_bots" ]]; then
_die "error: not found bots: ${not_found_bots[*]}"
if [[ -n "$not_found_agents" ]]; then
_die "error: not found agents: ${not_found_agents[*]}"
fi
}
# @cmd Build bots function declarations file
# @alias bot:build-declarations
# @option --names-file=bots.txt Path to a file containing bot dirs, one per line.
# @arg bots*[`_choice_bot`] The tool filenames
build-declarations@bot() {
if [[ "${#argc_bots[@]}" -gt 0 ]]; then
names=("${argc_bots[@]}" )
# @cmd Build agents function declarations file
# @alias agent:build-declarations
# @option --names-file=agents.txt Path to a file containing agent dirs, one per line.
# @arg agents*[`_choice_agent`] The tool filenames
build-declarations@agent() {
if [[ "${#argc_agents[@]}" -gt 0 ]]; then
names=("${argc_agents[@]}" )
elif [[ -f "$argc_names_file" ]]; then
names=($(cat "$argc_names_file"))
fi
if [[ -z "$names" ]]; then
_die "error: not input bots, not found '$argc_names_file', please create it add some tools."
_die "error: not input agents, not found '$argc_names_file', please create it add some tools."
fi
not_found_bots=()
build_failed_bots=()
not_found_agents=()
build_failed_agents=()
for name in "${names[@]}"; do
bot_dir="bots/$name"
agent_dir="agents/$name"
build_ok=false
found=false
for item in "${LANG_CMDS[@]}"; do
lang="${item%:*}"
bot_tools_file="$bot_dir/tools.$lang"
if [[ -f "$bot_tools_file" ]]; then
agent_tools_file="$agent_dir/tools.$lang"
if [[ -f "$agent_tools_file" ]]; then
found=true
json_data="$(generate-declarations@bot "$name")" || {
build_failed_bots+=("$name")
json_data="$(generate-declarations@agent "$name")" || {
build_failed_agents+=("$name")
}
declarations_file="$bot_dir/functions.json"
declarations_file="$agent_dir/functions.json"
echo "Build $declarations_file"
echo "$json_data" > "$declarations_file"
fi
done
if [[ "$found" == "false" ]]; then
not_found_bots+=("$name")
not_found_agents+=("$name")
fi
done
if [[ -n "$not_found_bots" ]]; then
_die "error: not found bots: ${not_found_bots[*]}"
if [[ -n "$not_found_agents" ]]; then
_die "error: not found agents: ${not_found_agents[*]}"
fi
if [[ -n "$build_failed_bots" ]]; then
_die "error: invalid bots: ${build_failed_bots[*]}"
if [[ -n "$build_failed_agents" ]]; then
_die "error: invalid agents: ${build_failed_agents[*]}"
fi
}
# @cmd Generate function declarations for the bot
# @alias bot:generate-declarations
# @cmd Generate function declarations for the agent
# @alias agent:generate-declarations
# @flag --oneline Summary JSON in one line
# @arg bot![`_choice_bot`] The bot name
generate-declarations@bot() {
tools_path="$(_get_bot_tools_path "$1")"
# @arg agent![`_choice_agent`] The agent name
generate-declarations@agent() {
tools_path="$(_get_agent_tools_path "$1")"
if [[ -z "$tools_path" ]]; then
_die "error: no found entry file at bots/$1/tools.<lang>"
_die "error: no found entry file at agents/$1/tools.<lang>"
fi
lang="${tools_path##*.}"
cmd="$(_lang_to_cmd "$lang")"
@@ -315,18 +315,18 @@ list@tool() {
_choice_tool
}
# @cmd List bots which can be put into bots.txt
# @alias bot:list
# @cmd List agents which can be put into agents.txt
# @alias agent:list
# Examples:
# argc list-bots > bots.txt
list@bot() {
_choice_bot
# argc list-agents > agents.txt
list@agent() {
_choice_agent
}
# @cmd Test the project
test() {
test@tool
test@bot
test@agent
}
# @cmd Test tools
@@ -395,20 +395,20 @@ test-demo-tools() {
done
}
# @cmd Test bots
# @alias bot:test
test@bot() {
# @cmd Test agents
# @alias agent:test
test@agent() {
tmp_dir="cache/tmp"
mkdir -p "$tmp_dir"
names_file="$tmp_dir/bots.txt"
argc list@bot > "$names_file"
argc build@bot --names-file "$names_file"
test-todo-bots
names_file="$tmp_dir/agents.txt"
argc list@agent > "$names_file"
argc build@agent --names-file "$names_file"
test-todo-agents
}
# @cmd Test todo-* bots
# @alias bot:test-todo
test-todo-bots() {
# @cmd Test todo-* agents
# @alias agent:test-todo
test-todo-agents() {
if _is_win; then
ext=".cmd"
fi
@@ -423,11 +423,11 @@ test-todo-bots() {
cmd="${item#*:}"
if command -v "$cmd" &> /dev/null; then
lang="${item%:*}"
bot_name="todo-$lang"
rm -rf "cache/$bot_name/todos.json"
agent_name="todo-$lang"
rm -rf "cache/$agent_name/todos.json"
for test_case in "${test_cases[@]}"; do
IFS='#' read -r action data <<<"${test_case}"
cmd_path="$BIN_DIR/$bot_name$ext"
cmd_path="$BIN_DIR/$agent_name$ext"
echo "Test $cmd_path: "
"$cmd_path" "$action" "$data"
done
@@ -443,11 +443,11 @@ clean@tool() {
rm -rf functions.json
}
# @cmd Clean bots
# @alias bot:clean
clean@bot() {
_choice_bot | xargs -I{} rm -rf "$BIN_DIR/{}"
_choice_bot | xargs -I{} rm -rf bots/{}/functions.json
# @cmd Clean agents
# @alias agent:clean
clean@agent() {
_choice_agent | xargs -I{} rm -rf "$BIN_DIR/{}"
_choice_agent | xargs -I{} rm -rf agents/{}/functions.json
}
# @cmd Install this repo to aichat functions_dir
@@ -500,12 +500,12 @@ _lang_to_cmd() {
done
}
_get_bot_tools_path() {
_get_agent_tools_path() {
name="$1"
for item in "${LANG_CMDS[@]}"; do
lang="${item%:*}"
entry_file="bots/$name/tools.$lang"
if [[ -f "bots/$name/tools.$lang" ]]; then
entry_file="agents/$name/tools.$lang"
if [[ -f "agents/$name/tools.$lang" ]]; then
echo "$entry_file"
fi
done
@@ -581,17 +581,17 @@ _choice_tool() {
done
}
_choice_bot() {
ls -1 bots
_choice_agent() {
ls -1 agents
}
_choice_bot_action() {
_choice_agent_action() {
if [[ "$ARGC_COMPGEN" -eq 1 ]]; then
expr="s/: /\t/"
else
expr="s/:.*//"
fi
argc generate-declarations@bot "$1" --oneline | sed "$expr"
argc generate-declarations@agent "$1" --oneline | sed "$expr"
}
_choice_cmd() {
+16 -16
View File
@@ -17,7 +17,7 @@ Make sure you have the following tools installed:
git clone https://github.com/sigoden/llm-functions
```
**2. Build tools and bots:**
**2. Build tools and agents:**
- Create a `./tools.txt` file with each tool filename on a new line.
@@ -26,14 +26,14 @@ get_current_weather.sh
may_execute_py_code.py
```
- Create a `./bots.txt` file with each bot name on a new line.
- Create a `./agents.txt` file with each agent name on a new line.
```
todo-sh
hackernews
```
- Run `argc build` to build functions declarations files (`functions.json`) and binaries (`./bin`) for tools and bots.
- Run `argc build` to build functions declarations files (`functions.json`) and binaries (`./bin`) for tools and agents.
**3. Configure your AIChat:**
@@ -63,7 +63,7 @@ Now you can interact with your LLM using natural language prompts that trigger y
![execute-type-showcase](https://github.com/sigoden/llm-functions/assets/4012553/1dbc345f-daf9-4d65-a49f-3df8c7df1727)
![bot-showcase](https://github.com/sigoden/llm-functions/assets/4012553/b4411eeb-d79c-4245-8ec2-dd424ba25621)
![agent-showcase](https://github.com/sigoden/llm-functions/assets/4012553/b4411eeb-d79c-4245-8ec2-dd424ba25621)
## Writing Your Own Tools
@@ -122,32 +122,32 @@ def main(code: str):
```
## Writing Bots
## Writing Agents
Bot = Prompt + Tools (Function Callings) + Knowndge (RAG). It's also known as OpenAI's GPTs.
Agent = Prompt + Tools (Function Callings) + Knowndge (RAG). It's also known as OpenAI's GPTs.
The bot has the following folder structure:
The agent has the following folder structure:
```
└── bots
└── mybot
└── agents
└── myagent
├── embeddings/ # Contains RAG files for knownledge
├── functions.json # Function declarations file (Auto-generated)
├── index.yaml # Bot definition file
└── tools.{sh,js,py} # Bot tools script
├── index.yaml # Agent definition file
└── tools.{sh,js,py} # Agent tools script
```
The bot definition file (`index.yaml`) defines crucial aspects of your bot:
The agent definition file (`index.yaml`) defines crucial aspects of your agent:
```yaml
name: TestBot
description: This is test bot
name: TestAgent
description: This is test agent
version: v0.1.0
instructions: You are a test bot to ...
instructions: You are a test agent to ...
conversation_starters:
- What can you do?
```
Refer to `./bots/todo-{sh,js,py}` for examples of how to implement a bot.
Refer to `./agents/todo-{sh,js,py}` for examples of how to implement a agent.
## License
@@ -60,7 +60,7 @@ exports.clear_todos = function clearTodos() {
}
function _getTodosFile() {
const cacheDir = process.env.LLM_BOT_CACHE_DIR || '/tmp';
const cacheDir = process.env.LLM_AGENT_CACHE_DIR || '/tmp';
if (!fs.existsSync(cacheDir)) {
fs.mkdirSync(cacheDir, { recursive: true });
}
@@ -56,7 +56,7 @@ def clear_todos():
def _get_todos_file() -> str:
cache_dir=os.environ.get("LLM_BOT_CACHE_DIR", "/tmp")
cache_dir=os.environ.get("LLM_AGENT_CACHE_DIR", "/tmp")
if not os.path.exists(cache_dir):
os.makedirs(cache_dir, exist_ok=True)
return os.path.join(cache_dir, "todos.json")
@@ -1,5 +1,5 @@
name: TodoBot
description: Your name is TodoBot and you are a helpful chatbot that manages a todo list.
name: Todo
description: A helpful ai agent that manages a todo list.
instructions: |
You will be provided with a list of todos.
Users can interact with you using the following commands:
@@ -60,7 +60,7 @@ _argc_before() {
}
_get_todos_file() {
echo "${LLM_BOT_CACHE_DIR:-/tmp}/todos.json"
echo "${LLM_AGENT_CACHE_DIR:-/tmp}/todos.json"
}
# See more details at https://github.com/sigoden/argc
+29 -29
View File
@@ -5,36 +5,36 @@ const fs = require("fs");
const os = require("os");
async function main() {
const [botName, botFunc, rawData] = parseArgv("run-bot.js");
const botData = parseRawData(rawData);
const [agentName, agentFunc, rawData] = parseArgv("run-agent.js");
const agentData = parseRawData(rawData);
const rootDir = path.resolve(__dirname, "..");
setupEnv(rootDir, botName);
setupEnv(rootDir, agentName);
const botToolsPath = path.resolve(rootDir, `bots/${botName}/tools.js`);
await run(botToolsPath, botFunc, botData);
const agentToolsPath = path.resolve(rootDir, `agents/${agentName}/tools.js`);
await run(agentToolsPath, agentFunc, agentData);
}
function parseArgv(thisFileName) {
let botName = process.argv[1];
let botFunc = "";
let botData = null;
let agentName = process.argv[1];
let agentFunc = "";
let agentData = null;
if (botName.endsWith(thisFileName)) {
botName = process.argv[2];
botFunc = process.argv[3];
botData = process.argv[4];
if (agentName.endsWith(thisFileName)) {
agentName = process.argv[2];
agentFunc = process.argv[3];
agentData = process.argv[4];
} else {
botName = path.basename(botName);
botFunc = process.argv[2];
botData = process.argv[3];
agentName = path.basename(agentName);
agentFunc = process.argv[2];
agentData = process.argv[3];
}
if (botName.endsWith(".js")) {
botName = botName.slice(0, -3);
if (agentName.endsWith(".js")) {
agentName = agentName.slice(0, -3);
}
return [botName, botFunc, botData];
return [agentName, agentFunc, agentData];
}
function parseRawData(data) {
@@ -48,12 +48,12 @@ function parseRawData(data) {
}
}
function setupEnv(rootDir, botName) {
function setupEnv(rootDir, agentName) {
process.env["LLM_ROOT_DIR"] = rootDir;
loadEnv(path.resolve(rootDir, ".env"));
process.env["LLM_BOT_NAME"] = botName;
process.env["LLM_BOT_ROOT_DIR"] = path.resolve(rootDir, "bots", botName);
process.env["LLM_BOT_CACHE_DIR"] = path.resolve(rootDir, "cache", botName);
process.env["LLM_AGENT_NAME"] = agentName;
process.env["LLM_AGENT_ROOT_DIR"] = path.resolve(rootDir, "agents", agentName);
process.env["LLM_AGENT_CACHE_DIR"] = path.resolve(rootDir, "cache", agentName);
}
function loadEnv(filePath) {
@@ -70,20 +70,20 @@ function loadEnv(filePath) {
} catch {}
}
async function run(botPath, botFunc, botData) {
async function run(agentPath, agentFunc, agentData) {
let mod;
if (os.platform() === "win32") {
botPath = `file://${botPath}`;
agentPath = `file://${agentPath}`;
}
try {
mod = await import(botPath);
mod = await import(agentPath);
} catch {
throw new Error(`Unable to load bot tools at '${botPath}'`);
throw new Error(`Unable to load agent tools at '${agentPath}'`);
}
if (!mod || !mod[botFunc]) {
throw new Error(`Not module function '${botFunc}' at '${botPath}'`);
if (!mod || !mod[agentFunc]) {
throw new Error(`Not module function '${agentFunc}' at '${agentPath}'`);
}
const value = await mod[botFunc](botData);
const value = await mod[agentFunc](agentData);
dumpValue(value);
}
+28 -28
View File
@@ -7,14 +7,14 @@ import importlib.util
def main():
(bot_name, bot_func, raw_data) = parse_argv("run-bot.py")
bot_data = parse_raw_data(raw_data)
(agent_name, agent_func, raw_data) = parse_argv("run-agent.py")
agent_data = parse_raw_data(raw_data)
root_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))
setup_env(root_dir, bot_name)
setup_env(root_dir, agent_name)
bot_tools_path = os.path.join(root_dir, f"bots/{bot_name}/tools.py")
run(bot_tools_path, bot_func, bot_data)
agent_tools_path = os.path.join(root_dir, f"agents/{agent_name}/tools.py")
run(agent_tools_path, agent_func, agent_data)
def parse_raw_data(data):
@@ -30,31 +30,31 @@ def parse_raw_data(data):
def parse_argv(this_file_name):
argv = sys.argv[:] + [None] * max(0, 4 - len(sys.argv))
bot_name = argv[0]
bot_func = ""
bot_data = None
agent_name = argv[0]
agent_func = ""
agent_data = None
if bot_name.endswith(this_file_name):
bot_name = sys.argv[1]
bot_func = sys.argv[2]
bot_data = sys.argv[3]
if agent_name.endswith(this_file_name):
agent_name = sys.argv[1]
agent_func = sys.argv[2]
agent_data = sys.argv[3]
else:
bot_name = os.path.basename(bot_name)
bot_func = sys.argv[1]
bot_data = sys.argv[2]
agent_name = os.path.basename(agent_name)
agent_func = sys.argv[1]
agent_data = sys.argv[2]
if bot_name.endswith(".py"):
bot_name = bot_name[:-3]
if agent_name.endswith(".py"):
agent_name = agent_name[:-3]
return bot_name, bot_func, bot_data
return agent_name, agent_func, agent_data
def setup_env(root_dir, bot_name):
def setup_env(root_dir, agent_name):
os.environ["LLM_ROOT_DIR"] = root_dir
load_env(os.path.join(root_dir, ".env"))
os.environ["LLM_BOT_NAME"] = bot_name
os.environ["LLM_BOT_ROOT_DIR"] = os.path.join(root_dir, "bots", bot_name)
os.environ["LLM_BOT_CACHE_DIR"] = os.path.join(root_dir, "cache", bot_name)
os.environ["LLM_AGENT_NAME"] = agent_name
os.environ["LLM_AGENT_ROOT_DIR"] = os.path.join(root_dir, "agents", agent_name)
os.environ["LLM_AGENT_CACHE_DIR"] = os.path.join(root_dir, "cache", agent_name)
def load_env(file_path):
@@ -71,20 +71,20 @@ def load_env(file_path):
pass
def run(bot_path, bot_func, bot_data):
def run(agent_path, agent_func, agent_data):
try:
spec = importlib.util.spec_from_file_location(
os.path.basename(bot_path), bot_path
os.path.basename(agent_path), agent_path
)
mod = importlib.util.module_from_spec(spec)
spec.loader.exec_module(mod)
except:
raise Exception(f"Unable to load bot tools at '{bot_path}'")
raise Exception(f"Unable to load agent tools at '{agent_path}'")
if not hasattr(mod, bot_func):
raise Exception(f"Not module function '{bot_func}' at '{bot_path}'")
if not hasattr(mod, agent_func):
raise Exception(f"Not module function '{agent_func}' at '{agent_path}'")
value = getattr(mod, bot_func)(**bot_data)
value = getattr(mod, agent_func)(**agent_data)
dump_value(value)
+17 -17
View File
@@ -2,26 +2,26 @@
set -e
main() {
this_file_name=run-bot.sh
this_file_name=run-agent.sh
parse_argv "$@"
root_dir="$(cd -- "$( dirname -- "${BASH_SOURCE[0]}" )/.." &> /dev/null && pwd)"
setup_env
bot_tools_path="$root_dir/bots/$bot_name/tools.sh"
agent_tools_path="$root_dir/agents/$agent_name/tools.sh"
run
}
parse_argv() {
if [[ "$0" == *"$this_file_name" ]]; then
bot_name="$1"
bot_func="$2"
bot_data="$3"
agent_name="$1"
agent_func="$2"
agent_data="$3"
else
bot_name="$(basename "$0")"
bot_func="$1"
bot_data="$2"
agent_name="$(basename "$0")"
agent_func="$1"
agent_data="$2"
fi
if [[ "$bot_name" == *.sh ]]; then
bot_name="${bot_name:0:$((${#bot_name}-3))}"
if [[ "$agent_name" == *.sh ]]; then
agent_name="${agent_name:0:$((${#agent_name}-3))}"
fi
}
@@ -30,24 +30,24 @@ setup_env() {
if [[ -f "$LLM_ROOT_DIR/.env" ]]; then
source "$LLM_ROOT_DIR/.env"
fi
export LLM_BOT_NAME="$bot_name"
export LLM_BOT_ROOT_DIR="$LLM_ROOT_DIR/bots/$bot_name"
export LLM_BOT_CACHE_DIR="$LLM_ROOT_DIR/cache/$bot_name"
export LLM_AGENT_NAME="$agent_name"
export LLM_AGENT_ROOT_DIR="$LLM_ROOT_DIR/agents/$agent_name"
export LLM_AGENT_CACHE_DIR="$LLM_ROOT_DIR/cache/$agent_name"
}
run() {
if [[ -z "$bot_data" ]]; then
if [[ -z "$agent_data" ]]; then
die "No JSON data"
fi
_jq=jq
if [[ "$OS" == "Windows_NT" ]]; then
_jq="jq -b"
bot_tools_path="$(cygpath -w "$bot_tools_path")"
agent_tools_path="$(cygpath -w "$agent_tools_path")"
fi
data="$(
echo "$bot_data" | \
echo "$agent_data" | \
$_jq -r '
to_entries | .[] |
(.key | split("_") | join("-")) as $key |
@@ -68,7 +68,7 @@ run() {
args+=("$(echo "$line" | $_jq -r '.')")
fi
done <<< "$data"
"$bot_tools_path" "$bot_func" "${args[@]}"
"$agent_tools_path" "$agent_func" "${args[@]}"
}
die() {