openmeld 0.3.122 → 0.3.124

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.
@@ -4,7 +4,7 @@ import { $ as runWithHeldLock, $t as runtimeAgentControllerConversationIdMapping
4
4
  import { A as MAX_TEXT_LENGTH, At as createCenterAgentRoutineResponseSchema, B as sleep, C as createSpaceApi, D as toStructuredApiClientFailure, Dt as organizationComputersResponseSchema, E as resolveProfileSpaceHistoryGatewayHost, Et as profileErrorResponseSchema, F as OPENMELD_HEADER_PROFILE_ID, Ft as resumeCenterAgentRoutineResponseSchema, Gt as localProjectControlDaemonFrameSchema, H as getSpaceUpdatesResponseSchema, It as updateCenterAgentRoutineResponseSchema, Jt as postSpaceMembersResponseSchema, Kt as localProjectControlDiscoverProjectsResponseSchema, L as OPENMELD_HEADER_REQUEST_ID, M as parseIncoming$1, Mt as listCenterAgentRoutineRunsResponseSchema, N as parseServerErrorFrame$1, Nt as listCenterAgentRoutinesResponseSchema, O as DAEMON_STREAM_KEEPALIVE_PING, Ot as submitFeedbackIssueRequestSchema, P as resolveCustomMentionAliasOverride, Pt as pauseCenterAgentRoutineResponseSchema, Q as submitAgentControllerTaskLifecycleEventItemSchema, Rt as AGENT_ACTIVITY_PRESENCE_TTL_MAX_MS, S as createRuntimeReportingApi, St as ADDITIONAL_HUMAN_PROFILE_CREATION_DISABLED_MESSAGE, T as resolveAccountSpaceIndexGatewayHost, Tt as profileCapabilitiesResponseSchema, U as SPACE_DISPATCH_TRACE_PROMPT_PREVIEW_MAX_CHARS, Ut as agentActivitySnapshotResponseSchema, V as toErrorMessage$42, Wt as localProjectControlConnectionSchema, Xt as spaceMemberDirectoryEntrySchema, Yt as removeSpaceMembersResponseSchema, Zt as spaceMemberDirectorySchema, _n as agentControllerPermissionModeSchema, _t as organizationSkillReleaseSummarySchema, a as buildSpaceAttachmentDownloadPath, an as createProjectResponseSchema, at as COMPUTER_FILE_ACCESS_RUNTIME_CAPABILITY, bt as organizationDirectoryResponseSchema, c as createAgentProfileBindingApi, cn as updateProjectResponseSchema, ct as computerFileAccessPolicyInputSchema, d as createCurrentDeviceApi, dt as organizationSpaceDirectoryWithMemberCountsResponseSchema, ft as spaceCreatorSchema, g as createOrganizationApi, h as createOpenMeldApiClient, ht as listOrganizationSkillsResponseSchema, i as buildProfileSpaceHistoryUpsertPath, in as archiveProjectResponseSchema, it as gatewayErrorEnvelopeSchema, j as parseEnvelope$1, jt as deleteCenterAgentRoutineResponseSchema, kt as submitFeedbackIssueResponseSchema, ln as centerAgentToolSpeakerSchema, lt as computerFileAccessPolicySchema, m as createLocalRuntimeExpectedRoutesApi, mt as getOrganizationSkillResponseSchema, n as OpenMeldApiClientInvalidResponseError, o as createAccountSpaceIndexApi, on as listProjectsResponseSchema, ot as OPENMELD_RUNTIME_CAPABILITIES_HEADER, p as createFetchTransport, pt as spaceMetaSchema, qt as leaveSpaceResponseSchema, r as buildProfileSpaceHistoryStatusPath, rn as observedLocalAgentSessionSchema, s as createAgentActivityApi, sn as projectSchema, st as computerFileAccessDaemonFrameSchema, t as OpenMeldApiClientHttpError, tn as agentActivitySessionInventoryResponseSchema, un as openCodePermissionConfigSchema, ut as modelCatalogSchema, vn as agentControllerCollaborationModeSchema, vt as organizationSkillSummarySchema, wt as authProfileManagedRoleSchema, xt as ADDITIONAL_HUMAN_PROFILE_CREATION_DISABLED_CODE, y as createProfileSpaceHistoryApi, yn as toLegacySpaceAddressingWireValue, z as toErrorMessage$43, zt as agentActivityEventSchema } from "./dist-DYE9Q3T4.js";
5
5
  import { $r as profileWorkspaceModeSchema, $t as skippedDaemonProfileSchema, A as runtimeTransportRegisterSessionResponseSchema, An as AGENT_INTERACTION_DEFAULT_TIMEOUT_MS, B as openMeldDaemonTaskResultPayloadSchema, Bn as localCliComponentUpdateProjectionSchema, Bt as resolveSpaceFileMimeType, C as runtimeTransportLocalAgentControlRefreshCatalogFramePayloadSchema, D as runtimeTransportOpenMeldToolsControlFramePayloadSchema, E as runtimeTransportLookupRouteOwnerServiceEvidenceSchema, Fn as formatLocalComponentsSummaryDescription, Fr as resolveSpaceMentionLabels, G as localFolderPickerDaemonFrameSchema, Gr as openMeldRequestContextSchema, H as openMeldSpaceEgressActionSchema, I as runtimeTransportSubmitTaskResultRequestSchema, In as formatLocalComponentsSummaryLabel, Jn as openMeldToolsUpdateOperationPhaseSchema, Jr as normalizeOptionalWorkingDirectory, K as localFolderPickerHelperProtocolResultSchema, Kr as MAX_PROFILE_WORKING_DIRECTORY_LENGTH, Ln as formatLocalSetupActionDescription, M as runtimeTransportResumeControllerConversationFramePayloadSchema, Mn as agentInteractionRequestSchema, Mr as normalizeSpacePasswordText, N as runtimeTransportResumeControllerConversationResultFramePayloadSchema, Nn as agentInteractionResolutionSchema, O as runtimeTransportOpenMeldToolsControlResultFramePayloadSchema, Or as runtimeCoordinatorExecutionTokenEnvelopeSchema, P as runtimeTransportRouteCatalogChangedFramePayloadSchema, Pr as resolveSingleSpaceMentionLabels, Pt as SPACE_FILE_MAX_SIZE_BYTES, R as openMeldDaemonTaskResultEnvelopeWriteSchema, Rn as formatLocalSetupActionLabel, S as runtimeTransportLocalAgentControlManageInstallationFramePayloadSchema, Sn as resolveMessageEnvelopeTargetField, T as runtimeTransportLocalAgentControlSetProfileWorkspaceFramePayloadSchema, U as LOCAL_FOLDER_PICKER_RUNTIME_CAPABILITY, W as OPENMELD_LOCAL_FOLDER_PICKER_CAPABILITY_HEADER, Wn as localServiceComponentUpdateProjectionSchema, Wt as spaceFileNameSchema, Xt as openMeldDaemonControlPlaneRequestSchema, Yr as openMeldRuntimeProfileIdSchema, Zn as openMeldToolsUpdateRequestSourceSchema, Zt as openMeldDaemonControlPlaneResponseSchema, _ as runtimeTransportHeartbeatRequestSchema, _n as collectCanonicalMentionTextFragments, a as runtimeTransportCapabilitiesSchema, ai as MAX_TEXT_LENGTH$1, b as runtimeTransportLocalAgentControlForkSessionFramePayloadSchema, br as url, c as runtimeTransportDispatchInteractionRequestSchema, ci as resolvePublicAgentAvailabilityCopy, d as runtimeTransportDispatchPreviewEndRequestSchema, di as shouldPreferMappedPublicAgentFailureReason, en as providerDispatchRuntimeContextSchema, er as boolean, f as runtimeTransportDispatchPreviewRequestSchema, g as runtimeTransportForkAgentSessionResultSchema, gn as MESSAGE_MENTION_TYPE_VALUES, gt as SPACE_MENTION_REJECT_NOTICE_PURPOSE, h as runtimeTransportErrorCodeSchema, hi as resolveCommandAgentWorkActivity, hr as string, ht as SPACE_MEMBER_REMOVE_NOTICE_PURPOSE, i as localWakeRouteReportSchema, ii as trimmedStringFromUnknown, ir as enumFactory, j as runtimeTransportRejectedProfileRegistrationSchema, k as runtimeTransportRegisterSessionRequestSchema, kr as runtimeTransportDeliveryExecutionIdentitySchema, l as runtimeTransportDispatchInteractionResponseFramePayloadSchema, li as resolvePublicAgentFailureRecovery, m as runtimeTransportDispatchToolActivityRequestSchema, mr as strictObject, mt as SPACE_MEMBER_JOIN_NOTICE_PURPOSE, n as daemonExecutionCompatibilitySchema, nr as discriminatedUnion, o as runtimeTransportDeliverDispatchRequestSchema, oi as resolveDetailedPublicAgentFailureReason$1, or as iso, p as runtimeTransportDispatchRuntimeEvidenceRequestSchema, q as localFolderPickerHelperResultSchema, qn as openMeldToolsUpdateAttemptSchema, qr as agentProfileIdSchema, r as daemonStreamFrameSchema, s as runtimeTransportDispatchInteractionDeliveredRequestSchema, si as resolveMappedPublicAgentFailureReason, sr as literal, t as CURRENT_DAEMON_EXECUTION_CONTRACT_EPOCH, tn as conversationExecutionStateSchema, u as runtimeTransportDispatchLifecycleRequestSchema, ui as sanitizeDispatchErrorSummary, ut as CONVERSATION_CONTINUITY_WARNING_PURPOSE, v as runtimeTransportHeartbeatResponseSchema, vn as formatCanonicalMentionLiteral, vt as sanitizeSignalTextPreview, w as runtimeTransportLocalAgentControlSetEnabledFramePayloadSchema, wr as parseOptionalClientMessageId, x as runtimeTransportLocalAgentControlInterruptFramePayloadSchema, xn as normalizeMessageEnvelope, y as runtimeTransportLocalAgentControlCancelFramePayloadSchema, yn as getSpaceMessageAddressingRelationSupportForTargetKind, z as openMeldDaemonTaskResultOpenClawGatewayVisibilityStatusSchema, zn as installedLocalComponentsSnapshotSchema } from "./runtime-transport-CWWB2Ily.js";
6
6
  import { r as daemonServiceLaneSchema, t as daemonServiceContractSchema } from "./service-contract-CRyDcIIf.js";
7
- import { A as isDaemonServiceRuntimeHeartbeatStale, B as setDaemonServiceRuntimeState, C as daemonServiceStableExecutableWrapperPath, D as getDaemonRuntimeStatus, E as ensureDaemonControlPlaneToken, F as releaseDaemonServiceLifecycleLock, G as withDaemonServiceStopLock, H as withDaemonServiceReconcileLock, I as resolveDaemonControlPlaneEndpoint, K as readDaemonLocalStateFile, L as resolveDaemonServiceRuntimeMetadata, M as readDaemonServiceLifecycleLockMeta, N as readDaemonServiceLifecycleLockMetaWithCleanup, O as getDaemonStatus, P as readDaemonServiceRuntimeSnapshot, R as restoreDaemonInstallStateSnapshot, S as daemonServiceRepairJournalPath, T as daemonStatePath, U as withDaemonServiceRegistrationMutationLock, V as uninstallDaemon, W as withDaemonServiceRunLock, _ as daemonRuntimeServiceManagerPath, a as DAEMON_SERVICE_RUNTIME_CONTROLLER_ENV, b as daemonServiceLegacyExecutableWrapperPath, c as DAEMON_SERVICE_RUNTIME_STATE_SCHEMA, d as clearDaemonServiceRuntimeState, f as daemonDispatchJournalPath, g as daemonRuntimeRootPath, h as daemonRuntimeDataPath, i as DAEMON_SERVICE_RUNTIME_AUTO_START_ENV, j as readDaemonControlPlaneToken, k as installDaemon, l as DAEMON_SERVICE_RUNTIME_SYSTEM_SERVICE_ENV, m as daemonRuntimeBundlesPath, n as writeDaemonRuntimeLease, o as DAEMON_SERVICE_RUNTIME_DETACHED_ENV, p as daemonLifecycleJournalPath, q as writeDaemonLocalStateFile, r as DAEMON_HEARTBEAT_STALE_MS, s as DAEMON_SERVICE_RUNTIME_MODE_ENV, t as readDaemonRuntimeLease, u as acquireDaemonServiceLifecycleLock, v as daemonRuntimeStateRootPath, w as daemonServiceStableLauncherPath, x as daemonServiceRecognizedExecutableWrapperPaths, y as daemonServiceActiveBundleStatePath, z as rotateDaemonControlPlaneTokenIfExpired } from "./daemon-runtime-lease-Cath1v3w.js";
7
+ import { A as getDaemonRuntimeStatus, B as resolveDaemonServiceRuntimeMetadata, C as daemonServiceRepairJournalPath, D as daemonServiceUpdateWorkerBinaryExecutablePath, E as daemonServiceStableLauncherPath, F as readDaemonServiceLifecycleLockMeta, G as withDaemonServiceReconcileLock, H as rotateDaemonControlPlaneTokenIfExpired, I as readDaemonServiceLifecycleLockMetaWithCleanup, J as withDaemonServiceStopLock, K as withDaemonServiceRegistrationMutationLock, L as readDaemonServiceRuntimeSnapshot, M as installDaemon, N as isDaemonServiceRuntimeHeartbeatStale, O as daemonStatePath, P as readDaemonControlPlaneToken, R as releaseDaemonServiceLifecycleLock, S as daemonServiceRecognizedExecutablePaths$1, T as daemonServiceStableExecutableWrapperPath, U as setDaemonServiceRuntimeState, V as restoreDaemonInstallStateSnapshot, W as uninstallDaemon, X as writeDaemonLocalStateFile, Y as readDaemonLocalStateFile, _ as daemonRuntimeServiceManagerPath, a as DAEMON_SERVICE_RUNTIME_CONTROLLER_ENV, b as daemonServiceExecutableWrapperPaths$1, c as DAEMON_SERVICE_RUNTIME_STATE_SCHEMA, d as clearDaemonServiceRuntimeState, f as daemonDispatchJournalPath, g as daemonRuntimeRootPath, h as daemonRuntimeDataPath, i as DAEMON_SERVICE_RUNTIME_AUTO_START_ENV, j as getDaemonStatus, k as ensureDaemonControlPlaneToken, l as DAEMON_SERVICE_RUNTIME_SYSTEM_SERVICE_ENV, m as daemonRuntimeBundlesPath, n as writeDaemonRuntimeLease, o as DAEMON_SERVICE_RUNTIME_DETACHED_ENV, p as daemonLifecycleJournalPath, q as withDaemonServiceRunLock, r as DAEMON_HEARTBEAT_STALE_MS, s as DAEMON_SERVICE_RUNTIME_MODE_ENV, t as readDaemonRuntimeLease, u as acquireDaemonServiceLifecycleLock, v as daemonRuntimeStateRootPath, w as daemonServiceStableBinaryExecutablePath, x as daemonServiceLegacyExecutableWrapperPath, y as daemonServiceActiveBundleStatePath, z as resolveDaemonControlPlaneEndpoint } from "./daemon-runtime-lease-Cvo63MGd.js";
8
8
  import { D as PROVIDER_CONVERSATION_PROOF_SYNC_INTERVAL_MS$1, E as OPENCLAW_CLI_TIMEOUT_MS$1, M as RUNTIME_AGENT_CONTROLLER_REPORT_SYNC_RETRY_INTERVAL_MS$1, N as RUNTIME_STATE_PERSIST_MIN_INTERVAL_MS$1, O as PROVIDER_CONVERSATION_PROOF_SYNC_RETRY_INTERVAL_MS$1, S as MAX_HEARTBEAT_INTERVAL_MS$2, _ as DAEMON_STREAM_KEEPALIVE_PONG_TIMEOUT_MS$1, d as resolveOpenMeldDistribution, f as CATALOG_SYNC_RETRY_INTERVAL_MS$1, g as DAEMON_STREAM_KEEPALIVE_INTERVAL_MS$1, h as DAEMON_STREAM_CONNECT_TIMEOUT_MS$1, i as getAuthSessionState, j as RUNTIME_AGENT_CONTROLLER_REPORT_SYNC_INTERVAL_MS$1, k as REGISTER_RESPONSE_TIMEOUT_MS$1, m as DAEMON_RUNTIME_CONTRACT_EPOCH$1, n as clearAuthSession, p as CATALOG_SYNC_SIGNAL_POLL_INTERVAL_MS$1, s as setAuthSession, u as isBinaryDistribution, v as DEFAULT_GATEWAY_CHAIN_TIMEOUT_MS$1, w as MIN_HEARTBEAT_INTERVAL_MS$2, x as HEARTBEAT_RESPONSE_TIMEOUT_MS$1, y as DEFAULT_HEARTBEAT_INTERVAL_MS$1 } from "./auth-session-qk94UQqs.js";
9
9
  import { a as buildOpenMeldProfileIdentityRequestHeadersWithAuth, c as buildRequestAuthHeaders, d as buildOpenMeldRequestContextFromProfile, f as buildOpenMeldRequestContextFromProfileIdentity, i as resolveSpaceRequestTimeoutMsForDiagnostics, l as canAttachAuthTokenToRequest, m as resolveAuthRequestCompatibility, n as createCliApiClientFoundation, o as buildOpenMeldProfileRequestHeadersWithAuth, p as deriveAuthBaseUrlFromGatewayUrl, r as fetchSpaceRequestWithTimeout, s as buildOpenMeldRequestContextHeadersWithAuth, u as resolveAuthTokenAttachment } from "./api-client-foundation-w4Oa06t4.js";
10
10
  import { createRequire } from "node:module";
@@ -19409,7 +19409,7 @@ const TECHNICAL_DETAIL_MARKERS = [
19409
19409
  /\s+Last network error:/iu,
19410
19410
  /\s+Support code:/iu
19411
19411
  ];
19412
- const ACTION_SENTENCE_RE = /^(?:After\b|Check\b|Choose\b|Close\b|Connect\b|Contact\b|Continue\b|Copy\b|Finish\b|Free\b|Go\b|Make sure\b|Open\b|Reconnect\b|Remove\b|Restart\b|Run\b|Select\b|Sign in\b|Start\b|Stop\b|Try\b|Turn off\b|Turn on\b|Update\b|Use\b|Wait\b)/iu;
19412
+ const ACTION_SENTENCE_RE = /^(?:After\b|Check\b|Choose\b|Close\b|Connect\b|Contact\b|Continue\b|Copy\b|Finish\b|Free\b|Go\b|Make sure\b|Open\b|Reconnect\b|Remove\b|Restart\b|Return\b|Run\b|Select\b|Sign in\b|Start\b|Stop\b|Try\b|Turn off\b|Turn on\b|Update\b|Use\b|Wait\b)/iu;
19413
19413
  const SENTENCE_BOUNDARY_RE = /(?<=[.!?])\s+(?=[A-Z`])/u;
19414
19414
  function buildHumanErrorCopy(message) {
19415
19415
  const sentences = splitSentences(stripTechnicalErrorDetail(message));
@@ -19470,7 +19470,7 @@ function splitSentences(message) {
19470
19470
  var package_default = {
19471
19471
  $schema: "https://www.schemastore.org/package.json",
19472
19472
  name: "openmeld",
19473
- version: "0.3.122",
19473
+ version: "0.3.124",
19474
19474
  openMeldReleaseDate: "2026-08-28",
19475
19475
  description: "OpenMeld CLI - https://openmeld.ai",
19476
19476
  license: "MIT",
@@ -20000,6 +20000,57 @@ function toStartBackgroundHelperExecutionCompatibility(input) {
20000
20000
  };
20001
20001
  }
20002
20002
  //#endregion
20003
+ //#region src/config/daemon-service-update-worker-registration.ts
20004
+ const MANAGED_VERSION_FROM_EXECUTABLE_PATTERN = /[\\/]versions[\\/](v?(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)(?:-[0-9A-Za-z.-]+)?(?:\+[0-9A-Za-z.-]+)?)[\\/]openmeld(?:\.exe)?/gu;
20005
+ function resolveDaemonServiceUpdateWorkerIdentity(pathInput = {}) {
20006
+ const preset = resolveOpenMeldEnvPreset(pathInput);
20007
+ const suffix = preset === "prod" ? "" : `-${preset}`;
20008
+ return {
20009
+ launchdLabel: `com.openmeld.openmeld-service-update${preset === "prod" ? "" : `.${preset}`}`,
20010
+ serviceName: `openmeld-service-update${suffix}`,
20011
+ windowsDisplayName: `OpenMeld Service Update${preset === "prod" ? "" : ` (${preset})`}`,
20012
+ windowsServiceName: `OpenMeld-Service-Update${suffix}`
20013
+ };
20014
+ }
20015
+ function resolveDaemonServiceUpdateWorkerLaunchdPlistPath(pathInput = {}) {
20016
+ return join(pathInput.homeDir ?? homedir(), "Library", "LaunchAgents", `${resolveDaemonServiceUpdateWorkerIdentity(pathInput).launchdLabel}.plist`);
20017
+ }
20018
+ function resolveDaemonServiceUpdateWorkerSystemdUnitPath(pathInput = {}) {
20019
+ return join(pathInput.homeDir ?? homedir(), ".config", "systemd", "user", `${resolveDaemonServiceUpdateWorkerIdentity(pathInput).serviceName}.service`);
20020
+ }
20021
+ function resolveDaemonServiceUpdateWorkerSystemdPathUnitPath(pathInput = {}) {
20022
+ return join(pathInput.homeDir ?? homedir(), ".config", "systemd", "user", `${resolveDaemonServiceUpdateWorkerIdentity(pathInput).serviceName}.path`);
20023
+ }
20024
+ function resolveDaemonServiceUpdateWorkerWindowsScriptPath(pathInput = {}) {
20025
+ return join(daemonRuntimeRootPath(pathInput), "service-update-worker.bat");
20026
+ }
20027
+ async function readDaemonServiceUpdateWorkerProtectedManagedVersions(pathInput = {}, platform = process$1.platform) {
20028
+ const registrationPath = resolveDaemonServiceUpdateWorkerRegistrationPath(pathInput, platform);
20029
+ if (registrationPath === null) return /* @__PURE__ */ new Set();
20030
+ const contents = await readFile(registrationPath, "utf8").catch((error) => {
20031
+ if (getErrorCode$5(error) === "ENOENT") return null;
20032
+ throw error;
20033
+ });
20034
+ return contents === null ? /* @__PURE__ */ new Set() : readManagedVersionsFromUpdateWorkerRegistration(contents);
20035
+ }
20036
+ function readManagedVersionsFromUpdateWorkerRegistration(contents) {
20037
+ const versions = /* @__PURE__ */ new Set();
20038
+ for (const match of contents.matchAll(MANAGED_VERSION_FROM_EXECUTABLE_PATTERN)) {
20039
+ const version = match[1];
20040
+ if (version) versions.add(version);
20041
+ }
20042
+ return versions;
20043
+ }
20044
+ function resolveDaemonServiceUpdateWorkerRegistrationPath(pathInput, platform) {
20045
+ if (platform === "darwin") return resolveDaemonServiceUpdateWorkerLaunchdPlistPath(pathInput);
20046
+ if (platform === "linux") return resolveDaemonServiceUpdateWorkerSystemdUnitPath(pathInput);
20047
+ if (platform === "win32") return resolveDaemonServiceUpdateWorkerWindowsScriptPath(pathInput);
20048
+ return null;
20049
+ }
20050
+ function getErrorCode$5(error) {
20051
+ return error && typeof error === "object" && "code" in error ? String(error.code) : null;
20052
+ }
20053
+ //#endregion
20003
20054
  //#region src/config/version-state.ts
20004
20055
  const VERSION_STATE_FILENAME = "version.json";
20005
20056
  const NPM_REGISTRY_LATEST_TIMEOUT_MS = 5e3;
@@ -20249,8 +20300,39 @@ function toErrorMessage$30(error) {
20249
20300
  return String(error);
20250
20301
  }
20251
20302
  //#endregion
20252
- //#region src/local-components/managed-install.ts
20303
+ //#region src/local-components/managed-version-pruning.ts
20253
20304
  const MANAGED_VERSION_DIRECTORY_PATTERN = /^v?(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-(?:0|[1-9]\d*|\d*[A-Za-z-][0-9A-Za-z-]*)(?:\.(?:0|[1-9]\d*|\d*[A-Za-z-][0-9A-Za-z-]*))*)?(?:\+[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?$/;
20305
+ async function pruneManagedVersions(input) {
20306
+ const versionsDir = openMeldVersionsDir(input.pathInput);
20307
+ const managedVersions = (await readdir(versionsDir, { withFileTypes: true })).filter((entry) => entry.isDirectory() && MANAGED_VERSION_DIRECTORY_PATTERN.test(entry.name)).map((entry) => entry.name);
20308
+ const usableManagedVersions = new Set((await Promise.all(managedVersions.map(async (version) => ({
20309
+ usable: await isUsableManagedVersion(version, versionsDir),
20310
+ version
20311
+ })))).filter((entry) => entry.usable).map((entry) => entry.version));
20312
+ const retainedVersions = /* @__PURE__ */ new Set([input.currentVersion]);
20313
+ let rollbackVersion = null;
20314
+ if (input.preferredRollbackVersion && input.preferredRollbackVersion !== input.currentVersion && usableManagedVersions.has(input.preferredRollbackVersion)) rollbackVersion = input.preferredRollbackVersion;
20315
+ rollbackVersion ??= [...usableManagedVersions].filter((version) => compareSemver(version, input.currentVersion) < 0).sort((left, right) => compareSemver(right, left))[0] ?? null;
20316
+ if (rollbackVersion) retainedVersions.add(rollbackVersion);
20317
+ for (const protectedVersion of input.protectedVersions ?? []) if (usableManagedVersions.has(protectedVersion)) retainedVersions.add(protectedVersion);
20318
+ await Promise.all(managedVersions.filter((version) => !retainedVersions.has(version)).map((version) => rm(path.join(versionsDir, version), { recursive: true })));
20319
+ }
20320
+ async function isUsableManagedVersion(version, versionsDir) {
20321
+ const target = path.join(versionsDir, version, "openmeld");
20322
+ if (!(await stat(target).catch((error) => {
20323
+ if (getErrorCode$4(error) === "ENOENT") return null;
20324
+ throw error;
20325
+ }))?.isFile()) return false;
20326
+ return await access(target, constants.X_OK).then(() => true, (error) => {
20327
+ if (getErrorCode$4(error) === "EACCES" || getErrorCode$4(error) === "ENOENT") return false;
20328
+ throw error;
20329
+ });
20330
+ }
20331
+ function getErrorCode$4(error) {
20332
+ return error && typeof error === "object" && "code" in error ? String(error.code) : null;
20333
+ }
20334
+ //#endregion
20335
+ //#region src/local-components/managed-install.ts
20254
20336
  const MANAGED_INSTALL_LOCK_PROFILE = "managed-cli";
20255
20337
  const MANAGED_INSTALL_LOCK_KEY = "install";
20256
20338
  const MANAGED_INSTALL_LOCK_RETRY_DELAY_MS = 100;
@@ -20296,6 +20378,7 @@ async function performManagedInstallLocked(input) {
20296
20378
  const currentPointerPath = openMeldManagedBinaryPath();
20297
20379
  const managedBinaryPath = openMeldManagedVersionBinaryPath(version);
20298
20380
  const previousVersion = await readCurrentPointerVersion();
20381
+ const protectedVersions = await readDaemonServiceUpdateWorkerProtectedManagedVersions();
20299
20382
  const baseOutcome = {
20300
20383
  version,
20301
20384
  platform,
@@ -20307,7 +20390,10 @@ async function performManagedInstallLocked(input) {
20307
20390
  if (previousVersion !== null) {
20308
20391
  const comparison = compareSemver(version, previousVersion);
20309
20392
  if (!force && comparison === 0 && await isUsableManagedBinary(managedBinaryPath)) {
20310
- await pruneManagedVersions({ currentVersion: previousVersion });
20393
+ await pruneManagedVersions({
20394
+ currentVersion: previousVersion,
20395
+ protectedVersions
20396
+ });
20311
20397
  return {
20312
20398
  ...baseOutcome,
20313
20399
  result: "noop_same_version"
@@ -20317,7 +20403,8 @@ async function performManagedInstallLocked(input) {
20317
20403
  if (!await isUsableManagedBinary(managedBinaryPath)) await placeVersionedBinary(input?.sourceBinaryPath ?? process$1.execPath, version, managedBinaryPath);
20318
20404
  await pruneManagedVersions({
20319
20405
  currentVersion: previousVersion,
20320
- preferredRollbackVersion: version
20406
+ preferredRollbackVersion: version,
20407
+ protectedVersions
20321
20408
  });
20322
20409
  return {
20323
20410
  ...baseOutcome,
@@ -20328,7 +20415,8 @@ async function performManagedInstallLocked(input) {
20328
20415
  await placeVersionedBinary(input?.sourceBinaryPath ?? process$1.execPath, version, managedBinaryPath);
20329
20416
  await pruneManagedVersions({
20330
20417
  currentVersion: version,
20331
- preferredRollbackVersion: previousVersion
20418
+ preferredRollbackVersion: previousVersion,
20419
+ protectedVersions
20332
20420
  });
20333
20421
  await swapCurrentPointer(currentPointerPath, managedBinaryPath);
20334
20422
  return {
@@ -20357,24 +20445,6 @@ async function withManagedInstallLock(run) {
20357
20445
  await setTimeout$1(MANAGED_INSTALL_LOCK_RETRY_DELAY_MS);
20358
20446
  }
20359
20447
  }
20360
- async function pruneManagedVersions(input) {
20361
- const versionsDir = openMeldVersionsDir();
20362
- const managedVersions = (await readdir(versionsDir, { withFileTypes: true })).filter((entry) => entry.isDirectory() && MANAGED_VERSION_DIRECTORY_PATTERN.test(entry.name)).map((entry) => entry.name);
20363
- const usableManagedVersions = new Set((await Promise.all(managedVersions.map(async (version) => ({
20364
- usable: await isUsableManagedVersion(version),
20365
- version
20366
- })))).filter((entry) => entry.usable).map((entry) => entry.version));
20367
- const retainedVersions = /* @__PURE__ */ new Set([input.currentVersion]);
20368
- if (input.preferredRollbackVersion && input.preferredRollbackVersion !== input.currentVersion && usableManagedVersions.has(input.preferredRollbackVersion)) retainedVersions.add(input.preferredRollbackVersion);
20369
- if (retainedVersions.size === 1) {
20370
- const rollbackVersion = [...usableManagedVersions].filter((version) => compareSemver(version, input.currentVersion) < 0).sort((left, right) => compareSemver(right, left))[0];
20371
- if (rollbackVersion) retainedVersions.add(rollbackVersion);
20372
- }
20373
- await Promise.all(managedVersions.filter((version) => !retainedVersions.has(version)).map((version) => rm(path.join(versionsDir, version), { recursive: true })));
20374
- }
20375
- async function isUsableManagedVersion(version) {
20376
- return await isUsableManagedBinary(path.join(openMeldVersionsDir(), version, "openmeld"));
20377
- }
20378
20448
  async function placeVersionedBinary(sourceBinary, version, managedBinaryPath) {
20379
20449
  await mkdir(openMeldManagedVersionDir(version), { recursive: true });
20380
20450
  const tmpPath = `${managedBinaryPath}.tmp-${process$1.pid}-${Date.now()}`;
@@ -20412,6 +20482,261 @@ function isErrorWithCode(error, code) {
20412
20482
  return error instanceof Error && "code" in error && error.code === code;
20413
20483
  }
20414
20484
  //#endregion
20485
+ //#region src/local-service/lifecycle/daemon-lifecycle-journal.ts
20486
+ const DAEMON_LIFECYCLE_EVENT_TYPES = [
20487
+ "connection.state",
20488
+ "daemon.crash",
20489
+ "lifecycle.command.begin",
20490
+ "lifecycle.command.end",
20491
+ "owner.snapshot",
20492
+ "route_catalog.initial_load",
20493
+ "runtime_state.takeover",
20494
+ "stop.controlled_drain",
20495
+ "stop.strategy.selected",
20496
+ "service_manager.action",
20497
+ "service_manager.registration_reconcile",
20498
+ "process_stop.action",
20499
+ "service_contract.write",
20500
+ "stop.signal.observed"
20501
+ ];
20502
+ const DAEMON_STOP_CAUSES = [
20503
+ "user_stop",
20504
+ "controlled_service_update",
20505
+ "service_crash",
20506
+ "network_disconnect",
20507
+ "unknown"
20508
+ ];
20509
+ function toJournalErrorMessage$1(error) {
20510
+ return error instanceof Error ? error.message : String(error);
20511
+ }
20512
+ function normalizeSessionId(value) {
20513
+ const normalized = typeof value === "string" ? value.trim() : "";
20514
+ return normalized.length > 0 ? normalized : null;
20515
+ }
20516
+ function resolveDaemonStopCause(input) {
20517
+ if (input.explicitCause) return input.explicitCause;
20518
+ if (input.type === "daemon.crash") return "service_crash";
20519
+ if (input.intent === "stop") return "user_stop";
20520
+ if (input.intent === "upgrade_reconcile" || input.intent === "reinstall" || input.intent === "startup_check" || input.intent === "status_cleanup") return "controlled_service_update";
20521
+ if (input.type === "connection.state" && input.result !== "connected" && input.result !== "stopping") return "network_disconnect";
20522
+ return "unknown";
20523
+ }
20524
+ function isDaemonLifecycleEvent(event) {
20525
+ if (typeof event !== "object" || event === null) return false;
20526
+ const candidate = event;
20527
+ return candidate.schema === "openmeld-daemon-lifecycle-event-v1" && candidate.v === 1 && DAEMON_LIFECYCLE_EVENT_TYPES.includes(candidate.type) && typeof candidate.timestamp === "string" && candidate.timestamp.length > 0 && typeof candidate.lane === "string" && candidate.lane.length > 0 && typeof candidate.intent === "string" && candidate.intent.length > 0 && typeof candidate.command === "string" && candidate.command.length > 0 && typeof candidate.pid === "number" && Number.isInteger(candidate.pid) && candidate.pid > 0 && (candidate.sessionId === null || typeof candidate.sessionId === "string" && candidate.sessionId.length > 0) && (candidate.stopCause === void 0 || DAEMON_STOP_CAUSES.includes(candidate.stopCause)) && typeof candidate.result === "string" && candidate.result.length > 0;
20528
+ }
20529
+ async function resolveDaemonLifecycleAttribution(input) {
20530
+ const lockMeta = await readDaemonServiceLifecycleLockMeta().catch(() => null);
20531
+ return {
20532
+ command: input.command?.trim() || (typeof lockMeta?.command === "string" ? lockMeta.command.trim() : "") || "unknown",
20533
+ intent: input.intent ?? (typeof lockMeta?.intent === "string" ? lockMeta.intent : "unknown"),
20534
+ lane: resolveOpenMeldEnvPreset(input.pathInput),
20535
+ pid: typeof lockMeta?.pid === "number" && lockMeta.pid > 0 ? lockMeta.pid : process$1.pid,
20536
+ sessionId: normalizeSessionId(lockMeta?.sessionId) ?? resolveCliContextId()
20537
+ };
20538
+ }
20539
+ async function emitDaemonLifecycleEvent(input) {
20540
+ assertNoPublishedProductionMutationDuringTests(input.pathInput ?? {}, "OpenMeld Service lifecycle journal");
20541
+ const journalPath = daemonLifecycleJournalPath(input.pathInput);
20542
+ const attribution = await resolveDaemonLifecycleAttribution(input);
20543
+ const event = {
20544
+ schema: "openmeld-daemon-lifecycle-event-v1",
20545
+ v: 1,
20546
+ type: input.type,
20547
+ timestamp: (/* @__PURE__ */ new Date()).toISOString(),
20548
+ lane: attribution.lane,
20549
+ intent: attribution.intent,
20550
+ command: attribution.command,
20551
+ pid: attribution.pid,
20552
+ sessionId: attribution.sessionId,
20553
+ stopCause: resolveDaemonStopCause({
20554
+ explicitCause: input.stopCause,
20555
+ intent: attribution.intent,
20556
+ result: input.result,
20557
+ type: input.type
20558
+ }),
20559
+ result: input.result,
20560
+ ...input.metadata ? { metadata: input.metadata } : {}
20561
+ };
20562
+ if (!isDaemonLifecycleEvent(event)) {
20563
+ console.warn(`[openmeld:lifecycle-journal] rejected invalid event ${input.type}`);
20564
+ return;
20565
+ }
20566
+ try {
20567
+ await mkdir(dirname(journalPath), { recursive: true });
20568
+ await appendFile(journalPath, `${JSON.stringify(event)}\n`, "utf8");
20569
+ } catch (error) {
20570
+ console.warn(`[openmeld:lifecycle-journal] failed to append event ${input.type}: ${toJournalErrorMessage$1(error)}`);
20571
+ }
20572
+ }
20573
+ async function runWithDaemonLifecycleCommandJournal(input) {
20574
+ await emitDaemonLifecycleEvent({
20575
+ type: "lifecycle.command.begin",
20576
+ result: "started",
20577
+ metadata: input.includeProcessUptime ? {
20578
+ ...input.metadata,
20579
+ processUptimeMs: Math.round(process$1.uptime() * 1e3)
20580
+ } : input.metadata,
20581
+ pathInput: input.pathInput,
20582
+ command: input.command,
20583
+ intent: input.intent
20584
+ });
20585
+ try {
20586
+ const result = await input.run();
20587
+ const resolvedResult = input.resolveResult?.(result) ?? { result: "completed" };
20588
+ await emitDaemonLifecycleEvent({
20589
+ type: "lifecycle.command.end",
20590
+ result: resolvedResult.result,
20591
+ metadata: resolvedResult.metadata,
20592
+ pathInput: input.pathInput,
20593
+ command: input.command,
20594
+ intent: input.intent
20595
+ });
20596
+ return result;
20597
+ } catch (error) {
20598
+ await emitDaemonLifecycleEvent({
20599
+ type: "lifecycle.command.end",
20600
+ result: "failed",
20601
+ metadata: { errorMessage: toJournalErrorMessage$1(error) },
20602
+ pathInput: input.pathInput,
20603
+ command: input.command,
20604
+ intent: input.intent
20605
+ });
20606
+ throw error;
20607
+ }
20608
+ }
20609
+ async function runDaemonServiceManagerAction(input) {
20610
+ const startedAtMs = Date.now();
20611
+ try {
20612
+ const result = await input.run();
20613
+ await emitDaemonLifecycleEvent({
20614
+ type: "service_manager.action",
20615
+ result: "completed",
20616
+ metadata: {
20617
+ action: input.action,
20618
+ controller: input.controller,
20619
+ durationMs: Date.now() - startedAtMs,
20620
+ ...input.metadata ?? {}
20621
+ },
20622
+ pathInput: input.pathInput,
20623
+ command: input.command,
20624
+ intent: input.intent
20625
+ });
20626
+ return result;
20627
+ } catch (error) {
20628
+ let errorMetadata = null;
20629
+ try {
20630
+ errorMetadata = input.resolveErrorMetadata?.(error) ?? null;
20631
+ } catch {
20632
+ errorMetadata = null;
20633
+ }
20634
+ await emitDaemonLifecycleEvent({
20635
+ type: "service_manager.action",
20636
+ result: "failed",
20637
+ metadata: {
20638
+ action: input.action,
20639
+ controller: input.controller,
20640
+ durationMs: Date.now() - startedAtMs,
20641
+ errorMessage: toJournalErrorMessage$1(error),
20642
+ ...errorMetadata ?? {},
20643
+ ...input.metadata ?? {}
20644
+ },
20645
+ pathInput: input.pathInput,
20646
+ command: input.command,
20647
+ intent: input.intent
20648
+ });
20649
+ throw error;
20650
+ }
20651
+ }
20652
+ const DAEMON_LIFECYCLE_ORIGIN_EVENT_TYPES = /* @__PURE__ */ new Set([
20653
+ "daemon.crash",
20654
+ "lifecycle.command.end",
20655
+ "process_stop.action",
20656
+ "runtime_state.takeover",
20657
+ "service_contract.write",
20658
+ "service_manager.action"
20659
+ ]);
20660
+ async function readLatestDaemonLifecycleOriginEvent(input = {}) {
20661
+ return await readLatestDaemonLifecycleEvent({
20662
+ pathInput: input.pathInput,
20663
+ typeFilter: DAEMON_LIFECYCLE_ORIGIN_EVENT_TYPES
20664
+ });
20665
+ }
20666
+ async function readLatestDaemonLifecycleConnectionStateEvent(input = {}) {
20667
+ return await readLatestDaemonLifecycleEvent({
20668
+ pathInput: input.pathInput,
20669
+ typeFilter: /* @__PURE__ */ new Set(["connection.state"])
20670
+ });
20671
+ }
20672
+ async function readLatestDaemonLifecycleEvent(input) {
20673
+ const journalPath = daemonLifecycleJournalPath(input.pathInput);
20674
+ let content;
20675
+ try {
20676
+ content = await readFile(journalPath, "utf8");
20677
+ } catch (error) {
20678
+ if (error.code === "ENOENT") return null;
20679
+ throw error;
20680
+ }
20681
+ const lines = content.split("\n").map((line) => line.trim()).filter((line) => line.length > 0);
20682
+ for (let index = lines.length - 1; index >= 0; index -= 1) {
20683
+ const line = lines[index];
20684
+ if (!line) continue;
20685
+ try {
20686
+ const parsed = JSON.parse(line);
20687
+ if (isDaemonLifecycleEvent(parsed) && input.typeFilter.has(parsed.type)) return parsed;
20688
+ } catch {}
20689
+ }
20690
+ return null;
20691
+ }
20692
+ async function readRecentDaemonLifecycleEvents(input) {
20693
+ if (input.maxEntries <= 0) return [];
20694
+ const journalPath = daemonLifecycleJournalPath(input.pathInput);
20695
+ let content;
20696
+ try {
20697
+ content = await readFile(journalPath, "utf8");
20698
+ } catch (error) {
20699
+ if (error.code === "ENOENT") return [];
20700
+ throw error;
20701
+ }
20702
+ const lines = content.split("\n").map((line) => line.trim()).filter((line) => line.length > 0);
20703
+ const recent = [];
20704
+ for (let index = lines.length - 1; index >= 0; index -= 1) {
20705
+ const line = lines[index];
20706
+ if (!line) continue;
20707
+ try {
20708
+ const parsed = JSON.parse(line);
20709
+ if (isDaemonLifecycleEvent(parsed)) {
20710
+ recent.push(parsed);
20711
+ if (recent.length >= input.maxEntries) break;
20712
+ }
20713
+ } catch {}
20714
+ }
20715
+ return recent.reverse();
20716
+ }
20717
+ async function resolveRecentDaemonSignalStopCause(input = {}) {
20718
+ const nowMs = Date.now();
20719
+ const maxAgeMs = input.maxAgeMs ?? 3e4;
20720
+ const events = await readRecentDaemonLifecycleEvents({
20721
+ maxEntries: 32,
20722
+ pathInput: input.pathInput
20723
+ });
20724
+ for (const event of events.toReversed()) {
20725
+ const eventAtMs = Date.parse(event.timestamp);
20726
+ if (!Number.isFinite(eventAtMs) || nowMs - eventAtMs < 0 || nowMs - eventAtMs > maxAgeMs) continue;
20727
+ if (event.stopCause === "user_stop" || event.stopCause === "controlled_service_update") return event.stopCause;
20728
+ }
20729
+ return "unknown";
20730
+ }
20731
+ function formatDaemonLifecycleOriginSummary(event) {
20732
+ const intent = formatDaemonLifecycleIntent(event.intent);
20733
+ return `${event.result} ${intent} from ${event.command} at ${event.timestamp} (pid ${event.pid})`;
20734
+ }
20735
+ function formatDaemonLifecycleIntent(intent) {
20736
+ if (intent === "unknown") return "OpenMeld Service task";
20737
+ return intent.replaceAll("_", " ");
20738
+ }
20739
+ //#endregion
20415
20740
  //#region src/local-service/lifecycle/daemon-service-bundle.ts
20416
20741
  const DAEMON_ACTIVE_BUNDLE_SCHEMA = "openmeld-daemon-active-bundle-v2";
20417
20742
  const DAEMON_ACTIVE_BUNDLE_LEGACY_SCHEMA = "openmeld-daemon-active-bundle-v1";
@@ -20430,8 +20755,17 @@ function daemonServiceLauncherPath(pathInput = {}) {
20430
20755
  function daemonServiceExecutableWrapperPath(pathInput = {}) {
20431
20756
  return daemonServiceStableExecutableWrapperPath(pathInput);
20432
20757
  }
20758
+ function daemonServiceBinaryExecutablePath(pathInput = {}) {
20759
+ return daemonServiceStableBinaryExecutablePath(pathInput);
20760
+ }
20761
+ function daemonServiceUpdateWorkerBinaryPath(pathInput = {}) {
20762
+ return daemonServiceUpdateWorkerBinaryExecutablePath(pathInput);
20763
+ }
20433
20764
  function daemonServiceExecutableWrapperPaths(pathInput = {}) {
20434
- return daemonServiceRecognizedExecutableWrapperPaths(pathInput);
20765
+ return daemonServiceExecutableWrapperPaths$1(pathInput);
20766
+ }
20767
+ function daemonServiceRecognizedExecutablePaths(pathInput = {}) {
20768
+ return daemonServiceRecognizedExecutablePaths$1(pathInput);
20435
20769
  }
20436
20770
  function daemonServiceLegacyWrapperPath(pathInput = {}) {
20437
20771
  return daemonServiceLegacyExecutableWrapperPath(pathInput);
@@ -20522,7 +20856,7 @@ async function resolveCurrentDaemonFingerprintForState(state) {
20522
20856
  async function resolveDaemonBundleEntryPathFromState(state, pathInput = {}) {
20523
20857
  if (!state) return null;
20524
20858
  if (state.bundleFormat === "binary_v1") {
20525
- const stableExecutablePath = daemonServiceExecutableWrapperPath(pathInput);
20859
+ const stableExecutablePath = daemonServiceBinaryExecutablePath(pathInput);
20526
20860
  if (await pathExists$5(stableExecutablePath)) return stableExecutablePath;
20527
20861
  return await pathExists$5(state.sourceEntryScriptPath) ? state.sourceEntryScriptPath : null;
20528
20862
  }
@@ -20640,28 +20974,130 @@ async function hashDaemonBinaryFile(filePath) {
20640
20974
  hash.update(await readFile(filePath));
20641
20975
  return hash.digest("hex");
20642
20976
  }
20977
+ async function runAuditedServiceManagerCarrierMutation(input) {
20978
+ const pathInput = input.pathInput ?? {};
20979
+ const metadata = {
20980
+ distribution: input.distribution ?? resolveOpenMeldDistribution(),
20981
+ executable: process$1.execPath,
20982
+ operation: input.operation,
20983
+ preset: resolveOpenMeldEnvPreset(pathInput),
20984
+ targetPath: input.targetPath
20985
+ };
20986
+ await emitDaemonLifecycleEvent({
20987
+ command: "openmeld service carrier mutation",
20988
+ intent: "status_cleanup",
20989
+ metadata,
20990
+ pathInput,
20991
+ result: "attempted",
20992
+ type: "service_manager.registration_reconcile"
20993
+ });
20994
+ try {
20995
+ const result = await input.run();
20996
+ await emitDaemonLifecycleEvent({
20997
+ command: "openmeld service carrier mutation",
20998
+ intent: "status_cleanup",
20999
+ metadata,
21000
+ pathInput,
21001
+ result: "completed",
21002
+ type: "service_manager.registration_reconcile"
21003
+ });
21004
+ return result;
21005
+ } catch (error) {
21006
+ await emitDaemonLifecycleEvent({
21007
+ command: "openmeld service carrier mutation",
21008
+ intent: "status_cleanup",
21009
+ metadata: {
21010
+ ...metadata,
21011
+ errorMessage: error instanceof Error ? error.message : String(error)
21012
+ },
21013
+ pathInput,
21014
+ result: "failed",
21015
+ type: "service_manager.registration_reconcile"
21016
+ });
21017
+ throw error;
21018
+ }
21019
+ }
20643
21020
  async function ensureDaemonServiceStableBinaryExecutable(pathInput = {}) {
20644
21021
  const activeBundle = await readDaemonActiveBundleState();
20645
21022
  if (activeBundle?.bundleFormat !== "binary_v1") throw new Error("OpenMeld cannot prepare the stable macOS Service executable without an active binary bundle.");
20646
- const sourcePath = activeBundle.sourceEntryScriptPath;
20647
- const expectedFingerprint = activeBundle.sourceDistFingerprint ?? await hashDaemonBinaryFile(sourcePath);
20648
- const stableExecutablePath = daemonServiceExecutableWrapperPath(pathInput);
21023
+ return await ensureVerifiedBinaryCarrier({
21024
+ bundle: activeBundle,
21025
+ operationName: "stable_binary",
21026
+ pathInput,
21027
+ targetPath: daemonServiceBinaryExecutablePath(pathInput)
21028
+ });
21029
+ }
21030
+ async function ensureDaemonServiceUpdateWorkerBinaryExecutable(preparedBundle, pathInput = {}) {
21031
+ if (preparedBundle.bundleFormat !== "binary_v1") throw new Error("OpenMeld cannot prepare the update worker binary without a binary Service bundle.");
21032
+ return await ensureVerifiedBinaryCarrier({
21033
+ bundle: preparedBundle,
21034
+ operationName: "update_worker_binary",
21035
+ pathInput,
21036
+ targetPath: daemonServiceUpdateWorkerBinaryPath(pathInput)
21037
+ });
21038
+ }
21039
+ async function clearDaemonServiceUpdateWorkerBinaryExecutable(pathInput = {}) {
21040
+ const targetPath = daemonServiceUpdateWorkerBinaryPath(pathInput);
21041
+ await runAuditedServiceManagerCarrierMutation({
21042
+ distribution: "binary",
21043
+ operation: "remove_update_worker_binary",
21044
+ pathInput,
21045
+ targetPath,
21046
+ run: async () => await rm(targetPath, { force: true })
21047
+ });
21048
+ }
21049
+ async function ensureVerifiedBinaryCarrier(input) {
21050
+ const sourcePath = input.bundle.sourceEntryScriptPath;
21051
+ const expectedFingerprint = input.bundle.sourceDistFingerprint ?? await hashDaemonBinaryFile(sourcePath);
21052
+ const stableExecutablePath = input.targetPath;
20649
21053
  const stableExecutableStat = await lstat(stableExecutablePath).catch(() => null);
20650
21054
  if (stableExecutableStat?.isFile() === true && !stableExecutableStat.isSymbolicLink() && await hashDaemonBinaryFile(stableExecutablePath).catch(() => null) === expectedFingerprint) {
20651
- await chmod(stableExecutablePath, 448);
21055
+ await runAuditedServiceManagerCarrierMutation({
21056
+ distribution: "binary",
21057
+ operation: `refresh_${input.operationName}_permissions`,
21058
+ pathInput: input.pathInput,
21059
+ targetPath: stableExecutablePath,
21060
+ run: async () => await chmod(stableExecutablePath, 448)
21061
+ });
20652
21062
  return stableExecutablePath;
20653
21063
  }
20654
21064
  await mkdir(dirname(stableExecutablePath), { recursive: true });
20655
21065
  const preparedPath = `${stableExecutablePath}.next-${String(process$1.pid)}`;
20656
- await rm(preparedPath, { force: true });
21066
+ await runAuditedServiceManagerCarrierMutation({
21067
+ distribution: "binary",
21068
+ operation: `clear_prepared_${input.operationName}`,
21069
+ pathInput: input.pathInput,
21070
+ targetPath: preparedPath,
21071
+ run: async () => await rm(preparedPath, { force: true })
21072
+ });
20657
21073
  try {
20658
- await copyFile(sourcePath, preparedPath);
20659
- await chmod(preparedPath, 448);
20660
- if (await hashDaemonBinaryFile(preparedPath) !== expectedFingerprint) throw new Error("OpenMeld could not verify the prepared stable macOS Service executable.");
20661
- await rename(preparedPath, stableExecutablePath);
21074
+ await runAuditedServiceManagerCarrierMutation({
21075
+ distribution: "binary",
21076
+ operation: `prepare_${input.operationName}`,
21077
+ pathInput: input.pathInput,
21078
+ targetPath: preparedPath,
21079
+ run: async () => {
21080
+ await copyFile(sourcePath, preparedPath);
21081
+ await chmod(preparedPath, 448);
21082
+ }
21083
+ });
21084
+ if (await hashDaemonBinaryFile(preparedPath) !== expectedFingerprint) throw new Error("OpenMeld could not verify the prepared Service carrier executable.");
21085
+ await runAuditedServiceManagerCarrierMutation({
21086
+ distribution: "binary",
21087
+ operation: `replace_${input.operationName}`,
21088
+ pathInput: input.pathInput,
21089
+ targetPath: stableExecutablePath,
21090
+ run: async () => await rename(preparedPath, stableExecutablePath)
21091
+ });
20662
21092
  return stableExecutablePath;
20663
21093
  } finally {
20664
- await rm(preparedPath, { force: true }).catch(() => void 0);
21094
+ await runAuditedServiceManagerCarrierMutation({
21095
+ distribution: "binary",
21096
+ operation: `clear_prepared_${input.operationName}`,
21097
+ pathInput: input.pathInput,
21098
+ targetPath: preparedPath,
21099
+ run: async () => await rm(preparedPath, { force: true })
21100
+ }).catch(() => void 0);
20665
21101
  }
20666
21102
  }
20667
21103
  async function verifyDaemonActiveBundleIntegrity(activeBundle) {
@@ -20717,19 +21153,34 @@ async function copyDaemonBundleDependencyDirectory(input) {
20717
21153
  }
20718
21154
  async function writeDaemonServiceLauncher(pathInput = {}) {
20719
21155
  await mkdir(daemonRuntimeServiceManagerPath(pathInput), { recursive: true });
20720
- await writeFile(daemonServiceLauncherPath(pathInput), `${buildDaemonServiceLauncherSource(pathInput)}\n`, {
20721
- encoding: "utf8",
20722
- mode: 448
21156
+ const targetPath = daemonServiceLauncherPath(pathInput);
21157
+ await runAuditedServiceManagerCarrierMutation({
21158
+ distribution: "npm",
21159
+ operation: "write_launcher",
21160
+ pathInput,
21161
+ targetPath,
21162
+ run: async () => await writeFile(targetPath, `${buildDaemonServiceLauncherSource(pathInput)}\n`, {
21163
+ encoding: "utf8",
21164
+ mode: 448
21165
+ })
20723
21166
  });
20724
21167
  }
20725
21168
  async function writeDaemonServiceExecutableWrapper(pathInput = {}) {
20726
21169
  await mkdir(daemonRuntimeServiceManagerPath(pathInput), { recursive: true });
20727
21170
  await Promise.all(daemonServiceExecutableWrapperPaths(pathInput).map(async (wrapperPath) => {
20728
- await writeFile(wrapperPath, `${buildDaemonServiceExecutableWrapperSource(pathInput)}\n`, {
20729
- encoding: "utf8",
20730
- mode: 448
21171
+ await runAuditedServiceManagerCarrierMutation({
21172
+ distribution: "npm",
21173
+ operation: "write_executable_wrapper",
21174
+ pathInput,
21175
+ targetPath: wrapperPath,
21176
+ run: async () => {
21177
+ await writeFile(wrapperPath, `${buildDaemonServiceExecutableWrapperSource(pathInput)}\n`, {
21178
+ encoding: "utf8",
21179
+ mode: 448
21180
+ });
21181
+ await chmod(wrapperPath, 448);
21182
+ }
20731
21183
  });
20732
- await chmod(wrapperPath, 448);
20733
21184
  }));
20734
21185
  }
20735
21186
  async function ensureDaemonServiceManagerExecutables(pathInput = {}) {
@@ -21537,7 +21988,7 @@ function resolveDaemonServiceProcessMode(serviceArguments) {
21537
21988
  }
21538
21989
  function isRecognizedDaemonServiceExecutableWrapperPath(token, pathInput) {
21539
21990
  const normalizedToken = normalizeDaemonCommandPath(token);
21540
- return daemonServiceRecognizedExecutableWrapperPaths(pathInput).some((wrapperPath) => {
21991
+ return daemonServiceRecognizedExecutablePaths$1(pathInput).some((wrapperPath) => {
21541
21992
  const normalizedWrapperPath = normalizeDaemonCommandPath(wrapperPath);
21542
21993
  return normalizedToken === normalizedWrapperPath || normalizedToken.endsWith(`/${normalizeDaemonCommandPath(basename(wrapperPath))}`);
21543
21994
  });
@@ -21548,7 +21999,7 @@ function extractUnquotedDaemonWrapperPath(command, pathInput) {
21548
21999
  if (serviceRunIndex <= 0) return null;
21549
22000
  const commandPrefix = command.slice(0, serviceRunIndex);
21550
22001
  const normalizedPrefix = normalizedCommand.slice(0, serviceRunIndex);
21551
- for (const wrapperPath of daemonServiceRecognizedExecutableWrapperPaths(pathInput)) {
22002
+ for (const wrapperPath of daemonServiceRecognizedExecutablePaths$1(pathInput)) {
21552
22003
  const normalizedWrapperPath = normalizeDaemonCommandPath(wrapperPath);
21553
22004
  const wrapperPathIndex = normalizedPrefix.lastIndexOf(normalizedWrapperPath);
21554
22005
  if (wrapperPathIndex >= 0 && daemonCommandContainsExactPath(commandPrefix, wrapperPath)) return commandPrefix.slice(wrapperPathIndex, wrapperPathIndex + normalizedWrapperPath.length);
@@ -22893,7 +23344,7 @@ function matchesExpectedDaemonServiceManagerCommand(input) {
22893
23344
  if (input.controller === "windows-service") return typeof input.definitionPath === "string" && input.definitionPath.length > 0 && input.commandSummary.includes(input.definitionPath);
22894
23345
  if ((input.distribution ?? resolveOpenMeldDistribution()) === "binary") {
22895
23346
  if (input.controller === "launchd") {
22896
- const stableExecutablePath = daemonServiceExecutableWrapperPath(input.pathInput);
23347
+ const stableExecutablePath = daemonServiceBinaryExecutablePath(input.pathInput);
22897
23348
  return [
22898
23349
  `${stableExecutablePath} service run`,
22899
23350
  `"${stableExecutablePath}" service run`,
@@ -22914,7 +23365,7 @@ async function matchesExpectedDaemonServiceManagerDefinition(input) {
22914
23365
  if (definition === null) return false;
22915
23366
  if ((input.distribution ?? resolveOpenMeldDistribution()) === "binary") {
22916
23367
  if (input.controller === "launchd") {
22917
- const stableExecutablePath = daemonServiceExecutableWrapperPath(input.pathInput);
23368
+ const stableExecutablePath = daemonServiceBinaryExecutablePath(input.pathInput);
22918
23369
  return definition.includes(`<string>${stableExecutablePath}</string>`);
22919
23370
  }
22920
23371
  return containsOpenMeldManagedBinaryPath(definition, input.pathInput);
@@ -22953,7 +23404,7 @@ function classifyDaemonOwnedProcess(processInfo, ignoredProcessIds, pathInput =
22953
23404
  if (ignoredProcessIds.has(processInfo.pid)) return null;
22954
23405
  const normalizedCommand = normalizeProcessCommand(processInfo.command);
22955
23406
  const launcherPath = normalizeProcessCommand(daemonServiceLauncherPath(pathInput));
22956
- const wrapperPaths = daemonServiceExecutableWrapperPaths(pathInput).map(normalizeProcessCommand);
23407
+ const wrapperPaths = daemonServiceRecognizedExecutablePaths(pathInput).map(normalizeProcessCommand);
22957
23408
  if (wrapperPaths.some((wrapperPath) => normalizedCommand.includes(wrapperPath) && !daemonCommandContainsExactPath(normalizedCommand, wrapperPath))) return null;
22958
23409
  if (!looksLikeCurrentLaneDaemonCandidate({
22959
23410
  launcherPath,
@@ -23034,7 +23485,7 @@ function resolveManagedDaemonPathLane(input) {
23034
23485
  for (const preset of ALL_OPENMELD_ENV_PRESETS) {
23035
23486
  const lanePathInput = resolveLanePathInput(input.pathInput, preset);
23036
23487
  const laneLauncherPath = normalizeProcessCommand(daemonServiceLauncherPath(lanePathInput));
23037
- const laneWrapperPaths = daemonServiceExecutableWrapperPaths(lanePathInput).map(normalizeProcessCommand);
23488
+ const laneWrapperPaths = daemonServiceRecognizedExecutablePaths(lanePathInput).map(normalizeProcessCommand);
23038
23489
  const laneRuntimeRoot = normalizeProcessCommand(daemonRuntimeRootPath(lanePathInput));
23039
23490
  if (input.normalizedCommand.includes(laneLauncherPath) || laneWrapperPaths.some((wrapperPath) => daemonCommandContainsExactPath(input.normalizedCommand, wrapperPath)) || input.normalizedCommand.includes(laneRuntimeRoot) || containsOpenMeldManagedBinaryPath(input.normalizedCommand, lanePathInput)) return preset;
23040
23491
  }
@@ -23159,7 +23610,7 @@ const PROD_ENV_PRESET = "prod";
23159
23610
  function shouldInspectLegacySharedDaemonService(input = {}) {
23160
23611
  const env = input.env ?? process.env;
23161
23612
  if (String(env["OPENMELD_HOME"] ?? "").trim()) return false;
23162
- return resolveOpenMeldEnvPreset(input) !== PROD_ENV_PRESET;
23613
+ return resolveOpenMeldEnvPreset(input) === PROD_ENV_PRESET;
23163
23614
  }
23164
23615
  function resolveLegacySharedDaemonPathInput(input = {}) {
23165
23616
  if (!shouldInspectLegacySharedDaemonService(input)) return null;
@@ -23426,7 +23877,7 @@ async function waitForDaemonSystemServiceToStop(input) {
23426
23877
  const deadlineMs = Date.now() + waitMs;
23427
23878
  while (Date.now() < deadlineMs) {
23428
23879
  const currentRuntime = await readCurrentObservedDaemonRuntimeStatus().catch(() => null);
23429
- if (!(await input.manager.status().catch(() => null))?.running && currentRuntime?.status !== "running") return true;
23880
+ if ((await input.manager.status().catch(() => null))?.running === false && currentRuntime !== null && currentRuntime.status !== "running") return true;
23430
23881
  if (currentRuntime?.status === "stale" && !currentRuntime.managedBySystemService) return true;
23431
23882
  if (currentRuntime?.status === "not_running") return true;
23432
23883
  await sleep(pollMs);
@@ -23435,11 +23886,12 @@ async function waitForDaemonSystemServiceToStop(input) {
23435
23886
  if (finalRuntime?.status === "not_running") return true;
23436
23887
  if (finalRuntime?.status === "stale" && !finalRuntime.managedBySystemService) return true;
23437
23888
  if (finalRuntime?.status === "running") return false;
23438
- return (await input.manager.status().catch(() => null))?.running !== true;
23889
+ if (finalRuntime === null) return false;
23890
+ return (await input.manager.status().catch(() => null))?.running === false;
23439
23891
  }
23440
23892
  async function readObservedRuntimeState() {
23441
23893
  const ignoredProcessIds = [process$1.pid, process$1.ppid].filter((pid) => Number.isInteger(pid) && pid > 0);
23442
- const [runtimeLease, ownedProcesses] = await Promise.all([readDaemonRuntimeLease().catch(() => null), listDaemonOwnedProcesses({ ignoreProcessIds: ignoredProcessIds }).catch(() => [])]);
23894
+ const [runtimeLease, ownedProcesses] = await Promise.all([readDaemonRuntimeLease().catch(() => null), listDaemonOwnedProcesses({ ignoreProcessIds: ignoredProcessIds })]);
23443
23895
  return resolveObservedDaemonRuntimeStatus({
23444
23896
  runtimeLease,
23445
23897
  ownedProcesses
@@ -23597,7 +24049,7 @@ async function inspectDaemonServiceInventory(input) {
23597
24049
  inspectLegacySharedDaemonService(),
23598
24050
  readDaemonActiveBundleState(),
23599
24051
  readDaemonServiceLifecycleLockMetaWithCleanup(),
23600
- listOwnedProcesses({ ignoreProcessIds: ignoredInventoryProcessIds }).catch(() => [])
24052
+ listOwnedProcesses({ ignoreProcessIds: ignoredInventoryProcessIds })
23601
24053
  ]);
23602
24054
  const activeBundleSourceAvailable = await resolveActiveBundleSourceAvailability(activeBundle);
23603
24055
  const runtimeStatus = resolveObservedDaemonRuntimeStatus({
@@ -24507,23 +24959,23 @@ const SETUP_FLOW_COPY = {
24507
24959
  verify_setup: "Checking setup."
24508
24960
  },
24509
24961
  prepareComputerBlockedSummary: "Setup needs attention.",
24510
- prepareComputerCompleteSummary: "Computer set up.",
24511
- prepareComputerDefaultActiveSummary: "Setting up this computer.",
24512
- prepareComputerNoLocalAgentsSummary: "No local agents selected.",
24962
+ prepareComputerCompleteSummary: "Computer connected.",
24963
+ prepareComputerDefaultActiveSummary: "Connecting this computer.",
24964
+ prepareComputerNoLocalAgentsSummary: "Computer connected. Local agents are syncing in the background.",
24513
24965
  prepareComputerPendingSummary: "Waiting for Terminal.",
24514
24966
  prepareComputerTerminalDisconnectedSummary: "Terminal disconnected. Run a fresh setup command.",
24515
24967
  prepareComputerTitle: "Connect this computer",
24516
- readyAccountComputerActionSummary: "Setup complete. Back to Computers, or run setup again.",
24517
- readyCompleteSummary: "Setup complete.",
24518
- readyDefaultActionSummary: "Continue, or run setup again.",
24968
+ readyAccountComputerActionSummary: "Computer connected. Back to Computers, or reconnect this computer.",
24969
+ readyCompleteSummary: "Computer connected.",
24970
+ readyDefaultActionSummary: "Continue, or reconnect this computer.",
24519
24971
  readyIncompleteSummary: "Setup not finished yet.",
24520
- readyNoSelectedLocalAgentsActionSummary: "No local agents selected. Continue, or run setup again.",
24521
- readyNoSelectedLocalAgentsSummary: "Setup complete. No local agents selected.",
24522
- readyRefreshPendingActionSummary: "Continue after the check, or run setup again.",
24523
- readyRefreshErrorSummary: "Setup complete. Wake availability could not refresh.",
24524
- readyRefreshPendingSummary: "Checking Wake availability.",
24525
- readySpaceRecoveryActionSummary: "Setup complete. Back to Space, or run setup again.",
24526
- readyTitle: "Setup complete 🎉",
24972
+ readyNoSelectedLocalAgentsActionSummary: "Computer connected. Local agents will sync in the background. Continue, or reconnect this computer.",
24973
+ readyNoSelectedLocalAgentsSummary: "Computer connected. Local agents will sync in the background.",
24974
+ readyRefreshPendingActionSummary: "Continue after the check, or reconnect this computer.",
24975
+ readyRefreshErrorSummary: "Computer connected. Agent availability could not refresh.",
24976
+ readyRefreshPendingSummary: "Checking agent availability.",
24977
+ readySpaceRecoveryActionSummary: "Computer connected. Back to Space, or reconnect this computer.",
24978
+ readyTitle: "Computer connected",
24527
24979
  cliAiAgentHintTemplate: "AI setup agents: run {command} for setup.complete.",
24528
24980
  cliBootstrapRepairStatus: "Preparing OpenMeld...",
24529
24981
  cliBootstrapRunStatus: "Starting OpenMeld...",
@@ -36476,7 +36928,7 @@ async function resolveAgentTargetState(rawAgentId, states) {
36476
36928
  if (custom) return await toAgentTargetState(custom, registrationById.get(custom.agentId) ?? null);
36477
36929
  return null;
36478
36930
  }
36479
- async function updateAgentRegistrations(updater) {
36931
+ async function updateAgentRegistrations(updater, options = {}) {
36480
36932
  let nextRegistrations = [];
36481
36933
  try {
36482
36934
  await updateConfiguredDeviceRuntimeState((currentConfig) => {
@@ -36486,10 +36938,10 @@ async function updateAgentRegistrations(updater) {
36486
36938
  } catch (error) {
36487
36939
  throw wrapConfigError(error, "agents.config_write_failed");
36488
36940
  }
36489
- await notifyDaemonRouteCatalogChanged({ reason: "device_runtime_state_updated" }).catch(() => void 0);
36941
+ if (options.notifyRouteCatalogChanged !== false) await notifyDaemonRouteCatalogChanged({ reason: "device_runtime_state_updated" }).catch(() => void 0);
36490
36942
  return nextRegistrations;
36491
36943
  }
36492
- async function reconcileNewRunnableBuiltinAgentsForSetup(input = {}) {
36944
+ async function reconcileNewRunnableBuiltinAgentRegistrations(input = {}) {
36493
36945
  const runnableBuiltins = (input.states ?? await listAgentTargetStates()).filter(isRunnableBuiltinForAutomaticSetup).sort((left, right) => compareAgentControllerRefsForDisplay(left.agentId, right.agentId));
36494
36946
  const result = {
36495
36947
  registeredAgentIds: [],
@@ -36516,9 +36968,12 @@ async function reconcileNewRunnableBuiltinAgentsForSetup(input = {}) {
36516
36968
  result.registeredAgentIds.push(state.agentId);
36517
36969
  }
36518
36970
  return next;
36519
- });
36971
+ }, { notifyRouteCatalogChanged: input.notifyRouteCatalogChanged });
36520
36972
  return result;
36521
36973
  }
36974
+ async function reconcileNewRunnableBuiltinAgentsForSetup(input = {}) {
36975
+ return await reconcileNewRunnableBuiltinAgentRegistrations(input);
36976
+ }
36522
36977
  async function listAgentCustomTargets() {
36523
36978
  return normalizeCustomTargets((await getConfiguredSkillsConfig().catch((error) => {
36524
36979
  throw wrapConfigError(error, "agents.config_read_failed");
@@ -38876,261 +39331,6 @@ function buildRouteCatalogFingerprint(routeCatalog) {
38876
39331
  });
38877
39332
  }
38878
39333
  //#endregion
38879
- //#region src/local-service/lifecycle/daemon-lifecycle-journal.ts
38880
- const DAEMON_LIFECYCLE_EVENT_TYPES = [
38881
- "connection.state",
38882
- "daemon.crash",
38883
- "lifecycle.command.begin",
38884
- "lifecycle.command.end",
38885
- "owner.snapshot",
38886
- "route_catalog.initial_load",
38887
- "runtime_state.takeover",
38888
- "stop.controlled_drain",
38889
- "stop.strategy.selected",
38890
- "service_manager.action",
38891
- "service_manager.registration_reconcile",
38892
- "process_stop.action",
38893
- "service_contract.write",
38894
- "stop.signal.observed"
38895
- ];
38896
- const DAEMON_STOP_CAUSES = [
38897
- "user_stop",
38898
- "controlled_service_update",
38899
- "service_crash",
38900
- "network_disconnect",
38901
- "unknown"
38902
- ];
38903
- function toJournalErrorMessage$1(error) {
38904
- return error instanceof Error ? error.message : String(error);
38905
- }
38906
- function normalizeSessionId(value) {
38907
- const normalized = typeof value === "string" ? value.trim() : "";
38908
- return normalized.length > 0 ? normalized : null;
38909
- }
38910
- function resolveDaemonStopCause(input) {
38911
- if (input.explicitCause) return input.explicitCause;
38912
- if (input.type === "daemon.crash") return "service_crash";
38913
- if (input.intent === "stop") return "user_stop";
38914
- if (input.intent === "upgrade_reconcile" || input.intent === "reinstall" || input.intent === "startup_check" || input.intent === "status_cleanup") return "controlled_service_update";
38915
- if (input.type === "connection.state" && input.result !== "connected" && input.result !== "stopping") return "network_disconnect";
38916
- return "unknown";
38917
- }
38918
- function isDaemonLifecycleEvent(event) {
38919
- if (typeof event !== "object" || event === null) return false;
38920
- const candidate = event;
38921
- return candidate.schema === "openmeld-daemon-lifecycle-event-v1" && candidate.v === 1 && DAEMON_LIFECYCLE_EVENT_TYPES.includes(candidate.type) && typeof candidate.timestamp === "string" && candidate.timestamp.length > 0 && typeof candidate.lane === "string" && candidate.lane.length > 0 && typeof candidate.intent === "string" && candidate.intent.length > 0 && typeof candidate.command === "string" && candidate.command.length > 0 && typeof candidate.pid === "number" && Number.isInteger(candidate.pid) && candidate.pid > 0 && (candidate.sessionId === null || typeof candidate.sessionId === "string" && candidate.sessionId.length > 0) && (candidate.stopCause === void 0 || DAEMON_STOP_CAUSES.includes(candidate.stopCause)) && typeof candidate.result === "string" && candidate.result.length > 0;
38922
- }
38923
- async function resolveDaemonLifecycleAttribution(input) {
38924
- const lockMeta = await readDaemonServiceLifecycleLockMeta().catch(() => null);
38925
- return {
38926
- command: input.command?.trim() || (typeof lockMeta?.command === "string" ? lockMeta.command.trim() : "") || "unknown",
38927
- intent: input.intent ?? (typeof lockMeta?.intent === "string" ? lockMeta.intent : "unknown"),
38928
- lane: resolveOpenMeldEnvPreset(input.pathInput),
38929
- pid: typeof lockMeta?.pid === "number" && lockMeta.pid > 0 ? lockMeta.pid : process$1.pid,
38930
- sessionId: normalizeSessionId(lockMeta?.sessionId) ?? resolveCliContextId()
38931
- };
38932
- }
38933
- async function emitDaemonLifecycleEvent(input) {
38934
- assertNoPublishedProductionMutationDuringTests(input.pathInput ?? {}, "OpenMeld Service lifecycle journal");
38935
- const journalPath = daemonLifecycleJournalPath(input.pathInput);
38936
- const attribution = await resolveDaemonLifecycleAttribution(input);
38937
- const event = {
38938
- schema: "openmeld-daemon-lifecycle-event-v1",
38939
- v: 1,
38940
- type: input.type,
38941
- timestamp: (/* @__PURE__ */ new Date()).toISOString(),
38942
- lane: attribution.lane,
38943
- intent: attribution.intent,
38944
- command: attribution.command,
38945
- pid: attribution.pid,
38946
- sessionId: attribution.sessionId,
38947
- stopCause: resolveDaemonStopCause({
38948
- explicitCause: input.stopCause,
38949
- intent: attribution.intent,
38950
- result: input.result,
38951
- type: input.type
38952
- }),
38953
- result: input.result,
38954
- ...input.metadata ? { metadata: input.metadata } : {}
38955
- };
38956
- if (!isDaemonLifecycleEvent(event)) {
38957
- console.warn(`[openmeld:lifecycle-journal] rejected invalid event ${input.type}`);
38958
- return;
38959
- }
38960
- try {
38961
- await mkdir(dirname(journalPath), { recursive: true });
38962
- await appendFile(journalPath, `${JSON.stringify(event)}\n`, "utf8");
38963
- } catch (error) {
38964
- console.warn(`[openmeld:lifecycle-journal] failed to append event ${input.type}: ${toJournalErrorMessage$1(error)}`);
38965
- }
38966
- }
38967
- async function runWithDaemonLifecycleCommandJournal(input) {
38968
- await emitDaemonLifecycleEvent({
38969
- type: "lifecycle.command.begin",
38970
- result: "started",
38971
- metadata: input.includeProcessUptime ? {
38972
- ...input.metadata,
38973
- processUptimeMs: Math.round(process$1.uptime() * 1e3)
38974
- } : input.metadata,
38975
- pathInput: input.pathInput,
38976
- command: input.command,
38977
- intent: input.intent
38978
- });
38979
- try {
38980
- const result = await input.run();
38981
- const resolvedResult = input.resolveResult?.(result) ?? { result: "completed" };
38982
- await emitDaemonLifecycleEvent({
38983
- type: "lifecycle.command.end",
38984
- result: resolvedResult.result,
38985
- metadata: resolvedResult.metadata,
38986
- pathInput: input.pathInput,
38987
- command: input.command,
38988
- intent: input.intent
38989
- });
38990
- return result;
38991
- } catch (error) {
38992
- await emitDaemonLifecycleEvent({
38993
- type: "lifecycle.command.end",
38994
- result: "failed",
38995
- metadata: { errorMessage: toJournalErrorMessage$1(error) },
38996
- pathInput: input.pathInput,
38997
- command: input.command,
38998
- intent: input.intent
38999
- });
39000
- throw error;
39001
- }
39002
- }
39003
- async function runDaemonServiceManagerAction(input) {
39004
- const startedAtMs = Date.now();
39005
- try {
39006
- const result = await input.run();
39007
- await emitDaemonLifecycleEvent({
39008
- type: "service_manager.action",
39009
- result: "completed",
39010
- metadata: {
39011
- action: input.action,
39012
- controller: input.controller,
39013
- durationMs: Date.now() - startedAtMs,
39014
- ...input.metadata ?? {}
39015
- },
39016
- pathInput: input.pathInput,
39017
- command: input.command,
39018
- intent: input.intent
39019
- });
39020
- return result;
39021
- } catch (error) {
39022
- let errorMetadata = null;
39023
- try {
39024
- errorMetadata = input.resolveErrorMetadata?.(error) ?? null;
39025
- } catch {
39026
- errorMetadata = null;
39027
- }
39028
- await emitDaemonLifecycleEvent({
39029
- type: "service_manager.action",
39030
- result: "failed",
39031
- metadata: {
39032
- action: input.action,
39033
- controller: input.controller,
39034
- durationMs: Date.now() - startedAtMs,
39035
- errorMessage: toJournalErrorMessage$1(error),
39036
- ...errorMetadata ?? {},
39037
- ...input.metadata ?? {}
39038
- },
39039
- pathInput: input.pathInput,
39040
- command: input.command,
39041
- intent: input.intent
39042
- });
39043
- throw error;
39044
- }
39045
- }
39046
- const DAEMON_LIFECYCLE_ORIGIN_EVENT_TYPES = /* @__PURE__ */ new Set([
39047
- "daemon.crash",
39048
- "lifecycle.command.end",
39049
- "process_stop.action",
39050
- "runtime_state.takeover",
39051
- "service_contract.write",
39052
- "service_manager.action"
39053
- ]);
39054
- async function readLatestDaemonLifecycleOriginEvent(input = {}) {
39055
- return await readLatestDaemonLifecycleEvent({
39056
- pathInput: input.pathInput,
39057
- typeFilter: DAEMON_LIFECYCLE_ORIGIN_EVENT_TYPES
39058
- });
39059
- }
39060
- async function readLatestDaemonLifecycleConnectionStateEvent(input = {}) {
39061
- return await readLatestDaemonLifecycleEvent({
39062
- pathInput: input.pathInput,
39063
- typeFilter: /* @__PURE__ */ new Set(["connection.state"])
39064
- });
39065
- }
39066
- async function readLatestDaemonLifecycleEvent(input) {
39067
- const journalPath = daemonLifecycleJournalPath(input.pathInput);
39068
- let content;
39069
- try {
39070
- content = await readFile(journalPath, "utf8");
39071
- } catch (error) {
39072
- if (error.code === "ENOENT") return null;
39073
- throw error;
39074
- }
39075
- const lines = content.split("\n").map((line) => line.trim()).filter((line) => line.length > 0);
39076
- for (let index = lines.length - 1; index >= 0; index -= 1) {
39077
- const line = lines[index];
39078
- if (!line) continue;
39079
- try {
39080
- const parsed = JSON.parse(line);
39081
- if (isDaemonLifecycleEvent(parsed) && input.typeFilter.has(parsed.type)) return parsed;
39082
- } catch {}
39083
- }
39084
- return null;
39085
- }
39086
- async function readRecentDaemonLifecycleEvents(input) {
39087
- if (input.maxEntries <= 0) return [];
39088
- const journalPath = daemonLifecycleJournalPath(input.pathInput);
39089
- let content;
39090
- try {
39091
- content = await readFile(journalPath, "utf8");
39092
- } catch (error) {
39093
- if (error.code === "ENOENT") return [];
39094
- throw error;
39095
- }
39096
- const lines = content.split("\n").map((line) => line.trim()).filter((line) => line.length > 0);
39097
- const recent = [];
39098
- for (let index = lines.length - 1; index >= 0; index -= 1) {
39099
- const line = lines[index];
39100
- if (!line) continue;
39101
- try {
39102
- const parsed = JSON.parse(line);
39103
- if (isDaemonLifecycleEvent(parsed)) {
39104
- recent.push(parsed);
39105
- if (recent.length >= input.maxEntries) break;
39106
- }
39107
- } catch {}
39108
- }
39109
- return recent.reverse();
39110
- }
39111
- async function resolveRecentDaemonSignalStopCause(input = {}) {
39112
- const nowMs = Date.now();
39113
- const maxAgeMs = input.maxAgeMs ?? 3e4;
39114
- const events = await readRecentDaemonLifecycleEvents({
39115
- maxEntries: 32,
39116
- pathInput: input.pathInput
39117
- });
39118
- for (const event of events.toReversed()) {
39119
- const eventAtMs = Date.parse(event.timestamp);
39120
- if (!Number.isFinite(eventAtMs) || nowMs - eventAtMs < 0 || nowMs - eventAtMs > maxAgeMs) continue;
39121
- if (event.stopCause === "user_stop" || event.stopCause === "controlled_service_update") return event.stopCause;
39122
- }
39123
- return "unknown";
39124
- }
39125
- function formatDaemonLifecycleOriginSummary(event) {
39126
- const intent = formatDaemonLifecycleIntent(event.intent);
39127
- return `${event.result} ${intent} from ${event.command} at ${event.timestamp} (pid ${event.pid})`;
39128
- }
39129
- function formatDaemonLifecycleIntent(intent) {
39130
- if (intent === "unknown") return "OpenMeld Service task";
39131
- return intent.replaceAll("_", " ");
39132
- }
39133
- //#endregion
39134
39334
  //#region src/local-service/lifecycle/local-service-demand.ts
39135
39335
  const QUIET_PRESENTER = {
39136
39336
  view: "agent",
@@ -39138,12 +39338,6 @@ const QUIET_PRESENTER = {
39138
39338
  line: () => void 0,
39139
39339
  data: () => void 0
39140
39340
  };
39141
- const AUTO_STOP_WAIT_MS = 3e3;
39142
- const AUTO_STOP_POLL_MS = 200;
39143
- const NOT_INSTALLED_DAEMON_STATUS = {
39144
- installed: false,
39145
- state: null
39146
- };
39147
39341
  async function resolveLocalServiceDemand(input) {
39148
39342
  const projection = input.projection === void 0 ? await syncDeviceRuntimeStateProjection({
39149
39343
  bindingReads: input.bindingReads,
@@ -39210,7 +39404,7 @@ async function resolveLocalServiceDemand(input) {
39210
39404
  projection
39211
39405
  };
39212
39406
  return {
39213
- decision: "allow_auto_stop",
39407
+ decision: "keep_running",
39214
39408
  hasLocalExecutionRoute: false,
39215
39409
  repairableReplyCandidateCount,
39216
39410
  reason: resolveZeroLocalValueReason(projection),
@@ -39221,117 +39415,6 @@ async function resolveLocalServiceDemand(input) {
39221
39415
  function isRepairableSkippedDaemonProfile(skipReason) {
39222
39416
  return skipReason === "projection.missing" || skipReason === "workspace.missing";
39223
39417
  }
39224
- async function maybeAutoStopIdleLocalService(input) {
39225
- const localDemand = await resolveLocalServiceDemand({
39226
- ownerUserId: input.ownerUserId,
39227
- runtimeWorkdir: input.runtimeWorkdir
39228
- });
39229
- if (localDemand.decision !== "allow_auto_stop") return {
39230
- autoStopped: false,
39231
- effectiveRuntimeStatus: null,
39232
- localDemand
39233
- };
39234
- return await withDaemonServiceRegistrationMutationLock(async () => await stopIdleLocalServiceWithLock(input, localDemand), {
39235
- intent: "status_cleanup",
39236
- command: "openmeld service auto-stop"
39237
- });
39238
- }
39239
- async function stopIdleLocalServiceWithLock(input, localDemand) {
39240
- const status = await getDaemonStatus().catch(() => NOT_INSTALLED_DAEMON_STATUS);
39241
- if (!status.installed) return {
39242
- autoStopped: false,
39243
- effectiveRuntimeStatus: null,
39244
- localDemand
39245
- };
39246
- const ownerSnapshot = await readCurrentDaemonOwnerSnapshot().catch(() => null);
39247
- await emitDaemonLifecycleEvent({
39248
- type: "owner.snapshot",
39249
- result: "observed",
39250
- metadata: ownerSnapshot ? summarizeDaemonOwnerSnapshot(ownerSnapshot) : { reason: "owner_snapshot_unavailable" },
39251
- command: "openmeld service auto-stop",
39252
- intent: "status_cleanup"
39253
- });
39254
- const runtimeState = await resolveDaemonRuntimeState(status);
39255
- if (!(ownerSnapshot && runtimeState) || runtimeState.status !== "running" || runtimeState.mode !== "background" || !ownerSnapshot.mustStopManagerFirst || !ownerSnapshot.serviceManager) return {
39256
- autoStopped: false,
39257
- effectiveRuntimeStatus: runtimeState?.status ?? null,
39258
- localDemand
39259
- };
39260
- const { serviceManager, serviceManagerStatus } = await resolveDaemonServiceManagerForRuntimeState({
39261
- runtimeState,
39262
- status
39263
- });
39264
- const effectiveRuntimeStatus = getEffectiveDaemonRuntimeStatus({
39265
- runtimeState,
39266
- serviceManagerStatus
39267
- });
39268
- if (!serviceManager || effectiveRuntimeStatus !== "running") return {
39269
- autoStopped: false,
39270
- effectiveRuntimeStatus,
39271
- localDemand
39272
- };
39273
- try {
39274
- await runDaemonServiceManagerAction({
39275
- action: "stop",
39276
- command: "openmeld service auto-stop",
39277
- controller: serviceManager.controller,
39278
- intent: "status_cleanup",
39279
- metadata: { localDemandReason: localDemand.reason },
39280
- run: async () => await serviceManager.stop()
39281
- });
39282
- if (!await waitForDaemonSystemServiceToStop({
39283
- manager: serviceManager,
39284
- waitMs: AUTO_STOP_WAIT_MS,
39285
- pollMs: AUTO_STOP_POLL_MS
39286
- })) {
39287
- input.presenter.line({
39288
- code: `${input.codePrefix}.auto_stop_failed`,
39289
- text: "OpenMeld could not auto-stop the background service. Run `openmeld service stop` if you want it off right now."
39290
- });
39291
- return {
39292
- autoStopped: false,
39293
- effectiveRuntimeStatus,
39294
- localDemand
39295
- };
39296
- }
39297
- const finalOwnerSnapshot = await readCurrentDaemonOwnerSnapshot().catch(() => null);
39298
- if (finalOwnerSnapshot && hasActiveDaemonOwners(finalOwnerSnapshot)) {
39299
- input.presenter.line({
39300
- code: `${input.codePrefix}.auto_stop_failed`,
39301
- text: "OpenMeld stopped the system service manager, but local service owners are still active on this device."
39302
- });
39303
- return {
39304
- autoStopped: false,
39305
- effectiveRuntimeStatus,
39306
- localDemand
39307
- };
39308
- }
39309
- await clearDaemonServiceRuntimeState();
39310
- input.presenter.line({
39311
- code: `${input.codePrefix}.auto_stopped`,
39312
- text: formatLocalServiceAutoStoppedMessage(localDemand)
39313
- });
39314
- return {
39315
- autoStopped: true,
39316
- effectiveRuntimeStatus: "not_running",
39317
- localDemand
39318
- };
39319
- } catch (error) {
39320
- input.presenter.line({
39321
- code: `${input.codePrefix}.auto_stop_failed`,
39322
- text: `OpenMeld could not auto-stop the background service. ${toErrorMessage$31(error)}`
39323
- });
39324
- return {
39325
- autoStopped: false,
39326
- effectiveRuntimeStatus,
39327
- localDemand
39328
- };
39329
- }
39330
- }
39331
- function formatLocalServiceAutoStoppedMessage(localDemand) {
39332
- if (localDemand.projection?.status === "ok" && localDemand.projection.projectedControllerIds.length === 0) return "OpenMeld stopped the background service because this device currently has no projected local agent controllers.";
39333
- return "OpenMeld stopped the background service because this device currently has no local execution routes.";
39334
- }
39335
39418
  function normalizeOptionalString$9(value) {
39336
39419
  const normalized = String(value ?? "").trim();
39337
39420
  return normalized.length > 0 ? normalized : null;
@@ -42134,7 +42217,7 @@ function buildDaemonServiceDependencyMeaning(input) {
42134
42217
  function buildDaemonServiceDependencyNextStep(input) {
42135
42218
  if (shouldUseDevLocalLaneLabel(input)) return formatInlineOpenMeldCliCommands(`Start the local OpenMeld dev stack with \`pnpm dev\`, then retry \`openmeld service ${input.command}\`.`);
42136
42219
  if (input.command === "start") return formatInlineOpenMeldCliCommands("Check the configured OpenMeld auth and gateway endpoints for this lane, then retry `openmeld service start`.");
42137
- return formatInlineOpenMeldCliCommands("Check the configured OpenMeld auth and gateway endpoints for this lane, then retry `openmeld service status` or `openmeld service start --mode foreground`.");
42220
+ return formatInlineOpenMeldCliCommands("Check the configured OpenMeld auth and gateway endpoints for this lane, then retry `openmeld service status`.");
42138
42221
  }
42139
42222
  function buildDependencyProbeTarget(input) {
42140
42223
  if (!input.baseUrl) return null;
@@ -43511,7 +43594,7 @@ function buildDaemonSystemServiceCommandSpec(input) {
43511
43594
  }
43512
43595
  function resolveDaemonServiceExecutable(input) {
43513
43596
  if ((input.distribution ?? resolveOpenMeldDistribution()) === "binary") return {
43514
- executable: input.controller === "launchd" ? daemonServiceExecutableWrapperPath() : input.binaryExecutablePath ?? openMeldManagedVersionBinaryPath(resolveCliSelfVersion()),
43597
+ executable: input.controller === "launchd" ? daemonServiceBinaryExecutablePath() : input.binaryExecutablePath ?? openMeldManagedVersionBinaryPath(resolveCliSelfVersion()),
43515
43598
  specArgs: input.args
43516
43599
  };
43517
43600
  const launcherPath = daemonServiceLauncherPath();
@@ -43529,6 +43612,7 @@ async function ensureDaemonSystemServiceCommandFiles(input) {
43529
43612
  if (input.controller === "launchd") await ensureDaemonServiceStableBinaryExecutable();
43530
43613
  return;
43531
43614
  }
43615
+ if ((await readDaemonActiveBundleState())?.bundleFormat === "binary_v1") throw new Error("Refusing to replace a binary-managed OpenMeld Service with the npm carrier. Run the managed OpenMeld binary for Service repair or update.");
43532
43616
  await writeDaemonServiceLauncher();
43533
43617
  if (input.controller === "launchd") await writeDaemonServiceExecutableWrapper();
43534
43618
  }
@@ -44065,12 +44149,15 @@ async function executeDaemonServiceLifecycle(input) {
44065
44149
  });
44066
44150
  input.state.failureStage = "register_service";
44067
44151
  await input.emitPhase("register_service");
44152
+ const serviceDistribution = preparedBundle.bundleFormat === "binary_v1" ? "binary" : "npm";
44068
44153
  const serviceCommandSpec = buildDaemonSystemServiceCommandSpec({
44069
44154
  ...preparedBundle.bundleFormat === "binary_v1" ? { binaryExecutablePath: preparedBundle.sourceEntryScriptPath } : {},
44070
44155
  controller: input.context.serviceManager.controller,
44156
+ distribution: serviceDistribution,
44071
44157
  environmentTarget: input.context.commandOptions.environmentTarget
44072
44158
  });
44073
44159
  await installDaemonSystemServiceRegistration({
44160
+ distribution: serviceDistribution,
44074
44161
  serviceCommandSpec,
44075
44162
  serviceManager: input.context.serviceManager
44076
44163
  });
@@ -44091,6 +44178,7 @@ async function executeDaemonServiceLifecycle(input) {
44091
44178
  input.state.failureStage = "start_if_desired";
44092
44179
  await input.emitPhase("start_if_desired");
44093
44180
  await startLifecycleServiceWithRetry({
44181
+ distribution: serviceDistribution,
44094
44182
  serviceCommandSpec,
44095
44183
  serviceManager: input.context.serviceManager
44096
44184
  });
@@ -44242,7 +44330,7 @@ async function recoverLifecycleFailure(input) {
44242
44330
  evidencePath: input.state.evidencePath,
44243
44331
  recoveryStatus: "failed_before_safe_state",
44244
44332
  errorCode: originalErrorCode,
44245
- errorMessage: recoveryErrorMessage
44333
+ errorMessage: `${recoveryErrorMessage}; stopped-safe recovery failed: ${toErrorMessage$42(stoppedSafe.safeStopError)}`
44246
44334
  };
44247
44335
  }
44248
44336
  input.state.runtimeDataBackup = null;
@@ -44269,16 +44357,23 @@ function isVerifiedRollbackEligibleFailureStage(failureStage) {
44269
44357
  return failureStage === "install_bundle" || failureStage === "write_contract" || failureStage === "register_service" || failureStage === "restore_runtime_data" || failureStage === "start_if_desired" || failureStage === "wait_running" || failureStage === "verify_final_inventory";
44270
44358
  }
44271
44359
  async function restoreVerifiedPreviousState(input) {
44360
+ const previousVersion = input.restorePoint.previousInstallState?.daemonVersion ?? input.restorePoint.previousContract?.daemonVersion;
44361
+ if (!previousVersion) throw new Error("verified rollback is missing the previous daemon version.");
44362
+ const requiredFloor = (await readVersionState())?.required_floor?.trim();
44363
+ if (requiredFloor && compareSemver(previousVersion, requiredFloor) < 0) throw new Error(`verified rollback version ${previousVersion} is below the required version floor ${requiredFloor}.`);
44272
44364
  await input.serviceManager.uninstall();
44273
44365
  await input.serviceManager.waitUntilAbsent();
44274
44366
  await ensureNoOwnedProcessesRemain();
44275
44367
  await restoreDaemonInstallStateSnapshot(input.restorePoint.previousInstallState);
44276
44368
  await restoreDaemonActiveBundleStateSnapshot(input.restorePoint.previousActiveBundle);
44277
44369
  await restoreLifecycleServiceContractSnapshot(input.restorePoint.previousContract);
44370
+ const previousDistribution = input.restorePoint.previousActiveBundle?.bundleFormat === "binary_v1" ? "binary" : "npm";
44278
44371
  await installDaemonSystemServiceRegistration({
44372
+ distribution: previousDistribution,
44279
44373
  serviceCommandSpec: buildDaemonSystemServiceCommandSpec({
44280
44374
  ...input.restorePoint.previousActiveBundle?.bundleFormat === "binary_v1" ? { binaryExecutablePath: input.restorePoint.previousActiveBundle.sourceEntryScriptPath } : {},
44281
44375
  controller: input.serviceManager.controller,
44376
+ distribution: previousDistribution,
44282
44377
  environmentTarget: resolveOpenMeldEnvironmentTargetFromEnv()
44283
44378
  }),
44284
44379
  serviceManager: input.serviceManager
@@ -44287,8 +44382,6 @@ async function restoreVerifiedPreviousState(input) {
44287
44382
  await input.serviceManager.start();
44288
44383
  await input.serviceManager.waitUntilRunning();
44289
44384
  } else await input.serviceManager.waitUntilStopped();
44290
- const previousVersion = input.restorePoint.previousInstallState?.daemonVersion ?? input.restorePoint.previousContract?.daemonVersion;
44291
- if (!previousVersion) throw new Error("verified rollback is missing the previous daemon version.");
44292
44385
  return await waitForVerifiedLifecycleInventory({
44293
44386
  desiredState: input.restorePoint.desiredState,
44294
44387
  expectedVersion: previousVersion,
@@ -44303,7 +44396,7 @@ async function restoreVerifiedPreviousState(input) {
44303
44396
  async function transitionLifecycleToStoppedSafeCurrentVersion(input) {
44304
44397
  await input.serviceManager.uninstall().catch(() => void 0);
44305
44398
  await input.serviceManager.waitUntilAbsent().catch(() => void 0);
44306
- await ensureNoOwnedProcessesRemain().catch(() => void 0);
44399
+ await ensureNoOwnedProcessesRemain();
44307
44400
  const preparedBundle = await prepareDaemonServiceBundle({
44308
44401
  daemonVersion: input.expectedVersion,
44309
44402
  ...input.cliScriptPath ? { cliScriptPath: input.cliScriptPath } : {}
@@ -44320,10 +44413,13 @@ async function transitionLifecycleToStoppedSafeCurrentVersion(input) {
44320
44413
  preparedBundle,
44321
44414
  serviceController: input.serviceManager.controller
44322
44415
  });
44416
+ const serviceDistribution = preparedBundle.bundleFormat === "binary_v1" ? "binary" : "npm";
44323
44417
  await installDaemonSystemServiceRegistration({
44418
+ distribution: serviceDistribution,
44324
44419
  serviceCommandSpec: buildDaemonSystemServiceCommandSpec({
44325
44420
  ...preparedBundle.bundleFormat === "binary_v1" ? { binaryExecutablePath: preparedBundle.sourceEntryScriptPath } : {},
44326
44421
  controller: input.serviceManager.controller,
44422
+ distribution: serviceDistribution,
44327
44423
  environmentTarget: input.commandOptions.environmentTarget
44328
44424
  }),
44329
44425
  serviceManager: input.serviceManager
@@ -44350,11 +44446,14 @@ async function recoverBackgroundLifecycleVerificationFailure(input) {
44350
44446
  await input.serviceManager.stop();
44351
44447
  await input.serviceManager.waitUntilStopped();
44352
44448
  await ensureNoOwnedProcessesRemain();
44449
+ const serviceCommandSpec = buildDaemonSystemServiceCommandSpec({
44450
+ controller: input.serviceManager.controller,
44451
+ distribution: input.target.bundleFormat === "binary_v1" ? "binary" : "npm",
44452
+ environmentTarget: input.commandOptions.environmentTarget
44453
+ });
44353
44454
  await startLifecycleServiceWithRetry({
44354
- serviceCommandSpec: buildDaemonSystemServiceCommandSpec({
44355
- controller: input.serviceManager.controller,
44356
- environmentTarget: input.commandOptions.environmentTarget
44357
- }),
44455
+ distribution: input.target.bundleFormat === "binary_v1" ? "binary" : "npm",
44456
+ serviceCommandSpec,
44358
44457
  serviceManager: input.serviceManager
44359
44458
  });
44360
44459
  await input.serviceManager.waitUntilRunning();
@@ -44501,11 +44600,12 @@ async function requestControlledSystemServiceDrain(input) {
44501
44600
  return shutdown.accepted;
44502
44601
  } catch (error) {
44503
44602
  const isLegacyShutdownContract = error instanceof LocalDaemonControlPlaneClientError && error.code === "daemon.control.contract_mismatch";
44603
+ const isManagerRunningWithoutRuntime = error instanceof LocalDaemonControlPlaneClientError && error.code === "daemon.control.endpoint_missing" && input.inventory.runtimeStatus.status !== "running" && input.inventory.ownedProcesses.length === 0;
44504
44604
  const isLegacyMissingCloseReason = isLegacyMissingControlledShutdownCloseReason({
44505
44605
  error,
44506
44606
  inventory: input.inventory
44507
44607
  });
44508
- const isCompatibilityFallback = isLegacyShutdownContract || isLegacyMissingCloseReason;
44608
+ const isCompatibilityFallback = isLegacyShutdownContract || isLegacyMissingCloseReason || isManagerRunningWithoutRuntime;
44509
44609
  const observedDaemonVersion = isLegacyMissingCloseReason ? resolveObservedDaemonVersion(input.inventory) : null;
44510
44610
  await emitDaemonLifecycleEvent({
44511
44611
  command: `openmeld service ${input.operation.replaceAll("_", "-")}`,
@@ -44516,6 +44616,7 @@ async function requestControlledSystemServiceDrain(input) {
44516
44616
  compatibilityReason: "legacy_missing_close_reason",
44517
44617
  observedDaemonVersion
44518
44618
  } : {},
44619
+ ...isManagerRunningWithoutRuntime ? { compatibilityReason: "manager_running_without_runtime" } : {},
44519
44620
  errorMessage: toErrorMessage$42(error)
44520
44621
  },
44521
44622
  result: isCompatibilityFallback ? "fallback" : "failed",
@@ -44884,13 +44985,17 @@ async function startLifecycleServiceWithRetry(input) {
44884
44985
  await input.serviceManager.uninstall();
44885
44986
  await input.serviceManager.waitUntilAbsent();
44886
44987
  await installDaemonSystemServiceRegistration({
44988
+ distribution: input.distribution,
44887
44989
  serviceCommandSpec: input.serviceCommandSpec,
44888
44990
  serviceManager: input.serviceManager
44889
44991
  });
44890
44992
  await input.serviceManager.start();
44891
44993
  }
44892
44994
  async function installDaemonSystemServiceRegistration(input) {
44893
- await ensureDaemonSystemServiceCommandFiles({ controller: input.serviceManager.controller });
44995
+ await ensureDaemonSystemServiceCommandFiles({
44996
+ controller: input.serviceManager.controller,
44997
+ distribution: input.distribution
44998
+ });
44894
44999
  await input.serviceManager.install(input.serviceCommandSpec);
44895
45000
  }
44896
45001
  function verifyLifecycleInventory(input) {
@@ -45113,12 +45218,14 @@ const WINDOWS_SERVICE_ALREADY_RUNNING_PATTERN = /already running|1056/i;
45113
45218
  const SYSTEMD_QUOTING_PATTERN = /[\s"\\]/u;
45114
45219
  async function installDaemonServiceUpdateWorker(job, pathInput = {}) {
45115
45220
  assertSafePublishedProductionServiceRegistrationMutation("install the OpenMeld Service update worker for", pathInput);
45221
+ const previousActiveBundle = job.preparedBundle.bundleFormat === "binary_v1" ? await readDaemonActiveBundleState().catch(() => null) : null;
45222
+ if (job.preparedBundle.bundleFormat === "binary_v1") await ensureDaemonServiceUpdateWorkerBinaryExecutable(job.preparedBundle, pathInput);
45116
45223
  const spec = await buildDaemonServiceUpdateWorkerSpec(job, pathInput);
45117
- const identity = resolveUpdateWorkerIdentity(pathInput);
45224
+ const identity = resolveDaemonServiceUpdateWorkerIdentity(pathInput);
45118
45225
  if (process$1.platform === "darwin") {
45119
45226
  const guiDomain = process$1.getuid === void 0 ? "gui/501" : `gui/${process$1.getuid()}`;
45120
45227
  const serviceKey = `${guiDomain}/${identity.launchdLabel}`;
45121
- const plistPath = resolveUpdateWorkerLaunchdPlistPath(pathInput);
45228
+ const plistPath = resolveDaemonServiceUpdateWorkerLaunchdPlistPath(pathInput);
45122
45229
  await Promise.all([mkdir(dirname(plistPath), { recursive: true }), mkdir(dirname(resolveUpdateWorkerLogPath(pathInput)), { recursive: true })]);
45123
45230
  await writeFile(plistPath, buildLaunchdServiceUpdateWorkerPlist({
45124
45231
  label: identity.launchdLabel,
@@ -45145,11 +45252,16 @@ async function installDaemonServiceUpdateWorker(job, pathInput = {}) {
45145
45252
  command: "launchctl",
45146
45253
  args: ["enable", serviceKey]
45147
45254
  });
45255
+ await pruneVersionsAfterStableWorkerRegistration({
45256
+ job,
45257
+ pathInput,
45258
+ previousActiveVersion: previousActiveBundle?.daemonVersion ?? null
45259
+ });
45148
45260
  return;
45149
45261
  }
45150
45262
  if (process$1.platform === "linux") {
45151
- const unitPath = resolveUpdateWorkerSystemdUnitPath(pathInput);
45152
- const pathUnitPath = resolveUpdateWorkerSystemdPathUnitPath(pathInput);
45263
+ const unitPath = resolveDaemonServiceUpdateWorkerSystemdUnitPath(pathInput);
45264
+ const pathUnitPath = resolveDaemonServiceUpdateWorkerSystemdPathUnitPath(pathInput);
45153
45265
  await mkdir(dirname(unitPath), { recursive: true });
45154
45266
  await Promise.all([writeFile(unitPath, buildSystemdServiceUpdateWorkerUnit({ spec }), {
45155
45267
  encoding: "utf8",
@@ -45174,10 +45286,15 @@ async function installDaemonServiceUpdateWorker(job, pathInput = {}) {
45174
45286
  `${identity.serviceName}.path`
45175
45287
  ]
45176
45288
  });
45289
+ await pruneVersionsAfterStableWorkerRegistration({
45290
+ job,
45291
+ pathInput,
45292
+ previousActiveVersion: previousActiveBundle?.daemonVersion ?? null
45293
+ });
45177
45294
  return;
45178
45295
  }
45179
45296
  if (process$1.platform === "win32") {
45180
- const scriptPath = resolveUpdateWorkerWindowsScriptPath(pathInput);
45297
+ const scriptPath = resolveDaemonServiceUpdateWorkerWindowsScriptPath(pathInput);
45181
45298
  await mkdir(dirname(scriptPath), { recursive: true });
45182
45299
  await writeFile(scriptPath, buildWindowsUpdateWorkerScript(spec), {
45183
45300
  encoding: "utf8",
@@ -45210,13 +45327,18 @@ async function installDaemonServiceUpdateWorker(job, pathInput = {}) {
45210
45327
  "restart/30000/restart/30000/restart/30000"
45211
45328
  ]
45212
45329
  });
45330
+ await pruneVersionsAfterStableWorkerRegistration({
45331
+ job,
45332
+ pathInput,
45333
+ previousActiveVersion: previousActiveBundle?.daemonVersion ?? null
45334
+ });
45213
45335
  return;
45214
45336
  }
45215
45337
  throw new Error(`OpenMeld cannot install its background update worker on ${process$1.platform}.`);
45216
45338
  }
45217
45339
  async function startDaemonServiceUpdateWorker(_job, pathInput = {}) {
45218
45340
  assertSafePublishedProductionServiceRegistrationMutation("start the OpenMeld Service update worker for", pathInput);
45219
- const identity = resolveUpdateWorkerIdentity(pathInput);
45341
+ const identity = resolveDaemonServiceUpdateWorkerIdentity(pathInput);
45220
45342
  if (process$1.platform === "darwin") {
45221
45343
  await requireSuccessfulCommand({
45222
45344
  command: "launchctl",
@@ -45247,13 +45369,14 @@ async function startDaemonServiceUpdateWorker(_job, pathInput = {}) {
45247
45369
  }
45248
45370
  async function uninstallDaemonServiceUpdateWorker(pathInput = {}) {
45249
45371
  assertSafePublishedProductionServiceRegistrationMutation("uninstall the OpenMeld Service update worker for", pathInput);
45250
- const identity = resolveUpdateWorkerIdentity(pathInput);
45372
+ const identity = resolveDaemonServiceUpdateWorkerIdentity(pathInput);
45251
45373
  if (process$1.platform === "darwin") {
45252
45374
  await runCommand$1({
45253
45375
  command: "launchctl",
45254
45376
  args: ["bootout", `${process$1.getuid === void 0 ? "gui/501" : `gui/${process$1.getuid()}`}/${identity.launchdLabel}`]
45255
45377
  });
45256
- await rm(resolveUpdateWorkerLaunchdPlistPath(pathInput), { force: true });
45378
+ await rm(resolveDaemonServiceUpdateWorkerLaunchdPlistPath(pathInput), { force: true });
45379
+ await clearDaemonServiceUpdateWorkerBinaryExecutable(pathInput);
45257
45380
  return;
45258
45381
  }
45259
45382
  if (process$1.platform === "linux") {
@@ -45274,11 +45397,12 @@ async function uninstallDaemonServiceUpdateWorker(pathInput = {}) {
45274
45397
  `${identity.serviceName}.service`
45275
45398
  ]
45276
45399
  });
45277
- await Promise.all([rm(resolveUpdateWorkerSystemdUnitPath(pathInput), { force: true }), rm(resolveUpdateWorkerSystemdPathUnitPath(pathInput), { force: true })]);
45400
+ await Promise.all([rm(resolveDaemonServiceUpdateWorkerSystemdUnitPath(pathInput), { force: true }), rm(resolveDaemonServiceUpdateWorkerSystemdPathUnitPath(pathInput), { force: true })]);
45278
45401
  await runCommand$1({
45279
45402
  command: "systemctl",
45280
45403
  args: ["--user", "daemon-reload"]
45281
45404
  });
45405
+ await clearDaemonServiceUpdateWorkerBinaryExecutable(pathInput);
45282
45406
  return;
45283
45407
  }
45284
45408
  if (process$1.platform === "win32") {
@@ -45290,6 +45414,7 @@ async function uninstallDaemonServiceUpdateWorker(pathInput = {}) {
45290
45414
  command: "sc",
45291
45415
  args: ["delete", identity.windowsServiceName]
45292
45416
  });
45417
+ await clearDaemonServiceUpdateWorkerBinaryExecutable(pathInput);
45293
45418
  }
45294
45419
  }
45295
45420
  async function buildDaemonServiceUpdateWorkerSpec(job, pathInput = {}) {
@@ -45297,10 +45422,11 @@ async function buildDaemonServiceUpdateWorkerSpec(job, pathInput = {}) {
45297
45422
  if (!mainManager) throw new Error("OpenMeld could not find this computer's background service manager.");
45298
45423
  const baseSpec = buildDaemonSystemServiceCommandSpec({
45299
45424
  controller: mainManager.controller,
45300
- ...job.preparedBundle.bundleFormat === "binary_v1" ? { binaryExecutablePath: job.preparedBundle.sourceEntryScriptPath } : {}
45425
+ ...job.preparedBundle.bundleFormat === "binary_v1" ? { binaryExecutablePath: job.preparedBundle.sourceEntryScriptPath } : {},
45426
+ distribution: job.preparedBundle.bundleFormat === "binary_v1" ? "binary" : "npm"
45301
45427
  });
45302
45428
  const binaryDistribution = job.preparedBundle.bundleFormat === "binary_v1";
45303
- const targetEntryPath = binaryDistribution ? job.preparedBundle.sourceEntryScriptPath : await resolveDaemonBundleEntryPathFromState(job.preparedBundle);
45429
+ const targetEntryPath = binaryDistribution ? daemonServiceUpdateWorkerBinaryPath(pathInput) : await resolveDaemonBundleEntryPathFromState(job.preparedBundle);
45304
45430
  if (!targetEntryPath) throw new Error("OpenMeld could not resolve the prepared Service update executable.");
45305
45431
  return {
45306
45432
  args: binaryDistribution ? ["service", "update-worker"] : [
@@ -45382,30 +45508,16 @@ Unit=${input.serviceName}.service
45382
45508
  WantedBy=default.target
45383
45509
  `;
45384
45510
  }
45385
- function resolveUpdateWorkerIdentity(pathInput) {
45386
- const preset = resolveOpenMeldEnvPreset(pathInput);
45387
- const suffix = preset === "prod" ? "" : `-${preset}`;
45388
- return {
45389
- launchdLabel: `com.openmeld.openmeld-service-update${preset === "prod" ? "" : `.${preset}`}`,
45390
- serviceName: `openmeld-service-update${suffix}`,
45391
- windowsDisplayName: `OpenMeld Service Update${preset === "prod" ? "" : ` (${preset})`}`,
45392
- windowsServiceName: `OpenMeld-Service-Update${suffix}`
45393
- };
45394
- }
45395
45511
  function resolveUpdateWorkerLogPath(pathInput) {
45396
45512
  return join(daemonRuntimeRootPath(pathInput), "logs", "service-update-worker.log");
45397
45513
  }
45398
- function resolveUpdateWorkerLaunchdPlistPath(pathInput) {
45399
- return join(pathInput.homeDir ?? userInfo().homedir, "Library", "LaunchAgents", `${resolveUpdateWorkerIdentity(pathInput).launchdLabel}.plist`);
45400
- }
45401
- function resolveUpdateWorkerSystemdUnitPath(pathInput) {
45402
- return join(pathInput.homeDir ?? userInfo().homedir, ".config", "systemd", "user", `${resolveUpdateWorkerIdentity(pathInput).serviceName}.service`);
45403
- }
45404
- function resolveUpdateWorkerSystemdPathUnitPath(pathInput) {
45405
- return join(pathInput.homeDir ?? userInfo().homedir, ".config", "systemd", "user", `${resolveUpdateWorkerIdentity(pathInput).serviceName}.path`);
45406
- }
45407
- function resolveUpdateWorkerWindowsScriptPath(pathInput) {
45408
- return join(daemonRuntimeRootPath(pathInput), "service-update-worker.bat");
45514
+ async function pruneVersionsAfterStableWorkerRegistration(input) {
45515
+ if (input.job.preparedBundle.bundleFormat !== "binary_v1") return;
45516
+ await pruneManagedVersions({
45517
+ currentVersion: input.job.targetVersion,
45518
+ pathInput: input.pathInput,
45519
+ preferredRollbackVersion: input.previousActiveVersion
45520
+ });
45409
45521
  }
45410
45522
  function buildWindowsUpdateWorkerScript(spec) {
45411
45523
  const env = Object.entries(spec.env).map(([key, value]) => `set "${key}=${value.replaceAll("\"", "\\\"")}"`);
@@ -57418,7 +57530,7 @@ function buildAgentOttFailureNextSteps(input) {
57418
57530
  if (input.code === "missing_access_token") return ["Auth worker returned no set-auth-token header; verify bearer plugin is enabled.", "Retry after confirming auth worker deployment includes one-time-token + bearer plugins."];
57419
57531
  if (input.code === "session_not_saved") return [
57420
57532
  "Verify the local CLI can persist and reload the bearer session after one-time-token verification.",
57421
- "Copy a fresh setup command from OpenMeld Web and retry.",
57533
+ "Return to OpenMeld Web to inspect the current connection state and recovery action.",
57422
57534
  "If it still fails, run `openmeld login --ott <token> --view agent` and inspect the auth worker response."
57423
57535
  ].map((step) => formatInlineOpenMeldCliCommands(step));
57424
57536
  if (input.code === "expired_token") return [`Open ${input.authBaseUrl}/ and generate a fresh one-time token.`, "Run `openmeld login --view agent --ott <new-token>` immediately."].map((step) => formatInlineOpenMeldCliCommands(step));
@@ -65084,7 +65196,7 @@ function buildSystemServiceStartupFailureReportFromVerdict(verdict, options) {
65084
65196
  const summary = "OpenMeld Service keeps stopping after it starts.";
65085
65197
  const card = buildDaemonStartNeedsAttentionCard({
65086
65198
  summary,
65087
- nextStep: formatInlineOpenMeldCliCommands("Run `openmeld service start --mode foreground` to see what stopped it."),
65199
+ nextStep: formatInlineOpenMeldCliCommands("Run `openmeld service repair` once. OpenMeld saved the startup evidence for diagnostics."),
65088
65200
  autoRepairAttempted
65089
65201
  });
65090
65202
  return {
@@ -65119,7 +65231,7 @@ function buildSystemServiceStartupFailureReportFromVerdict(verdict, options) {
65119
65231
  }
65120
65232
  const card = buildDaemonStartNeedsAttentionCard({
65121
65233
  summary: "OpenMeld could not finish starting OpenMeld Service.",
65122
- nextStep: formatInlineOpenMeldCliCommands("Run `openmeld service start --mode foreground` to see what stopped it."),
65234
+ nextStep: formatInlineOpenMeldCliCommands("Run `openmeld service repair` once. OpenMeld saved the startup evidence for diagnostics."),
65123
65235
  autoRepairAttempted
65124
65236
  });
65125
65237
  return {
@@ -65148,7 +65260,7 @@ function buildSystemServiceStartupFailureDiagnostics(input) {
65148
65260
  launchdLabel: (input.controller ?? null) === "launchd" ? getDaemonServiceLaunchdLabel() : null,
65149
65261
  lifecycleJournalPath: daemonLifecycleJournalPath(),
65150
65262
  managerStatus: timeoutError?.managerStatus ?? null,
65151
- nextSteps: localMachineIssue?.primaryAction ? [localMachineIssue.primaryAction] : [formatOpenMeldCliCommand("openmeld service start --mode foreground"), formatOpenMeldCliCommand("openmeld service repair")],
65263
+ nextSteps: localMachineIssue?.primaryAction ? [localMachineIssue.primaryAction] : [formatOpenMeldCliCommand("openmeld service repair")],
65152
65264
  recovery: input.recovery,
65153
65265
  runtimeStatus: timeoutError?.runtimeStatus ?? null,
65154
65266
  serviceLogPath: getDaemonSystemServiceLogPath()
@@ -75249,14 +75361,17 @@ const runDaemonServiceLoop = async (input) => {
75249
75361
  skippedProfiles: []
75250
75362
  });
75251
75363
  const routeCatalogLoader = createRouteCatalogSyncLoader({
75252
- loadFresh: async () => await loadDaemonRouteCatalog({
75253
- allowEmpty: true,
75254
- localAdapterContainer,
75255
- localReplyStateMode: "check",
75256
- ownerUserId,
75257
- presenter: input.presenter,
75258
- quiet: true
75259
- }),
75364
+ loadFresh: async () => {
75365
+ await reconcileNewRunnableBuiltinAgentRegistrations({ notifyRouteCatalogChanged: false });
75366
+ return await loadDaemonRouteCatalog({
75367
+ allowEmpty: true,
75368
+ localAdapterContainer,
75369
+ localReplyStateMode: "check",
75370
+ ownerUserId,
75371
+ presenter: input.presenter,
75372
+ quiet: true
75373
+ });
75374
+ },
75260
75375
  loadInitial: async () => await loadInitialDaemonRouteCatalog({
75261
75376
  allowEmpty: true,
75262
75377
  lane,
@@ -78756,8 +78871,8 @@ function buildDaemonReinstallNextStepText(outcome, action) {
78756
78871
  switch (outcome.result) {
78757
78872
  case "already_healthy": return "No action is required.";
78758
78873
  case "scheduled": return "You can close this window. No action is required.";
78759
- case "completed": return outcome.serviceState === "running" ? "No action is required." : formatInlineOpenMeldCliCommands(`Run \`${formatOpenMeldCliCommand("openmeld service start")}\` to keep OpenMeld Service running in the background. If you need live logs, run \`${formatOpenMeldCliCommand("openmeld service start --mode foreground")}\`.`);
78760
- case "stopped_safe": return formatInlineOpenMeldCliCommands(`Run \`${formatOpenMeldCliCommand("openmeld service start --mode foreground")}\` to inspect startup live, or \`${formatOpenMeldCliCommand("openmeld service start")}\` to retry background startup from the current version.`);
78874
+ case "completed": return outcome.serviceState === "running" ? "No action is required." : formatInlineOpenMeldCliCommands(`Run \`${formatOpenMeldCliCommand("openmeld service start")}\` to keep OpenMeld Service running in the background.`);
78875
+ case "stopped_safe": return formatInlineOpenMeldCliCommands(`Run \`${formatOpenMeldCliCommand("openmeld service repair")}\` once. OpenMeld preserved the failed update evidence and kept the current version stopped safely.`);
78761
78876
  case "in_progress": return formatInlineOpenMeldCliCommands(`Wait a moment. If OpenMeld Service is still not connected, run \`${formatOpenMeldCliCommand(outcome.retryCommand)}\` again.`);
78762
78877
  case "downgrade_blocked": return `${formatDaemonServiceDowngradeBlockedRecommendation({
78763
78878
  installedVersion: outcome.installedVersion,
@@ -78938,7 +79053,7 @@ function buildDaemonReinstallUnexpectedStartSummary(_error, action = "repair") {
78938
79053
  return `OpenMeld Service couldn't start after the ${formatDaemonServiceMaintenanceActionLabel(action)}.`;
78939
79054
  }
78940
79055
  function buildDaemonReinstallUnexpectedStartNextStep(action = "repair") {
78941
- return formatInlineOpenMeldCliCommands(`Run \`openmeld service start --mode foreground\` to see the live error. The latest local service log is at \`${getDaemonSystemServiceLogPath()}\`. If it still fails, run \`${formatDaemonServiceMaintenanceCommand(action)}\` again.`);
79056
+ return formatInlineOpenMeldCliCommands(`Run \`${formatDaemonServiceMaintenanceCommand(action)}\` once. OpenMeld saved the latest local service log at \`${getDaemonSystemServiceLogPath()}\` for diagnostics.`);
78942
79057
  }
78943
79058
  function buildDaemonReinstallStartBlockedWhyText(outcome, action) {
78944
79059
  const forcedSuffix = outcome.forceUsed ? " Force continue was used after graceful drain timed out." : "";
@@ -78970,7 +79085,7 @@ function buildDaemonReinstallStartBlockedNextStep(outcome, action) {
78970
79085
  switch (outcome.blockReason) {
78971
79086
  case "authentication_required": return formatInlineOpenMeldCliCommands(`Run \`${formatOpenMeldCliCommand("openmeld login")}\` first, then \`${formatOpenMeldCliCommand("openmeld service start")}\` to start OpenMeld Service in the background.`);
78972
79087
  case "authentication_environment_mismatch": return formatInlineOpenMeldCliCommands(`Run \`${formatOpenMeldCliCommand("openmeld login")}\` for the correct OpenMeld environment, then \`${formatOpenMeldCliCommand("openmeld service start")}\` again.`);
78973
- case "service_dependencies_unavailable": return formatInlineOpenMeldCliCommands(`Start the required OpenMeld dependencies, then run \`${formatOpenMeldCliCommand("openmeld service start")}\` again. If you need live detail, run \`${formatOpenMeldCliCommand("openmeld service start --mode foreground")}\`.`);
79088
+ case "service_dependencies_unavailable": return formatInlineOpenMeldCliCommands(`Start the required OpenMeld dependencies, then run \`${formatOpenMeldCliCommand("openmeld service start")}\` again.`);
78974
79089
  case "cleanup_required": return formatInlineOpenMeldCliCommands(`Run \`${formatOpenMeldCliCommand("openmeld service status")}\` to inspect the current cleanup guidance. If OpenMeld still reports a conflict, run \`${formatOpenMeldCliCommand(formatDaemonServiceMaintenanceCommand(action))}\` again.`);
78975
79090
  default: {
78976
79091
  const unexpectedBlockReason = outcome.blockReason;
@@ -80847,7 +80962,7 @@ async function handleDaemonRunStartFailure(input) {
80847
80962
  }) : [
80848
80963
  "OpenMeld could not finish starting OpenMeld Service.",
80849
80964
  ...failure?.detail ? [`Last local detail: ${failure.detail}`] : [],
80850
- `Next: ${formatInlineOpenMeldCliCommands("Run `openmeld service start --mode foreground` to see the live error. If it still fails, run `openmeld service repair`.")}`
80965
+ `Next: ${formatInlineOpenMeldCliCommands("Run `openmeld service repair` once. OpenMeld saved the startup evidence for diagnostics.")}`
80851
80966
  ].join("\n");
80852
80967
  input.presenter.data({
80853
80968
  code: "daemon.run.start_failed",
@@ -80881,7 +80996,7 @@ async function handleDaemonRunStartFailure(input) {
80881
80996
  const card = buildDaemonStartNeedsAttentionCard({
80882
80997
  summary: "OpenMeld could not finish starting OpenMeld Service.",
80883
80998
  detail: failure?.detail ?? void 0,
80884
- nextStep: formatInlineOpenMeldCliCommands("Run `openmeld service start --mode foreground` to see the live error. If it still fails, run `openmeld service repair`.")
80999
+ nextStep: formatInlineOpenMeldCliCommands("Run `openmeld service repair` once. OpenMeld saved the startup evidence for diagnostics.")
80885
81000
  });
80886
81001
  renderServiceActionCard({
80887
81002
  presenter: input.presenter,
@@ -83806,17 +83921,6 @@ function assertNever(value) {
83806
83921
  throw new Error(`unsupported agents agent overview command: ${String(value)}`);
83807
83922
  }
83808
83923
  //#endregion
83809
- //#region src/system/local-participation-mutation-reconcile.ts
83810
- async function postLocalParticipationMutationReconcile(input) {
83811
- if (!input.shouldReconcile) return;
83812
- await maybeAutoStopIdleLocalService({
83813
- codePrefix: input.codePrefix,
83814
- ownerUserId: input.ownerUserId,
83815
- presenter: input.presenter,
83816
- runtimeWorkdir: input.runtimeWorkdir
83817
- });
83818
- }
83819
- //#endregion
83820
83924
  //#region src/ui/transport-mode-display.ts
83821
83925
  const DISPLAY_NOT_SET_UP = "Not set up";
83822
83926
  function formatTransportModeDisplay(value) {
@@ -86155,12 +86259,6 @@ async function runAgentsDisable(input) {
86155
86259
  }
86156
86260
  return sortAgentRegistrations(next);
86157
86261
  });
86158
- await postLocalParticipationMutationReconcile({
86159
- codePrefix: "agents.disable",
86160
- ownerUserId: (await resolveLocalParticipationOwnerProfile(runtime))?.ownerUserId ?? null,
86161
- presenter,
86162
- shouldReconcile: summary.disabled.length > 0
86163
- });
86164
86262
  if (input.json === true) {
86165
86263
  emitCliJsonEnvelope({
86166
86264
  schemaVersion: 1,
@@ -86218,12 +86316,6 @@ async function runAgentsConfig(input) {
86218
86316
  return sortAgentRegistrations(next);
86219
86317
  })).find((item) => item.agentId === agentId) ?? null;
86220
86318
  if (!effectiveConfig) throw new Error("agents.config_write_failed: config update returned empty");
86221
- await postLocalParticipationMutationReconcile({
86222
- codePrefix: "agents.config",
86223
- ownerUserId: (await resolveLocalParticipationOwnerProfile(runtime))?.ownerUserId ?? null,
86224
- presenter,
86225
- shouldReconcile: enabled === false
86226
- });
86227
86319
  const payload = {
86228
86320
  agentId,
86229
86321
  updatedFields,
@@ -86261,14 +86353,6 @@ async function runAgentsConfig(input) {
86261
86353
  minContentWidth: 34
86262
86354
  });
86263
86355
  }
86264
- async function resolveLocalParticipationOwnerProfile(runtime) {
86265
- return await resolveOpenMeldProfileOrNull({
86266
- openMeldProfileId: runtime.openMeldProfileId,
86267
- allowDefaultFallback: true,
86268
- allowUnauthenticated: true,
86269
- persistSelection: false
86270
- }).catch(() => null);
86271
- }
86272
86356
  async function runAgentsCustomList(input) {
86273
86357
  const runtime = await resolveRuntimeContext({
86274
86358
  view: input.view,
@@ -109461,6 +109545,6 @@ function isHumanInteractiveSpaceRuntime(runtime) {
109461
109545
  return runtime.resolvedView === "human" && canUseInteractivePrompts(runtime);
109462
109546
  }
109463
109547
  //#endregion
109464
- export { runAgentsRepair as $, defaultManagedIntegrationPaths as $a, readDaemonServiceJobCrashExitCode as $i, formatDaemonServiceMissingRecommendation as $n, resolveOpenClawLocalDiagnosticsValue as $r, readBundledOpenMeldCliSkillDocumentByPath as $t, assertFullSignalIdArgument as A, resolveOpenMeldProfile as Aa, resolveNativeAgentControllerPermissionModeForController as Ai, upsertSpaceConfig as An, runIfAgentActivityBindingGenerationIsCurrent as Ao, DualViewGuideError as Ar, shouldEmitAgentOverview as At, persistAgentTransportSelection as B, resolveAuthenticationGuidanceFromError as Ba, assessServerRequiredVersion as Bi, promptSearchMultiselect as Bn, errLine as Bo, runPendingDaemonServiceUpdate as Br, parseJsonResponse$1 as Bt, toSpaceMetaUpsertInput as C, requireOpenMeldProfile as Ca, getAgentControllerPermissionModeFieldLabel as Ci, submitRuntimeAgentControllerReport as Cn, readAgentActivityOutboxHealth as Co, SPACE_ADD_MEMBERS_PROGRESS_HEARTBEAT_MS as Cr, runDaemonTeardownStrict as Ct, formatHumanReadTargetList as D, deleteOpenMeldProfile as Da, resolveAgentExecutionStatus as Di, resolveLocalAgentControllerLaunchability as Dn, listProjectConnectionsWithStatus as Do, registerAuthLoginRequestOptions as Dr, reconcileCliVersionView as Dt, buildHumanReplyContextSummary as E, createOpenMeldHumanProfile as Ea, resolveAgentControllerPermissionModeForController as Ei, resolveLocalAgentControllerBlockerReasonCodes as En, listProjectBindings as Eo, registerDaemonControlTargetOptions as Er, buildProfileWorkspaceRows as Et, emitSpaceAgentOverview as F, setSelectedOpenMeldProfileId as Fa, buildDaemonServiceTargetSpec as Fi, buildSignalMessageReadProjection as Fn, readControllerTaskLifecycleOutboxHealth as Fo, SPACE_CONTRACT_ALLOWED_ACTION_ORDER as Fr, fetchSpaceMeta as Ft, runAgentsCustomList as G, validateLocalProjectConnectionPath as Ga, resetCurrentCommandCheckState as Gi, isCliUpdateCheckApplicable as Gn, cliJsonSkillsListEnvelopeSchema as Go, resolveServiceReadinessFromServiceStatus as Gr, runDaemonStartDecisionPrompt as Gt, runAgents as H, getProfileDefaultView as Ha, finishCurrentCommandCheckScope as Hi, isReturnKeypress as Hn, outLine as Ho, ensureDaemonRuntimePaths as Hr, writeInstalledLocalComponentsSnapshot as Ht, emitSpaceCliAgentOverview as I, buildAgentAuthenticationGuide as Ia, resolveDaemonServiceAlignmentDecision as Ii, buildSpaceRoundReadProjection as In, renderInfoCard as Io, areAllowedActionsEquivalent as Ir, updateSpaceMeta as It, runAgentsDetect as J, isAgentActivityRouteRegistered as Ja, resolveVersionChangeDirection as Ji, readDispatchSpaceActionContextFromEnv as Jn, getOrganizationJoinLinkResponseSchema as Jo, formatAgentReplyReadinessLabel as Jr, runSkillsEnsure as Jt, runAgentsCustomRemove as K, LocalDaemonControlPlaneClientError as Ka, startCurrentCommandCheckScope as Ki, assertDispatchOwnedRuntimePublicWriteAllowed as Kn, cliJsonSkillsLoadEnvelopeSchema as Ko, resolveDaemonServiceFreshnessWarning as Kr, collectSkillsReadinessSnapshot as Kt, prepareLocalAgentReadiness as L, buildHumanAuthenticationCard as La, classifyDaemonServiceRunStartability as Li, buildUpdatesReplyWorkflowProjection as Ln, renderTextInfoCard as Lo, buildAgentFacingPublicationModeGuideLines as Lr, readGatewayJsonResponse as Lt, prepareAuthenticatedSpaceCommandContext as M, alignSelectedOpenMeldProfileStorage as Ma, buildDaemonRouteObservationPresentation as Mi, buildDispatchResultMessageReadProjection as Mn, unbindProject as Mo, buildDualViewGuideMessage as Mr, readDaemonStartFailureLogTailLines as Mt, resolveOpenMeldProfileForSpaceCommand as N, clearSelectedOpenMeldProfileId as Na, buildOnboardingPlan as Ni, buildDispatchResultReplyWorkflowProjection as Nn, canonicalizeLocalProjectPath as No, formatAgentOverviewPayload as Nr, fetchSpaceUpdates as Nt, parseEnvelope as O, listOpenMeldProfiles as Oa, resolveAgentProfileEditCapabilities as Oi, resolveLocalAgentControllerReportDecision as On, migrateProjectBindingStore as Oo, registerBuiltinAgentSelectionOptions as Or, emitDaemonAgentOverview as Ot, resolveSpaceAccessLabel as P, getSelectedOpenMeldProfileId as Pa, getSetupFlowCopy as Pi, buildSignalIndex as Pn, enqueueControllerTaskLifecycleEventWhileLocked as Po, OPENMELD_AGENT_MENTAL_MODEL_LINES as Pr, createCliSpaceApi as Pt, runAgentsManage as Q, AGENT_ACTIVITY_INTEGRATION_OWNER as Qa, isDaemonServiceJobNeverSpawned as Qi, formatDaemonServiceDowngradeBlockedRecommendation as Qn, resolveGatewayChainReadiness as Qr, ensureLocalSkills as Qt, buildReplyReadinessGuidance as R, createAuthenticationError as Ra, classifyDaemonServiceWakeability as Ri, createSpaceMemberIdentityIndex as Rn, sanitizeTerminalDisplayText as Ro, canonicalizeAllowedActions as Rr, readGatewayTextResponse as Rt, loadSpaceSignalIndexOrNull as S, isSelectedOpenMeldProfileRequiredError as Sa, getAgentControllerPermissionModeDisplayMetadata as Si, submitProfileRuntimeAgentControllerReport as Sn, removeProjectInbox as So, registerSpaceMemberSelectionOptions as Sr, runDaemonStop as St, buildFormalSignalReadPayload as T, createOpenMeldAgentProfile as Ta, parseAgentControllerRef as Ti, collectLocalAgentControllerInventory as Tn, bindProject as To, getCliVersionInfo as Tr, buildProfileWorkspacePresentation as Tt, runAgentsConfig as U, setProfileDefaultView as Ua, getCurrentCommandCheckState as Ui, runInteractivePrompt as Un, cliBinaryDeltaPatchSchema as Uo, resolveDaemonDeviceId as Ur, resolveDaemonServiceParticipationStatus as Ut, resolveAgentProfileSetup as V, resolveAuthenticationGuidanceFromMessage as Va, resolveOpenMeldEnvironmentTarget as Vi, promptSearchSelect as Vn, outJsonLine as Vo, scheduleDaemonServiceUpdate as Vr, resolveLocalComponentsStatus as Vt, runAgentsCustomAdd as W, LocalProjectConnectionError as Wa, isCurrentCommandCheckScopeActive as Wi, assessCliUpdate as Wn, cliJsonOutputEnvelopeSchema as Wo, formatDaemonFailureContextText as Wr, runDaemonServiceParticipationGate as Wt, runAgentsEnable as X, resolveAgentActivityRouteForPath as Xa, readCurrentObservedDaemonRuntimeStatus as Xi, formatElapsedTime as Xn, revokeOrganizationJoinLinkResponseSchema as Xo, formatHumanReplyReadinessReason as Xr, runSkillsUninstall as Xt, runAgentsDisable as Y, registerAgentActivityRoute as Ya, readCurrentDaemonRuntimeContext as Yi, writeDispatchSpaceActionRecord as Yn, organizationJoinLinkErrorResponseSchema as Yo, formatDeviceReplyReadinessLabel as Yr, runSkillsInstall as Yt, runAgentsList as Z, unregisterAgentActivityRoute as Za, getDaemonSystemServiceLogPath as Zi, resolveElapsedTimeMs as Zn, compareAgentControllerRefsForDisplay as Zo, mapAgentReplyReadinessToLegacyAutoReply as Zr, runSkillsUpdate as Zt, runSpaceWriteWithPasswordRetry as _, createPresenter as _a, listBuiltinAgentsRegistryEntries as _i, ensureAgentProfileRuntimeBinding as _n, buildAgentActivityEvent as _o, createStartAgentIdentityGuideError as _r, runDaemonInterrupt as _t, runSpaceDelete as a, ensureVersionStateReady as aa, normalizeCustomProfileWorkspacePath as ai, evaluateCommandAuthentication as an, formatOpenMeldCliCommand as ao, createResetConfirmationGuideError as ar, printOpenMeldBanner as at, buildIdentityOnlyMembersSnapshotForReadProjection as b, resolveRuntimeContext as ba, buildAgentControllerRef as bi, assessActionParticipationCandidate as bn, readCodexSessionTitles as bo, getCommandEntryContract as br, runDaemonSnapshot as bt, runSpaceLeave as c, readVersionState as ca, setCustomProfileWorkspace as ci, runAuthMenu as cn, formatOpenMeldCliTextBlock as co, createSpaceContractSetGuideError as cr, renderOpenMeldLogo as ct, runSpaceRemoveMembers as d, toStartBackgroundHelperExecutionCompatibility as da, describeProfileWorkspacePathValidationFailure as di, buildAuthStatusSnapshot as dn, resolveUserFacingCliEntryCommand as do, createSpacePublicationSetGuideError as dr, resolveSpaceSendText as dt, resolveDaemonServiceManager as ea, readRecentDaemonLifecycleEvents as ei, readRuntimeReportingHealthState as en, installAgentActivityIntegrations as eo, canUseInteractivePrompts as er, runAgentsShow as et, runSpaceSend as f, resolveCurrentDaemonExpectedVersion as fa, syncDeviceRuntimeStateProjection as fi, formatActiveOrganizationLabel as fn, syncLocalAgentActivity as fo, createSpaceRemoveMembersGuideError as fr, runDaemon as ft, runSpaceReadWithPasswordRetry as g, renderHumanTextErrorCard as ga, reconcileNewRunnableBuiltinAgentsForSetup as gi, promptTextEntry as gn, removeAgentActivityContextCache as go, createSpaceUpdatesGuideError as gr, runDaemonInstall as gt, uploadPreparedSpaceFiles as h, renderHumanErrorCard as ha, listAgentTargetStates as hi, resolveCreateProfileName as hn, readAgentActivityContextForPath as ho, createSpaceTargetGuideError as hr, runDaemonCancel as ht, runSpaceCreate as i, compareSemver as ia, ensureOpenMeldManagedProfileWorkspace as ii, ensureCommandAuthenticationOrCancel as in, formatInlineOpenMeldCliCommands as io, createProfileMenuGuideError as ir, colorizeDisplayProfileLabel as it, assertValidSpaceIdTarget as j, updateOpenMeldProfile as ja, PREPARE_SESSION_RECONNECT_GRACE_MS as ji, assertNoRemovedCcSpaceAddressingSyntax as jn, setDefaultProjectConnection as jo, formatDualViewGuideForDisplay as jr, runDaemonStartupPreflight as jt, isSpaceCommandOutputHandledError as k, primeOpenMeldProfilesSessionCache as ka, resolveEvidenceSyncHealth as ki, inspectSpaceCacheFile as kn, removeProjectConnection as ko, buildAgentOverviewFromContract as kr, createDelayedSpinner as kt, runSpaceList as l, writeVersionState as la, setOpenMeldManagedProfileWorkspace as li, runAuthStatus as ln, formatProfileAwareOpenMeldCliCommands as lo, createSpaceLeaveGuideError as lr, renderOpenMeldTagline as lt, prepareRequestedSpaceSendFiles as m, buildHumanErrorCopy as ma, resolveAgentProfilePrimaryAgentControllerReport as mi, resolveCreateProfileKind as mn, upsertDaemonServiceContract as mo, createSpaceSubcommandTargetGuideError as mr, runDaemonBackgroundStartForDecision as mt, promptAndConfirmSpacePassword as n, performManagedInstall as na, createModelCatalogReadSession as ni, connectWebSocket as nn, resolveAgentActivityDispatcherCommand as no, createProfileActionGuideError as nr, postLocalParticipationMutationReconcile as nt, runSpaceHistory as o, fetchLatestCliBinaryRelease as oa, readProfileWorkspaceConfig as oi, runAuthLogin as on, formatOpenMeldCliCommands as oo, createSpaceAddMembersGuideError as or, renderOpenMeldBrandBlockLines as ot, runSpaceWatch as p, OPENMELD_VERSION as pa, createPrimaryBindingReadSession as pi, createProfileByKind as pn, readDaemonServiceContract as po, createSpaceResultGuideError as pr, runDaemonAutostart as pt, runAgentsCustomUpdate as q, requestLocalAgentActivitySync as qa, inspectDaemonServiceInventory as qi, readDispatchOwnedRuntimeGuard as qn, cliJsonSkillsShowEnvelopeSchema as qo, resolveCurrentReplyReadinessSnapshot as qr, runSkillsCheck as qt, runSpaceAddMembers as r, buildNextVersionState as ra, resolveProfileWorkspaceRuntime as ri, buildCommandAuthenticationPromptMessage as rn, uninstallAgentActivityIntegrations as ro, createProfileCreateGuideError as rr, colorizeAgentLabel as rt, runSpaceJoin as s, fetchLatestPackageInfo as sa, resolveConfiguredProfileWorkspacePath as si, runAuthLogout as sn, formatOpenMeldCliLine as so, createSpaceAliasTargetGuideError as sr, renderOpenMeldHeader as st, buildCreateSpacePasswordPromptConfig as t, buildInstallSelfJsonPayload as ta, syncProfileWorkspaceState as ti, readRecentDaemonDispatchJournalEvents as tn, readAgentActivityIntegrationStatus as to, createDoctorFailedGuideError as tr, formatTransportModeDisplay as tt, runSpacePassword as u, resolveDaemonRuntimeContractCompatibility as ua, validateCustomProfileWorkspacePath as ui, buildAuthStatusRows as un, resolveSetupFollowUpCliEntryCommand as uo, createSpaceMenuGuideError as ur, resolveGatewayWebOrigin as ut, buildHumanReadSignalsTranscriptItems as v, formatMessage as va, notifyDaemonRouteCatalogChanged as vi, formatServiceParticipationReadinessLabel as vn, resolveObservedAgentActivityBinding as vo, createStartAuthenticationGuideError as vr, runDaemonReinstall as vt, buildFormalDispatchResultReadPayload as w, resolveOpenMeldProfileOrNull as wa, listAgentControllerPermissionModeOptions as wi, submitRuntimeAgentControllerReports as wn, removeProjectOutbox as wo, registerSkillsTargetSelectionOptions as wr, runDaemonUninstall as wt, loadSpaceIdentityDirectoryOrNull as x, resolveViewProfileKey as xa, createAgentExecutionStatusDisplayRows as xi, computeRetryDelayMs as xn, enqueueAgentActivityHookEvent as xo, getCommandHintsFromContract as xr, runDaemonStatusFlow as xt, emitHumanReadSignalsTextProjection as y, parseCliViewMode as ya, resolveLocalRegistryAgentIdFromAgentControllerRef as yi, resolveServiceParticipationReadiness as yn, normalizeSharedSessionTitle as yo, createUpgradeConfirmationGuideError as yr, runDaemonRunAfterEntryChecks as yt, resolveHumanControllerDisplayName as z, resolveAuthenticationGuidance as za, resolveServiceUpdateUrgency as zi, formatRemovedCcRelationMessage as zn, emitCliJsonEnvelope as zo, readOpenMeldToolsUpdateContextFromEnv as zr, toStructuredGatewayFailure as zt };
109548
+ export { runAgentsRepair as $, installAgentActivityIntegrations as $a, readRecentDaemonLifecycleEvents as $i, canUseInteractivePrompts as $n, syncProfileWorkspaceState as $r, readRuntimeReportingHealthState as $t, assertFullSignalIdArgument as A, updateOpenMeldProfile as Aa, buildDaemonRouteObservationPresentation as Ai, assertNoRemovedCcSpaceAddressingSyntax as An, setDefaultProjectConnection as Ao, formatDualViewGuideForDisplay as Ar, runDaemonStartupPreflight as At, persistAgentTransportSelection as B, resolveAuthenticationGuidanceFromMessage as Ba, finishCurrentCommandCheckScope as Bi, promptSearchSelect as Bn, outJsonLine as Bo, scheduleDaemonServiceUpdate as Br, resolveLocalComponentsStatus as Bt, toSpaceMetaUpsertInput as C, resolveOpenMeldProfileOrNull as Ca, parseAgentControllerRef as Ci, submitRuntimeAgentControllerReports as Cn, removeProjectOutbox as Co, registerSkillsTargetSelectionOptions as Cr, runDaemonUninstall as Ct, formatHumanReadTargetList as D, listOpenMeldProfiles as Da, resolveEvidenceSyncHealth as Di, resolveLocalAgentControllerReportDecision as Dn, migrateProjectBindingStore as Do, registerBuiltinAgentSelectionOptions as Dr, emitDaemonAgentOverview as Dt, buildHumanReplyContextSummary as E, deleteOpenMeldProfile as Ea, resolveAgentProfileEditCapabilities as Ei, resolveLocalAgentControllerLaunchability as En, listProjectConnectionsWithStatus as Eo, registerAuthLoginRequestOptions as Er, reconcileCliVersionView as Et, emitSpaceAgentOverview as F, buildAgentAuthenticationGuide as Fa, classifyDaemonServiceRunStartability as Fi, buildSpaceRoundReadProjection as Fn, renderInfoCard as Fo, areAllowedActionsEquivalent as Fr, updateSpaceMeta as Ft, runAgentsCustomList as G, LocalDaemonControlPlaneClientError as Ga, inspectDaemonServiceInventory as Gi, assertDispatchOwnedRuntimePublicWriteAllowed as Gn, cliJsonSkillsLoadEnvelopeSchema as Go, resolveDaemonServiceFreshnessWarning as Gr, collectSkillsReadinessSnapshot as Gt, runAgents as H, setProfileDefaultView as Ha, isCurrentCommandCheckScopeActive as Hi, runInteractivePrompt as Hn, cliBinaryDeltaPatchSchema as Ho, resolveDaemonDeviceId as Hr, resolveDaemonServiceParticipationStatus as Ht, emitSpaceCliAgentOverview as I, buildHumanAuthenticationCard as Ia, classifyDaemonServiceWakeability as Ii, buildUpdatesReplyWorkflowProjection as In, renderTextInfoCard as Io, buildAgentFacingPublicationModeGuideLines as Ir, readGatewayJsonResponse as It, runAgentsDetect as J, registerAgentActivityRoute as Ja, readCurrentObservedDaemonRuntimeStatus as Ji, writeDispatchSpaceActionRecord as Jn, organizationJoinLinkErrorResponseSchema as Jo, formatDeviceReplyReadinessLabel as Jr, runSkillsInstall as Jt, runAgentsCustomRemove as K, requestLocalAgentActivitySync as Ka, resolveVersionChangeDirection as Ki, readDispatchOwnedRuntimeGuard as Kn, cliJsonSkillsShowEnvelopeSchema as Ko, resolveCurrentReplyReadinessSnapshot as Kr, runSkillsCheck as Kt, prepareLocalAgentReadiness as L, createAuthenticationError as La, resolveServiceUpdateUrgency as Li, createSpaceMemberIdentityIndex as Ln, sanitizeTerminalDisplayText as Lo, canonicalizeAllowedActions as Lr, readGatewayTextResponse as Lt, prepareAuthenticatedSpaceCommandContext as M, clearSelectedOpenMeldProfileId as Ma, getSetupFlowCopy as Mi, buildDispatchResultReplyWorkflowProjection as Mn, canonicalizeLocalProjectPath as Mo, formatAgentOverviewPayload as Mr, fetchSpaceUpdates as Mt, resolveOpenMeldProfileForSpaceCommand as N, getSelectedOpenMeldProfileId as Na, buildDaemonServiceTargetSpec as Ni, buildSignalIndex as Nn, enqueueControllerTaskLifecycleEventWhileLocked as No, OPENMELD_AGENT_MENTAL_MODEL_LINES as Nr, createCliSpaceApi as Nt, parseEnvelope as O, primeOpenMeldProfilesSessionCache as Oa, resolveNativeAgentControllerPermissionModeForController as Oi, inspectSpaceCacheFile as On, removeProjectConnection as Oo, buildAgentOverviewFromContract as Or, createDelayedSpinner as Ot, resolveSpaceAccessLabel as P, setSelectedOpenMeldProfileId as Pa, resolveDaemonServiceAlignmentDecision as Pi, buildSignalMessageReadProjection as Pn, readControllerTaskLifecycleOutboxHealth as Po, SPACE_CONTRACT_ALLOWED_ACTION_ORDER as Pr, fetchSpaceMeta as Pt, runAgentsManage as Q, defaultManagedIntegrationPaths as Qa, resolveDaemonServiceManager as Qi, formatDaemonServiceMissingRecommendation as Qn, resolveOpenClawLocalDiagnosticsValue as Qr, readBundledOpenMeldCliSkillDocumentByPath as Qt, buildReplyReadinessGuidance as R, resolveAuthenticationGuidance as Ra, assessServerRequiredVersion as Ri, formatRemovedCcRelationMessage as Rn, emitCliJsonEnvelope as Ro, readOpenMeldToolsUpdateContextFromEnv as Rr, toStructuredGatewayFailure as Rt, loadSpaceSignalIndexOrNull as S, requireOpenMeldProfile as Sa, listAgentControllerPermissionModeOptions as Si, submitRuntimeAgentControllerReport as Sn, readAgentActivityOutboxHealth as So, SPACE_ADD_MEMBERS_PROGRESS_HEARTBEAT_MS as Sr, runDaemonTeardownStrict as St, buildFormalSignalReadPayload as T, createOpenMeldHumanProfile as Ta, resolveAgentExecutionStatus as Ti, resolveLocalAgentControllerBlockerReasonCodes as Tn, listProjectBindings as To, registerDaemonControlTargetOptions as Tr, buildProfileWorkspaceRows as Tt, runAgentsConfig as U, LocalProjectConnectionError as Ua, resetCurrentCommandCheckState as Ui, assessCliUpdate as Un, cliJsonOutputEnvelopeSchema as Uo, formatDaemonFailureContextText as Ur, runDaemonServiceParticipationGate as Ut, resolveAgentProfileSetup as V, getProfileDefaultView as Va, getCurrentCommandCheckState as Vi, isReturnKeypress as Vn, outLine as Vo, ensureDaemonRuntimePaths as Vr, writeInstalledLocalComponentsSnapshot as Vt, runAgentsCustomAdd as W, validateLocalProjectConnectionPath as Wa, startCurrentCommandCheckScope as Wi, isCliUpdateCheckApplicable as Wn, cliJsonSkillsListEnvelopeSchema as Wo, resolveServiceReadinessFromServiceStatus as Wr, runDaemonStartDecisionPrompt as Wt, runAgentsEnable as X, unregisterAgentActivityRoute as Xa, isDaemonServiceJobNeverSpawned as Xi, resolveElapsedTimeMs as Xn, compareAgentControllerRefsForDisplay as Xo, mapAgentReplyReadinessToLegacyAutoReply as Xr, runSkillsUpdate as Xt, runAgentsDisable as Y, resolveAgentActivityRouteForPath as Ya, getDaemonSystemServiceLogPath as Yi, formatElapsedTime as Yn, revokeOrganizationJoinLinkResponseSchema as Yo, formatHumanReplyReadinessReason as Yr, runSkillsUninstall as Yt, runAgentsList as Z, AGENT_ACTIVITY_INTEGRATION_OWNER as Za, readDaemonServiceJobCrashExitCode as Zi, formatDaemonServiceDowngradeBlockedRecommendation as Zn, resolveGatewayChainReadiness as Zr, ensureLocalSkills as Zt, runSpaceWriteWithPasswordRetry as _, formatMessage as _a, resolveLocalRegistryAgentIdFromAgentControllerRef as _i, formatServiceParticipationReadinessLabel as _n, resolveObservedAgentActivityBinding as _o, createStartAuthenticationGuideError as _r, runDaemonReinstall as _t, runSpaceDelete as a, fetchLatestCliBinaryRelease as aa, resolveConfiguredProfileWorkspacePath as ai, runAuthLogin as an, formatOpenMeldCliCommands as ao, createSpaceAddMembersGuideError as ar, renderOpenMeldBrandBlockLines as at, buildIdentityOnlyMembersSnapshotForReadProjection as b, resolveViewProfileKey as ba, getAgentControllerPermissionModeDisplayMetadata as bi, computeRetryDelayMs as bn, enqueueAgentActivityHookEvent as bo, getCommandHintsFromContract as br, runDaemonStatusFlow as bt, runSpaceLeave as c, writeVersionState as ca, validateCustomProfileWorkspacePath as ci, runAuthStatus as cn, formatProfileAwareOpenMeldCliCommands as co, createSpaceLeaveGuideError as cr, renderOpenMeldTagline as ct, runSpaceRemoveMembers as d, resolveCurrentDaemonExpectedVersion as da, createPrimaryBindingReadSession as di, formatActiveOrganizationLabel as dn, syncLocalAgentActivity as do, createSpaceRemoveMembersGuideError as dr, runDaemon as dt, buildInstallSelfJsonPayload as ea, createModelCatalogReadSession as ei, readRecentDaemonDispatchJournalEvents as en, readAgentActivityIntegrationStatus as eo, createDoctorFailedGuideError as er, runAgentsShow as et, runSpaceSend as f, OPENMELD_VERSION as fa, resolveAgentProfilePrimaryAgentControllerReport as fi, createProfileByKind as fn, readDaemonServiceContract as fo, createSpaceResultGuideError as fr, runDaemonAutostart as ft, runSpaceReadWithPasswordRetry as g, createPresenter as ga, notifyDaemonRouteCatalogChanged as gi, ensureAgentProfileRuntimeBinding as gn, buildAgentActivityEvent as go, createStartAgentIdentityGuideError as gr, runDaemonInterrupt as gt, uploadPreparedSpaceFiles as h, renderHumanTextErrorCard as ha, listBuiltinAgentsRegistryEntries as hi, promptTextEntry as hn, removeAgentActivityContextCache as ho, createSpaceUpdatesGuideError as hr, runDaemonInstall as ht, runSpaceCreate as i, ensureVersionStateReady as ia, readProfileWorkspaceConfig as ii, evaluateCommandAuthentication as in, formatOpenMeldCliCommand as io, createResetConfirmationGuideError as ir, printOpenMeldBanner as it, assertValidSpaceIdTarget as j, alignSelectedOpenMeldProfileStorage as ja, buildOnboardingPlan as ji, buildDispatchResultMessageReadProjection as jn, unbindProject as jo, buildDualViewGuideMessage as jr, readDaemonStartFailureLogTailLines as jt, isSpaceCommandOutputHandledError as k, resolveOpenMeldProfile as ka, PREPARE_SESSION_RECONNECT_GRACE_MS as ki, upsertSpaceConfig as kn, runIfAgentActivityBindingGenerationIsCurrent as ko, DualViewGuideError as kr, shouldEmitAgentOverview as kt, runSpaceList as l, resolveDaemonRuntimeContractCompatibility as la, describeProfileWorkspacePathValidationFailure as li, buildAuthStatusRows as ln, resolveSetupFollowUpCliEntryCommand as lo, createSpaceMenuGuideError as lr, resolveGatewayWebOrigin as lt, prepareRequestedSpaceSendFiles as m, renderHumanErrorCard as ma, reconcileNewRunnableBuiltinAgentsForSetup as mi, resolveCreateProfileName as mn, readAgentActivityContextForPath as mo, createSpaceTargetGuideError as mr, runDaemonCancel as mt, promptAndConfirmSpacePassword as n, buildNextVersionState as na, ensureOpenMeldManagedProfileWorkspace as ni, buildCommandAuthenticationPromptMessage as nn, uninstallAgentActivityIntegrations as no, createProfileCreateGuideError as nr, colorizeAgentLabel as nt, runSpaceHistory as o, fetchLatestPackageInfo as oa, setCustomProfileWorkspace as oi, runAuthLogout as on, formatOpenMeldCliLine as oo, createSpaceAliasTargetGuideError as or, renderOpenMeldHeader as ot, runSpaceWatch as p, buildHumanErrorCopy as pa, listAgentTargetStates as pi, resolveCreateProfileKind as pn, upsertDaemonServiceContract as po, createSpaceSubcommandTargetGuideError as pr, runDaemonBackgroundStartForDecision as pt, runAgentsCustomUpdate as q, isAgentActivityRouteRegistered as qa, readCurrentDaemonRuntimeContext as qi, readDispatchSpaceActionContextFromEnv as qn, getOrganizationJoinLinkResponseSchema as qo, formatAgentReplyReadinessLabel as qr, runSkillsEnsure as qt, runSpaceAddMembers as r, compareSemver as ra, normalizeCustomProfileWorkspacePath as ri, ensureCommandAuthenticationOrCancel as rn, formatInlineOpenMeldCliCommands as ro, createProfileMenuGuideError as rr, colorizeDisplayProfileLabel as rt, runSpaceJoin as s, readVersionState as sa, setOpenMeldManagedProfileWorkspace as si, runAuthMenu as sn, formatOpenMeldCliTextBlock as so, createSpaceContractSetGuideError as sr, renderOpenMeldLogo as st, buildCreateSpacePasswordPromptConfig as t, performManagedInstall as ta, resolveProfileWorkspaceRuntime as ti, connectWebSocket as tn, resolveAgentActivityDispatcherCommand as to, createProfileActionGuideError as tr, formatTransportModeDisplay as tt, runSpacePassword as u, toStartBackgroundHelperExecutionCompatibility as ua, syncDeviceRuntimeStateProjection as ui, buildAuthStatusSnapshot as un, resolveUserFacingCliEntryCommand as uo, createSpacePublicationSetGuideError as ur, resolveSpaceSendText as ut, buildHumanReadSignalsTranscriptItems as v, parseCliViewMode as va, buildAgentControllerRef as vi, resolveServiceParticipationReadiness as vn, normalizeSharedSessionTitle as vo, createUpgradeConfirmationGuideError as vr, runDaemonRunAfterEntryChecks as vt, buildFormalDispatchResultReadPayload as w, createOpenMeldAgentProfile as wa, resolveAgentControllerPermissionModeForController as wi, collectLocalAgentControllerInventory as wn, bindProject as wo, getCliVersionInfo as wr, buildProfileWorkspacePresentation as wt, loadSpaceIdentityDirectoryOrNull as x, isSelectedOpenMeldProfileRequiredError as xa, getAgentControllerPermissionModeFieldLabel as xi, submitProfileRuntimeAgentControllerReport as xn, removeProjectInbox as xo, registerSpaceMemberSelectionOptions as xr, runDaemonStop as xt, emitHumanReadSignalsTextProjection as y, resolveRuntimeContext as ya, createAgentExecutionStatusDisplayRows as yi, assessActionParticipationCandidate as yn, readCodexSessionTitles as yo, getCommandEntryContract as yr, runDaemonSnapshot as yt, resolveHumanControllerDisplayName as z, resolveAuthenticationGuidanceFromError as za, resolveOpenMeldEnvironmentTarget as zi, promptSearchMultiselect as zn, errLine as zo, runPendingDaemonServiceUpdate as zr, parseJsonResponse$1 as zt };
109465
109549
 
109466
- //# sourceMappingURL=command-D_BRRxBQ.js.map
109550
+ //# sourceMappingURL=command-Cp18onuk.js.map