@songsid/agend 2.3.5-alpha.12 → 2.3.5-alpha.14
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/THIRD_PARTY_NOTICES.md +4 -0
- package/dist/agent-export.d.ts +74 -0
- package/dist/agent-export.js +362 -0
- package/dist/agent-export.js.map +1 -0
- package/dist/agent-workspace.d.ts +1 -2
- package/dist/agent-workspace.js +8 -29
- package/dist/agent-workspace.js.map +1 -1
- package/dist/auth-api.js +3 -1
- package/dist/auth-api.js.map +1 -1
- package/dist/backend/codex.d.ts +7 -14
- package/dist/backend/codex.js +25 -29
- package/dist/backend/codex.js.map +1 -1
- package/dist/backend/grok-mcp.d.ts +5 -0
- package/dist/backend/grok-mcp.js +221 -0
- package/dist/backend/grok-mcp.js.map +1 -0
- package/dist/backend/grok.d.ts +0 -10
- package/dist/backend/grok.js +5 -82
- package/dist/backend/grok.js.map +1 -1
- package/dist/backend/types.d.ts +6 -1
- package/dist/backend/types.js.map +1 -1
- package/dist/build-provenance.json +1 -1
- package/dist/cli.js +45 -12
- package/dist/cli.js.map +1 -1
- package/dist/codex-pane-ownership.d.ts +13 -0
- package/dist/codex-pane-ownership.js +192 -0
- package/dist/codex-pane-ownership.js.map +1 -0
- package/dist/daemon.d.ts +2 -0
- package/dist/daemon.js +89 -8
- package/dist/daemon.js.map +1 -1
- package/dist/fleet-manager.d.ts +15 -1
- package/dist/fleet-manager.js +72 -17
- package/dist/fleet-manager.js.map +1 -1
- package/dist/hub/client.d.ts +1 -1
- package/dist/hub/client.js +11 -0
- package/dist/hub/client.js.map +1 -1
- package/dist/hub/compose/member.d.ts +2 -2
- package/dist/hub/compose/member.js +11 -3
- package/dist/hub/compose/member.js.map +1 -1
- package/dist/hub/join/local.d.ts +1 -0
- package/dist/hub/join/local.js +8 -3
- package/dist/hub/join/local.js.map +1 -1
- package/dist/hub/member/exposure-api.d.ts +2 -0
- package/dist/hub/member/exposure-api.js +4 -2
- package/dist/hub/member/exposure-api.js.map +1 -1
- package/dist/hub/member/pairing-api.d.ts +2 -2
- package/dist/hub/member/pairing-api.js +2 -2
- package/dist/hub/member/pairing-api.js.map +1 -1
- package/dist/hub/server.js +8 -0
- package/dist/hub/server.js.map +1 -1
- package/dist/hub-pairing-summary.d.ts +3 -1
- package/dist/hub-pairing-summary.js +6 -3
- package/dist/hub-pairing-summary.js.map +1 -1
- package/dist/install-user-systemd.d.ts +20 -0
- package/dist/install-user-systemd.js +55 -0
- package/dist/install-user-systemd.js.map +1 -0
- package/dist/linux-launchers.d.ts +88 -0
- package/dist/linux-launchers.js +296 -0
- package/dist/linux-launchers.js.map +1 -0
- package/dist/locale.js +91 -4
- package/dist/locale.js.map +1 -1
- package/dist/runtime-client-store.js +5 -0
- package/dist/runtime-client-store.js.map +1 -1
- package/dist/runtime-pane-private.d.ts +2 -0
- package/dist/runtime-pane-private.js +25 -0
- package/dist/runtime-pane-private.js.map +1 -1
- package/dist/runtime-pane-private.ps1 +74 -7
- package/dist/selection-card.d.ts +4 -3
- package/dist/selection-card.js +2 -1
- package/dist/selection-card.js.map +1 -1
- package/dist/service-installer.js +11 -2
- package/dist/service-installer.js.map +1 -1
- package/dist/settings-change.d.ts +2 -0
- package/dist/settings-change.js +74 -31
- package/dist/settings-change.js.map +1 -1
- package/dist/settings-confirmation.d.ts +23 -0
- package/dist/settings-confirmation.js +13 -2
- package/dist/settings-confirmation.js.map +1 -1
- package/dist/settings-effect.d.ts +4 -0
- package/dist/settings-effect.js +14 -14
- package/dist/settings-effect.js.map +1 -1
- package/dist/settings-http-confirmation.d.ts +3 -1
- package/dist/settings-http-confirmation.js +12 -7
- package/dist/settings-http-confirmation.js.map +1 -1
- package/dist/settings-summary.d.ts +24 -0
- package/dist/settings-summary.js +42 -0
- package/dist/settings-summary.js.map +1 -0
- package/dist/transcript-delta-reader.d.ts +9 -1
- package/dist/transcript-delta-reader.js +37 -8
- package/dist/transcript-delta-reader.js.map +1 -1
- package/dist/ui/agent-details-settings.js +253 -0
- package/dist/ui/agent-export-dialog.js +169 -0
- package/dist/ui/agent-export-strings.js +81 -0
- package/dist/ui/agent-instructions-field.js +69 -0
- package/dist/ui/agent-page-strings.js +148 -0
- package/dist/ui/chat-quote.js +12 -17
- package/dist/ui/hub-client.js +1 -1
- package/dist/ui/hub-company-join-strings.js +1 -1
- package/dist/ui/hub-company-join.js +7 -0
- package/dist/ui/hub-strings.js +4 -0
- package/dist/ui/native-instance-settings.js +47 -14
- package/dist/ui/panel-details.js +38 -14
- package/dist/ui/panel-fleet.js +2 -2
- package/dist/ui/panel-settings.js +12 -9
- package/dist/ui/settings-access-overview.js +24 -3
- package/dist/ui/settings-confirm.js +5 -5
- package/dist/ui/settings-dialogs.js +210 -100
- package/dist/ui/settings-hub-company-join.js +69 -14
- package/dist/ui/settings-hub.js +13 -5
- package/dist/ui/settings-layout.js +0 -2
- package/dist/ui/settings-model.js +15 -0
- package/dist/ui/shared/access-overview.css +48 -0
- package/dist/ui/shared/app-i18n.js +2 -2
- package/dist/ui/shared/app-shell.js +144 -3
- package/dist/ui/shared/app.css +74 -50
- package/dist/ui/shared/instance-nav.js +5 -1
- package/dist/ui/shared/view-strings.js +2 -0
- package/dist/update-dispatch.d.ts +62 -0
- package/dist/update-dispatch.js +69 -2
- package/dist/update-dispatch.js.map +1 -1
- package/dist/web-api.d.ts +2 -0
- package/dist/web-api.js +49 -0
- package/dist/web-api.js.map +1 -1
- package/dist/web-session.d.ts +4 -2
- package/dist/web-session.js +5 -2
- package/dist/web-session.js.map +1 -1
- package/dist/windows-shortcuts.d.ts +29 -5
- package/dist/windows-shortcuts.js +52 -9
- package/dist/windows-shortcuts.js.map +1 -1
- package/dist/workspace-file-policy.d.ts +2 -0
- package/dist/workspace-file-policy.js +31 -0
- package/dist/workspace-file-policy.js.map +1 -0
- package/dist/workspace-follow.js +2 -1
- package/dist/workspace-follow.js.map +1 -1
- package/launcher/agend-install.cjs +7 -1
- package/package.json +2 -2
- package/templates/icons/agend-restart.ico +0 -0
- package/templates/icons/agend.ico +0 -0
- package/templates/runtime-assets/runtime-pane-private.ps1 +74 -7
- package/templates/windows-shortcuts.ps1 +45 -12
|
@@ -1,14 +1,81 @@
|
|
|
1
|
-
param([Parameter(Mandatory=$true)][string]$Directory)
|
|
1
|
+
param([Parameter(Mandatory=$true)][string]$Directory, [switch]$RuntimeProfile)
|
|
2
2
|
$ErrorActionPreference = 'Stop'
|
|
3
|
+
# Existing Runtime profiles are verification-only: a parent DACL rewrite can alter unrelated descendants.
|
|
4
|
+
# The creation overload supplies the private DACL to newly created directories, not after their creation.
|
|
5
|
+
$user = [Security.Principal.WindowsIdentity]::GetCurrent().User
|
|
6
|
+
function New-PrivateAcl {
|
|
7
|
+
$value = New-Object Security.AccessControl.DirectorySecurity
|
|
8
|
+
$value.SetAccessRuleProtection($true,$false)
|
|
9
|
+
$value.SetOwner($user)
|
|
10
|
+
foreach ($sid in @($user,[Security.Principal.SecurityIdentifier]::new('S-1-5-18'))) {
|
|
11
|
+
$value.AddAccessRule([Security.AccessControl.FileSystemAccessRule]::new($sid,'FullControl','ContainerInherit,ObjectInherit','None','Allow'))
|
|
12
|
+
}
|
|
13
|
+
return $value
|
|
14
|
+
}
|
|
15
|
+
if ($RuntimeProfile) {
|
|
16
|
+
$allowed = @($user.Value,'S-1-5-18','S-1-5-32-544') # Local administrators already control this Windows user; ordinary users are never allowed.
|
|
17
|
+
$watch = [Diagnostics.Stopwatch]::StartNew()
|
|
18
|
+
function Real-Entry($entry) {
|
|
19
|
+
if ($entry.Attributes -band [IO.FileAttributes]::ReparsePoint) { throw 'Runtime profile contains a reparse point' }
|
|
20
|
+
}
|
|
21
|
+
function Private-Entry($entry) {
|
|
22
|
+
Real-Entry $entry
|
|
23
|
+
$security = $entry.GetAccessControl([Security.AccessControl.AccessControlSections]::Access -bor [Security.AccessControl.AccessControlSections]::Owner)
|
|
24
|
+
$owner = $security.GetOwner([Security.Principal.SecurityIdentifier]).Value
|
|
25
|
+
# Elevated Windows writes may use the Administrators default owner. That principal is already trusted by the DACL policy.
|
|
26
|
+
if ($owner -notin $allowed) { throw 'Runtime profile has a different owner' }
|
|
27
|
+
$raw = [Security.AccessControl.RawSecurityDescriptor]::new($security.GetSecurityDescriptorBinaryForm(),0)
|
|
28
|
+
if (-not ($raw.ControlFlags -band [Security.AccessControl.ControlFlags]::DiscretionaryAclPresent) -or $null -eq $raw.DiscretionaryAcl) { throw 'Runtime profile has no private DACL' }
|
|
29
|
+
foreach ($rule in $security.GetAccessRules($true,$true,[Security.Principal.SecurityIdentifier])) {
|
|
30
|
+
if ($rule.AccessControlType -eq [Security.AccessControl.AccessControlType]::Allow -and $rule.IdentityReference.Value -notin $allowed) { throw 'Runtime profile is shared with another Windows principal' }
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
# A checked private leaf is insufficient if another account can replace an ancestor after this check.
|
|
34
|
+
$ancestorAllowed = @($allowed)
|
|
35
|
+
try { $ancestorAllowed += ([Security.Principal.NTAccount]::new('NT SERVICE','TrustedInstaller')).Translate([Security.Principal.SecurityIdentifier]).Value } catch { }
|
|
36
|
+
$namespaceWrite = [Security.AccessControl.FileSystemRights]::DeleteSubdirectoriesAndFiles -bor [Security.AccessControl.FileSystemRights]::Delete -bor [Security.AccessControl.FileSystemRights]::ChangePermissions -bor [Security.AccessControl.FileSystemRights]::TakeOwnership -bor [Security.AccessControl.FileSystemRights]::WriteData -bor [Security.AccessControl.FileSystemRights]::WriteAttributes -bor [Security.AccessControl.FileSystemRights]::WriteExtendedAttributes -bor 0x50000000 # Unmapped GENERIC_ALL / GENERIC_WRITE are mutable too.
|
|
37
|
+
function Stable-Ancestor($entry) {
|
|
38
|
+
Real-Entry $entry
|
|
39
|
+
$security = $entry.GetAccessControl([Security.AccessControl.AccessControlSections]::Access -bor [Security.AccessControl.AccessControlSections]::Owner)
|
|
40
|
+
if ($security.GetOwner([Security.Principal.SecurityIdentifier]).Value -notin $ancestorAllowed) { throw 'Runtime profile ancestor has an untrusted owner' }
|
|
41
|
+
$raw = [Security.AccessControl.RawSecurityDescriptor]::new($security.GetSecurityDescriptorBinaryForm(),0)
|
|
42
|
+
if (-not ($raw.ControlFlags -band [Security.AccessControl.ControlFlags]::DiscretionaryAclPresent) -or $null -eq $raw.DiscretionaryAcl) { throw 'Runtime profile ancestor has no private namespace ACL' }
|
|
43
|
+
foreach ($rule in $security.GetAccessRules($true,$true,[Security.Principal.SecurityIdentifier])) {
|
|
44
|
+
if ($rule.AccessControlType -eq [Security.AccessControl.AccessControlType]::Allow -and -not ($rule.PropagationFlags -band [Security.AccessControl.PropagationFlags]::InheritOnly) -and $rule.IdentityReference.Value -notin $ancestorAllowed -and ($rule.FileSystemRights -band $namespaceWrite)) { throw 'Runtime profile ancestor can be replaced by another principal' }
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
$full = [IO.Path]::GetFullPath($Directory)
|
|
48
|
+
$missing = [Collections.Generic.Stack[string]]::new()
|
|
49
|
+
for ($path = $full; -not (Test-Path -LiteralPath $path); $path = [IO.Path]::GetDirectoryName($path)) {
|
|
50
|
+
if (-not $path) { throw 'Runtime profile has no real parent' }
|
|
51
|
+
$missing.Push($path)
|
|
52
|
+
}
|
|
53
|
+
for ($walk = Get-Item -LiteralPath $path -Force; $walk; $walk = $walk.Parent) { if ($walk -isnot [IO.DirectoryInfo]) { throw 'Runtime profile parent is not a directory' }; Stable-Ancestor $walk }
|
|
54
|
+
while ($missing.Count -gt 0) {
|
|
55
|
+
$created = [IO.DirectoryInfo]::new($missing.Pop())
|
|
56
|
+
$created.Create((New-PrivateAcl))
|
|
57
|
+
Private-Entry (Get-Item -LiteralPath $created.FullName -Force)
|
|
58
|
+
}
|
|
59
|
+
$root = Get-Item -LiteralPath $full -Force
|
|
60
|
+
if (-not $root.PSIsContainer) { throw 'Runtime profile is not a directory' }
|
|
61
|
+
$pending = [Collections.Generic.Stack[object]]::new(); $pending.Push($root); $count = 0
|
|
62
|
+
while ($pending.Count -gt 0) {
|
|
63
|
+
$entry = $pending.Pop(); $count++
|
|
64
|
+
if ($count -gt 20000 -or $watch.ElapsedMilliseconds -gt 25000) { throw 'Runtime profile privacy check exceeded its limit' }
|
|
65
|
+
Private-Entry $entry
|
|
66
|
+
if ($entry.Attributes -band [IO.FileAttributes]::Directory) {
|
|
67
|
+
foreach ($child in $entry.EnumerateFileSystemInfos()) {
|
|
68
|
+
if ($count + $pending.Count -ge 20000 -or $watch.ElapsedMilliseconds -gt 25000) { throw 'Runtime profile privacy check exceeded its limit' }
|
|
69
|
+
$pending.Push($child)
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
return
|
|
74
|
+
}
|
|
3
75
|
$entry = Get-Item -LiteralPath $Directory -Force
|
|
4
76
|
if (-not $entry.PSIsContainer -or ($entry.Attributes -band [IO.FileAttributes]::ReparsePoint)) { throw 'Pane profile must be a real directory' }
|
|
5
77
|
$user = [Security.Principal.WindowsIdentity]::GetCurrent().User
|
|
6
|
-
$acl = New-
|
|
78
|
+
$acl = New-PrivateAcl
|
|
7
79
|
$ownedDirectory = [IO.DirectoryInfo]::new($Directory)
|
|
8
80
|
if ($ownedDirectory.GetAccessControl([Security.AccessControl.AccessControlSections]::Owner).GetOwner([Security.Principal.SecurityIdentifier]).Value -ne $user.Value) { throw 'Pane profile has a different owner' }
|
|
9
|
-
$acl.SetAccessRuleProtection($true,$false)
|
|
10
|
-
foreach ($sid in @($user, [Security.Principal.SecurityIdentifier]::new('S-1-5-18'))) {
|
|
11
|
-
$rule = [Security.AccessControl.FileSystemAccessRule]::new($sid,'FullControl','ContainerInherit,ObjectInherit','None','Allow')
|
|
12
|
-
$acl.AddAccessRule($rule)
|
|
13
|
-
}
|
|
14
81
|
$ownedDirectory.SetAccessControl($acl)
|
|
@@ -104,7 +104,7 @@ function Invoke-AgendInWsl([string]$distro, [string]$user, [string]$command) {
|
|
|
104
104
|
}
|
|
105
105
|
function Invoke-RestartAgend([string]$distro, [string]$user, [switch]$Wait, [int]$SettleSeconds = 3) {
|
|
106
106
|
Write-Host ""
|
|
107
|
-
$answer = Read-Host " 確定要重啟 AgEnD 嗎?所有
|
|
107
|
+
$answer = Read-Host " 確定要重啟 AgEnD 嗎?所有 Agent 會重新啟動,正在進行的工作會中斷。(y/N)"
|
|
108
108
|
if (([string]$answer) -notmatch '^\s*[yY]\s*$') {
|
|
109
109
|
Write-Host " 沒有重啟。"
|
|
110
110
|
if ($Wait) { $null = Read-Host "按 Enter 關閉" }
|
|
@@ -167,26 +167,59 @@ function Get-ShortcutCommand([string]$file) {
|
|
|
167
167
|
if ($wt) { return @{ Target = $wt.Source; Arguments = '-w new "{0}" {1}' -f $ps, ($a -replace ';', '\;') } }
|
|
168
168
|
return @{ Target = $ps; Arguments = $a }
|
|
169
169
|
}
|
|
170
|
-
function
|
|
170
|
+
function Save-AgendIcon([string]$name, $bytes) {
|
|
171
|
+
if (-not $bytes) { return $null }
|
|
172
|
+
try {
|
|
173
|
+
New-Item -ItemType Directory -Path (Get-AgendShortcutDir) -Force | Out-Null
|
|
174
|
+
$path = Join-Path (Get-AgendShortcutDir) $name
|
|
175
|
+
[IO.File]::WriteAllBytes($path, [byte[]]$bytes)
|
|
176
|
+
return $path
|
|
177
|
+
} catch { return $null }
|
|
178
|
+
}
|
|
179
|
+
function New-AgendShortcut([string]$name, [string]$scriptName, [string]$scriptText, [string]$description, [string]$icon = '') {
|
|
171
180
|
$dir = Get-AgendShortcutDir
|
|
172
181
|
New-Item -ItemType Directory -Path $dir -Force | Out-Null
|
|
173
182
|
$file = Join-Path $dir $scriptName
|
|
174
183
|
[IO.File]::WriteAllText($file, $scriptText, (New-Object System.Text.UTF8Encoding $true))
|
|
175
184
|
$lnk = Join-Path ([Environment]::GetFolderPath('Desktop')) ($name + '.lnk')
|
|
176
|
-
$
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
$
|
|
181
|
-
$
|
|
182
|
-
$
|
|
185
|
+
$staged = $lnk + '.agend-new'
|
|
186
|
+
# WScript.Shell saves a shortcut through the system ANSI code page: on a Windows whose system language has no 儀表板
|
|
187
|
+
# (English, Japanese...) Save() on the Chinese name fails. So it is saved under an ASCII name here, then put in place
|
|
188
|
+
# by .NET (Unicode). Leftovers of a run that died midway are ours by name, and only those are removed.
|
|
189
|
+
Get-ChildItem -LiteralPath $dir -Filter 'shortcut-*.tmp.lnk' -ErrorAction SilentlyContinue | Remove-Item -Force -ErrorAction SilentlyContinue
|
|
190
|
+
if ([IO.File]::Exists($staged)) { [IO.File]::Delete($staged) }
|
|
191
|
+
$tmp = Join-Path $dir ('shortcut-' + [guid]::NewGuid().ToString('N') + '.tmp.lnk')
|
|
192
|
+
try {
|
|
193
|
+
$shell = New-Object -ComObject WScript.Shell
|
|
194
|
+
$sc = $shell.CreateShortcut($tmp)
|
|
195
|
+
$cmd = Get-ShortcutCommand $file
|
|
196
|
+
$sc.TargetPath = $cmd.Target
|
|
197
|
+
$sc.Arguments = $cmd.Arguments
|
|
198
|
+
$sc.Description = $description
|
|
199
|
+
if ($icon) { $sc.IconLocation = $icon + ',0' }
|
|
200
|
+
$sc.Save()
|
|
201
|
+
# Beside the old one first (same folder, same volume), then swapped in: if that fails, the old shortcut stays.
|
|
202
|
+
[IO.File]::Copy($tmp, $staged, $true)
|
|
203
|
+
if (-not [IO.File]::Exists($lnk)) { [IO.File]::Move($staged, $lnk) }
|
|
204
|
+
else {
|
|
205
|
+
try { [IO.File]::Replace($staged, $lnk, [NullString]::Value) }
|
|
206
|
+
catch {
|
|
207
|
+
# ReplaceFile can fail after the old one is gone (ERROR_UNABLE_TO_MOVE_REPLACEMENT): then the new one goes in.
|
|
208
|
+
if ((-not [IO.File]::Exists($lnk)) -and [IO.File]::Exists($staged)) { [IO.File]::Move($staged, $lnk) } else { throw }
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
} finally {
|
|
212
|
+
foreach ($left in @($tmp, $staged)) { try { if ([IO.File]::Exists($left)) { [IO.File]::Delete($left) } } catch { } }
|
|
213
|
+
}
|
|
183
214
|
return $lnk
|
|
184
215
|
}
|
|
185
|
-
function Install-AgendShortcuts([string]$distro, [string]$user) {
|
|
216
|
+
function Install-AgendShortcuts([string]$distro, [string]$user, $icons = $null) {
|
|
186
217
|
if (-not $script:OnWindows) { return @() }
|
|
187
218
|
$made = @()
|
|
188
|
-
|
|
189
|
-
|
|
219
|
+
$dashIcon = ''; $restartIcon = ''
|
|
220
|
+
if ($icons) { $dashIcon = [string](Save-AgendIcon 'agend.ico' $icons['agend.ico']); $restartIcon = [string](Save-AgendIcon 'agend-restart.ico' $icons['agend-restart.ico']) }
|
|
221
|
+
try { $made += New-AgendShortcut 'AgEnD 儀表板' 'open-dashboard.ps1' (Get-DashboardOpenerScript $distro $user) 'AgEnD 網頁儀表板(自動帶入登入碼)' $dashIcon } catch { }
|
|
222
|
+
try { $made += New-AgendShortcut 'AgEnD 重新啟動' 'restart-agend.ps1' (Get-RestartScript $distro $user) '重新啟動 AgEnD(會先詢問)' $restartIcon } catch { }
|
|
190
223
|
try {
|
|
191
224
|
New-Item -ItemType Directory -Path (Get-AgendShortcutDir) -Force | Out-Null
|
|
192
225
|
$record = @{ distro = $distro; user = $user } | ConvertTo-Json -Compress
|