agent-transport-system 0.3.47 → 0.3.48

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-Bb7PYhPq.js";
4
- import { v as DEV_LOCAL_GATEWAY_BASE_URL } from "./runtime-config-DrykJV63.js";
3
+ import "./lock-BDqdJx3V.js";
4
+ import { v as DEV_LOCAL_GATEWAY_BASE_URL } from "./runtime-config-BB48ivdi.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-Bb7PYhPq.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-BDqdJx3V.js";
4
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";
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-BB48ivdi.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.47";
30
+ var version = "0.3.48";
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-CvsrTiRk.js");
4010
+ const { clearDaemonRuntimeLease } = await import("./daemon-runtime-lease-G7W5cMzg.js");
4011
4011
  await Promise.all([rm(daemonServiceRuntimeStatePath(pathInput), { force: true }), clearDaemonRuntimeLease(pathInput)]);
4012
4012
  }
4013
4013
  async function withDaemonServiceRunLock(callback, meta = {
@@ -52802,8 +52802,11 @@ function failCliStartHandoffProgress(input) {
52802
52802
  //#endregion
52803
52803
  //#region src/ui/delayed-spinner.ts
52804
52804
  const DEFAULT_SPINNER_DELAY_MS = 250;
52805
+ const SPINNER_DECORATION_VISIBLE_WIDTH = 6;
52806
+ const TRUNCATED_SPINNER_MESSAGE_MARKER = "…";
52805
52807
  function createDelayedSpinner(input) {
52806
- if (!(input.enabled === true && (input.isTTY ?? process.stdout.isTTY) === true && typeof clackPrompts.spinner === "function")) return {
52808
+ const terminalColumns = resolveSpinnerTerminalColumns(input.columns ?? process.stdout.columns);
52809
+ if (!(input.enabled === true && (input.isTTY ?? process.stdout.isTTY) === true && terminalColumns !== null && terminalColumns >= SPINNER_DECORATION_VISIBLE_WIDTH && typeof clackPrompts.spinner === "function")) return {
52807
52810
  start: () => void 0,
52808
52811
  complete: () => void 0,
52809
52812
  fail: () => void 0
@@ -52812,7 +52815,10 @@ function createDelayedSpinner(input) {
52812
52815
  const delayMs = input.delayMs ?? DEFAULT_SPINNER_DELAY_MS;
52813
52816
  let pendingTimer = null;
52814
52817
  let spinnerVisible = false;
52815
- const latestMessage = input.message;
52818
+ const latestMessage = toSingleLineSpinnerMessage({
52819
+ message: input.message,
52820
+ terminalColumns
52821
+ });
52816
52822
  const clearPendingTimer = () => {
52817
52823
  if (!pendingTimer) return;
52818
52824
  clearTimeout(pendingTimer);
@@ -52848,6 +52854,30 @@ function createDelayedSpinner(input) {
52848
52854
  }
52849
52855
  };
52850
52856
  }
52857
+ function resolveSpinnerTerminalColumns(columns) {
52858
+ if (typeof columns !== "number" || !Number.isInteger(columns) || columns < 1) return null;
52859
+ return columns;
52860
+ }
52861
+ function toSingleLineSpinnerMessage(input) {
52862
+ const maxMessageWidth = input.terminalColumns - SPINNER_DECORATION_VISIBLE_WIDTH;
52863
+ if (maxMessageWidth < 1) return "";
52864
+ return truncateVisibleText(sanitizeTerminalDisplayText(input.message, "single-line").trim(), maxMessageWidth);
52865
+ }
52866
+ function truncateVisibleText(value, maxWidth) {
52867
+ if (stringWidth(value) <= maxWidth) return value;
52868
+ const markerWidth = stringWidth(TRUNCATED_SPINNER_MESSAGE_MARKER);
52869
+ if (maxWidth <= markerWidth) return TRUNCATED_SPINNER_MESSAGE_MARKER;
52870
+ const targetWidth = maxWidth - markerWidth;
52871
+ let result = "";
52872
+ let resultWidth = 0;
52873
+ for (const char of value) {
52874
+ const charWidth = stringWidth(char);
52875
+ if (resultWidth + charWidth > targetWidth) break;
52876
+ result += char;
52877
+ resultWidth += charWidth;
52878
+ }
52879
+ return `${result.trimEnd()}${TRUNCATED_SPINNER_MESSAGE_MARKER}`;
52880
+ }
52851
52881
 
52852
52882
  //#endregion
52853
52883
  //#region src/lib/profile-kind.ts
@@ -53914,10 +53944,11 @@ async function runStartHandoff(input) {
53914
53944
  const sessionDeviceId = requireStartHandoffSessionDeviceId(sessionSlot.value);
53915
53945
  const localSetupMode = resolveLocalSetupMode({ session: sessionSlot.value });
53916
53946
  const profile = await resolveCliStartHandoffProfile(handoff.profile);
53917
- const { targetProfileIds, targetProfiles } = await resolveCliStartHandoffTargetProfiles({
53947
+ const { targetProfileIds, targetProfiles: resolvedTargetProfiles } = await resolveCliStartHandoffTargetProfiles({
53918
53948
  primaryProfile: profile,
53919
53949
  session: sessionSlot.value
53920
53950
  });
53951
+ let targetProfiles = resolvedTargetProfiles;
53921
53952
  let readiness = await collectHandoffReadiness(gatewayUrl);
53922
53953
  let observation = await buildValidatedHandoffObservation({
53923
53954
  baseUrl: gatewayUrl,
@@ -53952,7 +53983,7 @@ async function runStartHandoff(input) {
53952
53983
  });
53953
53984
  if (input.runtime.resolvedView === "human" && input.interactive) {
53954
53985
  await runWithDelayedSpinner({
53955
- message: "Waiting for your agent choices in ATS Web. Keep this Terminal open; setup will continue automatically.",
53986
+ message: "Waiting for your agent choices in ATS Web",
53956
53987
  completeMessage: "ATS received your agent choices from ATS Web.",
53957
53988
  run: async () => await waitForWebAgentSelection({
53958
53989
  opaqueToken: input.startSession,
@@ -53960,7 +53991,10 @@ async function runStartHandoff(input) {
53960
53991
  waitConfig
53961
53992
  })
53962
53993
  });
53963
- await runStartHandoff(input);
53994
+ await runWithDelayedSpinner({
53995
+ message: "Continuing setup on this computer",
53996
+ run: async () => await runStartHandoff(input)
53997
+ });
53964
53998
  return;
53965
53999
  }
53966
54000
  throw new Error(START_HANDOFF_WAITING_FOR_WEB_AGENT_SELECTION_MESSAGE);
@@ -53982,6 +54016,23 @@ async function runStartHandoff(input) {
53982
54016
  });
53983
54017
  }
53984
54018
  });
54019
+ const preparation = await runHandoffLocalStepWithFailedProgressSync({
54020
+ run: async () => await prepareLocalAgentReadiness({
54021
+ profiles: targetProfiles,
54022
+ interactive: input.runtime.resolvedView === "human" && input.interactive,
54023
+ view: input.view
54024
+ }),
54025
+ syncFailedProgress: async () => {
54026
+ progress = failCliStartHandoffProgress({ progress });
54027
+ await writeHandoffProgress({
54028
+ startApi,
54029
+ opaqueToken: input.startSession,
54030
+ progress
54031
+ });
54032
+ }
54033
+ });
54034
+ if (preparation.status === "cancelled") return;
54035
+ targetProfiles = preparation.profiles;
53985
54036
  readiness = await collectHandoffReadiness(gatewayUrl);
53986
54037
  observation = await buildValidatedHandoffObservation({
53987
54038
  baseUrl: gatewayUrl,
@@ -58065,7 +58116,8 @@ function readLooseGatewayErrorEnvelope(value) {
58065
58116
  //#region src/config/space-dispatch-lookup-api.ts
58066
58117
  async function fetchSpaceDispatchLookup(input) {
58067
58118
  const endpoint = new URL(toSpaceDispatchLookupUrl(input.baseUrl, input.space));
58068
- endpoint.searchParams.set("sourceSignalId", input.sourceSignalId);
58119
+ if (typeof input.sourceSignalId === "string") endpoint.searchParams.set("sourceSignalId", input.sourceSignalId);
58120
+ if (typeof input.clientMessageId === "string") endpoint.searchParams.set("clientMessageId", input.clientMessageId);
58069
58121
  if (typeof input.targetProfileId === "string") endpoint.searchParams.set("targetProfileId", input.targetProfileId);
58070
58122
  return await readGatewayJsonResponse({
58071
58123
  response: await fetchSpaceRequestWithTimeout({
@@ -58141,6 +58193,7 @@ async function runServiceTrace(input, deps = {}) {
58141
58193
  baseUrl,
58142
58194
  deps,
58143
58195
  dispatchId: input.dispatchId,
58196
+ clientMessageId: input.clientMessageId,
58144
58197
  password: input.password,
58145
58198
  presenter,
58146
58199
  runtimeView: runtime.resolvedView,
@@ -58162,6 +58215,7 @@ async function runServiceTrace(input, deps = {}) {
58162
58215
  });
58163
58216
  const payload = {
58164
58217
  query: traceResponse.query,
58218
+ lookup: selection.lookup,
58165
58219
  actorProfile: {
58166
58220
  profileId: actingProfile.atsProfileId,
58167
58221
  profileName: actingProfile.profileName,
@@ -58206,6 +58260,7 @@ async function runServiceTrace(input, deps = {}) {
58206
58260
  actorProfile: actingProfile,
58207
58261
  spaceId: traceResponse.query.spaceId,
58208
58262
  dispatchId: traceResponse.query.dispatchId,
58263
+ lookup: selection.lookup,
58209
58264
  trace: traceResponse.trace,
58210
58265
  targetProfile: targetContext.targetProfile,
58211
58266
  currentAgentReplyReadiness: targetContext.currentAgentReplyReadiness,
@@ -58219,15 +58274,20 @@ async function runServiceTrace(input, deps = {}) {
58219
58274
  async function resolveDispatchTraceSelection(input) {
58220
58275
  const dispatchSelector = normalizeOptionalString$5(input.dispatchId);
58221
58276
  const sourceSignalSelector = normalizeOptionalString$5(input.sourceSignalId);
58277
+ const clientMessageSelector = normalizeOptionalString$5(input.clientMessageId);
58222
58278
  const targetProfileSelector = normalizeOptionalString$5(input.targetProfileId);
58223
- if (Number(dispatchSelector !== null) + Number(sourceSignalSelector !== null) !== 1) throw new Error("exactly one of dispatchId or sourceSignalId is required");
58224
- if (dispatchSelector) return { dispatchId: dispatchSelector };
58225
- if (!sourceSignalSelector) throw new Error("sourceSignalId could not be resolved");
58279
+ if (Number(dispatchSelector !== null) + Number(sourceSignalSelector !== null) + Number(clientMessageSelector !== null) !== 1) throw new Error("exactly one of dispatchId, sourceSignalId, or clientMessageId is required");
58280
+ if (dispatchSelector) return {
58281
+ dispatchId: dispatchSelector,
58282
+ lookup: null
58283
+ };
58284
+ if (!(sourceSignalSelector || clientMessageSelector)) throw new Error("lookup selector could not be resolved");
58226
58285
  const lookup = await (input.deps.fetchLookup ?? fetchSpaceDispatchLookup)({
58227
58286
  requestContext: input.requestContext,
58228
58287
  baseUrl: input.baseUrl,
58229
58288
  space: input.spaceId,
58230
- sourceSignalId: sourceSignalSelector,
58289
+ ...sourceSignalSelector ? { sourceSignalId: sourceSignalSelector } : {},
58290
+ ...clientMessageSelector ? { clientMessageId: clientMessageSelector } : {},
58231
58291
  ...targetProfileSelector ? { targetProfileId: targetProfileSelector } : {},
58232
58292
  password: input.password
58233
58293
  });
@@ -58237,6 +58297,7 @@ async function resolveDispatchTraceSelection(input) {
58237
58297
  runtimeView: input.runtimeView,
58238
58298
  spaceId: lookup.query.spaceId,
58239
58299
  sourceSignalId: lookup.query.sourceSignalId,
58300
+ clientMessageId: lookup.query.clientMessageId,
58240
58301
  targetProfileId: lookup.query.targetProfileId
58241
58302
  });
58242
58303
  return null;
@@ -58251,7 +58312,10 @@ async function resolveDispatchTraceSelection(input) {
58251
58312
  }
58252
58313
  const dispatchId = lookup.matches[0]?.dispatchId ?? null;
58253
58314
  if (!dispatchId) throw new Error("dispatchId could not be resolved");
58254
- return { dispatchId };
58315
+ return {
58316
+ dispatchId,
58317
+ lookup
58318
+ };
58255
58319
  }
58256
58320
  async function resolveTraceTargetContext(input) {
58257
58321
  const targetProfileId = input.trace?.dispatch.targetProfileId ?? null;
@@ -58300,10 +58364,12 @@ function renderLookupNotFound(input) {
58300
58364
  query: {
58301
58365
  spaceId: input.spaceId,
58302
58366
  sourceSignalId: input.sourceSignalId,
58367
+ clientMessageId: input.clientMessageId,
58303
58368
  targetProfileId: input.targetProfileId
58304
58369
  },
58305
58370
  matches: []
58306
58371
  };
58372
+ const selectorLabel = formatLookupSelectorLabel(input);
58307
58373
  if (input.runtimeView === "agent") {
58308
58374
  input.presenter.data({
58309
58375
  code: "service.trace.lookup",
@@ -58311,7 +58377,7 @@ function renderLookupNotFound(input) {
58311
58377
  });
58312
58378
  input.presenter.line({
58313
58379
  code: "service.trace.lookup.summary",
58314
- text: `source signal ${input.sourceSignalId}: no matching dispatches`,
58380
+ text: `${selectorLabel}: no matching dispatches`,
58315
58381
  data: payload
58316
58382
  });
58317
58383
  return;
@@ -58326,10 +58392,14 @@ function renderLookupNotFound(input) {
58326
58392
  label: "Space ID",
58327
58393
  value: input.spaceId
58328
58394
  },
58329
- {
58395
+ ...input.sourceSignalId ? [{
58330
58396
  label: "Source Signal",
58331
58397
  value: input.sourceSignalId
58332
- },
58398
+ }] : [],
58399
+ ...input.clientMessageId ? [{
58400
+ label: "Client Message",
58401
+ value: input.clientMessageId
58402
+ }] : [],
58333
58403
  ...input.targetProfileId ? [{
58334
58404
  label: "Target Profile",
58335
58405
  value: input.targetProfileId
@@ -58340,7 +58410,7 @@ function renderLookupNotFound(input) {
58340
58410
  },
58341
58411
  {
58342
58412
  label: "Why",
58343
- value: "No dispatch ledger record was found for this source signal."
58413
+ value: input.sourceSignalId ? "No dispatch ledger record was found for this source signal." : "No source signal was found for this client message."
58344
58414
  }
58345
58415
  ]
58346
58416
  });
@@ -58353,7 +58423,7 @@ function renderLookupAmbiguous(input) {
58353
58423
  });
58354
58424
  input.presenter.line({
58355
58425
  code: "service.trace.lookup.summary",
58356
- text: `source signal ${input.lookup.query.sourceSignalId}: ${input.lookup.matches.length} matching dispatches; specify --target-profile or --dispatch`,
58426
+ text: `${formatLookupSelectorLabel(input.lookup.query)}: ${input.lookup.matches.length} matching dispatches; specify --target-profile or --dispatch`,
58357
58427
  data: input.lookup
58358
58428
  });
58359
58429
  return;
@@ -58363,10 +58433,14 @@ function renderLookupAmbiguous(input) {
58363
58433
  label: "Space ID",
58364
58434
  value: input.lookup.query.spaceId
58365
58435
  },
58366
- {
58436
+ ...input.lookup.query.sourceSignalId ? [{
58367
58437
  label: "Source Signal",
58368
58438
  value: input.lookup.query.sourceSignalId
58369
- },
58439
+ }] : [],
58440
+ ...input.lookup.query.clientMessageId ? [{
58441
+ label: "Client Message",
58442
+ value: input.lookup.query.clientMessageId
58443
+ }] : [],
58370
58444
  {
58371
58445
  label: "Status",
58372
58446
  value: `${input.lookup.matches.length} matching dispatches`
@@ -58388,6 +58462,11 @@ function renderLookupAmbiguous(input) {
58388
58462
  rows
58389
58463
  });
58390
58464
  }
58465
+ function formatLookupSelectorLabel(input) {
58466
+ if (input.sourceSignalId) return `source signal ${input.sourceSignalId}`;
58467
+ if (input.clientMessageId) return `client message ${input.clientMessageId}`;
58468
+ return "lookup selector";
58469
+ }
58391
58470
  function buildHumanTraceRows(input) {
58392
58471
  if (!input.trace) return [
58393
58472
  {
@@ -58428,6 +58507,14 @@ function buildHumanTraceRows(input) {
58428
58507
  label: "Dispatch ID",
58429
58508
  value: input.trace.dispatch.dispatchId
58430
58509
  },
58510
+ ...input.lookup?.query.sourceSignalId ? [{
58511
+ label: "Source Signal",
58512
+ value: input.lookup.query.sourceSignalId
58513
+ }] : [],
58514
+ ...input.lookup?.query.clientMessageId ? [{
58515
+ label: "Client Message",
58516
+ value: input.lookup.query.clientMessageId
58517
+ }] : [],
58431
58518
  {
58432
58519
  label: "Target",
58433
58520
  value: input.targetProfile?.profileName ?? input.trace.dispatch.targetProfileId
@@ -58435,6 +58522,10 @@ function buildHumanTraceRows(input) {
58435
58522
  {
58436
58523
  label: "Dispatch",
58437
58524
  value: `${input.trace.dispatch.status} · attempts ${input.trace.dispatch.attemptCount}`
58525
+ },
58526
+ {
58527
+ label: "Root Cause",
58528
+ value: resolveTraceRootCause(input.trace)
58438
58529
  }
58439
58530
  ];
58440
58531
  if (input.currentAgentReplyReadiness) {
@@ -58662,7 +58753,15 @@ function buildAgentTraceSummary(input) {
58662
58753
  const previewEmitted = input.trace.streaming?.previewEmitted === true;
58663
58754
  const runtimeSummary = input.trace.runtime ? ` runtime=${formatRuntimeTraceSummary(input.trace.runtime)}` : "";
58664
58755
  const dispatchExecutionSummary = input.trace.dispatchExecution ? ` upstream_conversation_resume=${input.trace.dispatchExecution.upstreamConversationResume.status} local_runtime_context=${input.trace.dispatchExecution.localRuntimeContext.status} bootstrap=${input.trace.dispatchExecution.bootstrap.status}` : "";
58665
- return `dispatch ${input.trace.dispatch.dispatchId}: status=${input.trace.dispatch.status} latestAttempt=${attemptStatus} streaming=${streamingMode} preview=${previewEmitted ? "emitted" : "none"}${runtimeSummary}${dispatchExecutionSummary}`;
58756
+ return `dispatch ${input.trace.dispatch.dispatchId}: status=${input.trace.dispatch.status} rootCause=${resolveTraceRootCause(input.trace)} latestAttempt=${attemptStatus} streaming=${streamingMode} preview=${previewEmitted ? "emitted" : "none"}${runtimeSummary}${dispatchExecutionSummary}`;
58757
+ }
58758
+ function resolveTraceRootCause(trace) {
58759
+ if (trace.latestAttempt?.errorCode) return trace.latestAttempt.errorCode;
58760
+ if (trace.dispatch.status === "succeeded") return trace.replySignal ? "reply.delivered" : "reply.not_found";
58761
+ if (trace.execution?.leaseState === "stalled") return "daemon.execution_stalled";
58762
+ if (trace.runtime?.timeoutTriggeredAt) return "runtime.timeout";
58763
+ if (trace.latestAttempt?.status) return `attempt.${trace.latestAttempt.status}`;
58764
+ return `dispatch.${trace.dispatch.status}`;
58666
58765
  }
58667
58766
  function formatAttemptError(errorCode, errorMessage) {
58668
58767
  return errorMessage ? `${errorCode} (${errorMessage})` : errorCode;
@@ -87242,7 +87341,7 @@ registerDaemonControlTargetOptions({ command: serviceCmd.command("cancel").descr
87242
87341
  }
87243
87342
  });
87244
87343
  });
87245
- serviceCmd.command("trace").description("Read a Space delivery trace for debugging.").requiredOption("--space <id>", "Space ID (64-character hex)").option("--dispatch <id>", "Dispatch ID").option("--source-signal <id>", "Source signal ID").option("--target-profile <id>", "Target ATS profile ID for source-signal lookup").option("--password <value>", "Space password for protected access").option("--profile <id>", "ATS profile ID used for auth context").option("--gateway-url <url>", "ATS gateway URL (command line, ATS_GATEWAY_URL, or saved ATS settings)").action(async (opts) => {
87344
+ serviceCmd.command("trace").description("Read a Space delivery trace for debugging.").requiredOption("--space <id>", "Space ID (64-character hex)").option("--dispatch <id>", "Dispatch ID").option("--source-signal <id>", "Source signal ID").option("--client-message <id>", "Client message ID from the sender").option("--target-profile <id>", "Target ATS profile ID for source-signal lookup").option("--password <value>", "Space password for protected access").option("--profile <id>", "ATS profile ID used for auth context").option("--gateway-url <url>", "ATS gateway URL (command line, ATS_GATEWAY_URL, or saved ATS settings)").action(async (opts) => {
87246
87345
  const view = getGlobalViewOption();
87247
87346
  await runCommandWithEntryChecks({
87248
87347
  routeTokens: ["service", "trace"],
@@ -87252,14 +87351,16 @@ serviceCmd.command("trace").description("Read a Space delivery trace for debuggi
87252
87351
  run: async () => {
87253
87352
  const dispatchId = normalizeOptionalString(opts.dispatch);
87254
87353
  const sourceSignalId = normalizeOptionalString(opts.sourceSignal);
87354
+ const clientMessageId = normalizeOptionalString(opts.clientMessage);
87255
87355
  const targetProfileId = normalizeOptionalString(opts.targetProfile);
87256
- if (Number(dispatchId !== null) + Number(sourceSignalId !== null) !== 1) throw new Error("exactly one of --dispatch or --source-signal is required");
87356
+ if (Number(dispatchId !== null) + Number(sourceSignalId !== null) + Number(clientMessageId !== null) !== 1) throw new Error("exactly one of --dispatch, --source-signal, or --client-message is required");
87257
87357
  await runServiceTrace({
87258
87358
  profile: opts.profile,
87259
87359
  baseUrl: opts.gatewayUrl,
87260
87360
  space: String(opts.space ?? ""),
87261
87361
  ...dispatchId ? { dispatchId } : {},
87262
87362
  ...sourceSignalId ? { sourceSignalId } : {},
87363
+ ...clientMessageId ? { clientMessageId } : {},
87263
87364
  ...targetProfileId ? { targetProfileId } : {},
87264
87365
  password: opts.password,
87265
87366
  view