style: biome formatting
This commit is contained in:
@@ -43,7 +43,6 @@ import {
|
|||||||
createClawdisCodingTools,
|
createClawdisCodingTools,
|
||||||
sanitizeContentBlocksImages,
|
sanitizeContentBlocksImages,
|
||||||
} from "./pi-tools.js";
|
} from "./pi-tools.js";
|
||||||
import { SteerableProviderTransport } from "./steerable-provider-transport.js";
|
|
||||||
import {
|
import {
|
||||||
applySkillEnvOverrides,
|
applySkillEnvOverrides,
|
||||||
applySkillEnvOverridesFromSnapshot,
|
applySkillEnvOverridesFromSnapshot,
|
||||||
@@ -51,6 +50,7 @@ import {
|
|||||||
loadWorkspaceSkillEntries,
|
loadWorkspaceSkillEntries,
|
||||||
type SkillSnapshot,
|
type SkillSnapshot,
|
||||||
} from "./skills.js";
|
} from "./skills.js";
|
||||||
|
import { SteerableProviderTransport } from "./steerable-provider-transport.js";
|
||||||
import { buildAgentSystemPrompt } from "./system-prompt.js";
|
import { buildAgentSystemPrompt } from "./system-prompt.js";
|
||||||
import { loadWorkspaceBootstrapFiles } from "./workspace.js";
|
import { loadWorkspaceBootstrapFiles } from "./workspace.js";
|
||||||
|
|
||||||
|
|||||||
@@ -1,18 +1,15 @@
|
|||||||
import {
|
import type {
|
||||||
agentLoop,
|
AgentRunConfig,
|
||||||
agentLoopContinue,
|
AgentTransport,
|
||||||
} from "./steerable-agent-loop.js";
|
ProviderTransportOptions,
|
||||||
|
} from "@mariozechner/pi-agent-core";
|
||||||
import type {
|
import type {
|
||||||
AgentContext,
|
AgentContext,
|
||||||
AgentLoopConfig,
|
AgentLoopConfig,
|
||||||
Message,
|
Message,
|
||||||
UserMessage,
|
UserMessage,
|
||||||
} from "@mariozechner/pi-ai";
|
} from "@mariozechner/pi-ai";
|
||||||
import type {
|
import { agentLoop, agentLoopContinue } from "./steerable-agent-loop.js";
|
||||||
AgentRunConfig,
|
|
||||||
AgentTransport,
|
|
||||||
} from "@mariozechner/pi-agent-core";
|
|
||||||
import type { ProviderTransportOptions } from "@mariozechner/pi-agent-core";
|
|
||||||
|
|
||||||
export class SteerableProviderTransport implements AgentTransport {
|
export class SteerableProviderTransport implements AgentTransport {
|
||||||
private options: ProviderTransportOptions;
|
private options: ProviderTransportOptions;
|
||||||
|
|||||||
@@ -759,7 +759,10 @@ export async function getReplyFromConfig(
|
|||||||
.join("\n\n")
|
.join("\n\n")
|
||||||
: baseBodyFinal;
|
: baseBodyFinal;
|
||||||
const queuedBody = mediaNote
|
const queuedBody = mediaNote
|
||||||
? [mediaNote, mediaReplyHint, queueBodyBase].filter(Boolean).join("\n").trim()
|
? [mediaNote, mediaReplyHint, queueBodyBase]
|
||||||
|
.filter(Boolean)
|
||||||
|
.join("\n")
|
||||||
|
.trim()
|
||||||
: queueBodyBase;
|
: queueBodyBase;
|
||||||
|
|
||||||
if (queueEmbeddedPiMessage(sessionIdFinal, queuedBody)) {
|
if (queueEmbeddedPiMessage(sessionIdFinal, queuedBody)) {
|
||||||
|
|||||||
@@ -1,17 +1,17 @@
|
|||||||
import { createServer } from "node:http";
|
|
||||||
import { type AddressInfo } from "node:net";
|
|
||||||
import fs from "node:fs/promises";
|
import fs from "node:fs/promises";
|
||||||
|
import { createServer } from "node:http";
|
||||||
|
import type { AddressInfo } from "node:net";
|
||||||
import os from "node:os";
|
import os from "node:os";
|
||||||
import path from "node:path";
|
import path from "node:path";
|
||||||
import { describe, expect, it } from "vitest";
|
import { describe, expect, it } from "vitest";
|
||||||
import { WebSocket } from "ws";
|
import { WebSocket } from "ws";
|
||||||
import { defaultRuntime } from "../runtime.js";
|
import { defaultRuntime } from "../runtime.js";
|
||||||
import { createCanvasHostHandler, startCanvasHost } from "./server.js";
|
|
||||||
import {
|
import {
|
||||||
CANVAS_HOST_PATH,
|
CANVAS_HOST_PATH,
|
||||||
CANVAS_WS_PATH,
|
CANVAS_WS_PATH,
|
||||||
injectCanvasLiveReload,
|
injectCanvasLiveReload,
|
||||||
} from "./a2ui.js";
|
} from "./a2ui.js";
|
||||||
|
import { createCanvasHostHandler, startCanvasHost } from "./server.js";
|
||||||
|
|
||||||
describe("canvas host", () => {
|
describe("canvas host", () => {
|
||||||
it("injects live reload script", () => {
|
it("injects live reload script", () => {
|
||||||
@@ -80,9 +80,7 @@ describe("canvas host", () => {
|
|||||||
const port = (server.address() as AddressInfo).port;
|
const port = (server.address() as AddressInfo).port;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const res = await fetch(
|
const res = await fetch(`http://127.0.0.1:${port}${CANVAS_HOST_PATH}/`);
|
||||||
`http://127.0.0.1:${port}${CANVAS_HOST_PATH}/`,
|
|
||||||
);
|
|
||||||
const html = await res.text();
|
const html = await res.text();
|
||||||
expect(res.status).toBe(200);
|
expect(res.status).toBe(200);
|
||||||
expect(html).toContain("v1");
|
expect(html).toContain("v1");
|
||||||
|
|||||||
@@ -48,7 +48,11 @@ export type CanvasHostHandler = {
|
|||||||
req: IncomingMessage,
|
req: IncomingMessage,
|
||||||
res: ServerResponse,
|
res: ServerResponse,
|
||||||
) => Promise<boolean>;
|
) => Promise<boolean>;
|
||||||
handleUpgrade: (req: IncomingMessage, socket: Socket, head: Buffer) => boolean;
|
handleUpgrade: (
|
||||||
|
req: IncomingMessage,
|
||||||
|
socket: Socket,
|
||||||
|
head: Buffer,
|
||||||
|
) => boolean;
|
||||||
close: () => Promise<void>;
|
close: () => Promise<void>;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -55,9 +55,9 @@ const bridgeListConnected = vi.hoisted(() =>
|
|||||||
vi.fn(() => [] as BridgeClientInfo[]),
|
vi.fn(() => [] as BridgeClientInfo[]),
|
||||||
);
|
);
|
||||||
const bridgeSendEvent = vi.hoisted(() => vi.fn());
|
const bridgeSendEvent = vi.hoisted(() => vi.fn());
|
||||||
const testTailnetIPv4 = vi.hoisted(
|
const testTailnetIPv4 = vi.hoisted(() => ({
|
||||||
() => ({ value: undefined as string | undefined }),
|
value: undefined as string | undefined,
|
||||||
);
|
}));
|
||||||
vi.mock("../infra/bridge/server.js", () => ({
|
vi.mock("../infra/bridge/server.js", () => ({
|
||||||
startNodeBridgeServer: vi.fn(async (opts: BridgeStartOpts) => {
|
startNodeBridgeServer: vi.fn(async (opts: BridgeStartOpts) => {
|
||||||
bridgeStartCalls.push(opts);
|
bridgeStartCalls.push(opts);
|
||||||
|
|||||||
@@ -18,7 +18,10 @@ import {
|
|||||||
normalizeThinkLevel,
|
normalizeThinkLevel,
|
||||||
normalizeVerboseLevel,
|
normalizeVerboseLevel,
|
||||||
} from "../auto-reply/thinking.js";
|
} from "../auto-reply/thinking.js";
|
||||||
import { handleA2uiHttpRequest, CANVAS_HOST_PATH } from "../canvas-host/a2ui.js";
|
import {
|
||||||
|
CANVAS_HOST_PATH,
|
||||||
|
handleA2uiHttpRequest,
|
||||||
|
} from "../canvas-host/a2ui.js";
|
||||||
import {
|
import {
|
||||||
type CanvasHostHandler,
|
type CanvasHostHandler,
|
||||||
createCanvasHostHandler,
|
createCanvasHostHandler,
|
||||||
@@ -2380,7 +2383,10 @@ export async function startGatewayServer(
|
|||||||
const remoteAddr = (
|
const remoteAddr = (
|
||||||
socket as WebSocket & { _socket?: { remoteAddress?: string } }
|
socket as WebSocket & { _socket?: { remoteAddress?: string } }
|
||||||
)._socket?.remoteAddress;
|
)._socket?.remoteAddress;
|
||||||
const canvasHostUrl = deriveCanvasHostUrl(req, canvasHost ? port : undefined);
|
const canvasHostUrl = deriveCanvasHostUrl(
|
||||||
|
req,
|
||||||
|
canvasHost ? port : undefined,
|
||||||
|
);
|
||||||
logWs("in", "open", { connId, remoteAddr });
|
logWs("in", "open", { connId, remoteAddr });
|
||||||
const isWebchatConnect = (params: ConnectParams | null | undefined) =>
|
const isWebchatConnect = (params: ConnectParams | null | undefined) =>
|
||||||
params?.client?.mode === "webchat" ||
|
params?.client?.mode === "webchat" ||
|
||||||
|
|||||||
Reference in New Issue
Block a user