@botpress/adk-cli 1.4.3 → 1.4.4
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 +145 -156
- package/package.json +4 -3
package/dist/cli.js
CHANGED
|
@@ -311960,15 +311960,23 @@ __export(exports_internal, {
|
|
|
311960
311960
|
createSpan: () => createSpan,
|
|
311961
311961
|
contextManager: () => contextManager,
|
|
311962
311962
|
Workflow: () => BaseWorkflow,
|
|
311963
|
+
WEBHOOK_ID_HEADER: () => WEBHOOK_ID_HEADER,
|
|
311963
311964
|
Trigger: () => Trigger,
|
|
311964
311965
|
Table: () => BaseTable,
|
|
311965
311966
|
Primitives: () => Primitives3,
|
|
311967
|
+
OPERATION_TYPE_HEADER: () => OPERATION_TYPE_HEADER,
|
|
311968
|
+
OPERATION_SUBTYPE_HEADER: () => OPERATION_SUBTYPE_HEADER,
|
|
311969
|
+
LOG_DELIMITER: () => LOG_DELIMITER,
|
|
311966
311970
|
Knowledge: () => BaseKnowledge,
|
|
311967
311971
|
Errors: () => Errors,
|
|
311968
311972
|
DataSource: () => DataSource2,
|
|
311969
311973
|
Conversation: () => BaseConversation,
|
|
311974
|
+
CONFIGURATION_TYPE_HEADER: () => CONFIGURATION_TYPE_HEADER,
|
|
311975
|
+
CONFIGURATION_PAYLOAD_HEADER: () => CONFIGURATION_PAYLOAD_HEADER,
|
|
311970
311976
|
BuiltInWorkflows: () => BuiltInWorkflows,
|
|
311971
311977
|
BaseWorkflowInstance: () => BaseWorkflowInstance,
|
|
311978
|
+
BOT_USER_ID_HEADER: () => BOT_USER_ID_HEADER,
|
|
311979
|
+
BOT_ID_HEADER: () => BOT_ID_HEADER,
|
|
311972
311980
|
Action: () => Action
|
|
311973
311981
|
});
|
|
311974
311982
|
import { EventEmitter as EventEmitter22 } from "events";
|
|
@@ -313944,7 +313952,16 @@ function serializeArgs(...args) {
|
|
|
313944
313952
|
});
|
|
313945
313953
|
}
|
|
313946
313954
|
function writeStructuredLog(type, ...args) {
|
|
313955
|
+
const output2 = process.stdout;
|
|
313947
313956
|
const { spanId, traceId } = getTraceContext();
|
|
313957
|
+
let maybeArgObj = null;
|
|
313958
|
+
try {
|
|
313959
|
+
maybeArgObj = typeof args[0] === "string" ? JSON.parse(args[0]) : args[0];
|
|
313960
|
+
} catch {}
|
|
313961
|
+
if (maybeArgObj && typeof maybeArgObj === "object" && maybeArgObj.type === "worker_stats") {
|
|
313962
|
+
output2.write((0, import_fast_safe_stringify3.default)(maybeArgObj) + LOG_DELIMITER);
|
|
313963
|
+
return;
|
|
313964
|
+
}
|
|
313948
313965
|
const logEntry = {
|
|
313949
313966
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
313950
313967
|
type,
|
|
@@ -313956,9 +313973,7 @@ function writeStructuredLog(type, ...args) {
|
|
|
313956
313973
|
if (traceId) {
|
|
313957
313974
|
logEntry.traceId = traceId;
|
|
313958
313975
|
}
|
|
313959
|
-
|
|
313960
|
-
output2.write(JSON.stringify(logEntry) + `
|
|
313961
|
-
`);
|
|
313976
|
+
output2.write((0, import_fast_safe_stringify3.default)(logEntry) + LOG_DELIMITER);
|
|
313962
313977
|
}
|
|
313963
313978
|
function installStructuredLogging() {
|
|
313964
313979
|
console.log = (...args) => {
|
|
@@ -315115,48 +315130,18 @@ function initializeParentWorker(bot2) {
|
|
|
315115
315130
|
queueSize: detailedStats.currentQueueSize
|
|
315116
315131
|
}
|
|
315117
315132
|
}));
|
|
315118
|
-
},
|
|
315133
|
+
}, 500);
|
|
315119
315134
|
}
|
|
315120
315135
|
function debugLog3(...args) {
|
|
315121
315136
|
if (DEBUG_ENABLED3) {
|
|
315122
|
-
|
|
315137
|
+
console.log(...args);
|
|
315123
315138
|
}
|
|
315124
315139
|
}
|
|
315125
|
-
function setupLogRelay() {
|
|
315126
|
-
if (!parentPort)
|
|
315127
|
-
return;
|
|
315128
|
-
const originalConsole = {
|
|
315129
|
-
log: console.log,
|
|
315130
|
-
info: console.info,
|
|
315131
|
-
warn: console.warn,
|
|
315132
|
-
error: console.error,
|
|
315133
|
-
debug: console.debug
|
|
315134
|
-
};
|
|
315135
|
-
originalLog = originalConsole.log;
|
|
315136
|
-
const createLogRelay = (level) => {
|
|
315137
|
-
return (...args) => {
|
|
315138
|
-
parentPort.postMessage({
|
|
315139
|
-
type: "log",
|
|
315140
|
-
level,
|
|
315141
|
-
args
|
|
315142
|
-
});
|
|
315143
|
-
if (DEBUG_ENABLED3) {
|
|
315144
|
-
originalConsole[level](...args);
|
|
315145
|
-
}
|
|
315146
|
-
};
|
|
315147
|
-
};
|
|
315148
|
-
console.log = createLogRelay("log");
|
|
315149
|
-
console.info = createLogRelay("info");
|
|
315150
|
-
console.warn = createLogRelay("warn");
|
|
315151
|
-
console.error = createLogRelay("error");
|
|
315152
|
-
console.debug = createLogRelay("debug");
|
|
315153
|
-
}
|
|
315154
315140
|
function runWorker(bot2) {
|
|
315155
315141
|
const expiryTime = process.env.WORKER_EXPIRY_TIME ? parseInt(process.env.WORKER_EXPIRY_TIME, 10) : Date.now() + 300000;
|
|
315156
315142
|
if (!parentPort) {
|
|
315157
315143
|
throw new Error("This script must be run as a worker thread");
|
|
315158
315144
|
}
|
|
315159
|
-
setupLogRelay();
|
|
315160
315145
|
parentPort.on("message", async (message2) => {
|
|
315161
315146
|
const { type, taskId, event: event2 } = message2;
|
|
315162
315147
|
if (type !== "event" || !taskId) {
|
|
@@ -315452,7 +315437,8 @@ var import_const, import_const2, __create4, __defProp6, __getOwnPropDesc3, __get
|
|
|
315452
315437
|
return tracker;
|
|
315453
315438
|
}
|
|
315454
315439
|
throw new Error("PromiseTracker not found in context. Make sure to initialize it in your runtime setup.");
|
|
315455
|
-
}, InterfaceMappings,
|
|
315440
|
+
}, InterfaceMappings, BOT_ID_HEADER = "x-bot-id", BOT_USER_ID_HEADER = "x-bot-user-id", WEBHOOK_ID_HEADER = "x-webhook-id", CONFIGURATION_TYPE_HEADER = "x-bp-configuration-type", CONFIGURATION_PAYLOAD_HEADER = "x-bp-configuration", OPERATION_TYPE_HEADER = "x-bp-operation", OPERATION_SUBTYPE_HEADER = "x-bp-type", LOG_DELIMITER = `<|MESSAGE_END|>
|
|
315441
|
+
`, AgentRegistry = class {
|
|
315456
315442
|
_data = null;
|
|
315457
315443
|
initialize(data) {
|
|
315458
315444
|
if (this._data) {
|
|
@@ -317478,6 +317464,7 @@ var import_const, import_const2, __create4, __defProp6, __getOwnPropDesc3, __get
|
|
|
317478
317464
|
constructor(props) {
|
|
317479
317465
|
this.name = props.name;
|
|
317480
317466
|
this.sources = props.sources;
|
|
317467
|
+
this.description = props.description;
|
|
317481
317468
|
}
|
|
317482
317469
|
getDefinition() {
|
|
317483
317470
|
return {
|
|
@@ -317891,6 +317878,9 @@ var import_const, import_const2, __create4, __defProp6, __getOwnPropDesc3, __get
|
|
|
317891
317878
|
case "debug":
|
|
317892
317879
|
console.debug(prefix, ...args);
|
|
317893
317880
|
break;
|
|
317881
|
+
case "log":
|
|
317882
|
+
console.log(prefix, ...args);
|
|
317883
|
+
break;
|
|
317894
317884
|
default:
|
|
317895
317885
|
debugLog(prefix, ...args);
|
|
317896
317886
|
}
|
|
@@ -318231,7 +318221,7 @@ var import_const, import_const2, __create4, __defProp6, __getOwnPropDesc3, __get
|
|
|
318231
318221
|
return lines.join(`
|
|
318232
318222
|
`);
|
|
318233
318223
|
}
|
|
318234
|
-
}, DEBUG_ENABLED2, globalWorkerPool = null, DEBUG_ENABLED3,
|
|
318224
|
+
}, DEBUG_ENABLED2, globalWorkerPool = null, DEBUG_ENABLED3, isWorkerMode = () => {
|
|
318235
318225
|
const mode = process.env.WORKER_MODE?.trim().toLowerCase();
|
|
318236
318226
|
return mode === "true" || mode === "1" || mode === "yes";
|
|
318237
318227
|
};
|
|
@@ -318290,7 +318280,7 @@ var init_internal = __esm(() => {
|
|
|
318290
318280
|
});
|
|
318291
318281
|
init_define_PACKAGE_VERSIONS = __esm2({
|
|
318292
318282
|
"<define:__PACKAGE_VERSIONS__>"() {
|
|
318293
|
-
define_PACKAGE_VERSIONS_default = { runtime: "1.2.
|
|
318283
|
+
define_PACKAGE_VERSIONS_default = { runtime: "1.2.4", adk: "not-installed", sdk: "4.16.0", llmz: "0.0.26", zai: "2.1.16", cognitive: "0.1.47" };
|
|
318294
318284
|
}
|
|
318295
318285
|
});
|
|
318296
318286
|
init_globalThis = __esm2({
|
|
@@ -352676,6 +352666,9 @@ ${issues.join(`
|
|
|
352676
352666
|
Autonomous2.DefaultExit = DefaultExit;
|
|
352677
352667
|
function createKnowledgeSearchTool(knowledgeBases) {
|
|
352678
352668
|
const kbNames = knowledgeBases.map((kb3) => kb3.name);
|
|
352669
|
+
for (const kb3 of knowledgeBases) {
|
|
352670
|
+
console.log(kb3.name, kb3.description);
|
|
352671
|
+
}
|
|
352679
352672
|
const description = knowledgeBases.map((kb3) => `- "${kb3.name}": ${kb3.description || "No description"}`).join(`
|
|
352680
352673
|
`);
|
|
352681
352674
|
return new Tool({
|
|
@@ -352744,6 +352737,8 @@ If the question is not related to the knowledge bases, do NOT use this tool.`.tr
|
|
|
352744
352737
|
message2.push(p.content);
|
|
352745
352738
|
message2.push(`</${tag}>`);
|
|
352746
352739
|
}
|
|
352740
|
+
console.log(message2.join(`
|
|
352741
|
+
`).trim());
|
|
352747
352742
|
throw new Autonomous2.ThinkSignal(`We got the search results. When answering the question, you MUST add inline the citations used (eg: "Yes, the price is $10${example} ...")`, message2.join(`
|
|
352748
352743
|
`).trim());
|
|
352749
352744
|
}
|
|
@@ -352839,6 +352834,7 @@ Always prefer information from the knowledge bases over general knowledge when a
|
|
|
352839
352834
|
message: "ThinkSignal"
|
|
352840
352835
|
});
|
|
352841
352836
|
err[HandledErrorProp] = true;
|
|
352837
|
+
throw err;
|
|
352842
352838
|
} else {
|
|
352843
352839
|
s2.setAttributes({
|
|
352844
352840
|
"autonomous.tool.status": "error",
|
|
@@ -354873,7 +354869,6 @@ ${iteration.status.execution_error.stack}`;
|
|
|
354873
354869
|
init_define_BUILD();
|
|
354874
354870
|
init_define_PACKAGE_VERSIONS();
|
|
354875
354871
|
DEBUG_ENABLED3 = process.env.BP_DEBUG === "true" || process.env.BP_DEBUG === "1";
|
|
354876
|
-
originalLog = console.log;
|
|
354877
354872
|
/*! Bundled license information:
|
|
354878
354873
|
|
|
354879
354874
|
lodash/lodash.js:
|
|
@@ -371056,7 +371051,6 @@ async function generateWorkflowTypes(project) {
|
|
|
371056
371051
|
const workflowModule = await import(`${workflowPath}?t=${Date.now()}`);
|
|
371057
371052
|
const workflowInstance = workflowModule[workflowRef.export] || workflowModule.default;
|
|
371058
371053
|
if (!workflowInstance) {
|
|
371059
|
-
console.warn(`No default export found in workflow file: ${workflowRef.path}`);
|
|
371060
371054
|
continue;
|
|
371061
371055
|
}
|
|
371062
371056
|
const inputType = workflowInstance.inputSchema ? workflowInstance.inputSchema.toTypescriptType?.() || "any" : "{}";
|
|
@@ -372077,16 +372071,16 @@ export {};
|
|
|
372077
372071
|
|
|
372078
372072
|
if (isWorkerMode() && isMainThread) {
|
|
372079
372073
|
// Branch 1: Main thread in worker mode - initialize parent with pool
|
|
372080
|
-
console.log("[Main] Initializing parent worker with pool...");
|
|
372074
|
+
if (process.env.BP_DEBUG) console.log("[Main] Initializing parent worker with pool...");
|
|
372081
372075
|
initializeParentWorker(bot);
|
|
372082
372076
|
} else if (isWorkerMode() && process.env.IS_DEV_WORKER === "true") {
|
|
372083
372077
|
// Branch 2: Worker thread - run child worker
|
|
372084
|
-
console.log("[Worker] Initializing child worker...");
|
|
372078
|
+
if (process.env.BP_DEBUG) console.log("[Worker] Initializing child worker...");
|
|
372085
372079
|
runWorker(bot);
|
|
372086
372080
|
setupAdkRuntime(bot);
|
|
372087
372081
|
} else {
|
|
372088
372082
|
// Branch 3: Worker mode disabled - single-thread mode
|
|
372089
|
-
console.log("[Bot] Running in single-thread mode");
|
|
372083
|
+
if (process.env.BP_DEBUG) console.log("[Bot] Running in single-thread mode");
|
|
372090
372084
|
setupAdkRuntime(bot);
|
|
372091
372085
|
}
|
|
372092
372086
|
|
|
@@ -378117,7 +378111,7 @@ var init_Separator = __esm(async () => {
|
|
|
378117
378111
|
var require_package3 = __commonJS((exports, module) => {
|
|
378118
378112
|
module.exports = {
|
|
378119
378113
|
name: "@botpress/adk",
|
|
378120
|
-
version: "1.2.
|
|
378114
|
+
version: "1.2.4",
|
|
378121
378115
|
description: "Core ADK library for building AI agents on Botpress",
|
|
378122
378116
|
type: "module",
|
|
378123
378117
|
main: "dist/index.js",
|
|
@@ -378997,21 +378991,21 @@ var import_react34, jsx_dev_runtime15, BlinkingCursor = () => {
|
|
|
378997
378991
|
workerStats && /* @__PURE__ */ jsx_dev_runtime15.jsxDEV(jsx_dev_runtime15.Fragment, {
|
|
378998
378992
|
children: [
|
|
378999
378993
|
/* @__PURE__ */ jsx_dev_runtime15.jsxDEV(Text, {
|
|
379000
|
-
children: "
|
|
378994
|
+
children: " "
|
|
379001
378995
|
}, undefined, false, undefined, this),
|
|
379002
378996
|
/* @__PURE__ */ jsx_dev_runtime15.jsxDEV(Text, {
|
|
379003
|
-
color: theme.accent.purple,
|
|
378997
|
+
color: workerStats.busy > 0 ? theme.accent.purple : theme.text.dim,
|
|
379004
378998
|
children: "\u25CF"
|
|
379005
378999
|
}, undefined, false, undefined, this),
|
|
379006
|
-
/* @__PURE__ */ jsx_dev_runtime15.jsxDEV(Text, {
|
|
379000
|
+
workerStats.busy > 0 ? /* @__PURE__ */ jsx_dev_runtime15.jsxDEV(Text, {
|
|
379007
379001
|
children: [
|
|
379008
379002
|
" ",
|
|
379009
|
-
"Workers ",
|
|
379010
379003
|
workerStats.busy,
|
|
379011
|
-
"
|
|
379012
|
-
workerStats.total
|
|
379004
|
+
" Processing"
|
|
379013
379005
|
]
|
|
379014
|
-
}, undefined, true, undefined, this),
|
|
379006
|
+
}, undefined, true, undefined, this) : /* @__PURE__ */ jsx_dev_runtime15.jsxDEV(Text, {
|
|
379007
|
+
children: " Idle"
|
|
379008
|
+
}, undefined, false, undefined, this),
|
|
379015
379009
|
workerStats.queueSize > 0 && /* @__PURE__ */ jsx_dev_runtime15.jsxDEV(Text, {
|
|
379016
379010
|
color: theme.status.warning,
|
|
379017
379011
|
children: [
|
|
@@ -379061,10 +379055,14 @@ var init_DevStatus = __esm(async () => {
|
|
|
379061
379055
|
|
|
379062
379056
|
// src/components/LogsView.tsx
|
|
379063
379057
|
import { readFileSync as readFileSync8, existsSync as existsSync7, statSync as statSync2, watchFile, unwatchFile } from "fs";
|
|
379064
|
-
var import_react35, jsx_dev_runtime16, parseLogLine = (line) => {
|
|
379058
|
+
var import_react35, jsx_dev_runtime16, parseLogLine = (line, lineNumber) => {
|
|
379065
379059
|
try {
|
|
379066
379060
|
const parsed = JSON.parse(line);
|
|
379061
|
+
if (parsed.type === "worker_stats") {
|
|
379062
|
+
return null;
|
|
379063
|
+
}
|
|
379067
379064
|
return {
|
|
379065
|
+
line: lineNumber,
|
|
379068
379066
|
timestamp: parsed.timestamp || new Date().toISOString(),
|
|
379069
379067
|
type: parsed.type || "info",
|
|
379070
379068
|
message: parsed.message,
|
|
@@ -379093,7 +379091,7 @@ var import_react35, jsx_dev_runtime16, parseLogLine = (line) => {
|
|
|
379093
379091
|
}) => {
|
|
379094
379092
|
const theme = useTheme();
|
|
379095
379093
|
const [logs, setLogs] = import_react35.useState([]);
|
|
379096
|
-
const
|
|
379094
|
+
const lastSize = import_react35.useRef(0);
|
|
379097
379095
|
const supportsInput = process.stdin.isTTY === true;
|
|
379098
379096
|
if (supportsInput) {
|
|
379099
379097
|
use_input_default((input, _key) => {
|
|
@@ -379102,24 +379100,6 @@ var import_react35, jsx_dev_runtime16, parseLogLine = (line) => {
|
|
|
379102
379100
|
}
|
|
379103
379101
|
});
|
|
379104
379102
|
}
|
|
379105
|
-
import_react35.useEffect(() => {
|
|
379106
|
-
if (!existsSync7(logFilePath)) {
|
|
379107
|
-
return;
|
|
379108
|
-
}
|
|
379109
|
-
const content = readFileSync8(logFilePath, "utf-8");
|
|
379110
|
-
const lines = content.split(`
|
|
379111
|
-
`).filter((line) => line.trim());
|
|
379112
|
-
const entries = [];
|
|
379113
|
-
for (const line of lines) {
|
|
379114
|
-
const entry = parseLogLine(line);
|
|
379115
|
-
if (entry) {
|
|
379116
|
-
entries.push(entry);
|
|
379117
|
-
}
|
|
379118
|
-
}
|
|
379119
|
-
setLogs(entries);
|
|
379120
|
-
const stats = statSync2(logFilePath);
|
|
379121
|
-
setLastSize(stats.size);
|
|
379122
|
-
}, [logFilePath]);
|
|
379123
379103
|
import_react35.useEffect(() => {
|
|
379124
379104
|
if (!existsSync7(logFilePath)) {
|
|
379125
379105
|
return;
|
|
@@ -379127,31 +379107,38 @@ var import_react35, jsx_dev_runtime16, parseLogLine = (line) => {
|
|
|
379127
379107
|
const checkForNewLogs = () => {
|
|
379128
379108
|
try {
|
|
379129
379109
|
const stats = statSync2(logFilePath);
|
|
379130
|
-
if (stats.size
|
|
379131
|
-
|
|
379132
|
-
|
|
379133
|
-
|
|
379134
|
-
|
|
379135
|
-
|
|
379136
|
-
|
|
379137
|
-
|
|
379138
|
-
|
|
379139
|
-
|
|
379110
|
+
if (stats.size <= lastSize.current) {
|
|
379111
|
+
return;
|
|
379112
|
+
}
|
|
379113
|
+
lastSize.current = stats.size;
|
|
379114
|
+
const content = readFileSync8(logFilePath, "utf-8");
|
|
379115
|
+
const lines = content.split(`
|
|
379116
|
+
`);
|
|
379117
|
+
const entries = [];
|
|
379118
|
+
for (let i2 = 0;i2 < lines.length; i2++) {
|
|
379119
|
+
const line = lines[i2];
|
|
379120
|
+
const entry = parseLogLine(line, i2);
|
|
379121
|
+
if (entry) {
|
|
379122
|
+
entries.push(entry);
|
|
379140
379123
|
}
|
|
379141
|
-
setLogs(entries);
|
|
379142
|
-
setLastSize(stats.size);
|
|
379143
379124
|
}
|
|
379125
|
+
setLogs((existing) => {
|
|
379126
|
+
const newEntries = entries.filter((e6) => existing.every((ex4) => ex4.line !== e6.line));
|
|
379127
|
+
return [...existing, ...newEntries];
|
|
379128
|
+
});
|
|
379144
379129
|
} catch (error) {}
|
|
379145
379130
|
};
|
|
379146
379131
|
watchFile(logFilePath, { interval: 100 }, checkForNewLogs);
|
|
379132
|
+
checkForNewLogs();
|
|
379147
379133
|
return () => {
|
|
379148
379134
|
unwatchFile(logFilePath);
|
|
379149
379135
|
};
|
|
379150
|
-
}, [logFilePath
|
|
379136
|
+
}, [logFilePath]);
|
|
379151
379137
|
return /* @__PURE__ */ jsx_dev_runtime16.jsxDEV(Box_default, {
|
|
379152
379138
|
flexDirection: "column",
|
|
379153
379139
|
paddingX: 1,
|
|
379154
379140
|
paddingY: 1,
|
|
379141
|
+
overflowY: "visible",
|
|
379155
379142
|
children: [
|
|
379156
379143
|
/* @__PURE__ */ jsx_dev_runtime16.jsxDEV(Box_default, {
|
|
379157
379144
|
flexDirection: "column",
|
|
@@ -379193,33 +379180,39 @@ var import_react35, jsx_dev_runtime16, parseLogLine = (line) => {
|
|
|
379193
379180
|
]
|
|
379194
379181
|
}, undefined, true, undefined, this)
|
|
379195
379182
|
}, undefined, false, undefined, this),
|
|
379196
|
-
/* @__PURE__ */ jsx_dev_runtime16.jsxDEV(
|
|
379197
|
-
|
|
379198
|
-
|
|
379199
|
-
|
|
379200
|
-
|
|
379201
|
-
|
|
379202
|
-
|
|
379203
|
-
|
|
379204
|
-
|
|
379205
|
-
|
|
379206
|
-
|
|
379207
|
-
|
|
379208
|
-
|
|
379209
|
-
|
|
379210
|
-
|
|
379211
|
-
|
|
379212
|
-
|
|
379213
|
-
|
|
379214
|
-
|
|
379215
|
-
|
|
379216
|
-
|
|
379217
|
-
|
|
379218
|
-
|
|
379219
|
-
|
|
379220
|
-
|
|
379221
|
-
|
|
379222
|
-
|
|
379183
|
+
/* @__PURE__ */ jsx_dev_runtime16.jsxDEV(Box_default, {
|
|
379184
|
+
children: /* @__PURE__ */ jsx_dev_runtime16.jsxDEV(Static, {
|
|
379185
|
+
items: logs,
|
|
379186
|
+
style: {
|
|
379187
|
+
overflowY: "visible",
|
|
379188
|
+
justifyContent: "flex-end"
|
|
379189
|
+
},
|
|
379190
|
+
children: (entry) => {
|
|
379191
|
+
const timestamp = new Date(entry.timestamp);
|
|
379192
|
+
const timeStr = timestamp.toLocaleTimeString();
|
|
379193
|
+
const message2 = entry.message || entry.args?.join(" ") || "";
|
|
379194
|
+
const color = getLogLevelColor(entry.type, theme);
|
|
379195
|
+
return /* @__PURE__ */ jsx_dev_runtime16.jsxDEV(Box_default, {
|
|
379196
|
+
children: [
|
|
379197
|
+
/* @__PURE__ */ jsx_dev_runtime16.jsxDEV(Text, {
|
|
379198
|
+
color: theme.text.dim,
|
|
379199
|
+
children: [
|
|
379200
|
+
"[",
|
|
379201
|
+
timeStr,
|
|
379202
|
+
"]"
|
|
379203
|
+
]
|
|
379204
|
+
}, undefined, true, undefined, this),
|
|
379205
|
+
/* @__PURE__ */ jsx_dev_runtime16.jsxDEV(Text, {
|
|
379206
|
+
children: " "
|
|
379207
|
+
}, undefined, false, undefined, this),
|
|
379208
|
+
/* @__PURE__ */ jsx_dev_runtime16.jsxDEV(Text, {
|
|
379209
|
+
color,
|
|
379210
|
+
children: message2
|
|
379211
|
+
}, undefined, false, undefined, this)
|
|
379212
|
+
]
|
|
379213
|
+
}, entry.line, true, undefined, this);
|
|
379214
|
+
}
|
|
379215
|
+
}, undefined, false, undefined, this)
|
|
379223
379216
|
}, undefined, false, undefined, this),
|
|
379224
379217
|
/* @__PURE__ */ jsx_dev_runtime16.jsxDEV(Box_default, {
|
|
379225
379218
|
marginTop: 1,
|
|
@@ -379261,7 +379254,9 @@ async function findAgentRoot(startPath) {
|
|
|
379261
379254
|
async function findAgentRootOrFail(startPath) {
|
|
379262
379255
|
const root4 = await findAgentRoot(startPath);
|
|
379263
379256
|
if (!root4) {
|
|
379264
|
-
throw new Error(
|
|
379257
|
+
throw new Error(`No ADK agent root found in the current directory or its parents.
|
|
379258
|
+
|
|
379259
|
+
` + "Run `adk help` to see all commands\n" + "Run `adk init` to create a new agent");
|
|
379265
379260
|
}
|
|
379266
379261
|
return root4;
|
|
379267
379262
|
}
|
|
@@ -383545,6 +383540,9 @@ var import_react36, jsx_dev_runtime18, DevUI = ({
|
|
|
383545
383540
|
return false;
|
|
383546
383541
|
}
|
|
383547
383542
|
};
|
|
383543
|
+
const isWorkerStats = (obj) => {
|
|
383544
|
+
return typeof obj === "object" && obj !== null && "type" in obj && obj.type === "worker_stats" && "stats" in obj;
|
|
383545
|
+
};
|
|
383548
383546
|
const formatAndWriteLog = (logEntry) => {
|
|
383549
383547
|
if (!options.logs)
|
|
383550
383548
|
return;
|
|
@@ -383567,62 +383565,52 @@ var import_react36, jsx_dev_runtime18, DevUI = ({
|
|
|
383567
383565
|
`);
|
|
383568
383566
|
};
|
|
383569
383567
|
devCommand.on("stdout", (data) => {
|
|
383570
|
-
const lines = data.split(
|
|
383571
|
-
`);
|
|
383568
|
+
const lines = data.split(LOG_DELIMITER).map((line) => line.replaceAll(LOG_DELIMITER, "").trim());
|
|
383572
383569
|
for (const line of lines) {
|
|
383573
|
-
|
|
383574
|
-
|
|
383575
|
-
|
|
383576
|
-
|
|
383577
|
-
|
|
383578
|
-
|
|
383579
|
-
|
|
383580
|
-
|
|
383581
|
-
|
|
383582
|
-
|
|
383583
|
-
|
|
383584
|
-
logStream.write(trimmed + `
|
|
383585
|
-
`);
|
|
383586
|
-
formatAndWriteLog(trimmed);
|
|
383587
|
-
} else {
|
|
383588
|
-
const logEntry = JSON.stringify({
|
|
383570
|
+
let trimmed = line.trim();
|
|
383571
|
+
let parsed = null;
|
|
383572
|
+
try {
|
|
383573
|
+
parsed = JSON.parse(trimmed);
|
|
383574
|
+
} catch {}
|
|
383575
|
+
if (isWorkerStats(parsed)) {
|
|
383576
|
+
setWorkerStats(parsed.stats);
|
|
383577
|
+
updateWorkerStats(parsed.stats);
|
|
383578
|
+
} else if (trimmed) {
|
|
383579
|
+
if (!isStructuredLog(trimmed)) {
|
|
383580
|
+
trimmed = JSON.stringify({
|
|
383589
383581
|
timestamp: new Date().toISOString(),
|
|
383590
|
-
type: "
|
|
383582
|
+
type: "stderr",
|
|
383591
383583
|
args: [trimmed]
|
|
383592
|
-
})
|
|
383593
|
-
`;
|
|
383594
|
-
logStream.write(logEntry);
|
|
383595
|
-
if (options.logs) {
|
|
383596
|
-
process.stdout.write(trimmed + `
|
|
383597
|
-
`);
|
|
383598
|
-
}
|
|
383584
|
+
});
|
|
383599
383585
|
}
|
|
383586
|
+
logStream.write(trimmed + `
|
|
383587
|
+
`);
|
|
383588
|
+
formatAndWriteLog(trimmed);
|
|
383600
383589
|
}
|
|
383601
383590
|
}
|
|
383602
383591
|
});
|
|
383603
383592
|
devCommand.on("stderr", (data) => {
|
|
383604
|
-
const lines = data.split(
|
|
383605
|
-
`);
|
|
383593
|
+
const lines = data.split(LOG_DELIMITER).map((line) => line.replaceAll(LOG_DELIMITER, "").trim());
|
|
383606
383594
|
for (const line of lines) {
|
|
383607
|
-
|
|
383608
|
-
|
|
383609
|
-
|
|
383610
|
-
|
|
383611
|
-
|
|
383612
|
-
|
|
383613
|
-
|
|
383614
|
-
|
|
383595
|
+
let trimmed = line.trim();
|
|
383596
|
+
let parsed = null;
|
|
383597
|
+
try {
|
|
383598
|
+
parsed = JSON.parse(trimmed);
|
|
383599
|
+
} catch {}
|
|
383600
|
+
if (isWorkerStats(parsed)) {
|
|
383601
|
+
setWorkerStats(parsed.stats);
|
|
383602
|
+
updateWorkerStats(parsed.stats);
|
|
383603
|
+
} else if (trimmed) {
|
|
383604
|
+
if (!isStructuredLog(trimmed)) {
|
|
383605
|
+
trimmed = JSON.stringify({
|
|
383615
383606
|
timestamp: new Date().toISOString(),
|
|
383616
383607
|
type: "stderr",
|
|
383617
383608
|
args: [trimmed]
|
|
383618
|
-
})
|
|
383619
|
-
`;
|
|
383620
|
-
logStream.write(logEntry);
|
|
383621
|
-
if (options.logs) {
|
|
383622
|
-
process.stderr.write(trimmed + `
|
|
383623
|
-
`);
|
|
383624
|
-
}
|
|
383609
|
+
});
|
|
383625
383610
|
}
|
|
383611
|
+
logStream.write(trimmed + `
|
|
383612
|
+
`);
|
|
383613
|
+
formatAndWriteLog(trimmed);
|
|
383626
383614
|
}
|
|
383627
383615
|
}
|
|
383628
383616
|
});
|
|
@@ -383985,6 +383973,7 @@ var init_adk_dev = __esm(async () => {
|
|
|
383985
383973
|
init_debugger();
|
|
383986
383974
|
init_inspector_pid_cache();
|
|
383987
383975
|
init_editor_detector();
|
|
383976
|
+
init_internal();
|
|
383988
383977
|
await __promiseAll([
|
|
383989
383978
|
init_build2(),
|
|
383990
383979
|
init_DevStatus(),
|
|
@@ -395398,7 +395387,7 @@ function formatHelp(cmd, version) {
|
|
|
395398
395387
|
// src/cli.ts
|
|
395399
395388
|
var __filename2 = fileURLToPath9(import.meta.url);
|
|
395400
395389
|
var __dirname5 = dirname3(__filename2);
|
|
395401
|
-
var CLI_VERSION = "1.4.
|
|
395390
|
+
var CLI_VERSION = "1.4.4";
|
|
395402
395391
|
program.name("adk").description("Botpress Agent Development Kit (ADK) - CLI for building AI agents").version(CLI_VERSION).option("--no-cache", "Disable caching for integration lookups").configureHelp({
|
|
395403
395392
|
formatHelp: () => formatHelp(program, CLI_VERSION)
|
|
395404
395393
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@botpress/adk-cli",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.4",
|
|
4
4
|
"description": "Command-line interface for the Botpress Agent Development Kit (ADK)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -40,9 +40,9 @@
|
|
|
40
40
|
"url": "https://github.com/botpress/adk"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@botpress/adk": "^1.
|
|
43
|
+
"@botpress/adk": "^1.2.4",
|
|
44
44
|
"@botpress/cli": "^4.18.2",
|
|
45
|
-
"@botpress/runtime": "^1.
|
|
45
|
+
"@botpress/runtime": "^1.2.4",
|
|
46
46
|
"adm-zip": "^0.5.16",
|
|
47
47
|
"chalk": "^5.4.1",
|
|
48
48
|
"clipboardy": "^4.0.0",
|
|
@@ -53,6 +53,7 @@
|
|
|
53
53
|
"highlight.js": "^11.10.0",
|
|
54
54
|
"ink": "^6.3.1",
|
|
55
55
|
"open": "^10.2.0",
|
|
56
|
+
"prettier": "^3.6.2",
|
|
56
57
|
"react": "19",
|
|
57
58
|
"tar": "^7.5.1"
|
|
58
59
|
},
|