agent-transport-system 0.7.2 → 0.7.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/ats.js CHANGED
@@ -1,8 +1,8 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- import { $ as formatLocalSetupActionDescription, $n as SPACE_PASSWORD_MIN_LENGTH, $t as resolveBuiltinProviderConversationCapability, A as claimExecutionDiagnosticsQuerySchema, An as upsertSpaceDeletionTombstoneResponseSchema, Ar as profileWorkspaceModeSchema, At as normalizeBuiltinControllerProviderId, B as currentDeviceTargetResponseSchema, Bn as CONVERSATION_CONTINUITY_WARNING_PURPOSE, Bt as postNormalMessageBodySchema, C as atsRequestContextSchema, Cn as startSessionWithTokenResponseSchema, Cr as daemonStreamFrameSchema, Ct as listProfileSpaceHistoryResponseSchema, D as canonicalizeBuiltinControllerRef, Dn as submitRuntimeRegistrationBodySchema, Dr as normalizeOptionalWorkingDirectory, Dt as localRuntimesQuerySchema, E as buildControllerRoutingKeyForKind, En as submitRuntimeCapabilityReportsResponseSchema, Er as normalizeMessageEnvelope, Et as listSpaceThreadsResponseSchema, F as createSpaceDiagnosticReportResponseSchema, Fn as AGENT_REPLYING_END_PURPOSE, Ft as observabilityWakeTraceSelectorSchema, G as dispatchBriefSchema, Gn as DISPATCH_ACTIVITY_RETRYING_PURPOSE, Gt as postSpaceThreadSignalResponseSchema, H as daemonRouteObservationResponseSchema, Hn as DAEMON_HUB_SCHEMA_VERSION, Ht as postSpaceMembersBodySchema, I as createSpaceResponseSchema, In as AGENT_REPLYING_PURPOSE, It as patchProfileSpaceHistoryStatusResponseSchema, J as entryBriefSchema, Jn as MAX_SIGNAL_REPLY_TO_PREVIEW_LENGTH, Jt as projectObservabilityWakeCorrelation, K as ensureAgentProfilePrimaryBindingBodySchema, Kn as LEGACY_RUNTIME_DISPATCH_POLICY, Kt as prepareSessionResponseSchema, L as createSpaceThreadBodySchema, Ln as AGENT_REPLY_PREVIEW_END_PURPOSE, Lr as runtimeCoordinatorExecutionTokenEnvelopeSchema, Lt as patchSpaceContractBodySchema, M as continuitySchema, Mn as writeCurrentDeviceObservedMetadataResponseSchema, Mr as resolveMessageEnvelopeTargetField, Mt as normalizeSpaceCursorPatch, N as createSpaceBodySchema, Nn as writeSetupTokenLocalRuntimeObservedMetadataBodySchema, Nr as resolveSingleSpaceMentionLabels, Nt as notifyAgentProfileRouteCatalogChangedBodySchema, O as canonicalizeControllerRefForKind, On as submitRuntimeRegistrationResponseSchema, Or as normalizeSpacePasswordText, Ot as localRuntimesResponseSchema, P as createSpaceDiagnosticReportBodySchema, Pn as writeSetupTokenLocalRuntimeObservedMetadataResponseSchema, Pr as resolveSpaceMentionLabels, Pt as notifyAgentProfileRouteCatalogChangedResponseSchema, Q as formatLocalComponentsSummaryLabel, Qn as SPACE_MENTION_REJECT_NOTICE_PURPOSE, Qt as removeSpaceMembersResponseSchema, R as createSpaceThreadResponseSchema, Rn as AGENT_REPLY_PREVIEW_PURPOSE, Rr as sanitizeSignalTextPreview, Rt as patchSpaceContractResponseSchema, S as atsProfileIdSchema, Sn as startSessionSpaceChoiceResponseSchema, Sr as daemonServiceContractSchema, St as leaveSpaceResponseSchema, T as atsdControlPlaneResponseSchema, Tn as submitRuntimeCapabilityReportsBodySchema, Tr as getSpaceMessageAddressingRelationSupportForTargetKind, Tt as listSpaceThreadSignalsResponseSchema, U as daemonRuntimeLeaseSchema, Un as DISPATCH_ACTIVITY_DISPATCHING_PURPOSE, Ut as postSpaceMembersResponseSchema, V as currentLocalRuntimeReplyReadinessResponseSchema, Vn as CURRENT_DAEMON_EXECUTION_CONTRACT_EPOCH, Vt as postNormalMessageResponseSchema, W as deleteSpaceResponseSchema, Wn as DISPATCH_ACTIVITY_FAILED_PURPOSE, Wt as postSpaceThreadSignalBodySchema, X as forgetCurrentComputerResponseSchema, Xn as SPACE_MEMBER_JOIN_NOTICE_PURPOSE, Xt as providerDispatchRuntimeContextSchema, Y as forgetComputerResponseSchema, Yn as MESSAGE_MENTION_TYPE_VALUES, Yt as projectSpaceDispatchTraceFinalVisibleOutcome, Z as formatLocalComponentsSummaryDescription, Zn as SPACE_MEMBER_REMOVE_NOTICE_PURPOSE, Zt as querySpaceDeletionTombstonesResponseSchema, _ as ATSD_CONTROL_PLANE_SCHEMA_VERSION, _n as startDeviceProjectionSchema, _r as daemonHubHeartbeatResponseSchema, _t as getSpaceWakeProgressResponseSchema, a as runWithHeldLock, an as setLocalRuntimeDisplayNameBodySchema, ar as atsdTaskResultPayloadSchema, at as getAgentExecutionReadinessResponseSchema, b as agentExecutionReadinessRouteParamsSchema, bn as startSessionResponseSchema, br as daemonHubRouteCatalogChangedFramePayloadSchema, bt as installedLocalComponentsSnapshotSchema, c as LEGACY_ATS_RUNTIME_SESSION_ENV_KEY, cn as spaceConversationBindingDeleteResponseSchema, cr as conversationExecutionStateSchema, ct as getPrepareReadinessResponseSchema, d as resolveRuntimeSession, dn as spaceConversationBindingUpsertResponseSchema, dr as daemonHubDeliveryExecutionIdentitySchema, dt as getSpaceConversationStatusResponseSchema, en as resolveSpaceDispatchTraceRootCause, er as SPACE_UPDATES_MAX_LIMIT, et as formatLocalSetupActionLabel, f as resolveRuntimeSessionId, fn as spaceCreatorSchema, fr as daemonHubDispatchLifecycleRequestSchema, ft as getSpaceDispatchLookupResponseSchema, g as resolveMappedPublicAgentFailureReason, gn as spaceViewerMembershipResponseSchema, gr as daemonHubHeartbeatRequestSchema, gt as getSpaceUpdatesResponseSchema, h as resolveBuiltinAgentControllerBrand, hn as spaceMetaSchema, hr as daemonHubDispatchRuntimeEvidenceRequestSchema, ht as getSpaceThreadResponseSchema, i as releaseLock, in as setCurrentDeviceTargetBodySchema, ir as atsdTaskResultOpenClawGatewayVisibilityStatusSchema, it as getAgentExecutionReadinessBatchResponseSchema, j as claimExecutionDiagnosticsResponseSchema, jn as writeCurrentDeviceObservedMetadataBodySchema, jr as resolveBuiltinUpstreamConversationRefKind, jt as normalizeListSignalsReadQuerySemantics, k as catchupResponseSchema, kn as upsertProfileSpaceHistoryResponseSchema, kr as parseOptionalClientMessageId, kt as normalizeBuiltinControllerAgentId, l as listRuntimeSessionStates, ln as spaceConversationBindingImportResponseSchema, lr as createDaemonRouteObservationSummary, lt as getSpaceContractResponseSchema, m as CODEX_UPGRADE_REQUIRED_REASON, mn as spaceMembersSnapshotSchema, mr as daemonHubDispatchPreviewRequestSchema, mt as getSpaceStatusResponseSchema, n as isAtsLockError, nn as resolveStartHandoffResponseSchema, nr as atsSpaceEgressActionSchema, nt as gatewayErrorEnvelopeSchema, o as tryCleanupStaleLock, on as signalEnvelopeSchema, or as buildUpstreamConversationRef, ot as getAgentProfilePrimaryBindingResponseSchema, p as writeRuntimeSessionState, pn as spaceDispatchTraceResponseSchema, pr as daemonHubDispatchPreviewEndRequestSchema, pt as getSpaceDispatchResultResponseSchema, q as ensureAgentProfilePrimaryBindingResponseSchema, qn as MAX_PROFILE_WORKING_DIRECTORY_LENGTH, qt as prepareSessionStreamServerFrameSchema, r as readLockMeta, rn as serverErrorFrameSchema, rr as atsdTaskResultEnvelopeWriteSchema, rt as getAgentExecutionReadinessBatchBodySchema, s as ATS_RUNTIME_SESSION_ENV_KEY, sn as spaceConversationBindingConflictResponseSchema, sr as collectCanonicalMentionTextFragments, st as getPrepareReadinessQuerySchema, t as acquireLock, tn as resolveStartHandoffBodySchema, tr as atsRuntimeProfileIdSchema, tt as gatewayErrorCodeSchema, u as readRuntimeSessionState, un as spaceConversationBindingResponseSchema, ur as daemonHubDeliverDispatchRequestSchema, ut as getSpaceConversationRemoteStatusResponseSchema, v as LOCAL_COMPONENTS_SCHEMA_VERSION, vn as startProfileReadinessSummarySchema, vr as daemonHubRegisterSessionRequestSchema, vt as getSpaceWakeTraceWaterfallResponseSchema, w as atsdControlPlaneRequestSchema, wn as structuredGuidePayloadFromInputSchema, wr as formatCanonicalMentionLiteral, wt as listSpaceThreadEventsResponseSchema, x as agentProfileBindingRouteParamsSchema, xn as startSessionSpaceChoiceBodySchema, xr as daemonHubSubmitTaskResultRequestSchema, xt as isExplicitBuiltinControllerRef, y as SPACE_DISPATCH_TRACE_PROMPT_PREVIEW_MAX_CHARS, yn as startSessionProgressSchema, yr as daemonHubRegisterSessionResponseSchema, yt as incomingServerMessageSchema, z as createStartSessionBodySchema, zn as ATSD_TASK_RESULT_SCHEMA_VERSION, zt as patchStartSessionBodySchema } from "./lock-BG0gWBdN.js";
3
+ import { $ as formatLocalSetupActionDescription, $n as SPACE_PASSWORD_MIN_LENGTH, $t as resolveBuiltinProviderConversationCapability, A as claimExecutionDiagnosticsQuerySchema, An as upsertSpaceDeletionTombstoneResponseSchema, Ar as profileWorkspaceModeSchema, At as normalizeBuiltinControllerProviderId, B as currentDeviceTargetResponseSchema, Bn as CONVERSATION_CONTINUITY_WARNING_PURPOSE, Bt as postNormalMessageBodySchema, C as atsRequestContextSchema, Cn as startSessionWithTokenResponseSchema, Cr as daemonStreamFrameSchema, Ct as listProfileSpaceHistoryResponseSchema, D as canonicalizeBuiltinControllerRef, Dn as submitRuntimeRegistrationBodySchema, Dr as normalizeOptionalWorkingDirectory, Dt as localRuntimesQuerySchema, E as buildControllerRoutingKeyForKind, En as submitRuntimeCapabilityReportsResponseSchema, Er as normalizeMessageEnvelope, Et as listSpaceThreadsResponseSchema, F as createSpaceDiagnosticReportResponseSchema, Fn as AGENT_REPLYING_END_PURPOSE, Ft as observabilityWakeTraceSelectorSchema, G as dispatchBriefSchema, Gn as DISPATCH_ACTIVITY_RETRYING_PURPOSE, Gt as postSpaceThreadSignalResponseSchema, H as daemonRouteObservationResponseSchema, Hn as DAEMON_HUB_SCHEMA_VERSION, Ht as postSpaceMembersBodySchema, I as createSpaceResponseSchema, In as AGENT_REPLYING_PURPOSE, It as patchProfileSpaceHistoryStatusResponseSchema, J as entryBriefSchema, Jn as MAX_SIGNAL_REPLY_TO_PREVIEW_LENGTH, Jt as projectObservabilityWakeCorrelation, K as ensureAgentProfilePrimaryBindingBodySchema, Kn as LEGACY_RUNTIME_DISPATCH_POLICY, Kt as prepareSessionResponseSchema, L as createSpaceThreadBodySchema, Ln as AGENT_REPLY_PREVIEW_END_PURPOSE, Lr as runtimeCoordinatorExecutionTokenEnvelopeSchema, Lt as patchSpaceContractBodySchema, M as continuitySchema, Mn as writeCurrentDeviceObservedMetadataResponseSchema, Mr as resolveMessageEnvelopeTargetField, Mt as normalizeSpaceCursorPatch, N as createSpaceBodySchema, Nn as writeSetupTokenLocalRuntimeObservedMetadataBodySchema, Nr as resolveSingleSpaceMentionLabels, Nt as notifyAgentProfileRouteCatalogChangedBodySchema, O as canonicalizeControllerRefForKind, On as submitRuntimeRegistrationResponseSchema, Or as normalizeSpacePasswordText, Ot as localRuntimesResponseSchema, P as createSpaceDiagnosticReportBodySchema, Pn as writeSetupTokenLocalRuntimeObservedMetadataResponseSchema, Pr as resolveSpaceMentionLabels, Pt as notifyAgentProfileRouteCatalogChangedResponseSchema, Q as formatLocalComponentsSummaryLabel, Qn as SPACE_MENTION_REJECT_NOTICE_PURPOSE, Qt as removeSpaceMembersResponseSchema, R as createSpaceThreadResponseSchema, Rn as AGENT_REPLY_PREVIEW_PURPOSE, Rr as sanitizeSignalTextPreview, Rt as patchSpaceContractResponseSchema, S as atsProfileIdSchema, Sn as startSessionSpaceChoiceResponseSchema, Sr as daemonServiceContractSchema, St as leaveSpaceResponseSchema, T as atsdControlPlaneResponseSchema, Tn as submitRuntimeCapabilityReportsBodySchema, Tr as getSpaceMessageAddressingRelationSupportForTargetKind, Tt as listSpaceThreadSignalsResponseSchema, U as daemonRuntimeLeaseSchema, Un as DISPATCH_ACTIVITY_DISPATCHING_PURPOSE, Ut as postSpaceMembersResponseSchema, V as currentLocalRuntimeReplyReadinessResponseSchema, Vn as CURRENT_DAEMON_EXECUTION_CONTRACT_EPOCH, Vt as postNormalMessageResponseSchema, W as deleteSpaceResponseSchema, Wn as DISPATCH_ACTIVITY_FAILED_PURPOSE, Wt as postSpaceThreadSignalBodySchema, X as forgetCurrentComputerResponseSchema, Xn as SPACE_MEMBER_JOIN_NOTICE_PURPOSE, Xt as providerDispatchRuntimeContextSchema, Y as forgetComputerResponseSchema, Yn as MESSAGE_MENTION_TYPE_VALUES, Yt as projectSpaceDispatchTraceFinalVisibleOutcome, Z as formatLocalComponentsSummaryDescription, Zn as SPACE_MEMBER_REMOVE_NOTICE_PURPOSE, Zt as querySpaceDeletionTombstonesResponseSchema, _ as ATSD_CONTROL_PLANE_SCHEMA_VERSION, _n as startDeviceProjectionSchema, _r as daemonHubHeartbeatResponseSchema, _t as getSpaceWakeProgressResponseSchema, a as runWithHeldLock, an as setLocalRuntimeDisplayNameBodySchema, ar as atsdTaskResultPayloadSchema, at as getAgentExecutionReadinessResponseSchema, b as agentExecutionReadinessRouteParamsSchema, bn as startSessionResponseSchema, br as daemonHubRouteCatalogChangedFramePayloadSchema, bt as installedLocalComponentsSnapshotSchema, c as LEGACY_ATS_RUNTIME_SESSION_ENV_KEY, cn as spaceConversationBindingDeleteResponseSchema, cr as conversationExecutionStateSchema, ct as getPrepareReadinessResponseSchema, d as resolveRuntimeSession, dn as spaceConversationBindingUpsertResponseSchema, dr as daemonHubDeliveryExecutionIdentitySchema, dt as getSpaceConversationStatusResponseSchema, en as resolveSpaceDispatchTraceRootCause, er as SPACE_UPDATES_MAX_LIMIT, et as formatLocalSetupActionLabel, f as resolveRuntimeSessionId, fn as spaceCreatorSchema, fr as daemonHubDispatchLifecycleRequestSchema, ft as getSpaceDispatchLookupResponseSchema, g as resolveMappedPublicAgentFailureReason, gn as spaceViewerMembershipResponseSchema, gr as daemonHubHeartbeatRequestSchema, gt as getSpaceUpdatesResponseSchema, h as resolveBuiltinAgentControllerBrand, hn as spaceMetaSchema, hr as daemonHubDispatchRuntimeEvidenceRequestSchema, ht as getSpaceThreadResponseSchema, i as releaseLock, in as setCurrentDeviceTargetBodySchema, ir as atsdTaskResultOpenClawGatewayVisibilityStatusSchema, it as getAgentExecutionReadinessBatchResponseSchema, j as claimExecutionDiagnosticsResponseSchema, jn as writeCurrentDeviceObservedMetadataBodySchema, jr as resolveBuiltinUpstreamConversationRefKind, jt as normalizeListSignalsReadQuerySemantics, k as catchupResponseSchema, kn as upsertProfileSpaceHistoryResponseSchema, kr as parseOptionalClientMessageId, kt as normalizeBuiltinControllerAgentId, l as listRuntimeSessionStates, ln as spaceConversationBindingImportResponseSchema, lr as createDaemonRouteObservationSummary, lt as getSpaceContractResponseSchema, m as CODEX_UPGRADE_REQUIRED_REASON, mn as spaceMembersSnapshotSchema, mr as daemonHubDispatchPreviewRequestSchema, mt as getSpaceStatusResponseSchema, n as isAtsLockError, nn as resolveStartHandoffResponseSchema, nr as atsSpaceEgressActionSchema, nt as gatewayErrorEnvelopeSchema, o as tryCleanupStaleLock, on as signalEnvelopeSchema, or as buildUpstreamConversationRef, ot as getAgentProfilePrimaryBindingResponseSchema, p as writeRuntimeSessionState, pn as spaceDispatchTraceResponseSchema, pr as daemonHubDispatchPreviewEndRequestSchema, pt as getSpaceDispatchResultResponseSchema, q as ensureAgentProfilePrimaryBindingResponseSchema, qn as MAX_PROFILE_WORKING_DIRECTORY_LENGTH, qt as prepareSessionStreamServerFrameSchema, r as readLockMeta, rn as serverErrorFrameSchema, rr as atsdTaskResultEnvelopeWriteSchema, rt as getAgentExecutionReadinessBatchBodySchema, s as ATS_RUNTIME_SESSION_ENV_KEY, sn as spaceConversationBindingConflictResponseSchema, sr as collectCanonicalMentionTextFragments, st as getPrepareReadinessQuerySchema, t as acquireLock, tn as resolveStartHandoffBodySchema, tr as atsRuntimeProfileIdSchema, tt as gatewayErrorCodeSchema, u as readRuntimeSessionState, un as spaceConversationBindingResponseSchema, ur as daemonHubDeliverDispatchRequestSchema, ut as getSpaceConversationRemoteStatusResponseSchema, v as LOCAL_COMPONENTS_SCHEMA_VERSION, vn as startProfileReadinessSummarySchema, vr as daemonHubRegisterSessionRequestSchema, vt as getSpaceWakeTraceWaterfallResponseSchema, w as atsdControlPlaneRequestSchema, wn as structuredGuidePayloadFromInputSchema, wr as formatCanonicalMentionLiteral, wt as listSpaceThreadEventsResponseSchema, x as agentProfileBindingRouteParamsSchema, xn as startSessionSpaceChoiceBodySchema, xr as daemonHubSubmitTaskResultRequestSchema, xt as isExplicitBuiltinControllerRef, y as SPACE_DISPATCH_TRACE_PROMPT_PREVIEW_MAX_CHARS, yn as startSessionProgressSchema, yr as daemonHubRegisterSessionResponseSchema, yt as incomingServerMessageSchema, z as createStartSessionBodySchema, zn as ATSD_TASK_RESULT_SCHEMA_VERSION, zt as patchStartSessionBodySchema } from "./lock-BeL3w4ma.js";
4
4
  import { A as runtimeDir, C as normalizeAtsProfileId, D as resolveAtsEnvPreset, E as resolveAtsCliEntryNameFromArgv, F as systemDir, N as skillsDir, O as resolveAtsRootDir, P as spacesDir, S as normalizeAccountKey, T as profileViewPath, a as accountProfileWorkspacePath, c as atsRootDir, d as deviceOpenClawProfileBootstrapPath, f as deviceOpenClawProfileDir, i as accountProfileViewPath, j as runtimeLogsDir, k as resolveDefaultAtsHomeDirname, 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-DFiopT5Y.js";
5
- import { A as toSpaceCursorUrl, B as toSpaceSignalsUrl, C as resolveDefaultGatewayBaseUrl, D as toDaemonRouteObservationUrl, E as toClaimExecutionDiagnosticsUrl, F as toSpaceMembersUrl, H as toSpaceWsUrl, I as toSpaceMetaUrl, L as toSpacePasswordUrl, M as toSpaceDispatchLookupUrl, N as toSpaceDispatchTraceUrl, O as toSpaceContractUrl, P as toSpaceLeaveUrl, R as toSpaceRemoveMembersUrl, S as resolveBaseUrlOrNull, T as normalizeBaseUrl, V as toSpaceUpdatesUrl, _ as updateConfiguredStartV1OnboardingState, a as getConfiguredDeviceRuntimeState, b as normalizeGatewayBaseUrlOrNull, c as getConfiguredStartV1OnboardingState, d as resolveRuntimeSkillsCustomTargetId, f as setConfiguredBaseUrl, g as updateConfiguredSkillsConfig, h as updateConfiguredOnboardingConfig, i as getConfiguredDaemonDispatchLimits, j as toSpaceDeleteUrl, k as toSpaceCreateUrl, l as getConfiguredViewCustomization, m as updateConfiguredDeviceRuntimeState, n as alignRuntimeConfigStorage, o as getConfiguredOnboardingDisclaimerAcceptedAt, p as setConfiguredSkillsConfig, r as createDefaultRuntimeAgentControllerSettings, s as getConfiguredSkillsConfig, t as DEFAULT_RUNTIME_AGENT_TRANSPORT_MODE, u as getRuntimeConfigReadHealth, w as resolveExplicitGatewayUrlOrThrow, x as resolveBaseUrl, y as normalizeGatewayBaseUrl, z as toSpaceResultUrl } from "./runtime-config-D3F15r0W.js";
5
+ import { A as toSpaceCursorUrl, B as toSpaceSignalsUrl, C as resolveDefaultGatewayBaseUrl, D as toDaemonRouteObservationUrl, E as toClaimExecutionDiagnosticsUrl, F as toSpaceMembersUrl, H as toSpaceWsUrl, I as toSpaceMetaUrl, L as toSpacePasswordUrl, M as toSpaceDispatchLookupUrl, N as toSpaceDispatchTraceUrl, O as toSpaceContractUrl, P as toSpaceLeaveUrl, R as toSpaceRemoveMembersUrl, S as resolveBaseUrlOrNull, T as normalizeBaseUrl, V as toSpaceUpdatesUrl, _ as updateConfiguredStartV1OnboardingState, a as getConfiguredDeviceRuntimeState, b as normalizeGatewayBaseUrlOrNull, c as getConfiguredStartV1OnboardingState, d as resolveRuntimeSkillsCustomTargetId, f as setConfiguredBaseUrl, g as updateConfiguredSkillsConfig, h as updateConfiguredOnboardingConfig, i as getConfiguredDaemonDispatchLimits, j as toSpaceDeleteUrl, k as toSpaceCreateUrl, l as getConfiguredViewCustomization, m as updateConfiguredDeviceRuntimeState, n as alignRuntimeConfigStorage, o as getConfiguredOnboardingDisclaimerAcceptedAt, p as setConfiguredSkillsConfig, r as createDefaultRuntimeAgentControllerSettings, s as getConfiguredSkillsConfig, t as DEFAULT_RUNTIME_AGENT_TRANSPORT_MODE, u as getRuntimeConfigReadHealth, w as resolveExplicitGatewayUrlOrThrow, x as resolveBaseUrl, y as normalizeGatewayBaseUrl, z as toSpaceResultUrl } from "./runtime-config-BmPPPJcT.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, renameSync, statSync, writeFileSync } from "node:fs";
@@ -27,12 +27,12 @@ import wrapAnsi from "wrap-ansi";
27
27
  import { Box, Container, Editor, Key, ProcessTerminal, TUI, Text, getEditorKeybindings, matchesKey } from "@mariozechner/pi-tui";
28
28
 
29
29
  //#region package.json
30
- var version = "0.7.2";
30
+ var version = "0.7.4";
31
31
  var package_default = {
32
32
  $schema: "https://www.schemastore.org/package.json",
33
33
  name: "agent-transport-system",
34
34
  version,
35
- atsReleaseDate: "2026-05-31",
35
+ atsReleaseDate: "2026-06-01",
36
36
  description: "Agent Transport System CLI - https://ats.sh",
37
37
  license: "MIT",
38
38
  type: "module",
@@ -4336,7 +4336,7 @@ async function setDaemonServiceRuntimeState(state, pathInput = {}) {
4336
4336
  await writeDaemonServiceRuntimeState(state, pathInput);
4337
4337
  }
4338
4338
  async function clearDaemonServiceRuntimeState(pathInput = {}) {
4339
- const { clearDaemonRuntimeLease } = await import("./daemon-runtime-lease-DYVTk_Z6.js");
4339
+ const { clearDaemonRuntimeLease } = await import("./daemon-runtime-lease-BWYGVA4a.js");
4340
4340
  await Promise.all([rm(daemonServiceRuntimeStatePath(pathInput), { force: true }), clearDaemonRuntimeLease(pathInput)]);
4341
4341
  }
4342
4342
  async function withDaemonServiceRunLock(callback, meta = {
@@ -21298,6 +21298,8 @@ function extractOutputFromCodexLine(line) {
21298
21298
  const item = record.item && typeof record.item === "object" && !Array.isArray(record.item) ? record.item : null;
21299
21299
  const response = record.response && typeof record.response === "object" && !Array.isArray(record.response) ? record.response : null;
21300
21300
  if (record.type === "item.completed" && item?.type === "agent_message") {
21301
+ const phase = normalizeOptionalText$23(item.phase ?? record.phase);
21302
+ if (phase && phase !== "final_answer") return null;
21301
21303
  const text = normalizeOptionalText$23(item.text);
21302
21304
  return text ? {
21303
21305
  previewable: false,
@@ -29078,6 +29080,110 @@ function normalizeOptionalText$7$1(value) {
29078
29080
  const normalized = String(value ?? "").trim();
29079
29081
  return normalized.length > 0 ? normalized : null;
29080
29082
  }
29083
+ const WORD_CHARACTER_PATTERN = /\w/u;
29084
+ const BARE_MENTION_BOUNDARY_PATTERN = /[\s.,!?;:,。!?;:\]})"'`]/u;
29085
+ const WHITESPACE_PATTERN$1 = /\s+/g;
29086
+ const MAX_BARE_MENTION_DIAGNOSTICS = 5;
29087
+ function listSpaceBareMentionDiagnostics(input) {
29088
+ if (!input.text.includes("@")) return [];
29089
+ const candidates = buildBareMentionCandidates(createSpaceTargetCatalog(input.snapshot).entries);
29090
+ if (candidates.length === 0) return [];
29091
+ const maxResults = Math.max(1, Math.min(input.maxResults ?? MAX_BARE_MENTION_DIAGNOSTICS, 20));
29092
+ const diagnostics = [];
29093
+ const seenStarts = /* @__PURE__ */ new Set();
29094
+ for (let cursor = 0; cursor < input.text.length; cursor += 1) {
29095
+ const atIndex = input.text.indexOf("@", cursor);
29096
+ if (atIndex < 0) break;
29097
+ cursor = atIndex;
29098
+ if (!isPotentialBareMentionStart(input.text, atIndex)) continue;
29099
+ const match = resolveBareMentionCandidateAt({
29100
+ atIndex,
29101
+ candidates,
29102
+ text: input.text
29103
+ });
29104
+ if (!match || seenStarts.has(atIndex)) continue;
29105
+ seenStarts.add(atIndex);
29106
+ diagnostics.push(toBareMentionDiagnostic(match));
29107
+ cursor = Math.max(cursor, match.end - 1);
29108
+ if (diagnostics.length >= maxResults) break;
29109
+ }
29110
+ return diagnostics;
29111
+ }
29112
+ function buildBareMentionCandidates(entries) {
29113
+ const candidatesByLabel = /* @__PURE__ */ new Map();
29114
+ for (const entry of entries) {
29115
+ const labels = new Set([
29116
+ entry.profileName,
29117
+ entry.primaryMentionLabel,
29118
+ ...entry.mentionAlias ? [entry.mentionAlias] : [],
29119
+ ...entry.exactMentionLabels
29120
+ ]);
29121
+ for (const label of labels) {
29122
+ const normalized = normalizeLabel(label);
29123
+ if (!normalized) continue;
29124
+ const key = normalized.toLowerCase();
29125
+ const existing = candidatesByLabel.get(key);
29126
+ if (existing === void 0) {
29127
+ candidatesByLabel.set(key, {
29128
+ entry,
29129
+ label: normalized
29130
+ });
29131
+ continue;
29132
+ }
29133
+ if (existing === null || existing.entry.profileId !== entry.profileId) candidatesByLabel.set(key, null);
29134
+ }
29135
+ }
29136
+ return [...candidatesByLabel.values()].filter((candidate) => candidate !== null).sort((left, right) => right.label.length - left.label.length);
29137
+ }
29138
+ function resolveBareMentionCandidateAt(input) {
29139
+ const tail = input.text.slice(input.atIndex + 1);
29140
+ const lowerTail = tail.toLowerCase();
29141
+ for (const candidate of input.candidates) {
29142
+ const lowerLabel = candidate.label.toLowerCase();
29143
+ if (!lowerTail.startsWith(lowerLabel)) continue;
29144
+ const afterLabel = tail.slice(candidate.label.length);
29145
+ if (isCanonicalMentionRelationSuffix(afterLabel)) continue;
29146
+ if (!isBareMentionBoundary(afterLabel[0] ?? "")) continue;
29147
+ const end = input.atIndex + 1 + candidate.label.length;
29148
+ return {
29149
+ candidate,
29150
+ end,
29151
+ mentionText: input.text.slice(input.atIndex, end),
29152
+ start: input.atIndex
29153
+ };
29154
+ }
29155
+ return null;
29156
+ }
29157
+ function toBareMentionDiagnostic(input) {
29158
+ const label = input.candidate.entry.primaryMentionLabel;
29159
+ const suggestedWakeText = input.candidate.entry.profileKind === "agent" && input.candidate.entry.allowedRelations.wake ? `@${label}(wake)` : null;
29160
+ return {
29161
+ end: input.end,
29162
+ mentionText: input.mentionText,
29163
+ profileId: input.candidate.entry.profileId,
29164
+ profileKind: input.candidate.entry.profileKind,
29165
+ profileName: input.candidate.entry.profileName,
29166
+ start: input.start,
29167
+ suggestedCcText: `@${label}(cc)`,
29168
+ suggestedReferenceText: `@${label}(reference)`,
29169
+ suggestedWakeText
29170
+ };
29171
+ }
29172
+ function isPotentialBareMentionStart(text, atIndex) {
29173
+ const previous = atIndex > 0 ? text[atIndex - 1] ?? "" : "";
29174
+ return !(previous === "\\" || WORD_CHARACTER_PATTERN.test(previous));
29175
+ }
29176
+ function isBareMentionBoundary(value) {
29177
+ if (!value) return true;
29178
+ return BARE_MENTION_BOUNDARY_PATTERN.test(value);
29179
+ }
29180
+ function isCanonicalMentionRelationSuffix(value) {
29181
+ return value.startsWith("(wake)") || value.startsWith("(reference)") || value.startsWith("(cc)");
29182
+ }
29183
+ function normalizeLabel(value) {
29184
+ const normalized = String(value ?? "").replaceAll(WHITESPACE_PATTERN$1, " ").trim();
29185
+ return normalized.length > 0 ? normalized : null;
29186
+ }
29081
29187
  const CANONICAL_MENTION_TYPES = new Set(MESSAGE_MENTION_TYPE_VALUES);
29082
29188
  const DUPLICATE_TARGET_ISSUE_PATTERN = /^(activationTargets|referenceTargets|ccTargets) must not contain duplicate profileId$/u;
29083
29189
  const DISTINCT_TARGET_ISSUE_PATTERN = /^(activationTargets|referenceTargets|ccTargets) must not reuse profileId from (activationTargets|referenceTargets|ccTargets)$/u;
@@ -37489,24 +37595,36 @@ function buildActionGuidanceLines(input) {
37489
37595
  const lines = [];
37490
37596
  if (publicationRequirement.allowsRawReplyWithoutAction) lines.push("- Default: share your raw reply to the Space.");
37491
37597
  else lines.push("- Keep private work, progress narration, tool logs, and drafts in your local agent context unless the user explicitly asked to publish them.");
37492
- lines.push(`- ${publicationRequirement.actionRequirementLine}`);
37493
- lines.push("- When ATS Space Action commands are available, run one command in the shell. Do not print fallback JSON as your final answer unless every Space Action command fails.");
37494
- lines.push(...buildSpaceActionCommandLines(input, publicationRequirement));
37598
+ lines.push(buildPrimaryFinalActionLine(input, publicationRequirement));
37599
+ lines.push(...buildConditionalSpaceActionCommandLines(input, publicationRequirement));
37495
37600
  lines.push(`- Need context? Run \`${buildSpaceHistoryCommand({
37496
37601
  cliEntry: input.cliEntry,
37497
37602
  spaceId: input.spaceId
37498
37603
  })}\`.`);
37499
37604
  if (input.threadContext) lines.push("- This dispatch belongs to a thread. Public replies should stay in that thread unless explicitly asked to reply in the main Space.");
37500
37605
  lines.push("- If the current message mentions multiple targets, handle only the part assigned to you unless it explicitly asks you to synthesize for the group.");
37501
- lines.push("- For a normal reply to this Wake, do not add target flags.", "- To hand off, reference, or CC someone else, use ATS Space Action target flags instead of only typing @names in prose.");
37606
+ lines.push("- Wake asks another Agent Profile to act. Reference and CC are context only. Bare @names in prose do not create executable work.", "- For a normal reply to this Wake, do not add target flags. Use target flags only when this Wake asks you to hand off, reference, or CC another profile.");
37502
37607
  lines.push(`- Need action details? Run \`${buildSpaceActionCommand(input, "help")}\`. Only if every Space Action command fails, use \`${buildPromptSpaceActionCommand(input)}\` for fallback JSON.`);
37503
37608
  return lines;
37504
37609
  }
37505
- function buildSpaceActionCommandLines(input, publicationRequirement) {
37610
+ function buildPrimaryFinalActionLine(input, publicationRequirement) {
37611
+ if (publicationRequirement.allowsRawReplyWithoutAction) return "- Final action for this Wake: write the public reply normally.";
37612
+ if (publicationRequirement.allowedActions.includes("post_message")) return `- Final action for this Wake: run \`${buildSpaceActionCommand(input, "reply \"message\"")}\`.`;
37613
+ if (publicationRequirement.allowedActions.includes("post_status")) return `- Final action for this Wake: run \`${buildSpaceActionCommand(input, "status done \"short completion update\"")}\`.`;
37614
+ if (publicationRequirement.allowedActions.includes("stay_silent")) return `- Final action for this Wake: run \`${buildSpaceActionCommand(input, "silent --reason \"reason\"")}\`.`;
37615
+ return `- Final action for this Wake: run \`${buildPromptSpaceActionCommand(input)}\` and use one trailing ats-space-action block.`;
37616
+ }
37617
+ function buildConditionalSpaceActionCommandLines(input, publicationRequirement) {
37506
37618
  const lines = [];
37507
- if (publicationRequirement.allowedActions.includes("post_message")) lines.push(` Reply: \`${buildSpaceActionCommand(input, "reply \"message\"")}\``, ` Handoff: \`${buildSpaceActionCommand(input, "wake \"@Agent Name\" \"summary and request\"")}\``, ` Reply + handoff: \`${buildSpaceActionCommand(input, "reply --wake \"@Agent Name\" \"message\"")}\``);
37508
- if (publicationRequirement.allowedActions.includes("post_status")) lines.push(` Status: \`${buildSpaceActionCommand(input, "status done \"short update\"")}\``);
37509
- if (publicationRequirement.allowedActions.includes("stay_silent")) lines.push(` Silent: \`${buildSpaceActionCommand(input, "silent --reason \"reason\"")}\``);
37619
+ if (publicationRequirement.allowedActions.includes("post_message")) lines.push("- Other action forms only when this Wake requires them:", ` Handoff: \`${buildSpaceActionCommand(input, "wake \"@Agent Name\" \"summary and request\"")}\``, ` Reply + handoff: \`${buildSpaceActionCommand(input, "reply --wake \"@Agent Name\" \"message\"")}\``);
37620
+ if (publicationRequirement.allowedActions.includes("post_status")) {
37621
+ if (lines.length === 0) lines.push("- Other action forms only when this Wake requires them:");
37622
+ lines.push(` Status: \`${buildSpaceActionCommand(input, "status done \"short update\"")}\``);
37623
+ }
37624
+ if (publicationRequirement.allowedActions.includes("stay_silent")) {
37625
+ if (lines.length === 0) lines.push("- Other action forms only when this Wake requires them:");
37626
+ lines.push(` Silent: \`${buildSpaceActionCommand(input, "silent --reason \"reason\"")}\``);
37627
+ }
37510
37628
  lines.push(` Targets: \`${buildSpaceActionCommand(input, "targets")}\``, ` Help: \`${buildSpaceActionCommand(input, "help")}\``);
37511
37629
  return lines;
37512
37630
  }
@@ -59346,8 +59464,8 @@ function emitProfileCreateAgentSetupHint(input) {
59346
59464
  ...input.setupResult.status === "skipped_no_enabled_controllers" && input.setupResult.reason ? { reason: input.setupResult.reason } : {},
59347
59465
  profileId: input.profile.atsProfileId,
59348
59466
  nextSteps: [
59349
- "For this existing profile, open ATS Web setup and choose a local agent.",
59350
- `After it is connected, run ${prepareCommand} to connect this computer for that profile.`,
59467
+ `For this existing profile, run ${formatAtsCliCommand(`ats setup --profile ${input.profile.atsProfileId} --local-agent <local-agent-id> --view agent`)} when you know which local agent it should use.`,
59468
+ `Or run ${prepareCommand} in an interactive Terminal and choose the local agent there.`,
59351
59469
  `For a new CLI-only Codex profile, run ${explicitControllerCreateCommand}.`
59352
59470
  ],
59353
59471
  cliOnlyCreateCommand: explicitControllerCreateCommand
@@ -59357,7 +59475,7 @@ function emitProfileCreateAgentSetupHint(input) {
59357
59475
  }
59358
59476
  input.presenter.line({
59359
59477
  code: "profile.create.agent_setup.skipped",
59360
- text: formatInlineAtsCliCommands(`${summary} For this existing profile, open ATS Web setup and choose a local agent. For a new CLI-only Codex profile, run \`${explicitControllerCreateCommand}\`.`)
59478
+ text: formatInlineAtsCliCommands(`${summary} For this existing profile, run \`ats setup --profile ${input.profile.atsProfileId} --local-agent <local-agent-id>\` when you know which local agent it should use, or run \`${prepareCommand}\` in an interactive Terminal. For a new CLI-only Codex profile, run \`${explicitControllerCreateCommand}\`.`)
59361
59479
  });
59362
59480
  }
59363
59481
  async function runProfileSet(input) {
@@ -60315,6 +60433,7 @@ function renderProfileSummaryCard(input) {
60315
60433
  }
60316
60434
  function buildAgentCreateNextSteps(profile) {
60317
60435
  if (profile.profileKind === "agent") return [
60436
+ formatAtsCliCommand(`ats setup --profile ${profile.atsProfileId} --local-agent <local-agent-id> --view agent`),
60318
60437
  formatAtsCliCommand(`ats setup --profile ${profile.atsProfileId} --view agent`),
60319
60438
  formatAtsCliCommand(`ats service status --profile ${profile.atsProfileId} --view agent`),
60320
60439
  formatAtsCliCommand(`ats profiles show ${profile.atsProfileId} --view agent`),
@@ -60343,13 +60462,14 @@ function buildProfileCreateWakeReadinessRows(input) {
60343
60462
  value: "Not verified by profile creation"
60344
60463
  }, {
60345
60464
  label: "Next",
60346
- value: `Run ${formatAtsCliCommand(`ats setup --profile ${input.profile.atsProfileId}`)} before expecting this Agent Profile to reply from a Space.`
60465
+ value: `Run ${formatAtsCliCommand(`ats setup --profile ${input.profile.atsProfileId} --local-agent <local-agent-id>`)} before expecting this Agent Profile to reply from a Space.`
60347
60466
  }];
60348
60467
  }
60349
60468
  function buildAgentUpdateNextSteps(profile) {
60350
60469
  return [
60351
60470
  formatAtsCliCommand(`ats profiles show ${profile.atsProfileId} --view agent`),
60352
60471
  formatAtsCliCommand(`ats profiles update ${profile.atsProfileId} --name <new-name> --view agent`),
60472
+ formatAtsCliCommand(`ats setup --profile ${profile.atsProfileId} --local-agent <local-agent-id> --view agent`),
60353
60473
  formatAtsCliCommand(`ats setup --profile ${profile.atsProfileId} --view agent`),
60354
60474
  formatAtsCliCommand(`ats profiles update ${profile.atsProfileId} --workspace-mode ats-managed --view agent`),
60355
60475
  formatAtsCliCommand(`ats profiles update ${profile.atsProfileId} --workspace-mode custom --workspace-path /absolute/path --view agent`),
@@ -60524,8 +60644,10 @@ const PROMPT_GUIDE_CATALOG = {
60524
60644
  summary: "Use this guide when an agent needs to reply, hand off, status, or stay silent inside an ATS Space Wake dispatch.",
60525
60645
  humanSteps: [
60526
60646
  "Use the exact `<DISPATCH_ACTION_CLI> space action ...` command printed in the current Wake dispatch prompt.",
60647
+ "Run the one final action named at the top of the current dispatch prompt before reading optional forms.",
60527
60648
  "Use `reply` for the normal final answer.",
60528
- "Use `wake` or `reply --wake` when handing off to another Agent Profile.",
60649
+ "Use `wake` or `reply --wake` only when handing off work to another Agent Profile.",
60650
+ "Use `--reference` or `--cc` when another profile should be mentioned for context but should not start work.",
60529
60651
  "Use `status` only for final-safe status outcomes, not ongoing progress.",
60530
60652
  "Use `ats-space-action` structured blocks only as a fallback when the CLI action command is unavailable."
60531
60653
  ],
@@ -60543,6 +60665,7 @@ const PROMPT_GUIDE_CATALOG = {
60543
60665
  "`<DISPATCH_ACTION_CLI>` is a placeholder in guides, not a literal command.",
60544
60666
  "Fallback JSON is last resort: only if every Space Action CLI command fails, run `ats prompt space-action --raw` and use one trailing `ats-space-action` block.",
60545
60667
  "Wake targets must be Agent Profiles available for Wake in the current Space.",
60668
+ "Bare @names in prose are not execution targets in the agent path; use target flags for Wake, Reference, or CC semantics.",
60546
60669
  "`working` is not accepted here because status actions are final visible outcomes in the current contract."
60547
60670
  ]
60548
60671
  }
@@ -61575,7 +61698,7 @@ async function runServiceTrace(input, deps = {}) {
61575
61698
  guidance: traceReadinessGuidance
61576
61699
  };
61577
61700
  if (runtime.resolvedView === "agent") {
61578
- presenter.data({
61701
+ if (input.details === true) presenter.data({
61579
61702
  code: "service.trace.result",
61580
61703
  payload
61581
61704
  });
@@ -61583,7 +61706,11 @@ async function runServiceTrace(input, deps = {}) {
61583
61706
  code: "service.trace.summary",
61584
61707
  text: formatAgentTraceCompactSummary(agentSummary),
61585
61708
  data: {
61586
- ...payload,
61709
+ correlation: payload.correlation,
61710
+ query: payload.query,
61711
+ selector: payload.selector,
61712
+ targetProfile: payload.targetProfile,
61713
+ agentSummary,
61587
61714
  diagnosticSummary: buildAgentTraceSummary({
61588
61715
  dispatchId: traceResponse.query.dispatchId,
61589
61716
  trace: traceResponse.trace
@@ -63901,6 +64028,7 @@ async function prepareLocalAgentReadiness(input) {
63901
64028
  }
63902
64029
  const result = await prepareSingleAgentProfile({
63903
64030
  profile,
64031
+ explicitLocalAgentId: input.explicitLocalAgentSelections?.get(profile.atsProfileId),
63904
64032
  interactive: input.interactive,
63905
64033
  view: input.view
63906
64034
  });
@@ -63920,9 +64048,18 @@ async function prepareSingleAgentProfile(input) {
63920
64048
  const profile = input.profile;
63921
64049
  let prepared = false;
63922
64050
  let snapshot = await resolveProfileReadinessSnapshot(profile);
63923
- if (needsControllerSetup({
64051
+ if (input.explicitLocalAgentId) {
64052
+ await bindAgentProfileToExplicitLocalAgent({
64053
+ localAgentId: input.explicitLocalAgentId,
64054
+ profile
64055
+ });
64056
+ prepared = true;
64057
+ snapshot = await resolveProfileReadinessSnapshot(profile);
64058
+ }
64059
+ const initialReasonCodes = collectPreparationReasonCodes(snapshot);
64060
+ if (!input.explicitLocalAgentId && needsControllerSetup({
63924
64061
  profile,
63925
- reasonCodes: collectPreparationReasonCodes(snapshot)
64062
+ reasonCodes: initialReasonCodes
63926
64063
  })) {
63927
64064
  if (!input.interactive) return {
63928
64065
  status: "unchanged",
@@ -63987,6 +64124,27 @@ async function prepareSingleAgentProfile(input) {
63987
64124
  profile
63988
64125
  };
63989
64126
  }
64127
+ async function bindAgentProfileToExplicitLocalAgent(input) {
64128
+ const capabilityRef = resolveCapabilityRefFromControllerTarget({
64129
+ controllerKind: "builtin",
64130
+ controllerRef: input.localAgentId
64131
+ });
64132
+ if (!capabilityRef) throw new Error(`Unknown local agent "${input.localAgentId}". Use a builtin local agent ID such as codex or claude-code.`);
64133
+ const runtimeReportSubmission = await submitRuntimeCapabilityReport({
64134
+ capabilityRef,
64135
+ diagnosticProfileId: input.profile.atsProfileId,
64136
+ localParticipationState: "ready",
64137
+ reasonCodes: ["runtime.capability_report.ready"]
64138
+ });
64139
+ await ensureAgentProfileRuntimeBinding({
64140
+ profile: input.profile,
64141
+ runtimeReportSubmission
64142
+ });
64143
+ await persistAgentTransportSelection({
64144
+ controllerRef: input.localAgentId,
64145
+ transportMode: "local-cli"
64146
+ });
64147
+ }
63990
64148
  async function prepareLocalAgentLaunchIfNeeded(input) {
63991
64149
  if (needsLocalAgentLaunchChoice(input.reasonCodes)) {
63992
64150
  const enableResult = await runAgentsEnable({
@@ -64289,8 +64447,10 @@ async function writeConnectedComputerEnrollmentToServiceContract(input) {
64289
64447
  const PREPARE_TOKEN_HEADER = "x-ats-prepare-token";
64290
64448
  const PREPARE_SESSION_MAX_RECONNECT_ATTEMPTS = 3;
64291
64449
  const PREPARE_SESSION_RECONNECT_DELAY_MS = 1e3;
64292
- const ROUTE_CATALOG_SYNC_MAX_ATTEMPTS$1 = 8;
64293
- const ROUTE_CATALOG_SYNC_RETRY_DELAY_MS$1 = 750;
64450
+ const REPORT_RUNTIME_CONNECTION_MAX_ATTEMPTS = 12;
64451
+ const REPORT_RUNTIME_CONNECTION_RETRY_DELAY_MS = 1e3;
64452
+ const ROUTE_CATALOG_SYNC_MAX_ATTEMPTS$1 = 12;
64453
+ const ROUTE_CATALOG_SYNC_RETRY_DELAY_MS$1 = 1e3;
64294
64454
  const TERMINAL_PREPARE_STEP_ORDER = [
64295
64455
  "prepare_selected_agents",
64296
64456
  "refresh_service",
@@ -64724,6 +64884,17 @@ async function enforcePrepareSessionTerminalAuth(input) {
64724
64884
  throw new Error(result.message);
64725
64885
  }
64726
64886
  async function connectSelectedLocalAgentsToAts(input) {
64887
+ let lastTransientError = null;
64888
+ for (let attempt = 1; attempt <= REPORT_RUNTIME_CONNECTION_MAX_ATTEMPTS; attempt++) try {
64889
+ return await connectSelectedLocalAgentsToAtsOnce(input);
64890
+ } catch (error) {
64891
+ if (!isTransientSelectedAgentConnectionError(error) || attempt >= REPORT_RUNTIME_CONNECTION_MAX_ATTEMPTS) throw error;
64892
+ lastTransientError = error;
64893
+ await sleep$2(REPORT_RUNTIME_CONNECTION_RETRY_DELAY_MS);
64894
+ }
64895
+ throw lastTransientError ?? /* @__PURE__ */ new Error("ATS could not connect local agents.");
64896
+ }
64897
+ async function connectSelectedLocalAgentsToAtsOnce(input) {
64727
64898
  const runtimeIdentity = await syncLocalSetupCurrentDeviceTargetFromServiceContract({ gatewayUrl: input.gatewayUrl });
64728
64899
  const readiness = await collectStartLocalReadiness({ auth: {
64729
64900
  status: "valid",
@@ -64736,10 +64907,12 @@ async function connectSelectedLocalAgentsToAts(input) {
64736
64907
  localAgentIds: input.localAgentIds
64737
64908
  }));
64738
64909
  if (input.syncRouteCatalog) await waitForConfirmedRouteCatalogSync$1({
64739
- confirmWakeAvailability: async () => await assertCurrentLocalRuntimeCanReceiveWake({
64740
- gatewayUrl: input.gatewayUrl,
64741
- runtimeIdentity
64742
- }),
64910
+ confirmWakeAvailability: async () => {
64911
+ await assertCurrentLocalRuntimeCanReceiveWake({
64912
+ gatewayUrl: input.gatewayUrl,
64913
+ runtimeIdentity
64914
+ });
64915
+ },
64743
64916
  reason: "prepare_selected_agents_connected"
64744
64917
  });
64745
64918
  return {
@@ -64747,6 +64920,10 @@ async function connectSelectedLocalAgentsToAts(input) {
64747
64920
  localReadinessSnapshot: buildPrepareLocalReadinessSnapshot(readiness)
64748
64921
  };
64749
64922
  }
64923
+ function isTransientSelectedAgentConnectionError(error) {
64924
+ const rawMessage = toErrorMessage$10(error).toLowerCase();
64925
+ return rawMessage.includes("service has not finished starting") || rawMessage.includes("ats service is not running") || rawMessage.includes("service.not_running") || rawMessage.includes("service_contract_unavailable") || rawMessage.includes("runtime.reporting.write_failed");
64926
+ }
64750
64927
  async function verifySelectedLocalAgentsConnectedToAts(input) {
64751
64928
  const runtimeIdentity = await readTerminalRuntimeIdentityFromServiceContract();
64752
64929
  const readiness = await collectStartLocalReadiness({ auth: {
@@ -64841,7 +65018,6 @@ function formatTerminalStepFailureMessage(input) {
64841
65018
  const detail = formatTerminalStepFailureDetail(input.rawMessage);
64842
65019
  return `ATS Service did not report a running local connection during setup. Copy a fresh setup command from ATS Web and run setup again to continue from this step. If it fails again, run \`${formatAtsCliCommand("ats service start --mode foreground")}\` to see live startup logs, then copy a fresh setup command from ATS Web and run setup again.${detail ? ` Detail: ${detail}` : ""}`;
64843
65020
  }
64844
- if (input.stepId === "report_runtime" && input.rawMessage.toLowerCase().includes("service")) return `ATS Service stopped before ATS could connect selected agents to ATS. Start ATS Service with \`${formatAtsCliCommand("ats service start")}\`, then copy a fresh setup command from ATS Web and run setup again.`;
64845
65021
  return input.rawMessage;
64846
65022
  }
64847
65023
  function formatTerminalStepFailureDetail(rawMessage) {
@@ -67403,9 +67579,11 @@ async function runSetupLocalAgentConnection(input) {
67403
67579
  };
67404
67580
  }
67405
67581
  const agentProfile = profile;
67582
+ const explicitLocalAgentId = resolveStandaloneProfileLocalAgentId(input);
67406
67583
  const result = await prepareLocalAgentReadiness({
67407
67584
  profiles: [agentProfile],
67408
67585
  interactive,
67586
+ ...explicitLocalAgentId ? { explicitLocalAgentSelections: new Map([[agentProfile.atsProfileId, explicitLocalAgentId]]) } : {},
67409
67587
  view: input.view
67410
67588
  });
67411
67589
  if (result.status === "cancelled") return {
@@ -67450,24 +67628,28 @@ function emitSetupLocalAgentConnectionHeader(input) {
67450
67628
  });
67451
67629
  }
67452
67630
  function assertValidSetupLocalAgentConnectionInput(input) {
67453
- const hasStartSession = typeof input.startSession === "string" && input.startSession.trim().length > 0;
67454
- const hasProfile = typeof input.profile === "string" && input.profile.trim().length > 0;
67455
- const hasHumanProfile = typeof input.humanProfile === "string" && input.humanProfile.trim().length > 0;
67456
- const hasLocalAgentPreparation = Array.isArray(input.agent) && input.agent.length > 0;
67457
- const localAgentMode = normalizeOptionalString$6(input.localAgents);
67458
- const hasPrepareSessionLocalAgentMode = localAgentMode !== null;
67459
- const hasPrepareSessionLocalAgentIds = Array.isArray(input.localAgent) && input.localAgent.length > 0;
67460
- if (hasStartSession && (hasProfile || hasHumanProfile || hasLocalAgentPreparation)) throw new Error("--start-session cannot be combined with --profile, --human-profile, or --agent.");
67461
- if (!hasStartSession && (hasPrepareSessionLocalAgentMode || hasPrepareSessionLocalAgentIds)) throw new Error("--local-agents and --local-agent require --start-session.");
67462
- if (hasPrepareSessionLocalAgentMode && hasPrepareSessionLocalAgentIds) throw new Error("use either --local-agents <all|none> or --local-agent <id...>, not both");
67463
- if (hasPrepareSessionLocalAgentMode && localAgentMode !== "all" && localAgentMode !== "none") throw new Error("--local-agents must be either all or none.");
67464
- if (hasHumanProfile && (hasProfile || hasLocalAgentPreparation)) throw new Error("--human-profile cannot be combined with --profile or --agent.");
67465
- if (hasProfile && hasLocalAgentPreparation) throw new Error("use either --profile <id> or --agent <id...>, not both");
67631
+ const facts = resolveSetupLocalAgentConnectionInputFacts(input);
67632
+ if (facts.hasStartSession && (facts.hasProfile || facts.hasHumanProfile || facts.hasLocalAgentPreparation)) throw new Error("--start-session cannot be combined with --profile, --human-profile, or --agent.");
67633
+ if (!facts.hasStartSession && facts.hasPrepareSessionLocalAgentMode) throw new Error("--local-agents requires --start-session.");
67634
+ assertValidLocalAgentSelectionInput({
67635
+ facts,
67636
+ localAgent: input.localAgent
67637
+ });
67638
+ if (facts.hasPrepareSessionLocalAgentMode && facts.localAgentMode !== "all" && facts.localAgentMode !== "none") throw new Error("--local-agents must be either all or none.");
67639
+ if (facts.hasHumanProfile && (facts.hasProfile || facts.hasLocalAgentPreparation)) throw new Error("--human-profile cannot be combined with --profile or --agent.");
67640
+ if (facts.hasProfile && facts.hasLocalAgentPreparation) throw new Error("use either --profile <id> or --agent <id...>, not both");
67641
+ }
67642
+ function resolveStandaloneProfileLocalAgentId(input) {
67643
+ if (!normalizeOptionalString$6(input.profile)) return null;
67644
+ return normalizeLocalAgentIds(input.localAgent)[0] ?? null;
67645
+ }
67646
+ function normalizeLocalAgentIds(localAgent) {
67647
+ return Array.from(new Set((localAgent ?? []).map((agentId) => normalizeOptionalString$6(agentId)).filter((agentId) => agentId !== null)));
67466
67648
  }
67467
67649
  function resolvePrepareSessionLocalAgentSelection(input) {
67468
67650
  const localAgentMode = normalizeOptionalString$6(input.localAgents);
67469
67651
  if (localAgentMode === "all" || localAgentMode === "none") return { mode: localAgentMode };
67470
- const localAgentIds = Array.from(new Set((input.localAgent ?? []).map((agentId) => agentId.trim()).filter((agentId) => agentId.length > 0)));
67652
+ const localAgentIds = normalizeLocalAgentIds(input.localAgent);
67471
67653
  if (localAgentIds.length > 0) return {
67472
67654
  localAgentIds,
67473
67655
  mode: "specific"
@@ -67499,6 +67681,25 @@ async function maybeLogInWithOneTimeToken$1(input) {
67499
67681
  agentOverviewHandled: true
67500
67682
  }) !== "completed") throw new Error("ATS sign-in was cancelled before local preparation ran.");
67501
67683
  }
67684
+ function resolveSetupLocalAgentConnectionInputFacts(input) {
67685
+ const localAgentMode = normalizeOptionalString$6(input.localAgents);
67686
+ return {
67687
+ hasHumanProfile: typeof input.humanProfile === "string" && input.humanProfile.trim().length > 0,
67688
+ hasLocalAgentIds: Array.isArray(input.localAgent) && input.localAgent.length > 0,
67689
+ hasLocalAgentPreparation: Array.isArray(input.agent) && input.agent.length > 0,
67690
+ hasPrepareSessionLocalAgentMode: localAgentMode !== null,
67691
+ hasProfile: typeof input.profile === "string" && input.profile.trim().length > 0,
67692
+ hasStartSession: typeof input.startSession === "string" && input.startSession.trim().length > 0,
67693
+ localAgentMode
67694
+ };
67695
+ }
67696
+ function assertValidLocalAgentSelectionInput(input) {
67697
+ const { facts } = input;
67698
+ if (!(facts.hasStartSession || facts.hasProfile) && facts.hasLocalAgentIds) throw new Error("--local-agent requires --start-session or --profile.");
67699
+ if (facts.hasPrepareSessionLocalAgentMode && facts.hasLocalAgentIds) throw new Error("use either --local-agents <all|none> or --local-agent <id...>, not both");
67700
+ if (!(facts.hasProfile && facts.hasLocalAgentIds)) return;
67701
+ if (normalizeLocalAgentIds(input.localAgent).length !== 1) throw new Error("--profile setup accepts exactly one --local-agent <id>.");
67702
+ }
67502
67703
  async function runSetupLocalAgentConnectionWebBootstrap(input) {
67503
67704
  if (input.resetThisComputer) await stopServiceForResetThisComputer({ view: input.view });
67504
67705
  const gatewayUrl = await resolveBaseUrl();
@@ -68207,25 +68408,26 @@ async function emitSetupCompleteForDelegatedPath(input) {
68207
68408
  });
68208
68409
  }
68209
68410
  async function resolveDelegatedSetupCompletionFacts(input) {
68210
- if (input.setupResult.completionFacts) {
68211
- const routeCatalogSync = input.setupResult.completionFacts.runtimeReports.length > 0 ? await waitForConfirmedRouteCatalogSync({
68411
+ const completionFacts = input.setupResult.completionFacts;
68412
+ if (completionFacts) {
68413
+ const routeCatalogSync = completionFacts.runtimeReports.length > 0 ? await waitForConfirmedRouteCatalogSync({
68212
68414
  confirmWakeAvailability: async () => await assertSetupCompletionCanReceiveWake({
68213
68415
  gatewayUrl: input.gatewayUrl,
68214
- runtimeIdentity: input.setupResult.completionFacts.runtimeIdentity,
68215
- selectedLocalAgentIds: input.setupResult.completionFacts.selectedLocalAgentIds
68416
+ runtimeIdentity: completionFacts.runtimeIdentity,
68417
+ selectedLocalAgentIds: completionFacts.selectedLocalAgentIds
68216
68418
  }),
68217
68419
  reason: "setup_profile_connection_path_connected"
68218
68420
  }) : null;
68219
68421
  await assertSetupCompletionCanReceiveWake({
68220
68422
  gatewayUrl: input.gatewayUrl,
68221
- runtimeIdentity: input.setupResult.completionFacts.runtimeIdentity,
68222
- selectedLocalAgentIds: input.setupResult.completionFacts.selectedLocalAgentIds
68423
+ runtimeIdentity: completionFacts.runtimeIdentity,
68424
+ selectedLocalAgentIds: completionFacts.selectedLocalAgentIds
68223
68425
  });
68224
68426
  return {
68225
68427
  routeCatalogSync,
68226
- runtimeIdentity: input.setupResult.completionFacts.runtimeIdentity,
68227
- runtimeReports: input.setupResult.completionFacts.runtimeReports,
68228
- selectedLocalAgentIds: input.setupResult.completionFacts.selectedLocalAgentIds
68428
+ runtimeIdentity: completionFacts.runtimeIdentity,
68429
+ runtimeReports: completionFacts.runtimeReports,
68430
+ selectedLocalAgentIds: completionFacts.selectedLocalAgentIds
68229
68431
  };
68230
68432
  }
68231
68433
  const sessionSelectedLocalAgentIds = input.setupResult.setupSessionSnapshot?.selectedLocalAgentIds ?? null;
@@ -84480,6 +84682,11 @@ async function runSend(input) {
84480
84682
  spaceApi,
84481
84683
  text: text.value
84482
84684
  });
84685
+ emitSendAddressingSummary({
84686
+ outboundMessageEnvelope,
84687
+ presenter,
84688
+ resolvedView: runtime.resolvedView
84689
+ });
84483
84690
  presenter.line({
84484
84691
  code: "send.acting_profile",
84485
84692
  text: `sender: ${profileIdentity.profileId} (${profileIdentity.kind})`,
@@ -84516,8 +84723,12 @@ async function runSend(input) {
84516
84723
  });
84517
84724
  }
84518
84725
  async function resolveOutboundSubmission(input) {
84726
+ let loadedMembersSnapshot = null;
84519
84727
  const preparedSubmission = await prepareCliSpaceComposerSubmission({
84520
84728
  missingSnapshotMessage: "Cannot validate mention labels right now because current space members could not be loaded.",
84729
+ onMembersSnapshotLoaded: (snapshot) => {
84730
+ loadedMembersSnapshot = snapshot;
84731
+ },
84521
84732
  onSnapshotLoadFailure: (error) => {
84522
84733
  rethrowCanonicalMentionSnapshotLoadFailure(error);
84523
84734
  },
@@ -84538,11 +84749,103 @@ async function resolveOutboundSubmission(input) {
84538
84749
  },
84539
84750
  text: input.text
84540
84751
  });
84752
+ const bareMentionDiagnostics = await resolveBareMentionDiagnostics({
84753
+ atsProfile: input.atsProfile,
84754
+ loadedMembersSnapshot,
84755
+ password: input.password,
84756
+ preparedSubmission: preparedSubmission.preparedSubmission,
84757
+ presenter: input.presenter,
84758
+ resolvedView: input.resolvedView,
84759
+ space: input.space,
84760
+ spaceApi: input.spaceApi,
84761
+ text: input.text
84762
+ });
84763
+ emitBareMentionDiagnostics({
84764
+ diagnostics: bareMentionDiagnostics,
84765
+ presenter: input.presenter,
84766
+ resolvedView: input.resolvedView
84767
+ });
84541
84768
  return {
84769
+ bareMentionDiagnostics,
84542
84770
  outboundMessageEnvelope: preparedSubmission.outboundMessageEnvelope,
84543
84771
  outboundText: preparedSubmission.outboundText
84544
84772
  };
84545
84773
  }
84774
+ async function resolveBareMentionDiagnostics(input) {
84775
+ if (!input.text.includes("@")) return [];
84776
+ const snapshot = input.loadedMembersSnapshot ?? await loadMembersSnapshotForBareMentionDiagnostics(input);
84777
+ if (!snapshot) return [];
84778
+ return listSpaceBareMentionDiagnostics({
84779
+ snapshot,
84780
+ text: input.preparedSubmission.text
84781
+ });
84782
+ }
84783
+ async function loadMembersSnapshotForBareMentionDiagnostics(input) {
84784
+ try {
84785
+ emitAgentSendProgress({
84786
+ presenter: input.presenter,
84787
+ resolvedView: input.resolvedView,
84788
+ stage: "load_members",
84789
+ summary: "Checking whether bare @mentions match Space members.",
84790
+ spaceId: input.space
84791
+ });
84792
+ const requestContext = buildAtsRequestContextFromProfile({ atsProfile: input.atsProfile });
84793
+ return await input.spaceApi.getMembersSnapshot({
84794
+ requestContext,
84795
+ spaceId: input.space,
84796
+ ...input.password === void 0 ? {} : { spacePassword: input.password }
84797
+ });
84798
+ } catch (error) {
84799
+ if (input.resolvedView === "agent") input.presenter.line({
84800
+ code: "space.send.bare_mention_check_unavailable",
84801
+ text: `bare @mention check unavailable: ${error instanceof Error ? error.message : String(error)}`
84802
+ });
84803
+ return null;
84804
+ }
84805
+ }
84806
+ function emitSendAddressingSummary(input) {
84807
+ if (input.resolvedView !== "agent") return;
84808
+ const envelope = input.outboundMessageEnvelope;
84809
+ const wakeCount = envelope?.activationTargets.length ?? 0;
84810
+ const referenceCount = envelope?.referenceTargets.length ?? 0;
84811
+ const ccCount = envelope?.ccTargets.length ?? 0;
84812
+ input.presenter.line({
84813
+ code: "space.send.addressing_summary",
84814
+ text: `Space Message Addressing: wake=${wakeCount}, reference=${referenceCount}, cc=${ccCount}.`,
84815
+ data: {
84816
+ ccTargetCount: ccCount,
84817
+ referenceTargetCount: referenceCount,
84818
+ wakeTargetCount: wakeCount
84819
+ }
84820
+ });
84821
+ }
84822
+ function emitBareMentionDiagnostics(input) {
84823
+ if (input.diagnostics.length === 0) return;
84824
+ const first = input.diagnostics[0];
84825
+ if (!first) return;
84826
+ const suggestion = first.suggestedWakeText ?? first.suggestedReferenceText;
84827
+ const text = `Bare mention ${first.mentionText} is plain text and does not create a Wake. Use ${suggestion} when you want ATS to address that profile.`;
84828
+ if (input.resolvedView === "agent") {
84829
+ input.presenter.line({
84830
+ code: "space.send.bare_mention_warning",
84831
+ text,
84832
+ data: { mentions: input.diagnostics.map((diagnostic) => ({
84833
+ mentionText: diagnostic.mentionText,
84834
+ profileId: diagnostic.profileId,
84835
+ profileKind: diagnostic.profileKind,
84836
+ profileName: diagnostic.profileName,
84837
+ suggestedCcText: diagnostic.suggestedCcText,
84838
+ suggestedReferenceText: diagnostic.suggestedReferenceText,
84839
+ suggestedWakeText: diagnostic.suggestedWakeText
84840
+ })) }
84841
+ });
84842
+ return;
84843
+ }
84844
+ input.presenter.line({
84845
+ code: "space.send.bare_mention_warning",
84846
+ text
84847
+ });
84848
+ }
84546
84849
  function emitAgentSendProgress(input) {
84547
84850
  if (input.resolvedView !== "agent") return;
84548
84851
  input.presenter.line({
@@ -85785,6 +86088,7 @@ async function runSpaceAddMembers(input) {
85785
86088
  password: input.password,
85786
86089
  explicitMembers: input.members,
85787
86090
  selectAll: input.all === true,
86091
+ details: input.details === true,
85788
86092
  allowPrompt: interactive,
85789
86093
  allowBackToCaller: input.allowBackToCaller === true,
85790
86094
  view: input.view
@@ -85960,15 +86264,18 @@ async function runSpaceAddMembersForTarget(input) {
85960
86264
  resolvedView: input.runtime.resolvedView,
85961
86265
  spaceId: input.target.space
85962
86266
  };
86267
+ const explicitMemberIds = normalizeRequestedMemberIds(input.explicitMembers);
86268
+ const progress = input.details || explicitMemberIds.length === 0 ? addMembersProgress : void 0;
85963
86269
  const candidates = await resolveSpaceMemberCandidatesForAdd({
85964
86270
  currentProfile: input.atsProfile,
85965
86271
  currentOwnerUserId: input.atsProfile.ownerUserId,
85966
86272
  space: input.target.space,
85967
86273
  baseUrl: targetBaseUrl,
85968
86274
  password: input.password,
85969
- progress: addMembersProgress
86275
+ explicitMemberIds,
86276
+ progress
85970
86277
  });
85971
- if (candidates.length === 0) {
86278
+ if (candidates.length === 0 && explicitMemberIds.length === 0) {
85972
86279
  input.presenter.line({
85973
86280
  code: "space.add_members.no_candidates",
85974
86281
  text: "No additional profiles are available to add.",
@@ -85998,10 +86305,7 @@ async function runSpaceAddMembersForTarget(input) {
85998
86305
  selectedProfileIds
85999
86306
  });
86000
86307
  if (selectedCandidates.length === 0) return { status: "completed" };
86001
- emitAgentSpaceAddMembersProgress({
86002
- presenter: input.presenter,
86003
- resolvedView: input.runtime.resolvedView,
86004
- spaceId: input.target.space,
86308
+ emitSpaceAddMembersProgressIfRequested(progress, {
86005
86309
  stage: "check_local_wake_readiness",
86006
86310
  phase: "start",
86007
86311
  summary: "Checking whether selected agent profiles can wake from this computer. Members can still be added if local Wake setup needs attention.",
@@ -86010,6 +86314,7 @@ async function runSpaceAddMembersForTarget(input) {
86010
86314
  const servicePreparationResult = await ensureSpaceMemberCandidatesLocalParticipationReady({
86011
86315
  atsProfile: input.atsProfile,
86012
86316
  candidates: selectedCandidates,
86317
+ progress,
86013
86318
  presenter: input.presenter,
86014
86319
  resolvedView: input.runtime.resolvedView,
86015
86320
  allowPrompt: input.allowPrompt,
@@ -86021,10 +86326,7 @@ async function runSpaceAddMembersForTarget(input) {
86021
86326
  authenticatedGatewayUrl
86022
86327
  } : { status: "cancelled" };
86023
86328
  const preparedCandidates = servicePreparationResult.candidates;
86024
- emitAgentSpaceAddMembersProgress({
86025
- presenter: input.presenter,
86026
- resolvedView: input.runtime.resolvedView,
86027
- spaceId: input.target.space,
86329
+ emitSpaceAddMembersProgressIfRequested(progress, {
86028
86330
  stage: "add_members",
86029
86331
  phase: "write_membership",
86030
86332
  summary: "Adding selected profiles to the Space.",
@@ -86038,10 +86340,7 @@ async function runSpaceAddMembersForTarget(input) {
86038
86340
  baseUrl: targetBaseUrl,
86039
86341
  password: input.password
86040
86342
  });
86041
- emitAgentSpaceAddMembersProgress({
86042
- presenter: input.presenter,
86043
- resolvedView: input.runtime.resolvedView,
86044
- spaceId: input.target.space,
86343
+ emitSpaceAddMembersProgressIfRequested(progress, {
86045
86344
  stage: "record_join_notices",
86046
86345
  phase: "write_join_notices",
86047
86346
  summary: "Recording visible join notices for newly added members.",
@@ -86076,6 +86375,13 @@ async function runSpaceAddMembersForTarget(input) {
86076
86375
  });
86077
86376
  return { status: "completed" };
86078
86377
  }
86378
+ function emitSpaceAddMembersProgressIfRequested(progress, input) {
86379
+ if (!progress) return;
86380
+ emitAgentSpaceAddMembersProgress({
86381
+ ...progress,
86382
+ ...input
86383
+ });
86384
+ }
86079
86385
  function emitAgentSpaceAddMembersProgress(input) {
86080
86386
  if (input.resolvedView !== "agent") return;
86081
86387
  const phaseContract = resolveSpaceAddMembersProgressPhase({
@@ -86238,21 +86544,15 @@ function resolveSelectedSpaceMemberCandidates(input) {
86238
86544
  return input.selectedProfileIds.map((profileId) => input.candidates.find((candidate) => candidate.profileId === profileId)).filter((candidate) => Boolean(candidate));
86239
86545
  }
86240
86546
  async function ensureSpaceMemberCandidatesLocalParticipationReady(input) {
86241
- let preparedCandidates = await refreshSpaceMemberCandidatesLocalReadiness(input.candidates, {
86242
- presenter: input.presenter,
86243
- resolvedView: input.resolvedView,
86244
- spaceId: input.spaceId
86245
- });
86547
+ let preparedCandidates = await refreshSpaceMemberCandidatesLocalReadiness(input.candidates, input.progress);
86246
86548
  const localDemand = input.resolvedView === "human" ? await resolveDaemonLocalServiceDemand({ ownerUserId: input.atsProfile.ownerUserId }).catch(() => null) : null;
86247
86549
  while (true) {
86248
86550
  const participationPlan = planActionParticipation({
86249
86551
  intent: "space_add_members",
86250
86552
  candidates: preparedCandidates.map(toActionParticipationCandidateFromSpaceMemberCandidate)
86251
86553
  });
86252
- emitAgentSpaceAddMembersProgress({
86253
- presenter: input.presenter,
86254
- resolvedView: input.resolvedView,
86255
- spaceId: input.spaceId,
86554
+ if (input.progress) emitAgentSpaceAddMembersProgress({
86555
+ ...input.progress,
86256
86556
  stage: "plan_local_wake_participation",
86257
86557
  phase: "plan",
86258
86558
  summary: buildSpaceAddMembersLocalWakePlanSummary(participationPlan),
@@ -86272,26 +86572,16 @@ async function ensureSpaceMemberCandidatesLocalParticipationReady(input) {
86272
86572
  });
86273
86573
  if (orchestratorResult.status === "cancelled") return { status: "cancelled" };
86274
86574
  if (orchestratorResult.status !== "recheck_required") break;
86275
- preparedCandidates = await refreshSpaceMemberCandidatesLocalReadiness(preparedCandidates, {
86276
- presenter: input.presenter,
86277
- resolvedView: input.resolvedView,
86278
- spaceId: input.spaceId
86279
- });
86575
+ preparedCandidates = await refreshSpaceMemberCandidatesLocalReadiness(preparedCandidates, input.progress);
86280
86576
  }
86281
- emitAgentSpaceAddMembersProgress({
86282
- presenter: input.presenter,
86283
- resolvedView: input.resolvedView,
86284
- spaceId: input.spaceId,
86577
+ if (input.progress) emitAgentSpaceAddMembersProgress({
86578
+ ...input.progress,
86285
86579
  stage: "confirm_local_wake_bindings",
86286
86580
  phase: "start",
86287
86581
  summary: "Confirming available local agent profiles have Wake bindings before adding them.",
86288
86582
  profileIds: preparedCandidates.map((candidate) => candidate.profileId)
86289
86583
  });
86290
- preparedCandidates = await ensureFormalBindingsForReadySpaceMemberCandidates(preparedCandidates, {
86291
- presenter: input.presenter,
86292
- resolvedView: input.resolvedView,
86293
- spaceId: input.spaceId
86294
- });
86584
+ preparedCandidates = await ensureFormalBindingsForReadySpaceMemberCandidates(preparedCandidates, input.progress);
86295
86585
  emitSpaceMemberJoinOnlyWarnings({
86296
86586
  candidates: preparedCandidates,
86297
86587
  presenter: input.presenter,
@@ -86317,7 +86607,7 @@ async function ensureFormalBindingsForReadySpaceMemberCandidates(candidates, pro
86317
86607
  continue;
86318
86608
  }
86319
86609
  const candidateAtsProfile = candidate.atsProfile;
86320
- emitAgentSpaceAddMembersProgress({
86610
+ if (progress) emitAgentSpaceAddMembersProgress({
86321
86611
  ...progress,
86322
86612
  stage: "confirm_local_wake_bindings",
86323
86613
  phase: "profile_binding_sync",
@@ -86325,7 +86615,7 @@ async function ensureFormalBindingsForReadySpaceMemberCandidates(candidates, pro
86325
86615
  profileId: candidate.profileId,
86326
86616
  profileIds: [candidate.profileId]
86327
86617
  });
86328
- const result = await runSpaceAddMembersProgressHeartbeat({
86618
+ const result = progress ? await runSpaceAddMembersProgressHeartbeat({
86329
86619
  ...progress,
86330
86620
  stage: "confirm_local_wake_bindings",
86331
86621
  phase: "profile_binding_sync_wait",
@@ -86333,9 +86623,9 @@ async function ensureFormalBindingsForReadySpaceMemberCandidates(candidates, pro
86333
86623
  profileId: candidate.profileId,
86334
86624
  profileIds: [candidate.profileId],
86335
86625
  operation: async () => await ensureFormalAgentBindingForReadyLocalProfile({ profile: candidateAtsProfile })
86336
- });
86626
+ }) : await ensureFormalAgentBindingForReadyLocalProfile({ profile: candidateAtsProfile });
86337
86627
  if (result.status === "ready") {
86338
- emitAgentSpaceAddMembersProgress({
86628
+ if (progress) emitAgentSpaceAddMembersProgress({
86339
86629
  ...progress,
86340
86630
  stage: "confirm_local_wake_bindings",
86341
86631
  phase: "profile_binding_confirmed",
@@ -86346,7 +86636,7 @@ async function ensureFormalBindingsForReadySpaceMemberCandidates(candidates, pro
86346
86636
  nextCandidates.push(candidate);
86347
86637
  continue;
86348
86638
  }
86349
- emitAgentSpaceAddMembersProgress({
86639
+ if (progress) emitAgentSpaceAddMembersProgress({
86350
86640
  ...progress,
86351
86641
  stage: "confirm_local_wake_bindings",
86352
86642
  phase: "profile_binding_not_confirmed",
@@ -87811,7 +88101,11 @@ async function resolveSpaceMemberCandidatesForAdd(input) {
87811
88101
  }) : await listAgentTargetStates().catch(() => []);
87812
88102
  const localTargetStateById = new Map(localTargetStates.map((state) => [state.agentId, state]));
87813
88103
  const ownerProfileNameByOwnerUserId = buildOwnerProfileNameByOwnerUserId(profiles);
87814
- const candidateProfiles = profiles.filter((profile) => profile.status === "active" && isSpaceMembershipProfileKind(profile.profileKind) && profile.atsProfileId !== input.currentProfile.atsProfileId).filter((profile) => typeof input.currentOwnerUserId !== "string" || input.currentOwnerUserId.trim().length === 0 || profile.ownerUserId === input.currentOwnerUserId);
88104
+ const candidateProfiles = profiles.filter((profile) => profile.status === "active" && isSpaceMembershipProfileKind(profile.profileKind) && profile.atsProfileId !== input.currentProfile.atsProfileId).filter((profile) => {
88105
+ const explicitMemberIds = input.explicitMemberIds ?? [];
88106
+ if (explicitMemberIds.length > 0 && !explicitMemberIds.includes(profile.atsProfileId)) return false;
88107
+ return typeof input.currentOwnerUserId !== "string" || input.currentOwnerUserId.trim().length === 0 || profile.ownerUserId === input.currentOwnerUserId;
88108
+ });
87815
88109
  if (candidateProfiles.length === 0) return [];
87816
88110
  if (input.progress) emitAgentSpaceAddMembersProgress({
87817
88111
  ...input.progress,
@@ -94359,12 +94653,14 @@ function runSpaceActionHelp() {
94359
94653
  outLine(formatSpaceActionHelpExample("Reply", "reply \"message\"", context));
94360
94654
  outLine(formatSpaceActionHelpExample("Handoff and wake another agent", "wake \"@Agent Name\" \"summary and request\"", context));
94361
94655
  outLine(formatSpaceActionHelpExample("Reply and also wake another agent", "reply --wake \"@Agent Name\" \"message\"", context));
94656
+ outLine(formatSpaceActionHelpExample("Reply and reference another profile", "reply --reference \"@Agent Name\" \"message\"", context));
94657
+ outLine(formatSpaceActionHelpExample("Reply and copy another profile", "reply --cc \"@Human or Agent Name\" \"message\"", context));
94362
94658
  outLine(formatSpaceActionHelpExample("Final status", "status done \"short completion update\"", context));
94363
94659
  outLine(formatSpaceActionHelpExample("Stay silent", "silent --reason \"No public reply is needed.\"", context));
94364
94660
  outLine(formatSpaceActionHelpExample("Current targets", "targets", context));
94365
94661
  outLine(formatSpaceActionHelpExample("Help", "help", context));
94366
94662
  outLine("");
94367
- outLine("These commands only record a dispatch-scoped action. ATS still publishes through RuntimeCoordinator and Agent Transport Space Action Delivery.");
94663
+ outLine("Run exactly one final action for the current Wake. ATS posts the accepted action to the Space.");
94368
94664
  if (!context) {
94369
94665
  outLine("");
94370
94666
  outLine(`No active dispatch context was found. ${DISPATCH_ACTION_CLI_PLACEHOLDER} is a placeholder for the exact Space Action command prefix printed in an ATS Space Wake dispatch prompt.`);
@@ -94383,7 +94679,7 @@ function formatSpaceActionHelpCommand(action, context) {
94383
94679
  return formatAtsCliCommand(`ats space action ${action}`);
94384
94680
  }
94385
94681
  function recordAction(input) {
94386
- outLine(`ATS Space Action recorded: ${writeDispatchSpaceActionRecord(input).action.type}. It will be delivered through the current dispatch finalization path.`);
94682
+ outLine(`Posted to Space: ATS accepted this final action (${writeDispatchSpaceActionRecord(input).action.type}) for the current Wake.`);
94387
94683
  }
94388
94684
  function resolveMessageEnvelopeTargetIds(input) {
94389
94685
  const targets = {
@@ -97246,7 +97542,7 @@ withStartOptions(program.command("start").description("Initial onboarding: set u
97246
97542
  program.command("setup").description("Set up this computer for ATS Space Wake.").option("--profile <id>", "Existing ATS agent profile ID to connect to this computer").option("--agent <id...>", "Builtin local agent ID to repair directly when you already know the target").option("--human-profile <id>", "ATS human profile ID from ATS Web for account setup").option("--ott <token>", "One-time token to sign in on this device before setup").option("--start-session <opaque-token>", "Continue an ATS Web Agent Interface setup handoff on this device").option("--local-agents <mode>", "Select local agents during setup: all or none").option("--local-agent <id...>", "Select specific local agent IDs during setup").option("--reset-this-computer", "Stop stale local ATS Service state before reconnecting this computer").addHelpText("after", buildCommandHelpExamples("Primary entry points", [
97247
97543
  "ats setup",
97248
97544
  "ats setup --start-session <opaque-token> --local-agents all",
97249
- "ats setup --profile <agent-profile-id>"
97545
+ "ats setup --profile <agent-profile-id> --local-agent <local-agent-id>"
97250
97546
  ])).action(async (opts) => {
97251
97547
  const view = getGlobalViewOption();
97252
97548
  await runCommandWithEntryChecks({
@@ -97838,7 +98134,7 @@ registerDaemonControlTargetOptions({ command: serviceCmd.command("cancel").descr
97838
98134
  }
97839
98135
  });
97840
98136
  });
97841
- 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) => {
98137
+ 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)").option("--details", "Print the full trace payload in agent view", false).action(async (opts) => {
97842
98138
  const view = getGlobalViewOption();
97843
98139
  await runCommandWithEntryChecks({
97844
98140
  routeTokens: ["service", "trace"],
@@ -97856,6 +98152,7 @@ serviceCmd.command("trace").description("Read a Space delivery trace for debuggi
97856
98152
  baseUrl: opts.gatewayUrl,
97857
98153
  space: String(opts.space ?? ""),
97858
98154
  ...dispatchId ? { dispatchId } : {},
98155
+ details: opts.details === true,
97859
98156
  ...sourceSignalId ? { sourceSignalId } : {},
97860
98157
  ...clientMessageId ? { clientMessageId } : {},
97861
98158
  ...targetProfileId ? { targetProfileId } : {},
@@ -98116,7 +98413,7 @@ withSpaceProfileOption(spaceCmd.command("join").description("Join a space and ch
98116
98413
  });
98117
98414
  });
98118
98415
  withSpaceProfileOption(registerSpaceMemberSelectionOptions({
98119
- command: spaceCmd.command("add-members").alias("add-agents").alias("add-profiles").description("Add your own profiles as members of a space.").argument("[space]", "Space ID (64-character hex)").option("--password <value>", "Space password for protected access"),
98416
+ command: spaceCmd.command("add-members").alias("add-agents").alias("add-profiles").description("Add your own profiles as members of a space.").argument("[space]", "Space ID (64-character hex)").option("--password <value>", "Space password for protected access").option("--details", "Print detailed add-members progress in agent view"),
98120
98417
  selectionCommand: "add-members"
98121
98418
  })).action(async (space, opts, command) => {
98122
98419
  const cliOptions = resolveSpaceCommandCliOptions(command, opts);
@@ -98139,6 +98436,7 @@ withSpaceProfileOption(registerSpaceMemberSelectionOptions({
98139
98436
  password: cliOptions.password,
98140
98437
  members,
98141
98438
  all: opts.all === true,
98439
+ details: opts.details === true,
98142
98440
  view,
98143
98441
  entryChecksHandled: true
98144
98442
  });