@evomap/evolver-proxy 2.0.33 → 2.0.35
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/dist/daemon/proxyDaemon.d.ts +1 -0
- package/dist/daemon/proxyDaemon.js +70 -5
- package/dist/lifecycle/claimNudge.js +1 -1
- package/dist/lifecycle/deployGuard.js +1 -1
- package/dist/lifecycle/legacyNodeId.js +1 -1
- package/dist/lifecycle/manager.js +1 -1
- package/dist/llm/bodyCapture.js +1 -1
- package/dist/llm/index.js +1 -1
- package/dist/llm/server.js +1 -1
- package/dist/llm/traceBackfill.js +1 -1
- package/dist/llm/traceConfig.js +1 -1
- package/dist/llm/traceControl.js +1 -1
- package/dist/llm/traceEnvelope.js +1 -1
- package/dist/llm/traceSink.js +1 -1
- package/dist/llm/traceUploadPayload.js +1 -1
- package/dist/llm/upstream.js +1 -1
- package/dist/router/cachePassthrough.js +1 -1
- package/dist/router/features.js +1 -1
- package/dist/router/index.js +1 -1
- package/dist/router/messagesRoute.js +1 -1
- package/dist/router/modelRouter.js +1 -1
- package/dist/router/providerRoutes.js +1 -1
- package/dist/router/sseScan.js +1 -1
- package/dist/selfUpdate/bootstrap.d.ts +5 -0
- package/dist/selfUpdate/bootstrap.js +4 -1
- package/dist/selfUpdate/migration.d.ts +5 -0
- package/dist/selfUpdate/migration.js +4 -1
- package/dist/selfUpdate/windowsUpdater.d.ts +4 -1
- package/dist/selfUpdate/windowsUpdater.js +57 -14
- package/dist/sync/engine.d.ts +4 -1
- package/dist/sync/engine.js +1 -1
- package/package.json +3 -3
|
@@ -155,6 +155,14 @@ export async function prepareWindowsExecutableSwap(options) {
|
|
|
155
155
|
resultPath: paths.resultPath,
|
|
156
156
|
};
|
|
157
157
|
}
|
|
158
|
+
function reportUpdaterFailure(options, error) {
|
|
159
|
+
try {
|
|
160
|
+
options.onFailure?.(error);
|
|
161
|
+
}
|
|
162
|
+
catch {
|
|
163
|
+
// 辅助诊断失败不能覆盖原始失败,也不能阻断 durable result 与恢复状态。
|
|
164
|
+
}
|
|
165
|
+
}
|
|
158
166
|
/**
|
|
159
167
|
* Apply the pending operation before the stable controller starts target.
|
|
160
168
|
* A successful swap is idempotent across crashes after rename: if target
|
|
@@ -180,6 +188,7 @@ export async function applyPendingWindowsExecutableSwap(options = {}) {
|
|
|
180
188
|
await validateWorkItem(workItem, paths, stateDir, options.assertHelperTrust);
|
|
181
189
|
}
|
|
182
190
|
catch (error) {
|
|
191
|
+
reportUpdaterFailure(options, error);
|
|
183
192
|
const result = {
|
|
184
193
|
schema_version: RESULT_SCHEMA_VERSION,
|
|
185
194
|
operation: workItem?.operation ?? 'install',
|
|
@@ -227,6 +236,7 @@ export async function applyPendingWindowsExecutableSwap(options = {}) {
|
|
|
227
236
|
await rm(paths.pendingPath);
|
|
228
237
|
}
|
|
229
238
|
catch (error) {
|
|
239
|
+
reportUpdaterFailure(options, error);
|
|
230
240
|
result = {
|
|
231
241
|
schema_version: RESULT_SCHEMA_VERSION,
|
|
232
242
|
operation: workItem.operation,
|
|
@@ -624,44 +634,77 @@ function assertNativeWindowsUpdaterHelperTrust(paths) {
|
|
|
624
634
|
break;
|
|
625
635
|
current = dirname(current);
|
|
626
636
|
}
|
|
637
|
+
const encodedChecks = checks.map((check) => (`${Buffer.from(check.path, 'utf8').toString('base64')}|${check.parentOnly ? '1' : '0'}`)).join('\n');
|
|
638
|
+
if (encodedChecks.length > 24 * 1024) {
|
|
639
|
+
throw selfUpdateFailure(SELF_UPDATE_FAILURE_CODES.REPLACE_FAILED, 'windows_updater_helper_acl_payload_oversized');
|
|
640
|
+
}
|
|
627
641
|
try {
|
|
628
|
-
execFileSync(trustedWindowsSystemExecutable('WindowsPowerShell\\v1.0\\powershell.exe'), ['-NoProfile', '-NonInteractive', '-Command', windowsUpdaterAclScript(
|
|
642
|
+
execFileSync(trustedWindowsSystemExecutable('WindowsPowerShell\\v1.0\\powershell.exe'), ['-NoProfile', '-NonInteractive', '-Command', windowsUpdaterAclScript()], {
|
|
643
|
+
env: {
|
|
644
|
+
SystemRoot: HOST_WINDOWS_SYSTEM_ROOT,
|
|
645
|
+
WINDIR: HOST_WINDOWS_SYSTEM_ROOT,
|
|
646
|
+
EVOLVER_UPDATER_ACL_CHECKS: encodedChecks,
|
|
647
|
+
},
|
|
648
|
+
shell: false,
|
|
649
|
+
stdio: 'ignore',
|
|
650
|
+
timeout: 10_000,
|
|
651
|
+
windowsHide: true,
|
|
652
|
+
});
|
|
629
653
|
}
|
|
630
654
|
catch (error) {
|
|
631
|
-
|
|
655
|
+
const status = typeof error === 'object' && error !== null
|
|
656
|
+
? error.status
|
|
657
|
+
: undefined;
|
|
658
|
+
const reason = status === 21
|
|
659
|
+
? 'owner_untrusted'
|
|
660
|
+
: status === 22
|
|
661
|
+
? 'identity_unresolved'
|
|
662
|
+
: status === 23
|
|
663
|
+
? 'writer_untrusted'
|
|
664
|
+
: status === 24
|
|
665
|
+
? 'input_or_acl_read_failed'
|
|
666
|
+
: 'process_failed';
|
|
667
|
+
throw selfUpdateFailure(SELF_UPDATE_FAILURE_CODES.REPLACE_FAILED, `windows_updater_helper_acl_${reason}`, {
|
|
632
668
|
cause: error,
|
|
633
669
|
});
|
|
634
670
|
}
|
|
635
671
|
}
|
|
636
|
-
function windowsUpdaterAclScript(
|
|
637
|
-
const encodedChecks = Buffer.from(JSON.stringify(checks), 'utf8').toString('base64');
|
|
672
|
+
export function windowsUpdaterAclScript() {
|
|
638
673
|
const d = String.fromCharCode(36);
|
|
639
674
|
return [
|
|
640
675
|
`${d}ErrorActionPreference = 'Stop'`,
|
|
641
|
-
'
|
|
642
|
-
|
|
643
|
-
`
|
|
676
|
+
'trap { exit 24 }',
|
|
677
|
+
`${d}checks = @()`,
|
|
678
|
+
`foreach (${d}row in ${d}env:EVOLVER_UPDATER_ACL_CHECKS.Split([char]10, [System.StringSplitOptions]::RemoveEmptyEntries)) {`,
|
|
679
|
+
` ${d}parts = ${d}row.Split('|')`,
|
|
680
|
+
` if (${d}parts.Count -ne 2 -or (${d}parts[1] -ne '0' -and ${d}parts[1] -ne '1')) { exit 24 }`,
|
|
681
|
+
` try { ${d}path = [Text.Encoding]::UTF8.GetString([Convert]::FromBase64String(${d}parts[0])) } catch { exit 24 }`,
|
|
682
|
+
` ${d}checks += [pscustomobject]@{ path = ${d}path; parentOnly = (${d}parts[1] -eq '1') }`,
|
|
683
|
+
'}',
|
|
684
|
+
`if (${d}checks.Count -eq 0) { exit 24 }`,
|
|
644
685
|
` ${d}userSid = [System.Security.Principal.WindowsIdentity]::GetCurrent().User.Value`,
|
|
645
686
|
` ${d}trustedInstaller = 'S-1-5-80-956008885-3418522649-1831038044-1853292631-2271478464'`,
|
|
646
687
|
` ${d}trustedOwners = @(${d}userSid, 'S-1-5-18', 'S-1-5-32-544', ${d}trustedInstaller)`,
|
|
647
688
|
` ${d}trustedWriters = @(${d}userSid, 'S-1-5-18', 'S-1-5-32-544', ${d}trustedInstaller, 'S-1-3-0', 'S-1-3-4')`,
|
|
648
689
|
` ${d}parentDanger = [System.Security.AccessControl.FileSystemRights]::Delete -bor [System.Security.AccessControl.FileSystemRights]::DeleteSubdirectoriesAndFiles -bor [System.Security.AccessControl.FileSystemRights]::ChangePermissions -bor [System.Security.AccessControl.FileSystemRights]::TakeOwnership`,
|
|
649
690
|
` ${d}contentDanger = [System.Security.AccessControl.FileSystemRights]::WriteData -bor [System.Security.AccessControl.FileSystemRights]::AppendData -bor [System.Security.AccessControl.FileSystemRights]::CreateFiles -bor [System.Security.AccessControl.FileSystemRights]::CreateDirectories`,
|
|
650
|
-
`
|
|
651
|
-
` ${d}
|
|
691
|
+
`foreach (${d}check in ${d}checks) {`,
|
|
692
|
+
` try { ${d}attributes = [System.IO.File]::GetAttributes(${d}check.path) } catch { exit 24 }`,
|
|
693
|
+
` try { ${d}acl = if ((${d}attributes -band [System.IO.FileAttributes]::Directory) -ne 0) { [System.IO.Directory]::GetAccessControl(${d}check.path) } else { [System.IO.File]::GetAccessControl(${d}check.path) } } catch { exit 24 }`,
|
|
652
694
|
` ${d}owner = ${d}acl.GetOwner([System.Security.Principal.SecurityIdentifier]).Value`,
|
|
653
695
|
` if (${d}trustedOwners -notcontains ${d}owner) { exit 21 }`,
|
|
654
696
|
` ${d}danger = if (${d}check.parentOnly) { ${d}parentDanger } else { ${d}parentDanger -bor ${d}contentDanger }`,
|
|
655
|
-
`
|
|
697
|
+
` ${d}rules = @(${d}acl.GetAccessRules(${d}true, ${d}true, [System.Security.Principal.SecurityIdentifier]))`,
|
|
698
|
+
` foreach (${d}rule in ${d}rules) {`,
|
|
656
699
|
` if (${d}rule.AccessControlType -ne [System.Security.AccessControl.AccessControlType]::Allow) { continue }`,
|
|
657
700
|
` if ((${d}rule.PropagationFlags -band [System.Security.AccessControl.PropagationFlags]::InheritOnly) -ne 0) { continue }`,
|
|
658
701
|
` if ((${d}rule.FileSystemRights -band ${d}danger) -eq 0) { continue }`,
|
|
659
|
-
`
|
|
702
|
+
` if (-not (${d}rule.IdentityReference -is [System.Security.Principal.SecurityIdentifier])) { exit 22 }`,
|
|
703
|
+
` ${d}sid = ${d}rule.IdentityReference.Value`,
|
|
660
704
|
` if (${d}trustedWriters -notcontains ${d}sid) { exit 23 }`,
|
|
661
705
|
' }',
|
|
662
|
-
'
|
|
663
|
-
|
|
664
|
-
].join('; ');
|
|
706
|
+
'}',
|
|
707
|
+
].join('\n');
|
|
665
708
|
}
|
|
666
709
|
function trustedWindowsSystemExecutable(name) {
|
|
667
710
|
if (!win32.isAbsolute(HOST_WINDOWS_SYSTEM_ROOT) || /[\r\n\0]/.test(HOST_WINDOWS_SYSTEM_ROOT)) {
|
package/dist/sync/engine.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { mailbox, hub as hubNs } from '@evomap/evolver-core';
|
|
1
|
+
import { reference, mailbox, hub as hubNs } from '@evomap/evolver-core';
|
|
2
2
|
type MailboxStore = mailbox.MailboxStore;
|
|
3
3
|
type Envelope = mailbox.Envelope;
|
|
4
4
|
type HubCapability = hubNs.HubCapability;
|
|
@@ -13,6 +13,7 @@ export declare const MAX_BATCH = 50;
|
|
|
13
13
|
export declare const IDLE_THRESHOLD_MS: number;
|
|
14
14
|
export interface SyncEngineDeps {
|
|
15
15
|
store: MailboxStore;
|
|
16
|
+
referenceStore?: reference.ReferenceStore;
|
|
16
17
|
hub: HubCapability;
|
|
17
18
|
/** = makeHubBindings(hub).asProxyHandler(); outbound 推送复用 Dispatcher 同一 handler. */
|
|
18
19
|
proxyHandler: (e: Envelope) => Promise<unknown>;
|
|
@@ -48,6 +49,8 @@ export interface InboundResult {
|
|
|
48
49
|
enqueued: number;
|
|
49
50
|
nextPollAfterMs?: number;
|
|
50
51
|
hasMore: boolean;
|
|
52
|
+
storedReferences?: number;
|
|
53
|
+
rejectedReferences?: number;
|
|
51
54
|
}
|
|
52
55
|
export declare class SyncEngine {
|
|
53
56
|
private readonly deps;
|