openmeld 0.3.125 → 0.3.128

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.
Files changed (24) hide show
  1. package/dist/{add-me-membership-BCGn5T-D.js → add-me-membership-CoSmA50L.js} +2 -2
  2. package/dist/{add-me-membership-BCGn5T-D.js.map → add-me-membership-CoSmA50L.js.map} +1 -1
  3. package/dist/{api-client-foundation-w4Oa06t4.js → api-client-foundation-eG7A-GEB.js} +84 -25
  4. package/dist/api-client-foundation-eG7A-GEB.js.map +1 -0
  5. package/dist/auth-session-B1jSy0ws.js +1905 -0
  6. package/dist/auth-session-B1jSy0ws.js.map +1 -0
  7. package/dist/{base-url-PkgATS5u.js → base-url-BtqW4aLS.js} +73 -8
  8. package/dist/base-url-BtqW4aLS.js.map +1 -0
  9. package/dist/{command-CD_g9eAM.js → command-BTuYFU2T.js} +884 -587
  10. package/dist/{command-CD_g9eAM.js.map → command-BTuYFU2T.js.map} +1 -1
  11. package/dist/{daemon-runtime-lease-Cvo63MGd.js → daemon-runtime-lease-D82uDZ5s.js} +2 -2
  12. package/dist/{daemon-runtime-lease-Cvo63MGd.js.map → daemon-runtime-lease-D82uDZ5s.js.map} +1 -1
  13. package/dist/{dist-DYE9Q3T4.js → dist-BnHChh7U.js} +3 -3
  14. package/dist/{dist-DYE9Q3T4.js.map → dist-BnHChh7U.js.map} +1 -1
  15. package/dist/openmeld-dev.js +1 -1
  16. package/dist/openmeld.js +512 -102
  17. package/dist/openmeld.js.map +1 -1
  18. package/dist/{runtime-transport-CWWB2Ily.js → runtime-transport-CHbXitKu.js} +2 -2
  19. package/dist/{runtime-transport-CWWB2Ily.js.map → runtime-transport-CHbXitKu.js.map} +1 -1
  20. package/package.json +2 -2
  21. package/dist/api-client-foundation-w4Oa06t4.js.map +0 -1
  22. package/dist/auth-session-qk94UQqs.js +0 -1146
  23. package/dist/auth-session-qk94UQqs.js.map +0 -1
  24. package/dist/base-url-PkgATS5u.js.map +0 -1
package/dist/openmeld.js CHANGED
@@ -1,13 +1,13 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- import { $ as runWithHeldLock, A as toSpaceContractUrl, At as openMeldBackupsDir, D as normalizeBaseUrl, E as updateConfiguredStartV1OnboardingState, F as toSpaceDispatchTraceUrl, Ft as openMeldRootDir, G as buildOpenMeldOrphanedLockAction, Gt as resolveOpenMeldRootDir, Ht as resolveOpenMeldCliEntryNameFromArgv, Jt as skillsDir, K as isOpenMeldLockError, Lt as organizationSkillReleaseDir, Mt as openMeldManagedBinaryPath, Nt as openMeldManagedVersionBinaryPath, Ot as normalizeAccountKey, P as toSpaceDispatchLookupUrl, Q as resolveOpenMeldOrphanedLockIssue, Rt as profileDir, S as setConfiguredSkillsConfig, St as accountsDir, Ut as resolveOpenMeldEnvPreset, V as toSpaceResultUrl, W as acquireLock, X as releaseLockSync, Xt as systemDir, Yt as spacesDir, Z as repairOrphanedLegacyLocks, Zt as formatLocalMachineIssueMessage, a as resolveBaseUrl, at as resolveCliContext, b as setConfiguredBaseUrl, bt as accountProfileViewPath, c as resolveExplicitGatewayUrlOrThrow, ct as formatLaneScopeSentence, ft as createActiveSetupConcurrencyIssue, g as getConfiguredSkillsConfig, gt as toRecognizedLocalMachineFailureError, ht as isLocalMachineFailureError, in as agentControllerConversationRefSchema, k as toSpaceBoardUrl, lt as resolveOpenMeldLaneDescriptor, m as getConfiguredOnboardingDisclaimerAcceptedAt, mt as createOrphanedSetupConcurrencyIssue, nt as OPENMELD_CLI_CONTEXT_ENV_KEY, o as resolveBaseUrlOrNull, q as isOpenMeldOrphanedLockError, tt as LEGACY_OPENMELD_AGENT_SESSION_ENV_KEY, u as alignRuntimeConfigStorage, ut as LocalMachineFailureError, w as updateConfiguredOnboardingConfig, yt as accountProfileSpaceCacheDir, zt as profileViewPath } from "./base-url-PkgATS5u.js";
4
- import { $ as runAgentsRepair, $a as installAgentActivityIntegrations, $i as readRecentDaemonLifecycleEvents, $n as canUseInteractivePrompts, $r as syncProfileWorkspaceState, $t as readRuntimeReportingHealthState, A as assertFullSignalIdArgument, Aa as updateOpenMeldProfile, Ai as buildDaemonRouteObservationPresentation$1, An as assertNoRemovedCcSpaceAddressingSyntax, Ao as setDefaultProjectConnection, Ar as formatDualViewGuideForDisplay, At as runDaemonStartupPreflight, B as persistAgentTransportSelection, Ba as resolveAuthenticationGuidanceFromMessage, Bi as finishCurrentCommandCheckScope, Bn as promptSearchSelect, Bo as outJsonLine, Br as scheduleDaemonServiceUpdate, Bt as resolveLocalComponentsStatus, C as toSpaceMetaUpsertInput, Ca as resolveOpenMeldProfileOrNull, Ci as parseAgentControllerRef, Cn as submitRuntimeAgentControllerReports, Co as removeProjectOutbox, Cr as registerSkillsTargetSelectionOptions, Ct as runDaemonUninstall, D as formatHumanReadTargetList, Da as listOpenMeldProfiles, Di as resolveEvidenceSyncHealth, Dn as resolveLocalAgentControllerReportDecision, Do as migrateProjectBindingStore, Dr as registerBuiltinAgentSelectionOptions, Dt as emitDaemonAgentOverview, E as buildHumanReplyContextSummary, Ea as deleteOpenMeldProfile, Ei as resolveAgentProfileEditCapabilities, En as resolveLocalAgentControllerLaunchability, Eo as listProjectConnectionsWithStatus, Er as registerAuthLoginRequestOptions, Et as reconcileCliVersionView, F as emitSpaceAgentOverview, Fa as buildAgentAuthenticationGuide, Fi as classifyDaemonServiceRunStartability, Fn as buildSpaceRoundReadProjection, Fo as renderInfoCard, Fr as areAllowedActionsEquivalent, Ft as updateSpaceMeta, G as runAgentsCustomList, Ga as LocalDaemonControlPlaneClientError, Gi as inspectDaemonServiceInventory, Gn as assertDispatchOwnedRuntimePublicWriteAllowed, Go as cliJsonSkillsLoadEnvelopeSchema, Gr as resolveDaemonServiceFreshnessWarning, Gt as collectSkillsReadinessSnapshot, H as runAgents, Ha as setProfileDefaultView, Hi as isCurrentCommandCheckScopeActive, Hn as runInteractivePrompt, Ho as cliBinaryDeltaPatchSchema, Hr as resolveDaemonDeviceId, Ht as resolveDaemonServiceParticipationStatus, I as emitSpaceCliAgentOverview, Ia as buildHumanAuthenticationCard, Ii as classifyDaemonServiceWakeability, In as buildUpdatesReplyWorkflowProjection, Io as renderTextInfoCard, Ir as buildAgentFacingPublicationModeGuideLines, It as readGatewayJsonResponse, J as runAgentsDetect, Ja as registerAgentActivityRoute, Ji as readCurrentObservedDaemonRuntimeStatus, Jn as writeDispatchSpaceActionRecord, Jo as organizationJoinLinkErrorResponseSchema, Jr as formatDeviceReplyReadinessLabel, Jt as runSkillsInstall, K as runAgentsCustomRemove, Ka as requestLocalAgentActivitySync, Ki as resolveVersionChangeDirection, Kn as readDispatchOwnedRuntimeGuard, Ko as cliJsonSkillsShowEnvelopeSchema, Kr as resolveCurrentReplyReadinessSnapshot, Kt as runSkillsCheck$1, L as prepareLocalAgentReadiness, La as createAuthenticationError, Li as resolveServiceUpdateUrgency, Ln as createSpaceMemberIdentityIndex, Lo as sanitizeTerminalDisplayText, Lr as canonicalizeAllowedActions, Lt as readGatewayTextResponse, M as prepareAuthenticatedSpaceCommandContext, Ma as clearSelectedOpenMeldProfileId, Mi as getSetupFlowCopy, Mn as buildDispatchResultReplyWorkflowProjection, Mo as canonicalizeLocalProjectPath, Mr as formatAgentOverviewPayload, Mt as fetchSpaceUpdates, N as resolveOpenMeldProfileForSpaceCommand, Na as getSelectedOpenMeldProfileId, Ni as buildDaemonServiceTargetSpec, Nn as buildSignalIndex, No as enqueueControllerTaskLifecycleEventWhileLocked, Nr as OPENMELD_AGENT_MENTAL_MODEL_LINES, Nt as createCliSpaceApi, O as parseEnvelope, Oa as primeOpenMeldProfilesSessionCache, Oi as resolveNativeAgentControllerPermissionModeForController, On as inspectSpaceCacheFile, Oo as removeProjectConnection, Or as buildAgentOverviewFromContract, Ot as createDelayedSpinner, P as resolveSpaceAccessLabel, Pa as setSelectedOpenMeldProfileId, Pi as resolveDaemonServiceAlignmentDecision, Pn as buildSignalMessageReadProjection, Po as readControllerTaskLifecycleOutboxHealth, Pr as SPACE_CONTRACT_ALLOWED_ACTION_ORDER, Pt as fetchSpaceMeta, Q as runAgentsManage, Qa as defaultManagedIntegrationPaths, Qi as resolveDaemonServiceManager, Qn as formatDaemonServiceMissingRecommendation, Qr as resolveOpenClawLocalDiagnosticsValue, Qt as readBundledOpenMeldCliSkillDocumentByPath, R as buildReplyReadinessGuidance, Ra as resolveAuthenticationGuidance, Ri as assessServerRequiredVersion, Rn as formatRemovedCcRelationMessage, Ro as emitCliJsonEnvelope, Rr as readOpenMeldToolsUpdateContextFromEnv, Rt as toStructuredGatewayFailure, S as loadSpaceSignalIndexOrNull, Sa as requireOpenMeldProfile, Si as listAgentControllerPermissionModeOptions, Sn as submitRuntimeAgentControllerReport, So as readAgentActivityOutboxHealth, Sr as SPACE_ADD_MEMBERS_PROGRESS_HEARTBEAT_MS, St as runDaemonTeardownStrict, T as buildFormalSignalReadPayload, Ta as createOpenMeldHumanProfile, Ti as resolveAgentExecutionStatus, Tn as resolveLocalAgentControllerBlockerReasonCodes, To as listProjectBindings, Tr as registerDaemonControlTargetOptions, Tt as buildProfileWorkspaceRows, U as runAgentsConfig, Ua as LocalProjectConnectionError, Ui as resetCurrentCommandCheckState, Un as assessCliUpdate, Uo as cliJsonOutputEnvelopeSchema, Ur as formatDaemonFailureContextText, Ut as runDaemonServiceParticipationGate, V as resolveAgentProfileSetup, Va as getProfileDefaultView, Vi as getCurrentCommandCheckState, Vn as isReturnKeypress, Vo as outLine, Vr as ensureDaemonRuntimePaths, Vt as writeInstalledLocalComponentsSnapshot, W as runAgentsCustomAdd, Wa as validateLocalProjectConnectionPath, Wi as startCurrentCommandCheckScope, Wn as isCliUpdateCheckApplicable, Wo as cliJsonSkillsListEnvelopeSchema, Wr as resolveServiceReadinessFromServiceStatus, Wt as runDaemonStartDecisionPrompt, X as runAgentsEnable, Xa as unregisterAgentActivityRoute, Xi as isDaemonServiceJobNeverSpawned, Xn as resolveElapsedTimeMs, Xo as compareAgentControllerRefsForDisplay, Xr as mapAgentReplyReadinessToLegacyAutoReply, Xt as runSkillsUpdate, Y as runAgentsDisable, Ya as resolveAgentActivityRouteForPath, Yi as getDaemonSystemServiceLogPath, Yn as formatElapsedTime, Yo as revokeOrganizationJoinLinkResponseSchema, Yr as formatHumanReplyReadinessReason$1, Yt as runSkillsUninstall, Z as runAgentsList, Zi as readDaemonServiceJobCrashExitCode, Zn as formatDaemonServiceDowngradeBlockedRecommendation, Zr as resolveGatewayChainReadiness, Zt as ensureLocalSkills, _ as runSpaceWriteWithPasswordRetry, _a as formatMessage, _i as resolveLocalRegistryAgentIdFromAgentControllerRef, _n as formatServiceParticipationReadinessLabel, _o as resolveObservedAgentActivityBinding, _r as createStartAuthenticationGuideError, _t as runDaemonReinstall, a as runSpaceDelete, aa as fetchLatestCliBinaryRelease, ai as resolveConfiguredProfileWorkspacePath, an as runAuthLogin, ao as formatOpenMeldCliCommands, ar as createSpaceAddMembersGuideError, at as renderOpenMeldBrandBlockLines, b as buildIdentityOnlyMembersSnapshotForReadProjection, ba as resolveViewProfileKey, bi as getAgentControllerPermissionModeDisplayMetadata, bn as computeRetryDelayMs, bo as enqueueAgentActivityHookEvent, br as getCommandHintsFromContract, bt as runDaemonStatusFlow, c as runSpaceLeave, ca as writeVersionState, ci as validateCustomProfileWorkspacePath, cn as runAuthStatus, co as formatProfileAwareOpenMeldCliCommands, cr as createSpaceLeaveGuideError, ct as renderOpenMeldTagline, d as runSpaceRemoveMembers, da as resolveCurrentDaemonExpectedVersion, di as createPrimaryBindingReadSession, dn as formatActiveOrganizationLabel, do as syncLocalAgentActivity, dr as createSpaceRemoveMembersGuideError, dt as runDaemon, ea as buildInstallSelfJsonPayload, ei as createModelCatalogReadSession, en as readRecentDaemonDispatchJournalEvents, eo as readAgentActivityIntegrationStatus, er as createDoctorFailedGuideError, et as runAgentsShow, f as runSpaceSend, fa as OPENMELD_VERSION, fi as resolveAgentProfilePrimaryAgentControllerReport, fn as createProfileByKind, fo as readDaemonServiceContract, fr as createSpaceResultGuideError, ft as runDaemonAutostart, g as runSpaceReadWithPasswordRetry, ga as createPresenter, gi as notifyDaemonRouteCatalogChanged, gn as ensureAgentProfileRuntimeBinding, go as buildAgentActivityEvent, gr as createStartAgentIdentityGuideError, gt as runDaemonInterrupt, h as uploadPreparedSpaceFiles, ha as renderHumanTextErrorCard, hi as listBuiltinAgentsRegistryEntries, hn as promptTextEntry, ho as removeAgentActivityContextCache, hr as createSpaceUpdatesGuideError, ht as runDaemonInstall, i as runSpaceCreate, ia as ensureVersionStateReady, ii as readProfileWorkspaceConfig, in as evaluateCommandAuthentication, io as formatOpenMeldCliCommand, ir as createResetConfirmationGuideError, it as printOpenMeldBanner, j as assertValidSpaceIdTarget, ja as alignSelectedOpenMeldProfileStorage, ji as buildOnboardingPlan, jn as buildDispatchResultMessageReadProjection, jo as unbindProject, jr as buildDualViewGuideMessage, jt as readDaemonStartFailureLogTailLines, k as isSpaceCommandOutputHandledError, ka as resolveOpenMeldProfile, kn as upsertSpaceConfig, ko as runIfAgentActivityBindingGenerationIsCurrent, kr as DualViewGuideError, kt as shouldEmitAgentOverview, l as runSpaceList, la as resolveDaemonRuntimeContractCompatibility, li as describeProfileWorkspacePathValidationFailure, ln as buildAuthStatusRows, lo as resolveSetupFollowUpCliEntryCommand, lr as createSpaceMenuGuideError, lt as resolveGatewayWebOrigin, m as prepareRequestedSpaceSendFiles, ma as renderHumanErrorCard, mi as reconcileNewRunnableBuiltinAgentsForSetup, mn as resolveCreateProfileName, mo as readAgentActivityContextForPath, mr as createSpaceTargetGuideError, mt as runDaemonCancel, n as promptAndConfirmSpacePassword, na as buildNextVersionState, ni as ensureOpenMeldManagedProfileWorkspace, nn as buildCommandAuthenticationPromptMessage, no as uninstallAgentActivityIntegrations, nr as createProfileCreateGuideError, nt as colorizeAgentLabel, o as runSpaceHistory, oa as fetchLatestPackageInfo, oi as setCustomProfileWorkspace, on as runAuthLogout, oo as formatOpenMeldCliLine, or as createSpaceAliasTargetGuideError, ot as renderOpenMeldHeader, p as runSpaceWatch, pa as buildHumanErrorCopy, pi as listAgentTargetStates, pn as resolveCreateProfileKind, po as upsertDaemonServiceContract, pr as createSpaceSubcommandTargetGuideError, pt as runDaemonBackgroundStartForDecision, q as runAgentsCustomUpdate, qa as isAgentActivityRouteRegistered, qi as readCurrentDaemonRuntimeContext, qn as readDispatchSpaceActionContextFromEnv, qo as getOrganizationJoinLinkResponseSchema, qr as formatAgentReplyReadinessLabel, qt as runSkillsEnsure, r as runSpaceAddMembers, ra as compareSemver, ri as normalizeCustomProfileWorkspacePath, rn as ensureCommandAuthenticationOrCancel, ro as formatInlineOpenMeldCliCommands, rr as createProfileMenuGuideError, rt as colorizeDisplayProfileLabel, s as runSpaceJoin, sa as readVersionState, si as setOpenMeldManagedProfileWorkspace, sn as runAuthMenu, so as formatOpenMeldCliTextBlock, sr as createSpaceContractSetGuideError, st as renderOpenMeldLogo, t as buildCreateSpacePasswordPromptConfig, ta as performManagedInstall, ti as resolveProfileWorkspaceRuntime, tn as connectWebSocket, to as resolveAgentActivityDispatcherCommand, tr as createProfileActionGuideError, tt as formatTransportModeDisplay, u as runSpacePassword, ua as toStartBackgroundHelperExecutionCompatibility, ui as syncDeviceRuntimeStateProjection, un as buildAuthStatusSnapshot, uo as resolveUserFacingCliEntryCommand, ur as createSpacePublicationSetGuideError, ut as resolveSpaceSendText, v as buildHumanReadSignalsTranscriptItems, va as parseCliViewMode, vi as buildAgentControllerRef, vn as resolveServiceParticipationReadiness, vo as normalizeSharedSessionTitle, vr as createUpgradeConfirmationGuideError, vt as runDaemonRunAfterEntryChecks, w as buildFormalDispatchResultReadPayload, wa as createOpenMeldAgentProfile, wi as resolveAgentControllerPermissionModeForController, wn as collectLocalAgentControllerInventory, wo as bindProject, wr as getCliVersionInfo, wt as buildProfileWorkspacePresentation, x as loadSpaceIdentityDirectoryOrNull, xa as isSelectedOpenMeldProfileRequiredError, xi as getAgentControllerPermissionModeFieldLabel, xn as submitProfileRuntimeAgentControllerReport, xo as removeProjectInbox, xr as registerSpaceMemberSelectionOptions, xt as runDaemonStop, y as emitHumanReadSignalsTextProjection, ya as resolveRuntimeContext, yi as createAgentExecutionStatusDisplayRows, yn as assessActionParticipationCandidate, yo as readCodexSessionTitles, yr as getCommandEntryContract, yt as runDaemonSnapshot, z as resolveHumanControllerDisplayName, za as resolveAuthenticationGuidanceFromError, zi as resolveOpenMeldEnvironmentTarget, zn as promptSearchMultiselect, zo as errLine, zr as runPendingDaemonServiceUpdate, zt as parseJsonResponse } from "./command-CD_g9eAM.js";
5
- import { $ as ownerComputerDiagnosticsSchema, $t as agentActivityInventorySessionStatusSchema, B as sleep, Bt as agentActivityProviderSchema, Ct as authProfileKindSchema, D as toStructuredApiClientFailure, F as OPENMELD_HEADER_PROFILE_ID, G as projectSpaceDispatchTraceFinalVisibleOutcome, Ht as agentActivitySnapshotQuerySchema, J as spaceDispatchTraceDispatchStatusSchema, K as resolveSpaceDispatchTraceRootCause, Ot as submitFeedbackIssueRequestSchema, Qt as agentActivityInventorySessionOriginSchema, Vt as agentActivitySessionStatusSchema, W as SPACE_DISPATCH_TRACE_RESPONSE_CONTRACT_VERSION_HEADER, X as observabilityWakeTraceSelectorSchema, Y as spaceDispatchTraceResponseSchema, Z as projectObservabilityWakeCorrelation, _ as createOrganizationSkillsApi, b as createProjectsApi, c as createAgentProfileBindingApi, d as createCurrentDeviceApi, dn as START_BOUNDED_ID_SCHEMA, en as agentActivitySessionInventoryQuerySchema, et as projectOwnerComputerLocalRuntimes, f as createFeedbackApi, fn as START_BOUNDED_VERSION_SCHEMA, g as createOrganizationApi, gn as localAgentCatalogSchema, gt as organizationSkillBundleSchema, hn as startReplyReadinessSummarySchema, l as createCenterAgentApi, mn as START_TRIMMED_NON_EMPTY_STRING_SCHEMA, nn as localAgentSessionProviderSchema, nt as DEFAULT_AGENT_PROFILE_CREATION_CONFIGURATION, pn as START_ISO_DATE_TIME_SCHEMA, q as spaceDispatchTraceAttemptStatusSchema, rt as agentProfileCreationConfigurationSchema, s as createAgentActivityApi, tt as summarizeComputerFileAccessPolicy, u as createComputerFileAccessApi, v as createPrepareReadinessApi, wt as authProfileManagedRoleSchema, x as createRoutinesApi, yt as stringifyOrganizationSkillBundleCanonicalJson } from "./dist-DYE9Q3T4.js";
6
- import { $n as array, Bt as resolveSpaceFileMimeType, Cr as clientMessageIdSchema, Lt as isSpaceFileTextEditable, Mt as centerAgentInteractionSourceSchema, Wr as openMeldProfileIdSchema, Yr as openMeldRuntimeProfileIdSchema, ar as int, bn as messageEnvelopeSchema, cn as spaceContractSchema, dr as object, er as boolean, hr as string, ii as trimmedStringFromUnknown, ir as enumFactory, jt as spaceStatusSchema, lr as nullFactory, mr as strictObject, ni as nonEmptyTrimmedStringFromUnknown, nn as dispatchExecutionSchema, nr as discriminatedUnion, or as iso, pr as record, rn as spaceThreadContextSchema, sn as spaceContractFieldsSchema, sr as literal, vr as union, yr as unknown } from "./runtime-transport-CWWB2Ily.js";
3
+ import { $ as runWithHeldLock, $t as formatLocalMachineIssueMessage, A as toSpaceContractUrl, At as normalizeAccountKey, Bt as profileDir, D as normalizeBaseUrl, E as updateConfiguredStartV1OnboardingState, F as toSpaceDispatchTraceUrl, Ft as openMeldManagedVersionBinaryPath, G as buildOpenMeldOrphanedLockAction, Gt as resolveOpenMeldEnvPreset, K as isOpenMeldLockError, Lt as openMeldRootDir, Mt as openMeldBackupsDir, P as toSpaceDispatchLookupUrl, Pt as openMeldManagedBinaryPath, Q as resolveOpenMeldOrphanedLockIssue, Qt as systemDir, S as setConfiguredSkillsConfig, St as accountProfileViewPath, V as toSpaceResultUrl, Vt as profileViewPath, W as acquireLock, Wt as resolveOpenMeldCliEntryNameFromArgv, X as releaseLockSync, Xt as skillsDir, Z as repairOrphanedLegacyLocks, Zt as spacesDir, a as resolveBaseUrl, at as resolveCliContext, b as setConfiguredBaseUrl, c as resolveExplicitGatewayUrlOrThrow, ct as formatLaneScopeSentence, ft as createActiveSetupConcurrencyIssue, g as getConfiguredSkillsConfig, gt as toRecognizedLocalMachineFailureError, ht as isLocalMachineFailureError, k as toSpaceBoardUrl, lt as resolveOpenMeldLaneDescriptor, m as getConfiguredOnboardingDisclaimerAcceptedAt, mt as createOrphanedSetupConcurrencyIssue, nt as OPENMELD_CLI_CONTEXT_ENV_KEY, o as resolveBaseUrlOrNull, on as agentControllerConversationRefSchema, q as isOpenMeldOrphanedLockError, qt as resolveOpenMeldRootDir, tt as LEGACY_OPENMELD_AGENT_SESSION_ENV_KEY, u as alignRuntimeConfigStorage, ut as LocalMachineFailureError, w as updateConfiguredOnboardingConfig, wt as accountsDir, xt as accountProfileSpaceCacheDir, zt as organizationSkillReleaseDir } from "./base-url-BtqW4aLS.js";
4
+ import { $ as runAgentsRepair, $a as validateLocalProjectConnectionPath, $i as startCurrentCommandCheckScope, $n as assertDispatchOwnedRuntimePublicWriteAllowed, $o as cliJsonSkillsListEnvelopeSchema, $r as resolveDaemonServiceFreshnessWarning, $t as readBundledOpenMeldCliSkillDocumentByPath, A as assertFullSignalIdArgument, Aa as isSelectedOpenMeldProfileRequiredError, Ai as listAgentControllerPermissionModeOptions, An as submitRuntimeAgentControllerReport, Ao as removeProjectInbox, Ar as SPACE_ADD_MEMBERS_PROGRESS_HEARTBEAT_MS, At as shouldEmitAgentOverview, B as persistAgentTransportSelection, Ba as alignSelectedOpenMeldProfileStorage, Bi as getSetupFlowCopy, Bn as buildDispatchResultReplyWorkflowProjection, Bo as unbindProject, Br as formatAgentOverviewPayload, Bt as parseJsonResponse, C as toSpaceMetaUpsertInput, Ca as renderHumanErrorCard, Ci as listBuiltinAgentsRegistryEntries, Cn as promptTextEntry, Co as readAgentActivityContextForPath, Cr as createSpaceUpdatesGuideError, Ct as runDaemonTeardownStrict, D as formatHumanReadTargetList, Da as parseCliViewMode, Di as createAgentExecutionStatusDisplayRows, Dn as assessActionParticipationCandidate, Do as normalizeSharedSessionTitle, Dr as getCommandEntryContract, Dt as reconcileCliVersionView, E as buildHumanReplyContextSummary, Ea as formatMessage, Ei as buildAgentControllerRef, En as resolveServiceParticipationReadiness, Eo as resolveObservedAgentActivityBinding, Er as createUpgradeConfirmationGuideError, Et as buildProfileWorkspaceRows, F as emitSpaceAgentOverview, Fa as deleteOpenMeldProfile, Fi as resolveEvidenceSyncHealth, Fn as resolveLocalAgentControllerReportDecision, Fo as listProjectConnectionsWithStatus, Fr as registerBuiltinAgentSelectionOptions, Ft as fetchSpaceMeta, G as runAgentsCustomList, Ga as buildHumanAuthenticationCard, Gi as resolveServiceUpdateUrgency, Gn as createSpaceMemberIdentityIndex, Go as renderTextInfoCard, Gr as canonicalizeAllowedActions, Gt as runDaemonStartDecisionPrompt, H as runAgents, Ha as getSelectedOpenMeldProfileId, Hi as resolveDaemonServiceAlignmentDecision, Hn as buildSignalMessageReadProjection, Ho as enqueueControllerTaskLifecycleEventWhileLocked, Hr as SPACE_CONTRACT_ALLOWED_ACTION_ORDER, Ht as writeInstalledLocalComponentsSnapshot, I as emitSpaceCliAgentOverview, Ia as listOpenMeldProfiles, Ii as resolveNativeAgentControllerPermissionModeForController, In as inspectSpaceCacheFile, Io as migrateProjectBindingStore, Ir as buildAgentOverviewFromContract, It as updateSpaceMeta, J as runAgentsDetect, Ja as resolveAuthenticationGuidanceFromError, Ji as resolveAuthBaseUrl, Jn as promptSearchSelect, Jo as errLine, Jr as scheduleDaemonServiceUpdate, Jt as runSkillsEnsure, K as runAgentsCustomRemove, Ka as createAuthenticationError, Ki as assessServerRequiredVersion, Kn as formatRemovedCcRelationMessage, Ko as sanitizeTerminalDisplayText, Kr as readOpenMeldToolsUpdateContextFromEnv, Kt as collectSkillsReadinessSnapshot, L as prepareLocalAgentReadiness, La as primeOpenMeldProfilesSessionCache, Ln as upsertSpaceConfig, Lo as removeProjectConnection, Lr as DualViewGuideError, Lt as readGatewayJsonResponse, M as prepareAuthenticatedSpaceCommandContext, Ma as resolveOpenMeldProfileOrNull, Mi as resolveAgentControllerPermissionModeForController, Mn as collectLocalAgentControllerInventory, Mo as removeProjectOutbox, Mr as getCliVersionInfo, Mt as readDaemonStartFailureLogTailLines, N as resolveOpenMeldProfileForSpaceCommand, Na as createOpenMeldAgentProfile, Ni as resolveAgentExecutionStatus, Nn as resolveLocalAgentControllerBlockerReasonCodes, No as bindProject, Nr as registerDaemonControlTargetOptions, Nt as fetchSpaceUpdates, O as parseEnvelope, Oa as resolveRuntimeContext, Oi as getAgentControllerPermissionModeDisplayMetadata, On as computeRetryDelayMs, Oo as readCodexSessionTitles, Or as getCommandHintsFromContract, Ot as emitDaemonAgentOverview, P as resolveSpaceAccessLabel, Pa as createOpenMeldHumanProfile, Pi as resolveAgentProfileEditCapabilities, Pn as resolveLocalAgentControllerLaunchability, Po as listProjectBindings, Pr as registerAuthLoginRequestOptions, Pt as createCliSpaceApi, Q as runAgentsManage, Qa as LocalProjectConnectionError, Qi as resetCurrentCommandCheckState, Qn as isCliUpdateCheckApplicable, Qo as cliJsonOutputEnvelopeSchema, Qr as resolveServiceReadinessFromServiceStatus, Qt as ensureLocalSkills, R as buildReplyReadinessGuidance, Ra as resolveOpenMeldProfile, Ri as buildDaemonRouteObservationPresentation$1, Rn as assertNoRemovedCcSpaceAddressingSyntax, Ro as runIfAgentActivityBindingGenerationIsCurrent, Rr as formatDualViewGuideForDisplay, Rt as readGatewayTextResponse, S as loadSpaceSignalIndexOrNull, Sa as buildHumanErrorCopy, Si as reconcileNewRunnableBuiltinAgentsForSetup, Sn as resolveCreateProfileName, So as upsertDaemonServiceContract, Sr as createSpaceTargetGuideError, St as runDaemonStop, T as buildFormalSignalReadPayload, Ta as createPresenter, Ti as resolveLocalRegistryAgentIdFromAgentControllerRef, Tn as formatServiceParticipationReadinessLabel, To as buildAgentActivityEvent, Tr as createStartAuthenticationGuideError, Tt as buildProfileWorkspacePresentation, U as runAgentsConfig, Ua as setSelectedOpenMeldProfileId, Ui as classifyDaemonServiceRunStartability, Un as buildSpaceRoundReadProjection, Uo as readControllerTaskLifecycleOutboxHealth, Ur as areAllowedActionsEquivalent, Ut as resolveDaemonServiceParticipationStatus, V as resolveAgentProfileSetup, Va as clearSelectedOpenMeldProfileId, Vi as buildDaemonServiceTargetSpec, Vn as buildSignalIndex, Vo as canonicalizeLocalProjectPath, Vr as OPENMELD_AGENT_MENTAL_MODEL_LINES, Vt as resolveLocalComponentsStatus, W as runAgentsCustomAdd, Wa as buildAgentAuthenticationGuide, Wi as classifyDaemonServiceWakeability, Wn as buildUpdatesReplyWorkflowProjection, Wo as renderInfoCard, Wr as buildAgentFacingPublicationModeGuideLines, Wt as runDaemonServiceParticipationGate, X as runAgentsEnable, Xa as getProfileDefaultView, Xi as getCurrentCommandCheckState, Xn as runInteractivePrompt, Xo as outLine, Xr as resolveDaemonDeviceId, Xt as runSkillsUninstall, Y as runAgentsDisable, Ya as resolveAuthenticationGuidanceFromMessage, Yi as finishCurrentCommandCheckScope, Yn as isReturnKeypress, Yo as outJsonLine, Yr as ensureDaemonRuntimePaths, Yt as runSkillsInstall, Z as runAgentsList, Za as setProfileDefaultView, Zi as isCurrentCommandCheckScopeActive, Zn as assessCliUpdate, Zo as cliBinaryDeltaPatchSchema, Zr as formatDaemonFailureContextText, Zt as runSkillsUpdate, _ as runSpaceWriteWithPasswordRetry, _a as writeVersionState, _i as describeProfileWorkspacePathValidationFailure, _n as resolveDeviceAuthClientId, _o as formatProfileAwareOpenMeldCliCommands, _r as createSpaceMenuGuideError, _t as runDaemonInterrupt, a as runSpaceDelete, aa as isDaemonServiceJobNeverSpawned, ai as resolveGatewayChainReadiness, an as evaluateCommandAuthentication, ao as unregisterAgentActivityRoute, ar as formatDaemonServiceDowngradeBlockedRecommendation, as as compareAgentControllerRefsForDisplay, at as renderOpenMeldBrandBlockLines, b as buildIdentityOnlyMembersSnapshotForReadProjection, ba as resolveCurrentDaemonExpectedVersion, bi as resolveAgentProfilePrimaryAgentControllerReport, bn as createProfileByKind, bo as syncLocalAgentActivity, br as createSpaceResultGuideError, bt as runDaemonSnapshot, c as runSpaceLeave, ca as readRecentDaemonLifecycleEvents, ci as createModelCatalogReadSession, cn as runAuthMenu, co as installAgentActivityIntegrations, cr as createDoctorFailedGuideError, ct as renderOpenMeldTagline, d as runSpaceRemoveMembers, da as buildNextVersionState, di as normalizeCustomProfileWorkspacePath, dn as buildAuthStatusRows, do as uninstallAgentActivityIntegrations, dr as createProfileMenuGuideError, dt as bestEffortStopCurrentLaneDaemonService, ea as inspectDaemonServiceInventory, ei as resolveCurrentReplyReadinessSnapshot, en as readRuntimeReportingHealthState, eo as LocalDaemonControlPlaneClientError, er as readDispatchOwnedRuntimeGuard, es as cliJsonSkillsLoadEnvelopeSchema, et as runAgentsShow, f as runSpaceSend, fa as compareSemver, fi as readProfileWorkspaceConfig, fn as buildAuthStatusSnapshot, fo as formatInlineOpenMeldCliCommands, fr as createResetConfirmationGuideError, ft as runDaemon, g as runSpaceReadWithPasswordRetry, ga as readVersionState, gi as validateCustomProfileWorkspacePath, gn as requestDeviceToken, go as formatOpenMeldCliTextBlock, gr as createSpaceLeaveGuideError, gt as runDaemonInstall, h as uploadPreparedSpaceFiles, ha as fetchLatestPackageInfo, hi as setOpenMeldManagedProfileWorkspace, hn as fetchAuthUserSnapshot, ho as formatOpenMeldCliLine, hr as createSpaceContractSetGuideError, ht as runDaemonCancel, i as runSpaceCreate, ia as getDaemonSystemServiceLogPath, ii as mapAgentReplyReadinessToLegacyAutoReply, in as ensureCommandAuthenticationOrCancel, io as resolveAgentActivityRouteForPath, ir as resolveElapsedTimeMs, is as revokeOrganizationJoinLinkResponseSchema, it as printOpenMeldBanner, j as assertValidSpaceIdTarget, ja as requireOpenMeldProfile, ji as parseAgentControllerRef, jn as submitRuntimeAgentControllerReports, jo as readAgentActivityOutboxHealth, jr as registerSkillsTargetSelectionOptions, jt as runDaemonStartupPreflight, k as isSpaceCommandOutputHandledError, ka as resolveViewProfileKey, ki as getAgentControllerPermissionModeFieldLabel, kn as submitProfileRuntimeAgentControllerReport, ko as enqueueAgentActivityHookEvent, kr as registerSpaceMemberSelectionOptions, kt as createDelayedSpinner, l as runSpaceList, la as buildInstallSelfJsonPayload, li as resolveProfileWorkspaceRuntime, ln as runAuthStatus, lo as readAgentActivityIntegrationStatus, lr as createProfileActionGuideError, lt as resolveGatewayWebOrigin, m as prepareRequestedSpaceSendFiles, ma as fetchLatestCliBinaryRelease, mi as setCustomProfileWorkspace, mn as extractAuthApiErrorMessage, mo as formatOpenMeldCliCommands, mr as createSpaceAliasTargetGuideError, mt as runDaemonBackgroundStartForDecision, n as promptAndConfirmSpacePassword, na as readCurrentDaemonRuntimeContext, ni as formatDeviceReplyReadinessLabel, nn as connectWebSocket, no as isAgentActivityRouteRegistered, nr as writeDispatchSpaceActionRecord, ns as getOrganizationJoinLinkResponseSchema, nt as colorizeAgentLabel, o as runSpaceHistory, oa as readDaemonServiceJobCrashExitCode, oi as resolveOpenClawLocalDiagnosticsValue, on as runAuthLogin, or as formatDaemonServiceMissingRecommendation, ot as renderOpenMeldHeader, p as runSpaceWatch, pa as ensureVersionStateReady, pi as resolveConfiguredProfileWorkspacePath, pn as formatActiveOrganizationLabel, po as formatOpenMeldCliCommand, pr as createSpaceAddMembersGuideError, pt as runDaemonAutostart, q as runAgentsCustomUpdate, qa as resolveAuthenticationGuidance, qi as resolveOpenMeldEnvironmentTarget, qn as promptSearchMultiselect, qo as emitCliJsonEnvelope, qr as runPendingDaemonServiceUpdate, qt as runSkillsCheck$1, r as runSpaceAddMembers, ra as readCurrentObservedDaemonRuntimeStatus, ri as formatHumanReplyReadinessReason$1, rn as buildCommandAuthenticationPromptMessage, ro as registerAgentActivityRoute, rr as formatElapsedTime, rs as organizationJoinLinkErrorResponseSchema, rt as colorizeDisplayProfileLabel, s as runSpaceJoin, sa as resolveDaemonServiceManager, si as syncProfileWorkspaceState, sn as runAuthLogout, so as defaultManagedIntegrationPaths, sr as canUseInteractivePrompts, st as renderOpenMeldLogo, t as buildCreateSpacePasswordPromptConfig, ta as resolveVersionChangeDirection, ti as formatAgentReplyReadinessLabel, tn as readRecentDaemonDispatchJournalEvents, to as requestLocalAgentActivitySync, tr as readDispatchSpaceActionContextFromEnv, ts as cliJsonSkillsShowEnvelopeSchema, tt as formatTransportModeDisplay, u as runSpacePassword, ua as performManagedInstall, ui as ensureOpenMeldManagedProfileWorkspace, un as exchangeOneTimeTokenAuthSession, uo as resolveAgentActivityDispatcherCommand, ur as createProfileCreateGuideError, ut as resolveSpaceSendText, v as buildHumanReadSignalsTranscriptItems, va as resolveDaemonRuntimeContractCompatibility, vi as syncDeviceRuntimeStateProjection, vn as resolveDeviceTokenExpiresAt, vo as resolveSetupFollowUpCliEntryCommand, vr as createSpacePublicationSetGuideError, vt as runDaemonReinstall, w as buildFormalDispatchResultReadPayload, wa as renderHumanTextErrorCard, wi as notifyDaemonRouteCatalogChanged, wn as ensureAgentProfileRuntimeBinding, wo as removeAgentActivityContextCache, wr as createStartAgentIdentityGuideError, wt as runDaemonUninstall, x as loadSpaceIdentityDirectoryOrNull, xa as OPENMELD_VERSION, xi as listAgentTargetStates, xn as resolveCreateProfileKind, xo as readDaemonServiceContract, xr as createSpaceSubcommandTargetGuideError, xt as runDaemonStatusFlow, y as emitHumanReadSignalsTextProjection, ya as toStartBackgroundHelperExecutionCompatibility, yi as createPrimaryBindingReadSession, yn as revokeAuthAccessToken, yo as resolveUserFacingCliEntryCommand, yr as createSpaceRemoveMembersGuideError, yt as runDaemonRunAfterEntryChecks, z as resolveHumanControllerDisplayName, za as updateOpenMeldProfile, zi as buildOnboardingPlan, zn as buildDispatchResultMessageReadProjection, zo as setDefaultProjectConnection, zr as buildDualViewGuideMessage, zt as toStructuredGatewayFailure } from "./command-BTuYFU2T.js";
5
+ import { $ as ownerComputerDiagnosticsSchema, $t as agentActivityInventorySessionStatusSchema, B as sleep, Bt as agentActivityProviderSchema, Ct as authProfileKindSchema, D as toStructuredApiClientFailure, F as OPENMELD_HEADER_PROFILE_ID, G as projectSpaceDispatchTraceFinalVisibleOutcome, Ht as agentActivitySnapshotQuerySchema, J as spaceDispatchTraceDispatchStatusSchema, K as resolveSpaceDispatchTraceRootCause, Ot as submitFeedbackIssueRequestSchema, Qt as agentActivityInventorySessionOriginSchema, Vt as agentActivitySessionStatusSchema, W as SPACE_DISPATCH_TRACE_RESPONSE_CONTRACT_VERSION_HEADER, X as observabilityWakeTraceSelectorSchema, Y as spaceDispatchTraceResponseSchema, Z as projectObservabilityWakeCorrelation, _ as createOrganizationSkillsApi, b as createProjectsApi, c as createAgentProfileBindingApi, d as createCurrentDeviceApi, dn as START_BOUNDED_ID_SCHEMA, en as agentActivitySessionInventoryQuerySchema, et as projectOwnerComputerLocalRuntimes, f as createFeedbackApi, fn as START_BOUNDED_VERSION_SCHEMA, g as createOrganizationApi, gn as localAgentCatalogSchema, gt as organizationSkillBundleSchema, hn as startReplyReadinessSummarySchema, l as createCenterAgentApi, mn as START_TRIMMED_NON_EMPTY_STRING_SCHEMA, nn as localAgentSessionProviderSchema, nt as DEFAULT_AGENT_PROFILE_CREATION_CONFIGURATION, pn as START_ISO_DATE_TIME_SCHEMA, q as spaceDispatchTraceAttemptStatusSchema, rt as agentProfileCreationConfigurationSchema, s as createAgentActivityApi, tt as summarizeComputerFileAccessPolicy, u as createComputerFileAccessApi, v as createPrepareReadinessApi, wt as authProfileManagedRoleSchema, x as createRoutinesApi, yt as stringifyOrganizationSkillBundleCanonicalJson } from "./dist-BnHChh7U.js";
6
+ import { $n as array, Bt as resolveSpaceFileMimeType, Cr as clientMessageIdSchema, Lt as isSpaceFileTextEditable, Mt as centerAgentInteractionSourceSchema, Wr as openMeldProfileIdSchema, Yr as openMeldRuntimeProfileIdSchema, ar as int, bn as messageEnvelopeSchema, cn as spaceContractSchema, dr as object, er as boolean, hr as string, ii as trimmedStringFromUnknown, ir as enumFactory, jt as spaceStatusSchema, lr as nullFactory, mr as strictObject, ni as nonEmptyTrimmedStringFromUnknown, nn as dispatchExecutionSchema, nr as discriminatedUnion, or as iso, pr as record, rn as spaceThreadContextSchema, sn as spaceContractFieldsSchema, sr as literal, vr as union, yr as unknown } from "./runtime-transport-CHbXitKu.js";
7
7
  import { r as daemonServiceLaneSchema } from "./service-contract-CRyDcIIf.js";
8
- import { j as getDaemonStatus } from "./daemon-runtime-lease-Cvo63MGd.js";
9
- import { a as getCurrentAuthOwnerUserId, c as updateAuthSessionActiveOrganization, d as resolveOpenMeldDistribution, i as getAuthSessionState, l as runMacOsNativeKeychainHelperIfRequested, n as clearAuthSession, o as normalizeStoredActiveOrganization, r as getAuthSessionMetadata, u as isBinaryDistribution } from "./auth-session-qk94UQqs.js";
10
- import { c as buildRequestAuthHeaders, d as buildOpenMeldRequestContextFromProfile, n as createCliApiClientFoundation, p as deriveAuthBaseUrlFromGatewayUrl, r as fetchSpaceRequestWithTimeout, s as buildOpenMeldRequestContextHeadersWithAuth } from "./api-client-foundation-w4Oa06t4.js";
8
+ import { j as getDaemonStatus } from "./daemon-runtime-lease-D82uDZ5s.js";
9
+ import { _ as isBinaryDistribution, a as clearAuthSession, c as getAuthSessionState, d as markInterruptedComputerAuthSessionRecovery, f as normalizeStoredActiveOrganization, g as runMacOsNativeKeychainHelperIfRequested, h as updateAuthSessionActiveOrganization, i as beginAuthSessionTransition, l as getCurrentAuthOwnerUserId, o as completeInterruptedComputerAuthSessionRecovery, p as recordInterruptedComputerAuthSessionRecoveryFailure, s as getAuthSessionMetadata, t as AuthSessionRecoveryInProgressError, u as getInterruptedComputerAuthSessionRecovery, v as resolveOpenMeldDistribution } from "./auth-session-B1jSy0ws.js";
10
+ import { c as buildOpenMeldRequestContextHeadersWithAuth, d as buildOpenMeldRequestContextFromProfile, l as buildRequestAuthHeaders, n as createCliApiClientFoundation, p as deriveAuthBaseUrlFromGatewayUrl, r as fetchSpaceRequestWithTimeout } from "./api-client-foundation-eG7A-GEB.js";
11
11
  import { Command, Option } from "commander";
12
12
  import os, { homedir, hostname, release, tmpdir } from "node:os";
13
13
  import * as z$1 from "zod/v4";
@@ -3399,7 +3399,7 @@ async function resolveUpgradeStatus(input) {
3399
3399
  distribution,
3400
3400
  currentVersion: input.currentVersion,
3401
3401
  checkedAt: input.checkedAt,
3402
- error: toErrorMessage$7(error)
3402
+ error: toErrorMessage$9(error)
3403
3403
  };
3404
3404
  }
3405
3405
  }
@@ -3483,7 +3483,7 @@ function parseInstallSelfJsonOutput(output) {
3483
3483
  try {
3484
3484
  parsed = JSON.parse(jsonLine);
3485
3485
  } catch (error) {
3486
- throw new Error(`binary install-self emitted invalid JSON: ${toErrorMessage$7(error)}`);
3486
+ throw new Error(`binary install-self emitted invalid JSON: ${toErrorMessage$9(error)}`);
3487
3487
  }
3488
3488
  if (!parsed || typeof parsed !== "object") throw new Error("binary install-self emitted an invalid JSON payload");
3489
3489
  const record = parsed;
@@ -3820,7 +3820,7 @@ function emitUpgradeCompleted(input) {
3820
3820
  text: "OpenMeld CLI upgrade completed."
3821
3821
  });
3822
3822
  }
3823
- function toErrorMessage$7(error) {
3823
+ function toErrorMessage$9(error) {
3824
3824
  if (error instanceof Error) return error.message;
3825
3825
  return String(error);
3826
3826
  }
@@ -5546,7 +5546,7 @@ const CHOOSE_PROFILE = "__command_entry_choose_profile__";
5546
5546
  const CREATE_PROFILE = "__command_entry_create_profile__";
5547
5547
  const CANCEL_PROFILE = "__command_entry_cancel_profile__";
5548
5548
  async function runSelectedProfileCheck(input) {
5549
- const explicitProfileArg = normalizeOptionalString$13(input.context.profileArg);
5549
+ const explicitProfileArg = normalizeOptionalString$16(input.context.profileArg);
5550
5550
  const hasExplicitProfileArg = explicitProfileArg !== null;
5551
5551
  const requiresConfirmation = input.requirement.mode === "confirm" && input.context.runtime.resolvedView === "human" && input.context.allowPrompt && !hasExplicitProfileArg;
5552
5552
  const currentState = getCurrentCommandCheckState();
@@ -5719,7 +5719,7 @@ function ensureCurrentProfileIsVisible(input) {
5719
5719
  function resolveProfileConfirmationMessage(entryName) {
5720
5720
  return entryName === "space.join" ? SPACE_JOIN_PROFILE_SELECTION_MESSAGE : SPACE_COMMAND_PROFILE_SELECTION_MESSAGE;
5721
5721
  }
5722
- function normalizeOptionalString$13(value) {
5722
+ function normalizeOptionalString$16(value) {
5723
5723
  const normalized = String(value ?? "").trim();
5724
5724
  return normalized.length > 0 ? normalized : null;
5725
5725
  }
@@ -6270,6 +6270,13 @@ const PASSIVE_CLI_QUERY_FLAGS = /* @__PURE__ */ new Set([
6270
6270
  "-V",
6271
6271
  "-h"
6272
6272
  ]);
6273
+ const PASSIVE_CLI_QUERY_COMMANDS = /* @__PURE__ */ new Set([
6274
+ "auth status",
6275
+ "service snapshot",
6276
+ "service status",
6277
+ "service trace",
6278
+ "whoami"
6279
+ ]);
6273
6280
  function isStandaloneViewQueryArgv(argv) {
6274
6281
  const args = argv.slice(2);
6275
6282
  return args.length === 1 && args[0] === "--view";
@@ -6346,7 +6353,7 @@ function isPassiveCliQueryArgv(argv) {
6346
6353
  if (arg.startsWith("--view=") || arg.startsWith("--service-auto-install=")) continue;
6347
6354
  if (arg === "help" || PASSIVE_CLI_QUERY_FLAGS.has(arg)) return true;
6348
6355
  }
6349
- return false;
6356
+ return PASSIVE_CLI_QUERY_COMMANDS.has(parseLeadingCommandTokensFromArgv(argv, 2).join(" "));
6350
6357
  }
6351
6358
  function hasJsonOutputArgv(argv) {
6352
6359
  for (let i = 2; i < argv.length; i += 1) {
@@ -6418,7 +6425,7 @@ async function runCommandWithEntryChecks(input) {
6418
6425
  allowPrompt: runtime.interactive,
6419
6426
  environmentTarget,
6420
6427
  gatewayUrl: normalizedGatewayUrl,
6421
- profileArg: normalizeOptionalString$12(input.profile),
6428
+ profileArg: normalizeOptionalString$15(input.profile),
6422
6429
  jsonOutput
6423
6430
  }),
6424
6431
  jsonOutput
@@ -6427,7 +6434,7 @@ async function runCommandWithEntryChecks(input) {
6427
6434
  finishCurrentCommandCheckScope();
6428
6435
  }
6429
6436
  }
6430
- function normalizeOptionalString$12(value) {
6437
+ function normalizeOptionalString$15(value) {
6431
6438
  const normalized = String(value ?? "").trim();
6432
6439
  return normalized.length > 0 ? normalized : null;
6433
6440
  }
@@ -7534,8 +7541,8 @@ function normalizeOrganizationSelectionPayload(payload) {
7534
7541
  message: "OpenMeld auth returned an invalid Organization selection."
7535
7542
  });
7536
7543
  return {
7537
- activeOrganizationId: normalizeOptionalString$11(payload.session.activeOrganizationId),
7538
- lastSelectedOrganizationId: normalizeOptionalString$11(payload.user.lastSelectedOrganizationId)
7544
+ activeOrganizationId: normalizeOptionalString$14(payload.session.activeOrganizationId),
7545
+ lastSelectedOrganizationId: normalizeOptionalString$14(payload.user.lastSelectedOrganizationId)
7539
7546
  };
7540
7547
  }
7541
7548
  function normalizeOrganizationListPayload(payload) {
@@ -7567,7 +7574,7 @@ function normalizeOrganizationFromPayload(payload) {
7567
7574
  if (!isRecord(payload)) return null;
7568
7575
  const organization = normalizeStoredActiveOrganization(payload.organization);
7569
7576
  if (!organization) return null;
7570
- const role = normalizeOptionalString$11(payload.role) ?? (isRecord(payload.member) ? normalizeOptionalString$11(payload.member.role) : null);
7577
+ const role = normalizeOptionalString$14(payload.role) ?? (isRecord(payload.member) ? normalizeOptionalString$14(payload.member.role) : null);
7571
7578
  return {
7572
7579
  ...organization,
7573
7580
  ...role ? { role } : {}
@@ -7637,13 +7644,13 @@ function parseJsonOrNull(raw) {
7637
7644
  }
7638
7645
  function readRequestId(payload) {
7639
7646
  if (!isRecord(payload)) return null;
7640
- return normalizeOptionalString$11(payload.requestId) ?? (isRecord(payload.error) ? normalizeOptionalString$11(payload.error.requestId) : null);
7647
+ return normalizeOptionalString$14(payload.requestId) ?? (isRecord(payload.error) ? normalizeOptionalString$14(payload.error.requestId) : null);
7641
7648
  }
7642
7649
  function readErrorMessage(payload) {
7643
7650
  if (!isRecord(payload)) return null;
7644
- return normalizeOptionalString$11(payload.message) ?? (isRecord(payload.error) ? normalizeOptionalString$11(payload.error.message) : null);
7651
+ return normalizeOptionalString$14(payload.message) ?? (isRecord(payload.error) ? normalizeOptionalString$14(payload.error.message) : null);
7645
7652
  }
7646
- function normalizeOptionalString$11(value) {
7653
+ function normalizeOptionalString$14(value) {
7647
7654
  const normalized = String(value ?? "").trim();
7648
7655
  return normalized.length > 0 ? normalized : null;
7649
7656
  }
@@ -8051,7 +8058,7 @@ async function createCenterAgentApiClient(input) {
8051
8058
  const CODEX_THREAD_ID_ENV = "CODEX_THREAD_ID";
8052
8059
  const CLAUDE_CODE_SESSION_ID_ENV = "CLAUDE_CODE_SESSION_ID";
8053
8060
  function detectLocalAgentEnvironment(env) {
8054
- const claudeSessionId = normalizeOptionalString$10(env[CLAUDE_CODE_SESSION_ID_ENV]);
8061
+ const claudeSessionId = normalizeOptionalString$13(env[CLAUDE_CODE_SESSION_ID_ENV]);
8055
8062
  if (claudeSessionId) return {
8056
8063
  kind: "agent",
8057
8064
  agentControllerConversationId: claudeSessionId,
@@ -8059,7 +8066,7 @@ function detectLocalAgentEnvironment(env) {
8059
8066
  conversationKind: "session",
8060
8067
  label: "Claude Code"
8061
8068
  };
8062
- const codexThreadId = normalizeOptionalString$10(env[CODEX_THREAD_ID_ENV]);
8069
+ const codexThreadId = normalizeOptionalString$13(env[CODEX_THREAD_ID_ENV]);
8063
8070
  if (codexThreadId) return {
8064
8071
  kind: "agent",
8065
8072
  agentControllerConversationId: codexThreadId,
@@ -8071,9 +8078,9 @@ function detectLocalAgentEnvironment(env) {
8071
8078
  return { kind: "human" };
8072
8079
  }
8073
8080
  function isCodexLikeEnvironment(env) {
8074
- return Boolean(normalizeOptionalString$10(env.CODEX_SHELL) || normalizeOptionalString$10(env.CODEX_CI) || normalizeOptionalString$10(env.CODEX_SESSION_ID) || normalizeOptionalString$10(env.CODEX_INTERNAL_ORIGINATOR_OVERRIDE));
8081
+ return Boolean(normalizeOptionalString$13(env.CODEX_SHELL) || normalizeOptionalString$13(env.CODEX_CI) || normalizeOptionalString$13(env.CODEX_SESSION_ID) || normalizeOptionalString$13(env.CODEX_INTERNAL_ORIGINATOR_OVERRIDE));
8075
8082
  }
8076
- function normalizeOptionalString$10(value) {
8083
+ function normalizeOptionalString$13(value) {
8077
8084
  if (typeof value !== "string") return null;
8078
8085
  const normalized = value.trim();
8079
8086
  return normalized.length > 0 ? normalized : null;
@@ -9453,6 +9460,190 @@ function formatLastSeen(lastObservedAtMs) {
9453
9460
  }).format(new Date(lastObservedAtMs))}`;
9454
9461
  }
9455
9462
  //#endregion
9463
+ //#region src/commands/computer-auth-session.ts
9464
+ async function exchangeComputerAuthorizationGrant(input) {
9465
+ const authBaseUrl = resolveAuthBaseUrl(input.authBaseUrl);
9466
+ const clientId = resolveDeviceAuthClientId(input.clientId);
9467
+ const tokenResult = await requestDeviceToken({
9468
+ authBaseUrl,
9469
+ clientId,
9470
+ deviceCode: normalizeRequiredString(input.deviceCode, "computer authorization code is required")
9471
+ });
9472
+ if (!tokenResult.ok) throw new Error(`computer authorization failed: ${extractAuthApiErrorMessage(tokenResult.error, tokenResult.status)}`);
9473
+ let user;
9474
+ try {
9475
+ user = await fetchAuthUserSnapshot({
9476
+ authBaseUrl,
9477
+ accessToken: tokenResult.data.access_token
9478
+ });
9479
+ } catch (error) {
9480
+ const cleanup = await revokeAuthAccessToken({
9481
+ accessToken: tokenResult.data.access_token,
9482
+ authBaseUrl,
9483
+ tokenType: tokenResult.data.token_type
9484
+ });
9485
+ throw new Error(`computer authorization could not verify its OpenMeld account: ${toErrorMessage$8(error)}${formatCleanupFailure(cleanup)}`, { cause: error });
9486
+ }
9487
+ const userId = normalizeOptionalString$12(user?.id);
9488
+ if (!userId) {
9489
+ const cleanup = await revokeAuthAccessToken({
9490
+ accessToken: tokenResult.data.access_token,
9491
+ authBaseUrl,
9492
+ tokenType: tokenResult.data.token_type
9493
+ });
9494
+ throw new Error(`computer authorization account response did not include a user id${formatCleanupFailure(cleanup)}`);
9495
+ }
9496
+ const expiresAt = resolveDeviceTokenExpiresAt(tokenResult.data.expires_in);
9497
+ const scope = normalizeOptionalString$12(tokenResult.data.scope);
9498
+ return {
9499
+ accessToken: tokenResult.data.access_token,
9500
+ tokenType: tokenResult.data.token_type,
9501
+ authBaseUrl,
9502
+ clientId,
9503
+ ...expiresAt ? { expiresAt } : {},
9504
+ ...scope ? { scope } : {},
9505
+ user: {
9506
+ ...user,
9507
+ id: userId
9508
+ }
9509
+ };
9510
+ }
9511
+ function revokePreparedAuthSession(session) {
9512
+ return revokeAuthAccessToken(session);
9513
+ }
9514
+ function formatCleanupFailure(result) {
9515
+ if (result.ok) return "";
9516
+ const status = result.error.status === null ? "network error" : `HTTP ${result.error.status}`;
9517
+ return `; cleanup failed at ${result.error.endpoint} (${status}): ${result.error.message}`;
9518
+ }
9519
+ function toErrorMessage$8(error) {
9520
+ return error instanceof Error && error.message.trim() ? error.message.trim() : String(error ?? "unknown error");
9521
+ }
9522
+ function normalizeRequiredString(value, message) {
9523
+ const normalized = normalizeOptionalString$12(value);
9524
+ if (!normalized) throw new Error(message);
9525
+ return normalized;
9526
+ }
9527
+ function normalizeOptionalString$12(value) {
9528
+ const normalized = String(value ?? "").trim();
9529
+ return normalized.length > 0 ? normalized : null;
9530
+ }
9531
+ //#endregion
9532
+ //#region src/commands/computer-auth-handoff-recovery.ts
9533
+ const UNUSED_SETUP_SESSION_CLEANUP_SUFFIX = " OpenMeld also could not revoke the unused setup session.";
9534
+ async function recoverInterruptedComputerAuthHandoff(input) {
9535
+ const recovery = await getInterruptedComputerAuthSessionRecovery();
9536
+ if (!recovery) return "none";
9537
+ const previousOwnerUserId = normalizeOptionalString$11(recovery.previousSession?.user?.id);
9538
+ if (!recovery.serviceReconciled) {
9539
+ const stopped = await bestEffortStopCurrentLaneDaemonService({ runtime: input.runtime });
9540
+ if (stopped.status === "warning") {
9541
+ const error = new Error(stopped.errorMessage ?? "OpenMeld could not stop the incomplete Computer connection.");
9542
+ await recordInterruptedComputerAuthSessionRecoveryFailure({
9543
+ id: recovery.id,
9544
+ message: error.message,
9545
+ phase: "service"
9546
+ });
9547
+ logDeferredComputerAuthHandoffRecovery({
9548
+ error: error.message,
9549
+ phase: "service",
9550
+ transitionId: recovery.id
9551
+ });
9552
+ throw error;
9553
+ }
9554
+ if (previousOwnerUserId) {
9555
+ const restored = await runDaemonServiceParticipationGate({
9556
+ intent: "start",
9557
+ presenter: input.presenter,
9558
+ resolvedView: input.runtime.resolvedView,
9559
+ allowPrompt: false,
9560
+ autoRepair: true,
9561
+ expectedOwnerUserId: previousOwnerUserId,
9562
+ forcePrompt: true,
9563
+ forceRefresh: true,
9564
+ gatewayUrl: recovery.gatewayUrl,
9565
+ suppressRefreshHumanResultCard: true,
9566
+ suppressStartSpinner: true,
9567
+ view: input.view
9568
+ });
9569
+ if (restored.status !== "aligned") {
9570
+ const error = new Error(restored.errorMessage ?? "OpenMeld could not reconnect the previous Computer account.");
9571
+ await recordInterruptedComputerAuthSessionRecoveryFailure({
9572
+ id: recovery.id,
9573
+ message: error.message,
9574
+ phase: "service"
9575
+ });
9576
+ logDeferredComputerAuthHandoffRecovery({
9577
+ error: error.message,
9578
+ phase: "service",
9579
+ transitionId: recovery.id
9580
+ });
9581
+ throw error;
9582
+ }
9583
+ }
9584
+ await markInterruptedComputerAuthSessionRecovery({
9585
+ id: recovery.id,
9586
+ phase: "service"
9587
+ });
9588
+ }
9589
+ if (!recovery.remoteSessionRevoked) {
9590
+ const revoked = await revokePreparedAuthSession(recovery.candidateSession);
9591
+ if (!revoked.ok) {
9592
+ await recordInterruptedComputerAuthSessionRecoveryFailure({
9593
+ endpoint: revoked.error.endpoint,
9594
+ id: recovery.id,
9595
+ message: revoked.error.message,
9596
+ phase: "remote_session",
9597
+ status: revoked.error.status
9598
+ });
9599
+ logDeferredComputerAuthHandoffRecovery({
9600
+ endpoint: revoked.error.endpoint,
9601
+ error: revoked.error.message,
9602
+ phase: "remote_session",
9603
+ status: revoked.error.status,
9604
+ transitionId: recovery.id
9605
+ });
9606
+ emitUnusedSetupSessionCleanupWarning(input.presenter, revoked.error);
9607
+ return "deferred";
9608
+ }
9609
+ await markInterruptedComputerAuthSessionRecovery({
9610
+ id: recovery.id,
9611
+ phase: "remote_session"
9612
+ });
9613
+ }
9614
+ return await completeInterruptedComputerAuthSessionRecovery(recovery.id) ? "completed" : "deferred";
9615
+ }
9616
+ function logDeferredComputerAuthHandoffRecovery(input) {
9617
+ console.warn("[openmeld.auth.computer_handoff_recovery_deferred]", {
9618
+ ...input.endpoint ? { endpoint: input.endpoint } : {},
9619
+ error: input.error,
9620
+ phase: input.phase,
9621
+ ...input.status === void 0 ? {} : { status: input.status },
9622
+ transitionId: input.transitionId
9623
+ });
9624
+ }
9625
+ function emitUnusedSetupSessionCleanupWarning(presenter, cleanupError) {
9626
+ presenter.line({
9627
+ code: "setup.computer_authorization.cleanup_warning",
9628
+ text: "OpenMeld kept the current Computer sign-in, but could not revoke the unused setup session. You can remove it later from Account sessions.",
9629
+ data: {
9630
+ endpoint: cleanupError.endpoint ?? null,
9631
+ status: cleanupError.status ?? null,
9632
+ error: cleanupError.message
9633
+ }
9634
+ });
9635
+ }
9636
+ function formatComputerAuthCleanupFailureSuffix(result) {
9637
+ if (result.ok) return "";
9638
+ const status = result.error.status === null ? "network error" : `HTTP ${result.error.status}`;
9639
+ return `${UNUSED_SETUP_SESSION_CLEANUP_SUFFIX} Cleanup endpoint ${result.error.endpoint} returned ${status}: ${result.error.message}`;
9640
+ }
9641
+ function normalizeOptionalString$11(value) {
9642
+ if (typeof value !== "string") return null;
9643
+ const normalized = value.trim();
9644
+ return normalized.length > 0 ? normalized : null;
9645
+ }
9646
+ //#endregion
9456
9647
  //#region src/local-service/diagnostics/runtime-reporting-health-diagnostic.ts
9457
9648
  const REPORTING_SUCCESS_STALE_AFTER_MS = 30 * 6e4;
9458
9649
  const REPORTING_DEGRADED_FAILURE_THRESHOLD = 3;
@@ -9888,7 +10079,7 @@ async function runDoctorProfileCheck(input) {
9888
10079
  }
9889
10080
  openMeldProfile = {
9890
10081
  ok: false,
9891
- message: `openmeld-profile failed: ${toErrorMessage$6(error)}`
10082
+ message: `openmeld-profile failed: ${toErrorMessage$7(error)}`
9892
10083
  };
9893
10084
  }
9894
10085
  emitCheckResult(input.presenter, openMeldProfile, {
@@ -10406,7 +10597,7 @@ async function runCheck(label, fn) {
10406
10597
  } catch (err) {
10407
10598
  return {
10408
10599
  ok: false,
10409
- message: `${label} failed: ${toErrorMessage$6(err)}`
10600
+ message: `${label} failed: ${toErrorMessage$7(err)}`
10410
10601
  };
10411
10602
  }
10412
10603
  }
@@ -10540,7 +10731,7 @@ async function maybePromptRepairAfterLogin(presenter) {
10540
10731
  function normalizeDoctorHumanText(text) {
10541
10732
  return text.replace(DOCTOR_TEXT_PREFIX_RE, "");
10542
10733
  }
10543
- function toErrorMessage$6(err) {
10734
+ function toErrorMessage$7(err) {
10544
10735
  if (err instanceof Error) return err.message;
10545
10736
  return String(err);
10546
10737
  }
@@ -10612,11 +10803,11 @@ function resolveDaemonRouteSkipMessage(input) {
10612
10803
  return `Reply route checks were skipped because the OpenMeld profile check failed: ${input.openMeldProfileMessage}`;
10613
10804
  }
10614
10805
  function resolveFeedbackInboxKey(input) {
10615
- const fromCli = normalizeOptionalString$9(input.cliValue);
10806
+ const fromCli = normalizeOptionalString$10(input.cliValue);
10616
10807
  if (fromCli) return fromCli;
10617
- return normalizeOptionalString$9((input.env ?? process.env).OPENMELD_FEEDBACK_INBOX_KEY) ?? "feedback_key_8oDRg9Aq-Q4crzVGV6hUqhKT2dQpKkBn4bKg9bjXLcE";
10808
+ return normalizeOptionalString$10((input.env ?? process.env).OPENMELD_FEEDBACK_INBOX_KEY) ?? "feedback_key_8oDRg9Aq-Q4crzVGV6hUqhKT2dQpKkBn4bKg9bjXLcE";
10618
10809
  }
10619
- function normalizeOptionalString$9(value) {
10810
+ function normalizeOptionalString$10(value) {
10620
10811
  const normalized = String(value ?? "").trim();
10621
10812
  return normalized.length > 0 ? normalized : null;
10622
10813
  }
@@ -10900,7 +11091,7 @@ async function activateManagedCommandOrWarn(outcome) {
10900
11091
  if (activationNotice) process$1.stderr.write(`${activationNotice}\n`);
10901
11092
  if (activation.status === "unsupported_shell") process$1.stderr.write(`OpenMeld installed the CLI, but could not add the openmeld command to this shell automatically. Add ${dirname(outcome.currentPointerPath)} to your shell PATH.\n`);
10902
11093
  } catch (error) {
10903
- process$1.stderr.write(`OpenMeld installed the CLI, but could not update your shell PATH: ${toErrorMessage$5(error)}. The managed command is ${outcome.currentPointerPath}.\n`);
11094
+ process$1.stderr.write(`OpenMeld installed the CLI, but could not update your shell PATH: ${toErrorMessage$6(error)}. The managed command is ${outcome.currentPointerPath}.\n`);
10904
11095
  }
10905
11096
  }
10906
11097
  function formatInstallSelfHuman(outcome) {
@@ -10908,7 +11099,7 @@ function formatInstallSelfHuman(outcome) {
10908
11099
  if (outcome.result === "noop_same_version") return `OpenMeld CLI ${outcome.version} is already installed. Nothing to do.\n`;
10909
11100
  return `A newer OpenMeld CLI (${outcome.previousVersion}) is already installed; keeping it. Use --force to install ${outcome.version} anyway.\n`;
10910
11101
  }
10911
- function toErrorMessage$5(error) {
11102
+ function toErrorMessage$6(error) {
10912
11103
  return error instanceof Error ? error.message : String(error);
10913
11104
  }
10914
11105
  //#endregion
@@ -10957,7 +11148,7 @@ async function resolveAgentControllerPermissionModeInput(input) {
10957
11148
  value: input.agentControllerPermissionModeInput
10958
11149
  });
10959
11150
  if (!agentControllerPermissionMode) return { hasAnyAgentControllerPermissionModeInput: false };
10960
- const agentControllerRef = normalizeOptionalString$8(input.agentControllerRef);
11151
+ const agentControllerRef = normalizeOptionalString$9(input.agentControllerRef);
10961
11152
  assertAgentControllerPermissionModeSupported({
10962
11153
  agentControllerPermissionMode,
10963
11154
  agentControllerRef,
@@ -10978,7 +11169,7 @@ async function resolveAgentControllerPermissionModeInput(input) {
10978
11169
  };
10979
11170
  }
10980
11171
  function normalizeAgentControllerPermissionModeCliInput(input) {
10981
- const raw = normalizeOptionalString$8(input.value);
11172
+ const raw = normalizeOptionalString$9(input.value);
10982
11173
  if (!raw) return null;
10983
11174
  const options = listAgentControllerPermissionModeOptions(input.agentControllerRef ? { agentControllerRef: input.agentControllerRef } : void 0);
10984
11175
  for (const option of options) if (raw === option.value) return option.value;
@@ -11081,7 +11272,7 @@ const AGENT_CONTROLLER_PERMISSION_MODE_BY_CLI_VALUE = {
11081
11272
  "run-everything": "cursor:force",
11082
11273
  runeverything: "cursor:force"
11083
11274
  };
11084
- function normalizeOptionalString$8(value) {
11275
+ function normalizeOptionalString$9(value) {
11085
11276
  const normalized = String(value ?? "").trim();
11086
11277
  return normalized.length > 0 ? normalized : null;
11087
11278
  }
@@ -11445,7 +11636,7 @@ async function runProfileShow(input) {
11445
11636
  }
11446
11637
  const presenter = createPresenter(runtime);
11447
11638
  const allowPrompt = canUseInteractivePrompts(runtime);
11448
- const explicitProfileId = normalizeOptionalString$7(input.profile);
11639
+ const explicitProfileId = normalizeOptionalString$8(input.profile);
11449
11640
  const visibleProfiles = explicitProfileId ? [] : await listVisibleProfilesForListByView(runtime.resolvedView);
11450
11641
  const current = explicitProfileId ? null : await resolveCurrentProfileId({
11451
11642
  profiles: visibleProfiles,
@@ -11927,7 +12118,7 @@ async function runProfileUpdate(input) {
11927
12118
  }
11928
12119
  const presenter = createPresenter(runtime);
11929
12120
  const allowPrompt = canUseInteractivePrompts(runtime);
11930
- const explicitProfileId = normalizeOptionalString$7(input.profile);
12121
+ const explicitProfileId = normalizeOptionalString$8(input.profile);
11931
12122
  const visibleProfiles = explicitProfileId ? [] : await listVisibleProfilesForListByView(runtime.resolvedView);
11932
12123
  const current = explicitProfileId ? null : await resolveCurrentProfileId({
11933
12124
  profiles: visibleProfiles,
@@ -12155,7 +12346,7 @@ function emitProfileUpdateCandidatesForHuman(input) {
12155
12346
  }
12156
12347
  }
12157
12348
  async function resolveProfileUpdatePayload(input) {
12158
- const profileName = normalizeOptionalString$7(input.profileName);
12349
+ const profileName = normalizeOptionalString$8(input.profileName);
12159
12350
  const explicitAgentController = await resolveExplicitAgentControllerPatchForProfile({
12160
12351
  agentController: input.agentController,
12161
12352
  agentControllerConversationId: input.agentControllerConversationId,
@@ -12200,7 +12391,7 @@ async function resolveProfileUpdatePayload(input) {
12200
12391
  }
12201
12392
  function resolveExplicitWorkspacePatchForProfile(input) {
12202
12393
  const normalizedMode = normalizeWorkspaceModeInput(input.workspaceMode);
12203
- const normalizedWorkspacePath = normalizeOptionalString$7(input.workspacePath);
12394
+ const normalizedWorkspacePath = normalizeOptionalString$8(input.workspacePath);
12204
12395
  if (!(normalizedMode || normalizedWorkspacePath)) return null;
12205
12396
  if (input.profile.profileKind !== "agent") throw new Error("Workspace can only be configured for agent profiles.");
12206
12397
  if (!normalizedMode) throw new Error("--workspace-path can only be used with --workspace-mode custom.");
@@ -12233,7 +12424,7 @@ function resolveExplicitModelSelectionPatchForProfile(input) {
12233
12424
  };
12234
12425
  }
12235
12426
  async function resolveExplicitAgentControllerPermissionModePatchForProfile(input) {
12236
- if (!normalizeOptionalString$7(input.agentControllerPermissionModeInput)) return null;
12427
+ if (!normalizeOptionalString$8(input.agentControllerPermissionModeInput)) return null;
12237
12428
  if (input.profile.profileKind !== "agent") throw new Error("Agent Controller Permission Mode can only be configured for agent profiles.");
12238
12429
  const currentBinding = input.agentControllerRef ? null : await resolveAgentProfilePrimaryAgentControllerReport({ profile: input.profile });
12239
12430
  const agentControllerRef = input.agentControllerRef ?? currentBinding?.agentControllerRef ?? null;
@@ -12252,8 +12443,8 @@ async function resolveExplicitAgentControllerPermissionModePatchForProfile(input
12252
12443
  };
12253
12444
  }
12254
12445
  async function resolveExplicitAgentControllerPatchForProfile(input) {
12255
- const agentController = normalizeOptionalString$7(input.agentController);
12256
- const agentControllerConversationId = normalizeOptionalString$7(input.agentControllerConversationId);
12446
+ const agentController = normalizeOptionalString$8(input.agentController);
12447
+ const agentControllerConversationId = normalizeOptionalString$8(input.agentControllerConversationId);
12257
12448
  if (!(agentController || agentControllerConversationId)) return null;
12258
12449
  if (input.profile.profileKind !== "agent") throw new Error("Agent controller can only be configured for agent profiles.");
12259
12450
  if (!agentController) throw new Error("--agent-controller-conversation-id requires --agent-controller.");
@@ -12267,7 +12458,7 @@ async function resolveExplicitAgentControllerPatchForProfile(input) {
12267
12458
  };
12268
12459
  }
12269
12460
  async function applyAgentProfileControllerBinding(input) {
12270
- const agentControllerRef = normalizeOptionalString$7(input.agentControllerRef);
12461
+ const agentControllerRef = normalizeOptionalString$8(input.agentControllerRef);
12271
12462
  const hasModelSelectionPatch = input.modelId !== void 0;
12272
12463
  if (!(agentControllerRef || hasModelSelectionPatch)) return;
12273
12464
  if (input.profile.profileKind !== "agent") throw new Error("Agent controller can only be configured for agent profiles.");
@@ -12405,7 +12596,7 @@ async function promptWorkspacePayload(profile) {
12405
12596
  });
12406
12597
  if (workspacePath.status === "cancelled") return { status: "cancelled" };
12407
12598
  if (workspacePath.status === "back") continue;
12408
- const customWorkspacePath = normalizeOptionalString$7(workspacePath.value);
12599
+ const customWorkspacePath = normalizeOptionalString$8(workspacePath.value);
12409
12600
  if (!customWorkspacePath) throw new Error("Custom workspace path is required.");
12410
12601
  return {
12411
12602
  status: "submitted",
@@ -12510,7 +12701,7 @@ async function promptModelSelectionPayload(profile) {
12510
12701
  });
12511
12702
  if (isCancel(selectedReasoningLevel)) return { status: "cancelled" };
12512
12703
  if (selectedReasoningLevel === BACK_UPDATE_FIELD_SELECTION) return { status: "back" };
12513
- const reasoningLevel = normalizeOptionalString$7(selectedReasoningLevel);
12704
+ const reasoningLevel = normalizeOptionalString$8(selectedReasoningLevel);
12514
12705
  return {
12515
12706
  status: "submitted",
12516
12707
  value: {
@@ -12578,7 +12769,7 @@ async function promptProfileNamePayload(currentProfileName) {
12578
12769
  });
12579
12770
  if (nextName.status === "cancelled") return { status: "cancelled" };
12580
12771
  if (nextName.status === "back") return { status: "back" };
12581
- const profileName = normalizeOptionalString$7(nextName.value);
12772
+ const profileName = normalizeOptionalString$8(nextName.value);
12582
12773
  if (!profileName) throw new Error("profileName is required");
12583
12774
  return {
12584
12775
  status: "submitted",
@@ -12834,11 +13025,11 @@ function buildProfileSearchItem(input) {
12834
13025
  function buildProfileSearchText(profile) {
12835
13026
  return [
12836
13027
  profile.openMeldProfileId,
12837
- normalizeOptionalString$7(profile.profileName),
13028
+ normalizeOptionalString$8(profile.profileName),
12838
13029
  profile.profileKind,
12839
- normalizeOptionalString$7(profile.ownerUserId),
12840
- normalizeOptionalString$7(profile.ownerName),
12841
- normalizeOptionalString$7(profile.source)
13030
+ normalizeOptionalString$8(profile.ownerUserId),
13031
+ normalizeOptionalString$8(profile.ownerName),
13032
+ normalizeOptionalString$8(profile.source)
12842
13033
  ].filter((value) => typeof value === "string").join("\n");
12843
13034
  }
12844
13035
  function resolveProfileSelectLabel(input) {
@@ -12889,7 +13080,7 @@ function normalizeProfileDisplayName(profile) {
12889
13080
  }
12890
13081
  function normalizeAgentControllerArgumentInput(input) {
12891
13082
  const agentController = String(input.agentController ?? "").trim();
12892
- const agentControllerConversationId = normalizeOptionalString$7(input.agentControllerConversationId);
13083
+ const agentControllerConversationId = normalizeOptionalString$8(input.agentControllerConversationId);
12893
13084
  const hasControllerEnabled = typeof input.controllerEnabled === "boolean";
12894
13085
  const hasAnyAgentControllerInput = Boolean(agentController) || Boolean(agentControllerConversationId) || hasControllerEnabled;
12895
13086
  return {
@@ -13097,7 +13288,7 @@ function resolveProfileUpdateCommandExamples() {
13097
13288
  function toProfileActionGuideExamples(_input) {
13098
13289
  return {};
13099
13290
  }
13100
- function normalizeOptionalString$7(value) {
13291
+ function normalizeOptionalString$8(value) {
13101
13292
  const normalized = String(value ?? "").trim();
13102
13293
  return normalized.length > 0 ? normalized : null;
13103
13294
  }
@@ -13108,8 +13299,8 @@ function normalizeWorkspaceModeInput(value) {
13108
13299
  throw new Error("--workspace-mode must be openmeld-managed|custom");
13109
13300
  }
13110
13301
  function normalizeModelSelectionInput(input) {
13111
- const modelId = normalizeOptionalString$7(input.model);
13112
- const reasoningLevel = normalizeOptionalString$7(input.reasoningEffort);
13302
+ const modelId = normalizeOptionalString$8(input.model);
13303
+ const reasoningLevel = normalizeOptionalString$8(input.reasoningEffort);
13113
13304
  if (!(modelId || reasoningLevel)) return { hasAnyModelSelectionInput: false };
13114
13305
  if (!modelId) throw new Error("--reasoning-effort requires --model.");
13115
13306
  return {
@@ -13664,7 +13855,7 @@ async function resolvePrepareReadinessApiEvidence(input) {
13664
13855
  } catch (error) {
13665
13856
  console.warn("[openmeld.prepare_readiness.api_read_failed]", {
13666
13857
  event: "cli.prepare_readiness.api_read_failed",
13667
- error: toErrorMessage$4(error),
13858
+ error: toErrorMessage$5(error),
13668
13859
  profileId: input.profile.openMeldProfileId
13669
13860
  });
13670
13861
  return unavailableEvidence({
@@ -13705,7 +13896,7 @@ function unavailableEvidence(input) {
13705
13896
  status: "unavailable"
13706
13897
  };
13707
13898
  }
13708
- function toErrorMessage$4(error) {
13899
+ function toErrorMessage$5(error) {
13709
13900
  if (error instanceof Error) {
13710
13901
  const message = error.message.trim();
13711
13902
  return message.length > 0 ? message : "unknown error";
@@ -14118,10 +14309,10 @@ function resolveDaemonDispatchJournalEvidence(dispatchId) {
14118
14309
  };
14119
14310
  }
14120
14311
  async function resolveDispatchTraceSelection(input) {
14121
- const dispatchSelector = normalizeOptionalString$6(input.dispatchId);
14122
- const sourceSignalSelector = normalizeOptionalString$6(input.sourceSignalId);
14123
- const clientMessageSelector = normalizeOptionalString$6(input.clientMessageId);
14124
- const targetProfileSelector = normalizeOptionalString$6(input.targetProfileId);
14312
+ const dispatchSelector = normalizeOptionalString$7(input.dispatchId);
14313
+ const sourceSignalSelector = normalizeOptionalString$7(input.sourceSignalId);
14314
+ const clientMessageSelector = normalizeOptionalString$7(input.clientMessageId);
14315
+ const targetProfileSelector = normalizeOptionalString$7(input.targetProfileId);
14125
14316
  if (Number(dispatchSelector !== null) + Number(sourceSignalSelector !== null) + Number(clientMessageSelector !== null) !== 1) throw new Error("exactly one of dispatchId, sourceSignalId, or clientMessageId is required");
14126
14317
  if (dispatchSelector) return {
14127
14318
  dispatchId: dispatchSelector,
@@ -14628,7 +14819,7 @@ function parenthesizedDetail(value, label) {
14628
14819
  return detail.length > 0 ? detail : null;
14629
14820
  }
14630
14821
  async function resolveServiceTraceActorProfile(input) {
14631
- if (normalizeOptionalString$6(input.explicitProfileId) || !canUseInteractivePrompts(input.runtime)) return input.actingProfile;
14822
+ if (normalizeOptionalString$7(input.explicitProfileId) || !canUseInteractivePrompts(input.runtime)) return input.actingProfile;
14632
14823
  while (true) {
14633
14824
  const selectedAction = await select({
14634
14825
  message: `Use ${input.actingProfile.profileName} (${input.actingProfile.openMeldProfileId}) to read this dispatch trace?`,
@@ -15509,7 +15700,7 @@ function truncateText(text, maxLength) {
15509
15700
  if (text.length <= maxLength) return text;
15510
15701
  return `${text.slice(0, maxLength)}...`;
15511
15702
  }
15512
- function normalizeOptionalString$6(value) {
15703
+ function normalizeOptionalString$7(value) {
15513
15704
  const normalized = String(value ?? "").trim();
15514
15705
  return normalized.length > 0 ? normalized : null;
15515
15706
  }
@@ -16199,7 +16390,7 @@ async function runSetupFirstBootstrap(input) {
16199
16390
  const stepError = error instanceof SetupBootstrapStepError ? error : null;
16200
16391
  const cause = stepError?.causeValue ?? error;
16201
16392
  const failedStep = stepError?.step ?? "unknown";
16202
- const message = toErrorMessage$3(cause);
16393
+ const message = toErrorMessage$4(cause);
16203
16394
  console.warn("[openmeld.setup.bootstrap.failed]", {
16204
16395
  event: "cli.setup.bootstrap.failed",
16205
16396
  error: message,
@@ -16263,13 +16454,13 @@ var SetupBootstrapStepError = class extends Error {
16263
16454
  causeValue;
16264
16455
  step;
16265
16456
  constructor(step, causeValue) {
16266
- super(`${step}: ${toErrorMessage$3(causeValue)}`);
16457
+ super(`${step}: ${toErrorMessage$4(causeValue)}`);
16267
16458
  this.name = "SetupBootstrapStepError";
16268
16459
  this.step = step;
16269
16460
  this.causeValue = causeValue;
16270
16461
  }
16271
16462
  };
16272
- function toErrorMessage$3(error) {
16463
+ function toErrorMessage$4(error) {
16273
16464
  if (error instanceof Error && error.message.trim().length > 0) return error.message;
16274
16465
  if (typeof error === "string" && error.trim().length > 0) return error;
16275
16466
  return "Unknown setup bootstrap error.";
@@ -16337,7 +16528,7 @@ async function acquireSetupCommandLockWithTakeover(input) {
16337
16528
  pid,
16338
16529
  startedAtLabel
16339
16530
  };
16340
- if (!(normalizeOptionalString$5(input.startSession) !== null && pid !== null && pid !== deps.selfPid && deps.probePid(pid) === "alive")) return {
16531
+ if (!(normalizeOptionalString$6(input.startSession) !== null && pid !== null && pid !== deps.selfPid && deps.probePid(pid) === "alive")) return {
16341
16532
  status: "contended",
16342
16533
  ...contendedBase,
16343
16534
  takeoverAttempted: false
@@ -16574,7 +16765,7 @@ function getErrorCode(error) {
16574
16765
  const code = error.code;
16575
16766
  return typeof code === "string" ? code : void 0;
16576
16767
  }
16577
- function normalizeOptionalString$5(value) {
16768
+ function normalizeOptionalString$6(value) {
16578
16769
  const normalized = String(value ?? "").trim();
16579
16770
  return normalized.length > 0 ? normalized : null;
16580
16771
  }
@@ -16862,7 +17053,7 @@ var PrepareSessionCancelledError = class extends Error {
16862
17053
  }
16863
17054
  };
16864
17055
  async function runPrepareSessionExecutor(input) {
16865
- let initial = await resolvePrepareSessionToken({
17056
+ let initial = input.initialSnapshot ?? await resolvePrepareSessionForHandoff({
16866
17057
  gatewayUrl: input.gatewayUrl,
16867
17058
  opaqueToken: input.startSession
16868
17059
  });
@@ -16921,7 +17112,7 @@ async function reconnectPrepareSession(input) {
16921
17112
  if (Date.now() >= deadlineMs) break;
16922
17113
  let snapshot;
16923
17114
  try {
16924
- snapshot = await resolvePrepareSessionToken({
17115
+ snapshot = await resolvePrepareSessionForHandoff({
16925
17116
  gatewayUrl: input.input.gatewayUrl,
16926
17117
  opaqueToken: input.input.startSession
16927
17118
  });
@@ -17818,7 +18009,7 @@ function buildPrepareSessionExecutorCompletionFacts(input) {
17818
18009
  };
17819
18010
  }
17820
18011
  function isTransientSelectedAgentConnectionError(error) {
17821
- const rawMessage = toErrorMessage$2(error).toLowerCase();
18012
+ const rawMessage = toErrorMessage$3(error).toLowerCase();
17822
18013
  return rawMessage.includes("service has not finished starting") || rawMessage.includes("openmeld service is not running") || rawMessage.includes("service.not_running") || rawMessage.includes("service_contract_unavailable") || rawMessage.includes("runtime.reporting.write_failed");
17823
18014
  }
17824
18015
  async function finishPrepareSetup() {
@@ -18079,7 +18270,7 @@ async function connectPrepareSessionStream(input) {
18079
18270
  }
18080
18271
  };
18081
18272
  }
18082
- async function resolvePrepareSessionToken(input) {
18273
+ async function resolvePrepareSessionForHandoff(input) {
18083
18274
  const response = await fetchSpaceRequestWithTimeout({
18084
18275
  url: new URL("/v1/prepare/sessions/resolve-token", input.gatewayUrl).toString(),
18085
18276
  operation: "prepare.session.resolve_token",
@@ -18186,7 +18377,7 @@ function toStatusCodeSlug(title) {
18186
18377
  const slug = title.toLowerCase().replaceAll(/[^a-z0-9]+/g, "_").replaceAll(/^_+|_+$/g, "");
18187
18378
  return slug.length > 0 ? slug : "status";
18188
18379
  }
18189
- function toErrorMessage$2(error) {
18380
+ function toErrorMessage$3(error) {
18190
18381
  if (error instanceof Error) {
18191
18382
  const message = error.message.trim();
18192
18383
  return message.length > 0 ? message : "unknown error";
@@ -18225,6 +18416,193 @@ function errorFromPrepareSessionServerError(input) {
18225
18416
  return new Error(input.message);
18226
18417
  }
18227
18418
  //#endregion
18419
+ //#region src/commands/computer-auth-handoff.ts
18420
+ function runComputerAuthorizationHandoff(input) {
18421
+ return runPreparedComputerAuthHandoff({
18422
+ ...input,
18423
+ exchangeCandidate: async () => await exchangeComputerAuthorizationGrant({ deviceCode: input.deviceCode })
18424
+ });
18425
+ }
18426
+ function runOneTimeTokenComputerHandoff(input) {
18427
+ return runPreparedComputerAuthHandoff({
18428
+ ...input,
18429
+ exchangeCandidate: async () => await exchangeOneTimeTokenAuthSession({
18430
+ authBaseUrl: resolveAuthBaseUrl(),
18431
+ clientId: "openmeld-cli",
18432
+ token: input.oneTimeToken
18433
+ })
18434
+ });
18435
+ }
18436
+ async function runPreparedComputerAuthHandoff(input) {
18437
+ if (await recoverInterruptedComputerAuthHandoff({
18438
+ presenter: input.presenter,
18439
+ runtime: input.runtime,
18440
+ view: input.view
18441
+ }) === "deferred") throw new AuthSessionRecoveryInProgressError();
18442
+ const gatewayUrl = await resolveBaseUrl();
18443
+ const initialSnapshot = await resolvePrepareSessionForHandoff({
18444
+ gatewayUrl,
18445
+ opaqueToken: input.startSession
18446
+ });
18447
+ const candidate = await input.exchangeCandidate();
18448
+ await assertPrepareSessionOwner({
18449
+ candidate,
18450
+ ownerUserId: initialSnapshot.ownerUserId
18451
+ });
18452
+ if (!await confirmComputerAccountSwitch({
18453
+ candidate,
18454
+ currentSession: await resolveCurrentComputerSession(candidate),
18455
+ interactive: input.interactive,
18456
+ presenter: input.presenter,
18457
+ resolvedView: input.runtime.resolvedView
18458
+ })) {
18459
+ const revoked = await revokePreparedAuthSession(candidate);
18460
+ if (!revoked.ok) emitUnusedSetupSessionCleanupWarning(input.presenter, revoked.error);
18461
+ return {
18462
+ reason: "user_cancelled",
18463
+ status: "not_completed"
18464
+ };
18465
+ }
18466
+ const transition = await beginComputerSessionTransition({
18467
+ candidate,
18468
+ gatewayUrl
18469
+ });
18470
+ try {
18471
+ const sessionResult = await runPrepareSessionExecutor({
18472
+ gatewayUrl,
18473
+ initialSnapshot,
18474
+ startSession: input.startSession,
18475
+ runtime: input.runtime,
18476
+ presenter: input.presenter,
18477
+ interactive: input.interactive,
18478
+ localAgentSelection: input.localAgentSelection,
18479
+ view: input.view
18480
+ });
18481
+ if (sessionResult.status !== "completed") {
18482
+ await restorePreviousComputerAfterFailedHandoff({
18483
+ candidate,
18484
+ gatewayUrl,
18485
+ presenter: input.presenter,
18486
+ runtime: input.runtime,
18487
+ transition,
18488
+ view: input.view
18489
+ });
18490
+ return sessionResult;
18491
+ }
18492
+ await transition.commit();
18493
+ return sessionResult;
18494
+ } catch (error) {
18495
+ try {
18496
+ await restorePreviousComputerAfterFailedHandoff({
18497
+ candidate,
18498
+ gatewayUrl,
18499
+ presenter: input.presenter,
18500
+ runtime: input.runtime,
18501
+ transition,
18502
+ view: input.view
18503
+ });
18504
+ } catch (recoveryError) {
18505
+ throw new Error(`Computer setup failed, and OpenMeld could not restore the previous local account: ${toErrorMessage$2(recoveryError)}`, { cause: error });
18506
+ }
18507
+ throw error;
18508
+ }
18509
+ }
18510
+ async function assertPrepareSessionOwner(input) {
18511
+ if (input.candidate.user.id === input.ownerUserId) return;
18512
+ const revoked = await revokePreparedAuthSession(input.candidate);
18513
+ throw new Error(`This setup command and its computer authorization belong to different OpenMeld accounts. Copy a fresh setup command from OpenMeld Web and try again.${formatComputerAuthCleanupFailureSuffix(revoked)}`);
18514
+ }
18515
+ async function resolveCurrentComputerSession(candidate) {
18516
+ let currentState;
18517
+ try {
18518
+ currentState = await getAuthSessionState({ validateRemote: false });
18519
+ } catch (error) {
18520
+ const revoked = await revokePreparedAuthSession(candidate);
18521
+ throw new Error(`OpenMeld could not inspect the current Computer sign-in. The current Computer connection was not changed. ${toErrorMessage$2(error)}${formatComputerAuthCleanupFailureSuffix(revoked)}`, { cause: error });
18522
+ }
18523
+ if (currentState.state === "missing" || currentState.session) return currentState.session;
18524
+ const revoked = await revokePreparedAuthSession(candidate);
18525
+ const detail = normalizeOptionalString$5(currentState.errorMessage) ?? normalizeOptionalString$5(currentState.reasonCode);
18526
+ throw new Error(`OpenMeld could not inspect the current Computer sign-in. The current Computer connection was not changed.${detail ? ` ${detail}` : ""}${formatComputerAuthCleanupFailureSuffix(revoked)}`);
18527
+ }
18528
+ async function beginComputerSessionTransition(input) {
18529
+ try {
18530
+ return await beginAuthSessionTransition(input.candidate, { computerHandoff: { gatewayUrl: input.gatewayUrl } });
18531
+ } catch (error) {
18532
+ const revoked = await revokePreparedAuthSession(input.candidate);
18533
+ if (!revoked.ok) throw new Error(`OpenMeld could not save the new Computer sign-in.${formatComputerAuthCleanupFailureSuffix(revoked)} ${toErrorMessage$2(error)}`, { cause: error });
18534
+ throw error;
18535
+ }
18536
+ }
18537
+ async function confirmComputerAccountSwitch(input) {
18538
+ const currentUserId = normalizeOptionalString$5(input.currentSession?.user?.id);
18539
+ if (!input.currentSession) return true;
18540
+ if (!currentUserId) {
18541
+ const revoked = await revokePreparedAuthSession(input.candidate);
18542
+ throw new Error(`OpenMeld could not verify the account currently connected to this Computer. The current Computer connection was not changed.${formatComputerAuthCleanupFailureSuffix(revoked)}`);
18543
+ }
18544
+ if (currentUserId === input.candidate.user.id) return true;
18545
+ const currentAccount = normalizeOptionalString$5(input.currentSession?.user?.email) ?? "the current account";
18546
+ const nextAccount = normalizeOptionalString$5(input.candidate.user.email) ?? "another account";
18547
+ if (!input.interactive || input.resolvedView !== "human") {
18548
+ const revoked = await revokePreparedAuthSession(input.candidate);
18549
+ throw new Error(`This computer is signed in as ${currentAccount}, but the setup command uses ${nextAccount}. Run the setup command in an interactive Terminal to review and confirm the account switch. The current Computer connection was not changed.${formatComputerAuthCleanupFailureSuffix(revoked)}`);
18550
+ }
18551
+ const confirmed = await confirm({
18552
+ initialValue: false,
18553
+ message: `Switch this computer from ${currentAccount} to ${nextAccount}?`
18554
+ });
18555
+ if (isCancel(confirmed) || !confirmed) {
18556
+ input.presenter.line({
18557
+ code: "setup.account_switch.cancelled",
18558
+ text: "Account switch canceled. The current Computer connection was not changed."
18559
+ });
18560
+ return false;
18561
+ }
18562
+ return true;
18563
+ }
18564
+ async function restorePreviousComputerAfterFailedHandoff(input) {
18565
+ await input.transition.rollback();
18566
+ if (await recoverInterruptedComputerAuthHandoff({
18567
+ presenter: input.presenter,
18568
+ runtime: input.runtime,
18569
+ view: input.view
18570
+ }) === "none") await restoreLegacyComputerAuthTransition(input);
18571
+ }
18572
+ async function restoreLegacyComputerAuthTransition(input) {
18573
+ const revoked = await revokePreparedAuthSession(input.candidate);
18574
+ if (!revoked.ok) emitUnusedSetupSessionCleanupWarning(input.presenter, revoked.error);
18575
+ const previousOwnerUserId = normalizeOptionalString$5(input.transition.previousSession?.user?.id);
18576
+ if (!previousOwnerUserId) {
18577
+ const stopped = await bestEffortStopCurrentLaneDaemonService({ runtime: input.runtime });
18578
+ if (stopped.status === "warning") throw new Error(stopped.errorMessage ?? "OpenMeld could not stop the incomplete Computer connection.");
18579
+ return;
18580
+ }
18581
+ const restored = await runDaemonServiceParticipationGate({
18582
+ intent: "start",
18583
+ presenter: input.presenter,
18584
+ resolvedView: input.runtime.resolvedView,
18585
+ allowPrompt: false,
18586
+ autoRepair: true,
18587
+ expectedOwnerUserId: previousOwnerUserId,
18588
+ forcePrompt: true,
18589
+ forceRefresh: true,
18590
+ gatewayUrl: input.gatewayUrl,
18591
+ suppressRefreshHumanResultCard: true,
18592
+ suppressStartSpinner: true,
18593
+ view: input.view
18594
+ });
18595
+ if (restored.status !== "aligned") throw new Error(restored.errorMessage ?? "OpenMeld could not reconnect the previous Computer account.");
18596
+ }
18597
+ function normalizeOptionalString$5(value) {
18598
+ if (typeof value !== "string") return null;
18599
+ const normalized = value.trim();
18600
+ return normalized.length > 0 ? normalized : null;
18601
+ }
18602
+ function toErrorMessage$2(error) {
18603
+ return error instanceof Error && error.message.trim() ? error.message.trim() : String(error ?? "unknown error");
18604
+ }
18605
+ //#endregion
18228
18606
  //#region src/commands/setup-local-agent-connection.ts
18229
18607
  const LOCAL_AGENT_CONNECTION_CARD_TITLE = "Local Agent Connection";
18230
18608
  const RETIRED_HUMAN_PROFILE_SETUP_MESSAGE = "This OpenMeld Web setup command is retired. Run `openmeld setup` to set up this computer, or open the org-scoped Connect page in OpenMeld Web and copy a fresh setup command.";
@@ -18242,6 +18620,26 @@ async function runSetupLocalAgentConnection(input) {
18242
18620
  view: runtime.resolvedView
18243
18621
  });
18244
18622
  if (input.humanProfile) throw new Error(RETIRED_HUMAN_PROFILE_SETUP_MESSAGE);
18623
+ const deviceCode = normalizeOptionalString$4(input.deviceCode);
18624
+ if (input.startSession && deviceCode) return buildPrepareSessionSetupResult(await runComputerAuthorizationHandoff({
18625
+ deviceCode,
18626
+ interactive,
18627
+ localAgentSelection: resolvePrepareSessionLocalAgentSelection(input),
18628
+ presenter,
18629
+ runtime,
18630
+ startSession: input.startSession,
18631
+ view: input.view
18632
+ }));
18633
+ const oneTimeToken = normalizeOptionalString$4(input.ott);
18634
+ if (input.startSession && oneTimeToken) return buildPrepareSessionSetupResult(await runOneTimeTokenComputerHandoff({
18635
+ oneTimeToken,
18636
+ interactive,
18637
+ localAgentSelection: resolvePrepareSessionLocalAgentSelection(input),
18638
+ presenter,
18639
+ runtime,
18640
+ startSession: input.startSession,
18641
+ view: input.view
18642
+ }));
18245
18643
  await maybeLogInWithOneTimeToken$1({
18246
18644
  ott: input.ott,
18247
18645
  view: input.view
@@ -18258,19 +18656,15 @@ async function runSetupLocalAgentConnection(input) {
18258
18656
  status: "not_completed"
18259
18657
  };
18260
18658
  }
18261
- if (input.startSession) {
18262
- const sessionResult = await runPrepareSessionExecutor({
18263
- gatewayUrl: await resolveBaseUrl(),
18264
- startSession: input.startSession,
18265
- runtime,
18266
- presenter,
18267
- interactive,
18268
- localAgentSelection: resolvePrepareSessionLocalAgentSelection(input),
18269
- view: input.view
18270
- });
18271
- if (sessionResult.status !== "completed") return resolveIncompletePrepareSessionSetupResult(sessionResult);
18272
- return buildCompletedSetupSessionResult(sessionResult);
18273
- }
18659
+ if (input.startSession) return buildPrepareSessionSetupResult(await runPrepareSessionExecutor({
18660
+ gatewayUrl: await resolveBaseUrl(),
18661
+ startSession: input.startSession,
18662
+ runtime,
18663
+ presenter,
18664
+ interactive,
18665
+ localAgentSelection: resolvePrepareSessionLocalAgentSelection(input),
18666
+ view: input.view
18667
+ }));
18274
18668
  if (input.agent && input.agent.length > 0) {
18275
18669
  await runAgentsRepair({
18276
18670
  agent: input.agent,
@@ -18358,6 +18752,9 @@ function resolveIncompletePrepareSessionSetupResult(sessionResult) {
18358
18752
  status: "not_completed"
18359
18753
  };
18360
18754
  }
18755
+ function buildPrepareSessionSetupResult(sessionResult) {
18756
+ return sessionResult.status === "completed" ? buildCompletedSetupSessionResult(sessionResult) : resolveIncompletePrepareSessionSetupResult(sessionResult);
18757
+ }
18361
18758
  function buildCompletedSetupSessionResult(sessionResult) {
18362
18759
  return {
18363
18760
  ...sessionResult.completionFacts ? { completionFacts: sessionResult.completionFacts } : {},
@@ -18386,6 +18783,8 @@ function emitSetupLocalAgentConnectionHeader(input) {
18386
18783
  }
18387
18784
  function assertValidSetupLocalAgentConnectionInput(input) {
18388
18785
  const facts = resolveSetupLocalAgentConnectionInputFacts(input);
18786
+ if (normalizeOptionalString$4(input.deviceCode) && !facts.hasStartSession) throw new Error("--device-code requires --start-session.");
18787
+ if (normalizeOptionalString$4(input.deviceCode) && normalizeOptionalString$4(input.ott)) throw new Error("use either --device-code or --ott, not both");
18389
18788
  if (facts.hasStartSession && (facts.hasProfile || facts.hasHumanProfile || facts.hasLocalAgentPreparation)) throw new Error("--start-session cannot be combined with --profile, --human-profile, or --agent.");
18390
18789
  if (!facts.hasStartSession && facts.hasPrepareSessionLocalAgentMode) throw new Error("--local-agents requires --start-session.");
18391
18790
  assertValidLocalAgentSelectionInput({
@@ -27435,7 +27834,7 @@ function normalizeOptionalString(value) {
27435
27834
  return normalized.length > 0 ? normalized : null;
27436
27835
  }
27437
27836
  async function runDefaultSpaceAddMeMembership(input) {
27438
- const { runSpaceAddMeMembership } = await import("./add-me-membership-BCGn5T-D.js");
27837
+ const { runSpaceAddMeMembership } = await import("./add-me-membership-CoSmA50L.js");
27439
27838
  return await runSpaceAddMeMembership(input);
27440
27839
  }
27441
27840
  //#endregion
@@ -31108,7 +31507,7 @@ withStartOptions(program.command("start").description("Initial onboarding: set u
31108
31507
  }
31109
31508
  });
31110
31509
  });
31111
- program.command("setup").description("Set up this computer for OpenMeld Space Wake.").option("--profile <id>", "Existing OpenMeld agent profile ID to connect to this computer").option("--agent <id...>", "Builtin local agent ID to repair directly when you already know the target").option("--human-profile <id>", "Retired OpenMeld Web setup flag; copy a fresh setup command from OpenMeld Web instead").option("--ott <token>", "One-time token to sign in on this device before setup").option("--start-session <opaque-token>", "Continue an OpenMeld Web Prepare setup command on this device").option("--local-agents <mode>", "Select local agents during setup: all or none").option("--local-agent <id...>", "Select specific local agent IDs during setup").option("--reset-this-computer", "Stop stale local OpenMeld Service state before reconnecting this computer").addHelpText("after", buildCommandHelpExamples("Primary entry points", [
31510
+ program.command("setup").description("Set up this computer for OpenMeld Space Wake.").option("--profile <id>", "Existing OpenMeld agent profile ID to connect to this computer").option("--agent <id...>", "Builtin local agent ID to repair directly when you already know the target").option("--human-profile <id>", "Retired OpenMeld Web setup flag; copy a fresh setup command from OpenMeld Web instead").option("--ott <token>", "One-time token to sign in on this device before setup").option("--device-code <code>", "Browser-approved code used to create this computer's independent sign-in session").option("--start-session <opaque-token>", "Continue an OpenMeld Web Prepare setup command on this device").option("--local-agents <mode>", "Select local agents during setup: all or none").option("--local-agent <id...>", "Select specific local agent IDs during setup").option("--reset-this-computer", "Stop stale local OpenMeld Service state before reconnecting this computer").addHelpText("after", buildCommandHelpExamples("Primary entry points", [
31112
31511
  "openmeld setup",
31113
31512
  "openmeld setup --start-session <opaque-token> --local-agents all",
31114
31513
  "openmeld setup --profile <agent-profile-id> --local-agent <local-agent-id>"
@@ -31121,6 +31520,7 @@ program.command("setup").description("Set up this computer for OpenMeld Space Wa
31121
31520
  run: async () => {
31122
31521
  await runSetup({
31123
31522
  agent: opts.agent,
31523
+ deviceCode: opts.deviceCode,
31124
31524
  humanProfile: opts.humanProfile,
31125
31525
  localAgent: opts.localAgent,
31126
31526
  localAgents: opts.localAgents,
@@ -32313,10 +32713,10 @@ serviceCmd.command("trace").description("Read a Space delivery trace for debuggi
32313
32713
  profile: opts.profile,
32314
32714
  gatewayUrl: opts.gatewayUrl,
32315
32715
  run: async () => {
32316
- const dispatchId = normalizeOptionalString$12(opts.dispatch);
32317
- const sourceSignalId = normalizeOptionalString$12(opts.sourceSignal);
32318
- const clientMessageId = normalizeOptionalString$12(opts.clientMessage);
32319
- const targetProfileId = normalizeOptionalString$12(opts.targetProfile);
32716
+ const dispatchId = normalizeOptionalString$15(opts.dispatch);
32717
+ const sourceSignalId = normalizeOptionalString$15(opts.sourceSignal);
32718
+ const clientMessageId = normalizeOptionalString$15(opts.clientMessage);
32719
+ const targetProfileId = normalizeOptionalString$15(opts.targetProfile);
32320
32720
  if (Number(dispatchId !== null) + Number(sourceSignalId !== null) + Number(clientMessageId !== null) !== 1) throw new Error("exactly one of --dispatch, --source-signal, or --client-message is required");
32321
32721
  await runServiceTrace({
32322
32722
  profile: opts.profile,
@@ -32507,7 +32907,7 @@ spaceActionCmd.command("help").description("Show OpenMeld Space Action help.").a
32507
32907
  withSpaceProfileOption(spaceCmd.command("create").description("Create a new space and print its space ID.").option("--name <name>", "Space name (<=80 chars; prompted in human interactive mode)").option("--visibility <public|private>", "Organization visibility for this space").option("--guide <text>", "Optional space guide").option("--password <value>", "Optional space password (minimum 6 characters; numbers/letters/symbols accepted)").option("--join", "Join immediately after create").option("--no-join", "Do not ask to join after create").option("--output <mode>", "Output mode when auto-joining: ndjson|text", "text")).action(async (opts, command) => {
32508
32908
  const cliOptions = resolveSpaceCommandCliOptions(command, opts);
32509
32909
  const view = getGlobalViewOption();
32510
- if (view === "agent" && (normalizeOptionalString$12(opts.name) === null || normalizeOptionalString$12(opts.visibility) === null)) {
32910
+ if (view === "agent" && (normalizeOptionalString$15(opts.name) === null || normalizeOptionalString$15(opts.visibility) === null)) {
32511
32911
  await runSpaceCreate({
32512
32912
  profile: cliOptions.profile,
32513
32913
  baseUrl: cliOptions.gatewayUrl,
@@ -32567,7 +32967,7 @@ withSpaceProfileOption(spaceCmd.command("join").description("Open an existing Sp
32567
32967
  const localEcho = opts.noLocalEcho !== true;
32568
32968
  const view = getGlobalViewOption();
32569
32969
  if (opts.selfServe === true) {
32570
- const spaceValue = normalizeOptionalString$12(space);
32970
+ const spaceValue = normalizeOptionalString$15(space);
32571
32971
  if (!spaceValue) throw Object.assign(/* @__PURE__ */ new Error("space join --self-serve requires an explicit public Organization Space ID"), { code: "space.join.self_serve.space_required" });
32572
32972
  await runCommandWithEntryChecks({
32573
32973
  routeTokens: [
@@ -32591,7 +32991,7 @@ withSpaceProfileOption(spaceCmd.command("join").description("Open an existing Sp
32591
32991
  });
32592
32992
  return;
32593
32993
  }
32594
- if (view === "agent" && normalizeOptionalString$12(space) === null) {
32994
+ if (view === "agent" && normalizeOptionalString$15(space) === null) {
32595
32995
  await runSpaceJoin({
32596
32996
  profile: cliOptions.profile,
32597
32997
  baseUrl: cliOptions.gatewayUrl,
@@ -32643,8 +33043,8 @@ withSpaceProfileOption(spaceCmd.command("wake-progress").description("Read live
32643
33043
  profile: cliOptions.profile,
32644
33044
  baseUrl: cliOptions.gatewayUrl,
32645
33045
  space: String(space),
32646
- clientMessageId: normalizeOptionalString$12(opts.clientMessage) ?? void 0,
32647
- targetProfileId: normalizeOptionalString$12(opts.targetProfile) ?? void 0,
33046
+ clientMessageId: normalizeOptionalString$15(opts.clientMessage) ?? void 0,
33047
+ targetProfileId: normalizeOptionalString$15(opts.targetProfile) ?? void 0,
32648
33048
  password: cliOptions.password,
32649
33049
  view,
32650
33050
  entryChecksHandled: true
@@ -32665,10 +33065,10 @@ withSpaceProfileOption(spaceCmd.command("wake-stop").description("Request Stop f
32665
33065
  profile: cliOptions.profile,
32666
33066
  baseUrl: cliOptions.gatewayUrl,
32667
33067
  space: String(space),
32668
- clientMessageId: normalizeOptionalString$12(opts.clientMessage) ?? void 0,
32669
- sourceSignalId: normalizeOptionalString$12(opts.sourceSignal) ?? void 0,
33068
+ clientMessageId: normalizeOptionalString$15(opts.clientMessage) ?? void 0,
33069
+ sourceSignalId: normalizeOptionalString$15(opts.sourceSignal) ?? void 0,
32670
33070
  targetProfileId: String(opts.targetProfile),
32671
- reason: normalizeOptionalString$12(opts.reason) ?? void 0,
33071
+ reason: normalizeOptionalString$15(opts.reason) ?? void 0,
32672
33072
  password: cliOptions.password,
32673
33073
  view,
32674
33074
  entryChecksHandled: true
@@ -33176,8 +33576,8 @@ withSpaceProfileOption(spaceCmd.command("updates").description("Read formal upda
33176
33576
  withSpaceProfileOption(spaceCmd.command("result").description("Read one formal dispatch result scoped to this space.").argument("[space]", "Space ID (64-character hex)").option("--dispatch <dispatch-id>", "Lookup by dispatch ID").option("--result-ref <result-ref>", "Lookup by dispatch result ref").option("--json", "Print canonical JSON", false).option("--password <value>", "Space password for protected access")).action(async (space, opts, command) => {
33177
33577
  const cliOptions = resolveSpaceCommandCliOptions(command, opts);
33178
33578
  const spaceValue = String(space ?? "").trim();
33179
- const dispatchId = normalizeOptionalString$12(opts.dispatch);
33180
- const resultRef = normalizeOptionalString$12(opts.resultRef);
33579
+ const dispatchId = normalizeOptionalString$15(opts.dispatch);
33580
+ const resultRef = normalizeOptionalString$15(opts.resultRef);
33181
33581
  const selectorCount = Number(dispatchId !== null) + Number(resultRef !== null);
33182
33582
  const outputView = await resolveEffectiveViewForOutput();
33183
33583
  if ((spaceValue.length === 0 || selectorCount !== 1) && outputView === "agent") throw createSpaceResultGuideError();
@@ -33805,6 +34205,16 @@ function isDispatchSpaceActionToolServerArgv(argv) {
33805
34205
  async function runLocalCli(argv) {
33806
34206
  try {
33807
34207
  await ensureSystemLayout();
34208
+ const [startupCommand, startupSubcommand] = parseLeadingCommandTokensFromArgv(argv, 2);
34209
+ if (!(isPassiveCliQueryArgv(argv) || startupCommand === "service" && startupSubcommand === "run")) await recoverInterruptedComputerAuthHandoff({
34210
+ presenter: createSilentPresenter("agent"),
34211
+ runtime: {
34212
+ interactive: false,
34213
+ resolvedView: "agent",
34214
+ viewMode: "agent"
34215
+ },
34216
+ view: "agent"
34217
+ });
33808
34218
  const removedCcInputMessage = getRemovedCcCliInputMessage(argv);
33809
34219
  if (removedCcInputMessage) throw new Error(removedCcInputMessage);
33810
34220
  const retiredCommandMessage = resolveRetiredCliCommandMessage(argv);