@posthog/agent 1.20.0 → 1.21.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/claude-cli/cli.js +2186 -1872
- package/dist/src/adapters/claude/claude-adapter.d.ts +1 -1
- package/dist/src/adapters/claude/claude-adapter.d.ts.map +1 -1
- package/dist/src/adapters/claude/claude-adapter.js +141 -133
- package/dist/src/adapters/claude/claude-adapter.js.map +1 -1
- package/dist/src/adapters/types.d.ts +3 -3
- package/dist/src/adapters/types.d.ts.map +1 -1
- package/dist/src/agent.d.ts +1 -1
- package/dist/src/agent.d.ts.map +1 -1
- package/dist/src/agent.js +9 -8
- package/dist/src/agent.js.map +1 -1
- package/dist/src/file-manager.d.ts +10 -0
- package/dist/src/file-manager.d.ts.map +1 -1
- package/dist/src/file-manager.js +49 -10
- package/dist/src/file-manager.js.map +1 -1
- package/dist/src/posthog-api.d.ts +2 -1
- package/dist/src/posthog-api.d.ts.map +1 -1
- package/dist/src/posthog-api.js +11 -0
- package/dist/src/posthog-api.js.map +1 -1
- package/dist/src/task-progress-reporter.d.ts +12 -4
- package/dist/src/task-progress-reporter.d.ts.map +1 -1
- package/dist/src/task-progress-reporter.js +271 -117
- package/dist/src/task-progress-reporter.js.map +1 -1
- package/dist/src/types.d.ts +17 -1
- package/dist/src/types.d.ts.map +1 -1
- package/dist/src/types.js.map +1 -1
- package/dist/src/workflow/config.d.ts.map +1 -1
- package/dist/src/workflow/config.js +11 -0
- package/dist/src/workflow/config.js.map +1 -1
- package/dist/src/workflow/steps/build.js +3 -3
- package/dist/src/workflow/steps/build.js.map +1 -1
- package/dist/src/workflow/steps/finalize.d.ts +3 -0
- package/dist/src/workflow/steps/finalize.d.ts.map +1 -0
- package/dist/src/workflow/steps/finalize.js +173 -0
- package/dist/src/workflow/steps/finalize.js.map +1 -0
- package/dist/src/workflow/steps/plan.js +3 -3
- package/dist/src/workflow/steps/plan.js.map +1 -1
- package/dist/src/workflow/steps/research.js +3 -3
- package/dist/src/workflow/steps/research.js.map +1 -1
- package/package.json +1 -1
- package/src/adapters/claude/claude-adapter.ts +56 -46
- package/src/adapters/types.ts +3 -3
- package/src/agent.ts +17 -8
- package/src/file-manager.ts +59 -6
- package/src/posthog-api.ts +33 -1
- package/src/task-progress-reporter.ts +299 -138
- package/src/types.ts +20 -1
- package/src/workflow/config.ts +11 -0
- package/src/workflow/steps/build.ts +3 -3
- package/src/workflow/steps/finalize.ts +207 -0
- package/src/workflow/steps/plan.ts +3 -3
- package/src/workflow/steps/research.ts +3 -3
|
@@ -12,6 +12,14 @@ class TaskProgressReporter {
|
|
|
12
12
|
outputLog = [];
|
|
13
13
|
totalSteps;
|
|
14
14
|
lastLogEntry;
|
|
15
|
+
tokenBuffer = '';
|
|
16
|
+
tokenCount = 0;
|
|
17
|
+
tokenFlushTimer;
|
|
18
|
+
TOKEN_BATCH_SIZE = 100;
|
|
19
|
+
TOKEN_FLUSH_INTERVAL_MS = 1000;
|
|
20
|
+
logWriteQueue = Promise.resolve();
|
|
21
|
+
LOG_APPEND_MAX_RETRIES = 3;
|
|
22
|
+
LOG_APPEND_RETRY_BASE_DELAY_MS = 200;
|
|
15
23
|
constructor(posthogAPI, logger) {
|
|
16
24
|
this.posthogAPI = posthogAPI;
|
|
17
25
|
this.logger = logger.child('TaskProgressReporter');
|
|
@@ -38,6 +46,11 @@ class TaskProgressReporter {
|
|
|
38
46
|
}
|
|
39
47
|
}
|
|
40
48
|
async complete() {
|
|
49
|
+
await this.flushTokens(); // Flush any remaining tokens before completion
|
|
50
|
+
if (this.tokenFlushTimer) {
|
|
51
|
+
clearTimeout(this.tokenFlushTimer);
|
|
52
|
+
this.tokenFlushTimer = undefined;
|
|
53
|
+
}
|
|
41
54
|
await this.update({ status: 'completed' }, 'Task execution completed');
|
|
42
55
|
}
|
|
43
56
|
async fail(error) {
|
|
@@ -47,60 +60,284 @@ class TaskProgressReporter {
|
|
|
47
60
|
async appendLog(line) {
|
|
48
61
|
await this.update({}, line);
|
|
49
62
|
}
|
|
63
|
+
async flushTokens() {
|
|
64
|
+
if (!this.tokenBuffer || this.tokenCount === 0) {
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
const buffer = this.tokenBuffer;
|
|
68
|
+
this.tokenBuffer = '';
|
|
69
|
+
this.tokenCount = 0;
|
|
70
|
+
await this.appendLogEntry({
|
|
71
|
+
type: 'token',
|
|
72
|
+
message: buffer,
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
scheduleTokenFlush() {
|
|
76
|
+
if (this.tokenFlushTimer) {
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
this.tokenFlushTimer = setTimeout(() => {
|
|
80
|
+
this.tokenFlushTimer = undefined;
|
|
81
|
+
this.flushTokens().catch((err) => {
|
|
82
|
+
this.logger.warn('Failed to flush tokens', { error: err });
|
|
83
|
+
});
|
|
84
|
+
}, this.TOKEN_FLUSH_INTERVAL_MS);
|
|
85
|
+
}
|
|
86
|
+
appendLogEntry(entry) {
|
|
87
|
+
if (!this.posthogAPI || !this.runId || !this.taskId) {
|
|
88
|
+
return Promise.resolve();
|
|
89
|
+
}
|
|
90
|
+
const taskId = this.taskId;
|
|
91
|
+
const runId = this.runId;
|
|
92
|
+
this.logWriteQueue = this.logWriteQueue
|
|
93
|
+
.catch((error) => {
|
|
94
|
+
// Ensure previous failures don't block subsequent writes
|
|
95
|
+
this.logger.debug('Previous log append failed', {
|
|
96
|
+
taskId,
|
|
97
|
+
runId,
|
|
98
|
+
error: error instanceof Error ? error.message : String(error),
|
|
99
|
+
});
|
|
100
|
+
})
|
|
101
|
+
.then(() => this.writeLogEntry(taskId, runId, entry));
|
|
102
|
+
return this.logWriteQueue;
|
|
103
|
+
}
|
|
104
|
+
async writeLogEntry(taskId, runId, entry) {
|
|
105
|
+
if (!this.posthogAPI) {
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
for (let attempt = 1; attempt <= this.LOG_APPEND_MAX_RETRIES; attempt++) {
|
|
109
|
+
try {
|
|
110
|
+
await this.posthogAPI.appendTaskRunLog(taskId, runId, [entry]);
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
catch (error) {
|
|
114
|
+
this.logger.warn('Failed to append log entry', {
|
|
115
|
+
taskId,
|
|
116
|
+
runId,
|
|
117
|
+
attempt,
|
|
118
|
+
maxAttempts: this.LOG_APPEND_MAX_RETRIES,
|
|
119
|
+
error: error.message,
|
|
120
|
+
});
|
|
121
|
+
if (attempt === this.LOG_APPEND_MAX_RETRIES) {
|
|
122
|
+
return;
|
|
123
|
+
}
|
|
124
|
+
const delayMs = this.LOG_APPEND_RETRY_BASE_DELAY_MS * Math.pow(2, attempt - 1);
|
|
125
|
+
await new Promise((resolve) => setTimeout(resolve, delayMs));
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}
|
|
50
129
|
async recordEvent(event) {
|
|
51
130
|
if (!this.posthogAPI || !this.runId || !this.taskId) {
|
|
52
131
|
return;
|
|
53
132
|
}
|
|
54
133
|
switch (event.type) {
|
|
55
|
-
case 'token':
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
134
|
+
case 'token': {
|
|
135
|
+
// Batch tokens for efficiency
|
|
136
|
+
this.tokenBuffer += event.content;
|
|
137
|
+
this.tokenCount++;
|
|
138
|
+
if (this.tokenCount >= this.TOKEN_BATCH_SIZE) {
|
|
139
|
+
await this.flushTokens();
|
|
140
|
+
if (this.tokenFlushTimer) {
|
|
141
|
+
clearTimeout(this.tokenFlushTimer);
|
|
142
|
+
this.tokenFlushTimer = undefined;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
else {
|
|
146
|
+
this.scheduleTokenFlush();
|
|
147
|
+
}
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
case 'content_block_start': {
|
|
151
|
+
await this.appendLogEntry({
|
|
152
|
+
type: 'content_block_start',
|
|
153
|
+
message: JSON.stringify({
|
|
154
|
+
index: event.index,
|
|
155
|
+
contentType: event.contentType,
|
|
156
|
+
toolName: event.toolName,
|
|
157
|
+
toolId: event.toolId,
|
|
158
|
+
ts: event.ts,
|
|
159
|
+
}),
|
|
160
|
+
});
|
|
161
|
+
return;
|
|
162
|
+
}
|
|
163
|
+
case 'content_block_stop': {
|
|
164
|
+
await this.appendLogEntry({
|
|
165
|
+
type: 'content_block_stop',
|
|
166
|
+
message: JSON.stringify({
|
|
167
|
+
index: event.index,
|
|
168
|
+
ts: event.ts,
|
|
169
|
+
}),
|
|
170
|
+
});
|
|
66
171
|
return;
|
|
172
|
+
}
|
|
173
|
+
case 'message_start': {
|
|
174
|
+
await this.appendLogEntry({
|
|
175
|
+
type: 'message_start',
|
|
176
|
+
message: JSON.stringify({
|
|
177
|
+
messageId: event.messageId,
|
|
178
|
+
model: event.model,
|
|
179
|
+
ts: event.ts,
|
|
180
|
+
}),
|
|
181
|
+
});
|
|
182
|
+
return;
|
|
183
|
+
}
|
|
184
|
+
case 'message_delta': {
|
|
185
|
+
await this.appendLogEntry({
|
|
186
|
+
type: 'message_delta',
|
|
187
|
+
message: JSON.stringify({
|
|
188
|
+
stopReason: event.stopReason,
|
|
189
|
+
stopSequence: event.stopSequence,
|
|
190
|
+
usage: event.usage,
|
|
191
|
+
ts: event.ts,
|
|
192
|
+
}),
|
|
193
|
+
});
|
|
194
|
+
return;
|
|
195
|
+
}
|
|
196
|
+
case 'message_stop': {
|
|
197
|
+
await this.appendLogEntry({
|
|
198
|
+
type: 'message_stop',
|
|
199
|
+
message: JSON.stringify({ ts: event.ts }),
|
|
200
|
+
});
|
|
201
|
+
return;
|
|
202
|
+
}
|
|
203
|
+
case 'status': {
|
|
204
|
+
await this.appendLogEntry({
|
|
205
|
+
type: 'status',
|
|
206
|
+
message: JSON.stringify({
|
|
207
|
+
phase: event.phase,
|
|
208
|
+
kind: event.kind,
|
|
209
|
+
branch: event.branch,
|
|
210
|
+
prUrl: event.prUrl,
|
|
211
|
+
taskId: event.taskId,
|
|
212
|
+
messageId: event.messageId,
|
|
213
|
+
model: event.model,
|
|
214
|
+
ts: event.ts,
|
|
215
|
+
}),
|
|
216
|
+
});
|
|
217
|
+
return;
|
|
218
|
+
}
|
|
219
|
+
case 'artifact': {
|
|
220
|
+
await this.appendLogEntry({
|
|
221
|
+
type: 'artifact',
|
|
222
|
+
message: JSON.stringify({
|
|
223
|
+
kind: event.kind,
|
|
224
|
+
content: event.content,
|
|
225
|
+
ts: event.ts,
|
|
226
|
+
}),
|
|
227
|
+
});
|
|
228
|
+
return;
|
|
229
|
+
}
|
|
230
|
+
case 'init': {
|
|
231
|
+
await this.appendLogEntry({
|
|
232
|
+
type: 'init',
|
|
233
|
+
message: JSON.stringify({
|
|
234
|
+
model: event.model,
|
|
235
|
+
tools: event.tools,
|
|
236
|
+
permissionMode: event.permissionMode,
|
|
237
|
+
cwd: event.cwd,
|
|
238
|
+
apiKeySource: event.apiKeySource,
|
|
239
|
+
ts: event.ts,
|
|
240
|
+
}),
|
|
241
|
+
});
|
|
242
|
+
return;
|
|
243
|
+
}
|
|
244
|
+
case 'metric': {
|
|
245
|
+
await this.appendLogEntry({
|
|
246
|
+
type: 'metric',
|
|
247
|
+
message: JSON.stringify({
|
|
248
|
+
key: event.key,
|
|
249
|
+
value: event.value,
|
|
250
|
+
unit: event.unit,
|
|
251
|
+
ts: event.ts,
|
|
252
|
+
}),
|
|
253
|
+
});
|
|
254
|
+
return;
|
|
255
|
+
}
|
|
256
|
+
case 'compact_boundary': {
|
|
257
|
+
await this.appendLogEntry({
|
|
258
|
+
type: 'compact_boundary',
|
|
259
|
+
message: JSON.stringify({
|
|
260
|
+
trigger: event.trigger,
|
|
261
|
+
preTokens: event.preTokens,
|
|
262
|
+
ts: event.ts,
|
|
263
|
+
}),
|
|
264
|
+
});
|
|
265
|
+
return;
|
|
266
|
+
}
|
|
67
267
|
case 'tool_call': {
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
268
|
+
await this.appendLogEntry({
|
|
269
|
+
type: 'tool_call',
|
|
270
|
+
message: JSON.stringify({
|
|
271
|
+
toolName: event.toolName,
|
|
272
|
+
callId: event.callId,
|
|
273
|
+
args: event.args,
|
|
274
|
+
parentToolUseId: event.parentToolUseId,
|
|
275
|
+
ts: event.ts,
|
|
276
|
+
}),
|
|
277
|
+
});
|
|
72
278
|
return;
|
|
73
279
|
}
|
|
74
280
|
case 'tool_result': {
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
281
|
+
await this.appendLogEntry({
|
|
282
|
+
type: 'tool_result',
|
|
283
|
+
message: JSON.stringify({
|
|
284
|
+
toolName: event.toolName,
|
|
285
|
+
callId: event.callId,
|
|
286
|
+
result: event.result,
|
|
287
|
+
isError: event.isError,
|
|
288
|
+
parentToolUseId: event.parentToolUseId,
|
|
289
|
+
ts: event.ts,
|
|
290
|
+
}),
|
|
291
|
+
});
|
|
79
292
|
return;
|
|
80
293
|
}
|
|
81
|
-
case '
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
294
|
+
case 'error': {
|
|
295
|
+
await this.appendLogEntry({
|
|
296
|
+
type: 'error',
|
|
297
|
+
message: JSON.stringify({
|
|
298
|
+
message: event.message,
|
|
299
|
+
errorType: event.errorType,
|
|
300
|
+
context: event.context,
|
|
301
|
+
ts: event.ts,
|
|
302
|
+
}),
|
|
303
|
+
});
|
|
86
304
|
return;
|
|
305
|
+
}
|
|
87
306
|
case 'done': {
|
|
88
|
-
|
|
89
|
-
|
|
307
|
+
await this.appendLogEntry({
|
|
308
|
+
type: 'done',
|
|
309
|
+
message: JSON.stringify({
|
|
310
|
+
result: event.result,
|
|
311
|
+
durationMs: event.durationMs,
|
|
312
|
+
durationApiMs: event.durationApiMs,
|
|
313
|
+
numTurns: event.numTurns,
|
|
314
|
+
totalCostUsd: event.totalCostUsd,
|
|
315
|
+
usage: event.usage,
|
|
316
|
+
modelUsage: event.modelUsage,
|
|
317
|
+
permissionDenials: event.permissionDenials,
|
|
318
|
+
ts: event.ts,
|
|
319
|
+
}),
|
|
320
|
+
});
|
|
90
321
|
return;
|
|
91
322
|
}
|
|
92
|
-
case 'init':
|
|
93
|
-
// Omit verbose init messages from persisted log
|
|
94
|
-
return;
|
|
95
323
|
case 'user_message': {
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
324
|
+
await this.appendLogEntry({
|
|
325
|
+
type: 'user_message',
|
|
326
|
+
message: JSON.stringify({
|
|
327
|
+
content: event.content,
|
|
328
|
+
isSynthetic: event.isSynthetic,
|
|
329
|
+
ts: event.ts,
|
|
330
|
+
}),
|
|
331
|
+
});
|
|
332
|
+
return;
|
|
333
|
+
}
|
|
334
|
+
case 'raw_sdk_event': {
|
|
335
|
+
// Skip raw SDK events - too verbose for persistence
|
|
100
336
|
return;
|
|
101
337
|
}
|
|
102
338
|
default:
|
|
103
|
-
// For any unfamiliar event types,
|
|
339
|
+
// For any unfamiliar event types, log them as-is
|
|
340
|
+
this.logger.debug('Unknown event type', { type: event.type });
|
|
104
341
|
return;
|
|
105
342
|
}
|
|
106
343
|
}
|
|
@@ -139,89 +376,6 @@ class TaskProgressReporter {
|
|
|
139
376
|
}
|
|
140
377
|
}
|
|
141
378
|
}
|
|
142
|
-
summarizeUserMessage(content) {
|
|
143
|
-
if (!content) {
|
|
144
|
-
return null;
|
|
145
|
-
}
|
|
146
|
-
const trimmed = content.trim();
|
|
147
|
-
if (!trimmed) {
|
|
148
|
-
return null;
|
|
149
|
-
}
|
|
150
|
-
const fileUpdateMatch = trimmed.match(/The file\s+([^\s]+)\s+has been updated/i);
|
|
151
|
-
if (fileUpdateMatch) {
|
|
152
|
-
return `[user] file updated: ${fileUpdateMatch[1]}`;
|
|
153
|
-
}
|
|
154
|
-
if (/Todos have been modified/i.test(trimmed)) {
|
|
155
|
-
return '[todo] list updated';
|
|
156
|
-
}
|
|
157
|
-
const diffMatch = trimmed.match(/diff --git a\/([^\s]+) b\/([^\s]+)/);
|
|
158
|
-
if (diffMatch) {
|
|
159
|
-
return `[diff] ${diffMatch[2] ?? diffMatch[1]}`;
|
|
160
|
-
}
|
|
161
|
-
const gitStatusMatch = trimmed.match(/^On branch ([^\n]+)/);
|
|
162
|
-
if (gitStatusMatch) {
|
|
163
|
-
return `[git] status ${gitStatusMatch[1]}`;
|
|
164
|
-
}
|
|
165
|
-
if (/This Bash command contains multiple operations/i.test(trimmed)) {
|
|
166
|
-
return '[approval] multi-step command pending';
|
|
167
|
-
}
|
|
168
|
-
if (/This command requires approval/i.test(trimmed)) {
|
|
169
|
-
return '[approval] command awaiting approval';
|
|
170
|
-
}
|
|
171
|
-
if (/^Exit plan mode\?/i.test(trimmed)) {
|
|
172
|
-
return null;
|
|
173
|
-
}
|
|
174
|
-
if (trimmed.includes('node_modules')) {
|
|
175
|
-
return null;
|
|
176
|
-
}
|
|
177
|
-
if (trimmed.includes('total ') && trimmed.includes('drwx')) {
|
|
178
|
-
return null;
|
|
179
|
-
}
|
|
180
|
-
if (trimmed.includes('→')) {
|
|
181
|
-
return null;
|
|
182
|
-
}
|
|
183
|
-
if (trimmed.split('\n').length > 2) {
|
|
184
|
-
return null;
|
|
185
|
-
}
|
|
186
|
-
const normalized = trimmed.replace(/\s+/g, ' ');
|
|
187
|
-
const maxLen = 120;
|
|
188
|
-
if (!normalized) {
|
|
189
|
-
return null;
|
|
190
|
-
}
|
|
191
|
-
const preview = normalized.length > maxLen ? `${normalized.slice(0, maxLen)}…` : normalized;
|
|
192
|
-
return `[user] ${preview}`;
|
|
193
|
-
}
|
|
194
|
-
truncateMultiline(text, max = 160) {
|
|
195
|
-
if (!text) {
|
|
196
|
-
return '';
|
|
197
|
-
}
|
|
198
|
-
const compact = text.replace(/\s+/g, ' ').trim();
|
|
199
|
-
return compact.length > max ? `${compact.slice(0, max)}…` : compact;
|
|
200
|
-
}
|
|
201
|
-
formatToolCallEvent(event) {
|
|
202
|
-
// File operations to track
|
|
203
|
-
const fileOps = ['read_file', 'write', 'search_replace', 'delete_file', 'glob_file_search', 'file_search', 'list_dir', 'edit_notebook'];
|
|
204
|
-
// Terminal commands to track
|
|
205
|
-
const terminalOps = ['run_terminal_cmd', 'bash', 'shell'];
|
|
206
|
-
if (fileOps.includes(event.toolName)) {
|
|
207
|
-
// Extract file path from args
|
|
208
|
-
const path = event.args?.target_file || event.args?.file_path || event.args?.target_notebook || event.args?.target_directory || '';
|
|
209
|
-
return `[tool] ${event.toolName}${path ? `: ${path}` : ''}`;
|
|
210
|
-
}
|
|
211
|
-
else if (terminalOps.includes(event.toolName)) {
|
|
212
|
-
// Extract command from args
|
|
213
|
-
const cmd = event.args?.command || '';
|
|
214
|
-
const truncated = cmd.length > 80 ? `${cmd.slice(0, 80)}…` : cmd;
|
|
215
|
-
return `[cmd] ${truncated}`;
|
|
216
|
-
}
|
|
217
|
-
// Skip other tools from persistence
|
|
218
|
-
return null;
|
|
219
|
-
}
|
|
220
|
-
formatToolResultEvent(event) {
|
|
221
|
-
// We don't need to log tool results separately - tool calls are sufficient
|
|
222
|
-
// This keeps the log concise
|
|
223
|
-
return null;
|
|
224
|
-
}
|
|
225
379
|
}
|
|
226
380
|
|
|
227
381
|
export { TaskProgressReporter };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"task-progress-reporter.js","sources":["../../src/task-progress-reporter.ts"],"sourcesContent":["import type { Logger } from './utils/logger.js';\nimport type { PostHogAPIClient, TaskRunUpdate } from './posthog-api.js';\nimport type { AgentEvent, TaskRun } from './types.js';\n\ninterface ProgressMetadata {\n totalSteps?: number;\n}\n\n/**\n * Persists task execution progress to PostHog so clients can poll for updates.\n *\n * The reporter is intentionally best-effort – failures are logged but never\n * allowed to break the agent execution flow.\n */\nexport class TaskProgressReporter {\n private posthogAPI?: PostHogAPIClient;\n private logger: Logger;\n private taskRun?: TaskRun;\n private taskId?: string;\n private outputLog: string[] = [];\n private totalSteps?: number;\n private lastLogEntry?: string;\n\n constructor(posthogAPI: PostHogAPIClient | undefined, logger: Logger) {\n this.posthogAPI = posthogAPI;\n this.logger = logger.child('TaskProgressReporter');\n }\n\n get runId(): string | undefined {\n return this.taskRun?.id;\n }\n\n async start(taskId: string, metadata: ProgressMetadata = {}): Promise<void> {\n if (!this.posthogAPI) {\n return;\n }\n\n this.taskId = taskId;\n this.totalSteps = metadata.totalSteps;\n\n try {\n const run = await this.posthogAPI.createTaskRun(taskId, {\n status: 'started',\n });\n this.taskRun = run;\n this.outputLog = [];\n this.logger.debug('Created task run', { taskId, runId: run.id });\n } catch (error) {\n this.logger.warn('Failed to create task run', { taskId, error: (error as Error).message });\n }\n }\n\n async complete(): Promise<void> {\n await this.update({ status: 'completed' }, 'Task execution completed');\n }\n\n async fail(error: Error | string): Promise<void> {\n const message = typeof error === 'string' ? error : error.message;\n await this.update({ status: 'failed', error_message: message }, `Task execution failed: ${message}`);\n }\n\n async appendLog(line: string): Promise<void> {\n await this.update({}, line);\n }\n\n async recordEvent(event: AgentEvent): Promise<void> {\n if (!this.posthogAPI || !this.runId || !this.taskId) {\n return;\n }\n\n switch (event.type) {\n case 'token':\n case 'message_delta':\n case 'content_block_start':\n case 'content_block_stop':\n case 'compact_boundary':\n case 'message_start':\n case 'message_stop':\n case 'metric':\n case 'artifact':\n case 'raw_sdk_event':\n // Skip verbose streaming artifacts from persistence\n return;\n\n case 'tool_call': {\n const logLine = this.formatToolCallEvent(event);\n if (logLine) {\n await this.appendLog(logLine);\n }\n return;\n }\n\n case 'tool_result': {\n const logLine = this.formatToolResultEvent(event);\n if (logLine) {\n await this.appendLog(logLine);\n }\n return;\n }\n\n case 'status':\n // Status events are covered by dedicated progress updates\n return;\n\n case 'error':\n await this.appendLog(`[error] ${event.message}`);\n return;\n\n case 'done': {\n const cost = event.totalCostUsd !== undefined ? ` cost=$${event.totalCostUsd.toFixed(2)}` : '';\n await this.appendLog(\n `[done] duration=${event.durationMs ?? 'unknown'}ms turns=${event.numTurns ?? 'unknown'}${cost}`\n );\n return;\n }\n\n case 'init':\n // Omit verbose init messages from persisted log\n return;\n\n case 'user_message': {\n const summary = this.summarizeUserMessage(event.content);\n if (summary) {\n await this.appendLog(summary);\n }\n return;\n }\n\n default:\n // For any unfamiliar event types, avoid spamming the log.\n return;\n }\n }\n\n private async update(update: TaskRunUpdate, logLine?: string): Promise<void> {\n if (!this.posthogAPI || !this.runId || !this.taskId) {\n return;\n }\n\n // If there's a log line, append it separately using the append_log endpoint\n if (logLine && logLine !== this.lastLogEntry) {\n try {\n await this.posthogAPI.appendTaskRunLog(this.taskId, this.runId, [\n { type: 'info', message: logLine }\n ]);\n this.lastLogEntry = logLine;\n } catch (error) {\n this.logger.warn('Failed to append log entry', {\n taskId: this.taskId,\n runId: this.runId,\n error: (error as Error).message,\n });\n }\n }\n\n // Update other fields if provided\n if (Object.keys(update).length > 0) {\n try {\n const run = await this.posthogAPI.updateTaskRun(this.taskId, this.runId, update);\n this.taskRun = run;\n } catch (error) {\n this.logger.warn('Failed to update task run', {\n taskId: this.taskId,\n runId: this.runId,\n error: (error as Error).message,\n });\n }\n }\n }\n\n private summarizeUserMessage(content?: string): string | null {\n if (!content) {\n return null;\n }\n const trimmed = content.trim();\n if (!trimmed) {\n return null;\n }\n\n const fileUpdateMatch = trimmed.match(/The file\\s+([^\\s]+)\\s+has been updated/i);\n if (fileUpdateMatch) {\n return `[user] file updated: ${fileUpdateMatch[1]}`;\n }\n\n if (/Todos have been modified/i.test(trimmed)) {\n return '[todo] list updated';\n }\n\n const diffMatch = trimmed.match(/diff --git a\\/([^\\s]+) b\\/([^\\s]+)/);\n if (diffMatch) {\n return `[diff] ${diffMatch[2] ?? diffMatch[1]}`;\n }\n\n const gitStatusMatch = trimmed.match(/^On branch ([^\\n]+)/);\n if (gitStatusMatch) {\n return `[git] status ${gitStatusMatch[1]}`;\n }\n\n if (/This Bash command contains multiple operations/i.test(trimmed)) {\n return '[approval] multi-step command pending';\n }\n\n if (/This command requires approval/i.test(trimmed)) {\n return '[approval] command awaiting approval';\n }\n\n if (/^Exit plan mode\\?/i.test(trimmed)) {\n return null;\n }\n\n if (trimmed.includes('node_modules')) {\n return null;\n }\n\n if (trimmed.includes('total ') && trimmed.includes('drwx')) {\n return null;\n }\n\n if (trimmed.includes('→')) {\n return null;\n }\n\n if (trimmed.split('\\n').length > 2) {\n return null;\n }\n\n const normalized = trimmed.replace(/\\s+/g, ' ');\n const maxLen = 120;\n if (!normalized) {\n return null;\n }\n const preview = normalized.length > maxLen ? `${normalized.slice(0, maxLen)}…` : normalized;\n return `[user] ${preview}`;\n }\n\n\n private truncateMultiline(text: string, max = 160): string {\n if (!text) {\n return '';\n }\n const compact = text.replace(/\\s+/g, ' ').trim();\n return compact.length > max ? `${compact.slice(0, max)}…` : compact;\n }\n\n private formatToolCallEvent(event: Extract<AgentEvent, { type: 'tool_call' }>): string | null {\n // File operations to track\n const fileOps = ['read_file', 'write', 'search_replace', 'delete_file', 'glob_file_search', 'file_search', 'list_dir', 'edit_notebook'];\n // Terminal commands to track\n const terminalOps = ['run_terminal_cmd', 'bash', 'shell'];\n\n if (fileOps.includes(event.toolName)) {\n // Extract file path from args\n const path = event.args?.target_file || event.args?.file_path || event.args?.target_notebook || event.args?.target_directory || '';\n return `[tool] ${event.toolName}${path ? `: ${path}` : ''}`;\n } else if (terminalOps.includes(event.toolName)) {\n // Extract command from args\n const cmd = event.args?.command || '';\n const truncated = cmd.length > 80 ? `${cmd.slice(0, 80)}…` : cmd;\n return `[cmd] ${truncated}`;\n }\n\n // Skip other tools from persistence\n return null;\n }\n\n private formatToolResultEvent(event: Extract<AgentEvent, { type: 'tool_result' }>): string | null {\n // We don't need to log tool results separately - tool calls are sufficient\n // This keeps the log concise\n return null;\n }\n}\n"],"names":[],"mappings":"AAQA;;;;;AAKG;MACU,oBAAoB,CAAA;AACvB,IAAA,UAAU;AACV,IAAA,MAAM;AACN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AG,EAAE,GAAG,CAAA,EAAG,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,GAAG,GAAG;YAChE,OAAO,CAAA,MAAA,EAAS,SAAS,CAAA,CAAE;QAC7B;;AAGA,QAAA,OAAO,IAAI;IACb;AAEQ,IAAA,qBAAqB,CAAC,KAAmD,EAAA;;;AAG/E,QAAA,OAAO,IAAI;IACb;AACD;;;;"}
|
|
1
|
+
{"version":3,"file":"task-progress-reporter.js","sources":["../../src/task-progress-reporter.ts"],"sourcesContent":["import type { Logger } from './utils/logger.js';\nimport type { PostHogAPIClient, TaskRunUpdate } from './posthog-api.js';\nimport type { AgentEvent, TaskRun, LogEntry } from './types.js';\n\ninterface ProgressMetadata {\n totalSteps?: number;\n}\n\n/**\n * Persists task execution progress to PostHog so clients can poll for updates.\n *\n * The reporter is intentionally best-effort – failures are logged but never\n * allowed to break the agent execution flow.\n */\nexport class TaskProgressReporter {\n private posthogAPI?: PostHogAPIClient;\n private logger: Logger;\n private taskRun?: TaskRun;\n private taskId?: string;\n private outputLog: string[] = [];\n private totalSteps?: number;\n private lastLogEntry?: string;\n private tokenBuffer: string = '';\n private tokenCount: number = 0;\n private tokenFlushTimer?: NodeJS.Timeout;\n private readonly TOKEN_BATCH_SIZE = 100;\n private readonly TOKEN_FLUSH_INTERVAL_MS = 1000;\n private logWriteQueue: Promise<void> = Promise.resolve();\n private readonly LOG_APPEND_MAX_RETRIES = 3;\n private readonly LOG_APPEND_RETRY_BASE_DELAY_MS = 200;\n\n constructor(posthogAPI: PostHogAPIClient | undefined, logger: Logger) {\n this.posthogAPI = posthogAPI;\n this.logger = logger.child('TaskProgressReporter');\n }\n\n get runId(): string | undefined {\n return this.taskRun?.id;\n }\n\n async start(taskId: string, metadata: ProgressMetadata = {}): Promise<void> {\n if (!this.posthogAPI) {\n return;\n }\n\n this.taskId = taskId;\n this.totalSteps = metadata.totalSteps;\n\n try {\n const run = await this.posthogAPI.createTaskRun(taskId, {\n status: 'started',\n });\n this.taskRun = run;\n this.outputLog = [];\n this.logger.debug('Created task run', { taskId, runId: run.id });\n } catch (error) {\n this.logger.warn('Failed to create task run', { taskId, error: (error as Error).message });\n }\n }\n\n async complete(): Promise<void> {\n await this.flushTokens(); // Flush any remaining tokens before completion\n if (this.tokenFlushTimer) {\n clearTimeout(this.tokenFlushTimer);\n this.tokenFlushTimer = undefined;\n }\n await this.update({ status: 'completed' }, 'Task execution completed');\n }\n\n async fail(error: Error | string): Promise<void> {\n const message = typeof error === 'string' ? error : error.message;\n await this.update({ status: 'failed', error_message: message }, `Task execution failed: ${message}`);\n }\n\n async appendLog(line: string): Promise<void> {\n await this.update({}, line);\n }\n\n private async flushTokens(): Promise<void> {\n if (!this.tokenBuffer || this.tokenCount === 0) {\n return;\n }\n\n const buffer = this.tokenBuffer;\n this.tokenBuffer = '';\n this.tokenCount = 0;\n\n await this.appendLogEntry({\n type: 'token',\n message: buffer,\n });\n }\n\n private scheduleTokenFlush(): void {\n if (this.tokenFlushTimer) {\n return;\n }\n\n this.tokenFlushTimer = setTimeout(() => {\n this.tokenFlushTimer = undefined;\n this.flushTokens().catch((err) => {\n this.logger.warn('Failed to flush tokens', { error: err });\n });\n }, this.TOKEN_FLUSH_INTERVAL_MS);\n }\n\n private appendLogEntry(entry: LogEntry): Promise<void> {\n if (!this.posthogAPI || !this.runId || !this.taskId) {\n return Promise.resolve();\n }\n\n const taskId = this.taskId;\n const runId = this.runId;\n\n this.logWriteQueue = this.logWriteQueue\n .catch((error) => {\n // Ensure previous failures don't block subsequent writes\n this.logger.debug('Previous log append failed', {\n taskId,\n runId,\n error: error instanceof Error ? error.message : String(error),\n });\n })\n .then(() => this.writeLogEntry(taskId, runId, entry));\n\n return this.logWriteQueue;\n }\n\n private async writeLogEntry(\n taskId: string,\n runId: string,\n entry: LogEntry,\n ): Promise<void> {\n if (!this.posthogAPI) {\n return;\n }\n\n for (let attempt = 1; attempt <= this.LOG_APPEND_MAX_RETRIES; attempt++) {\n try {\n await this.posthogAPI.appendTaskRunLog(taskId, runId, [entry]);\n return;\n } catch (error) {\n this.logger.warn('Failed to append log entry', {\n taskId,\n runId,\n attempt,\n maxAttempts: this.LOG_APPEND_MAX_RETRIES,\n error: (error as Error).message,\n });\n\n if (attempt === this.LOG_APPEND_MAX_RETRIES) {\n return;\n }\n\n const delayMs =\n this.LOG_APPEND_RETRY_BASE_DELAY_MS * Math.pow(2, attempt - 1);\n await new Promise((resolve) => setTimeout(resolve, delayMs));\n }\n }\n }\n\n async recordEvent(event: AgentEvent): Promise<void> {\n if (!this.posthogAPI || !this.runId || !this.taskId) {\n return;\n }\n\n switch (event.type) {\n case 'token': {\n // Batch tokens for efficiency\n this.tokenBuffer += event.content;\n this.tokenCount++;\n\n if (this.tokenCount >= this.TOKEN_BATCH_SIZE) {\n await this.flushTokens();\n if (this.tokenFlushTimer) {\n clearTimeout(this.tokenFlushTimer);\n this.tokenFlushTimer = undefined;\n }\n } else {\n this.scheduleTokenFlush();\n }\n return;\n }\n\n case 'content_block_start': {\n await this.appendLogEntry({\n type: 'content_block_start',\n message: JSON.stringify({\n index: event.index,\n contentType: event.contentType,\n toolName: event.toolName,\n toolId: event.toolId,\n ts: event.ts,\n }),\n });\n return;\n }\n\n case 'content_block_stop': {\n await this.appendLogEntry({\n type: 'content_block_stop',\n message: JSON.stringify({\n index: event.index,\n ts: event.ts,\n }),\n });\n return;\n }\n\n case 'message_start': {\n await this.appendLogEntry({\n type: 'message_start',\n message: JSON.stringify({\n messageId: event.messageId,\n model: event.model,\n ts: event.ts,\n }),\n });\n return;\n }\n\n case 'message_delta': {\n await this.appendLogEntry({\n type: 'message_delta',\n message: JSON.stringify({\n stopReason: event.stopReason,\n stopSequence: event.stopSequence,\n usage: event.usage,\n ts: event.ts,\n }),\n });\n return;\n }\n\n case 'message_stop': {\n await this.appendLogEntry({\n type: 'message_stop',\n message: JSON.stringify({ ts: event.ts }),\n });\n return;\n }\n\n case 'status': {\n await this.appendLogEntry({\n type: 'status',\n message: JSON.stringify({\n phase: event.phase,\n kind: event.kind,\n branch: event.branch,\n prUrl: event.prUrl,\n taskId: event.taskId,\n messageId: event.messageId,\n model: event.model,\n ts: event.ts,\n }),\n });\n return;\n }\n\n case 'artifact': {\n await this.appendLogEntry({\n type: 'artifact',\n message: JSON.stringify({\n kind: event.kind,\n content: event.content,\n ts: event.ts,\n }),\n });\n return;\n }\n\n case 'init': {\n await this.appendLogEntry({\n type: 'init',\n message: JSON.stringify({\n model: event.model,\n tools: event.tools,\n permissionMode: event.permissionMode,\n cwd: event.cwd,\n apiKeySource: event.apiKeySource,\n ts: event.ts,\n }),\n });\n return;\n }\n\n case 'metric': {\n await this.appendLogEntry({\n type: 'metric',\n message: JSON.stringify({\n key: event.key,\n value: event.value,\n unit: event.unit,\n ts: event.ts,\n }),\n });\n return;\n }\n\n case 'compact_boundary': {\n await this.appendLogEntry({\n type: 'compact_boundary',\n message: JSON.stringify({\n trigger: event.trigger,\n preTokens: event.preTokens,\n ts: event.ts,\n }),\n });\n return;\n }\n\n case 'tool_call': {\n await this.appendLogEntry({\n type: 'tool_call',\n message: JSON.stringify({\n toolName: event.toolName,\n callId: event.callId,\n args: event.args,\n parentToolUseId: event.parentToolUseId,\n ts: event.ts,\n }),\n });\n return;\n }\n\n case 'tool_result': {\n await this.appendLogEntry({\n type: 'tool_result',\n message: JSON.stringify({\n toolName: event.toolName,\n callId: event.callId,\n result: event.result,\n isError: event.isError,\n parentToolUseId: event.parentToolUseId,\n ts: event.ts,\n }),\n });\n return;\n }\n\n case 'error': {\n await this.appendLogEntry({\n type: 'error',\n message: JSON.stringify({\n message: event.message,\n errorType: event.errorType,\n context: event.context,\n ts: event.ts,\n }),\n });\n return;\n }\n\n case 'done': {\n await this.appendLogEntry({\n type: 'done',\n message: JSON.stringify({\n result: event.result,\n durationMs: event.durationMs,\n durationApiMs: event.durationApiMs,\n numTurns: event.numTurns,\n totalCostUsd: event.totalCostUsd,\n usage: event.usage,\n modelUsage: event.modelUsage,\n permissionDenials: event.permissionDenials,\n ts: event.ts,\n }),\n });\n return;\n }\n\n case 'user_message': {\n await this.appendLogEntry({\n type: 'user_message',\n message: JSON.stringify({\n content: event.content,\n isSynthetic: event.isSynthetic,\n ts: event.ts,\n }),\n });\n return;\n }\n\n case 'raw_sdk_event': {\n // Skip raw SDK events - too verbose for persistence\n return;\n }\n\n default:\n // For any unfamiliar event types, log them as-is\n this.logger.debug('Unknown event type', { type: (event as any).type });\n return;\n }\n }\n\n private async update(update: TaskRunUpdate, logLine?: string): Promise<void> {\n if (!this.posthogAPI || !this.runId || !this.taskId) {\n return;\n }\n\n // If there's a log line, append it separately using the append_log endpoint\n if (logLine && logLine !== this.lastLogEntry) {\n try {\n await this.posthogAPI.appendTaskRunLog(this.taskId, this.runId, [\n { type: 'info', message: logLine }\n ]);\n this.lastLogEntry = logLine;\n } catch (error) {\n this.logger.warn('Failed to append log entry', {\n taskId: this.taskId,\n runId: this.runId,\n error: (error as Error).message,\n });\n }\n }\n\n // Update other fields if provided\n if (Object.keys(update).length > 0) {\n try {\n const run = await this.posthogAPI.updateTaskRun(this.taskId, this.runId, update);\n this.taskRun = run;\n } catch (error) {\n this.logger.warn('Failed to update task run', {\n taskId: this.taskId,\n runId: this.runId,\n error: (error as Error).message,\n });\n }\n }\n }\n\n}\n"],"names":[],"mappings":"AAQA;;;;;AAKG;MACU,oBAAoB,CAAA;AACvB,IAAA,UAAU;AACV,IAAA,MAAM;AACN,IAAA,OAAO;AACP,IAAA,MAAM;IACN,SAAS,GAAa,EAAE;AACxB,IAAA,UAAU;AACV,IAAA,YAAY;IACZ,WAAW,GAAW,EAAE;IACxB,UAAU,GAAW,CAAC;AACtB,IAAA,eAAe;IACN,gBAAgB,GAAG,GAAG;IACtB,uBAAuB,GAAG,IAAI;AACvC,IAAA,aAAa,GAAkB,OAAO,CAAC,OAAO,EAAE;IACvC,sBAAsB,GAAG,CAAC;IAC1B,8BAA8B,GAAG,GAAG;IAErD,WAAA,CAAY,U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I,CAAC,OAAO,GAAG,GAAG;YACpB;YAAE,OAAO,KAAK,EAAE;AACd,gBAAA,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,2BAA2B,EAAE;oBAC5C,MAAM,EAAE,IAAI,CAAC,MAAM;oBACnB,KAAK,EAAE,IAAI,CAAC,KAAK;oBACjB,KAAK,EAAG,KAAe,CAAC,OAAO;AAChC,iBAAA,CAAC;YACJ;QACF;IACF;AAED;;;;"}
|
package/dist/src/types.d.ts
CHANGED
|
@@ -22,6 +22,15 @@ export interface LogEntry {
|
|
|
22
22
|
message: string;
|
|
23
23
|
[key: string]: unknown;
|
|
24
24
|
}
|
|
25
|
+
export type ArtifactType = 'plan' | 'context' | 'reference' | 'output' | 'artifact';
|
|
26
|
+
export interface TaskRunArtifact {
|
|
27
|
+
name: string;
|
|
28
|
+
type: ArtifactType;
|
|
29
|
+
size?: number;
|
|
30
|
+
content_type?: string;
|
|
31
|
+
storage_path?: string;
|
|
32
|
+
uploaded_at?: string;
|
|
33
|
+
}
|
|
25
34
|
export interface TaskRun {
|
|
26
35
|
id: string;
|
|
27
36
|
task: string;
|
|
@@ -32,6 +41,7 @@ export interface TaskRun {
|
|
|
32
41
|
error_message: string | null;
|
|
33
42
|
output: Record<string, unknown> | null;
|
|
34
43
|
state: Record<string, unknown>;
|
|
44
|
+
artifacts?: TaskRunArtifact[];
|
|
35
45
|
created_at: string;
|
|
36
46
|
updated_at: string;
|
|
37
47
|
completed_at: string | null;
|
|
@@ -39,9 +49,15 @@ export interface TaskRun {
|
|
|
39
49
|
export interface SupportingFile {
|
|
40
50
|
name: string;
|
|
41
51
|
content: string;
|
|
42
|
-
type:
|
|
52
|
+
type: ArtifactType;
|
|
43
53
|
created_at: string;
|
|
44
54
|
}
|
|
55
|
+
export interface TaskArtifactUploadPayload {
|
|
56
|
+
name: string;
|
|
57
|
+
type: ArtifactType;
|
|
58
|
+
content: string;
|
|
59
|
+
content_type?: string;
|
|
60
|
+
}
|
|
45
61
|
export declare enum PermissionMode {
|
|
46
62
|
PLAN = "plan",
|
|
47
63
|
DEFAULT = "default",
|
package/dist/src/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AACnF,YAAY,EAAE,UAAU,EAAE,gBAAgB,EAAE,CAAC;AAG7C,MAAM,WAAW,IAAI;IACnB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,EAAE,gBAAgB,GAAG,eAAe,GAAG,cAAc,GAAG,eAAe,GAAG,mBAAmB,CAAC;IAC5G,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,kBAAkB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACnC,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,eAAe,EAAE,MAAM,CAAC;IACxB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IAInB,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAGD,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAGD,MAAM,WAAW,OAAO;IACtB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC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