@posthog/agent 1.21.0 → 1.24.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 +3 -3
- package/README.md +3 -3
- package/dist/claude-cli/cli.js +1396 -1347
- package/dist/index.d.ts +11 -11
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -3
- package/dist/src/adapters/claude/claude-adapter.d.ts +3 -3
- package/dist/src/adapters/claude/claude-adapter.d.ts.map +1 -1
- package/dist/src/adapters/claude/claude-adapter.js +156 -111
- package/dist/src/adapters/claude/claude-adapter.js.map +1 -1
- package/dist/src/adapters/claude/tool-mapper.d.ts +1 -1
- package/dist/src/adapters/claude/tool-mapper.d.ts.map +1 -1
- package/dist/src/adapters/claude/tool-mapper.js.map +1 -1
- package/dist/src/adapters/types.d.ts +1 -1
- package/dist/src/adapters/types.d.ts.map +1 -1
- package/dist/src/agent.d.ts +7 -7
- package/dist/src/agent.d.ts.map +1 -1
- package/dist/src/agent.js +143 -85
- package/dist/src/agent.js.map +1 -1
- package/dist/src/agents/execution.js.map +1 -1
- package/dist/src/agents/planning.js.map +1 -1
- package/dist/src/agents/research.js.map +1 -1
- package/dist/src/file-manager.d.ts +4 -4
- package/dist/src/file-manager.d.ts.map +1 -1
- package/dist/src/file-manager.js +59 -58
- package/dist/src/file-manager.js.map +1 -1
- package/dist/src/git-manager.d.ts +2 -1
- package/dist/src/git-manager.d.ts.map +1 -1
- package/dist/src/git-manager.js +99 -68
- package/dist/src/git-manager.js.map +1 -1
- package/dist/src/posthog-api.d.ts +2 -3
- package/dist/src/posthog-api.d.ts.map +1 -1
- package/dist/src/posthog-api.js +22 -22
- 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 +123 -93
- package/dist/src/prompt-builder.js.map +1 -1
- package/dist/src/task-manager.d.ts +4 -4
- package/dist/src/task-manager.d.ts.map +1 -1
- package/dist/src/task-manager.js +19 -18
- package/dist/src/task-manager.js.map +1 -1
- package/dist/src/task-progress-reporter.d.ts +3 -4
- package/dist/src/task-progress-reporter.d.ts.map +1 -1
- package/dist/src/task-progress-reporter.js +69 -53
- package/dist/src/task-progress-reporter.js.map +1 -1
- package/dist/src/template-manager.d.ts +1 -1
- package/dist/src/template-manager.d.ts.map +1 -1
- package/dist/src/template-manager.js +30 -28
- package/dist/src/template-manager.js.map +1 -1
- package/dist/src/todo-manager.d.ts +3 -3
- package/dist/src/todo-manager.d.ts.map +1 -1
- package/dist/src/todo-manager.js +29 -24
- package/dist/src/todo-manager.js.map +1 -1
- package/dist/src/tools/registry.d.ts +1 -1
- package/dist/src/tools/registry.js +60 -60
- package/dist/src/tools/registry.js.map +1 -1
- package/dist/src/tools/types.d.ts +31 -31
- package/dist/src/types.d.ts +33 -33
- package/dist/src/types.d.ts.map +1 -1
- package/dist/src/types.js.map +1 -1
- package/dist/src/utils/logger.d.ts +4 -4
- package/dist/src/utils/logger.d.ts.map +1 -1
- package/dist/src/utils/logger.js +8 -8
- package/dist/src/utils/logger.js.map +1 -1
- package/dist/src/workflow/config.d.ts +1 -1
- package/dist/src/workflow/config.d.ts.map +1 -1
- package/dist/src/workflow/config.js +18 -18
- package/dist/src/workflow/config.js.map +1 -1
- package/dist/src/workflow/steps/build.d.ts +1 -1
- package/dist/src/workflow/steps/build.d.ts.map +1 -1
- package/dist/src/workflow/steps/build.js +46 -38
- package/dist/src/workflow/steps/build.js.map +1 -1
- package/dist/src/workflow/steps/finalize.d.ts +1 -1
- package/dist/src/workflow/steps/finalize.d.ts.map +1 -1
- package/dist/src/workflow/steps/finalize.js +62 -47
- package/dist/src/workflow/steps/finalize.js.map +1 -1
- package/dist/src/workflow/steps/plan.d.ts +1 -1
- package/dist/src/workflow/steps/plan.d.ts.map +1 -1
- package/dist/src/workflow/steps/plan.js +58 -46
- package/dist/src/workflow/steps/plan.js.map +1 -1
- package/dist/src/workflow/steps/research.d.ts +1 -1
- package/dist/src/workflow/steps/research.d.ts.map +1 -1
- package/dist/src/workflow/steps/research.js +68 -56
- package/dist/src/workflow/steps/research.js.map +1 -1
- package/dist/src/workflow/types.d.ts +12 -12
- package/dist/src/workflow/types.d.ts.map +1 -1
- package/dist/src/workflow/utils.d.ts +1 -1
- package/dist/src/workflow/utils.d.ts.map +1 -1
- package/dist/src/workflow/utils.js +7 -4
- package/dist/src/workflow/utils.js.map +1 -1
- package/package.json +9 -9
- package/src/adapters/claude/claude-adapter.ts +220 -168
- package/src/adapters/claude/tool-mapper.ts +2 -2
- package/src/adapters/types.ts +1 -1
- package/src/agent.ts +579 -444
- package/src/agents/execution.ts +1 -1
- package/src/agents/planning.ts +1 -1
- package/src/agents/research.ts +0 -1
- package/src/file-manager.ts +64 -63
- package/src/git-manager.ts +159 -86
- package/src/posthog-api.ts +122 -82
- package/src/prompt-builder.ts +180 -135
- package/src/task-manager.ts +38 -30
- package/src/task-progress-reporter.ts +80 -58
- package/src/template-manager.ts +98 -45
- package/src/todo-manager.ts +35 -30
- package/src/tools/registry.ts +62 -62
- package/src/tools/types.ts +36 -36
- package/src/types.ts +93 -71
- package/src/utils/logger.ts +62 -56
- package/src/workflow/config.ts +48 -48
- package/src/workflow/steps/build.ts +122 -113
- package/src/workflow/steps/finalize.ts +218 -177
- package/src/workflow/steps/plan.ts +151 -131
- package/src/workflow/steps/research.ts +205 -186
- package/src/workflow/types.ts +38 -36
- package/src/workflow/utils.ts +37 -34
- package/LICENSE +0 -33
|
@@ -1,25 +1,27 @@
|
|
|
1
1
|
import { query } from '@anthropic-ai/claude-agent-sdk';
|
|
2
2
|
import { EXECUTION_SYSTEM_PROMPT } from '../../agents/execution.js';
|
|
3
|
-
import { PermissionMode } from '../../types.js';
|
|
4
3
|
import { TodoManager } from '../../todo-manager.js';
|
|
4
|
+
import { PermissionMode } from '../../types.js';
|
|
5
5
|
|
|
6
6
|
const buildStep = async ({ step, context }) => {
|
|
7
7
|
const { task, cwd, options, logger, promptBuilder, adapter, mcpServers, gitManager, emitEvent, } = context;
|
|
8
|
-
const stepLogger = logger.child(
|
|
8
|
+
const stepLogger = logger.child("BuildStep");
|
|
9
9
|
const latestRun = task.latest_run;
|
|
10
|
-
const prExists = latestRun?.output && typeof latestRun.output ===
|
|
10
|
+
const prExists = latestRun?.output && typeof latestRun.output === "object"
|
|
11
11
|
? latestRun.output.pr_url
|
|
12
12
|
: null;
|
|
13
13
|
if (prExists) {
|
|
14
|
-
stepLogger.info(
|
|
15
|
-
|
|
14
|
+
stepLogger.info("PR already exists, skipping build phase", {
|
|
15
|
+
taskId: task.id,
|
|
16
|
+
});
|
|
17
|
+
return { status: "skipped" };
|
|
16
18
|
}
|
|
17
|
-
stepLogger.info(
|
|
18
|
-
emitEvent(adapter.createStatusEvent(
|
|
19
|
+
stepLogger.info("Starting build phase", { taskId: task.id });
|
|
20
|
+
emitEvent(adapter.createStatusEvent("phase_start", { phase: "build" }));
|
|
19
21
|
const executionPrompt = await promptBuilder.buildExecutionPrompt(task, cwd);
|
|
20
22
|
const fullPrompt = `${EXECUTION_SYSTEM_PROMPT}\n\n${executionPrompt}`;
|
|
21
23
|
const configuredPermissionMode = options.permissionMode ??
|
|
22
|
-
(typeof step.permissionMode ===
|
|
24
|
+
(typeof step.permissionMode === "string"
|
|
23
25
|
? step.permissionMode
|
|
24
26
|
: step.permissionMode) ??
|
|
25
27
|
PermissionMode.ACCEPT_EDITS;
|
|
@@ -27,25 +29,25 @@ const buildStep = async ({ step, context }) => {
|
|
|
27
29
|
model: step.model,
|
|
28
30
|
cwd,
|
|
29
31
|
permissionMode: configuredPermissionMode,
|
|
30
|
-
settingSources: [
|
|
32
|
+
settingSources: ["local"],
|
|
31
33
|
mcpServers,
|
|
32
34
|
// Allow all tools for build phase - full read/write access needed for implementation
|
|
33
35
|
allowedTools: [
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
36
|
+
"Task",
|
|
37
|
+
"Bash",
|
|
38
|
+
"BashOutput",
|
|
39
|
+
"KillBash",
|
|
40
|
+
"Edit",
|
|
41
|
+
"Read",
|
|
42
|
+
"Write",
|
|
43
|
+
"Glob",
|
|
44
|
+
"Grep",
|
|
45
|
+
"NotebookEdit",
|
|
46
|
+
"WebFetch",
|
|
47
|
+
"WebSearch",
|
|
48
|
+
"ListMcpResources",
|
|
49
|
+
"ReadMcpResource",
|
|
50
|
+
"TodoWrite",
|
|
49
51
|
],
|
|
50
52
|
};
|
|
51
53
|
// Add fine-grained permission hook if provided
|
|
@@ -60,17 +62,23 @@ const buildStep = async ({ step, context }) => {
|
|
|
60
62
|
const commitTracker = await gitManager.trackCommitsDuring();
|
|
61
63
|
// Track todos from TodoWrite tool calls
|
|
62
64
|
const todoManager = new TodoManager(context.fileManager, stepLogger);
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
65
|
+
try {
|
|
66
|
+
for await (const message of response) {
|
|
67
|
+
emitEvent(adapter.createRawSDKEvent(message));
|
|
68
|
+
const transformedEvents = adapter.transform(message);
|
|
69
|
+
for (const event of transformedEvents) {
|
|
70
|
+
emitEvent(event);
|
|
71
|
+
}
|
|
72
|
+
const todoList = await todoManager.checkAndPersistFromMessage(message, task.id);
|
|
73
|
+
if (todoList) {
|
|
74
|
+
emitEvent(adapter.createArtifactEvent("todos", todoList));
|
|
75
|
+
}
|
|
72
76
|
}
|
|
73
77
|
}
|
|
78
|
+
catch (error) {
|
|
79
|
+
stepLogger.error("Error during build step query", error);
|
|
80
|
+
throw error;
|
|
81
|
+
}
|
|
74
82
|
// Finalize: commit any remaining changes and optionally push
|
|
75
83
|
const { commitCreated, pushedBranch } = await commitTracker.finalize({
|
|
76
84
|
commitMessage: `Implementation for ${task.title}`,
|
|
@@ -78,16 +86,16 @@ const buildStep = async ({ step, context }) => {
|
|
|
78
86
|
});
|
|
79
87
|
context.stepResults[step.id] = { commitCreated };
|
|
80
88
|
if (!commitCreated) {
|
|
81
|
-
stepLogger.warn(
|
|
89
|
+
stepLogger.warn("No changes to commit in build phase", { taskId: task.id });
|
|
82
90
|
}
|
|
83
91
|
else {
|
|
84
|
-
stepLogger.info(
|
|
92
|
+
stepLogger.info("Build commits finalized", {
|
|
85
93
|
taskId: task.id,
|
|
86
|
-
pushedBranch
|
|
94
|
+
pushedBranch,
|
|
87
95
|
});
|
|
88
96
|
}
|
|
89
|
-
emitEvent(adapter.createStatusEvent(
|
|
90
|
-
return { status:
|
|
97
|
+
emitEvent(adapter.createStatusEvent("phase_complete", { phase: "build" }));
|
|
98
|
+
return { status: "completed" };
|
|
91
99
|
};
|
|
92
100
|
|
|
93
101
|
export { buildStep };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build.js","sources":["../../../../src/workflow/steps/build.ts"],"sourcesContent":["import { query } from
|
|
1
|
+
{"version":3,"file":"build.js","sources":["../../../../src/workflow/steps/build.ts"],"sourcesContent":["import { query } from \"@anthropic-ai/claude-agent-sdk\";\nimport { EXECUTION_SYSTEM_PROMPT } from \"../../agents/execution.js\";\nimport { TodoManager } from \"../../todo-manager.js\";\nimport { PermissionMode } from \"../../types.js\";\nimport type { WorkflowStepRunner } from \"../types.js\";\n\nexport const buildStep: WorkflowStepRunner = async ({ step, context }) => {\n const {\n task,\n cwd,\n options,\n logger,\n promptBuilder,\n adapter,\n mcpServers,\n gitManager,\n emitEvent,\n } = context;\n\n const stepLogger = logger.child(\"BuildStep\");\n\n const latestRun = task.latest_run;\n const prExists =\n latestRun?.output && typeof latestRun.output === \"object\"\n ? (latestRun.output as Record<string, unknown>).pr_url\n : null;\n\n if (prExists) {\n stepLogger.info(\"PR already exists, skipping build phase\", {\n taskId: task.id,\n });\n return { status: \"skipped\" };\n }\n\n stepLogger.info(\"Starting build phase\", { taskId: task.id });\n emitEvent(adapter.createStatusEvent(\"phase_start\", { phase: \"build\" }));\n\n const executionPrompt = await promptBuilder.buildExecutionPrompt(task, cwd);\n const fullPrompt = `${EXECUTION_SYSTEM_PROMPT}\\n\\n${executionPrompt}`;\n\n const configuredPermissionMode =\n options.permissionMode ??\n (typeof step.permissionMode === \"string\"\n ? (step.permissionMode as PermissionMode)\n : step.permissionMode) ??\n PermissionMode.ACCEPT_EDITS;\n\n const baseOptions: Record<string, unknown> = {\n model: step.model,\n cwd,\n permissionMode: configuredPermissionMode,\n settingSources: [\"local\"],\n mcpServers,\n // Allow all tools for build phase - full read/write access needed for implementation\n allowedTools: [\n \"Task\",\n \"Bash\",\n \"BashOutput\",\n \"KillBash\",\n \"Edit\",\n \"Read\",\n \"Write\",\n \"Glob\",\n \"Grep\",\n \"NotebookEdit\",\n \"WebFetch\",\n \"WebSearch\",\n \"ListMcpResources\",\n \"ReadMcpResource\",\n \"TodoWrite\",\n ],\n };\n\n // Add fine-grained permission hook if provided\n if (options.canUseTool) {\n baseOptions.canUseTool = options.canUseTool;\n }\n\n const response = query({\n prompt: fullPrompt,\n options: { ...baseOptions, ...(options.queryOverrides || {}) },\n });\n\n // Track commits made during Claude Code execution\n const commitTracker = await gitManager.trackCommitsDuring();\n\n // Track todos from TodoWrite tool calls\n const todoManager = new TodoManager(context.fileManager, stepLogger);\n\n try {\n for await (const message of response) {\n emitEvent(adapter.createRawSDKEvent(message));\n const transformedEvents = adapter.transform(message);\n for (const event of transformedEvents) {\n emitEvent(event);\n }\n\n const todoList = await todoManager.checkAndPersistFromMessage(\n message,\n task.id,\n );\n if (todoList) {\n emitEvent(adapter.createArtifactEvent(\"todos\", todoList));\n }\n }\n } catch (error) {\n stepLogger.error(\"Error during build step query\", error);\n throw error;\n }\n\n // Finalize: commit any remaining changes and optionally push\n const { commitCreated, pushedBranch } = await commitTracker.finalize({\n commitMessage: `Implementation for ${task.title}`,\n push: step.push,\n });\n\n context.stepResults[step.id] = { commitCreated };\n\n if (!commitCreated) {\n stepLogger.warn(\"No changes to commit in build phase\", { taskId: task.id });\n } else {\n stepLogger.info(\"Build commits finalized\", {\n taskId: task.id,\n pushedBranch,\n });\n }\n\n emitEvent(adapter.createStatusEvent(\"phase_complete\", { phase: \"build\" }));\n return { status: \"completed\" };\n};\n"],"names":[],"mappings":";;;;;AAMO,MAAM,SAAS,GAAuB,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,KAAI;IACvE,MAAM,EACJ,IAAI,EACJ,GAAG,EACH,OAAO,EACP,MAAM,EACN,aAAa,EACb,OAAO,EACP,UAAU,EACV,UAAU,EACV,SAAS,GACV,GAAG,OAAO;IAEX,MAAM,UAAU,GAAG,MAAM,CAAC,KAAK,CAAC,WAAW,CAAC;AAE5C,IAAA,MAAM,SAAS,GAAG,IAAI,CAAC,UAAU;IACjC,MAAM,QAAQ,GACZ,SAAS,EAAE,MAAM,IAAI,OAAO,SAAS,CAAC,MAAM,KAAK;AAC/C,UAAG,SAAS,CAAC,MAAkC,CAAC;UAC9C,IAAI;IAEV,IAAI,QAAQ,EAAE;AACZ,QAAA,UAAU,CAAC,IAAI,CAAC,yCAAyC,EAAE;YACzD,MAAM,EAAE,IAAI,CAAC,EAAE;AAChB,SAAA,CAAC;AACF,QAAA,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE;IAC9B;AAEA,IAAA,UAAU,CAAC,IAAI,CAAC,sBAAsB,EAAE,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC;AAC5D,IAAA,SAAS,CAAC,OAAO,CAAC,iBAAiB,CAAC,aAAa,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC,CAAC;IAEvE,MAAM,eAAe,GAAG,MAAM,aAAa,CAAC,oBAAoB,CAAC,IAAI,EAAE,GAAG,CAAC;AAC3E,IAAA,MAAM,UAAU,GAAG,C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"mappings":"AAEA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"finalize.d.ts","sourceRoot":"","sources":["../../../../src/workflow/steps/finalize.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAKtD,eAAO,MAAM,YAAY,EAAE,kBA8D1B,CAAC"}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
import { finalizeStepGitActions } from '../utils.js';
|
|
2
|
+
|
|
1
3
|
const MAX_SNIPPET_LENGTH = 1200;
|
|
2
4
|
const finalizeStep = async ({ step, context }) => {
|
|
3
5
|
const { task, logger, fileManager, gitManager, posthogAPI, progressReporter, } = context;
|
|
4
|
-
const stepLogger = logger.child(
|
|
6
|
+
const stepLogger = logger.child("FinalizeStep");
|
|
5
7
|
const artifacts = await fileManager.collectTaskArtifacts(task.id);
|
|
6
8
|
let uploadedArtifacts;
|
|
7
9
|
if (artifacts.length && posthogAPI && progressReporter.runId) {
|
|
@@ -13,20 +15,20 @@ const finalizeStep = async ({ step, context }) => {
|
|
|
13
15
|
content_type: artifact.contentType,
|
|
14
16
|
}));
|
|
15
17
|
uploadedArtifacts = await posthogAPI.uploadTaskArtifacts(task.id, progressReporter.runId, payload);
|
|
16
|
-
stepLogger.info(
|
|
18
|
+
stepLogger.info("Uploaded task artifacts to PostHog", {
|
|
17
19
|
taskId: task.id,
|
|
18
20
|
uploadedCount: uploadedArtifacts.length,
|
|
19
21
|
});
|
|
20
22
|
}
|
|
21
23
|
catch (error) {
|
|
22
|
-
stepLogger.warn(
|
|
24
|
+
stepLogger.warn("Failed to upload task artifacts", {
|
|
23
25
|
taskId: task.id,
|
|
24
26
|
error: error instanceof Error ? error.message : String(error),
|
|
25
27
|
});
|
|
26
28
|
}
|
|
27
29
|
}
|
|
28
30
|
else {
|
|
29
|
-
stepLogger.debug(
|
|
31
|
+
stepLogger.debug("Skipping artifact upload", {
|
|
30
32
|
hasArtifacts: artifacts.length > 0,
|
|
31
33
|
hasPostHogApi: Boolean(posthogAPI),
|
|
32
34
|
runId: progressReporter.runId,
|
|
@@ -35,84 +37,96 @@ const finalizeStep = async ({ step, context }) => {
|
|
|
35
37
|
const prBody = buildPullRequestBody(task, artifacts, uploadedArtifacts);
|
|
36
38
|
await fileManager.cleanupTaskDirectory(task.id);
|
|
37
39
|
await gitManager.addAllPostHogFiles();
|
|
40
|
+
// Commit the deletion of artifacts
|
|
41
|
+
await finalizeStepGitActions(context, step, {
|
|
42
|
+
commitMessage: `Cleanup task artifacts for ${task.title}`,
|
|
43
|
+
allowEmptyCommit: true,
|
|
44
|
+
});
|
|
38
45
|
context.stepResults[step.id] = {
|
|
39
46
|
prBody,
|
|
40
47
|
uploadedArtifacts,
|
|
41
48
|
artifactCount: artifacts.length,
|
|
42
49
|
};
|
|
43
|
-
return { status:
|
|
50
|
+
return { status: "completed" };
|
|
44
51
|
};
|
|
45
52
|
function buildPullRequestBody(task, artifacts, uploaded) {
|
|
46
53
|
const lines = [];
|
|
47
54
|
const taskSlug = task.slug || task.id;
|
|
48
|
-
lines.push(
|
|
55
|
+
lines.push("## Task context");
|
|
49
56
|
lines.push(`- **Task**: ${taskSlug}`);
|
|
50
57
|
lines.push(`- **Title**: ${task.title}`);
|
|
51
58
|
lines.push(`- **Origin**: ${task.origin_product}`);
|
|
52
59
|
if (task.description) {
|
|
53
|
-
lines.push(
|
|
54
|
-
lines.push(
|
|
60
|
+
lines.push("");
|
|
61
|
+
lines.push(`> ${task.description.trim().split("\n").join("\n> ")}`);
|
|
55
62
|
}
|
|
56
63
|
const usedFiles = new Set();
|
|
57
|
-
const contextArtifact = artifacts.find((artifact) => artifact.name ===
|
|
64
|
+
const contextArtifact = artifacts.find((artifact) => artifact.name === "context.md");
|
|
58
65
|
if (contextArtifact) {
|
|
59
|
-
lines.push(
|
|
60
|
-
lines.push(
|
|
61
|
-
lines.push(
|
|
66
|
+
lines.push("");
|
|
67
|
+
lines.push("### Task prompt");
|
|
68
|
+
lines.push(contextArtifact.content);
|
|
62
69
|
usedFiles.add(contextArtifact.name);
|
|
63
70
|
}
|
|
64
|
-
const researchArtifact = artifacts.find((artifact) => artifact.name ===
|
|
71
|
+
const researchArtifact = artifacts.find((artifact) => artifact.name === "research.json");
|
|
65
72
|
if (researchArtifact) {
|
|
66
73
|
usedFiles.add(researchArtifact.name);
|
|
67
74
|
const researchSection = formatResearchSection(researchArtifact.content);
|
|
68
75
|
if (researchSection) {
|
|
69
|
-
lines.push(
|
|
76
|
+
lines.push("");
|
|
70
77
|
lines.push(researchSection);
|
|
71
78
|
}
|
|
72
79
|
}
|
|
73
|
-
const planArtifact = artifacts.find((artifact) => artifact.name ===
|
|
80
|
+
const planArtifact = artifacts.find((artifact) => artifact.name === "plan.md");
|
|
74
81
|
if (planArtifact) {
|
|
75
|
-
lines.push(
|
|
76
|
-
lines.push(
|
|
77
|
-
lines.push(
|
|
82
|
+
lines.push("");
|
|
83
|
+
lines.push("### Implementation plan");
|
|
84
|
+
lines.push(planArtifact.content);
|
|
78
85
|
usedFiles.add(planArtifact.name);
|
|
79
86
|
}
|
|
80
|
-
const todoArtifact = artifacts.find((artifact) => artifact.name ===
|
|
87
|
+
const todoArtifact = artifacts.find((artifact) => artifact.name === "todos.json");
|
|
81
88
|
if (todoArtifact) {
|
|
82
89
|
const summary = summarizeTodos(todoArtifact.content);
|
|
83
90
|
if (summary) {
|
|
84
|
-
lines.push(
|
|
85
|
-
lines.push(
|
|
91
|
+
lines.push("");
|
|
92
|
+
lines.push("### Todo list");
|
|
86
93
|
lines.push(summary);
|
|
87
94
|
}
|
|
88
95
|
usedFiles.add(todoArtifact.name);
|
|
89
96
|
}
|
|
90
97
|
const remainingArtifacts = artifacts.filter((artifact) => !usedFiles.has(artifact.name));
|
|
91
98
|
if (remainingArtifacts.length) {
|
|
92
|
-
lines.push(
|
|
93
|
-
lines.push(
|
|
99
|
+
lines.push("");
|
|
100
|
+
lines.push("### Additional artifacts");
|
|
94
101
|
for (const artifact of remainingArtifacts) {
|
|
95
102
|
lines.push(`#### ${artifact.name}`);
|
|
96
103
|
lines.push(renderCodeFence(artifact.content));
|
|
97
104
|
}
|
|
98
105
|
}
|
|
99
|
-
const artifactList = uploaded ??
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
106
|
+
const artifactList = uploaded ??
|
|
107
|
+
artifacts.map((artifact) => ({
|
|
108
|
+
name: artifact.name,
|
|
109
|
+
type: artifact.type,
|
|
110
|
+
}));
|
|
103
111
|
if (artifactList.length) {
|
|
104
|
-
lines.push(
|
|
105
|
-
lines.push(
|
|
112
|
+
lines.push("");
|
|
113
|
+
lines.push("### Uploaded artifacts");
|
|
106
114
|
for (const artifact of artifactList) {
|
|
107
|
-
const
|
|
115
|
+
const rawStoragePath = "storage_path" in artifact
|
|
116
|
+
? artifact.storage_path
|
|
117
|
+
: undefined;
|
|
118
|
+
const storagePath = typeof rawStoragePath === "string" ? rawStoragePath : undefined;
|
|
119
|
+
const storage = storagePath && storagePath.trim().length > 0
|
|
120
|
+
? ` – \`${storagePath.trim()}\``
|
|
121
|
+
: "";
|
|
108
122
|
lines.push(`- ${artifact.name} (${artifact.type})${storage}`);
|
|
109
123
|
}
|
|
110
124
|
}
|
|
111
|
-
return lines.join(
|
|
125
|
+
return lines.join("\n\n");
|
|
112
126
|
}
|
|
113
127
|
function renderCodeFence(content) {
|
|
114
128
|
const snippet = truncate(content, MAX_SNIPPET_LENGTH);
|
|
115
|
-
return [
|
|
129
|
+
return ["```", snippet, "```"].join("\n");
|
|
116
130
|
}
|
|
117
131
|
function truncate(value, maxLength) {
|
|
118
132
|
if (value.length <= maxLength) {
|
|
@@ -125,25 +139,27 @@ function formatResearchSection(content) {
|
|
|
125
139
|
const parsed = JSON.parse(content);
|
|
126
140
|
const sections = [];
|
|
127
141
|
if (parsed.context) {
|
|
128
|
-
sections.push(
|
|
142
|
+
sections.push("### Research summary");
|
|
129
143
|
sections.push(parsed.context);
|
|
130
144
|
}
|
|
131
|
-
if (parsed.questions
|
|
132
|
-
sections.push(
|
|
133
|
-
sections.push(
|
|
145
|
+
if (parsed.questions?.length) {
|
|
146
|
+
sections.push("");
|
|
147
|
+
sections.push("### Questions needing answers");
|
|
134
148
|
for (const question of parsed.questions) {
|
|
135
149
|
sections.push(`- ${question.question ?? question}`);
|
|
136
150
|
}
|
|
137
151
|
}
|
|
138
|
-
if (parsed.answers
|
|
139
|
-
sections.push(
|
|
140
|
-
sections.push(
|
|
152
|
+
if (parsed.answers?.length) {
|
|
153
|
+
sections.push("");
|
|
154
|
+
sections.push("### Answers provided");
|
|
141
155
|
for (const answer of parsed.answers) {
|
|
142
|
-
const questionId = answer.questionId
|
|
143
|
-
|
|
156
|
+
const questionId = answer.questionId
|
|
157
|
+
? ` (Q: ${answer.questionId})`
|
|
158
|
+
: "";
|
|
159
|
+
sections.push(`- ${answer.selectedOption || answer.customInput || "answer"}${questionId}`);
|
|
144
160
|
}
|
|
145
161
|
}
|
|
146
|
-
return sections.length ? sections.join(
|
|
162
|
+
return sections.length ? sections.join("\n") : null;
|
|
147
163
|
}
|
|
148
164
|
catch {
|
|
149
165
|
return null;
|
|
@@ -153,16 +169,15 @@ function summarizeTodos(content) {
|
|
|
153
169
|
try {
|
|
154
170
|
const data = JSON.parse(content);
|
|
155
171
|
const total = data?.metadata?.total ?? data?.items?.length;
|
|
156
|
-
const completed = data?.metadata?.completed ??
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
];
|
|
172
|
+
const completed = data?.metadata?.completed ??
|
|
173
|
+
data?.items?.filter((item) => item.status === "completed").length;
|
|
174
|
+
const lines = [`Progress: ${completed}/${total} completed`];
|
|
160
175
|
if (data?.items?.length) {
|
|
161
176
|
for (const item of data.items) {
|
|
162
177
|
lines.push(`- [${item.status}] ${item.content}`);
|
|
163
178
|
}
|
|
164
179
|
}
|
|
165
|
-
return lines.join(
|
|
180
|
+
return lines.join("\n");
|
|
166
181
|
}
|
|
167
182
|
catch {
|
|
168
183
|
return null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"finalize.js","sources":["../../../../src/workflow/steps/finalize.ts"],"sourcesContent":["import type { LocalArtifact } from '../../file-manager.js';\nimport type { Task, TaskRunArtifact } from '../../types.js';\nimport type { WorkflowStepRunner } from '../types.js';\n\nconst MAX_SNIPPET_LENGTH = 1200;\n\nexport const finalizeStep: WorkflowStepRunner = async ({ step, context }) => {\n const {\n task,\n logger,\n fileManager,\n gitManager,\n posthogAPI,\n progressReporter,\n } = context;\n\n const stepLogger = logger.child('FinalizeStep');\n const artifacts = await fileManager.collectTaskArtifacts(task.id);\n let uploadedArtifacts: TaskRunArtifact[] | undefined;\n\n if (artifacts.length && posthogAPI && progressReporter.runId) {\n try {\n const payload = artifacts.map((artifact) => ({\n name: artifact.name,\n type: artifact.type,\n content: artifact.content,\n content_type: artifact.contentType,\n }));\n uploadedArtifacts = await posthogAPI.uploadTaskArtifacts(task.id, progressReporter.runId, payload);\n stepLogger.info('Uploaded task artifacts to PostHog', {\n taskId: task.id,\n uploadedCount: uploadedArtifacts.length,\n });\n } catch (error) {\n stepLogger.warn('Failed to upload task artifacts', {\n taskId: task.id,\n error: error instanceof Error ? error.message : String(error),\n });\n }\n } else {\n stepLogger.debug('Skipping artifact upload', {\n hasArtifacts: artifacts.length > 0,\n hasPostHogApi: Boolean(posthogAPI),\n runId: progressReporter.runId,\n });\n }\n\n const prBody = buildPullRequestBody(task, artifacts, uploadedArtifacts);\n await fileManager.cleanupTaskDirectory(task.id);\n await gitManager.addAllPostHogFiles();\n\n context.stepResults[step.id] = {\n prBody,\n uploadedArtifacts,\n artifactCount: artifacts.length,\n };\n\n return { status: 'completed' };\n};\n\nfunction buildPullRequestBody(task: Task, artifacts: LocalArtifact[], uploaded?: TaskRunArtifact[]): string {\n const lines: string[] = [];\n const taskSlug = (task as any).slug || task.id;\n\n lines.push('## Task context');\n lines.push(`- **Task**: ${taskSlug}`);\n lines.push(`- **Title**: ${task.title}`);\n lines.push(`- **Origin**: ${task.origin_product}`);\n\n if (task.description) {\n lines.push('');\n lines.push('> ' + task.description.trim().split('\\n').join('\\n> '));\n }\n\n const usedFiles = new Set<string>();\n\n const contextArtifact = artifacts.find((artifact) => artifact.name === 'context.md');\n if (contextArtifact) {\n lines.push('');\n lines.push('### Task prompt');\n lines.push(renderCodeFence(contextArtifact.content));\n usedFiles.add(contextArtifact.name);\n }\n\n const researchArtifact = artifacts.find((artifact) => artifact.name === 'research.json');\n if (researchArtifact) {\n usedFiles.add(researchArtifact.name);\n const researchSection = formatResearchSection(researchArtifact.content);\n if (researchSection) {\n lines.push('');\n lines.push(researchSection);\n }\n }\n\n const planArtifact = artifacts.find((artifact) => artifact.name === 'plan.md');\n if (planArtifact) {\n lines.push('');\n lines.push('### Implementation plan');\n lines.push(renderCodeFence(planArtifact.content));\n usedFiles.add(planArtifact.name);\n }\n\n const todoArtifact = artifacts.find((artifact) => artifact.name === 'todos.json');\n if (todoArtifact) {\n const summary = summarizeTodos(todoArtifact.content);\n if (summary) {\n lines.push('');\n lines.push('### Todo list');\n lines.push(summary);\n }\n usedFiles.add(todoArtifact.name);\n }\n\n const remainingArtifacts = artifacts.filter((artifact) => !usedFiles.has(artifact.name));\n if (remainingArtifacts.length) {\n lines.push('');\n lines.push('### Additional artifacts');\n for (const artifact of remainingArtifacts) {\n lines.push(`#### ${artifact.name}`);\n lines.push(renderCodeFence(artifact.content));\n }\n }\n\n const artifactList = uploaded ?? artifacts.map((artifact) => ({\n name: artifact.name,\n type: artifact.type,\n }));\n\n if (artifactList.length) {\n lines.push('');\n lines.push('### Uploaded artifacts');\n for (const artifact of artifactList) {\n const storage = 'storage_path' in artifact && artifact.storage_path ? ` – \\`${artifact.storage_path}\\`` : '';\n lines.push(`- ${artifact.name} (${artifact.type})${storage}`);\n }\n }\n\n return lines.join('\\n\\n');\n}\n\nfunction renderCodeFence(content: string): string {\n const snippet = truncate(content, MAX_SNIPPET_LENGTH);\n return ['```', snippet, '```'].join('\\n');\n}\n\nfunction truncate(value: string, maxLength: number): string {\n if (value.length <= maxLength) {\n return value;\n }\n return `${value.slice(0, maxLength)}\\n…`;\n}\n\nfunction formatResearchSection(content: string): string | null {\n try {\n const parsed = JSON.parse(content);\n const sections: string[] = [];\n\n if (parsed.context) {\n sections.push('### Research summary');\n sections.push(parsed.context);\n }\n\n if (parsed.questions && parsed.questions.length) {\n sections.push('');\n sections.push('### Questions needing answers');\n for (const question of parsed.questions) {\n sections.push(`- ${question.question ?? question}`);\n }\n }\n\n if (parsed.answers && parsed.answers.length) {\n sections.push('');\n sections.push('### Answers provided');\n for (const answer of parsed.answers) {\n const questionId = answer.questionId ? ` (Q: ${answer.questionId})` : '';\n sections.push(`- ${answer.selectedOption || answer.customInput || 'answer'}${questionId}`);\n }\n }\n\n return sections.length ? sections.join('\\n') : null;\n } catch {\n return null;\n }\n}\n\nfunction summarizeTodos(content: string): string | null {\n try {\n const data = JSON.parse(content);\n const total = data?.metadata?.total ?? data?.items?.length;\n const completed = data?.metadata?.completed ?? data?.items?.filter((item: any) => item.status === 'completed').length;\n\n const lines = [\n `Progress: ${completed}/${total} completed`,\n ];\n\n if (data?.items?.length) {\n for (const item of data.items) {\n lines.push(`- [${item.status}] ${item.content}`);\n }\n }\n\n return lines.join('\\n');\n } catch {\n return null;\n }\n}\n\n"],"names":[],"mappings":"AAIA,MAAM,kBAAkB,GAAG,IAAI;AAExB,MAAM,YAAY,GAAuB,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,KAAI;AACxE,IAAA,MAAM,EACF,IAAI,EACJ,MAAM,EACN,WAAW,EACX,UAAU,EACV,UAAU,EACV,gBAAgB,GACnB,GAAG,OAAO;IAEX,MAAM,UAAU,GAAG,MAAM,CAAC,KAAK,CAAC,cAAc,CAAC;IAC/C,MAAM,SAAS,GAAG,MAAM,WAAW,CAAC,oBAAoB,CAAC,IAAI,CAAC,EAAE,CAAC;AACjE,IAAA,IAAI,iBAAgD;IAE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AM,IAAI,CAAC,MAAM,CAAA,EAAA,EAAK,IAAI,CAAC,OAAO,CAAA,CAAE,CAAC;YACpD;QACJ;AAEA,QAAA,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC;IAC3B;AAAE,IAAA,MAAM;AACJ,QAAA,OAAO,IAAI;IACf;AACJ;;;;"}
|
|
1
|
+
{"version":3,"file":"finalize.js","sources":["../../../../src/workflow/steps/finalize.ts"],"sourcesContent":["import type { LocalArtifact } from \"../../file-manager.js\";\nimport type { Task, TaskRunArtifact } from \"../../types.js\";\nimport type { WorkflowStepRunner } from \"../types.js\";\nimport { finalizeStepGitActions } from \"../utils.js\";\n\nconst MAX_SNIPPET_LENGTH = 1200;\n\nexport const finalizeStep: WorkflowStepRunner = async ({ step, context }) => {\n const {\n task,\n logger,\n fileManager,\n gitManager,\n posthogAPI,\n progressReporter,\n } = context;\n\n const stepLogger = logger.child(\"FinalizeStep\");\n const artifacts = await fileManager.collectTaskArtifacts(task.id);\n let uploadedArtifacts: TaskRunArtifact[] | undefined;\n\n if (artifacts.length && posthogAPI && progressReporter.runId) {\n try {\n const payload = artifacts.map((artifact) => ({\n name: artifact.name,\n type: artifact.type,\n content: artifact.content,\n content_type: artifact.contentType,\n }));\n uploadedArtifacts = await posthogAPI.uploadTaskArtifacts(\n task.id,\n progressReporter.runId,\n payload,\n );\n stepLogger.info(\"Uploaded task artifacts to PostHog\", {\n taskId: task.id,\n uploadedCount: uploadedArtifacts.length,\n });\n } catch (error) {\n stepLogger.warn(\"Failed to upload task artifacts\", {\n taskId: task.id,\n error: error instanceof Error ? error.message : String(error),\n });\n }\n } else {\n stepLogger.debug(\"Skipping artifact upload\", {\n hasArtifacts: artifacts.length > 0,\n hasPostHogApi: Boolean(posthogAPI),\n runId: progressReporter.runId,\n });\n }\n\n const prBody = buildPullRequestBody(task, artifacts, uploadedArtifacts);\n await fileManager.cleanupTaskDirectory(task.id);\n await gitManager.addAllPostHogFiles();\n\n // Commit the deletion of artifacts\n await finalizeStepGitActions(context, step, {\n commitMessage: `Cleanup task artifacts for ${task.title}`,\n allowEmptyCommit: true,\n });\n\n context.stepResults[step.id] = {\n prBody,\n uploadedArtifacts,\n artifactCount: artifacts.length,\n };\n\n return { status: \"completed\" };\n};\n\nfunction buildPullRequestBody(\n task: Task,\n artifacts: LocalArtifact[],\n uploaded?: TaskRunArtifact[],\n): string {\n const lines: string[] = [];\n const taskSlug = (task as unknown as Record<string, unknown>).slug || task.id;\n\n lines.push(\"## Task context\");\n lines.push(`- **Task**: ${taskSlug}`);\n lines.push(`- **Title**: ${task.title}`);\n lines.push(`- **Origin**: ${task.origin_product}`);\n\n if (task.description) {\n lines.push(\"\");\n lines.push(`> ${task.description.trim().split(\"\\n\").join(\"\\n> \")}`);\n }\n\n const usedFiles = new Set<string>();\n\n const contextArtifact = artifacts.find(\n (artifact) => artifact.name === \"context.md\",\n );\n if (contextArtifact) {\n lines.push(\"\");\n lines.push(\"### Task prompt\");\n lines.push(contextArtifact.content);\n usedFiles.add(contextArtifact.name);\n }\n\n const researchArtifact = artifacts.find(\n (artifact) => artifact.name === \"research.json\",\n );\n if (researchArtifact) {\n usedFiles.add(researchArtifact.name);\n const researchSection = formatResearchSection(researchArtifact.content);\n if (researchSection) {\n lines.push(\"\");\n lines.push(researchSection);\n }\n }\n\n const planArtifact = artifacts.find(\n (artifact) => artifact.name === \"plan.md\",\n );\n if (planArtifact) {\n lines.push(\"\");\n lines.push(\"### Implementation plan\");\n lines.push(planArtifact.content);\n usedFiles.add(planArtifact.name);\n }\n\n const todoArtifact = artifacts.find(\n (artifact) => artifact.name === \"todos.json\",\n );\n if (todoArtifact) {\n const summary = summarizeTodos(todoArtifact.content);\n if (summary) {\n lines.push(\"\");\n lines.push(\"### Todo list\");\n lines.push(summary);\n }\n usedFiles.add(todoArtifact.name);\n }\n\n const remainingArtifacts = artifacts.filter(\n (artifact) => !usedFiles.has(artifact.name),\n );\n if (remainingArtifacts.length) {\n lines.push(\"\");\n lines.push(\"### Additional artifacts\");\n for (const artifact of remainingArtifacts) {\n lines.push(`#### ${artifact.name}`);\n lines.push(renderCodeFence(artifact.content));\n }\n }\n\n const artifactList =\n uploaded ??\n artifacts.map((artifact) => ({\n name: artifact.name,\n type: artifact.type,\n }));\n\n if (artifactList.length) {\n lines.push(\"\");\n lines.push(\"### Uploaded artifacts\");\n for (const artifact of artifactList) {\n const rawStoragePath =\n \"storage_path\" in artifact\n ? (artifact as Record<string, unknown>).storage_path\n : undefined;\n const storagePath =\n typeof rawStoragePath === \"string\" ? rawStoragePath : undefined;\n const storage =\n storagePath && storagePath.trim().length > 0\n ? ` – \\`${storagePath.trim()}\\``\n : \"\";\n lines.push(`- ${artifact.name} (${artifact.type})${storage}`);\n }\n }\n\n return lines.join(\"\\n\\n\");\n}\n\nfunction renderCodeFence(content: string): string {\n const snippet = truncate(content, MAX_SNIPPET_LENGTH);\n return [\"```\", snippet, \"```\"].join(\"\\n\");\n}\n\nfunction truncate(value: string, maxLength: number): string {\n if (value.length <= maxLength) {\n return value;\n }\n return `${value.slice(0, maxLength)}\\n…`;\n}\n\nfunction formatResearchSection(content: string): string | null {\n try {\n const parsed = JSON.parse(content);\n const sections: string[] = [];\n\n if (parsed.context) {\n sections.push(\"### Research summary\");\n sections.push(parsed.context);\n }\n\n if (parsed.questions?.length) {\n sections.push(\"\");\n sections.push(\"### Questions needing answers\");\n for (const question of parsed.questions) {\n sections.push(`- ${question.question ?? question}`);\n }\n }\n\n if (parsed.answers?.length) {\n sections.push(\"\");\n sections.push(\"### Answers provided\");\n for (const answer of parsed.answers) {\n const questionId = answer.questionId\n ? ` (Q: ${answer.questionId})`\n : \"\";\n sections.push(\n `- ${answer.selectedOption || answer.customInput || \"answer\"}${questionId}`,\n );\n }\n }\n\n return sections.length ? sections.join(\"\\n\") : null;\n } catch {\n return null;\n }\n}\n\nfunction summarizeTodos(content: string): string | null {\n try {\n const data = JSON.parse(content);\n const total = data?.metadata?.total ?? data?.items?.length;\n const completed =\n data?.metadata?.completed ??\n data?.items?.filter(\n (item: { status?: string }) => item.status === \"completed\",\n ).length;\n\n const lines = [`Progress: ${completed}/${total} completed`];\n\n if (data?.items?.length) {\n for (const item of data.items) {\n lines.push(`- [${item.status}] ${item.content}`);\n }\n }\n\n return lines.join(\"\\n\");\n } catch {\n return null;\n }\n}\n"],"names":[],"mappings":";;AAKA,MAAM,kBAAkB,GAAG,IAAI;AAExB,MAAM,YAAY,GAAuB,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,KAAI;AAC1E,IAAA,MAAM,EACJ,IAAI,EACJ,MAAM,EACN,WAAW,EACX,UAAU,EACV,UAAU,EACV,gBAAgB,GACjB,GAAG,OAAO;IAEX,MAAM,UAAU,GAAG,MAAM,CAAC,KAAK,CAAC,cAAc,CAAC;IAC/C,MAAM,SAAS,GAAG,MAAM,WAAW,CAAC,oBAAoB,CAAC,IAAI,CAAC,EAAE,CAAC;AACjE,IAAA,IAAI,iBAAgD;IAEpD,IAAI,SAAS,CAAC,MAAM,IAAI,UAAU,IAAI,gBAAgB,CAAC,KAAK,EAAE;AAC5D,QAAA,IAAI;YACF,MAAM,OAAO,GAAG,SAAS,CAAC,GAAG,CAAC,CAAC,QAAQ,MAAM;gBAC3C,IAAI,EAAE,QAAQ,CAAC,IAAI;gBACnB,IAAI,EAAE,QAAQ,CAAC,IAAI;gBACnB,OAAO,EAAE,QAAQ,CAAC,OAAO;gBACzB,YAAY,EAAE,QAAQ,CAAC,WAAW;AACnC,aAAA,CAAC,CAAC;AACH,YAAA,iBAAiB,GAAG,MAAM,UAAU,CAAC,mBAAmB,CACtD,IAAI,CAAC,EAAE,EACP,gBAAgB,CAAC,KAAK,EACtB,OAAO,CACR;AACD,YAAA,UAAU,CAAC,IAAI,CAAC,oCAAoC,EAAE;gBACpD,MAAM,EAAE,IAAI,CAAC,EAAE;gBACf,aAAa,EAAE,iBAAiB,CAAC,MAAM;AACxC,aAAA,CAAC;QACJ;QAAE,OAAO,KAAK,EAAE;AACd,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
|
+
{"version":3,"file":"plan.d.ts","sourceRoot":"","sources":["../../../../src/workflow/steps/plan.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAGtD,eAAO,MAAM,QAAQ,EAAE,kBA2JtB,CAAC"}
|