More capabilities for tentacles, for an upcoming one

This commit is contained in:
lilmike committed 2026-11-23 08:25:36 -08:00
1 parent ffc5107112
commit a34d7e70c8
53 files changed
+2744 -131

No files matched your search

+12 -1
View File
@@ -23,6 +23,9 @@ func tentacleUpdateCapabilities(entry tentacle.Entry, manifest tentacle.Manifest
if entry.ReaderSettings {
previous = append(previous, "reader-settings")
}
if entry.Automation {
previous = append(previous, "automation")
}
previous = append(previous, entry.RemoteGrants...)
if len(previous) == 0 {
previous = append(previous, "none")
@@ -46,12 +49,13 @@ func tentacleInstallConfirmation(entry tentacle.Entry, manifest tentacle.Manifes
if slices.Contains(manifest.Capabilities, "reader-settings") {
permissions += " It can also add preferences pages and quick settings, inspect speech voices, and temporarily change the reader voice configuration."
}
permissions += automationPermissions(manifest.Capabilities)
permissions += remotePermissions(manifest.Capabilities)
return fmt.Sprintf("%s %s version %s from %s?\n\n%s\n\nOnly install packages from publishers you trust. Tentacles run with your account's access; resource limits do not protect your files or network.\n\nTentacle management changes take effect immediately.", label, entry.Name, entry.Version, entry.Repository, permissions)
}
func tentacleUpdateConfirmation(entry tentacle.Entry, update tentacle.AvailableUpdate, manifest tentacle.Manifest) string {
permissions := tentacleUpdateCapabilities(entry, manifest) + remotePermissions(manifest.Capabilities)
permissions := tentacleUpdateCapabilities(entry, manifest) + remotePermissions(manifest.Capabilities) + automationPermissions(manifest.Capabilities)
return fmt.Sprintf("Update %s from version %s to version %s?\n\n%s\n\nOnly update packages from publishers you trust. Tentacles run with your account's access.\n\nChanges take effect immediately.", update.Name, update.InstalledVersion, update.AvailableVersion, permissions)
}
@@ -76,3 +80,10 @@ func remotePermissions(grants []string) string {
}
return " Requested remote access: " + strings.Join(requested, "; ") + ". Installation does not start a connection or authorize control. Each session requires local approval, and unavailable reader operations remain disabled."
}
func automationPermissions(grants []string) string {
if slices.Contains(grants, "automation") {
return " It can also control the mouse and OCR in a declared foreground application when invoked."
}
return ""
}
@@ -66,3 +66,17 @@ func TestRemoteGrantConfirmationExplainsDirectionAndConsent(t *testing.T) {
t.Fatal("existing grants hidden")
}
}
func TestAutomationPermissionIsDisclosedSeparately(t *testing.T) {
for _, granted := range []bool{false, true} {
manifest := tentacle.Manifest{Capabilities: []string{"presentation", "interaction"}}
if granted {
manifest.Capabilities = append(manifest.Capabilities, "automation")
}
for _, message := range []string{tentacleInstallConfirmation(tentacle.Entry{}, manifest, "Install"), tentacleUpdateConfirmation(tentacle.Entry{}, tentacle.AvailableUpdate{}, manifest)} {
if strings.Contains(message, "control the mouse and OCR") != granted {
t.Fatal("automation permission described incorrectly", message)
}
}
}
}