openmeld 0.3.205 → 0.3.207
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{add-me-membership-jhCNTfdl.js → add-me-membership-1JHMjZoR.js} +2 -2
- package/dist/{add-me-membership-jhCNTfdl.js.map → add-me-membership-1JHMjZoR.js.map} +1 -1
- package/dist/{agents-9krfNX_L.js → agents-CIDsThyG.js} +1041 -597
- package/dist/agents-CIDsThyG.js.map +1 -0
- package/dist/{api-client-foundation-BguumKMv.js → api-client-foundation-D6_NXHPV.js} +1 -1
- package/dist/{api-client-foundation-BMPOo4bG.js → api-client-foundation-DSurenul.js} +17 -7
- package/dist/api-client-foundation-DSurenul.js.map +1 -0
- package/dist/auth-session-B7QMhHwh.js +4 -0
- package/dist/{auth-session-wmefguut.js → auth-session-CO5XtFaq.js} +450 -128
- package/dist/auth-session-CO5XtFaq.js.map +1 -0
- package/dist/{base-url-C89TOpPV.js → base-url-BE3pFiOZ.js} +1 -1
- package/dist/{base-url-jWXPssF_.js → base-url-C6sHRNGu.js} +3 -3
- package/dist/{base-url-jWXPssF_.js.map → base-url-C6sHRNGu.js.map} +1 -1
- package/dist/cli-binary-manifest-DiUulkp0.js +117 -0
- package/dist/cli-binary-manifest-DiUulkp0.js.map +1 -0
- package/dist/{command-DKM3wO3V.js → command-Bzt9zgnI.js} +14 -12
- package/dist/{command-DKM3wO3V.js.map → command-Bzt9zgnI.js.map} +1 -1
- package/dist/computer-connection-BOl79Ftf.js +54 -0
- package/dist/computer-connection-BOl79Ftf.js.map +1 -0
- package/dist/computer-connection-review-BTOvbJYL.js +39 -0
- package/dist/computer-connection-review-BTOvbJYL.js.map +1 -0
- package/dist/{computer-setup-continuation-Dad0lLP9.js → computer-setup-continuation-DmKdhR5u.js} +4 -4
- package/dist/{computer-setup-continuation-Dad0lLP9.js.map → computer-setup-continuation-DmKdhR5u.js.map} +1 -1
- package/dist/control-plane-D9jDcbMZ.js +1211 -0
- package/dist/control-plane-D9jDcbMZ.js.map +1 -0
- package/dist/daemon-local-state-file-jOXuXrky.js +45 -0
- package/dist/daemon-local-state-file-jOXuXrky.js.map +1 -0
- package/dist/daemon-runtime-lease-Dd4hdHNo.js +50 -0
- package/dist/daemon-runtime-lease-Dd4hdHNo.js.map +1 -0
- package/dist/{daemon-runtime-lease-BG9g0a6Z.js → daemon-runtime-lease-y3n1K0-C.js} +1 -1
- package/dist/{daemon-service-manager-DqVtRLBY.js → daemon-service-manager-Bh0LoLed.js} +1 -1
- package/dist/{daemon-service-manager-BVipiZwK.js → daemon-service-manager-GiMCiTmu.js} +99 -85
- package/dist/daemon-service-manager-GiMCiTmu.js.map +1 -0
- package/dist/daemon-service-runtime-DQW9gSLT.js +3642 -0
- package/dist/daemon-service-runtime-DQW9gSLT.js.map +1 -0
- package/dist/{daemon-state-BwIoDq7_.js → daemon-state-C37ZtIZK.js} +11 -5
- package/dist/daemon-state-C37ZtIZK.js.map +1 -0
- package/dist/{dist-CkixulB-.js → dist-D-kJdWZE.js} +4272 -3990
- package/dist/dist-D-kJdWZE.js.map +1 -0
- package/dist/dist-DTG_Vqc7.js +4 -0
- package/dist/distribution-DY2fBeSW.js +72 -0
- package/dist/distribution-DY2fBeSW.js.map +1 -0
- package/dist/{elapsed-time-CjAPqg-B.js → elapsed-time-CcoM2R3N.js} +7 -4
- package/dist/{elapsed-time-CjAPqg-B.js.map → elapsed-time-CcoM2R3N.js.map} +1 -1
- package/dist/{installer-CZyyvNZr.js → installation-inventory-DJlwXa1q.js} +362 -361
- package/dist/installation-inventory-DJlwXa1q.js.map +1 -0
- package/dist/{lock-CvBnBcFK.js → lock-Dxp6o_t_.js} +56 -7
- package/dist/lock-Dxp6o_t_.js.map +1 -0
- package/dist/{openmeld-DVThrV4O.js → openmeld-CiL4AiB0.js} +232 -23
- package/dist/openmeld-CiL4AiB0.js.map +1 -0
- package/dist/openmeld-dev.js +1 -1
- package/dist/openmeld-environment-target-NtJYJe1D.js +256 -0
- package/dist/openmeld-environment-target-NtJYJe1D.js.map +1 -0
- package/dist/{openmeld-maintenance-worker-Cxp6fwB5.js → openmeld-maintenance-worker-DjdmRASI.js} +9 -8
- package/dist/{openmeld-maintenance-worker-Cxp6fwB5.js.map → openmeld-maintenance-worker-DjdmRASI.js.map} +1 -1
- package/dist/{openmeld-tools-update-coordinator-DJ65uI3O.js → openmeld-tools-update-coordinator-D9Skj8IE.js} +52 -4013
- package/dist/openmeld-tools-update-coordinator-D9Skj8IE.js.map +1 -0
- package/dist/openmeld.js +3 -3
- package/dist/{prepare-session-executor-aE1YARgn.js → prepare-session-executor-B0NtjHEL.js} +15 -13
- package/dist/{prepare-session-executor-aE1YARgn.js.map → prepare-session-executor-B0NtjHEL.js.map} +1 -1
- package/dist/{profiles-Dx3gaXgQ.js → runtime-transport-QIZmAo4-.js} +634 -1825
- package/dist/runtime-transport-QIZmAo4-.js.map +1 -0
- package/dist/service-account-authorization-Dt8kGvq8.js +56 -0
- package/dist/service-account-authorization-Dt8kGvq8.js.map +1 -0
- package/dist/service-control-capabilities-BU5F75zi.js +54 -0
- package/dist/service-control-capabilities-BU5F75zi.js.map +1 -0
- package/dist/service-control-capabilities-CzUB1ovW.js +4 -0
- package/dist/upgrade-DLECkjMt.js +4 -0
- package/dist/{upgrade-Bk8t5oav.js → upgrade-NxpTydHp.js} +6 -4
- package/dist/upgrade-NxpTydHp.js.map +1 -0
- package/dist/{urls-4D7CaXe3.js → urls-CY2uzH2-.js} +2 -1
- package/dist/urls-CY2uzH2-.js.map +1 -0
- package/package.json +2 -2
- package/dist/agents-9krfNX_L.js.map +0 -1
- package/dist/api-client-foundation-BMPOo4bG.js.map +0 -1
- package/dist/auth-session-CpPqG8Xz.js +0 -4
- package/dist/auth-session-wmefguut.js.map +0 -1
- package/dist/daemon-runtime-lease-CXlGR-iA.js +0 -87
- package/dist/daemon-runtime-lease-CXlGR-iA.js.map +0 -1
- package/dist/daemon-service-manager-BVipiZwK.js.map +0 -1
- package/dist/daemon-state-BwIoDq7_.js.map +0 -1
- package/dist/dist-BFbC-9BX.js +0 -4
- package/dist/dist-CkixulB-.js.map +0 -1
- package/dist/installer-CZyyvNZr.js.map +0 -1
- package/dist/lock-CvBnBcFK.js.map +0 -1
- package/dist/openmeld-DVThrV4O.js.map +0 -1
- package/dist/openmeld-tools-update-coordinator-DJ65uI3O.js.map +0 -1
- package/dist/profiles-Dx3gaXgQ.js.map +0 -1
- package/dist/upgrade-BFGKy5He.js +0 -4
- package/dist/upgrade-Bk8t5oav.js.map +0 -1
- package/dist/urls-4D7CaXe3.js.map +0 -1
|
@@ -1,35 +1,41 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
import { f as toSpaceMetaUrl, g as toSpaceUpdatesUrl } from "./urls-
|
|
3
|
+
import { f as toSpaceMetaUrl, g as toSpaceUpdatesUrl } from "./urls-CY2uzH2-.js";
|
|
4
4
|
import { t as isLoopbackHostname } from "./loopback-hostname-DHQPKq8N.js";
|
|
5
|
-
import {
|
|
5
|
+
import { E as assessLocalMachineFailure, F as accountProfileSpaceCacheDir, J as legacyAccountProfileSpacesDir, M as formatLocalMachineIssueMessage, N as OPENMELD_HOME_ENV_KEY, R as accountsDir, X as normalizeAccountKey, Z as normalizeOpenMeldProfileId, dt as resolveOpenMeldEnvPreset, et as openMeldManagedBinaryPath, ft as resolveOpenMeldRootDir, i as isOpenMeldLockError, k as createServiceSpawnPendingIssue, pt as resolveOpenMeldServiceOwnedPathInput, q as isPublishedOpenMeldHome, rt as openMeldRootDir, u as resolveOpenMeldOrphanedLockIssue, v as resolveCliContextId, x as resolveOpenMeldLaneDescriptor } from "./lock-Dxp6o_t_.js";
|
|
6
|
+
import { $r as spaceMemberKindSchema, An as DAEMON_STREAM_KEEPALIVE_PING, Ar as submitFeedbackIssueResponseSchema, Bn as OPENMELD_HEADER_SPACE_ADDRESSING_VERSION, Br as agentActivityEventSchema, Ci as computerFileAccessPolicyInputSchema, Cn as toStructuredApiClientFailure, Dr as organizationDirectoryResponseSchema, Fr as pauseCenterAgentRoutineResponseSchema, Ir as resumeCenterAgentRoutineResponseSchema, Kn as SPACE_DISPATCH_TRACE_PROMPT_PREVIEW_MAX_CHARS, Lr as updateCenterAgentRoutineResponseSchema, Mr as deleteCenterAgentRoutineResponseSchema, Nr as listCenterAgentRoutineRunsResponseSchema, Or as organizationComputersResponseSchema, Pr as listCenterAgentRoutinesResponseSchema, Qr as spaceMemberDirectorySchema, Si as computerFileAccessDaemonFrameSchema, Sr as listOrganizationSkillsResponseSchema, Ti as toCompatibleSpaceAddressingRequestWireValue, Tr as organizationSkillSummarySchema, Tt as buildSpaceAttachmentDownloadPath, Un as getSpaceUpdatesResponseSchema, Wn as spaceEntryTargetSchema, Wr as agentActivitySnapshotResponseSchema, Xr as spaceMemberDirectoryAllowedRelationsSchema, Yr as spaceMemberAgentWakeAvailabilitySchema, Zr as spaceMemberDirectoryEntrySchema, _i as listProjectsResponseSchema, _r as organizationSpaceDirectoryWithMemberCountsResponseSchema, ai as observedLocalAgentSessionSchema, an as createServiceConnectionEvidenceApi, ar as BETTER_AUTH_DEVICE_AUTHORIZATION_GRANT_TYPE, bi as COMPUTER_FILE_ACCESS_RUNTIME_CAPABILITY, br as spaceMetaSchema, cr as betterAuthDeviceAuthorizationErrorResponseSchema, di as serviceConnectionEvidenceJournalSchema, dr as betterAuthSessionSnapshotResponseSchema, fi as localProjectControlConnectionSchema, gi as createProjectResponseSchema, hi as archiveProjectResponseSchema, hr as gatewayErrorEnvelopeSchema, in as createRuntimeReportingApi, jr as createCenterAgentRoutineResponseSchema, jt as createAgentActivityApi, kr as submitFeedbackIssueRequestSchema, lr as betterAuthDeviceAuthorizationTokenRequestSchema, mi as localProjectControlDiscoverProjectsResponseSchema, oi as centerAgentToolSpeakerSchema, on as createSpaceApi, or as betterAuthDeviceAuthorizationCodeRequestSchema, pi as localProjectControlDaemonFrameSchema, ri as agentActivitySessionInventoryResponseSchema, sr as betterAuthDeviceAuthorizationCodeResponseSchema, t as OpenMeldApiClientHttpError, tr as submitAgentControllerTaskLifecycleEventItemSchema, ui as serviceConnectionEvidenceEventSchema, ur as betterAuthDeviceAuthorizationTokenResponseSchema, vi as projectSchema, wi as computerFileAccessPolicySchema, wr as organizationSkillReleaseSummarySchema, xi as OPENMELD_RUNTIME_CAPABILITIES_HEADER, xr as getOrganizationSkillResponseSchema, yi as updateProjectResponseSchema, yr as spaceCreatorSchema, zn as OPENMELD_HEADER_REQUEST_ID, zr as AGENT_ACTIVITY_PRESENCE_TTL_MAX_MS } from "./dist-D-kJdWZE.js";
|
|
6
7
|
import { b as normalizeKnownBuiltinAgentControllerId, d as resolveBuiltinAgentControllerConversationKind, l as buildAgentControllerConversationRef } from "./controller-contract-pe3_Re-c.js";
|
|
7
|
-
import { $a as RUNTIME_STATE_PERSIST_MIN_INTERVAL_MS, $n as resolveRouteRegistrationReconcileDecision, $t as resolveProjectBindingForPath, A as resolveDaemonStatusSnapshot, Aa as normalizeNonNegativeInteger$1, Ai as readCurrentDaemonOwnerSnapshot, An as resolveSkillsAgentRegistry, Ar as seedLegacyAgentContext, B as formatDaemonServiceRefreshReliabilityMessage, Ba as CONTROLLED_SHUTDOWN_SOCKET_CLOSE_TIMEOUT_MS, Bi as waitForDaemonSystemServiceToStop, Bn as repairBuiltinControllerInstall, Br as buildWorkingLanguagePromptPlan, C as isSystemServiceStartupTimeoutError, Ca as ensureDaemonRuntimePaths, Ci as buildCliLaunchInvocation, Cn as removeAgentCustomTarget, Cr as buildRuntimeWorkspaceFingerprint, Ct as summarizeSkippedDaemonProfiles, D as captureDaemonServiceEvidence, Da as dirnamePath, Di as buildDaemonOwnerSnapshotFromObservedState, Dn as updateAgentRegistrations, Do as formatDaemonLifecycleOriginSummary, Dr as loadLedgerState, Ds as compareAgentControllerRefsForDisplay, Dt as resolveLocalController, E as startDaemonSystemServiceWithAutoRepair, Ea as asRecord, Ei as inspectDaemonServiceInventory, En as updateAgentCustomTarget, Eo as emitDaemonLifecycleEvent, Er as commitResolvedAgentContext, Es as resolveUserFacingCliEntryCommand, Et as readLocalEnabledControllers, F as buildDaemonServiceRefreshNextStep, Fa as warnDaemonEvent, Fi as getEffectiveDaemonRuntimeStatus, Fr as buildAgentContextLookupKey, G as buildDaemonServiceDependencyDetails, Ga as DEFAULT_RECONNECT_DELAY_MS, Gn as isNpmGlobalCommandPath, Gt as bindProject, Ha as DAEMON_STREAM_CONNECT_TIMEOUT_MS, Hi as listDaemonOwnedProcesses, Hn as resolveBuiltinAgentControllerDefinition, Ho as isDaemonServiceContractIdentityReusable, I as buildDaemonServiceRefreshPromptMessage, Ia as CATALOG_SYNC_RETRY_INTERVAL_MS, Ii as readCurrentDaemonRuntimeContext, In as normalizeAgentId, Ir as DEFAULT_TASK_LIFECYCLE_HEARTBEAT_INTERVAL_MS, It as readProfileWorkspaceConfigForAccount, J as buildDaemonServiceDependencySummary, Ja as PROVIDER_CONVERSATION_PROOF_SYNC_INTERVAL_MS, Ji as DaemonServiceRunError, Jn as normalizeDispatchThreadAction, Jr as parseAgentControllerRef, Jt as listProjectConnectionsWithStatus, K as buildDaemonServiceDependencyMeaning, Ka as HEARTBEAT_RESPONSE_TIMEOUT_MS, Ki as ensureDaemonRuntimeContractState, Kn as isPnpmGlobalCommandPath, Ko as compareSemver, Kt as isProjectBound, La as CATALOG_SYNC_SIGNAL_POLL_INTERVAL_MS, Li as readCurrentObservedDaemonRuntimeStatus, Ln as normalizeAgentIds, Lr as areAgentControllerInterfaceAccountsSame, M as resolveDaemonStatusAuthenticationAttention, Ma as normalizeText$2, Mi as resolveStoppedContractWriteBlockedReason, Mo as runDaemonServiceManagerAction, Mr as upsertConversationExecutionState, Mt as resolveProfileWorkspaceRuntime, N as resolveServiceReadiness, Na as nowIsoString, Ni as summarizeDaemonOwnerSnapshot, Nn as resolveRegistryRuntimeAdapterCapabilitySnapshot, No as runWithDaemonLifecycleCommandJournal, Nr as withLedgerStateTransaction, Nt as ensureOpenMeldManagedProfileWorkspace, O as captureDaemonServiceEvidenceBestEffort, Oa as emitRunLine, Oi as formatDaemonOwnerSummaryLabel, On as canManageRegistryAgentSkillTargets, Oo as readLatestDaemonLifecycleConnectionStateEvent, Or as removeConversationExecutionState, Ot as resolveLocalRuntimeControllerSupport, Pa as toErrorMessage$10, Pi as clearDaemonRuntimeStateIfDefinitelyStopped, Pn as resolveRegistryRuntimeAdapterContractByAgentControllerRef, Pr as buildAuthenticatedControlPlaneResponse, Qa as RUNTIME_AGENT_CONTROLLER_REPORT_SYNC_RETRY_INTERVAL_MS, Qn as isDaemonReconcileInProgressError, Qr as renderWorkingLanguagePrompt, Qt as removeProjectConnection, R as buildDaemonServiceStatusReadOnlyDetail, Ra as CONTROLLED_SHUTDOWN_REQUEST_TIMEOUT_MS, Ri as resolveDaemonRuntimeState, Rn as parseAgentEnabledOption, Rr as buildAgentControllerRef, Rt as resolveConfiguredProfileWorkspacePathForAccount, S as isDaemonInventoryRunningAndStartReady$1, Sa as buildLedgerPaths, So as resolveDaemonBundleEntryPathFromState, Sr as runRuntimeTask, Ss as formatOpenMeldCliTextBlock, St as loadDaemonRouteCatalog, T as waitForSystemServiceStartup$1, Ta as resolvePreferredDaemonDeviceId, Ti as createProviderOriginalError, Tn as setAgentRegistrationEnabled, Tr as appendLedgerHistoryEntry, Tt as buildRuntimeRouteTargets, U as clearDaemonStartFailureState, Ua as DAEMON_STREAM_KEEPALIVE_INTERVAL_MS, Un as isBunGlobalCommandPath, Uo as readDaemonServiceContract, Ut as ProjectBindingOperationError, V as formatDaemonServiceUpdateRequiredMessage, Va as DAEMON_RUNTIME_CONTRACT_EPOCH, Vi as cleanupLegacySharedDaemonServiceState, Vn as EMPTY_AGENT_CONTROLLER_INTERFACE_CAPABILITIES, Vo as clearDaemonServiceContract, Vr as createAgentControllerInterfaceDisplayRows, W as writeDaemonStartFailureState, Wa as DAEMON_STREAM_KEEPALIVE_PONG_TIMEOUT_MS, Wn as isHomebrewCommandPath, Wo as upsertDaemonServiceContract, Wt as ProjectBindingStoreUpdateRequiredError, X as resolveDaemonServiceDependencyDiagnostics, Xa as REGISTER_RESPONSE_TIMEOUT_MS, Xn as SPACE_ACTION_CONTEXT_GUIDANCE_LINES, Xt as removeAgentActivityBindingsWhileDeliveryLocked, Y as buildDaemonServiceDependencyTitle, Ya as PROVIDER_CONVERSATION_PROOF_SYNC_RETRY_INTERVAL_MS, Yi as resolveCurrentDaemonExpectedVersion, Yn as syncRuntimeEventToInflightTaskControlRegistry, Za as RUNTIME_AGENT_CONTROLLER_REPORT_SYNC_INTERVAL_MS, Zn as SPACE_ACTION_TARGET_GUIDANCE_LINES, Zr as renderInformationProtectionPrompt, Zt as removeMissingProjectConnections, _ as DaemonServiceLifecycleDrainTimeoutError, _a as DAEMON_SERVICE_FULL_ALIGNMENT_ANOMALIES, _i as forkCodexAppServerThread, _n as listAgentRegistrations, _o as OPENMELD_VERSION, _r as resolveDispatchQueueLogMeta, _s as resolveAuthenticationReasonFromState, _t as readDaemonRouteCatalogCache, a as resolveServiceUpdateUrgency, aa as resolveCurrentOpenMeldAccountContext, ai as resolveCatalogSyncSkippedProfilesLogState, an as withAgentActivityDeliveryLock, ar as createLocalTaskInterruptSender, ba as classifyDaemonServiceRunStartability, bi as createUnavailableProviderUsageLimits, bn as readAgentRuntimeConfigHealth, bo as readDaemonActiveBundleState, br as resolveCompatibleConversationExecutionState, bs as formatOpenMeldCliCommands, bt as createMutableRouteCatalogState, ca as ensureDaemonSystemServiceCommandFiles, ci as parseOpenCodeGoUsageResponse, cn as syncDeviceRuntimeStateProjection, co as resolveOpenMeldEnvironmentTarget, cr as createInflightTaskControlRegistry, da as isOpenMeldManagedBinaryPath, di as GrokBuildAcpTransportError, dn as emitReconcileStartedEvidence, dr as MIN_HEARTBEAT_INTERVAL_MS, ds as buildHumanAuthenticationCard, er as createSerialAgentInteractionCallback, fa as buildDaemonServiceTargetSpec, fi as probeGrokBuildAcpInterface, fo as requestLocalDaemonShutdown, fr as applyAcceptedLeases, fs as createAuthenticationError, g as scheduleDaemonServiceUpdate, ga as DAEMON_SERVICE_AUTO_HEAL_ANOMALIES, gi as resolveInstalledCodexLaunchCandidates, gn as listAgentCustomTargets, go as readManagedCliInstallation, gr as resolveCatalogSyncIntervalMs, gt as slugifyOpenClawNamePart, hi as resolveCodexTimeoutMs, hn as createRegistrationFromCatalogTarget, hr as resolveAdaptiveHeartbeatIntervalMs, ht as normalizeOpenClawSpaceIdPrefix, i as writeOpenMeldToolsMaintenancePolicy, in as resolveLocalProjectConnectionForPath, io as clearAllSelectedOpenMeldProfileIds, ir as mergeOpenClawGatewayVisibility, j as resolveDaemonStatusAttention, ja as normalizeOptionalText$13, ji as resolveDaemonStopStrategy, jo as resolveRecentDaemonSignalStopCause, jr as settleInflightTask, jt as resolveCurrentEffectiveProfileWorkingFolderRuntime, k as formatDaemonFailureContextText, ka as normalizeHeartbeatIntervalMs, ki as hasActiveDaemonOwners, ko as readLatestDaemonLifecycleOriginEvent, kr as resolveConversationExecutionStateByLookupKey, la as extractDaemonCommandEntryPath, li as forkOpenCodeServerSession, ln as emitDriftDetectedEvidence, lo as resolveAuthBaseUrl, lr as ADAPTIVE_HEARTBEAT_JITTER_RATIO, ls as buildAuthenticationStatusLabel, ma as isVersionDowngrade, mi as projectCodexUsageLimits, mn as addAgentCustomTarget, mr as pruneStaleLeases, ms as resolveAuthenticationGuidance, mt as buildOpenClawSpaceSessionKey, n as readOpenMeldToolsMaintenancePolicy, no as resolveOpenMeldProfileOrNull, nr as normalizeDispatchPostMessageAction, o as assessServerRequiredVersion, oa as writeDaemonServiceContract, oi as createLocalAdapterContainer, on as withAgentActivityLocalStateLock, or as buildLocalServiceDiagnosticsPayload, pa as resolveDaemonServiceAlignmentDecision, pi as resolveInstalledGrokBuildLaunchCandidates, pn as resolveAgentProfilePrimaryAgentControllerReport, po as sendLocalDaemonControlPlaneRequest, pr as applyIntervalJitterMs, ps as extractAuthenticationPromptAction, pt as prepareProviderRuntime, q as buildDaemonServiceDependencyNextStep, qa as MAX_RECONNECT_DELAY_MS, qi as readDaemonRuntimeContractRepairReport, qt as listProjectBindings, r as resolveOpenMeldToolsMaintenanceProjection, rr as createPendingAgentInteractionRegistry, s as describeServerRequiredVersionUnavailableReason, sa as buildDaemonSystemServiceCommandSpec, si as createLocalAdapterEntries, sr as createLocalExecutionSlots, ss as readDaemonCatalogSyncSignal, t as createOpenMeldToolsUpdateCoordinator, ta as resolveRuntimeContext, tn as setDefaultProjectConnection, to as requireOpenMeldProfile, tr as buildDispatchReplyContextSummary, u as assessCliUpdate, ua as resolveDaemonBundleIdFromEntryPath, ui as resolveInstalledOpenCodeLaunchCandidates, un as emitReconcileCompletedEvidence, uo as LocalDaemonControlPlaneClientError, ur as MAX_HEARTBEAT_INTERVAL_MS, us as buildCommandAuthenticationPromptMessage$1, v as runDaemonServiceLifecycle, va as DAEMON_SERVICE_REPAIR_ANOMALIES, vi as verifyCodexAppServerThread, vn as listAgentTargetStates, vo as cleanupInactiveDaemonServiceBundles, vr as resolveDispatchContinuityObservation, vs as formatInlineOpenMeldCliCommands, vt as writeDaemonRouteCatalogCache, w as resolveSystemServiceStartupWaitMs, wa as resolveDaemonDeviceId, wi as materializeCliLaunchCommand, wn as resolveAgentTargetState, wr as buildTaskResultEnvelope, wt as syncDaemonRouteCatalogState, x as uninstallDaemonServiceUpdateWorker, xa as classifyDaemonServiceWakeability, xi as createUnsupportedProviderUsageLimits, xn as reconcileNewRunnableBuiltinAgentRegistrations, xo as resolveAlignedDaemonActiveBundleEntryPath, xr as resolveLatestScopedConversationExecutionState, xt as createRouteCatalogFromMutableState, y as ensureDaemonServiceMaintenanceInstalled, ya as DAEMON_SERVICE_WAKEABILITY_ADVISORY_ANOMALIES, yi as resolveInstalledClaudeCodeLaunchCandidates, yn as manageAgentRegistrationInstallation, yo as prepareDaemonServiceBundle, yr as resolveCompatibleAgentContextMatch, ys as formatOpenMeldCliCommand, yt as resolveLocalServiceDemand, z as buildDaemonServiceUpdateRequiredNextStep, za as CONTROLLED_SHUTDOWN_RESULT_ACK_TIMEOUT_MS, zi as resolveDaemonServiceManagerForRuntimeState, zn as sortAgentRegistrations, zr as buildInformationProtectionPromptPlan, zt as setCustomProfileWorkspace } from "./openmeld-tools-update-coordinator-DJ65uI3O.js";
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import { b as hashBundledSkillAssets, f as ensureLocalSkills, g as loadSelectedSkillAssets, r as collectSkillsReadinessSnapshot, t as installSkillsToTargets, u as resolveSkillInstallStateForTarget, v as withSkillsInstallLock, x as OFFICIAL_CLI_SKILL_URL, y as computeDirectoryContentHash } from "./installer-CZyyvNZr.js";
|
|
8
|
+
import { $i as buildDaemonServiceTargetSpec, $n as resolveRouteRegistrationReconcileDecision, $t as resolveProjectBindingForPath, A as resolveDaemonStatusSnapshot, Aa as DAEMON_STREAM_KEEPALIVE_INTERVAL_MS, Ai as readCurrentDaemonOwnerSnapshot, An as resolveSkillsAgentRegistry, Ar as seedLegacyAgentContext, B as formatDaemonServiceRefreshReliabilityMessage, Ba as RUNTIME_STATE_PERSIST_MIN_INTERVAL_MS, Bn as repairBuiltinControllerInstall, Br as buildWorkingLanguagePromptPlan, C as isSystemServiceStartupTimeoutError, Ca as CATALOG_SYNC_RETRY_INTERVAL_MS, Ci as buildCliLaunchInvocation, Cn as removeAgentCustomTarget, Cr as buildRuntimeWorkspaceFingerprint, Ct as summarizeSkippedDaemonProfiles, D as captureDaemonServiceEvidence, Da as CONTROLLED_SHUTDOWN_SOCKET_CLOSE_TIMEOUT_MS, Di as buildDaemonOwnerSnapshotFromObservedState, Dn as updateAgentRegistrations, Dr as loadLedgerState, Dt as resolveLocalController, E as startDaemonSystemServiceWithAutoRepair, Ea as CONTROLLED_SHUTDOWN_RESULT_ACK_TIMEOUT_MS, Ei as inspectDaemonServiceInventory, En as updateAgentCustomTarget, Er as commitResolvedAgentContext, Et as readLocalEnabledControllers, F as buildDaemonServiceRefreshNextStep, Fa as PROVIDER_CONVERSATION_PROOF_SYNC_INTERVAL_MS, Fr as buildAgentContextLookupKey, G as buildDaemonServiceDependencyDetails, Ga as clearAllSelectedOpenMeldProfileIds, Gi as resolveRuntimeContext, Gn as isNpmGlobalCommandPath, Gt as bindProject, Ha as requireOpenMeldProfile, Hn as resolveBuiltinAgentControllerDefinition, I as buildDaemonServiceRefreshPromptMessage, Ia as PROVIDER_CONVERSATION_PROOF_SYNC_RETRY_INTERVAL_MS, Ii as ensureDaemonRuntimeContractState, In as normalizeAgentId, Ir as DEFAULT_TASK_LIFECYCLE_HEARTBEAT_INTERVAL_MS, It as readProfileWorkspaceConfigForAccount, J as buildDaemonServiceDependencySummary, Jn as normalizeDispatchThreadAction, Jr as parseAgentControllerRef, Jt as listProjectConnectionsWithStatus, K as buildDaemonServiceDependencyMeaning, Kn as isPnpmGlobalCommandPath, Kt as isProjectBound, La as REGISTER_RESPONSE_TIMEOUT_MS, Li as readDaemonRuntimeContractRepairReport, Ln as normalizeAgentIds, Lr as areAgentControllerInterfaceAccountsSame, M as resolveDaemonStatusAuthenticationAttention, Ma as DEFAULT_RECONNECT_DELAY_MS, Mi as resolveStoppedContractWriteBlockedReason, Mr as upsertConversationExecutionState, Mt as resolveProfileWorkspaceRuntime, N as resolveServiceReadiness, Na as HEARTBEAT_RESPONSE_TIMEOUT_MS, Ni as summarizeDaemonOwnerSnapshot, Nn as resolveRegistryRuntimeAdapterCapabilitySnapshot, Nr as withLedgerStateTransaction, Nt as ensureOpenMeldManagedProfileWorkspace, O as captureDaemonServiceEvidenceBestEffort, Oa as DAEMON_RUNTIME_CONTRACT_EPOCH, Oi as formatDaemonOwnerSummaryLabel, On as canManageRegistryAgentSkillTargets, Or as removeConversationExecutionState, Ot as resolveLocalRuntimeControllerSupport, Pa as MAX_RECONNECT_DELAY_MS, Pn as resolveRegistryRuntimeAdapterContractByAgentControllerRef, Pr as buildAuthenticatedControlPlaneResponse, Qi as ensureDaemonSystemServiceCommandFiles, Qn as isDaemonReconcileInProgressError, Qr as renderWorkingLanguagePrompt, Qt as removeProjectConnection, R as buildDaemonServiceStatusReadOnlyDetail, Ra as RUNTIME_AGENT_CONTROLLER_REPORT_SYNC_INTERVAL_MS, Ri as DaemonServiceRunError, Rn as parseAgentEnabledOption, Rr as buildAgentControllerRef, Rt as resolveConfiguredProfileWorkspacePathForAccount, S as isDaemonInventoryRunningAndStartReady$1, Sa as warnDaemonEvent, Sr as runRuntimeTask, St as loadDaemonRouteCatalog, T as waitForSystemServiceStartup$1, Ta as CONTROLLED_SHUTDOWN_REQUEST_TIMEOUT_MS, Ti as createProviderOriginalError, Tn as setAgentRegistrationEnabled, Tr as appendLedgerHistoryEntry, Tt as buildRuntimeRouteTargets, U as clearDaemonStartFailureState, Ua as resolveOpenMeldProfileOrNull, Un as isBunGlobalCommandPath, Ut as ProjectBindingOperationError, V as formatDaemonServiceUpdateRequiredMessage, Vn as EMPTY_AGENT_CONTROLLER_INTERFACE_CAPABILITIES, Vr as createAgentControllerInterfaceDisplayRows, W as writeDaemonStartFailureState, Wn as isHomebrewCommandPath, Wt as ProjectBindingStoreUpdateRequiredError, X as resolveDaemonServiceDependencyDiagnostics, Xi as writeDaemonServiceContract, Xn as SPACE_ACTION_CONTEXT_GUIDANCE_LINES, Xt as removeAgentActivityBindingsWhileDeliveryLocked, Y as buildDaemonServiceDependencyTitle, Yi as resolveCurrentOpenMeldAccountContext, Yn as syncRuntimeEventToInflightTaskControlRegistry, Zi as buildDaemonSystemServiceCommandSpec, Zn as SPACE_ACTION_TARGET_GUIDANCE_LINES, Zr as renderInformationProtectionPrompt, Zt as removeMissingProjectConnections, _ as DaemonServiceLifecycleDrainTimeoutError, _a as normalizeNonNegativeInteger$1, _i as forkCodexAppServerThread, _n as listAgentRegistrations, _r as resolveDispatchQueueLogMeta, _t as readDaemonRouteCatalogCache, a as resolveServiceUpdateUrgency, aa as DAEMON_SERVICE_REPAIR_ANOMALIES, ai as resolveCatalogSyncSkippedProfilesLogState, an as withAgentActivityDeliveryLock, ar as createLocalTaskInterruptSender, ba as nowIsoString, bi as createUnavailableProviderUsageLimits, bn as readAgentRuntimeConfigHealth, br as resolveCompatibleConversationExecutionState, bt as createMutableRouteCatalogState, ca as classifyDaemonServiceWakeability, ci as parseOpenCodeGoUsageResponse, cn as syncDeviceRuntimeStateProjection, co as buildHumanAuthenticationCard, cr as createInflightTaskControlRegistry, da as resolveDaemonDeviceId, di as GrokBuildAcpTransportError, dn as emitReconcileStartedEvidence, do as resolveAuthenticationGuidance, dr as MIN_HEARTBEAT_INTERVAL_MS, ea as resolveDaemonServiceAlignmentDecision, er as createSerialAgentInteractionCallback, fa as resolvePreferredDaemonDeviceId, fi as probeGrokBuildAcpInterface, fr as applyAcceptedLeases, g as scheduleDaemonServiceUpdate, ga as normalizeHeartbeatIntervalMs, gi as resolveInstalledCodexLaunchCandidates, gn as listAgentCustomTargets, gr as resolveCatalogSyncIntervalMs, gt as slugifyOpenClawNamePart, ha as emitRunLine, hi as resolveCodexTimeoutMs, hn as createRegistrationFromCatalogTarget, ho as compareAgentControllerRefsForDisplay, hr as resolveAdaptiveHeartbeatIntervalMs, ht as normalizeOpenClawSpaceIdPrefix, i as writeOpenMeldToolsMaintenancePolicy, ia as DAEMON_SERVICE_FULL_ALIGNMENT_ANOMALIES, in as resolveLocalProjectConnectionForPath, io as readDaemonCatalogSyncSignal, ir as mergeOpenClawGatewayVisibility, j as resolveDaemonStatusAttention, ja as DAEMON_STREAM_KEEPALIVE_PONG_TIMEOUT_MS, ji as resolveDaemonStopStrategy, jr as settleInflightTask, jt as resolveCurrentEffectiveProfileWorkingFolderRuntime, k as formatDaemonFailureContextText, ka as DAEMON_STREAM_CONNECT_TIMEOUT_MS, ki as hasActiveDaemonOwners, kr as resolveConversationExecutionStateByLookupKey, la as buildLedgerPaths, li as forkOpenCodeServerSession, ln as emitDriftDetectedEvidence, lo as createAuthenticationError, lr as ADAPTIVE_HEARTBEAT_JITTER_RATIO, ma as dirnamePath, mi as projectCodexUsageLimits, mn as addAgentCustomTarget, mo as resolveAuthenticationReasonFromState, mr as pruneStaleLeases, mt as buildOpenClawSpaceSessionKey, n as readOpenMeldToolsMaintenancePolicy, nr as normalizeDispatchPostMessageAction, o as assessServerRequiredVersion, oa as DAEMON_SERVICE_WAKEABILITY_ADVISORY_ANOMALIES, oi as createLocalAdapterContainer, on as withAgentActivityLocalStateLock, oo as buildAuthenticationStatusLabel, or as buildLocalServiceDiagnosticsPayload, pa as asRecord, pi as resolveInstalledGrokBuildLaunchCandidates, pn as resolveAgentProfilePrimaryAgentControllerReport, pr as applyIntervalJitterMs$1, pt as prepareProviderRuntime, q as buildDaemonServiceDependencyNextStep, qt as listProjectBindings, r as resolveOpenMeldToolsMaintenanceProjection, ra as DAEMON_SERVICE_AUTO_HEAL_ANOMALIES, rr as createPendingAgentInteractionRegistry, s as describeServerRequiredVersionUnavailableReason, sa as classifyDaemonServiceRunStartability, si as createLocalAdapterEntries, so as buildCommandAuthenticationPromptMessage$1, sr as createLocalExecutionSlots, t as createOpenMeldToolsUpdateCoordinator, ta as isVersionDowngrade, tn as setDefaultProjectConnection, tr as buildDispatchReplyContextSummary, u as assessCliUpdate, ua as ensureDaemonRuntimePaths, ui as resolveInstalledOpenCodeLaunchCandidates, un as emitReconcileCompletedEvidence, uo as extractAuthenticationPromptAction, ur as MAX_HEARTBEAT_INTERVAL_MS, v as runDaemonServiceLifecycle, va as normalizeOptionalText$13, vi as verifyCodexAppServerThread, vn as listAgentTargetStates, vr as resolveDispatchContinuityObservation, vt as writeDaemonRouteCatalogCache, w as resolveSystemServiceStartupWaitMs, wa as CATALOG_SYNC_SIGNAL_POLL_INTERVAL_MS, wi as materializeCliLaunchCommand, wn as resolveAgentTargetState, wr as buildTaskResultEnvelope, wt as syncDaemonRouteCatalogState, x as uninstallDaemonServiceUpdateWorker, xa as toErrorMessage$10, xi as createUnsupportedProviderUsageLimits, xn as reconcileNewRunnableBuiltinAgentRegistrations, xr as resolveLatestScopedConversationExecutionState, xt as createRouteCatalogFromMutableState, y as ensureDaemonServiceMaintenanceInstalled, ya as normalizeText$2, yi as resolveInstalledClaudeCodeLaunchCandidates, yn as manageAgentRegistrationInstallation, yr as resolveCompatibleAgentContextMatch, yt as resolveLocalServiceDemand, z as buildDaemonServiceUpdateRequiredNextStep, za as RUNTIME_AGENT_CONTROLLER_REPORT_SYNC_RETRY_INTERVAL_MS, zi as resolveCurrentDaemonExpectedVersion, zn as sortAgentRegistrations, zr as buildInformationProtectionPromptPlan, zt as setCustomProfileWorkspace } from "./openmeld-tools-update-coordinator-D9Skj8IE.js";
|
|
9
|
+
import { A as runtimeTransportOpenMeldToolsControlResultFramePayloadSchema, Bt as localFolderPickerHelperProtocolResultSchema, C as runtimeTransportLocalAgentControlInterruptFramePayloadSchema, D as runtimeTransportLocalAgentControlSetProfileWorkspaceFramePayloadSchema, E as runtimeTransportLocalAgentControlSetEnabledFramePayloadSchema, En as resolveSpaceMentionLabels, F as runtimeTransportResumeControllerConversationResultFramePayloadSchema, I as runtimeTransportRouteCatalogChangedFramePayloadSchema, J as openMeldSpaceEgressActionSchema, K as openMeldDaemonTaskResultPayloadSchema, Kr as openMeldRequestContextSchema, Lt as LOCAL_FOLDER_PICKER_RUNTIME_CAPABILITY, M as runtimeTransportRegisterSessionResponseSchema, Ot as normalizeSpacePasswordText, P as runtimeTransportResumeControllerConversationFramePayloadSchema, R as runtimeTransportSubmitTaskResultRequestSchema, Rt as OPENMELD_LOCAL_FOLDER_PICKER_CAPABILITY_HEADER, S as runtimeTransportLocalAgentControlForkSessionFramePayloadSchema, Sr as sanitizeDispatchErrorSummary, T as runtimeTransportLocalAgentControlRefreshCatalogFramePayloadSchema, Tn as resolveSingleSpaceMentionLabels, Tt as runtimeTransportDeliveryExecutionIdentitySchema, Vt as localFolderPickerHelperResultSchema, a as localWakeRouteWorkingFolderObservationSchema, b as runtimeTransportHeartbeatResponseSchema, bn as normalizeMessageEnvelope, br as resolvePublicAgentAvailabilityCopy, c as runtimeTransportDispatchInteractionDeliveredRequestSchema, d as runtimeTransportDispatchLifecycleRequestSchema, f as runtimeTransportDispatchPreviewEndRequestSchema, fr as LOCAL_AGENT_REASONING_MAX_CHARS, g as runtimeTransportDispatchToolActivityRequestSchema, gn as collectCanonicalMentionTextFragments, gt as agentInteractionRequestSchema, h as runtimeTransportDispatchRuntimeEvidenceRequestSchema, hn as MESSAGE_MENTION_TYPE_VALUES, j as runtimeTransportRegisterSessionRequestSchema, k as runtimeTransportOpenMeldToolsControlFramePayloadSchema, l as runtimeTransportDispatchInteractionRequestSchema, m as runtimeTransportDispatchReasoningRequestSchema, mr as localAgentReasoningPreferencesSchema, mt as AGENT_INTERACTION_DEFAULT_TIMEOUT_MS, nn as sanitizeSignalTextPreview, p as runtimeTransportDispatchPreviewRequestSchema, pr as OPENMELD_REASONING_STREAM_HEADER, r as daemonStreamFrameSchema, s as runtimeTransportDeliverDispatchRequestSchema, t as CURRENT_DAEMON_EXECUTION_CONTRACT_EPOCH, u as runtimeTransportDispatchInteractionResponseFramePayloadSchema, v as runtimeTransportForkAgentSessionResultSchema, vn as getSpaceMessageAddressingRelationSupportForTargetKind, w as runtimeTransportLocalAgentControlManageInstallationFramePayloadSchema, wt as runtimeCoordinatorExecutionTokenEnvelopeSchema, x as runtimeTransportLocalAgentControlCancelFramePayloadSchema, xn as resolveMessageEnvelopeTargetField, y as runtimeTransportHeartbeatRequestSchema, zt as localFolderPickerDaemonFrameSchema } from "./runtime-transport-QIZmAo4-.js";
|
|
10
|
+
import { $ as literal, C as formatLocalSetupActionDescription, E as localCliComponentUpdateProjectionSchema, G as boolean, S as formatLocalComponentsSummaryLabel, T as installedLocalComponentsSnapshotSchema, Y as enumFactory, Z as iso, a as openMeldDaemonControlPlaneResponseSchema, ft as url, gt as openMeldRuntimeProfileIdSchema, ht as normalizeOptionalWorkingDirectory, j as localServiceComponentUpdateProjectionSchema, ot as strictObject, q as discriminatedUnion, st as string, w as formatLocalSetupActionLabel, x as formatLocalComponentsSummaryDescription } from "./control-plane-D9jDcbMZ.js";
|
|
11
11
|
import { r as daemonServiceLaneSchema } from "./service-contract-CRyDcIIf.js";
|
|
12
|
-
import { _ as
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
12
|
+
import { C as withAdmittedServiceSession, T as ServiceAccountAdmissionError, _ as onAuthSessionCredentialObservation, a as beginAuthSessionTransition, g as onAuthSessionCredentialAvailable, i as assertAuthSessionMutationAvailable, s as clearAuthSession, u as getAuthSessionState, x as setAuthSession } from "./auth-session-CO5XtFaq.js";
|
|
13
|
+
import { b as withSkillsInstallLock, f as ensureLocalSkills, g as loadSelectedSkillAssets, l as installSkillsToTargets, n as collectSkillsReadinessSnapshot, u as resolveSkillInstallStateForTarget, v as hashBundledSkillAssets, x as OFFICIAL_CLI_SKILL_URL, y as computeDirectoryContentHash } from "./installation-inventory-DJlwXa1q.js";
|
|
14
|
+
import { n as resolveOpenMeldDistribution, o as serviceControlCapabilitiesSchema, t as isBinaryDistribution } from "./distribution-DY2fBeSW.js";
|
|
15
|
+
import { i as writeDaemonRuntimeLease } from "./daemon-runtime-lease-Dd4hdHNo.js";
|
|
16
|
+
import { $ as readManagedCliInstallation, A as prepareDaemonServiceBundle, Bt as readDaemonServiceContract, H as formatDaemonLifecycleOriginSummary, It as sendLocalDaemonControlPlaneRequest, J as runWithDaemonLifecycleCommandJournal, K as resolveRecentDaemonSignalStopCause, Lt as clearDaemonServiceContract, M as resolveAlignedDaemonActiveBundleEntryPath, N as resolveDaemonBundleEntryPathFromState, Pt as requestLocalDaemonShutdown, Rt as isDaemonServiceContractIdentityReusable, U as readLatestDaemonLifecycleConnectionStateEvent, V as emitDaemonLifecycleEvent, Vt as upsertDaemonServiceContract, W as readLatestDaemonLifecycleOriginEvent, a as resolveDaemonRuntimeState, b as cleanupInactiveDaemonServiceBundles, f as listDaemonOwnedProcesses, h as resolveDaemonBundleIdFromEntryPath, i as readCurrentObservedDaemonRuntimeStatus, j as readDaemonActiveBundleState, jt as LocalDaemonControlPlaneClientError, lt as compareSemver, n as getEffectiveDaemonRuntimeStatus, nt as OPENMELD_VERSION, o as resolveDaemonServiceManagerForRuntimeState, p as extractDaemonCommandEntryPath, q as runDaemonServiceManagerAction, r as readCurrentDaemonRuntimeContext, s as waitForDaemonSystemServiceToStop, t as clearDaemonRuntimeStateIfDefinitelyStopped, u as cleanupLegacySharedDaemonServiceState, v as isOpenMeldManagedBinaryPath } from "./daemon-service-runtime-DQW9gSLT.js";
|
|
17
|
+
import { $ as buildAgentFacingMentalModelLines, At as validateDaemonControlTargetInput, Ft as getBuiltinAgentSelectionRequiredArguments, Gt as waitForOpenMeldToolsUpdateCompletion, Ht as formatAgentOverviewPayload, Jt as sanitizeTerminalDisplayText, Kt as resolveOpenMeldToolsUpdateOperation, Lt as validateBuiltinAgentSelectionInput, Mt as buildBuiltinAgentSelectionCommand, Nt as buildBuiltinAgentSelectionExamples, Pt as getBuiltinAgentSelectionOptionalArguments, Qt as outLine, Rt as buildAgentOverviewFromContract, Y as SPACE_COLLABORATION_CONTEXT_RULE, Z as SPACE_PERSONAL_CONTRIBUTION_RULE, Zt as outJsonLine, a as formatDaemonServiceDowngradeBlockedRecommendation, at as buildSpaceWakeParticipantLines, ct as deriveContinuity, d as formatDaemonServiceMissingStatus, dt as resolvePublicAgentFailureReason, f as getDaemonDowngradeBlockedTitle, ft as resolveSpacePublicationRequirement, h as createAuthLoginGuideError, i as formatDaemonInstallFailedMessage, it as buildSpaceEntryBriefNeedMoreLine, l as formatDaemonServiceMissingRunStepOne, lt as isSelfWakeSpaceAction, m as canUseInteractivePrompts, n as resolveElapsedTimeMs, nt as buildCompactDispatchActionGuidanceLines, o as formatDaemonServiceMissingAction, p as runDaemonInstallDecisionPrompt, pt as getCommandEntryContract, qt as createPresenter, r as formatDaemonDowngradeBlockedNextStep, rt as buildSpaceAgentIdentityLine, s as formatDaemonServiceMissingMeaning, st as composeDispatchBrief, t as formatElapsedTime, tt as buildCenterAgentRoleTemplateText, u as formatDaemonServiceMissingRunStepTwo, ut as renderSpaceEntryBrief } from "./elapsed-time-CcoM2R3N.js";
|
|
18
|
+
import { a as resolveBaseUrl, c as resolveExplicitGatewayUrlOrThrow, d as createDefaultRuntimeAgentControllerSettings, f as getConfiguredDaemonDispatchLimits, g as getConfiguredSkillsConfig, i as normalizeGatewayBaseUrlOrNull, l as DEFAULT_RUNTIME_AGENT_TRANSPORT_MODE, o as resolveBaseUrlOrNull, r as normalizeGatewayBaseUrl } from "./base-url-C6sHRNGu.js";
|
|
19
|
+
import { n as writeDaemonLocalStateFile, t as readDaemonLocalStateFile } from "./daemon-local-state-file-jOXuXrky.js";
|
|
20
|
+
import { A as getDaemonStatus, G as withDaemonServiceRegistrationMutationLock, H as setDaemonServiceRuntimeState, I as readDaemonServiceRuntimeSnapshot, K as withDaemonServiceRunLock, L as releaseDaemonServiceLifecycleLock, M as isDaemonServiceRuntimeHeartbeatStale, O as ensureDaemonControlPlaneToken, R as resolveDaemonControlPlaneEndpoint, S as daemonServiceRepairJournalPath, U as uninstallDaemon, W as withDaemonServiceReconcileLock, _ as daemonRuntimeStateRootPath, a as DAEMON_SERVICE_RUNTIME_MODE_ENV, c as acquireDaemonServiceLifecycleLock, d as daemonDispatchJournalPath, f as daemonLifecycleJournalPath, h as daemonRuntimeRootPath, i as DAEMON_SERVICE_RUNTIME_DETACHED_ENV, j as installDaemon, l as clearDaemonServiceRuntimeState, o as DAEMON_SERVICE_RUNTIME_STATE_SCHEMA, q as withDaemonServiceStopLock, z as resolveDaemonServiceRuntimeMetadata } from "./daemon-state-C37ZtIZK.js";
|
|
21
|
+
import { S as resolveDaemonServiceManager, _ as readDaemonServiceJobCrashExitCode, a as disableDaemonServiceAutostartIfConfigured, c as getDaemonSystemServiceLogPath, f as isDaemonServiceJobSpawnPending, o as formatDaemonServiceJobDiagnosticsEvidence, s as getDaemonServiceLaunchdLabel } from "./daemon-service-manager-GiMCiTmu.js";
|
|
22
|
+
import { a as formatOpenMeldCliCommand, c as formatOpenMeldCliTextBlock, f as resolveUserFacingCliEntryCommand, i as formatInlineOpenMeldCliCommands, o as formatOpenMeldCliCommands, r as resolveAuthBaseUrl, t as resolveOpenMeldEnvironmentTarget } from "./openmeld-environment-target-NtJYJe1D.js";
|
|
23
|
+
import { t as admitServiceAccountStop } from "./service-account-authorization-Dt8kGvq8.js";
|
|
16
24
|
import { n as toErrorMessage$11, t as sleep } from "./dist-o3UL1EGQ.js";
|
|
17
|
-
import { a as buildOpenMeldProfileIdentityRequestHeadersWithAuth, c as buildRequestAuthHeaders,
|
|
18
|
-
import { A as installDaemon, D as ensureDaemonControlPlaneToken, F as readDaemonServiceRuntimeSnapshot, G as withDaemonServiceRunLock, H as uninstallDaemon, I as releaseDaemonServiceLifecycleLock, K as withDaemonServiceStopLock, L as resolveDaemonControlPlaneEndpoint, R as resolveDaemonServiceRuntimeMetadata, U as withDaemonServiceReconcileLock, V as setDaemonServiceRuntimeState, W as withDaemonServiceRegistrationMutationLock, a as DAEMON_SERVICE_RUNTIME_MODE_ENV, c as acquireDaemonServiceLifecycleLock, d as daemonLifecycleJournalPath, g as daemonRuntimeStateRootPath, i as DAEMON_SERVICE_RUNTIME_DETACHED_ENV, j as isDaemonServiceRuntimeHeartbeatStale, k as getDaemonStatus, l as clearDaemonServiceRuntimeState, m as daemonRuntimeRootPath, o as DAEMON_SERVICE_RUNTIME_STATE_SCHEMA, u as daemonDispatchJournalPath, x as daemonServiceRepairJournalPath } from "./daemon-state-BwIoDq7_.js";
|
|
19
|
-
import { S as resolveDaemonServiceManager, _ as readDaemonServiceJobCrashExitCode, a as disableDaemonServiceAutostartIfConfigured, c as getDaemonSystemServiceLogPath, f as isDaemonServiceJobSpawnPending, o as formatDaemonServiceJobDiagnosticsEvidence, s as getDaemonServiceLaunchdLabel } from "./daemon-service-manager-BVipiZwK.js";
|
|
25
|
+
import { a as buildOpenMeldProfileIdentityRequestHeadersWithAuth, c as buildRequestAuthHeaders, f as buildOpenMeldRequestContextFromProfileIdentity, i as AuthRequestCredentialError, l as canAttachAuthTokenToRequest, n as fetchSpaceRequestWithTimeout, o as buildOpenMeldProfileRequestHeadersWithAuth, p as deriveAuthBaseUrlFromGatewayUrl, s as buildOpenMeldRequestContextHeadersWithAuth, t as createCliApiClientFoundation, u as fingerprintRequestAuthorization } from "./api-client-foundation-DSurenul.js";
|
|
20
26
|
import { createHash, randomUUID } from "node:crypto";
|
|
21
|
-
import { homedir, loadavg } from "node:os";
|
|
27
|
+
import { homedir, loadavg, tmpdir } from "node:os";
|
|
22
28
|
import { basename, delimiter, dirname, extname, isAbsolute, join, relative, resolve, sep } from "node:path";
|
|
23
|
-
import { access, appendFile, chmod, link, mkdir, open, readFile, readdir, realpath, rename, rm, stat, unlink, writeFile } from "node:fs/promises";
|
|
29
|
+
import { access, appendFile, chmod, link, mkdir, mkdtemp, open, readFile, readdir, realpath, rename, rm, stat, unlink, writeFile } from "node:fs/promises";
|
|
24
30
|
import * as z$1 from "zod/v4";
|
|
25
31
|
import { z } from "zod/v4";
|
|
26
32
|
import { accessSync, appendFileSync, chmodSync, constants, createReadStream, existsSync, mkdirSync, readFileSync, readSync, renameSync, watch, writeFileSync } from "node:fs";
|
|
27
33
|
import process$1 from "node:process";
|
|
28
34
|
import { execFile, spawn } from "node:child_process";
|
|
29
35
|
import { setTimeout as setTimeout$1 } from "node:timers/promises";
|
|
30
|
-
import pc from "picocolors";
|
|
31
36
|
import { isDeepStrictEqual } from "node:util";
|
|
32
37
|
import { createServer } from "node:net";
|
|
38
|
+
import pc from "picocolors";
|
|
33
39
|
import { forkSession } from "@anthropic-ai/claude-agent-sdk";
|
|
34
40
|
import { createOpencodeClient } from "@opencode-ai/sdk/v2";
|
|
35
41
|
import { cancel, confirm, isCancel, select } from "@clack/prompts";
|
|
@@ -37,6 +43,10 @@ import stringWidth from "string-width";
|
|
|
37
43
|
import { Worker } from "node:worker_threads";
|
|
38
44
|
import { createInterface } from "node:readline";
|
|
39
45
|
import WebSocket from "ws";
|
|
46
|
+
//#region ../../packages/schemas/dist/schemas/daemon/service-connection-correlation.js
|
|
47
|
+
const SERVICE_CONNECTION_ID_QUERY_PARAMETER = "connectionId";
|
|
48
|
+
z$1.uuid();
|
|
49
|
+
//#endregion
|
|
40
50
|
//#region ../../packages/schemas/dist/schemas/cli/daemon-status-server-requirement.js
|
|
41
51
|
const cliVersionVerdictKindSchema = z$1.enum([
|
|
42
52
|
"aligned",
|
|
@@ -272,6 +282,7 @@ const cliJsonDaemonStatusEnvelopeSchema = defineSuccessEnvelope("daemon.status",
|
|
|
272
282
|
runtimeFlavor: z$1.enum(["binary", "node-bundle"]).optional(),
|
|
273
283
|
serverRequirement: daemonStatusServerRequirementSchema.optional()
|
|
274
284
|
});
|
|
285
|
+
const cliJsonServiceControlCapabilitiesEnvelopeSchema = defineSuccessEnvelope("service.control_capabilities", serviceControlCapabilitiesSchema.shape);
|
|
275
286
|
const cliJsonDaemonStopEnvelopeSchema = defineSuccessEnvelope("daemon.stop", {});
|
|
276
287
|
const cliJsonDaemonAutostartEnvelopeSchema = defineSuccessEnvelope("daemon.autostart", {
|
|
277
288
|
action: z$1.enum(["enable", "disable"]),
|
|
@@ -493,6 +504,7 @@ const cliJsonOutputEnvelopeSchema = z$1.discriminatedUnion("type", [
|
|
|
493
504
|
cliJsonDaemonUninstallEnvelopeSchema,
|
|
494
505
|
cliJsonDaemonReinstallEnvelopeSchema,
|
|
495
506
|
cliJsonDaemonStatusEnvelopeSchema,
|
|
507
|
+
cliJsonServiceControlCapabilitiesEnvelopeSchema,
|
|
496
508
|
cliJsonDaemonStopEnvelopeSchema,
|
|
497
509
|
cliJsonDaemonAutostartEnvelopeSchema,
|
|
498
510
|
cliJsonAgentsDetectEnvelopeSchema,
|
|
@@ -590,59 +602,6 @@ const runtimeReportingHealthStateSchema = z$1.strictObject({
|
|
|
590
602
|
providerConversationProof: runtimeReportingChannelHealthSchema
|
|
591
603
|
});
|
|
592
604
|
//#endregion
|
|
593
|
-
//#region ../../packages/schemas/dist/schemas/http/auth-device-authorization.js
|
|
594
|
-
const BETTER_AUTH_DEVICE_AUTHORIZATION_GRANT_TYPE = "urn:ietf:params:oauth:grant-type:device_code";
|
|
595
|
-
const betterAuthDeviceAuthorizationCodeRequestSchema = z$1.object({
|
|
596
|
-
client_id: z$1.string().min(1),
|
|
597
|
-
scope: z$1.string().optional(),
|
|
598
|
-
user_id: z$1.string().optional()
|
|
599
|
-
});
|
|
600
|
-
const betterAuthDeviceAuthorizationCodeResponseSchema = z$1.object({
|
|
601
|
-
device_code: z$1.string().min(1),
|
|
602
|
-
user_code: z$1.string().min(1),
|
|
603
|
-
verification_uri: z$1.string().min(1),
|
|
604
|
-
verification_uri_complete: z$1.string().min(1),
|
|
605
|
-
expires_in: z$1.number().finite().positive(),
|
|
606
|
-
interval: z$1.number().finite().positive()
|
|
607
|
-
});
|
|
608
|
-
const betterAuthDeviceAuthorizationStatusSchema = z$1.enum([
|
|
609
|
-
"pending",
|
|
610
|
-
"approved",
|
|
611
|
-
"denied"
|
|
612
|
-
]);
|
|
613
|
-
z$1.object({
|
|
614
|
-
user_code: z$1.string().min(1),
|
|
615
|
-
status: betterAuthDeviceAuthorizationStatusSchema
|
|
616
|
-
});
|
|
617
|
-
z$1.object({ userCode: z$1.string().min(1) });
|
|
618
|
-
z$1.object({ success: z$1.boolean() });
|
|
619
|
-
const betterAuthDeviceAuthorizationTokenRequestSchema = z$1.object({
|
|
620
|
-
grant_type: z$1.literal(BETTER_AUTH_DEVICE_AUTHORIZATION_GRANT_TYPE),
|
|
621
|
-
device_code: z$1.string().min(1),
|
|
622
|
-
client_id: z$1.string().min(1)
|
|
623
|
-
});
|
|
624
|
-
const betterAuthDeviceAuthorizationTokenResponseSchema = z$1.object({
|
|
625
|
-
access_token: z$1.string().min(1),
|
|
626
|
-
token_type: z$1.string().min(1),
|
|
627
|
-
expires_in: z$1.number().finite().positive(),
|
|
628
|
-
scope: z$1.string()
|
|
629
|
-
});
|
|
630
|
-
const betterAuthDeviceAuthorizationErrorResponseSchema = z$1.object({
|
|
631
|
-
error: z$1.string().optional(),
|
|
632
|
-
error_description: z$1.string().optional(),
|
|
633
|
-
message: z$1.string().optional(),
|
|
634
|
-
detail: z$1.string().optional()
|
|
635
|
-
});
|
|
636
|
-
const betterAuthSessionUserSnapshotSchema = z$1.object({
|
|
637
|
-
id: z$1.string().optional(),
|
|
638
|
-
email: z$1.string().optional(),
|
|
639
|
-
name: z$1.string().optional()
|
|
640
|
-
});
|
|
641
|
-
const betterAuthSessionSnapshotResponseSchema = z$1.nullable(z$1.object({
|
|
642
|
-
session: z$1.unknown().optional(),
|
|
643
|
-
user: betterAuthSessionUserSnapshotSchema.nullable()
|
|
644
|
-
}));
|
|
645
|
-
//#endregion
|
|
646
605
|
//#region ../../packages/schemas/dist/schemas/runtime/agent-controller-session.js
|
|
647
606
|
const agentControllerSessionTitleSchema = z$1.string().trim().min(1).max(120);
|
|
648
607
|
//#endregion
|
|
@@ -7171,6 +7130,18 @@ const MAX_UPGRADE_REJECTION_BODY_BYTES = 2048;
|
|
|
7171
7130
|
const UPGRADE_REJECTION_BODY_READ_TIMEOUT_MS = 1e3;
|
|
7172
7131
|
const OPENMELD_REQUEST_ID_HEADER = "x-openmeld-request-id";
|
|
7173
7132
|
const CLOUDFLARE_RAY_HEADER = "cf-ray";
|
|
7133
|
+
var WebSocketConnectionError = class extends Error {
|
|
7134
|
+
kind;
|
|
7135
|
+
status;
|
|
7136
|
+
requestId;
|
|
7137
|
+
constructor(message, kind, status, requestId) {
|
|
7138
|
+
super(message);
|
|
7139
|
+
this.name = "WebSocketConnectionError";
|
|
7140
|
+
this.kind = kind;
|
|
7141
|
+
this.status = status;
|
|
7142
|
+
this.requestId = requestId;
|
|
7143
|
+
}
|
|
7144
|
+
};
|
|
7174
7145
|
async function connectWebSocket(url, input) {
|
|
7175
7146
|
return await new Promise((resolve, reject) => {
|
|
7176
7147
|
let settled = false;
|
|
@@ -7180,7 +7151,7 @@ async function connectWebSocket(url, input) {
|
|
|
7180
7151
|
if (settled) return;
|
|
7181
7152
|
settled = true;
|
|
7182
7153
|
ws.terminate();
|
|
7183
|
-
reject(
|
|
7154
|
+
reject(new WebSocketConnectionError(`websocket open timeout after ${openTimeoutMs}ms`, "open_timeout"));
|
|
7184
7155
|
}, openTimeoutMs);
|
|
7185
7156
|
const closePromise = new Promise((r) => {
|
|
7186
7157
|
ws.on("close", () => r());
|
|
@@ -7190,7 +7161,7 @@ async function connectWebSocket(url, input) {
|
|
|
7190
7161
|
if (settled) return;
|
|
7191
7162
|
settled = true;
|
|
7192
7163
|
if (openTimeout) clearTimeout(openTimeout);
|
|
7193
|
-
reject(
|
|
7164
|
+
reject(new WebSocketConnectionError(`websocket closed before open (code=${String(code)}, reason=${reason.toString("utf8")})`, "closed_before_open"));
|
|
7194
7165
|
});
|
|
7195
7166
|
if (!isBunRuntime()) ws.on("unexpected-response", (_request, response) => {
|
|
7196
7167
|
if (settled) return;
|
|
@@ -7244,14 +7215,13 @@ async function buildWebSocketUpgradeRejectedError(response) {
|
|
|
7244
7215
|
const body = await readBodyExcerpt(response);
|
|
7245
7216
|
const requestId = readHeaderValue(response, OPENMELD_REQUEST_ID_HEADER) ?? readRequestIdFromJsonBody(body.excerpt);
|
|
7246
7217
|
const cfRay = readHeaderValue(response, CLOUDFLARE_RAY_HEADER);
|
|
7247
|
-
|
|
7218
|
+
return new WebSocketConnectionError(`daemon stream upgrade rejected (${[
|
|
7248
7219
|
`status=${String(response.statusCode ?? "unknown")}`,
|
|
7249
7220
|
...response.statusMessage ? [`statusText=${JSON.stringify(response.statusMessage)}`] : [],
|
|
7250
7221
|
...requestId ? [`requestId=${JSON.stringify(requestId)}`] : [],
|
|
7251
7222
|
...cfRay ? [`cfRay=${JSON.stringify(cfRay)}`] : [],
|
|
7252
7223
|
...body.excerpt ? [`bodyExcerpt=${JSON.stringify(body.excerpt)}${body.truncated ? " bodyTruncated=true" : ""}`] : []
|
|
7253
|
-
];
|
|
7254
|
-
return /* @__PURE__ */ new Error(`daemon stream upgrade rejected (${fields.join(", ")})`);
|
|
7224
|
+
].join(", ")})`, "upgrade_rejected", response.statusCode, requestId ?? void 0);
|
|
7255
7225
|
}
|
|
7256
7226
|
function readBodyExcerpt(response) {
|
|
7257
7227
|
return new Promise((resolve) => {
|
|
@@ -7778,6 +7748,7 @@ function resolveControlPlaneErrorCode(error) {
|
|
|
7778
7748
|
const DAEMON_DISPATCH_EVENT_TYPES = [
|
|
7779
7749
|
"dispatch.deliver.received",
|
|
7780
7750
|
"dispatch.local.phase",
|
|
7751
|
+
"dispatch.reply_reconsideration",
|
|
7781
7752
|
"dispatch.lifecycle.sent",
|
|
7782
7753
|
"dispatch.lifecycle.send_failed",
|
|
7783
7754
|
"dispatch.result.queued",
|
|
@@ -12831,6 +12802,275 @@ function collectErrorMessages(error) {
|
|
|
12831
12802
|
return [...new Set(messages)];
|
|
12832
12803
|
}
|
|
12833
12804
|
//#endregion
|
|
12805
|
+
//#region src/local-service/lifecycle/service-connection-evidence.ts
|
|
12806
|
+
const LOCAL_RETENTION_MS = 10080 * 6e4;
|
|
12807
|
+
const MAX_JOURNAL_BYTES = 1024 * 1024;
|
|
12808
|
+
const MAX_PENDING_EVENT_WRITES = 128;
|
|
12809
|
+
function createServiceConnectionEvidenceRecorder(input) {
|
|
12810
|
+
const ownerKey = createHash("sha256").update(input.ownerUserId).digest("hex");
|
|
12811
|
+
const path = join(daemonRuntimeStateRootPath(), `connection-evidence-${ownerKey}.json`);
|
|
12812
|
+
const send = input.sendIncident ?? createServiceConnectionEvidenceApi(createCliApiClientFoundation(input.gatewayUrl, { expectedOwnerUserId: input.ownerUserId })).report;
|
|
12813
|
+
let journal = null;
|
|
12814
|
+
let writes = Promise.resolve();
|
|
12815
|
+
let prelude = [];
|
|
12816
|
+
let online = false;
|
|
12817
|
+
let disposed = false;
|
|
12818
|
+
let uploading = false;
|
|
12819
|
+
let failureCount = 0;
|
|
12820
|
+
let uploadTimer = null;
|
|
12821
|
+
let pendingEventWrites = 0;
|
|
12822
|
+
const truncatedRecoveryIds = /* @__PURE__ */ new Set();
|
|
12823
|
+
let writeFailureReported = false;
|
|
12824
|
+
function mutate(update) {
|
|
12825
|
+
writes = writes.then(async () => {
|
|
12826
|
+
journal ??= await readDaemonLocalStateFile({
|
|
12827
|
+
path,
|
|
12828
|
+
schema: serviceConnectionEvidenceJournalSchema
|
|
12829
|
+
}) ?? {
|
|
12830
|
+
v: 1,
|
|
12831
|
+
entries: []
|
|
12832
|
+
};
|
|
12833
|
+
update(journal);
|
|
12834
|
+
journal.entries = journal.entries.filter((entry) => entry.incident.endedAtMs >= Date.now() - LOCAL_RETENTION_MS);
|
|
12835
|
+
while (journal.entries.length > 32 || Buffer.byteLength(JSON.stringify(journal, null, 2), "utf8") + 1 > MAX_JOURNAL_BYTES) journal.entries.shift();
|
|
12836
|
+
await writeDaemonLocalStateFile({
|
|
12837
|
+
path,
|
|
12838
|
+
value: journal,
|
|
12839
|
+
schema: serviceConnectionEvidenceJournalSchema,
|
|
12840
|
+
mode: 384
|
|
12841
|
+
});
|
|
12842
|
+
writeFailureReported = false;
|
|
12843
|
+
}).catch(() => {
|
|
12844
|
+
if (!writeFailureReported) {
|
|
12845
|
+
writeFailureReported = true;
|
|
12846
|
+
console.warn("[openmeld:connection-evidence] Local connection history could not be saved.");
|
|
12847
|
+
}
|
|
12848
|
+
});
|
|
12849
|
+
return writes;
|
|
12850
|
+
}
|
|
12851
|
+
function scheduleUpload(delayMs = 0) {
|
|
12852
|
+
if (disposed || !online || uploading || uploadTimer) return;
|
|
12853
|
+
uploadTimer = setTimeout(() => {
|
|
12854
|
+
uploadTimer = null;
|
|
12855
|
+
uploadPending().catch(() => void 0);
|
|
12856
|
+
}, delayMs);
|
|
12857
|
+
uploadTimer.unref();
|
|
12858
|
+
}
|
|
12859
|
+
async function uploadPending() {
|
|
12860
|
+
if (!online || disposed || uploading) return;
|
|
12861
|
+
uploading = true;
|
|
12862
|
+
try {
|
|
12863
|
+
await mutate(() => void 0);
|
|
12864
|
+
const entry = journal?.entries.find((item) => item.uploadedAtMs === null && (item.incident.outcome === "recovered" || item.incident.serviceSessionId !== input.identity.serviceSessionId));
|
|
12865
|
+
if (!entry) return;
|
|
12866
|
+
const receipt = await send({
|
|
12867
|
+
uploaderServiceSessionId: input.identity.serviceSessionId,
|
|
12868
|
+
incident: entry.incident
|
|
12869
|
+
});
|
|
12870
|
+
if (receipt.incidentId !== entry.incident.incidentId) throw new Error("connection_incident_receipt_mismatch");
|
|
12871
|
+
await mutate((state) => {
|
|
12872
|
+
const saved = state.entries.find((item) => item.incident.incidentId === receipt.incidentId);
|
|
12873
|
+
if (saved) saved.uploadedAtMs = receipt.receivedAtMs;
|
|
12874
|
+
});
|
|
12875
|
+
failureCount = 0;
|
|
12876
|
+
} catch {
|
|
12877
|
+
failureCount += 1;
|
|
12878
|
+
} finally {
|
|
12879
|
+
uploading = false;
|
|
12880
|
+
if (journal?.entries.some((item) => item.uploadedAtMs === null && (item.incident.outcome === "recovered" || item.incident.serviceSessionId !== input.identity.serviceSessionId))) scheduleUpload(failureCount ? Math.min(15 * 6e4, 3e4 * 2 ** Math.min(failureCount - 1, 5)) : 1e3);
|
|
12881
|
+
}
|
|
12882
|
+
}
|
|
12883
|
+
function record(inputEvent) {
|
|
12884
|
+
if (disposed) return;
|
|
12885
|
+
const parsed = serviceConnectionEvidenceEventSchema.safeParse(inputEvent.event);
|
|
12886
|
+
if (!parsed.success) return;
|
|
12887
|
+
const event = parsed.data;
|
|
12888
|
+
if (!inputEvent.recovery) {
|
|
12889
|
+
prelude = [...prelude, event].filter((item) => item.lastAtMs >= event.lastAtMs - 5 * 6e4).slice(-10);
|
|
12890
|
+
return;
|
|
12891
|
+
}
|
|
12892
|
+
const recovery = inputEvent.recovery;
|
|
12893
|
+
if (pendingEventWrites >= MAX_PENDING_EVENT_WRITES) {
|
|
12894
|
+
if (truncatedRecoveryIds.size < 32) truncatedRecoveryIds.add(recovery.recoveryId);
|
|
12895
|
+
return;
|
|
12896
|
+
}
|
|
12897
|
+
const precedingEvents = prelude;
|
|
12898
|
+
prelude = [];
|
|
12899
|
+
pendingEventWrites += 1;
|
|
12900
|
+
mutate((state) => {
|
|
12901
|
+
let entry = state.entries.find((item) => item.incident.incidentId === recovery.recoveryId);
|
|
12902
|
+
if (!entry) {
|
|
12903
|
+
entry = {
|
|
12904
|
+
uploadedAtMs: null,
|
|
12905
|
+
incident: {
|
|
12906
|
+
v: 1,
|
|
12907
|
+
...input.identity,
|
|
12908
|
+
incidentId: recovery.recoveryId,
|
|
12909
|
+
startedAtMs: recovery.disconnectedAt,
|
|
12910
|
+
endedAtMs: Math.max(recovery.disconnectedAt, event.lastAtMs),
|
|
12911
|
+
outcome: "interrupted",
|
|
12912
|
+
evidenceTruncated: false,
|
|
12913
|
+
events: precedingEvents
|
|
12914
|
+
}
|
|
12915
|
+
};
|
|
12916
|
+
state.entries.push(entry);
|
|
12917
|
+
}
|
|
12918
|
+
const incident = entry.incident;
|
|
12919
|
+
if (truncatedRecoveryIds.delete(recovery.recoveryId)) incident.evidenceTruncated = true;
|
|
12920
|
+
appendEvent(incident, event);
|
|
12921
|
+
incident.endedAtMs = Math.max(incident.endedAtMs, event.lastAtMs);
|
|
12922
|
+
if (event.kind === "registered" && event.reason === "recovered") incident.outcome = "recovered";
|
|
12923
|
+
}).then(() => scheduleUpload()).finally(() => {
|
|
12924
|
+
pendingEventWrites -= 1;
|
|
12925
|
+
}).catch(() => void 0);
|
|
12926
|
+
}
|
|
12927
|
+
return {
|
|
12928
|
+
record,
|
|
12929
|
+
setOnline(value) {
|
|
12930
|
+
if (online === value) return;
|
|
12931
|
+
online = value;
|
|
12932
|
+
if (uploadTimer) {
|
|
12933
|
+
clearTimeout(uploadTimer);
|
|
12934
|
+
uploadTimer = null;
|
|
12935
|
+
}
|
|
12936
|
+
if (value) scheduleUpload();
|
|
12937
|
+
},
|
|
12938
|
+
flush: () => writes,
|
|
12939
|
+
dispose() {
|
|
12940
|
+
disposed = true;
|
|
12941
|
+
online = false;
|
|
12942
|
+
if (uploadTimer) {
|
|
12943
|
+
clearTimeout(uploadTimer);
|
|
12944
|
+
uploadTimer = null;
|
|
12945
|
+
}
|
|
12946
|
+
}
|
|
12947
|
+
};
|
|
12948
|
+
}
|
|
12949
|
+
function appendEvent(incident, event) {
|
|
12950
|
+
const previous = incident.events.at(-1);
|
|
12951
|
+
if (previous && previous.kind === event.kind && previous.reason === event.reason && previous.phase === event.phase && previous.connectionId === event.connectionId && previous.nativeErrorCode === event.nativeErrorCode && previous.closeCode === event.closeCode) incident.events[incident.events.length - 1] = {
|
|
12952
|
+
...event,
|
|
12953
|
+
firstAtMs: previous.firstAtMs,
|
|
12954
|
+
count: Math.min(1e7, previous.count + event.count)
|
|
12955
|
+
};
|
|
12956
|
+
else incident.events.push(event);
|
|
12957
|
+
if (incident.events.length > 100) {
|
|
12958
|
+
incident.events.splice(10, incident.events.length - 100);
|
|
12959
|
+
incident.evidenceTruncated = true;
|
|
12960
|
+
}
|
|
12961
|
+
}
|
|
12962
|
+
function readServiceConnectionFailureEvidence(error) {
|
|
12963
|
+
const code = typeof error === "object" && error !== null && "code" in error ? error.code : void 0;
|
|
12964
|
+
const nativeCode = serviceConnectionEvidenceEventSchema.shape.nativeErrorCode.safeParse(code);
|
|
12965
|
+
const requestId = serviceConnectionEvidenceEventSchema.shape.requestId.safeParse(error instanceof WebSocketConnectionError ? error.requestId : void 0);
|
|
12966
|
+
let reason = "unknown";
|
|
12967
|
+
if (error instanceof WebSocketConnectionError) {
|
|
12968
|
+
if (error.kind === "open_timeout") reason = "open_timeout";
|
|
12969
|
+
else if (error.kind === "closed_before_open") reason = "socket_closed";
|
|
12970
|
+
else if (error.status === 401) reason = "auth_rejected";
|
|
12971
|
+
}
|
|
12972
|
+
return {
|
|
12973
|
+
reason,
|
|
12974
|
+
...nativeCode.success && nativeCode.data ? { nativeErrorCode: nativeCode.data } : {},
|
|
12975
|
+
...requestId.success && requestId.data ? { requestId: requestId.data } : {}
|
|
12976
|
+
};
|
|
12977
|
+
}
|
|
12978
|
+
//#endregion
|
|
12979
|
+
//#region src/local-service/lifecycle/service-connection-evidence-observer.ts
|
|
12980
|
+
function createServiceConnectionEvidenceObserver(input) {
|
|
12981
|
+
const recorder = createServiceConnectionEvidenceRecorder(input);
|
|
12982
|
+
let connectionId = randomUUID();
|
|
12983
|
+
let phase = "credentials";
|
|
12984
|
+
let lastHeartbeatAckAtMs;
|
|
12985
|
+
let attemptStartedAtMs = Date.now();
|
|
12986
|
+
let retryDueAtMs;
|
|
12987
|
+
const record = (event) => {
|
|
12988
|
+
const atMs = Date.now();
|
|
12989
|
+
recorder.record({
|
|
12990
|
+
recovery: input.getRecovery(),
|
|
12991
|
+
event: {
|
|
12992
|
+
...event,
|
|
12993
|
+
connectionId,
|
|
12994
|
+
phase,
|
|
12995
|
+
firstAtMs: atMs,
|
|
12996
|
+
lastAtMs: atMs,
|
|
12997
|
+
count: 1,
|
|
12998
|
+
...lastHeartbeatAckAtMs === void 0 ? {} : { lastHeartbeatAckAtMs }
|
|
12999
|
+
}
|
|
13000
|
+
});
|
|
13001
|
+
};
|
|
13002
|
+
return {
|
|
13003
|
+
get connectionDiagnosticId() {
|
|
13004
|
+
return connectionId;
|
|
13005
|
+
},
|
|
13006
|
+
beginAttempt() {
|
|
13007
|
+
connectionId = randomUUID();
|
|
13008
|
+
phase = "credentials";
|
|
13009
|
+
attemptStartedAtMs = Date.now();
|
|
13010
|
+
record({
|
|
13011
|
+
kind: "connecting",
|
|
13012
|
+
reason: "unknown",
|
|
13013
|
+
...retryDueAtMs === void 0 ? {} : { eventLoopDelayMs: Math.max(0, attemptStartedAtMs - retryDueAtMs) }
|
|
13014
|
+
});
|
|
13015
|
+
retryDueAtMs = void 0;
|
|
13016
|
+
},
|
|
13017
|
+
opening() {
|
|
13018
|
+
phase = "opening";
|
|
13019
|
+
},
|
|
13020
|
+
opened(socket) {
|
|
13021
|
+
phase = "registering";
|
|
13022
|
+
record({
|
|
13023
|
+
kind: "transport_open",
|
|
13024
|
+
reason: "unknown"
|
|
13025
|
+
});
|
|
13026
|
+
const openedId = connectionId;
|
|
13027
|
+
socket.onClose((closeCode) => {
|
|
13028
|
+
if (openedId === connectionId) record({
|
|
13029
|
+
kind: "disconnected",
|
|
13030
|
+
reason: input.isStopping() ? "stopped" : "socket_closed",
|
|
13031
|
+
closeCode
|
|
13032
|
+
});
|
|
13033
|
+
});
|
|
13034
|
+
},
|
|
13035
|
+
acknowledged(heartbeatAt, transitioned) {
|
|
13036
|
+
const timestamp = Date.parse(heartbeatAt);
|
|
13037
|
+
if (Number.isFinite(timestamp)) lastHeartbeatAckAtMs = timestamp;
|
|
13038
|
+
phase = "online";
|
|
13039
|
+
if (transitioned) record({
|
|
13040
|
+
kind: "registered",
|
|
13041
|
+
reason: "recovered",
|
|
13042
|
+
durationMs: Math.max(0, Date.now() - (input.getRecovery()?.disconnectedAt ?? attemptStartedAtMs))
|
|
13043
|
+
});
|
|
13044
|
+
recorder.setOnline(true);
|
|
13045
|
+
},
|
|
13046
|
+
retry(error, connectionReason, backoffMs) {
|
|
13047
|
+
recorder.setOnline(false);
|
|
13048
|
+
const evidence = readServiceConnectionFailureEvidence(error);
|
|
13049
|
+
const reason = connectionReason === "auth_unavailable" || connectionReason === "auth_rejected" ? connectionReason : evidence.reason;
|
|
13050
|
+
record({
|
|
13051
|
+
kind: "disconnected",
|
|
13052
|
+
...evidence,
|
|
13053
|
+
reason,
|
|
13054
|
+
durationMs: Math.max(0, Date.now() - attemptStartedAtMs)
|
|
13055
|
+
});
|
|
13056
|
+
phase = "waiting";
|
|
13057
|
+
retryDueAtMs = Date.now() + backoffMs;
|
|
13058
|
+
record({
|
|
13059
|
+
kind: "retry_scheduled",
|
|
13060
|
+
reason,
|
|
13061
|
+
retryAtMs: retryDueAtMs
|
|
13062
|
+
});
|
|
13063
|
+
},
|
|
13064
|
+
credential(reason) {
|
|
13065
|
+
record({
|
|
13066
|
+
kind: "credential_cache",
|
|
13067
|
+
reason
|
|
13068
|
+
});
|
|
13069
|
+
},
|
|
13070
|
+
dispose: recorder.dispose
|
|
13071
|
+
};
|
|
13072
|
+
}
|
|
13073
|
+
//#endregion
|
|
12834
13074
|
//#region src/agents/controller-version-channel.ts
|
|
12835
13075
|
const LATEST_VERSION_TIMEOUT_MS = 4e3;
|
|
12836
13076
|
const LATEST_VERSION_CACHE_TTL_MS = 3600 * 1e3;
|
|
@@ -13415,12 +13655,13 @@ async function probeOpenCodeReadiness(input) {
|
|
|
13415
13655
|
let server = null;
|
|
13416
13656
|
try {
|
|
13417
13657
|
server = await startOpenCodeProbeServer({
|
|
13658
|
+
workingDirectory: input.workingDirectory,
|
|
13418
13659
|
launchContract: input.launchContract,
|
|
13419
13660
|
timeoutMs: input.timeoutMs ?? DEFAULT_PROBE_TIMEOUT_MS
|
|
13420
13661
|
});
|
|
13421
13662
|
const providerListResult = await rejectAfterTimeout(createOpencodeClient({
|
|
13422
13663
|
baseUrl: server.url,
|
|
13423
|
-
directory:
|
|
13664
|
+
directory: input.workingDirectory,
|
|
13424
13665
|
throwOnError: true
|
|
13425
13666
|
}).provider.list(), SDK_READ_TIMEOUT_MS, `Timed out while reading OpenCode provider status after ${SDK_READ_TIMEOUT_MS}ms.`);
|
|
13426
13667
|
const readiness = resolveOpenCodeReadinessFromProviderList(providerListResult.data);
|
|
@@ -13510,7 +13751,7 @@ async function startOpenCodeProbeServer(input) {
|
|
|
13510
13751
|
});
|
|
13511
13752
|
return new Promise((resolve, reject) => {
|
|
13512
13753
|
const child = spawn(invocation.bin, invocation.args, {
|
|
13513
|
-
cwd:
|
|
13754
|
+
cwd: input.workingDirectory,
|
|
13514
13755
|
detached: process.platform !== "win32",
|
|
13515
13756
|
env: process.env,
|
|
13516
13757
|
shell: invocation.shell ?? false,
|
|
@@ -13758,6 +13999,19 @@ function toErrorMessage$5(error) {
|
|
|
13758
13999
|
return message.length > 0 ? message : "unknown error";
|
|
13759
14000
|
}
|
|
13760
14001
|
//#endregion
|
|
14002
|
+
//#region src/local-service/inventory/probe-working-directory.ts
|
|
14003
|
+
async function withProbeWorkingDirectory(probe) {
|
|
14004
|
+
const workingDirectory = await mkdtemp(join(tmpdir(), "openmeld-inventory-"));
|
|
14005
|
+
try {
|
|
14006
|
+
return await probe(await realpath(workingDirectory));
|
|
14007
|
+
} finally {
|
|
14008
|
+
await rm(workingDirectory, {
|
|
14009
|
+
force: true,
|
|
14010
|
+
recursive: true
|
|
14011
|
+
});
|
|
14012
|
+
}
|
|
14013
|
+
}
|
|
14014
|
+
//#endregion
|
|
13761
14015
|
//#region src/local-service/inventory/runtime-provider-usage-limits.ts
|
|
13762
14016
|
async function recordRuntimeProviderUsageLimits(input) {
|
|
13763
14017
|
const commandPath = resolveLaunchContractCommandPath(input.launchContract);
|
|
@@ -13798,11 +14052,12 @@ const CONTROLLER_INTERFACE_SNAPSHOT_RESOLVERS = {
|
|
|
13798
14052
|
};
|
|
13799
14053
|
async function probeAgentControllerUsageObservationAuth(input) {
|
|
13800
14054
|
if (input.agentId !== "claude-code") return { status: "unknown" };
|
|
13801
|
-
return resolveClaudeAuthSnapshot(await runLaunchContractCommand({
|
|
14055
|
+
return resolveClaudeAuthSnapshot(await withProbeWorkingDirectory((workingDirectory) => runLaunchContractCommand({
|
|
14056
|
+
workingDirectory,
|
|
13802
14057
|
allowNonZeroExit: true,
|
|
13803
14058
|
args: ["auth", "status"],
|
|
13804
14059
|
launchContract: input.launchContract
|
|
13805
|
-
}));
|
|
14060
|
+
})));
|
|
13806
14061
|
}
|
|
13807
14062
|
async function resolveAgentControllerInterfaceSnapshot(input) {
|
|
13808
14063
|
const checkedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
@@ -13866,10 +14121,12 @@ async function resolveAgentControllerInterfaceSnapshot(input) {
|
|
|
13866
14121
|
});
|
|
13867
14122
|
if (reusableSnapshot) return reusableSnapshot;
|
|
13868
14123
|
}
|
|
13869
|
-
const
|
|
14124
|
+
const launchContract = input.state.launchContract;
|
|
14125
|
+
const outcome = await withProbeWorkingDirectory((workingDirectory) => snapshotResolver({
|
|
13870
14126
|
baseSnapshot,
|
|
13871
|
-
launchContract
|
|
13872
|
-
|
|
14127
|
+
launchContract,
|
|
14128
|
+
workingDirectory
|
|
14129
|
+
}));
|
|
13873
14130
|
const commandFingerprintAfterProbe = await resolveAgentControllerCommandFingerprint({
|
|
13874
14131
|
commandPath,
|
|
13875
14132
|
launchContractKind
|
|
@@ -14077,7 +14334,7 @@ function parseSemverCore(value) {
|
|
|
14077
14334
|
];
|
|
14078
14335
|
}
|
|
14079
14336
|
async function resolveCodexInterfaceSnapshot(input) {
|
|
14080
|
-
const appServerProbe = await probeCodexAppServer(input.launchContract);
|
|
14337
|
+
const appServerProbe = await probeCodexAppServer(input.launchContract, input.workingDirectory);
|
|
14081
14338
|
if (appServerProbe.ok) {
|
|
14082
14339
|
const version = appServerProbe.version ?? input.baseSnapshot.version;
|
|
14083
14340
|
return {
|
|
@@ -14101,6 +14358,7 @@ async function resolveCodexInterfaceSnapshot(input) {
|
|
|
14101
14358
|
};
|
|
14102
14359
|
}
|
|
14103
14360
|
const versionProbe = await runLaunchContractCommand({
|
|
14361
|
+
workingDirectory: input.workingDirectory,
|
|
14104
14362
|
args: ["--version"],
|
|
14105
14363
|
launchContract: input.launchContract
|
|
14106
14364
|
});
|
|
@@ -14123,9 +14381,11 @@ async function resolveCodexInterfaceSnapshot(input) {
|
|
|
14123
14381
|
}
|
|
14124
14382
|
async function resolveClaudeCodeInterfaceSnapshot(input) {
|
|
14125
14383
|
const [versionProbe, authProbe] = await Promise.all([runLaunchContractCommand({
|
|
14384
|
+
workingDirectory: input.workingDirectory,
|
|
14126
14385
|
args: ["--version"],
|
|
14127
14386
|
launchContract: input.launchContract
|
|
14128
14387
|
}), runLaunchContractCommand({
|
|
14388
|
+
workingDirectory: input.workingDirectory,
|
|
14129
14389
|
allowNonZeroExit: true,
|
|
14130
14390
|
args: [
|
|
14131
14391
|
"auth",
|
|
@@ -14164,9 +14424,11 @@ async function resolveClaudeCodeInterfaceSnapshot(input) {
|
|
|
14164
14424
|
}
|
|
14165
14425
|
async function resolveCursorInterfaceSnapshot(input) {
|
|
14166
14426
|
const [versionProbe, authProbe] = await Promise.all([runLaunchContractCommand({
|
|
14427
|
+
workingDirectory: input.workingDirectory,
|
|
14167
14428
|
args: ["--version"],
|
|
14168
14429
|
launchContract: input.launchContract
|
|
14169
14430
|
}), runLaunchContractCommand({
|
|
14431
|
+
workingDirectory: input.workingDirectory,
|
|
14170
14432
|
allowNonZeroExit: true,
|
|
14171
14433
|
args: [
|
|
14172
14434
|
"status",
|
|
@@ -14205,11 +14467,12 @@ async function resolveCursorInterfaceSnapshot(input) {
|
|
|
14205
14467
|
}
|
|
14206
14468
|
async function resolveGrokBuildInterfaceSnapshot(input) {
|
|
14207
14469
|
const [versionProbe, interfaceProbe] = await Promise.all([runLaunchContractCommand({
|
|
14470
|
+
workingDirectory: input.workingDirectory,
|
|
14208
14471
|
args: ["--no-auto-update", "version"],
|
|
14209
14472
|
launchContract: input.launchContract
|
|
14210
14473
|
}), probeGrokBuildAcpInterface({
|
|
14211
14474
|
grokBuildTimeoutMs: PROBE_TIMEOUT_MS,
|
|
14212
|
-
grokBuildWorkdir:
|
|
14475
|
+
grokBuildWorkdir: input.workingDirectory,
|
|
14213
14476
|
launchContract: input.launchContract
|
|
14214
14477
|
}).then((result) => ({
|
|
14215
14478
|
ok: true,
|
|
@@ -14261,9 +14524,11 @@ async function resolveGrokBuildInterfaceSnapshot(input) {
|
|
|
14261
14524
|
}
|
|
14262
14525
|
async function resolveOpenClawInterfaceSnapshot(input) {
|
|
14263
14526
|
const [versionProbe, authProbe] = await Promise.all([runLaunchContractCommand({
|
|
14527
|
+
workingDirectory: input.workingDirectory,
|
|
14264
14528
|
args: ["--version"],
|
|
14265
14529
|
launchContract: input.launchContract
|
|
14266
14530
|
}), runLaunchContractCommand({
|
|
14531
|
+
workingDirectory: input.workingDirectory,
|
|
14267
14532
|
allowNonZeroExit: true,
|
|
14268
14533
|
args: [
|
|
14269
14534
|
"models",
|
|
@@ -14294,9 +14559,11 @@ async function resolveOpenClawInterfaceSnapshot(input) {
|
|
|
14294
14559
|
}
|
|
14295
14560
|
async function resolveOpenCodeInterfaceSnapshot(input) {
|
|
14296
14561
|
const [versionProbe, readinessProbe] = await Promise.all([runLaunchContractCommand({
|
|
14562
|
+
workingDirectory: input.workingDirectory,
|
|
14297
14563
|
args: ["--version"],
|
|
14298
14564
|
launchContract: input.launchContract
|
|
14299
14565
|
}), probeOpenCodeReadiness({
|
|
14566
|
+
workingDirectory: input.workingDirectory,
|
|
14300
14567
|
launchContract: input.launchContract,
|
|
14301
14568
|
timeoutMs: PROBE_TIMEOUT_MS
|
|
14302
14569
|
})]);
|
|
@@ -14326,6 +14593,7 @@ function runLaunchContractCommand(input) {
|
|
|
14326
14593
|
launchContract: input.launchContract
|
|
14327
14594
|
});
|
|
14328
14595
|
return runCommand({
|
|
14596
|
+
workingDirectory: input.workingDirectory,
|
|
14329
14597
|
allowNonZeroExit: input.allowNonZeroExit,
|
|
14330
14598
|
args: invocation.args,
|
|
14331
14599
|
bin: invocation.bin,
|
|
@@ -14336,7 +14604,7 @@ function runLaunchContractCommand(input) {
|
|
|
14336
14604
|
function runCommand(input) {
|
|
14337
14605
|
return new Promise((resolve) => {
|
|
14338
14606
|
const child = spawn(input.bin, input.args, {
|
|
14339
|
-
cwd:
|
|
14607
|
+
cwd: input.workingDirectory,
|
|
14340
14608
|
env: process.env,
|
|
14341
14609
|
shell: input.shell ?? false,
|
|
14342
14610
|
stdio: [
|
|
@@ -14402,7 +14670,7 @@ function runCommand(input) {
|
|
|
14402
14670
|
});
|
|
14403
14671
|
});
|
|
14404
14672
|
}
|
|
14405
|
-
function probeCodexAppServer(launchContract) {
|
|
14673
|
+
function probeCodexAppServer(launchContract, workingDirectory) {
|
|
14406
14674
|
const invocation = buildCliLaunchInvocation({
|
|
14407
14675
|
args: [
|
|
14408
14676
|
"app-server",
|
|
@@ -14413,7 +14681,7 @@ function probeCodexAppServer(launchContract) {
|
|
|
14413
14681
|
});
|
|
14414
14682
|
return new Promise((resolve) => {
|
|
14415
14683
|
const child = spawn(invocation.bin, invocation.args, {
|
|
14416
|
-
cwd:
|
|
14684
|
+
cwd: workingDirectory,
|
|
14417
14685
|
env: process.env,
|
|
14418
14686
|
shell: invocation.shell ?? false,
|
|
14419
14687
|
stdio: [
|
|
@@ -14504,6 +14772,7 @@ function probeCodexAppServer(launchContract) {
|
|
|
14504
14772
|
});
|
|
14505
14773
|
});
|
|
14506
14774
|
runCodexAppServerProbeRequests({
|
|
14775
|
+
workingDirectory,
|
|
14507
14776
|
clearProbeTimeout: () => {
|
|
14508
14777
|
clearTimeout(timeout);
|
|
14509
14778
|
},
|
|
@@ -14528,7 +14797,7 @@ async function runCodexAppServerProbeRequests(input) {
|
|
|
14528
14797
|
}
|
|
14529
14798
|
});
|
|
14530
14799
|
input.notify("initialized", {});
|
|
14531
|
-
const skillsPromise = input.request("skills/list", { cwds: [
|
|
14800
|
+
const skillsPromise = input.request("skills/list", { cwds: [input.workingDirectory] }).catch(() => null);
|
|
14532
14801
|
const modelsPromise = requestAllCodexModels(input.request).catch(() => []);
|
|
14533
14802
|
const usageLimitsPromise = input.request("account/rateLimits/read", null).then((response) => projectCodexUsageLimits({
|
|
14534
14803
|
observedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
@@ -14979,8 +15248,7 @@ async function submitRuntimeAgentControllerReports(input) {
|
|
|
14979
15248
|
failure: {
|
|
14980
15249
|
authenticationRejected: false,
|
|
14981
15250
|
message: "OpenMeld Service contract is unavailable.",
|
|
14982
|
-
reasonCode: "runtime.reporting.service_contract_unavailable"
|
|
14983
|
-
requiresCarrierHandshake: false
|
|
15251
|
+
reasonCode: "runtime.reporting.service_contract_unavailable"
|
|
14984
15252
|
},
|
|
14985
15253
|
onAttempt: input.onAttempt,
|
|
14986
15254
|
submissions: unavailableSubmissions({
|
|
@@ -14991,13 +15259,12 @@ async function submitRuntimeAgentControllerReports(input) {
|
|
|
14991
15259
|
});
|
|
14992
15260
|
const authCompatibility = await resolveRuntimeReportingAuthCompatibility(serviceContract.gatewayUrl);
|
|
14993
15261
|
if (authCompatibility.status === "unavailable") {
|
|
14994
|
-
const reasonCode = `runtime.reporting.auth_${authCompatibility.authState}`;
|
|
15262
|
+
const reasonCode = `runtime.reporting.${authCompatibility.reasonCode ?? `auth_${authCompatibility.authState}`}`;
|
|
14995
15263
|
return await finishRuntimeAgentControllerReportingAttempt({
|
|
14996
15264
|
failure: {
|
|
14997
15265
|
authenticationRejected: false,
|
|
14998
15266
|
message: `Local authentication is ${authCompatibility.authState}.`,
|
|
14999
|
-
reasonCode
|
|
15000
|
-
requiresCarrierHandshake: authCompatibility.authState !== "error"
|
|
15267
|
+
reasonCode
|
|
15001
15268
|
},
|
|
15002
15269
|
onAttempt: input.onAttempt,
|
|
15003
15270
|
submissions: failedSubmissions({
|
|
@@ -15012,8 +15279,7 @@ async function submitRuntimeAgentControllerReports(input) {
|
|
|
15012
15279
|
failure: {
|
|
15013
15280
|
authenticationRejected: false,
|
|
15014
15281
|
message: "The local authentication session does not match the reporting Gateway.",
|
|
15015
|
-
reasonCode: "runtime.reporting.auth_gateway_mismatch"
|
|
15016
|
-
requiresCarrierHandshake: false
|
|
15282
|
+
reasonCode: "runtime.reporting.auth_gateway_mismatch"
|
|
15017
15283
|
},
|
|
15018
15284
|
onAttempt: input.onAttempt,
|
|
15019
15285
|
submissions: failedSubmissions({
|
|
@@ -15025,8 +15291,11 @@ async function submitRuntimeAgentControllerReports(input) {
|
|
|
15025
15291
|
reasonCode: "runtime.reporting.auth_gateway_mismatch"
|
|
15026
15292
|
})
|
|
15027
15293
|
});
|
|
15294
|
+
let credentialFingerprint;
|
|
15028
15295
|
try {
|
|
15029
|
-
const api = createRuntimeReportingApi(createCliApiClientFoundation(serviceContract.gatewayUrl)
|
|
15296
|
+
const api = createRuntimeReportingApi(createCliApiClientFoundation(serviceContract.gatewayUrl, { onAuthHeadersResolved: (headers) => {
|
|
15297
|
+
credentialFingerprint = headers.Authorization ? fingerprintRequestAuthorization(headers.Authorization) : void 0;
|
|
15298
|
+
} }));
|
|
15030
15299
|
const registration = await api.submitRegistration({
|
|
15031
15300
|
deviceId: serviceContract.deviceId,
|
|
15032
15301
|
lane: serviceContract.lane
|
|
@@ -15037,8 +15306,7 @@ async function submitRuntimeAgentControllerReports(input) {
|
|
|
15037
15306
|
failure: {
|
|
15038
15307
|
authenticationRejected: false,
|
|
15039
15308
|
message: `Runtime registration was rejected: ${registration.reason ?? "rejected"}.`,
|
|
15040
|
-
reasonCode
|
|
15041
|
-
requiresCarrierHandshake: false
|
|
15309
|
+
reasonCode
|
|
15042
15310
|
},
|
|
15043
15311
|
onAttempt: input.onAttempt,
|
|
15044
15312
|
submissions: failedSubmissions({
|
|
@@ -15075,6 +15343,7 @@ async function submitRuntimeAgentControllerReports(input) {
|
|
|
15075
15343
|
});
|
|
15076
15344
|
} catch (error) {
|
|
15077
15345
|
const failure = resolveRuntimeReportingWriteFailure({
|
|
15346
|
+
credentialFingerprint,
|
|
15078
15347
|
error,
|
|
15079
15348
|
reasonCodePrefix: "runtime.reporting"
|
|
15080
15349
|
});
|
|
@@ -15104,8 +15373,7 @@ async function submitRuntimeProviderConversationProofs(input) {
|
|
|
15104
15373
|
failure: {
|
|
15105
15374
|
authenticationRejected: false,
|
|
15106
15375
|
message: "OpenMeld Service contract is unavailable.",
|
|
15107
|
-
reasonCode
|
|
15108
|
-
requiresCarrierHandshake: false
|
|
15376
|
+
reasonCode
|
|
15109
15377
|
},
|
|
15110
15378
|
onAttempt: input.onAttempt,
|
|
15111
15379
|
submissions: unavailableProviderConversationProofSubmissions({
|
|
@@ -15117,13 +15385,12 @@ async function submitRuntimeProviderConversationProofs(input) {
|
|
|
15117
15385
|
}
|
|
15118
15386
|
const authCompatibility = await resolveRuntimeReportingAuthCompatibility(serviceContract.gatewayUrl);
|
|
15119
15387
|
if (authCompatibility.status === "unavailable") {
|
|
15120
|
-
const reasonCode = `provider_conversation.runtime_reporting.auth_${authCompatibility.authState}`;
|
|
15388
|
+
const reasonCode = `provider_conversation.runtime_reporting.${authCompatibility.reasonCode ?? `auth_${authCompatibility.authState}`}`;
|
|
15121
15389
|
return await finishProviderConversationProofReportingAttempt({
|
|
15122
15390
|
failure: {
|
|
15123
15391
|
authenticationRejected: false,
|
|
15124
15392
|
message: `Local authentication is ${authCompatibility.authState}.`,
|
|
15125
|
-
reasonCode
|
|
15126
|
-
requiresCarrierHandshake: authCompatibility.authState !== "error"
|
|
15393
|
+
reasonCode
|
|
15127
15394
|
},
|
|
15128
15395
|
onAttempt: input.onAttempt,
|
|
15129
15396
|
submissions: failedProviderConversationProofSubmissions({
|
|
@@ -15140,8 +15407,7 @@ async function submitRuntimeProviderConversationProofs(input) {
|
|
|
15140
15407
|
failure: {
|
|
15141
15408
|
authenticationRejected: false,
|
|
15142
15409
|
message: "The local authentication session does not match the reporting Gateway.",
|
|
15143
|
-
reasonCode
|
|
15144
|
-
requiresCarrierHandshake: false
|
|
15410
|
+
reasonCode
|
|
15145
15411
|
},
|
|
15146
15412
|
onAttempt: input.onAttempt,
|
|
15147
15413
|
submissions: failedProviderConversationProofSubmissions({
|
|
@@ -15154,8 +15420,11 @@ async function submitRuntimeProviderConversationProofs(input) {
|
|
|
15154
15420
|
})
|
|
15155
15421
|
});
|
|
15156
15422
|
}
|
|
15423
|
+
let credentialFingerprint;
|
|
15157
15424
|
try {
|
|
15158
|
-
const api = createRuntimeReportingApi(createCliApiClientFoundation(serviceContract.gatewayUrl)
|
|
15425
|
+
const api = createRuntimeReportingApi(createCliApiClientFoundation(serviceContract.gatewayUrl, { onAuthHeadersResolved: (headers) => {
|
|
15426
|
+
credentialFingerprint = headers.Authorization ? fingerprintRequestAuthorization(headers.Authorization) : void 0;
|
|
15427
|
+
} }));
|
|
15159
15428
|
const registration = await api.submitRegistration({
|
|
15160
15429
|
deviceId: serviceContract.deviceId,
|
|
15161
15430
|
lane: serviceContract.lane
|
|
@@ -15166,8 +15435,7 @@ async function submitRuntimeProviderConversationProofs(input) {
|
|
|
15166
15435
|
failure: {
|
|
15167
15436
|
authenticationRejected: false,
|
|
15168
15437
|
message: `Runtime registration was rejected: ${registration.reason ?? "rejected"}.`,
|
|
15169
|
-
reasonCode
|
|
15170
|
-
requiresCarrierHandshake: false
|
|
15438
|
+
reasonCode
|
|
15171
15439
|
},
|
|
15172
15440
|
onAttempt: input.onAttempt,
|
|
15173
15441
|
submissions: failedProviderConversationProofSubmissions({
|
|
@@ -15196,6 +15464,7 @@ async function submitRuntimeProviderConversationProofs(input) {
|
|
|
15196
15464
|
});
|
|
15197
15465
|
} catch (error) {
|
|
15198
15466
|
const failure = resolveRuntimeReportingWriteFailure({
|
|
15467
|
+
credentialFingerprint,
|
|
15199
15468
|
error,
|
|
15200
15469
|
reasonCodePrefix: "provider_conversation.runtime_reporting"
|
|
15201
15470
|
});
|
|
@@ -15223,11 +15492,11 @@ async function finishRuntimeAgentControllerReportingAttempt(input) {
|
|
|
15223
15492
|
reasonCodes: failedSubmission.reasonCodes
|
|
15224
15493
|
}) : null);
|
|
15225
15494
|
await notifyRuntimeReportingAttemptObserver(input.onAttempt, {
|
|
15495
|
+
...failure?.credentialFingerprint ? { credentialFingerprint: failure.credentialFingerprint } : {},
|
|
15226
15496
|
authenticationRejected: failure?.authenticationRejected ?? false,
|
|
15227
15497
|
family: "runtime_agent_controller",
|
|
15228
15498
|
message: failure?.message ?? null,
|
|
15229
15499
|
reasonCode: failure?.reasonCode ?? null,
|
|
15230
|
-
requiresCarrierHandshake: failure?.requiresCarrierHandshake ?? false,
|
|
15231
15500
|
status: failure ? "failed" : "succeeded"
|
|
15232
15501
|
});
|
|
15233
15502
|
return input.submissions;
|
|
@@ -15239,11 +15508,11 @@ async function finishProviderConversationProofReportingAttempt(input) {
|
|
|
15239
15508
|
reasonCodes: failedSubmission.reasonCodes
|
|
15240
15509
|
}) : null);
|
|
15241
15510
|
await notifyRuntimeReportingAttemptObserver(input.onAttempt, {
|
|
15511
|
+
...failure?.credentialFingerprint ? { credentialFingerprint: failure.credentialFingerprint } : {},
|
|
15242
15512
|
authenticationRejected: failure?.authenticationRejected ?? false,
|
|
15243
15513
|
family: "provider_conversation_proof",
|
|
15244
15514
|
message: failure?.message ?? null,
|
|
15245
15515
|
reasonCode: failure?.reasonCode ?? null,
|
|
15246
|
-
requiresCarrierHandshake: failure?.requiresCarrierHandshake ?? false,
|
|
15247
15516
|
status: failure ? "failed" : "succeeded"
|
|
15248
15517
|
});
|
|
15249
15518
|
return input.submissions;
|
|
@@ -15253,22 +15522,21 @@ function buildSubmissionFailure(input) {
|
|
|
15253
15522
|
return {
|
|
15254
15523
|
authenticationRejected: false,
|
|
15255
15524
|
message: `Runtime reporting failed: ${reasonCode}.`,
|
|
15256
|
-
reasonCode
|
|
15257
|
-
requiresCarrierHandshake: false
|
|
15525
|
+
reasonCode
|
|
15258
15526
|
};
|
|
15259
15527
|
}
|
|
15260
15528
|
function resolveRuntimeReportingWriteFailure(input) {
|
|
15261
15529
|
const failure = toStructuredApiClientFailure(input.error);
|
|
15262
|
-
const authenticationRejected = failure.status === 401 || failure.code === "auth.unauthenticated"
|
|
15530
|
+
const authenticationRejected = failure.status === 401 || failure.status === null && failure.code === "auth.unauthenticated";
|
|
15263
15531
|
return {
|
|
15532
|
+
...authenticationRejected && input.credentialFingerprint ? { credentialFingerprint: input.credentialFingerprint } : {},
|
|
15264
15533
|
authenticationRejected,
|
|
15265
15534
|
message: resolveSafeRuntimeReportingFailureMessage({
|
|
15266
15535
|
authenticationRejected,
|
|
15267
15536
|
message: failure.message,
|
|
15268
15537
|
status: failure.status
|
|
15269
15538
|
}),
|
|
15270
|
-
reasonCode: `${input.reasonCodePrefix}.${authenticationRejected ? "authentication_required" : "write_failed"}
|
|
15271
|
-
requiresCarrierHandshake: false
|
|
15539
|
+
reasonCode: `${input.reasonCodePrefix}.${authenticationRejected ? "authentication_required" : "write_failed"}`
|
|
15272
15540
|
};
|
|
15273
15541
|
}
|
|
15274
15542
|
function resolveSafeRuntimeReportingFailureMessage(input) {
|
|
@@ -15290,7 +15558,6 @@ async function notifyRuntimeReportingAttemptObserver(observer, attempt) {
|
|
|
15290
15558
|
event: "cli.runtime_reporting.attempt_observer_failed",
|
|
15291
15559
|
family: attempt.family,
|
|
15292
15560
|
reasonCode: attempt.reasonCode,
|
|
15293
|
-
requiresCarrierHandshake: attempt.requiresCarrierHandshake,
|
|
15294
15561
|
status: attempt.status
|
|
15295
15562
|
});
|
|
15296
15563
|
}
|
|
@@ -15513,12 +15780,13 @@ function failedProviderConversationProofSubmissions(input) {
|
|
|
15513
15780
|
}));
|
|
15514
15781
|
}
|
|
15515
15782
|
async function resolveRuntimeReportingAuthCompatibility(gatewayUrl) {
|
|
15516
|
-
const authState = await getAuthSessionState().catch(() => null);
|
|
15783
|
+
const authState = await getAuthSessionState({ refreshExpired: true }).catch(() => null);
|
|
15517
15784
|
if (!authState) return {
|
|
15518
15785
|
authState: "error",
|
|
15519
15786
|
status: "unavailable"
|
|
15520
15787
|
};
|
|
15521
15788
|
if (!(authState.state === "valid" && authState.session)) return {
|
|
15789
|
+
reasonCode: authState.reasonCode,
|
|
15522
15790
|
authState: authState.state === "expired" || authState.state === "invalid" ? authState.state : "missing",
|
|
15523
15791
|
status: "unavailable"
|
|
15524
15792
|
};
|
|
@@ -15599,7 +15867,6 @@ async function syncLocalServiceRuntimeAgentControllerReports(input) {
|
|
|
15599
15867
|
family: "runtime_agent_controller",
|
|
15600
15868
|
message: "Local agent inventory collection failed.",
|
|
15601
15869
|
reasonCode: "runtime.reporting.inventory_failed",
|
|
15602
|
-
requiresCarrierHandshake: false,
|
|
15603
15870
|
status: "failed"
|
|
15604
15871
|
});
|
|
15605
15872
|
throw error;
|
|
@@ -15621,7 +15888,6 @@ async function syncLocalServiceRuntimeAgentControllerReports(input) {
|
|
|
15621
15888
|
family: "runtime_agent_controller",
|
|
15622
15889
|
message: "No local controllers are installed on this computer.",
|
|
15623
15890
|
reasonCode: "runtime.agent_controller_report.no_local_controllers",
|
|
15624
|
-
requiresCarrierHandshake: false,
|
|
15625
15891
|
status: "not_applicable"
|
|
15626
15892
|
});
|
|
15627
15893
|
return {
|
|
@@ -15775,7 +16041,8 @@ function isSameServiceIdentity(left, right) {
|
|
|
15775
16041
|
function createRuntimeReportingAttemptObserver(input) {
|
|
15776
16042
|
return async (attempt) => {
|
|
15777
16043
|
await persistRuntimeReportingAttempt(attempt, input.serviceIdentity);
|
|
15778
|
-
if (attempt.status === "failed" &&
|
|
16044
|
+
if (attempt.status === "failed" && attempt.authenticationRejected && attempt.reasonCode && attempt.message) await input.onAuthenticationFailure?.({
|
|
16045
|
+
...attempt.credentialFingerprint ? { credentialFingerprint: attempt.credentialFingerprint } : {},
|
|
15779
16046
|
message: attempt.message,
|
|
15780
16047
|
reasonCode: attempt.reasonCode
|
|
15781
16048
|
});
|
|
@@ -16019,7 +16286,6 @@ function classifyConnectionFailureReason(message) {
|
|
|
16019
16286
|
const lowered = message.toLowerCase();
|
|
16020
16287
|
const upgradeRejectionStatus = readDaemonStreamUpgradeRejectionStatus(lowered);
|
|
16021
16288
|
if (upgradeRejectionStatus !== null) return upgradeRejectionStatus === 401 ? "auth_rejected" : "internal";
|
|
16022
|
-
if (lowered.includes("authentication required") || lowered.includes("unauthorized")) return "auth_rejected";
|
|
16023
16289
|
if (lowered.includes("fetch failed") || lowered.includes("timed out") || lowered.includes("timeout") || lowered.includes("econn") || lowered.includes("enotfound") || lowered.includes("socket") || lowered.includes("network")) return "network_unreachable";
|
|
16024
16290
|
return "internal";
|
|
16025
16291
|
}
|
|
@@ -16398,355 +16664,6 @@ function createDaemonLocalExecutionSlots(input) {
|
|
|
16398
16664
|
});
|
|
16399
16665
|
}
|
|
16400
16666
|
//#endregion
|
|
16401
|
-
//#region src/local-service/status/service-participation-status.ts
|
|
16402
|
-
async function resolveDaemonServiceParticipationStatus(input) {
|
|
16403
|
-
const expectedVersion = input?.expectedVersion ?? await resolveCurrentDaemonExpectedVersion();
|
|
16404
|
-
const inventory = await inspectDaemonServiceInventory({ expectedVersion });
|
|
16405
|
-
if (!(inventory.installStatus.installed && inventory.installStatus.state)) return {
|
|
16406
|
-
kind: "missing",
|
|
16407
|
-
expectedVersion
|
|
16408
|
-
};
|
|
16409
|
-
const installedVersion = inventory.installStatus.state.daemonVersion;
|
|
16410
|
-
const wakeability = classifyDaemonServiceWakeability({ inventory });
|
|
16411
|
-
const blockingServiceDriftCodes = wakeability.blockingCodes;
|
|
16412
|
-
const runBlockingServiceDriftCodes = classifyDaemonServiceRunStartability({ inventory }).blockingCodes;
|
|
16413
|
-
const repairAnomalies = inventory.anomalies.filter((anomaly) => [...blockingServiceDriftCodes, ...runBlockingServiceDriftCodes].includes(anomaly.code));
|
|
16414
|
-
if (repairAnomalies.length > 0) return {
|
|
16415
|
-
kind: "needs_repair",
|
|
16416
|
-
expectedVersion,
|
|
16417
|
-
installedVersion,
|
|
16418
|
-
runtimeStatus: inventory.runtimeStatus.status,
|
|
16419
|
-
detail: repairAnomalies[0]?.message ?? "OpenMeld found conflicting local service state on this device.",
|
|
16420
|
-
anomalyCodes: inventory.anomalies.map((anomaly) => anomaly.code)
|
|
16421
|
-
};
|
|
16422
|
-
if (inventory.runtimeStatus.status !== "running") return {
|
|
16423
|
-
kind: "not_running",
|
|
16424
|
-
expectedVersion,
|
|
16425
|
-
installedVersion,
|
|
16426
|
-
runtimeStatus: inventory.runtimeStatus.status
|
|
16427
|
-
};
|
|
16428
|
-
return {
|
|
16429
|
-
kind: "ready",
|
|
16430
|
-
expectedVersion,
|
|
16431
|
-
installedVersion,
|
|
16432
|
-
runtimeStatus: inventory.runtimeStatus.status,
|
|
16433
|
-
advisoryAnomalyCodes: wakeability.advisoryCodes
|
|
16434
|
-
};
|
|
16435
|
-
}
|
|
16436
|
-
//#endregion
|
|
16437
|
-
//#region src/local-components/manifest.ts
|
|
16438
|
-
const OPENMELD_CLI_COMMAND_CONTRACT_VERSION = "openmeld-cli-command-contract-2026-09-large-space-files-v1";
|
|
16439
|
-
const OPENMELD_SKILLS_CONTRACT_VERSION = "openmeld-skills-contract-2026-09-explicit-space-recipients-v1";
|
|
16440
|
-
const OPENMELD_SERVICE_CONTRACT_VERSION = "openmeld-service-contract-2026-09-space-access-and-large-files-v1";
|
|
16441
|
-
const LOCAL_COMPONENTS_SNAPSHOT_FILE = "local-components.json";
|
|
16442
|
-
const SERVICE_COMPONENT_UPDATE_CODES = /* @__PURE__ */ new Set([
|
|
16443
|
-
"version_outdated",
|
|
16444
|
-
"downgrade_blocked",
|
|
16445
|
-
"runtime_contract_missing",
|
|
16446
|
-
"runtime_contract_mismatch",
|
|
16447
|
-
"runtime_contract_unavailable",
|
|
16448
|
-
"bundle_missing",
|
|
16449
|
-
"bundle_content_drift",
|
|
16450
|
-
"bundle_id_drift",
|
|
16451
|
-
"bundle_version_drift",
|
|
16452
|
-
"bundle_lane_drift",
|
|
16453
|
-
"bundle_strategy_legacy",
|
|
16454
|
-
"bundle_provenance_drift",
|
|
16455
|
-
"bundle_path_invalid"
|
|
16456
|
-
]);
|
|
16457
|
-
function localComponentsSnapshotPath() {
|
|
16458
|
-
return join(openMeldRootDir(), LOCAL_COMPONENTS_SNAPSHOT_FILE);
|
|
16459
|
-
}
|
|
16460
|
-
async function buildExpectedLocalComponentsManifest() {
|
|
16461
|
-
const skills = await resolveExpectedSkillsManifest();
|
|
16462
|
-
return {
|
|
16463
|
-
schemaVersion: 1,
|
|
16464
|
-
openMeldReleaseVersion: OPENMELD_VERSION,
|
|
16465
|
-
cli: {
|
|
16466
|
-
packageVersion: OPENMELD_VERSION,
|
|
16467
|
-
commandContractVersion: OPENMELD_CLI_COMMAND_CONTRACT_VERSION
|
|
16468
|
-
},
|
|
16469
|
-
service: {
|
|
16470
|
-
bundleHash: null,
|
|
16471
|
-
bundleVersion: await resolveCurrentDaemonExpectedVersion(),
|
|
16472
|
-
runtimeContractEpoch: CURRENT_DAEMON_EXECUTION_CONTRACT_EPOCH,
|
|
16473
|
-
serviceContractVersion: OPENMELD_SERVICE_CONTRACT_VERSION
|
|
16474
|
-
},
|
|
16475
|
-
skills
|
|
16476
|
-
};
|
|
16477
|
-
}
|
|
16478
|
-
async function readInstalledLocalComponentsSnapshot() {
|
|
16479
|
-
const raw = await readFile(localComponentsSnapshotPath(), "utf8").catch(() => null);
|
|
16480
|
-
if (!raw) return null;
|
|
16481
|
-
const parsed = JSON.parse(raw);
|
|
16482
|
-
const result = installedLocalComponentsSnapshotSchema.safeParse(parsed);
|
|
16483
|
-
return result.success ? result.data : null;
|
|
16484
|
-
}
|
|
16485
|
-
async function writeInstalledLocalComponentsSnapshot(input) {
|
|
16486
|
-
const snapshot = {
|
|
16487
|
-
schemaVersion: 1,
|
|
16488
|
-
installedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
16489
|
-
source: input.source,
|
|
16490
|
-
manifest: await buildExpectedLocalComponentsManifest()
|
|
16491
|
-
};
|
|
16492
|
-
const installed = isBinaryDistribution() ? await readManagedCliInstallation() : null;
|
|
16493
|
-
if (installed && installed.version !== OPENMELD_VERSION) {
|
|
16494
|
-
const previous = await readInstalledLocalComponentsSnapshot();
|
|
16495
|
-
if (previous?.manifest.cli.packageVersion === installed.version) snapshot.manifest.cli = previous.manifest.cli;
|
|
16496
|
-
}
|
|
16497
|
-
const snapshotPath = localComponentsSnapshotPath();
|
|
16498
|
-
await mkdir(dirname(snapshotPath), { recursive: true });
|
|
16499
|
-
const temporaryPath = `${snapshotPath}.${crypto.randomUUID()}.tmp`;
|
|
16500
|
-
try {
|
|
16501
|
-
await writeFile(temporaryPath, `${JSON.stringify(snapshot, null, 2)}\n`);
|
|
16502
|
-
await rename(temporaryPath, snapshotPath);
|
|
16503
|
-
} finally {
|
|
16504
|
-
await rm(temporaryPath, { force: true });
|
|
16505
|
-
}
|
|
16506
|
-
return snapshot;
|
|
16507
|
-
}
|
|
16508
|
-
async function resolveLocalComponentsStatus(input = {}) {
|
|
16509
|
-
const [expectedManifest, service, skills, maintenance, updateOperation] = await Promise.all([
|
|
16510
|
-
buildExpectedLocalComponentsManifest(),
|
|
16511
|
-
resolveServiceComponentState(),
|
|
16512
|
-
resolveSkillsComponentState(),
|
|
16513
|
-
resolveOpenMeldToolsMaintenanceProjection(),
|
|
16514
|
-
resolveOpenMeldToolsUpdateOperation()
|
|
16515
|
-
]);
|
|
16516
|
-
const cli = await resolveCliComponentStatus(input);
|
|
16517
|
-
const selectedSkill = await loadSelectedSkillAssets();
|
|
16518
|
-
const setupAction = resolveLocalComponentsSetupAction({
|
|
16519
|
-
cliStatus: cli.status,
|
|
16520
|
-
serviceKind: service.kind,
|
|
16521
|
-
serviceStatus: service.status,
|
|
16522
|
-
skillsStatus: skills.status
|
|
16523
|
-
});
|
|
16524
|
-
return {
|
|
16525
|
-
schemaVersion: 1,
|
|
16526
|
-
generatedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
16527
|
-
entrypoint: "setup",
|
|
16528
|
-
summaryLabel: formatLocalComponentsSummaryLabel({
|
|
16529
|
-
cliStatus: cli.status,
|
|
16530
|
-
setupAction
|
|
16531
|
-
}),
|
|
16532
|
-
summaryDescription: formatLocalComponentsSummaryDescription({
|
|
16533
|
-
cliStatus: cli.status,
|
|
16534
|
-
setupAction
|
|
16535
|
-
}),
|
|
16536
|
-
setupAction,
|
|
16537
|
-
setupActionLabel: formatLocalSetupActionLabel(setupAction),
|
|
16538
|
-
setupActionDescription: formatLocalSetupActionDescription(setupAction),
|
|
16539
|
-
maintenance,
|
|
16540
|
-
...updateOperation ? { updateOperation } : {},
|
|
16541
|
-
cli,
|
|
16542
|
-
service: {
|
|
16543
|
-
expectedBundleHash: expectedManifest.service.bundleHash,
|
|
16544
|
-
expectedBundleVersion: expectedManifest.service.bundleVersion,
|
|
16545
|
-
installedBundleHash: service.installedBundleHash,
|
|
16546
|
-
installedBundleVersion: service.installedBundleVersion,
|
|
16547
|
-
reasonCodes: service.reasonCodes,
|
|
16548
|
-
runtimeContractEpoch: expectedManifest.service.runtimeContractEpoch,
|
|
16549
|
-
serviceContractVersion: expectedManifest.service.serviceContractVersion,
|
|
16550
|
-
status: service.status
|
|
16551
|
-
},
|
|
16552
|
-
skills: {
|
|
16553
|
-
...selectedSkill.contentRelease ? { contentRelease: selectedSkill.contentRelease } : {},
|
|
16554
|
-
expectedBundleHash: expectedManifest.skills.bundleHash,
|
|
16555
|
-
installedBundleHash: skills.installedBundleHash,
|
|
16556
|
-
reasonCodes: skills.reasonCodes,
|
|
16557
|
-
skillContractVersion: expectedManifest.skills.skillContractVersion,
|
|
16558
|
-
status: skills.status,
|
|
16559
|
-
targetCount: skills.targetCount
|
|
16560
|
-
}
|
|
16561
|
-
};
|
|
16562
|
-
}
|
|
16563
|
-
function resolveLocalComponentsSetupAction(input) {
|
|
16564
|
-
if (input.cliStatus === "update_required") return "update_cli";
|
|
16565
|
-
if (input.serviceStatus === "update_required") return "update_service";
|
|
16566
|
-
if (input.skillsStatus === "update_required") return "update_skills";
|
|
16567
|
-
if (input.serviceKind === "missing") return "connect_service";
|
|
16568
|
-
if (input.serviceKind === "not_running" || input.serviceKind === "inspection_failed") return "reconnect_service";
|
|
16569
|
-
return "none";
|
|
16570
|
-
}
|
|
16571
|
-
async function resolveCliComponentStatus(input) {
|
|
16572
|
-
const installed = isBinaryDistribution() ? await readManagedCliInstallation() : null;
|
|
16573
|
-
const packageVersion = installed?.version ?? OPENMELD_VERSION;
|
|
16574
|
-
const snapshot = installed && installed.version !== OPENMELD_VERSION ? await readInstalledLocalComponentsSnapshot() : null;
|
|
16575
|
-
let commandContractVersion = OPENMELD_CLI_COMMAND_CONTRACT_VERSION;
|
|
16576
|
-
if (packageVersion !== OPENMELD_VERSION) commandContractVersion = snapshot?.manifest.cli.packageVersion === packageVersion ? snapshot.manifest.cli.commandContractVersion : "unknown";
|
|
16577
|
-
const latestPackageVersion = normalizeOptionalString$1(input.latestPackageVersion);
|
|
16578
|
-
const requiredCommandContractVersion = normalizeOptionalString$1(input.requiredCommandContractVersion);
|
|
16579
|
-
const reasonCodes = [];
|
|
16580
|
-
let status = "ok";
|
|
16581
|
-
if (commandContractVersion === "unknown" || requiredCommandContractVersion && requiredCommandContractVersion !== commandContractVersion) {
|
|
16582
|
-
status = "update_required";
|
|
16583
|
-
reasonCodes.push("cli.command_contract_mismatch");
|
|
16584
|
-
} else if (latestPackageVersion && compareSemver(packageVersion, latestPackageVersion) < 0) {
|
|
16585
|
-
status = "update_available";
|
|
16586
|
-
reasonCodes.push("cli.package_update_available");
|
|
16587
|
-
}
|
|
16588
|
-
return {
|
|
16589
|
-
commandContractVersion,
|
|
16590
|
-
latestPackageVersion,
|
|
16591
|
-
packageVersion,
|
|
16592
|
-
reasonCodes,
|
|
16593
|
-
requiredCommandContractVersion,
|
|
16594
|
-
status
|
|
16595
|
-
};
|
|
16596
|
-
}
|
|
16597
|
-
async function resolveServiceComponentState() {
|
|
16598
|
-
const expectedVersion = await resolveCurrentDaemonExpectedVersion();
|
|
16599
|
-
try {
|
|
16600
|
-
const [participation, inventory, activeBundle] = await Promise.all([
|
|
16601
|
-
resolveDaemonServiceParticipationStatus({ expectedVersion }),
|
|
16602
|
-
inspectDaemonServiceInventory({ expectedVersion }),
|
|
16603
|
-
readDaemonActiveBundleState().catch(() => null)
|
|
16604
|
-
]);
|
|
16605
|
-
const installedBundleVersion = resolveInstalledServiceVersion(participation);
|
|
16606
|
-
const serviceUpdateReasonCodes = collectServiceUpdateReasonCodes({
|
|
16607
|
-
anomalyCodes: inventory.anomalies.map((anomaly) => anomaly.code),
|
|
16608
|
-
participation
|
|
16609
|
-
});
|
|
16610
|
-
if (serviceUpdateReasonCodes.length > 0) return {
|
|
16611
|
-
installedBundleHash: resolveInstalledServiceBundleHash(activeBundle),
|
|
16612
|
-
installedBundleVersion,
|
|
16613
|
-
kind: "update_required",
|
|
16614
|
-
reasonCodes: serviceUpdateReasonCodes,
|
|
16615
|
-
status: "update_required"
|
|
16616
|
-
};
|
|
16617
|
-
if (participation.kind === "missing") return {
|
|
16618
|
-
installedBundleHash: null,
|
|
16619
|
-
installedBundleVersion: null,
|
|
16620
|
-
kind: "missing",
|
|
16621
|
-
reasonCodes: ["service.not_installed"],
|
|
16622
|
-
status: "ok"
|
|
16623
|
-
};
|
|
16624
|
-
if (participation.kind === "not_running") return {
|
|
16625
|
-
installedBundleHash: resolveInstalledServiceBundleHash(activeBundle),
|
|
16626
|
-
installedBundleVersion,
|
|
16627
|
-
kind: "not_running",
|
|
16628
|
-
reasonCodes: ["service.not_running"],
|
|
16629
|
-
status: "ok"
|
|
16630
|
-
};
|
|
16631
|
-
return {
|
|
16632
|
-
installedBundleHash: resolveInstalledServiceBundleHash(activeBundle),
|
|
16633
|
-
installedBundleVersion,
|
|
16634
|
-
kind: "ok",
|
|
16635
|
-
reasonCodes: [],
|
|
16636
|
-
status: "ok"
|
|
16637
|
-
};
|
|
16638
|
-
} catch (error) {
|
|
16639
|
-
return {
|
|
16640
|
-
installedBundleHash: null,
|
|
16641
|
-
installedBundleVersion: null,
|
|
16642
|
-
kind: "inspection_failed",
|
|
16643
|
-
reasonCodes: [`service.inspection_failed:${error instanceof Error ? error.message : "unknown"}`],
|
|
16644
|
-
status: "ok"
|
|
16645
|
-
};
|
|
16646
|
-
}
|
|
16647
|
-
}
|
|
16648
|
-
function resolveInstalledServiceBundleHash(activeBundle) {
|
|
16649
|
-
if (activeBundle?.bundleFormat === "binary_v1") return null;
|
|
16650
|
-
return activeBundle?.sourceDistFingerprint ?? null;
|
|
16651
|
-
}
|
|
16652
|
-
async function resolveSkillsComponentState() {
|
|
16653
|
-
const [installed, snapshot] = await Promise.all([resolveInstalledSkillsManifest(), collectSkillsReadinessSnapshot().catch(() => null)]);
|
|
16654
|
-
if (!snapshot) return {
|
|
16655
|
-
installedBundleHash: installed?.bundleHash ?? null,
|
|
16656
|
-
reasonCodes: ["skills.status_unavailable"],
|
|
16657
|
-
status: "update_required",
|
|
16658
|
-
targetCount: 0
|
|
16659
|
-
};
|
|
16660
|
-
if (!installed) return {
|
|
16661
|
-
installedBundleHash: null,
|
|
16662
|
-
reasonCodes: ["skills.bundle_hash_unavailable"],
|
|
16663
|
-
status: "update_required",
|
|
16664
|
-
targetCount: snapshot.targetCount
|
|
16665
|
-
};
|
|
16666
|
-
if (snapshot.status === "action_required") return {
|
|
16667
|
-
installedBundleHash: installed.bundleHash,
|
|
16668
|
-
reasonCodes: ["skills.update_required"],
|
|
16669
|
-
status: "update_required",
|
|
16670
|
-
targetCount: snapshot.targetCount
|
|
16671
|
-
};
|
|
16672
|
-
return {
|
|
16673
|
-
installedBundleHash: installed.bundleHash,
|
|
16674
|
-
reasonCodes: snapshot.status === "no_targets" ? ["skills.no_targets"] : [],
|
|
16675
|
-
status: "ok",
|
|
16676
|
-
targetCount: snapshot.targetCount
|
|
16677
|
-
};
|
|
16678
|
-
}
|
|
16679
|
-
async function resolveExpectedSkillsManifest() {
|
|
16680
|
-
return await resolveBundledSkillsManifest() ?? buildUnavailableSkillsManifest();
|
|
16681
|
-
}
|
|
16682
|
-
async function resolveInstalledSkillsManifest() {
|
|
16683
|
-
const bundled = await resolveBundledSkillsManifest();
|
|
16684
|
-
if (bundled) return bundled;
|
|
16685
|
-
const activeBundleSource = await resolveActiveBundleSourceSkillsManifest();
|
|
16686
|
-
if (activeBundleSource) return activeBundleSource;
|
|
16687
|
-
return (await readInstalledLocalComponentsSnapshot())?.manifest.skills ?? null;
|
|
16688
|
-
}
|
|
16689
|
-
async function resolveBundledSkillsManifest() {
|
|
16690
|
-
const assets = await loadSelectedSkillAssets().then((selected) => selected.assets).catch(() => null);
|
|
16691
|
-
if (!assets || assets.length === 0) return null;
|
|
16692
|
-
return {
|
|
16693
|
-
bundleHash: hashBundledSkillAssets(assets),
|
|
16694
|
-
skillContractVersion: OPENMELD_SKILLS_CONTRACT_VERSION,
|
|
16695
|
-
skillIds: ["openmeld-cli"]
|
|
16696
|
-
};
|
|
16697
|
-
}
|
|
16698
|
-
async function resolveActiveBundleSourceSkillsManifest() {
|
|
16699
|
-
const sourcePackageRootPath = normalizeOptionalString$1((await readDaemonActiveBundleState().catch(() => null))?.sourcePackageRootPath);
|
|
16700
|
-
if (!sourcePackageRootPath) return null;
|
|
16701
|
-
const skillsRootDir = join(sourcePackageRootPath, "skills");
|
|
16702
|
-
if (!await pathExists(skillsRootDir)) return null;
|
|
16703
|
-
return await buildSkillsManifestFromRoot(skillsRootDir);
|
|
16704
|
-
}
|
|
16705
|
-
async function buildSkillsManifestFromRoot(skillsRootDir) {
|
|
16706
|
-
return {
|
|
16707
|
-
bundleHash: await computeDirectoryContentHash({
|
|
16708
|
-
rootDir: skillsRootDir,
|
|
16709
|
-
ignoredNames: [".openmeld-skill.json"]
|
|
16710
|
-
}).catch(() => null),
|
|
16711
|
-
skillContractVersion: OPENMELD_SKILLS_CONTRACT_VERSION,
|
|
16712
|
-
skillIds: ["openmeld-cli"]
|
|
16713
|
-
};
|
|
16714
|
-
}
|
|
16715
|
-
function buildUnavailableSkillsManifest() {
|
|
16716
|
-
return {
|
|
16717
|
-
bundleHash: null,
|
|
16718
|
-
skillContractVersion: OPENMELD_SKILLS_CONTRACT_VERSION,
|
|
16719
|
-
skillIds: []
|
|
16720
|
-
};
|
|
16721
|
-
}
|
|
16722
|
-
async function pathExists(path) {
|
|
16723
|
-
try {
|
|
16724
|
-
await access(path);
|
|
16725
|
-
return true;
|
|
16726
|
-
} catch {
|
|
16727
|
-
return false;
|
|
16728
|
-
}
|
|
16729
|
-
}
|
|
16730
|
-
function collectServiceUpdateReasonCodes(input) {
|
|
16731
|
-
const reasonCodes = input.anomalyCodes.filter((code) => SERVICE_COMPONENT_UPDATE_CODES.has(code));
|
|
16732
|
-
if (input.participation.kind === "outdated") reasonCodes.push("version_outdated");
|
|
16733
|
-
if (input.participation.kind === "needs_repair") reasonCodes.push(...input.participation.anomalyCodes.filter((code) => SERVICE_COMPONENT_UPDATE_CODES.has(code)));
|
|
16734
|
-
return [...new Set(reasonCodes.map((code) => `service.${code}`))];
|
|
16735
|
-
}
|
|
16736
|
-
function resolveInstalledServiceVersion(participation) {
|
|
16737
|
-
switch (participation.kind) {
|
|
16738
|
-
case "ready":
|
|
16739
|
-
case "not_running":
|
|
16740
|
-
case "needs_repair":
|
|
16741
|
-
case "outdated": return participation.installedVersion;
|
|
16742
|
-
default: return null;
|
|
16743
|
-
}
|
|
16744
|
-
}
|
|
16745
|
-
function normalizeOptionalString$1(value) {
|
|
16746
|
-
const normalized = String(value ?? "").trim();
|
|
16747
|
-
return normalized.length > 0 ? normalized : null;
|
|
16748
|
-
}
|
|
16749
|
-
//#endregion
|
|
16750
16667
|
//#region src/local-service/adapters/resolve-daemon-capabilities.ts
|
|
16751
16668
|
function resolveDaemonCapabilities(input) {
|
|
16752
16669
|
const runtimeAdapters = input.localAdapterContainer.listAdapters().map((entry) => resolveRegistryRuntimeAdapterCapabilitySnapshot(entry.adapterId)).filter((entry) => entry !== null).sort((left, right) => left.adapterId.localeCompare(right.adapterId));
|
|
@@ -18386,7 +18303,6 @@ async function syncLocalServiceProviderConversationProofs(input) {
|
|
|
18386
18303
|
family: "provider_conversation_proof",
|
|
18387
18304
|
message: "Provider conversation proof collection failed.",
|
|
18388
18305
|
reasonCode: "provider_conversation.runtime_reporting.collection_failed",
|
|
18389
|
-
requiresCarrierHandshake: false,
|
|
18390
18306
|
status: "failed"
|
|
18391
18307
|
});
|
|
18392
18308
|
throw error;
|
|
@@ -18397,7 +18313,6 @@ async function syncLocalServiceProviderConversationProofs(input) {
|
|
|
18397
18313
|
family: "provider_conversation_proof",
|
|
18398
18314
|
message: null,
|
|
18399
18315
|
reasonCode: "provider_conversation.proof.no_applicable_routes",
|
|
18400
|
-
requiresCarrierHandshake: false,
|
|
18401
18316
|
status: "not_applicable"
|
|
18402
18317
|
});
|
|
18403
18318
|
return {
|
|
@@ -23321,95 +23236,116 @@ async function coordinateConcurrentAgentReply(input) {
|
|
|
23321
23236
|
},
|
|
23322
23237
|
observation,
|
|
23323
23238
|
reconsider: async (prompt, currentObservation) => {
|
|
23324
|
-
const
|
|
23325
|
-
|
|
23326
|
-
|
|
23327
|
-
|
|
23328
|
-
|
|
23329
|
-
|
|
23330
|
-
|
|
23331
|
-
|
|
23332
|
-
|
|
23333
|
-
const activeTask = input.inflightTaskControlRegistry.getTask(input.parsedTask.taskId);
|
|
23334
|
-
if (activeTask?.dispatchId !== input.parsedTask.dispatchId || activeTask.runtimeCoordinatorExecutionId !== input.parsedTask.runtimeCoordinatorExecutionId) throw new DaemonServiceRunError({
|
|
23335
|
-
code: "dispatch.agent_reply_reconsideration.execution_inactive",
|
|
23336
|
-
message: "The Wake stopped before the Agent could reconsider its reply."
|
|
23337
|
-
});
|
|
23338
|
-
if (input.dispatchSpaceActionContext) supersedeDispatchSpaceActionRecordForReconsideration({ context: input.dispatchSpaceActionContext });
|
|
23339
|
-
emitRunLine({
|
|
23340
|
-
presenter: input.presenter,
|
|
23341
|
-
code: "daemon.run.agent_reply_reconsideration_started",
|
|
23342
|
-
text: `Agent reply reconsideration started for task ${input.parsedTask.taskId}`,
|
|
23343
|
-
payload: {
|
|
23344
|
-
dispatchId: input.parsedTask.dispatchId,
|
|
23239
|
+
const reconsiderationStartedAtMs = Date.now();
|
|
23240
|
+
const recordReconsideration = (result) => emitDaemonDispatchJournalEvent({
|
|
23241
|
+
type: "dispatch.reply_reconsideration",
|
|
23242
|
+
dispatchId: input.parsedTask.dispatchId,
|
|
23243
|
+
profileId: input.parsedTask.targetProfileId,
|
|
23244
|
+
taskId: input.parsedTask.taskId,
|
|
23245
|
+
result,
|
|
23246
|
+
metadata: {
|
|
23247
|
+
reason: "new_relevant_space_signal",
|
|
23345
23248
|
newerSignalCount: currentObservation.relevantSignals.length,
|
|
23346
23249
|
observedThroughSignalId: currentObservation.observedThroughSignalId,
|
|
23347
|
-
|
|
23348
|
-
|
|
23250
|
+
triggeringSignalIds: currentObservation.relevantSignals.map((signal) => signal.id),
|
|
23251
|
+
startedAtMs: reconsiderationStartedAtMs,
|
|
23252
|
+
durationMs: Math.max(0, Date.now() - reconsiderationStartedAtMs)
|
|
23349
23253
|
}
|
|
23350
23254
|
});
|
|
23351
|
-
|
|
23352
|
-
|
|
23353
|
-
|
|
23354
|
-
|
|
23355
|
-
|
|
23356
|
-
|
|
23357
|
-
|
|
23358
|
-
|
|
23359
|
-
|
|
23360
|
-
|
|
23361
|
-
|
|
23362
|
-
|
|
23363
|
-
|
|
23364
|
-
|
|
23365
|
-
|
|
23366
|
-
|
|
23367
|
-
|
|
23368
|
-
|
|
23369
|
-
|
|
23370
|
-
|
|
23371
|
-
|
|
23372
|
-
|
|
23373
|
-
|
|
23374
|
-
|
|
23375
|
-
|
|
23376
|
-
|
|
23377
|
-
|
|
23378
|
-
|
|
23379
|
-
|
|
23380
|
-
runtimeResult
|
|
23381
|
-
|
|
23382
|
-
|
|
23383
|
-
|
|
23384
|
-
|
|
23255
|
+
recordReconsideration("started");
|
|
23256
|
+
try {
|
|
23257
|
+
const continuation = resolveStructuredActionRepairContinuation({
|
|
23258
|
+
agentControllerConversationOverride: input.agentControllerConversationOverride,
|
|
23259
|
+
runtimeResult: input.runtimeResult
|
|
23260
|
+
});
|
|
23261
|
+
if (!(continuation.contextId || continuation.agentControllerConversationOverride)) throw new DaemonServiceRunError({
|
|
23262
|
+
code: "dispatch.agent_reply_reconsideration.conversation_unavailable",
|
|
23263
|
+
message: "The Space changed, but the exact Agent conversation is unavailable for reply reconsideration."
|
|
23264
|
+
});
|
|
23265
|
+
await input.controllerTurnCompletion;
|
|
23266
|
+
const activeTask = input.inflightTaskControlRegistry.getTask(input.parsedTask.taskId);
|
|
23267
|
+
if (activeTask?.dispatchId !== input.parsedTask.dispatchId || activeTask.runtimeCoordinatorExecutionId !== input.parsedTask.runtimeCoordinatorExecutionId) throw new DaemonServiceRunError({
|
|
23268
|
+
code: "dispatch.agent_reply_reconsideration.execution_inactive",
|
|
23269
|
+
message: "The Wake stopped before the Agent could reconsider its reply."
|
|
23270
|
+
});
|
|
23271
|
+
if (input.dispatchSpaceActionContext) supersedeDispatchSpaceActionRecordForReconsideration({ context: input.dispatchSpaceActionContext });
|
|
23272
|
+
emitRunLine({
|
|
23273
|
+
presenter: input.presenter,
|
|
23274
|
+
code: "daemon.run.agent_reply_reconsideration_started",
|
|
23275
|
+
text: `Agent reply reconsideration started for task ${input.parsedTask.taskId}`,
|
|
23276
|
+
payload: {
|
|
23277
|
+
dispatchId: input.parsedTask.dispatchId,
|
|
23278
|
+
newerSignalCount: currentObservation.relevantSignals.length,
|
|
23279
|
+
observedThroughSignalId: currentObservation.observedThroughSignalId,
|
|
23280
|
+
targetProfileId: input.parsedTask.targetProfileId,
|
|
23281
|
+
taskId: input.parsedTask.taskId
|
|
23282
|
+
}
|
|
23283
|
+
});
|
|
23284
|
+
let runtimeResult = await runDispatchRuntimeExecution({
|
|
23285
|
+
agentControllerConversationOverride: continuation.agentControllerConversationOverride,
|
|
23286
|
+
computerFileAccessBoundary: input.computerFileAccessBoundary,
|
|
23287
|
+
contextId: continuation.contextId,
|
|
23288
|
+
executionMode: "repair",
|
|
23289
|
+
instructionPrompt: input.instructionPrompt ? {
|
|
23290
|
+
...input.instructionPrompt,
|
|
23291
|
+
userPrompt: prompt
|
|
23292
|
+
} : void 0,
|
|
23293
|
+
io: input.ledgerIo,
|
|
23294
|
+
ledgerPaths: input.ledgerPaths,
|
|
23295
|
+
parsedTask: input.parsedTask,
|
|
23296
|
+
prompt,
|
|
23297
|
+
routeConfig: input.routeConfig,
|
|
23298
|
+
runtimeContext: input.runtimeContext,
|
|
23299
|
+
runtimeEnvOverrides: input.runtimeEnvOverrides,
|
|
23300
|
+
runtimeControllerSupport: input.runtimeControllerSupport,
|
|
23301
|
+
streamingModeOverride: "final"
|
|
23302
|
+
});
|
|
23303
|
+
runtimeResult = await applyCliSpaceActionRecordIfPresent({
|
|
23304
|
+
dispatchSpaceActionContext: input.dispatchSpaceActionContext,
|
|
23305
|
+
parsedTask: input.parsedTask,
|
|
23306
|
+
presenter: input.presenter,
|
|
23307
|
+
runtimeResult
|
|
23308
|
+
});
|
|
23309
|
+
const reconsidered = await resolveRuntimeResultStructuredSpaceAction({
|
|
23310
|
+
...input,
|
|
23311
|
+
agentControllerConversationOverride: continuation.agentControllerConversationOverride,
|
|
23312
|
+
allowConcurrentReplyReconsideration: false,
|
|
23313
|
+
runtimeResult
|
|
23314
|
+
});
|
|
23315
|
+
if (!reconsidered.resolvedSpaceAction) {
|
|
23316
|
+
if (reconsidered.runtimeResult.resultPayload.status === "failed") return {
|
|
23317
|
+
action: void 0,
|
|
23318
|
+
value: {
|
|
23319
|
+
provenance: void 0,
|
|
23320
|
+
runtimeResult: reconsidered.runtimeResult
|
|
23321
|
+
}
|
|
23322
|
+
};
|
|
23323
|
+
throw new DaemonServiceRunError({
|
|
23324
|
+
code: "dispatch.agent_reply_reconsideration.action_missing",
|
|
23325
|
+
message: "The Agent did not return a valid Space action after reviewing newer messages."
|
|
23326
|
+
});
|
|
23327
|
+
}
|
|
23328
|
+
emitRunLine({
|
|
23329
|
+
presenter: input.presenter,
|
|
23330
|
+
code: "daemon.run.agent_reply_reconsideration_completed",
|
|
23331
|
+
text: `Agent reply reconsideration completed for task ${input.parsedTask.taskId}`,
|
|
23332
|
+
payload: {
|
|
23333
|
+
dispatchId: input.parsedTask.dispatchId,
|
|
23334
|
+
observedThroughSignalId: currentObservation.observedThroughSignalId,
|
|
23335
|
+
targetProfileId: input.parsedTask.targetProfileId,
|
|
23336
|
+
taskId: input.parsedTask.taskId
|
|
23337
|
+
}
|
|
23338
|
+
});
|
|
23339
|
+
return {
|
|
23340
|
+
action: reconsidered.resolvedSpaceAction,
|
|
23385
23341
|
value: {
|
|
23386
|
-
provenance:
|
|
23342
|
+
provenance: "controller_repair",
|
|
23387
23343
|
runtimeResult: reconsidered.runtimeResult
|
|
23388
23344
|
}
|
|
23389
23345
|
};
|
|
23390
|
-
|
|
23391
|
-
|
|
23392
|
-
message: "The Agent did not return a valid Space action after reviewing newer messages."
|
|
23393
|
-
});
|
|
23346
|
+
} finally {
|
|
23347
|
+
recordReconsideration("finished");
|
|
23394
23348
|
}
|
|
23395
|
-
emitRunLine({
|
|
23396
|
-
presenter: input.presenter,
|
|
23397
|
-
code: "daemon.run.agent_reply_reconsideration_completed",
|
|
23398
|
-
text: `Agent reply reconsideration completed for task ${input.parsedTask.taskId}`,
|
|
23399
|
-
payload: {
|
|
23400
|
-
dispatchId: input.parsedTask.dispatchId,
|
|
23401
|
-
observedThroughSignalId: currentObservation.observedThroughSignalId,
|
|
23402
|
-
targetProfileId: input.parsedTask.targetProfileId,
|
|
23403
|
-
taskId: input.parsedTask.taskId
|
|
23404
|
-
}
|
|
23405
|
-
});
|
|
23406
|
-
return {
|
|
23407
|
-
action: reconsidered.resolvedSpaceAction,
|
|
23408
|
-
value: {
|
|
23409
|
-
provenance: "controller_repair",
|
|
23410
|
-
runtimeResult: reconsidered.runtimeResult
|
|
23411
|
-
}
|
|
23412
|
-
};
|
|
23413
23349
|
},
|
|
23414
23350
|
refreshObservation: readObservation,
|
|
23415
23351
|
spaceId: input.parsedTask.spaceId
|
|
@@ -25443,7 +25379,7 @@ async function runDaemonSocketSession(input) {
|
|
|
25443
25379
|
profileId,
|
|
25444
25380
|
leaseEpoch
|
|
25445
25381
|
})).sort((left, right) => left.profileId.localeCompare(right.profileId));
|
|
25446
|
-
const localComponentsStatus =
|
|
25382
|
+
const localComponentsStatus = readSessionLocalComponentsStatus();
|
|
25447
25383
|
const heartbeatRequest = runtimeTransportHeartbeatRequestSchema.safeParse({
|
|
25448
25384
|
v: 1,
|
|
25449
25385
|
ownerUserId: input.ownerUserId,
|
|
@@ -25511,7 +25447,7 @@ async function runDaemonSocketSession(input) {
|
|
|
25511
25447
|
reason: heartbeatSchedule.reason
|
|
25512
25448
|
});
|
|
25513
25449
|
scheduleHeartbeat({
|
|
25514
|
-
delayMs: applyIntervalJitterMs({
|
|
25450
|
+
delayMs: applyIntervalJitterMs$1({
|
|
25515
25451
|
baseIntervalMs: currentHeartbeatIntervalMs,
|
|
25516
25452
|
jitterRatio: ADAPTIVE_HEARTBEAT_JITTER_RATIO,
|
|
25517
25453
|
maxIntervalMs: MAX_HEARTBEAT_INTERVAL_MS,
|
|
@@ -25637,21 +25573,15 @@ async function runDaemonSocketSession(input) {
|
|
|
25637
25573
|
};
|
|
25638
25574
|
let hasLoggedWaitingForProfiles = (input.isRouteCatalogResolved?.() ?? true) && input.routeCatalogState.profileIds.length === 0;
|
|
25639
25575
|
const serviceVersion = OPENMELD_VERSION;
|
|
25640
|
-
const
|
|
25641
|
-
|
|
25642
|
-
|
|
25643
|
-
|
|
25644
|
-
|
|
25645
|
-
|
|
25646
|
-
code: "daemon.run.local_components_status_failed",
|
|
25647
|
-
text: `local components status unavailable: ${toErrorMessage$10(error)}`
|
|
25648
|
-
});
|
|
25649
|
-
return null;
|
|
25650
|
-
}
|
|
25651
|
-
};
|
|
25576
|
+
const readSessionLocalComponentsStatus = () => input.localComponentsObservation.read(() => {
|
|
25577
|
+
if (lastHeartbeatSentAtMs !== null) scheduleHeartbeat({
|
|
25578
|
+
delayMs: 0,
|
|
25579
|
+
reason: "local_components_refreshed"
|
|
25580
|
+
});
|
|
25581
|
+
});
|
|
25652
25582
|
const registerDaemonSession = async (routeCatalog) => {
|
|
25653
25583
|
const connectionGeneration = Math.max(1, input.reconnectAttempt + 1);
|
|
25654
|
-
const localComponentsStatus =
|
|
25584
|
+
const localComponentsStatus = readSessionLocalComponentsStatus();
|
|
25655
25585
|
const registerPayload = runtimeTransportRegisterSessionRequestSchema.safeParse({
|
|
25656
25586
|
v: 1,
|
|
25657
25587
|
ownerUserId: input.ownerUserId,
|
|
@@ -26909,11 +26839,401 @@ function resolveProfileWorkspaceControlErrorCode(error) {
|
|
|
26909
26839
|
return "profile.workspace.update_failed";
|
|
26910
26840
|
}
|
|
26911
26841
|
//#endregion
|
|
26842
|
+
//#region src/local-service/status/service-participation-status.ts
|
|
26843
|
+
async function resolveDaemonServiceParticipationStatus(input) {
|
|
26844
|
+
const expectedVersion = input?.expectedVersion ?? await resolveCurrentDaemonExpectedVersion();
|
|
26845
|
+
const inventory = await inspectDaemonServiceInventory({ expectedVersion });
|
|
26846
|
+
if (!(inventory.installStatus.installed && inventory.installStatus.state)) return {
|
|
26847
|
+
kind: "missing",
|
|
26848
|
+
expectedVersion
|
|
26849
|
+
};
|
|
26850
|
+
const installedVersion = inventory.installStatus.state.daemonVersion;
|
|
26851
|
+
const wakeability = classifyDaemonServiceWakeability({ inventory });
|
|
26852
|
+
const blockingServiceDriftCodes = wakeability.blockingCodes;
|
|
26853
|
+
const runBlockingServiceDriftCodes = classifyDaemonServiceRunStartability({ inventory }).blockingCodes;
|
|
26854
|
+
const repairAnomalies = inventory.anomalies.filter((anomaly) => [...blockingServiceDriftCodes, ...runBlockingServiceDriftCodes].includes(anomaly.code));
|
|
26855
|
+
if (repairAnomalies.length > 0) return {
|
|
26856
|
+
kind: "needs_repair",
|
|
26857
|
+
expectedVersion,
|
|
26858
|
+
installedVersion,
|
|
26859
|
+
runtimeStatus: inventory.runtimeStatus.status,
|
|
26860
|
+
detail: repairAnomalies[0]?.message ?? "OpenMeld found conflicting local service state on this device.",
|
|
26861
|
+
anomalyCodes: inventory.anomalies.map((anomaly) => anomaly.code)
|
|
26862
|
+
};
|
|
26863
|
+
if (inventory.runtimeStatus.status !== "running") return {
|
|
26864
|
+
kind: "not_running",
|
|
26865
|
+
expectedVersion,
|
|
26866
|
+
installedVersion,
|
|
26867
|
+
runtimeStatus: inventory.runtimeStatus.status
|
|
26868
|
+
};
|
|
26869
|
+
return {
|
|
26870
|
+
kind: "ready",
|
|
26871
|
+
expectedVersion,
|
|
26872
|
+
installedVersion,
|
|
26873
|
+
runtimeStatus: inventory.runtimeStatus.status,
|
|
26874
|
+
advisoryAnomalyCodes: wakeability.advisoryCodes
|
|
26875
|
+
};
|
|
26876
|
+
}
|
|
26877
|
+
//#endregion
|
|
26878
|
+
//#region src/local-components/manifest.ts
|
|
26879
|
+
const OPENMELD_CLI_COMMAND_CONTRACT_VERSION = "openmeld-cli-command-contract-2026-09-large-space-files-v1";
|
|
26880
|
+
const OPENMELD_SKILLS_CONTRACT_VERSION = "openmeld-skills-contract-2026-09-explicit-space-recipients-v1";
|
|
26881
|
+
const OPENMELD_SERVICE_CONTRACT_VERSION = "openmeld-service-contract-2026-09-space-access-and-large-files-v1";
|
|
26882
|
+
const LOCAL_COMPONENTS_SNAPSHOT_FILE = "local-components.json";
|
|
26883
|
+
const SERVICE_COMPONENT_UPDATE_CODES = /* @__PURE__ */ new Set([
|
|
26884
|
+
"version_outdated",
|
|
26885
|
+
"downgrade_blocked",
|
|
26886
|
+
"runtime_contract_missing",
|
|
26887
|
+
"runtime_contract_mismatch",
|
|
26888
|
+
"runtime_contract_unavailable",
|
|
26889
|
+
"bundle_missing",
|
|
26890
|
+
"bundle_content_drift",
|
|
26891
|
+
"bundle_id_drift",
|
|
26892
|
+
"bundle_version_drift",
|
|
26893
|
+
"bundle_lane_drift",
|
|
26894
|
+
"bundle_strategy_legacy",
|
|
26895
|
+
"bundle_provenance_drift",
|
|
26896
|
+
"bundle_path_invalid"
|
|
26897
|
+
]);
|
|
26898
|
+
function localComponentsSnapshotPath() {
|
|
26899
|
+
return join(openMeldRootDir(), LOCAL_COMPONENTS_SNAPSHOT_FILE);
|
|
26900
|
+
}
|
|
26901
|
+
async function buildExpectedLocalComponentsManifest() {
|
|
26902
|
+
const skills = await resolveExpectedSkillsManifest();
|
|
26903
|
+
return {
|
|
26904
|
+
schemaVersion: 1,
|
|
26905
|
+
openMeldReleaseVersion: OPENMELD_VERSION,
|
|
26906
|
+
cli: {
|
|
26907
|
+
packageVersion: OPENMELD_VERSION,
|
|
26908
|
+
commandContractVersion: OPENMELD_CLI_COMMAND_CONTRACT_VERSION
|
|
26909
|
+
},
|
|
26910
|
+
service: {
|
|
26911
|
+
bundleHash: null,
|
|
26912
|
+
bundleVersion: await resolveCurrentDaemonExpectedVersion(),
|
|
26913
|
+
runtimeContractEpoch: CURRENT_DAEMON_EXECUTION_CONTRACT_EPOCH,
|
|
26914
|
+
serviceContractVersion: OPENMELD_SERVICE_CONTRACT_VERSION
|
|
26915
|
+
},
|
|
26916
|
+
skills
|
|
26917
|
+
};
|
|
26918
|
+
}
|
|
26919
|
+
async function readInstalledLocalComponentsSnapshot() {
|
|
26920
|
+
const raw = await readFile(localComponentsSnapshotPath(), "utf8").catch(() => null);
|
|
26921
|
+
if (!raw) return null;
|
|
26922
|
+
const parsed = JSON.parse(raw);
|
|
26923
|
+
const result = installedLocalComponentsSnapshotSchema.safeParse(parsed);
|
|
26924
|
+
return result.success ? result.data : null;
|
|
26925
|
+
}
|
|
26926
|
+
async function writeInstalledLocalComponentsSnapshot(input) {
|
|
26927
|
+
const snapshot = {
|
|
26928
|
+
schemaVersion: 1,
|
|
26929
|
+
installedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
26930
|
+
source: input.source,
|
|
26931
|
+
manifest: await buildExpectedLocalComponentsManifest()
|
|
26932
|
+
};
|
|
26933
|
+
const installed = isBinaryDistribution() ? await readManagedCliInstallation() : null;
|
|
26934
|
+
if (installed && installed.version !== OPENMELD_VERSION) {
|
|
26935
|
+
const previous = await readInstalledLocalComponentsSnapshot();
|
|
26936
|
+
if (previous?.manifest.cli.packageVersion === installed.version) snapshot.manifest.cli = previous.manifest.cli;
|
|
26937
|
+
}
|
|
26938
|
+
const snapshotPath = localComponentsSnapshotPath();
|
|
26939
|
+
await mkdir(dirname(snapshotPath), { recursive: true });
|
|
26940
|
+
const temporaryPath = `${snapshotPath}.${crypto.randomUUID()}.tmp`;
|
|
26941
|
+
try {
|
|
26942
|
+
await writeFile(temporaryPath, `${JSON.stringify(snapshot, null, 2)}\n`);
|
|
26943
|
+
await rename(temporaryPath, snapshotPath);
|
|
26944
|
+
} finally {
|
|
26945
|
+
await rm(temporaryPath, { force: true });
|
|
26946
|
+
}
|
|
26947
|
+
return snapshot;
|
|
26948
|
+
}
|
|
26949
|
+
async function resolveLocalComponentsStatus(input = {}) {
|
|
26950
|
+
const [expectedManifest, service, skills, maintenance, updateOperation] = await Promise.all([
|
|
26951
|
+
buildExpectedLocalComponentsManifest(),
|
|
26952
|
+
resolveServiceComponentState(),
|
|
26953
|
+
resolveSkillsComponentState(),
|
|
26954
|
+
resolveOpenMeldToolsMaintenanceProjection(),
|
|
26955
|
+
resolveOpenMeldToolsUpdateOperation()
|
|
26956
|
+
]);
|
|
26957
|
+
const cli = await resolveCliComponentStatus(input);
|
|
26958
|
+
const selectedSkill = await loadSelectedSkillAssets();
|
|
26959
|
+
const setupAction = resolveLocalComponentsSetupAction({
|
|
26960
|
+
cliStatus: cli.status,
|
|
26961
|
+
serviceKind: service.kind,
|
|
26962
|
+
serviceStatus: service.status,
|
|
26963
|
+
skillsStatus: skills.status
|
|
26964
|
+
});
|
|
26965
|
+
return {
|
|
26966
|
+
schemaVersion: 1,
|
|
26967
|
+
generatedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
26968
|
+
entrypoint: "setup",
|
|
26969
|
+
summaryLabel: formatLocalComponentsSummaryLabel({
|
|
26970
|
+
cliStatus: cli.status,
|
|
26971
|
+
setupAction
|
|
26972
|
+
}),
|
|
26973
|
+
summaryDescription: formatLocalComponentsSummaryDescription({
|
|
26974
|
+
cliStatus: cli.status,
|
|
26975
|
+
setupAction
|
|
26976
|
+
}),
|
|
26977
|
+
setupAction,
|
|
26978
|
+
setupActionLabel: formatLocalSetupActionLabel(setupAction),
|
|
26979
|
+
setupActionDescription: formatLocalSetupActionDescription(setupAction),
|
|
26980
|
+
maintenance,
|
|
26981
|
+
...updateOperation ? { updateOperation } : {},
|
|
26982
|
+
cli,
|
|
26983
|
+
service: {
|
|
26984
|
+
expectedBundleHash: expectedManifest.service.bundleHash,
|
|
26985
|
+
expectedBundleVersion: expectedManifest.service.bundleVersion,
|
|
26986
|
+
installedBundleHash: service.installedBundleHash,
|
|
26987
|
+
installedBundleVersion: service.installedBundleVersion,
|
|
26988
|
+
reasonCodes: service.reasonCodes,
|
|
26989
|
+
runtimeContractEpoch: expectedManifest.service.runtimeContractEpoch,
|
|
26990
|
+
serviceContractVersion: expectedManifest.service.serviceContractVersion,
|
|
26991
|
+
status: service.status
|
|
26992
|
+
},
|
|
26993
|
+
skills: {
|
|
26994
|
+
...selectedSkill.contentRelease ? { contentRelease: selectedSkill.contentRelease } : {},
|
|
26995
|
+
expectedBundleHash: expectedManifest.skills.bundleHash,
|
|
26996
|
+
installedBundleHash: skills.installedBundleHash,
|
|
26997
|
+
reasonCodes: skills.reasonCodes,
|
|
26998
|
+
skillContractVersion: expectedManifest.skills.skillContractVersion,
|
|
26999
|
+
status: skills.status,
|
|
27000
|
+
targetCount: skills.targetCount
|
|
27001
|
+
}
|
|
27002
|
+
};
|
|
27003
|
+
}
|
|
27004
|
+
function resolveLocalComponentsSetupAction(input) {
|
|
27005
|
+
if (input.cliStatus === "update_required") return "update_cli";
|
|
27006
|
+
if (input.serviceStatus === "update_required") return "update_service";
|
|
27007
|
+
if (input.skillsStatus === "update_required") return "update_skills";
|
|
27008
|
+
if (input.serviceKind === "missing") return "connect_service";
|
|
27009
|
+
if (input.serviceKind === "not_running" || input.serviceKind === "inspection_failed") return "reconnect_service";
|
|
27010
|
+
return "none";
|
|
27011
|
+
}
|
|
27012
|
+
async function resolveCliComponentStatus(input) {
|
|
27013
|
+
const installed = isBinaryDistribution() ? await readManagedCliInstallation() : null;
|
|
27014
|
+
const packageVersion = installed?.version ?? OPENMELD_VERSION;
|
|
27015
|
+
const snapshot = installed && installed.version !== OPENMELD_VERSION ? await readInstalledLocalComponentsSnapshot() : null;
|
|
27016
|
+
let commandContractVersion = OPENMELD_CLI_COMMAND_CONTRACT_VERSION;
|
|
27017
|
+
if (packageVersion !== OPENMELD_VERSION) commandContractVersion = snapshot?.manifest.cli.packageVersion === packageVersion ? snapshot.manifest.cli.commandContractVersion : "unknown";
|
|
27018
|
+
const latestPackageVersion = normalizeOptionalString$1(input.latestPackageVersion);
|
|
27019
|
+
const requiredCommandContractVersion = normalizeOptionalString$1(input.requiredCommandContractVersion);
|
|
27020
|
+
const reasonCodes = [];
|
|
27021
|
+
let status = "ok";
|
|
27022
|
+
if (commandContractVersion === "unknown" || requiredCommandContractVersion && requiredCommandContractVersion !== commandContractVersion) {
|
|
27023
|
+
status = "update_required";
|
|
27024
|
+
reasonCodes.push("cli.command_contract_mismatch");
|
|
27025
|
+
} else if (latestPackageVersion && compareSemver(packageVersion, latestPackageVersion) < 0) {
|
|
27026
|
+
status = "update_available";
|
|
27027
|
+
reasonCodes.push("cli.package_update_available");
|
|
27028
|
+
}
|
|
27029
|
+
return {
|
|
27030
|
+
commandContractVersion,
|
|
27031
|
+
latestPackageVersion,
|
|
27032
|
+
packageVersion,
|
|
27033
|
+
reasonCodes,
|
|
27034
|
+
requiredCommandContractVersion,
|
|
27035
|
+
status
|
|
27036
|
+
};
|
|
27037
|
+
}
|
|
27038
|
+
async function resolveServiceComponentState() {
|
|
27039
|
+
const expectedVersion = await resolveCurrentDaemonExpectedVersion();
|
|
27040
|
+
try {
|
|
27041
|
+
const [participation, inventory, activeBundle] = await Promise.all([
|
|
27042
|
+
resolveDaemonServiceParticipationStatus({ expectedVersion }),
|
|
27043
|
+
inspectDaemonServiceInventory({ expectedVersion }),
|
|
27044
|
+
readDaemonActiveBundleState().catch(() => null)
|
|
27045
|
+
]);
|
|
27046
|
+
const installedBundleVersion = resolveInstalledServiceVersion(participation);
|
|
27047
|
+
const serviceUpdateReasonCodes = collectServiceUpdateReasonCodes({
|
|
27048
|
+
anomalyCodes: inventory.anomalies.map((anomaly) => anomaly.code),
|
|
27049
|
+
participation
|
|
27050
|
+
});
|
|
27051
|
+
if (serviceUpdateReasonCodes.length > 0) return {
|
|
27052
|
+
installedBundleHash: resolveInstalledServiceBundleHash(activeBundle),
|
|
27053
|
+
installedBundleVersion,
|
|
27054
|
+
kind: "update_required",
|
|
27055
|
+
reasonCodes: serviceUpdateReasonCodes,
|
|
27056
|
+
status: "update_required"
|
|
27057
|
+
};
|
|
27058
|
+
if (participation.kind === "missing") return {
|
|
27059
|
+
installedBundleHash: null,
|
|
27060
|
+
installedBundleVersion: null,
|
|
27061
|
+
kind: "missing",
|
|
27062
|
+
reasonCodes: ["service.not_installed"],
|
|
27063
|
+
status: "ok"
|
|
27064
|
+
};
|
|
27065
|
+
if (participation.kind === "not_running") return {
|
|
27066
|
+
installedBundleHash: resolveInstalledServiceBundleHash(activeBundle),
|
|
27067
|
+
installedBundleVersion,
|
|
27068
|
+
kind: "not_running",
|
|
27069
|
+
reasonCodes: ["service.not_running"],
|
|
27070
|
+
status: "ok"
|
|
27071
|
+
};
|
|
27072
|
+
return {
|
|
27073
|
+
installedBundleHash: resolveInstalledServiceBundleHash(activeBundle),
|
|
27074
|
+
installedBundleVersion,
|
|
27075
|
+
kind: "ok",
|
|
27076
|
+
reasonCodes: [],
|
|
27077
|
+
status: "ok"
|
|
27078
|
+
};
|
|
27079
|
+
} catch (error) {
|
|
27080
|
+
return {
|
|
27081
|
+
installedBundleHash: null,
|
|
27082
|
+
installedBundleVersion: null,
|
|
27083
|
+
kind: "inspection_failed",
|
|
27084
|
+
reasonCodes: [`service.inspection_failed:${error instanceof Error ? error.message : "unknown"}`],
|
|
27085
|
+
status: "ok"
|
|
27086
|
+
};
|
|
27087
|
+
}
|
|
27088
|
+
}
|
|
27089
|
+
function resolveInstalledServiceBundleHash(activeBundle) {
|
|
27090
|
+
if (activeBundle?.bundleFormat === "binary_v1") return null;
|
|
27091
|
+
return activeBundle?.sourceDistFingerprint ?? null;
|
|
27092
|
+
}
|
|
27093
|
+
async function resolveSkillsComponentState() {
|
|
27094
|
+
const [installed, snapshot] = await Promise.all([resolveInstalledSkillsManifest(), collectSkillsReadinessSnapshot().catch(() => null)]);
|
|
27095
|
+
if (!snapshot) return {
|
|
27096
|
+
installedBundleHash: installed?.bundleHash ?? null,
|
|
27097
|
+
reasonCodes: ["skills.status_unavailable"],
|
|
27098
|
+
status: "update_required",
|
|
27099
|
+
targetCount: 0
|
|
27100
|
+
};
|
|
27101
|
+
if (!installed) return {
|
|
27102
|
+
installedBundleHash: null,
|
|
27103
|
+
reasonCodes: ["skills.bundle_hash_unavailable"],
|
|
27104
|
+
status: "update_required",
|
|
27105
|
+
targetCount: snapshot.targetCount
|
|
27106
|
+
};
|
|
27107
|
+
if (snapshot.status === "action_required") return {
|
|
27108
|
+
installedBundleHash: installed.bundleHash,
|
|
27109
|
+
reasonCodes: ["skills.update_required"],
|
|
27110
|
+
status: "update_required",
|
|
27111
|
+
targetCount: snapshot.targetCount
|
|
27112
|
+
};
|
|
27113
|
+
return {
|
|
27114
|
+
installedBundleHash: installed.bundleHash,
|
|
27115
|
+
reasonCodes: snapshot.status === "no_targets" ? ["skills.no_targets"] : [],
|
|
27116
|
+
status: "ok",
|
|
27117
|
+
targetCount: snapshot.targetCount
|
|
27118
|
+
};
|
|
27119
|
+
}
|
|
27120
|
+
async function resolveExpectedSkillsManifest() {
|
|
27121
|
+
return await resolveBundledSkillsManifest() ?? buildUnavailableSkillsManifest();
|
|
27122
|
+
}
|
|
27123
|
+
async function resolveInstalledSkillsManifest() {
|
|
27124
|
+
const bundled = await resolveBundledSkillsManifest();
|
|
27125
|
+
if (bundled) return bundled;
|
|
27126
|
+
const activeBundleSource = await resolveActiveBundleSourceSkillsManifest();
|
|
27127
|
+
if (activeBundleSource) return activeBundleSource;
|
|
27128
|
+
return (await readInstalledLocalComponentsSnapshot())?.manifest.skills ?? null;
|
|
27129
|
+
}
|
|
27130
|
+
async function resolveBundledSkillsManifest() {
|
|
27131
|
+
const assets = await loadSelectedSkillAssets().then((selected) => selected.assets).catch(() => null);
|
|
27132
|
+
if (!assets || assets.length === 0) return null;
|
|
27133
|
+
return {
|
|
27134
|
+
bundleHash: hashBundledSkillAssets(assets),
|
|
27135
|
+
skillContractVersion: OPENMELD_SKILLS_CONTRACT_VERSION,
|
|
27136
|
+
skillIds: ["openmeld-cli"]
|
|
27137
|
+
};
|
|
27138
|
+
}
|
|
27139
|
+
async function resolveActiveBundleSourceSkillsManifest() {
|
|
27140
|
+
const sourcePackageRootPath = normalizeOptionalString$1((await readDaemonActiveBundleState().catch(() => null))?.sourcePackageRootPath);
|
|
27141
|
+
if (!sourcePackageRootPath) return null;
|
|
27142
|
+
const skillsRootDir = join(sourcePackageRootPath, "skills");
|
|
27143
|
+
if (!await pathExists(skillsRootDir)) return null;
|
|
27144
|
+
return await buildSkillsManifestFromRoot(skillsRootDir);
|
|
27145
|
+
}
|
|
27146
|
+
async function buildSkillsManifestFromRoot(skillsRootDir) {
|
|
27147
|
+
return {
|
|
27148
|
+
bundleHash: await computeDirectoryContentHash({
|
|
27149
|
+
rootDir: skillsRootDir,
|
|
27150
|
+
ignoredNames: [".openmeld-skill.json"]
|
|
27151
|
+
}).catch(() => null),
|
|
27152
|
+
skillContractVersion: OPENMELD_SKILLS_CONTRACT_VERSION,
|
|
27153
|
+
skillIds: ["openmeld-cli"]
|
|
27154
|
+
};
|
|
27155
|
+
}
|
|
27156
|
+
function buildUnavailableSkillsManifest() {
|
|
27157
|
+
return {
|
|
27158
|
+
bundleHash: null,
|
|
27159
|
+
skillContractVersion: OPENMELD_SKILLS_CONTRACT_VERSION,
|
|
27160
|
+
skillIds: []
|
|
27161
|
+
};
|
|
27162
|
+
}
|
|
27163
|
+
async function pathExists(path) {
|
|
27164
|
+
try {
|
|
27165
|
+
await access(path);
|
|
27166
|
+
return true;
|
|
27167
|
+
} catch {
|
|
27168
|
+
return false;
|
|
27169
|
+
}
|
|
27170
|
+
}
|
|
27171
|
+
function collectServiceUpdateReasonCodes(input) {
|
|
27172
|
+
const reasonCodes = input.anomalyCodes.filter((code) => SERVICE_COMPONENT_UPDATE_CODES.has(code));
|
|
27173
|
+
if (input.participation.kind === "outdated") reasonCodes.push("version_outdated");
|
|
27174
|
+
if (input.participation.kind === "needs_repair") reasonCodes.push(...input.participation.anomalyCodes.filter((code) => SERVICE_COMPONENT_UPDATE_CODES.has(code)));
|
|
27175
|
+
return [...new Set(reasonCodes.map((code) => `service.${code}`))];
|
|
27176
|
+
}
|
|
27177
|
+
function resolveInstalledServiceVersion(participation) {
|
|
27178
|
+
switch (participation.kind) {
|
|
27179
|
+
case "ready":
|
|
27180
|
+
case "not_running":
|
|
27181
|
+
case "needs_repair":
|
|
27182
|
+
case "outdated": return participation.installedVersion;
|
|
27183
|
+
default: return null;
|
|
27184
|
+
}
|
|
27185
|
+
}
|
|
27186
|
+
function normalizeOptionalString$1(value) {
|
|
27187
|
+
const normalized = String(value ?? "").trim();
|
|
27188
|
+
return normalized.length > 0 ? normalized : null;
|
|
27189
|
+
}
|
|
27190
|
+
//#endregion
|
|
27191
|
+
//#region src/local-service/carrier/service-local-components-observation.ts
|
|
27192
|
+
function createServiceLocalComponentsObservation(input) {
|
|
27193
|
+
let observation = null;
|
|
27194
|
+
let pending = null;
|
|
27195
|
+
let onRefresh;
|
|
27196
|
+
let disposed = false;
|
|
27197
|
+
return {
|
|
27198
|
+
read(notify) {
|
|
27199
|
+
if (disposed) return null;
|
|
27200
|
+
onRefresh = notify;
|
|
27201
|
+
if (observation && Date.now() - observation.observedAtMs < 3e4) return observation.value;
|
|
27202
|
+
if (!pending) pending = (input.inspect ?? resolveLocalComponentsStatus)().then((value) => {
|
|
27203
|
+
observation = {
|
|
27204
|
+
value,
|
|
27205
|
+
observedAtMs: Date.now()
|
|
27206
|
+
};
|
|
27207
|
+
if (!disposed) onRefresh?.();
|
|
27208
|
+
}).catch((error) => {
|
|
27209
|
+
observation = {
|
|
27210
|
+
value: null,
|
|
27211
|
+
observedAtMs: Date.now()
|
|
27212
|
+
};
|
|
27213
|
+
if (!disposed) input.onError(error);
|
|
27214
|
+
}).finally(() => {
|
|
27215
|
+
pending = null;
|
|
27216
|
+
});
|
|
27217
|
+
return null;
|
|
27218
|
+
},
|
|
27219
|
+
dispose() {
|
|
27220
|
+
disposed = true;
|
|
27221
|
+
onRefresh = void 0;
|
|
27222
|
+
}
|
|
27223
|
+
};
|
|
27224
|
+
}
|
|
27225
|
+
//#endregion
|
|
26912
27226
|
//#region src/local-service/carrier/stop-aware-delay.ts
|
|
26913
27227
|
function createStopAwareDelay() {
|
|
26914
27228
|
let interrupted = false;
|
|
27229
|
+
let wakePending = false;
|
|
26915
27230
|
const pendingInterruptNotifiers = /* @__PURE__ */ new Set();
|
|
26916
27231
|
return {
|
|
27232
|
+
wake: () => {
|
|
27233
|
+
wakePending = pendingInterruptNotifiers.size === 0;
|
|
27234
|
+
for (const notify of pendingInterruptNotifiers) notify();
|
|
27235
|
+
pendingInterruptNotifiers.clear();
|
|
27236
|
+
},
|
|
26917
27237
|
interrupt: () => {
|
|
26918
27238
|
if (interrupted) return;
|
|
26919
27239
|
interrupted = true;
|
|
@@ -26922,6 +27242,10 @@ function createStopAwareDelay() {
|
|
|
26922
27242
|
},
|
|
26923
27243
|
wait: (delayMs) => {
|
|
26924
27244
|
if (interrupted) return Promise.resolve("interrupted");
|
|
27245
|
+
if (wakePending) {
|
|
27246
|
+
wakePending = false;
|
|
27247
|
+
return Promise.resolve("interrupted");
|
|
27248
|
+
}
|
|
26925
27249
|
return new Promise((resolve) => {
|
|
26926
27250
|
let timer = null;
|
|
26927
27251
|
const notifyInterrupted = () => {
|
|
@@ -26959,6 +27283,9 @@ var DaemonStreamAuthenticationRequiredError = class extends Error {
|
|
|
26959
27283
|
this.name = "DaemonStreamAuthenticationRequiredError";
|
|
26960
27284
|
}
|
|
26961
27285
|
};
|
|
27286
|
+
function applyIntervalJitterMs(input) {
|
|
27287
|
+
return applyIntervalJitterMs$1(input);
|
|
27288
|
+
}
|
|
26962
27289
|
async function resolveDaemonServiceOwnerContext(input) {
|
|
26963
27290
|
const explicitOpenMeldProfileId = normalizeText$2(input.openMeldProfileId);
|
|
26964
27291
|
if (explicitOpenMeldProfileId) return resolveDaemonServiceOwnerContextFromProfile(await requireOpenMeldProfile({
|
|
@@ -27017,6 +27344,7 @@ async function resolveDaemonStreamAuthContext(input) {
|
|
|
27017
27344
|
};
|
|
27018
27345
|
return {
|
|
27019
27346
|
authState: "valid",
|
|
27347
|
+
credentialFingerprint: fingerprintRequestAuthorization(headers.Authorization),
|
|
27020
27348
|
headers,
|
|
27021
27349
|
status: "ready"
|
|
27022
27350
|
};
|
|
@@ -27028,6 +27356,7 @@ function resolveCredentialFailureAuthState(reason) {
|
|
|
27028
27356
|
}
|
|
27029
27357
|
function toDaemonStreamCredentialFailure(error) {
|
|
27030
27358
|
return {
|
|
27359
|
+
...error.retryAfterMs !== void 0 ? { retryAfterMs: error.retryAfterMs } : {},
|
|
27031
27360
|
authHost: error.authHost,
|
|
27032
27361
|
expectedGatewayHost: error.expectedGatewayHost,
|
|
27033
27362
|
reason: error.reason,
|
|
@@ -27076,32 +27405,67 @@ function createControlledShutdownCoordinator(input) {
|
|
|
27076
27405
|
},
|
|
27077
27406
|
requestServiceStop,
|
|
27078
27407
|
async request(payload) {
|
|
27079
|
-
|
|
27080
|
-
|
|
27081
|
-
|
|
27082
|
-
|
|
27083
|
-
|
|
27084
|
-
|
|
27085
|
-
|
|
27086
|
-
|
|
27087
|
-
|
|
27088
|
-
|
|
27408
|
+
return await withControlledStopRefusalProof({
|
|
27409
|
+
guarded: payload.onAdmission !== void 0,
|
|
27410
|
+
isStopping: () => shutdownAttempt !== null || input.isStopRequested(),
|
|
27411
|
+
run: async (markCommitted) => {
|
|
27412
|
+
const stopCause = await resolveRecentDaemonSignalStopCause();
|
|
27413
|
+
if (shutdownAttempt) {
|
|
27414
|
+
markCommitted();
|
|
27415
|
+
const existingAttempt = shutdownAttempt;
|
|
27416
|
+
await payload.onAdmission?.(() => void 0);
|
|
27417
|
+
await existingAttempt.promise;
|
|
27418
|
+
} else if (activeSessionShutdownResolver) {
|
|
27419
|
+
const currentAttempt = Promise.withResolvers();
|
|
27420
|
+
const clearAttempt = () => {
|
|
27421
|
+
if (shutdownAttempt === currentAttempt) shutdownAttempt = null;
|
|
27422
|
+
};
|
|
27423
|
+
currentAttempt.promise.then(clearAttempt, clearAttempt);
|
|
27424
|
+
const resolver = activeSessionShutdownResolver;
|
|
27425
|
+
const commit = () => {
|
|
27426
|
+
if (shutdownAttempt || activeSessionShutdownResolver !== resolver) throw new Error("Service session changed before Stop admission.");
|
|
27427
|
+
markCommitted();
|
|
27428
|
+
shutdownAttempt = currentAttempt;
|
|
27429
|
+
resolver(stopCause);
|
|
27430
|
+
};
|
|
27431
|
+
await (payload.onAdmission ?? commitControlledStop)(commit);
|
|
27432
|
+
await currentAttempt.promise;
|
|
27433
|
+
} else {
|
|
27434
|
+
if (input.hasUndrainedWork()) throw new DaemonServiceRunError({
|
|
27435
|
+
code: "daemon.control.shutdown_drain_unavailable",
|
|
27436
|
+
message: "controlled shutdown cannot verify active local work without a connected runtime session"
|
|
27437
|
+
});
|
|
27438
|
+
const commit = () => {
|
|
27439
|
+
if (activeSessionShutdownResolver || input.hasUndrainedWork()) throw new Error("Service work changed before Stop admission.");
|
|
27440
|
+
markCommitted();
|
|
27441
|
+
requestServiceStop(stopCause);
|
|
27442
|
+
};
|
|
27443
|
+
await (payload.onAdmission ?? commitControlledStop)(commit);
|
|
27444
|
+
}
|
|
27445
|
+
return {
|
|
27446
|
+
accepted: true,
|
|
27447
|
+
gracePeriodMs: payload.gracePeriodMs,
|
|
27448
|
+
mode: payload.mode
|
|
27449
|
+
};
|
|
27089
27450
|
}
|
|
27090
|
-
}
|
|
27091
|
-
if (input.hasUndrainedWork()) throw new DaemonServiceRunError({
|
|
27092
|
-
code: "daemon.control.shutdown_drain_unavailable",
|
|
27093
|
-
message: "controlled shutdown cannot verify active local work without a connected runtime session"
|
|
27094
|
-
});
|
|
27095
|
-
requestServiceStop(stopCause);
|
|
27096
|
-
}
|
|
27097
|
-
return {
|
|
27098
|
-
accepted: true,
|
|
27099
|
-
gracePeriodMs: payload.gracePeriodMs,
|
|
27100
|
-
mode: payload.mode
|
|
27101
|
-
};
|
|
27451
|
+
});
|
|
27102
27452
|
}
|
|
27103
27453
|
};
|
|
27104
27454
|
}
|
|
27455
|
+
function commitControlledStop(commit) {
|
|
27456
|
+
commit();
|
|
27457
|
+
}
|
|
27458
|
+
async function withControlledStopRefusalProof(input) {
|
|
27459
|
+
let committed = input.isStopping();
|
|
27460
|
+
try {
|
|
27461
|
+
return await input.run(() => {
|
|
27462
|
+
committed = true;
|
|
27463
|
+
});
|
|
27464
|
+
} catch (error) {
|
|
27465
|
+
if (input.guarded && !committed && !input.isStopping()) throw new ServiceAccountAdmissionError("stop_refused", error instanceof Error ? error.message : String(error));
|
|
27466
|
+
throw error;
|
|
27467
|
+
}
|
|
27468
|
+
}
|
|
27105
27469
|
function hasUndrainedLocalWork(input) {
|
|
27106
27470
|
return input.inflightDispatchMetaByTaskId.size > 0 || listDispatchResultOutboxPendingAcknowledgementKeys({ ledgerPaths: input.ledgerPaths }).length > 0;
|
|
27107
27471
|
}
|
|
@@ -27122,6 +27486,11 @@ async function runSocketSessionWithControlledShutdown(input) {
|
|
|
27122
27486
|
input.controlledShutdown.handleSessionCompleted();
|
|
27123
27487
|
}
|
|
27124
27488
|
const runDaemonServiceLoop = async (input) => {
|
|
27489
|
+
const auth = await getAuthSessionState({ refreshExpired: true });
|
|
27490
|
+
if (auth.state !== "valid" || !auth.session?.user?.id) throw new Error("A valid CLI account is required to start this Service.");
|
|
27491
|
+
return await withAdmittedServiceSession(auth.session, async () => await runAccountBoundDaemonServiceLoop(input));
|
|
27492
|
+
};
|
|
27493
|
+
const runAccountBoundDaemonServiceLoop = async (input) => {
|
|
27125
27494
|
await assertDaemonServiceLaunchScope();
|
|
27126
27495
|
const baseUrl = await resolveBaseUrl(input.baseUrl);
|
|
27127
27496
|
const ownerContext = await resolveDaemonServiceOwnerContext({ openMeldProfileId: input.profile });
|
|
@@ -27183,11 +27552,29 @@ const runDaemonServiceLoop = async (input) => {
|
|
|
27183
27552
|
leaseDescriptor: await resolveDaemonRuntimeLeaseDescriptor({ command: daemonRuntimeState.command })
|
|
27184
27553
|
});
|
|
27185
27554
|
let recovery = null;
|
|
27555
|
+
const connectionEvidence = createServiceConnectionEvidenceObserver({
|
|
27556
|
+
ownerUserId: ownerContext.ownerUserId,
|
|
27557
|
+
gatewayUrl: baseUrl,
|
|
27558
|
+
identity: {
|
|
27559
|
+
deviceId,
|
|
27560
|
+
runtimeLane: daemonServiceLaneSchema.parse(lane),
|
|
27561
|
+
serviceSessionId: daemonSessionId,
|
|
27562
|
+
serviceVersion: OPENMELD_VERSION
|
|
27563
|
+
},
|
|
27564
|
+
getRecovery: () => recovery,
|
|
27565
|
+
isStopping: () => stopRequested
|
|
27566
|
+
});
|
|
27186
27567
|
const recoveryMetadata = () => ({
|
|
27187
27568
|
...describeConnectionRecovery(recovery),
|
|
27569
|
+
connectionDiagnosticId: connectionEvidence.connectionDiagnosticId,
|
|
27188
27570
|
attempt: reconnectAttempt
|
|
27189
27571
|
});
|
|
27190
27572
|
const connectionState = createRunLoopConnectionStateTracker(input.presenter, recoveryMetadata);
|
|
27573
|
+
const localComponentsObservation = createServiceLocalComponentsObservation({ onError: (error) => emitRunLine({
|
|
27574
|
+
presenter: input.presenter,
|
|
27575
|
+
code: "daemon.run.local_components_status_failed",
|
|
27576
|
+
text: `local components status unavailable: ${toErrorMessage$10(error)}`
|
|
27577
|
+
}) });
|
|
27191
27578
|
const localAdapterContainer = createLocalAdapterContainer(createLocalAdapterEntries({
|
|
27192
27579
|
registerRuntimeProcess: (event) => {
|
|
27193
27580
|
const nextProcessId = event.phase === "process_exit" ? null : event.processId;
|
|
@@ -27245,6 +27632,7 @@ const runDaemonServiceLoop = async (input) => {
|
|
|
27245
27632
|
const reconnectBackoffDelay = createStopAwareDelay();
|
|
27246
27633
|
let reconnectAttempt = 0;
|
|
27247
27634
|
let activeSocket = null;
|
|
27635
|
+
let activeCredentialFingerprint = null;
|
|
27248
27636
|
const recoverRuntimeReportingAuthentication = createRuntimeReportingAuthenticationRecovery({ requestCarrierHandshake: () => {
|
|
27249
27637
|
activeSocket?.close(1012, "runtime_reporting_auth_recovery");
|
|
27250
27638
|
} });
|
|
@@ -27257,6 +27645,7 @@ const runDaemonServiceLoop = async (input) => {
|
|
|
27257
27645
|
});
|
|
27258
27646
|
return;
|
|
27259
27647
|
}
|
|
27648
|
+
if (input.failure.credentialFingerprint !== activeCredentialFingerprint) return;
|
|
27260
27649
|
const recovery = await recoverRuntimeReportingAuthentication(input.failure);
|
|
27261
27650
|
warnDaemonEvent("[openmeld.runtime_reporting.auth_recovery]", {
|
|
27262
27651
|
event: "cli.runtime_reporting.auth_recovery",
|
|
@@ -27287,6 +27676,7 @@ const runDaemonServiceLoop = async (input) => {
|
|
|
27287
27676
|
const controlPlaneServer = await startLocalDaemonControlPlaneServer({
|
|
27288
27677
|
resolveExpectedToken: async () => await ensureDaemonControlPlaneToken(),
|
|
27289
27678
|
getContext: async () => ({
|
|
27679
|
+
accountCheckedServiceControl: process.platform !== "win32",
|
|
27290
27680
|
healthPayload: {
|
|
27291
27681
|
checkedAt: nowIsoString(),
|
|
27292
27682
|
...toHealthProjection(stopRequested ? {
|
|
@@ -27341,7 +27731,19 @@ const runDaemonServiceLoop = async (input) => {
|
|
|
27341
27731
|
requestActiveRouteCatalogSync
|
|
27342
27732
|
});
|
|
27343
27733
|
},
|
|
27344
|
-
shutdownHandler:
|
|
27734
|
+
shutdownHandler: async (payload) => {
|
|
27735
|
+
const admissionId = payload.accountAdmissionId;
|
|
27736
|
+
return await controlledShutdown.request({
|
|
27737
|
+
...payload,
|
|
27738
|
+
...admissionId ? { onAdmission: async (commit) => await admitServiceAccountStop({
|
|
27739
|
+
id: admissionId,
|
|
27740
|
+
ownerUserId,
|
|
27741
|
+
deviceId,
|
|
27742
|
+
contractGeneration: daemonServiceContract?.generation ?? 0,
|
|
27743
|
+
commit
|
|
27744
|
+
}) } : {}
|
|
27745
|
+
});
|
|
27746
|
+
},
|
|
27345
27747
|
serviceUpdateReadinessHandler: () => {
|
|
27346
27748
|
const unacknowledgedResultCount = listDispatchResultOutboxPendingAcknowledgementKeys({ ledgerPaths }).length;
|
|
27347
27749
|
return {
|
|
@@ -27476,6 +27878,10 @@ const runDaemonServiceLoop = async (input) => {
|
|
|
27476
27878
|
});
|
|
27477
27879
|
agentActivityIntegrationRefresh.request();
|
|
27478
27880
|
};
|
|
27881
|
+
const unsubscribeCredentialAvailability = onAuthSessionCredentialAvailable(() => {
|
|
27882
|
+
if (connectionState.get().reason === "auth_unavailable") reconnectBackoffDelay.wake();
|
|
27883
|
+
});
|
|
27884
|
+
const unsubscribeCredentialObservation = onAuthSessionCredentialObservation((reason) => connectionEvidence.credential(reason));
|
|
27479
27885
|
try {
|
|
27480
27886
|
emitRunLine({
|
|
27481
27887
|
presenter: input.presenter,
|
|
@@ -27503,8 +27909,11 @@ const runDaemonServiceLoop = async (input) => {
|
|
|
27503
27909
|
}
|
|
27504
27910
|
});
|
|
27505
27911
|
while (!stopRequested) try {
|
|
27912
|
+
connectionEvidence.beginAttempt();
|
|
27506
27913
|
connectionState.set("connecting", { reason: resolveConnectingReason(reconnectAttempt) });
|
|
27507
|
-
const
|
|
27914
|
+
const connectionUrl = new URL(toDaemonStreamUrl(baseUrl));
|
|
27915
|
+
connectionUrl.searchParams.set(SERVICE_CONNECTION_ID_QUERY_PARAMETER, connectionEvidence.connectionDiagnosticId);
|
|
27916
|
+
const wsUrl = connectionUrl.toString();
|
|
27508
27917
|
const authContext = await resolveDaemonStreamAuthContext({
|
|
27509
27918
|
requestUrl: wsUrl,
|
|
27510
27919
|
selectedOpenMeldProfile
|
|
@@ -27514,6 +27923,7 @@ const runDaemonServiceLoop = async (input) => {
|
|
|
27514
27923
|
connectionState,
|
|
27515
27924
|
credentialFailure: authContext.credentialFailure ?? null
|
|
27516
27925
|
});
|
|
27926
|
+
connectionEvidence.opening();
|
|
27517
27927
|
const ws = await connectWebSocket(wsUrl, {
|
|
27518
27928
|
headers: {
|
|
27519
27929
|
...authContext.headers,
|
|
@@ -27526,6 +27936,8 @@ const runDaemonServiceLoop = async (input) => {
|
|
|
27526
27936
|
break;
|
|
27527
27937
|
}
|
|
27528
27938
|
activeSocket = ws;
|
|
27939
|
+
activeCredentialFingerprint = authContext.credentialFingerprint;
|
|
27940
|
+
connectionEvidence.opened(ws);
|
|
27529
27941
|
emitRunLine({
|
|
27530
27942
|
presenter: input.presenter,
|
|
27531
27943
|
code: "daemon.run.connected",
|
|
@@ -27553,6 +27965,7 @@ const runDaemonServiceLoop = async (input) => {
|
|
|
27553
27965
|
ledgerPaths,
|
|
27554
27966
|
loadRouteCatalog: routeCatalogLoader.load,
|
|
27555
27967
|
localAdapterContainer,
|
|
27968
|
+
localComponentsObservation,
|
|
27556
27969
|
localExecutionSlots,
|
|
27557
27970
|
onRuntimeReportingAuthenticationFailure: async (failure) => {
|
|
27558
27971
|
await requestRuntimeReportingAuthenticationRecovery({
|
|
@@ -27581,6 +27994,7 @@ const runDaemonServiceLoop = async (input) => {
|
|
|
27581
27994
|
socket: ws,
|
|
27582
27995
|
touchRuntimeState: async (updates) => {
|
|
27583
27996
|
if (typeof updates.heartbeatAt === "string") {
|
|
27997
|
+
connectionEvidence.acknowledged(updates.heartbeatAt, connectionState.get().state !== "online");
|
|
27584
27998
|
connectionState.set("online");
|
|
27585
27999
|
reconnectAttempt = 0;
|
|
27586
28000
|
recovery = null;
|
|
@@ -27613,9 +28027,14 @@ const runDaemonServiceLoop = async (input) => {
|
|
|
27613
28027
|
presenter: input.presenter,
|
|
27614
28028
|
reconnectAttempt
|
|
27615
28029
|
});
|
|
28030
|
+
connectionEvidence.retry(error, connectionState.get().reason, backoffMs);
|
|
27616
28031
|
await reconnectBackoffDelay.wait(backoffMs);
|
|
27617
28032
|
}
|
|
27618
28033
|
} finally {
|
|
28034
|
+
connectionEvidence.dispose();
|
|
28035
|
+
localComponentsObservation.dispose();
|
|
28036
|
+
unsubscribeCredentialObservation();
|
|
28037
|
+
unsubscribeCredentialAvailability();
|
|
27619
28038
|
controlledShutdown.failOutstanding();
|
|
27620
28039
|
process.off("SIGINT", onSigint);
|
|
27621
28040
|
process.off("SIGTERM", onSigterm);
|
|
@@ -27951,12 +28370,25 @@ function createRunLoopConnectionStateTracker(presenter, recoveryMetadata) {
|
|
|
27951
28370
|
}
|
|
27952
28371
|
function noteRunLoopReconnectScheduled(input) {
|
|
27953
28372
|
const errorMessage = toErrorMessage$10(input.error);
|
|
27954
|
-
const
|
|
27955
|
-
|
|
27956
|
-
|
|
28373
|
+
const credentialFailure = input.error instanceof DaemonStreamAuthenticationRequiredError ? input.error.credentialFailure : null;
|
|
28374
|
+
let failureReason = classifyConnectionFailureReason(errorMessage);
|
|
28375
|
+
if (credentialFailure?.reason === "session_token_unavailable") failureReason = "auth_unavailable";
|
|
28376
|
+
else if (input.error instanceof DaemonStreamAuthenticationRequiredError || input.error instanceof WebSocketConnectionError && input.error.status === 401) failureReason = "auth_rejected";
|
|
28377
|
+
let authState = input.error instanceof DaemonStreamAuthenticationRequiredError ? input.error.authState : null;
|
|
28378
|
+
if (failureReason === "auth_unavailable") authState = null;
|
|
28379
|
+
const policyBackoffMs = resolveServiceConnectionReconnectBackoffMs({
|
|
27957
28380
|
attempt: input.reconnectAttempt,
|
|
27958
28381
|
reason: failureReason
|
|
27959
28382
|
});
|
|
28383
|
+
const credentialRetryAfterMs = credentialFailure?.retryAfterMs ?? 0;
|
|
28384
|
+
let backoffMs = policyBackoffMs;
|
|
28385
|
+
if (failureReason === "auth_unavailable" && credentialRetryAfterMs > 0) backoffMs = credentialRetryAfterMs;
|
|
28386
|
+
else if (failureReason !== "auth_rejected") backoffMs = applyIntervalJitterMs({
|
|
28387
|
+
baseIntervalMs: policyBackoffMs,
|
|
28388
|
+
minIntervalMs: DEFAULT_RECONNECT_DELAY_MS,
|
|
28389
|
+
maxIntervalMs: MAX_RECONNECT_DELAY_MS,
|
|
28390
|
+
jitterRatio: .2
|
|
28391
|
+
});
|
|
27960
28392
|
noteReconnectFailureState({
|
|
27961
28393
|
authState,
|
|
27962
28394
|
connectionState: input.connectionState,
|
|
@@ -28045,6 +28477,13 @@ function throwDaemonStreamAuthenticationRequired(input) {
|
|
|
28045
28477
|
}
|
|
28046
28478
|
function noteAuthenticationRequiredState(input) {
|
|
28047
28479
|
const detail = input.credentialFailure ? `stored credentials are not attachable to the daemon stream (${input.credentialFailure.reason}: requestHost=${input.credentialFailure.requestHost ?? "unknown"}, authHost=${input.credentialFailure.authHost ?? "unknown"}, expectedGatewayHost=${input.credentialFailure.expectedGatewayHost ?? "unknown"})` : `connecting without credentials, session=${input.authState}`;
|
|
28480
|
+
if (input.credentialFailure?.reason === "session_token_unavailable") {
|
|
28481
|
+
input.connectionState.set("degraded", {
|
|
28482
|
+
detail,
|
|
28483
|
+
reason: "auth_unavailable"
|
|
28484
|
+
});
|
|
28485
|
+
return;
|
|
28486
|
+
}
|
|
28048
28487
|
input.connectionState.set("authentication_required", {
|
|
28049
28488
|
authState: input.authState,
|
|
28050
28489
|
detail,
|
|
@@ -31455,6 +31894,7 @@ function summarizeDaemonStopJournalResult(stopResult) {
|
|
|
31455
31894
|
}
|
|
31456
31895
|
async function stopCurrentLaneDaemonService(input) {
|
|
31457
31896
|
const context = await loadCurrentLaneDaemonStopContext();
|
|
31897
|
+
if (input.completedControlledShutdownOwnerPid !== void 0 && (context.ownerSnapshot.runtimeStatus.pid !== null && context.ownerSnapshot.runtimeStatus.pid !== input.completedControlledShutdownOwnerPid || context.ownerSnapshot.ownedProcesses.some((process) => process.pid !== input.completedControlledShutdownOwnerPid))) throw new Error("The Service owner changed after controlled shutdown. Check its status before trying again.");
|
|
31458
31898
|
await emitDaemonLifecycleEvent({
|
|
31459
31899
|
type: "owner.snapshot",
|
|
31460
31900
|
result: "observed",
|
|
@@ -31474,6 +31914,7 @@ async function stopCurrentLaneDaemonService(input) {
|
|
|
31474
31914
|
});
|
|
31475
31915
|
if (context.stopStrategy.kind === "not_running") return await buildDaemonStopNotRunningResult(context.ownerSnapshot.runtimeStatus);
|
|
31476
31916
|
if (context.stopStrategy.kind === "manager_first") return await stopManagedCurrentLaneDaemonService({
|
|
31917
|
+
controlledShutdownComplete: input.completedControlledShutdownOwnerPid !== void 0,
|
|
31477
31918
|
force: input.force,
|
|
31478
31919
|
mode: input.mode,
|
|
31479
31920
|
ownerSnapshot: context.ownerSnapshot,
|
|
@@ -31554,7 +31995,7 @@ async function stopManagedCurrentLaneDaemonService(input) {
|
|
|
31554
31995
|
if (input.mode === "interactive") {
|
|
31555
31996
|
if (!await confirmStopServiceManager(input.runtime, input.ownerSnapshot.runtimeStatus)) return { status: "cancelled" };
|
|
31556
31997
|
}
|
|
31557
|
-
const drainPreparationResult = await prepareManagedDaemonServiceForStop({
|
|
31998
|
+
const drainPreparationResult = input.controlledShutdownComplete ? null : await prepareManagedDaemonServiceForStop({
|
|
31558
31999
|
force: input.force,
|
|
31559
32000
|
mode: input.mode,
|
|
31560
32001
|
ownerSnapshot: input.ownerSnapshot
|
|
@@ -33418,7 +33859,7 @@ async function runDaemonRunInteractivePreflightBeforeModePrompt(input) {
|
|
|
33418
33859
|
}
|
|
33419
33860
|
return null;
|
|
33420
33861
|
}
|
|
33421
|
-
async function runDaemonStop(input) {
|
|
33862
|
+
async function runDaemonStop(input, internal = {}) {
|
|
33422
33863
|
const runtime = await resolveRuntimeContext({ view: input.view });
|
|
33423
33864
|
const presenter = input.json === true ? createQuietPresenter(runtime) : createPresenter(runtime);
|
|
33424
33865
|
emitDaemonOverviewIfAgent({
|
|
@@ -33438,6 +33879,7 @@ async function runDaemonStop(input) {
|
|
|
33438
33879
|
run: async () => {
|
|
33439
33880
|
if (resolveOpenMeldEnvPreset() === "dev-local") await uninstallDaemonServiceUpdateWorker();
|
|
33440
33881
|
const stopped = await executeDaemonStopCommand({
|
|
33882
|
+
completedControlledShutdownOwnerPid: internal.completedControlledShutdownOwnerPid,
|
|
33441
33883
|
force: input.force,
|
|
33442
33884
|
presenter,
|
|
33443
33885
|
profile: input.profile,
|
|
@@ -33519,6 +33961,7 @@ async function runDaemonAutostart(input, options = {}) {
|
|
|
33519
33961
|
}
|
|
33520
33962
|
async function executeDaemonStopCommand(input) {
|
|
33521
33963
|
const stopResult = await stopCurrentLaneDaemonService({
|
|
33964
|
+
completedControlledShutdownOwnerPid: input.completedControlledShutdownOwnerPid,
|
|
33522
33965
|
force: input.force,
|
|
33523
33966
|
mode: "interactive",
|
|
33524
33967
|
runtime: input.runtime
|
|
@@ -34997,6 +35440,7 @@ async function resolveDetachedDaemonServiceLaunchTarget() {
|
|
|
34997
35440
|
function buildDetachedDaemonLaunchSpec(input) {
|
|
34998
35441
|
const detachedMode = input.mode === "background" ? "foreground" : input.mode;
|
|
34999
35442
|
const sharedArgs = [
|
|
35443
|
+
...input.accountAdmissionId ? ["--account-admission-id", input.accountAdmissionId] : [],
|
|
35000
35444
|
...input.openMeldProfileId ? ["--profile", input.openMeldProfileId] : [],
|
|
35001
35445
|
...input.deviceId ? ["--device-id", input.deviceId] : [],
|
|
35002
35446
|
...typeof input.heartbeatMs === "number" ? ["--heartbeat-ms", String(input.heartbeatMs)] : [],
|
|
@@ -39527,6 +39971,6 @@ async function emitAgentsConfigParseFallbackSignal(input) {
|
|
|
39527
39971
|
});
|
|
39528
39972
|
}
|
|
39529
39973
|
//#endregion
|
|
39530
|
-
export {
|
|
39974
|
+
export { buildHumanErrorCopy as $, uninstallAgentActivityIntegrations as $n, buildPublicSpaceEntryUrl as $t, runDaemonBackgroundStartForDecision as A, connectWebSocket as An, cliJsonSkillsListEnvelopeSchema as Ar, collectLocalAgentControllerInventory as At, runDaemonTeardownStrict as B, readAgentActivityOutboxHealth as Bn, readSpaceConfig as Bt, resolveGatewayWebOrigin as C, resolveNextRecentMentionProfileIdsForQueuedText as Cn, finishCurrentCommandCheckScope as Cr, writeDispatchSpaceActionRecord as Ct, isManagedSystemServiceBootstrapRun as D, DISPATCH_OWNED_RUNTIME_MODE as Dn, startCurrentCommandCheckScope as Dr, submitProfileRuntimeAgentControllerReport as Dt, bestEffortStopCurrentLaneDaemonService as E, updateAuthoredMentionRanges as En, resetCurrentCommandCheckState as Er, readRuntimeReportingHealthState as Et, runDaemonRunAfterEntryChecks as F, readCodexSessionTitles as Fn, organizationJoinLinkErrorResponseSchema as Fr, LocalSpaceStateIntegrityError as Ft, buildProfileWorkspacePresentation as G, registerAgentActivityRoute as Gn, toSpaceConfigListIntegrityError as Gt, formatServiceParticipationReadinessLabel as H, enqueueControllerTaskLifecycleEventWhileLocked as Hn, readSpaceRecentMentionProfileIds as Ht, runDaemonServiceDetached as I, readAgentActivityContextForPath as In, organizationJoinLinkManagementQuerySchema as Ir, inspectSpaceCacheFile as It, createQuietPresenter as J, AGENT_ACTIVITY_INTEGRATION_OWNER as Jn, writeSpaceCacheDeletionNoticeState as Jt, buildProfileWorkspaceRows as K, resolveAgentActivityRouteForPath as Kn, updateSpaceLastSeenTs as Kt, runDaemonSnapshot as L, removeAgentActivityContextCache as Ln, revokeOrganizationJoinLinkResponseSchema as Lr, isLocalSpaceStateCorruptResult as Lt, runDaemonInstall as M, buildAgentActivityEvent as Mn, cliJsonSkillsShowEnvelopeSchema as Mr, resolveLocalAgentControllerLaunchability as Mt, runDaemonInterrupt as N, resolveObservedAgentActivityBinding as Nn, acceptOrganizationJoinLinkBodySchema as Nr, resolveLocalAgentControllerReportDecision as Nt, runDaemon as O, OPENMELD_DISPATCH_RUNTIME_MODE_ENV as On, cliJsonErrorEnvelopeSchema as Or, submitRuntimeAgentControllerReport as Ot, runDaemonReinstall as P, normalizeSharedSessionTitle as Pn, getOrganizationJoinLinkResponseSchema as Pr, projectSpaceProfileCache as Pt, runDaemonStartDecisionPrompt as Q, resolveAgentActivityDispatcherCommand as Qn, buildDispatchResultReplyWorkflowProjection as Qt, runDaemonStatusFlow as R, enqueueAgentActivityHookEvent as Rn, listSpaceConfigs as Rt, buildSpaceWebUrl as S, prepareSpaceFileOnlySubmission as Sn, runInteractivePrompt as Sr, readDispatchSpaceActionContextFromEnv as St, runDaemonServiceParticipationGate as T, returnToTargetPickerState as Tn, isCurrentCommandCheckScopeActive as Tr, validateLocalProjectConnectionPath as Tt, formatServiceRuntimeHeadline as U, readControllerTaskLifecycleOutboxHealth as Un, removeSpaceConfig as Ut, runDaemonUninstall as V, removeProjectOutbox as Vn, readSpaceLastSeenTs as Vt, resolveServiceParticipationReadiness as W, isAgentActivityRouteRegistered as Wn, toLocalSpaceStateIntegrityError as Wt, createDelayedSpinner as X, installAgentActivityIntegrations as Xn, SpaceComposerSubmissionError as Xt, emitDaemonAgentOverview as Y, defaultManagedIntegrationPaths as Yn, writeSpaceRecentMentionProfileIds as Yt, shouldEmitAgentOverview as Z, readAgentActivityIntegrationStatus as Zn, buildDispatchResultMessageReadProjection as Zt, promptSearchSelect as _, isTargetPickerState as _n, resolveDeviceAuthClientId as _r, toStructuredGatewayFailure as _t, runAgentsCustomRemove as a, buildSpaceMessageReadRelationSummary as an, runAuthMenu as ar, resolveLocalComponentsStatus as at, resolveOffsetVisibleWindow as b, openTargetPickerState as bn, promptTextEntry as br, readDispatchOwnedRuntimeGuard as bt, runAgentsDisable as c, buildUpdatesReplyWorkflowProjection as cn, buildAuthStatusRows as cr, fetchSpaceUpdates as ct, runAgentsManage as d, createSpaceMemberIdentityIndex as dn, renderInfoCard as dr, updateSpaceMeta as dt, buildSignalIndex as en, buildCommandAuthenticationPromptMessage as er, renderHumanErrorCard as et, runAgentsRepair as f, createSpaceTargetCatalog as fn, renderTextInfoCard as fr, parseSpaceMetaPayload as ft, promptSearchMultiselectWorkbench as g, isRelationPickerState as gn, requestDeviceToken as gr, readGatewayTextResponse as gt, promptSearchMultiselect as h, formatRemovedCcRelationMessage as hn, fetchAuthUserSnapshot as hr, readGatewayJsonResponse as ht, runAgentsCustomList as i, buildSpaceMentionProfileIndex as in, runAuthLogout as ir, readDaemonIncidentLogTail as it, runDaemonCancel as j, syncLocalAgentActivity as jn, cliJsonSkillsLoadEnvelopeSchema as jr, resolveLocalAgentControllerBlockerReasonCodes as jt, runDaemonAutostart as k, readRecentDaemonDispatchJournalEvents as kn, cliJsonOutputEnvelopeSchema as kr, submitRuntimeAgentControllerReports as kt, runAgentsEnable as l, closeMentionPickerState as ln, buildAuthStatusSnapshot as lr, createCliSpaceApi as lt, formatTransportModeDisplay as m, extractMentionAuthoringPrefix as mn, extractAuthApiErrorMessage as mr, GatewayHttpError as mt, runAgentsConfig as n, buildSignalReplyWorkflowProjection as nn, evaluateCommandAuthentication as nr, emitCliJsonEnvelope as nt, runAgentsCustomUpdate as o, buildSpaceProfileAddPlan as on, runAuthStatus as or, writeInstalledLocalComponentsSnapshot as ot, runAgentsShow as p, enterRelationPickerState as pn, buildUnifiedCardFrame as pr, parseSpaceMetaResponse as pt, reconcileCliVersionView as q, unregisterAgentActivityRoute as qn, upsertSpaceConfig as qt, runAgentsCustomAdd as r, buildSpaceMemberAgentPresencePresentation as rn, runAuthLogin as rr, runDaemonStartupPreflight as rt, runAgentsDetect as s, buildSpaceRoundReadProjection as sn, exchangeOneTimeTokenAuthSession as sr, resolveDaemonServiceParticipationStatus as st, runAgents as t, buildSignalMessageReadProjection as tn, ensureCommandAuthenticationOrCancel as tr, renderHumanTextErrorCard as tt, runAgentsList as u, collectResolvedSpaceMentions as un, formatActiveOrganizationLabel as ur, fetchSpaceMeta as ut, clampNumber as v, listSpaceMentionRelationChoices as vn, resolveDeviceTokenExpiresAt as vr, parseJsonResponse as vt, resolveSpaceWebGatewayOrigin as w, resolveSpaceMemberAgentOwnerWakeDiagnosticsView as wn, getCurrentCommandCheckState as wr, LocalProjectConnectionError as wt, computeRetryDelayMs as x, prepareSpaceComposerSubmission as xn, isReturnKeypress as xr, OPENMELD_SPACE_ACTION_CONTEXT_PATH_ENV as xt, resolveAnchoredVisibleWindow as y, listSpaceMentionSuggestions as yn, revokeAuthAccessToken as yr, assertDispatchOwnedRuntimePublicWriteAllowed as yt, runDaemonStop as z, removeProjectInbox as zn, readSpaceCacheDeletionNoticeState as zt };
|
|
39531
39975
|
|
|
39532
|
-
//# sourceMappingURL=agents-
|
|
39976
|
+
//# sourceMappingURL=agents-CIDsThyG.js.map
|