lody 0.115.0 → 0.116.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{access-Sut1_1-c.js → access-DIhEb_MP.js} +333 -314
- package/dist/{acp-interaction-owner-uSfNzpiU.js → acp-interaction-owner-8OMcZVET.js} +33 -33
- package/dist/{agent-execution-D1-dEIN6.js → agent-execution-ZTPT3A88.js} +13 -13
- package/dist/{analytics-events-BQIrmfJp.js → analytics-events-BNLOju7l.js} +2 -2
- package/dist/{app-J2sTmsZo.js → app-DzrwnZPK.js} +34 -34
- package/dist/{application-runtime-BPgp9fKR.js → application-runtime-4EGQJvLm.js} +2 -2
- package/dist/{auth-CTegS0TL.js → auth-CA7u_ijj.js} +8 -8
- package/dist/{automation-BL7x_nUm.js → automation-ClFKwWKg.js} +34 -34
- package/dist/baguette-worker.js +6 -6
- package/dist/chunks/{vendor-@agentclientprotocol-sdk-CpxTRW1f.js → vendor-@agentclientprotocol-sdk-54yhgJSn.js} +2 -2
- package/dist/chunks/{vendor-@anthropic-ai-claude-agent-sdk-B0HhZ112.js → vendor-@anthropic-ai-claude-agent-sdk-NAjHQcVv.js} +27 -3
- package/dist/chunks/{vendor-@better-auth-api-key-D0bKvhcn.js → vendor-@better-auth-api-key-Dy9PtbSj.js} +2 -2
- package/dist/chunks/{vendor-@better-auth-core-Dpzqxq_j.js → vendor-@better-auth-core-C7hql1k7.js} +8 -8
- package/dist/chunks/{vendor-@effect-platform-node-shared-DkrmBObz.js → vendor-@effect-platform-node-shared-DUSlMsdQ.js} +2 -2
- package/dist/chunks/{vendor-@loro-dev-streams-client-DPTfaXHE.js → vendor-@loro-dev-streams-client-DkeRiNAY.js} +1329 -88
- package/dist/chunks/{vendor-@loro-dev-streams-crdt-BOuVa3yO.js → vendor-@loro-dev-streams-crdt-CsXRvQxK.js} +861 -322
- package/dist/chunks/{vendor-@modelcontextprotocol-client-B_Q9G9Ku.js → vendor-@modelcontextprotocol-client-DuJtk4js.js} +3 -3
- package/dist/chunks/{vendor-@modelcontextprotocol-core-CW-vRGZP.js → vendor-@modelcontextprotocol-core-BkUcdvo6.js} +2 -2
- package/dist/chunks/{vendor-@modelcontextprotocol-node-CSCPUEbv.js → vendor-@modelcontextprotocol-node-D0s30TCx.js} +2 -2
- package/dist/chunks/{vendor-@modelcontextprotocol-server-BA5N3RYD.js → vendor-@modelcontextprotocol-server-C9c_OMTp.js} +3 -3
- package/dist/chunks/{vendor-@opencode-codemode-61MXX511.js → vendor-@opencode-codemode-DmkYINkB.js} +2 -2
- package/dist/chunks/{vendor-@sorbetai-artifacts-Dt9BTK8Q.js → vendor-@sorbetai-artifacts-Vz3r0uhj.js} +3 -3
- package/dist/chunks/{vendor-@sorbetai-context-COh8_Kmc.js → vendor-@sorbetai-context-BV7q3KwO.js} +2 -2
- package/dist/chunks/{vendor-@sorbetai-control-HcZa4Y-V.js → vendor-@sorbetai-control-C9pxQF9a.js} +137 -51
- package/dist/chunks/{vendor-@sorbetai-plugins-Bs93fyHc.js → vendor-@sorbetai-plugins-COkYjDxn.js} +3 -3
- package/dist/chunks/{vendor-@sorbetai-runtime-kicj4Xs_.js → vendor-@sorbetai-runtime-DKAfUiS0.js} +172 -60
- package/dist/chunks/{vendor-@sorbetai-schema-BYxzbt6U.js → vendor-@sorbetai-schema-D53JJ0HJ.js} +2 -2
- package/dist/chunks/{vendor-better-auth-PQ6PT4aF.js → vendor-better-auth-D1bP-dEy.js} +2 -2
- package/dist/chunks/{vendor-effect-CNM-5PoN.js → vendor-effect-BTVRmkqM.js} +418 -418
- package/dist/chunks/{vendor-es-toolkit-DnvFX_hl.js → vendor-es-toolkit-BDp9OdLC.js} +4 -4
- package/dist/chunks/{vendor-loro-repo-B1zdQ8Qd.js → vendor-loro-repo-DbOhEZ39.js} +2166 -93
- package/dist/chunks/{vendor-zod-DAcQjQuC.js → vendor-zod-nebGZ0VM.js} +6 -6
- package/dist/claude-acp.js +28 -7
- package/dist/{cli-platform-Cfc6A61f.js → cli-platform-qpp4fxi7.js} +6 -6
- package/dist/{cli-presence-application-D2Dn0fPM.js → cli-presence-application-Cw9rnD3u.js} +18 -18
- package/dist/{client-BsIzN-iC.js → client-09TiIsd2.js} +33 -33
- package/dist/{cloudflared-native-DmvSYnMb.js → cloudflared-native-Ber1sIlU.js} +4 -4
- package/dist/cloudflared-worker.js +7 -7
- package/dist/{code-collab-Cgso3Ix3.js → code-collab-DRoDl8u7.js} +3 -3
- package/dist/codex-acp.js +2 -1
- package/dist/{command-runtime-C7EPuHLe.js → command-runtime-CYs2KAyh.js} +774 -224
- package/dist/{const-LYLptZ7f.js → const-C9yql4zo.js} +2 -2
- package/dist/{control-CgRxpxvc.js → control-HMzEZJTm.js} +36 -36
- package/dist/{cross-workspace-D6-aE1-w.js → cross-workspace-CEB-pWmO.js} +3 -3
- package/dist/{daemon-runner-Bn8O9-a0.js → daemon-runner-BHgvKJ_l.js} +27 -27
- package/dist/{daemon-DWm2IzH9.js → daemon-s8LqFNYd.js} +30 -30
- package/dist/{daemon-session-tools-BSAgq4O1.js → daemon-session-tools-CrxHUVDk.js} +46 -46
- package/dist/{daemon-shared-NcwWGSEj.js → daemon-shared-BGfDcTED.js} +10 -10
- package/dist/{daemon-update-qOLnkZcv.js → daemon-update-BjGbzSFc.js} +2 -2
- package/dist/deepseek-acp.js +14 -2
- package/dist/{deepseek-harness-runtime-D6lV9pxi.js → deepseek-harness-runtime-CtfyKY7w.js} +8 -8
- package/dist/{deepseek-system-node-C2YpUQwp.js → deepseek-system-node-CBHH8N-Z.js} +4 -4
- package/dist/{device-preview-BjqAbZ9g.js → device-preview-WVdriBmC.js} +36 -11
- package/dist/devin-acp.js +2 -1
- package/dist/{diff-line-counts-ClicfZ_E.js → diff-line-counts-C7vhQioX.js} +2 -2
- package/dist/{diff-worker-task-BVD3EgeO.js → diff-worker-task-wwEm25bo.js} +2 -2
- package/dist/diff-worker.js +5 -5
- package/dist/{discovery-query-C_7lyBI8.js → discovery-query-6rvHO0Ax.js} +4 -4
- package/dist/{dsh-DVyIAYZ9.js → dsh-D8jYqbih.js} +9 -9
- package/dist/{dsh-plugins-Dfsqsiu7.js → dsh-plugins-BGuhIgPz.js} +15 -15
- package/dist/{e2ee-CslOKVIM.js → e2ee-BDxs5Gma.js} +3 -3
- package/dist/{e2ee-execution-intent-DYBEG410.js → e2ee-execution-intent-BTTWEaTs.js} +4 -4
- package/dist/{export-C-zeWP1i.js → export-BVe6KJcH.js} +40 -40
- package/dist/{feedback-Dde39k5W.js → feedback-8RRkLuXP.js} +34 -34
- package/dist/{feedback-jvl2Dz8w.js → feedback-Da3aBQ2E.js} +4 -4
- package/dist/{file-index-scan-core-Bta7tnbY.js → file-index-scan-core-QNHdA1nq.js} +5 -5
- package/dist/file-index-scan-worker.js +8 -8
- package/dist/{file-lock-By0YSSDw.js → file-lock-Oeerthnp.js} +9 -9
- package/dist/{github-BtMkInqL.js → github-B3lOSLjx.js} +33 -33
- package/dist/grok-acp.js +2 -1
- package/dist/{http-transport-C1f1XEnB.js → http-transport-3J_3rzKQ.js} +6 -6
- package/dist/{index-C41WZg1y.js → index-C5TYbo5p.js} +2 -2
- package/dist/{index-CitAbDql.js → index-CNsJ2gEh.js} +19 -6
- package/dist/{index-BUam8GIX.js → index-CbO2HBCx.js} +35 -35
- package/dist/{index-Ce9khNjj.js → index-CvTdgB45.js} +87 -75
- package/dist/{index-BsfKnSuo.js → index-CzJfh76P.js} +991 -964
- package/dist/index-DdJk9U2O.js +202 -0
- package/dist/{index-Dy-FYtdl.js → index-DtKSPvAx.js} +41 -41
- package/dist/{index-CZG5q6QS.js → index-PK9ed2VJ.js} +4 -4
- package/dist/{index-CwHleXV2.js → index-Z-EXLH2-.js} +2 -2
- package/dist/index.js +15 -15
- package/dist/{internal-BPOwohVc.js → internal-210PnQHj.js} +48 -48
- package/dist/{ios-simulator-BduF_qia.js → ios-simulator-B8Edygo_.js} +10 -10
- package/dist/{local-cli-host-lease-Chm4-jV0.js → local-cli-host-lease-BcOQ-7Gk.js} +3 -3
- package/dist/{local-ipc-B8vySppK.js → local-ipc-BNwkKO5i.js} +156 -103
- package/dist/{local-project-control-client-CIBpaXbo.js → local-project-control-client-BKaZlhrn.js} +5 -5
- package/dist/{lody-mcp-http-protocol-DBLKn7SZ.js → lody-mcp-http-protocol-C24PR-58.js} +46 -10
- package/dist/{lody-mcp-server-B4OeNPT4.js → lody-mcp-server-C_KUMdUq.js} +84 -39
- package/dist/{logger-C-G7jpWR.js → logger-zm-QQb1B.js} +2 -2
- package/dist/{login-Df1IkdeV.js → login-DoRU06W8.js} +18 -18
- package/dist/{login-shell-env-HKDW5zwx.js → login-shell-env-CFLesG20.js} +6 -6
- package/dist/{logout-gDuSiB0l.js → logout-4T76xG1C.js} +18 -18
- package/dist/{machine-bjdZ1hmy.js → machine-BFM6JQSw.js} +42 -42
- package/dist/{machine-identity-restore-BuoxXyiw.js → machine-identity-restore-CYjkTQcN.js} +3 -3
- package/dist/{machine-protocol-capabilities-DEhAj9SH.js → machine-protocol-capabilities-DcJpLvsC.js} +68 -47
- package/dist/{magpie-import-IrqfCF6i.js → magpie-import-CsiqaviF.js} +52 -50
- package/dist/{managed-daemon-forwarding-BpXhy_-O.js → managed-daemon-forwarding-D10w26x_.js} +9 -9
- package/dist/{managed-daemon-release-CwkvVtSj.js → managed-daemon-release-Bq0NQ5KB.js} +8 -8
- package/dist/{mcp-DTnh_PAT.js → mcp-CFSVE37k.js} +39 -39
- package/dist/{migrate-CUdZ3XBR.js → migrate-D0JGnFDi.js} +40 -38
- package/dist/{open-browser-3TOC7G1u.js → open-browser-CXJ_k8PZ.js} +3 -3
- package/dist/{operation-CzLcjV3W.js → operation-CjjYD8KR.js} +35 -35
- package/dist/{operation-store-rllAX2mr.js → operation-store-CjW-plfi.js} +6 -6
- package/dist/{presence-CZco7UQH.js → presence-DfPa6xSX.js} +95 -71
- package/dist/{presence-legacy-DIYBtj5j.js → presence-legacy-B7H0xyqf.js} +5 -5
- package/dist/{process-DrX1wZZk.js → process-BU5vWwzZ.js} +3 -3
- package/dist/{process-options-DNYWY_s6.js → process-options-CvxupoAj.js} +4 -4
- package/dist/{project-C_EZ2dLN.js → project-DbFdl-Tc.js} +41 -41
- package/dist/{project-path-CAQE9bes.js → project-path-BylnHhzQ.js} +11 -11
- package/dist/{realtime-journal-DyMe8jsR.js → realtime-journal-D5hdU6Fc.js} +2 -2
- package/dist/{register-VLBUVPh5.js → register-DzkfcD0R.js} +33 -33
- package/dist/{registry-generated-wkLapT7U.js → registry-generated-BtQFYqS0.js} +30 -30
- package/dist/{remote-pairing-D24xSpRh.js → remote-pairing-B-1pCVbn.js} +40 -40
- package/dist/{reset-identity-DVubJrt0.js → reset-identity-BKSdKzDv.js} +40 -40
- package/dist/{review-6aCgWEdv.js → review-DHDdCwwj.js} +9 -9
- package/dist/{review-viewer-CRYK94SE.js → review-viewer-DO7rhsH9.js} +3 -3
- package/dist/{rpc-secret-CPdan_XW.js → rpc-secret-Ds9rnsWf.js} +2 -2
- package/dist/{runtime-diagnostics-5l1pBD3m.js → runtime-diagnostics-BElvgU5u.js} +5 -5
- package/dist/{schedule-CGTbG70S.js → schedule-C-UJnfpM.js} +39 -39
- package/dist/{schedule-command-client-C6matZWn.js → schedule-command-client-B2k5ix1s.js} +38 -38
- package/dist/{schedule-command-service-2gToipBI.js → schedule-command-service-pFq9cQHf.js} +134 -58
- package/dist/{schedule-documents-DRc0byQm.js → schedule-documents-Di23etFx.js} +3 -3
- package/dist/{schedule-recurrence-BVxMRfp4.js → schedule-recurrence-D4r80Udd.js} +42 -14
- package/dist/{schedule-repository-dz9iwR0x.js → schedule-repository-BNUNXl15.js} +4 -4
- package/dist/{schedule-run-preparation-1oSQ5i-A.js → schedule-run-preparation-D2GjotJy.js} +5 -5
- package/dist/{schedule-types-BquxGfza.js → schedule-types-B9O0I1Ui.js} +472 -364
- package/dist/{service-D9xJKmI-.js → service-pb71b8fj.js} +5 -5
- package/dist/{session-npaRR-y3.js → session-C6dNbMjx.js} +21 -21
- package/dist/{session-file-blob-store-CBHDgf4e.js → session-file-blob-store-CdpmEU94.js} +4 -4
- package/dist/{session-image-download-DUwc2Fb4.js → session-image-download-DeZ6r1-w.js} +4 -4
- package/dist/{session-input-MeZheBJ0.js → session-input-Dz8R9xPL.js} +3 -3
- package/dist/{session-link-demCF_Y_.js → session-link-CABPzB2T.js} +51 -2
- package/dist/{session-link-export-BM1zZQRs.js → session-link-export-CabjkQNk.js} +3 -3
- package/dist/{session-operation-targets-lq3rsTnV.js → session-operation-targets-B-VimRwZ.js} +3 -3
- package/dist/{setting-Cq6nKJgF.js → setting-CKO-Tb-e.js} +116 -64
- package/dist/{start-BolVcMOA.js → start-B83c1-EW.js} +957 -297
- package/dist/streams-crdt-factory-CkuXGilB.js +17 -0
- package/dist/{subagent-emitter-DALyc5yu.js → subagent-emitter-D-zUFnS9.js} +2 -2
- package/dist/{subagent-events-CyFbbE20.js → subagent-events-D22OQNDm.js} +7 -2
- package/dist/{sync-BrDYKZ4H.js → sync-Cf_HanAI.js} +35 -35
- package/dist/{time-sync-D63wG9u-.js → time-sync-DjSg4eHx.js} +2 -2
- package/dist/{workspace-Bthb-nhu.js → workspace-BCjgp5pF.js} +36 -36
- package/dist/{workspace-legacy-jZ0D5Xl-.js → workspace-legacy-DJAko-Yj.js} +24 -24
- package/package.json +5 -5
- package/dist/index-BTgKuz44.js +0 -65
|
@@ -1,69 +1,69 @@
|
|
|
1
|
-
import { e as applyExecutionProcessResourceProfile, w as withMachineEncryption, v as verifyMachineLifecycleRequest, b as EXIT_CODE_REMOTE_RESTART, f as normalizeMachineUpgradeTargetVersion, a as EXIT_CODE_REMOTE_UPGRADE, E as EXIT_CODE_RETRYABLE_STARTUP, d as EXIT_CODE_SUPERVISOR_CONTRACT_MISMATCH, r as resolveMachineLifecycleCapability, g as getRuntimeDiagnostics, c as EXIT_CODE_AUTH_FAILURE, h as requestManagedPreparation, n as normalizeCurrentProcessResourceProfile } from "./runtime-diagnostics-
|
|
2
|
-
import { p as platformLayer, t as toShared, w as withSpawn, o as observeManagedProcessTree, g as getManagedWorkerLaunchContext, a as pruneManagedProcessTrees, b as confirmManagedProcessTreesGone } from "./process-options-
|
|
3
|
-
import { c as captureCli, j as getLoginShellEnvLegacy, k as getCachedLoginShellEnvSyncLegacy, l as captureMessage, m as isErrorReportingEnabled, h as hashAnalyticsId, i as initCliAnalytics, f as flushTelemetry, d as closeLoginShellApplicationLegacy } from "./login-shell-env-
|
|
1
|
+
import { e as applyExecutionProcessResourceProfile, w as withMachineEncryption, v as verifyMachineLifecycleRequest, b as EXIT_CODE_REMOTE_RESTART, f as normalizeMachineUpgradeTargetVersion, a as EXIT_CODE_REMOTE_UPGRADE, E as EXIT_CODE_RETRYABLE_STARTUP, d as EXIT_CODE_SUPERVISOR_CONTRACT_MISMATCH, r as resolveMachineLifecycleCapability, g as getRuntimeDiagnostics, c as EXIT_CODE_AUTH_FAILURE, h as requestManagedPreparation, n as normalizeCurrentProcessResourceProfile } from "./runtime-diagnostics-BElvgU5u.js";
|
|
2
|
+
import { p as platformLayer, t as toShared, w as withSpawn, o as observeManagedProcessTree, g as getManagedWorkerLaunchContext, a as pruneManagedProcessTrees, b as confirmManagedProcessTreesGone } from "./process-options-CvxupoAj.js";
|
|
3
|
+
import { c as captureCli, j as getLoginShellEnvLegacy, k as getCachedLoginShellEnvSyncLegacy, l as captureMessage, m as isErrorReportingEnabled, h as hashAnalyticsId, i as initCliAnalytics, f as flushTelemetry, d as closeLoginShellApplicationLegacy } from "./login-shell-env-CFLesG20.js";
|
|
4
4
|
import { C as Command } from "./chunks/vendor-commander-BkZcYyor.js";
|
|
5
5
|
import { c as chalk } from "./chunks/vendor-chalk-MVIUzg44.js";
|
|
6
6
|
import * as os from "os";
|
|
7
7
|
import os__default$1 from "os";
|
|
8
8
|
import { createHash, randomBytes, randomUUID as randomUUID$1, timingSafeEqual } from "node:crypto";
|
|
9
|
-
import { g as getCliHttpFetch, v as version$3, p as pkg } from "./http-transport-
|
|
10
|
-
import { f as formatErrorMessage, g as getLogger, t as truncateLogText, e as formatErrorWithCauses, m as formatReportedError, b as createHybridLogger, L as LODY_LOG_DIR } from "./logger-
|
|
9
|
+
import { g as getCliHttpFetch, v as version$3, p as pkg } from "./http-transport-3J_3rzKQ.js";
|
|
10
|
+
import { f as formatErrorMessage, g as getLogger, t as truncateLogText, e as formatErrorWithCauses, m as formatReportedError, b as createHybridLogger, L as LODY_LOG_DIR } from "./logger-zm-QQb1B.js";
|
|
11
11
|
import { w as withDaemonMallocArenaLimit, r as reportError, f as formatLocalLogDate, p as pickDailyLogAppendName, b as formatDailyLogLine, c as registerProcessExitTrace, d as registerProcessCleanup, u as unregisterProcessCleanup } from "./index.js";
|
|
12
|
-
import { w as writePrivateCredentialFile, A as AuthClient, p as performLoginWithAuthCredential, i as isMachinePairingCredential, c as performLogin } from "./auth-
|
|
12
|
+
import { w as writePrivateCredentialFile, A as AuthClient, p as performLoginWithAuthCredential, i as isMachinePairingCredential, c as performLogin } from "./auth-CA7u_ijj.js";
|
|
13
13
|
import * as path$2 from "node:path";
|
|
14
14
|
import path__default$1, { resolve, relative, isAbsolute, join, delimiter, dirname } from "node:path";
|
|
15
15
|
import { g as getLodyDataDir, c as LodyDataDirUnavailableError, e as ensureLodyDataDir, a as getInstallationProfile } from "./installation-profile-BgCqPyUj.js";
|
|
16
|
-
import { bN as getLoroMachineRpcRequestStreamId, av as LORO_STREAMS_RPC_RETENTION_SECONDS, bl as LoroStreamsGatewayError, bq as LoroStreamsRpcRequestSchema, aw as LORO_STREAMS_RPC_VERSION, au as LORO_STREAMS_RPC_ERROR_CODES, bT as isOwnerScopedEncryptedRpcMethod, bI as encryptCodeCollabV2RpcPayload, bD as decryptCodeCollabV2RpcPayload,
|
|
17
|
-
import { g as runCommand, l as errnoCode, C as CommandTimedOut, q as runPromiseSquashedLegacy, u as ProcessCleanupFailed, P as ProcessReleaseFailed, s as startProcessLegacy, i as isPidAliveSyncLegacy, c as runCommandTextLegacy, f as terminateChildTreeLegacy, b as runCommandOk, p as processLayer, t as terminateTree, N as NodeProcess, S as SpawnFailed, T as TerminationFailed, v as spawnProcess, m as makeProcessRunnerLegacy, n as nodeProcessLive, w as unwrapSpawnFailure, r as runCommandTextSyncLegacy, R as READ_ONLY_ABANDON_POLICY, x as pidTree, y as CommandOutputTooLarge, z as posixGroupTree, A as waitUntilGone } from "./process-
|
|
18
|
-
import {
|
|
19
|
-
import { l as layer } from "./chunks/vendor-@effect-platform-node-shared-
|
|
20
|
-
import {
|
|
21
|
-
import { b as FileLockCleanupFailed, L as LockReleaseFailed, c as LockOwnershipLost, F as FileLocks, f as fileLocksLegacy, s as squashFileLockFailure, d as LockIoError, e as LockReentrant, h as LockTimeout, i as ensureImplicitLocalWorkspace, g as getCliPlatformKind, j as applyLocalPlatformEnv, l as loadOrCreateLocalIdentity } from "./cli-platform-
|
|
22
|
-
import { getCliNodeExecutable, readManagedOperation } from "./managed-daemon-release-
|
|
16
|
+
import { bN as getLoroMachineRpcRequestStreamId, av as LORO_STREAMS_RPC_RETENTION_SECONDS, bl as LoroStreamsGatewayError, bq as LoroStreamsRpcRequestSchema, aw as LORO_STREAMS_RPC_VERSION, au as LORO_STREAMS_RPC_ERROR_CODES, bT as isOwnerScopedEncryptedRpcMethod, bI as encryptCodeCollabV2RpcPayload, bD as decryptCodeCollabV2RpcPayload, cR as isE2eeReadQuery, bs as LoroStreamsRpcResponseSchema, bo as LoroStreamsRpcHandlerError, bJ as encryptRpcSecret, bK as getAndroidEmulatorViewerSecretContext, bM as getIosSimulatorViewerSecretContext, an as CodeCollabV2LspRpcParamsSchema, bv as SessionHistoryWriteRpcPayloadSchema, bu as SessionHistorySubscriptionRpcPayloadSchema, bt as SessionHistoryReadRpcPayloadSchema, by as createRpcSecretRecipient, bR as getMachineAcpAuthorizationCodeSecretContext, bQ as getMachineAcpAuthenticationInputSecretContext, b5 as LoroSessionAutomationControlPayloadSchema, bL as getAutomationResponseSecretContext, c$ as makeNodeLocalLoroWriterConnection, c3 as localProjectsLegacy, c4 as getLocalProjectNameFromRootPath, d0 as isLodyPromptSuggestion, cq as WorkspaceSyncUnavailableError, d1 as startTraceSpan, d2 as withSlowOperationWarning, b_ as createSessionBackend, l as areStringArraysEqual, a2 as storedBaselineHashes, A as hashHistoryForStoredVersion, s as decideHistoryConflictResolution, b$ as SYNC_CONFIRMATION_TIMEOUT_MS, d3 as withMachineCatalogWriteLock, cs as readMachineLocalProjects, d4 as upsertMachineLocalProject, z as hashHistoryEntryV2, H as HASH_VERSION, B as hashText, W as resolveImportHashVersion, X as resolveImportedTurnHashes, d5 as redactUrlAuth, d6 as simulatorRtcChunks, d7 as SimulatorOfferSchema, d8 as SimulatorIceServersSchema, d9 as projectRunMetaPatch, da as buildGitHubCloneUrl, db as reconcileProjectMemberLink, dc as removeProjectMemberLinks, dd as streamsRoomBinding, de as isRecoverableStreamsRoomStatus, df as computeLoroReconnectDelayMs, dg as withTimeout$2, dh as ConcurrentQueue, di as traceAsync, dj as getSteerOperationId, dk as createLocalProjectBranchSelector, dl as resolveWorkspaceLocalProjectRootPathWithRetry, dm as readLocalProjectRootResolveSyncTimeoutMs, u as findProgressMessageId, dn as resolveProjectFileRoots, dp as readLodyDataDiskInfo, dq as subscribeSessionChanges, ad as listAliveRoomIds, dr as sameDispatchEntry, U as readSessionHistoryMetadata, V as resolveEditableTail, v as getOperationProgressTargetKey, w as getOperationProgressTurnId, ds as isMemberAccessSnapshotFresh, dt as resolveProjectFileTarget, du as readTimeoutEnv, dv as sanitizeAttachmentFileName, ag as listWorkspaceGitHubRepositoriesForCliToken, ai as makeLocalWorkspaceCatalog, bx as createLoroStreamsJsonStreamClient, cg as SessionAttachmentTransfer, dw as ATTACHMENTS_DIR_RELATIVE, dx as ensureAttachmentsGitExcluded, dy as buildAttachmentFileName, dz as buildAttachmentPromptText, dA as buildUnavailableAttachmentPromptText, dB as resolveWorkspaceLocalProjectRootPath, dC as updateMachineLocalProjectGitSummaryFields, bW as getSessionCommandEnvironment, ab as resolveWorkspaceOrThrow, dD as reconcileMissingLocalProjectGitSummaries, cl as listAliveSessionMetas, dE as isSessionInLocalProjectRemovalScope, dF as resolveWorkspaceLocalProject, dG as shouldApplyMachineDeleteLocalProjectCommand, dH as isLocalProjectReferenced, dI as removeMachineLocalProject, a3 as summarizeHistoryQuery, dJ as deriveRepoIdFromGitHubRepo$1, dK as runWithDaemonWorkspace, dL as runWithSessionCommandEnvironment, dM as createLocalSessionCommandEnvironment, cr as readHistoryEntry, Q as readLatestUserId, c7 as prepareCliStreamsGatewayBaseUrl, dN as resolveWorkspaceLocalProjectWithSyncOnMiss, cS as e2eeFeatureTarget, dO as GitHubTokenFetchError, S as SESSION_DIRECTORY_INPUT_CONFIG_KEYS, O as projectRoostSegments, dP as isDispatchCandidate, dQ as dispatchEntry, dR as selectDispatchHistory, J as pickDirectoryInputConfig, D as historyQueryRow, K as pickDirectoryScalars, dS as registerSessionBackendFactory, dT as createRoostSessionBackendFactory, dU as captureStoredHistory, N as planHistoryImport, y as hashHistoryEntryForVersion, o as createImportCursor, L as planEditableTailReplacement, dV as matchesRollbackReceipt, R as ROOST_CLEAR_FIELDS_KEY, dW as prepareReplacement, G as markTurnSeenBlocked, h as applyMarkTurnSeen, q as createRoostDirectoryRow, dX as latestSessionModel, M as planHistoryAction, C as historyActionTarget, _ as selectHistoryActionRows, dY as prepareStoredHistoryCopy, Z as selectAgentHistoryRows, n as createAssistantTurn, i as applyOpenAssistantTurn, $ as selectTranscriptHistoryPositions, a0 as selectTurnOutput, cb as assertRetainedE2eeModeAllowsOpen, ci as workspaceSupports, dZ as routeRemoteOwnedSessionHistory, d_ as createCommandSessionHistoryFactory, d$ as LoroDocumentManager, bZ as readMergedAgentConfigById, e0 as localCatalogWorkspaceToWorkspaceListItem, e1 as closeProcessLocalLoroWriterLegacy, e2 as classifyRetainedE2eeMode, e3 as reconcileMachineLocalProjectRootPaths, e4 as E2eeModeConflictError, e5 as E2eeBindingUnreadableError, bX as listMergedAgentConfigs, e6 as findWorkspacesBySelector, c5 as formatWorkspaceCandidate, cY as isCloudE2eeMemberRemoved, cZ as isCloudE2eeDeviceRevoked, e7 as createLocalCloudPort, e8 as createCloudCliPort } from "./command-runtime-CYs2KAyh.js";
|
|
17
|
+
import { g as runCommand, l as errnoCode, C as CommandTimedOut, q as runPromiseSquashedLegacy, u as ProcessCleanupFailed, P as ProcessReleaseFailed, s as startProcessLegacy, i as isPidAliveSyncLegacy, c as runCommandTextLegacy, f as terminateChildTreeLegacy, b as runCommandOk, p as processLayer, t as terminateTree, N as NodeProcess, S as SpawnFailed, T as TerminationFailed, v as spawnProcess, m as makeProcessRunnerLegacy, n as nodeProcessLive, w as unwrapSpawnFailure, r as runCommandTextSyncLegacy, R as READ_ONLY_ABANDON_POLICY, x as pidTree, y as CommandOutputTooLarge, z as posixGroupTree, A as waitUntilGone } from "./process-BU5vWwzZ.js";
|
|
18
|
+
import { S as Service, cf as provideMerge, cZ as mergeAll, J as succeed, s as sync, T as TaggedError, aF as effect, g as gen, bh as FileSystem, ci as ChildProcessSpawner, al as provideService, a5 as catchCause, af as failCause, cm as map, ar as map$1, as as logDebug, ag as findErrorOption, d0 as isNone, Y as mapError, R as fail, cW as fn, a$ as catchTag, K as succeed$1, cT as isSome, bb as as, E as flatMap, aG as provide, N as fnUntraced, q as void_, cl as scoped, az as currentTimeMillis, ab as acquireRelease, aC as uninterruptible, P as die, I as interruptible, d2 as timeout, e as exit, C as isSuccess, bv as callback, eu as tap, ev as map$2, b0 as filter, ew as runHead, ex as getOrThrow, $ as timeoutOrElse, t as tap$1, d3 as tapError, aQ as offerUnsafe, aa as acquireUseRelease, aw as try_, cV as runPromise, bD as String$1, e4 as isPattern, c7 as decodeUnknownOption, bO as Struct, c4 as Literal, a4 as orDie, cd as runPromiseExit, i as isFailure, bN as squash, cj as runSyncExit, p as provide$1, dx as runSync, f as close, aD as makeUnsafe, v as void_$1, cE as scope, c$ as make, cU as get, G as forEach, j as andThen, cI as result$1, cL as isFailure$1, e1 as keys, c as make$1, d1 as update, dY as set, k as succeed$2, at as forkIn, _ as _await, l as asVoid, ey as exists, dO as get$1, d_ as remove, aB as catch_, ck as logWarning, X as sleep, x as suspend, cS as seconds, dU as empty, cc as set$1, a1 as all, a3 as addFinalizer, z as tryPromise, bs as none, bq as some, cF as fork, m as make$2, O as Clock, aM as Scope, Z as makeUnsafe$1, a as addFinalizer$1, d as cached, dC as repeat, ds as spaced, dy as delay$2, dk as die$1, o as doneUnsafe, V as promise, a0 as callback$1, dw as retry, h as combine, n as empty$1, ac as await_, ed as hasInterrupts, dn as pretty, cN as interrupt, a2 as ensuring, W as raceFirst, bw as runFork, aV as next, d5 as isCause, dd as unbounded, aW as offer, aK as forever, aL as take, ez as takeBetween, a7 as done, aR as succeed$3, cq as forkScoped, eA as unwrap, eB as make$3, Q as make$4, eC as size$1, eD as awaitEmpty, eE as clear, y as interrupt$1, eF as remove$1, eG as has, eH as run$1, ec as dropping, df as tapCause, d4 as fromReasons, c0 as isInterruptReason, cX as isFailReason, ej as makeUnsafe$2, cg as merge, aE as make$5, cY as provide$2, aA as isTimeoutError, au as fail$1, M as onInterrupt, eI as bounded, eh as onError, eg as take$1, ei as release, eJ as withPermits, e6 as decodeUnknownResult, cJ as isSuccess$1, bQ as ArraySchema, bP as NullOr, e7 as optional, eK as Record, c2 as Number$1, c3 as Boolean$1, c9 as Unknown, eL as getUnsafe, eM as hasUnsafe, db as timeoutOption, D as hasInterruptsOnly } from "./chunks/vendor-effect-BTVRmkqM.js";
|
|
19
|
+
import { l as layer } from "./chunks/vendor-@effect-platform-node-shared-DUSlMsdQ.js";
|
|
20
|
+
import { t as getProjectRepositoryFullName, r as resolveSessionFilePath, i as isSafeProjectPath, B as projectRepositoryUrlIdentity, a as SessionProjectRunSchema, A as pickProjectRepositoryLocalCopy, m as deduplicateProjectMembers, n as encodeProjectPreparationProgress, b as PROJECT_SUBMODULE_BASE, o as encodeSessionFilePath, d as decodeSessionFilePath, y as parseGitHubPullRequestUrl, p as getCurrentPullRequestsByRepository } from "./project-path-BylnHhzQ.js";
|
|
21
|
+
import { b as FileLockCleanupFailed, L as LockReleaseFailed, c as LockOwnershipLost, F as FileLocks, f as fileLocksLegacy, s as squashFileLockFailure, d as LockIoError, e as LockReentrant, h as LockTimeout, i as ensureImplicitLocalWorkspace, g as getCliPlatformKind, j as applyLocalPlatformEnv, l as loadOrCreateLocalIdentity } from "./cli-platform-qpp4fxi7.js";
|
|
22
|
+
import { getCliNodeExecutable, readManagedOperation } from "./managed-daemon-release-Bq0NQ5KB.js";
|
|
23
23
|
import fs__default$1, { existsSync, writeFileSync, createWriteStream, createReadStream, mkdirSync as mkdirSync$1, openSync, constants, fchmodSync, closeSync, statSync, mkdtempSync, rmSync, realpathSync, watch, chmodSync } from "node:fs";
|
|
24
24
|
import * as fs$2 from "node:fs/promises";
|
|
25
|
-
import
|
|
25
|
+
import { realpath, readdir, rm, mkdir, lstat, writeFile, readFile, rename, mkdtemp, chmod, access, rmdir, appendFile, stat as stat$1, open, unlink, opendir } from "node:fs/promises";
|
|
26
26
|
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
27
27
|
import { a as parseWorkspaceWatchChildMessage } from "./workspace-watch-protocol-CKvroybp.js";
|
|
28
|
-
import { aH as LocalMachineRpcRequestSchema, aI as LocalMachineRpcResponseSchema,
|
|
28
|
+
import { aH as LocalMachineRpcRequestSchema, aI as LocalMachineRpcResponseSchema, F as AndroidEmulatorRemoteResponseSchema, av as FilePreviewV3RequestSchema, br as filePreviewV3Error, b2 as SessionDirectoryListRequestSchema, am as FileDownloadRequestSchema, a1 as CodeCollabReadBlobRequestSchema, $ as CodeCollabOpenDiffManifestRequestSchema, s as remoteAutomationSecretEnvelopeSchema, as as FilePreviewV3ErrorCodeSchema, A as AUTOMATION_CONTROL_PATH, d as automationControlRequestSchema, bD as LOCAL_E2EE_RESET_PATH, bE as LocalE2eeResetRequestSchema, bF as LocalE2eeResetResponseSchema, bG as LOCAL_E2EE_PAIRING_PATH, bH as LocalE2eePairingRequestSchema, bI as LocalE2eePrepareReplySchema, bJ as LocalE2eeActivateResponseSchema, bK as LocalE2eeRecoveryFailureSchema, bL as LocalE2eePairingFailureSchema, aF as LOCAL_WORKSPACE_BUNDLE_PATH, bk as WorkspaceBundleControlRequestSchema, aE as LOCAL_SCHEDULE_CONTROL_PATH, aY as ScheduleControlRequestSchema, bM as LOCAL_SESSION_CONTROL_PATH, aD as LOCAL_MACHINE_RPC_PATH, bN as LOCAL_PROJECT_CONTROL_PATH, bx as safeParseLocalMachineRpcRequest, bO as LOCAL_CONTROL_HEADER, bP as LOCAL_SESSION_CONTROL_STREAM_MEDIA_TYPE, bQ as getLocalLoroDataPlaneSocketPath, bR as getLocalProbeSocketPath, bS as getLocalControlSocketPath, bT as getLocalDaemonRunFilePath, bU as getLocalDaemonLockFilePath, bV as ensureLocalDaemonRunDir, bW as writeLocalDaemonRunFile, bX as getLocalIpcServerCredentials, bY as matchesLocalIpcToken, bZ as LOCAL_IPC_TOKEN_HEADER, b_ as removeLocalDaemonRunFile, b$ as getLocalDaemonSocketPath, aj as FILE_DOWNLOAD_MAX_BYTES, ai as FILE_DOWNLOAD_CHUNK_BYTES, aS as PiExtensionDiscoverySchema, M as CODE_COLLAB_DIFF_BLOB_LIMITS, al as FILE_PREVIEW_V3_LIMITS, ak as FILE_PREVIEW_PROTOCOL_VERSION, aO as McpLocalAuthenticationSchema, bw as publicMcpServer, bp as assertPublicMcpServer, h as automationRegistrationSchema, j as automationRunSchema, i as automationResultSchema, b as autoDeliverOptionsSchema, c as automationCommandSchema, o as remoteAutomationOperationSchema, p as remoteAutomationProofSchema, n as remoteAutomationIntentSchema, K as CLI_STORAGE_WRITE_FAILED_ISSUE_CODE } from "./local-ipc-BNwkKO5i.js";
|
|
29
29
|
import http, { createServer } from "node:http";
|
|
30
30
|
import { d as daemonLossObserver, c as createDaemonLossTasks, a as authorityStamp, w as withinAuthorityLimit, b as authorityTimeLeft } from "./authority-clock-CbOcllMG.js";
|
|
31
|
-
import {
|
|
31
|
+
import { dE as SESSION_HISTORY_SUBSCRIPTION_LEASE_MS, q as normalizeSessionTurnInputConfig, ah as LocalProjectControlRequestSchema, g9 as safeParseLocalSessionControlRequest, aH as LocalSessionControlResponseSchema, g8 as safeParseLocalProjectControlRequest, aA as LocalProjectControlResponseSchema, gp as LODY_SUBAGENT_EVENT_METHOD, go as isLodySubagentEvent, fZ as readAcpModelCapabilitiesMeta, eQ as deriveModelReasoningEffortsFromLegacyModelIds, eZ as formatMcpResolutionProblem, ge as sanitizeGoalObjective, fr as isSensitiveAcpConfigOptionId, gf as sanitizeLodyInternalInstructions, dG as SESSION_HISTORY_SUBSCRIPTION_MAX_PUBLICATIONS, ea as SessionHistoryChangesSchema, dF as SESSION_HISTORY_SUBSCRIPTION_MAX_DELTA_BYTES, a4 as SessionLocalAttachmentSchema, fl as isLocalOnlyMemoryProvider, ag as MemoryProviderRequestSchema, W as MemoryBindingSchema, gq as isLodySubagentOutput, dd as MessageContentSchema, ev as ToolCallContentSchema, fR as parseLodyTaskMeta, bf as ACP_AUTHORIZATION_URL_MAX_LENGTH, bh as ACP_AUTH_ID_MAX_LENGTH, bk as ACP_AUTH_TEXT_MAX_LENGTH, be as ACP_AUTHENTICATION_FORM_MAX_BYTES, bg as ACP_AUTH_FORM_FIELD_MAX_COUNT, bi as ACP_AUTH_LABEL_MAX_LENGTH, bj as ACP_AUTH_SELECT_OPTION_MAX_COUNT, fb as isAcpAuthenticationFormWithinByteLimit, f0 as getAcpConfigOptionsModelId, aV as normalizeMcpServerIdSelection, A as AgentConfigCliTypeSchema, ba as ProjectRefSchema, gj as sessionForkFailure, gi as sessionEditAndResendFailure, ft as isSessionGoalActive, aT as readChatFailureNotice, eR as describeChatFailure, fC as makeLodyError, a$ as isAcpFastModeConfigId, b1 as isAcpNormalSpeedAlias, b2 as ACP_CONFIG_OPTION_ON_VALUE, b6 as ACP_FAST_MODE_VALUE_FAST, b0 as ACP_CONFIG_OPTION_OFF_VALUE, br as ACP_REASONING_EFFORT_CONFIG_ID, ff as isAcpPlanModeConfigOption, b7 as isAcpThoughtLevelConfigOption, bq as ACP_PLAN_PERMISSION_MODE_ID, Y as readMessageAuthor, r as readEncryptedAttachment, o as encryptedAttachmentPath, eY as formatAgentSenderHeader, aW as hasAgentRunConfigSelection, gk as shouldBypassSessionQuota, ai as SessionHistoryReadResponseSchema, aj as SessionHistoryWriteResponseSchema, di as PermissionOutcomeSchema, g5 as resolveSessionMcpServers, S as SessionHistoryContentPatchSchema, dD as SESSION_HISTORY_READ_MAX_RANGE, g4 as resolveLatestSessionGoalFromHistory, dz as SCHEDULE_RETRY_DELAYS_MS, F as ScheduleRuntimeRowSchema, K as ScheduledMessageSchema, h as automationRuleDraftSchema, d as automationEventSchema, c as automationContinuationSchema, f as automationInvocationSchema, g as automationOriginSchema } from "./schedule-types-B9O0I1Ui.js";
|
|
32
32
|
import net__default, { isIP, Socket } from "node:net";
|
|
33
|
-
import { g as getServerNow } from "./time-sync-
|
|
34
|
-
import {
|
|
33
|
+
import { g as getServerNow } from "./time-sync-DjSg4eHx.js";
|
|
34
|
+
import { bS as createJsonLineSplitter, aF as LOCAL_LORO_DATA_PLANE_MAX_FRAME_BYTES, aI as LOCAL_LORO_DATA_PLANE_PROTOCOL_VERSION, aR as LocalLoroDataPlaneClientMessageSchema, c0 as deriveRepoIdFromGitHubRepo, cI as getWorktreeHostPathFromDotlodyPath, dr as parseDevinSubagentTaskMeta, ca as getDevinSubagentContextId, cM as hasOtherDevinSubagentMeta, dB as parseSessionNotification, bA as assertManagedCodexProfileConfig, ai as CodexAuthProfileSchema, dh as normalizeCodexEndpoint, ce as getLocalProjectHistoryProviderKey, cb as getExternalAcpHistoryImportKey, f as isLoroRepoDocDeleted, cS as isActiveSessionStatus, de as matchesHistoryProviderBinding, T as NEW_SESSION_HISTORY_BACKEND, J as SessionStatusFactory, cd as getLocalProjectHistoryCatalogKey, d5 as isSessionHistoryPendingForDispatch, bU as createUtf8StreamDecoder, bE as buildManagedPreviewViewerUrl, e7 as setPreviewQueryParamInUrl, dR as removePreviewQueryParamFromSearch, b5 as PREVIEW_ACCESS_TOKEN_QUERY_PARAM, e0 as sanitizePreviewProxyResponseHeaders, bx as applyPreviewEmbeddingHeaders, ap as DEFAULT_PREVIEW_RESOURCE_LIMITS, b4 as PREVIEW_ACCESS_TOKEN_COOKIE, an as DEFAULT_PREVIEW_IDLE_TIMEOUT_MS, I as hasPendingUserTurnActivation, a as addSessionTurnTokenUsage, i as isEmptySessionTurnTokenUsage, g as getMachineFlockDocId, C as getMachineFlockProviderSetups, h as readMachineFlockRowsFromFlock, z as getMachineFlockProviderSetupCancellations, by as applyProviderSetupCancellationToFlock, B as getMachineFlockAgentConfigs, F as machineFlockKeys, D as writeMachineFlockRowToFlock, bX as deleteMachineFlockRowFromFlock, c3 as encodeCodexProfileConfig, c5 as findBuiltinAgentOptOutToRetract, m as parseHistoryWrite, aD as HistoryWriteError, b$ as deriveLocationsFromToolCallContent, ec as stripToolCallPayloadsForHistory, bF as buildMessageContentFromNotification, eh as truncateTerminalOutputForHistory, dt as parseLodyMessagePhase, cK as getWorktreeSetupScriptForShell, dZ as resolveWorktreeSetupShellForPlatform, at as DEFAULT_WORKTREE_SETUP_TIMEOUT_MS, as as DEFAULT_WORKTREE_CLEANUP_TIMEOUT_MS, dU as resolveSessionHistoryStatus, cc as getImportFence, c_ as isMissingHistoryUserTurn, cr as getPendingUserTurnActivationId, Y as getSessionLaunchConfigLegacyFields, bM as buildSessionLaunchConfig, dg as mergeSessionLaunchConfig, cn as getMachineFlockSessionLaunchConfig, L as resolveProjectGitHubRepo, bT as createReplayPromptBuilder, d2 as isReplayEntryExcluded, R as resolveBaseBranchPreference, cN as hasRecentResumeNotice, K as resolveActiveAssistantTurnId, aE as LEGACY_SESSION_HISTORY_BACKEND, dY as resolveSessionPullRequests, d7 as isTextPreviewable, bc as PreviewControlProofSchema, cY as isLoopbackPreviewHost, b6 as PREVIEW_CREATE_RATE_LIMIT_MAX, ao as DEFAULT_PREVIEW_MAX_ACTIVE_TUNNELS_PER_MACHINE, b7 as PREVIEW_CREATE_RATE_LIMIT_WINDOW_MS, e6 as sessionHistoryWriteIntentDigest, $ as getProjectRefBranch, bI as buildSessionFileApiUrl, d as getSessionFileDownloadApiPath, dv as parseMachineFlockKey, s as getWorkspaceFlockDocId, dc as listWorkspaceProjects, u as readWorkspaceFlockRowsFromFlock, ej as truncateToolTitleForHistory, H as HistoryEntryWriteSchema, cU as isContainedSession, ey as resolveNotificationPresentation, ez as notificationReplyPreview, cj as getMachineFlockDeleteLocalProjectEntries, cE as getWorkspaceMcpCatalog, d6 as isSessionHistoryStatusAwaitingStart, cR as inheritHistoryStreamText, ed as targetLocalHistoryTargets, dG as planAgentHistoryMutation, dP as readSessionPullRequestLinks, dy as parsePullRequestUrl, d0 as isPullRequestUnlinked, dO as readPullRequestLifecycle, dI as planPullRequestLifecycle, c$ as isPullRequestExplicitlyLinked, dJ as planPullRequestLinkCheck, aQ as LODY_MACHINE_MONITOR_WINDOWS_SAMPLE_MS, aK as LODY_MACHINE_MONITOR_MACOS_SAMPLE_MS, aP as LODY_MACHINE_MONITOR_UNIX_SAMPLE_MS, eA as notificationLabel, d3 as isScheduleImportFenced, l as getMachineFlockLocalProjects } from "./access-DIhEb_MP.js";
|
|
35
|
+
import { m as magpieProfileDirectory, c as codexMagpieSkillEntries, i as isNpxCommand, p as parseNpxPackageSpecFromArgs, g as getConfiguredNpxCacheRoot, a as inspectNpxInstallState, b as purgeBrokenNpxInstall, d as isLikelyNpmCacheCorruption, e as purgeBrokenNpxCache, f as purgeLodyNpmCache, h as isLikelyBrokenNpxInstall, r as resolveBuiltinAuthenticationProcessLaunch, j as resolveACPProcessLaunchAsync, k as mergeLoginShellEnv, w as withLoopbackNoProxy, l as withLodyNpmCacheForNpx, n as withDefaultAcpPathEntries, o as mergeACPProcessEnv, q as resolveACPProcessLaunch, G as GITHUB_CREDENTIAL_ENV_KEYS, s as extractAbortableZip, t as ensureGhShimScript, u as prependGhShimBinDirToPath, v as getGhShimHostBinDir, x as toSingleQuotedShellString, y as writeIfChanged, z as clearGitHubTokenEnv, A as normalizeAgentProcessEnv, P as PI_EXTENSIONS_SUPPORTED, B as getManagedAgentRuntimeManager, C as getAcpCapabilitySourceVersion, D as getAcpBinaryManager, M as ManagedRuntimeUnsupportedPlatformError, E as formatManagedRuntimeFailureMessage, F as classifyManagedRuntimeFailureReason, H as AcpBinaryUnsupportedPlatformError, I as resolveExpectedAcpCapabilitySourceVersion, J as getHostMachineProtocolCapabilities, K as normalizeComparablePath, L as ManagedRuntimeError, N as clearManagedGhTokenEnv, O as LODY_MANAGED_GH_TOKEN_SHA256_ENV, Q as configureManagedAgentRuntimeManager, R as configureManagedRuntimeUpdateCoordinator } from "./setting-CKO-Tb-e.js";
|
|
35
36
|
import os__default, { homedir, tmpdir, cpus } from "node:os";
|
|
36
|
-
import { ar as isBinaryImagePath, b as applyProjectSkillsResultBudget, m as ALL_KNOWN_GLOBAL_SKILL_DIRS, o as ALL_KNOWN_SYSTEM_SKILL_DIRS, c as buildProjectSkill, aq as isAskUserQuestionPermissionRequest, aD as parseAskUserQuestionElicitationRequest, X as buildAskUserQuestionElicitationResponse, g as ACP_INIT_TIMEOUT_MS, h as ACP_NEW_SESSION_TIMEOUT_MS, i as ACP_NPX_STARTUP_MAX_ATTEMPTS, e as ACP_COLD_NPX_INIT_TIMEOUT_MS, l as ACP_STARTUP_QUEUE_WAIT_TIMEOUT_MS, Z as buildHistoryReplayImport, Q as TerminalClientMessageSchema, a3 as classifyBrowserHostname, W as VISUAL_ANNOTATION_INSPECTOR_BROWSER_SCRIPT, F as DevicePreviewControlRequestSchema, av as isMissingEmail, aO as usesAcpProtocolAuthentication, ao as hasBuiltinEnvAuthentication, ah as getLodyElicitationMeta, aJ as resolveSessionDefaultConfigOptionValues, aH as resolveResumableAcpSessionId, aI as resolveSessionAcpTargetId, az as isSessionCancelRequestMarker, al as getSessionCancelRequestMarker, aA as isSubscriptionQuotaEligible, a1 as buildMissingEmail, ag as getImageMimeTypeForPath, aP as withAgentSessionDefaults, a as formatCommentReferenceForPrompt, f as formatVisualAnnotationReferenceForPrompt, aE as parseAskUserQuestionPermissionMeta, P as PERMISSION_REQUEST_TIMEOUT_MS, ae as getAskUserQuestionPermissionDisplayTitle, _ as buildLiveActivityConversationItems, a6 as countLiveActivityConversationStatuses, a5 as countLiveActivityConversationCandidates, $ as buildLodyConversationsLiveActivityId, L as LODY_CONVERSATIONS_LIVE_ACTIVITY_SCHEMA_VERSION, O as TERMINAL_MAX_PER_SESSION, aQ as withPrBranchUpkeep, J as PR_BRANCH_UPKEEP_PROMPT, v as CREATE_PR_BASE_PROMPT, Y as buildFixCiRequest, a2 as buildResolveConflictsRequest, a0 as buildMergePrRequest, aS as withQuickActionOrigin, aR as withProjectGroupPrScope, p as AUTO_DELIVERY_ORIGIN_PROMPT, aK as startTimeSyncLegacy } from "./device-preview-
|
|
37
|
+
import { ar as isBinaryImagePath, b as applyProjectSkillsResultBudget, m as ALL_KNOWN_GLOBAL_SKILL_DIRS, o as ALL_KNOWN_SYSTEM_SKILL_DIRS, c as buildProjectSkill, aq as isAskUserQuestionPermissionRequest, aD as parseAskUserQuestionElicitationRequest, X as buildAskUserQuestionElicitationResponse, g as ACP_INIT_TIMEOUT_MS, h as ACP_NEW_SESSION_TIMEOUT_MS, i as ACP_NPX_STARTUP_MAX_ATTEMPTS, e as ACP_COLD_NPX_INIT_TIMEOUT_MS, l as ACP_STARTUP_QUEUE_WAIT_TIMEOUT_MS, Z as buildHistoryReplayImport, Q as TerminalClientMessageSchema, a3 as classifyBrowserHostname, W as VISUAL_ANNOTATION_INSPECTOR_BROWSER_SCRIPT, F as DevicePreviewControlRequestSchema, av as isMissingEmail, aO as usesAcpProtocolAuthentication, ao as hasBuiltinEnvAuthentication, ah as getLodyElicitationMeta, aJ as resolveSessionDefaultConfigOptionValues, aH as resolveResumableAcpSessionId, aI as resolveSessionAcpTargetId, az as isSessionCancelRequestMarker, al as getSessionCancelRequestMarker, aA as isSubscriptionQuotaEligible, a1 as buildMissingEmail, ag as getImageMimeTypeForPath, aP as withAgentSessionDefaults, a as formatCommentReferenceForPrompt, f as formatVisualAnnotationReferenceForPrompt, aE as parseAskUserQuestionPermissionMeta, P as PERMISSION_REQUEST_TIMEOUT_MS, ae as getAskUserQuestionPermissionDisplayTitle, _ as buildLiveActivityConversationItems, a6 as countLiveActivityConversationStatuses, a5 as countLiveActivityConversationCandidates, $ as buildLodyConversationsLiveActivityId, L as LODY_CONVERSATIONS_LIVE_ACTIVITY_SCHEMA_VERSION, O as TERMINAL_MAX_PER_SESSION, aQ as withPrBranchUpkeep, J as PR_BRANCH_UPKEEP_PROMPT, v as CREATE_PR_BASE_PROMPT, Y as buildFixCiRequest, a2 as buildResolveConflictsRequest, a0 as buildMergePrRequest, aS as withQuickActionOrigin, aR as withProjectGroupPrScope, p as AUTO_DELIVERY_ORIGIN_PROMPT, aK as startTimeSyncLegacy } from "./device-preview-WVdriBmC.js";
|
|
37
38
|
import * as path$1 from "path";
|
|
38
39
|
import path__default from "path";
|
|
39
40
|
import * as fs$1 from "fs/promises";
|
|
40
41
|
import { stat } from "fs/promises";
|
|
41
|
-
import { R as RequestError, C as ClientSideConnection, P as PROTOCOL_VERSION, n as ndJsonStream, c as client, m as methods } from "./chunks/vendor-@agentclientprotocol-sdk-
|
|
42
|
-
import { o as object$2,
|
|
43
|
-
import { p as prepareDeepSeekNodeEnvironment } from "./deepseek-system-node-
|
|
42
|
+
import { R as RequestError, C as ClientSideConnection, P as PROTOCOL_VERSION, n as ndJsonStream, c as client, m as methods } from "./chunks/vendor-@agentclientprotocol-sdk-54yhgJSn.js";
|
|
43
|
+
import { o as object$2, f as _enum, e as array, a as literal, n as number, c as string, r as record$1, d as boolean, j as datetime, x as number$1, E as uuid$2, h as unknown, k as discriminatedUnion, u as union, z as tuple, D as ZodError, B as json$1 } from "./chunks/vendor-zod-nebGZ0VM.js";
|
|
44
|
+
import { p as prepareDeepSeekNodeEnvironment } from "./deepseek-system-node-CBHH8N-Z.js";
|
|
44
45
|
import * as fs from "fs";
|
|
45
46
|
import fs__default, { promises, mkdirSync, existsSync as existsSync$1, readFileSync, writeFileSync as writeFileSync$1, unlinkSync } from "fs";
|
|
46
47
|
import crypto__default, { randomUUID, randomBytes as randomBytes$1, createHash as createHash$1, timingSafeEqual as timingSafeEqual$1 } from "crypto";
|
|
47
48
|
import { performance as performance$1 } from "perf_hooks";
|
|
48
49
|
import { once, EventEmitter } from "node:events";
|
|
49
|
-
import { g as MCP_HTTP_PREFERRED_PORT_ENV, M as MCP_HTTP_TOKEN_ENV,
|
|
50
|
+
import { g as MCP_HTTP_PREFERRED_PORT_ENV, M as MCP_HTTP_TOKEN_ENV, v as McpHttpHostHandshakeSchema, w as buildLodyMcpHttpHeaders, L as LODY_HELP_INSTRUCTIONS, x as LODY_PR_LINK_GUIDANCE, y as LODY_PR_LINK_GUIDANCE_WITHOUT_GH_SHIM, t as turnNotificationAudience, q as resolveSessionMessageAuthor, f as canReadProcNetTcp, l as lookupLoopbackPeerUid, u as createSessionPullRequestLinks, d as automationReadRequestSchema, a as automationEmptyReadParametersSchema, b as automationEventReadParametersSchema, e as automationReadResponseSchema } from "./lody-mcp-http-protocol-C24PR-58.js";
|
|
50
51
|
import { i as iconv } from "./chunks/vendor-iconv-lite-HWexUuLF.js";
|
|
51
|
-
import { L as LODY_AUTH_URL, a as LODY_AUTH_SITE_URL, d as LODY_SERVER_URL, g as getOrCreateStableMachineIdAsync, S as SITE_URL } from "./const-
|
|
52
|
-
import {
|
|
53
|
-
import {
|
|
54
|
-
import { resolveDeepSeekHarnessSpawn } from "./deepseek-harness-runtime-D6lV9pxi.js";
|
|
52
|
+
import { L as LODY_AUTH_URL, a as LODY_AUTH_SITE_URL, d as LODY_SERVER_URL, g as getOrCreateStableMachineIdAsync, S as SITE_URL } from "./const-C9yql4zo.js";
|
|
53
|
+
import { a6 as trustsUntaggedAcpSessionTitle, J as MODEL_THOUGHT_LEVEL_META_KEY, s as supportsBuiltinProviderSetup, Y as hasBuiltinRuntimeOverrideValues, j as isManagedBuiltinAgentType, Z as hasEmptyModelSelectOption, r as getManagedBuiltinRuntimeByAgentType, R as computeTitleGenerationDefaults, G as DEFAULT_TITLE_GENERATION_PROMPT, Q as acpOwnsSessionTitleGeneration, T as decideAcpCapabilityRefreshCache, q as getManagedBuiltinRuntimeByRuntimeName, v as serializeCustomAcpLaunchSpec, a as SESSION_FILE_MAX_SIZE_BYTES, N as SESSION_FILE_PREVIEW_SNIFF_BYTES, b as SESSION_IMAGE_MAX_SIZE_BYTES, c as SESSION_IMAGE_ALLOWED_MIME_TYPES, t as isBuiltinAgentType, w as SESSION_IMAGE_MAX_COUNT, S as SESSION_FILE_MAX_COUNT } from "./magpie-import-CsiqaviF.js";
|
|
54
|
+
import { resolveDeepSeekHarnessSpawn } from "./deepseek-harness-runtime-CtfyKY7w.js";
|
|
55
55
|
import { Readable, Transform } from "node:stream";
|
|
56
56
|
import { pipeline } from "node:stream/promises";
|
|
57
57
|
import { v as v4, a as validate } from "./chunks/vendor-uuid-ZvTlSCzA.js";
|
|
58
|
-
import {
|
|
58
|
+
import { a4 as LoroStreamsTokenAuthError, b as getSessionRoomId, n as getMachineRoomId, D as isSessionDocRoomId, s as scheduleDefinitionFingerprint, w as LODY_PRESENCE_HEARTBEAT_MS, j as SESSION_DOC_PREFIX, ax as getCodeCollabFileIndexSignalFlockDocId, aw as getCodeCollabFileIndexFlockDocId, f as LORO_STREAMS_BUCKET_ID, k as getSessionIdFromRoomId, aN as hasFreshDesktopForegroundPresence, a as getScheduleRoomId, am as collectViewedSessionIdsFromPresence, as as evaluateSchedule, b8 as scheduleRunKey, b7 as scheduleRunIds, C as manualScheduleRunKey, b5 as quotaReservationIdentity, g as getScheduleRegistryFlockDocId, B as scheduleRegistryKeys, m as canonicalScheduleJson, ag as SUPPORTED_CLI_TYPES } from "./presence-DfPa6xSX.js";
|
|
59
59
|
import { g as githubCredentialRuntime } from "./github-credential-runtime-Vuv6HxRs.js";
|
|
60
|
-
import { a2 as CodeCollabV2RpcContentEnvelopeSchema, l as CodeCollabV2InitDirectoryRequestSchema, k as CodeCollabV2OpenTurnDiffRequestSchema, j as CodeCollabV2OpenAllChangesDiffRequestSchema, i as CodeCollabV2OpenCurrentDiffRequestSchema, h as CodeCollabV2SaveTextRequestSchema, g as CodeCollabV2RefreshTextRequestSchema, f as CodeCollabV2OpenTextRequestSchema, Y as CodeCollabV2ErrorCodeSchema, aL as readCodeCollabFileIndexSignalFromFlock, aQ as writeCodeCollabFileIndexSignalToFlock, aK as readCodeCollabFileIndexFromFlock, aJ as readCodeCollabFileGenerations, w as CODE_COLLAB_FILE_GENERATION_MAX_BYTES, ak as codeCollabFileIndexValuesEqual, aI as planCodeCollabFileIndexFlockWrite, a8 as applyCodeCollabFileIndexFlockWriteBatch, ab as buildCodeCollabFileIndexState, D as CODE_COLLAB_V2_TEXT_LIMITS, y as CODE_COLLAB_V2_ALL_CHANGES_DIFF_LIMITS, b as buildBoundedCodeCollabFileIndexState, ag as codeCollabFileIndexStatesEqual, C as CODE_COLLAB_FILE_INDEX_LIMITS } from "./code-collab-
|
|
61
|
-
import {
|
|
60
|
+
import { a2 as CodeCollabV2RpcContentEnvelopeSchema, l as CodeCollabV2InitDirectoryRequestSchema, k as CodeCollabV2OpenTurnDiffRequestSchema, j as CodeCollabV2OpenAllChangesDiffRequestSchema, i as CodeCollabV2OpenCurrentDiffRequestSchema, h as CodeCollabV2SaveTextRequestSchema, g as CodeCollabV2RefreshTextRequestSchema, f as CodeCollabV2OpenTextRequestSchema, Y as CodeCollabV2ErrorCodeSchema, aL as readCodeCollabFileIndexSignalFromFlock, aQ as writeCodeCollabFileIndexSignalToFlock, aK as readCodeCollabFileIndexFromFlock, aJ as readCodeCollabFileGenerations, w as CODE_COLLAB_FILE_GENERATION_MAX_BYTES, ak as codeCollabFileIndexValuesEqual, aI as planCodeCollabFileIndexFlockWrite, a8 as applyCodeCollabFileIndexFlockWriteBatch, ab as buildCodeCollabFileIndexState, D as CODE_COLLAB_V2_TEXT_LIMITS, y as CODE_COLLAB_V2_ALL_CHANGES_DIFF_LIMITS, b as buildBoundedCodeCollabFileIndexState, ag as codeCollabFileIndexStatesEqual, C as CODE_COLLAB_FILE_INDEX_LIMITS } from "./code-collab-DRoDl8u7.js";
|
|
61
|
+
import { k as IosSimulatorRemoteResponseSchema, j as IosSimulatorExteriorSchema, m as isIosSimulatorBezelPng, f as IOS_SIMULATOR_BEZEL_MAX_BYTES, I as IosSimulatorDeviceControlSchema } from "./ios-simulator-B8Edygo_.js";
|
|
62
62
|
import { setTimeout as setTimeout$1 } from "node:timers/promises";
|
|
63
|
-
import { g as getSessionFileBlobPath, a as readLocalSessionImage, s as storeLocalSessionImage, c as copyIntoSessionFileBlobStore, b as readLocalSessionImageReceipt, d as sessionFileBlobExists, e as readSessionFileBlobBackfillReceipt, m as markSessionFileBlobBackfilled, f as getSessionFileBlobAgeMs, h as getDraftSessionFileBlobMaxAgeMs, r as removeSessionFileBlob, w as writeSessionFileBlobBackfillMarker, l as listLocalSessionImages, i as listPendingLocalSessionFiles, j as writeLocalSessionImageReceipt } from "./session-file-blob-store-
|
|
63
|
+
import { g as getSessionFileBlobPath, a as readLocalSessionImage, s as storeLocalSessionImage, c as copyIntoSessionFileBlobStore, b as readLocalSessionImageReceipt, d as sessionFileBlobExists, e as readSessionFileBlobBackfillReceipt, m as markSessionFileBlobBackfilled, f as getSessionFileBlobAgeMs, h as getDraftSessionFileBlobMaxAgeMs, r as removeSessionFileBlob, w as writeSessionFileBlobBackfillMarker, l as listLocalSessionImages, i as listPendingLocalSessionFiles, j as writeLocalSessionImageReceipt } from "./session-file-blob-store-CdpmEU94.js";
|
|
64
64
|
import { e as extract } from "./chunks/vendor-tar-DsFjtMqu.js";
|
|
65
65
|
import "./chunks/vendor-minipass-CfF1uFKZ.js";
|
|
66
|
-
import { C as CloudflaredError } from "./cloudflared-native-
|
|
66
|
+
import { C as CloudflaredError } from "./cloudflared-native-Ber1sIlU.js";
|
|
67
67
|
import http$1 from "http";
|
|
68
68
|
import { Buffer as Buffer$2 } from "buffer";
|
|
69
69
|
import { b as WebSocketServer, a as WebSocket } from "./chunks/vendor-ws-D1QOrWHI.js";
|
|
@@ -75,9 +75,9 @@ import { R as RTCPeerConnection } from "./chunks/vendor-werift-BBQOPwZO.js";
|
|
|
75
75
|
import { a as AdbServerClient } from "./chunks/vendor-@yume-chan-adb-Dm1Ebig-.js";
|
|
76
76
|
import { A as AdbScrcpyClient, a as AdbScrcpyOptions3_3_3 } from "./chunks/vendor-@yume-chan-adb-scrcpy-DlC3e29n.js";
|
|
77
77
|
import { M as MAX_DERIVED_TURNS_PER_ORIGIN, d as decideEncryptedDerivation } from "./derivation-limits-DFGnDRcs.js";
|
|
78
|
-
import { S as ScheduleRepository } from "./schedule-repository-
|
|
79
|
-
import { J as buildSessionArchiveMetaPatch, K as verifyMachineAccessWithRetry, h as createSessionResult, j as sendSessionChatResult, L as waitForMcpCatalogBaseline, N as commitPreparedSessionDispatch, O as isPreparedSessionDispatched, P as materializePreparedSessionInput, Q as resolveTurnDispatchDefaultsFromHistory, R as resolveAgentRoleCreateFromCatalog, T as applyAgentRoleCreateTarget, U as prepareSessionInput } from "./session-
|
|
80
|
-
import { r as readSessionOperationTargets, i as isSessionCollaborationStopped } from "./session-operation-targets-
|
|
78
|
+
import { S as ScheduleRepository } from "./schedule-repository-BNUNXl15.js";
|
|
79
|
+
import { J as buildSessionArchiveMetaPatch, K as verifyMachineAccessWithRetry, h as createSessionResult, j as sendSessionChatResult, L as waitForMcpCatalogBaseline, N as commitPreparedSessionDispatch, O as isPreparedSessionDispatched, P as materializePreparedSessionInput, Q as resolveTurnDispatchDefaultsFromHistory, R as resolveAgentRoleCreateFromCatalog, T as applyAgentRoleCreateTarget, U as prepareSessionInput } from "./session-C6dNbMjx.js";
|
|
80
|
+
import { r as readSessionOperationTargets, i as isSessionCollaborationStopped } from "./session-operation-targets-B-VimRwZ.js";
|
|
81
81
|
import "./chunks/vendor-loro-crdt-2CFvB1HS.js";
|
|
82
82
|
import Database from "better-sqlite3";
|
|
83
83
|
import { fileURLToPath as fileURLToPath$1, pathToFileURL as pathToFileURL$1 } from "url";
|
|
@@ -85,36 +85,36 @@ import { RoostHostError, RoostNativeClient } from "@loro-dev/roost-node";
|
|
|
85
85
|
import { I as Identity, d as decodeBatch, t as toApplicationJson, f as fromApplicationJson, a as applicationJsonText, b as decodeJson, N as NodeLodyHistory } from "./chunks/vendor-@loro-dev-roost-Ba5LLBEl.js";
|
|
86
86
|
import { E as EventEmitter$1 } from "./chunks/vendor-eventemitter3-BTaPclo1.js";
|
|
87
87
|
import { Transform as Transform$1 } from "stream";
|
|
88
|
-
import { o as openSorbetControl } from "./chunks/vendor-@sorbetai-control-
|
|
88
|
+
import { o as openSorbetControl } from "./chunks/vendor-@sorbetai-control-C9pxQF9a.js";
|
|
89
89
|
import { stripVTControlCharacters, promisify, isDeepStrictEqual } from "node:util";
|
|
90
|
-
import { b as batchHistoryMembers, c as batchPreview, i as inboxScopeKey, I as InboxAdmissionRejected, d as inboxFailureDiagnostic, e as INBOX_INLINE_MEMBERS, f as OrchestrationDatabase, L as LodyOperationStore, g as getLodyOperationStorePath, a as LodyOperationStoreError, h as OrchestrationConnection } from "./operation-store-
|
|
91
|
-
import { n as normalizeSessionInputBlocks, a as buildPendingUserHistoryEntry, b as buildSessionTurnInputConfig, e as extractPromptPreviewFromInputBlocks, h as historyItemsToInputBlocks, k as resolveSessionExecutionInputBlocks, g as resolveSessionAuthoredText, l as resolveSessionMcpSelection, r as resolveSessionConversationConfig, f as resolveSessionAcpRuntimeConfig, i as inputBlocksToHistoryItems } from "./session-input-
|
|
92
|
-
import { R as REGISTRY_ACP_AGENTS } from "./registry-generated-
|
|
90
|
+
import { b as batchHistoryMembers, c as batchPreview, i as inboxScopeKey, I as InboxAdmissionRejected, d as inboxFailureDiagnostic, e as INBOX_INLINE_MEMBERS, f as OrchestrationDatabase, L as LodyOperationStore, g as getLodyOperationStorePath, a as LodyOperationStoreError, h as OrchestrationConnection } from "./operation-store-CjW-plfi.js";
|
|
91
|
+
import { n as normalizeSessionInputBlocks, a as buildPendingUserHistoryEntry, b as buildSessionTurnInputConfig, e as extractPromptPreviewFromInputBlocks, h as historyItemsToInputBlocks, k as resolveSessionExecutionInputBlocks, g as resolveSessionAuthoredText, l as resolveSessionMcpSelection, r as resolveSessionConversationConfig, f as resolveSessionAcpRuntimeConfig, i as inputBlocksToHistoryItems } from "./session-input-Dz8R9xPL.js";
|
|
92
|
+
import { R as REGISTRY_ACP_AGENTS } from "./registry-generated-BtQFYqS0.js";
|
|
93
93
|
import { m as mapWithConcurrency } from "./bounded-concurrency-JZXr8Xjv.js";
|
|
94
|
-
import { d as computeAllChanges, r as resolveProjectGitDirectory, f as resolveAllChangesDiffBase, g as summarizeAllChanges, h as computeProjectAllChangesSnapshot, l as listGitIgnoredPaths, k as gitDiffBaseRefCandidates, s as scanGitDirectoryEntries, c as createGitIgnoreScanFilter, a as relativeScanDirectory, e as closeDirectoryQuietly } from "./file-index-scan-core-
|
|
94
|
+
import { d as computeAllChanges, r as resolveProjectGitDirectory, f as resolveAllChangesDiffBase, g as summarizeAllChanges, h as computeProjectAllChangesSnapshot, l as listGitIgnoredPaths, k as gitDiffBaseRefCandidates, s as scanGitDirectoryEntries, c as createGitIgnoreScanFilter, a as relativeScanDirectory, e as closeDirectoryQuietly } from "./file-index-scan-core-QNHdA1nq.js";
|
|
95
95
|
import { c as createTwoFilesPatch } from "./chunks/vendor-diff-CPHd5agL.js";
|
|
96
96
|
import { gzip, gunzip } from "node:zlib";
|
|
97
|
-
import { c as computeLineCounts, a as countTextLines } from "./diff-line-counts-
|
|
98
|
-
import { r as runDiffWorkerTask } from "./diff-worker-task-
|
|
97
|
+
import { c as computeLineCounts, a as countTextLines } from "./diff-line-counts-C7vhQioX.js";
|
|
98
|
+
import { r as runDiffWorkerTask } from "./diff-worker-task-wwEm25bo.js";
|
|
99
99
|
import { MessageChannel, Worker } from "node:worker_threads";
|
|
100
100
|
import { C as CODE_COLLAB_IGNORED_DIRECTORY_NAMES } from "./workspace-watch-path-policy-CxHey7qg.js";
|
|
101
101
|
import require$$0 from "net";
|
|
102
|
-
import { a as downloadSessionImageForPrompt } from "./session-image-download-
|
|
103
|
-
import { g as getDeviceTimeZone } from "./schedule-recurrence-
|
|
104
|
-
import {
|
|
102
|
+
import { a as downloadSessionImageForPrompt } from "./session-image-download-DeZ6r1-w.js";
|
|
103
|
+
import { g as getDeviceTimeZone } from "./schedule-recurrence-D4r80Udd.js";
|
|
104
|
+
import { a3 as SORBET_HOST_SETTINGS_REMOTE_PROTOCOL_VERSION, a6 as SORBET_PROVIDERS_REMOTE_PROTOCOL_VERSION, a1 as SORBET_CREDENTIALS_REMOTE_PROTOCOL_VERSION, a2 as SORBET_HOST_SETTINGS_PROTOCOL_VERSION, a5 as SORBET_PROVIDERS_PROTOCOL_VERSION, a0 as SORBET_CREDENTIALS_PROTOCOL_VERSION, l as E2EE_ROOST_HISTORY_PROTOCOL_VERSION, k as E2EE_REMOTE_CONTROL_PROTOCOL_VERSION, o as E2EE_SESSION_EDIT_AND_RESEND_PROTOCOL_VERSION, p as E2EE_SESSION_FORK_PROTOCOL_VERSION, E as E2EE_ACP_INTERACTION_PROTOCOL_VERSION } from "./machine-protocol-capabilities-DcJpLvsC.js";
|
|
105
105
|
import { AsyncEntry } from "@napi-rs/keyring";
|
|
106
|
-
import { m as makeApplicationRuntime } from "./application-runtime-
|
|
107
|
-
import { a as auth, d as discoverOAuthServerInfo, c as checkResourceAllowed, r as resourceUrlFromServerUrl, e as extractWWWAuthenticateParams, S as StreamableHTTPClientTransport, b as StdioClientTransport, C as Client } from "./chunks/vendor-@modelcontextprotocol-client-
|
|
106
|
+
import { m as makeApplicationRuntime } from "./application-runtime-4EGQJvLm.js";
|
|
107
|
+
import { a as auth, d as discoverOAuthServerInfo, c as checkResourceAllowed, r as resourceUrlFromServerUrl, e as extractWWWAuthenticateParams, S as StreamableHTTPClientTransport, b as StdioClientTransport, C as Client } from "./chunks/vendor-@modelcontextprotocol-client-DuJtk4js.js";
|
|
108
108
|
import { createRequire } from "node:module";
|
|
109
|
-
import { r as resolveScheduleAgentRunConfig, b as buildScheduleSessionCreateOptions, w as withScheduledMessageInput, a as scheduleRequiredLocalProjectId, s as scheduleDestinationSessionId, d as destinationSessionProblem, c as buildScheduleRunTarget } from "./schedule-run-preparation-
|
|
110
|
-
import { m as make$6, a as make$7 } from "./chunks/vendor-@opencode-codemode-
|
|
109
|
+
import { r as resolveScheduleAgentRunConfig, b as buildScheduleSessionCreateOptions, w as withScheduledMessageInput, a as scheduleRequiredLocalProjectId, s as scheduleDestinationSessionId, d as destinationSessionProblem, c as buildScheduleRunTarget } from "./schedule-run-preparation-D2GjotJy.js";
|
|
110
|
+
import { m as make$6, a as make$7 } from "./chunks/vendor-@opencode-codemode-DmkYINkB.js";
|
|
111
111
|
import { p as parse } from "./chunks/vendor-acorn-FBr7vWTA.js";
|
|
112
112
|
import v8 from "node:v8";
|
|
113
113
|
import { d as LODY_SUPERVISOR_CONTRACT_ENV, h as LOCAL_CLI_SUPERVISOR_CONTRACT_VERSION, c as LODY_SUPERVISOR_TOKEN_ENV, L as LODY_SUPERVISOR_PID_ENV, b as LODY_SUPERVISOR_INSTANCE_ID_ENV, i as isLocalCliSupervisorShutdownMessage } from "./local-cli-supervisor-B9g3UlUg.js";
|
|
114
|
-
import { a as acquireLocalCliHostLease } from "./local-cli-host-lease-
|
|
115
|
-
import { e as captureAgentServiceEvent, f as captureCliActiveUser, g as captureCliActivePing, A as ACTIVE_PING_MIN_INTERVAL_MS$1 } from "./analytics-events-
|
|
114
|
+
import { a as acquireLocalCliHostLease } from "./local-cli-host-lease-BcOQ-7Gk.js";
|
|
115
|
+
import { e as captureAgentServiceEvent, f as captureCliActiveUser, g as captureCliActivePing, A as ACTIVE_PING_MIN_INTERVAL_MS$1 } from "./analytics-events-BNLOju7l.js";
|
|
116
116
|
import "./capabilities-Btwk4R--.js";
|
|
117
|
-
import { M as ManagedDaemonUpgradeOptionsSchema } from "./daemon-update-
|
|
117
|
+
import { M as ManagedDaemonUpgradeOptionsSchema } from "./daemon-update-BjGbzSFc.js";
|
|
118
118
|
const LODY_EXTENSION_METHODS = {
|
|
119
119
|
sessionPromptSuggestion: "_lody/session/prompt_suggestion",
|
|
120
120
|
sessionUsageUpdate: "_lody/session/usage_update",
|
|
@@ -125,6 +125,8 @@ const LODY_EXTENSION_METHODS = {
|
|
|
125
125
|
sessionActivityUpdate: "_lody/session/activity_update",
|
|
126
126
|
sessionGoal: "_lody/session/goal",
|
|
127
127
|
sessionHistoryRead: "_lody/session/history/read",
|
|
128
|
+
sessionArchive: "_lody/session/archive",
|
|
129
|
+
sessionUnarchive: "_lody/session/unarchive",
|
|
128
130
|
subagentsCancel: "_lody/subagents/cancel"
|
|
129
131
|
};
|
|
130
132
|
function normalizeLodyExtensionMethod(method) {
|
|
@@ -4983,7 +4985,7 @@ async function scanProjectSkillGroup(args) {
|
|
|
4983
4985
|
if (shouldExcludeLocalProjectRelativePath(groupDir, args.shouldIgnorePath)) {
|
|
4984
4986
|
return null;
|
|
4985
4987
|
}
|
|
4986
|
-
const groupPath = resolveSafeProjectDirectoryPath(args.rootRealPath, groupDir);
|
|
4988
|
+
const groupPath = args.singleSkillPath ?? resolveSafeProjectDirectoryPath(args.rootRealPath, groupDir);
|
|
4987
4989
|
const resolvedGroup = await resolveProjectEntry(args.rootRealPath, groupPath);
|
|
4988
4990
|
if (!resolvedGroup) {
|
|
4989
4991
|
return null;
|
|
@@ -5022,6 +5024,9 @@ async function scanProjectSkillGroup(args) {
|
|
|
5022
5024
|
if (rootSkillResult === "external-symlink") {
|
|
5023
5025
|
skippedExternalSymlinks += 1;
|
|
5024
5026
|
}
|
|
5027
|
+
if (args.singleSkillPath) {
|
|
5028
|
+
return candidates.length || skippedExternalSymlinks ? { scope: args.scope, dir: groupDir, candidates, truncated: false, skippedExternalSymlinks } : null;
|
|
5029
|
+
}
|
|
5025
5030
|
const entries = await fs__default$1.promises.readdir(resolvedGroup.realPath, { withFileTypes: true });
|
|
5026
5031
|
entries.sort((left, right) => left.name.localeCompare(right.name));
|
|
5027
5032
|
let truncated = entries.length > LOCAL_PROJECT_SKILL_DIR_MAX_CHILDREN;
|
|
@@ -5258,7 +5263,7 @@ function toHomeSkillGroup(group) {
|
|
|
5258
5263
|
}))
|
|
5259
5264
|
};
|
|
5260
5265
|
}
|
|
5261
|
-
async function scanHomeSkillDirs(homeRealPath, knownSkillDirs, scope2, fingerprintParts) {
|
|
5266
|
+
async function scanHomeSkillDirs(homeRealPath, knownSkillDirs, scope2, fingerprintParts, singleSkillPaths) {
|
|
5262
5267
|
const uniqueSkillDirs = [
|
|
5263
5268
|
...new Map(
|
|
5264
5269
|
knownSkillDirs.map((skillDir) => {
|
|
@@ -5274,6 +5279,7 @@ async function scanHomeSkillDirs(homeRealPath, knownSkillDirs, scope2, fingerpri
|
|
|
5274
5279
|
rootRealPath: homeRealPath,
|
|
5275
5280
|
scope: scope2,
|
|
5276
5281
|
skillDir: skillDir.relativeDir,
|
|
5282
|
+
singleSkillPath: singleSkillPaths?.get(skillDir.displayDir),
|
|
5277
5283
|
shouldIgnorePath: null,
|
|
5278
5284
|
fingerprintParts
|
|
5279
5285
|
});
|
|
@@ -5294,13 +5300,38 @@ async function scanHomeSkillDirs(homeRealPath, knownSkillDirs, scope2, fingerpri
|
|
|
5294
5300
|
);
|
|
5295
5301
|
return scannedGroups.filter((entry) => entry !== null);
|
|
5296
5302
|
}
|
|
5297
|
-
async function listGlobalSkillsAtHomePath(homePath, knownFingerprint) {
|
|
5303
|
+
async function listGlobalSkillsAtHomePath(homePath, knownFingerprint, magpieGatewayUrl) {
|
|
5298
5304
|
const homeRealPath = await fs__default$1.promises.realpath(homePath);
|
|
5299
5305
|
const fingerprintParts = [];
|
|
5300
5306
|
const [globalGroups, systemGroups] = await Promise.all([
|
|
5301
5307
|
scanHomeSkillDirs(homeRealPath, ALL_KNOWN_GLOBAL_SKILL_DIRS, "global", fingerprintParts),
|
|
5302
5308
|
scanHomeSkillDirs(homeRealPath, ALL_KNOWN_SYSTEM_SKILL_DIRS, "system", fingerprintParts)
|
|
5303
5309
|
]);
|
|
5310
|
+
if (magpieGatewayUrl) {
|
|
5311
|
+
const profile = magpieProfileDirectory(
|
|
5312
|
+
path__default$1.join(getLodyDataDir(void 0, homePath), "magpie"),
|
|
5313
|
+
magpieGatewayUrl,
|
|
5314
|
+
"codex"
|
|
5315
|
+
);
|
|
5316
|
+
const paths = /* @__PURE__ */ new Map();
|
|
5317
|
+
for (const entry of await codexMagpieSkillEntries(profile, homeRealPath)) {
|
|
5318
|
+
if (entry.existing || entry.writable) {
|
|
5319
|
+
paths.set(
|
|
5320
|
+
`~/.codex/skills/${entry.name}`,
|
|
5321
|
+
entry.existing ? entry.destination : entry.native
|
|
5322
|
+
);
|
|
5323
|
+
}
|
|
5324
|
+
}
|
|
5325
|
+
globalGroups.push(
|
|
5326
|
+
...await scanHomeSkillDirs(
|
|
5327
|
+
homeRealPath,
|
|
5328
|
+
[...paths.keys()],
|
|
5329
|
+
"global",
|
|
5330
|
+
fingerprintParts,
|
|
5331
|
+
paths
|
|
5332
|
+
)
|
|
5333
|
+
);
|
|
5334
|
+
}
|
|
5304
5335
|
return await finishSkillsResult(
|
|
5305
5336
|
[...globalGroups, ...systemGroups],
|
|
5306
5337
|
fingerprintParts,
|
|
@@ -5542,7 +5573,8 @@ class LocalProjectControlService {
|
|
|
5542
5573
|
async listGlobalSkills(options) {
|
|
5543
5574
|
return await listGlobalSkillsAtHomePath(
|
|
5544
5575
|
options?.homePath ?? os__default.homedir(),
|
|
5545
|
-
options?.knownFingerprint
|
|
5576
|
+
options?.knownFingerprint,
|
|
5577
|
+
options?.magpieGatewayUrl
|
|
5546
5578
|
);
|
|
5547
5579
|
}
|
|
5548
5580
|
readProjectFile(rootPath, relativePath, options) {
|
|
@@ -5643,6 +5675,7 @@ const LodyCapabilitiesSchema = object$2({
|
|
|
5643
5675
|
}).optional(),
|
|
5644
5676
|
compaction: VersionOneSchema.optional(),
|
|
5645
5677
|
sessionHistory: VersionOneSchema.optional(),
|
|
5678
|
+
sessionArchive: VersionOneSchema.extend({ mode: _enum(["native", "title-marker"]) }).optional().catch(void 0),
|
|
5646
5679
|
worktreeProject: VersionOneSchema.optional(),
|
|
5647
5680
|
sessionActivity: VersionOneSchema.optional().catch(void 0),
|
|
5648
5681
|
promptSuggestions: VersionOneSchema.optional().catch(void 0)
|
|
@@ -9769,6 +9802,16 @@ function withoutElectronBootstrapCredentials(env) {
|
|
|
9769
9802
|
}
|
|
9770
9803
|
return childEnv;
|
|
9771
9804
|
}
|
|
9805
|
+
function resolveElectronRunAsNodeEnv(command2, env) {
|
|
9806
|
+
const childEnv = { ...env };
|
|
9807
|
+
const flag = process.env.ELECTRON_RUN_AS_NODE;
|
|
9808
|
+
if (flag && command2 === process.execPath) {
|
|
9809
|
+
childEnv.ELECTRON_RUN_AS_NODE = flag;
|
|
9810
|
+
} else {
|
|
9811
|
+
delete childEnv.ELECTRON_RUN_AS_NODE;
|
|
9812
|
+
}
|
|
9813
|
+
return childEnv;
|
|
9814
|
+
}
|
|
9772
9815
|
const DEFAULT_MAX_CONCURRENT_ACP_SESSION_STARTS = 2;
|
|
9773
9816
|
const ACP_SESSION_START_GATE_ENV = "LODY_MAX_CONCURRENT_ACP_SESSION_STARTS";
|
|
9774
9817
|
class AcpSessionStartQueueTimeoutError extends Error {
|
|
@@ -10562,7 +10605,11 @@ const spawnAcpProcess = (options) => {
|
|
|
10562
10605
|
{
|
|
10563
10606
|
command: executable.command,
|
|
10564
10607
|
args: executable.args,
|
|
10565
|
-
options: {
|
|
10608
|
+
options: {
|
|
10609
|
+
cwd: options.workdir,
|
|
10610
|
+
env: resolveElectronRunAsNodeEnv(executable.command, options.env),
|
|
10611
|
+
stdio: ["pipe", "pipe", "pipe"]
|
|
10612
|
+
},
|
|
10566
10613
|
processGroup: true
|
|
10567
10614
|
},
|
|
10568
10615
|
toShared(withSpawn(options.spawnImpl))
|
|
@@ -10599,7 +10646,14 @@ function copyTitleAgentCodexConfig(sourcePath, destinationPath) {
|
|
|
10599
10646
|
fs.copyFileSync(sourcePath, destinationPath);
|
|
10600
10647
|
}
|
|
10601
10648
|
}
|
|
10602
|
-
const startLocalAcpAgent = (options) => startLocalAcpProtocol(
|
|
10649
|
+
const startLocalAcpAgent = (options) => startLocalAcpProtocol(
|
|
10650
|
+
options,
|
|
10651
|
+
(connection) => createAcpClient({
|
|
10652
|
+
...options,
|
|
10653
|
+
...connection,
|
|
10654
|
+
agentConfig: { cliType: options.cliType, agentType: options.agentType }
|
|
10655
|
+
})
|
|
10656
|
+
);
|
|
10603
10657
|
class AcpQuotaCleanupError extends Error {
|
|
10604
10658
|
constructor(child2, cause) {
|
|
10605
10659
|
super("Quota ACP process cleanup was not confirmed", { cause });
|
|
@@ -10646,6 +10700,7 @@ async function queryLocalAcpRateLimits(options) {
|
|
|
10646
10700
|
mergeLoginShellEnv(options.env ?? process.env, await getLoginShellEnvLegacy())
|
|
10647
10701
|
)
|
|
10648
10702
|
);
|
|
10703
|
+
delete env.ELECTRON_RUN_AS_NODE;
|
|
10649
10704
|
let quotaChild;
|
|
10650
10705
|
const output = await runPromiseSquashedLegacy(
|
|
10651
10706
|
runCommandOk({
|
|
@@ -10716,6 +10771,58 @@ async function queryLocalAcpRateLimits(options) {
|
|
|
10716
10771
|
}
|
|
10717
10772
|
}
|
|
10718
10773
|
}
|
|
10774
|
+
async function initializeAndSetAcpSessionArchived(stream, options) {
|
|
10775
|
+
const connection = new ClientSideConnection(
|
|
10776
|
+
() => ({
|
|
10777
|
+
requestPermission: async () => ({ outcome: { outcome: "cancelled" } }),
|
|
10778
|
+
sessionUpdate: async () => {
|
|
10779
|
+
}
|
|
10780
|
+
}),
|
|
10781
|
+
stream
|
|
10782
|
+
);
|
|
10783
|
+
const initialized = await connection.initialize({
|
|
10784
|
+
protocolVersion: PROTOCOL_VERSION,
|
|
10785
|
+
clientCapabilities: { terminal: false, fs: { readTextFile: false, writeTextFile: false } }
|
|
10786
|
+
});
|
|
10787
|
+
const capability = parseLodyExtensionCapabilities(
|
|
10788
|
+
initialized.agentCapabilities?._meta
|
|
10789
|
+
).sessionArchive;
|
|
10790
|
+
if (!capability) return "unsupported";
|
|
10791
|
+
if (!await options.shouldApply()) return "superseded";
|
|
10792
|
+
options.signal?.throwIfAborted();
|
|
10793
|
+
object$2({}).strict().parse(
|
|
10794
|
+
await connection.request(
|
|
10795
|
+
options.archived ? LODY_EXTENSION_METHODS.sessionArchive : LODY_EXTENSION_METHODS.sessionUnarchive,
|
|
10796
|
+
{ sessionId: options.nativeSessionId }
|
|
10797
|
+
)
|
|
10798
|
+
);
|
|
10799
|
+
return capability.mode;
|
|
10800
|
+
}
|
|
10801
|
+
async function setLocalAcpSessionArchived(options) {
|
|
10802
|
+
const signal = options.signal ? AbortSignal.any([options.signal, AbortSignal.timeout(3e4)]) : AbortSignal.timeout(3e4);
|
|
10803
|
+
signal.throwIfAborted();
|
|
10804
|
+
const workdir = fs.mkdtempSync(path__default.join(os__default$1.tmpdir(), "lody-session-archive-"));
|
|
10805
|
+
try {
|
|
10806
|
+
const started = await startLocalAcpProtocol(
|
|
10807
|
+
{ ...options, workdir, signal },
|
|
10808
|
+
async ({ stream, startupAbort }) => ({
|
|
10809
|
+
result: await Promise.race([
|
|
10810
|
+
initializeAndSetAcpSessionArchived(stream, { ...options, signal }),
|
|
10811
|
+
...startupAbort ? [startupAbort] : []
|
|
10812
|
+
])
|
|
10813
|
+
}),
|
|
10814
|
+
true
|
|
10815
|
+
);
|
|
10816
|
+
await terminateAcpProcessTree(started.agentProcess, {
|
|
10817
|
+
logger: options.logger,
|
|
10818
|
+
sessionLabel: "session-archive",
|
|
10819
|
+
exitTimeoutMs: 3e3
|
|
10820
|
+
});
|
|
10821
|
+
return started.result;
|
|
10822
|
+
} finally {
|
|
10823
|
+
fs.rmSync(workdir, { recursive: true, force: true });
|
|
10824
|
+
}
|
|
10825
|
+
}
|
|
10719
10826
|
async function prepareAcpProcessEnvironmentLegacy(launch, env, options = {}) {
|
|
10720
10827
|
if (!launch.env?.LODY_DSH_NODE_ARGS) return env;
|
|
10721
10828
|
return runPromiseSquashedLegacy(
|
|
@@ -10774,6 +10881,7 @@ async function startLocalAcpProtocol(options, startClient, retainCleanupFailure
|
|
|
10774
10881
|
logger: options.logger,
|
|
10775
10882
|
signal: options.signal
|
|
10776
10883
|
});
|
|
10884
|
+
delete mergedStartupEnv.ELECTRON_RUN_AS_NODE;
|
|
10777
10885
|
const envWithAcpStartup = isTitleAgentCodexRun ? withTitleAgentCodexConfig(mergedStartupEnv) : mergedStartupEnv;
|
|
10778
10886
|
const keepCodexHome = env.LODY_KEEP_CODEX_HOME === "1";
|
|
10779
10887
|
const defaultCodexHome = path__default.join(os__default$1.homedir(), ".codex");
|
|
@@ -10909,20 +11017,7 @@ async function startLocalAcpProtocol(options, startClient, retainCleanupFailure
|
|
|
10909
11017
|
options.logger.debug("[acp-startup] creating ACP client");
|
|
10910
11018
|
const started = await startClient({
|
|
10911
11019
|
stream,
|
|
10912
|
-
workdir: options.workdir,
|
|
10913
|
-
logger: options.logger,
|
|
10914
|
-
terminalManager: options.terminalManager,
|
|
10915
|
-
agentConfig: {
|
|
10916
|
-
cliType: options.cliType,
|
|
10917
|
-
agentType: options.agentType
|
|
10918
|
-
},
|
|
10919
11020
|
launcher,
|
|
10920
|
-
terminalEnabled: options.terminalEnabled,
|
|
10921
|
-
discoverAuthenticationMethods: options.discoverAuthenticationMethods,
|
|
10922
|
-
onUsageUpdate: options.onUsageUpdate,
|
|
10923
|
-
onContextWindowUsageUpdate: options.onContextWindowUsageUpdate,
|
|
10924
|
-
onUpdateMessage: options.onUpdateMessage,
|
|
10925
|
-
onRequestPermission: options.onRequestPermission,
|
|
10926
11021
|
startupTimeouts,
|
|
10927
11022
|
startupAbort: signalAbort ? Promise.race([startupMonitor.abortPromise, signalAbort]) : startupMonitor.abortPromise
|
|
10928
11023
|
});
|
|
@@ -12071,7 +12166,6 @@ class LocalProjectHistorySyncService {
|
|
|
12071
12166
|
createdAt: new Date(nowMs).toISOString(),
|
|
12072
12167
|
userId: this.context.userId,
|
|
12073
12168
|
status: SessionStatusFactory.idle(),
|
|
12074
|
-
isArchived: false,
|
|
12075
12169
|
origin: "external-acp",
|
|
12076
12170
|
cliType: this.provider.cliType,
|
|
12077
12171
|
agentType: this.provider.agentType,
|
|
@@ -19253,15 +19347,32 @@ class SessionAutomationAuthority {
|
|
|
19253
19347
|
rootId,
|
|
19254
19348
|
"archive"
|
|
19255
19349
|
);
|
|
19256
|
-
|
|
19350
|
+
const protectedIds = new Set(current.map((meta) => meta.id));
|
|
19351
|
+
if (targets.some((meta) => !protectedIds.has(meta.id)))
|
|
19352
|
+
return { value: "unknown", reason: "group_membership_changed" };
|
|
19353
|
+
const archiveTarget = async (meta) => {
|
|
19257
19354
|
const fresh = await this.deps.manager.repo.getDocMeta(getSessionRoomId(meta.id));
|
|
19258
19355
|
if (!fresh?.meta || isLoroRepoDocDeleted(fresh) || hasPendingUserTurnActivation(fresh.meta))
|
|
19259
|
-
return
|
|
19356
|
+
return false;
|
|
19260
19357
|
await this.deps.manager.repo.upsertDocMeta(
|
|
19261
19358
|
getSessionRoomId(meta.id),
|
|
19262
19359
|
buildSessionArchiveMetaPatch()
|
|
19263
19360
|
);
|
|
19361
|
+
return true;
|
|
19362
|
+
};
|
|
19363
|
+
for (const meta of targets.slice(1)) {
|
|
19364
|
+
if (!await archiveTarget(meta))
|
|
19365
|
+
return { value: "unknown", reason: "session_changed" };
|
|
19264
19366
|
}
|
|
19367
|
+
const finalTargets = await readSessionOperationTargets(
|
|
19368
|
+
this.deps.manager.repo,
|
|
19369
|
+
rootId,
|
|
19370
|
+
"archive"
|
|
19371
|
+
);
|
|
19372
|
+
if (finalTargets.map((meta) => meta.id).sort().join("\0") !== targets.map((meta) => meta.id).sort().join("\0"))
|
|
19373
|
+
return { value: "unknown", reason: "group_membership_changed" };
|
|
19374
|
+
if (!await archiveTarget(targets[0]))
|
|
19375
|
+
return { value: "unknown", reason: "session_changed" };
|
|
19265
19376
|
await this.deps.manager.repo.flush();
|
|
19266
19377
|
return { value: "yes", reason: "session_archived" };
|
|
19267
19378
|
} finally {
|
|
@@ -20665,7 +20776,9 @@ function createEverMeMemoryProvider(run2 = runEvercli, runInstall = runNpm, prov
|
|
|
20665
20776
|
const resolve2 = (target) => EVERME_AGENTS.find((entry) => entry.id === target || entry.aliases?.includes(target));
|
|
20666
20777
|
let flow;
|
|
20667
20778
|
let job;
|
|
20668
|
-
let claiming
|
|
20779
|
+
let claiming;
|
|
20780
|
+
let uninstallJob;
|
|
20781
|
+
const uninstalling = () => claiming === "uninstall" || uninstallJob?.running === true;
|
|
20669
20782
|
let account;
|
|
20670
20783
|
let agentJob;
|
|
20671
20784
|
let lastAgents;
|
|
@@ -20721,7 +20834,10 @@ function createEverMeMemoryProvider(run2 = runEvercli, runInstall = runNpm, prov
|
|
|
20721
20834
|
};
|
|
20722
20835
|
const probe = async () => {
|
|
20723
20836
|
const result2 = await run2(["auth", "status", "--no-prompt", "--format", "json"]);
|
|
20724
|
-
if (result2.code === "ENOENT")
|
|
20837
|
+
if (result2.code === "ENOENT") {
|
|
20838
|
+
account = void 0;
|
|
20839
|
+
return "not_installed";
|
|
20840
|
+
}
|
|
20725
20841
|
try {
|
|
20726
20842
|
const parsed = object$2({
|
|
20727
20843
|
ok: boolean(),
|
|
@@ -20741,6 +20857,7 @@ function createEverMeMemoryProvider(run2 = runEvercli, runInstall = runNpm, prov
|
|
|
20741
20857
|
};
|
|
20742
20858
|
const startAgentJob = (targets, mode) => {
|
|
20743
20859
|
if (agentJob?.running) return agentsSnapshot();
|
|
20860
|
+
if (uninstalling()) throw new Error("EverMe is being uninstalled on this machine.");
|
|
20744
20861
|
const started = { running: true, failed: false };
|
|
20745
20862
|
agentJob = started;
|
|
20746
20863
|
void apply(targets, mode).then(
|
|
@@ -20832,13 +20949,14 @@ function createEverMeMemoryProvider(run2 = runEvercli, runInstall = runNpm, prov
|
|
|
20832
20949
|
},
|
|
20833
20950
|
async install() {
|
|
20834
20951
|
if (job?.running) return { status: "running", step: job.step };
|
|
20835
|
-
if (claiming) return { status: "running" };
|
|
20836
|
-
|
|
20952
|
+
if (claiming === "install") return { status: "running" };
|
|
20953
|
+
if (uninstalling()) throw new Error("EverMe is being uninstalled on this machine.");
|
|
20954
|
+
claiming = "install";
|
|
20837
20955
|
try {
|
|
20838
20956
|
const before = await probe();
|
|
20839
20957
|
if (before !== "not_installed" && before !== "error") return { status: "done" };
|
|
20840
20958
|
} finally {
|
|
20841
|
-
claiming =
|
|
20959
|
+
claiming = void 0;
|
|
20842
20960
|
}
|
|
20843
20961
|
const started = { running: true, failed: false, step: "provider" };
|
|
20844
20962
|
job = started;
|
|
@@ -20870,12 +20988,51 @@ function createEverMeMemoryProvider(run2 = runEvercli, runInstall = runNpm, prov
|
|
|
20870
20988
|
// Async only to match its other half, so the caller can reach either by
|
|
20871
20989
|
// name; asking after a job is reading a flag, not work.
|
|
20872
20990
|
async installPoll() {
|
|
20873
|
-
if (claiming) return { status: "running" };
|
|
20991
|
+
if (claiming === "install") return { status: "running" };
|
|
20874
20992
|
if (!job) return { status: "failed" };
|
|
20875
20993
|
if (job.running) return { status: "running", step: job.step };
|
|
20876
20994
|
if (!job.failed) return { status: "done" };
|
|
20877
20995
|
return job.failure ? { status: "failed", failure: job.failure } : { status: "failed" };
|
|
20878
20996
|
},
|
|
20997
|
+
/** Removes only the global package, through the npm and prefix the install used. */
|
|
20998
|
+
async uninstall() {
|
|
20999
|
+
if (uninstallJob?.running || claiming === "uninstall") return { status: "running" };
|
|
21000
|
+
if (claiming || job?.running || agentJob?.running)
|
|
21001
|
+
throw new Error("EverMe is busy on this machine. Wait for it to finish, then retry.");
|
|
21002
|
+
claiming = "uninstall";
|
|
21003
|
+
try {
|
|
21004
|
+
if (await probe() === "not_installed") return { status: "done" };
|
|
21005
|
+
} finally {
|
|
21006
|
+
claiming = void 0;
|
|
21007
|
+
}
|
|
21008
|
+
const started = { running: true, failed: false };
|
|
21009
|
+
uninstallJob = started;
|
|
21010
|
+
void (async () => {
|
|
21011
|
+
const result2 = await runInstall(["uninstall", "--global", EVERME_PACKAGE]);
|
|
21012
|
+
if (result2.code !== void 0) {
|
|
21013
|
+
started.failed = true;
|
|
21014
|
+
started.failure = installFailure(result2);
|
|
21015
|
+
return;
|
|
21016
|
+
}
|
|
21017
|
+
started.failed = await probe() !== "not_installed";
|
|
21018
|
+
if (!started.failed) {
|
|
21019
|
+
flow = void 0;
|
|
21020
|
+
lastAgents = void 0;
|
|
21021
|
+
}
|
|
21022
|
+
})().catch(() => {
|
|
21023
|
+
started.failed = true;
|
|
21024
|
+
}).finally(() => {
|
|
21025
|
+
started.running = false;
|
|
21026
|
+
});
|
|
21027
|
+
return { status: "running" };
|
|
21028
|
+
},
|
|
21029
|
+
async uninstallPoll() {
|
|
21030
|
+
if (claiming === "uninstall") return { status: "running" };
|
|
21031
|
+
if (!uninstallJob) return { status: "failed" };
|
|
21032
|
+
if (uninstallJob.running) return { status: "running" };
|
|
21033
|
+
if (!uninstallJob.failed) return { status: "done" };
|
|
21034
|
+
return uninstallJob.failure ? { status: "failed", failure: uninstallJob.failure } : { status: "failed" };
|
|
21035
|
+
},
|
|
20879
21036
|
/** Credentials stay in EverMe's own per-machine config; nothing is injected. */
|
|
20880
21037
|
environment: () => ({})
|
|
20881
21038
|
};
|
|
@@ -21011,6 +21168,12 @@ async function handleMemoryProviderRequest(input, registry = providers) {
|
|
|
21011
21168
|
const install = await begin.call(provider);
|
|
21012
21169
|
return { ...await settledReply(provider, await provider.probe()), install };
|
|
21013
21170
|
}
|
|
21171
|
+
if (request.action === "uninstall" || request.action === "uninstallPoll") {
|
|
21172
|
+
const begin = request.action === "uninstall" ? provider.uninstall : provider.uninstallPoll;
|
|
21173
|
+
if (!begin) throw new Error("This memory provider does not uninstall from Lody");
|
|
21174
|
+
const uninstall = await begin.call(provider);
|
|
21175
|
+
return { ...await settledReply(provider, await provider.probe()), uninstall };
|
|
21176
|
+
}
|
|
21014
21177
|
if (request.action === "connectPoll") {
|
|
21015
21178
|
if (!provider.connectPoll) throw new Error("This memory provider does not connect agents");
|
|
21016
21179
|
return agentsJobReply(provider, await provider.connectPoll());
|
|
@@ -30922,6 +31085,7 @@ class Session extends EventEmitter$1 {
|
|
|
30922
31085
|
finalEnv[key2] = configEnv[key2];
|
|
30923
31086
|
}
|
|
30924
31087
|
}
|
|
31088
|
+
delete finalEnv.ELECTRON_RUN_AS_NODE;
|
|
30925
31089
|
return finalEnv;
|
|
30926
31090
|
}
|
|
30927
31091
|
async createAgent(callbacks) {
|
|
@@ -31001,7 +31165,7 @@ class Session extends EventEmitter$1 {
|
|
|
31001
31165
|
});
|
|
31002
31166
|
agentProcessHandle = await this.sandbox.spawn(executable.command, executable.args, {
|
|
31003
31167
|
cwd: this.getWorkdir(),
|
|
31004
|
-
env: startupEnv,
|
|
31168
|
+
env: resolveElectronRunAsNodeEnv(executable.command, startupEnv),
|
|
31005
31169
|
stdio: ["pipe", "pipe", "pipe"]
|
|
31006
31170
|
});
|
|
31007
31171
|
agentProcessHandle.onExit(() => {
|
|
@@ -34792,6 +34956,7 @@ const generateTitleIsolated = async (options) => {
|
|
|
34792
34956
|
};
|
|
34793
34957
|
const ACTIVE_PING_MIN_INTERVAL_MS = 6e4;
|
|
34794
34958
|
const DEFAULT_SLOW_THRESHOLD_MS = 12e4;
|
|
34959
|
+
const DEFAULT_LATE_STREAM_ACTIVITY_TTL_MS = 3e4;
|
|
34795
34960
|
const DEFAULT_INITIALIZING_STALL_BUDGETS_MS = {
|
|
34796
34961
|
initializing: 18e4,
|
|
34797
34962
|
acp: 9e5,
|
|
@@ -34860,11 +35025,21 @@ const makeSessionActivePresence = fnUntraced(function* (options = {}) {
|
|
|
34860
35025
|
const parent = yield* Scope;
|
|
34861
35026
|
const active = /* @__PURE__ */ new Map();
|
|
34862
35027
|
const nativeWork = /* @__PURE__ */ new Map();
|
|
35028
|
+
const lateActivityUntil = /* @__PURE__ */ new Map();
|
|
34863
35029
|
const nativePublished = /* @__PURE__ */ new Map();
|
|
34864
35030
|
let idle = yield* make$1();
|
|
34865
35031
|
yield* succeed$2(idle, void 0);
|
|
34866
35032
|
let retired = false;
|
|
34867
35033
|
const now = () => clock.currentTimeMillisUnsafe();
|
|
35034
|
+
const lateActivityTtlMs = options.lateStreamActivityTtlMs ?? DEFAULT_LATE_STREAM_ACTIVITY_TTL_MS;
|
|
35035
|
+
const hasActiveLateActivity = (sessionId, nowMs) => {
|
|
35036
|
+
const deadline = lateActivityUntil.get(sessionId);
|
|
35037
|
+
if (deadline === void 0) return false;
|
|
35038
|
+
if (nowMs < deadline) return true;
|
|
35039
|
+
lateActivityUntil.delete(sessionId);
|
|
35040
|
+
return false;
|
|
35041
|
+
};
|
|
35042
|
+
const hasLiveOutOfTurnWork = (sessionId, nowMs) => nativeWork.has(sessionId) || hasActiveLateActivity(sessionId, nowMs);
|
|
34868
35043
|
const tick = (sessionId, state) => {
|
|
34869
35044
|
if (active.get(sessionId) !== state || state.closing || state.stallReported) return;
|
|
34870
35045
|
const status = phaseToStatus(state.phase, state.detail);
|
|
@@ -34907,9 +35082,10 @@ const makeSessionActivePresence = fnUntraced(function* (options = {}) {
|
|
|
34907
35082
|
};
|
|
34908
35083
|
const clear2 = (sessionId, state) => sync(() => {
|
|
34909
35084
|
if (active.get(sessionId) !== state) return;
|
|
34910
|
-
|
|
35085
|
+
const nowMs = now();
|
|
35086
|
+
if (hasLiveOutOfTurnWork(sessionId, nowMs) && !retired) {
|
|
34911
35087
|
host.publish(sessionId, SessionStatusFactory.running());
|
|
34912
|
-
nativePublished.set(sessionId,
|
|
35088
|
+
nativePublished.set(sessionId, nowMs);
|
|
34913
35089
|
} else {
|
|
34914
35090
|
host.clear(sessionId);
|
|
34915
35091
|
nativePublished.delete(sessionId);
|
|
@@ -34939,6 +35115,7 @@ const makeSessionActivePresence = fnUntraced(function* (options = {}) {
|
|
|
34939
35115
|
stallReported: false
|
|
34940
35116
|
};
|
|
34941
35117
|
if (active.size === 0) idle = makeUnsafe$1();
|
|
35118
|
+
lateActivityUntil.delete(sessionId);
|
|
34942
35119
|
active.set(sessionId, state);
|
|
34943
35120
|
yield* addFinalizer$1(
|
|
34944
35121
|
scope2,
|
|
@@ -34979,16 +35156,21 @@ const makeSessionActivePresence = fnUntraced(function* (options = {}) {
|
|
|
34979
35156
|
});
|
|
34980
35157
|
yield* forkIn(
|
|
34981
35158
|
sync(() => {
|
|
34982
|
-
|
|
35159
|
+
const nowMs = now();
|
|
35160
|
+
for (const sessionId of /* @__PURE__ */ new Set([
|
|
35161
|
+
...nativeWork.keys(),
|
|
35162
|
+
...lateActivityUntil.keys(),
|
|
35163
|
+
...nativePublished.keys()
|
|
35164
|
+
])) {
|
|
34983
35165
|
if (active.has(sessionId)) continue;
|
|
34984
35166
|
try {
|
|
34985
35167
|
const lastPublished = nativePublished.get(sessionId);
|
|
34986
|
-
if (!
|
|
35168
|
+
if (!hasLiveOutOfTurnWork(sessionId, nowMs)) {
|
|
34987
35169
|
if (lastPublished !== void 0) host.clear(sessionId);
|
|
34988
35170
|
nativePublished.delete(sessionId);
|
|
34989
|
-
} else if (lastPublished === void 0 ||
|
|
35171
|
+
} else if (lastPublished === void 0 || nowMs - lastPublished >= (options.intervalMs ?? LODY_PRESENCE_HEARTBEAT_MS)) {
|
|
34990
35172
|
host.publish(sessionId, SessionStatusFactory.running());
|
|
34991
|
-
nativePublished.set(sessionId,
|
|
35173
|
+
nativePublished.set(sessionId, nowMs);
|
|
34992
35174
|
}
|
|
34993
35175
|
} catch (error) {
|
|
34994
35176
|
host.report({ kind: "heartbeat-failed", sessionId, cause: die$1(error) });
|
|
@@ -35014,6 +35196,14 @@ const makeSessionActivePresence = fnUntraced(function* (options = {}) {
|
|
|
35014
35196
|
if (work) nativeWork.set(sessionId, work);
|
|
35015
35197
|
else nativeWork.delete(sessionId);
|
|
35016
35198
|
},
|
|
35199
|
+
noteLateActivity: (sessionId) => {
|
|
35200
|
+
if (retired) return;
|
|
35201
|
+
lateActivityUntil.set(sessionId, now() + lateActivityTtlMs);
|
|
35202
|
+
},
|
|
35203
|
+
clearLateActivity: (sessionId) => {
|
|
35204
|
+
lateActivityUntil.delete(sessionId);
|
|
35205
|
+
},
|
|
35206
|
+
hasLateActivity: (sessionId) => !retired && hasActiveLateActivity(sessionId, now()),
|
|
35017
35207
|
setPhase: (sessionId, phase, detail) => {
|
|
35018
35208
|
const state = active.get(sessionId);
|
|
35019
35209
|
if (!state || state.closing || state.stallReported || state.phase === phase && state.detail === detail)
|
|
@@ -35026,15 +35216,23 @@ const makeSessionActivePresence = fnUntraced(function* (options = {}) {
|
|
|
35026
35216
|
has: (sessionId) => active.has(sessionId),
|
|
35027
35217
|
getStatus: (sessionId) => {
|
|
35028
35218
|
const state = active.get(sessionId);
|
|
35029
|
-
return state ? phaseToStatus(state.phase, state.detail) :
|
|
35219
|
+
return state ? phaseToStatus(state.phase, state.detail) : hasLiveOutOfTurnWork(sessionId, now()) ? SessionStatusFactory.running() : null;
|
|
35220
|
+
},
|
|
35221
|
+
activeSessionCount: () => {
|
|
35222
|
+
const nowMs = now();
|
|
35223
|
+
const ids = /* @__PURE__ */ new Set([...active.keys(), ...nativeWork.keys()]);
|
|
35224
|
+
for (const sessionId of lateActivityUntil.keys()) {
|
|
35225
|
+
if (hasLiveOutOfTurnWork(sessionId, nowMs)) ids.add(sessionId);
|
|
35226
|
+
}
|
|
35227
|
+
return ids.size;
|
|
35030
35228
|
},
|
|
35031
|
-
activeSessionCount: () => (/* @__PURE__ */ new Set([...active.keys(), ...nativeWork.keys()])).size,
|
|
35032
35229
|
retire: () => {
|
|
35033
35230
|
retired = true;
|
|
35034
35231
|
for (const sessionId of nativePublished.keys()) {
|
|
35035
35232
|
if (!active.has(sessionId)) host.clear(sessionId);
|
|
35036
35233
|
}
|
|
35037
35234
|
nativeWork.clear();
|
|
35235
|
+
lateActivityUntil.clear();
|
|
35038
35236
|
nativePublished.clear();
|
|
35039
35237
|
},
|
|
35040
35238
|
retryRelease: (sessionId) => suspend(() => {
|
|
@@ -37161,23 +37359,6 @@ async function resolveSessionLaunchConfig(input) {
|
|
|
37161
37359
|
});
|
|
37162
37360
|
}
|
|
37163
37361
|
}
|
|
37164
|
-
const GB = 1024 ** 3;
|
|
37165
|
-
const round = (value) => Math.round(value * 10) / 10;
|
|
37166
|
-
async function readLodyDataDiskInfo(directory = getLodyDataDir()) {
|
|
37167
|
-
try {
|
|
37168
|
-
const stats = await fs__default$2.statfs(directory);
|
|
37169
|
-
const total = stats.blocks * stats.bsize;
|
|
37170
|
-
const free = stats.bavail * stats.bsize;
|
|
37171
|
-
if (!Number.isFinite(total) || total <= 0) return void 0;
|
|
37172
|
-
return {
|
|
37173
|
-
totalGB: round(total / GB),
|
|
37174
|
-
freeGB: round(free / GB),
|
|
37175
|
-
usedPercent: Math.min(100, Math.max(0, round((total - free) / total * 100)))
|
|
37176
|
-
};
|
|
37177
|
-
} catch {
|
|
37178
|
-
return void 0;
|
|
37179
|
-
}
|
|
37180
|
-
}
|
|
37181
37362
|
function mcpSelectionChanged(session, input) {
|
|
37182
37363
|
const selected = new Set(input.mcpServerIds ?? []);
|
|
37183
37364
|
const mounted = new Set(session.getMcpServerIds?.() ?? []);
|
|
@@ -37552,6 +37733,10 @@ class SessionExecutionService {
|
|
|
37552
37733
|
isInboxInputCanceled(sessionId, inputId) {
|
|
37553
37734
|
return this.operationInbox?.inputCanceled(this.deps.workspaceId, sessionId, inputId) ?? false;
|
|
37554
37735
|
}
|
|
37736
|
+
/** True once the input finished or was canceled; begin never admits it again. */
|
|
37737
|
+
isInboxInputEnded(sessionId, inputId) {
|
|
37738
|
+
return this.operationInbox?.inputEnded(this.deps.workspaceId, sessionId, inputId) ?? false;
|
|
37739
|
+
}
|
|
37555
37740
|
quiesceInboxExecutions() {
|
|
37556
37741
|
this.shutdownAbort.abort();
|
|
37557
37742
|
for (const runtime of this.turnRuntimeBySession.values()) {
|
|
@@ -47047,7 +47232,8 @@ class SessionDispatchWatcher {
|
|
|
47047
47232
|
);
|
|
47048
47233
|
});
|
|
47049
47234
|
}
|
|
47050
|
-
|
|
47235
|
+
const awaitingStart = entry.role === "user" && ["pending", "seen", "prepared", "pending_apply"].includes(entry.status ?? "");
|
|
47236
|
+
if (awaitingStart && (pausedQueueIds.has(entry.id) || this.deps.executionService.isInboxInputCanceled?.(meta.id, entry.id))) {
|
|
47051
47237
|
await backend.applyHistoryAction({
|
|
47052
47238
|
kind: "user-status",
|
|
47053
47239
|
turnId: entry.id,
|
|
@@ -47059,6 +47245,22 @@ class SessionDispatchWatcher {
|
|
|
47059
47245
|
});
|
|
47060
47246
|
entry.status = "canceled";
|
|
47061
47247
|
canceledInput = true;
|
|
47248
|
+
} else if (awaitingStart && this.deps.executionService.isInboxInputEnded?.(meta.id, entry.id)) {
|
|
47249
|
+
await backend.applyHistoryAction({
|
|
47250
|
+
kind: "user-status",
|
|
47251
|
+
turnId: entry.id,
|
|
47252
|
+
status: "failed"
|
|
47253
|
+
});
|
|
47254
|
+
entry.status = "failed";
|
|
47255
|
+
canceledInput = true;
|
|
47256
|
+
if (meta.processingUserMsgId === entry.id) {
|
|
47257
|
+
await this.deps.workspaceDocument.repo.upsertDocMeta?.(getSessionRoomId(meta.id), {
|
|
47258
|
+
lastHandledUserMsgId: entry.id,
|
|
47259
|
+
lastFailedUserMsgId: entry.id,
|
|
47260
|
+
processingUserMsgId: void 0
|
|
47261
|
+
});
|
|
47262
|
+
meta.processingUserMsgId = void 0;
|
|
47263
|
+
}
|
|
47062
47264
|
}
|
|
47063
47265
|
}
|
|
47064
47266
|
const observedPreferred = preferred;
|
|
@@ -59367,7 +59569,8 @@ class MessageHandler {
|
|
|
59367
59569
|
{ noticeId: `session-stop-failure-${turnId}-${failure.phase}` }
|
|
59368
59570
|
),
|
|
59369
59571
|
recordNativeWorkInterrupted: async (sessionId, turnId) => {
|
|
59370
|
-
if (this.deletedSessionIds.has(sessionId) || this.
|
|
59572
|
+
if (this.deletedSessionIds.has(sessionId) || this.sessionManager.isArchiveInFlight(sessionId))
|
|
59573
|
+
return;
|
|
59371
59574
|
await this.recordAgentWarning(
|
|
59372
59575
|
sessionId,
|
|
59373
59576
|
{
|
|
@@ -59428,7 +59631,7 @@ class MessageHandler {
|
|
|
59428
59631
|
// metadata sync is what separates "deleted" from "not seen yet".
|
|
59429
59632
|
hasCompleteMetadata: () => this.cloudPort.kind === "local" || this.workspaceDocument.hasCompletedInitialMetaSync(),
|
|
59430
59633
|
readOwnerState: (sessionId) => this.readWorktreeOwnerState(sessionId),
|
|
59431
|
-
isRuntimeActive: (sessionId) => this.
|
|
59634
|
+
isRuntimeActive: (sessionId) => this.sessionManager.isArchiveInFlight(sessionId) || this.sessionManager.hasSession(sessionId),
|
|
59432
59635
|
runCleanupScript: (input) => this.runArchivedWorktreeCleanupScript(input),
|
|
59433
59636
|
archiveProjectGroup: (input) => archiveProjectGroup({
|
|
59434
59637
|
...input,
|
|
@@ -60083,10 +60286,9 @@ class MessageHandler {
|
|
|
60083
60286
|
cancelledHistorySubscriptions = /* @__PURE__ */ new Map();
|
|
60084
60287
|
sessionActivePresence;
|
|
60085
60288
|
titleGenerationInFlight = /* @__PURE__ */ new Map();
|
|
60086
|
-
// Note: titleGenerationInFlight
|
|
60289
|
+
// Note: titleGenerationInFlight is self-cleaning
|
|
60087
60290
|
// and stay as independent tracking. All other per-session state lives in this.store.
|
|
60088
60291
|
sessionLifecycleWatchHandles = [];
|
|
60089
|
-
archiveInFlight = /* @__PURE__ */ new Set();
|
|
60090
60292
|
deletedSessionIds = /* @__PURE__ */ new Set();
|
|
60091
60293
|
/**
|
|
60092
60294
|
* Latest output time and running tool title per Session, for on-demand live
|
|
@@ -61250,15 +61452,9 @@ class MessageHandler {
|
|
|
61250
61452
|
}
|
|
61251
61453
|
const tempPath = `${args.destPath}.${v4()}.part`;
|
|
61252
61454
|
const hash = crypto__default.createHash("sha256");
|
|
61253
|
-
let source2;
|
|
61254
|
-
try {
|
|
61255
|
-
source2 = fs__default.createReadStream(blobPath);
|
|
61256
|
-
} catch {
|
|
61257
|
-
return false;
|
|
61258
|
-
}
|
|
61259
61455
|
const fileHandle = await fs__default.promises.open(tempPath, "wx");
|
|
61260
61456
|
try {
|
|
61261
|
-
for await (const chunk of
|
|
61457
|
+
for await (const chunk of fs__default.createReadStream(blobPath)) {
|
|
61262
61458
|
const buf = chunk;
|
|
61263
61459
|
hash.update(buf);
|
|
61264
61460
|
await fileHandle.write(buf);
|
|
@@ -62170,9 +62366,11 @@ class MessageHandler {
|
|
|
62170
62366
|
...this.sorbetCredentials ? {
|
|
62171
62367
|
sorbetCredentials: SORBET_CREDENTIALS_PROTOCOL_VERSION,
|
|
62172
62368
|
sorbetProviders: SORBET_PROVIDERS_PROTOCOL_VERSION,
|
|
62369
|
+
sorbetHostSettings: SORBET_HOST_SETTINGS_PROTOCOL_VERSION,
|
|
62173
62370
|
...this.encryptedAttachments ? {
|
|
62174
62371
|
sorbetCredentialsRemote: SORBET_CREDENTIALS_REMOTE_PROTOCOL_VERSION,
|
|
62175
|
-
sorbetProvidersRemote: SORBET_PROVIDERS_REMOTE_PROTOCOL_VERSION
|
|
62372
|
+
sorbetProvidersRemote: SORBET_PROVIDERS_REMOTE_PROTOCOL_VERSION,
|
|
62373
|
+
sorbetHostSettingsRemote: SORBET_HOST_SETTINGS_REMOTE_PROTOCOL_VERSION
|
|
62176
62374
|
} : {}
|
|
62177
62375
|
} : {},
|
|
62178
62376
|
...this.cloudPort.remoteAutomation ? { remoteAutomationControl: 1 } : {}
|
|
@@ -62486,10 +62684,17 @@ class MessageHandler {
|
|
|
62486
62684
|
if (event.kind !== "doc-metadata") return;
|
|
62487
62685
|
const sessionId = getSessionIdFromRoomId(event.docId);
|
|
62488
62686
|
if (!sessionId) return;
|
|
62489
|
-
|
|
62490
|
-
void
|
|
62491
|
-
|
|
62492
|
-
|
|
62687
|
+
const { isArchived: archived, createdAt } = event.patch;
|
|
62688
|
+
const initialActiveMetadata = archived === false && createdAt !== void 0;
|
|
62689
|
+
if (typeof archived !== "boolean" || initialActiveMetadata) return;
|
|
62690
|
+
if (archived) {
|
|
62691
|
+
void this.iosSimulatorService.closeSession(sessionId);
|
|
62692
|
+
void this.androidEmulatorService.closeSession(sessionId);
|
|
62693
|
+
}
|
|
62694
|
+
void this.sessionManager.observeArchiveChange(
|
|
62695
|
+
sessionId,
|
|
62696
|
+
() => this.handleSessionArchiveChanged(sessionId)
|
|
62697
|
+
);
|
|
62493
62698
|
},
|
|
62494
62699
|
{ kinds: ["doc-metadata"], metadataFields: ["isArchived"] }
|
|
62495
62700
|
),
|
|
@@ -62602,22 +62807,24 @@ class MessageHandler {
|
|
|
62602
62807
|
const snapshot = await this.workspaceDocument.repo.getDocMeta(getSessionRoomId(sessionId));
|
|
62603
62808
|
return snapshot?.meta?.machineId === this.machineId;
|
|
62604
62809
|
}
|
|
62605
|
-
async
|
|
62606
|
-
if (this.archiveInFlight.has(sessionId)) {
|
|
62607
|
-
return;
|
|
62608
|
-
}
|
|
62609
|
-
if (!await this.isSessionOwnedByThisMachine(sessionId)) {
|
|
62610
|
-
return;
|
|
62611
|
-
}
|
|
62612
|
-
this.archiveInFlight.add(sessionId);
|
|
62810
|
+
async handleSessionArchiveChanged(sessionId) {
|
|
62613
62811
|
try {
|
|
62614
|
-
await this.
|
|
62812
|
+
if (!await this.isSessionOwnedByThisMachine(sessionId)) return;
|
|
62813
|
+
const current = await this.workspaceDocument.repo.getDocMeta(getSessionRoomId(sessionId));
|
|
62814
|
+
if (!current?.meta || isLoroRepoDocDeleted(current)) return;
|
|
62815
|
+
if (current.meta.isArchived === true) {
|
|
62816
|
+
await this.releaseArchivedSessionRuntime(sessionId);
|
|
62817
|
+
} else {
|
|
62818
|
+
try {
|
|
62819
|
+
await this.sessionManager.syncNativeSessionArchive(sessionId, false);
|
|
62820
|
+
} catch (error) {
|
|
62821
|
+
this.sessionManager.reportNativeArchiveFailure(sessionId, error);
|
|
62822
|
+
}
|
|
62823
|
+
}
|
|
62615
62824
|
} catch (error) {
|
|
62616
62825
|
this.logger.error(
|
|
62617
|
-
`[${sessionId}]
|
|
62826
|
+
`[${sessionId}] Archive state reconciliation failed: ${formatErrorMessage(error)}`
|
|
62618
62827
|
);
|
|
62619
|
-
} finally {
|
|
62620
|
-
this.archiveInFlight.delete(sessionId);
|
|
62621
62828
|
}
|
|
62622
62829
|
void this.worktreeGc.schedule();
|
|
62623
62830
|
}
|
|
@@ -62639,16 +62846,20 @@ class MessageHandler {
|
|
|
62639
62846
|
await this.finalizeACPState(sessionId);
|
|
62640
62847
|
await this.previewService.closeSessionPreviewForCleanup(sessionId, "Session archived");
|
|
62641
62848
|
await this.terminateActiveChildSessions(sessionId, "Parent session archived");
|
|
62849
|
+
let releaseFailure;
|
|
62642
62850
|
if (this.sessionManager.hasSession(sessionId)) {
|
|
62643
62851
|
this.logger.debug(`[${sessionId}] Terminating active session`);
|
|
62644
|
-
await this.terminateSessionForRelease(sessionId);
|
|
62852
|
+
releaseFailure = await this.terminateSessionForRelease(sessionId);
|
|
62645
62853
|
if (options.writeIdleStatus !== false) {
|
|
62646
62854
|
await this.workspaceDocument.repo.upsertDocMeta(getSessionRoomId(sessionId), {
|
|
62647
62855
|
status: SessionStatusFactory.idle()
|
|
62648
62856
|
});
|
|
62649
62857
|
}
|
|
62650
62858
|
}
|
|
62651
|
-
await this.sessionManager.archiveSession(sessionId
|
|
62859
|
+
await this.sessionManager.archiveSession(sessionId, {
|
|
62860
|
+
releaseFailure,
|
|
62861
|
+
recordWarning: (warning) => this.recordAgentWarning(sessionId, warning)
|
|
62862
|
+
});
|
|
62652
62863
|
this.store.get(sessionId).logger = null;
|
|
62653
62864
|
this.logger.debug(`[${sessionId}] Archived session runtime released`);
|
|
62654
62865
|
}
|
|
@@ -62922,10 +63133,12 @@ class MessageHandler {
|
|
|
62922
63133
|
this.executionService.withdrawNativeWorkCompletion(sessionId);
|
|
62923
63134
|
try {
|
|
62924
63135
|
await this.sessionManager.terminateSession(sessionId, true);
|
|
63136
|
+
return void 0;
|
|
62925
63137
|
} catch (error) {
|
|
62926
63138
|
this.logger.warn(
|
|
62927
63139
|
`[${sessionId}] Releasing the session although its processes could not all be terminated: ${formatErrorMessage(error)}`
|
|
62928
63140
|
);
|
|
63141
|
+
return `Session processes could not all be terminated: ${formatErrorMessage(error)}`;
|
|
62929
63142
|
}
|
|
62930
63143
|
}
|
|
62931
63144
|
async terminateActiveChildSessions(parentSessionId, reason) {
|
|
@@ -63039,10 +63252,15 @@ class MessageHandler {
|
|
|
63039
63252
|
);
|
|
63040
63253
|
return;
|
|
63041
63254
|
}
|
|
63255
|
+
const isVisible = this.isVisibleACPUpdate(update2.update);
|
|
63042
63256
|
if (target.source === "finalized_turn") {
|
|
63043
|
-
|
|
63257
|
+
const reportsSessionActivity = this.sessionManager.getSession(sessionId)?.agentClient?.reportsSessionActivity() ?? false;
|
|
63258
|
+
if (reportsSessionActivity || isVisible) {
|
|
63044
63259
|
this.touchSession(sessionId);
|
|
63045
63260
|
}
|
|
63261
|
+
if (!reportsSessionActivity && isVisible) {
|
|
63262
|
+
this.sessionActivePresence.native.noteLateActivity(sessionId);
|
|
63263
|
+
}
|
|
63046
63264
|
this.captureACPUpdateInvariant(
|
|
63047
63265
|
"late_acp_update_routed_to_finalized_turn",
|
|
63048
63266
|
sessionId,
|
|
@@ -63054,7 +63272,7 @@ class MessageHandler {
|
|
|
63054
63272
|
);
|
|
63055
63273
|
}
|
|
63056
63274
|
const state = this.store.get(sessionId);
|
|
63057
|
-
this.recordTurnEvent(sessionId, target.turnEpoch,
|
|
63275
|
+
this.recordTurnEvent(sessionId, target.turnEpoch, isVisible);
|
|
63058
63276
|
state.acpUpdateBuffer.push({
|
|
63059
63277
|
operationId: v4(),
|
|
63060
63278
|
notification: update2,
|
|
@@ -63907,7 +64125,7 @@ class MessageHandler {
|
|
|
63907
64125
|
if (inFlight.length > 0) {
|
|
63908
64126
|
await Promise.allSettled(inFlight);
|
|
63909
64127
|
}
|
|
63910
|
-
for (let
|
|
64128
|
+
for (let round = 0; round < MessageHandler.CODE_COLLAB_EVIDENCE_MAX_AUTOMATIC_RETRIES; round += 1) {
|
|
63911
64129
|
const keys2 = /* @__PURE__ */ new Set([
|
|
63912
64130
|
...this.codeCollabV2TurnDiffs.keys(),
|
|
63913
64131
|
...this.codeCollabV2TurnEdits.keys()
|
|
@@ -63926,7 +64144,7 @@ class MessageHandler {
|
|
|
63926
64144
|
await this.persistCodeCollabTurnDiffs(sessionId, turnId);
|
|
63927
64145
|
} catch (error) {
|
|
63928
64146
|
this.logger.debug(
|
|
63929
|
-
`[${sessionId}] Cleanup retry ${
|
|
64147
|
+
`[${sessionId}] Cleanup retry ${round + 1} failed to persist Code Collab v2 evidence for turn ${turnId}: ${formatErrorMessage(error)}`
|
|
63930
64148
|
);
|
|
63931
64149
|
}
|
|
63932
64150
|
}
|
|
@@ -64065,6 +64283,7 @@ class MessageHandler {
|
|
|
64065
64283
|
}
|
|
64066
64284
|
clearSessionActivePresence(sessionId) {
|
|
64067
64285
|
this.sessionActivePresence.clearUnleased(sessionId);
|
|
64286
|
+
this.sessionActivePresence.native.clearLateActivity(sessionId);
|
|
64068
64287
|
}
|
|
64069
64288
|
createRuntimeDispatchContext() {
|
|
64070
64289
|
return {
|
|
@@ -64249,9 +64468,11 @@ class MessageHandler {
|
|
|
64249
64468
|
...this.sorbetCredentials ? {
|
|
64250
64469
|
sorbetCredentials: SORBET_CREDENTIALS_PROTOCOL_VERSION,
|
|
64251
64470
|
sorbetProviders: SORBET_PROVIDERS_PROTOCOL_VERSION,
|
|
64471
|
+
sorbetHostSettings: SORBET_HOST_SETTINGS_PROTOCOL_VERSION,
|
|
64252
64472
|
...this.encryptedAttachments ? {
|
|
64253
64473
|
sorbetCredentialsRemote: SORBET_CREDENTIALS_REMOTE_PROTOCOL_VERSION,
|
|
64254
|
-
sorbetProvidersRemote: SORBET_PROVIDERS_REMOTE_PROTOCOL_VERSION
|
|
64474
|
+
sorbetProvidersRemote: SORBET_PROVIDERS_REMOTE_PROTOCOL_VERSION,
|
|
64475
|
+
sorbetHostSettingsRemote: SORBET_HOST_SETTINGS_REMOTE_PROTOCOL_VERSION
|
|
64255
64476
|
} : {}
|
|
64256
64477
|
} : {},
|
|
64257
64478
|
...this.cloudPort.remoteAutomation ? { remoteAutomationControl: 1 } : {}
|
|
@@ -64883,9 +65104,9 @@ class MessageHandler {
|
|
|
64883
65104
|
throw new Error("e2ee_feature_unavailable");
|
|
64884
65105
|
if (!this.acpInteractionOwner) {
|
|
64885
65106
|
this.acpInteractionOwner = Promise.all([
|
|
64886
|
-
import("./acp-interaction-owner-
|
|
64887
|
-
import("./index-
|
|
64888
|
-
import("./index-
|
|
65107
|
+
import("./acp-interaction-owner-8OMcZVET.js"),
|
|
65108
|
+
import("./index-CvTdgB45.js"),
|
|
65109
|
+
import("./index-CzJfh76P.js")
|
|
64889
65110
|
]).then(
|
|
64890
65111
|
([{ createAcpInteractionOwner }, { createRpcSecretRecipient: createRpcSecretRecipient2, encryptRpcSecret: encryptRpcSecret2 }, shared]) => createAcpInteractionOwner({
|
|
64891
65112
|
workspaceId: this.workspaceId,
|
|
@@ -65130,9 +65351,33 @@ class MessageHandler {
|
|
|
65130
65351
|
case "sorbet/providers-update":
|
|
65131
65352
|
case "sorbet/providers-delete":
|
|
65132
65353
|
case "sorbet/providers-refresh":
|
|
65133
|
-
case "sorbet/models-list":
|
|
65354
|
+
case "sorbet/models-list":
|
|
65355
|
+
case "sorbet/host-settings-get":
|
|
65356
|
+
case "sorbet/host-settings-update": {
|
|
65134
65357
|
if (request.workspaceId !== this.workspaceId || request.machineId !== this.machineId || request.ownerSessionId)
|
|
65135
65358
|
throw new Error("Sorbet credentials scope mismatch");
|
|
65359
|
+
if (!this.sorbetCredentials) throw new Error("Sorbet credentials unsupported");
|
|
65360
|
+
const isHostSettings = request.method === "sorbet/host-settings-get" || request.method === "sorbet/host-settings-update";
|
|
65361
|
+
if (isHostSettings) {
|
|
65362
|
+
try {
|
|
65363
|
+
const { SorbetHostSettingsResultSchema } = await import("./local-ipc-BNwkKO5i.js").then((n) => n.c0);
|
|
65364
|
+
if (request.method === "sorbet/host-settings-get") {
|
|
65365
|
+
return SorbetHostSettingsResultSchema.parse({
|
|
65366
|
+
type: "sorbet/host-settings-get",
|
|
65367
|
+
settings: await this.sorbetCredentials.getHostSettings(signal)
|
|
65368
|
+
});
|
|
65369
|
+
}
|
|
65370
|
+
return SorbetHostSettingsResultSchema.parse({
|
|
65371
|
+
type: "sorbet/host-settings-update",
|
|
65372
|
+
settings: await this.sorbetCredentials.updateHostSettings(
|
|
65373
|
+
request.params.patch,
|
|
65374
|
+
signal
|
|
65375
|
+
)
|
|
65376
|
+
});
|
|
65377
|
+
} catch {
|
|
65378
|
+
throw new Error("Sorbet host settings operation failed");
|
|
65379
|
+
}
|
|
65380
|
+
}
|
|
65136
65381
|
const configId = request.params.configId;
|
|
65137
65382
|
const config = await this.workspaceDocument.getAgentConfigForMachineLaunch(
|
|
65138
65383
|
configId,
|
|
@@ -65140,9 +65385,8 @@ class MessageHandler {
|
|
|
65140
65385
|
);
|
|
65141
65386
|
if (!config || config.machineId !== this.machineId || config.cliType !== "builtin" || config.agentType !== "sorbet")
|
|
65142
65387
|
throw new Error("Sorbet credentials configuration unavailable");
|
|
65143
|
-
if (!this.sorbetCredentials) throw new Error("Sorbet credentials unsupported");
|
|
65144
65388
|
try {
|
|
65145
|
-
const { SorbetCredentialsResultSchema, SorbetProvidersResultSchema } = await import("./local-ipc-
|
|
65389
|
+
const { SorbetCredentialsResultSchema, SorbetProvidersResultSchema } = await import("./local-ipc-BNwkKO5i.js").then((n) => n.c0);
|
|
65146
65390
|
if (request.method === "sorbet/credentials-list") {
|
|
65147
65391
|
return SorbetCredentialsResultSchema.parse({
|
|
65148
65392
|
type: "sorbet/credentials-list",
|
|
@@ -65221,7 +65465,7 @@ class MessageHandler {
|
|
|
65221
65465
|
const { sessionId, name, arguments: args } = request.params;
|
|
65222
65466
|
if (request.workspaceId !== this.workspaceId || request.machineId !== this.machineId || request.ownerSessionId !== sessionId)
|
|
65223
65467
|
throw new Error("Session tool scope mismatch");
|
|
65224
|
-
const { executeDaemonSessionTool } = await import("./daemon-session-tools-
|
|
65468
|
+
const { executeDaemonSessionTool } = await import("./daemon-session-tools-CrxHUVDk.js");
|
|
65225
65469
|
const sourceWorkdir = this.resolveSessionWorkspaceRoot(sessionId);
|
|
65226
65470
|
if (!sourceWorkdir && args && typeof args === "object" && "attachments" in args)
|
|
65227
65471
|
throw new Error("Requester Session workspace is unavailable");
|
|
@@ -67223,7 +67467,7 @@ class MessageHandler {
|
|
|
67223
67467
|
"Stop all tasks on this daemon before restoring its identity."
|
|
67224
67468
|
);
|
|
67225
67469
|
}
|
|
67226
|
-
const { prepareMachineIdentityRestore, cancelPreparedMachineIdentityRestore } = await import("./machine-identity-restore-
|
|
67470
|
+
const { prepareMachineIdentityRestore, cancelPreparedMachineIdentityRestore } = await import("./machine-identity-restore-CYjkTQcN.js");
|
|
67227
67471
|
const prepared = await prepareMachineIdentityRestore({
|
|
67228
67472
|
workspaceId: this.workspaceId,
|
|
67229
67473
|
sourceMachineId: this.machineId,
|
|
@@ -68414,6 +68658,7 @@ class MessageHandler {
|
|
|
68414
68658
|
ok: true,
|
|
68415
68659
|
type: "local-project/list-global-skills",
|
|
68416
68660
|
result: await this.localProjectControlService.listGlobalSkills({
|
|
68661
|
+
magpieGatewayUrl: request.magpieGatewayUrl,
|
|
68417
68662
|
knownFingerprint: request.knownFingerprint
|
|
68418
68663
|
})
|
|
68419
68664
|
};
|
|
@@ -68867,7 +69112,7 @@ class MessageHandler {
|
|
|
68867
69112
|
* Check if a session is currently being archived.
|
|
68868
69113
|
*/
|
|
68869
69114
|
isArchiveInFlight(sessionId) {
|
|
68870
|
-
return this.
|
|
69115
|
+
return this.sessionManager.isArchiveInFlight(sessionId);
|
|
68871
69116
|
}
|
|
68872
69117
|
/**
|
|
68873
69118
|
* Work the native agent does outside Lody's turns (a background shell, or a
|
|
@@ -68876,7 +69121,7 @@ class MessageHandler {
|
|
|
68876
69121
|
getNativeWork(sessionId) {
|
|
68877
69122
|
const session = this.sessionManager.getSession(sessionId);
|
|
68878
69123
|
if (!session || session.hasLiveAgentProcess?.() === false) return null;
|
|
68879
|
-
return session.agentClient?.getNativeWork() ?? null;
|
|
69124
|
+
return session.agentClient?.getNativeWork() ?? (this.sessionActivePresence.native.hasLateActivity(sessionId) ? "running" : null);
|
|
68880
69125
|
}
|
|
68881
69126
|
/**
|
|
68882
69127
|
* Get the last activity timestamp for a session.
|
|
@@ -70230,6 +70475,26 @@ function createSorbetCredentialsHandler(document, machineId) {
|
|
|
70230
70475
|
} finally {
|
|
70231
70476
|
await control.close();
|
|
70232
70477
|
}
|
|
70478
|
+
},
|
|
70479
|
+
/**
|
|
70480
|
+
* Host settings live in the machine's Sorbet data directory, not on any
|
|
70481
|
+
* config, so they read and patch without the per-config credential check.
|
|
70482
|
+
*/
|
|
70483
|
+
async getHostSettings(signal) {
|
|
70484
|
+
const control = await openSorbetControl({ dataDirectory, signal });
|
|
70485
|
+
try {
|
|
70486
|
+
return await control.hostSettings.get({ signal });
|
|
70487
|
+
} finally {
|
|
70488
|
+
await control.close();
|
|
70489
|
+
}
|
|
70490
|
+
},
|
|
70491
|
+
async updateHostSettings(patch, signal) {
|
|
70492
|
+
const control = await openSorbetControl({ dataDirectory, signal });
|
|
70493
|
+
try {
|
|
70494
|
+
return await control.hostSettings.update(patch, { signal });
|
|
70495
|
+
} finally {
|
|
70496
|
+
await control.close();
|
|
70497
|
+
}
|
|
70233
70498
|
}
|
|
70234
70499
|
};
|
|
70235
70500
|
}
|
|
@@ -71965,6 +72230,7 @@ class SessionManager extends EventEmitter$1 {
|
|
|
71965
72230
|
throw new Error("SessionManager requires an assembled CloudPort");
|
|
71966
72231
|
}
|
|
71967
72232
|
this.cloudPort = options.cloudPort;
|
|
72233
|
+
this.syncAgentSessionArchive = options.syncAgentSessionArchive ?? setLocalAcpSessionArchived;
|
|
71968
72234
|
this.mcpAuthentication = new McpAuthenticationLegacy({
|
|
71969
72235
|
machineId,
|
|
71970
72236
|
workspaceId,
|
|
@@ -71991,6 +72257,11 @@ class SessionManager extends EventEmitter$1 {
|
|
|
71991
72257
|
// shared machine-wide budget. This avoids create/exit races briefly applying stale
|
|
71992
72258
|
// shares of the 90% execution-plane budget. See docs/exec-sandbox.md.
|
|
71993
72259
|
sandboxRebalanceChain = Promise.resolve();
|
|
72260
|
+
archiveObservations = /* @__PURE__ */ new Map();
|
|
72261
|
+
nativeArchiveJobs = /* @__PURE__ */ new Map();
|
|
72262
|
+
// Shutdown aborts archive transitions, whose ACP children do not belong to a Session.
|
|
72263
|
+
archiveTransitionLifetime = new AbortController();
|
|
72264
|
+
syncAgentSessionArchive;
|
|
71994
72265
|
requestPermissionHandler;
|
|
71995
72266
|
/**
|
|
71996
72267
|
* If a session is currently being created (worktree + ACP startup), callers should wait
|
|
@@ -72266,6 +72537,10 @@ class SessionManager extends EventEmitter$1 {
|
|
|
72266
72537
|
this.reportStartStage(config, "credentials");
|
|
72267
72538
|
await this.freezeCodexProfile(config);
|
|
72268
72539
|
signal?.throwIfAborted();
|
|
72540
|
+
if (config.sessionId && agentStart?.resumeSessionId && !agentStart.forkSessionId) {
|
|
72541
|
+
await this.archiveObservations.get(config.sessionId)?.done;
|
|
72542
|
+
signal?.throwIfAborted();
|
|
72543
|
+
}
|
|
72269
72544
|
const credentials = await this.prepareGitHubRepoSessionConfig(config);
|
|
72270
72545
|
let session;
|
|
72271
72546
|
let usageState = "starting";
|
|
@@ -73204,7 +73479,10 @@ class SessionManager extends EventEmitter$1 {
|
|
|
73204
73479
|
failures.push(error);
|
|
73205
73480
|
}
|
|
73206
73481
|
};
|
|
73207
|
-
await
|
|
73482
|
+
await Promise.all([
|
|
73483
|
+
attempt(() => this.cleanupSessions()),
|
|
73484
|
+
attempt(() => this.joinArchiveTransitions())
|
|
73485
|
+
]);
|
|
73208
73486
|
if (!options.keepWorkspaceDocumentOpen) {
|
|
73209
73487
|
await attempt(() => this.mcpAuthentication.close());
|
|
73210
73488
|
await attempt(() => this.workspaceDocument.cleanUp());
|
|
@@ -73310,9 +73588,156 @@ class SessionManager extends EventEmitter$1 {
|
|
|
73310
73588
|
}
|
|
73311
73589
|
return childSessionIds;
|
|
73312
73590
|
}
|
|
73313
|
-
|
|
73591
|
+
isArchiveInFlight(sessionId) {
|
|
73592
|
+
return this.archiveObservations.has(sessionId);
|
|
73593
|
+
}
|
|
73594
|
+
observeArchiveChange(sessionId, reconcile) {
|
|
73595
|
+
const existing = this.archiveObservations.get(sessionId);
|
|
73596
|
+
if (existing) {
|
|
73597
|
+
existing.repeat = true;
|
|
73598
|
+
return existing.done;
|
|
73599
|
+
}
|
|
73600
|
+
const observation = { repeat: false, done: Promise.resolve() };
|
|
73601
|
+
observation.done = Promise.resolve().then(async () => {
|
|
73602
|
+
try {
|
|
73603
|
+
do {
|
|
73604
|
+
observation.repeat = false;
|
|
73605
|
+
await reconcile();
|
|
73606
|
+
} while (observation.repeat);
|
|
73607
|
+
} finally {
|
|
73608
|
+
this.archiveObservations.delete(sessionId);
|
|
73609
|
+
}
|
|
73610
|
+
});
|
|
73611
|
+
this.archiveObservations.set(sessionId, observation);
|
|
73612
|
+
return observation.done;
|
|
73613
|
+
}
|
|
73614
|
+
/**
|
|
73615
|
+
* Native sync, its warning and the Lody document release form one transition,
|
|
73616
|
+
* so a restore queued behind it never receives a destroyed document.
|
|
73617
|
+
*/
|
|
73618
|
+
async archiveSession(sessionId, options = {}) {
|
|
73619
|
+
await this.enqueueArchiveTransition(sessionId, void 0, async (signal) => {
|
|
73620
|
+
let warning;
|
|
73621
|
+
try {
|
|
73622
|
+
warning = options.releaseFailure ? this.nativeArchiveFailureWarning(sessionId, options.releaseFailure) : await this.applyNativeSessionArchive(sessionId, true, signal);
|
|
73623
|
+
} catch (error) {
|
|
73624
|
+
warning = this.nativeArchiveFailureWarning(sessionId, error);
|
|
73625
|
+
}
|
|
73626
|
+
try {
|
|
73627
|
+
if (warning) await options.recordWarning?.(warning);
|
|
73628
|
+
} finally {
|
|
73629
|
+
await this.cleanArchivedSessionDoc(sessionId);
|
|
73630
|
+
}
|
|
73631
|
+
});
|
|
73632
|
+
}
|
|
73633
|
+
async syncNativeSessionArchive(sessionId, archived, signal) {
|
|
73634
|
+
return await this.enqueueArchiveTransition(
|
|
73635
|
+
sessionId,
|
|
73636
|
+
signal,
|
|
73637
|
+
(transitionSignal) => this.applyNativeSessionArchive(sessionId, archived, transitionSignal)
|
|
73638
|
+
);
|
|
73639
|
+
}
|
|
73640
|
+
enqueueArchiveTransition(sessionId, signal, run2) {
|
|
73641
|
+
const lifetime = this.archiveTransitionLifetime.signal;
|
|
73642
|
+
const transitionSignal = signal ? AbortSignal.any([lifetime, signal]) : lifetime;
|
|
73643
|
+
const previous = this.nativeArchiveJobs.get(sessionId) ?? Promise.resolve();
|
|
73644
|
+
const next2 = previous.catch(() => {
|
|
73645
|
+
}).then(() => run2(transitionSignal));
|
|
73646
|
+
this.nativeArchiveJobs.set(sessionId, next2);
|
|
73647
|
+
void next2.finally(() => {
|
|
73648
|
+
if (this.nativeArchiveJobs.get(sessionId) === next2)
|
|
73649
|
+
this.nativeArchiveJobs.delete(sessionId);
|
|
73650
|
+
}).catch(() => void 0);
|
|
73651
|
+
return next2;
|
|
73652
|
+
}
|
|
73653
|
+
async cleanArchivedSessionDoc(sessionId) {
|
|
73654
|
+
const snapshot = await this.workspaceDocument.repo.getDocMeta(getSessionRoomId(sessionId));
|
|
73655
|
+
const meta = snapshot?.meta;
|
|
73656
|
+
if (meta && !isLoroRepoDocDeleted(snapshot) && meta.isArchived !== true) {
|
|
73657
|
+
this.logger.debug(`[${sessionId}] Archive superseded by restore; keeping session document`);
|
|
73658
|
+
return;
|
|
73659
|
+
}
|
|
73314
73660
|
await this.workspaceDocument.cleanSessionDoc(sessionId);
|
|
73315
73661
|
}
|
|
73662
|
+
/** Cancels archive transitions and waits for their ACP process cleanup. */
|
|
73663
|
+
async joinArchiveTransitions() {
|
|
73664
|
+
this.archiveTransitionLifetime.abort();
|
|
73665
|
+
const transitions = [
|
|
73666
|
+
...this.nativeArchiveJobs.values(),
|
|
73667
|
+
...Array.from(this.archiveObservations.values(), ({ done: done2 }) => done2)
|
|
73668
|
+
];
|
|
73669
|
+
if (!transitions.length) return;
|
|
73670
|
+
await withTimeout$2(
|
|
73671
|
+
Promise.allSettled(transitions),
|
|
73672
|
+
TURN_BUDGETS.agentCleanupMs,
|
|
73673
|
+
"Agent archive synchronization did not stop after shutdown cancellation"
|
|
73674
|
+
);
|
|
73675
|
+
}
|
|
73676
|
+
async applyNativeSessionArchive(sessionId, archived, signal) {
|
|
73677
|
+
const snapshot = await this.workspaceDocument.repo.getDocMeta(getSessionRoomId(sessionId));
|
|
73678
|
+
const meta = snapshot?.meta;
|
|
73679
|
+
if (!meta || isLoroRepoDocDeleted(snapshot) || meta.machineId !== this.machineId) return;
|
|
73680
|
+
if (meta.isArchived === true !== archived || !meta.agentConfigId) return;
|
|
73681
|
+
const nativeSessionId = resolveSessionAcpTargetId(meta);
|
|
73682
|
+
if (!nativeSessionId) return;
|
|
73683
|
+
const provider = await this.workspaceDocument.getAgentConfigById(
|
|
73684
|
+
meta.agentConfigId,
|
|
73685
|
+
this.machineId
|
|
73686
|
+
);
|
|
73687
|
+
if (!provider || provider.id !== meta.agentConfigId || provider.machineId !== this.machineId)
|
|
73688
|
+
return;
|
|
73689
|
+
const profiles = getCodexProfileStore();
|
|
73690
|
+
const codex = provider.cliType === "builtin" && provider.agentType === "codex";
|
|
73691
|
+
if (codex && !provider.codexAuth && await profiles.isAccountBound({
|
|
73692
|
+
workspaceId: this.workspaceId,
|
|
73693
|
+
machineId: this.machineId,
|
|
73694
|
+
configId: provider.id
|
|
73695
|
+
}))
|
|
73696
|
+
throw new Error("This Codex provider account reference is missing");
|
|
73697
|
+
const profile = codex ? await profiles.resolve(this.workspaceId, provider) : void 0;
|
|
73698
|
+
const result2 = await this.syncAgentSessionArchive({
|
|
73699
|
+
cliType: provider.cliType,
|
|
73700
|
+
agentType: provider.agentType,
|
|
73701
|
+
customAcp: provider.customAcp,
|
|
73702
|
+
runtimeOverrides: provider.runtimeOverrides,
|
|
73703
|
+
agentConfigId: provider.id,
|
|
73704
|
+
magpieGatewayUrl: provider.magpieGatewayUrl,
|
|
73705
|
+
codexProfile: profile ? { profile } : void 0,
|
|
73706
|
+
env: withoutElectronBootstrapCredentials({ ...process.env, ...provider.env }),
|
|
73707
|
+
nativeSessionId,
|
|
73708
|
+
archived,
|
|
73709
|
+
signal,
|
|
73710
|
+
logger: this.logger,
|
|
73711
|
+
shouldApply: async () => {
|
|
73712
|
+
const current = await this.workspaceDocument.repo.getDocMeta(getSessionRoomId(sessionId));
|
|
73713
|
+
const latest = current?.meta;
|
|
73714
|
+
return !isLoroRepoDocDeleted(current) && latest?.machineId === this.machineId && latest.agentConfigId === provider.id && latest.isArchived === true === archived && resolveSessionAcpTargetId(latest) === nativeSessionId;
|
|
73715
|
+
}
|
|
73716
|
+
});
|
|
73717
|
+
if (archived && result2 === "unsupported")
|
|
73718
|
+
return {
|
|
73719
|
+
source: "native-session-archive",
|
|
73720
|
+
message: "This agent does not advertise archive synchronization. The conversation is archived in Lody only."
|
|
73721
|
+
};
|
|
73722
|
+
if (archived && result2 === "title-marker")
|
|
73723
|
+
return {
|
|
73724
|
+
source: "native-session-archive",
|
|
73725
|
+
message: "The agent marked its native session title as archived. The session may still appear in its native history picker."
|
|
73726
|
+
};
|
|
73727
|
+
return void 0;
|
|
73728
|
+
}
|
|
73729
|
+
reportNativeArchiveFailure(sessionId, error) {
|
|
73730
|
+
this.emit("onAgentWarning", sessionId, this.nativeArchiveFailureWarning(sessionId, error));
|
|
73731
|
+
}
|
|
73732
|
+
nativeArchiveFailureWarning(sessionId, error) {
|
|
73733
|
+
this.logger.warn(
|
|
73734
|
+
`[${sessionId}] Native session archive synchronization failed: ${formatErrorMessage(error)}`
|
|
73735
|
+
);
|
|
73736
|
+
return {
|
|
73737
|
+
source: "native-session-archive",
|
|
73738
|
+
message: "Agent archive synchronization failed. The Lody archive state is unchanged. Restore and archive the conversation again to retry."
|
|
73739
|
+
};
|
|
73740
|
+
}
|
|
73316
73741
|
/**
|
|
73317
73742
|
* Invalidate cached GitHub token for a specific repo.
|
|
73318
73743
|
* Called when an auth failure is detected to force a fresh token fetch on retry.
|
|
@@ -77217,7 +77642,7 @@ const createNodeServicesForLease = async (sessionDoc, lease) => {
|
|
|
77217
77642
|
if (!await dispatchIndex().checkpoint(cursor, 0))
|
|
77218
77643
|
await rebuildDispatchIndex(dispatchIndex(), cursor);
|
|
77219
77644
|
}
|
|
77220
|
-
const { createRoostSessionData } = await import("./index-
|
|
77645
|
+
const { createRoostSessionData } = await import("./index-CbO2HBCx.js");
|
|
77221
77646
|
syncModelSummary = async () => {
|
|
77222
77647
|
const position = latestModelTurnId ? positionById.get(latestModelTurnId) : void 0;
|
|
77223
77648
|
const cached2 = position === void 0 ? void 0 : entries[position];
|
|
@@ -79069,7 +79494,7 @@ class Lody {
|
|
|
79069
79494
|
e2ee = options.encryptedWorkspace;
|
|
79070
79495
|
e2ee.adopt(callbacks);
|
|
79071
79496
|
} else {
|
|
79072
|
-
const { openCliE2eeWorkspaceLegacy } = await import("./workspace-legacy-
|
|
79497
|
+
const { openCliE2eeWorkspaceLegacy } = await import("./workspace-legacy-DJAko-Yj.js").then((n) => n.b_);
|
|
79073
79498
|
e2ee = await openCliE2eeWorkspaceLegacy({
|
|
79074
79499
|
machineId: options.machineId,
|
|
79075
79500
|
accountId: options.userId,
|
|
@@ -79090,8 +79515,8 @@ class Lody {
|
|
|
79090
79515
|
if (e2ee) {
|
|
79091
79516
|
if (!options.genesisHash) throw new Error("e2ee_workspace_unavailable");
|
|
79092
79517
|
const { join: join2 } = await import("node:path");
|
|
79093
|
-
const { Effect } = await import("./chunks/vendor-effect-
|
|
79094
|
-
const { makeEncryptedAgentExecution, lazyExecutionJournal } = await import("./agent-execution-
|
|
79518
|
+
const { Effect } = await import("./chunks/vendor-effect-BTVRmkqM.js").then((n) => n.eN);
|
|
79519
|
+
const { makeEncryptedAgentExecution, lazyExecutionJournal } = await import("./agent-execution-ZTPT3A88.js");
|
|
79095
79520
|
encryptedExecution = makeEncryptedAgentExecution({
|
|
79096
79521
|
genesis: options.genesisHash,
|
|
79097
79522
|
workspaceId: options.workspaceId,
|
|
@@ -79971,6 +80396,8 @@ function createLodyPrPollerWorkspace(options) {
|
|
|
79971
80396
|
machineId,
|
|
79972
80397
|
recordObservations: options.recordObservations,
|
|
79973
80398
|
workflowObservationOwners: options.workflowObservationOwners,
|
|
80399
|
+
deliveryObservationOwners: options.deliveryObservationOwners,
|
|
80400
|
+
onPullRequestMetaWritten: options.onPullRequestMetaWritten,
|
|
79974
80401
|
recordWorkflowObservations: options.recordWorkflowObservations,
|
|
79975
80402
|
async listAliveSessionMetas() {
|
|
79976
80403
|
const rows = await listAliveSessionMetas(documentManager);
|
|
@@ -80549,6 +80976,7 @@ function computePrPollMetaSignature(meta, resolveGitHubRepo = defaultResolveGitH
|
|
|
80549
80976
|
])
|
|
80550
80977
|
),
|
|
80551
80978
|
meta.isArchived ? "1" : "0",
|
|
80979
|
+
meta.autoDelivery ? "1" : "0",
|
|
80552
80980
|
meta.lastMessageAt ?? "",
|
|
80553
80981
|
resolveDiscoveryBranch(meta) ?? "",
|
|
80554
80982
|
resolveGitHubRepo(meta) ?? "",
|
|
@@ -81537,8 +81965,10 @@ class PrPollScheduler {
|
|
|
81537
81965
|
highOwnerCap: config.highOwnerCap
|
|
81538
81966
|
});
|
|
81539
81967
|
const workflowOwners = runtime.handle.workflowObservationOwners?.();
|
|
81968
|
+
const deliveryOwners = runtime.handle.deliveryObservationOwners?.();
|
|
81540
81969
|
for (const entry of runtime.entries) {
|
|
81541
|
-
const
|
|
81970
|
+
const deliveryDemand = deliveryOwners?.has(entry.ownerSessionId) ?? false;
|
|
81971
|
+
const lane = deliveryDemand || highOwners.has(entry.ownerSessionId) ? "high" : "low";
|
|
81542
81972
|
const workflowDemand = workflowOwners?.has(entry.ownerSessionId) ?? false;
|
|
81543
81973
|
const ownerMeta = runtime.sessionMetas.get(entry.ownerSessionId)?.meta;
|
|
81544
81974
|
const statusTargets = ownerMeta && workflowDemand ? collectStatusTargets(ownerMeta, true) : entry.statusTargets;
|
|
@@ -82354,6 +82784,7 @@ class PrPollScheduler {
|
|
|
82354
82784
|
patch.pullRequestState = plan.pullRequestState;
|
|
82355
82785
|
}
|
|
82356
82786
|
await runtime.handle.writeOwnerMeta(ownerSessionId, patch);
|
|
82787
|
+
await runtime.handle.onPullRequestMetaWritten?.();
|
|
82357
82788
|
this.counters.corrections += plan.changedStatusUrls.length;
|
|
82358
82789
|
for (const url of plan.changedStatusUrls) {
|
|
82359
82790
|
logger.debug(
|
|
@@ -83533,7 +83964,7 @@ async function createScheduleWorkspace(args) {
|
|
|
83533
83964
|
await resolveTarget(run2);
|
|
83534
83965
|
},
|
|
83535
83966
|
prepare: async (run2) => {
|
|
83536
|
-
const { prepareSessionInput: prepareSessionInput2, resolveTurnDispatchConfig } = await import("./session-
|
|
83967
|
+
const { prepareSessionInput: prepareSessionInput2, resolveTurnDispatchConfig } = await import("./session-C6dNbMjx.js").then((n) => n.X);
|
|
83537
83968
|
const target = await resolveTarget(run2);
|
|
83538
83969
|
const agent = await resolveScheduleAgentRunConfig(
|
|
83539
83970
|
manager,
|
|
@@ -85004,62 +85435,119 @@ class AutomationLedger {
|
|
|
85004
85435
|
}
|
|
85005
85436
|
}
|
|
85006
85437
|
const pullRequestCheckpointId = (sessionId, url) => automationIdentity("github.pr", sessionId, url);
|
|
85007
|
-
function
|
|
85008
|
-
|
|
85009
|
-
const
|
|
85010
|
-
|
|
85011
|
-
|
|
85012
|
-
if (
|
|
85013
|
-
|
|
85014
|
-
|
|
85015
|
-
|
|
85016
|
-
|
|
85438
|
+
function inferPullRequestProvider(url) {
|
|
85439
|
+
try {
|
|
85440
|
+
const host = new URL(url).hostname.toLowerCase();
|
|
85441
|
+
if (host === "github.com" || host.endsWith(".github.com")) return "github";
|
|
85442
|
+
if (host === "gitlab.com" || host.includes("gitlab")) return "gitlab";
|
|
85443
|
+
if (url.includes("/-/merge_requests/")) return "gitlab";
|
|
85444
|
+
return "other";
|
|
85445
|
+
} catch {
|
|
85446
|
+
return "other";
|
|
85447
|
+
}
|
|
85448
|
+
}
|
|
85449
|
+
function mapGitHubCiState(ciState) {
|
|
85450
|
+
if (ciState === "s") return "passed";
|
|
85451
|
+
if (ciState === "f" || ciState === "e") return "failed";
|
|
85452
|
+
if (ciState === "p" || ciState === "x") return "pending";
|
|
85453
|
+
return "none";
|
|
85454
|
+
}
|
|
85455
|
+
function mapGitHubMergeState(mergeState) {
|
|
85456
|
+
if (mergeState === "c" || mergeState === "u") return "clean";
|
|
85457
|
+
if (mergeState === "d") return "conflicts";
|
|
85458
|
+
if (mergeState === "h") return "behind";
|
|
85459
|
+
if (mergeState === "b") return "blocked";
|
|
85460
|
+
return "unknown";
|
|
85461
|
+
}
|
|
85462
|
+
function observeNormalizedPullRequest(ledger, meta, observation, extra) {
|
|
85463
|
+
const checkpointId = pullRequestCheckpointId(meta.id, observation.url);
|
|
85464
|
+
const previous = ledger.checkpoint(checkpointId);
|
|
85465
|
+
const providerUpdatedAt = observation.providerUpdatedAt ?? observation.observedAt;
|
|
85466
|
+
if (!Number.isFinite(providerUpdatedAt) || typeof previous?.data.providerUpdatedAt === "number" && previous.data.providerUpdatedAt > providerUpdatedAt)
|
|
85467
|
+
return;
|
|
85468
|
+
const changed = previous && previous.data.status !== observation.status;
|
|
85469
|
+
const updatedKey = extra?.updatedAtRaw ?? String(providerUpdatedAt);
|
|
85470
|
+
const repoFullName = observation.repoFullName ?? observation.url;
|
|
85471
|
+
const prNumber = observation.number ?? 0;
|
|
85472
|
+
ledger.observe(
|
|
85473
|
+
checkpointId,
|
|
85474
|
+
{
|
|
85475
|
+
revision: `${updatedKey}:${observation.status}:${observation.headSha ?? ""}:${observation.checks}:${observation.mergeability}`,
|
|
85476
|
+
observedAt: observation.observedAt,
|
|
85477
|
+
data: {
|
|
85478
|
+
provider: observation.provider,
|
|
85479
|
+
status: observation.status,
|
|
85480
|
+
providerUpdatedAt,
|
|
85481
|
+
...observation.repoFullName ? { repoFullName: observation.repoFullName } : {},
|
|
85482
|
+
prUrl: observation.url,
|
|
85483
|
+
...observation.number !== void 0 ? { prNumber: observation.number } : {},
|
|
85484
|
+
...observation.branch ? { branch: observation.branch } : {},
|
|
85485
|
+
headSha: observation.headSha ?? null,
|
|
85486
|
+
headRepository: observation.headRepository ?? null,
|
|
85487
|
+
checks: observation.checks,
|
|
85488
|
+
mergeability: observation.mergeability,
|
|
85489
|
+
...extra?.ciState !== void 0 ? { ciState: extra.ciState } : {},
|
|
85490
|
+
...extra?.mergeState !== void 0 ? { mergeState: extra.mergeState } : {}
|
|
85491
|
+
}
|
|
85492
|
+
},
|
|
85493
|
+
changed ? [
|
|
85017
85494
|
{
|
|
85018
|
-
|
|
85019
|
-
|
|
85020
|
-
|
|
85495
|
+
id: `${meta.id}:${prNumber}:${updatedKey}:${observation.status}`,
|
|
85496
|
+
source: `${observation.provider}/repo/${repoFullName}`,
|
|
85497
|
+
type: `github.pr.${observation.status}`,
|
|
85498
|
+
version: 1,
|
|
85499
|
+
subject: `pr/${prNumber}`,
|
|
85500
|
+
occurredAt: providerUpdatedAt,
|
|
85501
|
+
observedAt: observation.observedAt,
|
|
85502
|
+
scope: {
|
|
85503
|
+
workspaceId: ledger.workspaceId,
|
|
85504
|
+
sessionId: meta.id,
|
|
85505
|
+
...meta.project?.kind === "local" ? { projectId: meta.project.localProjectId } : {}
|
|
85506
|
+
},
|
|
85021
85507
|
data: {
|
|
85022
|
-
|
|
85023
|
-
providerUpdatedAt,
|
|
85508
|
+
provider: observation.provider,
|
|
85024
85509
|
repoFullName,
|
|
85025
85510
|
prUrl: observation.url,
|
|
85026
|
-
prNumber
|
|
85027
|
-
|
|
85511
|
+
prNumber,
|
|
85512
|
+
status: observation.status,
|
|
85513
|
+
branch: observation.branch ?? null,
|
|
85028
85514
|
headSha: observation.headSha ?? null,
|
|
85029
|
-
headRepository: observation.headRepository ?? null
|
|
85030
|
-
|
|
85031
|
-
|
|
85032
|
-
|
|
85515
|
+
headRepository: observation.headRepository ?? null
|
|
85516
|
+
},
|
|
85517
|
+
provenance: "poll",
|
|
85518
|
+
completeness: previous && observation.observedAt - previous.observedAt > 10 * 6e4 ? "gap" : "observed",
|
|
85519
|
+
correlationId: `${observation.provider}/repo/${repoFullName}/pr/${prNumber}`,
|
|
85520
|
+
depth: 0
|
|
85521
|
+
}
|
|
85522
|
+
] : []
|
|
85523
|
+
);
|
|
85524
|
+
}
|
|
85525
|
+
function observePullRequests(ledger, meta, repoFullName, observations, now) {
|
|
85526
|
+
for (const observation of observations) {
|
|
85527
|
+
const providerUpdatedAt = Date.parse(observation.updatedAt);
|
|
85528
|
+
if (!Number.isFinite(providerUpdatedAt)) continue;
|
|
85529
|
+
observeNormalizedPullRequest(
|
|
85530
|
+
ledger,
|
|
85531
|
+
meta,
|
|
85532
|
+
{
|
|
85533
|
+
provider: "github",
|
|
85534
|
+
url: observation.url,
|
|
85535
|
+
repoFullName,
|
|
85536
|
+
number: observation.number,
|
|
85537
|
+
status: observation.status,
|
|
85538
|
+
...observation.headSha ? { headSha: observation.headSha } : {},
|
|
85539
|
+
branch: observation.headRefName,
|
|
85540
|
+
...observation.headRepository ? { headRepository: observation.headRepository } : {},
|
|
85541
|
+
checks: mapGitHubCiState(observation.ciState),
|
|
85542
|
+
mergeability: mapGitHubMergeState(observation.mergeState),
|
|
85543
|
+
observedAt: now,
|
|
85544
|
+
providerUpdatedAt
|
|
85033
85545
|
},
|
|
85034
|
-
|
|
85035
|
-
|
|
85036
|
-
|
|
85037
|
-
|
|
85038
|
-
|
|
85039
|
-
version: 1,
|
|
85040
|
-
subject: `pr/${observation.number}`,
|
|
85041
|
-
occurredAt: providerUpdatedAt,
|
|
85042
|
-
observedAt: now,
|
|
85043
|
-
scope: {
|
|
85044
|
-
workspaceId: ledger.workspaceId,
|
|
85045
|
-
sessionId: meta.id,
|
|
85046
|
-
...meta.project?.kind === "local" ? { projectId: meta.project.localProjectId } : {}
|
|
85047
|
-
},
|
|
85048
|
-
data: {
|
|
85049
|
-
repoFullName,
|
|
85050
|
-
prUrl: observation.url,
|
|
85051
|
-
prNumber: observation.number,
|
|
85052
|
-
status: observation.status,
|
|
85053
|
-
branch: observation.headRefName,
|
|
85054
|
-
headSha: observation.headSha ?? null,
|
|
85055
|
-
headRepository: observation.headRepository ?? null
|
|
85056
|
-
},
|
|
85057
|
-
provenance: "poll",
|
|
85058
|
-
completeness: previous && now - previous.observedAt > 10 * 6e4 ? "gap" : "observed",
|
|
85059
|
-
correlationId: `github/repo/${repoFullName}/pr/${observation.number}`,
|
|
85060
|
-
depth: 0
|
|
85061
|
-
}
|
|
85062
|
-
] : []
|
|
85546
|
+
{
|
|
85547
|
+
ciState: observation.ciState,
|
|
85548
|
+
mergeState: observation.mergeState,
|
|
85549
|
+
updatedAtRaw: observation.updatedAt
|
|
85550
|
+
}
|
|
85063
85551
|
);
|
|
85064
85552
|
}
|
|
85065
85553
|
}
|
|
@@ -85551,70 +86039,151 @@ const DELIVERY_ATTEMPT_LIMIT = 3;
|
|
|
85551
86039
|
const DELIVERY_PR_CREATION_GRACE_MS = 10 * 6e4;
|
|
85552
86040
|
const DELIVERY_CI_REPORT_GRACE_MS = 5 * 6e4;
|
|
85553
86041
|
const stepState = (step) => step === "create_pr" ? "pr" : step === "fix_ci" ? "fix" : step === "resolve_conflicts" ? "conflict" : "merge";
|
|
86042
|
+
const emptyAttempts = () => ({
|
|
86043
|
+
fixHeads: [],
|
|
86044
|
+
conflictHeads: [],
|
|
86045
|
+
mergeHeads: []
|
|
86046
|
+
});
|
|
86047
|
+
function readPrAttempts(progress, url) {
|
|
86048
|
+
const existing = progress.prAttempts?.[url];
|
|
86049
|
+
if (existing) {
|
|
86050
|
+
return {
|
|
86051
|
+
fixHeads: [...existing.fixHeads],
|
|
86052
|
+
conflictHeads: [...existing.conflictHeads],
|
|
86053
|
+
mergeHeads: [...existing.mergeHeads],
|
|
86054
|
+
...existing.unreportedCi ? { unreportedCi: { ...existing.unreportedCi } } : {}
|
|
86055
|
+
};
|
|
86056
|
+
}
|
|
86057
|
+
if (progress.prUrl === url) {
|
|
86058
|
+
return {
|
|
86059
|
+
fixHeads: [...progress.fixHeads],
|
|
86060
|
+
conflictHeads: [...progress.conflictHeads],
|
|
86061
|
+
mergeHeads: [...progress.mergeHeads],
|
|
86062
|
+
...progress.unreportedCi ? { unreportedCi: { ...progress.unreportedCi } } : {}
|
|
86063
|
+
};
|
|
86064
|
+
}
|
|
86065
|
+
return emptyAttempts();
|
|
86066
|
+
}
|
|
86067
|
+
function writePrAttempts(progress, url, attempts) {
|
|
86068
|
+
progress.prAttempts = { ...progress.prAttempts ?? {}, [url]: attempts };
|
|
86069
|
+
progress.fixHeads = [...attempts.fixHeads];
|
|
86070
|
+
progress.conflictHeads = [...attempts.conflictHeads];
|
|
86071
|
+
progress.mergeHeads = [...attempts.mergeHeads];
|
|
86072
|
+
progress.unreportedCi = attempts.unreportedCi;
|
|
86073
|
+
}
|
|
85554
86074
|
function decideDelivery(input) {
|
|
85555
86075
|
const { options, now } = input;
|
|
85556
|
-
const progress = {
|
|
85557
|
-
|
|
85558
|
-
|
|
85559
|
-
|
|
86076
|
+
const progress = {
|
|
86077
|
+
...input.progress,
|
|
86078
|
+
...input.progress.prUrls ? { prUrls: [...input.progress.prUrls] } : {},
|
|
86079
|
+
...input.progress.prAttempts ? { prAttempts: { ...input.progress.prAttempts } } : {}
|
|
86080
|
+
};
|
|
86081
|
+
const lookupPr = (url) => {
|
|
86082
|
+
if (!url) return void 0;
|
|
86083
|
+
if (input.prs?.[url]) return input.prs[url];
|
|
86084
|
+
if (input.pr && input.pr.url === url) return input.pr;
|
|
86085
|
+
return void 0;
|
|
86086
|
+
};
|
|
86087
|
+
const prPosition = (url) => {
|
|
86088
|
+
const total = progress.prUrls?.length ?? 0;
|
|
86089
|
+
if (total <= 1 || !url) return {};
|
|
86090
|
+
const index2 = progress.prUrls.indexOf(url);
|
|
86091
|
+
return index2 >= 0 ? { prIndex: index2 + 1, prTotal: total } : { prTotal: total };
|
|
86092
|
+
};
|
|
86093
|
+
const statusFor = (url, state, extra = {}) => ({
|
|
86094
|
+
status: { state, ...url ? { prUrl: url } : {}, ...prPosition(url), ...extra },
|
|
85560
86095
|
progress
|
|
85561
86096
|
});
|
|
85562
|
-
const stalled = (reason) => status("stalled", { reason });
|
|
85563
|
-
const request = (step, pr2, attempt) => ({
|
|
85564
|
-
...status(stepState(step), attempt ? { attempt } : {}),
|
|
85565
|
-
step: { step, ...attempt ? { attempt } : {}, ...pr2 ? { pr: pr2 } : {} }
|
|
85566
|
-
});
|
|
85567
86097
|
const last = progress.lastStep;
|
|
85568
86098
|
if (last && input.lastStep?.state === "outstanding")
|
|
85569
|
-
return
|
|
85570
|
-
|
|
85571
|
-
|
|
86099
|
+
return statusFor(
|
|
86100
|
+
last.prUrl ?? progress.prUrl,
|
|
86101
|
+
stepState(last.step),
|
|
86102
|
+
last.attempt ? { attempt: last.attempt } : {}
|
|
86103
|
+
);
|
|
86104
|
+
if (input.lastStep?.state === "stopped")
|
|
86105
|
+
return statusFor(last?.prUrl ?? progress.prUrl, "stalled", { reason: "stopped" });
|
|
86106
|
+
if (input.lastStep?.state === "failed")
|
|
86107
|
+
return statusFor(last?.prUrl ?? progress.prUrl, "stalled", { reason: "request_failed" });
|
|
85572
86108
|
const settledAt = input.lastStep?.state === "settled" ? input.lastStep.at : void 0;
|
|
85573
|
-
if (!progress.
|
|
85574
|
-
if (
|
|
85575
|
-
|
|
85576
|
-
if (
|
|
85577
|
-
|
|
86109
|
+
if (!progress.prUrls?.length) {
|
|
86110
|
+
if (progress.prUrl) {
|
|
86111
|
+
progress.prUrls = [progress.prUrl];
|
|
86112
|
+
} else if (input.candidates.length > 0) {
|
|
86113
|
+
progress.prUrls = [...input.candidates];
|
|
86114
|
+
progress.prUrl = input.candidates[0];
|
|
86115
|
+
} else if (!progress.createRequested) {
|
|
85578
86116
|
progress.createRequested = true;
|
|
85579
|
-
return
|
|
85580
|
-
|
|
85581
|
-
|
|
85582
|
-
|
|
86117
|
+
return {
|
|
86118
|
+
...statusFor(void 0, "pr"),
|
|
86119
|
+
step: { step: "create_pr" }
|
|
86120
|
+
};
|
|
86121
|
+
} else if (settledAt !== void 0 && now - settledAt > DELIVERY_PR_CREATION_GRACE_MS) {
|
|
86122
|
+
return statusFor(void 0, "stalled", { reason: "pr_not_created" });
|
|
86123
|
+
} else {
|
|
86124
|
+
return statusFor(void 0, "pr");
|
|
86125
|
+
}
|
|
85583
86126
|
}
|
|
85584
|
-
const
|
|
85585
|
-
|
|
86127
|
+
const queue = progress.prUrls ?? (progress.prUrl ? [progress.prUrl] : []);
|
|
86128
|
+
let activeUrl = progress.prUrl && queue.includes(progress.prUrl) ? progress.prUrl : queue[0];
|
|
86129
|
+
let pr = lookupPr(activeUrl);
|
|
86130
|
+
if (pr?.status === "merged") {
|
|
86131
|
+
const nextUrl = queue.find((url) => lookupPr(url)?.status !== "merged");
|
|
86132
|
+
if (!nextUrl) {
|
|
86133
|
+
return { ...statusFor(activeUrl, "merged"), finished: true };
|
|
86134
|
+
}
|
|
86135
|
+
activeUrl = nextUrl;
|
|
86136
|
+
progress.prUrl = nextUrl;
|
|
86137
|
+
pr = lookupPr(activeUrl);
|
|
86138
|
+
} else if (activeUrl) {
|
|
86139
|
+
progress.prUrl = activeUrl;
|
|
86140
|
+
}
|
|
86141
|
+
const status = (state, extra = {}) => statusFor(activeUrl, state, extra);
|
|
86142
|
+
const stalled = (reason) => status("stalled", { reason });
|
|
86143
|
+
const request = (step, targetPr, attempt) => ({
|
|
86144
|
+
...status(stepState(step), attempt ? { attempt } : {}),
|
|
86145
|
+
step: { step, ...attempt ? { attempt } : {}, ...targetPr ? { pr: targetPr } : {} }
|
|
86146
|
+
});
|
|
86147
|
+
if (!activeUrl || !pr || pr.url !== activeUrl) return status("ci");
|
|
85586
86148
|
if (pr.status === "merged") return { ...status("merged"), finished: true };
|
|
85587
86149
|
if (pr.status === "closed") return stalled("pr_closed");
|
|
85588
86150
|
if (pr.status === "draft") return stalled("pr_draft");
|
|
85589
|
-
|
|
86151
|
+
const lastStepForActive = !last?.prUrl || last.prUrl === activeUrl;
|
|
86152
|
+
if (!pr.headSha || lastStepForActive && settledAt !== void 0 && pr.observedAt <= settledAt)
|
|
86153
|
+
return status("ci");
|
|
85590
86154
|
if (input.workspacePending) return stalled("workspace_unpushed");
|
|
85591
86155
|
const head = pr.headSha;
|
|
85592
|
-
|
|
86156
|
+
const attempts = readPrAttempts(progress, activeUrl);
|
|
86157
|
+
if (pr.mergeability === "conflicts") {
|
|
85593
86158
|
if (!options.resolveConflicts) return stalled("conflicts");
|
|
85594
|
-
if (
|
|
85595
|
-
if (
|
|
85596
|
-
|
|
85597
|
-
|
|
86159
|
+
if (attempts.conflictHeads.includes(head)) return stalled("no_new_commit");
|
|
86160
|
+
if (attempts.conflictHeads.length >= DELIVERY_ATTEMPT_LIMIT) return stalled("conflict_limit");
|
|
86161
|
+
attempts.conflictHeads = [...attempts.conflictHeads, head];
|
|
86162
|
+
writePrAttempts(progress, activeUrl, attempts);
|
|
86163
|
+
return request("resolve_conflicts", pr, attempts.conflictHeads.length);
|
|
85598
86164
|
}
|
|
85599
|
-
if (pr.
|
|
86165
|
+
if (pr.checks === "failed") {
|
|
85600
86166
|
if (!options.fixCi) return stalled("ci_failed");
|
|
85601
|
-
if (
|
|
85602
|
-
if (
|
|
85603
|
-
|
|
85604
|
-
|
|
85605
|
-
|
|
85606
|
-
|
|
85607
|
-
|
|
85608
|
-
|
|
85609
|
-
|
|
86167
|
+
if (attempts.fixHeads.includes(head)) return stalled("no_new_commit");
|
|
86168
|
+
if (attempts.fixHeads.length >= DELIVERY_ATTEMPT_LIMIT) return stalled("ci_limit");
|
|
86169
|
+
attempts.fixHeads = [...attempts.fixHeads, head];
|
|
86170
|
+
writePrAttempts(progress, activeUrl, attempts);
|
|
86171
|
+
return request("fix_ci", pr, attempts.fixHeads.length);
|
|
86172
|
+
}
|
|
86173
|
+
if (pr.checks === "none") {
|
|
86174
|
+
if (attempts.unreportedCi?.head !== head)
|
|
86175
|
+
attempts.unreportedCi = { head, since: pr.observedAt };
|
|
86176
|
+
writePrAttempts(progress, activeUrl, attempts);
|
|
86177
|
+
if (pr.observedAt - attempts.unreportedCi.since < DELIVERY_CI_REPORT_GRACE_MS)
|
|
85610
86178
|
return status("ci");
|
|
85611
86179
|
}
|
|
85612
|
-
if (pr.
|
|
85613
|
-
if (pr.
|
|
85614
|
-
if (pr.
|
|
86180
|
+
if (pr.checks === "pending" || pr.mergeability === "unknown") return status("ci");
|
|
86181
|
+
if (pr.mergeability === "blocked") return stalled("merge_blocked");
|
|
86182
|
+
if (pr.mergeability === "behind") return stalled("merge_behind");
|
|
85615
86183
|
if (!options.merge) return status("ready");
|
|
85616
|
-
if (
|
|
85617
|
-
|
|
86184
|
+
if (attempts.mergeHeads.includes(head)) return stalled("merge_failed");
|
|
86185
|
+
attempts.mergeHeads = [...attempts.mergeHeads, head];
|
|
86186
|
+
writePrAttempts(progress, activeUrl, attempts);
|
|
85618
86187
|
return request("merge", pr);
|
|
85619
86188
|
}
|
|
85620
86189
|
const deliveryCheckpointId = (sessionId) => automationIdentity("auto-delivery", sessionId);
|
|
@@ -85637,21 +86206,26 @@ function writeDeliveryProgress(ledger, sessionId, progress, now) {
|
|
|
85637
86206
|
function startDeliveryEpoch(ledger, sessionId, now) {
|
|
85638
86207
|
writeDeliveryProgress(ledger, sessionId, emptyDeliveryProgress(now), now);
|
|
85639
86208
|
}
|
|
86209
|
+
const isCheckStatus = (value) => value === "passed" || value === "failed" || value === "pending" || value === "none";
|
|
86210
|
+
const isMergeability = (value) => value === "clean" || value === "conflicts" || value === "behind" || value === "blocked" || value === "unknown";
|
|
86211
|
+
const isProvider = (value) => value === "github" || value === "gitlab" || value === "other";
|
|
85640
86212
|
function readPullRequestSnapshot(ledger, sessionId, url) {
|
|
85641
86213
|
const checkpoint = ledger.checkpoint(pullRequestCheckpointId(sessionId, url));
|
|
85642
86214
|
if (!checkpoint) return void 0;
|
|
85643
86215
|
const data = checkpoint.data;
|
|
85644
|
-
if (typeof data.status !== "string"
|
|
85645
|
-
|
|
86216
|
+
if (typeof data.status !== "string") return void 0;
|
|
86217
|
+
const provider = isProvider(data.provider) ? data.provider : inferPullRequestProvider(url);
|
|
86218
|
+
const checks = isCheckStatus(data.checks) ? data.checks : mapGitHubCiState(data.ciState ?? null);
|
|
86219
|
+
const mergeability = isMergeability(data.mergeability) ? data.mergeability : mapGitHubMergeState(data.mergeState ?? null);
|
|
85646
86220
|
return {
|
|
86221
|
+
provider,
|
|
85647
86222
|
url,
|
|
85648
|
-
repoFullName: data.repoFullName,
|
|
85649
|
-
number: data.prNumber,
|
|
86223
|
+
...typeof data.repoFullName === "string" ? { repoFullName: data.repoFullName } : {},
|
|
86224
|
+
...typeof data.prNumber === "number" ? { number: data.prNumber } : {},
|
|
85650
86225
|
status: data.status,
|
|
85651
86226
|
...typeof data.headSha === "string" ? { headSha: data.headSha } : {},
|
|
85652
|
-
|
|
85653
|
-
|
|
85654
|
-
mergeState: data.mergeState ?? null,
|
|
86227
|
+
checks,
|
|
86228
|
+
mergeability,
|
|
85655
86229
|
observedAt: checkpoint.observedAt
|
|
85656
86230
|
};
|
|
85657
86231
|
}
|
|
@@ -85667,8 +86241,9 @@ function stepOutcome(ledger, eventId) {
|
|
|
85667
86241
|
const receiptOutcome = (receipt) => {
|
|
85668
86242
|
switch (receipt.state) {
|
|
85669
86243
|
case "settled":
|
|
85670
|
-
case "superseded":
|
|
85671
86244
|
return { state: "settled", at: receipt.updatedAt };
|
|
86245
|
+
case "superseded":
|
|
86246
|
+
return { state: "superseded" };
|
|
85672
86247
|
case "failed":
|
|
85673
86248
|
return { state: "failed" };
|
|
85674
86249
|
case "cancelled":
|
|
@@ -85680,29 +86255,58 @@ const receiptOutcome = (receipt) => {
|
|
|
85680
86255
|
}
|
|
85681
86256
|
};
|
|
85682
86257
|
const unfinished = (status) => status === void 0 || status === "open" || status === "draft";
|
|
85683
|
-
|
|
85684
|
-
|
|
85685
|
-
|
|
86258
|
+
function deliveryCandidates(ledger, meta, selectedUrls) {
|
|
86259
|
+
const seen = /* @__PURE__ */ new Set();
|
|
86260
|
+
const allUnfinished = [];
|
|
86261
|
+
for (const pr of resolveSessionPullRequests(meta)) {
|
|
86262
|
+
const key2 = pr.url.trim().toLowerCase();
|
|
86263
|
+
if (!key2 || seen.has(key2)) continue;
|
|
86264
|
+
seen.add(key2);
|
|
86265
|
+
if (unfinished(pr.status) && unfinished(readPullRequestSnapshot(ledger, meta.id, pr.url)?.status)) {
|
|
86266
|
+
allUnfinished.push(pr.url);
|
|
86267
|
+
}
|
|
86268
|
+
}
|
|
86269
|
+
if (!selectedUrls?.length) return allUnfinished;
|
|
86270
|
+
const available = new Map(allUnfinished.map((url) => [url.trim().toLowerCase(), url]));
|
|
86271
|
+
const filtered = [];
|
|
86272
|
+
for (const selected of selectedUrls) {
|
|
86273
|
+
const match = available.get(selected.trim().toLowerCase());
|
|
86274
|
+
if (match && !filtered.includes(match)) filtered.push(match);
|
|
86275
|
+
}
|
|
86276
|
+
return filtered;
|
|
86277
|
+
}
|
|
85686
86278
|
function advanceDelivery(input) {
|
|
85687
86279
|
const { ledger, meta, options, now } = input;
|
|
85688
86280
|
const progress = readDeliveryProgress(ledger, meta.id) ?? emptyDeliveryProgress(now);
|
|
85689
|
-
const candidates = deliveryCandidates(ledger, meta);
|
|
85690
|
-
const
|
|
85691
|
-
|
|
86281
|
+
const candidates = deliveryCandidates(ledger, meta, options.prUrls);
|
|
86282
|
+
const urlsToRead = /* @__PURE__ */ new Set([
|
|
86283
|
+
...progress.prUrls ?? [],
|
|
86284
|
+
...progress.prUrl ? [progress.prUrl] : [],
|
|
86285
|
+
...candidates
|
|
86286
|
+
]);
|
|
86287
|
+
const prs = {};
|
|
86288
|
+
for (const url of urlsToRead) {
|
|
86289
|
+
const snapshot = readPullRequestSnapshot(ledger, meta.id, url);
|
|
86290
|
+
if (snapshot) prs[url] = snapshot;
|
|
86291
|
+
}
|
|
85692
86292
|
const decision = decideDelivery({
|
|
85693
86293
|
options,
|
|
85694
86294
|
progress,
|
|
85695
86295
|
candidates,
|
|
85696
|
-
|
|
86296
|
+
prs,
|
|
85697
86297
|
workspacePending: meta.workspaceDirty === true || meta.workspaceUnpushed === true,
|
|
85698
86298
|
...progress.lastStep ? { lastStep: stepOutcome(ledger, progress.lastStep.eventId) } : {},
|
|
85699
86299
|
now
|
|
85700
86300
|
});
|
|
86301
|
+
const activeUrl = decision.progress.prUrl;
|
|
86302
|
+
const observed = activeUrl ? prs[activeUrl] : void 0;
|
|
85701
86303
|
if (decision.step) {
|
|
85702
86304
|
const { step, attempt, pr } = decision.step;
|
|
86305
|
+
const prKey = pr ? automationIdentity(pr.url).slice(0, 8) : "none";
|
|
85703
86306
|
const eventId = [
|
|
85704
86307
|
meta.id,
|
|
85705
86308
|
decision.progress.epoch,
|
|
86309
|
+
prKey,
|
|
85706
86310
|
step,
|
|
85707
86311
|
pr?.headSha ?? "none",
|
|
85708
86312
|
attempt ?? 0
|
|
@@ -85716,14 +86320,14 @@ function advanceDelivery(input) {
|
|
|
85716
86320
|
};
|
|
85717
86321
|
decision.progress.lastStep = lastStep;
|
|
85718
86322
|
ledger.publish(
|
|
85719
|
-
deliveryEvent(ledger.workspaceId, meta, decision.progress.epoch, lastStep, pr, now)
|
|
86323
|
+
deliveryEvent(ledger.workspaceId, meta, decision.progress.epoch, lastStep, pr, options, now)
|
|
85720
86324
|
);
|
|
85721
86325
|
}
|
|
85722
86326
|
if (JSON.stringify(decision.progress) !== JSON.stringify(progress) || !readDeliveryProgress(ledger, meta.id))
|
|
85723
86327
|
writeDeliveryProgress(ledger, meta.id, decision.progress, now);
|
|
85724
86328
|
return observed ? { ...decision, observed } : decision;
|
|
85725
86329
|
}
|
|
85726
|
-
function deliveryEvent(workspaceId, meta, epoch, step, pr, now) {
|
|
86330
|
+
function deliveryEvent(workspaceId, meta, epoch, step, pr, options, now) {
|
|
85727
86331
|
const sessionId = meta.id;
|
|
85728
86332
|
return {
|
|
85729
86333
|
id: step.eventId,
|
|
@@ -85736,8 +86340,14 @@ function deliveryEvent(workspaceId, meta, epoch, step, pr, now) {
|
|
|
85736
86340
|
data: {
|
|
85737
86341
|
step: step.step,
|
|
85738
86342
|
...step.attempt ? { attempt: step.attempt } : {},
|
|
85739
|
-
...pr ? {
|
|
86343
|
+
...pr ? {
|
|
86344
|
+
provider: pr.provider,
|
|
86345
|
+
prUrl: pr.url,
|
|
86346
|
+
...pr.repoFullName ? { repoFullName: pr.repoFullName } : {},
|
|
86347
|
+
...pr.number !== void 0 ? { prNumber: pr.number } : {}
|
|
86348
|
+
} : {},
|
|
85740
86349
|
...step.headSha ? { headSha: step.headSha } : {},
|
|
86350
|
+
...step.step === "merge" && options.mergeMethod ? { mergeMethod: options.mergeMethod } : {},
|
|
85741
86351
|
...meta.projectRun ? { projectGroup: true } : {}
|
|
85742
86352
|
},
|
|
85743
86353
|
provenance: "command",
|
|
@@ -85881,7 +86491,7 @@ function configureSessionPolicies(ledger, sessionId, userId, settings, now) {
|
|
|
85881
86491
|
maxActionsPerEvent: 1,
|
|
85882
86492
|
// One Auto delivery enablement shares a correlation: one Create PR, bounded
|
|
85883
86493
|
// repairs and one merge request per head.
|
|
85884
|
-
maxInvocationsPerCorrelation: policy.policy === "auto-deliver" ?
|
|
86494
|
+
maxInvocationsPerCorrelation: policy.policy === "auto-deliver" ? 64 : 8,
|
|
85885
86495
|
maxPendingActions: 128,
|
|
85886
86496
|
maxDepth: 8
|
|
85887
86497
|
}
|
|
@@ -86140,9 +86750,16 @@ class Automations extends Service()("lody/automations/Runtime") {
|
|
|
86140
86750
|
{ concurrency: 4, discard: true }
|
|
86141
86751
|
);
|
|
86142
86752
|
const receipts = yield* try_(() => ledger.pending(now, 8));
|
|
86753
|
+
let receiptTransitioned = false;
|
|
86143
86754
|
yield* forEach(
|
|
86144
86755
|
receipts,
|
|
86145
86756
|
(receipt) => advanceOwned(receipt).pipe(
|
|
86757
|
+
tap$1(
|
|
86758
|
+
() => sync(() => {
|
|
86759
|
+
const after = ledger.receipt(receipt.id);
|
|
86760
|
+
if (after && after.state !== receipt.state) receiptTransitioned = true;
|
|
86761
|
+
})
|
|
86762
|
+
),
|
|
86146
86763
|
catchCause(
|
|
86147
86764
|
(cause) => hasInterrupts(cause) ? failCause(cause) : persist(receipt, {
|
|
86148
86765
|
state: receipt.state === "submitting" ? "unknown" : receipt.state,
|
|
@@ -86153,6 +86770,7 @@ class Automations extends Service()("lody/automations/Runtime") {
|
|
|
86153
86770
|
),
|
|
86154
86771
|
{ concurrency: 4, discard: true }
|
|
86155
86772
|
);
|
|
86773
|
+
if (receiptTransitioned && host.observe) yield* host.observe;
|
|
86156
86774
|
})
|
|
86157
86775
|
);
|
|
86158
86776
|
yield* forever(
|
|
@@ -86529,12 +87147,15 @@ class AutomationSessionActionsLegacy {
|
|
|
86529
87147
|
if (meta.latestUserMsgId !== compact.idleTurnId && meta.latestUserMsgId !== receipt.turnId || meta.lastHandledUserMsgId !== compact.idleTurnId)
|
|
86530
87148
|
return { value: "no", reason: "guard:maintenance_input_changed" };
|
|
86531
87149
|
}
|
|
86532
|
-
if (meta.isArchived)
|
|
87150
|
+
if (meta.isArchived) {
|
|
87151
|
+
if (action.kind === "session.archive" && await this.authority.archived(sessionId))
|
|
87152
|
+
return { value: "yes", reason: "archive_already_committed" };
|
|
86533
87153
|
return {
|
|
86534
87154
|
value: "no",
|
|
86535
87155
|
reason: "target_archived",
|
|
86536
87156
|
...unavailableFails ? { terminalState: "failed" } : {}
|
|
86537
87157
|
};
|
|
87158
|
+
}
|
|
86538
87159
|
if (meta.collaborationStopped) return { value: "no", reason: "target_stopped" };
|
|
86539
87160
|
return { value: "yes", reason: "authorized" };
|
|
86540
87161
|
}
|
|
@@ -86734,10 +87355,12 @@ class AutomationSessionActionsLegacy {
|
|
|
86734
87355
|
const allowed = await this.authorize(receipt);
|
|
86735
87356
|
if (allowed.value !== "yes") return { state: "blocked", reason: allowed.reason };
|
|
86736
87357
|
if (receipt.intent.action.kind === "session.archive") {
|
|
87358
|
+
if (allowed.reason === "archive_already_committed")
|
|
87359
|
+
return { state: "settled", reason: allowed.reason };
|
|
86737
87360
|
const result2 = await this.authority.archive(
|
|
86738
87361
|
receipt.sessionId,
|
|
86739
87362
|
receipt.rule.ownerUserId,
|
|
86740
|
-
() => this.options.
|
|
87363
|
+
() => this.options.admission(receipt),
|
|
86741
87364
|
receipt.id
|
|
86742
87365
|
);
|
|
86743
87366
|
return { state: result2.value === "yes" ? "settled" : "blocked", reason: result2.reason };
|
|
@@ -86830,7 +87453,7 @@ class AutomationSessionActionsLegacy {
|
|
|
86830
87453
|
}
|
|
86831
87454
|
if (receipt.intent.action.kind === "session.archive") {
|
|
86832
87455
|
if (await this.authority.archived(receipt.sessionId))
|
|
86833
|
-
return { state: "settled" };
|
|
87456
|
+
return { state: "settled", reason: "archive_already_committed" };
|
|
86834
87457
|
if (!meta.isArchived) return this.submit(receipt);
|
|
86835
87458
|
return { state: "unknown", reason: "archive_group_unconfirmed" };
|
|
86836
87459
|
}
|
|
@@ -86906,18 +87529,25 @@ class AutomationSessionActionsLegacy {
|
|
|
86906
87529
|
}
|
|
86907
87530
|
}
|
|
86908
87531
|
const deliveryValues = object$2({
|
|
87532
|
+
provider: _enum(["github", "gitlab", "other"]).optional(),
|
|
86909
87533
|
repoFullName: string().min(1).optional(),
|
|
86910
87534
|
prNumber: number().int().positive().optional(),
|
|
86911
87535
|
prUrl: string().url().optional(),
|
|
86912
87536
|
headSha: string().min(1).optional(),
|
|
87537
|
+
mergeMethod: _enum(["auto", "squash", "merge", "rebase"]).optional(),
|
|
86913
87538
|
projectGroup: boolean().optional()
|
|
86914
87539
|
}).passthrough();
|
|
86915
87540
|
function deliveryRequest(step, values) {
|
|
86916
87541
|
const parsed = deliveryValues.safeParse(values);
|
|
86917
87542
|
if (!parsed.success) return void 0;
|
|
86918
|
-
const { repoFullName, prNumber, prUrl, headSha } = parsed.data;
|
|
86919
|
-
const target =
|
|
86920
|
-
|
|
87543
|
+
const { provider, repoFullName, prNumber, prUrl, headSha, mergeMethod } = parsed.data;
|
|
87544
|
+
const target = prUrl ? {
|
|
87545
|
+
...provider ? { provider } : {},
|
|
87546
|
+
repoFullName: repoFullName ?? null,
|
|
87547
|
+
prNumber: prNumber ?? null,
|
|
87548
|
+
prUrl
|
|
87549
|
+
} : void 0;
|
|
87550
|
+
const request = step === "create_pr" ? withPrBranchUpkeep(CREATE_PR_BASE_PROMPT, PR_BRANCH_UPKEEP_PROMPT) : step === "fix_ci" && target ? buildFixCiRequest(target) : step === "resolve_conflicts" && target ? buildResolveConflictsRequest(target) : step === "merge" && target && headSha ? buildMergePrRequest({ ...target, headSha, ...mergeMethod ? { mergeMethod } : {} }) : void 0;
|
|
86921
87551
|
if (!request) return void 0;
|
|
86922
87552
|
return withQuickActionOrigin(
|
|
86923
87553
|
AUTO_DELIVERY_ORIGIN_PROMPT,
|
|
@@ -87301,23 +87931,30 @@ async function createAutomationWorkspaceLegacy(options) {
|
|
|
87301
87931
|
return { value: "unknown", reason: `condition_unsupported:${spec.kind}` };
|
|
87302
87932
|
}
|
|
87303
87933
|
};
|
|
87304
|
-
const
|
|
87934
|
+
const recheckAdmission = async (receipt) => {
|
|
87305
87935
|
const authorization = await actions.authorize(receipt);
|
|
87306
|
-
if (authorization.value !== "yes"
|
|
87936
|
+
if (authorization.value !== "yes" || authorization.reason === "archive_already_committed")
|
|
87937
|
+
return authorization;
|
|
87307
87938
|
if (receipt.intent.guard) {
|
|
87308
87939
|
const guard = await condition(receipt.intent.guard, receipt);
|
|
87309
87940
|
if (guard.value !== "yes") return { ...guard, reason: `guard:${guard.reason}` };
|
|
87310
87941
|
}
|
|
87942
|
+
return { value: "yes", reason: "authorized" };
|
|
87943
|
+
};
|
|
87944
|
+
const recheck = async (receipt) => {
|
|
87945
|
+
const admission = await recheckAdmission(receipt);
|
|
87946
|
+
if (admission.value !== "yes" || admission.reason === "archive_already_committed")
|
|
87947
|
+
return admission;
|
|
87311
87948
|
if (receipt.intent.condition && !["queued", "running", "unknown"].includes(receipt.state)) {
|
|
87312
87949
|
const predicate = await condition(receipt.intent.condition, receipt);
|
|
87313
87950
|
if (predicate.value !== "yes") return predicate;
|
|
87314
87951
|
}
|
|
87315
|
-
return
|
|
87952
|
+
return admission;
|
|
87316
87953
|
};
|
|
87317
87954
|
const actions = new AutomationSessionActionsLegacy({
|
|
87318
87955
|
...options,
|
|
87319
87956
|
ledger,
|
|
87320
|
-
|
|
87957
|
+
admission: recheckAdmission,
|
|
87321
87958
|
capacity: (bindingId, modelId, receipt) => condition(
|
|
87322
87959
|
{
|
|
87323
87960
|
kind: "provider.capacity.can_dispatch",
|
|
@@ -87444,7 +88081,14 @@ async function createAutomationWorkspaceLegacy(options) {
|
|
|
87444
88081
|
)
|
|
87445
88082
|
)
|
|
87446
88083
|
);
|
|
87447
|
-
const deliveryStatusKey = (status) => status ? JSON.stringify([
|
|
88084
|
+
const deliveryStatusKey = (status) => status ? JSON.stringify([
|
|
88085
|
+
status.state,
|
|
88086
|
+
status.attempt,
|
|
88087
|
+
status.reason,
|
|
88088
|
+
status.prUrl,
|
|
88089
|
+
status.prIndex,
|
|
88090
|
+
status.prTotal
|
|
88091
|
+
]) : "";
|
|
87448
88092
|
const advanceDeliveries = async (now) => {
|
|
87449
88093
|
for (const rule of ledger.rules()) {
|
|
87450
88094
|
const sessionId = rule.scope.sessionId;
|
|
@@ -87470,10 +88114,11 @@ async function createAutomationWorkspaceLegacy(options) {
|
|
|
87470
88114
|
logger.debug(`Auto delivery ${sessionId}: ${deliveryStatusKey(decision.status)}`, {
|
|
87471
88115
|
step: decision.step?.step,
|
|
87472
88116
|
...pr ? {
|
|
88117
|
+
provider: pr.provider,
|
|
87473
88118
|
head: pr.headSha,
|
|
87474
88119
|
status: pr.status,
|
|
87475
|
-
|
|
87476
|
-
|
|
88120
|
+
checks: pr.checks,
|
|
88121
|
+
mergeability: pr.mergeability,
|
|
87477
88122
|
observedAt: pr.observedAt
|
|
87478
88123
|
} : {},
|
|
87479
88124
|
workspaceDirty: meta.workspaceDirty,
|
|
@@ -87676,7 +88321,9 @@ async function createAutomationWorkspaceLegacy(options) {
|
|
|
87676
88321
|
);
|
|
87677
88322
|
const lastStep = command2.settings.autoDeliver === false ? readDeliveryProgress(ledger, sessionId)?.lastStep : void 0;
|
|
87678
88323
|
for (const receipt of lastStep ? ledger.eventReceipts(DELIVERY_EVENT_SOURCE, lastStep.eventId) : [])
|
|
87679
|
-
if (["accepted", "waiting", "resolved", "blocked"].includes(
|
|
88324
|
+
if (["accepted", "waiting", "resolved", "blocked", "submitting", "queued"].includes(
|
|
88325
|
+
receipt.state
|
|
88326
|
+
))
|
|
87680
88327
|
await runtime.runPromise(service.cancel(receipt.id));
|
|
87681
88328
|
}
|
|
87682
88329
|
await runtime.runPromise(service.wake);
|
|
@@ -87761,6 +88408,14 @@ async function createAutomationWorkspaceLegacy(options) {
|
|
|
87761
88408
|
})
|
|
87762
88409
|
),
|
|
87763
88410
|
workflowObservationOwners: () => ledger.wantsReadSessions("github.workflowRuns"),
|
|
88411
|
+
deliveryObservationOwners: () => {
|
|
88412
|
+
const owners = /* @__PURE__ */ new Set();
|
|
88413
|
+
for (const rule of ledger.rules()) {
|
|
88414
|
+
if (rule.enabled && rule.scope.sessionId && rule.handler.kind === "policy" && rule.handler.policy === "auto-deliver" && rule.ownerMachineId === auth2.machineId)
|
|
88415
|
+
owners.add(rule.scope.sessionId);
|
|
88416
|
+
}
|
|
88417
|
+
return owners;
|
|
88418
|
+
},
|
|
87764
88419
|
recordWorkflowObservations: ((meta, repository, headSha, runs, gap, observedAt) => observe(async () => {
|
|
87765
88420
|
observeWorkflows(ledger, meta, repository, headSha, runs, gap, observedAt);
|
|
87766
88421
|
await runtime.runPromise(service.wake);
|
|
@@ -88047,7 +88702,7 @@ class LodyFleet {
|
|
|
88047
88702
|
dispatchE2eePairing: (message) => this.dispatchLocalE2eePairing(message),
|
|
88048
88703
|
dispatchSchedule: async (message) => {
|
|
88049
88704
|
const runtime = await this.resolveWorkspaceRuntime(message.workspaceId);
|
|
88050
|
-
const { executeScheduleCommand } = await import("./schedule-command-service-
|
|
88705
|
+
const { executeScheduleCommand } = await import("./schedule-command-service-pFq9cQHf.js");
|
|
88051
88706
|
try {
|
|
88052
88707
|
const result2 = await executeScheduleCommand(
|
|
88053
88708
|
{
|
|
@@ -88077,7 +88732,7 @@ class LodyFleet {
|
|
|
88077
88732
|
dispatchMachineRpc: async (message, signal) => await this.dispatchLocalMachineRpc(message, signal),
|
|
88078
88733
|
dispatchWorkspaceBundle: async (message) => {
|
|
88079
88734
|
const runtime = await this.resolveWorkspaceRuntime(message.workspaceId);
|
|
88080
|
-
const { handleWorkspaceBundleControl } = await import("./control-
|
|
88735
|
+
const { handleWorkspaceBundleControl } = await import("./control-HMzEZJTm.js");
|
|
88081
88736
|
const { daemonBundleWorkspace } = await import("./daemon-D2tAQPaP.js");
|
|
88082
88737
|
return await handleWorkspaceBundleControl(message, {
|
|
88083
88738
|
workspace: daemonBundleWorkspace(runtime.workspace.id, runtime.lody.documentManager, {
|
|
@@ -88762,7 +89417,7 @@ class LodyFleet {
|
|
|
88762
89417
|
const automation = this.runtimes.get(workspace.id)?.automations;
|
|
88763
89418
|
if (!automation) throw new Error("AUTOMATION_OWNER_UNAVAILABLE");
|
|
88764
89419
|
const result2 = await automation.remoteControl(input);
|
|
88765
|
-
const { remoteAutomationResultSchema } = await import("./index-
|
|
89420
|
+
const { remoteAutomationResultSchema } = await import("./index-DdJk9U2O.js");
|
|
88766
89421
|
return {
|
|
88767
89422
|
type: "session/automation-control_response",
|
|
88768
89423
|
sessionId: input.sessionId,
|
|
@@ -88829,6 +89484,10 @@ class LodyFleet {
|
|
|
88829
89484
|
prAssociation: workspace.contentMode === "e2ee" ? null : this.cloudPort.prAssociation,
|
|
88830
89485
|
logger: workspaceLogger,
|
|
88831
89486
|
workflowObservationOwners: () => this.runtimes.get(workspace.id)?.automations?.workflowObservationOwners() ?? /* @__PURE__ */ new Set(),
|
|
89487
|
+
deliveryObservationOwners: () => this.runtimes.get(workspace.id)?.automations?.deliveryObservationOwners() ?? /* @__PURE__ */ new Set(),
|
|
89488
|
+
onPullRequestMetaWritten: async () => {
|
|
89489
|
+
await this.runtimes.get(workspace.id)?.automations?.wake();
|
|
89490
|
+
},
|
|
88832
89491
|
recordWorkflowObservations: async (...args) => {
|
|
88833
89492
|
await this.runtimes.get(workspace.id)?.automations?.recordWorkflowObservations(...args);
|
|
88834
89493
|
},
|
|
@@ -89738,7 +90397,7 @@ class LodyFleet {
|
|
|
89738
90397
|
throw new Error("e2ee_account_unavailable");
|
|
89739
90398
|
if (this.e2eeResets.has(workspace.id)) throw new Error("e2ee_identity_busy");
|
|
89740
90399
|
const completion = (async () => {
|
|
89741
|
-
const { resetCliE2eeIdentity, completedCliE2eeIdentityReset } = await import("./reset-identity-
|
|
90400
|
+
const { resetCliE2eeIdentity, completedCliE2eeIdentityReset } = await import("./reset-identity-BKSdKzDv.js");
|
|
89742
90401
|
const previous = await runPromise(completedCliE2eeIdentityReset(message));
|
|
89743
90402
|
if (previous)
|
|
89744
90403
|
return { ok: true, resetId: message.resetId, archive: previous.archive };
|
|
@@ -89789,7 +90448,7 @@ class LodyFleet {
|
|
|
89789
90448
|
activateAndPromoteCliE2eeWorkspaceLegacy,
|
|
89790
90449
|
prepareCliE2eeMachineLegacy,
|
|
89791
90450
|
validateCliE2eePairingIntentLegacy
|
|
89792
|
-
} = await import("./workspace-legacy-
|
|
90451
|
+
} = await import("./workspace-legacy-DJAko-Yj.js").then((n) => n.b_);
|
|
89793
90452
|
if (this.e2eeResets.has(message.workspaceId)) throw new Error("e2ee_identity_busy");
|
|
89794
90453
|
if (message.type === "prepare") {
|
|
89795
90454
|
const material = await prepareCliE2eeMachineLegacy({ ...message, cloud: e2eeCloud });
|
|
@@ -90150,6 +90809,7 @@ class LodyFleet {
|
|
|
90150
90809
|
ok: true,
|
|
90151
90810
|
type: "local-project/list-global-skills",
|
|
90152
90811
|
result: await this.localProjectControlService.listGlobalSkills({
|
|
90812
|
+
magpieGatewayUrl: message.magpieGatewayUrl,
|
|
90153
90813
|
knownFingerprint: message.knownFingerprint
|
|
90154
90814
|
})
|
|
90155
90815
|
};
|
|
@@ -91239,7 +91899,7 @@ const startCommand = new Command("start").description("Start agent service in na
|
|
|
91239
91899
|
const supervisorIdentity = identityResolution.status === "supervised" ? identityResolution.identity : null;
|
|
91240
91900
|
if (managedCandidate) pauseMachineTurnsIfIdle();
|
|
91241
91901
|
if (supervisorIdentity?.launchMode === "daemon" && getCliPlatformKind() === "cloud") {
|
|
91242
|
-
const { applyPendingMachineIdentityRestore, machineIdentityRestoreStartupExitCode } = await import("./machine-identity-restore-
|
|
91902
|
+
const { applyPendingMachineIdentityRestore, machineIdentityRestoreStartupExitCode } = await import("./machine-identity-restore-CYjkTQcN.js");
|
|
91243
91903
|
try {
|
|
91244
91904
|
await applyPendingMachineIdentityRestore({ readOnly: managedCandidate });
|
|
91245
91905
|
} catch (error) {
|
|
@@ -91429,7 +92089,7 @@ const startCommand = new Command("start").description("Start agent service in na
|
|
|
91429
92089
|
process.exit(1);
|
|
91430
92090
|
}
|
|
91431
92091
|
if (options.pairedWorkspace) {
|
|
91432
|
-
const { loadCliE2eeMachineBootstrapLegacy } = await import("./workspace-legacy-
|
|
92092
|
+
const { loadCliE2eeMachineBootstrapLegacy } = await import("./workspace-legacy-DJAko-Yj.js").then((n) => n.b_);
|
|
91433
92093
|
machineId = await getOrCreateStableMachineIdAsync();
|
|
91434
92094
|
const paired = await loadCliE2eeMachineBootstrapLegacy(options.pairedWorkspace, machineId);
|
|
91435
92095
|
token = "";
|
|
@@ -91607,9 +92267,9 @@ async function startAgentService(options, token, userId, machineName, machineId,
|
|
|
91607
92267
|
if (!LODY_SERVER_URL) {
|
|
91608
92268
|
throw new Error("Cloud platform startup requires LODY_SERVER_URL");
|
|
91609
92269
|
}
|
|
91610
|
-
const { loadCliE2eeMachineBootstrapLegacy } = await import("./workspace-legacy-
|
|
92270
|
+
const { loadCliE2eeMachineBootstrapLegacy } = await import("./workspace-legacy-DJAko-Yj.js").then((n) => n.b_);
|
|
91611
92271
|
const paired = await loadCliE2eeMachineBootstrapLegacy(options.pairedWorkspace, machineId);
|
|
91612
|
-
const { createCloudE2eeMachinePort } = await import("./command-runtime-
|
|
92272
|
+
const { createCloudE2eeMachinePort } = await import("./command-runtime-CYs2KAyh.js").then((n) => n.e9);
|
|
91613
92273
|
cloudPort = createCloudE2eeMachinePort({
|
|
91614
92274
|
accountId: userId,
|
|
91615
92275
|
workspaceId: paired.bootstrap.workspaceId,
|
|
@@ -91927,4 +92587,4 @@ export {
|
|
|
91927
92587
|
SESSION_HISTORY_PRECONDITION_CODES as S,
|
|
91928
92588
|
start as s
|
|
91929
92589
|
};
|
|
91930
|
-
//# sourceMappingURL=start-
|
|
92590
|
+
//# sourceMappingURL=start-B83c1-EW.js.map
|