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

推荐订阅源

M
MIT News - Artificial intelligence
罗磊的独立博客
Hugging Face - Blog
Hugging Face - Blog
Apple Machine Learning Research
Apple Machine Learning Research
Last Week in AI
Last Week in AI
S
SegmentFault 最新的问题
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
美团技术团队
人人都是产品经理
人人都是产品经理
WordPress大学
WordPress大学
The Cloudflare Blog
IT之家
IT之家
雷峰网
雷峰网
小众软件
小众软件
博客园 - 叶小钗
博客园 - 聂微东
爱范儿
爱范儿
博客园 - 司徒正美
博客园 - 三生石上(FineUI控件)
V
Visual Studio Blog
博客园 - 【当耐特】
V
V2EX
博客园_首页
T
Tailwind CSS Blog

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
fix: harden mac app computer use docs · openclaw/openclaw...
steipete · 2026-04-28 · via Recent Commits to openclaw:main

@@ -2,11 +2,101 @@ import Foundation

2233

final class CanvasFileWatcher: @unchecked Sendable, SimpleFileWatcherOwner {

44

let watcher: SimpleFileWatcher

5+

private let pollingWatcher: PollingDirectoryWatcher

5667

init(url: URL, onChange: @escaping () -> Void) {

78

self.watcher = SimpleFileWatcher(CoalescingFSEventsWatcher(

89

paths: [url.path],

910

queueLabel: "ai.openclaw.canvaswatcher",

1011

onChange: onChange))

12+

self.pollingWatcher = PollingDirectoryWatcher(

13+

url: url,

14+

queueLabel: "ai.openclaw.canvaswatcher.poll",

15+

onChange: onChange)

16+

}

17+18+

func start() {

19+

self.watcher.start()

20+

self.pollingWatcher.start()

21+

}

22+23+

func stop() {

24+

self.watcher.stop()

25+

self.pollingWatcher.stop()

26+

}

27+

}

28+29+

private final class PollingDirectoryWatcher: @unchecked Sendable {

30+

private struct FileSignature: Equatable {

31+

let modifiedAt: TimeInterval

32+

let size: Int

33+

}

34+35+

private let url: URL

36+

private let queue: DispatchQueue

37+

private let onChange: () -> Void

38+

private var timer: DispatchSourceTimer?

39+

private var lastSnapshot: [String: FileSignature] = [:]

40+41+

init(url: URL, queueLabel: String, onChange: @escaping () -> Void) {

42+

self.url = url

43+

self.queue = DispatchQueue(label: queueLabel)

44+

self.onChange = onChange

45+

}

46+47+

deinit {

48+

self.stop()

49+

}

50+51+

func start() {

52+

self.queue.sync {

53+

guard self.timer == nil else { return }

54+

self.lastSnapshot = self.snapshot()

55+56+

let timer = DispatchSource.makeTimerSource(queue: self.queue)

57+

timer.schedule(deadline: .now() + 0.15, repeating: 0.25)

58+

timer.setEventHandler { [weak self] in

59+

self?.poll()

60+

}

61+

self.timer = timer

62+

timer.resume()

63+

}

64+

}

65+66+

func stop() {

67+

self.queue.sync {

68+

self.timer?.cancel()

69+

self.timer = nil

70+

self.lastSnapshot = [:]

71+

}

72+

}

73+74+

private func poll() {

75+

let next = self.snapshot()

76+

guard next != self.lastSnapshot else { return }

77+

self.lastSnapshot = next

78+

self.onChange()

79+

}

80+81+

private func snapshot() -> [String: FileSignature] {

82+

let keys: [URLResourceKey] = [.contentModificationDateKey, .fileSizeKey, .isRegularFileKey]

83+

guard let enumerator = FileManager.default.enumerator(

84+

at: self.url,

85+

includingPropertiesForKeys: keys,

86+

options: [.skipsPackageDescendants])

87+

else { return [:] }

88+89+

var result: [String: FileSignature] = [:]

90+

for case let fileURL as URL in enumerator {

91+

guard let values = try? fileURL.resourceValues(forKeys: Set(keys)),

92+

values.isRegularFile == true

93+

else { continue }

94+95+

let relativePath = String(fileURL.path.dropFirst(self.url.path.count + 1))

96+

result[relativePath] = FileSignature(

97+

modifiedAt: values.contentModificationDate?.timeIntervalSinceReferenceDate ?? 0,

98+

size: values.fileSize ?? 0)

99+

}

100+

return result

11101

}

12102

}