@inkeep/agents-cli 0.0.0-dev-20250920002849 → 0.0.0-dev-20250924193535
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 +248 -26
- package/package.json +6 -4
package/dist/index.js
CHANGED
|
@@ -42,29 +42,124 @@ var init_esm_shims = __esm({
|
|
|
42
42
|
});
|
|
43
43
|
|
|
44
44
|
// ../packages/agents-core/src/utils/logger.ts
|
|
45
|
+
import pino from "pino";
|
|
46
|
+
import pinoPretty from "pino-pretty";
|
|
45
47
|
function getLogger(name) {
|
|
46
48
|
return loggerFactory.getLogger(name);
|
|
47
49
|
}
|
|
48
|
-
var
|
|
50
|
+
var PinoLogger, LoggerFactory, loggerFactory;
|
|
49
51
|
var init_logger = __esm({
|
|
50
52
|
"../packages/agents-core/src/utils/logger.ts"() {
|
|
51
53
|
"use strict";
|
|
52
54
|
init_esm_shims();
|
|
53
|
-
|
|
54
|
-
constructor(name) {
|
|
55
|
+
PinoLogger = class {
|
|
56
|
+
constructor(name, config = {}) {
|
|
55
57
|
this.name = name;
|
|
58
|
+
this.options = {
|
|
59
|
+
name: this.name,
|
|
60
|
+
level: process.env.LOG_LEVEL || "info",
|
|
61
|
+
serializers: {
|
|
62
|
+
obj: (value) => ({ ...value })
|
|
63
|
+
},
|
|
64
|
+
redact: ["req.headers.authorization", 'req.headers["x-inkeep-admin-authentication"]'],
|
|
65
|
+
...config.options
|
|
66
|
+
};
|
|
67
|
+
if (config.transportConfigs) {
|
|
68
|
+
this.transportConfigs = config.transportConfigs;
|
|
69
|
+
}
|
|
70
|
+
if (this.transportConfigs.length > 0) {
|
|
71
|
+
this.pinoInstance = pino(this.options, pino.transport({ targets: this.transportConfigs }));
|
|
72
|
+
} else {
|
|
73
|
+
try {
|
|
74
|
+
const prettyStream = pinoPretty({
|
|
75
|
+
colorize: true,
|
|
76
|
+
translateTime: "HH:MM:ss",
|
|
77
|
+
ignore: "pid,hostname"
|
|
78
|
+
});
|
|
79
|
+
this.pinoInstance = pino(this.options, prettyStream);
|
|
80
|
+
} catch (error) {
|
|
81
|
+
console.warn("Warning: pino-pretty failed, using standard JSON output:", error);
|
|
82
|
+
this.pinoInstance = pino(this.options);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
transportConfigs = [];
|
|
87
|
+
pinoInstance;
|
|
88
|
+
options;
|
|
89
|
+
/**
|
|
90
|
+
* Recreate the pino instance with current transports
|
|
91
|
+
*/
|
|
92
|
+
recreateInstance() {
|
|
93
|
+
if (this.pinoInstance && typeof this.pinoInstance.flush === "function") {
|
|
94
|
+
this.pinoInstance.flush();
|
|
95
|
+
}
|
|
96
|
+
if (this.transportConfigs.length === 0) {
|
|
97
|
+
try {
|
|
98
|
+
const prettyStream = pinoPretty({
|
|
99
|
+
colorize: true,
|
|
100
|
+
translateTime: "HH:MM:ss",
|
|
101
|
+
ignore: "pid,hostname"
|
|
102
|
+
});
|
|
103
|
+
this.pinoInstance = pino(this.options, prettyStream);
|
|
104
|
+
} catch (error) {
|
|
105
|
+
console.warn("Warning: pino-pretty failed, using standard JSON output:", error);
|
|
106
|
+
this.pinoInstance = pino(this.options);
|
|
107
|
+
}
|
|
108
|
+
} else {
|
|
109
|
+
const multiTransport = { targets: this.transportConfigs };
|
|
110
|
+
const pinoTransport = pino.transport(multiTransport);
|
|
111
|
+
this.pinoInstance = pino(this.options, pinoTransport);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Add a new transport to the logger
|
|
116
|
+
*/
|
|
117
|
+
addTransport(transportConfig) {
|
|
118
|
+
this.transportConfigs.push(transportConfig);
|
|
119
|
+
this.recreateInstance();
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Remove a transport by index
|
|
123
|
+
*/
|
|
124
|
+
removeTransport(index2) {
|
|
125
|
+
if (index2 >= 0 && index2 < this.transportConfigs.length) {
|
|
126
|
+
this.transportConfigs.splice(index2, 1);
|
|
127
|
+
this.recreateInstance();
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Get current transports
|
|
132
|
+
*/
|
|
133
|
+
getTransports() {
|
|
134
|
+
return [...this.transportConfigs];
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Update logger options
|
|
138
|
+
*/
|
|
139
|
+
updateOptions(options) {
|
|
140
|
+
this.options = {
|
|
141
|
+
...this.options,
|
|
142
|
+
...options
|
|
143
|
+
};
|
|
144
|
+
this.recreateInstance();
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Get the underlying pino instance for advanced usage
|
|
148
|
+
*/
|
|
149
|
+
getPinoInstance() {
|
|
150
|
+
return this.pinoInstance;
|
|
56
151
|
}
|
|
57
152
|
error(data, message) {
|
|
58
|
-
|
|
153
|
+
this.pinoInstance.error(data, message);
|
|
59
154
|
}
|
|
60
155
|
warn(data, message) {
|
|
61
|
-
|
|
156
|
+
this.pinoInstance.warn(data, message);
|
|
62
157
|
}
|
|
63
158
|
info(data, message) {
|
|
64
|
-
|
|
159
|
+
this.pinoInstance.info(data, message);
|
|
65
160
|
}
|
|
66
161
|
debug(data, message) {
|
|
67
|
-
|
|
162
|
+
this.pinoInstance.debug(data, message);
|
|
68
163
|
}
|
|
69
164
|
};
|
|
70
165
|
LoggerFactory = class {
|
|
@@ -94,7 +189,7 @@ var init_logger = __esm({
|
|
|
94
189
|
} else if (this.config.defaultLogger) {
|
|
95
190
|
logger11 = this.config.defaultLogger;
|
|
96
191
|
} else {
|
|
97
|
-
logger11 = new
|
|
192
|
+
logger11 = new PinoLogger(name, this.config.pinoConfig);
|
|
98
193
|
}
|
|
99
194
|
this.loggers.set(name, logger11);
|
|
100
195
|
return logger11;
|
|
@@ -21505,6 +21600,7 @@ import { existsSync as existsSync2 } from "fs";
|
|
|
21505
21600
|
import { createRequire } from "module";
|
|
21506
21601
|
import { dirname, join as join2 } from "path";
|
|
21507
21602
|
import chalk3 from "chalk";
|
|
21603
|
+
import fs4 from "fs-extra";
|
|
21508
21604
|
import ora2 from "ora";
|
|
21509
21605
|
var require2 = createRequire(import.meta.url);
|
|
21510
21606
|
function resolveWebRuntime() {
|
|
@@ -21517,22 +21613,18 @@ function resolveWebRuntime() {
|
|
|
21517
21613
|
}
|
|
21518
21614
|
}
|
|
21519
21615
|
function startWebApp({ port = 3e3, host = "localhost" }) {
|
|
21616
|
+
console.log("");
|
|
21520
21617
|
const spinner = ora2("Starting dashboard server...").start();
|
|
21521
21618
|
try {
|
|
21522
21619
|
const rt = resolveWebRuntime();
|
|
21523
21620
|
const entry = join2(rt, "server.js");
|
|
21524
|
-
console.log(entry);
|
|
21525
21621
|
if (!existsSync2(entry)) {
|
|
21526
21622
|
spinner.fail("Dashboard server not found");
|
|
21527
|
-
console.error(
|
|
21528
|
-
chalk3.red("The dashboard server has not been built yet. Please run the following commands:")
|
|
21529
|
-
);
|
|
21530
|
-
console.error(chalk3.yellow(" cd agents-manage-ui"));
|
|
21531
|
-
console.error(chalk3.yellow(" pnpm build"));
|
|
21532
|
-
console.error(chalk3.yellow(" pnpm start"));
|
|
21623
|
+
console.error(chalk3.red("The dashboard server has not been built yet."));
|
|
21533
21624
|
process.exit(1);
|
|
21534
21625
|
}
|
|
21535
21626
|
spinner.succeed("Starting dashboard server...");
|
|
21627
|
+
console.log("");
|
|
21536
21628
|
const child = fork(entry, [], {
|
|
21537
21629
|
cwd: rt,
|
|
21538
21630
|
env: {
|
|
@@ -21544,8 +21636,11 @@ function startWebApp({ port = 3e3, host = "localhost" }) {
|
|
|
21544
21636
|
stdio: "inherit"
|
|
21545
21637
|
});
|
|
21546
21638
|
console.log(chalk3.green(`\u{1F680} Dashboard server started at http://${host}:${port}`));
|
|
21639
|
+
console.log("");
|
|
21547
21640
|
console.log(chalk3.gray("Press Ctrl+C to stop the server"));
|
|
21641
|
+
console.log("");
|
|
21548
21642
|
process.on("SIGINT", () => {
|
|
21643
|
+
console.log("");
|
|
21549
21644
|
console.log(chalk3.yellow("\n\u{1F6D1} Stopping dashboard server..."));
|
|
21550
21645
|
child.kill("SIGINT");
|
|
21551
21646
|
process.exit(0);
|
|
@@ -21561,11 +21656,135 @@ function startWebApp({ port = 3e3, host = "localhost" }) {
|
|
|
21561
21656
|
process.exit(1);
|
|
21562
21657
|
}
|
|
21563
21658
|
}
|
|
21659
|
+
async function copyVercelOutput() {
|
|
21660
|
+
const spinner = ora2("Copying Vercel output...").start();
|
|
21661
|
+
try {
|
|
21662
|
+
const pkg = require2.resolve("@inkeep/agents-manage-ui/package.json");
|
|
21663
|
+
const root = dirname(pkg);
|
|
21664
|
+
const sourceOutputPath = join2(root, ".vercel", "output");
|
|
21665
|
+
if (!existsSync2(sourceOutputPath)) {
|
|
21666
|
+
spinner.fail("Vercel output not found");
|
|
21667
|
+
console.error(chalk3.red("The Vercel output has not been built yet in the package."));
|
|
21668
|
+
process.exit(1);
|
|
21669
|
+
}
|
|
21670
|
+
const destVercelDir = join2(process.cwd(), ".vercel");
|
|
21671
|
+
const destOutputPath = join2(destVercelDir, "output");
|
|
21672
|
+
await fs4.ensureDir(destVercelDir);
|
|
21673
|
+
if (existsSync2(destOutputPath)) {
|
|
21674
|
+
await fs4.remove(destOutputPath);
|
|
21675
|
+
}
|
|
21676
|
+
await fs4.copy(sourceOutputPath, destOutputPath);
|
|
21677
|
+
spinner.succeed(`Vercel output copied to .vercel/output/`);
|
|
21678
|
+
console.log("");
|
|
21679
|
+
console.log(chalk3.blue("\u{1F680} Ready for Vercel deployment"));
|
|
21680
|
+
console.log(chalk3.gray("Run: vercel deploy --prebuilt --prod"));
|
|
21681
|
+
console.log("");
|
|
21682
|
+
} catch (error) {
|
|
21683
|
+
spinner.fail("Failed to copy Vercel output");
|
|
21684
|
+
console.error(chalk3.red("Error:"), error instanceof Error ? error.message : "Unknown error");
|
|
21685
|
+
throw error;
|
|
21686
|
+
}
|
|
21687
|
+
}
|
|
21688
|
+
async function buildForVercel({ outputDir = "./vercel-build" }) {
|
|
21689
|
+
const spinner = ora2("Creating Vercel-ready build...").start();
|
|
21690
|
+
try {
|
|
21691
|
+
const pkg = require2.resolve("@inkeep/agents-manage-ui/package.json");
|
|
21692
|
+
const root = dirname(pkg);
|
|
21693
|
+
const standalonePath = join2(root, ".next/standalone/agents-manage-ui");
|
|
21694
|
+
if (!existsSync2(standalonePath)) {
|
|
21695
|
+
spinner.fail("Standalone build not found");
|
|
21696
|
+
console.error(chalk3.red("The standalone build has not been created yet."));
|
|
21697
|
+
process.exit(1);
|
|
21698
|
+
}
|
|
21699
|
+
if (existsSync2(outputDir)) {
|
|
21700
|
+
await fs4.remove(outputDir);
|
|
21701
|
+
}
|
|
21702
|
+
await fs4.ensureDir(outputDir);
|
|
21703
|
+
await fs4.copy(standalonePath, outputDir);
|
|
21704
|
+
const packageJson2 = {
|
|
21705
|
+
name: "inkeep-dashboard",
|
|
21706
|
+
version: "1.0.0",
|
|
21707
|
+
scripts: {
|
|
21708
|
+
start: "node server.js"
|
|
21709
|
+
},
|
|
21710
|
+
dependencies: {
|
|
21711
|
+
"@inkeep/agents-manage-ui": "latest"
|
|
21712
|
+
}
|
|
21713
|
+
};
|
|
21714
|
+
await fs4.writeJson(join2(outputDir, "package.json"), packageJson2, { spaces: 2 });
|
|
21715
|
+
const vercelConfig = {
|
|
21716
|
+
version: 2,
|
|
21717
|
+
builds: [
|
|
21718
|
+
{
|
|
21719
|
+
src: "server.js",
|
|
21720
|
+
use: "@vercel/node"
|
|
21721
|
+
}
|
|
21722
|
+
],
|
|
21723
|
+
routes: [
|
|
21724
|
+
{
|
|
21725
|
+
src: "/(.*)",
|
|
21726
|
+
dest: "server.js"
|
|
21727
|
+
}
|
|
21728
|
+
]
|
|
21729
|
+
};
|
|
21730
|
+
await fs4.writeJson(join2(outputDir, "vercel.json"), vercelConfig, { spaces: 2 });
|
|
21731
|
+
const instructions = `# Inkeep Dashboard - Vercel Deployment
|
|
21732
|
+
|
|
21733
|
+
## Quick Deploy
|
|
21734
|
+
|
|
21735
|
+
1. Go to https://vercel.com/dashboard
|
|
21736
|
+
2. Click "New Project"
|
|
21737
|
+
3. Upload this folder or connect to GitHub
|
|
21738
|
+
4. Set environment variables:
|
|
21739
|
+
- INKEEP_API_URL=your-api-url
|
|
21740
|
+
- INKEEP_TENANT_ID=your-tenant-id
|
|
21741
|
+
- NODE_ENV=production
|
|
21742
|
+
5. Deploy!
|
|
21743
|
+
|
|
21744
|
+
## Using Vercel CLI
|
|
21745
|
+
|
|
21746
|
+
\`\`\`bash
|
|
21747
|
+
cd ${outputDir}
|
|
21748
|
+
vercel --prod
|
|
21749
|
+
\`\`\`
|
|
21750
|
+
|
|
21751
|
+
## Environment Variables
|
|
21752
|
+
|
|
21753
|
+
Make sure to set these in your Vercel project settings:
|
|
21754
|
+
- INKEEP_API_URL
|
|
21755
|
+
- INKEEP_TENANT_ID
|
|
21756
|
+
- Any other variables from your .env file
|
|
21757
|
+
`;
|
|
21758
|
+
await fs4.writeFile(join2(outputDir, "README-VERCEL.md"), instructions);
|
|
21759
|
+
spinner.succeed(`Vercel-ready build created at ${outputDir}/`);
|
|
21760
|
+
console.log("");
|
|
21761
|
+
console.log(chalk3.blue("\u{1F680} Start script:"), "node server.js");
|
|
21762
|
+
console.log("");
|
|
21763
|
+
console.log(chalk3.yellow("\u{1F4D6} See README-VERCEL.md for deployment instructions"));
|
|
21764
|
+
} catch (error) {
|
|
21765
|
+
spinner.fail("Failed to create Vercel build");
|
|
21766
|
+
console.error(chalk3.red("Error:"), error instanceof Error ? error.message : "Unknown error");
|
|
21767
|
+
throw error;
|
|
21768
|
+
}
|
|
21769
|
+
}
|
|
21564
21770
|
async function devCommand(options) {
|
|
21565
|
-
const {
|
|
21566
|
-
|
|
21567
|
-
|
|
21568
|
-
|
|
21771
|
+
const {
|
|
21772
|
+
port = 3e3,
|
|
21773
|
+
host = "localhost",
|
|
21774
|
+
build = false,
|
|
21775
|
+
outputDir = "./vercel-build",
|
|
21776
|
+
vercel = false
|
|
21777
|
+
} = options;
|
|
21778
|
+
if (vercel) {
|
|
21779
|
+
await copyVercelOutput();
|
|
21780
|
+
return;
|
|
21781
|
+
}
|
|
21782
|
+
if (build) {
|
|
21783
|
+
await buildForVercel({ outputDir });
|
|
21784
|
+
console.log("");
|
|
21785
|
+
console.log(chalk3.blue("Next steps: Deploy the build folder to Vercel"));
|
|
21786
|
+
return;
|
|
21787
|
+
}
|
|
21569
21788
|
startWebApp({ port, host });
|
|
21570
21789
|
}
|
|
21571
21790
|
|
|
@@ -22040,11 +22259,11 @@ function parseModelString(modelString) {
|
|
|
22040
22259
|
};
|
|
22041
22260
|
}
|
|
22042
22261
|
async function generateTypeScriptFileWithLLM(graphData, graphId, outputFilePath, modelSettings, retryContext) {
|
|
22043
|
-
const
|
|
22262
|
+
const fs5 = await import("fs");
|
|
22044
22263
|
let existingContent = "";
|
|
22045
22264
|
let fileExists = false;
|
|
22046
22265
|
try {
|
|
22047
|
-
existingContent =
|
|
22266
|
+
existingContent = fs5.readFileSync(outputFilePath, "utf-8");
|
|
22048
22267
|
fileExists = true;
|
|
22049
22268
|
} catch {
|
|
22050
22269
|
fileExists = false;
|
|
@@ -22060,7 +22279,7 @@ async function generateTypeScriptFileWithLLM(graphData, graphId, outputFilePath,
|
|
|
22060
22279
|
maxOutputTokens: 16e3
|
|
22061
22280
|
// Increased to handle large TypeScript files
|
|
22062
22281
|
});
|
|
22063
|
-
|
|
22282
|
+
fs5.writeFileSync(outputFilePath, text2, "utf-8");
|
|
22064
22283
|
console.log(`\u2705 Successfully generated TypeScript file: ${outputFilePath}`);
|
|
22065
22284
|
} catch (error) {
|
|
22066
22285
|
console.error("\u274C Error generating TypeScript file with LLM:", error);
|
|
@@ -22472,8 +22691,8 @@ async function pushCommand(options) {
|
|
|
22472
22691
|
try {
|
|
22473
22692
|
const projectDefinition = await project.toFullProjectDefinition();
|
|
22474
22693
|
const jsonFilePath = join9(projectDir, `${finalConfig.projectId}.json`);
|
|
22475
|
-
const
|
|
22476
|
-
await
|
|
22694
|
+
const fs5 = await import("fs/promises");
|
|
22695
|
+
await fs5.writeFile(jsonFilePath, JSON.stringify(projectDefinition, null, 2));
|
|
22477
22696
|
spinner.succeed(`Project data saved to ${jsonFilePath}`);
|
|
22478
22697
|
console.log(chalk7.gray(` \u2022 File: ${jsonFilePath}`));
|
|
22479
22698
|
console.log(chalk7.gray(` \u2022 Size: ${JSON.stringify(projectDefinition).length} bytes`));
|
|
@@ -22581,10 +22800,13 @@ program.command("list-graphs").description("List all available graphs for the cu
|
|
|
22581
22800
|
).action(async (options) => {
|
|
22582
22801
|
await listGraphsCommand(options);
|
|
22583
22802
|
});
|
|
22584
|
-
program.command("dev").description("Start the Inkeep dashboard server").option("--port <port>", "Port to run the server on", "3000").option("--host <host>", "Host to bind the server to", "localhost").action(async (options) => {
|
|
22803
|
+
program.command("dev").description("Start the Inkeep dashboard server").option("--port <port>", "Port to run the server on", "3000").option("--host <host>", "Host to bind the server to", "localhost").option("--build", "Create a Vercel-ready build and exit").option("--output-dir <dir>", "Output directory for build files", "./vercel-build").option("--vercel", "Copy Vercel output to .vercel/output for deployment").action(async (options) => {
|
|
22585
22804
|
await devCommand({
|
|
22586
22805
|
port: parseInt(options.port, 10),
|
|
22587
|
-
host: options.host
|
|
22806
|
+
host: options.host,
|
|
22807
|
+
build: options.build,
|
|
22808
|
+
outputDir: options.outputDir,
|
|
22809
|
+
vercel: options.vercel
|
|
22588
22810
|
});
|
|
22589
22811
|
});
|
|
22590
22812
|
program.parse();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inkeep/agents-cli",
|
|
3
|
-
"version": "0.0.0-dev-
|
|
3
|
+
"version": "0.0.0-dev-20250924193535",
|
|
4
4
|
"description": "Inkeep CLI tool",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -40,11 +40,12 @@
|
|
|
40
40
|
"inquirer-autocomplete-prompt": "^3.0.1",
|
|
41
41
|
"ora": "^8.0.1",
|
|
42
42
|
"picocolors": "^1.1.1",
|
|
43
|
+
"pino": "^9.11.0",
|
|
43
44
|
"recast": "^0.23.0",
|
|
44
45
|
"ts-morph": "^26.0.0",
|
|
45
46
|
"tsx": "^4.20.5",
|
|
46
|
-
"@inkeep/agents-core": "^0.0.0-dev-
|
|
47
|
-
"@inkeep/agents-manage-ui": "^0.0.0-dev-
|
|
47
|
+
"@inkeep/agents-core": "^0.0.0-dev-20250924193535",
|
|
48
|
+
"@inkeep/agents-manage-ui": "^0.0.0-dev-20250924193535"
|
|
48
49
|
},
|
|
49
50
|
"devDependencies": {
|
|
50
51
|
"@types/degit": "^2.8.6",
|
|
@@ -54,7 +55,8 @@
|
|
|
54
55
|
"@vitest/coverage-v8": "^3.2.4",
|
|
55
56
|
"tsup": "^8.5.0",
|
|
56
57
|
"typescript": "^5.9.2",
|
|
57
|
-
"vitest": "^3.2.4"
|
|
58
|
+
"vitest": "^3.2.4",
|
|
59
|
+
"pino-pretty": "^13.1.1"
|
|
58
60
|
},
|
|
59
61
|
"peerDependencies": {
|
|
60
62
|
"zod": "^4.1.5"
|