docs: document package sources

This commit is contained in:
Peter Steinberger
2026-06-04 20:54:41 -04:00
parent b8d08f0cfd
commit 4df95d3c3f
270 changed files with 274 additions and 1 deletions

View File

@@ -1,3 +1,4 @@
// ACP Core helper module supports error format behavior.
const SECRET_PATTERNS: RegExp[] = [
/\b[A-Z0-9_]*(?:KEY|TOKEN|SECRET|PASSWORD|PASSWD|CARD[_-]?NUMBER|CARD[_-]?CVC|CARD[_-]?CVV|CVC|CVV|SECURITY[_-]?CODE|PAYMENT[_-]?CREDENTIAL|SHARED[_-]?PAYMENT[_-]?TOKEN)\b\s*[=:]\s*(["']?)([^\s"'\\]+)\1/g,
/\b[A-Z0-9_]*(?:KEY|TOKEN|SECRET|PASSWORD|PASSWD|CARD[_-]?NUMBER|CARD[_-]?CVC|CARD[_-]?CVV|CVC|CVV|SECURITY[_-]?CODE|PAYMENT[_-]?CREDENTIAL|SHARED[_-]?PAYMENT[_-]?TOKEN)\b\s*[=:]\s*\\+(["'])([^\s"'\\]+)\\+\1/g,

View File

@@ -1,3 +1,4 @@
// ACP Core tests cover meta behavior.
import { describe, expect, it } from "vitest";
import { readBool, readNonNegativeInteger, readNumber, readString } from "./meta.js";

View File

@@ -1,3 +1,4 @@
// ACP Core module implements meta behavior.
import { normalizeOptionalString } from "@openclaw/normalization-core/string-coerce";
function readMetaValue<T>(

View File

@@ -1,3 +1,4 @@
// ACP Core module implements numeric options behavior.
import { resolveIntegerOption as resolveSharedIntegerOption } from "@openclaw/normalization-core/number-coercion";
/** Resolves ACP integer options through the shared normalization contract. */

View File

@@ -1,3 +1,4 @@
// ACP Core tests cover error text behavior.
import { describe, expect, it } from "vitest";
import { formatAcpRuntimeErrorText, toAcpRuntimeErrorText } from "./error-text.js";
import { AcpRuntimeError, toAcpRuntimeError } from "./errors.js";

View File

@@ -1,3 +1,4 @@
// ACP Core module implements error text behavior.
import { type AcpRuntimeErrorCode, AcpRuntimeError, toAcpRuntimeError } from "./errors.js";
function resolveAcpRuntimeErrorNextStep(error: AcpRuntimeError): string | undefined {

View File

@@ -1,3 +1,4 @@
// ACP Core tests cover errors behavior.
import { afterEach, describe, expect, it } from "vitest";
import { configureAcpErrorRedactor } from "../error-format.js";
import {

View File

@@ -1,3 +1,4 @@
// ACP Core module implements errors behavior.
import { redactSensitiveText, stringifyNonErrorCause } from "../error-format.js";
export const ACP_ERROR_CODES = [

View File

@@ -1,3 +1,4 @@
// ACP Core tests cover session identifiers behavior.
import { describe, expect, it } from "vitest";
import {
resolveAcpSessionCwd,

View File

@@ -1,3 +1,4 @@
// ACP Core module implements session identifiers behavior.
import { normalizeLowercaseStringOrEmpty } from "@openclaw/normalization-core/string-coerce";
import { normalizeText } from "../normalize-text.js";
import type { SessionAcpIdentity, SessionAcpMeta } from "../types.js";

View File

@@ -1,3 +1,4 @@
// ACP Core module implements session identity behavior.
import { normalizeText } from "../normalize-text.js";
import type { SessionAcpIdentity, SessionAcpIdentitySource, SessionAcpMeta } from "../types.js";
import type { AcpRuntimeHandle, AcpRuntimeStatus } from "./types.js";

View File

@@ -1,3 +1,4 @@
// ACP Core type module defines shared TypeScript contracts.
export type AcpRuntimePromptMode = "prompt" | "steer";
export type AcpRuntimeSessionMode = "persistent" | "oneshot";

View File

@@ -1,3 +1,4 @@
// ACP Core tests cover session interaction mode behavior.
import { describe, expect, it } from "vitest";
import {
isParentOwnedBackgroundAcpSession,

View File

@@ -1,3 +1,4 @@
// ACP Core module implements session interaction mode behavior.
import { normalizeOptionalString } from "@openclaw/normalization-core/string-coerce";
type AcpSessionInteractionMode = "interactive" | "parent-owned-background";

View File

@@ -1,3 +1,4 @@
// ACP Core tests cover session lineage meta behavior.
import { describe, expect, it } from "vitest";
import { toAcpSessionLineageMeta, type AcpSessionLineageRow } from "./session-lineage-meta.js";

View File

@@ -1,3 +1,4 @@
// ACP Core module implements session lineage meta behavior.
import { normalizeOptionalString } from "@openclaw/normalization-core/string-coerce";
const SUBAGENT_ROLES = ["orchestrator", "leaf"] as const;

View File

@@ -1,3 +1,4 @@
// ACP Core tests cover session behavior.
import { afterEach, beforeEach, describe, expect, it } from "vitest";
import { createInMemorySessionStore } from "./session.js";

View File

@@ -1,3 +1,4 @@
// ACP Core module implements session behavior.
import { randomUUID } from "node:crypto";
import { resolveIntegerOption } from "./numeric-options.js";
import type { AcpSession } from "./types.js";

View File

@@ -1,3 +1,4 @@
// ACP Core type module defines shared TypeScript contracts.
import { normalizeOptionalLowercaseString } from "@openclaw/normalization-core/string-coerce";
const ACP_PROVENANCE_MODE_VALUES = ["off", "meta", "meta+receipt"] as const;

View File

@@ -1,3 +1,4 @@
// Agent Core tests cover agent loop behavior.
import { describe, expect, it } from "vitest";
import { agentLoop, agentLoopContinue } from "./agent-loop.js";
import type { Message, Model } from "./llm.js";

View File

@@ -1,3 +1,4 @@
// Agent Core module implements agent behavior.
import type {
ImageContent,
Message,

View File

@@ -1,3 +1,4 @@
// Agent Core module implements agent harness behavior.
import type {
AssistantMessage,
ImageContent,

View File

@@ -1,3 +1,4 @@
// Agent Core module implements branch summarization behavior.
import type { Model, StreamFn } from "../../../../llm-core/src/index.js";
import {
type AgentCoreCompletionRuntimeDeps,

View File

@@ -1,3 +1,4 @@
// Agent Core module implements compaction behavior.
import type {
AssistantMessage,
Context,

View File

@@ -1,3 +1,4 @@
// Agent Core helper module supports utils behavior.
import type { Message } from "../../../../llm-core/src/index.js";
import type { AgentMessage } from "../../types.js";

View File

@@ -1,3 +1,4 @@
// Agent Core module implements kill tree behavior.
import { spawn } from "node:child_process";
const DEFAULT_GRACE_MS = 3000;

View File

@@ -1,3 +1,4 @@
// Agent Core tests cover nodejs behavior.
import { describe, expect, it } from "vitest";
import { resolveExecTimeoutMs } from "./nodejs.js";

View File

@@ -1,3 +1,4 @@
// Agent Core module implements nodejs behavior.
import { spawn } from "node:child_process";
import { randomUUID } from "node:crypto";
import { constants, createReadStream } from "node:fs";

View File

@@ -1,3 +1,4 @@
// Agent Core helper module supports file loader utils behavior.
import { parse } from "yaml";
import { type ExecutionEnv, type FileInfo, type Result, toError } from "./types.js";

View File

@@ -1,3 +1,4 @@
// Agent Core tests cover messages behavior.
import { describe, expect, it } from "vitest";
import { convertToLlm, createCustomMessage } from "./messages.js";

View File

@@ -1,3 +1,4 @@
// Agent Core module implements messages behavior.
import type { ImageContent, Message, TextContent } from "../../../llm-core/src/index.js";
import type {
AgentMessage,

View File

@@ -1,3 +1,4 @@
// Agent Core tests cover prompt templates behavior.
import { describe, expect, it } from "vitest";
import { parseCommandArgs, substituteArgs } from "./prompt-templates.js";

View File

@@ -1,3 +1,4 @@
// Agent Core module implements prompt templates behavior.
import {
basenameEnvPath,
parseFrontmatter,

View File

@@ -1,3 +1,4 @@
// Agent Core module implements jsonl repo behavior.
import type {
FileSystem,
JsonlSessionCreateOptions,

View File

@@ -1,3 +1,4 @@
// Agent Core tests cover jsonl storage behavior.
import { describe, expect, it } from "vitest";
import { ok, type FileSystem } from "../types.js";
import { JsonlSessionStorage, loadJsonlSessionMetadata } from "./jsonl-storage.js";

View File

@@ -1,3 +1,4 @@
// Agent Core module implements jsonl storage behavior.
import type { FileSystem, JsonlSessionMetadata, SessionTreeEntry } from "../types.js";
import { SessionError, toError } from "../types.js";
import { getFileSystemResultOrThrow } from "./repo-utils.js";

View File

@@ -1,3 +1,4 @@
// Agent Core module implements memory repo behavior.
import { type Session, SessionError, type SessionMetadata, type SessionRepo } from "../types.js";
import { InMemorySessionStorage } from "./memory-storage.js";
import { createSessionId, createTimestamp, getEntriesToFork, toSession } from "./repo-utils.js";

View File

@@ -1,3 +1,4 @@
// Agent Core tests cover memory storage behavior.
import { describe, expect, it } from "vitest";
import type { SessionTreeEntry } from "../types.js";
import { InMemorySessionStorage } from "./memory-storage.js";

View File

@@ -1,3 +1,4 @@
// Agent Core module implements memory storage behavior.
import type { SessionMetadata, SessionTreeEntry } from "../types.js";
import { BaseSessionStorage } from "./storage-base.js";
import { uuidv7 } from "./uuid.js";

View File

@@ -1,3 +1,4 @@
// Agent Core helper module supports repo utils behavior.
import {
type FileError,
type Result,

View File

@@ -1,3 +1,4 @@
// Agent Core module implements session behavior.
import type { ImageContent, TextContent } from "../../../../llm-core/src/index.js";
import type { AgentMessage } from "../../types.js";
import {

View File

@@ -1,3 +1,4 @@
// Agent Core module implements storage base behavior.
import {
type LeafEntry,
SessionError,

View File

@@ -1,3 +1,4 @@
// Agent Core module implements uuid behavior.
let lastTimestamp = -Infinity;
let sequence = 0;

View File

@@ -1,3 +1,4 @@
// Agent Core module implements skills behavior.
import ignore from "ignore";
import {
basenameEnvPath,

View File

@@ -1,3 +1,4 @@
// Agent Core module implements system prompt behavior.
import type { Skill } from "./types.js";
/** Format model-visible skill metadata for inclusion in the harness system prompt. */

View File

@@ -1,3 +1,4 @@
// Agent Core type module defines shared TypeScript contracts.
import type {
ImageContent,
Model,

View File

@@ -1,3 +1,4 @@
// Agent Core module implements shell output behavior.
import {
type ExecutionEnv,
type ExecutionEnvExecOptions,

View File

@@ -1,3 +1,4 @@
// Agent Core tests cover truncate behavior.
import { describe, expect, it } from "vitest";
import { truncateHead, truncateTail } from "./truncate.js";

View File

@@ -1,3 +1,4 @@
// Agent Core module implements truncate behavior.
export const DEFAULT_MAX_LINES = 2000;
export const DEFAULT_MAX_BYTES = 50 * 1024; // 50KB
export const GREP_MAX_LINE_LENGTH = 500; // Max chars per grep match line

View File

@@ -1,3 +1,4 @@
// Agent Core module implements runtime deps behavior.
import type { CompleteSimpleFn, StreamFn } from "../../llm-core/src/index.js";
/** Runtime functions injected by host packages so agent-core stays provider-agnostic. */

View File

@@ -1,3 +1,4 @@
// Agent Core type module defines shared TypeScript contracts.
import type { Static, TSchema } from "typebox";
import type {
AssistantMessage,

View File

@@ -1,3 +1,4 @@
// Gateway Client module implements client behavior.
import { randomUUID } from "node:crypto";
import type {
ConnectParams,

View File

@@ -1,3 +1,4 @@
// Gateway Client tests cover client.watchdog behavior.
import { createServer as createHttpsServer } from "node:https";
import { createServer } from "node:net";
import { afterEach, describe, expect, test, vi } from "vitest";

View File

@@ -1,3 +1,4 @@
// Gateway Client module implements device auth behavior.
export function normalizeDeviceMetadataForAuth(value?: string | null): string {
if (typeof value !== "string") {
return "";

View File

@@ -1,3 +1,4 @@
// Gateway Client tests cover event loop ready behavior.
import { afterEach, describe, expect, it, vi } from "vitest";
import { waitForEventLoopReady } from "./event-loop-ready.js";
import { MAX_SAFE_TIMEOUT_DELAY_MS } from "./timeouts.js";

View File

@@ -1,3 +1,4 @@
// Gateway Client module implements event loop ready behavior.
import { resolveFiniteTimeoutDelayMs } from "./timeouts.js";
/** Readiness probe outcome with timing data for diagnosing event-loop stalls. */

View File

@@ -1,3 +1,4 @@
// Gateway Client module implements readiness behavior.
import type { GatewayClientOptions } from "./client.js";
import {
waitForEventLoopReady,

View File

@@ -1,3 +1,4 @@
// Gateway Client tests cover timeouts behavior.
import { describe, expect, it } from "vitest";
import {
addSafeTimeoutDelayGraceMs,

View File

@@ -1,3 +1,4 @@
// Gateway Client module implements timeouts behavior.
function parseStrictPositiveInteger(value: string): number | undefined {
const trimmed = value.trim();
if (!/^\+?\d+$/u.test(trimmed)) {

View File

@@ -1,3 +1,4 @@
// Gateway Protocol tests cover channels.schema behavior.
import { Compile } from "typebox/compile";
import { describe, expect, it } from "vitest";
import { ChannelsStatusResultSchema, WebLoginWaitParamsSchema } from "./schema/channels.js";

View File

@@ -1,3 +1,4 @@
// Gateway Protocol tests cover connect error details behavior.
import { describe, expect, it } from "vitest";
import {
buildPairingConnectCloseReason,

View File

@@ -1,3 +1,4 @@
// Gateway Protocol tests cover cron validators behavior.
import { describe, expect, it } from "vitest";
import {
validateCronAddParams,

View File

@@ -1,3 +1,4 @@
// Gateway Protocol tests cover exec approvals validators behavior.
import { describe, expect, it } from "vitest";
import {
validateExecApprovalRequestParams,

View File

@@ -1,3 +1,4 @@
// Gateway Protocol tests cover index behavior.
import { describe, expect, it } from "vitest";
import { TALK_TEST_PROVIDER_ID } from "../../../src/test-utils/talk-test-provider.js";
import * as protocol from "./index.js";

View File

@@ -1,3 +1,4 @@
// Gateway Protocol tests cover native protocol levels.guard behavior.
import fs from "node:fs/promises";
import path from "node:path";
import { describe, it } from "vitest";

View File

@@ -1,3 +1,4 @@
// Gateway Protocol tests cover primitives.secretref behavior.
import { Compile } from "typebox/compile";
import { describe, expect, it } from "vitest";
import {

View File

@@ -1,3 +1,4 @@
// Gateway Protocol tests cover push behavior.
import { Compile } from "typebox/compile";
import { describe, expect, it } from "vitest";
import { PushTestResultSchema } from "./schema/push.js";

View File

@@ -1,3 +1,4 @@
// Gateway Protocol tests cover agent behavior.
import { Value } from "typebox/value";
import { describe, expect, it } from "vitest";
import { AgentParamsSchema } from "./agent.js";

View File

@@ -1,3 +1,4 @@
// Gateway Protocol schema module defines protocol validation shapes.
import { Type } from "typebox";
import { InputProvenanceSchema, NonEmptyString, SessionLabelString } from "./primitives.js";

View File

@@ -1,3 +1,4 @@
// Gateway Protocol tests cover agents models skills behavior.
import { Value } from "typebox/value";
import { describe, expect, it } from "vitest";
import {

View File

@@ -1,3 +1,4 @@
// Gateway Protocol schema module defines protocol validation shapes.
import { Type } from "typebox";
import { NonEmptyString } from "./primitives.js";

View File

@@ -1,3 +1,4 @@
// Gateway Protocol schema module defines protocol validation shapes.
import { Type } from "typebox";
import { NonEmptyString } from "./primitives.js";

View File

@@ -1,3 +1,4 @@
// Gateway Protocol schema module defines protocol validation shapes.
import { Type } from "typebox";
import { NonEmptyString, SecretInputSchema } from "./primitives.js";

View File

@@ -1,3 +1,4 @@
// Gateway Protocol schema module defines protocol validation shapes.
import { Type } from "typebox";
import { NonEmptyString } from "./primitives.js";

View File

@@ -1,3 +1,4 @@
// Gateway Protocol schema module defines protocol validation shapes.
import { Type } from "typebox";
import { NonEmptyString } from "./primitives.js";

View File

@@ -1,3 +1,4 @@
// Gateway Protocol schema module defines protocol validation shapes.
import { Type, type TSchema } from "typebox";
import { NonEmptyString } from "./primitives.js";

View File

@@ -1,3 +1,4 @@
// Gateway Protocol schema module defines protocol validation shapes.
import { Type } from "typebox";
import { NonEmptyString } from "./primitives.js";

View File

@@ -1,3 +1,4 @@
// Gateway Protocol schema module defines protocol validation shapes.
import { Type } from "typebox";
import { NonEmptyString } from "./primitives.js";

View File

@@ -1,3 +1,4 @@
// Gateway Protocol schema module defines protocol validation shapes.
import type { ErrorShape } from "./types.js";
/** Gateway JSON-RPC style error codes shared by clients and server handlers. */

View File

@@ -1,3 +1,4 @@
// Gateway Protocol schema module defines protocol validation shapes.
import { Type } from "typebox";
import { NonEmptyString } from "./primitives.js";

View File

@@ -1,3 +1,4 @@
// Gateway Protocol schema module defines protocol validation shapes.
import { Type } from "typebox";
import { GatewayClientIdSchema, GatewayClientModeSchema, NonEmptyString } from "./primitives.js";
import { SnapshotSchema, StateVersionSchema } from "./snapshot.js";

View File

@@ -1,3 +1,4 @@
// Gateway Protocol schema module defines protocol validation shapes.
import type { Static } from "typebox";
import { Type } from "typebox";
import { ChatSendSessionKeyString, InputProvenanceSchema, NonEmptyString } from "./primitives.js";

View File

@@ -1,3 +1,4 @@
// Gateway Protocol schema module defines protocol validation shapes.
import { Type } from "typebox";
import { NonEmptyString } from "./primitives.js";

View File

@@ -1,3 +1,4 @@
// Gateway Protocol schema module defines protocol validation shapes.
import { Type } from "typebox";
import { NonEmptyString } from "./primitives.js";

View File

@@ -1,3 +1,4 @@
// Gateway Protocol schema module defines protocol validation shapes.
import { Type } from "typebox";
import { NonEmptyString } from "./primitives.js";

View File

@@ -1,3 +1,4 @@
// Gateway Protocol schema module defines protocol validation shapes.
import { Type } from "typebox";
import { GATEWAY_CLIENT_IDS, GATEWAY_CLIENT_MODES } from "../client-info.js";
import {

View File

@@ -1,3 +1,4 @@
// Gateway Protocol schema module defines protocol validation shapes.
import { Type } from "typebox";
import { NonEmptyString } from "./primitives.js";

View File

@@ -1,3 +1,4 @@
// Gateway Protocol schema module defines protocol validation shapes.
import { Type, type Static } from "typebox";
import { NonEmptyString } from "./primitives.js";

View File

@@ -1,3 +1,4 @@
// Gateway Protocol schema module defines protocol validation shapes.
import { Type } from "typebox";
import { PluginJsonValueSchema } from "./plugins.js";
import { NonEmptyString, SessionLabelString } from "./primitives.js";

View File

@@ -1,3 +1,4 @@
// Gateway Protocol schema module defines protocol validation shapes.
import { Type } from "typebox";
import { NonEmptyString } from "./primitives.js";

View File

@@ -1,3 +1,4 @@
// Gateway Protocol schema module defines protocol validation shapes.
import { Type } from "typebox";
import { NonEmptyString } from "./primitives.js";

View File

@@ -1,3 +1,4 @@
// Gateway Protocol schema module defines protocol validation shapes.
import { Type } from "typebox";
import { NonEmptyString } from "./primitives.js";

View File

@@ -1,3 +1,4 @@
// Gateway Protocol tests cover talk config.contract behavior.
import fs from "node:fs";
import { describe, expect, it } from "vitest";
import { buildTalkConfigResponse } from "../../../src/config/talk.js";

View File

@@ -1,3 +1,4 @@
// LLM Core type module defines shared TypeScript contracts.
export type { AssistantMessageDiagnostic, DiagnosticErrorInfo } from "./utils/diagnostics.js";
import type { AssistantMessageDiagnostic } from "./utils/diagnostics.js";

View File

@@ -1,3 +1,4 @@
// LLM Core module implements diagnostics behavior.
export interface DiagnosticErrorInfo {
name?: string;
message: string;

View File

@@ -1,3 +1,4 @@
// LLM Core module implements event stream behavior.
import type {
AssistantMessage,
AssistantMessageEvent,

View File

@@ -1,3 +1,4 @@
// LLM Core tests cover validation behavior.
import { describe, expect, it } from "vitest";
import type { Tool } from "./types.js";
import { validateToolArguments } from "./validation.js";

View File

@@ -1,3 +1,4 @@
// LLM Core module implements validation behavior.
import { Compile } from "typebox/compile";
import type { TLocalizedValidationError } from "typebox/error";
import { Value } from "typebox/value";

View File

@@ -1,3 +1,4 @@
// LLM Runtime tests cover api registry behavior.
import { createAssistantMessageEventStream, type Model } from "@openclaw/llm-core";
import { afterEach, describe, expect, it } from "vitest";
import { getApiProvider, registerApiProvider, unregisterApiProviders } from "./api-registry.js";

View File

@@ -1,3 +1,4 @@
// LLM Runtime module implements api registry behavior.
import type {
Api,
AssistantMessageEventStreamContract,

Some files were not shown because too many files have changed in this diff Show More