@apralabs/apra-fleet 0.3.6 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +245 -257
- package/dist/agents/backlog-groomer.md +287 -0
- package/dist/agents/deployer.md +52 -11
- package/dist/agents/doer.md +32 -7
- package/dist/agents/integ-test-runner.md +151 -61
- package/dist/agents/plan-reviewer.md +74 -17
- package/dist/agents/planner.md +94 -14
- package/dist/agents/regression-test-runner.md +216 -0
- package/dist/agents/reviewer.md +21 -6
- package/dist/agents/schemas/backlog-groomer-input.json +35 -0
- package/dist/agents/schemas/backlog-groomer-output.json +164 -0
- package/dist/agents/schemas/integ-test-runner-output.json +34 -0
- package/dist/agents/schemas/regression-test-runner-input.json +15 -0
- package/dist/agents/schemas/regression-test-runner-output.json +50 -0
- package/dist/agents/schemas/reviewer-output.json +4 -0
- package/dist/cli/agent-transform.d.ts +1 -0
- package/dist/cli/agent-transform.d.ts.map +1 -1
- package/dist/cli/agent-transform.js +77 -0
- package/dist/cli/agent-transform.js.map +1 -1
- package/dist/cli/auth.d.ts +3 -0
- package/dist/cli/auth.d.ts.map +1 -1
- package/dist/cli/auth.js +181 -5
- package/dist/cli/auth.js.map +1 -1
- package/dist/cli/config.d.ts +5 -1
- package/dist/cli/config.d.ts.map +1 -1
- package/dist/cli/config.js +7 -1
- package/dist/cli/config.js.map +1 -1
- package/dist/cli/dolt-install.d.ts +91 -0
- package/dist/cli/dolt-install.d.ts.map +1 -0
- package/dist/cli/dolt-install.js +334 -0
- package/dist/cli/dolt-install.js.map +1 -0
- package/dist/cli/install-guard.d.ts +29 -0
- package/dist/cli/install-guard.d.ts.map +1 -0
- package/dist/cli/install-guard.js +153 -0
- package/dist/cli/install-guard.js.map +1 -0
- package/dist/cli/install.d.ts +44 -3
- package/dist/cli/install.d.ts.map +1 -1
- package/dist/cli/install.js +604 -108
- package/dist/cli/install.js.map +1 -1
- package/dist/cli/join.d.ts +12 -0
- package/dist/cli/join.d.ts.map +1 -0
- package/dist/cli/join.js +87 -0
- package/dist/cli/join.js.map +1 -0
- package/dist/cli/register-member.d.ts +2 -0
- package/dist/cli/register-member.d.ts.map +1 -0
- package/dist/cli/register-member.js +193 -0
- package/dist/cli/register-member.js.map +1 -0
- package/dist/cli/restart.d.ts +2 -0
- package/dist/cli/restart.d.ts.map +1 -0
- package/dist/cli/restart.js +7 -0
- package/dist/cli/restart.js.map +1 -0
- package/dist/cli/spoke.d.ts +35 -0
- package/dist/cli/spoke.d.ts.map +1 -0
- package/dist/cli/spoke.js +212 -0
- package/dist/cli/spoke.js.map +1 -0
- package/dist/cli/start.d.ts +2 -0
- package/dist/cli/start.d.ts.map +1 -0
- package/dist/cli/start.js +92 -0
- package/dist/cli/start.js.map +1 -0
- package/dist/cli/status.d.ts +2 -0
- package/dist/cli/status.d.ts.map +1 -0
- package/dist/cli/status.js +83 -0
- package/dist/cli/status.js.map +1 -0
- package/dist/cli/stop.d.ts +2 -0
- package/dist/cli/stop.d.ts.map +1 -0
- package/dist/cli/stop.js +51 -0
- package/dist/cli/stop.js.map +1 -0
- package/dist/cli/uninstall.d.ts.map +1 -1
- package/dist/cli/uninstall.js +109 -9
- package/dist/cli/uninstall.js.map +1 -1
- package/dist/cli/update.d.ts.map +1 -1
- package/dist/cli/update.js +10 -1
- package/dist/cli/update.js.map +1 -1
- package/dist/cli/workflow-assets.d.ts +37 -0
- package/dist/cli/workflow-assets.d.ts.map +1 -0
- package/dist/cli/workflow-assets.js +144 -0
- package/dist/cli/workflow-assets.js.map +1 -0
- package/dist/cli/workflow.d.ts +75 -0
- package/dist/cli/workflow.d.ts.map +1 -0
- package/dist/cli/workflow.js +397 -0
- package/dist/cli/workflow.js.map +1 -0
- package/dist/hub-service/activity.d.ts +30 -0
- package/dist/hub-service/activity.d.ts.map +1 -0
- package/dist/hub-service/activity.js +20 -0
- package/dist/hub-service/activity.js.map +1 -0
- package/dist/hub-service/audit-log.d.ts +19 -0
- package/dist/hub-service/audit-log.d.ts.map +1 -0
- package/dist/hub-service/audit-log.js +13 -0
- package/dist/hub-service/audit-log.js.map +1 -0
- package/dist/hub-service/db/pool.d.ts +19 -0
- package/dist/hub-service/db/pool.d.ts.map +1 -0
- package/dist/hub-service/db/pool.js +53 -0
- package/dist/hub-service/db/pool.js.map +1 -0
- package/dist/hub-service/enrollment.d.ts +29 -0
- package/dist/hub-service/enrollment.d.ts.map +1 -0
- package/dist/hub-service/enrollment.js +48 -0
- package/dist/hub-service/enrollment.js.map +1 -0
- package/dist/hub-service/envelope-routes.d.ts +46 -0
- package/dist/hub-service/envelope-routes.d.ts.map +1 -0
- package/dist/hub-service/envelope-routes.js +94 -0
- package/dist/hub-service/envelope-routes.js.map +1 -0
- package/dist/hub-service/handlers/installers.d.ts +14 -0
- package/dist/hub-service/handlers/installers.d.ts.map +1 -0
- package/dist/hub-service/handlers/installers.js +8 -0
- package/dist/hub-service/handlers/installers.js.map +1 -0
- package/dist/hub-service/http-server.d.ts +31 -0
- package/dist/hub-service/http-server.d.ts.map +1 -0
- package/dist/hub-service/http-server.js +711 -0
- package/dist/hub-service/http-server.js.map +1 -0
- package/dist/hub-service/hub-jwt.d.ts +30 -0
- package/dist/hub-service/hub-jwt.d.ts.map +1 -0
- package/dist/hub-service/hub-jwt.js +105 -0
- package/dist/hub-service/hub-jwt.js.map +1 -0
- package/dist/hub-service/jwt-revocation.d.ts +20 -0
- package/dist/hub-service/jwt-revocation.d.ts.map +1 -0
- package/dist/hub-service/jwt-revocation.js +18 -0
- package/dist/hub-service/jwt-revocation.js.map +1 -0
- package/dist/hub-service/machines.d.ts +16 -0
- package/dist/hub-service/machines.d.ts.map +1 -0
- package/dist/hub-service/machines.js +14 -0
- package/dist/hub-service/machines.js.map +1 -0
- package/dist/hub-service/main.d.ts +3 -0
- package/dist/hub-service/main.d.ts.map +1 -0
- package/dist/hub-service/main.js +64 -0
- package/dist/hub-service/main.js.map +1 -0
- package/dist/hub-service/member-tokens.d.ts +11 -0
- package/dist/hub-service/member-tokens.d.ts.map +1 -0
- package/dist/hub-service/member-tokens.js +49 -0
- package/dist/hub-service/member-tokens.js.map +1 -0
- package/dist/hub-service/member-view.d.ts +20 -0
- package/dist/hub-service/member-view.d.ts.map +1 -0
- package/dist/hub-service/member-view.js +76 -0
- package/dist/hub-service/member-view.js.map +1 -0
- package/dist/hub-service/members.d.ts +44 -0
- package/dist/hub-service/members.d.ts.map +1 -0
- package/dist/hub-service/members.js +25 -0
- package/dist/hub-service/members.js.map +1 -0
- package/dist/hub-service/presence.d.ts +40 -0
- package/dist/hub-service/presence.d.ts.map +1 -0
- package/dist/hub-service/presence.js +44 -0
- package/dist/hub-service/presence.js.map +1 -0
- package/dist/hub-service/project-view.d.ts +12 -0
- package/dist/hub-service/project-view.d.ts.map +1 -0
- package/dist/hub-service/project-view.js +34 -0
- package/dist/hub-service/project-view.js.map +1 -0
- package/dist/hub-service/projects.d.ts +48 -0
- package/dist/hub-service/projects.d.ts.map +1 -0
- package/dist/hub-service/projects.js +80 -0
- package/dist/hub-service/projects.js.map +1 -0
- package/dist/hub-service/relay-queue.d.ts +115 -0
- package/dist/hub-service/relay-queue.d.ts.map +1 -0
- package/dist/hub-service/relay-queue.js +148 -0
- package/dist/hub-service/relay-queue.js.map +1 -0
- package/dist/hub-service/session-jwt.d.ts +10 -0
- package/dist/hub-service/session-jwt.d.ts.map +1 -0
- package/dist/hub-service/session-jwt.js +69 -0
- package/dist/hub-service/session-jwt.js.map +1 -0
- package/dist/hub-service/usage.d.ts +40 -0
- package/dist/hub-service/usage.d.ts.map +1 -0
- package/dist/hub-service/usage.js +25 -0
- package/dist/hub-service/usage.js.map +1 -0
- package/dist/hub-service/users.d.ts +56 -0
- package/dist/hub-service/users.d.ts.map +1 -0
- package/dist/hub-service/users.js +72 -0
- package/dist/hub-service/users.js.map +1 -0
- package/dist/hub-service/workspaces.d.ts +20 -0
- package/dist/hub-service/workspaces.d.ts.map +1 -0
- package/dist/hub-service/workspaces.js +10 -0
- package/dist/hub-service/workspaces.js.map +1 -0
- package/dist/index.js +179 -132
- package/dist/index.js.map +1 -1
- package/dist/os/linux.d.ts +13 -0
- package/dist/os/linux.d.ts.map +1 -1
- package/dist/os/linux.js +62 -3
- package/dist/os/linux.js.map +1 -1
- package/dist/os/os-commands.d.ts +10 -0
- package/dist/os/os-commands.d.ts.map +1 -1
- package/dist/os/windows.d.ts +1 -0
- package/dist/os/windows.d.ts.map +1 -1
- package/dist/os/windows.js +21 -1
- package/dist/os/windows.js.map +1 -1
- package/dist/paths.d.ts +23 -0
- package/dist/paths.d.ts.map +1 -1
- package/dist/paths.js +29 -0
- package/dist/paths.js.map +1 -1
- package/dist/providers/agy.d.ts +9 -2
- package/dist/providers/agy.d.ts.map +1 -1
- package/dist/providers/agy.js +127 -14
- package/dist/providers/agy.js.map +1 -1
- package/dist/providers/claude.d.ts +6 -2
- package/dist/providers/claude.d.ts.map +1 -1
- package/dist/providers/claude.js +248 -9
- package/dist/providers/claude.js.map +1 -1
- package/dist/providers/codex.d.ts +3 -2
- package/dist/providers/codex.d.ts.map +1 -1
- package/dist/providers/codex.js +7 -0
- package/dist/providers/codex.js.map +1 -1
- package/dist/providers/copilot.d.ts +3 -2
- package/dist/providers/copilot.d.ts.map +1 -1
- package/dist/providers/copilot.js +8 -1
- package/dist/providers/copilot.js.map +1 -1
- package/dist/providers/gemini.d.ts +3 -2
- package/dist/providers/gemini.d.ts.map +1 -1
- package/dist/providers/gemini.js +11 -1
- package/dist/providers/gemini.js.map +1 -1
- package/dist/providers/index.d.ts +1 -0
- package/dist/providers/index.d.ts.map +1 -1
- package/dist/providers/index.js +3 -0
- package/dist/providers/index.js.map +1 -1
- package/dist/providers/none.d.ts +51 -0
- package/dist/providers/none.d.ts.map +1 -0
- package/dist/providers/none.js +103 -0
- package/dist/providers/none.js.map +1 -0
- package/dist/providers/opencode.d.ts +4 -2
- package/dist/providers/opencode.d.ts.map +1 -1
- package/dist/providers/opencode.js +49 -0
- package/dist/providers/opencode.js.map +1 -1
- package/dist/providers/provider.d.ts +79 -1
- package/dist/providers/provider.d.ts.map +1 -1
- package/dist/providers/provider.js +10 -0
- package/dist/providers/provider.js.map +1 -1
- package/dist/services/agent-provisioner.d.ts +3 -3
- package/dist/services/agent-provisioner.d.ts.map +1 -1
- package/dist/services/agent-provisioner.js +12 -5
- package/dist/services/agent-provisioner.js.map +1 -1
- package/dist/services/auth-socket.d.ts.map +1 -1
- package/dist/services/auth-socket.js +2 -0
- package/dist/services/auth-socket.js.map +1 -1
- package/dist/services/budget-awareness.d.ts +130 -0
- package/dist/services/budget-awareness.d.ts.map +1 -0
- package/dist/services/budget-awareness.js +129 -0
- package/dist/services/budget-awareness.js.map +1 -0
- package/dist/services/cloud-sync.d.ts +35 -0
- package/dist/services/cloud-sync.d.ts.map +1 -0
- package/dist/services/cloud-sync.js +90 -0
- package/dist/services/cloud-sync.js.map +1 -0
- package/dist/services/context-admission.d.ts +82 -0
- package/dist/services/context-admission.d.ts.map +1 -0
- package/dist/services/context-admission.js +136 -0
- package/dist/services/context-admission.js.map +1 -0
- package/dist/services/event-bus.d.ts +27 -0
- package/dist/services/event-bus.d.ts.map +1 -0
- package/dist/services/event-bus.js +20 -0
- package/dist/services/event-bus.js.map +1 -0
- package/dist/services/file-chunker.d.ts +38 -0
- package/dist/services/file-chunker.d.ts.map +1 -0
- package/dist/services/file-chunker.js +63 -0
- package/dist/services/file-chunker.js.map +1 -0
- package/dist/services/file-transfer-relay.d.ts +55 -0
- package/dist/services/file-transfer-relay.d.ts.map +1 -0
- package/dist/services/file-transfer-relay.js +115 -0
- package/dist/services/file-transfer-relay.js.map +1 -0
- package/dist/services/github-app.d.ts.map +1 -1
- package/dist/services/github-app.js +1 -0
- package/dist/services/github-app.js.map +1 -1
- package/dist/services/http-transport.d.ts +25 -0
- package/dist/services/http-transport.d.ts.map +1 -0
- package/dist/services/http-transport.js +371 -0
- package/dist/services/http-transport.js.map +1 -0
- package/dist/services/hub-client.d.ts +69 -0
- package/dist/services/hub-client.d.ts.map +1 -0
- package/dist/services/hub-client.js +217 -0
- package/dist/services/hub-client.js.map +1 -0
- package/dist/services/jwt.d.ts +17 -0
- package/dist/services/jwt.d.ts.map +1 -0
- package/dist/services/jwt.js +70 -0
- package/dist/services/jwt.js.map +1 -0
- package/dist/services/known-sessions.d.ts +8 -0
- package/dist/services/known-sessions.d.ts.map +1 -0
- package/dist/services/known-sessions.js +40 -0
- package/dist/services/known-sessions.js.map +1 -0
- package/dist/services/model-pricing.d.ts +36 -0
- package/dist/services/model-pricing.d.ts.map +1 -0
- package/dist/services/model-pricing.js +108 -0
- package/dist/services/model-pricing.js.map +1 -0
- package/dist/services/orphan-recovery.d.ts +56 -0
- package/dist/services/orphan-recovery.d.ts.map +1 -0
- package/dist/services/orphan-recovery.js +111 -0
- package/dist/services/orphan-recovery.js.map +1 -0
- package/dist/services/pending-responses.d.ts +23 -0
- package/dist/services/pending-responses.d.ts.map +1 -0
- package/dist/services/pending-responses.js +52 -0
- package/dist/services/pending-responses.js.map +1 -0
- package/dist/services/registry.d.ts +4 -1
- package/dist/services/registry.d.ts.map +1 -1
- package/dist/services/registry.js +3 -0
- package/dist/services/registry.js.map +1 -1
- package/dist/services/relay-context.d.ts +23 -0
- package/dist/services/relay-context.d.ts.map +1 -0
- package/dist/services/relay-context.js +8 -0
- package/dist/services/relay-context.js.map +1 -0
- package/dist/services/relay-executor.d.ts +68 -0
- package/dist/services/relay-executor.d.ts.map +1 -0
- package/dist/services/relay-executor.js +70 -0
- package/dist/services/relay-executor.js.map +1 -0
- package/dist/services/relay-request.d.ts +65 -0
- package/dist/services/relay-request.d.ts.map +1 -0
- package/dist/services/relay-request.js +129 -0
- package/dist/services/relay-request.js.map +1 -0
- package/dist/services/relay-strategy.d.ts +19 -0
- package/dist/services/relay-strategy.d.ts.map +1 -0
- package/dist/services/relay-strategy.js +111 -0
- package/dist/services/relay-strategy.js.map +1 -0
- package/dist/services/service-manager/index.d.ts +5 -0
- package/dist/services/service-manager/index.d.ts.map +1 -0
- package/dist/services/service-manager/index.js +66 -0
- package/dist/services/service-manager/index.js.map +1 -0
- package/dist/services/service-manager/linux.d.ts +10 -0
- package/dist/services/service-manager/linux.d.ts.map +1 -0
- package/dist/services/service-manager/linux.js +97 -0
- package/dist/services/service-manager/linux.js.map +1 -0
- package/dist/services/service-manager/macos.d.ts +10 -0
- package/dist/services/service-manager/macos.d.ts.map +1 -0
- package/dist/services/service-manager/macos.js +94 -0
- package/dist/services/service-manager/macos.js.map +1 -0
- package/dist/services/service-manager/types.d.ts +18 -0
- package/dist/services/service-manager/types.d.ts.map +1 -0
- package/dist/services/service-manager/types.js +5 -0
- package/dist/services/service-manager/types.js.map +1 -0
- package/dist/services/service-manager/windows.d.ts +10 -0
- package/dist/services/service-manager/windows.d.ts.map +1 -0
- package/dist/services/service-manager/windows.js +73 -0
- package/dist/services/service-manager/windows.js.map +1 -0
- package/dist/services/session-registry.d.ts +70 -0
- package/dist/services/session-registry.d.ts.map +1 -0
- package/dist/services/session-registry.js +91 -0
- package/dist/services/session-registry.js.map +1 -0
- package/dist/services/singleton.d.ts +15 -0
- package/dist/services/singleton.d.ts.map +1 -0
- package/dist/services/singleton.js +98 -0
- package/dist/services/singleton.js.map +1 -0
- package/dist/services/sprint-coordination.d.ts +168 -0
- package/dist/services/sprint-coordination.d.ts.map +1 -0
- package/dist/services/sprint-coordination.js +564 -0
- package/dist/services/sprint-coordination.js.map +1 -0
- package/dist/services/ssh.d.ts.map +1 -1
- package/dist/services/ssh.js +70 -3
- package/dist/services/ssh.js.map +1 -1
- package/dist/services/stall/log-path-resolver.d.ts.map +1 -1
- package/dist/services/stall/log-path-resolver.js +8 -1
- package/dist/services/stall/log-path-resolver.js.map +1 -1
- package/dist/services/stall/stall-detector.d.ts.map +1 -1
- package/dist/services/stall/stall-detector.js +39 -7
- package/dist/services/stall/stall-detector.js.map +1 -1
- package/dist/services/stall/stall-poller.d.ts +16 -0
- package/dist/services/stall/stall-poller.d.ts.map +1 -1
- package/dist/services/stall/stall-poller.js +136 -18
- package/dist/services/stall/stall-poller.js.map +1 -1
- package/dist/services/strategy.d.ts.map +1 -1
- package/dist/services/strategy.js +55 -5
- package/dist/services/strategy.js.map +1 -1
- package/dist/services/substitution-engine.d.ts +20 -0
- package/dist/services/substitution-engine.d.ts.map +1 -0
- package/dist/services/substitution-engine.js +92 -0
- package/dist/services/substitution-engine.js.map +1 -0
- package/dist/services/task-cleanup.d.ts.map +1 -1
- package/dist/services/task-cleanup.js +1 -9
- package/dist/services/task-cleanup.js.map +1 -1
- package/dist/services/token-issuer.d.ts +47 -0
- package/dist/services/token-issuer.d.ts.map +1 -0
- package/dist/services/token-issuer.js +63 -0
- package/dist/services/token-issuer.js.map +1 -0
- package/dist/services/tool-registry.d.ts +3 -0
- package/dist/services/tool-registry.d.ts.map +1 -0
- package/dist/services/tool-registry.js +139 -0
- package/dist/services/tool-registry.js.map +1 -0
- package/dist/services/user-config.d.ts +14 -0
- package/dist/services/user-config.d.ts.map +1 -1
- package/dist/services/user-config.js +55 -0
- package/dist/services/user-config.js.map +1 -1
- package/dist/services/vcs/types.d.ts +44 -0
- package/dist/services/vcs/types.d.ts.map +1 -1
- package/dist/skills/fleet-sprint-cli/SKILL.md +103 -0
- package/dist/skills/pm/cost.md +3 -0
- package/dist/skills/pm/doer-reviewer-loop.md +3 -0
- package/dist/tools/check-status.d.ts.map +1 -1
- package/dist/tools/check-status.js +8 -2
- package/dist/tools/check-status.js.map +1 -1
- package/dist/tools/child-id-allocator.d.ts +45 -0
- package/dist/tools/child-id-allocator.d.ts.map +1 -0
- package/dist/tools/child-id-allocator.js +62 -0
- package/dist/tools/child-id-allocator.js.map +1 -0
- package/dist/tools/cloud-control.d.ts +2 -2
- package/dist/tools/compose-permissions.d.ts +12 -4
- package/dist/tools/compose-permissions.d.ts.map +1 -1
- package/dist/tools/compose-permissions.js +55 -4
- package/dist/tools/compose-permissions.js.map +1 -1
- package/dist/tools/dolt-push-mutex.d.ts +44 -0
- package/dist/tools/dolt-push-mutex.d.ts.map +1 -0
- package/dist/tools/dolt-push-mutex.js +83 -0
- package/dist/tools/dolt-push-mutex.js.map +1 -0
- package/dist/tools/execute-command.d.ts +11 -1
- package/dist/tools/execute-command.d.ts.map +1 -1
- package/dist/tools/execute-command.js +22 -5
- package/dist/tools/execute-command.js.map +1 -1
- package/dist/tools/execute-prompt.d.ts +72 -12
- package/dist/tools/execute-prompt.d.ts.map +1 -1
- package/dist/tools/execute-prompt.js +962 -71
- package/dist/tools/execute-prompt.js.map +1 -1
- package/dist/tools/get-member-model-pricing.d.ts +21 -0
- package/dist/tools/get-member-model-pricing.d.ts.map +1 -0
- package/dist/tools/get-member-model-pricing.js +29 -0
- package/dist/tools/get-member-model-pricing.js.map +1 -0
- package/dist/tools/list-members.d.ts.map +1 -1
- package/dist/tools/list-members.js +39 -7
- package/dist/tools/list-members.js.map +1 -1
- package/dist/tools/member-detail.d.ts +1 -1
- package/dist/tools/member-detail.d.ts.map +1 -1
- package/dist/tools/member-detail.js +8 -2
- package/dist/tools/member-detail.js.map +1 -1
- package/dist/tools/member-reservation.d.ts +29 -0
- package/dist/tools/member-reservation.d.ts.map +1 -0
- package/dist/tools/member-reservation.js +71 -0
- package/dist/tools/member-reservation.js.map +1 -0
- package/dist/tools/provision-vcs-auth.d.ts +7 -7
- package/dist/tools/provision-vcs-auth.js +1 -1
- package/dist/tools/provision-vcs-auth.js.map +1 -1
- package/dist/tools/register-member.d.ts +17 -5
- package/dist/tools/register-member.d.ts.map +1 -1
- package/dist/tools/register-member.js +144 -5
- package/dist/tools/register-member.js.map +1 -1
- package/dist/tools/remove-member.d.ts +1 -1
- package/dist/tools/report-status.d.ts +33 -0
- package/dist/tools/report-status.d.ts.map +1 -0
- package/dist/tools/report-status.js +44 -0
- package/dist/tools/report-status.js.map +1 -0
- package/dist/tools/respond-to-message.d.ts +21 -0
- package/dist/tools/respond-to-message.d.ts.map +1 -0
- package/dist/tools/respond-to-message.js +23 -0
- package/dist/tools/respond-to-message.js.map +1 -0
- package/dist/tools/send-files.d.ts +3 -0
- package/dist/tools/send-files.d.ts.map +1 -1
- package/dist/tools/send-files.js +88 -8
- package/dist/tools/send-files.js.map +1 -1
- package/dist/tools/send-message.d.ts +27 -0
- package/dist/tools/send-message.d.ts.map +1 -0
- package/dist/tools/send-message.js +46 -0
- package/dist/tools/send-message.js.map +1 -0
- package/dist/tools/shutdown-server.d.ts +2 -0
- package/dist/tools/shutdown-server.d.ts.map +1 -1
- package/dist/tools/shutdown-server.js +19 -0
- package/dist/tools/shutdown-server.js.map +1 -1
- package/dist/tools/update-member.d.ts +8 -8
- package/dist/tools/update-member.d.ts.map +1 -1
- package/dist/tools/update-member.js +11 -1
- package/dist/tools/update-member.js.map +1 -1
- package/dist/types.d.ts +15 -3
- package/dist/types.d.ts.map +1 -1
- package/dist/utils/agent-helpers.d.ts +2 -1
- package/dist/utils/agent-helpers.d.ts.map +1 -1
- package/dist/utils/agent-helpers.js +7 -2
- package/dist/utils/agent-helpers.js.map +1 -1
- package/dist/utils/pid-helpers.d.ts +15 -0
- package/dist/utils/pid-helpers.d.ts.map +1 -1
- package/dist/utils/pid-helpers.js +23 -0
- package/dist/utils/pid-helpers.js.map +1 -1
- package/dist/utils/process-utils.d.ts +3 -0
- package/dist/utils/process-utils.d.ts.map +1 -0
- package/dist/utils/process-utils.js +42 -0
- package/dist/utils/process-utils.js.map +1 -0
- package/dist/utils/prompt-errors.d.ts +2 -1
- package/dist/utils/prompt-errors.d.ts.map +1 -1
- package/dist/utils/prompt-errors.js +13 -3
- package/dist/utils/prompt-errors.js.map +1 -1
- package/dist/utils/workspace-trust.d.ts +24 -0
- package/dist/utils/workspace-trust.d.ts.map +1 -0
- package/dist/utils/workspace-trust.js +35 -0
- package/dist/utils/workspace-trust.js.map +1 -0
- package/dist/workflows/auto-sprint.js +450 -87
- package/package.json +35 -7
- package/packages/apra-fleet-client/package.json +26 -0
- package/packages/apra-fleet-client/src/client/api.mjs +396 -0
- package/packages/apra-fleet-client/src/client/client.mjs +146 -0
- package/packages/apra-fleet-client/src/client/errors.mjs +71 -0
- package/packages/apra-fleet-client/src/client/factory.mjs +65 -0
- package/packages/apra-fleet-client/src/client/server-resolution.mjs +265 -0
- package/packages/apra-fleet-client/src/client/transport.mjs +327 -0
- package/packages/apra-fleet-se/apra-pm/agents/backlog-groomer.md +287 -0
- package/packages/apra-fleet-se/apra-pm/agents/ci-watcher.md +89 -0
- package/packages/apra-fleet-se/apra-pm/agents/deployer.md +139 -0
- package/packages/apra-fleet-se/apra-pm/agents/doer.md +225 -0
- package/packages/apra-fleet-se/apra-pm/agents/harvester.md +169 -0
- package/packages/apra-fleet-se/apra-pm/agents/integ-test-runner.md +316 -0
- package/packages/apra-fleet-se/apra-pm/agents/plan-reviewer.md +188 -0
- package/packages/apra-fleet-se/apra-pm/agents/planner.md +239 -0
- package/packages/apra-fleet-se/apra-pm/agents/regression-test-runner.md +216 -0
- package/packages/apra-fleet-se/apra-pm/agents/reviewer.md +174 -0
- package/packages/apra-fleet-se/apra-pm/agents/schemas/backlog-groomer-input.json +35 -0
- package/packages/apra-fleet-se/apra-pm/agents/schemas/backlog-groomer-output.json +164 -0
- package/packages/apra-fleet-se/apra-pm/agents/schemas/ci-watcher-input.json +26 -0
- package/packages/apra-fleet-se/apra-pm/agents/schemas/ci-watcher-output.json +18 -0
- package/packages/apra-fleet-se/apra-pm/agents/schemas/deployer-input.json +19 -0
- package/packages/apra-fleet-se/apra-pm/agents/schemas/deployer-output.json +17 -0
- package/packages/apra-fleet-se/apra-pm/agents/schemas/doer-input.json +25 -0
- package/packages/apra-fleet-se/apra-pm/agents/schemas/doer-output.json +22 -0
- package/packages/apra-fleet-se/apra-pm/agents/schemas/harvester-input.json +31 -0
- package/packages/apra-fleet-se/apra-pm/agents/schemas/harvester-output.json +18 -0
- package/packages/apra-fleet-se/apra-pm/agents/schemas/integ-test-runner-input.json +20 -0
- package/packages/apra-fleet-se/apra-pm/agents/schemas/integ-test-runner-output.json +61 -0
- package/packages/apra-fleet-se/apra-pm/agents/schemas/plan-reviewer-input.json +15 -0
- package/packages/apra-fleet-se/apra-pm/agents/schemas/plan-reviewer-output.json +30 -0
- package/packages/apra-fleet-se/apra-pm/agents/schemas/regression-test-runner-input.json +15 -0
- package/packages/apra-fleet-se/apra-pm/agents/schemas/regression-test-runner-output.json +50 -0
- package/packages/apra-fleet-se/apra-pm/agents/schemas/reviewer-input.json +25 -0
- package/packages/apra-fleet-se/apra-pm/agents/schemas/reviewer-output.json +38 -0
- package/packages/apra-fleet-se/apra-pm/skills/pm/SKILL.md +402 -0
- package/packages/apra-fleet-se/apra-pm/skills/pm/beads.md +142 -0
- package/packages/apra-fleet-se/apra-pm/skills/pm/cost.md +157 -0
- package/packages/apra-fleet-se/apra-pm/skills/pm/doer-reviewer-loop.md +300 -0
- package/packages/apra-fleet-se/apra-pm/skills/pm/fleet-addendum.md +121 -0
- package/packages/apra-fleet-se/apra-pm/skills/pm/simple-sprint.md +65 -0
- package/packages/apra-fleet-se/apra-pm/skills/pm/sprint.md +327 -0
- package/packages/apra-fleet-se/apra-pm/skills/pm/worktrees.md +92 -0
- package/packages/apra-fleet-se/apra-pm/version.json +3 -0
- package/packages/apra-fleet-se/bin/cli.mjs +857 -0
- package/packages/apra-fleet-se/bin/serve.mjs +383 -0
- package/packages/apra-fleet-se/fleet-sprint/conflict-ladder.mjs +178 -0
- package/packages/apra-fleet-se/fleet-sprint/contracts.mjs +914 -0
- package/packages/apra-fleet-se/fleet-sprint/dispatch-safety-guard.mjs +177 -0
- package/packages/apra-fleet-se/fleet-sprint/docs/README.md +191 -0
- package/packages/apra-fleet-se/fleet-sprint/docs/coach-role-design.md +151 -0
- package/packages/apra-fleet-se/fleet-sprint/docs/dolt-tier2-runbook.md +127 -0
- package/packages/apra-fleet-se/fleet-sprint/docs/fleet-sprint-diagram.md +94 -0
- package/packages/apra-fleet-se/fleet-sprint/docs/stabilization-log.md +1125 -0
- package/packages/apra-fleet-se/fleet-sprint/dolt-literal-guard.mjs +72 -0
- package/packages/apra-fleet-se/fleet-sprint/dolt-recovery-path-b.mjs +339 -0
- package/packages/apra-fleet-se/fleet-sprint/dolt-recovery-tier2.mjs +360 -0
- package/packages/apra-fleet-se/fleet-sprint/dolt-recovery.mjs +363 -0
- package/packages/apra-fleet-se/fleet-sprint/dolt-sync.mjs +1244 -0
- package/packages/apra-fleet-se/fleet-sprint/errors.mjs +572 -0
- package/packages/apra-fleet-se/fleet-sprint/full-db-fetch-guard.mjs +118 -0
- package/packages/apra-fleet-se/fleet-sprint/runner.js +9447 -0
- package/packages/apra-fleet-se/fleet-sprint/skills/fleet-sprint-cli/SKILL.md +103 -0
- package/packages/apra-fleet-se/fleet-sprint/sprint-lock.mjs +140 -0
- package/packages/apra-fleet-se/fleet-sprint/vcs-module.mjs +435 -0
- package/packages/apra-fleet-se/fleet-sprint/vcs-providers/azure-devops.mjs +68 -0
- package/packages/apra-fleet-se/fleet-sprint/vcs-providers/bitbucket.mjs +53 -0
- package/packages/apra-fleet-se/fleet-sprint/vcs-providers/dolt.mjs +146 -0
- package/packages/apra-fleet-se/fleet-sprint/vcs-providers/generic-git.mjs +176 -0
- package/packages/apra-fleet-se/fleet-sprint/vcs-providers/github.mjs +222 -0
- package/packages/apra-fleet-se/fleet-sprint/vcs-providers/index.mjs +218 -0
- package/packages/apra-fleet-se/fleet-sprint/viewer-extensions.mjs +882 -0
- package/packages/apra-fleet-se/package.json +28 -0
- package/packages/apra-fleet-se/workflow.json +1 -0
- package/packages/apra-fleet-workflow/package.json +30 -0
- package/packages/apra-fleet-workflow/src/viewer/command-output-cap.mjs +112 -0
- package/packages/apra-fleet-workflow/src/viewer/debounced-writer.mjs +153 -0
- package/packages/apra-fleet-workflow/src/viewer/html-utils.mjs +31 -0
- package/packages/apra-fleet-workflow/src/viewer/index.mjs +1325 -0
- package/packages/apra-fleet-workflow/src/viewer/lean-state.mjs +237 -0
- package/packages/apra-fleet-workflow/src/viewer/run-state-paths.mjs +130 -0
- package/packages/apra-fleet-workflow/src/viewer/sprint-state-paths.mjs +29 -0
- package/packages/apra-fleet-workflow/src/workflow/engine.mjs +200 -0
- package/packages/apra-fleet-workflow/src/workflow/errors.mjs +146 -0
- package/packages/apra-fleet-workflow/src/workflow/index.mjs +1723 -0
- package/packages/apra-fleet-workflow/src/workflow/journal.mjs +291 -0
- package/packages/apra-fleet-workflow/src/workflow/pricing.mjs +99 -0
- package/packages/apra-fleet-workflow/src/workflow/vetting.mjs +111 -0
- package/scripts/agy-transcript-reader.js +1 -0
- package/scripts/fleet-statusline.sh +17 -13
- package/skills/fleet/SKILL.md +37 -2
- package/skills/fleet/beads.md +14 -7
- package/skills/fleet/permissions.md +50 -0
- package/skills/fleet/profiles/base-dev.json +1 -0
- package/skills/fleet/profiles/base-reviewer.json +1 -0
- package/skills/fleet/profiles/node.json +2 -2
- package/version.json +1 -1
- package/scripts/agy-settings-merge.js +0 -27
- /package/{dist → packages/apra-fleet-se/apra-pm}/agents/_shared/GRAPH-SEMANTICS.md +0 -0
|
@@ -0,0 +1,882 @@
|
|
|
1
|
+
import { escapeHtml } from '@apralabs/apra-fleet-workflow/viewer/html-utils';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Pure HTML-string builder for the beads task tree (apra-fleet-unw.10,
|
|
5
|
+
* F9/A7-viewer).
|
|
6
|
+
*
|
|
7
|
+
* Bead `id`/`title`/`description`/`status` are LLM-authored (or otherwise
|
|
8
|
+
* untrusted) and were previously interpolated into `innerHTML` unescaped --
|
|
9
|
+
* an XSS risk, since the same dashboard page also exposes the `/stop`
|
|
10
|
+
* capability. Every bead-derived field is now run through the shared
|
|
11
|
+
* `escapeHtml()` (packages/apra-fleet-workflow/src/viewer/html-utils.mjs)
|
|
12
|
+
* before being placed into the returned HTML string.
|
|
13
|
+
*
|
|
14
|
+
* This function only builds and returns a string via concatenation -- it
|
|
15
|
+
* never touches `document` -- so it can be (and is, see
|
|
16
|
+
* test/viewer-extensions.test.mjs) unit-tested directly under Node without a
|
|
17
|
+
* browser/DOM/jsdom dependency.
|
|
18
|
+
*
|
|
19
|
+
* The identical implementation also has to run in the browser, inside the
|
|
20
|
+
* extension's plain (non-module) `<script>` tag, which cannot `import` this
|
|
21
|
+
* file at runtime. Rather than hand-duplicating the logic, its source text
|
|
22
|
+
* is embedded into that `<script>` tag via `.toString()` (see `js` below),
|
|
23
|
+
* the same pattern `escapeHtml` itself uses -- one implementation, not two
|
|
24
|
+
* kept in sync by hand. All helper functions (badge builders, tree
|
|
25
|
+
* construction) are nested INSIDE renderBeadsHtml rather than module-level,
|
|
26
|
+
* so that single `.toString()` embed captures everything -- no second
|
|
27
|
+
* function needs its own embed.
|
|
28
|
+
*
|
|
29
|
+
* Tree is built from each task's `parent` field (bd's real parent-child
|
|
30
|
+
* containment, e.g. a `[test]` task nested under its owning bug/feature),
|
|
31
|
+
* not from `blocks`-type dependency edges -- the user-facing goal is "show
|
|
32
|
+
* me epic->task nesting" (containment), not "show me what unblocks what"
|
|
33
|
+
* (ordering). A task with no in-dataset parent is a root. `blocks`-type
|
|
34
|
+
* edges are a real DAG (a task can have multiple blockers) with no bearing
|
|
35
|
+
* on tree placement; every blocker is instead listed inline as a compact
|
|
36
|
+
* "blocked by" badge on the row, so no dependency/ordering information is
|
|
37
|
+
* lost even though it is no longer used for nesting. Multiple top-level
|
|
38
|
+
* roots (tasks with no in-dataset parent) render as multiple top-level
|
|
39
|
+
* rows -- this is expected, not an error, whenever a sprint targets more
|
|
40
|
+
* than one independent top-level item at once. apra-fleet-eft.52.1.2: those
|
|
41
|
+
* TOP-LEVEL roots are ordered by status urgency first (In-progress -> Open
|
|
42
|
+
* -> Blocked -> Closed, priority-then-id breaking ties within a status);
|
|
43
|
+
* this is non-recursive -- each root's own children keep their existing
|
|
44
|
+
* natural DAG order (see `childrenOf[nodeId].slice().sort()` in
|
|
45
|
+
* `renderNode`), unaffected by their parent's status.
|
|
46
|
+
*
|
|
47
|
+
* The panel shows up to two top-level sections: "Sprint" (the containment
|
|
48
|
+
* tree above, built from `sprintTasks`) and "Backlog" (`backlogTasks` --
|
|
49
|
+
* open/deferred beads the sprint is certainly NOT addressing this run,
|
|
50
|
+
* which may belong to an entirely different epic or never have gone
|
|
51
|
+
* through a planning phase at all). Each section (header + body) is
|
|
52
|
+
* rendered ONLY when that section has at least one task (apra-fleet-eft.89):
|
|
53
|
+
* an empty `sprintTasks`/`backlogTasks` array skips its section entirely
|
|
54
|
+
* rather than showing a header with a "No sprint tasks."/"No backlog
|
|
55
|
+
* items." placeholder row. This lets a caller that only ever supplies one
|
|
56
|
+
* of the two lists (e.g. the supervisor's viewer, which always calls
|
|
57
|
+
* `renderBeadsHtml([], tasks, ...)`) render a single, focused section with
|
|
58
|
+
* no always-empty sibling section cluttering the panel. The 6-column
|
|
59
|
+
* header row and outer `<table>` wrapper always render regardless of which
|
|
60
|
+
* (if either) section has content.
|
|
61
|
+
*
|
|
62
|
+
* apra-fleet-k7s: unlike Sprint (nested by `parent` containment), Backlog
|
|
63
|
+
* has no shared parent/epic to nest under -- what it DOES sometimes have is
|
|
64
|
+
* `blocks`-type dependency edges BETWEEN backlog items themselves (e.g. two
|
|
65
|
+
* unplanned beads under the same stale epic, one blocking the other). When
|
|
66
|
+
* present, those edges now drive nesting the same way `renderNode` nests
|
|
67
|
+
* Sprint rows: the blocker renders as the parent row, the blocked item
|
|
68
|
+
* nests as its child, using the identical indent/prefix/cycle-guard
|
|
69
|
+
* mechanics. A backlog item with no blocks-edge to another IN-SET backlog
|
|
70
|
+
* item (the common case -- most backlog beads are unrelated to each other)
|
|
71
|
+
* remains a flat, top-level row, same as before -- nesting is only ever
|
|
72
|
+
* drawn when a real edge justifies it, never implied. Root rows (including
|
|
73
|
+
* every item with no in-set blocker) are still sorted priority-then-id for
|
|
74
|
+
* scannability; a blocked item's DEPTH in the tree is what shows structure,
|
|
75
|
+
* not its position in that sort.
|
|
76
|
+
*
|
|
77
|
+
* Every rendering decision here (status/type badges, tree placement) is
|
|
78
|
+
* defensive by construction: unrecognized/missing status, type, model, or
|
|
79
|
+
* priority values fall back to a generic, still-visible label rather than
|
|
80
|
+
* throwing or rendering blank, and a cycle-guard plus an end-of-pass sweep
|
|
81
|
+
* for any task that never got attached to the tree (should not happen with
|
|
82
|
+
* well-formed bd data, but is not assumed) guarantees every task in the
|
|
83
|
+
* input is rendered exactly once, never silently dropped.
|
|
84
|
+
*
|
|
85
|
+
* apra-fleet-4p5: every tree node that has children (and either top-level
|
|
86
|
+
* "Sprint"/"Backlog" section header that is actually rendered, per the
|
|
87
|
+
* conditional-section rule above) renders a `[-]`/`[+]` toggle (a
|
|
88
|
+
* `.tree-toggle` span carrying a `data-toggle-id`,
|
|
89
|
+
* same round-trip-through-the-DOM pattern the `bead-desc` `data-bead-id`
|
|
90
|
+
* attribute already uses) so a user can fold away a subtree. A node id in
|
|
91
|
+
* `collapsedIds` is rendered collapsed: its own row still shows (with the
|
|
92
|
+
* `[+]` toggle), but none of its descendants' rows are emitted at all --
|
|
93
|
+
* they are still walked (so the cycle-guard/`rendered` bookkeeping stays
|
|
94
|
+
* correct and the end-of-pass safety-net sweep does not re-attach a hidden
|
|
95
|
+
* descendant as a spurious extra root), just not concatenated into the
|
|
96
|
+
* returned HTML. The two sections use the synthetic ids `'section:sprint'`
|
|
97
|
+
* / `'section:backlog'` in the same `collapsedIds` set, since neither can
|
|
98
|
+
* ever collide with a real bd id. This function stays a pure, synchronous
|
|
99
|
+
* string builder either way -- collapse is a rendering decision driven
|
|
100
|
+
* entirely by the `collapsedIds` input, not by any DOM/document access.
|
|
101
|
+
*
|
|
102
|
+
* @param {Array<{id: string|number, title?: string, description?: string, status?: string, issue_type?: string, ready?: boolean, priority?: number, metadata?: {model?: string}, dependencies?: Array<{depends_on_id: string|number, type: string}>}>} sprintTasks
|
|
103
|
+
* @param {Array<{id: string|number, title?: string, description?: string, status?: string, issue_type?: string, priority?: number, metadata?: {model?: string}}>} [backlogTasks]
|
|
104
|
+
* @param {Set<string>|string[]} [collapsedIds] ids (real bead ids, or the synthetic 'section:sprint'/'section:backlog') currently collapsed
|
|
105
|
+
* @returns {string}
|
|
106
|
+
*/
|
|
107
|
+
export function renderBeadsHtml(sprintTasks, backlogTasks, collapsedIds) {
|
|
108
|
+
sprintTasks = sprintTasks || [];
|
|
109
|
+
backlogTasks = backlogTasks || [];
|
|
110
|
+
|
|
111
|
+
// apra-fleet-eft.52.1.3: a server-computed `placement` flag ('sprint' |
|
|
112
|
+
// 'backlog') on a task is AUTHORITATIVE for which section it renders in --
|
|
113
|
+
// runner.js decides Sprint vs Backlog by goal membership (goal-priority
|
|
114
|
+
// band + a blocks-edge exception), not this browser-side view, and never
|
|
115
|
+
// by hiding a row with CSS. When any task carries `placement`, re-derive
|
|
116
|
+
// both section lists from the flag so a below-goal top-level item lands in
|
|
117
|
+
// the Backlog container even if it arrived in the sprintTasks array (and
|
|
118
|
+
// vice versa). Tasks with no `placement` (every pre-existing caller and
|
|
119
|
+
// fixture) are left in whichever array the caller passed them -- this
|
|
120
|
+
// normalization is a no-op for them, so behavior is unchanged.
|
|
121
|
+
const anyPlacement = sprintTasks.some((t) => t && t.placement) || backlogTasks.some((t) => t && t.placement);
|
|
122
|
+
if (anyPlacement) {
|
|
123
|
+
const all = sprintTasks.concat(backlogTasks);
|
|
124
|
+
// A flag-less item defaults to Sprint (in-scope work of unknown rank
|
|
125
|
+
// is sprint work, mirroring runner.js's server-side default).
|
|
126
|
+
sprintTasks = all.filter((t) => t && t.placement !== 'backlog');
|
|
127
|
+
backlogTasks = all.filter((t) => t && t.placement === 'backlog');
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
// Accept a Set (the browser-side embed's long-lived collapse state) or
|
|
131
|
+
// a plain array (e.g. a future caller reconstructing it from
|
|
132
|
+
// persisted/serialized state) -- never throws on either shape.
|
|
133
|
+
collapsedIds = collapsedIds instanceof Set ? collapsedIds : new Set(Array.isArray(collapsedIds) ? collapsedIds : []);
|
|
134
|
+
|
|
135
|
+
// ASCII-only badges throughout (project convention) -- bracketed text
|
|
136
|
+
// tags with inline color, not unicode glyphs/emoji.
|
|
137
|
+
// Color signals "needs attention", not "good/bad": closed work is done
|
|
138
|
+
// and should recede (grey), not celebrate (green); open work hasn't
|
|
139
|
+
// been started and should draw the eye (red), same urgency register as
|
|
140
|
+
// blocked.
|
|
141
|
+
const STATUS_BADGES = {
|
|
142
|
+
open: { label: 'OPEN', color: 'var(--danger)' },
|
|
143
|
+
in_progress: { label: 'IN PROGRESS', color: 'var(--accent)' },
|
|
144
|
+
closed: { label: 'CLOSED', color: '#71717a' },
|
|
145
|
+
blocked: { label: 'BLOCKED', color: 'var(--danger)' },
|
|
146
|
+
deferred: { label: 'DEFERRED', color: '#71717a' },
|
|
147
|
+
};
|
|
148
|
+
// Keys serve double duty: some are real bd `issue_type` values (bug,
|
|
149
|
+
// chore, epic, decision), checked first below; others are only
|
|
150
|
+
// title-prefix conventions (test, impl, feat, fix, doc, design, spike,
|
|
151
|
+
// ci) that carry no `issue_type` of their own -- `task`/`feature` beads
|
|
152
|
+
// commonly use these prefixes to say what KIND of task/feature work this
|
|
153
|
+
// is, which is more informative than the bare issue_type, so those two
|
|
154
|
+
// real types are deliberately left OUT of this map: leaving them out is
|
|
155
|
+
// what lets the title-prefix fallback below run for them instead of
|
|
156
|
+
// being short-circuited to a bare TASK/FEATURE badge.
|
|
157
|
+
const TYPE_BADGES = {
|
|
158
|
+
bug: { label: 'BUG', color: 'var(--danger)' },
|
|
159
|
+
test: { label: 'TEST', color: '#22d3ee' },
|
|
160
|
+
impl: { label: 'IMPL', color: 'var(--accent)' },
|
|
161
|
+
feat: { label: 'FEAT', color: 'var(--accent)' },
|
|
162
|
+
fix: { label: 'FIX', color: 'var(--danger)' },
|
|
163
|
+
doc: { label: 'DOC', color: '#a78bfa' },
|
|
164
|
+
docs: { label: 'DOC', color: '#a78bfa' },
|
|
165
|
+
design: { label: 'DESIGN', color: '#a78bfa' },
|
|
166
|
+
spike: { label: 'SPIKE', color: '#f59e0b' },
|
|
167
|
+
ci: { label: 'CI', color: '#71717a' },
|
|
168
|
+
chore: { label: 'CHORE', color: '#71717a' },
|
|
169
|
+
epic: { label: 'EPIC', color: '#e4e4e7' },
|
|
170
|
+
decision: { label: 'DECISION', color: '#a78bfa' },
|
|
171
|
+
};
|
|
172
|
+
|
|
173
|
+
// Never throws: an unrecognized or missing status/type always resolves
|
|
174
|
+
// to a visible, styled fallback rather than a blank cell or an
|
|
175
|
+
// exception that would take the whole panel down with it.
|
|
176
|
+
function statusBadge(status) {
|
|
177
|
+
const key = (status || '').toString().toLowerCase();
|
|
178
|
+
const known = STATUS_BADGES[key];
|
|
179
|
+
const label = known ? known.label : (status ? escapeHtml(status.toString().toUpperCase()) : 'UNKNOWN');
|
|
180
|
+
const color = known ? known.color : '#a1a1aa';
|
|
181
|
+
return '<span style="color: ' + color + '; font-weight: bold; font-size: 10px; border: 1px solid ' + color + '; border-radius: 3px; padding: 1px 5px; white-space: nowrap;">' + label + '</span>';
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
// Reads the authoritative `issue_type` first (bd's real, stored field);
|
|
185
|
+
// only falls back to guessing from a `[prefix]` title convention when
|
|
186
|
+
// issue_type is absent or isn't one of the types with its own dedicated
|
|
187
|
+
// badge above (this is the common case for `task`/`feature` beads,
|
|
188
|
+
// which rely on the title prefix to say what kind of task/feature this
|
|
189
|
+
// is -- see the comment on TYPE_BADGES).
|
|
190
|
+
function typeBadge(issueType, title) {
|
|
191
|
+
const typeKey = (issueType || '').toString().toLowerCase();
|
|
192
|
+
const knownType = TYPE_BADGES[typeKey];
|
|
193
|
+
if (knownType) {
|
|
194
|
+
return '<span style="color: ' + knownType.color + '; font-size: 10px; border: 1px solid ' + knownType.color + '; border-radius: 3px; padding: 1px 5px; white-space: nowrap;">' + knownType.label + '</span>';
|
|
195
|
+
}
|
|
196
|
+
const match = /^\[([A-Za-z0-9_-]+)\]/.exec(title || '');
|
|
197
|
+
const prefixKey = match ? match[1].toLowerCase() : '';
|
|
198
|
+
const knownPrefix = TYPE_BADGES[prefixKey];
|
|
199
|
+
const label = knownPrefix ? knownPrefix.label : (match ? escapeHtml(match[1]).toUpperCase() : 'MISC');
|
|
200
|
+
const color = knownPrefix ? knownPrefix.color : '#71717a';
|
|
201
|
+
return '<span style="color: ' + color + '; font-size: 10px; border: 1px solid ' + color + '; border-radius: 3px; padding: 1px 5px; white-space: nowrap;">' + label + '</span>';
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
// apra-fleet-xbu.C6: a bead with stored status 'open' that is NOT in
|
|
205
|
+
// this update's `--ready` set (see updateDashboard() in runner.js,
|
|
206
|
+
// which now threads a per-bead `ready` boolean computed from the same
|
|
207
|
+
// `--ready` query dispatch decisions are already based on) is blocked,
|
|
208
|
+
// not merely unstarted -- render it distinctly instead of conflating it
|
|
209
|
+
// with genuinely-ready OPEN work. Beads with no `ready` field at all
|
|
210
|
+
// (e.g. backlog rows, or an older caller that hasn't been updated)
|
|
211
|
+
// fall back to the plain stored-status badge, unchanged.
|
|
212
|
+
function statusBadgeForNode(node) {
|
|
213
|
+
const status = (node.status || '').toString().toLowerCase();
|
|
214
|
+
if (status === 'open' && node.ready === false) {
|
|
215
|
+
return statusBadge('blocked');
|
|
216
|
+
}
|
|
217
|
+
return statusBadge(node.status);
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
// apra-fleet-eft.52.1.2: rank used to order Sprint's TOP-LEVEL roots only
|
|
221
|
+
// (see sprintRootSort below) -- in-progress work surfaces first, closed
|
|
222
|
+
// work sinks to the bottom. Mirrors statusBadgeForNode's 'open' +
|
|
223
|
+
// ready===false ==> effectively-blocked distinction above, so a root
|
|
224
|
+
// row's rank always agrees with its own rendered status badge. Anything
|
|
225
|
+
// outside these four (e.g. 'deferred', or a future/unrecognized status)
|
|
226
|
+
// ranks after 'closed' rather than throwing or being treated as one of
|
|
227
|
+
// the four.
|
|
228
|
+
const STATUS_ORDER = { in_progress: 0, open: 1, blocked: 2, closed: 3 };
|
|
229
|
+
function statusRank(node) {
|
|
230
|
+
const status = (node.status || '').toString().toLowerCase();
|
|
231
|
+
const effective = (status === 'open' && node.ready === false) ? 'blocked' : status;
|
|
232
|
+
const rank = STATUS_ORDER[effective];
|
|
233
|
+
return typeof rank === 'number' ? rank : STATUS_ORDER.closed + 1;
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
function priorityBadge(priority) {
|
|
237
|
+
const label = (typeof priority === 'number' && Number.isFinite(priority)) ? 'P' + priority : 'P?';
|
|
238
|
+
return '<span style="color: #a1a1aa; font-size: 10px;">' + label + '</span>';
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
// Closed items' titles are dimmed so completed work visually recedes
|
|
242
|
+
// rather than competing for attention with what's still open/blocked.
|
|
243
|
+
function titleColor(status) {
|
|
244
|
+
return (status || '').toString().toLowerCase() === 'closed' ? '#71717a' : '#e4e4e7';
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
function modelBadge(metadata) {
|
|
248
|
+
const model = metadata && metadata.model;
|
|
249
|
+
return '<span style="color: #a1a1aa; font-size: 10px;">' + (model ? escapeHtml(model) : 'n/a') + '</span>';
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
// apra-fleet supervisor's Backlog view (src/supervisor/backlog.mjs) has no
|
|
253
|
+
// containment tree of its own to hang a partial-claim annotation off (its
|
|
254
|
+
// beads-tree nests by `blocks` edges, not `parent`), so it attaches the
|
|
255
|
+
// annotation directly onto the flat row object it hands this renderer as
|
|
256
|
+
// `node.partialClaim`. Every fleet-sprint caller leaves this field
|
|
257
|
+
// undefined, so this is a no-op there -- same "defensive, never throws on
|
|
258
|
+
// an absent/unrecognized field" rule the badge builders above already
|
|
259
|
+
// follow.
|
|
260
|
+
function partialClaimAnnotationHtml(partialClaim) {
|
|
261
|
+
if (!partialClaim) return '';
|
|
262
|
+
const sprintLabel = partialClaim.sprints.length === 0
|
|
263
|
+
? 'an active sprint'
|
|
264
|
+
: partialClaim.sprints.map((s) => (partialClaim.sprints.length > 1 ? s.sprintId + ' (' + s.count + ')' : s.sprintId)).join(', ');
|
|
265
|
+
const text = partialClaim.claimedCount + ' of ' + partialClaim.totalCount + ' children claimed by ' + sprintLabel + '; ' + partialClaim.freeCount + ' free';
|
|
266
|
+
return '<div data-partial-claim="true" style="margin-top: 4px; font-size: 10px; color: #f59e0b; font-style: italic;">' + escapeHtml(text) + '</div>';
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
// apra-fleet-eft.27.2: descriptions are no longer inlined into the
|
|
270
|
+
// dashboard's recurring poll payload -- apra-fleet-eft.27.1's lean
|
|
271
|
+
// list-state transform (src/viewer/lean-state.mjs) strips every bead's
|
|
272
|
+
// full `description` down to a short `summary` before GET /state ever
|
|
273
|
+
// serves it, so the real running dashboard only ever has `summary`
|
|
274
|
+
// here. The full text is instead fetched on demand, exactly once per
|
|
275
|
+
// (bead id, updatedAt) pair, the moment a user expands the row -- see
|
|
276
|
+
// GET /extensions/beads/detail/:itemId (src/viewer/index.mjs, generic
|
|
277
|
+
// route delegating to this module's `beadsExtension.detailLookup`,
|
|
278
|
+
// apra-fleet-eft.37.4) and the fetch + localStorage-cache logic wired up
|
|
279
|
+
// below in `js`.
|
|
280
|
+
//
|
|
281
|
+
// A caller that already has the full `description` inline (this
|
|
282
|
+
// module's own unit tests, a History-view's frozen/unleaned snapshot,
|
|
283
|
+
// or any future non-leaned data source) still gets it rendered
|
|
284
|
+
// immediately with no fetch at all -- `data-loaded="true"` marks that
|
|
285
|
+
// case so the client-side expand handler never re-fetches something it
|
|
286
|
+
// was already given. `summary` is only used as the short initial
|
|
287
|
+
// preview when the full field isn't present.
|
|
288
|
+
function descriptionDetailsHtml(task, safeId, safeTitle) {
|
|
289
|
+
const preview = task.description || task.summary;
|
|
290
|
+
if (!preview) return safeTitle;
|
|
291
|
+
const safePreview = escapeHtml(preview);
|
|
292
|
+
const safeUpdatedAt = escapeHtml(task.updated_at || task.updatedAt || '');
|
|
293
|
+
const hasFull = task.description ? 'true' : 'false';
|
|
294
|
+
return '<details class="bead-desc" data-bead-id="' + safeId + '" data-updated-at="' + safeUpdatedAt + '">' +
|
|
295
|
+
'<summary style="cursor: pointer; outline: none; list-style-position: inside;">' + safeTitle + '</summary>' +
|
|
296
|
+
'<div class="bead-desc-body" data-loaded="' + hasFull + '" style="margin-top: 6px; padding: 8px; background: rgba(0,0,0,0.15); border-left: 2px solid var(--accent); font-size: 11px; border-radius: 0 4px 4px 0; color: #a1a1aa; white-space: pre-wrap; font-family: monospace;">' +
|
|
297
|
+
safePreview +
|
|
298
|
+
'</div></details>';
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
// A childless node/section gets an invisible same-width spacer instead
|
|
302
|
+
// of a toggle, so id/label columns still line up whether or not a
|
|
303
|
+
// given row happens to have anything to fold away. `id` is the raw
|
|
304
|
+
// (unescaped) node id or synthetic section key -- escaped here, once,
|
|
305
|
+
// for the `data-toggle-id` attribute; the browser round-trips it back
|
|
306
|
+
// to the original string when read via `.dataset.toggleId` (HTML
|
|
307
|
+
// entity decoding), exactly like the existing `data-bead-id` attribute
|
|
308
|
+
// on `.bead-desc` already relies on.
|
|
309
|
+
function treeToggleHtml(id, hasChildren, collapsed) {
|
|
310
|
+
if (!hasChildren) {
|
|
311
|
+
return '<span style="display: inline-block; width: 16px;"></span>';
|
|
312
|
+
}
|
|
313
|
+
const safeToggleId = escapeHtml(id);
|
|
314
|
+
const label = collapsed ? '[+]' : '[-]';
|
|
315
|
+
const title = collapsed ? 'Expand' : 'Collapse';
|
|
316
|
+
return '<span class="tree-toggle" data-toggle-id="' + safeToggleId + '" title="' + title + '" ' +
|
|
317
|
+
'style="cursor: pointer; display: inline-block; width: 16px; user-select: none; color: #a1a1aa;">' + label + '</span>';
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
// apra-fleet-eft.52.1.1: `variant` distinguishes the Backlog header from
|
|
321
|
+
// the Sprint header, both in DOM (a stable `backlog-header`/
|
|
322
|
+
// `backlog-section` class not present on Sprint) and visually (a muted
|
|
323
|
+
// band + more prominent header), so the two regions are no longer
|
|
324
|
+
// rendered via an identical, indistinguishable code path.
|
|
325
|
+
function sectionHeaderRow(label, sectionKey, collapsed, variant) {
|
|
326
|
+
const isBacklog = variant === 'backlog';
|
|
327
|
+
const rowClass = isBacklog ? 'section-header backlog-section' : 'section-header';
|
|
328
|
+
const cellStyle = isBacklog
|
|
329
|
+
? 'padding: 10px 8px; font-size: 12px; font-weight: bold; letter-spacing: 0.5px; text-transform: uppercase; color: #e4e4e7; background: rgba(161,161,170,0.12); border-top: 1px solid rgba(255,255,255,0.15); border-bottom: 1px solid rgba(255,255,255,0.15);'
|
|
330
|
+
: 'padding: 10px 8px 4px; font-size: 11px; font-weight: bold; letter-spacing: 0.5px; color: #a1a1aa; border-bottom: 1px solid rgba(255,255,255,0.1);';
|
|
331
|
+
const headerClass = isBacklog ? ' backlog-header' : '';
|
|
332
|
+
return '<tr class="' + rowClass + '"><td colspan="6" class="section-header-cell' + headerClass + '" style="' + cellStyle + '">' +
|
|
333
|
+
treeToggleHtml(sectionKey, true, collapsed) + ' ' + escapeHtml(label) + '</td></tr>';
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
function emptySectionRow(message) {
|
|
337
|
+
return '<tr><td colspan="6" style="padding: 8px; font-size: 12px; color: #71717a; font-style: italic;">' + escapeHtml(message) + '</td></tr>';
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
// --- Build a containment tree from each task's `parent` field, not
|
|
341
|
+
// from `blocks`-type dependency edges (see module doc-comment above) ---
|
|
342
|
+
const map = {};
|
|
343
|
+
sprintTasks.forEach((t) => { map[t.id] = { ...t, children: [], blockedBy: [] }; });
|
|
344
|
+
|
|
345
|
+
const childrenOf = {}; // parentId -> [taskId, ...] (parent-containment, not blocking)
|
|
346
|
+
sprintTasks.forEach((t) => {
|
|
347
|
+
// 'blocks'-type dependency edges are still captured here -- they no
|
|
348
|
+
// longer decide tree placement, but every blocker is preserved and
|
|
349
|
+
// rendered as an inline annotation below so no dependency
|
|
350
|
+
// information is lost.
|
|
351
|
+
const deps = Array.isArray(t.dependencies) ? t.dependencies : [];
|
|
352
|
+
const blockerIds = deps
|
|
353
|
+
.filter((d) => d && d.type === 'blocks' && map[d.depends_on_id])
|
|
354
|
+
.map((d) => d.depends_on_id);
|
|
355
|
+
map[t.id].blockedBy = blockerIds;
|
|
356
|
+
|
|
357
|
+
// Only an in-dataset parent contributes to nesting -- a `parent`
|
|
358
|
+
// value pointing outside sprintTasks (e.g. an epic not itself part
|
|
359
|
+
// of this sprint run) leaves the task a root, same as having no
|
|
360
|
+
// parent at all.
|
|
361
|
+
const parentId = t.parent;
|
|
362
|
+
if (parentId !== undefined && parentId !== null && map[parentId]) {
|
|
363
|
+
(childrenOf[parentId] = childrenOf[parentId] || []).push(t.id);
|
|
364
|
+
}
|
|
365
|
+
});
|
|
366
|
+
|
|
367
|
+
// apra-fleet-eft.52.1.2: TOP-LEVEL Sprint roots only are primarily
|
|
368
|
+
// ordered by status urgency (statusRank above) -- In-progress -> Open ->
|
|
369
|
+
// Blocked -> Closed -- falling back to the existing priority-then-id
|
|
370
|
+
// ordering only to break ties within the same status. This is
|
|
371
|
+
// deliberately NOT applied recursively: `childrenOf[nodeId]` in
|
|
372
|
+
// renderNode below keeps its own unrelated (natural DAG / id) order, so
|
|
373
|
+
// a subtree's hierarchy stays legible rather than being scrambled by
|
|
374
|
+
// status.
|
|
375
|
+
function sprintRootSort(aId, bId) {
|
|
376
|
+
const a = map[aId];
|
|
377
|
+
const b = map[bId];
|
|
378
|
+
const ra = statusRank(a);
|
|
379
|
+
const rb = statusRank(b);
|
|
380
|
+
if (ra !== rb) return ra - rb;
|
|
381
|
+
const pa = (typeof a.priority === 'number' && Number.isFinite(a.priority)) ? a.priority : 99;
|
|
382
|
+
const pb = (typeof b.priority === 'number' && Number.isFinite(b.priority)) ? b.priority : 99;
|
|
383
|
+
if (pa !== pb) return pa - pb;
|
|
384
|
+
return String(aId).localeCompare(String(bId));
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
const roots = sprintTasks
|
|
388
|
+
.filter((t) => !(t.parent !== undefined && t.parent !== null && map[t.parent]))
|
|
389
|
+
.map((t) => t.id)
|
|
390
|
+
.sort(sprintRootSort);
|
|
391
|
+
|
|
392
|
+
function renderNode(nodeId, depth, rendered) {
|
|
393
|
+
if (rendered.has(nodeId)) return ''; // cycle-guard: never render twice
|
|
394
|
+
rendered.add(nodeId);
|
|
395
|
+
const node = map[nodeId];
|
|
396
|
+
|
|
397
|
+
const indent = depth * 20;
|
|
398
|
+
const prefix = depth > 0 ? String.fromCharCode(0x2514, 0x2500) + ' ' : '';
|
|
399
|
+
|
|
400
|
+
// Every bead-derived field is escaped before interpolation -- these
|
|
401
|
+
// are the exact fields the original (vulnerable) implementation
|
|
402
|
+
// injected raw.
|
|
403
|
+
const safeId = escapeHtml(node.id);
|
|
404
|
+
const safeTitle = escapeHtml(node.title);
|
|
405
|
+
|
|
406
|
+
const titleHtml = descriptionDetailsHtml(node, safeId, safeTitle);
|
|
407
|
+
|
|
408
|
+
// 'blocks'-type dependency edges no longer decide tree placement
|
|
409
|
+
// (nesting now comes from `parent`), so every blocker -- not just
|
|
410
|
+
// ones beyond a former "primary" -- must be listed here or the
|
|
411
|
+
// information would be lost.
|
|
412
|
+
let extraBlockedByHtml = '';
|
|
413
|
+
if (node.blockedBy.length > 0) {
|
|
414
|
+
const blockers = node.blockedBy.slice().sort().map((id) => '#' + escapeHtml(id)).join(', ');
|
|
415
|
+
extraBlockedByHtml = '<div style="margin-top: 4px; font-size: 10px; color: #71717a;">blocked by: ' + blockers + '</div>';
|
|
416
|
+
}
|
|
417
|
+
extraBlockedByHtml += partialClaimAnnotationHtml(node.partialClaim);
|
|
418
|
+
|
|
419
|
+
const children = (childrenOf[nodeId] || []).slice().sort();
|
|
420
|
+
const isCollapsed = children.length > 0 && collapsedIds.has(String(nodeId));
|
|
421
|
+
const toggleHtml = treeToggleHtml(nodeId, children.length > 0, isCollapsed);
|
|
422
|
+
|
|
423
|
+
// data-bead-id round-trips the raw (unescaped) id back via HTML entity
|
|
424
|
+
// decoding, same convention as .bead-desc's data-bead-id / .tree-toggle's
|
|
425
|
+
// data-toggle-id above -- lets a host page (e.g. the supervisor's Launch
|
|
426
|
+
// Sprint form) wire row click-to-select without parsing rendered text.
|
|
427
|
+
let html = '<tr data-bead-id="' + safeId + '" style="border-bottom: 1px solid rgba(255,255,255,0.05);">' +
|
|
428
|
+
'<td style="padding: 8px; padding-left: ' + (8 + indent) + 'px; vertical-align: top; width: 110px; color: ' + titleColor(node.status) + ';">' + toggleHtml + prefix + '#' + safeId + '</td>' +
|
|
429
|
+
'<td style="padding: 8px; vertical-align: top; color: ' + titleColor(node.status) + ';">' + titleHtml + extraBlockedByHtml + '</td>' +
|
|
430
|
+
'<td style="padding: 8px; vertical-align: top; width: 90px;">' + typeBadge(node.issue_type, node.title) + '</td>' +
|
|
431
|
+
'<td style="padding: 8px; vertical-align: top; width: 100px;">' + statusBadgeForNode(node) + '</td>' +
|
|
432
|
+
'<td style="padding: 8px; vertical-align: top; width: 50px;">' + priorityBadge(node.priority) + '</td>' +
|
|
433
|
+
'<td style="padding: 8px; vertical-align: top; width: 80px;">' + modelBadge(node.metadata) + '</td>' +
|
|
434
|
+
'</tr>';
|
|
435
|
+
|
|
436
|
+
// Always recurse (even when collapsed) so every descendant still
|
|
437
|
+
// gets added to `rendered` -- otherwise the end-of-pass safety-net
|
|
438
|
+
// sweep below would mistake a hidden-but-known descendant for an
|
|
439
|
+
// orphan and re-attach it as a spurious extra root. Only the
|
|
440
|
+
// concatenation into the returned HTML is conditional on collapse.
|
|
441
|
+
const childrenHtml = children.map((childId) => renderNode(childId, depth + 1, rendered)).join('');
|
|
442
|
+
if (!isCollapsed) {
|
|
443
|
+
html += childrenHtml;
|
|
444
|
+
}
|
|
445
|
+
return html;
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
// apra-fleet-k7s: Backlog is built into a tree from `blocks`-type
|
|
449
|
+
// dependency edges BETWEEN backlog items (mirrors the doc-comment above
|
|
450
|
+
// and reuses renderNode's own indent/prefix/cycle-guard mechanics, just
|
|
451
|
+
// keyed off a separate `backlogMap`/`backlogChildrenOf` built from
|
|
452
|
+
// blocks-edges instead of Sprint's `map`/`childrenOf` built from
|
|
453
|
+
// `parent`). A blocker outside the backlog set (e.g. it's actually in
|
|
454
|
+
// this run's Sprint, or not part of this dataset at all) does not
|
|
455
|
+
// count -- same "only an in-dataset edge nests" rule Sprint applies to
|
|
456
|
+
// `parent`.
|
|
457
|
+
const backlogMap = {};
|
|
458
|
+
backlogTasks.forEach((t) => { backlogMap[t.id] = { ...t, blockedBy: [] }; });
|
|
459
|
+
|
|
460
|
+
const backlogChildrenOf = {}; // blockerId -> [taskId, ...] (blocks-edge, not containment)
|
|
461
|
+
const nestedBacklogIds = new Set(); // ids nested under a blocker -- excluded from the root list
|
|
462
|
+
|
|
463
|
+
backlogTasks.forEach((t) => {
|
|
464
|
+
const deps = Array.isArray(t.dependencies) ? t.dependencies : [];
|
|
465
|
+
const blockerIds = deps
|
|
466
|
+
.filter((d) => d && d.type === 'blocks' && backlogMap[d.depends_on_id])
|
|
467
|
+
.map((d) => d.depends_on_id);
|
|
468
|
+
backlogMap[t.id].blockedBy = blockerIds;
|
|
469
|
+
if (blockerIds.length > 0) {
|
|
470
|
+
// A node renders exactly once (cycle-guard below), so with
|
|
471
|
+
// multiple in-set blockers only one can be the tree-parent --
|
|
472
|
+
// the lowest-sorted blocker id wins, for deterministic output.
|
|
473
|
+
// Every blocker (not just the nesting one) still appears in the
|
|
474
|
+
// inline "blocked by" annotation, so no edge is silently lost.
|
|
475
|
+
const primaryBlockerId = blockerIds.slice().sort()[0];
|
|
476
|
+
(backlogChildrenOf[primaryBlockerId] = backlogChildrenOf[primaryBlockerId] || []).push(t.id);
|
|
477
|
+
nestedBacklogIds.add(t.id);
|
|
478
|
+
}
|
|
479
|
+
});
|
|
480
|
+
|
|
481
|
+
function priorityThenId(aId, bId) {
|
|
482
|
+
const a = backlogMap[aId];
|
|
483
|
+
const b = backlogMap[bId];
|
|
484
|
+
const pa = (typeof a.priority === 'number' && Number.isFinite(a.priority)) ? a.priority : 99;
|
|
485
|
+
const pb = (typeof b.priority === 'number' && Number.isFinite(b.priority)) ? b.priority : 99;
|
|
486
|
+
if (pa !== pb) return pa - pb;
|
|
487
|
+
return String(aId).localeCompare(String(bId));
|
|
488
|
+
}
|
|
489
|
+
|
|
490
|
+
const backlogRoots = backlogTasks
|
|
491
|
+
.map((t) => t.id)
|
|
492
|
+
.filter((id) => !nestedBacklogIds.has(id))
|
|
493
|
+
.sort(priorityThenId);
|
|
494
|
+
|
|
495
|
+
function renderBacklogNode(nodeId, depth, rendered) {
|
|
496
|
+
if (rendered.has(nodeId)) return ''; // cycle-guard: never render twice
|
|
497
|
+
rendered.add(nodeId);
|
|
498
|
+
const node = backlogMap[nodeId];
|
|
499
|
+
|
|
500
|
+
const indent = depth * 20;
|
|
501
|
+
const prefix = depth > 0 ? String.fromCharCode(0x2514, 0x2500) + ' ' : '';
|
|
502
|
+
|
|
503
|
+
const safeId = escapeHtml(node.id);
|
|
504
|
+
const safeTitle = escapeHtml(node.title);
|
|
505
|
+
|
|
506
|
+
const titleHtml = descriptionDetailsHtml(node, safeId, safeTitle);
|
|
507
|
+
|
|
508
|
+
let extraBlockedByHtml = '';
|
|
509
|
+
if (node.blockedBy.length > 0) {
|
|
510
|
+
const blockers = node.blockedBy.slice().sort().map((id) => '#' + escapeHtml(id)).join(', ');
|
|
511
|
+
extraBlockedByHtml = '<div style="margin-top: 4px; font-size: 10px; color: #71717a;">blocked by: ' + blockers + '</div>';
|
|
512
|
+
}
|
|
513
|
+
extraBlockedByHtml += partialClaimAnnotationHtml(node.partialClaim);
|
|
514
|
+
|
|
515
|
+
const children = (backlogChildrenOf[nodeId] || []).slice().sort(priorityThenId);
|
|
516
|
+
const isCollapsed = children.length > 0 && collapsedIds.has(String(nodeId));
|
|
517
|
+
const toggleHtml = treeToggleHtml(nodeId, children.length > 0, isCollapsed);
|
|
518
|
+
|
|
519
|
+
let html = '<tr data-bead-id="' + safeId + '" style="border-bottom: 1px solid rgba(255,255,255,0.05);">' +
|
|
520
|
+
'<td style="padding: 8px; padding-left: ' + (8 + indent) + 'px; vertical-align: top; width: 110px; color: ' + titleColor(node.status) + ';">' + toggleHtml + prefix + '#' + safeId + '</td>' +
|
|
521
|
+
'<td style="padding: 8px; vertical-align: top; color: ' + titleColor(node.status) + ';">' + titleHtml + extraBlockedByHtml + '</td>' +
|
|
522
|
+
'<td style="padding: 8px; vertical-align: top; width: 90px;">' + typeBadge(node.issue_type, node.title) + '</td>' +
|
|
523
|
+
'<td style="padding: 8px; vertical-align: top; width: 100px;">' + statusBadgeForNode(node) + '</td>' +
|
|
524
|
+
'<td style="padding: 8px; vertical-align: top; width: 50px;">' + priorityBadge(node.priority) + '</td>' +
|
|
525
|
+
'<td style="padding: 8px; vertical-align: top; width: 80px;">' + modelBadge(node.metadata) + '</td>' +
|
|
526
|
+
'</tr>';
|
|
527
|
+
|
|
528
|
+
// Same "always recurse, conditionally concatenate" rule as
|
|
529
|
+
// renderNode above -- keeps the safety-net sweep below from
|
|
530
|
+
// re-attaching a hidden-but-known descendant as a spurious root.
|
|
531
|
+
const childrenHtml = children.map((childId) => renderBacklogNode(childId, depth + 1, rendered)).join('');
|
|
532
|
+
if (!isCollapsed) {
|
|
533
|
+
html += childrenHtml;
|
|
534
|
+
}
|
|
535
|
+
return html;
|
|
536
|
+
}
|
|
537
|
+
|
|
538
|
+
let html = '<table style="width: 100%; border-collapse: collapse; text-align: left; font-size: 13px;">';
|
|
539
|
+
html += '<tr style="border-bottom: 1px solid rgba(255,255,255,0.1);">' +
|
|
540
|
+
'<th style="padding: 8px;">ID</th><th style="padding: 8px;">Title</th><th style="padding: 8px;">Type</th>' +
|
|
541
|
+
'<th style="padding: 8px;">Status</th><th style="padding: 8px;">Pri</th><th style="padding: 8px;">Model</th></tr>';
|
|
542
|
+
|
|
543
|
+
// The two top-level section headers are themselves collapsible via the
|
|
544
|
+
// same synthetic-id convention as any other .tree-toggle: folding a
|
|
545
|
+
// section hides its ENTIRE body (all root rows and their subtrees),
|
|
546
|
+
// not just direct children -- there is no safety-net concern here
|
|
547
|
+
// (unlike node-level collapse) since a section's rows have nowhere
|
|
548
|
+
// else in the output they could spuriously reappear.
|
|
549
|
+
//
|
|
550
|
+
// apra-fleet-eft.89: a section (header + body) is only emitted when it
|
|
551
|
+
// has at least one task -- an empty sprintTasks/backlogTasks list skips
|
|
552
|
+
// that entire section (no header, no "No sprint tasks."/"No backlog
|
|
553
|
+
// items." placeholder row), rather than always rendering both. This
|
|
554
|
+
// keeps a caller that only ever supplies one of the two lists (e.g. the
|
|
555
|
+
// supervisor's renderBeadsHtml([], tasks, ...)) from showing an
|
|
556
|
+
// always-empty sibling section.
|
|
557
|
+
const sprintCollapsed = collapsedIds.has('section:sprint');
|
|
558
|
+
if (sprintTasks.length > 0) {
|
|
559
|
+
html += sectionHeaderRow('Sprint', 'section:sprint', sprintCollapsed);
|
|
560
|
+
if (!sprintCollapsed) {
|
|
561
|
+
const rendered = new Set();
|
|
562
|
+
roots.forEach((rootId) => {
|
|
563
|
+
html += renderNode(rootId, 0, rendered);
|
|
564
|
+
});
|
|
565
|
+
// Safety net: any task that never got attached (should not
|
|
566
|
+
// happen with well-formed data, but is not assumed) still
|
|
567
|
+
// renders, as its own root, rather than being silently dropped.
|
|
568
|
+
sprintTasks.forEach((t) => {
|
|
569
|
+
if (!rendered.has(t.id)) {
|
|
570
|
+
html += renderNode(t.id, 0, rendered);
|
|
571
|
+
}
|
|
572
|
+
});
|
|
573
|
+
}
|
|
574
|
+
}
|
|
575
|
+
|
|
576
|
+
const backlogCollapsed = collapsedIds.has('section:backlog');
|
|
577
|
+
if (backlogTasks.length > 0) {
|
|
578
|
+
html += sectionHeaderRow('Backlog', 'section:backlog', backlogCollapsed, 'backlog');
|
|
579
|
+
if (!backlogCollapsed) {
|
|
580
|
+
// Roots (items with no in-set blocker, or whose blocker isn't
|
|
581
|
+
// part of this backlog dataset) are sorted priority-then-id for
|
|
582
|
+
// stable, scannable ordering; any item nested under a blocker
|
|
583
|
+
// (see `backlogChildrenOf` above) renders under that blocker
|
|
584
|
+
// instead, not flattened into this top-level sort.
|
|
585
|
+
const renderedBacklog = new Set();
|
|
586
|
+
backlogRoots.forEach((rootId) => {
|
|
587
|
+
html += renderBacklogNode(rootId, 0, renderedBacklog);
|
|
588
|
+
});
|
|
589
|
+
// Safety net: any backlog task never attached (e.g. a
|
|
590
|
+
// blocks-cycle among backlog items -- should not happen with
|
|
591
|
+
// well-formed bd data, but is not assumed) still renders, as
|
|
592
|
+
// its own root, rather than being silently dropped.
|
|
593
|
+
backlogTasks.forEach((t) => {
|
|
594
|
+
if (!renderedBacklog.has(t.id)) {
|
|
595
|
+
html += renderBacklogNode(t.id, 0, renderedBacklog);
|
|
596
|
+
}
|
|
597
|
+
});
|
|
598
|
+
}
|
|
599
|
+
}
|
|
600
|
+
|
|
601
|
+
// Both lists empty: neither section rendered above, so the table would
|
|
602
|
+
// otherwise be just the 6-column header row with no body at all. That
|
|
603
|
+
// is well-formed on its own, but a single graceful placeholder row
|
|
604
|
+
// reads better than a header with nothing under it.
|
|
605
|
+
if (sprintTasks.length === 0 && backlogTasks.length === 0) {
|
|
606
|
+
html += emptySectionRow('No tasks to display.');
|
|
607
|
+
}
|
|
608
|
+
|
|
609
|
+
html += '</table>';
|
|
610
|
+
return html;
|
|
611
|
+
}
|
|
612
|
+
|
|
613
|
+
/**
|
|
614
|
+
* apra-fleet-eft.37.3: pure HTML-string builder for the auto-sprint verdict
|
|
615
|
+
* badge + PR link, moved OUT of the generic workflow core (which used to
|
|
616
|
+
* mint `state.verdict`/`state.prUrl` by name -- see
|
|
617
|
+
* docs/workflow-core-boundary-refactoring.md M2) and into this se-owned
|
|
618
|
+
* extension. Core now only stores the workflow script's own return value
|
|
619
|
+
* WHOLESALE and opaquely as `state.result`, and renders its top-level
|
|
620
|
+
* SCALAR fields as a generic, unstyled key/value strip (src/viewer/
|
|
621
|
+
* index.mjs's `#result-strip`). This function reads the SAME
|
|
622
|
+
* `state.result` object, but knows the two keys that are meaningful for an
|
|
623
|
+
* auto-sprint run specifically -- `verdict` (colored by outcome) and
|
|
624
|
+
* `prUrl` (link-ified) -- exactly the se-domain knowledge that has no
|
|
625
|
+
* business living in the generic engine.
|
|
626
|
+
*
|
|
627
|
+
* Returns '' when `result` carries neither key (e.g. a non-auto-sprint
|
|
628
|
+
* workflow, or a run that hasn't finished yet), so the caller can hide its
|
|
629
|
+
* container entirely rather than show an empty badge strip.
|
|
630
|
+
*
|
|
631
|
+
* @param {{ verdict?: string|null, prUrl?: string|null }|null|undefined} result
|
|
632
|
+
* @returns {string}
|
|
633
|
+
*/
|
|
634
|
+
export function renderResultExtrasHtml(result) {
|
|
635
|
+
const verdict = result && typeof result === 'object' ? result.verdict : undefined;
|
|
636
|
+
const prUrl = result && typeof result === 'object' ? result.prUrl : undefined;
|
|
637
|
+
// Nothing se-meaningful to show (non-auto-sprint workflow, or a run that
|
|
638
|
+
// hasn't finished yet) -- let the caller hide its container entirely.
|
|
639
|
+
if (verdict == null && prUrl == null) return '';
|
|
640
|
+
|
|
641
|
+
// Color signals outcome, same register as the beads status badges above:
|
|
642
|
+
// a clean PASS/MERGED/APPROVED recedes to green, anything that means
|
|
643
|
+
// "this needs a human's attention" (FAIL/CHANGES_NEEDED/ABORTED) draws
|
|
644
|
+
// the eye in red; an unrecognized verdict string still renders, just in
|
|
645
|
+
// a neutral grey, rather than being silently dropped.
|
|
646
|
+
const VERDICT_COLORS = {
|
|
647
|
+
PASS: 'var(--success)',
|
|
648
|
+
MERGED: 'var(--success)',
|
|
649
|
+
APPROVED: 'var(--success)',
|
|
650
|
+
FAIL: 'var(--danger)',
|
|
651
|
+
CHANGES_NEEDED: 'var(--danger)',
|
|
652
|
+
ABORTED: 'var(--danger)',
|
|
653
|
+
};
|
|
654
|
+
let verdictHtml = '';
|
|
655
|
+
if (verdict != null) {
|
|
656
|
+
const key = String(verdict).toUpperCase();
|
|
657
|
+
const color = VERDICT_COLORS[key] || '#a1a1aa';
|
|
658
|
+
verdictHtml = '<span style="color: ' + color + '; font-weight: 700; font-size: 11px; ' +
|
|
659
|
+
'border: 1px solid ' + color + '; border-radius: 4px; padding: 2px 6px; white-space: nowrap;">' +
|
|
660
|
+
escapeHtml(String(verdict)) + '</span>';
|
|
661
|
+
}
|
|
662
|
+
|
|
663
|
+
let prHtml = '';
|
|
664
|
+
if (typeof prUrl === 'string' && prUrl.length > 0) {
|
|
665
|
+
prHtml = '<a href="' + escapeHtml(prUrl) + '" target="_blank" rel="noopener noreferrer" ' +
|
|
666
|
+
'style="color: var(--accent); font-size: 11px; text-decoration: none; white-space: nowrap;">PR -></a>';
|
|
667
|
+
}
|
|
668
|
+
|
|
669
|
+
return verdictHtml + prHtml;
|
|
670
|
+
}
|
|
671
|
+
|
|
672
|
+
// apra-fleet-eft.37.4 (M3, docs/workflow-core-boundary-refactoring.md):
|
|
673
|
+
// relocated verbatim from packages/apra-fleet-workflow/src/viewer/index.mjs's
|
|
674
|
+
// former findBeadById() -- that was the one place core reached into
|
|
675
|
+
// `state.extensions.beads.sprintTasks/backlogTasks` by name, a deliberate
|
|
676
|
+
// domain leak the eft.27.2 comment it replaced called out explicitly. Core
|
|
677
|
+
// now only knows the generic `detailLookup(state, id)` hook shape (see
|
|
678
|
+
// `beadsExtension.detailLookup` below); this function is the se-owned
|
|
679
|
+
// knowledge of the beads extension's own data shape.
|
|
680
|
+
//
|
|
681
|
+
// Runs server-side (Node), invoked by core's GET
|
|
682
|
+
// /extensions/beads/detail/:itemId route -- never embedded into the
|
|
683
|
+
// browser-side `js` string below, unlike renderBeadsHtml/renderResultExtrasHtml.
|
|
684
|
+
function findBeadById(state, id) {
|
|
685
|
+
const beadsExt = state.extensions && state.extensions.beads;
|
|
686
|
+
if (!beadsExt) return null;
|
|
687
|
+
const pools = [beadsExt.sprintTasks, beadsExt.backlogTasks];
|
|
688
|
+
for (const pool of pools) {
|
|
689
|
+
if (!Array.isArray(pool)) continue;
|
|
690
|
+
const match = pool.find((t) => t && String(t.id) === String(id));
|
|
691
|
+
if (match) return match;
|
|
692
|
+
}
|
|
693
|
+
return null;
|
|
694
|
+
}
|
|
695
|
+
|
|
696
|
+
export const beadsExtension = {
|
|
697
|
+
id: 'beads',
|
|
698
|
+
title: 'Tasks',
|
|
699
|
+
// apra-fleet-eft.37.4 (M3): the beads extension's detailLookup hook,
|
|
700
|
+
// called by core's generic GET /extensions/beads/detail/:itemId route
|
|
701
|
+
// (packages/apra-fleet-workflow/src/viewer/index.mjs) against the LIVE,
|
|
702
|
+
// full-fidelity `state` object. Returns the shape the hook contract
|
|
703
|
+
// requires -- `{text, updatedAt} | null` -- never the raw bead object,
|
|
704
|
+
// so core stays ignorant of bd's own field names (`description`,
|
|
705
|
+
// `updated_at`).
|
|
706
|
+
detailLookup(state, id) {
|
|
707
|
+
const bead = findBeadById(state, id);
|
|
708
|
+
if (!bead) return null;
|
|
709
|
+
return {
|
|
710
|
+
text: bead.description || '',
|
|
711
|
+
updatedAt: bead.updated_at || bead.updatedAt || null
|
|
712
|
+
};
|
|
713
|
+
},
|
|
714
|
+
js: `
|
|
715
|
+
${escapeHtml.toString()}
|
|
716
|
+
${renderBeadsHtml.toString()}
|
|
717
|
+
${renderResultExtrasHtml.toString()}
|
|
718
|
+
|
|
719
|
+
// apra-fleet-eft.37.3: mounts the auto-sprint verdict badge + PR
|
|
720
|
+
// link into the header, next to core's generic (unstyled)
|
|
721
|
+
// #result-strip -- see viewer/index.mjs's 'workflow:result'
|
|
722
|
+
// CustomEvent, dispatched on every renderState() with
|
|
723
|
+
// state.result (core's opaque, workflow-declared result) as its
|
|
724
|
+
// detail. The container is created lazily on first non-empty
|
|
725
|
+
// render and removed again whenever there is nothing se-specific
|
|
726
|
+
// to show (e.g. before a run has finished).
|
|
727
|
+
function renderResultExtras(result) {
|
|
728
|
+
const html = renderResultExtrasHtml(result);
|
|
729
|
+
let el = document.getElementById('se-result-extras');
|
|
730
|
+
if (!html) {
|
|
731
|
+
if (el) el.remove();
|
|
732
|
+
return;
|
|
733
|
+
}
|
|
734
|
+
if (!el) {
|
|
735
|
+
const headerActions = document.querySelector('.header-actions');
|
|
736
|
+
if (!headerActions) return;
|
|
737
|
+
el = document.createElement('div');
|
|
738
|
+
el.id = 'se-result-extras';
|
|
739
|
+
el.style.display = 'flex';
|
|
740
|
+
el.style.gap = '8px';
|
|
741
|
+
el.style.alignItems = 'center';
|
|
742
|
+
headerActions.insertBefore(el, headerActions.firstChild);
|
|
743
|
+
}
|
|
744
|
+
el.innerHTML = html;
|
|
745
|
+
}
|
|
746
|
+
|
|
747
|
+
// apra-fleet-eft.27.2 / apra-fleet-eft.37.4 (M3): on-demand
|
|
748
|
+
// bead-description fetch + browser localStorage cache. GET /state
|
|
749
|
+
// now serves only a short \`summary\` per bead (apra-fleet-eft.27.1)
|
|
750
|
+
// -- the full text is fetched here, from the GENERIC
|
|
751
|
+
// GET /extensions/beads/detail/:itemId route (src/viewer/index.mjs,
|
|
752
|
+
// delegating to this extension's own \`detailLookup\` above -- the
|
|
753
|
+
// old sprint-named /beads/:id/description route is now core's
|
|
754
|
+
// one-release BOUNDARY-COMPAT alias, no longer called from here),
|
|
755
|
+
// the moment a user actually expands a row, and cached under the
|
|
756
|
+
// bead's id. Each cache entry also carries the \`updatedAt\` it was
|
|
757
|
+
// fetched against, so a later lean-state poll reporting a NEW
|
|
758
|
+
// updatedAt for that bead transparently invalidates the cache and
|
|
759
|
+
// triggers a refetch instead of ever serving stale text.
|
|
760
|
+
const BEAD_DESC_CACHE_PREFIX = 'apra-fleet-bead-desc:';
|
|
761
|
+
|
|
762
|
+
function beadDescCacheKey(id) { return BEAD_DESC_CACHE_PREFIX + id; }
|
|
763
|
+
|
|
764
|
+
function readBeadDescCache(id, updatedAt) {
|
|
765
|
+
try {
|
|
766
|
+
const raw = localStorage.getItem(beadDescCacheKey(id));
|
|
767
|
+
if (!raw) return null;
|
|
768
|
+
const parsed = JSON.parse(raw);
|
|
769
|
+
if (parsed && parsed.updatedAt === updatedAt) return parsed.description;
|
|
770
|
+
} catch (e) {
|
|
771
|
+
// Corrupt or unavailable cache entry -- treat as a miss,
|
|
772
|
+
// never let a caching problem break the expand action.
|
|
773
|
+
}
|
|
774
|
+
return null;
|
|
775
|
+
}
|
|
776
|
+
|
|
777
|
+
function writeBeadDescCache(id, updatedAt, description) {
|
|
778
|
+
try {
|
|
779
|
+
localStorage.setItem(beadDescCacheKey(id), JSON.stringify({ updatedAt: updatedAt, description: description }));
|
|
780
|
+
} catch (e) {
|
|
781
|
+
// localStorage full/unavailable (quota, private browsing) --
|
|
782
|
+
// non-fatal: the fetch itself already succeeded and rendered.
|
|
783
|
+
}
|
|
784
|
+
}
|
|
785
|
+
|
|
786
|
+
async function loadBeadDescription(detailsEl) {
|
|
787
|
+
const bodyEl = detailsEl.querySelector('.bead-desc-body');
|
|
788
|
+
// Already showing the full text (either a prior fetch/cache hit,
|
|
789
|
+
// or a caller that inlined the full description up front) --
|
|
790
|
+
// no network request on a repeat expand.
|
|
791
|
+
if (!bodyEl || bodyEl.dataset.loaded === 'true') return;
|
|
792
|
+
|
|
793
|
+
const id = detailsEl.dataset.beadId;
|
|
794
|
+
const updatedAt = detailsEl.dataset.updatedAt || '';
|
|
795
|
+
|
|
796
|
+
const cached = readBeadDescCache(id, updatedAt);
|
|
797
|
+
if (cached !== null) {
|
|
798
|
+
bodyEl.textContent = cached;
|
|
799
|
+
bodyEl.dataset.loaded = 'true';
|
|
800
|
+
return;
|
|
801
|
+
}
|
|
802
|
+
|
|
803
|
+
bodyEl.textContent = 'Loading...';
|
|
804
|
+
try {
|
|
805
|
+
const res = await fetch('/extensions/beads/detail/' + encodeURIComponent(id));
|
|
806
|
+
if (!res.ok) { bodyEl.textContent = '(description unavailable)'; return; }
|
|
807
|
+
const data = await res.json();
|
|
808
|
+
const description = data.text || '(no description)';
|
|
809
|
+
bodyEl.textContent = description;
|
|
810
|
+
bodyEl.dataset.loaded = 'true';
|
|
811
|
+
writeBeadDescCache(id, updatedAt, description);
|
|
812
|
+
} catch (e) {
|
|
813
|
+
bodyEl.textContent = '(failed to load description)';
|
|
814
|
+
}
|
|
815
|
+
}
|
|
816
|
+
|
|
817
|
+
// The 'toggle' event does not bubble in every browser, but it IS
|
|
818
|
+
// still observable during the capture phase regardless of bubbling
|
|
819
|
+
// -- a single document-level capture listener therefore catches
|
|
820
|
+
// every <details class="bead-desc"> toggle, including rows
|
|
821
|
+
// recreated by the full innerHTML rebuild below on each poll, with
|
|
822
|
+
// no per-row listener wiring or cleanup needed.
|
|
823
|
+
document.addEventListener('toggle', function (e) {
|
|
824
|
+
const el = e.target;
|
|
825
|
+
if (el && el.tagName === 'DETAILS' && el.classList && el.classList.contains('bead-desc') && el.open) {
|
|
826
|
+
loadBeadDescription(el);
|
|
827
|
+
}
|
|
828
|
+
}, true);
|
|
829
|
+
|
|
830
|
+
// apra-fleet-4p5: collapse state lives here, in this closure -- not
|
|
831
|
+
// on any DOM node -- so it survives the full innerHTML rebuild each
|
|
832
|
+
// 'workflow:state:beads' tick performs (the exact same rebuild that
|
|
833
|
+
// would otherwise silently reset every DETAILS element's \`open\`
|
|
834
|
+
// attribute, if bead descriptions relied on that instead of the
|
|
835
|
+
// cache above). \`lastBeadsData\` caches the most recent poll's
|
|
836
|
+
// payload so a pure collapse/expand click can re-render immediately
|
|
837
|
+
// without waiting on (or synthesizing) a new server payload.
|
|
838
|
+
const collapsedBeadIds = new Set();
|
|
839
|
+
let lastBeadsData = { sprintTasks: [], backlogTasks: [] };
|
|
840
|
+
|
|
841
|
+
function renderBeadsPanel() {
|
|
842
|
+
const container = document.getElementById('extension-beads');
|
|
843
|
+
if (!container) return;
|
|
844
|
+
container.innerHTML = renderBeadsHtml(lastBeadsData.sprintTasks || [], lastBeadsData.backlogTasks || [], collapsedBeadIds);
|
|
845
|
+
}
|
|
846
|
+
|
|
847
|
+
// Single document-level click-delegation listener (same rationale
|
|
848
|
+
// as the capture-phase 'toggle' listener above) catches every
|
|
849
|
+
// \`.tree-toggle\` click, including toggles on rows recreated by the
|
|
850
|
+
// innerHTML rebuild on each poll -- no per-row listener wiring or
|
|
851
|
+
// cleanup needed. \`data-toggle-id\` round-trips back to the original
|
|
852
|
+
// (unescaped) bead id or synthetic section key via HTML entity
|
|
853
|
+
// decoding, the same way \`data-bead-id\` already does above.
|
|
854
|
+
document.addEventListener('click', function (e) {
|
|
855
|
+
const toggle = e.target && e.target.closest ? e.target.closest('.tree-toggle') : null;
|
|
856
|
+
if (!toggle) return;
|
|
857
|
+
const id = toggle.dataset.toggleId;
|
|
858
|
+
if (!id) return;
|
|
859
|
+
if (collapsedBeadIds.has(id)) {
|
|
860
|
+
collapsedBeadIds.delete(id);
|
|
861
|
+
} else {
|
|
862
|
+
collapsedBeadIds.add(id);
|
|
863
|
+
}
|
|
864
|
+
renderBeadsPanel();
|
|
865
|
+
});
|
|
866
|
+
|
|
867
|
+
document.addEventListener('workflow:state:beads', (e) => {
|
|
868
|
+
lastBeadsData = e.detail || {};
|
|
869
|
+
renderBeadsPanel();
|
|
870
|
+
});
|
|
871
|
+
|
|
872
|
+
// apra-fleet-eft.37.3: mounts the auto-sprint verdict badge + PR
|
|
873
|
+
// link into the header, next to core's generic (unstyled)
|
|
874
|
+
// #result-strip -- see viewer/index.mjs's 'workflow:result'
|
|
875
|
+
// CustomEvent, dispatched on every renderState() with
|
|
876
|
+
// state.result (core's opaque, workflow-declared result) as its
|
|
877
|
+
// detail.
|
|
878
|
+
document.addEventListener('workflow:result', (e) => {
|
|
879
|
+
renderResultExtras(e.detail);
|
|
880
|
+
});
|
|
881
|
+
`
|
|
882
|
+
};
|