@posthog/agent 1.16.6 → 1.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -2
- package/dist/claude-cli/cli.js +3617 -0
- package/dist/claude-cli/package.json +3 -0
- package/dist/index.d.ts +1 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/src/agent.d.ts +0 -3
- package/dist/src/agent.d.ts.map +1 -1
- package/dist/src/agent.js +6 -27
- package/dist/src/agent.js.map +1 -1
- package/dist/src/agents/research.d.ts +1 -1
- package/dist/src/agents/research.d.ts.map +1 -1
- package/dist/src/agents/research.js +84 -53
- package/dist/src/agents/research.js.map +1 -1
- package/dist/src/file-manager.d.ts +3 -21
- package/dist/src/file-manager.d.ts.map +1 -1
- package/dist/src/file-manager.js +15 -47
- package/dist/src/file-manager.js.map +1 -1
- package/dist/src/git-manager.d.ts.map +1 -1
- package/dist/src/git-manager.js +8 -1
- package/dist/src/git-manager.js.map +1 -1
- package/dist/src/posthog-api.d.ts +6 -1
- package/dist/src/posthog-api.d.ts.map +1 -1
- package/dist/src/posthog-api.js +28 -0
- package/dist/src/posthog-api.js.map +1 -1
- package/dist/src/task-progress-reporter.d.ts.map +1 -1
- package/dist/src/task-progress-reporter.js +0 -1
- package/dist/src/task-progress-reporter.js.map +1 -1
- package/dist/src/types.d.ts +21 -2
- package/dist/src/types.d.ts.map +1 -1
- package/dist/src/types.js.map +1 -1
- package/dist/src/workflow/steps/plan.d.ts.map +1 -1
- package/dist/src/workflow/steps/plan.js +26 -18
- package/dist/src/workflow/steps/plan.js.map +1 -1
- package/dist/src/workflow/steps/research.d.ts.map +1 -1
- package/dist/src/workflow/steps/research.js +100 -66
- package/dist/src/workflow/steps/research.js.map +1 -1
- package/dist/src/workflow/types.d.ts +0 -2
- package/dist/src/workflow/types.d.ts.map +1 -1
- package/dist/templates/plan-template.md +1 -5
- package/package.json +2 -6
- package/src/agent.ts +7 -31
- package/src/agents/research.ts +84 -53
- package/src/file-manager.ts +18 -73
- package/src/git-manager.ts +7 -1
- package/src/posthog-api.ts +33 -1
- package/src/task-progress-reporter.ts +0 -1
- package/src/templates/plan-template.md +1 -5
- package/src/types.ts +25 -2
- package/src/workflow/steps/plan.ts +28 -21
- package/src/workflow/steps/research.ts +109 -74
- package/src/workflow/types.ts +0 -2
- package/dist/_virtual/_commonjsHelpers.js +0 -6
- package/dist/_virtual/_commonjsHelpers.js.map +0 -1
- package/dist/_virtual/index.js +0 -4
- package/dist/_virtual/index.js.map +0 -1
- package/dist/node_modules/@ai-sdk/anthropic/dist/index.js +0 -1154
- package/dist/node_modules/@ai-sdk/anthropic/dist/index.js.map +0 -1
- package/dist/node_modules/@ai-sdk/provider/dist/index.js +0 -296
- package/dist/node_modules/@ai-sdk/provider/dist/index.js.map +0 -1
- package/dist/node_modules/@ai-sdk/provider-utils/dist/index.js +0 -576
- package/dist/node_modules/@ai-sdk/provider-utils/dist/index.js.map +0 -1
- package/dist/node_modules/@ai-sdk/ui-utils/dist/index.js +0 -741
- package/dist/node_modules/@ai-sdk/ui-utils/dist/index.js.map +0 -1
- package/dist/node_modules/@opentelemetry/api/build/esm/api/context.js +0 -112
- package/dist/node_modules/@opentelemetry/api/build/esm/api/context.js.map +0 -1
- package/dist/node_modules/@opentelemetry/api/build/esm/api/diag.js +0 -123
- package/dist/node_modules/@opentelemetry/api/build/esm/api/diag.js.map +0 -1
- package/dist/node_modules/@opentelemetry/api/build/esm/api/metrics.js +0 -62
- package/dist/node_modules/@opentelemetry/api/build/esm/api/metrics.js.map +0 -1
- package/dist/node_modules/@opentelemetry/api/build/esm/api/propagation.js +0 -91
- package/dist/node_modules/@opentelemetry/api/build/esm/api/propagation.js.map +0 -1
- package/dist/node_modules/@opentelemetry/api/build/esm/api/trace.js +0 -79
- package/dist/node_modules/@opentelemetry/api/build/esm/api/trace.js.map +0 -1
- package/dist/node_modules/@opentelemetry/api/build/esm/baggage/context-helpers.js +0 -59
- package/dist/node_modules/@opentelemetry/api/build/esm/baggage/context-helpers.js.map +0 -1
- package/dist/node_modules/@opentelemetry/api/build/esm/baggage/internal/baggage-impl.js +0 -99
- package/dist/node_modules/@opentelemetry/api/build/esm/baggage/internal/baggage-impl.js.map +0 -1
- package/dist/node_modules/@opentelemetry/api/build/esm/baggage/utils.js +0 -31
- package/dist/node_modules/@opentelemetry/api/build/esm/baggage/utils.js.map +0 -1
- package/dist/node_modules/@opentelemetry/api/build/esm/context/NoopContextManager.js +0 -69
- package/dist/node_modules/@opentelemetry/api/build/esm/context/NoopContextManager.js.map +0 -1
- package/dist/node_modules/@opentelemetry/api/build/esm/context/context.js +0 -54
- package/dist/node_modules/@opentelemetry/api/build/esm/context/context.js.map +0 -1
- package/dist/node_modules/@opentelemetry/api/build/esm/context-api.js +0 -22
- package/dist/node_modules/@opentelemetry/api/build/esm/context-api.js.map +0 -1
- package/dist/node_modules/@opentelemetry/api/build/esm/diag/ComponentLogger.js +0 -104
- package/dist/node_modules/@opentelemetry/api/build/esm/diag/ComponentLogger.js.map +0 -1
- package/dist/node_modules/@opentelemetry/api/build/esm/diag/internal/logLevelLogger.js +0 -44
- package/dist/node_modules/@opentelemetry/api/build/esm/diag/internal/logLevelLogger.js.map +0 -1
- package/dist/node_modules/@opentelemetry/api/build/esm/diag/types.js +0 -43
- package/dist/node_modules/@opentelemetry/api/build/esm/diag/types.js.map +0 -1
- package/dist/node_modules/@opentelemetry/api/build/esm/diag-api.js +0 -27
- package/dist/node_modules/@opentelemetry/api/build/esm/diag-api.js.map +0 -1
- package/dist/node_modules/@opentelemetry/api/build/esm/internal/global-utils.js +0 -62
- package/dist/node_modules/@opentelemetry/api/build/esm/internal/global-utils.js.map +0 -1
- package/dist/node_modules/@opentelemetry/api/build/esm/internal/semver.js +0 -121
- package/dist/node_modules/@opentelemetry/api/build/esm/internal/semver.js.map +0 -1
- package/dist/node_modules/@opentelemetry/api/build/esm/metrics/NoopMeter.js +0 -167
- package/dist/node_modules/@opentelemetry/api/build/esm/metrics/NoopMeter.js.map +0 -1
- package/dist/node_modules/@opentelemetry/api/build/esm/metrics/NoopMeterProvider.js +0 -33
- package/dist/node_modules/@opentelemetry/api/build/esm/metrics/NoopMeterProvider.js.map +0 -1
- package/dist/node_modules/@opentelemetry/api/build/esm/metrics-api.js +0 -22
- package/dist/node_modules/@opentelemetry/api/build/esm/metrics-api.js.map +0 -1
- package/dist/node_modules/@opentelemetry/api/build/esm/platform/node/globalThis.js +0 -21
- package/dist/node_modules/@opentelemetry/api/build/esm/platform/node/globalThis.js.map +0 -1
- package/dist/node_modules/@opentelemetry/api/build/esm/propagation/NoopTextMapPropagator.js +0 -35
- package/dist/node_modules/@opentelemetry/api/build/esm/propagation/NoopTextMapPropagator.js.map +0 -1
- package/dist/node_modules/@opentelemetry/api/build/esm/propagation/TextMapPropagator.js +0 -40
- package/dist/node_modules/@opentelemetry/api/build/esm/propagation/TextMapPropagator.js.map +0 -1
- package/dist/node_modules/@opentelemetry/api/build/esm/propagation-api.js +0 -22
- package/dist/node_modules/@opentelemetry/api/build/esm/propagation-api.js.map +0 -1
- package/dist/node_modules/@opentelemetry/api/build/esm/trace/NonRecordingSpan.js +0 -70
- package/dist/node_modules/@opentelemetry/api/build/esm/trace/NonRecordingSpan.js.map +0 -1
- package/dist/node_modules/@opentelemetry/api/build/esm/trace/NoopTracer.js +0 -78
- package/dist/node_modules/@opentelemetry/api/build/esm/trace/NoopTracer.js.map +0 -1
- package/dist/node_modules/@opentelemetry/api/build/esm/trace/NoopTracerProvider.js +0 -34
- package/dist/node_modules/@opentelemetry/api/build/esm/trace/NoopTracerProvider.js.map +0 -1
- package/dist/node_modules/@opentelemetry/api/build/esm/trace/ProxyTracer.js +0 -55
- package/dist/node_modules/@opentelemetry/api/build/esm/trace/ProxyTracer.js.map +0 -1
- package/dist/node_modules/@opentelemetry/api/build/esm/trace/ProxyTracerProvider.js +0 -56
- package/dist/node_modules/@opentelemetry/api/build/esm/trace/ProxyTracerProvider.js.map +0 -1
- package/dist/node_modules/@opentelemetry/api/build/esm/trace/context-utils.js +0 -76
- package/dist/node_modules/@opentelemetry/api/build/esm/trace/context-utils.js.map +0 -1
- package/dist/node_modules/@opentelemetry/api/build/esm/trace/invalid-span-constants.js +0 -27
- package/dist/node_modules/@opentelemetry/api/build/esm/trace/invalid-span-constants.js.map +0 -1
- package/dist/node_modules/@opentelemetry/api/build/esm/trace/spancontext-utils.js +0 -45
- package/dist/node_modules/@opentelemetry/api/build/esm/trace/spancontext-utils.js.map +0 -1
- package/dist/node_modules/@opentelemetry/api/build/esm/trace/status.js +0 -22
- package/dist/node_modules/@opentelemetry/api/build/esm/trace/status.js.map +0 -1
- package/dist/node_modules/@opentelemetry/api/build/esm/trace/trace_flags.js +0 -25
- package/dist/node_modules/@opentelemetry/api/build/esm/trace/trace_flags.js.map +0 -1
- package/dist/node_modules/@opentelemetry/api/build/esm/trace-api.js +0 -24
- package/dist/node_modules/@opentelemetry/api/build/esm/trace-api.js.map +0 -1
- package/dist/node_modules/@opentelemetry/api/build/esm/version.js +0 -20
- package/dist/node_modules/@opentelemetry/api/build/esm/version.js.map +0 -1
- package/dist/node_modules/ai/dist/index.js +0 -2870
- package/dist/node_modules/ai/dist/index.js.map +0 -1
- package/dist/node_modules/nanoid/non-secure/index.js +0 -13
- package/dist/node_modules/nanoid/non-secure/index.js.map +0 -1
- package/dist/node_modules/secure-json-parse/index.js +0 -133
- package/dist/node_modules/secure-json-parse/index.js.map +0 -1
- package/dist/node_modules/zod-to-json-schema/dist/esm/Options.js +0 -37
- package/dist/node_modules/zod-to-json-schema/dist/esm/Options.js.map +0 -1
- package/dist/node_modules/zod-to-json-schema/dist/esm/Refs.js +0 -26
- package/dist/node_modules/zod-to-json-schema/dist/esm/Refs.js.map +0 -1
- package/dist/node_modules/zod-to-json-schema/dist/esm/errorMessages.js +0 -17
- package/dist/node_modules/zod-to-json-schema/dist/esm/errorMessages.js.map +0 -1
- package/dist/node_modules/zod-to-json-schema/dist/esm/getRelativePath.js +0 -11
- package/dist/node_modules/zod-to-json-schema/dist/esm/getRelativePath.js.map +0 -1
- package/dist/node_modules/zod-to-json-schema/dist/esm/index.js +0 -8
- package/dist/node_modules/zod-to-json-schema/dist/esm/index.js.map +0 -1
- package/dist/node_modules/zod-to-json-schema/dist/esm/parseDef.js +0 -66
- package/dist/node_modules/zod-to-json-schema/dist/esm/parseDef.js.map +0 -1
- package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/any.js +0 -21
- package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/any.js.map +0 -1
- package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/array.js +0 -30
- package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/array.js.map +0 -1
- package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/bigint.js +0 -53
- package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/bigint.js.map +0 -1
- package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/boolean.js +0 -8
- package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/boolean.js.map +0 -1
- package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/branded.js +0 -8
- package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/branded.js.map +0 -1
- package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/catch.js +0 -8
- package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/catch.js.map +0 -1
- package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/date.js +0 -50
- package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/date.js.map +0 -1
- package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/default.js +0 -11
- package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/default.js.map +0 -1
- package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/effects.js +0 -11
- package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/effects.js.map +0 -1
- package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/enum.js +0 -9
- package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/enum.js.map +0 -1
- package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/intersection.js +0 -56
- package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/intersection.js.map +0 -1
- package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/literal.js +0 -24
- package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/literal.js.map +0 -1
- package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/map.js +0 -30
- package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/map.js.map +0 -1
- package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/nativeEnum.js +0 -19
- package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/nativeEnum.js.map +0 -1
- package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/never.js +0 -15
- package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/never.js.map +0 -1
- package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/null.js +0 -13
- package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/null.js.map +0 -1
- package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/nullable.js +0 -37
- package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/nullable.js.map +0 -1
- package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/number.js +0 -56
- package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/number.js.map +0 -1
- package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/object.js +0 -76
- package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/object.js.map +0 -1
- package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/optional.js +0 -25
- package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/optional.js.map +0 -1
- package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/pipeline.js +0 -24
- package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/pipeline.js.map +0 -1
- package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/promise.js +0 -8
- package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/promise.js.map +0 -1
- package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/readonly.js +0 -8
- package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/readonly.js.map +0 -1
- package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/record.js +0 -65
- package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/record.js.map +0 -1
- package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/set.js +0 -24
- package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/set.js.map +0 -1
- package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/string.js +0 -350
- package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/string.js.map +0 -1
- package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/tuple.js +0 -36
- package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/tuple.js.map +0 -1
- package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/undefined.js +0 -10
- package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/undefined.js.map +0 -1
- package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/union.js +0 -84
- package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/union.js.map +0 -1
- package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/unknown.js +0 -8
- package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/unknown.js.map +0 -1
- package/dist/node_modules/zod-to-json-schema/dist/esm/selectParser.js +0 -110
- package/dist/node_modules/zod-to-json-schema/dist/esm/selectParser.js.map +0 -1
- package/dist/node_modules/zod-to-json-schema/dist/esm/zodToJsonSchema.js +0 -90
- package/dist/node_modules/zod-to-json-schema/dist/esm/zodToJsonSchema.js.map +0 -1
- package/dist/src/structured-extraction.d.ts +0 -28
- package/dist/src/structured-extraction.d.ts.map +0 -1
- package/dist/src/structured-extraction.js +0 -77
- package/dist/src/structured-extraction.js.map +0 -1
- package/dist/src/utils/ai-sdk.d.ts +0 -14
- package/dist/src/utils/ai-sdk.d.ts.map +0 -1
- package/dist/src/utils/ai-sdk.js +0 -38
- package/dist/src/utils/ai-sdk.js.map +0 -1
- package/src/structured-extraction.ts +0 -117
- package/src/utils/ai-sdk.ts +0 -47
package/dist/src/types.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { CanUseTool, PermissionResult } from '@anthropic-ai/claude-agent-sdk
|
|
1
|
+
import type { CanUseTool, PermissionResult } from '@anthropic-ai/claude-agent-sdk';
|
|
2
2
|
export type { CanUseTool, PermissionResult };
|
|
3
3
|
export interface Task {
|
|
4
4
|
id: string;
|
|
@@ -28,7 +28,7 @@ export interface TaskRun {
|
|
|
28
28
|
team: number;
|
|
29
29
|
branch: string | null;
|
|
30
30
|
status: 'started' | 'in_progress' | 'completed' | 'failed';
|
|
31
|
-
|
|
31
|
+
log_url?: string;
|
|
32
32
|
error_message: string | null;
|
|
33
33
|
output: Record<string, unknown> | null;
|
|
34
34
|
state: Record<string, unknown>;
|
|
@@ -260,4 +260,23 @@ export interface UrlMention {
|
|
|
260
260
|
id?: string;
|
|
261
261
|
label?: string;
|
|
262
262
|
}
|
|
263
|
+
export interface ResearchQuestion {
|
|
264
|
+
id: string;
|
|
265
|
+
question: string;
|
|
266
|
+
options: string[];
|
|
267
|
+
}
|
|
268
|
+
export interface ResearchAnswer {
|
|
269
|
+
questionId: string;
|
|
270
|
+
selectedOption: string;
|
|
271
|
+
customInput?: string;
|
|
272
|
+
}
|
|
273
|
+
export interface ResearchEvaluation {
|
|
274
|
+
actionabilityScore: number;
|
|
275
|
+
context: string;
|
|
276
|
+
keyFiles: string[];
|
|
277
|
+
blockers?: string[];
|
|
278
|
+
questions?: ResearchQuestion[];
|
|
279
|
+
answered?: boolean;
|
|
280
|
+
answers?: ResearchAnswer[];
|
|
281
|
+
}
|
|
263
282
|
//# sourceMappingURL=types.d.ts.map
|
package/dist/src/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"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;IACnB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAGD,MAAM,WAAW,gBAAgB;IAC/B,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB;AAED,MAAM,WAAW,cAAc;IAC7B,UAAU,EAAE,MAAM,CAAC;IACnB,cAAc,EAAE,MAAM,CAAC;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,kBAAkB;IACjC,kBAAkB,EAAE,MAAM,CAAC;IAC3B,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,SAAS,CAAC,EAAE,gBAAgB,EAAE,CAAC;IAC/B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,cAAc,EAAE,CAAC;CAC5B"}
|
package/dist/src/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sources":["../../src/types.ts"],"sourcesContent":["\n// import and export to keep a single type file\nimport type { CanUseTool, PermissionResult } from '@anthropic-ai/claude-agent-sdk/sdkTypes.js';\nexport type { CanUseTool, PermissionResult };\n\n// PostHog Task model (matches Array's OpenAPI schema)\nexport interface Task {\n id: string;\n title: string;\n description: string;\n origin_product: 'error_tracking' | 'eval_clusters' | 'user_created' | 'support_queue' | 'session_summaries';\n position?: number;\n github_integration?: number | null;\n repository_config?: unknown; // JSONField\n repository_list: string;\n primary_repository: string;\n created_at: string;\n updated_at: string;\n\n // DEPRECATED: These fields have been moved to TaskRun\n // Use task.latest_run instead\n current_stage?: string | null;\n github_branch?: string | null;\n github_pr_url?: string | null;\n latest_run?: TaskRun;\n}\n\n// Log entry structure for TaskRun.log\nexport interface LogEntry {\n type: string; // e.g., \"info\", \"warning\", \"error\", \"success\", \"debug\"\n message: string;\n [key: string]: unknown; // Allow additional fields\n}\n\n// TaskRun model - represents individual execution runs of tasks\nexport interface TaskRun {\n id: string;\n task: string; // Task ID\n team: number;\n branch: string | null;\n status: 'started' | 'in_progress' | 'completed' | 'failed';\n log: LogEntry[]; // Array of log entry objects\n error_message: string | null;\n output: Record<string, unknown> | null; // Structured output (PR URL, commit SHA, etc.)\n state: Record<string, unknown>; // Intermediate run state (defaults to {}, never null)\n created_at: string;\n updated_at: string;\n completed_at: string | null;\n}\n\nexport interface SupportingFile {\n name: string;\n content: string;\n type: 'plan' | 'context' | 'reference' | 'output';\n created_at: string;\n}\n\nexport enum PermissionMode {\n PLAN = \"plan\",\n DEFAULT = \"default\",\n ACCEPT_EDITS = \"acceptEdits\",\n BYPASS = \"bypassPermissions\"\n}\n\nexport interface ExecutionOptions {\n repositoryPath?: string;\n permissionMode?: PermissionMode;\n}\n\nexport interface TaskExecutionOptions {\n repositoryPath?: string;\n permissionMode?: PermissionMode;\n isCloudMode?: boolean; // Determines local vs cloud behavior (local pauses after each phase)\n createPR?: boolean; // Whether to create PR after build (defaults to false if local. This setting has no effect if isCloudMode is true.)\n autoProgress?: boolean;\n queryOverrides?: Record<string, any>;\n // Fine-grained permission control (only applied to build phase)\n // See: https://docs.claude.com/en/api/agent-sdk/permissions\n canUseTool?: CanUseTool;\n}\n\n// Base event with timestamp\ninterface BaseEvent {\n ts: number;\n}\n\n// Streaming content events\nexport interface TokenEvent extends BaseEvent {\n type: 'token';\n content: string;\n contentType?: 'text' | 'thinking' | 'tool_input';\n}\n\nexport interface ContentBlockStartEvent extends BaseEvent {\n type: 'content_block_start';\n index: number;\n contentType: 'text' | 'tool_use' | 'thinking';\n toolName?: string;\n toolId?: string;\n}\n\nexport interface ContentBlockStopEvent extends BaseEvent {\n type: 'content_block_stop';\n index: number;\n}\n\n// Tool events\nexport interface ToolCallEvent extends BaseEvent {\n type: 'tool_call';\n toolName: string;\n callId: string;\n args: Record<string, any>;\n parentToolUseId?: string | null; // For nested tool calls (subagents)\n // Tool metadata (enriched by adapter for UI consumption)\n tool?: import('./tools/types.js').Tool;\n category?: import('./tools/types.js').ToolCategory;\n}\n\nexport interface ToolResultEvent extends BaseEvent {\n type: 'tool_result';\n toolName: string;\n callId: string;\n result: any;\n isError?: boolean; // Whether the tool execution failed\n parentToolUseId?: string | null; // For nested tool calls (subagents)\n // Tool metadata (enriched by adapter for UI consumption)\n tool?: import('./tools/types.js').Tool;\n category?: import('./tools/types.js').ToolCategory;\n}\n\n// Message lifecycle events\nexport interface MessageStartEvent extends BaseEvent {\n type: 'message_start';\n messageId?: string;\n model?: string;\n}\n\nexport interface MessageDeltaEvent extends BaseEvent {\n type: 'message_delta';\n stopReason?: string;\n stopSequence?: string;\n usage?: {\n outputTokens: number;\n };\n}\n\nexport interface MessageStopEvent extends BaseEvent {\n type: 'message_stop';\n}\n\n// User message events\nexport interface UserMessageEvent extends BaseEvent {\n type: 'user_message';\n content: string;\n isSynthetic?: boolean;\n}\n\n// System events\nexport interface StatusEvent extends BaseEvent {\n type: 'status';\n phase: string;\n // Common optional fields (varies by phase):\n kind?: string; // Kind of status (plan, implementation)\n branch?: string; // Git branch name\n prUrl?: string; // Pull request URL\n taskId?: string; // Task identifier\n messageId?: string; // Claude message ID\n model?: string; // Model name\n [key: string]: any; // Allow additional fields\n}\n\nexport interface InitEvent extends BaseEvent {\n type: 'init';\n model: string;\n tools: string[];\n permissionMode: string;\n cwd: string;\n apiKeySource: string;\n agents?: string[];\n slashCommands?: string[];\n outputStyle?: string;\n mcpServers?: Array<{ name: string; status: string }>;\n}\n\nexport interface CompactBoundaryEvent extends BaseEvent {\n type: 'compact_boundary';\n trigger: 'manual' | 'auto';\n preTokens: number;\n}\n\n// Result events\nexport interface DoneEvent extends BaseEvent {\n type: 'done';\n result?: string; // Final summary text from Claude\n durationMs?: number;\n durationApiMs?: number; // API-only duration (excluding local processing)\n numTurns?: number;\n totalCostUsd?: number;\n usage?: any;\n modelUsage?: { // Per-model usage breakdown\n [modelName: string]: {\n inputTokens: number;\n outputTokens: number;\n cacheReadInputTokens: number;\n cacheCreationInputTokens: number;\n webSearchRequests: number;\n costUSD: number;\n contextWindow: number;\n };\n };\n permissionDenials?: Array<{ // Tools that were denied by permissions\n tool_name: string;\n tool_use_id: string;\n tool_input: Record<string, unknown>;\n }>;\n}\n\nexport interface ErrorEvent extends BaseEvent {\n type: 'error';\n message: string;\n error?: any;\n errorType?: string;\n context?: Record<string, any>; // Partial error context for debugging\n sdkError?: any; // Original SDK error object\n}\n\n// Metric and artifact events (general purpose, not tool-specific)\nexport interface MetricEvent extends BaseEvent {\n type: 'metric';\n key: string;\n value: number;\n unit?: string;\n}\n\nexport interface ArtifactEvent extends BaseEvent {\n type: 'artifact';\n kind: string;\n content: any;\n}\n\nexport interface RawSDKEvent extends BaseEvent {\n type: 'raw_sdk_event';\n sdkMessage: any; // Full SDK message for debugging\n}\n\nexport type AgentEvent =\n | TokenEvent\n | ContentBlockStartEvent\n | ContentBlockStopEvent\n | ToolCallEvent\n | ToolResultEvent\n | MessageStartEvent\n | MessageDeltaEvent\n | MessageStopEvent\n | UserMessageEvent\n | StatusEvent\n | InitEvent\n | CompactBoundaryEvent\n | DoneEvent\n | ErrorEvent\n | MetricEvent\n | ArtifactEvent\n | RawSDKEvent;\n\nexport interface ExecutionResult {\n results: any[];\n}\n\nexport interface PlanResult {\n plan: string;\n}\n\nexport interface TaskExecutionResult {\n task: Task;\n plan?: string;\n executionResult?: ExecutionResult;\n}\n\n// MCP Server configuration types (re-exported from Claude SDK for convenience)\nexport type McpServerConfig = {\n type?: 'stdio';\n command: string;\n args?: string[];\n env?: Record<string, string>;\n} | {\n type: 'sse';\n url: string;\n headers?: Record<string, string>;\n} | {\n type: 'http';\n url: string;\n headers?: Record<string, string>;\n} | {\n type: 'sdk';\n name: string;\n instance?: any; // McpServer instance\n};\n\nexport interface AgentConfig {\n workingDirectory?: string;\n onEvent?: (event: AgentEvent) => void;\n\n // PostHog API configuration\n posthogApiUrl: string;\n posthogApiKey: string;\n posthogProjectId: number;\n\n // PostHog MCP configuration\n posthogMcpUrl?: string;\n\n\n // MCP Server configuration\n // Additional MCP servers (PostHog MCP is always included by default)\n // You can override the PostHog MCP config by providing mcpServers.posthog\n mcpServers?: Record<string, McpServerConfig>;\n\n // Logging configuration\n debug?: boolean;\n\n // Fine-grained permission control for direct run() calls\n // See: https://docs.claude.com/en/api/agent-sdk/permissions\n canUseTool?: CanUseTool;\n}\n\nexport interface PostHogAPIConfig {\n apiUrl: string;\n apiKey: string;\n projectId: number;\n}\n\n// URL mention types\nexport type ResourceType = 'error' | 'experiment' | 'insight' | 'feature_flag' | 'generic';\n\nexport interface PostHogResource {\n type: ResourceType;\n id: string;\n url: string;\n title?: string;\n content: string;\n metadata?: Record<string, any>;\n}\n\nexport interface UrlMention {\n url: string;\n type: ResourceType;\n id?: string;\n label?: string;\n}"],"names":[],"mappings":"IAyDY;AAAZ,CAAA,UAAY,cAAc,EAAA;AACxB,IAAA,cAAA,CAAA,MAAA,CAAA,GAAA,MAAa;AACb,IAAA,cAAA,CAAA,SAAA,CAAA,GAAA,SAAmB;AACnB,IAAA,cAAA,CAAA,cAAA,CAAA,GAAA,aAA4B;AAC5B,IAAA,cAAA,CAAA,QAAA,CAAA,GAAA,mBAA4B;AAC9B,CAAC,EALW,cAAc,KAAd,cAAc,GAAA,EAAA,CAAA,CAAA;;;;"}
|
|
1
|
+
{"version":3,"file":"types.js","sources":["../../src/types.ts"],"sourcesContent":["\n// import and export to keep a single type file\nimport type { CanUseTool, PermissionResult } from '@anthropic-ai/claude-agent-sdk';\nexport type { CanUseTool, PermissionResult };\n\n// PostHog Task model (matches Array's OpenAPI schema)\nexport interface Task {\n id: string;\n title: string;\n description: string;\n origin_product: 'error_tracking' | 'eval_clusters' | 'user_created' | 'support_queue' | 'session_summaries';\n position?: number;\n github_integration?: number | null;\n repository_config?: unknown; // JSONField\n repository_list: string;\n primary_repository: string;\n created_at: string;\n updated_at: string;\n\n // DEPRECATED: These fields have been moved to TaskRun\n // Use task.latest_run instead\n current_stage?: string | null;\n github_branch?: string | null;\n github_pr_url?: string | null;\n latest_run?: TaskRun;\n}\n\n// Log entry structure for TaskRun.log\nexport interface LogEntry {\n type: string; // e.g., \"info\", \"warning\", \"error\", \"success\", \"debug\"\n message: string;\n [key: string]: unknown; // Allow additional fields\n}\n\n// TaskRun model - represents individual execution runs of tasks\nexport interface TaskRun {\n id: string;\n task: string; // Task ID\n team: number;\n branch: string | null;\n status: 'started' | 'in_progress' | 'completed' | 'failed';\n log_url?: string; // Presigned S3 URL for log access (valid for 1 hour)\n error_message: string | null;\n output: Record<string, unknown> | null; // Structured output (PR URL, commit SHA, etc.)\n state: Record<string, unknown>; // Intermediate run state (defaults to {}, never null)\n created_at: string;\n updated_at: string;\n completed_at: string | null;\n}\n\nexport interface SupportingFile {\n name: string;\n content: string;\n type: 'plan' | 'context' | 'reference' | 'output';\n created_at: string;\n}\n\nexport enum PermissionMode {\n PLAN = \"plan\",\n DEFAULT = \"default\",\n ACCEPT_EDITS = \"acceptEdits\",\n BYPASS = \"bypassPermissions\"\n}\n\nexport interface ExecutionOptions {\n repositoryPath?: string;\n permissionMode?: PermissionMode;\n}\n\nexport interface TaskExecutionOptions {\n repositoryPath?: string;\n permissionMode?: PermissionMode;\n isCloudMode?: boolean; // Determines local vs cloud behavior (local pauses after each phase)\n createPR?: boolean; // Whether to create PR after build (defaults to false if local. This setting has no effect if isCloudMode is true.)\n autoProgress?: boolean;\n queryOverrides?: Record<string, any>;\n // Fine-grained permission control (only applied to build phase)\n // See: https://docs.claude.com/en/api/agent-sdk/permissions\n canUseTool?: CanUseTool;\n}\n\n// Base event with timestamp\ninterface BaseEvent {\n ts: number;\n}\n\n// Streaming content events\nexport interface TokenEvent extends BaseEvent {\n type: 'token';\n content: string;\n contentType?: 'text' | 'thinking' | 'tool_input';\n}\n\nexport interface ContentBlockStartEvent extends BaseEvent {\n type: 'content_block_start';\n index: number;\n contentType: 'text' | 'tool_use' | 'thinking';\n toolName?: string;\n toolId?: string;\n}\n\nexport interface ContentBlockStopEvent extends BaseEvent {\n type: 'content_block_stop';\n index: number;\n}\n\n// Tool events\nexport interface ToolCallEvent extends BaseEvent {\n type: 'tool_call';\n toolName: string;\n callId: string;\n args: Record<string, any>;\n parentToolUseId?: string | null; // For nested tool calls (subagents)\n // Tool metadata (enriched by adapter for UI consumption)\n tool?: import('./tools/types.js').Tool;\n category?: import('./tools/types.js').ToolCategory;\n}\n\nexport interface ToolResultEvent extends BaseEvent {\n type: 'tool_result';\n toolName: string;\n callId: string;\n result: any;\n isError?: boolean; // Whether the tool execution failed\n parentToolUseId?: string | null; // For nested tool calls (subagents)\n // Tool metadata (enriched by adapter for UI consumption)\n tool?: import('./tools/types.js').Tool;\n category?: import('./tools/types.js').ToolCategory;\n}\n\n// Message lifecycle events\nexport interface MessageStartEvent extends BaseEvent {\n type: 'message_start';\n messageId?: string;\n model?: string;\n}\n\nexport interface MessageDeltaEvent extends BaseEvent {\n type: 'message_delta';\n stopReason?: string;\n stopSequence?: string;\n usage?: {\n outputTokens: number;\n };\n}\n\nexport interface MessageStopEvent extends BaseEvent {\n type: 'message_stop';\n}\n\n// User message events\nexport interface UserMessageEvent extends BaseEvent {\n type: 'user_message';\n content: string;\n isSynthetic?: boolean;\n}\n\n// System events\nexport interface StatusEvent extends BaseEvent {\n type: 'status';\n phase: string;\n // Common optional fields (varies by phase):\n kind?: string; // Kind of status (plan, implementation)\n branch?: string; // Git branch name\n prUrl?: string; // Pull request URL\n taskId?: string; // Task identifier\n messageId?: string; // Claude message ID\n model?: string; // Model name\n [key: string]: any; // Allow additional fields\n}\n\nexport interface InitEvent extends BaseEvent {\n type: 'init';\n model: string;\n tools: string[];\n permissionMode: string;\n cwd: string;\n apiKeySource: string;\n agents?: string[];\n slashCommands?: string[];\n outputStyle?: string;\n mcpServers?: Array<{ name: string; status: string }>;\n}\n\nexport interface CompactBoundaryEvent extends BaseEvent {\n type: 'compact_boundary';\n trigger: 'manual' | 'auto';\n preTokens: number;\n}\n\n// Result events\nexport interface DoneEvent extends BaseEvent {\n type: 'done';\n result?: string; // Final summary text from Claude\n durationMs?: number;\n durationApiMs?: number; // API-only duration (excluding local processing)\n numTurns?: number;\n totalCostUsd?: number;\n usage?: any;\n modelUsage?: { // Per-model usage breakdown\n [modelName: string]: {\n inputTokens: number;\n outputTokens: number;\n cacheReadInputTokens: number;\n cacheCreationInputTokens: number;\n webSearchRequests: number;\n costUSD: number;\n contextWindow: number;\n };\n };\n permissionDenials?: Array<{ // Tools that were denied by permissions\n tool_name: string;\n tool_use_id: string;\n tool_input: Record<string, unknown>;\n }>;\n}\n\nexport interface ErrorEvent extends BaseEvent {\n type: 'error';\n message: string;\n error?: any;\n errorType?: string;\n context?: Record<string, any>; // Partial error context for debugging\n sdkError?: any; // Original SDK error object\n}\n\n// Metric and artifact events (general purpose, not tool-specific)\nexport interface MetricEvent extends BaseEvent {\n type: 'metric';\n key: string;\n value: number;\n unit?: string;\n}\n\nexport interface ArtifactEvent extends BaseEvent {\n type: 'artifact';\n kind: string;\n content: any;\n}\n\nexport interface RawSDKEvent extends BaseEvent {\n type: 'raw_sdk_event';\n sdkMessage: any; // Full SDK message for debugging\n}\n\nexport type AgentEvent =\n | TokenEvent\n | ContentBlockStartEvent\n | ContentBlockStopEvent\n | ToolCallEvent\n | ToolResultEvent\n | MessageStartEvent\n | MessageDeltaEvent\n | MessageStopEvent\n | UserMessageEvent\n | StatusEvent\n | InitEvent\n | CompactBoundaryEvent\n | DoneEvent\n | ErrorEvent\n | MetricEvent\n | ArtifactEvent\n | RawSDKEvent;\n\nexport interface ExecutionResult {\n results: any[];\n}\n\nexport interface PlanResult {\n plan: string;\n}\n\nexport interface TaskExecutionResult {\n task: Task;\n plan?: string;\n executionResult?: ExecutionResult;\n}\n\n// MCP Server configuration types (re-exported from Claude SDK for convenience)\nexport type McpServerConfig = {\n type?: 'stdio';\n command: string;\n args?: string[];\n env?: Record<string, string>;\n} | {\n type: 'sse';\n url: string;\n headers?: Record<string, string>;\n} | {\n type: 'http';\n url: string;\n headers?: Record<string, string>;\n} | {\n type: 'sdk';\n name: string;\n instance?: any; // McpServer instance\n};\n\nexport interface AgentConfig {\n workingDirectory?: string;\n onEvent?: (event: AgentEvent) => void;\n\n // PostHog API configuration\n posthogApiUrl: string;\n posthogApiKey: string;\n posthogProjectId: number;\n\n // PostHog MCP configuration\n posthogMcpUrl?: string;\n\n\n // MCP Server configuration\n // Additional MCP servers (PostHog MCP is always included by default)\n // You can override the PostHog MCP config by providing mcpServers.posthog\n mcpServers?: Record<string, McpServerConfig>;\n\n // Logging configuration\n debug?: boolean;\n\n // Fine-grained permission control for direct run() calls\n // See: https://docs.claude.com/en/api/agent-sdk/permissions\n canUseTool?: CanUseTool;\n}\n\nexport interface PostHogAPIConfig {\n apiUrl: string;\n apiKey: string;\n projectId: number;\n}\n\n// URL mention types\nexport type ResourceType = 'error' | 'experiment' | 'insight' | 'feature_flag' | 'generic';\n\nexport interface PostHogResource {\n type: ResourceType;\n id: string;\n url: string;\n title?: string;\n content: string;\n metadata?: Record<string, any>;\n}\n\nexport interface UrlMention {\n url: string;\n type: ResourceType;\n id?: string;\n label?: string;\n}\n\n// Research evaluation types\nexport interface ResearchQuestion {\n id: string;\n question: string;\n options: string[];\n}\n\nexport interface ResearchAnswer {\n questionId: string;\n selectedOption: string;\n customInput?: string;\n}\n\nexport interface ResearchEvaluation {\n actionabilityScore: number; // 0-1 confidence score\n context: string; // brief summary for planning\n keyFiles: string[]; // files needing modification\n blockers?: string[]; // what's preventing full confidence\n questions?: ResearchQuestion[]; // only if score < 0.7\n answered?: boolean; // whether questions have been answered\n answers?: ResearchAnswer[]; // user's answers to questions\n}"],"names":[],"mappings":"IAyDY;AAAZ,CAAA,UAAY,cAAc,EAAA;AACxB,IAAA,cAAA,CAAA,MAAA,CAAA,GAAA,MAAa;AACb,IAAA,cAAA,CAAA,SAAA,CAAA,GAAA,SAAmB;AACnB,IAAA,cAAA,CAAA,cAAA,CAAA,GAAA,aAA4B;AAC5B,IAAA,cAAA,CAAA,QAAA,CAAA,GAAA,mBAA4B;AAC9B,CAAC,EALW,cAAc,KAAd,cAAc,GAAA,EAAA,CAAA,CAAA;;;;"}
|
|
@@ -1 +1 @@
|
|
|
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;AAGtD,eAAO,MAAM,QAAQ,EAAE,
|
|
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;AAGtD,eAAO,MAAM,QAAQ,EAAE,kBA8HtB,CAAC"}
|
|
@@ -10,33 +10,41 @@ const planStep = async ({ step, context }) => {
|
|
|
10
10
|
stepLogger.info('Plan already exists, skipping step', { taskId: task.id });
|
|
11
11
|
return { status: 'skipped' };
|
|
12
12
|
}
|
|
13
|
-
const
|
|
14
|
-
if (
|
|
13
|
+
const researchData = await fileManager.readResearch(task.id);
|
|
14
|
+
if (researchData?.questions && !researchData.answered) {
|
|
15
15
|
stepLogger.info('Waiting for answered research questions', { taskId: task.id });
|
|
16
16
|
emitEvent(adapter.createStatusEvent('phase_complete', { phase: 'research_questions' }));
|
|
17
17
|
return { status: 'skipped', halt: true };
|
|
18
18
|
}
|
|
19
19
|
stepLogger.info('Starting planning phase', { taskId: task.id });
|
|
20
20
|
emitEvent(adapter.createStatusEvent('phase_start', { phase: 'planning' }));
|
|
21
|
-
const researchContent = await fileManager.readResearch(task.id);
|
|
22
21
|
let researchContext = '';
|
|
23
|
-
if (
|
|
24
|
-
researchContext += `## Research
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
if (answer) {
|
|
31
|
-
researchContext += `**Selected:** ${answer.selectedOption}\n`;
|
|
32
|
-
if (answer.customInput) {
|
|
33
|
-
researchContext += `**Details:** ${answer.customInput}\n`;
|
|
34
|
-
}
|
|
22
|
+
if (researchData) {
|
|
23
|
+
researchContext += `## Research Context\n\n${researchData.context}\n\n`;
|
|
24
|
+
if (researchData.keyFiles.length > 0) {
|
|
25
|
+
researchContext += `**Key Files:**\n${researchData.keyFiles.map(f => `- ${f}`).join('\n')}\n\n`;
|
|
26
|
+
}
|
|
27
|
+
if (researchData.blockers && researchData.blockers.length > 0) {
|
|
28
|
+
researchContext += `**Considerations:**\n${researchData.blockers.map(b => `- ${b}`).join('\n')}\n\n`;
|
|
35
29
|
}
|
|
36
|
-
|
|
37
|
-
|
|
30
|
+
// Add answered questions if they exist
|
|
31
|
+
if (researchData.questions && researchData.answers && researchData.answered) {
|
|
32
|
+
researchContext += `## Implementation Decisions\n\n`;
|
|
33
|
+
for (const question of researchData.questions) {
|
|
34
|
+
const answer = researchData.answers.find((a) => a.questionId === question.id);
|
|
35
|
+
researchContext += `### ${question.question}\n\n`;
|
|
36
|
+
if (answer) {
|
|
37
|
+
researchContext += `**Selected:** ${answer.selectedOption}\n`;
|
|
38
|
+
if (answer.customInput) {
|
|
39
|
+
researchContext += `**Details:** ${answer.customInput}\n`;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
researchContext += `**Selected:** Not answered\n`;
|
|
44
|
+
}
|
|
45
|
+
researchContext += `\n`;
|
|
46
|
+
}
|
|
38
47
|
}
|
|
39
|
-
researchContext += `\n`;
|
|
40
48
|
}
|
|
41
49
|
const planningPrompt = await promptBuilder.buildPlanningPrompt(task, cwd);
|
|
42
50
|
const fullPrompt = `${PLANNING_SYSTEM_PROMPT}\n\n${planningPrompt}\n\n${researchContext}`;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plan.js","sources":["../../../../src/workflow/steps/plan.ts"],"sourcesContent":["import { query } from '@anthropic-ai/claude-agent-sdk';\nimport { PLANNING_SYSTEM_PROMPT } from '../../agents/planning.js';\nimport type { WorkflowStepRunner } from '../types.js';\nimport { finalizeStepGitActions } from '../utils.js';\n\nexport const planStep: WorkflowStepRunner = async ({ step, context }) => {\n const {\n task,\n cwd,\n isCloudMode,\n options,\n logger,\n fileManager,\n gitManager,\n promptBuilder,\n adapter,\n mcpServers,\n emitEvent,\n } = context;\n\n const stepLogger = logger.child('PlanStep');\n\n const existingPlan = await fileManager.readPlan(task.id);\n if (existingPlan) {\n stepLogger.info('Plan already exists, skipping step', { taskId: task.id });\n return { status: 'skipped' };\n }\n\n const
|
|
1
|
+
{"version":3,"file":"plan.js","sources":["../../../../src/workflow/steps/plan.ts"],"sourcesContent":["import { query } from '@anthropic-ai/claude-agent-sdk';\nimport { PLANNING_SYSTEM_PROMPT } from '../../agents/planning.js';\nimport type { WorkflowStepRunner } from '../types.js';\nimport { finalizeStepGitActions } from '../utils.js';\n\nexport const planStep: WorkflowStepRunner = async ({ step, context }) => {\n const {\n task,\n cwd,\n isCloudMode,\n options,\n logger,\n fileManager,\n gitManager,\n promptBuilder,\n adapter,\n mcpServers,\n emitEvent,\n } = context;\n\n const stepLogger = logger.child('PlanStep');\n\n const existingPlan = await fileManager.readPlan(task.id);\n if (existingPlan) {\n stepLogger.info('Plan already exists, skipping step', { taskId: task.id });\n return { status: 'skipped' };\n }\n\n const researchData = await fileManager.readResearch(task.id);\n if (researchData?.questions && !researchData.answered) {\n stepLogger.info('Waiting for answered research questions', { taskId: task.id });\n emitEvent(adapter.createStatusEvent('phase_complete', { phase: 'research_questions' }));\n return { status: 'skipped', halt: true };\n }\n\n stepLogger.info('Starting planning phase', { taskId: task.id });\n emitEvent(adapter.createStatusEvent('phase_start', { phase: 'planning' }));\n let researchContext = '';\n if (researchData) {\n researchContext += `## Research Context\\n\\n${researchData.context}\\n\\n`;\n if (researchData.keyFiles.length > 0) {\n researchContext += `**Key Files:**\\n${researchData.keyFiles.map(f => `- ${f}`).join('\\n')}\\n\\n`;\n }\n if (researchData.blockers && researchData.blockers.length > 0) {\n researchContext += `**Considerations:**\\n${researchData.blockers.map(b => `- ${b}`).join('\\n')}\\n\\n`;\n }\n\n // Add answered questions if they exist\n if (researchData.questions && researchData.answers && researchData.answered) {\n researchContext += `## Implementation Decisions\\n\\n`;\n for (const question of researchData.questions) {\n const answer = researchData.answers.find(\n (a) => a.questionId === question.id\n );\n\n researchContext += `### ${question.question}\\n\\n`;\n if (answer) {\n researchContext += `**Selected:** ${answer.selectedOption}\\n`;\n if (answer.customInput) {\n researchContext += `**Details:** ${answer.customInput}\\n`;\n }\n } else {\n researchContext += `**Selected:** Not answered\\n`;\n }\n researchContext += `\\n`;\n }\n }\n }\n\n const planningPrompt = await promptBuilder.buildPlanningPrompt(task, cwd);\n const fullPrompt = `${PLANNING_SYSTEM_PROMPT}\\n\\n${planningPrompt}\\n\\n${researchContext}`;\n\n const baseOptions: Record<string, any> = {\n model: step.model,\n cwd,\n permissionMode: 'plan',\n settingSources: ['local'],\n mcpServers,\n // Allow research tools: read-only operations, web search, MCP resources, and ExitPlanMode\n allowedTools: [\n 'Read',\n 'Glob',\n 'Grep',\n 'WebFetch',\n 'WebSearch',\n 'ListMcpResources',\n 'ReadMcpResource',\n 'ExitPlanMode',\n 'TodoWrite',\n 'BashOutput',\n ],\n };\n\n const response = query({\n prompt: fullPrompt,\n options: { ...baseOptions, ...(options.queryOverrides || {}) },\n });\n\n let planContent = '';\n for await (const message of response) {\n emitEvent(adapter.createRawSDKEvent(message));\n const transformed = adapter.transform(message);\n if (transformed) {\n emitEvent(transformed);\n }\n if (message.type === 'assistant' && message.message?.content) {\n for (const c of message.message.content) {\n if (c.type === 'text' && c.text) {\n planContent += `${c.text}\\n`;\n }\n }\n }\n }\n\n if (planContent.trim()) {\n await fileManager.writePlan(task.id, planContent.trim());\n stepLogger.info('Plan completed', { taskId: task.id });\n }\n\n await gitManager.addAllPostHogFiles();\n await finalizeStepGitActions(context, step, {\n commitMessage: `Planning phase for ${task.title}`,\n });\n\n if (!isCloudMode) {\n emitEvent(adapter.createStatusEvent('phase_complete', { phase: 'planning' }));\n return { status: 'completed', halt: true };\n }\n\n emitEvent(adapter.createStatusEvent('phase_complete', { phase: 'planning' }));\n return { status: 'completed' };\n};\n"],"names":[],"mappings":";;;;AAKO,MAAM,QAAQ,GAAuB,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,KAAI;IACpE,MAAM,EACF,IAAI,EACJ,GAAG,EACH,WAAW,EACX,OAAO,EACP,MAAM,EACN,WAAW,EACX,UAAU,EACV,aAAa,EACb,OAAO,EACP,UAAU,EACV,SAAS,GACZ,GAAG,OAAO;IAEX,MAAM,UAAU,GAAG,MAAM,CAAC,KAAK,CAAC,UAAU,CAAC;IAE3C,MAAM,YAAY,GAAG,MAAM,WAAW,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;IACxD,IAAI,YAAY,EAAE;AACd,QAAA,UAAU,CAAC,IAAI,CAAC,oCAAoC,EAAE,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC;AAC1E,QAAA,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE;IAChC;IAEA,MAAM,YAAY,GAAG,MAAM,WAAW,CAAC,YAAY,CAAC,IAAI,CAAC,EAAE,CAAC;IAC5D,IAAI,YAAY,EAAE,SAAS,IAAI,CAAC,YAAY,CAAC,QAAQ,EAAE;AACnD,QAAA,UAAU,CAAC,IAAI,CAAC,yCAAyC,EAAE,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC;AAC/E,QAAA,SAAS,CAAC,OAAO,CAAC,iBAAiB,CAAC,gBAAgB,EAAE,EAAE,KAAK,EAAE,oBAAoB,EAAE,CAAC,CAAC;QACvF,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE;IAC5C;AAEA,IAAA,UAAU,CAAC,IAAI,CAAC,yBAAyB,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OAAO,EAAE;YAC1D,KAAK,MAAM,CAAC,IAAI,OAAO,CAAC,OAAO,CAAC,OAAO,EAAE;gBACrC,IAAI,CAAC,CAAC,IAAI,KAAK,MAAM,IAAI,CAAC,CAAC,IAAI,EAAE;AAC7B,oBAAA,WAAW,IAAI,CAAA,EAAG,CAAC,CAAC,IAAI,IAAI;gBAChC;YACJ;QACJ;IACJ;AAEA,IAAA,IAAI,WAAW,CAAC,IAAI,EAAE,EAAE;AACpB,QAAA,MAAM,WAAW,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,EAAE,WAAW,CAAC,IAAI,EAAE,CAAC;AACxD,QAAA,UAAU,CAAC,IAAI,CAAC,gBAAgB,EAAE,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC;IAC1D;AAEA,IAAA,MAAM,UAAU,CAAC,kBAAkB,EAAE;AACrC,IAAA,MAAM,sBAAsB,CAAC,OAAO,EAAE,IAAI,EAAE;AACxC,QAAA,aAAa,EAAE,CAAA,mBAAA,EAAsB,IAAI,CAAC,KAAK,CAAA,CAAE;AACpD,KAAA,CAAC;IAEF,IAAI,CAAC,WAAW,EAAE;AACd,QAAA,SAAS,CAAC,OAAO,CAAC,iBAAiB,CAAC,gBAAgB,EAAE,EAAE,KAAK,EAAE,UAAU,EAAE,CAAC,CAAC;QAC7E,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,IAAI,EAAE,IAAI,EAAE;IAC9C;AAEA,IAAA,SAAS,CAAC,OAAO,CAAC,iBAAiB,CAAC,gBAAgB,EAAE,EAAE,KAAK,EAAE,UAAU,EAAE,CAAC,CAAC;AAC7E,IAAA,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE;AAClC;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"research.d.ts","sourceRoot":"","sources":["../../../../src/workflow/steps/research.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"research.d.ts","sourceRoot":"","sources":["../../../../src/workflow/steps/research.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAItD,eAAO,MAAM,YAAY,EAAE,kBAoM1B,CAAC"}
|
|
@@ -3,11 +3,29 @@ import { RESEARCH_SYSTEM_PROMPT } from '../../agents/research.js';
|
|
|
3
3
|
import { finalizeStepGitActions } from '../utils.js';
|
|
4
4
|
|
|
5
5
|
const researchStep = async ({ step, context }) => {
|
|
6
|
-
const { task, cwd, isCloudMode, options, logger, fileManager, gitManager, promptBuilder, adapter, mcpServers,
|
|
6
|
+
const { task, cwd, isCloudMode, options, logger, fileManager, gitManager, promptBuilder, adapter, mcpServers, emitEvent, } = context;
|
|
7
7
|
const stepLogger = logger.child('ResearchStep');
|
|
8
8
|
const existingResearch = await fileManager.readResearch(task.id);
|
|
9
9
|
if (existingResearch) {
|
|
10
|
-
stepLogger.info('Research already exists
|
|
10
|
+
stepLogger.info('Research already exists', { taskId: task.id, hasQuestions: !!existingResearch.questions, answered: existingResearch.answered });
|
|
11
|
+
// If there are unanswered questions, re-emit them so UI can prompt user
|
|
12
|
+
if (existingResearch.questions && !existingResearch.answered) {
|
|
13
|
+
stepLogger.info('Re-emitting unanswered research questions', {
|
|
14
|
+
taskId: task.id,
|
|
15
|
+
questionCount: existingResearch.questions.length
|
|
16
|
+
});
|
|
17
|
+
emitEvent({
|
|
18
|
+
type: 'artifact',
|
|
19
|
+
ts: Date.now(),
|
|
20
|
+
kind: 'research_questions',
|
|
21
|
+
content: existingResearch.questions,
|
|
22
|
+
});
|
|
23
|
+
// In local mode, halt to allow user to answer
|
|
24
|
+
if (!isCloudMode) {
|
|
25
|
+
emitEvent(adapter.createStatusEvent('phase_complete', { phase: 'research' }));
|
|
26
|
+
return { status: 'skipped', halt: true };
|
|
27
|
+
}
|
|
28
|
+
}
|
|
11
29
|
return { status: 'skipped' };
|
|
12
30
|
}
|
|
13
31
|
stepLogger.info('Starting research phase', { taskId: task.id });
|
|
@@ -37,7 +55,7 @@ const researchStep = async ({ step, context }) => {
|
|
|
37
55
|
prompt: fullPrompt,
|
|
38
56
|
options: { ...baseOptions, ...(options.queryOverrides || {}) },
|
|
39
57
|
});
|
|
40
|
-
let
|
|
58
|
+
let jsonContent = '';
|
|
41
59
|
for await (const message of response) {
|
|
42
60
|
emitEvent(adapter.createRawSDKEvent(message));
|
|
43
61
|
const transformed = adapter.transform(message);
|
|
@@ -47,87 +65,103 @@ const researchStep = async ({ step, context }) => {
|
|
|
47
65
|
if (message.type === 'assistant' && message.message?.content) {
|
|
48
66
|
for (const c of message.message.content) {
|
|
49
67
|
if (c.type === 'text' && c.text) {
|
|
50
|
-
|
|
68
|
+
jsonContent += c.text;
|
|
51
69
|
}
|
|
52
70
|
}
|
|
53
71
|
}
|
|
54
72
|
}
|
|
55
|
-
if (
|
|
56
|
-
|
|
57
|
-
|
|
73
|
+
if (!jsonContent.trim()) {
|
|
74
|
+
stepLogger.error('No JSON output from research agent', { taskId: task.id });
|
|
75
|
+
emitEvent({
|
|
76
|
+
type: 'error',
|
|
77
|
+
ts: Date.now(),
|
|
78
|
+
message: 'Research agent returned no output',
|
|
79
|
+
});
|
|
80
|
+
return { status: 'completed', halt: true };
|
|
81
|
+
}
|
|
82
|
+
// Parse JSON response
|
|
83
|
+
let evaluation;
|
|
84
|
+
try {
|
|
85
|
+
// Extract JSON from potential markdown code blocks or other wrapping
|
|
86
|
+
const jsonMatch = jsonContent.match(/\{[\s\S]*\}/);
|
|
87
|
+
if (!jsonMatch) {
|
|
88
|
+
throw new Error('No JSON object found in response');
|
|
89
|
+
}
|
|
90
|
+
evaluation = JSON.parse(jsonMatch[0]);
|
|
91
|
+
stepLogger.info('Parsed research evaluation', {
|
|
92
|
+
taskId: task.id,
|
|
93
|
+
score: evaluation.actionabilityScore,
|
|
94
|
+
hasQuestions: !!evaluation.questions,
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
catch (error) {
|
|
98
|
+
stepLogger.error('Failed to parse research JSON', {
|
|
99
|
+
taskId: task.id,
|
|
100
|
+
error: error instanceof Error ? error.message : String(error),
|
|
101
|
+
content: jsonContent.substring(0, 500),
|
|
102
|
+
});
|
|
103
|
+
emitEvent({
|
|
104
|
+
type: 'error',
|
|
105
|
+
ts: Date.now(),
|
|
106
|
+
message: `Failed to parse research JSON: ${error instanceof Error ? error.message : String(error)}`,
|
|
107
|
+
});
|
|
108
|
+
return { status: 'completed', halt: true };
|
|
109
|
+
}
|
|
110
|
+
// Add answered/answers fields to evaluation
|
|
111
|
+
if (evaluation.questions && evaluation.questions.length > 0) {
|
|
112
|
+
evaluation.answered = false;
|
|
113
|
+
evaluation.answers = undefined;
|
|
58
114
|
}
|
|
115
|
+
// Always write research.json
|
|
116
|
+
await fileManager.writeResearch(task.id, evaluation);
|
|
117
|
+
stepLogger.info('Research evaluation written', {
|
|
118
|
+
taskId: task.id,
|
|
119
|
+
score: evaluation.actionabilityScore,
|
|
120
|
+
hasQuestions: !!evaluation.questions,
|
|
121
|
+
});
|
|
122
|
+
emitEvent({
|
|
123
|
+
type: 'artifact',
|
|
124
|
+
ts: Date.now(),
|
|
125
|
+
kind: 'research_evaluation',
|
|
126
|
+
content: evaluation,
|
|
127
|
+
});
|
|
59
128
|
await gitManager.addAllPostHogFiles();
|
|
60
129
|
await finalizeStepGitActions(context, step, {
|
|
61
130
|
commitMessage: `Research phase for ${task.title}`,
|
|
62
131
|
});
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
answers: null,
|
|
71
|
-
});
|
|
72
|
-
emitEvent({
|
|
73
|
-
type: 'artifact',
|
|
74
|
-
ts: Date.now(),
|
|
75
|
-
kind: 'research_questions',
|
|
76
|
-
content: parsedQuestions,
|
|
77
|
-
});
|
|
78
|
-
stepLogger.info('Questions extracted successfully', {
|
|
79
|
-
taskId: task.id,
|
|
80
|
-
count: parsedQuestions.length,
|
|
81
|
-
});
|
|
82
|
-
}
|
|
83
|
-
catch (error) {
|
|
84
|
-
stepLogger.error('Failed to extract questions', {
|
|
85
|
-
taskId: task.id,
|
|
86
|
-
error: error instanceof Error ? error.message : String(error),
|
|
87
|
-
});
|
|
88
|
-
emitEvent({
|
|
89
|
-
type: 'error',
|
|
90
|
-
ts: Date.now(),
|
|
91
|
-
message: `Failed to extract questions: ${error instanceof Error ? error.message : String(error)}`,
|
|
92
|
-
});
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
else if (!extractor) {
|
|
96
|
-
stepLogger.warn('Question extractor not available, skipping question extraction. Ensure LLM gateway is configured.');
|
|
132
|
+
// Log whether questions need answering
|
|
133
|
+
if (evaluation.actionabilityScore < 0.7 && evaluation.questions && evaluation.questions.length > 0) {
|
|
134
|
+
stepLogger.info('Actionability score below threshold, questions needed', {
|
|
135
|
+
taskId: task.id,
|
|
136
|
+
score: evaluation.actionabilityScore,
|
|
137
|
+
questionCount: evaluation.questions.length,
|
|
138
|
+
});
|
|
97
139
|
emitEvent({
|
|
98
|
-
type: '
|
|
140
|
+
type: 'artifact',
|
|
99
141
|
ts: Date.now(),
|
|
100
|
-
|
|
101
|
-
|
|
142
|
+
kind: 'research_questions',
|
|
143
|
+
content: evaluation.questions,
|
|
102
144
|
});
|
|
103
145
|
}
|
|
146
|
+
else {
|
|
147
|
+
stepLogger.info('Actionability score acceptable, proceeding to planning', {
|
|
148
|
+
taskId: task.id,
|
|
149
|
+
score: evaluation.actionabilityScore,
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
// In local mode, always halt after research for user review
|
|
104
153
|
if (!isCloudMode) {
|
|
105
154
|
emitEvent(adapter.createStatusEvent('phase_complete', { phase: 'research' }));
|
|
106
155
|
return { status: 'completed', halt: true };
|
|
107
156
|
}
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
customInput: qa.justification,
|
|
115
|
-
}));
|
|
116
|
-
await fileManager.writeQuestions(task.id, {
|
|
117
|
-
questions: researchQuestions.map((qa) => ({
|
|
118
|
-
id: qa.id,
|
|
119
|
-
question: qa.question,
|
|
120
|
-
options: qa.options,
|
|
121
|
-
})),
|
|
122
|
-
answered: true,
|
|
123
|
-
answers,
|
|
124
|
-
});
|
|
125
|
-
await gitManager.addAllPostHogFiles();
|
|
126
|
-
await finalizeStepGitActions(context, step, {
|
|
127
|
-
commitMessage: `Answer research questions for ${task.title}`,
|
|
128
|
-
});
|
|
129
|
-
stepLogger.info('Auto-answered research questions', { taskId: task.id });
|
|
157
|
+
// In cloud mode, check if questions need answering
|
|
158
|
+
const researchData = await fileManager.readResearch(task.id);
|
|
159
|
+
if (researchData?.questions && !researchData.answered) {
|
|
160
|
+
// Questions need answering - halt for user input in cloud mode too
|
|
161
|
+
emitEvent(adapter.createStatusEvent('phase_complete', { phase: 'research' }));
|
|
162
|
+
return { status: 'completed', halt: true };
|
|
130
163
|
}
|
|
164
|
+
// No questions or questions already answered - proceed to planning
|
|
131
165
|
emitEvent(adapter.createStatusEvent('phase_complete', { phase: 'research' }));
|
|
132
166
|
return { status: 'completed' };
|
|
133
167
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"research.js","sources":["../../../../src/workflow/steps/research.ts"],"sourcesContent":["import { query } from '@anthropic-ai/claude-agent-sdk';\nimport { RESEARCH_SYSTEM_PROMPT } from '../../agents/research.js';\nimport type { ExtractedQuestionWithAnswer } from '../../structured-extraction.js';\nimport type { WorkflowStepRunner } from '../types.js';\nimport { finalizeStepGitActions } from '../utils.js';\n\nexport const researchStep: WorkflowStepRunner = async ({ step, context }) => {\n const {\n task,\n cwd,\n isCloudMode,\n options,\n logger,\n fileManager,\n gitManager,\n promptBuilder,\n adapter,\n mcpServers,\n extractor,\n emitEvent,\n } = context;\n\n const stepLogger = logger.child('ResearchStep');\n\n const existingResearch = await fileManager.readResearch(task.id);\n if (existingResearch) {\n stepLogger.info('Research already exists, skipping step', { taskId: task.id });\n return { status: 'skipped' };\n }\n\n stepLogger.info('Starting research phase', { taskId: task.id });\n emitEvent(adapter.createStatusEvent('phase_start', { phase: 'research' }));\n\n const researchPrompt = await promptBuilder.buildResearchPrompt(task, cwd);\n const fullPrompt = `${RESEARCH_SYSTEM_PROMPT}\\n\\n${researchPrompt}`;\n\n const baseOptions: Record<string, any> = {\n model: step.model,\n cwd,\n permissionMode: 'plan',\n settingSources: ['local'],\n mcpServers,\n // Allow research tools: read-only operations, web search, and MCP resources\n allowedTools: [\n 'Read',\n 'Glob',\n 'Grep',\n 'WebFetch',\n 'WebSearch',\n 'ListMcpResources',\n 'ReadMcpResource',\n 'TodoWrite',\n 'BashOutput',\n ],\n };\n\n const response = query({\n prompt: fullPrompt,\n options: { ...baseOptions, ...(options.queryOverrides || {}) },\n });\n\n let researchContent = '';\n for await (const message of response) {\n emitEvent(adapter.createRawSDKEvent(message));\n const transformed = adapter.transform(message);\n if (transformed) {\n emitEvent(transformed);\n }\n if (message.type === 'assistant' && message.message?.content) {\n for (const c of message.message.content) {\n if (c.type === 'text' && c.text) {\n researchContent += `${c.text}\\n`;\n }\n }\n }\n }\n\n if (researchContent.trim()) {\n await fileManager.writeResearch(task.id, researchContent.trim());\n stepLogger.info('Research completed', { taskId: task.id });\n }\n\n await gitManager.addAllPostHogFiles();\n await finalizeStepGitActions(context, step, {\n commitMessage: `Research phase for ${task.title}`,\n });\n\n if (extractor && researchContent.trim()) {\n try {\n stepLogger.info('Extracting questions from research.md', { taskId: task.id });\n const parsedQuestions = await extractor.extractQuestions(researchContent);\n\n await fileManager.writeQuestions(task.id, {\n questions: parsedQuestions,\n answered: false,\n answers: null,\n });\n\n emitEvent({\n type: 'artifact',\n ts: Date.now(),\n kind: 'research_questions',\n content: parsedQuestions,\n });\n\n stepLogger.info('Questions extracted successfully', {\n taskId: task.id,\n count: parsedQuestions.length,\n });\n } catch (error) {\n stepLogger.error('Failed to extract questions', {\n taskId: task.id,\n error: error instanceof Error ? error.message : String(error),\n });\n emitEvent({\n type: 'error',\n ts: Date.now(),\n message: `Failed to extract questions: ${\n error instanceof Error ? error.message : String(error)\n }`,\n });\n }\n } else if (!extractor) {\n stepLogger.warn(\n 'Question extractor not available, skipping question extraction. Ensure LLM gateway is configured.'\n );\n emitEvent({\n type: 'status',\n ts: Date.now(),\n phase: 'extraction_skipped',\n message: 'Question extraction skipped - extractor not configured',\n });\n }\n\n if (!isCloudMode) {\n emitEvent(adapter.createStatusEvent('phase_complete', { phase: 'research' }));\n return { status: 'completed', halt: true };\n }\n\n const questionsData = await fileManager.readQuestions(task.id);\n if (questionsData && !questionsData.answered && extractor && researchContent.trim()) {\n const researchQuestions = await extractor.extractQuestionsWithAnswers(researchContent);\n const answers = (researchQuestions as ExtractedQuestionWithAnswer[]).map((qa) => ({\n questionId: qa.id,\n selectedOption: qa.recommendedAnswer,\n customInput: qa.justification,\n }));\n\n await fileManager.writeQuestions(task.id, {\n questions: researchQuestions.map((qa) => ({\n id: qa.id,\n question: qa.question,\n options: qa.options,\n })),\n answered: true,\n answers,\n });\n\n await gitManager.addAllPostHogFiles();\n await finalizeStepGitActions(context, step, {\n commitMessage: `Answer research questions for ${task.title}`,\n });\n stepLogger.info('Auto-answered research questions', { taskId: task.id });\n }\n\n emitEvent(adapter.createStatusEvent('phase_complete', { phase: 'research' }));\n return { status: 'completed' };\n};\n"],"names":[],"mappings":";;;;AAMO,MAAM,YAAY,GAAuB,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,KAAI;IACxE,MAAM,EACF,IAAI,EACJ,GAAG,EACH,WAAW,EACX,OAAO,EACP,MAAM,EACN,WAAW,EACX,UAAU,EACV,aAAa,EACb,OAAO,EACP,UAAU,EACV,SAAS,EACT,SAAS,GACZ,GAAG,OAAO;IAEX,MAAM,UAAU,GAAG,MAAM,CAAC,KAAK,CAAC,cAAc,CAAC;IAE/C,MAAM,gBAAgB,GAAG,MAAM,WAAW,CAAC,YAAY,CAAC,IAAI,CAAC,EAAE,C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E,EAAE,KAAK,EAAE,UAAU,EAAE,CAAC,CAAC;AAC7E,IAAA,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE;AAClC;;;;"}
|
|
1
|
+
{"version":3,"file":"research.js","sources":["../../../../src/workflow/steps/research.ts"],"sourcesContent":["import { query } from '@anthropic-ai/claude-agent-sdk';\nimport { RESEARCH_SYSTEM_PROMPT } from '../../agents/research.js';\nimport type { WorkflowStepRunner } from '../types.js';\nimport type { ResearchEvaluation } from '../../types.js';\nimport { finalizeStepGitActions } from '../utils.js';\n\nexport const researchStep: WorkflowStepRunner = async ({ step, context }) => {\n const {\n task,\n cwd,\n isCloudMode,\n options,\n logger,\n fileManager,\n gitManager,\n promptBuilder,\n adapter,\n mcpServers,\n emitEvent,\n } = context;\n\n const stepLogger = logger.child('ResearchStep');\n\n const existingResearch = await fileManager.readResearch(task.id);\n if (existingResearch) {\n stepLogger.info('Research already exists', { taskId: task.id, hasQuestions: !!existingResearch.questions, answered: existingResearch.answered });\n \n // If there are unanswered questions, re-emit them so UI can prompt user\n if (existingResearch.questions && !existingResearch.answered) {\n stepLogger.info('Re-emitting unanswered research questions', { \n taskId: task.id,\n questionCount: existingResearch.questions.length \n });\n \n emitEvent({\n type: 'artifact',\n ts: Date.now(),\n kind: 'research_questions',\n content: existingResearch.questions,\n });\n \n // In local mode, halt to allow user to answer\n if (!isCloudMode) {\n emitEvent(adapter.createStatusEvent('phase_complete', { phase: 'research' }));\n return { status: 'skipped', halt: true };\n }\n }\n \n return { status: 'skipped' };\n }\n\n stepLogger.info('Starting research phase', { taskId: task.id });\n emitEvent(adapter.createStatusEvent('phase_start', { phase: 'research' }));\n\n const researchPrompt = await promptBuilder.buildResearchPrompt(task, cwd);\n const fullPrompt = `${RESEARCH_SYSTEM_PROMPT}\\n\\n${researchPrompt}`;\n\n const baseOptions: Record<string, any> = {\n model: step.model,\n cwd,\n permissionMode: 'plan',\n settingSources: ['local'],\n mcpServers,\n // Allow research tools: read-only operations, web search, and MCP resources\n allowedTools: [\n 'Read',\n 'Glob',\n 'Grep',\n 'WebFetch',\n 'WebSearch',\n 'ListMcpResources',\n 'ReadMcpResource',\n 'TodoWrite',\n 'BashOutput',\n ],\n };\n\n const response = query({\n prompt: fullPrompt,\n options: { ...baseOptions, ...(options.queryOverrides || {}) },\n });\n\n let jsonContent = '';\n for await (const message of response) {\n emitEvent(adapter.createRawSDKEvent(message));\n const transformed = adapter.transform(message);\n if (transformed) {\n emitEvent(transformed);\n }\n if (message.type === 'assistant' && message.message?.content) {\n for (const c of message.message.content) {\n if (c.type === 'text' && c.text) {\n jsonContent += c.text;\n }\n }\n }\n }\n\n if (!jsonContent.trim()) {\n stepLogger.error('No JSON output from research agent', { taskId: task.id });\n emitEvent({\n type: 'error',\n ts: Date.now(),\n message: 'Research agent returned no output',\n });\n return { status: 'completed', halt: true };\n }\n\n // Parse JSON response\n let evaluation: ResearchEvaluation;\n try {\n // Extract JSON from potential markdown code blocks or other wrapping\n const jsonMatch = jsonContent.match(/\\{[\\s\\S]*\\}/);\n if (!jsonMatch) {\n throw new Error('No JSON object found in response');\n }\n evaluation = JSON.parse(jsonMatch[0]);\n stepLogger.info('Parsed research evaluation', {\n taskId: task.id,\n score: evaluation.actionabilityScore,\n hasQuestions: !!evaluation.questions,\n });\n } catch (error) {\n stepLogger.error('Failed to parse research JSON', {\n taskId: task.id,\n error: error instanceof Error ? error.message : String(error),\n content: jsonContent.substring(0, 500),\n });\n emitEvent({\n type: 'error',\n ts: Date.now(),\n message: `Failed to parse research JSON: ${\n error instanceof Error ? error.message : String(error)\n }`,\n });\n return { status: 'completed', halt: true };\n }\n\n // Add answered/answers fields to evaluation\n if (evaluation.questions && evaluation.questions.length > 0) {\n evaluation.answered = false;\n evaluation.answers = undefined;\n }\n\n // Always write research.json\n await fileManager.writeResearch(task.id, evaluation);\n stepLogger.info('Research evaluation written', {\n taskId: task.id,\n score: evaluation.actionabilityScore,\n hasQuestions: !!evaluation.questions,\n });\n\n emitEvent({\n type: 'artifact',\n ts: Date.now(),\n kind: 'research_evaluation',\n content: evaluation,\n });\n\n await gitManager.addAllPostHogFiles();\n await finalizeStepGitActions(context, step, {\n commitMessage: `Research phase for ${task.title}`,\n });\n\n // Log whether questions need answering\n if (evaluation.actionabilityScore < 0.7 && evaluation.questions && evaluation.questions.length > 0) {\n stepLogger.info('Actionability score below threshold, questions needed', {\n taskId: task.id,\n score: evaluation.actionabilityScore,\n questionCount: evaluation.questions.length,\n });\n \n emitEvent({\n type: 'artifact',\n ts: Date.now(),\n kind: 'research_questions',\n content: evaluation.questions,\n });\n } else {\n stepLogger.info('Actionability score acceptable, proceeding to planning', {\n taskId: task.id,\n score: evaluation.actionabilityScore,\n });\n }\n\n // In local mode, always halt after research for user review\n if (!isCloudMode) {\n emitEvent(adapter.createStatusEvent('phase_complete', { phase: 'research' }));\n return { status: 'completed', halt: true };\n }\n\n // In cloud mode, check if questions need answering\n const researchData = await fileManager.readResearch(task.id);\n if (researchData?.questions && !researchData.answered) {\n // Questions need answering - halt for user input in cloud mode too\n emitEvent(adapter.createStatusEvent('phase_complete', { phase: 'research' }));\n return { status: 'completed', halt: true };\n }\n\n // No questions or questions already answered - proceed to planning\n emitEvent(adapter.createStatusEvent('phase_complete', { phase: 'research' }));\n return { status: 'completed' };\n};\n"],"names":[],"mappings":";;;;AAMO,MAAM,YAAY,GAAuB,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,KAAI;IACxE,MAAM,EACF,IAAI,EACJ,GAAG,EACH,WAAW,EACX,OAAO,EACP,MAAM,EACN,WAAW,EACX,UAAU,EACV,aAAa,EACb,OAAO,EACP,UAAU,EACV,SAAS,GACZ,GAAG,OAAO;IAEX,MAAM,UAAU,GAAG,MAAM,CAAC,KAAK,CAAC,cAAc,CAAC;IAE/C,MAAM,gBAAgB,GAAG,MAAM,WAAW,CAAC,YAAY,CAAC,IAAI,CAAC,EAAE,CAAC;IAChE,IAAI,gBAAgB,EAAE;QAClB,UAAU,CAAC,IAAI,CAAC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AAU;AAChB,YAAA,EAAE,EAAE,IAAI,CAAC,GAAG,EAAE;AACd,YAAA,IAAI,EAAE,oBAAoB;YAC1B,OAAO,EAAE,UAAU,CAAC,SAAS;AAChC,SAAA,CAAC;IACN;SAAO;AACH,QAAA,UAAU,CAAC,IAAI,CAAC,wDAAwD,EAAE;YACtE,MAAM,EAAE,IAAI,CAAC,EAAE;YACf,KAAK,EAAE,UAAU,CAAC,kBAAkB;AACvC,SAAA,CAAC;IACN;;IAGA,IAAI,CAAC,WAAW,EAAE;AACd,QAAA,SAAS,CAAC,OAAO,CAAC,iBAAiB,CAAC,gBAAgB,EAAE,EAAE,KAAK,EAAE,UAAU,EAAE,CAAC,CAAC;QAC7E,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,IAAI,EAAE,IAAI,EAAE;IAC9C;;IAGA,MAAM,YAAY,GAAG,MAAM,WAAW,CAAC,YAAY,CAAC,IAAI,CAAC,EAAE,CAAC;IAC5D,IAAI,YAAY,EAAE,SAAS,IAAI,CAAC,YAAY,CAAC,QAAQ,EAAE;;AAEnD,QAAA,SAAS,CAAC,OAAO,CAAC,iBAAiB,CAAC,gBAAgB,EAAE,EAAE,KAAK,EAAE,UAAU,EAAE,CAAC,CAAC;QAC7E,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,IAAI,EAAE,IAAI,EAAE;IAC9C;;AAGA,IAAA,SAAS,CAAC,OAAO,CAAC,iBAAiB,CAAC,gBAAgB,EAAE,EAAE,KAAK,EAAE,UAAU,EAAE,CAAC,CAAC;AAC7E,IAAA,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE;AAClC;;;;"}
|
|
@@ -6,7 +6,6 @@ import type { PromptBuilder } from '../prompt-builder.js';
|
|
|
6
6
|
import type { TaskProgressReporter } from '../task-progress-reporter.js';
|
|
7
7
|
import type { ProviderAdapter } from '../adapters/types.js';
|
|
8
8
|
import type { PostHogAPIClient } from '../posthog-api.js';
|
|
9
|
-
import type { StructuredExtractor } from '../structured-extraction.js';
|
|
10
9
|
export interface WorkflowRuntime {
|
|
11
10
|
task: Task;
|
|
12
11
|
taskSlug: string;
|
|
@@ -21,7 +20,6 @@ export interface WorkflowRuntime {
|
|
|
21
20
|
adapter: ProviderAdapter;
|
|
22
21
|
mcpServers?: Record<string, any>;
|
|
23
22
|
posthogAPI?: PostHogAPIClient;
|
|
24
|
-
extractor?: StructuredExtractor;
|
|
25
23
|
emitEvent: (event: any) => void;
|
|
26
24
|
stepResults: Record<string, any>;
|
|
27
25
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/workflow/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,oBAAoB,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC9E,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AACzE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/workflow/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,oBAAoB,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC9E,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBA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;CAC5B;AAED,MAAM,WAAW,kBAAkB;IAC/B,MAAM,EAAE,WAAW,GAAG,SAAS,CAAC;IAChC,IAAI,CAAC,EAAE,OAAO,CAAC;CAClB;AAED,MAAM,MAAM,kBAAkB,GAAG,CAAC,OAAO,EAAE,mBAAmB,KAAK,OAAO,CAAC,kBAAkB,CAAC,CAAC;AAE/F,MAAM,MAAM,kBAAkB,GAAG,sBAAsB,EAAE,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@posthog/agent",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.18.0",
|
|
4
4
|
"description": "TypeScript agent framework wrapping Claude Agent SDK with Git-based task execution for PostHog",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.js",
|
|
@@ -49,12 +49,8 @@
|
|
|
49
49
|
"typescript": "^5.5.0"
|
|
50
50
|
},
|
|
51
51
|
"dependencies": {
|
|
52
|
-
"@ai-sdk/anthropic": "^1.0.6",
|
|
53
|
-
"@ai-sdk/openai": "^1.0.10",
|
|
54
52
|
"@anthropic-ai/claude-agent-sdk": "^0.1.1",
|
|
55
|
-
"
|
|
56
|
-
"dotenv": "^17.2.3",
|
|
57
|
-
"zod": "^3.24.1"
|
|
53
|
+
"dotenv": "^17.2.3"
|
|
58
54
|
},
|
|
59
55
|
"files": [
|
|
60
56
|
"dist/**/*",
|