mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-23 18:48:10 +00:00
Sync adabot changes on top of origin/main
Includes: - memory-neo4j: four-phase sleep cycle (dedup, decay, extraction, cleanup) - memory-neo4j: full plugin implementation with hybrid search - memory-lancedb: updates and benchmarks - OpenSpec workflow skills and commands - Session memory hooks - Various CLI and config improvements Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { resolveCommitHash } from "../infra/git-commit.js";
|
||||
import { resolveCommitHash, resolveUpstreamCommitHash } from "../infra/git-commit.js";
|
||||
import { visibleWidth } from "../terminal/ansi.js";
|
||||
import { isRich, theme } from "../terminal/theme.js";
|
||||
import { pickTagline, type TaglineOptions } from "./tagline.js";
|
||||
@@ -6,6 +6,7 @@ import { pickTagline, type TaglineOptions } from "./tagline.js";
|
||||
type BannerOptions = TaglineOptions & {
|
||||
argv?: string[];
|
||||
commit?: string | null;
|
||||
upstreamCommit?: string | null;
|
||||
columns?: number;
|
||||
richTty?: boolean;
|
||||
};
|
||||
@@ -36,30 +37,33 @@ const hasVersionFlag = (argv: string[]) =>
|
||||
|
||||
export function formatCliBannerLine(version: string, options: BannerOptions = {}): string {
|
||||
const commit = options.commit ?? resolveCommitHash({ env: options.env });
|
||||
const upstreamCommit = options.upstreamCommit ?? resolveUpstreamCommitHash();
|
||||
const commitLabel = commit ?? "unknown";
|
||||
// Show upstream if different from current (indicates local commits ahead)
|
||||
const showUpstream = upstreamCommit && upstreamCommit !== commit;
|
||||
const commitDisplay = showUpstream ? `${commitLabel} ← ${upstreamCommit}` : commitLabel;
|
||||
const tagline = pickTagline(options);
|
||||
const rich = options.richTty ?? isRich();
|
||||
const title = "🦞 OpenClaw";
|
||||
const prefix = "🦞 ";
|
||||
const columns = options.columns ?? process.stdout.columns ?? 120;
|
||||
const plainFullLine = `${title} ${version} (${commitLabel}) — ${tagline}`;
|
||||
const plainFullLine = `${title} ${version} (${commitDisplay}) — ${tagline}`;
|
||||
const fitsOnOneLine = visibleWidth(plainFullLine) <= columns;
|
||||
if (rich) {
|
||||
const commitPart = showUpstream
|
||||
? `${theme.muted("(")}${commitLabel}${theme.muted(" ← ")}${theme.muted(upstreamCommit)}${theme.muted(")")}`
|
||||
: theme.muted(`(${commitLabel})`);
|
||||
if (fitsOnOneLine) {
|
||||
return `${theme.heading(title)} ${theme.info(version)} ${theme.muted(
|
||||
`(${commitLabel})`,
|
||||
)} ${theme.muted("—")} ${theme.accentDim(tagline)}`;
|
||||
return `${theme.heading(title)} ${theme.info(version)} ${commitPart} ${theme.muted("—")} ${theme.accentDim(tagline)}`;
|
||||
}
|
||||
const line1 = `${theme.heading(title)} ${theme.info(version)} ${theme.muted(
|
||||
`(${commitLabel})`,
|
||||
)}`;
|
||||
const line1 = `${theme.heading(title)} ${theme.info(version)} ${commitPart}`;
|
||||
const line2 = `${" ".repeat(prefix.length)}${theme.accentDim(tagline)}`;
|
||||
return `${line1}\n${line2}`;
|
||||
}
|
||||
if (fitsOnOneLine) {
|
||||
return plainFullLine;
|
||||
}
|
||||
const line1 = `${title} ${version} (${commitLabel})`;
|
||||
const line1 = `${title} ${version} (${commitDisplay})`;
|
||||
const line2 = `${" ".repeat(prefix.length)}${tagline}`;
|
||||
return `${line1}\n${line2}`;
|
||||
}
|
||||
|
||||
@@ -280,11 +280,14 @@ export async function runMemoryStatus(opts: MemoryCommandOptions) {
|
||||
scan?: MemorySourceScan;
|
||||
}> = [];
|
||||
|
||||
const disabledAgentIds: string[] = [];
|
||||
for (const agentId of agentIds) {
|
||||
const managerPurpose = opts.index ? "default" : "status";
|
||||
await withManager<MemoryManager>({
|
||||
getManager: () => getMemorySearchManager({ cfg, agentId, purpose: managerPurpose }),
|
||||
onMissing: (error) => defaultRuntime.log(error ?? "Memory search disabled."),
|
||||
onMissing: () => {
|
||||
disabledAgentIds.push(agentId);
|
||||
},
|
||||
onCloseError: (err) =>
|
||||
defaultRuntime.error(`Memory manager close failed: ${formatErrorMessage(err)}`),
|
||||
close: async (manager) => {
|
||||
@@ -374,11 +377,22 @@ export async function runMemoryStatus(opts: MemoryCommandOptions) {
|
||||
const accent = (text: string) => colorize(rich, theme.accent, text);
|
||||
const label = (text: string) => muted(`${text}:`);
|
||||
|
||||
const emptyAgentIds: string[] = [];
|
||||
for (const result of allResults) {
|
||||
const { agentId, status, embeddingProbe, indexError, scan } = result;
|
||||
const filesIndexed = status.files ?? 0;
|
||||
const chunksIndexed = status.chunks ?? 0;
|
||||
const totalFiles = scan?.totalFiles ?? null;
|
||||
|
||||
// Skip agents with no indexed content (0 files, 0 chunks, no source files, no errors).
|
||||
// These agents aren't using the core memory search system — no need to show them.
|
||||
const isEmpty =
|
||||
status.files === 0 && status.chunks === 0 && (totalFiles ?? 0) === 0 && !indexError;
|
||||
if (isEmpty) {
|
||||
emptyAgentIds.push(agentId);
|
||||
continue;
|
||||
}
|
||||
|
||||
const indexedLabel =
|
||||
totalFiles === null
|
||||
? `${filesIndexed}/? files · ${chunksIndexed} chunks`
|
||||
@@ -510,6 +524,28 @@ export async function runMemoryStatus(opts: MemoryCommandOptions) {
|
||||
defaultRuntime.log(lines.join("\n"));
|
||||
defaultRuntime.log("");
|
||||
}
|
||||
|
||||
// Show compact summary for agents with no indexed memory-search content
|
||||
if (emptyAgentIds.length > 0) {
|
||||
const agentList = emptyAgentIds.join(", ");
|
||||
defaultRuntime.log(
|
||||
muted(
|
||||
`Memory Search: ${emptyAgentIds.length} agent${emptyAgentIds.length > 1 ? "s" : ""} with no indexed files (${agentList})`,
|
||||
),
|
||||
);
|
||||
defaultRuntime.log("");
|
||||
}
|
||||
|
||||
// Show compact summary for agents with memory search disabled
|
||||
if (disabledAgentIds.length > 0 && emptyAgentIds.length === 0) {
|
||||
const agentList = disabledAgentIds.join(", ");
|
||||
defaultRuntime.log(
|
||||
muted(
|
||||
`Memory Search: disabled for ${disabledAgentIds.length} agent${disabledAgentIds.length > 1 ? "s" : ""} (${agentList})`,
|
||||
),
|
||||
);
|
||||
defaultRuntime.log("");
|
||||
}
|
||||
}
|
||||
|
||||
export function registerMemoryCli(program: Command) {
|
||||
|
||||
Reference in New Issue
Block a user