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

推荐订阅源

G
Google Developers Blog
博客园 - 聂微东
J
Java Code Geeks
Engineering at Meta
Engineering at Meta
Jina AI
Jina AI
D
Docker
B
Blog
S
SegmentFault 最新的问题
宝玉的分享
宝玉的分享
D
DataBreaches.Net
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
Y
Y Combinator Blog
N
Netflix TechBlog - Medium
月光博客
月光博客
F
Fortinet All Blogs
爱范儿
爱范儿
H
Help Net Security
腾讯CDC
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
WordPress大学
WordPress大学
The Cloudflare Blog
有赞技术团队
有赞技术团队
T
Tailwind CSS Blog
U
Unit 42

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 gateway mcp helpers · openclaw/openclaw@1e...
steipete · 2026-06-05 · via Recent Commits to openclaw:main
Original file line numberDiff line numberDiff line change

@@ -1,3 +1,5 @@

1+

// OpenAI-compatible embeddings HTTP endpoint.

2+

// Bridges /v1/embeddings requests to configured OpenClaw memory providers.

13

import { Buffer } from "node:buffer";

24

import type { IncomingMessage, ServerResponse } from "node:http";

35

import {

@@ -80,6 +82,7 @@ function resolveInputTexts(input: unknown): string[] | null {

8082

}

8183
8284

function encodeEmbeddingBase64(embedding: number[]): string {

85+

// OpenAI-compatible base64 embeddings are raw float32 bytes, not JSON.

8386

const float32 = Float32Array.from(embedding);

8487

return Buffer.from(float32.buffer).toString("base64");

8588

}

Original file line numberDiff line numberDiff line change

@@ -1,3 +1,5 @@

1+

// MCP loopback HTTP request helpers.

2+

// Authenticates local MCP POST requests and extracts scoped Gateway context.

13

import type { IncomingMessage, ServerResponse } from "node:http";

24

import { normalizeOptionalString } from "@openclaw/normalization-core/string-coerce";

35

import type { SourceReplyDeliveryMode } from "../auto-reply/get-reply-options.types.js";

@@ -176,6 +178,8 @@ export async function readMcpHttpBody(req: IncomingMessage): Promise<string> {

176178

const chunks: Buffer[] = [];

177179

let received = 0;

178180

let settled = false;

181+

// Remove listeners on every terminal path; oversized bodies keep the error

182+

// listener briefly so Node can deliver the pause/error safely.

179183

const cleanup = (options?: { keepErrorListener?: boolean }) => {

180184

req.off("data", onData);

181185

req.off("end", onEnd);

Original file line numberDiff line numberDiff line change

@@ -1,3 +1,5 @@

1+

// MCP loopback runtime scope cache.

2+

// Resolves Gateway-visible tools for MCP clients with short-lived schema caching.

13

import type { SourceReplyDeliveryMode } from "../auto-reply/get-reply-options.types.js";

24

import type { InboundEventKind } from "../channels/inbound-event/kind.js";

35

import type { OpenClawConfig } from "../config/types.openclaw.js";

Original file line numberDiff line numberDiff line change

@@ -1,3 +1,5 @@

1+

// MCP loopback tool schema projection.

2+

// Converts gateway-scoped tools into MCP tools/list-compatible schemas.

13

import { isRecord } from "@openclaw/normalization-core/record-coerce";

24

import { uniqueValues } from "@openclaw/normalization-core/string-normalization";

35

import { logWarn } from "../logger.js";

@@ -56,6 +58,8 @@ function readLoopbackToolParameters(tool: McpLoopbackTool): Record<string, unkno

5658

}

5759
5860

function flattenUnionSchema(raw: Record<string, unknown>): Record<string, unknown> {

61+

// MCP clients vary in union-schema support. Merge only safe object variants

62+

// and keep common required fields so generated forms remain usable.

5963

const variants = (raw.anyOf ?? raw.oneOf) as unknown[] | undefined;

6064

if (!Array.isArray(variants) || variants.length === 0) {

6165

return raw;

Original file line numberDiff line numberDiff line change

@@ -1,3 +1,5 @@

1+

// MCP loopback HTTP server.

2+

// Exposes Gateway-scoped tools to local MCP clients over bearer-auth loopback.

13

import crypto from "node:crypto";

24

import {

35

createServer as createHttpServer,

@@ -207,6 +209,8 @@ export async function startMcpLoopbackServer(port = 0): Promise<{

207209

if (!address || typeof address === "string") {

208210

throw new Error("mcp loopback did not bind to a TCP port");

209211

}

212+

// Register tokens only after the TCP listener is live so clients never learn

213+

// a bearer token for a server that failed to bind.

210214

setActiveMcpLoopbackRuntime({ port: address.port, ownerToken, nonOwnerToken });

211215

logDebug(`mcp loopback listening on 127.0.0.1:${address.port}`);

212216
Original file line numberDiff line numberDiff line change

@@ -1,3 +1,5 @@

1+

// OpenResponses file-content boundary helper.

2+

// Marks uploaded/read file text as untrusted external model input.

13

import { wrapExternalContent } from "../security/external-content.js";

24
35

// OpenResponses file content is untrusted model input. The wrapper preserves