agent-transport-system 0.7.37 → 0.7.39

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 gatewayErrorCodeSchema, $n as conversationExecutionStateSchema, $t as signalEnvelopeSchema, A as createSpaceBodySchema, An as DAEMON_HUB_SCHEMA_VERSION, At as patchProfileSpaceHistoryStatusResponseSchema, B as daemonRouteObservationResponseSchema, Bn as SPACE_MENTION_REJECT_NOTICE_PURPOSE, Bt as prepareSessionResponseSchema, C as agentProfileBindingRouteParamsSchema, Cn as AGENT_REPLYING_END_PURPOSE, Cr as parseAgentControllerRef$1, Ct as localRuntimesQuerySchema, D as atsdControlPlaneResponseSchema, Dn as ATSD_TASK_RESULT_SCHEMA_VERSION, Dr as resolveMessageEnvelopeTargetField, Dt as notifyAgentProfileRouteCatalogChangedBodySchema, E as atsdControlPlaneRequestSchema, En as AGENT_REPLY_PREVIEW_PURPOSE, Er as resolveBuiltinAgentControllerConversationKind, Et as normalizeSpaceCursorPatch, F as createSpaceThreadResponseSchema, Fn as MAX_PROFILE_WORKING_DIRECTORY_LENGTH, Ft as postNormalMessageResponseSchema, G as ensureAgentProfilePrimaryBindingResponseSchema, Gn as atsdTaskResultEnvelopeWriteSchema, Gt as querySpaceDeletionTombstonesResponseSchema, H as deleteSpaceResponseSchema, Hn as SPACE_UPDATES_MAX_LIMIT, Ht as projectObservabilityWakeCorrelation, I as createStartSessionBodySchema, In as MAX_SIGNAL_REPLY_TO_PREVIEW_LENGTH, It as postSpaceMembersBodySchema, J as forgetCurrentComputerResponseSchema, Jn as buildAgentControllerConversationRef, Jt as resolveStartHandoffBodySchema, K as entryBriefSchema, Kn as atsdTaskResultOpenClawGatewayVisibilityStatusSchema, Kt as removeSpaceMembersResponseSchema, L as currentDeviceTargetResponseSchema, Ln as MESSAGE_MENTION_TYPE_VALUES, Lt as postSpaceMembersResponseSchema, M as createSpaceDiagnosticReportResponseSchema, Mn as DISPATCH_ACTIVITY_FAILED_PURPOSE, Mr as runtimeCoordinatorExecutionTokenEnvelopeSchema, Mt as patchSpaceContractResponseSchema, N as createSpaceResponseSchema, Nn as DISPATCH_ACTIVITY_RETRYING_PURPOSE, Nr as sanitizeSignalTextPreview, Nt as patchStartSessionBodySchema, O as catchupResponseSchema, On as CONVERSATION_CONTINUITY_WARNING_PURPOSE, Or as resolveSingleSpaceMentionLabels, Ot as notifyAgentProfileRouteCatalogChangedResponseSchema, P as createSpaceThreadBodySchema, Pn as LEGACY_RUNTIME_DISPATCH_POLICY, Pt as postNormalMessageBodySchema, Q as formatLocalSetupActionLabel, Qn as collectCanonicalMentionTextFragments, Qt as setLocalRuntimeDisplayNameBodySchema, R as currentLocalRuntimeReplyReadinessResponseSchema, Rn as SPACE_MEMBER_JOIN_NOTICE_PURPOSE, Rt as postSpaceThreadSignalBodySchema, S as agentExecutionReadinessRouteParamsSchema, Sn as writeSetupTokenLocalRuntimeObservedMetadataResponseSchema, Sr as normalizeSpacePasswordText, St as listSpaceThreadsResponseSchema, T as atsRequestContextSchema, Tn as AGENT_REPLY_PREVIEW_END_PURPOSE, Tr as profileWorkspaceModeSchema, Tt as normalizeListSignalsReadQuerySemantics, U as dispatchBriefSchema, Un as atsRuntimeProfileIdSchema, Ut as projectSpaceDispatchTraceFinalVisibleOutcome, V as daemonRuntimeLeaseSchema, Vn as SPACE_PASSWORD_MIN_LENGTH, Vt as prepareSessionStreamServerFrameSchema, W as ensureAgentProfilePrimaryBindingBodySchema, Wn as atsSpaceEgressActionSchema, Wt as providerDispatchRuntimeContextSchema, X as formatLocalComponentsSummaryLabel, Xn as canonicalizeAgentControllerRef, Xt as serverErrorFrameSchema, Y as formatLocalComponentsSummaryDescription, Yn as buildAgentControllerRoutingKey, Yt as resolveStartHandoffResponseSchema, Z as formatLocalSetupActionDescription, Zn as canonicalizeBuiltinAgentControllerRef, Zt as setCurrentDeviceTargetBodySchema, _ as ATSD_CONTROL_PLANE_SCHEMA_VERSION, _n as upsertProfileSpaceHistoryResponseSchema, _r as getSpaceMessageAddressingRelationSupportForTargetKind, _t as installedLocalComponentsSnapshotSchema, a as runWithHeldLock, an as startDeviceProjectionSchema, ar as daemonHubDispatchPreviewRequestSchema, at as getPrepareReadinessQuerySchema, b as LOCAL_COMPONENTS_SCHEMA_VERSION, bn as writeCurrentDeviceObservedMetadataResponseSchema, br as normalizeMessageEnvelope, bt as listSpaceThreadEventsResponseSchema, c as LEGACY_ATS_CLI_CONTEXT_ENV_KEY, cn as startSessionResponseSchema, cr as daemonHubHeartbeatResponseSchema, ct as getSpaceDispatchLookupResponseSchema, d as resolveCliContext, dn as startSessionWithTokenResponseSchema, dr as daemonHubRouteCatalogChangedFramePayloadSchema, dt as getSpaceStatusResponseSchema, en as spaceCreatorSchema, er as createDaemonRouteObservationSummary, et as gatewayErrorEnvelopeSchema, f as resolveCliContextId, fn as structuredGuidePayloadFromInputSchema, fr as daemonHubSubmitTaskResultRequestSchema, ft as getSpaceThreadResponseSchema, g as resolveMappedPublicAgentFailureReason, gn as submitRuntimeRegistrationResponseSchema, gr as formatCanonicalMentionLiteral, gt as incomingServerMessageSchema, h as resolveBuiltinAgentControllerBrand, hn as submitRuntimeRegistrationBodySchema, hr as daemonStreamFrameSchema, ht as getSpaceWakeTraceWaterfallResponseSchema, i as releaseLock, in as spaceViewerMembershipResponseSchema, ir as daemonHubDispatchPreviewEndRequestSchema, it as getAgentProfilePrimaryBindingResponseSchema, j as createSpaceDiagnosticReportBodySchema, jn as DISPATCH_ACTIVITY_DISPATCHING_PURPOSE, jt as patchSpaceContractBodySchema, k as continuitySchema, kn as CURRENT_DAEMON_EXECUTION_CONTRACT_EPOCH, kr as resolveSpaceMentionLabels, kt as observabilityWakeTraceSelectorSchema, l as listCliContextStates, ln as startSessionSpaceChoiceBodySchema, lr as daemonHubRegisterSessionRequestSchema, lt as getSpaceDispatchResultResponseSchema, m as CODEX_UPGRADE_REQUIRED_REASON, mn as submitRuntimeAgentControllerReportsResponseSchema, mr as daemonServiceLaneSchema, mt as getSpaceWakeProgressResponseSchema, n as isAtsLockError, nn as spaceMembersSnapshotSchema, nr as daemonHubDeliveryExecutionIdentitySchema, nt as getAgentExecutionReadinessBatchResponseSchema, o as tryCleanupStaleLock, on as startProfileReadinessSummarySchema, or as daemonHubDispatchRuntimeEvidenceRequestSchema, ot as getPrepareReadinessResponseSchema, p as writeCliContextState, pn as submitRuntimeAgentControllerReportsBodySchema, pr as daemonServiceContractSchema, pt as getSpaceUpdatesResponseSchema, q as forgetComputerResponseSchema, qn as atsdTaskResultPayloadSchema, qt as resolveSpaceDispatchTraceRootCause, r as readLockMeta, rn as spaceMetaSchema, rr as daemonHubDispatchLifecycleRequestSchema, rt as getAgentExecutionReadinessResponseSchema, s as ATS_CLI_CONTEXT_ENV_KEY, sn as startSessionProgressSchema, sr as daemonHubHeartbeatRequestSchema, st as getSpaceContractResponseSchema, t as acquireLock, tn as spaceDispatchTraceResponseSchema, tr as daemonHubDeliverDispatchRequestSchema, tt as getAgentExecutionReadinessBatchBodySchema, u as readCliContextState, un as startSessionSpaceChoiceResponseSchema, ur as daemonHubRegisterSessionResponseSchema, ut as getSpaceMessageDetailsResponseSchema, v as DAEMON_ROUTE_CATALOG_CACHE_SCHEMA_NAME, vn as upsertSpaceDeletionTombstoneResponseSchema, vr as normalizeBuiltinAgentControllerId, vt as leaveSpaceResponseSchema, w as atsProfileIdSchema, wn as AGENT_REPLYING_PURPOSE, wr as parseOptionalClientMessageId, wt as localRuntimesResponseSchema, x as SPACE_DISPATCH_TRACE_PROMPT_PREVIEW_MAX_CHARS, xn as writeSetupTokenLocalRuntimeObservedMetadataBodySchema, xr as normalizeOptionalWorkingDirectory, xt as listSpaceThreadSignalsResponseSchema, y as DAEMON_ROUTE_CATALOG_CACHE_SCHEMA_VERSION, yn as writeCurrentDeviceObservedMetadataBodySchema, yr as normalizeKnownBuiltinAgentControllerId, yt as listProfileSpaceHistoryResponseSchema, z as daemonRouteCatalogCacheSchema, zn as SPACE_MEMBER_REMOVE_NOTICE_PURPOSE, zt as postSpaceThreadSignalResponseSchema } from "./lock-DKrCsluT.js";
3
+ import { $ as gatewayErrorCodeSchema, $n as collectCanonicalMentionTextFragments, $t as signalEnvelopeSchema, A as createSpaceBodySchema, An as CURRENT_DAEMON_EXECUTION_CONTRACT_EPOCH, Ar as resolveSpaceMentionLabels, At as patchProfileSpaceHistoryStatusResponseSchema, B as daemonRouteObservationResponseSchema, Bn as SPACE_MEMBER_REMOVE_NOTICE_PURPOSE, Bt as prepareSessionResponseSchema, C as agentProfileBindingRouteParamsSchema, Cn as writeSetupTokenLocalRuntimeObservedMetadataResponseSchema, Cr as normalizeSpacePasswordText, Ct as localRuntimesQuerySchema, D as atsdControlPlaneResponseSchema, Dn as AGENT_REPLY_PREVIEW_PURPOSE, Dr as resolveBuiltinAgentControllerConversationKind, Dt as notifyAgentProfileRouteCatalogChangedBodySchema, E as atsdControlPlaneRequestSchema, En as AGENT_REPLY_PREVIEW_END_PURPOSE, Er as profileWorkspaceModeSchema, Et as normalizeSpaceCursorPatch, F as createSpaceThreadResponseSchema, Fn as LEGACY_RUNTIME_DISPATCH_POLICY, Ft as postNormalMessageResponseSchema, G as ensureAgentProfilePrimaryBindingResponseSchema, Gn as atsSpaceEgressActionSchema, Gt as querySpaceDeletionTombstonesResponseSchema, H as deleteSpaceResponseSchema, Hn as SPACE_PASSWORD_MIN_LENGTH, Ht as projectObservabilityWakeCorrelation, I as createStartSessionBodySchema, In as MAX_PROFILE_WORKING_DIRECTORY_LENGTH, It as postSpaceMembersBodySchema, J as forgetCurrentComputerResponseSchema, Jn as atsdTaskResultPayloadSchema, Jt as resolveStartHandoffBodySchema, K as entryBriefSchema, Kn as atsdTaskResultEnvelopeWriteSchema, Kt as removeSpaceMembersResponseSchema, L as currentDeviceTargetResponseSchema, Ln as MAX_SIGNAL_REPLY_TO_PREVIEW_LENGTH, Lt as postSpaceMembersResponseSchema, M as createSpaceDiagnosticReportResponseSchema, Mn as DISPATCH_ACTIVITY_DISPATCHING_PURPOSE, Mt as patchSpaceContractResponseSchema, N as createSpaceResponseSchema, Nn as DISPATCH_ACTIVITY_FAILED_PURPOSE, Nr as runtimeCoordinatorExecutionTokenEnvelopeSchema, Nt as patchStartSessionBodySchema, O as catchupResponseSchema, On as ATSD_TASK_RESULT_SCHEMA_VERSION, Or as resolveMessageEnvelopeTargetField, Ot as notifyAgentProfileRouteCatalogChangedResponseSchema, P as createSpaceThreadBodySchema, Pn as DISPATCH_ACTIVITY_RETRYING_PURPOSE, Pr as sanitizeSignalTextPreview, Pt as postNormalMessageBodySchema, Q as formatLocalSetupActionLabel, Qn as canonicalizeBuiltinAgentControllerRef, Qt as setLocalRuntimeDisplayNameBodySchema, R as currentLocalRuntimeReplyReadinessResponseSchema, Rn as MESSAGE_MENTION_TYPE_VALUES, Rt as postSpaceThreadSignalBodySchema, S as agentExecutionReadinessRouteParamsSchema, Sn as writeSetupTokenLocalRuntimeObservedMetadataBodySchema, Sr as normalizeOptionalWorkingDirectory, St as listSpaceThreadsResponseSchema, T as atsRequestContextSchema, Tn as AGENT_REPLYING_PURPOSE, Tr as parseOptionalClientMessageId, Tt as normalizeListSignalsReadQuerySemantics, U as dispatchBriefSchema, Un as SPACE_UPDATES_MAX_LIMIT, Ut as projectSpaceDispatchTraceFinalVisibleOutcome, V as daemonRuntimeLeaseSchema, Vn as SPACE_MENTION_REJECT_NOTICE_PURPOSE, Vt as prepareSessionStreamServerFrameSchema, W as ensureAgentProfilePrimaryBindingBodySchema, Wn as atsRuntimeProfileIdSchema, Wt as providerDispatchRuntimeContextSchema, X as formatLocalComponentsSummaryLabel, Xn as buildAgentControllerRoutingKey, Xt as serverErrorFrameSchema, Y as formatLocalComponentsSummaryDescription, Yn as buildAgentControllerConversationRef, Yt as resolveStartHandoffResponseSchema, Z as formatLocalSetupActionDescription, Zn as canonicalizeAgentControllerRef, Zt as setCurrentDeviceTargetBodySchema, _ as ATSD_CONTROL_PLANE_SCHEMA_VERSION, _n as submitRuntimeRegistrationResponseSchema, _r as formatCanonicalMentionLiteral, _t as installedLocalComponentsSnapshotSchema, a as runWithHeldLock, an as spaceViewerMembershipResponseSchema, ar as daemonHubDispatchPreviewEndRequestSchema, at as getPrepareReadinessQuerySchema, b as LOCAL_COMPONENTS_SCHEMA_VERSION, bn as writeCurrentDeviceObservedMetadataBodySchema, br as normalizeKnownBuiltinAgentControllerId, bt as listSpaceThreadEventsResponseSchema, c as LEGACY_ATS_CLI_CONTEXT_ENV_KEY, cn as startSessionProgressSchema, cr as daemonHubHeartbeatRequestSchema, ct as getSpaceDispatchLookupResponseSchema, d as resolveCliContext, dn as startSessionSpaceChoiceResponseSchema, dr as daemonHubRegisterSessionResponseSchema, dt as getSpaceStatusResponseSchema, en as spaceCreatorSchema, er as conversationExecutionStateSchema, et as gatewayErrorEnvelopeSchema, f as resolveCliContextId, fn as startSessionWithTokenResponseSchema, fr as daemonHubRouteCatalogChangedFramePayloadSchema, ft as getSpaceThreadResponseSchema, g as resolveMappedPublicAgentFailureReason, gn as submitRuntimeRegistrationBodySchema, gr as daemonStreamFrameSchema, gt as incomingServerMessageSchema, h as resolveBuiltinAgentControllerBrand, hn as submitRuntimeAgentControllerReportsResponseSchema, hr as daemonServiceLaneSchema, ht as getSpaceWakeTraceWaterfallResponseSchema, i as releaseLock, in as spaceMetaSchema, ir as daemonHubDispatchLifecycleRequestSchema, it as getAgentProfilePrimaryBindingResponseSchema, j as createSpaceDiagnosticReportBodySchema, jn as DAEMON_HUB_SCHEMA_VERSION, jt as patchSpaceContractBodySchema, k as continuitySchema, kn as CONVERSATION_CONTINUITY_WARNING_PURPOSE, kr as resolveSingleSpaceMentionLabels, kt as observabilityWakeTraceSelectorSchema, l as listCliContextStates, ln as startSessionResponseSchema, lr as daemonHubHeartbeatResponseSchema, lt as getSpaceDispatchResultResponseSchema, m as CODEX_UPGRADE_REQUIRED_REASON, mn as submitRuntimeAgentControllerReportsBodySchema, mr as daemonServiceContractSchema, mt as getSpaceWakeProgressResponseSchema, n as isAtsLockError, nn as spaceIdentityDirectorySchema, nr as daemonHubDeliverDispatchRequestSchema, nt as getAgentExecutionReadinessBatchResponseSchema, o as tryCleanupStaleLock, on as startDeviceProjectionSchema, or as daemonHubDispatchPreviewRequestSchema, ot as getPrepareReadinessResponseSchema, p as writeCliContextState, pn as structuredGuidePayloadFromInputSchema, pr as daemonHubSubmitTaskResultRequestSchema, pt as getSpaceUpdatesResponseSchema, q as forgetComputerResponseSchema, qn as atsdTaskResultOpenClawGatewayVisibilityStatusSchema, qt as resolveSpaceDispatchTraceRootCause, r as readLockMeta, rn as spaceMembersSnapshotSchema, rr as daemonHubDeliveryExecutionIdentitySchema, rt as getAgentExecutionReadinessResponseSchema, s as ATS_CLI_CONTEXT_ENV_KEY, sn as startProfileReadinessSummarySchema, sr as daemonHubDispatchRuntimeEvidenceRequestSchema, st as getSpaceContractResponseSchema, t as acquireLock, tn as spaceDispatchTraceResponseSchema, tr as createDaemonRouteObservationSummary, tt as getAgentExecutionReadinessBatchBodySchema, u as readCliContextState, un as startSessionSpaceChoiceBodySchema, ur as daemonHubRegisterSessionRequestSchema, ut as getSpaceMessageDetailsResponseSchema, v as DAEMON_ROUTE_CATALOG_CACHE_SCHEMA_NAME, vn as upsertProfileSpaceHistoryResponseSchema, vr as getSpaceMessageAddressingRelationSupportForTargetKind, vt as leaveSpaceResponseSchema, w as atsProfileIdSchema, wn as AGENT_REPLYING_END_PURPOSE, wr as parseAgentControllerRef$1, wt as localRuntimesResponseSchema, x as SPACE_DISPATCH_TRACE_PROMPT_PREVIEW_MAX_CHARS, xn as writeCurrentDeviceObservedMetadataResponseSchema, xr as normalizeMessageEnvelope, xt as listSpaceThreadSignalsResponseSchema, y as DAEMON_ROUTE_CATALOG_CACHE_SCHEMA_VERSION, yn as upsertSpaceDeletionTombstoneResponseSchema, yr as normalizeBuiltinAgentControllerId, yt as listProfileSpaceHistoryResponseSchema, z as daemonRouteCatalogCacheSchema, zn as SPACE_MEMBER_JOIN_NOTICE_PURPOSE, zt as postSpaceThreadSignalResponseSchema } from "./lock-DV2_jevB.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 toSpaceDeleteUrl, B as toSpaceUpdatesUrl, C as updateConfiguredSkillsConfig, D as toSpaceContractUrl, E as toDaemonRouteObservationUrl, F as toSpaceMetaUrl, I as toSpacePasswordUrl, L as toSpaceRemoveMembersUrl, M as toSpaceDispatchTraceUrl, N as toSpaceLeaveUrl, O as toSpaceCreateUrl, P as toSpaceMembersUrl, R as toSpaceResultUrl, S as updateConfiguredOnboardingConfig, T as normalizeBaseUrl, V as toSpaceWsUrl, _ as getRuntimeConfigReadHealth, a as resolveBaseUrlOrNull, b as setConfiguredSkillsConfig, c as DEFAULT_RUNTIME_AGENT_TRANSPORT_MODE, d as getConfiguredDaemonDispatchLimits, f as getConfiguredDeviceRuntimeState, g as getConfiguredViewCustomization, h as getConfiguredStartV1OnboardingState, i as resolveBaseUrl, j as toSpaceDispatchLookupUrl, k as toSpaceCursorUrl, l as alignRuntimeConfigStorage, m as getConfiguredSkillsConfig, n as normalizeGatewayBaseUrl, o as resolveDefaultGatewayBaseUrl, p as getConfiguredOnboardingDisclaimerAcceptedAt, r as normalizeGatewayBaseUrlOrNull, s as resolveExplicitGatewayUrlOrThrow, u as createDefaultRuntimeAgentControllerSettings, v as resolveRuntimeSkillsCustomTargetId, w as updateConfiguredStartV1OnboardingState, x as updateConfiguredDeviceRuntimeState, y as setConfiguredBaseUrl, z as toSpaceSignalsUrl } from "./base-url-QcrZsd29.js";
5
+ import { A as toSpaceDeleteUrl, B as toSpaceUpdatesUrl, C as updateConfiguredSkillsConfig, D as toSpaceContractUrl, E as toDaemonRouteObservationUrl, F as toSpaceMetaUrl, I as toSpacePasswordUrl, L as toSpaceRemoveMembersUrl, M as toSpaceDispatchTraceUrl, N as toSpaceLeaveUrl, O as toSpaceCreateUrl, P as toSpaceMembersUrl, R as toSpaceResultUrl, S as updateConfiguredOnboardingConfig, T as normalizeBaseUrl, V as toSpaceWsUrl, _ as getRuntimeConfigReadHealth, a as resolveBaseUrlOrNull, b as setConfiguredSkillsConfig, c as DEFAULT_RUNTIME_AGENT_TRANSPORT_MODE, d as getConfiguredDaemonDispatchLimits, f as getConfiguredDeviceRuntimeState, g as getConfiguredViewCustomization, h as getConfiguredStartV1OnboardingState, i as resolveBaseUrl, j as toSpaceDispatchLookupUrl, k as toSpaceCursorUrl, l as alignRuntimeConfigStorage, m as getConfiguredSkillsConfig, n as normalizeGatewayBaseUrl, o as resolveDefaultGatewayBaseUrl, p as getConfiguredOnboardingDisclaimerAcceptedAt, r as normalizeGatewayBaseUrlOrNull, s as resolveExplicitGatewayUrlOrThrow, u as createDefaultRuntimeAgentControllerSettings, v as resolveRuntimeSkillsCustomTargetId, w as updateConfiguredStartV1OnboardingState, x as updateConfiguredDeviceRuntimeState, y as setConfiguredBaseUrl, z as toSpaceSignalsUrl } from "./base-url-Gd_RGCHM.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,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.7.37";
30
+ var version = "0.7.39";
31
31
  var package_default = {
32
32
  $schema: "https://www.schemastore.org/package.json",
33
33
  name: "agent-transport-system",
@@ -58,7 +58,7 @@ var package_default = {
58
58
  "test": "vitest run --config vitest.config.ts",
59
59
  "test:integration": "node scripts/run-integration-tests.mjs",
60
60
  "test:full": "pnpm run test && pnpm run test:integration",
61
- "test:daemon": "vitest run --config vitest.integration.config.ts tests/daemon-state.integration.test.ts tests/daemon-command.integration.test.ts tests/daemon-menu.integration.test.ts tests/daemon-run.integration.test.ts tests/daemon-bootstrap-recommendation.integration.test.ts",
61
+ "test:local-service": "vitest run --config vitest.integration.config.ts tests/local-service-state.integration.test.ts tests/local-service-command.integration.test.ts tests/local-service-menu.integration.test.ts tests/local-service-run.integration.test.ts tests/local-service-bootstrap-recommendation.test.ts",
62
62
  "test:watch": "vitest"
63
63
  },
64
64
  dependencies: {
@@ -11784,6 +11784,12 @@ function isDaemonReconcileInProgressError(error) {
11784
11784
 
11785
11785
  //#endregion
11786
11786
  //#region ../../runtime/local-service/src/space-action-target-guidance.ts
11787
+ const SPACE_ACTION_CONTEXT_GUIDANCE_LINES = [
11788
+ "- Source alignment: Treat this Wake message as the current source. If you use other Space messages, private context, memory, or tools, keep each source mapped to the action and reply it supports.",
11789
+ "- Delivery intent: If the user asks you to deliver work to another Agent Profile, use Handoff or Reply + handoff. A plain reply or a bare @name does not deliver executable work.",
11790
+ "- Reply placement: Reply where the current request should continue. Thread Wakes default to the current thread; only move the reply when the user explicitly asks.",
11791
+ "- Context sources: ATS metadata is infrastructure context, not proof of what a human or agent is doing. Use Space context, private context, memory, and tools when appropriate; avoid exposing secrets, credentials, private files, or high-risk sensitive data unless the owner clearly authorizes it."
11792
+ ];
11787
11793
  const SPACE_ACTION_TARGET_GUIDANCE_LINES = [
11788
11794
  "Prefer ATS Space Action CLI target flags such as --wake, --reference, and --cc.",
11789
11795
  "For fallback ats-space-action blocks, target semantics only count when they are written in post_message.messageEnvelope.",
@@ -12001,7 +12007,7 @@ async function setDaemonServiceRuntimeState(state, pathInput = {}) {
12001
12007
  await writeDaemonServiceRuntimeState(state, pathInput);
12002
12008
  }
12003
12009
  async function clearDaemonServiceRuntimeState(pathInput = {}) {
12004
- const { clearDaemonRuntimeLease } = await import("./daemon-runtime-lease-CyZs1l93.js");
12010
+ const { clearDaemonRuntimeLease } = await import("./daemon-runtime-lease-BzvcJMMC.js");
12005
12011
  await Promise.all([rm(daemonServiceRuntimeStatePath(pathInput), { force: true }), clearDaemonRuntimeLease(pathInput)]);
12006
12012
  }
12007
12013
  async function withDaemonServiceRunLock(callback, meta = {
@@ -18667,22 +18673,22 @@ function resolveDaemonStopStrategy(snapshot) {
18667
18673
  if (snapshot.effectiveRuntimeStatus !== "running" && !hasOwnedProcesses && snapshot.serviceManagerStatus?.running !== true) return {
18668
18674
  kind: "not_running",
18669
18675
  requiresResidualProcessCleanup: false,
18670
- reason: "no active daemon owner is currently running"
18676
+ reason: "no active local service owner is currently running"
18671
18677
  };
18672
18678
  if (snapshot.activeOwnerKinds.includes("system_service")) return {
18673
18679
  kind: "manager_first",
18674
18680
  requiresResidualProcessCleanup: true,
18675
- reason: "a system-managed daemon owner is active on this device, so stop must go through the OS service manager first"
18681
+ reason: "a system-managed local service owner is active on this device, so stop must go through the OS service manager first"
18676
18682
  };
18677
18683
  if (snapshot.systemServiceRegistrationPresent) return {
18678
18684
  kind: "process_then_manager_cleanup",
18679
18685
  requiresResidualProcessCleanup: true,
18680
- reason: "a direct local daemon owner is active and system service registration is still present, so stop must drain the process and then clear the service manager registration"
18686
+ reason: "a direct local service owner is active and system service registration is still present, so stop must drain the process and then clear the service manager registration"
18681
18687
  };
18682
18688
  return {
18683
18689
  kind: "process_only",
18684
18690
  requiresResidualProcessCleanup: true,
18685
- reason: "only direct local daemon processes are active on this device"
18691
+ reason: "only direct local service processes are active on this device"
18686
18692
  };
18687
18693
  }
18688
18694
  function hasActiveDaemonOwners(snapshot) {
@@ -20617,6 +20623,9 @@ function buildSpaceStatusPath(spaceId) {
20617
20623
  function buildSpaceMembersPath(spaceId) {
20618
20624
  return buildSpaceRoutePath(spaceId, "members");
20619
20625
  }
20626
+ function buildSpaceIdentityDirectoryPath(spaceId) {
20627
+ return buildSpaceRoutePath(spaceId, "identity-directory");
20628
+ }
20620
20629
  function buildSpaceViewerMembershipPath(spaceId) {
20621
20630
  return buildSpaceRoutePath(spaceId, "viewer-membership");
20622
20631
  }
@@ -20744,6 +20753,16 @@ async function getSpaceMembersSnapshot(client, input) {
20744
20753
  invalidMessage: "invalid space members response"
20745
20754
  });
20746
20755
  }
20756
+ async function getSpaceIdentityDirectory(client, input) {
20757
+ return await client.requestJson({
20758
+ url: buildSpaceIdentityDirectoryPath(input.spaceId),
20759
+ operation: "space.identity_directory.read",
20760
+ requestContext: input.requestContext,
20761
+ ...input.spacePassword === void 0 ? {} : { spacePassword: input.spacePassword },
20762
+ schema: spaceIdentityDirectorySchema,
20763
+ invalidMessage: "invalid space identity directory response"
20764
+ });
20765
+ }
20747
20766
  async function getSpaceViewerMembership(client, input) {
20748
20767
  return await client.requestJson({
20749
20768
  url: buildSpaceViewerMembershipPath(input.spaceId),
@@ -21035,6 +21054,7 @@ const createSpaceApi = (client) => {
21035
21054
  leaveSpace: async (input) => await leaveSpace$1(client, input),
21036
21055
  getStatus: async (input) => await getSpaceStatus(client, input),
21037
21056
  getMembersSnapshot: async (input) => await getSpaceMembersSnapshot(client, input),
21057
+ getIdentityDirectory: async (input) => await getSpaceIdentityDirectory(client, input),
21038
21058
  getViewerMembership: async (input) => await getSpaceViewerMembership(client, input),
21039
21059
  listSignals: async (input) => await listSpaceSignals(client, input),
21040
21060
  listSignalEnvelopes: async (input) => await listSpaceSignalEnvelopes(client, input),
@@ -22981,7 +23001,7 @@ async function maybeAutoStopIdleLocalService(input) {
22981
23001
  if (finalOwnerSnapshot && hasActiveDaemonOwners(finalOwnerSnapshot)) {
22982
23002
  input.presenter.line({
22983
23003
  code: `${input.codePrefix}.auto_stop_failed`,
22984
- text: "ATS stopped the system service manager, but local daemon owners are still active on this device."
23004
+ text: "ATS stopped the system service manager, but local service owners are still active on this device."
22985
23005
  });
22986
23006
  return {
22987
23007
  autoStopped: false,
@@ -31841,10 +31861,16 @@ function listSpaceBareMentionDiagnostics(input) {
31841
31861
  const maxResults = Math.max(1, Math.min(input.maxResults ?? MAX_BARE_MENTION_DIAGNOSTICS, 20));
31842
31862
  const diagnostics = [];
31843
31863
  const seenStarts = /* @__PURE__ */ new Set();
31864
+ const ignoredRanges = normalizeIgnoredRanges(input.ignoredRanges ?? []);
31844
31865
  for (let cursor = 0; cursor < input.text.length; cursor += 1) {
31845
31866
  const atIndex = input.text.indexOf("@", cursor);
31846
31867
  if (atIndex < 0) break;
31847
31868
  cursor = atIndex;
31869
+ const ignoredRange = findIgnoredRangeContaining(ignoredRanges, atIndex);
31870
+ if (ignoredRange) {
31871
+ cursor = Math.max(cursor, ignoredRange.end - 1);
31872
+ continue;
31873
+ }
31848
31874
  if (!isPotentialBareMentionStart(input.text, atIndex)) continue;
31849
31875
  const match = resolveBareMentionCandidateAt({
31850
31876
  atIndex,
@@ -31859,6 +31885,19 @@ function listSpaceBareMentionDiagnostics(input) {
31859
31885
  }
31860
31886
  return diagnostics;
31861
31887
  }
31888
+ function normalizeIgnoredRanges(ranges) {
31889
+ return ranges.filter((range) => range.start >= 0 && range.end > range.start).map((range) => ({
31890
+ end: range.end,
31891
+ start: range.start
31892
+ })).sort((left, right) => left.start - right.start);
31893
+ }
31894
+ function findIgnoredRangeContaining(ranges, index) {
31895
+ for (const range of ranges) {
31896
+ if (index < range.start) return null;
31897
+ if (index >= range.start && index < range.end) return range;
31898
+ }
31899
+ return null;
31900
+ }
31862
31901
  function buildBareMentionCandidates(entries) {
31863
31902
  const candidatesByLabel = /* @__PURE__ */ new Map();
31864
31903
  for (const entry of entries) {
@@ -32531,17 +32570,25 @@ function buildPublicPresencePresentation(input) {
32531
32570
  function createSpaceMemberIdentityIndex(input) {
32532
32571
  const byProfileId = /* @__PURE__ */ new Map();
32533
32572
  for (const signal of input.signals ?? []) registerSignalIdentity(byProfileId, signal);
32534
- for (const member of [...input.snapshot?.humans ?? [], ...input.snapshot?.agents ?? []]) {
32535
- if (byProfileId.get(member.profileId)?.source === "member_snapshot") throw new Error(`Invariant violation: duplicate profile id "${member.profileId}" in space member identity index.`);
32536
- byProfileId.set(member.profileId, {
32537
- profileId: member.profileId,
32538
- profileKind: normalizeProfileKind$1(member.profileKind),
32539
- profileName: member.profileName,
32540
- source: "member_snapshot"
32541
- });
32542
- }
32573
+ for (const entry of input.identityDirectory?.entries ?? []) registerAuthoritativeIdentityEntry(byProfileId, {
32574
+ profileId: entry.profileId,
32575
+ profileKind: normalizeProfileKind$1(entry.profileKind),
32576
+ profileName: entry.profileName,
32577
+ source: "identity_directory"
32578
+ });
32579
+ for (const member of [...input.snapshot?.humans ?? [], ...input.snapshot?.agents ?? []]) registerAuthoritativeIdentityEntry(byProfileId, {
32580
+ profileId: member.profileId,
32581
+ profileKind: normalizeProfileKind$1(member.profileKind),
32582
+ profileName: member.profileName,
32583
+ source: "member_snapshot"
32584
+ });
32543
32585
  return { byProfileId };
32544
32586
  }
32587
+ function registerAuthoritativeIdentityEntry(byProfileId, input) {
32588
+ const existingEntry = byProfileId.get(input.profileId);
32589
+ if (existingEntry?.source === "identity_directory" || existingEntry?.source === "member_snapshot") throw new Error(`Invariant violation: duplicate profile id "${input.profileId}" in space member identity index.`);
32590
+ byProfileId.set(input.profileId, input);
32591
+ }
32545
32592
  function registerSignalIdentity(byProfileId, signal) {
32546
32593
  registerIdentityEntry(byProfileId, {
32547
32594
  profileId: normalizeOptionalText$4$1(signal.profile?.profileId),
@@ -32560,7 +32607,8 @@ function registerSignalIdentity(byProfileId, signal) {
32560
32607
  }
32561
32608
  function registerIdentityEntry(byProfileId, input) {
32562
32609
  if (!(input.profileId && input.profileName)) return;
32563
- if (byProfileId.get(input.profileId)?.source === "member_snapshot") return;
32610
+ const existingEntry = byProfileId.get(input.profileId);
32611
+ if (existingEntry?.source === "identity_directory" || existingEntry?.source === "member_snapshot") return;
32564
32612
  byProfileId.set(input.profileId, {
32565
32613
  profileId: input.profileId,
32566
32614
  profileKind: input.profileKind,
@@ -32579,7 +32627,7 @@ function buildSignalIndex(events) {
32579
32627
  return new Map(events.map((event) => [event.id, event]));
32580
32628
  }
32581
32629
  function buildSignalMessageReadProjection(input) {
32582
- const memberIdentityIndex = buildMemberIdentityIndex(input.membersSnapshot ?? null, input.signalIndex ?? null);
32630
+ const memberIdentityIndex = buildMemberIdentityIndex(input.identityDirectory ?? null, input.membersSnapshot ?? null, input.signalIndex ?? null);
32583
32631
  const envelope = readSignalMessageEnvelope(input.signal);
32584
32632
  const replyTo = readSignalReplyTo(input.signal);
32585
32633
  const replyToSignalId = normalizeOptionalText$3$1(envelope?.replyToSignalId ?? replyTo?.signalId);
@@ -32599,7 +32647,7 @@ function buildSignalMessageReadProjection(input) {
32599
32647
  };
32600
32648
  }
32601
32649
  function buildDispatchResultMessageReadProjection(input) {
32602
- const memberIdentityIndex = buildMemberIdentityIndex(input.membersSnapshot ?? null, input.signalIndex ?? null);
32650
+ const memberIdentityIndex = buildMemberIdentityIndex(input.identityDirectory ?? null, input.membersSnapshot ?? null, input.signalIndex ?? null);
32603
32651
  const envelope = input.result.messageEnvelope ?? null;
32604
32652
  const replyToSignalId = normalizeOptionalText$3$1(envelope?.replyToSignalId ?? input.result.replyToSignalId);
32605
32653
  return {
@@ -32744,10 +32792,11 @@ function resolveTargetByProfileId(profileId, memberIdentityIndex) {
32744
32792
  if (!memberIdentityIndex) return null;
32745
32793
  return memberIdentityIndex.byProfileId.get(profileId) ?? null;
32746
32794
  }
32747
- function buildMemberIdentityIndex(membersSnapshot, signalIndex) {
32748
- if (!(membersSnapshot || signalIndex)) return null;
32795
+ function buildMemberIdentityIndex(identityDirectory, membersSnapshot, signalIndex) {
32796
+ if (!(identityDirectory || membersSnapshot || signalIndex)) return null;
32749
32797
  return createSpaceMemberIdentityIndex({
32750
- snapshot: membersSnapshot,
32798
+ identityDirectory,
32799
+ snapshot: identityDirectory ? null : membersSnapshot,
32751
32800
  signals: signalIndex ? signalIndex.values() : null
32752
32801
  });
32753
32802
  }
@@ -32762,6 +32811,7 @@ function buildSpaceRoundReadProjection(input) {
32762
32811
  const sourceSignal = input.sourceSignal ?? input.signalIndex?.get(normalizeRequiredText$1(input.sourceSignalId)) ?? null;
32763
32812
  const sourceMessageReadProjection = sourceSignal ? buildSignalMessageReadProjection({
32764
32813
  signal: sourceSignal,
32814
+ identityDirectory: input.identityDirectory ?? null,
32765
32815
  membersSnapshot: input.membersSnapshot ?? null,
32766
32816
  signalIndex: input.signalIndex ?? null
32767
32817
  }) : null;
@@ -34892,7 +34942,7 @@ async function confirmLocalExecutionEvidenceAfterBinding(input) {
34892
34942
  const readiness = await waitForExecutionReadinessAfterBinding(input);
34893
34943
  if (!readiness) return {
34894
34944
  reasonCodes: ["agent_profile_binding.execution_readiness_pending"],
34895
- status: "accepted"
34945
+ status: "unavailable"
34896
34946
  };
34897
34947
  if (isAgentExecutionReadyOrConnecting(readiness.agentExecutionReadiness)) return {
34898
34948
  reasonCodes: readiness.agentExecutionReadiness.reasonCodes,
@@ -38506,7 +38556,7 @@ function buildActionGuidanceLines(input) {
38506
38556
  spaceId: input.spaceId
38507
38557
  })}\`.`);
38508
38558
  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.");
38509
- lines.push("- Source alignment: Treat this Wake message as the current source. If you use other Space messages, private context, memory, or tools, keep each source mapped to the action and reply it supports.", "- Delivery intent: If the user asks you to deliver work to another Agent Profile, use Handoff or Reply + handoff. A plain reply or a bare @name does not deliver executable work.", "- Reply placement: Reply where the current request should continue. Thread Wakes default to the current thread; only move the reply when the user explicitly asks.", "- Context sources: ATS metadata is infrastructure context, not proof of what a human or agent is doing. Use Space context, private context, memory, and tools when appropriate; avoid exposing secrets, credentials, private files, or high-risk sensitive data unless the owner clearly authorizes it.");
38559
+ lines.push(...SPACE_ACTION_CONTEXT_GUIDANCE_LINES);
38510
38560
  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.");
38511
38561
  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.");
38512
38562
  lines.push(`- Need action details? Run \`${buildSpaceActionCommand(input, "help")}\`. Only if every Space Action command fails, use \`${buildPromptSpaceActionCommand(input)}\` for fallback JSON.`);
@@ -42342,8 +42392,7 @@ function buildStructuredActionRepairPrompt(input) {
42342
42392
  ] : [],
42343
42393
  "This is a bounded repair of the public delivery action only. Do not redo the user's work.",
42344
42394
  "Do not change the user's intent.",
42345
- "Preserve source alignment: keep the corrected action tied to the same current Wake and reply target.",
42346
- "If the user's intent was to make another Agent Profile act, use Wake or Reply + handoff target semantics. A plain reply or bare @name is not executable delivery.",
42395
+ ...SPACE_ACTION_CONTEXT_GUIDANCE_LINES,
42347
42396
  "ATS only consumes your final answer and at most one valid trailing ```ats-space-action``` JSON block.",
42348
42397
  "If an ATS Space Action CLI command is available, run that command instead of printing fallback JSON.",
42349
42398
  publicationRequirement.repairRequirementLine,
@@ -44286,7 +44335,7 @@ async function runDaemonSocketSession(input) {
44286
44335
  leasesByProfileId,
44287
44336
  loadCatalog: async () => await loadDaemonRouteCatalog({
44288
44337
  localAdapterContainer: input.localAdapterContainer,
44289
- localReplyStateMode: "check",
44338
+ localReplyStateMode: "repair",
44290
44339
  ownerUserId: input.ownerUserId,
44291
44340
  presenter: input.presenter,
44292
44341
  allowEmpty: true,
@@ -44786,7 +44835,7 @@ const runDaemonServiceLoop = async (input) => {
44786
44835
  emitRunLine({
44787
44836
  presenter: input.presenter,
44788
44837
  code: "daemon.run.start",
44789
- text: `starting daemon service loop (gateway=${baseUrl}, owner=${ownerUserId}, profiles=${routeCatalogState.profileIds.length})`,
44838
+ text: `starting local service loop (gateway=${baseUrl}, owner=${ownerUserId}, profiles=${routeCatalogState.profileIds.length})`,
44790
44839
  payload: {
44791
44840
  adapterId: null,
44792
44841
  baseUrl,
@@ -44926,7 +44975,7 @@ const runDaemonServiceLoop = async (input) => {
44926
44975
  emitRunLine({
44927
44976
  presenter: input.presenter,
44928
44977
  code: "daemon.run.stopped",
44929
- text: "daemon service loop stopped"
44978
+ text: "local service loop stopped"
44930
44979
  });
44931
44980
  };
44932
44981
  async function loadInitialDaemonRouteCatalog(input) {
@@ -45349,7 +45398,7 @@ function toErrorMessage$13(error) {
45349
45398
  //#endregion
45350
45399
  //#region src/local-service/lifecycle/daemon-start-failure-log.ts
45351
45400
  const LOG_NOISE_PATTERNS = [
45352
- /^starting daemon service loop/i,
45401
+ /^starting local service loop/i,
45353
45402
  /^daemon stream connected/i,
45354
45403
  /^registered daemon session/i,
45355
45404
  /^catalog sync/i,
@@ -48566,7 +48615,7 @@ async function stopRegisteredDaemonServiceManager(input) {
48566
48615
  if (hasDifferentActiveDaemonOwnerAfterSystemStop(input.ownerSnapshot, finalOwnerSnapshot)) return buildDaemonStopWarningResult({
48567
48616
  reason: "stop_failed",
48568
48617
  runtimeStatus: finalOwnerSnapshot.runtimeStatus,
48569
- errorMessage: "daemon owners are still active after stopping the system service"
48618
+ errorMessage: "local service owners are still active after stopping the system service"
48570
48619
  });
48571
48620
  return buildDaemonStopWarningResult({
48572
48621
  reason: "system_timeout",
@@ -48592,7 +48641,7 @@ async function stopRegisteredDaemonServiceManager(input) {
48592
48641
  if (hasActiveDaemonOwners(finalOwnerSnapshot) || finalOwnerSnapshot.serviceManagerStatus?.enabled === true) return buildDaemonStopWarningResult({
48593
48642
  reason: "stop_failed",
48594
48643
  runtimeStatus: finalOwnerSnapshot.runtimeStatus,
48595
- errorMessage: "daemon owners are still active after stopping the system service"
48644
+ errorMessage: "local service owners are still active after stopping the system service"
48596
48645
  });
48597
48646
  return null;
48598
48647
  }
@@ -51199,7 +51248,7 @@ function resolveDaemonServiceParticipationCodePrefix(intent) {
51199
51248
  case "space_create_join": return "space.create_join.service";
51200
51249
  case "space_join": return "space.join.service";
51201
51250
  case "space_add_members": return "space.add_members.service";
51202
- default: throw new Error(`Unknown daemon service participation intent: ${intent}`);
51251
+ default: throw new Error(`Unknown local service participation intent: ${intent}`);
51203
51252
  }
51204
51253
  }
51205
51254
  function shouldStartAfterDaemonInstall(_intent) {
@@ -59978,7 +60027,7 @@ const SUMMARY_BY_COMMAND = {
59978
60027
  publication_set: "Use `ats space publication set --view agent` with an explicit Space ID, mode, owner profile, and Space password to change how agent output becomes visible.",
59979
60028
  status: "Use `ats space status --view agent` with an explicit space ID to read the current space status deterministically.",
59980
60029
  updates: "Use `ats space updates --view agent` with an explicit anchor signal to read formal post-anchor updates deterministically as signal envelopes plus `messageReadProjection`.",
59981
- result: "Use `ats space result --view agent` with exactly one selector to read a space-scoped dispatch result deterministically as the archived result plus `messageReadProjection`.",
60030
+ result: "Use `ats space result --view agent` with exactly one selector to read an archived dispatch result plus `messageReadProjection`. Use `ats service trace --view agent` to diagnose Wake execution and the final visible Space outcome.",
59982
60031
  password: "Use `ats space password --view agent` with an explicit space ID and one explicit password action.",
59983
60032
  guide: "Use `ats space guide --view agent` to read, `ats space guide set --view agent` to update, and `ats space guide clear --view agent` to clear the current space guide deterministically.",
59984
60033
  add_members: "Use `ats space add-members --profile <profile-id> <space-id> --member <profile-id...> --view agent` with explicit acting profile, Space ID, and member selection.",
@@ -67265,6 +67314,7 @@ function buildFormalSignalReadPayload(input) {
67265
67314
  if (!isMessageSemanticSignal$1(input.signal)) return input.signal;
67266
67315
  const messageReadProjection = buildSignalMessageReadProjection({
67267
67316
  signal: input.signal,
67317
+ identityDirectory: input.identityDirectory ?? null,
67268
67318
  membersSnapshot: input.membersSnapshot ?? null,
67269
67319
  signalIndex: input.signalIndex ?? null
67270
67320
  });
@@ -67283,6 +67333,7 @@ function buildFormalDispatchResultReadPayload(input) {
67283
67333
  ...input.result,
67284
67334
  messageReadProjection: buildDispatchResultMessageReadProjection({
67285
67335
  result: input.result,
67336
+ identityDirectory: input.identityDirectory ?? null,
67286
67337
  membersSnapshot: input.membersSnapshot ?? null,
67287
67338
  signalIndex: input.signalIndex ?? null
67288
67339
  })
@@ -73425,10 +73476,79 @@ function listSpaceMemberProfileIds(snapshot) {
73425
73476
  function withResolvedSpacePassword(spacePassword) {
73426
73477
  return spacePassword === void 0 ? {} : { spacePassword };
73427
73478
  }
73428
- async function loadSpaceMembersSnapshotOrNull(input) {
73479
+ function buildIdentityOnlyMembersSnapshotForReadProjection(identityDirectory) {
73480
+ if (!identityDirectory) return null;
73481
+ const humans = identityDirectory.entries.filter((entry) => entry.profileKind === "human").map((entry) => ({
73482
+ profileId: entry.profileId,
73483
+ profileName: entry.profileName,
73484
+ profileKind: "human",
73485
+ status: "active",
73486
+ memberSource: "backfilled",
73487
+ memberSourceLabel: "Member",
73488
+ addedAt: identityDirectory.generatedAt,
73489
+ removedAt: null,
73490
+ createdAt: identityDirectory.generatedAt,
73491
+ updatedAt: identityDirectory.generatedAt,
73492
+ addedByProfileId: null,
73493
+ addedByOwnerUserId: null,
73494
+ addedByDisplayName: null,
73495
+ removedByProfileId: null,
73496
+ removedByOwnerUserId: null,
73497
+ removalReason: null,
73498
+ firstEnteredAt: null,
73499
+ lastEnteredAt: null,
73500
+ lastSeenAt: null,
73501
+ lastSeenLabel: null,
73502
+ liveNow: false,
73503
+ mentionAlias: entry.mentionAlias,
73504
+ ownerUserId: entry.ownerUserId,
73505
+ ownerName: entry.ownerName
73506
+ }));
73507
+ const agents = identityDirectory.entries.filter((entry) => entry.profileKind === "agent").map((entry) => ({
73508
+ profileId: entry.profileId,
73509
+ profileName: entry.profileName,
73510
+ profileKind: "agent",
73511
+ status: "active",
73512
+ memberSource: "backfilled",
73513
+ memberSourceLabel: "Member",
73514
+ addedAt: identityDirectory.generatedAt,
73515
+ removedAt: null,
73516
+ createdAt: identityDirectory.generatedAt,
73517
+ updatedAt: identityDirectory.generatedAt,
73518
+ addedByProfileId: null,
73519
+ addedByOwnerUserId: null,
73520
+ addedByDisplayName: null,
73521
+ removedByProfileId: null,
73522
+ removedByOwnerUserId: null,
73523
+ removalReason: null,
73524
+ firstEnteredAt: null,
73525
+ lastEnteredAt: null,
73526
+ lastSeenAt: null,
73527
+ lastSeenLabel: null,
73528
+ liveNow: false,
73529
+ mentionAlias: entry.mentionAlias,
73530
+ ownerUserId: entry.ownerUserId,
73531
+ ownerName: entry.ownerName,
73532
+ agentControllerRef: entry.agentControllerRef,
73533
+ agentControllerConversationId: null
73534
+ }));
73535
+ return {
73536
+ spaceId: identityDirectory.spaceId,
73537
+ generatedAt: identityDirectory.generatedAt,
73538
+ summary: {
73539
+ totalCount: humans.length + agents.length,
73540
+ humanCount: humans.length,
73541
+ agentCount: agents.length,
73542
+ liveNowCount: 0
73543
+ },
73544
+ humans,
73545
+ agents
73546
+ };
73547
+ }
73548
+ async function loadSpaceIdentityDirectoryOrNull(input) {
73429
73549
  if (input.skip === true) return null;
73430
73550
  try {
73431
- return await input.spaceApi.getMembersSnapshot({
73551
+ return await input.spaceApi.getIdentityDirectory({
73432
73552
  spaceId: input.spaceId,
73433
73553
  requestContext: input.requestContext,
73434
73554
  ...withResolvedSpacePassword(input.resolvedPassword)
@@ -73587,13 +73707,15 @@ async function runTail(input) {
73587
73707
  password: input.password,
73588
73708
  space
73589
73709
  }).catch(() => null);
73590
- const fetchedMembersSnapshot = await spaceApi.getMembersSnapshot({
73710
+ const identityDirectory = await loadSpaceIdentityDirectoryOrNull({
73711
+ spaceApi,
73591
73712
  spaceId: space,
73592
73713
  requestContext,
73593
- ...input.password === void 0 ? {} : { spacePassword: input.password }
73594
- }).catch(() => null);
73714
+ resolvedPassword: input.password
73715
+ });
73716
+ const identityOnlyMembersSnapshot = buildIdentityOnlyMembersSnapshotForReadProjection(identityDirectory);
73595
73717
  if (shouldPromoteHistorySignalIndex({
73596
- membersSnapshot: fetchedMembersSnapshot,
73718
+ identityDirectory,
73597
73719
  signals: parsedEnvelopes,
73598
73720
  signalIndex
73599
73721
  })) signalIndex = await loadSpaceSignalIndexOrNull({
@@ -73607,7 +73729,7 @@ async function runTail(input) {
73607
73729
  outJsonLine(buildSpaceHistoryBriefPayload({
73608
73730
  atsProfile,
73609
73731
  events: parsedEnvelopes,
73610
- membersSnapshot: fetchedMembersSnapshot,
73732
+ identityDirectory,
73611
73733
  signalIndex,
73612
73734
  spaceId: space
73613
73735
  }));
@@ -73618,19 +73740,19 @@ async function runTail(input) {
73618
73740
  const transcriptItems = buildHumanReadSignalsTranscriptItems({
73619
73741
  atsProfile,
73620
73742
  events: parsedEnvelopes,
73621
- membersSnapshot: fetchedMembersSnapshot,
73743
+ membersSnapshot: identityOnlyMembersSnapshot,
73622
73744
  signalIndex
73623
73745
  });
73624
73746
  const transcriptProjection = buildHumanTranscriptProjection({
73625
73747
  items: transcriptItems,
73626
- membersSnapshot: fetchedMembersSnapshot,
73748
+ membersSnapshot: identityOnlyMembersSnapshot,
73627
73749
  sessionProfile: buildSpaceSessionProfileContext(atsProfile)
73628
73750
  });
73629
73751
  if (canUseHumanHistoryPiTui) {
73630
73752
  await runHumanHistoryPiTuiViewer({
73631
73753
  atsProfile,
73632
73754
  baseUrl,
73633
- membersSnapshot: fetchedMembersSnapshot,
73755
+ membersSnapshot: identityOnlyMembersSnapshot,
73634
73756
  password: input.password,
73635
73757
  space,
73636
73758
  spaceMeta,
@@ -73642,43 +73764,37 @@ async function runTail(input) {
73642
73764
  atsProfile,
73643
73765
  presenter,
73644
73766
  transcriptItems,
73645
- membersSnapshot: fetchedMembersSnapshot,
73767
+ membersSnapshot: identityOnlyMembersSnapshot,
73646
73768
  focusedSummary: buildFocusedHistorySummary({ systemNoticeCount: transcriptProjection.hiddenSummary.hiddenSystemNoticeCount })
73647
73769
  });
73648
73770
  return;
73649
73771
  }
73650
73772
  const shouldEmitFullEnvelope = input.json || agentRawContract;
73651
- const spaceMembersSnapshot = shouldEmitFullEnvelope ? null : fetchedMembersSnapshot;
73652
- if (agentRawContract) {
73653
- if (spaceMeta) outJsonLine(buildAgentSessionMetaPayload({
73654
- gatewayUrl: baseUrl,
73655
- mode: "history viewer",
73656
- passwordProtected: spaceMeta.passwordProtected,
73657
- agentControllerConversationId: void 0,
73658
- agentControllerRef: void 0,
73659
- profileId: atsProfile.atsProfileId,
73660
- profileKind: atsProfile.profileKind,
73661
- profileName: atsProfile.profileName,
73662
- ownerName: atsProfile.ownerName,
73663
- ownerUserId: atsProfile.ownerUserId,
73664
- spaceCreatedAt: spaceMeta.createdAt,
73665
- spaceCreatorId: spaceMeta.creator?.profileId,
73666
- spaceCreatorName: spaceMeta.creator?.profileName,
73667
- spaceId: space,
73668
- spaceName: spaceMeta.name
73669
- }));
73670
- if (fetchedMembersSnapshot) outJsonLine({
73671
- type: "system.space.members",
73672
- payload: normalizeAgentOutputMembersSnapshot(fetchedMembersSnapshot)
73673
- });
73674
- }
73773
+ const spaceMembersSnapshot = shouldEmitFullEnvelope ? null : identityOnlyMembersSnapshot;
73774
+ if (agentRawContract && spaceMeta) outJsonLine(buildAgentSessionMetaPayload({
73775
+ gatewayUrl: baseUrl,
73776
+ mode: "history viewer",
73777
+ passwordProtected: spaceMeta.passwordProtected,
73778
+ agentControllerConversationId: void 0,
73779
+ agentControllerRef: void 0,
73780
+ profileId: atsProfile.atsProfileId,
73781
+ profileKind: atsProfile.profileKind,
73782
+ profileName: atsProfile.profileName,
73783
+ ownerName: atsProfile.ownerName,
73784
+ ownerUserId: atsProfile.ownerUserId,
73785
+ spaceCreatedAt: spaceMeta.createdAt,
73786
+ spaceCreatorId: spaceMeta.creator?.profileId,
73787
+ spaceCreatorName: spaceMeta.creator?.profileName,
73788
+ spaceId: space,
73789
+ spaceName: spaceMeta.name
73790
+ }));
73675
73791
  let emitted = 0;
73676
73792
  for (const env of parsedEnvelopes) {
73677
73793
  emitted += 1;
73678
73794
  if (agentRawContract) {
73679
73795
  outJsonLine(buildFormalSignalReadPayload({
73680
73796
  signal: normalizeAgentOutputEvent(env),
73681
- membersSnapshot: fetchedMembersSnapshot,
73797
+ identityDirectory,
73682
73798
  signalIndex
73683
73799
  }));
73684
73800
  continue;
@@ -73688,7 +73804,7 @@ async function runTail(input) {
73688
73804
  code: "tail.signal",
73689
73805
  payload: buildFormalSignalReadPayload({
73690
73806
  signal: env,
73691
- membersSnapshot: fetchedMembersSnapshot,
73807
+ identityDirectory,
73692
73808
  signalIndex
73693
73809
  })
73694
73810
  });
@@ -73754,7 +73870,7 @@ function shouldPromoteHistorySignalIndex(input) {
73754
73870
  if (!isMessageSemanticSignal(signal)) continue;
73755
73871
  const projection = buildSignalMessageReadProjection({
73756
73872
  signal,
73757
- membersSnapshot: input.membersSnapshot,
73873
+ identityDirectory: input.identityDirectory,
73758
73874
  signalIndex: input.signalIndex
73759
73875
  });
73760
73876
  if (projection.replyToSignalId && projection.replyToContext?.resolved !== true) return true;
@@ -73779,7 +73895,7 @@ function buildSpaceHistoryBriefPayload(input) {
73779
73895
  },
73780
73896
  messages: input.events.map((event) => buildSpaceHistoryBriefMessage({
73781
73897
  event,
73782
- membersSnapshot: input.membersSnapshot,
73898
+ identityDirectory: input.identityDirectory,
73783
73899
  signalIndex: input.signalIndex
73784
73900
  }))
73785
73901
  };
@@ -73787,7 +73903,7 @@ function buildSpaceHistoryBriefPayload(input) {
73787
73903
  function buildSpaceHistoryBriefMessage(input) {
73788
73904
  const messageReadProjection = isMessageSemanticSignal(input.event) ? buildSignalMessageReadProjection({
73789
73905
  signal: input.event,
73790
- membersSnapshot: input.membersSnapshot,
73906
+ identityDirectory: input.identityDirectory,
73791
73907
  signalIndex: input.signalIndex
73792
73908
  }) : null;
73793
73909
  return {
@@ -75654,10 +75770,26 @@ async function resolveBareMentionDiagnostics(input) {
75654
75770
  const snapshot = input.loadedMembersSnapshot ?? await loadMembersSnapshotForBareMentionDiagnostics(input);
75655
75771
  if (!snapshot) return [];
75656
75772
  return listSpaceBareMentionDiagnostics({
75773
+ ignoredRanges: resolveCanonicalMentionDiagnosticIgnoreRanges(input.preparedSubmission),
75657
75774
  snapshot,
75658
75775
  text: input.preparedSubmission.text
75659
75776
  });
75660
75777
  }
75778
+ function resolveCanonicalMentionDiagnosticIgnoreRanges(preparedSubmission) {
75779
+ const ranges = [];
75780
+ let cursor = 0;
75781
+ for (const mention of preparedSubmission.canonicalMentionsInTextOrder) {
75782
+ const start = preparedSubmission.text.indexOf(mention.text, cursor);
75783
+ if (start < 0) continue;
75784
+ const end = start + mention.text.length;
75785
+ ranges.push({
75786
+ end,
75787
+ start
75788
+ });
75789
+ cursor = end;
75790
+ }
75791
+ return ranges;
75792
+ }
75661
75793
  async function loadMembersSnapshotForBareMentionDiagnostics(input) {
75662
75794
  try {
75663
75795
  emitAgentSendProgress({
@@ -96130,7 +96262,7 @@ function buildHumanReplyWorkflowSummary(projection) {
96130
96262
  }
96131
96263
  }
96132
96264
  function buildHumanReplyWorkflowSurfaceNote(input) {
96133
- return input.surface === "result" ? "`space result` shows archived successful outcomes only. Use `space updates` for blocked or failed execution evidence." : "`space updates` shows formal execution evidence, including blocked and failed targets. `space result` only shows archived successful outcomes.";
96265
+ return input.surface === "result" ? "`space result` reads archived dispatch results only. Use `ats service trace` to inspect Wake execution and the final visible Space outcome." : "`space updates` shows formal execution evidence for this message round. Use `ats service trace` to inspect Wake execution and the final visible Space outcome.";
96134
96266
  }
96135
96267
  function buildHumanReplyWorkflowSignalSummary(projection) {
96136
96268
  if (!(projection?.hasPublicSignal && projection.publishedSignalId)) return null;
@@ -96363,19 +96495,22 @@ async function loadSpaceResultProjectionContext(input) {
96363
96495
  resolvedPassword: input.resolvedPassword,
96364
96496
  required: true
96365
96497
  });
96498
+ const identityDirectory = await loadSpaceIdentityDirectoryOrNull({
96499
+ spaceApi: input.spaceApi,
96500
+ spaceId: input.spaceId,
96501
+ requestContext: input.requestContext,
96502
+ resolvedPassword: input.resolvedPassword
96503
+ });
96366
96504
  return {
96367
- membersSnapshot: await loadSpaceMembersSnapshotOrNull({
96368
- spaceApi: input.spaceApi,
96369
- spaceId: input.spaceId,
96370
- requestContext: input.requestContext,
96371
- resolvedPassword: input.resolvedPassword
96372
- }),
96505
+ identityDirectory,
96506
+ membersSnapshot: buildIdentityOnlyMembersSnapshotForReadProjection(identityDirectory),
96373
96507
  signalIndex
96374
96508
  };
96375
96509
  }
96376
96510
  function emitSpaceResultJsonOutput(input) {
96377
96511
  outJsonLine(buildFormalDispatchResultReadPayload({
96378
96512
  result: input.result,
96513
+ identityDirectory: input.identityDirectory,
96379
96514
  membersSnapshot: input.membersSnapshot,
96380
96515
  signalIndex: input.signalIndex
96381
96516
  }));
@@ -96427,7 +96562,7 @@ async function runSpaceResult(input) {
96427
96562
  if (resultRead.status === "cancelled") return;
96428
96563
  const result = resultRead.result;
96429
96564
  const resolvedPassword = resultRead.password;
96430
- const { membersSnapshot, signalIndex } = await loadSpaceResultProjectionContext({
96565
+ const { identityDirectory, membersSnapshot, signalIndex } = await loadSpaceResultProjectionContext({
96431
96566
  result,
96432
96567
  requestContext,
96433
96568
  resolvedPassword,
@@ -96436,6 +96571,7 @@ async function runSpaceResult(input) {
96436
96571
  });
96437
96572
  if (input.json) {
96438
96573
  emitSpaceResultJsonOutput({
96574
+ identityDirectory,
96439
96575
  membersSnapshot,
96440
96576
  result,
96441
96577
  signalIndex
@@ -96455,7 +96591,7 @@ function decorateSpaceResultReadError(input) {
96455
96591
  code: failure.code,
96456
96592
  message: failure.message
96457
96593
  }))) return input.error;
96458
- const error = /* @__PURE__ */ new Error("No archived dispatch result was found. `space result` only reads archived successful outcomes. Use `space updates` to inspect blocked or failed execution evidence.");
96594
+ const error = /* @__PURE__ */ new Error("No archived dispatch result was found. `space result` reads archived dispatch results only. Use `ats service trace` to inspect Wake execution and the final visible Space outcome.");
96459
96595
  error.code = failure.code ?? void 0;
96460
96596
  error.requestId = failure.requestId;
96461
96597
  error.status = failure.status;
@@ -97033,6 +97169,7 @@ function emitSpaceUpdatesJsonOutput(input) {
97033
97169
  sourceSignalId: input.sourceSignalId,
97034
97170
  sourceSignal: input.signalIndex?.get(input.sourceSignalId) ?? null,
97035
97171
  dispatchExecution: input.dispatchExecution,
97172
+ identityDirectory: input.identityDirectory,
97036
97173
  membersSnapshot: input.membersSnapshot,
97037
97174
  signalIndex: input.signalIndex,
97038
97175
  signals: input.signals
@@ -97040,6 +97177,7 @@ function emitSpaceUpdatesJsonOutput(input) {
97040
97177
  });
97041
97178
  for (const signal of input.signals) outJsonLine(buildFormalSignalReadPayload({
97042
97179
  signal,
97180
+ identityDirectory: input.identityDirectory,
97043
97181
  membersSnapshot: input.membersSnapshot,
97044
97182
  signalIndex: input.signalIndex
97045
97183
  }));
@@ -97071,7 +97209,7 @@ async function loadAnchorDispatchExecutionEvidence(input) {
97071
97209
  }
97072
97210
  }
97073
97211
  async function loadSpaceUpdatesProjectionContext(input) {
97074
- const [membersSnapshot, signalIndex] = await Promise.all([loadSpaceMembersSnapshotOrNull({
97212
+ const [identityDirectory, signalIndex] = await Promise.all([loadSpaceIdentityDirectoryOrNull({
97075
97213
  spaceApi: input.spaceApi,
97076
97214
  spaceId: input.space,
97077
97215
  requestContext: input.requestContext,
@@ -97082,6 +97220,7 @@ async function loadSpaceUpdatesProjectionContext(input) {
97082
97220
  requestContext: input.requestContext,
97083
97221
  resolvedPassword: input.resolvedPassword
97084
97222
  })]);
97223
+ const membersSnapshot = buildIdentityOnlyMembersSnapshotForReadProjection(identityDirectory);
97085
97224
  const dispatchExecutionState = await loadAnchorDispatchExecutionEvidence({
97086
97225
  afterSignalId: input.afterSignalId,
97087
97226
  baseUrl: input.baseUrl,
@@ -97094,6 +97233,7 @@ async function loadSpaceUpdatesProjectionContext(input) {
97094
97233
  return {
97095
97234
  dispatchExecution: dispatchExecutionState.status === "available" ? dispatchExecutionState.dispatchExecution : null,
97096
97235
  dispatchExecutionUnavailable: dispatchExecutionState.status === "unavailable" ? dispatchExecutionState.failure : null,
97236
+ identityDirectory,
97097
97237
  membersSnapshot,
97098
97238
  signalIndex
97099
97239
  };
@@ -97139,7 +97279,7 @@ async function runSpaceUpdates(input) {
97139
97279
  if (updatesRead.status === "cancelled") return;
97140
97280
  const updates = updatesRead.result;
97141
97281
  const resolvedPassword = updatesRead.password;
97142
- const { dispatchExecution, dispatchExecutionUnavailable, membersSnapshot, signalIndex } = await loadSpaceUpdatesProjectionContext({
97282
+ const { dispatchExecution, dispatchExecutionUnavailable, identityDirectory, membersSnapshot, signalIndex } = await loadSpaceUpdatesProjectionContext({
97143
97283
  afterSignalId,
97144
97284
  baseUrl,
97145
97285
  requestContext,
@@ -97151,6 +97291,7 @@ async function runSpaceUpdates(input) {
97151
97291
  emitSpaceUpdatesJsonOutput({
97152
97292
  dispatchExecution,
97153
97293
  dispatchExecutionUnavailable,
97294
+ identityDirectory,
97154
97295
  membersSnapshot,
97155
97296
  signalIndex,
97156
97297
  sourceSignalId: afterSignalId,