agent-transport-system 0.7.9 → 0.7.10
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 +195 -358
- 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.10";
|
|
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
|
}
|
|
@@ -8450,11 +8450,11 @@ function normalizeOptionalText$46(value) {
|
|
|
8450
8450
|
function nowIsoString() {
|
|
8451
8451
|
return (/* @__PURE__ */ new Date()).toISOString();
|
|
8452
8452
|
}
|
|
8453
|
-
function toErrorMessage$
|
|
8453
|
+
function toErrorMessage$36(error) {
|
|
8454
8454
|
if (error instanceof Error) return error.message;
|
|
8455
8455
|
return String(error);
|
|
8456
8456
|
}
|
|
8457
|
-
function sleep$
|
|
8457
|
+
function sleep$9(delayMs) {
|
|
8458
8458
|
return new Promise((resolve) => {
|
|
8459
8459
|
setTimeout(() => {
|
|
8460
8460
|
resolve();
|
|
@@ -10115,7 +10115,7 @@ async function pathExists$4(path) {
|
|
|
10115
10115
|
throw error;
|
|
10116
10116
|
}
|
|
10117
10117
|
}
|
|
10118
|
-
async function sleep$
|
|
10118
|
+
async function sleep$8(ms) {
|
|
10119
10119
|
await new Promise((resolve) => setTimeout(resolve, ms));
|
|
10120
10120
|
}
|
|
10121
10121
|
function buildSystemServiceWaitTimeoutError(input) {
|
|
@@ -10127,7 +10127,7 @@ async function waitForCondition(input) {
|
|
|
10127
10127
|
const pollMs = input.pollMs ?? SYSTEM_SERVICE_POLL_MS;
|
|
10128
10128
|
while (Date.now() < deadline) {
|
|
10129
10129
|
if (await input.until()) return;
|
|
10130
|
-
await sleep$
|
|
10130
|
+
await sleep$8(pollMs);
|
|
10131
10131
|
}
|
|
10132
10132
|
throw await input.onTimeout();
|
|
10133
10133
|
}
|
|
@@ -11348,7 +11348,7 @@ const backupAndCleanRuntimeState = async (input) => {
|
|
|
11348
11348
|
appliedAt: input.nowIso,
|
|
11349
11349
|
backupPaths,
|
|
11350
11350
|
cleanedPaths,
|
|
11351
|
-
errorMessage: toErrorMessage$
|
|
11351
|
+
errorMessage: toErrorMessage$36(error),
|
|
11352
11352
|
fromEpoch: input.fromEpoch,
|
|
11353
11353
|
reason: input.reason,
|
|
11354
11354
|
status: "failed",
|
|
@@ -12195,7 +12195,7 @@ function createSpaceRequestTimeoutError(input) {
|
|
|
12195
12195
|
return error;
|
|
12196
12196
|
}
|
|
12197
12197
|
function createSpaceRequestNetworkError(input) {
|
|
12198
|
-
const error = new Error(`${input.operation} request could not reach ${describeRequestTarget(input.url)} (${toErrorMessage$
|
|
12198
|
+
const error = new Error(`${input.operation} request could not reach ${describeRequestTarget(input.url)} (${toErrorMessage$35(input.cause)})`, { cause: input.cause });
|
|
12199
12199
|
error.code = "network.request_failed";
|
|
12200
12200
|
return error;
|
|
12201
12201
|
}
|
|
@@ -12233,7 +12233,7 @@ function describeRequestTarget(url) {
|
|
|
12233
12233
|
return url;
|
|
12234
12234
|
}
|
|
12235
12235
|
}
|
|
12236
|
-
function toErrorMessage$
|
|
12236
|
+
function toErrorMessage$35(error) {
|
|
12237
12237
|
if (error instanceof Error) {
|
|
12238
12238
|
const message = error.message.trim();
|
|
12239
12239
|
return message.length > 0 ? message : "request failed";
|
|
@@ -12243,7 +12243,7 @@ function toErrorMessage$37(error) {
|
|
|
12243
12243
|
}
|
|
12244
12244
|
function shouldWrapNetworkRequestError(error) {
|
|
12245
12245
|
if (error instanceof TypeError) return true;
|
|
12246
|
-
const message = toErrorMessage$
|
|
12246
|
+
const message = toErrorMessage$35(error).toLowerCase();
|
|
12247
12247
|
return message.includes("fetch failed") || message.includes("failed to fetch") || message.includes("network request failed");
|
|
12248
12248
|
}
|
|
12249
12249
|
|
|
@@ -12306,7 +12306,7 @@ function normalizeProfileIdList(value) {
|
|
|
12306
12306
|
if (!Array.isArray(value)) return [];
|
|
12307
12307
|
return value.map((item) => normalize$1(item)).filter((item) => item.length > 0);
|
|
12308
12308
|
}
|
|
12309
|
-
function toErrorMessage$
|
|
12309
|
+
function toErrorMessage$34(err) {
|
|
12310
12310
|
if (err instanceof Error) return err.message;
|
|
12311
12311
|
return String(err);
|
|
12312
12312
|
}
|
|
@@ -13690,7 +13690,7 @@ async function verifyLaunchContractFiles(input) {
|
|
|
13690
13690
|
};
|
|
13691
13691
|
} catch (error) {
|
|
13692
13692
|
return {
|
|
13693
|
-
errorMessage: toErrorMessage$
|
|
13693
|
+
errorMessage: toErrorMessage$33(error),
|
|
13694
13694
|
ok: false
|
|
13695
13695
|
};
|
|
13696
13696
|
}
|
|
@@ -13717,7 +13717,7 @@ async function verifyCliLaunchContract(input) {
|
|
|
13717
13717
|
return fileCheck;
|
|
13718
13718
|
} catch (error) {
|
|
13719
13719
|
return {
|
|
13720
|
-
errorMessage: `${input.displayName} can't start on this device: ${toErrorMessage$
|
|
13720
|
+
errorMessage: `${input.displayName} can't start on this device: ${toErrorMessage$33(error)}`,
|
|
13721
13721
|
ok: false
|
|
13722
13722
|
};
|
|
13723
13723
|
}
|
|
@@ -13778,7 +13778,7 @@ async function inspectInstalledNodeScriptLaunchCandidate(input) {
|
|
|
13778
13778
|
};
|
|
13779
13779
|
} catch (error) {
|
|
13780
13780
|
return {
|
|
13781
|
-
errorMessage: `${input.displayName} is installed, but ATS could not inspect its launch files: ${toErrorMessage$
|
|
13781
|
+
errorMessage: `${input.displayName} is installed, but ATS could not inspect its launch files: ${toErrorMessage$33(error)}`,
|
|
13782
13782
|
ok: false
|
|
13783
13783
|
};
|
|
13784
13784
|
}
|
|
@@ -13975,7 +13975,7 @@ function shortenPathForDisplay(path) {
|
|
|
13975
13975
|
function resolveNodeVersionFromPath(path) {
|
|
13976
13976
|
return normalizeOptionalText$40(path.match(NODE_VERSION_PATH_RE)?.[1]);
|
|
13977
13977
|
}
|
|
13978
|
-
function toErrorMessage$
|
|
13978
|
+
function toErrorMessage$33(error) {
|
|
13979
13979
|
return error instanceof Error ? error.message : String(error);
|
|
13980
13980
|
}
|
|
13981
13981
|
|
|
@@ -14984,7 +14984,7 @@ async function invokeOpenClawWithSingleContextHeal(input) {
|
|
|
14984
14984
|
createRebuildFailedError: (error) => new OpenClawRuntimeError({
|
|
14985
14985
|
code: "context.rebuild_failed",
|
|
14986
14986
|
errorType: "adapter",
|
|
14987
|
-
message: `context.rebuild_failed: ${toErrorMessage$
|
|
14987
|
+
message: `context.rebuild_failed: ${toErrorMessage$32(error)}`
|
|
14988
14988
|
}),
|
|
14989
14989
|
invokeOnce: (sessionId) => invokeOpenClawOnce({
|
|
14990
14990
|
openClawAgentId: input.openClawAgentId,
|
|
@@ -15035,11 +15035,11 @@ async function invokeOpenClawOnce(input) {
|
|
|
15035
15035
|
throw new OpenClawRuntimeError({
|
|
15036
15036
|
code: "upstream_unreachable",
|
|
15037
15037
|
errorType: "adapter",
|
|
15038
|
-
message: `upstream_unreachable: ${toErrorMessage$
|
|
15038
|
+
message: `upstream_unreachable: ${toErrorMessage$32(error)}`
|
|
15039
15039
|
});
|
|
15040
15040
|
}
|
|
15041
15041
|
}
|
|
15042
|
-
function toErrorMessage$
|
|
15042
|
+
function toErrorMessage$32(error) {
|
|
15043
15043
|
if (error instanceof Error) return error.message;
|
|
15044
15044
|
return String(error);
|
|
15045
15045
|
}
|
|
@@ -15332,7 +15332,7 @@ function toOpenClawGatewayTransportError(error) {
|
|
|
15332
15332
|
});
|
|
15333
15333
|
const stderr = normalizeOptionalText$32(error?.stderr);
|
|
15334
15334
|
const stdout = normalizeOptionalText$32(error?.stdout);
|
|
15335
|
-
return classifyGatewayFailure(stderr ?? stdout ?? toErrorMessage$
|
|
15335
|
+
return classifyGatewayFailure(stderr ?? stdout ?? toErrorMessage$31(error));
|
|
15336
15336
|
}
|
|
15337
15337
|
function classifyGatewayFailure(message) {
|
|
15338
15338
|
return new OpenClawGatewayTransportError(classifyOpenClawFailureMessage({ message }));
|
|
@@ -15341,7 +15341,7 @@ function normalizeOptionalText$32(value) {
|
|
|
15341
15341
|
const normalized = String(value ?? "").trim();
|
|
15342
15342
|
return normalized.length > 0 ? normalized : null;
|
|
15343
15343
|
}
|
|
15344
|
-
function toErrorMessage$
|
|
15344
|
+
function toErrorMessage$31(error) {
|
|
15345
15345
|
return error instanceof Error ? error.message : String(error);
|
|
15346
15346
|
}
|
|
15347
15347
|
|
|
@@ -15613,7 +15613,7 @@ async function runOpenClawJsonCommand(input) {
|
|
|
15613
15613
|
try {
|
|
15614
15614
|
return JSON.parse(stdout);
|
|
15615
15615
|
} catch (error) {
|
|
15616
|
-
throw new Error(`openclaw JSON output could not be parsed: ${toErrorMessage$
|
|
15616
|
+
throw new Error(`openclaw JSON output could not be parsed: ${toErrorMessage$30(error)}`);
|
|
15617
15617
|
}
|
|
15618
15618
|
}
|
|
15619
15619
|
async function runOpenClawCommand(input) {
|
|
@@ -15648,7 +15648,7 @@ function normalizeOptionalText$30(value) {
|
|
|
15648
15648
|
const normalized = String(value ?? "").trim();
|
|
15649
15649
|
return normalized.length > 0 ? normalized : null;
|
|
15650
15650
|
}
|
|
15651
|
-
function toErrorMessage$
|
|
15651
|
+
function toErrorMessage$30(error) {
|
|
15652
15652
|
return error instanceof Error ? error.message : String(error);
|
|
15653
15653
|
}
|
|
15654
15654
|
function isExecFileTimeoutError(error) {
|
|
@@ -15662,7 +15662,7 @@ function resolveOpenClawCliErrorMessage(error, timeoutMs) {
|
|
|
15662
15662
|
const cliMessage = normalizeOptionalText$30(error.stderr) ?? stdout;
|
|
15663
15663
|
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
15664
|
if (cliMessage) return cliMessage;
|
|
15665
|
-
return `openclaw command failed: ${toErrorMessage$
|
|
15665
|
+
return `openclaw command failed: ${toErrorMessage$30(error)}`;
|
|
15666
15666
|
}
|
|
15667
15667
|
function parseOpenClawAgentSummary(value) {
|
|
15668
15668
|
if (!value || typeof value !== "object") return null;
|
|
@@ -16043,7 +16043,7 @@ async function ensureOpenClawGatewayAgentVisible(input, deps = DEFAULT_OPENCLAW_
|
|
|
16043
16043
|
gatewayRestartAttempted: true,
|
|
16044
16044
|
gatewayVisibility: "missing_before_restart"
|
|
16045
16045
|
},
|
|
16046
|
-
message: `OpenClaw gateway restart failed while making agent '${agentId}' visible: ${toErrorMessage$
|
|
16046
|
+
message: `OpenClaw gateway restart failed while making agent '${agentId}' visible: ${toErrorMessage$29(error)}`
|
|
16047
16047
|
});
|
|
16048
16048
|
}
|
|
16049
16049
|
let lastVisibilityError = null;
|
|
@@ -16072,7 +16072,7 @@ async function ensureOpenClawGatewayAgentVisible(input, deps = DEFAULT_OPENCLAW_
|
|
|
16072
16072
|
gatewayRestartAttempted: true,
|
|
16073
16073
|
gatewayVisibility: "missing_after_restart"
|
|
16074
16074
|
},
|
|
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$
|
|
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$29(lastVisibilityError)}`
|
|
16076
16076
|
});
|
|
16077
16077
|
}
|
|
16078
16078
|
async function maybeCopyOpenClawAuth(input) {
|
|
@@ -16113,7 +16113,7 @@ async function ensureParentDirectory(path) {
|
|
|
16113
16113
|
async function pathExists$2(path) {
|
|
16114
16114
|
return await access(path, constants.F_OK).then(() => true).catch(() => false);
|
|
16115
16115
|
}
|
|
16116
|
-
function toErrorMessage$
|
|
16116
|
+
function toErrorMessage$29(error) {
|
|
16117
16117
|
return error instanceof Error ? error.message : String(error);
|
|
16118
16118
|
}
|
|
16119
16119
|
function normalizeBootstrapReadError(error) {
|
|
@@ -16232,7 +16232,7 @@ function assertOpenClawWorkspaceMatch(input) {
|
|
|
16232
16232
|
});
|
|
16233
16233
|
}
|
|
16234
16234
|
function isOpenClawAgentAlreadyExistsError(error) {
|
|
16235
|
-
const normalizedMessage = toErrorMessage$
|
|
16235
|
+
const normalizedMessage = toErrorMessage$29(error).toLowerCase();
|
|
16236
16236
|
return normalizedMessage.includes("agent") && normalizedMessage.includes("already exists");
|
|
16237
16237
|
}
|
|
16238
16238
|
function resolveProviderRuntimeWorkingDirectory(value) {
|
|
@@ -16270,7 +16270,7 @@ async function prepareOpenClawRuntime(input, deps = DEFAULT_OPENCLAW_RUNTIME_PRE
|
|
|
16270
16270
|
}).catch((error) => {
|
|
16271
16271
|
throw new DaemonServiceRunError({
|
|
16272
16272
|
code: "controller.bootstrap.failed",
|
|
16273
|
-
message: `controller.bootstrap.failed: ${toErrorMessage$
|
|
16273
|
+
message: `controller.bootstrap.failed: ${toErrorMessage$28(error)}`,
|
|
16274
16274
|
providerErrorCode: extractErrorCode$1(error)
|
|
16275
16275
|
});
|
|
16276
16276
|
});
|
|
@@ -16280,7 +16280,7 @@ async function prepareOpenClawRuntime(input, deps = DEFAULT_OPENCLAW_RUNTIME_PRE
|
|
|
16280
16280
|
}).catch((error) => {
|
|
16281
16281
|
throw new DaemonServiceRunError({
|
|
16282
16282
|
code: "controller.gateway.unhealthy",
|
|
16283
|
-
message: `controller.gateway.unhealthy: ${toErrorMessage$
|
|
16283
|
+
message: `controller.gateway.unhealthy: ${toErrorMessage$28(error)}`,
|
|
16284
16284
|
providerErrorCode: extractErrorCode$1(error)
|
|
16285
16285
|
});
|
|
16286
16286
|
});
|
|
@@ -16292,7 +16292,7 @@ async function prepareOpenClawRuntime(input, deps = DEFAULT_OPENCLAW_RUNTIME_PRE
|
|
|
16292
16292
|
const gatewayFailure = buildOpenClawGatewayVisibilityFailure(error);
|
|
16293
16293
|
throw new DaemonServiceRunError({
|
|
16294
16294
|
code: "controller.gateway.unhealthy",
|
|
16295
|
-
message: `controller.gateway.unhealthy: ${toErrorMessage$
|
|
16295
|
+
message: `controller.gateway.unhealthy: ${toErrorMessage$28(error)}`,
|
|
16296
16296
|
providerErrorCode: extractErrorCode$1(error),
|
|
16297
16297
|
...gatewayFailure
|
|
16298
16298
|
});
|
|
@@ -16331,7 +16331,7 @@ function resolveOpenClawGatewayVisibilityDiagnostics(error) {
|
|
|
16331
16331
|
gatewayVisibility: parsedGatewayVisibility.data
|
|
16332
16332
|
};
|
|
16333
16333
|
}
|
|
16334
|
-
function toErrorMessage$
|
|
16334
|
+
function toErrorMessage$28(error) {
|
|
16335
16335
|
return error instanceof Error ? error.message : String(error);
|
|
16336
16336
|
}
|
|
16337
16337
|
|
|
@@ -16381,7 +16381,7 @@ function createOpenClawLocalDiagnosticsFailure(error) {
|
|
|
16381
16381
|
return {
|
|
16382
16382
|
errorCode: extractErrorCode(error),
|
|
16383
16383
|
kind: "failed",
|
|
16384
|
-
message: toErrorMessage$
|
|
16384
|
+
message: toErrorMessage$27(error)
|
|
16385
16385
|
};
|
|
16386
16386
|
}
|
|
16387
16387
|
function isOpenClawLocalDiagnosticsFailure(diagnostics) {
|
|
@@ -16465,7 +16465,7 @@ async function resolveInspectModeDiagnostics(input) {
|
|
|
16465
16465
|
openClawBin: input.openClawBin
|
|
16466
16466
|
}).then(() => "healthy").catch((error) => ({
|
|
16467
16467
|
errorCode: extractErrorCode(error),
|
|
16468
|
-
message: toErrorMessage$
|
|
16468
|
+
message: toErrorMessage$27(error)
|
|
16469
16469
|
}));
|
|
16470
16470
|
if (gatewayHealth !== "healthy") return {
|
|
16471
16471
|
...inspected,
|
|
@@ -16545,7 +16545,7 @@ async function resolveInspectGatewayVisibility(input) {
|
|
|
16545
16545
|
return {
|
|
16546
16546
|
errorCode: extractErrorCode(error),
|
|
16547
16547
|
gatewayVisibility: "not_checked",
|
|
16548
|
-
message: toErrorMessage$
|
|
16548
|
+
message: toErrorMessage$27(error)
|
|
16549
16549
|
};
|
|
16550
16550
|
}
|
|
16551
16551
|
}
|
|
@@ -16554,7 +16554,7 @@ function resolveDiagnosticsFailureDetail(input) {
|
|
|
16554
16554
|
const inspectedMessage = typeof input.inspected.message === "string" && input.inspected.message.trim().length > 0 ? input.inspected.message.trim() : null;
|
|
16555
16555
|
return {
|
|
16556
16556
|
errorCode: inspectedErrorCode ?? extractErrorCode(input.error),
|
|
16557
|
-
message: inspectedMessage ?? toErrorMessage$
|
|
16557
|
+
message: inspectedMessage ?? toErrorMessage$27(input.error)
|
|
16558
16558
|
};
|
|
16559
16559
|
}
|
|
16560
16560
|
function resolveDiagnosticsTargetAgent(input) {
|
|
@@ -16615,7 +16615,7 @@ function buildBootstrapDiagnosticStatus(bootstrapStatus, errorCode, message) {
|
|
|
16615
16615
|
}
|
|
16616
16616
|
function resolveExplicitBootstrapDiagnostic(error) {
|
|
16617
16617
|
const explicitErrorCode = extractErrorCode(error);
|
|
16618
|
-
const explicitMessage = error ? toErrorMessage$
|
|
16618
|
+
const explicitMessage = error ? toErrorMessage$27(error) : null;
|
|
16619
16619
|
switch (explicitErrorCode) {
|
|
16620
16620
|
case "openclaw.bootstrap.binding_conflict": return buildBootstrapDiagnosticStatus("binding_conflict", explicitErrorCode, explicitMessage);
|
|
16621
16621
|
case "openclaw.bootstrap.workspace_mismatch": return buildBootstrapDiagnosticStatus("workspace_mismatch", explicitErrorCode, explicitMessage);
|
|
@@ -16635,7 +16635,7 @@ function resolveExistingBootstrapStatus(input) {
|
|
|
16635
16635
|
}
|
|
16636
16636
|
function resolveInvalidBootstrapStatus(input) {
|
|
16637
16637
|
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$
|
|
16638
|
+
return buildBootstrapDiagnosticStatus("invalid", input.bootstrapRead.error?.code ?? extractErrorCode(input.error), input.bootstrapRead.error?.message ?? (input.error ? toErrorMessage$27(input.error) : null));
|
|
16639
16639
|
}
|
|
16640
16640
|
function resolveMissingBootstrapStatus(workspaceAgents, input = {}) {
|
|
16641
16641
|
if (workspaceAgents.length > 1) return buildBootstrapDiagnosticStatus("workspace_ambiguous", "openclaw.bootstrap.workspace_ambiguous", null);
|
|
@@ -16679,7 +16679,7 @@ function extractProviderErrorCode(error) {
|
|
|
16679
16679
|
const normalized = String(error.providerErrorCode ?? "").trim();
|
|
16680
16680
|
return normalized.length > 0 ? normalized : null;
|
|
16681
16681
|
}
|
|
16682
|
-
function toErrorMessage$
|
|
16682
|
+
function toErrorMessage$27(error) {
|
|
16683
16683
|
return error instanceof Error ? error.message : String(error);
|
|
16684
16684
|
}
|
|
16685
16685
|
|
|
@@ -19690,7 +19690,7 @@ async function resolveDaemonRuntimeContractCompatibility(input) {
|
|
|
19690
19690
|
observedEpoch: null,
|
|
19691
19691
|
updatedAt: null,
|
|
19692
19692
|
reasonCode: "daemon.runtime_contract.unavailable",
|
|
19693
|
-
errorMessage: toErrorMessage$
|
|
19693
|
+
errorMessage: toErrorMessage$36(error)
|
|
19694
19694
|
};
|
|
19695
19695
|
}
|
|
19696
19696
|
if (!meta) return {
|
|
@@ -20011,7 +20011,7 @@ async function waitForDaemonSystemServiceToStop(input) {
|
|
|
20011
20011
|
if (!(await input.manager.status().catch(() => null))?.running && currentRuntime?.status !== "running") return true;
|
|
20012
20012
|
if (currentRuntime?.status === "stale" && !currentRuntime.managedBySystemService) return true;
|
|
20013
20013
|
if (currentRuntime?.status === "not_running") return true;
|
|
20014
|
-
await sleep$
|
|
20014
|
+
await sleep$7(pollMs);
|
|
20015
20015
|
}
|
|
20016
20016
|
const finalRuntime = await readCurrentObservedDaemonRuntimeStatus().catch(() => null);
|
|
20017
20017
|
if (finalRuntime?.status === "not_running") return true;
|
|
@@ -20019,7 +20019,7 @@ async function waitForDaemonSystemServiceToStop(input) {
|
|
|
20019
20019
|
if (finalRuntime?.status === "running") return false;
|
|
20020
20020
|
return (await input.manager.status().catch(() => null))?.running !== true;
|
|
20021
20021
|
}
|
|
20022
|
-
async function sleep$
|
|
20022
|
+
async function sleep$7(ms) {
|
|
20023
20023
|
await new Promise((resolve) => setTimeout(resolve, ms));
|
|
20024
20024
|
}
|
|
20025
20025
|
async function readObservedRuntimeState() {
|
|
@@ -21031,7 +21031,7 @@ async function invokeClaudeWithSingleContextHeal(input) {
|
|
|
21031
21031
|
return new ClaudeRuntimeError({
|
|
21032
21032
|
code: "context.rebuild_failed",
|
|
21033
21033
|
errorType: "adapter",
|
|
21034
|
-
message: `context.rebuild_failed: ${toErrorMessage$
|
|
21034
|
+
message: `context.rebuild_failed: ${toErrorMessage$26(error)}`,
|
|
21035
21035
|
...providerAccessEvidence ? { providerAccessEvidence } : {}
|
|
21036
21036
|
});
|
|
21037
21037
|
},
|
|
@@ -21091,7 +21091,7 @@ async function invokeClaudeOnce(input) {
|
|
|
21091
21091
|
throw new ClaudeRuntimeError({
|
|
21092
21092
|
code: "upstream_unreachable",
|
|
21093
21093
|
errorType: "adapter",
|
|
21094
|
-
message: `upstream_unreachable: ${toErrorMessage$
|
|
21094
|
+
message: `upstream_unreachable: ${toErrorMessage$26(error)}`
|
|
21095
21095
|
});
|
|
21096
21096
|
}
|
|
21097
21097
|
}
|
|
@@ -21101,7 +21101,7 @@ function getClaudeProviderAccessEvidence(error) {
|
|
|
21101
21101
|
if (!evidence || typeof evidence !== "object") return null;
|
|
21102
21102
|
return evidence;
|
|
21103
21103
|
}
|
|
21104
|
-
function toErrorMessage$
|
|
21104
|
+
function toErrorMessage$26(error) {
|
|
21105
21105
|
if (error instanceof Error) return error.message;
|
|
21106
21106
|
return String(error);
|
|
21107
21107
|
}
|
|
@@ -21720,7 +21720,7 @@ async function invokeCodexWithSingleContextHeal(input) {
|
|
|
21720
21720
|
createRebuildFailedError: (error) => new CodexRuntimeError({
|
|
21721
21721
|
code: "context.rebuild_failed",
|
|
21722
21722
|
errorType: "adapter",
|
|
21723
|
-
message: `context.rebuild_failed: ${toErrorMessage$
|
|
21723
|
+
message: `context.rebuild_failed: ${toErrorMessage$25(error)}`
|
|
21724
21724
|
}),
|
|
21725
21725
|
invokeOnce: (threadId) => invokeCodexOnce({
|
|
21726
21726
|
launchContract: input.launchContract,
|
|
@@ -21774,11 +21774,11 @@ async function invokeCodexOnce(input) {
|
|
|
21774
21774
|
throw new CodexRuntimeError({
|
|
21775
21775
|
code: "upstream_unreachable",
|
|
21776
21776
|
errorType: "adapter",
|
|
21777
|
-
message: `upstream_unreachable: ${toErrorMessage$
|
|
21777
|
+
message: `upstream_unreachable: ${toErrorMessage$25(error)}`
|
|
21778
21778
|
});
|
|
21779
21779
|
}
|
|
21780
21780
|
}
|
|
21781
|
-
function toErrorMessage$
|
|
21781
|
+
function toErrorMessage$25(error) {
|
|
21782
21782
|
if (error instanceof Error) return error.message;
|
|
21783
21783
|
return String(error);
|
|
21784
21784
|
}
|
|
@@ -22722,7 +22722,7 @@ async function syncDeviceRuntimeStateProjection(input) {
|
|
|
22722
22722
|
const projectedControllers = await loadProjectedControllers();
|
|
22723
22723
|
const registeredCustomTargetIds = await loadRegisteredCustomTargetIds();
|
|
22724
22724
|
const targetStates = await listAgentTargetStates().catch((error) => {
|
|
22725
|
-
throw new Error(`failed to load ATS agent target states: ${toErrorMessage$
|
|
22725
|
+
throw new Error(`failed to load ATS agent target states: ${toErrorMessage$24(error)}`);
|
|
22726
22726
|
});
|
|
22727
22727
|
const targetStateById = new Map(targetStates.map((state) => [state.agentId, state]));
|
|
22728
22728
|
const projectedControllerIds = [...projectedControllers.keys()].sort();
|
|
@@ -22796,12 +22796,12 @@ async function hasValidAuthSession() {
|
|
|
22796
22796
|
}
|
|
22797
22797
|
async function loadProjectedControllers() {
|
|
22798
22798
|
return await collectProjectedControllers(await listAtsProfiles().catch((error) => {
|
|
22799
|
-
throw new Error(`failed to list ATS profiles: ${toErrorMessage$
|
|
22799
|
+
throw new Error(`failed to list ATS profiles: ${toErrorMessage$24(error)}`);
|
|
22800
22800
|
}));
|
|
22801
22801
|
}
|
|
22802
22802
|
async function loadRegisteredCustomTargetIds() {
|
|
22803
22803
|
const customTargets = await listAgentCustomTargets().catch((error) => {
|
|
22804
|
-
throw new Error(`failed to list ATS custom targets: ${toErrorMessage$
|
|
22804
|
+
throw new Error(`failed to list ATS custom targets: ${toErrorMessage$24(error)}`);
|
|
22805
22805
|
});
|
|
22806
22806
|
return new Set(customTargets.map((target) => target.id));
|
|
22807
22807
|
}
|
|
@@ -23078,7 +23078,7 @@ function emitProjectionEvidence(result) {
|
|
|
23078
23078
|
function normalizeText$1(value) {
|
|
23079
23079
|
return String(value ?? "").trim();
|
|
23080
23080
|
}
|
|
23081
|
-
function toErrorMessage$
|
|
23081
|
+
function toErrorMessage$24(error) {
|
|
23082
23082
|
if (error instanceof Error) return error.message;
|
|
23083
23083
|
return String(error);
|
|
23084
23084
|
}
|
|
@@ -23505,7 +23505,7 @@ async function readPrimaryBindingForRouteCatalog(input) {
|
|
|
23505
23505
|
} catch (error) {
|
|
23506
23506
|
throw new DaemonServiceRunError({
|
|
23507
23507
|
code: "daemon.run.primary_binding_lookup_failed",
|
|
23508
|
-
message: `Core primary binding lookup failed for profile ${input.profile.atsProfileId}: ${toErrorMessage$
|
|
23508
|
+
message: `Core primary binding lookup failed for profile ${input.profile.atsProfileId}: ${toErrorMessage$36(error)}`
|
|
23509
23509
|
});
|
|
23510
23510
|
}
|
|
23511
23511
|
}
|
|
@@ -23513,7 +23513,7 @@ async function repairLocalReplyStateOrThrow(input) {
|
|
|
23513
23513
|
try {
|
|
23514
23514
|
await syncDeviceRuntimeStateProjection({ mode: "repair" });
|
|
23515
23515
|
} catch (error) {
|
|
23516
|
-
const errorMessage = toErrorMessage$
|
|
23516
|
+
const errorMessage = toErrorMessage$36(error);
|
|
23517
23517
|
emitRunLine({
|
|
23518
23518
|
presenter: input.presenter,
|
|
23519
23519
|
code: "daemon.run.projection_sync_failed",
|
|
@@ -23527,7 +23527,7 @@ async function repairLocalReplyStateOrThrow(input) {
|
|
|
23527
23527
|
try {
|
|
23528
23528
|
await syncProfileWorkspaceState({ mode: "repair" });
|
|
23529
23529
|
} catch (error) {
|
|
23530
|
-
const errorMessage = toErrorMessage$
|
|
23530
|
+
const errorMessage = toErrorMessage$36(error);
|
|
23531
23531
|
emitRunLine({
|
|
23532
23532
|
presenter: input.presenter,
|
|
23533
23533
|
code: "daemon.run.profile_workspace_sync_failed",
|
|
@@ -23569,7 +23569,7 @@ async function syncDaemonRouteCatalogState(input) {
|
|
|
23569
23569
|
return {
|
|
23570
23570
|
status: "failed",
|
|
23571
23571
|
reason: "load_failed",
|
|
23572
|
-
errorMessage: toErrorMessage$
|
|
23572
|
+
errorMessage: toErrorMessage$36(error)
|
|
23573
23573
|
};
|
|
23574
23574
|
}
|
|
23575
23575
|
const nextFingerprint = buildRouteCatalogFingerprint(nextCatalog);
|
|
@@ -23582,7 +23582,7 @@ async function syncDaemonRouteCatalogState(input) {
|
|
|
23582
23582
|
return {
|
|
23583
23583
|
status: "failed",
|
|
23584
23584
|
reason: "register_failed",
|
|
23585
|
-
errorMessage: toErrorMessage$
|
|
23585
|
+
errorMessage: toErrorMessage$36(error)
|
|
23586
23586
|
};
|
|
23587
23587
|
}
|
|
23588
23588
|
applyAcceptedLeases({
|
|
@@ -23613,7 +23613,7 @@ async function syncDaemonRouteCatalogState(input) {
|
|
|
23613
23613
|
return {
|
|
23614
23614
|
status: "failed",
|
|
23615
23615
|
reason: "register_failed",
|
|
23616
|
-
errorMessage: toErrorMessage$
|
|
23616
|
+
errorMessage: toErrorMessage$36(error)
|
|
23617
23617
|
};
|
|
23618
23618
|
}
|
|
23619
23619
|
const diff = buildRouteCatalogDiff({
|
|
@@ -23756,7 +23756,7 @@ async function resolveDaemonLocalServiceDemand(input) {
|
|
|
23756
23756
|
decision: "indeterminate",
|
|
23757
23757
|
hasWakeableLocalRoute: false,
|
|
23758
23758
|
repairableReplyCandidateCount: 0,
|
|
23759
|
-
reason: `failed to load local daemon routes: ${toErrorMessage$
|
|
23759
|
+
reason: `failed to load local daemon routes: ${toErrorMessage$36(error)}`,
|
|
23760
23760
|
wakeableLocalRouteCount: 0,
|
|
23761
23761
|
projection
|
|
23762
23762
|
};
|
|
@@ -23881,7 +23881,7 @@ async function maybeAutoStopIdleBackgroundDaemonService(input) {
|
|
|
23881
23881
|
} catch (error) {
|
|
23882
23882
|
input.presenter.line({
|
|
23883
23883
|
code: `${input.codePrefix}.auto_stop_failed`,
|
|
23884
|
-
text: `ATS could not auto-stop the background service. ${toErrorMessage$
|
|
23884
|
+
text: `ATS could not auto-stop the background service. ${toErrorMessage$36(error)}`
|
|
23885
23885
|
});
|
|
23886
23886
|
return {
|
|
23887
23887
|
autoStopped: false,
|
|
@@ -23975,9 +23975,9 @@ async function resolveGatewayChainReadiness(input = {}) {
|
|
|
23975
23975
|
applicable: true,
|
|
23976
23976
|
baseUrl: fallbackBaseUrl,
|
|
23977
23977
|
checkedAt,
|
|
23978
|
-
details: toErrorMessage$
|
|
23978
|
+
details: toErrorMessage$34(error),
|
|
23979
23979
|
errorCode: null,
|
|
23980
|
-
errorMessage: toErrorMessage$
|
|
23980
|
+
errorMessage: toErrorMessage$34(error),
|
|
23981
23981
|
failureKind: "gateway_unreachable",
|
|
23982
23982
|
ready: false,
|
|
23983
23983
|
status: null,
|
|
@@ -24901,7 +24901,7 @@ function buildLookupFailedRouteObservationDetail(input) {
|
|
|
24901
24901
|
observedAt: input.observedAt,
|
|
24902
24902
|
reasonCode: "lookup_failed"
|
|
24903
24903
|
});
|
|
24904
|
-
const rawError = toErrorMessage$
|
|
24904
|
+
const rawError = toErrorMessage$23(input.error).trim();
|
|
24905
24905
|
if (rawError.length === 0 || rawError === detail) return detail;
|
|
24906
24906
|
return `${detail} Raw lookup error: ${rawError}`;
|
|
24907
24907
|
}
|
|
@@ -24929,7 +24929,7 @@ function enrichRuntimeStateWithManager(input) {
|
|
|
24929
24929
|
serviceController: input.runtimeState.serviceController === "unknown" && input.serviceManager?.controller !== void 0 ? input.serviceManager.controller : input.runtimeState.serviceController
|
|
24930
24930
|
};
|
|
24931
24931
|
}
|
|
24932
|
-
function toErrorMessage$
|
|
24932
|
+
function toErrorMessage$23(error) {
|
|
24933
24933
|
if (error instanceof Error) return error.message;
|
|
24934
24934
|
return String(error);
|
|
24935
24935
|
}
|
|
@@ -25818,7 +25818,7 @@ async function captureDaemonServiceEvidence(input = {}) {
|
|
|
25818
25818
|
errorMessage: null
|
|
25819
25819
|
})).catch((error) => ({
|
|
25820
25820
|
snapshot: null,
|
|
25821
|
-
errorMessage: toErrorMessage$
|
|
25821
|
+
errorMessage: toErrorMessage$22(error)
|
|
25822
25822
|
})),
|
|
25823
25823
|
captureOwnedProcessesArtifact(phaseRootPath),
|
|
25824
25824
|
captureSystemServiceDiagnosticsArtifact(phaseRootPath)
|
|
@@ -25932,7 +25932,7 @@ async function captureDirectoryArtifact(input) {
|
|
|
25932
25932
|
};
|
|
25933
25933
|
} catch (error) {
|
|
25934
25934
|
return {
|
|
25935
|
-
errorMessage: toErrorMessage$
|
|
25935
|
+
errorMessage: toErrorMessage$22(error),
|
|
25936
25936
|
relativePath: null,
|
|
25937
25937
|
sourcePath: input.sourcePath,
|
|
25938
25938
|
status: "error"
|
|
@@ -25958,7 +25958,7 @@ async function captureFileArtifact(input) {
|
|
|
25958
25958
|
};
|
|
25959
25959
|
} catch (error) {
|
|
25960
25960
|
return {
|
|
25961
|
-
errorMessage: toErrorMessage$
|
|
25961
|
+
errorMessage: toErrorMessage$22(error),
|
|
25962
25962
|
relativePath: null,
|
|
25963
25963
|
sourcePath: input.sourcePath,
|
|
25964
25964
|
status: "error"
|
|
@@ -25980,7 +25980,7 @@ async function captureOwnedProcessesArtifact(evidencePath) {
|
|
|
25980
25980
|
} };
|
|
25981
25981
|
} catch (error) {
|
|
25982
25982
|
return { artifact: {
|
|
25983
|
-
errorMessage: toErrorMessage$
|
|
25983
|
+
errorMessage: toErrorMessage$22(error),
|
|
25984
25984
|
relativePath: null,
|
|
25985
25985
|
sourcePath: null,
|
|
25986
25986
|
status: "error"
|
|
@@ -26087,7 +26087,7 @@ async function runCommand$1(command, args, input = {}) {
|
|
|
26087
26087
|
child.once("close", handleClose);
|
|
26088
26088
|
});
|
|
26089
26089
|
}
|
|
26090
|
-
function toErrorMessage$
|
|
26090
|
+
function toErrorMessage$22(error) {
|
|
26091
26091
|
if (error instanceof Error) return error.message;
|
|
26092
26092
|
return String(error);
|
|
26093
26093
|
}
|
|
@@ -26259,7 +26259,7 @@ async function runDaemonServiceLifecycle(input) {
|
|
|
26259
26259
|
failureStage: state.failureStage,
|
|
26260
26260
|
evidencePath: state.evidencePath,
|
|
26261
26261
|
recoveryStatus: "failed_before_safe_state",
|
|
26262
|
-
errorMessage: toErrorMessage$
|
|
26262
|
+
errorMessage: toErrorMessage$21(error)
|
|
26263
26263
|
};
|
|
26264
26264
|
}
|
|
26265
26265
|
}
|
|
@@ -26399,7 +26399,7 @@ async function executeDaemonServiceLifecycle(input) {
|
|
|
26399
26399
|
}
|
|
26400
26400
|
}
|
|
26401
26401
|
async function recoverLifecycleFailure(input) {
|
|
26402
|
-
const originalErrorMessage = toErrorMessage$
|
|
26402
|
+
const originalErrorMessage = toErrorMessage$21(input.error);
|
|
26403
26403
|
const originalFailureStage = resolveLifecycleFailureStage(input.error, input.state.failureStage);
|
|
26404
26404
|
const originalReasonCodes = resolveLifecycleFailureReasonCodes(input.error);
|
|
26405
26405
|
if (input.restorePoint.trusted) {
|
|
@@ -26609,7 +26609,7 @@ async function ensureNoOwnedProcessesRemain() {
|
|
|
26609
26609
|
return;
|
|
26610
26610
|
}
|
|
26611
26611
|
}
|
|
26612
|
-
await sleep$
|
|
26612
|
+
await sleep$6(STRICT_TEARDOWN_VERIFY_POLL_MS$1);
|
|
26613
26613
|
}
|
|
26614
26614
|
const [ownedProcesses, runtimeStatus] = await Promise.all([listDaemonOwnedProcesses({ ignoreProcessIds: [process$1.pid, process$1.ppid].filter((pid) => Number.isInteger(pid) && pid > 0) }), readCurrentObservedDaemonRuntimeStatus()]);
|
|
26615
26615
|
if (ownedProcesses.length > 0) throw new DaemonServiceLifecycleStageError({
|
|
@@ -26632,7 +26632,7 @@ async function waitForLegacySharedServiceCleanup(input) {
|
|
|
26632
26632
|
});
|
|
26633
26633
|
lastInventory = inventory;
|
|
26634
26634
|
if (!(inventory.legacySharedService?.present === true || inventory.anomalies.some((anomaly) => anomaly.code === "legacy_shared_service_present"))) return;
|
|
26635
|
-
await sleep$
|
|
26635
|
+
await sleep$6(STRICT_TEARDOWN_VERIFY_POLL_MS$1);
|
|
26636
26636
|
}
|
|
26637
26637
|
throw new DaemonServiceLifecycleStageError({
|
|
26638
26638
|
message: "ATS Service legacy shared registration is still present after cleanup. reason=legacy_shared_service_present",
|
|
@@ -26820,7 +26820,7 @@ async function waitForVerifiedLifecycleInventory(input) {
|
|
|
26820
26820
|
});
|
|
26821
26821
|
lastInventory = inventory;
|
|
26822
26822
|
lastError = verificationError;
|
|
26823
|
-
await sleep$
|
|
26823
|
+
await sleep$6(STRICT_TEARDOWN_VERIFY_POLL_MS$1);
|
|
26824
26824
|
}
|
|
26825
26825
|
throw new DaemonServiceLifecycleStageError({
|
|
26826
26826
|
message: lastError ?? "ATS could not verify the final local service inventory state.",
|
|
@@ -26917,7 +26917,7 @@ function resolveLifecycleFailureReasonCodes(error) {
|
|
|
26917
26917
|
if (error instanceof DaemonServiceLifecycleStageError) return error.reasonCodes;
|
|
26918
26918
|
return [];
|
|
26919
26919
|
}
|
|
26920
|
-
function toErrorMessage$
|
|
26920
|
+
function toErrorMessage$21(error) {
|
|
26921
26921
|
if (error instanceof Error) return error.message;
|
|
26922
26922
|
return String(error);
|
|
26923
26923
|
}
|
|
@@ -26934,7 +26934,7 @@ async function stopDaemonProcess$1(pid, signal) {
|
|
|
26934
26934
|
process$1.kill(pid, signal);
|
|
26935
26935
|
} catch (error) {
|
|
26936
26936
|
if (error instanceof Error && error.code === "ESRCH") return true;
|
|
26937
|
-
throw new Error(`Failed to send ${signal} to pid ${String(pid)}: ${toErrorMessage$
|
|
26937
|
+
throw new Error(`Failed to send ${signal} to pid ${String(pid)}: ${toErrorMessage$21(error)}`);
|
|
26938
26938
|
}
|
|
26939
26939
|
if (signal === "SIGKILL") return true;
|
|
26940
26940
|
return await waitForProcessToExit$1(pid, PROCESS_STOP_WAIT_MS);
|
|
@@ -26944,7 +26944,7 @@ async function stopDaemonProcessWithTimeout(pid, signal, timeoutMs) {
|
|
|
26944
26944
|
process$1.kill(pid, signal);
|
|
26945
26945
|
} catch (error) {
|
|
26946
26946
|
if (error instanceof Error && error.code === "ESRCH") return true;
|
|
26947
|
-
throw new Error(`Failed to send ${signal} to pid ${String(pid)}: ${toErrorMessage$
|
|
26947
|
+
throw new Error(`Failed to send ${signal} to pid ${String(pid)}: ${toErrorMessage$21(error)}`);
|
|
26948
26948
|
}
|
|
26949
26949
|
return await waitForProcessToExit$1(pid, timeoutMs);
|
|
26950
26950
|
}
|
|
@@ -26952,16 +26952,16 @@ async function waitForProcessToExit$1(pid, timeoutMs) {
|
|
|
26952
26952
|
const deadline = Date.now() + timeoutMs;
|
|
26953
26953
|
while (Date.now() < deadline) {
|
|
26954
26954
|
if (!isPidAlive$3(pid)) return true;
|
|
26955
|
-
await sleep$
|
|
26955
|
+
await sleep$6(STRICT_TEARDOWN_VERIFY_POLL_MS$1);
|
|
26956
26956
|
}
|
|
26957
26957
|
return !isPidAlive$3(pid);
|
|
26958
26958
|
}
|
|
26959
|
-
async function sleep$
|
|
26959
|
+
async function sleep$6(ms) {
|
|
26960
26960
|
await new Promise((resolve) => setTimeout(resolve, ms));
|
|
26961
26961
|
}
|
|
26962
26962
|
function isLaunchdBootstrapIoError(serviceManager, error) {
|
|
26963
26963
|
if (serviceManager.controller !== "launchd") return false;
|
|
26964
|
-
const message = toErrorMessage$
|
|
26964
|
+
const message = toErrorMessage$21(error).toLowerCase();
|
|
26965
26965
|
return message.includes("bootstrap failed") && message.includes("input/output error");
|
|
26966
26966
|
}
|
|
26967
26967
|
async function writeLifecycleEvidenceEvent(input) {
|
|
@@ -27399,7 +27399,7 @@ async function resolveUpgradeStatus(input) {
|
|
|
27399
27399
|
status: "check_failed",
|
|
27400
27400
|
currentVersion: input.currentVersion,
|
|
27401
27401
|
checkedAt: input.checkedAt,
|
|
27402
|
-
error: toErrorMessage$
|
|
27402
|
+
error: toErrorMessage$20(error)
|
|
27403
27403
|
};
|
|
27404
27404
|
}
|
|
27405
27405
|
}
|
|
@@ -27770,7 +27770,7 @@ function emitUpgradeCompleted(input) {
|
|
|
27770
27770
|
text: "ATS CLI upgrade completed."
|
|
27771
27771
|
});
|
|
27772
27772
|
}
|
|
27773
|
-
function toErrorMessage$
|
|
27773
|
+
function toErrorMessage$20(error) {
|
|
27774
27774
|
if (error instanceof Error) return error.message;
|
|
27775
27775
|
return String(error);
|
|
27776
27776
|
}
|
|
@@ -31975,7 +31975,7 @@ async function submitPrepareRuntimeCapabilityReports(input) {
|
|
|
31975
31975
|
});
|
|
31976
31976
|
} catch (error) {
|
|
31977
31977
|
console.warn("[ats.runtime_reporting.write_failed]", {
|
|
31978
|
-
error: toErrorMessage$
|
|
31978
|
+
error: toErrorMessage$19(error),
|
|
31979
31979
|
event: "cli.runtime_reporting.write_failed",
|
|
31980
31980
|
profileIds: input.reports.map((report) => report.diagnosticProfileId).filter((profileId) => Boolean(profileId)),
|
|
31981
31981
|
reportCount: input.reports.length
|
|
@@ -32081,7 +32081,7 @@ function failedSubmission(input) {
|
|
|
32081
32081
|
status: "failed"
|
|
32082
32082
|
};
|
|
32083
32083
|
}
|
|
32084
|
-
function toErrorMessage$
|
|
32084
|
+
function toErrorMessage$19(error) {
|
|
32085
32085
|
if (error instanceof Error) {
|
|
32086
32086
|
const message = error.message.trim();
|
|
32087
32087
|
return message.length > 0 ? message : "unknown error";
|
|
@@ -32208,7 +32208,7 @@ async function ensureAgentProfileRuntimeBinding(input) {
|
|
|
32208
32208
|
};
|
|
32209
32209
|
} catch (error) {
|
|
32210
32210
|
console.warn("[ats.agent_profile_binding.ensure_failed]", {
|
|
32211
|
-
error: toErrorMessage$
|
|
32211
|
+
error: toErrorMessage$18(error),
|
|
32212
32212
|
event: "cli.agent_profile_binding.ensure_failed",
|
|
32213
32213
|
profileId: input.profile.atsProfileId
|
|
32214
32214
|
});
|
|
@@ -32253,7 +32253,7 @@ async function waitForExecutionReadinessAfterBinding(input) {
|
|
|
32253
32253
|
requestContext: input.requestContext
|
|
32254
32254
|
});
|
|
32255
32255
|
if (isAgentExecutionReadyOrConnecting(latest.agentExecutionReadiness)) return latest;
|
|
32256
|
-
await sleep$
|
|
32256
|
+
await sleep$5(EXECUTION_READINESS_AFTER_BINDING_RETRY_DELAY_MS);
|
|
32257
32257
|
}
|
|
32258
32258
|
return latest;
|
|
32259
32259
|
}
|
|
@@ -32326,10 +32326,10 @@ function tryResolveBindingInput(submission) {
|
|
|
32326
32326
|
function uniqueReasonCodes(reasonCodes) {
|
|
32327
32327
|
return [...new Set(reasonCodes)];
|
|
32328
32328
|
}
|
|
32329
|
-
async function sleep$
|
|
32329
|
+
async function sleep$5(durationMs) {
|
|
32330
32330
|
await new Promise((resolve) => setTimeout(resolve, durationMs));
|
|
32331
32331
|
}
|
|
32332
|
-
function toErrorMessage$
|
|
32332
|
+
function toErrorMessage$18(error) {
|
|
32333
32333
|
if (error instanceof Error) {
|
|
32334
32334
|
const message = error.message.trim();
|
|
32335
32335
|
return message.length > 0 ? message : "unknown error";
|
|
@@ -33943,7 +33943,7 @@ async function runAuthLogin(input) {
|
|
|
33943
33943
|
ott: input.ott,
|
|
33944
33944
|
allowBackToCaller: input.allowBackToCaller === true
|
|
33945
33945
|
}).catch((error) => {
|
|
33946
|
-
if (runtime.resolvedView === "agent") throw createAuthLoginGuideError(toErrorMessage$
|
|
33946
|
+
if (runtime.resolvedView === "agent") throw createAuthLoginGuideError(toErrorMessage$17(error));
|
|
33947
33947
|
throw error;
|
|
33948
33948
|
});
|
|
33949
33949
|
if (resolved.status !== "submitted") return handleAuthLoginExit({
|
|
@@ -34012,7 +34012,7 @@ async function runAuthLogin(input) {
|
|
|
34012
34012
|
}
|
|
34013
34013
|
});
|
|
34014
34014
|
}
|
|
34015
|
-
throw createAuthLoginGuideError(toErrorMessage$
|
|
34015
|
+
throw createAuthLoginGuideError(toErrorMessage$17(error));
|
|
34016
34016
|
}
|
|
34017
34017
|
throw error;
|
|
34018
34018
|
}
|
|
@@ -34349,7 +34349,7 @@ function resolveClientIdForLogin(value, resolvedView) {
|
|
|
34349
34349
|
try {
|
|
34350
34350
|
return resolveClientId(value);
|
|
34351
34351
|
} catch (error) {
|
|
34352
|
-
if (resolvedView === "agent") throw createAuthLoginGuideError(toErrorMessage$
|
|
34352
|
+
if (resolvedView === "agent") throw createAuthLoginGuideError(toErrorMessage$17(error));
|
|
34353
34353
|
throw error;
|
|
34354
34354
|
}
|
|
34355
34355
|
}
|
|
@@ -34772,7 +34772,7 @@ function normalizeOptionalString$14(value) {
|
|
|
34772
34772
|
const normalized = String(value ?? "").trim();
|
|
34773
34773
|
return normalized.length > 0 ? normalized : null;
|
|
34774
34774
|
}
|
|
34775
|
-
function toErrorMessage$
|
|
34775
|
+
function toErrorMessage$17(error) {
|
|
34776
34776
|
if (error instanceof Error) return error.message;
|
|
34777
34777
|
return String(error);
|
|
34778
34778
|
}
|
|
@@ -38158,13 +38158,13 @@ async function bindImportedUpstreamConversationLocally(input) {
|
|
|
38158
38158
|
agentContextLookupKey: seeded.agentContextLookupKey
|
|
38159
38159
|
};
|
|
38160
38160
|
} catch (error) {
|
|
38161
|
-
if (!snapshot) throw new Error(`local imported upstream conversation bind failed on this device: ${toErrorMessage$
|
|
38161
|
+
if (!snapshot) throw new Error(`local imported upstream conversation bind failed on this device: ${toErrorMessage$16(error)}`);
|
|
38162
38162
|
try {
|
|
38163
38163
|
await restoreImportedConversationExecution({ snapshot });
|
|
38164
38164
|
} 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$
|
|
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$16(error)}; local recovery failed: ${toErrorMessage$16(restoreError)}`, { cause: restoreError });
|
|
38166
38166
|
}
|
|
38167
|
-
throw new LocalImportedUpstreamConversationBindError("daemon.control.local_imported_upstream_conversation_bind_failed", `local imported upstream conversation bind failed on this device: ${toErrorMessage$
|
|
38167
|
+
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
38168
|
}
|
|
38169
38169
|
}
|
|
38170
38170
|
async function clearImportedUpstreamConversationLocalStateLocally(input) {
|
|
@@ -38177,10 +38177,10 @@ async function clearImportedUpstreamConversationLocalStateLocally(input) {
|
|
|
38177
38177
|
transportMode: input.transportMode
|
|
38178
38178
|
});
|
|
38179
38179
|
} 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$
|
|
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$16(error), { cause: error });
|
|
38181
38181
|
}
|
|
38182
38182
|
}
|
|
38183
|
-
function toErrorMessage$
|
|
38183
|
+
function toErrorMessage$16(error) {
|
|
38184
38184
|
if (error instanceof Error && error.message.trim().length > 0) return error.message;
|
|
38185
38185
|
return String(error);
|
|
38186
38186
|
}
|
|
@@ -38919,7 +38919,7 @@ function flushDispatchResultOutbox(input) {
|
|
|
38919
38919
|
return {
|
|
38920
38920
|
...record,
|
|
38921
38921
|
attemptCount: record.attemptCount + 1,
|
|
38922
|
-
lastFailureReason: toErrorMessage$
|
|
38922
|
+
lastFailureReason: toErrorMessage$36(error),
|
|
38923
38923
|
nextAttemptAtMs: nowMs + resolveOutboxBackoffMs(record.attemptCount + 1),
|
|
38924
38924
|
updatedAtMs: nowMs
|
|
38925
38925
|
};
|
|
@@ -39093,7 +39093,7 @@ function createLocalExecutionSlots(input) {
|
|
|
39093
39093
|
dispatchId: selectedTask.dispatchId,
|
|
39094
39094
|
durationMs: Math.max(0, Date.now() - startedAtMs),
|
|
39095
39095
|
errorCode: null,
|
|
39096
|
-
errorMessage: toErrorMessage$
|
|
39096
|
+
errorMessage: toErrorMessage$15(error),
|
|
39097
39097
|
localQueue: buildLocalQueueDiagnostics({
|
|
39098
39098
|
profileId: selectedTask.profileId,
|
|
39099
39099
|
queuePosition: null,
|
|
@@ -39236,7 +39236,7 @@ function createLocalExecutionSlots(input) {
|
|
|
39236
39236
|
function buildAttemptKey(dispatchId, attemptId) {
|
|
39237
39237
|
return `${dispatchId}::${attemptId}`;
|
|
39238
39238
|
}
|
|
39239
|
-
function toErrorMessage$
|
|
39239
|
+
function toErrorMessage$15(error) {
|
|
39240
39240
|
if (error instanceof Error && error.message.trim().length > 0) return error.message;
|
|
39241
39241
|
if (typeof error === "string" && error.trim().length > 0) return error;
|
|
39242
39242
|
return "unknown error";
|
|
@@ -40519,7 +40519,7 @@ function reportInvalidDeliverRequest(input) {
|
|
|
40519
40519
|
leaseEpoch: identity.leaseEpoch,
|
|
40520
40520
|
metadata: {
|
|
40521
40521
|
...buildResultDispatchJournalMetadata(resultPayload),
|
|
40522
|
-
errorMessage: toErrorMessage$
|
|
40522
|
+
errorMessage: toErrorMessage$36(error),
|
|
40523
40523
|
parseIssues: issues
|
|
40524
40524
|
},
|
|
40525
40525
|
profileId: identity.targetProfileId,
|
|
@@ -40530,10 +40530,10 @@ function reportInvalidDeliverRequest(input) {
|
|
|
40530
40530
|
emitRunLine({
|
|
40531
40531
|
presenter: input.presenter,
|
|
40532
40532
|
code: "daemon.run.invalid_deliver_result_send_failed",
|
|
40533
|
-
text: `failed to send invalid deliver result for dispatch ${identity.dispatchId}: ${toErrorMessage$
|
|
40533
|
+
text: `failed to send invalid deliver result for dispatch ${identity.dispatchId}: ${toErrorMessage$36(error)}`,
|
|
40534
40534
|
payload: {
|
|
40535
40535
|
dispatchId: identity.dispatchId,
|
|
40536
|
-
errorMessage: toErrorMessage$
|
|
40536
|
+
errorMessage: toErrorMessage$36(error),
|
|
40537
40537
|
result: "failed",
|
|
40538
40538
|
taskId: identity.taskId
|
|
40539
40539
|
}
|
|
@@ -41727,7 +41727,7 @@ function normalizeResolvedPostMessageAction(input) {
|
|
|
41727
41727
|
resolvedSpaceAction: normalizedPostMessageAction.action
|
|
41728
41728
|
};
|
|
41729
41729
|
} catch (error) {
|
|
41730
|
-
const failureReason = toErrorMessage$
|
|
41730
|
+
const failureReason = toErrorMessage$36(error);
|
|
41731
41731
|
emitRunLine({
|
|
41732
41732
|
presenter: input.presenter,
|
|
41733
41733
|
code: "daemon.run.post_message_validation_rejected",
|
|
@@ -41793,7 +41793,7 @@ function normalizeResolvedThreadAction(input) {
|
|
|
41793
41793
|
})
|
|
41794
41794
|
};
|
|
41795
41795
|
} catch (error) {
|
|
41796
|
-
const failureReason = toErrorMessage$
|
|
41796
|
+
const failureReason = toErrorMessage$36(error);
|
|
41797
41797
|
emitRunLine({
|
|
41798
41798
|
presenter: input.presenter,
|
|
41799
41799
|
code: "daemon.run.thread_action_validation_rejected",
|
|
@@ -41902,7 +41902,7 @@ async function maybeRepairStructuredSpaceAction(input) {
|
|
|
41902
41902
|
dispatchId: input.parsedTask.dispatchId,
|
|
41903
41903
|
...resolveStructuredActionFailureDiagnostics({
|
|
41904
41904
|
carrierKind: "none",
|
|
41905
|
-
parseError: toErrorMessage$
|
|
41905
|
+
parseError: toErrorMessage$36(error),
|
|
41906
41906
|
publicFailureReason: input.failureReason,
|
|
41907
41907
|
repairMode: "controller_roundtrip",
|
|
41908
41908
|
runtimeResult: input.runtimeResult
|
|
@@ -41918,7 +41918,7 @@ async function maybeRepairStructuredSpaceAction(input) {
|
|
|
41918
41918
|
return {
|
|
41919
41919
|
finalFailureDiagnostics: resolveStructuredActionFailureDiagnostics({
|
|
41920
41920
|
carrierKind: "none",
|
|
41921
|
-
parseError: toErrorMessage$
|
|
41921
|
+
parseError: toErrorMessage$36(error),
|
|
41922
41922
|
publicFailureReason: input.failureReason,
|
|
41923
41923
|
repairMode: "controller_roundtrip",
|
|
41924
41924
|
runtimeResult: input.runtimeResult
|
|
@@ -42647,7 +42647,7 @@ function toTaskExecutionError(error) {
|
|
|
42647
42647
|
return {
|
|
42648
42648
|
errorCode: "dispatch.execution_failed",
|
|
42649
42649
|
errorType: "internal",
|
|
42650
|
-
message: toErrorMessage$
|
|
42650
|
+
message: toErrorMessage$36(error)
|
|
42651
42651
|
};
|
|
42652
42652
|
}
|
|
42653
42653
|
function normalizeOptionalContextId(contextId) {
|
|
@@ -43042,7 +43042,7 @@ function sendResultAndSummarize(input) {
|
|
|
43042
43042
|
leaseEpoch: input.leaseEpoch,
|
|
43043
43043
|
metadata: {
|
|
43044
43044
|
...buildResultDispatchJournalMetadata(input.payload),
|
|
43045
|
-
errorMessage: toErrorMessage$
|
|
43045
|
+
errorMessage: toErrorMessage$36(error)
|
|
43046
43046
|
},
|
|
43047
43047
|
result: input.payload.status,
|
|
43048
43048
|
taskId: input.taskId,
|
|
@@ -43051,7 +43051,7 @@ function sendResultAndSummarize(input) {
|
|
|
43051
43051
|
emitRunLine({
|
|
43052
43052
|
presenter: input.presenter,
|
|
43053
43053
|
code: "daemon.run.result_send_failed",
|
|
43054
|
-
text: `daemon result send failed for dispatch ${input.dispatchId}: ${toErrorMessage$
|
|
43054
|
+
text: `daemon result send failed for dispatch ${input.dispatchId}: ${toErrorMessage$36(error)}`,
|
|
43055
43055
|
payload: {
|
|
43056
43056
|
attemptId: input.attemptId,
|
|
43057
43057
|
connectionGeneration: input.connectionGeneration,
|
|
@@ -43084,7 +43084,7 @@ function emitDispatchPreviewFrame(input) {
|
|
|
43084
43084
|
emitRunLine({
|
|
43085
43085
|
presenter: input.presenter,
|
|
43086
43086
|
code: "daemon.run.preview_send_failed",
|
|
43087
|
-
text: `daemon preview send failed for dispatch ${input.dispatchId}: ${toErrorMessage$
|
|
43087
|
+
text: `daemon preview send failed for dispatch ${input.dispatchId}: ${toErrorMessage$36(error)}`,
|
|
43088
43088
|
payload: {
|
|
43089
43089
|
attemptId: input.attemptId,
|
|
43090
43090
|
dispatchId: input.dispatchId,
|
|
@@ -43110,7 +43110,7 @@ function emitDispatchPreviewEndFrame(input) {
|
|
|
43110
43110
|
emitRunLine({
|
|
43111
43111
|
presenter: input.presenter,
|
|
43112
43112
|
code: "daemon.run.preview_end_send_failed",
|
|
43113
|
-
text: `daemon preview end send failed for dispatch ${input.dispatchId}: ${toErrorMessage$
|
|
43113
|
+
text: `daemon preview end send failed for dispatch ${input.dispatchId}: ${toErrorMessage$36(error)}`,
|
|
43114
43114
|
payload: {
|
|
43115
43115
|
attemptId: input.attemptId,
|
|
43116
43116
|
dispatchId: input.dispatchId,
|
|
@@ -43153,7 +43153,7 @@ function emitDispatchRuntimeEvidenceTransition(input) {
|
|
|
43153
43153
|
emitRunLine({
|
|
43154
43154
|
presenter: input.presenter,
|
|
43155
43155
|
code: "daemon.run.runtime_evidence_send_failed",
|
|
43156
|
-
text: `daemon runtime evidence ${input.phase} send failed for dispatch ${identity.dispatchId}: ${toErrorMessage$
|
|
43156
|
+
text: `daemon runtime evidence ${input.phase} send failed for dispatch ${identity.dispatchId}: ${toErrorMessage$36(error)}`,
|
|
43157
43157
|
payload: {
|
|
43158
43158
|
attemptId: identity.attemptId,
|
|
43159
43159
|
dispatchId: identity.dispatchId,
|
|
@@ -43252,7 +43252,7 @@ function emitDispatchLifecycleTransition(input) {
|
|
|
43252
43252
|
dispatchId: input.dispatchId,
|
|
43253
43253
|
leaseEpoch: input.leaseEpoch,
|
|
43254
43254
|
metadata: {
|
|
43255
|
-
errorMessage: toErrorMessage$
|
|
43255
|
+
errorMessage: toErrorMessage$36(error),
|
|
43256
43256
|
localQueue: input.localQueue ?? null,
|
|
43257
43257
|
phase: input.phase
|
|
43258
43258
|
},
|
|
@@ -43263,7 +43263,7 @@ function emitDispatchLifecycleTransition(input) {
|
|
|
43263
43263
|
emitRunLine({
|
|
43264
43264
|
presenter: input.presenter,
|
|
43265
43265
|
code: "daemon.run.lifecycle_send_failed",
|
|
43266
|
-
text: `daemon lifecycle ${input.phase} send failed for dispatch ${input.dispatchId}: ${toErrorMessage$
|
|
43266
|
+
text: `daemon lifecycle ${input.phase} send failed for dispatch ${input.dispatchId}: ${toErrorMessage$36(error)}`,
|
|
43267
43267
|
payload: {
|
|
43268
43268
|
attemptId: input.attemptId,
|
|
43269
43269
|
dispatchId: input.dispatchId,
|
|
@@ -43892,7 +43892,7 @@ async function runDaemonSocketSession(input) {
|
|
|
43892
43892
|
emitRunLine({
|
|
43893
43893
|
presenter: input.presenter,
|
|
43894
43894
|
code: "daemon.run.heartbeat_failed",
|
|
43895
|
-
text: `heartbeat failed (${String(consecutiveHeartbeatFailures)}/${String(HEARTBEAT_CONSECUTIVE_FAILURES_BEFORE_CLOSE)}): ${toErrorMessage$
|
|
43895
|
+
text: `heartbeat failed (${String(consecutiveHeartbeatFailures)}/${String(HEARTBEAT_CONSECUTIVE_FAILURES_BEFORE_CLOSE)}): ${toErrorMessage$36(error)}`
|
|
43896
43896
|
});
|
|
43897
43897
|
if (shouldCloseSocket) {
|
|
43898
43898
|
input.socket.close(1011, "heartbeat_failed");
|
|
@@ -43925,7 +43925,7 @@ async function runDaemonSocketSession(input) {
|
|
|
43925
43925
|
emitRunLine({
|
|
43926
43926
|
presenter: input.presenter,
|
|
43927
43927
|
code: "daemon.run.heartbeat_failed",
|
|
43928
|
-
text: `heartbeat failed: ${toErrorMessage$
|
|
43928
|
+
text: `heartbeat failed: ${toErrorMessage$36(error)}`
|
|
43929
43929
|
});
|
|
43930
43930
|
});
|
|
43931
43931
|
}, normalizedDelayMs);
|
|
@@ -43967,7 +43967,7 @@ async function runDaemonSocketSession(input) {
|
|
|
43967
43967
|
emitRunLine({
|
|
43968
43968
|
presenter: input.presenter,
|
|
43969
43969
|
code: "daemon.run.catalog_sync_signal_read_failed",
|
|
43970
|
-
text: `catalog sync signal read failed: ${toErrorMessage$
|
|
43970
|
+
text: `catalog sync signal read failed: ${toErrorMessage$36(error)}`
|
|
43971
43971
|
});
|
|
43972
43972
|
}).finally(() => {
|
|
43973
43973
|
scheduleCatalogSyncSignalPoll();
|
|
@@ -44193,7 +44193,7 @@ async function runDaemonSocketSession(input) {
|
|
|
44193
44193
|
emitRunLine({
|
|
44194
44194
|
presenter: input.presenter,
|
|
44195
44195
|
code: "daemon.run.runtime_capability_report_sync_failed",
|
|
44196
|
-
text: `runtime capability report sync failed: ${toErrorMessage$
|
|
44196
|
+
text: `runtime capability report sync failed: ${toErrorMessage$36(error)}`
|
|
44197
44197
|
});
|
|
44198
44198
|
}
|
|
44199
44199
|
};
|
|
@@ -44201,7 +44201,7 @@ async function runDaemonSocketSession(input) {
|
|
|
44201
44201
|
emitRunLine({
|
|
44202
44202
|
presenter: input.presenter,
|
|
44203
44203
|
code: "daemon.run.socket_error",
|
|
44204
|
-
text: `daemon stream socket error: ${toErrorMessage$
|
|
44204
|
+
text: `daemon stream socket error: ${toErrorMessage$36(error)}`
|
|
44205
44205
|
});
|
|
44206
44206
|
});
|
|
44207
44207
|
input.socket.onMessage((raw) => {
|
|
@@ -44856,7 +44856,7 @@ const runDaemonServiceLoop = async (input) => {
|
|
|
44856
44856
|
action: reconcileDecision.action,
|
|
44857
44857
|
backoffMs,
|
|
44858
44858
|
driftClass: reconcileDecision.driftClass,
|
|
44859
|
-
error: toErrorMessage$
|
|
44859
|
+
error: toErrorMessage$36(error),
|
|
44860
44860
|
foregroundActive: reconcileDecision.foregroundActive,
|
|
44861
44861
|
lifecycleLocked: reconcileDecision.lifecycleLocked,
|
|
44862
44862
|
owner: reconcileDecision.owner,
|
|
@@ -44867,7 +44867,7 @@ const runDaemonServiceLoop = async (input) => {
|
|
|
44867
44867
|
action: reconcileDecision.action,
|
|
44868
44868
|
backoffMs,
|
|
44869
44869
|
driftClass: reconcileDecision.driftClass,
|
|
44870
|
-
error: toErrorMessage$
|
|
44870
|
+
error: toErrorMessage$36(error),
|
|
44871
44871
|
foregroundActive: reconcileDecision.foregroundActive,
|
|
44872
44872
|
lifecycleLocked: reconcileDecision.lifecycleLocked,
|
|
44873
44873
|
owner: reconcileDecision.owner,
|
|
@@ -44877,14 +44877,14 @@ const runDaemonServiceLoop = async (input) => {
|
|
|
44877
44877
|
emitRunLine({
|
|
44878
44878
|
presenter: input.presenter,
|
|
44879
44879
|
code: "daemon.run.reconnect",
|
|
44880
|
-
text: `daemon stream reconnect scheduled in ${String(backoffMs)}ms (${toErrorMessage$
|
|
44880
|
+
text: `daemon stream reconnect scheduled in ${String(backoffMs)}ms (${toErrorMessage$36(error)})`,
|
|
44881
44881
|
payload: {
|
|
44882
44882
|
attempt: reconnectAttempt,
|
|
44883
44883
|
backoffMs,
|
|
44884
|
-
error: toErrorMessage$
|
|
44884
|
+
error: toErrorMessage$36(error)
|
|
44885
44885
|
}
|
|
44886
44886
|
});
|
|
44887
|
-
await sleep$
|
|
44887
|
+
await sleep$9(backoffMs);
|
|
44888
44888
|
}
|
|
44889
44889
|
} finally {
|
|
44890
44890
|
process.off("SIGINT", onSigint);
|
|
@@ -45354,16 +45354,16 @@ function isLaunchdBootstrapIosError$1(message) {
|
|
|
45354
45354
|
}
|
|
45355
45355
|
function shouldAttemptLaunchdAutoRepair(input) {
|
|
45356
45356
|
if (input.controller !== "launchd") return false;
|
|
45357
|
-
return isLaunchdBootstrapIosError$1(sanitizeSystemServiceErrorMessage$1(toErrorMessage$
|
|
45357
|
+
return isLaunchdBootstrapIosError$1(sanitizeSystemServiceErrorMessage$1(toErrorMessage$14(input.error)));
|
|
45358
45358
|
}
|
|
45359
45359
|
function buildLaunchdAutoRepairFailureError(input) {
|
|
45360
45360
|
return new Error([
|
|
45361
45361
|
"launchd auto-repair retry failed.",
|
|
45362
|
-
`initial error: ${toErrorMessage$
|
|
45363
|
-
`retry error: ${toErrorMessage$
|
|
45362
|
+
`initial error: ${toErrorMessage$14(input.initialError)}`,
|
|
45363
|
+
`retry error: ${toErrorMessage$14(input.retryError)}`
|
|
45364
45364
|
].join(" "));
|
|
45365
45365
|
}
|
|
45366
|
-
function toErrorMessage$
|
|
45366
|
+
function toErrorMessage$14(error) {
|
|
45367
45367
|
if (error instanceof Error) return error.message;
|
|
45368
45368
|
return String(error);
|
|
45369
45369
|
}
|
|
@@ -45726,7 +45726,7 @@ var DaemonReinstallUnexpectedStartError = class extends Error {
|
|
|
45726
45726
|
diagnosticDetail;
|
|
45727
45727
|
outcome;
|
|
45728
45728
|
constructor(input) {
|
|
45729
|
-
super(toErrorMessage$
|
|
45729
|
+
super(toErrorMessage$13(input.cause));
|
|
45730
45730
|
this.name = "DaemonReinstallUnexpectedStartError";
|
|
45731
45731
|
this.cause = input.cause;
|
|
45732
45732
|
this.diagnosticDetail = input.diagnosticDetail;
|
|
@@ -45744,7 +45744,7 @@ var DaemonReinstallFailureError = class extends Error {
|
|
|
45744
45744
|
evidencePath;
|
|
45745
45745
|
failureStage;
|
|
45746
45746
|
constructor(input) {
|
|
45747
|
-
super(toErrorMessage$
|
|
45747
|
+
super(toErrorMessage$13(input.cause));
|
|
45748
45748
|
this.name = "DaemonReinstallFailureError";
|
|
45749
45749
|
this.backupDataPath = input.backupDataPath;
|
|
45750
45750
|
this.cause = input.cause;
|
|
@@ -46442,7 +46442,7 @@ async function runDaemonReinstall(input, options = {}) {
|
|
|
46442
46442
|
if (error instanceof DaemonReinstallFailureError) throw new Error(buildDaemonReinstallFailureMessage({
|
|
46443
46443
|
action: displayAction,
|
|
46444
46444
|
backupDataPath: error.backupDataPath,
|
|
46445
|
-
errorMessage: toErrorMessage$
|
|
46445
|
+
errorMessage: toErrorMessage$13(error.cause),
|
|
46446
46446
|
failureStage: error.failureStage,
|
|
46447
46447
|
evidencePath: error.evidencePath ?? await captureDaemonServiceEvidenceBestEffort({
|
|
46448
46448
|
runtime,
|
|
@@ -46625,14 +46625,14 @@ async function runDaemonAfterReinstallStartWithRetry(input) {
|
|
|
46625
46625
|
if (result.ok || isDaemonRunAlreadyRunningReason(result.reason) || normalizeDaemonRunReason(result.reason) === "cancelled") process.exitCode = previousExitCode;
|
|
46626
46626
|
if (normalizeDaemonRunReason(result.reason) === "start_failed" && attempt < REINSTALL_START_RETRY_ATTEMPTS) {
|
|
46627
46627
|
process.exitCode = previousExitCode;
|
|
46628
|
-
await sleep$
|
|
46628
|
+
await sleep$4(input.startRetryDelayMs);
|
|
46629
46629
|
continue;
|
|
46630
46630
|
}
|
|
46631
46631
|
return result.reason;
|
|
46632
46632
|
} catch (error) {
|
|
46633
46633
|
if (attempt < REINSTALL_START_RETRY_ATTEMPTS) {
|
|
46634
46634
|
process.exitCode = previousExitCode;
|
|
46635
|
-
await sleep$
|
|
46635
|
+
await sleep$4(input.startRetryDelayMs);
|
|
46636
46636
|
continue;
|
|
46637
46637
|
}
|
|
46638
46638
|
const startupDiagnostic = await readDaemonStartFailureLogDiagnostic({ cursor: startFailureLogCursor });
|
|
@@ -46669,7 +46669,7 @@ async function applyDaemonReinstallTargetDesiredState(input) {
|
|
|
46669
46669
|
}
|
|
46670
46670
|
function buildDaemonReinstallUnexpectedStartSummary(error, action = "repair") {
|
|
46671
46671
|
const actionLabel = formatDaemonServiceMaintenanceActionLabel(action);
|
|
46672
|
-
const detail = sanitizeSystemServiceErrorMessage(toErrorMessage$
|
|
46672
|
+
const detail = sanitizeSystemServiceErrorMessage(toErrorMessage$13(error));
|
|
46673
46673
|
if (!detail) return `ATS hit a local start error right after service ${actionLabel}.`;
|
|
46674
46674
|
return `ATS hit a local start error right after service ${actionLabel}: ${detail}`;
|
|
46675
46675
|
}
|
|
@@ -46778,7 +46778,7 @@ async function waitForDaemonHealthyAfterReinstall(input) {
|
|
|
46778
46778
|
}).catch(() => null);
|
|
46779
46779
|
if (inventory && isDaemonInventoryRunningAndAligned(inventory)) return inventory.runtimeStatus;
|
|
46780
46780
|
lastRuntime = inventory?.runtimeStatus ?? await readCurrentObservedDaemonRuntimeStatus();
|
|
46781
|
-
await sleep$
|
|
46781
|
+
await sleep$4(REINSTALL_VERIFY_POLL_MS);
|
|
46782
46782
|
}
|
|
46783
46783
|
const statusText = lastRuntime ? describeDaemonRuntimeStatus(lastRuntime) : "No runtime status available.";
|
|
46784
46784
|
throw new Error(`ATS Service repair verification timed out after ${String(input.verifyWaitMs)}ms. ${statusText}`);
|
|
@@ -46885,7 +46885,7 @@ async function stopDaemonForStrictTeardown(input) {
|
|
|
46885
46885
|
await input.context.serviceManager.stop().catch((error) => {
|
|
46886
46886
|
throw createStrictTeardownError({
|
|
46887
46887
|
reason: input.reason,
|
|
46888
|
-
message: `failed to stop system service (${input.context.serviceManager?.controller}): ${toErrorMessage$
|
|
46888
|
+
message: `failed to stop system service (${input.context.serviceManager?.controller}): ${toErrorMessage$13(error)}`,
|
|
46889
46889
|
hint: "run `ats service stop --force` and retry",
|
|
46890
46890
|
stage: "stop-wait"
|
|
46891
46891
|
});
|
|
@@ -46930,7 +46930,7 @@ async function uninstallSystemServiceForStrictTeardown(input) {
|
|
|
46930
46930
|
for (const manager of managers) await manager.uninstall().catch((error) => {
|
|
46931
46931
|
throw createStrictTeardownError({
|
|
46932
46932
|
reason: input.reason,
|
|
46933
|
-
message: `failed to uninstall system service (${manager.controller}): ${toErrorMessage$
|
|
46933
|
+
message: `failed to uninstall system service (${manager.controller}): ${toErrorMessage$13(error)}`,
|
|
46934
46934
|
hint: "fix OS service permissions and retry",
|
|
46935
46935
|
stage: "uninstall-verify"
|
|
46936
46936
|
});
|
|
@@ -46947,7 +46947,7 @@ async function verifySystemServiceRemovedAfterStrictTeardown(input) {
|
|
|
46947
46947
|
const finalManagerStatus = await manager.status().catch((error) => {
|
|
46948
46948
|
throw createStrictTeardownError({
|
|
46949
46949
|
reason: input.reason,
|
|
46950
|
-
message: `failed to verify system service status (${manager.controller}): ${toErrorMessage$
|
|
46950
|
+
message: `failed to verify system service status (${manager.controller}): ${toErrorMessage$13(error)}`,
|
|
46951
46951
|
hint: "run `ats service status` and confirm service manager state",
|
|
46952
46952
|
stage: "uninstall-verify"
|
|
46953
46953
|
});
|
|
@@ -46958,13 +46958,13 @@ async function verifySystemServiceRemovedAfterStrictTeardown(input) {
|
|
|
46958
46958
|
}
|
|
46959
46959
|
}
|
|
46960
46960
|
if (allRemoved) return;
|
|
46961
|
-
await sleep$
|
|
46961
|
+
await sleep$4(STRICT_TEARDOWN_VERIFY_POLL_MS);
|
|
46962
46962
|
}
|
|
46963
46963
|
for (const manager of managers) {
|
|
46964
46964
|
const finalManagerStatus = await manager.status().catch((error) => {
|
|
46965
46965
|
throw createStrictTeardownError({
|
|
46966
46966
|
reason: input.reason,
|
|
46967
|
-
message: `failed to verify system service status (${manager.controller}): ${toErrorMessage$
|
|
46967
|
+
message: `failed to verify system service status (${manager.controller}): ${toErrorMessage$13(error)}`,
|
|
46968
46968
|
hint: "run `ats service status` and confirm service manager state",
|
|
46969
46969
|
stage: "uninstall-verify"
|
|
46970
46970
|
});
|
|
@@ -46995,7 +46995,7 @@ async function ensureRuntimeCleanAfterStrictTeardown(input) {
|
|
|
46995
46995
|
if ((await input.deps.readCurrentObservedDaemonRuntimeStatus()).status === "not_running") return;
|
|
46996
46996
|
}
|
|
46997
46997
|
}
|
|
46998
|
-
await sleep$
|
|
46998
|
+
await sleep$4(STRICT_TEARDOWN_VERIFY_POLL_MS);
|
|
46999
46999
|
}
|
|
47000
47000
|
const [ownedProcesses, finalRuntime] = await Promise.all([input.deps.listDaemonOwnedProcesses({ ignoreProcessIds: [process.pid] }), input.deps.readCurrentObservedDaemonRuntimeStatus()]);
|
|
47001
47001
|
if (finalRuntime.status === "running") throw createStrictTeardownError({
|
|
@@ -47796,7 +47796,7 @@ function isLocalControllerSignInRequiredReason(reason) {
|
|
|
47796
47796
|
return reason === "sign in required";
|
|
47797
47797
|
}
|
|
47798
47798
|
function buildSystemServiceStartupFailureReport(input) {
|
|
47799
|
-
const message = sanitizeSystemServiceErrorMessage(toErrorMessage$
|
|
47799
|
+
const message = sanitizeSystemServiceErrorMessage(toErrorMessage$13(input.error));
|
|
47800
47800
|
const localLogPath = getDaemonSystemServiceLogPath();
|
|
47801
47801
|
if (isLaunchdBootstrapIosError(message)) {
|
|
47802
47802
|
const card = buildDaemonStartNeedsAttentionCard({
|
|
@@ -47872,7 +47872,7 @@ async function waitForSystemServiceStartup(input) {
|
|
|
47872
47872
|
state: "running",
|
|
47873
47873
|
runtimeStatus: inventory.runtimeStatus
|
|
47874
47874
|
};
|
|
47875
|
-
await sleep$
|
|
47875
|
+
await sleep$4(input.pollMs);
|
|
47876
47876
|
}
|
|
47877
47877
|
const finalInventory = await inspectDaemonServiceInventory({
|
|
47878
47878
|
expectedVersion: input.expectedVersion,
|
|
@@ -48138,7 +48138,7 @@ async function runDirectDaemonServiceLoop(input) {
|
|
|
48138
48138
|
};
|
|
48139
48139
|
} catch (error) {
|
|
48140
48140
|
return await handleDaemonRunStartFailure({
|
|
48141
|
-
fallbackRawLine: toErrorMessage$
|
|
48141
|
+
fallbackRawLine: toErrorMessage$13(error),
|
|
48142
48142
|
gatewayUrl: input.gatewayUrl,
|
|
48143
48143
|
presenter: input.presenter,
|
|
48144
48144
|
runtime: input.runtime,
|
|
@@ -48440,11 +48440,11 @@ async function stopRegisteredDaemonServiceManager(input) {
|
|
|
48440
48440
|
run: async () => await input.ownerSnapshot.serviceManager?.stop()
|
|
48441
48441
|
});
|
|
48442
48442
|
} catch (error) {
|
|
48443
|
-
if (input.mode !== "best_effort") throw new Error(`Failed to stop system service (${input.ownerSnapshot.runtimeStatus.serviceController}): ${toErrorMessage$
|
|
48443
|
+
if (input.mode !== "best_effort") throw new Error(`Failed to stop system service (${input.ownerSnapshot.runtimeStatus.serviceController}): ${toErrorMessage$13(error)}`);
|
|
48444
48444
|
return buildDaemonStopWarningResult({
|
|
48445
48445
|
reason: "stop_failed",
|
|
48446
48446
|
runtimeStatus: input.ownerSnapshot.runtimeStatus,
|
|
48447
|
-
errorMessage: toErrorMessage$
|
|
48447
|
+
errorMessage: toErrorMessage$13(error)
|
|
48448
48448
|
});
|
|
48449
48449
|
}
|
|
48450
48450
|
if (!await waitForDaemonSystemServiceToStop({
|
|
@@ -48475,7 +48475,7 @@ async function stopRegisteredDaemonServiceManager(input) {
|
|
|
48475
48475
|
return buildDaemonStopWarningResult({
|
|
48476
48476
|
reason: "stop_failed",
|
|
48477
48477
|
runtimeStatus: input.ownerSnapshot.runtimeStatus,
|
|
48478
|
-
errorMessage: toErrorMessage$
|
|
48478
|
+
errorMessage: toErrorMessage$13(error)
|
|
48479
48479
|
});
|
|
48480
48480
|
}
|
|
48481
48481
|
const finalOwnerSnapshot = residualCleanupResult.shouldRefresh ? await readCurrentDaemonOwnerSnapshot() : residualCleanupResult.ownerSnapshot;
|
|
@@ -48548,7 +48548,7 @@ async function stopCurrentLaneDaemonProcess(input) {
|
|
|
48548
48548
|
pid: daemonPid,
|
|
48549
48549
|
reason: "stop_failed",
|
|
48550
48550
|
runtimeStatus: input.runtimeStatus,
|
|
48551
|
-
errorMessage: toErrorMessage$
|
|
48551
|
+
errorMessage: toErrorMessage$13(error)
|
|
48552
48552
|
};
|
|
48553
48553
|
}
|
|
48554
48554
|
}
|
|
@@ -48632,7 +48632,7 @@ async function stopTrackedDaemonProcess(input) {
|
|
|
48632
48632
|
type: "process_stop.action",
|
|
48633
48633
|
result: "failed",
|
|
48634
48634
|
metadata: {
|
|
48635
|
-
errorMessage: toErrorMessage$
|
|
48635
|
+
errorMessage: toErrorMessage$13(error),
|
|
48636
48636
|
pid: input.pid,
|
|
48637
48637
|
reason: input.reason,
|
|
48638
48638
|
signal: input.signal
|
|
@@ -49656,13 +49656,13 @@ async function runDaemonServiceDetached(input) {
|
|
|
49656
49656
|
if (typeof child.pid === "number" && child.pid > 0) await cleanupDetachedRuntimeStateIfOwnedByPid(child.pid).catch(() => {});
|
|
49657
49657
|
return await handleDaemonRunStartFailure({
|
|
49658
49658
|
cursor: startFailureLogCursor,
|
|
49659
|
-
fallbackRawLine: selectRelevantDaemonStartFailureLogLine(startupOutput.summary()) ?? toErrorMessage$
|
|
49659
|
+
fallbackRawLine: selectRelevantDaemonStartFailureLogLine(startupOutput.summary()) ?? toErrorMessage$13(error),
|
|
49660
49660
|
gatewayUrl: input.gatewayUrl,
|
|
49661
49661
|
presenter: input.presenter,
|
|
49662
49662
|
runtime: input.runtime,
|
|
49663
49663
|
genericErrorPayload: {
|
|
49664
49664
|
codePrefix: "daemon.run.start_failed",
|
|
49665
|
-
error: /* @__PURE__ */ new Error(`Failed to start ATS Service process: ${toErrorMessage$
|
|
49665
|
+
error: /* @__PURE__ */ new Error(`Failed to start ATS Service process: ${toErrorMessage$13(error)}`)
|
|
49666
49666
|
}
|
|
49667
49667
|
});
|
|
49668
49668
|
} finally {
|
|
@@ -49761,7 +49761,7 @@ function waitForDetachedChildProcessSpawn(child) {
|
|
|
49761
49761
|
child.once("error", onError);
|
|
49762
49762
|
});
|
|
49763
49763
|
}
|
|
49764
|
-
function sleep$
|
|
49764
|
+
function sleep$4(milliseconds) {
|
|
49765
49765
|
return new Promise((resolve) => {
|
|
49766
49766
|
setTimeout(resolve, milliseconds);
|
|
49767
49767
|
});
|
|
@@ -49782,7 +49782,7 @@ async function waitForDetachedBackgroundProcessStartup(child, startupDelayMs, st
|
|
|
49782
49782
|
reason: startupLifecycle,
|
|
49783
49783
|
startupOutput: startupOutput.summary()
|
|
49784
49784
|
}));
|
|
49785
|
-
await sleep$
|
|
49785
|
+
await sleep$4(startupPollMs);
|
|
49786
49786
|
}
|
|
49787
49787
|
const finalStatus = await readCurrentObservedDaemonRuntimeStatus().catch(() => null);
|
|
49788
49788
|
if (finalStatus?.status === "running" && finalStatus.pid === child.pid) return;
|
|
@@ -50132,7 +50132,7 @@ function describeDaemonRuntimeStatus(status) {
|
|
|
50132
50132
|
if (status.status === "not_running") return "Service is not running.";
|
|
50133
50133
|
return "Service runtime status is unknown.";
|
|
50134
50134
|
}
|
|
50135
|
-
function toErrorMessage$
|
|
50135
|
+
function toErrorMessage$13(error) {
|
|
50136
50136
|
if (error instanceof Error) return error.message;
|
|
50137
50137
|
return String(error);
|
|
50138
50138
|
}
|
|
@@ -50162,7 +50162,7 @@ async function stopDaemonProcess(pid, signal) {
|
|
|
50162
50162
|
process.kill(pid, signal);
|
|
50163
50163
|
} catch (error) {
|
|
50164
50164
|
if (isNodeErrorCode(error, "ESRCH")) return true;
|
|
50165
|
-
throw new Error(`Failed to send ${signal} to pid ${String(pid)}: ${toErrorMessage$
|
|
50165
|
+
throw new Error(`Failed to send ${signal} to pid ${String(pid)}: ${toErrorMessage$13(error)}`);
|
|
50166
50166
|
}
|
|
50167
50167
|
if (signal === "SIGKILL") return true;
|
|
50168
50168
|
return await waitForProcessToExit(pid);
|
|
@@ -50471,7 +50471,7 @@ async function runDaemonServiceParticipationRefresh(input) {
|
|
|
50471
50471
|
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
50472
|
});
|
|
50473
50473
|
return {
|
|
50474
|
-
errorMessage: toErrorMessage$
|
|
50474
|
+
errorMessage: toErrorMessage$36(error),
|
|
50475
50475
|
status: "needs_attention"
|
|
50476
50476
|
};
|
|
50477
50477
|
}
|
|
@@ -50778,7 +50778,7 @@ async function runDaemonServiceAutoHeal(input) {
|
|
|
50778
50778
|
cooldownUntil: null
|
|
50779
50779
|
};
|
|
50780
50780
|
} catch (error) {
|
|
50781
|
-
const errorMessage = toErrorMessage$
|
|
50781
|
+
const errorMessage = toErrorMessage$12(error);
|
|
50782
50782
|
await recordDaemonServiceRepairFailure({
|
|
50783
50783
|
actions: safeActions,
|
|
50784
50784
|
errorMessage
|
|
@@ -50857,7 +50857,7 @@ async function terminateDaemonOwnedProcess(pid) {
|
|
|
50857
50857
|
const deadline = Date.now() + AUTO_HEAL_DUPLICATE_WAIT_MS;
|
|
50858
50858
|
while (Date.now() < deadline) {
|
|
50859
50859
|
if (!isPidAlive$1(pid)) return;
|
|
50860
|
-
await sleep$
|
|
50860
|
+
await sleep$3(AUTO_HEAL_DUPLICATE_POLL_MS);
|
|
50861
50861
|
}
|
|
50862
50862
|
if (isPidAlive$1(pid)) process$1.kill(pid, "SIGKILL");
|
|
50863
50863
|
}
|
|
@@ -50882,10 +50882,10 @@ function isPidAlive$1(pid) {
|
|
|
50882
50882
|
return !(error instanceof Error && error.code === "ESRCH");
|
|
50883
50883
|
}
|
|
50884
50884
|
}
|
|
50885
|
-
async function sleep$
|
|
50885
|
+
async function sleep$3(ms) {
|
|
50886
50886
|
await new Promise((resolve) => setTimeout(resolve, ms));
|
|
50887
50887
|
}
|
|
50888
|
-
function toErrorMessage$
|
|
50888
|
+
function toErrorMessage$12(error) {
|
|
50889
50889
|
if (error instanceof Error && error.message.trim().length > 0) return error.message;
|
|
50890
50890
|
return String(error);
|
|
50891
50891
|
}
|
|
@@ -51068,7 +51068,7 @@ async function waitForDaemonStartupAlignmentSettlement(input) {
|
|
|
51068
51068
|
cliScriptPath: input.cliScriptPath
|
|
51069
51069
|
}).catch(() => null);
|
|
51070
51070
|
if (!inventory) {
|
|
51071
|
-
await sleep$
|
|
51071
|
+
await sleep$2(input.pollMs);
|
|
51072
51072
|
continue;
|
|
51073
51073
|
}
|
|
51074
51074
|
const decision = resolveDaemonServiceAlignmentDecision({
|
|
@@ -51089,11 +51089,11 @@ async function waitForDaemonStartupAlignmentSettlement(input) {
|
|
|
51089
51089
|
cooldownUntil: null,
|
|
51090
51090
|
backupDataPath: null
|
|
51091
51091
|
};
|
|
51092
|
-
await sleep$
|
|
51092
|
+
await sleep$2(input.pollMs);
|
|
51093
51093
|
}
|
|
51094
51094
|
return null;
|
|
51095
51095
|
}
|
|
51096
|
-
async function sleep$
|
|
51096
|
+
async function sleep$2(ms) {
|
|
51097
51097
|
await new Promise((resolve) => {
|
|
51098
51098
|
setTimeout(resolve, ms);
|
|
51099
51099
|
});
|
|
@@ -58101,7 +58101,7 @@ async function runDoctorProfileCheck(input) {
|
|
|
58101
58101
|
}
|
|
58102
58102
|
atsProfile = {
|
|
58103
58103
|
ok: false,
|
|
58104
|
-
message: `ats-profile failed: ${toErrorMessage$
|
|
58104
|
+
message: `ats-profile failed: ${toErrorMessage$11(error)}`
|
|
58105
58105
|
};
|
|
58106
58106
|
}
|
|
58107
58107
|
emitCheckResult(input.presenter, atsProfile, {
|
|
@@ -58488,7 +58488,7 @@ async function runCheck(label, fn) {
|
|
|
58488
58488
|
} catch (err) {
|
|
58489
58489
|
return {
|
|
58490
58490
|
ok: false,
|
|
58491
|
-
message: `${label} failed: ${toErrorMessage$
|
|
58491
|
+
message: `${label} failed: ${toErrorMessage$11(err)}`
|
|
58492
58492
|
};
|
|
58493
58493
|
}
|
|
58494
58494
|
}
|
|
@@ -58613,7 +58613,7 @@ async function maybePromptRepairAfterLogin(presenter) {
|
|
|
58613
58613
|
function normalizeDoctorHumanText(text) {
|
|
58614
58614
|
return text.replace(DOCTOR_TEXT_PREFIX_RE, "");
|
|
58615
58615
|
}
|
|
58616
|
-
function toErrorMessage$
|
|
58616
|
+
function toErrorMessage$11(err) {
|
|
58617
58617
|
if (err instanceof Error) return err.message;
|
|
58618
58618
|
return String(err);
|
|
58619
58619
|
}
|
|
@@ -61297,7 +61297,7 @@ async function resolvePrepareReadinessApiEvidence(input) {
|
|
|
61297
61297
|
} catch (error) {
|
|
61298
61298
|
console.warn("[ats.prepare_readiness.api_read_failed]", {
|
|
61299
61299
|
event: "cli.prepare_readiness.api_read_failed",
|
|
61300
|
-
error: toErrorMessage$
|
|
61300
|
+
error: toErrorMessage$10(error),
|
|
61301
61301
|
profileId: input.profile.atsProfileId
|
|
61302
61302
|
});
|
|
61303
61303
|
return unavailableEvidence({
|
|
@@ -61338,7 +61338,7 @@ function unavailableEvidence(input) {
|
|
|
61338
61338
|
status: "unavailable"
|
|
61339
61339
|
};
|
|
61340
61340
|
}
|
|
61341
|
-
function toErrorMessage$
|
|
61341
|
+
function toErrorMessage$10(error) {
|
|
61342
61342
|
if (error instanceof Error) {
|
|
61343
61343
|
const message = error.message.trim();
|
|
61344
61344
|
return message.length > 0 ? message : "unknown error";
|
|
@@ -63603,58 +63603,6 @@ async function collectStartLocalReadiness(input) {
|
|
|
63603
63603
|
};
|
|
63604
63604
|
}
|
|
63605
63605
|
|
|
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
63606
|
//#endregion
|
|
63659
63607
|
//#region src/system/selected-local-runtime-reporting.ts
|
|
63660
63608
|
function resolveSelectedLocalRuntimeReadiness(input) {
|
|
@@ -64468,8 +64416,6 @@ const PREPARE_SESSION_MAX_RECONNECT_ATTEMPTS = 3;
|
|
|
64468
64416
|
const PREPARE_SESSION_RECONNECT_DELAY_MS = 1e3;
|
|
64469
64417
|
const REPORT_RUNTIME_CONNECTION_MAX_ATTEMPTS = 12;
|
|
64470
64418
|
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
64419
|
const TERMINAL_PREPARE_STEP_ORDER = [
|
|
64474
64420
|
"prepare_selected_agents",
|
|
64475
64421
|
"refresh_service",
|
|
@@ -64509,7 +64455,7 @@ async function runPrepareSessionExecutor(input) {
|
|
|
64509
64455
|
if (error instanceof PrepareSessionConnectionInterruptedError && reconnectAttempts < PREPARE_SESSION_MAX_RECONNECT_ATTEMPTS) {
|
|
64510
64456
|
reconnectAttempts += 1;
|
|
64511
64457
|
emitHumanStatus(input, "Reconnecting", ["ATS Web connection was interrupted.", "Reconnecting to the setup session..."]);
|
|
64512
|
-
await sleep$
|
|
64458
|
+
await sleep$1(PREPARE_SESSION_RECONNECT_DELAY_MS);
|
|
64513
64459
|
initial = await resolvePrepareSessionToken({
|
|
64514
64460
|
gatewayUrl: input.gatewayUrl,
|
|
64515
64461
|
opaqueToken: input.startSession
|
|
@@ -64909,7 +64855,7 @@ async function connectSelectedLocalAgentsToAts(input) {
|
|
|
64909
64855
|
} catch (error) {
|
|
64910
64856
|
if (!isTransientSelectedAgentConnectionError(error) || attempt >= REPORT_RUNTIME_CONNECTION_MAX_ATTEMPTS) throw error;
|
|
64911
64857
|
lastTransientError = error;
|
|
64912
|
-
await sleep$
|
|
64858
|
+
await sleep$1(REPORT_RUNTIME_CONNECTION_RETRY_DELAY_MS);
|
|
64913
64859
|
}
|
|
64914
64860
|
throw lastTransientError ?? /* @__PURE__ */ new Error("ATS could not connect local agents.");
|
|
64915
64861
|
}
|
|
@@ -64925,22 +64871,14 @@ async function connectSelectedLocalAgentsToAtsOnce(input) {
|
|
|
64925
64871
|
readiness,
|
|
64926
64872
|
localAgentIds: input.localAgentIds
|
|
64927
64873
|
}));
|
|
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
|
-
});
|
|
64874
|
+
if (input.syncRouteCatalog) await notifyRouteCatalogAfterPrepare({ reason: "prepare_selected_agents_reported" });
|
|
64937
64875
|
return {
|
|
64938
64876
|
...runtimeIdentity,
|
|
64939
64877
|
localReadinessSnapshot: buildPrepareLocalReadinessSnapshot(readiness)
|
|
64940
64878
|
};
|
|
64941
64879
|
}
|
|
64942
64880
|
function isTransientSelectedAgentConnectionError(error) {
|
|
64943
|
-
const rawMessage = toErrorMessage$
|
|
64881
|
+
const rawMessage = toErrorMessage$9(error).toLowerCase();
|
|
64944
64882
|
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
64883
|
}
|
|
64946
64884
|
async function verifySelectedLocalAgentsConnectedToAts(input) {
|
|
@@ -64961,10 +64899,6 @@ async function verifySelectedLocalAgentsConnectedToAts(input) {
|
|
|
64961
64899
|
runtimeIdentity,
|
|
64962
64900
|
selectedReadiness
|
|
64963
64901
|
});
|
|
64964
|
-
await assertCurrentLocalRuntimeCanReceiveWake({
|
|
64965
|
-
gatewayUrl: input.gatewayUrl,
|
|
64966
|
-
runtimeIdentity
|
|
64967
|
-
});
|
|
64968
64902
|
return {
|
|
64969
64903
|
...runtimeIdentity,
|
|
64970
64904
|
localReadinessSnapshot: buildPrepareLocalReadinessSnapshot(readiness)
|
|
@@ -64980,20 +64914,8 @@ async function readTerminalRuntimeIdentityFromServiceContract() {
|
|
|
64980
64914
|
runtimeLane
|
|
64981
64915
|
};
|
|
64982
64916
|
}
|
|
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));
|
|
64917
|
+
async function notifyRouteCatalogAfterPrepare(input) {
|
|
64918
|
+
await notifyDaemonRouteCatalogChanged({ reason: input.reason });
|
|
64997
64919
|
}
|
|
64998
64920
|
async function assertSelectedRuntimeReadinessIsReadableByAts(input) {
|
|
64999
64921
|
const capabilityRefs = input.selectedReadiness.map((decision) => decision.capabilityRef);
|
|
@@ -65007,12 +64929,7 @@ async function assertSelectedRuntimeReadinessIsReadableByAts(input) {
|
|
|
65007
64929
|
const missingCapabilityRef = capabilityRefs.find((capabilityRef) => !runnableCapabilityRefs.has(capabilityRef));
|
|
65008
64930
|
if (response.status === "ready" && response.runtimeId && !missingCapabilityRef) return;
|
|
65009
64931
|
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}`;
|
|
64932
|
+
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
64933
|
}
|
|
65017
64934
|
function buildPrepareLocalReadinessSnapshot(readiness) {
|
|
65018
64935
|
return {
|
|
@@ -65259,7 +65176,7 @@ function toStatusCodeSlug(title) {
|
|
|
65259
65176
|
const slug = title.toLowerCase().replaceAll(/[^a-z0-9]+/g, "_").replaceAll(/^_+|_+$/g, "");
|
|
65260
65177
|
return slug.length > 0 ? slug : "status";
|
|
65261
65178
|
}
|
|
65262
|
-
function toErrorMessage$
|
|
65179
|
+
function toErrorMessage$9(error) {
|
|
65263
65180
|
if (error instanceof Error) {
|
|
65264
65181
|
const message = error.message.trim();
|
|
65265
65182
|
return message.length > 0 ? message : "unknown error";
|
|
@@ -65291,7 +65208,7 @@ function errorFromPrepareSessionServerError(input) {
|
|
|
65291
65208
|
if (input.code === "prepare.session.revision_conflict") return new PrepareSessionRevisionConflictError(input.message);
|
|
65292
65209
|
return new Error(input.message);
|
|
65293
65210
|
}
|
|
65294
|
-
async function sleep$
|
|
65211
|
+
async function sleep$1(ms) {
|
|
65295
65212
|
await new Promise((resolve) => {
|
|
65296
65213
|
setTimeout(resolve, ms);
|
|
65297
65214
|
});
|
|
@@ -67268,7 +67185,7 @@ async function waitForWebLocalAgentPreparation(input) {
|
|
|
67268
67185
|
const nowMs = Date.now();
|
|
67269
67186
|
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
67187
|
const sleepMs = Math.min(input.waitConfig.pollIntervalMs, Math.max(0, deadlineMs - nowMs));
|
|
67271
|
-
if (sleepMs > 0) await sleep
|
|
67188
|
+
if (sleepMs > 0) await sleep(sleepMs);
|
|
67272
67189
|
}
|
|
67273
67190
|
}
|
|
67274
67191
|
function resolveWebLocalAgentPreparationWaitConfig() {
|
|
@@ -67297,7 +67214,7 @@ function formatWaitDuration(timeoutMs) {
|
|
|
67297
67214
|
if (seconds < 60) return `${seconds} seconds`;
|
|
67298
67215
|
return `${Math.round(seconds / 60)} minutes`;
|
|
67299
67216
|
}
|
|
67300
|
-
function sleep
|
|
67217
|
+
function sleep(ms) {
|
|
67301
67218
|
return new Promise((resolve) => {
|
|
67302
67219
|
setTimeout(resolve, ms);
|
|
67303
67220
|
});
|
|
@@ -68239,8 +68156,6 @@ function isAgentProfile(profile) {
|
|
|
68239
68156
|
|
|
68240
68157
|
//#endregion
|
|
68241
68158
|
//#region src/commands/setup.ts
|
|
68242
|
-
const ROUTE_CATALOG_SYNC_MAX_ATTEMPTS = 8;
|
|
68243
|
-
const ROUTE_CATALOG_SYNC_RETRY_DELAY_MS = 750;
|
|
68244
68159
|
const SETUP_COMMAND_LOCK_PROFILE = "setup";
|
|
68245
68160
|
const SETUP_COMMAND_LOCK_KEY = "setup-command";
|
|
68246
68161
|
async function runSetup(input) {
|
|
@@ -68325,19 +68240,7 @@ async function runSetupUnlocked(input) {
|
|
|
68325
68240
|
localAgentIds: selectedLocalAgentIds
|
|
68326
68241
|
});
|
|
68327
68242
|
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
|
-
});
|
|
68243
|
+
const routeCatalogSync = selectedLocalAgentIds.length > 0 ? await notifyRouteCatalogAfterSetup({ reason: "setup_local_capabilities_reported" }) : null;
|
|
68341
68244
|
emitSetupStatus(runtime, "Updating ATS skills", ["Updating ATS skills so local agents use the current ATS instructions."]);
|
|
68342
68245
|
await ensureSetupManagedSkills({ view: input.view });
|
|
68343
68246
|
emitSetupComplete({
|
|
@@ -68414,25 +68317,8 @@ function assertStartLocalAgentsEnableCompleted(result) {
|
|
|
68414
68317
|
if (!blockingError) return;
|
|
68415
68318
|
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
68319
|
}
|
|
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}`;
|
|
68320
|
+
async function notifyRouteCatalogAfterSetup(input) {
|
|
68321
|
+
return await notifyDaemonRouteCatalogChanged({ reason: input.reason });
|
|
68436
68322
|
}
|
|
68437
68323
|
function emitSetupStatus(runtime, title, lines) {
|
|
68438
68324
|
if (runtime.resolvedView !== "human") return;
|
|
@@ -68462,27 +68348,12 @@ async function emitSetupCompleteForDelegatedPath(input) {
|
|
|
68462
68348
|
}
|
|
68463
68349
|
async function resolveDelegatedSetupCompletionFacts(input) {
|
|
68464
68350
|
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
|
-
}
|
|
68351
|
+
if (completionFacts) return {
|
|
68352
|
+
routeCatalogSync: completionFacts.runtimeReports.length > 0 ? await notifyRouteCatalogAfterSetup({ reason: "setup_profile_capability_reported" }) : null,
|
|
68353
|
+
runtimeIdentity: completionFacts.runtimeIdentity,
|
|
68354
|
+
runtimeReports: completionFacts.runtimeReports,
|
|
68355
|
+
selectedLocalAgentIds: completionFacts.selectedLocalAgentIds
|
|
68356
|
+
};
|
|
68486
68357
|
const sessionSelectedLocalAgentIds = input.setupResult.setupSessionSnapshot?.selectedLocalAgentIds ?? null;
|
|
68487
68358
|
if (!(sessionSelectedLocalAgentIds || hasExplicitLocalAgentSelection(input.setupInput))) return {
|
|
68488
68359
|
routeCatalogSync: null,
|
|
@@ -68522,34 +68393,13 @@ async function resolveDelegatedSetupCompletionFacts(input) {
|
|
|
68522
68393
|
localAgentIds: selectedLocalAgentIds
|
|
68523
68394
|
});
|
|
68524
68395
|
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
68396
|
return {
|
|
68539
|
-
routeCatalogSync,
|
|
68397
|
+
routeCatalogSync: await notifyRouteCatalogAfterSetup({ reason: "setup_session_capabilities_reported" }),
|
|
68540
68398
|
runtimeIdentity,
|
|
68541
68399
|
runtimeReports,
|
|
68542
68400
|
selectedLocalAgentIds
|
|
68543
68401
|
};
|
|
68544
68402
|
}
|
|
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
68403
|
function resolveRuntimeIdentityFromSetupSession(snapshot) {
|
|
68554
68404
|
if (!(snapshot?.deviceId && snapshot.runtimeLane)) return null;
|
|
68555
68405
|
return {
|
|
@@ -68576,10 +68426,10 @@ function emitSetupComplete(input) {
|
|
|
68576
68426
|
} : null,
|
|
68577
68427
|
localAgents: {
|
|
68578
68428
|
selectedAgentIds: [...input.selectedLocalAgentIds],
|
|
68579
|
-
|
|
68429
|
+
reportedCapabilities: input.runtimeReports.map((report) => ({
|
|
68580
68430
|
agentId: report.agentId,
|
|
68581
68431
|
capabilityRef: report.capabilityRef,
|
|
68582
|
-
status: report.localParticipationState === "ready" ? "
|
|
68432
|
+
status: report.localParticipationState === "ready" ? "reported" : "blocked",
|
|
68583
68433
|
reasonCodes: [...report.reasonCodes],
|
|
68584
68434
|
runtimeId: report.runtimeReportSubmission.runtimeId
|
|
68585
68435
|
})),
|
|
@@ -68697,19 +68547,6 @@ function normalizeOptionalString$5(value) {
|
|
|
68697
68547
|
const normalized = String(value ?? "").trim();
|
|
68698
68548
|
return normalized.length > 0 ? normalized : null;
|
|
68699
68549
|
}
|
|
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
68550
|
|
|
68714
68551
|
//#endregion
|
|
68715
68552
|
//#region src/start-shell/next-action-commands.ts
|