@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
package/CLAUDE.md
ADDED
|
@@ -0,0 +1,296 @@
|
|
|
1
|
+
# CLAUDE.md
|
|
2
|
+
|
|
3
|
+
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
This is a TypeScript-based agent framework that wraps the Anthropic Claude Agent SDK, providing plan-and-execute capabilities for PostHog's Array desktop app and future backend services. It uses a Git-based workflow with file system storage for task artifacts. The project uses Bun runtime for execution.
|
|
8
|
+
|
|
9
|
+
## Essential Commands
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
# Install dependencies
|
|
13
|
+
bun install
|
|
14
|
+
|
|
15
|
+
# Run example usage (demonstrates all features)
|
|
16
|
+
bun run example-usage.ts
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Note: No test, lint, or build scripts are currently defined in package.json.
|
|
20
|
+
|
|
21
|
+
## Architecture
|
|
22
|
+
|
|
23
|
+
### Core Components
|
|
24
|
+
|
|
25
|
+
1. **Agent Class** (`src/agent.ts`):
|
|
26
|
+
- Main interface to Claude API using `@anthropic-ai/claude-agent-sdk`
|
|
27
|
+
- Supports three execution modes: PLAN_AND_BUILD, PLAN_ONLY, BUILD_ONLY
|
|
28
|
+
- Git-based workflow with branch creation and commits
|
|
29
|
+
- Event streaming with Array-compatible event format
|
|
30
|
+
- Default model: claude-4-5-sonnet
|
|
31
|
+
|
|
32
|
+
2. **PostHog API Client** (`src/posthog-api.ts`):
|
|
33
|
+
- Fetches existing tasks from PostHog Django backend
|
|
34
|
+
- Authenticates using API keys and team resolution
|
|
35
|
+
- Does not create tasks - only reads existing ones
|
|
36
|
+
|
|
37
|
+
3. **File Manager** (`src/file-manager.ts`):
|
|
38
|
+
- Manages .posthog/{taskId}/ folder structure
|
|
39
|
+
- Stores plans, context files, and supporting documents
|
|
40
|
+
- Handles gitignore configuration for PostHog folders
|
|
41
|
+
|
|
42
|
+
4. **Git Manager** (`src/git-manager.ts`):
|
|
43
|
+
- Creates task-specific branches for planning and implementation
|
|
44
|
+
- Commits plans and implementations with descriptive messages
|
|
45
|
+
- Branch naming: posthog/task-{id}-planning, posthog/task-{id}-implementation
|
|
46
|
+
|
|
47
|
+
5. **Template Manager** (`src/template-manager.ts`):
|
|
48
|
+
- Generates standardized plan and context files from templates
|
|
49
|
+
- Supports variable substitution in markdown templates
|
|
50
|
+
- Creates consistent .posthog/ folder structures
|
|
51
|
+
|
|
52
|
+
6. **Task Manager** (`src/task-manager.ts`):
|
|
53
|
+
- Tracks execution state (running, completed, failed, canceled)
|
|
54
|
+
- Manages timeouts and cancellation
|
|
55
|
+
- Does not store task data - only execution state
|
|
56
|
+
|
|
57
|
+
3. **Event System** (`src/event-transformer.ts`):
|
|
58
|
+
- Maps Claude SDK events to Array's expected format
|
|
59
|
+
- Supports: token, status, tool_call, tool_result, diff, file_write, metric, artifact, error, done
|
|
60
|
+
|
|
61
|
+
4. **System Prompts** (`src/agents/` directory):
|
|
62
|
+
- `planning.ts`: System prompt for planning mode (read-only analysis)
|
|
63
|
+
- `execution.ts`: System prompt for execution mode (implementation)
|
|
64
|
+
- `ENGINEER.md`: Legacy prompt template (kept for reference)
|
|
65
|
+
|
|
66
|
+
5. **Entry Point** (`index.ts`):
|
|
67
|
+
- Re-exports all public APIs from src
|
|
68
|
+
- Clean import interface for consumers
|
|
69
|
+
|
|
70
|
+
### Key Patterns
|
|
71
|
+
|
|
72
|
+
- **Git-Based Workflow**: Plans and implementations are committed to separate branches
|
|
73
|
+
- **Plan-and-Execute Workflow**: Planning phase generates plans stored in .posthog/ folders
|
|
74
|
+
- **File System Storage**: Task artifacts stored in .posthog/{taskId}/ directories
|
|
75
|
+
- **PostHog Integration**: Fetches existing tasks from PostHog API, doesn't create new ones
|
|
76
|
+
- **Event Streaming**: Real-time event streaming compatible with Array app
|
|
77
|
+
- **Permission Modes**: Support for plan, default, acceptEdits, bypassPermissions
|
|
78
|
+
|
|
79
|
+
### Project Structure
|
|
80
|
+
|
|
81
|
+
```
|
|
82
|
+
/
|
|
83
|
+
├── example-usage.ts # Comprehensive usage examples
|
|
84
|
+
├── tsconfig.json # TypeScript configuration
|
|
85
|
+
└── src/ # Source code
|
|
86
|
+
├── agent.ts # Main Agent class
|
|
87
|
+
├── types.ts # TypeScript interfaces and enums
|
|
88
|
+
├── posthog-api.ts # PostHog API client
|
|
89
|
+
├── file-manager.ts # .posthog/ folder management
|
|
90
|
+
├── git-manager.ts # Git operations and branch management
|
|
91
|
+
├── template-manager.ts # Plan and context templates
|
|
92
|
+
├── task-manager.ts # Execution state tracking
|
|
93
|
+
├── event-transformer.ts # Event mapping logic
|
|
94
|
+
├── agents/ # System prompts
|
|
95
|
+
│ ├── planning.ts # Planning mode system prompt
|
|
96
|
+
│ └── execution.ts # Execution mode system prompt
|
|
97
|
+
└── templates/ # Template files
|
|
98
|
+
├── plan-template.md # Plan generation template
|
|
99
|
+
└── context-template.md # Context file template
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
## Usage Patterns
|
|
103
|
+
|
|
104
|
+
### Basic Task Execution with PostHog
|
|
105
|
+
```typescript
|
|
106
|
+
const agent = new Agent({
|
|
107
|
+
workingDirectory: "/path/to/repo",
|
|
108
|
+
posthogApiUrl: "https://app.posthog.com",
|
|
109
|
+
posthogApiKey: process.env.POSTHOG_API_KEY
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
// Fetch existing PostHog task
|
|
113
|
+
const task = await agent.fetchTask("task_abc123");
|
|
114
|
+
const result = await agent.runTask(task, ExecutionMode.PLAN_AND_BUILD);
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
### Array App Integration
|
|
118
|
+
```typescript
|
|
119
|
+
// Fetch task from PostHog and run with selected mode
|
|
120
|
+
const result = await agent.runTask(taskId, userSelectedMode, {
|
|
121
|
+
repositoryPath: selectedRepoPath,
|
|
122
|
+
permissionMode: PermissionMode.DEFAULT,
|
|
123
|
+
onEvent: (event) => updateUI(event)
|
|
124
|
+
});
|
|
125
|
+
|
|
126
|
+
// Plan is stored in .posthog/{taskId}/plan.md and committed to Git
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
### Working with Task Files
|
|
130
|
+
```typescript
|
|
131
|
+
// Add context files to task folder
|
|
132
|
+
await agent.writeTaskFile(taskId, "requirements.md",
|
|
133
|
+
"Must be backwards compatible...", "context");
|
|
134
|
+
|
|
135
|
+
// Read plan after planning phase
|
|
136
|
+
const plan = await agent.readPlan(taskId);
|
|
137
|
+
|
|
138
|
+
// All files are in .posthog/{taskId}/ and version controlled
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
### Git Workflow
|
|
142
|
+
```typescript
|
|
143
|
+
// Plan-only mode creates planning branch and commits plan
|
|
144
|
+
const planResult = await agent.runTask(taskId, ExecutionMode.PLAN_ONLY);
|
|
145
|
+
// Creates branch: posthog/task-{id}-planning
|
|
146
|
+
// Commits: .posthog/{taskId}/plan.md
|
|
147
|
+
|
|
148
|
+
// Build-only mode creates implementation branch
|
|
149
|
+
const buildResult = await agent.runTask(taskId, ExecutionMode.BUILD_ONLY);
|
|
150
|
+
// Creates branch: posthog/task-{id}-implementation
|
|
151
|
+
// Commits: all implementation changes
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
## Development Notes
|
|
155
|
+
|
|
156
|
+
- Replaces the previous `@posthog/code-agent` package
|
|
157
|
+
- Designed for both Array app and future backend integration
|
|
158
|
+
- Uses Claude SDK's native plan mode for proper planning workflow
|
|
159
|
+
- Git-based artifact storage replaces database-backed supporting files
|
|
160
|
+
- All task artifacts (.posthog/ folders) are version controlled alongside code
|
|
161
|
+
- PostHog tasks are read-only - SDK doesn't create tasks, only executes existing ones
|
|
162
|
+
- Event system compatible with existing Array app expectations
|
|
163
|
+
|
|
164
|
+
## File System Layout
|
|
165
|
+
|
|
166
|
+
When working with tasks, the agent creates this structure:
|
|
167
|
+
|
|
168
|
+
```
|
|
169
|
+
your-repo/
|
|
170
|
+
├── .posthog/
|
|
171
|
+
│ ├── README.md # Auto-generated documentation
|
|
172
|
+
│ ├── .gitignore # Controls what gets committed
|
|
173
|
+
│ └── {task-id}/ # Per-task folder
|
|
174
|
+
│ ├── plan.md # Generated implementation plan
|
|
175
|
+
│ ├── context.md # Additional context (optional)
|
|
176
|
+
│ └── *.md # Other supporting files
|
|
177
|
+
└── (your regular code)
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
## Git Workflow
|
|
181
|
+
|
|
182
|
+
Each task execution creates specific Git branches:
|
|
183
|
+
|
|
184
|
+
1. **Planning Phase**: `posthog/task-{id}-planning`
|
|
185
|
+
- Contains .posthog/{id}/ folder with plan files
|
|
186
|
+
- Committed after plan generation
|
|
187
|
+
- Ready for review before implementation
|
|
188
|
+
|
|
189
|
+
2. **Implementation Phase**: `posthog/task-{id}-implementation`
|
|
190
|
+
- Contains actual code changes
|
|
191
|
+
- Includes updated .posthog/ files if needed
|
|
192
|
+
- Ready for PR creation and code review
|
|
193
|
+
|
|
194
|
+
## Workflow Examples
|
|
195
|
+
|
|
196
|
+
### Complete Task Execution Flow
|
|
197
|
+
|
|
198
|
+
```typescript
|
|
199
|
+
// 1. Initialize agent with PostHog credentials
|
|
200
|
+
const agent = new Agent({
|
|
201
|
+
workingDirectory: "/path/to/repo",
|
|
202
|
+
posthogApiUrl: "https://app.posthog.com",
|
|
203
|
+
posthogApiKey: process.env.POSTHOG_API_KEY
|
|
204
|
+
});
|
|
205
|
+
|
|
206
|
+
// 2. Fetch existing task from PostHog
|
|
207
|
+
const task = await agent.fetchTask("task_abc123");
|
|
208
|
+
|
|
209
|
+
// 3. Add context files before execution (optional)
|
|
210
|
+
await agent.writeTaskFile(task.id, "requirements.md",
|
|
211
|
+
"- Maintain backwards compatibility\n- Add comprehensive tests",
|
|
212
|
+
"context"
|
|
213
|
+
);
|
|
214
|
+
|
|
215
|
+
// 4. Execute with PLAN_AND_BUILD mode
|
|
216
|
+
const result = await agent.runTask(task, ExecutionMode.PLAN_AND_BUILD, {
|
|
217
|
+
permissionMode: PermissionMode.DEFAULT,
|
|
218
|
+
onEvent: (event) => console.log(event)
|
|
219
|
+
});
|
|
220
|
+
|
|
221
|
+
// 5. Review results
|
|
222
|
+
console.log("Planning branch:", `posthog/task-${task.id}-planning`);
|
|
223
|
+
console.log("Implementation branch:", `posthog/task-${task.id}-implementation`);
|
|
224
|
+
console.log("Plan location:", `.posthog/${task.id}/plan.md`);
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
### Array App Integration Pattern
|
|
228
|
+
|
|
229
|
+
```typescript
|
|
230
|
+
// How Array app uses the SDK
|
|
231
|
+
class ArrayTaskExecution {
|
|
232
|
+
async executeTask(taskId: string, mode: ExecutionMode, repoPath: string) {
|
|
233
|
+
const result = await this.agent.runTask(taskId, mode, {
|
|
234
|
+
repositoryPath: repoPath,
|
|
235
|
+
permissionMode: PermissionMode.DEFAULT,
|
|
236
|
+
onEvent: (event) => this.updateUI(event)
|
|
237
|
+
});
|
|
238
|
+
|
|
239
|
+
// Show branches created for user review
|
|
240
|
+
this.showBranchesForReview(taskId, mode);
|
|
241
|
+
return result;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
private updateUI(event: any) {
|
|
245
|
+
switch (event.type) {
|
|
246
|
+
case 'status':
|
|
247
|
+
this.updateProgressBar(event.data?.status);
|
|
248
|
+
break;
|
|
249
|
+
case 'file_write':
|
|
250
|
+
this.showFileChange(event.data);
|
|
251
|
+
break;
|
|
252
|
+
case 'done':
|
|
253
|
+
this.showCompletion();
|
|
254
|
+
break;
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
### File System Operations
|
|
261
|
+
|
|
262
|
+
```typescript
|
|
263
|
+
// Working with task files
|
|
264
|
+
await agent.writeTaskFile(taskId, "context.md", contextContent, "context");
|
|
265
|
+
await agent.writeTaskFile(taskId, "requirements.md", requirements, "reference");
|
|
266
|
+
|
|
267
|
+
// Reading files
|
|
268
|
+
const plan = await agent.readPlan(taskId);
|
|
269
|
+
const files = await agent.getTaskFiles(taskId);
|
|
270
|
+
|
|
271
|
+
// Files are stored in .posthog/{taskId}/ and committed to Git
|
|
272
|
+
```
|
|
273
|
+
|
|
274
|
+
## Error Handling Patterns
|
|
275
|
+
|
|
276
|
+
```typescript
|
|
277
|
+
try {
|
|
278
|
+
const result = await agent.runTask(taskId, ExecutionMode.PLAN_AND_BUILD);
|
|
279
|
+
} catch (error) {
|
|
280
|
+
if (error.message.includes('Git command failed')) {
|
|
281
|
+
// Handle Git-related errors (branch conflicts, etc.)
|
|
282
|
+
} else if (error.message.includes('PostHog API')) {
|
|
283
|
+
// Handle API-related errors (authentication, task not found)
|
|
284
|
+
} else if (error.message.includes('File system')) {
|
|
285
|
+
// Handle file permission or disk space issues
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
```
|
|
289
|
+
|
|
290
|
+
## Performance Considerations
|
|
291
|
+
|
|
292
|
+
- **Branch Creation**: Fast Git operations using local commands
|
|
293
|
+
- **File I/O**: Efficient `.posthog/` folder management with minimal disk usage
|
|
294
|
+
- **API Calls**: Cached PostHog task data to minimize network requests
|
|
295
|
+
- **Event Streaming**: Real-time updates without blocking execution
|
|
296
|
+
- **Template Processing**: Lazy-loaded templates with variable substitution
|
package/README.md
ADDED
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
# PostHog Agent SDK
|
|
2
|
+
|
|
3
|
+
TypeScript agent framework that wraps the Claude Agent SDK for PostHog's Array desktop app. Features a Git-based workflow that stores task artifacts alongside your code.
|
|
4
|
+
|
|
5
|
+
## Quick Start
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
bun install
|
|
9
|
+
bun run example
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
## Key Features
|
|
13
|
+
|
|
14
|
+
- **Git-Based Workflow**: Plans and artifacts stored in `.posthog/` folders and committed to Git
|
|
15
|
+
- **PostHog Integration**: Fetches existing tasks from PostHog API
|
|
16
|
+
- **Configurable Workflows**: Execute tasks via PostHog-defined or local workflows
|
|
17
|
+
- **Branch Management**: Automatic branch creation for planning and implementation
|
|
18
|
+
- **Event Streaming**: Real-time events for UI integration
|
|
19
|
+
|
|
20
|
+
## Usage
|
|
21
|
+
|
|
22
|
+
```typescript
|
|
23
|
+
import { Agent, PermissionMode } from '@posthog/agent';
|
|
24
|
+
|
|
25
|
+
const agent = new Agent({
|
|
26
|
+
workingDirectory: "/path/to/repo",
|
|
27
|
+
posthogApiUrl: "https://app.posthog.com",
|
|
28
|
+
posthogApiKey: process.env.POSTHOG_API_KEY
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
// Run by workflow
|
|
32
|
+
const taskId = "task_abc123";
|
|
33
|
+
const workflowId = "workflow_123";
|
|
34
|
+
await agent.runWorkflow(taskId, workflowId, {
|
|
35
|
+
repositoryPath: "/path/to/repo",
|
|
36
|
+
permissionMode: PermissionMode.ACCEPT_EDITS,
|
|
37
|
+
autoProgress: true,
|
|
38
|
+
});
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Workflow
|
|
42
|
+
|
|
43
|
+
Each task execution creates Git branches:
|
|
44
|
+
|
|
45
|
+
1. **Planning**: `posthog/task-{id}-planning` - Contains plan in `.posthog/{id}/plan.md`
|
|
46
|
+
2. **Implementation**: `posthog/task-{id}-implementation` - Contains code changes
|
|
47
|
+
|
|
48
|
+
## Manual Stages and Resume
|
|
49
|
+
|
|
50
|
+
- Manual stages (no agent, or `is_manual_only`) are stop-points: the SDK will not auto-advance.
|
|
51
|
+
- On manual stages, a PR is opened by default for human review (configurable per stage with `openPullRequest`).
|
|
52
|
+
|
|
53
|
+
Resume from the current stage:
|
|
54
|
+
|
|
55
|
+
```typescript
|
|
56
|
+
await agent.runWorkflow(taskId, workflowId, {
|
|
57
|
+
repositoryPath: "/path/to/repo",
|
|
58
|
+
permissionMode: PermissionMode.ACCEPT_EDITS,
|
|
59
|
+
resumeFromCurrentStage: true,
|
|
60
|
+
autoProgress: true, // ignored on manual stages
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
// Or explicitly progress via API then resume
|
|
64
|
+
await agent.progressToNextStage(taskId);
|
|
65
|
+
await agent.runWorkflow(taskId, workflowId, { resumeFromCurrentStage: true });
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## File System
|
|
69
|
+
|
|
70
|
+
```
|
|
71
|
+
your-repo/
|
|
72
|
+
├── .posthog/
|
|
73
|
+
│ ├── README.md
|
|
74
|
+
│ ├── .gitignore
|
|
75
|
+
│ └── {task-id}/
|
|
76
|
+
│ ├── plan.md
|
|
77
|
+
│ └── context.md (optional)
|
|
78
|
+
└── (your code)
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
## Array App Integration
|
|
82
|
+
|
|
83
|
+
```typescript
|
|
84
|
+
const result = await agent.runTask(taskId, userSelectedMode, {
|
|
85
|
+
repositoryPath: selectedRepo,
|
|
86
|
+
onEvent: (event) => {
|
|
87
|
+
// Update UI based on event type
|
|
88
|
+
switch (event.type) {
|
|
89
|
+
case 'status': updateProgress(event.data); break;
|
|
90
|
+
case 'file_write': showFileChange(event.data); break;
|
|
91
|
+
case 'done': showCompletion(); break;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
## Requirements
|
|
98
|
+
|
|
99
|
+
- Bun runtime
|
|
100
|
+
- Git repository
|
|
101
|
+
- PostHog API access
|
|
102
|
+
- Claude API access via `@anthropic-ai/claude-agent-sdk`
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
## Stage overrides and query overrides
|
|
106
|
+
|
|
107
|
+
You can customize behavior per workflow stage using `stageOverrides`, and pass low-level model options using `queryOverrides`.
|
|
108
|
+
|
|
109
|
+
```ts
|
|
110
|
+
await agent.runWorkflow(taskId, workflowId, {
|
|
111
|
+
repositoryPath: "/path/to/repo",
|
|
112
|
+
// Global defaults for this run
|
|
113
|
+
permissionMode: PermissionMode.ACCEPT_EDITS,
|
|
114
|
+
queryOverrides: { model: 'claude-3-7-sonnet' },
|
|
115
|
+
|
|
116
|
+
// Per-stage overrides (keys must match your workflow's stage keys)
|
|
117
|
+
stageOverrides: {
|
|
118
|
+
plan: {
|
|
119
|
+
permissionMode: PermissionMode.PLAN,
|
|
120
|
+
createPlanningBranch: true,
|
|
121
|
+
// Only applied during the planning stage
|
|
122
|
+
queryOverrides: { temperature: 0.2 }
|
|
123
|
+
},
|
|
124
|
+
build: {
|
|
125
|
+
createImplementationBranch: true,
|
|
126
|
+
openPullRequest: false,
|
|
127
|
+
// Inject custom MCP servers or any other query option
|
|
128
|
+
queryOverrides: {
|
|
129
|
+
mcpServers: {
|
|
130
|
+
// example: override or add servers
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
},
|
|
134
|
+
complete: {
|
|
135
|
+
// ensure a PR is opened at the end regardless of edits
|
|
136
|
+
openPullRequest: true
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
});
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
Precedence for query options: base defaults in the SDK < global `queryOverrides` < per-stage `stageOverrides[stageKey].queryOverrides`.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"example.d.ts","sourceRoot":"","sources":["../example.ts"],"names":[],"mappings":""}
|
package/dist/example.js
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
#!/usr/bin/env bun
|
|
2
|
+
import { config } from "dotenv";
|
|
3
|
+
config();
|
|
4
|
+
import { Agent, PermissionMode } from './src/agent';
|
|
5
|
+
async function testAgent() {
|
|
6
|
+
const REPO_PATH = process.argv[2] || process.cwd();
|
|
7
|
+
const TASK_ID = process.argv[3];
|
|
8
|
+
if (!process.env.POSTHOG_API_KEY) {
|
|
9
|
+
console.error("❌ POSTHOG_API_KEY required");
|
|
10
|
+
process.exit(1);
|
|
11
|
+
}
|
|
12
|
+
console.log(`📁 Working in: ${REPO_PATH}`);
|
|
13
|
+
const agent = new Agent({
|
|
14
|
+
workingDirectory: REPO_PATH,
|
|
15
|
+
posthogApiUrl: process.env.POSTHOG_API_URL || "http://localhost:8010",
|
|
16
|
+
posthogApiKey: process.env.POSTHOG_API_KEY,
|
|
17
|
+
onEvent: (event) => {
|
|
18
|
+
console.log(`[${event.type}]`, event);
|
|
19
|
+
},
|
|
20
|
+
debug: true,
|
|
21
|
+
});
|
|
22
|
+
if (TASK_ID) {
|
|
23
|
+
console.log(`🎯 Running task: ${TASK_ID}`);
|
|
24
|
+
try {
|
|
25
|
+
// Example: list and run a workflow
|
|
26
|
+
await agent['workflowRegistry'].loadWorkflows();
|
|
27
|
+
const workflows = agent['workflowRegistry'].listWorkflows();
|
|
28
|
+
if (workflows.length === 0) {
|
|
29
|
+
throw new Error('No workflows available');
|
|
30
|
+
}
|
|
31
|
+
const selectedWorkflow = workflows[0];
|
|
32
|
+
const options = {
|
|
33
|
+
repositoryPath: REPO_PATH,
|
|
34
|
+
permissionMode: PermissionMode.ACCEPT_EDITS,
|
|
35
|
+
autoProgress: true,
|
|
36
|
+
};
|
|
37
|
+
const result = await agent.runWorkflow(TASK_ID, selectedWorkflow.id, options);
|
|
38
|
+
console.log("✅ Done!");
|
|
39
|
+
console.log(`📁 Plan stored in: .posthog/${TASK_ID}/plan.md`);
|
|
40
|
+
}
|
|
41
|
+
finally {
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
console.log("❌ Please provide a task ID");
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
testAgent().catch(console.error);
|
|
49
|
+
//# sourceMappingURL=example.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"example.js","sourceRoot":"","sources":["../example.ts"],"names":[],"mappings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AC;gBACzB,MAAM,IAAI,KAAK,CAAC,wBAAwB,CAAC,CAAC;YAC9C,CAAC;YACD,MAAM,gBAAgB,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC;YACtC,MAAM,OAAO,GAA6B;gBACtC,cAAc,EAAE,SAAS;gBACzB,cAAc,EAAE,cAAc,CAAC,YAAY;gBAC3C,YAAY,EAAE,IAAI;aACrB,CAAC;YACF,MAAM,MAAM,GAAG,MAAM,KAAK,CAAC,WAAW,CAAC,OAAO,EAAE,gBAAgB,CAAC,EAAE,EAAE,OAAO,CAAC,CAAC;YAC9E,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;YACvB,OAAO,CAAC,GAAG,CAAC,+BAA+B,OAAO,UAAU,CAAC,CAAC;QAClE,CAAC;gBAAS,CAAC;QACX,CAAC;IACL,CAAC;SAAM,CAAC;QACJ,OAAO,CAAC,GAAG,CAAC,4BAA4B,CAAC,CAAC;IAC9C,CAAC;AACL,CAAC;AAED,SAAS,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { Agent, } from './src/agent';
|
|
2
|
+
export { PermissionMode, } from './src/types';
|
|
3
|
+
export type { Task, SupportingFile, ExecutionResult, AgentConfig } from './src/types';
|
|
4
|
+
export type { WorkflowDefinition, WorkflowStage, WorkflowExecutionOptions, AgentDefinition } from './src/workflow-types';
|
|
5
|
+
export { Logger, LogLevel, } from './src/utils/logger';
|
|
6
|
+
export type { LoggerConfig } from './src/utils/logger';
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AACA,OAAO,EACH,KAAK,GACR,MAAM,aAAa,CAAC;AAErB,OAAO,EACH,cAAc,GACjB,MAAM,aAAa,CAAC;AAErB,YAAY,EACR,IAAI,EACJ,cAAc,EACd,eAAe,EACf,WAAW,EACd,MAAM,aAAa,CAAC;AAErB,YAAY,EACV,kBAAkB,EAClB,aAAa,EACb,wBAAwB,EACxB,eAAe,EAChB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EACH,MAAM,EACN,QAAQ,GACX,MAAM,oBAAoB,CAAC;AAE5B,YAAY,EACR,YAAY,EACf,MAAM,oBAAoB,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,yCAAyC;AACzC,OAAO,EACH,KAAK,GACR,MAAM,aAAa,CAAC;AAErB,OAAO,EACH,cAAc,GACjB,MAAM,aAAa,CAAC;AAgBrB,OAAO,EACH,MAAM,EACN,QAAQ,GACX,MAAM,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { AgentDefinition, AgentType } from './workflow-types';
|
|
2
|
+
export declare class AgentRegistry {
|
|
3
|
+
private agentsByName;
|
|
4
|
+
constructor(definitions?: AgentDefinition[]);
|
|
5
|
+
static getDefaultAgents(): AgentDefinition[];
|
|
6
|
+
register(def: AgentDefinition): void;
|
|
7
|
+
getAgent(name: string): AgentDefinition | undefined;
|
|
8
|
+
listAgents(): AgentDefinition[];
|
|
9
|
+
exportForPostHog(): {
|
|
10
|
+
id: string;
|
|
11
|
+
name: string;
|
|
12
|
+
agent_type: AgentType;
|
|
13
|
+
description?: string;
|
|
14
|
+
}[];
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=agent-registry.d.ts.map
|
|
@@ -0,0 +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,kBAAkB,CAAC;AAEnE,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"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
export class AgentRegistry {
|
|
2
|
+
agentsByName = new Map();
|
|
3
|
+
constructor(definitions) {
|
|
4
|
+
if (definitions) {
|
|
5
|
+
for (const def of definitions)
|
|
6
|
+
this.register(def);
|
|
7
|
+
}
|
|
8
|
+
else {
|
|
9
|
+
for (const def of AgentRegistry.getDefaultAgents())
|
|
10
|
+
this.register(def);
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
static getDefaultAgents() {
|
|
14
|
+
return [
|
|
15
|
+
{
|
|
16
|
+
id: 'planning_basic',
|
|
17
|
+
name: 'planning_basic',
|
|
18
|
+
agent_type: 'planning',
|
|
19
|
+
description: 'Analyze repo and produce implementation plan',
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
id: 'code_generation',
|
|
23
|
+
name: 'code_generation',
|
|
24
|
+
agent_type: 'execution',
|
|
25
|
+
description: 'Implements code changes using Claude SDK',
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
id: 'review_basic',
|
|
29
|
+
name: 'review_basic',
|
|
30
|
+
agent_type: 'review',
|
|
31
|
+
description: 'Reviews changes and suggests fixes',
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
id: 'testing_basic',
|
|
35
|
+
name: 'testing_basic',
|
|
36
|
+
agent_type: 'testing',
|
|
37
|
+
description: 'Runs tests and reports results',
|
|
38
|
+
},
|
|
39
|
+
];
|
|
40
|
+
}
|
|
41
|
+
register(def) {
|
|
42
|
+
this.agentsByName.set(def.name, def);
|
|
43
|
+
}
|
|
44
|
+
getAgent(name) {
|
|
45
|
+
return this.agentsByName.get(name);
|
|
46
|
+
}
|
|
47
|
+
listAgents() {
|
|
48
|
+
return Array.from(this.agentsByName.values());
|
|
49
|
+
}
|
|
50
|
+
exportForPostHog() {
|
|
51
|
+
return this.listAgents().map(({ id, name, agent_type, description }) => ({ id, name, agent_type, description }));
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
//# sourceMappingURL=agent-registry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-registry.js","sourceRoot":"","sources":["../../src/agent-registry.ts"],"names":[],"mappings":"AAEA,MAAM,OAAO,aAAa;IAChB,YAAY,GAAiC,IAAI,GAAG,EAAE,CAAC;IAE/D,YAAY,WAA+B;QACzC,IAAI,WAAW,EAAE,CAAC;YAChB,KAAK,MAAM,GAAG,IAAI,WAAW;gBAAE,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;QACpD,CAAC;aAAM,CAAC;YACN,KAAK,MAAM,GAAG,IAAI,aAAa,CAAC,gBAAgB,EAAE;gBAAE,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;QACzE,CAAC;IACH,CAAC;IAED,MAAM,CAAC,gBAAgB;QACrB,OAAO;YACL;gBACE,EAAE,EAAE,gBAAgB;gBACpB,IAAI,EAAE,gBAAgB;gBACtB,UAAU,EAAE,UAAU;gBACtB,WAAW,EAAE,8CAA8C;aAC5D;YACD;gBACE,EAAE,EAAE,iBAAiB;gBACrB,IAAI,EAAE,iBAAiB;gBACvB,UAAU,EAAE,WAAW;gBACvB,WAAW,EAAE,0CAA0C;aACxD;YACD;gBACE,EAAE,EAAE,cAAc;gBAClB,IAAI,EAAE,cAAc;gBACpB,UAAU,EAAE,QAAQ;gBACpB,WAAW,EAAE,oCAAoC;aAClD;YACD;gBACE,EAAE,EAAE,eAAe;gBACnB,IAAI,EAAE,eAAe;gBACrB,UAAU,EAAE,SAAS;gBACrB,WAAW,EAAE,gCAAgC;aAC9C;SACF,CAAC;IACJ,CAAC;IAED,QAAQ,CAAC,GAAoB;QAC3B,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;IACvC,CAAC;IAED,QAAQ,CAAC,IAAY;QACnB,OAAO,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IACrC,CAAC;IAED,UAAU;QACR,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,MAAM,EAAE,CAAC,CAAC;IAChD,CAAC;IAED,gBAAgB;QACd,OAAO,IAAI,CAAC,UAAU,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,UAAU,EAAE,WAAW,EAAE,EAAE,EAAE,CAAC,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,UAAU,EAAE,WAAW,EAAE,CAAC,CAAC,CAAC;IACnH,CAAC;CACF"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import type { Task, ExecutionResult, AgentConfig } from './types';
|
|
2
|
+
import type { WorkflowDefinition, WorkflowStage, WorkflowExecutionOptions } from './workflow-types';
|
|
3
|
+
export declare class Agent {
|
|
4
|
+
private workingDirectory;
|
|
5
|
+
private onEvent?;
|
|
6
|
+
private taskManager;
|
|
7
|
+
private posthogAPI?;
|
|
8
|
+
private fileManager;
|
|
9
|
+
private gitManager;
|
|
10
|
+
private templateManager;
|
|
11
|
+
private eventTransformer;
|
|
12
|
+
private logger;
|
|
13
|
+
private agentRegistry;
|
|
14
|
+
private workflowRegistry;
|
|
15
|
+
private stageExecutor;
|
|
16
|
+
debug: boolean;
|
|
17
|
+
constructor(config?: AgentConfig);
|
|
18
|
+
/**
|
|
19
|
+
* Enable or disable debug logging
|
|
20
|
+
*/
|
|
21
|
+
setDebug(enabled: boolean): void;
|
|
22
|
+
runWorkflow(taskOrId: Task | string, workflowId: string, options?: WorkflowExecutionOptions): Promise<{
|
|
23
|
+
task: Task;
|
|
24
|
+
workflow: WorkflowDefinition;
|
|
25
|
+
}>;
|
|
26
|
+
executeStage(task: Task, stage: WorkflowStage, options?: WorkflowExecutionOptions): Promise<void>;
|
|
27
|
+
progressToNextStage(taskId: string): Promise<void>;
|
|
28
|
+
run(prompt: string, options?: {
|
|
29
|
+
repositoryPath?: string;
|
|
30
|
+
permissionMode?: import('./types').PermissionMode;
|
|
31
|
+
queryOverrides?: Record<string, any>;
|
|
32
|
+
}): Promise<ExecutionResult>;
|
|
33
|
+
fetchTask(taskId: string): Promise<Task>;
|
|
34
|
+
listTasks(filters?: {
|
|
35
|
+
repository?: string;
|
|
36
|
+
organization?: string;
|
|
37
|
+
origin_product?: string;
|
|
38
|
+
workflow?: string;
|
|
39
|
+
current_stage?: string;
|
|
40
|
+
}): Promise<Task[]>;
|
|
41
|
+
writeTaskFile(taskId: string, fileName: string, content: string, type?: 'plan' | 'context' | 'reference' | 'output'): Promise<void>;
|
|
42
|
+
readTaskFile(taskId: string, fileName: string): Promise<string | null>;
|
|
43
|
+
getTaskFiles(taskId: string): Promise<any[]>;
|
|
44
|
+
writePlan(taskId: string, plan: string): Promise<void>;
|
|
45
|
+
readPlan(taskId: string): Promise<string | null>;
|
|
46
|
+
createPlanningBranch(taskId: string): Promise<string>;
|
|
47
|
+
commitPlan(taskId: string, taskTitle: string): Promise<string>;
|
|
48
|
+
createImplementationBranch(taskId: string, planningBranchName?: string): Promise<string>;
|
|
49
|
+
commitImplementation(taskId: string, taskTitle: string, planSummary?: string): Promise<string>;
|
|
50
|
+
createPullRequest(taskId: string, branchName: string, taskTitle: string, taskDescription: string): Promise<string>;
|
|
51
|
+
attachPullRequestToTask(taskId: string, prUrl: string): Promise<void>;
|
|
52
|
+
updateTaskBranch(taskId: string, branchName: string): Promise<void>;
|
|
53
|
+
cancelTask(taskId: string): void;
|
|
54
|
+
getTaskExecutionStatus(taskId: string): string | null;
|
|
55
|
+
private emitEvent;
|
|
56
|
+
}
|
|
57
|
+
export { PermissionMode } from './types';
|
|
58
|
+
export type { Task, SupportingFile, ExecutionResult, AgentConfig } from './types';
|
|
59
|
+
export type { WorkflowDefinition, WorkflowStage, WorkflowExecutionOptions } from './workflow-types';
|
|
60
|
+
//# sourceMappingURL=agent.d.ts.map
|
|
@@ -0,0 +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,SAAS,CAAC;AAC9E,OAAO,KAAK,EAAE,kBAAkB,EAAE,aAAa,EAAE,wBAAwB,EAAE,MAAM,kBAAkB,CAAC;AAepG,qBAAa,KAAK;IACd,OAAO,CAAC,gBAAgB,CAAS;IACjC,OAAO,CAAC,OAAO,CAAC,CAAuB;IACvC,OAAO,CAAC,WAAW,CAAc;IACjC,OAAO,CAAC,UAAU,CAAC,CAAmB;IACtC,OAAO,CAAC,WAAW,CAAqB;IACxC,OAAO,CAAC,UAAU,CAAa;IAC/B,OAAO,CAAC,eAAe,CAAkB;IACzC,OAAO,CAAC,gBAAgB,CAAmB;IAC3C,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,aAAa,CAAgB;IACrC,OAAO,CAAC,gBAAgB,CAAmB;IAC3C,OAAO,CAAC,aAAa,CAAgB;IAC9B,KAAK,EAAE,OAAO,CAAC;gBAEV,MAAM,GAAE,WAAgB;IAoCpC;;OAEG;IACH,QAAQ,CAAC,OAAO,EAAE,OAAO;IAMnB,WAAW,CAAC,QAAQ,EAAE,IAAI,GAAG,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,OAAO,GAAE,wBAA6B,GAAG,OAAO,CA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