@openape/apes 1.3.0 → 1.3.1
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
CHANGED
|
@@ -2851,9 +2851,18 @@ function taskTools(names) {
|
|
|
2851
2851
|
function asOpenAiTools(tools) {
|
|
2852
2852
|
return tools.map((t) => ({
|
|
2853
2853
|
type: "function",
|
|
2854
|
-
function: { name: t.name, description: t.description, parameters: t.parameters }
|
|
2854
|
+
function: { name: wireToolName(t.name), description: t.description, parameters: t.parameters }
|
|
2855
2855
|
}));
|
|
2856
2856
|
}
|
|
2857
|
+
function wireToolName(local) {
|
|
2858
|
+
return local.replace(/\./g, "_");
|
|
2859
|
+
}
|
|
2860
|
+
function localToolName(wire) {
|
|
2861
|
+
for (const t of Object.values(TOOLS)) {
|
|
2862
|
+
if (wireToolName(t.name) === wire) return t.name;
|
|
2863
|
+
}
|
|
2864
|
+
return wire;
|
|
2865
|
+
}
|
|
2857
2866
|
|
|
2858
2867
|
// src/lib/agent-runtime.ts
|
|
2859
2868
|
function previewJson(value, max = 500) {
|
|
@@ -2913,19 +2922,21 @@ async function runLoop(opts) {
|
|
|
2913
2922
|
return result2;
|
|
2914
2923
|
}
|
|
2915
2924
|
for (const call of assistant.tool_calls) {
|
|
2916
|
-
const
|
|
2925
|
+
const wireName = call.function.name;
|
|
2926
|
+
const localName = localToolName(wireName);
|
|
2927
|
+
const tool = opts.tools.find((t) => t.name === localName);
|
|
2917
2928
|
let parsedArgs;
|
|
2918
2929
|
try {
|
|
2919
2930
|
parsedArgs = JSON.parse(call.function.arguments);
|
|
2920
2931
|
} catch {
|
|
2921
2932
|
parsedArgs = {};
|
|
2922
2933
|
}
|
|
2923
|
-
opts.handlers?.onToolCall?.({ name:
|
|
2924
|
-
trace.push({ step, type: "tool_call", tool:
|
|
2934
|
+
opts.handlers?.onToolCall?.({ name: localName, args: parsedArgs });
|
|
2935
|
+
trace.push({ step, type: "tool_call", tool: localName, preview: previewJson(parsedArgs) });
|
|
2925
2936
|
let result2;
|
|
2926
2937
|
let isError = false;
|
|
2927
2938
|
if (!tool) {
|
|
2928
|
-
result2 = `unknown tool: ${
|
|
2939
|
+
result2 = `unknown tool: ${localName}`;
|
|
2929
2940
|
isError = true;
|
|
2930
2941
|
} else {
|
|
2931
2942
|
try {
|
|
@@ -2936,16 +2947,16 @@ async function runLoop(opts) {
|
|
|
2936
2947
|
}
|
|
2937
2948
|
}
|
|
2938
2949
|
if (isError) {
|
|
2939
|
-
opts.handlers?.onToolError?.({ name:
|
|
2940
|
-
trace.push({ step, type: "tool_error", tool:
|
|
2950
|
+
opts.handlers?.onToolError?.({ name: localName, error: String(result2) });
|
|
2951
|
+
trace.push({ step, type: "tool_error", tool: localName, preview: previewJson(result2) });
|
|
2941
2952
|
} else {
|
|
2942
|
-
opts.handlers?.onToolResult?.({ name:
|
|
2943
|
-
trace.push({ step, type: "tool_result", tool:
|
|
2953
|
+
opts.handlers?.onToolResult?.({ name: localName, result: result2 });
|
|
2954
|
+
trace.push({ step, type: "tool_result", tool: localName, preview: previewJson(result2) });
|
|
2944
2955
|
}
|
|
2945
2956
|
messages.push({
|
|
2946
2957
|
role: "tool",
|
|
2947
2958
|
tool_call_id: call.id,
|
|
2948
|
-
name:
|
|
2959
|
+
name: wireToolName(localName),
|
|
2949
2960
|
content: typeof result2 === "string" ? result2 : JSON.stringify(result2)
|
|
2950
2961
|
});
|
|
2951
2962
|
}
|
|
@@ -5167,7 +5178,7 @@ var mcpCommand = defineCommand36({
|
|
|
5167
5178
|
if (transport !== "stdio" && transport !== "sse") {
|
|
5168
5179
|
throw new Error('Transport must be "stdio" or "sse"');
|
|
5169
5180
|
}
|
|
5170
|
-
const { startMcpServer } = await import("./server-
|
|
5181
|
+
const { startMcpServer } = await import("./server-PNV5UGY3.js");
|
|
5171
5182
|
await startMcpServer(transport, port);
|
|
5172
5183
|
}
|
|
5173
5184
|
});
|
|
@@ -5805,7 +5816,7 @@ async function bestEffortGrantCount(idp) {
|
|
|
5805
5816
|
}
|
|
5806
5817
|
}
|
|
5807
5818
|
async function runHealth(args) {
|
|
5808
|
-
const version = true ? "1.3.
|
|
5819
|
+
const version = true ? "1.3.1" : "0.0.0";
|
|
5809
5820
|
const auth = loadAuth();
|
|
5810
5821
|
if (!auth) {
|
|
5811
5822
|
throw new CliError("Not logged in. Run `apes login` first.", 1);
|
|
@@ -6078,10 +6089,10 @@ if (shellRewrite) {
|
|
|
6078
6089
|
if (shellRewrite.action === "rewrite") {
|
|
6079
6090
|
process.argv = shellRewrite.argv;
|
|
6080
6091
|
} else if (shellRewrite.action === "version") {
|
|
6081
|
-
console.log(`ape-shell ${"1.3.
|
|
6092
|
+
console.log(`ape-shell ${"1.3.1"} (OpenApe DDISA shell wrapper)`);
|
|
6082
6093
|
process.exit(0);
|
|
6083
6094
|
} else if (shellRewrite.action === "help") {
|
|
6084
|
-
console.log(`ape-shell ${"1.3.
|
|
6095
|
+
console.log(`ape-shell ${"1.3.1"} \u2014 OpenApe DDISA shell wrapper`);
|
|
6085
6096
|
console.log("");
|
|
6086
6097
|
console.log("Usage:");
|
|
6087
6098
|
console.log(" ape-shell Start interactive grant-mediated REPL");
|
|
@@ -6139,7 +6150,7 @@ var configCommand = defineCommand48({
|
|
|
6139
6150
|
var main = defineCommand48({
|
|
6140
6151
|
meta: {
|
|
6141
6152
|
name: "apes",
|
|
6142
|
-
version: "1.3.
|
|
6153
|
+
version: "1.3.1",
|
|
6143
6154
|
description: "Unified CLI for OpenApe"
|
|
6144
6155
|
},
|
|
6145
6156
|
subCommands: {
|
|
@@ -6194,7 +6205,7 @@ async function maybeRefreshAuth() {
|
|
|
6194
6205
|
}
|
|
6195
6206
|
}
|
|
6196
6207
|
await maybeRefreshAuth();
|
|
6197
|
-
await maybeWarnStaleVersion("1.3.
|
|
6208
|
+
await maybeWarnStaleVersion("1.3.1").catch(() => {
|
|
6198
6209
|
});
|
|
6199
6210
|
runMain(main).catch((err) => {
|
|
6200
6211
|
if (err instanceof CliExit) {
|