Skip to content

Commit 35b27aa

Browse files
Ubunturendrag-git
authored andcommitted
fix(memory): trim reserved ID check, verbose/diagnostics in --shared path, guard sync no-op
1 parent 776eb09 commit 35b27aa

2 files changed

Lines changed: 9 additions & 4 deletions

File tree

src/cli/memory-cli.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -631,22 +631,27 @@ export function registerMemoryCli(program: Command) {
631631
.option("--shared", "Index only the shared memory store", false)
632632
.option("--verbose", "Verbose logging", false)
633633
.action(async (opts: MemoryCommandOptions & { shared?: boolean }) => {
634+
setVerbose(Boolean(opts.verbose));
634635
// Handle --shared: sync only the shared store
635636
if (opts.shared) {
636637
const { SHARED_AGENT_ID } = await import("../memory/shared-constants.js");
637-
const { config: cfg } = await loadMemoryCommandConfig("memory index");
638+
const { config: cfg, diagnostics } = await loadMemoryCommandConfig("memory index");
639+
emitMemorySecretResolveDiagnostics(diagnostics);
638640
await withMemoryManagerForAgent({
639641
cfg,
640642
agentId: SHARED_AGENT_ID,
641643
run: async (manager) => {
644+
if (!manager.sync) {
645+
defaultRuntime.log("Shared store sync not available.");
646+
return;
647+
}
642648
defaultRuntime.log("Syncing shared memory store…");
643-
await manager.sync?.({ reason: "cli", force: Boolean(opts.force) });
649+
await manager.sync({ reason: "cli", force: Boolean(opts.force) });
644650
defaultRuntime.log("Shared store synced.");
645651
},
646652
});
647653
return;
648654
}
649-
setVerbose(Boolean(opts.verbose));
650655
const { config: cfg, diagnostics } = await loadMemoryCommandConfig("memory index");
651656
emitMemorySecretResolveDiagnostics(diagnostics);
652657
const agentIds = resolveAgentIds(cfg, opts.agent);

src/config/zod-schema.agent-runtime.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -782,7 +782,7 @@ export const RESERVED_AGENT_IDS = new Set([SHARED_AGENT_ID]);
782782

783783
export const AgentEntrySchema = z
784784
.object({
785-
id: z.string().refine((id) => !RESERVED_AGENT_IDS.has(id.toLowerCase()), {
785+
id: z.string().refine((id) => !RESERVED_AGENT_IDS.has(id.trim().toLowerCase()), {
786786
message: 'Agent ID "_shared" is reserved for the shared memory store',
787787
}),
788788
default: z.boolean().optional(),

0 commit comments

Comments
 (0)