agent-transport-system 0.3.47 → 0.3.49

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.49";
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,
@@ -53982,6 +54013,23 @@ async function runStartHandoff(input) {
53982
54013
  });
53983
54014
  }
53984
54015
  });
54016
+ const preparation = await runHandoffLocalStepWithFailedProgressSync({
54017
+ run: async () => await prepareLocalAgentReadiness({
54018
+ profiles: targetProfiles,
54019
+ interactive: input.runtime.resolvedView === "human" && input.interactive,
54020
+ view: input.view
54021
+ }),
54022
+ syncFailedProgress: async () => {
54023
+ progress = failCliStartHandoffProgress({ progress });
54024
+ await writeHandoffProgress({
54025
+ startApi,
54026
+ opaqueToken: input.startSession,
54027
+ progress
54028
+ });
54029
+ }
54030
+ });
54031
+ if (preparation.status === "cancelled") return;
54032
+ targetProfiles = preparation.profiles;
53985
54033
  readiness = await collectHandoffReadiness(gatewayUrl);
53986
54034
  observation = await buildValidatedHandoffObservation({
53987
54035
  baseUrl: gatewayUrl,
@@ -58065,7 +58113,8 @@ function readLooseGatewayErrorEnvelope(value) {
58065
58113
  //#region src/config/space-dispatch-lookup-api.ts
58066
58114
  async function fetchSpaceDispatchLookup(input) {
58067
58115
  const endpoint = new URL(toSpaceDispatchLookupUrl(input.baseUrl, input.space));
58068
- endpoint.searchParams.set("sourceSignalId", input.sourceSignalId);
58116
+ if (typeof input.sourceSignalId === "string") endpoint.searchParams.set("sourceSignalId", input.sourceSignalId);
58117
+ if (typeof input.clientMessageId === "string") endpoint.searchParams.set("clientMessageId", input.clientMessageId);
58069
58118
  if (typeof input.targetProfileId === "string") endpoint.searchParams.set("targetProfileId", input.targetProfileId);
58070
58119
  return await readGatewayJsonResponse({
58071
58120
  response: await fetchSpaceRequestWithTimeout({
@@ -58141,6 +58190,7 @@ async function runServiceTrace(input, deps = {}) {
58141
58190
  baseUrl,
58142
58191
  deps,
58143
58192
  dispatchId: input.dispatchId,
58193
+ clientMessageId: input.clientMessageId,
58144
58194
  password: input.password,
58145
58195
  presenter,
58146
58196
  runtimeView: runtime.resolvedView,
@@ -58162,6 +58212,7 @@ async function runServiceTrace(input, deps = {}) {
58162
58212
  });
58163
58213
  const payload = {
58164
58214
  query: traceResponse.query,
58215
+ lookup: selection.lookup,
58165
58216
  actorProfile: {
58166
58217
  profileId: actingProfile.atsProfileId,
58167
58218
  profileName: actingProfile.profileName,
@@ -58206,6 +58257,7 @@ async function runServiceTrace(input, deps = {}) {
58206
58257
  actorProfile: actingProfile,
58207
58258
  spaceId: traceResponse.query.spaceId,
58208
58259
  dispatchId: traceResponse.query.dispatchId,
58260
+ lookup: selection.lookup,
58209
58261
  trace: traceResponse.trace,
58210
58262
  targetProfile: targetContext.targetProfile,
58211
58263
  currentAgentReplyReadiness: targetContext.currentAgentReplyReadiness,
@@ -58219,15 +58271,20 @@ async function runServiceTrace(input, deps = {}) {
58219
58271
  async function resolveDispatchTraceSelection(input) {
58220
58272
  const dispatchSelector = normalizeOptionalString$5(input.dispatchId);
58221
58273
  const sourceSignalSelector = normalizeOptionalString$5(input.sourceSignalId);
58274
+ const clientMessageSelector = normalizeOptionalString$5(input.clientMessageId);
58222
58275
  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");
58276
+ if (Number(dispatchSelector !== null) + Number(sourceSignalSelector !== null) + Number(clientMessageSelector !== null) !== 1) throw new Error("exactly one of dispatchId, sourceSignalId, or clientMessageId is required");
58277
+ if (dispatchSelector) return {
58278
+ dispatchId: dispatchSelector,
58279
+ lookup: null
58280
+ };
58281
+ if (!(sourceSignalSelector || clientMessageSelector)) throw new Error("lookup selector could not be resolved");
58226
58282
  const lookup = await (input.deps.fetchLookup ?? fetchSpaceDispatchLookup)({
58227
58283
  requestContext: input.requestContext,
58228
58284
  baseUrl: input.baseUrl,
58229
58285
  space: input.spaceId,
58230
- sourceSignalId: sourceSignalSelector,
58286
+ ...sourceSignalSelector ? { sourceSignalId: sourceSignalSelector } : {},
58287
+ ...clientMessageSelector ? { clientMessageId: clientMessageSelector } : {},
58231
58288
  ...targetProfileSelector ? { targetProfileId: targetProfileSelector } : {},
58232
58289
  password: input.password
58233
58290
  });
@@ -58237,6 +58294,7 @@ async function resolveDispatchTraceSelection(input) {
58237
58294
  runtimeView: input.runtimeView,
58238
58295
  spaceId: lookup.query.spaceId,
58239
58296
  sourceSignalId: lookup.query.sourceSignalId,
58297
+ clientMessageId: lookup.query.clientMessageId,
58240
58298
  targetProfileId: lookup.query.targetProfileId
58241
58299
  });
58242
58300
  return null;
@@ -58251,7 +58309,10 @@ async function resolveDispatchTraceSelection(input) {
58251
58309
  }
58252
58310
  const dispatchId = lookup.matches[0]?.dispatchId ?? null;
58253
58311
  if (!dispatchId) throw new Error("dispatchId could not be resolved");
58254
- return { dispatchId };
58312
+ return {
58313
+ dispatchId,
58314
+ lookup
58315
+ };
58255
58316
  }
58256
58317
  async function resolveTraceTargetContext(input) {
58257
58318
  const targetProfileId = input.trace?.dispatch.targetProfileId ?? null;
@@ -58300,10 +58361,12 @@ function renderLookupNotFound(input) {
58300
58361
  query: {
58301
58362
  spaceId: input.spaceId,
58302
58363
  sourceSignalId: input.sourceSignalId,
58364
+ clientMessageId: input.clientMessageId,
58303
58365
  targetProfileId: input.targetProfileId
58304
58366
  },
58305
58367
  matches: []
58306
58368
  };
58369
+ const selectorLabel = formatLookupSelectorLabel(input);
58307
58370
  if (input.runtimeView === "agent") {
58308
58371
  input.presenter.data({
58309
58372
  code: "service.trace.lookup",
@@ -58311,7 +58374,7 @@ function renderLookupNotFound(input) {
58311
58374
  });
58312
58375
  input.presenter.line({
58313
58376
  code: "service.trace.lookup.summary",
58314
- text: `source signal ${input.sourceSignalId}: no matching dispatches`,
58377
+ text: `${selectorLabel}: no matching dispatches`,
58315
58378
  data: payload
58316
58379
  });
58317
58380
  return;
@@ -58326,10 +58389,14 @@ function renderLookupNotFound(input) {
58326
58389
  label: "Space ID",
58327
58390
  value: input.spaceId
58328
58391
  },
58329
- {
58392
+ ...input.sourceSignalId ? [{
58330
58393
  label: "Source Signal",
58331
58394
  value: input.sourceSignalId
58332
- },
58395
+ }] : [],
58396
+ ...input.clientMessageId ? [{
58397
+ label: "Client Message",
58398
+ value: input.clientMessageId
58399
+ }] : [],
58333
58400
  ...input.targetProfileId ? [{
58334
58401
  label: "Target Profile",
58335
58402
  value: input.targetProfileId
@@ -58340,7 +58407,7 @@ function renderLookupNotFound(input) {
58340
58407
  },
58341
58408
  {
58342
58409
  label: "Why",
58343
- value: "No dispatch ledger record was found for this source signal."
58410
+ value: input.sourceSignalId ? "No dispatch ledger record was found for this source signal." : "No source signal was found for this client message."
58344
58411
  }
58345
58412
  ]
58346
58413
  });
@@ -58353,7 +58420,7 @@ function renderLookupAmbiguous(input) {
58353
58420
  });
58354
58421
  input.presenter.line({
58355
58422
  code: "service.trace.lookup.summary",
58356
- text: `source signal ${input.lookup.query.sourceSignalId}: ${input.lookup.matches.length} matching dispatches; specify --target-profile or --dispatch`,
58423
+ text: `${formatLookupSelectorLabel(input.lookup.query)}: ${input.lookup.matches.length} matching dispatches; specify --target-profile or --dispatch`,
58357
58424
  data: input.lookup
58358
58425
  });
58359
58426
  return;
@@ -58363,10 +58430,14 @@ function renderLookupAmbiguous(input) {
58363
58430
  label: "Space ID",
58364
58431
  value: input.lookup.query.spaceId
58365
58432
  },
58366
- {
58433
+ ...input.lookup.query.sourceSignalId ? [{
58367
58434
  label: "Source Signal",
58368
58435
  value: input.lookup.query.sourceSignalId
58369
- },
58436
+ }] : [],
58437
+ ...input.lookup.query.clientMessageId ? [{
58438
+ label: "Client Message",
58439
+ value: input.lookup.query.clientMessageId
58440
+ }] : [],
58370
58441
  {
58371
58442
  label: "Status",
58372
58443
  value: `${input.lookup.matches.length} matching dispatches`
@@ -58388,6 +58459,11 @@ function renderLookupAmbiguous(input) {
58388
58459
  rows
58389
58460
  });
58390
58461
  }
58462
+ function formatLookupSelectorLabel(input) {
58463
+ if (input.sourceSignalId) return `source signal ${input.sourceSignalId}`;
58464
+ if (input.clientMessageId) return `client message ${input.clientMessageId}`;
58465
+ return "lookup selector";
58466
+ }
58391
58467
  function buildHumanTraceRows(input) {
58392
58468
  if (!input.trace) return [
58393
58469
  {
@@ -58428,6 +58504,14 @@ function buildHumanTraceRows(input) {
58428
58504
  label: "Dispatch ID",
58429
58505
  value: input.trace.dispatch.dispatchId
58430
58506
  },
58507
+ ...input.lookup?.query.sourceSignalId ? [{
58508
+ label: "Source Signal",
58509
+ value: input.lookup.query.sourceSignalId
58510
+ }] : [],
58511
+ ...input.lookup?.query.clientMessageId ? [{
58512
+ label: "Client Message",
58513
+ value: input.lookup.query.clientMessageId
58514
+ }] : [],
58431
58515
  {
58432
58516
  label: "Target",
58433
58517
  value: input.targetProfile?.profileName ?? input.trace.dispatch.targetProfileId
@@ -58435,6 +58519,10 @@ function buildHumanTraceRows(input) {
58435
58519
  {
58436
58520
  label: "Dispatch",
58437
58521
  value: `${input.trace.dispatch.status} · attempts ${input.trace.dispatch.attemptCount}`
58522
+ },
58523
+ {
58524
+ label: "Root Cause",
58525
+ value: resolveTraceRootCause(input.trace)
58438
58526
  }
58439
58527
  ];
58440
58528
  if (input.currentAgentReplyReadiness) {
@@ -58662,7 +58750,15 @@ function buildAgentTraceSummary(input) {
58662
58750
  const previewEmitted = input.trace.streaming?.previewEmitted === true;
58663
58751
  const runtimeSummary = input.trace.runtime ? ` runtime=${formatRuntimeTraceSummary(input.trace.runtime)}` : "";
58664
58752
  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}`;
58753
+ 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}`;
58754
+ }
58755
+ function resolveTraceRootCause(trace) {
58756
+ if (trace.latestAttempt?.errorCode) return trace.latestAttempt.errorCode;
58757
+ if (trace.dispatch.status === "succeeded") return trace.replySignal ? "reply.delivered" : "reply.not_found";
58758
+ if (trace.execution?.leaseState === "stalled") return "daemon.execution_stalled";
58759
+ if (trace.runtime?.timeoutTriggeredAt) return "runtime.timeout";
58760
+ if (trace.latestAttempt?.status) return `attempt.${trace.latestAttempt.status}`;
58761
+ return `dispatch.${trace.dispatch.status}`;
58666
58762
  }
58667
58763
  function formatAttemptError(errorCode, errorMessage) {
58668
58764
  return errorMessage ? `${errorCode} (${errorMessage})` : errorCode;
@@ -87242,7 +87338,7 @@ registerDaemonControlTargetOptions({ command: serviceCmd.command("cancel").descr
87242
87338
  }
87243
87339
  });
87244
87340
  });
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) => {
87341
+ 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
87342
  const view = getGlobalViewOption();
87247
87343
  await runCommandWithEntryChecks({
87248
87344
  routeTokens: ["service", "trace"],
@@ -87252,14 +87348,16 @@ serviceCmd.command("trace").description("Read a Space delivery trace for debuggi
87252
87348
  run: async () => {
87253
87349
  const dispatchId = normalizeOptionalString(opts.dispatch);
87254
87350
  const sourceSignalId = normalizeOptionalString(opts.sourceSignal);
87351
+ const clientMessageId = normalizeOptionalString(opts.clientMessage);
87255
87352
  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");
87353
+ 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
87354
  await runServiceTrace({
87258
87355
  profile: opts.profile,
87259
87356
  baseUrl: opts.gatewayUrl,
87260
87357
  space: String(opts.space ?? ""),
87261
87358
  ...dispatchId ? { dispatchId } : {},
87262
87359
  ...sourceSignalId ? { sourceSignalId } : {},
87360
+ ...clientMessageId ? { clientMessageId } : {},
87263
87361
  ...targetProfileId ? { targetProfileId } : {},
87264
87362
  password: opts.password,
87265
87363
  view