Skip to content

Open source CapCut alternative.

TypeScript

feat(app): surface allow-once/always-allow consent in the notch overlay

David Le363ee755de10
diff --git a/apps/Donkey/Sources/Donkey/UserQueryCommandHandler.swift b/apps/Donkey/Sources/Donkey/UserQueryCommandHandler.swift
index 1d799341..a2caf30e 100644
--- a/apps/Donkey/Sources/Donkey/UserQueryCommandHandler.swift
+++ b/apps/Donkey/Sources/Donkey/UserQueryCommandHandler.swift
@@ -319,12 +319,14 @@ struct LocalAppUserQueryCommandHandler: UserQueryCommandHandling {
registry: registry
)
let plannerDescriptors = await registry.descriptors()
+ let environmentSummary = await SystemToolCapabilityProbe.shared.summary()
let planner = HostedHarnessStepPlanner(
backend: backend,
descriptors: plannerDescriptors,
appName: appName,
appGuidance: appGuidance,
- understanding: understanding
+ understanding: understanding,
+ environmentSummary: environmentSummary
)
_ = await genericHarnessLifecycle.coordinator.startRunning(
taskID: taskID,
diff --git a/apps/Donkey/Sources/Donkey/UserQueryOverlayController.swift b/apps/Donkey/Sources/Donkey/UserQueryOverlayController.swift
index d65b4f37..242179b9 100644
--- a/apps/Donkey/Sources/Donkey/UserQueryOverlayController.swift
+++ b/apps/Donkey/Sources/Donkey/UserQueryOverlayController.swift
@@ -627,8 +627,8 @@ final class UserQueryOverlayController {
resumeRequested: { [weak self] taskID in
self?.model.resumeTask(id: taskID)
},
- approvePermissionRequested: { [weak self] taskID in
- self?.model.approvePermissionGate(id: taskID)
+ approvePermissionRequested: { [weak self] taskID, alwaysAllow in
+ self?.model.approvePermissionGate(id: taskID, alwaysAllow: alwaysAllow)
},
updateRequested: { [weak self] in
self?.openAvailableUpdate()
diff --git a/apps/Donkey/Sources/DonkeyUI/UserQueryNotchStatusView.swift b/apps/Donkey/Sources/DonkeyUI/UserQueryNotchStatusView.swift
index 81cb3281..6e44252c 100644
--- a/apps/Donkey/Sources/DonkeyUI/UserQueryNotchStatusView.swift
+++ b/apps/Donkey/Sources/DonkeyUI/UserQueryNotchStatusView.swift
@@ -26,7 +26,9 @@ public struct UserQueryNotchStatusView: View {
private let assetsDropped: @MainActor ([UserQueryTaskAssetDraft]) -> Void
private let pauseRequested: @MainActor (String) -> Void
private let resumeRequested: @MainActor (String) -> Void
- private let approvePermissionRequested: @MainActor (String) -> Void
+ /// (taskID, alwaysAllow). `alwaysAllow` persists a standing rule for the
+ /// command signature; it is only offered for non-highRisk shell consent.
+ private let approvePermissionRequested: @MainActor (String, Bool) -> Void
private let updateRequested: @MainActor () -> Void
public init(
@@ -49,7 +51,7 @@ public struct UserQueryNotchStatusView: View {
assetsDropped: @escaping @MainActor ([UserQueryTaskAssetDraft]) -> Void,
pauseRequested: @escaping @MainActor (String) -> Void,
resumeRequested: @escaping @MainActor (String) -> Void,
- approvePermissionRequested: @escaping @MainActor (String) -> Void,
+ approvePermissionRequested: @escaping @MainActor (String, Bool) -> Void,
updateRequested: @escaping @MainActor () -> Void
) {
self.state = state
@@ -569,14 +571,39 @@ public struct UserQueryNotchStatusView: View {
private func activeTaskControls(for task: UserQueryNotchTask) -> some View {
switch task.status {
case .waitingForPermission:
- statusControlButton(
- systemName: "checkmark.shield",
- label: "Approve Permission",
- isEnabled: true,
- action: {
- approvePermissionRequested(task.id)
+ let isShellConsent = !(task.metadata["genericHarness.shellConsent.command"] ?? "").isEmpty
+ let allowAlways = task.metadata["genericHarness.shellConsent.allowAlways"] == "true"
+ if isShellConsent {
+ HStack(spacing: 6) {
+ statusControlButton(
+ systemName: "checkmark.shield",
+ label: "Allow Once",
+ isEnabled: true,
+ action: {
+ approvePermissionRequested(task.id, false)
+ }
+ )
+ if allowAlways {
+ statusControlButton(
+ systemName: "checkmark.shield.fill",
+ label: "Always Allow",
+ isEnabled: true,
+ action: {
+ approvePermissionRequested(task.id, true)
+ }
+ )
+ }
}
- )
+ } else {
+ statusControlButton(
+ systemName: "checkmark.shield",
+ label: "Approve Permission",
+ isEnabled: true,
+ action: {
+ approvePermissionRequested(task.id, false)
+ }
+ )
+ }
case .interrupted:
statusControlButton(
systemName: "arrow.triangle.2.circlepath",