Commit Graph

215 Commits

Author SHA1 Message Date
gsxdsm
e7863da66e feat(KB-010): add autoResolveConflicts setting with intelligent merge conflict resolution
- Add autoResolveConflicts setting to types and store (default: true)
- Implement smart conflict detection for lock files and generated files
- Add 3-attempt retry logic with escalating strategies to merger
- Auto-resolve lock files using 'ours', trivial whitespace conflicts
- Track mergeRetries per task for retry loop management
- Update AGENTS.md with conflict resolution documentation
- Add comprehensive merger tests for retry scenarios
2026-03-29 18:27:23 -07:00
gsxdsm
efd7c176fb feat(KB-004): add GitHub PR creation and comment monitoring
- Add PR fields (prInfo, prNumber, prUrl) to Task type and TaskStore with updatePrInfo method
- Add PR Management API endpoints: create, status, refresh with per-repo rate limiting
- Add GitHubClient for PR creation and status fetching with comment support
- Add PrSection component for PR status display and actions in dashboard
- Add PR comment monitoring engine with PrMonitor and PrCommentHandler
- Integrate PR monitoring into scheduler for automatic PR tracking
- Add comprehensive tests for PR features in all packages
2026-03-29 18:10:35 -07:00
gsxdsm
43c81c1f55 feat(KB-003): add task steering feature with UI and prompt injection
- Add SteeringComment type to core types for user steering input
- Add addSteeringComment method to TaskStore with persistence
- Add POST /api/tasks/:id/steer endpoint for adding steering comments
- Add frontend API client and SteeringTab UI component
- Inject steering comments into execution prompt for agent guidance
- Add comprehensive tests for store, API, UI, and executor components
- Include changeset for patch release
2026-03-29 17:40:42 -07:00
Dustin Byrne
1a73733be6 fix(KB-182): strengthen spec review post-session gate to require explicit APPROVE
- Change post-session gate from only blocking REVISE to requiring explicit APPROVE verdict
- Block tasks from reaching executor when review_spec was never called (null verdict)
- Block tasks on RETHINK, UNAVAILABLE, and reviewer-error paths
- Add tests for all non-APPROVE verdict paths: null, RETHINK, UNAVAILABLE, reviewer throw
- Update existing tests to invoke review_spec with APPROVE so they pass the stricter gate
2026-03-28 17:41:10 -04:00
Dustin Byrne
0772709955 feat(KB-176): make enginePaused a soft pause that lets running agents finish
- Remove agent termination listeners for enginePaused in executor and triage
- Update Settings.enginePaused JSDoc to document soft-pause semantics
- Update executor/triage/integration tests to assert sessions are NOT disposed on enginePaused
- Remove pause-abort tracking for enginePaused (only globalPause hard-stops agents)
- Add changeset for the behavioral change
2026-03-28 16:47:23 -04:00
Dustin Byrne
e7711013c9 fix: triage agent now knows of the task_create tool 2026-03-28 16:30:23 -04:00
Dustin Byrne
853496a74f fix: skip merger agent when squash merge stages nothing 2026-03-28 16:30:23 -04:00
Dustin Byrne
d7a9daf5c5 feat(KB-172): add spec review loop to triage agent
- Extend reviewer with 'spec' review type and spec review format template
- Add review_spec tool to triage agent for independent spec quality evaluation
- Implement APPROVE/REVISE/RETHINK loop with conversation rewind on RETHINK
- Add post-session gate to block tasks with unresolved REVISE verdicts from moving to todo
- Add tests for reviewer spec support and triage review loop (APPROVE, REVISE, RETHINK paths)
2026-03-28 16:30:23 -04:00
Dustin Byrne
08cdacf417 feat(KB-161): terminate active agent sessions on engine pause
- Add enginePaused agent termination to executor (kills sessions, moves tasks back to todo)
- Add enginePaused agent termination to triage processor (kills sessions, clears specifying status)
- Update enginePaused JSDoc to reflect new termination behavior vs old graceful drain
- Add unit tests for executor/triage pause termination and integration tests for restart flow
- Include changeset for engine pause behavior change
2026-03-28 16:30:23 -04:00
Dustin Byrne
f823161804 feat(KB-157): add soft-pause (enginePaused) alongside hard-stop (globalPause)
- Add enginePaused field to Settings type with soft-pause semantics (drain queue, don't kill agents)
- Gate scheduler, triage, auto-merge, and periodic merge retry on enginePaused
- Add Pause and Stop buttons to dashboard Header replacing single toggle
- Wire enginePaused state through App with optimistic toggle and unpause resume logic
- Add tests for scheduler, triage, dashboard CLI, Header, and App covering pause behavior
2026-03-28 16:30:23 -04:00
Dustin Byrne
e1bd4be9be fix(KB-153): detect exhausted-retry errors from pi-coding-agent sessions
- Add checkSessionError helper that re-raises errors stored on session.state.error after prompt() resolves silently when retries are exhausted
- Integrate checkSessionError in executor, triage, merger, and reviewer agents so existing catch blocks with isUsageLimitError can trigger UsageLimitPauser
- Add tests for checkSessionError and for each agent's error propagation path
- Add audit report documenting the error propagation gap
- Add changeset for the fix
2026-03-28 16:30:23 -04:00
Dustin Byrne
ab2b663385 feat(KB-154): persist worktree pool across engine restarts
- Add rehydrate() method and scanIdleWorktrees() to restore idle worktrees from disk on startup
- Add cleanupOrphanedWorktrees() to remove stale worktrees when recycling is disabled
- Wire startup rehydrate/cleanup into dashboard command based on recycleWorktrees setting
- Export new functions from @kb/engine and update dashboard imports
- Add unit tests for rehydrate/scan/cleanup and integration tests for restart resilience
2026-03-28 16:30:23 -04:00
Dustin Byrne
0a5b1ed76f feat(KB-152): make triage poll() dispatch specifyTask() calls concurrently
- Change poll() to fire specifyTask() with `void` instead of `await`, enabling concurrent task specification bounded by AgentSemaphore
- Add JSDoc to poll() documenting concurrent dispatch and re-entrance guard behavior
- Add tests for concurrent dispatch, semaphore limiting, polling flag reset, and overlapping poll discovery
- Update existing re-entrance guard test to block on listTasks (discovery) rather than specifyTask
- Fix existing paused-tasks and globalPause tests for non-blocking dispatch timing
2026-03-28 16:30:23 -04:00
Dustin Byrne
a37f1d2260 feat(KB-151): immediately resume agentic activity on global unpause
- Add settings:updated listener in Scheduler to trigger schedule() on globalPause true→false transition
- Add settings:updated listener in TriageProcessor to trigger poll() on globalPause true→false transition
- Add unpause handler in dashboard to resume orphaned executor tasks and sweep merge queue
- Guard all resume paths against no-op transitions (false→false, true→true) and stopped state
- Add tests for all three resume paths covering transition edge cases
2026-03-28 16:30:23 -04:00
Dustin Byrne
0f2958df69 feat(KB-150): kill active agent sessions on global pause
- Add settings:updated event to TaskStore with previous/new settings payload
- Kill all active executor agent sessions when globalPause transitions false→true
- Kill all active triage specification sessions on global pause with clean status reset
- Track and dispose active merger session on global pause via onSession callback
- Add JSDoc documenting global pause behavior on executor and triage constructors
2026-03-28 16:30:23 -04:00
Dustin Byrne
711b19740d fix(KB-148): fix triage concurrency and scheduler double-counting
- Add re-entrance guard to triage poll() to prevent overlapping poll cycles
- Move status update to 'specifying' inside semaphore callback so queued tasks don't appear active
- Fix scheduler double-counting specifying tasks when semaphore is present
- Add tests for poll re-entrance guard, semaphore-aware status transitions, and scheduler slot counting
- Add changeset for patch release
2026-03-28 16:30:23 -04:00
Dustin Byrne
85687be6a0 feat(KB-147): auto-pause engine on API usage limit errors
- Add UsageLimitPauser class and isUsageLimitError detector for rate limits, overloaded, and quota errors
- Integrate usage limit detection into executor, triage, and merger error handlers
- Wire shared UsageLimitPauser instance in dashboard startup across all agents
- Export UsageLimitPauser and isUsageLimitError from @kb/engine public API
- Add comprehensive tests for detector patterns and agent integration
2026-03-28 16:30:23 -04:00
Dustin Byrne
36873e57ca feat(KB-145): add global pause button to halt all AI engine activity
- Add globalPause setting to core Settings type with default false
- Guard scheduler, triage, and auto-merge queue to skip work when globalPause is active
- Add pause/play toggle button in dashboard Header with optimistic UI and rollback on failure
- Add tests for scheduler, triage, Header, and App global pause behavior
- Include minor changeset for the new feature
2026-03-28 16:30:23 -04:00
Dustin Byrne
2bdd628d6d feat(KB-142): add confirm gate and abort flow to task_add_dep tool
- Add confirm parameter to task_add_dep requiring explicit opt-in before destructive action
- On confirm, abort execution, discard worktree/branch, and move task to triage
- Add triage as valid transition from in-progress for dependency-triggered re-specification
- Auto-move todo tasks to triage when dependencies are added
- Update EXECUTOR_SYSTEM_PROMPT with task_add_dep confirm behavior documentation
2026-03-28 16:30:23 -04:00
Dustin Byrne
a59fb5b857 fix(KB-144): exclude in-review worktrees from maxWorktrees limit
- Change activeWorktrees filter to only count in-progress tasks, not in-review with worktree
- Update existing scheduler test to reflect in-progress-only counting
- Add 3 new tests covering in-review tasks not blocking scheduling
- Update maxWorktrees JSDoc to reflect new semantics
- Add changeset for patch release
2026-03-28 16:30:23 -04:00
Dustin Byrne
7c685f2138 fix: prompt agents to declare dependencies when creating related tasks 2026-03-28 16:30:23 -04:00
Dustin Byrne
8a6396e4d1 Revert "feat(KB-140): add task_add_dep tool to executor"
This reverts commit a9dae834a59b60701874ee09e0b1f86d0d98b3e2.
2026-03-28 16:30:23 -04:00
Dustin Byrne
861179cbe7 feat(KB-139): parse dependencies, size, and review level from PROMPT.md after triage
- Add parseDependenciesFromPrompt to TaskStore to extract task IDs from ## Dependencies section
- Call dependency parser in specifyTask after PROMPT.md is written by triage agent
- Extract size (S/M/L) and review level from PROMPT.md front-matter into task metadata
- Extend updateTask to accept size and reviewLevel fields
- Add comprehensive tests for dependency parsing and triage integration
2026-03-28 16:30:23 -04:00
Dustin Byrne
8fd8b36f7d feat(KB-140): add task_add_dep tool to executor
- Add task_add_dep tool allowing agents to declare dependencies mid-execution
- Validate against self-dependency, non-existent targets, and duplicates
- Append new dependency to existing array without overwriting
- Log dependency additions via store.logEntry
- Add 7 tests covering success, self-dep, missing target, duplicate, and append behavior
2026-03-28 16:30:23 -04:00
Dustin Byrne
d151a31789 feat(KB-141): add dependency awareness to triage system prompt and task_get tool
- Add 'Dependency awareness' section to TRIAGE_SYSTEM_PROMPT instructing agent to call task_get on dependencies before writing specs
- Update task_get tool description to mention reading dependency task specs
- Add test verifying system prompt contains dependency awareness instructions
- Add test verifying task_get tool description mentions dependency specs
2026-03-28 16:30:23 -04:00
Dustin Byrne
5a851a714e feat(KB-138): add priority-based scheduling to AgentSemaphore
- Add priority levels (PRIORITY_MERGE=2, PRIORITY_EXECUTE=1, PRIORITY_SPECIFY=0) to AgentSemaphore
- Update acquire() and run() to accept a numeric priority parameter with FIFO ordering within same level
- Wire priority constants into executor (PRIORITY_EXECUTE) and triage (PRIORITY_SPECIFY) callers
- Add comprehensive tests for priority ordering, FIFO within same priority, and dynamic limit interaction
- Include changeset for the priority-based agent scheduling feature
2026-03-28 16:30:23 -04:00
Dustin Byrne
ffc5e14876 feat(KB-130): allow dependent tasks to start from in-review dep branches
- Relax scheduler dep gate to treat in-review tasks as satisfied
- Add resolveBaseBranch() to detect in-review deps with unmerged worktrees
- Executor creates worktrees from dep branch instead of HEAD when baseBranch is set
- Extend file-overlap tracking to include in-review tasks with worktrees
- Add baseBranch field to Task type and store update logic
- Add scheduler and executor tests for in-review dependency handling
2026-03-27 02:15:20 -04:00
Dustin Byrne
039671b5ad feat(KB-126): add RETHINK rewind for plan and code reviews with REVISE enforcement
- Differentiate RETHINK handling between plan reviews (session rewind only) and code reviews (git reset + session rewind)
- Update system prompt with detailed REVISE/RETHINK verdict descriptions for plan vs code review types
- Enforce code review REVISE verdict by blocking task_update(done) until re-review passes
- Capture pre-step session checkpoints in task_update for conversation rewind on RETHINK
- Add comprehensive tests for plan RETHINK, code RETHINK, and REVISE enforcement flows
2026-03-27 01:58:46 -04:00
Dustin Byrne
741964f271 feat(KB-125): implement RETHINK verdict with git reset and session rewind
- Capture pre-step session checkpoint in task_update when status changes to in-progress
- Handle RETHINK verdict with git reset --hard to baseline SHA to revert code changes
- Rewind agent conversation to pre-step checkpoint via navigateTree with branchWithSummary fallback
- Update system prompt to describe RETHINK as automatic revert + rewind behavior
- Replace code review REVISE enforcement tests with comprehensive RETHINK rewind tests
2026-03-27 01:49:43 -04:00
Dustin Byrne
488b9260d5 feat(KB-124): enforce code review REVISE verdict before step advancement
- Track per-step code review verdicts in executor via codeReviewVerdicts map
- Block task_update(status="done") when last code review returned REVISE
- Update system prompt with enforcement language distinguishing code vs plan reviews
- Add comprehensive tests for verdict tracking, blocking, clearing, and independence across steps
2026-03-27 01:25:06 -04:00
Dustin Byrne
948928d258 feat(KB-123): add agent role tracking and expanded logging to agent system
- Extend AgentLogEntry with agent field and new event types (thinking, tool_end)
- Expand AgentLogger with thinking, tool_end callbacks and agent role support
- Wire new logging callbacks in createKbAgent and all agent call-sites (executor, merger, reviewer, triage, pi)
- Update AgentLogViewer with agent role badges and rendering for new entry types
- Export AgentRole and AgentLogType from core package and add tests for new functionality
2026-03-27 01:19:42 -04:00
Dustin Byrne
cd22c2d19a fix: mark internal packages as private, only publish @dustinbyrne/kb 2026-03-27 00:28:03 -04:00
Dustin Byrne
dc821973fa feat(KB-119): add configurable thinking effort level
- Add defaultThinkingLevel to core Settings types and exports
- Thread thinking level through engine executor, merger, reviewer, triage, and pi
- Add effort dropdown to Model settings UI in SettingsModal
- Add tests for thinking effort dropdown in SettingsModal
2026-03-26 23:13:40 -04:00
Dustin Byrne
c802108a02 refactor(HAI-116): rename kb to hai across all packages, CLI, and docs
- Rename npm packages from @kb/* to @hai/* and update all workspace references
- Rename CLI binary from kb to hai and config directory from .kb to .hai
- Update dashboard UI branding, titles, and references from kb to hai
- Update all test files, CI workflows, and documentation to reflect new naming
- Run comprehensive grep verification to ensure no stale kb references remain
2026-03-26 22:44:11 -04:00
Dustin Byrne
1c5eb494db feat(HAI-113): add structured logger and replace console calls
- Create logger module with log levels and structured output (packages/engine/src/logger.ts)
- Replace console.log/warn/error calls with structured logger across engine modules
- Export logger from engine package index
- Add comprehensive tests for logger functionality
- Clean up CI/release workflows and update docs
2026-03-26 22:44:11 -04:00
Dustin Byrne
a7a9e985e2 feat(HAI-108): remove binary builds and configure npm publishing
- Remove binary build steps from CI and delete release/test-release workflows
- Replace release workflow with npm publish via version.yml and changesets
- Configure all packages (cli, core, dashboard, engine) for npm publishing
- Add package-config tests to verify publishConfig and package metadata
- Update README and documentation to reflect npm-based distribution
2026-03-26 22:44:11 -04:00
Dustin Byrne
1a61f09379 feat(HAI-102): thread model settings through reviewer and merger
- Add defaultProvider and defaultModelId to ReviewOptions interface
- Forward model settings from store to createHaiAgent in reviewer
- Forward model settings from store to createHaiAgent in merger
- Pass settings from executor to reviewStep call
- Add tests for model settings threading in both reviewer and merger
2026-03-26 22:44:11 -04:00
Dustin Byrne
a8b767d6fc feat(HAI-098): add model selection and configuration support
- Extend Settings type with model provider and model name fields
- Add backend API endpoint to list available models
- Add frontend API client for fetching models
- Add model settings section to SettingsModal with provider/model dropdowns
- Update engine executor to use the selected model from settings
2026-03-26 22:44:11 -04:00
Dustin Byrne
615f31c777 feat(HAI-096): add task pause/unpause functionality
- Add paused field to Task data model and store with pauseTask method
- Update triage, scheduler, and executor to respect paused flag and terminate paused tasks
- Add REST API endpoints and CLI commands for pause/unpause operations
- Add dashboard UI visual indicator and toggle for paused state
- Update README with pause/unpause CLI command documentation
2026-03-26 22:44:11 -04:00
Dustin Byrne
9bb25a15ea feat(HAI-099): remove truncation from summarizeToolArgs
- Remove 80-char truncation from bash command summaries in summarizeToolArgs
- Remove length guard from fallback string-valued arg path
- Update agent-logger tests to expect full strings without truncation
- Add test case for long string-valued fallback args
- Update executor tests to match new non-truncating behavior
2026-03-26 19:33:56 -04:00
Dustin Byrne
30593e5f6b feat(HAI-094): add includeTaskIdInCommit setting to control commit scope
- Add includeTaskIdInCommit boolean to Settings type with default true
- Refactor merger to dynamically build system prompt based on setting
- Update fallback commit message to respect the toggle
- Add checkbox to Settings UI under Merge section
- Add unit tests for merger and SettingsModal behavior
2026-03-26 19:29:45 -04:00
Dustin Byrne
121b509686 refactor(HAI-093): extract AgentLogger abstraction and rewire agents
- Add AgentLogger class encapsulating log file management and structured logging
- Add comprehensive unit tests for AgentLogger
- Rewire executor, triage, and merger to use AgentLogger instead of inline logging
- Reduce duplication across agent modules
- Export AgentLogger from engine package index
2026-03-26 19:29:17 -04:00
Dustin Byrne
a8a7fd711b feat(HAI-091): add agent log persistence to triage and merger agents
- Add agent log persistence to triage agent with log capture and storage
- Add agent log persistence to merger agent with log capture and storage
- Add unit tests for triage agent log persistence
- Add unit tests for merger agent log persistence
2026-03-26 01:17:07 -04:00
Dustin Byrne
fc57042522 fix(HAI-092): use generateWorktreeName for fresh worktree directories
- Replace task ID with generateWorktreeName for worktree directory paths
- Worktrees now use human-friendly adjective-noun names (e.g. swift-falcon)
- Add tests for fresh worktree naming, task ID exclusion, and resumed task reuse
2026-03-26 01:16:41 -04:00
Dustin Byrne
2baa119969 feat(HAI-082): display tool call details in AgentLogViewer
- Extend AgentLogEntry type with optional detail field for tool metadata
- Thread tool args through engine executor callbacks to populate detail
- Render tool detail (name, args) in AgentLogViewer component
- Add unit tests for store, executor, and AgentLogViewer changes
2026-03-26 00:59:11 -04:00
Dustin Byrne
93a79a5bfa fix(HAI-086): handle ENOENT gracefully in specifyTask
- Move updateTask call inside try block so ENOENT from deleted tasks is caught
- Add ENOENT check in catch to log and skip instead of treating as a failure
- Preserve existing error handling for non-ENOENT errors
- Add resilience tests covering ENOENT scenarios in specifyTask
2026-03-26 00:57:49 -04:00
Dustin Byrne
cab27b5096 fix(HAI-085): resolve TS2307/TS2339 build errors in engine package
- Add @types/node dev dependency to fix TS2307 module resolution errors
- Sort dependencies alphabetically in engine package.json
- Update pnpm-lock.yaml with new type definitions
2026-03-26 00:55:16 -04:00
Dustin Byrne
5dea073d22 feat(HAI-078): add configurable task prefix to settings
- Add taskPrefix field to Settings type and use it in allocateId
- Update store listTasks and handleFsChange to support any task prefix
- Update triage duplicate regex to match configurable prefix
- Add Task Prefix input to dashboard SettingsModal UI
- Add tests for prefix-aware task allocation and settings modal
2026-03-26 00:48:38 -04:00
Dustin Byrne
40099be89e feat(HAI-075): add project commands to buildExecutionPrompt
- Inject test and build commands from settings into the execution prompt
- Add Project Commands section with testCommand and buildCommand when configured
- Hoist getSettings call above the isResume check so commands are always available
- Add unit tests for project command propagation in buildExecutionPrompt
- Update integration test assertions for the hoisted getSettings call
2026-03-26 00:42:28 -04:00
Dustin Byrne
af69220031 fix: merger uses HEAD not hardcoded main for diff/log context 2026-03-26 00:37:48 -04:00