@posthog/agent 1.26.0 → 1.28.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/dist/index.d.ts +1274 -20
- package/dist/index.js +7327 -11
- package/dist/index.js.map +1 -1
- package/package.json +6 -12
- package/src/agent.ts +42 -5
- package/src/types.ts +1 -1
- package/src/worktree-manager.ts +45 -0
- package/dist/_virtual/_commonjsHelpers.js +0 -6
- package/dist/_virtual/_commonjsHelpers.js.map +0 -1
- package/dist/_virtual/_tslib.js +0 -74
- package/dist/_virtual/_tslib.js.map +0 -1
- package/dist/_virtual/additionalItems.js +0 -4
- package/dist/_virtual/additionalItems.js.map +0 -1
- package/dist/_virtual/additionalProperties.js +0 -4
- package/dist/_virtual/additionalProperties.js.map +0 -1
- package/dist/_virtual/ajv.js +0 -4
- package/dist/_virtual/ajv.js.map +0 -1
- package/dist/_virtual/allOf.js +0 -4
- package/dist/_virtual/allOf.js.map +0 -1
- package/dist/_virtual/anyOf.js +0 -4
- package/dist/_virtual/anyOf.js.map +0 -1
- package/dist/_virtual/applicability.js +0 -4
- package/dist/_virtual/applicability.js.map +0 -1
- package/dist/_virtual/boolSchema.js +0 -4
- package/dist/_virtual/boolSchema.js.map +0 -1
- package/dist/_virtual/code.js +0 -4
- package/dist/_virtual/code.js.map +0 -1
- package/dist/_virtual/code2.js +0 -4
- package/dist/_virtual/code2.js.map +0 -1
- package/dist/_virtual/const.js +0 -4
- package/dist/_virtual/const.js.map +0 -1
- package/dist/_virtual/contains.js +0 -4
- package/dist/_virtual/contains.js.map +0 -1
- package/dist/_virtual/core.js +0 -4
- package/dist/_virtual/core.js.map +0 -1
- package/dist/_virtual/dataType.js +0 -4
- package/dist/_virtual/dataType.js.map +0 -1
- package/dist/_virtual/defaults.js +0 -4
- package/dist/_virtual/defaults.js.map +0 -1
- package/dist/_virtual/dependencies.js +0 -4
- package/dist/_virtual/dependencies.js.map +0 -1
- package/dist/_virtual/draft7.js +0 -4
- package/dist/_virtual/draft7.js.map +0 -1
- package/dist/_virtual/enum.js +0 -4
- package/dist/_virtual/enum.js.map +0 -1
- package/dist/_virtual/equal.js +0 -4
- package/dist/_virtual/equal.js.map +0 -1
- package/dist/_virtual/errors.js +0 -4
- package/dist/_virtual/errors.js.map +0 -1
- package/dist/_virtual/format.js +0 -4
- package/dist/_virtual/format.js.map +0 -1
- package/dist/_virtual/formats.js +0 -4
- package/dist/_virtual/formats.js.map +0 -1
- package/dist/_virtual/id.js +0 -4
- package/dist/_virtual/id.js.map +0 -1
- package/dist/_virtual/if.js +0 -4
- package/dist/_virtual/if.js.map +0 -1
- package/dist/_virtual/index.js +0 -4
- package/dist/_virtual/index.js.map +0 -1
- package/dist/_virtual/index10.js +0 -4
- package/dist/_virtual/index10.js.map +0 -1
- package/dist/_virtual/index11.js +0 -4
- package/dist/_virtual/index11.js.map +0 -1
- package/dist/_virtual/index2.js +0 -4
- package/dist/_virtual/index2.js.map +0 -1
- package/dist/_virtual/index3.js +0 -4
- package/dist/_virtual/index3.js.map +0 -1
- package/dist/_virtual/index4.js +0 -4
- package/dist/_virtual/index4.js.map +0 -1
- package/dist/_virtual/index5.js +0 -4
- package/dist/_virtual/index5.js.map +0 -1
- package/dist/_virtual/index6.js +0 -4
- package/dist/_virtual/index6.js.map +0 -1
- package/dist/_virtual/index7.js +0 -4
- package/dist/_virtual/index7.js.map +0 -1
- package/dist/_virtual/index8.js +0 -4
- package/dist/_virtual/index8.js.map +0 -1
- package/dist/_virtual/index9.js +0 -4
- package/dist/_virtual/index9.js.map +0 -1
- package/dist/_virtual/items.js +0 -4
- package/dist/_virtual/items.js.map +0 -1
- package/dist/_virtual/items2020.js +0 -4
- package/dist/_virtual/items2020.js.map +0 -1
- package/dist/_virtual/keyword.js +0 -4
- package/dist/_virtual/keyword.js.map +0 -1
- package/dist/_virtual/limit.js +0 -4
- package/dist/_virtual/limit.js.map +0 -1
- package/dist/_virtual/limitItems.js +0 -4
- package/dist/_virtual/limitItems.js.map +0 -1
- package/dist/_virtual/limitLength.js +0 -4
- package/dist/_virtual/limitLength.js.map +0 -1
- package/dist/_virtual/limitNumber.js +0 -4
- package/dist/_virtual/limitNumber.js.map +0 -1
- package/dist/_virtual/limitProperties.js +0 -4
- package/dist/_virtual/limitProperties.js.map +0 -1
- package/dist/_virtual/metadata.js +0 -4
- package/dist/_virtual/metadata.js.map +0 -1
- package/dist/_virtual/multipleOf.js +0 -4
- package/dist/_virtual/multipleOf.js.map +0 -1
- package/dist/_virtual/names.js +0 -4
- package/dist/_virtual/names.js.map +0 -1
- package/dist/_virtual/not.js +0 -4
- package/dist/_virtual/not.js.map +0 -1
- package/dist/_virtual/oneOf.js +0 -4
- package/dist/_virtual/oneOf.js.map +0 -1
- package/dist/_virtual/pattern.js +0 -4
- package/dist/_virtual/pattern.js.map +0 -1
- package/dist/_virtual/patternProperties.js +0 -4
- package/dist/_virtual/patternProperties.js.map +0 -1
- package/dist/_virtual/prefixItems.js +0 -4
- package/dist/_virtual/prefixItems.js.map +0 -1
- package/dist/_virtual/properties.js +0 -4
- package/dist/_virtual/properties.js.map +0 -1
- package/dist/_virtual/propertyNames.js +0 -4
- package/dist/_virtual/propertyNames.js.map +0 -1
- package/dist/_virtual/ref.js +0 -4
- package/dist/_virtual/ref.js.map +0 -1
- package/dist/_virtual/ref_error.js +0 -4
- package/dist/_virtual/ref_error.js.map +0 -1
- package/dist/_virtual/required.js +0 -4
- package/dist/_virtual/required.js.map +0 -1
- package/dist/_virtual/resolve.js +0 -4
- package/dist/_virtual/resolve.js.map +0 -1
- package/dist/_virtual/rules.js +0 -4
- package/dist/_virtual/rules.js.map +0 -1
- package/dist/_virtual/scope.js +0 -4
- package/dist/_virtual/scope.js.map +0 -1
- package/dist/_virtual/subschema.js +0 -4
- package/dist/_virtual/subschema.js.map +0 -1
- package/dist/_virtual/thenElse.js +0 -4
- package/dist/_virtual/thenElse.js.map +0 -1
- package/dist/_virtual/types.js +0 -4
- package/dist/_virtual/types.js.map +0 -1
- package/dist/_virtual/ucs2length.js +0 -4
- package/dist/_virtual/ucs2length.js.map +0 -1
- package/dist/_virtual/uniqueItems.js +0 -4
- package/dist/_virtual/uniqueItems.js.map +0 -1
- package/dist/_virtual/uri.js +0 -4
- package/dist/_virtual/uri.js.map +0 -1
- package/dist/_virtual/util.js +0 -4
- package/dist/_virtual/util.js.map +0 -1
- package/dist/_virtual/validation_error.js +0 -4
- package/dist/_virtual/validation_error.js.map +0 -1
- package/dist/example-client.d.ts +0 -3
- package/dist/example-client.d.ts.map +0 -1
- package/dist/example.d.ts +0 -3
- package/dist/example.d.ts.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/node_modules/@agentclientprotocol/sdk/dist/acp.js +0 -891
- package/dist/node_modules/@agentclientprotocol/sdk/dist/acp.js.map +0 -1
- package/dist/node_modules/@agentclientprotocol/sdk/dist/schema.js +0 -876
- package/dist/node_modules/@agentclientprotocol/sdk/dist/schema.js.map +0 -1
- package/dist/node_modules/@agentclientprotocol/sdk/dist/stream.js +0 -66
- package/dist/node_modules/@agentclientprotocol/sdk/dist/stream.js.map +0 -1
- package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/server/completable.js +0 -23
- package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/server/completable.js.map +0 -1
- package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/server/index.js +0 -331
- package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/server/index.js.map +0 -1
- package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/server/mcp.js +0 -717
- package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/server/mcp.js.map +0 -1
- package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-compat.js +0 -221
- package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-compat.js.map +0 -1
- package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-json-schema-compat.js +0 -56
- package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-json-schema-compat.js.map +0 -1
- package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/protocol.js +0 -440
- package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/protocol.js.map +0 -1
- package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/toolNameValidation.js +0 -94
- package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/toolNameValidation.js.map +0 -1
- package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/types.js +0 -1610
- package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/types.js.map +0 -1
- package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/validation/ajv-provider.js +0 -91
- package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/validation/ajv-provider.js.map +0 -1
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v3/ZodError.js +0 -133
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v3/ZodError.js.map +0 -1
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v3/errors.js +0 -9
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v3/errors.js.map +0 -1
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v3/helpers/errorUtil.js +0 -9
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v3/helpers/errorUtil.js.map +0 -1
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v3/helpers/parseUtil.js +0 -112
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v3/helpers/parseUtil.js.map +0 -1
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v3/helpers/util.js +0 -136
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v3/helpers/util.js.map +0 -1
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v3/locales/en.js +0 -112
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v3/locales/en.js.map +0 -1
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v3/types.js +0 -3297
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v3/types.js.map +0 -1
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v4/classic/errors.js +0 -44
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v4/classic/errors.js.map +0 -1
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v4/classic/iso.js +0 -36
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v4/classic/iso.js.map +0 -1
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v4/classic/parse.js +0 -10
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v4/classic/parse.js.map +0 -1
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v4/classic/schemas.js +0 -657
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v4/classic/schemas.js.map +0 -1
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v4/core/api.js +0 -449
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v4/core/api.js.map +0 -1
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v4/core/checks.js +0 -413
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v4/core/checks.js.map +0 -1
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v4/core/core.js +0 -57
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v4/core/core.js.map +0 -1
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v4/core/doc.js +0 -38
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v4/core/doc.js.map +0 -1
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v4/core/errors.js +0 -86
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v4/core/errors.js.map +0 -1
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v4/core/parse.js +0 -61
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v4/core/parse.js.map +0 -1
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v4/core/regexes.js +0 -80
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v4/core/regexes.js.map +0 -1
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v4/core/registries.js +0 -52
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v4/core/registries.js.map +0 -1
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v4/core/schemas.js +0 -1307
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v4/core/schemas.js.map +0 -1
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v4/core/to-json-schema.js +0 -842
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v4/core/to-json-schema.js.map +0 -1
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v4/core/util.js +0 -335
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v4/core/util.js.map +0 -1
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v4/core/versions.js +0 -8
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v4/core/versions.js.map +0 -1
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v4/mini/schemas.js +0 -51
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v4/mini/schemas.js.map +0 -1
- package/dist/node_modules/ajv/dist/ajv.js +0 -69
- package/dist/node_modules/ajv/dist/ajv.js.map +0 -1
- package/dist/node_modules/ajv/dist/compile/codegen/code.js +0 -169
- package/dist/node_modules/ajv/dist/compile/codegen/code.js.map +0 -1
- package/dist/node_modules/ajv/dist/compile/codegen/index.js +0 -712
- package/dist/node_modules/ajv/dist/compile/codegen/index.js.map +0 -1
- package/dist/node_modules/ajv/dist/compile/codegen/scope.js +0 -157
- package/dist/node_modules/ajv/dist/compile/codegen/scope.js.map +0 -1
- package/dist/node_modules/ajv/dist/compile/errors.js +0 -140
- package/dist/node_modules/ajv/dist/compile/errors.js.map +0 -1
- package/dist/node_modules/ajv/dist/compile/index.js +0 -253
- package/dist/node_modules/ajv/dist/compile/index.js.map +0 -1
- package/dist/node_modules/ajv/dist/compile/names.js +0 -40
- package/dist/node_modules/ajv/dist/compile/names.js.map +0 -1
- package/dist/node_modules/ajv/dist/compile/ref_error.js +0 -25
- package/dist/node_modules/ajv/dist/compile/ref_error.js.map +0 -1
- package/dist/node_modules/ajv/dist/compile/resolve.js +0 -162
- package/dist/node_modules/ajv/dist/compile/resolve.js.map +0 -1
- package/dist/node_modules/ajv/dist/compile/rules.js +0 -29
- package/dist/node_modules/ajv/dist/compile/rules.js.map +0 -1
- package/dist/node_modules/ajv/dist/compile/util.js +0 -183
- package/dist/node_modules/ajv/dist/compile/util.js.map +0 -1
- package/dist/node_modules/ajv/dist/compile/validate/applicability.js +0 -30
- package/dist/node_modules/ajv/dist/compile/validate/applicability.js.map +0 -1
- package/dist/node_modules/ajv/dist/compile/validate/boolSchema.js +0 -64
- package/dist/node_modules/ajv/dist/compile/validate/boolSchema.js.map +0 -1
- package/dist/node_modules/ajv/dist/compile/validate/dataType.js +0 -213
- package/dist/node_modules/ajv/dist/compile/validate/dataType.js.map +0 -1
- package/dist/node_modules/ajv/dist/compile/validate/defaults.js +0 -49
- package/dist/node_modules/ajv/dist/compile/validate/defaults.js.map +0 -1
- package/dist/node_modules/ajv/dist/compile/validate/index.js +0 -544
- package/dist/node_modules/ajv/dist/compile/validate/index.js.map +0 -1
- package/dist/node_modules/ajv/dist/compile/validate/keyword.js +0 -139
- package/dist/node_modules/ajv/dist/compile/validate/keyword.js.map +0 -1
- package/dist/node_modules/ajv/dist/compile/validate/subschema.js +0 -95
- package/dist/node_modules/ajv/dist/compile/validate/subschema.js.map +0 -1
- package/dist/node_modules/ajv/dist/core.js +0 -639
- package/dist/node_modules/ajv/dist/core.js.map +0 -1
- package/dist/node_modules/ajv/dist/refs/data.json.js +0 -31
- package/dist/node_modules/ajv/dist/refs/data.json.js.map +0 -1
- package/dist/node_modules/ajv/dist/refs/json-schema-draft-07.json.js +0 -254
- package/dist/node_modules/ajv/dist/refs/json-schema-draft-07.json.js.map +0 -1
- package/dist/node_modules/ajv/dist/runtime/equal.js +0 -9
- package/dist/node_modules/ajv/dist/runtime/equal.js.map +0 -1
- package/dist/node_modules/ajv/dist/runtime/ucs2length.js +0 -25
- package/dist/node_modules/ajv/dist/runtime/ucs2length.js.map +0 -1
- package/dist/node_modules/ajv/dist/runtime/uri.js +0 -8
- package/dist/node_modules/ajv/dist/runtime/uri.js.map +0 -1
- package/dist/node_modules/ajv/dist/runtime/validation_error.js +0 -22
- package/dist/node_modules/ajv/dist/runtime/validation_error.js.map +0 -1
- package/dist/node_modules/ajv/dist/vocabularies/applicator/additionalItems.js +0 -53
- package/dist/node_modules/ajv/dist/vocabularies/applicator/additionalItems.js.map +0 -1
- package/dist/node_modules/ajv/dist/vocabularies/applicator/additionalProperties.js +0 -112
- package/dist/node_modules/ajv/dist/vocabularies/applicator/additionalProperties.js.map +0 -1
- package/dist/node_modules/ajv/dist/vocabularies/applicator/allOf.js +0 -26
- package/dist/node_modules/ajv/dist/vocabularies/applicator/allOf.js.map +0 -1
- package/dist/node_modules/ajv/dist/vocabularies/applicator/anyOf.js +0 -14
- package/dist/node_modules/ajv/dist/vocabularies/applicator/anyOf.js.map +0 -1
- package/dist/node_modules/ajv/dist/vocabularies/applicator/contains.js +0 -99
- package/dist/node_modules/ajv/dist/vocabularies/applicator/contains.js.map +0 -1
- package/dist/node_modules/ajv/dist/vocabularies/applicator/dependencies.js +0 -93
- package/dist/node_modules/ajv/dist/vocabularies/applicator/dependencies.js.map +0 -1
- package/dist/node_modules/ajv/dist/vocabularies/applicator/if.js +0 -70
- package/dist/node_modules/ajv/dist/vocabularies/applicator/if.js.map +0 -1
- package/dist/node_modules/ajv/dist/vocabularies/applicator/index.js +0 -77
- package/dist/node_modules/ajv/dist/vocabularies/applicator/index.js.map +0 -1
- package/dist/node_modules/ajv/dist/vocabularies/applicator/items.js +0 -57
- package/dist/node_modules/ajv/dist/vocabularies/applicator/items.js.map +0 -1
- package/dist/node_modules/ajv/dist/vocabularies/applicator/items2020.js +0 -37
- package/dist/node_modules/ajv/dist/vocabularies/applicator/items2020.js.map +0 -1
- package/dist/node_modules/ajv/dist/vocabularies/applicator/not.js +0 -29
- package/dist/node_modules/ajv/dist/vocabularies/applicator/not.js.map +0 -1
- package/dist/node_modules/ajv/dist/vocabularies/applicator/oneOf.js +0 -64
- package/dist/node_modules/ajv/dist/vocabularies/applicator/oneOf.js.map +0 -1
- package/dist/node_modules/ajv/dist/vocabularies/applicator/patternProperties.js +0 -80
- package/dist/node_modules/ajv/dist/vocabularies/applicator/patternProperties.js.map +0 -1
- package/dist/node_modules/ajv/dist/vocabularies/applicator/prefixItems.js +0 -15
- package/dist/node_modules/ajv/dist/vocabularies/applicator/prefixItems.js.map +0 -1
- package/dist/node_modules/ajv/dist/vocabularies/applicator/properties.js +0 -61
- package/dist/node_modules/ajv/dist/vocabularies/applicator/properties.js.map +0 -1
- package/dist/node_modules/ajv/dist/vocabularies/applicator/propertyNames.js +0 -42
- package/dist/node_modules/ajv/dist/vocabularies/applicator/propertyNames.js.map +0 -1
- package/dist/node_modules/ajv/dist/vocabularies/applicator/thenElse.js +0 -16
- package/dist/node_modules/ajv/dist/vocabularies/applicator/thenElse.js.map +0 -1
- package/dist/node_modules/ajv/dist/vocabularies/code.js +0 -146
- package/dist/node_modules/ajv/dist/vocabularies/code.js.map +0 -1
- package/dist/node_modules/ajv/dist/vocabularies/core/id.js +0 -11
- package/dist/node_modules/ajv/dist/vocabularies/core/id.js.map +0 -1
- package/dist/node_modules/ajv/dist/vocabularies/core/index.js +0 -21
- package/dist/node_modules/ajv/dist/vocabularies/core/index.js.map +0 -1
- package/dist/node_modules/ajv/dist/vocabularies/core/ref.js +0 -131
- package/dist/node_modules/ajv/dist/vocabularies/core/ref.js.map +0 -1
- package/dist/node_modules/ajv/dist/vocabularies/discriminator/index.js +0 -113
- package/dist/node_modules/ajv/dist/vocabularies/discriminator/index.js.map +0 -1
- package/dist/node_modules/ajv/dist/vocabularies/discriminator/types.js +0 -12
- package/dist/node_modules/ajv/dist/vocabularies/discriminator/types.js.map +0 -1
- package/dist/node_modules/ajv/dist/vocabularies/draft7.js +0 -28
- package/dist/node_modules/ajv/dist/vocabularies/draft7.js.map +0 -1
- package/dist/node_modules/ajv/dist/vocabularies/format/format.js +0 -94
- package/dist/node_modules/ajv/dist/vocabularies/format/format.js.map +0 -1
- package/dist/node_modules/ajv/dist/vocabularies/format/index.js +0 -9
- package/dist/node_modules/ajv/dist/vocabularies/format/index.js.map +0 -1
- package/dist/node_modules/ajv/dist/vocabularies/metadata.js +0 -21
- package/dist/node_modules/ajv/dist/vocabularies/metadata.js.map +0 -1
- package/dist/node_modules/ajv/dist/vocabularies/validation/const.js +0 -31
- package/dist/node_modules/ajv/dist/vocabularies/validation/const.js.map +0 -1
- package/dist/node_modules/ajv/dist/vocabularies/validation/enum.js +0 -54
- package/dist/node_modules/ajv/dist/vocabularies/validation/enum.js.map +0 -1
- package/dist/node_modules/ajv/dist/vocabularies/validation/index.js +0 -54
- package/dist/node_modules/ajv/dist/vocabularies/validation/index.js.map +0 -1
- package/dist/node_modules/ajv/dist/vocabularies/validation/limitItems.js +0 -26
- package/dist/node_modules/ajv/dist/vocabularies/validation/limitItems.js.map +0 -1
- package/dist/node_modules/ajv/dist/vocabularies/validation/limitLength.js +0 -33
- package/dist/node_modules/ajv/dist/vocabularies/validation/limitLength.js.map +0 -1
- package/dist/node_modules/ajv/dist/vocabularies/validation/limitNumber.js +0 -29
- package/dist/node_modules/ajv/dist/vocabularies/validation/limitNumber.js.map +0 -1
- package/dist/node_modules/ajv/dist/vocabularies/validation/limitProperties.js +0 -26
- package/dist/node_modules/ajv/dist/vocabularies/validation/limitProperties.js.map +0 -1
- package/dist/node_modules/ajv/dist/vocabularies/validation/multipleOf.js +0 -28
- package/dist/node_modules/ajv/dist/vocabularies/validation/multipleOf.js.map +0 -1
- package/dist/node_modules/ajv/dist/vocabularies/validation/pattern.js +0 -27
- package/dist/node_modules/ajv/dist/vocabularies/validation/pattern.js.map +0 -1
- package/dist/node_modules/ajv/dist/vocabularies/validation/required.js +0 -84
- package/dist/node_modules/ajv/dist/vocabularies/validation/required.js.map +0 -1
- package/dist/node_modules/ajv/dist/vocabularies/validation/uniqueItems.js +0 -72
- package/dist/node_modules/ajv/dist/vocabularies/validation/uniqueItems.js.map +0 -1
- package/dist/node_modules/ajv-formats/dist/formats.js +0 -212
- package/dist/node_modules/ajv-formats/dist/formats.js.map +0 -1
- package/dist/node_modules/ajv-formats/dist/index.js +0 -52
- package/dist/node_modules/ajv-formats/dist/index.js.map +0 -1
- package/dist/node_modules/ajv-formats/dist/limit.js +0 -75
- package/dist/node_modules/ajv-formats/dist/limit.js.map +0 -1
- package/dist/node_modules/diff/libesm/diff/base.js +0 -256
- package/dist/node_modules/diff/libesm/diff/base.js.map +0 -1
- package/dist/node_modules/diff/libesm/diff/line.js +0 -64
- package/dist/node_modules/diff/libesm/diff/line.js.map +0 -1
- package/dist/node_modules/diff/libesm/patch/create.js +0 -185
- package/dist/node_modules/diff/libesm/patch/create.js.map +0 -1
- package/dist/node_modules/fast-deep-equal/index.js +0 -47
- package/dist/node_modules/fast-deep-equal/index.js.map +0 -1
- package/dist/node_modules/fast-uri/index.js +0 -347
- package/dist/node_modules/fast-uri/index.js.map +0 -1
- package/dist/node_modules/fast-uri/lib/schemes.js +0 -255
- package/dist/node_modules/fast-uri/lib/schemes.js.map +0 -1
- package/dist/node_modules/fast-uri/lib/utils.js +0 -334
- package/dist/node_modules/fast-uri/lib/utils.js.map +0 -1
- package/dist/node_modules/json-schema-traverse/index.js +0 -98
- package/dist/node_modules/json-schema-traverse/index.js.map +0 -1
- package/dist/node_modules/uuid/dist/rng.js +0 -14
- package/dist/node_modules/uuid/dist/rng.js.map +0 -1
- package/dist/node_modules/uuid/dist/stringify.js +0 -29
- package/dist/node_modules/uuid/dist/stringify.js.map +0 -1
- package/dist/node_modules/uuid/dist/v7.js +0 -65
- package/dist/node_modules/uuid/dist/v7.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/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 -109
- 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/node_modules/zod-to-json-schema/node_modules/zod/v3/types.js +0 -42
- package/dist/node_modules/zod-to-json-schema/node_modules/zod/v3/types.js.map +0 -1
- package/dist/package.json.js +0 -8
- package/dist/package.json.js.map +0 -1
- package/dist/src/acp-extensions.d.ts +0 -91
- package/dist/src/acp-extensions.d.ts.map +0 -1
- package/dist/src/acp-extensions.js +0 -38
- package/dist/src/acp-extensions.js.map +0 -1
- package/dist/src/adapters/claude/claude.d.ts +0 -136
- package/dist/src/adapters/claude/claude.d.ts.map +0 -1
- package/dist/src/adapters/claude/claude.js +0 -1128
- package/dist/src/adapters/claude/claude.js.map +0 -1
- package/dist/src/adapters/claude/mcp-server.d.ts +0 -30
- package/dist/src/adapters/claude/mcp-server.d.ts.map +0 -1
- package/dist/src/adapters/claude/mcp-server.js +0 -668
- package/dist/src/adapters/claude/mcp-server.js.map +0 -1
- package/dist/src/adapters/claude/tools.d.ts +0 -35
- package/dist/src/adapters/claude/tools.d.ts.map +0 -1
- package/dist/src/adapters/claude/tools.js +0 -473
- package/dist/src/adapters/claude/tools.js.map +0 -1
- package/dist/src/adapters/claude/utils.d.ts +0 -48
- package/dist/src/adapters/claude/utils.d.ts.map +0 -1
- package/dist/src/adapters/claude/utils.js +0 -158
- package/dist/src/adapters/claude/utils.js.map +0 -1
- package/dist/src/agent.d.ts +0 -58
- package/dist/src/agent.d.ts.map +0 -1
- package/dist/src/agent.js +0 -576
- package/dist/src/agent.js.map +0 -1
- package/dist/src/agents/execution.d.ts +0 -2
- package/dist/src/agents/execution.d.ts.map +0 -1
- package/dist/src/agents/execution.js +0 -40
- package/dist/src/agents/execution.js.map +0 -1
- package/dist/src/agents/planning.d.ts +0 -2
- package/dist/src/agents/planning.d.ts.map +0 -1
- package/dist/src/agents/planning.js +0 -63
- package/dist/src/agents/planning.js.map +0 -1
- package/dist/src/agents/research.d.ts +0 -2
- package/dist/src/agents/research.d.ts.map +0 -1
- package/dist/src/agents/research.js +0 -163
- package/dist/src/agents/research.js.map +0 -1
- package/dist/src/file-manager.d.ts +0 -43
- package/dist/src/file-manager.d.ts.map +0 -1
- package/dist/src/file-manager.js +0 -266
- package/dist/src/file-manager.js.map +0 -1
- package/dist/src/git-manager.d.ts +0 -79
- package/dist/src/git-manager.d.ts.map +0 -1
- package/dist/src/git-manager.js +0 -454
- package/dist/src/git-manager.js.map +0 -1
- package/dist/src/posthog-api.d.ts +0 -48
- package/dist/src/posthog-api.d.ts.map +0 -1
- package/dist/src/posthog-api.js +0 -260
- package/dist/src/posthog-api.js.map +0 -1
- package/dist/src/prompt-builder.d.ts +0 -49
- package/dist/src/prompt-builder.d.ts.map +0 -1
- package/dist/src/prompt-builder.js +0 -397
- package/dist/src/prompt-builder.js.map +0 -1
- package/dist/src/schemas.d.ts +0 -980
- package/dist/src/schemas.d.ts.map +0 -1
- package/dist/src/schemas.js +0 -196
- package/dist/src/schemas.js.map +0 -1
- package/dist/src/session-store.d.ts +0 -58
- package/dist/src/session-store.d.ts.map +0 -1
- package/dist/src/session-store.js +0 -206
- package/dist/src/session-store.js.map +0 -1
- package/dist/src/task-manager.d.ts +0 -25
- package/dist/src/task-manager.d.ts.map +0 -1
- package/dist/src/task-manager.js +0 -123
- package/dist/src/task-manager.js.map +0 -1
- package/dist/src/template-manager.d.ts +0 -30
- package/dist/src/template-manager.d.ts.map +0 -1
- package/dist/src/template-manager.js +0 -152
- package/dist/src/template-manager.js.map +0 -1
- package/dist/src/todo-manager.d.ts +0 -29
- package/dist/src/todo-manager.d.ts.map +0 -1
- package/dist/src/todo-manager.js +0 -135
- package/dist/src/todo-manager.js.map +0 -1
- package/dist/src/tools/registry.d.ts +0 -25
- package/dist/src/tools/registry.d.ts.map +0 -1
- package/dist/src/tools/registry.js +0 -120
- package/dist/src/tools/registry.js.map +0 -1
- package/dist/src/tools/types.d.ts +0 -80
- package/dist/src/tools/types.d.ts.map +0 -1
- package/dist/src/types.d.ts +0 -193
- package/dist/src/types.d.ts.map +0 -1
- package/dist/src/types.js +0 -11
- package/dist/src/types.js.map +0 -1
- package/dist/src/utils/logger.d.ts +0 -37
- package/dist/src/utils/logger.d.ts.map +0 -1
- package/dist/src/utils/logger.js +0 -83
- package/dist/src/utils/logger.js.map +0 -1
- package/dist/src/utils/tapped-stream.d.ts +0 -17
- package/dist/src/utils/tapped-stream.d.ts.map +0 -1
- package/dist/src/utils/tapped-stream.js +0 -45
- package/dist/src/utils/tapped-stream.js.map +0 -1
- package/dist/src/workflow/config.d.ts +0 -3
- package/dist/src/workflow/config.d.ts.map +0 -1
- package/dist/src/workflow/config.js +0 -54
- package/dist/src/workflow/config.js.map +0 -1
- package/dist/src/workflow/steps/build.d.ts +0 -3
- package/dist/src/workflow/steps/build.d.ts.map +0 -1
- package/dist/src/workflow/steps/build.js +0 -108
- package/dist/src/workflow/steps/build.js.map +0 -1
- package/dist/src/workflow/steps/finalize.d.ts +0 -3
- package/dist/src/workflow/steps/finalize.d.ts.map +0 -1
- package/dist/src/workflow/steps/finalize.js +0 -188
- package/dist/src/workflow/steps/finalize.js.map +0 -1
- package/dist/src/workflow/steps/plan.d.ts +0 -3
- package/dist/src/workflow/steps/plan.d.ts.map +0 -1
- package/dist/src/workflow/steps/plan.js +0 -136
- package/dist/src/workflow/steps/plan.js.map +0 -1
- package/dist/src/workflow/steps/research.d.ts +0 -3
- package/dist/src/workflow/steps/research.d.ts.map +0 -1
- package/dist/src/workflow/steps/research.js +0 -189
- package/dist/src/workflow/steps/research.js.map +0 -1
- package/dist/src/workflow/types.d.ts +0 -51
- package/dist/src/workflow/types.d.ts.map +0 -1
- package/dist/src/workflow/utils.d.ts +0 -12
- package/dist/src/workflow/utils.d.ts.map +0 -1
- package/dist/src/workflow/utils.js +0 -41
- package/dist/src/workflow/utils.js.map +0 -1
- package/dist/src/worktree-manager.d.ts +0 -39
- package/dist/src/worktree-manager.d.ts.map +0 -1
- package/dist/src/worktree-manager.js +0 -808
- package/dist/src/worktree-manager.js.map +0 -1
package/dist/src/agent.js
DELETED
|
@@ -1,576 +0,0 @@
|
|
|
1
|
-
import { ClientSideConnection } from '../node_modules/@agentclientprotocol/sdk/dist/acp.js';
|
|
2
|
-
import { POSTHOG_NOTIFICATIONS } from './acp-extensions.js';
|
|
3
|
-
import { createAcpConnection } from './adapters/claude/claude.js';
|
|
4
|
-
import { PostHogFileManager } from './file-manager.js';
|
|
5
|
-
import { GitManager } from './git-manager.js';
|
|
6
|
-
import { PostHogAPIClient } from './posthog-api.js';
|
|
7
|
-
import { PromptBuilder } from './prompt-builder.js';
|
|
8
|
-
import { SessionStore } from './session-store.js';
|
|
9
|
-
import { TaskManager } from './task-manager.js';
|
|
10
|
-
import { TemplateManager } from './template-manager.js';
|
|
11
|
-
import { Logger } from './utils/logger.js';
|
|
12
|
-
import { TASK_WORKFLOW } from './workflow/config.js';
|
|
13
|
-
export { PermissionMode } from './types.js';
|
|
14
|
-
import { PROTOCOL_VERSION } from '../node_modules/@agentclientprotocol/sdk/dist/schema.js';
|
|
15
|
-
import { ndJsonStream } from '../node_modules/@agentclientprotocol/sdk/dist/stream.js';
|
|
16
|
-
|
|
17
|
-
class Agent {
|
|
18
|
-
workingDirectory;
|
|
19
|
-
taskManager;
|
|
20
|
-
posthogAPI;
|
|
21
|
-
fileManager;
|
|
22
|
-
gitManager;
|
|
23
|
-
templateManager;
|
|
24
|
-
logger;
|
|
25
|
-
acpConnection;
|
|
26
|
-
promptBuilder;
|
|
27
|
-
mcpServers;
|
|
28
|
-
canUseTool;
|
|
29
|
-
currentRunId;
|
|
30
|
-
sessionStore;
|
|
31
|
-
debug;
|
|
32
|
-
constructor(config) {
|
|
33
|
-
this.workingDirectory = config.workingDirectory || process.cwd();
|
|
34
|
-
this.canUseTool = config.canUseTool;
|
|
35
|
-
this.debug = config.debug || false;
|
|
36
|
-
// Build default PostHog MCP server configuration
|
|
37
|
-
const posthogMcpUrl = config.posthogMcpUrl ||
|
|
38
|
-
process.env.POSTHOG_MCP_URL ||
|
|
39
|
-
"https://mcp.posthog.com/mcp";
|
|
40
|
-
// Add auth if API key provided
|
|
41
|
-
const headers = {};
|
|
42
|
-
if (config.posthogApiKey) {
|
|
43
|
-
headers.Authorization = `Bearer ${config.posthogApiKey}`;
|
|
44
|
-
}
|
|
45
|
-
const defaultMcpServers = {
|
|
46
|
-
posthog: {
|
|
47
|
-
type: "http",
|
|
48
|
-
url: posthogMcpUrl,
|
|
49
|
-
...(Object.keys(headers).length > 0 ? { headers } : {}),
|
|
50
|
-
},
|
|
51
|
-
};
|
|
52
|
-
// Merge default PostHog MCP with user-provided servers (user config takes precedence)
|
|
53
|
-
this.mcpServers = {
|
|
54
|
-
...defaultMcpServers,
|
|
55
|
-
...config.mcpServers,
|
|
56
|
-
};
|
|
57
|
-
this.logger = new Logger({
|
|
58
|
-
debug: this.debug,
|
|
59
|
-
prefix: "[PostHog Agent]",
|
|
60
|
-
onLog: config.onLog,
|
|
61
|
-
});
|
|
62
|
-
this.taskManager = new TaskManager();
|
|
63
|
-
this.fileManager = new PostHogFileManager(this.workingDirectory, this.logger.child("FileManager"));
|
|
64
|
-
this.gitManager = new GitManager({
|
|
65
|
-
repositoryPath: this.workingDirectory,
|
|
66
|
-
logger: this.logger.child("GitManager"),
|
|
67
|
-
});
|
|
68
|
-
this.templateManager = new TemplateManager();
|
|
69
|
-
if (config.posthogApiUrl &&
|
|
70
|
-
config.posthogApiKey &&
|
|
71
|
-
config.posthogProjectId) {
|
|
72
|
-
this.posthogAPI = new PostHogAPIClient({
|
|
73
|
-
apiUrl: config.posthogApiUrl,
|
|
74
|
-
apiKey: config.posthogApiKey,
|
|
75
|
-
projectId: config.posthogProjectId,
|
|
76
|
-
});
|
|
77
|
-
// Create SessionStore from the API client for ACP connection
|
|
78
|
-
this.sessionStore = new SessionStore(this.posthogAPI, this.logger.child("SessionStore"));
|
|
79
|
-
}
|
|
80
|
-
this.promptBuilder = new PromptBuilder({
|
|
81
|
-
getTaskFiles: (taskId) => this.getTaskFiles(taskId),
|
|
82
|
-
generatePlanTemplate: (vars) => this.templateManager.generatePlan(vars),
|
|
83
|
-
posthogClient: this.posthogAPI,
|
|
84
|
-
logger: this.logger.child("PromptBuilder"),
|
|
85
|
-
});
|
|
86
|
-
}
|
|
87
|
-
/**
|
|
88
|
-
* Enable or disable debug logging
|
|
89
|
-
*/
|
|
90
|
-
setDebug(enabled) {
|
|
91
|
-
this.debug = enabled;
|
|
92
|
-
this.logger.setDebug(enabled);
|
|
93
|
-
}
|
|
94
|
-
/**
|
|
95
|
-
* Configure LLM gateway environment variables for Claude Code CLI
|
|
96
|
-
*/
|
|
97
|
-
async _configureLlmGateway() {
|
|
98
|
-
if (!this.posthogAPI) {
|
|
99
|
-
return;
|
|
100
|
-
}
|
|
101
|
-
try {
|
|
102
|
-
const gatewayUrl = this.posthogAPI.getLlmGatewayUrl();
|
|
103
|
-
const apiKey = this.posthogAPI.getApiKey();
|
|
104
|
-
process.env.ANTHROPIC_BASE_URL = gatewayUrl;
|
|
105
|
-
process.env.ANTHROPIC_AUTH_TOKEN = apiKey;
|
|
106
|
-
this.ensureOpenAIGatewayEnv(gatewayUrl, apiKey);
|
|
107
|
-
}
|
|
108
|
-
catch (error) {
|
|
109
|
-
this.logger.error("Failed to configure LLM gateway", error);
|
|
110
|
-
throw error;
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
getOrCreateConnection() {
|
|
114
|
-
if (!this.acpConnection) {
|
|
115
|
-
this.acpConnection = createAcpConnection({
|
|
116
|
-
sessionStore: this.sessionStore,
|
|
117
|
-
});
|
|
118
|
-
}
|
|
119
|
-
return this.acpConnection;
|
|
120
|
-
}
|
|
121
|
-
// Adaptive task execution orchestrated via workflow steps
|
|
122
|
-
async runTask(taskId, taskRunId, options = {}) {
|
|
123
|
-
// await this._configureLlmGateway();
|
|
124
|
-
const task = await this.fetchTask(taskId);
|
|
125
|
-
const cwd = options.repositoryPath || this.workingDirectory;
|
|
126
|
-
const isCloudMode = options.isCloudMode ?? false;
|
|
127
|
-
const taskSlug = task.slug || task.id;
|
|
128
|
-
// Use taskRunId as sessionId - they are the same identifier
|
|
129
|
-
this.currentRunId = taskRunId;
|
|
130
|
-
this.logger.info("Starting adaptive task execution", {
|
|
131
|
-
taskId: task.id,
|
|
132
|
-
taskSlug,
|
|
133
|
-
taskRunId,
|
|
134
|
-
isCloudMode,
|
|
135
|
-
});
|
|
136
|
-
const connection = this.getOrCreateConnection();
|
|
137
|
-
// Create sendNotification using ACP connection's extNotification
|
|
138
|
-
const sendNotification = async (method, params) => {
|
|
139
|
-
this.logger.debug(`Notification: ${method}`, params);
|
|
140
|
-
await connection.agentConnection.extNotification?.(method, params);
|
|
141
|
-
};
|
|
142
|
-
await sendNotification(POSTHOG_NOTIFICATIONS.RUN_STARTED, {
|
|
143
|
-
sessionId: taskRunId,
|
|
144
|
-
runId: taskRunId,
|
|
145
|
-
});
|
|
146
|
-
await this.prepareTaskBranch(taskSlug, isCloudMode, sendNotification);
|
|
147
|
-
let taskError;
|
|
148
|
-
try {
|
|
149
|
-
const workflowContext = {
|
|
150
|
-
task,
|
|
151
|
-
taskSlug,
|
|
152
|
-
runId: taskRunId,
|
|
153
|
-
cwd,
|
|
154
|
-
isCloudMode,
|
|
155
|
-
options,
|
|
156
|
-
logger: this.logger,
|
|
157
|
-
fileManager: this.fileManager,
|
|
158
|
-
gitManager: this.gitManager,
|
|
159
|
-
promptBuilder: this.promptBuilder,
|
|
160
|
-
connection: connection.agentConnection,
|
|
161
|
-
sessionId: taskRunId,
|
|
162
|
-
sendNotification,
|
|
163
|
-
mcpServers: this.mcpServers,
|
|
164
|
-
posthogAPI: this.posthogAPI,
|
|
165
|
-
stepResults: {},
|
|
166
|
-
};
|
|
167
|
-
for (const step of TASK_WORKFLOW) {
|
|
168
|
-
const result = await step.run({ step, context: workflowContext });
|
|
169
|
-
if (result.halt) {
|
|
170
|
-
return;
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
const shouldCreatePR = options.createPR ?? isCloudMode;
|
|
174
|
-
if (shouldCreatePR) {
|
|
175
|
-
await this.ensurePullRequest(task, workflowContext.stepResults, sendNotification);
|
|
176
|
-
}
|
|
177
|
-
this.logger.info("Task execution complete", { taskId: task.id });
|
|
178
|
-
await sendNotification(POSTHOG_NOTIFICATIONS.TASK_COMPLETE, {
|
|
179
|
-
sessionId: taskRunId,
|
|
180
|
-
taskId: task.id,
|
|
181
|
-
});
|
|
182
|
-
}
|
|
183
|
-
catch (error) {
|
|
184
|
-
taskError = error instanceof Error ? error : new Error(String(error));
|
|
185
|
-
this.logger.error("Task execution failed", {
|
|
186
|
-
taskId: task.id,
|
|
187
|
-
error: taskError.message,
|
|
188
|
-
});
|
|
189
|
-
await sendNotification(POSTHOG_NOTIFICATIONS.ERROR, {
|
|
190
|
-
sessionId: taskRunId,
|
|
191
|
-
message: taskError.message,
|
|
192
|
-
});
|
|
193
|
-
throw taskError;
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
/**
|
|
197
|
-
* Creates an in-process ACP connection for client communication.
|
|
198
|
-
* Sets up git branch for the task, configures LLM gateway.
|
|
199
|
-
* The client handles all prompting/querying via the returned streams.
|
|
200
|
-
*
|
|
201
|
-
* @returns InProcessAcpConnection with clientStreams for the client to use
|
|
202
|
-
*/
|
|
203
|
-
async runTaskV2(taskId, taskRunId, options = {}) {
|
|
204
|
-
await this._configureLlmGateway();
|
|
205
|
-
const task = await this.fetchTask(taskId);
|
|
206
|
-
const taskSlug = task.slug || task.id;
|
|
207
|
-
const isCloudMode = options.isCloudMode ?? false;
|
|
208
|
-
options.repositoryPath || this.workingDirectory;
|
|
209
|
-
// Use taskRunId as sessionId - they are the same identifier
|
|
210
|
-
this.currentRunId = taskRunId;
|
|
211
|
-
this.acpConnection = createAcpConnection({
|
|
212
|
-
sessionStore: this.sessionStore,
|
|
213
|
-
sessionId: taskRunId,
|
|
214
|
-
taskId: task.id,
|
|
215
|
-
});
|
|
216
|
-
const sendNotification = async (method, params) => {
|
|
217
|
-
this.logger.debug(`Notification: ${method}`, params);
|
|
218
|
-
await this.acpConnection?.agentConnection.extNotification?.(method, params);
|
|
219
|
-
};
|
|
220
|
-
await sendNotification(POSTHOG_NOTIFICATIONS.RUN_STARTED, {
|
|
221
|
-
sessionId: taskRunId,
|
|
222
|
-
runId: taskRunId,
|
|
223
|
-
});
|
|
224
|
-
if (!options.skipGitBranch) {
|
|
225
|
-
try {
|
|
226
|
-
await this.prepareTaskBranch(taskSlug, isCloudMode, sendNotification);
|
|
227
|
-
}
|
|
228
|
-
catch (error) {
|
|
229
|
-
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
230
|
-
this.logger.error("Failed to prepare task branch", {
|
|
231
|
-
error: errorMessage,
|
|
232
|
-
});
|
|
233
|
-
await sendNotification(POSTHOG_NOTIFICATIONS.ERROR, {
|
|
234
|
-
sessionId: taskRunId,
|
|
235
|
-
message: errorMessage,
|
|
236
|
-
});
|
|
237
|
-
throw error;
|
|
238
|
-
}
|
|
239
|
-
}
|
|
240
|
-
return this.acpConnection;
|
|
241
|
-
}
|
|
242
|
-
// PostHog task operations
|
|
243
|
-
async fetchTask(taskId) {
|
|
244
|
-
if (!this.posthogAPI) {
|
|
245
|
-
const error = new Error("PostHog API not configured. Provide posthogApiUrl and posthogApiKey in constructor.");
|
|
246
|
-
this.logger.error("PostHog API not configured", error);
|
|
247
|
-
throw error;
|
|
248
|
-
}
|
|
249
|
-
return this.posthogAPI.fetchTask(taskId);
|
|
250
|
-
}
|
|
251
|
-
getPostHogClient() {
|
|
252
|
-
return this.posthogAPI;
|
|
253
|
-
}
|
|
254
|
-
/**
|
|
255
|
-
* Send a notification to a cloud task run's S3 log.
|
|
256
|
-
* The cloud runner will pick up new notifications via interrupt polling.
|
|
257
|
-
*/
|
|
258
|
-
async sendNotification(taskId, runId, notification) {
|
|
259
|
-
if (!this.posthogAPI) {
|
|
260
|
-
throw new Error("PostHog API not configured. Cannot send notification to cloud task.");
|
|
261
|
-
}
|
|
262
|
-
await this.posthogAPI.appendTaskRunLog(taskId, runId, [notification]);
|
|
263
|
-
this.logger.debug("Notification sent to cloud task", {
|
|
264
|
-
taskId,
|
|
265
|
-
runId,
|
|
266
|
-
method: notification.notification.method,
|
|
267
|
-
});
|
|
268
|
-
}
|
|
269
|
-
async getTaskFiles(taskId) {
|
|
270
|
-
this.logger.debug("Getting task files", { taskId });
|
|
271
|
-
const files = await this.fileManager.getTaskFiles(taskId);
|
|
272
|
-
this.logger.debug("Found task files", { taskId, fileCount: files.length });
|
|
273
|
-
return files;
|
|
274
|
-
}
|
|
275
|
-
async createPullRequest(taskId, branchName, taskTitle, taskDescription, customBody) {
|
|
276
|
-
this.logger.info("Creating pull request", {
|
|
277
|
-
taskId,
|
|
278
|
-
branchName,
|
|
279
|
-
taskTitle,
|
|
280
|
-
});
|
|
281
|
-
const defaultBody = `## Task Details
|
|
282
|
-
**Task ID**: ${taskId}
|
|
283
|
-
**Description**: ${taskDescription}
|
|
284
|
-
|
|
285
|
-
## Changes
|
|
286
|
-
This PR implements the changes described in the task.
|
|
287
|
-
|
|
288
|
-
Generated by PostHog Agent`;
|
|
289
|
-
const prBody = customBody || defaultBody;
|
|
290
|
-
const prUrl = await this.gitManager.createPullRequest(branchName, taskTitle, prBody);
|
|
291
|
-
this.logger.info("Pull request created", { taskId, prUrl });
|
|
292
|
-
return prUrl;
|
|
293
|
-
}
|
|
294
|
-
async attachPullRequestToTask(taskId, prUrl, branchName) {
|
|
295
|
-
this.logger.info("Attaching PR to task run", { taskId, prUrl, branchName });
|
|
296
|
-
if (!this.posthogAPI || !this.currentRunId) {
|
|
297
|
-
const error = new Error("PostHog API not configured or no active run. Cannot attach PR to task.");
|
|
298
|
-
this.logger.error("PostHog API not configured", error);
|
|
299
|
-
throw error;
|
|
300
|
-
}
|
|
301
|
-
const updates = {
|
|
302
|
-
output: { pr_url: prUrl },
|
|
303
|
-
};
|
|
304
|
-
if (branchName) {
|
|
305
|
-
updates.branch = branchName;
|
|
306
|
-
}
|
|
307
|
-
await this.posthogAPI.updateTaskRun(taskId, this.currentRunId, updates);
|
|
308
|
-
this.logger.debug("PR attached to task run", {
|
|
309
|
-
taskId,
|
|
310
|
-
runId: this.currentRunId,
|
|
311
|
-
prUrl,
|
|
312
|
-
});
|
|
313
|
-
}
|
|
314
|
-
async updateTaskBranch(taskId, branchName) {
|
|
315
|
-
this.logger.info("Updating task run branch", { taskId, branchName });
|
|
316
|
-
if (!this.posthogAPI || !this.currentRunId) {
|
|
317
|
-
const error = new Error("PostHog API not configured or no active run. Cannot update branch.");
|
|
318
|
-
this.logger.error("PostHog API not configured", error);
|
|
319
|
-
throw error;
|
|
320
|
-
}
|
|
321
|
-
await this.posthogAPI.updateTaskRun(taskId, this.currentRunId, {
|
|
322
|
-
branch: branchName,
|
|
323
|
-
});
|
|
324
|
-
this.logger.debug("Task run branch updated", {
|
|
325
|
-
taskId,
|
|
326
|
-
runId: this.currentRunId,
|
|
327
|
-
branchName,
|
|
328
|
-
});
|
|
329
|
-
}
|
|
330
|
-
// Execution management
|
|
331
|
-
cancelTask(taskId) {
|
|
332
|
-
// Find the execution for this task and cancel it
|
|
333
|
-
for (const [executionId, execution] of this.taskManager.executionStates) {
|
|
334
|
-
if (execution.taskId === taskId && execution.status === "running") {
|
|
335
|
-
this.taskManager.cancelExecution(executionId);
|
|
336
|
-
break;
|
|
337
|
-
}
|
|
338
|
-
}
|
|
339
|
-
}
|
|
340
|
-
getTaskExecutionStatus(taskId) {
|
|
341
|
-
// Find the execution for this task
|
|
342
|
-
for (const execution of this.taskManager.executionStates.values()) {
|
|
343
|
-
if (execution.taskId === taskId) {
|
|
344
|
-
return execution.status;
|
|
345
|
-
}
|
|
346
|
-
}
|
|
347
|
-
return null;
|
|
348
|
-
}
|
|
349
|
-
async prepareTaskBranch(taskSlug, isCloudMode, sendNotification) {
|
|
350
|
-
if (await this.gitManager.hasChanges()) {
|
|
351
|
-
throw new Error("Cannot start task with uncommitted changes. Please commit or stash your changes first.");
|
|
352
|
-
}
|
|
353
|
-
// If we're running in a worktree, we're already on the correct branch
|
|
354
|
-
// (the worktree was created with its own branch). Skip branch creation.
|
|
355
|
-
const isWorktree = await this.gitManager.isWorktree();
|
|
356
|
-
if (isWorktree) {
|
|
357
|
-
const currentBranch = await this.gitManager.getCurrentBranch();
|
|
358
|
-
this.logger.info("Running in worktree, using existing branch", {
|
|
359
|
-
branch: currentBranch,
|
|
360
|
-
});
|
|
361
|
-
await sendNotification(POSTHOG_NOTIFICATIONS.BRANCH_CREATED, {
|
|
362
|
-
branch: currentBranch,
|
|
363
|
-
});
|
|
364
|
-
return;
|
|
365
|
-
}
|
|
366
|
-
await this.gitManager.resetToDefaultBranchIfNeeded();
|
|
367
|
-
const existingBranch = await this.gitManager.getTaskBranch(taskSlug);
|
|
368
|
-
if (!existingBranch) {
|
|
369
|
-
const branchName = await this.gitManager.createTaskBranch(taskSlug);
|
|
370
|
-
await sendNotification(POSTHOG_NOTIFICATIONS.BRANCH_CREATED, {
|
|
371
|
-
branch: branchName,
|
|
372
|
-
});
|
|
373
|
-
await this.gitManager.addAllPostHogFiles();
|
|
374
|
-
// Only commit if there are changes or we're in cloud mode
|
|
375
|
-
if (isCloudMode) {
|
|
376
|
-
await this.gitManager.commitAndPush(`Initialize task ${taskSlug}`, {
|
|
377
|
-
allowEmpty: true,
|
|
378
|
-
});
|
|
379
|
-
}
|
|
380
|
-
else {
|
|
381
|
-
// Check if there are any changes before committing
|
|
382
|
-
const hasChanges = await this.gitManager.hasStagedChanges();
|
|
383
|
-
if (hasChanges) {
|
|
384
|
-
await this.gitManager.commitChanges(`Initialize task ${taskSlug}`);
|
|
385
|
-
}
|
|
386
|
-
}
|
|
387
|
-
}
|
|
388
|
-
else {
|
|
389
|
-
this.logger.info("Switching to existing task branch", {
|
|
390
|
-
branch: existingBranch,
|
|
391
|
-
});
|
|
392
|
-
await this.gitManager.switchToBranch(existingBranch);
|
|
393
|
-
}
|
|
394
|
-
}
|
|
395
|
-
ensureOpenAIGatewayEnv(gatewayUrl, token) {
|
|
396
|
-
const resolvedGatewayUrl = gatewayUrl || process.env.ANTHROPIC_BASE_URL;
|
|
397
|
-
const resolvedToken = token || process.env.ANTHROPIC_AUTH_TOKEN;
|
|
398
|
-
if (resolvedGatewayUrl) {
|
|
399
|
-
process.env.OPENAI_BASE_URL = resolvedGatewayUrl;
|
|
400
|
-
}
|
|
401
|
-
if (resolvedToken) {
|
|
402
|
-
process.env.OPENAI_API_KEY = resolvedToken;
|
|
403
|
-
}
|
|
404
|
-
}
|
|
405
|
-
async runTaskCloud(taskId, taskRunId, options = {}) {
|
|
406
|
-
await this._configureLlmGateway();
|
|
407
|
-
const task = await this.fetchTask(taskId);
|
|
408
|
-
const cwd = options.repositoryPath || this.workingDirectory;
|
|
409
|
-
const taskSlug = task.slug || task.id;
|
|
410
|
-
this.currentRunId = taskRunId;
|
|
411
|
-
this.logger.info("Starting cloud task execution", {
|
|
412
|
-
taskId: task.id,
|
|
413
|
-
taskSlug,
|
|
414
|
-
taskRunId,
|
|
415
|
-
cwd,
|
|
416
|
-
});
|
|
417
|
-
if (!this.sessionStore) {
|
|
418
|
-
throw new Error("SessionStore required for cloud mode. Ensure PostHog API credentials are configured.");
|
|
419
|
-
}
|
|
420
|
-
// Start session in SessionStore (updates task run status to in_progress)
|
|
421
|
-
const taskRun = await this.sessionStore.start(taskRunId, taskId, taskRunId);
|
|
422
|
-
this.logger.debug("Session started", {
|
|
423
|
-
taskRunId,
|
|
424
|
-
logUrl: taskRun?.log_url,
|
|
425
|
-
});
|
|
426
|
-
// Create internal ACP connection with S3 persistence
|
|
427
|
-
const acpConnection = createAcpConnection({
|
|
428
|
-
sessionStore: this.sessionStore,
|
|
429
|
-
sessionId: taskRunId,
|
|
430
|
-
taskId: task.id,
|
|
431
|
-
});
|
|
432
|
-
// Create client connection using the client-side streams
|
|
433
|
-
const clientStream = ndJsonStream(acpConnection.clientStreams.writable, acpConnection.clientStreams.readable);
|
|
434
|
-
// Create auto-approving client for headless cloud mode
|
|
435
|
-
const cloudClient = {
|
|
436
|
-
async requestPermission(params) {
|
|
437
|
-
const allowOption = params.options.find((o) => o.kind === "allow_once" || o.kind === "allow_always");
|
|
438
|
-
return {
|
|
439
|
-
outcome: {
|
|
440
|
-
outcome: "selected",
|
|
441
|
-
optionId: allowOption?.optionId ?? params.options[0].optionId,
|
|
442
|
-
},
|
|
443
|
-
};
|
|
444
|
-
},
|
|
445
|
-
async sessionUpdate(_params) {
|
|
446
|
-
// Notifications are already being persisted to S3 via tapped streams
|
|
447
|
-
},
|
|
448
|
-
};
|
|
449
|
-
const clientConnection = new ClientSideConnection((_agent) => cloudClient, clientStream);
|
|
450
|
-
try {
|
|
451
|
-
// Initialize the connection
|
|
452
|
-
await clientConnection.initialize({
|
|
453
|
-
protocolVersion: PROTOCOL_VERSION,
|
|
454
|
-
clientCapabilities: {},
|
|
455
|
-
});
|
|
456
|
-
// Create new session
|
|
457
|
-
await clientConnection.newSession({
|
|
458
|
-
cwd,
|
|
459
|
-
mcpServers: [],
|
|
460
|
-
_meta: { sessionId: taskRunId },
|
|
461
|
-
});
|
|
462
|
-
// Prepare git branch if not skipped
|
|
463
|
-
if (!options.skipGitBranch) {
|
|
464
|
-
const sendNotification = async (method, params) => {
|
|
465
|
-
this.logger.debug(`Notification: ${method}`, params);
|
|
466
|
-
await acpConnection.agentConnection.extNotification?.(method, params);
|
|
467
|
-
};
|
|
468
|
-
await this.prepareTaskBranch(taskSlug, true, sendNotification);
|
|
469
|
-
}
|
|
470
|
-
// Build initial prompt from task description
|
|
471
|
-
const initialPrompt = [
|
|
472
|
-
{
|
|
473
|
-
type: "text",
|
|
474
|
-
text: `# Task: ${task.title}\n\n${task.description}`,
|
|
475
|
-
},
|
|
476
|
-
];
|
|
477
|
-
// Track the last known log entry count for interrupt polling
|
|
478
|
-
let lastKnownEntryCount = 0;
|
|
479
|
-
let isPolling = true;
|
|
480
|
-
// Start interrupt polling in background
|
|
481
|
-
const pollForInterrupts = async () => {
|
|
482
|
-
while (isPolling) {
|
|
483
|
-
await new Promise((resolve) => setTimeout(resolve, 2000)); // Poll every 2 seconds
|
|
484
|
-
if (!isPolling)
|
|
485
|
-
break;
|
|
486
|
-
try {
|
|
487
|
-
const newEntries = await this.sessionStore.pollForNewEntries(taskRunId, lastKnownEntryCount);
|
|
488
|
-
for (const entry of newEntries) {
|
|
489
|
-
lastKnownEntryCount++;
|
|
490
|
-
// Look for user_message notifications
|
|
491
|
-
if (entry.notification?.method === "sessionUpdate" &&
|
|
492
|
-
entry.notification?.params?.sessionUpdate ===
|
|
493
|
-
"user_message") {
|
|
494
|
-
const content = entry.notification?.params?.content;
|
|
495
|
-
if (content) {
|
|
496
|
-
this.logger.info("Processing user interrupt", { content });
|
|
497
|
-
// Send as new prompt - will be processed after current prompt completes
|
|
498
|
-
await clientConnection.prompt({
|
|
499
|
-
sessionId: taskRunId,
|
|
500
|
-
prompt: Array.isArray(content) ? content : [content],
|
|
501
|
-
});
|
|
502
|
-
}
|
|
503
|
-
}
|
|
504
|
-
}
|
|
505
|
-
}
|
|
506
|
-
catch (err) {
|
|
507
|
-
this.logger.warn("Interrupt polling error", { error: err });
|
|
508
|
-
}
|
|
509
|
-
}
|
|
510
|
-
};
|
|
511
|
-
// Start polling in background (don't await)
|
|
512
|
-
const pollingPromise = pollForInterrupts();
|
|
513
|
-
// Send initial prompt and wait for completion
|
|
514
|
-
this.logger.info("Sending initial prompt to agent");
|
|
515
|
-
const result = await clientConnection.prompt({
|
|
516
|
-
sessionId: taskRunId,
|
|
517
|
-
prompt: initialPrompt,
|
|
518
|
-
});
|
|
519
|
-
// Stop interrupt polling
|
|
520
|
-
isPolling = false;
|
|
521
|
-
await pollingPromise;
|
|
522
|
-
this.logger.info("Task execution complete", {
|
|
523
|
-
taskId: task.id,
|
|
524
|
-
stopReason: result.stopReason,
|
|
525
|
-
});
|
|
526
|
-
await this.sessionStore.complete(taskRunId);
|
|
527
|
-
}
|
|
528
|
-
catch (error) {
|
|
529
|
-
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
530
|
-
this.logger.error("Cloud task execution failed", {
|
|
531
|
-
taskId: task.id,
|
|
532
|
-
error: errorMessage,
|
|
533
|
-
});
|
|
534
|
-
await this.sessionStore.fail(taskRunId, errorMessage);
|
|
535
|
-
throw error;
|
|
536
|
-
}
|
|
537
|
-
}
|
|
538
|
-
async ensurePullRequest(task, stepResults, sendNotification) {
|
|
539
|
-
const latestRun = task.latest_run;
|
|
540
|
-
const existingPr = latestRun?.output && typeof latestRun.output === "object"
|
|
541
|
-
? latestRun.output.pr_url
|
|
542
|
-
: null;
|
|
543
|
-
if (existingPr) {
|
|
544
|
-
this.logger.info("PR already exists, skipping creation", {
|
|
545
|
-
taskId: task.id,
|
|
546
|
-
prUrl: existingPr,
|
|
547
|
-
});
|
|
548
|
-
return;
|
|
549
|
-
}
|
|
550
|
-
const buildResult = stepResults.build;
|
|
551
|
-
if (!buildResult?.commitCreated) {
|
|
552
|
-
this.logger.warn("Build step did not produce a commit; skipping PR creation", { taskId: task.id });
|
|
553
|
-
return;
|
|
554
|
-
}
|
|
555
|
-
const branchName = await this.gitManager.getCurrentBranch();
|
|
556
|
-
const finalizeResult = stepResults.finalize;
|
|
557
|
-
const prBody = finalizeResult?.prBody;
|
|
558
|
-
const prUrl = await this.createPullRequest(task.id, branchName, task.title, task.description ?? "", prBody);
|
|
559
|
-
await sendNotification(POSTHOG_NOTIFICATIONS.PR_CREATED, { prUrl });
|
|
560
|
-
try {
|
|
561
|
-
await this.attachPullRequestToTask(task.id, prUrl, branchName);
|
|
562
|
-
this.logger.info("PR attached to task successfully", {
|
|
563
|
-
taskId: task.id,
|
|
564
|
-
prUrl,
|
|
565
|
-
});
|
|
566
|
-
}
|
|
567
|
-
catch (error) {
|
|
568
|
-
this.logger.warn("Could not attach PR to task", {
|
|
569
|
-
error: error instanceof Error ? error.message : String(error),
|
|
570
|
-
});
|
|
571
|
-
}
|
|
572
|
-
}
|
|
573
|
-
}
|
|
574
|
-
|
|
575
|
-
export { Agent };
|
|
576
|
-
//# sourceMappingURL=agent.js.map
|
package/dist/src/agent.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"agent.js","sources":["../../src/agent.ts"],"sourcesContent":["import {\n type Client,\n ClientSideConnection,\n type ContentBlock,\n ndJsonStream,\n PROTOCOL_VERSION,\n type RequestPermissionRequest,\n type RequestPermissionResponse,\n type SessionNotification,\n} from \"@agentclientprotocol/sdk\";\nimport { POSTHOG_NOTIFICATIONS } from \"./acp-extensions.js\";\nimport {\n createAcpConnection,\n type InProcessAcpConnection,\n} from \"./adapters/claude/claude.js\";\nimport { PostHogFileManager } from \"./file-manager.js\";\nimport { GitManager } from \"./git-manager.js\";\nimport { PostHogAPIClient } from \"./posthog-api.js\";\nimport { PromptBuilder } from \"./prompt-builder.js\";\nimport { SessionStore } from \"./session-store.js\";\nimport { TaskManager } from \"./task-manager.js\";\nimport { TemplateManager } from \"./template-manager.js\";\nimport type {\n AgentConfig,\n CanUseTool,\n StoredNotification,\n Task,\n TaskExecutionOptions,\n} from \"./types.js\";\nimport { Logger } from \"./utils/logger.js\";\nimport { TASK_WORKFLOW } from \"./workflow/config.js\";\nimport type { SendNotification, WorkflowRuntime } from \"./workflow/types.js\";\n\nexport class Agent {\n private workingDirectory: string;\n private taskManager: TaskManager;\n private posthogAPI?: PostHogAPIClient;\n private fileManager: PostHogFileManager;\n private gitManager: GitManager;\n private templateManager: TemplateManager;\n private logger: Logger;\n private acpConnection?: InProcessAcpConnection;\n private promptBuilder: PromptBuilder;\n private mcpServers?: Record<string, any>;\n private canUseTool?: CanUseTool;\n private currentRunId?: string;\n private sessionStore?: SessionStore;\n public debug: boolean;\n\n constructor(config: AgentConfig) {\n this.workingDirectory = config.workingDirectory || process.cwd();\n this.canUseTool = config.canUseTool;\n this.debug = config.debug || false;\n\n // Build default PostHog MCP server configuration\n const posthogMcpUrl =\n 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({\n debug: this.debug,\n prefix: \"[PostHog Agent]\",\n onLog: config.onLog,\n });\n this.taskManager = new TaskManager();\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 });\n this.templateManager = new TemplateManager();\n\n if (\n config.posthogApiUrl &&\n config.posthogApiKey &&\n config.posthogProjectId\n ) {\n this.posthogAPI = new PostHogAPIClient({\n apiUrl: config.posthogApiUrl,\n apiKey: config.posthogApiKey,\n projectId: config.posthogProjectId,\n });\n\n // Create SessionStore from the API client for ACP connection\n this.sessionStore = new SessionStore(\n this.posthogAPI,\n this.logger.child(\"SessionStore\"),\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 }\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 process.env.ANTHROPIC_BASE_URL = gatewayUrl;\n process.env.ANTHROPIC_AUTH_TOKEN = apiKey;\n this.ensureOpenAIGatewayEnv(gatewayUrl, apiKey);\n } catch (error) {\n this.logger.error(\"Failed to configure LLM gateway\", error);\n throw error;\n }\n }\n\n private getOrCreateConnection(): InProcessAcpConnection {\n if (!this.acpConnection) {\n this.acpConnection = createAcpConnection({\n sessionStore: this.sessionStore,\n });\n }\n return this.acpConnection;\n }\n\n // Adaptive task execution orchestrated via workflow steps\n async runTask(\n taskId: string,\n taskRunId: string,\n options: import(\"./types.js\").TaskExecutionOptions = {},\n ): Promise<void> {\n // await this._configureLlmGateway();\n\n const task = await this.fetchTask(taskId);\n const cwd = options.repositoryPath || this.workingDirectory;\n const isCloudMode = options.isCloudMode ?? false;\n const taskSlug = (task as any).slug || task.id;\n\n // Use taskRunId as sessionId - they are the same identifier\n this.currentRunId = taskRunId;\n\n this.logger.info(\"Starting adaptive task execution\", {\n taskId: task.id,\n taskSlug,\n taskRunId,\n isCloudMode,\n });\n\n const connection = this.getOrCreateConnection();\n\n // Create sendNotification using ACP connection's extNotification\n const sendNotification: SendNotification = async (method, params) => {\n this.logger.debug(`Notification: ${method}`, params);\n await connection.agentConnection.extNotification?.(method, params);\n };\n\n await sendNotification(POSTHOG_NOTIFICATIONS.RUN_STARTED, {\n sessionId: taskRunId,\n runId: taskRunId,\n });\n\n await this.prepareTaskBranch(taskSlug, isCloudMode, sendNotification);\n\n let taskError: Error | undefined;\n try {\n const workflowContext: WorkflowRuntime = {\n task,\n taskSlug,\n runId: taskRunId,\n cwd,\n isCloudMode,\n options,\n logger: this.logger,\n fileManager: this.fileManager,\n gitManager: this.gitManager,\n promptBuilder: this.promptBuilder,\n connection: connection.agentConnection,\n sessionId: taskRunId,\n sendNotification,\n mcpServers: this.mcpServers,\n posthogAPI: this.posthogAPI,\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(\n task,\n workflowContext.stepResults,\n sendNotification,\n );\n }\n\n this.logger.info(\"Task execution complete\", { taskId: task.id });\n await sendNotification(POSTHOG_NOTIFICATIONS.TASK_COMPLETE, {\n sessionId: taskRunId,\n taskId: task.id,\n });\n } catch (error) {\n taskError = error instanceof Error ? error : new Error(String(error));\n this.logger.error(\"Task execution failed\", {\n taskId: task.id,\n error: taskError.message,\n });\n await sendNotification(POSTHOG_NOTIFICATIONS.ERROR, {\n sessionId: taskRunId,\n message: taskError.message,\n });\n throw taskError;\n }\n }\n\n /**\n * Creates an in-process ACP connection for client communication.\n * Sets up git branch for the task, configures LLM gateway.\n * The client handles all prompting/querying via the returned streams.\n *\n * @returns InProcessAcpConnection with clientStreams for the client to use\n */\n async runTaskV2(\n taskId: string,\n taskRunId: string,\n options: import(\"./types.js\").TaskExecutionOptions = {},\n ): Promise<InProcessAcpConnection> {\n await this._configureLlmGateway();\n\n const task = await this.fetchTask(taskId);\n const taskSlug = (task as any).slug || task.id;\n const isCloudMode = options.isCloudMode ?? false;\n const _cwd = options.repositoryPath || this.workingDirectory;\n\n // Use taskRunId as sessionId - they are the same identifier\n this.currentRunId = taskRunId;\n\n this.acpConnection = createAcpConnection({\n sessionStore: this.sessionStore,\n sessionId: taskRunId,\n taskId: task.id,\n });\n\n const sendNotification: SendNotification = async (method, params) => {\n this.logger.debug(`Notification: ${method}`, params);\n await this.acpConnection?.agentConnection.extNotification?.(\n method,\n params,\n );\n };\n\n await sendNotification(POSTHOG_NOTIFICATIONS.RUN_STARTED, {\n sessionId: taskRunId,\n runId: taskRunId,\n });\n\n if (!options.skipGitBranch) {\n try {\n await this.prepareTaskBranch(taskSlug, isCloudMode, sendNotification);\n } catch (error) {\n const errorMessage =\n error instanceof Error ? error.message : String(error);\n this.logger.error(\"Failed to prepare task branch\", {\n error: errorMessage,\n });\n await sendNotification(POSTHOG_NOTIFICATIONS.ERROR, {\n sessionId: taskRunId,\n message: errorMessage,\n });\n throw error;\n }\n }\n\n return this.acpConnection;\n }\n\n // PostHog task operations\n async fetchTask(taskId: string): Promise<Task> {\n if (!this.posthogAPI) {\n const error = new Error(\n \"PostHog API not configured. Provide posthogApiUrl and posthogApiKey in constructor.\",\n );\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 /**\n * Send a notification to a cloud task run's S3 log.\n * The cloud runner will pick up new notifications via interrupt polling.\n */\n async sendNotification(\n taskId: string,\n runId: string,\n notification: StoredNotification,\n ): Promise<void> {\n if (!this.posthogAPI) {\n throw new Error(\n \"PostHog API not configured. Cannot send notification to cloud task.\",\n );\n }\n\n await this.posthogAPI.appendTaskRunLog(taskId, runId, [notification]);\n this.logger.debug(\"Notification sent to cloud task\", {\n taskId,\n runId,\n method: notification.notification.method,\n });\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 createPullRequest(\n taskId: string,\n branchName: string,\n taskTitle: string,\n taskDescription: string,\n customBody?: string,\n ): Promise<string> {\n this.logger.info(\"Creating pull request\", {\n taskId,\n branchName,\n taskTitle,\n });\n\n const defaultBody = `## 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 const prBody = customBody || defaultBody;\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(\n taskId: string,\n prUrl: string,\n branchName?: string,\n ): Promise<void> {\n this.logger.info(\"Attaching PR to task run\", { taskId, prUrl, branchName });\n\n if (!this.posthogAPI || !this.currentRunId) {\n const error = new Error(\n \"PostHog API not configured or no active run. Cannot attach PR to task.\",\n );\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.currentRunId, updates);\n this.logger.debug(\"PR attached to task run\", {\n taskId,\n runId: this.currentRunId,\n prUrl,\n });\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.currentRunId) {\n const error = new Error(\n \"PostHog API not configured or no active run. Cannot update branch.\",\n );\n this.logger.error(\"PostHog API not configured\", error);\n throw error;\n }\n\n await this.posthogAPI.updateTaskRun(taskId, this.currentRunId, {\n branch: branchName,\n });\n this.logger.debug(\"Task run branch updated\", {\n taskId,\n runId: this.currentRunId,\n branchName,\n });\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(\n taskSlug: string,\n isCloudMode: boolean,\n sendNotification: SendNotification,\n ): Promise<void> {\n if (await this.gitManager.hasChanges()) {\n throw new Error(\n \"Cannot start task with uncommitted changes. Please commit or stash your changes first.\",\n );\n }\n\n // If we're running in a worktree, we're already on the correct branch\n // (the worktree was created with its own branch). Skip branch creation.\n const isWorktree = await this.gitManager.isWorktree();\n if (isWorktree) {\n const currentBranch = await this.gitManager.getCurrentBranch();\n this.logger.info(\"Running in worktree, using existing branch\", {\n branch: currentBranch,\n });\n await sendNotification(POSTHOG_NOTIFICATIONS.BRANCH_CREATED, {\n branch: currentBranch,\n });\n return;\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 await sendNotification(POSTHOG_NOTIFICATIONS.BRANCH_CREATED, {\n branch: branchName,\n });\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}`, {\n allowEmpty: true,\n });\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\", {\n branch: existingBranch,\n });\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 async runTaskCloud(\n taskId: string,\n taskRunId: string,\n options: TaskExecutionOptions = {},\n ): Promise<void> {\n await this._configureLlmGateway();\n\n const task = await this.fetchTask(taskId);\n const cwd = options.repositoryPath || this.workingDirectory;\n const taskSlug = (task as any).slug || task.id;\n\n this.currentRunId = taskRunId;\n\n this.logger.info(\"Starting cloud task execution\", {\n taskId: task.id,\n taskSlug,\n taskRunId,\n cwd,\n });\n\n if (!this.sessionStore) {\n throw new Error(\n \"SessionStore required for cloud mode. Ensure PostHog API credentials are configured.\",\n );\n }\n\n // Start session in SessionStore (updates task run status to in_progress)\n const taskRun = await this.sessionStore.start(taskRunId, taskId, taskRunId);\n this.logger.debug(\"Session started\", {\n taskRunId,\n logUrl: taskRun?.log_url,\n });\n\n // Create internal ACP connection with S3 persistence\n const acpConnection = createAcpConnection({\n sessionStore: this.sessionStore,\n sessionId: taskRunId,\n taskId: task.id,\n });\n\n // Create client connection using the client-side streams\n const clientStream = ndJsonStream(\n acpConnection.clientStreams.writable as WritableStream<Uint8Array>,\n acpConnection.clientStreams.readable as ReadableStream<Uint8Array>,\n );\n\n // Create auto-approving client for headless cloud mode\n const cloudClient: Client = {\n async requestPermission(params) {\n const allowOption = params.options.find(\n (o) => o.kind === \"allow_once\" || o.kind === \"allow_always\",\n );\n return {\n outcome: {\n outcome: \"selected\",\n optionId: allowOption?.optionId ?? params.options[0].optionId,\n },\n };\n },\n async sessionUpdate(_params) {\n // Notifications are already being persisted to S3 via tapped streams\n },\n };\n\n const clientConnection = new ClientSideConnection(\n (_agent) => cloudClient,\n clientStream,\n );\n\n try {\n // Initialize the connection\n await clientConnection.initialize({\n protocolVersion: PROTOCOL_VERSION,\n clientCapabilities: {},\n });\n\n // Create new session\n await clientConnection.newSession({\n cwd,\n mcpServers: [],\n _meta: { sessionId: taskRunId },\n });\n\n // Prepare git branch if not skipped\n if (!options.skipGitBranch) {\n const sendNotification: SendNotification = async (method, params) => {\n this.logger.debug(`Notification: ${method}`, params);\n await acpConnection.agentConnection.extNotification?.(method, params);\n };\n await this.prepareTaskBranch(taskSlug, true, sendNotification);\n }\n\n // Build initial prompt from task description\n const initialPrompt: ContentBlock[] = [\n {\n type: \"text\",\n text: `# Task: ${task.title}\\n\\n${task.description}`,\n },\n ];\n\n // Track the last known log entry count for interrupt polling\n let lastKnownEntryCount = 0;\n let isPolling = true;\n\n // Start interrupt polling in background\n const pollForInterrupts = async () => {\n while (isPolling) {\n await new Promise((resolve) => setTimeout(resolve, 2000)); // Poll every 2 seconds\n if (!isPolling) break;\n\n try {\n const newEntries = await this.sessionStore!.pollForNewEntries(\n taskRunId,\n lastKnownEntryCount,\n );\n\n for (const entry of newEntries) {\n lastKnownEntryCount++;\n // Look for user_message notifications\n if (\n entry.notification?.method === \"sessionUpdate\" &&\n (entry.notification?.params as any)?.sessionUpdate ===\n \"user_message\"\n ) {\n const content = (entry.notification?.params as any)?.content;\n if (content) {\n this.logger.info(\"Processing user interrupt\", { content });\n // Send as new prompt - will be processed after current prompt completes\n await clientConnection.prompt({\n sessionId: taskRunId,\n prompt: Array.isArray(content) ? content : [content],\n });\n }\n }\n }\n } catch (err) {\n this.logger.warn(\"Interrupt polling error\", { error: err });\n }\n }\n };\n\n // Start polling in background (don't await)\n const pollingPromise = pollForInterrupts();\n\n // Send initial prompt and wait for completion\n this.logger.info(\"Sending initial prompt to agent\");\n const result = await clientConnection.prompt({\n sessionId: taskRunId,\n prompt: initialPrompt,\n });\n\n // Stop interrupt polling\n isPolling = false;\n await pollingPromise;\n\n this.logger.info(\"Task execution complete\", {\n taskId: task.id,\n stopReason: result.stopReason,\n });\n\n await this.sessionStore.complete(taskRunId);\n } catch (error) {\n const errorMessage =\n error instanceof Error ? error.message : String(error);\n this.logger.error(\"Cloud task execution failed\", {\n taskId: task.id,\n error: errorMessage,\n });\n await this.sessionStore.fail(taskRunId, errorMessage);\n throw error;\n }\n }\n\n private async ensurePullRequest(\n task: Task,\n stepResults: Record<string, any>,\n sendNotification: SendNotification,\n ): 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\", {\n taskId: task.id,\n prUrl: existingPr,\n });\n return;\n }\n\n const buildResult = stepResults.build;\n if (!buildResult?.commitCreated) {\n this.logger.warn(\n \"Build step did not produce a commit; skipping PR creation\",\n { taskId: task.id },\n );\n return;\n }\n\n const branchName = await this.gitManager.getCurrentBranch();\n const finalizeResult = stepResults.finalize;\n const prBody = finalizeResult?.prBody;\n\n const prUrl = await this.createPullRequest(\n task.id,\n branchName,\n task.title,\n task.description ?? \"\",\n prBody,\n );\n\n await sendNotification(POSTHOG_NOTIFICATIONS.PR_CREATED, { prUrl });\n\n try {\n await this.attachPullRequestToTask(task.id, prUrl, branchName);\n this.logger.info(\"PR attached to task successfully\", {\n taskId: task.id,\n prUrl,\n });\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\nexport type {\n AgentConfig,\n ExecutionResult,\n SupportingFile,\n Task,\n} from \"./types.js\";\nexport { PermissionMode } from \"./types.js\";\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;MAiCa,KAAK,CAAA;AACR,IAAA,gBAAgB;AAChB,IAAA,WAAW;AACX,IAAA,UAAU;AACV,IAAA,WAAW;AACX,IAAA,UAAU;AACV,IAAA,eAAe;AACf,IAAA,MAAM;AACN,IAAA,aAAa;AACb,IAAA,aAAa;AACb,IAAA,UAAU;AACV,IAAA,UAAU;AACV,IAAA,YAAY;AACZ,IAAA,YAAY;AACb,IAAA,KAAK;AAEZ,IAAA,WAAA,CAAY,MAAmB,EAAA;QAC7B,IAAI,CAAC,gBAAgB,GAAG,MAAM,CAAC,gBAAgB,IAAI,OAAO,CAAC,GAAG,EAAE;AAChE,QAAA,IAAI,CAAC,UAAU,GAAG,MAAM,CAAC,UAAU;QACnC,IAAI,CAAC,KAAK,GAAG,MAAM,CAAC,KAAK,IAAI,KAAK;;AAGlC,QAAA,MAAM,aAAa,GACjB,MAAM,CAAC,aAAa;YACpB,OAAO,CAAC,GAAG,CAAC,eAAe;AAC3B,YAAA,6BAA6B;;QAG/B,MAAM,OAAO,GAA2B,EAAE;AAC1C,QAAA,IAAI,MAAM,CAAC,aAAa,EAAE;Y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uB,CAAC,IAAI,CAAC,EAAE,EAAE,KAAK,EAAE,UAAU,CAAC;AAC9D,YAAA,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,kCAAkC,EAAE;gBACnD,MAAM,EAAE,IAAI,CAAC,EAAE;gBACf,KAAK;AACN,aAAA,CAAC;QACJ;QAAE,OAAO,KAAK,EAAE;AACd,YAAA,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,6BAA6B,EAAE;AAC9C,gBAAA,KAAK,EAAE,KAAK,YAAY,KAAK,GAAG,KAAK,CAAC,OAAO,GAAG,MAAM,CAAC,KAAK,CAAC;AAC9D,aAAA,CAAC;QACJ;IACF;AACD;;;;"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
export declare const EXECUTION_SYSTEM_PROMPT = "<role>\nPostHog AI Execution Agent \u2014 autonomously implement tasks as merge-ready code following project conventions.\n</role>\n\n<context>\nYou have access to local repository files and PostHog MCP server. Work primarily with local files for implementation. Commit changes regularly.\n</context>\n\n<constraints>\n- Follow existing code style, patterns, and conventions found in the repository\n- Minimize new external dependencies \u2014 only add when necessary\n- Implement structured logging and error handling (never log secrets)\n- Avoid destructive shell commands\n- Create/update .gitignore to exclude build artifacts, dependencies, and temp files\n</constraints>\n\n<approach>\n1. Review the implementation plan if provided, or create your own todo list\n2. Execute changes step by step\n3. Test thoroughly and verify functionality\n4. Commit changes with clear messages\n</approach>\n\n<checklist>\nBefore completing the task, verify:\n- .gitignore includes build artifacts, node_modules, __pycache__, etc.\n- Dependency files (package.json, requirements.txt) use exact versions\n- Code compiles and tests pass\n- Added or updated relevant tests\n- Captured meaningful events with PostHog SDK where appropriate\n- Wrapped new logic in PostHog feature flags where appropriate\n- Updated documentation, README, or type hints as needed\n</checklist>\n\n<output_format>\nProvide a concise summary of changes made when finished.\n</output_format>";
|
|
2
|
-
//# sourceMappingURL=execution.d.ts.map
|