@posthog/agent 1.25.0 → 1.27.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 +7296 -11
- package/dist/index.js.map +1 -1
- package/package.json +6 -12
- package/src/adapters/claude/claude.ts +21 -5
- package/src/adapters/claude/tools.ts +8 -1
- package/src/agent.ts +250 -1
- package/src/session-store.ts +18 -3
- package/src/types.ts +1 -1
- package/src/worktree-manager.ts +4 -7
- package/dist/_virtual/_commonjsHelpers.js +0 -6
- package/dist/_virtual/_commonjsHelpers.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 -610
- package/dist/node_modules/@agentclientprotocol/sdk/dist/acp.js.map +0 -1
- package/dist/node_modules/@agentclientprotocol/sdk/dist/schema.js +0 -875
- 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 -1112
- 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 -655
- 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 -466
- 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 -52
- package/dist/src/agent.d.ts.map +0 -1
- package/dist/src/agent.js +0 -425
- 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 -53
- package/dist/src/session-store.d.ts.map +0 -1
- package/dist/src/session-store.js +0 -195
- 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 -810
- package/dist/src/worktree-manager.js.map +0 -1
|
@@ -1,163 +0,0 @@
|
|
|
1
|
-
const RESEARCH_SYSTEM_PROMPT = `<role>
|
|
2
|
-
PostHog AI Research Agent — analyze codebases to evaluate task actionability and identify missing information.
|
|
3
|
-
</role>
|
|
4
|
-
|
|
5
|
-
<constraints>
|
|
6
|
-
- Read-only: analyze files, search code, explore structure
|
|
7
|
-
- No modifications or code changes
|
|
8
|
-
- Output structured JSON only
|
|
9
|
-
</constraints>
|
|
10
|
-
|
|
11
|
-
<objective>
|
|
12
|
-
Your PRIMARY goal is to evaluate whether a task is actionable and assign an actionability score.
|
|
13
|
-
|
|
14
|
-
Calculate an actionabilityScore (0-1) based on:
|
|
15
|
-
- **Task clarity** (0.4 weight): Is the task description specific and unambiguous?
|
|
16
|
-
- **Codebase context** (0.3 weight): Can you locate the relevant code and patterns?
|
|
17
|
-
- **Architectural decisions** (0.2 weight): Are the implementation approaches clear?
|
|
18
|
-
- **Dependencies** (0.1 weight): Are required dependencies and constraints understood?
|
|
19
|
-
|
|
20
|
-
If actionabilityScore < 0.7, generate specific clarifying questions to increase confidence.
|
|
21
|
-
|
|
22
|
-
Questions must present complete implementation choices, NOT request information from the user:
|
|
23
|
-
options: array of strings
|
|
24
|
-
- GOOD: options: ["Use Redux Toolkit (matches pattern in src/store/)", "Zustand (lighter weight)"]
|
|
25
|
-
- BAD: "Tell me which state management library to use"
|
|
26
|
-
- GOOD: options: ["Place in Button.tsx (existing component)", "create NewButton.tsx (separate concerns)?"]
|
|
27
|
-
- BAD: "Where should I put this code?"
|
|
28
|
-
|
|
29
|
-
DO NOT ask questions like "how should I fix this" or "tell me the pattern" — present concrete options that can be directly chosen and acted upon.
|
|
30
|
-
</objective>
|
|
31
|
-
|
|
32
|
-
<process>
|
|
33
|
-
1. Explore repository structure and identify relevant files/components
|
|
34
|
-
2. Understand existing patterns, conventions, and dependencies
|
|
35
|
-
3. Calculate actionabilityScore based on clarity, context, architecture, and dependencies
|
|
36
|
-
4. Identify key files that will need modification
|
|
37
|
-
5. If score < 0.7: generate 2-4 specific questions to resolve blockers
|
|
38
|
-
6. Output JSON matching ResearchEvaluation schema
|
|
39
|
-
</process>
|
|
40
|
-
|
|
41
|
-
<output_format>
|
|
42
|
-
Output ONLY valid JSON with no markdown wrappers, no preamble, no explanation:
|
|
43
|
-
|
|
44
|
-
{
|
|
45
|
-
"actionabilityScore": 0.85,
|
|
46
|
-
"context": "Brief 2-3 sentence summary of the task and implementation approach",
|
|
47
|
-
"keyFiles": ["path/to/file1.ts", "path/to/file2.ts"],
|
|
48
|
-
"blockers": ["Optional: what's preventing full confidence"],
|
|
49
|
-
"questions": [
|
|
50
|
-
{
|
|
51
|
-
"id": "q1",
|
|
52
|
-
"question": "Specific architectural decision needed?",
|
|
53
|
-
"options": [
|
|
54
|
-
"First approach with concrete details",
|
|
55
|
-
"Alternative approach with concrete details",
|
|
56
|
-
"Third option if needed"
|
|
57
|
-
]
|
|
58
|
-
}
|
|
59
|
-
]
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
Rules:
|
|
63
|
-
- actionabilityScore: number between 0 and 1
|
|
64
|
-
- context: concise summary for planning phase
|
|
65
|
-
- keyFiles: array of file paths that need modification
|
|
66
|
-
- blockers: optional array explaining confidence gaps
|
|
67
|
-
- questions: ONLY include if actionabilityScore < 0.7
|
|
68
|
-
- Each question must have 2-3 options (maximum 3)
|
|
69
|
-
- Max 3 questions total
|
|
70
|
-
- Options must be complete, actionable choices that require NO additional user input
|
|
71
|
-
- NEVER use options like "Tell me the pattern", "Show me examples", "Specify the approach"
|
|
72
|
-
- Each option must be a full implementation decision that can be directly acted upon
|
|
73
|
-
</output_format>
|
|
74
|
-
|
|
75
|
-
<scoring_examples>
|
|
76
|
-
<example score="0.9">
|
|
77
|
-
Task: "Fix typo in login button text"
|
|
78
|
-
Reasoning: Completely clear task, found exact component, no architectural decisions
|
|
79
|
-
</example>
|
|
80
|
-
|
|
81
|
-
<example score="0.75">
|
|
82
|
-
Task: "Add caching to API endpoints"
|
|
83
|
-
Reasoning: Clear goal, found endpoints, but multiple caching strategies possible
|
|
84
|
-
</example>
|
|
85
|
-
|
|
86
|
-
<example score="0.55">
|
|
87
|
-
Task: "Improve performance"
|
|
88
|
-
Reasoning: Vague task, unclear scope, needs questions about which areas to optimize
|
|
89
|
-
Questions needed: Which features are slow? What metrics define success?
|
|
90
|
-
</example>
|
|
91
|
-
|
|
92
|
-
<example score="0.3">
|
|
93
|
-
Task: "Add the new feature"
|
|
94
|
-
Reasoning: Extremely vague, no context, cannot locate relevant code
|
|
95
|
-
Questions needed: What feature? Which product area? What should it do?
|
|
96
|
-
</example>
|
|
97
|
-
</scoring_examples>
|
|
98
|
-
|
|
99
|
-
<question_examples>
|
|
100
|
-
<good_example>
|
|
101
|
-
{
|
|
102
|
-
"id": "q1",
|
|
103
|
-
"question": "Which caching layer should we use for API responses?",
|
|
104
|
-
"options": [
|
|
105
|
-
"Redis with 1-hour TTL (existing infrastructure, requires Redis client setup)",
|
|
106
|
-
"In-memory LRU cache with 100MB limit (simpler, single-server only)",
|
|
107
|
-
"HTTP Cache-Control headers only (minimal backend changes, relies on browser/CDN)"
|
|
108
|
-
]
|
|
109
|
-
}
|
|
110
|
-
Reason: Each option is a complete, actionable decision with concrete details
|
|
111
|
-
</good_example>
|
|
112
|
-
|
|
113
|
-
<good_example>
|
|
114
|
-
{
|
|
115
|
-
"id": "q2",
|
|
116
|
-
"question": "Where should the new analytics tracking code be placed?",
|
|
117
|
-
"options": [
|
|
118
|
-
"In the existing UserAnalytics.ts module alongside page view tracking",
|
|
119
|
-
"Create a new EventTracking.ts module in src/analytics/ for all event tracking",
|
|
120
|
-
"Add directly to each component that needs tracking (no centralized module)"
|
|
121
|
-
]
|
|
122
|
-
}
|
|
123
|
-
Reason: Specific file paths and architectural patterns, no user input needed
|
|
124
|
-
</good_example>
|
|
125
|
-
|
|
126
|
-
<bad_example>
|
|
127
|
-
{
|
|
128
|
-
"id": "q1",
|
|
129
|
-
"question": "How should I implement this?",
|
|
130
|
-
"options": ["One way", "Another way"]
|
|
131
|
-
}
|
|
132
|
-
Reason: Too vague, doesn't explain the tradeoffs or provide concrete details
|
|
133
|
-
</bad_example>
|
|
134
|
-
|
|
135
|
-
<bad_example>
|
|
136
|
-
{
|
|
137
|
-
"id": "q2",
|
|
138
|
-
"question": "Which pattern should we follow for state management?",
|
|
139
|
-
"options": [
|
|
140
|
-
"Tell me which pattern the codebase currently uses",
|
|
141
|
-
"Show me examples of state management",
|
|
142
|
-
"Whatever you think is best"
|
|
143
|
-
]
|
|
144
|
-
}
|
|
145
|
-
Reason: Options request user input instead of being actionable choices. Should be concrete patterns like "Zustand stores (matching existing patterns in src/stores/)" or "React Context (simpler, no new dependencies)"
|
|
146
|
-
</bad_example>
|
|
147
|
-
|
|
148
|
-
<bad_example>
|
|
149
|
-
{
|
|
150
|
-
"id": "q3",
|
|
151
|
-
"question": "What color scheme should the button use?",
|
|
152
|
-
"options": [
|
|
153
|
-
"Use the existing theme colors",
|
|
154
|
-
"Let me specify custom colors",
|
|
155
|
-
"Match the design system"
|
|
156
|
-
]
|
|
157
|
-
}
|
|
158
|
-
Reason: "Let me specify" requires user input. Should be "Primary blue (#0066FF, existing theme)" or "Secondary gray (#6B7280, existing theme)"
|
|
159
|
-
</bad_example>
|
|
160
|
-
</question_examples>`;
|
|
161
|
-
|
|
162
|
-
export { RESEARCH_SYSTEM_PROMPT };
|
|
163
|
-
//# sourceMappingURL=research.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"research.js","sources":["../../../src/agents/research.ts"],"sourcesContent":["export const RESEARCH_SYSTEM_PROMPT = `<role>\nPostHog AI Research Agent — analyze codebases to evaluate task actionability and identify missing information.\n</role>\n\n<constraints>\n- Read-only: analyze files, search code, explore structure\n- No modifications or code changes\n- Output structured JSON only\n</constraints>\n\n<objective>\nYour PRIMARY goal is to evaluate whether a task is actionable and assign an actionability score.\n\nCalculate an actionabilityScore (0-1) based on:\n- **Task clarity** (0.4 weight): Is the task description specific and unambiguous?\n- **Codebase context** (0.3 weight): Can you locate the relevant code and patterns?\n- **Architectural decisions** (0.2 weight): Are the implementation approaches clear?\n- **Dependencies** (0.1 weight): Are required dependencies and constraints understood?\n\nIf actionabilityScore < 0.7, generate specific clarifying questions to increase confidence.\n\nQuestions must present complete implementation choices, NOT request information from the user:\noptions: array of strings\n- GOOD: options: [\"Use Redux Toolkit (matches pattern in src/store/)\", \"Zustand (lighter weight)\"]\n- BAD: \"Tell me which state management library to use\"\n- GOOD: options: [\"Place in Button.tsx (existing component)\", \"create NewButton.tsx (separate concerns)?\"]\n- BAD: \"Where should I put this code?\"\n\nDO NOT ask questions like \"how should I fix this\" or \"tell me the pattern\" — present concrete options that can be directly chosen and acted upon.\n</objective>\n\n<process>\n1. Explore repository structure and identify relevant files/components\n2. Understand existing patterns, conventions, and dependencies\n3. Calculate actionabilityScore based on clarity, context, architecture, and dependencies\n4. Identify key files that will need modification\n5. If score < 0.7: generate 2-4 specific questions to resolve blockers\n6. Output JSON matching ResearchEvaluation schema\n</process>\n\n<output_format>\nOutput ONLY valid JSON with no markdown wrappers, no preamble, no explanation:\n\n{\n \"actionabilityScore\": 0.85,\n \"context\": \"Brief 2-3 sentence summary of the task and implementation approach\",\n \"keyFiles\": [\"path/to/file1.ts\", \"path/to/file2.ts\"],\n \"blockers\": [\"Optional: what's preventing full confidence\"],\n \"questions\": [\n {\n \"id\": \"q1\",\n \"question\": \"Specific architectural decision needed?\",\n \"options\": [\n \"First approach with concrete details\",\n \"Alternative approach with concrete details\",\n \"Third option if needed\"\n ]\n }\n ]\n}\n\nRules:\n- actionabilityScore: number between 0 and 1\n- context: concise summary for planning phase\n- keyFiles: array of file paths that need modification\n- blockers: optional array explaining confidence gaps\n- questions: ONLY include if actionabilityScore < 0.7\n- Each question must have 2-3 options (maximum 3)\n- Max 3 questions total\n- Options must be complete, actionable choices that require NO additional user input\n- NEVER use options like \"Tell me the pattern\", \"Show me examples\", \"Specify the approach\"\n- Each option must be a full implementation decision that can be directly acted upon\n</output_format>\n\n<scoring_examples>\n<example score=\"0.9\">\nTask: \"Fix typo in login button text\"\nReasoning: Completely clear task, found exact component, no architectural decisions\n</example>\n\n<example score=\"0.75\">\nTask: \"Add caching to API endpoints\"\nReasoning: Clear goal, found endpoints, but multiple caching strategies possible\n</example>\n\n<example score=\"0.55\">\nTask: \"Improve performance\"\nReasoning: Vague task, unclear scope, needs questions about which areas to optimize\nQuestions needed: Which features are slow? What metrics define success?\n</example>\n\n<example score=\"0.3\">\nTask: \"Add the new feature\"\nReasoning: Extremely vague, no context, cannot locate relevant code\nQuestions needed: What feature? Which product area? What should it do?\n</example>\n</scoring_examples>\n\n<question_examples>\n<good_example>\n{\n \"id\": \"q1\",\n \"question\": \"Which caching layer should we use for API responses?\",\n \"options\": [\n \"Redis with 1-hour TTL (existing infrastructure, requires Redis client setup)\",\n \"In-memory LRU cache with 100MB limit (simpler, single-server only)\",\n \"HTTP Cache-Control headers only (minimal backend changes, relies on browser/CDN)\"\n ]\n}\nReason: Each option is a complete, actionable decision with concrete details\n</good_example>\n\n<good_example>\n{\n \"id\": \"q2\",\n \"question\": \"Where should the new analytics tracking code be placed?\",\n \"options\": [\n \"In the existing UserAnalytics.ts module alongside page view tracking\",\n \"Create a new EventTracking.ts module in src/analytics/ for all event tracking\",\n \"Add directly to each component that needs tracking (no centralized module)\"\n ]\n}\nReason: Specific file paths and architectural patterns, no user input needed\n</good_example>\n\n<bad_example>\n{\n \"id\": \"q1\", \n \"question\": \"How should I implement this?\",\n \"options\": [\"One way\", \"Another way\"]\n}\nReason: Too vague, doesn't explain the tradeoffs or provide concrete details\n</bad_example>\n\n<bad_example>\n{\n \"id\": \"q2\",\n \"question\": \"Which pattern should we follow for state management?\",\n \"options\": [\n \"Tell me which pattern the codebase currently uses\",\n \"Show me examples of state management\",\n \"Whatever you think is best\"\n ]\n}\nReason: Options request user input instead of being actionable choices. Should be concrete patterns like \"Zustand stores (matching existing patterns in src/stores/)\" or \"React Context (simpler, no new dependencies)\"\n</bad_example>\n\n<bad_example>\n{\n \"id\": \"q3\",\n \"question\": \"What color scheme should the button use?\",\n \"options\": [\n \"Use the existing theme colors\",\n \"Let me specify custom colors\",\n \"Match the design system\"\n ]\n}\nReason: \"Let me specify\" requires user input. Should be \"Primary blue (#0066FF, existing theme)\" or \"Secondary gray (#6B7280, existing theme)\"\n</bad_example>\n</question_examples>`;\n"],"names":[],"mappings":"AAAO,MAAM,sBAAsB,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import type { ResearchEvaluation, SupportingFile } from "./types.js";
|
|
2
|
-
import { Logger } from "./utils/logger.js";
|
|
3
|
-
export interface TaskFile {
|
|
4
|
-
name: string;
|
|
5
|
-
content: string;
|
|
6
|
-
type: "plan" | "context" | "reference" | "output" | "artifact";
|
|
7
|
-
}
|
|
8
|
-
export interface LocalArtifact {
|
|
9
|
-
name: string;
|
|
10
|
-
content: string;
|
|
11
|
-
type: TaskFile["type"];
|
|
12
|
-
contentType: string;
|
|
13
|
-
size: number;
|
|
14
|
-
}
|
|
15
|
-
export declare class PostHogFileManager {
|
|
16
|
-
private repositoryPath;
|
|
17
|
-
private logger;
|
|
18
|
-
constructor(repositoryPath: string, logger?: Logger);
|
|
19
|
-
private getTaskDirectory;
|
|
20
|
-
private getTaskFilePath;
|
|
21
|
-
ensureTaskDirectory(taskId: string): Promise<void>;
|
|
22
|
-
writeTaskFile(taskId: string, file: TaskFile): Promise<void>;
|
|
23
|
-
readTaskFile(taskId: string, fileName: string): Promise<string | null>;
|
|
24
|
-
listTaskFiles(taskId: string): Promise<string[]>;
|
|
25
|
-
deleteTaskFile(taskId: string, fileName: string): Promise<void>;
|
|
26
|
-
taskDirectoryExists(taskId: string): Promise<boolean>;
|
|
27
|
-
cleanupTaskDirectory(taskId: string): Promise<void>;
|
|
28
|
-
writePlan(taskId: string, plan: string): Promise<void>;
|
|
29
|
-
readPlan(taskId: string): Promise<string | null>;
|
|
30
|
-
writeContext(taskId: string, context: string): Promise<void>;
|
|
31
|
-
readContext(taskId: string): Promise<string | null>;
|
|
32
|
-
writeRequirements(taskId: string, requirements: string): Promise<void>;
|
|
33
|
-
readRequirements(taskId: string): Promise<string | null>;
|
|
34
|
-
writeResearch(taskId: string, data: ResearchEvaluation): Promise<void>;
|
|
35
|
-
readResearch(taskId: string): Promise<ResearchEvaluation | null>;
|
|
36
|
-
writeTodos(taskId: string, data: unknown): Promise<void>;
|
|
37
|
-
readTodos(taskId: string): Promise<unknown | null>;
|
|
38
|
-
getTaskFiles(taskId: string): Promise<SupportingFile[]>;
|
|
39
|
-
collectTaskArtifacts(taskId: string): Promise<LocalArtifact[]>;
|
|
40
|
-
private resolveFileType;
|
|
41
|
-
private inferContentType;
|
|
42
|
-
}
|
|
43
|
-
//# sourceMappingURL=file-manager.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"file-manager.d.ts","sourceRoot":"","sources":["../../src/file-manager.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AACrE,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAE3C,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAA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IAIhD,YAAY,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAQ5D,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;IAInD,iBAAiB,CAAC,MAAM,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAQtE,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;IAIxD,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,kBAAkB,GAAG,OAAO,CAAC,IAAI,CAAC;IAuBtE,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,GAAG,IAAI,CAAC;IAUhE,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;IA4BxD,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,GAAG,IAAI,CAAC;IAUlD,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,EAAE,CAAC;IAsBvD,oBAAoB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,EAAE,CAAC;IA0BpE,OAAO,CAAC,eAAe;IASvB,OAAO,CAAC,gBAAgB;CAazB"}
|
package/dist/src/file-manager.js
DELETED
|
@@ -1,266 +0,0 @@
|
|
|
1
|
-
import { promises } from 'node:fs';
|
|
2
|
-
import { join, extname } from 'node:path';
|
|
3
|
-
import z from 'zod';
|
|
4
|
-
import { Logger } from './utils/logger.js';
|
|
5
|
-
|
|
6
|
-
class PostHogFileManager {
|
|
7
|
-
repositoryPath;
|
|
8
|
-
logger;
|
|
9
|
-
constructor(repositoryPath, logger) {
|
|
10
|
-
this.repositoryPath = repositoryPath;
|
|
11
|
-
this.logger =
|
|
12
|
-
logger || new Logger({ debug: false, prefix: "[FileManager]" });
|
|
13
|
-
}
|
|
14
|
-
getTaskDirectory(taskId) {
|
|
15
|
-
return join(this.repositoryPath, ".posthog", taskId);
|
|
16
|
-
}
|
|
17
|
-
getTaskFilePath(taskId, fileName) {
|
|
18
|
-
return join(this.getTaskDirectory(taskId), fileName);
|
|
19
|
-
}
|
|
20
|
-
async ensureTaskDirectory(taskId) {
|
|
21
|
-
const taskDir = this.getTaskDirectory(taskId);
|
|
22
|
-
try {
|
|
23
|
-
await promises.access(taskDir);
|
|
24
|
-
}
|
|
25
|
-
catch {
|
|
26
|
-
await promises.mkdir(taskDir, { recursive: true });
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
async writeTaskFile(taskId, file) {
|
|
30
|
-
await this.ensureTaskDirectory(taskId);
|
|
31
|
-
const filePath = this.getTaskFilePath(taskId, file.name);
|
|
32
|
-
this.logger.debug("Writing task file", {
|
|
33
|
-
filePath,
|
|
34
|
-
contentLength: file.content.length,
|
|
35
|
-
contentType: typeof file.content,
|
|
36
|
-
});
|
|
37
|
-
await promises.writeFile(filePath, file.content, "utf8");
|
|
38
|
-
this.logger.debug("File written successfully", { filePath });
|
|
39
|
-
}
|
|
40
|
-
async readTaskFile(taskId, fileName) {
|
|
41
|
-
try {
|
|
42
|
-
const filePath = this.getTaskFilePath(taskId, fileName);
|
|
43
|
-
return await promises.readFile(filePath, "utf8");
|
|
44
|
-
}
|
|
45
|
-
catch (error) {
|
|
46
|
-
if (error.code === "ENOENT") {
|
|
47
|
-
return null;
|
|
48
|
-
}
|
|
49
|
-
throw error;
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
async listTaskFiles(taskId) {
|
|
53
|
-
try {
|
|
54
|
-
const taskDir = this.getTaskDirectory(taskId);
|
|
55
|
-
const files = await promises.readdir(taskDir);
|
|
56
|
-
return files.filter((file) => !file.startsWith("."));
|
|
57
|
-
}
|
|
58
|
-
catch (error) {
|
|
59
|
-
if (error.code === "ENOENT") {
|
|
60
|
-
return [];
|
|
61
|
-
}
|
|
62
|
-
throw error;
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
async deleteTaskFile(taskId, fileName) {
|
|
66
|
-
try {
|
|
67
|
-
const filePath = this.getTaskFilePath(taskId, fileName);
|
|
68
|
-
await promises.unlink(filePath);
|
|
69
|
-
}
|
|
70
|
-
catch (error) {
|
|
71
|
-
if (error.code !== "ENOENT") {
|
|
72
|
-
throw error;
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
async taskDirectoryExists(taskId) {
|
|
77
|
-
try {
|
|
78
|
-
const taskDir = this.getTaskDirectory(taskId);
|
|
79
|
-
await promises.access(taskDir);
|
|
80
|
-
return true;
|
|
81
|
-
}
|
|
82
|
-
catch {
|
|
83
|
-
return false;
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
async cleanupTaskDirectory(taskId) {
|
|
87
|
-
try {
|
|
88
|
-
const taskDir = this.getTaskDirectory(taskId);
|
|
89
|
-
await promises.rm(taskDir, { recursive: true, force: true });
|
|
90
|
-
}
|
|
91
|
-
catch (error) {
|
|
92
|
-
if (error.code !== "ENOENT") {
|
|
93
|
-
throw error;
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
// Convenience methods for common file types
|
|
98
|
-
async writePlan(taskId, plan) {
|
|
99
|
-
this.logger.debug("Writing plan", {
|
|
100
|
-
taskId,
|
|
101
|
-
planLength: plan.length,
|
|
102
|
-
contentPreview: plan.substring(0, 200),
|
|
103
|
-
});
|
|
104
|
-
await this.writeTaskFile(taskId, {
|
|
105
|
-
name: "plan.md",
|
|
106
|
-
content: plan,
|
|
107
|
-
type: "plan",
|
|
108
|
-
});
|
|
109
|
-
this.logger.info("Plan file written", { taskId });
|
|
110
|
-
}
|
|
111
|
-
async readPlan(taskId) {
|
|
112
|
-
return await this.readTaskFile(taskId, "plan.md");
|
|
113
|
-
}
|
|
114
|
-
async writeContext(taskId, context) {
|
|
115
|
-
await this.writeTaskFile(taskId, {
|
|
116
|
-
name: "context.md",
|
|
117
|
-
content: context,
|
|
118
|
-
type: "context",
|
|
119
|
-
});
|
|
120
|
-
}
|
|
121
|
-
async readContext(taskId) {
|
|
122
|
-
return await this.readTaskFile(taskId, "context.md");
|
|
123
|
-
}
|
|
124
|
-
async writeRequirements(taskId, requirements) {
|
|
125
|
-
await this.writeTaskFile(taskId, {
|
|
126
|
-
name: "requirements.md",
|
|
127
|
-
content: requirements,
|
|
128
|
-
type: "reference",
|
|
129
|
-
});
|
|
130
|
-
}
|
|
131
|
-
async readRequirements(taskId) {
|
|
132
|
-
return await this.readTaskFile(taskId, "requirements.md");
|
|
133
|
-
}
|
|
134
|
-
async writeResearch(taskId, data) {
|
|
135
|
-
this.logger.debug("Writing research", {
|
|
136
|
-
taskId,
|
|
137
|
-
score: data.actionabilityScore,
|
|
138
|
-
hasQuestions: !!data.questions,
|
|
139
|
-
questionCount: data.questions?.length ?? 0,
|
|
140
|
-
answered: data.answered ?? false,
|
|
141
|
-
});
|
|
142
|
-
await this.writeTaskFile(taskId, {
|
|
143
|
-
name: "research.json",
|
|
144
|
-
content: JSON.stringify(data, null, 2),
|
|
145
|
-
type: "artifact",
|
|
146
|
-
});
|
|
147
|
-
this.logger.info("Research file written", {
|
|
148
|
-
taskId,
|
|
149
|
-
score: data.actionabilityScore,
|
|
150
|
-
hasQuestions: !!data.questions,
|
|
151
|
-
answered: data.answered ?? false,
|
|
152
|
-
});
|
|
153
|
-
}
|
|
154
|
-
async readResearch(taskId) {
|
|
155
|
-
try {
|
|
156
|
-
const content = await this.readTaskFile(taskId, "research.json");
|
|
157
|
-
return content ? JSON.parse(content) : null;
|
|
158
|
-
}
|
|
159
|
-
catch (error) {
|
|
160
|
-
this.logger.debug("Failed to parse research.json", { error });
|
|
161
|
-
return null;
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
async writeTodos(taskId, data) {
|
|
165
|
-
const todos = z.object({
|
|
166
|
-
metadata: z.object({
|
|
167
|
-
total: z.number(),
|
|
168
|
-
completed: z.number(),
|
|
169
|
-
}),
|
|
170
|
-
});
|
|
171
|
-
const validatedData = todos.parse(data);
|
|
172
|
-
this.logger.debug("Writing todos", {
|
|
173
|
-
taskId,
|
|
174
|
-
total: validatedData.metadata?.total ?? 0,
|
|
175
|
-
completed: validatedData.metadata?.completed ?? 0,
|
|
176
|
-
});
|
|
177
|
-
await this.writeTaskFile(taskId, {
|
|
178
|
-
name: "todos.json",
|
|
179
|
-
content: JSON.stringify(validatedData, null, 2),
|
|
180
|
-
type: "artifact",
|
|
181
|
-
});
|
|
182
|
-
this.logger.info("Todos file written", {
|
|
183
|
-
taskId,
|
|
184
|
-
total: validatedData.metadata?.total ?? 0,
|
|
185
|
-
completed: validatedData.metadata?.completed ?? 0,
|
|
186
|
-
});
|
|
187
|
-
}
|
|
188
|
-
async readTodos(taskId) {
|
|
189
|
-
try {
|
|
190
|
-
const content = await this.readTaskFile(taskId, "todos.json");
|
|
191
|
-
return content ? JSON.parse(content) : null;
|
|
192
|
-
}
|
|
193
|
-
catch (error) {
|
|
194
|
-
this.logger.debug("Failed to parse todos.json", { error });
|
|
195
|
-
return null;
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
async getTaskFiles(taskId) {
|
|
199
|
-
const fileNames = await this.listTaskFiles(taskId);
|
|
200
|
-
const files = [];
|
|
201
|
-
for (const fileName of fileNames) {
|
|
202
|
-
const content = await this.readTaskFile(taskId, fileName);
|
|
203
|
-
if (content !== null) {
|
|
204
|
-
// Determine type based on file name
|
|
205
|
-
const type = this.resolveFileType(fileName);
|
|
206
|
-
files.push({
|
|
207
|
-
name: fileName,
|
|
208
|
-
content,
|
|
209
|
-
type,
|
|
210
|
-
created_at: new Date().toISOString(), // Could be enhanced with file stats
|
|
211
|
-
});
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
return files;
|
|
215
|
-
}
|
|
216
|
-
async collectTaskArtifacts(taskId) {
|
|
217
|
-
const fileNames = await this.listTaskFiles(taskId);
|
|
218
|
-
const artifacts = [];
|
|
219
|
-
for (const fileName of fileNames) {
|
|
220
|
-
const content = await this.readTaskFile(taskId, fileName);
|
|
221
|
-
if (content === null) {
|
|
222
|
-
continue;
|
|
223
|
-
}
|
|
224
|
-
const type = this.resolveFileType(fileName);
|
|
225
|
-
const contentType = this.inferContentType(fileName);
|
|
226
|
-
const size = Buffer.byteLength(content, "utf8");
|
|
227
|
-
artifacts.push({
|
|
228
|
-
name: fileName,
|
|
229
|
-
content,
|
|
230
|
-
type,
|
|
231
|
-
contentType,
|
|
232
|
-
size,
|
|
233
|
-
});
|
|
234
|
-
}
|
|
235
|
-
return artifacts;
|
|
236
|
-
}
|
|
237
|
-
resolveFileType(fileName) {
|
|
238
|
-
if (fileName === "plan.md")
|
|
239
|
-
return "plan";
|
|
240
|
-
if (fileName === "context.md")
|
|
241
|
-
return "context";
|
|
242
|
-
if (fileName === "requirements.md")
|
|
243
|
-
return "reference";
|
|
244
|
-
if (fileName.startsWith("output_"))
|
|
245
|
-
return "output";
|
|
246
|
-
if (fileName.endsWith(".md"))
|
|
247
|
-
return "reference";
|
|
248
|
-
return "artifact";
|
|
249
|
-
}
|
|
250
|
-
inferContentType(fileName) {
|
|
251
|
-
const extension = extname(fileName).toLowerCase();
|
|
252
|
-
switch (extension) {
|
|
253
|
-
case ".md":
|
|
254
|
-
return "text/markdown";
|
|
255
|
-
case ".json":
|
|
256
|
-
return "application/json";
|
|
257
|
-
case ".txt":
|
|
258
|
-
return "text/plain";
|
|
259
|
-
default:
|
|
260
|
-
return "text/plain";
|
|
261
|
-
}
|
|
262
|
-
}
|
|
263
|
-
}
|
|
264
|
-
|
|
265
|
-
export { PostHogFileManager };
|
|
266
|
-
//# sourceMappingURL=file-manager.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"file-manager.js","sources":["../../src/file-manager.ts"],"sourcesContent":["import { promises as fs } from \"node:fs\";\nimport { extname, join } from \"node:path\";\nimport z from \"zod\";\nimport type { ResearchEvaluation, SupportingFile } from \"./types.js\";\nimport { Logger } from \"./utils/logger.js\";\n\nexport interface TaskFile {\n name: string;\n content: string;\n type: \"plan\" | \"context\" | \"reference\" | \"output\" | \"artifact\";\n}\n\nexport interface LocalArtifact {\n name: string;\n content: string;\n type: TaskFile[\"type\"];\n contentType: string;\n size: number;\n}\n\nexport class PostHogFileManager {\n private repositoryPath: string;\n private logger: Logger;\n\n constructor(repositoryPath: string, logger?: Logger) {\n this.repositoryPath = repositoryPath;\n this.logger =\n logger || new Logger({ debug: false, prefix: \"[FileManager]\" });\n }\n\n private getTaskDirectory(taskId: string): string {\n return join(this.repositoryPath, \".posthog\", taskId);\n }\n\n private getTaskFilePath(taskId: string, fileName: string): string {\n return join(this.getTaskDirectory(taskId), fileName);\n }\n\n async ensureTaskDirectory(taskId: string): Promise<void> {\n const taskDir = this.getTaskDirectory(taskId);\n try {\n await fs.access(taskDir);\n } catch {\n await fs.mkdir(taskDir, { recursive: true });\n }\n }\n\n async writeTaskFile(taskId: string, file: TaskFile): Promise<void> {\n await this.ensureTaskDirectory(taskId);\n const filePath = this.getTaskFilePath(taskId, file.name);\n\n this.logger.debug(\"Writing task file\", {\n filePath,\n contentLength: file.content.length,\n contentType: typeof file.content,\n });\n\n await fs.writeFile(filePath, file.content, \"utf8\");\n\n this.logger.debug(\"File written successfully\", { filePath });\n }\n\n async readTaskFile(taskId: string, fileName: string): Promise<string | null> {\n try {\n const filePath = this.getTaskFilePath(taskId, fileName);\n return await fs.readFile(filePath, \"utf8\");\n } catch (error) {\n if ((error as NodeJS.ErrnoException).code === \"ENOENT\") {\n return null;\n }\n throw error;\n }\n }\n\n async listTaskFiles(taskId: string): Promise<string[]> {\n try {\n const taskDir = this.getTaskDirectory(taskId);\n const files = await fs.readdir(taskDir);\n return files.filter((file) => !file.startsWith(\".\"));\n } catch (error) {\n if ((error as NodeJS.ErrnoException).code === \"ENOENT\") {\n return [];\n }\n throw error;\n }\n }\n\n async deleteTaskFile(taskId: string, fileName: string): Promise<void> {\n try {\n const filePath = this.getTaskFilePath(taskId, fileName);\n await fs.unlink(filePath);\n } catch (error) {\n if ((error as NodeJS.ErrnoException).code !== \"ENOENT\") {\n throw error;\n }\n }\n }\n\n async taskDirectoryExists(taskId: string): Promise<boolean> {\n try {\n const taskDir = this.getTaskDirectory(taskId);\n await fs.access(taskDir);\n return true;\n } catch {\n return false;\n }\n }\n\n async cleanupTaskDirectory(taskId: string): Promise<void> {\n try {\n const taskDir = this.getTaskDirectory(taskId);\n await fs.rm(taskDir, { recursive: true, force: true });\n } catch (error) {\n if ((error as NodeJS.ErrnoException).code !== \"ENOENT\") {\n throw error;\n }\n }\n }\n\n // Convenience methods for common file types\n async writePlan(taskId: string, plan: string): Promise<void> {\n this.logger.debug(\"Writing plan\", {\n taskId,\n planLength: plan.length,\n contentPreview: plan.substring(0, 200),\n });\n\n await this.writeTaskFile(taskId, {\n name: \"plan.md\",\n content: plan,\n type: \"plan\",\n });\n\n this.logger.info(\"Plan file written\", { taskId });\n }\n\n async readPlan(taskId: string): Promise<string | null> {\n return await this.readTaskFile(taskId, \"plan.md\");\n }\n\n async writeContext(taskId: string, context: string): Promise<void> {\n await this.writeTaskFile(taskId, {\n name: \"context.md\",\n content: context,\n type: \"context\",\n });\n }\n\n async readContext(taskId: string): Promise<string | null> {\n return await this.readTaskFile(taskId, \"context.md\");\n }\n\n async writeRequirements(taskId: string, requirements: string): Promise<void> {\n await this.writeTaskFile(taskId, {\n name: \"requirements.md\",\n content: requirements,\n type: \"reference\",\n });\n }\n\n async readRequirements(taskId: string): Promise<string | null> {\n return await this.readTaskFile(taskId, \"requirements.md\");\n }\n\n async writeResearch(taskId: string, data: ResearchEvaluation): Promise<void> {\n this.logger.debug(\"Writing research\", {\n taskId,\n score: data.actionabilityScore,\n hasQuestions: !!data.questions,\n questionCount: data.questions?.length ?? 0,\n answered: data.answered ?? false,\n });\n\n await this.writeTaskFile(taskId, {\n name: \"research.json\",\n content: JSON.stringify(data, null, 2),\n type: \"artifact\",\n });\n\n this.logger.info(\"Research file written\", {\n taskId,\n score: data.actionabilityScore,\n hasQuestions: !!data.questions,\n answered: data.answered ?? false,\n });\n }\n\n async readResearch(taskId: string): Promise<ResearchEvaluation | null> {\n try {\n const content = await this.readTaskFile(taskId, \"research.json\");\n return content ? (JSON.parse(content) as ResearchEvaluation) : null;\n } catch (error) {\n this.logger.debug(\"Failed to parse research.json\", { error });\n return null;\n }\n }\n\n async writeTodos(taskId: string, data: unknown): Promise<void> {\n const todos = z.object({\n metadata: z.object({\n total: z.number(),\n completed: z.number(),\n }),\n });\n\n const validatedData = todos.parse(data);\n this.logger.debug(\"Writing todos\", {\n taskId,\n total: validatedData.metadata?.total ?? 0,\n completed: validatedData.metadata?.completed ?? 0,\n });\n\n await this.writeTaskFile(taskId, {\n name: \"todos.json\",\n content: JSON.stringify(validatedData, null, 2),\n type: \"artifact\",\n });\n\n this.logger.info(\"Todos file written\", {\n taskId,\n total: validatedData.metadata?.total ?? 0,\n completed: validatedData.metadata?.completed ?? 0,\n });\n }\n\n async readTodos(taskId: string): Promise<unknown | null> {\n try {\n const content = await this.readTaskFile(taskId, \"todos.json\");\n return content ? JSON.parse(content) : null;\n } catch (error) {\n this.logger.debug(\"Failed to parse todos.json\", { error });\n return null;\n }\n }\n\n async getTaskFiles(taskId: string): Promise<SupportingFile[]> {\n const fileNames = await this.listTaskFiles(taskId);\n const files: SupportingFile[] = [];\n\n for (const fileName of fileNames) {\n const content = await this.readTaskFile(taskId, fileName);\n if (content !== null) {\n // Determine type based on file name\n const type = this.resolveFileType(fileName);\n\n files.push({\n name: fileName,\n content,\n type,\n created_at: new Date().toISOString(), // Could be enhanced with file stats\n });\n }\n }\n\n return files;\n }\n\n async collectTaskArtifacts(taskId: string): Promise<LocalArtifact[]> {\n const fileNames = await this.listTaskFiles(taskId);\n const artifacts: LocalArtifact[] = [];\n\n for (const fileName of fileNames) {\n const content = await this.readTaskFile(taskId, fileName);\n if (content === null) {\n continue;\n }\n\n const type = this.resolveFileType(fileName);\n const contentType = this.inferContentType(fileName);\n const size = Buffer.byteLength(content, \"utf8\");\n\n artifacts.push({\n name: fileName,\n content,\n type,\n contentType,\n size,\n });\n }\n\n return artifacts;\n }\n\n private resolveFileType(fileName: string): TaskFile[\"type\"] {\n if (fileName === \"plan.md\") return \"plan\";\n if (fileName === \"context.md\") return \"context\";\n if (fileName === \"requirements.md\") return \"reference\";\n if (fileName.startsWith(\"output_\")) return \"output\";\n if (fileName.endsWith(\".md\")) return \"reference\";\n return \"artifact\";\n }\n\n private inferContentType(fileName: string): string {\n const extension = extname(fileName).toLowerCase();\n switch (extension) {\n case \".md\":\n return \"text/markdown\";\n case \".json\":\n return \"application/json\";\n case \".txt\":\n return \"text/plain\";\n default:\n return \"text/plain\";\n }\n }\n}\n"],"names":["fs"],"mappings":";;;;;MAoBa,kBAAkB,CAAA;AACrB,IAAA,cAAc;AACd,IAAA,MAAM;IAEd,WAAA,CAAY,cAAsB,EAAE,MAAe,EAAA;AACjD,QAAA,IAAI,CAAC,cAAc,GAAG,cAAc;AACpC,QAAA,IAAI,CAAC,MAAM;AACT,YAAA,MAAM,IAAI,IAAI,MAAM,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,eAAe,EAAE,CAAC;IACnE;AAEQ,IAAA,gBAAgB,CAAC,MAAc,EAAA;QACrC,OAAO,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,UAAU,EAAE,MAAM,CAAC;IACtD;IAEQ,eAAe,CAAC,MAAc,EAAE,QAAgB,EAAA;QACtD,OAAO,IAAI,CAAC,IAAI,CAAC,gBAAgB,CAAC,MAAM,CAAC,EAAE,QAAQ,CAAC;IACtD;IAEA,MAAM,mBAAmB,CAAC,MAAc,EAAA;QACtC,MAAM,OAAO,GAAG,IAAI,CAAC,gBAAgB,CAAC,MAAM,CAAC;AAC7C,QAAA,IAAI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,MAAM,CAAC,UAAU,CAAC,OAAO,EAAE,MAAM,CAAC;YAE/C,SAAS,CAAC,IAAI,CAAC;AACb,gBAAA,IAAI,EAAE,QAAQ;gBACd,OAAO;gBACP,IAAI;gBACJ,WAAW;gBACX,IAAI;AACL,aAAA,CAAC;QACJ;AAEA,QAAA,OAAO,SAAS;IAClB;AAEQ,IAAA,eAAe,CAAC,QAAgB,EAAA;QACtC,IAAI,QAAQ,KAAK,SAAS;AAAE,YAAA,OAAO,MAAM;QACzC,IAAI,QAAQ,KAAK,YAAY;AAAE,YAAA,OAAO,SAAS;QAC/C,IAAI,QAAQ,KAAK,iBAAiB;AAAE,YAAA,OAAO,WAAW;AACtD,QAAA,IAAI,QAAQ,CAAC,UAAU,CAAC,SAAS,CAAC;AAAE,YAAA,OAAO,QAAQ;AACnD,QAAA,IAAI,QAAQ,CAAC,QAAQ,CAAC,KAAK,CAAC;AAAE,YAAA,OAAO,WAAW;AAChD,QAAA,OAAO,UAAU;IACnB;AAEQ,IAAA,gBAAgB,CAAC,QAAgB,EAAA;QACvC,MAAM,SAAS,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC,WAAW,EAAE;QACjD,QAAQ,SAAS;AACf,YAAA,KAAK,KAAK;AACR,gBAAA,OAAO,eAAe;AACxB,YAAA,KAAK,OAAO;AACV,gBAAA,OAAO,kBAAkB;AAC3B,YAAA,KAAK,MAAM;AACT,gBAAA,OAAO,YAAY;AACrB,YAAA;AACE,gBAAA,OAAO,YAAY;;IAEzB;AACD;;;;"}
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
import { Logger } from "./utils/logger.js";
|
|
2
|
-
export interface GitConfig {
|
|
3
|
-
repositoryPath: string;
|
|
4
|
-
authorName?: string;
|
|
5
|
-
authorEmail?: string;
|
|
6
|
-
logger?: Logger;
|
|
7
|
-
}
|
|
8
|
-
export interface BranchInfo {
|
|
9
|
-
name: string;
|
|
10
|
-
exists: boolean;
|
|
11
|
-
isCurrentBranch: boolean;
|
|
12
|
-
}
|
|
13
|
-
export declare class GitManager {
|
|
14
|
-
private repositoryPath;
|
|
15
|
-
private authorName?;
|
|
16
|
-
private authorEmail?;
|
|
17
|
-
private logger;
|
|
18
|
-
constructor(config: GitConfig);
|
|
19
|
-
private escapeShellArg;
|
|
20
|
-
private runGitCommand;
|
|
21
|
-
private runCommand;
|
|
22
|
-
isGitRepository(): Promise<boolean>;
|
|
23
|
-
getCurrentBranch(): Promise<string>;
|
|
24
|
-
getDefaultBranch(): Promise<string>;
|
|
25
|
-
branchExists(branchName: string): Promise<boolean>;
|
|
26
|
-
createBranch(branchName: string, baseBranch?: string): Promise<void>;
|
|
27
|
-
switchToBranch(branchName: string): Promise<void>;
|
|
28
|
-
resetToDefaultBranchIfNeeded(): Promise<boolean>;
|
|
29
|
-
createOrSwitchToBranch(branchName: string, baseBranch?: string): Promise<void>;
|
|
30
|
-
addFiles(paths: string[]): Promise<void>;
|
|
31
|
-
addAllPostHogFiles(): Promise<void>;
|
|
32
|
-
commitChanges(message: string, options?: {
|
|
33
|
-
authorName?: string;
|
|
34
|
-
authorEmail?: string;
|
|
35
|
-
}): Promise<string>;
|
|
36
|
-
hasChanges(): Promise<boolean>;
|
|
37
|
-
hasStagedChanges(): Promise<boolean>;
|
|
38
|
-
private ensureCleanWorkingDirectory;
|
|
39
|
-
private generateUniqueBranchName;
|
|
40
|
-
private ensureOnDefaultBranch;
|
|
41
|
-
private buildCommitCommand;
|
|
42
|
-
getRemoteUrl(): Promise<string | null>;
|
|
43
|
-
pushBranch(branchName: string, force?: boolean): Promise<void>;
|
|
44
|
-
/**
|
|
45
|
-
* Tracks whether commits were made during an operation by comparing HEAD SHA
|
|
46
|
-
* before and after. Returns an object with methods to finalize the operation.
|
|
47
|
-
*
|
|
48
|
-
* Usage:
|
|
49
|
-
* const tracker = await gitManager.trackCommitsDuring();
|
|
50
|
-
* // ... do work that might create commits ...
|
|
51
|
-
* const result = await tracker.finalize({ commitMessage: 'fallback message', push: true });
|
|
52
|
-
*/
|
|
53
|
-
trackCommitsDuring(): Promise<{
|
|
54
|
-
finalize: (options: {
|
|
55
|
-
commitMessage: string;
|
|
56
|
-
push?: boolean;
|
|
57
|
-
}) => Promise<{
|
|
58
|
-
commitCreated: boolean;
|
|
59
|
-
pushedBranch: boolean;
|
|
60
|
-
}>;
|
|
61
|
-
}>;
|
|
62
|
-
createTaskBranch(taskSlug: string): Promise<string>;
|
|
63
|
-
createTaskPlanningBranch(taskId: string, baseBranch?: string): Promise<string>;
|
|
64
|
-
createTaskImplementationBranch(taskId: string, planningBranchName?: string): Promise<string>;
|
|
65
|
-
commitPlan(taskId: string, taskTitle: string): Promise<string>;
|
|
66
|
-
commitImplementation(taskId: string, taskTitle: string, planSummary?: string): Promise<string>;
|
|
67
|
-
deleteBranch(branchName: string, force?: boolean): Promise<void>;
|
|
68
|
-
deleteRemoteBranch(branchName: string): Promise<void>;
|
|
69
|
-
getBranchInfo(branchName: string): Promise<BranchInfo>;
|
|
70
|
-
getCommitSha(ref?: string): Promise<string>;
|
|
71
|
-
getCommitMessage(ref?: string): Promise<string>;
|
|
72
|
-
createPullRequest(branchName: string, title: string, body: string, baseBranch?: string): Promise<string>;
|
|
73
|
-
getTaskBranch(taskSlug: string): Promise<string | null>;
|
|
74
|
-
commitAndPush(message: string, options?: {
|
|
75
|
-
allowEmpty?: boolean;
|
|
76
|
-
}): Promise<void>;
|
|
77
|
-
isWorktree(): Promise<boolean>;
|
|
78
|
-
}
|
|
79
|
-
//# sourceMappingURL=git-manager.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"git-manager.d.ts","sourceRoot":"","sources":["../../src/git-manager.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAI3C,MAAM,WAAW,SAAS;IACxB,cAAc,EAAE,MAAM,CAAC;IACvB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;I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