@livx.cc/agentx 0.99.55 → 0.99.57
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/dist/cli.js +8 -2
- package/dist/cli.js.map +1 -1
- package/dist/index.js +8 -2
- package/dist/index.js.map +1 -1
- package/dist/tools.shell.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -671,8 +671,10 @@ var init_tools_structured = __esm({
|
|
|
671
671
|
required: ["path", "content"],
|
|
672
672
|
properties: { path: { type: "string" }, content: { type: "string" } }
|
|
673
673
|
},
|
|
674
|
-
async run({ path, content }, ctx) {
|
|
675
|
-
const
|
|
674
|
+
async run({ path, content, contents }, ctx) {
|
|
675
|
+
const raw = content ?? contents;
|
|
676
|
+
if (raw == null) throw new Error(`Write needs \`content\` (the file body) \u2014 none was given for ${path}; nothing written.`);
|
|
677
|
+
const body = String(raw);
|
|
676
678
|
const key = ctx.fs.resolvePath(path);
|
|
677
679
|
if (await wouldClobberUnread(ctx, path, key))
|
|
678
680
|
throw new Error(`Refusing to overwrite ${path}: it exists and hasn't been Read. Read it first, then Write to replace it (or Edit to change part of it).`);
|
|
@@ -5166,6 +5168,10 @@ var Agent = class _Agent {
|
|
|
5166
5168
|
args = tc.function.arguments;
|
|
5167
5169
|
earlyError ??= `Error: invalid JSON arguments for ${tc.function.name}: ${String(e)}`;
|
|
5168
5170
|
}
|
|
5171
|
+
if (!earlyError && tool && args && typeof args === "object") {
|
|
5172
|
+
const missing = (tool.parameters?.required ?? []).filter((k) => args[k] == null);
|
|
5173
|
+
if (missing.length) earlyError = `Error: ${tc.function.name} is missing required argument(s): ${missing.join(", ")} (got: ${Object.keys(args).join(", ") || "none"}). Re-call with the exact parameter names.`;
|
|
5174
|
+
}
|
|
5169
5175
|
const hooks = this.activeHooks;
|
|
5170
5176
|
const call = { name: tc.function.name, args };
|
|
5171
5177
|
const meta = { id: tc.id };
|