docs: document utility helpers

This commit is contained in:
Peter Steinberger
2026-06-04 20:12:49 -04:00
parent b6ce59d367
commit ef08c83e17
29 changed files with 29 additions and 0 deletions

View File

@@ -1,3 +1,4 @@
// Account id helpers normalize routing account identifiers for utility callers.
import { normalizeOptionalAccountId } from "../routing/account-id.js";
/**

View File

@@ -1,3 +1,4 @@
// Boolean utility helpers normalize string-like boolean inputs.
import { normalizeOptionalLowercaseString } from "@openclaw/normalization-core/string-coerce";
/**

View File

@@ -1,3 +1,4 @@
// CJK character tests cover detection and width handling for CJK text.
import { describe, expect, it } from "vitest";
import {
CHARS_PER_TOKEN_ESTIMATE,

View File

@@ -1,3 +1,4 @@
// Shared delivery context helpers expose route normalization shared by modules.
import {
channelRouteCompactKey,
channelRouteThreadId,

View File

@@ -1,3 +1,4 @@
// Delivery context tests cover context normalization for channel delivery.
import { beforeEach, describe, expect, it } from "vitest";
import { setActivePluginRegistry } from "../plugins/runtime.js";
import { createChannelTestPluginBase, createTestRegistry } from "../test-utils/channel-plugins.js";

View File

@@ -1,3 +1,4 @@
// Delivery context helpers normalize target and route metadata for delivery.
import { normalizeOptionalString } from "@openclaw/normalization-core/string-coerce";
import { getChannelPlugin, normalizeChannelId } from "../channels/plugins/index.js";
import { normalizeMessageChannel } from "./message-channel.js";

View File

@@ -1,3 +1,4 @@
// Delivery context types describe normalized channel route delivery inputs.
import type { ChannelRouteRef, ChannelRouteTargetInput } from "../plugin-sdk/channel-route.js";
/** Deferred outbound delivery intent attached to a session or task. */

View File

@@ -1,3 +1,4 @@
// Directive tag tests cover parsing and filtering inline directive tags.
import { describe, expect, test } from "vitest";
import {
parseInlineDirectives,

View File

@@ -1,3 +1,4 @@
// Directive tag helpers parse inline directive tags from user text.
import { normalizeOptionalString } from "@openclaw/normalization-core/string-coerce";
export type InlineDirectiveParseResult = {

View File

@@ -1,3 +1,4 @@
// Fetch timeout tests cover abort handling and streamed response timeouts.
import { Stream } from "openai/streaming";
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";

View File

@@ -1,3 +1,4 @@
// Fetch timeout helpers wrap fetch calls with timeout and abort behavior.
import { createSubsystemLogger } from "../logging/subsystem.js";
import { resolveSafeTimeoutDelayMs } from "./timer-delay.js";

View File

@@ -1,3 +1,4 @@
// API key masking tests cover redaction of provider credential values.
import { describe, expect, it } from "vitest";
import { maskApiKey } from "./mask-api-key.js";

View File

@@ -1,3 +1,4 @@
// Message channel constants define internal channel ids shared across routing.
export const INTERNAL_MESSAGE_CHANNEL = "webchat" as const;
export type InternalMessageChannel = typeof INTERNAL_MESSAGE_CHANNEL;

View File

@@ -1,3 +1,4 @@
// Message channel core helpers normalize channel families and internal ids.
import { normalizeOptionalLowercaseString } from "@openclaw/normalization-core/string-coerce";
import { normalizeChatChannelId } from "../channels/ids.js";
import { normalizeAnyChannelId } from "../channels/registry-normalize.js";

View File

@@ -1,3 +1,4 @@
// Message channel normalization helpers canonicalize channel identifiers and aliases.
import { uniqueStrings } from "@openclaw/normalization-core/string-normalization";
import { CHANNEL_IDS } from "../channels/ids.js";
import { listRegisteredChannelPluginIds } from "../channels/registry.js";

View File

@@ -1,3 +1,4 @@
// Message channel tests cover channel id normalization and routing helpers.
import path from "node:path";
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
import type { ChannelPlugin } from "../channels/plugins/types.js";

View File

@@ -1,3 +1,4 @@
// Message channel helpers classify and format channel identifiers.
import {
GATEWAY_CLIENT_MODES,
GATEWAY_CLIENT_NAMES,

View File

@@ -1,3 +1,4 @@
// Secret input normalization tests cover trimming and empty-value handling.
import { describe, expect, it } from "vitest";
import { normalizeOptionalSecretInput, normalizeSecretInput } from "./normalize-secret-input.js";

View File

@@ -1,3 +1,4 @@
// Provider utility tests cover provider normalization and utility behavior.
import { beforeEach, describe, expect, it, vi } from "vitest";
const { resolveProviderReasoningOutputModeWithPluginMock } = vi.hoisted(() => ({

View File

@@ -1,3 +1,4 @@
// Queue helper tests cover queue ordering and dedupe utility behavior.
import { describe, expect, it } from "vitest";
import {
applyQueueRuntimeSettings,

View File

@@ -1,3 +1,4 @@
// Reaction level tests cover normalization of reaction intensity values.
import { describe, expect, it } from "vitest";
import { resolveReactionLevel } from "./reaction-level.js";

View File

@@ -1,3 +1,4 @@
// Concurrency runner tests cover bounded parallel task execution.
import { describe, expect, it, vi } from "vitest";
import { runTasksWithConcurrency } from "./run-with-concurrency.js";

View File

@@ -1,3 +1,4 @@
// Shell argv helpers quote and parse shell-style argument strings.
const DOUBLE_QUOTE_ESCAPES = new Set(["\\", '"', "$", "`", "\n", "\r"]);
// POSIX double quotes only consume the backslash before a small escape set;

View File

@@ -1,3 +1,4 @@
// Timer delay tests cover safe timeout clamping and scheduling behavior.
import { describe, expect, it, vi } from "vitest";
import { MAX_SAFE_TIMEOUT_DELAY_MS, setSafeTimeout } from "./timer-delay.js";

View File

@@ -1,3 +1,4 @@
// Timer delay helpers clamp delays to runtime-safe timeout values.
import { resolveSafeTimeoutDelayMs } from "../../packages/gateway-client/src/timeouts.js";
export {

View File

@@ -1,3 +1,4 @@
// Transcript tool tests cover transcript utility parsing and formatting.
import { describe, expect, it } from "vitest";
import { countToolResults, extractToolCallNames, hasToolCall } from "./transcript-tools.js";

View File

@@ -1,3 +1,4 @@
// Usage format tests cover display formatting for token and cost usage.
import nodeFs from "node:fs";
import fs from "node:fs/promises";
import os from "node:os";

View File

@@ -1,3 +1,4 @@
// Misc utility tests cover small shared helper behavior.
import { describe, expect, it } from "vitest";
import { z } from "zod";
import { asBoolean, parseBooleanValue } from "./boolean.js";

View File

@@ -1,3 +1,4 @@
// Zod parse helpers wrap schema parsing with consistent error handling.
import type { ZodType } from "zod";
/**