@townco/agent 0.1.53 → 0.1.55

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.
Files changed (52) hide show
  1. package/dist/acp-server/adapter.d.ts +16 -0
  2. package/dist/acp-server/adapter.js +231 -17
  3. package/dist/acp-server/cli.d.ts +1 -3
  4. package/dist/acp-server/http.js +51 -7
  5. package/dist/acp-server/session-storage.d.ts +16 -1
  6. package/dist/acp-server/session-storage.js +23 -0
  7. package/dist/bin.js +0 -0
  8. package/dist/definition/index.d.ts +2 -2
  9. package/dist/definition/index.js +1 -0
  10. package/dist/index.js +1 -1
  11. package/dist/logger.d.ts +26 -0
  12. package/dist/logger.js +43 -0
  13. package/dist/runner/agent-runner.d.ts +7 -2
  14. package/dist/runner/hooks/executor.js +1 -1
  15. package/dist/runner/hooks/loader.js +1 -1
  16. package/dist/runner/hooks/predefined/compaction-tool.js +1 -1
  17. package/dist/runner/hooks/predefined/tool-response-compactor.js +1 -1
  18. package/dist/runner/index.d.ts +1 -3
  19. package/dist/runner/langchain/index.js +179 -39
  20. package/dist/runner/langchain/model-factory.js +1 -1
  21. package/dist/runner/langchain/tools/generate_image.d.ts +28 -0
  22. package/dist/runner/langchain/tools/generate_image.js +135 -0
  23. package/dist/runner/langchain/tools/port-utils.d.ts +8 -0
  24. package/dist/runner/langchain/tools/port-utils.js +35 -0
  25. package/dist/runner/langchain/tools/subagent.d.ts +6 -1
  26. package/dist/runner/langchain/tools/subagent.js +242 -129
  27. package/dist/runner/tools.d.ts +19 -2
  28. package/dist/runner/tools.js +9 -0
  29. package/dist/storage/index.js +1 -1
  30. package/dist/telemetry/index.js +7 -1
  31. package/dist/templates/index.d.ts +3 -0
  32. package/dist/templates/index.js +27 -5
  33. package/dist/tsconfig.tsbuildinfo +1 -1
  34. package/index.ts +1 -1
  35. package/package.json +11 -6
  36. package/templates/index.ts +37 -6
  37. package/dist/definition/mcp.d.ts +0 -0
  38. package/dist/definition/mcp.js +0 -0
  39. package/dist/definition/tools/todo.d.ts +0 -49
  40. package/dist/definition/tools/todo.js +0 -80
  41. package/dist/definition/tools/web_search.d.ts +0 -4
  42. package/dist/definition/tools/web_search.js +0 -26
  43. package/dist/dev-agent/index.d.ts +0 -2
  44. package/dist/dev-agent/index.js +0 -18
  45. package/dist/example.d.ts +0 -2
  46. package/dist/example.js +0 -19
  47. package/dist/scaffold/link-local.d.ts +0 -1
  48. package/dist/scaffold/link-local.js +0 -54
  49. package/dist/utils/__tests__/tool-overhead-calculator.test.d.ts +0 -1
  50. package/dist/utils/__tests__/tool-overhead-calculator.test.js +0 -153
  51. package/dist/utils/logger.d.ts +0 -39
  52. package/dist/utils/logger.js +0 -175
package/index.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { basename } from "node:path";
2
- import { createLogger } from "@townco/core";
3
2
  import { makeHttpTransport, makeStdioTransport } from "./acp-server";
4
3
  import type { AgentDefinition } from "./definition";
4
+ import { createLogger } from "./logger.js";
5
5
  import { initializeOpenTelemetryFromEnv } from "./telemetry/setup.js";
6
6
  import { makeSubagentsTool } from "./utils";
7
7
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@townco/agent",
3
- "version": "0.1.53",
3
+ "version": "0.1.55",
4
4
  "type": "module",
5
5
  "module": "index.ts",
6
6
  "files": [
@@ -42,6 +42,10 @@
42
42
  "./utils": {
43
43
  "import": "./dist/utils/index.js",
44
44
  "types": "./dist/utils/index.d.ts"
45
+ },
46
+ "./logger": {
47
+ "import": "./dist/logger.js",
48
+ "types": "./dist/logger.d.ts"
45
49
  }
46
50
  },
47
51
  "scripts": {
@@ -55,6 +59,7 @@
55
59
  "@agentclientprotocol/sdk": "^0.5.1",
56
60
  "@anthropic-ai/sandbox-runtime": "^0.0.2",
57
61
  "@anthropic-ai/sdk": "^0.70.0",
62
+ "@google/genai": "^0.14.1",
58
63
  "@anthropic-ai/tokenizer": "^0.0.4",
59
64
  "@electric-sql/pglite": "^0.2.15",
60
65
  "@langchain/anthropic": "1.0.1",
@@ -73,11 +78,11 @@
73
78
  "@opentelemetry/sdk-trace-base": "^1.28.0",
74
79
  "@opentelemetry/sdk-trace-node": "^1.28.0",
75
80
  "@opentelemetry/semantic-conventions": "^1.28.0",
76
- "@townco/core": "0.0.26",
77
- "@townco/gui-template": "0.1.45",
78
- "@townco/tsconfig": "0.1.45",
79
- "@townco/tui-template": "0.1.45",
80
- "@townco/ui": "0.1.48",
81
+ "@townco/core": "0.0.28",
82
+ "@townco/gui-template": "0.1.47",
83
+ "@townco/tsconfig": "0.1.47",
84
+ "@townco/tui-template": "0.1.47",
85
+ "@townco/ui": "0.1.50",
81
86
  "exa-js": "^2.0.0",
82
87
  "hono": "^4.10.4",
83
88
  "langchain": "^1.0.3",
@@ -4,6 +4,9 @@ import type { AgentDefinition } from "../definition";
4
4
  export interface TemplateVars {
5
5
  name: string;
6
6
  model: string;
7
+ displayName?: string;
8
+ description?: string;
9
+ suggestedPrompts?: string[];
7
10
  tools: Array<
8
11
  | string
9
12
  | { type: "custom"; modulePath: string }
@@ -45,7 +48,7 @@ export function getTemplateVars(
45
48
  definition: AgentDefinition,
46
49
  ): TemplateVars {
47
50
  const tools = definition.tools ?? [];
48
- return {
51
+ const result: TemplateVars = {
49
52
  name,
50
53
  model: definition.model,
51
54
  tools,
@@ -55,6 +58,18 @@ export function getTemplateVars(
55
58
  ),
56
59
  hooks: definition.hooks as TemplateVars["hooks"],
57
60
  };
61
+
62
+ if (definition.displayName) {
63
+ result.displayName = definition.displayName;
64
+ }
65
+ if (definition.description) {
66
+ result.description = definition.description;
67
+ }
68
+ if (definition.suggestedPrompts) {
69
+ result.suggestedPrompts = definition.suggestedPrompts;
70
+ }
71
+
72
+ return result;
58
73
  }
59
74
 
60
75
  export function generatePackageJson(vars: TemplateVars): string {
@@ -94,17 +109,33 @@ export function generatePackageJson(vars: TemplateVars): string {
94
109
  }
95
110
 
96
111
  export async function generateIndexTs(vars: TemplateVars): Promise<string> {
97
- const agentDef = {
112
+ // Build agent definition with fields in a logical order
113
+ const agentDef: Record<string, unknown> = {
98
114
  model: vars.model,
99
- systemPrompt: vars.systemPrompt,
100
- tools: vars.tools,
101
- hooks: vars.hooks,
102
115
  };
116
+
117
+ if (vars.displayName) {
118
+ agentDef.displayName = vars.displayName;
119
+ }
120
+ if (vars.description) {
121
+ agentDef.description = vars.description;
122
+ }
123
+ if (vars.suggestedPrompts) {
124
+ agentDef.suggestedPrompts = vars.suggestedPrompts;
125
+ }
126
+
127
+ agentDef.systemPrompt = vars.systemPrompt;
128
+ agentDef.tools = vars.tools;
129
+
130
+ if (vars.hooks) {
131
+ agentDef.hooks = vars.hooks;
132
+ }
133
+
103
134
  return prettier.format(
104
135
  `import { makeHttpTransport, makeStdioTransport } from "@townco/agent/acp-server";
105
136
  import type { AgentDefinition } from "@townco/agent/definition";
137
+ import { createLogger } from "@townco/agent/logger";
106
138
  import { basename } from "node:path";
107
- import { createLogger } from "@townco/core";
108
139
 
109
140
  const logger = createLogger("agent-index");
110
141
 
File without changes
File without changes
@@ -1,49 +0,0 @@
1
- import { z } from "zod";
2
- export declare const todoItemSchema: z.ZodObject<
3
- {
4
- content: z.ZodString;
5
- status: z.ZodEnum<{
6
- pending: "pending";
7
- in_progress: "in_progress";
8
- completed: "completed";
9
- }>;
10
- activeForm: z.ZodString;
11
- },
12
- z.core.$strip
13
- >;
14
- export declare const todoWrite: import("langchain").DynamicStructuredTool<
15
- z.ZodObject<
16
- {
17
- todos: z.ZodArray<
18
- z.ZodObject<
19
- {
20
- content: z.ZodString;
21
- status: z.ZodEnum<{
22
- pending: "pending";
23
- in_progress: "in_progress";
24
- completed: "completed";
25
- }>;
26
- activeForm: z.ZodString;
27
- },
28
- z.core.$strip
29
- >
30
- >;
31
- },
32
- z.core.$strip
33
- >,
34
- {
35
- todos: {
36
- content: string;
37
- status: "pending" | "in_progress" | "completed";
38
- activeForm: string;
39
- }[];
40
- },
41
- {
42
- todos: {
43
- content: string;
44
- status: "pending" | "in_progress" | "completed";
45
- activeForm: string;
46
- }[];
47
- },
48
- string
49
- >;
@@ -1,80 +0,0 @@
1
- import { tool } from "langchain";
2
- import { z } from "zod";
3
- export const todoItemSchema = z.object({
4
- content: z.string().min(1),
5
- status: z.enum(["pending", "in_progress", "completed"]),
6
- activeForm: z.string().min(1),
7
- });
8
- export const todoWrite = tool(
9
- ({ todos }) => {
10
- // Simple implementation that confirms the todos were written
11
- return `Successfully updated todo list with ${todos.length} items`;
12
- },
13
- {
14
- name: "todo_write",
15
- description: `Use this tool to create and manage a structured task list for your current coding session. This helps you track progress, organize complex tasks, and demonstrate thoroughness to the user.
16
- It also helps the user understand the progress of the task and overall progress of their requests.
17
-
18
- ## When to Use This Tool
19
- Use this tool proactively in these scenarios:
20
-
21
- 1. Complex multi-step tasks - When a task requires 3 or more distinct steps or actions
22
- 2. Non-trivial and complex tasks - Tasks that require careful planning or multiple operations
23
- 3. User explicitly requests todo list - When the user directly asks you to use the todo list
24
- 4. User provides multiple tasks - When users provide a list of things to be done (numbered or comma-separated)
25
- 5. After receiving new instructions - Immediately capture user requirements as todos
26
- 6. When you start working on a task - Mark it as in_progress BEFORE beginning work. Ideally you should only have one todo as in_progress at a time
27
- 7. After completing a task - Mark it as completed and add any new follow-up tasks discovered during implementation
28
-
29
- ## When NOT to Use This Tool
30
-
31
- Skip using this tool when:
32
- 1. There is only a single, straightforward task
33
- 2. The task is trivial and tracking it provides no organizational benefit
34
- 3. The task can be completed in less than 3 trivial steps
35
- 4. The task is purely conversational or informational
36
-
37
- NOTE that you should not use this tool if there is only one trivial task to do. In this case you are better off just doing the task directly.
38
-
39
- ## Task States and Management
40
-
41
- 1. **Task States**: Use these states to track progress:
42
- - pending: Task not yet started
43
- - in_progress: Currently working on (limit to ONE task at a time)
44
- - completed: Task finished successfully
45
-
46
- **IMPORTANT**: Task descriptions must have two forms:
47
- - content: The imperative form describing what needs to be done (e.g., "Run tests", "Build the project")
48
- - activeForm: The present continuous form shown during execution (e.g., "Running tests", "Building the project")
49
-
50
- 2. **Task Management**:
51
- - Update task status in real-time as you work
52
- - Mark tasks complete IMMEDIATELY after finishing (don't batch completions)
53
- - Exactly ONE task must be in_progress at any time (not less, not more)
54
- - Complete current tasks before starting new ones
55
- - Remove tasks that are no longer relevant from the list entirely
56
-
57
- 3. **Task Completion Requirements**:
58
- - ONLY mark a task as completed when you have FULLY accomplished it
59
- - If you encounter errors, blockers, or cannot finish, keep the task as in_progress
60
- - When blocked, create a new task describing what needs to be resolved
61
- - Never mark a task as completed if:
62
- - Tests are failing
63
- - Implementation is partial
64
- - You encountered unresolved errors
65
- - You couldn't find necessary files or dependencies
66
-
67
- 4. **Task Breakdown**:
68
- - Create specific, actionable items
69
- - Break complex tasks into smaller, manageable steps
70
- - Use clear, descriptive task names
71
- - Always provide both forms:
72
- - content: "Fix authentication bug"
73
- - activeForm: "Fixing authentication bug"
74
-
75
- When in doubt, use this tool. Being proactive with task management demonstrates attentiveness and ensures you complete all requirements successfully.`,
76
- schema: z.object({
77
- todos: z.array(todoItemSchema),
78
- }),
79
- },
80
- );
@@ -1,4 +0,0 @@
1
- import { ExaSearchResults } from "@langchain/exa";
2
- export declare function makeWebSearchTool(): ExaSearchResults<{
3
- text: true;
4
- }>;
@@ -1,26 +0,0 @@
1
- import { ExaSearchResults } from "@langchain/exa";
2
- import Exa from "exa-js";
3
-
4
- let _webSearchInstance = null;
5
- export function makeWebSearchTool() {
6
- if (_webSearchInstance) {
7
- return _webSearchInstance;
8
- }
9
- const apiKey = process.env.EXA_API_KEY;
10
- if (!apiKey) {
11
- throw new Error(
12
- "EXA_API_KEY environment variable is required to use the web_search tool. " +
13
- "Please set it to your Exa API key from https://exa.ai",
14
- );
15
- }
16
- const client = new Exa(apiKey);
17
- _webSearchInstance = new ExaSearchResults({
18
- client,
19
- searchArgs: {
20
- numResults: 5,
21
- type: "auto",
22
- text: true,
23
- },
24
- });
25
- return _webSearchInstance;
26
- }
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env bun
2
- export {};
@@ -1,18 +0,0 @@
1
- #!/usr/bin/env bun
2
- import { readFileSync } from "node:fs";
3
- import { join } from "node:path";
4
- import { makeHttpTransport, makeStdioTransport } from "../acp-server/index";
5
- // Load agent definition from JSON file
6
- const configPath = join(import.meta.dir, "agent.json");
7
- const agent = JSON.parse(readFileSync(configPath, "utf-8"));
8
- const transport = process.argv[2] || "stdio";
9
- if (transport === "http") {
10
- makeHttpTransport(agent);
11
- }
12
- else if (transport === "stdio") {
13
- makeStdioTransport(agent);
14
- }
15
- else {
16
- console.error(`Invalid transport: ${transport}`);
17
- process.exit(1);
18
- }
package/dist/example.d.ts DELETED
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env bun
2
- export {};
package/dist/example.js DELETED
@@ -1,19 +0,0 @@
1
- #!/usr/bin/env bun
2
- import { makeHttpTransport, makeStdioTransport } from "./acp-server/index.js";
3
-
4
- const exampleAgent = {
5
- model: "claude-sonnet-4-5-20250929",
6
- systemPrompt: "You are a helpful assistant.",
7
- tools: ["todo_write", "get_weather", "web_search"],
8
- };
9
- // Parse transport type from command line argument
10
- const transport = process.argv[2] || "stdio";
11
- if (transport === "http") {
12
- makeHttpTransport(exampleAgent);
13
- } else if (transport === "stdio") {
14
- makeStdioTransport(exampleAgent);
15
- } else {
16
- console.error(`Invalid transport: ${transport}`);
17
- console.error("Usage: bun run example.ts [stdio|http]");
18
- process.exit(1);
19
- }
@@ -1 +0,0 @@
1
- export declare function linkLocalPackages(projectPath: string): Promise<void>;
@@ -1,54 +0,0 @@
1
- import { exists } from "node:fs/promises";
2
- import { join } from "node:path";
3
- import { $ } from "bun";
4
- const PACKAGE_PATHS = {
5
- "@townco/ui": "packages/ui",
6
- "@townco/core": "packages/core",
7
- "@townco/tsconfig": "packages/tsconfig",
8
- "@townco/tui-template": "apps/tui",
9
- "@townco/gui-template": "apps/gui",
10
- "@townco/secret": "packages/secret",
11
- "@townco/agent": "packages/agent",
12
- "@townco/cli": "apps/cli",
13
- };
14
- async function getMonorepoRoot() {
15
- try {
16
- // 1. Get git repo root
17
- const result = await $ `git rev-parse --show-toplevel`.quiet();
18
- const repoRoot = result.text().trim();
19
- // 2. Check package.json name === "town"
20
- const pkgJsonPath = join(repoRoot, "package.json");
21
- const pkgJson = await Bun.file(pkgJsonPath).json();
22
- if (pkgJson.name !== "town")
23
- return null;
24
- // 3. Check packages/agent and packages/ui exist
25
- const agentExists = await exists(join(repoRoot, "packages/agent"));
26
- const uiExists = await exists(join(repoRoot, "packages/ui"));
27
- if (!agentExists || !uiExists)
28
- return null;
29
- return repoRoot;
30
- }
31
- catch {
32
- return null;
33
- }
34
- }
35
- export async function linkLocalPackages(projectPath) {
36
- const repoRoot = await getMonorepoRoot();
37
- if (!repoRoot)
38
- return; // Not in monorepo, no-op
39
- console.log("Detected town monorepo, linking local packages...");
40
- // 1. Register each local package globally
41
- for (const [, localPath] of Object.entries(PACKAGE_PATHS)) {
42
- const pkgPath = join(repoRoot, localPath);
43
- await $ `bun link`.cwd(pkgPath).quiet();
44
- }
45
- // 2. Parse project's package.json for @townco/* deps
46
- const pkgJson = await Bun.file(join(projectPath, "package.json")).json();
47
- const deps = { ...pkgJson.dependencies, ...pkgJson.devDependencies };
48
- const towncoPackages = Object.keys(deps).filter((name) => name.startsWith("@townco/"));
49
- // 3. Link each package in the project
50
- for (const pkgName of towncoPackages) {
51
- await $ `bun link ${pkgName}`.cwd(projectPath);
52
- console.log(`Linked ${pkgName}`);
53
- }
54
- }
@@ -1,153 +0,0 @@
1
- import { describe, expect, test } from "bun:test";
2
- import { estimateAllToolsOverhead, estimateToolDefinitionTokens, extractToolMetadata, } from "../tool-overhead-calculator.js";
3
- describe("tool-overhead-calculator", () => {
4
- describe("estimateToolDefinitionTokens", () => {
5
- test("estimates tokens for a simple tool", () => {
6
- const tool = {
7
- name: "simple_tool",
8
- description: "A simple tool",
9
- schema: {
10
- type: "object",
11
- properties: {
12
- param1: { type: "string" },
13
- },
14
- },
15
- };
16
- const tokens = estimateToolDefinitionTokens(tool);
17
- // Should return a positive number
18
- expect(tokens).toBeGreaterThan(0);
19
- // Rough sanity check: a simple tool should be at least 20 tokens
20
- expect(tokens).toBeGreaterThanOrEqual(20);
21
- });
22
- test("estimates more tokens for a complex tool", () => {
23
- const simpleTool = {
24
- name: "simple",
25
- description: "Simple",
26
- schema: { type: "object" },
27
- };
28
- const complexTool = {
29
- name: "complex_tool_with_long_name",
30
- description: "A very complex tool with a long description that explains what it does in great detail and provides usage notes and examples.",
31
- schema: {
32
- type: "object",
33
- properties: {
34
- param1: {
35
- type: "string",
36
- description: "First parameter description",
37
- },
38
- param2: {
39
- type: "number",
40
- description: "Second parameter description",
41
- },
42
- param3: {
43
- type: "array",
44
- items: { type: "string" },
45
- description: "Third parameter description",
46
- },
47
- },
48
- required: ["param1", "param2"],
49
- },
50
- };
51
- const simpleTokens = estimateToolDefinitionTokens(simpleTool);
52
- const complexTokens = estimateToolDefinitionTokens(complexTool);
53
- expect(complexTokens).toBeGreaterThan(simpleTokens);
54
- });
55
- test("handles empty description", () => {
56
- const tool = {
57
- name: "test",
58
- description: "",
59
- schema: {},
60
- };
61
- const tokens = estimateToolDefinitionTokens(tool);
62
- expect(tokens).toBeGreaterThan(0);
63
- });
64
- });
65
- describe("estimateAllToolsOverhead", () => {
66
- test("returns 0 for empty array", () => {
67
- const tools = [];
68
- const tokens = estimateAllToolsOverhead(tools);
69
- expect(tokens).toBe(0);
70
- });
71
- test("sums tokens for multiple tools", () => {
72
- const tools = [
73
- {
74
- name: "tool1",
75
- description: "First tool",
76
- schema: { type: "object" },
77
- },
78
- {
79
- name: "tool2",
80
- description: "Second tool",
81
- schema: { type: "object" },
82
- },
83
- ];
84
- const totalTokens = estimateAllToolsOverhead(tools);
85
- const tool1Tokens = estimateToolDefinitionTokens(tools[0]);
86
- const tool2Tokens = estimateToolDefinitionTokens(tools[1]);
87
- expect(totalTokens).toBe(tool1Tokens + tool2Tokens);
88
- });
89
- test("handles large tool collections", () => {
90
- const tools = Array.from({ length: 10 }, (_, i) => ({
91
- name: `tool_${i}`,
92
- description: `Tool number ${i} with description`,
93
- schema: {
94
- type: "object",
95
- properties: {
96
- param: { type: "string" },
97
- },
98
- },
99
- }));
100
- const totalTokens = estimateAllToolsOverhead(tools);
101
- // With 10 tools, should be substantial
102
- expect(totalTokens).toBeGreaterThan(100);
103
- });
104
- });
105
- describe("extractToolMetadata", () => {
106
- test("extracts metadata from LangChain tool object", () => {
107
- const langchainTool = {
108
- name: "test_tool",
109
- description: "Test description",
110
- schema: {
111
- type: "object",
112
- properties: { x: { type: "number" } },
113
- },
114
- };
115
- const metadata = extractToolMetadata(langchainTool);
116
- expect(metadata.name).toBe("test_tool");
117
- expect(metadata.description).toBe("Test description");
118
- expect(metadata.schema).toEqual({
119
- type: "object",
120
- properties: { x: { type: "number" } },
121
- });
122
- });
123
- test("handles missing description", () => {
124
- const langchainTool = {
125
- name: "test_tool",
126
- schema: { type: "object" },
127
- };
128
- const metadata = extractToolMetadata(langchainTool);
129
- expect(metadata.name).toBe("test_tool");
130
- expect(metadata.description).toBe("");
131
- expect(metadata.schema).toEqual({ type: "object" });
132
- });
133
- test("handles missing schema", () => {
134
- const langchainTool = {
135
- name: "test_tool",
136
- description: "Test",
137
- };
138
- const metadata = extractToolMetadata(langchainTool);
139
- expect(metadata.name).toBe("test_tool");
140
- expect(metadata.description).toBe("Test");
141
- expect(metadata.schema).toEqual({});
142
- });
143
- test("handles missing description and schema", () => {
144
- const langchainTool = {
145
- name: "test_tool",
146
- };
147
- const metadata = extractToolMetadata(langchainTool);
148
- expect(metadata.name).toBe("test_tool");
149
- expect(metadata.description).toBe("");
150
- expect(metadata.schema).toEqual({});
151
- });
152
- });
153
- });
@@ -1,39 +0,0 @@
1
- /**
2
- * Node.js logger with file rotation support
3
- * Outputs to both stdout and .logs/<service>.log files
4
- */
5
- export type LogLevel = "trace" | "debug" | "info" | "warn" | "error" | "fatal";
6
- export declare class Logger {
7
- private service;
8
- private minLevel;
9
- private logFilePath;
10
- private logsDir;
11
- private writeQueue;
12
- private isWriting;
13
- private silent;
14
- constructor(service: string, minLevel?: LogLevel, options?: {
15
- silent?: boolean;
16
- logsDir?: string;
17
- });
18
- private ensureLogsDirectory;
19
- private shouldLog;
20
- private rotateLogFile;
21
- private writeToFile;
22
- private log;
23
- trace(message: string, metadata?: Record<string, unknown>): void;
24
- debug(message: string, metadata?: Record<string, unknown>): void;
25
- info(message: string, metadata?: Record<string, unknown>): void;
26
- warn(message: string, metadata?: Record<string, unknown>): void;
27
- error(message: string, metadata?: Record<string, unknown>): void;
28
- fatal(message: string, metadata?: Record<string, unknown>): void;
29
- }
30
- /**
31
- * Create a logger instance for a service
32
- * @param service - Service name (e.g., "gui", "http-agent", "tui")
33
- * @param minLevel - Minimum log level to display (default: "debug")
34
- * @param options - Logger options (silent mode, custom logs directory, etc.)
35
- */
36
- export declare function createLogger(service: string, minLevel?: LogLevel, options?: {
37
- silent?: boolean;
38
- logsDir?: string;
39
- }): Logger;