feat(KB-330): rename internal packages from @kb/* to @fusion/*
- Rename @kb/core, @kb/dashboard, @kb/engine to @fusion/* namespace - Update all import statements across 143+ files to use new package names - Update workspace dependencies and root package.json references - Fix bundler configurations (tsup, vite) for new package names - Update test files and fix typecheck issues - Add changeset file documenting the package rename
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"name": "@kb/engine",
|
||||
"name": "@fusion/engine",
|
||||
"version": "0.1.0",
|
||||
"type": "module",
|
||||
"exports": {
|
||||
@@ -21,7 +21,7 @@
|
||||
"test": "vitest run"
|
||||
},
|
||||
"dependencies": {
|
||||
"@kb/core": "workspace:*",
|
||||
"@fusion/core": "workspace:*",
|
||||
"@mariozechner/pi-ai": "^0.62.0",
|
||||
"@mariozechner/pi-coding-agent": "^0.62.0"
|
||||
},
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
* - onTerminated: Called when an unresponsive agent is terminated
|
||||
*/
|
||||
|
||||
import type { AgentStore, Agent, AgentState } from "@kb/core";
|
||||
import type { AgentStore, Agent, AgentState } from "@fusion/core";
|
||||
|
||||
/** Options for HeartbeatMonitor constructor */
|
||||
export interface HeartbeatMonitorOptions {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { describe, it, expect, vi, beforeEach, afterEach } from "vitest";
|
||||
import { AgentLogger, summarizeToolArgs } from "./agent-logger.js";
|
||||
import type { TaskStore } from "@kb/core";
|
||||
import type { TaskStore } from "@fusion/core";
|
||||
|
||||
// ── summarizeToolArgs tests ──────────────────────────────────────────
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { TaskStore, AgentRole } from "@kb/core";
|
||||
import type { TaskStore, AgentRole } from "@fusion/core";
|
||||
|
||||
/** Default byte threshold before an automatic flush. */
|
||||
const FLUSH_SIZE_BYTES = 1024;
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { describe, it, expect, vi, beforeEach, afterEach } from "vitest";
|
||||
import { CronRunner } from "./cron-runner.js";
|
||||
import type { TaskStore, AutomationStore, ScheduledTask, AutomationRunResult, AutomationStep, Settings } from "@kb/core";
|
||||
import type { TaskStore, AutomationStore, ScheduledTask, AutomationRunResult, AutomationStep, Settings } from "@fusion/core";
|
||||
import { randomUUID } from "node:crypto";
|
||||
|
||||
// Default settings inline to avoid @kb/core build dependency during tests
|
||||
// Default settings inline to avoid @fusion/core build dependency during tests
|
||||
const DEFAULT_SETTINGS: Settings = {
|
||||
maxConcurrent: 2,
|
||||
maxWorktrees: 4,
|
||||
@@ -21,9 +21,9 @@ const DEFAULT_SETTINGS: Settings = {
|
||||
planningModelId: "claude-sonnet-4-5",
|
||||
validatorProvider: "openai",
|
||||
validatorModelId: "gpt-4o",
|
||||
autoUpdatePrStatus: true,
|
||||
autoCreatePr: false,
|
||||
taskStuckTimeoutMs: undefined,
|
||||
groupOverlappingFiles: false,
|
||||
autoMerge: true,
|
||||
};
|
||||
|
||||
function createMockSchedule(overrides: Partial<ScheduledTask> = {}): ScheduledTask {
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { exec } from "node:child_process";
|
||||
import { promisify } from "node:util";
|
||||
import type { TaskStore } from "@kb/core";
|
||||
import type { AutomationStore } from "@kb/core";
|
||||
import type { ScheduledTask, AutomationRunResult, AutomationStep, AutomationStepResult } from "@kb/core";
|
||||
import type { TaskStore } from "@fusion/core";
|
||||
import type { AutomationStore } from "@fusion/core";
|
||||
import type { ScheduledTask, AutomationRunResult, AutomationStep, AutomationStepResult } from "@fusion/core";
|
||||
import { createLogger } from "./logger.js";
|
||||
|
||||
const execAsync = promisify(exec);
|
||||
|
||||
@@ -38,7 +38,7 @@ import { execSync } from "node:child_process";
|
||||
import { findWorktreeUser, aiMergeTask } from "./merger.js";
|
||||
import { WorktreePool } from "./worktree-pool.js";
|
||||
import { generateWorktreeName, slugify } from "./worktree-names.js";
|
||||
import type { Column, Task, TaskDetail } from "@kb/core";
|
||||
import type { Column, Task, TaskDetail } from "@fusion/core";
|
||||
|
||||
const mockedCreateHaiAgent = vi.mocked(createKbAgent);
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { execSync } from "node:child_process";
|
||||
import { join } from "node:path";
|
||||
import { existsSync } from "node:fs";
|
||||
import type { TaskStore, Task, TaskDetail, StepStatus, Settings, WorkflowStep } from "@kb/core";
|
||||
import type { TaskStore, Task, TaskDetail, StepStatus, Settings, WorkflowStep } from "@fusion/core";
|
||||
import { findWorktreeUser } from "./merger.js";
|
||||
import { generateWorktreeName, slugify } from "./worktree-names.js";
|
||||
import { Type, type Static } from "@mariozechner/pi-ai";
|
||||
@@ -1028,7 +1028,7 @@ export class TaskExecutor {
|
||||
if (!currentTask.enabledWorkflowSteps?.length) return true;
|
||||
|
||||
const workflowStepIds = currentTask.enabledWorkflowSteps;
|
||||
const results: import("@kb/core").WorkflowStepResult[] = [];
|
||||
const results: import("@fusion/core").WorkflowStepResult[] = [];
|
||||
|
||||
for (const wsId of workflowStepIds) {
|
||||
const ws = await this.store.getWorkflowStep(wsId);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Lightweight structured logger for the `@kb/engine` package.
|
||||
* Lightweight structured logger for the `@fusion/engine` package.
|
||||
*
|
||||
* Usage:
|
||||
* ```ts
|
||||
|
||||
@@ -32,7 +32,7 @@ import {
|
||||
} from "./merger.js";
|
||||
import { createKbAgent } from "./pi.js";
|
||||
import { execSync } from "node:child_process";
|
||||
import { type TaskStore, type Task, type MergeResult, DEFAULT_SETTINGS } from "@kb/core";
|
||||
import { type TaskStore, type Task, type MergeResult, DEFAULT_SETTINGS } from "@fusion/core";
|
||||
|
||||
const mockedCreateHaiAgent = vi.mocked(createKbAgent);
|
||||
const mockedExecSync = vi.mocked(execSync);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { execSync } from "node:child_process";
|
||||
import { existsSync, readFileSync } from "node:fs";
|
||||
import type { TaskStore, Task, MergeResult } from "@kb/core";
|
||||
import type { TaskStore, Task, MergeResult } from "@fusion/core";
|
||||
import { createKbAgent } from "./pi.js";
|
||||
import type { WorktreePool } from "./worktree-pool.js";
|
||||
import { AgentLogger } from "./agent-logger.js";
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { describe, it, expect, vi, beforeEach, afterEach } from "vitest";
|
||||
import { EventEmitter } from "node:events";
|
||||
import type { Task, Column, MergeResult, Settings } from "@kb/core";
|
||||
import type { Task, Column, MergeResult, Settings } from "@fusion/core";
|
||||
import { NtfyNotifier } from "./notifier.js";
|
||||
|
||||
// Mock the logger
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { TaskStore, Task, Column, Settings, MergeResult } from "@kb/core";
|
||||
import type { TaskStore, Task, Column, Settings, MergeResult } from "@fusion/core";
|
||||
import { EventEmitter } from "node:events";
|
||||
import { schedulerLog } from "./logger.js";
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { describe, it, expect, vi, beforeEach } from "vitest";
|
||||
import { PrCommentHandler } from "./pr-comment-handler.js";
|
||||
import type { TaskStore, Task } from "@kb/core";
|
||||
import type { TaskStore, Task } from "@fusion/core";
|
||||
|
||||
const mockStore = {
|
||||
addSteeringComment: vi.fn<(id: string, text: string, author?: "user" | "agent") => Promise<Task>>(),
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { TaskStore } from "@kb/core";
|
||||
import type { PrInfo } from "@kb/core";
|
||||
import type { TaskStore } from "@fusion/core";
|
||||
import type { PrInfo } from "@fusion/core";
|
||||
import { prMonitorLog } from "./logger.js";
|
||||
|
||||
interface PrComment {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { prMonitorLog } from "./logger.js";
|
||||
import type { PrInfo } from "@kb/core";
|
||||
import type { PrInfo } from "@fusion/core";
|
||||
|
||||
export interface TrackedPr {
|
||||
owner: string;
|
||||
@@ -44,7 +44,7 @@ interface GhPrViewJson {
|
||||
*/
|
||||
async function checkGhAuth(): Promise<boolean> {
|
||||
try {
|
||||
const { isGhAvailable, isGhAuthenticated } = await import("@kb/core");
|
||||
const { isGhAvailable, isGhAuthenticated } = await import("@fusion/core");
|
||||
return isGhAvailable() && isGhAuthenticated();
|
||||
} catch {
|
||||
return false;
|
||||
@@ -60,7 +60,7 @@ async function fetchCommentsWithGh(
|
||||
prNumber: number,
|
||||
since?: string
|
||||
): Promise<PrComment[]> {
|
||||
const { runGhJson } = await import("@kb/core");
|
||||
const { runGhJson } = await import("@fusion/core");
|
||||
|
||||
const pr = await runGhJson<GhPrViewJson>([
|
||||
"pr", "view", String(prNumber),
|
||||
|
||||
@@ -36,7 +36,7 @@ import { WorktreePool, scanIdleWorktrees, cleanupOrphanedWorktrees } from "./wor
|
||||
import { createKbAgent } from "./pi.js";
|
||||
import { execSync } from "node:child_process";
|
||||
import { existsSync, readdirSync } from "node:fs";
|
||||
import type { Task, TaskDetail, TaskStep, Column, Settings, StepStatus } from "@kb/core";
|
||||
import type { Task, TaskDetail, TaskStep, Column, Settings, StepStatus } from "@fusion/core";
|
||||
|
||||
const mockedCreateHaiAgent = vi.mocked(createKbAgent);
|
||||
const mockedExecSync = vi.mocked(execSync);
|
||||
@@ -267,7 +267,7 @@ describe("In-progress task resume after restart", () => {
|
||||
// ── Step 3: In-review merge re-queue tests ────────────────────────────────
|
||||
//
|
||||
// The merge queue/enqueueMerge logic lives in dashboard.ts (CLI layer).
|
||||
// These tests focus on what @kb/engine owns: aiMergeTask() behaviour
|
||||
// These tests focus on what @fusion/engine owns: aiMergeTask() behaviour
|
||||
// relevant to restart resilience — state validation, status lifecycle,
|
||||
// and error handling with git reset --merge cleanup.
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
* - Verdict + feedback is returned to the worker
|
||||
*/
|
||||
|
||||
import type { TaskStore } from "@kb/core";
|
||||
import type { TaskStore } from "@fusion/core";
|
||||
import { createKbAgent } from "./pi.js";
|
||||
import { AgentLogger } from "./agent-logger.js";
|
||||
import { checkSessionError } from "./usage-limit-detector.js";
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { describe, it, expect, vi } from "vitest";
|
||||
import { Scheduler, pathsOverlap } from "./scheduler.js";
|
||||
import type { TaskStore, Task } from "@kb/core";
|
||||
import { AgentSemaphore } from "./concurrency.js";
|
||||
import type { TaskStore, Task } from "@fusion/core";
|
||||
|
||||
// Helper to create mock tasks
|
||||
function createMockTask(overrides: Partial<Task> = {}): Task {
|
||||
@@ -181,7 +182,7 @@ describe("Scheduler", () => {
|
||||
totalCount: 2,
|
||||
acquire: vi.fn().mockResolvedValue(undefined),
|
||||
release: vi.fn(),
|
||||
};
|
||||
} as unknown as AgentSemaphore;
|
||||
|
||||
const tasks = [
|
||||
createMockTask({ id: "KB-001", column: "in-progress" }),
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { resolveDependencyOrder, type TaskStore, type Task } from "@kb/core";
|
||||
import { resolveDependencyOrder, type TaskStore, type Task } from "@fusion/core";
|
||||
import type { AgentSemaphore } from "./concurrency.js";
|
||||
import { schedulerLog } from "./logger.js";
|
||||
import type { PrMonitor } from "./pr-monitor.js";
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { describe, it, expect, vi, beforeEach, afterEach } from "vitest";
|
||||
import { StuckTaskDetector } from "./stuck-task-detector.js";
|
||||
import type { TaskStore } from "@kb/core";
|
||||
import type { TaskStore } from "@fusion/core";
|
||||
|
||||
// Mock store factory
|
||||
function createMockStore(overrides: Partial<TaskStore> = {}): TaskStore {
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
* compares the last activity timestamp against `taskStuckTimeoutMs` from settings.
|
||||
*/
|
||||
|
||||
import type { TaskStore, Settings } from "@kb/core";
|
||||
import type { TaskStore, Settings } from "@fusion/core";
|
||||
import { createLogger } from "./logger.js";
|
||||
|
||||
const stuckLog = createLogger("stuck-detector");
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { describe, it, expect, vi, beforeEach } from "vitest";
|
||||
import type { TaskStore, Task, TaskDetail, Settings } from "@kb/core";
|
||||
import type { TaskStore, Task, TaskDetail, Settings } from "@fusion/core";
|
||||
import {
|
||||
TriageProcessor,
|
||||
TRIAGE_SYSTEM_PROMPT,
|
||||
|
||||
@@ -4,7 +4,7 @@ import type {
|
||||
TaskDetail,
|
||||
TaskAttachment,
|
||||
Settings,
|
||||
} from "@kb/core";
|
||||
} from "@fusion/core";
|
||||
import type { ImageContent } from "@mariozechner/pi-ai";
|
||||
import { Type, type Static } from "@mariozechner/pi-ai";
|
||||
import type {
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
* on their own via per-session retry.
|
||||
*/
|
||||
|
||||
import type { TaskStore } from "@kb/core";
|
||||
import type { TaskStore } from "@fusion/core";
|
||||
import { createLogger } from "./logger.js";
|
||||
|
||||
const log = createLogger("usage-limit");
|
||||
|
||||
@@ -12,7 +12,7 @@ vi.mock("node:fs", () => ({
|
||||
import { WorktreePool, scanIdleWorktrees, cleanupOrphanedWorktrees } from "./worktree-pool.js";
|
||||
import { execSync } from "node:child_process";
|
||||
import { existsSync, readdirSync } from "node:fs";
|
||||
import type { Task, Column } from "@kb/core";
|
||||
import type { Task, Column } from "@fusion/core";
|
||||
|
||||
const mockedExecSync = vi.mocked(execSync);
|
||||
const mockedExistsSync = vi.mocked(existsSync);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { execSync } from "node:child_process";
|
||||
import { existsSync, readdirSync } from "node:fs";
|
||||
import { join } from "node:path";
|
||||
import type { TaskStore } from "@kb/core";
|
||||
import type { TaskStore } from "@fusion/core";
|
||||
import { worktreePoolLog } from "./logger.js";
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user