style: fix lint formatting
This commit is contained in:
@@ -66,7 +66,14 @@ describe("createClawdbotCodingTools", () => {
|
|||||||
|
|
||||||
it("preserves action enums in normalized schemas", () => {
|
it("preserves action enums in normalized schemas", () => {
|
||||||
const tools = createClawdbotCodingTools();
|
const tools = createClawdbotCodingTools();
|
||||||
const toolNames = ["browser", "canvas", "nodes", "cron", "gateway", "message"];
|
const toolNames = [
|
||||||
|
"browser",
|
||||||
|
"canvas",
|
||||||
|
"nodes",
|
||||||
|
"cron",
|
||||||
|
"gateway",
|
||||||
|
"message",
|
||||||
|
];
|
||||||
|
|
||||||
const collectActionValues = (
|
const collectActionValues = (
|
||||||
schema: unknown,
|
schema: unknown,
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
import { Type } from "@sinclair/typebox";
|
import { Type } from "@sinclair/typebox";
|
||||||
|
|
||||||
import {
|
import {
|
||||||
sendMessage,
|
|
||||||
sendPoll,
|
|
||||||
type MessagePollResult,
|
type MessagePollResult,
|
||||||
type MessageSendResult,
|
type MessageSendResult,
|
||||||
|
sendMessage,
|
||||||
|
sendPoll,
|
||||||
} from "../../infra/outbound/message.js";
|
} from "../../infra/outbound/message.js";
|
||||||
import type { AnyAgentTool } from "./common.js";
|
import type { AnyAgentTool } from "./common.js";
|
||||||
import {
|
import {
|
||||||
@@ -64,7 +64,9 @@ export function createMessageTool(): AnyAgentTool {
|
|||||||
const gifPlayback =
|
const gifPlayback =
|
||||||
typeof params.gifPlayback === "boolean" ? params.gifPlayback : false;
|
typeof params.gifPlayback === "boolean" ? params.gifPlayback : false;
|
||||||
const bestEffort =
|
const bestEffort =
|
||||||
typeof params.bestEffort === "boolean" ? params.bestEffort : undefined;
|
typeof params.bestEffort === "boolean"
|
||||||
|
? params.bestEffort
|
||||||
|
: undefined;
|
||||||
|
|
||||||
const result: MessageSendResult = await sendMessage({
|
const result: MessageSendResult = await sendMessage({
|
||||||
to,
|
to,
|
||||||
@@ -82,7 +84,9 @@ export function createMessageTool(): AnyAgentTool {
|
|||||||
|
|
||||||
if (action === "poll") {
|
if (action === "poll") {
|
||||||
const to = readStringParam(params, "to", { required: true });
|
const to = readStringParam(params, "to", { required: true });
|
||||||
const question = readStringParam(params, "question", { required: true });
|
const question = readStringParam(params, "question", {
|
||||||
|
required: true,
|
||||||
|
});
|
||||||
const options =
|
const options =
|
||||||
readStringArrayParam(params, "options", { required: true }) ?? [];
|
readStringArrayParam(params, "options", { required: true }) ?? [];
|
||||||
const maxSelections = readNumberParam(params, "maxSelections", {
|
const maxSelections = readNumberParam(params, "maxSelections", {
|
||||||
|
|||||||
@@ -138,7 +138,9 @@ describe("gateway-cli coverage", () => {
|
|||||||
program.exitOverride();
|
program.exitOverride();
|
||||||
registerGatewayCli(program);
|
registerGatewayCli(program);
|
||||||
|
|
||||||
await program.parseAsync(["gateway", "discover", "--json"], { from: "user" });
|
await program.parseAsync(["gateway", "discover", "--json"], {
|
||||||
|
from: "user",
|
||||||
|
});
|
||||||
|
|
||||||
expect(discoverGatewayBeacons).toHaveBeenCalledTimes(1);
|
expect(discoverGatewayBeacons).toHaveBeenCalledTimes(1);
|
||||||
expect(runtimeLogs.join("\n")).toContain('"beacons"');
|
expect(runtimeLogs.join("\n")).toContain('"beacons"');
|
||||||
|
|||||||
@@ -48,9 +48,12 @@ describe("cli program", () => {
|
|||||||
|
|
||||||
it("runs message send with required options", async () => {
|
it("runs message send with required options", async () => {
|
||||||
const program = buildProgram();
|
const program = buildProgram();
|
||||||
await program.parseAsync(["message", "send", "--to", "+1", "--message", "hi"], {
|
await program.parseAsync(
|
||||||
|
["message", "send", "--to", "+1", "--message", "hi"],
|
||||||
|
{
|
||||||
from: "user",
|
from: "user",
|
||||||
});
|
},
|
||||||
|
);
|
||||||
expect(messageSendCommand).toHaveBeenCalled();
|
expect(messageSendCommand).toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -8,8 +8,8 @@ import {
|
|||||||
import { configureCommand } from "../commands/configure.js";
|
import { configureCommand } from "../commands/configure.js";
|
||||||
import { doctorCommand } from "../commands/doctor.js";
|
import { doctorCommand } from "../commands/doctor.js";
|
||||||
import { healthCommand } from "../commands/health.js";
|
import { healthCommand } from "../commands/health.js";
|
||||||
import { onboardCommand } from "../commands/onboard.js";
|
|
||||||
import { messagePollCommand, messageSendCommand } from "../commands/message.js";
|
import { messagePollCommand, messageSendCommand } from "../commands/message.js";
|
||||||
|
import { onboardCommand } from "../commands/onboard.js";
|
||||||
import { sessionsCommand } from "../commands/sessions.js";
|
import { sessionsCommand } from "../commands/sessions.js";
|
||||||
import { setupCommand } from "../commands/setup.js";
|
import { setupCommand } from "../commands/setup.js";
|
||||||
import { statusCommand } from "../commands/status.js";
|
import { statusCommand } from "../commands/status.js";
|
||||||
|
|||||||
@@ -9,10 +9,10 @@ import {
|
|||||||
formatOutboundDeliverySummary,
|
formatOutboundDeliverySummary,
|
||||||
} from "../infra/outbound/format.js";
|
} from "../infra/outbound/format.js";
|
||||||
import {
|
import {
|
||||||
sendMessage,
|
|
||||||
sendPoll,
|
|
||||||
type MessagePollResult,
|
type MessagePollResult,
|
||||||
type MessageSendResult,
|
type MessageSendResult,
|
||||||
|
sendMessage,
|
||||||
|
sendPoll,
|
||||||
} from "../infra/outbound/message.js";
|
} from "../infra/outbound/message.js";
|
||||||
import type { RuntimeEnv } from "../runtime.js";
|
import type { RuntimeEnv } from "../runtime.js";
|
||||||
import { normalizeMessageProvider } from "../utils/message-provider.js";
|
import { normalizeMessageProvider } from "../utils/message-provider.js";
|
||||||
@@ -49,7 +49,11 @@ function parseIntOption(value: unknown, label: string): number | undefined {
|
|||||||
return parsed;
|
return parsed;
|
||||||
}
|
}
|
||||||
|
|
||||||
function logSendDryRun(opts: MessageSendOpts, provider: string, runtime: RuntimeEnv) {
|
function logSendDryRun(
|
||||||
|
opts: MessageSendOpts,
|
||||||
|
provider: string,
|
||||||
|
runtime: RuntimeEnv,
|
||||||
|
) {
|
||||||
runtime.log(
|
runtime.log(
|
||||||
`[dry-run] would send via ${provider} -> ${opts.to}: ${opts.message}${
|
`[dry-run] would send via ${provider} -> ${opts.to}: ${opts.message}${
|
||||||
opts.media ? ` (media ${opts.media})` : ""
|
opts.media ? ` (media ${opts.media})` : ""
|
||||||
@@ -57,10 +61,7 @@ function logSendDryRun(opts: MessageSendOpts, provider: string, runtime: Runtime
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function logPollDryRun(
|
function logPollDryRun(result: MessagePollResult, runtime: RuntimeEnv) {
|
||||||
result: MessagePollResult,
|
|
||||||
runtime: RuntimeEnv,
|
|
||||||
) {
|
|
||||||
runtime.log(
|
runtime.log(
|
||||||
`[dry-run] would send poll via ${result.provider} -> ${result.to}:\n Question: ${result.question}\n Options: ${result.options.join(
|
`[dry-run] would send poll via ${result.provider} -> ${result.to}:\n Question: ${result.question}\n Options: ${result.options.join(
|
||||||
", ",
|
", ",
|
||||||
|
|||||||
@@ -1,14 +1,15 @@
|
|||||||
import { describe, expect, it, vi } from "vitest";
|
import { describe, expect, it, vi } from "vitest";
|
||||||
|
|
||||||
import type { runCommandWithTimeout } from "../process/exec.js";
|
import type { runCommandWithTimeout } from "../process/exec.js";
|
||||||
import { WIDE_AREA_DISCOVERY_DOMAIN } from "./widearea-dns.js";
|
|
||||||
import { discoverGatewayBeacons } from "./bonjour-discovery.js";
|
import { discoverGatewayBeacons } from "./bonjour-discovery.js";
|
||||||
|
import { WIDE_AREA_DISCOVERY_DOMAIN } from "./widearea-dns.js";
|
||||||
|
|
||||||
describe("bonjour-discovery", () => {
|
describe("bonjour-discovery", () => {
|
||||||
it("discovers beacons on darwin across local + wide-area domains", async () => {
|
it("discovers beacons on darwin across local + wide-area domains", async () => {
|
||||||
const calls: Array<{ argv: string[]; timeoutMs: number }> = [];
|
const calls: Array<{ argv: string[]; timeoutMs: number }> = [];
|
||||||
|
|
||||||
const run = vi.fn(async (argv: string[], options: { timeoutMs: number }) => {
|
const run = vi.fn(
|
||||||
|
async (argv: string[], options: { timeoutMs: number }) => {
|
||||||
calls.push({ argv, timeoutMs: options.timeoutMs });
|
calls.push({ argv, timeoutMs: options.timeoutMs });
|
||||||
const domain = argv[3] ?? "";
|
const domain = argv[3] ?? "";
|
||||||
|
|
||||||
@@ -74,7 +75,8 @@ describe("bonjour-discovery", () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
throw new Error(`unexpected argv: ${argv.join(" ")}`);
|
throw new Error(`unexpected argv: ${argv.join(" ")}`);
|
||||||
});
|
},
|
||||||
|
);
|
||||||
|
|
||||||
const beacons = await discoverGatewayBeacons({
|
const beacons = await discoverGatewayBeacons({
|
||||||
platform: "darwin",
|
platform: "darwin",
|
||||||
|
|||||||
Reference in New Issue
Block a user