Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .github/workflows/build-macos-arm-dmg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,11 @@ jobs:
--team-id "$APPLE_TEAM_ID" \
--password "$APPLE_APP_SPECIFIC_PASSWORD"

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.23'

- name: Build DMG
run: ./scripts/build-dmg.sh "$VERSION"

Expand All @@ -144,6 +149,8 @@ jobs:
SPARKLE_ARCHS="$(lipo -archs .build/dmg-staging/CodeIsland.app/Contents/Frameworks/Sparkle.framework/Sparkle)"
test "$APP_ARCHS" = "arm64"
test "$HELPER_ARCHS" = "arm64"
FEISHU_ARCHS="$(lipo -archs .build/dmg-staging/CodeIsland.app/Contents/Helpers/feishu-bridge)"
test "$FEISHU_ARCHS" = "arm64"
test "$SPARKLE_ARCHS" = "arm64"
test -s .build/dmg-staging/CodeIsland.app/Contents/Resources/AppIcon.icns
test "$(/usr/libexec/PlistBuddy -c 'Print :CFBundleIconFile' .build/dmg-staging/CodeIsland.app/Contents/Info.plist)" = "AppIcon"
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Build artifacts
.build/
helpers/feishu-bridge/dist/
.swiftpm/

# Superpowers artifacts
Expand Down
16 changes: 13 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,17 @@ Cowork runs inside Claude Desktop's sandbox, where hooks never fire, so CodeIsla

<br>

**Settings → Behavior → Push notifications** sends approvals, questions (with numbered options), finished turns, turn errors and follow-up reminders to Bark, ntfy, DingTalk, Lark / Feishu, WeCom, Slack or Telegram — several at once, each with its own event choices and a **Send test** button that shows the service's real reply. By default a push only goes out while you're away (screen locked, screen saver, displays asleep, or no keyboard / mouse input for 5 minutes), and subagent turns are never pushed. Commands and messages go through the same credential redaction as the rest of the app. Pushes answer nothing: approve on the Mac.
**Settings → Behavior → Push notifications** sends approvals, questions (with numbered options), finished turns, turn errors and follow-up reminders to Bark, ntfy, DingTalk, Lark / Feishu, WeCom, Slack or Telegram — several at once, each with its own event choices and a **Send test** button that shows the service's real reply. By default a push only goes out while you're away (screen locked, screen saver, displays asleep, or no keyboard / mouse input for 5 minutes), and subagent turns are never pushed. Commands and messages go through the same credential redaction as the rest of the app. Pushes answer nothing: approve on the Mac, or with Feishu remote approval below.

</details>

<a name="feishu-approval"></a>
<details>
<summary><b>Feishu remote approval</b></summary>

<br>

**Settings → Behavior → Feishu remote approval** can answer a permission request from a private Feishu chat: Allow once, or Deny. It is not the one-way Feishu webhook under Push notifications, and a text reply never approves a command. Use a company self-built bot. The App Secret stays in the Keychain. Turn the long connection on here before saving the Feishu event and card subscriptions, keep the bot available only to yourself, and do not add it to a group. The card has no Always allow. A timeout, a disconnect, another account, or a second tap on the same card does not allow the command.

</details>

Expand All @@ -326,14 +336,14 @@ AI tool (Claude Code / Codex / Gemini / Cursor / …)

CodeIsland installs lightweight hooks into each tool's own config. When the tool fires an event — session start, tool call, permission request, question, stop — the bridge forwards it as JSON over a local Unix socket, and the island updates instantly. For events that wait on you, the answer travels back the same way.

**Privacy:** events never leave your Mac unless you opt in. The only network requests CodeIsland makes are Sparkle update checks, plus — only if you turn them on — Claude plan-limit lookups (sent to `api.anthropic.com` with your own Claude Code login), webhook forwarding to the URL you configure, and pushes to the services you set up.
**Privacy:** events never leave your Mac unless you opt in. The only network requests CodeIsland makes are Sparkle update checks, plus — only if you turn them on — Claude plan-limit lookups (sent to `api.anthropic.com` with your own Claude Code login), webhook forwarding to the URL you configure, pushes to the services you set up, and — only while Feishu remote approval is connected — an outbound long connection that sends private approval cards.

## Settings

| Page | What's there |
|------|--------------|
| **General** | Language, launch at login, display selection |
| **Behavior** | Auto-expand (approvals and questions separately), hover delay, smart suppress, completion style, follow-up reminders, session cleanup, silence rules, auto-approve, push notifications, webhook |
| **Behavior** | Auto-expand (approvals and questions separately), hover delay, smart suppress, completion style, follow-up reminders, session cleanup, silence rules, auto-approve, push notifications, Feishu remote approval, webhook |
| **Appearance** | Panel size, notch width, font size, reply lines, open/close speed, project name, git branch, task progress, session recap, model label, usage stats, plan limits |
| **Mascots** | Preview every character and its animations |
| **Sound** | 8-bit sounds per event, volume, quiet hours, mute while away |
Expand Down
16 changes: 13 additions & 3 deletions README.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,17 @@ Cowork 跑在 Claude Desktop 的沙盒里,hook 不会触发,所以 CodeIslan

<br>

**设置 → 行为 → 推送通知** 可以把审批、提问(附编号选项)、完成、整轮出错和跟进提醒推送到 Bark、ntfy、钉钉、飞书 / Lark、企业微信、Slack 或 Telegram。可以同时启用多个通道,每个通道单独选择推送哪些事件,「发送测试」按钮会显示服务端的真实返回。默认只在你离开时推送(锁屏、屏保、显示器睡眠,或键盘鼠标 5 分钟没有操作),子 Agent 的回合不推送。命令和消息会经过和应用其他部分相同的凭据脱敏。推送只负责通知,审批仍需回到 Mac 上操作。
**设置 → 行为 → 推送通知** 可以把审批、提问(附编号选项)、完成、整轮出错和跟进提醒推送到 Bark、ntfy、钉钉、飞书 / Lark、企业微信、Slack 或 Telegram。可以同时启用多个通道,每个通道单独选择推送哪些事件,「发送测试」按钮会显示服务端的真实返回。默认只在你离开时推送(锁屏、屏保、显示器睡眠,或键盘鼠标 5 分钟没有操作),子 Agent 的回合不推送。命令和消息会经过和应用其他部分相同的凭据脱敏。推送只负责通知。要在手机上点允许或拒绝,用下面的飞书远程审批,不要用这条 webhook。

</details>

<a name="feishu-approval"></a>
<details>
<summary><b>飞书远程审批</b></summary>

<br>

**设置 → 行为 → 飞书远程审批** 可以把一条权限请求发到飞书私聊,在手机上点「允许一次」或「拒绝」。它和推送通知里的飞书 webhook 不是一回事,聊天里回复文字也不会批准命令。需要企业自建应用,App Secret 只放在钥匙串。先在这里连上长连接,再去飞书后台保存事件和卡片订阅;可用范围只留给自己,不要把机器人拉进群。卡片没有「始终允许」。超时、断线、别人的账号,或同一张卡片再点一次,都不会允许。

</details>

Expand All @@ -326,14 +336,14 @@ AI 工具(Claude Code / Codex / Gemini / Cursor / …)

CodeIsland 往每个工具自己的配置里装一个轻量 hook。工具触发事件时(会话开始、工具调用、权限请求、提问、结束),bridge 把事件以 JSON 形式经本机 Unix socket 转发过来,刘海立即更新。需要你做决定的事件,答案也沿同一条路回传。

**隐私:** 除非你主动开启,事件不会离开你的 Mac。CodeIsland 发出的网络请求只有:Sparkle 更新检查;以及仅在你打开时才有的 Claude 套餐额度查询(用你自己的 Claude Code 登录请求 `api.anthropic.com`)、发往你所配置地址的 Webhook 转发,以及发往你所配置服务的推送。
**隐私:** 除非你主动开启,事件不会离开你的 Mac。CodeIsland 发出的网络请求只有:Sparkle 更新检查;以及仅在你打开时才有的 Claude 套餐额度查询(用你自己的 Claude Code 登录请求 `api.anthropic.com`)、发往你所配置地址的 Webhook 转发、发往你所配置服务的推送,以及仅在打开飞书远程审批并连上时长连接时,向飞书发送的私聊审批卡片。

## 设置

| 页面 | 内容 |
|------|------|
| **通用** | 语言、开机启动、显示器选择 |
| **行为** | 自动展开(审批与提问分开设置)、悬停展开延迟、智能抑制、完成提示方式、跟进提醒、会话清理、静默规则、自动放行、推送通知、Webhook |
| **行为** | 自动展开(审批与提问分开设置)、悬停展开延迟、智能抑制、完成提示方式、跟进提醒、会话清理、静默规则、自动放行、推送通知、飞书远程审批、Webhook |
| **外观** | 面板尺寸、刘海宽度、字号、回复行数、展开 / 收起速度、项目名、Git 分支、任务进度、会话回顾、模型标签、用量统计、套餐额度 |
| **角色** | 预览所有像素角色和它们的动画 |
| **声音** | 按事件的 8-bit 音效、音量、静默时段、离开时自动静音 |
Expand Down
2 changes: 2 additions & 0 deletions Sources/CodeIsland/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ class AppDelegate: NSObject, NSApplicationDelegate {
if isolated {
Self.log.notice("Isolated (CODEISLAND_ISOLATED=1): no hooks installed, no sessions discovered, no remote hosts connected")
} else {
FeishuApprovalCenter.shared.attach(appState)
FeishuApprovalCenter.shared.startIfConfigured()
Task.detached(priority: .userInitiated) {
if ConfigInstaller.install() {
Self.log.info("Hooks installed")
Expand Down
1 change: 1 addition & 0 deletions Sources/CodeIsland/AppState+ToolUseCache.swift
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@ extension AppState {
permissionQueue.removeAll { droppedIds.contains($0.id) }
for stale in dropped {
log.notice("⚠️ permission dropped, no decision reason=\(reason, privacy: .public) session=\(stale.event.sessionId ?? "nil", privacy: .public) toolUseId=\(stale.toolUseId ?? "nil", privacy: .public) tool=\(stale.event.toolName ?? "nil", privacy: .public) triggerEvent=\(triggerEvent, privacy: .public)")
notifyFeishuPermissionFinished(stale.id, decision: "gone")
stale.continuation.resume(returning: Self.noDecisionAnswer)
}

Expand Down
51 changes: 51 additions & 0 deletions Sources/CodeIsland/AppState.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2186,6 +2186,7 @@ final class AppState {
// already in progress.
let burstAlreadyInProgress = nextVisiblePermissionIndex() != nil
permissionQueue.append(request)
publishFeishuPermission(request)
let attention = decideAttention(.approvalQueued(firstOfBurst: !burstAlreadyInProgress), sessionId: sessionId)
pushPermissionQueued(event, sessionId: sessionId, push: attention.push)

Expand Down Expand Up @@ -2232,13 +2233,46 @@ final class AppState {
refreshDerivedState()
}

func notifyFeishuPermissionFinished(_ id: UUID, decision: String) {
FeishuApprovalCenter.shared.noteFinished(id: id, decision: decision)
}

func publishFeishuPermission(_ request: PermissionRequest) {
let event = request.event
FeishuApprovalCenter.shared.offer(
id: request.id,
source: (event.rawJSON["_source"] as? String) ?? "",
tool: event.toolName ?? "",
cwd: (event.rawJSON["cwd"] as? String) ?? "",
command: PushDetailSummarizer.permissionDetail(
toolInput: event.toolInput,
fallback: event.toolDescription,
cwd: event.rawJSON["cwd"] as? String
) ?? "",
sessionId: event.sessionId ?? ""
)
}

func approvePermission(always: Bool = false, expectedSessionId: String? = nil) {
guard let index = permissionIndex(expecting: expectedSessionId) else {
if let expectedSessionId {
discardStalePanelAction(expected: expectedSessionId, kind: "approve")
}
return
}
approveQueuedPermission(at: index, always: always)
}

/// A Feishu card names one request, which may not be the card on screen.
/// Allow once only: remote approval never writes an always-allow rule.
@discardableResult
func approvePermission(requestId: UUID) -> Bool {
guard let index = permissionQueue.firstIndex(where: { $0.id == requestId }) else { return false }
approveQueuedPermission(at: index, always: false)
return true
}

private func approveQueuedPermission(at index: Int, always: Bool) {
let pending = permissionQueue.remove(at: index)
let sessionId = pending.event.sessionId ?? "default"
dismissedPermissionSessionIds.remove(sessionId)
Expand All @@ -2257,6 +2291,7 @@ final class AppState {
answerQueuedRequestsCoveredByAlways(sessionId: sessionId)
}

notifyFeishuPermissionFinished(pending.id, decision: "allow")
showNextPending()
refreshDerivedState()
}
Expand All @@ -2274,6 +2309,7 @@ final class AppState {
permissionQueue.removeAll { ids.contains($0.id) }
for request in covered {
request.continuation.resume(returning: Self.plainAllowAnswer)
notifyFeishuPermissionFinished(request.id, decision: "allow")
resolveMergedSubagentAfterUI(
sessionId: sessionId,
agentId: request.event.agentId,
Expand Down Expand Up @@ -2523,6 +2559,18 @@ final class AppState {
}
return
}
denyQueuedPermission(at: index)
}

/// See `approvePermission(requestId:)`.
@discardableResult
func denyPermission(requestId: UUID) -> Bool {
guard let index = permissionQueue.firstIndex(where: { $0.id == requestId }) else { return false }
denyQueuedPermission(at: index)
return true
}

private func denyQueuedPermission(at index: Int) {
let pending = permissionQueue.remove(at: index)
let sessionId = pending.event.sessionId ?? "default"
dismissedPermissionSessionIds.remove(sessionId)
Expand All @@ -2541,6 +2589,7 @@ final class AppState {
activeSessionId = mostActiveSessionId()
}

notifyFeishuPermissionFinished(pending.id, decision: "deny")
showNextPending()
refreshDerivedState()
}
Expand Down Expand Up @@ -3071,6 +3120,7 @@ final class AppState {
permissionQueue.removeAll { item in
guard item.event.sessionId == sessionId, matches(item.event) else { return false }
log.notice("⚠️ permission dropped, no decision reason=drainPermissions(\(reason, privacy: .public)) session=\(sessionId, privacy: .public) toolUseId=\(item.toolUseId ?? "nil", privacy: .public) tool=\(item.event.toolName ?? "nil", privacy: .public)")
notifyFeishuPermissionFinished(item.id, decision: "gone")
item.continuation.resume(returning: Self.noDecisionAnswer)
return true
}
Expand Down Expand Up @@ -3102,6 +3152,7 @@ final class AppState {
let pending = permissionQueue.remove(at: index)
sessionId = pending.event.sessionId ?? "default"
log.notice("⚠️ permission deny reason=hookGone session=\(sessionId, privacy: .public) toolUseId=\(pending.toolUseId ?? "nil", privacy: .public) tool=\(pending.event.toolName ?? "nil", privacy: .public)")
notifyFeishuPermissionFinished(pending.id, decision: "gone")
// Nobody reads it, but the continuation must not leak.
pending.continuation.resume(returning: Data(
#"{"hookSpecificOutput":{"hookEventName":"PermissionRequest","decision":{"behavior":"deny"}}}"#.utf8
Expand Down
Loading