fix: ensure remote clawdis-mac path
parent
759ab54e59
commit
faca83e1e8
|
|
@ -22,6 +22,7 @@ let voiceWakeForwardCommandKey = "clawdis.voiceWakeForwardCommand"
|
||||||
let modelCatalogPathKey = "clawdis.modelCatalogPath"
|
let modelCatalogPathKey = "clawdis.modelCatalogPath"
|
||||||
let modelCatalogReloadKey = "clawdis.modelCatalogReload"
|
let modelCatalogReloadKey = "clawdis.modelCatalogReload"
|
||||||
let voiceWakeSupported: Bool = ProcessInfo.processInfo.operatingSystemVersion.majorVersion >= 26
|
let voiceWakeSupported: Bool = ProcessInfo.processInfo.operatingSystemVersion.majorVersion >= 26
|
||||||
|
let cliHelperSearchPaths = ["/usr/local/bin", "/opt/homebrew/bin"]
|
||||||
let defaultVoiceWakeForwardCommand = "clawdis-mac agent --message \"${text}\" --thinking low"
|
let defaultVoiceWakeForwardCommand = "clawdis-mac agent --message \"${text}\" --thinking low"
|
||||||
let defaultVoiceWakeForwardPort = 22
|
let defaultVoiceWakeForwardPort = 22
|
||||||
let defaultVoiceWakeForwardTimeout: TimeInterval = 6
|
let defaultVoiceWakeForwardTimeout: TimeInterval = 6
|
||||||
|
|
|
||||||
|
|
@ -97,7 +97,7 @@ enum CLIInstaller {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
let targets = ["/usr/local/bin/clawdis-mac", "/opt/homebrew/bin/clawdis-mac"]
|
let targets = cliHelperSearchPaths.map { "\($0)/clawdis-mac" }
|
||||||
let result = await self.privilegedSymlink(source: helper.path, targets: targets)
|
let result = await self.privilegedSymlink(source: helper.path, targets: targets)
|
||||||
await statusHandler(result)
|
await statusHandler(result)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,11 @@ struct VoiceWakeForwardConfig: Sendable {
|
||||||
|
|
||||||
enum VoiceWakeForwarder {
|
enum VoiceWakeForwarder {
|
||||||
private static let logger = Logger(subsystem: "com.steipete.clawdis", category: "voicewake.forward")
|
private static let logger = Logger(subsystem: "com.steipete.clawdis", category: "voicewake.forward")
|
||||||
|
private static let cliPathPrefix = "PATH=\(cliHelperSearchPaths.joined(separator: ":")):$PATH"
|
||||||
|
|
||||||
|
static func commandWithCliPath(_ command: String) -> String {
|
||||||
|
"\(self.cliPathPrefix); \(command)"
|
||||||
|
}
|
||||||
|
|
||||||
enum VoiceWakeForwardError: LocalizedError, Equatable {
|
enum VoiceWakeForwardError: LocalizedError, Equatable {
|
||||||
case invalidTarget
|
case invalidTarget
|
||||||
|
|
@ -57,7 +62,7 @@ enum VoiceWakeForwarder {
|
||||||
args.append(userHost)
|
args.append(userHost)
|
||||||
|
|
||||||
let rendered = self.renderedCommand(template: config.commandTemplate, transcript: transcript)
|
let rendered = self.renderedCommand(template: config.commandTemplate, transcript: transcript)
|
||||||
args.append(contentsOf: ["sh", "-c", rendered])
|
args.append(contentsOf: ["sh", "-c", self.commandWithCliPath(rendered)])
|
||||||
|
|
||||||
self.logger.info("voice wake forward starting host=\(userHost, privacy: .public)")
|
self.logger.info("voice wake forward starting host=\(userHost, privacy: .public)")
|
||||||
|
|
||||||
|
|
@ -134,7 +139,8 @@ enum VoiceWakeForwarder {
|
||||||
|
|
||||||
// Stage 2: ensure remote clawdis-mac is present and responsive.
|
// Stage 2: ensure remote clawdis-mac is present and responsive.
|
||||||
var checkArgs = baseArgs
|
var checkArgs = baseArgs
|
||||||
checkArgs.append(contentsOf: [userHost, "clawdis-mac", "status"])
|
let statusCommand = self.commandWithCliPath("clawdis-mac status")
|
||||||
|
checkArgs.append(contentsOf: [userHost, "sh", "-c", statusCommand])
|
||||||
let checkProc = Process()
|
let checkProc = Process()
|
||||||
checkProc.executableURL = URL(fileURLWithPath: "/usr/bin/ssh")
|
checkProc.executableURL = URL(fileURLWithPath: "/usr/bin/ssh")
|
||||||
checkProc.arguments = checkArgs
|
checkProc.arguments = checkArgs
|
||||||
|
|
|
||||||
|
|
@ -29,4 +29,11 @@ import Testing
|
||||||
let command = VoiceWakeForwarder.renderedCommand(template: template, transcript: "ignored")
|
let command = VoiceWakeForwarder.renderedCommand(template: template, transcript: "ignored")
|
||||||
#expect(command == template)
|
#expect(command == template)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test func commandPrefersCliInstallPaths() {
|
||||||
|
let command = VoiceWakeForwarder.commandWithCliPath("clawdis-mac status")
|
||||||
|
let prefix = "PATH=\(cliHelperSearchPaths.joined(separator: ":")):$PATH; "
|
||||||
|
#expect(command.hasPrefix(prefix))
|
||||||
|
#expect(command.contains("clawdis-mac status"))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue