@posthog/agent 1.21.0 → 1.22.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.
@@ -1,6 +1,7 @@
1
1
  import type { LocalArtifact } from '../../file-manager.js';
2
2
  import type { Task, TaskRunArtifact } from '../../types.js';
3
3
  import type { WorkflowStepRunner } from '../types.js';
4
+ import { finalizeStepGitActions } from '../utils.js';
4
5
 
5
6
  const MAX_SNIPPET_LENGTH = 1200;
6
7
 
@@ -48,6 +49,12 @@ export const finalizeStep: WorkflowStepRunner = async ({ step, context }) => {
48
49
  const prBody = buildPullRequestBody(task, artifacts, uploadedArtifacts);
49
50
  await fileManager.cleanupTaskDirectory(task.id);
50
51
  await gitManager.addAllPostHogFiles();
52
+
53
+ // Commit the deletion of artifacts
54
+ await finalizeStepGitActions(context, step, {
55
+ commitMessage: `Cleanup task artifacts for ${task.title}`,
56
+ allowEmptyCommit: true
57
+ });
51
58
 
52
59
  context.stepResults[step.id] = {
53
60
  prBody,
@@ -78,7 +85,7 @@ function buildPullRequestBody(task: Task, artifacts: LocalArtifact[], uploaded?:
78
85
  if (contextArtifact) {
79
86
  lines.push('');
80
87
  lines.push('### Task prompt');
81
- lines.push(renderCodeFence(contextArtifact.content));
88
+ lines.push(contextArtifact.content);
82
89
  usedFiles.add(contextArtifact.name);
83
90
  }
84
91
 
@@ -96,7 +103,7 @@ function buildPullRequestBody(task: Task, artifacts: LocalArtifact[], uploaded?:
96
103
  if (planArtifact) {
97
104
  lines.push('');
98
105
  lines.push('### Implementation plan');
99
- lines.push(renderCodeFence(planArtifact.content));
106
+ lines.push(planArtifact.content);
100
107
  usedFiles.add(planArtifact.name);
101
108
  }
102
109
 
@@ -130,7 +137,9 @@ function buildPullRequestBody(task: Task, artifacts: LocalArtifact[], uploaded?:
130
137
  lines.push('');
131
138
  lines.push('### Uploaded artifacts');
132
139
  for (const artifact of artifactList) {
133
- const storage = 'storage_path' in artifact && artifact.storage_path ? ` – \`${artifact.storage_path}\`` : '';
140
+ const rawStoragePath = 'storage_path' in artifact ? (artifact as any).storage_path : undefined;
141
+ const storagePath = typeof rawStoragePath === 'string' ? rawStoragePath : undefined;
142
+ const storage = storagePath && storagePath.trim().length > 0 ? ` – \`${storagePath.trim()}\`` : '';
134
143
  lines.push(`- ${artifact.name} (${artifact.type})${storage}`);
135
144
  }
136
145
  }