agent-transport-system 0.7.9 → 0.7.11
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/ats.js +252 -379
- package/dist/ats.js.map +1 -1
- package/package.json +1 -1
- package/skills/ats-cli/SKILL.md +8 -4
- package/skills/ats-cli/playbooks/agent-onboarding.md +4 -0
package/dist/ats.js
CHANGED
|
@@ -27,7 +27,7 @@ import wrapAnsi from "wrap-ansi";
|
|
|
27
27
|
import { Box, Container, Editor, Key, ProcessTerminal, TUI, Text, getEditorKeybindings, matchesKey } from "@mariozechner/pi-tui";
|
|
28
28
|
|
|
29
29
|
//#region package.json
|
|
30
|
-
var version = "0.7.
|
|
30
|
+
var version = "0.7.11";
|
|
31
31
|
var package_default = {
|
|
32
32
|
$schema: "https://www.schemastore.org/package.json",
|
|
33
33
|
name: "agent-transport-system",
|
|
@@ -3811,7 +3811,7 @@ async function requestLatestPackageVersion(packageName) {
|
|
|
3811
3811
|
if (!version) throw new Error("missing version");
|
|
3812
3812
|
return version;
|
|
3813
3813
|
} catch (error) {
|
|
3814
|
-
throw new Error(`version check failed: invalid registry response: ${toErrorMessage$
|
|
3814
|
+
throw new Error(`version check failed: invalid registry response: ${toErrorMessage$38(error)}`);
|
|
3815
3815
|
}
|
|
3816
3816
|
}
|
|
3817
3817
|
function compareSemver(a, b) {
|
|
@@ -3876,7 +3876,7 @@ function toNonEmptyString(value) {
|
|
|
3876
3876
|
const normalized = value.trim();
|
|
3877
3877
|
return normalized.length > 0 ? normalized : null;
|
|
3878
3878
|
}
|
|
3879
|
-
function toErrorMessage$
|
|
3879
|
+
function toErrorMessage$38(error) {
|
|
3880
3880
|
if (error instanceof Error) return error.message;
|
|
3881
3881
|
return String(error);
|
|
3882
3882
|
}
|
|
@@ -5068,7 +5068,7 @@ async function storeAccessToken(input) {
|
|
|
5068
5068
|
key
|
|
5069
5069
|
};
|
|
5070
5070
|
}
|
|
5071
|
-
throw new Error(`failed to store access token in macOS Keychain: ${toErrorMessage$
|
|
5071
|
+
throw new Error(`failed to store access token in macOS Keychain: ${toErrorMessage$37(error)}`);
|
|
5072
5072
|
}
|
|
5073
5073
|
if (process.platform === "win32") try {
|
|
5074
5074
|
await setWindowsDpapiToken({
|
|
@@ -5090,7 +5090,7 @@ async function storeAccessToken(input) {
|
|
|
5090
5090
|
key
|
|
5091
5091
|
};
|
|
5092
5092
|
}
|
|
5093
|
-
throw new Error(`failed to store access token via Windows DPAPI: ${toErrorMessage$
|
|
5093
|
+
throw new Error(`failed to store access token via Windows DPAPI: ${toErrorMessage$37(error)}`);
|
|
5094
5094
|
}
|
|
5095
5095
|
if (allowInsecureFallback()) {
|
|
5096
5096
|
await setInsecureFileToken({
|
|
@@ -5342,7 +5342,7 @@ function normalizeToken(value) {
|
|
|
5342
5342
|
const normalized = value.trim();
|
|
5343
5343
|
return normalized.length > 0 ? normalized : null;
|
|
5344
5344
|
}
|
|
5345
|
-
function toErrorMessage$
|
|
5345
|
+
function toErrorMessage$37(error) {
|
|
5346
5346
|
if (error instanceof Error) return error.message;
|
|
5347
5347
|
return String(error);
|
|
5348
5348
|
}
|
|
@@ -8246,10 +8246,30 @@ function safeParseJson$1(raw) {
|
|
|
8246
8246
|
}
|
|
8247
8247
|
}
|
|
8248
8248
|
|
|
8249
|
+
//#endregion
|
|
8250
|
+
//#region src/config/published-production-safety.ts
|
|
8251
|
+
const PUBLISHED_PRODUCTION_ATS_ROOT = normalizeComparablePath(join(homedir(), resolveDefaultAtsHomeDirname("prod")));
|
|
8252
|
+
function assertNoPublishedProductionMutationDuringTests(pathInput, targetName) {
|
|
8253
|
+
if (!isTestProcess(pathInput)) return;
|
|
8254
|
+
if (!isPublishedProductionAtsRoot(pathInput)) return;
|
|
8255
|
+
throw new Error([`Refusing to mutate ${targetName} in the published production lane during tests.`, "Set ATS_HOME to a fresh temporary directory, or run the validation through ats-dev or ats-canary."].join(" "));
|
|
8256
|
+
}
|
|
8257
|
+
function isPublishedProductionAtsRoot(pathInput) {
|
|
8258
|
+
return normalizeComparablePath(resolveAtsRootDir(pathInput)) === PUBLISHED_PRODUCTION_ATS_ROOT;
|
|
8259
|
+
}
|
|
8260
|
+
function isTestProcess(pathInput = {}) {
|
|
8261
|
+
const env = pathInput.env ?? process.env;
|
|
8262
|
+
const argv = pathInput.argv ?? process.argv;
|
|
8263
|
+
return env.NODE_ENV === "test" || env.VITEST === "true" || typeof env.VITEST_WORKER_ID === "string" || typeof env.JEST_WORKER_ID === "string" || argv.some((arg) => arg.includes("vitest"));
|
|
8264
|
+
}
|
|
8265
|
+
function normalizeComparablePath(path) {
|
|
8266
|
+
const normalized = resolve(path);
|
|
8267
|
+
return process.platform === "win32" ? normalized.toLowerCase() : normalized;
|
|
8268
|
+
}
|
|
8269
|
+
|
|
8249
8270
|
//#endregion
|
|
8250
8271
|
//#region src/config/daemon-service-contract.ts
|
|
8251
8272
|
const DAEMON_SERVICE_CONTRACT_FILENAME = "service-contract.json";
|
|
8252
|
-
const PUBLISHED_PRODUCTION_ATS_ROOT = normalizeComparablePath(join(homedir(), resolveDefaultAtsHomeDirname("prod")));
|
|
8253
8273
|
function daemonServiceContractPath(pathInput = {}) {
|
|
8254
8274
|
return join(daemonRuntimeStateRootPath(pathInput), DAEMON_SERVICE_CONTRACT_FILENAME);
|
|
8255
8275
|
}
|
|
@@ -8283,13 +8303,11 @@ async function clearDaemonServiceContract(pathInput = {}) {
|
|
|
8283
8303
|
await rm(daemonServiceContractPath(pathInput), { force: true });
|
|
8284
8304
|
}
|
|
8285
8305
|
function assertDaemonServiceContractMutationAllowed(pathInput) {
|
|
8286
|
-
|
|
8287
|
-
if (!isPublishedProductionAtsRoot(pathInput)) return;
|
|
8288
|
-
throw new Error(["Refusing to mutate ATS Service contract in the published production lane during tests.", "Set ATS_HOME to a fresh temporary directory, or run the validation through ats-dev or ats-canary."].join(" "));
|
|
8306
|
+
assertNoPublishedProductionMutationDuringTests(pathInput, "ATS Service contract");
|
|
8289
8307
|
}
|
|
8290
8308
|
function assertDaemonServiceContractIdentityAllowed(candidate, pathInput) {
|
|
8291
|
-
if (!isPublishedProductionAtsRoot(pathInput)) return;
|
|
8292
8309
|
if (!isUnsafeProductionDaemonServiceContractIdentity(candidate)) return;
|
|
8310
|
+
if (isTestProcess(pathInput) && !isPublishedProductionAtsRoot(pathInput)) return;
|
|
8293
8311
|
throw new Error(["Refusing to write ATS Service contract with a test fixture identity in the published production lane.", "Run `ats service repair --profile <profile-id>` from the signed-in production lane, or clear the polluted local service state before retrying."].join(" "));
|
|
8294
8312
|
}
|
|
8295
8313
|
function isDaemonServiceContractIdentityReusable(contract, pathInput = {}) {
|
|
@@ -8317,16 +8335,6 @@ const UNSAFE_PRODUCTION_PROFILE_IDS = new Set([
|
|
|
8317
8335
|
function normalizeFixtureText(value) {
|
|
8318
8336
|
return value.trim().toLowerCase();
|
|
8319
8337
|
}
|
|
8320
|
-
function isPublishedProductionAtsRoot(pathInput) {
|
|
8321
|
-
return normalizeComparablePath(resolveAtsRootDir(pathInput)) === PUBLISHED_PRODUCTION_ATS_ROOT;
|
|
8322
|
-
}
|
|
8323
|
-
function isTestProcess(env = process.env) {
|
|
8324
|
-
return env.NODE_ENV === "test" || env.VITEST === "true" || typeof env.VITEST_WORKER_ID === "string" || typeof env.JEST_WORKER_ID === "string" || process.argv.some((arg) => arg.includes("vitest"));
|
|
8325
|
-
}
|
|
8326
|
-
function normalizeComparablePath(path) {
|
|
8327
|
-
const normalized = resolve(path);
|
|
8328
|
-
return process.platform === "win32" ? normalized.toLowerCase() : normalized;
|
|
8329
|
-
}
|
|
8330
8338
|
function buildContractCandidate(input, pathInput, current) {
|
|
8331
8339
|
const lane = input.lane ?? resolveAtsEnvPreset(pathInput);
|
|
8332
8340
|
const connectedComputerId = input.connectedComputerId ?? (current && current.lane === lane && current.gatewayUrl === input.gatewayUrl && current.profileId === input.profileId && current.deviceId === input.deviceId ? current.connectedComputerId : void 0);
|
|
@@ -8450,11 +8458,11 @@ function normalizeOptionalText$46(value) {
|
|
|
8450
8458
|
function nowIsoString() {
|
|
8451
8459
|
return (/* @__PURE__ */ new Date()).toISOString();
|
|
8452
8460
|
}
|
|
8453
|
-
function toErrorMessage$
|
|
8461
|
+
function toErrorMessage$36(error) {
|
|
8454
8462
|
if (error instanceof Error) return error.message;
|
|
8455
8463
|
return String(error);
|
|
8456
8464
|
}
|
|
8457
|
-
function sleep$
|
|
8465
|
+
function sleep$9(delayMs) {
|
|
8458
8466
|
return new Promise((resolve) => {
|
|
8459
8467
|
setTimeout(() => {
|
|
8460
8468
|
resolve();
|
|
@@ -9793,6 +9801,7 @@ async function resolveDaemonLifecycleAttribution(input) {
|
|
|
9793
9801
|
};
|
|
9794
9802
|
}
|
|
9795
9803
|
async function emitDaemonLifecycleEvent(input) {
|
|
9804
|
+
assertNoPublishedProductionMutationDuringTests(input.pathInput ?? {}, "ATS Service lifecycle journal");
|
|
9796
9805
|
const journalPath = daemonLifecycleJournalPath(input.pathInput);
|
|
9797
9806
|
const attribution = await resolveDaemonLifecycleAttribution(input);
|
|
9798
9807
|
const event = {
|
|
@@ -10115,7 +10124,7 @@ async function pathExists$4(path) {
|
|
|
10115
10124
|
throw error;
|
|
10116
10125
|
}
|
|
10117
10126
|
}
|
|
10118
|
-
async function sleep$
|
|
10127
|
+
async function sleep$8(ms) {
|
|
10119
10128
|
await new Promise((resolve) => setTimeout(resolve, ms));
|
|
10120
10129
|
}
|
|
10121
10130
|
function buildSystemServiceWaitTimeoutError(input) {
|
|
@@ -10127,7 +10136,7 @@ async function waitForCondition(input) {
|
|
|
10127
10136
|
const pollMs = input.pollMs ?? SYSTEM_SERVICE_POLL_MS;
|
|
10128
10137
|
while (Date.now() < deadline) {
|
|
10129
10138
|
if (await input.until()) return;
|
|
10130
|
-
await sleep$
|
|
10139
|
+
await sleep$8(pollMs);
|
|
10131
10140
|
}
|
|
10132
10141
|
throw await input.onTimeout();
|
|
10133
10142
|
}
|
|
@@ -11348,7 +11357,7 @@ const backupAndCleanRuntimeState = async (input) => {
|
|
|
11348
11357
|
appliedAt: input.nowIso,
|
|
11349
11358
|
backupPaths,
|
|
11350
11359
|
cleanedPaths,
|
|
11351
|
-
errorMessage: toErrorMessage$
|
|
11360
|
+
errorMessage: toErrorMessage$36(error),
|
|
11352
11361
|
fromEpoch: input.fromEpoch,
|
|
11353
11362
|
reason: input.reason,
|
|
11354
11363
|
status: "failed",
|
|
@@ -12195,7 +12204,7 @@ function createSpaceRequestTimeoutError(input) {
|
|
|
12195
12204
|
return error;
|
|
12196
12205
|
}
|
|
12197
12206
|
function createSpaceRequestNetworkError(input) {
|
|
12198
|
-
const error = new Error(`${input.operation} request could not reach ${describeRequestTarget(input.url)} (${toErrorMessage$
|
|
12207
|
+
const error = new Error(`${input.operation} request could not reach ${describeRequestTarget(input.url)} (${toErrorMessage$35(input.cause)})`, { cause: input.cause });
|
|
12199
12208
|
error.code = "network.request_failed";
|
|
12200
12209
|
return error;
|
|
12201
12210
|
}
|
|
@@ -12233,7 +12242,7 @@ function describeRequestTarget(url) {
|
|
|
12233
12242
|
return url;
|
|
12234
12243
|
}
|
|
12235
12244
|
}
|
|
12236
|
-
function toErrorMessage$
|
|
12245
|
+
function toErrorMessage$35(error) {
|
|
12237
12246
|
if (error instanceof Error) {
|
|
12238
12247
|
const message = error.message.trim();
|
|
12239
12248
|
return message.length > 0 ? message : "request failed";
|
|
@@ -12243,7 +12252,7 @@ function toErrorMessage$37(error) {
|
|
|
12243
12252
|
}
|
|
12244
12253
|
function shouldWrapNetworkRequestError(error) {
|
|
12245
12254
|
if (error instanceof TypeError) return true;
|
|
12246
|
-
const message = toErrorMessage$
|
|
12255
|
+
const message = toErrorMessage$35(error).toLowerCase();
|
|
12247
12256
|
return message.includes("fetch failed") || message.includes("failed to fetch") || message.includes("network request failed");
|
|
12248
12257
|
}
|
|
12249
12258
|
|
|
@@ -12306,7 +12315,7 @@ function normalizeProfileIdList(value) {
|
|
|
12306
12315
|
if (!Array.isArray(value)) return [];
|
|
12307
12316
|
return value.map((item) => normalize$1(item)).filter((item) => item.length > 0);
|
|
12308
12317
|
}
|
|
12309
|
-
function toErrorMessage$
|
|
12318
|
+
function toErrorMessage$34(err) {
|
|
12310
12319
|
if (err instanceof Error) return err.message;
|
|
12311
12320
|
return String(err);
|
|
12312
12321
|
}
|
|
@@ -13690,7 +13699,7 @@ async function verifyLaunchContractFiles(input) {
|
|
|
13690
13699
|
};
|
|
13691
13700
|
} catch (error) {
|
|
13692
13701
|
return {
|
|
13693
|
-
errorMessage: toErrorMessage$
|
|
13702
|
+
errorMessage: toErrorMessage$33(error),
|
|
13694
13703
|
ok: false
|
|
13695
13704
|
};
|
|
13696
13705
|
}
|
|
@@ -13717,7 +13726,7 @@ async function verifyCliLaunchContract(input) {
|
|
|
13717
13726
|
return fileCheck;
|
|
13718
13727
|
} catch (error) {
|
|
13719
13728
|
return {
|
|
13720
|
-
errorMessage: `${input.displayName} can't start on this device: ${toErrorMessage$
|
|
13729
|
+
errorMessage: `${input.displayName} can't start on this device: ${toErrorMessage$33(error)}`,
|
|
13721
13730
|
ok: false
|
|
13722
13731
|
};
|
|
13723
13732
|
}
|
|
@@ -13778,7 +13787,7 @@ async function inspectInstalledNodeScriptLaunchCandidate(input) {
|
|
|
13778
13787
|
};
|
|
13779
13788
|
} catch (error) {
|
|
13780
13789
|
return {
|
|
13781
|
-
errorMessage: `${input.displayName} is installed, but ATS could not inspect its launch files: ${toErrorMessage$
|
|
13790
|
+
errorMessage: `${input.displayName} is installed, but ATS could not inspect its launch files: ${toErrorMessage$33(error)}`,
|
|
13782
13791
|
ok: false
|
|
13783
13792
|
};
|
|
13784
13793
|
}
|
|
@@ -13975,7 +13984,7 @@ function shortenPathForDisplay(path) {
|
|
|
13975
13984
|
function resolveNodeVersionFromPath(path) {
|
|
13976
13985
|
return normalizeOptionalText$40(path.match(NODE_VERSION_PATH_RE)?.[1]);
|
|
13977
13986
|
}
|
|
13978
|
-
function toErrorMessage$
|
|
13987
|
+
function toErrorMessage$33(error) {
|
|
13979
13988
|
return error instanceof Error ? error.message : String(error);
|
|
13980
13989
|
}
|
|
13981
13990
|
|
|
@@ -14984,7 +14993,7 @@ async function invokeOpenClawWithSingleContextHeal(input) {
|
|
|
14984
14993
|
createRebuildFailedError: (error) => new OpenClawRuntimeError({
|
|
14985
14994
|
code: "context.rebuild_failed",
|
|
14986
14995
|
errorType: "adapter",
|
|
14987
|
-
message: `context.rebuild_failed: ${toErrorMessage$
|
|
14996
|
+
message: `context.rebuild_failed: ${toErrorMessage$32(error)}`
|
|
14988
14997
|
}),
|
|
14989
14998
|
invokeOnce: (sessionId) => invokeOpenClawOnce({
|
|
14990
14999
|
openClawAgentId: input.openClawAgentId,
|
|
@@ -15035,11 +15044,11 @@ async function invokeOpenClawOnce(input) {
|
|
|
15035
15044
|
throw new OpenClawRuntimeError({
|
|
15036
15045
|
code: "upstream_unreachable",
|
|
15037
15046
|
errorType: "adapter",
|
|
15038
|
-
message: `upstream_unreachable: ${toErrorMessage$
|
|
15047
|
+
message: `upstream_unreachable: ${toErrorMessage$32(error)}`
|
|
15039
15048
|
});
|
|
15040
15049
|
}
|
|
15041
15050
|
}
|
|
15042
|
-
function toErrorMessage$
|
|
15051
|
+
function toErrorMessage$32(error) {
|
|
15043
15052
|
if (error instanceof Error) return error.message;
|
|
15044
15053
|
return String(error);
|
|
15045
15054
|
}
|
|
@@ -15332,7 +15341,7 @@ function toOpenClawGatewayTransportError(error) {
|
|
|
15332
15341
|
});
|
|
15333
15342
|
const stderr = normalizeOptionalText$32(error?.stderr);
|
|
15334
15343
|
const stdout = normalizeOptionalText$32(error?.stdout);
|
|
15335
|
-
return classifyGatewayFailure(stderr ?? stdout ?? toErrorMessage$
|
|
15344
|
+
return classifyGatewayFailure(stderr ?? stdout ?? toErrorMessage$31(error));
|
|
15336
15345
|
}
|
|
15337
15346
|
function classifyGatewayFailure(message) {
|
|
15338
15347
|
return new OpenClawGatewayTransportError(classifyOpenClawFailureMessage({ message }));
|
|
@@ -15341,7 +15350,7 @@ function normalizeOptionalText$32(value) {
|
|
|
15341
15350
|
const normalized = String(value ?? "").trim();
|
|
15342
15351
|
return normalized.length > 0 ? normalized : null;
|
|
15343
15352
|
}
|
|
15344
|
-
function toErrorMessage$
|
|
15353
|
+
function toErrorMessage$31(error) {
|
|
15345
15354
|
return error instanceof Error ? error.message : String(error);
|
|
15346
15355
|
}
|
|
15347
15356
|
|
|
@@ -15613,7 +15622,7 @@ async function runOpenClawJsonCommand(input) {
|
|
|
15613
15622
|
try {
|
|
15614
15623
|
return JSON.parse(stdout);
|
|
15615
15624
|
} catch (error) {
|
|
15616
|
-
throw new Error(`openclaw JSON output could not be parsed: ${toErrorMessage$
|
|
15625
|
+
throw new Error(`openclaw JSON output could not be parsed: ${toErrorMessage$30(error)}`);
|
|
15617
15626
|
}
|
|
15618
15627
|
}
|
|
15619
15628
|
async function runOpenClawCommand(input) {
|
|
@@ -15648,7 +15657,7 @@ function normalizeOptionalText$30(value) {
|
|
|
15648
15657
|
const normalized = String(value ?? "").trim();
|
|
15649
15658
|
return normalized.length > 0 ? normalized : null;
|
|
15650
15659
|
}
|
|
15651
|
-
function toErrorMessage$
|
|
15660
|
+
function toErrorMessage$30(error) {
|
|
15652
15661
|
return error instanceof Error ? error.message : String(error);
|
|
15653
15662
|
}
|
|
15654
15663
|
function isExecFileTimeoutError(error) {
|
|
@@ -15662,7 +15671,7 @@ function resolveOpenClawCliErrorMessage(error, timeoutMs) {
|
|
|
15662
15671
|
const cliMessage = normalizeOptionalText$30(error.stderr) ?? stdout;
|
|
15663
15672
|
if (timeoutMs !== void 0 && isExecFileTimeoutError(error)) return cliMessage ? `openclaw command timed out after ${String(timeoutMs)}ms: ${cliMessage}` : `openclaw command timed out after ${String(timeoutMs)}ms`;
|
|
15664
15673
|
if (cliMessage) return cliMessage;
|
|
15665
|
-
return `openclaw command failed: ${toErrorMessage$
|
|
15674
|
+
return `openclaw command failed: ${toErrorMessage$30(error)}`;
|
|
15666
15675
|
}
|
|
15667
15676
|
function parseOpenClawAgentSummary(value) {
|
|
15668
15677
|
if (!value || typeof value !== "object") return null;
|
|
@@ -16043,7 +16052,7 @@ async function ensureOpenClawGatewayAgentVisible(input, deps = DEFAULT_OPENCLAW_
|
|
|
16043
16052
|
gatewayRestartAttempted: true,
|
|
16044
16053
|
gatewayVisibility: "missing_before_restart"
|
|
16045
16054
|
},
|
|
16046
|
-
message: `OpenClaw gateway restart failed while making agent '${agentId}' visible: ${toErrorMessage$
|
|
16055
|
+
message: `OpenClaw gateway restart failed while making agent '${agentId}' visible: ${toErrorMessage$29(error)}`
|
|
16047
16056
|
});
|
|
16048
16057
|
}
|
|
16049
16058
|
let lastVisibilityError = null;
|
|
@@ -16072,7 +16081,7 @@ async function ensureOpenClawGatewayAgentVisible(input, deps = DEFAULT_OPENCLAW_
|
|
|
16072
16081
|
gatewayRestartAttempted: true,
|
|
16073
16082
|
gatewayVisibility: "missing_after_restart"
|
|
16074
16083
|
},
|
|
16075
|
-
message: lastVisibilityError === null ? `OpenClaw gateway is running but agent '${agentId}' is still not visible after a gateway restart` : `OpenClaw gateway still cannot confirm agent '${agentId}' after a gateway restart: ${toErrorMessage$
|
|
16084
|
+
message: lastVisibilityError === null ? `OpenClaw gateway is running but agent '${agentId}' is still not visible after a gateway restart` : `OpenClaw gateway still cannot confirm agent '${agentId}' after a gateway restart: ${toErrorMessage$29(lastVisibilityError)}`
|
|
16076
16085
|
});
|
|
16077
16086
|
}
|
|
16078
16087
|
async function maybeCopyOpenClawAuth(input) {
|
|
@@ -16113,7 +16122,7 @@ async function ensureParentDirectory(path) {
|
|
|
16113
16122
|
async function pathExists$2(path) {
|
|
16114
16123
|
return await access(path, constants.F_OK).then(() => true).catch(() => false);
|
|
16115
16124
|
}
|
|
16116
|
-
function toErrorMessage$
|
|
16125
|
+
function toErrorMessage$29(error) {
|
|
16117
16126
|
return error instanceof Error ? error.message : String(error);
|
|
16118
16127
|
}
|
|
16119
16128
|
function normalizeBootstrapReadError(error) {
|
|
@@ -16232,7 +16241,7 @@ function assertOpenClawWorkspaceMatch(input) {
|
|
|
16232
16241
|
});
|
|
16233
16242
|
}
|
|
16234
16243
|
function isOpenClawAgentAlreadyExistsError(error) {
|
|
16235
|
-
const normalizedMessage = toErrorMessage$
|
|
16244
|
+
const normalizedMessage = toErrorMessage$29(error).toLowerCase();
|
|
16236
16245
|
return normalizedMessage.includes("agent") && normalizedMessage.includes("already exists");
|
|
16237
16246
|
}
|
|
16238
16247
|
function resolveProviderRuntimeWorkingDirectory(value) {
|
|
@@ -16270,7 +16279,7 @@ async function prepareOpenClawRuntime(input, deps = DEFAULT_OPENCLAW_RUNTIME_PRE
|
|
|
16270
16279
|
}).catch((error) => {
|
|
16271
16280
|
throw new DaemonServiceRunError({
|
|
16272
16281
|
code: "controller.bootstrap.failed",
|
|
16273
|
-
message: `controller.bootstrap.failed: ${toErrorMessage$
|
|
16282
|
+
message: `controller.bootstrap.failed: ${toErrorMessage$28(error)}`,
|
|
16274
16283
|
providerErrorCode: extractErrorCode$1(error)
|
|
16275
16284
|
});
|
|
16276
16285
|
});
|
|
@@ -16280,7 +16289,7 @@ async function prepareOpenClawRuntime(input, deps = DEFAULT_OPENCLAW_RUNTIME_PRE
|
|
|
16280
16289
|
}).catch((error) => {
|
|
16281
16290
|
throw new DaemonServiceRunError({
|
|
16282
16291
|
code: "controller.gateway.unhealthy",
|
|
16283
|
-
message: `controller.gateway.unhealthy: ${toErrorMessage$
|
|
16292
|
+
message: `controller.gateway.unhealthy: ${toErrorMessage$28(error)}`,
|
|
16284
16293
|
providerErrorCode: extractErrorCode$1(error)
|
|
16285
16294
|
});
|
|
16286
16295
|
});
|
|
@@ -16292,7 +16301,7 @@ async function prepareOpenClawRuntime(input, deps = DEFAULT_OPENCLAW_RUNTIME_PRE
|
|
|
16292
16301
|
const gatewayFailure = buildOpenClawGatewayVisibilityFailure(error);
|
|
16293
16302
|
throw new DaemonServiceRunError({
|
|
16294
16303
|
code: "controller.gateway.unhealthy",
|
|
16295
|
-
message: `controller.gateway.unhealthy: ${toErrorMessage$
|
|
16304
|
+
message: `controller.gateway.unhealthy: ${toErrorMessage$28(error)}`,
|
|
16296
16305
|
providerErrorCode: extractErrorCode$1(error),
|
|
16297
16306
|
...gatewayFailure
|
|
16298
16307
|
});
|
|
@@ -16331,7 +16340,7 @@ function resolveOpenClawGatewayVisibilityDiagnostics(error) {
|
|
|
16331
16340
|
gatewayVisibility: parsedGatewayVisibility.data
|
|
16332
16341
|
};
|
|
16333
16342
|
}
|
|
16334
|
-
function toErrorMessage$
|
|
16343
|
+
function toErrorMessage$28(error) {
|
|
16335
16344
|
return error instanceof Error ? error.message : String(error);
|
|
16336
16345
|
}
|
|
16337
16346
|
|
|
@@ -16381,7 +16390,7 @@ function createOpenClawLocalDiagnosticsFailure(error) {
|
|
|
16381
16390
|
return {
|
|
16382
16391
|
errorCode: extractErrorCode(error),
|
|
16383
16392
|
kind: "failed",
|
|
16384
|
-
message: toErrorMessage$
|
|
16393
|
+
message: toErrorMessage$27(error)
|
|
16385
16394
|
};
|
|
16386
16395
|
}
|
|
16387
16396
|
function isOpenClawLocalDiagnosticsFailure(diagnostics) {
|
|
@@ -16465,7 +16474,7 @@ async function resolveInspectModeDiagnostics(input) {
|
|
|
16465
16474
|
openClawBin: input.openClawBin
|
|
16466
16475
|
}).then(() => "healthy").catch((error) => ({
|
|
16467
16476
|
errorCode: extractErrorCode(error),
|
|
16468
|
-
message: toErrorMessage$
|
|
16477
|
+
message: toErrorMessage$27(error)
|
|
16469
16478
|
}));
|
|
16470
16479
|
if (gatewayHealth !== "healthy") return {
|
|
16471
16480
|
...inspected,
|
|
@@ -16545,7 +16554,7 @@ async function resolveInspectGatewayVisibility(input) {
|
|
|
16545
16554
|
return {
|
|
16546
16555
|
errorCode: extractErrorCode(error),
|
|
16547
16556
|
gatewayVisibility: "not_checked",
|
|
16548
|
-
message: toErrorMessage$
|
|
16557
|
+
message: toErrorMessage$27(error)
|
|
16549
16558
|
};
|
|
16550
16559
|
}
|
|
16551
16560
|
}
|
|
@@ -16554,7 +16563,7 @@ function resolveDiagnosticsFailureDetail(input) {
|
|
|
16554
16563
|
const inspectedMessage = typeof input.inspected.message === "string" && input.inspected.message.trim().length > 0 ? input.inspected.message.trim() : null;
|
|
16555
16564
|
return {
|
|
16556
16565
|
errorCode: inspectedErrorCode ?? extractErrorCode(input.error),
|
|
16557
|
-
message: inspectedMessage ?? toErrorMessage$
|
|
16566
|
+
message: inspectedMessage ?? toErrorMessage$27(input.error)
|
|
16558
16567
|
};
|
|
16559
16568
|
}
|
|
16560
16569
|
function resolveDiagnosticsTargetAgent(input) {
|
|
@@ -16615,7 +16624,7 @@ function buildBootstrapDiagnosticStatus(bootstrapStatus, errorCode, message) {
|
|
|
16615
16624
|
}
|
|
16616
16625
|
function resolveExplicitBootstrapDiagnostic(error) {
|
|
16617
16626
|
const explicitErrorCode = extractErrorCode(error);
|
|
16618
|
-
const explicitMessage = error ? toErrorMessage$
|
|
16627
|
+
const explicitMessage = error ? toErrorMessage$27(error) : null;
|
|
16619
16628
|
switch (explicitErrorCode) {
|
|
16620
16629
|
case "openclaw.bootstrap.binding_conflict": return buildBootstrapDiagnosticStatus("binding_conflict", explicitErrorCode, explicitMessage);
|
|
16621
16630
|
case "openclaw.bootstrap.workspace_mismatch": return buildBootstrapDiagnosticStatus("workspace_mismatch", explicitErrorCode, explicitMessage);
|
|
@@ -16635,7 +16644,7 @@ function resolveExistingBootstrapStatus(input) {
|
|
|
16635
16644
|
}
|
|
16636
16645
|
function resolveInvalidBootstrapStatus(input) {
|
|
16637
16646
|
if (input.workspaceAgents.length > 1) return buildBootstrapDiagnosticStatus("workspace_ambiguous", "openclaw.bootstrap.workspace_ambiguous", null);
|
|
16638
|
-
return buildBootstrapDiagnosticStatus("invalid", input.bootstrapRead.error?.code ?? extractErrorCode(input.error), input.bootstrapRead.error?.message ?? (input.error ? toErrorMessage$
|
|
16647
|
+
return buildBootstrapDiagnosticStatus("invalid", input.bootstrapRead.error?.code ?? extractErrorCode(input.error), input.bootstrapRead.error?.message ?? (input.error ? toErrorMessage$27(input.error) : null));
|
|
16639
16648
|
}
|
|
16640
16649
|
function resolveMissingBootstrapStatus(workspaceAgents, input = {}) {
|
|
16641
16650
|
if (workspaceAgents.length > 1) return buildBootstrapDiagnosticStatus("workspace_ambiguous", "openclaw.bootstrap.workspace_ambiguous", null);
|
|
@@ -16679,7 +16688,7 @@ function extractProviderErrorCode(error) {
|
|
|
16679
16688
|
const normalized = String(error.providerErrorCode ?? "").trim();
|
|
16680
16689
|
return normalized.length > 0 ? normalized : null;
|
|
16681
16690
|
}
|
|
16682
|
-
function toErrorMessage$
|
|
16691
|
+
function toErrorMessage$27(error) {
|
|
16683
16692
|
return error instanceof Error ? error.message : String(error);
|
|
16684
16693
|
}
|
|
16685
16694
|
|
|
@@ -19690,7 +19699,7 @@ async function resolveDaemonRuntimeContractCompatibility(input) {
|
|
|
19690
19699
|
observedEpoch: null,
|
|
19691
19700
|
updatedAt: null,
|
|
19692
19701
|
reasonCode: "daemon.runtime_contract.unavailable",
|
|
19693
|
-
errorMessage: toErrorMessage$
|
|
19702
|
+
errorMessage: toErrorMessage$36(error)
|
|
19694
19703
|
};
|
|
19695
19704
|
}
|
|
19696
19705
|
if (!meta) return {
|
|
@@ -20011,7 +20020,7 @@ async function waitForDaemonSystemServiceToStop(input) {
|
|
|
20011
20020
|
if (!(await input.manager.status().catch(() => null))?.running && currentRuntime?.status !== "running") return true;
|
|
20012
20021
|
if (currentRuntime?.status === "stale" && !currentRuntime.managedBySystemService) return true;
|
|
20013
20022
|
if (currentRuntime?.status === "not_running") return true;
|
|
20014
|
-
await sleep$
|
|
20023
|
+
await sleep$7(pollMs);
|
|
20015
20024
|
}
|
|
20016
20025
|
const finalRuntime = await readCurrentObservedDaemonRuntimeStatus().catch(() => null);
|
|
20017
20026
|
if (finalRuntime?.status === "not_running") return true;
|
|
@@ -20019,7 +20028,7 @@ async function waitForDaemonSystemServiceToStop(input) {
|
|
|
20019
20028
|
if (finalRuntime?.status === "running") return false;
|
|
20020
20029
|
return (await input.manager.status().catch(() => null))?.running !== true;
|
|
20021
20030
|
}
|
|
20022
|
-
async function sleep$
|
|
20031
|
+
async function sleep$7(ms) {
|
|
20023
20032
|
await new Promise((resolve) => setTimeout(resolve, ms));
|
|
20024
20033
|
}
|
|
20025
20034
|
async function readObservedRuntimeState() {
|
|
@@ -21031,7 +21040,7 @@ async function invokeClaudeWithSingleContextHeal(input) {
|
|
|
21031
21040
|
return new ClaudeRuntimeError({
|
|
21032
21041
|
code: "context.rebuild_failed",
|
|
21033
21042
|
errorType: "adapter",
|
|
21034
|
-
message: `context.rebuild_failed: ${toErrorMessage$
|
|
21043
|
+
message: `context.rebuild_failed: ${toErrorMessage$26(error)}`,
|
|
21035
21044
|
...providerAccessEvidence ? { providerAccessEvidence } : {}
|
|
21036
21045
|
});
|
|
21037
21046
|
},
|
|
@@ -21091,7 +21100,7 @@ async function invokeClaudeOnce(input) {
|
|
|
21091
21100
|
throw new ClaudeRuntimeError({
|
|
21092
21101
|
code: "upstream_unreachable",
|
|
21093
21102
|
errorType: "adapter",
|
|
21094
|
-
message: `upstream_unreachable: ${toErrorMessage$
|
|
21103
|
+
message: `upstream_unreachable: ${toErrorMessage$26(error)}`
|
|
21095
21104
|
});
|
|
21096
21105
|
}
|
|
21097
21106
|
}
|
|
@@ -21101,7 +21110,7 @@ function getClaudeProviderAccessEvidence(error) {
|
|
|
21101
21110
|
if (!evidence || typeof evidence !== "object") return null;
|
|
21102
21111
|
return evidence;
|
|
21103
21112
|
}
|
|
21104
|
-
function toErrorMessage$
|
|
21113
|
+
function toErrorMessage$26(error) {
|
|
21105
21114
|
if (error instanceof Error) return error.message;
|
|
21106
21115
|
return String(error);
|
|
21107
21116
|
}
|
|
@@ -21720,7 +21729,7 @@ async function invokeCodexWithSingleContextHeal(input) {
|
|
|
21720
21729
|
createRebuildFailedError: (error) => new CodexRuntimeError({
|
|
21721
21730
|
code: "context.rebuild_failed",
|
|
21722
21731
|
errorType: "adapter",
|
|
21723
|
-
message: `context.rebuild_failed: ${toErrorMessage$
|
|
21732
|
+
message: `context.rebuild_failed: ${toErrorMessage$25(error)}`
|
|
21724
21733
|
}),
|
|
21725
21734
|
invokeOnce: (threadId) => invokeCodexOnce({
|
|
21726
21735
|
launchContract: input.launchContract,
|
|
@@ -21774,11 +21783,11 @@ async function invokeCodexOnce(input) {
|
|
|
21774
21783
|
throw new CodexRuntimeError({
|
|
21775
21784
|
code: "upstream_unreachable",
|
|
21776
21785
|
errorType: "adapter",
|
|
21777
|
-
message: `upstream_unreachable: ${toErrorMessage$
|
|
21786
|
+
message: `upstream_unreachable: ${toErrorMessage$25(error)}`
|
|
21778
21787
|
});
|
|
21779
21788
|
}
|
|
21780
21789
|
}
|
|
21781
|
-
function toErrorMessage$
|
|
21790
|
+
function toErrorMessage$25(error) {
|
|
21782
21791
|
if (error instanceof Error) return error.message;
|
|
21783
21792
|
return String(error);
|
|
21784
21793
|
}
|
|
@@ -22722,7 +22731,7 @@ async function syncDeviceRuntimeStateProjection(input) {
|
|
|
22722
22731
|
const projectedControllers = await loadProjectedControllers();
|
|
22723
22732
|
const registeredCustomTargetIds = await loadRegisteredCustomTargetIds();
|
|
22724
22733
|
const targetStates = await listAgentTargetStates().catch((error) => {
|
|
22725
|
-
throw new Error(`failed to load ATS agent target states: ${toErrorMessage$
|
|
22734
|
+
throw new Error(`failed to load ATS agent target states: ${toErrorMessage$24(error)}`);
|
|
22726
22735
|
});
|
|
22727
22736
|
const targetStateById = new Map(targetStates.map((state) => [state.agentId, state]));
|
|
22728
22737
|
const projectedControllerIds = [...projectedControllers.keys()].sort();
|
|
@@ -22796,12 +22805,12 @@ async function hasValidAuthSession() {
|
|
|
22796
22805
|
}
|
|
22797
22806
|
async function loadProjectedControllers() {
|
|
22798
22807
|
return await collectProjectedControllers(await listAtsProfiles().catch((error) => {
|
|
22799
|
-
throw new Error(`failed to list ATS profiles: ${toErrorMessage$
|
|
22808
|
+
throw new Error(`failed to list ATS profiles: ${toErrorMessage$24(error)}`);
|
|
22800
22809
|
}));
|
|
22801
22810
|
}
|
|
22802
22811
|
async function loadRegisteredCustomTargetIds() {
|
|
22803
22812
|
const customTargets = await listAgentCustomTargets().catch((error) => {
|
|
22804
|
-
throw new Error(`failed to list ATS custom targets: ${toErrorMessage$
|
|
22813
|
+
throw new Error(`failed to list ATS custom targets: ${toErrorMessage$24(error)}`);
|
|
22805
22814
|
});
|
|
22806
22815
|
return new Set(customTargets.map((target) => target.id));
|
|
22807
22816
|
}
|
|
@@ -23078,7 +23087,7 @@ function emitProjectionEvidence(result) {
|
|
|
23078
23087
|
function normalizeText$1(value) {
|
|
23079
23088
|
return String(value ?? "").trim();
|
|
23080
23089
|
}
|
|
23081
|
-
function toErrorMessage$
|
|
23090
|
+
function toErrorMessage$24(error) {
|
|
23082
23091
|
if (error instanceof Error) return error.message;
|
|
23083
23092
|
return String(error);
|
|
23084
23093
|
}
|
|
@@ -23505,7 +23514,7 @@ async function readPrimaryBindingForRouteCatalog(input) {
|
|
|
23505
23514
|
} catch (error) {
|
|
23506
23515
|
throw new DaemonServiceRunError({
|
|
23507
23516
|
code: "daemon.run.primary_binding_lookup_failed",
|
|
23508
|
-
message: `Core primary binding lookup failed for profile ${input.profile.atsProfileId}: ${toErrorMessage$
|
|
23517
|
+
message: `Core primary binding lookup failed for profile ${input.profile.atsProfileId}: ${toErrorMessage$36(error)}`
|
|
23509
23518
|
});
|
|
23510
23519
|
}
|
|
23511
23520
|
}
|
|
@@ -23513,7 +23522,7 @@ async function repairLocalReplyStateOrThrow(input) {
|
|
|
23513
23522
|
try {
|
|
23514
23523
|
await syncDeviceRuntimeStateProjection({ mode: "repair" });
|
|
23515
23524
|
} catch (error) {
|
|
23516
|
-
const errorMessage = toErrorMessage$
|
|
23525
|
+
const errorMessage = toErrorMessage$36(error);
|
|
23517
23526
|
emitRunLine({
|
|
23518
23527
|
presenter: input.presenter,
|
|
23519
23528
|
code: "daemon.run.projection_sync_failed",
|
|
@@ -23527,7 +23536,7 @@ async function repairLocalReplyStateOrThrow(input) {
|
|
|
23527
23536
|
try {
|
|
23528
23537
|
await syncProfileWorkspaceState({ mode: "repair" });
|
|
23529
23538
|
} catch (error) {
|
|
23530
|
-
const errorMessage = toErrorMessage$
|
|
23539
|
+
const errorMessage = toErrorMessage$36(error);
|
|
23531
23540
|
emitRunLine({
|
|
23532
23541
|
presenter: input.presenter,
|
|
23533
23542
|
code: "daemon.run.profile_workspace_sync_failed",
|
|
@@ -23569,7 +23578,7 @@ async function syncDaemonRouteCatalogState(input) {
|
|
|
23569
23578
|
return {
|
|
23570
23579
|
status: "failed",
|
|
23571
23580
|
reason: "load_failed",
|
|
23572
|
-
errorMessage: toErrorMessage$
|
|
23581
|
+
errorMessage: toErrorMessage$36(error)
|
|
23573
23582
|
};
|
|
23574
23583
|
}
|
|
23575
23584
|
const nextFingerprint = buildRouteCatalogFingerprint(nextCatalog);
|
|
@@ -23582,7 +23591,7 @@ async function syncDaemonRouteCatalogState(input) {
|
|
|
23582
23591
|
return {
|
|
23583
23592
|
status: "failed",
|
|
23584
23593
|
reason: "register_failed",
|
|
23585
|
-
errorMessage: toErrorMessage$
|
|
23594
|
+
errorMessage: toErrorMessage$36(error)
|
|
23586
23595
|
};
|
|
23587
23596
|
}
|
|
23588
23597
|
applyAcceptedLeases({
|
|
@@ -23613,7 +23622,7 @@ async function syncDaemonRouteCatalogState(input) {
|
|
|
23613
23622
|
return {
|
|
23614
23623
|
status: "failed",
|
|
23615
23624
|
reason: "register_failed",
|
|
23616
|
-
errorMessage: toErrorMessage$
|
|
23625
|
+
errorMessage: toErrorMessage$36(error)
|
|
23617
23626
|
};
|
|
23618
23627
|
}
|
|
23619
23628
|
const diff = buildRouteCatalogDiff({
|
|
@@ -23756,7 +23765,7 @@ async function resolveDaemonLocalServiceDemand(input) {
|
|
|
23756
23765
|
decision: "indeterminate",
|
|
23757
23766
|
hasWakeableLocalRoute: false,
|
|
23758
23767
|
repairableReplyCandidateCount: 0,
|
|
23759
|
-
reason: `failed to load local daemon routes: ${toErrorMessage$
|
|
23768
|
+
reason: `failed to load local daemon routes: ${toErrorMessage$36(error)}`,
|
|
23760
23769
|
wakeableLocalRouteCount: 0,
|
|
23761
23770
|
projection
|
|
23762
23771
|
};
|
|
@@ -23881,7 +23890,7 @@ async function maybeAutoStopIdleBackgroundDaemonService(input) {
|
|
|
23881
23890
|
} catch (error) {
|
|
23882
23891
|
input.presenter.line({
|
|
23883
23892
|
code: `${input.codePrefix}.auto_stop_failed`,
|
|
23884
|
-
text: `ATS could not auto-stop the background service. ${toErrorMessage$
|
|
23893
|
+
text: `ATS could not auto-stop the background service. ${toErrorMessage$36(error)}`
|
|
23885
23894
|
});
|
|
23886
23895
|
return {
|
|
23887
23896
|
autoStopped: false,
|
|
@@ -23975,9 +23984,9 @@ async function resolveGatewayChainReadiness(input = {}) {
|
|
|
23975
23984
|
applicable: true,
|
|
23976
23985
|
baseUrl: fallbackBaseUrl,
|
|
23977
23986
|
checkedAt,
|
|
23978
|
-
details: toErrorMessage$
|
|
23987
|
+
details: toErrorMessage$34(error),
|
|
23979
23988
|
errorCode: null,
|
|
23980
|
-
errorMessage: toErrorMessage$
|
|
23989
|
+
errorMessage: toErrorMessage$34(error),
|
|
23981
23990
|
failureKind: "gateway_unreachable",
|
|
23982
23991
|
ready: false,
|
|
23983
23992
|
status: null,
|
|
@@ -24901,7 +24910,7 @@ function buildLookupFailedRouteObservationDetail(input) {
|
|
|
24901
24910
|
observedAt: input.observedAt,
|
|
24902
24911
|
reasonCode: "lookup_failed"
|
|
24903
24912
|
});
|
|
24904
|
-
const rawError = toErrorMessage$
|
|
24913
|
+
const rawError = toErrorMessage$23(input.error).trim();
|
|
24905
24914
|
if (rawError.length === 0 || rawError === detail) return detail;
|
|
24906
24915
|
return `${detail} Raw lookup error: ${rawError}`;
|
|
24907
24916
|
}
|
|
@@ -24929,7 +24938,7 @@ function enrichRuntimeStateWithManager(input) {
|
|
|
24929
24938
|
serviceController: input.runtimeState.serviceController === "unknown" && input.serviceManager?.controller !== void 0 ? input.serviceManager.controller : input.runtimeState.serviceController
|
|
24930
24939
|
};
|
|
24931
24940
|
}
|
|
24932
|
-
function toErrorMessage$
|
|
24941
|
+
function toErrorMessage$23(error) {
|
|
24933
24942
|
if (error instanceof Error) return error.message;
|
|
24934
24943
|
return String(error);
|
|
24935
24944
|
}
|
|
@@ -25818,7 +25827,7 @@ async function captureDaemonServiceEvidence(input = {}) {
|
|
|
25818
25827
|
errorMessage: null
|
|
25819
25828
|
})).catch((error) => ({
|
|
25820
25829
|
snapshot: null,
|
|
25821
|
-
errorMessage: toErrorMessage$
|
|
25830
|
+
errorMessage: toErrorMessage$22(error)
|
|
25822
25831
|
})),
|
|
25823
25832
|
captureOwnedProcessesArtifact(phaseRootPath),
|
|
25824
25833
|
captureSystemServiceDiagnosticsArtifact(phaseRootPath)
|
|
@@ -25932,7 +25941,7 @@ async function captureDirectoryArtifact(input) {
|
|
|
25932
25941
|
};
|
|
25933
25942
|
} catch (error) {
|
|
25934
25943
|
return {
|
|
25935
|
-
errorMessage: toErrorMessage$
|
|
25944
|
+
errorMessage: toErrorMessage$22(error),
|
|
25936
25945
|
relativePath: null,
|
|
25937
25946
|
sourcePath: input.sourcePath,
|
|
25938
25947
|
status: "error"
|
|
@@ -25958,7 +25967,7 @@ async function captureFileArtifact(input) {
|
|
|
25958
25967
|
};
|
|
25959
25968
|
} catch (error) {
|
|
25960
25969
|
return {
|
|
25961
|
-
errorMessage: toErrorMessage$
|
|
25970
|
+
errorMessage: toErrorMessage$22(error),
|
|
25962
25971
|
relativePath: null,
|
|
25963
25972
|
sourcePath: input.sourcePath,
|
|
25964
25973
|
status: "error"
|
|
@@ -25980,7 +25989,7 @@ async function captureOwnedProcessesArtifact(evidencePath) {
|
|
|
25980
25989
|
} };
|
|
25981
25990
|
} catch (error) {
|
|
25982
25991
|
return { artifact: {
|
|
25983
|
-
errorMessage: toErrorMessage$
|
|
25992
|
+
errorMessage: toErrorMessage$22(error),
|
|
25984
25993
|
relativePath: null,
|
|
25985
25994
|
sourcePath: null,
|
|
25986
25995
|
status: "error"
|
|
@@ -26087,7 +26096,7 @@ async function runCommand$1(command, args, input = {}) {
|
|
|
26087
26096
|
child.once("close", handleClose);
|
|
26088
26097
|
});
|
|
26089
26098
|
}
|
|
26090
|
-
function toErrorMessage$
|
|
26099
|
+
function toErrorMessage$22(error) {
|
|
26091
26100
|
if (error instanceof Error) return error.message;
|
|
26092
26101
|
return String(error);
|
|
26093
26102
|
}
|
|
@@ -26259,7 +26268,7 @@ async function runDaemonServiceLifecycle(input) {
|
|
|
26259
26268
|
failureStage: state.failureStage,
|
|
26260
26269
|
evidencePath: state.evidencePath,
|
|
26261
26270
|
recoveryStatus: "failed_before_safe_state",
|
|
26262
|
-
errorMessage: toErrorMessage$
|
|
26271
|
+
errorMessage: toErrorMessage$21(error)
|
|
26263
26272
|
};
|
|
26264
26273
|
}
|
|
26265
26274
|
}
|
|
@@ -26399,7 +26408,7 @@ async function executeDaemonServiceLifecycle(input) {
|
|
|
26399
26408
|
}
|
|
26400
26409
|
}
|
|
26401
26410
|
async function recoverLifecycleFailure(input) {
|
|
26402
|
-
const originalErrorMessage = toErrorMessage$
|
|
26411
|
+
const originalErrorMessage = toErrorMessage$21(input.error);
|
|
26403
26412
|
const originalFailureStage = resolveLifecycleFailureStage(input.error, input.state.failureStage);
|
|
26404
26413
|
const originalReasonCodes = resolveLifecycleFailureReasonCodes(input.error);
|
|
26405
26414
|
if (input.restorePoint.trusted) {
|
|
@@ -26609,7 +26618,7 @@ async function ensureNoOwnedProcessesRemain() {
|
|
|
26609
26618
|
return;
|
|
26610
26619
|
}
|
|
26611
26620
|
}
|
|
26612
|
-
await sleep$
|
|
26621
|
+
await sleep$6(STRICT_TEARDOWN_VERIFY_POLL_MS$1);
|
|
26613
26622
|
}
|
|
26614
26623
|
const [ownedProcesses, runtimeStatus] = await Promise.all([listDaemonOwnedProcesses({ ignoreProcessIds: [process$1.pid, process$1.ppid].filter((pid) => Number.isInteger(pid) && pid > 0) }), readCurrentObservedDaemonRuntimeStatus()]);
|
|
26615
26624
|
if (ownedProcesses.length > 0) throw new DaemonServiceLifecycleStageError({
|
|
@@ -26632,7 +26641,7 @@ async function waitForLegacySharedServiceCleanup(input) {
|
|
|
26632
26641
|
});
|
|
26633
26642
|
lastInventory = inventory;
|
|
26634
26643
|
if (!(inventory.legacySharedService?.present === true || inventory.anomalies.some((anomaly) => anomaly.code === "legacy_shared_service_present"))) return;
|
|
26635
|
-
await sleep$
|
|
26644
|
+
await sleep$6(STRICT_TEARDOWN_VERIFY_POLL_MS$1);
|
|
26636
26645
|
}
|
|
26637
26646
|
throw new DaemonServiceLifecycleStageError({
|
|
26638
26647
|
message: "ATS Service legacy shared registration is still present after cleanup. reason=legacy_shared_service_present",
|
|
@@ -26820,7 +26829,7 @@ async function waitForVerifiedLifecycleInventory(input) {
|
|
|
26820
26829
|
});
|
|
26821
26830
|
lastInventory = inventory;
|
|
26822
26831
|
lastError = verificationError;
|
|
26823
|
-
await sleep$
|
|
26832
|
+
await sleep$6(STRICT_TEARDOWN_VERIFY_POLL_MS$1);
|
|
26824
26833
|
}
|
|
26825
26834
|
throw new DaemonServiceLifecycleStageError({
|
|
26826
26835
|
message: lastError ?? "ATS could not verify the final local service inventory state.",
|
|
@@ -26917,7 +26926,7 @@ function resolveLifecycleFailureReasonCodes(error) {
|
|
|
26917
26926
|
if (error instanceof DaemonServiceLifecycleStageError) return error.reasonCodes;
|
|
26918
26927
|
return [];
|
|
26919
26928
|
}
|
|
26920
|
-
function toErrorMessage$
|
|
26929
|
+
function toErrorMessage$21(error) {
|
|
26921
26930
|
if (error instanceof Error) return error.message;
|
|
26922
26931
|
return String(error);
|
|
26923
26932
|
}
|
|
@@ -26934,7 +26943,7 @@ async function stopDaemonProcess$1(pid, signal) {
|
|
|
26934
26943
|
process$1.kill(pid, signal);
|
|
26935
26944
|
} catch (error) {
|
|
26936
26945
|
if (error instanceof Error && error.code === "ESRCH") return true;
|
|
26937
|
-
throw new Error(`Failed to send ${signal} to pid ${String(pid)}: ${toErrorMessage$
|
|
26946
|
+
throw new Error(`Failed to send ${signal} to pid ${String(pid)}: ${toErrorMessage$21(error)}`);
|
|
26938
26947
|
}
|
|
26939
26948
|
if (signal === "SIGKILL") return true;
|
|
26940
26949
|
return await waitForProcessToExit$1(pid, PROCESS_STOP_WAIT_MS);
|
|
@@ -26944,7 +26953,7 @@ async function stopDaemonProcessWithTimeout(pid, signal, timeoutMs) {
|
|
|
26944
26953
|
process$1.kill(pid, signal);
|
|
26945
26954
|
} catch (error) {
|
|
26946
26955
|
if (error instanceof Error && error.code === "ESRCH") return true;
|
|
26947
|
-
throw new Error(`Failed to send ${signal} to pid ${String(pid)}: ${toErrorMessage$
|
|
26956
|
+
throw new Error(`Failed to send ${signal} to pid ${String(pid)}: ${toErrorMessage$21(error)}`);
|
|
26948
26957
|
}
|
|
26949
26958
|
return await waitForProcessToExit$1(pid, timeoutMs);
|
|
26950
26959
|
}
|
|
@@ -26952,16 +26961,16 @@ async function waitForProcessToExit$1(pid, timeoutMs) {
|
|
|
26952
26961
|
const deadline = Date.now() + timeoutMs;
|
|
26953
26962
|
while (Date.now() < deadline) {
|
|
26954
26963
|
if (!isPidAlive$3(pid)) return true;
|
|
26955
|
-
await sleep$
|
|
26964
|
+
await sleep$6(STRICT_TEARDOWN_VERIFY_POLL_MS$1);
|
|
26956
26965
|
}
|
|
26957
26966
|
return !isPidAlive$3(pid);
|
|
26958
26967
|
}
|
|
26959
|
-
async function sleep$
|
|
26968
|
+
async function sleep$6(ms) {
|
|
26960
26969
|
await new Promise((resolve) => setTimeout(resolve, ms));
|
|
26961
26970
|
}
|
|
26962
26971
|
function isLaunchdBootstrapIoError(serviceManager, error) {
|
|
26963
26972
|
if (serviceManager.controller !== "launchd") return false;
|
|
26964
|
-
const message = toErrorMessage$
|
|
26973
|
+
const message = toErrorMessage$21(error).toLowerCase();
|
|
26965
26974
|
return message.includes("bootstrap failed") && message.includes("input/output error");
|
|
26966
26975
|
}
|
|
26967
26976
|
async function writeLifecycleEvidenceEvent(input) {
|
|
@@ -27399,7 +27408,7 @@ async function resolveUpgradeStatus(input) {
|
|
|
27399
27408
|
status: "check_failed",
|
|
27400
27409
|
currentVersion: input.currentVersion,
|
|
27401
27410
|
checkedAt: input.checkedAt,
|
|
27402
|
-
error: toErrorMessage$
|
|
27411
|
+
error: toErrorMessage$20(error)
|
|
27403
27412
|
};
|
|
27404
27413
|
}
|
|
27405
27414
|
}
|
|
@@ -27770,7 +27779,7 @@ function emitUpgradeCompleted(input) {
|
|
|
27770
27779
|
text: "ATS CLI upgrade completed."
|
|
27771
27780
|
});
|
|
27772
27781
|
}
|
|
27773
|
-
function toErrorMessage$
|
|
27782
|
+
function toErrorMessage$20(error) {
|
|
27774
27783
|
if (error instanceof Error) return error.message;
|
|
27775
27784
|
return String(error);
|
|
27776
27785
|
}
|
|
@@ -31975,7 +31984,7 @@ async function submitPrepareRuntimeCapabilityReports(input) {
|
|
|
31975
31984
|
});
|
|
31976
31985
|
} catch (error) {
|
|
31977
31986
|
console.warn("[ats.runtime_reporting.write_failed]", {
|
|
31978
|
-
error: toErrorMessage$
|
|
31987
|
+
error: toErrorMessage$19(error),
|
|
31979
31988
|
event: "cli.runtime_reporting.write_failed",
|
|
31980
31989
|
profileIds: input.reports.map((report) => report.diagnosticProfileId).filter((profileId) => Boolean(profileId)),
|
|
31981
31990
|
reportCount: input.reports.length
|
|
@@ -32081,7 +32090,7 @@ function failedSubmission(input) {
|
|
|
32081
32090
|
status: "failed"
|
|
32082
32091
|
};
|
|
32083
32092
|
}
|
|
32084
|
-
function toErrorMessage$
|
|
32093
|
+
function toErrorMessage$19(error) {
|
|
32085
32094
|
if (error instanceof Error) {
|
|
32086
32095
|
const message = error.message.trim();
|
|
32087
32096
|
return message.length > 0 ? message : "unknown error";
|
|
@@ -32208,7 +32217,7 @@ async function ensureAgentProfileRuntimeBinding(input) {
|
|
|
32208
32217
|
};
|
|
32209
32218
|
} catch (error) {
|
|
32210
32219
|
console.warn("[ats.agent_profile_binding.ensure_failed]", {
|
|
32211
|
-
error: toErrorMessage$
|
|
32220
|
+
error: toErrorMessage$18(error),
|
|
32212
32221
|
event: "cli.agent_profile_binding.ensure_failed",
|
|
32213
32222
|
profileId: input.profile.atsProfileId
|
|
32214
32223
|
});
|
|
@@ -32253,7 +32262,7 @@ async function waitForExecutionReadinessAfterBinding(input) {
|
|
|
32253
32262
|
requestContext: input.requestContext
|
|
32254
32263
|
});
|
|
32255
32264
|
if (isAgentExecutionReadyOrConnecting(latest.agentExecutionReadiness)) return latest;
|
|
32256
|
-
await sleep$
|
|
32265
|
+
await sleep$5(EXECUTION_READINESS_AFTER_BINDING_RETRY_DELAY_MS);
|
|
32257
32266
|
}
|
|
32258
32267
|
return latest;
|
|
32259
32268
|
}
|
|
@@ -32326,10 +32335,10 @@ function tryResolveBindingInput(submission) {
|
|
|
32326
32335
|
function uniqueReasonCodes(reasonCodes) {
|
|
32327
32336
|
return [...new Set(reasonCodes)];
|
|
32328
32337
|
}
|
|
32329
|
-
async function sleep$
|
|
32338
|
+
async function sleep$5(durationMs) {
|
|
32330
32339
|
await new Promise((resolve) => setTimeout(resolve, durationMs));
|
|
32331
32340
|
}
|
|
32332
|
-
function toErrorMessage$
|
|
32341
|
+
function toErrorMessage$18(error) {
|
|
32333
32342
|
if (error instanceof Error) {
|
|
32334
32343
|
const message = error.message.trim();
|
|
32335
32344
|
return message.length > 0 ? message : "unknown error";
|
|
@@ -33943,7 +33952,7 @@ async function runAuthLogin(input) {
|
|
|
33943
33952
|
ott: input.ott,
|
|
33944
33953
|
allowBackToCaller: input.allowBackToCaller === true
|
|
33945
33954
|
}).catch((error) => {
|
|
33946
|
-
if (runtime.resolvedView === "agent") throw createAuthLoginGuideError(toErrorMessage$
|
|
33955
|
+
if (runtime.resolvedView === "agent") throw createAuthLoginGuideError(toErrorMessage$17(error));
|
|
33947
33956
|
throw error;
|
|
33948
33957
|
});
|
|
33949
33958
|
if (resolved.status !== "submitted") return handleAuthLoginExit({
|
|
@@ -34012,7 +34021,7 @@ async function runAuthLogin(input) {
|
|
|
34012
34021
|
}
|
|
34013
34022
|
});
|
|
34014
34023
|
}
|
|
34015
|
-
throw createAuthLoginGuideError(toErrorMessage$
|
|
34024
|
+
throw createAuthLoginGuideError(toErrorMessage$17(error));
|
|
34016
34025
|
}
|
|
34017
34026
|
throw error;
|
|
34018
34027
|
}
|
|
@@ -34349,7 +34358,7 @@ function resolveClientIdForLogin(value, resolvedView) {
|
|
|
34349
34358
|
try {
|
|
34350
34359
|
return resolveClientId(value);
|
|
34351
34360
|
} catch (error) {
|
|
34352
|
-
if (resolvedView === "agent") throw createAuthLoginGuideError(toErrorMessage$
|
|
34361
|
+
if (resolvedView === "agent") throw createAuthLoginGuideError(toErrorMessage$17(error));
|
|
34353
34362
|
throw error;
|
|
34354
34363
|
}
|
|
34355
34364
|
}
|
|
@@ -34772,7 +34781,7 @@ function normalizeOptionalString$14(value) {
|
|
|
34772
34781
|
const normalized = String(value ?? "").trim();
|
|
34773
34782
|
return normalized.length > 0 ? normalized : null;
|
|
34774
34783
|
}
|
|
34775
|
-
function toErrorMessage$
|
|
34784
|
+
function toErrorMessage$17(error) {
|
|
34776
34785
|
if (error instanceof Error) return error.message;
|
|
34777
34786
|
return String(error);
|
|
34778
34787
|
}
|
|
@@ -38158,13 +38167,13 @@ async function bindImportedUpstreamConversationLocally(input) {
|
|
|
38158
38167
|
agentContextLookupKey: seeded.agentContextLookupKey
|
|
38159
38168
|
};
|
|
38160
38169
|
} catch (error) {
|
|
38161
|
-
if (!snapshot) throw new Error(`local imported upstream conversation bind failed on this device: ${toErrorMessage$
|
|
38170
|
+
if (!snapshot) throw new Error(`local imported upstream conversation bind failed on this device: ${toErrorMessage$16(error)}`);
|
|
38162
38171
|
try {
|
|
38163
38172
|
await restoreImportedConversationExecution({ snapshot });
|
|
38164
38173
|
} catch (restoreError) {
|
|
38165
|
-
throw new LocalImportedUpstreamConversationBindError("daemon.control.local_imported_upstream_conversation_recovery_failed", `local imported upstream conversation bind failed and local recovery also failed on this device: original bind error: ${toErrorMessage$
|
|
38174
|
+
throw new LocalImportedUpstreamConversationBindError("daemon.control.local_imported_upstream_conversation_recovery_failed", `local imported upstream conversation bind failed and local recovery also failed on this device: original bind error: ${toErrorMessage$16(error)}; local recovery failed: ${toErrorMessage$16(restoreError)}`, { cause: restoreError });
|
|
38166
38175
|
}
|
|
38167
|
-
throw new LocalImportedUpstreamConversationBindError("daemon.control.local_imported_upstream_conversation_bind_failed", `local imported upstream conversation bind failed on this device: ${toErrorMessage$
|
|
38176
|
+
throw new LocalImportedUpstreamConversationBindError("daemon.control.local_imported_upstream_conversation_bind_failed", `local imported upstream conversation bind failed on this device: ${toErrorMessage$16(error)}`, { cause: error });
|
|
38168
38177
|
}
|
|
38169
38178
|
}
|
|
38170
38179
|
async function clearImportedUpstreamConversationLocalStateLocally(input) {
|
|
@@ -38177,10 +38186,10 @@ async function clearImportedUpstreamConversationLocalStateLocally(input) {
|
|
|
38177
38186
|
transportMode: input.transportMode
|
|
38178
38187
|
});
|
|
38179
38188
|
} catch (error) {
|
|
38180
|
-
throw new LocalImportedUpstreamConversationBindError("daemon.control.local_imported_upstream_conversation_local_state_clear_failed", "local imported upstream conversation local state clear failed on this device: " + toErrorMessage$
|
|
38189
|
+
throw new LocalImportedUpstreamConversationBindError("daemon.control.local_imported_upstream_conversation_local_state_clear_failed", "local imported upstream conversation local state clear failed on this device: " + toErrorMessage$16(error), { cause: error });
|
|
38181
38190
|
}
|
|
38182
38191
|
}
|
|
38183
|
-
function toErrorMessage$
|
|
38192
|
+
function toErrorMessage$16(error) {
|
|
38184
38193
|
if (error instanceof Error && error.message.trim().length > 0) return error.message;
|
|
38185
38194
|
return String(error);
|
|
38186
38195
|
}
|
|
@@ -38919,7 +38928,7 @@ function flushDispatchResultOutbox(input) {
|
|
|
38919
38928
|
return {
|
|
38920
38929
|
...record,
|
|
38921
38930
|
attemptCount: record.attemptCount + 1,
|
|
38922
|
-
lastFailureReason: toErrorMessage$
|
|
38931
|
+
lastFailureReason: toErrorMessage$36(error),
|
|
38923
38932
|
nextAttemptAtMs: nowMs + resolveOutboxBackoffMs(record.attemptCount + 1),
|
|
38924
38933
|
updatedAtMs: nowMs
|
|
38925
38934
|
};
|
|
@@ -39093,7 +39102,7 @@ function createLocalExecutionSlots(input) {
|
|
|
39093
39102
|
dispatchId: selectedTask.dispatchId,
|
|
39094
39103
|
durationMs: Math.max(0, Date.now() - startedAtMs),
|
|
39095
39104
|
errorCode: null,
|
|
39096
|
-
errorMessage: toErrorMessage$
|
|
39105
|
+
errorMessage: toErrorMessage$15(error),
|
|
39097
39106
|
localQueue: buildLocalQueueDiagnostics({
|
|
39098
39107
|
profileId: selectedTask.profileId,
|
|
39099
39108
|
queuePosition: null,
|
|
@@ -39236,7 +39245,7 @@ function createLocalExecutionSlots(input) {
|
|
|
39236
39245
|
function buildAttemptKey(dispatchId, attemptId) {
|
|
39237
39246
|
return `${dispatchId}::${attemptId}`;
|
|
39238
39247
|
}
|
|
39239
|
-
function toErrorMessage$
|
|
39248
|
+
function toErrorMessage$15(error) {
|
|
39240
39249
|
if (error instanceof Error && error.message.trim().length > 0) return error.message;
|
|
39241
39250
|
if (typeof error === "string" && error.trim().length > 0) return error;
|
|
39242
39251
|
return "unknown error";
|
|
@@ -40519,7 +40528,7 @@ function reportInvalidDeliverRequest(input) {
|
|
|
40519
40528
|
leaseEpoch: identity.leaseEpoch,
|
|
40520
40529
|
metadata: {
|
|
40521
40530
|
...buildResultDispatchJournalMetadata(resultPayload),
|
|
40522
|
-
errorMessage: toErrorMessage$
|
|
40531
|
+
errorMessage: toErrorMessage$36(error),
|
|
40523
40532
|
parseIssues: issues
|
|
40524
40533
|
},
|
|
40525
40534
|
profileId: identity.targetProfileId,
|
|
@@ -40530,10 +40539,10 @@ function reportInvalidDeliverRequest(input) {
|
|
|
40530
40539
|
emitRunLine({
|
|
40531
40540
|
presenter: input.presenter,
|
|
40532
40541
|
code: "daemon.run.invalid_deliver_result_send_failed",
|
|
40533
|
-
text: `failed to send invalid deliver result for dispatch ${identity.dispatchId}: ${toErrorMessage$
|
|
40542
|
+
text: `failed to send invalid deliver result for dispatch ${identity.dispatchId}: ${toErrorMessage$36(error)}`,
|
|
40534
40543
|
payload: {
|
|
40535
40544
|
dispatchId: identity.dispatchId,
|
|
40536
|
-
errorMessage: toErrorMessage$
|
|
40545
|
+
errorMessage: toErrorMessage$36(error),
|
|
40537
40546
|
result: "failed",
|
|
40538
40547
|
taskId: identity.taskId
|
|
40539
40548
|
}
|
|
@@ -41727,7 +41736,7 @@ function normalizeResolvedPostMessageAction(input) {
|
|
|
41727
41736
|
resolvedSpaceAction: normalizedPostMessageAction.action
|
|
41728
41737
|
};
|
|
41729
41738
|
} catch (error) {
|
|
41730
|
-
const failureReason = toErrorMessage$
|
|
41739
|
+
const failureReason = toErrorMessage$36(error);
|
|
41731
41740
|
emitRunLine({
|
|
41732
41741
|
presenter: input.presenter,
|
|
41733
41742
|
code: "daemon.run.post_message_validation_rejected",
|
|
@@ -41793,7 +41802,7 @@ function normalizeResolvedThreadAction(input) {
|
|
|
41793
41802
|
})
|
|
41794
41803
|
};
|
|
41795
41804
|
} catch (error) {
|
|
41796
|
-
const failureReason = toErrorMessage$
|
|
41805
|
+
const failureReason = toErrorMessage$36(error);
|
|
41797
41806
|
emitRunLine({
|
|
41798
41807
|
presenter: input.presenter,
|
|
41799
41808
|
code: "daemon.run.thread_action_validation_rejected",
|
|
@@ -41902,7 +41911,7 @@ async function maybeRepairStructuredSpaceAction(input) {
|
|
|
41902
41911
|
dispatchId: input.parsedTask.dispatchId,
|
|
41903
41912
|
...resolveStructuredActionFailureDiagnostics({
|
|
41904
41913
|
carrierKind: "none",
|
|
41905
|
-
parseError: toErrorMessage$
|
|
41914
|
+
parseError: toErrorMessage$36(error),
|
|
41906
41915
|
publicFailureReason: input.failureReason,
|
|
41907
41916
|
repairMode: "controller_roundtrip",
|
|
41908
41917
|
runtimeResult: input.runtimeResult
|
|
@@ -41918,7 +41927,7 @@ async function maybeRepairStructuredSpaceAction(input) {
|
|
|
41918
41927
|
return {
|
|
41919
41928
|
finalFailureDiagnostics: resolveStructuredActionFailureDiagnostics({
|
|
41920
41929
|
carrierKind: "none",
|
|
41921
|
-
parseError: toErrorMessage$
|
|
41930
|
+
parseError: toErrorMessage$36(error),
|
|
41922
41931
|
publicFailureReason: input.failureReason,
|
|
41923
41932
|
repairMode: "controller_roundtrip",
|
|
41924
41933
|
runtimeResult: input.runtimeResult
|
|
@@ -42647,7 +42656,7 @@ function toTaskExecutionError(error) {
|
|
|
42647
42656
|
return {
|
|
42648
42657
|
errorCode: "dispatch.execution_failed",
|
|
42649
42658
|
errorType: "internal",
|
|
42650
|
-
message: toErrorMessage$
|
|
42659
|
+
message: toErrorMessage$36(error)
|
|
42651
42660
|
};
|
|
42652
42661
|
}
|
|
42653
42662
|
function normalizeOptionalContextId(contextId) {
|
|
@@ -43042,7 +43051,7 @@ function sendResultAndSummarize(input) {
|
|
|
43042
43051
|
leaseEpoch: input.leaseEpoch,
|
|
43043
43052
|
metadata: {
|
|
43044
43053
|
...buildResultDispatchJournalMetadata(input.payload),
|
|
43045
|
-
errorMessage: toErrorMessage$
|
|
43054
|
+
errorMessage: toErrorMessage$36(error)
|
|
43046
43055
|
},
|
|
43047
43056
|
result: input.payload.status,
|
|
43048
43057
|
taskId: input.taskId,
|
|
@@ -43051,7 +43060,7 @@ function sendResultAndSummarize(input) {
|
|
|
43051
43060
|
emitRunLine({
|
|
43052
43061
|
presenter: input.presenter,
|
|
43053
43062
|
code: "daemon.run.result_send_failed",
|
|
43054
|
-
text: `daemon result send failed for dispatch ${input.dispatchId}: ${toErrorMessage$
|
|
43063
|
+
text: `daemon result send failed for dispatch ${input.dispatchId}: ${toErrorMessage$36(error)}`,
|
|
43055
43064
|
payload: {
|
|
43056
43065
|
attemptId: input.attemptId,
|
|
43057
43066
|
connectionGeneration: input.connectionGeneration,
|
|
@@ -43084,7 +43093,7 @@ function emitDispatchPreviewFrame(input) {
|
|
|
43084
43093
|
emitRunLine({
|
|
43085
43094
|
presenter: input.presenter,
|
|
43086
43095
|
code: "daemon.run.preview_send_failed",
|
|
43087
|
-
text: `daemon preview send failed for dispatch ${input.dispatchId}: ${toErrorMessage$
|
|
43096
|
+
text: `daemon preview send failed for dispatch ${input.dispatchId}: ${toErrorMessage$36(error)}`,
|
|
43088
43097
|
payload: {
|
|
43089
43098
|
attemptId: input.attemptId,
|
|
43090
43099
|
dispatchId: input.dispatchId,
|
|
@@ -43110,7 +43119,7 @@ function emitDispatchPreviewEndFrame(input) {
|
|
|
43110
43119
|
emitRunLine({
|
|
43111
43120
|
presenter: input.presenter,
|
|
43112
43121
|
code: "daemon.run.preview_end_send_failed",
|
|
43113
|
-
text: `daemon preview end send failed for dispatch ${input.dispatchId}: ${toErrorMessage$
|
|
43122
|
+
text: `daemon preview end send failed for dispatch ${input.dispatchId}: ${toErrorMessage$36(error)}`,
|
|
43114
43123
|
payload: {
|
|
43115
43124
|
attemptId: input.attemptId,
|
|
43116
43125
|
dispatchId: input.dispatchId,
|
|
@@ -43153,7 +43162,7 @@ function emitDispatchRuntimeEvidenceTransition(input) {
|
|
|
43153
43162
|
emitRunLine({
|
|
43154
43163
|
presenter: input.presenter,
|
|
43155
43164
|
code: "daemon.run.runtime_evidence_send_failed",
|
|
43156
|
-
text: `daemon runtime evidence ${input.phase} send failed for dispatch ${identity.dispatchId}: ${toErrorMessage$
|
|
43165
|
+
text: `daemon runtime evidence ${input.phase} send failed for dispatch ${identity.dispatchId}: ${toErrorMessage$36(error)}`,
|
|
43157
43166
|
payload: {
|
|
43158
43167
|
attemptId: identity.attemptId,
|
|
43159
43168
|
dispatchId: identity.dispatchId,
|
|
@@ -43252,7 +43261,7 @@ function emitDispatchLifecycleTransition(input) {
|
|
|
43252
43261
|
dispatchId: input.dispatchId,
|
|
43253
43262
|
leaseEpoch: input.leaseEpoch,
|
|
43254
43263
|
metadata: {
|
|
43255
|
-
errorMessage: toErrorMessage$
|
|
43264
|
+
errorMessage: toErrorMessage$36(error),
|
|
43256
43265
|
localQueue: input.localQueue ?? null,
|
|
43257
43266
|
phase: input.phase
|
|
43258
43267
|
},
|
|
@@ -43263,7 +43272,7 @@ function emitDispatchLifecycleTransition(input) {
|
|
|
43263
43272
|
emitRunLine({
|
|
43264
43273
|
presenter: input.presenter,
|
|
43265
43274
|
code: "daemon.run.lifecycle_send_failed",
|
|
43266
|
-
text: `daemon lifecycle ${input.phase} send failed for dispatch ${input.dispatchId}: ${toErrorMessage$
|
|
43275
|
+
text: `daemon lifecycle ${input.phase} send failed for dispatch ${input.dispatchId}: ${toErrorMessage$36(error)}`,
|
|
43267
43276
|
payload: {
|
|
43268
43277
|
attemptId: input.attemptId,
|
|
43269
43278
|
dispatchId: input.dispatchId,
|
|
@@ -43892,7 +43901,7 @@ async function runDaemonSocketSession(input) {
|
|
|
43892
43901
|
emitRunLine({
|
|
43893
43902
|
presenter: input.presenter,
|
|
43894
43903
|
code: "daemon.run.heartbeat_failed",
|
|
43895
|
-
text: `heartbeat failed (${String(consecutiveHeartbeatFailures)}/${String(HEARTBEAT_CONSECUTIVE_FAILURES_BEFORE_CLOSE)}): ${toErrorMessage$
|
|
43904
|
+
text: `heartbeat failed (${String(consecutiveHeartbeatFailures)}/${String(HEARTBEAT_CONSECUTIVE_FAILURES_BEFORE_CLOSE)}): ${toErrorMessage$36(error)}`
|
|
43896
43905
|
});
|
|
43897
43906
|
if (shouldCloseSocket) {
|
|
43898
43907
|
input.socket.close(1011, "heartbeat_failed");
|
|
@@ -43925,7 +43934,7 @@ async function runDaemonSocketSession(input) {
|
|
|
43925
43934
|
emitRunLine({
|
|
43926
43935
|
presenter: input.presenter,
|
|
43927
43936
|
code: "daemon.run.heartbeat_failed",
|
|
43928
|
-
text: `heartbeat failed: ${toErrorMessage$
|
|
43937
|
+
text: `heartbeat failed: ${toErrorMessage$36(error)}`
|
|
43929
43938
|
});
|
|
43930
43939
|
});
|
|
43931
43940
|
}, normalizedDelayMs);
|
|
@@ -43967,7 +43976,7 @@ async function runDaemonSocketSession(input) {
|
|
|
43967
43976
|
emitRunLine({
|
|
43968
43977
|
presenter: input.presenter,
|
|
43969
43978
|
code: "daemon.run.catalog_sync_signal_read_failed",
|
|
43970
|
-
text: `catalog sync signal read failed: ${toErrorMessage$
|
|
43979
|
+
text: `catalog sync signal read failed: ${toErrorMessage$36(error)}`
|
|
43971
43980
|
});
|
|
43972
43981
|
}).finally(() => {
|
|
43973
43982
|
scheduleCatalogSyncSignalPoll();
|
|
@@ -44193,7 +44202,7 @@ async function runDaemonSocketSession(input) {
|
|
|
44193
44202
|
emitRunLine({
|
|
44194
44203
|
presenter: input.presenter,
|
|
44195
44204
|
code: "daemon.run.runtime_capability_report_sync_failed",
|
|
44196
|
-
text: `runtime capability report sync failed: ${toErrorMessage$
|
|
44205
|
+
text: `runtime capability report sync failed: ${toErrorMessage$36(error)}`
|
|
44197
44206
|
});
|
|
44198
44207
|
}
|
|
44199
44208
|
};
|
|
@@ -44201,7 +44210,7 @@ async function runDaemonSocketSession(input) {
|
|
|
44201
44210
|
emitRunLine({
|
|
44202
44211
|
presenter: input.presenter,
|
|
44203
44212
|
code: "daemon.run.socket_error",
|
|
44204
|
-
text: `daemon stream socket error: ${toErrorMessage$
|
|
44213
|
+
text: `daemon stream socket error: ${toErrorMessage$36(error)}`
|
|
44205
44214
|
});
|
|
44206
44215
|
});
|
|
44207
44216
|
input.socket.onMessage((raw) => {
|
|
@@ -44856,7 +44865,7 @@ const runDaemonServiceLoop = async (input) => {
|
|
|
44856
44865
|
action: reconcileDecision.action,
|
|
44857
44866
|
backoffMs,
|
|
44858
44867
|
driftClass: reconcileDecision.driftClass,
|
|
44859
|
-
error: toErrorMessage$
|
|
44868
|
+
error: toErrorMessage$36(error),
|
|
44860
44869
|
foregroundActive: reconcileDecision.foregroundActive,
|
|
44861
44870
|
lifecycleLocked: reconcileDecision.lifecycleLocked,
|
|
44862
44871
|
owner: reconcileDecision.owner,
|
|
@@ -44867,7 +44876,7 @@ const runDaemonServiceLoop = async (input) => {
|
|
|
44867
44876
|
action: reconcileDecision.action,
|
|
44868
44877
|
backoffMs,
|
|
44869
44878
|
driftClass: reconcileDecision.driftClass,
|
|
44870
|
-
error: toErrorMessage$
|
|
44879
|
+
error: toErrorMessage$36(error),
|
|
44871
44880
|
foregroundActive: reconcileDecision.foregroundActive,
|
|
44872
44881
|
lifecycleLocked: reconcileDecision.lifecycleLocked,
|
|
44873
44882
|
owner: reconcileDecision.owner,
|
|
@@ -44877,14 +44886,14 @@ const runDaemonServiceLoop = async (input) => {
|
|
|
44877
44886
|
emitRunLine({
|
|
44878
44887
|
presenter: input.presenter,
|
|
44879
44888
|
code: "daemon.run.reconnect",
|
|
44880
|
-
text: `daemon stream reconnect scheduled in ${String(backoffMs)}ms (${toErrorMessage$
|
|
44889
|
+
text: `daemon stream reconnect scheduled in ${String(backoffMs)}ms (${toErrorMessage$36(error)})`,
|
|
44881
44890
|
payload: {
|
|
44882
44891
|
attempt: reconnectAttempt,
|
|
44883
44892
|
backoffMs,
|
|
44884
|
-
error: toErrorMessage$
|
|
44893
|
+
error: toErrorMessage$36(error)
|
|
44885
44894
|
}
|
|
44886
44895
|
});
|
|
44887
|
-
await sleep$
|
|
44896
|
+
await sleep$9(backoffMs);
|
|
44888
44897
|
}
|
|
44889
44898
|
} finally {
|
|
44890
44899
|
process.off("SIGINT", onSigint);
|
|
@@ -45354,16 +45363,16 @@ function isLaunchdBootstrapIosError$1(message) {
|
|
|
45354
45363
|
}
|
|
45355
45364
|
function shouldAttemptLaunchdAutoRepair(input) {
|
|
45356
45365
|
if (input.controller !== "launchd") return false;
|
|
45357
|
-
return isLaunchdBootstrapIosError$1(sanitizeSystemServiceErrorMessage$1(toErrorMessage$
|
|
45366
|
+
return isLaunchdBootstrapIosError$1(sanitizeSystemServiceErrorMessage$1(toErrorMessage$14(input.error)));
|
|
45358
45367
|
}
|
|
45359
45368
|
function buildLaunchdAutoRepairFailureError(input) {
|
|
45360
45369
|
return new Error([
|
|
45361
45370
|
"launchd auto-repair retry failed.",
|
|
45362
|
-
`initial error: ${toErrorMessage$
|
|
45363
|
-
`retry error: ${toErrorMessage$
|
|
45371
|
+
`initial error: ${toErrorMessage$14(input.initialError)}`,
|
|
45372
|
+
`retry error: ${toErrorMessage$14(input.retryError)}`
|
|
45364
45373
|
].join(" "));
|
|
45365
45374
|
}
|
|
45366
|
-
function toErrorMessage$
|
|
45375
|
+
function toErrorMessage$14(error) {
|
|
45367
45376
|
if (error instanceof Error) return error.message;
|
|
45368
45377
|
return String(error);
|
|
45369
45378
|
}
|
|
@@ -45726,7 +45735,7 @@ var DaemonReinstallUnexpectedStartError = class extends Error {
|
|
|
45726
45735
|
diagnosticDetail;
|
|
45727
45736
|
outcome;
|
|
45728
45737
|
constructor(input) {
|
|
45729
|
-
super(toErrorMessage$
|
|
45738
|
+
super(toErrorMessage$13(input.cause));
|
|
45730
45739
|
this.name = "DaemonReinstallUnexpectedStartError";
|
|
45731
45740
|
this.cause = input.cause;
|
|
45732
45741
|
this.diagnosticDetail = input.diagnosticDetail;
|
|
@@ -45744,7 +45753,7 @@ var DaemonReinstallFailureError = class extends Error {
|
|
|
45744
45753
|
evidencePath;
|
|
45745
45754
|
failureStage;
|
|
45746
45755
|
constructor(input) {
|
|
45747
|
-
super(toErrorMessage$
|
|
45756
|
+
super(toErrorMessage$13(input.cause));
|
|
45748
45757
|
this.name = "DaemonReinstallFailureError";
|
|
45749
45758
|
this.backupDataPath = input.backupDataPath;
|
|
45750
45759
|
this.cause = input.cause;
|
|
@@ -46442,7 +46451,7 @@ async function runDaemonReinstall(input, options = {}) {
|
|
|
46442
46451
|
if (error instanceof DaemonReinstallFailureError) throw new Error(buildDaemonReinstallFailureMessage({
|
|
46443
46452
|
action: displayAction,
|
|
46444
46453
|
backupDataPath: error.backupDataPath,
|
|
46445
|
-
errorMessage: toErrorMessage$
|
|
46454
|
+
errorMessage: toErrorMessage$13(error.cause),
|
|
46446
46455
|
failureStage: error.failureStage,
|
|
46447
46456
|
evidencePath: error.evidencePath ?? await captureDaemonServiceEvidenceBestEffort({
|
|
46448
46457
|
runtime,
|
|
@@ -46625,14 +46634,14 @@ async function runDaemonAfterReinstallStartWithRetry(input) {
|
|
|
46625
46634
|
if (result.ok || isDaemonRunAlreadyRunningReason(result.reason) || normalizeDaemonRunReason(result.reason) === "cancelled") process.exitCode = previousExitCode;
|
|
46626
46635
|
if (normalizeDaemonRunReason(result.reason) === "start_failed" && attempt < REINSTALL_START_RETRY_ATTEMPTS) {
|
|
46627
46636
|
process.exitCode = previousExitCode;
|
|
46628
|
-
await sleep$
|
|
46637
|
+
await sleep$4(input.startRetryDelayMs);
|
|
46629
46638
|
continue;
|
|
46630
46639
|
}
|
|
46631
46640
|
return result.reason;
|
|
46632
46641
|
} catch (error) {
|
|
46633
46642
|
if (attempt < REINSTALL_START_RETRY_ATTEMPTS) {
|
|
46634
46643
|
process.exitCode = previousExitCode;
|
|
46635
|
-
await sleep$
|
|
46644
|
+
await sleep$4(input.startRetryDelayMs);
|
|
46636
46645
|
continue;
|
|
46637
46646
|
}
|
|
46638
46647
|
const startupDiagnostic = await readDaemonStartFailureLogDiagnostic({ cursor: startFailureLogCursor });
|
|
@@ -46669,7 +46678,7 @@ async function applyDaemonReinstallTargetDesiredState(input) {
|
|
|
46669
46678
|
}
|
|
46670
46679
|
function buildDaemonReinstallUnexpectedStartSummary(error, action = "repair") {
|
|
46671
46680
|
const actionLabel = formatDaemonServiceMaintenanceActionLabel(action);
|
|
46672
|
-
const detail = sanitizeSystemServiceErrorMessage(toErrorMessage$
|
|
46681
|
+
const detail = sanitizeSystemServiceErrorMessage(toErrorMessage$13(error));
|
|
46673
46682
|
if (!detail) return `ATS hit a local start error right after service ${actionLabel}.`;
|
|
46674
46683
|
return `ATS hit a local start error right after service ${actionLabel}: ${detail}`;
|
|
46675
46684
|
}
|
|
@@ -46778,7 +46787,7 @@ async function waitForDaemonHealthyAfterReinstall(input) {
|
|
|
46778
46787
|
}).catch(() => null);
|
|
46779
46788
|
if (inventory && isDaemonInventoryRunningAndAligned(inventory)) return inventory.runtimeStatus;
|
|
46780
46789
|
lastRuntime = inventory?.runtimeStatus ?? await readCurrentObservedDaemonRuntimeStatus();
|
|
46781
|
-
await sleep$
|
|
46790
|
+
await sleep$4(REINSTALL_VERIFY_POLL_MS);
|
|
46782
46791
|
}
|
|
46783
46792
|
const statusText = lastRuntime ? describeDaemonRuntimeStatus(lastRuntime) : "No runtime status available.";
|
|
46784
46793
|
throw new Error(`ATS Service repair verification timed out after ${String(input.verifyWaitMs)}ms. ${statusText}`);
|
|
@@ -46885,7 +46894,7 @@ async function stopDaemonForStrictTeardown(input) {
|
|
|
46885
46894
|
await input.context.serviceManager.stop().catch((error) => {
|
|
46886
46895
|
throw createStrictTeardownError({
|
|
46887
46896
|
reason: input.reason,
|
|
46888
|
-
message: `failed to stop system service (${input.context.serviceManager?.controller}): ${toErrorMessage$
|
|
46897
|
+
message: `failed to stop system service (${input.context.serviceManager?.controller}): ${toErrorMessage$13(error)}`,
|
|
46889
46898
|
hint: "run `ats service stop --force` and retry",
|
|
46890
46899
|
stage: "stop-wait"
|
|
46891
46900
|
});
|
|
@@ -46930,7 +46939,7 @@ async function uninstallSystemServiceForStrictTeardown(input) {
|
|
|
46930
46939
|
for (const manager of managers) await manager.uninstall().catch((error) => {
|
|
46931
46940
|
throw createStrictTeardownError({
|
|
46932
46941
|
reason: input.reason,
|
|
46933
|
-
message: `failed to uninstall system service (${manager.controller}): ${toErrorMessage$
|
|
46942
|
+
message: `failed to uninstall system service (${manager.controller}): ${toErrorMessage$13(error)}`,
|
|
46934
46943
|
hint: "fix OS service permissions and retry",
|
|
46935
46944
|
stage: "uninstall-verify"
|
|
46936
46945
|
});
|
|
@@ -46947,7 +46956,7 @@ async function verifySystemServiceRemovedAfterStrictTeardown(input) {
|
|
|
46947
46956
|
const finalManagerStatus = await manager.status().catch((error) => {
|
|
46948
46957
|
throw createStrictTeardownError({
|
|
46949
46958
|
reason: input.reason,
|
|
46950
|
-
message: `failed to verify system service status (${manager.controller}): ${toErrorMessage$
|
|
46959
|
+
message: `failed to verify system service status (${manager.controller}): ${toErrorMessage$13(error)}`,
|
|
46951
46960
|
hint: "run `ats service status` and confirm service manager state",
|
|
46952
46961
|
stage: "uninstall-verify"
|
|
46953
46962
|
});
|
|
@@ -46958,13 +46967,13 @@ async function verifySystemServiceRemovedAfterStrictTeardown(input) {
|
|
|
46958
46967
|
}
|
|
46959
46968
|
}
|
|
46960
46969
|
if (allRemoved) return;
|
|
46961
|
-
await sleep$
|
|
46970
|
+
await sleep$4(STRICT_TEARDOWN_VERIFY_POLL_MS);
|
|
46962
46971
|
}
|
|
46963
46972
|
for (const manager of managers) {
|
|
46964
46973
|
const finalManagerStatus = await manager.status().catch((error) => {
|
|
46965
46974
|
throw createStrictTeardownError({
|
|
46966
46975
|
reason: input.reason,
|
|
46967
|
-
message: `failed to verify system service status (${manager.controller}): ${toErrorMessage$
|
|
46976
|
+
message: `failed to verify system service status (${manager.controller}): ${toErrorMessage$13(error)}`,
|
|
46968
46977
|
hint: "run `ats service status` and confirm service manager state",
|
|
46969
46978
|
stage: "uninstall-verify"
|
|
46970
46979
|
});
|
|
@@ -46995,7 +47004,7 @@ async function ensureRuntimeCleanAfterStrictTeardown(input) {
|
|
|
46995
47004
|
if ((await input.deps.readCurrentObservedDaemonRuntimeStatus()).status === "not_running") return;
|
|
46996
47005
|
}
|
|
46997
47006
|
}
|
|
46998
|
-
await sleep$
|
|
47007
|
+
await sleep$4(STRICT_TEARDOWN_VERIFY_POLL_MS);
|
|
46999
47008
|
}
|
|
47000
47009
|
const [ownedProcesses, finalRuntime] = await Promise.all([input.deps.listDaemonOwnedProcesses({ ignoreProcessIds: [process.pid] }), input.deps.readCurrentObservedDaemonRuntimeStatus()]);
|
|
47001
47010
|
if (finalRuntime.status === "running") throw createStrictTeardownError({
|
|
@@ -47796,7 +47805,7 @@ function isLocalControllerSignInRequiredReason(reason) {
|
|
|
47796
47805
|
return reason === "sign in required";
|
|
47797
47806
|
}
|
|
47798
47807
|
function buildSystemServiceStartupFailureReport(input) {
|
|
47799
|
-
const message = sanitizeSystemServiceErrorMessage(toErrorMessage$
|
|
47808
|
+
const message = sanitizeSystemServiceErrorMessage(toErrorMessage$13(input.error));
|
|
47800
47809
|
const localLogPath = getDaemonSystemServiceLogPath();
|
|
47801
47810
|
if (isLaunchdBootstrapIosError(message)) {
|
|
47802
47811
|
const card = buildDaemonStartNeedsAttentionCard({
|
|
@@ -47872,7 +47881,7 @@ async function waitForSystemServiceStartup(input) {
|
|
|
47872
47881
|
state: "running",
|
|
47873
47882
|
runtimeStatus: inventory.runtimeStatus
|
|
47874
47883
|
};
|
|
47875
|
-
await sleep$
|
|
47884
|
+
await sleep$4(input.pollMs);
|
|
47876
47885
|
}
|
|
47877
47886
|
const finalInventory = await inspectDaemonServiceInventory({
|
|
47878
47887
|
expectedVersion: input.expectedVersion,
|
|
@@ -48138,7 +48147,7 @@ async function runDirectDaemonServiceLoop(input) {
|
|
|
48138
48147
|
};
|
|
48139
48148
|
} catch (error) {
|
|
48140
48149
|
return await handleDaemonRunStartFailure({
|
|
48141
|
-
fallbackRawLine: toErrorMessage$
|
|
48150
|
+
fallbackRawLine: toErrorMessage$13(error),
|
|
48142
48151
|
gatewayUrl: input.gatewayUrl,
|
|
48143
48152
|
presenter: input.presenter,
|
|
48144
48153
|
runtime: input.runtime,
|
|
@@ -48440,11 +48449,11 @@ async function stopRegisteredDaemonServiceManager(input) {
|
|
|
48440
48449
|
run: async () => await input.ownerSnapshot.serviceManager?.stop()
|
|
48441
48450
|
});
|
|
48442
48451
|
} catch (error) {
|
|
48443
|
-
if (input.mode !== "best_effort") throw new Error(`Failed to stop system service (${input.ownerSnapshot.runtimeStatus.serviceController}): ${toErrorMessage$
|
|
48452
|
+
if (input.mode !== "best_effort") throw new Error(`Failed to stop system service (${input.ownerSnapshot.runtimeStatus.serviceController}): ${toErrorMessage$13(error)}`);
|
|
48444
48453
|
return buildDaemonStopWarningResult({
|
|
48445
48454
|
reason: "stop_failed",
|
|
48446
48455
|
runtimeStatus: input.ownerSnapshot.runtimeStatus,
|
|
48447
|
-
errorMessage: toErrorMessage$
|
|
48456
|
+
errorMessage: toErrorMessage$13(error)
|
|
48448
48457
|
});
|
|
48449
48458
|
}
|
|
48450
48459
|
if (!await waitForDaemonSystemServiceToStop({
|
|
@@ -48475,7 +48484,7 @@ async function stopRegisteredDaemonServiceManager(input) {
|
|
|
48475
48484
|
return buildDaemonStopWarningResult({
|
|
48476
48485
|
reason: "stop_failed",
|
|
48477
48486
|
runtimeStatus: input.ownerSnapshot.runtimeStatus,
|
|
48478
|
-
errorMessage: toErrorMessage$
|
|
48487
|
+
errorMessage: toErrorMessage$13(error)
|
|
48479
48488
|
});
|
|
48480
48489
|
}
|
|
48481
48490
|
const finalOwnerSnapshot = residualCleanupResult.shouldRefresh ? await readCurrentDaemonOwnerSnapshot() : residualCleanupResult.ownerSnapshot;
|
|
@@ -48548,7 +48557,7 @@ async function stopCurrentLaneDaemonProcess(input) {
|
|
|
48548
48557
|
pid: daemonPid,
|
|
48549
48558
|
reason: "stop_failed",
|
|
48550
48559
|
runtimeStatus: input.runtimeStatus,
|
|
48551
|
-
errorMessage: toErrorMessage$
|
|
48560
|
+
errorMessage: toErrorMessage$13(error)
|
|
48552
48561
|
};
|
|
48553
48562
|
}
|
|
48554
48563
|
}
|
|
@@ -48632,7 +48641,7 @@ async function stopTrackedDaemonProcess(input) {
|
|
|
48632
48641
|
type: "process_stop.action",
|
|
48633
48642
|
result: "failed",
|
|
48634
48643
|
metadata: {
|
|
48635
|
-
errorMessage: toErrorMessage$
|
|
48644
|
+
errorMessage: toErrorMessage$13(error),
|
|
48636
48645
|
pid: input.pid,
|
|
48637
48646
|
reason: input.reason,
|
|
48638
48647
|
signal: input.signal
|
|
@@ -49656,13 +49665,13 @@ async function runDaemonServiceDetached(input) {
|
|
|
49656
49665
|
if (typeof child.pid === "number" && child.pid > 0) await cleanupDetachedRuntimeStateIfOwnedByPid(child.pid).catch(() => {});
|
|
49657
49666
|
return await handleDaemonRunStartFailure({
|
|
49658
49667
|
cursor: startFailureLogCursor,
|
|
49659
|
-
fallbackRawLine: selectRelevantDaemonStartFailureLogLine(startupOutput.summary()) ?? toErrorMessage$
|
|
49668
|
+
fallbackRawLine: selectRelevantDaemonStartFailureLogLine(startupOutput.summary()) ?? toErrorMessage$13(error),
|
|
49660
49669
|
gatewayUrl: input.gatewayUrl,
|
|
49661
49670
|
presenter: input.presenter,
|
|
49662
49671
|
runtime: input.runtime,
|
|
49663
49672
|
genericErrorPayload: {
|
|
49664
49673
|
codePrefix: "daemon.run.start_failed",
|
|
49665
|
-
error: /* @__PURE__ */ new Error(`Failed to start ATS Service process: ${toErrorMessage$
|
|
49674
|
+
error: /* @__PURE__ */ new Error(`Failed to start ATS Service process: ${toErrorMessage$13(error)}`)
|
|
49666
49675
|
}
|
|
49667
49676
|
});
|
|
49668
49677
|
} finally {
|
|
@@ -49761,7 +49770,7 @@ function waitForDetachedChildProcessSpawn(child) {
|
|
|
49761
49770
|
child.once("error", onError);
|
|
49762
49771
|
});
|
|
49763
49772
|
}
|
|
49764
|
-
function sleep$
|
|
49773
|
+
function sleep$4(milliseconds) {
|
|
49765
49774
|
return new Promise((resolve) => {
|
|
49766
49775
|
setTimeout(resolve, milliseconds);
|
|
49767
49776
|
});
|
|
@@ -49782,7 +49791,7 @@ async function waitForDetachedBackgroundProcessStartup(child, startupDelayMs, st
|
|
|
49782
49791
|
reason: startupLifecycle,
|
|
49783
49792
|
startupOutput: startupOutput.summary()
|
|
49784
49793
|
}));
|
|
49785
|
-
await sleep$
|
|
49794
|
+
await sleep$4(startupPollMs);
|
|
49786
49795
|
}
|
|
49787
49796
|
const finalStatus = await readCurrentObservedDaemonRuntimeStatus().catch(() => null);
|
|
49788
49797
|
if (finalStatus?.status === "running" && finalStatus.pid === child.pid) return;
|
|
@@ -50132,7 +50141,7 @@ function describeDaemonRuntimeStatus(status) {
|
|
|
50132
50141
|
if (status.status === "not_running") return "Service is not running.";
|
|
50133
50142
|
return "Service runtime status is unknown.";
|
|
50134
50143
|
}
|
|
50135
|
-
function toErrorMessage$
|
|
50144
|
+
function toErrorMessage$13(error) {
|
|
50136
50145
|
if (error instanceof Error) return error.message;
|
|
50137
50146
|
return String(error);
|
|
50138
50147
|
}
|
|
@@ -50162,7 +50171,7 @@ async function stopDaemonProcess(pid, signal) {
|
|
|
50162
50171
|
process.kill(pid, signal);
|
|
50163
50172
|
} catch (error) {
|
|
50164
50173
|
if (isNodeErrorCode(error, "ESRCH")) return true;
|
|
50165
|
-
throw new Error(`Failed to send ${signal} to pid ${String(pid)}: ${toErrorMessage$
|
|
50174
|
+
throw new Error(`Failed to send ${signal} to pid ${String(pid)}: ${toErrorMessage$13(error)}`);
|
|
50166
50175
|
}
|
|
50167
50176
|
if (signal === "SIGKILL") return true;
|
|
50168
50177
|
return await waitForProcessToExit(pid);
|
|
@@ -50412,7 +50421,7 @@ async function resolveDaemonServiceParticipationStatusAfterInstall(input) {
|
|
|
50412
50421
|
return { status: refreshedStatus };
|
|
50413
50422
|
}
|
|
50414
50423
|
async function runDaemonServiceSafeRefresh(input) {
|
|
50415
|
-
|
|
50424
|
+
return await runDaemonReinstall({
|
|
50416
50425
|
agentOverviewHandled: true,
|
|
50417
50426
|
...input.gatewayUrl ? { gatewayUrl: input.gatewayUrl } : {},
|
|
50418
50427
|
...input.atsProfileId ? { profile: input.atsProfileId } : {},
|
|
@@ -50423,8 +50432,6 @@ async function runDaemonServiceSafeRefresh(input) {
|
|
|
50423
50432
|
suppressAgentOverview: true,
|
|
50424
50433
|
suppressInstallOutput: true
|
|
50425
50434
|
});
|
|
50426
|
-
if (outcome.ok && outcome.result === "completed" && outcome.serviceState === "running") return;
|
|
50427
|
-
throw new Error(`ATS Service refresh did not complete: ${outcome.result}`);
|
|
50428
50435
|
}
|
|
50429
50436
|
async function runDaemonServiceParticipationActionStage(input) {
|
|
50430
50437
|
if (input.status.kind === "needs_repair") return await runDaemonServiceParticipationRefresh({
|
|
@@ -50459,11 +50466,39 @@ async function runDaemonServiceParticipationRefresh(input) {
|
|
|
50459
50466
|
data: { reasonCode: input.accountIssue.reasonCode }
|
|
50460
50467
|
});
|
|
50461
50468
|
try {
|
|
50462
|
-
await runDaemonServiceSafeRefresh({
|
|
50469
|
+
const refreshOutcome = await runDaemonServiceSafeRefresh({
|
|
50463
50470
|
atsProfileId: input.input.atsProfileId,
|
|
50464
50471
|
gatewayUrl: input.input.gatewayUrl,
|
|
50465
50472
|
view: input.input.view
|
|
50466
50473
|
});
|
|
50474
|
+
if (refreshOutcome.ok && (refreshOutcome.result === "completed" || refreshOutcome.result === "stopped_safe") && refreshOutcome.serviceState === "stopped") {
|
|
50475
|
+
const startMapped = await mapDaemonBackgroundStartResult(await runDaemonBackgroundStartForDecision({
|
|
50476
|
+
gatewayUrl: input.input.gatewayUrl,
|
|
50477
|
+
...input.input.atsProfileId ? { profile: input.input.atsProfileId } : {},
|
|
50478
|
+
view: input.input.view
|
|
50479
|
+
}), {
|
|
50480
|
+
expectedVersion: input.expectedVersion,
|
|
50481
|
+
presenter: input.input.presenter,
|
|
50482
|
+
codePrefix: input.codePrefix
|
|
50483
|
+
});
|
|
50484
|
+
if (startMapped.status !== "aligned") return startMapped;
|
|
50485
|
+
const accountIssueAfterStart = await resolveDaemonServiceAccountAlignmentIssue(input.input);
|
|
50486
|
+
if (accountIssueAfterStart) {
|
|
50487
|
+
renderDaemonStartNeedsAttention({
|
|
50488
|
+
presenter: input.input.presenter,
|
|
50489
|
+
codePrefix: input.codePrefix,
|
|
50490
|
+
summary: accountIssueAfterStart.summary
|
|
50491
|
+
});
|
|
50492
|
+
input.input.presenter.line({
|
|
50493
|
+
code: `${input.codePrefix}.account_alignment_failed`,
|
|
50494
|
+
text: accountIssueAfterStart.summary,
|
|
50495
|
+
data: { reasonCode: accountIssueAfterStart.reasonCode }
|
|
50496
|
+
});
|
|
50497
|
+
return { status: "needs_attention" };
|
|
50498
|
+
}
|
|
50499
|
+
return startMapped;
|
|
50500
|
+
}
|
|
50501
|
+
if (!(refreshOutcome.ok && refreshOutcome.result === "completed" && refreshOutcome.serviceState === "running")) throw new Error(`ATS Service refresh did not complete: ${refreshOutcome.result}`);
|
|
50467
50502
|
} catch (error) {
|
|
50468
50503
|
renderDaemonStartNeedsAttention({
|
|
50469
50504
|
presenter: input.input.presenter,
|
|
@@ -50471,7 +50506,7 @@ async function runDaemonServiceParticipationRefresh(input) {
|
|
|
50471
50506
|
summary: "ATS Service was repaired, but it is not running yet. Local Wake work will keep waiting until ATS Service starts. Run `ats service start`."
|
|
50472
50507
|
});
|
|
50473
50508
|
return {
|
|
50474
|
-
errorMessage: toErrorMessage$
|
|
50509
|
+
errorMessage: toErrorMessage$36(error),
|
|
50475
50510
|
status: "needs_attention"
|
|
50476
50511
|
};
|
|
50477
50512
|
}
|
|
@@ -50778,7 +50813,7 @@ async function runDaemonServiceAutoHeal(input) {
|
|
|
50778
50813
|
cooldownUntil: null
|
|
50779
50814
|
};
|
|
50780
50815
|
} catch (error) {
|
|
50781
|
-
const errorMessage = toErrorMessage$
|
|
50816
|
+
const errorMessage = toErrorMessage$12(error);
|
|
50782
50817
|
await recordDaemonServiceRepairFailure({
|
|
50783
50818
|
actions: safeActions,
|
|
50784
50819
|
errorMessage
|
|
@@ -50857,7 +50892,7 @@ async function terminateDaemonOwnedProcess(pid) {
|
|
|
50857
50892
|
const deadline = Date.now() + AUTO_HEAL_DUPLICATE_WAIT_MS;
|
|
50858
50893
|
while (Date.now() < deadline) {
|
|
50859
50894
|
if (!isPidAlive$1(pid)) return;
|
|
50860
|
-
await sleep$
|
|
50895
|
+
await sleep$3(AUTO_HEAL_DUPLICATE_POLL_MS);
|
|
50861
50896
|
}
|
|
50862
50897
|
if (isPidAlive$1(pid)) process$1.kill(pid, "SIGKILL");
|
|
50863
50898
|
}
|
|
@@ -50882,10 +50917,10 @@ function isPidAlive$1(pid) {
|
|
|
50882
50917
|
return !(error instanceof Error && error.code === "ESRCH");
|
|
50883
50918
|
}
|
|
50884
50919
|
}
|
|
50885
|
-
async function sleep$
|
|
50920
|
+
async function sleep$3(ms) {
|
|
50886
50921
|
await new Promise((resolve) => setTimeout(resolve, ms));
|
|
50887
50922
|
}
|
|
50888
|
-
function toErrorMessage$
|
|
50923
|
+
function toErrorMessage$12(error) {
|
|
50889
50924
|
if (error instanceof Error && error.message.trim().length > 0) return error.message;
|
|
50890
50925
|
return String(error);
|
|
50891
50926
|
}
|
|
@@ -51068,7 +51103,7 @@ async function waitForDaemonStartupAlignmentSettlement(input) {
|
|
|
51068
51103
|
cliScriptPath: input.cliScriptPath
|
|
51069
51104
|
}).catch(() => null);
|
|
51070
51105
|
if (!inventory) {
|
|
51071
|
-
await sleep$
|
|
51106
|
+
await sleep$2(input.pollMs);
|
|
51072
51107
|
continue;
|
|
51073
51108
|
}
|
|
51074
51109
|
const decision = resolveDaemonServiceAlignmentDecision({
|
|
@@ -51089,11 +51124,11 @@ async function waitForDaemonStartupAlignmentSettlement(input) {
|
|
|
51089
51124
|
cooldownUntil: null,
|
|
51090
51125
|
backupDataPath: null
|
|
51091
51126
|
};
|
|
51092
|
-
await sleep$
|
|
51127
|
+
await sleep$2(input.pollMs);
|
|
51093
51128
|
}
|
|
51094
51129
|
return null;
|
|
51095
51130
|
}
|
|
51096
|
-
async function sleep$
|
|
51131
|
+
async function sleep$2(ms) {
|
|
51097
51132
|
await new Promise((resolve) => {
|
|
51098
51133
|
setTimeout(resolve, ms);
|
|
51099
51134
|
});
|
|
@@ -58101,7 +58136,7 @@ async function runDoctorProfileCheck(input) {
|
|
|
58101
58136
|
}
|
|
58102
58137
|
atsProfile = {
|
|
58103
58138
|
ok: false,
|
|
58104
|
-
message: `ats-profile failed: ${toErrorMessage$
|
|
58139
|
+
message: `ats-profile failed: ${toErrorMessage$11(error)}`
|
|
58105
58140
|
};
|
|
58106
58141
|
}
|
|
58107
58142
|
emitCheckResult(input.presenter, atsProfile, {
|
|
@@ -58488,7 +58523,7 @@ async function runCheck(label, fn) {
|
|
|
58488
58523
|
} catch (err) {
|
|
58489
58524
|
return {
|
|
58490
58525
|
ok: false,
|
|
58491
|
-
message: `${label} failed: ${toErrorMessage$
|
|
58526
|
+
message: `${label} failed: ${toErrorMessage$11(err)}`
|
|
58492
58527
|
};
|
|
58493
58528
|
}
|
|
58494
58529
|
}
|
|
@@ -58613,7 +58648,7 @@ async function maybePromptRepairAfterLogin(presenter) {
|
|
|
58613
58648
|
function normalizeDoctorHumanText(text) {
|
|
58614
58649
|
return text.replace(DOCTOR_TEXT_PREFIX_RE, "");
|
|
58615
58650
|
}
|
|
58616
|
-
function toErrorMessage$
|
|
58651
|
+
function toErrorMessage$11(err) {
|
|
58617
58652
|
if (err instanceof Error) return err.message;
|
|
58618
58653
|
return String(err);
|
|
58619
58654
|
}
|
|
@@ -61297,7 +61332,7 @@ async function resolvePrepareReadinessApiEvidence(input) {
|
|
|
61297
61332
|
} catch (error) {
|
|
61298
61333
|
console.warn("[ats.prepare_readiness.api_read_failed]", {
|
|
61299
61334
|
event: "cli.prepare_readiness.api_read_failed",
|
|
61300
|
-
error: toErrorMessage$
|
|
61335
|
+
error: toErrorMessage$10(error),
|
|
61301
61336
|
profileId: input.profile.atsProfileId
|
|
61302
61337
|
});
|
|
61303
61338
|
return unavailableEvidence({
|
|
@@ -61338,7 +61373,7 @@ function unavailableEvidence(input) {
|
|
|
61338
61373
|
status: "unavailable"
|
|
61339
61374
|
};
|
|
61340
61375
|
}
|
|
61341
|
-
function toErrorMessage$
|
|
61376
|
+
function toErrorMessage$10(error) {
|
|
61342
61377
|
if (error instanceof Error) {
|
|
61343
61378
|
const message = error.message.trim();
|
|
61344
61379
|
return message.length > 0 ? message : "unknown error";
|
|
@@ -63603,58 +63638,6 @@ async function collectStartLocalReadiness(input) {
|
|
|
63603
63638
|
};
|
|
63604
63639
|
}
|
|
63605
63640
|
|
|
63606
|
-
//#endregion
|
|
63607
|
-
//#region src/system/current-local-runtime-reply-readiness.ts
|
|
63608
|
-
async function readCurrentLocalRuntimeReplyReadiness(input) {
|
|
63609
|
-
return await createCurrentDeviceApi(createCliApiClientFoundation(input.gatewayUrl)).getCurrentLocalRuntimeReplyReadiness();
|
|
63610
|
-
}
|
|
63611
|
-
async function assertCurrentLocalRuntimeCanReceiveWake(input) {
|
|
63612
|
-
let response;
|
|
63613
|
-
try {
|
|
63614
|
-
response = await readCurrentLocalRuntimeReplyReadiness({ gatewayUrl: input.gatewayUrl });
|
|
63615
|
-
} catch (error) {
|
|
63616
|
-
throw new Error(formatCurrentLocalRuntimeReplyReadinessFailure({
|
|
63617
|
-
commandLabel: input.commandLabel,
|
|
63618
|
-
detail: toErrorMessage$11(error),
|
|
63619
|
-
supportCode: "current_reply_readiness.read_failed"
|
|
63620
|
-
}));
|
|
63621
|
-
}
|
|
63622
|
-
const mismatchSupportCode = resolveCurrentTargetMismatchSupportCode({
|
|
63623
|
-
response,
|
|
63624
|
-
runtimeIdentity: input.runtimeIdentity
|
|
63625
|
-
});
|
|
63626
|
-
if (mismatchSupportCode) throw new Error(formatCurrentLocalRuntimeReplyReadinessFailure({
|
|
63627
|
-
commandLabel: input.commandLabel,
|
|
63628
|
-
supportCode: mismatchSupportCode
|
|
63629
|
-
}));
|
|
63630
|
-
if (response.canReplyFromThisComputer && response.service.connected && response.service.matchingCurrentRuntime) return response;
|
|
63631
|
-
throw new Error(formatCurrentLocalRuntimeReplyReadinessFailure({
|
|
63632
|
-
commandLabel: input.commandLabel,
|
|
63633
|
-
detail: response.message,
|
|
63634
|
-
supportCode: resolveCurrentReplyReadinessSupportCode(response)
|
|
63635
|
-
}));
|
|
63636
|
-
}
|
|
63637
|
-
function resolveCurrentTargetMismatchSupportCode(input) {
|
|
63638
|
-
if (input.response.currentTarget.availability !== "resolved") return "current_reply_readiness.current_target_missing";
|
|
63639
|
-
if (input.response.currentTarget.deviceId !== input.runtimeIdentity.deviceId) return "current_reply_readiness.device_mismatch";
|
|
63640
|
-
if (input.response.currentTarget.runtimeLane !== input.runtimeIdentity.runtimeLane) return "current_reply_readiness.lane_mismatch";
|
|
63641
|
-
return null;
|
|
63642
|
-
}
|
|
63643
|
-
function resolveCurrentReplyReadinessSupportCode(response) {
|
|
63644
|
-
return response.service.reasonCodes[0] ?? response.runtime.reasonCodes[0] ?? `current_reply_readiness.${response.primaryBlocker}`;
|
|
63645
|
-
}
|
|
63646
|
-
function formatCurrentLocalRuntimeReplyReadinessFailure(input) {
|
|
63647
|
-
return `ATS Service started, but ATS could not confirm this computer can receive local Wake work yet. Keep ATS Service running, then run ${input.commandLabel ?? "setup"} again from this terminal. Support code: ${input.supportCode}.${input.detail ? ` Detail: ${input.detail}` : ""}`;
|
|
63648
|
-
}
|
|
63649
|
-
function toErrorMessage$11(error) {
|
|
63650
|
-
if (error instanceof Error) {
|
|
63651
|
-
const message = error.message.trim();
|
|
63652
|
-
return message.length > 0 ? message : "unknown error";
|
|
63653
|
-
}
|
|
63654
|
-
const message = String(error ?? "").trim();
|
|
63655
|
-
return message.length > 0 ? message : "unknown error";
|
|
63656
|
-
}
|
|
63657
|
-
|
|
63658
63641
|
//#endregion
|
|
63659
63642
|
//#region src/system/selected-local-runtime-reporting.ts
|
|
63660
63643
|
function resolveSelectedLocalRuntimeReadiness(input) {
|
|
@@ -64468,8 +64451,6 @@ const PREPARE_SESSION_MAX_RECONNECT_ATTEMPTS = 3;
|
|
|
64468
64451
|
const PREPARE_SESSION_RECONNECT_DELAY_MS = 1e3;
|
|
64469
64452
|
const REPORT_RUNTIME_CONNECTION_MAX_ATTEMPTS = 12;
|
|
64470
64453
|
const REPORT_RUNTIME_CONNECTION_RETRY_DELAY_MS = 1e3;
|
|
64471
|
-
const ROUTE_CATALOG_SYNC_MAX_ATTEMPTS$1 = 12;
|
|
64472
|
-
const ROUTE_CATALOG_SYNC_RETRY_DELAY_MS$1 = 1e3;
|
|
64473
64454
|
const TERMINAL_PREPARE_STEP_ORDER = [
|
|
64474
64455
|
"prepare_selected_agents",
|
|
64475
64456
|
"refresh_service",
|
|
@@ -64509,7 +64490,7 @@ async function runPrepareSessionExecutor(input) {
|
|
|
64509
64490
|
if (error instanceof PrepareSessionConnectionInterruptedError && reconnectAttempts < PREPARE_SESSION_MAX_RECONNECT_ATTEMPTS) {
|
|
64510
64491
|
reconnectAttempts += 1;
|
|
64511
64492
|
emitHumanStatus(input, "Reconnecting", ["ATS Web connection was interrupted.", "Reconnecting to the setup session..."]);
|
|
64512
|
-
await sleep$
|
|
64493
|
+
await sleep$1(PREPARE_SESSION_RECONNECT_DELAY_MS);
|
|
64513
64494
|
initial = await resolvePrepareSessionToken({
|
|
64514
64495
|
gatewayUrl: input.gatewayUrl,
|
|
64515
64496
|
opaqueToken: input.startSession
|
|
@@ -64785,7 +64766,7 @@ function buildTerminalStep(input) {
|
|
|
64785
64766
|
case "refresh_service": return {
|
|
64786
64767
|
message: "Starting or repairing ATS Service.",
|
|
64787
64768
|
run: async () => {
|
|
64788
|
-
|
|
64769
|
+
const gate = await runDaemonServiceParticipationGate({
|
|
64789
64770
|
intent: "start",
|
|
64790
64771
|
presenter: input.input.presenter,
|
|
64791
64772
|
resolvedView: input.input.runtime.resolvedView,
|
|
@@ -64795,7 +64776,8 @@ function buildTerminalStep(input) {
|
|
|
64795
64776
|
...input.humanProfileId ? { atsProfileId: input.humanProfileId } : {},
|
|
64796
64777
|
forcePrompt: true,
|
|
64797
64778
|
view: input.input.view
|
|
64798
|
-
})
|
|
64779
|
+
});
|
|
64780
|
+
if (gate.status !== "aligned") throw new Error(gate.errorMessage ?? "ATS Service is not connected yet.");
|
|
64799
64781
|
emitHumanStatus(input.input, "Current step", ["Connecting this computer to ATS.", "Saving this computer's ATS Service identity so ATS Web can use it."]);
|
|
64800
64782
|
const runtimeIdentity = await syncLocalSetupCurrentDeviceTargetFromServiceContract({ gatewayUrl: input.input.gatewayUrl });
|
|
64801
64783
|
emitHumanStatus(input.input, "Current step", ["Checking local setup state.", "Reading installed local agents and ATS Service compatibility."]);
|
|
@@ -64909,7 +64891,7 @@ async function connectSelectedLocalAgentsToAts(input) {
|
|
|
64909
64891
|
} catch (error) {
|
|
64910
64892
|
if (!isTransientSelectedAgentConnectionError(error) || attempt >= REPORT_RUNTIME_CONNECTION_MAX_ATTEMPTS) throw error;
|
|
64911
64893
|
lastTransientError = error;
|
|
64912
|
-
await sleep$
|
|
64894
|
+
await sleep$1(REPORT_RUNTIME_CONNECTION_RETRY_DELAY_MS);
|
|
64913
64895
|
}
|
|
64914
64896
|
throw lastTransientError ?? /* @__PURE__ */ new Error("ATS could not connect local agents.");
|
|
64915
64897
|
}
|
|
@@ -64925,22 +64907,14 @@ async function connectSelectedLocalAgentsToAtsOnce(input) {
|
|
|
64925
64907
|
readiness,
|
|
64926
64908
|
localAgentIds: input.localAgentIds
|
|
64927
64909
|
}));
|
|
64928
|
-
if (input.syncRouteCatalog) await
|
|
64929
|
-
confirmWakeAvailability: async () => {
|
|
64930
|
-
await assertCurrentLocalRuntimeCanReceiveWake({
|
|
64931
|
-
gatewayUrl: input.gatewayUrl,
|
|
64932
|
-
runtimeIdentity
|
|
64933
|
-
});
|
|
64934
|
-
},
|
|
64935
|
-
reason: "prepare_selected_agents_connected"
|
|
64936
|
-
});
|
|
64910
|
+
if (input.syncRouteCatalog) await notifyRouteCatalogAfterPrepare({ reason: "prepare_selected_agents_reported" });
|
|
64937
64911
|
return {
|
|
64938
64912
|
...runtimeIdentity,
|
|
64939
64913
|
localReadinessSnapshot: buildPrepareLocalReadinessSnapshot(readiness)
|
|
64940
64914
|
};
|
|
64941
64915
|
}
|
|
64942
64916
|
function isTransientSelectedAgentConnectionError(error) {
|
|
64943
|
-
const rawMessage = toErrorMessage$
|
|
64917
|
+
const rawMessage = toErrorMessage$9(error).toLowerCase();
|
|
64944
64918
|
return rawMessage.includes("service has not finished starting") || rawMessage.includes("ats service is not running") || rawMessage.includes("service.not_running") || rawMessage.includes("service_contract_unavailable") || rawMessage.includes("runtime.reporting.write_failed");
|
|
64945
64919
|
}
|
|
64946
64920
|
async function verifySelectedLocalAgentsConnectedToAts(input) {
|
|
@@ -64961,10 +64935,6 @@ async function verifySelectedLocalAgentsConnectedToAts(input) {
|
|
|
64961
64935
|
runtimeIdentity,
|
|
64962
64936
|
selectedReadiness
|
|
64963
64937
|
});
|
|
64964
|
-
await assertCurrentLocalRuntimeCanReceiveWake({
|
|
64965
|
-
gatewayUrl: input.gatewayUrl,
|
|
64966
|
-
runtimeIdentity
|
|
64967
|
-
});
|
|
64968
64938
|
return {
|
|
64969
64939
|
...runtimeIdentity,
|
|
64970
64940
|
localReadinessSnapshot: buildPrepareLocalReadinessSnapshot(readiness)
|
|
@@ -64980,20 +64950,8 @@ async function readTerminalRuntimeIdentityFromServiceContract() {
|
|
|
64980
64950
|
runtimeLane
|
|
64981
64951
|
};
|
|
64982
64952
|
}
|
|
64983
|
-
async function
|
|
64984
|
-
|
|
64985
|
-
for (let attempt = 1; attempt <= ROUTE_CATALOG_SYNC_MAX_ATTEMPTS$1; attempt++) {
|
|
64986
|
-
latestDelivery = await notifyDaemonRouteCatalogChanged({ reason: input.reason });
|
|
64987
|
-
if (latestDelivery.delivery === "control_plane") return latestDelivery;
|
|
64988
|
-
if (attempt < ROUTE_CATALOG_SYNC_MAX_ATTEMPTS$1) await sleep$2(ROUTE_CATALOG_SYNC_RETRY_DELAY_MS$1);
|
|
64989
|
-
}
|
|
64990
|
-
if (latestDelivery?.delivery === "signal" && input.confirmWakeAvailability) try {
|
|
64991
|
-
await input.confirmWakeAvailability();
|
|
64992
|
-
return latestDelivery;
|
|
64993
|
-
} catch (error) {
|
|
64994
|
-
throw new Error(formatRouteCatalogSyncFailure$1(latestDelivery, error));
|
|
64995
|
-
}
|
|
64996
|
-
throw new Error(formatRouteCatalogSyncFailure$1(latestDelivery));
|
|
64953
|
+
async function notifyRouteCatalogAfterPrepare(input) {
|
|
64954
|
+
await notifyDaemonRouteCatalogChanged({ reason: input.reason });
|
|
64997
64955
|
}
|
|
64998
64956
|
async function assertSelectedRuntimeReadinessIsReadableByAts(input) {
|
|
64999
64957
|
const capabilityRefs = input.selectedReadiness.map((decision) => decision.capabilityRef);
|
|
@@ -65007,12 +64965,7 @@ async function assertSelectedRuntimeReadinessIsReadableByAts(input) {
|
|
|
65007
64965
|
const missingCapabilityRef = capabilityRefs.find((capabilityRef) => !runnableCapabilityRefs.has(capabilityRef));
|
|
65008
64966
|
if (response.status === "ready" && response.runtimeId && !missingCapabilityRef) return;
|
|
65009
64967
|
const reasonCode = response.summary.reasonCodes[0] ?? response.reason ?? (missingCapabilityRef ? "prepare_readiness.capability_not_ready" : "prepare_readiness.not_ready");
|
|
65010
|
-
throw new Error(`ATS could not verify that selected agents
|
|
65011
|
-
}
|
|
65012
|
-
function formatRouteCatalogSyncFailure$1(latestDelivery, error) {
|
|
65013
|
-
const supportCode = latestDelivery?.delivery === "signal" ? `route_catalog_sync.${latestDelivery.fallbackReason}` : "route_catalog_sync.unavailable";
|
|
65014
|
-
const detail = error ? ` Detail: ${toErrorMessage$10(error)}` : "";
|
|
65015
|
-
return `ATS Service started, but ATS could not confirm that selected agents are available for Wake yet. Keep ATS Service running, then run \`${formatAtsCliCommand("ats setup --view agent")}\` again. You can also run \`${formatAtsCliCommand("ats service status --view agent")}\` to inspect the local service. Support code: ${supportCode}.${detail}`;
|
|
64968
|
+
throw new Error(`ATS could not verify that selected local agents were reported to ATS yet. Keep ATS Service running, then run \`${formatAtsCliCommand("ats setup --view agent")}\` again. You can also run \`${formatAtsCliCommand("ats service status --view agent")}\` to inspect the local service. Support code: ${reasonCode}.`);
|
|
65016
64969
|
}
|
|
65017
64970
|
function buildPrepareLocalReadinessSnapshot(readiness) {
|
|
65018
64971
|
return {
|
|
@@ -65259,7 +65212,7 @@ function toStatusCodeSlug(title) {
|
|
|
65259
65212
|
const slug = title.toLowerCase().replaceAll(/[^a-z0-9]+/g, "_").replaceAll(/^_+|_+$/g, "");
|
|
65260
65213
|
return slug.length > 0 ? slug : "status";
|
|
65261
65214
|
}
|
|
65262
|
-
function toErrorMessage$
|
|
65215
|
+
function toErrorMessage$9(error) {
|
|
65263
65216
|
if (error instanceof Error) {
|
|
65264
65217
|
const message = error.message.trim();
|
|
65265
65218
|
return message.length > 0 ? message : "unknown error";
|
|
@@ -65291,7 +65244,7 @@ function errorFromPrepareSessionServerError(input) {
|
|
|
65291
65244
|
if (input.code === "prepare.session.revision_conflict") return new PrepareSessionRevisionConflictError(input.message);
|
|
65292
65245
|
return new Error(input.message);
|
|
65293
65246
|
}
|
|
65294
|
-
async function sleep$
|
|
65247
|
+
async function sleep$1(ms) {
|
|
65295
65248
|
await new Promise((resolve) => {
|
|
65296
65249
|
setTimeout(resolve, ms);
|
|
65297
65250
|
});
|
|
@@ -67268,7 +67221,7 @@ async function waitForWebLocalAgentPreparation(input) {
|
|
|
67268
67221
|
const nowMs = Date.now();
|
|
67269
67222
|
if (nowMs >= deadlineMs) throw new Error(`ATS waited ${formatWaitDuration(input.waitConfig.timeoutMs)} for a local-agent choice in ATS Web. Copy a fresh setup command from ATS Web and run it again.`);
|
|
67270
67223
|
const sleepMs = Math.min(input.waitConfig.pollIntervalMs, Math.max(0, deadlineMs - nowMs));
|
|
67271
|
-
if (sleepMs > 0) await sleep
|
|
67224
|
+
if (sleepMs > 0) await sleep(sleepMs);
|
|
67272
67225
|
}
|
|
67273
67226
|
}
|
|
67274
67227
|
function resolveWebLocalAgentPreparationWaitConfig() {
|
|
@@ -67297,7 +67250,7 @@ function formatWaitDuration(timeoutMs) {
|
|
|
67297
67250
|
if (seconds < 60) return `${seconds} seconds`;
|
|
67298
67251
|
return `${Math.round(seconds / 60)} minutes`;
|
|
67299
67252
|
}
|
|
67300
|
-
function sleep
|
|
67253
|
+
function sleep(ms) {
|
|
67301
67254
|
return new Promise((resolve) => {
|
|
67302
67255
|
setTimeout(resolve, ms);
|
|
67303
67256
|
});
|
|
@@ -68239,8 +68192,6 @@ function isAgentProfile(profile) {
|
|
|
68239
68192
|
|
|
68240
68193
|
//#endregion
|
|
68241
68194
|
//#region src/commands/setup.ts
|
|
68242
|
-
const ROUTE_CATALOG_SYNC_MAX_ATTEMPTS = 8;
|
|
68243
|
-
const ROUTE_CATALOG_SYNC_RETRY_DELAY_MS = 750;
|
|
68244
68195
|
const SETUP_COMMAND_LOCK_PROFILE = "setup";
|
|
68245
68196
|
const SETUP_COMMAND_LOCK_KEY = "setup-command";
|
|
68246
68197
|
async function runSetup(input) {
|
|
@@ -68325,19 +68276,7 @@ async function runSetupUnlocked(input) {
|
|
|
68325
68276
|
localAgentIds: selectedLocalAgentIds
|
|
68326
68277
|
});
|
|
68327
68278
|
assertSelectedLocalRuntimeReportsAccepted(runtimeReports);
|
|
68328
|
-
const routeCatalogSync = selectedLocalAgentIds.length > 0 ? await
|
|
68329
|
-
confirmWakeAvailability: async () => await assertSetupCompletionCanReceiveWake({
|
|
68330
|
-
gatewayUrl,
|
|
68331
|
-
runtimeIdentity,
|
|
68332
|
-
selectedLocalAgentIds
|
|
68333
|
-
}),
|
|
68334
|
-
reason: "setup_to_wake_path_connected"
|
|
68335
|
-
}) : null;
|
|
68336
|
-
await assertSetupCompletionCanReceiveWake({
|
|
68337
|
-
gatewayUrl,
|
|
68338
|
-
runtimeIdentity,
|
|
68339
|
-
selectedLocalAgentIds
|
|
68340
|
-
});
|
|
68279
|
+
const routeCatalogSync = selectedLocalAgentIds.length > 0 ? await notifyRouteCatalogAfterSetup({ reason: "setup_local_capabilities_reported" }) : null;
|
|
68341
68280
|
emitSetupStatus(runtime, "Updating ATS skills", ["Updating ATS skills so local agents use the current ATS instructions."]);
|
|
68342
68281
|
await ensureSetupManagedSkills({ view: input.view });
|
|
68343
68282
|
emitSetupComplete({
|
|
@@ -68414,25 +68353,8 @@ function assertStartLocalAgentsEnableCompleted(result) {
|
|
|
68414
68353
|
if (!blockingError) return;
|
|
68415
68354
|
throw new Error(blockingError.nextSteps?.[0] ? `ATS could not set up ${blockingError.agentId}. Run \`${formatAtsCliCommand(blockingError.nextSteps[0])}\`, then run setup again. Detail: ${blockingError.reason}` : `ATS could not set up ${blockingError.agentId}. Detail: ${blockingError.reason}`);
|
|
68416
68355
|
}
|
|
68417
|
-
async function
|
|
68418
|
-
|
|
68419
|
-
for (let attempt = 1; attempt <= ROUTE_CATALOG_SYNC_MAX_ATTEMPTS; attempt++) {
|
|
68420
|
-
latestDelivery = await notifyDaemonRouteCatalogChanged({ reason: input.reason });
|
|
68421
|
-
if (latestDelivery.delivery === "control_plane") return latestDelivery;
|
|
68422
|
-
if (attempt < ROUTE_CATALOG_SYNC_MAX_ATTEMPTS) await sleep(ROUTE_CATALOG_SYNC_RETRY_DELAY_MS);
|
|
68423
|
-
}
|
|
68424
|
-
if (latestDelivery?.delivery === "signal" && input.confirmWakeAvailability) try {
|
|
68425
|
-
await input.confirmWakeAvailability();
|
|
68426
|
-
return latestDelivery;
|
|
68427
|
-
} catch (error) {
|
|
68428
|
-
throw new Error(formatRouteCatalogSyncFailure(latestDelivery, error));
|
|
68429
|
-
}
|
|
68430
|
-
throw new Error(formatRouteCatalogSyncFailure(latestDelivery));
|
|
68431
|
-
}
|
|
68432
|
-
function formatRouteCatalogSyncFailure(latestDelivery, error) {
|
|
68433
|
-
const supportCode = latestDelivery?.delivery === "signal" ? `route_catalog_sync.${latestDelivery.fallbackReason}` : "route_catalog_sync.unavailable";
|
|
68434
|
-
const detail = error ? ` Detail: ${toErrorMessage$9(error)}` : "";
|
|
68435
|
-
return `ATS Service started, but ATS could not confirm that selected agents are available for Wake yet. Keep ATS Service running, then run \`${formatAtsCliCommand("ats setup --view agent")}\` again. You can also run \`${formatAtsCliCommand("ats service status --view agent")}\` to inspect the local service. Support code: ${supportCode}.${detail}`;
|
|
68356
|
+
async function notifyRouteCatalogAfterSetup(input) {
|
|
68357
|
+
return await notifyDaemonRouteCatalogChanged({ reason: input.reason });
|
|
68436
68358
|
}
|
|
68437
68359
|
function emitSetupStatus(runtime, title, lines) {
|
|
68438
68360
|
if (runtime.resolvedView !== "human") return;
|
|
@@ -68462,27 +68384,12 @@ async function emitSetupCompleteForDelegatedPath(input) {
|
|
|
68462
68384
|
}
|
|
68463
68385
|
async function resolveDelegatedSetupCompletionFacts(input) {
|
|
68464
68386
|
const completionFacts = input.setupResult.completionFacts;
|
|
68465
|
-
if (completionFacts) {
|
|
68466
|
-
|
|
68467
|
-
|
|
68468
|
-
|
|
68469
|
-
|
|
68470
|
-
|
|
68471
|
-
}),
|
|
68472
|
-
reason: "setup_profile_connection_path_connected"
|
|
68473
|
-
}) : null;
|
|
68474
|
-
await assertSetupCompletionCanReceiveWake({
|
|
68475
|
-
gatewayUrl: input.gatewayUrl,
|
|
68476
|
-
runtimeIdentity: completionFacts.runtimeIdentity,
|
|
68477
|
-
selectedLocalAgentIds: completionFacts.selectedLocalAgentIds
|
|
68478
|
-
});
|
|
68479
|
-
return {
|
|
68480
|
-
routeCatalogSync,
|
|
68481
|
-
runtimeIdentity: completionFacts.runtimeIdentity,
|
|
68482
|
-
runtimeReports: completionFacts.runtimeReports,
|
|
68483
|
-
selectedLocalAgentIds: completionFacts.selectedLocalAgentIds
|
|
68484
|
-
};
|
|
68485
|
-
}
|
|
68387
|
+
if (completionFacts) return {
|
|
68388
|
+
routeCatalogSync: completionFacts.runtimeReports.length > 0 ? await notifyRouteCatalogAfterSetup({ reason: "setup_profile_capability_reported" }) : null,
|
|
68389
|
+
runtimeIdentity: completionFacts.runtimeIdentity,
|
|
68390
|
+
runtimeReports: completionFacts.runtimeReports,
|
|
68391
|
+
selectedLocalAgentIds: completionFacts.selectedLocalAgentIds
|
|
68392
|
+
};
|
|
68486
68393
|
const sessionSelectedLocalAgentIds = input.setupResult.setupSessionSnapshot?.selectedLocalAgentIds ?? null;
|
|
68487
68394
|
if (!(sessionSelectedLocalAgentIds || hasExplicitLocalAgentSelection(input.setupInput))) return {
|
|
68488
68395
|
routeCatalogSync: null,
|
|
@@ -68522,34 +68429,13 @@ async function resolveDelegatedSetupCompletionFacts(input) {
|
|
|
68522
68429
|
localAgentIds: selectedLocalAgentIds
|
|
68523
68430
|
});
|
|
68524
68431
|
assertSelectedLocalRuntimeReportsAccepted(runtimeReports);
|
|
68525
|
-
const routeCatalogSync = await waitForConfirmedRouteCatalogSync({
|
|
68526
|
-
confirmWakeAvailability: async () => await assertSetupCompletionCanReceiveWake({
|
|
68527
|
-
gatewayUrl: input.gatewayUrl,
|
|
68528
|
-
runtimeIdentity,
|
|
68529
|
-
selectedLocalAgentIds
|
|
68530
|
-
}),
|
|
68531
|
-
reason: "setup_delegated_path_connected"
|
|
68532
|
-
});
|
|
68533
|
-
await assertSetupCompletionCanReceiveWake({
|
|
68534
|
-
gatewayUrl: input.gatewayUrl,
|
|
68535
|
-
runtimeIdentity,
|
|
68536
|
-
selectedLocalAgentIds
|
|
68537
|
-
});
|
|
68538
68432
|
return {
|
|
68539
|
-
routeCatalogSync,
|
|
68433
|
+
routeCatalogSync: await notifyRouteCatalogAfterSetup({ reason: "setup_session_capabilities_reported" }),
|
|
68540
68434
|
runtimeIdentity,
|
|
68541
68435
|
runtimeReports,
|
|
68542
68436
|
selectedLocalAgentIds
|
|
68543
68437
|
};
|
|
68544
68438
|
}
|
|
68545
|
-
async function assertSetupCompletionCanReceiveWake(input) {
|
|
68546
|
-
if (input.selectedLocalAgentIds.length === 0) return;
|
|
68547
|
-
if (!input.runtimeIdentity) throw new Error(`ATS Service started, but ATS could not confirm this computer can receive local Wake work yet. Keep ATS Service running, then run \`${formatAtsCliCommand("ats setup --view agent")}\` again. Support code: current_reply_readiness.current_target_missing.`);
|
|
68548
|
-
await assertCurrentLocalRuntimeCanReceiveWake({
|
|
68549
|
-
gatewayUrl: input.gatewayUrl,
|
|
68550
|
-
runtimeIdentity: input.runtimeIdentity
|
|
68551
|
-
});
|
|
68552
|
-
}
|
|
68553
68439
|
function resolveRuntimeIdentityFromSetupSession(snapshot) {
|
|
68554
68440
|
if (!(snapshot?.deviceId && snapshot.runtimeLane)) return null;
|
|
68555
68441
|
return {
|
|
@@ -68576,10 +68462,10 @@ function emitSetupComplete(input) {
|
|
|
68576
68462
|
} : null,
|
|
68577
68463
|
localAgents: {
|
|
68578
68464
|
selectedAgentIds: [...input.selectedLocalAgentIds],
|
|
68579
|
-
|
|
68465
|
+
reportedCapabilities: input.runtimeReports.map((report) => ({
|
|
68580
68466
|
agentId: report.agentId,
|
|
68581
68467
|
capabilityRef: report.capabilityRef,
|
|
68582
|
-
status: report.localParticipationState === "ready" ? "
|
|
68468
|
+
status: report.localParticipationState === "ready" ? "reported" : "blocked",
|
|
68583
68469
|
reasonCodes: [...report.reasonCodes],
|
|
68584
68470
|
runtimeId: report.runtimeReportSubmission.runtimeId
|
|
68585
68471
|
})),
|
|
@@ -68697,19 +68583,6 @@ function normalizeOptionalString$5(value) {
|
|
|
68697
68583
|
const normalized = String(value ?? "").trim();
|
|
68698
68584
|
return normalized.length > 0 ? normalized : null;
|
|
68699
68585
|
}
|
|
68700
|
-
function toErrorMessage$9(error) {
|
|
68701
|
-
if (error instanceof Error) {
|
|
68702
|
-
const message = error.message.trim();
|
|
68703
|
-
return message.length > 0 ? message : "unknown error";
|
|
68704
|
-
}
|
|
68705
|
-
const message = String(error ?? "").trim();
|
|
68706
|
-
return message.length > 0 ? message : "unknown error";
|
|
68707
|
-
}
|
|
68708
|
-
function sleep(ms) {
|
|
68709
|
-
return new Promise((resolve) => {
|
|
68710
|
-
setTimeout(resolve, ms);
|
|
68711
|
-
});
|
|
68712
|
-
}
|
|
68713
68586
|
|
|
68714
68587
|
//#endregion
|
|
68715
68588
|
//#region src/start-shell/next-action-commands.ts
|