惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

J
Java Code Geeks
F
Fortinet All Blogs
Martin Fowler
Martin Fowler
M
MIT News - Artificial intelligence
G
Google Developers Blog
P
Proofpoint News Feed
Recent Announcements
Recent Announcements
MyScale Blog
MyScale Blog
D
DataBreaches.Net
Stack Overflow Blog
Stack Overflow Blog
月光博客
月光博客
爱范儿
爱范儿
罗磊的独立博客
腾讯CDC
Hugging Face - Blog
Hugging Face - Blog
博客园 - 叶小钗
Vercel News
Vercel News
酷 壳 – CoolShell
酷 壳 – CoolShell
B
Blog
C
Check Point Blog
美团技术团队
宝玉的分享
宝玉的分享
Microsoft Security Blog
Microsoft Security Blog
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻

Recent Commits to openclaw:main

test: merge chat side-result checks · openclaw/openclaw@ddd2c2a test: merge cron history checks · openclaw/openclaw@f7eb746 test: merge responsive navigation shell checks · openclaw/openclaw@c2e4b47 docs(changelog): add codex oauth fixes · openclaw/openclaw@628e6cd test: merge navigation routing cases · openclaw/openclaw@5d8cecb Tests: mock channel registry bundled fallback · openclaw/openclaw@2b08233 Secrets: avoid broad web search discovery for single plugin config · openclaw/openclaw@a464f59 test: merge config view browser checks · openclaw/openclaw@20cf511 fix(status): align oauth health with runtime · openclaw/openclaw@eed7116 feat: add macOS screen snapshots for monitor preview (#67954) thanks … · openclaw/openclaw@f377db1 fix: report shared auth scopes in hello-ok (#67810) thanks @BunsDev · openclaw/openclaw@0b6c39b Auto-reply: avoid eager bundled route fallback · openclaw/openclaw@3ea1bf4 Tests: narrow session binding contract setup · openclaw/openclaw@54e4e16 fix(macOS): enable undo/redo in webchat composer text input (#34962) · openclaw/openclaw@00951dc Tests: speed up channel setup promotion · openclaw/openclaw@82b529a Docs: refresh agent instructions · openclaw/openclaw@5775fe2 fix(auth): serialize OAuth refresh across agents to fix #26322 (#67876) · openclaw/openclaw@8e79080 test: allow ollama public surface boundary test · openclaw/openclaw@7d4f1a6 Docs: add test performance guardrails · openclaw/openclaw@89706d3 Tests: restore context-engine usage proof · openclaw/openclaw@e4c4f95 Tests: slim context engine runtime coverage · openclaw/openclaw@74c198f ci: retry failed custom checkouts · openclaw/openclaw@0ee5baf test: trim duplicate provider auth onboarding cases · openclaw/openclaw@1ffc02e matrix: fix sessions_spawn --thread subagent session spawning (#67643) · openclaw/openclaw@1ce2596 test: reduce auth choice fixture churn · openclaw/openclaw@857b9cd test: mock health status config boundaries · openclaw/openclaw@9d5ab4a test: mock onboard config io boundary · openclaw/openclaw@299694d test: mock legacy state plugin boundaries · openclaw/openclaw@2713089 test: mock channel install boundaries · openclaw/openclaw@b945248 test: mock doctor preview channel boundaries · openclaw/openclaw@b1a3ad4
docs: document remaining cli helpers · openclaw/openclaw@...
steipete · 2026-06-04 · via Recent Commits to openclaw:main

@@ -1,3 +1,4 @@

1+

// Camera payload validation and artifact writers for node media commands.

12

import * as fs from "node:fs/promises";

23

import * as path from "node:path";

34

import { fetchWithSsrFGuard } from "../infra/net/fetch-guard.js";

@@ -15,8 +16,10 @@ import {

1516

const MAX_CAMERA_URL_DOWNLOAD_BYTES = 250 * 1024 * 1024;

1617

const MAX_CAMERA_BASE64_BYTES = MAX_CAMERA_URL_DOWNLOAD_BYTES;

171819+

/** Camera orientation accepted by node camera commands. */

1820

export type CameraFacing = "front" | "back";

192122+

/** Validated still-image payload from `nodes camera snap`. */

2023

export type CameraSnapPayload = {

2124

format: string;

2225

base64?: string;

@@ -25,6 +28,7 @@ export type CameraSnapPayload = {

2528

height: number;

2629

};

273031+

/** Validated video payload from `nodes camera clip`. */

2832

export type CameraClipPayload = {

2933

format: string;

3034

base64?: string;

@@ -33,6 +37,7 @@ export type CameraClipPayload = {

3337

hasAudio: boolean;

3438

};

353940+

/** Validate and normalize an unknown camera still-image payload. */

3641

export function parseCameraSnapPayload(value: unknown): CameraSnapPayload {

3742

const obj = asRecord(value);

3843

const format = asString(obj.format);

@@ -46,6 +51,7 @@ export function parseCameraSnapPayload(value: unknown): CameraSnapPayload {

4651

return { format, ...(base64 ? { base64 } : {}), ...(url ? { url } : {}), width, height };

4752

}

485354+

/** Validate and normalize an unknown camera clip payload. */

4955

export function parseCameraClipPayload(value: unknown): CameraClipPayload {

5056

const obj = asRecord(value);

5157

const format = asString(obj.format);

@@ -59,6 +65,7 @@ export function parseCameraClipPayload(value: unknown): CameraClipPayload {

5965

return { format, ...(base64 ? { base64 } : {}), ...(url ? { url } : {}), durationMs, hasAudio };

6066

}

616768+

/** Build a deterministic temp path for a camera artifact. */

6269

export function cameraTempPath(opts: {

6370

kind: "snap" | "clip";

6471

facing?: CameraFacing;

@@ -76,6 +83,7 @@ export function cameraTempPath(opts: {

7683

return path.join(tmpDir, `${cliName}-camera-${opts.kind}${facingPart}-${id}${ext}`);

7784

}

788586+

/** Download a node-hosted media URL to disk after HTTPS, host, redirect, and size checks. */

7987

export async function writeUrlToFile(

8088

filePath: string,

8189

url: string,

@@ -95,6 +103,7 @@ export async function writeUrlToFile(

95103

);

96104

}

97105106+

// The node host is allowed even when private because the RPC response supplied its remote IP.

98107

const policy = {

99108

allowPrivateNetwork: true,

100109

allowedHostnames: [expectedHost],

@@ -184,6 +193,7 @@ function estimateDecodedBase64Bytes(base64: string): number {

184193

return Math.floor((normalized.length * 3) / 4) - padding;

185194

}

186195196+

/** Decode a base64 media payload to disk with preflight and post-decode size checks. */

187197

export async function writeBase64ToFile(

188198

filePath: string,

189199

base64: string,

@@ -201,6 +211,7 @@ export async function writeBase64ToFile(

201211

return { path: filePath, bytes: buf.length };

202212

}

203213214+

/** Require the node remote IP needed to validate URL-backed camera payloads. */

204215

export function requireNodeRemoteIp(remoteIp?: string): string {

205216

const normalized = remoteIp?.trim();

206217

if (!normalized) {

@@ -209,6 +220,7 @@ export function requireNodeRemoteIp(remoteIp?: string): string {

209220

return normalized;

210221

}

211222223+

/** Write either a URL-backed or base64-backed camera payload to disk. */

212224

export async function writeCameraPayloadToFile(params: {

213225

filePath: string;

214226

payload: { url?: string; base64?: string };

@@ -228,6 +240,7 @@ export async function writeCameraPayloadToFile(params: {

228240

throw new Error(params.invalidPayloadMessage ?? "invalid camera payload");

229241

}

230242243+

/** Write a camera clip payload to a generated temp file and return its path. */

231244

export async function writeCameraClipPayloadToFile(params: {

232245

payload: CameraClipPayload;

233246

facing: CameraFacing;