Skip to content

Garry's Opinionated OpenClaw/Hermes Agent Brain

TypeScript

Merge remote-tracking branch 'origin/capy/gbra155-entity-recall' into capy/gbra155-remember-receipt

garrytanc1aa834240bd
diff --cc src/core/persistence/memory-mutations.ts
index b5eda3e501,d9edb4720c..fbe4446131
--- a/src/core/persistence/memory-mutations.ts
+++ b/src/core/persistence/memory-mutations.ts
@@@ -156,10 -176,11 +176,11 @@@ async function inferRememberTarget(ctx
}
}
- export async function submitRememberMutation(ctx: OperationContext, params: Record<string, unknown>, waitMs?: number): Promise<Record<string, unknown>> {
+ export async function submitRememberMutation(ctx: OperationContext, params: Record<string, unknown>, waitMs?: number,
+ opts: { visibilityDefaulted?: boolean } = {}): Promise<Record<string, unknown>> {
registerMutationPreparer('remember', prepareMemoryMutation);
const sub = await submission(ctx, 'remember', params);
- if (sub.prior) return throwIfHeld(writeResponse(await waitForWrite(ctx.engine, sub.prior, ctx.config, waitMs ?? ctx.writeWaitMs)));
+ if (sub.prior) { const prior = sub.prior; const settled = await waitForWrite(ctx.engine, prior, ctx.config, waitMs ?? ctx.writeWaitMs); return throwIfHeld(withRememberTarget(prior, () => writeResponse(settled))); }
const { p, sourceId, principal, callerIntent, requestId, clientRequestId } = sub;
const [source] = await ctx.engine.executeRaw<RememberSource>(
"SELECT incarnation,archived,local_path,config->>'kind' AS kind FROM sources WHERE id=$1", [sourceId]);
@@@ -167,8 -188,10 +188,9 @@@
const { parseTtlParam } = await import('../ops/facts.ts');
const validUntil = parseTtlParam(p.ttl);
const entity = typeof p.entity === 'string' && !isNullLikeEntity(p.entity) ? p.entity.trim() : null;
- const { resolveEntitySlugWithSource } = await import('../entities/resolve.ts');
- const resolved = entity ? await resolveEntitySlugWithSource(ctx.engine, sourceId, entity) : null;
+ const resolved = entity ? await resolveRememberEntity(ctx, sourceId, entity) : null;
- const inference = entity === null ? await inferRememberTarget(ctx, sourceId, source, p) : null;
+ const call: RememberCall = { p, visibilityDefaulted: opts.visibilityDefaulted === true };
+ const inference = entity === null ? await inferRememberTarget(ctx, sourceId, source, call) : null;
const linked = inference && 'target' in inference ? inference : null;
const entitySlug = linked?.target.slug ?? resolved?.slug ?? null;
// A source-scoped absent identity serializes subjectless facts. Bound writers