👾 Open Computer Use – Open-Source Alternative to Codex Computer Use
Swift accessibilityai-agentai-agentsclaude-codecodexcodex-computer-usecomputer-usecomputer-use-agentcross-platformcuadesktop-automationgemini-cligui-automationmacosmcpmodel-context-protocolopen-computer-useopen-computer-use-mcpopenai-codexopencode
Render matching links as markdown
Leo349df3a46f1f
diff --git a/docs/histories/2026-05/20260508-1022-align-feishu-state-wrappers.md b/docs/histories/2026-05/20260508-1022-align-feishu-state-wrappers.mdindex d4566a1..21a8077 100644--- a/docs/histories/2026-05/20260508-1022-align-feishu-state-wrappers.md+++ b/docs/histories/2026-05/20260508-1022-align-feishu-state-wrappers.md@@ -10,6 +10,7 @@- WebArea 下不再仅因为处在浅层就保留单子节点 generic container,减少 Feishu 页面顶部和正文区的冗余层级。- 文本合并规则新增独立时间范围保护,避免把日程标题、倒计时和 `HH:mm - HH:mm` 时间段合成一整句。- 文本摘要允许 AXLink 参与合并,让内容列表项能更接近官方的单行摘要形状。+- AXLink 的独立渲染也统一保留 markdown 链接形态,并避免长 URL 同时输出重复 `Description`。- 补充单元测试覆盖 wrapper elision 和时间范围合并边界。## Validation@@ -17,6 +18,7 @@- `swift test`- `./scripts/build-open-computer-use-app.sh debug`- 直连新构建 Dev app 抽样 `get_app_state`,确认 Feishu 顶层 `ClientView` 前的空 wrapper 已压平,日程时间范围不再被合并。+- 直连新构建 Dev app 抽样链接渲染,确认 Feishu 长链接以 markdown link 输出且不重复 `Description`。- `./scripts/run-tool-smoke-tests.sh`- `./scripts/check-docs.sh`- `git diff --check`diff --git a/packages/OpenComputerUseKit/Sources/OpenComputerUseKit/AccessibilitySnapshot.swift b/packages/OpenComputerUseKit/Sources/OpenComputerUseKit/AccessibilitySnapshot.swiftindex 50c5a2c..1fdfc37 100644--- a/packages/OpenComputerUseKit/Sources/OpenComputerUseKit/AccessibilitySnapshot.swift+++ b/packages/OpenComputerUseKit/Sources/OpenComputerUseKit/AccessibilitySnapshot.swift@@ -1004,10 +1004,6 @@ private func markdownLinkText(for element: AXUIElement, title: String?, label: Sreturn nil}- if text == url {- return url- }-return "[\(markdownEscapedLinkText(text))](\(url))"}@@ -1059,12 +1055,13 @@ private func formattedValueSegment(for element: AXUIElement, roleText: String, treturn " Value: \(value)"}-private func formattedLabelSegment(_ label: String?, title: String?, linkText: String?) -> String {+func formattedLabelSegment(_ label: String?, title: String?, linkText: String?) -> String {guard let label, label != title else {return ""}- if let linkText, linkText.hasPrefix("[\(markdownEscapedLinkText(label))](") {+ let comparableLabel = markdownEscapedLinkText(sanitizeText(label))+ if let linkText, linkText.hasPrefix("[\(comparableLabel)](") {return ""}@@ -1598,11 +1595,11 @@ private func summaryTextForLink(_ element: AXUIElement) -> String? {return nil}- if sanitized == url {- return url- }+ return summaryMarkdownLinkText(text: sanitized, url: url)+}- return "[\(markdownEscapedLinkText(sanitized))](\(url))"+func summaryMarkdownLinkText(text: String, url: String) -> String {+ "[\(markdownEscapedLinkText(text))](\(url))"}private func visibleRows(in rows: [AXUIElement], parent: AXUIElement) -> [AXUIElement] {diff --git a/packages/OpenComputerUseKit/Tests/OpenComputerUseKitTests/OpenComputerUseKitTests.swift b/packages/OpenComputerUseKit/Tests/OpenComputerUseKitTests/OpenComputerUseKitTests.swiftindex 1413b3d..58847ef 100644--- a/packages/OpenComputerUseKit/Tests/OpenComputerUseKitTests/OpenComputerUseKitTests.swift+++ b/packages/OpenComputerUseKit/Tests/OpenComputerUseKitTests/OpenComputerUseKitTests.swift@@ -763,6 +763,44 @@ final class OpenComputerUseKitTests: XCTestCase {)}+ func testAccessibilityRendererKeepsMarkdownShapeForSummaryLinks() {+ XCTAssertEqual(+ summaryMarkdownLinkText(+ text: "https://example.com/docs?topic=[agents]",+ url: "https://example.com/docs?topic=%5Bagents%5D"+ ),+ "[https://example.com/docs?topic=\\[agents\\]](https://example.com/docs?topic=%5Bagents%5D)"+ )+ XCTAssertEqual(+ summaryMarkdownLinkText(+ text: "https://example.com/docs",+ url: "https://example.com/docs"+ ),+ "[https://example.com/docs](https://example.com/docs)"+ )+ }++ func testAccessibilityRendererSuppressesDuplicateDescriptionForSameTextMarkdownLinks() {+ XCTAssertEqual(+ formattedLabelSegment(+ "https://example.com/docs",+ title: "[https://example.com/docs](https://example.com/docs)",+ linkText: "[https://example.com/docs](https://example.com/docs)"+ ),+ ""+ )+ let longURL = "https://example.com/docs?" + String(repeating: "query=value&", count: 20)+ let truncatedURL = String(longURL.prefix(160)) + "..."+ XCTAssertEqual(+ formattedLabelSegment(+ longURL,+ title: "[\(truncatedURL)](\(truncatedURL))",+ linkText: "[\(truncatedURL)](\(truncatedURL))"+ ),+ ""+ )+ }+func testAccessibilityRendererFormatsPlaceholderSegment() {XCTAssertEqual(formattedPlaceholderSegment(