@agentknight/client 0.9.48 → 0.9.50
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/LICENSE +201 -201
- package/README.md +356 -324
- package/dist/chunks/aad-relay-login-NABH6HML.js +14 -0
- package/dist/chunks/chunk-CYCBYXFV.js +32 -0
- package/dist/chunks/chunk-HWCSV7QP.js +2902 -0
- package/dist/chunks/chunk-KYTI7A5R.js +735 -0
- package/dist/chunks/chunk-SPZWIFFP.js +52 -0
- package/dist/chunks/chunk-WZIU4HVH.js +318 -0
- package/dist/chunks/chunk-XODJ7TIT.js +475 -0
- package/dist/chunks/chunk-YNKNHR5K.js +74 -0
- package/dist/chunks/client-home-LAKFDPXO.js +268 -0
- package/dist/chunks/local-sessions-CLY45IWB.js +29 -0
- package/dist/chunks/runtime-CTACRJCK.js +20 -0
- package/dist/chunks/start-client-VGGH7W42.js +3971 -0
- package/dist/chunks/upgrade-T32WY4HC.js +181 -0
- package/dist/chunks/upgrade-state-QXZT3TTS.js +17 -0
- package/dist/cli.js +98 -7353
- package/dist/upgrade-worker.js +200 -4
- package/package.json +13 -4
|
@@ -0,0 +1,735 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
defaultClientHome,
|
|
4
|
+
isClientConfigurationKey,
|
|
5
|
+
normalizeClientEnvironment
|
|
6
|
+
} from "./chunk-YNKNHR5K.js";
|
|
7
|
+
import {
|
|
8
|
+
RuntimeStatusSchema
|
|
9
|
+
} from "./chunk-WZIU4HVH.js";
|
|
10
|
+
import {
|
|
11
|
+
readOptionalJson,
|
|
12
|
+
writePrivateJson
|
|
13
|
+
} from "./chunk-SPZWIFFP.js";
|
|
14
|
+
|
|
15
|
+
// src/restart-environment.ts
|
|
16
|
+
import { resolve } from "node:path";
|
|
17
|
+
var credentialKey = /(?:^|_)(?:TOKEN|API_KEY|ACCESS_KEY|SECRET)$/u;
|
|
18
|
+
var retainedKeys = [
|
|
19
|
+
"PATH",
|
|
20
|
+
"Path",
|
|
21
|
+
"HOME",
|
|
22
|
+
"USERPROFILE",
|
|
23
|
+
"APPDATA",
|
|
24
|
+
"LOCALAPPDATA",
|
|
25
|
+
"COPILOT_HOME",
|
|
26
|
+
"PI_CODING_AGENT_DIR",
|
|
27
|
+
"NODE_EXTRA_CA_CERTS",
|
|
28
|
+
"NODE_OPTIONS"
|
|
29
|
+
];
|
|
30
|
+
function restartEnvironment(effective, persisted, dataDirectory) {
|
|
31
|
+
const effectiveEnvironment = normalizeClientEnvironment(effective);
|
|
32
|
+
const persistedEnvironment = normalizeClientEnvironment(persisted);
|
|
33
|
+
const environment = { AGENTKNIGHT_HOME: dataDirectory };
|
|
34
|
+
for (const key of retainedKeys) {
|
|
35
|
+
const value = effectiveEnvironment[key];
|
|
36
|
+
if (value !== void 0) environment[key] = value;
|
|
37
|
+
}
|
|
38
|
+
return {
|
|
39
|
+
canRestart: Object.entries(effectiveEnvironment).every(([key, value]) => {
|
|
40
|
+
if (key === "AGENTKNIGHT_HOME" && value !== void 0) {
|
|
41
|
+
return resolve(value) === resolve(persistedEnvironment[key] ?? defaultClientHome());
|
|
42
|
+
}
|
|
43
|
+
return !isClientConfigurationKey(key) && !credentialKey.test(key) || value === void 0 || persistedEnvironment[key] === value;
|
|
44
|
+
}),
|
|
45
|
+
environment
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
// src/upgrade-supervisor.ts
|
|
50
|
+
import { execFile, spawn } from "node:child_process";
|
|
51
|
+
import { createHash } from "node:crypto";
|
|
52
|
+
import { open } from "node:fs/promises";
|
|
53
|
+
import { join } from "node:path";
|
|
54
|
+
import { promisify } from "node:util";
|
|
55
|
+
import { z } from "zod";
|
|
56
|
+
var execute = promisify(execFile);
|
|
57
|
+
var SupervisorSchema = z.discriminatedUnion("kind", [
|
|
58
|
+
z.object({ kind: z.literal("process") }),
|
|
59
|
+
z.object({ kind: z.literal("windows-task"), name: z.string(), path: z.string(), definitionHash: z.string() }),
|
|
60
|
+
z.object({ kind: z.literal("launchd"), domain: z.string(), label: z.string(), plist: z.string() })
|
|
61
|
+
]);
|
|
62
|
+
function globalPackageDirectory(prefix) {
|
|
63
|
+
return process.platform === "win32" ? join(prefix, "node_modules", "@agentknight", "client") : join(prefix, "lib", "node_modules", "@agentknight", "client");
|
|
64
|
+
}
|
|
65
|
+
function quotePowerShell(value) {
|
|
66
|
+
return `'${value.replaceAll("'", "''")}'`;
|
|
67
|
+
}
|
|
68
|
+
async function powershell(script) {
|
|
69
|
+
const encoded = Buffer.from(`$ErrorActionPreference='Stop'; ${script}`, "utf16le").toString("base64");
|
|
70
|
+
const result = await execute(
|
|
71
|
+
"powershell.exe",
|
|
72
|
+
["-NoProfile", "-NonInteractive", "-EncodedCommand", encoded],
|
|
73
|
+
{ windowsHide: true, timeout: 3e4, maxBuffer: 1024 * 1024 }
|
|
74
|
+
);
|
|
75
|
+
return result.stdout.trim();
|
|
76
|
+
}
|
|
77
|
+
async function assertInstallationIdle(prefix, allowedPid) {
|
|
78
|
+
const cli = join(globalPackageDirectory(prefix), "dist", "cli.js");
|
|
79
|
+
let pids;
|
|
80
|
+
if (process.platform === "win32") {
|
|
81
|
+
const result = await powershell(`
|
|
82
|
+
$cli=${quotePowerShell(cli)} -replace '[\\\\/]+','\\';
|
|
83
|
+
$ids=@(Get-CimInstance Win32_Process -Filter "Name = 'node.exe'" | Where-Object {
|
|
84
|
+
$_.CommandLine -and ($_.CommandLine -replace '[\\\\/]+','\\').IndexOf($cli,[StringComparison]::OrdinalIgnoreCase) -ge 0
|
|
85
|
+
} | ForEach-Object { [int]$_.ProcessId });
|
|
86
|
+
ConvertTo-Json -InputObject $ids -Compress
|
|
87
|
+
`);
|
|
88
|
+
pids = z.array(z.number().int().positive()).parse(JSON.parse(result));
|
|
89
|
+
} else {
|
|
90
|
+
const result = await execute("ps", ["-eo", "pid=,args="], { timeout: 1e4 });
|
|
91
|
+
pids = result.stdout.split("\n").flatMap((line) => {
|
|
92
|
+
const match = /^\s*(\d+)\s+(.*)$/u.exec(line);
|
|
93
|
+
if (match?.[2] === void 0) return [];
|
|
94
|
+
return [cli, join(prefix, "bin", "agentknight")].some((path) => match[2]?.includes(path)) ? [Number(match[1])] : [];
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
if (pids.some((pid) => pid !== process.pid && pid !== allowedPid)) {
|
|
98
|
+
throw new Error("Another Agent uses this installation without the expected control instance. Stop it, or restart it with the current CLI before upgrading.");
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
async function detectSupervisor(runtime) {
|
|
102
|
+
if (process.platform === "win32") {
|
|
103
|
+
const result = await powershell(`
|
|
104
|
+
$ancestors=@(); $next=${runtime.pid};
|
|
105
|
+
for($i=0;$i -lt 12 -and $next -gt 0;$i++) {
|
|
106
|
+
$p=Get-CimInstance Win32_Process -Filter "ProcessId = $next";
|
|
107
|
+
if(-not $p) { break }; $ancestors+=,$p; $next=$p.ParentProcessId
|
|
108
|
+
};
|
|
109
|
+
$matches=@(foreach($task in Get-ScheduledTask | Where-Object { $_.State -eq 'Running' }) {
|
|
110
|
+
foreach($action in $task.Actions) {
|
|
111
|
+
if(-not $action.Arguments) { continue };
|
|
112
|
+
$argument=$action.Arguments -replace '\\s+',' ';
|
|
113
|
+
if(@($ancestors | Where-Object {
|
|
114
|
+
$_.CommandLine -and ($_.CommandLine -replace '\\s+',' ').IndexOf($argument,[StringComparison]::OrdinalIgnoreCase) -ge 0
|
|
115
|
+
}).Count -gt 0) {
|
|
116
|
+
[pscustomobject]@{name=$task.TaskName;path=$task.TaskPath;xml=(Export-ScheduledTask -TaskName $task.TaskName -TaskPath $task.TaskPath)};
|
|
117
|
+
break
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
});
|
|
121
|
+
if($matches.Count -gt 1) { throw 'Multiple scheduled tasks match this Agent. Refusing to choose.' };
|
|
122
|
+
if($matches.Count -eq 1) { $matches[0] | ConvertTo-Json -Compress } else { 'null' }
|
|
123
|
+
`);
|
|
124
|
+
const task = z.object({ name: z.string(), path: z.string(), xml: z.string() }).nullable().parse(JSON.parse(result));
|
|
125
|
+
return task === null ? { kind: "process" } : {
|
|
126
|
+
kind: "windows-task",
|
|
127
|
+
name: task.name,
|
|
128
|
+
path: task.path,
|
|
129
|
+
definitionHash: createHash("sha256").update(task.xml.trim()).digest("hex")
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
if (process.platform === "darwin") {
|
|
133
|
+
const domain = `gui/${process.getuid?.()}`;
|
|
134
|
+
const label = "com.agentknight.pc-agent";
|
|
135
|
+
const result = await execute("launchctl", ["list"], { timeout: 1e4 });
|
|
136
|
+
const service = result.stdout.split("\n").find((line) => line.endsWith(` ${label}`));
|
|
137
|
+
if (service !== void 0) {
|
|
138
|
+
const parentPid = Number(service.split(/\s+/u)[0]);
|
|
139
|
+
let pid = runtime.pid;
|
|
140
|
+
for (let index = 0; index < 12 && pid > 1; index++) {
|
|
141
|
+
if (pid === parentPid) return {
|
|
142
|
+
kind: "launchd",
|
|
143
|
+
domain,
|
|
144
|
+
label,
|
|
145
|
+
plist: `${process.env.HOME}/Library/LaunchAgents/${label}.plist`
|
|
146
|
+
};
|
|
147
|
+
const parent = await execute("ps", ["-o", "ppid=", "-p", String(pid)], { timeout: 1e4 });
|
|
148
|
+
pid = Number(parent.stdout.trim());
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
return { kind: "process" };
|
|
153
|
+
}
|
|
154
|
+
async function launchUpgradeWorker(workerPath, planPath, taskName, logPath) {
|
|
155
|
+
if (process.platform === "win32") {
|
|
156
|
+
const args = `"${workerPath}" "${planPath}"`;
|
|
157
|
+
await powershell(`
|
|
158
|
+
$action=New-ScheduledTaskAction -Execute ${quotePowerShell(process.execPath)} -Argument ${quotePowerShell(args)};
|
|
159
|
+
$principal=New-ScheduledTaskPrincipal -UserId ([Security.Principal.WindowsIdentity]::GetCurrent().Name) -LogonType Interactive -RunLevel Limited;
|
|
160
|
+
$settings=New-ScheduledTaskSettingsSet -AllowStartIfOnBatteries -DontStopIfGoingOnBatteries -ExecutionTimeLimit (New-TimeSpan -Minutes 20);
|
|
161
|
+
Register-ScheduledTask -TaskName ${quotePowerShell(taskName)} -Action $action -Principal $principal -Settings $settings | Out-Null;
|
|
162
|
+
try { Start-ScheduledTask -TaskName ${quotePowerShell(taskName)} } catch {
|
|
163
|
+
Unregister-ScheduledTask -TaskName ${quotePowerShell(taskName)} -Confirm:$false; throw
|
|
164
|
+
}
|
|
165
|
+
`);
|
|
166
|
+
} else {
|
|
167
|
+
const output = await open(logPath, "a", 384);
|
|
168
|
+
try {
|
|
169
|
+
const child = spawn(process.execPath, [workerPath, planPath], {
|
|
170
|
+
detached: true,
|
|
171
|
+
stdio: ["ignore", output.fd, output.fd]
|
|
172
|
+
});
|
|
173
|
+
await new Promise((fulfill, reject) => {
|
|
174
|
+
child.once("spawn", fulfill);
|
|
175
|
+
child.once("error", reject);
|
|
176
|
+
});
|
|
177
|
+
child.unref();
|
|
178
|
+
} finally {
|
|
179
|
+
await output.close();
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
// src/upgrade-packages.ts
|
|
185
|
+
import { execFile as execFile2, spawn as spawn2 } from "node:child_process";
|
|
186
|
+
import { createHash as createHash2, timingSafeEqual } from "node:crypto";
|
|
187
|
+
import { access, appendFile, chmod, mkdir, mkdtemp, readFile, readdir, realpath, rm, writeFile } from "node:fs/promises";
|
|
188
|
+
import { delimiter, dirname, isAbsolute, join as join2, resolve as resolve2 } from "node:path";
|
|
189
|
+
var OFFICIAL_NPM_REGISTRY = "https://registry.npmjs.org/";
|
|
190
|
+
var TENCENT_NPM_REGISTRY = "https://mirrors.cloud.tencent.com/npm/";
|
|
191
|
+
var exactVersion = /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+[0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*)?$/;
|
|
192
|
+
var networkFailure = /\b(?:ENOTFOUND|EAI_AGAIN|ECONNRESET|ECONNREFUSED|ETIMEDOUT|ESOCKETTIMEDOUT|EHOSTUNREACH|ENETUNREACH|ECONNABORTED|E408|E429|E5\d\d)\b/i;
|
|
193
|
+
var NpmCommandError = class extends Error {
|
|
194
|
+
constructor(message, exitCode, category) {
|
|
195
|
+
super(message);
|
|
196
|
+
this.exitCode = exitCode;
|
|
197
|
+
this.category = category;
|
|
198
|
+
this.name = "NpmCommandError";
|
|
199
|
+
}
|
|
200
|
+
exitCode;
|
|
201
|
+
category;
|
|
202
|
+
};
|
|
203
|
+
function logHint(options) {
|
|
204
|
+
return options.logPath ? ` See ${options.logPath}.` : " Supply a log path to retain npm diagnostics.";
|
|
205
|
+
}
|
|
206
|
+
function npmJson(text, options) {
|
|
207
|
+
try {
|
|
208
|
+
return JSON.parse(text);
|
|
209
|
+
} catch {
|
|
210
|
+
throw new NpmCommandError(`npm returned invalid package JSON.${logHint(options)}`, null, "invalid-output");
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
function validateVersion(version) {
|
|
214
|
+
if (!exactVersion.test(version)) throw new Error(`Expected an exact semantic version, received ${JSON.stringify(version)}.`);
|
|
215
|
+
}
|
|
216
|
+
function record(value) {
|
|
217
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
218
|
+
}
|
|
219
|
+
function isMissing(error) {
|
|
220
|
+
return record(error) && error.code === "ENOENT";
|
|
221
|
+
}
|
|
222
|
+
function isNetworkFailure(error) {
|
|
223
|
+
if (error instanceof NpmCommandError) return error.category === "network" || error.category === "timeout";
|
|
224
|
+
return error instanceof Error && error.name !== "AbortError" && networkFailure.test(error.message);
|
|
225
|
+
}
|
|
226
|
+
function sha512(integrity) {
|
|
227
|
+
const token = integrity.split(/\s+/).find((part) => /^sha512-[A-Za-z0-9+/]{86}==$/.test(part));
|
|
228
|
+
if (!token) throw new Error("The package registry did not provide a valid SHA512 integrity.");
|
|
229
|
+
const digest = Buffer.from(token.slice(7), "base64");
|
|
230
|
+
if (digest.length !== 64) throw new Error("Invalid package SHA512 integrity.");
|
|
231
|
+
return digest;
|
|
232
|
+
}
|
|
233
|
+
async function verifyArchive(archive, integrity) {
|
|
234
|
+
const actual = createHash2("sha512").update(await readFile(archive)).digest();
|
|
235
|
+
if (!timingSafeEqual(actual, sha512(integrity))) {
|
|
236
|
+
throw new Error(`SHA512 integrity verification failed for ${archive}.`);
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
async function findNpmCli(options) {
|
|
240
|
+
if (options.npmCliPath) return options.npmCliPath;
|
|
241
|
+
const env = { ...process.env, ...options.env };
|
|
242
|
+
const candidates = [join2(dirname(process.execPath), "node_modules", "npm", "bin", "npm-cli.js")];
|
|
243
|
+
if (env.npm_execpath && /(?:^|[/\\])npm-cli\.js$/i.test(env.npm_execpath)) {
|
|
244
|
+
candidates.unshift(env.npm_execpath);
|
|
245
|
+
}
|
|
246
|
+
for (const directory of (env.PATH ?? env.Path ?? "").split(delimiter).filter(Boolean)) {
|
|
247
|
+
candidates.push(join2(directory, "node_modules", "npm", "bin", "npm-cli.js"), join2(directory, "npm"));
|
|
248
|
+
}
|
|
249
|
+
for (const candidate of candidates) {
|
|
250
|
+
try {
|
|
251
|
+
const path = await realpath(candidate);
|
|
252
|
+
if (!path.endsWith("npm-cli.js")) continue;
|
|
253
|
+
await access(path);
|
|
254
|
+
return path;
|
|
255
|
+
} catch (error) {
|
|
256
|
+
if (!isMissing(error) && !(record(error) && error.code === "ENOTDIR")) throw error;
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
throw new Error("Cannot locate npm-cli.js. Install Node.js with npm and make it available on PATH.");
|
|
260
|
+
}
|
|
261
|
+
function redactDiagnostics(text, env) {
|
|
262
|
+
let result = text.replace(/\b(https?:\/\/)[^/@\s]+@/gi, "$1[redacted]@").replace(/\b(Bearer|Basic)\s+[a-zA-Z0-9+/_=.-]+/gi, "$1 [redacted]").replace(/((?:"?(?:_authToken|_auth|password|passwd|access_token|token|authorization)"?)\s*[:=]\s*)(?:"[^"]*"|'[^']*'|[^\s,;]+)/gi, "$1[redacted]").replace(/\bnpm_[a-zA-Z0-9]{20,}\b/g, "[redacted]");
|
|
263
|
+
for (const [name, value] of Object.entries(env)) {
|
|
264
|
+
if (value && /token|secret|password|passwd|auth/i.test(name)) result = result.split(value).join("[redacted]");
|
|
265
|
+
}
|
|
266
|
+
return result;
|
|
267
|
+
}
|
|
268
|
+
async function runCommand(executable, args, options) {
|
|
269
|
+
options.signal?.throwIfAborted();
|
|
270
|
+
const timeoutMs = options.timeoutMs ?? 9e5;
|
|
271
|
+
if (options.commandRunner) return options.commandRunner(executable, args, { ...options, timeoutMs });
|
|
272
|
+
if (options.logPath) await mkdir(dirname(options.logPath), { recursive: true, mode: 448 });
|
|
273
|
+
let output = "";
|
|
274
|
+
let errors = "";
|
|
275
|
+
try {
|
|
276
|
+
return await new Promise((accept, reject) => {
|
|
277
|
+
const child = spawn2(executable, [...args], {
|
|
278
|
+
...options.cwd ? { cwd: options.cwd } : {},
|
|
279
|
+
env: { ...process.env, ...options.env },
|
|
280
|
+
windowsHide: true,
|
|
281
|
+
shell: false,
|
|
282
|
+
detached: process.platform !== "win32",
|
|
283
|
+
stdio: ["ignore", "pipe", "pipe"]
|
|
284
|
+
});
|
|
285
|
+
let failure;
|
|
286
|
+
let terminationComplete;
|
|
287
|
+
let timeout;
|
|
288
|
+
const cleanup = () => {
|
|
289
|
+
clearTimeout(timeout);
|
|
290
|
+
options.signal?.removeEventListener("abort", abort);
|
|
291
|
+
};
|
|
292
|
+
const terminationFailed = () => {
|
|
293
|
+
failure = new NpmCommandError(
|
|
294
|
+
`Could not confirm termination of the complete npm process tree. Staging was retained.${logHint(options)}`,
|
|
295
|
+
null,
|
|
296
|
+
"termination"
|
|
297
|
+
);
|
|
298
|
+
child.kill("SIGKILL");
|
|
299
|
+
child.stdout.destroy();
|
|
300
|
+
child.stderr.destroy();
|
|
301
|
+
cleanup();
|
|
302
|
+
reject(failure);
|
|
303
|
+
};
|
|
304
|
+
const terminate = (error) => {
|
|
305
|
+
if (failure) return;
|
|
306
|
+
failure = error;
|
|
307
|
+
if (!child.pid) return;
|
|
308
|
+
if (process.platform === "win32") {
|
|
309
|
+
terminationComplete = new Promise((complete) => {
|
|
310
|
+
execFile2("taskkill.exe", ["/pid", String(child.pid), "/T", "/F"], { windowsHide: true, timeout: 5e3 }, (killError) => {
|
|
311
|
+
if (killError) terminationFailed();
|
|
312
|
+
complete();
|
|
313
|
+
});
|
|
314
|
+
});
|
|
315
|
+
} else {
|
|
316
|
+
try {
|
|
317
|
+
process.kill(-child.pid, "SIGKILL");
|
|
318
|
+
} catch (killError) {
|
|
319
|
+
if (!(record(killError) && killError.code === "ESRCH")) terminationFailed();
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
};
|
|
323
|
+
timeout = setTimeout(
|
|
324
|
+
() => terminate(new NpmCommandError(
|
|
325
|
+
`ETIMEDOUT: command exceeded ${timeoutMs}ms.${logHint(options)}`,
|
|
326
|
+
null,
|
|
327
|
+
"timeout"
|
|
328
|
+
)),
|
|
329
|
+
timeoutMs
|
|
330
|
+
);
|
|
331
|
+
const abort = () => terminate(options.signal?.reason instanceof NpmCommandError ? options.signal.reason : new DOMException("Upgrade preparation was cancelled.", "AbortError"));
|
|
332
|
+
options.signal?.addEventListener("abort", abort, { once: true });
|
|
333
|
+
if (options.signal?.aborted) abort();
|
|
334
|
+
child.stdout.setEncoding("utf8");
|
|
335
|
+
child.stderr.setEncoding("utf8");
|
|
336
|
+
child.stdout.on("data", (chunk) => {
|
|
337
|
+
output = (output + chunk).slice(-4194304);
|
|
338
|
+
});
|
|
339
|
+
child.stderr.on("data", (chunk) => {
|
|
340
|
+
errors = (errors + chunk).slice(-4194304);
|
|
341
|
+
});
|
|
342
|
+
child.once("error", (error) => {
|
|
343
|
+
cleanup();
|
|
344
|
+
reject(error);
|
|
345
|
+
});
|
|
346
|
+
child.once("close", async (code) => {
|
|
347
|
+
cleanup();
|
|
348
|
+
await terminationComplete;
|
|
349
|
+
if (failure) reject(failure);
|
|
350
|
+
else if (code !== 0) {
|
|
351
|
+
reject(new NpmCommandError(
|
|
352
|
+
`Command failed (exit ${code}).${logHint(options)}`,
|
|
353
|
+
code,
|
|
354
|
+
networkFailure.test(`${errors}
|
|
355
|
+
${output}`) ? "network" : "command"
|
|
356
|
+
));
|
|
357
|
+
} else accept({ stdout: output, stderr: errors });
|
|
358
|
+
});
|
|
359
|
+
});
|
|
360
|
+
} finally {
|
|
361
|
+
if (options.logPath) {
|
|
362
|
+
await appendFile(options.logPath, redactDiagnostics(`${output}
|
|
363
|
+
${errors}
|
|
364
|
+
`, { ...process.env, ...options.env }), { encoding: "utf8", mode: 384 });
|
|
365
|
+
await chmod(options.logPath, 384);
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
async function executeNpm(args, options = {}) {
|
|
370
|
+
return runCommand(process.execPath, [await findNpmCli(options), ...args], options);
|
|
371
|
+
}
|
|
372
|
+
async function runNpm(args, options = {}) {
|
|
373
|
+
try {
|
|
374
|
+
return (await executeNpm(args, options)).stdout.trim();
|
|
375
|
+
} catch (error) {
|
|
376
|
+
if (error instanceof NpmCommandError || error instanceof Error && error.name === "AbortError") throw error;
|
|
377
|
+
throw new NpmCommandError(`Cannot run npm.${logHint(options)}`, null, isNetworkFailure(error) ? "network" : "command");
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
function registryArguments(registry, fetchTimeoutMs = 2e4) {
|
|
381
|
+
if (registry !== OFFICIAL_NPM_REGISTRY && registry !== TENCENT_NPM_REGISTRY) {
|
|
382
|
+
throw new Error(`Unsupported upgrade registry: ${registry}`);
|
|
383
|
+
}
|
|
384
|
+
return ["--registry", registry, `--fetch-timeout=${fetchTimeoutMs}`, "--fetch-retries=0"];
|
|
385
|
+
}
|
|
386
|
+
async function metadata(version, registry, options) {
|
|
387
|
+
const result = await executeNpm([
|
|
388
|
+
"view",
|
|
389
|
+
`@agentknight/client@${version}`,
|
|
390
|
+
"--json",
|
|
391
|
+
"--prefer-online",
|
|
392
|
+
"--offline=false",
|
|
393
|
+
...registryArguments(registry)
|
|
394
|
+
], options);
|
|
395
|
+
const value = npmJson(result.stdout, options);
|
|
396
|
+
if (!record(value) || value.name !== "@agentknight/client" || typeof value.version !== "string" || !record(value.dist) || typeof value.dist.integrity !== "string") {
|
|
397
|
+
throw new Error("The registry returned invalid AgentKnight package metadata.");
|
|
398
|
+
}
|
|
399
|
+
validateVersion(value.version);
|
|
400
|
+
if (version !== "latest" && value.version !== version) throw new Error(`The registry returned ${value.version} instead of ${version}.`);
|
|
401
|
+
sha512(value.dist.integrity);
|
|
402
|
+
return { version: value.version, integrity: value.dist.integrity };
|
|
403
|
+
}
|
|
404
|
+
async function resolveUpgradeVersion(requestedVersion, options = {}) {
|
|
405
|
+
if (requestedVersion !== void 0) validateVersion(requestedVersion);
|
|
406
|
+
try {
|
|
407
|
+
const result = await metadata(requestedVersion ?? "latest", OFFICIAL_NPM_REGISTRY, options);
|
|
408
|
+
return { version: result.version, registry: OFFICIAL_NPM_REGISTRY };
|
|
409
|
+
} catch (error) {
|
|
410
|
+
if (!isNetworkFailure(error)) throw error;
|
|
411
|
+
try {
|
|
412
|
+
const result = await metadata(requestedVersion ?? "latest", TENCENT_NPM_REGISTRY, options);
|
|
413
|
+
return { version: result.version, registry: TENCENT_NPM_REGISTRY };
|
|
414
|
+
} catch (mirrorError) {
|
|
415
|
+
throw new AggregateError([error, mirrorError], `Neither npm nor the Tencent mirror could resolve the upgrade version.${logHint(options)}`, { cause: mirrorError });
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
async function downloadArchive(directory, cache, registry, info, officialIntegrity, options) {
|
|
420
|
+
await mkdir(directory, { recursive: true });
|
|
421
|
+
const result = await executeNpm([
|
|
422
|
+
"pack",
|
|
423
|
+
`@agentknight/client@${info.version}`,
|
|
424
|
+
"--json",
|
|
425
|
+
"--ignore-scripts",
|
|
426
|
+
"--prefer-online",
|
|
427
|
+
"--offline=false",
|
|
428
|
+
"--pack-destination",
|
|
429
|
+
directory,
|
|
430
|
+
"--cache",
|
|
431
|
+
cache,
|
|
432
|
+
...registryArguments(registry, 6e5)
|
|
433
|
+
], options);
|
|
434
|
+
const value = npmJson(result.stdout, options);
|
|
435
|
+
const entry = Array.isArray(value) ? value[0] : void 0;
|
|
436
|
+
if (!record(entry) || typeof entry.filename !== "string" || !/^[a-zA-Z0-9._+-]+\.tgz$/.test(entry.filename)) {
|
|
437
|
+
throw new Error("npm pack did not return a safe package archive filename.");
|
|
438
|
+
}
|
|
439
|
+
const archive = join2(directory, entry.filename);
|
|
440
|
+
await verifyArchive(archive, info.integrity);
|
|
441
|
+
if (officialIntegrity) await verifyArchive(archive, officialIntegrity);
|
|
442
|
+
await writeFile(`${archive}.sha512`, officialIntegrity ?? info.integrity, "utf8");
|
|
443
|
+
return archive;
|
|
444
|
+
}
|
|
445
|
+
async function checkJavaScript(directory, options) {
|
|
446
|
+
let count = 0;
|
|
447
|
+
for (const entry of await readdir(directory, { withFileTypes: true })) {
|
|
448
|
+
const path = join2(directory, entry.name);
|
|
449
|
+
if (entry.isDirectory()) count += await checkJavaScript(path, options);
|
|
450
|
+
else if (entry.isFile() && /\.(?:[cm]?js)$/.test(entry.name)) {
|
|
451
|
+
await runCommand(process.execPath, ["--check", path], options);
|
|
452
|
+
count++;
|
|
453
|
+
}
|
|
454
|
+
}
|
|
455
|
+
return count;
|
|
456
|
+
}
|
|
457
|
+
async function installedDependency(directory, name) {
|
|
458
|
+
if (!/^(?:@[a-z0-9][a-z0-9._-]*\/)?[a-z0-9][a-z0-9._-]*$/i.test(name)) {
|
|
459
|
+
throw new Error(`Invalid dependency name: ${name}`);
|
|
460
|
+
}
|
|
461
|
+
for (const location of [join2(directory, "node_modules", name), join2(dirname(dirname(directory)), name)]) {
|
|
462
|
+
try {
|
|
463
|
+
await access(join2(location, "package.json"));
|
|
464
|
+
return location;
|
|
465
|
+
} catch (error) {
|
|
466
|
+
if (!isMissing(error)) throw error;
|
|
467
|
+
}
|
|
468
|
+
}
|
|
469
|
+
throw new Error(`Required optional/native dependency ${name} is missing from the staged installation.`);
|
|
470
|
+
}
|
|
471
|
+
async function nativePackages(directory) {
|
|
472
|
+
const found = [];
|
|
473
|
+
let entries;
|
|
474
|
+
try {
|
|
475
|
+
entries = await readdir(directory, { withFileTypes: true });
|
|
476
|
+
} catch (error) {
|
|
477
|
+
if (isMissing(error)) return found;
|
|
478
|
+
throw error;
|
|
479
|
+
}
|
|
480
|
+
for (const entry of entries) {
|
|
481
|
+
if (!entry.isDirectory()) continue;
|
|
482
|
+
const location = join2(directory, entry.name);
|
|
483
|
+
if (entry.name.startsWith("@")) found.push(...await nativePackages(location));
|
|
484
|
+
else {
|
|
485
|
+
if (entry.name === "koffi" || entry.name === "sharp") found.push(location);
|
|
486
|
+
found.push(...await nativePackages(join2(location, "node_modules")));
|
|
487
|
+
}
|
|
488
|
+
}
|
|
489
|
+
return found;
|
|
490
|
+
}
|
|
491
|
+
async function validateInstallation(prefix, cache, registry, expectedVersion, options) {
|
|
492
|
+
const directory = globalPackageDirectory(prefix);
|
|
493
|
+
const value = JSON.parse(await readFile(join2(directory, "package.json"), "utf8"));
|
|
494
|
+
if (!record(value) || value.name !== "@agentknight/client" || typeof value.version !== "string") {
|
|
495
|
+
throw new Error("The staged package is not AgentKnight.");
|
|
496
|
+
}
|
|
497
|
+
validateVersion(value.version);
|
|
498
|
+
if (expectedVersion !== void 0 && value.version !== expectedVersion) {
|
|
499
|
+
throw new Error(`Installed ${value.version} instead of ${expectedVersion}.`);
|
|
500
|
+
}
|
|
501
|
+
const optional = value.optionalDependencies;
|
|
502
|
+
if (optional !== void 0 && !record(optional)) throw new Error("Invalid optional dependencies in the staged package.");
|
|
503
|
+
const modules = Object.keys(optional ?? {});
|
|
504
|
+
if (record(value.dependencies) && "sharp" in value.dependencies) modules.push("sharp");
|
|
505
|
+
const modulePaths = await Promise.all(modules.map((name) => installedDependency(directory, name)));
|
|
506
|
+
modulePaths.push(...await nativePackages(join2(directory, "node_modules")));
|
|
507
|
+
await runCommand(process.execPath, [
|
|
508
|
+
"--input-type=module",
|
|
509
|
+
"--eval",
|
|
510
|
+
"import {createRequire} from 'node:module'; import {pathToFileURL} from 'node:url'; import {join} from 'node:path';for(const directory of JSON.parse(process.argv[1])) {const require=createRequire(pathToFileURL(join(directory,'package.json')));await import(pathToFileURL(require.resolve(directory)).href);}",
|
|
511
|
+
JSON.stringify([...new Set(modulePaths)])
|
|
512
|
+
], { ...options, cwd: directory });
|
|
513
|
+
await executeNpm([
|
|
514
|
+
"ls",
|
|
515
|
+
"--all",
|
|
516
|
+
"--offline",
|
|
517
|
+
"--json",
|
|
518
|
+
"--omit=dev",
|
|
519
|
+
"--global=false",
|
|
520
|
+
"--prefix",
|
|
521
|
+
directory,
|
|
522
|
+
"--cache",
|
|
523
|
+
cache,
|
|
524
|
+
...registryArguments(registry)
|
|
525
|
+
], options);
|
|
526
|
+
if (await checkJavaScript(join2(directory, "dist"), options) === 0) {
|
|
527
|
+
throw new Error("The staged package contains no JavaScript in dist.");
|
|
528
|
+
}
|
|
529
|
+
}
|
|
530
|
+
async function install(prefix, archive, cache, registry, offline, version, options) {
|
|
531
|
+
await verifyArchive(archive, await readFile(`${archive}.sha512`, "utf8"));
|
|
532
|
+
const result = await executeNpm([
|
|
533
|
+
"install",
|
|
534
|
+
"--global",
|
|
535
|
+
"--prefix",
|
|
536
|
+
prefix,
|
|
537
|
+
"--cache",
|
|
538
|
+
cache,
|
|
539
|
+
"--include=optional",
|
|
540
|
+
"--omit=dev",
|
|
541
|
+
"--ignore-scripts=false",
|
|
542
|
+
"--no-audit",
|
|
543
|
+
"--no-fund",
|
|
544
|
+
"--package-lock=false",
|
|
545
|
+
"--loglevel=verbose",
|
|
546
|
+
...offline ? ["--offline"] : ["--prefer-online", "--offline=false"],
|
|
547
|
+
...registryArguments(registry, 6e5),
|
|
548
|
+
archive
|
|
549
|
+
], options);
|
|
550
|
+
try {
|
|
551
|
+
await validateInstallation(prefix, cache, registry, version, options);
|
|
552
|
+
} catch (error) {
|
|
553
|
+
if (options.signal?.aborted || error instanceof Error && error.name === "AbortError" || error instanceof NpmCommandError && error.category === "termination") throw error;
|
|
554
|
+
if (!offline && networkFailure.test(`${result.stdout}
|
|
555
|
+
${result.stderr}`)) {
|
|
556
|
+
throw new NpmCommandError(`An optional/native dependency failed its network preparation.${logHint(options)}`, null, "network");
|
|
557
|
+
}
|
|
558
|
+
throw error;
|
|
559
|
+
}
|
|
560
|
+
}
|
|
561
|
+
async function prepareUpgradePackages(options) {
|
|
562
|
+
validateVersion(options.currentVersion);
|
|
563
|
+
validateVersion(options.targetVersion);
|
|
564
|
+
options.signal?.throwIfAborted();
|
|
565
|
+
await mkdir(options.directory, { recursive: true });
|
|
566
|
+
const directory = await mkdtemp(join2(resolve2(options.directory), "packages-"));
|
|
567
|
+
const cacheDirectory = join2(directory, "cache");
|
|
568
|
+
const officialIntegrities = /* @__PURE__ */ new Map();
|
|
569
|
+
const stage = async (registry) => {
|
|
570
|
+
const deadline = Date.now() + 18e5;
|
|
571
|
+
const onlineOptions = {
|
|
572
|
+
...options,
|
|
573
|
+
get timeoutMs() {
|
|
574
|
+
const remaining = deadline - Date.now();
|
|
575
|
+
if (remaining <= 0) throw new NpmCommandError(`ETIMEDOUT: online package preparation exceeded its deadline.${logHint(options)}`, null, "timeout");
|
|
576
|
+
return Math.min(options.timeoutMs ?? 9e5, remaining);
|
|
577
|
+
}
|
|
578
|
+
};
|
|
579
|
+
options.onProgress?.(`Preparing upgrade and rollback from ${registry}`);
|
|
580
|
+
const target = await metadata(options.targetVersion, registry, onlineOptions);
|
|
581
|
+
if (registry === OFFICIAL_NPM_REGISTRY) officialIntegrities.set(target.version, target.integrity);
|
|
582
|
+
const rollback = await metadata(options.currentVersion, registry, onlineOptions);
|
|
583
|
+
if (registry === OFFICIAL_NPM_REGISTRY) officialIntegrities.set(rollback.version, rollback.integrity);
|
|
584
|
+
const targetArchive = await downloadArchive(
|
|
585
|
+
join2(directory, "target"),
|
|
586
|
+
cacheDirectory,
|
|
587
|
+
registry,
|
|
588
|
+
target,
|
|
589
|
+
officialIntegrities.get(target.version),
|
|
590
|
+
onlineOptions
|
|
591
|
+
);
|
|
592
|
+
const rollbackArchive = await downloadArchive(
|
|
593
|
+
join2(directory, "rollback"),
|
|
594
|
+
cacheDirectory,
|
|
595
|
+
registry,
|
|
596
|
+
rollback,
|
|
597
|
+
officialIntegrities.get(rollback.version),
|
|
598
|
+
onlineOptions
|
|
599
|
+
);
|
|
600
|
+
const packages = [
|
|
601
|
+
{ role: "target", archive: targetArchive, version: target.version },
|
|
602
|
+
{ role: "rollback", archive: rollbackArchive, version: rollback.version }
|
|
603
|
+
];
|
|
604
|
+
for (const offline of [false, true]) {
|
|
605
|
+
for (const { role, archive, version } of packages) {
|
|
606
|
+
const prefix = join2(directory, `${role}-${offline ? "offline" : "online"}`);
|
|
607
|
+
options.onProgress?.(`${offline ? "Checking offline" : "Installing in isolation"}: ${role} ${version}`);
|
|
608
|
+
await install(prefix, archive, cacheDirectory, registry, offline, version, offline ? options : onlineOptions);
|
|
609
|
+
try {
|
|
610
|
+
await access(join2(globalPackageDirectory(prefix), "dist", "upgrade-worker.js"));
|
|
611
|
+
} catch (error) {
|
|
612
|
+
if (!isMissing(error)) throw error;
|
|
613
|
+
throw new Error(`Published ${role} ${version} does not support managed upgrades. Install a compatible published release with npm first.`);
|
|
614
|
+
}
|
|
615
|
+
await rm(prefix, { recursive: true, force: true });
|
|
616
|
+
}
|
|
617
|
+
}
|
|
618
|
+
return { targetArchive, rollbackArchive, cacheDirectory, registry };
|
|
619
|
+
};
|
|
620
|
+
try {
|
|
621
|
+
try {
|
|
622
|
+
return await stage(OFFICIAL_NPM_REGISTRY);
|
|
623
|
+
} catch (error) {
|
|
624
|
+
if (!isNetworkFailure(error)) throw error;
|
|
625
|
+
options.onProgress?.("npm is unavailable; retrying the same versions with Tencent");
|
|
626
|
+
for (const name of ["target", "rollback", "target-online", "rollback-online", "target-offline", "rollback-offline"]) {
|
|
627
|
+
await rm(join2(directory, name), { recursive: true, force: true });
|
|
628
|
+
}
|
|
629
|
+
try {
|
|
630
|
+
return await stage(TENCENT_NPM_REGISTRY);
|
|
631
|
+
} catch (mirrorError) {
|
|
632
|
+
throw new AggregateError([error, mirrorError], `Upgrade preparation failed with both registries.${logHint(options)}`, { cause: mirrorError });
|
|
633
|
+
}
|
|
634
|
+
}
|
|
635
|
+
} catch (error) {
|
|
636
|
+
const cause = error instanceof AggregateError ? error.cause : error;
|
|
637
|
+
if (!(cause instanceof NpmCommandError && cause.category === "termination")) {
|
|
638
|
+
await rm(directory, { recursive: true, force: true });
|
|
639
|
+
}
|
|
640
|
+
throw error;
|
|
641
|
+
}
|
|
642
|
+
}
|
|
643
|
+
|
|
644
|
+
// src/upgrade-startup.ts
|
|
645
|
+
import { rename, rm as rm2 } from "node:fs/promises";
|
|
646
|
+
import { basename, dirname as dirname2, join as join3, resolve as resolve3 } from "node:path";
|
|
647
|
+
import { z as z2 } from "zod";
|
|
648
|
+
var PermitSchema = z2.object({ id: z2.uuid(), version: z2.string(), cliPath: z2.string() });
|
|
649
|
+
function globalUpgradeLockPath(cliPath) {
|
|
650
|
+
const packageDirectory = dirname2(dirname2(cliPath));
|
|
651
|
+
const scope = dirname2(packageDirectory);
|
|
652
|
+
const modules = dirname2(scope);
|
|
653
|
+
if (basename(packageDirectory) !== "client" || basename(scope) !== "@agentknight" || basename(modules) !== "node_modules") return void 0;
|
|
654
|
+
const parent = dirname2(modules);
|
|
655
|
+
return join3(process.platform === "win32" ? parent : dirname2(parent), ".agentknight-upgrade.json");
|
|
656
|
+
}
|
|
657
|
+
async function claimUpgradeStartup(directory, version, cliPath) {
|
|
658
|
+
const lock = await readOptionalJson(join3(directory, "upgrades", "upgrade.lock"));
|
|
659
|
+
const globalPath = globalUpgradeLockPath(cliPath);
|
|
660
|
+
const globalLock = globalPath === void 0 ? void 0 : await readOptionalJson(globalPath);
|
|
661
|
+
if (globalLock !== void 0) {
|
|
662
|
+
const globalOwner = z2.object({ id: z2.uuid(), dataDirectory: z2.string() }).parse(globalLock);
|
|
663
|
+
if (lock === void 0 || resolve3(globalOwner.dataDirectory) !== resolve3(directory)) {
|
|
664
|
+
throw new Error("This global installation is being upgraded for another data directory. Wait for that upgrade to finish.");
|
|
665
|
+
}
|
|
666
|
+
}
|
|
667
|
+
if (lock === void 0) return void 0;
|
|
668
|
+
const owner = z2.object({ id: z2.uuid() }).parse(lock);
|
|
669
|
+
if (globalLock !== void 0 && z2.object({ id: z2.uuid() }).parse(globalLock).id !== owner.id) {
|
|
670
|
+
throw new Error("Local and global upgrade ownership disagree; inspect the interrupted upgrade before starting.");
|
|
671
|
+
}
|
|
672
|
+
const path = join3(directory, "run", "upgrade-start.json");
|
|
673
|
+
const value = await readOptionalJson(path);
|
|
674
|
+
if (value === void 0) throw new Error("An upgrade owns this installation. Use agentknight status and wait for it to finish.");
|
|
675
|
+
const permit = PermitSchema.parse(value);
|
|
676
|
+
if (permit.id !== owner.id || permit.version !== version || resolve3(permit.cliPath) !== resolve3(cliPath)) {
|
|
677
|
+
throw new Error("This startup does not match the prepared upgrade.");
|
|
678
|
+
}
|
|
679
|
+
const claimed = `${path}.${process.pid}`;
|
|
680
|
+
await rename(path, claimed);
|
|
681
|
+
await rm2(claimed);
|
|
682
|
+
return permit.id;
|
|
683
|
+
}
|
|
684
|
+
|
|
685
|
+
// src/upgrade-job.ts
|
|
686
|
+
import { mkdir as mkdir2, readFile as readFile2, rm as rm3, stat } from "node:fs/promises";
|
|
687
|
+
import { createHash as createHash3 } from "node:crypto";
|
|
688
|
+
import { join as join4, resolve as resolve4 } from "node:path";
|
|
689
|
+
import { z as z3 } from "zod";
|
|
690
|
+
var PreparedPackagesSchema = z3.object({
|
|
691
|
+
targetArchive: z3.string(),
|
|
692
|
+
rollbackArchive: z3.string(),
|
|
693
|
+
cacheDirectory: z3.string(),
|
|
694
|
+
registry: z3.string().url()
|
|
695
|
+
});
|
|
696
|
+
var UpgradePlanSchema = z3.object({
|
|
697
|
+
id: z3.uuid(),
|
|
698
|
+
dataDirectory: z3.string(),
|
|
699
|
+
directory: z3.string(),
|
|
700
|
+
prefix: z3.string(),
|
|
701
|
+
currentVersion: z3.string(),
|
|
702
|
+
targetVersion: z3.string(),
|
|
703
|
+
packages: PreparedPackagesSchema,
|
|
704
|
+
runtime: RuntimeStatusSchema.optional(),
|
|
705
|
+
supervisor: SupervisorSchema,
|
|
706
|
+
taskName: z3.string(),
|
|
707
|
+
configHash: z3.string().optional()
|
|
708
|
+
});
|
|
709
|
+
async function fileHash(path) {
|
|
710
|
+
return createHash3("sha256").update(await readFile2(path)).digest("hex");
|
|
711
|
+
}
|
|
712
|
+
async function updateJobState(plan, phase, error) {
|
|
713
|
+
await writePrivateJson(join4(plan.dataDirectory, "upgrades", "status.json"), {
|
|
714
|
+
id: plan.id,
|
|
715
|
+
phase,
|
|
716
|
+
fromVersion: plan.currentVersion,
|
|
717
|
+
toVersion: plan.targetVersion,
|
|
718
|
+
updatedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
719
|
+
...error === void 0 ? {} : { error }
|
|
720
|
+
});
|
|
721
|
+
}
|
|
722
|
+
|
|
723
|
+
export {
|
|
724
|
+
restartEnvironment,
|
|
725
|
+
globalPackageDirectory,
|
|
726
|
+
assertInstallationIdle,
|
|
727
|
+
detectSupervisor,
|
|
728
|
+
launchUpgradeWorker,
|
|
729
|
+
runNpm,
|
|
730
|
+
resolveUpgradeVersion,
|
|
731
|
+
prepareUpgradePackages,
|
|
732
|
+
claimUpgradeStartup,
|
|
733
|
+
fileHash,
|
|
734
|
+
updateJobState
|
|
735
|
+
};
|