@posthog/agent 1.24.2 → 1.25.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/_virtual/_commonjsHelpers.js +6 -0
- package/dist/_virtual/_commonjsHelpers.js.map +1 -0
- package/dist/_virtual/additionalItems.js +4 -0
- package/dist/_virtual/additionalItems.js.map +1 -0
- package/dist/_virtual/additionalProperties.js +4 -0
- package/dist/_virtual/additionalProperties.js.map +1 -0
- package/dist/_virtual/ajv.js +4 -0
- package/dist/_virtual/ajv.js.map +1 -0
- package/dist/_virtual/allOf.js +4 -0
- package/dist/_virtual/allOf.js.map +1 -0
- package/dist/_virtual/anyOf.js +4 -0
- package/dist/_virtual/anyOf.js.map +1 -0
- package/dist/_virtual/applicability.js +4 -0
- package/dist/_virtual/applicability.js.map +1 -0
- package/dist/_virtual/boolSchema.js +4 -0
- package/dist/_virtual/boolSchema.js.map +1 -0
- package/dist/_virtual/code.js +4 -0
- package/dist/_virtual/code.js.map +1 -0
- package/dist/_virtual/code2.js +4 -0
- package/dist/_virtual/code2.js.map +1 -0
- package/dist/_virtual/const.js +4 -0
- package/dist/_virtual/const.js.map +1 -0
- package/dist/_virtual/contains.js +4 -0
- package/dist/_virtual/contains.js.map +1 -0
- package/dist/_virtual/core.js +4 -0
- package/dist/_virtual/core.js.map +1 -0
- package/dist/_virtual/dataType.js +4 -0
- package/dist/_virtual/dataType.js.map +1 -0
- package/dist/_virtual/defaults.js +4 -0
- package/dist/_virtual/defaults.js.map +1 -0
- package/dist/_virtual/dependencies.js +4 -0
- package/dist/_virtual/dependencies.js.map +1 -0
- package/dist/_virtual/draft7.js +4 -0
- package/dist/_virtual/draft7.js.map +1 -0
- package/dist/_virtual/enum.js +4 -0
- package/dist/_virtual/enum.js.map +1 -0
- package/dist/_virtual/equal.js +4 -0
- package/dist/_virtual/equal.js.map +1 -0
- package/dist/_virtual/errors.js +4 -0
- package/dist/_virtual/errors.js.map +1 -0
- package/dist/_virtual/format.js +4 -0
- package/dist/_virtual/format.js.map +1 -0
- package/dist/_virtual/formats.js +4 -0
- package/dist/_virtual/formats.js.map +1 -0
- package/dist/_virtual/id.js +4 -0
- package/dist/_virtual/id.js.map +1 -0
- package/dist/_virtual/if.js +4 -0
- package/dist/_virtual/if.js.map +1 -0
- package/dist/_virtual/index.js +4 -0
- package/dist/_virtual/index.js.map +1 -0
- package/dist/_virtual/index10.js +4 -0
- package/dist/_virtual/index10.js.map +1 -0
- package/dist/_virtual/index11.js +4 -0
- package/dist/_virtual/index11.js.map +1 -0
- package/dist/_virtual/index2.js +4 -0
- package/dist/_virtual/index2.js.map +1 -0
- package/dist/_virtual/index3.js +4 -0
- package/dist/_virtual/index3.js.map +1 -0
- package/dist/_virtual/index4.js +4 -0
- package/dist/_virtual/index4.js.map +1 -0
- package/dist/_virtual/index5.js +4 -0
- package/dist/_virtual/index5.js.map +1 -0
- package/dist/_virtual/index6.js +4 -0
- package/dist/_virtual/index6.js.map +1 -0
- package/dist/_virtual/index7.js +4 -0
- package/dist/_virtual/index7.js.map +1 -0
- package/dist/_virtual/index8.js +4 -0
- package/dist/_virtual/index8.js.map +1 -0
- package/dist/_virtual/index9.js +4 -0
- package/dist/_virtual/index9.js.map +1 -0
- package/dist/_virtual/items.js +4 -0
- package/dist/_virtual/items.js.map +1 -0
- package/dist/_virtual/items2020.js +4 -0
- package/dist/_virtual/items2020.js.map +1 -0
- package/dist/_virtual/keyword.js +4 -0
- package/dist/_virtual/keyword.js.map +1 -0
- package/dist/_virtual/limit.js +4 -0
- package/dist/_virtual/limit.js.map +1 -0
- package/dist/_virtual/limitItems.js +4 -0
- package/dist/_virtual/limitItems.js.map +1 -0
- package/dist/_virtual/limitLength.js +4 -0
- package/dist/_virtual/limitLength.js.map +1 -0
- package/dist/_virtual/limitNumber.js +4 -0
- package/dist/_virtual/limitNumber.js.map +1 -0
- package/dist/_virtual/limitProperties.js +4 -0
- package/dist/_virtual/limitProperties.js.map +1 -0
- package/dist/_virtual/metadata.js +4 -0
- package/dist/_virtual/metadata.js.map +1 -0
- package/dist/_virtual/multipleOf.js +4 -0
- package/dist/_virtual/multipleOf.js.map +1 -0
- package/dist/_virtual/names.js +4 -0
- package/dist/_virtual/names.js.map +1 -0
- package/dist/_virtual/not.js +4 -0
- package/dist/_virtual/not.js.map +1 -0
- package/dist/_virtual/oneOf.js +4 -0
- package/dist/_virtual/oneOf.js.map +1 -0
- package/dist/_virtual/pattern.js +4 -0
- package/dist/_virtual/pattern.js.map +1 -0
- package/dist/_virtual/patternProperties.js +4 -0
- package/dist/_virtual/patternProperties.js.map +1 -0
- package/dist/_virtual/prefixItems.js +4 -0
- package/dist/_virtual/prefixItems.js.map +1 -0
- package/dist/_virtual/properties.js +4 -0
- package/dist/_virtual/properties.js.map +1 -0
- package/dist/_virtual/propertyNames.js +4 -0
- package/dist/_virtual/propertyNames.js.map +1 -0
- package/dist/_virtual/ref.js +4 -0
- package/dist/_virtual/ref.js.map +1 -0
- package/dist/_virtual/ref_error.js +4 -0
- package/dist/_virtual/ref_error.js.map +1 -0
- package/dist/_virtual/required.js +4 -0
- package/dist/_virtual/required.js.map +1 -0
- package/dist/_virtual/resolve.js +4 -0
- package/dist/_virtual/resolve.js.map +1 -0
- package/dist/_virtual/rules.js +4 -0
- package/dist/_virtual/rules.js.map +1 -0
- package/dist/_virtual/scope.js +4 -0
- package/dist/_virtual/scope.js.map +1 -0
- package/dist/_virtual/subschema.js +4 -0
- package/dist/_virtual/subschema.js.map +1 -0
- package/dist/_virtual/thenElse.js +4 -0
- package/dist/_virtual/thenElse.js.map +1 -0
- package/dist/_virtual/types.js +4 -0
- package/dist/_virtual/types.js.map +1 -0
- package/dist/_virtual/ucs2length.js +4 -0
- package/dist/_virtual/ucs2length.js.map +1 -0
- package/dist/_virtual/uniqueItems.js +4 -0
- package/dist/_virtual/uniqueItems.js.map +1 -0
- package/dist/_virtual/uri.js +4 -0
- package/dist/_virtual/uri.js.map +1 -0
- package/dist/_virtual/util.js +4 -0
- package/dist/_virtual/util.js.map +1 -0
- package/dist/_virtual/validation_error.js +4 -0
- package/dist/_virtual/validation_error.js.map +1 -0
- package/dist/claude-cli/cli.js +2294 -2146
- package/dist/example-client.d.ts +3 -0
- package/dist/example-client.d.ts.map +1 -0
- package/dist/index.d.ts +19 -11
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -3
- package/dist/index.js.map +1 -1
- package/dist/node_modules/@agentclientprotocol/sdk/dist/acp.js +610 -0
- package/dist/node_modules/@agentclientprotocol/sdk/dist/acp.js.map +1 -0
- package/dist/node_modules/@agentclientprotocol/sdk/dist/schema.js +875 -0
- package/dist/node_modules/@agentclientprotocol/sdk/dist/schema.js.map +1 -0
- package/dist/node_modules/@agentclientprotocol/sdk/dist/stream.js +66 -0
- package/dist/node_modules/@agentclientprotocol/sdk/dist/stream.js.map +1 -0
- package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/server/completable.js +23 -0
- package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/server/completable.js.map +1 -0
- package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/server/index.js +331 -0
- package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/server/index.js.map +1 -0
- package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/server/mcp.js +717 -0
- package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/server/mcp.js.map +1 -0
- package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-compat.js +221 -0
- package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-compat.js.map +1 -0
- package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-json-schema-compat.js +56 -0
- package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-json-schema-compat.js.map +1 -0
- package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/protocol.js +440 -0
- package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/protocol.js.map +1 -0
- package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/toolNameValidation.js +94 -0
- package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/toolNameValidation.js.map +1 -0
- package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/types.js +1610 -0
- package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/types.js.map +1 -0
- package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/validation/ajv-provider.js +91 -0
- package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/validation/ajv-provider.js.map +1 -0
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v3/ZodError.js +133 -0
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v3/ZodError.js.map +1 -0
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v3/errors.js +9 -0
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v3/errors.js.map +1 -0
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v3/helpers/errorUtil.js +9 -0
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v3/helpers/errorUtil.js.map +1 -0
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v3/helpers/parseUtil.js +112 -0
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v3/helpers/parseUtil.js.map +1 -0
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v3/helpers/util.js +136 -0
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v3/helpers/util.js.map +1 -0
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v3/locales/en.js +112 -0
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v3/locales/en.js.map +1 -0
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v3/types.js +3297 -0
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v3/types.js.map +1 -0
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v4/classic/errors.js +44 -0
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v4/classic/errors.js.map +1 -0
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v4/classic/iso.js +36 -0
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v4/classic/iso.js.map +1 -0
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v4/classic/parse.js +10 -0
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v4/classic/parse.js.map +1 -0
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v4/classic/schemas.js +657 -0
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v4/classic/schemas.js.map +1 -0
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v4/core/api.js +449 -0
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v4/core/api.js.map +1 -0
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v4/core/checks.js +413 -0
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v4/core/checks.js.map +1 -0
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v4/core/core.js +57 -0
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v4/core/core.js.map +1 -0
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v4/core/doc.js +38 -0
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v4/core/doc.js.map +1 -0
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v4/core/errors.js +86 -0
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v4/core/errors.js.map +1 -0
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v4/core/parse.js +61 -0
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v4/core/parse.js.map +1 -0
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v4/core/regexes.js +80 -0
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v4/core/regexes.js.map +1 -0
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v4/core/registries.js +52 -0
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v4/core/registries.js.map +1 -0
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v4/core/schemas.js +1307 -0
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v4/core/schemas.js.map +1 -0
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v4/core/to-json-schema.js +842 -0
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v4/core/to-json-schema.js.map +1 -0
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v4/core/util.js +335 -0
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v4/core/util.js.map +1 -0
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v4/core/versions.js +8 -0
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v4/core/versions.js.map +1 -0
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v4/mini/schemas.js +51 -0
- package/dist/node_modules/@modelcontextprotocol/sdk/node_modules/zod/v4/mini/schemas.js.map +1 -0
- package/dist/node_modules/ajv/dist/ajv.js +69 -0
- package/dist/node_modules/ajv/dist/ajv.js.map +1 -0
- package/dist/node_modules/ajv/dist/compile/codegen/code.js +169 -0
- package/dist/node_modules/ajv/dist/compile/codegen/code.js.map +1 -0
- package/dist/node_modules/ajv/dist/compile/codegen/index.js +712 -0
- package/dist/node_modules/ajv/dist/compile/codegen/index.js.map +1 -0
- package/dist/node_modules/ajv/dist/compile/codegen/scope.js +157 -0
- package/dist/node_modules/ajv/dist/compile/codegen/scope.js.map +1 -0
- package/dist/node_modules/ajv/dist/compile/errors.js +140 -0
- package/dist/node_modules/ajv/dist/compile/errors.js.map +1 -0
- package/dist/node_modules/ajv/dist/compile/index.js +253 -0
- package/dist/node_modules/ajv/dist/compile/index.js.map +1 -0
- package/dist/node_modules/ajv/dist/compile/names.js +40 -0
- package/dist/node_modules/ajv/dist/compile/names.js.map +1 -0
- package/dist/node_modules/ajv/dist/compile/ref_error.js +25 -0
- package/dist/node_modules/ajv/dist/compile/ref_error.js.map +1 -0
- package/dist/node_modules/ajv/dist/compile/resolve.js +162 -0
- package/dist/node_modules/ajv/dist/compile/resolve.js.map +1 -0
- package/dist/node_modules/ajv/dist/compile/rules.js +29 -0
- package/dist/node_modules/ajv/dist/compile/rules.js.map +1 -0
- package/dist/node_modules/ajv/dist/compile/util.js +183 -0
- package/dist/node_modules/ajv/dist/compile/util.js.map +1 -0
- package/dist/node_modules/ajv/dist/compile/validate/applicability.js +30 -0
- package/dist/node_modules/ajv/dist/compile/validate/applicability.js.map +1 -0
- package/dist/node_modules/ajv/dist/compile/validate/boolSchema.js +64 -0
- package/dist/node_modules/ajv/dist/compile/validate/boolSchema.js.map +1 -0
- package/dist/node_modules/ajv/dist/compile/validate/dataType.js +213 -0
- package/dist/node_modules/ajv/dist/compile/validate/dataType.js.map +1 -0
- package/dist/node_modules/ajv/dist/compile/validate/defaults.js +49 -0
- package/dist/node_modules/ajv/dist/compile/validate/defaults.js.map +1 -0
- package/dist/node_modules/ajv/dist/compile/validate/index.js +544 -0
- package/dist/node_modules/ajv/dist/compile/validate/index.js.map +1 -0
- package/dist/node_modules/ajv/dist/compile/validate/keyword.js +139 -0
- package/dist/node_modules/ajv/dist/compile/validate/keyword.js.map +1 -0
- package/dist/node_modules/ajv/dist/compile/validate/subschema.js +95 -0
- package/dist/node_modules/ajv/dist/compile/validate/subschema.js.map +1 -0
- package/dist/node_modules/ajv/dist/core.js +639 -0
- package/dist/node_modules/ajv/dist/core.js.map +1 -0
- package/dist/node_modules/ajv/dist/refs/data.json.js +31 -0
- package/dist/node_modules/ajv/dist/refs/data.json.js.map +1 -0
- package/dist/node_modules/ajv/dist/refs/json-schema-draft-07.json.js +254 -0
- package/dist/node_modules/ajv/dist/refs/json-schema-draft-07.json.js.map +1 -0
- package/dist/node_modules/ajv/dist/runtime/equal.js +9 -0
- package/dist/node_modules/ajv/dist/runtime/equal.js.map +1 -0
- package/dist/node_modules/ajv/dist/runtime/ucs2length.js +25 -0
- package/dist/node_modules/ajv/dist/runtime/ucs2length.js.map +1 -0
- package/dist/node_modules/ajv/dist/runtime/uri.js +8 -0
- package/dist/node_modules/ajv/dist/runtime/uri.js.map +1 -0
- package/dist/node_modules/ajv/dist/runtime/validation_error.js +22 -0
- package/dist/node_modules/ajv/dist/runtime/validation_error.js.map +1 -0
- package/dist/node_modules/ajv/dist/vocabularies/applicator/additionalItems.js +53 -0
- package/dist/node_modules/ajv/dist/vocabularies/applicator/additionalItems.js.map +1 -0
- package/dist/node_modules/ajv/dist/vocabularies/applicator/additionalProperties.js +112 -0
- package/dist/node_modules/ajv/dist/vocabularies/applicator/additionalProperties.js.map +1 -0
- package/dist/node_modules/ajv/dist/vocabularies/applicator/allOf.js +26 -0
- package/dist/node_modules/ajv/dist/vocabularies/applicator/allOf.js.map +1 -0
- package/dist/node_modules/ajv/dist/vocabularies/applicator/anyOf.js +14 -0
- package/dist/node_modules/ajv/dist/vocabularies/applicator/anyOf.js.map +1 -0
- package/dist/node_modules/ajv/dist/vocabularies/applicator/contains.js +99 -0
- package/dist/node_modules/ajv/dist/vocabularies/applicator/contains.js.map +1 -0
- package/dist/node_modules/ajv/dist/vocabularies/applicator/dependencies.js +93 -0
- package/dist/node_modules/ajv/dist/vocabularies/applicator/dependencies.js.map +1 -0
- package/dist/node_modules/ajv/dist/vocabularies/applicator/if.js +70 -0
- package/dist/node_modules/ajv/dist/vocabularies/applicator/if.js.map +1 -0
- package/dist/node_modules/ajv/dist/vocabularies/applicator/index.js +77 -0
- package/dist/node_modules/ajv/dist/vocabularies/applicator/index.js.map +1 -0
- package/dist/node_modules/ajv/dist/vocabularies/applicator/items.js +57 -0
- package/dist/node_modules/ajv/dist/vocabularies/applicator/items.js.map +1 -0
- package/dist/node_modules/ajv/dist/vocabularies/applicator/items2020.js +37 -0
- package/dist/node_modules/ajv/dist/vocabularies/applicator/items2020.js.map +1 -0
- package/dist/node_modules/ajv/dist/vocabularies/applicator/not.js +29 -0
- package/dist/node_modules/ajv/dist/vocabularies/applicator/not.js.map +1 -0
- package/dist/node_modules/ajv/dist/vocabularies/applicator/oneOf.js +64 -0
- package/dist/node_modules/ajv/dist/vocabularies/applicator/oneOf.js.map +1 -0
- package/dist/node_modules/ajv/dist/vocabularies/applicator/patternProperties.js +80 -0
- package/dist/node_modules/ajv/dist/vocabularies/applicator/patternProperties.js.map +1 -0
- package/dist/node_modules/ajv/dist/vocabularies/applicator/prefixItems.js +15 -0
- package/dist/node_modules/ajv/dist/vocabularies/applicator/prefixItems.js.map +1 -0
- package/dist/node_modules/ajv/dist/vocabularies/applicator/properties.js +61 -0
- package/dist/node_modules/ajv/dist/vocabularies/applicator/properties.js.map +1 -0
- package/dist/node_modules/ajv/dist/vocabularies/applicator/propertyNames.js +42 -0
- package/dist/node_modules/ajv/dist/vocabularies/applicator/propertyNames.js.map +1 -0
- package/dist/node_modules/ajv/dist/vocabularies/applicator/thenElse.js +16 -0
- package/dist/node_modules/ajv/dist/vocabularies/applicator/thenElse.js.map +1 -0
- package/dist/node_modules/ajv/dist/vocabularies/code.js +146 -0
- package/dist/node_modules/ajv/dist/vocabularies/code.js.map +1 -0
- package/dist/node_modules/ajv/dist/vocabularies/core/id.js +11 -0
- package/dist/node_modules/ajv/dist/vocabularies/core/id.js.map +1 -0
- package/dist/node_modules/ajv/dist/vocabularies/core/index.js +21 -0
- package/dist/node_modules/ajv/dist/vocabularies/core/index.js.map +1 -0
- package/dist/node_modules/ajv/dist/vocabularies/core/ref.js +131 -0
- package/dist/node_modules/ajv/dist/vocabularies/core/ref.js.map +1 -0
- package/dist/node_modules/ajv/dist/vocabularies/discriminator/index.js +113 -0
- package/dist/node_modules/ajv/dist/vocabularies/discriminator/index.js.map +1 -0
- package/dist/node_modules/ajv/dist/vocabularies/discriminator/types.js +12 -0
- package/dist/node_modules/ajv/dist/vocabularies/discriminator/types.js.map +1 -0
- package/dist/node_modules/ajv/dist/vocabularies/draft7.js +28 -0
- package/dist/node_modules/ajv/dist/vocabularies/draft7.js.map +1 -0
- package/dist/node_modules/ajv/dist/vocabularies/format/format.js +94 -0
- package/dist/node_modules/ajv/dist/vocabularies/format/format.js.map +1 -0
- package/dist/node_modules/ajv/dist/vocabularies/format/index.js +9 -0
- package/dist/node_modules/ajv/dist/vocabularies/format/index.js.map +1 -0
- package/dist/node_modules/ajv/dist/vocabularies/metadata.js +21 -0
- package/dist/node_modules/ajv/dist/vocabularies/metadata.js.map +1 -0
- package/dist/node_modules/ajv/dist/vocabularies/validation/const.js +31 -0
- package/dist/node_modules/ajv/dist/vocabularies/validation/const.js.map +1 -0
- package/dist/node_modules/ajv/dist/vocabularies/validation/enum.js +54 -0
- package/dist/node_modules/ajv/dist/vocabularies/validation/enum.js.map +1 -0
- package/dist/node_modules/ajv/dist/vocabularies/validation/index.js +54 -0
- package/dist/node_modules/ajv/dist/vocabularies/validation/index.js.map +1 -0
- package/dist/node_modules/ajv/dist/vocabularies/validation/limitItems.js +26 -0
- package/dist/node_modules/ajv/dist/vocabularies/validation/limitItems.js.map +1 -0
- package/dist/node_modules/ajv/dist/vocabularies/validation/limitLength.js +33 -0
- package/dist/node_modules/ajv/dist/vocabularies/validation/limitLength.js.map +1 -0
- package/dist/node_modules/ajv/dist/vocabularies/validation/limitNumber.js +29 -0
- package/dist/node_modules/ajv/dist/vocabularies/validation/limitNumber.js.map +1 -0
- package/dist/node_modules/ajv/dist/vocabularies/validation/limitProperties.js +26 -0
- package/dist/node_modules/ajv/dist/vocabularies/validation/limitProperties.js.map +1 -0
- package/dist/node_modules/ajv/dist/vocabularies/validation/multipleOf.js +28 -0
- package/dist/node_modules/ajv/dist/vocabularies/validation/multipleOf.js.map +1 -0
- package/dist/node_modules/ajv/dist/vocabularies/validation/pattern.js +27 -0
- package/dist/node_modules/ajv/dist/vocabularies/validation/pattern.js.map +1 -0
- package/dist/node_modules/ajv/dist/vocabularies/validation/required.js +84 -0
- package/dist/node_modules/ajv/dist/vocabularies/validation/required.js.map +1 -0
- package/dist/node_modules/ajv/dist/vocabularies/validation/uniqueItems.js +72 -0
- package/dist/node_modules/ajv/dist/vocabularies/validation/uniqueItems.js.map +1 -0
- package/dist/node_modules/ajv-formats/dist/formats.js +212 -0
- package/dist/node_modules/ajv-formats/dist/formats.js.map +1 -0
- package/dist/node_modules/ajv-formats/dist/index.js +52 -0
- package/dist/node_modules/ajv-formats/dist/index.js.map +1 -0
- package/dist/node_modules/ajv-formats/dist/limit.js +75 -0
- package/dist/node_modules/ajv-formats/dist/limit.js.map +1 -0
- package/dist/node_modules/diff/libesm/diff/base.js +256 -0
- package/dist/node_modules/diff/libesm/diff/base.js.map +1 -0
- package/dist/node_modules/diff/libesm/diff/line.js +64 -0
- package/dist/node_modules/diff/libesm/diff/line.js.map +1 -0
- package/dist/node_modules/diff/libesm/patch/create.js +185 -0
- package/dist/node_modules/diff/libesm/patch/create.js.map +1 -0
- package/dist/node_modules/fast-deep-equal/index.js +47 -0
- package/dist/node_modules/fast-deep-equal/index.js.map +1 -0
- package/dist/node_modules/fast-uri/index.js +347 -0
- package/dist/node_modules/fast-uri/index.js.map +1 -0
- package/dist/node_modules/fast-uri/lib/schemes.js +255 -0
- package/dist/node_modules/fast-uri/lib/schemes.js.map +1 -0
- package/dist/node_modules/fast-uri/lib/utils.js +334 -0
- package/dist/node_modules/fast-uri/lib/utils.js.map +1 -0
- package/dist/node_modules/json-schema-traverse/index.js +98 -0
- package/dist/node_modules/json-schema-traverse/index.js.map +1 -0
- package/dist/node_modules/uuid/dist/rng.js +14 -0
- package/dist/node_modules/uuid/dist/rng.js.map +1 -0
- package/dist/node_modules/uuid/dist/stringify.js +29 -0
- package/dist/node_modules/uuid/dist/stringify.js.map +1 -0
- package/dist/node_modules/uuid/dist/v7.js +65 -0
- package/dist/node_modules/uuid/dist/v7.js.map +1 -0
- package/dist/node_modules/zod-to-json-schema/dist/esm/Options.js +37 -0
- package/dist/node_modules/zod-to-json-schema/dist/esm/Options.js.map +1 -0
- package/dist/node_modules/zod-to-json-schema/dist/esm/Refs.js +26 -0
- package/dist/node_modules/zod-to-json-schema/dist/esm/Refs.js.map +1 -0
- package/dist/node_modules/zod-to-json-schema/dist/esm/errorMessages.js +17 -0
- package/dist/node_modules/zod-to-json-schema/dist/esm/errorMessages.js.map +1 -0
- package/dist/node_modules/zod-to-json-schema/dist/esm/getRelativePath.js +11 -0
- package/dist/node_modules/zod-to-json-schema/dist/esm/getRelativePath.js.map +1 -0
- package/dist/node_modules/zod-to-json-schema/dist/esm/parseDef.js +66 -0
- package/dist/node_modules/zod-to-json-schema/dist/esm/parseDef.js.map +1 -0
- package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/any.js +21 -0
- package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/any.js.map +1 -0
- package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/array.js +30 -0
- package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/array.js.map +1 -0
- package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/bigint.js +53 -0
- package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/bigint.js.map +1 -0
- package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/boolean.js +8 -0
- package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/boolean.js.map +1 -0
- package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/branded.js +8 -0
- package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/branded.js.map +1 -0
- package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/catch.js +8 -0
- package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/catch.js.map +1 -0
- package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/date.js +50 -0
- package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/date.js.map +1 -0
- package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/default.js +11 -0
- package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/default.js.map +1 -0
- package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/effects.js +11 -0
- package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/effects.js.map +1 -0
- package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/enum.js +9 -0
- package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/enum.js.map +1 -0
- package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/intersection.js +56 -0
- package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/intersection.js.map +1 -0
- package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/literal.js +24 -0
- package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/literal.js.map +1 -0
- package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/map.js +30 -0
- package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/map.js.map +1 -0
- package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/nativeEnum.js +19 -0
- package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/nativeEnum.js.map +1 -0
- package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/never.js +15 -0
- package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/never.js.map +1 -0
- package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/null.js +13 -0
- package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/null.js.map +1 -0
- package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/nullable.js +37 -0
- package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/nullable.js.map +1 -0
- package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/number.js +56 -0
- package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/number.js.map +1 -0
- package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/object.js +76 -0
- package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/object.js.map +1 -0
- package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/optional.js +25 -0
- package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/optional.js.map +1 -0
- package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/pipeline.js +24 -0
- package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/pipeline.js.map +1 -0
- package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/promise.js +8 -0
- package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/promise.js.map +1 -0
- package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/readonly.js +8 -0
- package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/readonly.js.map +1 -0
- package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/record.js +65 -0
- package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/record.js.map +1 -0
- package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/set.js +24 -0
- package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/set.js.map +1 -0
- package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/string.js +350 -0
- package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/string.js.map +1 -0
- package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/tuple.js +36 -0
- package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/tuple.js.map +1 -0
- package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/undefined.js +10 -0
- package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/undefined.js.map +1 -0
- package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/union.js +84 -0
- package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/union.js.map +1 -0
- package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/unknown.js +8 -0
- package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/unknown.js.map +1 -0
- package/dist/node_modules/zod-to-json-schema/dist/esm/selectParser.js +109 -0
- package/dist/node_modules/zod-to-json-schema/dist/esm/selectParser.js.map +1 -0
- package/dist/node_modules/zod-to-json-schema/dist/esm/zodToJsonSchema.js +90 -0
- package/dist/node_modules/zod-to-json-schema/dist/esm/zodToJsonSchema.js.map +1 -0
- package/dist/node_modules/zod-to-json-schema/node_modules/zod/v3/types.js +42 -0
- package/dist/node_modules/zod-to-json-schema/node_modules/zod/v3/types.js.map +1 -0
- package/dist/package.json.js +8 -0
- package/dist/package.json.js.map +1 -0
- package/dist/src/acp-extensions.d.ts +91 -0
- package/dist/src/acp-extensions.d.ts.map +1 -0
- package/dist/src/acp-extensions.js +38 -0
- package/dist/src/acp-extensions.js.map +1 -0
- package/dist/src/adapters/claude/claude.d.ts +136 -0
- package/dist/src/adapters/claude/claude.d.ts.map +1 -0
- package/dist/src/adapters/claude/claude.js +1112 -0
- package/dist/src/adapters/claude/claude.js.map +1 -0
- package/dist/src/adapters/claude/mcp-server.d.ts +30 -0
- package/dist/src/adapters/claude/mcp-server.d.ts.map +1 -0
- package/dist/src/adapters/claude/mcp-server.js +655 -0
- package/dist/src/adapters/claude/mcp-server.js.map +1 -0
- package/dist/src/adapters/claude/tools.d.ts +35 -0
- package/dist/src/adapters/claude/tools.d.ts.map +1 -0
- package/dist/src/adapters/claude/tools.js +466 -0
- package/dist/src/adapters/claude/tools.js.map +1 -0
- package/dist/src/adapters/claude/utils.d.ts +48 -0
- package/dist/src/adapters/claude/utils.d.ts.map +1 -0
- package/dist/src/adapters/claude/utils.js +158 -0
- package/dist/src/adapters/claude/utils.js.map +1 -0
- package/dist/src/agent.d.ts +18 -28
- package/dist/src/agent.d.ts.map +1 -1
- package/dist/src/agent.js +195 -175
- package/dist/src/agent.js.map +1 -1
- package/dist/src/agents/execution.js.map +1 -1
- package/dist/src/agents/planning.js.map +1 -1
- package/dist/src/agents/research.js.map +1 -1
- package/dist/src/file-manager.d.ts +6 -6
- package/dist/src/file-manager.d.ts.map +1 -1
- package/dist/src/file-manager.js +72 -63
- package/dist/src/file-manager.js.map +1 -1
- package/dist/src/git-manager.d.ts +2 -1
- package/dist/src/git-manager.d.ts.map +1 -1
- package/dist/src/git-manager.js +105 -70
- package/dist/src/git-manager.js.map +1 -1
- package/dist/src/posthog-api.d.ts +8 -14
- package/dist/src/posthog-api.d.ts.map +1 -1
- package/dist/src/posthog-api.js +35 -23
- package/dist/src/posthog-api.js.map +1 -1
- package/dist/src/prompt-builder.d.ts +4 -4
- package/dist/src/prompt-builder.d.ts.map +1 -1
- package/dist/src/prompt-builder.js +129 -99
- package/dist/src/prompt-builder.js.map +1 -1
- package/dist/src/schemas.d.ts +980 -0
- package/dist/src/schemas.d.ts.map +1 -0
- package/dist/src/schemas.js +196 -0
- package/dist/src/schemas.js.map +1 -0
- package/dist/src/session-store.d.ts +53 -0
- package/dist/src/session-store.d.ts.map +1 -0
- package/dist/src/session-store.js +195 -0
- package/dist/src/session-store.js.map +1 -0
- package/dist/src/task-manager.d.ts +7 -7
- package/dist/src/task-manager.d.ts.map +1 -1
- package/dist/src/task-manager.js +19 -18
- package/dist/src/task-manager.js.map +1 -1
- package/dist/src/template-manager.d.ts +1 -1
- package/dist/src/template-manager.d.ts.map +1 -1
- package/dist/src/template-manager.js +30 -28
- package/dist/src/template-manager.js.map +1 -1
- package/dist/src/todo-manager.d.ts +5 -5
- package/dist/src/todo-manager.d.ts.map +1 -1
- package/dist/src/todo-manager.js +33 -24
- package/dist/src/todo-manager.js.map +1 -1
- package/dist/src/tools/registry.d.ts +1 -1
- package/dist/src/tools/registry.js +60 -60
- package/dist/src/tools/registry.js.map +1 -1
- package/dist/src/tools/types.d.ts +31 -31
- package/dist/src/types.d.ts +62 -167
- package/dist/src/types.d.ts.map +1 -1
- package/dist/src/types.js +1 -0
- package/dist/src/types.js.map +1 -1
- package/dist/src/utils/logger.d.ts +14 -6
- package/dist/src/utils/logger.d.ts.map +1 -1
- package/dist/src/utils/logger.js +37 -22
- package/dist/src/utils/logger.js.map +1 -1
- package/dist/src/utils/tapped-stream.d.ts +17 -0
- package/dist/src/utils/tapped-stream.d.ts.map +1 -0
- package/dist/src/utils/tapped-stream.js +45 -0
- package/dist/src/utils/tapped-stream.js.map +1 -0
- package/dist/src/workflow/config.d.ts +1 -1
- package/dist/src/workflow/config.d.ts.map +1 -1
- package/dist/src/workflow/config.js +18 -18
- package/dist/src/workflow/config.js.map +1 -1
- package/dist/src/workflow/steps/build.d.ts +1 -1
- package/dist/src/workflow/steps/build.d.ts.map +1 -1
- package/dist/src/workflow/steps/build.js +53 -39
- package/dist/src/workflow/steps/build.js.map +1 -1
- package/dist/src/workflow/steps/finalize.d.ts +1 -1
- package/dist/src/workflow/steps/finalize.d.ts.map +1 -1
- package/dist/src/workflow/steps/finalize.js +58 -52
- package/dist/src/workflow/steps/finalize.js.map +1 -1
- package/dist/src/workflow/steps/plan.d.ts +1 -1
- package/dist/src/workflow/steps/plan.d.ts.map +1 -1
- package/dist/src/workflow/steps/plan.js +69 -47
- package/dist/src/workflow/steps/plan.js.map +1 -1
- package/dist/src/workflow/steps/research.d.ts +1 -1
- package/dist/src/workflow/steps/research.d.ts.map +1 -1
- package/dist/src/workflow/steps/research.js +86 -67
- package/dist/src/workflow/steps/research.js.map +1 -1
- package/dist/src/workflow/types.d.ts +19 -14
- package/dist/src/workflow/types.d.ts.map +1 -1
- package/dist/src/workflow/utils.d.ts +1 -1
- package/dist/src/workflow/utils.d.ts.map +1 -1
- package/dist/src/workflow/utils.js +7 -4
- package/dist/src/workflow/utils.js.map +1 -1
- package/dist/src/worktree-manager.d.ts +39 -0
- package/dist/src/worktree-manager.d.ts.map +1 -0
- package/dist/src/worktree-manager.js +810 -0
- package/dist/src/worktree-manager.js.map +1 -0
- package/package.json +20 -16
- package/src/acp-extensions.ts +117 -0
- package/src/adapters/claude/claude.ts +1498 -0
- package/src/adapters/claude/mcp-server.ts +810 -0
- package/src/adapters/claude/tools.ts +609 -0
- package/src/adapters/claude/utils.ts +267 -0
- package/src/agent.ts +511 -447
- package/src/agents/execution.ts +1 -1
- package/src/agents/planning.ts +1 -1
- package/src/agents/research.ts +0 -1
- package/src/file-manager.ts +80 -70
- package/src/git-manager.ts +164 -88
- package/src/posthog-api.ts +155 -94
- package/src/prompt-builder.ts +196 -143
- package/src/schemas.ts +241 -0
- package/src/session-store.ts +244 -0
- package/src/task-manager.ts +41 -33
- package/src/template-manager.ts +98 -45
- package/src/todo-manager.ts +43 -32
- package/src/tools/registry.ts +62 -62
- package/src/tools/types.ts +36 -36
- package/src/types.ts +130 -239
- package/src/utils/logger.ts +89 -58
- package/src/utils/tapped-stream.ts +60 -0
- package/src/workflow/config.ts +48 -48
- package/src/workflow/steps/build.ts +127 -113
- package/src/workflow/steps/finalize.ts +207 -182
- package/src/workflow/steps/plan.ts +155 -130
- package/src/workflow/steps/research.ts +207 -187
- package/src/workflow/types.ts +47 -36
- package/src/workflow/utils.ts +37 -34
- package/src/worktree-manager.ts +884 -0
- package/dist/src/adapters/claude/claude-adapter.d.ts +0 -18
- package/dist/src/adapters/claude/claude-adapter.d.ts.map +0 -1
- package/dist/src/adapters/claude/claude-adapter.js +0 -311
- package/dist/src/adapters/claude/claude-adapter.js.map +0 -1
- package/dist/src/adapters/claude/tool-mapper.d.ts +0 -19
- package/dist/src/adapters/claude/tool-mapper.d.ts.map +0 -1
- package/dist/src/adapters/claude/tool-mapper.js +0 -44
- package/dist/src/adapters/claude/tool-mapper.js.map +0 -1
- package/dist/src/adapters/types.d.ts +0 -33
- package/dist/src/adapters/types.d.ts.map +0 -1
- package/dist/src/task-progress-reporter.d.ts +0 -43
- package/dist/src/task-progress-reporter.d.ts.map +0 -1
- package/dist/src/task-progress-reporter.js +0 -393
- package/dist/src/task-progress-reporter.js.map +0 -1
- package/src/adapters/claude/claude-adapter.ts +0 -338
- package/src/adapters/claude/tool-mapper.ts +0 -46
- package/src/adapters/types.ts +0 -37
- package/src/task-progress-reporter.ts +0 -443
package/dist/src/agent.js
CHANGED
|
@@ -1,82 +1,85 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { PostHogAPIClient } from './posthog-api.js';
|
|
1
|
+
import { POSTHOG_NOTIFICATIONS } from './acp-extensions.js';
|
|
2
|
+
import { createAcpConnection } from './adapters/claude/claude.js';
|
|
4
3
|
import { PostHogFileManager } from './file-manager.js';
|
|
5
4
|
import { GitManager } from './git-manager.js';
|
|
5
|
+
import { PostHogAPIClient } from './posthog-api.js';
|
|
6
|
+
import { PromptBuilder } from './prompt-builder.js';
|
|
7
|
+
import { SessionStore } from './session-store.js';
|
|
8
|
+
import { TaskManager } from './task-manager.js';
|
|
6
9
|
import { TemplateManager } from './template-manager.js';
|
|
7
|
-
import { ClaudeAdapter } from './adapters/claude/claude-adapter.js';
|
|
8
10
|
import { Logger } from './utils/logger.js';
|
|
9
|
-
import { PromptBuilder } from './prompt-builder.js';
|
|
10
|
-
import { TaskProgressReporter } from './task-progress-reporter.js';
|
|
11
11
|
import { TASK_WORKFLOW } from './workflow/config.js';
|
|
12
12
|
export { PermissionMode } from './types.js';
|
|
13
13
|
|
|
14
14
|
class Agent {
|
|
15
15
|
workingDirectory;
|
|
16
|
-
onEvent;
|
|
17
16
|
taskManager;
|
|
18
17
|
posthogAPI;
|
|
19
18
|
fileManager;
|
|
20
19
|
gitManager;
|
|
21
20
|
templateManager;
|
|
22
|
-
adapter;
|
|
23
21
|
logger;
|
|
24
|
-
|
|
22
|
+
acpConnection;
|
|
25
23
|
promptBuilder;
|
|
26
24
|
mcpServers;
|
|
27
25
|
canUseTool;
|
|
26
|
+
currentRunId;
|
|
27
|
+
sessionStore;
|
|
28
28
|
debug;
|
|
29
29
|
constructor(config) {
|
|
30
30
|
this.workingDirectory = config.workingDirectory || process.cwd();
|
|
31
|
-
this.onEvent = config.onEvent;
|
|
32
31
|
this.canUseTool = config.canUseTool;
|
|
33
32
|
this.debug = config.debug || false;
|
|
34
33
|
// Build default PostHog MCP server configuration
|
|
35
|
-
const posthogMcpUrl = config.posthogMcpUrl
|
|
36
|
-
|
|
37
|
-
|
|
34
|
+
const posthogMcpUrl = config.posthogMcpUrl ||
|
|
35
|
+
process.env.POSTHOG_MCP_URL ||
|
|
36
|
+
"https://mcp.posthog.com/mcp";
|
|
38
37
|
// Add auth if API key provided
|
|
39
38
|
const headers = {};
|
|
40
39
|
if (config.posthogApiKey) {
|
|
41
|
-
headers
|
|
40
|
+
headers.Authorization = `Bearer ${config.posthogApiKey}`;
|
|
42
41
|
}
|
|
43
42
|
const defaultMcpServers = {
|
|
44
43
|
posthog: {
|
|
45
|
-
type:
|
|
44
|
+
type: "http",
|
|
46
45
|
url: posthogMcpUrl,
|
|
47
46
|
...(Object.keys(headers).length > 0 ? { headers } : {}),
|
|
48
|
-
}
|
|
47
|
+
},
|
|
49
48
|
};
|
|
50
49
|
// Merge default PostHog MCP with user-provided servers (user config takes precedence)
|
|
51
50
|
this.mcpServers = {
|
|
52
51
|
...defaultMcpServers,
|
|
53
|
-
...config.mcpServers
|
|
52
|
+
...config.mcpServers,
|
|
54
53
|
};
|
|
55
|
-
this.logger = new Logger({
|
|
54
|
+
this.logger = new Logger({
|
|
55
|
+
debug: this.debug,
|
|
56
|
+
prefix: "[PostHog Agent]",
|
|
57
|
+
onLog: config.onLog,
|
|
58
|
+
});
|
|
56
59
|
this.taskManager = new TaskManager();
|
|
57
|
-
|
|
58
|
-
this.adapter = new ClaudeAdapter();
|
|
59
|
-
this.fileManager = new PostHogFileManager(this.workingDirectory, this.logger.child('FileManager'));
|
|
60
|
+
this.fileManager = new PostHogFileManager(this.workingDirectory, this.logger.child("FileManager"));
|
|
60
61
|
this.gitManager = new GitManager({
|
|
61
62
|
repositoryPath: this.workingDirectory,
|
|
62
|
-
logger: this.logger.child(
|
|
63
|
-
// TODO: Add author config from environment or config
|
|
63
|
+
logger: this.logger.child("GitManager"),
|
|
64
64
|
});
|
|
65
65
|
this.templateManager = new TemplateManager();
|
|
66
|
-
if (config.posthogApiUrl &&
|
|
66
|
+
if (config.posthogApiUrl &&
|
|
67
|
+
config.posthogApiKey &&
|
|
68
|
+
config.posthogProjectId) {
|
|
67
69
|
this.posthogAPI = new PostHogAPIClient({
|
|
68
70
|
apiUrl: config.posthogApiUrl,
|
|
69
71
|
apiKey: config.posthogApiKey,
|
|
70
72
|
projectId: config.posthogProjectId,
|
|
71
73
|
});
|
|
74
|
+
// Create SessionStore from the API client for ACP connection
|
|
75
|
+
this.sessionStore = new SessionStore(this.posthogAPI, this.logger.child("SessionStore"));
|
|
72
76
|
}
|
|
73
77
|
this.promptBuilder = new PromptBuilder({
|
|
74
78
|
getTaskFiles: (taskId) => this.getTaskFiles(taskId),
|
|
75
79
|
generatePlanTemplate: (vars) => this.templateManager.generatePlan(vars),
|
|
76
80
|
posthogClient: this.posthogAPI,
|
|
77
|
-
logger: this.logger.child(
|
|
81
|
+
logger: this.logger.child("PromptBuilder"),
|
|
78
82
|
});
|
|
79
|
-
this.progressReporter = new TaskProgressReporter(this.posthogAPI, this.logger);
|
|
80
83
|
}
|
|
81
84
|
/**
|
|
82
85
|
* Enable or disable debug logging
|
|
@@ -98,30 +101,52 @@ class Agent {
|
|
|
98
101
|
process.env.ANTHROPIC_BASE_URL = gatewayUrl;
|
|
99
102
|
process.env.ANTHROPIC_AUTH_TOKEN = apiKey;
|
|
100
103
|
this.ensureOpenAIGatewayEnv(gatewayUrl, apiKey);
|
|
101
|
-
this.logger.debug('Configured LLM gateway', { gatewayUrl });
|
|
102
104
|
}
|
|
103
105
|
catch (error) {
|
|
104
|
-
this.logger.error(
|
|
106
|
+
this.logger.error("Failed to configure LLM gateway", error);
|
|
105
107
|
throw error;
|
|
106
108
|
}
|
|
107
109
|
}
|
|
110
|
+
getOrCreateConnection() {
|
|
111
|
+
if (!this.acpConnection) {
|
|
112
|
+
this.acpConnection = createAcpConnection({
|
|
113
|
+
sessionStore: this.sessionStore,
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
return this.acpConnection;
|
|
117
|
+
}
|
|
108
118
|
// Adaptive task execution orchestrated via workflow steps
|
|
109
|
-
async runTask(
|
|
110
|
-
await this._configureLlmGateway();
|
|
111
|
-
const task =
|
|
119
|
+
async runTask(taskId, taskRunId, options = {}) {
|
|
120
|
+
// await this._configureLlmGateway();
|
|
121
|
+
const task = await this.fetchTask(taskId);
|
|
112
122
|
const cwd = options.repositoryPath || this.workingDirectory;
|
|
113
123
|
const isCloudMode = options.isCloudMode ?? false;
|
|
114
124
|
const taskSlug = task.slug || task.id;
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
125
|
+
// Use taskRunId as sessionId - they are the same identifier
|
|
126
|
+
this.currentRunId = taskRunId;
|
|
127
|
+
this.logger.info("Starting adaptive task execution", {
|
|
128
|
+
taskId: task.id,
|
|
129
|
+
taskSlug,
|
|
130
|
+
taskRunId,
|
|
131
|
+
isCloudMode,
|
|
132
|
+
});
|
|
133
|
+
const connection = this.getOrCreateConnection();
|
|
134
|
+
// Create sendNotification using ACP connection's extNotification
|
|
135
|
+
const sendNotification = async (method, params) => {
|
|
136
|
+
this.logger.debug(`Notification: ${method}`, params);
|
|
137
|
+
await connection.agentConnection.extNotification?.(method, params);
|
|
138
|
+
};
|
|
139
|
+
await sendNotification(POSTHOG_NOTIFICATIONS.RUN_STARTED, {
|
|
140
|
+
sessionId: taskRunId,
|
|
141
|
+
runId: taskRunId,
|
|
142
|
+
});
|
|
143
|
+
await this.prepareTaskBranch(taskSlug, isCloudMode, sendNotification);
|
|
120
144
|
let taskError;
|
|
121
145
|
try {
|
|
122
146
|
const workflowContext = {
|
|
123
147
|
task,
|
|
124
148
|
taskSlug,
|
|
149
|
+
runId: taskRunId,
|
|
125
150
|
cwd,
|
|
126
151
|
isCloudMode,
|
|
127
152
|
options,
|
|
@@ -129,11 +154,11 @@ class Agent {
|
|
|
129
154
|
fileManager: this.fileManager,
|
|
130
155
|
gitManager: this.gitManager,
|
|
131
156
|
promptBuilder: this.promptBuilder,
|
|
132
|
-
|
|
133
|
-
|
|
157
|
+
connection: connection.agentConnection,
|
|
158
|
+
sessionId: taskRunId,
|
|
159
|
+
sendNotification,
|
|
134
160
|
mcpServers: this.mcpServers,
|
|
135
161
|
posthogAPI: this.posthogAPI,
|
|
136
|
-
emitEvent: (event) => this.emitEvent(event),
|
|
137
162
|
stepResults: {},
|
|
138
163
|
};
|
|
139
164
|
for (const step of TASK_WORKFLOW) {
|
|
@@ -144,63 +169,78 @@ class Agent {
|
|
|
144
169
|
}
|
|
145
170
|
const shouldCreatePR = options.createPR ?? isCloudMode;
|
|
146
171
|
if (shouldCreatePR) {
|
|
147
|
-
await this.ensurePullRequest(task, workflowContext.stepResults);
|
|
172
|
+
await this.ensurePullRequest(task, workflowContext.stepResults, sendNotification);
|
|
148
173
|
}
|
|
149
|
-
this.logger.info(
|
|
150
|
-
|
|
174
|
+
this.logger.info("Task execution complete", { taskId: task.id });
|
|
175
|
+
await sendNotification(POSTHOG_NOTIFICATIONS.TASK_COMPLETE, {
|
|
176
|
+
sessionId: taskRunId,
|
|
177
|
+
taskId: task.id,
|
|
178
|
+
});
|
|
151
179
|
}
|
|
152
180
|
catch (error) {
|
|
153
181
|
taskError = error instanceof Error ? error : new Error(String(error));
|
|
154
|
-
this.logger.error(
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
}
|
|
182
|
+
this.logger.error("Task execution failed", {
|
|
183
|
+
taskId: task.id,
|
|
184
|
+
error: taskError.message,
|
|
185
|
+
});
|
|
186
|
+
await sendNotification(POSTHOG_NOTIFICATIONS.ERROR, {
|
|
187
|
+
sessionId: taskRunId,
|
|
188
|
+
message: taskError.message,
|
|
189
|
+
});
|
|
190
|
+
throw taskError;
|
|
164
191
|
}
|
|
165
192
|
}
|
|
166
|
-
|
|
167
|
-
|
|
193
|
+
/**
|
|
194
|
+
* Creates an in-process ACP connection for client communication.
|
|
195
|
+
* Sets up git branch for the task, configures LLM gateway.
|
|
196
|
+
* The client handles all prompting/querying via the returned streams.
|
|
197
|
+
*
|
|
198
|
+
* @returns InProcessAcpConnection with clientStreams for the client to use
|
|
199
|
+
*/
|
|
200
|
+
async runTaskV2(taskId, taskRunId, options = {}) {
|
|
168
201
|
await this._configureLlmGateway();
|
|
169
|
-
const
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
202
|
+
const task = await this.fetchTask(taskId);
|
|
203
|
+
const taskSlug = task.slug || task.id;
|
|
204
|
+
const isCloudMode = options.isCloudMode ?? false;
|
|
205
|
+
options.repositoryPath || this.workingDirectory;
|
|
206
|
+
// Use taskRunId as sessionId - they are the same identifier
|
|
207
|
+
this.currentRunId = taskRunId;
|
|
208
|
+
this.acpConnection = createAcpConnection({
|
|
209
|
+
sessionStore: this.sessionStore,
|
|
210
|
+
sessionId: taskRunId,
|
|
211
|
+
taskId: task.id,
|
|
212
|
+
});
|
|
213
|
+
const sendNotification = async (method, params) => {
|
|
214
|
+
this.logger.debug(`Notification: ${method}`, params);
|
|
215
|
+
await this.acpConnection?.agentConnection.extNotification?.(method, params);
|
|
175
216
|
};
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
baseOptions.canUseTool = canUseTool;
|
|
180
|
-
}
|
|
181
|
-
const response = query({
|
|
182
|
-
prompt,
|
|
183
|
-
options: { ...baseOptions, ...(options.queryOverrides || {}) },
|
|
217
|
+
await sendNotification(POSTHOG_NOTIFICATIONS.RUN_STARTED, {
|
|
218
|
+
sessionId: taskRunId,
|
|
219
|
+
runId: taskRunId,
|
|
184
220
|
});
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
221
|
+
if (!options.skipGitBranch) {
|
|
222
|
+
try {
|
|
223
|
+
await this.prepareTaskBranch(taskSlug, isCloudMode, sendNotification);
|
|
224
|
+
}
|
|
225
|
+
catch (error) {
|
|
226
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
227
|
+
this.logger.error("Failed to prepare task branch", {
|
|
228
|
+
error: errorMessage,
|
|
229
|
+
});
|
|
230
|
+
await sendNotification(POSTHOG_NOTIFICATIONS.ERROR, {
|
|
231
|
+
sessionId: taskRunId,
|
|
232
|
+
message: errorMessage,
|
|
233
|
+
});
|
|
234
|
+
throw error;
|
|
193
235
|
}
|
|
194
|
-
results.push(message);
|
|
195
236
|
}
|
|
196
|
-
return
|
|
237
|
+
return this.acpConnection;
|
|
197
238
|
}
|
|
198
239
|
// PostHog task operations
|
|
199
240
|
async fetchTask(taskId) {
|
|
200
|
-
this.logger.debug('Fetching task from PostHog', { taskId });
|
|
201
241
|
if (!this.posthogAPI) {
|
|
202
|
-
const error = new Error(
|
|
203
|
-
this.logger.error(
|
|
242
|
+
const error = new Error("PostHog API not configured. Provide posthogApiUrl and posthogApiKey in constructor.");
|
|
243
|
+
this.logger.error("PostHog API not configured", error);
|
|
204
244
|
throw error;
|
|
205
245
|
}
|
|
206
246
|
return this.posthogAPI.fetchTask(taskId);
|
|
@@ -208,62 +248,18 @@ class Agent {
|
|
|
208
248
|
getPostHogClient() {
|
|
209
249
|
return this.posthogAPI;
|
|
210
250
|
}
|
|
211
|
-
async listTasks(filters) {
|
|
212
|
-
if (!this.posthogAPI) {
|
|
213
|
-
throw new Error('PostHog API not configured. Provide posthogApiUrl and posthogApiKey in constructor.');
|
|
214
|
-
}
|
|
215
|
-
return this.posthogAPI.listTasks(filters);
|
|
216
|
-
}
|
|
217
|
-
// File system operations for task artifacts
|
|
218
|
-
async writeTaskFile(taskId, fileName, content, type = 'reference') {
|
|
219
|
-
this.logger.debug('Writing task file', { taskId, fileName, type, contentLength: content.length });
|
|
220
|
-
await this.fileManager.writeTaskFile(taskId, { name: fileName, content, type });
|
|
221
|
-
}
|
|
222
|
-
async readTaskFile(taskId, fileName) {
|
|
223
|
-
this.logger.debug('Reading task file', { taskId, fileName });
|
|
224
|
-
return await this.fileManager.readTaskFile(taskId, fileName);
|
|
225
|
-
}
|
|
226
251
|
async getTaskFiles(taskId) {
|
|
227
|
-
this.logger.debug(
|
|
252
|
+
this.logger.debug("Getting task files", { taskId });
|
|
228
253
|
const files = await this.fileManager.getTaskFiles(taskId);
|
|
229
|
-
this.logger.debug(
|
|
254
|
+
this.logger.debug("Found task files", { taskId, fileCount: files.length });
|
|
230
255
|
return files;
|
|
231
256
|
}
|
|
232
|
-
async writePlan(taskId, plan) {
|
|
233
|
-
this.logger.info('Writing plan', { taskId, planLength: plan.length });
|
|
234
|
-
await this.fileManager.writePlan(taskId, plan);
|
|
235
|
-
}
|
|
236
|
-
async readPlan(taskId) {
|
|
237
|
-
this.logger.debug('Reading plan', { taskId });
|
|
238
|
-
return await this.fileManager.readPlan(taskId);
|
|
239
|
-
}
|
|
240
|
-
// Git operations for task execution
|
|
241
|
-
async createPlanningBranch(taskId) {
|
|
242
|
-
this.logger.info('Creating planning branch', { taskId });
|
|
243
|
-
const branchName = await this.gitManager.createTaskPlanningBranch(taskId);
|
|
244
|
-
this.logger.debug('Planning branch created', { taskId, branchName });
|
|
245
|
-
return branchName;
|
|
246
|
-
}
|
|
247
|
-
async commitPlan(taskId, taskTitle) {
|
|
248
|
-
this.logger.info('Committing plan', { taskId, taskTitle });
|
|
249
|
-
const commitHash = await this.gitManager.commitPlan(taskId, taskTitle);
|
|
250
|
-
this.logger.debug('Plan committed', { taskId, commitHash });
|
|
251
|
-
return commitHash;
|
|
252
|
-
}
|
|
253
|
-
async createImplementationBranch(taskId, planningBranchName) {
|
|
254
|
-
this.logger.info('Creating implementation branch', { taskId, fromBranch: planningBranchName });
|
|
255
|
-
const branchName = await this.gitManager.createTaskImplementationBranch(taskId, planningBranchName);
|
|
256
|
-
this.logger.debug('Implementation branch created', { taskId, branchName });
|
|
257
|
-
return branchName;
|
|
258
|
-
}
|
|
259
|
-
async commitImplementation(taskId, taskTitle, planSummary) {
|
|
260
|
-
this.logger.info('Committing implementation', { taskId, taskTitle });
|
|
261
|
-
const commitHash = await this.gitManager.commitImplementation(taskId, taskTitle, planSummary);
|
|
262
|
-
this.logger.debug('Implementation committed', { taskId, commitHash });
|
|
263
|
-
return commitHash;
|
|
264
|
-
}
|
|
265
257
|
async createPullRequest(taskId, branchName, taskTitle, taskDescription, customBody) {
|
|
266
|
-
this.logger.info(
|
|
258
|
+
this.logger.info("Creating pull request", {
|
|
259
|
+
taskId,
|
|
260
|
+
branchName,
|
|
261
|
+
taskTitle,
|
|
262
|
+
});
|
|
267
263
|
const defaultBody = `## Task Details
|
|
268
264
|
**Task ID**: ${taskId}
|
|
269
265
|
**Description**: ${taskDescription}
|
|
@@ -274,40 +270,50 @@ This PR implements the changes described in the task.
|
|
|
274
270
|
Generated by PostHog Agent`;
|
|
275
271
|
const prBody = customBody || defaultBody;
|
|
276
272
|
const prUrl = await this.gitManager.createPullRequest(branchName, taskTitle, prBody);
|
|
277
|
-
this.logger.info(
|
|
273
|
+
this.logger.info("Pull request created", { taskId, prUrl });
|
|
278
274
|
return prUrl;
|
|
279
275
|
}
|
|
280
276
|
async attachPullRequestToTask(taskId, prUrl, branchName) {
|
|
281
|
-
this.logger.info(
|
|
282
|
-
if (!this.posthogAPI || !this.
|
|
283
|
-
const error = new Error(
|
|
284
|
-
this.logger.error(
|
|
277
|
+
this.logger.info("Attaching PR to task run", { taskId, prUrl, branchName });
|
|
278
|
+
if (!this.posthogAPI || !this.currentRunId) {
|
|
279
|
+
const error = new Error("PostHog API not configured or no active run. Cannot attach PR to task.");
|
|
280
|
+
this.logger.error("PostHog API not configured", error);
|
|
285
281
|
throw error;
|
|
286
282
|
}
|
|
287
283
|
const updates = {
|
|
288
|
-
output: { pr_url: prUrl }
|
|
284
|
+
output: { pr_url: prUrl },
|
|
289
285
|
};
|
|
290
286
|
if (branchName) {
|
|
291
287
|
updates.branch = branchName;
|
|
292
288
|
}
|
|
293
|
-
await this.posthogAPI.updateTaskRun(taskId, this.
|
|
294
|
-
this.logger.debug(
|
|
289
|
+
await this.posthogAPI.updateTaskRun(taskId, this.currentRunId, updates);
|
|
290
|
+
this.logger.debug("PR attached to task run", {
|
|
291
|
+
taskId,
|
|
292
|
+
runId: this.currentRunId,
|
|
293
|
+
prUrl,
|
|
294
|
+
});
|
|
295
295
|
}
|
|
296
296
|
async updateTaskBranch(taskId, branchName) {
|
|
297
|
-
this.logger.info(
|
|
298
|
-
if (!this.posthogAPI || !this.
|
|
299
|
-
const error = new Error(
|
|
300
|
-
this.logger.error(
|
|
297
|
+
this.logger.info("Updating task run branch", { taskId, branchName });
|
|
298
|
+
if (!this.posthogAPI || !this.currentRunId) {
|
|
299
|
+
const error = new Error("PostHog API not configured or no active run. Cannot update branch.");
|
|
300
|
+
this.logger.error("PostHog API not configured", error);
|
|
301
301
|
throw error;
|
|
302
302
|
}
|
|
303
|
-
await this.posthogAPI.updateTaskRun(taskId, this.
|
|
304
|
-
|
|
303
|
+
await this.posthogAPI.updateTaskRun(taskId, this.currentRunId, {
|
|
304
|
+
branch: branchName,
|
|
305
|
+
});
|
|
306
|
+
this.logger.debug("Task run branch updated", {
|
|
307
|
+
taskId,
|
|
308
|
+
runId: this.currentRunId,
|
|
309
|
+
branchName,
|
|
310
|
+
});
|
|
305
311
|
}
|
|
306
312
|
// Execution management
|
|
307
313
|
cancelTask(taskId) {
|
|
308
314
|
// Find the execution for this task and cancel it
|
|
309
|
-
for (const [executionId, execution] of this.taskManager
|
|
310
|
-
if (execution.taskId === taskId && execution.status ===
|
|
315
|
+
for (const [executionId, execution] of this.taskManager.executionStates) {
|
|
316
|
+
if (execution.taskId === taskId && execution.status === "running") {
|
|
311
317
|
this.taskManager.cancelExecution(executionId);
|
|
312
318
|
break;
|
|
313
319
|
}
|
|
@@ -315,26 +321,43 @@ Generated by PostHog Agent`;
|
|
|
315
321
|
}
|
|
316
322
|
getTaskExecutionStatus(taskId) {
|
|
317
323
|
// Find the execution for this task
|
|
318
|
-
for (const execution of this.taskManager
|
|
324
|
+
for (const execution of this.taskManager.executionStates.values()) {
|
|
319
325
|
if (execution.taskId === taskId) {
|
|
320
326
|
return execution.status;
|
|
321
327
|
}
|
|
322
328
|
}
|
|
323
329
|
return null;
|
|
324
330
|
}
|
|
325
|
-
async prepareTaskBranch(taskSlug, isCloudMode) {
|
|
331
|
+
async prepareTaskBranch(taskSlug, isCloudMode, sendNotification) {
|
|
326
332
|
if (await this.gitManager.hasChanges()) {
|
|
327
|
-
throw new Error(
|
|
333
|
+
throw new Error("Cannot start task with uncommitted changes. Please commit or stash your changes first.");
|
|
334
|
+
}
|
|
335
|
+
// If we're running in a worktree, we're already on the correct branch
|
|
336
|
+
// (the worktree was created with its own branch). Skip branch creation.
|
|
337
|
+
const isWorktree = await this.gitManager.isWorktree();
|
|
338
|
+
if (isWorktree) {
|
|
339
|
+
const currentBranch = await this.gitManager.getCurrentBranch();
|
|
340
|
+
this.logger.info("Running in worktree, using existing branch", {
|
|
341
|
+
branch: currentBranch,
|
|
342
|
+
});
|
|
343
|
+
await sendNotification(POSTHOG_NOTIFICATIONS.BRANCH_CREATED, {
|
|
344
|
+
branch: currentBranch,
|
|
345
|
+
});
|
|
346
|
+
return;
|
|
328
347
|
}
|
|
329
348
|
await this.gitManager.resetToDefaultBranchIfNeeded();
|
|
330
349
|
const existingBranch = await this.gitManager.getTaskBranch(taskSlug);
|
|
331
350
|
if (!existingBranch) {
|
|
332
351
|
const branchName = await this.gitManager.createTaskBranch(taskSlug);
|
|
333
|
-
|
|
352
|
+
await sendNotification(POSTHOG_NOTIFICATIONS.BRANCH_CREATED, {
|
|
353
|
+
branch: branchName,
|
|
354
|
+
});
|
|
334
355
|
await this.gitManager.addAllPostHogFiles();
|
|
335
356
|
// Only commit if there are changes or we're in cloud mode
|
|
336
357
|
if (isCloudMode) {
|
|
337
|
-
await this.gitManager.commitAndPush(`Initialize task ${taskSlug}`, {
|
|
358
|
+
await this.gitManager.commitAndPush(`Initialize task ${taskSlug}`, {
|
|
359
|
+
allowEmpty: true,
|
|
360
|
+
});
|
|
338
361
|
}
|
|
339
362
|
else {
|
|
340
363
|
// Check if there are any changes before committing
|
|
@@ -345,7 +368,9 @@ Generated by PostHog Agent`;
|
|
|
345
368
|
}
|
|
346
369
|
}
|
|
347
370
|
else {
|
|
348
|
-
this.logger.info(
|
|
371
|
+
this.logger.info("Switching to existing task branch", {
|
|
372
|
+
branch: existingBranch,
|
|
373
|
+
});
|
|
349
374
|
await this.gitManager.switchToBranch(existingBranch);
|
|
350
375
|
}
|
|
351
376
|
}
|
|
@@ -359,46 +384,41 @@ Generated by PostHog Agent`;
|
|
|
359
384
|
process.env.OPENAI_API_KEY = resolvedToken;
|
|
360
385
|
}
|
|
361
386
|
}
|
|
362
|
-
async ensurePullRequest(task, stepResults) {
|
|
387
|
+
async ensurePullRequest(task, stepResults, sendNotification) {
|
|
363
388
|
const latestRun = task.latest_run;
|
|
364
|
-
const existingPr = latestRun?.output && typeof latestRun.output ===
|
|
389
|
+
const existingPr = latestRun?.output && typeof latestRun.output === "object"
|
|
365
390
|
? latestRun.output.pr_url
|
|
366
391
|
: null;
|
|
367
392
|
if (existingPr) {
|
|
368
|
-
this.logger.info(
|
|
393
|
+
this.logger.info("PR already exists, skipping creation", {
|
|
394
|
+
taskId: task.id,
|
|
395
|
+
prUrl: existingPr,
|
|
396
|
+
});
|
|
369
397
|
return;
|
|
370
398
|
}
|
|
371
|
-
const buildResult = stepResults
|
|
399
|
+
const buildResult = stepResults.build;
|
|
372
400
|
if (!buildResult?.commitCreated) {
|
|
373
|
-
this.logger.warn(
|
|
401
|
+
this.logger.warn("Build step did not produce a commit; skipping PR creation", { taskId: task.id });
|
|
374
402
|
return;
|
|
375
403
|
}
|
|
376
404
|
const branchName = await this.gitManager.getCurrentBranch();
|
|
377
|
-
const finalizeResult = stepResults
|
|
405
|
+
const finalizeResult = stepResults.finalize;
|
|
378
406
|
const prBody = finalizeResult?.prBody;
|
|
379
|
-
const prUrl = await this.createPullRequest(task.id, branchName, task.title, task.description ??
|
|
380
|
-
|
|
407
|
+
const prUrl = await this.createPullRequest(task.id, branchName, task.title, task.description ?? "", prBody);
|
|
408
|
+
await sendNotification(POSTHOG_NOTIFICATIONS.PR_CREATED, { prUrl });
|
|
381
409
|
try {
|
|
382
410
|
await this.attachPullRequestToTask(task.id, prUrl, branchName);
|
|
383
|
-
this.logger.info(
|
|
411
|
+
this.logger.info("PR attached to task successfully", {
|
|
412
|
+
taskId: task.id,
|
|
413
|
+
prUrl,
|
|
414
|
+
});
|
|
384
415
|
}
|
|
385
416
|
catch (error) {
|
|
386
|
-
this.logger.warn(
|
|
417
|
+
this.logger.warn("Could not attach PR to task", {
|
|
387
418
|
error: error instanceof Error ? error.message : String(error),
|
|
388
419
|
});
|
|
389
420
|
}
|
|
390
421
|
}
|
|
391
|
-
emitEvent(event) {
|
|
392
|
-
if (this.debug && event.type !== 'token') {
|
|
393
|
-
// Log all events except tokens (too verbose)
|
|
394
|
-
this.logger.debug('Emitting event', { type: event.type, ts: event.ts });
|
|
395
|
-
}
|
|
396
|
-
const persistPromise = this.progressReporter.recordEvent(event);
|
|
397
|
-
if (persistPromise && typeof persistPromise.then === 'function') {
|
|
398
|
-
persistPromise.catch((error) => this.logger.debug('Failed to persist agent event', { message: error.message }));
|
|
399
|
-
}
|
|
400
|
-
this.onEvent?.(event);
|
|
401
|
-
}
|
|
402
422
|
}
|
|
403
423
|
|
|
404
424
|
export { Agent };
|