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

推荐订阅源

U
Unit 42
Vercel News
Vercel News
博客园 - 叶小钗
大猫的无限游戏
大猫的无限游戏
MyScale Blog
MyScale Blog
P
Proofpoint News Feed
量子位
Engineering at Meta
Engineering at Meta
B
Blog RSS Feed
博客园 - 【当耐特】
Recent Announcements
Recent Announcements
Google DeepMind News
Google DeepMind News
D
DataBreaches.Net
Stack Overflow Blog
Stack Overflow Blog
博客园 - 聂微东
小众软件
小众软件
Hugging Face - Blog
Hugging Face - Blog
人人都是产品经理
人人都是产品经理
IT之家
IT之家
T
The Blog of Author Tim Ferriss
Last Week in AI
Last Week in AI
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
Jina AI
Jina AI
博客园 - 三生石上(FineUI控件)

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 visible approval list mapping · openclaw/...
vincentkoc · 2026-05-30 · via Recent Commits to openclaw:main

File tree

  • src/gateway/server-methods

Original file line numberDiff line numberDiff line change

@@ -44,6 +44,13 @@ type RequestedApprovalEvent<TPayload extends ApprovalTurnSourceFields> = {

4444

expiresAtMs: number;

4545

};

4646
47+

type PendingApprovalListEntry<TPayload> = {

48+

id: string;

49+

request: TPayload;

50+

createdAtMs: number;

51+

expiresAtMs: number;

52+

};

53+
4754

function isPromiseLike<T>(value: T | Promise<T>): value is Promise<T> {

4855

return typeof value === "object" && value !== null && "then" in value;

4956

}

@@ -114,6 +121,26 @@ export function isApprovalRecordVisibleToClient<TPayload>(params: {

114121

return true;

115122

}

116123
124+

export function listVisiblePendingApprovalRequests<TPayload>(params: {

125+

manager: ExecApprovalManager<TPayload>;

126+

client?: GatewayClient | null;

127+

}): PendingApprovalListEntry<TPayload>[] {

128+

return params.manager

129+

.listPendingRecords()

130+

.filter((record) =>

131+

isApprovalRecordVisibleToClient({

132+

record,

133+

client: params.client ?? null,

134+

}),

135+

)

136+

.map((record) => ({

137+

id: record.id,

138+

request: record.request,

139+

createdAtMs: record.createdAtMs,

140+

expiresAtMs: record.expiresAtMs,

141+

}));

142+

}

143+
117144

export function resolveApprovalRequestRecipientConnIds<TPayload>(params: {

118145

context: GatewayRequestContext;

119146

record: ExecApprovalRecord<TPayload>;

Original file line numberDiff line numberDiff line change

@@ -37,6 +37,7 @@ import {

3737

handleApprovalResolve,

3838

isApprovalDecision,

3939

isApprovalRecordVisibleToClient,

40+

listVisiblePendingApprovalRequests,

4041

respondPendingApprovalLookupError,

4142

resolvePendingApprovalRecord,

4243

} from "./approval-shared.js";

@@ -136,19 +137,7 @@ export function createExecApprovalHandlers(

136137

);

137138

},

138139

"exec.approval.list": async ({ respond, client }) => {

139-

respond(

140-

true,

141-

manager

142-

.listPendingRecords()

143-

.filter((record) => isApprovalRecordVisibleToClient({ record, client }))

144-

.map((record) => ({

145-

id: record.id,

146-

request: record.request,

147-

createdAtMs: record.createdAtMs,

148-

expiresAtMs: record.expiresAtMs,

149-

})),

150-

undefined,

151-

);

140+

respond(true, listVisiblePendingApprovalRequests({ manager, client }), undefined);

152141

},

153142

"exec.approval.request": async ({ params, respond, context, client }) => {

154143

if (!validateExecApprovalRequestParams(params)) {

Original file line numberDiff line numberDiff line change

@@ -21,7 +21,7 @@ import {

2121

handleApprovalWaitDecision,

2222

handlePendingApprovalRequest,

2323

isApprovalDecision,

24-

isApprovalRecordVisibleToClient,

24+

listVisiblePendingApprovalRequests,

2525

} from "./approval-shared.js";

2626

import type { GatewayRequestHandlers } from "./types.js";

2727

@@ -31,19 +31,7 @@ export function createPluginApprovalHandlers(

3131

): GatewayRequestHandlers {

3232

return {

3333

"plugin.approval.list": async ({ respond, client }) => {

34-

respond(

35-

true,

36-

manager

37-

.listPendingRecords()

38-

.filter((record) => isApprovalRecordVisibleToClient({ record, client }))

39-

.map((record) => ({

40-

id: record.id,

41-

request: record.request,

42-

createdAtMs: record.createdAtMs,

43-

expiresAtMs: record.expiresAtMs,

44-

})),

45-

undefined,

46-

);

34+

respond(true, listVisiblePendingApprovalRequests({ manager, client }), undefined);

4735

},

4836

"plugin.approval.request": async ({ params, client, respond, context }) => {

4937

if (!validatePluginApprovalRequestParams(params)) {