Files
openclaw-zero-token/cli/nodes-screen.ts
sjhu 571e14a236 feat: upgrade to upstream v2026.3.28
Major upgrade from e26988a38 to upstream v2026.3.28 (f9b107928).
Key changes:
- Upstream src/, ui/, extensions/ (89 bundled extensions)
- Zero-token web providers preserved in src/zero-token/
- AskOnce plugin restored and registered as CLI command
- Added missing packages: @anthropic-ai/vertex-sdk, @modelcontextprotocol/sdk
- Fixed tsconfig rootDir, skipLibCheck for plugin-sdk DTS build
- Added askonce to bundled plugin metadata and package.json exports
- Fixed AskOnce CLI command registration (missing commands metadata)
- Restored AskOnce adapter imports (correct 5-level relative paths)
- Removed stale migration artifacts from root directory
2026-03-30 17:58:12 +08:00

39 lines
1.3 KiB
TypeScript

import * as path from "node:path";
import { writeBase64ToFile } from "./nodes-camera.js";
import { asRecord, asString, resolveTempPathParts } from "./nodes-media-utils.js";
export type ScreenRecordPayload = {
format: string;
base64: string;
durationMs?: number;
fps?: number;
screenIndex?: number;
hasAudio?: boolean;
};
export function parseScreenRecordPayload(value: unknown): ScreenRecordPayload {
const obj = asRecord(value);
const format = asString(obj.format);
const base64 = asString(obj.base64);
if (!format || !base64) {
throw new Error("invalid screen.record payload");
}
return {
format,
base64,
durationMs: typeof obj.durationMs === "number" ? obj.durationMs : undefined,
fps: typeof obj.fps === "number" ? obj.fps : undefined,
screenIndex: typeof obj.screenIndex === "number" ? obj.screenIndex : undefined,
hasAudio: typeof obj.hasAudio === "boolean" ? obj.hasAudio : undefined,
};
}
export function screenRecordTempPath(opts: { ext: string; tmpDir?: string; id?: string }) {
const { tmpDir, id, ext } = resolveTempPathParts(opts);
return path.join(tmpDir, `openclaw-screen-record-${id}${ext}`);
}
export async function writeScreenRecordToFile(filePath: string, base64: string) {
return writeBase64ToFile(filePath, base64);
}