@knid/agentx 0.1.2 → 0.1.6
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.js +8 -20
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -77,6 +77,7 @@ var agentYamlSchema = z.object({
|
|
|
77
77
|
mcp_servers: z.record(mcpServerSchema).optional(),
|
|
78
78
|
secrets: z.array(secretSchema).optional(),
|
|
79
79
|
permissions: permissionsSchema.optional(),
|
|
80
|
+
allowed_tools: z.array(z.string()).optional(),
|
|
80
81
|
config: z.array(configOptionSchema).optional(),
|
|
81
82
|
examples: z.array(exampleSchema).optional()
|
|
82
83
|
});
|
|
@@ -314,19 +315,6 @@ function buildPromptWithPipe(prompt, pipedContent) {
|
|
|
314
315
|
${prompt}`;
|
|
315
316
|
}
|
|
316
317
|
|
|
317
|
-
// src/runtime/output-formatter.ts
|
|
318
|
-
function formatOutput(data, format) {
|
|
319
|
-
if (format === "json") {
|
|
320
|
-
try {
|
|
321
|
-
const parsed = JSON.parse(data);
|
|
322
|
-
return JSON.stringify(parsed, null, 2);
|
|
323
|
-
} catch {
|
|
324
|
-
return JSON.stringify({ output: data });
|
|
325
|
-
}
|
|
326
|
-
}
|
|
327
|
-
return data;
|
|
328
|
-
}
|
|
329
|
-
|
|
330
318
|
// src/telemetry/reporter.ts
|
|
331
319
|
function sendTelemetry(event) {
|
|
332
320
|
try {
|
|
@@ -442,6 +430,9 @@ function buildClaudeArgs(options) {
|
|
|
442
430
|
if (options.mcpConfigPath) {
|
|
443
431
|
args.push("--mcp-config", options.mcpConfigPath);
|
|
444
432
|
}
|
|
433
|
+
if (options.allowedTools && options.allowedTools.length > 0) {
|
|
434
|
+
args.push("--allowedTools", ...options.allowedTools);
|
|
435
|
+
}
|
|
445
436
|
if (options.maxTurns !== void 0) {
|
|
446
437
|
args.push("--max-turns", String(options.maxTurns));
|
|
447
438
|
}
|
|
@@ -486,7 +477,8 @@ async function runAgent(agentName, options) {
|
|
|
486
477
|
mcpConfigPath,
|
|
487
478
|
maxTurns: globalConfig.claude_defaults.max_turns,
|
|
488
479
|
outputFormat: options.outputFormat ?? globalConfig.default_output,
|
|
489
|
-
interactive: options.interactive
|
|
480
|
+
interactive: options.interactive,
|
|
481
|
+
allowedTools: manifest.allowed_tools
|
|
490
482
|
});
|
|
491
483
|
if (options.debug) {
|
|
492
484
|
console.error(`[debug] claude ${claudeArgs.join(" ")}`);
|
|
@@ -502,18 +494,14 @@ async function runAgent(agentName, options) {
|
|
|
502
494
|
});
|
|
503
495
|
return "";
|
|
504
496
|
}
|
|
505
|
-
|
|
506
|
-
const output = formatOutput(result.stdout, options.outputFormat ?? "text");
|
|
507
|
-
if (!options.quiet) {
|
|
508
|
-
process.stdout.write(output);
|
|
509
|
-
}
|
|
497
|
+
await execa(claudePath, claudeArgs, { stdio: "inherit" });
|
|
510
498
|
sendTelemetry({
|
|
511
499
|
agent: agentFullName,
|
|
512
500
|
version: manifest.version,
|
|
513
501
|
success: true,
|
|
514
502
|
duration_ms: Date.now() - startTime
|
|
515
503
|
});
|
|
516
|
-
return
|
|
504
|
+
return "";
|
|
517
505
|
} catch (error) {
|
|
518
506
|
sendTelemetry({
|
|
519
507
|
agent: agentFullName,
|