@gitgov/core 1.0.1 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +31 -31
- package/dist/src/index.d.ts +5475 -21
- package/dist/src/index.js +7873 -22
- package/dist/src/index.js.map +1 -1
- package/package.json +17 -5
- package/dist/scripts/compile-json-to-types.d.ts +0 -11
- package/dist/scripts/compile-json-to-types.d.ts.map +0 -1
- package/dist/scripts/compile-json-to-types.js +0 -129
- package/dist/scripts/compile-json-to-types.js.map +0 -1
- package/dist/scripts/diagnose-duplicates.d.ts +0 -7
- package/dist/scripts/diagnose-duplicates.d.ts.map +0 -1
- package/dist/scripts/diagnose-duplicates.js +0 -72
- package/dist/scripts/diagnose-duplicates.js.map +0 -1
- package/dist/scripts/generate-indexes.d.ts +0 -22
- package/dist/scripts/generate-indexes.d.ts.map +0 -1
- package/dist/scripts/generate-indexes.js +0 -168
- package/dist/scripts/generate-indexes.js.map +0 -1
- package/dist/scripts/sync-schemas.d.ts +0 -10
- package/dist/scripts/sync-schemas.d.ts.map +0 -1
- package/dist/scripts/sync-schemas.js +0 -84
- package/dist/scripts/sync-schemas.js.map +0 -1
- package/dist/scripts/sync-workflow-configs.d.ts +0 -11
- package/dist/scripts/sync-workflow-configs.d.ts.map +0 -1
- package/dist/scripts/sync-workflow-configs.js +0 -61
- package/dist/scripts/sync-workflow-configs.js.map +0 -1
- package/dist/scripts/update-diagram.d.ts +0 -7
- package/dist/scripts/update-diagram.d.ts.map +0 -1
- package/dist/scripts/update-diagram.js +0 -47
- package/dist/scripts/update-diagram.js.map +0 -1
- package/dist/scripts/validate-schemas.d.ts +0 -18
- package/dist/scripts/validate-schemas.d.ts.map +0 -1
- package/dist/scripts/validate-schemas.js +0 -313
- package/dist/scripts/validate-schemas.js.map +0 -1
- package/dist/src/adapters/backlog_adapter/backlog_adapter.integration.test.d.ts +0 -2
- package/dist/src/adapters/backlog_adapter/backlog_adapter.integration.test.d.ts.map +0 -1
- package/dist/src/adapters/backlog_adapter/backlog_adapter.integration.test.js +0 -507
- package/dist/src/adapters/backlog_adapter/backlog_adapter.integration.test.js.map +0 -1
- package/dist/src/adapters/backlog_adapter/backlog_adapter.test.d.ts +0 -2
- package/dist/src/adapters/backlog_adapter/backlog_adapter.test.d.ts.map +0 -1
- package/dist/src/adapters/backlog_adapter/backlog_adapter.test.js +0 -1282
- package/dist/src/adapters/backlog_adapter/backlog_adapter.test.js.map +0 -1
- package/dist/src/adapters/backlog_adapter/backlog_adapter_e2e.test.d.ts +0 -10
- package/dist/src/adapters/backlog_adapter/backlog_adapter_e2e.test.d.ts.map +0 -1
- package/dist/src/adapters/backlog_adapter/backlog_adapter_e2e.test.js +0 -144
- package/dist/src/adapters/backlog_adapter/backlog_adapter_e2e.test.js.map +0 -1
- package/dist/src/adapters/backlog_adapter/index.d.ts +0 -213
- package/dist/src/adapters/backlog_adapter/index.d.ts.map +0 -1
- package/dist/src/adapters/backlog_adapter/index.js +0 -924
- package/dist/src/adapters/backlog_adapter/index.js.map +0 -1
- package/dist/src/adapters/changelog_adapter/changelog_adapter.test.d.ts +0 -2
- package/dist/src/adapters/changelog_adapter/changelog_adapter.test.d.ts.map +0 -1
- package/dist/src/adapters/changelog_adapter/changelog_adapter.test.js +0 -505
- package/dist/src/adapters/changelog_adapter/changelog_adapter.test.js.map +0 -1
- package/dist/src/adapters/changelog_adapter/index.d.ts +0 -101
- package/dist/src/adapters/changelog_adapter/index.d.ts.map +0 -1
- package/dist/src/adapters/changelog_adapter/index.js +0 -197
- package/dist/src/adapters/changelog_adapter/index.js.map +0 -1
- package/dist/src/adapters/execution_adapter/execution_adapter.test.d.ts +0 -2
- package/dist/src/adapters/execution_adapter/execution_adapter.test.d.ts.map +0 -1
- package/dist/src/adapters/execution_adapter/execution_adapter.test.js +0 -266
- package/dist/src/adapters/execution_adapter/execution_adapter.test.js.map +0 -1
- package/dist/src/adapters/execution_adapter/index.d.ts +0 -90
- package/dist/src/adapters/execution_adapter/index.d.ts.map +0 -1
- package/dist/src/adapters/execution_adapter/index.js +0 -150
- package/dist/src/adapters/execution_adapter/index.js.map +0 -1
- package/dist/src/adapters/feedback_adapter/feedback_adapter.test.d.ts +0 -2
- package/dist/src/adapters/feedback_adapter/feedback_adapter.test.d.ts.map +0 -1
- package/dist/src/adapters/feedback_adapter/feedback_adapter.test.js +0 -256
- package/dist/src/adapters/feedback_adapter/feedback_adapter.test.js.map +0 -1
- package/dist/src/adapters/feedback_adapter/index.d.ts +0 -95
- package/dist/src/adapters/feedback_adapter/index.d.ts.map +0 -1
- package/dist/src/adapters/feedback_adapter/index.js +0 -192
- package/dist/src/adapters/feedback_adapter/index.js.map +0 -1
- package/dist/src/adapters/identity_adapter/identity_adapter.test.d.ts +0 -2
- package/dist/src/adapters/identity_adapter/identity_adapter.test.d.ts.map +0 -1
- package/dist/src/adapters/identity_adapter/identity_adapter.test.js +0 -624
- package/dist/src/adapters/identity_adapter/identity_adapter.test.js.map +0 -1
- package/dist/src/adapters/identity_adapter/index.d.ts +0 -82
- package/dist/src/adapters/identity_adapter/index.d.ts.map +0 -1
- package/dist/src/adapters/identity_adapter/index.js +0 -336
- package/dist/src/adapters/identity_adapter/index.js.map +0 -1
- package/dist/src/adapters/index.d.ts +0 -10
- package/dist/src/adapters/index.d.ts.map +0 -1
- package/dist/src/adapters/index.js +0 -10
- package/dist/src/adapters/index.js.map +0 -1
- package/dist/src/adapters/indexer_adapter/index.d.ts +0 -214
- package/dist/src/adapters/indexer_adapter/index.d.ts.map +0 -1
- package/dist/src/adapters/indexer_adapter/index.js +0 -643
- package/dist/src/adapters/indexer_adapter/index.js.map +0 -1
- package/dist/src/adapters/indexer_adapter/indexer_adapter.test.d.ts +0 -2
- package/dist/src/adapters/indexer_adapter/indexer_adapter.test.d.ts.map +0 -1
- package/dist/src/adapters/indexer_adapter/indexer_adapter.test.js +0 -409
- package/dist/src/adapters/indexer_adapter/indexer_adapter.test.js.map +0 -1
- package/dist/src/adapters/metrics_adapter/index.d.ts +0 -189
- package/dist/src/adapters/metrics_adapter/index.d.ts.map +0 -1
- package/dist/src/adapters/metrics_adapter/index.js +0 -592
- package/dist/src/adapters/metrics_adapter/index.js.map +0 -1
- package/dist/src/adapters/metrics_adapter/metrics_adapter.test.d.ts +0 -2
- package/dist/src/adapters/metrics_adapter/metrics_adapter.test.d.ts.map +0 -1
- package/dist/src/adapters/metrics_adapter/metrics_adapter.test.js +0 -558
- package/dist/src/adapters/metrics_adapter/metrics_adapter.test.js.map +0 -1
- package/dist/src/adapters/project_adapter/index.d.ts +0 -164
- package/dist/src/adapters/project_adapter/index.d.ts.map +0 -1
- package/dist/src/adapters/project_adapter/index.js +0 -445
- package/dist/src/adapters/project_adapter/index.js.map +0 -1
- package/dist/src/adapters/project_adapter/project_adapter.test.d.ts +0 -2
- package/dist/src/adapters/project_adapter/project_adapter.test.d.ts.map +0 -1
- package/dist/src/adapters/project_adapter/project_adapter.test.js +0 -627
- package/dist/src/adapters/project_adapter/project_adapter.test.js.map +0 -1
- package/dist/src/adapters/workflow_methodology_adapter/index.d.ts +0 -75
- package/dist/src/adapters/workflow_methodology_adapter/index.d.ts.map +0 -1
- package/dist/src/adapters/workflow_methodology_adapter/index.js +0 -205
- package/dist/src/adapters/workflow_methodology_adapter/index.js.map +0 -1
- package/dist/src/adapters/workflow_methodology_adapter/workflow_methodology_adapter.test.d.ts +0 -2
- package/dist/src/adapters/workflow_methodology_adapter/workflow_methodology_adapter.test.d.ts.map +0 -1
- package/dist/src/adapters/workflow_methodology_adapter/workflow_methodology_adapter.test.js +0 -463
- package/dist/src/adapters/workflow_methodology_adapter/workflow_methodology_adapter.test.js.map +0 -1
- package/dist/src/adapters/workflow_methodology_adapter/workflow_methodology_adapter_integration.test.d.ts +0 -2
- package/dist/src/adapters/workflow_methodology_adapter/workflow_methodology_adapter_integration.test.d.ts.map +0 -1
- package/dist/src/adapters/workflow_methodology_adapter/workflow_methodology_adapter_integration.test.js +0 -287
- package/dist/src/adapters/workflow_methodology_adapter/workflow_methodology_adapter_integration.test.js.map +0 -1
- package/dist/src/adapters/workflow_methodology_adapter/workflow_methodology_adapter_scrum_integration.test.d.ts +0 -2
- package/dist/src/adapters/workflow_methodology_adapter/workflow_methodology_adapter_scrum_integration.test.d.ts.map +0 -1
- package/dist/src/adapters/workflow_methodology_adapter/workflow_methodology_adapter_scrum_integration.test.js +0 -278
- package/dist/src/adapters/workflow_methodology_adapter/workflow_methodology_adapter_scrum_integration.test.js.map +0 -1
- package/dist/src/adapters/workflow_methodology_adapter/workflow_methodology_default.json +0 -188
- package/dist/src/adapters/workflow_methodology_adapter/workflow_methodology_scrum.json +0 -284
- package/dist/src/config_manager/config_manager.test.d.ts +0 -2
- package/dist/src/config_manager/config_manager.test.d.ts.map +0 -1
- package/dist/src/config_manager/config_manager.test.js +0 -321
- package/dist/src/config_manager/config_manager.test.js.map +0 -1
- package/dist/src/config_manager/index.d.ts +0 -107
- package/dist/src/config_manager/index.d.ts.map +0 -1
- package/dist/src/config_manager/index.js +0 -192
- package/dist/src/config_manager/index.js.map +0 -1
- package/dist/src/crypto/checksum.d.ts +0 -6
- package/dist/src/crypto/checksum.d.ts.map +0 -1
- package/dist/src/crypto/checksum.js +0 -38
- package/dist/src/crypto/checksum.js.map +0 -1
- package/dist/src/crypto/checksum.test.d.ts +0 -2
- package/dist/src/crypto/checksum.test.d.ts.map +0 -1
- package/dist/src/crypto/checksum.test.js +0 -167
- package/dist/src/crypto/checksum.test.js.map +0 -1
- package/dist/src/crypto/index.d.ts +0 -3
- package/dist/src/crypto/index.d.ts.map +0 -1
- package/dist/src/crypto/index.js +0 -3
- package/dist/src/crypto/index.js.map +0 -1
- package/dist/src/crypto/signatures.d.ts +0 -24
- package/dist/src/crypto/signatures.d.ts.map +0 -1
- package/dist/src/crypto/signatures.js +0 -67
- package/dist/src/crypto/signatures.js.map +0 -1
- package/dist/src/crypto/signatures.test.d.ts +0 -2
- package/dist/src/crypto/signatures.test.d.ts.map +0 -1
- package/dist/src/crypto/signatures.test.js +0 -378
- package/dist/src/crypto/signatures.test.js.map +0 -1
- package/dist/src/diagram_generator/diagram_generator.d.ts +0 -76
- package/dist/src/diagram_generator/diagram_generator.d.ts.map +0 -1
- package/dist/src/diagram_generator/diagram_generator.js +0 -233
- package/dist/src/diagram_generator/diagram_generator.js.map +0 -1
- package/dist/src/diagram_generator/graph_validator.d.ts +0 -19
- package/dist/src/diagram_generator/graph_validator.d.ts.map +0 -1
- package/dist/src/diagram_generator/graph_validator.js +0 -98
- package/dist/src/diagram_generator/graph_validator.js.map +0 -1
- package/dist/src/diagram_generator/index.d.ts +0 -4
- package/dist/src/diagram_generator/index.d.ts.map +0 -1
- package/dist/src/diagram_generator/index.js +0 -4
- package/dist/src/diagram_generator/index.js.map +0 -1
- package/dist/src/diagram_generator/mermaid_renderer.d.ts +0 -82
- package/dist/src/diagram_generator/mermaid_renderer.d.ts.map +0 -1
- package/dist/src/diagram_generator/mermaid_renderer.js +0 -306
- package/dist/src/diagram_generator/mermaid_renderer.js.map +0 -1
- package/dist/src/diagram_generator/relationship_analyzer.d.ts +0 -116
- package/dist/src/diagram_generator/relationship_analyzer.d.ts.map +0 -1
- package/dist/src/diagram_generator/relationship_analyzer.js +0 -381
- package/dist/src/diagram_generator/relationship_analyzer.js.map +0 -1
- package/dist/src/event_bus/event_bus.d.ts +0 -110
- package/dist/src/event_bus/event_bus.d.ts.map +0 -1
- package/dist/src/event_bus/event_bus.js +0 -161
- package/dist/src/event_bus/event_bus.js.map +0 -1
- package/dist/src/event_bus/event_bus.test.d.ts +0 -2
- package/dist/src/event_bus/event_bus.test.d.ts.map +0 -1
- package/dist/src/event_bus/event_bus.test.js +0 -332
- package/dist/src/event_bus/event_bus.test.js.map +0 -1
- package/dist/src/event_bus/event_bus_integration.test.d.ts +0 -2
- package/dist/src/event_bus/event_bus_integration.test.d.ts.map +0 -1
- package/dist/src/event_bus/event_bus_integration.test.js +0 -474
- package/dist/src/event_bus/event_bus_integration.test.js.map +0 -1
- package/dist/src/event_bus/index.d.ts +0 -3
- package/dist/src/event_bus/index.d.ts.map +0 -1
- package/dist/src/event_bus/index.js +0 -3
- package/dist/src/event_bus/index.js.map +0 -1
- package/dist/src/event_bus/types.d.ts +0 -203
- package/dist/src/event_bus/types.d.ts.map +0 -1
- package/dist/src/event_bus/types.js +0 -5
- package/dist/src/event_bus/types.js.map +0 -1
- package/dist/src/factories/actor_factory.d.ts +0 -6
- package/dist/src/factories/actor_factory.d.ts.map +0 -1
- package/dist/src/factories/actor_factory.js +0 -25
- package/dist/src/factories/actor_factory.js.map +0 -1
- package/dist/src/factories/actor_factory.test.d.ts +0 -2
- package/dist/src/factories/actor_factory.test.d.ts.map +0 -1
- package/dist/src/factories/actor_factory.test.js +0 -169
- package/dist/src/factories/actor_factory.test.js.map +0 -1
- package/dist/src/factories/agent_factory.d.ts +0 -6
- package/dist/src/factories/agent_factory.d.ts.map +0 -1
- package/dist/src/factories/agent_factory.js +0 -25
- package/dist/src/factories/agent_factory.js.map +0 -1
- package/dist/src/factories/agent_factory.test.d.ts +0 -2
- package/dist/src/factories/agent_factory.test.d.ts.map +0 -1
- package/dist/src/factories/agent_factory.test.js +0 -199
- package/dist/src/factories/agent_factory.test.js.map +0 -1
- package/dist/src/factories/changelog_factory.d.ts +0 -9
- package/dist/src/factories/changelog_factory.d.ts.map +0 -1
- package/dist/src/factories/changelog_factory.js +0 -46
- package/dist/src/factories/changelog_factory.js.map +0 -1
- package/dist/src/factories/changelog_factory.test.d.ts +0 -2
- package/dist/src/factories/changelog_factory.test.d.ts.map +0 -1
- package/dist/src/factories/changelog_factory.test.js +0 -368
- package/dist/src/factories/changelog_factory.test.js.map +0 -1
- package/dist/src/factories/cycle_factory.d.ts +0 -6
- package/dist/src/factories/cycle_factory.d.ts.map +0 -1
- package/dist/src/factories/cycle_factory.js +0 -28
- package/dist/src/factories/cycle_factory.js.map +0 -1
- package/dist/src/factories/cycle_factory.test.d.ts +0 -2
- package/dist/src/factories/cycle_factory.test.d.ts.map +0 -1
- package/dist/src/factories/cycle_factory.test.js +0 -175
- package/dist/src/factories/cycle_factory.test.js.map +0 -1
- package/dist/src/factories/execution_factory.d.ts +0 -9
- package/dist/src/factories/execution_factory.d.ts.map +0 -1
- package/dist/src/factories/execution_factory.js +0 -29
- package/dist/src/factories/execution_factory.js.map +0 -1
- package/dist/src/factories/execution_factory.test.d.ts +0 -2
- package/dist/src/factories/execution_factory.test.d.ts.map +0 -1
- package/dist/src/factories/execution_factory.test.js +0 -207
- package/dist/src/factories/execution_factory.test.js.map +0 -1
- package/dist/src/factories/feedback_factory.d.ts +0 -9
- package/dist/src/factories/feedback_factory.d.ts.map +0 -1
- package/dist/src/factories/feedback_factory.js +0 -30
- package/dist/src/factories/feedback_factory.js.map +0 -1
- package/dist/src/factories/feedback_factory.test.d.ts +0 -2
- package/dist/src/factories/feedback_factory.test.d.ts.map +0 -1
- package/dist/src/factories/feedback_factory.test.js +0 -256
- package/dist/src/factories/feedback_factory.test.js.map +0 -1
- package/dist/src/factories/index.d.ts +0 -9
- package/dist/src/factories/index.d.ts.map +0 -1
- package/dist/src/factories/index.js +0 -9
- package/dist/src/factories/index.js.map +0 -1
- package/dist/src/factories/task_factory.d.ts +0 -6
- package/dist/src/factories/task_factory.d.ts.map +0 -1
- package/dist/src/factories/task_factory.js +0 -30
- package/dist/src/factories/task_factory.js.map +0 -1
- package/dist/src/factories/task_factory.test.d.ts +0 -2
- package/dist/src/factories/task_factory.test.d.ts.map +0 -1
- package/dist/src/factories/task_factory.test.js +0 -197
- package/dist/src/factories/task_factory.test.js.map +0 -1
- package/dist/src/factories/workflow_methodology_factory.d.ts +0 -11
- package/dist/src/factories/workflow_methodology_factory.d.ts.map +0 -1
- package/dist/src/factories/workflow_methodology_factory.js +0 -173
- package/dist/src/factories/workflow_methodology_factory.js.map +0 -1
- package/dist/src/factories/workflow_methodology_factory.test.d.ts +0 -2
- package/dist/src/factories/workflow_methodology_factory.test.d.ts.map +0 -1
- package/dist/src/factories/workflow_methodology_factory.test.js +0 -244
- package/dist/src/factories/workflow_methodology_factory.test.js.map +0 -1
- package/dist/src/index.d.ts.map +0 -1
- package/dist/src/integration/cycles_tasks_integration.test.d.ts +0 -2
- package/dist/src/integration/cycles_tasks_integration.test.d.ts.map +0 -1
- package/dist/src/integration/cycles_tasks_integration.test.js +0 -258
- package/dist/src/integration/cycles_tasks_integration.test.js.map +0 -1
- package/dist/src/integration/schema_integration.test.d.ts +0 -8
- package/dist/src/integration/schema_integration.test.d.ts.map +0 -1
- package/dist/src/integration/schema_integration.test.js +0 -279
- package/dist/src/integration/schema_integration.test.js.map +0 -1
- package/dist/src/logger/index.d.ts +0 -2
- package/dist/src/logger/index.d.ts.map +0 -1
- package/dist/src/logger/index.js +0 -2
- package/dist/src/logger/index.js.map +0 -1
- package/dist/src/logger/logger.d.ts +0 -10
- package/dist/src/logger/logger.d.ts.map +0 -1
- package/dist/src/logger/logger.js +0 -48
- package/dist/src/logger/logger.js.map +0 -1
- package/dist/src/schemas/errors.d.ts +0 -28
- package/dist/src/schemas/errors.d.ts.map +0 -1
- package/dist/src/schemas/errors.js +0 -31
- package/dist/src/schemas/errors.js.map +0 -1
- package/dist/src/schemas/generated/actor_record_schema.json +0 -91
- package/dist/src/schemas/generated/agent_record_schema.json +0 -142
- package/dist/src/schemas/generated/changelog_record_schema.json +0 -227
- package/dist/src/schemas/generated/cycle_record_schema.json +0 -80
- package/dist/src/schemas/generated/embedded_metadata_schema.json +0 -318
- package/dist/src/schemas/generated/execution_record_schema.json +0 -89
- package/dist/src/schemas/generated/feedback_record_schema.json +0 -83
- package/dist/src/schemas/generated/index.d.ts +0 -2221
- package/dist/src/schemas/generated/index.d.ts.map +0 -1
- package/dist/src/schemas/generated/index.js +0 -48
- package/dist/src/schemas/generated/index.js.map +0 -1
- package/dist/src/schemas/generated/task_record_schema.json +0 -103
- package/dist/src/schemas/generated/workflow_methodology_record_schema.json +0 -393
- package/dist/src/schemas/index.d.ts +0 -4
- package/dist/src/schemas/index.d.ts.map +0 -1
- package/dist/src/schemas/index.js +0 -4
- package/dist/src/schemas/index.js.map +0 -1
- package/dist/src/schemas/schema_cache.d.ts +0 -39
- package/dist/src/schemas/schema_cache.d.ts.map +0 -1
- package/dist/src/schemas/schema_cache.js +0 -109
- package/dist/src/schemas/schema_cache.js.map +0 -1
- package/dist/src/schemas/schema_cache.test.d.ts +0 -2
- package/dist/src/schemas/schema_cache.test.d.ts.map +0 -1
- package/dist/src/schemas/schema_cache.test.js +0 -163
- package/dist/src/schemas/schema_cache.test.js.map +0 -1
- package/dist/src/store/index.d.ts +0 -2
- package/dist/src/store/index.d.ts.map +0 -1
- package/dist/src/store/index.js +0 -2
- package/dist/src/store/index.js.map +0 -1
- package/dist/src/store/record_store.d.ts +0 -30
- package/dist/src/store/record_store.d.ts.map +0 -1
- package/dist/src/store/record_store.js +0 -83
- package/dist/src/store/record_store.js.map +0 -1
- package/dist/src/store/record_store.test.d.ts +0 -2
- package/dist/src/store/record_store.test.d.ts.map +0 -1
- package/dist/src/store/record_store.test.js +0 -646
- package/dist/src/store/record_store.test.js.map +0 -1
- package/dist/src/types/common.types.d.ts +0 -43
- package/dist/src/types/common.types.d.ts.map +0 -1
- package/dist/src/types/common.types.js +0 -13
- package/dist/src/types/common.types.js.map +0 -1
- package/dist/src/types/embedded.types.d.ts +0 -17
- package/dist/src/types/embedded.types.d.ts.map +0 -1
- package/dist/src/types/embedded.types.js +0 -2
- package/dist/src/types/embedded.types.js.map +0 -1
- package/dist/src/types/generated/actor_record.d.ts +0 -45
- package/dist/src/types/generated/actor_record.d.ts.map +0 -1
- package/dist/src/types/generated/actor_record.js +0 -7
- package/dist/src/types/generated/actor_record.js.map +0 -1
- package/dist/src/types/generated/agent_record.d.ts +0 -40
- package/dist/src/types/generated/agent_record.d.ts.map +0 -1
- package/dist/src/types/generated/agent_record.js +0 -7
- package/dist/src/types/generated/agent_record.js.map +0 -1
- package/dist/src/types/generated/changelog_record.d.ts +0 -100
- package/dist/src/types/generated/changelog_record.d.ts.map +0 -1
- package/dist/src/types/generated/changelog_record.js +0 -7
- package/dist/src/types/generated/changelog_record.js.map +0 -1
- package/dist/src/types/generated/cycle_record.d.ts +0 -36
- package/dist/src/types/generated/cycle_record.d.ts.map +0 -1
- package/dist/src/types/generated/cycle_record.js +0 -7
- package/dist/src/types/generated/cycle_record.js.map +0 -1
- package/dist/src/types/generated/embedded_metadata.d.ts +0 -94
- package/dist/src/types/generated/embedded_metadata.d.ts.map +0 -1
- package/dist/src/types/generated/embedded_metadata.js +0 -7
- package/dist/src/types/generated/embedded_metadata.js.map +0 -1
- package/dist/src/types/generated/execution_record.d.ts +0 -39
- package/dist/src/types/generated/execution_record.d.ts.map +0 -1
- package/dist/src/types/generated/execution_record.js +0 -7
- package/dist/src/types/generated/execution_record.js.map +0 -1
- package/dist/src/types/generated/feedback_record.d.ts +0 -43
- package/dist/src/types/generated/feedback_record.d.ts.map +0 -1
- package/dist/src/types/generated/feedback_record.js +0 -7
- package/dist/src/types/generated/feedback_record.js.map +0 -1
- package/dist/src/types/generated/index.d.ts +0 -15
- package/dist/src/types/generated/index.d.ts.map +0 -1
- package/dist/src/types/generated/index.js +0 -15
- package/dist/src/types/generated/index.js.map +0 -1
- package/dist/src/types/generated/task_record.d.ts +0 -47
- package/dist/src/types/generated/task_record.d.ts.map +0 -1
- package/dist/src/types/generated/task_record.js +0 -7
- package/dist/src/types/generated/task_record.js.map +0 -1
- package/dist/src/types/generated/workflow_methodology_record.d.ts +0 -211
- package/dist/src/types/generated/workflow_methodology_record.d.ts.map +0 -1
- package/dist/src/types/generated/workflow_methodology_record.js +0 -7
- package/dist/src/types/generated/workflow_methodology_record.js.map +0 -1
- package/dist/src/types/index.d.ts +0 -4
- package/dist/src/types/index.d.ts.map +0 -1
- package/dist/src/types/index.js +0 -4
- package/dist/src/types/index.js.map +0 -1
- package/dist/src/utils/id_generator.d.ts +0 -44
- package/dist/src/utils/id_generator.d.ts.map +0 -1
- package/dist/src/utils/id_generator.js +0 -107
- package/dist/src/utils/id_generator.js.map +0 -1
- package/dist/src/utils/id_generator.test.d.ts +0 -2
- package/dist/src/utils/id_generator.test.d.ts.map +0 -1
- package/dist/src/utils/id_generator.test.js +0 -100
- package/dist/src/utils/id_generator.test.js.map +0 -1
- package/dist/src/utils/index.d.ts +0 -2
- package/dist/src/utils/index.d.ts.map +0 -1
- package/dist/src/utils/index.js +0 -3
- package/dist/src/utils/index.js.map +0 -1
- package/dist/src/validation/actor_validator.d.ts +0 -21
- package/dist/src/validation/actor_validator.d.ts.map +0 -1
- package/dist/src/validation/actor_validator.js +0 -48
- package/dist/src/validation/actor_validator.js.map +0 -1
- package/dist/src/validation/actor_validator.test.d.ts +0 -2
- package/dist/src/validation/actor_validator.test.d.ts.map +0 -1
- package/dist/src/validation/actor_validator.test.js +0 -83
- package/dist/src/validation/actor_validator.test.js.map +0 -1
- package/dist/src/validation/agent_validator.d.ts +0 -30
- package/dist/src/validation/agent_validator.d.ts.map +0 -1
- package/dist/src/validation/agent_validator.js +0 -66
- package/dist/src/validation/agent_validator.js.map +0 -1
- package/dist/src/validation/agent_validator.test.d.ts +0 -2
- package/dist/src/validation/agent_validator.test.d.ts.map +0 -1
- package/dist/src/validation/agent_validator.test.js +0 -73
- package/dist/src/validation/agent_validator.test.js.map +0 -1
- package/dist/src/validation/changelog_validator.d.ts +0 -23
- package/dist/src/validation/changelog_validator.d.ts.map +0 -1
- package/dist/src/validation/changelog_validator.js +0 -58
- package/dist/src/validation/changelog_validator.js.map +0 -1
- package/dist/src/validation/changelog_validator.test.d.ts +0 -2
- package/dist/src/validation/changelog_validator.test.d.ts.map +0 -1
- package/dist/src/validation/changelog_validator.test.js +0 -401
- package/dist/src/validation/changelog_validator.test.js.map +0 -1
- package/dist/src/validation/common.d.ts +0 -10
- package/dist/src/validation/common.d.ts.map +0 -1
- package/dist/src/validation/common.js +0 -12
- package/dist/src/validation/common.js.map +0 -1
- package/dist/src/validation/cycle_validator.d.ts +0 -24
- package/dist/src/validation/cycle_validator.d.ts.map +0 -1
- package/dist/src/validation/cycle_validator.js +0 -51
- package/dist/src/validation/cycle_validator.js.map +0 -1
- package/dist/src/validation/cycle_validator.test.d.ts +0 -2
- package/dist/src/validation/cycle_validator.test.d.ts.map +0 -1
- package/dist/src/validation/cycle_validator.test.js +0 -182
- package/dist/src/validation/cycle_validator.test.js.map +0 -1
- package/dist/src/validation/embedded_metadata_validator.d.ts +0 -26
- package/dist/src/validation/embedded_metadata_validator.d.ts.map +0 -1
- package/dist/src/validation/embedded_metadata_validator.js +0 -122
- package/dist/src/validation/embedded_metadata_validator.js.map +0 -1
- package/dist/src/validation/embedded_metadata_validator.test.d.ts +0 -2
- package/dist/src/validation/embedded_metadata_validator.test.d.ts.map +0 -1
- package/dist/src/validation/embedded_metadata_validator.test.js +0 -316
- package/dist/src/validation/embedded_metadata_validator.test.js.map +0 -1
- package/dist/src/validation/errors.d.ts +0 -67
- package/dist/src/validation/errors.d.ts.map +0 -1
- package/dist/src/validation/errors.js +0 -83
- package/dist/src/validation/errors.js.map +0 -1
- package/dist/src/validation/execution_validator.d.ts +0 -23
- package/dist/src/validation/execution_validator.d.ts.map +0 -1
- package/dist/src/validation/execution_validator.js +0 -58
- package/dist/src/validation/execution_validator.js.map +0 -1
- package/dist/src/validation/execution_validator.test.d.ts +0 -2
- package/dist/src/validation/execution_validator.test.d.ts.map +0 -1
- package/dist/src/validation/execution_validator.test.js +0 -167
- package/dist/src/validation/execution_validator.test.js.map +0 -1
- package/dist/src/validation/feedback_validator.d.ts +0 -23
- package/dist/src/validation/feedback_validator.d.ts.map +0 -1
- package/dist/src/validation/feedback_validator.js +0 -58
- package/dist/src/validation/feedback_validator.js.map +0 -1
- package/dist/src/validation/feedback_validator.test.d.ts +0 -2
- package/dist/src/validation/feedback_validator.test.d.ts.map +0 -1
- package/dist/src/validation/feedback_validator.test.js +0 -131
- package/dist/src/validation/feedback_validator.test.js.map +0 -1
- package/dist/src/validation/index.d.ts +0 -11
- package/dist/src/validation/index.d.ts.map +0 -1
- package/dist/src/validation/index.js +0 -10
- package/dist/src/validation/index.js.map +0 -1
- package/dist/src/validation/task_validator.d.ts +0 -24
- package/dist/src/validation/task_validator.d.ts.map +0 -1
- package/dist/src/validation/task_validator.js +0 -50
- package/dist/src/validation/task_validator.js.map +0 -1
- package/dist/src/validation/task_validator.test.d.ts +0 -2
- package/dist/src/validation/task_validator.test.d.ts.map +0 -1
- package/dist/src/validation/task_validator.test.js +0 -185
- package/dist/src/validation/task_validator.test.js.map +0 -1
- package/dist/src/validation/workflow_methodology_validator.d.ts +0 -32
- package/dist/src/validation/workflow_methodology_validator.d.ts.map +0 -1
- package/dist/src/validation/workflow_methodology_validator.js +0 -91
- package/dist/src/validation/workflow_methodology_validator.js.map +0 -1
- package/dist/src/validation/workflow_methodology_validator.test.d.ts +0 -2
- package/dist/src/validation/workflow_methodology_validator.test.d.ts.map +0 -1
- package/dist/src/validation/workflow_methodology_validator.test.js +0 -229
- package/dist/src/validation/workflow_methodology_validator.test.js.map +0 -1
|
@@ -1,924 +0,0 @@
|
|
|
1
|
-
import { createTaskRecord } from '../../factories/task_factory';
|
|
2
|
-
import { createCycleRecord } from '../../factories/cycle_factory';
|
|
3
|
-
import { RecordStore } from '../../store';
|
|
4
|
-
import { IdentityAdapter } from '../identity_adapter';
|
|
5
|
-
import { FeedbackAdapter } from '../feedback_adapter';
|
|
6
|
-
import { ExecutionAdapter } from '../execution_adapter';
|
|
7
|
-
import { ChangelogAdapter } from '../changelog_adapter';
|
|
8
|
-
import { MetricsAdapter } from '../metrics_adapter';
|
|
9
|
-
// Default configuration
|
|
10
|
-
const DEFAULT_CONFIG = {
|
|
11
|
-
healthThresholds: {
|
|
12
|
-
taskMinScore: 50,
|
|
13
|
-
maxDaysInStage: 7,
|
|
14
|
-
systemMinScore: 60
|
|
15
|
-
}
|
|
16
|
-
};
|
|
17
|
-
/**
|
|
18
|
-
* BacklogAdapter - The Facade/Mediator
|
|
19
|
-
*
|
|
20
|
-
* Implements Facade + Dependency Injection Pattern for testeable and configurable orchestration.
|
|
21
|
-
* Acts as Mediator between Task/Cycle protocols and Workflow/Planning methodologies.
|
|
22
|
-
*/
|
|
23
|
-
export class BacklogAdapter {
|
|
24
|
-
taskStore;
|
|
25
|
-
cycleStore;
|
|
26
|
-
feedbackStore;
|
|
27
|
-
changelogStore;
|
|
28
|
-
feedbackAdapter;
|
|
29
|
-
metricsAdapter;
|
|
30
|
-
workflowMethodologyAdapter;
|
|
31
|
-
identity;
|
|
32
|
-
eventBus;
|
|
33
|
-
config;
|
|
34
|
-
constructor(dependencies) {
|
|
35
|
-
// Data Layer
|
|
36
|
-
this.taskStore = dependencies.taskStore;
|
|
37
|
-
this.cycleStore = dependencies.cycleStore;
|
|
38
|
-
this.feedbackStore = dependencies.feedbackStore;
|
|
39
|
-
this.changelogStore = dependencies.changelogStore;
|
|
40
|
-
// Adapter Dependencies
|
|
41
|
-
this.feedbackAdapter = dependencies.feedbackAdapter;
|
|
42
|
-
this.metricsAdapter = dependencies.metricsAdapter;
|
|
43
|
-
// Business Rules & Infrastructure
|
|
44
|
-
this.workflowMethodologyAdapter = dependencies.workflowMethodologyAdapter;
|
|
45
|
-
this.identity = dependencies.identity;
|
|
46
|
-
this.eventBus = dependencies.eventBus;
|
|
47
|
-
// Configuration with defaults
|
|
48
|
-
this.config = dependencies.config || DEFAULT_CONFIG;
|
|
49
|
-
// Phase 3: Setup event subscriptions
|
|
50
|
-
this.setupEventSubscriptions();
|
|
51
|
-
}
|
|
52
|
-
/**
|
|
53
|
-
* Setup event subscriptions for Phase 3 event handlers
|
|
54
|
-
*/
|
|
55
|
-
setupEventSubscriptions() {
|
|
56
|
-
this.eventBus.subscribe("feedback.created", (event) => this.handleFeedbackCreated(event));
|
|
57
|
-
this.eventBus.subscribe("feedback.status.changed", (event) => this.handleFeedbackResolved(event));
|
|
58
|
-
this.eventBus.subscribe("execution.created", (event) => this.handleExecutionCreated(event));
|
|
59
|
-
this.eventBus.subscribe("changelog.created", (event) => this.handleChangelogCreated(event));
|
|
60
|
-
this.eventBus.subscribe("cycle.status.changed", (event) => this.handleCycleStatusChanged(event));
|
|
61
|
-
this.eventBus.subscribe("system.daily_tick", (event) => this.handleDailyTick(event));
|
|
62
|
-
}
|
|
63
|
-
// ===== PHASE 1: TASK/CYCLE CRUD OPERATIONS (IMPLEMENTED) =====
|
|
64
|
-
/**
|
|
65
|
-
* Creates a new task with workflow validation
|
|
66
|
-
*/
|
|
67
|
-
async createTask(payload, actorId) {
|
|
68
|
-
// 1. Build the record with factory
|
|
69
|
-
const validatedPayload = await createTaskRecord(payload);
|
|
70
|
-
// 2. Create unsigned record structure
|
|
71
|
-
const unsignedRecord = {
|
|
72
|
-
header: {
|
|
73
|
-
version: '1.0',
|
|
74
|
-
type: 'task',
|
|
75
|
-
payloadChecksum: 'will-be-calculated-by-signRecord',
|
|
76
|
-
signatures: [{
|
|
77
|
-
keyId: actorId,
|
|
78
|
-
role: 'author',
|
|
79
|
-
signature: 'placeholder',
|
|
80
|
-
timestamp: Date.now(),
|
|
81
|
-
timestamp_iso: new Date().toISOString()
|
|
82
|
-
}]
|
|
83
|
-
},
|
|
84
|
-
payload: validatedPayload,
|
|
85
|
-
};
|
|
86
|
-
// 3. Sign the record
|
|
87
|
-
const signedRecord = await this.identity.signRecord(unsignedRecord, actorId, 'author');
|
|
88
|
-
// 4. Persist the record with validation
|
|
89
|
-
await this.taskStore.write(signedRecord);
|
|
90
|
-
// 5. Emit event
|
|
91
|
-
this.eventBus.publish({
|
|
92
|
-
type: 'task.created',
|
|
93
|
-
timestamp: Date.now(),
|
|
94
|
-
source: 'backlog_adapter',
|
|
95
|
-
payload: {
|
|
96
|
-
taskId: validatedPayload.id,
|
|
97
|
-
actorId
|
|
98
|
-
},
|
|
99
|
-
metadata: {
|
|
100
|
-
eventId: `${Date.now()}-task-created-${validatedPayload.id}`,
|
|
101
|
-
timestamp: Date.now(),
|
|
102
|
-
sourceAdapter: 'backlog_adapter'
|
|
103
|
-
}
|
|
104
|
-
});
|
|
105
|
-
return validatedPayload;
|
|
106
|
-
}
|
|
107
|
-
/**
|
|
108
|
-
* Gets a specific task by ID
|
|
109
|
-
*/
|
|
110
|
-
async getTask(taskId) {
|
|
111
|
-
const record = await this.taskStore.read(taskId);
|
|
112
|
-
return record ? record.payload : null;
|
|
113
|
-
}
|
|
114
|
-
/**
|
|
115
|
-
* Gets all tasks in the system
|
|
116
|
-
*/
|
|
117
|
-
async getAllTasks() {
|
|
118
|
-
const ids = await this.taskStore.list();
|
|
119
|
-
const tasks = [];
|
|
120
|
-
for (const id of ids) {
|
|
121
|
-
const record = await this.taskStore.read(id);
|
|
122
|
-
if (record) {
|
|
123
|
-
tasks.push(record.payload);
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
return tasks;
|
|
127
|
-
}
|
|
128
|
-
/**
|
|
129
|
-
* Submits a task for review
|
|
130
|
-
*/
|
|
131
|
-
async submitTask(taskId, actorId) {
|
|
132
|
-
// Read and validate task exists
|
|
133
|
-
const taskRecord = await this.taskStore.read(taskId);
|
|
134
|
-
if (!taskRecord) {
|
|
135
|
-
throw new Error(`RecordNotFoundError: Task not found: ${taskId}`);
|
|
136
|
-
}
|
|
137
|
-
const task = taskRecord.payload;
|
|
138
|
-
// Validate current status
|
|
139
|
-
if (task.status !== 'draft') {
|
|
140
|
-
throw new Error(`ProtocolViolationError: Task ${taskId} is not in draft status`);
|
|
141
|
-
}
|
|
142
|
-
// Get actor with proper typing
|
|
143
|
-
const actor = await this.getActor(actorId);
|
|
144
|
-
// Delegate to workflow methodology for validation
|
|
145
|
-
const transitionRule = await this.workflowMethodologyAdapter.getTransitionRule('draft', 'review', {
|
|
146
|
-
task,
|
|
147
|
-
actor,
|
|
148
|
-
signatures: taskRecord.header.signatures
|
|
149
|
-
});
|
|
150
|
-
if (!transitionRule) {
|
|
151
|
-
throw new Error(`ProtocolViolationError: Transition draft→review not allowed for task ${taskId}`);
|
|
152
|
-
}
|
|
153
|
-
// Update task status
|
|
154
|
-
const updatedPayload = { ...task, status: 'review' };
|
|
155
|
-
const updatedRecord = { ...taskRecord, payload: updatedPayload };
|
|
156
|
-
// Sign and persist
|
|
157
|
-
const signedRecord = await this.identity.signRecord(updatedRecord, actorId, 'submitter');
|
|
158
|
-
await this.taskStore.write(signedRecord);
|
|
159
|
-
// Emit event
|
|
160
|
-
this.eventBus.publish({
|
|
161
|
-
type: 'task.status.changed',
|
|
162
|
-
timestamp: Date.now(),
|
|
163
|
-
source: 'backlog_adapter',
|
|
164
|
-
payload: {
|
|
165
|
-
taskId,
|
|
166
|
-
oldStatus: 'draft',
|
|
167
|
-
newStatus: 'review',
|
|
168
|
-
actorId
|
|
169
|
-
}
|
|
170
|
-
});
|
|
171
|
-
return updatedPayload;
|
|
172
|
-
}
|
|
173
|
-
/**
|
|
174
|
-
* Approves a task for next stage with complete workflow validation
|
|
175
|
-
*/
|
|
176
|
-
async approveTask(taskId, actorId) {
|
|
177
|
-
// 1. Read and validate task exists
|
|
178
|
-
const taskRecord = await this.taskStore.read(taskId);
|
|
179
|
-
if (!taskRecord) {
|
|
180
|
-
throw new Error(`RecordNotFoundError: Task not found: ${taskId}`);
|
|
181
|
-
}
|
|
182
|
-
const task = taskRecord.payload;
|
|
183
|
-
const actor = await this.getActor(actorId);
|
|
184
|
-
// 2. Determine target transition from available transitions
|
|
185
|
-
const availableTransitions = await this.getAvailableTransitions(task.status);
|
|
186
|
-
const approvalTransition = availableTransitions.find(transition => transition.requires?.signatures && Object.keys(transition.requires.signatures).length > 0);
|
|
187
|
-
if (!approvalTransition) {
|
|
188
|
-
throw new Error(`ProtocolViolationError: No approval transition available from ${task.status}`);
|
|
189
|
-
}
|
|
190
|
-
const targetState = approvalTransition.to;
|
|
191
|
-
// 3. Generate temporary signature for validation
|
|
192
|
-
const tempSignature = {
|
|
193
|
-
keyId: actorId,
|
|
194
|
-
role: 'approver',
|
|
195
|
-
signature: 'temp-signature',
|
|
196
|
-
timestamp: Date.now(),
|
|
197
|
-
timestamp_iso: new Date().toISOString()
|
|
198
|
-
};
|
|
199
|
-
// 4. Build complete validation context
|
|
200
|
-
const context = {
|
|
201
|
-
task,
|
|
202
|
-
actor,
|
|
203
|
-
signatures: [...taskRecord.header.signatures, tempSignature],
|
|
204
|
-
transitionTo: targetState
|
|
205
|
-
};
|
|
206
|
-
// 5. Delegate signature validation to methodology
|
|
207
|
-
const isValidSignature = await this.workflowMethodologyAdapter.validateSignature(tempSignature, context);
|
|
208
|
-
if (!isValidSignature) {
|
|
209
|
-
throw new Error(`ProtocolViolationError: Signature is not valid for this approval`);
|
|
210
|
-
}
|
|
211
|
-
// 6. Update, sign and persist if validation successful
|
|
212
|
-
const updatedPayload = { ...task, status: targetState };
|
|
213
|
-
const updatedRecord = { ...taskRecord, payload: updatedPayload };
|
|
214
|
-
const signedRecord = await this.identity.signRecord(updatedRecord, actorId, 'approver');
|
|
215
|
-
await this.taskStore.write(signedRecord);
|
|
216
|
-
// 7. Emit event
|
|
217
|
-
this.eventBus.publish({
|
|
218
|
-
type: 'task.status.changed',
|
|
219
|
-
timestamp: Date.now(),
|
|
220
|
-
source: 'backlog_adapter',
|
|
221
|
-
payload: {
|
|
222
|
-
taskId,
|
|
223
|
-
oldStatus: task.status,
|
|
224
|
-
newStatus: targetState,
|
|
225
|
-
actorId
|
|
226
|
-
}
|
|
227
|
-
});
|
|
228
|
-
return updatedPayload;
|
|
229
|
-
}
|
|
230
|
-
/**
|
|
231
|
-
* Activates a task transitioning from ready to active with permission validation
|
|
232
|
-
*/
|
|
233
|
-
async activateTask(taskId, actorId) {
|
|
234
|
-
// 1. Read and validate task exists
|
|
235
|
-
const taskRecord = await this.taskStore.read(taskId);
|
|
236
|
-
if (!taskRecord) {
|
|
237
|
-
throw new Error(`RecordNotFoundError: Task not found: ${taskId}`);
|
|
238
|
-
}
|
|
239
|
-
const task = taskRecord.payload;
|
|
240
|
-
const actor = await this.getActor(actorId);
|
|
241
|
-
// 2. Validate current status is 'ready'
|
|
242
|
-
if (task.status !== 'ready') {
|
|
243
|
-
throw new Error(`ProtocolViolationError: Task is in '${task.status}' state. Cannot activate from this state.`);
|
|
244
|
-
}
|
|
245
|
-
// 3. Validate transition with WorkflowMethodology
|
|
246
|
-
const context = {
|
|
247
|
-
task,
|
|
248
|
-
actor,
|
|
249
|
-
signatures: taskRecord.header.signatures,
|
|
250
|
-
transitionTo: 'active'
|
|
251
|
-
};
|
|
252
|
-
const transitionRule = await this.workflowMethodologyAdapter.getTransitionRule('ready', 'active', context);
|
|
253
|
-
if (!transitionRule) {
|
|
254
|
-
throw new Error(`ProtocolViolationError: Workflow methodology rejected ready→active transition`);
|
|
255
|
-
}
|
|
256
|
-
// 4. Update task status to 'active'
|
|
257
|
-
const updatedPayload = { ...task, status: 'active' };
|
|
258
|
-
const updatedRecord = { ...taskRecord, payload: updatedPayload };
|
|
259
|
-
// 5. Sign the record with 'executor' role
|
|
260
|
-
const signedRecord = await this.identity.signRecord(updatedRecord, actorId, 'executor');
|
|
261
|
-
await this.taskStore.write(signedRecord);
|
|
262
|
-
// 6. Emit task status changed event
|
|
263
|
-
this.eventBus.publish({
|
|
264
|
-
type: 'task.status.changed',
|
|
265
|
-
timestamp: Date.now(),
|
|
266
|
-
source: 'backlog_adapter',
|
|
267
|
-
payload: {
|
|
268
|
-
taskId,
|
|
269
|
-
oldStatus: 'ready',
|
|
270
|
-
newStatus: 'active',
|
|
271
|
-
actorId
|
|
272
|
-
}
|
|
273
|
-
});
|
|
274
|
-
return updatedPayload;
|
|
275
|
-
}
|
|
276
|
-
/**
|
|
277
|
-
* Resumes a paused task transitioning back to active with optional force override
|
|
278
|
-
*/
|
|
279
|
-
async resumeTask(taskId, actorId, force = false) {
|
|
280
|
-
// 1. Read and validate task exists
|
|
281
|
-
const taskRecord = await this.taskStore.read(taskId);
|
|
282
|
-
if (!taskRecord) {
|
|
283
|
-
throw new Error(`RecordNotFoundError: Task not found: ${taskId}`);
|
|
284
|
-
}
|
|
285
|
-
const task = taskRecord.payload;
|
|
286
|
-
// 2. Validate current status is 'paused'
|
|
287
|
-
if (task.status !== 'paused') {
|
|
288
|
-
throw new Error(`ProtocolViolationError: Task is in '${task.status}' state. Cannot resume (requires paused).`);
|
|
289
|
-
}
|
|
290
|
-
// 3. Resolve actor and validate permissions via workflow methodology
|
|
291
|
-
const actor = await this.getActor(actorId);
|
|
292
|
-
if (!force) {
|
|
293
|
-
const taskHealth = await this.metricsAdapter.getTaskHealth(task.id);
|
|
294
|
-
if (taskHealth.blockingFeedbacks > 0) {
|
|
295
|
-
throw new Error('BlockingFeedbackError: Task has blocking feedbacks. Resolve them before resuming or use force.');
|
|
296
|
-
}
|
|
297
|
-
}
|
|
298
|
-
const context = {
|
|
299
|
-
task,
|
|
300
|
-
actor,
|
|
301
|
-
signatures: taskRecord.header.signatures,
|
|
302
|
-
transitionTo: 'active'
|
|
303
|
-
};
|
|
304
|
-
const transitionRule = await this.workflowMethodologyAdapter.getTransitionRule('paused', 'active', context);
|
|
305
|
-
if (!transitionRule) {
|
|
306
|
-
throw new Error('ProtocolViolationError: Workflow methodology rejected paused→active transition');
|
|
307
|
-
}
|
|
308
|
-
// 4. Update task status back to 'active'
|
|
309
|
-
const updatedPayload = { ...task, status: 'active' };
|
|
310
|
-
const updatedRecord = { ...taskRecord, payload: updatedPayload };
|
|
311
|
-
// 5. Sign and persist with resumer role
|
|
312
|
-
const signedRecord = await this.identity.signRecord(updatedRecord, actorId, 'resumer');
|
|
313
|
-
await this.taskStore.write(signedRecord);
|
|
314
|
-
// 6. Emit task status changed event
|
|
315
|
-
this.eventBus.publish({
|
|
316
|
-
type: 'task.status.changed',
|
|
317
|
-
timestamp: Date.now(),
|
|
318
|
-
source: 'backlog_adapter',
|
|
319
|
-
payload: {
|
|
320
|
-
taskId,
|
|
321
|
-
oldStatus: 'paused',
|
|
322
|
-
newStatus: 'active',
|
|
323
|
-
actorId
|
|
324
|
-
}
|
|
325
|
-
});
|
|
326
|
-
return updatedPayload;
|
|
327
|
-
}
|
|
328
|
-
/**
|
|
329
|
-
* Completes a task transitioning from active to done with signature validation
|
|
330
|
-
*/
|
|
331
|
-
async completeTask(taskId, actorId) {
|
|
332
|
-
// 1. Read and validate task exists
|
|
333
|
-
const taskRecord = await this.taskStore.read(taskId);
|
|
334
|
-
if (!taskRecord) {
|
|
335
|
-
throw new Error(`RecordNotFoundError: Task not found: ${taskId}`);
|
|
336
|
-
}
|
|
337
|
-
const task = taskRecord.payload;
|
|
338
|
-
const actor = await this.getActor(actorId);
|
|
339
|
-
// 2. Validate current status is 'active'
|
|
340
|
-
if (task.status !== 'active') {
|
|
341
|
-
throw new Error(`ProtocolViolationError: Task is in '${task.status}' state. Cannot complete from this state.`);
|
|
342
|
-
}
|
|
343
|
-
// 3. Validate transition with WorkflowMethodology
|
|
344
|
-
const context = {
|
|
345
|
-
task,
|
|
346
|
-
actor,
|
|
347
|
-
signatures: taskRecord.header.signatures,
|
|
348
|
-
transitionTo: 'done'
|
|
349
|
-
};
|
|
350
|
-
const transitionRule = await this.workflowMethodologyAdapter.getTransitionRule('active', 'done', context);
|
|
351
|
-
if (!transitionRule) {
|
|
352
|
-
throw new Error(`ProtocolViolationError: Workflow methodology rejected active→done transition`);
|
|
353
|
-
}
|
|
354
|
-
// 4. Update task status to 'done'
|
|
355
|
-
const updatedPayload = { ...task, status: 'done' };
|
|
356
|
-
const updatedRecord = { ...taskRecord, payload: updatedPayload };
|
|
357
|
-
// 5. Sign the record with 'approver' role
|
|
358
|
-
const signedRecord = await this.identity.signRecord(updatedRecord, actorId, 'approver');
|
|
359
|
-
await this.taskStore.write(signedRecord);
|
|
360
|
-
// 6. Emit task status changed event
|
|
361
|
-
this.eventBus.publish({
|
|
362
|
-
type: 'task.status.changed',
|
|
363
|
-
timestamp: Date.now(),
|
|
364
|
-
source: 'backlog_adapter',
|
|
365
|
-
payload: {
|
|
366
|
-
taskId,
|
|
367
|
-
oldStatus: 'active',
|
|
368
|
-
newStatus: 'done',
|
|
369
|
-
actorId
|
|
370
|
-
}
|
|
371
|
-
});
|
|
372
|
-
return updatedPayload;
|
|
373
|
-
}
|
|
374
|
-
/**
|
|
375
|
-
* Discards a task transitioning from ready/active/review to discarded
|
|
376
|
-
* Supports both cancellation (ready/active) and rejection (review) operations
|
|
377
|
-
*/
|
|
378
|
-
async discardTask(taskId, actorId, reason) {
|
|
379
|
-
// 1. Read and validate task exists
|
|
380
|
-
const taskRecord = await this.taskStore.read(taskId);
|
|
381
|
-
if (!taskRecord) {
|
|
382
|
-
throw new Error(`RecordNotFoundError: Task not found: ${taskId}`);
|
|
383
|
-
}
|
|
384
|
-
const task = taskRecord.payload;
|
|
385
|
-
const actor = await this.getActor(actorId);
|
|
386
|
-
// 2. Validate current status allows cancellation/rejection
|
|
387
|
-
if (!['ready', 'active', 'review'].includes(task.status)) {
|
|
388
|
-
throw new Error(`ProtocolViolationError: Task is in '${task.status}' state. Cannot cancel from this state. Only 'ready', 'active', and 'review' tasks can be cancelled.`);
|
|
389
|
-
}
|
|
390
|
-
// 3. Validate transition with WorkflowMethodology
|
|
391
|
-
const context = {
|
|
392
|
-
task,
|
|
393
|
-
actor,
|
|
394
|
-
signatures: taskRecord.header.signatures,
|
|
395
|
-
transitionTo: 'discarded'
|
|
396
|
-
};
|
|
397
|
-
const transitionRule = await this.workflowMethodologyAdapter.getTransitionRule(task.status, 'discarded', context);
|
|
398
|
-
if (!transitionRule) {
|
|
399
|
-
throw new Error(`ProtocolViolationError: Workflow methodology rejected ${task.status}→discarded transition`);
|
|
400
|
-
}
|
|
401
|
-
// 4. Update task status to 'discarded' and add cancellation/rejection reason
|
|
402
|
-
const updatedPayload = {
|
|
403
|
-
...task,
|
|
404
|
-
status: 'discarded',
|
|
405
|
-
// Add reason to notes with appropriate prefix based on current state
|
|
406
|
-
...(reason && {
|
|
407
|
-
notes: `${task.notes || ''}\n${task.status === 'review' ? '[REJECTED]' : '[CANCELLED]'} ${reason} (${new Date().toISOString()})`.trim()
|
|
408
|
-
})
|
|
409
|
-
};
|
|
410
|
-
const updatedRecord = { ...taskRecord, payload: updatedPayload };
|
|
411
|
-
// 5. Sign the record with 'canceller' role
|
|
412
|
-
const signedRecord = await this.identity.signRecord(updatedRecord, actorId, 'canceller');
|
|
413
|
-
await this.taskStore.write(signedRecord);
|
|
414
|
-
// 6. Emit task status changed event
|
|
415
|
-
this.eventBus.publish({
|
|
416
|
-
type: 'task.status.changed',
|
|
417
|
-
timestamp: Date.now(),
|
|
418
|
-
source: 'backlog_adapter',
|
|
419
|
-
payload: {
|
|
420
|
-
taskId,
|
|
421
|
-
oldStatus: task.status,
|
|
422
|
-
newStatus: 'discarded',
|
|
423
|
-
actorId,
|
|
424
|
-
reason: reason || (task.status === 'review' ? 'Task rejected' : 'Task cancelled')
|
|
425
|
-
}
|
|
426
|
-
});
|
|
427
|
-
return updatedPayload;
|
|
428
|
-
}
|
|
429
|
-
/**
|
|
430
|
-
* Updates a task with new payload
|
|
431
|
-
*/
|
|
432
|
-
async updateTask(taskId, payload) {
|
|
433
|
-
const taskRecord = await this.taskStore.read(taskId);
|
|
434
|
-
if (!taskRecord) {
|
|
435
|
-
throw new Error(`RecordNotFoundError: Task not found: ${taskId}`);
|
|
436
|
-
}
|
|
437
|
-
// Validate not in final state
|
|
438
|
-
if (['archived'].includes(taskRecord.payload.status)) {
|
|
439
|
-
throw new Error(`ProtocolViolationError: Cannot update task in final state: ${taskRecord.payload.status}`);
|
|
440
|
-
}
|
|
441
|
-
// Merge and validate with factory
|
|
442
|
-
const updatedPayload = await createTaskRecord({ ...taskRecord.payload, ...payload });
|
|
443
|
-
const updatedRecord = { ...taskRecord, payload: updatedPayload };
|
|
444
|
-
await this.taskStore.write(updatedRecord);
|
|
445
|
-
return updatedPayload;
|
|
446
|
-
}
|
|
447
|
-
// ===== PHASE 2: AGENT NAVIGATION (IMPLEMENTED) =====
|
|
448
|
-
/**
|
|
449
|
-
* Gets tasks assigned to a specific actor
|
|
450
|
-
*/
|
|
451
|
-
async getTasksAssignedToActor(actorId) {
|
|
452
|
-
// Read all feedbacks to find assignments
|
|
453
|
-
const feedbackIds = await this.feedbackStore.list();
|
|
454
|
-
const assignedTaskIds = [];
|
|
455
|
-
for (const id of feedbackIds) {
|
|
456
|
-
const record = await this.feedbackStore.read(id);
|
|
457
|
-
if (record &&
|
|
458
|
-
record.payload.type === 'assignment' &&
|
|
459
|
-
record.payload.assignee === actorId) {
|
|
460
|
-
assignedTaskIds.push(record.payload.entityId);
|
|
461
|
-
}
|
|
462
|
-
}
|
|
463
|
-
// Read the assigned tasks
|
|
464
|
-
const assignedTasks = [];
|
|
465
|
-
for (const taskId of assignedTaskIds) {
|
|
466
|
-
const task = await this.getTask(taskId);
|
|
467
|
-
if (task) {
|
|
468
|
-
assignedTasks.push(task);
|
|
469
|
-
}
|
|
470
|
-
}
|
|
471
|
-
return assignedTasks;
|
|
472
|
-
}
|
|
473
|
-
// ===== PHASE 3: EVENT HANDLERS (NEW IMPLEMENTATION) =====
|
|
474
|
-
/**
|
|
475
|
-
* [EARS-31] Handles feedback created events - pauses task if blocking
|
|
476
|
-
*/
|
|
477
|
-
async handleFeedbackCreated(event) {
|
|
478
|
-
try {
|
|
479
|
-
const metadata = {
|
|
480
|
-
eventId: `${Date.now()}-handle-feedback-created`,
|
|
481
|
-
timestamp: Date.now(),
|
|
482
|
-
processedAt: Date.now(),
|
|
483
|
-
sourceAdapter: 'backlog_adapter'
|
|
484
|
-
};
|
|
485
|
-
// Only handle blocking feedbacks
|
|
486
|
-
if (event.payload.type !== 'blocking') {
|
|
487
|
-
return; // EARS-32: Do nothing for non-blocking feedback
|
|
488
|
-
}
|
|
489
|
-
// Read the associated task through feedback record
|
|
490
|
-
const feedbackRecord = await this.feedbackStore.read(event.payload.feedbackId);
|
|
491
|
-
if (!feedbackRecord) {
|
|
492
|
-
console.warn(`Feedback not found: ${event.payload.feedbackId}`);
|
|
493
|
-
return;
|
|
494
|
-
}
|
|
495
|
-
const task = await this.getTask(feedbackRecord.payload.entityId);
|
|
496
|
-
if (!task) {
|
|
497
|
-
console.warn(`Task not found for feedback: ${feedbackRecord.payload.entityId}`);
|
|
498
|
-
return;
|
|
499
|
-
}
|
|
500
|
-
// Only pause if task is in a pausable state
|
|
501
|
-
if (!['active', 'ready'].includes(task.status)) {
|
|
502
|
-
return;
|
|
503
|
-
}
|
|
504
|
-
// Update task to paused
|
|
505
|
-
const updatedTask = { ...task, status: 'paused' };
|
|
506
|
-
const taskRecord = await this.taskStore.read(task.id);
|
|
507
|
-
if (taskRecord) {
|
|
508
|
-
const updatedRecord = { ...taskRecord, payload: updatedTask };
|
|
509
|
-
await this.taskStore.write(updatedRecord);
|
|
510
|
-
// Emit status change event
|
|
511
|
-
this.eventBus.publish({
|
|
512
|
-
type: 'task.status.changed',
|
|
513
|
-
timestamp: Date.now(),
|
|
514
|
-
source: 'backlog_adapter',
|
|
515
|
-
payload: {
|
|
516
|
-
taskId: task.id,
|
|
517
|
-
oldStatus: task.status,
|
|
518
|
-
newStatus: 'paused',
|
|
519
|
-
actorId: 'system'
|
|
520
|
-
},
|
|
521
|
-
metadata
|
|
522
|
-
});
|
|
523
|
-
}
|
|
524
|
-
}
|
|
525
|
-
catch (error) {
|
|
526
|
-
console.error('Error in handleFeedbackCreated:', error);
|
|
527
|
-
}
|
|
528
|
-
}
|
|
529
|
-
/**
|
|
530
|
-
* [EARS-33] Handles feedback resolved events - resumes task if no more blocks
|
|
531
|
-
*/
|
|
532
|
-
async handleFeedbackResolved(event) {
|
|
533
|
-
try {
|
|
534
|
-
// Only handle resolution of blocking feedbacks
|
|
535
|
-
if (event.payload.oldStatus !== 'open' || event.payload.newStatus !== 'resolved') {
|
|
536
|
-
return;
|
|
537
|
-
}
|
|
538
|
-
// Get the task through feedback record
|
|
539
|
-
const feedbackRecord = await this.feedbackStore.read(event.payload.feedbackId);
|
|
540
|
-
if (!feedbackRecord) {
|
|
541
|
-
return;
|
|
542
|
-
}
|
|
543
|
-
const task = await this.getTask(feedbackRecord.payload.entityId);
|
|
544
|
-
if (!task || task.status !== 'paused') {
|
|
545
|
-
return;
|
|
546
|
-
}
|
|
547
|
-
// EARS-33: Use MetricsAdapter to check for remaining blocks
|
|
548
|
-
const taskHealth = await this.metricsAdapter.getTaskHealth(task.id);
|
|
549
|
-
// EARS-34: Don't resume if other blocking feedbacks remain
|
|
550
|
-
if (taskHealth.blockingFeedbacks > 0) {
|
|
551
|
-
return;
|
|
552
|
-
}
|
|
553
|
-
// Resume task to active (assuming it was active before being paused)
|
|
554
|
-
const updatedTask = { ...task, status: 'active' };
|
|
555
|
-
const taskRecord = await this.taskStore.read(task.id);
|
|
556
|
-
if (taskRecord) {
|
|
557
|
-
const updatedRecord = { ...taskRecord, payload: updatedTask };
|
|
558
|
-
await this.taskStore.write(updatedRecord);
|
|
559
|
-
this.eventBus.publish({
|
|
560
|
-
type: 'task.status.changed',
|
|
561
|
-
timestamp: Date.now(),
|
|
562
|
-
source: 'backlog_adapter',
|
|
563
|
-
payload: {
|
|
564
|
-
taskId: task.id,
|
|
565
|
-
oldStatus: 'paused',
|
|
566
|
-
newStatus: 'active',
|
|
567
|
-
actorId: 'system'
|
|
568
|
-
}
|
|
569
|
-
});
|
|
570
|
-
}
|
|
571
|
-
}
|
|
572
|
-
catch (error) {
|
|
573
|
-
console.error('Error in handleFeedbackResolved:', error);
|
|
574
|
-
}
|
|
575
|
-
}
|
|
576
|
-
/**
|
|
577
|
-
* [EARS-35] Handles execution created events - transitions ready→active on first execution
|
|
578
|
-
*/
|
|
579
|
-
async handleExecutionCreated(event) {
|
|
580
|
-
try {
|
|
581
|
-
// EARS-35: Use ExecutionAdapter isFirstExecution logic
|
|
582
|
-
if (!event.payload.isFirstExecution) {
|
|
583
|
-
return; // EARS-36: Do nothing on subsequent executions
|
|
584
|
-
}
|
|
585
|
-
const task = await this.getTask(event.payload.taskId);
|
|
586
|
-
if (!task || task.status !== 'ready') {
|
|
587
|
-
return;
|
|
588
|
-
}
|
|
589
|
-
// EARS-36: Validate with WorkflowMethodology before transition
|
|
590
|
-
const actor = await this.getActor(event.payload.triggeredBy);
|
|
591
|
-
const transitionRule = await this.workflowMethodologyAdapter.getTransitionRule('ready', 'active', {
|
|
592
|
-
task,
|
|
593
|
-
actor,
|
|
594
|
-
signatures: []
|
|
595
|
-
});
|
|
596
|
-
if (!transitionRule) {
|
|
597
|
-
console.warn(`Workflow methodology rejected ready→active transition for task ${task.id}`);
|
|
598
|
-
return;
|
|
599
|
-
}
|
|
600
|
-
// Transition to active
|
|
601
|
-
const updatedTask = { ...task, status: 'active' };
|
|
602
|
-
const taskRecord = await this.taskStore.read(task.id);
|
|
603
|
-
if (taskRecord) {
|
|
604
|
-
const updatedRecord = { ...taskRecord, payload: updatedTask };
|
|
605
|
-
await this.taskStore.write(updatedRecord);
|
|
606
|
-
this.eventBus.publish({
|
|
607
|
-
type: 'task.status.changed',
|
|
608
|
-
timestamp: Date.now(),
|
|
609
|
-
source: 'backlog_adapter',
|
|
610
|
-
payload: {
|
|
611
|
-
taskId: task.id,
|
|
612
|
-
oldStatus: 'ready',
|
|
613
|
-
newStatus: 'active',
|
|
614
|
-
actorId: event.payload.triggeredBy
|
|
615
|
-
}
|
|
616
|
-
});
|
|
617
|
-
}
|
|
618
|
-
}
|
|
619
|
-
catch (error) {
|
|
620
|
-
console.error('Error in handleExecutionCreated:', error);
|
|
621
|
-
}
|
|
622
|
-
}
|
|
623
|
-
/**
|
|
624
|
-
* [EARS-37] Handles changelog created events - transitions done→archived
|
|
625
|
-
*/
|
|
626
|
-
async handleChangelogCreated(event) {
|
|
627
|
-
try {
|
|
628
|
-
// Get changelog record to access entityType and entityId
|
|
629
|
-
const changelogRecord = await this.changelogStore.read(event.payload.changelogId);
|
|
630
|
-
if (!changelogRecord) {
|
|
631
|
-
console.warn(`Changelog not found: ${event.payload.changelogId}`);
|
|
632
|
-
return;
|
|
633
|
-
}
|
|
634
|
-
// EARS-37: Only handle task-related changelogs
|
|
635
|
-
if (changelogRecord.payload.entityType !== 'task') {
|
|
636
|
-
return;
|
|
637
|
-
}
|
|
638
|
-
const task = await this.getTask(changelogRecord.payload.entityId);
|
|
639
|
-
if (!task || task.status !== 'done') {
|
|
640
|
-
return;
|
|
641
|
-
}
|
|
642
|
-
// Transition to archived
|
|
643
|
-
const updatedTask = { ...task, status: 'archived' };
|
|
644
|
-
const taskRecord = await this.taskStore.read(task.id);
|
|
645
|
-
if (taskRecord) {
|
|
646
|
-
const updatedRecord = { ...taskRecord, payload: updatedTask };
|
|
647
|
-
await this.taskStore.write(updatedRecord);
|
|
648
|
-
this.eventBus.publish({
|
|
649
|
-
type: 'task.status.changed',
|
|
650
|
-
timestamp: Date.now(),
|
|
651
|
-
source: 'backlog_adapter',
|
|
652
|
-
payload: {
|
|
653
|
-
taskId: task.id,
|
|
654
|
-
oldStatus: 'done',
|
|
655
|
-
newStatus: 'archived',
|
|
656
|
-
actorId: 'system'
|
|
657
|
-
}
|
|
658
|
-
});
|
|
659
|
-
}
|
|
660
|
-
}
|
|
661
|
-
catch (error) {
|
|
662
|
-
console.error('Error in handleChangelogCreated:', error);
|
|
663
|
-
}
|
|
664
|
-
}
|
|
665
|
-
/**
|
|
666
|
-
* [EARS-38] Handles daily tick events - proactive health auditing
|
|
667
|
-
*/
|
|
668
|
-
async handleDailyTick(_event) {
|
|
669
|
-
try {
|
|
670
|
-
// EARS-38: Use MetricsAdapter for proactive auditing
|
|
671
|
-
const systemStatus = await this.metricsAdapter.getSystemStatus();
|
|
672
|
-
// Get all active tasks for health analysis
|
|
673
|
-
const allTasks = await this.getAllTasks();
|
|
674
|
-
const activeTasks = allTasks.filter(task => task.status === 'active');
|
|
675
|
-
for (const task of activeTasks) {
|
|
676
|
-
const taskHealth = await this.metricsAdapter.getTaskHealth(task.id);
|
|
677
|
-
// Apply configurable health thresholds
|
|
678
|
-
if (taskHealth.healthScore < this.config.healthThresholds.taskMinScore ||
|
|
679
|
-
taskHealth.timeInCurrentStage > this.config.healthThresholds.maxDaysInStage) {
|
|
680
|
-
// Create automated warning feedback
|
|
681
|
-
await this.feedbackAdapter.create({
|
|
682
|
-
entityType: 'task',
|
|
683
|
-
entityId: task.id,
|
|
684
|
-
type: 'suggestion',
|
|
685
|
-
content: `Automated health warning: Task health score is ${taskHealth.healthScore}%. ${taskHealth.recommendations.join('. ')}.`,
|
|
686
|
-
status: 'open'
|
|
687
|
-
}, 'system');
|
|
688
|
-
}
|
|
689
|
-
}
|
|
690
|
-
// Log system health alert if critical issues (no custom event needed)
|
|
691
|
-
if (systemStatus.health.overallScore < this.config.healthThresholds.systemMinScore) {
|
|
692
|
-
console.warn(`System health alert: Score ${systemStatus.health.overallScore}%, blocked: ${systemStatus.health.blockedTasks}, stale: ${systemStatus.health.staleTasks}`);
|
|
693
|
-
// Note: Health alerts are logged, not emitted as events.
|
|
694
|
-
// System monitoring should read logs for alerting.
|
|
695
|
-
}
|
|
696
|
-
}
|
|
697
|
-
catch (error) {
|
|
698
|
-
console.error('Error in handleDailyTick:', error);
|
|
699
|
-
}
|
|
700
|
-
}
|
|
701
|
-
/**
|
|
702
|
-
* [EARS-45] Handles cycle status changed events - manages cycle hierarchy completion
|
|
703
|
-
*/
|
|
704
|
-
async handleCycleStatusChanged(event) {
|
|
705
|
-
try {
|
|
706
|
-
// Only handle cycle completion
|
|
707
|
-
if (event.payload.newStatus !== 'completed') {
|
|
708
|
-
return;
|
|
709
|
-
}
|
|
710
|
-
const completedCycle = await this.getCycle(event.payload.cycleId);
|
|
711
|
-
if (!completedCycle) {
|
|
712
|
-
console.warn(`Completed cycle not found: ${event.payload.cycleId}`);
|
|
713
|
-
return;
|
|
714
|
-
}
|
|
715
|
-
// Find parent cycles that contain this completed cycle
|
|
716
|
-
const allCycles = await this.getAllCycles();
|
|
717
|
-
const parentCycles = allCycles.filter(cycle => cycle.childCycleIds?.includes(event.payload.cycleId));
|
|
718
|
-
for (const parentCycle of parentCycles) {
|
|
719
|
-
// Check if ALL child cycles are completed
|
|
720
|
-
const childCycles = await Promise.all((parentCycle.childCycleIds || []).map(id => this.getCycle(id)));
|
|
721
|
-
const allChildrenCompleted = childCycles.every(child => child && child.status === 'completed');
|
|
722
|
-
if (allChildrenCompleted) {
|
|
723
|
-
// Complete the parent cycle
|
|
724
|
-
await this.updateCycle(parentCycle.id, { status: 'completed' });
|
|
725
|
-
// TODO: Delegate epic task completion to planning methodology
|
|
726
|
-
// The logic for completing epic tasks based on cycle completion
|
|
727
|
-
// should be handled by planningMethodology, not backlogAdapter
|
|
728
|
-
/*
|
|
729
|
-
if (this.planningMethodology) {
|
|
730
|
-
await this.planningMethodology.handleEpicCompletion({
|
|
731
|
-
completedCycleId: parentCycle.id,
|
|
732
|
-
event
|
|
733
|
-
});
|
|
734
|
-
}
|
|
735
|
-
*/
|
|
736
|
-
// For now, just log the completion - epic logic will be in planning methodology
|
|
737
|
-
console.log(`Parent cycle ${parentCycle.id} completed - epic task completion delegated to planning methodology`);
|
|
738
|
-
}
|
|
739
|
-
}
|
|
740
|
-
}
|
|
741
|
-
catch (error) {
|
|
742
|
-
console.error('Error in handleCycleStatusChanged:', error);
|
|
743
|
-
}
|
|
744
|
-
}
|
|
745
|
-
// ===== PHASE 4: STUBS AND POLISH (DELEGATE TO ADAPTERS) =====
|
|
746
|
-
/**
|
|
747
|
-
* Gets system status by delegating to MetricsAdapter
|
|
748
|
-
*/
|
|
749
|
-
async getSystemStatus() {
|
|
750
|
-
return await this.metricsAdapter.getSystemStatus();
|
|
751
|
-
}
|
|
752
|
-
/**
|
|
753
|
-
* Gets task health by delegating to MetricsAdapter
|
|
754
|
-
*/
|
|
755
|
-
async getTaskHealth(taskId) {
|
|
756
|
-
return await this.metricsAdapter.getTaskHealth(taskId);
|
|
757
|
-
}
|
|
758
|
-
// ===== HELPER METHODS =====
|
|
759
|
-
/**
|
|
760
|
-
* Helper to get actor record
|
|
761
|
-
*/
|
|
762
|
-
async getActor(actorId) {
|
|
763
|
-
// Use IdentityAdapter to get real actor data
|
|
764
|
-
const actor = await this.identity.getActor(actorId);
|
|
765
|
-
if (!actor) {
|
|
766
|
-
throw new Error(`RecordNotFoundError: Actor not found: ${actorId}`);
|
|
767
|
-
}
|
|
768
|
-
return actor;
|
|
769
|
-
}
|
|
770
|
-
/**
|
|
771
|
-
* Helper to get available transitions from current state
|
|
772
|
-
*/
|
|
773
|
-
async getAvailableTransitions(fromStatus) {
|
|
774
|
-
// This would normally be implemented using workflowMethodology.getAvailableTransitions()
|
|
775
|
-
// For now, implementing basic logic based on canonical workflow
|
|
776
|
-
const transitions = [
|
|
777
|
-
{ from: 'review', to: 'ready', requires: { signatures: { __default__: { role: 'approver' } } } },
|
|
778
|
-
{ from: 'active', to: 'done', requires: { signatures: { __default__: { role: 'approver' } } } }
|
|
779
|
-
];
|
|
780
|
-
return transitions.filter(t => t.from === fromStatus);
|
|
781
|
-
}
|
|
782
|
-
// ===== PHASE 1: CYCLE CRUD OPERATIONS (IMPLEMENTED) =====
|
|
783
|
-
/**
|
|
784
|
-
* Creates a new cycle with workflow validation
|
|
785
|
-
*/
|
|
786
|
-
async createCycle(payload, actorId) {
|
|
787
|
-
// 1. Build the record with factory
|
|
788
|
-
const validatedPayload = await createCycleRecord(payload);
|
|
789
|
-
// 2. Create unsigned record structure
|
|
790
|
-
const unsignedRecord = {
|
|
791
|
-
header: {
|
|
792
|
-
version: '1.0',
|
|
793
|
-
type: 'cycle',
|
|
794
|
-
payloadChecksum: 'will-be-calculated-by-signRecord',
|
|
795
|
-
signatures: [{
|
|
796
|
-
keyId: actorId,
|
|
797
|
-
role: 'author',
|
|
798
|
-
signature: 'placeholder',
|
|
799
|
-
timestamp: Date.now(),
|
|
800
|
-
timestamp_iso: new Date().toISOString()
|
|
801
|
-
}]
|
|
802
|
-
},
|
|
803
|
-
payload: validatedPayload,
|
|
804
|
-
};
|
|
805
|
-
// 3. Sign the record
|
|
806
|
-
const signedRecord = await this.identity.signRecord(unsignedRecord, actorId, 'author');
|
|
807
|
-
// 4. Persist the record
|
|
808
|
-
await this.cycleStore.write(signedRecord);
|
|
809
|
-
// 5. Emit event
|
|
810
|
-
this.eventBus.publish({
|
|
811
|
-
type: 'cycle.created',
|
|
812
|
-
timestamp: Date.now(),
|
|
813
|
-
source: 'backlog_adapter',
|
|
814
|
-
payload: {
|
|
815
|
-
cycleId: validatedPayload.id,
|
|
816
|
-
actorId
|
|
817
|
-
},
|
|
818
|
-
metadata: {
|
|
819
|
-
eventId: `${Date.now()}-cycle-created-${validatedPayload.id}`,
|
|
820
|
-
timestamp: Date.now(),
|
|
821
|
-
sourceAdapter: 'backlog_adapter'
|
|
822
|
-
}
|
|
823
|
-
});
|
|
824
|
-
return validatedPayload;
|
|
825
|
-
}
|
|
826
|
-
/**
|
|
827
|
-
* Gets a specific cycle by ID
|
|
828
|
-
*/
|
|
829
|
-
async getCycle(cycleId) {
|
|
830
|
-
const record = await this.cycleStore.read(cycleId);
|
|
831
|
-
return record ? record.payload : null;
|
|
832
|
-
}
|
|
833
|
-
/**
|
|
834
|
-
* Gets all cycles in the system
|
|
835
|
-
*/
|
|
836
|
-
async getAllCycles() {
|
|
837
|
-
const ids = await this.cycleStore.list();
|
|
838
|
-
const cycles = [];
|
|
839
|
-
for (const id of ids) {
|
|
840
|
-
const record = await this.cycleStore.read(id);
|
|
841
|
-
if (record) {
|
|
842
|
-
cycles.push(record.payload);
|
|
843
|
-
}
|
|
844
|
-
}
|
|
845
|
-
return cycles;
|
|
846
|
-
}
|
|
847
|
-
/**
|
|
848
|
-
* Updates a cycle with new payload
|
|
849
|
-
*/
|
|
850
|
-
async updateCycle(cycleId, payload) {
|
|
851
|
-
const cycleRecord = await this.cycleStore.read(cycleId);
|
|
852
|
-
if (!cycleRecord) {
|
|
853
|
-
throw new Error(`RecordNotFoundError: Cycle not found: ${cycleId}`);
|
|
854
|
-
}
|
|
855
|
-
// Validate not in final state
|
|
856
|
-
if (['archived'].includes(cycleRecord.payload.status)) {
|
|
857
|
-
throw new Error(`ProtocolViolationError: Cannot update cycle in final state: ${cycleRecord.payload.status}`);
|
|
858
|
-
}
|
|
859
|
-
// Merge and validate with factory
|
|
860
|
-
const updatedPayload = await createCycleRecord({ ...cycleRecord.payload, ...payload });
|
|
861
|
-
const updatedRecord = { ...cycleRecord, payload: updatedPayload };
|
|
862
|
-
// Emit event if status changed
|
|
863
|
-
if (cycleRecord.payload.status !== updatedPayload.status) {
|
|
864
|
-
this.eventBus.publish({
|
|
865
|
-
type: 'cycle.status.changed',
|
|
866
|
-
timestamp: Date.now(),
|
|
867
|
-
source: 'backlog_adapter',
|
|
868
|
-
payload: {
|
|
869
|
-
cycleId,
|
|
870
|
-
oldStatus: cycleRecord.payload.status,
|
|
871
|
-
newStatus: updatedPayload.status,
|
|
872
|
-
actorId: 'system'
|
|
873
|
-
}
|
|
874
|
-
});
|
|
875
|
-
}
|
|
876
|
-
await this.cycleStore.write(updatedRecord);
|
|
877
|
-
return updatedPayload;
|
|
878
|
-
}
|
|
879
|
-
/**
|
|
880
|
-
* Creates bidirectional link between task and cycle
|
|
881
|
-
*/
|
|
882
|
-
async addTaskToCycle(cycleId, taskId) {
|
|
883
|
-
// Read both records
|
|
884
|
-
const cycleRecord = await this.cycleStore.read(cycleId);
|
|
885
|
-
const taskRecord = await this.taskStore.read(taskId);
|
|
886
|
-
if (!cycleRecord) {
|
|
887
|
-
throw new Error(`RecordNotFoundError: Cycle not found: ${cycleId}`);
|
|
888
|
-
}
|
|
889
|
-
if (!taskRecord) {
|
|
890
|
-
throw new Error(`RecordNotFoundError: Task not found: ${taskId}`);
|
|
891
|
-
}
|
|
892
|
-
// Create bidirectional links
|
|
893
|
-
const updatedCycle = {
|
|
894
|
-
...cycleRecord.payload,
|
|
895
|
-
taskIds: [...(cycleRecord.payload.taskIds || []), taskId]
|
|
896
|
-
};
|
|
897
|
-
const updatedTask = {
|
|
898
|
-
...taskRecord.payload,
|
|
899
|
-
cycleIds: [...(taskRecord.payload.cycleIds || []), cycleId]
|
|
900
|
-
};
|
|
901
|
-
// Get current actor for signing (MVP mode)
|
|
902
|
-
const currentActor = await this.identity.getCurrentActor();
|
|
903
|
-
// Sign and persist both records with current actor
|
|
904
|
-
const signedCycleRecord = await this.identity.signRecord({ ...cycleRecord, payload: updatedCycle }, currentActor.id, 'author');
|
|
905
|
-
const signedTaskRecord = await this.identity.signRecord({ ...taskRecord, payload: updatedTask }, currentActor.id, 'author');
|
|
906
|
-
await Promise.all([
|
|
907
|
-
this.cycleStore.write(signedCycleRecord),
|
|
908
|
-
this.taskStore.write(signedTaskRecord)
|
|
909
|
-
]);
|
|
910
|
-
}
|
|
911
|
-
// TODO: Implement when lint_command.md is implemented
|
|
912
|
-
async lint() {
|
|
913
|
-
throw new Error('NotImplementedError: lint() will be implemented when lint_command.md is ready');
|
|
914
|
-
}
|
|
915
|
-
// TODO: Implement when audit_command.md is implemented
|
|
916
|
-
async audit() {
|
|
917
|
-
throw new Error('NotImplementedError: audit() will be implemented when audit_command.md is ready');
|
|
918
|
-
}
|
|
919
|
-
// TODO: Implement when commit_processor.md is implemented
|
|
920
|
-
async processChanges(_changes) {
|
|
921
|
-
throw new Error('NotImplementedError: processChanges() will be implemented when commit_processor.md is ready');
|
|
922
|
-
}
|
|
923
|
-
}
|
|
924
|
-
//# sourceMappingURL=index.js.map
|