@posthog/agent 1.24.0 → 1.24.2
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/LICENSE +33 -0
- 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 +111 -156
- 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 +85 -143
- 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 +58 -59
- package/dist/src/file-manager.js.map +1 -1
- package/dist/src/git-manager.d.ts +1 -1
- package/dist/src/git-manager.d.ts.map +1 -1
- package/dist/src/git-manager.js +70 -87
- package/dist/src/git-manager.js.map +1 -1
- package/dist/src/posthog-api.d.ts +3 -2
- 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 +93 -123
- 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 +18 -19
- package/dist/src/task-manager.js.map +1 -1
- package/dist/src/task-progress-reporter.d.ts +4 -3
- package/dist/src/task-progress-reporter.d.ts.map +1 -1
- package/dist/src/task-progress-reporter.js +54 -59
- 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 +28 -30
- 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 +24 -29
- 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 +38 -46
- 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 +48 -54
- 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 +46 -58
- 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 +56 -68
- 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 +4 -7
- package/dist/src/workflow/utils.js.map +1 -1
- package/package.json +6 -6
- package/src/adapters/claude/claude-adapter.ts +168 -220
- package/src/adapters/claude/tool-mapper.ts +2 -2
- package/src/adapters/types.ts +1 -1
- package/src/agent.ts +444 -579
- package/src/agents/execution.ts +1 -1
- package/src/agents/planning.ts +1 -1
- package/src/agents/research.ts +1 -0
- package/src/file-manager.ts +63 -64
- package/src/git-manager.ts +88 -144
- package/src/posthog-api.ts +82 -122
- package/src/prompt-builder.ts +135 -180
- package/src/task-manager.ts +30 -38
- package/src/task-progress-reporter.ts +59 -70
- package/src/template-manager.ts +45 -98
- package/src/todo-manager.ts +30 -35
- package/src/tools/registry.ts +62 -62
- package/src/tools/types.ts +36 -36
- package/src/types.ts +71 -93
- package/src/utils/logger.ts +56 -62
- package/src/workflow/config.ts +48 -48
- package/src/workflow/steps/build.ts +113 -122
- package/src/workflow/steps/finalize.ts +182 -214
- package/src/workflow/steps/plan.ts +131 -151
- package/src/workflow/steps/research.ts +186 -205
- package/src/workflow/types.ts +36 -38
- package/src/workflow/utils.ts +34 -37
|
@@ -1,27 +1,25 @@
|
|
|
1
1
|
import { query } from '@anthropic-ai/claude-agent-sdk';
|
|
2
2
|
import { EXECUTION_SYSTEM_PROMPT } from '../../agents/execution.js';
|
|
3
|
-
import { TodoManager } from '../../todo-manager.js';
|
|
4
3
|
import { PermissionMode } from '../../types.js';
|
|
4
|
+
import { TodoManager } from '../../todo-manager.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
|
-
|
|
16
|
-
});
|
|
17
|
-
return { status: "skipped" };
|
|
14
|
+
stepLogger.info('PR already exists, skipping build phase', { taskId: task.id });
|
|
15
|
+
return { status: 'skipped' };
|
|
18
16
|
}
|
|
19
|
-
stepLogger.info(
|
|
20
|
-
emitEvent(adapter.createStatusEvent(
|
|
17
|
+
stepLogger.info('Starting build phase', { taskId: task.id });
|
|
18
|
+
emitEvent(adapter.createStatusEvent('phase_start', { phase: 'build' }));
|
|
21
19
|
const executionPrompt = await promptBuilder.buildExecutionPrompt(task, cwd);
|
|
22
20
|
const fullPrompt = `${EXECUTION_SYSTEM_PROMPT}\n\n${executionPrompt}`;
|
|
23
21
|
const configuredPermissionMode = options.permissionMode ??
|
|
24
|
-
(typeof step.permissionMode ===
|
|
22
|
+
(typeof step.permissionMode === 'string'
|
|
25
23
|
? step.permissionMode
|
|
26
24
|
: step.permissionMode) ??
|
|
27
25
|
PermissionMode.ACCEPT_EDITS;
|
|
@@ -29,25 +27,25 @@ const buildStep = async ({ step, context }) => {
|
|
|
29
27
|
model: step.model,
|
|
30
28
|
cwd,
|
|
31
29
|
permissionMode: configuredPermissionMode,
|
|
32
|
-
settingSources: [
|
|
30
|
+
settingSources: ['local'],
|
|
33
31
|
mcpServers,
|
|
34
32
|
// Allow all tools for build phase - full read/write access needed for implementation
|
|
35
33
|
allowedTools: [
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
34
|
+
'Task',
|
|
35
|
+
'Bash',
|
|
36
|
+
'BashOutput',
|
|
37
|
+
'KillBash',
|
|
38
|
+
'Edit',
|
|
39
|
+
'Read',
|
|
40
|
+
'Write',
|
|
41
|
+
'Glob',
|
|
42
|
+
'Grep',
|
|
43
|
+
'NotebookEdit',
|
|
44
|
+
'WebFetch',
|
|
45
|
+
'WebSearch',
|
|
46
|
+
'ListMcpResources',
|
|
47
|
+
'ReadMcpResource',
|
|
48
|
+
'TodoWrite',
|
|
51
49
|
],
|
|
52
50
|
};
|
|
53
51
|
// Add fine-grained permission hook if provided
|
|
@@ -62,22 +60,16 @@ const buildStep = async ({ step, context }) => {
|
|
|
62
60
|
const commitTracker = await gitManager.trackCommitsDuring();
|
|
63
61
|
// Track todos from TodoWrite tool calls
|
|
64
62
|
const todoManager = new TodoManager(context.fileManager, stepLogger);
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
emitEvent(adapter.createArtifactEvent("todos", todoList));
|
|
75
|
-
}
|
|
63
|
+
for await (const message of response) {
|
|
64
|
+
emitEvent(adapter.createRawSDKEvent(message));
|
|
65
|
+
const transformedEvents = adapter.transform(message);
|
|
66
|
+
for (const event of transformedEvents) {
|
|
67
|
+
emitEvent(event);
|
|
68
|
+
}
|
|
69
|
+
const todoList = await todoManager.checkAndPersistFromMessage(message, task.id);
|
|
70
|
+
if (todoList) {
|
|
71
|
+
emitEvent(adapter.createArtifactEvent('todos', todoList));
|
|
76
72
|
}
|
|
77
|
-
}
|
|
78
|
-
catch (error) {
|
|
79
|
-
stepLogger.error("Error during build step query", error);
|
|
80
|
-
throw error;
|
|
81
73
|
}
|
|
82
74
|
// Finalize: commit any remaining changes and optionally push
|
|
83
75
|
const { commitCreated, pushedBranch } = await commitTracker.finalize({
|
|
@@ -86,16 +78,16 @@ const buildStep = async ({ step, context }) => {
|
|
|
86
78
|
});
|
|
87
79
|
context.stepResults[step.id] = { commitCreated };
|
|
88
80
|
if (!commitCreated) {
|
|
89
|
-
stepLogger.warn(
|
|
81
|
+
stepLogger.warn('No changes to commit in build phase', { taskId: task.id });
|
|
90
82
|
}
|
|
91
83
|
else {
|
|
92
|
-
stepLogger.info(
|
|
84
|
+
stepLogger.info('Build commits finalized', {
|
|
93
85
|
taskId: task.id,
|
|
94
|
-
pushedBranch
|
|
86
|
+
pushedBranch
|
|
95
87
|
});
|
|
96
88
|
}
|
|
97
|
-
emitEvent(adapter.createStatusEvent(
|
|
98
|
-
return { status:
|
|
89
|
+
emitEvent(adapter.createStatusEvent('phase_complete', { phase: 'build' }));
|
|
90
|
+
return { status: 'completed' };
|
|
99
91
|
};
|
|
100
92
|
|
|
101
93
|
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 { PermissionMode } from '../../types.js';\nimport type { WorkflowStepRunner } from '../types.js';\nimport { finalizeStepGitActions } from '../utils.js';\nimport { TodoManager } from '../../todo-manager.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 any).pr_url\n : null;\n\n if (prExists) {\n stepLogger.info('PR already exists, skipping build phase', { taskId: task.id });\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, any> = {\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 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(message, task.id);\n if (todoList) {\n emitEvent(adapter.createArtifactEvent('todos', todoList));\n }\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":";;;;;AAOO,MAAM,SAAS,GAAuB,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,KAAI;IACrE,MAAM,EACF,IAAI,EACJ,GAAG,EACH,OAAO,EACP,MAAM,EACN,aAAa,EACb,OAAO,EACP,UAAU,EACV,UAAU,EACV,SAAS,GACZ,GAAG,OAAO;IAEX,MAAM,UAAU,GAAG,MAAM,CAAC,KAAK,CAAC,WAAW,CAAC;AAE5C,IAAA,MAAM,SAAS,GAAG,IAAI,CAAC,UAAU;IACjC,MAAM,QAAQ,GACV,SAAS,EAAE,MAAM,IAAI,OAAO,SAAS,CAAC,MAAM,KAAK;AAC7C,UAAG,SAAS,CAAC,MAAc,CAAC;UAC1B,IAAI;IAEd,IAAI,QAAQ,EAAE;AACV,QAAA,UAAU,CAAC,IAAI,CAAC,yCAAyC,EAAE,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC;AAC/E,QAAA,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE;IAChC;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,CAAA,EAAG,uBAAuB,CAAA,IAAA,EAAO,eAAe,EAAE;AAErE,IAAA,MAAM,wBAAwB,GAC1B,OAAO,CAAC,cAAc;AACtB,SAAC,OAAO,IAAI,CAAC,cAAc,KAAK;cACzB,IAAI,CAAC;AACR,cAAE,IAAI,C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AE;YACV,SAAS,CAAC,OAAO,CAAC,mBAAmB,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;QAC7D;IACJ;;IAGA,MAAM,EAAE,aAAa,EAAE,YAAY,EAAE,GAAG,MAAM,aAAa,CAAC,QAAQ,CAAC;AACjE,QAAA,aAAa,EAAE,CAAA,mBAAA,EAAsB,IAAI,CAAC,KAAK,CAAA,CAAE;QACjD,IAAI,EAAE,IAAI,CAAC,IAAI;AAClB,KAAA,CAAC;IAEF,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC,EAAE,CAAC,GAAG,EAAE,aAAa,EAAE;IAEhD,IAAI,CAAC,aAAa,EAAE;AAChB,QAAA,UAAU,CAAC,IAAI,CAAC,qCAAqC,EAAE,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC;IAC/E;SAAO;AACH,QAAA,UAAU,CAAC,IAAI,CAAC,yBAAyB,EAAE;YACvC,MAAM,EAAE,IAAI,CAAC,EAAE;YACf;AACH,SAAA,CAAC;IACN;AAEA,IAAA,SAAS,CAAC,OAAO,CAAC,iBAAiB,CAAC,gBAAgB,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC,CAAC;AAC1E,IAAA,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE;AAClC;;;;"}
|
|
@@ -1 +1 @@
|
|
|
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,
|
|
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,kBA0D1B,CAAC"}
|
|
@@ -3,7 +3,7 @@ import { finalizeStepGitActions } from '../utils.js';
|
|
|
3
3
|
const MAX_SNIPPET_LENGTH = 1200;
|
|
4
4
|
const finalizeStep = async ({ step, context }) => {
|
|
5
5
|
const { task, logger, fileManager, gitManager, posthogAPI, progressReporter, } = context;
|
|
6
|
-
const stepLogger = logger.child(
|
|
6
|
+
const stepLogger = logger.child('FinalizeStep');
|
|
7
7
|
const artifacts = await fileManager.collectTaskArtifacts(task.id);
|
|
8
8
|
let uploadedArtifacts;
|
|
9
9
|
if (artifacts.length && posthogAPI && progressReporter.runId) {
|
|
@@ -15,20 +15,20 @@ const finalizeStep = async ({ step, context }) => {
|
|
|
15
15
|
content_type: artifact.contentType,
|
|
16
16
|
}));
|
|
17
17
|
uploadedArtifacts = await posthogAPI.uploadTaskArtifacts(task.id, progressReporter.runId, payload);
|
|
18
|
-
stepLogger.info(
|
|
18
|
+
stepLogger.info('Uploaded task artifacts to PostHog', {
|
|
19
19
|
taskId: task.id,
|
|
20
20
|
uploadedCount: uploadedArtifacts.length,
|
|
21
21
|
});
|
|
22
22
|
}
|
|
23
23
|
catch (error) {
|
|
24
|
-
stepLogger.warn(
|
|
24
|
+
stepLogger.warn('Failed to upload task artifacts', {
|
|
25
25
|
taskId: task.id,
|
|
26
26
|
error: error instanceof Error ? error.message : String(error),
|
|
27
27
|
});
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
30
|
else {
|
|
31
|
-
stepLogger.debug(
|
|
31
|
+
stepLogger.debug('Skipping artifact upload', {
|
|
32
32
|
hasArtifacts: artifacts.length > 0,
|
|
33
33
|
hasPostHogApi: Boolean(posthogAPI),
|
|
34
34
|
runId: progressReporter.runId,
|
|
@@ -40,93 +40,88 @@ const finalizeStep = async ({ step, context }) => {
|
|
|
40
40
|
// Commit the deletion of artifacts
|
|
41
41
|
await finalizeStepGitActions(context, step, {
|
|
42
42
|
commitMessage: `Cleanup task artifacts for ${task.title}`,
|
|
43
|
-
allowEmptyCommit: true
|
|
43
|
+
allowEmptyCommit: true
|
|
44
44
|
});
|
|
45
45
|
context.stepResults[step.id] = {
|
|
46
46
|
prBody,
|
|
47
47
|
uploadedArtifacts,
|
|
48
48
|
artifactCount: artifacts.length,
|
|
49
49
|
};
|
|
50
|
-
return { status:
|
|
50
|
+
return { status: 'completed' };
|
|
51
51
|
};
|
|
52
52
|
function buildPullRequestBody(task, artifacts, uploaded) {
|
|
53
53
|
const lines = [];
|
|
54
54
|
const taskSlug = task.slug || task.id;
|
|
55
|
-
lines.push(
|
|
55
|
+
lines.push('## Task context');
|
|
56
56
|
lines.push(`- **Task**: ${taskSlug}`);
|
|
57
57
|
lines.push(`- **Title**: ${task.title}`);
|
|
58
58
|
lines.push(`- **Origin**: ${task.origin_product}`);
|
|
59
59
|
if (task.description) {
|
|
60
|
-
lines.push(
|
|
61
|
-
lines.push(
|
|
60
|
+
lines.push('');
|
|
61
|
+
lines.push('> ' + task.description.trim().split('\n').join('\n> '));
|
|
62
62
|
}
|
|
63
63
|
const usedFiles = new Set();
|
|
64
|
-
const contextArtifact = artifacts.find((artifact) => artifact.name ===
|
|
64
|
+
const contextArtifact = artifacts.find((artifact) => artifact.name === 'context.md');
|
|
65
65
|
if (contextArtifact) {
|
|
66
|
-
lines.push(
|
|
67
|
-
lines.push(
|
|
66
|
+
lines.push('');
|
|
67
|
+
lines.push('### Task prompt');
|
|
68
68
|
lines.push(contextArtifact.content);
|
|
69
69
|
usedFiles.add(contextArtifact.name);
|
|
70
70
|
}
|
|
71
|
-
const researchArtifact = artifacts.find((artifact) => artifact.name ===
|
|
71
|
+
const researchArtifact = artifacts.find((artifact) => artifact.name === 'research.json');
|
|
72
72
|
if (researchArtifact) {
|
|
73
73
|
usedFiles.add(researchArtifact.name);
|
|
74
74
|
const researchSection = formatResearchSection(researchArtifact.content);
|
|
75
75
|
if (researchSection) {
|
|
76
|
-
lines.push(
|
|
76
|
+
lines.push('');
|
|
77
77
|
lines.push(researchSection);
|
|
78
78
|
}
|
|
79
79
|
}
|
|
80
|
-
const planArtifact = artifacts.find((artifact) => artifact.name ===
|
|
80
|
+
const planArtifact = artifacts.find((artifact) => artifact.name === 'plan.md');
|
|
81
81
|
if (planArtifact) {
|
|
82
|
-
lines.push(
|
|
83
|
-
lines.push(
|
|
82
|
+
lines.push('');
|
|
83
|
+
lines.push('### Implementation plan');
|
|
84
84
|
lines.push(planArtifact.content);
|
|
85
85
|
usedFiles.add(planArtifact.name);
|
|
86
86
|
}
|
|
87
|
-
const todoArtifact = artifacts.find((artifact) => artifact.name ===
|
|
87
|
+
const todoArtifact = artifacts.find((artifact) => artifact.name === 'todos.json');
|
|
88
88
|
if (todoArtifact) {
|
|
89
89
|
const summary = summarizeTodos(todoArtifact.content);
|
|
90
90
|
if (summary) {
|
|
91
|
-
lines.push(
|
|
92
|
-
lines.push(
|
|
91
|
+
lines.push('');
|
|
92
|
+
lines.push('### Todo list');
|
|
93
93
|
lines.push(summary);
|
|
94
94
|
}
|
|
95
95
|
usedFiles.add(todoArtifact.name);
|
|
96
96
|
}
|
|
97
97
|
const remainingArtifacts = artifacts.filter((artifact) => !usedFiles.has(artifact.name));
|
|
98
98
|
if (remainingArtifacts.length) {
|
|
99
|
-
lines.push(
|
|
100
|
-
lines.push(
|
|
99
|
+
lines.push('');
|
|
100
|
+
lines.push('### Additional artifacts');
|
|
101
101
|
for (const artifact of remainingArtifacts) {
|
|
102
102
|
lines.push(`#### ${artifact.name}`);
|
|
103
103
|
lines.push(renderCodeFence(artifact.content));
|
|
104
104
|
}
|
|
105
105
|
}
|
|
106
|
-
const artifactList = uploaded ??
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
}));
|
|
106
|
+
const artifactList = uploaded ?? artifacts.map((artifact) => ({
|
|
107
|
+
name: artifact.name,
|
|
108
|
+
type: artifact.type,
|
|
109
|
+
}));
|
|
111
110
|
if (artifactList.length) {
|
|
112
|
-
lines.push(
|
|
113
|
-
lines.push(
|
|
111
|
+
lines.push('');
|
|
112
|
+
lines.push('### Uploaded artifacts');
|
|
114
113
|
for (const artifact of artifactList) {
|
|
115
|
-
const rawStoragePath =
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
const storagePath = typeof rawStoragePath === "string" ? rawStoragePath : undefined;
|
|
119
|
-
const storage = storagePath && storagePath.trim().length > 0
|
|
120
|
-
? ` – \`${storagePath.trim()}\``
|
|
121
|
-
: "";
|
|
114
|
+
const rawStoragePath = 'storage_path' in artifact ? artifact.storage_path : undefined;
|
|
115
|
+
const storagePath = typeof rawStoragePath === 'string' ? rawStoragePath : undefined;
|
|
116
|
+
const storage = storagePath && storagePath.trim().length > 0 ? ` – \`${storagePath.trim()}\`` : '';
|
|
122
117
|
lines.push(`- ${artifact.name} (${artifact.type})${storage}`);
|
|
123
118
|
}
|
|
124
119
|
}
|
|
125
|
-
return lines.join(
|
|
120
|
+
return lines.join('\n\n');
|
|
126
121
|
}
|
|
127
122
|
function renderCodeFence(content) {
|
|
128
123
|
const snippet = truncate(content, MAX_SNIPPET_LENGTH);
|
|
129
|
-
return [
|
|
124
|
+
return ['```', snippet, '```'].join('\n');
|
|
130
125
|
}
|
|
131
126
|
function truncate(value, maxLength) {
|
|
132
127
|
if (value.length <= maxLength) {
|
|
@@ -139,27 +134,25 @@ function formatResearchSection(content) {
|
|
|
139
134
|
const parsed = JSON.parse(content);
|
|
140
135
|
const sections = [];
|
|
141
136
|
if (parsed.context) {
|
|
142
|
-
sections.push(
|
|
137
|
+
sections.push('### Research summary');
|
|
143
138
|
sections.push(parsed.context);
|
|
144
139
|
}
|
|
145
|
-
if (parsed.questions
|
|
146
|
-
sections.push(
|
|
147
|
-
sections.push(
|
|
140
|
+
if (parsed.questions && parsed.questions.length) {
|
|
141
|
+
sections.push('');
|
|
142
|
+
sections.push('### Questions needing answers');
|
|
148
143
|
for (const question of parsed.questions) {
|
|
149
144
|
sections.push(`- ${question.question ?? question}`);
|
|
150
145
|
}
|
|
151
146
|
}
|
|
152
|
-
if (parsed.answers
|
|
153
|
-
sections.push(
|
|
154
|
-
sections.push(
|
|
147
|
+
if (parsed.answers && parsed.answers.length) {
|
|
148
|
+
sections.push('');
|
|
149
|
+
sections.push('### Answers provided');
|
|
155
150
|
for (const answer of parsed.answers) {
|
|
156
|
-
const questionId = answer.questionId
|
|
157
|
-
|
|
158
|
-
: "";
|
|
159
|
-
sections.push(`- ${answer.selectedOption || answer.customInput || "answer"}${questionId}`);
|
|
151
|
+
const questionId = answer.questionId ? ` (Q: ${answer.questionId})` : '';
|
|
152
|
+
sections.push(`- ${answer.selectedOption || answer.customInput || 'answer'}${questionId}`);
|
|
160
153
|
}
|
|
161
154
|
}
|
|
162
|
-
return sections.length ? sections.join(
|
|
155
|
+
return sections.length ? sections.join('\n') : null;
|
|
163
156
|
}
|
|
164
157
|
catch {
|
|
165
158
|
return null;
|
|
@@ -169,15 +162,16 @@ function summarizeTodos(content) {
|
|
|
169
162
|
try {
|
|
170
163
|
const data = JSON.parse(content);
|
|
171
164
|
const total = data?.metadata?.total ?? data?.items?.length;
|
|
172
|
-
const completed = data?.metadata?.completed ??
|
|
173
|
-
|
|
174
|
-
|
|
165
|
+
const completed = data?.metadata?.completed ?? data?.items?.filter((item) => item.status === 'completed').length;
|
|
166
|
+
const lines = [
|
|
167
|
+
`Progress: ${completed}/${total} completed`,
|
|
168
|
+
];
|
|
175
169
|
if (data?.items?.length) {
|
|
176
170
|
for (const item of data.items) {
|
|
177
171
|
lines.push(`- [${item.status}] ${item.content}`);
|
|
178
172
|
}
|
|
179
173
|
}
|
|
180
|
-
return lines.join(
|
|
174
|
+
return lines.join('\n');
|
|
181
175
|
}
|
|
182
176
|
catch {
|
|
183
177
|
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\";\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,GAC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Q,EAAE,KAAK,IAAI,IAAI,EAAE,KAAK,EAAE,MAAM;AAC1D,QAAA,MAAM,SAAS,GACb,IAAI,EAAE,QAAQ,EAAE,SAAS;AACzB,YAAA,IAAI,EAAE,KAAK,EAAE,MAAM,CACjB,CAAC,IAAyB,KAAK,IAAI,CAAC,MAAM,KAAK,WAAW,CAC3D,CAAC,MAAM;QAEV,MAAM,KAAK,GAAG,CAAC,CAAA,UAAA,EAAa,SAAS,CAAA,CAAA,EAAI,KAAK,CAAA,UAAA,CAAY,CAAC;AAE3D,QAAA,IAAI,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE;AACvB,YAAA,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,KAAK,EAAE;AAC7B,gBAAA,KAAK,CAAC,IAAI,CAAC,CAAA,GAAA,EAAM,IAAI,CAAC,MAAM,CAAA,EAAA,EAAK,IAAI,CAAC,OAAO,CAAA,CAAE,CAAC;YAClD;QACF;AAEA,QAAA,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC;IACzB;AAAE,IAAA,MAAM;AACN,QAAA,OAAO,IAAI;IACb;AACF;;;;"}
|
|
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(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 // 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(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(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(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 rawStoragePath = 'storage_path' in artifact ? (artifact as any).storage_path : undefined;\n const storagePath = typeof rawStoragePath === 'string' ? rawStoragePath : undefined;\n const storage = storagePath && storagePath.trim().length > 0 ? ` – \\`${storagePath.trim()}\\`` : '';\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":";;AAKA,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;IAEpD,IAAI,SAAS,CAAC,MAAM,IAAI,UAAU,IAAI,gBAAgB,CAAC,KAAK,EAAE;AAC1D,QAAA,IAAI;YACA,MAAM,OAAO,GAAG,SAAS,CAAC,GAAG,CAAC,CAAC,QAAQ,MAAM;gBACzC,IAAI,EAAE,QAAQ,CAAC,IAAI;gBACnB,IAAI,EAAE,QAAQ,CAAC,IAAI;gBACnB,OAAO,EAAE,QAAQ,CAAC,OAAO;gBACzB,YAAY,EAAE,QAAQ,CAAC,WAAW;AACrC,aAAA,CAAC,CAAC;AACH,YAAA,iBAAiB,GAAG,MAAM,UAAU,CAAC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A,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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plan.d.ts","sourceRoot":"","sources":["../../../../src/workflow/steps/plan.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"plan.d.ts","sourceRoot":"","sources":["../../../../src/workflow/steps/plan.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAItD,eAAO,MAAM,QAAQ,EAAE,kBAuItB,CAAC"}
|