chore: fix lint and typing
This commit is contained in:
@@ -1,11 +1,11 @@
|
|||||||
import { describe, expect, it } from "vitest";
|
import { describe, expect, it } from "vitest";
|
||||||
import { CURRENT_MESSAGE_MARKER } from "./mentions.js";
|
|
||||||
import {
|
import {
|
||||||
HISTORY_CONTEXT_MARKER,
|
|
||||||
appendHistoryEntry,
|
appendHistoryEntry,
|
||||||
buildHistoryContext,
|
buildHistoryContext,
|
||||||
buildHistoryContextFromEntries,
|
buildHistoryContextFromEntries,
|
||||||
|
HISTORY_CONTEXT_MARKER,
|
||||||
} from "./history.js";
|
} from "./history.js";
|
||||||
|
import { CURRENT_MESSAGE_MARKER } from "./mentions.js";
|
||||||
|
|
||||||
describe("history helpers", () => {
|
describe("history helpers", () => {
|
||||||
it("returns current message when history is empty", () => {
|
it("returns current message when history is empty", () => {
|
||||||
|
|||||||
@@ -51,9 +51,8 @@ export function buildHistoryContextFromEntries(params: {
|
|||||||
excludeLast?: boolean;
|
excludeLast?: boolean;
|
||||||
}): string {
|
}): string {
|
||||||
const lineBreak = params.lineBreak ?? "\n";
|
const lineBreak = params.lineBreak ?? "\n";
|
||||||
const entries = params.excludeLast === false
|
const entries =
|
||||||
? params.entries
|
params.excludeLast === false ? params.entries : params.entries.slice(0, -1);
|
||||||
: params.entries.slice(0, -1);
|
|
||||||
if (entries.length === 0) return params.currentMessage;
|
if (entries.length === 0) return params.currentMessage;
|
||||||
const historyText = entries.map(params.formatEntry).join(lineBreak);
|
const historyText = entries.map(params.formatEntry).join(lineBreak);
|
||||||
return buildHistoryContext({
|
return buildHistoryContext({
|
||||||
|
|||||||
@@ -34,15 +34,15 @@ import {
|
|||||||
formatThreadStarterEnvelope,
|
formatThreadStarterEnvelope,
|
||||||
} from "../auto-reply/envelope.js";
|
} from "../auto-reply/envelope.js";
|
||||||
import { dispatchReplyFromConfig } from "../auto-reply/reply/dispatch-from-config.js";
|
import { dispatchReplyFromConfig } from "../auto-reply/reply/dispatch-from-config.js";
|
||||||
import {
|
|
||||||
buildMentionRegexes,
|
|
||||||
matchesMentionPatterns,
|
|
||||||
} from "../auto-reply/reply/mentions.js";
|
|
||||||
import {
|
import {
|
||||||
appendHistoryEntry,
|
appendHistoryEntry,
|
||||||
buildHistoryContextFromEntries,
|
buildHistoryContextFromEntries,
|
||||||
type HistoryEntry,
|
type HistoryEntry,
|
||||||
} from "../auto-reply/reply/history.js";
|
} from "../auto-reply/reply/history.js";
|
||||||
|
import {
|
||||||
|
buildMentionRegexes,
|
||||||
|
matchesMentionPatterns,
|
||||||
|
} from "../auto-reply/reply/mentions.js";
|
||||||
import {
|
import {
|
||||||
createReplyDispatcher,
|
createReplyDispatcher,
|
||||||
createReplyDispatcherWithTyping,
|
createReplyDispatcherWithTyping,
|
||||||
|
|||||||
@@ -7,9 +7,9 @@ import { hasControlCommand } from "../auto-reply/command-detection.js";
|
|||||||
import { formatAgentEnvelope } from "../auto-reply/envelope.js";
|
import { formatAgentEnvelope } from "../auto-reply/envelope.js";
|
||||||
import { dispatchReplyFromConfig } from "../auto-reply/reply/dispatch-from-config.js";
|
import { dispatchReplyFromConfig } from "../auto-reply/reply/dispatch-from-config.js";
|
||||||
import {
|
import {
|
||||||
DEFAULT_GROUP_HISTORY_LIMIT,
|
|
||||||
appendHistoryEntry,
|
appendHistoryEntry,
|
||||||
buildHistoryContextFromEntries,
|
buildHistoryContextFromEntries,
|
||||||
|
DEFAULT_GROUP_HISTORY_LIMIT,
|
||||||
type HistoryEntry,
|
type HistoryEntry,
|
||||||
} from "../auto-reply/reply/history.js";
|
} from "../auto-reply/reply/history.js";
|
||||||
import {
|
import {
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
import { formatAgentEnvelope } from "../auto-reply/envelope.js";
|
import { formatAgentEnvelope } from "../auto-reply/envelope.js";
|
||||||
import { dispatchReplyFromConfig } from "../auto-reply/reply/dispatch-from-config.js";
|
import { dispatchReplyFromConfig } from "../auto-reply/reply/dispatch-from-config.js";
|
||||||
import {
|
import {
|
||||||
DEFAULT_GROUP_HISTORY_LIMIT,
|
|
||||||
appendHistoryEntry,
|
appendHistoryEntry,
|
||||||
buildHistoryContextFromEntries,
|
buildHistoryContextFromEntries,
|
||||||
|
DEFAULT_GROUP_HISTORY_LIMIT,
|
||||||
type HistoryEntry,
|
type HistoryEntry,
|
||||||
} from "../auto-reply/reply/history.js";
|
} from "../auto-reply/reply/history.js";
|
||||||
import type { ClawdbotConfig } from "../config/types.js";
|
import type { ClawdbotConfig } from "../config/types.js";
|
||||||
|
|||||||
@@ -6,9 +6,9 @@ import { chunkText, resolveTextChunkLimit } from "../auto-reply/chunk.js";
|
|||||||
import { formatAgentEnvelope } from "../auto-reply/envelope.js";
|
import { formatAgentEnvelope } from "../auto-reply/envelope.js";
|
||||||
import { dispatchReplyFromConfig } from "../auto-reply/reply/dispatch-from-config.js";
|
import { dispatchReplyFromConfig } from "../auto-reply/reply/dispatch-from-config.js";
|
||||||
import {
|
import {
|
||||||
DEFAULT_GROUP_HISTORY_LIMIT,
|
|
||||||
appendHistoryEntry,
|
appendHistoryEntry,
|
||||||
buildHistoryContextFromEntries,
|
buildHistoryContextFromEntries,
|
||||||
|
DEFAULT_GROUP_HISTORY_LIMIT,
|
||||||
type HistoryEntry,
|
type HistoryEntry,
|
||||||
} from "../auto-reply/reply/history.js";
|
} from "../auto-reply/reply/history.js";
|
||||||
import { createReplyDispatcher } from "../auto-reply/reply/reply-dispatcher.js";
|
import { createReplyDispatcher } from "../auto-reply/reply/reply-dispatcher.js";
|
||||||
|
|||||||
@@ -24,16 +24,16 @@ import {
|
|||||||
formatThreadStarterEnvelope,
|
formatThreadStarterEnvelope,
|
||||||
} from "../auto-reply/envelope.js";
|
} from "../auto-reply/envelope.js";
|
||||||
import { dispatchReplyFromConfig } from "../auto-reply/reply/dispatch-from-config.js";
|
import { dispatchReplyFromConfig } from "../auto-reply/reply/dispatch-from-config.js";
|
||||||
|
import {
|
||||||
|
appendHistoryEntry,
|
||||||
|
buildHistoryContextFromEntries,
|
||||||
|
DEFAULT_GROUP_HISTORY_LIMIT,
|
||||||
|
type HistoryEntry,
|
||||||
|
} from "../auto-reply/reply/history.js";
|
||||||
import {
|
import {
|
||||||
buildMentionRegexes,
|
buildMentionRegexes,
|
||||||
matchesMentionPatterns,
|
matchesMentionPatterns,
|
||||||
} from "../auto-reply/reply/mentions.js";
|
} from "../auto-reply/reply/mentions.js";
|
||||||
import {
|
|
||||||
DEFAULT_GROUP_HISTORY_LIMIT,
|
|
||||||
appendHistoryEntry,
|
|
||||||
buildHistoryContextFromEntries,
|
|
||||||
type HistoryEntry,
|
|
||||||
} from "../auto-reply/reply/history.js";
|
|
||||||
import { createReplyDispatcherWithTyping } from "../auto-reply/reply/reply-dispatcher.js";
|
import { createReplyDispatcherWithTyping } from "../auto-reply/reply/reply-dispatcher.js";
|
||||||
import { getReplyFromConfig } from "../auto-reply/reply.js";
|
import { getReplyFromConfig } from "../auto-reply/reply.js";
|
||||||
import { isSilentReplyText, SILENT_REPLY_TOKEN } from "../auto-reply/tokens.js";
|
import { isSilentReplyText, SILENT_REPLY_TOKEN } from "../auto-reply/tokens.js";
|
||||||
|
|||||||
@@ -20,16 +20,16 @@ import {
|
|||||||
} from "../auto-reply/commands-registry.js";
|
} from "../auto-reply/commands-registry.js";
|
||||||
import { formatAgentEnvelope } from "../auto-reply/envelope.js";
|
import { formatAgentEnvelope } from "../auto-reply/envelope.js";
|
||||||
import { resolveTelegramDraftStreamingChunking } from "../auto-reply/reply/block-streaming.js";
|
import { resolveTelegramDraftStreamingChunking } from "../auto-reply/reply/block-streaming.js";
|
||||||
|
import {
|
||||||
|
appendHistoryEntry,
|
||||||
|
buildHistoryContextFromEntries,
|
||||||
|
DEFAULT_GROUP_HISTORY_LIMIT,
|
||||||
|
type HistoryEntry,
|
||||||
|
} from "../auto-reply/reply/history.js";
|
||||||
import {
|
import {
|
||||||
buildMentionRegexes,
|
buildMentionRegexes,
|
||||||
matchesMentionPatterns,
|
matchesMentionPatterns,
|
||||||
} from "../auto-reply/reply/mentions.js";
|
} from "../auto-reply/reply/mentions.js";
|
||||||
import {
|
|
||||||
DEFAULT_GROUP_HISTORY_LIMIT,
|
|
||||||
appendHistoryEntry,
|
|
||||||
buildHistoryContextFromEntries,
|
|
||||||
type HistoryEntry,
|
|
||||||
} from "../auto-reply/reply/history.js";
|
|
||||||
import { dispatchReplyWithBufferedBlockDispatcher } from "../auto-reply/reply/provider-dispatcher.js";
|
import { dispatchReplyWithBufferedBlockDispatcher } from "../auto-reply/reply/provider-dispatcher.js";
|
||||||
import { getReplyFromConfig } from "../auto-reply/reply.js";
|
import { getReplyFromConfig } from "../auto-reply/reply.js";
|
||||||
import type { ReplyPayload } from "../auto-reply/types.js";
|
import type { ReplyPayload } from "../auto-reply/types.js";
|
||||||
|
|||||||
@@ -17,14 +17,14 @@ import {
|
|||||||
resolveHeartbeatPrompt,
|
resolveHeartbeatPrompt,
|
||||||
stripHeartbeatToken,
|
stripHeartbeatToken,
|
||||||
} from "../auto-reply/heartbeat.js";
|
} from "../auto-reply/heartbeat.js";
|
||||||
import {
|
|
||||||
buildMentionRegexes,
|
|
||||||
normalizeMentionText,
|
|
||||||
} from "../auto-reply/reply/mentions.js";
|
|
||||||
import {
|
import {
|
||||||
buildHistoryContext,
|
buildHistoryContext,
|
||||||
DEFAULT_GROUP_HISTORY_LIMIT,
|
DEFAULT_GROUP_HISTORY_LIMIT,
|
||||||
} from "../auto-reply/reply/history.js";
|
} from "../auto-reply/reply/history.js";
|
||||||
|
import {
|
||||||
|
buildMentionRegexes,
|
||||||
|
normalizeMentionText,
|
||||||
|
} from "../auto-reply/reply/mentions.js";
|
||||||
import { dispatchReplyWithBufferedBlockDispatcher } from "../auto-reply/reply/provider-dispatcher.js";
|
import { dispatchReplyWithBufferedBlockDispatcher } from "../auto-reply/reply/provider-dispatcher.js";
|
||||||
import { getReplyFromConfig } from "../auto-reply/reply.js";
|
import { getReplyFromConfig } from "../auto-reply/reply.js";
|
||||||
import { HEARTBEAT_TOKEN, SILENT_REPLY_TOKEN } from "../auto-reply/tokens.js";
|
import { HEARTBEAT_TOKEN, SILENT_REPLY_TOKEN } from "../auto-reply/tokens.js";
|
||||||
|
|||||||
Reference in New Issue
Block a user