agent-transport-system 0.3.45 → 0.3.47

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- import "./lock-CA3rSDod.js";
4
- import { v as DEV_LOCAL_GATEWAY_BASE_URL } from "./runtime-config-Bp7NfBtS.js";
3
+ import "./lock-Bb7PYhPq.js";
4
+ import { v as DEV_LOCAL_GATEWAY_BASE_URL } from "./runtime-config-DrykJV63.js";
5
5
 
6
6
  //#region src/ats-dev.ts
7
7
  const LOCAL_GATEWAY_URL = DEV_LOCAL_GATEWAY_BASE_URL;
package/dist/ats.js CHANGED
@@ -1,8 +1,8 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- import { $ as currentDeviceTargetResponseSchema, $t as resolveSpaceMentionLabels, A as SPACE_MEMBER_REMOVE_NOTICE_PURPOSE, An as writeCurrentDeviceBootstrapObservationResponseSchema, At as normalizeBuiltinControllerAgentId, B as atsdTaskResultOpenClawGatewayVisibilityStatusSchema, Bt as patchStartSessionBodySchema, C as DISPATCH_ACTIVITY_DISPATCHING_PURPOSE, Cn as startSessionSpaceChoiceResponseSchema, Ct as getSpaceDispatchResultResponseSchema, D as MAX_PROFILE_WORKING_DIRECTORY_LENGTH, Dn as upsertProfileSpaceHistoryResponseSchema, Dt as isExplicitBuiltinControllerRef, E as LEGACY_RUNTIME_DISPATCH_POLICY, En as structuredGuidePayloadFromInputSchema, Et as incomingServerMessageSchema, F as atsRuntimeProfileIdSchema, Fn as writeStartObservedDeviceMetadataBodySchema, Ft as ownedDevicesResponseSchema, G as canonicalizeControllerRefForKind, Gt as profileWorkspaceModeSchema, H as buildControllerRoutingKeyForKind, Ht as postNormalMessageResponseSchema, I as atsSpaceEgressActionSchema, In as writeStartObservedDeviceMetadataResponseSchema, It as parseOptionalClientMessageId, J as continuitySchema, Jt as removeSpaceMembersResponseSchema, K as catchupResponseSchema, Kt as providerDispatchRuntimeContextSchema, L as atsdControlPlaneRequestSchema, Ln as writeStartSessionProgressBodySchema, Lt as patchProfileSpaceHistoryStatusResponseSchema, M as SPACE_PASSWORD_MIN_LENGTH, Mn as writeCurrentDeviceObservedMetadataResponseSchema, Mt as normalizeListSignalsReadQuerySemantics, N as SPACE_UPDATES_MAX_LIMIT, Nn as writeStartObservationBodySchema, Nt as normalizeMessageEnvelope, O as SPACE_DISPATCH_TRACE_PROMPT_PREVIEW_MAX_CHARS, On as upsertSpaceDeletionTombstoneResponseSchema, Ot as leaveSpaceResponseSchema, P as atsProfileIdSchema, Pn as writeStartObservationResponseSchema, Pt as normalizeOptionalWorkingDirectory, Q as createStartSessionBodySchema, Qt as resolveSingleSpaceMentionLabels, R as atsdControlPlaneResponseSchema, Rn as writeStartSessionProgressResponseSchema, Rt as patchSpaceContractBodySchema, S as DAEMON_HUB_SCHEMA_VERSION, Sn as startSessionSpaceChoiceBodySchema, St as getSpaceDispatchLookupResponseSchema, T as DISPATCH_ACTIVITY_RETRYING_PURPOSE, Tn as startStateResponseSchema, Tt as getSpaceUpdatesResponseSchema, U as buildUpstreamConversationRef, Ut as postSpaceMembersBodySchema, V as atsdTaskResultPayloadSchema, Vt as postNormalMessageBodySchema, W as canonicalizeBuiltinControllerRef, Wt as postSpaceMembersResponseSchema, X as createSpaceBodySchema, Xt as resolveBuiltinUpstreamConversationRefKind, Y as conversationExecutionStateSchema, Yt as resolveBuiltinProviderConversationCapability, Z as createSpaceResponseSchema, Zt as resolveMessageEnvelopeTargetField, _ as AGENT_REPLY_PREVIEW_END_PURPOSE, _n as spaceMetaSchema, _t as gatewayErrorCodeSchema, a as runWithHeldLock, an as serverErrorFrameSchema, at as daemonHubHeartbeatResponseSchema, b as ATSD_TASK_RESULT_SCHEMA_VERSION, bn as startSessionProgressSchema, bt as getSpaceConversationRemoteStatusResponseSchema, c as LEGACY_ATS_RUNTIME_SESSION_ENV_KEY, cn as signalEnvelopeSchema, ct as daemonHubSubmitTaskResultRequestSchema, d as resolveRuntimeSession, dn as spaceConversationBindingImportResponseSchema, dt as daemonServiceContractSchema, en as resolveStartHandoffBodySchema, et as daemonHubDeliverDispatchRequestSchema, f as resolveRuntimeSessionId, fn as spaceConversationBindingResponseSchema, ft as daemonStreamFrameSchema, g as AGENT_REPLYING_PURPOSE, gn as spaceMembersSnapshotSchema, gt as formatCanonicalMentionLiteral, h as AGENT_REPLYING_END_PURPOSE, hn as spaceDispatchTraceResponseSchema, ht as forgetCurrentComputerResponseSchema, i as releaseLock, in as sanitizeSignalTextPreview, it as daemonHubHeartbeatRequestSchema, j as SPACE_MENTION_REJECT_NOTICE_PURPOSE, jn as writeCurrentDeviceObservedMetadataBodySchema, jt as normalizeBuiltinControllerProviderId, k as SPACE_MEMBER_JOIN_NOTICE_PURPOSE, kn as writeCurrentDeviceBootstrapObservationBodySchema, kt as listProfileSpaceHistoryResponseSchema, l as listRuntimeSessionStates, ln as spaceConversationBindingConflictResponseSchema, lt as daemonRouteObservationResponseSchema, m as resolveBuiltinAgentControllerBrand, mn as spaceCreatorSchema, mt as entryBriefSchema, n as isAtsLockError, nt as daemonHubDispatchPreviewEndRequestSchema, o as tryCleanupStaleLock, on as setCurrentDeviceTargetBodySchema, ot as daemonHubRegisterSessionRequestSchema, p as writeRuntimeSessionState, pn as spaceConversationBindingUpsertResponseSchema, pt as dispatchBriefSchema, q as collectCanonicalMentionTextFragments, qt as querySpaceDeletionTombstonesResponseSchema, r as readLockMeta, rt as daemonHubDispatchPreviewRequestSchema, s as ATS_RUNTIME_SESSION_ENV_KEY, sn as setOwnedDeviceDisplayNameBodySchema, st as daemonHubRegisterSessionResponseSchema, t as acquireLock, tn as resolveStartHandoffResponseSchema, tt as daemonHubDispatchLifecycleRequestSchema, u as readRuntimeSessionState, un as spaceConversationBindingDeleteResponseSchema, ut as daemonRuntimeLeaseSchema, v as AGENT_REPLY_PREVIEW_PURPOSE, vn as startDeviceProjectionSchema, vt as gatewayErrorEnvelopeSchema, w as DISPATCH_ACTIVITY_FAILED_PURPOSE, wn as startSessionWithTokenResponseSchema, wt as getSpaceStatusResponseSchema, x as CONVERSATION_CONTINUITY_WARNING_PURPOSE, xn as startSessionResponseSchema, xt as getSpaceConversationStatusResponseSchema, y as ATSD_CONTROL_PLANE_SCHEMA_VERSION, yn as startProfileReadinessSummarySchema, yt as getSpaceContractResponseSchema, z as atsdTaskResultEnvelopeWriteSchema, zn as createDaemonRouteObservationSummary, zt as patchSpaceContractResponseSchema } from "./lock-CA3rSDod.js";
4
- import { C as normalizeAtsProfileId, D as resolveAtsRootDir, E as resolveAtsEnvPreset, M as spacesDir, N as systemDir, O as runtimeDir, S as normalizeAccountKey, T as profileViewPath, a as accountProfileWorkspacePath, c as atsRootDir, d as deviceOpenClawProfileBootstrapPath, f as deviceOpenClawProfileDir, i as accountProfileViewPath, j as skillsDir, k as runtimeLogsDir, 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-B2sqzP1x.js";
5
- import { A as toSpaceDispatchTraceUrl, C as normalizeBaseUrl, D as toSpaceCursorUrl, E as toSpaceCreateUrl, F as toSpaceRemoveMembersUrl, I as toSpaceResultUrl, L as toSpaceSignalsUrl, M as toSpaceMembersUrl, N as toSpaceMetaUrl, O as toSpaceDeleteUrl, P as toSpacePasswordUrl, R as toSpaceUpdatesUrl, S as resolveExplicitGatewayUrlOrThrow, T as toSpaceContractUrl, _ as updateConfiguredStartV1OnboardingState, a as getConfiguredDeviceRuntimeState, b as resolveBaseUrl, c as getConfiguredStartV1OnboardingState, d as resolveRuntimeSkillsCustomTargetId, f as setConfiguredBaseUrl, g as updateConfiguredSkillsConfig, h as updateConfiguredOnboardingConfig, i as getConfiguredDaemonDispatchLimits, j as toSpaceLeaveUrl, k as toSpaceDispatchLookupUrl, 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 toDaemonRouteObservationUrl, x as resolveBaseUrlOrNull, y as normalizeGatewayBaseUrlOrNull, z as toSpaceWsUrl } from "./runtime-config-Bp7NfBtS.js";
3
+ import { $ as currentDeviceTargetResponseSchema, $t as resolveSpaceMentionLabels, A as SPACE_MEMBER_REMOVE_NOTICE_PURPOSE, An as writeCurrentDeviceBootstrapObservationResponseSchema, At as normalizeBuiltinControllerAgentId, B as atsdTaskResultOpenClawGatewayVisibilityStatusSchema, Bt as patchStartSessionBodySchema, C as DISPATCH_ACTIVITY_DISPATCHING_PURPOSE, Cn as startSessionSpaceChoiceResponseSchema, Ct as getSpaceDispatchResultResponseSchema, D as MAX_PROFILE_WORKING_DIRECTORY_LENGTH, Dn as upsertProfileSpaceHistoryResponseSchema, Dt as isExplicitBuiltinControllerRef, E as LEGACY_RUNTIME_DISPATCH_POLICY, En as structuredGuidePayloadFromInputSchema, Et as incomingServerMessageSchema, F as atsRuntimeProfileIdSchema, Fn as writeStartObservedDeviceMetadataBodySchema, Ft as ownedDevicesResponseSchema, G as canonicalizeControllerRefForKind, Gt as profileWorkspaceModeSchema, H as buildControllerRoutingKeyForKind, Ht as postNormalMessageResponseSchema, I as atsSpaceEgressActionSchema, In as writeStartObservedDeviceMetadataResponseSchema, It as parseOptionalClientMessageId, J as continuitySchema, Jt as removeSpaceMembersResponseSchema, K as catchupResponseSchema, Kt as providerDispatchRuntimeContextSchema, L as atsdControlPlaneRequestSchema, Ln as writeStartSessionProgressBodySchema, Lt as patchProfileSpaceHistoryStatusResponseSchema, M as SPACE_PASSWORD_MIN_LENGTH, Mn as writeCurrentDeviceObservedMetadataResponseSchema, Mt as normalizeListSignalsReadQuerySemantics, N as SPACE_UPDATES_MAX_LIMIT, Nn as writeStartObservationBodySchema, Nt as normalizeMessageEnvelope, O as SPACE_DISPATCH_TRACE_PROMPT_PREVIEW_MAX_CHARS, On as upsertSpaceDeletionTombstoneResponseSchema, Ot as leaveSpaceResponseSchema, P as atsProfileIdSchema, Pn as writeStartObservationResponseSchema, Pt as normalizeOptionalWorkingDirectory, Q as createStartSessionBodySchema, Qt as resolveSingleSpaceMentionLabels, R as atsdControlPlaneResponseSchema, Rn as writeStartSessionProgressResponseSchema, Rt as patchSpaceContractBodySchema, S as DAEMON_HUB_SCHEMA_VERSION, Sn as startSessionSpaceChoiceBodySchema, St as getSpaceDispatchLookupResponseSchema, T as DISPATCH_ACTIVITY_RETRYING_PURPOSE, Tn as startStateResponseSchema, Tt as getSpaceUpdatesResponseSchema, U as buildUpstreamConversationRef, Ut as postSpaceMembersBodySchema, V as atsdTaskResultPayloadSchema, Vt as postNormalMessageBodySchema, W as canonicalizeBuiltinControllerRef, Wt as postSpaceMembersResponseSchema, X as createSpaceBodySchema, Xt as resolveBuiltinUpstreamConversationRefKind, Y as conversationExecutionStateSchema, Yt as resolveBuiltinProviderConversationCapability, Z as createSpaceResponseSchema, Zt as resolveMessageEnvelopeTargetField, _ as AGENT_REPLY_PREVIEW_END_PURPOSE, _n as spaceMetaSchema, _t as gatewayErrorCodeSchema, a as runWithHeldLock, an as serverErrorFrameSchema, at as daemonHubHeartbeatResponseSchema, b as ATSD_TASK_RESULT_SCHEMA_VERSION, bn as startSessionProgressSchema, bt as getSpaceConversationRemoteStatusResponseSchema, c as LEGACY_ATS_RUNTIME_SESSION_ENV_KEY, cn as signalEnvelopeSchema, ct as daemonHubSubmitTaskResultRequestSchema, d as resolveRuntimeSession, dn as spaceConversationBindingImportResponseSchema, dt as daemonServiceContractSchema, en as resolveStartHandoffBodySchema, et as daemonHubDeliverDispatchRequestSchema, f as resolveRuntimeSessionId, fn as spaceConversationBindingResponseSchema, ft as daemonStreamFrameSchema, g as AGENT_REPLYING_PURPOSE, gn as spaceMembersSnapshotSchema, gt as formatCanonicalMentionLiteral, h as AGENT_REPLYING_END_PURPOSE, hn as spaceDispatchTraceResponseSchema, ht as forgetCurrentComputerResponseSchema, i as releaseLock, in as sanitizeSignalTextPreview, it as daemonHubHeartbeatRequestSchema, j as SPACE_MENTION_REJECT_NOTICE_PURPOSE, jn as writeCurrentDeviceObservedMetadataBodySchema, jt as normalizeBuiltinControllerProviderId, k as SPACE_MEMBER_JOIN_NOTICE_PURPOSE, kn as writeCurrentDeviceBootstrapObservationBodySchema, kt as listProfileSpaceHistoryResponseSchema, l as listRuntimeSessionStates, ln as spaceConversationBindingConflictResponseSchema, lt as daemonRouteObservationResponseSchema, m as resolveBuiltinAgentControllerBrand, mn as spaceCreatorSchema, mt as entryBriefSchema, n as isAtsLockError, nt as daemonHubDispatchPreviewEndRequestSchema, o as tryCleanupStaleLock, on as setCurrentDeviceTargetBodySchema, ot as daemonHubRegisterSessionRequestSchema, p as writeRuntimeSessionState, pn as spaceConversationBindingUpsertResponseSchema, pt as dispatchBriefSchema, q as collectCanonicalMentionTextFragments, qt as querySpaceDeletionTombstonesResponseSchema, r as readLockMeta, rt as daemonHubDispatchPreviewRequestSchema, s as ATS_RUNTIME_SESSION_ENV_KEY, sn as setOwnedDeviceDisplayNameBodySchema, st as daemonHubRegisterSessionResponseSchema, t as acquireLock, tn as resolveStartHandoffResponseSchema, tt as daemonHubDispatchLifecycleRequestSchema, u as readRuntimeSessionState, un as spaceConversationBindingDeleteResponseSchema, ut as daemonRuntimeLeaseSchema, v as AGENT_REPLY_PREVIEW_PURPOSE, vn as startDeviceProjectionSchema, vt as gatewayErrorEnvelopeSchema, w as DISPATCH_ACTIVITY_FAILED_PURPOSE, wn as startSessionWithTokenResponseSchema, wt as getSpaceStatusResponseSchema, x as CONVERSATION_CONTINUITY_WARNING_PURPOSE, xn as startSessionResponseSchema, xt as getSpaceConversationStatusResponseSchema, y as ATSD_CONTROL_PLANE_SCHEMA_VERSION, yn as startProfileReadinessSummarySchema, yt as getSpaceContractResponseSchema, z as atsdTaskResultEnvelopeWriteSchema, zn as createDaemonRouteObservationSummary, zt as patchSpaceContractResponseSchema } from "./lock-Bb7PYhPq.js";
4
+ import { A as runtimeLogsDir, C as normalizeAtsProfileId, D as resolveAtsRootDir, E as resolveAtsEnvPreset, M as skillsDir, N as spacesDir, O as resolveKnownAtsEnvPresetFromArgv, 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-DTn3aLSP.js";
5
+ import { A as toSpaceDispatchTraceUrl, C as normalizeBaseUrl, D as toSpaceCursorUrl, E as toSpaceCreateUrl, F as toSpaceRemoveMembersUrl, I as toSpaceResultUrl, L as toSpaceSignalsUrl, M as toSpaceMembersUrl, N as toSpaceMetaUrl, O as toSpaceDeleteUrl, P as toSpacePasswordUrl, R as toSpaceUpdatesUrl, S as resolveExplicitGatewayUrlOrThrow, T as toSpaceContractUrl, _ as updateConfiguredStartV1OnboardingState, a as getConfiguredDeviceRuntimeState, b as resolveBaseUrl, c as getConfiguredStartV1OnboardingState, d as resolveRuntimeSkillsCustomTargetId, f as setConfiguredBaseUrl, g as updateConfiguredSkillsConfig, h as updateConfiguredOnboardingConfig, i as getConfiguredDaemonDispatchLimits, j as toSpaceLeaveUrl, k as toSpaceDispatchLookupUrl, 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 toDaemonRouteObservationUrl, x as resolveBaseUrlOrNull, y as normalizeGatewayBaseUrlOrNull, z as toSpaceWsUrl } from "./runtime-config-DrykJV63.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,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.3.45";
30
+ var version = "0.3.47";
31
31
  var package_default = {
32
32
  name: "agent-transport-system",
33
33
  version,
@@ -4007,7 +4007,7 @@ async function setDaemonServiceRuntimeState(state, pathInput = {}) {
4007
4007
  await writeDaemonServiceRuntimeState(state, pathInput);
4008
4008
  }
4009
4009
  async function clearDaemonServiceRuntimeState(pathInput = {}) {
4010
- const { clearDaemonRuntimeLease } = await import("./daemon-runtime-lease-BF-4jUcH.js");
4010
+ const { clearDaemonRuntimeLease } = await import("./daemon-runtime-lease-CvsrTiRk.js");
4011
4011
  await Promise.all([rm(daemonServiceRuntimeStatePath(pathInput), { force: true }), clearDaemonRuntimeLease(pathInput)]);
4012
4012
  }
4013
4013
  async function withDaemonServiceRunLock(callback, meta = {
@@ -10236,8 +10236,8 @@ function collectProfileReadinessPlannerSignals(readModel, baseAction) {
10236
10236
  const memberResult = collectProfileSignalsForId({
10237
10237
  readModel,
10238
10238
  actionId: baseAction.actionId,
10239
- blockRouteOffline: false,
10240
- blockReplyBlocked: false,
10239
+ blockRouteOffline: baseAction.actionId === "space_entry",
10240
+ blockReplyBlocked: baseAction.actionId === "space_entry",
10241
10241
  profileId
10242
10242
  });
10243
10243
  attention.push(...memberResult.attention);
@@ -18192,7 +18192,7 @@ function toErrorMessage$20(error) {
18192
18192
 
18193
18193
  //#endregion
18194
18194
  //#region src/system/gateway-chain-readiness.ts
18195
- const DEFAULT_GATEWAY_CHAIN_TIMEOUT_MS = 5e3;
18195
+ const DEFAULT_GATEWAY_CHAIN_TIMEOUT_MS = 3e4;
18196
18196
  async function resolveGatewayChainReadiness(input = {}) {
18197
18197
  const checkedAt = (/* @__PURE__ */ new Date()).toISOString();
18198
18198
  const authSession = input.authSession === void 0 ? await resolveGatewayChainAuthSession() : input.authSession;
@@ -23809,6 +23809,7 @@ function prepareSpaceComposerSubmission(input) {
23809
23809
  mentionText: fragment.text,
23810
23810
  relation: parsedLiteral.type
23811
23811
  }));
23812
+ if (parsedLiteral.type === "wake" && target.wakeAvailability.status === "blocked") throw new Error(buildBlockedWakeCanonicalMentionMessage({ profileName: target.profileName }));
23812
23813
  envelopeInput[resolveMessageEnvelopeTargetField(parsedLiteral.type)].push(target.profileId);
23813
23814
  profileIdsInTextOrder.push(target.profileId);
23814
23815
  canonicalMentionsInTextOrder.push({
@@ -23901,6 +23902,9 @@ function describeRelationSupport(relation) {
23901
23902
  if (relation === "wake") return "agent targets";
23902
23903
  return "active targets";
23903
23904
  }
23905
+ function buildBlockedWakeCanonicalMentionMessage(input) {
23906
+ return `Cannot Wake "${input.profileName}" yet. Finish local agent setup on this computer first.`;
23907
+ }
23904
23908
  function formatCanonicalMentionEnvelopeError(error) {
23905
23909
  const issues = extractEnvelopeIssueMessages(error);
23906
23910
  for (const issueMessage of issues) {
@@ -24066,15 +24070,13 @@ function listSpaceMentionRelationChoices(input) {
24066
24070
  const choices = [];
24067
24071
  for (const relation of MENTION_RELATION_ORDER) {
24068
24072
  if (!input.allowedRelations[relation]) continue;
24073
+ if (relation === "wake" && input.wakeAvailability.status === "blocked") continue;
24069
24074
  choices.push({
24070
24075
  canonicalLiteral: formatCanonicalMentionLiteral({
24071
24076
  name: input.primaryMentionLabel,
24072
24077
  type: relation
24073
24078
  }),
24074
- description: buildRelationChoiceDescription({
24075
- relation,
24076
- wakeAvailability: input.wakeAvailability
24077
- }),
24079
+ description: RELATION_DESCRIPTIONS[relation],
24078
24080
  label: RELATION_LABELS[relation],
24079
24081
  relation
24080
24082
  });
@@ -24193,11 +24195,6 @@ function compareMentionSuggestions(left, right, recentRankByProfileId) {
24193
24195
  if (left.liveNow !== right.liveNow) return left.liveNow ? -1 : 1;
24194
24196
  return left.primaryMentionLabel.localeCompare(right.primaryMentionLabel, "en", { sensitivity: "base" });
24195
24197
  }
24196
- function buildRelationChoiceDescription(input) {
24197
- const segments = [RELATION_DESCRIPTIONS[input.relation]];
24198
- if (input.relation === "wake" && input.wakeAvailability.status === "blocked") segments.push("unavailable now");
24199
- return segments.join(" · ");
24200
- }
24201
24198
  function normalizeMentionQuery(value) {
24202
24199
  return value.trim().replace(MENTION_PREFIX_PATTERN, "").replace(MULTI_SPACE_PATTERN$1, " ").toLowerCase();
24203
24200
  }
@@ -33175,7 +33172,8 @@ async function createStartSession(client, input) {
33175
33172
  profileChoice: input.profileChoice,
33176
33173
  agentSelection: input.agentSelection,
33177
33174
  ...input.spaceMemberSelection === void 0 ? {} : { spaceMemberSelection: input.spaceMemberSelection },
33178
- spaceChoice: input.spaceChoice
33175
+ spaceChoice: input.spaceChoice,
33176
+ ...input.writeMode === void 0 ? {} : { writeMode: input.writeMode }
33179
33177
  });
33180
33178
  return await client.requestJson({
33181
33179
  url: buildStartSessionPath(input.deviceId),
@@ -50726,7 +50724,7 @@ async function prepareSingleAgentProfile(input) {
50726
50724
  let profile = input.profile;
50727
50725
  let prepared = false;
50728
50726
  let snapshot = await resolveProfileReadinessSnapshot(profile);
50729
- const initialReasonCodes = snapshot.deviceReplyReadiness.reasonCodes;
50727
+ const initialReasonCodes = collectPreparationReasonCodes(snapshot);
50730
50728
  if (needsControllerSetup({
50731
50729
  profile,
50732
50730
  reasonCodes: initialReasonCodes
@@ -50763,7 +50761,7 @@ async function prepareSingleAgentProfile(input) {
50763
50761
  snapshot = await resolveProfileReadinessSnapshot(profile);
50764
50762
  }
50765
50763
  }
50766
- const reasonCodes = snapshot.deviceReplyReadiness.reasonCodes;
50764
+ const reasonCodes = collectPreparationReasonCodes(snapshot);
50767
50765
  if (reasonCodes.includes("projection.missing")) {
50768
50766
  await syncDeviceRuntimeStateProjection({ mode: "repair" });
50769
50767
  prepared = true;
@@ -50814,6 +50812,12 @@ async function resolveProfileReadinessSnapshot(profile) {
50814
50812
  profile
50815
50813
  });
50816
50814
  }
50815
+ function collectPreparationReasonCodes(snapshot) {
50816
+ const reasonCodes = [];
50817
+ for (const reasonCode of snapshot.deviceReplyReadiness.reasonCodes) if (!reasonCodes.includes(reasonCode)) reasonCodes.push(reasonCode);
50818
+ for (const reasonCode of snapshot.agentReplyReadiness?.reasonCodes ?? []) if (!reasonCodes.includes(reasonCode)) reasonCodes.push(reasonCode);
50819
+ return reasonCodes;
50820
+ }
50817
50821
  function didWorkspaceRepairPrepareProfile(input) {
50818
50822
  if (input.workspaceSync.status === "skipped") return false;
50819
50823
  if (!input.workspaceSync.projectedProfileIds.includes(input.profileId)) return false;
@@ -52795,6 +52799,56 @@ function failCliStartHandoffProgress(input) {
52795
52799
  });
52796
52800
  }
52797
52801
 
52802
+ //#endregion
52803
+ //#region src/ui/delayed-spinner.ts
52804
+ const DEFAULT_SPINNER_DELAY_MS = 250;
52805
+ function createDelayedSpinner(input) {
52806
+ if (!(input.enabled === true && (input.isTTY ?? process.stdout.isTTY) === true && typeof clackPrompts.spinner === "function")) return {
52807
+ start: () => void 0,
52808
+ complete: () => void 0,
52809
+ fail: () => void 0
52810
+ };
52811
+ const progressSpinner = clackPrompts.spinner();
52812
+ const delayMs = input.delayMs ?? DEFAULT_SPINNER_DELAY_MS;
52813
+ let pendingTimer = null;
52814
+ let spinnerVisible = false;
52815
+ const latestMessage = input.message;
52816
+ const clearPendingTimer = () => {
52817
+ if (!pendingTimer) return;
52818
+ clearTimeout(pendingTimer);
52819
+ pendingTimer = null;
52820
+ };
52821
+ const ensureSpinnerStarted = () => {
52822
+ if (spinnerVisible || pendingTimer) return;
52823
+ pendingTimer = setTimeout(() => {
52824
+ pendingTimer = null;
52825
+ spinnerVisible = true;
52826
+ progressSpinner.start(latestMessage);
52827
+ }, delayMs);
52828
+ };
52829
+ return {
52830
+ start: () => {
52831
+ ensureSpinnerStarted();
52832
+ },
52833
+ complete: (message) => {
52834
+ clearPendingTimer();
52835
+ if (!spinnerVisible) return;
52836
+ spinnerVisible = false;
52837
+ if (message) {
52838
+ progressSpinner.stop(message);
52839
+ return;
52840
+ }
52841
+ progressSpinner.clear();
52842
+ },
52843
+ fail: () => {
52844
+ clearPendingTimer();
52845
+ if (!spinnerVisible) return;
52846
+ spinnerVisible = false;
52847
+ progressSpinner.clear();
52848
+ }
52849
+ };
52850
+ }
52851
+
52798
52852
  //#endregion
52799
52853
  //#region src/lib/profile-kind.ts
52800
52854
  function toProfileKind(value) {
@@ -53897,10 +53951,14 @@ async function runStartHandoff(input) {
53897
53951
  timeoutMs: waitConfig.timeoutMs
53898
53952
  });
53899
53953
  if (input.runtime.resolvedView === "human" && input.interactive) {
53900
- await waitForWebAgentSelection({
53901
- opaqueToken: input.startSession,
53902
- startApi,
53903
- waitConfig
53954
+ await runWithDelayedSpinner({
53955
+ message: "Waiting for your agent choices in ATS Web. Keep this Terminal open; setup will continue automatically.",
53956
+ completeMessage: "ATS received your agent choices from ATS Web.",
53957
+ run: async () => await waitForWebAgentSelection({
53958
+ opaqueToken: input.startSession,
53959
+ startApi,
53960
+ waitConfig
53961
+ })
53904
53962
  });
53905
53963
  await runStartHandoff(input);
53906
53964
  return;
@@ -53971,33 +54029,39 @@ async function runStartHandoff(input) {
53971
54029
  });
53972
54030
  }
53973
54031
  }) === "cancelled") return;
53974
- readiness = await collectHandoffReadiness(gatewayUrl);
53975
- observation = await buildValidatedHandoffObservation({
53976
- baseUrl: gatewayUrl,
53977
- profile,
53978
- sessionDeviceId,
53979
- targetProfileIds,
53980
- targetProfiles,
53981
- readiness
53982
- });
53983
- await writeHandoffObservation({
53984
- startApi,
53985
- opaqueToken: input.startSession,
53986
- observation
53987
- });
53988
- progress = touchCliStartHandoffProgress({ progress });
53989
- await writeHandoffProgress({
53990
- startApi,
53991
- opaqueToken: input.startSession,
53992
- progress
53993
- });
53994
- foundation = await buildCliStartHandoffFoundation({
53995
- baseUrl: gatewayUrl,
53996
- profile,
53997
- readiness,
53998
- session: sessionSlot,
53999
- targetProfileIds,
54000
- targetProfiles
54032
+ await runWithDelayedSpinner({
54033
+ message: "Finishing local setup. ATS is checking this computer and updating ATS Web.",
54034
+ completeMessage: "ATS finished checking this computer.",
54035
+ run: async () => {
54036
+ readiness = await collectHandoffReadiness(gatewayUrl);
54037
+ observation = await buildValidatedHandoffObservation({
54038
+ baseUrl: gatewayUrl,
54039
+ profile,
54040
+ sessionDeviceId,
54041
+ targetProfileIds,
54042
+ targetProfiles,
54043
+ readiness
54044
+ });
54045
+ await writeHandoffObservation({
54046
+ startApi,
54047
+ opaqueToken: input.startSession,
54048
+ observation
54049
+ });
54050
+ progress = touchCliStartHandoffProgress({ progress });
54051
+ await writeHandoffProgress({
54052
+ startApi,
54053
+ opaqueToken: input.startSession,
54054
+ progress
54055
+ });
54056
+ foundation = await buildCliStartHandoffFoundation({
54057
+ baseUrl: gatewayUrl,
54058
+ profile,
54059
+ readiness,
54060
+ session: sessionSlot,
54061
+ targetProfileIds,
54062
+ targetProfiles
54063
+ });
54064
+ }
54001
54065
  });
54002
54066
  const serviceStepResult = await runHandoffLocalStepWithFailedProgressSync({
54003
54067
  run: async () => await runStartServiceStep({
@@ -54018,19 +54082,25 @@ async function runStartHandoff(input) {
54018
54082
  });
54019
54083
  }
54020
54084
  });
54021
- readiness = await collectHandoffReadiness(gatewayUrl);
54022
- observation = await buildValidatedHandoffObservation({
54023
- baseUrl: gatewayUrl,
54024
- profile,
54025
- sessionDeviceId,
54026
- targetProfileIds,
54027
- targetProfiles,
54028
- readiness
54029
- });
54030
- await writeHandoffObservation({
54031
- startApi,
54032
- opaqueToken: input.startSession,
54033
- observation
54085
+ await runWithDelayedSpinner({
54086
+ message: "Verifying local agent readiness and telling ATS Web this computer is ready.",
54087
+ completeMessage: "ATS Web can now use this computer.",
54088
+ run: async () => {
54089
+ readiness = await collectHandoffReadiness(gatewayUrl);
54090
+ observation = await buildValidatedHandoffObservation({
54091
+ baseUrl: gatewayUrl,
54092
+ profile,
54093
+ sessionDeviceId,
54094
+ targetProfileIds,
54095
+ targetProfiles,
54096
+ readiness
54097
+ });
54098
+ await writeHandoffObservation({
54099
+ startApi,
54100
+ opaqueToken: input.startSession,
54101
+ observation
54102
+ });
54103
+ }
54034
54104
  });
54035
54105
  if (serviceStepResult !== "continue") return;
54036
54106
  progress = localSetupMode.kind === "selected_agents" ? advanceCliStartHandoffProgressAfterLocalSetup({ progress }) : touchCliStartHandoffProgress({ progress });
@@ -54085,6 +54155,21 @@ async function runHandoffLocalStepWithFailedProgressSync(input) {
54085
54155
  throw error;
54086
54156
  }
54087
54157
  }
54158
+ async function runWithDelayedSpinner(input) {
54159
+ const spinner = createDelayedSpinner({
54160
+ enabled: true,
54161
+ message: input.message
54162
+ });
54163
+ spinner.start();
54164
+ try {
54165
+ const result = await input.run();
54166
+ spinner.complete(input.completeMessage);
54167
+ return result;
54168
+ } catch (error) {
54169
+ spinner.fail();
54170
+ throw error;
54171
+ }
54172
+ }
54088
54173
  async function buildValidatedHandoffObservation(input) {
54089
54174
  const observation = await buildCliStartObservation({
54090
54175
  baseUrl: input.baseUrl,
@@ -54484,6 +54569,12 @@ async function runAgentsPrepare(input) {
54484
54569
  profile: preparedProfile,
54485
54570
  runtime
54486
54571
  });
54572
+ await maybeCompleteServiceReadinessAfterPreparation({
54573
+ interactive,
54574
+ profile: preparedProfile,
54575
+ runtime,
54576
+ view: input.view
54577
+ });
54487
54578
  await emitAgentsPrepareReadinessResult({
54488
54579
  presenter,
54489
54580
  profile: preparedProfile,
@@ -54590,6 +54681,59 @@ async function stopServiceForResetThisComputer(input) {
54590
54681
  throw error;
54591
54682
  }
54592
54683
  }
54684
+ async function maybeCompleteServiceReadinessAfterPreparation(input) {
54685
+ if (!input.interactive || input.runtime.resolvedView !== "human") return;
54686
+ const reasonCodes = collectReadinessReasonCodes(await resolveCurrentReplyReadinessSnapshot({
54687
+ checkGatewayChain: true,
54688
+ includeDaemonRouteObservation: true,
54689
+ openClawDiagnosticsMode: "repair",
54690
+ ownerUserId: input.profile.ownerUserId,
54691
+ profile: input.profile
54692
+ }));
54693
+ if (reasonCodes.length === 0) return;
54694
+ if ((await inspectDaemonServiceInventory({
54695
+ expectedVersion: resolveCurrentDaemonExpectedVersion(),
54696
+ intent: "status_cleanup"
54697
+ })).anomalies.some((anomaly) => DAEMON_SERVICE_ARTIFACT_DRIFT_ANOMALIES.has(anomaly.code)) || reasonCodes.includes("service.drifted")) {
54698
+ await runDaemonReinstall({
54699
+ agentOverviewHandled: true,
54700
+ profile: input.profile.atsProfileId,
54701
+ view: input.view
54702
+ }, {
54703
+ startAfterInstallMode: "always",
54704
+ suppressAgentOverview: true
54705
+ });
54706
+ return;
54707
+ }
54708
+ if (reasonCodes.includes("service.not_installed")) {
54709
+ await runDaemonInstall({
54710
+ agentOverviewHandled: true,
54711
+ profile: input.profile.atsProfileId,
54712
+ view: input.view
54713
+ }, { suppressAgentOverview: true });
54714
+ await runDaemonRun({
54715
+ agentOverviewHandled: true,
54716
+ gatewayUrl: await resolveBaseUrl(),
54717
+ mode: "background",
54718
+ profile: input.profile.atsProfileId,
54719
+ view: input.view
54720
+ });
54721
+ return;
54722
+ }
54723
+ if (reasonCodes.includes("service.not_running")) await runDaemonRun({
54724
+ agentOverviewHandled: true,
54725
+ gatewayUrl: await resolveBaseUrl(),
54726
+ mode: "background",
54727
+ profile: input.profile.atsProfileId,
54728
+ view: input.view
54729
+ });
54730
+ }
54731
+ function collectReadinessReasonCodes(input) {
54732
+ const reasonCodes = [];
54733
+ for (const reasonCode of input.deviceReplyReadiness.reasonCodes) if (!reasonCodes.includes(reasonCode)) reasonCodes.push(reasonCode);
54734
+ for (const reasonCode of input.agentReplyReadiness?.reasonCodes ?? []) if (!reasonCodes.includes(reasonCode)) reasonCodes.push(reasonCode);
54735
+ return reasonCodes;
54736
+ }
54593
54737
  function normalizeOptionalString$7(value) {
54594
54738
  const normalized = String(value ?? "").trim();
54595
54739
  return normalized.length > 0 ? normalized : null;
@@ -54909,6 +55053,51 @@ function formatLastSeen(lastObservedAtMs) {
54909
55053
  }).format(new Date(lastObservedAtMs))}`;
54910
55054
  }
54911
55055
 
55056
+ //#endregion
55057
+ //#region src/commands/production-web-prepare-environment.ts
55058
+ const PRODUCTION_WEB_PREPARE_ENV_KEYS = [
55059
+ ATS_HOME_ENV_KEY,
55060
+ "ATS_GATEWAY_URL",
55061
+ "ATS_AUTH_URL",
55062
+ "ATS_ENV_PRESET",
55063
+ "ATS_DEV_MODE",
55064
+ "ATS_USER_FACING_CLI_COMMAND"
55065
+ ];
55066
+ async function runWithProductionWebPrepareEnvironment(input, run) {
55067
+ const env = input.env ?? process$1.env;
55068
+ if (!shouldUseProductionWebPrepareEnvironment(input)) return run();
55069
+ const previousEnv = captureEnvironment(env);
55070
+ clearProductionWebPrepareEnvironment(env);
55071
+ try {
55072
+ return await run();
55073
+ } finally {
55074
+ restoreEnvironment(env, previousEnv);
55075
+ }
55076
+ }
55077
+ function shouldUseProductionWebPrepareEnvironment(input) {
55078
+ if (resolveKnownAtsEnvPresetFromArgv(input.argv ?? process$1.argv) !== "prod") return false;
55079
+ if (hasText(input.humanProfile) || hasText(input.startSession)) return true;
55080
+ return hasText(input.profile) && hasText(input.ott);
55081
+ }
55082
+ function captureEnvironment(env) {
55083
+ return Object.fromEntries(PRODUCTION_WEB_PREPARE_ENV_KEYS.map((key) => [key, env[key]]));
55084
+ }
55085
+ function clearProductionWebPrepareEnvironment(env) {
55086
+ for (const key of PRODUCTION_WEB_PREPARE_ENV_KEYS) Reflect.deleteProperty(env, key);
55087
+ }
55088
+ function restoreEnvironment(env, previousEnv) {
55089
+ for (const [key, value] of Object.entries(previousEnv)) {
55090
+ if (value === void 0) {
55091
+ Reflect.deleteProperty(env, key);
55092
+ continue;
55093
+ }
55094
+ env[key] = value;
55095
+ }
55096
+ }
55097
+ function hasText(value) {
55098
+ return String(value ?? "").trim().length > 0;
55099
+ }
55100
+
54912
55101
  //#endregion
54913
55102
  //#region src/system/provider-diagnostics/openclaw/presentation.ts
54914
55103
  function formatOpenClawBootstrapDisplay(input) {
@@ -59340,56 +59529,6 @@ function buildAgentPreparationPromptMessage(profiles) {
59340
59529
  return `${String(profiles.length)} local agent profiles still need setup on this device before they can wake or reply in the background. Prepare them now?`;
59341
59530
  }
59342
59531
 
59343
- //#endregion
59344
- //#region src/ui/delayed-spinner.ts
59345
- const DEFAULT_SPINNER_DELAY_MS = 250;
59346
- function createDelayedSpinner(input) {
59347
- if (!(input.enabled === true && (input.isTTY ?? process.stdout.isTTY) === true && typeof clackPrompts.spinner === "function")) return {
59348
- start: () => void 0,
59349
- complete: () => void 0,
59350
- fail: () => void 0
59351
- };
59352
- const progressSpinner = clackPrompts.spinner();
59353
- const delayMs = input.delayMs ?? DEFAULT_SPINNER_DELAY_MS;
59354
- let pendingTimer = null;
59355
- let spinnerVisible = false;
59356
- const latestMessage = input.message;
59357
- const clearPendingTimer = () => {
59358
- if (!pendingTimer) return;
59359
- clearTimeout(pendingTimer);
59360
- pendingTimer = null;
59361
- };
59362
- const ensureSpinnerStarted = () => {
59363
- if (spinnerVisible || pendingTimer) return;
59364
- pendingTimer = setTimeout(() => {
59365
- pendingTimer = null;
59366
- spinnerVisible = true;
59367
- progressSpinner.start(latestMessage);
59368
- }, delayMs);
59369
- };
59370
- return {
59371
- start: () => {
59372
- ensureSpinnerStarted();
59373
- },
59374
- complete: (message) => {
59375
- clearPendingTimer();
59376
- if (!spinnerVisible) return;
59377
- spinnerVisible = false;
59378
- if (message) {
59379
- progressSpinner.stop(message);
59380
- return;
59381
- }
59382
- progressSpinner.clear();
59383
- },
59384
- fail: () => {
59385
- clearPendingTimer();
59386
- if (!spinnerVisible) return;
59387
- spinnerVisible = false;
59388
- progressSpinner.clear();
59389
- }
59390
- };
59391
- }
59392
-
59393
59532
  //#endregion
59394
59533
  //#region src/space/agent-overview.ts
59395
59534
  const STAGES_BY_COMMAND = {
@@ -86793,25 +86932,33 @@ agentsCmd.command("prepare").description("Prepare local agent readiness on this
86793
86932
  "ats service run"
86794
86933
  ])).action(async (opts) => {
86795
86934
  const view = getGlobalViewOption();
86796
- await runCommandWithEntryChecks({
86797
- routeTokens: ["agents", "prepare"],
86798
- view,
86935
+ await runWithProductionWebPrepareEnvironment({
86936
+ argv: process.argv,
86937
+ humanProfile: opts.humanProfile,
86938
+ ott: opts.ott,
86799
86939
  profile: opts.profile,
86800
- run: async () => {
86801
- await runAgentsPrepare({
86802
- profile: opts.profile,
86803
- humanProfile: opts.humanProfile,
86804
- agent: opts.agent,
86805
- ott: opts.ott,
86806
- resetThisComputer: Boolean(opts.resetThisComputer),
86807
- startSession: opts.startSession,
86808
- view
86809
- });
86810
- await maybeRunAgentViewRecoveryAfterSuccess({
86811
- view,
86812
- profile: opts.profile
86813
- });
86814
- }
86940
+ startSession: opts.startSession
86941
+ }, async () => {
86942
+ await runCommandWithEntryChecks({
86943
+ routeTokens: ["agents", "prepare"],
86944
+ view,
86945
+ profile: opts.profile,
86946
+ run: async () => {
86947
+ await runAgentsPrepare({
86948
+ profile: opts.profile,
86949
+ humanProfile: opts.humanProfile,
86950
+ agent: opts.agent,
86951
+ ott: opts.ott,
86952
+ resetThisComputer: Boolean(opts.resetThisComputer),
86953
+ startSession: opts.startSession,
86954
+ view
86955
+ });
86956
+ await maybeRunAgentViewRecoveryAfterSuccess({
86957
+ view,
86958
+ profile: opts.profile
86959
+ });
86960
+ }
86961
+ });
86815
86962
  });
86816
86963
  });
86817
86964
  agentsCmd.command("list").alias("ls").description("List the agents ATS can use on this device.").action(async () => {