Vendor OpenClaw source as Adolf fork baseline
Some checks failed
ClawSweeper Dispatch / dispatch (push) Has been cancelled
CodeQL / Security High (actions) (push) Has been cancelled
CodeQL / Security High (channel-runtime-boundary) (push) Has been cancelled
CodeQL / Security High (core-auth-secrets) (push) Has been cancelled
CodeQL / Security High (mcp-process-tool-boundary) (push) Has been cancelled
CodeQL / Security High (network-ssrf-boundary) (push) Has been cancelled
CodeQL / Security High (plugin-trust-boundary) (push) Has been cancelled
CodeQL / Security High (process-exec-boundary) (push) Has been cancelled
Docs Sync Publish Repo / sync-publish-repo (push) Has been cancelled
Docs / docs (push) Has been cancelled
OpenClaw Stable Main Closeout / Resolve stable release closeout inputs (push) Has been cancelled
OpenClaw Stable Main Closeout / Verify stable main closeout (push) Has been cancelled
Workflow Sanity / no-tabs (push) Has been cancelled
Workflow Sanity / actionlint (push) Has been cancelled
Workflow Sanity / generated-doc-baselines (push) Has been cancelled
CI / runner-admission (push) Has been cancelled
CI / preflight (push) Has been cancelled
CI / security-fast (push) Has been cancelled
CI / pnpm-store-warmup (push) Has been cancelled
CI / build-artifacts (push) Has been cancelled
CI / native-i18n (push) Has been cancelled
CI / ${{ matrix.check_name }} (push) Has been cancelled
CI / ${{ matrix.checkName }} (push) Has been cancelled
CI / checks-node-compat-node22 (push) Has been cancelled
CI / check-bundled-channel-config-metadata (push) Has been cancelled
CI / check-dependencies (push) Has been cancelled
CI / check-guards (push) Has been cancelled
CI / check-lint (push) Has been cancelled
CI / check-prod-types (push) Has been cancelled
CI / check-shrinkwrap (push) Has been cancelled
CI / check-test-types (push) Has been cancelled
CI / check-additional-boundaries-a (push) Has been cancelled
CI / check-additional-boundaries-bcd (push) Has been cancelled
CI / check-additional-extension-bundled (push) Has been cancelled
CI / check-additional-extension-channels (push) Has been cancelled
CI / check-additional-extension-package-boundary (push) Has been cancelled
CI / check-additional-runtime-topology-architecture (push) Has been cancelled
CI / check-session-accessor-boundary (push) Has been cancelled
CI / check-session-transcript-reader-boundary (push) Has been cancelled
CI / check-docs (push) Has been cancelled
CI / skills-python (push) Has been cancelled
CI / macos-swift (push) Has been cancelled
CI / ios-build (push) Has been cancelled
CI / ci-timings-summary (push) Has been cancelled
Native App Locale Refresh / Refresh native fa (push) Has been cancelled
Native App Locale Refresh / Refresh native fr (push) Has been cancelled
Native App Locale Refresh / Refresh native hi (push) Has been cancelled
Native App Locale Refresh / Refresh native id (push) Has been cancelled
Native App Locale Refresh / Refresh native it (push) Has been cancelled
Native App Locale Refresh / Refresh native ja-JP (push) Has been cancelled
Control UI Locale Refresh / plan (push) Has been cancelled
Control UI Locale Refresh / Refresh ${{ matrix.locale }} (push) Has been cancelled
Control UI Locale Refresh / Commit control UI locale refresh (push) Has been cancelled
Live Media Runner Image / Build live media runner image (push) Has been cancelled
Native App Locale Refresh / Refresh native ar (push) Has been cancelled
Native App Locale Refresh / Refresh native de (push) Has been cancelled
Native App Locale Refresh / Refresh native es (push) Has been cancelled
Native App Locale Refresh / Refresh native ko (push) Has been cancelled
Native App Locale Refresh / Refresh native nl (push) Has been cancelled
Native App Locale Refresh / Refresh native pl (push) Has been cancelled
Native App Locale Refresh / Refresh native pt-BR (push) Has been cancelled
Native App Locale Refresh / Refresh native ru (push) Has been cancelled
Native App Locale Refresh / Refresh native sv (push) Has been cancelled
Native App Locale Refresh / Refresh native th (push) Has been cancelled
Native App Locale Refresh / Refresh native tr (push) Has been cancelled
Native App Locale Refresh / Refresh native uk (push) Has been cancelled
Native App Locale Refresh / Refresh native vi (push) Has been cancelled
Native App Locale Refresh / Refresh native zh-CN (push) Has been cancelled
Native App Locale Refresh / Refresh native zh-TW (push) Has been cancelled
Native App Locale Refresh / Commit native locale refresh (push) Has been cancelled
Plugin Init Scaffold Validation / Validate provider scaffold (push) Has been cancelled
Plugin NPM Release / preview_plugins_npm (push) Has been cancelled
Plugin NPM Release / Validate release publish approval (push) Has been cancelled
Plugin NPM Release / preview_plugin_pack (push) Has been cancelled
Plugin NPM Release / publish_plugins_npm (push) Has been cancelled
Sandbox Common Smoke / sandbox-common-smoke (push) Has been cancelled
Website Installer Sync / static (push) Has been cancelled
Website Installer Sync / linux-docker (push) Has been cancelled
Website Installer Sync / macos-installer (push) Has been cancelled
Website Installer Sync / windows-installer (push) Has been cancelled
Website Installer Sync / sync-website (push) Has been cancelled

Adolf is a fork/vendored clone of github.com/openclaw/openclaw (v2026.6.11),
free to diverge. Tree copied sans upstream .git; upstream remote added for
future syncs. Node pinned to 24 (.nvmrc); engines already require >=22.19.
Preserves docs/ARCHITECTURE.md.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LeqyaxJF2nbRXJtae2kNB2
This commit is contained in:
2026-07-05 09:36:54 +00:00
parent 3216769225
commit bedb527145
21108 changed files with 6010766 additions and 0 deletions

View File

@@ -0,0 +1,253 @@
// Memory Wiki plugin module implements claim health behavior.
import { normalizeLowercaseStringOrEmpty } from "openclaw/plugin-sdk/string-coerce-runtime";
import type { WikiClaim, WikiPageSummary } from "./markdown.js";
const DAY_MS = 24 * 60 * 60 * 1000;
export const WIKI_AGING_DAYS = 30;
const WIKI_STALE_DAYS = 90;
const CONTESTED_CLAIM_STATUSES = new Set(["contested", "contradicted", "refuted", "superseded"]);
export type WikiFreshnessLevel = "fresh" | "aging" | "stale" | "unknown";
export type WikiFreshness = {
level: WikiFreshnessLevel;
reason: string;
daysSinceTouch?: number;
lastTouchedAt?: string;
};
export type WikiClaimHealth = {
key: string;
pagePath: string;
pageTitle: string;
pageId?: string;
claimId?: string;
text: string;
status: string;
confidence?: number;
evidenceCount: number;
missingEvidence: boolean;
freshness: WikiFreshness;
};
export type WikiClaimContradictionCluster = {
key: string;
label: string;
entries: WikiClaimHealth[];
};
export type WikiPageContradictionCluster = {
key: string;
label: string;
entries: Array<{
pagePath: string;
pageTitle: string;
pageId?: string;
note: string;
}>;
};
function parseTimestamp(value?: string): number | null {
if (!value?.trim()) {
return null;
}
const parsed = Date.parse(value);
return Number.isFinite(parsed) ? parsed : null;
}
function clampDaysSinceTouch(daysSinceTouch: number): number {
return Math.max(0, daysSinceTouch);
}
function normalizeClaimTextKey(text: string): string {
return normalizeLowercaseStringOrEmpty(text.replace(/\s+/g, " "));
}
function normalizeTextKey(text: string): string {
return normalizeLowercaseStringOrEmpty(text)
.replace(/[^\p{L}\p{N}\p{M}]+/gu, " ")
.replace(/\s+/g, " ");
}
function buildFreshnessFromTimestamp(params: { timestamp?: string; now?: Date }): WikiFreshness {
const now = params.now ?? new Date();
const timestampMs = parseTimestamp(params.timestamp);
if (timestampMs === null || !params.timestamp) {
return {
level: "unknown",
reason: "missing updatedAt",
};
}
const daysSinceTouch = clampDaysSinceTouch(Math.floor((now.getTime() - timestampMs) / DAY_MS));
if (daysSinceTouch >= WIKI_STALE_DAYS) {
return {
level: "stale",
reason: `last touched ${params.timestamp}`,
daysSinceTouch,
lastTouchedAt: params.timestamp,
};
}
if (daysSinceTouch >= WIKI_AGING_DAYS) {
return {
level: "aging",
reason: `last touched ${params.timestamp}`,
daysSinceTouch,
lastTouchedAt: params.timestamp,
};
}
return {
level: "fresh",
reason: `last touched ${params.timestamp}`,
daysSinceTouch,
lastTouchedAt: params.timestamp,
};
}
function resolveLatestTimestamp(candidates: Array<string | undefined>): string | undefined {
let bestValue: string | undefined;
let bestMs = -1;
for (const candidate of candidates) {
const parsed = parseTimestamp(candidate);
if (parsed === null || !candidate || parsed <= bestMs) {
continue;
}
bestMs = parsed;
bestValue = candidate;
}
return bestValue;
}
export function normalizeClaimStatus(status?: string): string {
return normalizeLowercaseStringOrEmpty(status) || "supported";
}
export function isClaimContestedStatus(status?: string): boolean {
return CONTESTED_CLAIM_STATUSES.has(normalizeClaimStatus(status));
}
export function assessPageFreshness(page: WikiPageSummary, now?: Date): WikiFreshness {
return buildFreshnessFromTimestamp({ timestamp: page.updatedAt, now });
}
export function assessClaimFreshness(params: {
page: WikiPageSummary;
claim: WikiClaim;
now?: Date;
}): WikiFreshness {
let hasClaimTimestamp = typeof params.claim.updatedAt === "string" &&
params.claim.updatedAt.trim().length > 0;
let latestTimestamp = resolveLatestTimestamp([params.claim.updatedAt]);
let latestMs = parseTimestamp(latestTimestamp) ?? -1;
for (const evidence of params.claim.evidence) {
if (typeof evidence.updatedAt === "string" && evidence.updatedAt.trim().length > 0) {
hasClaimTimestamp = true;
}
const evidenceMs = parseTimestamp(evidence.updatedAt);
if (evidenceMs === null || !evidence.updatedAt || evidenceMs <= latestMs) {
continue;
}
latestMs = evidenceMs;
latestTimestamp = evidence.updatedAt;
}
return buildFreshnessFromTimestamp({
timestamp: latestTimestamp ?? (hasClaimTimestamp ? undefined : params.page.updatedAt),
now: params.now,
});
}
function buildWikiClaimHealth(params: {
page: WikiPageSummary;
claim: WikiClaim;
index: number;
now?: Date;
}): WikiClaimHealth {
const claimId = params.claim.id?.trim();
return {
key: `${params.page.relativePath}#${claimId ?? `claim-${params.index + 1}`}`,
pagePath: params.page.relativePath,
pageTitle: params.page.title,
...(params.page.id ? { pageId: params.page.id } : {}),
...(claimId ? { claimId } : {}),
text: params.claim.text,
status: normalizeClaimStatus(params.claim.status),
...(typeof params.claim.confidence === "number" ? { confidence: params.claim.confidence } : {}),
evidenceCount: params.claim.evidence.length,
missingEvidence: params.claim.evidence.length === 0,
freshness: assessClaimFreshness({ page: params.page, claim: params.claim, now: params.now }),
};
}
export function collectWikiClaimHealth(pages: WikiPageSummary[], now?: Date): WikiClaimHealth[] {
return pages.flatMap((page) =>
page.claims.map((claim, index) => buildWikiClaimHealth({ page, claim, index, now })),
);
}
export function buildClaimContradictionClusters(params: {
pages: WikiPageSummary[];
now?: Date;
}): WikiClaimContradictionCluster[] {
const claimHealth = collectWikiClaimHealth(params.pages, params.now);
const byId = new Map<string, WikiClaimHealth[]>();
for (const claim of claimHealth) {
if (!claim.claimId) {
continue;
}
const current = byId.get(claim.claimId) ?? [];
current.push(claim);
byId.set(claim.claimId, current);
}
return [...byId.entries()]
.flatMap(([claimId, entries]) => {
if (entries.length < 2) {
return [];
}
const distinctTexts = new Set(entries.map((entry) => normalizeClaimTextKey(entry.text)));
const distinctStatuses = new Set(entries.map((entry) => entry.status));
if (distinctTexts.size < 2 && distinctStatuses.size < 2) {
return [];
}
return [
{
key: claimId,
label: claimId,
entries: [...entries].toSorted((left, right) =>
left.pagePath.localeCompare(right.pagePath),
),
},
];
})
.toSorted((left, right) => left.label.localeCompare(right.label));
}
export function buildPageContradictionClusters(
pages: WikiPageSummary[],
): WikiPageContradictionCluster[] {
const byNote = new Map<string, WikiPageContradictionCluster["entries"]>();
for (const page of pages) {
for (const note of page.contradictions) {
const key = normalizeTextKey(note);
if (!key) {
continue;
}
const current = byNote.get(key) ?? [];
current.push({
pagePath: page.relativePath,
pageTitle: page.title,
...(page.id ? { pageId: page.id } : {}),
note,
});
byNote.set(key, current);
}
}
return [...byNote.entries()]
.map(([key, entries]) => ({
key,
label: entries[0]?.note ?? key,
entries: [...entries].toSorted((left, right) => left.pagePath.localeCompare(right.pagePath)),
}))
.toSorted((left, right) => left.label.localeCompare(right.label));
}