feat: update skills (migrating-memory, agent-finder, message-search) (#458)
Co-authored-by: Letta <noreply@letta.com>
This commit is contained in:
@@ -1,12 +1,14 @@
|
||||
/**
|
||||
* Shell environment utilities
|
||||
* Provides enhanced environment variables for shell execution,
|
||||
* including bundled tools like ripgrep in PATH.
|
||||
* including bundled tools like ripgrep in PATH and Letta context for skill scripts.
|
||||
*/
|
||||
|
||||
import { createRequire } from "node:module";
|
||||
import * as path from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
import { getCurrentAgentId } from "../../agent/context";
|
||||
import { settingsManager } from "../../settings-manager";
|
||||
|
||||
/**
|
||||
* Get the directory containing the bundled ripgrep binary.
|
||||
@@ -26,7 +28,7 @@ function getRipgrepBinDir(): string | undefined {
|
||||
|
||||
/**
|
||||
* Get enhanced environment variables for shell execution.
|
||||
* Includes bundled tools (like ripgrep) in PATH.
|
||||
* Includes bundled tools (like ripgrep) in PATH and Letta context for skill scripts.
|
||||
*/
|
||||
export function getShellEnv(): NodeJS.ProcessEnv {
|
||||
const env = { ...process.env };
|
||||
@@ -38,5 +40,24 @@ export function getShellEnv(): NodeJS.ProcessEnv {
|
||||
env.PATH = `${rgBinDir}${path.delimiter}${currentPath}`;
|
||||
}
|
||||
|
||||
// Add Letta context for skill scripts
|
||||
try {
|
||||
env.LETTA_AGENT_ID = getCurrentAgentId();
|
||||
} catch {
|
||||
// Context not set yet (e.g., during startup), skip
|
||||
}
|
||||
|
||||
// Inject API key from settings if not already in env
|
||||
if (!env.LETTA_API_KEY) {
|
||||
try {
|
||||
const settings = settingsManager.getSettings();
|
||||
if (settings.env?.LETTA_API_KEY) {
|
||||
env.LETTA_API_KEY = settings.env.LETTA_API_KEY;
|
||||
}
|
||||
} catch {
|
||||
// Settings not initialized yet, skip
|
||||
}
|
||||
}
|
||||
|
||||
return env;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user