mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-08 17:50:43 +00:00
Let route-question searches match people-routing metadata from natural-language prompts, and allow wiki_apply evidence provenance fields that the markdown parser already supports.
27 lines
1.2 KiB
TypeScript
27 lines
1.2 KiB
TypeScript
import { describe, expect, it } from "vitest";
|
|
import type { ResolvedMemoryWikiConfig } from "./config.js";
|
|
import { createWikiApplyTool } from "./tool.js";
|
|
|
|
function asSchemaObject(value: unknown): Record<string, unknown> {
|
|
expect(value).toEqual(expect.any(Object));
|
|
return value as Record<string, unknown>;
|
|
}
|
|
|
|
describe("memory-wiki tools", () => {
|
|
it("allows provenance metadata in wiki_apply claim evidence", () => {
|
|
const tool = createWikiApplyTool({} as ResolvedMemoryWikiConfig);
|
|
const applyProperties = asSchemaObject(asSchemaObject(tool.parameters).properties);
|
|
const claimsSchema = asSchemaObject(applyProperties.claims);
|
|
const claimSchema = asSchemaObject(claimsSchema.items);
|
|
const claimProperties = asSchemaObject(claimSchema.properties);
|
|
const evidenceSchema = asSchemaObject(claimProperties.evidence);
|
|
const evidenceArraySchema = asSchemaObject(evidenceSchema.items);
|
|
const evidenceProperties = asSchemaObject(evidenceArraySchema.properties);
|
|
|
|
expect(Object.keys(evidenceProperties)).toEqual(
|
|
expect.arrayContaining(["kind", "confidence", "privacyTier"]),
|
|
);
|
|
expect(evidenceProperties.confidence).toMatchObject({ minimum: 0, maximum: 1 });
|
|
});
|
|
});
|