style: apply lint fixes
This commit is contained in:
@@ -6,6 +6,7 @@ import {
|
|||||||
createProcessTool,
|
createProcessTool,
|
||||||
processTool,
|
processTool,
|
||||||
} from "./bash-tools.js";
|
} from "./bash-tools.js";
|
||||||
|
import { sanitizeBinaryOutput } from "./shell-utils.js";
|
||||||
|
|
||||||
const isWin = process.platform === "win32";
|
const isWin = process.platform === "win32";
|
||||||
const shortDelayCmd = isWin ? "ping -n 2 127.0.0.1 > nul" : "sleep 0.05";
|
const shortDelayCmd = isWin ? "ping -n 2 127.0.0.1 > nul" : "sleep 0.05";
|
||||||
@@ -17,10 +18,9 @@ const echoAfterDelay = (message: string) =>
|
|||||||
const echoLines = (lines: string[]) =>
|
const echoLines = (lines: string[]) =>
|
||||||
joinCommands(lines.map((line) => `echo ${line}`));
|
joinCommands(lines.map((line) => `echo ${line}`));
|
||||||
const normalizeText = (value?: string) =>
|
const normalizeText = (value?: string) =>
|
||||||
(value ?? "")
|
sanitizeBinaryOutput(value ?? "")
|
||||||
.replace(/\r\n/g, "\n")
|
.replace(/\r\n/g, "\n")
|
||||||
.replace(/\r/g, "\n")
|
.replace(/\r/g, "\n")
|
||||||
.replace(/[\u0000-\u0008\u000b\u000c\u000e-\u001f\u007f]/g, "")
|
|
||||||
.split("\n")
|
.split("\n")
|
||||||
.map((line) => line.replace(/\s+$/u, ""))
|
.map((line) => line.replace(/\s+$/u, ""))
|
||||||
.join("\n")
|
.join("\n")
|
||||||
|
|||||||
@@ -424,8 +424,42 @@ export async function scanOpenRouterModels(
|
|||||||
filtered,
|
filtered,
|
||||||
concurrency,
|
concurrency,
|
||||||
async (entry) => {
|
async (entry) => {
|
||||||
const isFree = isFreeOpenRouterModel(entry);
|
const isFree = isFreeOpenRouterModel(entry);
|
||||||
if (!probe) {
|
if (!probe) {
|
||||||
|
return {
|
||||||
|
id: entry.id,
|
||||||
|
name: entry.name,
|
||||||
|
provider: "openrouter",
|
||||||
|
modelRef: `openrouter/${entry.id}`,
|
||||||
|
contextLength: entry.contextLength,
|
||||||
|
maxCompletionTokens: entry.maxCompletionTokens,
|
||||||
|
supportedParametersCount: entry.supportedParametersCount,
|
||||||
|
supportsToolsMeta: entry.supportsToolsMeta,
|
||||||
|
modality: entry.modality,
|
||||||
|
inferredParamB: entry.inferredParamB,
|
||||||
|
createdAtMs: entry.createdAtMs,
|
||||||
|
pricing: entry.pricing,
|
||||||
|
isFree,
|
||||||
|
tool: { ok: false, latencyMs: null, skipped: true },
|
||||||
|
image: { ok: false, latencyMs: null, skipped: true },
|
||||||
|
} satisfies ModelScanResult;
|
||||||
|
}
|
||||||
|
|
||||||
|
const model: OpenAIModel = {
|
||||||
|
...baseModel,
|
||||||
|
id: entry.id,
|
||||||
|
name: entry.name || entry.id,
|
||||||
|
contextWindow: entry.contextLength ?? baseModel.contextWindow,
|
||||||
|
maxTokens: entry.maxCompletionTokens ?? baseModel.maxTokens,
|
||||||
|
input: parseModality(entry.modality),
|
||||||
|
reasoning: baseModel.reasoning,
|
||||||
|
};
|
||||||
|
|
||||||
|
const toolResult = await probeTool(model, apiKey, timeoutMs);
|
||||||
|
const imageResult = model.input.includes("image")
|
||||||
|
? await probeImage(ensureImageInput(model), apiKey, timeoutMs)
|
||||||
|
: { ok: false, latencyMs: null, skipped: true };
|
||||||
|
|
||||||
return {
|
return {
|
||||||
id: entry.id,
|
id: entry.id,
|
||||||
name: entry.name,
|
name: entry.name,
|
||||||
@@ -440,44 +474,10 @@ export async function scanOpenRouterModels(
|
|||||||
createdAtMs: entry.createdAtMs,
|
createdAtMs: entry.createdAtMs,
|
||||||
pricing: entry.pricing,
|
pricing: entry.pricing,
|
||||||
isFree,
|
isFree,
|
||||||
tool: { ok: false, latencyMs: null, skipped: true },
|
tool: toolResult,
|
||||||
image: { ok: false, latencyMs: null, skipped: true },
|
image: imageResult,
|
||||||
} satisfies ModelScanResult;
|
} satisfies ModelScanResult;
|
||||||
}
|
},
|
||||||
|
|
||||||
const model: OpenAIModel = {
|
|
||||||
...baseModel,
|
|
||||||
id: entry.id,
|
|
||||||
name: entry.name || entry.id,
|
|
||||||
contextWindow: entry.contextLength ?? baseModel.contextWindow,
|
|
||||||
maxTokens: entry.maxCompletionTokens ?? baseModel.maxTokens,
|
|
||||||
input: parseModality(entry.modality),
|
|
||||||
reasoning: baseModel.reasoning,
|
|
||||||
};
|
|
||||||
|
|
||||||
const toolResult = await probeTool(model, apiKey, timeoutMs);
|
|
||||||
const imageResult = model.input.includes("image")
|
|
||||||
? await probeImage(ensureImageInput(model), apiKey, timeoutMs)
|
|
||||||
: { ok: false, latencyMs: null, skipped: true };
|
|
||||||
|
|
||||||
return {
|
|
||||||
id: entry.id,
|
|
||||||
name: entry.name,
|
|
||||||
provider: "openrouter",
|
|
||||||
modelRef: `openrouter/${entry.id}`,
|
|
||||||
contextLength: entry.contextLength,
|
|
||||||
maxCompletionTokens: entry.maxCompletionTokens,
|
|
||||||
supportedParametersCount: entry.supportedParametersCount,
|
|
||||||
supportsToolsMeta: entry.supportsToolsMeta,
|
|
||||||
modality: entry.modality,
|
|
||||||
inferredParamB: entry.inferredParamB,
|
|
||||||
createdAtMs: entry.createdAtMs,
|
|
||||||
pricing: entry.pricing,
|
|
||||||
isFree,
|
|
||||||
tool: toolResult,
|
|
||||||
image: imageResult,
|
|
||||||
} satisfies ModelScanResult;
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
onProgress: (completed, total) =>
|
onProgress: (completed, total) =>
|
||||||
options.onProgress?.({
|
options.onProgress?.({
|
||||||
|
|||||||
@@ -26,4 +26,3 @@ describe("buildInboundMediaNote", () => {
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -18,16 +18,15 @@ function formatMediaAttachedLine(params: {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function buildInboundMediaNote(ctx: MsgContext): string | undefined {
|
export function buildInboundMediaNote(ctx: MsgContext): string | undefined {
|
||||||
const hasPathsArray =
|
|
||||||
Array.isArray(ctx.MediaPaths) && ctx.MediaPaths.length > 0;
|
|
||||||
const pathsFromArray = Array.isArray(ctx.MediaPaths)
|
const pathsFromArray = Array.isArray(ctx.MediaPaths)
|
||||||
? ctx.MediaPaths
|
? ctx.MediaPaths
|
||||||
: undefined;
|
: undefined;
|
||||||
const paths = pathsFromArray && pathsFromArray.length > 0
|
const paths =
|
||||||
? pathsFromArray
|
pathsFromArray && pathsFromArray.length > 0
|
||||||
: ctx.MediaPath?.trim()
|
? pathsFromArray
|
||||||
? [ctx.MediaPath.trim()]
|
: ctx.MediaPath?.trim()
|
||||||
: [];
|
? [ctx.MediaPath.trim()]
|
||||||
|
: [];
|
||||||
if (paths.length === 0) return undefined;
|
if (paths.length === 0) return undefined;
|
||||||
|
|
||||||
const urls =
|
const urls =
|
||||||
|
|||||||
@@ -11,7 +11,8 @@ vi.mock("../agents/pi-embedded.js", () => ({
|
|||||||
abortEmbeddedPiRun: vi.fn().mockReturnValue(false),
|
abortEmbeddedPiRun: vi.fn().mockReturnValue(false),
|
||||||
runEmbeddedPiAgent: vi.fn(),
|
runEmbeddedPiAgent: vi.fn(),
|
||||||
queueEmbeddedPiMessage: vi.fn().mockReturnValue(false),
|
queueEmbeddedPiMessage: vi.fn().mockReturnValue(false),
|
||||||
resolveEmbeddedSessionLane: (key: string) => `session:${key.trim() || "main"}`,
|
resolveEmbeddedSessionLane: (key: string) =>
|
||||||
|
`session:${key.trim() || "main"}`,
|
||||||
isEmbeddedPiRunActive: vi.fn().mockReturnValue(false),
|
isEmbeddedPiRunActive: vi.fn().mockReturnValue(false),
|
||||||
isEmbeddedPiRunStreaming: vi.fn().mockReturnValue(false),
|
isEmbeddedPiRunStreaming: vi.fn().mockReturnValue(false),
|
||||||
}));
|
}));
|
||||||
@@ -90,4 +91,3 @@ describe("getReplyFromConfig media note plumbing", () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ import {
|
|||||||
listChatCommands,
|
listChatCommands,
|
||||||
shouldHandleTextCommands,
|
shouldHandleTextCommands,
|
||||||
} from "./commands-registry.js";
|
} from "./commands-registry.js";
|
||||||
|
import { buildInboundMediaNote } from "./media-note.js";
|
||||||
import { getAbortMemory } from "./reply/abort.js";
|
import { getAbortMemory } from "./reply/abort.js";
|
||||||
import { runReplyAgent } from "./reply/agent-runner.js";
|
import { runReplyAgent } from "./reply/agent-runner.js";
|
||||||
import { resolveBlockStreamingChunking } from "./reply/block-streaming.js";
|
import { resolveBlockStreamingChunking } from "./reply/block-streaming.js";
|
||||||
@@ -80,7 +81,6 @@ import {
|
|||||||
import { SILENT_REPLY_TOKEN } from "./tokens.js";
|
import { SILENT_REPLY_TOKEN } from "./tokens.js";
|
||||||
import { isAudio, transcribeInboundAudio } from "./transcription.js";
|
import { isAudio, transcribeInboundAudio } from "./transcription.js";
|
||||||
import type { GetReplyOptions, ReplyPayload } from "./types.js";
|
import type { GetReplyOptions, ReplyPayload } from "./types.js";
|
||||||
import { buildInboundMediaNote } from "./media-note.js";
|
|
||||||
|
|
||||||
export {
|
export {
|
||||||
extractElevatedDirective,
|
extractElevatedDirective,
|
||||||
@@ -856,15 +856,17 @@ async function stageSandboxMedia(params: {
|
|||||||
workspaceDir: string;
|
workspaceDir: string;
|
||||||
}) {
|
}) {
|
||||||
const { ctx, sessionCtx, cfg, sessionKey, workspaceDir } = params;
|
const { ctx, sessionCtx, cfg, sessionKey, workspaceDir } = params;
|
||||||
const hasPathsArray = Array.isArray(ctx.MediaPaths) && ctx.MediaPaths.length > 0;
|
const hasPathsArray =
|
||||||
|
Array.isArray(ctx.MediaPaths) && ctx.MediaPaths.length > 0;
|
||||||
const pathsFromArray = Array.isArray(ctx.MediaPaths)
|
const pathsFromArray = Array.isArray(ctx.MediaPaths)
|
||||||
? ctx.MediaPaths
|
? ctx.MediaPaths
|
||||||
: undefined;
|
: undefined;
|
||||||
const rawPaths = pathsFromArray && pathsFromArray.length > 0
|
const rawPaths =
|
||||||
? pathsFromArray
|
pathsFromArray && pathsFromArray.length > 0
|
||||||
: ctx.MediaPath?.trim()
|
? pathsFromArray
|
||||||
? [ctx.MediaPath.trim()]
|
: ctx.MediaPath?.trim()
|
||||||
: [];
|
? [ctx.MediaPath.trim()]
|
||||||
|
: [];
|
||||||
if (rawPaths.length === 0 || !sessionKey) return;
|
if (rawPaths.length === 0 || !sessionKey) return;
|
||||||
|
|
||||||
const sandbox = await ensureSandboxWorkspaceForSession({
|
const sandbox = await ensureSandboxWorkspaceForSession({
|
||||||
|
|||||||
@@ -92,7 +92,6 @@ export const formatContextUsageShort = (
|
|||||||
contextTokens: number | null | undefined,
|
contextTokens: number | null | undefined,
|
||||||
) => `Context ${formatTokens(total, contextTokens ?? null)}`;
|
) => `Context ${formatTokens(total, contextTokens ?? null)}`;
|
||||||
|
|
||||||
|
|
||||||
const formatQueueDetails = (queue?: QueueStatus) => {
|
const formatQueueDetails = (queue?: QueueStatus) => {
|
||||||
if (!queue) return "";
|
if (!queue) return "";
|
||||||
const depth = typeof queue.depth === "number" ? `depth ${queue.depth}` : null;
|
const depth = typeof queue.depth === "number" ? `depth ${queue.depth}` : null;
|
||||||
|
|||||||
@@ -33,10 +33,7 @@ export function formatCliBannerLine(
|
|||||||
return `${title} ${version} (${commitLabel}) — ${tagline}`;
|
return `${title} ${version} (${commitLabel}) — ${tagline}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function emitCliBanner(
|
export function emitCliBanner(version: string, options: BannerOptions = {}) {
|
||||||
version: string,
|
|
||||||
options: BannerOptions = {},
|
|
||||||
) {
|
|
||||||
if (bannerEmitted) return;
|
if (bannerEmitted) return;
|
||||||
const argv = options.argv ?? process.argv;
|
const argv = options.argv ?? process.argv;
|
||||||
if (!process.stdout.isTTY) return;
|
if (!process.stdout.isTTY) return;
|
||||||
|
|||||||
@@ -3,12 +3,12 @@ import fs from "node:fs/promises";
|
|||||||
import type { Command } from "commander";
|
import type { Command } from "commander";
|
||||||
import { callGateway, randomIdempotencyKey } from "../gateway/call.js";
|
import { callGateway, randomIdempotencyKey } from "../gateway/call.js";
|
||||||
import { defaultRuntime } from "../runtime.js";
|
import { defaultRuntime } from "../runtime.js";
|
||||||
import { withProgress } from "./progress.js";
|
|
||||||
import { writeBase64ToFile } from "./nodes-camera.js";
|
import { writeBase64ToFile } from "./nodes-camera.js";
|
||||||
import {
|
import {
|
||||||
canvasSnapshotTempPath,
|
canvasSnapshotTempPath,
|
||||||
parseCanvasSnapshotPayload,
|
parseCanvasSnapshotPayload,
|
||||||
} from "./nodes-canvas.js";
|
} from "./nodes-canvas.js";
|
||||||
|
import { withProgress } from "./progress.js";
|
||||||
|
|
||||||
type CanvasOpts = {
|
type CanvasOpts = {
|
||||||
url?: string;
|
url?: string;
|
||||||
|
|||||||
@@ -160,8 +160,7 @@ function printCronList(jobs: CronJob[], runtime = defaultRuntime) {
|
|||||||
const targetLabel = pad(job.sessionTarget, CRON_TARGET_PAD);
|
const targetLabel = pad(job.sessionTarget, CRON_TARGET_PAD);
|
||||||
|
|
||||||
const coloredStatus = (() => {
|
const coloredStatus = (() => {
|
||||||
if (statusRaw === "ok")
|
if (statusRaw === "ok") return colorize(rich, theme.success, statusLabel);
|
||||||
return colorize(rich, theme.success, statusLabel);
|
|
||||||
if (statusRaw === "error")
|
if (statusRaw === "error")
|
||||||
return colorize(rich, theme.error, statusLabel);
|
return colorize(rich, theme.error, statusLabel);
|
||||||
if (statusRaw === "running")
|
if (statusRaw === "running")
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
import type { Command } from "commander";
|
import type { Command } from "commander";
|
||||||
import { callGateway, randomIdempotencyKey } from "../gateway/call.js";
|
import { callGateway, randomIdempotencyKey } from "../gateway/call.js";
|
||||||
import { defaultRuntime } from "../runtime.js";
|
import { defaultRuntime } from "../runtime.js";
|
||||||
import { withProgress } from "./progress.js";
|
|
||||||
import {
|
import {
|
||||||
type CameraFacing,
|
type CameraFacing,
|
||||||
cameraTempPath,
|
cameraTempPath,
|
||||||
@@ -20,6 +19,7 @@ import {
|
|||||||
writeScreenRecordToFile,
|
writeScreenRecordToFile,
|
||||||
} from "./nodes-screen.js";
|
} from "./nodes-screen.js";
|
||||||
import { parseDurationMs } from "./parse-duration.js";
|
import { parseDurationMs } from "./parse-duration.js";
|
||||||
|
import { withProgress } from "./progress.js";
|
||||||
|
|
||||||
type NodesRpcOpts = {
|
type NodesRpcOpts = {
|
||||||
url?: string;
|
url?: string;
|
||||||
|
|||||||
@@ -26,8 +26,10 @@ import { danger, setVerbose } from "../globals.js";
|
|||||||
import { autoMigrateLegacyState } from "../infra/state-migrations.js";
|
import { autoMigrateLegacyState } from "../infra/state-migrations.js";
|
||||||
import { loginWeb, logoutWeb } from "../provider-web.js";
|
import { loginWeb, logoutWeb } from "../provider-web.js";
|
||||||
import { defaultRuntime } from "../runtime.js";
|
import { defaultRuntime } from "../runtime.js";
|
||||||
|
import { isRich, theme } from "../terminal/theme.js";
|
||||||
import { VERSION } from "../version.js";
|
import { VERSION } from "../version.js";
|
||||||
import { resolveWhatsAppAccount } from "../web/accounts.js";
|
import { resolveWhatsAppAccount } from "../web/accounts.js";
|
||||||
|
import { emitCliBanner, formatCliBannerLine } from "./banner.js";
|
||||||
import { registerBrowserCli } from "./browser-cli.js";
|
import { registerBrowserCli } from "./browser-cli.js";
|
||||||
import { registerCanvasCli } from "./canvas-cli.js";
|
import { registerCanvasCli } from "./canvas-cli.js";
|
||||||
import { hasExplicitOptions } from "./command-options.js";
|
import { hasExplicitOptions } from "./command-options.js";
|
||||||
@@ -45,8 +47,6 @@ import { forceFreePort } from "./ports.js";
|
|||||||
import { registerProvidersCli } from "./providers-cli.js";
|
import { registerProvidersCli } from "./providers-cli.js";
|
||||||
import { registerTelegramCli } from "./telegram-cli.js";
|
import { registerTelegramCli } from "./telegram-cli.js";
|
||||||
import { registerTuiCli } from "./tui-cli.js";
|
import { registerTuiCli } from "./tui-cli.js";
|
||||||
import { emitCliBanner, formatCliBannerLine } from "./banner.js";
|
|
||||||
import { isRich, theme } from "../terminal/theme.js";
|
|
||||||
|
|
||||||
export { forceFreePort };
|
export { forceFreePort };
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,5 @@
|
|||||||
import { spinner } from "@clack/prompts";
|
import { spinner } from "@clack/prompts";
|
||||||
import {
|
import { createOscProgressController, supportsOscProgress } from "osc-progress";
|
||||||
createOscProgressController,
|
|
||||||
supportsOscProgress,
|
|
||||||
} from "osc-progress";
|
|
||||||
|
|
||||||
import { theme } from "../terminal/theme.js";
|
import { theme } from "../terminal/theme.js";
|
||||||
|
|
||||||
@@ -44,11 +41,12 @@ export function createCliProgress(options: ProgressOptions): ProgressReporter {
|
|||||||
typeof options.delayMs === "number" ? options.delayMs : DEFAULT_DELAY_MS;
|
typeof options.delayMs === "number" ? options.delayMs : DEFAULT_DELAY_MS;
|
||||||
const canOsc = supportsOscProgress(process.env, stream.isTTY);
|
const canOsc = supportsOscProgress(process.env, stream.isTTY);
|
||||||
const allowSpinner =
|
const allowSpinner =
|
||||||
!canOsc && (options.fallback === undefined || options.fallback === "spinner");
|
!canOsc &&
|
||||||
|
(options.fallback === undefined || options.fallback === "spinner");
|
||||||
|
|
||||||
let started = false;
|
let started = false;
|
||||||
let label = options.label;
|
let label = options.label;
|
||||||
let total = options.total ?? null;
|
const total = options.total ?? null;
|
||||||
let completed = 0;
|
let completed = 0;
|
||||||
let percent = 0;
|
let percent = 0;
|
||||||
let indeterminate =
|
let indeterminate =
|
||||||
@@ -103,8 +101,7 @@ export function createCliProgress(options: ProgressOptions): ProgressReporter {
|
|||||||
const tick = (delta = 1) => {
|
const tick = (delta = 1) => {
|
||||||
if (!total) return;
|
if (!total) return;
|
||||||
completed = Math.min(total, completed + delta);
|
completed = Math.min(total, completed + delta);
|
||||||
const nextPercent =
|
const nextPercent = total > 0 ? Math.round((completed / total) * 100) : 0;
|
||||||
total > 0 ? Math.round((completed / total) * 100) : 0;
|
|
||||||
setPercent(nextPercent);
|
setPercent(nextPercent);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -22,7 +22,9 @@ export interface TaglineOptions {
|
|||||||
export function activeTaglines(options: TaglineOptions = {}): string[] {
|
export function activeTaglines(options: TaglineOptions = {}): string[] {
|
||||||
if (TAGLINES.length === 0) return [DEFAULT_TAGLINE];
|
if (TAGLINES.length === 0) return [DEFAULT_TAGLINE];
|
||||||
const today = options.now ? options.now() : new Date();
|
const today = options.now ? options.now() : new Date();
|
||||||
const filtered = TAGLINES.filter((tagline) => isTaglineActive(tagline, today));
|
const filtered = TAGLINES.filter((tagline) =>
|
||||||
|
isTaglineActive(tagline, today),
|
||||||
|
);
|
||||||
return filtered.length > 0 ? filtered : TAGLINES;
|
return filtered.length > 0 ? filtered : TAGLINES;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import type { CliDeps } from "../cli/deps.js";
|
import type { CliDeps } from "../cli/deps.js";
|
||||||
|
import { withProgress } from "../cli/progress.js";
|
||||||
import { loadConfig } from "../config/config.js";
|
import { loadConfig } from "../config/config.js";
|
||||||
import {
|
import {
|
||||||
loadSessionStore,
|
loadSessionStore,
|
||||||
@@ -7,7 +8,6 @@ import {
|
|||||||
} from "../config/sessions.js";
|
} from "../config/sessions.js";
|
||||||
import { callGateway, randomIdempotencyKey } from "../gateway/call.js";
|
import { callGateway, randomIdempotencyKey } from "../gateway/call.js";
|
||||||
import type { RuntimeEnv } from "../runtime.js";
|
import type { RuntimeEnv } from "../runtime.js";
|
||||||
import { withProgress } from "../cli/progress.js";
|
|
||||||
import { normalizeMessageProvider } from "../utils/message-provider.js";
|
import { normalizeMessageProvider } from "../utils/message-provider.js";
|
||||||
import { agentCommand } from "./agent.js";
|
import { agentCommand } from "./agent.js";
|
||||||
|
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ import {
|
|||||||
CODEX_CLI_PROFILE_ID,
|
CODEX_CLI_PROFILE_ID,
|
||||||
ensureAuthProfileStore,
|
ensureAuthProfileStore,
|
||||||
} from "../agents/auth-profiles.js";
|
} from "../agents/auth-profiles.js";
|
||||||
|
import { createCliProgress } from "../cli/progress.js";
|
||||||
import type { ClawdbotConfig } from "../config/config.js";
|
import type { ClawdbotConfig } from "../config/config.js";
|
||||||
import {
|
import {
|
||||||
CONFIG_PATH_CLAWDBOT,
|
CONFIG_PATH_CLAWDBOT,
|
||||||
@@ -31,7 +32,6 @@ import {
|
|||||||
import { GATEWAY_LAUNCH_AGENT_LABEL } from "../daemon/constants.js";
|
import { GATEWAY_LAUNCH_AGENT_LABEL } from "../daemon/constants.js";
|
||||||
import { resolveGatewayProgramArguments } from "../daemon/program-args.js";
|
import { resolveGatewayProgramArguments } from "../daemon/program-args.js";
|
||||||
import { resolveGatewayService } from "../daemon/service.js";
|
import { resolveGatewayService } from "../daemon/service.js";
|
||||||
import { createCliProgress } from "../cli/progress.js";
|
|
||||||
import { ensureControlUiAssetsBuilt } from "../infra/control-ui-assets.js";
|
import { ensureControlUiAssetsBuilt } from "../infra/control-ui-assets.js";
|
||||||
import type { RuntimeEnv } from "../runtime.js";
|
import type { RuntimeEnv } from "../runtime.js";
|
||||||
import { defaultRuntime } from "../runtime.js";
|
import { defaultRuntime } from "../runtime.js";
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
|
import { withProgress } from "../cli/progress.js";
|
||||||
import { loadConfig } from "../config/config.js";
|
import { loadConfig } from "../config/config.js";
|
||||||
import { loadSessionStore, resolveStorePath } from "../config/sessions.js";
|
import { loadSessionStore, resolveStorePath } from "../config/sessions.js";
|
||||||
import { type DiscordProbe, probeDiscord } from "../discord/probe.js";
|
import { type DiscordProbe, probeDiscord } from "../discord/probe.js";
|
||||||
import { buildGatewayConnectionDetails, callGateway } from "../gateway/call.js";
|
import { buildGatewayConnectionDetails, callGateway } from "../gateway/call.js";
|
||||||
import { info } from "../globals.js";
|
import { info } from "../globals.js";
|
||||||
import type { RuntimeEnv } from "../runtime.js";
|
import type { RuntimeEnv } from "../runtime.js";
|
||||||
import { withProgress } from "../cli/progress.js";
|
|
||||||
import { probeTelegram, type TelegramProbe } from "../telegram/probe.js";
|
import { probeTelegram, type TelegramProbe } from "../telegram/probe.js";
|
||||||
import { resolveTelegramToken } from "../telegram/token.js";
|
import { resolveTelegramToken } from "../telegram/token.js";
|
||||||
import { resolveWhatsAppAccount } from "../web/accounts.js";
|
import { resolveWhatsAppAccount } from "../web/accounts.js";
|
||||||
|
|||||||
@@ -35,7 +35,11 @@ import {
|
|||||||
shouldEnableShellEnvFallback,
|
shouldEnableShellEnvFallback,
|
||||||
} from "../../infra/shell-env.js";
|
} from "../../infra/shell-env.js";
|
||||||
import type { RuntimeEnv } from "../../runtime.js";
|
import type { RuntimeEnv } from "../../runtime.js";
|
||||||
import { colorize, isRich as isRichTerminal, theme } from "../../terminal/theme.js";
|
import {
|
||||||
|
colorize,
|
||||||
|
isRich as isRichTerminal,
|
||||||
|
theme,
|
||||||
|
} from "../../terminal/theme.js";
|
||||||
import { shortenHomePath } from "../../utils.js";
|
import { shortenHomePath } from "../../utils.js";
|
||||||
import {
|
import {
|
||||||
DEFAULT_MODEL,
|
DEFAULT_MODEL,
|
||||||
@@ -69,8 +73,7 @@ const formatKeyValue = (
|
|||||||
valueColor: (value: string) => string = theme.info,
|
valueColor: (value: string) => string = theme.info,
|
||||||
) => `${formatKey(key, rich)}=${colorize(rich, valueColor, value)}`;
|
) => `${formatKey(key, rich)}=${colorize(rich, valueColor, value)}`;
|
||||||
|
|
||||||
const formatSeparator = (rich: boolean) =>
|
const formatSeparator = (rich: boolean) => colorize(rich, theme.muted, " | ");
|
||||||
colorize(rich, theme.muted, " | ");
|
|
||||||
|
|
||||||
const formatTag = (tag: string, rich: boolean) => {
|
const formatTag = (tag: string, rich: boolean) => {
|
||||||
if (!rich) return tag;
|
if (!rich) return tag;
|
||||||
@@ -468,7 +471,11 @@ function printModelTable(
|
|||||||
);
|
);
|
||||||
const coloredLocal = colorize(
|
const coloredLocal = colorize(
|
||||||
rich,
|
rich,
|
||||||
row.local === null ? theme.muted : row.local ? theme.success : theme.muted,
|
row.local === null
|
||||||
|
? theme.muted
|
||||||
|
: row.local
|
||||||
|
? theme.success
|
||||||
|
: theme.muted,
|
||||||
localLabel,
|
localLabel,
|
||||||
);
|
);
|
||||||
const coloredAuth = colorize(
|
const coloredAuth = colorize(
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import type { CliDeps } from "../cli/deps.js";
|
import type { CliDeps } from "../cli/deps.js";
|
||||||
|
import { withProgress } from "../cli/progress.js";
|
||||||
import { callGateway, randomIdempotencyKey } from "../gateway/call.js";
|
import { callGateway, randomIdempotencyKey } from "../gateway/call.js";
|
||||||
import { success } from "../globals.js";
|
import { success } from "../globals.js";
|
||||||
import { buildOutboundResultEnvelope } from "../infra/outbound/envelope.js";
|
import { buildOutboundResultEnvelope } from "../infra/outbound/envelope.js";
|
||||||
@@ -8,7 +9,6 @@ import {
|
|||||||
} from "../infra/outbound/format.js";
|
} from "../infra/outbound/format.js";
|
||||||
import { normalizePollInput, type PollInput } from "../polls.js";
|
import { normalizePollInput, type PollInput } from "../polls.js";
|
||||||
import type { RuntimeEnv } from "../runtime.js";
|
import type { RuntimeEnv } from "../runtime.js";
|
||||||
import { withProgress } from "../cli/progress.js";
|
|
||||||
|
|
||||||
function parseIntOption(value: unknown, label: string): number | undefined {
|
function parseIntOption(value: unknown, label: string): number | undefined {
|
||||||
if (value === undefined || value === null) return undefined;
|
if (value === undefined || value === null) return undefined;
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import type { CliDeps } from "../cli/deps.js";
|
import type { CliDeps } from "../cli/deps.js";
|
||||||
|
import { withProgress } from "../cli/progress.js";
|
||||||
import { loadConfig } from "../config/config.js";
|
import { loadConfig } from "../config/config.js";
|
||||||
import { callGateway, randomIdempotencyKey } from "../gateway/call.js";
|
import { callGateway, randomIdempotencyKey } from "../gateway/call.js";
|
||||||
import { success } from "../globals.js";
|
import { success } from "../globals.js";
|
||||||
@@ -11,7 +12,6 @@ import {
|
|||||||
} from "../infra/outbound/format.js";
|
} from "../infra/outbound/format.js";
|
||||||
import { resolveOutboundTarget } from "../infra/outbound/targets.js";
|
import { resolveOutboundTarget } from "../infra/outbound/targets.js";
|
||||||
import type { RuntimeEnv } from "../runtime.js";
|
import type { RuntimeEnv } from "../runtime.js";
|
||||||
import { withProgress } from "../cli/progress.js";
|
|
||||||
import { normalizeMessageProvider } from "../utils/message-provider.js";
|
import { normalizeMessageProvider } from "../utils/message-provider.js";
|
||||||
|
|
||||||
export async function sendCommand(
|
export async function sendCommand(
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import {
|
|||||||
DEFAULT_PROVIDER,
|
DEFAULT_PROVIDER,
|
||||||
} from "../agents/defaults.js";
|
} from "../agents/defaults.js";
|
||||||
import { resolveConfiguredModelRef } from "../agents/model-selection.js";
|
import { resolveConfiguredModelRef } from "../agents/model-selection.js";
|
||||||
|
import { withProgress } from "../cli/progress.js";
|
||||||
import { loadConfig } from "../config/config.js";
|
import { loadConfig } from "../config/config.js";
|
||||||
import {
|
import {
|
||||||
loadSessionStore,
|
loadSessionStore,
|
||||||
@@ -18,7 +19,6 @@ import {
|
|||||||
formatUsageReportLines,
|
formatUsageReportLines,
|
||||||
loadProviderUsageSummary,
|
loadProviderUsageSummary,
|
||||||
} from "../infra/provider-usage.js";
|
} from "../infra/provider-usage.js";
|
||||||
import { withProgress } from "../cli/progress.js";
|
|
||||||
import { peekSystemEvents } from "../infra/system-events.js";
|
import { peekSystemEvents } from "../infra/system-events.js";
|
||||||
import type { RuntimeEnv } from "../runtime.js";
|
import type { RuntimeEnv } from "../runtime.js";
|
||||||
import { resolveWhatsAppAccount } from "../web/accounts.js";
|
import { resolveWhatsAppAccount } from "../web/accounts.js";
|
||||||
|
|||||||
@@ -37,10 +37,9 @@ const resolveGitHead = (startDir: string) => {
|
|||||||
|
|
||||||
let cachedCommit: string | null | undefined;
|
let cachedCommit: string | null | undefined;
|
||||||
|
|
||||||
export const resolveCommitHash = (options: {
|
export const resolveCommitHash = (
|
||||||
cwd?: string;
|
options: { cwd?: string; env?: NodeJS.ProcessEnv } = {},
|
||||||
env?: NodeJS.ProcessEnv;
|
) => {
|
||||||
} = {}) => {
|
|
||||||
if (cachedCommit !== undefined) return cachedCommit;
|
if (cachedCommit !== undefined) return cachedCommit;
|
||||||
const env = options.env ?? process.env;
|
const env = options.env ?? process.env;
|
||||||
const envCommit = env.GIT_COMMIT?.trim() || env.GIT_SHA?.trim();
|
const envCommit = env.GIT_COMMIT?.trim() || env.GIT_SHA?.trim();
|
||||||
|
|||||||
@@ -11,11 +11,10 @@ import {
|
|||||||
spinner,
|
spinner,
|
||||||
text,
|
text,
|
||||||
} from "@clack/prompts";
|
} from "@clack/prompts";
|
||||||
|
|
||||||
import type { WizardProgress, WizardPrompter } from "./prompts.js";
|
|
||||||
import { WizardCancelledError } from "./prompts.js";
|
|
||||||
import { createCliProgress } from "../cli/progress.js";
|
import { createCliProgress } from "../cli/progress.js";
|
||||||
import { theme } from "../terminal/theme.js";
|
import { theme } from "../terminal/theme.js";
|
||||||
|
import type { WizardProgress, WizardPrompter } from "./prompts.js";
|
||||||
|
import { WizardCancelledError } from "./prompts.js";
|
||||||
|
|
||||||
function guardCancel<T>(value: T | symbol): T {
|
function guardCancel<T>(value: T | symbol): T {
|
||||||
if (isCancel(value)) {
|
if (isCancel(value)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user