@lattices/cli 0.4.14 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -7
- package/apps/mac/Info.plist +4 -4
- package/apps/mac/Lattices.app/Contents/Info.plist +4 -12
- package/apps/mac/Lattices.app/Contents/MacOS/Lattices +0 -0
- package/bin/lattices-app.ts +110 -17
- package/bin/lattices-build +125 -0
- package/bin/lattices-dev +89 -16
- package/bin/lattices.ts +977 -16
- package/docs/agents.md +81 -4
- package/docs/ai-chat-ux-review.md +416 -0
- package/docs/api.md +135 -3
- package/docs/app.md +30 -8
- package/docs/config.md +4 -0
- package/docs/mouse-gestures.md +60 -1
- package/docs/proposals/LAT-004-interactive-overlay-actors.md +1 -1
- package/docs/proposals/LAT-005-action-runtime-product-spine.md +914 -0
- package/docs/proposals/LAT-006-mira-in-lattices.md +553 -0
- package/docs/proposals/LAT-007-unified-app-shell.md +128 -0
- package/docs/reference/dewey.config.ts +2 -2
- package/docs/release.md +171 -0
- package/docs/repo-structure.md +5 -5
- package/docs/voice.md +11 -27
- package/package.json +11 -10
- package/apps/mac/Package.swift +0 -27
- package/apps/mac/Sources/AppShell/App.swift +0 -26
- package/apps/mac/Sources/AppShell/AppActivationCoordinator.swift +0 -27
- package/apps/mac/Sources/AppShell/AppDelegate.swift +0 -189
- package/apps/mac/Sources/AppShell/AppServicesBootstrap.swift +0 -25
- package/apps/mac/Sources/AppShell/AppShellView.swift +0 -171
- package/apps/mac/Sources/AppShell/AppUpdater.swift +0 -305
- package/apps/mac/Sources/AppShell/CliActionLauncher.swift +0 -50
- package/apps/mac/Sources/AppShell/HomeDashboardView.swift +0 -133
- package/apps/mac/Sources/AppShell/HotkeyBootstrap.swift +0 -87
- package/apps/mac/Sources/AppShell/KeyRecorderView.swift +0 -210
- package/apps/mac/Sources/AppShell/LatticesRuntime.swift +0 -104
- package/apps/mac/Sources/AppShell/MainView.swift +0 -847
- package/apps/mac/Sources/AppShell/MainWindow.swift +0 -83
- package/apps/mac/Sources/AppShell/MenuBarController.swift +0 -177
- package/apps/mac/Sources/AppShell/OnboardingView.swift +0 -483
- package/apps/mac/Sources/AppShell/PermissionsAssistantView.swift +0 -366
- package/apps/mac/Sources/AppShell/PermissionsAssistantWindow.swift +0 -70
- package/apps/mac/Sources/AppShell/Preferences.swift +0 -297
- package/apps/mac/Sources/AppShell/SettingsView.swift +0 -3163
- package/apps/mac/Sources/AppShell/SettingsWindow.swift +0 -34
- package/apps/mac/Sources/AppShell/WorkspaceInspectorPresenter.swift +0 -13
- package/apps/mac/Sources/Core/Actions/HotkeyManager.swift +0 -256
- package/apps/mac/Sources/Core/Actions/HotkeyStore.swift +0 -399
- package/apps/mac/Sources/Core/Actions/IntentEngine.swift +0 -988
- package/apps/mac/Sources/Core/Actions/IntentSchema.swift +0 -94
- package/apps/mac/Sources/Core/Actions/Intents/CreateLayerIntent.swift +0 -54
- package/apps/mac/Sources/Core/Actions/Intents/DistributeIntent.swift +0 -56
- package/apps/mac/Sources/Core/Actions/Intents/FocusIntent.swift +0 -69
- package/apps/mac/Sources/Core/Actions/Intents/HelpIntent.swift +0 -41
- package/apps/mac/Sources/Core/Actions/Intents/KillIntent.swift +0 -47
- package/apps/mac/Sources/Core/Actions/Intents/LatticeIntent.swift +0 -53
- package/apps/mac/Sources/Core/Actions/Intents/LaunchIntent.swift +0 -67
- package/apps/mac/Sources/Core/Actions/Intents/ListSessionsIntent.swift +0 -32
- package/apps/mac/Sources/Core/Actions/Intents/ListWindowsIntent.swift +0 -30
- package/apps/mac/Sources/Core/Actions/Intents/ScanIntent.swift +0 -52
- package/apps/mac/Sources/Core/Actions/Intents/SearchIntent.swift +0 -190
- package/apps/mac/Sources/Core/Actions/Intents/SwitchLayerIntent.swift +0 -50
- package/apps/mac/Sources/Core/Actions/Intents/TileIntent.swift +0 -61
- package/apps/mac/Sources/Core/Actions/PaletteCommand.swift +0 -439
- package/apps/mac/Sources/Core/Actions/VoiceIntentResolver.swift +0 -713
- package/apps/mac/Sources/Core/Companion/CompanionActivityLog.swift +0 -70
- package/apps/mac/Sources/Core/Companion/CompanionKeyboardController.swift +0 -141
- package/apps/mac/Sources/Core/Companion/LatticesCompanionBridgeServer.swift +0 -454
- package/apps/mac/Sources/Core/Companion/LatticesCompanionCockpit.swift +0 -555
- package/apps/mac/Sources/Core/Companion/LatticesCompanionSecurityCoordinator.swift +0 -629
- package/apps/mac/Sources/Core/Companion/LatticesCompanionTrackpadController.swift +0 -204
- package/apps/mac/Sources/Core/Companion/LatticesDeckHost.swift +0 -1463
- package/apps/mac/Sources/Core/Daemon/DaemonProtocol.swift +0 -114
- package/apps/mac/Sources/Core/Daemon/DaemonServer.swift +0 -427
- package/apps/mac/Sources/Core/Daemon/LatticesApi.swift +0 -2965
- package/apps/mac/Sources/Core/Desktop/AccessibilityTextExtractor.swift +0 -111
- package/apps/mac/Sources/Core/Desktop/AppTypeClassifier.swift +0 -106
- package/apps/mac/Sources/Core/Desktop/DesktopModel.swift +0 -331
- package/apps/mac/Sources/Core/Desktop/DesktopModelTypes.swift +0 -73
- package/apps/mac/Sources/Core/Desktop/InventoryManager.swift +0 -35
- package/apps/mac/Sources/Core/Desktop/InventoryPath.swift +0 -43
- package/apps/mac/Sources/Core/Desktop/MouseFinder.swift +0 -527
- package/apps/mac/Sources/Core/Desktop/OcrModel.swift +0 -467
- package/apps/mac/Sources/Core/Desktop/OcrStore.swift +0 -329
- package/apps/mac/Sources/Core/Desktop/PlacementSpec.swift +0 -195
- package/apps/mac/Sources/Core/Desktop/SessionWindowLocator.swift +0 -139
- package/apps/mac/Sources/Core/Desktop/TilePickerView.swift +0 -209
- package/apps/mac/Sources/Core/Desktop/WindowCapture.swift +0 -33
- package/apps/mac/Sources/Core/Desktop/WindowDragSnapController.swift +0 -429
- package/apps/mac/Sources/Core/Desktop/WindowPreviewCard.swift +0 -100
- package/apps/mac/Sources/Core/Desktop/WindowPreviewStore.swift +0 -112
- package/apps/mac/Sources/Core/Desktop/WindowSelectionStore.swift +0 -76
- package/apps/mac/Sources/Core/Desktop/WindowTiler.swift +0 -2222
- package/apps/mac/Sources/Core/Input/EventTapBreaker.swift +0 -124
- package/apps/mac/Sources/Core/Input/EventTapThread.swift +0 -54
- package/apps/mac/Sources/Core/Input/InputCaptureResetCenter.swift +0 -20
- package/apps/mac/Sources/Core/Input/KeyboardRemapConfig.swift +0 -69
- package/apps/mac/Sources/Core/Input/KeyboardRemapController.swift +0 -346
- package/apps/mac/Sources/Core/Input/KeyboardRemapStore.swift +0 -141
- package/apps/mac/Sources/Core/Input/MouseGestureConfig.swift +0 -499
- package/apps/mac/Sources/Core/Input/MouseGestureController.swift +0 -2583
- package/apps/mac/Sources/Core/Input/MouseInputDeviceStore.swift +0 -98
- package/apps/mac/Sources/Core/Input/MouseInputEventViewer.swift +0 -272
- package/apps/mac/Sources/Core/Input/MouseShortcutStore.swift +0 -170
- package/apps/mac/Sources/Core/Input/SecureEventInputMonitor.swift +0 -39
- package/apps/mac/Sources/Core/Input/ShapeRecognizer.swift +0 -624
- package/apps/mac/Sources/Core/Input/TapBudgetMeter.swift +0 -56
- package/apps/mac/Sources/Core/Overlays/AppWindowShell.swift +0 -63
- package/apps/mac/Sources/Core/Overlays/CommandMode/CommandModeState.swift +0 -1566
- package/apps/mac/Sources/Core/Overlays/CommandMode/CommandModeView.swift +0 -1927
- package/apps/mac/Sources/Core/Overlays/CommandMode/CommandModeWindow.swift +0 -196
- package/apps/mac/Sources/Core/Overlays/CommandPalette/CommandPaletteView.swift +0 -307
- package/apps/mac/Sources/Core/Overlays/CommandPalette/CommandPaletteWindow.swift +0 -67
- package/apps/mac/Sources/Core/Overlays/HUD/CheatSheetHUD.swift +0 -576
- package/apps/mac/Sources/Core/Overlays/HUD/HUDBottomBar.swift +0 -279
- package/apps/mac/Sources/Core/Overlays/HUD/HUDController.swift +0 -1158
- package/apps/mac/Sources/Core/Overlays/HUD/HUDLeftBar.swift +0 -849
- package/apps/mac/Sources/Core/Overlays/HUD/HUDMinimap.swift +0 -179
- package/apps/mac/Sources/Core/Overlays/HUD/HUDRightBar.swift +0 -596
- package/apps/mac/Sources/Core/Overlays/HUD/HUDState.swift +0 -367
- package/apps/mac/Sources/Core/Overlays/HUD/HUDTopBar.swift +0 -243
- package/apps/mac/Sources/Core/Overlays/HUD/LauncherHUD.swift +0 -334
- package/apps/mac/Sources/Core/Overlays/HUD/LayerBezel.swift +0 -203
- package/apps/mac/Sources/Core/Overlays/OmniSearch/OmniSearchState.swift +0 -280
- package/apps/mac/Sources/Core/Overlays/OmniSearch/OmniSearchView.swift +0 -422
- package/apps/mac/Sources/Core/Overlays/OmniSearch/OmniSearchWindow.swift +0 -94
- package/apps/mac/Sources/Core/Overlays/OverlayPanelShell.swift +0 -241
- package/apps/mac/Sources/Core/Overlays/ScreenMap/ScreenMapState.swift +0 -3135
- package/apps/mac/Sources/Core/Overlays/ScreenMap/ScreenMapView.swift +0 -3977
- package/apps/mac/Sources/Core/Overlays/ScreenMap/ScreenMapWindowController.swift +0 -119
- package/apps/mac/Sources/Core/Overlays/ScreenOverlayCanvasController.swift +0 -1217
- package/apps/mac/Sources/Core/Overlays/Voice/VoiceCommandWindow.swift +0 -1575
- package/apps/mac/Sources/Core/Pi/PiAuthNextStepCard.swift +0 -148
- package/apps/mac/Sources/Core/Pi/PiAuthPromptCard.swift +0 -90
- package/apps/mac/Sources/Core/Pi/PiChatDock.swift +0 -564
- package/apps/mac/Sources/Core/Pi/PiChatSession.swift +0 -1948
- package/apps/mac/Sources/Core/Pi/PiInstallCallout.swift +0 -86
- package/apps/mac/Sources/Core/Pi/PiProviderSetupCallout.swift +0 -99
- package/apps/mac/Sources/Core/Pi/PiWorkspaceView.swift +0 -510
- package/apps/mac/Sources/Core/System/Capability.swift +0 -79
- package/apps/mac/Sources/Core/System/DiagnosticLog.swift +0 -373
- package/apps/mac/Sources/Core/System/EventBus.swift +0 -31
- package/apps/mac/Sources/Core/System/PermissionChecker.swift +0 -224
- package/apps/mac/Sources/Core/System/ProcessModel.swift +0 -199
- package/apps/mac/Sources/Core/System/ProcessQuery.swift +0 -151
- package/apps/mac/Sources/Core/System/SystemTelemetryMonitor.swift +0 -273
- package/apps/mac/Sources/Core/Voice/AdvisorLearningStore.swift +0 -90
- package/apps/mac/Sources/Core/Voice/AgentSession.swift +0 -377
- package/apps/mac/Sources/Core/Voice/AudioProvider.swift +0 -555
- package/apps/mac/Sources/Core/Voice/HandsOffSession.swift +0 -839
- package/apps/mac/Sources/Core/Voice/VoiceChatView.swift +0 -192
- package/apps/mac/Sources/Core/Voice/VoxClient.swift +0 -454
- package/apps/mac/Sources/Core/Workspace/Project.swift +0 -28
- package/apps/mac/Sources/Core/Workspace/ProjectScanner.swift +0 -141
- package/apps/mac/Sources/Core/Workspace/SessionLayerStore.swift +0 -285
- package/apps/mac/Sources/Core/Workspace/SessionManager.swift +0 -75
- package/apps/mac/Sources/Core/Workspace/Terminal/Terminal.swift +0 -259
- package/apps/mac/Sources/Core/Workspace/Terminal/TerminalQuery.swift +0 -156
- package/apps/mac/Sources/Core/Workspace/Terminal/TerminalSynthesizer.swift +0 -200
- package/apps/mac/Sources/Core/Workspace/Tmux/TmuxModel.swift +0 -60
- package/apps/mac/Sources/Core/Workspace/Tmux/TmuxQuery.swift +0 -105
- package/apps/mac/Sources/Core/Workspace/WorkspaceManager.swift +0 -1027
- package/apps/mac/Sources/UI/ActionRow.swift +0 -78
- package/apps/mac/Sources/UI/OrphanRow.swift +0 -129
- package/apps/mac/Sources/UI/ProjectRow.swift +0 -368
- package/apps/mac/Sources/UI/TabGroupRow.swift +0 -178
- package/apps/mac/Sources/UI/Theme.swift +0 -164
- package/apps/mac/Tests/StageDragTests.swift +0 -333
- package/apps/mac/Tests/StageJoinTests.swift +0 -313
- package/apps/mac/Tests/StageManagerTests.swift +0 -280
- package/apps/mac/Tests/StageTileTests.swift +0 -353
- package/swift/Package.swift +0 -20
- package/swift/Sources/DeckKit/DeckAction.swift +0 -51
- package/swift/Sources/DeckKit/DeckBridgeSecurity.swift +0 -152
- package/swift/Sources/DeckKit/DeckCockpit.swift +0 -82
- package/swift/Sources/DeckKit/DeckHost.swift +0 -7
- package/swift/Sources/DeckKit/DeckManifest.swift +0 -145
- package/swift/Sources/DeckKit/DeckRuntimeSnapshot.swift +0 -533
- package/swift/Sources/DeckKit/DeckTrackpad.swift +0 -63
- package/swift/Sources/DeckKit/DeckValue.swift +0 -93
- package/swift/Sources/DeckKit/DeckVoiceError.swift +0 -88
- package/swift/Tests/DeckKitTests/DeckKitTests.swift +0 -286
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
import SwiftUI
|
|
2
|
-
|
|
3
|
-
struct PiInstallCallout: View {
|
|
4
|
-
@ObservedObject var session: PiChatSession
|
|
5
|
-
let compact: Bool
|
|
6
|
-
|
|
7
|
-
var body: some View {
|
|
8
|
-
VStack(alignment: .leading, spacing: compact ? 10 : 12) {
|
|
9
|
-
HStack(spacing: 8) {
|
|
10
|
-
Circle()
|
|
11
|
-
.fill(Palette.kill)
|
|
12
|
-
.frame(width: compact ? 6 : 7, height: compact ? 6 : 7)
|
|
13
|
-
|
|
14
|
-
Text("PI REQUIRED")
|
|
15
|
-
.font(Typo.geistMonoBold(compact ? 9 : 10))
|
|
16
|
-
.foregroundColor(Palette.kill.opacity(0.95))
|
|
17
|
-
|
|
18
|
-
Text("assistant unavailable")
|
|
19
|
-
.font(Typo.mono(compact ? 9 : 10))
|
|
20
|
-
.foregroundColor(Palette.textMuted)
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
Text("Install the official Pi coding agent CLI to use the in-app assistant. Lattices can copy the command or run it in \(Preferences.shared.terminal.rawValue).")
|
|
24
|
-
.font(Typo.mono(compact ? 10 : 11))
|
|
25
|
-
.foregroundColor(Palette.textDim)
|
|
26
|
-
.fixedSize(horizontal: false, vertical: true)
|
|
27
|
-
|
|
28
|
-
Text(session.piInstallCommand)
|
|
29
|
-
.font(Typo.mono(compact ? 10 : 11))
|
|
30
|
-
.foregroundColor(Palette.text)
|
|
31
|
-
.textSelection(.enabled)
|
|
32
|
-
.frame(maxWidth: .infinity, alignment: .leading)
|
|
33
|
-
.padding(.horizontal, compact ? 10 : 12)
|
|
34
|
-
.padding(.vertical, compact ? 8 : 10)
|
|
35
|
-
.background(
|
|
36
|
-
RoundedRectangle(cornerRadius: compact ? 6 : 8)
|
|
37
|
-
.fill(Color.black.opacity(0.35))
|
|
38
|
-
.overlay(
|
|
39
|
-
RoundedRectangle(cornerRadius: compact ? 6 : 8)
|
|
40
|
-
.strokeBorder(Palette.border, lineWidth: 0.5)
|
|
41
|
-
)
|
|
42
|
-
)
|
|
43
|
-
|
|
44
|
-
HStack(spacing: 8) {
|
|
45
|
-
actionButton(compact ? "COPY" : "COPY CMD", tint: Palette.running) {
|
|
46
|
-
session.copyPiInstallCommand()
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
actionButton(compact ? "INSTALL" : "INSTALL IN TERMINAL", tint: Palette.detach) {
|
|
50
|
-
session.installPiInTerminal()
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
actionButton("REFRESH", tint: Palette.textMuted) {
|
|
54
|
-
session.refreshBinaryAvailability()
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
.padding(.horizontal, compact ? 10 : 16)
|
|
59
|
-
.padding(.vertical, compact ? 10 : 14)
|
|
60
|
-
.background(
|
|
61
|
-
RoundedRectangle(cornerRadius: compact ? 6 : 8)
|
|
62
|
-
.fill(Palette.kill.opacity(0.06))
|
|
63
|
-
.overlay(
|
|
64
|
-
RoundedRectangle(cornerRadius: compact ? 6 : 8)
|
|
65
|
-
.strokeBorder(Palette.kill.opacity(0.22), lineWidth: 0.5)
|
|
66
|
-
)
|
|
67
|
-
)
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
private func actionButton(_ label: String, tint: Color, action: @escaping () -> Void) -> some View {
|
|
71
|
-
Button(label, action: action)
|
|
72
|
-
.buttonStyle(.plain)
|
|
73
|
-
.font(Typo.geistMonoBold(compact ? 9 : 10))
|
|
74
|
-
.foregroundColor(tint)
|
|
75
|
-
.padding(.horizontal, compact ? 8 : 10)
|
|
76
|
-
.padding(.vertical, compact ? 5 : 6)
|
|
77
|
-
.background(
|
|
78
|
-
Capsule()
|
|
79
|
-
.fill(Color.white.opacity(0.03))
|
|
80
|
-
.overlay(
|
|
81
|
-
Capsule()
|
|
82
|
-
.strokeBorder(Palette.border, lineWidth: 0.5)
|
|
83
|
-
)
|
|
84
|
-
)
|
|
85
|
-
}
|
|
86
|
-
}
|
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
import SwiftUI
|
|
2
|
-
|
|
3
|
-
struct PiProviderSetupCallout: View {
|
|
4
|
-
@ObservedObject var session: PiChatSession
|
|
5
|
-
let compact: Bool
|
|
6
|
-
|
|
7
|
-
var body: some View {
|
|
8
|
-
VStack(alignment: .leading, spacing: compact ? 10 : 12) {
|
|
9
|
-
HStack(spacing: 8) {
|
|
10
|
-
Circle()
|
|
11
|
-
.fill(Palette.detach)
|
|
12
|
-
.frame(width: compact ? 6 : 7, height: compact ? 6 : 7)
|
|
13
|
-
|
|
14
|
-
Text("SET UP YOUR AI")
|
|
15
|
-
.font(Typo.geistMonoBold(compact ? 9 : 10))
|
|
16
|
-
.foregroundColor(Palette.detach.opacity(0.95))
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
Text(session.isAuthenticating
|
|
20
|
-
? "Finish the setup above. As soon as that one step is done, the chat box unlocks."
|
|
21
|
-
: "Chat is optional. Connect \(session.currentProvider.name) when you want the in-app assistant.")
|
|
22
|
-
.font(Typo.mono(compact ? 10 : 11))
|
|
23
|
-
.foregroundColor(Palette.textDim)
|
|
24
|
-
.fixedSize(horizontal: false, vertical: true)
|
|
25
|
-
|
|
26
|
-
HStack(spacing: 8) {
|
|
27
|
-
capsuleLabel(session.currentProvider.name.uppercased(), tint: Palette.text)
|
|
28
|
-
capsuleLabel(session.currentProvider.authMode == .oauth ? "SIGN IN" : "API KEY", tint: Palette.running)
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
if session.isAuthenticating {
|
|
32
|
-
PiAuthNextStepCard(session: session, compact: compact)
|
|
33
|
-
} else {
|
|
34
|
-
Text(session.currentProvider.authMode == .oauth
|
|
35
|
-
? "This opens the provider flow in your browser."
|
|
36
|
-
: "Open setup when you are ready to paste and save a key.")
|
|
37
|
-
.font(Typo.mono(compact ? 9 : 10))
|
|
38
|
-
.foregroundColor(Palette.textMuted)
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
if session.currentProvider.authMode == .oauth && !session.isAuthenticating {
|
|
42
|
-
primaryActionButton(
|
|
43
|
-
"SET UP \(session.currentProvider.name.uppercased())",
|
|
44
|
-
tint: Palette.running
|
|
45
|
-
) {
|
|
46
|
-
session.toggleAuthPanel()
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
.padding(.horizontal, compact ? 10 : 16)
|
|
51
|
-
.padding(.vertical, compact ? 10 : 14)
|
|
52
|
-
.background(
|
|
53
|
-
RoundedRectangle(cornerRadius: compact ? 6 : 8)
|
|
54
|
-
.fill(Palette.detach.opacity(0.06))
|
|
55
|
-
.overlay(
|
|
56
|
-
RoundedRectangle(cornerRadius: compact ? 6 : 8)
|
|
57
|
-
.strokeBorder(Palette.detach.opacity(0.22), lineWidth: 0.5)
|
|
58
|
-
)
|
|
59
|
-
)
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
private func primaryActionButton(_ label: String, tint: Color, disabled: Bool = false, action: @escaping () -> Void) -> some View {
|
|
63
|
-
Button(action: action) {
|
|
64
|
-
Text(label)
|
|
65
|
-
.font(Typo.geistMonoBold(compact ? 10 : 11))
|
|
66
|
-
.foregroundColor(disabled ? Palette.textMuted : tint)
|
|
67
|
-
.frame(maxWidth: .infinity)
|
|
68
|
-
.padding(.horizontal, compact ? 10 : 12)
|
|
69
|
-
.padding(.vertical, compact ? 8 : 10)
|
|
70
|
-
.background(
|
|
71
|
-
RoundedRectangle(cornerRadius: compact ? 6 : 8)
|
|
72
|
-
.fill(tint.opacity(disabled ? 0.05 : 0.12))
|
|
73
|
-
.overlay(
|
|
74
|
-
RoundedRectangle(cornerRadius: compact ? 6 : 8)
|
|
75
|
-
.strokeBorder((disabled ? Palette.border : tint.opacity(0.35)), lineWidth: 0.5)
|
|
76
|
-
)
|
|
77
|
-
)
|
|
78
|
-
}
|
|
79
|
-
.buttonStyle(.plain)
|
|
80
|
-
.opacity(disabled ? 0.65 : 1)
|
|
81
|
-
.disabled(disabled)
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
private func capsuleLabel(_ text: String, tint: Color) -> some View {
|
|
85
|
-
Text(text)
|
|
86
|
-
.font(Typo.geistMonoBold(compact ? 9 : 10))
|
|
87
|
-
.foregroundColor(tint.opacity(0.95))
|
|
88
|
-
.padding(.horizontal, compact ? 7 : 8)
|
|
89
|
-
.padding(.vertical, compact ? 4 : 5)
|
|
90
|
-
.background(
|
|
91
|
-
Capsule()
|
|
92
|
-
.fill(tint.opacity(0.10))
|
|
93
|
-
.overlay(
|
|
94
|
-
Capsule()
|
|
95
|
-
.strokeBorder(tint.opacity(0.28), lineWidth: 0.5)
|
|
96
|
-
)
|
|
97
|
-
)
|
|
98
|
-
}
|
|
99
|
-
}
|
|
@@ -1,510 +0,0 @@
|
|
|
1
|
-
import SwiftUI
|
|
2
|
-
|
|
3
|
-
struct PiWorkspaceView: View {
|
|
4
|
-
@StateObject private var session = PiChatSession.shared
|
|
5
|
-
@FocusState private var composerFocused: Bool
|
|
6
|
-
@FocusState private var authFieldFocused: Bool
|
|
7
|
-
|
|
8
|
-
private static let timeFormatter: DateFormatter = {
|
|
9
|
-
let formatter = DateFormatter()
|
|
10
|
-
formatter.dateFormat = "HH:mm"
|
|
11
|
-
return formatter
|
|
12
|
-
}()
|
|
13
|
-
|
|
14
|
-
var body: some View {
|
|
15
|
-
VStack(spacing: 0) {
|
|
16
|
-
header
|
|
17
|
-
|
|
18
|
-
Rectangle()
|
|
19
|
-
.fill(Palette.border)
|
|
20
|
-
.frame(height: 0.5)
|
|
21
|
-
|
|
22
|
-
transcript
|
|
23
|
-
|
|
24
|
-
Rectangle()
|
|
25
|
-
.fill(Palette.border)
|
|
26
|
-
.frame(height: 0.5)
|
|
27
|
-
|
|
28
|
-
if session.hasPiBinary && !session.needsProviderSetup {
|
|
29
|
-
composer
|
|
30
|
-
} else if session.needsProviderSetup {
|
|
31
|
-
providerSettingsPrompt
|
|
32
|
-
} else {
|
|
33
|
-
PiInstallCallout(session: session, compact: false)
|
|
34
|
-
.padding(.horizontal, 16)
|
|
35
|
-
.padding(.vertical, 14)
|
|
36
|
-
.background(Palette.surface.opacity(0.22))
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
.background(Palette.bg)
|
|
40
|
-
.onAppear {
|
|
41
|
-
session.prepareForDisplay()
|
|
42
|
-
if session.hasPiBinary && !session.needsProviderSetup {
|
|
43
|
-
DispatchQueue.main.asyncAfter(deadline: .now() + 0.1) {
|
|
44
|
-
composerFocused = true
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
private var header: some View {
|
|
51
|
-
HStack(spacing: 10) {
|
|
52
|
-
VStack(alignment: .leading, spacing: 6) {
|
|
53
|
-
HStack(spacing: 8) {
|
|
54
|
-
Circle()
|
|
55
|
-
.fill(session.hasPiBinary ? Palette.running : Palette.kill)
|
|
56
|
-
.frame(width: 7, height: 7)
|
|
57
|
-
|
|
58
|
-
Text("WORKSPACE ASSISTANT")
|
|
59
|
-
.font(Typo.geistMonoBold(11))
|
|
60
|
-
.foregroundColor(Palette.text)
|
|
61
|
-
|
|
62
|
-
capsuleLabel(
|
|
63
|
-
session.statusText.uppercased(),
|
|
64
|
-
tint: session.statusText == "missing pi"
|
|
65
|
-
? Palette.kill
|
|
66
|
-
: ((session.statusText == "setup ai" || session.statusText == "connecting...")
|
|
67
|
-
? Palette.detach
|
|
68
|
-
: (session.isSending ? Palette.detach : Palette.running))
|
|
69
|
-
)
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
Text(session.hasPiBinary
|
|
73
|
-
? (session.isAuthenticating
|
|
74
|
-
? session.authStepDescription
|
|
75
|
-
: (session.needsProviderSetup
|
|
76
|
-
? "Next step: connect a provider to unlock chat."
|
|
77
|
-
: "Full conversation surface for settings, longer prompts, planning, debugging, and second opinions."))
|
|
78
|
-
: "Settings chat is ready here. Install the provider runtime to unlock longer prompts and provider-backed chat.")
|
|
79
|
-
.font(Typo.mono(10))
|
|
80
|
-
.foregroundColor(Palette.textDim)
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
Spacer()
|
|
84
|
-
|
|
85
|
-
HStack(spacing: 6) {
|
|
86
|
-
settingsGearButton
|
|
87
|
-
|
|
88
|
-
if session.hasConversationHistory {
|
|
89
|
-
actionChip("RESET") {
|
|
90
|
-
session.clearConversation()
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
.padding(.horizontal, 16)
|
|
96
|
-
.padding(.vertical, 14)
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
private var settingsGearButton: some View {
|
|
100
|
-
Button {
|
|
101
|
-
SettingsWindowController.shared.showAssistant()
|
|
102
|
-
} label: {
|
|
103
|
-
Image(systemName: "gearshape")
|
|
104
|
-
.font(.system(size: 11, weight: .semibold))
|
|
105
|
-
.foregroundColor(Palette.textMuted)
|
|
106
|
-
.frame(width: 26, height: 24)
|
|
107
|
-
.background(
|
|
108
|
-
Capsule()
|
|
109
|
-
.fill(Color.white.opacity(0.03))
|
|
110
|
-
.overlay(Capsule().strokeBorder(Palette.border, lineWidth: 0.5))
|
|
111
|
-
)
|
|
112
|
-
}
|
|
113
|
-
.buttonStyle(.plain)
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
private var providerSettingsPrompt: some View {
|
|
117
|
-
HStack(alignment: .center, spacing: 10) {
|
|
118
|
-
Circle()
|
|
119
|
-
.fill(Palette.detach)
|
|
120
|
-
.frame(width: 7, height: 7)
|
|
121
|
-
|
|
122
|
-
VStack(alignment: .leading, spacing: 3) {
|
|
123
|
-
Text("CONNECT A PROVIDER")
|
|
124
|
-
.font(Typo.geistMonoBold(10))
|
|
125
|
-
.foregroundColor(Palette.text)
|
|
126
|
-
|
|
127
|
-
Text("Choose OpenAI, Groq, OpenRouter, or MiniMax in Settings to unlock provider-backed chat.")
|
|
128
|
-
.font(Typo.mono(10))
|
|
129
|
-
.foregroundColor(Palette.textDim)
|
|
130
|
-
.fixedSize(horizontal: false, vertical: true)
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
Spacer()
|
|
134
|
-
|
|
135
|
-
actionChip("SETTINGS", tint: Palette.running) {
|
|
136
|
-
SettingsWindowController.shared.showAssistant()
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
.padding(.horizontal, 16)
|
|
140
|
-
.padding(.vertical, 14)
|
|
141
|
-
.background(Palette.surface.opacity(0.22))
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
private var authPanel: some View {
|
|
145
|
-
VStack(alignment: .leading, spacing: 12) {
|
|
146
|
-
if session.isAuthenticating {
|
|
147
|
-
VStack(alignment: .leading, spacing: 4) {
|
|
148
|
-
Text("Finish Setup")
|
|
149
|
-
.font(Typo.geistMonoBold(11))
|
|
150
|
-
.foregroundColor(Palette.text)
|
|
151
|
-
|
|
152
|
-
Text("Ignore the rest for a second and just do the next step below.")
|
|
153
|
-
.font(Typo.mono(10))
|
|
154
|
-
.foregroundColor(Palette.textDim)
|
|
155
|
-
.fixedSize(horizontal: false, vertical: true)
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
HStack(spacing: 8) {
|
|
159
|
-
capsuleLabel(session.currentProvider.name.uppercased(), tint: Palette.text)
|
|
160
|
-
capsuleLabel("IN PROGRESS", tint: Palette.detach)
|
|
161
|
-
Spacer()
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
if let prompt = session.pendingAuthPrompt {
|
|
165
|
-
PiAuthPromptCard(session: session, prompt: prompt, compact: false, focus: $authFieldFocused)
|
|
166
|
-
} else {
|
|
167
|
-
PiAuthNextStepCard(session: session, compact: false)
|
|
168
|
-
}
|
|
169
|
-
} else {
|
|
170
|
-
if session.needsProviderSetup {
|
|
171
|
-
VStack(alignment: .leading, spacing: 4) {
|
|
172
|
-
Text("Set Up Your AI")
|
|
173
|
-
.font(Typo.geistMonoBold(11))
|
|
174
|
-
.foregroundColor(Palette.text)
|
|
175
|
-
|
|
176
|
-
Text("Choose a provider, connect it once, and the chat box unlocks automatically.")
|
|
177
|
-
.font(Typo.mono(10))
|
|
178
|
-
.foregroundColor(Palette.textDim)
|
|
179
|
-
.fixedSize(horizontal: false, vertical: true)
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
HStack(spacing: 8) {
|
|
184
|
-
Text(session.needsProviderSetup ? "choose provider" : "provider")
|
|
185
|
-
.font(Typo.geistMonoBold(9))
|
|
186
|
-
.foregroundColor(Palette.textMuted)
|
|
187
|
-
|
|
188
|
-
Picker("Provider", selection: $session.authProviderID) {
|
|
189
|
-
ForEach(session.providerOptions) { provider in
|
|
190
|
-
Text(provider.name).tag(provider.id)
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
.labelsHidden()
|
|
194
|
-
.pickerStyle(.menu)
|
|
195
|
-
.font(Typo.mono(10))
|
|
196
|
-
|
|
197
|
-
Spacer()
|
|
198
|
-
|
|
199
|
-
capsuleLabel(
|
|
200
|
-
session.currentProvider.authMode == .oauth ? "OAUTH" : "TOKEN",
|
|
201
|
-
tint: session.currentProvider.authMode == .oauth ? Palette.detach : Palette.running
|
|
202
|
-
)
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
Text(session.currentProvider.helpText)
|
|
206
|
-
.font(Typo.mono(10))
|
|
207
|
-
.foregroundColor(Palette.textDim)
|
|
208
|
-
.fixedSize(horizontal: false, vertical: true)
|
|
209
|
-
|
|
210
|
-
if session.currentProvider.authMode == .apiKey {
|
|
211
|
-
if session.hasSelectedCredential && !session.isEditingStoredCredential {
|
|
212
|
-
HStack(spacing: 8) {
|
|
213
|
-
Circle()
|
|
214
|
-
.fill(Palette.running)
|
|
215
|
-
.frame(width: 6, height: 6)
|
|
216
|
-
|
|
217
|
-
Text("\(session.currentProvider.name) credential saved")
|
|
218
|
-
.font(Typo.mono(10))
|
|
219
|
-
.foregroundColor(Palette.textDim)
|
|
220
|
-
|
|
221
|
-
Spacer()
|
|
222
|
-
|
|
223
|
-
actionChip("REPLACE") {
|
|
224
|
-
session.beginReplacingSelectedCredential()
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
actionChip("CLEAR") {
|
|
228
|
-
session.removeSelectedCredential()
|
|
229
|
-
}
|
|
230
|
-
}
|
|
231
|
-
.padding(.horizontal, 12)
|
|
232
|
-
.padding(.vertical, 10)
|
|
233
|
-
.background(authCardBackground(tint: Palette.running))
|
|
234
|
-
} else {
|
|
235
|
-
HStack(spacing: 8) {
|
|
236
|
-
SecureField(session.currentProvider.tokenPlaceholder, text: $session.authToken)
|
|
237
|
-
.textFieldStyle(.plain)
|
|
238
|
-
.font(Typo.mono(11))
|
|
239
|
-
.foregroundColor(Palette.text)
|
|
240
|
-
.focused($authFieldFocused)
|
|
241
|
-
.onSubmit {
|
|
242
|
-
session.saveSelectedToken()
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
actionChip("SAVE KEY") {
|
|
246
|
-
session.saveSelectedToken()
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
if session.hasSelectedCredential {
|
|
250
|
-
actionChip("CANCEL") {
|
|
251
|
-
session.cancelReplacingSelectedCredential()
|
|
252
|
-
}
|
|
253
|
-
}
|
|
254
|
-
}
|
|
255
|
-
.padding(.horizontal, 12)
|
|
256
|
-
.padding(.vertical, 10)
|
|
257
|
-
.background(authCardBackground(tint: Palette.running))
|
|
258
|
-
}
|
|
259
|
-
} else {
|
|
260
|
-
HStack(spacing: 8) {
|
|
261
|
-
actionChip("CONNECT") {
|
|
262
|
-
session.startSelectedAuthFlow()
|
|
263
|
-
}
|
|
264
|
-
|
|
265
|
-
if session.hasSelectedCredential {
|
|
266
|
-
actionChip("CLEAR") {
|
|
267
|
-
session.removeSelectedCredential()
|
|
268
|
-
}
|
|
269
|
-
}
|
|
270
|
-
}
|
|
271
|
-
.padding(.horizontal, 12)
|
|
272
|
-
.padding(.vertical, 10)
|
|
273
|
-
.background(authCardBackground(tint: Palette.running))
|
|
274
|
-
}
|
|
275
|
-
}
|
|
276
|
-
|
|
277
|
-
if !session.isAuthenticating, let notice = session.authNoticeText, !notice.isEmpty {
|
|
278
|
-
Text(notice)
|
|
279
|
-
.font(Typo.mono(9))
|
|
280
|
-
.foregroundColor(Palette.textDim)
|
|
281
|
-
.fixedSize(horizontal: false, vertical: true)
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
if let error = session.authErrorText, !error.isEmpty {
|
|
285
|
-
Text(error)
|
|
286
|
-
.font(Typo.mono(9))
|
|
287
|
-
.foregroundColor(Palette.kill)
|
|
288
|
-
.fixedSize(horizontal: false, vertical: true)
|
|
289
|
-
}
|
|
290
|
-
}
|
|
291
|
-
.padding(.horizontal, 16)
|
|
292
|
-
.padding(.vertical, 14)
|
|
293
|
-
.background(Palette.surface.opacity(0.35))
|
|
294
|
-
.onAppear {
|
|
295
|
-
focusAuthFieldIfNeeded()
|
|
296
|
-
}
|
|
297
|
-
.onChange(of: session.authProviderID) { _ in
|
|
298
|
-
focusAuthFieldIfNeeded()
|
|
299
|
-
}
|
|
300
|
-
.onChange(of: session.pendingAuthPrompt?.message) { prompt in
|
|
301
|
-
if prompt != nil {
|
|
302
|
-
focusAuthFieldIfNeeded()
|
|
303
|
-
}
|
|
304
|
-
}
|
|
305
|
-
}
|
|
306
|
-
|
|
307
|
-
private var setupLockedPanel: some View {
|
|
308
|
-
HStack(alignment: .center, spacing: 10) {
|
|
309
|
-
Circle()
|
|
310
|
-
.fill(Palette.detach)
|
|
311
|
-
.frame(width: 7, height: 7)
|
|
312
|
-
|
|
313
|
-
VStack(alignment: .leading, spacing: 3) {
|
|
314
|
-
Text("SETUP IN PROGRESS")
|
|
315
|
-
.font(Typo.geistMonoBold(10))
|
|
316
|
-
.foregroundColor(Palette.text)
|
|
317
|
-
|
|
318
|
-
Text(session.isAuthenticating
|
|
319
|
-
? "Stay with the setup panel above for now. The chat box unlocks as soon as you finish that step."
|
|
320
|
-
: "Finish the setup panel above to unlock the chat box.")
|
|
321
|
-
.font(Typo.mono(10))
|
|
322
|
-
.foregroundColor(Palette.textDim)
|
|
323
|
-
.fixedSize(horizontal: false, vertical: true)
|
|
324
|
-
}
|
|
325
|
-
|
|
326
|
-
Spacer()
|
|
327
|
-
}
|
|
328
|
-
.padding(.horizontal, 16)
|
|
329
|
-
.padding(.vertical, 14)
|
|
330
|
-
.background(Palette.surface.opacity(0.22))
|
|
331
|
-
}
|
|
332
|
-
|
|
333
|
-
private var transcript: some View {
|
|
334
|
-
ScrollViewReader { proxy in
|
|
335
|
-
ScrollView(.vertical, showsIndicators: true) {
|
|
336
|
-
LazyVStack(alignment: .leading, spacing: 10) {
|
|
337
|
-
ForEach(session.messages) { message in
|
|
338
|
-
row(message)
|
|
339
|
-
.id(message.id)
|
|
340
|
-
}
|
|
341
|
-
}
|
|
342
|
-
.padding(.horizontal, 16)
|
|
343
|
-
.padding(.vertical, 16)
|
|
344
|
-
}
|
|
345
|
-
.onAppear {
|
|
346
|
-
if let last = session.messages.last?.id {
|
|
347
|
-
proxy.scrollTo(last, anchor: .bottom)
|
|
348
|
-
}
|
|
349
|
-
}
|
|
350
|
-
.onChange(of: session.messages.count) { _ in
|
|
351
|
-
if let last = session.messages.last?.id {
|
|
352
|
-
withAnimation(.easeOut(duration: 0.15)) {
|
|
353
|
-
proxy.scrollTo(last, anchor: .bottom)
|
|
354
|
-
}
|
|
355
|
-
}
|
|
356
|
-
}
|
|
357
|
-
}
|
|
358
|
-
}
|
|
359
|
-
|
|
360
|
-
private func row(_ message: PiChatMessage) -> some View {
|
|
361
|
-
HStack(alignment: .top, spacing: 12) {
|
|
362
|
-
VStack(alignment: .leading, spacing: 4) {
|
|
363
|
-
capsuleLabel(roleLabel(for: message.role).uppercased(), tint: roleColor(for: message.role))
|
|
364
|
-
Text(Self.timeFormatter.string(from: message.timestamp))
|
|
365
|
-
.font(Typo.mono(8))
|
|
366
|
-
.foregroundColor(Palette.textMuted)
|
|
367
|
-
}
|
|
368
|
-
.frame(width: 62, alignment: .leading)
|
|
369
|
-
|
|
370
|
-
Text(message.text)
|
|
371
|
-
.font(Typo.mono(12))
|
|
372
|
-
.foregroundColor(Palette.text)
|
|
373
|
-
.textSelection(.enabled)
|
|
374
|
-
.frame(maxWidth: .infinity, alignment: .leading)
|
|
375
|
-
}
|
|
376
|
-
.padding(.horizontal, 12)
|
|
377
|
-
.padding(.vertical, 10)
|
|
378
|
-
.background(
|
|
379
|
-
RoundedRectangle(cornerRadius: 8)
|
|
380
|
-
.fill(roleColor(for: message.role).opacity(message.role == .assistant ? 0.10 : 0.06))
|
|
381
|
-
.overlay(
|
|
382
|
-
RoundedRectangle(cornerRadius: 8)
|
|
383
|
-
.strokeBorder(roleColor(for: message.role).opacity(0.22), lineWidth: 0.5)
|
|
384
|
-
)
|
|
385
|
-
)
|
|
386
|
-
}
|
|
387
|
-
|
|
388
|
-
private var composer: some View {
|
|
389
|
-
VStack(spacing: 10) {
|
|
390
|
-
HStack(spacing: 10) {
|
|
391
|
-
Text(">")
|
|
392
|
-
.font(Typo.geistMonoBold(12))
|
|
393
|
-
.foregroundColor(Palette.running)
|
|
394
|
-
|
|
395
|
-
TextField("Ask about settings or planning...", text: $session.draft, axis: .vertical)
|
|
396
|
-
.textFieldStyle(.plain)
|
|
397
|
-
.font(Typo.mono(12))
|
|
398
|
-
.foregroundColor(Palette.text)
|
|
399
|
-
.lineLimit(1...6)
|
|
400
|
-
.focused($composerFocused)
|
|
401
|
-
.onSubmit {
|
|
402
|
-
session.sendDraft()
|
|
403
|
-
}
|
|
404
|
-
|
|
405
|
-
actionChip(session.isSending ? "..." : "SEND") {
|
|
406
|
-
session.sendDraft()
|
|
407
|
-
}
|
|
408
|
-
}
|
|
409
|
-
.padding(.horizontal, 12)
|
|
410
|
-
.padding(.vertical, 10)
|
|
411
|
-
.background(
|
|
412
|
-
RoundedRectangle(cornerRadius: 8)
|
|
413
|
-
.fill(Color.black.opacity(0.28))
|
|
414
|
-
.overlay(
|
|
415
|
-
RoundedRectangle(cornerRadius: 8)
|
|
416
|
-
.strokeBorder(Palette.running.opacity(0.18), lineWidth: 0.5)
|
|
417
|
-
)
|
|
418
|
-
)
|
|
419
|
-
|
|
420
|
-
HStack {
|
|
421
|
-
HStack(spacing: 6) {
|
|
422
|
-
Circle()
|
|
423
|
-
.fill(session.hasPiBinary ? Palette.running : Palette.kill)
|
|
424
|
-
.frame(width: 6, height: 6)
|
|
425
|
-
|
|
426
|
-
Text(session.currentProvider.name)
|
|
427
|
-
.font(Typo.mono(10))
|
|
428
|
-
.foregroundColor(Palette.textMuted)
|
|
429
|
-
}
|
|
430
|
-
|
|
431
|
-
Spacer()
|
|
432
|
-
|
|
433
|
-
Text("Return to send")
|
|
434
|
-
.font(Typo.mono(9))
|
|
435
|
-
.foregroundColor(Palette.textMuted)
|
|
436
|
-
}
|
|
437
|
-
}
|
|
438
|
-
.padding(.horizontal, 16)
|
|
439
|
-
.padding(.vertical, 14)
|
|
440
|
-
.background(Palette.surface.opacity(0.22))
|
|
441
|
-
}
|
|
442
|
-
|
|
443
|
-
private func roleLabel(for role: PiChatMessage.Role) -> String {
|
|
444
|
-
switch role {
|
|
445
|
-
case .system: return "system"
|
|
446
|
-
case .user: return "you"
|
|
447
|
-
case .assistant: return "assistant"
|
|
448
|
-
}
|
|
449
|
-
}
|
|
450
|
-
|
|
451
|
-
private func focusAuthFieldIfNeeded() {
|
|
452
|
-
if session.currentProvider.authMode == .apiKey || session.pendingAuthPrompt != nil {
|
|
453
|
-
DispatchQueue.main.asyncAfter(deadline: .now() + 0.05) {
|
|
454
|
-
authFieldFocused = true
|
|
455
|
-
}
|
|
456
|
-
}
|
|
457
|
-
}
|
|
458
|
-
|
|
459
|
-
private func roleColor(for role: PiChatMessage.Role) -> Color {
|
|
460
|
-
switch role {
|
|
461
|
-
case .system: return Palette.detach
|
|
462
|
-
case .user: return Palette.textDim
|
|
463
|
-
case .assistant: return Palette.running
|
|
464
|
-
}
|
|
465
|
-
}
|
|
466
|
-
|
|
467
|
-
private func capsuleLabel(_ text: String, tint: Color) -> some View {
|
|
468
|
-
Text(text)
|
|
469
|
-
.font(Typo.geistMonoBold(9))
|
|
470
|
-
.foregroundColor(tint.opacity(0.95))
|
|
471
|
-
.padding(.horizontal, 7)
|
|
472
|
-
.padding(.vertical, 4)
|
|
473
|
-
.background(
|
|
474
|
-
Capsule()
|
|
475
|
-
.fill(tint.opacity(0.10))
|
|
476
|
-
.overlay(
|
|
477
|
-
Capsule()
|
|
478
|
-
.strokeBorder(tint.opacity(0.28), lineWidth: 0.5)
|
|
479
|
-
)
|
|
480
|
-
)
|
|
481
|
-
}
|
|
482
|
-
|
|
483
|
-
private func actionChip(_ label: String, tint: Color = Palette.textMuted, disabled: Bool = false, action: @escaping () -> Void) -> some View {
|
|
484
|
-
Button(label, action: action)
|
|
485
|
-
.buttonStyle(.plain)
|
|
486
|
-
.font(Typo.geistMonoBold(9))
|
|
487
|
-
.foregroundColor(disabled ? Palette.textMuted : tint)
|
|
488
|
-
.padding(.horizontal, 8)
|
|
489
|
-
.padding(.vertical, 5)
|
|
490
|
-
.background(
|
|
491
|
-
Capsule()
|
|
492
|
-
.fill(Color.white.opacity(0.03))
|
|
493
|
-
.overlay(
|
|
494
|
-
Capsule()
|
|
495
|
-
.strokeBorder(Palette.border, lineWidth: 0.5)
|
|
496
|
-
)
|
|
497
|
-
)
|
|
498
|
-
.opacity(disabled ? 0.65 : 1)
|
|
499
|
-
.disabled(disabled)
|
|
500
|
-
}
|
|
501
|
-
|
|
502
|
-
private func authCardBackground(tint: Color) -> some View {
|
|
503
|
-
RoundedRectangle(cornerRadius: 8)
|
|
504
|
-
.fill(tint.opacity(0.06))
|
|
505
|
-
.overlay(
|
|
506
|
-
RoundedRectangle(cornerRadius: 8)
|
|
507
|
-
.strokeBorder(tint.opacity(0.22), lineWidth: 0.5)
|
|
508
|
-
)
|
|
509
|
-
}
|
|
510
|
-
}
|