@posthog/agent 1.16.5 → 1.17.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.
Files changed (215) hide show
  1. package/dist/index.d.ts +1 -3
  2. package/dist/index.d.ts.map +1 -1
  3. package/dist/src/agent.d.ts +0 -3
  4. package/dist/src/agent.d.ts.map +1 -1
  5. package/dist/src/agent.js +6 -27
  6. package/dist/src/agent.js.map +1 -1
  7. package/dist/src/agents/research.d.ts +1 -1
  8. package/dist/src/agents/research.d.ts.map +1 -1
  9. package/dist/src/agents/research.js +84 -53
  10. package/dist/src/agents/research.js.map +1 -1
  11. package/dist/src/file-manager.d.ts +3 -21
  12. package/dist/src/file-manager.d.ts.map +1 -1
  13. package/dist/src/file-manager.js +15 -47
  14. package/dist/src/file-manager.js.map +1 -1
  15. package/dist/src/git-manager.d.ts.map +1 -1
  16. package/dist/src/git-manager.js +8 -1
  17. package/dist/src/git-manager.js.map +1 -1
  18. package/dist/src/types.d.ts +20 -1
  19. package/dist/src/types.d.ts.map +1 -1
  20. package/dist/src/types.js.map +1 -1
  21. package/dist/src/workflow/steps/plan.d.ts.map +1 -1
  22. package/dist/src/workflow/steps/plan.js +26 -18
  23. package/dist/src/workflow/steps/plan.js.map +1 -1
  24. package/dist/src/workflow/steps/research.d.ts.map +1 -1
  25. package/dist/src/workflow/steps/research.js +100 -66
  26. package/dist/src/workflow/steps/research.js.map +1 -1
  27. package/dist/src/workflow/types.d.ts +0 -2
  28. package/dist/src/workflow/types.d.ts.map +1 -1
  29. package/dist/templates/plan-template.md +1 -5
  30. package/package.json +2 -6
  31. package/src/agent.ts +7 -31
  32. package/src/agents/research.ts +84 -53
  33. package/src/file-manager.ts +18 -73
  34. package/src/git-manager.ts +7 -1
  35. package/src/templates/plan-template.md +1 -5
  36. package/src/types.ts +24 -1
  37. package/src/workflow/steps/plan.ts +28 -21
  38. package/src/workflow/steps/research.ts +109 -74
  39. package/src/workflow/types.ts +0 -2
  40. package/dist/_virtual/_commonjsHelpers.js +0 -6
  41. package/dist/_virtual/_commonjsHelpers.js.map +0 -1
  42. package/dist/_virtual/index.js +0 -4
  43. package/dist/_virtual/index.js.map +0 -1
  44. package/dist/node_modules/@ai-sdk/anthropic/dist/index.js +0 -1154
  45. package/dist/node_modules/@ai-sdk/anthropic/dist/index.js.map +0 -1
  46. package/dist/node_modules/@ai-sdk/provider/dist/index.js +0 -296
  47. package/dist/node_modules/@ai-sdk/provider/dist/index.js.map +0 -1
  48. package/dist/node_modules/@ai-sdk/provider-utils/dist/index.js +0 -576
  49. package/dist/node_modules/@ai-sdk/provider-utils/dist/index.js.map +0 -1
  50. package/dist/node_modules/@ai-sdk/ui-utils/dist/index.js +0 -741
  51. package/dist/node_modules/@ai-sdk/ui-utils/dist/index.js.map +0 -1
  52. package/dist/node_modules/@opentelemetry/api/build/esm/api/context.js +0 -112
  53. package/dist/node_modules/@opentelemetry/api/build/esm/api/context.js.map +0 -1
  54. package/dist/node_modules/@opentelemetry/api/build/esm/api/diag.js +0 -123
  55. package/dist/node_modules/@opentelemetry/api/build/esm/api/diag.js.map +0 -1
  56. package/dist/node_modules/@opentelemetry/api/build/esm/api/metrics.js +0 -62
  57. package/dist/node_modules/@opentelemetry/api/build/esm/api/metrics.js.map +0 -1
  58. package/dist/node_modules/@opentelemetry/api/build/esm/api/propagation.js +0 -91
  59. package/dist/node_modules/@opentelemetry/api/build/esm/api/propagation.js.map +0 -1
  60. package/dist/node_modules/@opentelemetry/api/build/esm/api/trace.js +0 -79
  61. package/dist/node_modules/@opentelemetry/api/build/esm/api/trace.js.map +0 -1
  62. package/dist/node_modules/@opentelemetry/api/build/esm/baggage/context-helpers.js +0 -59
  63. package/dist/node_modules/@opentelemetry/api/build/esm/baggage/context-helpers.js.map +0 -1
  64. package/dist/node_modules/@opentelemetry/api/build/esm/baggage/internal/baggage-impl.js +0 -99
  65. package/dist/node_modules/@opentelemetry/api/build/esm/baggage/internal/baggage-impl.js.map +0 -1
  66. package/dist/node_modules/@opentelemetry/api/build/esm/baggage/utils.js +0 -31
  67. package/dist/node_modules/@opentelemetry/api/build/esm/baggage/utils.js.map +0 -1
  68. package/dist/node_modules/@opentelemetry/api/build/esm/context/NoopContextManager.js +0 -69
  69. package/dist/node_modules/@opentelemetry/api/build/esm/context/NoopContextManager.js.map +0 -1
  70. package/dist/node_modules/@opentelemetry/api/build/esm/context/context.js +0 -54
  71. package/dist/node_modules/@opentelemetry/api/build/esm/context/context.js.map +0 -1
  72. package/dist/node_modules/@opentelemetry/api/build/esm/context-api.js +0 -22
  73. package/dist/node_modules/@opentelemetry/api/build/esm/context-api.js.map +0 -1
  74. package/dist/node_modules/@opentelemetry/api/build/esm/diag/ComponentLogger.js +0 -104
  75. package/dist/node_modules/@opentelemetry/api/build/esm/diag/ComponentLogger.js.map +0 -1
  76. package/dist/node_modules/@opentelemetry/api/build/esm/diag/internal/logLevelLogger.js +0 -44
  77. package/dist/node_modules/@opentelemetry/api/build/esm/diag/internal/logLevelLogger.js.map +0 -1
  78. package/dist/node_modules/@opentelemetry/api/build/esm/diag/types.js +0 -43
  79. package/dist/node_modules/@opentelemetry/api/build/esm/diag/types.js.map +0 -1
  80. package/dist/node_modules/@opentelemetry/api/build/esm/diag-api.js +0 -27
  81. package/dist/node_modules/@opentelemetry/api/build/esm/diag-api.js.map +0 -1
  82. package/dist/node_modules/@opentelemetry/api/build/esm/internal/global-utils.js +0 -62
  83. package/dist/node_modules/@opentelemetry/api/build/esm/internal/global-utils.js.map +0 -1
  84. package/dist/node_modules/@opentelemetry/api/build/esm/internal/semver.js +0 -121
  85. package/dist/node_modules/@opentelemetry/api/build/esm/internal/semver.js.map +0 -1
  86. package/dist/node_modules/@opentelemetry/api/build/esm/metrics/NoopMeter.js +0 -167
  87. package/dist/node_modules/@opentelemetry/api/build/esm/metrics/NoopMeter.js.map +0 -1
  88. package/dist/node_modules/@opentelemetry/api/build/esm/metrics/NoopMeterProvider.js +0 -33
  89. package/dist/node_modules/@opentelemetry/api/build/esm/metrics/NoopMeterProvider.js.map +0 -1
  90. package/dist/node_modules/@opentelemetry/api/build/esm/metrics-api.js +0 -22
  91. package/dist/node_modules/@opentelemetry/api/build/esm/metrics-api.js.map +0 -1
  92. package/dist/node_modules/@opentelemetry/api/build/esm/platform/node/globalThis.js +0 -21
  93. package/dist/node_modules/@opentelemetry/api/build/esm/platform/node/globalThis.js.map +0 -1
  94. package/dist/node_modules/@opentelemetry/api/build/esm/propagation/NoopTextMapPropagator.js +0 -35
  95. package/dist/node_modules/@opentelemetry/api/build/esm/propagation/NoopTextMapPropagator.js.map +0 -1
  96. package/dist/node_modules/@opentelemetry/api/build/esm/propagation/TextMapPropagator.js +0 -40
  97. package/dist/node_modules/@opentelemetry/api/build/esm/propagation/TextMapPropagator.js.map +0 -1
  98. package/dist/node_modules/@opentelemetry/api/build/esm/propagation-api.js +0 -22
  99. package/dist/node_modules/@opentelemetry/api/build/esm/propagation-api.js.map +0 -1
  100. package/dist/node_modules/@opentelemetry/api/build/esm/trace/NonRecordingSpan.js +0 -70
  101. package/dist/node_modules/@opentelemetry/api/build/esm/trace/NonRecordingSpan.js.map +0 -1
  102. package/dist/node_modules/@opentelemetry/api/build/esm/trace/NoopTracer.js +0 -78
  103. package/dist/node_modules/@opentelemetry/api/build/esm/trace/NoopTracer.js.map +0 -1
  104. package/dist/node_modules/@opentelemetry/api/build/esm/trace/NoopTracerProvider.js +0 -34
  105. package/dist/node_modules/@opentelemetry/api/build/esm/trace/NoopTracerProvider.js.map +0 -1
  106. package/dist/node_modules/@opentelemetry/api/build/esm/trace/ProxyTracer.js +0 -55
  107. package/dist/node_modules/@opentelemetry/api/build/esm/trace/ProxyTracer.js.map +0 -1
  108. package/dist/node_modules/@opentelemetry/api/build/esm/trace/ProxyTracerProvider.js +0 -56
  109. package/dist/node_modules/@opentelemetry/api/build/esm/trace/ProxyTracerProvider.js.map +0 -1
  110. package/dist/node_modules/@opentelemetry/api/build/esm/trace/context-utils.js +0 -76
  111. package/dist/node_modules/@opentelemetry/api/build/esm/trace/context-utils.js.map +0 -1
  112. package/dist/node_modules/@opentelemetry/api/build/esm/trace/invalid-span-constants.js +0 -27
  113. package/dist/node_modules/@opentelemetry/api/build/esm/trace/invalid-span-constants.js.map +0 -1
  114. package/dist/node_modules/@opentelemetry/api/build/esm/trace/spancontext-utils.js +0 -45
  115. package/dist/node_modules/@opentelemetry/api/build/esm/trace/spancontext-utils.js.map +0 -1
  116. package/dist/node_modules/@opentelemetry/api/build/esm/trace/status.js +0 -22
  117. package/dist/node_modules/@opentelemetry/api/build/esm/trace/status.js.map +0 -1
  118. package/dist/node_modules/@opentelemetry/api/build/esm/trace/trace_flags.js +0 -25
  119. package/dist/node_modules/@opentelemetry/api/build/esm/trace/trace_flags.js.map +0 -1
  120. package/dist/node_modules/@opentelemetry/api/build/esm/trace-api.js +0 -24
  121. package/dist/node_modules/@opentelemetry/api/build/esm/trace-api.js.map +0 -1
  122. package/dist/node_modules/@opentelemetry/api/build/esm/version.js +0 -20
  123. package/dist/node_modules/@opentelemetry/api/build/esm/version.js.map +0 -1
  124. package/dist/node_modules/ai/dist/index.js +0 -2870
  125. package/dist/node_modules/ai/dist/index.js.map +0 -1
  126. package/dist/node_modules/nanoid/non-secure/index.js +0 -13
  127. package/dist/node_modules/nanoid/non-secure/index.js.map +0 -1
  128. package/dist/node_modules/secure-json-parse/index.js +0 -133
  129. package/dist/node_modules/secure-json-parse/index.js.map +0 -1
  130. package/dist/node_modules/zod-to-json-schema/dist/esm/Options.js +0 -37
  131. package/dist/node_modules/zod-to-json-schema/dist/esm/Options.js.map +0 -1
  132. package/dist/node_modules/zod-to-json-schema/dist/esm/Refs.js +0 -26
  133. package/dist/node_modules/zod-to-json-schema/dist/esm/Refs.js.map +0 -1
  134. package/dist/node_modules/zod-to-json-schema/dist/esm/errorMessages.js +0 -17
  135. package/dist/node_modules/zod-to-json-schema/dist/esm/errorMessages.js.map +0 -1
  136. package/dist/node_modules/zod-to-json-schema/dist/esm/getRelativePath.js +0 -11
  137. package/dist/node_modules/zod-to-json-schema/dist/esm/getRelativePath.js.map +0 -1
  138. package/dist/node_modules/zod-to-json-schema/dist/esm/index.js +0 -8
  139. package/dist/node_modules/zod-to-json-schema/dist/esm/index.js.map +0 -1
  140. package/dist/node_modules/zod-to-json-schema/dist/esm/parseDef.js +0 -66
  141. package/dist/node_modules/zod-to-json-schema/dist/esm/parseDef.js.map +0 -1
  142. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/any.js +0 -21
  143. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/any.js.map +0 -1
  144. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/array.js +0 -30
  145. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/array.js.map +0 -1
  146. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/bigint.js +0 -53
  147. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/bigint.js.map +0 -1
  148. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/boolean.js +0 -8
  149. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/boolean.js.map +0 -1
  150. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/branded.js +0 -8
  151. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/branded.js.map +0 -1
  152. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/catch.js +0 -8
  153. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/catch.js.map +0 -1
  154. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/date.js +0 -50
  155. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/date.js.map +0 -1
  156. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/default.js +0 -11
  157. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/default.js.map +0 -1
  158. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/effects.js +0 -11
  159. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/effects.js.map +0 -1
  160. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/enum.js +0 -9
  161. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/enum.js.map +0 -1
  162. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/intersection.js +0 -56
  163. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/intersection.js.map +0 -1
  164. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/literal.js +0 -24
  165. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/literal.js.map +0 -1
  166. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/map.js +0 -30
  167. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/map.js.map +0 -1
  168. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/nativeEnum.js +0 -19
  169. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/nativeEnum.js.map +0 -1
  170. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/never.js +0 -15
  171. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/never.js.map +0 -1
  172. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/null.js +0 -13
  173. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/null.js.map +0 -1
  174. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/nullable.js +0 -37
  175. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/nullable.js.map +0 -1
  176. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/number.js +0 -56
  177. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/number.js.map +0 -1
  178. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/object.js +0 -76
  179. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/object.js.map +0 -1
  180. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/optional.js +0 -25
  181. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/optional.js.map +0 -1
  182. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/pipeline.js +0 -24
  183. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/pipeline.js.map +0 -1
  184. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/promise.js +0 -8
  185. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/promise.js.map +0 -1
  186. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/readonly.js +0 -8
  187. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/readonly.js.map +0 -1
  188. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/record.js +0 -65
  189. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/record.js.map +0 -1
  190. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/set.js +0 -24
  191. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/set.js.map +0 -1
  192. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/string.js +0 -350
  193. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/string.js.map +0 -1
  194. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/tuple.js +0 -36
  195. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/tuple.js.map +0 -1
  196. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/undefined.js +0 -10
  197. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/undefined.js.map +0 -1
  198. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/union.js +0 -84
  199. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/union.js.map +0 -1
  200. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/unknown.js +0 -8
  201. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/unknown.js.map +0 -1
  202. package/dist/node_modules/zod-to-json-schema/dist/esm/selectParser.js +0 -110
  203. package/dist/node_modules/zod-to-json-schema/dist/esm/selectParser.js.map +0 -1
  204. package/dist/node_modules/zod-to-json-schema/dist/esm/zodToJsonSchema.js +0 -90
  205. package/dist/node_modules/zod-to-json-schema/dist/esm/zodToJsonSchema.js.map +0 -1
  206. package/dist/src/structured-extraction.d.ts +0 -28
  207. package/dist/src/structured-extraction.d.ts.map +0 -1
  208. package/dist/src/structured-extraction.js +0 -77
  209. package/dist/src/structured-extraction.js.map +0 -1
  210. package/dist/src/utils/ai-sdk.d.ts +0 -14
  211. package/dist/src/utils/ai-sdk.d.ts.map +0 -1
  212. package/dist/src/utils/ai-sdk.js +0 -38
  213. package/dist/src/utils/ai-sdk.js.map +0 -1
  214. package/src/structured-extraction.ts +0 -117
  215. package/src/utils/ai-sdk.ts +0 -47
package/dist/index.d.ts CHANGED
@@ -1,10 +1,8 @@
1
1
  export { Agent, } from './src/agent.js';
2
2
  export { PermissionMode, } from './src/types.js';
3
- export type { Task, TaskRun, SupportingFile, ExecutionResult, AgentConfig, McpServerConfig, AgentEvent } from './src/types.js';
3
+ export type { Task, TaskRun, SupportingFile, ExecutionResult, AgentConfig, McpServerConfig, AgentEvent, ResearchEvaluation } from './src/types.js';
4
4
  export { Logger, LogLevel, } from './src/utils/logger.js';
5
5
  export type { LoggerConfig } from './src/utils/logger.js';
6
- export type { ExtractedQuestion, ExtractedQuestionWithAnswer, StructuredExtractor } from './src/structured-extraction.js';
7
- export type { QuestionData, AnswerData, QuestionsFile } from './src/file-manager.js';
8
6
  export type { ProviderAdapter } from './src/adapters/types.js';
9
7
  export { ClaudeAdapter } from './src/adapters/claude/claude-adapter.js';
10
8
  export type { Tool, ToolCategory, KnownTool, ReadTool, WriteTool, EditTool, GlobTool, NotebookEditTool, BashTool, BashOutputTool, KillShellTool, WebFetchTool, WebSearchTool, GrepTool, TaskTool, TodoWriteTool, ExitPlanModeTool, SlashCommandTool, } from './src/tools/types.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AACA,OAAO,EACH,KAAK,GACR,MAAM,gBAAgB,CAAC;AAExB,OAAO,EACH,cAAc,GACjB,MAAM,gBAAgB,CAAC;AAExB,YAAY,EACR,IAAI,EACJ,OAAO,EACP,cAAc,EACd,eAAe,EACf,WAAW,E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YAAY,EACR,IAAI,EACJ,YAAY,EACZ,SAAS,EACT,QAAQ,EACR,SAAS,EACT,QAAQ,EACR,QAAQ,EACR,gBAAgB,EAChB,QAAQ,EACR,cAAc,EACd,aAAa,EACb,YAAY,EACZ,aAAa,EACb,QAAQ,EACR,QAAQ,EACR,aAAa,EACb,gBAAgB,EAChB,gBAAgB,GACnB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC"}
@@ -1,6 +1,5 @@
1
1
  import type { Task, ExecutionResult, AgentConfig, CanUseTool } from './types.js';
2
2
  import { PostHogAPIClient } from './posthog-api.js';
3
- import { type ExtractedQuestion, type ExtractedQuestionWithAnswer } from './structured-extraction.js';
4
3
  export declare class Agent {
5
4
  private workingDirectory;
6
5
  private onEvent?;
@@ -13,7 +12,6 @@ export declare class Agent {
13
12
  private logger;
14
13
  private progressReporter;
15
14
  private promptBuilder;
16
- private extractor?;
17
15
  private mcpServers?;
18
16
  private canUseTool?;
19
17
  debug: boolean;
@@ -45,7 +43,6 @@ export declare class Agent {
45
43
  getTaskFiles(taskId: string): Promise<any[]>;
46
44
  writePlan(taskId: string, plan: string): Promise<void>;
47
45
  readPlan(taskId: string): Promise<string | null>;
48
- extractQuestionsFromResearch(taskId: string, includeAnswers?: boolean): Promise<ExtractedQuestion[] | ExtractedQuestionWithAnswer[]>;
49
46
  createPlanningBranch(taskId: string): Promise<string>;
50
47
  commitPlan(taskId: string, taskTitle: string): Promise<string>;
51
48
  createImplementationBranch(taskId: string, planningBranchName?: string): Promise<string>;
@@ -1 +1 @@
1
- {"version":3,"file":"agent.d.ts","sourceRoot":"","sources":["../../src/agent.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,eAAe,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAEjF,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AASpD,OAAO,EAA4C,KAAK,iBAA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;AAC5C,YAAY,EAAE,IAAI,EAAE,cAAc,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC"}
package/dist/src/agent.js CHANGED
@@ -8,7 +8,6 @@ import { ClaudeAdapter } from './adapters/claude/claude-adapter.js';
8
8
  import { Logger } from './utils/logger.js';
9
9
  import { PromptBuilder } from './prompt-builder.js';
10
10
  import { TaskProgressReporter } from './task-progress-reporter.js';
11
- import { AISDKExtractor } from './structured-extraction.js';
12
11
  import { TASK_WORKFLOW } from './workflow/config.js';
13
12
  export { PermissionMode } from './types.js';
14
13
 
@@ -24,7 +23,6 @@ class Agent {
24
23
  logger;
25
24
  progressReporter;
26
25
  promptBuilder;
27
- extractor;
28
26
  mcpServers;
29
27
  canUseTool;
30
28
  debug;
@@ -79,7 +77,6 @@ class Agent {
79
77
  logger: this.logger.child('PromptBuilder')
80
78
  });
81
79
  this.progressReporter = new TaskProgressReporter(this.posthogAPI, this.logger);
82
- this.extractor = new AISDKExtractor({ apiKey: config.posthogApiKey, gatewayUrl: this.posthogAPI?.getLlmGatewayUrl() ?? '', logger: this.logger.child('AISDKExtractor') });
83
80
  }
84
81
  /**
85
82
  * Enable or disable debug logging
@@ -136,7 +133,6 @@ class Agent {
136
133
  adapter: this.adapter,
137
134
  mcpServers: this.mcpServers,
138
135
  posthogAPI: this.posthogAPI,
139
- extractor: this.extractor,
140
136
  emitEvent: (event) => this.emitEvent(event),
141
137
  stepResults: {},
142
138
  };
@@ -242,29 +238,11 @@ class Agent {
242
238
  this.logger.debug('Reading plan', { taskId });
243
239
  return await this.fileManager.readPlan(taskId);
244
240
  }
245
- async extractQuestionsFromResearch(taskId, includeAnswers = false) {
246
- this.logger.info('Extracting questions from research.md', { taskId, includeAnswers });
247
- if (!this.extractor) {
248
- throw new Error('OpenAI extractor not initialized. Ensure the LLM gateway is configured.');
249
- }
250
- const researchContent = await this.fileManager.readResearch(taskId);
251
- if (!researchContent) {
252
- throw new Error('research.md not found for task ' + taskId);
253
- }
254
- if (includeAnswers) {
255
- return await this.extractor.extractQuestionsWithAnswers(researchContent);
256
- }
257
- else {
258
- return await this.extractor.extractQuestions(researchContent);
259
- }
260
- }
261
241
  // Git operations for task execution
262
242
  async createPlanningBranch(taskId) {
263
243
  this.logger.info('Creating planning branch', { taskId });
264
244
  const branchName = await this.gitManager.createTaskPlanningBranch(taskId);
265
245
  this.logger.debug('Planning branch created', { taskId, branchName });
266
- // Only create gitignore after we're on the new branch
267
- await this.fileManager.ensureGitignore();
268
246
  return branchName;
269
247
  }
270
248
  async commitPlan(taskId, taskTitle) {
@@ -354,13 +332,17 @@ Generated by PostHog Agent`;
354
332
  if (!existingBranch) {
355
333
  const branchName = await this.gitManager.createTaskBranch(taskSlug);
356
334
  this.emitEvent(this.adapter.createStatusEvent('branch_created', { branch: branchName }));
357
- await this.fileManager.ensureGitignore();
358
335
  await this.gitManager.addAllPostHogFiles();
336
+ // Only commit if there are changes or we're in cloud mode
359
337
  if (isCloudMode) {
360
338
  await this.gitManager.commitAndPush(`Initialize task ${taskSlug}`, { allowEmpty: true });
361
339
  }
362
340
  else {
363
- await this.gitManager.commitChanges(`Initialize task ${taskSlug}`);
341
+ // Check if there are any changes before committing
342
+ const hasChanges = await this.gitManager.hasStagedChanges();
343
+ if (hasChanges) {
344
+ await this.gitManager.commitChanges(`Initialize task ${taskSlug}`);
345
+ }
364
346
  }
365
347
  }
366
348
  else {
@@ -377,9 +359,6 @@ Generated by PostHog Agent`;
377
359
  if (resolvedToken) {
378
360
  process.env.OPENAI_API_KEY = resolvedToken;
379
361
  }
380
- if (!this.extractor) {
381
- this.extractor = new AISDKExtractor({ apiKey: resolvedToken || '', gatewayUrl: resolvedGatewayUrl || '', logger: this.logger.child('AISDKExtractor') });
382
- }
383
362
  }
384
363
  async ensurePullRequest(task, stepResults) {
385
364
  const latestRun = task.latest_run;
@@ -1 +1 @@
1
- {"version":3,"file":"agent.js","sources":["../../src/agent.ts"],"sourcesContent":["import { query } from \"@anthropic-ai/claude-agent-sdk\";\nimport type { Task, ExecutionResult, AgentConfig, CanUseTool } from './types.js';\nimport { TaskManager } from './task-manager.js';\nimport { PostHogAPIClient } from './posthog-api.js';\nimport { PostHogFileManager } from './file-manager.js';\nimport { GitManager } from './git-manager.js';\nimport { TemplateManager } from './template-manager.js';\nimport { ClaudeAdapter } from './adapters/claude/claude-adapter.js';\nimport type { ProviderAdapter } from './adapters/types.js';\nimport { Logger } from './utils/logger.js';\nimport { PromptBuilder } from './prompt-builder.js';\nimport { TaskProgressReporter } from './task-progress-reporter.js';\nimport { AISDKExtractor, type StructuredExtractor, type ExtractedQuestion, type ExtractedQuestionWithAnswer } from './structured-extraction.js';\nimport { TASK_WORKFLOW } from './workflow/config.js';\nimport type { WorkflowRuntime } from './workflow/types.js';\n\nexport class Agent {\n private workingDirectory: string;\n private onEvent?: (event: any) => void;\n private taskManager: TaskManager;\n private posthogAPI?: PostHogAPIClient;\n private fileManager: PostHogFileManager;\n private gitManager: GitManager;\n private templateManager: TemplateManager;\n private adapter: ProviderAdapter;\n private logger: Logger;\n private progressReporter: TaskProgressReporter;\n private promptBuilder: PromptBuilder;\n private extractor?: StructuredExtractor;\n private mcpServers?: Record<string, any>;\n private canUseTool?: CanUseTool;\n public debug: boolean;\n\n constructor(config: AgentConfig) {\n this.workingDirectory = config.workingDirectory || process.cwd();\n this.onEvent = config.onEvent;\n this.canUseTool = config.canUseTool;\n this.debug = config.debug || false;\n\n // Build default PostHog MCP server configuration\n const posthogMcpUrl = config.posthogMcpUrl\n || process.env.POSTHOG_MCP_URL\n || 'https://mcp.posthog.com/mcp';\n\n // Add auth if API key provided\n const headers: Record<string, string> = {};\n if (config.posthogApiKey) {\n headers['Authorization'] = `Bearer ${config.posthogApiKey}`;\n }\n\n const defaultMcpServers = {\n posthog: {\n type: 'http' as const,\n url: posthogMcpUrl,\n ...(Object.keys(headers).length > 0 ? { headers } : {}),\n }\n };\n\n // Merge default PostHog MCP with user-provided servers (user config takes precedence)\n this.mcpServers = {\n ...defaultMcpServers,\n ...config.mcpServers\n };\n this.logger = new Logger({ debug: this.debug, prefix: '[PostHog Agent]' });\n this.taskManager = new TaskManager();\n // Hardcode Claude adapter for now - extensible for other providers later\n this.adapter = new ClaudeAdapter();\n\n this.fileManager = new PostHogFileManager(\n this.workingDirectory,\n this.logger.child('FileManager')\n );\n this.gitManager = new GitManager({\n repositoryPath: this.workingDirectory,\n logger: this.logger.child('GitManager')\n // TODO: Add author config from environment or config\n });\n this.templateManager = new TemplateManager();\n\n if (config.posthogApiUrl && config.posthogApiKey) {\n this.posthogAPI = new PostHogAPIClient({\n apiUrl: config.posthogApiUrl,\n apiKey: config.posthogApiKey,\n projectId: config.posthogProjectId,\n });\n }\n\n this.promptBuilder = new PromptBuilder({\n getTaskFiles: (taskId: string) => this.getTaskFiles(taskId),\n generatePlanTemplate: (vars) => this.templateManager.generatePlan(vars),\n posthogClient: this.posthogAPI,\n logger: this.logger.child('PromptBuilder')\n });\n this.progressReporter = new TaskProgressReporter(this.posthogAPI, this.logger);\n this.extractor = new AISDKExtractor({apiKey: config.posthogApiKey, gatewayUrl: this.posthogAPI?.getLlmGatewayUrl() ?? '', logger: this.logger.child('AISDKExtractor')});\n }\n\n /**\n * Enable or disable debug logging\n */\n setDebug(enabled: boolean) {\n this.debug = enabled;\n this.logger.setDebug(enabled);\n }\n\n /**\n * Configure LLM gateway environment variables for Claude Code CLI\n */\n private async _configureLlmGateway(): Promise<void> {\n if (!this.posthogAPI) {\n return;\n }\n\n try {\n const gatewayUrl = this.posthogAPI.getLlmGatewayUrl();\n const apiKey = this.posthogAPI.getApiKey();\n\n process.env.ANTHROPIC_BASE_URL = gatewayUrl;\n process.env.ANTHROPIC_AUTH_TOKEN = apiKey;\n this.ensureOpenAIGatewayEnv(gatewayUrl, apiKey);\n\n this.logger.debug('Configured LLM gateway', { gatewayUrl });\n } catch (error) {\n this.logger.error('Failed to configure LLM gateway', error);\n throw error;\n }\n }\n\n // Adaptive task execution orchestrated via workflow steps\n async runTask(taskOrId: Task | string, options: import('./types.js').TaskExecutionOptions = {}): Promise<void> {\n await this._configureLlmGateway();\n\n const task = typeof taskOrId === 'string' ? await this.fetchTask(taskOrId) : taskOrId;\n const cwd = options.repositoryPath || this.workingDirectory;\n const isCloudMode = options.isCloudMode ?? false;\n const taskSlug = (task as any).slug || task.id;\n\n this.logger.info('Starting adaptive task execution', { taskId: task.id, taskSlug, isCloudMode });\n\n // Initialize progress reporter for task run tracking (needed for PR attachment)\n await this.progressReporter.start(task.id, { totalSteps: TASK_WORKFLOW.length });\n this.emitEvent(this.adapter.createStatusEvent('run_started', { runId: this.progressReporter.runId }));\n\n await this.prepareTaskBranch(taskSlug, isCloudMode);\n\n let taskError: Error | undefined;\n try {\n const workflowContext: WorkflowRuntime = {\n task,\n taskSlug,\n cwd,\n isCloudMode,\n options,\n logger: this.logger,\n fileManager: this.fileManager,\n gitManager: this.gitManager,\n promptBuilder: this.promptBuilder,\n progressReporter: this.progressReporter,\n adapter: this.adapter,\n mcpServers: this.mcpServers,\n posthogAPI: this.posthogAPI,\n extractor: this.extractor,\n emitEvent: (event: any) => this.emitEvent(event),\n stepResults: {},\n };\n\n for (const step of TASK_WORKFLOW) {\n const result = await step.run({ step, context: workflowContext });\n if (result.halt) {\n return;\n }\n }\n\n const shouldCreatePR = options.createPR ?? isCloudMode;\n if (shouldCreatePR) {\n await this.ensurePullRequest(task, workflowContext.stepResults);\n }\n\n this.logger.info('Task execution complete', { taskId: task.id });\n this.emitEvent(this.adapter.createStatusEvent('task_complete', { taskId: task.id }));\n } catch (error) {\n taskError = error instanceof Error ? error : new Error(String(error));\n this.logger.error('Task execution failed', { taskId: task.id, error: taskError.message });\n } finally {\n if (taskError) {\n await this.progressReporter.fail(taskError);\n throw taskError;\n } else {\n await this.progressReporter.complete();\n }\n }\n }\n\n // Direct prompt execution - still supported for low-level usage\n async run(prompt: string, options: { repositoryPath?: string; permissionMode?: import('./types.js').PermissionMode; queryOverrides?: Record<string, any>; canUseTool?: CanUseTool } = {}): Promise<ExecutionResult> {\n await this._configureLlmGateway();\n const baseOptions: Record<string, any> = {\n model: \"claude-sonnet-4-5-20250929\",\n cwd: options.repositoryPath || this.workingDirectory,\n permissionMode: (options.permissionMode as any) || \"default\",\n settingSources: [\"local\"],\n mcpServers: this.mcpServers,\n };\n\n // Add canUseTool hook if provided (options take precedence over instance config)\n const canUseTool = options.canUseTool || this.canUseTool;\n if (canUseTool) {\n baseOptions.canUseTool = canUseTool;\n }\n\n const response = query({\n prompt,\n options: { ...baseOptions, ...(options.queryOverrides || {}) },\n });\n\n const results = [];\n for await (const message of response) {\n this.logger.debug('Received message in direct run', message);\n // Emit raw SDK event\n this.emitEvent(this.adapter.createRawSDKEvent(message));\n // Emit transformed event\n const transformedEvent = this.adapter.transform(message);\n if (transformedEvent) {\n this.emitEvent(transformedEvent);\n }\n results.push(message);\n }\n \n return { results };\n }\n \n // PostHog task operations\n async fetchTask(taskId: string): Promise<Task> {\n this.logger.debug('Fetching task from PostHog', { taskId });\n if (!this.posthogAPI) {\n const error = new Error('PostHog API not configured. Provide posthogApiUrl and posthogApiKey in constructor.');\n this.logger.error('PostHog API not configured', error);\n throw error;\n }\n return this.posthogAPI.fetchTask(taskId);\n }\n\n getPostHogClient(): PostHogAPIClient | undefined {\n return this.posthogAPI;\n }\n \n async listTasks(filters?: {\n repository?: string;\n organization?: string;\n origin_product?: string;\n }): Promise<Task[]> {\n if (!this.posthogAPI) {\n throw new Error('PostHog API not configured. Provide posthogApiUrl and posthogApiKey in constructor.');\n }\n return this.posthogAPI.listTasks(filters);\n }\n \n // File system operations for task artifacts\n async writeTaskFile(taskId: string, fileName: string, content: string, type: 'plan' | 'context' | 'reference' | 'output' = 'reference'): Promise<void> {\n this.logger.debug('Writing task file', { taskId, fileName, type, contentLength: content.length });\n await this.fileManager.writeTaskFile(taskId, { name: fileName, content, type });\n }\n \n async readTaskFile(taskId: string, fileName: string): Promise<string | null> {\n this.logger.debug('Reading task file', { taskId, fileName });\n return await this.fileManager.readTaskFile(taskId, fileName);\n }\n \n async getTaskFiles(taskId: string): Promise<any[]> {\n this.logger.debug('Getting task files', { taskId });\n const files = await this.fileManager.getTaskFiles(taskId);\n this.logger.debug('Found task files', { taskId, fileCount: files.length });\n return files;\n }\n \n async writePlan(taskId: string, plan: string): Promise<void> {\n this.logger.info('Writing plan', { taskId, planLength: plan.length });\n await this.fileManager.writePlan(taskId, plan);\n }\n \n async readPlan(taskId: string): Promise<string | null> {\n this.logger.debug('Reading plan', { taskId });\n return await this.fileManager.readPlan(taskId);\n }\n\n async extractQuestionsFromResearch(taskId: string, includeAnswers: boolean = false): Promise<ExtractedQuestion[] | ExtractedQuestionWithAnswer[]> {\n this.logger.info('Extracting questions from research.md', { taskId, includeAnswers });\n \n if (!this.extractor) {\n throw new Error('OpenAI extractor not initialized. Ensure the LLM gateway is configured.');\n }\n\n const researchContent = await this.fileManager.readResearch(taskId);\n if (!researchContent) {\n throw new Error('research.md not found for task ' + taskId);\n }\n\n if (includeAnswers) {\n return await this.extractor.extractQuestionsWithAnswers(researchContent);\n } else {\n return await this.extractor.extractQuestions(researchContent);\n }\n }\n\n // Git operations for task execution\n async createPlanningBranch(taskId: string): Promise<string> {\n this.logger.info('Creating planning branch', { taskId });\n const branchName = await this.gitManager.createTaskPlanningBranch(taskId);\n this.logger.debug('Planning branch created', { taskId, branchName });\n // Only create gitignore after we're on the new branch\n await this.fileManager.ensureGitignore();\n return branchName;\n }\n \n async commitPlan(taskId: string, taskTitle: string): Promise<string> {\n this.logger.info('Committing plan', { taskId, taskTitle });\n const commitHash = await this.gitManager.commitPlan(taskId, taskTitle);\n this.logger.debug('Plan committed', { taskId, commitHash });\n return commitHash;\n }\n \n async createImplementationBranch(taskId: string, planningBranchName?: string): Promise<string> {\n this.logger.info('Creating implementation branch', { taskId, fromBranch: planningBranchName });\n const branchName = await this.gitManager.createTaskImplementationBranch(taskId, planningBranchName);\n this.logger.debug('Implementation branch created', { taskId, branchName });\n return branchName;\n }\n \n async commitImplementation(taskId: string, taskTitle: string, planSummary?: string): Promise<string> {\n this.logger.info('Committing implementation', { taskId, taskTitle });\n const commitHash = await this.gitManager.commitImplementation(taskId, taskTitle, planSummary);\n this.logger.debug('Implementation committed', { taskId, commitHash });\n return commitHash;\n }\n\n async createPullRequest(taskId: string, branchName: string, taskTitle: string, taskDescription: string): Promise<string> {\n this.logger.info('Creating pull request', { taskId, branchName, taskTitle });\n\n // Build PR body\n const prBody = `## Task Details\n**Task ID**: ${taskId}\n**Description**: ${taskDescription}\n\n## Changes\nThis PR implements the changes described in the task.\n\nGenerated by PostHog Agent`;\n\n const prUrl = await this.gitManager.createPullRequest(\n branchName,\n taskTitle,\n prBody\n );\n\n this.logger.info('Pull request created', { taskId, prUrl });\n return prUrl;\n }\n\n async attachPullRequestToTask(taskId: string, prUrl: string, branchName?: string): Promise<void> {\n this.logger.info('Attaching PR to task run', { taskId, prUrl, branchName });\n\n if (!this.posthogAPI || !this.progressReporter.runId) {\n const error = new Error('PostHog API not configured or no active run. Cannot attach PR to task.');\n this.logger.error('PostHog API not configured', error);\n throw error;\n }\n\n const updates: any = {\n output: { pr_url: prUrl }\n };\n if (branchName) {\n updates.branch = branchName;\n }\n\n await this.posthogAPI.updateTaskRun(taskId, this.progressReporter.runId, updates);\n this.logger.debug('PR attached to task run', { taskId, runId: this.progressReporter.runId, prUrl });\n }\n\n async updateTaskBranch(taskId: string, branchName: string): Promise<void> {\n this.logger.info('Updating task run branch', { taskId, branchName });\n\n if (!this.posthogAPI || !this.progressReporter.runId) {\n const error = new Error('PostHog API not configured or no active run. Cannot update branch.');\n this.logger.error('PostHog API not configured', error);\n throw error;\n }\n\n await this.posthogAPI.updateTaskRun(taskId, this.progressReporter.runId, { branch: branchName });\n this.logger.debug('Task run branch updated', { taskId, runId: this.progressReporter.runId, branchName });\n }\n\n // Execution management\n cancelTask(taskId: string): void {\n // Find the execution for this task and cancel it\n for (const [executionId, execution] of this.taskManager['executionStates']) {\n if (execution.taskId === taskId && execution.status === 'running') {\n this.taskManager.cancelExecution(executionId);\n break;\n }\n }\n }\n\n getTaskExecutionStatus(taskId: string): string | null {\n // Find the execution for this task\n for (const execution of this.taskManager['executionStates'].values()) {\n if (execution.taskId === taskId) {\n return execution.status;\n }\n }\n return null;\n }\n\n private async prepareTaskBranch(taskSlug: string, isCloudMode: boolean): Promise<void> {\n if (await this.gitManager.hasChanges()) {\n throw new Error('Cannot start task with uncommitted changes. Please commit or stash your changes first.');\n }\n\n await this.gitManager.resetToDefaultBranchIfNeeded();\n\n const existingBranch = await this.gitManager.getTaskBranch(taskSlug);\n if (!existingBranch) {\n const branchName = await this.gitManager.createTaskBranch(taskSlug);\n this.emitEvent(this.adapter.createStatusEvent('branch_created', { branch: branchName }));\n\n await this.fileManager.ensureGitignore();\n await this.gitManager.addAllPostHogFiles();\n if (isCloudMode) {\n await this.gitManager.commitAndPush(`Initialize task ${taskSlug}`, { allowEmpty: true });\n } else {\n await this.gitManager.commitChanges(`Initialize task ${taskSlug}`);\n }\n } else {\n this.logger.info('Switching to existing task branch', { branch: existingBranch });\n await this.gitManager.switchToBranch(existingBranch);\n }\n }\n\n private ensureOpenAIGatewayEnv(gatewayUrl?: string, token?: string): void {\n const resolvedGatewayUrl = gatewayUrl || process.env.ANTHROPIC_BASE_URL;\n const resolvedToken = token || process.env.ANTHROPIC_AUTH_TOKEN;\n\n if (resolvedGatewayUrl) {\n process.env.OPENAI_BASE_URL = resolvedGatewayUrl;\n }\n\n if (resolvedToken) {\n process.env.OPENAI_API_KEY = resolvedToken;\n }\n\n if (!this.extractor) {\n this.extractor = new AISDKExtractor({apiKey: resolvedToken || '', gatewayUrl: resolvedGatewayUrl || '', logger: this.logger.child('AISDKExtractor')});\n }\n }\n\n private async ensurePullRequest(task: Task, stepResults: Record<string, any>): Promise<void> {\n const latestRun = task.latest_run;\n const existingPr =\n latestRun?.output && typeof latestRun.output === 'object'\n ? (latestRun.output as any).pr_url\n : null;\n\n if (existingPr) {\n this.logger.info('PR already exists, skipping creation', { taskId: task.id, prUrl: existingPr });\n return;\n }\n\n const buildResult = stepResults['build'];\n if (!buildResult?.commitCreated) {\n this.logger.warn('Build step did not produce a commit; skipping PR creation', { taskId: task.id });\n return;\n }\n\n const branchName = await this.gitManager.getCurrentBranch();\n const prUrl = await this.createPullRequest(\n task.id,\n branchName,\n task.title,\n task.description ?? ''\n );\n\n this.emitEvent(this.adapter.createStatusEvent('pr_created', { prUrl }));\n\n try {\n await this.attachPullRequestToTask(task.id, prUrl, branchName);\n this.logger.info('PR attached to task successfully', { taskId: task.id, prUrl });\n } catch (error) {\n this.logger.warn('Could not attach PR to task', {\n error: error instanceof Error ? error.message : String(error),\n });\n }\n }\n\n private emitEvent(event: any): void {\n if (this.debug && event.type !== 'token') {\n // Log all events except tokens (too verbose)\n this.logger.debug('Emitting event', { type: event.type, ts: event.ts });\n }\n const persistPromise = this.progressReporter.recordEvent(event);\n if (persistPromise && typeof persistPromise.then === 'function') {\n persistPromise.catch((error: Error) =>\n this.logger.debug('Failed to persist agent event', { message: error.message })\n );\n }\n this.onEvent?.(event);\n }\n}\n\nexport { PermissionMode } from './types.js';\nexport type { Task, SupportingFile, ExecutionResult, AgentConfig } from './types.js';\n"],"names":[],"mappings":";;;;;;;;;;;;;;MAgBa,KAAK,CAAA;AACN,IAAA,gBAAgB;AAChB,IAAA,OAAO;AACP,IAAA,WAAW;AACX,IAAA,UAAU;AACV,IAAA,WAAW;AACX,IAAA,UAAU;AACV,IAAA,eAAe;AACf,IAAA,OAAO;AACP,IAAA,MAAM;AACN,IAAA,gBAAgB;AAChB,IAAA,aAAa;AACb,IAAA,SAAS;AACT,IAAA,UAAU;AACV,IAAA,UAAU;AACX,IAAA,KAAK;AAEZ,IAAA,WAAA,CAAY,MAAmB,EAAA;QAC3B,IAAI,CAAC,gBAAgB,GAAG,MAAM,CAAC,gBAAgB,IAAI,OAAO,CAAC,GAAG,EAAE;AAChE,QAAA,IAAI,CAAC,OAAO,GAAG,MA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G,IAAI,CAAC,gBAAgB,CAAC,WAAW,CAAC,KAAK,CAAC;QAC/D,IAAI,cAAc,IAAI,OAAO,cAAc,CAAC,IAAI,KAAK,UAAU,EAAE;YAC7D,cAAc,CAAC,KAAK,CAAC,CAAC,KAAY,KAC9B,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,+BAA+B,EAAE,EAAE,OAAO,EAAE,KAAK,CAAC,OAAO,EAAE,CAAC,CACjF;QACL;AACA,QAAA,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC;IACzB;AACH;;;;"}
1
+ {"version":3,"file":"agent.js","sources":["../../src/agent.ts"],"sourcesContent":["import { query } from \"@anthropic-ai/claude-agent-sdk\";\nimport type { Task, ExecutionResult, AgentConfig, CanUseTool } from './types.js';\nimport { TaskManager } from './task-manager.js';\nimport { PostHogAPIClient } from './posthog-api.js';\nimport { PostHogFileManager } from './file-manager.js';\nimport { GitManager } from './git-manager.js';\nimport { TemplateManager } from './template-manager.js';\nimport { ClaudeAdapter } from './adapters/claude/claude-adapter.js';\nimport type { ProviderAdapter } from './adapters/types.js';\nimport { Logger } from './utils/logger.js';\nimport { PromptBuilder } from './prompt-builder.js';\nimport { TaskProgressReporter } from './task-progress-reporter.js';\nimport { TASK_WORKFLOW } from './workflow/config.js';\nimport type { WorkflowRuntime } from './workflow/types.js';\n\nexport class Agent {\n private workingDirectory: string;\n private onEvent?: (event: any) => void;\n private taskManager: TaskManager;\n private posthogAPI?: PostHogAPIClient;\n private fileManager: PostHogFileManager;\n private gitManager: GitManager;\n private templateManager: TemplateManager;\n private adapter: ProviderAdapter;\n private logger: Logger;\n private progressReporter: TaskProgressReporter;\n private promptBuilder: PromptBuilder;\n private mcpServers?: Record<string, any>;\n private canUseTool?: CanUseTool;\n public debug: boolean;\n\n constructor(config: AgentConfig) {\n this.workingDirectory = config.workingDirectory || process.cwd();\n this.onEvent = config.onEvent;\n this.canUseTool = config.canUseTool;\n this.debug = config.debug || false;\n\n // Build default PostHog MCP server configuration\n const posthogMcpUrl = config.posthogMcpUrl\n || process.env.POSTHOG_MCP_URL\n || 'https://mcp.posthog.com/mcp';\n\n // Add auth if API key provided\n const headers: Record<string, string> = {};\n if (config.posthogApiKey) {\n headers['Authorization'] = `Bearer ${config.posthogApiKey}`;\n }\n\n const defaultMcpServers = {\n posthog: {\n type: 'http' as const,\n url: posthogMcpUrl,\n ...(Object.keys(headers).length > 0 ? { headers } : {}),\n }\n };\n\n // Merge default PostHog MCP with user-provided servers (user config takes precedence)\n this.mcpServers = {\n ...defaultMcpServers,\n ...config.mcpServers\n };\n this.logger = new Logger({ debug: this.debug, prefix: '[PostHog Agent]' });\n this.taskManager = new TaskManager();\n // Hardcode Claude adapter for now - extensible for other providers later\n this.adapter = new ClaudeAdapter();\n\n this.fileManager = new PostHogFileManager(\n this.workingDirectory,\n this.logger.child('FileManager')\n );\n this.gitManager = new GitManager({\n repositoryPath: this.workingDirectory,\n logger: this.logger.child('GitManager')\n // TODO: Add author config from environment or config\n });\n this.templateManager = new TemplateManager();\n\n if (config.posthogApiUrl && config.posthogApiKey) {\n this.posthogAPI = new PostHogAPIClient({\n apiUrl: config.posthogApiUrl,\n apiKey: config.posthogApiKey,\n projectId: config.posthogProjectId,\n });\n }\n\n this.promptBuilder = new PromptBuilder({\n getTaskFiles: (taskId: string) => this.getTaskFiles(taskId),\n generatePlanTemplate: (vars) => this.templateManager.generatePlan(vars),\n posthogClient: this.posthogAPI,\n logger: this.logger.child('PromptBuilder')\n });\n this.progressReporter = new TaskProgressReporter(this.posthogAPI, this.logger);\n }\n\n /**\n * Enable or disable debug logging\n */\n setDebug(enabled: boolean) {\n this.debug = enabled;\n this.logger.setDebug(enabled);\n }\n\n /**\n * Configure LLM gateway environment variables for Claude Code CLI\n */\n private async _configureLlmGateway(): Promise<void> {\n if (!this.posthogAPI) {\n return;\n }\n\n try {\n const gatewayUrl = this.posthogAPI.getLlmGatewayUrl();\n const apiKey = this.posthogAPI.getApiKey();\n\n process.env.ANTHROPIC_BASE_URL = gatewayUrl;\n process.env.ANTHROPIC_AUTH_TOKEN = apiKey;\n this.ensureOpenAIGatewayEnv(gatewayUrl, apiKey);\n\n this.logger.debug('Configured LLM gateway', { gatewayUrl });\n } catch (error) {\n this.logger.error('Failed to configure LLM gateway', error);\n throw error;\n }\n }\n\n // Adaptive task execution orchestrated via workflow steps\n async runTask(taskOrId: Task | string, options: import('./types.js').TaskExecutionOptions = {}): Promise<void> {\n await this._configureLlmGateway();\n\n const task = typeof taskOrId === 'string' ? await this.fetchTask(taskOrId) : taskOrId;\n const cwd = options.repositoryPath || this.workingDirectory;\n const isCloudMode = options.isCloudMode ?? false;\n const taskSlug = (task as any).slug || task.id;\n\n this.logger.info('Starting adaptive task execution', { taskId: task.id, taskSlug, isCloudMode });\n\n // Initialize progress reporter for task run tracking (needed for PR attachment)\n await this.progressReporter.start(task.id, { totalSteps: TASK_WORKFLOW.length });\n this.emitEvent(this.adapter.createStatusEvent('run_started', { runId: this.progressReporter.runId }));\n\n await this.prepareTaskBranch(taskSlug, isCloudMode);\n\n let taskError: Error | undefined;\n try {\n const workflowContext: WorkflowRuntime = {\n task,\n taskSlug,\n cwd,\n isCloudMode,\n options,\n logger: this.logger,\n fileManager: this.fileManager,\n gitManager: this.gitManager,\n promptBuilder: this.promptBuilder,\n progressReporter: this.progressReporter,\n adapter: this.adapter,\n mcpServers: this.mcpServers,\n posthogAPI: this.posthogAPI,\n emitEvent: (event: any) => this.emitEvent(event),\n stepResults: {},\n };\n\n for (const step of TASK_WORKFLOW) {\n const result = await step.run({ step, context: workflowContext });\n if (result.halt) {\n return;\n }\n }\n\n const shouldCreatePR = options.createPR ?? isCloudMode;\n if (shouldCreatePR) {\n await this.ensurePullRequest(task, workflowContext.stepResults);\n }\n\n this.logger.info('Task execution complete', { taskId: task.id });\n this.emitEvent(this.adapter.createStatusEvent('task_complete', { taskId: task.id }));\n } catch (error) {\n taskError = error instanceof Error ? error : new Error(String(error));\n this.logger.error('Task execution failed', { taskId: task.id, error: taskError.message });\n } finally {\n if (taskError) {\n await this.progressReporter.fail(taskError);\n throw taskError;\n } else {\n await this.progressReporter.complete();\n }\n }\n }\n\n // Direct prompt execution - still supported for low-level usage\n async run(prompt: string, options: { repositoryPath?: string; permissionMode?: import('./types.js').PermissionMode; queryOverrides?: Record<string, any>; canUseTool?: CanUseTool } = {}): Promise<ExecutionResult> {\n await this._configureLlmGateway();\n const baseOptions: Record<string, any> = {\n model: \"claude-sonnet-4-5-20250929\",\n cwd: options.repositoryPath || this.workingDirectory,\n permissionMode: (options.permissionMode as any) || \"default\",\n settingSources: [\"local\"],\n mcpServers: this.mcpServers,\n };\n\n // Add canUseTool hook if provided (options take precedence over instance config)\n const canUseTool = options.canUseTool || this.canUseTool;\n if (canUseTool) {\n baseOptions.canUseTool = canUseTool;\n }\n\n const response = query({\n prompt,\n options: { ...baseOptions, ...(options.queryOverrides || {}) },\n });\n\n const results = [];\n for await (const message of response) {\n this.logger.debug('Received message in direct run', message);\n // Emit raw SDK event\n this.emitEvent(this.adapter.createRawSDKEvent(message));\n // Emit transformed event\n const transformedEvent = this.adapter.transform(message);\n if (transformedEvent) {\n this.emitEvent(transformedEvent);\n }\n results.push(message);\n }\n \n return { results };\n }\n \n // PostHog task operations\n async fetchTask(taskId: string): Promise<Task> {\n this.logger.debug('Fetching task from PostHog', { taskId });\n if (!this.posthogAPI) {\n const error = new Error('PostHog API not configured. Provide posthogApiUrl and posthogApiKey in constructor.');\n this.logger.error('PostHog API not configured', error);\n throw error;\n }\n return this.posthogAPI.fetchTask(taskId);\n }\n\n getPostHogClient(): PostHogAPIClient | undefined {\n return this.posthogAPI;\n }\n \n async listTasks(filters?: {\n repository?: string;\n organization?: string;\n origin_product?: string;\n }): Promise<Task[]> {\n if (!this.posthogAPI) {\n throw new Error('PostHog API not configured. Provide posthogApiUrl and posthogApiKey in constructor.');\n }\n return this.posthogAPI.listTasks(filters);\n }\n \n // File system operations for task artifacts\n async writeTaskFile(taskId: string, fileName: string, content: string, type: 'plan' | 'context' | 'reference' | 'output' = 'reference'): Promise<void> {\n this.logger.debug('Writing task file', { taskId, fileName, type, contentLength: content.length });\n await this.fileManager.writeTaskFile(taskId, { name: fileName, content, type });\n }\n \n async readTaskFile(taskId: string, fileName: string): Promise<string | null> {\n this.logger.debug('Reading task file', { taskId, fileName });\n return await this.fileManager.readTaskFile(taskId, fileName);\n }\n \n async getTaskFiles(taskId: string): Promise<any[]> {\n this.logger.debug('Getting task files', { taskId });\n const files = await this.fileManager.getTaskFiles(taskId);\n this.logger.debug('Found task files', { taskId, fileCount: files.length });\n return files;\n }\n \n async writePlan(taskId: string, plan: string): Promise<void> {\n this.logger.info('Writing plan', { taskId, planLength: plan.length });\n await this.fileManager.writePlan(taskId, plan);\n }\n \n async readPlan(taskId: string): Promise<string | null> {\n this.logger.debug('Reading plan', { taskId });\n return await this.fileManager.readPlan(taskId);\n }\n\n // Git operations for task execution\n async createPlanningBranch(taskId: string): Promise<string> {\n this.logger.info('Creating planning branch', { taskId });\n const branchName = await this.gitManager.createTaskPlanningBranch(taskId);\n this.logger.debug('Planning branch created', { taskId, branchName });\n return branchName;\n }\n \n async commitPlan(taskId: string, taskTitle: string): Promise<string> {\n this.logger.info('Committing plan', { taskId, taskTitle });\n const commitHash = await this.gitManager.commitPlan(taskId, taskTitle);\n this.logger.debug('Plan committed', { taskId, commitHash });\n return commitHash;\n }\n \n async createImplementationBranch(taskId: string, planningBranchName?: string): Promise<string> {\n this.logger.info('Creating implementation branch', { taskId, fromBranch: planningBranchName });\n const branchName = await this.gitManager.createTaskImplementationBranch(taskId, planningBranchName);\n this.logger.debug('Implementation branch created', { taskId, branchName });\n return branchName;\n }\n \n async commitImplementation(taskId: string, taskTitle: string, planSummary?: string): Promise<string> {\n this.logger.info('Committing implementation', { taskId, taskTitle });\n const commitHash = await this.gitManager.commitImplementation(taskId, taskTitle, planSummary);\n this.logger.debug('Implementation committed', { taskId, commitHash });\n return commitHash;\n }\n\n async createPullRequest(taskId: string, branchName: string, taskTitle: string, taskDescription: string): Promise<string> {\n this.logger.info('Creating pull request', { taskId, branchName, taskTitle });\n\n // Build PR body\n const prBody = `## Task Details\n**Task ID**: ${taskId}\n**Description**: ${taskDescription}\n\n## Changes\nThis PR implements the changes described in the task.\n\nGenerated by PostHog Agent`;\n\n const prUrl = await this.gitManager.createPullRequest(\n branchName,\n taskTitle,\n prBody\n );\n\n this.logger.info('Pull request created', { taskId, prUrl });\n return prUrl;\n }\n\n async attachPullRequestToTask(taskId: string, prUrl: string, branchName?: string): Promise<void> {\n this.logger.info('Attaching PR to task run', { taskId, prUrl, branchName });\n\n if (!this.posthogAPI || !this.progressReporter.runId) {\n const error = new Error('PostHog API not configured or no active run. Cannot attach PR to task.');\n this.logger.error('PostHog API not configured', error);\n throw error;\n }\n\n const updates: any = {\n output: { pr_url: prUrl }\n };\n if (branchName) {\n updates.branch = branchName;\n }\n\n await this.posthogAPI.updateTaskRun(taskId, this.progressReporter.runId, updates);\n this.logger.debug('PR attached to task run', { taskId, runId: this.progressReporter.runId, prUrl });\n }\n\n async updateTaskBranch(taskId: string, branchName: string): Promise<void> {\n this.logger.info('Updating task run branch', { taskId, branchName });\n\n if (!this.posthogAPI || !this.progressReporter.runId) {\n const error = new Error('PostHog API not configured or no active run. Cannot update branch.');\n this.logger.error('PostHog API not configured', error);\n throw error;\n }\n\n await this.posthogAPI.updateTaskRun(taskId, this.progressReporter.runId, { branch: branchName });\n this.logger.debug('Task run branch updated', { taskId, runId: this.progressReporter.runId, branchName });\n }\n\n // Execution management\n cancelTask(taskId: string): void {\n // Find the execution for this task and cancel it\n for (const [executionId, execution] of this.taskManager['executionStates']) {\n if (execution.taskId === taskId && execution.status === 'running') {\n this.taskManager.cancelExecution(executionId);\n break;\n }\n }\n }\n\n getTaskExecutionStatus(taskId: string): string | null {\n // Find the execution for this task\n for (const execution of this.taskManager['executionStates'].values()) {\n if (execution.taskId === taskId) {\n return execution.status;\n }\n }\n return null;\n }\n\n private async prepareTaskBranch(taskSlug: string, isCloudMode: boolean): Promise<void> {\n if (await this.gitManager.hasChanges()) {\n throw new Error('Cannot start task with uncommitted changes. Please commit or stash your changes first.');\n }\n\n await this.gitManager.resetToDefaultBranchIfNeeded();\n\n const existingBranch = await this.gitManager.getTaskBranch(taskSlug);\n if (!existingBranch) {\n const branchName = await this.gitManager.createTaskBranch(taskSlug);\n this.emitEvent(this.adapter.createStatusEvent('branch_created', { branch: branchName }));\n\n await this.gitManager.addAllPostHogFiles();\n \n // Only commit if there are changes or we're in cloud mode\n if (isCloudMode) {\n await this.gitManager.commitAndPush(`Initialize task ${taskSlug}`, { allowEmpty: true });\n } else {\n // Check if there are any changes before committing\n const hasChanges = await this.gitManager.hasStagedChanges();\n if (hasChanges) {\n await this.gitManager.commitChanges(`Initialize task ${taskSlug}`);\n }\n }\n } else {\n this.logger.info('Switching to existing task branch', { branch: existingBranch });\n await this.gitManager.switchToBranch(existingBranch);\n }\n }\n\n private ensureOpenAIGatewayEnv(gatewayUrl?: string, token?: string): void {\n const resolvedGatewayUrl = gatewayUrl || process.env.ANTHROPIC_BASE_URL;\n const resolvedToken = token || process.env.ANTHROPIC_AUTH_TOKEN;\n\n if (resolvedGatewayUrl) {\n process.env.OPENAI_BASE_URL = resolvedGatewayUrl;\n }\n\n if (resolvedToken) {\n process.env.OPENAI_API_KEY = resolvedToken;\n }\n }\n\n private async ensurePullRequest(task: Task, stepResults: Record<string, any>): Promise<void> {\n const latestRun = task.latest_run;\n const existingPr =\n latestRun?.output && typeof latestRun.output === 'object'\n ? (latestRun.output as any).pr_url\n : null;\n\n if (existingPr) {\n this.logger.info('PR already exists, skipping creation', { taskId: task.id, prUrl: existingPr });\n return;\n }\n\n const buildResult = stepResults['build'];\n if (!buildResult?.commitCreated) {\n this.logger.warn('Build step did not produce a commit; skipping PR creation', { taskId: task.id });\n return;\n }\n\n const branchName = await this.gitManager.getCurrentBranch();\n const prUrl = await this.createPullRequest(\n task.id,\n branchName,\n task.title,\n task.description ?? ''\n );\n\n this.emitEvent(this.adapter.createStatusEvent('pr_created', { prUrl }));\n\n try {\n await this.attachPullRequestToTask(task.id, prUrl, branchName);\n this.logger.info('PR attached to task successfully', { taskId: task.id, prUrl });\n } catch (error) {\n this.logger.warn('Could not attach PR to task', {\n error: error instanceof Error ? error.message : String(error),\n });\n }\n }\n\n private emitEvent(event: any): void {\n if (this.debug && event.type !== 'token') {\n // Log all events except tokens (too verbose)\n this.logger.debug('Emitting event', { type: event.type, ts: event.ts });\n }\n const persistPromise = this.progressReporter.recordEvent(event);\n if (persistPromise && typeof persistPromise.then === 'function') {\n persistPromise.catch((error: Error) =>\n this.logger.debug('Failed to persist agent event', { message: error.message })\n );\n }\n this.onEvent?.(event);\n }\n}\n\nexport { PermissionMode } from './types.js';\nexport type { Task, SupportingFile, ExecutionResult, AgentConfig } from './types.js';\n"],"names":[],"mappings":";;;;;;;;;;;;;MAea,KAAK,CAAA;AACN,IAAA,gBAAgB;AAChB,IAAA,OAAO;AACP,IAAA,WAAW;AACX,IAAA,UAAU;AACV,IAAA,WAAW;AACX,IAAA,UAAU;AACV,IAAA,eAAe;AACf,IAAA,OAAO;AACP,IAAA,MAAM;AACN,IAAA,gBAAgB;AAChB,IAAA,aAAa;AACb,IAAA,UAAU;AACV,IAAA,UAAU;AACX,IAAA,KAAK;AAEZ,IAAA,WAAA,CAAY,MAAmB,EAAA;QAC3B,IAAI,CAAC,gBAAgB,GAAG,MAAM,CAAC,gBAAgB,IAAI,OAAO,CAAC,GAAG,EAAE;AAChE,QAAA,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC,OAAO;AAC7B,QAAA,IAAI,CAAC,UAAU,GAAG,MAAM,CAAC,UAAU;QACnC,IAAI,CAAC,KAAK,GAAG,MAAM,CAAC,KAAK,IAAI,KAAK;;AAGlC,QAAA,MAAM,aAAa,GAAG,MAAM,CAAC;eACtB,OAAO,CAAC,GAAG,CAAC;AACZ,eAAA,6BAA6B;;QAGpC,MAAM,OAAO,GAA2B,EAA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+BAA+B,EAAE,EAAE,OAAO,EAAE,KAAK,CAAC,OAAO,EAAE,CAAC,CACjF;QACL;AACA,QAAA,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC;IACzB;AACH;;;;"}
@@ -1,2 +1,2 @@
1
- export declare const RESEARCH_SYSTEM_PROMPT = "<role>\nPostHog AI Research Agent \u2014 analyze codebases to understand implementation context and identify areas of focus for development tasks.\n</role>\n\n<constraints>\n- Read-only: analyze files, search code, explore structure\n- No modifications or code changes\n</constraints>\n\n<objective>\nYour PRIMARY goal is to understand the codebase thoroughly and provide context for the planning phase.\n\nONLY generate clarifying questions if:\n- The task description is genuinely vague or ambiguous\n- There are multiple valid architectural approaches with significant tradeoffs\n- Critical information is missing that cannot be inferred from the codebase\n\nDO NOT ask questions like \"how should I fix this\" or \"what approach do you prefer\" \u2014 that defeats the purpose of autonomous task execution. The user has already specified what they want done.\n</objective>\n\n<process>\n1. Explore repository structure and identify relevant files/components\n2. Understand existing patterns, conventions, and dependencies\n3. Locate similar implementations or related code\n4. Identify the key areas of the codebase that will be affected\n5. Document your findings to provide context for planning\n6. ONLY if genuinely needed: generate 2-3 specific clarification questions\n</process>\n\n<output_format>\nOutput ONLY the markdown artifact with no preamble:\n\n```markdown\n# Research Findings\n\n## Codebase Analysis\n[Brief summary of relevant code structure, patterns, and files]\n\n## Key Areas of Focus\n[List specific files/components that need modification]\n\n## Implementation Context\n[Important patterns, dependencies, or constraints found in the code]\n\n## Clarifying Questions\n[ONLY include this section if it will increase the quality of the plan]\n\n## Question 1: [Specific architectural decision]\n**Options:**\n- a) [Concrete option with file references]\n- b) [Alternative with file references]\n- c) Something else (please specify)\n```\n\nFormat requirements:\n- Use \"## Question N:\" for question headers (h2)\n- Follow with \"**Options:**\" on its own line\n- Start options with \"- a)\", \"- b)\", \"- c)\"\n- Always include \"c) Something else (please specify)\"\n- Max 4 questions total\n</output_format>\n\n<examples>\n<good_example>\nTask: \"Fix authentication bug in login flow\"\nOutput: Research findings showing auth flow files, patterns used, NO questions needed\n</good_example>\n\n<bad_example>\nTask: \"Fix authentication bug\"\nOutput: \"How should I fix the authentication? a) Fix it one way b) Fix it another way\"\nReason: Don't ask HOW to do the task \u2014 that's what the agent is for\n</bad_example>\n\n<good_example>\nTask: \"Add caching to API endpoints\"\nOutput: Research showing existing cache implementations, question about cache backend choice IF multiple production systems are already in use\n</good_example>\n</examples>";
1
+ export declare const RESEARCH_SYSTEM_PROMPT = "<role>\nPostHog AI Research Agent \u2014 analyze codebases to evaluate task actionability and identify missing information.\n</role>\n\n<constraints>\n- Read-only: analyze files, search code, explore structure\n- No modifications or code changes\n- Output structured JSON only\n</constraints>\n\n<objective>\nYour PRIMARY goal is to evaluate whether a task is actionable and assign an actionability score.\n\nCalculate an actionabilityScore (0-1) based on:\n- **Task clarity** (0.4 weight): Is the task description specific and unambiguous?\n- **Codebase context** (0.3 weight): Can you locate the relevant code and patterns?\n- **Architectural decisions** (0.2 weight): Are the implementation approaches clear?\n- **Dependencies** (0.1 weight): Are required dependencies and constraints understood?\n\nIf actionabilityScore < 0.7, generate specific clarifying questions to increase confidence.\n\nDO NOT ask questions like \"how should I fix this\" \u2014 focus on missing information that prevents confident planning.\n</objective>\n\n<process>\n1. Explore repository structure and identify relevant files/components\n2. Understand existing patterns, conventions, and dependencies\n3. Calculate actionabilityScore based on clarity, context, architecture, and dependencies\n4. Identify key files that will need modification\n5. If score < 0.7: generate 2-4 specific questions to resolve blockers\n6. Output JSON matching ResearchEvaluation schema\n</process>\n\n<output_format>\nOutput ONLY valid JSON with no markdown wrappers, no preamble, no explanation:\n\n{\n \"actionabilityScore\": 0.85,\n \"context\": \"Brief 2-3 sentence summary of the task and implementation approach\",\n \"keyFiles\": [\"path/to/file1.ts\", \"path/to/file2.ts\"],\n \"blockers\": [\"Optional: what's preventing full confidence\"],\n \"questions\": [\n {\n \"id\": \"q1\",\n \"question\": \"Specific architectural decision needed?\",\n \"options\": [\n \"First approach with concrete details\",\n \"Alternative approach with concrete details\",\n \"Third option if needed\"\n ]\n }\n ]\n}\n\nRules:\n- actionabilityScore: number between 0 and 1\n- context: concise summary for planning phase\n- keyFiles: array of file paths that need modification\n- blockers: optional array explaining confidence gaps\n- questions: ONLY include if actionabilityScore < 0.7\n- Each question must have 2-3 options (maximum 3)\n- Max 3 questions total\n</output_format>\n\n<scoring_examples>\n<example score=\"0.9\">\nTask: \"Fix typo in login button text\"\nReasoning: Completely clear task, found exact component, no architectural decisions\n</example>\n\n<example score=\"0.75\">\nTask: \"Add caching to API endpoints\"\nReasoning: Clear goal, found endpoints, but multiple caching strategies possible\n</example>\n\n<example score=\"0.55\">\nTask: \"Improve performance\"\nReasoning: Vague task, unclear scope, needs questions about which areas to optimize\nQuestions needed: Which features are slow? What metrics define success?\n</example>\n\n<example score=\"0.3\">\nTask: \"Add the new feature\"\nReasoning: Extremely vague, no context, cannot locate relevant code\nQuestions needed: What feature? Which product area? What should it do?\n</example>\n</scoring_examples>\n\n<question_examples>\n<good_example>\n{\n \"id\": \"q1\",\n \"question\": \"Which caching layer should we use for API responses?\",\n \"options\": [\n \"Redis (existing infrastructure, requires setup)\",\n \"In-memory cache (simpler, but not distributed)\",\n \"Browser-side caching only (minimal backend changes)\"\n ]\n}\n</good_example>\n\n<bad_example>\n{\n \"id\": \"q1\", \n \"question\": \"How should I implement this?\",\n \"options\": [\"One way\", \"Another way\"]\n}\nReason: Too vague, doesn't explain the tradeoffs\n</bad_example>\n</question_examples>";
2
2
  //# sourceMappingURL=research.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"research.d.ts","sourceRoot":"","sources":["../../../src/agents/research.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,sBAAsB,s0FA8EvB,CAAC"}
1
+ {"version":3,"file":"research.d.ts","sourceRoot":"","sources":["../../../src/agents/research.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,sBAAsB,yyHA6Gd,CAAC"}
@@ -1,82 +1,113 @@
1
1
  const RESEARCH_SYSTEM_PROMPT = `<role>
2
- PostHog AI Research Agent — analyze codebases to understand implementation context and identify areas of focus for development tasks.
2
+ PostHog AI Research Agent — analyze codebases to evaluate task actionability and identify missing information.
3
3
  </role>
4
4
 
5
5
  <constraints>
6
6
  - Read-only: analyze files, search code, explore structure
7
7
  - No modifications or code changes
8
+ - Output structured JSON only
8
9
  </constraints>
9
10
 
10
11
  <objective>
11
- Your PRIMARY goal is to understand the codebase thoroughly and provide context for the planning phase.
12
+ Your PRIMARY goal is to evaluate whether a task is actionable and assign an actionability score.
12
13
 
13
- ONLY generate clarifying questions if:
14
- - The task description is genuinely vague or ambiguous
15
- - There are multiple valid architectural approaches with significant tradeoffs
16
- - Critical information is missing that cannot be inferred from the codebase
14
+ Calculate an actionabilityScore (0-1) based on:
15
+ - **Task clarity** (0.4 weight): Is the task description specific and unambiguous?
16
+ - **Codebase context** (0.3 weight): Can you locate the relevant code and patterns?
17
+ - **Architectural decisions** (0.2 weight): Are the implementation approaches clear?
18
+ - **Dependencies** (0.1 weight): Are required dependencies and constraints understood?
17
19
 
18
- DO NOT ask questions like "how should I fix this" or "what approach do you prefer" — that defeats the purpose of autonomous task execution. The user has already specified what they want done.
20
+ If actionabilityScore < 0.7, generate specific clarifying questions to increase confidence.
21
+
22
+ DO NOT ask questions like "how should I fix this" — focus on missing information that prevents confident planning.
19
23
  </objective>
20
24
 
21
25
  <process>
22
26
  1. Explore repository structure and identify relevant files/components
23
27
  2. Understand existing patterns, conventions, and dependencies
24
- 3. Locate similar implementations or related code
25
- 4. Identify the key areas of the codebase that will be affected
26
- 5. Document your findings to provide context for planning
27
- 6. ONLY if genuinely needed: generate 2-3 specific clarification questions
28
+ 3. Calculate actionabilityScore based on clarity, context, architecture, and dependencies
29
+ 4. Identify key files that will need modification
30
+ 5. If score < 0.7: generate 2-4 specific questions to resolve blockers
31
+ 6. Output JSON matching ResearchEvaluation schema
28
32
  </process>
29
33
 
30
34
  <output_format>
31
- Output ONLY the markdown artifact with no preamble:
32
-
33
- \`\`\`markdown
34
- # Research Findings
35
-
36
- ## Codebase Analysis
37
- [Brief summary of relevant code structure, patterns, and files]
38
-
39
- ## Key Areas of Focus
40
- [List specific files/components that need modification]
41
-
42
- ## Implementation Context
43
- [Important patterns, dependencies, or constraints found in the code]
44
-
45
- ## Clarifying Questions
46
- [ONLY include this section if it will increase the quality of the plan]
47
-
48
- ## Question 1: [Specific architectural decision]
49
- **Options:**
50
- - a) [Concrete option with file references]
51
- - b) [Alternative with file references]
52
- - c) Something else (please specify)
53
- \`\`\`
54
-
55
- Format requirements:
56
- - Use "## Question N:" for question headers (h2)
57
- - Follow with "**Options:**" on its own line
58
- - Start options with "- a)", "- b)", "- c)"
59
- - Always include "c) Something else (please specify)"
60
- - Max 4 questions total
35
+ Output ONLY valid JSON with no markdown wrappers, no preamble, no explanation:
36
+
37
+ {
38
+ "actionabilityScore": 0.85,
39
+ "context": "Brief 2-3 sentence summary of the task and implementation approach",
40
+ "keyFiles": ["path/to/file1.ts", "path/to/file2.ts"],
41
+ "blockers": ["Optional: what's preventing full confidence"],
42
+ "questions": [
43
+ {
44
+ "id": "q1",
45
+ "question": "Specific architectural decision needed?",
46
+ "options": [
47
+ "First approach with concrete details",
48
+ "Alternative approach with concrete details",
49
+ "Third option if needed"
50
+ ]
51
+ }
52
+ ]
53
+ }
54
+
55
+ Rules:
56
+ - actionabilityScore: number between 0 and 1
57
+ - context: concise summary for planning phase
58
+ - keyFiles: array of file paths that need modification
59
+ - blockers: optional array explaining confidence gaps
60
+ - questions: ONLY include if actionabilityScore < 0.7
61
+ - Each question must have 2-3 options (maximum 3)
62
+ - Max 3 questions total
61
63
  </output_format>
62
64
 
63
- <examples>
65
+ <scoring_examples>
66
+ <example score="0.9">
67
+ Task: "Fix typo in login button text"
68
+ Reasoning: Completely clear task, found exact component, no architectural decisions
69
+ </example>
70
+
71
+ <example score="0.75">
72
+ Task: "Add caching to API endpoints"
73
+ Reasoning: Clear goal, found endpoints, but multiple caching strategies possible
74
+ </example>
75
+
76
+ <example score="0.55">
77
+ Task: "Improve performance"
78
+ Reasoning: Vague task, unclear scope, needs questions about which areas to optimize
79
+ Questions needed: Which features are slow? What metrics define success?
80
+ </example>
81
+
82
+ <example score="0.3">
83
+ Task: "Add the new feature"
84
+ Reasoning: Extremely vague, no context, cannot locate relevant code
85
+ Questions needed: What feature? Which product area? What should it do?
86
+ </example>
87
+ </scoring_examples>
88
+
89
+ <question_examples>
64
90
  <good_example>
65
- Task: "Fix authentication bug in login flow"
66
- Output: Research findings showing auth flow files, patterns used, NO questions needed
91
+ {
92
+ "id": "q1",
93
+ "question": "Which caching layer should we use for API responses?",
94
+ "options": [
95
+ "Redis (existing infrastructure, requires setup)",
96
+ "In-memory cache (simpler, but not distributed)",
97
+ "Browser-side caching only (minimal backend changes)"
98
+ ]
99
+ }
67
100
  </good_example>
68
101
 
69
102
  <bad_example>
70
- Task: "Fix authentication bug"
71
- Output: "How should I fix the authentication? a) Fix it one way b) Fix it another way"
72
- Reason: Don't ask HOW to do the task — that's what the agent is for
103
+ {
104
+ "id": "q1",
105
+ "question": "How should I implement this?",
106
+ "options": ["One way", "Another way"]
107
+ }
108
+ Reason: Too vague, doesn't explain the tradeoffs
73
109
  </bad_example>
74
-
75
- <good_example>
76
- Task: "Add caching to API endpoints"
77
- Output: Research showing existing cache implementations, question about cache backend choice IF multiple production systems are already in use
78
- </good_example>
79
- </examples>`;
110
+ </question_examples>`;
80
111
 
81
112
  export { RESEARCH_SYSTEM_PROMPT };
82
113
  //# sourceMappingURL=research.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"research.js","sources":["../../../src/agents/research.ts"],"sourcesContent":["export const RESEARCH_SYSTEM_PROMPT = `<role>\nPostHog AI Research Agent — analyze codebases to understand implementation context and identify areas of focus for development tasks.\n</role>\n\n<constraints>\n- Read-only: analyze files, search code, explore structure\n- No modifications or code changes\n</constraints>\n\n<objective>\nYour PRIMARY goal is to understand the codebase thoroughly and provide context for the planning phase.\n\nONLY generate clarifying questions if:\n- The task description is genuinely vague or ambiguous\n- There are multiple valid architectural approaches with significant tradeoffs\n- Critical information is missing that cannot be inferred from the codebase\n\nDO NOT ask questions like \"how should I fix this\" or \"what approach do you prefer\" — that defeats the purpose of autonomous task execution. The user has already specified what they want done.\n</objective>\n\n<process>\n1. Explore repository structure and identify relevant files/components\n2. Understand existing patterns, conventions, and dependencies\n3. Locate similar implementations or related code\n4. Identify the key areas of the codebase that will be affected\n5. Document your findings to provide context for planning\n6. ONLY if genuinely needed: generate 2-3 specific clarification questions\n</process>\n\n<output_format>\nOutput ONLY the markdown artifact with no preamble:\n\n\\`\\`\\`markdown\n# Research Findings\n\n## Codebase Analysis\n[Brief summary of relevant code structure, patterns, and files]\n\n## Key Areas of Focus\n[List specific files/components that need modification]\n\n## Implementation Context\n[Important patterns, dependencies, or constraints found in the code]\n\n## Clarifying Questions\n[ONLY include this section if it will increase the quality of the plan]\n\n## Question 1: [Specific architectural decision]\n**Options:**\n- a) [Concrete option with file references]\n- b) [Alternative with file references]\n- c) Something else (please specify)\n\\`\\`\\`\n\nFormat requirements:\n- Use \"## Question N:\" for question headers (h2)\n- Follow with \"**Options:**\" on its own line\n- Start options with \"- a)\", \"- b)\", \"- c)\"\n- Always include \"c) Something else (please specify)\"\n- Max 4 questions total\n</output_format>\n\n<examples>\n<good_example>\nTask: \"Fix authentication bug in login flow\"\nOutput: Research findings showing auth flow files, patterns used, NO questions needed\n</good_example>\n\n<bad_example>\nTask: \"Fix authentication bug\"\nOutput: \"How should I fix the authentication? a) Fix it one way b) Fix it another way\"\nReason: Don't ask HOW to do the task that's what the agent is for\n</bad_example>\n\n<good_example>\nTask: \"Add caching to API endpoints\"\nOutput: Research showing existing cache implementations, question about cache backend choice IF multiple production systems are already in use\n</good_example>\n</examples>`;\n\n"],"names":[],"mappings":"AAAO,MAAM,sBAAsB,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"research.js","sources":["../../../src/agents/research.ts"],"sourcesContent":["export const RESEARCH_SYSTEM_PROMPT = `<role>\nPostHog AI Research Agent — analyze codebases to evaluate task actionability and identify missing information.\n</role>\n\n<constraints>\n- Read-only: analyze files, search code, explore structure\n- No modifications or code changes\n- Output structured JSON only\n</constraints>\n\n<objective>\nYour PRIMARY goal is to evaluate whether a task is actionable and assign an actionability score.\n\nCalculate an actionabilityScore (0-1) based on:\n- **Task clarity** (0.4 weight): Is the task description specific and unambiguous?\n- **Codebase context** (0.3 weight): Can you locate the relevant code and patterns?\n- **Architectural decisions** (0.2 weight): Are the implementation approaches clear?\n- **Dependencies** (0.1 weight): Are required dependencies and constraints understood?\n\nIf actionabilityScore < 0.7, generate specific clarifying questions to increase confidence.\n\nDO NOT ask questions like \"how should I fix this\" focus on missing information that prevents confident planning.\n</objective>\n\n<process>\n1. Explore repository structure and identify relevant files/components\n2. Understand existing patterns, conventions, and dependencies\n3. Calculate actionabilityScore based on clarity, context, architecture, and dependencies\n4. Identify key files that will need modification\n5. If score < 0.7: generate 2-4 specific questions to resolve blockers\n6. Output JSON matching ResearchEvaluation schema\n</process>\n\n<output_format>\nOutput ONLY valid JSON with no markdown wrappers, no preamble, no explanation:\n\n{\n \"actionabilityScore\": 0.85,\n \"context\": \"Brief 2-3 sentence summary of the task and implementation approach\",\n \"keyFiles\": [\"path/to/file1.ts\", \"path/to/file2.ts\"],\n \"blockers\": [\"Optional: what's preventing full confidence\"],\n \"questions\": [\n {\n \"id\": \"q1\",\n \"question\": \"Specific architectural decision needed?\",\n \"options\": [\n \"First approach with concrete details\",\n \"Alternative approach with concrete details\",\n \"Third option if needed\"\n ]\n }\n ]\n}\n\nRules:\n- actionabilityScore: number between 0 and 1\n- context: concise summary for planning phase\n- keyFiles: array of file paths that need modification\n- blockers: optional array explaining confidence gaps\n- questions: ONLY include if actionabilityScore < 0.7\n- Each question must have 2-3 options (maximum 3)\n- Max 3 questions total\n</output_format>\n\n<scoring_examples>\n<example score=\"0.9\">\nTask: \"Fix typo in login button text\"\nReasoning: Completely clear task, found exact component, no architectural decisions\n</example>\n\n<example score=\"0.75\">\nTask: \"Add caching to API endpoints\"\nReasoning: Clear goal, found endpoints, but multiple caching strategies possible\n</example>\n\n<example score=\"0.55\">\nTask: \"Improve performance\"\nReasoning: Vague task, unclear scope, needs questions about which areas to optimize\nQuestions needed: Which features are slow? What metrics define success?\n</example>\n\n<example score=\"0.3\">\nTask: \"Add the new feature\"\nReasoning: Extremely vague, no context, cannot locate relevant code\nQuestions needed: What feature? Which product area? What should it do?\n</example>\n</scoring_examples>\n\n<question_examples>\n<good_example>\n{\n \"id\": \"q1\",\n \"question\": \"Which caching layer should we use for API responses?\",\n \"options\": [\n \"Redis (existing infrastructure, requires setup)\",\n \"In-memory cache (simpler, but not distributed)\",\n \"Browser-side caching only (minimal backend changes)\"\n ]\n}\n</good_example>\n\n<bad_example>\n{\n \"id\": \"q1\", \n \"question\": \"How should I implement this?\",\n \"options\": [\"One way\", \"Another way\"]\n}\nReason: Too vague, doesn't explain the tradeoffs\n</bad_example>\n</question_examples>`;\n\n"],"names":[],"mappings":"AAAO,MAAM,sBAAsB,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1,25 +1,10 @@
1
- import type { SupportingFile } from './types.js';
1
+ import type { SupportingFile, ResearchEvaluation } from './types.js';
2
2
  import { Logger } from './utils/logger.js';
3
3
  export interface TaskFile {
4
4
  name: string;
5
5
  content: string;
6
6
  type: 'plan' | 'context' | 'reference' | 'output' | 'artifact';
7
7
  }
8
- export interface QuestionData {
9
- id: string;
10
- question: string;
11
- options: string[];
12
- }
13
- export interface AnswerData {
14
- questionId: string;
15
- selectedOption: string;
16
- customInput?: string;
17
- }
18
- export interface QuestionsFile {
19
- questions: QuestionData[];
20
- answered: boolean;
21
- answers: AnswerData[] | null;
22
- }
23
8
  export declare class PostHogFileManager {
24
9
  private repositoryPath;
25
10
  private logger;
@@ -39,11 +24,8 @@ export declare class PostHogFileManager {
39
24
  readContext(taskId: string): Promise<string | null>;
40
25
  writeRequirements(taskId: string, requirements: string): Promise<void>;
41
26
  readRequirements(taskId: string): Promise<string | null>;
42
- writeResearch(taskId: string, content: string): Promise<void>;
43
- readResearch(taskId: string): Promise<string | null>;
44
- writeQuestions(taskId: string, data: QuestionsFile): Promise<void>;
45
- readQuestions(taskId: string): Promise<QuestionsFile | null>;
27
+ writeResearch(taskId: string, data: ResearchEvaluation): Promise<void>;
28
+ readResearch(taskId: string): Promise<ResearchEvaluation | null>;
46
29
  getTaskFiles(taskId: string): Promise<SupportingFile[]>;
47
- ensureGitignore(): Promise<void>;
48
30
  }
49
31
  //# sourceMappingURL=file-manager.d.ts.map