feat: add memfs option to createAgent (#39)
Co-authored-by: Letta <noreply@letta.com>
This commit is contained in:
@@ -32,6 +32,7 @@ import { createAgent, resumeSession } from "@letta-ai/letta-code-sdk";
|
||||
|
||||
const agentId = await createAgent({
|
||||
persona: "You are a helpful coding assistant for TypeScript projects.",
|
||||
memfs: true, // Enable git-backed memory filesystem for this new agent
|
||||
});
|
||||
|
||||
await using session = resumeSession(agentId);
|
||||
|
||||
@@ -30,6 +30,7 @@ describe("transport args", () => {
|
||||
permissionMode?: "default" | "acceptEdits" | "plan" | "bypassPermissions";
|
||||
allowedTools?: string[];
|
||||
disallowedTools?: string[];
|
||||
memfs?: boolean;
|
||||
} = {}): string[] {
|
||||
const transport = new SubprocessTransport(options);
|
||||
// Access private helper for deterministic argument testing.
|
||||
@@ -66,4 +67,14 @@ describe("transport args", () => {
|
||||
expect(args).toContain("--disallowedTools");
|
||||
expect(args).toContain("EnterPlanMode,ExitPlanMode");
|
||||
});
|
||||
|
||||
test("memfs true forwards --memfs", () => {
|
||||
const args = buildArgsFor({ memfs: true });
|
||||
expect(args).toContain("--memfs");
|
||||
});
|
||||
|
||||
test("memfs false/undefined does not forward --memfs", () => {
|
||||
expect(buildArgsFor({ memfs: false })).not.toContain("--memfs");
|
||||
expect(buildArgsFor({})).not.toContain("--memfs");
|
||||
});
|
||||
});
|
||||
|
||||
@@ -367,6 +367,11 @@ export class SubprocessTransport {
|
||||
args.push("--tags", this.options.tags.join(","));
|
||||
}
|
||||
|
||||
// Memory filesystem
|
||||
if (this.options.memfs) {
|
||||
args.push("--memfs");
|
||||
}
|
||||
|
||||
return args;
|
||||
}
|
||||
|
||||
|
||||
@@ -211,6 +211,9 @@ export interface InternalSessionOptions {
|
||||
// Tags (only for new agents)
|
||||
tags?: string[];
|
||||
|
||||
// Memory filesystem (only for new agents)
|
||||
memfs?: boolean;
|
||||
|
||||
// Permissions
|
||||
allowedTools?: string[];
|
||||
disallowedTools?: string[];
|
||||
@@ -318,6 +321,12 @@ export interface CreateAgentOptions {
|
||||
|
||||
/** Tags to organize and categorize the agent */
|
||||
tags?: string[];
|
||||
|
||||
/**
|
||||
* Enable git-backed memory filesystem for this newly created agent.
|
||||
* Maps to Letta Code CLI `--memfs` during agent creation.
|
||||
*/
|
||||
memfs?: boolean;
|
||||
}
|
||||
|
||||
// ═══════════════════════════════════════════════════════════════
|
||||
|
||||
Reference in New Issue
Block a user