Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/cli/commands/import/__tests__/import-memory.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ function toMemorySpec(mem: ParsedStarterToolkitMemory): Memory {

return {
name: mem.name,
eventExpiryDuration: Math.max(7, Math.min(365, mem.eventExpiryDays)),
eventExpiryDuration: Math.max(3, Math.min(365, mem.eventExpiryDays)),
strategies,
};
}
Expand Down Expand Up @@ -408,7 +408,7 @@ describe('toMemorySpec', () => {
};

const result = toMemorySpec(mem);
expect(result.eventExpiryDuration).toBe(7);
expect(result.eventExpiryDuration).toBe(3);
});

it('clamps zero to minimum of 7', () => {
Expand All @@ -419,7 +419,7 @@ describe('toMemorySpec', () => {
};

const result = toMemorySpec(mem);
expect(result.eventExpiryDuration).toBe(7);
expect(result.eventExpiryDuration).toBe(3);
});

it('clamps negative values to minimum of 7', () => {
Expand All @@ -430,7 +430,7 @@ describe('toMemorySpec', () => {
};

const result = toMemorySpec(mem);
expect(result.eventExpiryDuration).toBe(7);
expect(result.eventExpiryDuration).toBe(3);
});

it('clamps high values to maximum of 365', () => {
Expand Down Expand Up @@ -473,7 +473,7 @@ describe('YAML Parsing: eventExpiryDays values', () => {

// But toMemorySpec should clamp it
const spec = toMemorySpec(parsed.memories[0]!);
expect(spec.eventExpiryDuration).toBe(7);
expect(spec.eventExpiryDuration).toBe(3);
} finally {
fs.unlinkSync(tmpFile);
}
Expand Down
4 changes: 2 additions & 2 deletions src/cli/commands/import/__tests__/merge-logic.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ function toMemorySpec(mem: ParsedStarterToolkitConfig['memories'][0]): Memory {
}
return {
name: mem.name,
eventExpiryDuration: Math.max(7, Math.min(365, mem.eventExpiryDays)),
eventExpiryDuration: Math.max(3, Math.min(365, mem.eventExpiryDays)),
strategies,
};
}
Expand Down Expand Up @@ -194,7 +194,7 @@ describe('source copy skip logic', () => {
describe('toMemorySpec', () => {
it('clamps below 7', () => {
const mem: ParsedStarterToolkitConfig['memories'][0] = { name: 't', mode: 'STM_ONLY', eventExpiryDays: 1 };
expect(toMemorySpec(mem).eventExpiryDuration).toBe(7);
expect(toMemorySpec(mem).eventExpiryDuration).toBe(3);
});
it('clamps above 365', () => {
const mem: ParsedStarterToolkitConfig['memories'][0] = { name: 't', mode: 'STM_ONLY', eventExpiryDays: 999 };
Expand Down
2 changes: 1 addition & 1 deletion src/cli/commands/import/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ function toMemorySpec(mem: ParsedStarterToolkitConfig['memories'][0]): Memory {

return {
name: mem.name,
eventExpiryDuration: Math.max(7, Math.min(365, mem.eventExpiryDays)),
eventExpiryDuration: Math.max(3, Math.min(365, mem.eventExpiryDays)),
strategies,
};
}
Expand Down
2 changes: 1 addition & 1 deletion src/cli/commands/import/import-memory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ function toMemorySpec(memory: MemoryDetail, localName: string): Memory {

return {
name: localName,
eventExpiryDuration: Math.max(7, Math.min(365, memory.eventExpiryDuration)),
eventExpiryDuration: Math.max(3, Math.min(365, memory.eventExpiryDuration)),
strategies,
...(memory.tags && Object.keys(memory.tags).length > 0 && { tags: memory.tags }),
...(memory.encryptionKeyArn && { encryptionKeyArn: memory.encryptionKeyArn }),
Expand Down
2 changes: 1 addition & 1 deletion src/schema/llm-compacted/agentcore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ interface EnvVar {

interface Memory {
name: string; // @regex ^[a-zA-Z][a-zA-Z0-9_]{0,47}$ @max 48
eventExpiryDuration: number; // @min 7 @max 365 (days)
eventExpiryDuration: number; // @min 3 @max 365 (days)
strategies: MemoryStrategy[]; // @min 1, unique by type
tags?: Record<string, string>;
}
Expand Down
8 changes: 4 additions & 4 deletions src/schema/schemas/__tests__/agentcore-project.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,10 +137,10 @@ describe('MemorySchema', () => {
}
});

it('rejects eventExpiryDuration below 7', () => {
it('rejects eventExpiryDuration below 3', () => {
const result = MemorySchema.safeParse({
name: 'Test',
eventExpiryDuration: 6,
eventExpiryDuration: 2,
strategies: [],
});
expect(result.success).toBe(false);
Expand All @@ -155,11 +155,11 @@ describe('MemorySchema', () => {
expect(result.success).toBe(false);
});

it('accepts eventExpiryDuration boundary values (7 and 365)', () => {
it('accepts eventExpiryDuration boundary values (3 and 365)', () => {
expect(
MemorySchema.safeParse({
name: 'Min',
eventExpiryDuration: 7,
eventExpiryDuration: 3,
strategies: [],
}).success
).toBe(true);
Expand Down
2 changes: 1 addition & 1 deletion src/schema/schemas/agentcore-project.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ export type StreamDeliveryResources = z.infer<typeof StreamDeliveryResourcesSche

export const MemorySchema = z.object({
name: MemoryNameSchema,
eventExpiryDuration: z.number().int().min(7).max(365),
eventExpiryDuration: z.number().int().min(3).max(365),
// Strategies array can be empty for short-term memory (just base memory with expiration)
// Long-term memory includes strategies like SEMANTIC, SUMMARIZATION, USER_PREFERENCE
strategies: z
Expand Down
Loading