mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-24 03:15:46 -06:00
refactor(agents): narrow internal helper exports
This commit is contained in:
@@ -17,10 +17,10 @@ type AgentOAuthCredential = {
|
||||
};
|
||||
|
||||
/** Credential value shape consumed by agent runtimes after auth-profile normalization. */
|
||||
export type AgentCredential = AgentApiKeyCredential | AgentOAuthCredential;
|
||||
type AgentCredential = AgentApiKeyCredential | AgentOAuthCredential;
|
||||
export type AgentCredentialMap = Record<string, AgentCredential>;
|
||||
|
||||
export type ResolveAgentCredentialMapOptions = {
|
||||
type ResolveAgentCredentialMapOptions = {
|
||||
includeSecretRefPlaceholders?: boolean;
|
||||
};
|
||||
|
||||
|
||||
@@ -25,10 +25,10 @@ function clampTtl(value: number | undefined) {
|
||||
let jobTtlMs = clampTtl(readEnvInt("OPENCLAW_BASH_JOB_TTL_MS", "PI_BASH_JOB_TTL_MS"));
|
||||
|
||||
/** Lifecycle status recorded for background process sessions. */
|
||||
export type ProcessStatus = "running" | "completed" | "failed" | "killed";
|
||||
type ProcessStatus = "running" | "completed" | "failed" | "killed";
|
||||
|
||||
/** Writable stdin surface shared by child-process and PTY-backed sessions. */
|
||||
export type SessionStdin = {
|
||||
type SessionStdin = {
|
||||
write: (data: string, cb?: (err?: Error | null) => void) => void;
|
||||
end: () => void;
|
||||
// When backed by a real Node stream (child.stdin), this exists; for PTY wrappers it may not.
|
||||
@@ -87,7 +87,7 @@ export interface ProcessSession {
|
||||
}
|
||||
|
||||
/** Retained summary for a completed background session. */
|
||||
export interface FinishedSession {
|
||||
interface FinishedSession {
|
||||
id: string;
|
||||
command: string;
|
||||
scopeKey?: string;
|
||||
@@ -306,7 +306,7 @@ function capPendingBuffer(buffer: string[], pendingCharsInput: number, cap: numb
|
||||
}
|
||||
|
||||
/** Keeps only the last `max` characters for bounded aggregate output storage. */
|
||||
export function trimWithCap(text: string, max: number) {
|
||||
function trimWithCap(text: string, max: number) {
|
||||
if (text.length <= max) {
|
||||
return text;
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ export const isBunBinary =
|
||||
* - For Node.js (dist/): returns currentDir (the dist/ directory)
|
||||
* - For tsx (src/): returns parent directory (the package root)
|
||||
*/
|
||||
export function getPackageDir(): string {
|
||||
function getPackageDir(): string {
|
||||
// Allow override via environment variable (useful for Nix/Guix where store paths tokenize poorly)
|
||||
const envDir = process.env.OPENCLAW_PACKAGE_DIR;
|
||||
if (envDir) {
|
||||
@@ -83,7 +83,7 @@ export function getThemesDir(): string {
|
||||
}
|
||||
|
||||
/** Get path to package.json */
|
||||
export function getPackageJsonPath(): string {
|
||||
function getPackageJsonPath(): string {
|
||||
return join(getPackageDir(), "package.json");
|
||||
}
|
||||
|
||||
@@ -122,9 +122,9 @@ export const APP_NAME: string = openClawConfigName || "openclaw";
|
||||
export const CONFIG_DIR_NAME: string = pkg.openclawConfig?.configDir || ".openclaw";
|
||||
export const VERSION: string = pkg.version || "0.0.0";
|
||||
|
||||
export const ENV_AGENT_DIR = `${APP_NAME.toUpperCase()}_AGENT_DIR`;
|
||||
const ENV_AGENT_DIR = `${APP_NAME.toUpperCase()}_AGENT_DIR`;
|
||||
|
||||
export function expandTildePath(path: string): string {
|
||||
function expandTildePath(path: string): string {
|
||||
if (path === "~") {
|
||||
return homedir();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user