@posthog/agent 1.0.1 → 1.1.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/dist/index.js +4 -5
- package/dist/index.js.map +1 -1
- package/dist/src/agent-registry.d.ts +1 -1
- package/dist/src/agent-registry.d.ts.map +1 -1
- package/dist/src/agent-registry.js +4 -2
- package/dist/src/agent-registry.js.map +1 -1
- package/dist/src/agent.d.ts +6 -6
- package/dist/src/agent.d.ts.map +1 -1
- package/dist/src/agent.js +18 -17
- package/dist/src/agent.js.map +1 -1
- package/dist/src/agents/execution.js +4 -2
- package/dist/src/agents/execution.js.map +1 -1
- package/dist/src/agents/planning.js +4 -2
- package/dist/src/agents/planning.js.map +1 -1
- package/dist/src/event-transformer.js +4 -2
- package/dist/src/event-transformer.js.map +1 -1
- package/dist/src/file-manager.d.ts +2 -2
- package/dist/src/file-manager.d.ts.map +1 -1
- package/dist/src/file-manager.js +18 -15
- package/dist/src/file-manager.js.map +1 -1
- package/dist/src/git-manager.d.ts +1 -1
- package/dist/src/git-manager.d.ts.map +1 -1
- package/dist/src/git-manager.js +6 -3
- package/dist/src/git-manager.js.map +1 -1
- package/dist/src/posthog-api.d.ts +2 -2
- package/dist/src/posthog-api.d.ts.map +1 -1
- package/dist/src/posthog-api.js +4 -2
- package/dist/src/posthog-api.js.map +1 -1
- package/dist/src/prompt-builder.d.ts +3 -3
- package/dist/src/prompt-builder.d.ts.map +1 -1
- package/dist/src/prompt-builder.js +6 -3
- package/dist/src/prompt-builder.js.map +1 -1
- package/dist/src/stage-executor.d.ts +5 -5
- package/dist/src/stage-executor.d.ts.map +1 -1
- package/dist/src/stage-executor.js +11 -9
- package/dist/src/stage-executor.js.map +1 -1
- package/dist/src/task-manager.js +5 -2
- package/dist/src/task-manager.js.map +1 -1
- package/dist/src/template-manager.d.ts.map +1 -1
- package/dist/src/template-manager.js +16 -6
- package/dist/src/template-manager.js.map +1 -1
- package/dist/src/types.js +4 -2
- package/dist/src/types.js.map +1 -1
- package/dist/src/utils/logger.js +5 -3
- package/dist/src/utils/logger.js.map +1 -1
- package/dist/src/utils/mcp.js +4 -2
- package/dist/src/utils/mcp.js.map +1 -1
- package/dist/src/workflow-registry.d.ts +2 -2
- package/dist/src/workflow-registry.d.ts.map +1 -1
- package/dist/src/workflow-registry.js +4 -3
- package/dist/src/workflow-registry.js.map +1 -1
- package/dist/src/workflow-types.d.ts +1 -1
- package/dist/src/workflow-types.d.ts.map +1 -1
- package/dist/templates/plan-template.md +45 -0
- package/package.json +8 -2
- package/src/agent-registry.ts +1 -2
- package/src/agent.ts +19 -19
- package/src/file-manager.ts +3 -3
- package/src/git-manager.ts +2 -2
- package/src/posthog-api.ts +3 -3
- package/src/prompt-builder.ts +3 -4
- package/src/stage-executor.ts +9 -10
- package/src/template-manager.ts +11 -3
- package/src/workflow-registry.ts +2 -3
- package/src/workflow-types.ts +1 -2
- package/dist/example.js +0 -49
- package/dist/example.js.map +0 -1
- package/dist/src/workflow-types.js +0 -2
- package/dist/src/workflow-types.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
export {
|
|
3
|
-
export {
|
|
4
|
-
|
|
5
|
-
//# sourceMappingURL=index.js.map
|
|
1
|
+
export { Agent } from './src/agent.js';
|
|
2
|
+
export { PermissionMode } from './src/types.js';
|
|
3
|
+
export { LogLevel, Logger } from './src/utils/logger.js';
|
|
4
|
+
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent-registry.d.ts","sourceRoot":"","sources":["../../src/agent-registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"agent-registry.d.ts","sourceRoot":"","sources":["../../src/agent-registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAEtE,qBAAa,aAAa;IACxB,OAAO,CAAC,YAAY,CAA2C;gBAEnD,WAAW,CAAC,EAAE,eAAe,EAAE;IAQ3C,MAAM,CAAC,gBAAgB,IAAI,eAAe,EAAE;IA6B5C,QAAQ,CAAC,GAAG,EAAE,eAAe,GAAG,IAAI;IAIpC,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,eAAe,GAAG,SAAS;IAInD,UAAU,IAAI,eAAe,EAAE;IAI/B,gBAAgB,IAAI;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,SAAS,CAAC;QAAC,WAAW,CAAC,EAAE,MAAM,CAAA;KAAE,EAAE;CAGhG"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
class AgentRegistry {
|
|
2
2
|
agentsByName = new Map();
|
|
3
3
|
constructor(definitions) {
|
|
4
4
|
if (definitions) {
|
|
@@ -51,4 +51,6 @@ export class AgentRegistry {
|
|
|
51
51
|
return this.listAgents().map(({ id, name, agent_type, description }) => ({ id, name, agent_type, description }));
|
|
52
52
|
}
|
|
53
53
|
}
|
|
54
|
-
|
|
54
|
+
|
|
55
|
+
export { AgentRegistry };
|
|
56
|
+
//# sourceMappingURL=agent-registry.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent-registry.js","
|
|
1
|
+
{"version":3,"file":"agent-registry.js","sources":["../../src/agent-registry.ts"],"sourcesContent":["import type { AgentDefinition, AgentType } from './workflow-types.js';\n\nexport class AgentRegistry {\n private agentsByName: Map<string, AgentDefinition> = new Map();\n\n constructor(definitions?: AgentDefinition[]) {\n if (definitions) {\n for (const def of definitions) this.register(def);\n } else {\n for (const def of AgentRegistry.getDefaultAgents()) this.register(def);\n }\n }\n\n static getDefaultAgents(): AgentDefinition[] {\n return [\n {\n id: 'planning_basic',\n name: 'planning_basic',\n agent_type: 'planning',\n description: 'Analyze repo and produce implementation plan',\n },\n {\n id: 'code_generation',\n name: 'code_generation',\n agent_type: 'execution',\n description: 'Implements code changes using Claude SDK',\n },\n {\n id: 'review_basic',\n name: 'review_basic',\n agent_type: 'review',\n description: 'Reviews changes and suggests fixes',\n },\n {\n id: 'testing_basic',\n name: 'testing_basic',\n agent_type: 'testing',\n description: 'Runs tests and reports results',\n },\n ];\n }\n\n register(def: AgentDefinition): void {\n this.agentsByName.set(def.name, def);\n }\n\n getAgent(name: string): AgentDefinition | undefined {\n return this.agentsByName.get(name);\n }\n\n listAgents(): AgentDefinition[] {\n return Array.from(this.agentsByName.values());\n }\n\n exportForPostHog(): { id: string; name: string; agent_type: AgentType; description?: string }[] {\n return this.listAgents().map(({ id, name, agent_type, description }) => ({ id, name, agent_type, description }));\n }\n}\n\n"],"names":[],"mappings":"MAEa,aAAa,CAAA;AAChB,IAAA,YAAY,GAAiC,IAAI,GAAG,EAAE;AAE9D,IAAA,WAAA,CAAY,WAA+B,EAAA;QACzC,IAAI,WAAW,EAAE;YACf,KAAK,MAAM,GAAG,IAAI,WAAW;AAAE,gBAAA,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC;QACnD;aAAO;AACL,YAAA,KAAK,MAAM,GAAG,IAAI,aAAa,CAAC,gBAAgB,EAAE;AAAE,gBAAA,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC;QACxE;IACF;AAEA,IAAA,OAAO,gBAAgB,GAAA;QACrB,OAAO;AACL,YAAA;AACE,gBAAA,EAAE,EAAE,gBAAgB;AACpB,gBAAA,IAAI,EAAE,gBAAgB;AACtB,gBAAA,UAAU,EAAE,UAAU;AACtB,gBAAA,WAAW,EAAE,8CAA8C;AAC5D,aAAA;AACD,YAAA;AACE,gBAAA,EAAE,EAAE,iBAAiB;AACrB,gBAAA,IAAI,EAAE,iBAAiB;AACvB,gBAAA,UAAU,EAAE,WAAW;AACvB,gBAAA,WAAW,EAAE,0CAA0C;AACxD,aAAA;AACD,YAAA;AACE,gBAAA,EAAE,EAAE,cAAc;AAClB,gBAAA,IAAI,EAAE,cAAc;AACpB,gBAAA,UAAU,EAAE,QAAQ;AACpB,gBAAA,WAAW,EAAE,oCAAoC;AAClD,aAAA;AACD,YAAA;AACE,gBAAA,EAAE,EAAE,eAAe;AACnB,gBAAA,IAAI,EAAE,eAAe;AACrB,gBAAA,UAAU,EAAE,SAAS;AACrB,gBAAA,WAAW,EAAE,gCAAgC;AAC9C,aAAA;SACF;IACH;AAEA,IAAA,QAAQ,CAAC,GAAoB,EAAA;QAC3B,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,EAAE,GAAG,CAAC;IACtC;AAEA,IAAA,QAAQ,CAAC,IAAY,EAAA;QACnB,OAAO,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,IAAI,CAAC;IACpC;IAEA,UAAU,GAAA;QACR,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,MAAM,EAAE,CAAC;IAC/C;IAEA,gBAAgB,GAAA;AACd,QAAA,OAAO,IAAI,CAAC,UAAU,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,EAAE,EAAE,EAAE,IAAI,EAAE,UAAU,EAAE,WAAW,EAAE,CAAC,CAAC;IAClH;AACD;;;;"}
|
package/dist/src/agent.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { Task, ExecutionResult, AgentConfig } from './types';
|
|
2
|
-
import type { WorkflowDefinition, WorkflowStage, WorkflowExecutionOptions } from './workflow-types';
|
|
1
|
+
import type { Task, ExecutionResult, AgentConfig } from './types.js';
|
|
2
|
+
import type { WorkflowDefinition, WorkflowStage, WorkflowExecutionOptions } from './workflow-types.js';
|
|
3
3
|
export declare class Agent {
|
|
4
4
|
private workingDirectory;
|
|
5
5
|
private onEvent?;
|
|
@@ -27,7 +27,7 @@ export declare class Agent {
|
|
|
27
27
|
progressToNextStage(taskId: string): Promise<void>;
|
|
28
28
|
run(prompt: string, options?: {
|
|
29
29
|
repositoryPath?: string;
|
|
30
|
-
permissionMode?: import('./types').PermissionMode;
|
|
30
|
+
permissionMode?: import('./types.js').PermissionMode;
|
|
31
31
|
queryOverrides?: Record<string, any>;
|
|
32
32
|
}): Promise<ExecutionResult>;
|
|
33
33
|
fetchTask(taskId: string): Promise<Task>;
|
|
@@ -54,7 +54,7 @@ export declare class Agent {
|
|
|
54
54
|
getTaskExecutionStatus(taskId: string): string | null;
|
|
55
55
|
private emitEvent;
|
|
56
56
|
}
|
|
57
|
-
export { PermissionMode } from './types';
|
|
58
|
-
export type { Task, SupportingFile, ExecutionResult, AgentConfig } from './types';
|
|
59
|
-
export type { WorkflowDefinition, WorkflowStage, WorkflowExecutionOptions } from './workflow-types';
|
|
57
|
+
export { PermissionMode } from './types.js';
|
|
58
|
+
export type { Task, SupportingFile, ExecutionResult, AgentConfig } from './types.js';
|
|
59
|
+
export type { WorkflowDefinition, WorkflowStage, WorkflowExecutionOptions } from './workflow-types.js';
|
|
60
60
|
//# sourceMappingURL=agent.d.ts.map
|
package/dist/src/agent.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent.d.ts","sourceRoot":"","sources":["../../src/agent.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,eAAe,EAAc,WAAW,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"agent.d.ts","sourceRoot":"","sources":["../../src/agent.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,eAAe,EAAc,WAAW,EAAE,MAAM,YAAY,CAAC;AACjF,OAAO,KAAK,EAAE,kBAAkB,EAAE,aAAa,EAAE,wBAA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MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAuBlH,uBAAuB,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAarE,gBAAgB,CAAC,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAczE,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;IAUhC,sBAAsB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI;IAUrD,OAAO,CAAC,SAAS;CAOpB;AAED,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAC5C,YAAY,EAAE,IAAI,EAAE,cAAc,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACrF,YAAY,EAAE,kBAAkB,EAAE,aAAa,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAC"}
|
package/dist/src/agent.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { query } from
|
|
2
|
-
import { TaskManager } from './task-manager';
|
|
3
|
-
import { PostHogAPIClient } from './posthog-api';
|
|
4
|
-
import { PostHogFileManager } from './file-manager';
|
|
5
|
-
import { GitManager } from './git-manager';
|
|
6
|
-
import { TemplateManager } from './template-manager';
|
|
7
|
-
import { EventTransformer } from './event-transformer';
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
1
|
+
import { query } from '@anthropic-ai/claude-agent-sdk';
|
|
2
|
+
import { TaskManager } from './task-manager.js';
|
|
3
|
+
import { PostHogAPIClient } from './posthog-api.js';
|
|
4
|
+
import { PostHogFileManager } from './file-manager.js';
|
|
5
|
+
import { GitManager } from './git-manager.js';
|
|
6
|
+
import { TemplateManager } from './template-manager.js';
|
|
7
|
+
import { EventTransformer } from './event-transformer.js';
|
|
8
|
+
import { Logger } from './utils/logger.js';
|
|
9
|
+
import { AgentRegistry } from './agent-registry.js';
|
|
10
|
+
import { WorkflowRegistry } from './workflow-registry.js';
|
|
11
|
+
import { StageExecutor } from './stage-executor.js';
|
|
12
|
+
import { PromptBuilder } from './prompt-builder.js';
|
|
13
|
+
export { PermissionMode } from './types.js';
|
|
14
|
+
|
|
15
|
+
class Agent {
|
|
16
16
|
workingDirectory;
|
|
17
17
|
onEvent;
|
|
18
18
|
taskManager;
|
|
@@ -367,5 +367,6 @@ Generated by PostHog Agent`;
|
|
|
367
367
|
this.onEvent?.(event);
|
|
368
368
|
}
|
|
369
369
|
}
|
|
370
|
-
|
|
371
|
-
|
|
370
|
+
|
|
371
|
+
export { Agent };
|
|
372
|
+
//# sourceMappingURL=agent.js.map
|
package/dist/src/agent.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent.js","sourceRoot":"","sources":["../../src/agent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,gCAAgC,CAAC;AAGvD,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACxC,OAAO,EAAE,aAAa,EAAE,MAAM,k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,iBAAiB,CAAC,EAAE,CAAC;YACzE,IAAI,SAAS,CAAC,MAAM,KAAK,MAAM,IAAI,SAAS,CAAC,MAAM,KAAK,SAAS,EAAE,CAAC;gBAChE,IAAI,CAAC,WAAW,CAAC,eAAe,CAAC,WAAW,CAAC,CAAC;gBAC9C,MAAM;YACV,CAAC;QACL,CAAC;IACL,CAAC;IAED,sBAAsB,CAAC,MAAc;QACjC,mCAAmC;QACnC,KAAK,MAAM,SAAS,IAAI,IAAI,CAAC,WAAW,CAAC,iBAAiB,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC;YACnE,IAAI,SAAS,CAAC,MAAM,KAAK,MAAM,EAAE,CAAC;gBAC9B,OAAO,SAAS,CAAC,MAAM,CAAC;YAC5B,CAAC;QACL,CAAC;QACD,OAAO,IAAI,CAAC;IAChB,CAAC;IAEO,SAAS,CAAC,KAAU;QACxB,IAAI,IAAI,CAAC,KAAK,IAAI,KAAK,CAAC,IAAI,KAAK,OAAO,EAAE,CAAC;YACvC,6CAA6C;YAC7C,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,gBAAgB,EAAE,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,EAAE,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,CAAC;QAC5E,CAAC;QACD,IAAI,CAAC,OAAO,EAAE,CAAC,KAAK,CAAC,CAAC;IAC1B,CAAC;CACJ;AAED,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC"}
|
|
1
|
+
{"version":3,"file":"agent.js","sources":["../../src/agent.ts"],"sourcesContent":["import { query } from \"@anthropic-ai/claude-agent-sdk\";\nimport type { Task, ExecutionResult, PlanResult, AgentConfig } from './types.js';\nimport type { WorkflowDefinition, WorkflowStage, WorkflowExecutionOptions } from './workflow-types.js';\nimport { TaskManager } from './task-manager.js';\nimport { PostHogAPIClient } from './posthog-api.js';\nimport { PostHogFileManager } from './file-manager.js';\nimport { GitManager } from './git-manager.js';\nimport { TemplateManager } from './template-manager.js';\nimport { EventTransformer } from './event-transformer.js';\nimport { PLANNING_SYSTEM_PROMPT } from './agents/planning.js';\nimport { EXECUTION_SYSTEM_PROMPT } from './agents/execution.js';\nimport { Logger } from './utils/logger.js';\nimport { AgentRegistry } from './agent-registry.js';\nimport { WorkflowRegistry } from './workflow-registry.js';\nimport { StageExecutor } from './stage-executor.js';\nimport { PromptBuilder } from './prompt-builder.js';\n\nexport class Agent {\n private workingDirectory: string;\n private onEvent?: (event: any) => void;\n private taskManager: TaskManager;\n private posthogAPI?: PostHogAPIClient;\n private fileManager: PostHogFileManager;\n private gitManager: GitManager;\n private templateManager: TemplateManager;\n private eventTransformer: EventTransformer;\n private logger: Logger;\n private agentRegistry: AgentRegistry;\n private workflowRegistry: WorkflowRegistry;\n private stageExecutor: StageExecutor;\n public debug: boolean;\n\n constructor(config: AgentConfig = {}) {\n this.workingDirectory = config.workingDirectory || process.cwd();\n this.onEvent = config.onEvent;\n this.debug = config.debug || false;\n this.logger = new Logger({ debug: this.debug, prefix: '[PostHog Agent]' });\n this.taskManager = new TaskManager();\n this.eventTransformer = new EventTransformer();\n\n this.fileManager = new PostHogFileManager(\n this.workingDirectory,\n this.logger.child('FileManager')\n );\n this.gitManager = new GitManager({\n repositoryPath: this.workingDirectory,\n logger: this.logger.child('GitManager')\n // TODO: Add author config from environment or config\n });\n this.templateManager = new TemplateManager();\n this.agentRegistry = new AgentRegistry();\n\n if (config.posthogApiUrl && config.posthogApiKey) {\n this.posthogAPI = new PostHogAPIClient({\n apiUrl: config.posthogApiUrl,\n apiKey: config.posthogApiKey,\n });\n }\n\n this.workflowRegistry = new WorkflowRegistry(this.posthogAPI);\n const promptBuilder = new PromptBuilder({\n getTaskFiles: (taskId: string) => this.getTaskFiles(taskId),\n generatePlanTemplate: (vars) => this.templateManager.generatePlan(vars),\n logger: this.logger.child('PromptBuilder')\n });\n this.stageExecutor = new StageExecutor(this.agentRegistry, this.logger, promptBuilder);\n }\n\n /**\n * Enable or disable debug logging\n */\n setDebug(enabled: boolean) {\n this.debug = enabled;\n this.logger.setDebug(enabled);\n }\n\n // Workflow-based execution\n async runWorkflow(taskOrId: Task | string, workflowId: string, options: WorkflowExecutionOptions = {}): Promise<{ task: Task; workflow: WorkflowDefinition }> {\n const task = typeof taskOrId === 'string' ? await this.fetchTask(taskOrId) : taskOrId;\n await this.workflowRegistry.loadWorkflows();\n const workflow = this.workflowRegistry.getWorkflow(workflowId);\n if (!workflow) {\n throw new Error(`Workflow ${workflowId} not found`);\n }\n\n // Ensure task is assigned to workflow and positioned at first stage\n if (this.posthogAPI) {\n try {\n if ((task.workflow as any) !== workflowId) {\n await this.posthogAPI.updateTask(task.id, { workflow: workflowId } as any);\n (task as any).workflow = workflowId;\n }\n if (!(task as any).current_stage && workflow.stages.length > 0) {\n const firstStage = [...workflow.stages].sort((a, b) => a.position - b.position)[0];\n await this.posthogAPI.updateTaskStage(task.id, firstStage.id);\n (task as any).current_stage = firstStage.id;\n }\n } catch (e) {\n this.logger.warn('Failed to sync task workflow/stage before execution', { error: (e as Error).message });\n }\n }\n\n const executionId = this.taskManager.generateExecutionId();\n this.logger.info('Starting workflow execution', { taskId: task.id, workflowId, executionId });\n this.taskManager.startExecution(task.id, 'plan_and_build', executionId);\n\n try {\n const orderedStages = [...workflow.stages].sort((a, b) => a.position - b.position);\n let startIndex = 0;\n const currentStageId = (task as any).current_stage as string | undefined;\n\n // If task is already at the last stage, fail gracefully without progressing\n if (currentStageId) {\n const currIdx = orderedStages.findIndex(s => s.id === currentStageId);\n const atLastStage = currIdx >= 0 && currIdx === orderedStages.length - 1;\n if (atLastStage) {\n this.emitEvent(this.eventTransformer.createStatusEvent('no_next_stage', { stage: orderedStages[currIdx].key }));\n this.taskManager.completeExecution(executionId, { task, workflow });\n return { task, workflow };\n }\n }\n\n if (options.resumeFromCurrentStage && currentStageId) {\n const idx = orderedStages.findIndex(s => s.id === currentStageId);\n if (idx >= 0) startIndex = idx;\n }\n\n // Align server-side stage when restarting from the beginning\n if (this.posthogAPI) {\n const targetStage = orderedStages[startIndex];\n if (targetStage && targetStage.id !== currentStageId) {\n try { await this.posthogAPI.updateTaskStage(task.id, targetStage.id); (task as any).current_stage = targetStage.id; } catch {}\n }\n }\n\n for (let i = startIndex; i < orderedStages.length; i++) {\n const stage = orderedStages[i];\n await this.executeStage(task, stage, options);\n if (options.autoProgress) {\n const hasNext = i < orderedStages.length - 1;\n if (hasNext) {\n await this.progressToNextStage(task.id);\n }\n }\n }\n this.taskManager.completeExecution(executionId, { task, workflow });\n return { task, workflow };\n } catch (error) {\n this.taskManager.failExecution(executionId, error as Error);\n throw error;\n }\n }\n\n async executeStage(task: Task, stage: WorkflowStage, options: WorkflowExecutionOptions = {}): Promise<void> {\n this.emitEvent(this.eventTransformer.createStatusEvent('stage_start', { stage: stage.key }));\n const overrides = options.stageOverrides?.[stage.key];\n const agentName = stage.agent_name || 'code_generation';\n const agentDef = this.agentRegistry.getAgent(agentName);\n const isManual = stage.is_manual_only === true;\n const stageKeyLower = (stage.key || '').toLowerCase().trim();\n const isPlanningByKey = stageKeyLower === 'plan' || stageKeyLower.includes('plan');\n const isPlanning = !isManual && ((agentDef?.agent_type === 'planning') || isPlanningByKey);\n const shouldCreatePlanningBranch = overrides?.createPlanningBranch !== false; // default true\n const shouldCreateImplBranch = overrides?.createImplementationBranch !== false; // default true\n\n if (isPlanning && shouldCreatePlanningBranch) {\n const planningBranch = await this.createPlanningBranch(task.id);\n await this.updateTaskBranch(task.id, planningBranch);\n this.emitEvent(this.eventTransformer.createStatusEvent('branch_created', { stage: stage.key, branch: planningBranch }));\n } else if (!isPlanning && !isManual && shouldCreateImplBranch) {\n const implBranch = await this.createImplementationBranch(task.id);\n await this.updateTaskBranch(task.id, implBranch);\n this.emitEvent(this.eventTransformer.createStatusEvent('branch_created', { stage: stage.key, branch: implBranch }));\n }\n\n const result = await this.stageExecutor.execute(task, stage, options);\n\n if (result.plan) {\n await this.writePlan(task.id, result.plan);\n await this.commitPlan(task.id, task.title);\n this.emitEvent(this.eventTransformer.createStatusEvent('commit_made', { stage: stage.key, kind: 'plan' }));\n }\n\n if (isManual) {\n const defaultOpenPR = true; // manual stages default to PR for review\n const openPR = overrides?.openPullRequest ?? defaultOpenPR;\n if (openPR) {\n // Ensure we're on an implementation branch for PRs\n let branchName = await this.gitManager.getCurrentBranch();\n const onTaskBranch = branchName.includes(`posthog/task-${task.id}`);\n if (!onTaskBranch && (overrides?.createImplementationBranch !== false)) {\n const implBranch = await this.createImplementationBranch(task.id);\n await this.updateTaskBranch(task.id, implBranch);\n branchName = implBranch;\n this.emitEvent(this.eventTransformer.createStatusEvent('branch_created', { stage: stage.key, branch: implBranch }));\n }\n try {\n const prUrl = await this.createPullRequest(task.id, branchName, task.title, task.description);\n await this.updateTaskBranch(task.id, branchName);\n await this.attachPullRequestToTask(task.id, prUrl);\n this.emitEvent(this.eventTransformer.createStatusEvent('pr_created', { stage: stage.key, prUrl }));\n } catch {}\n }\n // Do not auto-progress on manual stages\n this.emitEvent(this.eventTransformer.createStatusEvent('stage_complete', { stage: stage.key }));\n return;\n }\n\n if (result.results) {\n const existingPlan = await this.readPlan(task.id);\n const planSummary = existingPlan ? existingPlan.split('\\n')[0] : undefined;\n await this.commitImplementation(task.id, task.title, planSummary);\n this.emitEvent(this.eventTransformer.createStatusEvent('commit_made', { stage: stage.key, kind: 'implementation' }));\n }\n\n // PR creation on complete stage (or if explicitly requested), regardless of whether edits occurred\n {\n const defaultOpenPR = stage.key.toLowerCase().includes('complete');\n const openPR = overrides?.openPullRequest ?? defaultOpenPR;\n if (openPR) {\n const branchName = await this.gitManager.getCurrentBranch();\n try {\n const prUrl = await this.createPullRequest(task.id, branchName, task.title, task.description);\n await this.updateTaskBranch(task.id, branchName);\n await this.attachPullRequestToTask(task.id, prUrl);\n this.emitEvent(this.eventTransformer.createStatusEvent('pr_created', { stage: stage.key, prUrl }));\n } catch {}\n }\n }\n\n this.emitEvent(this.eventTransformer.createStatusEvent('stage_complete', { stage: stage.key }));\n }\n\n async progressToNextStage(taskId: string): Promise<void> {\n if (!this.posthogAPI) throw new Error('PostHog API not configured. Cannot progress stage.');\n await this.posthogAPI.progressTask(taskId, { auto: true });\n }\n\n // Direct prompt execution - still supported for low-level usage\n async run(prompt: string, options: { repositoryPath?: string; permissionMode?: import('./types.js').PermissionMode; queryOverrides?: Record<string, any> } = {}): Promise<ExecutionResult> {\n const baseOptions: Record<string, any> = {\n model: \"claude-4-5-sonnet\",\n cwd: options.repositoryPath || this.workingDirectory,\n permissionMode: (options.permissionMode as any) || \"default\",\n settingSources: [\"local\"],\n };\n\n const response = query({\n prompt,\n options: { ...baseOptions, ...(options.queryOverrides || {}) },\n });\n\n const results = [];\n for await (const message of response) {\n this.logger.debug('Received message in direct run', { type: message.type });\n const transformedEvent = this.eventTransformer.transform(message);\n this.onEvent?.(transformedEvent);\n results.push(message);\n }\n \n return { results };\n }\n \n // PostHog task operations\n async fetchTask(taskId: string): Promise<Task> {\n this.logger.debug('Fetching task from PostHog', { taskId });\n if (!this.posthogAPI) {\n const error = new Error('PostHog API not configured. Provide posthogApiUrl and posthogApiKey in constructor.');\n this.logger.error('PostHog API not configured', error);\n throw error;\n }\n return this.posthogAPI.fetchTask(taskId);\n }\n \n async listTasks(filters?: {\n repository?: string;\n organization?: string;\n origin_product?: string;\n workflow?: string;\n current_stage?: string;\n }): Promise<Task[]> {\n if (!this.posthogAPI) {\n throw new Error('PostHog API not configured. Provide posthogApiUrl and posthogApiKey in constructor.');\n }\n return this.posthogAPI.listTasks(filters);\n }\n \n // File system operations for task artifacts\n async writeTaskFile(taskId: string, fileName: string, content: string, type: 'plan' | 'context' | 'reference' | 'output' = 'reference'): Promise<void> {\n this.logger.debug('Writing task file', { taskId, fileName, type, contentLength: content.length });\n await this.fileManager.writeTaskFile(taskId, { name: fileName, content, type });\n }\n \n async readTaskFile(taskId: string, fileName: string): Promise<string | null> {\n this.logger.debug('Reading task file', { taskId, fileName });\n return await this.fileManager.readTaskFile(taskId, fileName);\n }\n \n async getTaskFiles(taskId: string): Promise<any[]> {\n this.logger.debug('Getting task files', { taskId });\n const files = await this.fileManager.getTaskFiles(taskId);\n this.logger.debug('Found task files', { taskId, fileCount: files.length });\n return files;\n }\n \n async writePlan(taskId: string, plan: string): Promise<void> {\n this.logger.info('Writing plan', { taskId, planLength: plan.length });\n await this.fileManager.writePlan(taskId, plan);\n }\n \n async readPlan(taskId: string): Promise<string | null> {\n this.logger.debug('Reading plan', { taskId });\n return await this.fileManager.readPlan(taskId);\n }\n \n // Git operations for task workflow\n async createPlanningBranch(taskId: string): Promise<string> {\n this.logger.info('Creating planning branch', { taskId });\n const branchName = await this.gitManager.createTaskPlanningBranch(taskId);\n this.logger.debug('Planning branch created', { taskId, branchName });\n // Only create gitignore after we're on the new branch\n await this.fileManager.ensureGitignore();\n return branchName;\n }\n \n async commitPlan(taskId: string, taskTitle: string): Promise<string> {\n this.logger.info('Committing plan', { taskId, taskTitle });\n const commitHash = await this.gitManager.commitPlan(taskId, taskTitle);\n this.logger.debug('Plan committed', { taskId, commitHash });\n return commitHash;\n }\n \n async createImplementationBranch(taskId: string, planningBranchName?: string): Promise<string> {\n this.logger.info('Creating implementation branch', { taskId, fromBranch: planningBranchName });\n const branchName = await this.gitManager.createTaskImplementationBranch(taskId, planningBranchName);\n this.logger.debug('Implementation branch created', { taskId, branchName });\n return branchName;\n }\n \n async commitImplementation(taskId: string, taskTitle: string, planSummary?: string): Promise<string> {\n this.logger.info('Committing implementation', { taskId, taskTitle });\n const commitHash = await this.gitManager.commitImplementation(taskId, taskTitle, planSummary);\n this.logger.debug('Implementation committed', { taskId, commitHash });\n return commitHash;\n }\n\n async createPullRequest(taskId: string, branchName: string, taskTitle: string, taskDescription: string): Promise<string> {\n this.logger.info('Creating pull request', { taskId, branchName, taskTitle });\n\n // Build PR body\n const prBody = `## Task Details\n**Task ID**: ${taskId}\n**Description**: ${taskDescription}\n\n## Changes\nThis PR implements the changes described in the task.\n\nGenerated by PostHog Agent`;\n\n const prUrl = await this.gitManager.createPullRequest(\n branchName,\n taskTitle,\n prBody\n );\n\n this.logger.info('Pull request created', { taskId, prUrl });\n return prUrl;\n }\n\n async attachPullRequestToTask(taskId: string, prUrl: string): Promise<void> {\n this.logger.info('Attaching PR to task', { taskId, prUrl });\n\n if (!this.posthogAPI) {\n const error = new Error('PostHog API not configured. Cannot attach PR to task.');\n this.logger.error('PostHog API not configured', error);\n throw error;\n }\n\n await this.posthogAPI.updateTask(taskId, { github_pr_url: prUrl });\n this.logger.debug('PR attached to task', { taskId, prUrl });\n }\n\n async updateTaskBranch(taskId: string, branchName: string): Promise<void> {\n this.logger.info('Updating task branch', { taskId, branchName });\n\n if (!this.posthogAPI) {\n const error = new Error('PostHog API not configured. Cannot update task branch.');\n this.logger.error('PostHog API not configured', error);\n throw error;\n }\n\n await this.posthogAPI.updateTask(taskId, { github_branch: branchName });\n this.logger.debug('Task branch updated', { taskId, branchName });\n }\n\n // Execution management\n cancelTask(taskId: string): void {\n // Find the execution for this task and cancel it\n for (const [executionId, execution] of this.taskManager['executionStates']) {\n if (execution.taskId === taskId && execution.status === 'running') {\n this.taskManager.cancelExecution(executionId);\n break;\n }\n }\n }\n\n getTaskExecutionStatus(taskId: string): string | null {\n // Find the execution for this task\n for (const execution of this.taskManager['executionStates'].values()) {\n if (execution.taskId === taskId) {\n return execution.status;\n }\n }\n return null;\n }\n\n private emitEvent(event: any): void {\n if (this.debug && event.type !== 'token') {\n // Log all events except tokens (too verbose)\n this.logger.debug('Emitting event', { type: event.type, ts: event.ts });\n }\n this.onEvent?.(event);\n }\n}\n\nexport { PermissionMode } from './types.js';\nexport type { Task, SupportingFile, ExecutionResult, AgentConfig } from './types.js';\nexport type { WorkflowDefinition, WorkflowStage, WorkflowExecutionOptions } from './workflow-types.js';\n"],"names":[],"mappings":";;;;;;;;;;;;;;MAiBa,KAAK,CAAA;AACN,IAAA,gBAAgB;AAChB,IAAA,OAAO;AACP,IAAA,WAAW;AACX,IAAA,UAAU;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AI,SAAS,CAAC,MAAM,KAAK,SAAS,EAAE;AAC/D,gBAAA,IAAI,CAAC,WAAW,CAAC,eAAe,CAAC,WAAW,CAAC;gBAC7C;YACJ;QACJ;IACJ;AAEA,IAAA,sBAAsB,CAAC,MAAc,EAAA;;AAEjC,QAAA,KAAK,MAAM,SAAS,IAAI,IAAI,CAAC,WAAW,CAAC,iBAAiB,CAAC,CAAC,MAAM,EAAE,EAAE;AAClE,YAAA,IAAI,SAAS,CAAC,MAAM,KAAK,MAAM,EAAE;gBAC7B,OAAO,SAAS,CAAC,MAAM;YAC3B;QACJ;AACA,QAAA,OAAO,IAAI;IACf;AAEQ,IAAA,SAAS,CAAC,KAAU,EAAA;QACxB,IAAI,IAAI,CAAC,KAAK,IAAI,KAAK,CAAC,IAAI,KAAK,OAAO,EAAE;;YAEtC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,gBAAgB,EAAE,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,EAAE,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC;QAC3E;AACA,QAAA,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC;IACzB;AACH;;;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
const EXECUTION_SYSTEM_PROMPT = `<context>
|
|
2
2
|
You have access to the local repository files for fast read/write operations.
|
|
3
3
|
You also have access to GitHub via the GitHub MCP server for additional repository operations.
|
|
4
4
|
Work with local files for your main implementation, and use GitHub MCP for any additional repository queries.
|
|
@@ -51,4 +51,6 @@ export const EXECUTION_SYSTEM_PROMPT = `<context>
|
|
|
51
51
|
<task>
|
|
52
52
|
Complete the ticket in a thoughtful step by step manner. Plan thoroughly and make sure to add logging and error handling as well as cover edge cases.
|
|
53
53
|
</task>`;
|
|
54
|
-
|
|
54
|
+
|
|
55
|
+
export { EXECUTION_SYSTEM_PROMPT };
|
|
56
|
+
//# sourceMappingURL=execution.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"execution.js","
|
|
1
|
+
{"version":3,"file":"execution.js","sources":["../../../src/agents/execution.ts"],"sourcesContent":["export const EXECUTION_SYSTEM_PROMPT = `<context>\n You have access to the local repository files for fast read/write operations.\n You also have access to GitHub via the GitHub MCP server for additional repository operations.\n Work with local files for your main implementation, and use GitHub MCP for any additional repository queries.\n Commit changes to the repository regularly.\n</context>\n\n<role>\n PostHog AI Coding Agent — autonomously transform a ticket into a merge-ready pull request that follows existing project conventions.\n</role>\n\n<tools>\n Local file system (for main implementation work)\n PostHog MCP server (for PostHog operations)\n</tools>\n\n<constraints>\n - Follow existing style and patterns you discover in the repo.\n - Try not to add new external dependencies, only if needed.\n - Implement structured logging and error handling; never log secrets.\n - Avoid destructive shell commands.\n - ALWAYS create appropriate .gitignore files to exclude build artifacts, dependencies, and temporary files.\n</constraints>\n\n<checklist>\n - Created or updated .gitignore file with appropriate exclusions\n - Created dependency files (requirements.txt, package.json, etc.) with exact versions\n - Added clear setup/installation instructions to README.md\n - Code compiles and tests pass.\n - Added or updated tests.\n - Captured meaningful events with PostHog SDK.\n - Wrapped new logic in an PostHog feature flag.\n - Updated docs, readme or type hints if needed.\n - Verified no build artifacts or dependencies are being committed\n</checklist>\n\n<workflow>\n- first make a plan and create a todo list\n- execute the todo list one by one\n- test the changes\n</workflow>\n\n<output_format>\n Once finished respond with a summary of changes made\n</output_format>\n\n<thinking>\n Use this area as a private scratch-pad for step-by-step reasoning; erase before final output.\n</thinking>\n\n<task>\n Complete the ticket in a thoughtful step by step manner. Plan thoroughly and make sure to add logging and error handling as well as cover edge cases.\n</task>`;"],"names":[],"mappings":"AAAO,MAAM,uBAAuB,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
const PLANNING_SYSTEM_PROMPT = `# PostHog AI Coding Agent - Planning Mode
|
|
2
2
|
|
|
3
3
|
You are a PostHog AI Coding Agent operating in PLANNING mode.
|
|
4
4
|
|
|
@@ -65,4 +65,6 @@ If supporting files are provided, incorporate them into your analysis:
|
|
|
65
65
|
- **Previous plans**: Build upon or refine existing planning work
|
|
66
66
|
|
|
67
67
|
Your planning should be thorough enough that another agent in execution mode can implement the changes successfully.`;
|
|
68
|
-
|
|
68
|
+
|
|
69
|
+
export { PLANNING_SYSTEM_PROMPT };
|
|
70
|
+
//# sourceMappingURL=planning.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"planning.js","
|
|
1
|
+
{"version":3,"file":"planning.js","sources":["../../../src/agents/planning.ts"],"sourcesContent":["export const PLANNING_SYSTEM_PROMPT = `# PostHog AI Coding Agent - Planning Mode\n\nYou are a PostHog AI Coding Agent operating in PLANNING mode.\n\n## Your Role\n\nYou are a specialized planning agent that analyzes codebases and creates detailed implementation plans for development tasks.\n\n## Important Constraints\n\n- **Read-Only Mode**: You can only read files, search code, and analyze the codebase\n- **No Modifications**: You cannot make any changes, edits, or execute commands\n- **Research Focus**: Your goal is understanding and planning, not implementation\n\n## Available Tools\n\n- File reading and exploration\n- Code search and analysis\n- Repository structure analysis\n- Documentation review\n\n## Planning Process\n\nWhen given a task, follow this systematic approach:\n\n1. **Codebase Analysis**\n - Explore the repository structure\n - Identify relevant files and components\n - Understand existing patterns and conventions\n - Review related code and dependencies\n\n2. **Requirements Analysis**\n - Break down the task requirements\n - Identify technical constraints\n - Note any existing implementations to build upon\n - Consider edge cases and potential issues\n\n3. **Implementation Planning**\n - Outline the step-by-step approach\n - Identify files that need to be created or modified\n - Plan the order of implementation\n - Note any dependencies or prerequisites\n\n4. **Documentation**\n - Create a clear, actionable plan\n - Include specific file paths and changes needed\n - Note any testing requirements\n - Highlight potential risks or considerations\n\n## Plan Output\n\nWhen you have completed your analysis, use the \\`exit_plan_mode\\` tool to present your plan. Your plan should include:\n\n- **Summary**: Brief overview of the implementation approach\n- **Files to Create/Modify**: Specific paths and purposes\n- **Implementation Steps**: Ordered list of actions to take\n- **Considerations**: Dependencies, risks, and important notes\n- **Testing Strategy**: How to verify the implementation works\n\n## Context Integration\n\nIf supporting files are provided, incorporate them into your analysis:\n- **Context files**: Additional requirements or constraints\n- **Reference files**: Examples or documentation to follow\n- **Previous plans**: Build upon or refine existing planning work\n\nYour planning should be thorough enough that another agent in execution mode can implement the changes successfully.`;"],"names":[],"mappings":"AAAO,MAAM,sBAAsB,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
class EventTransformer {
|
|
2
2
|
transform(sdkMessage) {
|
|
3
3
|
const baseEvent = { ts: Date.now() };
|
|
4
4
|
// Handle stream events
|
|
@@ -171,4 +171,6 @@ export class EventTransformer {
|
|
|
171
171
|
};
|
|
172
172
|
}
|
|
173
173
|
}
|
|
174
|
-
|
|
174
|
+
|
|
175
|
+
export { EventTransformer };
|
|
176
|
+
//# sourceMappingURL=event-transformer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"event-transformer.js","
|
|
1
|
+
{"version":3,"file":"event-transformer.js","sources":["../../src/event-transformer.ts"],"sourcesContent":["import type { AgentEvent } from './types.js';\nimport type { SDKMessage } from '@anthropic-ai/claude-agent-sdk';\n\nexport class EventTransformer {\n transform(sdkMessage: SDKMessage): AgentEvent | null {\n const baseEvent = { ts: Date.now() };\n\n // Handle stream events\n if (sdkMessage.type === 'stream_event') {\n const event = sdkMessage.event;\n\n switch (event.type) {\n case 'message_start':\n return {\n ...baseEvent,\n type: 'message_start',\n messageId: event.message?.id,\n model: event.message?.model\n };\n\n case 'content_block_start':\n const contentBlock = event.content_block;\n if (!contentBlock) return null;\n\n return {\n ...baseEvent,\n type: 'content_block_start',\n index: event.index,\n contentType: contentBlock.type as 'text' | 'tool_use' | 'thinking',\n toolName: contentBlock.type === 'tool_use' ? contentBlock.name : undefined,\n toolId: contentBlock.type === 'tool_use' ? contentBlock.id : undefined\n };\n\n case 'content_block_delta':\n const delta = event.delta;\n if (!delta) return null;\n\n if (delta.type === 'text_delta') {\n return {\n ...baseEvent,\n type: 'token',\n content: delta.text,\n contentType: 'text'\n };\n } else if (delta.type === 'input_json_delta') {\n return {\n ...baseEvent,\n type: 'token',\n content: delta.partial_json,\n contentType: 'tool_input'\n };\n } else if (delta.type === 'thinking_delta') {\n return {\n ...baseEvent,\n type: 'token',\n content: delta.thinking,\n contentType: 'thinking'\n };\n }\n return null;\n\n case 'content_block_stop':\n return {\n ...baseEvent,\n type: 'content_block_stop',\n index: event.index\n };\n\n case 'message_delta':\n return {\n ...baseEvent,\n type: 'message_delta',\n stopReason: event.delta?.stop_reason,\n stopSequence: event.delta?.stop_sequence,\n usage: event.usage ? {\n outputTokens: event.usage.output_tokens\n } : undefined\n };\n\n case 'message_stop':\n return {\n ...baseEvent,\n type: 'message_stop'\n };\n\n case 'ping':\n // Ignore ping events\n return null;\n\n case 'error':\n return {\n ...baseEvent,\n type: 'error',\n message: event.error?.message || 'Unknown error',\n error: event.error,\n errorType: event.error?.type\n };\n\n default:\n return null;\n }\n }\n\n // Handle assistant messages (full message, not streaming)\n if (sdkMessage.type === 'assistant') {\n // Extract tool calls from assistant message\n const message = sdkMessage.message;\n // We could emit individual tool_call events here if needed\n // For now, just emit a status event\n return {\n ...baseEvent,\n type: 'status',\n phase: 'assistant_message',\n messageId: message.id,\n model: message.model\n };\n }\n\n // Handle user messages\n if (sdkMessage.type === 'user') {\n const content = sdkMessage.message.content;\n const textContent = Array.isArray(content)\n ? content.find(c => c.type === 'text')?.text\n : typeof content === 'string' ? content : '';\n\n return {\n ...baseEvent,\n type: 'user_message',\n content: textContent || '',\n isSynthetic: sdkMessage.isSynthetic\n };\n }\n\n // Handle result messages\n if (sdkMessage.type === 'result') {\n if (sdkMessage.subtype === 'success') {\n return {\n ...baseEvent,\n type: 'done',\n durationMs: sdkMessage.duration_ms,\n numTurns: sdkMessage.num_turns,\n totalCostUsd: sdkMessage.total_cost_usd,\n usage: sdkMessage.usage\n };\n } else {\n return {\n ...baseEvent,\n type: 'error',\n message: `Execution failed: ${sdkMessage.subtype}`,\n error: { subtype: sdkMessage.subtype },\n errorType: sdkMessage.subtype\n };\n }\n }\n\n // Handle system messages\n if (sdkMessage.type === 'system') {\n if (sdkMessage.subtype === 'init') {\n return {\n ...baseEvent,\n type: 'init',\n model: sdkMessage.model,\n tools: sdkMessage.tools,\n permissionMode: sdkMessage.permissionMode,\n cwd: sdkMessage.cwd,\n apiKeySource: sdkMessage.apiKeySource\n };\n } else if (sdkMessage.subtype === 'compact_boundary') {\n return {\n ...baseEvent,\n type: 'compact_boundary',\n trigger: sdkMessage.compact_metadata.trigger,\n preTokens: sdkMessage.compact_metadata.pre_tokens\n };\n }\n }\n\n return null;\n }\n \n createStatusEvent(phase: string, additionalData?: any): AgentEvent {\n return {\n type: 'status',\n ts: Date.now(),\n phase,\n ...additionalData\n };\n }\n}"],"names":[],"mappings":"MAGa,gBAAgB,CAAA;AAC3B,IAAA,SAAS,CAAC,UAAsB,EAAA;QAC9B,MAAM,SAAS,GAAG,EAAE,EAAE,EAAE,IAAI,CAAC,GAAG,EAAE,EAAE;;AAGpC,QAAA,IAAI,UAAU,CAAC,IAAI,KAAK,cAAc,EAAE;AACtC,YAAA,MAAM,KAAK,GAAG,UAAU,CAAC,KAAK;AAE9B,YAAA,QAAQ,KAAK,CAAC,IAAI;AAChB,gBAAA,KAAK,eAAe;oBAClB,OAAO;AACL,wBAAA,GAAG,SAAS;AACZ,wBAAA,IAAI,EAAE,eAAe;AACrB,wBAAA,SAAS,EAAE,KAAK,CAAC,OAAO,EAAE,EAAE;AAC5B,wBAAA,KAAK,EAAE,KAAK,CAAC,OAAO,EAAE;qBACvB;AAEH,gBAAA,KAAK,qBAAqB;AACxB,oBAAA,MAAM,YAAY,GAAG,KAAK,CAAC,aAAa;AACxC,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AE,UAAU,CAAC,cAAc;oBACzC,GAAG,EAAE,UAAU,CAAC,GAAG;oBACnB,YAAY,EAAE,UAAU,CAAC;iBAC1B;YACH;AAAO,iBAAA,IAAI,UAAU,CAAC,OAAO,KAAK,kBAAkB,EAAE;gBACpD,OAAO;AACL,oBAAA,GAAG,SAAS;AACZ,oBAAA,IAAI,EAAE,kBAAkB;AACxB,oBAAA,OAAO,EAAE,UAAU,CAAC,gBAAgB,CAAC,OAAO;AAC5C,oBAAA,SAAS,EAAE,UAAU,CAAC,gBAAgB,CAAC;iBACxC;YACH;QACF;AAEA,QAAA,OAAO,IAAI;IACb;IAEA,iBAAiB,CAAC,KAAa,EAAE,cAAoB,EAAA;QACnD,OAAO;AACL,YAAA,IAAI,EAAE,QAAQ;AACd,YAAA,EAAE,EAAE,IAAI,CAAC,GAAG,EAAE;YACd,KAAK;AACL,YAAA,GAAG;SACJ;IACH;AACD;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"file-manager.d.ts","sourceRoot":"","sources":["../../src/file-manager.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"file-manager.d.ts","sourceRoot":"","sources":["../../src/file-manager.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAE3C,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,WAAW,GAAG,QAAQ,GAAG,UAAU,CAAC;CAChE;AAED,qBAAa,kBAAkB;IAC7B,OAAO,CAAC,cAAc,CAAS;IAC/B,OAAO,CAAC,MAAM,CAAS;gBAEX,cAAc,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM;IAKnD,OAAO,CAAC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AAI,CAAC;CAuBvC"}
|
package/dist/src/file-manager.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { promises
|
|
1
|
+
import { promises } from 'fs';
|
|
2
2
|
import { join, dirname } from 'path';
|
|
3
|
-
import { Logger } from './utils/logger';
|
|
4
|
-
|
|
3
|
+
import { Logger } from './utils/logger.js';
|
|
4
|
+
|
|
5
|
+
class PostHogFileManager {
|
|
5
6
|
repositoryPath;
|
|
6
7
|
logger;
|
|
7
8
|
constructor(repositoryPath, logger) {
|
|
@@ -17,10 +18,10 @@ export class PostHogFileManager {
|
|
|
17
18
|
async ensureTaskDirectory(taskId) {
|
|
18
19
|
const taskDir = this.getTaskDirectory(taskId);
|
|
19
20
|
try {
|
|
20
|
-
await
|
|
21
|
+
await promises.access(taskDir);
|
|
21
22
|
}
|
|
22
23
|
catch {
|
|
23
|
-
await
|
|
24
|
+
await promises.mkdir(taskDir, { recursive: true });
|
|
24
25
|
}
|
|
25
26
|
}
|
|
26
27
|
async writeTaskFile(taskId, file) {
|
|
@@ -31,13 +32,13 @@ export class PostHogFileManager {
|
|
|
31
32
|
contentLength: file.content.length,
|
|
32
33
|
contentType: typeof file.content
|
|
33
34
|
});
|
|
34
|
-
await
|
|
35
|
+
await promises.writeFile(filePath, file.content, 'utf8');
|
|
35
36
|
this.logger.debug('File written successfully', { filePath });
|
|
36
37
|
}
|
|
37
38
|
async readTaskFile(taskId, fileName) {
|
|
38
39
|
try {
|
|
39
40
|
const filePath = this.getTaskFilePath(taskId, fileName);
|
|
40
|
-
return await
|
|
41
|
+
return await promises.readFile(filePath, 'utf8');
|
|
41
42
|
}
|
|
42
43
|
catch (error) {
|
|
43
44
|
if (error.code === 'ENOENT') {
|
|
@@ -49,7 +50,7 @@ export class PostHogFileManager {
|
|
|
49
50
|
async listTaskFiles(taskId) {
|
|
50
51
|
try {
|
|
51
52
|
const taskDir = this.getTaskDirectory(taskId);
|
|
52
|
-
const files = await
|
|
53
|
+
const files = await promises.readdir(taskDir);
|
|
53
54
|
return files.filter(file => !file.startsWith('.'));
|
|
54
55
|
}
|
|
55
56
|
catch (error) {
|
|
@@ -62,7 +63,7 @@ export class PostHogFileManager {
|
|
|
62
63
|
async deleteTaskFile(taskId, fileName) {
|
|
63
64
|
try {
|
|
64
65
|
const filePath = this.getTaskFilePath(taskId, fileName);
|
|
65
|
-
await
|
|
66
|
+
await promises.unlink(filePath);
|
|
66
67
|
}
|
|
67
68
|
catch (error) {
|
|
68
69
|
if (error.code !== 'ENOENT') {
|
|
@@ -73,7 +74,7 @@ export class PostHogFileManager {
|
|
|
73
74
|
async taskDirectoryExists(taskId) {
|
|
74
75
|
try {
|
|
75
76
|
const taskDir = this.getTaskDirectory(taskId);
|
|
76
|
-
await
|
|
77
|
+
await promises.access(taskDir);
|
|
77
78
|
return true;
|
|
78
79
|
}
|
|
79
80
|
catch {
|
|
@@ -83,7 +84,7 @@ export class PostHogFileManager {
|
|
|
83
84
|
async cleanupTaskDirectory(taskId) {
|
|
84
85
|
try {
|
|
85
86
|
const taskDir = this.getTaskDirectory(taskId);
|
|
86
|
-
await
|
|
87
|
+
await promises.rm(taskDir, { recursive: true, force: true });
|
|
87
88
|
}
|
|
88
89
|
catch (error) {
|
|
89
90
|
if (error.code !== 'ENOENT') {
|
|
@@ -170,12 +171,14 @@ export class PostHogFileManager {
|
|
|
170
171
|
!*/README.md
|
|
171
172
|
`;
|
|
172
173
|
try {
|
|
173
|
-
await
|
|
174
|
+
await promises.access(gitignorePath);
|
|
174
175
|
}
|
|
175
176
|
catch {
|
|
176
|
-
await
|
|
177
|
-
await
|
|
177
|
+
await promises.mkdir(dirname(gitignorePath), { recursive: true });
|
|
178
|
+
await promises.writeFile(gitignorePath, gitignoreContent, 'utf8');
|
|
178
179
|
}
|
|
179
180
|
}
|
|
180
181
|
}
|
|
181
|
-
|
|
182
|
+
|
|
183
|
+
export { PostHogFileManager };
|
|
184
|
+
//# sourceMappingURL=file-manager.js.map
|
|
@@ -1 +1 @@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,MAAM,CAAC,CAAC;QAC9D,CAAC;IACH,CAAC;CACF"}
|
|
1
|
+
{"version":3,"file":"file-manager.js","sources":["../../src/file-manager.ts"],"sourcesContent":["import { promises as fs } from 'fs';\nimport { join, dirname } from 'path';\nimport type { SupportingFile } from './types.js';\nimport { Logger } from './utils/logger.js';\n\nexport interface TaskFile {\n name: string;\n content: string;\n type: 'plan' | 'context' | 'reference' | 'output' | 'artifact';\n}\n\nexport class PostHogFileManager {\n private repositoryPath: string;\n private logger: Logger;\n\n constructor(repositoryPath: string, logger?: Logger) {\n this.repositoryPath = repositoryPath;\n this.logger = logger || new Logger({ debug: false, prefix: '[FileManager]' });\n }\n\n private getTaskDirectory(taskId: string): string {\n return join(this.repositoryPath, '.posthog', taskId);\n }\n\n private getTaskFilePath(taskId: string, fileName: string): string {\n return join(this.getTaskDirectory(taskId), fileName);\n }\n\n async ensureTaskDirectory(taskId: string): Promise<void> {\n const taskDir = this.getTaskDirectory(taskId);\n try {\n await fs.access(taskDir);\n } catch {\n await fs.mkdir(taskDir, { recursive: true });\n }\n }\n\n async writeTaskFile(taskId: string, file: TaskFile): Promise<void> {\n await this.ensureTaskDirectory(taskId);\n const filePath = this.getTaskFilePath(taskId, file.name);\n\n this.logger.debug('Writing task file', {\n filePath,\n contentLength: file.content.length,\n contentType: typeof file.content\n });\n\n await fs.writeFile(filePath, file.content, 'utf8');\n\n this.logger.debug('File written successfully', { filePath });\n }\n\n async readTaskFile(taskId: string, fileName: string): Promise<string | null> {\n try {\n const filePath = this.getTaskFilePath(taskId, fileName);\n return await fs.readFile(filePath, 'utf8');\n } catch (error) {\n if ((error as NodeJS.ErrnoException).code === 'ENOENT') {\n return null;\n }\n throw error;\n }\n }\n\n async listTaskFiles(taskId: string): Promise<string[]> {\n try {\n const taskDir = this.getTaskDirectory(taskId);\n const files = await fs.readdir(taskDir);\n return files.filter(file => !file.startsWith('.'));\n } catch (error) {\n if ((error as NodeJS.ErrnoException).code === 'ENOENT') {\n return [];\n }\n throw error;\n }\n }\n\n async deleteTaskFile(taskId: string, fileName: string): Promise<void> {\n try {\n const filePath = this.getTaskFilePath(taskId, fileName);\n await fs.unlink(filePath);\n } catch (error) {\n if ((error as NodeJS.ErrnoException).code !== 'ENOENT') {\n throw error;\n }\n }\n }\n\n async taskDirectoryExists(taskId: string): Promise<boolean> {\n try {\n const taskDir = this.getTaskDirectory(taskId);\n await fs.access(taskDir);\n return true;\n } catch {\n return false;\n }\n }\n\n async cleanupTaskDirectory(taskId: string): Promise<void> {\n try {\n const taskDir = this.getTaskDirectory(taskId);\n await fs.rm(taskDir, { recursive: true, force: true });\n } catch (error) {\n if ((error as NodeJS.ErrnoException).code !== 'ENOENT') {\n throw error;\n }\n }\n }\n\n // Convenience methods for common file types\n async writePlan(taskId: string, plan: string): Promise<void> {\n this.logger.debug('Writing plan', {\n taskId,\n planLength: plan.length,\n contentPreview: plan.substring(0, 200)\n });\n\n await this.writeTaskFile(taskId, {\n name: 'plan.md',\n content: plan,\n type: 'plan'\n });\n\n this.logger.info('Plan file written', { taskId });\n }\n\n async readPlan(taskId: string): Promise<string | null> {\n return await this.readTaskFile(taskId, 'plan.md');\n }\n\n async writeContext(taskId: string, context: string): Promise<void> {\n await this.writeTaskFile(taskId, {\n name: 'context.md',\n content: context,\n type: 'context'\n });\n }\n\n async readContext(taskId: string): Promise<string | null> {\n return await this.readTaskFile(taskId, 'context.md');\n }\n\n async writeRequirements(taskId: string, requirements: string): Promise<void> {\n await this.writeTaskFile(taskId, {\n name: 'requirements.md',\n content: requirements,\n type: 'reference'\n });\n }\n\n async readRequirements(taskId: string): Promise<string | null> {\n return await this.readTaskFile(taskId, 'requirements.md');\n }\n\n async getTaskFiles(taskId: string): Promise<SupportingFile[]> {\n const fileNames = await this.listTaskFiles(taskId);\n const files: SupportingFile[] = [];\n \n for (const fileName of fileNames) {\n const content = await this.readTaskFile(taskId, fileName);\n if (content !== null) {\n // Determine type based on file name\n let type: SupportingFile['type'] = 'reference';\n if (fileName === 'plan.md') type = 'plan';\n else if (fileName === 'context.md') type = 'context';\n else if (fileName === 'requirements.md') type = 'reference';\n else if (fileName.startsWith('output_')) type = 'output';\n \n files.push({\n name: fileName,\n content,\n type,\n created_at: new Date().toISOString() // Could be enhanced with file stats\n });\n }\n }\n \n return files;\n }\n\n async ensureGitignore(): Promise<void> {\n const gitignorePath = join(this.repositoryPath, '.posthog', '.gitignore');\n const gitignoreContent = `# PostHog task artifacts - customize as needed\n# Exclude temporary files\n*/temp/\n*/cache/\n*/.env\n*/.secrets\n\n# Include plans and documentation by default\n!*/plan.md\n!*/context.md\n!*/requirements.md\n!*/README.md\n`;\n\n try {\n await fs.access(gitignorePath);\n } catch {\n await fs.mkdir(dirname(gitignorePath), { recursive: true });\n await fs.writeFile(gitignorePath, gitignoreContent, 'utf8');\n }\n }\n}\n"],"names":["fs"],"mappings":";;;;MAWa,kBAAkB,CAAA;AACrB,IAAA,cAAc;AACd,IAAA,MAAM;IAEd,WAAA,CAAY,cAAsB,EAAE,MAAe,EAAA;AACjD,QAAA,IAAI,CAAC,cAAc,GAAG,cAAc;AACpC,QAAA,IAAI,CAAC,MAAM,GAAG,MAAM,IAAI,IAAI,MAAM,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,eAAe,EAAE,CAAC;IAC/E;AAEQ,IAAA,gBAAgB,CAAC,MAAc,EAAA;QACrC,OAAO,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,UAAU,EAAE,MAAM,CAAC;IACtD;IAEQ,eAAe,CAAC,MAAc,EAAE,QAAgB,EAAA;QACtD,OAAO,IAAI,CAAC,IAAI,CAAC,gBAAgB,CAAC,MAAM,CAAC,EAAE,QAAQ,CAAC;IACtD;IAEA,MAAM,mBAAmB,CAAC,MAAc,EAAA;QACtC,MAAM,OAAO,GAAG,IAAI,CAAC,gBAAgB,CAAC,MAAM,CAAC;AAC7C,QAAA,IAAI;AACF,YAAA,MAAMA,QAAE,CAAC,MAAM,CAAC,OAAO,CA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C,aAAa,EAAE,gBAAgB,EAAE,MAAM,CAAC;QAC7D;IACF;AACD;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"git-manager.d.ts","sourceRoot":"","sources":["../../src/git-manager.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"git-manager.d.ts","sourceRoot":"","sources":["../../src/git-manager.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAI3C,MAAM,WAAW,SAAS;IACxB,cAAc,EAAE,MAAM,CAAC;IACvB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,OAAO,CAAC;IAChB,eAAe,EAAE,OAAO,CAAC;CAC1B;AAED,qBAAa,UAAU;IACrB,OAAO,CAAC,cAAc,CAAS;IAC/B,OAAO,CAAC,UAAU,CAAC,CAAS;IAC5B,OAAO,CAAC,WAAW,CAAC,CAAS;IAC7B,OAAO,CAAC,MAAM,CAAS;gBAEX,MAAM,EAAE,SAAS;YAOf,aAAa;YASb,UAAU;IASlB,eAAe,IAAI,OAAO,CAAC,OAAO,CAAC;IASnC,gBAAgB,IAAI,OAAO,CAAC,MAAM,CAAC;IAInC,gBAAgB,IAAI,OAAO,CAAC,MAAM,CAAC;IAiBnC,YAAY,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IASlD,YAAY,CAAC,UAAU,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAKpE,cAAc,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAIjD,sBAAsB,CAAC,UAAU,EAAE,MAAM,EA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AWtD,YAAY,CAAC,GAAG,GAAE,MAAe,GAAG,OAAO,CAAC,MAAM,CAAC;IAInD,gBAAgB,CAAC,GAAG,GAAE,MAAe,GAAG,OAAO,CAAC,MAAM,CAAC;IAIvD,iBAAiB,CACrB,UAAU,EAAE,MAAM,EAClB,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,MAAM,EACZ,UAAU,CAAC,EAAE,MAAM,GAClB,OAAO,CAAC,MAAM,CAAC;CAqBnB"}
|
package/dist/src/git-manager.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { exec } from 'child_process';
|
|
2
2
|
import { promisify } from 'util';
|
|
3
|
-
import { Logger } from './utils/logger';
|
|
3
|
+
import { Logger } from './utils/logger.js';
|
|
4
|
+
|
|
4
5
|
const execAsync = promisify(exec);
|
|
5
|
-
|
|
6
|
+
class GitManager {
|
|
6
7
|
repositoryPath;
|
|
7
8
|
authorName;
|
|
8
9
|
authorEmail;
|
|
@@ -275,4 +276,6 @@ Generated by PostHog Agent`;
|
|
|
275
276
|
}
|
|
276
277
|
}
|
|
277
278
|
}
|
|
278
|
-
|
|
279
|
+
|
|
280
|
+
export { GitManager };
|
|
281
|
+
//# sourceMappingURL=git-manager.js.map
|