@posthog/agent 1.0.0
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/CLAUDE.md +296 -0
- package/README.md +142 -0
- package/dist/example.d.ts +3 -0
- package/dist/example.d.ts.map +1 -0
- package/dist/example.js +49 -0
- package/dist/example.js.map +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +5 -0
- package/dist/index.js.map +1 -0
- package/dist/src/agent-registry.d.ts +16 -0
- package/dist/src/agent-registry.d.ts.map +1 -0
- package/dist/src/agent-registry.js +54 -0
- package/dist/src/agent-registry.js.map +1 -0
- package/dist/src/agent.d.ts +60 -0
- package/dist/src/agent.d.ts.map +1 -0
- package/dist/src/agent.js +371 -0
- package/dist/src/agent.js.map +1 -0
- package/dist/src/agents/execution.d.ts +2 -0
- package/dist/src/agents/execution.d.ts.map +1 -0
- package/dist/src/agents/execution.js +54 -0
- package/dist/src/agents/execution.js.map +1 -0
- package/dist/src/agents/planning.d.ts +2 -0
- package/dist/src/agents/planning.d.ts.map +1 -0
- package/dist/src/agents/planning.js +68 -0
- package/dist/src/agents/planning.js.map +1 -0
- package/dist/src/event-transformer.d.ts +7 -0
- package/dist/src/event-transformer.d.ts.map +1 -0
- package/dist/src/event-transformer.js +174 -0
- package/dist/src/event-transformer.js.map +1 -0
- package/dist/src/file-manager.d.ts +30 -0
- package/dist/src/file-manager.d.ts.map +1 -0
- package/dist/src/file-manager.js +181 -0
- package/dist/src/file-manager.js.map +1 -0
- package/dist/src/git-manager.d.ts +49 -0
- package/dist/src/git-manager.d.ts.map +1 -0
- package/dist/src/git-manager.js +278 -0
- package/dist/src/git-manager.js.map +1 -0
- package/dist/src/posthog-api.d.ts +48 -0
- package/dist/src/posthog-api.d.ts.map +1 -0
- package/dist/src/posthog-api.js +110 -0
- package/dist/src/posthog-api.js.map +1 -0
- package/dist/src/prompt-builder.d.ts +17 -0
- package/dist/src/prompt-builder.d.ts.map +1 -0
- package/dist/src/prompt-builder.js +75 -0
- package/dist/src/prompt-builder.js.map +1 -0
- package/dist/src/stage-executor.d.ts +16 -0
- package/dist/src/stage-executor.d.ts.map +1 -0
- package/dist/src/stage-executor.js +119 -0
- package/dist/src/stage-executor.js.map +1 -0
- package/dist/src/task-manager.d.ts +25 -0
- package/dist/src/task-manager.d.ts.map +1 -0
- package/dist/src/task-manager.js +119 -0
- package/dist/src/task-manager.js.map +1 -0
- package/dist/src/template-manager.d.ts +30 -0
- package/dist/src/template-manager.d.ts.map +1 -0
- package/dist/src/template-manager.js +118 -0
- package/dist/src/template-manager.js.map +1 -0
- package/dist/src/types.d.ts +163 -0
- package/dist/src/types.d.ts.map +1 -0
- package/dist/src/types.js +9 -0
- package/dist/src/types.js.map +1 -0
- package/dist/src/utils/logger.d.ts +29 -0
- package/dist/src/utils/logger.d.ts.map +1 -0
- package/dist/src/utils/logger.js +66 -0
- package/dist/src/utils/logger.js.map +1 -0
- package/dist/src/utils/mcp.d.ts +10 -0
- package/dist/src/utils/mcp.d.ts.map +1 -0
- package/dist/src/utils/mcp.js +16 -0
- package/dist/src/utils/mcp.js.map +1 -0
- package/dist/src/workflow-registry.d.ts +11 -0
- package/dist/src/workflow-registry.d.ts.map +1 -0
- package/dist/src/workflow-registry.js +26 -0
- package/dist/src/workflow-registry.js.map +1 -0
- package/dist/src/workflow-types.d.ts +45 -0
- package/dist/src/workflow-types.d.ts.map +1 -0
- package/dist/src/workflow-types.js +2 -0
- package/dist/src/workflow-types.js.map +1 -0
- package/package.json +61 -0
- package/src/agent-registry.ts +60 -0
- package/src/agent.ts +428 -0
- package/src/agents/execution.ts +53 -0
- package/src/agents/planning.ts +67 -0
- package/src/event-transformer.ts +189 -0
- package/src/file-manager.ts +204 -0
- package/src/git-manager.ts +344 -0
- package/src/posthog-api.ts +169 -0
- package/src/prompt-builder.ts +93 -0
- package/src/stage-executor.ts +137 -0
- package/src/task-manager.ts +155 -0
- package/src/template-manager.ts +149 -0
- package/src/templates/plan-template.md +45 -0
- package/src/types.ts +223 -0
- package/src/utils/logger.ts +79 -0
- package/src/utils/mcp.ts +15 -0
- package/src/workflow-registry.ts +31 -0
- package/src/workflow-types.ts +53 -0
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { query } from '@anthropic-ai/claude-agent-sdk';
|
|
2
|
+
import { Logger } from './utils/logger';
|
|
3
|
+
import { EventTransformer } from './event-transformer';
|
|
4
|
+
import { AgentRegistry } from './agent-registry';
|
|
5
|
+
import { PLANNING_SYSTEM_PROMPT } from './agents/planning';
|
|
6
|
+
import { EXECUTION_SYSTEM_PROMPT } from './agents/execution';
|
|
7
|
+
import { PromptBuilder } from './prompt-builder';
|
|
8
|
+
import { POSTHOG_MCP } from './utils/mcp';
|
|
9
|
+
export class StageExecutor {
|
|
10
|
+
registry;
|
|
11
|
+
logger;
|
|
12
|
+
eventTransformer;
|
|
13
|
+
promptBuilder;
|
|
14
|
+
constructor(registry, logger, promptBuilder) {
|
|
15
|
+
this.registry = registry;
|
|
16
|
+
this.logger = logger.child('StageExecutor');
|
|
17
|
+
this.eventTransformer = new EventTransformer();
|
|
18
|
+
this.promptBuilder = promptBuilder || new PromptBuilder({
|
|
19
|
+
getTaskFiles: async () => [],
|
|
20
|
+
generatePlanTemplate: async () => '',
|
|
21
|
+
logger,
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
async execute(task, stage, options) {
|
|
25
|
+
const isManual = stage.is_manual_only === true;
|
|
26
|
+
if (isManual) {
|
|
27
|
+
this.logger.info('Manual stage detected; skipping agent execution', { stage: stage.key });
|
|
28
|
+
return { results: [] };
|
|
29
|
+
}
|
|
30
|
+
const inferredAgent = stage.key.toLowerCase().includes('plan') ? 'planning_basic' : 'code_generation';
|
|
31
|
+
const agentName = stage.agent_name || inferredAgent;
|
|
32
|
+
const agent = this.registry.getAgent(agentName);
|
|
33
|
+
if (!agent) {
|
|
34
|
+
throw new Error(`Unknown agent '${agentName}' for stage '${stage.key}'`);
|
|
35
|
+
}
|
|
36
|
+
const permissionMode = options.permissionMode || 'acceptEdits';
|
|
37
|
+
const cwd = options.repositoryPath || process.cwd();
|
|
38
|
+
switch (agent.agent_type) {
|
|
39
|
+
case 'planning':
|
|
40
|
+
return this.runPlanning(task, cwd, options, stage.key);
|
|
41
|
+
case 'execution':
|
|
42
|
+
return this.runExecution(task, cwd, permissionMode, options, stage.key);
|
|
43
|
+
case 'review': // TODO: Implement review
|
|
44
|
+
case 'testing': // TODO: Implement testing
|
|
45
|
+
default:
|
|
46
|
+
// throw new Error(`Unsupported agent type: ${agent.agent_type}`);
|
|
47
|
+
console.warn(`Unsupported agent type: ${agent.agent_type}`);
|
|
48
|
+
return { results: [] };
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
async runPlanning(task, cwd, options, stageKey) {
|
|
52
|
+
const contextPrompt = await this.promptBuilder.buildPlanningPrompt(task);
|
|
53
|
+
let prompt = PLANNING_SYSTEM_PROMPT + '\n\n' + contextPrompt;
|
|
54
|
+
const stageOverrides = options.stageOverrides?.[stageKey] || options.stageOverrides?.['plan'];
|
|
55
|
+
const mergedOverrides = {
|
|
56
|
+
...(options.queryOverrides || {}),
|
|
57
|
+
...(stageOverrides?.queryOverrides || {}),
|
|
58
|
+
};
|
|
59
|
+
const baseOptions = {
|
|
60
|
+
model: 'claude-sonnet-4-5-20250929',
|
|
61
|
+
cwd,
|
|
62
|
+
permissionMode: 'plan',
|
|
63
|
+
settingSources: ['local'],
|
|
64
|
+
mcpServers: {
|
|
65
|
+
...POSTHOG_MCP
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
const response = query({
|
|
69
|
+
prompt,
|
|
70
|
+
options: { ...baseOptions, ...mergedOverrides },
|
|
71
|
+
});
|
|
72
|
+
let plan = '';
|
|
73
|
+
for await (const message of response) {
|
|
74
|
+
const transformed = this.eventTransformer.transform(message);
|
|
75
|
+
if (transformed && transformed.type !== 'token') {
|
|
76
|
+
this.logger.debug('Planning event', { type: transformed.type });
|
|
77
|
+
}
|
|
78
|
+
if (message.type === 'assistant' && message.message?.content) {
|
|
79
|
+
for (const c of message.message.content) {
|
|
80
|
+
if (c.type === 'text' && c.text)
|
|
81
|
+
plan += c.text + '\n';
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
return { plan: plan.trim() };
|
|
86
|
+
}
|
|
87
|
+
async runExecution(task, cwd, permissionMode, options, stageKey) {
|
|
88
|
+
const contextPrompt = await this.promptBuilder.buildExecutionPrompt(task);
|
|
89
|
+
let prompt = EXECUTION_SYSTEM_PROMPT + '\n\n' + contextPrompt;
|
|
90
|
+
const stageOverrides = options.stageOverrides?.[stageKey];
|
|
91
|
+
const mergedOverrides = {
|
|
92
|
+
...(options.queryOverrides || {}),
|
|
93
|
+
...(stageOverrides?.queryOverrides || {}),
|
|
94
|
+
};
|
|
95
|
+
const baseOptions = {
|
|
96
|
+
model: 'claude-sonnet-4-5-20250929',
|
|
97
|
+
cwd,
|
|
98
|
+
permissionMode,
|
|
99
|
+
settingSources: ['local'],
|
|
100
|
+
mcpServers: {
|
|
101
|
+
...POSTHOG_MCP
|
|
102
|
+
}
|
|
103
|
+
};
|
|
104
|
+
const response = query({
|
|
105
|
+
prompt,
|
|
106
|
+
options: { ...baseOptions, ...mergedOverrides },
|
|
107
|
+
});
|
|
108
|
+
const results = [];
|
|
109
|
+
for await (const message of response) {
|
|
110
|
+
const transformed = this.eventTransformer.transform(message);
|
|
111
|
+
if (transformed && transformed.type !== 'token') {
|
|
112
|
+
this.logger.debug('Execution event', { type: transformed.type });
|
|
113
|
+
}
|
|
114
|
+
results.push(message);
|
|
115
|
+
}
|
|
116
|
+
return { results };
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
//# sourceMappingURL=stage-executor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stage-executor.js","sourceRoot":"","sources":["../../src/stage-executor.ts"],"names":[],"mappings":"AAAA,O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BAChD,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,iBAAiB,EAAE,EAAE,IAAI,EAAE,WAAW,CAAC,IAAI,EAAE,CAAC,CAAC;YACnE,CAAC;YACD,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACxB,CAAC;QACD,OAAO,EAAE,OAAO,EAAE,CAAC;IACrB,CAAC;CACF"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export interface TaskExecutionState {
|
|
2
|
+
taskId: string;
|
|
3
|
+
status: 'running' | 'completed' | 'failed' | 'canceled' | 'timeout';
|
|
4
|
+
mode: 'plan_only' | 'plan_and_build' | 'build_only';
|
|
5
|
+
result?: any;
|
|
6
|
+
startedAt: number;
|
|
7
|
+
completedAt?: number;
|
|
8
|
+
abortController?: AbortController;
|
|
9
|
+
}
|
|
10
|
+
export declare class TaskManager {
|
|
11
|
+
private executionStates;
|
|
12
|
+
private defaultTimeout;
|
|
13
|
+
generateExecutionId(): string;
|
|
14
|
+
startExecution(taskId: string, mode: 'plan_only' | 'plan_and_build' | 'build_only', executionId?: string): TaskExecutionState;
|
|
15
|
+
waitForCompletion(executionId: string): Promise<any>;
|
|
16
|
+
completeExecution(executionId: string, result: any): void;
|
|
17
|
+
failExecution(executionId: string, error: Error): void;
|
|
18
|
+
cancelExecution(executionId: string): void;
|
|
19
|
+
getExecution(executionId: string): TaskExecutionState | undefined;
|
|
20
|
+
getAbortSignal(executionId: string): AbortSignal | undefined;
|
|
21
|
+
getAbortController(executionId: string): AbortController | undefined;
|
|
22
|
+
private scheduleTimeout;
|
|
23
|
+
cleanup(olderThan?: number): void;
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=task-manager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"task-manager.d.ts","sourceRoot":"","sources":["../../src/task-manager.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,kBAAkB;IACjC,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,SAAS,GAAG,WAAW,GAAG,QAAQ,GAAG,UAAU,GAAG,SAAS,CAAC;IACpE,IAAI,EAAE,WAAW,GAAG,gBAAgB,GAAG,YAAY,CAAC;IACpD,MAAM,CAAC,EAAE,GAAG,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,eAAe,CAAC,EAAE,eAAe,CAAC;CACnC;AAED,qBAAa,WAAW;IACtB,OAAO,CAAC,eAAe,CAAyC;IAChE,OAAO,CAAC,cAAc,CAAkB;IAExC,mBAAmB,IAAI,MAAM;IAI7B,cAAc,CACZ,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,WAAW,GAAG,gBAAgB,GAAG,YAAY,EACnD,WAAW,GAAE,MAAmC,GAC/C,kBAAkB;IAef,iBAAiB,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC;IAkC1D,iBAAiB,CAAC,WAAW,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,GAAG,IAAI;IAWzD,aAAa,CAAC,WAAW,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,GAAG,IAAI;IActD,eAAe,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI;IAkB1C,YAAY,CAAC,WAAW,EAAE,MAAM,GAAG,kBAAkB,GAAG,SAAS;IAIjE,cAAc,CAAC,WAAW,EAAE,MAAM,GAAG,WAAW,GAAG,SAAS;IAI5D,kBAAkB,CAAC,WAAW,EAAE,MAAM,GAAG,eAAe,GAAG,SAAS;IAIpE,OAAO,CAAC,eAAe;IAkBvB,OAAO,CAAC,SAAS,GAAE,MAAuB,GAAG,IAAI;CAQlD"}
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { randomBytes } from 'crypto';
|
|
2
|
+
export class TaskManager {
|
|
3
|
+
executionStates = new Map();
|
|
4
|
+
defaultTimeout = 10 * 60 * 1000; // 10 minutes
|
|
5
|
+
generateExecutionId() {
|
|
6
|
+
return randomBytes(16).toString('hex');
|
|
7
|
+
}
|
|
8
|
+
startExecution(taskId, mode, executionId = this.generateExecutionId()) {
|
|
9
|
+
const executionState = {
|
|
10
|
+
taskId,
|
|
11
|
+
status: 'running',
|
|
12
|
+
mode,
|
|
13
|
+
startedAt: Date.now(),
|
|
14
|
+
abortController: new AbortController(),
|
|
15
|
+
};
|
|
16
|
+
this.executionStates.set(executionId, executionState);
|
|
17
|
+
this.scheduleTimeout(executionId);
|
|
18
|
+
return executionState;
|
|
19
|
+
}
|
|
20
|
+
async waitForCompletion(executionId) {
|
|
21
|
+
const execution = this.executionStates.get(executionId);
|
|
22
|
+
if (!execution) {
|
|
23
|
+
throw new Error(`Execution ${executionId} not found`);
|
|
24
|
+
}
|
|
25
|
+
if (execution.result && execution.status === 'completed') {
|
|
26
|
+
return execution.result;
|
|
27
|
+
}
|
|
28
|
+
return new Promise((resolve, reject) => {
|
|
29
|
+
const checkInterval = setInterval(() => {
|
|
30
|
+
const currentExecution = this.executionStates.get(executionId);
|
|
31
|
+
if (!currentExecution) {
|
|
32
|
+
clearInterval(checkInterval);
|
|
33
|
+
reject(new Error(`Execution ${executionId} disappeared`));
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
if (currentExecution.status === 'completed' && currentExecution.result) {
|
|
37
|
+
clearInterval(checkInterval);
|
|
38
|
+
resolve(currentExecution.result);
|
|
39
|
+
}
|
|
40
|
+
else if (currentExecution.status === 'failed' ||
|
|
41
|
+
currentExecution.status === 'canceled' ||
|
|
42
|
+
currentExecution.status === 'timeout') {
|
|
43
|
+
clearInterval(checkInterval);
|
|
44
|
+
reject(new Error(`Execution ${executionId} ${currentExecution.status}`));
|
|
45
|
+
}
|
|
46
|
+
}, 100);
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
completeExecution(executionId, result) {
|
|
50
|
+
const execution = this.executionStates.get(executionId);
|
|
51
|
+
if (!execution) {
|
|
52
|
+
throw new Error(`Execution ${executionId} not found`);
|
|
53
|
+
}
|
|
54
|
+
execution.status = 'completed';
|
|
55
|
+
execution.result = result;
|
|
56
|
+
execution.completedAt = Date.now();
|
|
57
|
+
}
|
|
58
|
+
failExecution(executionId, error) {
|
|
59
|
+
const execution = this.executionStates.get(executionId);
|
|
60
|
+
if (!execution) {
|
|
61
|
+
throw new Error(`Execution ${executionId} not found`);
|
|
62
|
+
}
|
|
63
|
+
execution.status = 'failed';
|
|
64
|
+
execution.completedAt = Date.now();
|
|
65
|
+
execution.result = {
|
|
66
|
+
error: error.message,
|
|
67
|
+
status: 'failed',
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
cancelExecution(executionId) {
|
|
71
|
+
const execution = this.executionStates.get(executionId);
|
|
72
|
+
if (!execution) {
|
|
73
|
+
throw new Error(`Execution ${executionId} not found`);
|
|
74
|
+
}
|
|
75
|
+
execution.status = 'canceled';
|
|
76
|
+
execution.completedAt = Date.now();
|
|
77
|
+
execution.abortController?.abort();
|
|
78
|
+
if (!execution.result) {
|
|
79
|
+
execution.result = {
|
|
80
|
+
status: 'canceled',
|
|
81
|
+
message: 'Execution was canceled',
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
getExecution(executionId) {
|
|
86
|
+
return this.executionStates.get(executionId);
|
|
87
|
+
}
|
|
88
|
+
getAbortSignal(executionId) {
|
|
89
|
+
return this.executionStates.get(executionId)?.abortController?.signal;
|
|
90
|
+
}
|
|
91
|
+
getAbortController(executionId) {
|
|
92
|
+
return this.executionStates.get(executionId)?.abortController;
|
|
93
|
+
}
|
|
94
|
+
scheduleTimeout(executionId, timeout = this.defaultTimeout) {
|
|
95
|
+
setTimeout(() => {
|
|
96
|
+
const execution = this.executionStates.get(executionId);
|
|
97
|
+
if (execution && execution.status === 'running') {
|
|
98
|
+
execution.status = 'timeout';
|
|
99
|
+
execution.completedAt = Date.now();
|
|
100
|
+
execution.abortController?.abort();
|
|
101
|
+
if (!execution.result) {
|
|
102
|
+
execution.result = {
|
|
103
|
+
status: 'timeout',
|
|
104
|
+
message: 'Execution timed out',
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}, timeout);
|
|
109
|
+
}
|
|
110
|
+
cleanup(olderThan = 60 * 60 * 1000) {
|
|
111
|
+
const cutoff = Date.now() - olderThan;
|
|
112
|
+
for (const [executionId, execution] of this.executionStates) {
|
|
113
|
+
if (execution.completedAt && execution.completedAt < cutoff) {
|
|
114
|
+
this.executionStates.delete(executionId);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
//# sourceMappingURL=task-manager.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"task-manager.js","sourceRoot":"","sources":["../../src/task-manager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC;AAYrC,MAAM,OAAO,WAAW;IACd,eAAe,GAAG,IAAI,GAAG,EAA8B,CAAC;IACxD,cAAc,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC,aAAa;IAEtD,mBAAmB;QACjB,OAAO,WAAW,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IACzC,CAAC;IAED,cAAc,CACZ,MAAc,EACd,IAAmD,EACnD,cAAsB,IAAI,CAAC,mBAAmB,EAAE;QAEhD,MAAM,cAAc,GAAuB;YACzC,MAAM;YACN,MAAM,EAAE,SAAS;YACjB,IAAI;YACJ,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE;YACrB,eAAe,EAAE,IAAI,eAAe,EAAE;SACvC,CAAC;QAEF,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,WAAW,EAAE,cAAc,CAAC,CAAC;QACtD,IAAI,CAAC,eAAe,CAAC,WAAW,CAAC,CAAC;QAElC,OAAO,cAAc,CAAC;IACxB,CAAC;IAED,KAAK,CAAC,iBAAiB,CAAC,WAAmB;QACzC,MAAM,SA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,CAAC,eAAe,EAAE,CAAC;YAC5D,IAAI,SAAS,CAAC,WAAW,IAAI,SAAS,CAAC,WAAW,GAAG,MAAM,EAAE,CAAC;gBAC5D,IAAI,CAAC,eAAe,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;YAC3C,CAAC;QACH,CAAC;IACH,CAAC;CACF"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export interface TemplateVariables {
|
|
2
|
+
task_id: string;
|
|
3
|
+
task_title: string;
|
|
4
|
+
task_description?: string;
|
|
5
|
+
date: string;
|
|
6
|
+
repository?: string;
|
|
7
|
+
[key: string]: string | undefined;
|
|
8
|
+
}
|
|
9
|
+
export declare class TemplateManager {
|
|
10
|
+
private templatesDir;
|
|
11
|
+
constructor();
|
|
12
|
+
private loadTemplate;
|
|
13
|
+
private substituteVariables;
|
|
14
|
+
generatePlan(variables: TemplateVariables): Promise<string>;
|
|
15
|
+
generateCustomFile(templateName: string, variables: TemplateVariables): Promise<string>;
|
|
16
|
+
createTaskStructure(taskId: string, taskTitle: string, options?: {
|
|
17
|
+
includePlan?: boolean;
|
|
18
|
+
additionalFiles?: Array<{
|
|
19
|
+
name: string;
|
|
20
|
+
template?: string;
|
|
21
|
+
content?: string;
|
|
22
|
+
}>;
|
|
23
|
+
}): Promise<Array<{
|
|
24
|
+
name: string;
|
|
25
|
+
content: string;
|
|
26
|
+
type: 'plan' | 'context' | 'reference' | 'output';
|
|
27
|
+
}>>;
|
|
28
|
+
generatePostHogReadme(): string;
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=template-manager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"template-manager.d.ts","sourceRoot":"","sources":["../../src/template-manager.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;CACnC;AAED,qBAAa,eAAe;IAC1B,OAAO,CAAC,YAAY,CAAS;;YAQf,YAAY;IAS1B,OAAO,CAAC,mBAAmB;IAerB,YAAY,CAAC,SAAS,EAAE,iBAAiB,GAAG,OAAO,CAAC,MAAM,CAAC;IAS3D,kBAAkB,CAAC,YAAY,EAAE,MAAM,EAAE,SAAS,EAAE,iBAAiB,GAAG,OAAO,CAAC,MAAM,CAAC;IAQvF,mBAAmB,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;QACrE,WAAW,CAAC,EAAE,OAAO,CAAC;QACtB,eAAe,CAAC,EAAE,KAAK,CAAC;YACtB,IAAI,EAAE,MAAM,CAAC;YACb,QAAQ,CAAC,EAAE,MAAM,CAAC;YAClB,OAAO,CAAC,EAAE,MAAM,CAAC;SAClB,CAAC,CAAC;KACJ,GAAG,OAAO,CAAC,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,WAAW,GAAG,QAAQ,CAAA;KAAE,CAAC,CAAC;IA2CxG,qBAAqB,IAAI,MAAM;CAmChC"}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { promises as fs } from 'fs';
|
|
2
|
+
import { join, dirname } from 'path';
|
|
3
|
+
import { fileURLToPath } from 'url';
|
|
4
|
+
export class TemplateManager {
|
|
5
|
+
templatesDir;
|
|
6
|
+
constructor() {
|
|
7
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
8
|
+
const __dirname = dirname(__filename);
|
|
9
|
+
this.templatesDir = join(__dirname, 'templates');
|
|
10
|
+
}
|
|
11
|
+
async loadTemplate(templateName) {
|
|
12
|
+
try {
|
|
13
|
+
const templatePath = join(this.templatesDir, templateName);
|
|
14
|
+
return await fs.readFile(templatePath, 'utf8');
|
|
15
|
+
}
|
|
16
|
+
catch (error) {
|
|
17
|
+
throw new Error(`Failed to load template ${templateName}: ${error}`);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
substituteVariables(template, variables) {
|
|
21
|
+
let result = template;
|
|
22
|
+
for (const [key, value] of Object.entries(variables)) {
|
|
23
|
+
if (value !== undefined) {
|
|
24
|
+
const placeholder = new RegExp(`{{${key}}}`, 'g');
|
|
25
|
+
result = result.replace(placeholder, value);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
result = result.replace(/{{[^}]+}}/g, '[PLACEHOLDER]');
|
|
29
|
+
return result;
|
|
30
|
+
}
|
|
31
|
+
async generatePlan(variables) {
|
|
32
|
+
const template = await this.loadTemplate('plan-template.md');
|
|
33
|
+
return this.substituteVariables(template, {
|
|
34
|
+
...variables,
|
|
35
|
+
date: variables.date || new Date().toISOString().split('T')[0]
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
async generateCustomFile(templateName, variables) {
|
|
39
|
+
const template = await this.loadTemplate(templateName);
|
|
40
|
+
return this.substituteVariables(template, {
|
|
41
|
+
...variables,
|
|
42
|
+
date: variables.date || new Date().toISOString().split('T')[0]
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
async createTaskStructure(taskId, taskTitle, options) {
|
|
46
|
+
const files = [];
|
|
47
|
+
const variables = {
|
|
48
|
+
task_id: taskId,
|
|
49
|
+
task_title: taskTitle,
|
|
50
|
+
date: new Date().toISOString().split('T')[0]
|
|
51
|
+
};
|
|
52
|
+
// Generate plan file if requested
|
|
53
|
+
if (options?.includePlan !== false) {
|
|
54
|
+
const planContent = await this.generatePlan(variables);
|
|
55
|
+
files.push({
|
|
56
|
+
name: 'plan.md',
|
|
57
|
+
content: planContent,
|
|
58
|
+
type: 'plan'
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
if (options?.additionalFiles) {
|
|
62
|
+
for (const file of options.additionalFiles) {
|
|
63
|
+
let content;
|
|
64
|
+
if (file.template) {
|
|
65
|
+
content = await this.generateCustomFile(file.template, variables);
|
|
66
|
+
}
|
|
67
|
+
else if (file.content) {
|
|
68
|
+
content = this.substituteVariables(file.content, variables);
|
|
69
|
+
}
|
|
70
|
+
else {
|
|
71
|
+
content = `# ${file.name}\n\nPlaceholder content for ${file.name}`;
|
|
72
|
+
}
|
|
73
|
+
files.push({
|
|
74
|
+
name: file.name,
|
|
75
|
+
content,
|
|
76
|
+
type: file.name.includes('context') ? 'context' : 'reference'
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
return files;
|
|
81
|
+
}
|
|
82
|
+
generatePostHogReadme() {
|
|
83
|
+
return `# PostHog Task Files
|
|
84
|
+
|
|
85
|
+
This directory contains task-related files generated by the PostHog Agent.
|
|
86
|
+
|
|
87
|
+
## Structure
|
|
88
|
+
|
|
89
|
+
Each task has its own subdirectory: \`.posthog/{task-id}/\`
|
|
90
|
+
|
|
91
|
+
### Common Files
|
|
92
|
+
|
|
93
|
+
- **plan.md** - Implementation plan generated during planning phase
|
|
94
|
+
- **Supporting files** - Any additional files added for task context
|
|
95
|
+
- **artifacts/** - Generated files, outputs, and temporary artifacts
|
|
96
|
+
|
|
97
|
+
### Usage
|
|
98
|
+
|
|
99
|
+
These files are:
|
|
100
|
+
- Version controlled alongside your code
|
|
101
|
+
- Used by the PostHog Agent for context
|
|
102
|
+
- Available for review in pull requests
|
|
103
|
+
- Organized by task ID for easy reference
|
|
104
|
+
|
|
105
|
+
### Gitignore
|
|
106
|
+
|
|
107
|
+
Customize \`.posthog/.gitignore\` to control which files are committed:
|
|
108
|
+
- Include plans and documentation by default
|
|
109
|
+
- Exclude temporary files and sensitive data
|
|
110
|
+
- Customize based on your team's workflow
|
|
111
|
+
|
|
112
|
+
---
|
|
113
|
+
|
|
114
|
+
*Generated by PostHog Agent*
|
|
115
|
+
`;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
//# sourceMappingURL=template-manager.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"template-manager.js","sourceRoot":"","sources":["../../src/template-manager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,IAAI,EAAE,EAAE,MAAM,IAAI,CAAC;AACpC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AACrC,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AAWpC,MAAM,OAAO,eAAe;IAClB,YAAY,CAAS;IAE7B;QACE,MAAM,UAAU,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAClD,MAAM,SAAS,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;QACtC,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,SAAS,EAAE,WAAW,CAAC,CAAC;IACnD,CAAC;IAEO,KAAK,CAAC,YAAY,CAAC,YAAoB;QAC7C,IAAI,CAAC;YACH,MAAM,YAAY,GAAG,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE,YAAY,CAAC,CAAC;YAC3D,OAAO,MAAM,EAAE,CAAC,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC;QACjD,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,MAAM,IAAI,KAAK,CAAC,2BAA2B,YAAY,KAAK,KAAK,EAAE,CAAC,CAAC;QACvE,CAAC;IACH,CAAC;IAEO,mBAAmB,CAAC,QAAgB,EAAE,SAA4B;QACxE,IAAI,MAAM,GAAG,QAAQ,CAAC;QAEtB,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE,CAAC;YACrD,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;gBACxB,MAAM,WAAW,GAAG,IAAI,MAAM,CAAC,KAAK,GAAG,IAAI,EAAE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|
4
|
+
description: string;
|
|
5
|
+
origin_product: 'error_tracking' | 'eval_clusters' | 'user_created' | 'support_queue' | 'session_summaries';
|
|
6
|
+
position?: number;
|
|
7
|
+
workflow?: string | null;
|
|
8
|
+
current_stage?: string | null;
|
|
9
|
+
github_integration?: number | null;
|
|
10
|
+
repository_config?: unknown;
|
|
11
|
+
repository_list: string;
|
|
12
|
+
primary_repository: string;
|
|
13
|
+
github_branch: string | null;
|
|
14
|
+
github_pr_url: string | null;
|
|
15
|
+
created_at: string;
|
|
16
|
+
updated_at: string;
|
|
17
|
+
}
|
|
18
|
+
export interface SupportingFile {
|
|
19
|
+
name: string;
|
|
20
|
+
content: string;
|
|
21
|
+
type: 'plan' | 'context' | 'reference' | 'output';
|
|
22
|
+
created_at: string;
|
|
23
|
+
}
|
|
24
|
+
export declare enum PermissionMode {
|
|
25
|
+
PLAN = "plan",
|
|
26
|
+
DEFAULT = "default",
|
|
27
|
+
ACCEPT_EDITS = "acceptEdits",
|
|
28
|
+
BYPASS = "bypassPermissions"
|
|
29
|
+
}
|
|
30
|
+
export interface ExecutionOptions {
|
|
31
|
+
repositoryPath?: string;
|
|
32
|
+
permissionMode?: PermissionMode;
|
|
33
|
+
}
|
|
34
|
+
interface BaseEvent {
|
|
35
|
+
ts: number;
|
|
36
|
+
}
|
|
37
|
+
export interface TokenEvent extends BaseEvent {
|
|
38
|
+
type: 'token';
|
|
39
|
+
content: string;
|
|
40
|
+
contentType?: 'text' | 'thinking' | 'tool_input';
|
|
41
|
+
}
|
|
42
|
+
export interface ContentBlockStartEvent extends BaseEvent {
|
|
43
|
+
type: 'content_block_start';
|
|
44
|
+
index: number;
|
|
45
|
+
contentType: 'text' | 'tool_use' | 'thinking';
|
|
46
|
+
toolName?: string;
|
|
47
|
+
toolId?: string;
|
|
48
|
+
}
|
|
49
|
+
export interface ContentBlockStopEvent extends BaseEvent {
|
|
50
|
+
type: 'content_block_stop';
|
|
51
|
+
index: number;
|
|
52
|
+
}
|
|
53
|
+
export interface ToolCallEvent extends BaseEvent {
|
|
54
|
+
type: 'tool_call';
|
|
55
|
+
toolName: string;
|
|
56
|
+
callId: string;
|
|
57
|
+
args: Record<string, any>;
|
|
58
|
+
}
|
|
59
|
+
export interface ToolResultEvent extends BaseEvent {
|
|
60
|
+
type: 'tool_result';
|
|
61
|
+
toolName: string;
|
|
62
|
+
callId: string;
|
|
63
|
+
result: any;
|
|
64
|
+
}
|
|
65
|
+
export interface MessageStartEvent extends BaseEvent {
|
|
66
|
+
type: 'message_start';
|
|
67
|
+
messageId?: string;
|
|
68
|
+
model?: string;
|
|
69
|
+
}
|
|
70
|
+
export interface MessageDeltaEvent extends BaseEvent {
|
|
71
|
+
type: 'message_delta';
|
|
72
|
+
stopReason?: string;
|
|
73
|
+
stopSequence?: string;
|
|
74
|
+
usage?: {
|
|
75
|
+
outputTokens: number;
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
export interface MessageStopEvent extends BaseEvent {
|
|
79
|
+
type: 'message_stop';
|
|
80
|
+
}
|
|
81
|
+
export interface UserMessageEvent extends BaseEvent {
|
|
82
|
+
type: 'user_message';
|
|
83
|
+
content: string;
|
|
84
|
+
isSynthetic?: boolean;
|
|
85
|
+
}
|
|
86
|
+
export interface StatusEvent extends BaseEvent {
|
|
87
|
+
type: 'status';
|
|
88
|
+
phase: string;
|
|
89
|
+
[key: string]: any;
|
|
90
|
+
}
|
|
91
|
+
export interface InitEvent extends BaseEvent {
|
|
92
|
+
type: 'init';
|
|
93
|
+
model: string;
|
|
94
|
+
tools: string[];
|
|
95
|
+
permissionMode: string;
|
|
96
|
+
cwd: string;
|
|
97
|
+
apiKeySource: string;
|
|
98
|
+
}
|
|
99
|
+
export interface CompactBoundaryEvent extends BaseEvent {
|
|
100
|
+
type: 'compact_boundary';
|
|
101
|
+
trigger: 'manual' | 'auto';
|
|
102
|
+
preTokens: number;
|
|
103
|
+
}
|
|
104
|
+
export interface DoneEvent extends BaseEvent {
|
|
105
|
+
type: 'done';
|
|
106
|
+
durationMs?: number;
|
|
107
|
+
numTurns?: number;
|
|
108
|
+
totalCostUsd?: number;
|
|
109
|
+
usage?: any;
|
|
110
|
+
}
|
|
111
|
+
export interface ErrorEvent extends BaseEvent {
|
|
112
|
+
type: 'error';
|
|
113
|
+
message: string;
|
|
114
|
+
error?: any;
|
|
115
|
+
errorType?: string;
|
|
116
|
+
}
|
|
117
|
+
export interface DiffEvent extends BaseEvent {
|
|
118
|
+
type: 'diff';
|
|
119
|
+
file: string;
|
|
120
|
+
patch: string;
|
|
121
|
+
summary?: string;
|
|
122
|
+
}
|
|
123
|
+
export interface FileWriteEvent extends BaseEvent {
|
|
124
|
+
type: 'file_write';
|
|
125
|
+
path: string;
|
|
126
|
+
bytes: number;
|
|
127
|
+
}
|
|
128
|
+
export interface MetricEvent extends BaseEvent {
|
|
129
|
+
type: 'metric';
|
|
130
|
+
key: string;
|
|
131
|
+
value: number;
|
|
132
|
+
unit?: string;
|
|
133
|
+
}
|
|
134
|
+
export interface ArtifactEvent extends BaseEvent {
|
|
135
|
+
type: 'artifact';
|
|
136
|
+
kind: string;
|
|
137
|
+
content: any;
|
|
138
|
+
}
|
|
139
|
+
export type AgentEvent = TokenEvent | ContentBlockStartEvent | ContentBlockStopEvent | ToolCallEvent | ToolResultEvent | MessageStartEvent | MessageDeltaEvent | MessageStopEvent | UserMessageEvent | StatusEvent | InitEvent | CompactBoundaryEvent | DoneEvent | ErrorEvent | DiffEvent | FileWriteEvent | MetricEvent | ArtifactEvent;
|
|
140
|
+
export interface ExecutionResult {
|
|
141
|
+
results: any[];
|
|
142
|
+
}
|
|
143
|
+
export interface PlanResult {
|
|
144
|
+
plan: string;
|
|
145
|
+
}
|
|
146
|
+
export interface TaskExecutionResult {
|
|
147
|
+
task: Task;
|
|
148
|
+
plan?: string;
|
|
149
|
+
executionResult?: ExecutionResult;
|
|
150
|
+
}
|
|
151
|
+
export interface AgentConfig {
|
|
152
|
+
workingDirectory?: string;
|
|
153
|
+
onEvent?: (event: AgentEvent) => void;
|
|
154
|
+
posthogApiUrl?: string;
|
|
155
|
+
posthogApiKey?: string;
|
|
156
|
+
debug?: boolean;
|
|
157
|
+
}
|
|
158
|
+
export interface PostHogAPIConfig {
|
|
159
|
+
apiUrl: string;
|
|
160
|
+
apiKey: string;
|
|
161
|
+
}
|
|
162
|
+
export {};
|
|
163
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AACA,MAAM,WAAW,IAAI;IACnB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,EAAE,gBAAgB,GAAG,eAAe,GAAG,cAAc,GAAG,eAAe,GAAG,mBAAmB,CAAC;IAC5G,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,kBAAkB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACnC,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,eAAe,EAAE,MAAM,CAAC;IACxB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,WAAW,GAAG,QAAQ,CAAC;IAClD,UAAU,EAAE,MAAM,CAAC;CACpB;AAID,oBAAY,cAAc;IACxB,IAAI,SAAS;IACb,OAAO,YAAY;IACn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AC1B,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,UAAU,KAAK,IAAI,CAAC;IAGtC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,aAAa,CAAC,EAAE,MAAM,CAAC;IAGvB,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;CAChB"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
// Removed legacy ExecutionMode in favor of configurable workflows
|
|
2
|
+
export var PermissionMode;
|
|
3
|
+
(function (PermissionMode) {
|
|
4
|
+
PermissionMode["PLAN"] = "plan";
|
|
5
|
+
PermissionMode["DEFAULT"] = "default";
|
|
6
|
+
PermissionMode["ACCEPT_EDITS"] = "acceptEdits";
|
|
7
|
+
PermissionMode["BYPASS"] = "bypassPermissions";
|
|
8
|
+
})(PermissionMode || (PermissionMode = {}));
|
|
9
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AA0BA,kEAAkE;AAElE,MAAM,CAAN,IAAY,cAKX;AALD,WAAY,cAAc;IACxB,+BAAa,CAAA;IACb,qCAAmB,CAAA;IACnB,8CAA4B,CAAA;IAC5B,8CAA4B,CAAA;AAC9B,CAAC,EALW,cAAc,KAAd,cAAc,QAKzB"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Simple logger utility with configurable debug mode
|
|
3
|
+
*/
|
|
4
|
+
export declare enum LogLevel {
|
|
5
|
+
ERROR = 0,
|
|
6
|
+
WARN = 1,
|
|
7
|
+
INFO = 2,
|
|
8
|
+
DEBUG = 3
|
|
9
|
+
}
|
|
10
|
+
export interface LoggerConfig {
|
|
11
|
+
debug?: boolean;
|
|
12
|
+
prefix?: string;
|
|
13
|
+
}
|
|
14
|
+
export declare class Logger {
|
|
15
|
+
private debugEnabled;
|
|
16
|
+
private prefix;
|
|
17
|
+
constructor(config?: LoggerConfig);
|
|
18
|
+
setDebug(enabled: boolean): void;
|
|
19
|
+
private formatMessage;
|
|
20
|
+
error(message: string, error?: Error | any): void;
|
|
21
|
+
warn(message: string, data?: any): void;
|
|
22
|
+
info(message: string, data?: any): void;
|
|
23
|
+
debug(message: string, data?: any): void;
|
|
24
|
+
/**
|
|
25
|
+
* Create a child logger with additional prefix
|
|
26
|
+
*/
|
|
27
|
+
child(childPrefix: string): Logger;
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=logger.d.ts.map
|