@agentforge/tools 0.5.4 → 0.6.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/index.cjs +14 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +15 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { toolBuilder, ToolCategory } from '@agentforge/core';
|
|
1
|
+
import { toolBuilder, ToolCategory, LogLevel, createLogger } from '@agentforge/core';
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
import axios from 'axios';
|
|
4
4
|
import * as cheerio2 from 'cheerio';
|
|
@@ -1994,6 +1994,8 @@ var AskHumanInputSchema = z.object({
|
|
|
1994
1994
|
*/
|
|
1995
1995
|
suggestions: z.array(z.string()).optional().describe("Suggested responses for the human")
|
|
1996
1996
|
});
|
|
1997
|
+
var logLevel = process.env.LOG_LEVEL?.toLowerCase() || LogLevel.INFO;
|
|
1998
|
+
var logger = createLogger("askHuman", { level: logLevel });
|
|
1997
1999
|
function createAskHumanTool() {
|
|
1998
2000
|
return toolBuilder().name("ask-human").description(
|
|
1999
2001
|
"Ask a human for input or approval. Use this when you need human guidance, approval for a critical action, or clarification on ambiguous requirements. The agent execution will pause until the human responds."
|
|
@@ -2026,7 +2028,18 @@ function createAskHumanTool() {
|
|
|
2026
2028
|
suggestions: validatedInput.suggestions,
|
|
2027
2029
|
status: "pending"
|
|
2028
2030
|
};
|
|
2029
|
-
|
|
2031
|
+
logger.debug("About to call interrupt()", { humanRequest });
|
|
2032
|
+
let response;
|
|
2033
|
+
try {
|
|
2034
|
+
response = interrupt(humanRequest);
|
|
2035
|
+
logger.debug("interrupt() returned successfully", { response, responseType: typeof response });
|
|
2036
|
+
} catch (error) {
|
|
2037
|
+
logger.debug("interrupt() threw error (expected for GraphInterrupt)", {
|
|
2038
|
+
errorType: error?.constructor?.name,
|
|
2039
|
+
error: error instanceof Error ? error.message : String(error)
|
|
2040
|
+
});
|
|
2041
|
+
throw error;
|
|
2042
|
+
}
|
|
2030
2043
|
const respondedAt = Date.now();
|
|
2031
2044
|
const duration = respondedAt - requestedAt;
|
|
2032
2045
|
const timedOut = validatedInput.timeout > 0 && duration >= validatedInput.timeout;
|