Skip to content

Commit aeedf95

Browse files
Fix dev cache detection and silence dev server logs
1 parent 66abd8c commit aeedf95

3 files changed

Lines changed: 16 additions & 3 deletions

File tree

apps/cli/src/commands/dev.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ export async function startDevServer(parsed: ParsedArgs): Promise<void> {
3131
config: devConfig,
3232
handlers: new DuckDbIngestionWriter(db.directIngestion()),
3333
authMode: "disabled",
34+
logger: false,
3435
});
3536
const shutdown = async () => {
3637
await server.close();

apps/cli/src/commands/environment.ts

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { existsSync } from "node:fs";
2+
import { resolve } from "node:path";
23
import {
34
configFromEnv,
45
DEV_SERVER_RUNNING_MESSAGE,
@@ -72,7 +73,7 @@ export function isDevEnvironment(
7273
export function cacheForRead(
7374
config: ReturnType<typeof configFromEnv>,
7475
): AgentPondCache {
75-
if (config.environment && isDevServerRunning(config.environment)) {
76+
if (usesRunningDevCache(config)) {
7677
if (!existsSync(config.dbPath)) {
7778
throw new CliError(
7879
"dev cache is not initialized yet; ingest a trace or stop the dev server",
@@ -86,11 +87,21 @@ export function cacheForRead(
8687
export function assertDevServerNotRunning(
8788
config: ReturnType<typeof configFromEnv>,
8889
): void {
89-
if (config.environment && isDevServerRunning(config.environment)) {
90+
if (usesRunningDevCache(config)) {
9091
throw new CliError(DEV_SERVER_RUNNING_MESSAGE);
9192
}
9293
}
9394

95+
function usesRunningDevCache(
96+
config: ReturnType<typeof configFromEnv>,
97+
): boolean {
98+
return (
99+
config.environment !== undefined &&
100+
resolve(config.dbPath) === resolve(config.environment.dbPath) &&
101+
isDevServerRunning(config.environment)
102+
);
103+
}
104+
94105
function printEnvironmentHelp(): void {
95106
console.log(`agentpond env - manage local AgentPond environments
96107

packages/ingest/src/server.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ export type BuildServerOptions = {
1818
store?: ObjectStore;
1919
authMode?: "required" | "disabled";
2020
handlers?: IngestionHandlers;
21+
logger?: boolean;
2122
};
2223

2324
export type IngestionHandlers = {
@@ -39,7 +40,7 @@ export function buildServer(options: BuildServerOptions = {}): FastifyInstance {
3940
const authMode = options.authMode ?? "required";
4041
const handlers = options.handlers ?? new ObjectStoreIngestionHandler(store);
4142
const server = Fastify({
42-
logger: process.env.NODE_ENV !== "test",
43+
logger: options.logger ?? process.env.NODE_ENV !== "test",
4344
bodyLimit: 16 * 1024 * 1024,
4445
});
4546

0 commit comments

Comments
 (0)