openmeld 0.3.206 → 0.3.208

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (87) hide show
  1. package/dist/{add-me-membership-BkHWMxE4.js → add-me-membership-CZS8PbYL.js} +2 -2
  2. package/dist/{add-me-membership-BkHWMxE4.js.map → add-me-membership-CZS8PbYL.js.map} +1 -1
  3. package/dist/{agents-BOTlKiwS.js → agents-pHCyQoFw.js} +1327 -283
  4. package/dist/agents-pHCyQoFw.js.map +1 -0
  5. package/dist/{api-client-foundation-DpgDs0rw.js → api-client-foundation-BdBSoby4.js} +3 -3
  6. package/dist/{api-client-foundation-DpgDs0rw.js.map → api-client-foundation-BdBSoby4.js.map} +1 -1
  7. package/dist/{api-client-foundation-6ms5gSu8.js → api-client-foundation-JiKYZcZI.js} +1 -1
  8. package/dist/auth-session-DDsceN-R.js +4 -0
  9. package/dist/{auth-session-BjSqMLTz.js → auth-session-ijcuaSsZ.js} +266 -75
  10. package/dist/auth-session-ijcuaSsZ.js.map +1 -0
  11. package/dist/{base-url-CRAYNW-4.js → base-url-BE3pFiOZ.js} +1 -1
  12. package/dist/{base-url-9A557X2K.js → base-url-C6sHRNGu.js} +2 -2
  13. package/dist/{base-url-9A557X2K.js.map → base-url-C6sHRNGu.js.map} +1 -1
  14. package/dist/cli-binary-manifest-DiUulkp0.js +117 -0
  15. package/dist/cli-binary-manifest-DiUulkp0.js.map +1 -0
  16. package/dist/{command-CkbzbvXy.js → command-CewWTp57.js} +53 -12
  17. package/dist/command-CewWTp57.js.map +1 -0
  18. package/dist/computer-connection-DK6L1_LF.js +54 -0
  19. package/dist/computer-connection-DK6L1_LF.js.map +1 -0
  20. package/dist/computer-connection-review-Dx4svB-T.js +39 -0
  21. package/dist/computer-connection-review-Dx4svB-T.js.map +1 -0
  22. package/dist/{computer-setup-continuation-Cd9nhLQ-.js → computer-setup-continuation-Bc0Tb7fi.js} +4 -4
  23. package/dist/{computer-setup-continuation-Cd9nhLQ-.js.map → computer-setup-continuation-Bc0Tb7fi.js.map} +1 -1
  24. package/dist/control-plane-D9jDcbMZ.js +1211 -0
  25. package/dist/control-plane-D9jDcbMZ.js.map +1 -0
  26. package/dist/daemon-local-state-file-jOXuXrky.js +45 -0
  27. package/dist/daemon-local-state-file-jOXuXrky.js.map +1 -0
  28. package/dist/daemon-runtime-lease-Dd4hdHNo.js +50 -0
  29. package/dist/daemon-runtime-lease-Dd4hdHNo.js.map +1 -0
  30. package/dist/{daemon-runtime-lease-BG9g0a6Z.js → daemon-runtime-lease-y3n1K0-C.js} +1 -1
  31. package/dist/{daemon-service-manager-DqVtRLBY.js → daemon-service-manager-Bh0LoLed.js} +1 -1
  32. package/dist/{daemon-service-manager-BVipiZwK.js → daemon-service-manager-GiMCiTmu.js} +99 -85
  33. package/dist/daemon-service-manager-GiMCiTmu.js.map +1 -0
  34. package/dist/daemon-service-runtime-D0LhAIGx.js +3642 -0
  35. package/dist/daemon-service-runtime-D0LhAIGx.js.map +1 -0
  36. package/dist/{daemon-state-BwIoDq7_.js → daemon-state-C37ZtIZK.js} +11 -5
  37. package/dist/daemon-state-C37ZtIZK.js.map +1 -0
  38. package/dist/{dist-CxadJClH.js → dist-B8I8inkY.js} +768 -579
  39. package/dist/dist-B8I8inkY.js.map +1 -0
  40. package/dist/dist-Dtdw34oo.js +4 -0
  41. package/dist/distribution-DY2fBeSW.js +72 -0
  42. package/dist/distribution-DY2fBeSW.js.map +1 -0
  43. package/dist/{elapsed-time-C7P-nWIO.js → elapsed-time-DZLKdEno.js} +7 -4
  44. package/dist/{elapsed-time-C7P-nWIO.js.map → elapsed-time-DZLKdEno.js.map} +1 -1
  45. package/dist/{installation-inventory-P49sTjhe.js → installation-inventory-_fMZas6v.js} +7 -6
  46. package/dist/{installation-inventory-P49sTjhe.js.map → installation-inventory-_fMZas6v.js.map} +1 -1
  47. package/dist/{lock-CvBnBcFK.js → lock-Dxp6o_t_.js} +56 -7
  48. package/dist/lock-Dxp6o_t_.js.map +1 -0
  49. package/dist/{openmeld-ChOHuaqH.js → openmeld-DQNVH1jx.js} +468 -41
  50. package/dist/openmeld-DQNVH1jx.js.map +1 -0
  51. package/dist/openmeld-dev.js +1 -1
  52. package/dist/openmeld-environment-target-NtJYJe1D.js +256 -0
  53. package/dist/openmeld-environment-target-NtJYJe1D.js.map +1 -0
  54. package/dist/{openmeld-maintenance-worker-C7WykyDt.js → openmeld-maintenance-worker-CgGOwbP4.js} +9 -8
  55. package/dist/{openmeld-maintenance-worker-C7WykyDt.js.map → openmeld-maintenance-worker-CgGOwbP4.js.map} +1 -1
  56. package/dist/{openmeld-tools-update-coordinator-BBZhGo1A.js → openmeld-tools-update-coordinator-D6uuBitR.js} +558 -4107
  57. package/dist/openmeld-tools-update-coordinator-D6uuBitR.js.map +1 -0
  58. package/dist/openmeld.js +3 -3
  59. package/dist/{prepare-session-executor-CLmDoHom.js → prepare-session-executor-DQqmhjGj.js} +15 -13
  60. package/dist/{prepare-session-executor-CLmDoHom.js.map → prepare-session-executor-DQqmhjGj.js.map} +1 -1
  61. package/dist/{profiles-BCecj4Pj.js → runtime-transport-DryoU4rm.js} +1041 -2096
  62. package/dist/runtime-transport-DryoU4rm.js.map +1 -0
  63. package/dist/service-account-authorization-BN2F75_x.js +56 -0
  64. package/dist/service-account-authorization-BN2F75_x.js.map +1 -0
  65. package/dist/service-control-capabilities-BqEr7J9H.js +4 -0
  66. package/dist/service-control-capabilities-CnG1E-e3.js +54 -0
  67. package/dist/service-control-capabilities-CnG1E-e3.js.map +1 -0
  68. package/dist/upgrade-B9gjUOgQ.js +4 -0
  69. package/dist/{upgrade-l_5Tge_z.js → upgrade-CNeTiYSS.js} +6 -4
  70. package/dist/upgrade-CNeTiYSS.js.map +1 -0
  71. package/package.json +2 -2
  72. package/dist/agents-BOTlKiwS.js.map +0 -1
  73. package/dist/auth-session-BjSqMLTz.js.map +0 -1
  74. package/dist/auth-session-ahQ5VXiF.js +0 -4
  75. package/dist/command-CkbzbvXy.js.map +0 -1
  76. package/dist/daemon-runtime-lease-CXlGR-iA.js +0 -87
  77. package/dist/daemon-runtime-lease-CXlGR-iA.js.map +0 -1
  78. package/dist/daemon-service-manager-BVipiZwK.js.map +0 -1
  79. package/dist/daemon-state-BwIoDq7_.js.map +0 -1
  80. package/dist/dist-0boZRalP.js +0 -4
  81. package/dist/dist-CxadJClH.js.map +0 -1
  82. package/dist/lock-CvBnBcFK.js.map +0 -1
  83. package/dist/openmeld-ChOHuaqH.js.map +0 -1
  84. package/dist/openmeld-tools-update-coordinator-BBZhGo1A.js.map +0 -1
  85. package/dist/profiles-BCecj4Pj.js.map +0 -1
  86. package/dist/upgrade-BKEAZKre.js +0 -4
  87. package/dist/upgrade-l_5Tge_z.js.map +0 -1
@@ -2,35 +2,41 @@
2
2
 
3
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 { A as formatLocalMachineIssueMessage, D as createServiceSpawnPendingIssue, G as isPublishedOpenMeldHome, I as accountsDir, J as normalizeAccountKey, K as legacyAccountProfileSpacesDir, N as accountProfileSpaceCacheDir, Q as openMeldManagedBinaryPath, Y as normalizeOpenMeldProfileId, _ as resolveCliContextId, b as resolveOpenMeldLaneDescriptor, dt as resolveOpenMeldServiceOwnedPathInput, j as OPENMELD_HOME_ENV_KEY, l as resolveOpenMeldOrphanedLockIssue, lt as resolveOpenMeldEnvPreset, r as isOpenMeldLockError, tt as openMeldRootDir, ut as resolveOpenMeldRootDir, w as assessLocalMachineFailure } from "./lock-CvBnBcFK.js";
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, d as runWithHeldLock, dt as resolveOpenMeldEnvPreset, et as openMeldManagedBinaryPath, ft as resolveOpenMeldRootDir, i as isOpenMeldLockError, k as createServiceSpawnPendingIssue, pt as resolveOpenMeldServiceOwnedPathInput, q as isPublishedOpenMeldHome, rt as openMeldRootDir, s as releaseLock, t as acquireLock, u as resolveOpenMeldOrphanedLockIssue, v as resolveCliContextId, x as resolveOpenMeldLaneDescriptor } from "./lock-Dxp6o_t_.js";
6
+ import { $r as spaceMemberDirectoryEntrySchema, Ar as organizationComputersResponseSchema, Bn as OPENMELD_HEADER_REQUEST_ID, Ci as OPENMELD_RUNTIME_CAPABILITIES_HEADER, Cr as getOrganizationSkillResponseSchema, Dr as organizationSkillSummarySchema, Ei as computerFileAccessPolicySchema, Er as organizationSkillReleaseSummarySchema, Fr as listCenterAgentRoutineRunsResponseSchema, Gn as spaceEntryTargetSchema, Hr as agentActivityEventSchema, Ir as listCenterAgentRoutinesResponseSchema, Kr as agentActivitySnapshotResponseSchema, Lr as pauseCenterAgentRoutineResponseSchema, Mr as submitFeedbackIssueResponseSchema, Nr as createCenterAgentRoutineResponseSchema, Oi as toCompatibleSpaceAddressingRequestWireValue, Pr as deleteCenterAgentRoutineResponseSchema, Qr as spaceMemberDirectoryAllowedRelationsSchema, Rr as resumeCenterAgentRoutineResponseSchema, Si as COMPUTER_FILE_ACCESS_RUNTIME_CAPABILITY, Sr as spaceMetaSchema, Ti as computerFileAccessPolicyInputSchema, Tt as buildSpaceAttachmentDownloadPath, Vn as OPENMELD_HEADER_SPACE_ADDRESSING_VERSION, Vr as AGENT_ACTIVITY_PRESENCE_TTL_MAX_MS, Wn as getSpaceUpdatesResponseSchema, Zr as spaceMemberAgentWakeAvailabilitySchema, _i as archiveProjectResponseSchema, _r as gatewayErrorEnvelopeSchema, ai as agentActivitySessionInventoryResponseSchema, an as createRuntimeReportingApi, bi as projectSchema, ci as centerAgentToolSpeakerSchema, cr as betterAuthDeviceAuthorizationCodeRequestSchema, dr as betterAuthDeviceAuthorizationTokenRequestSchema, ei as spaceMemberDirectorySchema, fi as serviceConnectionEvidenceEventSchema, fr as betterAuthDeviceAuthorizationTokenResponseSchema, gi as localProjectControlDiscoverProjectsResponseSchema, hi as localProjectControlDaemonFrameSchema, jn as DAEMON_STREAM_KEEPALIVE_PING, jr as submitFeedbackIssueRequestSchema, jt as createAgentActivityApi, kr as organizationDirectoryResponseSchema, lr as betterAuthDeviceAuthorizationCodeResponseSchema, mi as localProjectControlConnectionSchema, on as createServiceConnectionEvidenceApi, pi as serviceConnectionEvidenceJournalSchema, pr as betterAuthSessionSnapshotResponseSchema, qn as SPACE_DISPATCH_TRACE_PROMPT_PREVIEW_MAX_CHARS, rr as submitAgentControllerTaskLifecycleEventItemSchema, si as observedLocalAgentSessionSchema, sn as createSpaceApi, sr as BETTER_AUTH_DEVICE_AUTHORIZATION_GRANT_TYPE, t as OpenMeldApiClientHttpError, ti as spaceMemberKindSchema, ur as betterAuthDeviceAuthorizationErrorResponseSchema, vi as createProjectResponseSchema, wi as computerFileAccessDaemonFrameSchema, wn as toStructuredApiClientFailure, wr as listOrganizationSkillsResponseSchema, xi as updateProjectResponseSchema, xr as spaceCreatorSchema, yi as listProjectsResponseSchema, yr as organizationSpaceDirectoryWithMemberCountsResponseSchema, zr as updateCenterAgentRoutineResponseSchema } from "./dist-B8I8inkY.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$1, 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-BBZhGo1A.js";
8
- import { $r as serviceConnectionEvidenceEventSchema, Bn as spaceEntryTargetSchema, Br as spaceMemberDirectoryEntrySchema, Cr as listCenterAgentRoutinesResponseSchema, En as DAEMON_STREAM_KEEPALIVE_PING, Er as updateCenterAgentRoutineResponseSchema, Fn as OPENMELD_HEADER_REQUEST_ID, Hn as SPACE_DISPATCH_TRACE_PROMPT_PREVIEW_MAX_CHARS, Hr as spaceMemberKindSchema, In as OPENMELD_HEADER_SPACE_ADDRESSING_VERSION, Jr as observedLocalAgentSessionSchema, Kr as agentActivitySessionInventoryResponseSchema, Nr as agentActivitySnapshotResponseSchema, Or as AGENT_ACTIVITY_PRESENCE_TTL_MAX_MS, Rr as spaceMemberAgentWakeAvailabilitySchema, Sr as listCenterAgentRoutineRunsResponseSchema, Tr as resumeCenterAgentRoutineResponseSchema, Tt as buildSpaceAttachmentDownloadPath, Vr as spaceMemberDirectorySchema, Yr as centerAgentToolSpeakerSchema, Zn as submitAgentControllerTaskLifecycleEventItemSchema, _r as organizationComputersResponseSchema, ai as createProjectResponseSchema, an as createSpaceApi, br as createCenterAgentRoutineResponseSchema, ci as updateProjectResponseSchema, cr as spaceCreatorSchema, di as computerFileAccessDaemonFrameSchema, dr as listOrganizationSkillsResponseSchema, ei as serviceConnectionEvidenceJournalSchema, fi as computerFileAccessPolicyInputSchema, gr as organizationDirectoryResponseSchema, ii as archiveProjectResponseSchema, in as createServiceConnectionEvidenceApi, ir as gatewayErrorEnvelopeSchema, jt as createAgentActivityApi, kr as agentActivityEventSchema, li as COMPUTER_FILE_ACCESS_RUNTIME_CAPABILITY, lr as spaceMetaSchema, mi as toCompatibleSpaceAddressingRequestWireValue, mr as organizationSkillSummarySchema, ni as localProjectControlDaemonFrameSchema, oi as listProjectsResponseSchema, or as organizationSpaceDirectoryWithMemberCountsResponseSchema, pi as computerFileAccessPolicySchema, pr as organizationSkillReleaseSummarySchema, ri as localProjectControlDiscoverProjectsResponseSchema, rn as createRuntimeReportingApi, si as projectSchema, t as OpenMeldApiClientHttpError, ti as localProjectControlConnectionSchema, ui as OPENMELD_RUNTIME_CAPABILITIES_HEADER, ur as getOrganizationSkillResponseSchema, vr as submitFeedbackIssueRequestSchema, wr as pauseCenterAgentRoutineResponseSchema, xr as deleteCenterAgentRoutineResponseSchema, yn as toStructuredApiClientFailure, yr as submitFeedbackIssueResponseSchema, zn as getSpaceUpdatesResponseSchema, zr as spaceMemberDirectoryAllowedRelationsSchema } from "./dist-CxadJClH.js";
9
- import { $ as runtimeTransportResumeControllerConversationResultFramePayloadSchema, A as runtimeTransportDispatchPreviewEndRequestSchema, An as localFolderPickerHelperResultSchema, B as runtimeTransportLocalAgentControlForkSessionFramePayloadSchema, Bt as AGENT_INTERACTION_DEFAULT_TIMEOUT_MS, C as localWakeRouteWorkingFolderObservationSchema, D as runtimeTransportDispatchInteractionRequestSchema, Di as localAgentReasoningPreferencesSchema, Dn as OPENMELD_LOCAL_FOLDER_PICKER_CAPABILITY_HEADER, E as runtimeTransportDispatchInteractionDeliveredRequestSchema, Ei as OPENMELD_REASONING_STREAM_HEADER, En as LOCAL_FOLDER_PICKER_RUNTIME_CAPABILITY, G as runtimeTransportLocalAgentControlSetProfileWorkspaceFramePayloadSchema, Gn as sanitizeSignalTextPreview, Gt as formatLocalComponentsSummaryDescription, H as runtimeTransportLocalAgentControlManageInstallationFramePayloadSchema, Ht as agentInteractionRequestSchema, I as runtimeTransportForkAgentSessionResultSchema, Ii as normalizeOptionalWorkingDirectory, J as runtimeTransportOpenMeldToolsControlResultFramePayloadSchema, Jr as boolean, Jt as formatLocalSetupActionLabel, Kt as formatLocalComponentsSummaryLabel, L as runtimeTransportHeartbeatRequestSchema, Li as openMeldRuntimeProfileIdSchema, M as runtimeTransportDispatchReasoningRequestSchema, N as runtimeTransportDispatchRuntimeEvidenceRequestSchema, O as runtimeTransportDispatchInteractionResponseFramePayloadSchema, On as localFolderPickerDaemonFrameSchema, P as runtimeTransportDispatchToolActivityRequestSchema, Q as runtimeTransportResumeControllerConversationFramePayloadSchema, Qr as enumFactory, R as runtimeTransportHeartbeatResponseSchema, T as runtimeTransportDeliverDispatchRequestSchema, Ti as LOCAL_AGENT_REASONING_MAX_CHARS, Tt as openMeldDaemonControlPlaneResponseSchema, U as runtimeTransportLocalAgentControlRefreshCatalogFramePayloadSchema, V as runtimeTransportLocalAgentControlInterruptFramePayloadSchema, W as runtimeTransportLocalAgentControlSetEnabledFramePayloadSchema, X as runtimeTransportRegisterSessionResponseSchema, Xr as discriminatedUnion, Xt as localCliComponentUpdateProjectionSchema, Y as runtimeTransportRegisterSessionRequestSchema, Yi as resolvePublicAgentAvailabilityCopy, Yt as installedLocalComponentsSnapshotSchema, Zi as sanitizeDispatchErrorSummary, _n as normalizeSpacePasswordText, ar as collectCanonicalMentionTextFragments, ei as iso, en as localServiceComponentUpdateProjectionSchema, et as runtimeTransportRouteCatalogChangedFramePayloadSchema, ft as openMeldSpaceEgressActionSchema, hi as url, hr as resolveSpaceMentionLabels, ir as MESSAGE_MENTION_TYPE_VALUES, j as runtimeTransportDispatchPreviewRequestSchema, k as runtimeTransportDispatchLifecycleRequestSchema, ki as openMeldRequestContextSchema, kn as localFolderPickerHelperProtocolResultSchema, li as strictObject, lr as normalizeMessageEnvelope, mn as runtimeTransportDeliveryExecutionIdentitySchema, mr as resolveSingleSpaceMentionLabels, ni as literal, nt as runtimeTransportSubmitTaskResultRequestSchema, pn as runtimeCoordinatorExecutionTokenEnvelopeSchema, q as runtimeTransportOpenMeldToolsControlFramePayloadSchema, qt as formatLocalSetupActionDescription, sr as getSpaceMessageAddressingRelationSupportForTargetKind, ui as string, ur as resolveMessageEnvelopeTargetField, ut as openMeldDaemonTaskResultPayloadSchema, x as daemonStreamFrameSchema, y as CURRENT_DAEMON_EXECUTION_CONTRACT_EPOCH, z as runtimeTransportLocalAgentControlCancelFramePayloadSchema } from "./profiles-BCecj4Pj.js";
10
- 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-P49sTjhe.js";
8
+ import { $i as buildDaemonSystemServiceCommandSpec, $n as resolveRouteRegistrationReconcileDecision, $r as renderWorkingLanguagePrompt, $t as resolveProjectBindingForPath, A as resolveDaemonStatusSnapshot, Aa as DAEMON_RUNTIME_CONTRACT_EPOCH, Ai as formatDaemonOwnerSummaryLabel, An as resolveSkillsAgentRegistry, Ar as seedLegacyAgentContext, B as formatDaemonServiceRefreshReliabilityMessage, Ba as RUNTIME_AGENT_CONTROLLER_REPORT_SYNC_INTERVAL_MS, Bi as DaemonServiceRunError, Bn as repairBuiltinControllerInstall, Br as buildInformationProtectionPromptPlan, C as isSystemServiceStartupTimeoutError, Ca as toErrorMessage$10, Cn as removeAgentCustomTarget, Cr as buildRuntimeWorkspaceFingerprint, Ct as summarizeSkippedDaemonProfiles, D as captureDaemonServiceEvidence, Da as CONTROLLED_SHUTDOWN_REQUEST_TIMEOUT_MS, Di as createProviderOriginalError, Dn as updateAgentRegistrations, Dr as loadLedgerState, Dt as resolveLocalController, E as startDaemonSystemServiceWithAutoRepair, Ea as CATALOG_SYNC_SIGNAL_POLL_INTERVAL_MS, Ei as listAgentControllerSupervisedProcessIds, En as updateAgentCustomTarget, Er as commitResolvedAgentContext, Et as readLocalEnabledControllers, F as buildDaemonServiceRefreshNextStep, Fa as HEARTBEAT_RESPONSE_TIMEOUT_MS, Fi as summarizeDaemonOwnerSnapshot, Fr as assertLegacyAgentContextAssociation, G as buildDaemonServiceDependencyDetails, Ga as resolveOpenMeldProfileOrNull, Gn as isNpmGlobalCommandPath, Gt as bindProject, Ha as RUNTIME_STATE_PERSIST_MIN_INTERVAL_MS, Hn as resolveBuiltinAgentControllerDefinition, Hr as createAgentControllerInterfaceDisplayRows, I as buildDaemonServiceRefreshPromptMessage, Ia as MAX_RECONNECT_DELAY_MS, In as normalizeAgentId, Ir as buildAgentContextLookupKey, It as readProfileWorkspaceConfigForAccount, J as buildDaemonServiceDependencySummary, Jn as normalizeDispatchThreadAction, Jt as listProjectConnectionsWithStatus, K as buildDaemonServiceDependencyMeaning, Kn as isPnpmGlobalCommandPath, Kt as isProjectBound, La as PROVIDER_CONVERSATION_PROOF_SYNC_INTERVAL_MS, Ln as normalizeAgentIds, Lr as DEFAULT_TASK_LIFECYCLE_HEARTBEAT_INTERVAL_MS, M as resolveDaemonStatusAuthenticationAttention, Ma as DAEMON_STREAM_KEEPALIVE_INTERVAL_MS, Mi as readCurrentDaemonOwnerSnapshot, Mr as upsertConversationExecutionState, Mt as resolveProfileWorkspaceRuntime, N as resolveServiceReadiness, Na as DAEMON_STREAM_KEEPALIVE_PONG_TIMEOUT_MS, Ni as resolveDaemonStopStrategy, Nn as resolveRegistryRuntimeAdapterCapabilitySnapshot, Nr as withLedgerStateTransaction, Nt as ensureOpenMeldManagedProfileWorkspace, O as captureDaemonServiceEvidenceBestEffort, Oa as CONTROLLED_SHUTDOWN_RESULT_ACK_TIMEOUT_MS, Oi as inspectDaemonServiceInventory, On as canManageRegistryAgentSkillTargets, Or as removeConversationExecutionState, Ot as resolveLocalRuntimeControllerSupport, Pa as DEFAULT_RECONNECT_DELAY_MS, Pi as resolveStoppedContractWriteBlockedReason, Pn as resolveRegistryRuntimeAdapterContractByAgentControllerRef, Pr as buildAuthenticatedControlPlaneResponse, Qi as writeDaemonServiceContract, Qn as isDaemonReconcileInProgressError, Qr as renderInformationProtectionPrompt, Qt as removeProjectConnection, R as buildDaemonServiceStatusReadOnlyDetail, Ra as PROVIDER_CONVERSATION_PROOF_SYNC_RETRY_INTERVAL_MS, Ri as ensureDaemonRuntimeContractState, Rn as parseAgentEnabledOption, Rr as areAgentControllerInterfaceAccountsSame, Rt as resolveConfiguredProfileWorkspacePathForAccount, S as isDaemonInventoryRunningAndStartReady$1, Sa as nowIsoString, Si as createUnsupportedProviderUsageLimits, Sr as runRuntimeTask, St as loadDaemonRouteCatalog, T as waitForSystemServiceStartup$1, Ta as CATALOG_SYNC_RETRY_INTERVAL_MS, Ti as materializeCliLaunchCommand, Tn as setAgentRegistrationEnabled, Tr as appendLedgerHistoryEntry, Tt as buildRuntimeRouteTargets, U as clearDaemonStartFailureState, Un as isBunGlobalCommandPath, Ut as ProjectBindingOperationError, V as formatDaemonServiceUpdateRequiredMessage, Va as RUNTIME_AGENT_CONTROLLER_REPORT_SYNC_RETRY_INTERVAL_MS, Vi as resolveCurrentDaemonExpectedVersion, Vn as EMPTY_AGENT_CONTROLLER_INTERFACE_CAPABILITIES, Vr as buildWorkingLanguagePromptPlan, W as writeDaemonStartFailureState, Wa as requireOpenMeldProfile, Wn as isHomebrewCommandPath, Wt as ProjectBindingStoreUpdateRequiredError, X as resolveDaemonServiceDependencyDiagnostics, Xn as SPACE_ACTION_CONTEXT_GUIDANCE_LINES, Xt as removeAgentActivityBindingsWhileDeliveryLocked, Y as buildDaemonServiceDependencyTitle, Yn as syncRuntimeEventToInflightTaskControlRegistry, Yr as parseAgentControllerRef, Zi as resolveCurrentOpenMeldAccountContext, Zn as SPACE_ACTION_TARGET_GUIDANCE_LINES, Zt as removeMissingProjectConnections, _ as DaemonServiceLifecycleDrainTimeoutError, _a as emitRunLine, _i as resolveInstalledCodexLaunchCandidates, _n as listAgentRegistrations, _o as compareAgentControllerRefsForDisplay, _r as resolveDispatchQueueLogMeta, _t as readDaemonRouteCatalogCache, a as resolveServiceUpdateUrgency, aa as DAEMON_SERVICE_AUTO_HEAL_ANOMALIES, an as withAgentActivityDeliveryLock, ar as createLocalTaskInterruptSender, ba as normalizeOptionalText$13, bi as resolveInstalledClaudeCodeLaunchCandidates, bn as readAgentRuntimeConfigHealth, br as resolveCompatibleConversationExecutionState, bt as createMutableRouteCatalogState, ca as DAEMON_SERVICE_WAKEABILITY_ADVISORY_ANOMALIES, ci as createLocalAdapterEntries, cn as syncDeviceRuntimeStateProjection, co as buildAuthenticationStatusLabel, cr as createInflightTaskControlRegistry, da as buildLedgerPaths, di as resolveInstalledOpenCodeLaunchCandidates, dn as emitReconcileStartedEvidence, do as createAuthenticationError, dr as MIN_HEARTBEAT_INTERVAL_MS, ea as ensureDaemonSystemServiceCommandFiles, er as createSerialAgentInteractionCallback, fa as ensureDaemonRuntimePaths, fi as GrokBuildAcpTransportError, fo as extractAuthenticationPromptAction, fr as applyAcceptedLeases, g as scheduleDaemonServiceUpdate, ga as dirnamePath, gi as resolveCodexTimeoutMs, gn as listAgentCustomTargets, go as resolveAuthenticationReasonFromState, gr as resolveCatalogSyncIntervalMs, gt as slugifyOpenClawNamePart, ha as asRecord, hi as projectCodexUsageLimits, hn as createRegistrationFromCatalogTarget, hr as resolveAdaptiveHeartbeatIntervalMs, ht as normalizeOpenClawSpaceIdPrefix, i as writeOpenMeldToolsMaintenancePolicy, in as resolveLocalProjectConnectionForPath, ir as mergeOpenClawGatewayVisibility, j as resolveDaemonStatusAttention, ja as DAEMON_STREAM_CONNECT_TIMEOUT_MS, ji as hasActiveDaemonOwners, jr as settleInflightTask, jt as resolveCurrentEffectiveProfileWorkingFolderRuntime, k as formatDaemonFailureContextText, ka as CONTROLLED_SHUTDOWN_SOCKET_CLOSE_TIMEOUT_MS, ki as buildDaemonOwnerSnapshotFromObservedState, kr as resolveConversationExecutionStateByLookupKey, la as classifyDaemonServiceRunStartability, li as parseOpenCodeGoUsageResponse, ln as emitDriftDetectedEvidence, lo as buildCommandAuthenticationPromptMessage$1, lr as ADAPTIVE_HEARTBEAT_JITTER_RATIO, ma as resolvePreferredDaemonDeviceId, mi as resolveInstalledGrokBuildLaunchCandidates, mn as addAgentCustomTarget, mr as pruneStaleLeases, mt as buildOpenClawSpaceSessionKey, n as readOpenMeldToolsMaintenancePolicy, na as resolveDaemonServiceAlignmentDecision, nr as normalizeDispatchPostMessageAction, o as assessServerRequiredVersion, oa as DAEMON_SERVICE_FULL_ALIGNMENT_ANOMALIES, oi as resolveCatalogSyncSkippedProfilesLogState, on as withAgentActivityLocalStateLock, oo as readDaemonCatalogSyncSignal, or as buildLocalServiceDiagnosticsPayload, pa as resolveDaemonDeviceId, pi as probeGrokBuildAcpInterface, pn as resolveAgentProfilePrimaryAgentControllerReport, po as resolveAuthenticationGuidance, pr as applyIntervalJitterMs$1, pt as prepareProviderRuntime, q as buildDaemonServiceDependencyNextStep, qa as clearAllSelectedOpenMeldProfileIds, qi as resolveRuntimeContext, qt as listProjectBindings, r as resolveOpenMeldToolsMaintenanceProjection, ra as isVersionDowngrade, rr as createPendingAgentInteractionRegistry, s as describeServerRequiredVersionUnavailableReason, sa as DAEMON_SERVICE_REPAIR_ANOMALIES, si as createLocalAdapterContainer, sr as createLocalExecutionSlots, t as createOpenMeldToolsUpdateCoordinator, ta as buildDaemonServiceTargetSpec, tn as setDefaultProjectConnection, tr as buildDispatchReplyContextSummary, u as assessCliUpdate, ua as classifyDaemonServiceWakeability, ui as forkOpenCodeServerSession, un as emitReconcileCompletedEvidence, uo as buildHumanAuthenticationCard, ur as MAX_HEARTBEAT_INTERVAL_MS, v as runDaemonServiceLifecycle, va as normalizeHeartbeatIntervalMs, vi as forkCodexAppServerThread, vn as listAgentTargetStates, vr as resolveDispatchContinuityObservation, vt as writeDaemonRouteCatalogCache, w as resolveSystemServiceStartupWaitMs, wa as warnDaemonEvent, wi as buildCliLaunchInvocation, wn as resolveAgentTargetState, wr as buildTaskResultEnvelope, wt as syncDaemonRouteCatalogState, x as uninstallDaemonServiceUpdateWorker, xa as normalizeText$2, xi as createUnavailableProviderUsageLimits, xn as reconcileNewRunnableBuiltinAgentRegistrations, xr as resolveLatestScopedConversationExecutionState, xt as createRouteCatalogFromMutableState, y as ensureDaemonServiceMaintenanceInstalled, ya as normalizeNonNegativeInteger$1, yi as verifyCodexAppServerThread, yn as manageAgentRegistrationInstallation, yr as resolveCompatibleAgentContextMatch, yt as resolveLocalServiceDemand, z as buildDaemonServiceUpdateRequiredNextStep, za as REGISTER_RESPONSE_TIMEOUT_MS, zi as readDaemonRuntimeContractRepairReport, zn as sortAgentRegistrations, zr as buildAgentControllerRef, zt as setCustomProfileWorkspace } from "./openmeld-tools-update-coordinator-D6uuBitR.js";
9
+ import { A as runtimeTransportOpenMeldToolsControlResultFramePayloadSchema, An as resolveSpaceMentionLabels, Bt as localFolderPickerDaemonFrameSchema, C as runtimeTransportLocalAgentControlInterruptFramePayloadSchema, Cn as executionContextAssignmentSchema, D as runtimeTransportLocalAgentControlSetProfileWorkspaceFramePayloadSchema, E as runtimeTransportLocalAgentControlSetEnabledFramePayloadSchema, Er as sanitizeDispatchErrorSummary, Et as runtimeTransportDeliveryExecutionIdentitySchema, F as runtimeTransportResumeControllerConversationResultFramePayloadSchema, Ht as localFolderPickerHelperResultSchema, I as runtimeTransportRouteCatalogChangedFramePayloadSchema, J as openMeldSpaceEgressActionSchema, K as openMeldDaemonTaskResultPayloadSchema, M as runtimeTransportRegisterSessionResponseSchema, P as runtimeTransportResumeControllerConversationFramePayloadSchema, R as runtimeTransportSubmitTaskResultRequestSchema, Rt as LOCAL_FOLDER_PICKER_RUNTIME_CAPABILITY, S as runtimeTransportLocalAgentControlForkSessionFramePayloadSchema, Sn as resolveMessageEnvelopeTargetField, T as runtimeTransportLocalAgentControlRefreshCatalogFramePayloadSchema, Tn as executionContextTaskSchema, Tt as runtimeCoordinatorExecutionTokenEnvelopeSchema, Vt as localFolderPickerHelperProtocolResultSchema, Xr as openMeldRequestContextSchema, _n as collectCanonicalMentionTextFragments, _r as OPENMELD_REASONING_STREAM_HEADER, _t as agentInteractionRequestSchema, a as localWakeRouteWorkingFolderObservationSchema, b as runtimeTransportHeartbeatResponseSchema, c as runtimeTransportDispatchInteractionDeliveredRequestSchema, d as runtimeTransportDispatchLifecycleRequestSchema, f as runtimeTransportDispatchPreviewEndRequestSchema, g as runtimeTransportDispatchToolActivityRequestSchema, gn as MESSAGE_MENTION_TYPE_VALUES, gr as LOCAL_AGENT_REASONING_MAX_CHARS, h as runtimeTransportDispatchRuntimeEvidenceRequestSchema, ht as AGENT_INTERACTION_DEFAULT_TIMEOUT_MS, j as runtimeTransportRegisterSessionRequestSchema, k as runtimeTransportOpenMeldToolsControlFramePayloadSchema, kn as resolveSingleSpaceMentionLabels, kt as normalizeSpacePasswordText, l as runtimeTransportDispatchInteractionRequestSchema, m as runtimeTransportDispatchReasoningRequestSchema, p as runtimeTransportDispatchPreviewRequestSchema, r as daemonStreamFrameSchema, rn as sanitizeSignalTextPreview, s as runtimeTransportDeliverDispatchRequestSchema, t as CURRENT_DAEMON_EXECUTION_CONTRACT_EPOCH, u as runtimeTransportDispatchInteractionResponseFramePayloadSchema, v as runtimeTransportForkAgentSessionResultSchema, vr as localAgentReasoningPreferencesSchema, w as runtimeTransportLocalAgentControlManageInstallationFramePayloadSchema, wr as resolvePublicAgentAvailabilityCopy, x as runtimeTransportLocalAgentControlCancelFramePayloadSchema, xn as normalizeMessageEnvelope, y as runtimeTransportHeartbeatRequestSchema, yn as getSpaceMessageAddressingRelationSupportForTargetKind, zt as OPENMELD_LOCAL_FOLDER_PICKER_CAPABILITY_HEADER } from "./runtime-transport-DryoU4rm.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 { C as resolveOpenMeldDistribution, S as isBinaryDistribution, a as beginAuthSessionTransition, g as onAuthSessionCredentialObservation, h as onAuthSessionCredentialAvailable, i as assertAuthSessionMutationAvailable, l as getAuthSessionState, o as clearAuthSession, y as setAuthSession } from "./auth-session-BjSqMLTz.js";
13
- import { a as readDaemonLocalStateFile, i as writeDaemonRuntimeLease, o as writeDaemonLocalStateFile } from "./daemon-runtime-lease-CXlGR-iA.js";
14
- 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-C7P-nWIO.js";
15
- 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-9A557X2K.js";
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-ijcuaSsZ.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-_fMZas6v.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-D0LhAIGx.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-DZLKdEno.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-BN2F75_x.js";
16
24
  import { n as toErrorMessage$11, t as sleep } from "./dist-o3UL1EGQ.js";
17
- 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-DpgDs0rw.js";
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-BdBSoby4.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, copyFile, link, lstat, mkdir, mkdtemp, open, readFile, readdir, readlink, 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
- import { isDeepStrictEqual } from "node:util";
36
+ import { isDeepStrictEqual, promisify } from "node:util";
32
37
  import { createServer } from "node:net";
33
- import { forkSession } from "@anthropic-ai/claude-agent-sdk";
38
+ import pc from "picocolors";
39
+ import { forkSession, getSessionInfo, getSessionMessages } 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";
36
42
  import stringWidth from "string-width";
@@ -276,6 +282,7 @@ const cliJsonDaemonStatusEnvelopeSchema = defineSuccessEnvelope("daemon.status",
276
282
  runtimeFlavor: z$1.enum(["binary", "node-bundle"]).optional(),
277
283
  serverRequirement: daemonStatusServerRequirementSchema.optional()
278
284
  });
285
+ const cliJsonServiceControlCapabilitiesEnvelopeSchema = defineSuccessEnvelope("service.control_capabilities", serviceControlCapabilitiesSchema.shape);
279
286
  const cliJsonDaemonStopEnvelopeSchema = defineSuccessEnvelope("daemon.stop", {});
280
287
  const cliJsonDaemonAutostartEnvelopeSchema = defineSuccessEnvelope("daemon.autostart", {
281
288
  action: z$1.enum(["enable", "disable"]),
@@ -497,6 +504,7 @@ const cliJsonOutputEnvelopeSchema = z$1.discriminatedUnion("type", [
497
504
  cliJsonDaemonUninstallEnvelopeSchema,
498
505
  cliJsonDaemonReinstallEnvelopeSchema,
499
506
  cliJsonDaemonStatusEnvelopeSchema,
507
+ cliJsonServiceControlCapabilitiesEnvelopeSchema,
500
508
  cliJsonDaemonStopEnvelopeSchema,
501
509
  cliJsonDaemonAutostartEnvelopeSchema,
502
510
  cliJsonAgentsDetectEnvelopeSchema,
@@ -594,59 +602,6 @@ const runtimeReportingHealthStateSchema = z$1.strictObject({
594
602
  providerConversationProof: runtimeReportingChannelHealthSchema
595
603
  });
596
604
  //#endregion
597
- //#region ../../packages/schemas/dist/schemas/http/auth-device-authorization.js
598
- const BETTER_AUTH_DEVICE_AUTHORIZATION_GRANT_TYPE = "urn:ietf:params:oauth:grant-type:device_code";
599
- const betterAuthDeviceAuthorizationCodeRequestSchema = z$1.object({
600
- client_id: z$1.string().min(1),
601
- scope: z$1.string().optional(),
602
- user_id: z$1.string().optional()
603
- });
604
- const betterAuthDeviceAuthorizationCodeResponseSchema = z$1.object({
605
- device_code: z$1.string().min(1),
606
- user_code: z$1.string().min(1),
607
- verification_uri: z$1.string().min(1),
608
- verification_uri_complete: z$1.string().min(1),
609
- expires_in: z$1.number().finite().positive(),
610
- interval: z$1.number().finite().positive()
611
- });
612
- const betterAuthDeviceAuthorizationStatusSchema = z$1.enum([
613
- "pending",
614
- "approved",
615
- "denied"
616
- ]);
617
- z$1.object({
618
- user_code: z$1.string().min(1),
619
- status: betterAuthDeviceAuthorizationStatusSchema
620
- });
621
- z$1.object({ userCode: z$1.string().min(1) });
622
- z$1.object({ success: z$1.boolean() });
623
- const betterAuthDeviceAuthorizationTokenRequestSchema = z$1.object({
624
- grant_type: z$1.literal(BETTER_AUTH_DEVICE_AUTHORIZATION_GRANT_TYPE),
625
- device_code: z$1.string().min(1),
626
- client_id: z$1.string().min(1)
627
- });
628
- const betterAuthDeviceAuthorizationTokenResponseSchema = z$1.object({
629
- access_token: z$1.string().min(1),
630
- token_type: z$1.string().min(1),
631
- expires_in: z$1.number().finite().positive(),
632
- scope: z$1.string()
633
- });
634
- const betterAuthDeviceAuthorizationErrorResponseSchema = z$1.object({
635
- error: z$1.string().optional(),
636
- error_description: z$1.string().optional(),
637
- message: z$1.string().optional(),
638
- detail: z$1.string().optional()
639
- });
640
- const betterAuthSessionUserSnapshotSchema = z$1.object({
641
- id: z$1.string().optional(),
642
- email: z$1.string().optional(),
643
- name: z$1.string().optional()
644
- });
645
- const betterAuthSessionSnapshotResponseSchema = z$1.nullable(z$1.object({
646
- session: z$1.unknown().optional(),
647
- user: betterAuthSessionUserSnapshotSchema.nullable()
648
- }));
649
- //#endregion
650
605
  //#region ../../packages/schemas/dist/schemas/runtime/agent-controller-session.js
651
606
  const agentControllerSessionTitleSchema = z$1.string().trim().min(1).max(120);
652
607
  //#endregion
@@ -7349,9 +7304,8 @@ function createLedgerIo() {
7349
7304
  await appendFile(filePath, content, { encoding });
7350
7305
  },
7351
7306
  copyFile: async (fromPath, toPath) => {
7352
- const raw = await readFile(fromPath, "utf8");
7353
7307
  await mkdir(dirnamePath(toPath), { recursive: true });
7354
- await writeFile(toPath, raw, "utf8");
7308
+ await copyFile(fromPath, toPath);
7355
7309
  },
7356
7310
  mkdir: async (dirPath, options) => {
7357
7311
  await mkdir(dirPath, options);
@@ -7363,6 +7317,16 @@ function createLedgerIo() {
7363
7317
  await mkdir(dirnamePath(toPath), { recursive: true });
7364
7318
  await rename(fromPath, toPath);
7365
7319
  },
7320
+ syncPath: async (fileOrDirectoryPath) => {
7321
+ const isWindows = process.platform === "win32";
7322
+ if (isWindows && (await stat(fileOrDirectoryPath)).isDirectory()) return;
7323
+ const handle = await open(fileOrDirectoryPath, isWindows ? "r+" : "r");
7324
+ try {
7325
+ await handle.sync();
7326
+ } finally {
7327
+ await handle.close();
7328
+ }
7329
+ },
7366
7330
  rm: async (filePath, options) => {
7367
7331
  await rm(filePath, options);
7368
7332
  },
@@ -11266,7 +11230,8 @@ function parseDispatchTask(input) {
11266
11230
  });
11267
11231
  if (!(prompt && controllerSelection)) return null;
11268
11232
  const fallbackControllerSettings = createDefaultRuntimeAgentControllerSettings(controllerSelection.agentControllerRef);
11269
- const agentControllerConversationId = normalizeOptionalText$13(payload.agentControllerConversationId) ?? null;
11233
+ const agentControllerConversationId = resolveDispatchNativeConversationId(payload);
11234
+ if (!hasMatchingExecutionContextScope(payload, requiredFields)) return null;
11270
11235
  const deliveryRecoveryReason = resolveDeliveryRecoveryReason(payload);
11271
11236
  const executionTokenEcho = resolveExecutionTokenEcho(payload);
11272
11237
  if (!executionTokenEcho) return null;
@@ -11275,6 +11240,7 @@ function parseDispatchTask(input) {
11275
11240
  const contextIdMappingSpec = payload.contextIdMappingSpec ?? input.fallbackRouteConfig?.contextIdMappingSpec ?? fallbackControllerSettings.contextIdMappingSpec;
11276
11241
  return {
11277
11242
  ...requiredFields,
11243
+ executionContext: payload.executionContext,
11278
11244
  agentControllerConversationId,
11279
11245
  ...resolveDispatchSourceFiles(payload),
11280
11246
  ...controllerSelection,
@@ -11311,6 +11277,14 @@ function parseDispatchTask(input) {
11311
11277
  contextIdMappingSpec
11312
11278
  };
11313
11279
  }
11280
+ function hasMatchingExecutionContextScope(payload, required) {
11281
+ const context = payload.executionContext;
11282
+ return !context || context.scope.targetProfileId === required.targetProfileId && context.scope.spaceId === required.spaceId && context.scope.threadId === (payload.threadContext?.threadId ?? null);
11283
+ }
11284
+ function resolveDispatchNativeConversationId(payload) {
11285
+ if (payload.executionContext) return payload.executionContext.nativeConversationId;
11286
+ return normalizeOptionalText$13(payload.agentControllerConversationId) ?? null;
11287
+ }
11314
11288
  function resolveDispatchSourceFiles(payload) {
11315
11289
  return {
11316
11290
  attachments: payload.sourceSignalSnapshot?.attachments ?? [],
@@ -11560,7 +11534,7 @@ function renderMandatoryCompletionSection(input) {
11560
11534
  return [
11561
11535
  "Mandatory completion:",
11562
11536
  "- Plain text is not a Space reply.",
11563
- "- For shared text attachments, discover and use the dispatch tool read_file with the file ID and revision. It reads the current Space as you without requiring terminal access to local login files. A file read is not a final action.",
11537
+ "- Use supplied context first. Discover read_history for this Wake's bounded Space text, or read_file with a file ID and revision. Both dispatch tools read as you without local login files; neither completes the Wake.",
11564
11538
  buildMandatoryCompletionActionLine(publicationRequirement),
11565
11539
  "- Use the Space Action tool first. If your harness offers tool search or discovery, look up the required action before declaring it unavailable. A tool missing from the initial list is not proof of unavailability. Do not read setup or onboarding guides merely to submit this result.",
11566
11540
  ...publicationRequirement.allowedActions.includes("post_message") ? ["- For a plain reply, omit wakeTargets and referenceTargets. Add targets only for an intentional handoff or reference to another Agent; never copy incoming activation targets or wake yourself."] : [],
@@ -11660,14 +11634,14 @@ function renderContinuityLine(input) {
11660
11634
  if (input.higherAuthorityUpdates) parts.push("higher-authority updates: yes");
11661
11635
  if (parts.length === 0) return null;
11662
11636
  const sourceSignalId = normalizeOptionalText$13(input.sourceSignalId);
11663
- if (!sourceSignalId) return `- Since your last public reply: ${parts.join("; ")} (run \`${buildSpaceHistoryCommand(input)}\` for content)`;
11637
+ if (!sourceSignalId) return `- Since your last public reply: ${parts.join("; ")} (use dispatch tool \`read_history\` for bounded context; only if unavailable and terminal access is permitted, run \`${buildSpaceHistoryCommand(input)}\`)`;
11664
11638
  const readCommand = buildSpaceContextWindowCommand({
11665
11639
  cliEntry: input.cliEntry,
11666
11640
  sourceSignalId,
11667
11641
  spaceId: input.spaceId,
11668
11642
  targetProfileId: input.targetProfileId
11669
11643
  });
11670
- return `- Since your last public reply: ${parts.join("; ")} (run \`${readCommand}\` for bounded context)`;
11644
+ return `- Since your last public reply: ${parts.join("; ")} (use dispatch tool \`read_history\` for bounded context; only if unavailable and terminal access is permitted, run \`${readCommand}\`)`;
11671
11645
  }
11672
11646
  function shouldRenderReplyTargetLine(replyTarget) {
11673
11647
  return normalizeOptionalText$13(replyTarget) !== "the current source message";
@@ -13700,12 +13674,13 @@ async function probeOpenCodeReadiness(input) {
13700
13674
  let server = null;
13701
13675
  try {
13702
13676
  server = await startOpenCodeProbeServer({
13677
+ workingDirectory: input.workingDirectory,
13703
13678
  launchContract: input.launchContract,
13704
13679
  timeoutMs: input.timeoutMs ?? DEFAULT_PROBE_TIMEOUT_MS
13705
13680
  });
13706
13681
  const providerListResult = await rejectAfterTimeout(createOpencodeClient({
13707
13682
  baseUrl: server.url,
13708
- directory: process.cwd(),
13683
+ directory: input.workingDirectory,
13709
13684
  throwOnError: true
13710
13685
  }).provider.list(), SDK_READ_TIMEOUT_MS, `Timed out while reading OpenCode provider status after ${SDK_READ_TIMEOUT_MS}ms.`);
13711
13686
  const readiness = resolveOpenCodeReadinessFromProviderList(providerListResult.data);
@@ -13795,7 +13770,7 @@ async function startOpenCodeProbeServer(input) {
13795
13770
  });
13796
13771
  return new Promise((resolve, reject) => {
13797
13772
  const child = spawn(invocation.bin, invocation.args, {
13798
- cwd: process.cwd(),
13773
+ cwd: input.workingDirectory,
13799
13774
  detached: process.platform !== "win32",
13800
13775
  env: process.env,
13801
13776
  shell: invocation.shell ?? false,
@@ -14043,6 +14018,19 @@ function toErrorMessage$5(error) {
14043
14018
  return message.length > 0 ? message : "unknown error";
14044
14019
  }
14045
14020
  //#endregion
14021
+ //#region src/local-service/inventory/probe-working-directory.ts
14022
+ async function withProbeWorkingDirectory(probe) {
14023
+ const workingDirectory = await mkdtemp(join(tmpdir(), "openmeld-inventory-"));
14024
+ try {
14025
+ return await probe(await realpath(workingDirectory));
14026
+ } finally {
14027
+ await rm(workingDirectory, {
14028
+ force: true,
14029
+ recursive: true
14030
+ });
14031
+ }
14032
+ }
14033
+ //#endregion
14046
14034
  //#region src/local-service/inventory/runtime-provider-usage-limits.ts
14047
14035
  async function recordRuntimeProviderUsageLimits(input) {
14048
14036
  const commandPath = resolveLaunchContractCommandPath(input.launchContract);
@@ -14083,11 +14071,12 @@ const CONTROLLER_INTERFACE_SNAPSHOT_RESOLVERS = {
14083
14071
  };
14084
14072
  async function probeAgentControllerUsageObservationAuth(input) {
14085
14073
  if (input.agentId !== "claude-code") return { status: "unknown" };
14086
- return resolveClaudeAuthSnapshot(await runLaunchContractCommand({
14074
+ return resolveClaudeAuthSnapshot(await withProbeWorkingDirectory((workingDirectory) => runLaunchContractCommand({
14075
+ workingDirectory,
14087
14076
  allowNonZeroExit: true,
14088
14077
  args: ["auth", "status"],
14089
14078
  launchContract: input.launchContract
14090
- }));
14079
+ })));
14091
14080
  }
14092
14081
  async function resolveAgentControllerInterfaceSnapshot(input) {
14093
14082
  const checkedAt = (/* @__PURE__ */ new Date()).toISOString();
@@ -14151,10 +14140,12 @@ async function resolveAgentControllerInterfaceSnapshot(input) {
14151
14140
  });
14152
14141
  if (reusableSnapshot) return reusableSnapshot;
14153
14142
  }
14154
- const outcome = await snapshotResolver({
14143
+ const launchContract = input.state.launchContract;
14144
+ const outcome = await withProbeWorkingDirectory((workingDirectory) => snapshotResolver({
14155
14145
  baseSnapshot,
14156
- launchContract: input.state.launchContract
14157
- });
14146
+ launchContract,
14147
+ workingDirectory
14148
+ }));
14158
14149
  const commandFingerprintAfterProbe = await resolveAgentControllerCommandFingerprint({
14159
14150
  commandPath,
14160
14151
  launchContractKind
@@ -14362,7 +14353,7 @@ function parseSemverCore(value) {
14362
14353
  ];
14363
14354
  }
14364
14355
  async function resolveCodexInterfaceSnapshot(input) {
14365
- const appServerProbe = await probeCodexAppServer(input.launchContract);
14356
+ const appServerProbe = await probeCodexAppServer(input.launchContract, input.workingDirectory);
14366
14357
  if (appServerProbe.ok) {
14367
14358
  const version = appServerProbe.version ?? input.baseSnapshot.version;
14368
14359
  return {
@@ -14386,6 +14377,7 @@ async function resolveCodexInterfaceSnapshot(input) {
14386
14377
  };
14387
14378
  }
14388
14379
  const versionProbe = await runLaunchContractCommand({
14380
+ workingDirectory: input.workingDirectory,
14389
14381
  args: ["--version"],
14390
14382
  launchContract: input.launchContract
14391
14383
  });
@@ -14408,9 +14400,11 @@ async function resolveCodexInterfaceSnapshot(input) {
14408
14400
  }
14409
14401
  async function resolveClaudeCodeInterfaceSnapshot(input) {
14410
14402
  const [versionProbe, authProbe] = await Promise.all([runLaunchContractCommand({
14403
+ workingDirectory: input.workingDirectory,
14411
14404
  args: ["--version"],
14412
14405
  launchContract: input.launchContract
14413
14406
  }), runLaunchContractCommand({
14407
+ workingDirectory: input.workingDirectory,
14414
14408
  allowNonZeroExit: true,
14415
14409
  args: [
14416
14410
  "auth",
@@ -14449,9 +14443,11 @@ async function resolveClaudeCodeInterfaceSnapshot(input) {
14449
14443
  }
14450
14444
  async function resolveCursorInterfaceSnapshot(input) {
14451
14445
  const [versionProbe, authProbe] = await Promise.all([runLaunchContractCommand({
14446
+ workingDirectory: input.workingDirectory,
14452
14447
  args: ["--version"],
14453
14448
  launchContract: input.launchContract
14454
14449
  }), runLaunchContractCommand({
14450
+ workingDirectory: input.workingDirectory,
14455
14451
  allowNonZeroExit: true,
14456
14452
  args: [
14457
14453
  "status",
@@ -14490,11 +14486,12 @@ async function resolveCursorInterfaceSnapshot(input) {
14490
14486
  }
14491
14487
  async function resolveGrokBuildInterfaceSnapshot(input) {
14492
14488
  const [versionProbe, interfaceProbe] = await Promise.all([runLaunchContractCommand({
14489
+ workingDirectory: input.workingDirectory,
14493
14490
  args: ["--no-auto-update", "version"],
14494
14491
  launchContract: input.launchContract
14495
14492
  }), probeGrokBuildAcpInterface({
14496
14493
  grokBuildTimeoutMs: PROBE_TIMEOUT_MS,
14497
- grokBuildWorkdir: process.cwd(),
14494
+ grokBuildWorkdir: input.workingDirectory,
14498
14495
  launchContract: input.launchContract
14499
14496
  }).then((result) => ({
14500
14497
  ok: true,
@@ -14546,9 +14543,11 @@ async function resolveGrokBuildInterfaceSnapshot(input) {
14546
14543
  }
14547
14544
  async function resolveOpenClawInterfaceSnapshot(input) {
14548
14545
  const [versionProbe, authProbe] = await Promise.all([runLaunchContractCommand({
14546
+ workingDirectory: input.workingDirectory,
14549
14547
  args: ["--version"],
14550
14548
  launchContract: input.launchContract
14551
14549
  }), runLaunchContractCommand({
14550
+ workingDirectory: input.workingDirectory,
14552
14551
  allowNonZeroExit: true,
14553
14552
  args: [
14554
14553
  "models",
@@ -14579,9 +14578,11 @@ async function resolveOpenClawInterfaceSnapshot(input) {
14579
14578
  }
14580
14579
  async function resolveOpenCodeInterfaceSnapshot(input) {
14581
14580
  const [versionProbe, readinessProbe] = await Promise.all([runLaunchContractCommand({
14581
+ workingDirectory: input.workingDirectory,
14582
14582
  args: ["--version"],
14583
14583
  launchContract: input.launchContract
14584
14584
  }), probeOpenCodeReadiness({
14585
+ workingDirectory: input.workingDirectory,
14585
14586
  launchContract: input.launchContract,
14586
14587
  timeoutMs: PROBE_TIMEOUT_MS
14587
14588
  })]);
@@ -14611,6 +14612,7 @@ function runLaunchContractCommand(input) {
14611
14612
  launchContract: input.launchContract
14612
14613
  });
14613
14614
  return runCommand({
14615
+ workingDirectory: input.workingDirectory,
14614
14616
  allowNonZeroExit: input.allowNonZeroExit,
14615
14617
  args: invocation.args,
14616
14618
  bin: invocation.bin,
@@ -14621,7 +14623,7 @@ function runLaunchContractCommand(input) {
14621
14623
  function runCommand(input) {
14622
14624
  return new Promise((resolve) => {
14623
14625
  const child = spawn(input.bin, input.args, {
14624
- cwd: process.cwd(),
14626
+ cwd: input.workingDirectory,
14625
14627
  env: process.env,
14626
14628
  shell: input.shell ?? false,
14627
14629
  stdio: [
@@ -14687,7 +14689,7 @@ function runCommand(input) {
14687
14689
  });
14688
14690
  });
14689
14691
  }
14690
- function probeCodexAppServer(launchContract) {
14692
+ function probeCodexAppServer(launchContract, workingDirectory) {
14691
14693
  const invocation = buildCliLaunchInvocation({
14692
14694
  args: [
14693
14695
  "app-server",
@@ -14698,7 +14700,7 @@ function probeCodexAppServer(launchContract) {
14698
14700
  });
14699
14701
  return new Promise((resolve) => {
14700
14702
  const child = spawn(invocation.bin, invocation.args, {
14701
- cwd: process.cwd(),
14703
+ cwd: workingDirectory,
14702
14704
  env: process.env,
14703
14705
  shell: invocation.shell ?? false,
14704
14706
  stdio: [
@@ -14789,6 +14791,7 @@ function probeCodexAppServer(launchContract) {
14789
14791
  });
14790
14792
  });
14791
14793
  runCodexAppServerProbeRequests({
14794
+ workingDirectory,
14792
14795
  clearProbeTimeout: () => {
14793
14796
  clearTimeout(timeout);
14794
14797
  },
@@ -14813,7 +14816,7 @@ async function runCodexAppServerProbeRequests(input) {
14813
14816
  }
14814
14817
  });
14815
14818
  input.notify("initialized", {});
14816
- const skillsPromise = input.request("skills/list", { cwds: [process.cwd()] }).catch(() => null);
14819
+ const skillsPromise = input.request("skills/list", { cwds: [input.workingDirectory] }).catch(() => null);
14817
14820
  const modelsPromise = requestAllCodexModels(input.request).catch(() => []);
14818
14821
  const usageLimitsPromise = input.request("account/rateLimits/read", null).then((response) => projectCodexUsageLimits({
14819
14822
  observedAt: (/* @__PURE__ */ new Date()).toISOString(),
@@ -16584,7 +16587,10 @@ function resolveAdapterInterruptNote(input) {
16584
16587
  //#region src/local-service/carrier/local-execution-slots.ts
16585
16588
  function createDaemonLocalExecutionSlots(input) {
16586
16589
  return createLocalExecutionSlots({
16587
- limits: input.limits,
16590
+ limits: {
16591
+ ...input.limits,
16592
+ contextConcurrency: 5
16593
+ },
16588
16594
  onTaskDropped: (event) => {
16589
16595
  emitRunLine({
16590
16596
  presenter: input.presenter,
@@ -18520,11 +18526,27 @@ function buildForkedSessionTitle(profileName) {
18520
18526
  }
18521
18527
  //#endregion
18522
18528
  //#region src/local-service/session-control/session-fork-operation-store.ts
18523
- const STORE_SCHEMA = "openmeld-agent-session-fork-operation-store-v1";
18529
+ const STORE_SCHEMA = "openmeld-agent-session-fork-operation-store-v2";
18530
+ const LEGACY_STORE_SCHEMA = "openmeld-agent-session-fork-operation-store-v1";
18524
18531
  const RECORD_SCHEMA = "openmeld-agent-session-fork-operation-record-v1";
18525
18532
  const STORE_FILE_NAME = "agent-session-fork-operations.json";
18526
18533
  const STORE_TEMP_FILE_NAME = "agent-session-fork-operations.tmp";
18527
18534
  const MAX_RETAINED_RECORDS = 256;
18535
+ const contextForkRequestSchema = z.strictObject({
18536
+ kind: z.literal("execution_context"),
18537
+ operationId: z.string().uuid(),
18538
+ sourceNativeSessionId: z.string().min(1),
18539
+ completedHistoryId: z.string().min(1),
18540
+ workingDirectory: z.string().min(1)
18541
+ });
18542
+ const contextForkResultSchema = z.discriminatedUnion("status", [contextForkRequestSchema.extend({
18543
+ status: z.literal("completed"),
18544
+ childNativeSessionId: z.string().min(1)
18545
+ }), contextForkRequestSchema.extend({
18546
+ status: z.enum(["rejected", "outcome_unknown"]),
18547
+ reasonCode: z.string().min(1),
18548
+ message: z.string().min(1)
18549
+ })]);
18528
18550
  const storeTails = /* @__PURE__ */ new Map();
18529
18551
  async function runAgentSessionForkOperation(input) {
18530
18552
  const previous = storeTails.get(input.ledgerRootPath) ?? Promise.resolve();
@@ -18552,6 +18574,7 @@ async function runSerialized(input) {
18552
18574
  if (existing.requestFingerprint !== fingerprint) return rejected(input.request, "agent_session_fork.operation_identity_conflict", "This Fork operation id was already used for a different Session.");
18553
18575
  return existing.result ?? outcomeUnknown(input.request, "The provider Fork started, but no authoritative child Session id was recorded.");
18554
18576
  }
18577
+ if (records.filter((record) => record.result === null || record.result.status === "outcome_unknown").length >= MAX_RETAINED_RECORDS) return rejected(input.request, "agent_session_fork.unresolved_operation_limit", "Resolve uncertain fork operations before starting another fork.");
18555
18578
  const started = {
18556
18579
  operationId: input.request.operationId,
18557
18580
  requestFingerprint: fingerprint,
@@ -18567,7 +18590,7 @@ async function runSerialized(input) {
18567
18590
  let result;
18568
18591
  try {
18569
18592
  const forked = await input.execute();
18570
- result = runtimeTransportForkAgentSessionResultSchema.parse({
18593
+ result = parseForkOperationResult({
18571
18594
  ...input.request,
18572
18595
  childNativeSessionId: forked.childNativeSessionId,
18573
18596
  status: "completed"
@@ -18615,8 +18638,13 @@ async function readRecords(ledgerRootPath) {
18615
18638
  ok: false,
18616
18639
  reasonCode: "agent_session_fork.operation_store_invalid"
18617
18640
  };
18641
+ if ("schema" in parsed && parsed.schema === LEGACY_STORE_SCHEMA && "v" in parsed && parsed.v === 1) parsed = {
18642
+ ...parsed,
18643
+ schema: STORE_SCHEMA,
18644
+ v: 2
18645
+ };
18618
18646
  const candidate = parsed;
18619
- if (candidate.schema !== STORE_SCHEMA || candidate.v !== 1) return {
18647
+ if (candidate.schema !== STORE_SCHEMA || candidate.v !== 2) return {
18620
18648
  ok: false,
18621
18649
  reasonCode: "agent_session_fork.operation_store_update_required"
18622
18650
  };
@@ -18636,12 +18664,14 @@ async function writeRecords(ledgerRootPath, records) {
18636
18664
  mode: 448,
18637
18665
  recursive: true
18638
18666
  });
18639
- const retained = [...records].sort((left, right) => right.updatedAtMs - left.updatedAtMs).slice(0, MAX_RETAINED_RECORDS);
18667
+ const ordered = [...records].sort((left, right) => right.updatedAtMs - left.updatedAtMs);
18668
+ const unresolved = ordered.filter((record) => record.result === null || record.result.status === "outcome_unknown");
18669
+ const retained = [...unresolved, ...ordered.filter((record) => !unresolved.includes(record)).slice(0, Math.max(0, MAX_RETAINED_RECORDS - unresolved.length))];
18640
18670
  await writeFile(tempPath, `${JSON.stringify({
18641
18671
  records: retained,
18642
18672
  schema: STORE_SCHEMA,
18643
18673
  updatedAtMs: Date.now(),
18644
- v: 1
18674
+ v: 2
18645
18675
  }, null, 2)}\n`, {
18646
18676
  encoding: "utf8",
18647
18677
  mode: 384
@@ -18651,15 +18681,15 @@ async function writeRecords(ledgerRootPath, records) {
18651
18681
  function isOperationStore(value) {
18652
18682
  if (!(value && typeof value === "object")) return false;
18653
18683
  const candidate = value;
18654
- return candidate.schema === STORE_SCHEMA && candidate.v === 1 && Array.isArray(candidate.records) && candidate.records.every(isStoredOperation);
18684
+ return candidate.schema === STORE_SCHEMA && candidate.v === 2 && Array.isArray(candidate.records) && candidate.records.every(isStoredOperation);
18655
18685
  }
18656
18686
  function isStoredOperation(value) {
18657
18687
  if (!(value && typeof value === "object")) return false;
18658
18688
  const candidate = value;
18659
- return candidate.schema === RECORD_SCHEMA && typeof candidate.operationId === "string" && typeof candidate.requestFingerprint === "string" && typeof candidate.updatedAtMs === "number" && (candidate.result === null || runtimeTransportForkAgentSessionResultSchema.safeParse(candidate.result).success);
18689
+ return candidate.schema === RECORD_SCHEMA && typeof candidate.operationId === "string" && typeof candidate.requestFingerprint === "string" && typeof candidate.updatedAtMs === "number" && (candidate.result === null || runtimeTransportForkAgentSessionResultSchema.safeParse(candidate.result).success || contextForkResultSchema.safeParse(candidate.result).success);
18660
18690
  }
18661
18691
  function rejected(request, reasonCode, message) {
18662
- return runtimeTransportForkAgentSessionResultSchema.parse({
18692
+ return parseForkOperationResult({
18663
18693
  ...request,
18664
18694
  message,
18665
18695
  reasonCode,
@@ -18667,7 +18697,7 @@ function rejected(request, reasonCode, message) {
18667
18697
  });
18668
18698
  }
18669
18699
  function outcomeUnknown(request, message) {
18670
- return runtimeTransportForkAgentSessionResultSchema.parse({
18700
+ return parseForkOperationResult({
18671
18701
  ...request,
18672
18702
  message,
18673
18703
  reasonCode: "agent_session_fork.provider_outcome_unknown",
@@ -18677,6 +18707,9 @@ function outcomeUnknown(request, message) {
18677
18707
  function readErrorCode(error) {
18678
18708
  return error && typeof error === "object" && "code" in error ? String(error.code).trim() || null : null;
18679
18709
  }
18710
+ function parseForkOperationResult(value) {
18711
+ return value.kind === "execution_context" ? contextForkResultSchema.parse(value) : runtimeTransportForkAgentSessionResultSchema.parse(value);
18712
+ }
18680
18713
  function toErrorMessage$2(error) {
18681
18714
  return error instanceof Error ? error.message : String(error);
18682
18715
  }
@@ -18783,6 +18816,7 @@ async function prepareDispatchRuntimeExecution(input) {
18783
18816
  }
18784
18817
  //#endregion
18785
18818
  //#region src/local-service/execution/task-execution-error.ts
18819
+ const EXECUTION_CONTEXT_ERROR_PATTERN = /^execution_context\.[a-z_]+$/u;
18786
18820
  function toTaskExecutionError(error) {
18787
18821
  if (error instanceof DaemonServiceRunError) return {
18788
18822
  errorCode: error.code,
@@ -18791,6 +18825,11 @@ function toTaskExecutionError(error) {
18791
18825
  openClawGatewayVisibility: error.openClawGatewayVisibility,
18792
18826
  projectFailureContext: error.projectFailureContext
18793
18827
  };
18828
+ if (error instanceof Error && EXECUTION_CONTEXT_ERROR_PATTERN.test(error.message)) return {
18829
+ errorCode: error.message,
18830
+ errorType: "config",
18831
+ message: error.message
18832
+ };
18794
18833
  return {
18795
18834
  errorCode: "dispatch.execution_failed",
18796
18835
  errorType: "internal",
@@ -18800,6 +18839,16 @@ function toTaskExecutionError(error) {
18800
18839
  //#endregion
18801
18840
  //#region src/runtime/dispatch-space-action-context.ts
18802
18841
  const OPENMELD_SPACE_ACTION_CONTEXT_PATH_ENV = "OPENMELD_SPACE_ACTION_CONTEXT_PATH";
18842
+ /** The local action context is known expired/closed/mismatched: a new ordinary action must be rejected, never recorded. */
18843
+ var DispatchSpaceActionClosedError = class extends Error {
18844
+ receipt = "rejected_closed";
18845
+ reasonCode;
18846
+ constructor(reasonCode, message) {
18847
+ super(message);
18848
+ this.name = "DispatchSpaceActionClosedError";
18849
+ this.reasonCode = reasonCode;
18850
+ }
18851
+ };
18803
18852
  const DISPATCH_SPACE_ACTION_CONTEXT_VERSION = 1;
18804
18853
  const DISPATCH_SPACE_ACTION_RECORD_VERSION = 1;
18805
18854
  const DEFAULT_CONTEXT_TTL_MS = 720 * 60 * 1e3;
@@ -18840,6 +18889,11 @@ function createDispatchSpaceActionContext(input) {
18840
18889
  };
18841
18890
  }
18842
18891
  function readDispatchSpaceActionContextFromEnv(env = process.env) {
18892
+ const context = readDispatchSpaceActionContextForReceiptFromEnv(env);
18893
+ assertContextActive(context, Date.now());
18894
+ return context;
18895
+ }
18896
+ function readDispatchSpaceActionContextForReceiptFromEnv(env = process.env) {
18843
18897
  const contextPath = normalizeOptionalText$7(env[OPENMELD_SPACE_ACTION_CONTEXT_PATH_ENV]);
18844
18898
  if (!contextPath) throw new Error("No active OpenMeld Space Action dispatch context was found. Use this command inside an OpenMeld Space Wake dispatch.");
18845
18899
  const context = readDispatchSpaceActionContext(contextPath);
@@ -18847,17 +18901,19 @@ function readDispatchSpaceActionContextFromEnv(env = process.env) {
18847
18901
  context,
18848
18902
  env
18849
18903
  });
18850
- assertContextActive(context, Date.now());
18851
18904
  return context;
18852
18905
  }
18853
18906
  function readDispatchSpaceActionContext(contextPath) {
18854
18907
  return parseDispatchSpaceActionContext(readJsonFile(contextPath));
18855
18908
  }
18856
18909
  function writeDispatchSpaceActionRecord(input) {
18857
- assertContextActive(input.context, input.nowMs ?? Date.now());
18858
18910
  const parsedAction = openMeldSpaceEgressActionSchema.safeParse(input.action);
18859
18911
  if (!parsedAction.success) throw parsedAction.error;
18860
18912
  if (isSelfWakeSpaceAction(parsedAction.data, input.context.targetProfileId)) throw new Error("An Agent cannot Wake itself. To reply to the current message, omit wakeTargets (CLI: --wake) and submit the reply again. No action was recorded.");
18913
+ const existing = readDispatchSpaceActionRecord({ context: input.context });
18914
+ if (existing.status === "invalid") throw new Error(existing.errorMessage);
18915
+ if (existing.status === "loaded" && isDeepStrictEqual(existing.record.action, parsedAction.data)) return existing.record;
18916
+ assertContextActive(input.context, input.nowMs ?? Date.now());
18861
18917
  const record = {
18862
18918
  version: DISPATCH_SPACE_ACTION_RECORD_VERSION,
18863
18919
  action: parsedAction.data,
@@ -18938,10 +18994,10 @@ function assertDispatchRuntimeEnvMatchesContext(input) {
18938
18994
  if (normalizeOptionalText$7(input.env["OPENMELD_DISPATCH_RUNTIME_MODE"]) !== "dispatch-owned-runtime") return;
18939
18995
  const envDispatchId = normalizeOptionalText$7(input.env[OPENMELD_DISPATCH_RUNTIME_DISPATCH_ID_ENV]);
18940
18996
  if (!envDispatchId) throw new Error("OpenMeld Space Action dispatch runtime is missing the active dispatch ID.");
18941
- if (envDispatchId !== input.context.dispatchId) throw new Error("OpenMeld Space Action dispatch context does not match the active dispatch runtime.");
18997
+ if (envDispatchId !== input.context.dispatchId) throw new DispatchSpaceActionClosedError("space_action.context_mismatch", "OpenMeld Space Action dispatch context does not match the active dispatch runtime.");
18942
18998
  const envTargetProfileId = normalizeOptionalText$7(input.env[OPENMELD_DISPATCH_RUNTIME_TARGET_PROFILE_ID_ENV]);
18943
18999
  if (!envTargetProfileId) throw new Error("OpenMeld Space Action dispatch runtime is missing the active target profile ID.");
18944
- if (envTargetProfileId !== input.context.targetProfileId) throw new Error("OpenMeld Space Action target profile does not match the active dispatch runtime.");
19000
+ if (envTargetProfileId !== input.context.targetProfileId) throw new DispatchSpaceActionClosedError("space_action.context_mismatch", "OpenMeld Space Action target profile does not match the active dispatch runtime.");
18945
19001
  }
18946
19002
  function parseDispatchSpaceActionRecord(value) {
18947
19003
  const record = toRecord$1(value, "OpenMeld Space Action record");
@@ -18990,7 +19046,7 @@ function parseSpaceContractSnapshot(value) {
18990
19046
  };
18991
19047
  }
18992
19048
  function assertContextActive(context, nowMs) {
18993
- if (nowMs > context.expiresAtMs) throw new Error("The OpenMeld Space Action dispatch context has expired.");
19049
+ if (nowMs > context.expiresAtMs) throw new DispatchSpaceActionClosedError("space_action.context_expired", "The OpenMeld Space Action dispatch context has expired.");
18994
19050
  }
18995
19051
  function readJsonFile(path) {
18996
19052
  return JSON.parse(readFileSync(path, "utf8"));
@@ -20638,6 +20694,710 @@ function coerceRuntimeResultToStructuredActionFailure$1(input) {
20638
20694
  };
20639
20695
  }
20640
20696
  //#endregion
20697
+ //#region src/local-service/dispatch/execution-context-workspace.ts
20698
+ const execFileAsync = promisify(execFile);
20699
+ const syncDirectory = createLedgerIo().syncPath;
20700
+ const COMMIT_PATTERN = /^(?:[a-f0-9]{40}|[a-f0-9]{64})$/u;
20701
+ const manifestSchema = z.strictObject({
20702
+ version: z.union([z.literal(1), z.literal(2)]),
20703
+ identity: executionContextAssignmentSchema,
20704
+ sourceWorkingDirectory: z.string().nullable(),
20705
+ baseCommit: z.string().regex(COMMIT_PATTERN).nullable(),
20706
+ boundaryRoot: z.string(),
20707
+ workingDirectory: z.string(),
20708
+ status: z.enum([
20709
+ "preparing",
20710
+ "restoring",
20711
+ "completed",
20712
+ "in_use",
20713
+ "retiring",
20714
+ "released"
20715
+ ]),
20716
+ pristineFingerprint: z.string().regex(/^[a-f0-9]{64}$/u).optional(),
20717
+ copiedUncommittedFiles: z.literal(false),
20718
+ processSupervisionId: z.uuid().optional(),
20719
+ retirement: z.strictObject({
20720
+ path: z.string(),
20721
+ pristineFingerprint: z.string().regex(/^[a-f0-9]{64}$/u)
20722
+ }).optional()
20723
+ }).refine((manifest) => manifest.version === 2 || (manifest.status === "preparing" || manifest.status === "completed") && !manifest.pristineFingerprint && !manifest.processSupervisionId && !manifest.retirement).refine((manifest) => manifest.identity.access === "space_context" ? manifest.sourceWorkingDirectory === null && manifest.baseCommit === null : manifest.sourceWorkingDirectory !== null && isAbsolute(manifest.sourceWorkingDirectory) && manifest.baseCommit !== null && manifest.identity.workspace === "isolated");
20724
+ async function prepareExecutionContextWorkspace(input) {
20725
+ const parsed = executionContextTaskSchema.safeParse(input.context);
20726
+ if (!parsed.success) throw failure("invalid_workspace_context");
20727
+ const { nativeConversationId, runtimeWorkspaceFingerprint } = parsed.data;
20728
+ const identity = executionContextAssignmentSchema.strip().parse(parsed.data);
20729
+ const source = identity.access !== "space_context" ? await canonicalDirectory(input.currentWorkingDirectory) : null;
20730
+ if (source) {
20731
+ assertSourceAllowed(source, input.policy);
20732
+ if (identity.workspace === "current") return {
20733
+ workingDirectory: source,
20734
+ boundaryRoot: source
20735
+ };
20736
+ }
20737
+ const ledgerRoot = await ensureDirectory(input.ledgerRootPath, true);
20738
+ const workspaceRoot = await ensureDirectory(join(ledgerRoot, "execution-context-workspaces"));
20739
+ const recordsRoot = await ensureDirectory(join(ledgerRoot, "execution-context-workspace-records"));
20740
+ const boundaryRoot = join(workspaceRoot, identity.id);
20741
+ const workingDirectory = source ? join(boundaryRoot, "worktree") : boundaryRoot;
20742
+ const recordPath = join(recordsRoot, `${identity.id}.json`);
20743
+ return await withWorkspaceLock(ledgerRoot, identity.id, async () => {
20744
+ const stored = await readManifest(recordPath);
20745
+ if (stored) {
20746
+ if (JSON.stringify(stored.identity) !== JSON.stringify(identity) || stored.sourceWorkingDirectory !== source || stored.boundaryRoot !== boundaryRoot || stored.workingDirectory !== workingDirectory) throw failure("workspace_identity_mismatch");
20747
+ await reconcileRetainedWorkspace(stored, recordPath, Boolean(runtimeWorkspaceFingerprint || nativeConversationId), ledgerRoot);
20748
+ return await verifyRetainedWorkspace(stored);
20749
+ }
20750
+ if (runtimeWorkspaceFingerprint || nativeConversationId) throw failure("workspace_record_missing");
20751
+ if (await inspectPath(boundaryRoot)) throw failure("workspace_already_exists");
20752
+ const baseCommit = source ? await resolveSourceCommit(source) : null;
20753
+ const manifest = {
20754
+ version: 2,
20755
+ identity,
20756
+ sourceWorkingDirectory: source,
20757
+ baseCommit,
20758
+ boundaryRoot,
20759
+ workingDirectory,
20760
+ status: "preparing",
20761
+ copiedUncommittedFiles: false,
20762
+ processSupervisionId: randomUUID()
20763
+ };
20764
+ await writeManifest(recordPath, manifest, "wx");
20765
+ await finishWorkspacePreparation(manifest, recordPath, true);
20766
+ return workspaceResult(manifest);
20767
+ });
20768
+ }
20769
+ async function reconcileRetainedWorkspace(record, path, hasNativeIdentity, ledgerRoot) {
20770
+ if (record.status === "retiring") await runWithHeldLock({
20771
+ lock: await acquireWorkspaceExecutionLock(ledgerRoot, record.identity.id),
20772
+ run: async () => {
20773
+ if (!record.processSupervisionId || (await listAgentControllerSupervisedProcessIds({
20774
+ fresh: true,
20775
+ processId: null,
20776
+ supervisionId: record.processSupervisionId
20777
+ })).length > 0) throw failure("workspace_execution_quiescence_unconfirmed");
20778
+ const reconciled = await finishWorkspaceRetirement(record, path);
20779
+ if (reconciled.status === "released") await restoreReleasedWorkspace(reconciled, path);
20780
+ }
20781
+ });
20782
+ else if (record.status === "released") await restoreReleasedWorkspace(record, path);
20783
+ else if (record.status === "preparing" || record.status === "restoring") {
20784
+ if (record.status === "preparing" && hasNativeIdentity) throw failure("workspace_creation_incomplete");
20785
+ if (!record.processSupervisionId || (await listAgentControllerSupervisedProcessIds({
20786
+ fresh: true,
20787
+ processId: null,
20788
+ supervisionId: record.processSupervisionId
20789
+ })).length > 0) throw failure("workspace_preparation_quiescence_unconfirmed");
20790
+ await finishWorkspacePreparation(record, path);
20791
+ } else if (record.status === "in_use") await runWithHeldLock({
20792
+ lock: await acquireWorkspaceExecutionLock(ledgerRoot, record.identity.id),
20793
+ run: async () => {
20794
+ if (!record.processSupervisionId || (await listAgentControllerSupervisedProcessIds({
20795
+ fresh: true,
20796
+ processId: null,
20797
+ supervisionId: record.processSupervisionId
20798
+ })).length > 0) throw failure("workspace_execution_quiescence_unconfirmed");
20799
+ await verifyRetainedWorkspace(record);
20800
+ await writeManifest(path, {
20801
+ ...record,
20802
+ status: "completed"
20803
+ }, "r+");
20804
+ }
20805
+ });
20806
+ }
20807
+ async function finishWorkspacePreparation(manifest, recordPath, pristineCreation = false) {
20808
+ const { boundaryRoot, workingDirectory, sourceWorkingDirectory: source, baseCommit } = manifest;
20809
+ await ensureDirectory(boundaryRoot);
20810
+ const repository = join(boundaryRoot, "repository.git");
20811
+ if (source && baseCommit) {
20812
+ if (!await inspectPath(repository)) {
20813
+ if ((await readdir(boundaryRoot)).length > 0) throw failure("workspace_creation_incomplete");
20814
+ await git(boundaryRoot, [
20815
+ "init",
20816
+ "--bare",
20817
+ "--template=",
20818
+ `--object-format=${baseCommit.length === 64 ? "sha256" : "sha1"}`,
20819
+ repository
20820
+ ], manifest.processSupervisionId);
20821
+ }
20822
+ await canonicalDirectory(repository);
20823
+ await assertPrivateMetadata(repository);
20824
+ if ((await readdir(boundaryRoot)).some((name) => name !== "repository.git" && name !== "worktree")) throw failure("workspace_creation_incomplete");
20825
+ if (await inspectPath(join(repository, "objects", "info", "alternates"))) throw failure("workspace_git_metadata_changed");
20826
+ if (!await inspectPath(workingDirectory)) {
20827
+ await git(boundaryRoot, [
20828
+ `--git-dir=${repository}`,
20829
+ "fetch",
20830
+ "--no-tags",
20831
+ "--no-recurse-submodules",
20832
+ "--depth=1",
20833
+ "--no-write-fetch-head",
20834
+ source,
20835
+ `${baseCommit}:refs/openmeld/base`
20836
+ ], manifest.processSupervisionId);
20837
+ await git(boundaryRoot, [
20838
+ `--git-dir=${repository}`,
20839
+ "worktree",
20840
+ "add",
20841
+ "--detach",
20842
+ workingDirectory,
20843
+ baseCommit
20844
+ ], manifest.processSupervisionId);
20845
+ }
20846
+ await verifyOwnedRepository(manifest);
20847
+ await finishMissingCheckoutFiles(manifest);
20848
+ if (!await isUnchangedCheckout(manifest)) throw failure("workspace_creation_incomplete");
20849
+ } else if ((await readdir(boundaryRoot)).length > 0) throw failure("workspace_creation_incomplete");
20850
+ await writeManifest(recordPath, {
20851
+ ...manifest,
20852
+ status: "completed",
20853
+ pristineFingerprint: pristineCreation ? await fingerprintDirectory(boundaryRoot) : void 0
20854
+ }, "r+");
20855
+ }
20856
+ async function readExecutionContextWorkspace(input) {
20857
+ if (!executionContextAssignmentSchema.shape.id.safeParse(input.contextId).success) throw failure("invalid_workspace_context");
20858
+ if (!await inspectPath(input.ledgerRootPath)) return null;
20859
+ const ledgerRoot = await canonicalDirectory(input.ledgerRootPath);
20860
+ const recordsRoot = join(ledgerRoot, "execution-context-workspace-records");
20861
+ if (!await inspectPath(recordsRoot)) return null;
20862
+ await canonicalDirectory(recordsRoot);
20863
+ const manifest = await readManifest(join(recordsRoot, `${input.contextId}.json`));
20864
+ if (!manifest) return null;
20865
+ const boundaryRoot = join(await canonicalDirectory(join(ledgerRoot, "execution-context-workspaces")), input.contextId);
20866
+ const workingDirectory = manifest.identity.access !== "space_context" ? join(boundaryRoot, "worktree") : boundaryRoot;
20867
+ if (manifest.identity.id !== input.contextId || manifest.boundaryRoot !== boundaryRoot || manifest.workingDirectory !== workingDirectory) throw failure("workspace_identity_mismatch");
20868
+ if (manifest.status === "released" || manifest.status === "retiring") return workspaceResult(manifest);
20869
+ if (manifest.status === "preparing" || manifest.status === "restoring") throw failure("workspace_creation_incomplete");
20870
+ return await verifyRetainedWorkspace(manifest);
20871
+ }
20872
+ async function markExecutionContextWorkspaceInUse(input) {
20873
+ const context = input.context;
20874
+ if (!context || context.workspace !== "isolated" || context.access === "space_context") return null;
20875
+ const root = await canonicalDirectory(input.ledgerRootPath);
20876
+ const lock = await acquireWorkspaceExecutionLock(root, context.id);
20877
+ const processSupervisionId = randomUUID();
20878
+ try {
20879
+ await withWorkspaceLock(root, context.id, async () => {
20880
+ await readExecutionContextWorkspace({
20881
+ ledgerRootPath: root,
20882
+ contextId: context.id
20883
+ });
20884
+ const path = join(root, "execution-context-workspace-records", `${context.id}.json`);
20885
+ const record = await readManifest(path);
20886
+ if (record?.status !== "completed") throw failure("workspace_execution_quiescence_unconfirmed");
20887
+ await writeManifest(path, {
20888
+ ...record,
20889
+ status: "in_use",
20890
+ processSupervisionId
20891
+ }, "r+");
20892
+ });
20893
+ return {
20894
+ lock,
20895
+ processSupervisionId
20896
+ };
20897
+ } catch (error) {
20898
+ await releaseLock(lock);
20899
+ throw error;
20900
+ }
20901
+ }
20902
+ async function releaseExecutionContextWorkspace(input) {
20903
+ const root = await canonicalDirectory(input.ledgerRootPath);
20904
+ try {
20905
+ return await withWorkspaceLock(root, input.context.id, async () => {
20906
+ await readExecutionContextWorkspace({
20907
+ ledgerRootPath: root,
20908
+ contextId: input.context.id
20909
+ });
20910
+ const path = join(root, "execution-context-workspace-records", `${input.context.id}.json`);
20911
+ let record = await readManifest(path);
20912
+ if (!(record && ["completed", "in_use"].includes(record.status))) throw failure("workspace_creation_incomplete");
20913
+ if (!input.ownedProcessesQuiescent) return {
20914
+ status: "retained",
20915
+ reason: "execution_quiescence_unconfirmed"
20916
+ };
20917
+ const completed = {
20918
+ ...record,
20919
+ status: "completed"
20920
+ };
20921
+ await writeManifest(path, completed, "r+");
20922
+ record = await removePristineRetirement(completed, path);
20923
+ if (record.retirement) return {
20924
+ status: "retained",
20925
+ reason: "cleanup_incomplete"
20926
+ };
20927
+ if (!record.pristineFingerprint) return {
20928
+ status: "retained",
20929
+ reason: "baseline_unverified"
20930
+ };
20931
+ await verifyRetainedWorkspace(record);
20932
+ if (await fingerprintDirectory(record.boundaryRoot) !== record.pristineFingerprint) return {
20933
+ status: "retained",
20934
+ reason: "workspace_changed"
20935
+ };
20936
+ if (record.sourceWorkingDirectory && !await sourceHasCommit(record)) return {
20937
+ status: "retained",
20938
+ reason: "source_commit_unavailable"
20939
+ };
20940
+ return (await retirePristineWorkspace(record, path)).status === "released" ? { status: "released" } : {
20941
+ status: "retained",
20942
+ reason: "workspace_changed"
20943
+ };
20944
+ });
20945
+ } finally {
20946
+ if (input.use) await releaseLock(input.use.lock);
20947
+ }
20948
+ }
20949
+ async function retirePristineWorkspace(record, recordPath) {
20950
+ if (!record.pristineFingerprint || await fingerprintDirectory(record.boundaryRoot) !== record.pristineFingerprint) throw failure("workspace_release_incomplete");
20951
+ const retiring = {
20952
+ ...record,
20953
+ status: "retiring",
20954
+ retirement: {
20955
+ path: `${recordPath}.retired-${randomUUID()}`,
20956
+ pristineFingerprint: record.pristineFingerprint
20957
+ }
20958
+ };
20959
+ await writeManifest(recordPath, retiring, "r+");
20960
+ return await finishWorkspaceRetirement(retiring, recordPath);
20961
+ }
20962
+ async function finishWorkspaceRetirement(record, recordPath) {
20963
+ const retirement = record.retirement;
20964
+ if (!retirement) throw failure("workspace_release_incomplete");
20965
+ const live = await inspectPath(record.boundaryRoot);
20966
+ const retired = await inspectPath(retirement.path);
20967
+ if (live && retired || !(live || retired)) throw failure("workspace_release_incomplete");
20968
+ if (live) await moveWorkspace(record.boundaryRoot, retirement.path);
20969
+ if (await fingerprintDirectory(retirement.path) !== retirement.pristineFingerprint) {
20970
+ if (await inspectPath(record.boundaryRoot)) throw failure("workspace_release_incomplete");
20971
+ await moveWorkspace(retirement.path, record.boundaryRoot);
20972
+ const retained = {
20973
+ ...record,
20974
+ retirement: void 0,
20975
+ status: "completed"
20976
+ };
20977
+ await writeManifest(recordPath, retained, "r+");
20978
+ return retained;
20979
+ }
20980
+ const released = {
20981
+ ...record,
20982
+ status: "released"
20983
+ };
20984
+ await writeManifest(recordPath, released, "r+");
20985
+ return await removePristineRetirement(released, recordPath);
20986
+ }
20987
+ async function removePristineRetirement(record, recordPath) {
20988
+ const retirement = record.retirement;
20989
+ if (!retirement) return record;
20990
+ if (await inspectPath(retirement.path)) {
20991
+ if (await fingerprintDirectory(retirement.path) !== retirement.pristineFingerprint) return record;
20992
+ await rm(retirement.path, { recursive: true });
20993
+ }
20994
+ const removed = {
20995
+ ...record,
20996
+ retirement: void 0
20997
+ };
20998
+ await writeManifest(recordPath, removed, "r+");
20999
+ return removed;
21000
+ }
21001
+ async function restoreReleasedWorkspace(record, recordPath) {
21002
+ if (record.sourceWorkingDirectory && !await sourceHasCommit(record)) throw failure("workspace_base_commit_unavailable");
21003
+ if (await inspectPath(record.boundaryRoot)) throw failure("workspace_already_exists");
21004
+ const restoring = {
21005
+ ...record,
21006
+ status: "restoring",
21007
+ processSupervisionId: randomUUID()
21008
+ };
21009
+ await writeManifest(recordPath, restoring, "r+");
21010
+ await finishWorkspacePreparation(restoring, recordPath, true);
21011
+ }
21012
+ async function sourceHasCommit(record) {
21013
+ if (!(record.sourceWorkingDirectory && record.baseCommit)) return false;
21014
+ try {
21015
+ await git(record.sourceWorkingDirectory, [
21016
+ "cat-file",
21017
+ "-e",
21018
+ `${record.baseCommit}^{commit}`
21019
+ ]);
21020
+ return true;
21021
+ } catch {
21022
+ return false;
21023
+ }
21024
+ }
21025
+ async function isUnchangedCheckout(record) {
21026
+ return await git(record.workingDirectory, ["rev-parse", "HEAD"]) === record.baseCommit && await git(record.workingDirectory, [
21027
+ "status",
21028
+ "--porcelain",
21029
+ "--untracked-files=all",
21030
+ "--ignored"
21031
+ ]) === "";
21032
+ }
21033
+ async function finishMissingCheckoutFiles(record) {
21034
+ if (await git(record.workingDirectory, ["rev-parse", "HEAD"]) !== record.baseCommit) throw failure("workspace_creation_incomplete");
21035
+ if ((await git(record.workingDirectory, [
21036
+ "ls-files",
21037
+ "-v",
21038
+ "-z"
21039
+ ])).split("\0").some((entry) => entry && !entry.startsWith("H "))) throw failure("workspace_creation_incomplete");
21040
+ const status = await git(record.workingDirectory, [
21041
+ "status",
21042
+ "--porcelain",
21043
+ "-z",
21044
+ "--untracked-files=all",
21045
+ "--ignored"
21046
+ ]);
21047
+ if (!status) return;
21048
+ const changes = status.split("\0").filter(Boolean);
21049
+ if (changes.some((entry) => !entry.startsWith(" D "))) throw failure("workspace_creation_incomplete");
21050
+ const paths = changes.map((entry) => entry.slice(3));
21051
+ for (let offset = 0; offset < paths.length; offset += 100) await git(record.workingDirectory, [
21052
+ "checkout-index",
21053
+ "--",
21054
+ ...paths.slice(offset, offset + 100)
21055
+ ], record.processSupervisionId);
21056
+ }
21057
+ async function fingerprintDirectory(root) {
21058
+ const hash = createHash("sha256");
21059
+ const visit = async (directory) => {
21060
+ for (const name of (await readdir(directory)).sort()) {
21061
+ const path = join(directory, name);
21062
+ const info = await lstat(path);
21063
+ hash.update(JSON.stringify([
21064
+ relative(root, path),
21065
+ info.mode,
21066
+ info.nlink
21067
+ ]));
21068
+ if (info.isSymbolicLink()) hash.update(JSON.stringify(await readlink(path)));
21069
+ else if (info.isDirectory()) await visit(path);
21070
+ else if (info.isFile() && info.nlink === 1) {
21071
+ hash.update(String(info.size));
21072
+ hash.update(await fingerprintFile(path));
21073
+ } else throw failure("workspace_git_metadata_changed");
21074
+ }
21075
+ };
21076
+ await visit(root);
21077
+ return hash.digest("hex");
21078
+ }
21079
+ async function fingerprintFile(path) {
21080
+ const hash = createHash("sha256");
21081
+ const file = await open(path, "r");
21082
+ try {
21083
+ const buffer = Buffer.alloc(64 * 1024);
21084
+ for (;;) {
21085
+ const { bytesRead } = await file.read(buffer);
21086
+ if (!bytesRead) break;
21087
+ hash.update(buffer.subarray(0, bytesRead));
21088
+ }
21089
+ } finally {
21090
+ await file.close();
21091
+ }
21092
+ return hash.digest("hex");
21093
+ }
21094
+ async function withWorkspaceLock(root, contextId, run) {
21095
+ if (!executionContextAssignmentSchema.shape.id.safeParse(contextId).success) throw failure("invalid_workspace_context");
21096
+ return await runWithHeldLock({
21097
+ lock: await acquireLock({
21098
+ openMeldProfileId: "execution-context-workspaces",
21099
+ key: contextId,
21100
+ pathResolution: { env: { OPENMELD_HOME: root } }
21101
+ }),
21102
+ run
21103
+ });
21104
+ }
21105
+ async function verifyRetainedWorkspace(manifest) {
21106
+ await canonicalDirectory(manifest.boundaryRoot);
21107
+ await canonicalDirectory(manifest.workingDirectory);
21108
+ if (manifest.sourceWorkingDirectory) await verifyOwnedRepository(manifest);
21109
+ return workspaceResult(manifest);
21110
+ }
21111
+ async function acquireWorkspaceExecutionLock(root, contextId) {
21112
+ return await acquireLock({
21113
+ openMeldProfileId: "execution-context-workspaces",
21114
+ key: `${contextId}-execution`,
21115
+ pathResolution: { env: { OPENMELD_HOME: root } }
21116
+ });
21117
+ }
21118
+ function workspaceResult(manifest) {
21119
+ return {
21120
+ workingDirectory: manifest.workingDirectory,
21121
+ boundaryRoot: manifest.boundaryRoot,
21122
+ ...manifest.sourceWorkingDirectory ? { sourceWorkingDirectory: manifest.sourceWorkingDirectory } : {},
21123
+ ...manifest.baseCommit ? { baseCommit: manifest.baseCommit } : {}
21124
+ };
21125
+ }
21126
+ function assertSourceAllowed(source, policy) {
21127
+ if (policy.mode === "only_selected_folders" && !policy.folders.some((folder) => within(source, folder))) throw failure("workspace_outside_computer_policy");
21128
+ if (policy.mode === "block_selected_folders" && policy.folders.some((folder) => within(source, folder) || within(folder, source))) throw failure("workspace_overlaps_blocked_folder");
21129
+ }
21130
+ async function resolveSourceCommit(source) {
21131
+ if (!await inspectPath(join(source, ".git"))) throw failure("project_repository_required");
21132
+ if (await realpath(await git(source, ["rev-parse", "--show-toplevel"])) !== source) throw failure("project_repository_root_required");
21133
+ const commit = await git(source, [
21134
+ "rev-parse",
21135
+ "--verify",
21136
+ "HEAD^{commit}"
21137
+ ]).catch((cause) => {
21138
+ throw new Error("execution_context.project_commit_required", { cause });
21139
+ });
21140
+ if (!COMMIT_PATTERN.test(commit)) throw failure("project_commit_required");
21141
+ return commit;
21142
+ }
21143
+ async function verifyOwnedRepository(manifest) {
21144
+ const repository = join(manifest.boundaryRoot, "repository.git");
21145
+ await canonicalDirectory(repository);
21146
+ await assertPrivateMetadata(repository);
21147
+ if (await inspectPath(join(repository, "objects", "info", "alternates"))) throw failure("workspace_git_metadata_changed");
21148
+ const gitFile = join(manifest.workingDirectory, ".git");
21149
+ const gitFileInfo = await inspectPath(gitFile);
21150
+ if (!gitFileInfo?.isFile() || gitFileInfo.size > 4096) throw failure("workspace_git_metadata_changed");
21151
+ const expectedGitDir = join(repository, "worktrees", "worktree");
21152
+ if ((await readFile(gitFile, "utf8")).trim() !== `gitdir: ${expectedGitDir}`) throw failure("workspace_git_metadata_changed");
21153
+ if (await realpath(join(expectedGitDir, (await readFile(join(expectedGitDir, "commondir"), "utf8")).trim())) !== repository) throw failure("workspace_git_metadata_changed");
21154
+ if (await git(manifest.boundaryRoot, [
21155
+ `--git-dir=${repository}`,
21156
+ "rev-parse",
21157
+ "--verify",
21158
+ "refs/openmeld/base^{commit}"
21159
+ ]) !== manifest.baseCommit) throw failure("workspace_base_commit_changed");
21160
+ }
21161
+ async function assertPrivateMetadata(path) {
21162
+ for (const entry of await readdir(path, { withFileTypes: true })) {
21163
+ if (entry.isSymbolicLink()) throw failure("workspace_is_symlink");
21164
+ if (entry.isDirectory()) await assertPrivateMetadata(join(path, entry.name));
21165
+ else if ((await lstat(join(path, entry.name))).nlink !== 1) throw failure("workspace_git_metadata_changed");
21166
+ }
21167
+ }
21168
+ async function readManifest(path) {
21169
+ const info = await inspectPath(path);
21170
+ if (!info) return null;
21171
+ if (!info.isFile() || info.size > 32768) throw failure("workspace_record_invalid");
21172
+ let content;
21173
+ try {
21174
+ content = JSON.parse(await readFile(path, "utf8"));
21175
+ } catch {
21176
+ throw failure("workspace_record_invalid");
21177
+ }
21178
+ const parsed = manifestSchema.safeParse(content);
21179
+ if (!parsed.success) throw failure("workspace_record_invalid");
21180
+ const retirement = parsed.data.retirement;
21181
+ const prefix = `${path}.retired-`;
21182
+ if (parsed.data.status === "retiring" && !retirement || retirement && !(retirement.path.startsWith(prefix) && z.uuid().safeParse(retirement.path.slice(prefix.length)).success)) throw failure("workspace_record_invalid");
21183
+ return parsed.data;
21184
+ }
21185
+ async function writeManifest(path, manifest, flags) {
21186
+ const temporaryPath = flags === "wx" ? path : `${path}.${randomUUID()}.tmp`;
21187
+ const file = await open(temporaryPath, "wx", 384);
21188
+ try {
21189
+ await file.writeFile(`${JSON.stringify({
21190
+ ...manifest,
21191
+ version: 2
21192
+ })}\n`, "utf8");
21193
+ await file.sync();
21194
+ } finally {
21195
+ await file.close();
21196
+ }
21197
+ if (flags !== "wx") await rename(temporaryPath, path);
21198
+ await syncDirectory(dirname(path));
21199
+ }
21200
+ async function moveWorkspace(from, to) {
21201
+ await rename(from, to);
21202
+ await syncDirectory(dirname(from));
21203
+ await syncDirectory(dirname(to));
21204
+ }
21205
+ async function inspectPath(path) {
21206
+ const info = await lstat(path).catch((error) => {
21207
+ if (error.code === "ENOENT") return null;
21208
+ throw error;
21209
+ });
21210
+ if (info?.isSymbolicLink()) throw failure("workspace_is_symlink");
21211
+ return info;
21212
+ }
21213
+ async function canonicalDirectory(path) {
21214
+ if (!(await inspectPath(path))?.isDirectory()) throw failure("workspace_directory_unavailable");
21215
+ return await realpath(path);
21216
+ }
21217
+ async function ensureDirectory(path, recursive = false) {
21218
+ await inspectPath(path);
21219
+ await mkdir(path, {
21220
+ recursive,
21221
+ mode: 448
21222
+ }).catch((error) => {
21223
+ if (error.code !== "EEXIST") throw error;
21224
+ });
21225
+ return await canonicalDirectory(path);
21226
+ }
21227
+ function within(child, parent) {
21228
+ const path = relative(resolve(parent), child);
21229
+ return path === "" || path !== ".." && !path.startsWith(`..${sep}`) && !isAbsolute(path);
21230
+ }
21231
+ const GIT_SETTINGS = {
21232
+ "core.hooksPath": "/dev/null",
21233
+ "core.attributesFile": "/dev/null",
21234
+ "core.fsmonitor": "false",
21235
+ "credential.helper": "",
21236
+ "protocol.allow": "never",
21237
+ "protocol.file.allow": "always",
21238
+ "fetch.recurseSubmodules": "false",
21239
+ "submodule.recurse": "false",
21240
+ "uploadpack.packObjectsHook": "",
21241
+ "gc.auto": "0",
21242
+ "maintenance.auto": "false"
21243
+ };
21244
+ async function git(cwd, args, processSupervisionId) {
21245
+ const env = Object.fromEntries(Object.entries(process.env).filter(([key]) => !key.startsWith("GIT_")));
21246
+ Object.assign(env, {
21247
+ ...processSupervisionId ? { OPENMELD_PROCESS_SUPERVISION_ID: processSupervisionId } : {},
21248
+ GIT_CONFIG_NOSYSTEM: "1",
21249
+ GIT_CONFIG_SYSTEM: "/dev/null",
21250
+ GIT_CONFIG_GLOBAL: "/dev/null",
21251
+ GIT_ATTR_NOSYSTEM: "1",
21252
+ GIT_NO_REPLACE_OBJECTS: "1",
21253
+ GIT_NO_LAZY_FETCH: "1",
21254
+ GIT_ALLOW_PROTOCOL: "file",
21255
+ GIT_TERMINAL_PROMPT: "0",
21256
+ GIT_CONFIG_COUNT: String(Object.keys(GIT_SETTINGS).length)
21257
+ });
21258
+ for (const [index, [key, value]] of Object.entries(GIT_SETTINGS).entries()) {
21259
+ env[`GIT_CONFIG_KEY_${index}`] = key;
21260
+ env[`GIT_CONFIG_VALUE_${index}`] = value;
21261
+ }
21262
+ return (await execFileAsync("git", args, {
21263
+ cwd,
21264
+ env,
21265
+ encoding: "utf8",
21266
+ timeout: 3e4,
21267
+ maxBuffer: 1024 * 1024
21268
+ })).stdout.trimEnd();
21269
+ }
21270
+ function failure(code) {
21271
+ return /* @__PURE__ */ new Error(`execution_context.${code}`);
21272
+ }
21273
+ //#endregion
21274
+ //#region src/local-service/dispatch/execution-context-session.ts
21275
+ function executionContextLedgerPolicy(context) {
21276
+ return context ? "throw" : "backup_and_reset";
21277
+ }
21278
+ function executionContextResourceScope(context) {
21279
+ if (!context) return;
21280
+ if (context.access === "space_context") return "none";
21281
+ if (context.workspace === "isolated") return context.access === "workspace" ? "isolated" : "isolated_read";
21282
+ return context.access === "workspace" ? "exclusive" : "read_only";
21283
+ }
21284
+ function executionContextFileAccessBoundary(input) {
21285
+ const within = (child, parent) => {
21286
+ const path = relative(parent, child);
21287
+ return path === "" || path !== ".." && !path.startsWith("../") && !isAbsolute(path);
21288
+ };
21289
+ const policy = input.policy;
21290
+ if (input.context.access !== "space_context") {
21291
+ const policySource = input.taskWorkspace?.sourceWorkingDirectory ?? input.workingDirectory;
21292
+ if (policy.mode === "only_selected_folders" && !policy.folders.some((folder) => within(policySource, folder))) throw new Error("execution_context.workspace_outside_computer_policy");
21293
+ if (policy.mode === "block_selected_folders" && policy.folders.some((folder) => within(policySource, folder) || within(folder, policySource))) throw new Error("execution_context.workspace_overlaps_blocked_folder");
21294
+ }
21295
+ return {
21296
+ mode: "only_selected_folders",
21297
+ folders: [input.taskWorkspace?.boundaryRoot ?? input.workingDirectory],
21298
+ revision: policy.revision,
21299
+ updatedAtMs: policy.updatedAtMs,
21300
+ executionContextAccess: input.context.access
21301
+ };
21302
+ }
21303
+ async function executionContextWorkingDirectory(input) {
21304
+ if (!input.context) return input.currentWorkingDirectory;
21305
+ if (input.context.workspace === "current") return await realpath(input.currentWorkingDirectory);
21306
+ await mkdir(input.ledgerRootPath, {
21307
+ recursive: true,
21308
+ mode: 448
21309
+ });
21310
+ const root = join(await realpath(input.ledgerRootPath), "execution-context-workspaces");
21311
+ await mkdir(root, {
21312
+ recursive: true,
21313
+ mode: 448
21314
+ });
21315
+ if ((await lstat(root)).isSymbolicLink()) throw new Error("execution_context.workspace_is_symlink");
21316
+ const path = join(root, input.context.id);
21317
+ await mkdir(path, {
21318
+ recursive: true,
21319
+ mode: 448
21320
+ });
21321
+ if ((await lstat(path)).isSymbolicLink()) throw new Error("execution_context.workspace_is_symlink");
21322
+ return await realpath(path);
21323
+ }
21324
+ async function prepareExecutionContextConversation(input) {
21325
+ if (!input.context) return input.unscopedNativeConversationId;
21326
+ const nativeId = input.context.nativeConversationId;
21327
+ if (input.context.runtimeWorkspaceFingerprint && input.context.runtimeWorkspaceFingerprint !== buildRuntimeWorkspaceFingerprint(input.workingDirectory)) throw new Error("execution_context.workspace_changed");
21328
+ if (nativeId && input.existingNativeConversationId && nativeId !== input.existingNativeConversationId) throw new Error("execution_context.native_identity_mismatch");
21329
+ if (nativeId || input.existingNativeConversationId) return nativeId ?? input.existingNativeConversationId;
21330
+ const source = input.context.forkSource;
21331
+ if (!source) return null;
21332
+ const sourceWorkspace = source.workspace === "isolated" ? await readExecutionContextWorkspace({
21333
+ ledgerRootPath: input.ledgerRootPath,
21334
+ contextId: source.contextId
21335
+ }) : null;
21336
+ const sourceDirectory = sourceWorkspace?.workingDirectory ?? await realpath(source.workspace === "current" ? input.currentWorkingDirectory : sourceWorkspace?.workingDirectory ?? join(input.ledgerRootPath, "execution-context-workspaces", source.contextId));
21337
+ if (buildRuntimeWorkspaceFingerprint(sourceDirectory) !== source.runtimeWorkspaceFingerprint) throw new Error("execution_context.fork_source_workspace_changed");
21338
+ const result = await runAgentSessionForkOperation({
21339
+ ledgerRootPath: input.ledgerRootPath,
21340
+ request: {
21341
+ kind: "execution_context",
21342
+ operationId: input.context.id,
21343
+ sourceNativeSessionId: source.nativeConversationId,
21344
+ completedHistoryId: source.completedHistoryId,
21345
+ workingDirectory: input.workingDirectory
21346
+ },
21347
+ execute: async () => {
21348
+ if (input.agentControllerRef === "builtin:claude-code") {
21349
+ if (!(await readBoundedClaudeHistory(source.nativeConversationId)).find((message) => message.uuid === source.completedHistoryId && isCompletedAssistantMessage(message))) throw new Error("execution_context.fork_checkpoint_unavailable");
21350
+ return { childNativeSessionId: (await forkSession(source.nativeConversationId, { upToMessageId: source.completedHistoryId })).sessionId };
21351
+ }
21352
+ if (input.agentControllerRef === "builtin:codex" && input.launchContract) return { childNativeSessionId: (await forkCodexAppServerThread({
21353
+ computerFileAccessBoundary: input.computerFileAccessBoundary ?? void 0,
21354
+ codexTimeoutMs: 3e4,
21355
+ codexWorkdir: sourceDirectory,
21356
+ launchContract: input.launchContract,
21357
+ sourceThreadId: source.nativeConversationId,
21358
+ sourceCompletedTurnId: source.completedHistoryId,
21359
+ targetWorkingDirectory: input.workingDirectory,
21360
+ onRuntimeEvent: input.onRuntimeEvent,
21361
+ env: { OPENMELD_PROCESS_SUPERVISION_ID: input.processSupervisionId }
21362
+ })).threadId };
21363
+ throw new Error("execution_context.fork_unsupported");
21364
+ }
21365
+ });
21366
+ if (result.status !== "completed") throw new Error(`${result.reasonCode}: ${result.message}`);
21367
+ return result.childNativeSessionId;
21368
+ }
21369
+ async function captureExecutionContextCompletion(input) {
21370
+ if (!(input.context && input.nativeConversationId)) return;
21371
+ const completion = {
21372
+ contextId: input.context.id,
21373
+ nativeConversationId: input.nativeConversationId,
21374
+ runtimeWorkspaceFingerprint: buildRuntimeWorkspaceFingerprint(input.workingDirectory)
21375
+ };
21376
+ if (!input.providerSucceeded) return completion;
21377
+ if (input.agentControllerRef === "builtin:codex") return {
21378
+ ...completion,
21379
+ ...input.completedTurnId ? { completedHistoryId: input.completedTurnId } : {}
21380
+ };
21381
+ if (input.agentControllerRef === "builtin:claude-code") try {
21382
+ const completed = (await readBoundedClaudeHistory(input.nativeConversationId)).findLast(isCompletedAssistantMessage);
21383
+ if (completed) return {
21384
+ ...completion,
21385
+ completedHistoryId: completed.uuid
21386
+ };
21387
+ } catch {
21388
+ console.warn("[execution_context.checkpoint_unavailable]", { contextId: input.context.id });
21389
+ }
21390
+ return completion;
21391
+ }
21392
+ async function readBoundedClaudeHistory(sessionId) {
21393
+ const info = await getSessionInfo(sessionId);
21394
+ if (!info || info.fileSize === void 0 || info.fileSize > 8 * 1024 * 1024) throw new Error("execution_context.history_unavailable_or_too_large");
21395
+ return await getSessionMessages(sessionId);
21396
+ }
21397
+ function isCompletedAssistantMessage(value) {
21398
+ return value.type === "assistant" && typeof value.message === "object" && value.message !== null && "stop_reason" in value.message && value.message.stop_reason === "end_turn";
21399
+ }
21400
+ //#endregion
20641
21401
  //#region src/local-service/dispatch/prompt-trace.ts
20642
21402
  const OMITTED_ORGANIZATION_POLICY = "[organization-protected information policy omitted]";
20643
21403
  function buildDispatchPromptTrace(input) {
@@ -20877,6 +21637,7 @@ function enqueueDispatchDeliverFrame(input) {
20877
21637
  presenter: input.presenter
20878
21638
  });
20879
21639
  const enqueueResult = input.localExecutionSlots.request({
21640
+ resourceScope: executionContextResourceScope(deliverRequest.payload.executionContext),
20880
21641
  adapterId: queueLogMeta.adapterId,
20881
21642
  attemptId: correlation.attemptId,
20882
21643
  controllerKey: queueLogMeta.controllerKey,
@@ -21446,6 +22207,15 @@ async function handleDispatchDeliverFrame(input) {
21446
22207
  let runtimeOpenClawBinding;
21447
22208
  let agentControllerConversationOverride = null;
21448
22209
  let dispatchSpaceActionContext = null;
22210
+ let nativeQuiescence;
22211
+ let workspaceUse = null;
22212
+ const workspaceProcesses = /* @__PURE__ */ new Map();
22213
+ const observeWorkspaceProcess = (event) => observeExecutionContextWorkspaceProcess(workspaceProcesses, event);
22214
+ let completedTurnId = null;
22215
+ let completedTurnConversationId = null;
22216
+ let completedNativeResult = null;
22217
+ let executionContextCompletion;
22218
+ const invalidStateStrategy = executionContextLedgerPolicy(parsedTask.executionContext);
21449
22219
  try {
21450
22220
  dispatchRuntimeContext = await resolveDispatchWorkingFolderRuntimeContext({
21451
22221
  controllerSnapshot: input.deliverRequest.payload.controllerSnapshot,
@@ -21475,6 +22245,20 @@ async function handleDispatchDeliverFrame(input) {
21475
22245
  targetProfileId: parsedTask.targetProfileId
21476
22246
  });
21477
22247
  effectiveRuntimeContext = runtimePreparation.effectiveRuntimeContext;
22248
+ const originalWorkingDirectory = effectiveRuntimeContext.providerRuntimeWorkingDirectory;
22249
+ await verifyDispatchLegacyContextAssociation({
22250
+ parsedTask,
22251
+ ledgerPaths: input.ledgerPaths,
22252
+ originalWorkingDirectory
22253
+ });
22254
+ const taskWorkspace = await prepareDispatchTaskWorkspace({
22255
+ parsedTask,
22256
+ ledgerRootPath: input.ledgerPaths.rootDirPath,
22257
+ currentWorkingDirectory: originalWorkingDirectory,
22258
+ computerFileAccessStorePath: input.computerFileAccessStorePath
22259
+ });
22260
+ effectiveRuntimeContext = { providerRuntimeWorkingDirectory: taskWorkspace.workingDirectory };
22261
+ runtimePreparation.effectiveRuntimeContext = effectiveRuntimeContext;
21478
22262
  computerFileAccessBoundary = await resolveDispatchComputerFileAccess({
21479
22263
  computerFileAccessStorePath: input.computerFileAccessStorePath,
21480
22264
  onInteractionRequest,
@@ -21482,7 +22266,8 @@ async function handleDispatchDeliverFrame(input) {
21482
22266
  presenter: input.presenter,
21483
22267
  routeConfig,
21484
22268
  runtimeControllerSupport,
21485
- runtimePreparation
22269
+ runtimePreparation,
22270
+ taskWorkspace
21486
22271
  });
21487
22272
  const [sendTargetReference, imageAttachmentPreparation] = await Promise.all([bootstrapContext.sendTargetReferencePromise, materializeDispatchImageAttachments({
21488
22273
  agentControllerRef: parsedTask.agentControllerRef,
@@ -21536,6 +22321,7 @@ async function handleDispatchDeliverFrame(input) {
21536
22321
  contextStore: input.contextStore,
21537
22322
  ledgerPaths: input.ledgerPaths,
21538
22323
  parsedTask,
22324
+ originalWorkingDirectory,
21539
22325
  runtimeWorkspaceFingerprint: buildRuntimeWorkspaceFingerprint(activeRuntimeContext.providerRuntimeWorkingDirectory)
21540
22326
  });
21541
22327
  contextLookupKey = dispatchLedgerContext.contextLookupKey;
@@ -21545,6 +22331,27 @@ async function handleDispatchDeliverFrame(input) {
21545
22331
  agentControllerConversationId: parsedTask.agentControllerConversationId,
21546
22332
  existingContextId
21547
22333
  });
22334
+ workspaceUse = await markExecutionContextWorkspaceInUse({
22335
+ context: parsedTask.executionContext,
22336
+ ledgerRootPath: input.ledgerPaths.rootDirPath
22337
+ });
22338
+ runtimeEnvOverrides = {
22339
+ ...runtimeEnvOverrides,
22340
+ OPENMELD_PROCESS_SUPERVISION_ID: workspaceUse?.processSupervisionId
22341
+ };
22342
+ effectiveAgentControllerConversationId = await prepareExecutionContextConversation({
22343
+ computerFileAccessBoundary,
22344
+ unscopedNativeConversationId: effectiveAgentControllerConversationId,
22345
+ context: parsedTask.executionContext,
22346
+ currentWorkingDirectory: originalWorkingDirectory,
22347
+ workingDirectory: activeRuntimeContext.providerRuntimeWorkingDirectory,
22348
+ existingNativeConversationId: existingContextId,
22349
+ ledgerRootPath: input.ledgerPaths.rootDirPath,
22350
+ agentControllerRef: parsedTask.agentControllerRef,
22351
+ launchContract: routeConfig?.launchContract,
22352
+ onRuntimeEvent: observeWorkspaceProcess,
22353
+ processSupervisionId: workspaceUse?.processSupervisionId
22354
+ });
21548
22355
  latestScopedExecutionState = dispatchLedgerContext.latestScopedExecutionState;
21549
22356
  ledgerIo = dispatchLedgerContext.ledgerIo;
21550
22357
  input.inflightDispatchMetaByTaskId.set(parsedTask.taskId, { agentContextLookupKey: contextLookupKey });
@@ -21602,7 +22409,8 @@ async function handleDispatchDeliverFrame(input) {
21602
22409
  profileOwnerName: input.profileOwnerName,
21603
22410
  profileOwnerUserId: input.profileOwnerUserId,
21604
22411
  sendTargetReference,
21605
- shouldInjectBootstrap: bootstrapPlan.shouldInject
22412
+ shouldInjectBootstrap: bootstrapPlan.shouldInject,
22413
+ taskWorkspace
21606
22414
  }), skillPreflight);
21607
22415
  runtimePromptPlan = computerFileAccessBoundary ? applyComputerFileAccessAwareness({
21608
22416
  policy: computerFileAccessBoundary,
@@ -21751,7 +22559,7 @@ async function handleDispatchDeliverFrame(input) {
21751
22559
  });
21752
22560
  }
21753
22561
  withLedgerStateTransaction({
21754
- invalidStateStrategy: "backup_and_reset",
22562
+ invalidStateStrategy,
21755
22563
  io: providerConversationLedgerIo,
21756
22564
  mutate: (state) => ({
21757
22565
  nextState: commitResolvedAgentContext({
@@ -21800,6 +22608,8 @@ async function handleDispatchDeliverFrame(input) {
21800
22608
  };
21801
22609
  const syncProviderTurnAcceptedLifecycle = (event) => {
21802
22610
  if (event.phase !== "provider_turn_accepted") return;
22611
+ completedTurnId = event.turnId;
22612
+ completedTurnConversationId = event.agentControllerConversationId;
21803
22613
  if (providerAdmissionOwnsRunningLifecycle && runtimeLifecyclePhase !== "running") transitionDispatchLifecycle({ phase: "running" });
21804
22614
  emitDispatchLocalPhaseJournalEvent({
21805
22615
  deliverRequest: input.deliverRequest,
@@ -21812,6 +22622,129 @@ async function handleDispatchDeliverFrame(input) {
21812
22622
  result: "accepted"
21813
22623
  });
21814
22624
  };
22625
+ const onNativeTurnStarted = () => {
22626
+ completedTurnId = null;
22627
+ completedTurnConversationId = null;
22628
+ executionContextCompletion = void 0;
22629
+ completedNativeResult = null;
22630
+ };
22631
+ const onNativeTurnCompleted = (result) => {
22632
+ completedNativeResult = result;
22633
+ };
22634
+ const onRuntimeEvent = routeReasoningEvents(observeReasoning, (event) => {
22635
+ observeWorkspaceProcess(event);
22636
+ syncAgentControllerConversationOccupancyLifecycle(event);
22637
+ syncProviderTurnAcceptedLifecycle(event);
22638
+ if (event.phase === "tool_activity") {
22639
+ agentToolActivitySequence += 1;
22640
+ emitDispatchAgentToolActivityFrame({
22641
+ currentSocketRef,
22642
+ daemonSessionId: input.daemonSessionId,
22643
+ deliverRequest: input.deliverRequest,
22644
+ event,
22645
+ parsedTask,
22646
+ presenter: input.presenter,
22647
+ sequence: agentToolActivitySequence
22648
+ });
22649
+ }
22650
+ if (event.phase === "provider_conversation_observed") recordProviderConversationObservation({
22651
+ agentControllerConversation: event.agentControllerConversation ?? null,
22652
+ agentControllerConversationId: event.agentControllerConversationId,
22653
+ source: "runtime_event"
22654
+ });
22655
+ if (event.phase === "provider_usage_limits_observed" && routeConfig?.launchContract) {
22656
+ const agentId = runtimeControllerSupport.runtimeAdapterMatch.adapterId;
22657
+ const launchContract = routeConfig.launchContract;
22658
+ usageObservationAuthPromise ??= probeAgentControllerUsageObservationAuth({
22659
+ agentId,
22660
+ launchContract
22661
+ });
22662
+ usageObservationAuthPromise.then((authSnapshot) => recordRuntimeProviderUsageLimits({
22663
+ agentId,
22664
+ authSnapshot,
22665
+ launchContract,
22666
+ usageLimits: event.usageLimits
22667
+ })).then((retained) => {
22668
+ if (retained) return;
22669
+ emitRunLine({
22670
+ presenter: input.presenter,
22671
+ code: "daemon.run.provider_usage_limits_observation_ignored",
22672
+ text: `provider usage limit observation could not be retained for task ${parsedTask.taskId}`,
22673
+ payload: {
22674
+ agentControllerRef: parsedTask.agentControllerRef,
22675
+ dispatchId: parsedTask.dispatchId,
22676
+ observedLimitKeys: event.usageLimits.map((limit) => limit.key),
22677
+ reasonCode: "provider_account_unconfirmed",
22678
+ targetProfileId: parsedTask.targetProfileId,
22679
+ taskId: parsedTask.taskId
22680
+ }
22681
+ });
22682
+ }).catch((error) => {
22683
+ emitRunLine({
22684
+ presenter: input.presenter,
22685
+ code: "daemon.run.provider_usage_limits_observation_ignored",
22686
+ text: `provider usage limit observation could not be retained for task ${parsedTask.taskId}`,
22687
+ payload: {
22688
+ agentControllerRef: parsedTask.agentControllerRef,
22689
+ dispatchId: parsedTask.dispatchId,
22690
+ errorMessage: toErrorMessage$10(error),
22691
+ observedLimitKeys: event.usageLimits.map((limit) => limit.key),
22692
+ targetProfileId: parsedTask.targetProfileId,
22693
+ taskId: parsedTask.taskId
22694
+ }
22695
+ });
22696
+ });
22697
+ }
22698
+ if (!firstOutputEvidenceSent && (event.phase === "first_stdout" || event.phase === "first_stderr")) {
22699
+ firstOutputEvidenceSent = true;
22700
+ emitDispatchRuntimeEvidenceTransition({
22701
+ currentSocketRef,
22702
+ daemonSessionId: input.daemonSessionId,
22703
+ deliverRequest: input.deliverRequest,
22704
+ durationMs: Math.max(0, event.tsMs - runtimeStartedAtMs),
22705
+ parsedTask,
22706
+ phase: "first_output",
22707
+ presenter: input.presenter
22708
+ });
22709
+ }
22710
+ const controlRegistrySyncResult = syncRuntimeEventToInflightTaskControlRegistry({
22711
+ event,
22712
+ registry: input.inflightTaskControlRegistry,
22713
+ taskId: parsedTask.taskId
22714
+ });
22715
+ if (controlRegistrySyncResult.updated) emitRunLine({
22716
+ presenter: input.presenter,
22717
+ code: "daemon.run.control_registry_synced",
22718
+ text: `control registry synced for task ${parsedTask.taskId}`,
22719
+ payload: {
22720
+ dispatchId: parsedTask.dispatchId,
22721
+ phase: event.phase,
22722
+ processId: controlRegistrySyncResult.processId,
22723
+ targetProfileId: parsedTask.targetProfileId,
22724
+ taskId: parsedTask.taskId
22725
+ }
22726
+ });
22727
+ if (event.phase === "process_spawned" || event.phase === "process_exit") emitDispatchLocalPhaseJournalEvent({
22728
+ deliverRequest: input.deliverRequest,
22729
+ metadata: buildProviderProcessJournalMetadata({
22730
+ agentControllerRef: parsedTask.agentControllerRef,
22731
+ event,
22732
+ runtimeStartedAtMs
22733
+ }),
22734
+ parsedTask,
22735
+ phase: event.phase,
22736
+ result: event.phase === "process_exit" ? "exited" : "spawned"
22737
+ });
22738
+ emitProviderRuntimePhaseLine({
22739
+ agentControllerRef: parsedTask.agentControllerRef,
22740
+ dispatchId: parsedTask.dispatchId,
22741
+ event,
22742
+ presenter: input.presenter,
22743
+ runtimeStartedAtMs,
22744
+ targetProfileId: parsedTask.targetProfileId,
22745
+ taskId: parsedTask.taskId
22746
+ });
22747
+ });
21815
22748
  clearReasoning();
21816
22749
  const runtimeExecutionPromise = Promise.resolve(runDispatchRuntimeExecution({
21817
22750
  computerFileAccessBoundary,
@@ -21820,6 +22753,9 @@ async function handleDispatchDeliverFrame(input) {
21820
22753
  io: ledgerIo,
21821
22754
  ledgerPaths: input.ledgerPaths,
21822
22755
  onInteractionRequest,
22756
+ onNativeTurnStarted,
22757
+ onNativeTurnCompleted,
22758
+ onRuntimeEvent,
21823
22759
  onPreview: (preview) => {
21824
22760
  emitDispatchPreviewFrame({
21825
22761
  attemptId: parsedTask.attemptId,
@@ -21833,119 +22769,6 @@ async function handleDispatchDeliverFrame(input) {
21833
22769
  taskId: parsedTask.taskId
21834
22770
  });
21835
22771
  },
21836
- onRuntimeEvent: routeReasoningEvents(observeReasoning, (event) => {
21837
- syncAgentControllerConversationOccupancyLifecycle(event);
21838
- syncProviderTurnAcceptedLifecycle(event);
21839
- if (event.phase === "tool_activity") {
21840
- agentToolActivitySequence += 1;
21841
- emitDispatchAgentToolActivityFrame({
21842
- currentSocketRef,
21843
- daemonSessionId: input.daemonSessionId,
21844
- deliverRequest: input.deliverRequest,
21845
- event,
21846
- parsedTask,
21847
- presenter: input.presenter,
21848
- sequence: agentToolActivitySequence
21849
- });
21850
- }
21851
- if (event.phase === "provider_conversation_observed") recordProviderConversationObservation({
21852
- agentControllerConversation: event.agentControllerConversation ?? null,
21853
- agentControllerConversationId: event.agentControllerConversationId,
21854
- source: "runtime_event"
21855
- });
21856
- if (event.phase === "provider_usage_limits_observed" && routeConfig?.launchContract) {
21857
- const agentId = runtimeControllerSupport.runtimeAdapterMatch.adapterId;
21858
- const launchContract = routeConfig.launchContract;
21859
- usageObservationAuthPromise ??= probeAgentControllerUsageObservationAuth({
21860
- agentId,
21861
- launchContract
21862
- });
21863
- usageObservationAuthPromise.then((authSnapshot) => recordRuntimeProviderUsageLimits({
21864
- agentId,
21865
- authSnapshot,
21866
- launchContract,
21867
- usageLimits: event.usageLimits
21868
- })).then((retained) => {
21869
- if (retained) return;
21870
- emitRunLine({
21871
- presenter: input.presenter,
21872
- code: "daemon.run.provider_usage_limits_observation_ignored",
21873
- text: `provider usage limit observation could not be retained for task ${parsedTask.taskId}`,
21874
- payload: {
21875
- agentControllerRef: parsedTask.agentControllerRef,
21876
- dispatchId: parsedTask.dispatchId,
21877
- observedLimitKeys: event.usageLimits.map((limit) => limit.key),
21878
- reasonCode: "provider_account_unconfirmed",
21879
- targetProfileId: parsedTask.targetProfileId,
21880
- taskId: parsedTask.taskId
21881
- }
21882
- });
21883
- }).catch((error) => {
21884
- emitRunLine({
21885
- presenter: input.presenter,
21886
- code: "daemon.run.provider_usage_limits_observation_ignored",
21887
- text: `provider usage limit observation could not be retained for task ${parsedTask.taskId}`,
21888
- payload: {
21889
- agentControllerRef: parsedTask.agentControllerRef,
21890
- dispatchId: parsedTask.dispatchId,
21891
- errorMessage: toErrorMessage$10(error),
21892
- observedLimitKeys: event.usageLimits.map((limit) => limit.key),
21893
- targetProfileId: parsedTask.targetProfileId,
21894
- taskId: parsedTask.taskId
21895
- }
21896
- });
21897
- });
21898
- }
21899
- if (!firstOutputEvidenceSent && (event.phase === "first_stdout" || event.phase === "first_stderr")) {
21900
- firstOutputEvidenceSent = true;
21901
- emitDispatchRuntimeEvidenceTransition({
21902
- currentSocketRef,
21903
- daemonSessionId: input.daemonSessionId,
21904
- deliverRequest: input.deliverRequest,
21905
- durationMs: Math.max(0, event.tsMs - runtimeStartedAtMs),
21906
- parsedTask,
21907
- phase: "first_output",
21908
- presenter: input.presenter
21909
- });
21910
- }
21911
- const controlRegistrySyncResult = syncRuntimeEventToInflightTaskControlRegistry({
21912
- event,
21913
- registry: input.inflightTaskControlRegistry,
21914
- taskId: parsedTask.taskId
21915
- });
21916
- if (controlRegistrySyncResult.updated) emitRunLine({
21917
- presenter: input.presenter,
21918
- code: "daemon.run.control_registry_synced",
21919
- text: `control registry synced for task ${parsedTask.taskId}`,
21920
- payload: {
21921
- dispatchId: parsedTask.dispatchId,
21922
- phase: event.phase,
21923
- processId: controlRegistrySyncResult.processId,
21924
- targetProfileId: parsedTask.targetProfileId,
21925
- taskId: parsedTask.taskId
21926
- }
21927
- });
21928
- if (event.phase === "process_spawned" || event.phase === "process_exit") emitDispatchLocalPhaseJournalEvent({
21929
- deliverRequest: input.deliverRequest,
21930
- metadata: buildProviderProcessJournalMetadata({
21931
- agentControllerRef: parsedTask.agentControllerRef,
21932
- event,
21933
- runtimeStartedAtMs
21934
- }),
21935
- parsedTask,
21936
- phase: event.phase,
21937
- result: event.phase === "process_exit" ? "exited" : "spawned"
21938
- });
21939
- emitProviderRuntimePhaseLine({
21940
- agentControllerRef: parsedTask.agentControllerRef,
21941
- dispatchId: parsedTask.dispatchId,
21942
- event,
21943
- presenter: input.presenter,
21944
- runtimeStartedAtMs,
21945
- targetProfileId: parsedTask.targetProfileId,
21946
- taskId: parsedTask.taskId
21947
- });
21948
- }),
21949
22772
  parsedTask,
21950
22773
  instructionPrompt: runtimePromptPlan,
21951
22774
  prompt: runtimePromptPlan.fallbackPrompt,
@@ -21956,6 +22779,7 @@ async function handleDispatchDeliverFrame(input) {
21956
22779
  agentControllerConversationOverride
21957
22780
  }));
21958
22781
  const controllerTurnCompletion = runtimeExecutionPromise.then(() => void 0, () => void 0);
22782
+ nativeQuiescence = controllerTurnCompletion;
21959
22783
  let runtimeResult = await resolveRuntimeResultFromRuntimeOrCliSpaceAction({
21960
22784
  contextIdForDispatch,
21961
22785
  dispatchSpaceActionContext,
@@ -21976,6 +22800,10 @@ async function handleDispatchDeliverFrame(input) {
21976
22800
  runtimeExecutionPromise
21977
22801
  });
21978
22802
  const structuredSpaceActionOutcome = await resolveRuntimeResultStructuredSpaceAction({
22803
+ onInteractionRequest,
22804
+ onNativeTurnStarted,
22805
+ onNativeTurnCompleted,
22806
+ onRuntimeEvent,
21979
22807
  computerFileAccessBoundary,
21980
22808
  controllerTurnCompletion,
21981
22809
  inflightTaskControlRegistry: input.inflightTaskControlRegistry,
@@ -22015,7 +22843,7 @@ async function handleDispatchDeliverFrame(input) {
22015
22843
  resolvedContextId: normalizeOptionalContextId(runtimeResult.contextResolution?.agentControllerConversationId ?? contextDelta?.agentControllerConversationId ?? null) ?? null
22016
22844
  });
22017
22845
  await withLedgerStateTransaction({
22018
- invalidStateStrategy: "backup_and_reset",
22846
+ invalidStateStrategy,
22019
22847
  io: ledgerIo,
22020
22848
  mutate: (state) => {
22021
22849
  let nextState = state;
@@ -22070,7 +22898,8 @@ async function handleDispatchDeliverFrame(input) {
22070
22898
  runtimePromptPlan
22071
22899
  });
22072
22900
  const completedAgentControllerConversationOverride = agentControllerConversationOverride ?? null;
22073
- const buildCurrentResultPayload = () => {
22901
+ const buildCurrentResultPayload = async () => {
22902
+ if (parsedTask.executionContext) await controllerTurnCompletion;
22074
22903
  const currentContextDelta = resolveDispatchContextDeltaFromRuntimeResult(runtimeResult.dispatchResult);
22075
22904
  const observedAgentControllerConversation = resolveObservedDispatchAgentControllerConversation({
22076
22905
  plannedAgentControllerConversation,
@@ -22078,6 +22907,16 @@ async function handleDispatchDeliverFrame(input) {
22078
22907
  contextResolution: runtimeResult.contextResolution ?? null,
22079
22908
  agentControllerConversationOverride: completedAgentControllerConversationOverride
22080
22909
  });
22910
+ const finalNativeResult = completedNativeResult;
22911
+ const nativeConversationId = (finalNativeResult ? resolveDispatchContextDeltaFromRuntimeResult(finalNativeResult.dispatchResult)?.agentControllerConversationId : null) ?? finalNativeResult?.contextResolution?.agentControllerConversationId ?? currentContextDelta?.agentControllerConversationId ?? runtimeResult.contextResolution?.agentControllerConversationId ?? observedAgentControllerConversation?.agentControllerConversationId ?? observedProviderConversationId;
22912
+ executionContextCompletion = await captureExecutionContextCompletion({
22913
+ context: parsedTask.executionContext,
22914
+ nativeConversationId,
22915
+ agentControllerRef: parsedTask.agentControllerRef,
22916
+ workingDirectory: activeRuntimeContext.providerRuntimeWorkingDirectory,
22917
+ completedTurnId: completedTurnConversationId === nativeConversationId ? completedTurnId : null,
22918
+ providerSucceeded: finalNativeResult?.resultPayload.status === "success" || finalNativeResult?.resultPayload.status === "partial_success"
22919
+ });
22081
22920
  dispatchExecution = buildDispatchExecution({
22082
22921
  bootstrapPlan: completedBootstrapPlan,
22083
22922
  agentControllerConversationId: effectiveAgentControllerConversationId,
@@ -22085,32 +22924,40 @@ async function handleDispatchDeliverFrame(input) {
22085
22924
  observedAgentControllerConversation,
22086
22925
  plannedAgentControllerConversation
22087
22926
  });
22088
- return resolveDispatchResultPayload({
22089
- attemptId: parsedTask.attemptId,
22090
- contextDelta: currentContextDelta,
22091
- contextResolution: runtimeResult.contextResolution ?? null,
22092
- basePayload: runtimeResult.resultPayload,
22093
- bootstrapTemplateFacts: bootstrapContext.bootstrapTemplateFacts,
22094
- agentControllerRef: parsedTask.agentControllerRef,
22095
- dispatchExecution,
22096
- existingContextId: contextIdForDispatch,
22097
- openClawBinding: runtimeOpenClawBinding,
22098
- openClawGatewayVisibility: runtimeOpenClawGatewayVisibility,
22099
- promptTrace: runtimePromptTrace,
22100
- agentControllerConversationForDispatch: observedAgentControllerConversation ?? plannedAgentControllerConversation,
22101
- workingDirectory: activeRuntimeContext.providerRuntimeWorkingDirectory,
22102
- spaceAction: resolvedSpaceAction,
22103
- spaceActionProvenance: resolvedSpaceActionProvenance,
22104
- sourceEventId: parsedTask.sourceEventId,
22105
- targetProfileId: parsedTask.targetProfileId,
22106
- taskId: parsedTask.taskId
22107
- });
22927
+ return {
22928
+ ...resolveDispatchResultPayload({
22929
+ attemptId: parsedTask.attemptId,
22930
+ contextDelta: currentContextDelta,
22931
+ contextResolution: runtimeResult.contextResolution ?? null,
22932
+ basePayload: runtimeResult.resultPayload,
22933
+ bootstrapTemplateFacts: bootstrapContext.bootstrapTemplateFacts,
22934
+ agentControllerRef: parsedTask.agentControllerRef,
22935
+ dispatchExecution,
22936
+ existingContextId: contextIdForDispatch,
22937
+ openClawBinding: runtimeOpenClawBinding,
22938
+ openClawGatewayVisibility: runtimeOpenClawGatewayVisibility,
22939
+ promptTrace: runtimePromptTrace,
22940
+ agentControllerConversationForDispatch: observedAgentControllerConversation ?? plannedAgentControllerConversation,
22941
+ workingDirectory: activeRuntimeContext.providerRuntimeWorkingDirectory,
22942
+ spaceAction: resolvedSpaceAction,
22943
+ spaceActionProvenance: resolvedSpaceActionProvenance,
22944
+ sourceEventId: parsedTask.sourceEventId,
22945
+ targetProfileId: parsedTask.targetProfileId,
22946
+ taskId: parsedTask.taskId
22947
+ }),
22948
+ executionContextId: parsedTask.executionContext?.id,
22949
+ executionContextCompletion
22950
+ };
22108
22951
  };
22109
- resultPayload = buildCurrentResultPayload();
22952
+ resultPayload = await buildCurrentResultPayload();
22110
22953
  const replySettlement = await settleAgentReplyProposals({
22111
22954
  initialResultPayload: resultPayload,
22112
22955
  reconsider: async (agentReplyObservationCursor) => {
22113
22956
  const reconsidered = await resolveRuntimeResultStructuredSpaceAction({
22957
+ onInteractionRequest,
22958
+ onNativeTurnStarted,
22959
+ onNativeTurnCompleted,
22960
+ onRuntimeEvent,
22114
22961
  agentReplyObservationCursor,
22115
22962
  computerFileAccessBoundary,
22116
22963
  controllerTurnCompletion,
@@ -22135,7 +22982,7 @@ async function handleDispatchDeliverFrame(input) {
22135
22982
  runtimeResult = reconsidered.runtimeResult;
22136
22983
  resolvedSpaceAction = reconsidered.resolvedSpaceAction;
22137
22984
  resolvedSpaceActionProvenance = reconsidered.resolvedSpaceActionProvenance;
22138
- return buildCurrentResultPayload();
22985
+ return await buildCurrentResultPayload();
22139
22986
  },
22140
22987
  submit: (payload) => sendResultAndSummarize({
22141
22988
  attemptId: parsedTask.attemptId,
@@ -22233,6 +23080,14 @@ async function handleDispatchDeliverFrame(input) {
22233
23080
  }
22234
23081
  });
22235
23082
  } finally {
23083
+ await nativeQuiescence;
23084
+ await releaseDispatchTaskWorkspace({
23085
+ workspaceUse,
23086
+ parsedTask,
23087
+ ledgerRootPath: input.ledgerPaths.rootDirPath,
23088
+ workspaceProcesses,
23089
+ presenter: input.presenter
23090
+ });
22236
23091
  reasoningStream.dispose();
22237
23092
  currentSocketRef.reasoningPreferenceListeners?.delete(clearReasoning);
22238
23093
  lifecycleKeepalive.stop?.();
@@ -22241,6 +23096,11 @@ async function handleDispatchDeliverFrame(input) {
22241
23096
  input.inflightTaskControlRegistry.removeTask(parsedTask.taskId);
22242
23097
  pendingAgentInteractionRegistry.removeTask(parsedTask.taskId);
22243
23098
  }
23099
+ resultPayload = {
23100
+ ...resultPayload,
23101
+ executionContextId: parsedTask.executionContext?.id,
23102
+ executionContextCompletion
23103
+ };
22244
23104
  emitDispatchRuntimeEvidenceTransition({
22245
23105
  currentSocketRef,
22246
23106
  daemonSessionId: input.daemonSessionId,
@@ -22401,8 +23261,28 @@ async function rollbackBootstrapExecutionStateAfterFailureIfNeeded(input) {
22401
23261
  paths: input.ledgerPaths
22402
23262
  });
22403
23263
  }
23264
+ async function verifyDispatchLegacyContextAssociation(input) {
23265
+ const association = input.parsedTask.executionContext?.legacyAssociation;
23266
+ if (!association) return;
23267
+ assertLegacyAgentContextAssociation({
23268
+ state: await loadLedgerState({
23269
+ invalidStateStrategy: "throw",
23270
+ io: createLedgerIo(),
23271
+ paths: input.ledgerPaths
23272
+ }),
23273
+ legacyNativeConversationId: association.nativeConversationId,
23274
+ key: {
23275
+ spaceId: input.parsedTask.spaceId,
23276
+ targetProfileId: input.parsedTask.targetProfileId,
23277
+ agentControllerRef: input.parsedTask.agentControllerRef,
23278
+ transportMode: input.parsedTask.transportMode,
23279
+ runtimeWorkspaceFingerprint: buildRuntimeWorkspaceFingerprint(input.originalWorkingDirectory)
23280
+ }
23281
+ });
23282
+ }
22404
23283
  async function loadDispatchLedgerContext(input) {
22405
23284
  const keyInput = {
23285
+ executionContextId: input.parsedTask.executionContext?.id,
22406
23286
  spaceId: input.parsedTask.spaceId,
22407
23287
  targetProfileId: input.parsedTask.targetProfileId,
22408
23288
  agentControllerRef: input.parsedTask.agentControllerRef,
@@ -22413,7 +23293,7 @@ async function loadDispatchLedgerContext(input) {
22413
23293
  const ledgerIo = createLedgerIo();
22414
23294
  const legacyContextId = input.contextStore.get(contextLookupKey) ?? null;
22415
23295
  const { currentExecutionState, existingContextId, latestScopedExecutionState } = await withLedgerStateTransaction({
22416
- invalidStateStrategy: "backup_and_reset",
23296
+ invalidStateStrategy: executionContextLedgerPolicy(input.parsedTask.executionContext),
22417
23297
  io: ledgerIo,
22418
23298
  mutate: (state) => {
22419
23299
  const scopeInput = {
@@ -22422,6 +23302,14 @@ async function loadDispatchLedgerContext(input) {
22422
23302
  targetProfileId: input.parsedTask.targetProfileId,
22423
23303
  transportMode: input.parsedTask.transportMode
22424
23304
  };
23305
+ assertLegacyAgentContextAssociation({
23306
+ state,
23307
+ legacyNativeConversationId: input.parsedTask.executionContext?.legacyAssociation?.nativeConversationId,
23308
+ key: {
23309
+ ...scopeInput,
23310
+ runtimeWorkspaceFingerprint: buildRuntimeWorkspaceFingerprint(input.originalWorkingDirectory)
23311
+ }
23312
+ });
22425
23313
  const seededLedgerState = resolveCompatibleAgentContextMatch({
22426
23314
  key: keyInput,
22427
23315
  state
@@ -22442,16 +23330,17 @@ async function loadDispatchLedgerContext(input) {
22442
23330
  state: seededLedgerState
22443
23331
  });
22444
23332
  const existingContextId = nextAgentContextMatch?.agentContext.agentControllerConversationId ?? null;
23333
+ const currentExecutionState = resolveCompatibleConversationExecutionState({
23334
+ key: keyInput,
23335
+ preferredLookupKey: nextAgentContextMatch?.agentContextLookupKey ?? null,
23336
+ state: seededLedgerState
23337
+ });
22445
23338
  return {
22446
23339
  nextState: seededLedgerState,
22447
23340
  value: {
22448
- currentExecutionState: resolveCompatibleConversationExecutionState({
22449
- key: keyInput,
22450
- preferredLookupKey: nextAgentContextMatch?.agentContextLookupKey ?? null,
22451
- state: seededLedgerState
22452
- }),
23341
+ currentExecutionState,
22453
23342
  existingContextId,
22454
- latestScopedExecutionState: resolveLatestScopedConversationExecutionState({
23343
+ latestScopedExecutionState: input.parsedTask.executionContext ? currentExecutionState : resolveLatestScopedConversationExecutionState({
22455
23344
  scope: scopeInput,
22456
23345
  state: seededLedgerState
22457
23346
  })?.executionState ?? null
@@ -22595,7 +23484,12 @@ function buildDispatchRuntimePrompt(input) {
22595
23484
  profileOwnerUserId: input.profileOwnerUserId,
22596
23485
  organizationProtectedInformation: input.parsedTask.organizationProtectedInformation,
22597
23486
  workingLanguage: input.parsedTask.workingLanguage,
22598
- prompt: input.parsedTask.prompt,
23487
+ prompt: input.taskWorkspace?.baseCommit ? `${input.parsedTask.prompt}\n\nOpenMeld task workspace: ${JSON.stringify({
23488
+ projectId: input.parsedTask.defaultProjectId,
23489
+ repositoryName: input.taskWorkspace.sourceWorkingDirectory ? basename(input.taskWorkspace.sourceWorkingDirectory) : null,
23490
+ workingDirectory: input.taskWorkspace.workingDirectory,
23491
+ baseCommit: input.taskWorkspace.baseCommit
23492
+ })}\nThis task uses an independent Git worktree with private Git metadata. The starting commit is frozen. Uncommitted and ignored source files were not copied. Make changes in this task worktree; the original checkout is not the task's working directory. Refer to the task and commit in public replies without disclosing private local paths.` : input.parsedTask.prompt,
22599
23493
  recipientExplicitlyAddressedByActivationTargets: input.parsedTask.recipientExplicitlyAddressedByActivationTargets,
22600
23494
  sourceSignalId: input.parsedTask.sourceEventId,
22601
23495
  sourceMessageEnvelope: input.parsedTask.sourceMessageEnvelope,
@@ -22616,9 +23510,83 @@ function buildDispatchRuntimePrompt(input) {
22616
23510
  targetProfileId: input.parsedTask.targetProfileId
22617
23511
  });
22618
23512
  }
23513
+ async function prepareDispatchTaskWorkspace(input) {
23514
+ const context = input.parsedTask.executionContext;
23515
+ if (context && context.access !== "space_context") return await prepareExecutionContextWorkspace({
23516
+ context,
23517
+ ledgerRootPath: input.ledgerRootPath,
23518
+ currentWorkingDirectory: input.currentWorkingDirectory,
23519
+ policy: await readComputerFileAccessPolicy(input.computerFileAccessStorePath)
23520
+ });
23521
+ const workingDirectory = await executionContextWorkingDirectory({
23522
+ context,
23523
+ ledgerRootPath: input.ledgerRootPath,
23524
+ currentWorkingDirectory: input.currentWorkingDirectory
23525
+ });
23526
+ return {
23527
+ workingDirectory,
23528
+ boundaryRoot: workingDirectory
23529
+ };
23530
+ }
23531
+ async function releaseDispatchTaskWorkspace(input) {
23532
+ const context = input.parsedTask.executionContext;
23533
+ if (!(input.workspaceUse && context)) return;
23534
+ try {
23535
+ const released = await releaseExecutionContextWorkspace({
23536
+ ledgerRootPath: input.ledgerRootPath,
23537
+ context,
23538
+ use: input.workspaceUse,
23539
+ ownedProcessesQuiescent: [...input.workspaceProcesses.values()].every(Boolean)
23540
+ });
23541
+ emitRunLine({
23542
+ presenter: input.presenter,
23543
+ code: `daemon.run.workspace_${released.status}`,
23544
+ text: released.status === "released" ? "Reclaimed the unchanged task workspace." : "Retained the task workspace.",
23545
+ payload: {
23546
+ contextId: context.id,
23547
+ ...released
23548
+ }
23549
+ });
23550
+ } catch (error) {
23551
+ emitRunLine({
23552
+ presenter: input.presenter,
23553
+ code: "daemon.run.workspace_retained",
23554
+ text: "Task workspace cleanup needs reconciliation.",
23555
+ payload: {
23556
+ contextId: context.id,
23557
+ errorMessage: toErrorMessage$10(error)
23558
+ }
23559
+ });
23560
+ }
23561
+ }
23562
+ function observeExecutionContextWorkspaceProcess(processes, event) {
23563
+ if (event.phase === "process_spawned") processes.set(event.processId, false);
23564
+ else if (event.phase === "process_exit") processes.set(event.processId, event.ownedProcessesQuiescent === true);
23565
+ }
22619
23566
  async function resolveDispatchComputerFileAccess(input) {
22620
23567
  const policy = await readComputerFileAccessPolicy(input.computerFileAccessStorePath);
22621
23568
  const verifier = input.runtimeControllerSupport.localAdapterEntry.adapter.verifyComputerFileAccessBoundary;
23569
+ if (input.parsedTask.executionContext) {
23570
+ const context = input.parsedTask.executionContext;
23571
+ if (input.parsedTask.agentControllerRef === "builtin:claude-code" && context.access === "space_context") return null;
23572
+ if (input.parsedTask.agentControllerRef !== "builtin:codex" || input.parsedTask.transportMode !== "codex-app-server" || !verifier) throw new Error("execution_context.file_access_unsupported");
23573
+ const workingDirectory = input.runtimePreparation.effectiveRuntimeContext.providerRuntimeWorkingDirectory;
23574
+ const boundary = executionContextFileAccessBoundary({
23575
+ context,
23576
+ workingDirectory,
23577
+ policy,
23578
+ taskWorkspace: input.taskWorkspace
23579
+ });
23580
+ if (!(await verifier({
23581
+ boundary,
23582
+ workingDirectory,
23583
+ executionMode: "normal",
23584
+ agentControllerPermissionMode: input.routeConfig?.agentControllerPermissionMode,
23585
+ launchContract: input.routeConfig?.launchContract ?? null,
23586
+ transportMode: input.parsedTask.transportMode
23587
+ })).supported) throw new Error("execution_context.file_access_unverified");
23588
+ return boundary;
23589
+ }
22622
23590
  const admission = await resolveComputerFileAccessAdmission({
22623
23591
  agentControllerPermissionMode: input.routeConfig?.agentControllerPermissionMode,
22624
23592
  agentControllerRef: input.parsedTask.agentControllerRef,
@@ -22675,6 +23643,12 @@ function createDispatchSpaceActionRuntimeContext(input) {
22675
23643
  }
22676
23644
  async function resolveRuntimeResultFromRuntimeOrCliSpaceAction(input) {
22677
23645
  if (!input.dispatchSpaceActionContext) return await input.runtimeExecutionPromise;
23646
+ if (input.parsedTask.executionContext) return await applyCliSpaceActionRecordIfPresent({
23647
+ dispatchSpaceActionContext: input.dispatchSpaceActionContext,
23648
+ parsedTask: input.parsedTask,
23649
+ presenter: input.presenter,
23650
+ runtimeResult: await input.runtimeExecutionPromise
23651
+ });
22678
23652
  const cliSpaceActionAbortController = new AbortController();
22679
23653
  let completion;
22680
23654
  try {
@@ -23059,6 +24033,10 @@ async function resolveRuntimeResultStructuredSpaceAction(input) {
23059
24033
  agentControllerConversationOverride: input.agentControllerConversationOverride
23060
24034
  });
23061
24035
  return runDispatchRuntimeExecution({
24036
+ onInteractionRequest: input.onInteractionRequest,
24037
+ onNativeTurnStarted: input.onNativeTurnStarted,
24038
+ onNativeTurnCompleted: input.onNativeTurnCompleted,
24039
+ onRuntimeEvent: input.onRuntimeEvent,
23062
24040
  computerFileAccessBoundary: input.computerFileAccessBoundary,
23063
24041
  contextId: repairContinuation.contextId,
23064
24042
  executionMode: "repair",
@@ -23298,6 +24276,10 @@ async function coordinateConcurrentAgentReply(input) {
23298
24276
  }
23299
24277
  });
23300
24278
  let runtimeResult = await runDispatchRuntimeExecution({
24279
+ onInteractionRequest: input.onInteractionRequest,
24280
+ onNativeTurnStarted: input.onNativeTurnStarted,
24281
+ onNativeTurnCompleted: input.onNativeTurnCompleted,
24282
+ onRuntimeEvent: input.onRuntimeEvent,
23301
24283
  agentControllerConversationOverride: continuation.agentControllerConversationOverride,
23302
24284
  computerFileAccessBoundary: input.computerFileAccessBoundary,
23303
24285
  contextId: continuation.contextId,
@@ -23739,11 +24721,12 @@ function resolveStructuredSpaceActionProvenance(input) {
23739
24721
  if (!input.resolvedSpaceAction) return;
23740
24722
  return input.runtimeResult.resultPayload.spaceActionProvenance ?? "direct";
23741
24723
  }
23742
- function runDispatchRuntimeExecution(input) {
23743
- return runRuntimeTask({
23744
- ...input.agentControllerConversationOverride ? { agentContextOverride: {
24724
+ async function runDispatchRuntimeExecution(input) {
24725
+ input.onNativeTurnStarted();
24726
+ const result = await runRuntimeTask({
24727
+ ...input.parsedTask.executionContext || input.agentControllerConversationOverride ? { agentContextOverride: {
23745
24728
  agentControllerConversationId: input.contextId,
23746
- agentControllerConversationOverride: input.agentControllerConversationOverride
24729
+ agentControllerConversationOverride: input.agentControllerConversationOverride ?? null
23747
24730
  } } : {},
23748
24731
  io: input.io,
23749
24732
  ...input.onInteractionRequest ? { onInteractionRequest: input.onInteractionRequest } : {},
@@ -23767,6 +24750,8 @@ function runDispatchRuntimeExecution(input) {
23767
24750
  runtimeContext: input.runtimeContext
23768
24751
  })
23769
24752
  });
24753
+ input.onNativeTurnCompleted(result);
24754
+ return result;
23770
24755
  }
23771
24756
  function buildDispatchRuntimeRoute(input) {
23772
24757
  const runtimeEnv = input.contextId ? {
@@ -23800,6 +24785,7 @@ function buildDispatchRuntimeRoute(input) {
23800
24785
  }
23801
24786
  function buildDispatchRuntimeTask(input) {
23802
24787
  return {
24788
+ executionContext: input.parsedTask.executionContext,
23803
24789
  agentId: input.parsedTask.targetProfileId,
23804
24790
  attemptId: input.parsedTask.attemptId,
23805
24791
  bindingKey: `${input.parsedTask.spaceId}|${input.parsedTask.targetProfileId}`,
@@ -27421,32 +28407,67 @@ function createControlledShutdownCoordinator(input) {
27421
28407
  },
27422
28408
  requestServiceStop,
27423
28409
  async request(payload) {
27424
- const stopCause = await resolveRecentDaemonSignalStopCause();
27425
- if (shutdownAttempt) await shutdownAttempt.promise;
27426
- else if (activeSessionShutdownResolver) {
27427
- const currentAttempt = Promise.withResolvers();
27428
- shutdownAttempt = currentAttempt;
27429
- activeSessionShutdownResolver(stopCause);
27430
- try {
27431
- await currentAttempt.promise;
27432
- } finally {
27433
- if (shutdownAttempt === currentAttempt) shutdownAttempt = null;
28410
+ return await withControlledStopRefusalProof({
28411
+ guarded: payload.onAdmission !== void 0,
28412
+ isStopping: () => shutdownAttempt !== null || input.isStopRequested(),
28413
+ run: async (markCommitted) => {
28414
+ const stopCause = await resolveRecentDaemonSignalStopCause();
28415
+ if (shutdownAttempt) {
28416
+ markCommitted();
28417
+ const existingAttempt = shutdownAttempt;
28418
+ await payload.onAdmission?.(() => void 0);
28419
+ await existingAttempt.promise;
28420
+ } else if (activeSessionShutdownResolver) {
28421
+ const currentAttempt = Promise.withResolvers();
28422
+ const clearAttempt = () => {
28423
+ if (shutdownAttempt === currentAttempt) shutdownAttempt = null;
28424
+ };
28425
+ currentAttempt.promise.then(clearAttempt, clearAttempt);
28426
+ const resolver = activeSessionShutdownResolver;
28427
+ const commit = () => {
28428
+ if (shutdownAttempt || activeSessionShutdownResolver !== resolver) throw new Error("Service session changed before Stop admission.");
28429
+ markCommitted();
28430
+ shutdownAttempt = currentAttempt;
28431
+ resolver(stopCause);
28432
+ };
28433
+ await (payload.onAdmission ?? commitControlledStop)(commit);
28434
+ await currentAttempt.promise;
28435
+ } else {
28436
+ if (input.hasUndrainedWork()) throw new DaemonServiceRunError({
28437
+ code: "daemon.control.shutdown_drain_unavailable",
28438
+ message: "controlled shutdown cannot verify active local work without a connected runtime session"
28439
+ });
28440
+ const commit = () => {
28441
+ if (activeSessionShutdownResolver || input.hasUndrainedWork()) throw new Error("Service work changed before Stop admission.");
28442
+ markCommitted();
28443
+ requestServiceStop(stopCause);
28444
+ };
28445
+ await (payload.onAdmission ?? commitControlledStop)(commit);
28446
+ }
28447
+ return {
28448
+ accepted: true,
28449
+ gracePeriodMs: payload.gracePeriodMs,
28450
+ mode: payload.mode
28451
+ };
27434
28452
  }
27435
- } else {
27436
- if (input.hasUndrainedWork()) throw new DaemonServiceRunError({
27437
- code: "daemon.control.shutdown_drain_unavailable",
27438
- message: "controlled shutdown cannot verify active local work without a connected runtime session"
27439
- });
27440
- requestServiceStop(stopCause);
27441
- }
27442
- return {
27443
- accepted: true,
27444
- gracePeriodMs: payload.gracePeriodMs,
27445
- mode: payload.mode
27446
- };
28453
+ });
27447
28454
  }
27448
28455
  };
27449
28456
  }
28457
+ function commitControlledStop(commit) {
28458
+ commit();
28459
+ }
28460
+ async function withControlledStopRefusalProof(input) {
28461
+ let committed = input.isStopping();
28462
+ try {
28463
+ return await input.run(() => {
28464
+ committed = true;
28465
+ });
28466
+ } catch (error) {
28467
+ if (input.guarded && !committed && !input.isStopping()) throw new ServiceAccountAdmissionError("stop_refused", error instanceof Error ? error.message : String(error));
28468
+ throw error;
28469
+ }
28470
+ }
27450
28471
  function hasUndrainedLocalWork(input) {
27451
28472
  return input.inflightDispatchMetaByTaskId.size > 0 || listDispatchResultOutboxPendingAcknowledgementKeys({ ledgerPaths: input.ledgerPaths }).length > 0;
27452
28473
  }
@@ -27467,6 +28488,11 @@ async function runSocketSessionWithControlledShutdown(input) {
27467
28488
  input.controlledShutdown.handleSessionCompleted();
27468
28489
  }
27469
28490
  const runDaemonServiceLoop = async (input) => {
28491
+ const auth = await getAuthSessionState({ refreshExpired: true });
28492
+ if (auth.state !== "valid" || !auth.session?.user?.id) throw new Error("A valid CLI account is required to start this Service.");
28493
+ return await withAdmittedServiceSession(auth.session, async () => await runAccountBoundDaemonServiceLoop(input));
28494
+ };
28495
+ const runAccountBoundDaemonServiceLoop = async (input) => {
27470
28496
  await assertDaemonServiceLaunchScope();
27471
28497
  const baseUrl = await resolveBaseUrl(input.baseUrl);
27472
28498
  const ownerContext = await resolveDaemonServiceOwnerContext({ openMeldProfileId: input.profile });
@@ -27652,6 +28678,7 @@ const runDaemonServiceLoop = async (input) => {
27652
28678
  const controlPlaneServer = await startLocalDaemonControlPlaneServer({
27653
28679
  resolveExpectedToken: async () => await ensureDaemonControlPlaneToken(),
27654
28680
  getContext: async () => ({
28681
+ accountCheckedServiceControl: process.platform !== "win32",
27655
28682
  healthPayload: {
27656
28683
  checkedAt: nowIsoString(),
27657
28684
  ...toHealthProjection(stopRequested ? {
@@ -27706,7 +28733,19 @@ const runDaemonServiceLoop = async (input) => {
27706
28733
  requestActiveRouteCatalogSync
27707
28734
  });
27708
28735
  },
27709
- shutdownHandler: controlledShutdown.request,
28736
+ shutdownHandler: async (payload) => {
28737
+ const admissionId = payload.accountAdmissionId;
28738
+ return await controlledShutdown.request({
28739
+ ...payload,
28740
+ ...admissionId ? { onAdmission: async (commit) => await admitServiceAccountStop({
28741
+ id: admissionId,
28742
+ ownerUserId,
28743
+ deviceId,
28744
+ contractGeneration: daemonServiceContract?.generation ?? 0,
28745
+ commit
28746
+ }) } : {}
28747
+ });
28748
+ },
27710
28749
  serviceUpdateReadinessHandler: () => {
27711
28750
  const unacknowledgedResultCount = listDispatchResultOutboxPendingAcknowledgementKeys({ ledgerPaths }).length;
27712
28751
  return {
@@ -31857,6 +32896,7 @@ function summarizeDaemonStopJournalResult(stopResult) {
31857
32896
  }
31858
32897
  async function stopCurrentLaneDaemonService(input) {
31859
32898
  const context = await loadCurrentLaneDaemonStopContext();
32899
+ 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.");
31860
32900
  await emitDaemonLifecycleEvent({
31861
32901
  type: "owner.snapshot",
31862
32902
  result: "observed",
@@ -31876,6 +32916,7 @@ async function stopCurrentLaneDaemonService(input) {
31876
32916
  });
31877
32917
  if (context.stopStrategy.kind === "not_running") return await buildDaemonStopNotRunningResult(context.ownerSnapshot.runtimeStatus);
31878
32918
  if (context.stopStrategy.kind === "manager_first") return await stopManagedCurrentLaneDaemonService({
32919
+ controlledShutdownComplete: input.completedControlledShutdownOwnerPid !== void 0,
31879
32920
  force: input.force,
31880
32921
  mode: input.mode,
31881
32922
  ownerSnapshot: context.ownerSnapshot,
@@ -31956,7 +32997,7 @@ async function stopManagedCurrentLaneDaemonService(input) {
31956
32997
  if (input.mode === "interactive") {
31957
32998
  if (!await confirmStopServiceManager(input.runtime, input.ownerSnapshot.runtimeStatus)) return { status: "cancelled" };
31958
32999
  }
31959
- const drainPreparationResult = await prepareManagedDaemonServiceForStop({
33000
+ const drainPreparationResult = input.controlledShutdownComplete ? null : await prepareManagedDaemonServiceForStop({
31960
33001
  force: input.force,
31961
33002
  mode: input.mode,
31962
33003
  ownerSnapshot: input.ownerSnapshot
@@ -33820,7 +34861,7 @@ async function runDaemonRunInteractivePreflightBeforeModePrompt(input) {
33820
34861
  }
33821
34862
  return null;
33822
34863
  }
33823
- async function runDaemonStop(input) {
34864
+ async function runDaemonStop(input, internal = {}) {
33824
34865
  const runtime = await resolveRuntimeContext({ view: input.view });
33825
34866
  const presenter = input.json === true ? createQuietPresenter(runtime) : createPresenter(runtime);
33826
34867
  emitDaemonOverviewIfAgent({
@@ -33840,6 +34881,7 @@ async function runDaemonStop(input) {
33840
34881
  run: async () => {
33841
34882
  if (resolveOpenMeldEnvPreset() === "dev-local") await uninstallDaemonServiceUpdateWorker();
33842
34883
  const stopped = await executeDaemonStopCommand({
34884
+ completedControlledShutdownOwnerPid: internal.completedControlledShutdownOwnerPid,
33843
34885
  force: input.force,
33844
34886
  presenter,
33845
34887
  profile: input.profile,
@@ -33921,6 +34963,7 @@ async function runDaemonAutostart(input, options = {}) {
33921
34963
  }
33922
34964
  async function executeDaemonStopCommand(input) {
33923
34965
  const stopResult = await stopCurrentLaneDaemonService({
34966
+ completedControlledShutdownOwnerPid: input.completedControlledShutdownOwnerPid,
33924
34967
  force: input.force,
33925
34968
  mode: "interactive",
33926
34969
  runtime: input.runtime
@@ -35399,6 +36442,7 @@ async function resolveDetachedDaemonServiceLaunchTarget() {
35399
36442
  function buildDetachedDaemonLaunchSpec(input) {
35400
36443
  const detachedMode = input.mode === "background" ? "foreground" : input.mode;
35401
36444
  const sharedArgs = [
36445
+ ...input.accountAdmissionId ? ["--account-admission-id", input.accountAdmissionId] : [],
35402
36446
  ...input.openMeldProfileId ? ["--profile", input.openMeldProfileId] : [],
35403
36447
  ...input.deviceId ? ["--device-id", input.deviceId] : [],
35404
36448
  ...typeof input.heartbeatMs === "number" ? ["--heartbeat-ms", String(input.heartbeatMs)] : [],
@@ -39929,6 +40973,6 @@ async function emitAgentsConfigParseFallbackSignal(input) {
39929
40973
  });
39930
40974
  }
39931
40975
  //#endregion
39932
- export { renderHumanTextErrorCard as $, ensureCommandAuthenticationOrCancel as $n, buildSignalMessageReadProjection as $t, runDaemonBackgroundStartForDecision as A, buildAgentActivityEvent as An, cliJsonSkillsShowEnvelopeSchema as Ar, resolveLocalAgentControllerLaunchability as At, runDaemonUninstall as B, enqueueControllerTaskLifecycleEventWhileLocked as Bn, readSpaceRecentMentionProfileIds as Bt, resolveGatewayWebOrigin as C, returnToTargetPickerState as Cn, isCurrentCommandCheckScopeActive as Cr, validateLocalProjectConnectionPath as Ct, isManagedSystemServiceBootstrapRun as D, readRecentDaemonDispatchJournalEvents as Dn, cliJsonOutputEnvelopeSchema as Dr, submitRuntimeAgentControllerReports as Dt, bestEffortStopCurrentLaneDaemonService as E, OPENMELD_DISPATCH_RUNTIME_MODE_ENV as En, cliJsonErrorEnvelopeSchema as Er, submitRuntimeAgentControllerReport as Et, runDaemonRunAfterEntryChecks as F, removeAgentActivityContextCache as Fn, revokeOrganizationJoinLinkResponseSchema as Fr, isLocalSpaceStateCorruptResult as Ft, buildProfileWorkspaceRows as G, unregisterAgentActivityRoute as Gn, upsertSpaceConfig as Gt, formatServiceRuntimeHeadline as H, isAgentActivityRouteRegistered as Hn, toLocalSpaceStateIntegrityError as Ht, runDaemonSnapshot as I, enqueueAgentActivityHookEvent as In, listSpaceConfigs as It, createDelayedSpinner as J, installAgentActivityIntegrations as Jn, SpaceComposerSubmissionError as Jt, reconcileCliVersionView as K, AGENT_ACTIVITY_INTEGRATION_OWNER as Kn, writeSpaceCacheDeletionNoticeState as Kt, runDaemonStatusFlow as L, removeProjectInbox as Ln, readSpaceCacheDeletionNoticeState as Lt, runDaemonInstall as M, normalizeSharedSessionTitle as Mn, getOrganizationJoinLinkResponseSchema as Mr, projectSpaceProfileCache as Mt, runDaemonInterrupt as N, readCodexSessionTitles as Nn, organizationJoinLinkErrorResponseSchema as Nr, LocalSpaceStateIntegrityError as Nt, runDaemon as O, connectWebSocket as On, cliJsonSkillsListEnvelopeSchema as Or, collectLocalAgentControllerInventory as Ot, runDaemonReinstall as P, readAgentActivityContextForPath as Pn, organizationJoinLinkManagementQuerySchema as Pr, inspectSpaceCacheFile as Pt, renderHumanErrorCard as Q, buildCommandAuthenticationPromptMessage as Qn, buildSignalIndex as Qt, runDaemonStop as R, readAgentActivityOutboxHealth as Rn, readSpaceConfig as Rt, buildSpaceWebUrl as S, resolveSpaceMemberAgentOwnerWakeDiagnosticsView as Sn, getCurrentCommandCheckState as Sr, LocalProjectConnectionError as St, runDaemonServiceParticipationGate as T, DISPATCH_OWNED_RUNTIME_MODE as Tn, startCurrentCommandCheckScope as Tr, submitProfileRuntimeAgentControllerReport as Tt, resolveServiceParticipationReadiness as U, registerAgentActivityRoute as Un, toSpaceConfigListIntegrityError as Ut, formatServiceParticipationReadinessLabel as V, readControllerTaskLifecycleOutboxHealth as Vn, removeSpaceConfig as Vt, buildProfileWorkspacePresentation as W, resolveAgentActivityRouteForPath as Wn, updateSpaceLastSeenTs as Wt, runDaemonStartDecisionPrompt as X, resolveAgentActivityDispatcherCommand as Xn, buildDispatchResultReplyWorkflowProjection as Xt, shouldEmitAgentOverview as Y, readAgentActivityIntegrationStatus as Yn, buildDispatchResultMessageReadProjection as Yt, buildHumanErrorCopy as Z, uninstallAgentActivityIntegrations as Zn, buildPublicSpaceEntryUrl as Zt, promptSearchSelect as _, listSpaceMentionSuggestions as _n, revokeAuthAccessToken as _r, assertDispatchOwnedRuntimePublicWriteAllowed as _t, runAgentsCustomRemove as a, buildSpaceRoundReadProjection as an, exchangeOneTimeTokenAuthSession as ar, resolveDaemonServiceParticipationStatus as at, resolveOffsetVisibleWindow as b, prepareSpaceFileOnlySubmission as bn, runInteractivePrompt as br, readDispatchSpaceActionContextFromEnv as bt, runAgentsDisable as c, collectResolvedSpaceMentions as cn, formatActiveOrganizationLabel as cr, fetchSpaceMeta as ct, runAgentsManage as d, enterRelationPickerState as dn, buildUnifiedCardFrame as dr, parseSpaceMetaResponse as dt, buildSignalReplyWorkflowProjection as en, evaluateCommandAuthentication as er, emitCliJsonEnvelope as et, runAgentsRepair as f, extractMentionAuthoringPrefix as fn, extractAuthApiErrorMessage as fr, GatewayHttpError as ft, promptSearchMultiselectWorkbench as g, listSpaceMentionRelationChoices as gn, resolveDeviceTokenExpiresAt as gr, parseJsonResponse as gt, promptSearchMultiselect as h, isTargetPickerState as hn, resolveDeviceAuthClientId as hr, toStructuredGatewayFailure as ht, runAgentsCustomList as i, buildSpaceProfileAddPlan as in, runAuthStatus as ir, writeInstalledLocalComponentsSnapshot as it, runDaemonCancel as j, resolveObservedAgentActivityBinding as jn, acceptOrganizationJoinLinkBodySchema as jr, resolveLocalAgentControllerReportDecision as jt, runDaemonAutostart as k, syncLocalAgentActivity as kn, cliJsonSkillsLoadEnvelopeSchema as kr, resolveLocalAgentControllerBlockerReasonCodes as kt, runAgentsEnable as l, createSpaceMemberIdentityIndex as ln, renderInfoCard as lr, updateSpaceMeta as lt, formatTransportModeDisplay as m, isRelationPickerState as mn, requestDeviceToken as mr, readGatewayTextResponse as mt, runAgentsConfig as n, buildSpaceMentionProfileIndex as nn, runAuthLogout as nr, readDaemonIncidentLogTail as nt, runAgentsCustomUpdate as o, buildUpdatesReplyWorkflowProjection as on, buildAuthStatusRows as or, fetchSpaceUpdates as ot, runAgentsShow as p, formatRemovedCcRelationMessage as pn, fetchAuthUserSnapshot as pr, readGatewayJsonResponse as pt, emitDaemonAgentOverview as q, defaultManagedIntegrationPaths as qn, writeSpaceRecentMentionProfileIds as qt, runAgentsCustomAdd as r, buildSpaceMessageReadRelationSummary as rn, runAuthMenu as rr, resolveLocalComponentsStatus as rt, runAgentsDetect as s, closeMentionPickerState as sn, buildAuthStatusSnapshot as sr, createCliSpaceApi as st, runAgents as t, buildSpaceMemberAgentPresencePresentation as tn, runAuthLogin as tr, runDaemonStartupPreflight as tt, runAgentsList as u, createSpaceTargetCatalog as un, renderTextInfoCard as ur, parseSpaceMetaPayload as ut, clampNumber as v, openTargetPickerState as vn, promptTextEntry as vr, readDispatchOwnedRuntimeGuard as vt, resolveSpaceWebGatewayOrigin as w, updateAuthoredMentionRanges as wn, resetCurrentCommandCheckState as wr, readRuntimeReportingHealthState as wt, computeRetryDelayMs as x, resolveNextRecentMentionProfileIdsForQueuedText as xn, finishCurrentCommandCheckScope as xr, writeDispatchSpaceActionRecord as xt, resolveAnchoredVisibleWindow as y, prepareSpaceComposerSubmission as yn, isReturnKeypress as yr, OPENMELD_SPACE_ACTION_CONTEXT_PATH_ENV as yt, runDaemonTeardownStrict as z, removeProjectOutbox as zn, readSpaceLastSeenTs as zt };
40976
+ export { buildHumanErrorCopy as $, readAgentActivityIntegrationStatus as $n, buildDispatchResultMessageReadProjection as $t, runDaemonBackgroundStartForDecision as A, OPENMELD_DISPATCH_RUNTIME_MODE_ENV as An, cliJsonErrorEnvelopeSchema as Ar, submitRuntimeAgentControllerReport as At, runDaemonTeardownStrict as B, enqueueAgentActivityHookEvent as Bn, listSpaceConfigs as Bt, resolveGatewayWebOrigin as C, prepareSpaceComposerSubmission as Cn, isReturnKeypress as Cr, readDispatchSpaceActionContextForReceiptFromEnv as Ct, isManagedSystemServiceBootstrapRun as D, returnToTargetPickerState as Dn, isCurrentCommandCheckScopeActive as Dr, validateLocalProjectConnectionPath as Dt, bestEffortStopCurrentLaneDaemonService as E, resolveSpaceMemberAgentOwnerWakeDiagnosticsView as En, getCurrentCommandCheckState as Er, LocalProjectConnectionError as Et, runDaemonRunAfterEntryChecks as F, resolveObservedAgentActivityBinding as Fn, acceptOrganizationJoinLinkBodySchema as Fr, resolveLocalAgentControllerReportDecision as Ft, buildProfileWorkspacePresentation as G, readControllerTaskLifecycleOutboxHealth as Gn, removeSpaceConfig as Gt, formatServiceParticipationReadinessLabel as H, readAgentActivityOutboxHealth as Hn, readSpaceConfig as Ht, runDaemonServiceDetached as I, normalizeSharedSessionTitle as In, getOrganizationJoinLinkResponseSchema as Ir, projectSpaceProfileCache as It, createQuietPresenter as J, resolveAgentActivityRouteForPath as Jn, updateSpaceLastSeenTs as Jt, buildProfileWorkspaceRows as K, isAgentActivityRouteRegistered as Kn, toLocalSpaceStateIntegrityError as Kt, runDaemonSnapshot as L, readCodexSessionTitles as Ln, organizationJoinLinkErrorResponseSchema as Lr, LocalSpaceStateIntegrityError as Lt, runDaemonInstall as M, connectWebSocket as Mn, cliJsonSkillsListEnvelopeSchema as Mr, collectLocalAgentControllerInventory as Mt, runDaemonInterrupt as N, syncLocalAgentActivity as Nn, cliJsonSkillsLoadEnvelopeSchema as Nr, resolveLocalAgentControllerBlockerReasonCodes as Nt, runDaemon as O, updateAuthoredMentionRanges as On, resetCurrentCommandCheckState as Or, readRuntimeReportingHealthState as Ot, runDaemonReinstall as P, buildAgentActivityEvent as Pn, cliJsonSkillsShowEnvelopeSchema as Pr, resolveLocalAgentControllerLaunchability as Pt, runDaemonStartDecisionPrompt as Q, installAgentActivityIntegrations as Qn, SpaceComposerSubmissionError as Qt, runDaemonStatusFlow as R, readAgentActivityContextForPath as Rn, organizationJoinLinkManagementQuerySchema as Rr, inspectSpaceCacheFile as Rt, buildSpaceWebUrl as S, openTargetPickerState as Sn, promptTextEntry as Sr, OPENMELD_SPACE_ACTION_CONTEXT_PATH_ENV as St, runDaemonServiceParticipationGate as T, resolveNextRecentMentionProfileIdsForQueuedText as Tn, finishCurrentCommandCheckScope as Tr, writeDispatchSpaceActionRecord as Tt, formatServiceRuntimeHeadline as U, removeProjectOutbox as Un, readSpaceLastSeenTs as Ut, runDaemonUninstall as V, removeProjectInbox as Vn, readSpaceCacheDeletionNoticeState as Vt, resolveServiceParticipationReadiness as W, enqueueControllerTaskLifecycleEventWhileLocked as Wn, readSpaceRecentMentionProfileIds as Wt, createDelayedSpinner as X, AGENT_ACTIVITY_INTEGRATION_OWNER as Xn, writeSpaceCacheDeletionNoticeState as Xt, emitDaemonAgentOverview as Y, unregisterAgentActivityRoute as Yn, upsertSpaceConfig as Yt, shouldEmitAgentOverview as Z, defaultManagedIntegrationPaths as Zn, writeSpaceRecentMentionProfileIds as Zt, promptSearchSelect as _, formatRemovedCcRelationMessage as _n, fetchAuthUserSnapshot as _r, toStructuredGatewayFailure as _t, runAgentsCustomRemove as a, buildSpaceMemberAgentPresencePresentation as an, runAuthLogin as ar, resolveLocalComponentsStatus as at, resolveOffsetVisibleWindow as b, listSpaceMentionRelationChoices as bn, resolveDeviceTokenExpiresAt as br, readDispatchOwnedRuntimeGuard as bt, runAgentsDisable as c, buildSpaceProfileAddPlan as cn, runAuthStatus as cr, fetchSpaceUpdates as ct, runAgentsManage as d, closeMentionPickerState as dn, buildAuthStatusSnapshot as dr, updateSpaceMeta as dt, buildDispatchResultReplyWorkflowProjection as en, resolveAgentActivityDispatcherCommand as er, renderHumanErrorCard as et, runAgentsRepair as f, collectResolvedSpaceMentions as fn, formatActiveOrganizationLabel as fr, parseSpaceMetaPayload as ft, promptSearchMultiselectWorkbench as g, extractMentionAuthoringPrefix as gn, extractAuthApiErrorMessage as gr, readGatewayTextResponse as gt, promptSearchMultiselect as h, enterRelationPickerState as hn, buildUnifiedCardFrame as hr, readGatewayJsonResponse as ht, runAgentsCustomList as i, buildSignalReplyWorkflowProjection as in, evaluateCommandAuthentication as ir, readDaemonIncidentLogTail as it, runDaemonCancel as j, readRecentDaemonDispatchJournalEvents as jn, cliJsonOutputEnvelopeSchema as jr, submitRuntimeAgentControllerReports as jt, runDaemonAutostart as k, DISPATCH_OWNED_RUNTIME_MODE as kn, startCurrentCommandCheckScope as kr, submitProfileRuntimeAgentControllerReport as kt, runAgentsEnable as l, buildSpaceRoundReadProjection as ln, exchangeOneTimeTokenAuthSession as lr, createCliSpaceApi as lt, formatTransportModeDisplay as m, createSpaceTargetCatalog as mn, renderTextInfoCard as mr, GatewayHttpError as mt, runAgentsConfig as n, buildSignalIndex as nn, buildCommandAuthenticationPromptMessage as nr, emitCliJsonEnvelope as nt, runAgentsCustomUpdate as o, buildSpaceMentionProfileIndex as on, runAuthLogout as or, writeInstalledLocalComponentsSnapshot as ot, runAgentsShow as p, createSpaceMemberIdentityIndex as pn, renderInfoCard as pr, parseSpaceMetaResponse as pt, reconcileCliVersionView as q, registerAgentActivityRoute as qn, toSpaceConfigListIntegrityError as qt, runAgentsCustomAdd as r, buildSignalMessageReadProjection as rn, ensureCommandAuthenticationOrCancel as rr, runDaemonStartupPreflight as rt, runAgentsDetect as s, buildSpaceMessageReadRelationSummary as sn, runAuthMenu as sr, resolveDaemonServiceParticipationStatus as st, runAgents as t, buildPublicSpaceEntryUrl as tn, uninstallAgentActivityIntegrations as tr, renderHumanTextErrorCard as tt, runAgentsList as u, buildUpdatesReplyWorkflowProjection as un, buildAuthStatusRows as ur, fetchSpaceMeta as ut, clampNumber as v, isRelationPickerState as vn, requestDeviceToken as vr, parseJsonResponse as vt, resolveSpaceWebGatewayOrigin as w, prepareSpaceFileOnlySubmission as wn, runInteractivePrompt as wr, readDispatchSpaceActionContextFromEnv as wt, computeRetryDelayMs as x, listSpaceMentionSuggestions as xn, revokeAuthAccessToken as xr, DispatchSpaceActionClosedError as xt, resolveAnchoredVisibleWindow as y, isTargetPickerState as yn, resolveDeviceAuthClientId as yr, assertDispatchOwnedRuntimePublicWriteAllowed as yt, runDaemonStop as z, removeAgentActivityContextCache as zn, revokeOrganizationJoinLinkResponseSchema as zr, isLocalSpaceStateCorruptResult as zt };
39933
40977
 
39934
- //# sourceMappingURL=agents-BOTlKiwS.js.map
40978
+ //# sourceMappingURL=agents-pHCyQoFw.js.map