agent-transport-system 0.4.2 → 0.4.4
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-dev.js +2 -2
- package/dist/ats.js +316 -71
- package/dist/ats.js.map +1 -1
- package/dist/{daemon-runtime-lease-Bs_rD8WX.js → daemon-runtime-lease-BCpF6ncF.js} +1 -1
- package/dist/{lock-CLqqzR_x.js → lock-DNHgZaBJ.js} +223 -16
- package/dist/lock-DNHgZaBJ.js.map +1 -0
- package/dist/{runtime-config-CPtfyCpL.js → runtime-config-JF1fXrHX.js} +2 -2
- package/dist/{runtime-config-CPtfyCpL.js.map → runtime-config-JF1fXrHX.js.map} +1 -1
- package/package.json +2 -2
- package/dist/lock-CLqqzR_x.js.map +0 -1
package/dist/ats.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
import { $ as
|
|
3
|
+
import { $ as catchupResponseSchema, $n as submitRuntimeCapabilityReportsResponseSchema, $t as normalizeListSignalsReadQuerySemantics, A as MAX_SIGNAL_REPLY_TO_PREVIEW_LENGTH, An as serverErrorFrameSchema, At as gatewayErrorCodeSchema, B as atsProfileIdSchema, Bn as spaceDispatchTraceResponseSchema, Bt as getSpaceConversationStatusResponseSchema, C as CONVERSATION_CONTINUITY_WARNING_PURPOSE, Cn as resolveSingleSpaceMentionLabels, Ct as ensureAgentProfilePrimaryBindingBodySchema, D as DISPATCH_ACTIVITY_RETRYING_PURPOSE, Dt as forgetComputerResponseSchema, E as DISPATCH_ACTIVITY_FAILED_PURPOSE, En as resolveStartHandoffResponseSchema, Et as finalClaimRouteParamsSchema, F as SPACE_MENTION_REJECT_NOTICE_PURPOSE, Fn as spaceConversationBindingDeleteResponseSchema, Ft as getAgentProfilePrimaryBindingResponseSchema, G as atsdControlPlaneResponseSchema, Gn as startSessionProgressSchema, Gt as getSpaceUpdatesResponseSchema, H as atsRuntimeProfileIdSchema, Hn as spaceMetaSchema, Ht as getSpaceDispatchResultResponseSchema, I as SPACE_PASSWORD_MIN_LENGTH, In as spaceConversationBindingImportResponseSchema, It as getPrepareReadinessQuerySchema, J as atsdTaskResultPayloadSchema, Jn as startSessionSpaceChoiceResponseSchema, Jt as isExplicitBuiltinControllerRef, K as atsdTaskResultEnvelopeWriteSchema, Kn as startSessionResponseSchema, Kt as getSpaceWakeProgressResponseSchema, L as SPACE_UPDATES_MAX_LIMIT, Ln as spaceConversationBindingResponseSchema, Lt as getPrepareReadinessResponseSchema, M as SPACE_DISPATCH_TRACE_PROMPT_PREVIEW_MAX_CHARS, Mn as setOwnedDeviceDisplayNameBodySchema, Mt as getAgentExecutionReadinessBatchBodySchema, N as SPACE_MEMBER_JOIN_NOTICE_PURPOSE, Nn as signalEnvelopeSchema, Nt as getAgentExecutionReadinessBatchResponseSchema, O as LEGACY_RUNTIME_DISPATCH_POLICY, Ot as forgetCurrentComputerResponseSchema, P as SPACE_MEMBER_REMOVE_NOTICE_PURPOSE, Pn as spaceConversationBindingConflictResponseSchema, Pt as getAgentExecutionReadinessResponseSchema, Q as canonicalizeControllerRefForKind, Qn as submitRuntimeCapabilityReportsBodySchema, Qt as normalizeBuiltinControllerProviderId, R as agentExecutionReadinessRouteParamsSchema, Rn as spaceConversationBindingUpsertResponseSchema, Rt as getSpaceContractResponseSchema, S as ATSD_TASK_RESULT_SCHEMA_VERSION, Sn as resolveMessageEnvelopeTargetField, St as dispatchBriefSchema, T as DISPATCH_ACTIVITY_DISPATCHING_PURPOSE, Tn as resolveStartHandoffBodySchema, Tt as entryBriefSchema, U as atsSpaceEgressActionSchema, Un as startDeviceProjectionSchema, Ut as getSpaceMessageAddressingRelationSupportForTargetKind, V as atsRequestContextSchema, Vn as spaceMembersSnapshotSchema, Vt as getSpaceDispatchLookupResponseSchema, W as atsdControlPlaneRequestSchema, Wn as startProfileReadinessSummarySchema, Wt as getSpaceStatusResponseSchema, X as buildUpstreamConversationRef, Xn as startStateResponseSchema, Xt as listProfileSpaceHistoryResponseSchema, Y as buildControllerRoutingKeyForKind, Yn as startSessionWithTokenResponseSchema, Yt as leaveSpaceResponseSchema, Z as canonicalizeBuiltinControllerRef, Zn as structuredGuidePayloadFromInputSchema, Zt as normalizeBuiltinControllerAgentId, _ as AGENT_REPLYING_END_PURPOSE, _n as removeSpaceMembersResponseSchema, _t as daemonHubSubmitTaskResultRequestSchema, a as runWithHeldLock, an as patchSpaceContractBodySchema, ar as writeCurrentDeviceBootstrapObservationResponseSchema, at as createSpaceBodySchema, b as AGENT_REPLY_PREVIEW_PURPOSE, bn as resolveBuiltinProviderConversationCapability, bt as daemonServiceContractSchema, c as LEGACY_ATS_RUNTIME_SESSION_ENV_KEY, cn as postNormalMessageBodySchema, cr as writeStartObservationBodySchema, ct as currentDeviceTargetResponseSchema, d as resolveRuntimeSession, dn as postSpaceMembersResponseSchema, dr as writeStartObservedDeviceMetadataResponseSchema, dt as daemonHubDispatchPreviewEndRequestSchema, en as normalizeMessageEnvelope, er as submitRuntimeRegistrationBodySchema, et as claimExecutionDiagnosticsQuerySchema, f as resolveRuntimeSessionId, fn as prepareSessionResponseSchema, fr as writeStartSessionProgressBodySchema, ft as daemonHubDispatchPreviewRequestSchema, g as resolveMappedPublicAgentFailureReason, gn as querySpaceDeletionTombstonesResponseSchema, gt as daemonHubRegisterSessionResponseSchema, h as resolveBuiltinAgentControllerBrand, hn as providerDispatchRuntimeContextSchema, ht as daemonHubRegisterSessionRequestSchema, i as releaseLock, in as patchProfileSpaceHistoryStatusResponseSchema, ir as writeCurrentDeviceBootstrapObservationBodySchema, it as conversationExecutionStateSchema, j as MESSAGE_MENTION_TYPE_VALUES, jn as setCurrentDeviceTargetBodySchema, jt as gatewayErrorEnvelopeSchema, k as MAX_PROFILE_WORKING_DIRECTORY_LENGTH, kn as sanitizeSignalTextPreview, kt as formatCanonicalMentionLiteral, l as listRuntimeSessionStates, ln as postNormalMessageResponseSchema, lr as writeStartObservationResponseSchema, lt as daemonHubDeliverDispatchRequestSchema, m as CODEX_UPGRADE_REQUIRED_REASON, mn as profileWorkspaceModeSchema, mr as createDaemonRouteObservationSummary, mt as daemonHubHeartbeatResponseSchema, n as isAtsLockError, nn as ownedDevicesResponseSchema, nr as upsertProfileSpaceHistoryResponseSchema, nt as collectCanonicalMentionTextFragments, o as tryCleanupStaleLock, on as patchSpaceContractResponseSchema, or as writeCurrentDeviceObservedMetadataBodySchema, ot as createSpaceResponseSchema, p as writeRuntimeSessionState, pn as prepareSessionStreamServerFrameSchema, pr as writeStartSessionProgressResponseSchema, pt as daemonHubHeartbeatRequestSchema, q as atsdTaskResultOpenClawGatewayVisibilityStatusSchema, qn as startSessionSpaceChoiceBodySchema, qt as incomingServerMessageSchema, r as readLockMeta, rn as parseOptionalClientMessageId, rr as upsertSpaceDeletionTombstoneResponseSchema, rt as continuitySchema, s as ATS_RUNTIME_SESSION_ENV_KEY, sn as patchStartSessionBodySchema, sr as writeCurrentDeviceObservedMetadataResponseSchema, st as createStartSessionBodySchema, t as acquireLock, tn as normalizeOptionalWorkingDirectory, tr as submitRuntimeRegistrationResponseSchema, tt as claimExecutionDiagnosticsResponseSchema, u as readRuntimeSessionState, un as postSpaceMembersBodySchema, ur as writeStartObservedDeviceMetadataBodySchema, ut as daemonHubDispatchLifecycleRequestSchema, v as AGENT_REPLYING_PURPOSE, vn as reserveFinalClaimBodySchema, vt as daemonRouteObservationResponseSchema, w as DAEMON_HUB_SCHEMA_VERSION, wn as resolveSpaceMentionLabels, wt as ensureAgentProfilePrimaryBindingResponseSchema, x as ATSD_CONTROL_PLANE_SCHEMA_VERSION, xn as resolveBuiltinUpstreamConversationRefKind, xt as daemonStreamFrameSchema, y as AGENT_REPLY_PREVIEW_END_PURPOSE, yn as reserveFinalClaimResponseSchema, yt as daemonRuntimeLeaseSchema, z as agentProfileBindingRouteParamsSchema, zn as spaceCreatorSchema, zt as getSpaceConversationRemoteStatusResponseSchema } from "./lock-DNHgZaBJ.js";
|
|
4
4
|
import { A as runtimeLogsDir, C as normalizeAtsProfileId, D as resolveAtsEnvPreset, E as resolveAtsCliEntryNameFromArgv, M as skillsDir, N as spacesDir, O as resolveAtsRootDir, P as systemDir, S as normalizeAccountKey, T as profileViewPath, a as accountProfileWorkspacePath, c as atsRootDir, d as deviceOpenClawProfileBootstrapPath, f as deviceOpenClawProfileDir, i as accountProfileViewPath, k as runtimeDir, n as accountProfileLocalMetaPath, o as accountsDir, p as deviceOpenClawProfileWorkspaceDir, r as accountProfileSpaceCacheDir, s as atsBackupsDir, t as ATS_HOME_ENV_KEY, w as profileDir, y as legacyAccountProfileSpacesDir } from "./paths-DyLxjg9Z.js";
|
|
5
|
-
import { A as toSpaceCursorUrl, B as toSpaceSignalsUrl, C as resolveDefaultGatewayBaseUrl, D as toDaemonRouteObservationUrl, E as toClaimExecutionDiagnosticsUrl, F as toSpaceMembersUrl, H as toSpaceWsUrl, I as toSpaceMetaUrl, L as toSpacePasswordUrl, M as toSpaceDispatchLookupUrl, N as toSpaceDispatchTraceUrl, O as toSpaceContractUrl, P as toSpaceLeaveUrl, R as toSpaceRemoveMembersUrl, S as resolveBaseUrlOrNull, T as normalizeBaseUrl, V as toSpaceUpdatesUrl, _ as updateConfiguredStartV1OnboardingState, a as getConfiguredDeviceRuntimeState, b as normalizeGatewayBaseUrlOrNull, c as getConfiguredStartV1OnboardingState, d as resolveRuntimeSkillsCustomTargetId, f as setConfiguredBaseUrl, g as updateConfiguredSkillsConfig, h as updateConfiguredOnboardingConfig, i as getConfiguredDaemonDispatchLimits, j as toSpaceDeleteUrl, k as toSpaceCreateUrl, l as getConfiguredViewCustomization, m as updateConfiguredDeviceRuntimeState, n as alignRuntimeConfigStorage, o as getConfiguredOnboardingDisclaimerAcceptedAt, p as setConfiguredSkillsConfig, r as createDefaultRuntimeAgentControllerSettings, s as getConfiguredSkillsConfig, t as DEFAULT_RUNTIME_AGENT_TRANSPORT_MODE, u as getRuntimeConfigReadHealth, w as resolveExplicitGatewayUrlOrThrow, x as resolveBaseUrl, y as normalizeGatewayBaseUrl, z as toSpaceResultUrl } from "./runtime-config-
|
|
5
|
+
import { A as toSpaceCursorUrl, B as toSpaceSignalsUrl, C as resolveDefaultGatewayBaseUrl, D as toDaemonRouteObservationUrl, E as toClaimExecutionDiagnosticsUrl, F as toSpaceMembersUrl, H as toSpaceWsUrl, I as toSpaceMetaUrl, L as toSpacePasswordUrl, M as toSpaceDispatchLookupUrl, N as toSpaceDispatchTraceUrl, O as toSpaceContractUrl, P as toSpaceLeaveUrl, R as toSpaceRemoveMembersUrl, S as resolveBaseUrlOrNull, T as normalizeBaseUrl, V as toSpaceUpdatesUrl, _ as updateConfiguredStartV1OnboardingState, a as getConfiguredDeviceRuntimeState, b as normalizeGatewayBaseUrlOrNull, c as getConfiguredStartV1OnboardingState, d as resolveRuntimeSkillsCustomTargetId, f as setConfiguredBaseUrl, g as updateConfiguredSkillsConfig, h as updateConfiguredOnboardingConfig, i as getConfiguredDaemonDispatchLimits, j as toSpaceDeleteUrl, k as toSpaceCreateUrl, l as getConfiguredViewCustomization, m as updateConfiguredDeviceRuntimeState, n as alignRuntimeConfigStorage, o as getConfiguredOnboardingDisclaimerAcceptedAt, p as setConfiguredSkillsConfig, r as createDefaultRuntimeAgentControllerSettings, s as getConfiguredSkillsConfig, t as DEFAULT_RUNTIME_AGENT_TRANSPORT_MODE, u as getRuntimeConfigReadHealth, w as resolveExplicitGatewayUrlOrThrow, x as resolveBaseUrl, y as normalizeGatewayBaseUrl, z as toSpaceResultUrl } from "./runtime-config-JF1fXrHX.js";
|
|
6
6
|
import { createRequire } from "node:module";
|
|
7
7
|
import { Command, Option } from "commander";
|
|
8
8
|
import { accessSync, appendFileSync, chmodSync, constants, existsSync, mkdirSync, readFileSync, realpathSync, statSync, writeFileSync } from "node:fs";
|
|
@@ -27,12 +27,12 @@ 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.4.
|
|
30
|
+
var version = "0.4.4";
|
|
31
31
|
var package_default = {
|
|
32
32
|
$schema: "https://www.schemastore.org/package.json",
|
|
33
33
|
name: "agent-transport-system",
|
|
34
34
|
version,
|
|
35
|
-
atsReleaseDate: "2026-05-
|
|
35
|
+
atsReleaseDate: "2026-05-11",
|
|
36
36
|
description: "Agent Transport System CLI - https://ats.sh",
|
|
37
37
|
license: "MIT",
|
|
38
38
|
type: "module",
|
|
@@ -4013,7 +4013,7 @@ async function setDaemonServiceRuntimeState(state, pathInput = {}) {
|
|
|
4013
4013
|
await writeDaemonServiceRuntimeState(state, pathInput);
|
|
4014
4014
|
}
|
|
4015
4015
|
async function clearDaemonServiceRuntimeState(pathInput = {}) {
|
|
4016
|
-
const { clearDaemonRuntimeLease } = await import("./daemon-runtime-lease-
|
|
4016
|
+
const { clearDaemonRuntimeLease } = await import("./daemon-runtime-lease-BCpF6ncF.js");
|
|
4017
4017
|
await Promise.all([rm(daemonServiceRuntimeStatePath(pathInput), { force: true }), clearDaemonRuntimeLease(pathInput)]);
|
|
4018
4018
|
}
|
|
4019
4019
|
async function withDaemonServiceRunLock(callback, meta = {
|
|
@@ -24246,6 +24246,17 @@ function resolveWakeAvailability(input) {
|
|
|
24246
24246
|
reasonText: null
|
|
24247
24247
|
};
|
|
24248
24248
|
if (!input.agentMember) throw new Error("Agent Space Message Addressing target is missing.");
|
|
24249
|
+
const readiness = input.agentMember.agentExecutionReadiness ?? null;
|
|
24250
|
+
if (readiness) {
|
|
24251
|
+
const ready = readiness.displayState === "ready";
|
|
24252
|
+
return {
|
|
24253
|
+
daemonRouteObservation: input.agentMember.daemonRouteObservation,
|
|
24254
|
+
status: ready ? "ready" : "blocked",
|
|
24255
|
+
wakeState: ready ? "wakeable" : "offline",
|
|
24256
|
+
reasonCodes: [...readiness.reasonCodes],
|
|
24257
|
+
reasonText: formatAgentExecutionReadinessReason(readiness)
|
|
24258
|
+
};
|
|
24259
|
+
}
|
|
24249
24260
|
return {
|
|
24250
24261
|
daemonRouteObservation: input.agentMember.daemonRouteObservation,
|
|
24251
24262
|
status: input.agentMember.wakeability.status,
|
|
@@ -24254,6 +24265,14 @@ function resolveWakeAvailability(input) {
|
|
|
24254
24265
|
reasonText: normalizeOptionalText$5$1(input.agentMember.wakeability.reasonText)
|
|
24255
24266
|
};
|
|
24256
24267
|
}
|
|
24268
|
+
function formatAgentExecutionReadinessReason(readiness) {
|
|
24269
|
+
if (readiness.displayState === "ready") return "This agent can reply in this space.";
|
|
24270
|
+
if (readiness.facts.claim.executionBlocked) return "ATS cannot safely send work to this agent yet.";
|
|
24271
|
+
if (!readiness.facts.binding.routable) return "This agent is not connected to a local agent yet.";
|
|
24272
|
+
if (!readiness.facts.runtime.ready) return "ATS needs current local agent readiness from this computer.";
|
|
24273
|
+
if (!readiness.facts.route.online) return "ATS cannot see this agent's local connection right now.";
|
|
24274
|
+
return "This agent is not ready to reply yet.";
|
|
24275
|
+
}
|
|
24257
24276
|
function buildActiveSpaceMemberInputs(snapshot) {
|
|
24258
24277
|
return [...snapshot.agents.map((member) => ({
|
|
24259
24278
|
expectedProfileKind: "agent",
|
|
@@ -24369,6 +24388,52 @@ function normalizeOptionalText$5$1(value) {
|
|
|
24369
24388
|
const normalized = String(value ?? "").trim();
|
|
24370
24389
|
return normalized.length > 0 ? normalized : null;
|
|
24371
24390
|
}
|
|
24391
|
+
function formatBlockedWakeAvailabilityLabel(wakeAvailability) {
|
|
24392
|
+
const reason = resolveBlockedWakeAvailabilityReason(wakeAvailability);
|
|
24393
|
+
return reason ? `Unavailable now: ${reason}` : "Unavailable now";
|
|
24394
|
+
}
|
|
24395
|
+
function formatBlockedWakeSubmissionMessage(input) {
|
|
24396
|
+
const reason = resolveBlockedWakeAvailabilityReason(input.wakeAvailability, { preferReasonText: true });
|
|
24397
|
+
if (!reason) return `"${input.profileName}" cannot reply yet. Review this computer from Members or Agents, then try again.`;
|
|
24398
|
+
return `"${input.profileName}" cannot reply yet: ${formatSentence(reason)}`;
|
|
24399
|
+
}
|
|
24400
|
+
function resolveBlockedWakeAvailabilityReason(wakeAvailability, options = {}) {
|
|
24401
|
+
if (wakeAvailability.status !== "blocked") return null;
|
|
24402
|
+
const reasonText = normalizeReasonText(wakeAvailability.reasonText);
|
|
24403
|
+
if (options.preferReasonText && reasonText) return reasonText;
|
|
24404
|
+
switch (wakeAvailability.reasonCodes[0]) {
|
|
24405
|
+
case "profile.unbound": return "Not connected to a local agent on this device yet";
|
|
24406
|
+
case "agent_profile_binding.missing":
|
|
24407
|
+
case "claim_eligibility.binding_missing": return "This agent is not connected to a local agent yet";
|
|
24408
|
+
case "claim_eligibility.binding_runtime_mismatch":
|
|
24409
|
+
case "claim_eligibility.runtime_id_mismatch": return "This agent is connected to an older computer setup";
|
|
24410
|
+
case "claim_eligibility.binding_capability_mismatch": return "This agent is connected to a different local agent setup";
|
|
24411
|
+
case "claim_eligibility.binding_owner_mismatch":
|
|
24412
|
+
case "claim_eligibility.owner_mismatch": return "This agent is connected to a different ATS account";
|
|
24413
|
+
case "controller.binding.disabled": return "Turned off on this device";
|
|
24414
|
+
case "controller.registry.disabled": return "Turned off in ATS on this device";
|
|
24415
|
+
case "controller.launch.choice_required": return "Needs an install choice on this device";
|
|
24416
|
+
case "controller.launch.needs_repair": return "Needs repair on this device";
|
|
24417
|
+
case "workspace.missing": return "Missing its local workspace on this device";
|
|
24418
|
+
case "workspace.invalid": return "Local workspace is broken on this device";
|
|
24419
|
+
case "service.not_installed": return "ATS Service is not installed on this device";
|
|
24420
|
+
case "service.not_running": return "ATS Service is not running on this device";
|
|
24421
|
+
case "projection.missing": return "ATS is still setting up this device";
|
|
24422
|
+
case "route.offline": return "Offline from this device right now";
|
|
24423
|
+
case "route.not_registered": return "Still setting up replies on this device";
|
|
24424
|
+
default: return reasonText;
|
|
24425
|
+
}
|
|
24426
|
+
}
|
|
24427
|
+
function formatSentence(value) {
|
|
24428
|
+
const normalized = normalizeReasonText(value);
|
|
24429
|
+
if (!normalized) return "Review this computer from Members or Agents, then try again.";
|
|
24430
|
+
return `${normalized}.`;
|
|
24431
|
+
}
|
|
24432
|
+
function normalizeReasonText(value) {
|
|
24433
|
+
const normalized = String(value ?? "").trim();
|
|
24434
|
+
if (!normalized) return null;
|
|
24435
|
+
return normalized.endsWith(".") ? normalized.slice(0, Math.max(0, normalized.length - 1)) : normalized;
|
|
24436
|
+
}
|
|
24372
24437
|
const CANONICAL_MENTION_TYPES = new Set(MESSAGE_MENTION_TYPE_VALUES);
|
|
24373
24438
|
const DUPLICATE_TARGET_ISSUE_PATTERN = /^(activationTargets|referenceTargets|ccTargets) must not contain duplicate profileId$/u;
|
|
24374
24439
|
const DISTINCT_TARGET_ISSUE_PATTERN = /^(activationTargets|referenceTargets|ccTargets) must not reuse profileId from (activationTargets|referenceTargets|ccTargets)$/u;
|
|
@@ -24420,7 +24485,10 @@ function prepareSpaceComposerSubmission(input) {
|
|
|
24420
24485
|
mentionText: fragment.text,
|
|
24421
24486
|
relation: parsedLiteral.type
|
|
24422
24487
|
}));
|
|
24423
|
-
if (parsedLiteral.type === "wake" && target.wakeAvailability.status === "blocked") throw createSubmissionError("addressing.wake_blocked",
|
|
24488
|
+
if (parsedLiteral.type === "wake" && target.wakeAvailability.status === "blocked") throw createSubmissionError("addressing.wake_blocked", formatBlockedWakeSubmissionMessage({
|
|
24489
|
+
profileName: target.profileName,
|
|
24490
|
+
wakeAvailability: target.wakeAvailability
|
|
24491
|
+
}));
|
|
24424
24492
|
envelopeInput[resolveMessageEnvelopeTargetField(parsedLiteral.type)].push(target.profileId);
|
|
24425
24493
|
profileIdsInTextOrder.push(target.profileId);
|
|
24426
24494
|
canonicalMentionsInTextOrder.push({
|
|
@@ -24541,9 +24609,6 @@ function describeRelationSupport(relation) {
|
|
|
24541
24609
|
if (relation === "wake") return "agent targets";
|
|
24542
24610
|
return "active targets";
|
|
24543
24611
|
}
|
|
24544
|
-
function buildBlockedWakeCanonicalMentionMessage(input) {
|
|
24545
|
-
return `"${input.profileName}" is not ready for Wake yet. Finish local agent setup first.`;
|
|
24546
|
-
}
|
|
24547
24612
|
function formatCanonicalMentionEnvelopeError(error) {
|
|
24548
24613
|
const issues = extractEnvelopeIssueMessages(error);
|
|
24549
24614
|
for (const issueMessage of issues) {
|
|
@@ -24730,10 +24795,6 @@ function listSpaceMentionRelationChoices(input) {
|
|
|
24730
24795
|
}
|
|
24731
24796
|
return choices;
|
|
24732
24797
|
}
|
|
24733
|
-
function formatBlockedWakeAvailabilityLabel(wakeAvailability) {
|
|
24734
|
-
const reason = resolveBlockedWakeAvailabilityReason(wakeAvailability);
|
|
24735
|
-
return reason ? `Unavailable now: ${reason}` : "Unavailable now";
|
|
24736
|
-
}
|
|
24737
24798
|
function normalizeRecentMentionProfileIds(input) {
|
|
24738
24799
|
const maxRecentProfileIds = resolveMaxRecentProfileIds(input.maxRecentProfileIds);
|
|
24739
24800
|
const allowedProfileIds = toAllowedProfileIdSet(input.allowedProfileIds);
|
|
@@ -24852,29 +24913,6 @@ function normalizeSearchTerm(value) {
|
|
|
24852
24913
|
function areCaseInsensitiveMatches$1(left, right) {
|
|
24853
24914
|
return left.localeCompare(right, "en", { sensitivity: "accent" }) === 0;
|
|
24854
24915
|
}
|
|
24855
|
-
function resolveBlockedWakeAvailabilityReason(wakeAvailability) {
|
|
24856
|
-
if (wakeAvailability.status !== "blocked") return null;
|
|
24857
|
-
switch (wakeAvailability.reasonCodes[0]) {
|
|
24858
|
-
case "profile.unbound": return "Not connected to a local agent on this device yet";
|
|
24859
|
-
case "controller.binding.disabled": return "Turned off on this device";
|
|
24860
|
-
case "controller.registry.disabled": return "Turned off in ATS on this device";
|
|
24861
|
-
case "controller.launch.choice_required": return "Needs an install choice on this device";
|
|
24862
|
-
case "controller.launch.needs_repair": return "Needs repair on this device";
|
|
24863
|
-
case "workspace.missing": return "Missing its local workspace on this device";
|
|
24864
|
-
case "workspace.invalid": return "Local workspace is broken on this device";
|
|
24865
|
-
case "service.not_installed": return "ATS Service is not installed on this device";
|
|
24866
|
-
case "service.not_running": return "ATS Service is not running on this device";
|
|
24867
|
-
case "projection.missing": return "ATS is still setting up this device";
|
|
24868
|
-
case "route.offline": return "Offline from this device right now";
|
|
24869
|
-
case "route.not_registered": return "Still setting up replies on this device";
|
|
24870
|
-
default: return normalizeReasonText(wakeAvailability.reasonText);
|
|
24871
|
-
}
|
|
24872
|
-
}
|
|
24873
|
-
function normalizeReasonText(value) {
|
|
24874
|
-
const normalized = String(value ?? "").trim();
|
|
24875
|
-
if (!normalized) return null;
|
|
24876
|
-
return normalized.endsWith(".") ? normalized.slice(0, Math.max(0, normalized.length - 1)) : normalized;
|
|
24877
|
-
}
|
|
24878
24916
|
function resolveRecentMentionProfileIdsFromCanonicalMentions(canonicalMentionsInTextOrder) {
|
|
24879
24917
|
if (!(canonicalMentionsInTextOrder && canonicalMentionsInTextOrder.length > 0)) return [];
|
|
24880
24918
|
return canonicalMentionsInTextOrder.toReversed().map((mention) => mention.profileId);
|
|
@@ -24902,6 +24940,28 @@ function spaceTextHasOneShotMentionAttempts(text) {
|
|
|
24902
24940
|
return spaceTextHasCanonicalMentionAttempts(text);
|
|
24903
24941
|
}
|
|
24904
24942
|
function buildSpaceMemberAgentPresencePresentation(member) {
|
|
24943
|
+
const readiness = member.agentExecutionReadiness ?? null;
|
|
24944
|
+
if (readiness) {
|
|
24945
|
+
if (readiness.displayState === "ready") return member.liveNow ? {
|
|
24946
|
+
detailLabel: "Live agent",
|
|
24947
|
+
shortLabel: "live now",
|
|
24948
|
+
status: "live"
|
|
24949
|
+
} : {
|
|
24950
|
+
detailLabel: "Wakeable agent",
|
|
24951
|
+
shortLabel: "wakeable",
|
|
24952
|
+
status: "wakeable"
|
|
24953
|
+
};
|
|
24954
|
+
if (hasUnavailableRoute(readiness.facts.route.reasonCodes)) return {
|
|
24955
|
+
detailLabel: "Daemon route unavailable",
|
|
24956
|
+
shortLabel: "daemon route unavailable",
|
|
24957
|
+
status: "unavailable"
|
|
24958
|
+
};
|
|
24959
|
+
return {
|
|
24960
|
+
detailLabel: "Offline agent",
|
|
24961
|
+
shortLabel: "offline",
|
|
24962
|
+
status: "offline"
|
|
24963
|
+
};
|
|
24964
|
+
}
|
|
24905
24965
|
if (member.liveNow) return {
|
|
24906
24966
|
detailLabel: "Live agent",
|
|
24907
24967
|
shortLabel: "live now",
|
|
@@ -24923,6 +24983,9 @@ function buildSpaceMemberAgentPresencePresentation(member) {
|
|
|
24923
24983
|
status: "offline"
|
|
24924
24984
|
};
|
|
24925
24985
|
}
|
|
24986
|
+
function hasUnavailableRoute(reasonCodes) {
|
|
24987
|
+
return reasonCodes.some((reasonCode) => reasonCode === "route.unavailable" || reasonCode === "agent_execution.route_unavailable");
|
|
24988
|
+
}
|
|
24926
24989
|
function createSpaceMemberIdentityIndex(input) {
|
|
24927
24990
|
const byProfileId = /* @__PURE__ */ new Map();
|
|
24928
24991
|
for (const signal of input.signals ?? []) registerSignalIdentity(byProfileId, signal);
|
|
@@ -26817,24 +26880,36 @@ function resolveAgentExecutionStatus(input) {
|
|
|
26817
26880
|
});
|
|
26818
26881
|
const runtime = resolveRuntimeFact(input.runtimeReadiness);
|
|
26819
26882
|
const claim = resolveClaimFact(input.claimDiagnostics);
|
|
26883
|
+
const route = resolveRouteFact(input.route);
|
|
26820
26884
|
const reasonCodes = uniqueReasonCodes$2([
|
|
26821
26885
|
...binding.reasonCodes,
|
|
26822
26886
|
...runtime.reasonCodes,
|
|
26823
|
-
...claim.reasonCodes
|
|
26887
|
+
...claim.reasonCodes,
|
|
26888
|
+
...route.reasonCodes
|
|
26824
26889
|
]);
|
|
26890
|
+
const displayState = resolveDisplayState({
|
|
26891
|
+
bindingBlocked: binding.source === "blocked",
|
|
26892
|
+
bindingRoutable: binding.routable,
|
|
26893
|
+
claimBlocked: claim.executionBlocked,
|
|
26894
|
+
routeOnline: route.online,
|
|
26895
|
+
runtimeReady: runtime.ready
|
|
26896
|
+
});
|
|
26825
26897
|
return {
|
|
26826
26898
|
agentProfileId: input.agentProfileId,
|
|
26827
|
-
displayState
|
|
26828
|
-
bindingBlocked: binding.source === "blocked",
|
|
26829
|
-
bindingRoutable: binding.routable,
|
|
26830
|
-
claimBlocked: claim.executionBlocked,
|
|
26831
|
-
runtimeReady: runtime.ready
|
|
26832
|
-
}),
|
|
26899
|
+
displayState,
|
|
26833
26900
|
facts: {
|
|
26834
26901
|
binding,
|
|
26835
26902
|
claim,
|
|
26903
|
+
route,
|
|
26836
26904
|
runtime
|
|
26837
26905
|
},
|
|
26906
|
+
primaryAction: resolvePrimaryAction({
|
|
26907
|
+
binding,
|
|
26908
|
+
claim,
|
|
26909
|
+
displayState,
|
|
26910
|
+
route,
|
|
26911
|
+
runtime
|
|
26912
|
+
}),
|
|
26838
26913
|
reasonCodes
|
|
26839
26914
|
};
|
|
26840
26915
|
}
|
|
@@ -26901,11 +26976,42 @@ function resolveClaimFact(claimDiagnostics) {
|
|
|
26901
26976
|
source: "claim_diagnostics"
|
|
26902
26977
|
};
|
|
26903
26978
|
}
|
|
26979
|
+
function resolveRouteFact(route) {
|
|
26980
|
+
if (!route) return {
|
|
26981
|
+
deviceId: null,
|
|
26982
|
+
observedAt: null,
|
|
26983
|
+
online: false,
|
|
26984
|
+
reasonCodes: ["agent_execution.route_missing"],
|
|
26985
|
+
source: "missing"
|
|
26986
|
+
};
|
|
26987
|
+
if (route.status === "online") return {
|
|
26988
|
+
deviceId: route.deviceId?.trim() || null,
|
|
26989
|
+
observedAt: route.observedAt?.trim() || null,
|
|
26990
|
+
online: true,
|
|
26991
|
+
reasonCodes: route.reasonCodes ?? [],
|
|
26992
|
+
source: "daemon_route"
|
|
26993
|
+
};
|
|
26994
|
+
return {
|
|
26995
|
+
deviceId: route.deviceId?.trim() || null,
|
|
26996
|
+
observedAt: route.observedAt?.trim() || null,
|
|
26997
|
+
online: false,
|
|
26998
|
+
reasonCodes: route.reasonCodes,
|
|
26999
|
+
source: "daemon_route"
|
|
27000
|
+
};
|
|
27001
|
+
}
|
|
26904
27002
|
function resolveDisplayState(input) {
|
|
26905
27003
|
if (input.claimBlocked || input.bindingBlocked) return "blocked";
|
|
26906
|
-
if (input.bindingRoutable && input.runtimeReady) return "ready";
|
|
27004
|
+
if (input.bindingRoutable && input.runtimeReady && input.routeOnline) return "ready";
|
|
26907
27005
|
return "not_ready";
|
|
26908
27006
|
}
|
|
27007
|
+
function resolvePrimaryAction(input) {
|
|
27008
|
+
if (input.displayState === "ready") return "none";
|
|
27009
|
+
if (input.claim.executionBlocked) return "check_status";
|
|
27010
|
+
if (!input.binding.routable) return input.binding.source === "unavailable" ? "check_status" : "reconnect_binding";
|
|
27011
|
+
if (!input.runtime.ready) return "run_prepare";
|
|
27012
|
+
if (!input.route.online) return "check_status";
|
|
27013
|
+
return "check_status";
|
|
27014
|
+
}
|
|
26909
27015
|
function uniqueReasonCodes$2(reasonCodes) {
|
|
26910
27016
|
return [...new Set(reasonCodes.filter((reasonCode) => reasonCode.trim()))];
|
|
26911
27017
|
}
|
|
@@ -26923,6 +27029,10 @@ function createAgentExecutionStatusDisplayRows(projection) {
|
|
|
26923
27029
|
label: "Runtime Evidence",
|
|
26924
27030
|
value: formatRuntimeEvidence(projection)
|
|
26925
27031
|
},
|
|
27032
|
+
{
|
|
27033
|
+
label: "Route Evidence",
|
|
27034
|
+
value: formatRouteEvidence(projection)
|
|
27035
|
+
},
|
|
26926
27036
|
{
|
|
26927
27037
|
label: "Claim Evidence",
|
|
26928
27038
|
value: formatClaimEvidence(projection)
|
|
@@ -26931,7 +27041,7 @@ function createAgentExecutionStatusDisplayRows(projection) {
|
|
|
26931
27041
|
}
|
|
26932
27042
|
function formatAgentExecutionStatus(projection) {
|
|
26933
27043
|
switch (projection.displayState) {
|
|
26934
|
-
case "ready": return "Ready · Binding truth
|
|
27044
|
+
case "ready": return "Ready · Binding truth, Runtime readiness, and route are ready.";
|
|
26935
27045
|
case "blocked": return `Blocked · ${formatBlockingReason(projection)}`;
|
|
26936
27046
|
case "not_ready": return `Not ready · ${formatNotReadyReason(projection)}`;
|
|
26937
27047
|
case "unknown": return "Unknown";
|
|
@@ -26956,6 +27066,11 @@ function formatRuntimeEvidence(projection) {
|
|
|
26956
27066
|
if (projection.facts.runtime.reasonCodes.includes("prepare_readiness.read_failed")) return `Prepare readiness · unavailable · ${formatPrimaryReason(projection.facts.runtime.reasonCodes)}`;
|
|
26957
27067
|
return `Prepare readiness · not ready · ${formatPrimaryReason(projection.facts.runtime.reasonCodes)}`;
|
|
26958
27068
|
}
|
|
27069
|
+
function formatRouteEvidence(projection) {
|
|
27070
|
+
if (projection.facts.route.online) return "Daemon route · online";
|
|
27071
|
+
if (projection.facts.route.source === "missing") return "Missing";
|
|
27072
|
+
return `Daemon route · not online · ${formatPrimaryReason(projection.facts.route.reasonCodes)}`;
|
|
27073
|
+
}
|
|
26959
27074
|
function formatClaimEvidence(projection) {
|
|
26960
27075
|
if (projection.facts.claim.source === "not_checked") return "Not checked";
|
|
26961
27076
|
if (projection.facts.claim.executionBlocked) return `Blocked · ${formatPrimaryReason(projection.facts.claim.reasonCodes)}`;
|
|
@@ -26969,10 +27084,14 @@ function formatPrimaryReason(reasonCodes) {
|
|
|
26969
27084
|
function formatNotReadyReason(projection) {
|
|
26970
27085
|
if (!projection.facts.binding.routable) return formatPrimaryReason(projection.facts.binding.reasonCodes);
|
|
26971
27086
|
if (!projection.facts.runtime.ready) return formatPrimaryReason(projection.facts.runtime.reasonCodes);
|
|
27087
|
+
if (!projection.facts.route.online) return formatPrimaryReason(projection.facts.route.reasonCodes);
|
|
26972
27088
|
return formatPrimaryReason(projection.reasonCodes);
|
|
26973
27089
|
}
|
|
26974
27090
|
const REASON_TEXT = {
|
|
26975
27091
|
"agent_execution.binding_agent_profile_mismatch": "Binding belongs to a different agent profile.",
|
|
27092
|
+
"agent_execution.route_missing": "Daemon route is missing.",
|
|
27093
|
+
"agent_execution.route_offline": "Daemon route is offline.",
|
|
27094
|
+
"agent_execution.route_unavailable": "Daemon route is unavailable.",
|
|
26976
27095
|
"agent_profile_binding.missing": "Binding is missing.",
|
|
26977
27096
|
"agent_profile_binding.read_unavailable": "Binding evidence is unavailable.",
|
|
26978
27097
|
"claim_execution_diagnostics.lease_missing": "claim lease evidence is missing.",
|
|
@@ -27180,6 +27299,14 @@ function buildLegacyDefaultMentionAliasSeed(input) {
|
|
|
27180
27299
|
function buildAgentProfilePrimaryBindingRoute(agentProfileId) {
|
|
27181
27300
|
return `/v1/agent-profiles/${encodeURIComponent(agentProfileId)}/primary-binding`;
|
|
27182
27301
|
}
|
|
27302
|
+
function buildAgentExecutionReadinessRoute(agentProfileId) {
|
|
27303
|
+
return `/v1/agent-profiles/${encodeURIComponent(agentProfileId)}/execution-readiness`;
|
|
27304
|
+
}
|
|
27305
|
+
function buildAgentExecutionReadinessBatchRoute() {
|
|
27306
|
+
return "/v1/agent-profiles/execution-readiness/batch";
|
|
27307
|
+
}
|
|
27308
|
+
const getAgentExecutionReadinessInputSchema = agentExecutionReadinessRouteParamsSchema.extend({ requestContext: atsRequestContextSchema.optional() });
|
|
27309
|
+
const getAgentExecutionReadinessBatchInputSchema = getAgentExecutionReadinessBatchBodySchema.extend({ requestContext: atsRequestContextSchema.optional() });
|
|
27183
27310
|
const ensureAgentProfilePrimaryBindingInputSchema = agentProfileBindingRouteParamsSchema.merge(ensureAgentProfilePrimaryBindingBodySchema).extend({ requestContext: atsRequestContextSchema.optional() });
|
|
27184
27311
|
function requireValidBindingCommandBody(input) {
|
|
27185
27312
|
const parsed = ensureAgentProfilePrimaryBindingInputSchema.safeParse(input);
|
|
@@ -27187,8 +27314,42 @@ function requireValidBindingCommandBody(input) {
|
|
|
27187
27314
|
const { agentProfileId: _agentProfileId, requestContext: _requestContext, ...body } = parsed.data;
|
|
27188
27315
|
return body;
|
|
27189
27316
|
}
|
|
27317
|
+
function requireValidExecutionReadinessInput(input) {
|
|
27318
|
+
const parsed = getAgentExecutionReadinessInputSchema.safeParse(input);
|
|
27319
|
+
if (!parsed.success) throw new Error(parsed.error.issues[0]?.message ?? "Invalid Agent Execution Readiness request.");
|
|
27320
|
+
return parsed.data;
|
|
27321
|
+
}
|
|
27322
|
+
function requireValidExecutionReadinessBatchInput(input) {
|
|
27323
|
+
const parsed = getAgentExecutionReadinessBatchInputSchema.safeParse(input);
|
|
27324
|
+
if (!parsed.success) throw new Error(parsed.error.issues[0]?.message ?? "Invalid Agent Execution Readiness batch request.");
|
|
27325
|
+
return parsed.data;
|
|
27326
|
+
}
|
|
27190
27327
|
const createAgentProfileBindingApi = (client) => {
|
|
27191
27328
|
return {
|
|
27329
|
+
getExecutionReadiness: async (input) => {
|
|
27330
|
+
const request = requireValidExecutionReadinessInput(input);
|
|
27331
|
+
return await client.requestJson({
|
|
27332
|
+
invalidMessage: "Invalid Agent Execution Readiness response.",
|
|
27333
|
+
method: "GET",
|
|
27334
|
+
operation: "agent_execution_readiness.read",
|
|
27335
|
+
requestContext: request.requestContext,
|
|
27336
|
+
schema: getAgentExecutionReadinessResponseSchema,
|
|
27337
|
+
url: buildAgentExecutionReadinessRoute(request.agentProfileId)
|
|
27338
|
+
});
|
|
27339
|
+
},
|
|
27340
|
+
getExecutionReadinessBatch: async (input) => {
|
|
27341
|
+
const request = requireValidExecutionReadinessBatchInput(input);
|
|
27342
|
+
return await client.requestJson({
|
|
27343
|
+
body: JSON.stringify({ agentProfileIds: request.agentProfileIds }),
|
|
27344
|
+
headers: { "content-type": "application/json" },
|
|
27345
|
+
invalidMessage: "Invalid Agent Execution Readiness batch response.",
|
|
27346
|
+
method: "POST",
|
|
27347
|
+
operation: "agent_execution_readiness.batch_read",
|
|
27348
|
+
requestContext: request.requestContext,
|
|
27349
|
+
schema: getAgentExecutionReadinessBatchResponseSchema,
|
|
27350
|
+
url: buildAgentExecutionReadinessBatchRoute()
|
|
27351
|
+
});
|
|
27352
|
+
},
|
|
27192
27353
|
getPrimaryBinding: async (input) => await client.requestJson({
|
|
27193
27354
|
invalidMessage: "Invalid Agent Profile Binding response.",
|
|
27194
27355
|
method: "GET",
|
|
@@ -32365,24 +32526,12 @@ const LIVE_RESUME_PROBE_PROMPT = "ATS resume probe. Reply with one short confirm
|
|
|
32365
32526
|
|
|
32366
32527
|
//#endregion
|
|
32367
32528
|
//#region ../../packages/space-mesh/dist/index.js
|
|
32368
|
-
const CODEX_UPGRADE_REQUIRED_REASON = "Codex on this device is too old for the current model. Upgrade Codex on this device, then try again.";
|
|
32369
32529
|
function resolvePublicAgentFailureReason(input) {
|
|
32370
32530
|
const errorCode = normalizeOptionalText$2$1(input.errorCode)?.toLowerCase();
|
|
32371
32531
|
const detailedReason = resolveDetailedPublicAgentFailureReason(input.errorMessage);
|
|
32372
32532
|
if (detailedReason) return detailedReason;
|
|
32373
32533
|
if (!errorCode) return normalizeOptionalText$2$1(input.defaultReason);
|
|
32374
|
-
|
|
32375
|
-
if (errorCode.includes("controller.launch.choice_required") || errorCode.includes("launch choice")) return "ATS found more than one working install for this agent on this device. Choose which one ATS should use here, then try again.";
|
|
32376
|
-
if (errorCode.includes("profile.workspace.missing")) return "This agent is missing its local workspace on this device. Run `ats doctor --repair`, then `ats agents prepare --profile <agent-profile-id>`, and try again.";
|
|
32377
|
-
if (errorCode.includes("profile.workspace.invalid")) return "This agent's local workspace is broken on this device. Run `ats doctor --repair`, then `ats agents prepare --profile <agent-profile-id>`, and try again.";
|
|
32378
|
-
if (errorCode.includes("auth") || errorCode.includes("credential") || errorCode.includes("login")) return "Authentication failed.";
|
|
32379
|
-
if (errorCode.includes("model.unsupported") || errorCode.includes("unsupported_model")) return "The current model is not available for this agent's account.";
|
|
32380
|
-
if (errorCode.includes("controller.client.upgrade_required")) return CODEX_UPGRADE_REQUIRED_REASON;
|
|
32381
|
-
if (errorCode.includes("rate") || errorCode.includes("quota")) return "The agent hit a rate limit.";
|
|
32382
|
-
if (errorCode.includes("permission") || errorCode.includes("forbidden") || errorCode.includes("unauthorized")) return "The agent does not have permission to reply here.";
|
|
32383
|
-
if (errorCode.includes("controller.launch.needs_repair")) return "ATS could not start this agent on this device. Repair it on this device, then try again.";
|
|
32384
|
-
if (errorCode.includes("timeout") || errorCode.includes("network") || errorCode.includes("unavailable") || errorCode.includes("provider") || errorCode.includes("upstream")) return "The agent could not complete this reply right now.";
|
|
32385
|
-
return normalizeOptionalText$2$1(input.defaultReason);
|
|
32534
|
+
return resolveMappedPublicAgentFailureReason(input.errorCode) ?? normalizeOptionalText$2$1(input.defaultReason);
|
|
32386
32535
|
}
|
|
32387
32536
|
function resolveDetailedPublicAgentFailureReason(errorMessage) {
|
|
32388
32537
|
const normalizedMessage = normalizeProviderFailureMessage(errorMessage);
|
|
@@ -54812,9 +54961,9 @@ function stripAnsi(value) {
|
|
|
54812
54961
|
|
|
54813
54962
|
//#endregion
|
|
54814
54963
|
//#region src/system/selected-local-runtime-reporting.ts
|
|
54815
|
-
|
|
54964
|
+
function resolveSelectedLocalRuntimeReadiness(input) {
|
|
54816
54965
|
const uniqueAgentIds = [...new Set(input.localAgentIds.map(normalizeId))].filter(Boolean).sort();
|
|
54817
|
-
const
|
|
54966
|
+
const decisions = [];
|
|
54818
54967
|
for (const agentId of uniqueAgentIds) {
|
|
54819
54968
|
const capabilityRef = resolveCapabilityRefFromControllerBinding({
|
|
54820
54969
|
controllerKind: "builtin",
|
|
@@ -54825,18 +54974,26 @@ async function submitSelectedLocalRuntimeReports(input) {
|
|
|
54825
54974
|
candidate: input.readiness.agents.candidates.find((currentCandidate) => currentCandidate.agentId === agentId) ?? null,
|
|
54826
54975
|
readiness: input.readiness
|
|
54827
54976
|
});
|
|
54828
|
-
|
|
54977
|
+
decisions.push({
|
|
54829
54978
|
agentId,
|
|
54830
54979
|
capabilityRef,
|
|
54831
54980
|
localParticipationState: readinessDecision.localParticipationState,
|
|
54832
|
-
reasonCodes: readinessDecision.reasonCodes
|
|
54833
|
-
runtimeReportSubmission: await submitPrepareRuntimeCapabilityReport({
|
|
54834
|
-
capabilityRef,
|
|
54835
|
-
localParticipationState: readinessDecision.localParticipationState,
|
|
54836
|
-
reasonCodes: readinessDecision.reasonCodes
|
|
54837
|
-
})
|
|
54981
|
+
reasonCodes: readinessDecision.reasonCodes
|
|
54838
54982
|
});
|
|
54839
54983
|
}
|
|
54984
|
+
return decisions;
|
|
54985
|
+
}
|
|
54986
|
+
async function submitSelectedLocalRuntimeReports(input) {
|
|
54987
|
+
const decisions = resolveSelectedLocalRuntimeReadiness(input);
|
|
54988
|
+
const results = [];
|
|
54989
|
+
for (const decision of decisions) results.push({
|
|
54990
|
+
...decision,
|
|
54991
|
+
runtimeReportSubmission: await submitPrepareRuntimeCapabilityReport({
|
|
54992
|
+
capabilityRef: decision.capabilityRef,
|
|
54993
|
+
localParticipationState: decision.localParticipationState,
|
|
54994
|
+
reasonCodes: decision.reasonCodes
|
|
54995
|
+
})
|
|
54996
|
+
});
|
|
54840
54997
|
return results;
|
|
54841
54998
|
}
|
|
54842
54999
|
function assertSelectedLocalRuntimeReportsAccepted(results) {
|
|
@@ -54845,6 +55002,11 @@ function assertSelectedLocalRuntimeReportsAccepted(results) {
|
|
|
54845
55002
|
const reasonCode = failed.reasonCodes[0] ?? failed.runtimeReportSubmission.reasonCodes[0] ?? failed.runtimeReportSubmission.reason ?? "runtime.reporting.unavailable";
|
|
54846
55003
|
throw new Error(formatSelectedRuntimeReportFailure(failed.agentId, reasonCode));
|
|
54847
55004
|
}
|
|
55005
|
+
function assertSelectedLocalRuntimeReadinessReady(decisions) {
|
|
55006
|
+
const failed = decisions.find((decision) => decision.localParticipationState !== "ready");
|
|
55007
|
+
if (!failed) return;
|
|
55008
|
+
throw new Error(formatSelectedRuntimeReportFailure(failed.agentId, failed.reasonCodes[0] ?? "runtime.reporting.unavailable"));
|
|
55009
|
+
}
|
|
54848
55010
|
function formatSelectedRuntimeReportFailure(agentId, reasonCode) {
|
|
54849
55011
|
if (reasonCode === "service.not_running") return `ATS could not connect selected agents to ATS for ${agentId} because ATS Service is not running. Run \`${formatAtsCliCommand("ats service status")}\` to inspect it, then \`${formatAtsCliCommand("ats service run")}\` to start it and retry this Web setup command.`;
|
|
54850
55012
|
if (reasonCode === "service.not_installed") return `ATS could not connect selected agents to ATS for ${agentId} because ATS Service is not installed. Run \`${formatAtsCliCommand("ats service install")}\`, then \`${formatAtsCliCommand("ats service run")}\`, and retry this Web setup command.`;
|
|
@@ -54975,6 +55137,8 @@ async function syncLocalSetupCurrentDeviceTargetFromServiceContract(input) {
|
|
|
54975
55137
|
const PREPARE_TOKEN_HEADER = "x-ats-prepare-token";
|
|
54976
55138
|
const PREPARE_SESSION_MAX_RECONNECT_ATTEMPTS = 3;
|
|
54977
55139
|
const PREPARE_SESSION_RECONNECT_DELAY_MS = 1e3;
|
|
55140
|
+
const ROUTE_CATALOG_SYNC_MAX_ATTEMPTS = 8;
|
|
55141
|
+
const ROUTE_CATALOG_SYNC_RETRY_DELAY_MS = 750;
|
|
54978
55142
|
const TERMINAL_PREPARE_STEP_ORDER = [
|
|
54979
55143
|
"prepare_selected_agents",
|
|
54980
55144
|
"refresh_service",
|
|
@@ -55233,7 +55397,7 @@ function buildTerminalStep(input) {
|
|
|
55233
55397
|
case "verify_setup": return {
|
|
55234
55398
|
message: "Checking that selected local agents are ready.",
|
|
55235
55399
|
run: async () => {
|
|
55236
|
-
return await
|
|
55400
|
+
return await verifySelectedLocalAgentsConnectedToAts({
|
|
55237
55401
|
gatewayUrl: input.input.gatewayUrl,
|
|
55238
55402
|
localAgentIds: input.localAgentIds
|
|
55239
55403
|
});
|
|
@@ -55299,12 +55463,71 @@ async function connectSelectedLocalAgentsToAts(input) {
|
|
|
55299
55463
|
readiness,
|
|
55300
55464
|
localAgentIds: input.localAgentIds
|
|
55301
55465
|
}));
|
|
55302
|
-
if (input.syncRouteCatalog) await
|
|
55466
|
+
if (input.syncRouteCatalog) await waitForConfirmedRouteCatalogSync({ reason: "prepare_selected_agents_connected" });
|
|
55467
|
+
return {
|
|
55468
|
+
...runtimeIdentity,
|
|
55469
|
+
localReadinessSnapshot: buildPrepareLocalReadinessSnapshot(readiness)
|
|
55470
|
+
};
|
|
55471
|
+
}
|
|
55472
|
+
async function verifySelectedLocalAgentsConnectedToAts(input) {
|
|
55473
|
+
const runtimeIdentity = await readTerminalRuntimeIdentityFromServiceContract();
|
|
55474
|
+
const readiness = await collectStartLocalReadiness({ auth: {
|
|
55475
|
+
status: "valid",
|
|
55476
|
+
email: null,
|
|
55477
|
+
authBaseUrl: null,
|
|
55478
|
+
gatewayUrl: input.gatewayUrl
|
|
55479
|
+
} });
|
|
55480
|
+
const selectedReadiness = resolveSelectedLocalRuntimeReadiness({
|
|
55481
|
+
readiness,
|
|
55482
|
+
localAgentIds: input.localAgentIds
|
|
55483
|
+
});
|
|
55484
|
+
assertSelectedLocalRuntimeReadinessReady(selectedReadiness);
|
|
55485
|
+
await assertSelectedRuntimeReadinessIsReadableByAts({
|
|
55486
|
+
gatewayUrl: input.gatewayUrl,
|
|
55487
|
+
runtimeIdentity,
|
|
55488
|
+
selectedReadiness
|
|
55489
|
+
});
|
|
55303
55490
|
return {
|
|
55304
55491
|
...runtimeIdentity,
|
|
55305
55492
|
localReadinessSnapshot: buildPrepareLocalReadinessSnapshot(readiness)
|
|
55306
55493
|
};
|
|
55307
55494
|
}
|
|
55495
|
+
async function readTerminalRuntimeIdentityFromServiceContract() {
|
|
55496
|
+
const serviceContract = await readDaemonServiceContract();
|
|
55497
|
+
const deviceId = serviceContract?.deviceId;
|
|
55498
|
+
const runtimeLane = serviceContract?.lane;
|
|
55499
|
+
if (!(deviceId && runtimeLane)) throw new Error("ATS could not verify selected agents because ATS Service did not provide this computer's device identity yet. Keep ATS Service running, then run the same setup command again.");
|
|
55500
|
+
return {
|
|
55501
|
+
deviceId,
|
|
55502
|
+
runtimeLane
|
|
55503
|
+
};
|
|
55504
|
+
}
|
|
55505
|
+
async function waitForConfirmedRouteCatalogSync(input) {
|
|
55506
|
+
let latestDelivery = null;
|
|
55507
|
+
for (let attempt = 1; attempt <= ROUTE_CATALOG_SYNC_MAX_ATTEMPTS; attempt++) {
|
|
55508
|
+
latestDelivery = await notifyDaemonRouteCatalogChanged({ reason: input.reason });
|
|
55509
|
+
if (latestDelivery.delivery === "control_plane") return latestDelivery;
|
|
55510
|
+
if (attempt < ROUTE_CATALOG_SYNC_MAX_ATTEMPTS) await sleep$1(ROUTE_CATALOG_SYNC_RETRY_DELAY_MS);
|
|
55511
|
+
}
|
|
55512
|
+
throw new Error(formatRouteCatalogSyncFailure(latestDelivery));
|
|
55513
|
+
}
|
|
55514
|
+
async function assertSelectedRuntimeReadinessIsReadableByAts(input) {
|
|
55515
|
+
const capabilityRefs = input.selectedReadiness.map((decision) => decision.capabilityRef);
|
|
55516
|
+
if (capabilityRefs.length === 0) return;
|
|
55517
|
+
const response = await createPrepareReadinessApi(createCliApiClientFoundation(input.gatewayUrl)).getReadiness({
|
|
55518
|
+
capabilityRefs,
|
|
55519
|
+
deviceId: input.runtimeIdentity.deviceId,
|
|
55520
|
+
lane: input.runtimeIdentity.runtimeLane
|
|
55521
|
+
});
|
|
55522
|
+
const runnableCapabilityRefs = new Set(response.runnableCapabilities.map((capability) => capability.capabilityRef));
|
|
55523
|
+
const missingCapabilityRef = capabilityRefs.find((capabilityRef) => !runnableCapabilityRefs.has(capabilityRef));
|
|
55524
|
+
if (response.status === "ready" && response.runtimeId && !missingCapabilityRef) return;
|
|
55525
|
+
const reasonCode = response.summary.reasonCodes[0] ?? response.reason ?? (missingCapabilityRef ? "prepare_readiness.capability_not_ready" : "prepare_readiness.not_ready");
|
|
55526
|
+
throw new Error(`ATS could not verify that selected agents are connected to ATS yet. Keep ATS Service running, then run the same setup command again. Support code: ${reasonCode}.`);
|
|
55527
|
+
}
|
|
55528
|
+
function formatRouteCatalogSyncFailure(latestDelivery) {
|
|
55529
|
+
return `ATS Service started, but ATS could not confirm that selected agents are available for Wake yet. Keep ATS Service running, then run the same setup command again. Support code: ${latestDelivery?.delivery === "signal" ? `route_catalog_sync.${latestDelivery.fallbackReason}` : "route_catalog_sync.unavailable"}.`;
|
|
55530
|
+
}
|
|
55308
55531
|
function buildPrepareLocalReadinessSnapshot(readiness) {
|
|
55309
55532
|
return {
|
|
55310
55533
|
observedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
@@ -55493,9 +55716,13 @@ function startHumanWaitingIndicator(input, message) {
|
|
|
55493
55716
|
}
|
|
55494
55717
|
let tick = 0;
|
|
55495
55718
|
const render = () => {
|
|
55496
|
-
const
|
|
55719
|
+
const line = formatHumanWaitingIndicatorLine({
|
|
55720
|
+
message: normalizedMessage,
|
|
55721
|
+
terminalColumns: process$1.stdout.columns,
|
|
55722
|
+
tick
|
|
55723
|
+
});
|
|
55497
55724
|
tick += 1;
|
|
55498
|
-
process$1.stdout.write(`\r${
|
|
55725
|
+
process$1.stdout.write(`\r\x1b[2K${line}`);
|
|
55499
55726
|
};
|
|
55500
55727
|
render();
|
|
55501
55728
|
const timer = setInterval(render, 500);
|
|
@@ -55504,6 +55731,23 @@ function startHumanWaitingIndicator(input, message) {
|
|
|
55504
55731
|
process$1.stdout.write("\r\x1B[2K");
|
|
55505
55732
|
} };
|
|
55506
55733
|
}
|
|
55734
|
+
function formatHumanWaitingIndicatorLine(input) {
|
|
55735
|
+
const label = shortHumanWaitingIndicatorLabel(input.message);
|
|
55736
|
+
const dots = ".".repeat(input.tick % 3 + 1);
|
|
55737
|
+
const maxLength = typeof input.terminalColumns === "number" && input.terminalColumns > 12 ? input.terminalColumns - 1 : 79;
|
|
55738
|
+
return `${truncateTerminalLine(label, Math.max(8, maxLength - dots.length))}${dots}`;
|
|
55739
|
+
}
|
|
55740
|
+
function shortHumanWaitingIndicatorLabel(message) {
|
|
55741
|
+
const normalizedMessage = message.toLowerCase();
|
|
55742
|
+
if (normalizedMessage.includes("choice in ats web")) return "Waiting for ATS Web";
|
|
55743
|
+
if (normalizedMessage.includes("connecting")) return "Connecting to ATS Web";
|
|
55744
|
+
return message;
|
|
55745
|
+
}
|
|
55746
|
+
function truncateTerminalLine(value, maxLength) {
|
|
55747
|
+
if (value.length <= maxLength) return value;
|
|
55748
|
+
if (maxLength <= 1) return value.slice(0, maxLength);
|
|
55749
|
+
return `${value.slice(0, maxLength - 1)}.`;
|
|
55750
|
+
}
|
|
55507
55751
|
function toStatusCodeSlug(title) {
|
|
55508
55752
|
const slug = title.toLowerCase().replaceAll(/[^a-z0-9]+/g, "_").replaceAll(/^_+|_+$/g, "");
|
|
55509
55753
|
return slug.length > 0 ? slug : "status";
|
|
@@ -61395,6 +61639,7 @@ function buildServiceTraceAgentExecutionStatus(input) {
|
|
|
61395
61639
|
agentProfileId: input.agentProfileId,
|
|
61396
61640
|
binding: normalizeBindingProjection(input.binding),
|
|
61397
61641
|
claimDiagnostics: normalizeClaimDiagnostics(input.claimDiagnostics),
|
|
61642
|
+
route: input.route ?? null,
|
|
61398
61643
|
runtimeReadiness: normalizePrepareReadiness(input.prepareReadiness)
|
|
61399
61644
|
});
|
|
61400
61645
|
}
|