feat: add agents command
This commit is contained in:
@@ -11,7 +11,7 @@ import {
|
||||
} from "../agents/workspace.js";
|
||||
import type { ClawdbotConfig } from "../config/config.js";
|
||||
import { CONFIG_PATH_CLAWDBOT } from "../config/config.js";
|
||||
import { resolveSessionTranscriptsDir } from "../config/sessions.js";
|
||||
import { resolveSessionTranscriptsDirForAgent } from "../config/sessions.js";
|
||||
import { callGateway } from "../gateway/call.js";
|
||||
import { normalizeControlUiBasePath } from "../gateway/control-ui.js";
|
||||
import { pickPrimaryTailnetIPv4 } from "../infra/tailnet.js";
|
||||
@@ -19,7 +19,11 @@ import { runCommandWithTimeout } from "../process/exec.js";
|
||||
import type { RuntimeEnv } from "../runtime.js";
|
||||
import { CONFIG_DIR, resolveUserPath } from "../utils.js";
|
||||
import { VERSION } from "../version.js";
|
||||
import type { NodeManagerChoice, ResetScope } from "./onboard-types.js";
|
||||
import type {
|
||||
NodeManagerChoice,
|
||||
OnboardMode,
|
||||
ResetScope,
|
||||
} from "./onboard-types.js";
|
||||
|
||||
export function guardCancel<T>(value: T, runtime: RuntimeEnv): T {
|
||||
if (isCancel(value)) {
|
||||
@@ -72,7 +76,7 @@ export function printWizardHeader(runtime: RuntimeEnv) {
|
||||
|
||||
export function applyWizardMetadata(
|
||||
cfg: ClawdbotConfig,
|
||||
params: { command: string; mode: "local" | "remote" },
|
||||
params: { command: string; mode: OnboardMode },
|
||||
): ClawdbotConfig {
|
||||
const commit =
|
||||
process.env.GIT_COMMIT?.trim() || process.env.GIT_SHA?.trim() || undefined;
|
||||
@@ -226,14 +230,14 @@ export async function openUrl(url: string): Promise<boolean> {
|
||||
export async function ensureWorkspaceAndSessions(
|
||||
workspaceDir: string,
|
||||
runtime: RuntimeEnv,
|
||||
options?: { skipBootstrap?: boolean },
|
||||
options?: { skipBootstrap?: boolean; agentId?: string },
|
||||
) {
|
||||
const ws = await ensureAgentWorkspace({
|
||||
dir: workspaceDir,
|
||||
ensureBootstrapFiles: !options?.skipBootstrap,
|
||||
});
|
||||
runtime.log(`Workspace OK: ${ws.dir}`);
|
||||
const sessionsDir = resolveSessionTranscriptsDir();
|
||||
const sessionsDir = resolveSessionTranscriptsDirForAgent(options?.agentId);
|
||||
await fs.mkdir(sessionsDir, { recursive: true });
|
||||
runtime.log(`Sessions OK: ${sessionsDir}`);
|
||||
}
|
||||
@@ -275,7 +279,7 @@ export async function handleReset(
|
||||
await moveToTrash(CONFIG_PATH_CLAWDBOT, runtime);
|
||||
if (scope === "config") return;
|
||||
await moveToTrash(path.join(CONFIG_DIR, "credentials"), runtime);
|
||||
await moveToTrash(resolveSessionTranscriptsDir(), runtime);
|
||||
await moveToTrash(resolveSessionTranscriptsDirForAgent(), runtime);
|
||||
if (scope === "full") {
|
||||
await moveToTrash(workspaceDir, runtime);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user