verbolab 0.1.0-alpha.1
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/LICENSE +21 -0
- package/README.md +71 -0
- package/dist/bin/verbo.d.ts +3 -0
- package/dist/bin/verbo.d.ts.map +1 -0
- package/dist/bin/verbo.js +1156 -0
- package/dist/bin/verbo.js.map +1 -0
- package/dist/relay/index.d.ts +2 -0
- package/dist/relay/index.d.ts.map +1 -0
- package/dist/relay/index.js +15 -0
- package/dist/relay/index.js.map +1 -0
- package/dist/src/agent/agent-launcher.d.ts +64 -0
- package/dist/src/agent/agent-launcher.d.ts.map +1 -0
- package/dist/src/agent/agent-launcher.js +326 -0
- package/dist/src/agent/agent-launcher.js.map +1 -0
- package/dist/src/agent/agent-monitor.d.ts +16 -0
- package/dist/src/agent/agent-monitor.d.ts.map +1 -0
- package/dist/src/agent/agent-monitor.js +41 -0
- package/dist/src/agent/agent-monitor.js.map +1 -0
- package/dist/src/agent/fun-names.d.ts +9 -0
- package/dist/src/agent/fun-names.d.ts.map +1 -0
- package/dist/src/agent/fun-names.js +118 -0
- package/dist/src/agent/fun-names.js.map +1 -0
- package/dist/src/agent/mcp-shim.d.ts +45 -0
- package/dist/src/agent/mcp-shim.d.ts.map +1 -0
- package/dist/src/agent/mcp-shim.js +192 -0
- package/dist/src/agent/mcp-shim.js.map +1 -0
- package/dist/src/agent/personas.d.ts +47 -0
- package/dist/src/agent/personas.d.ts.map +1 -0
- package/dist/src/agent/personas.js +86 -0
- package/dist/src/agent/personas.js.map +1 -0
- package/dist/src/agent/provider-detection.d.ts +21 -0
- package/dist/src/agent/provider-detection.d.ts.map +1 -0
- package/dist/src/agent/provider-detection.js +47 -0
- package/dist/src/agent/provider-detection.js.map +1 -0
- package/dist/src/agent/providers/claude-provider.d.ts +3 -0
- package/dist/src/agent/providers/claude-provider.d.ts.map +1 -0
- package/dist/src/agent/providers/claude-provider.js +119 -0
- package/dist/src/agent/providers/claude-provider.js.map +1 -0
- package/dist/src/agent/providers/gemini-provider.d.ts +13 -0
- package/dist/src/agent/providers/gemini-provider.d.ts.map +1 -0
- package/dist/src/agent/providers/gemini-provider.js +143 -0
- package/dist/src/agent/providers/gemini-provider.js.map +1 -0
- package/dist/src/agent/providers/openai-provider.d.ts +3 -0
- package/dist/src/agent/providers/openai-provider.d.ts.map +1 -0
- package/dist/src/agent/providers/openai-provider.js +127 -0
- package/dist/src/agent/providers/openai-provider.js.map +1 -0
- package/dist/src/agent/providers/registry.d.ts +19 -0
- package/dist/src/agent/providers/registry.d.ts.map +1 -0
- package/dist/src/agent/providers/registry.js +30 -0
- package/dist/src/agent/providers/registry.js.map +1 -0
- package/dist/src/agent/providers/types.d.ts +118 -0
- package/dist/src/agent/providers/types.d.ts.map +1 -0
- package/dist/src/agent/providers/types.js +2 -0
- package/dist/src/agent/providers/types.js.map +1 -0
- package/dist/src/approval/approval-server.d.ts +17 -0
- package/dist/src/approval/approval-server.d.ts.map +1 -0
- package/dist/src/approval/approval-server.js +90 -0
- package/dist/src/approval/approval-server.js.map +1 -0
- package/dist/src/approval/approval-store.d.ts +29 -0
- package/dist/src/approval/approval-store.d.ts.map +1 -0
- package/dist/src/approval/approval-store.js +94 -0
- package/dist/src/approval/approval-store.js.map +1 -0
- package/dist/src/auth/auth-store.d.ts +18 -0
- package/dist/src/auth/auth-store.d.ts.map +1 -0
- package/dist/src/auth/auth-store.js +34 -0
- package/dist/src/auth/auth-store.js.map +1 -0
- package/dist/src/auth/device-code-client.d.ts +32 -0
- package/dist/src/auth/device-code-client.d.ts.map +1 -0
- package/dist/src/auth/device-code-client.js +41 -0
- package/dist/src/auth/device-code-client.js.map +1 -0
- package/dist/src/auth/plan-enforcer.d.ts +8 -0
- package/dist/src/auth/plan-enforcer.d.ts.map +1 -0
- package/dist/src/auth/plan-enforcer.js +14 -0
- package/dist/src/auth/plan-enforcer.js.map +1 -0
- package/dist/src/commands/audit.d.ts +7 -0
- package/dist/src/commands/audit.d.ts.map +1 -0
- package/dist/src/commands/audit.js +92 -0
- package/dist/src/commands/audit.js.map +1 -0
- package/dist/src/commands/team.d.ts +48 -0
- package/dist/src/commands/team.d.ts.map +1 -0
- package/dist/src/commands/team.js +175 -0
- package/dist/src/commands/team.js.map +1 -0
- package/dist/src/config/verbo-config.d.ts +43 -0
- package/dist/src/config/verbo-config.d.ts.map +1 -0
- package/dist/src/config/verbo-config.js +111 -0
- package/dist/src/config/verbo-config.js.map +1 -0
- package/dist/src/core/agent-session-store.d.ts +69 -0
- package/dist/src/core/agent-session-store.d.ts.map +1 -0
- package/dist/src/core/agent-session-store.js +168 -0
- package/dist/src/core/agent-session-store.js.map +1 -0
- package/dist/src/core/audit-log-store.d.ts +33 -0
- package/dist/src/core/audit-log-store.d.ts.map +1 -0
- package/dist/src/core/audit-log-store.js +104 -0
- package/dist/src/core/audit-log-store.js.map +1 -0
- package/dist/src/core/compliance.d.ts +50 -0
- package/dist/src/core/compliance.d.ts.map +1 -0
- package/dist/src/core/compliance.js +59 -0
- package/dist/src/core/compliance.js.map +1 -0
- package/dist/src/core/conflict-detector.d.ts +19 -0
- package/dist/src/core/conflict-detector.d.ts.map +1 -0
- package/dist/src/core/conflict-detector.js +87 -0
- package/dist/src/core/conflict-detector.js.map +1 -0
- package/dist/src/core/conflict-enforcer.d.ts +37 -0
- package/dist/src/core/conflict-enforcer.d.ts.map +1 -0
- package/dist/src/core/conflict-enforcer.js +139 -0
- package/dist/src/core/conflict-enforcer.js.map +1 -0
- package/dist/src/core/cost-store.d.ts +55 -0
- package/dist/src/core/cost-store.d.ts.map +1 -0
- package/dist/src/core/cost-store.js +140 -0
- package/dist/src/core/cost-store.js.map +1 -0
- package/dist/src/core/hot-files.d.ts +19 -0
- package/dist/src/core/hot-files.d.ts.map +1 -0
- package/dist/src/core/hot-files.js +64 -0
- package/dist/src/core/hot-files.js.map +1 -0
- package/dist/src/core/human-action-store.d.ts +33 -0
- package/dist/src/core/human-action-store.d.ts.map +1 -0
- package/dist/src/core/human-action-store.js +92 -0
- package/dist/src/core/human-action-store.js.map +1 -0
- package/dist/src/core/learning-store.d.ts +32 -0
- package/dist/src/core/learning-store.d.ts.map +1 -0
- package/dist/src/core/learning-store.js +95 -0
- package/dist/src/core/learning-store.js.map +1 -0
- package/dist/src/core/merge-queue.d.ts +28 -0
- package/dist/src/core/merge-queue.d.ts.map +1 -0
- package/dist/src/core/merge-queue.js +92 -0
- package/dist/src/core/merge-queue.js.map +1 -0
- package/dist/src/core/notification-service.d.ts +13 -0
- package/dist/src/core/notification-service.d.ts.map +1 -0
- package/dist/src/core/notification-service.js +126 -0
- package/dist/src/core/notification-service.js.map +1 -0
- package/dist/src/core/notifications.d.ts +10 -0
- package/dist/src/core/notifications.d.ts.map +1 -0
- package/dist/src/core/notifications.js +33 -0
- package/dist/src/core/notifications.js.map +1 -0
- package/dist/src/core/orchestrator-store.d.ts +44 -0
- package/dist/src/core/orchestrator-store.d.ts.map +1 -0
- package/dist/src/core/orchestrator-store.js +69 -0
- package/dist/src/core/orchestrator-store.js.map +1 -0
- package/dist/src/core/parallelizer.d.ts +47 -0
- package/dist/src/core/parallelizer.d.ts.map +1 -0
- package/dist/src/core/parallelizer.js +224 -0
- package/dist/src/core/parallelizer.js.map +1 -0
- package/dist/src/core/pipeline-rollback.d.ts +29 -0
- package/dist/src/core/pipeline-rollback.d.ts.map +1 -0
- package/dist/src/core/pipeline-rollback.js +84 -0
- package/dist/src/core/pipeline-rollback.js.map +1 -0
- package/dist/src/core/pipeline-runner.d.ts +73 -0
- package/dist/src/core/pipeline-runner.d.ts.map +1 -0
- package/dist/src/core/pipeline-runner.js +165 -0
- package/dist/src/core/pipeline-runner.js.map +1 -0
- package/dist/src/core/pr-creator.d.ts +22 -0
- package/dist/src/core/pr-creator.d.ts.map +1 -0
- package/dist/src/core/pr-creator.js +55 -0
- package/dist/src/core/pr-creator.js.map +1 -0
- package/dist/src/core/rbac.d.ts +27 -0
- package/dist/src/core/rbac.d.ts.map +1 -0
- package/dist/src/core/rbac.js +76 -0
- package/dist/src/core/rbac.js.map +1 -0
- package/dist/src/core/startup-cleanup.d.ts +47 -0
- package/dist/src/core/startup-cleanup.d.ts.map +1 -0
- package/dist/src/core/startup-cleanup.js +150 -0
- package/dist/src/core/startup-cleanup.js.map +1 -0
- package/dist/src/core/task-store.d.ts +96 -0
- package/dist/src/core/task-store.d.ts.map +1 -0
- package/dist/src/core/task-store.js +309 -0
- package/dist/src/core/task-store.js.map +1 -0
- package/dist/src/core/verbo-config-editor.d.ts +44 -0
- package/dist/src/core/verbo-config-editor.d.ts.map +1 -0
- package/dist/src/core/verbo-config-editor.js +204 -0
- package/dist/src/core/verbo-config-editor.js.map +1 -0
- package/dist/src/core/verbo-config.d.ts +35 -0
- package/dist/src/core/verbo-config.d.ts.map +1 -0
- package/dist/src/core/verbo-config.js +55 -0
- package/dist/src/core/verbo-config.js.map +1 -0
- package/dist/src/core/verbo-md.d.ts +96 -0
- package/dist/src/core/verbo-md.d.ts.map +1 -0
- package/dist/src/core/verbo-md.js +410 -0
- package/dist/src/core/verbo-md.js.map +1 -0
- package/dist/src/db/database.d.ts +9 -0
- package/dist/src/db/database.d.ts.map +1 -0
- package/dist/src/db/database.js +37 -0
- package/dist/src/db/database.js.map +1 -0
- package/dist/src/db/migrations/001-personas-subtasks.d.ts +10 -0
- package/dist/src/db/migrations/001-personas-subtasks.d.ts.map +1 -0
- package/dist/src/db/migrations/001-personas-subtasks.js +32 -0
- package/dist/src/db/migrations/001-personas-subtasks.js.map +1 -0
- package/dist/src/db/migrations/002-rbac.d.ts +9 -0
- package/dist/src/db/migrations/002-rbac.d.ts.map +1 -0
- package/dist/src/db/migrations/002-rbac.js +31 -0
- package/dist/src/db/migrations/002-rbac.js.map +1 -0
- package/dist/src/db/migrations/003-provider-column.d.ts +8 -0
- package/dist/src/db/migrations/003-provider-column.d.ts.map +1 -0
- package/dist/src/db/migrations/003-provider-column.js +12 -0
- package/dist/src/db/migrations/003-provider-column.js.map +1 -0
- package/dist/src/db/migrations/004-pipeline-cost.d.ts +8 -0
- package/dist/src/db/migrations/004-pipeline-cost.d.ts.map +1 -0
- package/dist/src/db/migrations/004-pipeline-cost.js +23 -0
- package/dist/src/db/migrations/004-pipeline-cost.js.map +1 -0
- package/dist/src/db/migrations/005-audit-log-timestamp.d.ts +10 -0
- package/dist/src/db/migrations/005-audit-log-timestamp.d.ts.map +1 -0
- package/dist/src/db/migrations/005-audit-log-timestamp.js +39 -0
- package/dist/src/db/migrations/005-audit-log-timestamp.js.map +1 -0
- package/dist/src/db/migrations/006-human-action-type.d.ts +9 -0
- package/dist/src/db/migrations/006-human-action-type.d.ts.map +1 -0
- package/dist/src/db/migrations/006-human-action-type.js +16 -0
- package/dist/src/db/migrations/006-human-action-type.js.map +1 -0
- package/dist/src/db/schema.d.ts +6 -0
- package/dist/src/db/schema.d.ts.map +1 -0
- package/dist/src/db/schema.js +255 -0
- package/dist/src/db/schema.js.map +1 -0
- package/dist/src/deps/dependabot-generator.d.ts +22 -0
- package/dist/src/deps/dependabot-generator.d.ts.map +1 -0
- package/dist/src/deps/dependabot-generator.js +83 -0
- package/dist/src/deps/dependabot-generator.js.map +1 -0
- package/dist/src/deps/dependabot-monitor.d.ts +22 -0
- package/dist/src/deps/dependabot-monitor.d.ts.map +1 -0
- package/dist/src/deps/dependabot-monitor.js +28 -0
- package/dist/src/deps/dependabot-monitor.js.map +1 -0
- package/dist/src/deps/package-auditor.d.ts +24 -0
- package/dist/src/deps/package-auditor.d.ts.map +1 -0
- package/dist/src/deps/package-auditor.js +118 -0
- package/dist/src/deps/package-auditor.js.map +1 -0
- package/dist/src/init/ensure-init.d.ts +6 -0
- package/dist/src/init/ensure-init.d.ts.map +1 -0
- package/dist/src/init/ensure-init.js +27 -0
- package/dist/src/init/ensure-init.js.map +1 -0
- package/dist/src/init/project-detector.d.ts +11 -0
- package/dist/src/init/project-detector.d.ts.map +1 -0
- package/dist/src/init/project-detector.js +117 -0
- package/dist/src/init/project-detector.js.map +1 -0
- package/dist/src/init/questionnaire.d.ts +5 -0
- package/dist/src/init/questionnaire.d.ts.map +1 -0
- package/dist/src/init/questionnaire.js +112 -0
- package/dist/src/init/questionnaire.js.map +1 -0
- package/dist/src/init/template.d.ts +17 -0
- package/dist/src/init/template.d.ts.map +1 -0
- package/dist/src/init/template.js +46 -0
- package/dist/src/init/template.js.map +1 -0
- package/dist/src/intelligence/claude-client.d.ts +3 -0
- package/dist/src/intelligence/claude-client.d.ts.map +1 -0
- package/dist/src/intelligence/claude-client.js +12 -0
- package/dist/src/intelligence/claude-client.js.map +1 -0
- package/dist/src/intelligence/conflict-mediator.d.ts +17 -0
- package/dist/src/intelligence/conflict-mediator.d.ts.map +1 -0
- package/dist/src/intelligence/conflict-mediator.js +83 -0
- package/dist/src/intelligence/conflict-mediator.js.map +1 -0
- package/dist/src/intelligence/github-orchestrator.d.ts +30 -0
- package/dist/src/intelligence/github-orchestrator.d.ts.map +1 -0
- package/dist/src/intelligence/github-orchestrator.js +270 -0
- package/dist/src/intelligence/github-orchestrator.js.map +1 -0
- package/dist/src/intelligence/kill-switch.d.ts +10 -0
- package/dist/src/intelligence/kill-switch.d.ts.map +1 -0
- package/dist/src/intelligence/kill-switch.js +12 -0
- package/dist/src/intelligence/kill-switch.js.map +1 -0
- package/dist/src/intelligence/learnings-extractor.d.ts +13 -0
- package/dist/src/intelligence/learnings-extractor.d.ts.map +1 -0
- package/dist/src/intelligence/learnings-extractor.js +74 -0
- package/dist/src/intelligence/learnings-extractor.js.map +1 -0
- package/dist/src/intelligence/project-scanner.d.ts +2 -0
- package/dist/src/intelligence/project-scanner.d.ts.map +1 -0
- package/dist/src/intelligence/project-scanner.js +28 -0
- package/dist/src/intelligence/project-scanner.js.map +1 -0
- package/dist/src/intelligence/task-decomposer.d.ts +14 -0
- package/dist/src/intelligence/task-decomposer.d.ts.map +1 -0
- package/dist/src/intelligence/task-decomposer.js +97 -0
- package/dist/src/intelligence/task-decomposer.js.map +1 -0
- package/dist/src/intelligence/types.d.ts +14 -0
- package/dist/src/intelligence/types.d.ts.map +1 -0
- package/dist/src/intelligence/types.js +2 -0
- package/dist/src/intelligence/types.js.map +1 -0
- package/dist/src/mcp/server.d.ts +63 -0
- package/dist/src/mcp/server.d.ts.map +1 -0
- package/dist/src/mcp/server.js +537 -0
- package/dist/src/mcp/server.js.map +1 -0
- package/dist/src/mcp/stdio-entry.d.ts +2 -0
- package/dist/src/mcp/stdio-entry.d.ts.map +1 -0
- package/dist/src/mcp/stdio-entry.js +124 -0
- package/dist/src/mcp/stdio-entry.js.map +1 -0
- package/dist/src/mcp/subtask-handlers.d.ts +7 -0
- package/dist/src/mcp/subtask-handlers.d.ts.map +1 -0
- package/dist/src/mcp/subtask-handlers.js +50 -0
- package/dist/src/mcp/subtask-handlers.js.map +1 -0
- package/dist/src/security/network-proxy.d.ts +20 -0
- package/dist/src/security/network-proxy.d.ts.map +1 -0
- package/dist/src/security/network-proxy.js +125 -0
- package/dist/src/security/network-proxy.js.map +1 -0
- package/dist/src/security/network-sandbox.d.ts +19 -0
- package/dist/src/security/network-sandbox.d.ts.map +1 -0
- package/dist/src/security/network-sandbox.js +100 -0
- package/dist/src/security/network-sandbox.js.map +1 -0
- package/dist/src/security/sanitize.d.ts +13 -0
- package/dist/src/security/sanitize.d.ts.map +1 -0
- package/dist/src/security/sanitize.js +19 -0
- package/dist/src/security/sanitize.js.map +1 -0
- package/dist/src/security/secrets-patterns.d.ts +29 -0
- package/dist/src/security/secrets-patterns.d.ts.map +1 -0
- package/dist/src/security/secrets-patterns.js +430 -0
- package/dist/src/security/secrets-patterns.js.map +1 -0
- package/dist/src/security/secrets-scanner.d.ts +26 -0
- package/dist/src/security/secrets-scanner.d.ts.map +1 -0
- package/dist/src/security/secrets-scanner.js +62 -0
- package/dist/src/security/secrets-scanner.js.map +1 -0
- package/dist/src/skills/classifier.d.ts +9 -0
- package/dist/src/skills/classifier.d.ts.map +1 -0
- package/dist/src/skills/classifier.js +41 -0
- package/dist/src/skills/classifier.js.map +1 -0
- package/dist/src/skills/registry.d.ts +16 -0
- package/dist/src/skills/registry.d.ts.map +1 -0
- package/dist/src/skills/registry.js +61 -0
- package/dist/src/skills/registry.js.map +1 -0
- package/dist/src/sync/events.d.ts +9 -0
- package/dist/src/sync/events.d.ts.map +1 -0
- package/dist/src/sync/events.js +2 -0
- package/dist/src/sync/events.js.map +1 -0
- package/dist/src/sync/relay-server.d.ts +18 -0
- package/dist/src/sync/relay-server.d.ts.map +1 -0
- package/dist/src/sync/relay-server.js +131 -0
- package/dist/src/sync/relay-server.js.map +1 -0
- package/dist/src/sync/sync-client.d.ts +31 -0
- package/dist/src/sync/sync-client.d.ts.map +1 -0
- package/dist/src/sync/sync-client.js +314 -0
- package/dist/src/sync/sync-client.js.map +1 -0
- package/dist/src/tui/app.d.ts +35 -0
- package/dist/src/tui/app.d.ts.map +1 -0
- package/dist/src/tui/app.js +676 -0
- package/dist/src/tui/app.js.map +1 -0
- package/dist/src/tui/components/activity-feed.d.ts +12 -0
- package/dist/src/tui/components/activity-feed.d.ts.map +1 -0
- package/dist/src/tui/components/activity-feed.js +82 -0
- package/dist/src/tui/components/activity-feed.js.map +1 -0
- package/dist/src/tui/components/agent-list.d.ts +19 -0
- package/dist/src/tui/components/agent-list.d.ts.map +1 -0
- package/dist/src/tui/components/agent-list.js +33 -0
- package/dist/src/tui/components/agent-list.js.map +1 -0
- package/dist/src/tui/components/agent-row.d.ts +12 -0
- package/dist/src/tui/components/agent-row.d.ts.map +1 -0
- package/dist/src/tui/components/agent-row.js +37 -0
- package/dist/src/tui/components/agent-row.js.map +1 -0
- package/dist/src/tui/components/approval-terminal.d.ts +13 -0
- package/dist/src/tui/components/approval-terminal.d.ts.map +1 -0
- package/dist/src/tui/components/approval-terminal.js +34 -0
- package/dist/src/tui/components/approval-terminal.js.map +1 -0
- package/dist/src/tui/components/audit-viewer.d.ts +16 -0
- package/dist/src/tui/components/audit-viewer.d.ts.map +1 -0
- package/dist/src/tui/components/audit-viewer.js +46 -0
- package/dist/src/tui/components/audit-viewer.js.map +1 -0
- package/dist/src/tui/components/auth-gate.d.ts +9 -0
- package/dist/src/tui/components/auth-gate.d.ts.map +1 -0
- package/dist/src/tui/components/auth-gate.js +112 -0
- package/dist/src/tui/components/auth-gate.js.map +1 -0
- package/dist/src/tui/components/command-palette.d.ts +12 -0
- package/dist/src/tui/components/command-palette.d.ts.map +1 -0
- package/dist/src/tui/components/command-palette.js +51 -0
- package/dist/src/tui/components/command-palette.js.map +1 -0
- package/dist/src/tui/components/compliance-badge.d.ts +11 -0
- package/dist/src/tui/components/compliance-badge.d.ts.map +1 -0
- package/dist/src/tui/components/compliance-badge.js +12 -0
- package/dist/src/tui/components/compliance-badge.js.map +1 -0
- package/dist/src/tui/components/decomposition-review.d.ts +10 -0
- package/dist/src/tui/components/decomposition-review.d.ts.map +1 -0
- package/dist/src/tui/components/decomposition-review.js +19 -0
- package/dist/src/tui/components/decomposition-review.js.map +1 -0
- package/dist/src/tui/components/dependency-graph.d.ts +13 -0
- package/dist/src/tui/components/dependency-graph.d.ts.map +1 -0
- package/dist/src/tui/components/dependency-graph.js +143 -0
- package/dist/src/tui/components/dependency-graph.js.map +1 -0
- package/dist/src/tui/components/diff-viewer.d.ts +11 -0
- package/dist/src/tui/components/diff-viewer.d.ts.map +1 -0
- package/dist/src/tui/components/diff-viewer.js +82 -0
- package/dist/src/tui/components/diff-viewer.js.map +1 -0
- package/dist/src/tui/components/edit-task-input.d.ts +10 -0
- package/dist/src/tui/components/edit-task-input.d.ts.map +1 -0
- package/dist/src/tui/components/edit-task-input.js +20 -0
- package/dist/src/tui/components/edit-task-input.js.map +1 -0
- package/dist/src/tui/components/footer.d.ts +12 -0
- package/dist/src/tui/components/footer.d.ts.map +1 -0
- package/dist/src/tui/components/footer.js +41 -0
- package/dist/src/tui/components/footer.js.map +1 -0
- package/dist/src/tui/components/header.d.ts +8 -0
- package/dist/src/tui/components/header.d.ts.map +1 -0
- package/dist/src/tui/components/header.js +20 -0
- package/dist/src/tui/components/header.js.map +1 -0
- package/dist/src/tui/components/human-actions.d.ts +14 -0
- package/dist/src/tui/components/human-actions.d.ts.map +1 -0
- package/dist/src/tui/components/human-actions.js +43 -0
- package/dist/src/tui/components/human-actions.js.map +1 -0
- package/dist/src/tui/components/log-panel.d.ts +10 -0
- package/dist/src/tui/components/log-panel.d.ts.map +1 -0
- package/dist/src/tui/components/log-panel.js +38 -0
- package/dist/src/tui/components/log-panel.js.map +1 -0
- package/dist/src/tui/components/memory-viewer.d.ts +10 -0
- package/dist/src/tui/components/memory-viewer.d.ts.map +1 -0
- package/dist/src/tui/components/memory-viewer.js +44 -0
- package/dist/src/tui/components/memory-viewer.js.map +1 -0
- package/dist/src/tui/components/new-task-input.d.ts +9 -0
- package/dist/src/tui/components/new-task-input.d.ts.map +1 -0
- package/dist/src/tui/components/new-task-input.js +21 -0
- package/dist/src/tui/components/new-task-input.js.map +1 -0
- package/dist/src/tui/components/orchestrator-status.d.ts +9 -0
- package/dist/src/tui/components/orchestrator-status.d.ts.map +1 -0
- package/dist/src/tui/components/orchestrator-status.js +15 -0
- package/dist/src/tui/components/orchestrator-status.js.map +1 -0
- package/dist/src/tui/components/parallelize-banner.d.ts +8 -0
- package/dist/src/tui/components/parallelize-banner.d.ts.map +1 -0
- package/dist/src/tui/components/parallelize-banner.js +9 -0
- package/dist/src/tui/components/parallelize-banner.js.map +1 -0
- package/dist/src/tui/components/progress-bar.d.ts +9 -0
- package/dist/src/tui/components/progress-bar.d.ts.map +1 -0
- package/dist/src/tui/components/progress-bar.js +15 -0
- package/dist/src/tui/components/progress-bar.js.map +1 -0
- package/dist/src/tui/components/review-queue.d.ts +13 -0
- package/dist/src/tui/components/review-queue.d.ts.map +1 -0
- package/dist/src/tui/components/review-queue.js +78 -0
- package/dist/src/tui/components/review-queue.js.map +1 -0
- package/dist/src/tui/components/rich-header.d.ts +11 -0
- package/dist/src/tui/components/rich-header.d.ts.map +1 -0
- package/dist/src/tui/components/rich-header.js +25 -0
- package/dist/src/tui/components/rich-header.js.map +1 -0
- package/dist/src/tui/components/spinner.d.ts +7 -0
- package/dist/src/tui/components/spinner.d.ts.map +1 -0
- package/dist/src/tui/components/spinner.js +8 -0
- package/dist/src/tui/components/spinner.js.map +1 -0
- package/dist/src/tui/components/status-bar.d.ts +23 -0
- package/dist/src/tui/components/status-bar.d.ts.map +1 -0
- package/dist/src/tui/components/status-bar.js +28 -0
- package/dist/src/tui/components/status-bar.js.map +1 -0
- package/dist/src/tui/components/task-queue.d.ts +11 -0
- package/dist/src/tui/components/task-queue.d.ts.map +1 -0
- package/dist/src/tui/components/task-queue.js +30 -0
- package/dist/src/tui/components/task-queue.js.map +1 -0
- package/dist/src/tui/components/team-view.d.ts +13 -0
- package/dist/src/tui/components/team-view.d.ts.map +1 -0
- package/dist/src/tui/components/team-view.js +12 -0
- package/dist/src/tui/components/team-view.js.map +1 -0
- package/dist/src/tui/graph-renderer.d.ts +11 -0
- package/dist/src/tui/graph-renderer.d.ts.map +1 -0
- package/dist/src/tui/graph-renderer.js +296 -0
- package/dist/src/tui/graph-renderer.js.map +1 -0
- package/dist/src/tui/hooks/use-bell.d.ts +21 -0
- package/dist/src/tui/hooks/use-bell.d.ts.map +1 -0
- package/dist/src/tui/hooks/use-bell.js +38 -0
- package/dist/src/tui/hooks/use-bell.js.map +1 -0
- package/dist/src/tui/hooks/use-ci-status.d.ts +16 -0
- package/dist/src/tui/hooks/use-ci-status.d.ts.map +1 -0
- package/dist/src/tui/hooks/use-ci-status.js +97 -0
- package/dist/src/tui/hooks/use-ci-status.js.map +1 -0
- package/dist/src/tui/hooks/use-command-palette.d.ts +37 -0
- package/dist/src/tui/hooks/use-command-palette.d.ts.map +1 -0
- package/dist/src/tui/hooks/use-command-palette.js +108 -0
- package/dist/src/tui/hooks/use-command-palette.js.map +1 -0
- package/dist/src/tui/hooks/use-diff-view.d.ts +16 -0
- package/dist/src/tui/hooks/use-diff-view.d.ts.map +1 -0
- package/dist/src/tui/hooks/use-diff-view.js +75 -0
- package/dist/src/tui/hooks/use-diff-view.js.map +1 -0
- package/dist/src/tui/hooks/use-keyboard.d.ts +3 -0
- package/dist/src/tui/hooks/use-keyboard.d.ts.map +1 -0
- package/dist/src/tui/hooks/use-keyboard.js +70 -0
- package/dist/src/tui/hooks/use-keyboard.js.map +1 -0
- package/dist/src/tui/hooks/use-log-stream.d.ts +25 -0
- package/dist/src/tui/hooks/use-log-stream.d.ts.map +1 -0
- package/dist/src/tui/hooks/use-log-stream.js +83 -0
- package/dist/src/tui/hooks/use-log-stream.js.map +1 -0
- package/dist/src/tui/hooks/use-spinner.d.ts +3 -0
- package/dist/src/tui/hooks/use-spinner.d.ts.map +1 -0
- package/dist/src/tui/hooks/use-spinner.js +13 -0
- package/dist/src/tui/hooks/use-spinner.js.map +1 -0
- package/dist/src/tui/hooks/use-store.d.ts +33 -0
- package/dist/src/tui/hooks/use-store.d.ts.map +1 -0
- package/dist/src/tui/hooks/use-store.js +21 -0
- package/dist/src/tui/hooks/use-store.js.map +1 -0
- package/dist/src/tui/lib/diff-parser.d.ts +24 -0
- package/dist/src/tui/lib/diff-parser.d.ts.map +1 -0
- package/dist/src/tui/lib/diff-parser.js +115 -0
- package/dist/src/tui/lib/diff-parser.js.map +1 -0
- package/dist/src/tui/lib/palette-commands.d.ts +14 -0
- package/dist/src/tui/lib/palette-commands.d.ts.map +1 -0
- package/dist/src/tui/lib/palette-commands.js +101 -0
- package/dist/src/tui/lib/palette-commands.js.map +1 -0
- package/dist/src/tui/tui.d.ts +8 -0
- package/dist/src/tui/tui.d.ts.map +1 -0
- package/dist/src/tui/tui.js +8 -0
- package/dist/src/tui/tui.js.map +1 -0
- package/package.json +66 -0
- package/skills/api-design.md +84 -0
- package/skills/backend-typescript.md +76 -0
- package/skills/data-modeling.md +73 -0
- package/skills/devops-ci.md +82 -0
- package/skills/frontend-design.md +69 -0
- package/skills/observability.md +73 -0
- package/skills/react-nextjs.md +76 -0
- package/skills/refactoring.md +77 -0
- package/skills/security.md +75 -0
- package/skills/testing.md +69 -0
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
import fs from 'fs';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
function defaultIsPidAlive(pid) {
|
|
4
|
+
try {
|
|
5
|
+
process.kill(pid, 0);
|
|
6
|
+
return true;
|
|
7
|
+
}
|
|
8
|
+
catch {
|
|
9
|
+
return false;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Clean up stale state left over from a previous Verbo run.
|
|
14
|
+
* Called once at startup before the TUI or any command that launches agents.
|
|
15
|
+
*
|
|
16
|
+
* 1. Deny all pending approval requests (agents that asked are gone).
|
|
17
|
+
* 2. Mark orphaned sessions (starting/active/stalled with no live PID) as errored.
|
|
18
|
+
* 3. Reset in_progress tasks whose session has no live PID back to todo.
|
|
19
|
+
*/
|
|
20
|
+
export async function cleanStaleState(deps) {
|
|
21
|
+
const { tasks, sessions, approvals, launcher, projectDir, isPidAlive = defaultIsPidAlive, pipelineRunner, pipelineRunIds, } = deps;
|
|
22
|
+
// Cancel any stale pipeline runs from a previous session
|
|
23
|
+
if (pipelineRunner && pipelineRunIds) {
|
|
24
|
+
for (const runId of pipelineRunIds) {
|
|
25
|
+
try {
|
|
26
|
+
pipelineRunner.cancel(runId);
|
|
27
|
+
}
|
|
28
|
+
catch {
|
|
29
|
+
// Non-fatal: run may already be in a terminal state
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
pipelineRunIds.clear();
|
|
33
|
+
}
|
|
34
|
+
// 1. Clear pending approvals
|
|
35
|
+
const pending = approvals.listPending();
|
|
36
|
+
for (const req of pending) {
|
|
37
|
+
approvals.deny(req.id);
|
|
38
|
+
}
|
|
39
|
+
// 2. Mark orphaned sessions as errored
|
|
40
|
+
const activeSessions = sessions.listActive(); // starting | active | stalled
|
|
41
|
+
let sessionsErrored = 0;
|
|
42
|
+
for (const session of activeSessions) {
|
|
43
|
+
const alive = session.pid !== null && isPidAlive(session.pid);
|
|
44
|
+
if (!alive) {
|
|
45
|
+
sessions.error(session.id);
|
|
46
|
+
sessionsErrored++;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
// 3. Reset in_progress tasks with no live session back to todo
|
|
50
|
+
const inProgressTasks = tasks.list({ status: 'in_progress' });
|
|
51
|
+
let tasksReset = 0;
|
|
52
|
+
for (const task of inProgressTasks) {
|
|
53
|
+
// Check if the task's session is still alive
|
|
54
|
+
let sessionAlive = false;
|
|
55
|
+
if (task.agentSessionId) {
|
|
56
|
+
const session = sessions.get(task.agentSessionId);
|
|
57
|
+
if (session && session.pid !== null && isPidAlive(session.pid)) {
|
|
58
|
+
sessionAlive = true;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
if (!sessionAlive) {
|
|
62
|
+
tasks.unclaim(task.id);
|
|
63
|
+
tasksReset++;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
// 4. Clean up orphaned worktrees from disk
|
|
67
|
+
let worktreesCleaned = 0;
|
|
68
|
+
if (projectDir) {
|
|
69
|
+
const agentsDir = path.join(projectDir, '.verbo', 'agents');
|
|
70
|
+
if (fs.existsSync(agentsDir)) {
|
|
71
|
+
const entries = fs.readdirSync(agentsDir);
|
|
72
|
+
for (const entry of entries) {
|
|
73
|
+
const fullPath = path.join(agentsDir, entry);
|
|
74
|
+
if (!fs.statSync(fullPath).isDirectory())
|
|
75
|
+
continue;
|
|
76
|
+
// Check if any active session still uses this worktree
|
|
77
|
+
const isActive = activeSessions.some((s) => s.pid !== null && isPidAlive(s.pid));
|
|
78
|
+
if (!isActive) {
|
|
79
|
+
// Remove git worktree registration first, then delete folder
|
|
80
|
+
if (launcher) {
|
|
81
|
+
await launcher.cleanupWorktree(entry);
|
|
82
|
+
}
|
|
83
|
+
// If folder still exists (cleanupWorktree may have failed), force remove
|
|
84
|
+
if (fs.existsSync(fullPath)) {
|
|
85
|
+
fs.rmSync(fullPath, { recursive: true, force: true });
|
|
86
|
+
}
|
|
87
|
+
worktreesCleaned++;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
// 5. Remove stale Verbo approval hooks from project root .claude/settings.json.
|
|
93
|
+
// These can be left behind if an agent ran in the root instead of a worktree,
|
|
94
|
+
// or from a previous development session. If left, they'll route *every*
|
|
95
|
+
// Claude Code session in this project through Verbo's approval server.
|
|
96
|
+
let staleHooksCleaned = false;
|
|
97
|
+
if (projectDir) {
|
|
98
|
+
const rootSettings = path.join(projectDir, '.claude', 'settings.json');
|
|
99
|
+
if (fs.existsSync(rootSettings)) {
|
|
100
|
+
try {
|
|
101
|
+
const content = JSON.parse(fs.readFileSync(rootSettings, 'utf-8'));
|
|
102
|
+
const hooks = content?.hooks?.PreToolUse;
|
|
103
|
+
if (Array.isArray(hooks)) {
|
|
104
|
+
const filtered = hooks.filter((h) => {
|
|
105
|
+
const inner = h.hooks;
|
|
106
|
+
if (!Array.isArray(inner))
|
|
107
|
+
return true;
|
|
108
|
+
// Drop entries whose URL points to Verbo's approval server
|
|
109
|
+
return !inner.some((ih) => typeof ih.url === 'string' && ih.url.includes('/hooks') && ih.url.includes('127.0.0.1'));
|
|
110
|
+
});
|
|
111
|
+
if (filtered.length !== hooks.length) {
|
|
112
|
+
if (filtered.length === 0) {
|
|
113
|
+
delete content.hooks.PreToolUse;
|
|
114
|
+
if (Object.keys(content.hooks).length === 0)
|
|
115
|
+
delete content.hooks;
|
|
116
|
+
}
|
|
117
|
+
else {
|
|
118
|
+
content.hooks.PreToolUse = filtered;
|
|
119
|
+
}
|
|
120
|
+
fs.writeFileSync(rootSettings, JSON.stringify(content, null, 2) + '\n');
|
|
121
|
+
staleHooksCleaned = true;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
catch {
|
|
126
|
+
// Malformed JSON or permission error — skip silently
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
return {
|
|
131
|
+
pendingApprovalsDenied: pending.length,
|
|
132
|
+
sessionsErrored,
|
|
133
|
+
tasksReset,
|
|
134
|
+
worktreesCleaned,
|
|
135
|
+
staleHooksCleaned,
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Delete audit_log rows older than `retainDays` (default 90).
|
|
140
|
+
* Called at startup to keep the audit table from growing unbounded.
|
|
141
|
+
* Returns the number of rows pruned.
|
|
142
|
+
*/
|
|
143
|
+
export function pruneAuditLog(db, retainDays = 90) {
|
|
144
|
+
const cutoff = new Date();
|
|
145
|
+
cutoff.setDate(cutoff.getDate() - retainDays);
|
|
146
|
+
const cutoffIso = cutoff.toISOString();
|
|
147
|
+
const result = db.prepare('DELETE FROM audit_log WHERE timestamp < ?').run(cutoffIso);
|
|
148
|
+
return result.changes;
|
|
149
|
+
}
|
|
150
|
+
//# sourceMappingURL=startup-cleanup.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"startup-cleanup.js","sourceRoot":"","sources":["../../../src/core/startup-cleanup.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,IAAI,MAAM,MAAM,CAAC;AA6BxB,SAAS,iBAAiB,CAAC,GAAW;IACpC,IAAI,CAAC;QACH,OAAO,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;QACrB,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,CAAC,KAAK,UAAU,eAAe,CAAC,IAAiB;IACrD,MAAM,EACJ,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE,UAAU,EAChD,UAAU,GAAG,iBAAiB,EAC9B,cAAc,EAAE,cAAc,GAC/B,GAAG,IAAI,CAAC;IAET,yDAAyD;IACzD,IAAI,cAAc,IAAI,cAAc,EA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{
|
|
3
|
+
id: string;
|
|
4
|
+
title: string;
|
|
5
|
+
description?: string;
|
|
6
|
+
status: 'todo' | 'in_progress' | 'done' | 'blocked';
|
|
7
|
+
priority: 'p0' | 'p1' | 'p2' | 'p3';
|
|
8
|
+
assignee?: string;
|
|
9
|
+
agentId?: string;
|
|
10
|
+
agentSessionId?: string;
|
|
11
|
+
filePaths: string[];
|
|
12
|
+
dependencies: string[];
|
|
13
|
+
progress: number;
|
|
14
|
+
progressLog: {
|
|
15
|
+
timestamp: string;
|
|
16
|
+
message: string;
|
|
17
|
+
}[];
|
|
18
|
+
attachments: {
|
|
19
|
+
type: string;
|
|
20
|
+
url: string;
|
|
21
|
+
label: string;
|
|
22
|
+
}[];
|
|
23
|
+
labels: string[];
|
|
24
|
+
prUrl?: string;
|
|
25
|
+
ciStatus?: 'pending' | 'success' | 'failure' | 'error';
|
|
26
|
+
createdBy?: string;
|
|
27
|
+
createdAt: string;
|
|
28
|
+
updatedAt: string;
|
|
29
|
+
parentTaskId?: string;
|
|
30
|
+
depth: number;
|
|
31
|
+
}
|
|
32
|
+
export interface CreateTaskInput {
|
|
33
|
+
title: string;
|
|
34
|
+
description?: string;
|
|
35
|
+
priority?: 'p0' | 'p1' | 'p2' | 'p3';
|
|
36
|
+
assignee?: string;
|
|
37
|
+
filePaths?: string[];
|
|
38
|
+
dependencies?: string[];
|
|
39
|
+
labels?: string[];
|
|
40
|
+
createdBy?: string;
|
|
41
|
+
parentTaskId?: string;
|
|
42
|
+
}
|
|
43
|
+
export interface TaskFilter {
|
|
44
|
+
status?: 'todo' | 'in_progress' | 'done' | 'blocked';
|
|
45
|
+
assignee?: string;
|
|
46
|
+
priority?: 'p0' | 'p1' | 'p2' | 'p3';
|
|
47
|
+
}
|
|
48
|
+
export interface DependencyGraphNode {
|
|
49
|
+
task: Task;
|
|
50
|
+
dependsOn: string[];
|
|
51
|
+
dependents: string[];
|
|
52
|
+
layer: number;
|
|
53
|
+
}
|
|
54
|
+
export interface DependencyGraph {
|
|
55
|
+
nodes: Map<string, DependencyGraphNode>;
|
|
56
|
+
layers: string[][];
|
|
57
|
+
roots: string[];
|
|
58
|
+
}
|
|
59
|
+
export interface TaskStore {
|
|
60
|
+
create(input: CreateTaskInput): Task;
|
|
61
|
+
get(id: string): Task | null;
|
|
62
|
+
update(id: string, changes: Partial<Omit<Task, 'id' | 'createdAt'>>): Task | null;
|
|
63
|
+
delete(id: string): void;
|
|
64
|
+
list(filter?: TaskFilter): Task[];
|
|
65
|
+
claim(id: string, agentId: string, agentSessionId: string): Task;
|
|
66
|
+
unclaim(id: string): Task;
|
|
67
|
+
getBlockedBy(id: string): string[];
|
|
68
|
+
getDependencyGraph(): DependencyGraph;
|
|
69
|
+
}
|
|
70
|
+
interface TaskRow {
|
|
71
|
+
id: string;
|
|
72
|
+
title: string;
|
|
73
|
+
description: string | null;
|
|
74
|
+
status: string;
|
|
75
|
+
priority: string;
|
|
76
|
+
assignee: string | null;
|
|
77
|
+
agent_id: string | null;
|
|
78
|
+
agent_session_id: string | null;
|
|
79
|
+
file_paths: string;
|
|
80
|
+
dependencies: string;
|
|
81
|
+
progress: number;
|
|
82
|
+
progress_log: string;
|
|
83
|
+
attachments: string;
|
|
84
|
+
labels: string;
|
|
85
|
+
pr_url: string | null;
|
|
86
|
+
ci_status: string | null;
|
|
87
|
+
created_by: string | null;
|
|
88
|
+
created_at: string;
|
|
89
|
+
updated_at: string;
|
|
90
|
+
parent_task_id: string | null;
|
|
91
|
+
depth: number;
|
|
92
|
+
}
|
|
93
|
+
export declare function rowToTask(row: TaskRow): Task;
|
|
94
|
+
export declare function createTaskStore(db: VerboDatabase): TaskStore;
|
|
95
|
+
export {};
|
|
96
|
+
//# sourceMappingURL=task-store.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"task-store.d.ts","sourceRoot":"","sources":["../../../src/core/task-store.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAA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description: row.description ?? undefined,
|
|
8
|
+
status: row.status,
|
|
9
|
+
priority: row.priority,
|
|
10
|
+
assignee: row.assignee ?? undefined,
|
|
11
|
+
agentId: row.agent_id ?? undefined,
|
|
12
|
+
agentSessionId: row.agent_session_id ?? undefined,
|
|
13
|
+
filePaths: JSON.parse(row.file_paths ?? '[]'),
|
|
14
|
+
dependencies: JSON.parse(row.dependencies ?? '[]'),
|
|
15
|
+
progress: row.progress ?? 0,
|
|
16
|
+
progressLog: JSON.parse(row.progress_log ?? '[]'),
|
|
17
|
+
attachments: JSON.parse(row.attachments ?? '[]'),
|
|
18
|
+
labels: JSON.parse(row.labels ?? '[]'),
|
|
19
|
+
prUrl: row.pr_url ?? undefined,
|
|
20
|
+
ciStatus: row.ci_status ?? undefined,
|
|
21
|
+
createdBy: row.created_by ?? undefined,
|
|
22
|
+
createdAt: row.created_at,
|
|
23
|
+
updatedAt: row.updated_at,
|
|
24
|
+
parentTaskId: row.parent_task_id ?? undefined,
|
|
25
|
+
depth: row.depth ?? 0,
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
// ---- Factory ----
|
|
29
|
+
export function createTaskStore(db) {
|
|
30
|
+
const raw = db.raw();
|
|
31
|
+
// Prepared statements created once and reused
|
|
32
|
+
const stmtInsert = raw.prepare(`
|
|
33
|
+
INSERT INTO tasks (
|
|
34
|
+
id, title, description, status, priority, assignee,
|
|
35
|
+
agent_id, agent_session_id,
|
|
36
|
+
file_paths, dependencies, progress, progress_log,
|
|
37
|
+
attachments, labels, pr_url, ci_status, created_by, created_at, updated_at,
|
|
38
|
+
parent_task_id, depth
|
|
39
|
+
) VALUES (
|
|
40
|
+
@id, @title, @description, @status, @priority, @assignee,
|
|
41
|
+
@agent_id, @agent_session_id,
|
|
42
|
+
@file_paths, @dependencies, @progress, @progress_log,
|
|
43
|
+
@attachments, @labels, @pr_url, @ci_status, @created_by, @created_at, @updated_at,
|
|
44
|
+
@parent_task_id, @depth
|
|
45
|
+
)
|
|
46
|
+
`);
|
|
47
|
+
const stmtGetById = raw.prepare('SELECT * FROM tasks WHERE id = ?');
|
|
48
|
+
const stmtDelete = raw.prepare('DELETE FROM tasks WHERE id = ?');
|
|
49
|
+
// JSON fields that need special serialization on update
|
|
50
|
+
const JSON_FIELDS = new Set([
|
|
51
|
+
'filePaths',
|
|
52
|
+
'dependencies',
|
|
53
|
+
'progressLog',
|
|
54
|
+
'attachments',
|
|
55
|
+
'labels',
|
|
56
|
+
]);
|
|
57
|
+
// Mapping from camelCase Task keys to snake_case column names
|
|
58
|
+
const COLUMN_MAP = {
|
|
59
|
+
title: 'title',
|
|
60
|
+
description: 'description',
|
|
61
|
+
status: 'status',
|
|
62
|
+
priority: 'priority',
|
|
63
|
+
assignee: 'assignee',
|
|
64
|
+
agentId: 'agent_id',
|
|
65
|
+
agentSessionId: 'agent_session_id',
|
|
66
|
+
filePaths: 'file_paths',
|
|
67
|
+
dependencies: 'dependencies',
|
|
68
|
+
progress: 'progress',
|
|
69
|
+
progressLog: 'progress_log',
|
|
70
|
+
attachments: 'attachments',
|
|
71
|
+
labels: 'labels',
|
|
72
|
+
prUrl: 'pr_url',
|
|
73
|
+
ciStatus: 'ci_status',
|
|
74
|
+
createdBy: 'created_by',
|
|
75
|
+
updatedAt: 'updated_at',
|
|
76
|
+
parentTaskId: 'parent_task_id',
|
|
77
|
+
depth: 'depth',
|
|
78
|
+
};
|
|
79
|
+
function create(input) {
|
|
80
|
+
const now = new Date().toISOString();
|
|
81
|
+
const id = ulid();
|
|
82
|
+
const parentDepth = input.parentTaskId ? (get(input.parentTaskId)?.depth ?? 0) : -1;
|
|
83
|
+
const depth = input.parentTaskId ? parentDepth + 1 : 0;
|
|
84
|
+
const row = {
|
|
85
|
+
id,
|
|
86
|
+
title: input.title,
|
|
87
|
+
description: input.description ?? null,
|
|
88
|
+
status: 'todo',
|
|
89
|
+
priority: input.priority ?? 'p2',
|
|
90
|
+
assignee: input.assignee ?? null,
|
|
91
|
+
agent_id: null,
|
|
92
|
+
agent_session_id: null,
|
|
93
|
+
file_paths: JSON.stringify(input.filePaths ?? []),
|
|
94
|
+
dependencies: JSON.stringify(input.dependencies ?? []),
|
|
95
|
+
progress: 0,
|
|
96
|
+
progress_log: JSON.stringify([]),
|
|
97
|
+
attachments: JSON.stringify([]),
|
|
98
|
+
labels: JSON.stringify(input.labels ?? []),
|
|
99
|
+
pr_url: null,
|
|
100
|
+
ci_status: null,
|
|
101
|
+
created_by: input.createdBy ?? null,
|
|
102
|
+
created_at: now,
|
|
103
|
+
updated_at: now,
|
|
104
|
+
parent_task_id: input.parentTaskId ?? null,
|
|
105
|
+
depth,
|
|
106
|
+
};
|
|
107
|
+
stmtInsert.run(row);
|
|
108
|
+
return get(id);
|
|
109
|
+
}
|
|
110
|
+
function get(id) {
|
|
111
|
+
const row = stmtGetById.get(id);
|
|
112
|
+
if (!row)
|
|
113
|
+
return null;
|
|
114
|
+
return rowToTask(row);
|
|
115
|
+
}
|
|
116
|
+
function update(id, changes) {
|
|
117
|
+
const existing = get(id);
|
|
118
|
+
if (!existing)
|
|
119
|
+
return null;
|
|
120
|
+
const setClauses = [];
|
|
121
|
+
const params = {};
|
|
122
|
+
for (const [key, value] of Object.entries(changes)) {
|
|
123
|
+
const col = COLUMN_MAP[key];
|
|
124
|
+
if (!col)
|
|
125
|
+
continue;
|
|
126
|
+
setClauses.push(`${col} = @${col}`);
|
|
127
|
+
if (JSON_FIELDS.has(key)) {
|
|
128
|
+
params[col] = JSON.stringify(value);
|
|
129
|
+
}
|
|
130
|
+
else {
|
|
131
|
+
params[col] = value ?? null;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
// Always update updated_at
|
|
135
|
+
const now = new Date().toISOString();
|
|
136
|
+
if (!setClauses.includes('updated_at = @updated_at')) {
|
|
137
|
+
setClauses.push('updated_at = @updated_at');
|
|
138
|
+
params['updated_at'] = now;
|
|
139
|
+
}
|
|
140
|
+
params['id'] = id;
|
|
141
|
+
const stmt = raw.prepare(`UPDATE tasks SET ${setClauses.join(', ')} WHERE id = @id`);
|
|
142
|
+
stmt.run(params);
|
|
143
|
+
return get(id);
|
|
144
|
+
}
|
|
145
|
+
function deleteTask(id) {
|
|
146
|
+
const task = get(id);
|
|
147
|
+
if (!task)
|
|
148
|
+
return;
|
|
149
|
+
if (task.status !== 'todo' && task.status !== 'blocked') {
|
|
150
|
+
throw new Error(`Cannot delete task with status "${task.status}" — only todo or blocked tasks can be deleted`);
|
|
151
|
+
}
|
|
152
|
+
stmtDelete.run(id);
|
|
153
|
+
}
|
|
154
|
+
function list(filter) {
|
|
155
|
+
const conditions = [];
|
|
156
|
+
const params = [];
|
|
157
|
+
if (filter?.status) {
|
|
158
|
+
conditions.push('status = ?');
|
|
159
|
+
params.push(filter.status);
|
|
160
|
+
}
|
|
161
|
+
if (filter?.assignee) {
|
|
162
|
+
conditions.push('assignee = ?');
|
|
163
|
+
params.push(filter.assignee);
|
|
164
|
+
}
|
|
165
|
+
if (filter?.priority) {
|
|
166
|
+
conditions.push('priority = ?');
|
|
167
|
+
params.push(filter.priority);
|
|
168
|
+
}
|
|
169
|
+
const where = conditions.length > 0 ? `WHERE ${conditions.join(' AND ')}` : '';
|
|
170
|
+
const sql = `SELECT * FROM tasks ${where} ORDER BY priority ASC, created_at ASC`;
|
|
171
|
+
const stmt = raw.prepare(sql);
|
|
172
|
+
const rows = stmt.all(...params);
|
|
173
|
+
return rows.map(rowToTask);
|
|
174
|
+
}
|
|
175
|
+
function claim(id, agentId, agentSessionId) {
|
|
176
|
+
const task = get(id);
|
|
177
|
+
if (!task)
|
|
178
|
+
throw new Error(`Task not found: ${id}`);
|
|
179
|
+
// Check if already claimed by a different agent
|
|
180
|
+
if (task.agentId && task.agentId !== agentId) {
|
|
181
|
+
throw new Error('already claimed');
|
|
182
|
+
}
|
|
183
|
+
// Also treat in_progress without an agentId as claimable (edge case), but
|
|
184
|
+
// if it has any agentId (even same agent) we allow re-claim (idempotent).
|
|
185
|
+
// However, if in_progress with different agent, we already threw above.
|
|
186
|
+
const now = new Date().toISOString();
|
|
187
|
+
raw.prepare(`
|
|
188
|
+
UPDATE tasks
|
|
189
|
+
SET status = 'in_progress', agent_id = ?, agent_session_id = ?, updated_at = ?
|
|
190
|
+
WHERE id = ?
|
|
191
|
+
`).run(agentId, agentSessionId, now, id);
|
|
192
|
+
return get(id);
|
|
193
|
+
}
|
|
194
|
+
function unclaim(id) {
|
|
195
|
+
const task = get(id);
|
|
196
|
+
if (!task)
|
|
197
|
+
throw new Error(`Task not found: ${id}`);
|
|
198
|
+
const now = new Date().toISOString();
|
|
199
|
+
raw.prepare(`
|
|
200
|
+
UPDATE tasks
|
|
201
|
+
SET status = 'todo', agent_id = NULL, agent_session_id = NULL, progress = 0, updated_at = ?
|
|
202
|
+
WHERE id = ?
|
|
203
|
+
`).run(now, id);
|
|
204
|
+
return get(id);
|
|
205
|
+
}
|
|
206
|
+
function getBlockedBy(id) {
|
|
207
|
+
const task = get(id);
|
|
208
|
+
if (!task)
|
|
209
|
+
return [];
|
|
210
|
+
if (task.dependencies.length === 0)
|
|
211
|
+
return [];
|
|
212
|
+
const placeholders = task.dependencies.map(() => '?').join(', ');
|
|
213
|
+
const stmt = raw.prepare(`SELECT id, status FROM tasks WHERE id IN (${placeholders})`);
|
|
214
|
+
const depRows = stmt.all(...task.dependencies);
|
|
215
|
+
return depRows
|
|
216
|
+
.filter((dep) => dep.status !== 'done')
|
|
217
|
+
.map((dep) => dep.id);
|
|
218
|
+
}
|
|
219
|
+
function getDependencyGraph() {
|
|
220
|
+
const allTasks = list();
|
|
221
|
+
const taskMap = new Map();
|
|
222
|
+
for (const t of allTasks)
|
|
223
|
+
taskMap.set(t.id, t);
|
|
224
|
+
const nodes = new Map();
|
|
225
|
+
const reverseMap = new Map(); // id -> dependents
|
|
226
|
+
// First pass: build nodes with dependsOn, init reverseMap
|
|
227
|
+
for (const t of allTasks) {
|
|
228
|
+
// Only include dependencies that actually exist in the task list
|
|
229
|
+
const validDeps = t.dependencies.filter((depId) => taskMap.has(depId));
|
|
230
|
+
nodes.set(t.id, {
|
|
231
|
+
task: t,
|
|
232
|
+
dependsOn: validDeps,
|
|
233
|
+
dependents: [],
|
|
234
|
+
layer: -1,
|
|
235
|
+
});
|
|
236
|
+
for (const depId of validDeps) {
|
|
237
|
+
if (!reverseMap.has(depId))
|
|
238
|
+
reverseMap.set(depId, []);
|
|
239
|
+
reverseMap.get(depId).push(t.id);
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
// Second pass: fill dependents
|
|
243
|
+
for (const [id, depIds] of reverseMap) {
|
|
244
|
+
const node = nodes.get(id);
|
|
245
|
+
if (node)
|
|
246
|
+
node.dependents = depIds;
|
|
247
|
+
}
|
|
248
|
+
// BFS to assign layers (topological)
|
|
249
|
+
const layers = [];
|
|
250
|
+
const assigned = new Set();
|
|
251
|
+
// Layer 0: tasks with no (valid) dependencies
|
|
252
|
+
const layer0 = [];
|
|
253
|
+
for (const [id, node] of nodes) {
|
|
254
|
+
if (node.dependsOn.length === 0) {
|
|
255
|
+
node.layer = 0;
|
|
256
|
+
layer0.push(id);
|
|
257
|
+
assigned.add(id);
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
if (layer0.length > 0)
|
|
261
|
+
layers.push(layer0);
|
|
262
|
+
// Subsequent layers
|
|
263
|
+
let currentLayer = 0;
|
|
264
|
+
while (assigned.size < nodes.size) {
|
|
265
|
+
const nextLayer = [];
|
|
266
|
+
for (const [id, node] of nodes) {
|
|
267
|
+
if (assigned.has(id))
|
|
268
|
+
continue;
|
|
269
|
+
// All dependencies must be assigned
|
|
270
|
+
if (node.dependsOn.every((depId) => assigned.has(depId))) {
|
|
271
|
+
node.layer = currentLayer + 1;
|
|
272
|
+
nextLayer.push(id);
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
if (nextLayer.length === 0) {
|
|
276
|
+
// Remaining tasks have circular dependencies — assign them to next layer
|
|
277
|
+
for (const [id] of nodes) {
|
|
278
|
+
if (!assigned.has(id)) {
|
|
279
|
+
const node = nodes.get(id);
|
|
280
|
+
node.layer = currentLayer + 1;
|
|
281
|
+
nextLayer.push(id);
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
for (const id of nextLayer)
|
|
286
|
+
assigned.add(id);
|
|
287
|
+
if (nextLayer.length > 0)
|
|
288
|
+
layers.push(nextLayer);
|
|
289
|
+
currentLayer++;
|
|
290
|
+
}
|
|
291
|
+
return {
|
|
292
|
+
nodes,
|
|
293
|
+
layers,
|
|
294
|
+
roots: layers[0] ?? [],
|
|
295
|
+
};
|
|
296
|
+
}
|
|
297
|
+
return {
|
|
298
|
+
create,
|
|
299
|
+
get,
|
|
300
|
+
update,
|
|
301
|
+
delete: deleteTask,
|
|
302
|
+
list,
|
|
303
|
+
claim,
|
|
304
|
+
unclaim,
|
|
305
|
+
getBlockedBy,
|
|
306
|
+
getDependencyGraph,
|
|
307
|
+
};
|
|
308
|
+
}
|
|
309
|
+
//# sourceMappingURL=task-store.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"task-store.js","sourceRoot":"","sources":["../../../src/core/task-store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAkG5B,gCAAgC;AAEhC,MAAM,UAAU,SAAS,CAAC,GAAY;IACpC,OAAO;QACL,EAAE,EAAE,GAAG,CAAC,EAAE;QACV,KAAK,EAAE,GAAG,CAAC,KAAK;QAChB,WAAW,EAAE,GAAG,CAAC,WAAW,IAAI,SAAS;QACzC,MAAM,EAAE,GAAG,CAAC,MAAwB;QACpC,QAAQ,EAAE,GAAG,CAAC,QAA4B;QAC1C,QAAQ,EAAE,GAAG,CAAC,QAAQ,IAAI,SAAS;QACnC,OAAO,EAAE,GAAG,CAAC,QAAQ,IAAI,SAAS;QAClC,cAAc,EAAE,GAAG,CAAC,gBAAgB,IAAI,SAAS;QACjD,SAAS,EAAE,IAAI,CAAC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value: string) => string | null;
|
|
6
|
+
}
|
|
7
|
+
export declare const FIELD_REGISTRY: Record<string, FieldDef>;
|
|
8
|
+
/**
|
|
9
|
+
* Returns a confirmation warning message if the field+value combo requires one,
|
|
10
|
+
* otherwise null.
|
|
11
|
+
*/
|
|
12
|
+
export declare function requiresConfirmation(field: string, value: string): string | null;
|
|
13
|
+
/**
|
|
14
|
+
* Validates a value for a given field. Returns an error message string if invalid,
|
|
15
|
+
* or null if valid.
|
|
16
|
+
*/
|
|
17
|
+
export declare function validateFieldValue(field: string, value: string): string | null;
|
|
18
|
+
/**
|
|
19
|
+
* Pure function: updates (or inserts) a field in a VERBO.md content string.
|
|
20
|
+
* - If the key exists in the correct section: replaces that line.
|
|
21
|
+
* - If the section exists but key is absent: appends the key inside the section.
|
|
22
|
+
* - If the section is absent: appends the section + key at the end.
|
|
23
|
+
*/
|
|
24
|
+
export declare function setFieldInContent(content: string, field: string, value: string): string;
|
|
25
|
+
/**
|
|
26
|
+
* Returns the current value of a field from a VERBO.md content string.
|
|
27
|
+
* Returns undefined if the field is not found in the correct section.
|
|
28
|
+
*/
|
|
29
|
+
export declare function getFieldFromContent(content: string, field: string): string | undefined;
|
|
30
|
+
/**
|
|
31
|
+
* Returns all currently set configurable fields as a flat key→value map.
|
|
32
|
+
*/
|
|
33
|
+
export declare function getAllFieldsFromContent(content: string): Record<string, string>;
|
|
34
|
+
/**
|
|
35
|
+
* Reads VERBO.md at verboMdPath, sets the field, and writes it back in place.
|
|
36
|
+
* Creates the file with a minimal header if it doesn't exist.
|
|
37
|
+
*/
|
|
38
|
+
export declare function setVerboMdField(verboMdPath: string, field: string, value: string): void;
|
|
39
|
+
/**
|
|
40
|
+
* Reads VERBO.md and returns all currently set configurable fields.
|
|
41
|
+
* Returns empty object if the file does not exist.
|
|
42
|
+
*/
|
|
43
|
+
export declare function getVerboMdFields(verboMdPath: string): Record<string, string>;
|
|
44
|
+
//# sourceMappingURL=verbo-config-editor.d.ts.map
|
|
@@ -0,0 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