Documentation Index
Fetch the complete documentation index at: https://docs.therefrain.ai/llms.txt
Use this file to discover all available pages before exploring further.
設定型
RefrainConfig
LocalConfig のエイリアス。プロパティ一覧はローカル実行を参照。
interface RefrainConfig {
ai: AIModelConfig;
headless?: boolean;
loggerFactory?: LoggerFactory;
debug?: boolean;
apiKey?: string;
locale?: "en" | "ja";
stealth?: boolean;
proxy?: string | { server: string; username?: string; password?: string };
}
AIModelConfig
interface AIModelConfig {
modelId: string;
provider: ModelProvider;
apiKey?: string;
baseURL?: string;
azureResourceName?: string;
azureApiVersion?: string;
bedrockRegion?: string;
bedrockAccessKeyId?: string;
bedrockSecretAccessKey?: string;
bedrockSessionToken?: string;
vertexProject?: string;
vertexLocation?: string;
modelOverrides?: Partial<Record<ModelPurpose, string>>;
}
ModelProvider
type ModelProvider =
| "anthropic"
| "openai"
| "openai-compatible"
| "google"
| "azure"
| "bedrock"
| "vertex";
ModelPurpose
type ModelPurpose =
| "exploration"
| "exploration-light"
| "selector"
| "extraction"
| "review"
| "fallback"
| "vision";
ExecuteOptions
プロパティ一覧はローカル実行を参照。
ExecutionStrategy
interface ExecutionStrategy {
maxRetries: number;
changeTimeouts: number[];
finalRetryStabilizeMs: number;
domStabilityMs: number;
}
結果型
ExecutionReport
interface ExecutionReport {
runbookTitle: string;
startUrl: string;
totalSteps: number;
executed: number;
succeeded: number;
failed: number;
skipped: number;
aborted: boolean;
steps: StepExecutionResult[];
totalDurationMs: number;
memoryCollections?: Record<string, number>;
downloadedFiles?: string[];
videoPaths?: string[];
aiMetrics?: AIMetricsSummary;
}
StepExecutionResult
interface StepExecutionResult {
ordinal: number;
description: string;
status: StepStatus;
durationMs: number;
error?: string;
capturedValues?: Record<string, string>;
actionType?: string;
// 条件・ループフィールド
conditionSkipped?: boolean;
loopIterations?: number;
subStepResults?: StepExecutionResult[][];
branchMatch?: string;
forEachItemCount?: number;
// 自己修復フィールド
retryCount?: number;
retryDetails?: StepRetryDetail[];
failureCategory?: FailureCategory;
// 出力フィールド
extractedData?: string;
downloadedFile?: string;
exportedFile?: string;
// 診断情報
diagnostics?: StepDiagnostics;
// テレメトリ
resolveMethod?: "cache" | "deterministic" | "ai" | "scroll" | "vision" | "agent" | null;
deterministicMatchType?: string;
deterministicConfidence?: number;
contextChunksUsed?: number;
failureHintsProvided?: boolean;
workingMemoryTokens?: number;
snapshotElementCount?: number;
}
StepStatus
type StepStatus = "success" | "failed" | "skipped";
StepDiagnostics
失敗したステップに付与される詳細な失敗情報:
interface StepDiagnostics {
lastSnapshotPreview?: string;
failureHistory?: string[];
lastAiResponseText?: string;
recoveryHint?: string;
deterministicResolveResult?: string;
visionFallbackResult?: {
annotationCount: number;
reasoning: string;
success: boolean;
};
agentFallbackResult?: {
strategy: string;
analysis: string;
reasoning: string;
success: boolean;
};
validationWarnings?: string[];
validationErrors?: string[];
executionStrategy?: ExecutionStrategy;
stepAction?: { type: string; selector?: any; value?: string; url?: string };
stepUrl?: string;
}
BatchExecutionReport
interface BatchExecutionReport {
runbookTitle: string;
totalRows: number;
succeeded: number;
failed: number;
rows: {
rowIndex: number;
rowLabel: string;
report: ExecutionReport;
}[];
totalDurationMs: number;
}
手順書型
ParsedRunbook
Zod スキーマから推論。フィールドの説明は手順書 YAML を参照。
ParsedStep / StepAction / Selector
アクション、セレクタを参照。
ActionType
type ActionType =
| "click" | "input" | "select" | "navigate"
| "scroll" | "wait" | "hover" | "extract"
| "download" | "export" | "memory" | "key";
RiskLevel
type RiskLevel = "low" | "medium" | "high";
VariableSource
type VariableSource = "prompt" | "fixed" | "context" | "env" | "expression" | "data";
CaptureStrategy
type CaptureStrategy = "snapshot" | "url" | "ai" | "expression" | "evaluate";
ロガー型
Logger
interface Logger {
step(message: string): void;
success(message: string): void;
error(message: string): void;
warn(message: string): void;
info(message: string): void;
debug(message: string): void;
}
LoggerFactory
interface LoggerFactory {
createLogger(): Logger;
createSpinner(): SpinnerLike;
}
SpinnerLike
interface SpinnerLike {
start(message: string): void;
stop(message: string): void;
}
CallbackLogger
全メッセージをコールバックに転送するカスタムロガー:
import { CallbackLogger } from "@refrainai/sdk";
const logger = new CallbackLogger((level, message) => {
// level: "step" | "success" | "error" | "warn" | "info" | "debug"
console.log(`[${level}] ${message}`);
});
LogLevel
type LogLevel = "step" | "success" | "error" | "warn" | "info" | "debug";
ユーティリティ型
interface ResolveVariablesInput {
secrets?: Record<string, string>;
contextMarkdown: string;
}
ResolveVariablesResult
interface ResolveVariablesResult {
variables: Record<string, string>;
secrets: Record<string, string>;
}
プラン型
Plan
interface Plan {
tier: PlanTier;
limits: PlanLimits;
features: PlanFeatures;
}
PlanTier
type PlanTier = "community" | "pro" | "team" | "business" | "enterprise";
PlanLimitError / PlanFeatureError
プラン制限またはフィーチャーゲートに到達した場合にスローされます:
try {
await client.execute(runbook, options);
} catch (e) {
if (e instanceof PlanLimitError) {
console.error(`制限超過: ${e.limitType}`);
}
if (e instanceof PlanFeatureError) {
console.error(`機能利用不可: ${e.message}`);
}
}
その他の型
| 型 | 説明 |
|---|
DataStore | メモリデータコレクションのインターフェース |
DataAggregator | データ集約クエリのインターフェース |
InMemoryDataStore | 組み込みインメモリデータストア |
DownloadManager | ファイルダウンロードと CSV マージユーティリティ |
DownloadRecord | ダウンロードメタデータ |
AggregateOperation | "sum" | "count" | "concat" | "min" | "max" | "avg" | "unique_count" |
Locale | "en" | "ja" |
MeteringCollector | 使用量メータリングインターフェース |
NoopMeteringCollector | No-op メータリング実装 |