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

推荐订阅源

Blog — PlanetScale
Blog — PlanetScale
Vercel News
Vercel News
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
量子位
Y
Y Combinator Blog
IT之家
IT之家
博客园 - 聂微东
L
LangChain Blog
爱范儿
爱范儿
H
Help Net Security
GbyAI
GbyAI
F
Fortinet All Blogs
B
Blog
Microsoft Security Blog
Microsoft Security Blog
罗磊的独立博客
C
Check Point Blog
博客园 - 三生石上(FineUI控件)
小众软件
小众软件
D
DataBreaches.Net
Last Week in AI
Last Week in AI
WordPress大学
WordPress大学
B
Blog RSS Feed
酷 壳 – CoolShell
酷 壳 – CoolShell
宝玉的分享
宝玉的分享

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
refactor: share node pairing surface helpers · openclaw/o...
vincentkoc · 2026-05-29 · via Recent Commits to openclaw:main
11

import type { ConnectParams } from "../../packages/gateway-protocol/src/index.js";

22

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

3+

import {

4+

normalizeNodeApprovalSurfaceList,

5+

sameNodeApprovalSurfaceSet,

6+

sameNodePermissionSurface,

7+

} from "../infra/node-pairing-surface.js";

38

import type {

49

NodePairingPairedNode,

510

NodePairingRequestInput,

611

RequestNodePairingResult,

712

} from "../infra/node-pairing.js";

8-

import { normalizeArrayBackedTrimmedStringList } from "../shared/string-normalization.js";

913

import {

1014

normalizeDeclaredNodeCommands,

1115

resolveNodeCommandAllowlist,

@@ -33,27 +37,6 @@ function resolveApprovedReconnectCommands(params: {

3337

});

3438

}

353936-

function normalizeApprovalSurfaceList(value: readonly string[] | undefined): string[] {

37-

return normalizeArrayBackedTrimmedStringList(value) ?? [];

38-

}

39-40-

function sameApprovalSurfaceSet(

41-

left: readonly string[] | undefined,

42-

right: readonly string[] | undefined,

43-

): boolean {

44-

const normalizedLeft = new Set(normalizeApprovalSurfaceList(left));

45-

const normalizedRight = new Set(normalizeApprovalSurfaceList(right));

46-

if (normalizedLeft.size !== normalizedRight.size) {

47-

return false;

48-

}

49-

for (const entry of normalizedLeft) {

50-

if (!normalizedRight.has(entry)) {

51-

return false;

52-

}

53-

}

54-

return true;

55-

}

56-5740

function normalizePermissionMap(

5841

value: Record<string, boolean> | undefined,

5942

): Record<string, boolean> | undefined {

@@ -66,31 +49,12 @@ function normalizePermissionMap(

6649

return entries.length > 0 ? Object.fromEntries(entries) : undefined;

6750

}

685169-

function samePermissions(

70-

left: Record<string, boolean> | undefined,

71-

right: Record<string, boolean> | undefined,

72-

): boolean {

73-

const leftEntries = Object.entries(left ?? {}).toSorted(([leftKey], [rightKey]) =>

74-

leftKey.localeCompare(rightKey),

75-

);

76-

const rightEntries = Object.entries(right ?? {}).toSorted(([leftKey], [rightKey]) =>

77-

leftKey.localeCompare(rightKey),

78-

);

79-

if (leftEntries.length !== rightEntries.length) {

80-

return false;

81-

}

82-

return leftEntries.every(([key, value], index) => {

83-

const rightEntry = rightEntries[index];

84-

return rightEntry !== undefined && rightEntry[0] === key && rightEntry[1] === value;

85-

});

86-

}

87-8852

function intersectApprovalSurfaceList(params: {

8953

approved: readonly string[] | undefined;

9054

declared: readonly string[];

9155

}): string[] {

92-

const approved = new Set(normalizeApprovalSurfaceList(params.approved));

93-

return normalizeApprovalSurfaceList(params.declared).filter((entry) => approved.has(entry));

56+

const approved = new Set(normalizeNodeApprovalSurfaceList(params.approved));

57+

return normalizeNodeApprovalSurfaceList(params.declared).filter((entry) => approved.has(entry));

9458

}

95599660

function intersectPermissionSurface(params: {

@@ -158,7 +122,7 @@ export async function reconcileNodePairingOnConnect(params: {

158122

: [],

159123

allowlist: pairingAllowlist,

160124

});

161-

const declaredCaps = normalizeApprovalSurfaceList(params.connectParams.caps);

125+

const declaredCaps = normalizeNodeApprovalSurfaceList(params.connectParams.caps);

162126

const declaredPermissions = normalizePermissionMap(params.connectParams.permissions);

163127164128

if (!params.pairedNode) {

@@ -192,11 +156,14 @@ export async function reconcileNodePairingOnConnect(params: {

192156

pairedCommands: params.pairedNode.commands,

193157

allowlist: runtimeAllowlist,

194158

});

195-

const approvedCaps = normalizeApprovalSurfaceList(params.pairedNode.caps);

159+

const approvedCaps = normalizeNodeApprovalSurfaceList(params.pairedNode.caps);

196160

const approvedPermissions = normalizePermissionMap(params.pairedNode.permissions);

197161

const hasCommandUpgrade = declared.some((command) => !approvedCommands.includes(command));

198-

const hasCapabilityChange = !sameApprovalSurfaceSet(params.pairedNode.caps, declaredCaps);

199-

const hasPermissionChange = !samePermissions(params.pairedNode.permissions, declaredPermissions);

162+

const hasCapabilityChange = !sameNodeApprovalSurfaceSet(params.pairedNode.caps, declaredCaps);

163+

const hasPermissionChange = !sameNodePermissionSurface(

164+

params.pairedNode.permissions,

165+

declaredPermissions,

166+

);

200167

const effectiveApprovedDeclaredCaps = intersectApprovalSurfaceList({

201168

approved: approvedCaps,

202169

declared: declaredCaps,