File size: 1,191 Bytes
e249c6d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import type { ClaudeCliFallbackSeed } from "../../gateway/cli-session-history.js";
import "./attempt-execution.helpers.js";

type AttemptExecutionHelpersTestApi = {
  claudeCliSessionTranscriptPath(params: {
    sessionId: string | undefined;
    workspaceDir: string | undefined;
    homeDir?: string;
  }): string | null;
  formatClaudeCliFallbackPrelude(
    seed: ClaudeCliFallbackSeed,
    options?: { charBudget?: number },
  ): string;
};

function getTestApi(): AttemptExecutionHelpersTestApi {
  const api = (globalThis as Record<PropertyKey, unknown>)[
    Symbol.for("openclaw.attemptExecutionHelpersTestApi")
  ];
  if (!api) {
    throw new Error("attempt execution helpers test API is unavailable");
  }
  return api as AttemptExecutionHelpersTestApi;
}

export function claudeCliSessionTranscriptPath(
  params: Parameters<AttemptExecutionHelpersTestApi["claudeCliSessionTranscriptPath"]>[0],
): string | null {
  return getTestApi().claudeCliSessionTranscriptPath(params);
}

export function formatClaudeCliFallbackPrelude(
  seed: ClaudeCliFallbackSeed,
  options?: { charBudget?: number },
): string {
  return getTestApi().formatClaudeCliFallbackPrelude(seed, options);
}