refactor(agents): narrow internal helper exports

This commit is contained in:
Vincent Koc
2026-06-17 08:28:11 +08:00
parent 8432d7d624
commit 76cd61a903
3 changed files with 10 additions and 10 deletions
+2 -2
View File
@@ -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;
};
+4 -4
View File
@@ -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;
}
+4 -4
View File
@@ -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();
}