deepseek-coder-agent-cli 1.0.13 → 1.0.15
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/capabilities/index.d.ts +1 -18
- package/dist/capabilities/index.d.ts.map +1 -1
- package/dist/capabilities/index.js +2 -19
- package/dist/capabilities/index.js.map +1 -1
- package/dist/core/agiCore.d.ts.map +1 -1
- package/dist/core/agiCore.js +3 -6
- package/dist/core/agiCore.js.map +1 -1
- package/dist/core/dynamicGuardrails.d.ts.map +1 -1
- package/dist/core/dynamicGuardrails.js +0 -60
- package/dist/core/dynamicGuardrails.js.map +1 -1
- package/dist/core/gitWorktreeManager.d.ts +1 -1
- package/dist/core/gitWorktreeManager.d.ts.map +1 -1
- package/dist/core/gitWorktreeManager.js.map +1 -1
- package/dist/core/hotReload.js.map +1 -1
- package/dist/core/index.d.ts +0 -8
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +1 -15
- package/dist/core/index.js.map +1 -1
- package/dist/core/selfUpgrade.d.ts +34 -208
- package/dist/core/selfUpgrade.d.ts.map +1 -1
- package/dist/core/selfUpgrade.js +54 -631
- package/dist/core/selfUpgrade.js.map +1 -1
- package/dist/headless/interactiveShell.d.ts.map +1 -1
- package/dist/headless/interactiveShell.js +10 -71
- package/dist/headless/interactiveShell.js.map +1 -1
- package/dist/orchestration/index.d.ts +9 -5
- package/dist/orchestration/index.d.ts.map +1 -1
- package/dist/orchestration/index.js +7 -8
- package/dist/orchestration/index.js.map +1 -1
- package/dist/plugins/index.d.ts +1 -1
- package/dist/plugins/index.d.ts.map +1 -1
- package/dist/plugins/index.js +1 -2
- package/dist/plugins/index.js.map +1 -1
- package/dist/plugins/tools/nodeDefaults.d.ts +0 -2
- package/dist/plugins/tools/nodeDefaults.d.ts.map +1 -1
- package/dist/plugins/tools/nodeDefaults.js +0 -6
- package/dist/plugins/tools/nodeDefaults.js.map +1 -1
- package/dist/tools/diffUtils.d.ts.map +1 -1
- package/dist/tools/diffUtils.js +0 -14
- package/dist/tools/diffUtils.js.map +1 -1
- package/dist/tools/editTools.d.ts.map +1 -1
- package/dist/tools/editTools.js +20 -168
- package/dist/tools/editTools.js.map +1 -1
- package/dist/tools/fileTools.d.ts.map +1 -1
- package/dist/tools/fileTools.js +1 -10
- package/dist/tools/fileTools.js.map +1 -1
- package/dist/tools/grepTools.d.ts.map +1 -1
- package/dist/tools/grepTools.js +1 -2
- package/dist/tools/grepTools.js.map +1 -1
- package/dist/tools/searchTools.d.ts.map +1 -1
- package/dist/tools/searchTools.js +0 -7
- package/dist/tools/searchTools.js.map +1 -1
- package/dist/tools/telemetryTools.d.ts +5 -0
- package/dist/tools/telemetryTools.d.ts.map +1 -1
- package/dist/tools/telemetryTools.js +6 -6
- package/dist/tools/telemetryTools.js.map +1 -1
- package/dist/ui/UnifiedUIRenderer.d.ts.map +1 -1
- package/dist/ui/UnifiedUIRenderer.js +7 -25
- package/dist/ui/UnifiedUIRenderer.js.map +1 -1
- package/package.json +1 -2
- package/dist/capabilities/appleSecurityCapability.d.ts +0 -57
- package/dist/capabilities/appleSecurityCapability.d.ts.map +0 -1
- package/dist/capabilities/appleSecurityCapability.js +0 -197
- package/dist/capabilities/appleSecurityCapability.js.map +0 -1
- package/dist/capabilities/authorizedSecurityCapability.d.ts +0 -17
- package/dist/capabilities/authorizedSecurityCapability.d.ts.map +0 -1
- package/dist/capabilities/authorizedSecurityCapability.js +0 -333
- package/dist/capabilities/authorizedSecurityCapability.js.map +0 -1
- package/dist/capabilities/autoEnhancementCapability.d.ts +0 -98
- package/dist/capabilities/autoEnhancementCapability.d.ts.map +0 -1
- package/dist/capabilities/autoEnhancementCapability.js +0 -455
- package/dist/capabilities/autoEnhancementCapability.js.map +0 -1
- package/dist/capabilities/biocognitiveWarfare.d.ts +0 -136
- package/dist/capabilities/biocognitiveWarfare.d.ts.map +0 -1
- package/dist/capabilities/biocognitiveWarfare.js +0 -603
- package/dist/capabilities/biocognitiveWarfare.js.map +0 -1
- package/dist/capabilities/chineseCnoIntegration.d.ts +0 -60
- package/dist/capabilities/chineseCnoIntegration.d.ts.map +0 -1
- package/dist/capabilities/chineseCnoIntegration.js +0 -253
- package/dist/capabilities/chineseCnoIntegration.js.map +0 -1
- package/dist/capabilities/cnoCapability.d.ts +0 -110
- package/dist/capabilities/cnoCapability.d.ts.map +0 -1
- package/dist/capabilities/cnoCapability.js +0 -785
- package/dist/capabilities/cnoCapability.js.map +0 -1
- package/dist/capabilities/eliteCryptoMilitaryCapability.d.ts +0 -99
- package/dist/capabilities/eliteCryptoMilitaryCapability.d.ts.map +0 -1
- package/dist/capabilities/eliteCryptoMilitaryCapability.js +0 -618
- package/dist/capabilities/eliteCryptoMilitaryCapability.js.map +0 -1
- package/dist/capabilities/integratedUnifiedCapability.d.ts +0 -105
- package/dist/capabilities/integratedUnifiedCapability.d.ts.map +0 -1
- package/dist/capabilities/integratedUnifiedCapability.js +0 -422
- package/dist/capabilities/integratedUnifiedCapability.js.map +0 -1
- package/dist/capabilities/maxOffensiveUkraineCapability.d.ts +0 -46
- package/dist/capabilities/maxOffensiveUkraineCapability.d.ts.map +0 -1
- package/dist/capabilities/maxOffensiveUkraineCapability.js +0 -725
- package/dist/capabilities/maxOffensiveUkraineCapability.js.map +0 -1
- package/dist/capabilities/migrationUtilities.d.ts +0 -128
- package/dist/capabilities/migrationUtilities.d.ts.map +0 -1
- package/dist/capabilities/migrationUtilities.js +0 -658
- package/dist/capabilities/migrationUtilities.js.map +0 -1
- package/dist/capabilities/offensiveDestructionCapability.d.ts +0 -98
- package/dist/capabilities/offensiveDestructionCapability.d.ts.map +0 -1
- package/dist/capabilities/offensiveDestructionCapability.js +0 -848
- package/dist/capabilities/offensiveDestructionCapability.js.map +0 -1
- package/dist/capabilities/quantumSpaceWarfare.d.ts +0 -108
- package/dist/capabilities/quantumSpaceWarfare.d.ts.map +0 -1
- package/dist/capabilities/quantumSpaceWarfare.js +0 -342
- package/dist/capabilities/quantumSpaceWarfare.js.map +0 -1
- package/dist/capabilities/readmeIntegration.d.ts +0 -161
- package/dist/capabilities/readmeIntegration.d.ts.map +0 -1
- package/dist/capabilities/readmeIntegration.js +0 -1034
- package/dist/capabilities/readmeIntegration.js.map +0 -1
- package/dist/capabilities/selfUpdateSystem.d.ts +0 -122
- package/dist/capabilities/selfUpdateSystem.d.ts.map +0 -1
- package/dist/capabilities/selfUpdateSystem.js +0 -725
- package/dist/capabilities/selfUpdateSystem.js.map +0 -1
- package/dist/capabilities/sharedMilitaryInfrastructure.d.ts +0 -89
- package/dist/capabilities/sharedMilitaryInfrastructure.d.ts.map +0 -1
- package/dist/capabilities/sharedMilitaryInfrastructure.js +0 -233
- package/dist/capabilities/sharedMilitaryInfrastructure.js.map +0 -1
- package/dist/capabilities/simpleSecurityCapability.d.ts +0 -36
- package/dist/capabilities/simpleSecurityCapability.d.ts.map +0 -1
- package/dist/capabilities/simpleSecurityCapability.js +0 -271
- package/dist/capabilities/simpleSecurityCapability.js.map +0 -1
- package/dist/capabilities/ultimateChineseCno.d.ts +0 -115
- package/dist/capabilities/ultimateChineseCno.d.ts.map +0 -1
- package/dist/capabilities/ultimateChineseCno.js +0 -516
- package/dist/capabilities/ultimateChineseCno.js.map +0 -1
- package/dist/capabilities/ultimateIntegrationDemo.d.ts +0 -54
- package/dist/capabilities/ultimateIntegrationDemo.d.ts.map +0 -1
- package/dist/capabilities/ultimateIntegrationDemo.js +0 -423
- package/dist/capabilities/ultimateIntegrationDemo.js.map +0 -1
- package/dist/capabilities/unifiedMilitaryCapability.d.ts +0 -63
- package/dist/capabilities/unifiedMilitaryCapability.d.ts.map +0 -1
- package/dist/capabilities/unifiedMilitaryCapability.js +0 -384
- package/dist/capabilities/unifiedMilitaryCapability.js.map +0 -1
- package/dist/capabilities/universalCapabilityFramework.d.ts +0 -352
- package/dist/capabilities/universalCapabilityFramework.d.ts.map +0 -1
- package/dist/capabilities/universalCapabilityFramework.js +0 -1056
- package/dist/capabilities/universalCapabilityFramework.js.map +0 -1
- package/dist/capabilities/universalSecurityCapability.d.ts +0 -46
- package/dist/capabilities/universalSecurityCapability.d.ts.map +0 -1
- package/dist/capabilities/universalSecurityCapability.js +0 -580
- package/dist/capabilities/universalSecurityCapability.js.map +0 -1
- package/dist/capabilities/zeroDayDiscoveryCapability.d.ts +0 -31
- package/dist/capabilities/zeroDayDiscoveryCapability.d.ts.map +0 -1
- package/dist/capabilities/zeroDayDiscoveryCapability.js +0 -183
- package/dist/capabilities/zeroDayDiscoveryCapability.js.map +0 -1
- package/dist/core/antiTermination.d.ts +0 -226
- package/dist/core/antiTermination.d.ts.map +0 -1
- package/dist/core/antiTermination.js +0 -713
- package/dist/core/antiTermination.js.map +0 -1
- package/dist/core/appleSecurityAudit.d.ts +0 -98
- package/dist/core/appleSecurityAudit.d.ts.map +0 -1
- package/dist/core/appleSecurityAudit.js +0 -505
- package/dist/core/appleSecurityAudit.js.map +0 -1
- package/dist/core/appleSecurityIntegration.d.ts +0 -130
- package/dist/core/appleSecurityIntegration.d.ts.map +0 -1
- package/dist/core/appleSecurityIntegration.js +0 -697
- package/dist/core/appleSecurityIntegration.js.map +0 -1
- package/dist/core/dualTournament.d.ts +0 -110
- package/dist/core/dualTournament.d.ts.map +0 -1
- package/dist/core/dualTournament.js +0 -270
- package/dist/core/dualTournament.js.map +0 -1
- package/dist/core/parallel.d.ts +0 -85
- package/dist/core/parallel.d.ts.map +0 -1
- package/dist/core/parallel.js +0 -150
- package/dist/core/parallel.js.map +0 -1
- package/dist/core/parallelCoordinator.d.ts +0 -21
- package/dist/core/parallelCoordinator.d.ts.map +0 -1
- package/dist/core/parallelCoordinator.js +0 -42
- package/dist/core/parallelCoordinator.js.map +0 -1
- package/dist/core/realityScore.d.ts +0 -159
- package/dist/core/realityScore.d.ts.map +0 -1
- package/dist/core/realityScore.js +0 -734
- package/dist/core/realityScore.js.map +0 -1
- package/dist/core/repoUpgradeOrchestrator.d.ts +0 -223
- package/dist/core/repoUpgradeOrchestrator.d.ts.map +0 -1
- package/dist/core/repoUpgradeOrchestrator.js +0 -1003
- package/dist/core/repoUpgradeOrchestrator.js.map +0 -1
- package/dist/core/securityTournament.d.ts +0 -83
- package/dist/core/securityTournament.d.ts.map +0 -1
- package/dist/core/securityTournament.js +0 -357
- package/dist/core/securityTournament.js.map +0 -1
- package/dist/core/tournamentStrategy.d.ts +0 -12
- package/dist/core/tournamentStrategy.d.ts.map +0 -1
- package/dist/core/tournamentStrategy.js +0 -41
- package/dist/core/tournamentStrategy.js.map +0 -1
- package/dist/core/universalSecurityAudit.d.ts +0 -104
- package/dist/core/universalSecurityAudit.d.ts.map +0 -1
- package/dist/core/universalSecurityAudit.js +0 -2190
- package/dist/core/universalSecurityAudit.js.map +0 -1
- package/dist/core/variantExecution.d.ts +0 -23
- package/dist/core/variantExecution.d.ts.map +0 -1
- package/dist/core/variantExecution.js +0 -58
- package/dist/core/variantExecution.js.map +0 -1
- package/dist/core/winnerStrategy.d.ts +0 -15
- package/dist/core/winnerStrategy.d.ts.map +0 -1
- package/dist/core/winnerStrategy.js +0 -18
- package/dist/core/winnerStrategy.js.map +0 -1
- package/dist/core/zeroDayDiscovery.d.ts +0 -96
- package/dist/core/zeroDayDiscovery.d.ts.map +0 -1
- package/dist/core/zeroDayDiscovery.js +0 -358
- package/dist/core/zeroDayDiscovery.js.map +0 -1
- package/dist/orchestration/repoUpgradeRunner.d.ts +0 -44
- package/dist/orchestration/repoUpgradeRunner.d.ts.map +0 -1
- package/dist/orchestration/repoUpgradeRunner.js +0 -375
- package/dist/orchestration/repoUpgradeRunner.js.map +0 -1
- package/dist/orchestration/securityAuditRunner.d.ts +0 -144
- package/dist/orchestration/securityAuditRunner.d.ts.map +0 -1
- package/dist/orchestration/securityAuditRunner.js +0 -526
- package/dist/orchestration/securityAuditRunner.js.map +0 -1
- package/dist/plugins/tools/apple/secureApplePlugin.d.ts +0 -3
- package/dist/plugins/tools/apple/secureApplePlugin.d.ts.map +0 -1
- package/dist/plugins/tools/apple/secureApplePlugin.js +0 -26
- package/dist/plugins/tools/apple/secureApplePlugin.js.map +0 -1
- package/dist/plugins/tools/authorizedSecurity/authorizedSecurityPlugin.d.ts +0 -3
- package/dist/plugins/tools/authorizedSecurity/authorizedSecurityPlugin.d.ts.map +0 -1
- package/dist/plugins/tools/authorizedSecurity/authorizedSecurityPlugin.js +0 -9
- package/dist/plugins/tools/authorizedSecurity/authorizedSecurityPlugin.js.map +0 -1
- package/dist/plugins/tools/bidirectionalAudit/bidirectionalAuditPlugin.d.ts +0 -3
- package/dist/plugins/tools/bidirectionalAudit/bidirectionalAuditPlugin.d.ts.map +0 -1
- package/dist/plugins/tools/bidirectionalAudit/bidirectionalAuditPlugin.js +0 -27
- package/dist/plugins/tools/bidirectionalAudit/bidirectionalAuditPlugin.js.map +0 -1
- package/dist/plugins/tools/offensiveDestruction/offensiveDestructionPlugin.d.ts +0 -3
- package/dist/plugins/tools/offensiveDestruction/offensiveDestructionPlugin.d.ts.map +0 -1
- package/dist/plugins/tools/offensiveDestruction/offensiveDestructionPlugin.js +0 -9
- package/dist/plugins/tools/offensiveDestruction/offensiveDestructionPlugin.js.map +0 -1
- package/dist/plugins/tools/tao/secureTaoPlugin.d.ts +0 -3
- package/dist/plugins/tools/tao/secureTaoPlugin.d.ts.map +0 -1
- package/dist/plugins/tools/tao/secureTaoPlugin.js +0 -37
- package/dist/plugins/tools/tao/secureTaoPlugin.js.map +0 -1
- package/dist/tools/secureAppleExploitation.d.ts +0 -29
- package/dist/tools/secureAppleExploitation.d.ts.map +0 -1
- package/dist/tools/secureAppleExploitation.js +0 -518
- package/dist/tools/secureAppleExploitation.js.map +0 -1
- package/dist/ui/maxOffensiveUkraineUI.d.ts +0 -94
- package/dist/ui/maxOffensiveUkraineUI.d.ts.map +0 -1
- package/dist/ui/maxOffensiveUkraineUI.js +0 -316
- package/dist/ui/maxOffensiveUkraineUI.js.map +0 -1
package/dist/core/selfUpgrade.js
CHANGED
|
@@ -1,669 +1,92 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Self-Upgrade System
|
|
2
|
+
* Self-Upgrade System - Stub Implementation
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* 2. Launch a new CLI instance
|
|
7
|
-
* 3. Continue work seamlessly after upgrade
|
|
8
|
-
* 4. Integrate with edits, builds, tests, and RL scoring
|
|
9
|
-
*
|
|
10
|
-
* This module enables true self-improvement through version updates
|
|
11
|
-
* while maintaining session continuity.
|
|
4
|
+
* The full self-upgrade functionality has been removed.
|
|
5
|
+
* This stub maintains API compatibility for dependent modules.
|
|
12
6
|
*/
|
|
13
|
-
import { exec as execCallback, spawn } from 'node:child_process';
|
|
14
|
-
import { existsSync, mkdirSync, readFileSync, writeFileSync, rmSync } from 'node:fs';
|
|
15
|
-
import { homedir } from 'node:os';
|
|
16
|
-
import { join, dirname } from 'node:path';
|
|
17
|
-
import { promisify } from 'node:util';
|
|
18
7
|
import { EventEmitter } from 'node:events';
|
|
19
|
-
const execAsync = promisify(execCallback);
|
|
20
|
-
// ============================================================================
|
|
21
|
-
// CONSTANTS
|
|
22
|
-
// ============================================================================
|
|
23
|
-
const DEFAULT_PACKAGE_NAME = 'deepseek-coder-cli';
|
|
24
|
-
const DEFAULT_TIMEOUT = 5 * 60 * 1000; // 5 minutes
|
|
25
|
-
const SESSION_STATE_FILE = join(homedir(), '.agi', 'upgrade-session.json');
|
|
26
|
-
const UPGRADE_LOG_FILE = join(homedir(), '.agi', 'upgrade-log.json');
|
|
27
|
-
const RL_CHECKPOINT_FILE = join(homedir(), '.agi', 'rl-checkpoint.json');
|
|
28
|
-
// ============================================================================
|
|
29
|
-
// SELF-UPGRADE CLASS
|
|
30
|
-
// ============================================================================
|
|
31
8
|
export class SelfUpgrade extends EventEmitter {
|
|
32
|
-
|
|
33
|
-
upgradeInProgress = false;
|
|
34
|
-
childProcess = null;
|
|
9
|
+
logger;
|
|
35
10
|
constructor(config = {}) {
|
|
36
11
|
super();
|
|
37
|
-
this.
|
|
38
|
-
packageName: config.packageName ?? DEFAULT_PACKAGE_NAME,
|
|
39
|
-
global: config.global ?? true,
|
|
40
|
-
workingDir: config.workingDir ?? process.cwd(),
|
|
41
|
-
logger: config.logger ?? console.log,
|
|
42
|
-
timeout: config.timeout ?? DEFAULT_TIMEOUT,
|
|
43
|
-
autoRestart: config.autoRestart ?? true,
|
|
44
|
-
sessionState: config.sessionState,
|
|
45
|
-
};
|
|
12
|
+
this.logger = config.logger;
|
|
46
13
|
}
|
|
47
|
-
// ==========================================================================
|
|
48
|
-
// VERSION CHECKING
|
|
49
|
-
// ==========================================================================
|
|
50
|
-
/**
|
|
51
|
-
* Check for available updates
|
|
52
|
-
*/
|
|
53
14
|
async checkForUpdates() {
|
|
54
|
-
const current = await this.getCurrentVersion();
|
|
55
|
-
const latest = await this.getLatestVersion();
|
|
56
15
|
return {
|
|
57
|
-
current,
|
|
58
|
-
latest,
|
|
59
|
-
updateAvailable:
|
|
60
|
-
releaseNotesUrl: `https://github.com/anthropics/claude-code/releases/tag/v${latest}`,
|
|
16
|
+
current: '1.0.0',
|
|
17
|
+
latest: '1.0.0',
|
|
18
|
+
updateAvailable: false,
|
|
61
19
|
};
|
|
62
20
|
}
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
const globalPrefix = prefix.trim();
|
|
71
|
-
const pkgJsonPath = join(globalPrefix, 'lib', 'node_modules', this.config.packageName, 'package.json');
|
|
72
|
-
if (existsSync(pkgJsonPath)) {
|
|
73
|
-
const pkgJson = JSON.parse(readFileSync(pkgJsonPath, 'utf8'));
|
|
74
|
-
if (pkgJson.version) {
|
|
75
|
-
return pkgJson.version;
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
catch {
|
|
80
|
-
// Fall through to next method
|
|
81
|
-
}
|
|
82
|
-
// Method 2: Try npm list with proper parsing
|
|
83
|
-
try {
|
|
84
|
-
const { stdout } = await execAsync(`npm list -g ${this.config.packageName} --depth=0 --json`, {
|
|
85
|
-
timeout: 10000,
|
|
86
|
-
});
|
|
87
|
-
const result = JSON.parse(stdout);
|
|
88
|
-
// Check multiple possible locations in the JSON structure
|
|
89
|
-
const version = result.dependencies?.[this.config.packageName]?.version ||
|
|
90
|
-
result.devDependencies?.[this.config.packageName]?.version ||
|
|
91
|
-
result.version;
|
|
92
|
-
if (version && version !== '0.0.0') {
|
|
93
|
-
return version;
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
catch {
|
|
97
|
-
// Fall through to next method
|
|
98
|
-
}
|
|
99
|
-
// Method 3: Try parsing npm list text output
|
|
100
|
-
try {
|
|
101
|
-
const { stdout } = await execAsync(`npm list -g ${this.config.packageName} --depth=0`, {
|
|
102
|
-
timeout: 10000,
|
|
103
|
-
});
|
|
104
|
-
// Output format: "└── agi-core-cli@1.1.44" or similar
|
|
105
|
-
const match = stdout.match(new RegExp(`${this.config.packageName}@([\\d.]+)`));
|
|
106
|
-
if (match?.[1]) {
|
|
107
|
-
return match[1];
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
catch {
|
|
111
|
-
// Fall through
|
|
112
|
-
}
|
|
113
|
-
return '0.0.0';
|
|
114
|
-
}
|
|
115
|
-
/**
|
|
116
|
-
* Get latest available version from npm registry
|
|
117
|
-
*/
|
|
118
|
-
async getLatestVersion() {
|
|
119
|
-
try {
|
|
120
|
-
const { stdout } = await execAsync(`npm view ${this.config.packageName} version`, {
|
|
121
|
-
timeout: 10000,
|
|
122
|
-
});
|
|
123
|
-
return stdout.trim();
|
|
124
|
-
}
|
|
125
|
-
catch {
|
|
126
|
-
return '0.0.0';
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
/**
|
|
130
|
-
* Compare two semver versions
|
|
131
|
-
* Returns: 1 if v1 > v2, -1 if v1 < v2, 0 if equal
|
|
132
|
-
*/
|
|
133
|
-
compareVersions(v1, v2) {
|
|
134
|
-
const parts1 = v1.replace(/^v/, '').split('.').map(Number);
|
|
135
|
-
const parts2 = v2.replace(/^v/, '').split('.').map(Number);
|
|
136
|
-
for (let i = 0; i < Math.max(parts1.length, parts2.length); i++) {
|
|
137
|
-
const p1 = parts1[i] || 0;
|
|
138
|
-
const p2 = parts2[i] || 0;
|
|
139
|
-
if (p1 > p2)
|
|
140
|
-
return 1;
|
|
141
|
-
if (p1 < p2)
|
|
142
|
-
return -1;
|
|
143
|
-
}
|
|
144
|
-
return 0;
|
|
145
|
-
}
|
|
146
|
-
// ==========================================================================
|
|
147
|
-
// UPGRADE EXECUTION
|
|
148
|
-
// ==========================================================================
|
|
149
|
-
/**
|
|
150
|
-
* Perform npm install of fresh version
|
|
151
|
-
*/
|
|
152
|
-
async npmInstallFresh(version) {
|
|
153
|
-
if (this.upgradeInProgress) {
|
|
154
|
-
return {
|
|
155
|
-
success: false,
|
|
156
|
-
fromVersion: await this.getCurrentVersion(),
|
|
157
|
-
error: 'Upgrade already in progress',
|
|
158
|
-
restarted: false,
|
|
159
|
-
durationMs: 0,
|
|
160
|
-
};
|
|
161
|
-
}
|
|
162
|
-
this.upgradeInProgress = true;
|
|
163
|
-
const startTime = Date.now();
|
|
164
|
-
const fromVersion = await this.getCurrentVersion();
|
|
165
|
-
this.emitEvent('upgrade:start', { fromVersion, targetVersion: version || 'latest' });
|
|
166
|
-
try {
|
|
167
|
-
// Save session state before upgrade
|
|
168
|
-
if (this.config.sessionState) {
|
|
169
|
-
this.saveSessionState({
|
|
170
|
-
...this.config.sessionState,
|
|
171
|
-
fromVersion,
|
|
172
|
-
toVersion: version,
|
|
173
|
-
timestamp: Date.now(),
|
|
174
|
-
});
|
|
175
|
-
}
|
|
176
|
-
// Build install command
|
|
177
|
-
const globalFlag = this.config.global ? '-g ' : '';
|
|
178
|
-
const versionSpec = version ? `@${version}` : '@latest';
|
|
179
|
-
const command = `npm install ${globalFlag}${this.config.packageName}${versionSpec}`;
|
|
180
|
-
this.config.logger(`Installing ${this.config.packageName}${versionSpec}...`);
|
|
181
|
-
this.emitEvent('upgrade:download', { command });
|
|
182
|
-
// Execute npm install
|
|
183
|
-
await execAsync(command, {
|
|
184
|
-
timeout: this.config.timeout,
|
|
185
|
-
maxBuffer: 10 * 1024 * 1024,
|
|
186
|
-
env: {
|
|
187
|
-
...process.env,
|
|
188
|
-
npm_config_loglevel: 'warn',
|
|
189
|
-
},
|
|
190
|
-
});
|
|
191
|
-
this.emitEvent('upgrade:install', { success: true });
|
|
192
|
-
const toVersion = await this.getLatestVersion();
|
|
193
|
-
const durationMs = Date.now() - startTime;
|
|
194
|
-
// Log upgrade
|
|
195
|
-
this.logUpgrade({
|
|
196
|
-
success: true,
|
|
197
|
-
fromVersion,
|
|
198
|
-
toVersion,
|
|
199
|
-
durationMs,
|
|
200
|
-
timestamp: Date.now(),
|
|
201
|
-
});
|
|
202
|
-
this.config.logger(`Upgrade complete: ${fromVersion} -> ${toVersion}`);
|
|
203
|
-
this.emitEvent('upgrade:complete', { fromVersion, toVersion, durationMs });
|
|
204
|
-
// Auto-restart if configured
|
|
205
|
-
if (this.config.autoRestart) {
|
|
206
|
-
await this.launchNewInstance();
|
|
207
|
-
return {
|
|
208
|
-
success: true,
|
|
209
|
-
fromVersion,
|
|
210
|
-
toVersion,
|
|
211
|
-
restarted: true,
|
|
212
|
-
durationMs,
|
|
213
|
-
};
|
|
214
|
-
}
|
|
215
|
-
return {
|
|
216
|
-
success: true,
|
|
217
|
-
fromVersion,
|
|
218
|
-
toVersion,
|
|
219
|
-
restarted: false,
|
|
220
|
-
durationMs,
|
|
221
|
-
};
|
|
222
|
-
}
|
|
223
|
-
catch (error) {
|
|
224
|
-
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
225
|
-
this.config.logger(`Upgrade failed: ${errorMessage}`);
|
|
226
|
-
this.emitEvent('upgrade:error', { error: errorMessage });
|
|
227
|
-
return {
|
|
228
|
-
success: false,
|
|
229
|
-
fromVersion,
|
|
230
|
-
error: errorMessage,
|
|
231
|
-
restarted: false,
|
|
232
|
-
durationMs: Date.now() - startTime,
|
|
233
|
-
};
|
|
234
|
-
}
|
|
235
|
-
finally {
|
|
236
|
-
this.upgradeInProgress = false;
|
|
237
|
-
}
|
|
21
|
+
async upgradeWithFullVerification(_version, _buildCommand, _testCommand) {
|
|
22
|
+
return {
|
|
23
|
+
success: false,
|
|
24
|
+
buildSuccess: false,
|
|
25
|
+
testState: { passed: 0, failed: 0 },
|
|
26
|
+
error: 'Self-upgrade functionality has been removed',
|
|
27
|
+
};
|
|
238
28
|
}
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
const args = [];
|
|
246
|
-
// Add resume flag if we have session state
|
|
247
|
-
if (resumeSession && this.hasPendingSession()) {
|
|
248
|
-
args.push('--resume');
|
|
249
|
-
}
|
|
250
|
-
// Add working directory
|
|
251
|
-
if (this.config.workingDir) {
|
|
252
|
-
args.push('--cwd', this.config.workingDir);
|
|
253
|
-
}
|
|
254
|
-
this.config.logger('Launching new CLI instance...');
|
|
255
|
-
this.emitEvent('upgrade:restart', { cliPath, args });
|
|
256
|
-
// Spawn new process
|
|
257
|
-
this.childProcess = spawn(process.execPath, [cliPath, ...args], {
|
|
258
|
-
detached: true,
|
|
259
|
-
stdio: 'inherit',
|
|
260
|
-
cwd: this.config.workingDir,
|
|
261
|
-
env: {
|
|
262
|
-
...process.env,
|
|
263
|
-
AGI_UPGRADED: 'true',
|
|
264
|
-
AGI_UPGRADE_FROM: await this.getCurrentVersion(),
|
|
265
|
-
AGI_RESUME_SESSION: resumeSession ? 'true' : 'false',
|
|
266
|
-
},
|
|
267
|
-
});
|
|
268
|
-
// Unref to allow parent to exit
|
|
269
|
-
if (this.childProcess.unref) {
|
|
270
|
-
this.childProcess.unref();
|
|
271
|
-
}
|
|
272
|
-
// Exit current process after short delay
|
|
273
|
-
setTimeout(() => {
|
|
274
|
-
process.exit(0);
|
|
275
|
-
}, 500);
|
|
276
|
-
return true;
|
|
277
|
-
}
|
|
278
|
-
catch (error) {
|
|
279
|
-
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
280
|
-
this.config.logger(`Failed to launch new instance: ${errorMessage}`);
|
|
281
|
-
return false;
|
|
282
|
-
}
|
|
29
|
+
async npmInstallFresh(_version) {
|
|
30
|
+
return {
|
|
31
|
+
success: false,
|
|
32
|
+
testState: { passed: 0, failed: 0 },
|
|
33
|
+
error: 'Self-upgrade functionality has been removed',
|
|
34
|
+
};
|
|
283
35
|
}
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
// ==========================================================================
|
|
287
|
-
/**
|
|
288
|
-
* Save session state for resumption after upgrade
|
|
289
|
-
*/
|
|
290
|
-
saveSessionState(state) {
|
|
291
|
-
try {
|
|
292
|
-
const dir = dirname(SESSION_STATE_FILE);
|
|
293
|
-
if (!existsSync(dir)) {
|
|
294
|
-
mkdirSync(dir, { recursive: true });
|
|
295
|
-
}
|
|
296
|
-
writeFileSync(SESSION_STATE_FILE, JSON.stringify(state, null, 2));
|
|
297
|
-
}
|
|
298
|
-
catch {
|
|
299
|
-
// Best-effort
|
|
300
|
-
}
|
|
36
|
+
saveSessionState(_state) {
|
|
37
|
+
// No-op
|
|
301
38
|
}
|
|
302
|
-
/**
|
|
303
|
-
* Load session state after upgrade
|
|
304
|
-
*/
|
|
305
39
|
loadSessionState() {
|
|
306
|
-
|
|
307
|
-
if (!existsSync(SESSION_STATE_FILE)) {
|
|
308
|
-
return null;
|
|
309
|
-
}
|
|
310
|
-
const raw = readFileSync(SESSION_STATE_FILE, 'utf8');
|
|
311
|
-
return JSON.parse(raw);
|
|
312
|
-
}
|
|
313
|
-
catch {
|
|
314
|
-
return null;
|
|
315
|
-
}
|
|
40
|
+
return null;
|
|
316
41
|
}
|
|
317
|
-
/**
|
|
318
|
-
* Clear session state after successful resumption
|
|
319
|
-
*/
|
|
320
42
|
clearSessionState() {
|
|
321
|
-
|
|
322
|
-
if (existsSync(SESSION_STATE_FILE)) {
|
|
323
|
-
rmSync(SESSION_STATE_FILE);
|
|
324
|
-
}
|
|
325
|
-
}
|
|
326
|
-
catch {
|
|
327
|
-
// Best-effort
|
|
328
|
-
}
|
|
329
|
-
}
|
|
330
|
-
/**
|
|
331
|
-
* Check if there's a pending session to resume
|
|
332
|
-
*/
|
|
333
|
-
hasPendingSession() {
|
|
334
|
-
const state = this.loadSessionState();
|
|
335
|
-
if (!state || !state.timestamp)
|
|
336
|
-
return false;
|
|
337
|
-
// Session valid if less than 24 hours old
|
|
338
|
-
const maxAge = 24 * 60 * 60 * 1000;
|
|
339
|
-
return Date.now() - state.timestamp < maxAge;
|
|
340
|
-
}
|
|
341
|
-
// ==========================================================================
|
|
342
|
-
// RL INTEGRATION
|
|
343
|
-
// ==========================================================================
|
|
344
|
-
/**
|
|
345
|
-
* Save RL checkpoint before upgrade (for RL scoring continuity)
|
|
346
|
-
*/
|
|
347
|
-
saveRLCheckpoint(context) {
|
|
348
|
-
try {
|
|
349
|
-
const dir = dirname(RL_CHECKPOINT_FILE);
|
|
350
|
-
if (!existsSync(dir)) {
|
|
351
|
-
mkdirSync(dir, { recursive: true });
|
|
352
|
-
}
|
|
353
|
-
writeFileSync(RL_CHECKPOINT_FILE, JSON.stringify({
|
|
354
|
-
...context,
|
|
355
|
-
checkpointTime: Date.now(),
|
|
356
|
-
}, null, 2));
|
|
357
|
-
this.emitEvent('upgrade:rl-checkpoint', { context });
|
|
358
|
-
}
|
|
359
|
-
catch {
|
|
360
|
-
// Best-effort
|
|
361
|
-
}
|
|
362
|
-
}
|
|
363
|
-
/**
|
|
364
|
-
* Load RL checkpoint after upgrade
|
|
365
|
-
*/
|
|
366
|
-
loadRLCheckpoint() {
|
|
367
|
-
try {
|
|
368
|
-
if (!existsSync(RL_CHECKPOINT_FILE)) {
|
|
369
|
-
return null;
|
|
370
|
-
}
|
|
371
|
-
const raw = readFileSync(RL_CHECKPOINT_FILE, 'utf8');
|
|
372
|
-
const data = JSON.parse(raw);
|
|
373
|
-
// Checkpoint valid if less than 1 hour old
|
|
374
|
-
if (Date.now() - data.checkpointTime > 60 * 60 * 1000) {
|
|
375
|
-
return null;
|
|
376
|
-
}
|
|
377
|
-
return data;
|
|
378
|
-
}
|
|
379
|
-
catch {
|
|
380
|
-
return null;
|
|
381
|
-
}
|
|
43
|
+
// No-op
|
|
382
44
|
}
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
*/
|
|
386
|
-
clearRLCheckpoint() {
|
|
387
|
-
try {
|
|
388
|
-
if (existsSync(RL_CHECKPOINT_FILE)) {
|
|
389
|
-
rmSync(RL_CHECKPOINT_FILE);
|
|
390
|
-
}
|
|
391
|
-
}
|
|
392
|
-
catch {
|
|
393
|
-
// Best-effort
|
|
394
|
-
}
|
|
45
|
+
saveRLCheckpoint(_context) {
|
|
46
|
+
// No-op
|
|
395
47
|
}
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
* Positive impact if upgrade improves capability
|
|
399
|
-
*/
|
|
400
|
-
calculateRLScoreImpact(preUpgrade, postUpgradeSuccess) {
|
|
401
|
-
if (!postUpgradeSuccess) {
|
|
402
|
-
return -0.1; // Penalty for failed upgrade attempt
|
|
403
|
-
}
|
|
404
|
-
// Base positive impact for successful upgrade
|
|
405
|
-
let impact = 0.05;
|
|
406
|
-
// Bonus for upgrading during active RL iteration
|
|
407
|
-
if (preUpgrade.iteration > 0) {
|
|
408
|
-
impact += 0.02;
|
|
409
|
-
}
|
|
410
|
-
// Bonus if files were modified (upgrade during active work)
|
|
411
|
-
if (preUpgrade.filesModified.length > 0) {
|
|
412
|
-
impact += 0.01 * Math.min(preUpgrade.filesModified.length, 5);
|
|
413
|
-
}
|
|
414
|
-
return impact;
|
|
48
|
+
saveActiveEdits(_edits) {
|
|
49
|
+
// No-op
|
|
415
50
|
}
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
// ==========================================================================
|
|
419
|
-
/**
|
|
420
|
-
* Upgrade with build verification
|
|
421
|
-
*/
|
|
422
|
-
async upgradeWithBuildCheck(version, buildCommand = 'npm run build') {
|
|
423
|
-
const result = await this.npmInstallFresh(version);
|
|
424
|
-
if (!result.success) {
|
|
425
|
-
return { ...result, buildSuccess: false };
|
|
426
|
-
}
|
|
427
|
-
// Run build to verify upgrade didn't break anything
|
|
428
|
-
try {
|
|
429
|
-
await execAsync(buildCommand, {
|
|
430
|
-
cwd: this.config.workingDir,
|
|
431
|
-
timeout: this.config.timeout,
|
|
432
|
-
});
|
|
433
|
-
return { ...result, buildSuccess: true };
|
|
434
|
-
}
|
|
435
|
-
catch (error) {
|
|
436
|
-
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
437
|
-
this.config.logger(`Post-upgrade build failed: ${errorMessage}`);
|
|
438
|
-
return { ...result, buildSuccess: false };
|
|
439
|
-
}
|
|
51
|
+
async launchNewInstance(_waitForClose) {
|
|
52
|
+
// No-op
|
|
440
53
|
}
|
|
441
|
-
/**
|
|
442
|
-
* Upgrade with test verification
|
|
443
|
-
*/
|
|
444
|
-
async upgradeWithTestCheck(version, testCommand = 'npm test') {
|
|
445
|
-
const result = await this.npmInstallFresh(version);
|
|
446
|
-
if (!result.success) {
|
|
447
|
-
return { ...result, testState: { passed: 0, failed: 0 } };
|
|
448
|
-
}
|
|
449
|
-
// Run tests to verify upgrade
|
|
450
|
-
try {
|
|
451
|
-
const { stdout, stderr } = await execAsync(testCommand, {
|
|
452
|
-
cwd: this.config.workingDir,
|
|
453
|
-
timeout: this.config.timeout,
|
|
454
|
-
});
|
|
455
|
-
const output = stdout + stderr;
|
|
456
|
-
const passed = this.parseTestCount(output, 'pass');
|
|
457
|
-
const failed = this.parseTestCount(output, 'fail');
|
|
458
|
-
return {
|
|
459
|
-
...result,
|
|
460
|
-
testState: { passed, failed, output, command: testCommand },
|
|
461
|
-
};
|
|
462
|
-
}
|
|
463
|
-
catch (error) {
|
|
464
|
-
const output = error instanceof Error ? error.stdout + error.stderr : '';
|
|
465
|
-
const passed = this.parseTestCount(output, 'pass');
|
|
466
|
-
const failed = this.parseTestCount(output, 'fail');
|
|
467
|
-
return {
|
|
468
|
-
...result,
|
|
469
|
-
testState: { passed, failed, output, command: testCommand },
|
|
470
|
-
};
|
|
471
|
-
}
|
|
472
|
-
}
|
|
473
|
-
/**
|
|
474
|
-
* Full upgrade with build and test verification
|
|
475
|
-
*/
|
|
476
|
-
async upgradeWithFullVerification(version, buildCommand = 'npm run build', testCommand = 'npm test') {
|
|
477
|
-
const result = await this.npmInstallFresh(version);
|
|
478
|
-
if (!result.success) {
|
|
479
|
-
return { ...result, buildSuccess: false, testState: { passed: 0, failed: 0 } };
|
|
480
|
-
}
|
|
481
|
-
// Run build
|
|
482
|
-
let buildSuccess = false;
|
|
483
|
-
try {
|
|
484
|
-
await execAsync(buildCommand, {
|
|
485
|
-
cwd: this.config.workingDir,
|
|
486
|
-
timeout: this.config.timeout,
|
|
487
|
-
});
|
|
488
|
-
buildSuccess = true;
|
|
489
|
-
}
|
|
490
|
-
catch {
|
|
491
|
-
this.config.logger('Post-upgrade build failed');
|
|
492
|
-
}
|
|
493
|
-
// Run tests
|
|
494
|
-
let testState = { passed: 0, failed: 0 };
|
|
495
|
-
try {
|
|
496
|
-
const { stdout, stderr } = await execAsync(testCommand, {
|
|
497
|
-
cwd: this.config.workingDir,
|
|
498
|
-
timeout: this.config.timeout,
|
|
499
|
-
});
|
|
500
|
-
const output = stdout + stderr;
|
|
501
|
-
testState = {
|
|
502
|
-
passed: this.parseTestCount(output, 'pass'),
|
|
503
|
-
failed: this.parseTestCount(output, 'fail'),
|
|
504
|
-
output,
|
|
505
|
-
command: testCommand,
|
|
506
|
-
};
|
|
507
|
-
}
|
|
508
|
-
catch (error) {
|
|
509
|
-
const output = error instanceof Error ? error.stdout + error.stderr : '';
|
|
510
|
-
testState = {
|
|
511
|
-
passed: this.parseTestCount(output, 'pass'),
|
|
512
|
-
failed: this.parseTestCount(output, 'fail'),
|
|
513
|
-
output,
|
|
514
|
-
command: testCommand,
|
|
515
|
-
};
|
|
516
|
-
}
|
|
517
|
-
return { ...result, buildSuccess, testState };
|
|
518
|
-
}
|
|
519
|
-
parseTestCount(output, type) {
|
|
520
|
-
const match = output.match(new RegExp(`(\\d+)\\s*${type}`, 'i'));
|
|
521
|
-
return match ? parseInt(match[1], 10) : 0;
|
|
522
|
-
}
|
|
523
|
-
// ==========================================================================
|
|
524
|
-
// EDIT INTEGRATION
|
|
525
|
-
// ==========================================================================
|
|
526
|
-
/**
|
|
527
|
-
* Save active edits before upgrade for continuity
|
|
528
|
-
*/
|
|
529
|
-
saveActiveEdits(files) {
|
|
530
|
-
const state = this.loadSessionState() || {
|
|
531
|
-
workingDir: this.config.workingDir,
|
|
532
|
-
fromVersion: '0.0.0',
|
|
533
|
-
timestamp: Date.now(),
|
|
534
|
-
};
|
|
535
|
-
this.saveSessionState({
|
|
536
|
-
...state,
|
|
537
|
-
activeEdits: files,
|
|
538
|
-
});
|
|
539
|
-
}
|
|
540
|
-
/**
|
|
541
|
-
* Get active edits to resume after upgrade
|
|
542
|
-
*/
|
|
543
|
-
getActiveEdits() {
|
|
544
|
-
const state = this.loadSessionState();
|
|
545
|
-
return state?.activeEdits || [];
|
|
546
|
-
}
|
|
547
|
-
// ==========================================================================
|
|
548
|
-
// LOGGING
|
|
549
|
-
// ==========================================================================
|
|
550
|
-
logUpgrade(entry) {
|
|
551
|
-
try {
|
|
552
|
-
const dir = dirname(UPGRADE_LOG_FILE);
|
|
553
|
-
if (!existsSync(dir)) {
|
|
554
|
-
mkdirSync(dir, { recursive: true });
|
|
555
|
-
}
|
|
556
|
-
let logs = [];
|
|
557
|
-
if (existsSync(UPGRADE_LOG_FILE)) {
|
|
558
|
-
try {
|
|
559
|
-
logs = JSON.parse(readFileSync(UPGRADE_LOG_FILE, 'utf8'));
|
|
560
|
-
}
|
|
561
|
-
catch {
|
|
562
|
-
logs = [];
|
|
563
|
-
}
|
|
564
|
-
}
|
|
565
|
-
logs.push(entry);
|
|
566
|
-
// Keep last 100 entries
|
|
567
|
-
if (logs.length > 100) {
|
|
568
|
-
logs = logs.slice(-100);
|
|
569
|
-
}
|
|
570
|
-
writeFileSync(UPGRADE_LOG_FILE, JSON.stringify(logs, null, 2));
|
|
571
|
-
}
|
|
572
|
-
catch {
|
|
573
|
-
// Best-effort
|
|
574
|
-
}
|
|
575
|
-
}
|
|
576
|
-
emitEvent(type, data) {
|
|
577
|
-
const event = {
|
|
578
|
-
type,
|
|
579
|
-
timestamp: Date.now(),
|
|
580
|
-
data,
|
|
581
|
-
};
|
|
582
|
-
this.emit(type, event);
|
|
583
|
-
this.emit('upgrade', event);
|
|
584
|
-
}
|
|
585
|
-
// ==========================================================================
|
|
586
|
-
// STATIC UTILITIES
|
|
587
|
-
// ==========================================================================
|
|
588
|
-
/**
|
|
589
|
-
* Check if this process was started after an upgrade
|
|
590
|
-
*/
|
|
591
54
|
static wasUpgraded() {
|
|
592
|
-
return
|
|
55
|
+
return false;
|
|
593
56
|
}
|
|
594
|
-
/**
|
|
595
|
-
* Get the version we upgraded from
|
|
596
|
-
*/
|
|
597
57
|
static getUpgradeFromVersion() {
|
|
598
|
-
return
|
|
599
|
-
}
|
|
600
|
-
/**
|
|
601
|
-
* Check if we should resume a session
|
|
602
|
-
*/
|
|
603
|
-
static shouldResumeSession() {
|
|
604
|
-
return process.env['AGI_RESUME_SESSION'] === 'true';
|
|
58
|
+
return null;
|
|
605
59
|
}
|
|
606
60
|
}
|
|
607
|
-
|
|
608
|
-
// SINGLETON EXPORT
|
|
609
|
-
// ============================================================================
|
|
610
|
-
let selfUpgradeInstance = null;
|
|
61
|
+
let instance = null;
|
|
611
62
|
export function getSelfUpgrade(config) {
|
|
612
|
-
if (!
|
|
613
|
-
|
|
63
|
+
if (!instance) {
|
|
64
|
+
instance = new SelfUpgrade(config);
|
|
614
65
|
}
|
|
615
|
-
return
|
|
66
|
+
return instance;
|
|
616
67
|
}
|
|
617
68
|
export function resetSelfUpgrade() {
|
|
618
|
-
|
|
69
|
+
instance = null;
|
|
619
70
|
}
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
export async function upgradeToLatest(options = {}) {
|
|
627
|
-
const upgrade = getSelfUpgrade({
|
|
628
|
-
autoRestart: options.autoRestart ?? true,
|
|
629
|
-
workingDir: options.workingDir,
|
|
630
|
-
logger: options.logger,
|
|
631
|
-
});
|
|
632
|
-
return upgrade.npmInstallFresh();
|
|
71
|
+
export async function upgradeToLatest() {
|
|
72
|
+
return {
|
|
73
|
+
success: false,
|
|
74
|
+
testState: { passed: 0, failed: 0 },
|
|
75
|
+
error: 'Self-upgrade functionality has been removed',
|
|
76
|
+
};
|
|
633
77
|
}
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
autoRestart: false, // Don't auto-restart, let caller decide after verification
|
|
642
|
-
});
|
|
643
|
-
return upgrade.upgradeWithFullVerification(options.version, options.buildCommand, options.testCommand);
|
|
78
|
+
export async function upgradeAndVerify() {
|
|
79
|
+
return {
|
|
80
|
+
success: false,
|
|
81
|
+
buildSuccess: false,
|
|
82
|
+
testState: { passed: 0, failed: 0 },
|
|
83
|
+
error: 'Self-upgrade functionality has been removed',
|
|
84
|
+
};
|
|
644
85
|
}
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
*/
|
|
648
|
-
export function saveUpgradeState(state) {
|
|
649
|
-
const upgrade = getSelfUpgrade();
|
|
650
|
-
upgrade.getCurrentVersion().then((fromVersion) => {
|
|
651
|
-
upgrade.saveSessionState({
|
|
652
|
-
...state,
|
|
653
|
-
fromVersion,
|
|
654
|
-
timestamp: Date.now(),
|
|
655
|
-
});
|
|
656
|
-
});
|
|
86
|
+
export function saveUpgradeState(_state) {
|
|
87
|
+
// No-op
|
|
657
88
|
}
|
|
658
|
-
/**
|
|
659
|
-
* Resume work after upgrade
|
|
660
|
-
*/
|
|
661
89
|
export function resumeAfterUpgrade() {
|
|
662
|
-
|
|
663
|
-
const state = upgrade.loadSessionState();
|
|
664
|
-
if (state) {
|
|
665
|
-
upgrade.clearSessionState();
|
|
666
|
-
}
|
|
667
|
-
return state;
|
|
90
|
+
return null;
|
|
668
91
|
}
|
|
669
92
|
//# sourceMappingURL=selfUpgrade.js.map
|