惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

F
Fortinet All Blogs
Recent Announcements
Recent Announcements
H
Help Net Security
Y
Y Combinator Blog
酷 壳 – CoolShell
酷 壳 – CoolShell
有赞技术团队
有赞技术团队
小众软件
小众软件
Last Week in AI
Last Week in AI
U
Unit 42
Google DeepMind News
Google DeepMind News
博客园 - 司徒正美
H
Hackread – Cybersecurity News, Data Breaches, AI and More
J
Java Code Geeks
Microsoft Security Blog
Microsoft Security Blog
G
Google Developers Blog
N
Netflix TechBlog - Medium
Blog — PlanetScale
Blog — PlanetScale
云风的 BLOG
云风的 BLOG
V
V2EX
博客园 - 聂微东
人人都是产品经理
人人都是产品经理
博客园 - 三生石上(FineUI控件)
阮一峰的网络日志
阮一峰的网络日志
爱范儿
爱范儿

Recent Commits to openclaw:main

test: merge chat side-result checks · openclaw/openclaw@ddd2c2a test: merge cron history checks · openclaw/openclaw@f7eb746 test: merge responsive navigation shell checks · openclaw/openclaw@c2e4b47 docs(changelog): add codex oauth fixes · openclaw/openclaw@628e6cd test: merge navigation routing cases · openclaw/openclaw@5d8cecb Tests: mock channel registry bundled fallback · openclaw/openclaw@2b08233 Secrets: avoid broad web search discovery for single plugin config · openclaw/openclaw@a464f59 test: merge config view browser checks · openclaw/openclaw@20cf511 fix(status): align oauth health with runtime · openclaw/openclaw@eed7116 feat: add macOS screen snapshots for monitor preview (#67954) thanks … · openclaw/openclaw@f377db1 fix: report shared auth scopes in hello-ok (#67810) thanks @BunsDev · openclaw/openclaw@0b6c39b Auto-reply: avoid eager bundled route fallback · openclaw/openclaw@3ea1bf4 Tests: narrow session binding contract setup · openclaw/openclaw@54e4e16 fix(macOS): enable undo/redo in webchat composer text input (#34962) · openclaw/openclaw@00951dc Tests: speed up channel setup promotion · openclaw/openclaw@82b529a Docs: refresh agent instructions · openclaw/openclaw@5775fe2 fix(auth): serialize OAuth refresh across agents to fix #26322 (#67876) · openclaw/openclaw@8e79080 test: allow ollama public surface boundary test · openclaw/openclaw@7d4f1a6 Docs: add test performance guardrails · openclaw/openclaw@89706d3 Tests: restore context-engine usage proof · openclaw/openclaw@e4c4f95 Tests: slim context engine runtime coverage · openclaw/openclaw@74c198f ci: retry failed custom checkouts · openclaw/openclaw@0ee5baf test: trim duplicate provider auth onboarding cases · openclaw/openclaw@1ffc02e matrix: fix sessions_spawn --thread subagent session spawning (#67643) · openclaw/openclaw@1ce2596 test: reduce auth choice fixture churn · openclaw/openclaw@857b9cd test: mock health status config boundaries · openclaw/openclaw@9d5ab4a test: mock onboard config io boundary · openclaw/openclaw@299694d test: mock legacy state plugin boundaries · openclaw/openclaw@2713089 test: mock channel install boundaries · openclaw/openclaw@b945248 test: mock doctor preview channel boundaries · openclaw/openclaw@b1a3ad4
feat(memory-lancedb): support query cmd for llm CLI (#711...
yanghua · 2026-04-29 · via Recent Commits to openclaw:main

@@ -256,6 +256,11 @@ class MemoryDB {

256256

await this.ensureInitialized();

257257

return this.table!.countRows();

258258

}

259+260+

async getTable(): Promise<LanceDB.Table> {

261+

await this.ensureInitialized();

262+

return this.table!;

263+

}

259264

}

260265261266

// ============================================================================

@@ -815,6 +820,74 @@ export default definePluginEntry({

815820

console.log(JSON.stringify(output, null, 2));

816821

});

817822823+

memory

824+

.command("query")

825+

.description("Query memories (non-vector search)")

826+

.option("--cols <columns>", "Columns to select, comma-separated")

827+

.option("--filter <condition>", "Filter condition")

828+

.option("--limit <n>", "Limit number of results", "10")

829+

.option("--order-by <order>", "Order by column and direction (e.g., createdAt:desc)")

830+

.action(async (opts) => {

831+

const table = await db.getTable();

832+

let query = table.query();

833+

let sortColAdded = false;

834+

let sortColName: string | undefined;

835+

if (opts.cols) {

836+

const columns = (opts.cols as string).split(",").map((c: string) => c.trim());

837+

if (opts.orderBy) {

838+

const [sortCol] = opts.orderBy.split(":");

839+

sortColName = sortCol;

840+

if (!columns.includes(sortCol)) {

841+

columns.push(sortCol);

842+

sortColAdded = true;

843+

}

844+

}

845+

query = query.select(columns);

846+

} else {

847+

query = query.select(["id", "text", "importance", "category", "createdAt"]);

848+

}

849+

if (opts.filter) {

850+

const filterCondition = String(opts.filter);

851+

if (filterCondition.length > 200) {

852+

throw new Error("Filter condition exceeds maximum length of 200 characters");

853+

}

854+

if (!/^[a-zA-Z0-9_\-\s='"><!.,()%*]+$/.test(filterCondition)) {

855+

throw new Error("Filter condition contains invalid characters");

856+

}

857+

query = query.where(filterCondition);

858+

}

859+

const limit = Number.parseInt(opts.limit, 10);

860+

if (Number.isNaN(limit) || limit <= 0) {

861+

throw new Error("Invalid limit: must be a positive integer");

862+

}

863+864+

// Fetch all filtered rows first if we need to order them in memory

865+

if (!opts.orderBy) {

866+

query = query.limit(limit);

867+

}

868+

let rows = await query.toArray();

869+

if (opts.orderBy) {

870+

const [col, dir] = opts.orderBy.split(":");

871+

const direction = dir?.toLowerCase() === "desc" ? -1 : 1;

872+

rows.sort((a, b) => {

873+

if (a[col] < b[col]) {

874+

return -1 * direction;

875+

}

876+

if (a[col] > b[col]) {

877+

return 1 * direction;

878+

}

879+

return 0;

880+

});

881+

rows = rows.slice(0, limit);

882+

if (sortColAdded && sortColName) {

883+

for (const row of rows) {

884+

delete row[sortColName];

885+

}

886+

}

887+

}

888+

console.log(JSON.stringify(rows, null, 2));

889+

});

890+818891

memory

819892

.command("stats")

820893

.description("Show memory statistics")