lody 0.83.0 → 0.84.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/chunks/{index-CbTnvx5t.js → index-ddMw90Gr.js} +5396 -4189
- package/dist/chunks/{package-Ce-NgzCA.js → package-CNW89xCh.js} +2 -2
- package/dist/chunks/{review-viewer-BPTYS7b4.js → review-viewer-BZC6lRid.js} +3 -3
- package/dist/claude-acp.js +56197 -48759
- package/dist/codex-acp.js +1 -1
- package/dist/index.js +1333 -1234
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import * as path$1 from "path";
|
|
3
3
|
import path__default$1, { posix, dirname, sep, isAbsolute as isAbsolute$1, relative, parse as parse$4, resolve as resolve$2 } from "path";
|
|
4
|
-
import * as fs$
|
|
4
|
+
import * as fs$1 from "node:fs";
|
|
5
5
|
import fs__default$1, { createReadStream, createWriteStream, existsSync, rmSync, readdirSync, readFileSync, mkdirSync as mkdirSync$2, chmodSync, watch, promises as promises$1, realpathSync, unlinkSync as unlinkSync$1, accessSync as accessSync$1, constants as constants$9, writeSync } from "node:fs";
|
|
6
6
|
import * as readline$1 from "node:readline";
|
|
7
7
|
import readline__default, { createInterface } from "node:readline";
|
|
@@ -16,36 +16,36 @@ import * as path from "node:path";
|
|
|
16
16
|
import path__default, { posix as posix$1, basename, win32, join as join$2, resolve as resolve$1, dirname as dirname$1, relative as relative$1, isAbsolute as isAbsolute$2, sep as sep$1, delimiter, normalize } from "node:path";
|
|
17
17
|
import { _ as _coercedNumber, Z as ZodNumber$1, o as object$1, s as string$1, l as literal$1, n as number$4, b as boolean, a as _enum$1, c as array$2, d as discriminatedUnion, e as _instanceof, r as record$1, u as unknown, f as union$7, p as preprocess, g as ZodError$1, h as _null, i as normalizeParams, $ as $constructor, j as $ZodObject, k as defineLazy, m as $ZodType, q as parse$5, t as safeParse$1, v as parseAsync, w as safeParseAsync$1, x as clone$2, y as looseObject, z as intersection, A as optional$1, B as datetime, C as custom$1, D as toJSONSchema, E as ZodOptional$1, F as never$1, G as xor } from "./chunks/schemas-Du3qLZPS.js";
|
|
18
18
|
import require$$0$4, { once as once$1, EventEmitter as EventEmitter$1 } from "node:events";
|
|
19
|
-
import
|
|
19
|
+
import LE__default, { execFile, spawn as spawn$1, execFileSync } from "node:child_process";
|
|
20
20
|
import process$2 from "node:process";
|
|
21
21
|
import tty from "node:tty";
|
|
22
22
|
import * as os from "os";
|
|
23
23
|
import os__default$1 from "os";
|
|
24
|
-
import
|
|
24
|
+
import crypto__default$1, { randomFillSync, randomUUID, createHash, randomBytes, timingSafeEqual } from "node:crypto";
|
|
25
25
|
import require$$0$5, { promisify as promisify$1 } from "util";
|
|
26
|
-
import
|
|
26
|
+
import Zr, { Transform as Transform$1, Readable as Readable$1 } from "stream";
|
|
27
27
|
import require$$0$6, { Buffer as Buffer$1 } from "buffer";
|
|
28
28
|
import require$$0$7, { EventEmitter as EventEmitter$2 } from "events";
|
|
29
|
-
import * as
|
|
30
|
-
import
|
|
31
|
-
import require$$1$
|
|
32
|
-
import require$$1$
|
|
29
|
+
import * as $s from "zlib";
|
|
30
|
+
import $s__default from "zlib";
|
|
31
|
+
import require$$1$2 from "tty";
|
|
32
|
+
import require$$1$3 from "string_decoder";
|
|
33
33
|
import http from "http";
|
|
34
34
|
import require$$1__default from "https";
|
|
35
35
|
import require$$0$8, { promisify, inspect as inspect$1, stripVTControlCharacters, isDeepStrictEqual } from "node:util";
|
|
36
|
-
import * as
|
|
37
|
-
import
|
|
36
|
+
import * as jt from "node:fs/promises";
|
|
37
|
+
import jt__default, { mkdir as mkdir$1, realpath, symlink, mkdtemp, chmod, writeFile, rm, rename, stat, lstat, readdir, readFile, unlink, open, opendir } from "node:fs/promises";
|
|
38
38
|
import zlib__default, { gzip, gunzip as gunzip$1, gunzipSync, brotliDecompressSync } from "node:zlib";
|
|
39
|
-
import require$$1$
|
|
39
|
+
import require$$1$8, { exec, execFile as execFile$1, spawn as spawn$2 } from "child_process";
|
|
40
|
+
import { i as imports, _ as __wbg_set_wasm$1, r as rawWasm, L as LoroDoc, E as EphemeralStoreWasm, U as UndoManager, c as callPendingEvents$3, a as LoroTree, b as LoroText, d as LoroMovableList, e as LoroList, f as LoroMap, V as VersionVector, g as __vite__initWasm, h as decodeImportBlobMeta, __tla as __tla_0 } from "./chunks/loro_wasm_bg-BPNKba8n.js";
|
|
40
41
|
import { performance as performance$1 } from "perf_hooks";
|
|
41
42
|
import require$$0$9 from "net";
|
|
42
43
|
import require$$4$2 from "tls";
|
|
43
44
|
import require$$7$2, { fileURLToPath as fileURLToPath$1, pathToFileURL as pathToFileURL$1 } from "url";
|
|
44
|
-
import { i as imports, _ as __wbg_set_wasm$1, r as rawWasm, L as LoroDoc, E as EphemeralStoreWasm, U as UndoManager, c as callPendingEvents$3, a as LoroTree, b as LoroText, d as LoroMovableList, e as LoroList, f as LoroMap, V as VersionVector, g as __vite__initWasm, h as decodeImportBlobMeta, __tla as __tla_0 } from "./chunks/loro_wasm_bg-BPNKba8n.js";
|
|
45
45
|
import { D as DEEPSEEK_HARNESS_PERMISSION_MODES, a as DEEPSEEK_HARNESS_AGENT_PRESETS, b as DEEPSEEK_HARNESS_MODELS, c as DEEPSEEK_HARNESS_REASONING_OPTIONS, A as ACP_EXTENSION_DSH_CAPABILITY_SOURCE_VERSION, d as createDeepSeekHarnessCordisConfig, e as ACP_EXTENSION_DSH_VERSION, f as ACP_EXTENSION_DSH_PROFILE_REVISION, g as ACP_EXTENSION_DSH_QUERY_PATH_ENV, h as ACP_EXTENSION_DSH_SESSION_ROOT_ENV, i as DEEPSEEK_HARNESS_NPX_PACKAGES, j as DEEPSEEK_HARNESS_VERSION, k as DEEPSEEK_HARNESS_DEFAULT_SESSION_COMPRESSION } from "./chunks/profile-RfMzWliN.js";
|
|
46
46
|
import assert from "assert";
|
|
47
|
-
import * as fs$
|
|
48
|
-
import fs__default$
|
|
47
|
+
import * as fs$2 from "fs/promises";
|
|
48
|
+
import fs__default$2 from "fs/promises";
|
|
49
49
|
import Database from "better-sqlite3";
|
|
50
50
|
import require$$0$d, { channel } from "node:diagnostics_channel";
|
|
51
51
|
import require$$0$b from "node:assert";
|
|
@@ -57,15 +57,15 @@ import require$$7$3 from "node:querystring";
|
|
|
57
57
|
import require$$5$2 from "node:tls";
|
|
58
58
|
import require$$5$3, { performance as performance$2 } from "node:perf_hooks";
|
|
59
59
|
import require$$8 from "node:util/types";
|
|
60
|
-
import require$$1$
|
|
61
|
-
import require$$1$
|
|
62
|
-
import require$$1$
|
|
63
|
-
import require$$1$
|
|
60
|
+
import require$$1$4, { Worker as Worker$1 } from "node:worker_threads";
|
|
61
|
+
import require$$1$5, { fileURLToPath, pathToFileURL } from "node:url";
|
|
62
|
+
import require$$1$6 from "node:console";
|
|
63
|
+
import require$$1$7 from "node:dns";
|
|
64
64
|
import { C as CodeCollabV2OpenTextRequestSchema, a as CodeCollabV2RefreshTextRequestSchema, b as CodeCollabV2SaveTextRequestSchema, c as CodeCollabV2OpenCurrentDiffRequestSchema, d as CodeCollabV2OpenAllChangesDiffRequestSchema, e as CodeCollabV2OpenTurnDiffRequestSchema, f as CodeCollabV2InitDirectoryRequestSchema, g as CodeCollabV2OpenTextOkSchema, h as CodeCollabV2RefreshTextResponseSchema, i as CodeCollabV2SaveTextResponseSchema, j as CodeCollabV2OpenCurrentDiffResponseSchema, k as CodeCollabV2OpenAllChangesDiffResponseSchema, l as CodeCollabV2OpenTurnDiffResponseSchema, m as CodeCollabV2InitDirectoryOkSchema, n as CodeCollabV2LspUnsupportedSchema, o as CodeCollabV2ErrorSchema, p as CodeCollabV2RpcContentEnvelopeSchema, q as deriveCodeCollabV2ContentKeyId, r as CodeCollabV2ErrorCodeSchema, s as CodeCollabV2RpcResponseSchema, t as deriveCodeCollabV2ContentKeyBytes, u as readCodeCollabFileIndexSignalFromFlock, w as writeCodeCollabFileIndexSignalToFlock, v as writeCodeCollabFileIndexToFlock, x as buildCodeCollabFileIndexState, y as CODE_COLLAB_V2_TEXT_LIMITS, z as CODE_COLLAB_V2_ALL_CHANGES_DIFF_LIMITS, A as computeAllChanges, B as codeCollabFileIndexStatesEqual, D as scanGitDirectoryEntries, E as closeDirectoryQuietly } from "./chunks/directory-handle-OPjjCl3O.js";
|
|
65
65
|
import { C as ClientSideConnection, P as PROTOCOL_VERSION, n as ndJsonStream } from "./chunks/acp-CrvzLY5A.js";
|
|
66
66
|
import { StringDecoder } from "node:string_decoder";
|
|
67
67
|
import { pipeline, finished } from "node:stream/promises";
|
|
68
|
-
import { p as packageJson } from "./chunks/package-
|
|
68
|
+
import { p as packageJson } from "./chunks/package-CNW89xCh.js";
|
|
69
69
|
import { r as runtimeManifest } from "./chunks/runtime-manifest-Fr5DEH54.js";
|
|
70
70
|
import { AsyncLocalStorage as AsyncLocalStorage$1 } from "async_hooks";
|
|
71
71
|
import { createRequire } from "module";
|
|
@@ -2296,7 +2296,7 @@ Upgrade Node, then re-run: npx lody@latest`;
|
|
|
2296
2296
|
return frames;
|
|
2297
2297
|
};
|
|
2298
2298
|
}
|
|
2299
|
-
const version$
|
|
2299
|
+
const version$a = "5.38.8";
|
|
2300
2300
|
const FeatureFlagError = {
|
|
2301
2301
|
ERRORS_WHILE_COMPUTING: "errors_while_computing_flags",
|
|
2302
2302
|
FLAG_MISSING: "flag_missing",
|
|
@@ -3474,7 +3474,7 @@ Upgrade Node, then re-run: npx lody@latest`;
|
|
|
3474
3474
|
return this.options.fetch ? this.options.fetch(url, options) : fetch(url, options);
|
|
3475
3475
|
}
|
|
3476
3476
|
getLibraryVersion() {
|
|
3477
|
-
return version$
|
|
3477
|
+
return version$a;
|
|
3478
3478
|
}
|
|
3479
3479
|
getCustomUserAgent() {
|
|
3480
3480
|
return `${this.getLibraryId()}/${this.getLibraryVersion()}`;
|
|
@@ -4324,7 +4324,7 @@ Upgrade Node, then re-run: npx lody@latest`;
|
|
|
4324
4324
|
}
|
|
4325
4325
|
const name$2 = "lody";
|
|
4326
4326
|
const name$1 = "@lody/cli-cloud";
|
|
4327
|
-
const version$
|
|
4327
|
+
const version$9 = "0.84.0";
|
|
4328
4328
|
const type$2 = "module";
|
|
4329
4329
|
const scripts = {
|
|
4330
4330
|
"dev": "node dev.mjs",
|
|
@@ -4341,7 +4341,7 @@ Upgrade Node, then re-run: npx lody@latest`;
|
|
|
4341
4341
|
};
|
|
4342
4342
|
const pkg = {
|
|
4343
4343
|
name: name$1,
|
|
4344
|
-
version: version$
|
|
4344
|
+
version: version$9,
|
|
4345
4345
|
"private": true,
|
|
4346
4346
|
type: type$2,
|
|
4347
4347
|
scripts,
|
|
@@ -14362,6 +14362,43 @@ Requirements:
|
|
|
14362
14362
|
}
|
|
14363
14363
|
}
|
|
14364
14364
|
},
|
|
14365
|
+
{
|
|
14366
|
+
id: "antigravity-acp",
|
|
14367
|
+
name: "Google Antigravity",
|
|
14368
|
+
version: "1.0.0",
|
|
14369
|
+
description: "Google\u2019s AI coding agent",
|
|
14370
|
+
icon: "https://cdn.agentclientprotocol.com/registry/v1/latest/antigravity-acp.svg",
|
|
14371
|
+
distribution: {
|
|
14372
|
+
binary: {
|
|
14373
|
+
"darwin-aarch64": {
|
|
14374
|
+
archive: "https://dl.google.com/agy-extensions/releases/macos/agy-acp-server-agy_acp_server_20260818_01_RC01-darwin-arm64.zip",
|
|
14375
|
+
cmd: "./agy_acp_server.par"
|
|
14376
|
+
},
|
|
14377
|
+
"linux-x86_64": {
|
|
14378
|
+
archive: "https://dl.google.com/agy-extensions/releases/linux/agy-acp-server-agy_acp_server_20260818_01_RC01-linux-x86_64.zip",
|
|
14379
|
+
cmd: "./agy_acp_server.par",
|
|
14380
|
+
args: [
|
|
14381
|
+
"--uid="
|
|
14382
|
+
]
|
|
14383
|
+
},
|
|
14384
|
+
"linux-aarch64": {
|
|
14385
|
+
archive: "https://dl.google.com/agy-extensions/releases/linux/agy-acp-server-agy_acp_server_20260818_01_RC01-linux-arm64.zip",
|
|
14386
|
+
cmd: "./agy_acp_server.par",
|
|
14387
|
+
args: [
|
|
14388
|
+
"--uid="
|
|
14389
|
+
]
|
|
14390
|
+
},
|
|
14391
|
+
"windows-x86_64": {
|
|
14392
|
+
archive: "https://dl.google.com/agy-extensions/releases/windows/agy-acp-server-agy_acp_server_20260818_01_RC01-windows-x86_64.zip",
|
|
14393
|
+
cmd: "./agy_acp_server.exe"
|
|
14394
|
+
},
|
|
14395
|
+
"windows-aarch64": {
|
|
14396
|
+
archive: "https://dl.google.com/agy-extensions/releases/windows/agy-acp-server-agy_acp_server_20260818_01_RC01-windows-arm64.zip",
|
|
14397
|
+
cmd: "./agy_acp_server.exe"
|
|
14398
|
+
}
|
|
14399
|
+
}
|
|
14400
|
+
}
|
|
14401
|
+
},
|
|
14365
14402
|
{
|
|
14366
14403
|
id: "auggie",
|
|
14367
14404
|
name: "Auggie CLI",
|
|
@@ -14410,12 +14447,12 @@ Requirements:
|
|
|
14410
14447
|
{
|
|
14411
14448
|
id: "codebuddy-code",
|
|
14412
14449
|
name: "Codebuddy Code",
|
|
14413
|
-
version: "2.
|
|
14450
|
+
version: "2.137.1",
|
|
14414
14451
|
description: "Tencent Cloud's official intelligent coding tool",
|
|
14415
14452
|
icon: "https://cdn.agentclientprotocol.com/registry/v1/latest/codebuddy-code.svg",
|
|
14416
14453
|
distribution: {
|
|
14417
14454
|
npx: {
|
|
14418
|
-
package: "@tencent-ai/codebuddy-code@2.
|
|
14455
|
+
package: "@tencent-ai/codebuddy-code@2.137.1",
|
|
14419
14456
|
args: [
|
|
14420
14457
|
"--acp"
|
|
14421
14458
|
]
|
|
@@ -14640,12 +14677,12 @@ Requirements:
|
|
|
14640
14677
|
{
|
|
14641
14678
|
id: "dimcode",
|
|
14642
14679
|
name: "DimCode",
|
|
14643
|
-
version: "0.3.
|
|
14680
|
+
version: "0.3.17",
|
|
14644
14681
|
description: "A coding agent that puts leading models at your command.",
|
|
14645
14682
|
icon: "https://cdn.agentclientprotocol.com/registry/v1/latest/dimcode.svg",
|
|
14646
14683
|
distribution: {
|
|
14647
14684
|
npx: {
|
|
14648
|
-
package: "dimcode@0.3.
|
|
14685
|
+
package: "dimcode@0.3.17",
|
|
14649
14686
|
args: [
|
|
14650
14687
|
"acp"
|
|
14651
14688
|
]
|
|
@@ -14670,12 +14707,12 @@ Requirements:
|
|
|
14670
14707
|
{
|
|
14671
14708
|
id: "factory-droid",
|
|
14672
14709
|
name: "Factory Droid",
|
|
14673
|
-
version: "0.
|
|
14710
|
+
version: "0.200.0",
|
|
14674
14711
|
description: "Factory Droid - AI coding agent powered by Factory AI",
|
|
14675
14712
|
icon: "https://cdn.agentclientprotocol.com/registry/v1/latest/factory-droid.svg",
|
|
14676
14713
|
distribution: {
|
|
14677
14714
|
npx: {
|
|
14678
|
-
package: "droid@0.
|
|
14715
|
+
package: "droid@0.200.0",
|
|
14679
14716
|
args: [
|
|
14680
14717
|
"exec",
|
|
14681
14718
|
"--output-format",
|
|
@@ -14709,12 +14746,12 @@ Requirements:
|
|
|
14709
14746
|
{
|
|
14710
14747
|
id: "gemini",
|
|
14711
14748
|
name: "Gemini CLI",
|
|
14712
|
-
version: "0.
|
|
14749
|
+
version: "0.56.0",
|
|
14713
14750
|
description: "Google's official CLI for Gemini",
|
|
14714
14751
|
icon: "https://cdn.agentclientprotocol.com/registry/v1/latest/gemini.svg",
|
|
14715
14752
|
distribution: {
|
|
14716
14753
|
npx: {
|
|
14717
|
-
package: "@google/gemini-cli@0.
|
|
14754
|
+
package: "@google/gemini-cli@0.56.0",
|
|
14718
14755
|
args: [
|
|
14719
14756
|
"--acp"
|
|
14720
14757
|
]
|
|
@@ -14739,12 +14776,12 @@ Requirements:
|
|
|
14739
14776
|
{
|
|
14740
14777
|
id: "glm-acp-agent",
|
|
14741
14778
|
name: "GLM Agent",
|
|
14742
|
-
version: "1.
|
|
14779
|
+
version: "1.6.0",
|
|
14743
14780
|
description: "ACP agent powered by Zhipu AI's GLM Coding Plan models (glm-5.1, glm-5-turbo, glm-4.7, glm-4.5-air). Supports streaming, tool calls, mid-session model switching, image input via Z.AI Coding Plan Vision MCP, and session load/fork/resume with on-disk persistence.",
|
|
14744
14781
|
icon: "https://cdn.agentclientprotocol.com/registry/v1/latest/glm-acp-agent.svg",
|
|
14745
14782
|
distribution: {
|
|
14746
14783
|
npx: {
|
|
14747
|
-
package: "glm-acp-agent@1.
|
|
14784
|
+
package: "glm-acp-agent@1.6.0"
|
|
14748
14785
|
}
|
|
14749
14786
|
}
|
|
14750
14787
|
},
|
|
@@ -14769,13 +14806,13 @@ Requirements:
|
|
|
14769
14806
|
{
|
|
14770
14807
|
id: "harn",
|
|
14771
14808
|
name: "Harn",
|
|
14772
|
-
version: "0.10.
|
|
14809
|
+
version: "0.10.108",
|
|
14773
14810
|
description: "Harn runs .harn agent pipelines as a native ACP coding agent over stdio.",
|
|
14774
14811
|
icon: "https://cdn.agentclientprotocol.com/registry/v1/latest/harn.svg",
|
|
14775
14812
|
distribution: {
|
|
14776
14813
|
binary: {
|
|
14777
14814
|
"darwin-aarch64": {
|
|
14778
|
-
archive: "https://github.com/burin-labs/harn/releases/download/v0.10.
|
|
14815
|
+
archive: "https://github.com/burin-labs/harn/releases/download/v0.10.108/harn-aarch64-apple-darwin.tar.gz",
|
|
14779
14816
|
cmd: "./harn",
|
|
14780
14817
|
args: [
|
|
14781
14818
|
"serve",
|
|
@@ -14783,7 +14820,7 @@ Requirements:
|
|
|
14783
14820
|
]
|
|
14784
14821
|
},
|
|
14785
14822
|
"darwin-x86_64": {
|
|
14786
|
-
archive: "https://github.com/burin-labs/harn/releases/download/v0.10.
|
|
14823
|
+
archive: "https://github.com/burin-labs/harn/releases/download/v0.10.108/harn-x86_64-apple-darwin.tar.gz",
|
|
14787
14824
|
cmd: "./harn",
|
|
14788
14825
|
args: [
|
|
14789
14826
|
"serve",
|
|
@@ -14791,7 +14828,7 @@ Requirements:
|
|
|
14791
14828
|
]
|
|
14792
14829
|
},
|
|
14793
14830
|
"linux-aarch64": {
|
|
14794
|
-
archive: "https://github.com/burin-labs/harn/releases/download/v0.10.
|
|
14831
|
+
archive: "https://github.com/burin-labs/harn/releases/download/v0.10.108/harn-aarch64-unknown-linux-gnu.tar.gz",
|
|
14795
14832
|
cmd: "./harn",
|
|
14796
14833
|
args: [
|
|
14797
14834
|
"serve",
|
|
@@ -14799,7 +14836,7 @@ Requirements:
|
|
|
14799
14836
|
]
|
|
14800
14837
|
},
|
|
14801
14838
|
"linux-x86_64": {
|
|
14802
|
-
archive: "https://github.com/burin-labs/harn/releases/download/v0.10.
|
|
14839
|
+
archive: "https://github.com/burin-labs/harn/releases/download/v0.10.108/harn-x86_64-unknown-linux-gnu.tar.gz",
|
|
14803
14840
|
cmd: "./harn",
|
|
14804
14841
|
args: [
|
|
14805
14842
|
"serve",
|
|
@@ -14807,7 +14844,7 @@ Requirements:
|
|
|
14807
14844
|
]
|
|
14808
14845
|
},
|
|
14809
14846
|
"windows-x86_64": {
|
|
14810
|
-
archive: "https://github.com/burin-labs/harn/releases/download/v0.10.
|
|
14847
|
+
archive: "https://github.com/burin-labs/harn/releases/download/v0.10.108/harn-x86_64-pc-windows-msvc.zip",
|
|
14811
14848
|
cmd: "harn.exe",
|
|
14812
14849
|
args: [
|
|
14813
14850
|
"serve",
|
|
@@ -14820,7 +14857,7 @@ Requirements:
|
|
|
14820
14857
|
{
|
|
14821
14858
|
id: "junie",
|
|
14822
14859
|
name: "Junie",
|
|
14823
|
-
version: "
|
|
14860
|
+
version: "2913.6.0",
|
|
14824
14861
|
description: "AI Coding Agent by JetBrains",
|
|
14825
14862
|
icon: "https://cdn.agentclientprotocol.com/registry/v1/latest/junie.svg",
|
|
14826
14863
|
distribution: {
|
|
@@ -14838,47 +14875,47 @@ Requirements:
|
|
|
14838
14875
|
{
|
|
14839
14876
|
id: "kilo",
|
|
14840
14877
|
name: "Kilo",
|
|
14841
|
-
version: "7.4.
|
|
14878
|
+
version: "7.4.23",
|
|
14842
14879
|
description: "The open source coding agent",
|
|
14843
14880
|
icon: "https://cdn.agentclientprotocol.com/registry/v1/latest/kilo.svg",
|
|
14844
14881
|
distribution: {
|
|
14845
14882
|
npx: {
|
|
14846
|
-
package: "@kilocode/cli@7.4.
|
|
14883
|
+
package: "@kilocode/cli@7.4.23",
|
|
14847
14884
|
args: [
|
|
14848
14885
|
"acp"
|
|
14849
14886
|
]
|
|
14850
14887
|
},
|
|
14851
14888
|
binary: {
|
|
14852
14889
|
"darwin-aarch64": {
|
|
14853
|
-
archive: "https://github.com/Kilo-Org/kilocode/releases/download/v7.4.
|
|
14890
|
+
archive: "https://github.com/Kilo-Org/kilocode/releases/download/v7.4.23/kilo-darwin-arm64.zip",
|
|
14854
14891
|
cmd: "./kilo",
|
|
14855
14892
|
args: [
|
|
14856
14893
|
"acp"
|
|
14857
14894
|
]
|
|
14858
14895
|
},
|
|
14859
14896
|
"darwin-x86_64": {
|
|
14860
|
-
archive: "https://github.com/Kilo-Org/kilocode/releases/download/v7.4.
|
|
14897
|
+
archive: "https://github.com/Kilo-Org/kilocode/releases/download/v7.4.23/kilo-darwin-x64.zip",
|
|
14861
14898
|
cmd: "./kilo",
|
|
14862
14899
|
args: [
|
|
14863
14900
|
"acp"
|
|
14864
14901
|
]
|
|
14865
14902
|
},
|
|
14866
14903
|
"linux-aarch64": {
|
|
14867
|
-
archive: "https://github.com/Kilo-Org/kilocode/releases/download/v7.4.
|
|
14904
|
+
archive: "https://github.com/Kilo-Org/kilocode/releases/download/v7.4.23/kilo-linux-arm64.tar.gz",
|
|
14868
14905
|
cmd: "./kilo",
|
|
14869
14906
|
args: [
|
|
14870
14907
|
"acp"
|
|
14871
14908
|
]
|
|
14872
14909
|
},
|
|
14873
14910
|
"linux-x86_64": {
|
|
14874
|
-
archive: "https://github.com/Kilo-Org/kilocode/releases/download/v7.4.
|
|
14911
|
+
archive: "https://github.com/Kilo-Org/kilocode/releases/download/v7.4.23/kilo-linux-x64.tar.gz",
|
|
14875
14912
|
cmd: "./kilo",
|
|
14876
14913
|
args: [
|
|
14877
14914
|
"acp"
|
|
14878
14915
|
]
|
|
14879
14916
|
},
|
|
14880
14917
|
"windows-x86_64": {
|
|
14881
|
-
archive: "https://github.com/Kilo-Org/kilocode/releases/download/v7.4.
|
|
14918
|
+
archive: "https://github.com/Kilo-Org/kilocode/releases/download/v7.4.23/kilo-windows-x64.zip",
|
|
14882
14919
|
cmd: "./kilo.exe",
|
|
14883
14920
|
args: [
|
|
14884
14921
|
"acp"
|
|
@@ -14975,7 +15012,7 @@ Requirements:
|
|
|
14975
15012
|
{
|
|
14976
15013
|
id: "opencode",
|
|
14977
15014
|
name: "OpenCode",
|
|
14978
|
-
version: "1.18.
|
|
15015
|
+
version: "1.18.19",
|
|
14979
15016
|
description: "The open source coding agent",
|
|
14980
15017
|
icon: "https://cdn.agentclientprotocol.com/registry/v1/latest/opencode.svg",
|
|
14981
15018
|
distribution: {
|
|
@@ -15073,12 +15110,12 @@ Requirements:
|
|
|
15073
15110
|
{
|
|
15074
15111
|
id: "qwen-code",
|
|
15075
15112
|
name: "Qwen Code",
|
|
15076
|
-
version: "0.21.
|
|
15113
|
+
version: "0.21.15",
|
|
15077
15114
|
description: "Alibaba's Qwen coding assistant",
|
|
15078
15115
|
icon: "https://cdn.agentclientprotocol.com/registry/v1/latest/qwen-code.svg",
|
|
15079
15116
|
distribution: {
|
|
15080
15117
|
npx: {
|
|
15081
|
-
package: "@qwen-code/qwen-code@0.21.
|
|
15118
|
+
package: "@qwen-code/qwen-code@0.21.15",
|
|
15082
15119
|
args: [
|
|
15083
15120
|
"--acp",
|
|
15084
15121
|
"--experimental-skills"
|
|
@@ -24068,907 +24105,6 @@ ${context2.authorReply.trim()}
|
|
|
24068
24105
|
}
|
|
24069
24106
|
return bytes;
|
|
24070
24107
|
}
|
|
24071
|
-
const scheduleDataWorkNextTurn = (work) => {
|
|
24072
|
-
const handle = setTimeout(work, 0);
|
|
24073
|
-
return () => clearTimeout(handle);
|
|
24074
|
-
};
|
|
24075
|
-
const createLocalLoroDataPlaneScheduler = (scheduleTurn = scheduleDataWorkNextTurn) => {
|
|
24076
|
-
const queue2 = [];
|
|
24077
|
-
let running2 = false;
|
|
24078
|
-
let cancelScheduledTurn = null;
|
|
24079
|
-
const takeNext = () => {
|
|
24080
|
-
for (; ; ) {
|
|
24081
|
-
const work = queue2.shift();
|
|
24082
|
-
if (!work) return null;
|
|
24083
|
-
if (!work.cancelled) return work;
|
|
24084
|
-
}
|
|
24085
|
-
};
|
|
24086
|
-
const requestRun = () => {
|
|
24087
|
-
if (running2 || cancelScheduledTurn || queue2.length === 0) return;
|
|
24088
|
-
cancelScheduledTurn = scheduleTurn(() => {
|
|
24089
|
-
cancelScheduledTurn = null;
|
|
24090
|
-
const work = takeNext();
|
|
24091
|
-
if (!work) {
|
|
24092
|
-
return;
|
|
24093
|
-
}
|
|
24094
|
-
running2 = true;
|
|
24095
|
-
void Promise.resolve().then(work.run).finally(() => {
|
|
24096
|
-
running2 = false;
|
|
24097
|
-
requestRun();
|
|
24098
|
-
});
|
|
24099
|
-
});
|
|
24100
|
-
};
|
|
24101
|
-
return {
|
|
24102
|
-
scheduleDataWork: (run2) => {
|
|
24103
|
-
const work = {
|
|
24104
|
-
run: run2,
|
|
24105
|
-
cancelled: false
|
|
24106
|
-
};
|
|
24107
|
-
queue2.push(work);
|
|
24108
|
-
requestRun();
|
|
24109
|
-
return () => {
|
|
24110
|
-
work.cancelled = true;
|
|
24111
|
-
};
|
|
24112
|
-
}
|
|
24113
|
-
};
|
|
24114
|
-
};
|
|
24115
|
-
function syncTaskKey(key2, peerId) {
|
|
24116
|
-
return `${key2}
|
|
24117
|
-
${peerId}`;
|
|
24118
|
-
}
|
|
24119
|
-
class LocalLoroDataPlaneServer {
|
|
24120
|
-
constructor(options) {
|
|
24121
|
-
this.options = options;
|
|
24122
|
-
this.scheduler = options.scheduler ?? createLocalLoroDataPlaneScheduler();
|
|
24123
|
-
this.docRoomJoinHandler = options.onDocRoomJoin ?? null;
|
|
24124
|
-
this.docRoomLeaveHandler = options.onDocRoomLeave ?? null;
|
|
24125
|
-
this.flockRoomJoinHandler = options.onFlockRoomJoin ?? null;
|
|
24126
|
-
this.flockRoomLeaveHandler = options.onFlockRoomLeave ?? null;
|
|
24127
|
-
if (options.presenceSource) {
|
|
24128
|
-
this.presenceUnsubscribe = options.presenceSource.subscribeLocalOrigin(() => this.broadcastPresence());
|
|
24129
|
-
}
|
|
24130
|
-
if (options.machineMonitorSource) {
|
|
24131
|
-
this.machineMonitorUnsubscribe = options.machineMonitorSource.subscribe(() => this.broadcastMachineMonitor());
|
|
24132
|
-
}
|
|
24133
|
-
}
|
|
24134
|
-
rooms = /* @__PURE__ */ new Map();
|
|
24135
|
-
resolveInFlight = /* @__PURE__ */ new Map();
|
|
24136
|
-
roomGenerations = /* @__PURE__ */ new Map();
|
|
24137
|
-
presenceReceivers = /* @__PURE__ */ new Map();
|
|
24138
|
-
machineMonitorReceivers = /* @__PURE__ */ new Map();
|
|
24139
|
-
writers = /* @__PURE__ */ new Map();
|
|
24140
|
-
presenceUnsubscribe = null;
|
|
24141
|
-
machineMonitorUnsubscribe = null;
|
|
24142
|
-
docRoomJoinHandler = null;
|
|
24143
|
-
docRoomLeaveHandler = null;
|
|
24144
|
-
flockRoomJoinHandler = null;
|
|
24145
|
-
flockRoomLeaveHandler = null;
|
|
24146
|
-
scheduler;
|
|
24147
|
-
disposed = false;
|
|
24148
|
-
setDocRoomJoinHandler(handler) {
|
|
24149
|
-
this.docRoomJoinHandler = handler;
|
|
24150
|
-
}
|
|
24151
|
-
setDocRoomLeaveHandler(handler) {
|
|
24152
|
-
this.docRoomLeaveHandler = handler;
|
|
24153
|
-
}
|
|
24154
|
-
setFlockRoomJoinHandler(handler) {
|
|
24155
|
-
this.flockRoomJoinHandler = handler;
|
|
24156
|
-
}
|
|
24157
|
-
setFlockRoomLeaveHandler(handler) {
|
|
24158
|
-
this.flockRoomLeaveHandler = handler;
|
|
24159
|
-
}
|
|
24160
|
-
publishRoomStatus(room, status) {
|
|
24161
|
-
const entry = this.rooms.get(roomKey(room));
|
|
24162
|
-
if (!entry) {
|
|
24163
|
-
return;
|
|
24164
|
-
}
|
|
24165
|
-
for (const subscriber of entry.subscribers.values()) {
|
|
24166
|
-
this.enqueueMessage(subscriber.connection, {
|
|
24167
|
-
type: "room-status",
|
|
24168
|
-
protocolVersion: LOCAL_LORO_DATA_PLANE_PROTOCOL_VERSION,
|
|
24169
|
-
workspaceId: this.options.workspaceId,
|
|
24170
|
-
peerId: subscriber.peerId,
|
|
24171
|
-
room,
|
|
24172
|
-
status
|
|
24173
|
-
});
|
|
24174
|
-
}
|
|
24175
|
-
}
|
|
24176
|
-
invalidateDocRoom(docId) {
|
|
24177
|
-
const room = {
|
|
24178
|
-
scope: "doc",
|
|
24179
|
-
docId
|
|
24180
|
-
};
|
|
24181
|
-
const key2 = roomKey(room);
|
|
24182
|
-
this.roomGenerations.set(key2, (this.roomGenerations.get(key2) ?? 0) + 1);
|
|
24183
|
-
const entry = this.rooms.get(key2);
|
|
24184
|
-
if (!entry || entry.scope !== "doc") {
|
|
24185
|
-
return;
|
|
24186
|
-
}
|
|
24187
|
-
this.dropQueuedRoomWork(key2);
|
|
24188
|
-
this.publishRoomStatus(room, "disconnected");
|
|
24189
|
-
entry.unsubscribe();
|
|
24190
|
-
entry.subscribers.clear();
|
|
24191
|
-
entry.uploadAssemblers.clear();
|
|
24192
|
-
this.rooms.delete(key2);
|
|
24193
|
-
}
|
|
24194
|
-
dropQueuedRoomWork(key2) {
|
|
24195
|
-
for (const writer of this.writers.values()) {
|
|
24196
|
-
writer.queue = writer.queue.filter((task) => !((task.kind === "sync" || task.kind === "join-reply") && task.roomKey === key2));
|
|
24197
|
-
for (const taskKey of [
|
|
24198
|
-
...writer.queuedSyncKeys
|
|
24199
|
-
]) {
|
|
24200
|
-
if (taskKey.startsWith(`${key2}
|
|
24201
|
-
`)) {
|
|
24202
|
-
writer.queuedSyncKeys.delete(taskKey);
|
|
24203
|
-
}
|
|
24204
|
-
}
|
|
24205
|
-
}
|
|
24206
|
-
}
|
|
24207
|
-
get maxPayloadBytes() {
|
|
24208
|
-
return this.options.maxPayloadBytes ?? LOCAL_LORO_DATA_PLANE_MAX_PAYLOAD_BYTES;
|
|
24209
|
-
}
|
|
24210
|
-
async handleMessage(connection2, message) {
|
|
24211
|
-
if (this.disposed) {
|
|
24212
|
-
this.sendError(connection2, {
|
|
24213
|
-
code: "workspace_runtime_unavailable",
|
|
24214
|
-
peerId: message.peerId,
|
|
24215
|
-
requestId: message.type === "join" ? message.requestId : void 0
|
|
24216
|
-
});
|
|
24217
|
-
return;
|
|
24218
|
-
}
|
|
24219
|
-
if (message.workspaceId !== this.options.workspaceId) {
|
|
24220
|
-
this.sendError(connection2, {
|
|
24221
|
-
code: "workspace_mismatch",
|
|
24222
|
-
peerId: message.peerId,
|
|
24223
|
-
requestId: message.type === "join" ? message.requestId : void 0
|
|
24224
|
-
});
|
|
24225
|
-
return;
|
|
24226
|
-
}
|
|
24227
|
-
try {
|
|
24228
|
-
this.registerPresenceReceiver(connection2);
|
|
24229
|
-
switch (message.type) {
|
|
24230
|
-
case "join":
|
|
24231
|
-
await this.handleJoin(connection2, message);
|
|
24232
|
-
return;
|
|
24233
|
-
case "update":
|
|
24234
|
-
await this.handleUpdate(connection2, message);
|
|
24235
|
-
return;
|
|
24236
|
-
case "leave":
|
|
24237
|
-
this.unsubscribePeer(message.peerId, roomKey(message.room));
|
|
24238
|
-
return;
|
|
24239
|
-
case "detach":
|
|
24240
|
-
this.detachPeer(message.peerId);
|
|
24241
|
-
return;
|
|
24242
|
-
case "machine-monitor":
|
|
24243
|
-
this.registerMachineMonitorReceiver(connection2);
|
|
24244
|
-
this.options.machineMonitorSource?.apply(base64ToBytes(message.dataBase64));
|
|
24245
|
-
return;
|
|
24246
|
-
}
|
|
24247
|
-
} catch (error2) {
|
|
24248
|
-
this.options.onError?.(error2, `handleMessage:${message.type}`);
|
|
24249
|
-
this.sendError(connection2, {
|
|
24250
|
-
code: "data_plane_error",
|
|
24251
|
-
message: errorMessage(error2),
|
|
24252
|
-
peerId: message.peerId,
|
|
24253
|
-
requestId: message.type === "join" ? message.requestId : void 0,
|
|
24254
|
-
room: "room" in message ? message.room : void 0
|
|
24255
|
-
});
|
|
24256
|
-
}
|
|
24257
|
-
}
|
|
24258
|
-
registerPresenceReceiver(connection2) {
|
|
24259
|
-
if (!this.options.presenceSource || this.presenceReceivers.has(connection2.id)) {
|
|
24260
|
-
return;
|
|
24261
|
-
}
|
|
24262
|
-
this.presenceReceivers.set(connection2.id, connection2);
|
|
24263
|
-
this.enqueuePresence(connection2);
|
|
24264
|
-
}
|
|
24265
|
-
broadcastPresence() {
|
|
24266
|
-
if (this.disposed) {
|
|
24267
|
-
return;
|
|
24268
|
-
}
|
|
24269
|
-
for (const connection2 of this.presenceReceivers.values()) {
|
|
24270
|
-
this.enqueuePresence(connection2);
|
|
24271
|
-
}
|
|
24272
|
-
}
|
|
24273
|
-
registerMachineMonitorReceiver(connection2) {
|
|
24274
|
-
if (!this.options.machineMonitorSource || this.machineMonitorReceivers.has(connection2.id)) {
|
|
24275
|
-
return;
|
|
24276
|
-
}
|
|
24277
|
-
this.machineMonitorReceivers.set(connection2.id, connection2);
|
|
24278
|
-
this.enqueueMachineMonitor(connection2);
|
|
24279
|
-
}
|
|
24280
|
-
broadcastMachineMonitor() {
|
|
24281
|
-
if (this.disposed) return;
|
|
24282
|
-
for (const connection2 of this.machineMonitorReceivers.values()) {
|
|
24283
|
-
this.enqueueMachineMonitor(connection2);
|
|
24284
|
-
}
|
|
24285
|
-
}
|
|
24286
|
-
dispose() {
|
|
24287
|
-
this.disposed = true;
|
|
24288
|
-
this.presenceUnsubscribe?.();
|
|
24289
|
-
this.presenceUnsubscribe = null;
|
|
24290
|
-
this.machineMonitorUnsubscribe?.();
|
|
24291
|
-
this.machineMonitorUnsubscribe = null;
|
|
24292
|
-
this.presenceReceivers.clear();
|
|
24293
|
-
this.machineMonitorReceivers.clear();
|
|
24294
|
-
for (const entry of this.rooms.values()) {
|
|
24295
|
-
entry.unsubscribe();
|
|
24296
|
-
this.notifyDocRoomLeave(entry.room);
|
|
24297
|
-
this.notifyFlockRoomLeave(entry.room);
|
|
24298
|
-
entry.subscribers.clear();
|
|
24299
|
-
}
|
|
24300
|
-
this.rooms.clear();
|
|
24301
|
-
this.roomGenerations.clear();
|
|
24302
|
-
for (const writer of this.writers.values()) {
|
|
24303
|
-
this.cancelScheduledDataPump(writer);
|
|
24304
|
-
writer.unsubscribeDrain?.();
|
|
24305
|
-
writer.queue.length = 0;
|
|
24306
|
-
writer.pendingFrames.length = 0;
|
|
24307
|
-
}
|
|
24308
|
-
this.writers.clear();
|
|
24309
|
-
}
|
|
24310
|
-
handleDisconnect(connectionId) {
|
|
24311
|
-
this.presenceReceivers.delete(connectionId);
|
|
24312
|
-
this.machineMonitorReceivers.delete(connectionId);
|
|
24313
|
-
const writer = this.writers.get(connectionId);
|
|
24314
|
-
if (writer) {
|
|
24315
|
-
this.cancelScheduledDataPump(writer);
|
|
24316
|
-
writer.unsubscribeDrain?.();
|
|
24317
|
-
writer.queue.length = 0;
|
|
24318
|
-
writer.pendingFrames.length = 0;
|
|
24319
|
-
this.writers.delete(connectionId);
|
|
24320
|
-
}
|
|
24321
|
-
for (const key2 of [
|
|
24322
|
-
...this.rooms.keys()
|
|
24323
|
-
]) {
|
|
24324
|
-
const entry = this.rooms.get(key2);
|
|
24325
|
-
if (!entry) {
|
|
24326
|
-
continue;
|
|
24327
|
-
}
|
|
24328
|
-
for (const [peerId, subscriber] of [
|
|
24329
|
-
...entry.subscribers
|
|
24330
|
-
]) {
|
|
24331
|
-
if (subscriber.connection.id === connectionId) {
|
|
24332
|
-
entry.subscribers.delete(peerId);
|
|
24333
|
-
if (entry.scope === "doc") {
|
|
24334
|
-
entry.uploadAssemblers.delete(peerId);
|
|
24335
|
-
}
|
|
24336
|
-
}
|
|
24337
|
-
}
|
|
24338
|
-
this.releaseRoomIfEmpty(key2, entry);
|
|
24339
|
-
}
|
|
24340
|
-
}
|
|
24341
|
-
detachPeer(peerId) {
|
|
24342
|
-
for (const key2 of [
|
|
24343
|
-
...this.rooms.keys()
|
|
24344
|
-
]) {
|
|
24345
|
-
this.unsubscribePeer(peerId, key2);
|
|
24346
|
-
}
|
|
24347
|
-
}
|
|
24348
|
-
async handleJoin(connection2, message) {
|
|
24349
|
-
const key2 = roomKey(message.room);
|
|
24350
|
-
for (; ; ) {
|
|
24351
|
-
const entry = await this.ensureRoom(message.room);
|
|
24352
|
-
if (this.rooms.get(key2) !== entry) {
|
|
24353
|
-
continue;
|
|
24354
|
-
}
|
|
24355
|
-
if (entry.scope === "doc") {
|
|
24356
|
-
entry.subscribers.set(message.peerId, {
|
|
24357
|
-
peerId: message.peerId,
|
|
24358
|
-
connection: connection2,
|
|
24359
|
-
latestJoinRequestId: message.requestId,
|
|
24360
|
-
lastSentVV: decodeVersion(message.haveVersion)
|
|
24361
|
-
});
|
|
24362
|
-
} else {
|
|
24363
|
-
entry.subscribers.set(message.peerId, {
|
|
24364
|
-
peerId: message.peerId,
|
|
24365
|
-
connection: connection2,
|
|
24366
|
-
latestJoinRequestId: message.requestId,
|
|
24367
|
-
lastSentVersion: decodeFlockVersion(message.haveVersion)
|
|
24368
|
-
});
|
|
24369
|
-
}
|
|
24370
|
-
this.enqueueJoinReply(connection2, key2, message.peerId, message.requestId);
|
|
24371
|
-
if (message.room.scope === "doc") {
|
|
24372
|
-
this.notifyDocRoomJoin(message.room.docId);
|
|
24373
|
-
} else if (message.room.scope === "flock-doc") {
|
|
24374
|
-
this.notifyFlockRoomJoin(message.room.flockDocId);
|
|
24375
|
-
}
|
|
24376
|
-
return;
|
|
24377
|
-
}
|
|
24378
|
-
}
|
|
24379
|
-
notifyDocRoomJoin(docId) {
|
|
24380
|
-
if (!this.docRoomJoinHandler) {
|
|
24381
|
-
return;
|
|
24382
|
-
}
|
|
24383
|
-
void Promise.resolve(this.docRoomJoinHandler(docId)).catch((error2) => {
|
|
24384
|
-
this.options.onError?.(error2, "onDocRoomJoin");
|
|
24385
|
-
});
|
|
24386
|
-
}
|
|
24387
|
-
notifyFlockRoomJoin(flockDocId) {
|
|
24388
|
-
if (!this.flockRoomJoinHandler) {
|
|
24389
|
-
return;
|
|
24390
|
-
}
|
|
24391
|
-
void Promise.resolve(this.flockRoomJoinHandler(flockDocId)).catch((error2) => {
|
|
24392
|
-
this.options.onError?.(error2, "onFlockRoomJoin");
|
|
24393
|
-
});
|
|
24394
|
-
}
|
|
24395
|
-
notifyDocRoomLeave(room) {
|
|
24396
|
-
if (room.scope !== "doc" || !this.docRoomLeaveHandler) {
|
|
24397
|
-
return;
|
|
24398
|
-
}
|
|
24399
|
-
void Promise.resolve(this.docRoomLeaveHandler(room.docId)).catch((error2) => {
|
|
24400
|
-
this.options.onError?.(error2, "onDocRoomLeave");
|
|
24401
|
-
});
|
|
24402
|
-
}
|
|
24403
|
-
notifyFlockRoomLeave(room) {
|
|
24404
|
-
if (room.scope !== "flock-doc" || !this.flockRoomLeaveHandler) {
|
|
24405
|
-
return;
|
|
24406
|
-
}
|
|
24407
|
-
void Promise.resolve(this.flockRoomLeaveHandler(room.flockDocId)).catch((error2) => {
|
|
24408
|
-
this.options.onError?.(error2, "onFlockRoomLeave");
|
|
24409
|
-
});
|
|
24410
|
-
}
|
|
24411
|
-
async handleUpdate(connection2, message) {
|
|
24412
|
-
const key2 = roomKey(message.room);
|
|
24413
|
-
let entry = await this.ensureRoom(message.room);
|
|
24414
|
-
while (this.rooms.get(key2) !== entry) {
|
|
24415
|
-
entry = await this.ensureRoom(message.room);
|
|
24416
|
-
}
|
|
24417
|
-
if (entry.scope === "doc") {
|
|
24418
|
-
if (message.payload.kind === "flock-json") {
|
|
24419
|
-
this.sendError(connection2, {
|
|
24420
|
-
code: "payload_kind_mismatch",
|
|
24421
|
-
message: "expected doc-update",
|
|
24422
|
-
peerId: message.peerId,
|
|
24423
|
-
room: message.room
|
|
24424
|
-
});
|
|
24425
|
-
return;
|
|
24426
|
-
}
|
|
24427
|
-
let dataBase64;
|
|
24428
|
-
if (message.payload.kind === "doc-update") {
|
|
24429
|
-
entry.uploadAssemblers.delete(message.peerId);
|
|
24430
|
-
dataBase64 = message.payload.dataBase64;
|
|
24431
|
-
} else {
|
|
24432
|
-
let assembler = entry.uploadAssemblers.get(message.peerId);
|
|
24433
|
-
if (!assembler) {
|
|
24434
|
-
assembler = new DocUpdateChunkAssembler();
|
|
24435
|
-
entry.uploadAssemblers.set(message.peerId, assembler);
|
|
24436
|
-
}
|
|
24437
|
-
dataBase64 = assembler.push(message.payload);
|
|
24438
|
-
if (dataBase64 === null) {
|
|
24439
|
-
return;
|
|
24440
|
-
}
|
|
24441
|
-
entry.uploadAssemblers.delete(message.peerId);
|
|
24442
|
-
}
|
|
24443
|
-
const subscriber2 = entry.subscribers.get(message.peerId);
|
|
24444
|
-
if (subscriber2) {
|
|
24445
|
-
subscriber2.lastSentVV = decodeVersion(message.haveVersion);
|
|
24446
|
-
}
|
|
24447
|
-
entry.doc.import(base64ToBytes(dataBase64));
|
|
24448
|
-
return;
|
|
24449
|
-
}
|
|
24450
|
-
if (message.payload.kind !== "flock-json") {
|
|
24451
|
-
this.sendError(connection2, {
|
|
24452
|
-
code: "payload_kind_mismatch",
|
|
24453
|
-
message: "expected flock-json",
|
|
24454
|
-
peerId: message.peerId,
|
|
24455
|
-
room: message.room
|
|
24456
|
-
});
|
|
24457
|
-
return;
|
|
24458
|
-
}
|
|
24459
|
-
const subscriber = entry.subscribers.get(message.peerId);
|
|
24460
|
-
if (subscriber) {
|
|
24461
|
-
subscriber.lastSentVersion = mergeFlockVersions(subscriber.lastSentVersion, decodeFlockVersion(message.haveVersion));
|
|
24462
|
-
}
|
|
24463
|
-
await entry.flock.importJson(message.payload.bundle);
|
|
24464
|
-
entry.flock.commit?.();
|
|
24465
|
-
}
|
|
24466
|
-
async ensureRoom(room) {
|
|
24467
|
-
const key2 = roomKey(room);
|
|
24468
|
-
for (; ; ) {
|
|
24469
|
-
const existing = this.rooms.get(key2);
|
|
24470
|
-
if (existing) {
|
|
24471
|
-
return existing;
|
|
24472
|
-
}
|
|
24473
|
-
const inFlight = this.resolveInFlight.get(key2);
|
|
24474
|
-
if (inFlight) {
|
|
24475
|
-
const shared = await inFlight;
|
|
24476
|
-
if (shared) {
|
|
24477
|
-
return shared;
|
|
24478
|
-
}
|
|
24479
|
-
continue;
|
|
24480
|
-
}
|
|
24481
|
-
const generation = this.roomGenerations.get(key2) ?? 0;
|
|
24482
|
-
const build = (async () => {
|
|
24483
|
-
const entry = room.scope === "doc" ? await this.buildDocRoom(room, room.docId) : await this.buildFlockRoom(room, await this.resolveFlockForRoom(room));
|
|
24484
|
-
if (this.disposed) {
|
|
24485
|
-
entry.unsubscribe();
|
|
24486
|
-
throw new Error("data_plane_engine_disposed");
|
|
24487
|
-
}
|
|
24488
|
-
if ((this.roomGenerations.get(key2) ?? 0) !== generation) {
|
|
24489
|
-
entry.unsubscribe();
|
|
24490
|
-
return null;
|
|
24491
|
-
}
|
|
24492
|
-
this.rooms.set(key2, entry);
|
|
24493
|
-
return entry;
|
|
24494
|
-
})().finally(() => this.resolveInFlight.delete(key2));
|
|
24495
|
-
this.resolveInFlight.set(key2, build);
|
|
24496
|
-
const resolved = await build;
|
|
24497
|
-
if (resolved) {
|
|
24498
|
-
return resolved;
|
|
24499
|
-
}
|
|
24500
|
-
}
|
|
24501
|
-
}
|
|
24502
|
-
async buildDocRoom(room, docId) {
|
|
24503
|
-
const doc = await this.options.resolveDoc(docId);
|
|
24504
|
-
const entry = {
|
|
24505
|
-
scope: "doc",
|
|
24506
|
-
room,
|
|
24507
|
-
doc,
|
|
24508
|
-
unsubscribe: () => {
|
|
24509
|
-
},
|
|
24510
|
-
subscribers: /* @__PURE__ */ new Map(),
|
|
24511
|
-
uploadAssemblers: /* @__PURE__ */ new Map()
|
|
24512
|
-
};
|
|
24513
|
-
entry.unsubscribe = doc.subscribe(() => this.markRoomDirty(entry));
|
|
24514
|
-
return entry;
|
|
24515
|
-
}
|
|
24516
|
-
resolveFlockForRoom(room) {
|
|
24517
|
-
if (room.scope === "flock-doc") {
|
|
24518
|
-
return this.options.resolveFlockDoc(room.flockDocId);
|
|
24519
|
-
}
|
|
24520
|
-
return this.options.resolveMetaFlock ? this.options.resolveMetaFlock() : this.options.resolveFlockDoc("meta");
|
|
24521
|
-
}
|
|
24522
|
-
async buildFlockRoom(room, flock) {
|
|
24523
|
-
const entry = {
|
|
24524
|
-
scope: "flock",
|
|
24525
|
-
room,
|
|
24526
|
-
flock,
|
|
24527
|
-
unsubscribe: () => {
|
|
24528
|
-
},
|
|
24529
|
-
subscribers: /* @__PURE__ */ new Map()
|
|
24530
|
-
};
|
|
24531
|
-
entry.unsubscribe = flock.subscribe(() => this.markRoomDirty(entry));
|
|
24532
|
-
return entry;
|
|
24533
|
-
}
|
|
24534
|
-
markRoomDirty(entry) {
|
|
24535
|
-
if (this.disposed) {
|
|
24536
|
-
return;
|
|
24537
|
-
}
|
|
24538
|
-
const key2 = roomKey(entry.room);
|
|
24539
|
-
for (const subscriber of entry.subscribers.values()) {
|
|
24540
|
-
this.enqueueSync(subscriber.connection, key2, subscriber.peerId);
|
|
24541
|
-
}
|
|
24542
|
-
this.releaseRoomIfEmpty(key2, entry);
|
|
24543
|
-
}
|
|
24544
|
-
writerFor(connection2) {
|
|
24545
|
-
const existing = this.writers.get(connection2.id);
|
|
24546
|
-
if (existing) {
|
|
24547
|
-
return existing;
|
|
24548
|
-
}
|
|
24549
|
-
const writer = {
|
|
24550
|
-
connection: connection2,
|
|
24551
|
-
queue: [],
|
|
24552
|
-
queuedSyncKeys: /* @__PURE__ */ new Set(),
|
|
24553
|
-
presenceQueued: false,
|
|
24554
|
-
machineMonitorQueued: false,
|
|
24555
|
-
pendingFrames: [],
|
|
24556
|
-
pumping: false,
|
|
24557
|
-
pumpScheduled: false,
|
|
24558
|
-
cancelScheduledPump: null,
|
|
24559
|
-
blocked: false,
|
|
24560
|
-
unsubscribeDrain: null
|
|
24561
|
-
};
|
|
24562
|
-
writer.unsubscribeDrain = connection2.onDrain?.(() => {
|
|
24563
|
-
writer.blocked = false;
|
|
24564
|
-
this.scheduleDataPump(writer);
|
|
24565
|
-
}) ?? null;
|
|
24566
|
-
this.writers.set(connection2.id, writer);
|
|
24567
|
-
return writer;
|
|
24568
|
-
}
|
|
24569
|
-
enqueueMessage(connection2, message) {
|
|
24570
|
-
const writer = this.writerFor(connection2);
|
|
24571
|
-
writer.queue.push({
|
|
24572
|
-
kind: "message",
|
|
24573
|
-
message
|
|
24574
|
-
});
|
|
24575
|
-
this.scheduleDataPump(writer);
|
|
24576
|
-
}
|
|
24577
|
-
enqueueJoinReply(connection2, key2, peerId, requestId) {
|
|
24578
|
-
const writer = this.writerFor(connection2);
|
|
24579
|
-
writer.queue.push({
|
|
24580
|
-
kind: "join-reply",
|
|
24581
|
-
roomKey: key2,
|
|
24582
|
-
peerId,
|
|
24583
|
-
requestId
|
|
24584
|
-
});
|
|
24585
|
-
this.scheduleDataPump(writer);
|
|
24586
|
-
}
|
|
24587
|
-
enqueueSync(connection2, key2, peerId) {
|
|
24588
|
-
const writer = this.writerFor(connection2);
|
|
24589
|
-
const taskKey = syncTaskKey(key2, peerId);
|
|
24590
|
-
if (writer.queuedSyncKeys.has(taskKey)) {
|
|
24591
|
-
return;
|
|
24592
|
-
}
|
|
24593
|
-
writer.queuedSyncKeys.add(taskKey);
|
|
24594
|
-
writer.queue.push({
|
|
24595
|
-
kind: "sync",
|
|
24596
|
-
roomKey: key2,
|
|
24597
|
-
peerId
|
|
24598
|
-
});
|
|
24599
|
-
this.scheduleDataPump(writer);
|
|
24600
|
-
}
|
|
24601
|
-
enqueuePresence(connection2) {
|
|
24602
|
-
const writer = this.writerFor(connection2);
|
|
24603
|
-
if (writer.presenceQueued) {
|
|
24604
|
-
return;
|
|
24605
|
-
}
|
|
24606
|
-
writer.presenceQueued = true;
|
|
24607
|
-
writer.queue.push({
|
|
24608
|
-
kind: "presence"
|
|
24609
|
-
});
|
|
24610
|
-
this.scheduleDataPump(writer);
|
|
24611
|
-
}
|
|
24612
|
-
enqueueMachineMonitor(connection2) {
|
|
24613
|
-
const writer = this.writerFor(connection2);
|
|
24614
|
-
if (writer.machineMonitorQueued) return;
|
|
24615
|
-
writer.machineMonitorQueued = true;
|
|
24616
|
-
writer.queue.push({
|
|
24617
|
-
kind: "machine-monitor"
|
|
24618
|
-
});
|
|
24619
|
-
this.scheduleDataPump(writer);
|
|
24620
|
-
}
|
|
24621
|
-
isWriterActive(writer) {
|
|
24622
|
-
return !this.disposed && this.writers.get(writer.connection.id) === writer;
|
|
24623
|
-
}
|
|
24624
|
-
cancelScheduledDataPump(writer) {
|
|
24625
|
-
writer.cancelScheduledPump?.();
|
|
24626
|
-
writer.cancelScheduledPump = null;
|
|
24627
|
-
writer.pumpScheduled = false;
|
|
24628
|
-
}
|
|
24629
|
-
hasPendingDataWork(writer) {
|
|
24630
|
-
return writer.pendingFrames.length > 0 || writer.queue.length > 0;
|
|
24631
|
-
}
|
|
24632
|
-
scheduleDataPump(writer) {
|
|
24633
|
-
if (!this.isWriterActive(writer) || writer.blocked || writer.pumping || writer.pumpScheduled || !this.hasPendingDataWork(writer)) {
|
|
24634
|
-
return;
|
|
24635
|
-
}
|
|
24636
|
-
writer.pumpScheduled = true;
|
|
24637
|
-
writer.cancelScheduledPump = this.scheduler.scheduleDataWork(() => {
|
|
24638
|
-
writer.pumpScheduled = false;
|
|
24639
|
-
writer.cancelScheduledPump = null;
|
|
24640
|
-
return this.pumpWriter(writer).catch((error2) => {
|
|
24641
|
-
this.options.onError?.(error2, "pumpWriter");
|
|
24642
|
-
});
|
|
24643
|
-
});
|
|
24644
|
-
}
|
|
24645
|
-
async pumpWriter(writer) {
|
|
24646
|
-
if (!this.isWriterActive(writer) || writer.pumping || writer.blocked) {
|
|
24647
|
-
return;
|
|
24648
|
-
}
|
|
24649
|
-
writer.pumping = true;
|
|
24650
|
-
try {
|
|
24651
|
-
const pendingFrame = writer.pendingFrames.shift();
|
|
24652
|
-
if (pendingFrame) {
|
|
24653
|
-
this.writeFrame(writer, pendingFrame);
|
|
24654
|
-
return;
|
|
24655
|
-
}
|
|
24656
|
-
const task = writer.queue.shift();
|
|
24657
|
-
if (!task) {
|
|
24658
|
-
return;
|
|
24659
|
-
}
|
|
24660
|
-
if (task.kind === "sync") {
|
|
24661
|
-
writer.queuedSyncKeys.delete(syncTaskKey(task.roomKey, task.peerId));
|
|
24662
|
-
} else if (task.kind === "presence") {
|
|
24663
|
-
writer.presenceQueued = false;
|
|
24664
|
-
} else if (task.kind === "machine-monitor") {
|
|
24665
|
-
writer.machineMonitorQueued = false;
|
|
24666
|
-
}
|
|
24667
|
-
try {
|
|
24668
|
-
const frames = await this.buildFrames(writer, task);
|
|
24669
|
-
if (!this.isWriterActive(writer)) return;
|
|
24670
|
-
writer.pendingFrames.push(...frames);
|
|
24671
|
-
} catch (error2) {
|
|
24672
|
-
this.options.onError?.(error2, `buildFrames:${task.kind}`);
|
|
24673
|
-
}
|
|
24674
|
-
if (!this.isWriterActive(writer) || writer.blocked) {
|
|
24675
|
-
return;
|
|
24676
|
-
}
|
|
24677
|
-
const firstFrame = writer.pendingFrames.shift();
|
|
24678
|
-
if (firstFrame) {
|
|
24679
|
-
this.writeFrame(writer, firstFrame);
|
|
24680
|
-
}
|
|
24681
|
-
} finally {
|
|
24682
|
-
writer.pumping = false;
|
|
24683
|
-
if (this.isWriterActive(writer)) {
|
|
24684
|
-
this.scheduleDataPump(writer);
|
|
24685
|
-
}
|
|
24686
|
-
}
|
|
24687
|
-
}
|
|
24688
|
-
writeFrame(writer, frame2) {
|
|
24689
|
-
const accepted = writer.connection.send(frame2);
|
|
24690
|
-
if (accepted === false && writer.unsubscribeDrain) {
|
|
24691
|
-
writer.blocked = true;
|
|
24692
|
-
}
|
|
24693
|
-
}
|
|
24694
|
-
async buildFrames(writer, task) {
|
|
24695
|
-
switch (task.kind) {
|
|
24696
|
-
case "message":
|
|
24697
|
-
return [
|
|
24698
|
-
task.message
|
|
24699
|
-
];
|
|
24700
|
-
case "presence": {
|
|
24701
|
-
const source = this.options.presenceSource;
|
|
24702
|
-
if (!source) {
|
|
24703
|
-
return [];
|
|
24704
|
-
}
|
|
24705
|
-
const encoded = source.encodeLocalOrigin();
|
|
24706
|
-
if (encoded.length === 0) {
|
|
24707
|
-
return [];
|
|
24708
|
-
}
|
|
24709
|
-
return [
|
|
24710
|
-
{
|
|
24711
|
-
type: "presence",
|
|
24712
|
-
protocolVersion: LOCAL_LORO_DATA_PLANE_PROTOCOL_VERSION,
|
|
24713
|
-
workspaceId: this.options.workspaceId,
|
|
24714
|
-
dataBase64: bytesToBase64(encoded)
|
|
24715
|
-
}
|
|
24716
|
-
];
|
|
24717
|
-
}
|
|
24718
|
-
case "machine-monitor": {
|
|
24719
|
-
const source = this.options.machineMonitorSource;
|
|
24720
|
-
if (!source) return [];
|
|
24721
|
-
const encoded = source.encodeAll();
|
|
24722
|
-
if (encoded.length === 0) return [];
|
|
24723
|
-
return [
|
|
24724
|
-
{
|
|
24725
|
-
type: "machine-monitor",
|
|
24726
|
-
protocolVersion: LOCAL_LORO_DATA_PLANE_PROTOCOL_VERSION,
|
|
24727
|
-
workspaceId: this.options.workspaceId,
|
|
24728
|
-
dataBase64: bytesToBase64(encoded)
|
|
24729
|
-
}
|
|
24730
|
-
];
|
|
24731
|
-
}
|
|
24732
|
-
case "join-reply":
|
|
24733
|
-
return await this.buildJoinReplyFrames(writer, task);
|
|
24734
|
-
case "sync":
|
|
24735
|
-
return await this.buildSyncFrames(writer, task.roomKey, task.peerId, null);
|
|
24736
|
-
}
|
|
24737
|
-
const exhaustive = task;
|
|
24738
|
-
throw new Error(`Unsupported local data-plane writer task: ${String(exhaustive)}`);
|
|
24739
|
-
}
|
|
24740
|
-
async buildJoinReplyFrames(writer, task) {
|
|
24741
|
-
const entry = this.rooms.get(task.roomKey);
|
|
24742
|
-
if (!entry) {
|
|
24743
|
-
return [];
|
|
24744
|
-
}
|
|
24745
|
-
const subscriber = entry.subscribers.get(task.peerId);
|
|
24746
|
-
if (!subscriber || subscriber.connection.id !== writer.connection.id) {
|
|
24747
|
-
return [];
|
|
24748
|
-
}
|
|
24749
|
-
if (subscriber.latestJoinRequestId !== task.requestId) {
|
|
24750
|
-
return [];
|
|
24751
|
-
}
|
|
24752
|
-
return await this.buildSyncFrames(writer, task.roomKey, task.peerId, task.requestId);
|
|
24753
|
-
}
|
|
24754
|
-
async buildSyncFrames(writer, key2, peerId, joinRequestId) {
|
|
24755
|
-
const entry = this.rooms.get(key2);
|
|
24756
|
-
if (!entry) {
|
|
24757
|
-
return [];
|
|
24758
|
-
}
|
|
24759
|
-
const subscriber = entry.subscribers.get(peerId);
|
|
24760
|
-
if (!subscriber || subscriber.connection.id !== writer.connection.id) {
|
|
24761
|
-
return [];
|
|
24762
|
-
}
|
|
24763
|
-
if (entry.scope === "doc") {
|
|
24764
|
-
const docSubscriber = subscriber;
|
|
24765
|
-
const serverVV = entry.doc.oplogVersion();
|
|
24766
|
-
const delta = entry.doc.export({
|
|
24767
|
-
mode: "update",
|
|
24768
|
-
from: docSubscriber.lastSentVV
|
|
24769
|
-
});
|
|
24770
|
-
const serverVersion2 = bytesToBase64(serverVV.encode());
|
|
24771
|
-
const dataBase64 = delta.length > 0 ? bytesToBase64(delta) : null;
|
|
24772
|
-
docSubscriber.lastSentVV = serverVV;
|
|
24773
|
-
if (dataBase64 && dataBase64.length > this.maxPayloadBytes) {
|
|
24774
|
-
const chunkPayloads = buildDocUpdateChunkPayloads(dataBase64, this.maxPayloadBytes, createDocUpdateTransferId());
|
|
24775
|
-
const frames2 = [];
|
|
24776
|
-
if (joinRequestId !== null) {
|
|
24777
|
-
frames2.push({
|
|
24778
|
-
type: "joined",
|
|
24779
|
-
protocolVersion: LOCAL_LORO_DATA_PLANE_PROTOCOL_VERSION,
|
|
24780
|
-
workspaceId: this.options.workspaceId,
|
|
24781
|
-
peerId,
|
|
24782
|
-
requestId: joinRequestId,
|
|
24783
|
-
room: entry.room,
|
|
24784
|
-
serverVersion: serverVersion2
|
|
24785
|
-
});
|
|
24786
|
-
}
|
|
24787
|
-
for (const payload of chunkPayloads) {
|
|
24788
|
-
frames2.push({
|
|
24789
|
-
type: "update",
|
|
24790
|
-
protocolVersion: LOCAL_LORO_DATA_PLANE_PROTOCOL_VERSION,
|
|
24791
|
-
workspaceId: this.options.workspaceId,
|
|
24792
|
-
peerId,
|
|
24793
|
-
room: entry.room,
|
|
24794
|
-
serverVersion: serverVersion2,
|
|
24795
|
-
payload
|
|
24796
|
-
});
|
|
24797
|
-
}
|
|
24798
|
-
return frames2;
|
|
24799
|
-
}
|
|
24800
|
-
if (joinRequestId !== null) {
|
|
24801
|
-
return [
|
|
24802
|
-
{
|
|
24803
|
-
type: "joined",
|
|
24804
|
-
protocolVersion: LOCAL_LORO_DATA_PLANE_PROTOCOL_VERSION,
|
|
24805
|
-
workspaceId: this.options.workspaceId,
|
|
24806
|
-
peerId,
|
|
24807
|
-
requestId: joinRequestId,
|
|
24808
|
-
room: entry.room,
|
|
24809
|
-
serverVersion: serverVersion2,
|
|
24810
|
-
...dataBase64 ? {
|
|
24811
|
-
payload: {
|
|
24812
|
-
kind: "doc-update",
|
|
24813
|
-
dataBase64
|
|
24814
|
-
}
|
|
24815
|
-
} : {}
|
|
24816
|
-
}
|
|
24817
|
-
];
|
|
24818
|
-
}
|
|
24819
|
-
if (!dataBase64) {
|
|
24820
|
-
return [];
|
|
24821
|
-
}
|
|
24822
|
-
return [
|
|
24823
|
-
{
|
|
24824
|
-
type: "update",
|
|
24825
|
-
protocolVersion: LOCAL_LORO_DATA_PLANE_PROTOCOL_VERSION,
|
|
24826
|
-
workspaceId: this.options.workspaceId,
|
|
24827
|
-
peerId,
|
|
24828
|
-
room: entry.room,
|
|
24829
|
-
serverVersion: serverVersion2,
|
|
24830
|
-
payload: {
|
|
24831
|
-
kind: "doc-update",
|
|
24832
|
-
dataBase64
|
|
24833
|
-
}
|
|
24834
|
-
}
|
|
24835
|
-
];
|
|
24836
|
-
}
|
|
24837
|
-
const flockSubscriber = subscriber;
|
|
24838
|
-
const have = entry.flock.version();
|
|
24839
|
-
const bundle = await entry.flock.exportJson(flockSubscriber.lastSentVersion);
|
|
24840
|
-
const currentEntry = this.rooms.get(key2);
|
|
24841
|
-
const currentSubscriber = currentEntry?.scope === "flock" ? currentEntry.subscribers.get(peerId) : void 0;
|
|
24842
|
-
if (currentEntry !== entry || currentSubscriber !== flockSubscriber || currentSubscriber.connection.id !== writer.connection.id || joinRequestId !== null && currentSubscriber.latestJoinRequestId !== joinRequestId) {
|
|
24843
|
-
return [];
|
|
24844
|
-
}
|
|
24845
|
-
flockSubscriber.lastSentVersion = mergeFlockVersions(flockSubscriber.lastSentVersion, have);
|
|
24846
|
-
const serverVersion = encodeFlockVersion(have);
|
|
24847
|
-
if (isEmptyFlockBundle(bundle)) {
|
|
24848
|
-
if (joinRequestId !== null) {
|
|
24849
|
-
return [
|
|
24850
|
-
{
|
|
24851
|
-
type: "joined",
|
|
24852
|
-
protocolVersion: LOCAL_LORO_DATA_PLANE_PROTOCOL_VERSION,
|
|
24853
|
-
workspaceId: this.options.workspaceId,
|
|
24854
|
-
peerId,
|
|
24855
|
-
requestId: joinRequestId,
|
|
24856
|
-
room: entry.room,
|
|
24857
|
-
serverVersion
|
|
24858
|
-
}
|
|
24859
|
-
];
|
|
24860
|
-
}
|
|
24861
|
-
return [];
|
|
24862
|
-
}
|
|
24863
|
-
const chunks = chunkFlockBundle(bundle, this.maxPayloadBytes);
|
|
24864
|
-
if (!chunks) {
|
|
24865
|
-
entry.subscribers.delete(peerId);
|
|
24866
|
-
this.releaseRoomIfEmpty(key2, entry);
|
|
24867
|
-
return [
|
|
24868
|
-
this.payloadTooLargeError(peerId, entry.room, joinRequestId ?? void 0)
|
|
24869
|
-
];
|
|
24870
|
-
}
|
|
24871
|
-
const frames = [];
|
|
24872
|
-
for (const [index, chunk] of chunks.entries()) {
|
|
24873
|
-
if (joinRequestId !== null && index === 0) {
|
|
24874
|
-
frames.push({
|
|
24875
|
-
type: "joined",
|
|
24876
|
-
protocolVersion: LOCAL_LORO_DATA_PLANE_PROTOCOL_VERSION,
|
|
24877
|
-
workspaceId: this.options.workspaceId,
|
|
24878
|
-
peerId,
|
|
24879
|
-
requestId: joinRequestId,
|
|
24880
|
-
room: entry.room,
|
|
24881
|
-
serverVersion,
|
|
24882
|
-
payload: {
|
|
24883
|
-
kind: "flock-json",
|
|
24884
|
-
bundle: chunk
|
|
24885
|
-
}
|
|
24886
|
-
});
|
|
24887
|
-
continue;
|
|
24888
|
-
}
|
|
24889
|
-
frames.push({
|
|
24890
|
-
type: "update",
|
|
24891
|
-
protocolVersion: LOCAL_LORO_DATA_PLANE_PROTOCOL_VERSION,
|
|
24892
|
-
workspaceId: this.options.workspaceId,
|
|
24893
|
-
peerId,
|
|
24894
|
-
room: entry.room,
|
|
24895
|
-
serverVersion,
|
|
24896
|
-
payload: {
|
|
24897
|
-
kind: "flock-json",
|
|
24898
|
-
bundle: chunk
|
|
24899
|
-
}
|
|
24900
|
-
});
|
|
24901
|
-
}
|
|
24902
|
-
return frames;
|
|
24903
|
-
}
|
|
24904
|
-
payloadTooLargeError(peerId, room, requestId) {
|
|
24905
|
-
return {
|
|
24906
|
-
type: "error",
|
|
24907
|
-
protocolVersion: LOCAL_LORO_DATA_PLANE_PROTOCOL_VERSION,
|
|
24908
|
-
workspaceId: this.options.workspaceId,
|
|
24909
|
-
code: LOCAL_LORO_DATA_PLANE_PAYLOAD_TOO_LARGE,
|
|
24910
|
-
message: "sync payload exceeds the local data-plane frame budget",
|
|
24911
|
-
peerId,
|
|
24912
|
-
room,
|
|
24913
|
-
...requestId ? {
|
|
24914
|
-
requestId
|
|
24915
|
-
} : {},
|
|
24916
|
-
terminal: true
|
|
24917
|
-
};
|
|
24918
|
-
}
|
|
24919
|
-
unsubscribePeer(peerId, key2) {
|
|
24920
|
-
const entry = this.rooms.get(key2);
|
|
24921
|
-
if (!entry) {
|
|
24922
|
-
return;
|
|
24923
|
-
}
|
|
24924
|
-
entry.subscribers.delete(peerId);
|
|
24925
|
-
if (entry.scope === "doc") {
|
|
24926
|
-
entry.uploadAssemblers.delete(peerId);
|
|
24927
|
-
}
|
|
24928
|
-
this.releaseRoomIfEmpty(key2, entry);
|
|
24929
|
-
}
|
|
24930
|
-
releaseRoomIfEmpty(key2, entry) {
|
|
24931
|
-
if (entry.subscribers.size > 0 || this.rooms.get(key2) !== entry) {
|
|
24932
|
-
return;
|
|
24933
|
-
}
|
|
24934
|
-
entry.unsubscribe();
|
|
24935
|
-
this.rooms.delete(key2);
|
|
24936
|
-
this.notifyDocRoomLeave(entry.room);
|
|
24937
|
-
this.notifyFlockRoomLeave(entry.room);
|
|
24938
|
-
}
|
|
24939
|
-
sendError(connection2, error2) {
|
|
24940
|
-
this.enqueueMessage(connection2, {
|
|
24941
|
-
type: "error",
|
|
24942
|
-
protocolVersion: LOCAL_LORO_DATA_PLANE_PROTOCOL_VERSION,
|
|
24943
|
-
workspaceId: this.options.workspaceId,
|
|
24944
|
-
code: error2.code,
|
|
24945
|
-
...error2.message ? {
|
|
24946
|
-
message: error2.message
|
|
24947
|
-
} : {},
|
|
24948
|
-
...error2.peerId ? {
|
|
24949
|
-
peerId: error2.peerId
|
|
24950
|
-
} : {},
|
|
24951
|
-
...error2.requestId ? {
|
|
24952
|
-
requestId: error2.requestId
|
|
24953
|
-
} : {},
|
|
24954
|
-
...error2.room ? {
|
|
24955
|
-
room: error2.room
|
|
24956
|
-
} : {},
|
|
24957
|
-
...error2.terminal ? {
|
|
24958
|
-
terminal: true
|
|
24959
|
-
} : {}
|
|
24960
|
-
});
|
|
24961
|
-
}
|
|
24962
|
-
}
|
|
24963
|
-
function decodeVersion(encoded) {
|
|
24964
|
-
if (!encoded) {
|
|
24965
|
-
return new VersionVector(null);
|
|
24966
|
-
}
|
|
24967
|
-
return VersionVector.decode(base64ToBytes(encoded));
|
|
24968
|
-
}
|
|
24969
|
-
function errorMessage(error2) {
|
|
24970
|
-
return error2 instanceof Error ? error2.message : String(error2);
|
|
24971
|
-
}
|
|
24972
24108
|
const DEFAULT_SAMPLE_RATES = {
|
|
24973
24109
|
A: 1,
|
|
24974
24110
|
B: 1,
|
|
@@ -25608,7 +24744,7 @@ ${peerId}`;
|
|
|
25608
24744
|
}
|
|
25609
24745
|
const runtimeEnv = getRuntimeEnv();
|
|
25610
24746
|
const apiKey = resolveApiKey();
|
|
25611
|
-
const release = `${name$2}@${version$
|
|
24747
|
+
const release = `${name$2}@${version$9}`;
|
|
25612
24748
|
const distinctId = resolveDistinctId();
|
|
25613
24749
|
const errorReportingEnabled = runtimeEnv !== "dev" && !!apiKey;
|
|
25614
24750
|
let client$1 = null;
|
|
@@ -25620,9 +24756,9 @@ ${peerId}`;
|
|
|
25620
24756
|
}
|
|
25621
24757
|
const baseExceptionProps = {
|
|
25622
24758
|
$lib: "lody-cli",
|
|
25623
|
-
$lib_version: version$
|
|
24759
|
+
$lib_version: version$9,
|
|
25624
24760
|
platform: "cli",
|
|
25625
|
-
app_version: version$
|
|
24761
|
+
app_version: version$9,
|
|
25626
24762
|
env: runtimeEnv,
|
|
25627
24763
|
release,
|
|
25628
24764
|
machine_id: distinctId
|
|
@@ -26314,7 +25450,7 @@ ${peerId}`;
|
|
|
26314
25450
|
if (hasRequiredCommand$1) return command$1;
|
|
26315
25451
|
hasRequiredCommand$1 = 1;
|
|
26316
25452
|
const EventEmitter2 = require$$0$4.EventEmitter;
|
|
26317
|
-
const childProcess =
|
|
25453
|
+
const childProcess = LE__default;
|
|
26318
25454
|
const path2 = path__default;
|
|
26319
25455
|
const fs2 = fs__default$1;
|
|
26320
25456
|
const process2 = process$2;
|
|
@@ -31232,9 +30368,9 @@ ${originalIndentation}`;
|
|
|
31232
30368
|
})(common$2);
|
|
31233
30369
|
return common$2;
|
|
31234
30370
|
}
|
|
31235
|
-
const version$
|
|
30371
|
+
const version$8 = "3.19.0";
|
|
31236
30372
|
const require$$2$3 = {
|
|
31237
|
-
version: version$
|
|
30373
|
+
version: version$8
|
|
31238
30374
|
};
|
|
31239
30375
|
var transports = {};
|
|
31240
30376
|
var winstonTransport = {
|
|
@@ -31256,7 +30392,7 @@ ${originalIndentation}`;
|
|
|
31256
30392
|
function requireStream$3() {
|
|
31257
30393
|
if (hasRequiredStream$3) return stream$3;
|
|
31258
30394
|
hasRequiredStream$3 = 1;
|
|
31259
|
-
stream$3 =
|
|
30395
|
+
stream$3 = Zr;
|
|
31260
30396
|
return stream$3;
|
|
31261
30397
|
}
|
|
31262
30398
|
var destroy_1;
|
|
@@ -34847,7 +33983,7 @@ ${originalIndentation}`;
|
|
|
34847
33983
|
if (hasRequiredReadable$1) return readable$1.exports;
|
|
34848
33984
|
hasRequiredReadable$1 = 1;
|
|
34849
33985
|
(function(module2, exports$1) {
|
|
34850
|
-
var Stream =
|
|
33986
|
+
var Stream = Zr;
|
|
34851
33987
|
if (process.env.READABLE_STREAM === "disable" && Stream) {
|
|
34852
33988
|
module2.exports = Stream.Readable;
|
|
34853
33989
|
Object.assign(module2.exports, Stream);
|
|
@@ -37621,7 +36757,7 @@ ${originalIndentation}`;
|
|
|
37621
36757
|
if (hasRequiredDevelopment) return development;
|
|
37622
36758
|
hasRequiredDevelopment = 1;
|
|
37623
36759
|
var create = requireDiagnostics$1();
|
|
37624
|
-
var tty2 = require$$1$
|
|
36760
|
+
var tty2 = require$$1$2.isatty(1);
|
|
37625
36761
|
var diagnostics2 = create(function dev(namespace, options) {
|
|
37626
36762
|
options = options || {};
|
|
37627
36763
|
options.colors = "colors" in options ? options.colors : tty2;
|
|
@@ -37656,7 +36792,7 @@ ${originalIndentation}`;
|
|
|
37656
36792
|
if (hasRequiredTailFile) return tailFile;
|
|
37657
36793
|
hasRequiredTailFile = 1;
|
|
37658
36794
|
const fs2 = fs__default;
|
|
37659
|
-
const { StringDecoder: StringDecoder2 } = require$$1$
|
|
36795
|
+
const { StringDecoder: StringDecoder2 } = require$$1$3;
|
|
37660
36796
|
const { Stream } = requireReadable$1();
|
|
37661
36797
|
function noop2() {
|
|
37662
36798
|
}
|
|
@@ -37753,7 +36889,7 @@ ${originalIndentation}`;
|
|
|
37753
36889
|
const fs2 = fs__default;
|
|
37754
36890
|
const path2 = path__default$1;
|
|
37755
36891
|
const asyncSeries = requireSeries();
|
|
37756
|
-
const zlib =
|
|
36892
|
+
const zlib = $s__default;
|
|
37757
36893
|
const { MESSAGE } = requireTripleBeam();
|
|
37758
36894
|
const { Stream, PassThrough: PassThrough2 } = requireReadable$1();
|
|
37759
36895
|
const TransportStream = requireWinstonTransport();
|
|
@@ -44690,10 +43826,10 @@ ${originalIndentation}`;
|
|
|
44690
43826
|
const os2 = os__default$1;
|
|
44691
43827
|
const path2 = path__default$1;
|
|
44692
43828
|
const util2 = require$$0$5;
|
|
44693
|
-
const zlib =
|
|
43829
|
+
const zlib = $s__default;
|
|
44694
43830
|
const hash2 = requireObjectHash();
|
|
44695
43831
|
const MESSAGE = requireTripleBeam().MESSAGE;
|
|
44696
|
-
const PassThrough2 =
|
|
43832
|
+
const PassThrough2 = Zr.PassThrough;
|
|
44697
43833
|
const Transport = requireWinstonTransport();
|
|
44698
43834
|
const loggerDefaults = {
|
|
44699
43835
|
json: false,
|
|
@@ -45145,7 +44281,7 @@ ${value.slice(value.length - safeTailChars)}`;
|
|
|
45145
44281
|
return files;
|
|
45146
44282
|
}
|
|
45147
44283
|
async function readDailyLogFile(file2) {
|
|
45148
|
-
const raw2 = await
|
|
44284
|
+
const raw2 = await jt__default.readFile(file2.path);
|
|
45149
44285
|
if (!file2.compressed) return raw2.toString("utf8");
|
|
45150
44286
|
return (await gunzip(raw2)).toString("utf8");
|
|
45151
44287
|
}
|
|
@@ -63849,6 +62985,907 @@ ${this.stack.split("\n").slice(1).join("\n")}` : this.toString();
|
|
|
63849
62985
|
function getDisableValidationMakeOption(options) {
|
|
63850
62986
|
return isBoolean(options) ? options : options?.disableValidation ?? false;
|
|
63851
62987
|
}
|
|
62988
|
+
const scheduleDataWorkNextTurn = (work) => {
|
|
62989
|
+
const handle = setTimeout(work, 0);
|
|
62990
|
+
return () => clearTimeout(handle);
|
|
62991
|
+
};
|
|
62992
|
+
const createLocalLoroDataPlaneScheduler = (scheduleTurn = scheduleDataWorkNextTurn) => {
|
|
62993
|
+
const queue2 = [];
|
|
62994
|
+
let running2 = false;
|
|
62995
|
+
let cancelScheduledTurn = null;
|
|
62996
|
+
const takeNext = () => {
|
|
62997
|
+
for (; ; ) {
|
|
62998
|
+
const work = queue2.shift();
|
|
62999
|
+
if (!work) return null;
|
|
63000
|
+
if (!work.cancelled) return work;
|
|
63001
|
+
}
|
|
63002
|
+
};
|
|
63003
|
+
const requestRun = () => {
|
|
63004
|
+
if (running2 || cancelScheduledTurn || queue2.length === 0) return;
|
|
63005
|
+
cancelScheduledTurn = scheduleTurn(() => {
|
|
63006
|
+
cancelScheduledTurn = null;
|
|
63007
|
+
const work = takeNext();
|
|
63008
|
+
if (!work) {
|
|
63009
|
+
return;
|
|
63010
|
+
}
|
|
63011
|
+
running2 = true;
|
|
63012
|
+
void Promise.resolve().then(work.run).finally(() => {
|
|
63013
|
+
running2 = false;
|
|
63014
|
+
requestRun();
|
|
63015
|
+
});
|
|
63016
|
+
});
|
|
63017
|
+
};
|
|
63018
|
+
return {
|
|
63019
|
+
scheduleDataWork: (run2) => {
|
|
63020
|
+
const work = {
|
|
63021
|
+
run: run2,
|
|
63022
|
+
cancelled: false
|
|
63023
|
+
};
|
|
63024
|
+
queue2.push(work);
|
|
63025
|
+
requestRun();
|
|
63026
|
+
return () => {
|
|
63027
|
+
work.cancelled = true;
|
|
63028
|
+
};
|
|
63029
|
+
}
|
|
63030
|
+
};
|
|
63031
|
+
};
|
|
63032
|
+
function syncTaskKey(key2, peerId) {
|
|
63033
|
+
return `${key2}
|
|
63034
|
+
${peerId}`;
|
|
63035
|
+
}
|
|
63036
|
+
class LocalLoroDataPlaneServer {
|
|
63037
|
+
constructor(options) {
|
|
63038
|
+
this.options = options;
|
|
63039
|
+
this.scheduler = options.scheduler ?? createLocalLoroDataPlaneScheduler();
|
|
63040
|
+
this.docRoomJoinHandler = options.onDocRoomJoin ?? null;
|
|
63041
|
+
this.docRoomLeaveHandler = options.onDocRoomLeave ?? null;
|
|
63042
|
+
this.flockRoomJoinHandler = options.onFlockRoomJoin ?? null;
|
|
63043
|
+
this.flockRoomLeaveHandler = options.onFlockRoomLeave ?? null;
|
|
63044
|
+
if (options.presenceSource) {
|
|
63045
|
+
this.presenceUnsubscribe = options.presenceSource.subscribeLocalOrigin(() => this.broadcastPresence());
|
|
63046
|
+
}
|
|
63047
|
+
if (options.machineMonitorSource) {
|
|
63048
|
+
this.machineMonitorUnsubscribe = options.machineMonitorSource.subscribe(() => this.broadcastMachineMonitor());
|
|
63049
|
+
}
|
|
63050
|
+
}
|
|
63051
|
+
rooms = /* @__PURE__ */ new Map();
|
|
63052
|
+
resolveInFlight = /* @__PURE__ */ new Map();
|
|
63053
|
+
roomGenerations = /* @__PURE__ */ new Map();
|
|
63054
|
+
presenceReceivers = /* @__PURE__ */ new Map();
|
|
63055
|
+
machineMonitorReceivers = /* @__PURE__ */ new Map();
|
|
63056
|
+
writers = /* @__PURE__ */ new Map();
|
|
63057
|
+
presenceUnsubscribe = null;
|
|
63058
|
+
machineMonitorUnsubscribe = null;
|
|
63059
|
+
docRoomJoinHandler = null;
|
|
63060
|
+
docRoomLeaveHandler = null;
|
|
63061
|
+
flockRoomJoinHandler = null;
|
|
63062
|
+
flockRoomLeaveHandler = null;
|
|
63063
|
+
scheduler;
|
|
63064
|
+
disposed = false;
|
|
63065
|
+
setDocRoomJoinHandler(handler) {
|
|
63066
|
+
this.docRoomJoinHandler = handler;
|
|
63067
|
+
}
|
|
63068
|
+
setDocRoomLeaveHandler(handler) {
|
|
63069
|
+
this.docRoomLeaveHandler = handler;
|
|
63070
|
+
}
|
|
63071
|
+
setFlockRoomJoinHandler(handler) {
|
|
63072
|
+
this.flockRoomJoinHandler = handler;
|
|
63073
|
+
}
|
|
63074
|
+
setFlockRoomLeaveHandler(handler) {
|
|
63075
|
+
this.flockRoomLeaveHandler = handler;
|
|
63076
|
+
}
|
|
63077
|
+
publishRoomStatus(room, status) {
|
|
63078
|
+
const entry = this.rooms.get(roomKey(room));
|
|
63079
|
+
if (!entry) {
|
|
63080
|
+
return;
|
|
63081
|
+
}
|
|
63082
|
+
for (const subscriber of entry.subscribers.values()) {
|
|
63083
|
+
this.enqueueMessage(subscriber.connection, {
|
|
63084
|
+
type: "room-status",
|
|
63085
|
+
protocolVersion: LOCAL_LORO_DATA_PLANE_PROTOCOL_VERSION,
|
|
63086
|
+
workspaceId: this.options.workspaceId,
|
|
63087
|
+
peerId: subscriber.peerId,
|
|
63088
|
+
room,
|
|
63089
|
+
status
|
|
63090
|
+
});
|
|
63091
|
+
}
|
|
63092
|
+
}
|
|
63093
|
+
invalidateDocRoom(docId) {
|
|
63094
|
+
const room = {
|
|
63095
|
+
scope: "doc",
|
|
63096
|
+
docId
|
|
63097
|
+
};
|
|
63098
|
+
const key2 = roomKey(room);
|
|
63099
|
+
this.roomGenerations.set(key2, (this.roomGenerations.get(key2) ?? 0) + 1);
|
|
63100
|
+
const entry = this.rooms.get(key2);
|
|
63101
|
+
if (!entry || entry.scope !== "doc") {
|
|
63102
|
+
return;
|
|
63103
|
+
}
|
|
63104
|
+
this.dropQueuedRoomWork(key2);
|
|
63105
|
+
this.publishRoomStatus(room, "disconnected");
|
|
63106
|
+
entry.unsubscribe();
|
|
63107
|
+
entry.subscribers.clear();
|
|
63108
|
+
entry.uploadAssemblers.clear();
|
|
63109
|
+
this.rooms.delete(key2);
|
|
63110
|
+
}
|
|
63111
|
+
dropQueuedRoomWork(key2) {
|
|
63112
|
+
for (const writer of this.writers.values()) {
|
|
63113
|
+
writer.queue = writer.queue.filter((task) => !((task.kind === "sync" || task.kind === "join-reply") && task.roomKey === key2));
|
|
63114
|
+
for (const taskKey of [
|
|
63115
|
+
...writer.queuedSyncKeys
|
|
63116
|
+
]) {
|
|
63117
|
+
if (taskKey.startsWith(`${key2}
|
|
63118
|
+
`)) {
|
|
63119
|
+
writer.queuedSyncKeys.delete(taskKey);
|
|
63120
|
+
}
|
|
63121
|
+
}
|
|
63122
|
+
}
|
|
63123
|
+
}
|
|
63124
|
+
get maxPayloadBytes() {
|
|
63125
|
+
return this.options.maxPayloadBytes ?? LOCAL_LORO_DATA_PLANE_MAX_PAYLOAD_BYTES;
|
|
63126
|
+
}
|
|
63127
|
+
async handleMessage(connection2, message) {
|
|
63128
|
+
if (this.disposed) {
|
|
63129
|
+
this.sendError(connection2, {
|
|
63130
|
+
code: "workspace_runtime_unavailable",
|
|
63131
|
+
peerId: message.peerId,
|
|
63132
|
+
requestId: message.type === "join" ? message.requestId : void 0
|
|
63133
|
+
});
|
|
63134
|
+
return;
|
|
63135
|
+
}
|
|
63136
|
+
if (message.workspaceId !== this.options.workspaceId) {
|
|
63137
|
+
this.sendError(connection2, {
|
|
63138
|
+
code: "workspace_mismatch",
|
|
63139
|
+
peerId: message.peerId,
|
|
63140
|
+
requestId: message.type === "join" ? message.requestId : void 0
|
|
63141
|
+
});
|
|
63142
|
+
return;
|
|
63143
|
+
}
|
|
63144
|
+
try {
|
|
63145
|
+
this.registerPresenceReceiver(connection2);
|
|
63146
|
+
switch (message.type) {
|
|
63147
|
+
case "join":
|
|
63148
|
+
await this.handleJoin(connection2, message);
|
|
63149
|
+
return;
|
|
63150
|
+
case "update":
|
|
63151
|
+
await this.handleUpdate(connection2, message);
|
|
63152
|
+
return;
|
|
63153
|
+
case "leave":
|
|
63154
|
+
this.unsubscribePeer(message.peerId, roomKey(message.room));
|
|
63155
|
+
return;
|
|
63156
|
+
case "detach":
|
|
63157
|
+
this.detachPeer(message.peerId);
|
|
63158
|
+
return;
|
|
63159
|
+
case "machine-monitor":
|
|
63160
|
+
this.registerMachineMonitorReceiver(connection2);
|
|
63161
|
+
this.options.machineMonitorSource?.apply(base64ToBytes(message.dataBase64));
|
|
63162
|
+
return;
|
|
63163
|
+
}
|
|
63164
|
+
} catch (error2) {
|
|
63165
|
+
this.options.onError?.(error2, `handleMessage:${message.type}`);
|
|
63166
|
+
this.sendError(connection2, {
|
|
63167
|
+
code: "data_plane_error",
|
|
63168
|
+
message: errorMessage(error2),
|
|
63169
|
+
peerId: message.peerId,
|
|
63170
|
+
requestId: message.type === "join" ? message.requestId : void 0,
|
|
63171
|
+
room: "room" in message ? message.room : void 0
|
|
63172
|
+
});
|
|
63173
|
+
}
|
|
63174
|
+
}
|
|
63175
|
+
registerPresenceReceiver(connection2) {
|
|
63176
|
+
if (!this.options.presenceSource || this.presenceReceivers.has(connection2.id)) {
|
|
63177
|
+
return;
|
|
63178
|
+
}
|
|
63179
|
+
this.presenceReceivers.set(connection2.id, connection2);
|
|
63180
|
+
this.enqueuePresence(connection2);
|
|
63181
|
+
}
|
|
63182
|
+
broadcastPresence() {
|
|
63183
|
+
if (this.disposed) {
|
|
63184
|
+
return;
|
|
63185
|
+
}
|
|
63186
|
+
for (const connection2 of this.presenceReceivers.values()) {
|
|
63187
|
+
this.enqueuePresence(connection2);
|
|
63188
|
+
}
|
|
63189
|
+
}
|
|
63190
|
+
registerMachineMonitorReceiver(connection2) {
|
|
63191
|
+
if (!this.options.machineMonitorSource || this.machineMonitorReceivers.has(connection2.id)) {
|
|
63192
|
+
return;
|
|
63193
|
+
}
|
|
63194
|
+
this.machineMonitorReceivers.set(connection2.id, connection2);
|
|
63195
|
+
this.enqueueMachineMonitor(connection2);
|
|
63196
|
+
}
|
|
63197
|
+
broadcastMachineMonitor() {
|
|
63198
|
+
if (this.disposed) return;
|
|
63199
|
+
for (const connection2 of this.machineMonitorReceivers.values()) {
|
|
63200
|
+
this.enqueueMachineMonitor(connection2);
|
|
63201
|
+
}
|
|
63202
|
+
}
|
|
63203
|
+
dispose() {
|
|
63204
|
+
this.disposed = true;
|
|
63205
|
+
this.presenceUnsubscribe?.();
|
|
63206
|
+
this.presenceUnsubscribe = null;
|
|
63207
|
+
this.machineMonitorUnsubscribe?.();
|
|
63208
|
+
this.machineMonitorUnsubscribe = null;
|
|
63209
|
+
this.presenceReceivers.clear();
|
|
63210
|
+
this.machineMonitorReceivers.clear();
|
|
63211
|
+
for (const entry of this.rooms.values()) {
|
|
63212
|
+
entry.unsubscribe();
|
|
63213
|
+
this.notifyDocRoomLeave(entry.room);
|
|
63214
|
+
this.notifyFlockRoomLeave(entry.room);
|
|
63215
|
+
entry.subscribers.clear();
|
|
63216
|
+
}
|
|
63217
|
+
this.rooms.clear();
|
|
63218
|
+
this.roomGenerations.clear();
|
|
63219
|
+
for (const writer of this.writers.values()) {
|
|
63220
|
+
this.cancelScheduledDataPump(writer);
|
|
63221
|
+
writer.unsubscribeDrain?.();
|
|
63222
|
+
writer.queue.length = 0;
|
|
63223
|
+
writer.pendingFrames.length = 0;
|
|
63224
|
+
}
|
|
63225
|
+
this.writers.clear();
|
|
63226
|
+
}
|
|
63227
|
+
handleDisconnect(connectionId) {
|
|
63228
|
+
this.presenceReceivers.delete(connectionId);
|
|
63229
|
+
this.machineMonitorReceivers.delete(connectionId);
|
|
63230
|
+
const writer = this.writers.get(connectionId);
|
|
63231
|
+
if (writer) {
|
|
63232
|
+
this.cancelScheduledDataPump(writer);
|
|
63233
|
+
writer.unsubscribeDrain?.();
|
|
63234
|
+
writer.queue.length = 0;
|
|
63235
|
+
writer.pendingFrames.length = 0;
|
|
63236
|
+
this.writers.delete(connectionId);
|
|
63237
|
+
}
|
|
63238
|
+
for (const key2 of [
|
|
63239
|
+
...this.rooms.keys()
|
|
63240
|
+
]) {
|
|
63241
|
+
const entry = this.rooms.get(key2);
|
|
63242
|
+
if (!entry) {
|
|
63243
|
+
continue;
|
|
63244
|
+
}
|
|
63245
|
+
for (const [peerId, subscriber] of [
|
|
63246
|
+
...entry.subscribers
|
|
63247
|
+
]) {
|
|
63248
|
+
if (subscriber.connection.id === connectionId) {
|
|
63249
|
+
entry.subscribers.delete(peerId);
|
|
63250
|
+
if (entry.scope === "doc") {
|
|
63251
|
+
entry.uploadAssemblers.delete(peerId);
|
|
63252
|
+
}
|
|
63253
|
+
}
|
|
63254
|
+
}
|
|
63255
|
+
this.releaseRoomIfEmpty(key2, entry);
|
|
63256
|
+
}
|
|
63257
|
+
}
|
|
63258
|
+
detachPeer(peerId) {
|
|
63259
|
+
for (const key2 of [
|
|
63260
|
+
...this.rooms.keys()
|
|
63261
|
+
]) {
|
|
63262
|
+
this.unsubscribePeer(peerId, key2);
|
|
63263
|
+
}
|
|
63264
|
+
}
|
|
63265
|
+
async handleJoin(connection2, message) {
|
|
63266
|
+
const key2 = roomKey(message.room);
|
|
63267
|
+
for (; ; ) {
|
|
63268
|
+
const entry = await this.ensureRoom(message.room);
|
|
63269
|
+
if (this.rooms.get(key2) !== entry) {
|
|
63270
|
+
continue;
|
|
63271
|
+
}
|
|
63272
|
+
if (entry.scope === "doc") {
|
|
63273
|
+
entry.subscribers.set(message.peerId, {
|
|
63274
|
+
peerId: message.peerId,
|
|
63275
|
+
connection: connection2,
|
|
63276
|
+
latestJoinRequestId: message.requestId,
|
|
63277
|
+
lastSentVV: decodeVersion(message.haveVersion)
|
|
63278
|
+
});
|
|
63279
|
+
} else {
|
|
63280
|
+
entry.subscribers.set(message.peerId, {
|
|
63281
|
+
peerId: message.peerId,
|
|
63282
|
+
connection: connection2,
|
|
63283
|
+
latestJoinRequestId: message.requestId,
|
|
63284
|
+
lastSentVersion: decodeFlockVersion(message.haveVersion)
|
|
63285
|
+
});
|
|
63286
|
+
}
|
|
63287
|
+
this.enqueueJoinReply(connection2, key2, message.peerId, message.requestId);
|
|
63288
|
+
if (message.room.scope === "doc") {
|
|
63289
|
+
this.notifyDocRoomJoin(message.room.docId);
|
|
63290
|
+
} else if (message.room.scope === "flock-doc") {
|
|
63291
|
+
this.notifyFlockRoomJoin(message.room.flockDocId);
|
|
63292
|
+
}
|
|
63293
|
+
return;
|
|
63294
|
+
}
|
|
63295
|
+
}
|
|
63296
|
+
notifyDocRoomJoin(docId) {
|
|
63297
|
+
if (!this.docRoomJoinHandler) {
|
|
63298
|
+
return;
|
|
63299
|
+
}
|
|
63300
|
+
void Promise.resolve(this.docRoomJoinHandler(docId)).catch((error2) => {
|
|
63301
|
+
this.options.onError?.(error2, "onDocRoomJoin");
|
|
63302
|
+
});
|
|
63303
|
+
}
|
|
63304
|
+
notifyFlockRoomJoin(flockDocId) {
|
|
63305
|
+
if (!this.flockRoomJoinHandler) {
|
|
63306
|
+
return;
|
|
63307
|
+
}
|
|
63308
|
+
void Promise.resolve(this.flockRoomJoinHandler(flockDocId)).catch((error2) => {
|
|
63309
|
+
this.options.onError?.(error2, "onFlockRoomJoin");
|
|
63310
|
+
});
|
|
63311
|
+
}
|
|
63312
|
+
notifyDocRoomLeave(room) {
|
|
63313
|
+
if (room.scope !== "doc" || !this.docRoomLeaveHandler) {
|
|
63314
|
+
return;
|
|
63315
|
+
}
|
|
63316
|
+
void Promise.resolve(this.docRoomLeaveHandler(room.docId)).catch((error2) => {
|
|
63317
|
+
this.options.onError?.(error2, "onDocRoomLeave");
|
|
63318
|
+
});
|
|
63319
|
+
}
|
|
63320
|
+
notifyFlockRoomLeave(room) {
|
|
63321
|
+
if (room.scope !== "flock-doc" || !this.flockRoomLeaveHandler) {
|
|
63322
|
+
return;
|
|
63323
|
+
}
|
|
63324
|
+
void Promise.resolve(this.flockRoomLeaveHandler(room.flockDocId)).catch((error2) => {
|
|
63325
|
+
this.options.onError?.(error2, "onFlockRoomLeave");
|
|
63326
|
+
});
|
|
63327
|
+
}
|
|
63328
|
+
async handleUpdate(connection2, message) {
|
|
63329
|
+
const key2 = roomKey(message.room);
|
|
63330
|
+
let entry = await this.ensureRoom(message.room);
|
|
63331
|
+
while (this.rooms.get(key2) !== entry) {
|
|
63332
|
+
entry = await this.ensureRoom(message.room);
|
|
63333
|
+
}
|
|
63334
|
+
if (entry.scope === "doc") {
|
|
63335
|
+
if (message.payload.kind === "flock-json") {
|
|
63336
|
+
this.sendError(connection2, {
|
|
63337
|
+
code: "payload_kind_mismatch",
|
|
63338
|
+
message: "expected doc-update",
|
|
63339
|
+
peerId: message.peerId,
|
|
63340
|
+
room: message.room
|
|
63341
|
+
});
|
|
63342
|
+
return;
|
|
63343
|
+
}
|
|
63344
|
+
let dataBase64;
|
|
63345
|
+
if (message.payload.kind === "doc-update") {
|
|
63346
|
+
entry.uploadAssemblers.delete(message.peerId);
|
|
63347
|
+
dataBase64 = message.payload.dataBase64;
|
|
63348
|
+
} else {
|
|
63349
|
+
let assembler = entry.uploadAssemblers.get(message.peerId);
|
|
63350
|
+
if (!assembler) {
|
|
63351
|
+
assembler = new DocUpdateChunkAssembler();
|
|
63352
|
+
entry.uploadAssemblers.set(message.peerId, assembler);
|
|
63353
|
+
}
|
|
63354
|
+
dataBase64 = assembler.push(message.payload);
|
|
63355
|
+
if (dataBase64 === null) {
|
|
63356
|
+
return;
|
|
63357
|
+
}
|
|
63358
|
+
entry.uploadAssemblers.delete(message.peerId);
|
|
63359
|
+
}
|
|
63360
|
+
const subscriber2 = entry.subscribers.get(message.peerId);
|
|
63361
|
+
if (subscriber2) {
|
|
63362
|
+
subscriber2.lastSentVV = decodeVersion(message.haveVersion);
|
|
63363
|
+
}
|
|
63364
|
+
entry.doc.import(base64ToBytes(dataBase64));
|
|
63365
|
+
return;
|
|
63366
|
+
}
|
|
63367
|
+
if (message.payload.kind !== "flock-json") {
|
|
63368
|
+
this.sendError(connection2, {
|
|
63369
|
+
code: "payload_kind_mismatch",
|
|
63370
|
+
message: "expected flock-json",
|
|
63371
|
+
peerId: message.peerId,
|
|
63372
|
+
room: message.room
|
|
63373
|
+
});
|
|
63374
|
+
return;
|
|
63375
|
+
}
|
|
63376
|
+
const subscriber = entry.subscribers.get(message.peerId);
|
|
63377
|
+
if (subscriber) {
|
|
63378
|
+
subscriber.lastSentVersion = mergeFlockVersions(subscriber.lastSentVersion, decodeFlockVersion(message.haveVersion));
|
|
63379
|
+
}
|
|
63380
|
+
await entry.flock.importJson(message.payload.bundle);
|
|
63381
|
+
entry.flock.commit?.();
|
|
63382
|
+
}
|
|
63383
|
+
async ensureRoom(room) {
|
|
63384
|
+
const key2 = roomKey(room);
|
|
63385
|
+
for (; ; ) {
|
|
63386
|
+
const existing = this.rooms.get(key2);
|
|
63387
|
+
if (existing) {
|
|
63388
|
+
return existing;
|
|
63389
|
+
}
|
|
63390
|
+
const inFlight = this.resolveInFlight.get(key2);
|
|
63391
|
+
if (inFlight) {
|
|
63392
|
+
const shared = await inFlight;
|
|
63393
|
+
if (shared) {
|
|
63394
|
+
return shared;
|
|
63395
|
+
}
|
|
63396
|
+
continue;
|
|
63397
|
+
}
|
|
63398
|
+
const generation = this.roomGenerations.get(key2) ?? 0;
|
|
63399
|
+
const build = (async () => {
|
|
63400
|
+
const entry = room.scope === "doc" ? await this.buildDocRoom(room, room.docId) : await this.buildFlockRoom(room, await this.resolveFlockForRoom(room));
|
|
63401
|
+
if (this.disposed) {
|
|
63402
|
+
entry.unsubscribe();
|
|
63403
|
+
throw new Error("data_plane_engine_disposed");
|
|
63404
|
+
}
|
|
63405
|
+
if ((this.roomGenerations.get(key2) ?? 0) !== generation) {
|
|
63406
|
+
entry.unsubscribe();
|
|
63407
|
+
return null;
|
|
63408
|
+
}
|
|
63409
|
+
this.rooms.set(key2, entry);
|
|
63410
|
+
return entry;
|
|
63411
|
+
})().finally(() => this.resolveInFlight.delete(key2));
|
|
63412
|
+
this.resolveInFlight.set(key2, build);
|
|
63413
|
+
const resolved = await build;
|
|
63414
|
+
if (resolved) {
|
|
63415
|
+
return resolved;
|
|
63416
|
+
}
|
|
63417
|
+
}
|
|
63418
|
+
}
|
|
63419
|
+
async buildDocRoom(room, docId) {
|
|
63420
|
+
const doc = await this.options.resolveDoc(docId);
|
|
63421
|
+
const entry = {
|
|
63422
|
+
scope: "doc",
|
|
63423
|
+
room,
|
|
63424
|
+
doc,
|
|
63425
|
+
unsubscribe: () => {
|
|
63426
|
+
},
|
|
63427
|
+
subscribers: /* @__PURE__ */ new Map(),
|
|
63428
|
+
uploadAssemblers: /* @__PURE__ */ new Map()
|
|
63429
|
+
};
|
|
63430
|
+
entry.unsubscribe = doc.subscribe(() => this.markRoomDirty(entry));
|
|
63431
|
+
return entry;
|
|
63432
|
+
}
|
|
63433
|
+
resolveFlockForRoom(room) {
|
|
63434
|
+
if (room.scope === "flock-doc") {
|
|
63435
|
+
return this.options.resolveFlockDoc(room.flockDocId);
|
|
63436
|
+
}
|
|
63437
|
+
return this.options.resolveMetaFlock ? this.options.resolveMetaFlock() : this.options.resolveFlockDoc("meta");
|
|
63438
|
+
}
|
|
63439
|
+
async buildFlockRoom(room, flock) {
|
|
63440
|
+
const entry = {
|
|
63441
|
+
scope: "flock",
|
|
63442
|
+
room,
|
|
63443
|
+
flock,
|
|
63444
|
+
unsubscribe: () => {
|
|
63445
|
+
},
|
|
63446
|
+
subscribers: /* @__PURE__ */ new Map()
|
|
63447
|
+
};
|
|
63448
|
+
entry.unsubscribe = flock.subscribe(() => this.markRoomDirty(entry));
|
|
63449
|
+
return entry;
|
|
63450
|
+
}
|
|
63451
|
+
markRoomDirty(entry) {
|
|
63452
|
+
if (this.disposed) {
|
|
63453
|
+
return;
|
|
63454
|
+
}
|
|
63455
|
+
const key2 = roomKey(entry.room);
|
|
63456
|
+
for (const subscriber of entry.subscribers.values()) {
|
|
63457
|
+
this.enqueueSync(subscriber.connection, key2, subscriber.peerId);
|
|
63458
|
+
}
|
|
63459
|
+
this.releaseRoomIfEmpty(key2, entry);
|
|
63460
|
+
}
|
|
63461
|
+
writerFor(connection2) {
|
|
63462
|
+
const existing = this.writers.get(connection2.id);
|
|
63463
|
+
if (existing) {
|
|
63464
|
+
return existing;
|
|
63465
|
+
}
|
|
63466
|
+
const writer = {
|
|
63467
|
+
connection: connection2,
|
|
63468
|
+
queue: [],
|
|
63469
|
+
queuedSyncKeys: /* @__PURE__ */ new Set(),
|
|
63470
|
+
presenceQueued: false,
|
|
63471
|
+
machineMonitorQueued: false,
|
|
63472
|
+
pendingFrames: [],
|
|
63473
|
+
pumping: false,
|
|
63474
|
+
pumpScheduled: false,
|
|
63475
|
+
cancelScheduledPump: null,
|
|
63476
|
+
blocked: false,
|
|
63477
|
+
unsubscribeDrain: null
|
|
63478
|
+
};
|
|
63479
|
+
writer.unsubscribeDrain = connection2.onDrain?.(() => {
|
|
63480
|
+
writer.blocked = false;
|
|
63481
|
+
this.scheduleDataPump(writer);
|
|
63482
|
+
}) ?? null;
|
|
63483
|
+
this.writers.set(connection2.id, writer);
|
|
63484
|
+
return writer;
|
|
63485
|
+
}
|
|
63486
|
+
enqueueMessage(connection2, message) {
|
|
63487
|
+
const writer = this.writerFor(connection2);
|
|
63488
|
+
writer.queue.push({
|
|
63489
|
+
kind: "message",
|
|
63490
|
+
message
|
|
63491
|
+
});
|
|
63492
|
+
this.scheduleDataPump(writer);
|
|
63493
|
+
}
|
|
63494
|
+
enqueueJoinReply(connection2, key2, peerId, requestId) {
|
|
63495
|
+
const writer = this.writerFor(connection2);
|
|
63496
|
+
writer.queue.push({
|
|
63497
|
+
kind: "join-reply",
|
|
63498
|
+
roomKey: key2,
|
|
63499
|
+
peerId,
|
|
63500
|
+
requestId
|
|
63501
|
+
});
|
|
63502
|
+
this.scheduleDataPump(writer);
|
|
63503
|
+
}
|
|
63504
|
+
enqueueSync(connection2, key2, peerId) {
|
|
63505
|
+
const writer = this.writerFor(connection2);
|
|
63506
|
+
const taskKey = syncTaskKey(key2, peerId);
|
|
63507
|
+
if (writer.queuedSyncKeys.has(taskKey)) {
|
|
63508
|
+
return;
|
|
63509
|
+
}
|
|
63510
|
+
writer.queuedSyncKeys.add(taskKey);
|
|
63511
|
+
writer.queue.push({
|
|
63512
|
+
kind: "sync",
|
|
63513
|
+
roomKey: key2,
|
|
63514
|
+
peerId
|
|
63515
|
+
});
|
|
63516
|
+
this.scheduleDataPump(writer);
|
|
63517
|
+
}
|
|
63518
|
+
enqueuePresence(connection2) {
|
|
63519
|
+
const writer = this.writerFor(connection2);
|
|
63520
|
+
if (writer.presenceQueued) {
|
|
63521
|
+
return;
|
|
63522
|
+
}
|
|
63523
|
+
writer.presenceQueued = true;
|
|
63524
|
+
writer.queue.push({
|
|
63525
|
+
kind: "presence"
|
|
63526
|
+
});
|
|
63527
|
+
this.scheduleDataPump(writer);
|
|
63528
|
+
}
|
|
63529
|
+
enqueueMachineMonitor(connection2) {
|
|
63530
|
+
const writer = this.writerFor(connection2);
|
|
63531
|
+
if (writer.machineMonitorQueued) return;
|
|
63532
|
+
writer.machineMonitorQueued = true;
|
|
63533
|
+
writer.queue.push({
|
|
63534
|
+
kind: "machine-monitor"
|
|
63535
|
+
});
|
|
63536
|
+
this.scheduleDataPump(writer);
|
|
63537
|
+
}
|
|
63538
|
+
isWriterActive(writer) {
|
|
63539
|
+
return !this.disposed && this.writers.get(writer.connection.id) === writer;
|
|
63540
|
+
}
|
|
63541
|
+
cancelScheduledDataPump(writer) {
|
|
63542
|
+
writer.cancelScheduledPump?.();
|
|
63543
|
+
writer.cancelScheduledPump = null;
|
|
63544
|
+
writer.pumpScheduled = false;
|
|
63545
|
+
}
|
|
63546
|
+
hasPendingDataWork(writer) {
|
|
63547
|
+
return writer.pendingFrames.length > 0 || writer.queue.length > 0;
|
|
63548
|
+
}
|
|
63549
|
+
scheduleDataPump(writer) {
|
|
63550
|
+
if (!this.isWriterActive(writer) || writer.blocked || writer.pumping || writer.pumpScheduled || !this.hasPendingDataWork(writer)) {
|
|
63551
|
+
return;
|
|
63552
|
+
}
|
|
63553
|
+
writer.pumpScheduled = true;
|
|
63554
|
+
writer.cancelScheduledPump = this.scheduler.scheduleDataWork(() => {
|
|
63555
|
+
writer.pumpScheduled = false;
|
|
63556
|
+
writer.cancelScheduledPump = null;
|
|
63557
|
+
return this.pumpWriter(writer).catch((error2) => {
|
|
63558
|
+
this.options.onError?.(error2, "pumpWriter");
|
|
63559
|
+
});
|
|
63560
|
+
});
|
|
63561
|
+
}
|
|
63562
|
+
async pumpWriter(writer) {
|
|
63563
|
+
if (!this.isWriterActive(writer) || writer.pumping || writer.blocked) {
|
|
63564
|
+
return;
|
|
63565
|
+
}
|
|
63566
|
+
writer.pumping = true;
|
|
63567
|
+
try {
|
|
63568
|
+
const pendingFrame = writer.pendingFrames.shift();
|
|
63569
|
+
if (pendingFrame) {
|
|
63570
|
+
this.writeFrame(writer, pendingFrame);
|
|
63571
|
+
return;
|
|
63572
|
+
}
|
|
63573
|
+
const task = writer.queue.shift();
|
|
63574
|
+
if (!task) {
|
|
63575
|
+
return;
|
|
63576
|
+
}
|
|
63577
|
+
if (task.kind === "sync") {
|
|
63578
|
+
writer.queuedSyncKeys.delete(syncTaskKey(task.roomKey, task.peerId));
|
|
63579
|
+
} else if (task.kind === "presence") {
|
|
63580
|
+
writer.presenceQueued = false;
|
|
63581
|
+
} else if (task.kind === "machine-monitor") {
|
|
63582
|
+
writer.machineMonitorQueued = false;
|
|
63583
|
+
}
|
|
63584
|
+
try {
|
|
63585
|
+
const frames = await this.buildFrames(writer, task);
|
|
63586
|
+
if (!this.isWriterActive(writer)) return;
|
|
63587
|
+
writer.pendingFrames.push(...frames);
|
|
63588
|
+
} catch (error2) {
|
|
63589
|
+
this.options.onError?.(error2, `buildFrames:${task.kind}`);
|
|
63590
|
+
}
|
|
63591
|
+
if (!this.isWriterActive(writer) || writer.blocked) {
|
|
63592
|
+
return;
|
|
63593
|
+
}
|
|
63594
|
+
const firstFrame = writer.pendingFrames.shift();
|
|
63595
|
+
if (firstFrame) {
|
|
63596
|
+
this.writeFrame(writer, firstFrame);
|
|
63597
|
+
}
|
|
63598
|
+
} finally {
|
|
63599
|
+
writer.pumping = false;
|
|
63600
|
+
if (this.isWriterActive(writer)) {
|
|
63601
|
+
this.scheduleDataPump(writer);
|
|
63602
|
+
}
|
|
63603
|
+
}
|
|
63604
|
+
}
|
|
63605
|
+
writeFrame(writer, frame2) {
|
|
63606
|
+
const accepted = writer.connection.send(frame2);
|
|
63607
|
+
if (accepted === false && writer.unsubscribeDrain) {
|
|
63608
|
+
writer.blocked = true;
|
|
63609
|
+
}
|
|
63610
|
+
}
|
|
63611
|
+
async buildFrames(writer, task) {
|
|
63612
|
+
switch (task.kind) {
|
|
63613
|
+
case "message":
|
|
63614
|
+
return [
|
|
63615
|
+
task.message
|
|
63616
|
+
];
|
|
63617
|
+
case "presence": {
|
|
63618
|
+
const source = this.options.presenceSource;
|
|
63619
|
+
if (!source) {
|
|
63620
|
+
return [];
|
|
63621
|
+
}
|
|
63622
|
+
const encoded = source.encodeLocalOrigin();
|
|
63623
|
+
if (encoded.length === 0) {
|
|
63624
|
+
return [];
|
|
63625
|
+
}
|
|
63626
|
+
return [
|
|
63627
|
+
{
|
|
63628
|
+
type: "presence",
|
|
63629
|
+
protocolVersion: LOCAL_LORO_DATA_PLANE_PROTOCOL_VERSION,
|
|
63630
|
+
workspaceId: this.options.workspaceId,
|
|
63631
|
+
dataBase64: bytesToBase64(encoded)
|
|
63632
|
+
}
|
|
63633
|
+
];
|
|
63634
|
+
}
|
|
63635
|
+
case "machine-monitor": {
|
|
63636
|
+
const source = this.options.machineMonitorSource;
|
|
63637
|
+
if (!source) return [];
|
|
63638
|
+
const encoded = source.encodeAll();
|
|
63639
|
+
if (encoded.length === 0) return [];
|
|
63640
|
+
return [
|
|
63641
|
+
{
|
|
63642
|
+
type: "machine-monitor",
|
|
63643
|
+
protocolVersion: LOCAL_LORO_DATA_PLANE_PROTOCOL_VERSION,
|
|
63644
|
+
workspaceId: this.options.workspaceId,
|
|
63645
|
+
dataBase64: bytesToBase64(encoded)
|
|
63646
|
+
}
|
|
63647
|
+
];
|
|
63648
|
+
}
|
|
63649
|
+
case "join-reply":
|
|
63650
|
+
return await this.buildJoinReplyFrames(writer, task);
|
|
63651
|
+
case "sync":
|
|
63652
|
+
return await this.buildSyncFrames(writer, task.roomKey, task.peerId, null);
|
|
63653
|
+
}
|
|
63654
|
+
const exhaustive = task;
|
|
63655
|
+
throw new Error(`Unsupported local data-plane writer task: ${String(exhaustive)}`);
|
|
63656
|
+
}
|
|
63657
|
+
async buildJoinReplyFrames(writer, task) {
|
|
63658
|
+
const entry = this.rooms.get(task.roomKey);
|
|
63659
|
+
if (!entry) {
|
|
63660
|
+
return [];
|
|
63661
|
+
}
|
|
63662
|
+
const subscriber = entry.subscribers.get(task.peerId);
|
|
63663
|
+
if (!subscriber || subscriber.connection.id !== writer.connection.id) {
|
|
63664
|
+
return [];
|
|
63665
|
+
}
|
|
63666
|
+
if (subscriber.latestJoinRequestId !== task.requestId) {
|
|
63667
|
+
return [];
|
|
63668
|
+
}
|
|
63669
|
+
return await this.buildSyncFrames(writer, task.roomKey, task.peerId, task.requestId);
|
|
63670
|
+
}
|
|
63671
|
+
async buildSyncFrames(writer, key2, peerId, joinRequestId) {
|
|
63672
|
+
const entry = this.rooms.get(key2);
|
|
63673
|
+
if (!entry) {
|
|
63674
|
+
return [];
|
|
63675
|
+
}
|
|
63676
|
+
const subscriber = entry.subscribers.get(peerId);
|
|
63677
|
+
if (!subscriber || subscriber.connection.id !== writer.connection.id) {
|
|
63678
|
+
return [];
|
|
63679
|
+
}
|
|
63680
|
+
if (entry.scope === "doc") {
|
|
63681
|
+
const docSubscriber = subscriber;
|
|
63682
|
+
const serverVV = entry.doc.oplogVersion();
|
|
63683
|
+
const delta = entry.doc.export({
|
|
63684
|
+
mode: "update",
|
|
63685
|
+
from: docSubscriber.lastSentVV
|
|
63686
|
+
});
|
|
63687
|
+
const serverVersion2 = bytesToBase64(serverVV.encode());
|
|
63688
|
+
const dataBase64 = delta.length > 0 ? bytesToBase64(delta) : null;
|
|
63689
|
+
docSubscriber.lastSentVV = serverVV;
|
|
63690
|
+
if (dataBase64 && dataBase64.length > this.maxPayloadBytes) {
|
|
63691
|
+
const chunkPayloads = buildDocUpdateChunkPayloads(dataBase64, this.maxPayloadBytes, createDocUpdateTransferId());
|
|
63692
|
+
const frames2 = [];
|
|
63693
|
+
if (joinRequestId !== null) {
|
|
63694
|
+
frames2.push({
|
|
63695
|
+
type: "joined",
|
|
63696
|
+
protocolVersion: LOCAL_LORO_DATA_PLANE_PROTOCOL_VERSION,
|
|
63697
|
+
workspaceId: this.options.workspaceId,
|
|
63698
|
+
peerId,
|
|
63699
|
+
requestId: joinRequestId,
|
|
63700
|
+
room: entry.room,
|
|
63701
|
+
serverVersion: serverVersion2
|
|
63702
|
+
});
|
|
63703
|
+
}
|
|
63704
|
+
for (const payload of chunkPayloads) {
|
|
63705
|
+
frames2.push({
|
|
63706
|
+
type: "update",
|
|
63707
|
+
protocolVersion: LOCAL_LORO_DATA_PLANE_PROTOCOL_VERSION,
|
|
63708
|
+
workspaceId: this.options.workspaceId,
|
|
63709
|
+
peerId,
|
|
63710
|
+
room: entry.room,
|
|
63711
|
+
serverVersion: serverVersion2,
|
|
63712
|
+
payload
|
|
63713
|
+
});
|
|
63714
|
+
}
|
|
63715
|
+
return frames2;
|
|
63716
|
+
}
|
|
63717
|
+
if (joinRequestId !== null) {
|
|
63718
|
+
return [
|
|
63719
|
+
{
|
|
63720
|
+
type: "joined",
|
|
63721
|
+
protocolVersion: LOCAL_LORO_DATA_PLANE_PROTOCOL_VERSION,
|
|
63722
|
+
workspaceId: this.options.workspaceId,
|
|
63723
|
+
peerId,
|
|
63724
|
+
requestId: joinRequestId,
|
|
63725
|
+
room: entry.room,
|
|
63726
|
+
serverVersion: serverVersion2,
|
|
63727
|
+
...dataBase64 ? {
|
|
63728
|
+
payload: {
|
|
63729
|
+
kind: "doc-update",
|
|
63730
|
+
dataBase64
|
|
63731
|
+
}
|
|
63732
|
+
} : {}
|
|
63733
|
+
}
|
|
63734
|
+
];
|
|
63735
|
+
}
|
|
63736
|
+
if (!dataBase64) {
|
|
63737
|
+
return [];
|
|
63738
|
+
}
|
|
63739
|
+
return [
|
|
63740
|
+
{
|
|
63741
|
+
type: "update",
|
|
63742
|
+
protocolVersion: LOCAL_LORO_DATA_PLANE_PROTOCOL_VERSION,
|
|
63743
|
+
workspaceId: this.options.workspaceId,
|
|
63744
|
+
peerId,
|
|
63745
|
+
room: entry.room,
|
|
63746
|
+
serverVersion: serverVersion2,
|
|
63747
|
+
payload: {
|
|
63748
|
+
kind: "doc-update",
|
|
63749
|
+
dataBase64
|
|
63750
|
+
}
|
|
63751
|
+
}
|
|
63752
|
+
];
|
|
63753
|
+
}
|
|
63754
|
+
const flockSubscriber = subscriber;
|
|
63755
|
+
const have = entry.flock.version();
|
|
63756
|
+
const bundle = await entry.flock.exportJson(flockSubscriber.lastSentVersion);
|
|
63757
|
+
const currentEntry = this.rooms.get(key2);
|
|
63758
|
+
const currentSubscriber = currentEntry?.scope === "flock" ? currentEntry.subscribers.get(peerId) : void 0;
|
|
63759
|
+
if (currentEntry !== entry || currentSubscriber !== flockSubscriber || currentSubscriber.connection.id !== writer.connection.id || joinRequestId !== null && currentSubscriber.latestJoinRequestId !== joinRequestId) {
|
|
63760
|
+
return [];
|
|
63761
|
+
}
|
|
63762
|
+
flockSubscriber.lastSentVersion = mergeFlockVersions(flockSubscriber.lastSentVersion, have);
|
|
63763
|
+
const serverVersion = encodeFlockVersion(have);
|
|
63764
|
+
if (isEmptyFlockBundle(bundle)) {
|
|
63765
|
+
if (joinRequestId !== null) {
|
|
63766
|
+
return [
|
|
63767
|
+
{
|
|
63768
|
+
type: "joined",
|
|
63769
|
+
protocolVersion: LOCAL_LORO_DATA_PLANE_PROTOCOL_VERSION,
|
|
63770
|
+
workspaceId: this.options.workspaceId,
|
|
63771
|
+
peerId,
|
|
63772
|
+
requestId: joinRequestId,
|
|
63773
|
+
room: entry.room,
|
|
63774
|
+
serverVersion
|
|
63775
|
+
}
|
|
63776
|
+
];
|
|
63777
|
+
}
|
|
63778
|
+
return [];
|
|
63779
|
+
}
|
|
63780
|
+
const chunks = chunkFlockBundle(bundle, this.maxPayloadBytes);
|
|
63781
|
+
if (!chunks) {
|
|
63782
|
+
entry.subscribers.delete(peerId);
|
|
63783
|
+
this.releaseRoomIfEmpty(key2, entry);
|
|
63784
|
+
return [
|
|
63785
|
+
this.payloadTooLargeError(peerId, entry.room, joinRequestId ?? void 0)
|
|
63786
|
+
];
|
|
63787
|
+
}
|
|
63788
|
+
const frames = [];
|
|
63789
|
+
for (const [index, chunk] of chunks.entries()) {
|
|
63790
|
+
if (joinRequestId !== null && index === 0) {
|
|
63791
|
+
frames.push({
|
|
63792
|
+
type: "joined",
|
|
63793
|
+
protocolVersion: LOCAL_LORO_DATA_PLANE_PROTOCOL_VERSION,
|
|
63794
|
+
workspaceId: this.options.workspaceId,
|
|
63795
|
+
peerId,
|
|
63796
|
+
requestId: joinRequestId,
|
|
63797
|
+
room: entry.room,
|
|
63798
|
+
serverVersion,
|
|
63799
|
+
payload: {
|
|
63800
|
+
kind: "flock-json",
|
|
63801
|
+
bundle: chunk
|
|
63802
|
+
}
|
|
63803
|
+
});
|
|
63804
|
+
continue;
|
|
63805
|
+
}
|
|
63806
|
+
frames.push({
|
|
63807
|
+
type: "update",
|
|
63808
|
+
protocolVersion: LOCAL_LORO_DATA_PLANE_PROTOCOL_VERSION,
|
|
63809
|
+
workspaceId: this.options.workspaceId,
|
|
63810
|
+
peerId,
|
|
63811
|
+
room: entry.room,
|
|
63812
|
+
serverVersion,
|
|
63813
|
+
payload: {
|
|
63814
|
+
kind: "flock-json",
|
|
63815
|
+
bundle: chunk
|
|
63816
|
+
}
|
|
63817
|
+
});
|
|
63818
|
+
}
|
|
63819
|
+
return frames;
|
|
63820
|
+
}
|
|
63821
|
+
payloadTooLargeError(peerId, room, requestId) {
|
|
63822
|
+
return {
|
|
63823
|
+
type: "error",
|
|
63824
|
+
protocolVersion: LOCAL_LORO_DATA_PLANE_PROTOCOL_VERSION,
|
|
63825
|
+
workspaceId: this.options.workspaceId,
|
|
63826
|
+
code: LOCAL_LORO_DATA_PLANE_PAYLOAD_TOO_LARGE,
|
|
63827
|
+
message: "sync payload exceeds the local data-plane frame budget",
|
|
63828
|
+
peerId,
|
|
63829
|
+
room,
|
|
63830
|
+
...requestId ? {
|
|
63831
|
+
requestId
|
|
63832
|
+
} : {},
|
|
63833
|
+
terminal: true
|
|
63834
|
+
};
|
|
63835
|
+
}
|
|
63836
|
+
unsubscribePeer(peerId, key2) {
|
|
63837
|
+
const entry = this.rooms.get(key2);
|
|
63838
|
+
if (!entry) {
|
|
63839
|
+
return;
|
|
63840
|
+
}
|
|
63841
|
+
entry.subscribers.delete(peerId);
|
|
63842
|
+
if (entry.scope === "doc") {
|
|
63843
|
+
entry.uploadAssemblers.delete(peerId);
|
|
63844
|
+
}
|
|
63845
|
+
this.releaseRoomIfEmpty(key2, entry);
|
|
63846
|
+
}
|
|
63847
|
+
releaseRoomIfEmpty(key2, entry) {
|
|
63848
|
+
if (entry.subscribers.size > 0 || this.rooms.get(key2) !== entry) {
|
|
63849
|
+
return;
|
|
63850
|
+
}
|
|
63851
|
+
entry.unsubscribe();
|
|
63852
|
+
this.rooms.delete(key2);
|
|
63853
|
+
this.notifyDocRoomLeave(entry.room);
|
|
63854
|
+
this.notifyFlockRoomLeave(entry.room);
|
|
63855
|
+
}
|
|
63856
|
+
sendError(connection2, error2) {
|
|
63857
|
+
this.enqueueMessage(connection2, {
|
|
63858
|
+
type: "error",
|
|
63859
|
+
protocolVersion: LOCAL_LORO_DATA_PLANE_PROTOCOL_VERSION,
|
|
63860
|
+
workspaceId: this.options.workspaceId,
|
|
63861
|
+
code: error2.code,
|
|
63862
|
+
...error2.message ? {
|
|
63863
|
+
message: error2.message
|
|
63864
|
+
} : {},
|
|
63865
|
+
...error2.peerId ? {
|
|
63866
|
+
peerId: error2.peerId
|
|
63867
|
+
} : {},
|
|
63868
|
+
...error2.requestId ? {
|
|
63869
|
+
requestId: error2.requestId
|
|
63870
|
+
} : {},
|
|
63871
|
+
...error2.room ? {
|
|
63872
|
+
room: error2.room
|
|
63873
|
+
} : {},
|
|
63874
|
+
...error2.terminal ? {
|
|
63875
|
+
terminal: true
|
|
63876
|
+
} : {}
|
|
63877
|
+
});
|
|
63878
|
+
}
|
|
63879
|
+
}
|
|
63880
|
+
function decodeVersion(encoded) {
|
|
63881
|
+
if (!encoded) {
|
|
63882
|
+
return new VersionVector(null);
|
|
63883
|
+
}
|
|
63884
|
+
return VersionVector.decode(base64ToBytes(encoded));
|
|
63885
|
+
}
|
|
63886
|
+
function errorMessage(error2) {
|
|
63887
|
+
return error2 instanceof Error ? error2.message : String(error2);
|
|
63888
|
+
}
|
|
63852
63889
|
const byteToHex = [];
|
|
63853
63890
|
for (let i2 = 0; i2 < 256; ++i2) {
|
|
63854
63891
|
byteToHex.push((i2 + 256).toString(16).slice(1));
|
|
@@ -64159,7 +64196,7 @@ ${this.stack.split("\n").slice(1).join("\n")}` : this.toString();
|
|
|
64159
64196
|
function requirePermessageDeflate$1() {
|
|
64160
64197
|
if (hasRequiredPermessageDeflate$1) return permessageDeflate$1;
|
|
64161
64198
|
hasRequiredPermessageDeflate$1 = 1;
|
|
64162
|
-
const zlib =
|
|
64199
|
+
const zlib = $s__default;
|
|
64163
64200
|
const bufferUtil2 = requireBufferUtil();
|
|
64164
64201
|
const Limiter = requireLimiter();
|
|
64165
64202
|
const { kStatusCode } = requireConstants$5();
|
|
@@ -64614,7 +64651,7 @@ ${this.stack.split("\n").slice(1).join("\n")}` : this.toString();
|
|
|
64614
64651
|
function requireReceiver$1() {
|
|
64615
64652
|
if (hasRequiredReceiver$1) return receiver$1;
|
|
64616
64653
|
hasRequiredReceiver$1 = 1;
|
|
64617
|
-
const { Writable } =
|
|
64654
|
+
const { Writable } = Zr;
|
|
64618
64655
|
const PerMessageDeflate = requirePermessageDeflate$1();
|
|
64619
64656
|
const { BINARY_TYPES, EMPTY_BUFFER, kStatusCode, kWebSocket } = requireConstants$5();
|
|
64620
64657
|
const { concat: concat2, toArrayBuffer: toArrayBuffer2, unmask } = requireBufferUtil();
|
|
@@ -64981,7 +65018,7 @@ ${this.stack.split("\n").slice(1).join("\n")}` : this.toString();
|
|
|
64981
65018
|
function requireSender$1() {
|
|
64982
65019
|
if (hasRequiredSender$1) return sender$1;
|
|
64983
65020
|
hasRequiredSender$1 = 1;
|
|
64984
|
-
const { Duplex } =
|
|
65021
|
+
const { Duplex } = Zr;
|
|
64985
65022
|
const { randomFillSync: randomFillSync2 } = crypto__default;
|
|
64986
65023
|
const PerMessageDeflate = requirePermessageDeflate$1();
|
|
64987
65024
|
const { EMPTY_BUFFER, kWebSocket, NOOP } = requireConstants$5();
|
|
@@ -65718,7 +65755,7 @@ ${this.stack.split("\n").slice(1).join("\n")}` : this.toString();
|
|
|
65718
65755
|
const net2 = require$$0$9;
|
|
65719
65756
|
const tls = require$$4$2;
|
|
65720
65757
|
const { randomBytes: randomBytes2, createHash: createHash2 } = crypto__default;
|
|
65721
|
-
const { Duplex, Readable: Readable2 } =
|
|
65758
|
+
const { Duplex, Readable: Readable2 } = Zr;
|
|
65722
65759
|
const { URL: URL2 } = require$$7$2;
|
|
65723
65760
|
const PerMessageDeflate = requirePermessageDeflate$1();
|
|
65724
65761
|
const Receiver = requireReceiver$1();
|
|
@@ -66456,7 +66493,7 @@ ${this.stack.split("\n").slice(1).join("\n")}` : this.toString();
|
|
|
66456
66493
|
if (hasRequiredStream$1) return stream$1;
|
|
66457
66494
|
hasRequiredStream$1 = 1;
|
|
66458
66495
|
requireWebsocket$1();
|
|
66459
|
-
const { Duplex } =
|
|
66496
|
+
const { Duplex } = Zr;
|
|
66460
66497
|
function emitClose(stream2) {
|
|
66461
66498
|
stream2.emit("close");
|
|
66462
66499
|
}
|
|
@@ -66607,7 +66644,7 @@ ${this.stack.split("\n").slice(1).join("\n")}` : this.toString();
|
|
|
66607
66644
|
hasRequiredWebsocketServer = 1;
|
|
66608
66645
|
const EventEmitter2 = require$$0$7;
|
|
66609
66646
|
const http$12 = http;
|
|
66610
|
-
const { Duplex } =
|
|
66647
|
+
const { Duplex } = Zr;
|
|
66611
66648
|
const { createHash: createHash2 } = crypto__default;
|
|
66612
66649
|
const extension2 = requireExtension();
|
|
66613
66650
|
const PerMessageDeflate = requirePermessageDeflate$1();
|
|
@@ -81391,7 +81428,7 @@ ${val.stack}`;
|
|
|
81391
81428
|
if (hasRequiredSupportsColor) return supportsColor_1;
|
|
81392
81429
|
hasRequiredSupportsColor = 1;
|
|
81393
81430
|
const os2 = os__default$1;
|
|
81394
|
-
const tty2 = require$$1$
|
|
81431
|
+
const tty2 = require$$1$2;
|
|
81395
81432
|
const hasFlag2 = requireHasFlag$1();
|
|
81396
81433
|
const { env: env2 } = process;
|
|
81397
81434
|
let forceColor;
|
|
@@ -81499,7 +81536,7 @@ ${val.stack}`;
|
|
|
81499
81536
|
if (hasRequiredNode) return node.exports;
|
|
81500
81537
|
hasRequiredNode = 1;
|
|
81501
81538
|
(function(module2, exports$1) {
|
|
81502
|
-
const tty2 = require$$1$
|
|
81539
|
+
const tty2 = require$$1$2;
|
|
81503
81540
|
const util2 = require$$0$5;
|
|
81504
81541
|
exports$1.init = init2;
|
|
81505
81542
|
exports$1.log = log;
|
|
@@ -82669,7 +82706,7 @@ ${val.stack}`;
|
|
|
82669
82706
|
}
|
|
82670
82707
|
const createCliSqliteRepoStore = async (workspaceId) => {
|
|
82671
82708
|
const baseDir = getLoroRepoStorageBaseDir(workspaceId);
|
|
82672
|
-
await fs__default$
|
|
82709
|
+
await fs__default$2.mkdir(baseDir, {
|
|
82673
82710
|
recursive: true
|
|
82674
82711
|
});
|
|
82675
82712
|
const dbPath = getLoroRepoSqliteDbPath(workspaceId);
|
|
@@ -85963,7 +86000,7 @@ ${val.stack}`;
|
|
|
85963
86000
|
if (hasRequiredWebidl) return webidl_1;
|
|
85964
86001
|
hasRequiredWebidl = 1;
|
|
85965
86002
|
const { types: types2, inspect: inspect2 } = require$$0$8;
|
|
85966
|
-
const { markAsUncloneable } = require$$1$
|
|
86003
|
+
const { markAsUncloneable } = require$$1$4;
|
|
85967
86004
|
const { toUSVString } = requireUtil$8();
|
|
85968
86005
|
const webidl = {};
|
|
85969
86006
|
webidl.converters = {};
|
|
@@ -90750,7 +90787,7 @@ ${len2.toString(16)}\r
|
|
|
90750
90787
|
if (hasRequiredProxyAgent) return proxyAgent;
|
|
90751
90788
|
hasRequiredProxyAgent = 1;
|
|
90752
90789
|
const { kProxy, kClose, kDestroy, kDispatch, kInterceptors } = requireSymbols$4();
|
|
90753
|
-
const { URL: URL2 } = require$$1$
|
|
90790
|
+
const { URL: URL2 } = require$$1$5;
|
|
90754
90791
|
const Agent = requireAgent();
|
|
90755
90792
|
const Pool = requirePool();
|
|
90756
90793
|
const DispatcherBase = requireDispatcherBase();
|
|
@@ -93252,7 +93289,7 @@ ${len2.toString(16)}\r
|
|
|
93252
93289
|
if (hasRequiredPendingInterceptorsFormatter) return pendingInterceptorsFormatter;
|
|
93253
93290
|
hasRequiredPendingInterceptorsFormatter = 1;
|
|
93254
93291
|
const { Transform: Transform2 } = require$$0$c;
|
|
93255
|
-
const { Console } = require$$1$
|
|
93292
|
+
const { Console } = require$$1$6;
|
|
93256
93293
|
const PERSISTENT = process.versions.icu ? "\u2705" : "Y ";
|
|
93257
93294
|
const NOT_PERSISTENT = process.versions.icu ? "\u274C" : "N ";
|
|
93258
93295
|
pendingInterceptorsFormatter = class PendingInterceptorsFormatter {
|
|
@@ -93621,7 +93658,7 @@ ${pendingInterceptorsFormatter2.format(pending2)}
|
|
|
93621
93658
|
if (hasRequiredDns) return dns;
|
|
93622
93659
|
hasRequiredDns = 1;
|
|
93623
93660
|
const { isIP } = net;
|
|
93624
|
-
const { lookup: lookup2 } = require$$1$
|
|
93661
|
+
const { lookup: lookup2 } = require$$1$7;
|
|
93625
93662
|
const DecoratorHandler = requireDecoratorHandler();
|
|
93626
93663
|
const { InvalidArgumentError: InvalidArgumentError2, InformationalError } = requireErrors$1();
|
|
93627
93664
|
const maxInt = Math.pow(2, 31) - 1;
|
|
@@ -96720,7 +96757,7 @@ ${pendingInterceptorsFormatter2.format(pending2)}
|
|
|
96720
96757
|
const { getEncoding } = requireEncoding();
|
|
96721
96758
|
const { serializeAMimeType, parseMIMEType } = requireDataUrl();
|
|
96722
96759
|
const { types: types2 } = require$$0$8;
|
|
96723
|
-
const { StringDecoder: StringDecoder2 } = require$$1$
|
|
96760
|
+
const { StringDecoder: StringDecoder2 } = require$$1$3;
|
|
96724
96761
|
const { btoa: btoa2 } = require$$0$a;
|
|
96725
96762
|
const staticPropertyDescriptors = {
|
|
96726
96763
|
enumerable: true,
|
|
@@ -98209,7 +98246,7 @@ ${pendingInterceptorsFormatter2.format(pending2)}
|
|
|
98209
98246
|
const { webidl } = requireWebidl();
|
|
98210
98247
|
const { kEnumerableProperty } = requireUtil$8();
|
|
98211
98248
|
const { kConstruct } = requireSymbols$4();
|
|
98212
|
-
const { MessagePort } = require$$1$
|
|
98249
|
+
const { MessagePort } = require$$1$4;
|
|
98213
98250
|
class MessageEvent extends Event {
|
|
98214
98251
|
#eventInit;
|
|
98215
98252
|
constructor(type2, eventInitDict = {}) {
|
|
@@ -108772,20 +108809,20 @@ ${value}`;
|
|
|
108772
108809
|
};
|
|
108773
108810
|
const parsed = DaemonUpgradeIntentSchema.parse(value);
|
|
108774
108811
|
const dir = path.dirname(DAEMON_UPGRADE_INTENT_FILE);
|
|
108775
|
-
await
|
|
108812
|
+
await jt.mkdir(dir, {
|
|
108776
108813
|
recursive: true
|
|
108777
108814
|
});
|
|
108778
108815
|
const tmpPath = path.join(dir, `.${path.basename(DAEMON_UPGRADE_INTENT_FILE)}.${process.pid}.tmp`);
|
|
108779
|
-
await
|
|
108816
|
+
await jt.writeFile(tmpPath, `${JSON.stringify(parsed, null, 2)}
|
|
108780
108817
|
`, {
|
|
108781
108818
|
encoding: "utf8",
|
|
108782
108819
|
mode: 384
|
|
108783
108820
|
});
|
|
108784
|
-
await
|
|
108821
|
+
await jt.rename(tmpPath, DAEMON_UPGRADE_INTENT_FILE);
|
|
108785
108822
|
};
|
|
108786
108823
|
const readDaemonUpgradeIntent = async () => {
|
|
108787
108824
|
try {
|
|
108788
|
-
const raw2 = await
|
|
108825
|
+
const raw2 = await jt.readFile(DAEMON_UPGRADE_INTENT_FILE, "utf8");
|
|
108789
108826
|
const parsed = DaemonUpgradeIntentSchema.safeParse(JSON.parse(raw2));
|
|
108790
108827
|
return parsed.success ? parsed.data : null;
|
|
108791
108828
|
} catch {
|
|
@@ -108794,7 +108831,7 @@ ${value}`;
|
|
|
108794
108831
|
};
|
|
108795
108832
|
const clearDaemonUpgradeIntent = async () => {
|
|
108796
108833
|
try {
|
|
108797
|
-
await
|
|
108834
|
+
await jt.unlink(DAEMON_UPGRADE_INTENT_FILE);
|
|
108798
108835
|
} catch {
|
|
108799
108836
|
}
|
|
108800
108837
|
};
|
|
@@ -111636,7 +111673,7 @@ ${incoming}`).output;
|
|
|
111636
111673
|
function requireCrossSpawn() {
|
|
111637
111674
|
if (hasRequiredCrossSpawn) return crossSpawn.exports;
|
|
111638
111675
|
hasRequiredCrossSpawn = 1;
|
|
111639
|
-
const cp = require$$1$
|
|
111676
|
+
const cp = require$$1$8;
|
|
111640
111677
|
const parse2 = requireParse();
|
|
111641
111678
|
const enoent2 = requireEnoent();
|
|
111642
111679
|
function spawn2(command2, args2, options) {
|
|
@@ -111728,7 +111765,7 @@ ${incoming}`).output;
|
|
|
111728
111765
|
return String(process.getuid());
|
|
111729
111766
|
}
|
|
111730
111767
|
const userInfo2 = os__default.userInfo();
|
|
111731
|
-
return
|
|
111768
|
+
return crypto__default$1.createHash("sha256").update(`${userInfo2.uid}:${userInfo2.username}:${os__default.homedir()}`).digest("hex").slice(0, 16);
|
|
111732
111769
|
}
|
|
111733
111770
|
const MAX_UNIX_SOCKET_PATH_BYTES = 103;
|
|
111734
111771
|
function getLocalDaemonSocketPath(basename2, platform2) {
|
|
@@ -111822,7 +111859,7 @@ ${incoming}`).output;
|
|
|
111822
111859
|
function writeLocalDaemonRunFile(runFile, runFilePath = getLocalDaemonRunFilePath()) {
|
|
111823
111860
|
const parsed = LocalDaemonRunFileSchema.parse(runFile);
|
|
111824
111861
|
ensureLocalDaemonRunDir(path__default.dirname(runFilePath));
|
|
111825
|
-
const tempPath = `${runFilePath}.${process.pid}.${
|
|
111862
|
+
const tempPath = `${runFilePath}.${process.pid}.${crypto__default$1.randomUUID()}.tmp`;
|
|
111826
111863
|
fs__default$1.writeFileSync(tempPath, `${JSON.stringify(parsed, null, 2)}
|
|
111827
111864
|
`, {
|
|
111828
111865
|
mode: 384
|
|
@@ -116013,7 +116050,7 @@ ${error2.message}` : execaMessage;
|
|
|
116013
116050
|
function requireBufferStream() {
|
|
116014
116051
|
if (hasRequiredBufferStream) return bufferStream;
|
|
116015
116052
|
hasRequiredBufferStream = 1;
|
|
116016
|
-
const { PassThrough: PassThroughStream } =
|
|
116053
|
+
const { PassThrough: PassThroughStream } = Zr;
|
|
116017
116054
|
bufferStream = (options) => {
|
|
116018
116055
|
options = {
|
|
116019
116056
|
...options
|
|
@@ -116062,7 +116099,7 @@ ${error2.message}` : execaMessage;
|
|
|
116062
116099
|
if (hasRequiredGetStream) return getStream.exports;
|
|
116063
116100
|
hasRequiredGetStream = 1;
|
|
116064
116101
|
const { constants: BufferConstants } = require$$0$6;
|
|
116065
|
-
const stream2 =
|
|
116102
|
+
const stream2 = Zr;
|
|
116066
116103
|
const { promisify: promisify2 } = require$$0$5;
|
|
116067
116104
|
const bufferStream2 = requireBufferStream();
|
|
116068
116105
|
const streamPipelinePromisified = promisify2(stream2.pipeline);
|
|
@@ -116122,7 +116159,7 @@ ${error2.message}` : execaMessage;
|
|
|
116122
116159
|
function requireMergeStream() {
|
|
116123
116160
|
if (hasRequiredMergeStream) return mergeStream;
|
|
116124
116161
|
hasRequiredMergeStream = 1;
|
|
116125
|
-
const { PassThrough: PassThrough2 } =
|
|
116162
|
+
const { PassThrough: PassThrough2 } = Zr;
|
|
116126
116163
|
mergeStream = function() {
|
|
116127
116164
|
var sources = [];
|
|
116128
116165
|
var output = new PassThrough2({
|
|
@@ -116370,7 +116407,7 @@ ${error2.message}` : execaMessage;
|
|
|
116370
116407
|
if (hasRequiredExeca) return execa$1.exports;
|
|
116371
116408
|
hasRequiredExeca = 1;
|
|
116372
116409
|
const path2 = path__default$1;
|
|
116373
|
-
const childProcess = require$$1$
|
|
116410
|
+
const childProcess = require$$1$8;
|
|
116374
116411
|
const crossSpawn2 = requireCrossSpawn();
|
|
116375
116412
|
const stripFinalNewline2 = requireStripFinalNewline();
|
|
116376
116413
|
const npmRunPath2 = requireNpmRunPath();
|
|
@@ -117853,7 +117890,7 @@ ${error2.message}` : execaMessage;
|
|
|
117853
117890
|
validate: validate2
|
|
117854
117891
|
});
|
|
117855
117892
|
};
|
|
117856
|
-
const realZlibConstants =
|
|
117893
|
+
const realZlibConstants = $s__default.constants || {
|
|
117857
117894
|
ZLIB_VERNUM: 4736
|
|
117858
117895
|
};
|
|
117859
117896
|
const constants = Object.freeze(Object.assign(/* @__PURE__ */ Object.create(null), {
|
|
@@ -118013,11 +118050,11 @@ ${error2.message}` : execaMessage;
|
|
|
118013
118050
|
this.#flushFlag = opts.flush ?? 0;
|
|
118014
118051
|
this.#finishFlushFlag = opts.finishFlush ?? 0;
|
|
118015
118052
|
this.#fullFlushFlag = opts.fullFlushFlag ?? 0;
|
|
118016
|
-
if (typeof
|
|
118053
|
+
if (typeof $s[mode2] !== "function") {
|
|
118017
118054
|
throw new TypeError("Compression method not supported: " + mode2);
|
|
118018
118055
|
}
|
|
118019
118056
|
try {
|
|
118020
|
-
this.#handle = new
|
|
118057
|
+
this.#handle = new $s[mode2](opts);
|
|
118021
118058
|
} catch (er) {
|
|
118022
118059
|
throw new ZlibError(er, this.constructor);
|
|
118023
118060
|
}
|
|
@@ -121032,7 +121069,7 @@ ${error2.message}` : execaMessage;
|
|
|
121032
121069
|
return checkCwd(dir, done2);
|
|
121033
121070
|
}
|
|
121034
121071
|
if (preserve) {
|
|
121035
|
-
return
|
|
121072
|
+
return jt__default.mkdir(dir, {
|
|
121036
121073
|
mode: mode2,
|
|
121037
121074
|
recursive: true
|
|
121038
121075
|
}).then((made) => done2(null, made ?? void 0), done2);
|
|
@@ -122282,7 +122319,7 @@ ${error2.message}` : execaMessage;
|
|
|
122282
122319
|
hasRequiredFdSlicer = 1;
|
|
122283
122320
|
var fs2 = fs__default;
|
|
122284
122321
|
var util2 = require$$0$5;
|
|
122285
|
-
var stream2 =
|
|
122322
|
+
var stream2 = Zr;
|
|
122286
122323
|
var Readable2 = stream2.Readable;
|
|
122287
122324
|
var Writable = stream2.Writable;
|
|
122288
122325
|
var PassThrough2 = stream2.PassThrough;
|
|
@@ -122848,14 +122885,14 @@ ${error2.message}` : execaMessage;
|
|
|
122848
122885
|
if (hasRequiredYauzl) return yauzl;
|
|
122849
122886
|
hasRequiredYauzl = 1;
|
|
122850
122887
|
var fs2 = fs__default;
|
|
122851
|
-
var zlib =
|
|
122888
|
+
var zlib = $s__default;
|
|
122852
122889
|
var fd_slicer = requireFdSlicer();
|
|
122853
122890
|
var crc322 = requireBufferCrc32();
|
|
122854
122891
|
var util2 = require$$0$5;
|
|
122855
122892
|
var EventEmitter2 = require$$0$7.EventEmitter;
|
|
122856
|
-
var Transform2 =
|
|
122857
|
-
var PassThrough2 =
|
|
122858
|
-
var Writable =
|
|
122893
|
+
var Transform2 = Zr.Transform;
|
|
122894
|
+
var PassThrough2 = Zr.PassThrough;
|
|
122895
|
+
var Writable = Zr.Writable;
|
|
122859
122896
|
yauzl.open = open2;
|
|
122860
122897
|
yauzl.fromFd = fromFd;
|
|
122861
122898
|
yauzl.fromBuffer = fromBuffer;
|
|
@@ -124284,60 +124321,154 @@ ${error2.message}` : execaMessage;
|
|
|
124284
124321
|
highWaterMark
|
|
124285
124322
|
}));
|
|
124286
124323
|
}
|
|
124287
|
-
const version$
|
|
124324
|
+
const version$7 = "1.6.2";
|
|
124288
124325
|
const dependencies$1 = {
|
|
124289
|
-
"@openai/codex": "^0.
|
|
124326
|
+
"@openai/codex": "^0.148.0"
|
|
124290
124327
|
};
|
|
124291
124328
|
const codexPackageJson = {
|
|
124292
|
-
version: version$
|
|
124329
|
+
version: version$7,
|
|
124293
124330
|
dependencies: dependencies$1
|
|
124294
124331
|
};
|
|
124295
|
-
const version$
|
|
124332
|
+
const version$6 = "0.1.0";
|
|
124296
124333
|
const grokPackageJson = {
|
|
124297
|
-
version: version$
|
|
124334
|
+
version: version$6
|
|
124298
124335
|
};
|
|
124299
|
-
const version$
|
|
124336
|
+
const version$5 = "2.1.232";
|
|
124300
124337
|
const platforms = {
|
|
124301
124338
|
"darwin-arm64": {
|
|
124302
|
-
"
|
|
124303
|
-
"
|
|
124339
|
+
"binary": "claude",
|
|
124340
|
+
"checksum": "7b39c1588df919d001dea3ffd5651adb682f2451b5a0e18d42d4233296b53cc7",
|
|
124341
|
+
"size": 306111312
|
|
124304
124342
|
},
|
|
124305
124343
|
"darwin-x64": {
|
|
124306
|
-
"
|
|
124307
|
-
"
|
|
124344
|
+
"binary": "claude",
|
|
124345
|
+
"checksum": "aa3d606d7bf0ea9739a6d0de11810e72a662e7a4e5061d67ee7f8bc47c8890f9",
|
|
124346
|
+
"size": 314779248
|
|
124308
124347
|
},
|
|
124309
124348
|
"linux-arm64": {
|
|
124310
|
-
"
|
|
124311
|
-
"
|
|
124349
|
+
"binary": "claude",
|
|
124350
|
+
"checksum": "20797ebc644dfc47a69865c46d5cf702c7dbedd48d4268063b8828ebd55b39d0",
|
|
124351
|
+
"size": 320133352
|
|
124312
124352
|
},
|
|
124313
124353
|
"linux-x64": {
|
|
124314
|
-
"
|
|
124315
|
-
"
|
|
124354
|
+
"binary": "claude",
|
|
124355
|
+
"checksum": "61d23f8749136907d586d5b11831ea8a5234d4c1dea40a5e55c33b52e204c6d1",
|
|
124356
|
+
"size": 323021104
|
|
124316
124357
|
},
|
|
124317
124358
|
"linux-arm64-musl": {
|
|
124318
|
-
"
|
|
124319
|
-
"
|
|
124359
|
+
"binary": "claude",
|
|
124360
|
+
"checksum": "bf6481aa98b84d3e51460f7cf07fe54cb8d116882b72cee7bff941a2776ac91e",
|
|
124361
|
+
"size": 313278016
|
|
124320
124362
|
},
|
|
124321
124363
|
"linux-x64-musl": {
|
|
124322
|
-
"
|
|
124323
|
-
"
|
|
124364
|
+
"binary": "claude",
|
|
124365
|
+
"checksum": "93c8a9ef90adfa5bb8a34dfd5f32fc4e820532ca1e1ec5e6bb2049a5069a03b4",
|
|
124366
|
+
"size": 317165312
|
|
124324
124367
|
},
|
|
124325
124368
|
"win32-x64": {
|
|
124326
|
-
"
|
|
124327
|
-
"
|
|
124369
|
+
"binary": "claude.exe",
|
|
124370
|
+
"checksum": "ec9e32479bc887809003c91384c6c3a26e7691856d1916f72f6f6d21800f3bd6",
|
|
124371
|
+
"size": 319026336
|
|
124328
124372
|
},
|
|
124329
124373
|
"win32-arm64": {
|
|
124330
|
-
"
|
|
124331
|
-
"
|
|
124374
|
+
"binary": "claude.exe",
|
|
124375
|
+
"checksum": "301bfd5a624d6280d4d4e4ba7523fafdfa439a33e9530478719eeb6efec51d52",
|
|
124376
|
+
"size": 306950304
|
|
124332
124377
|
}
|
|
124333
124378
|
};
|
|
124334
124379
|
const claudeSdkManifestJson = {
|
|
124335
|
-
version: version$
|
|
124380
|
+
version: version$5,
|
|
124336
124381
|
platforms
|
|
124337
124382
|
};
|
|
124338
|
-
const version$
|
|
124383
|
+
const version$4 = "0.3.232";
|
|
124339
124384
|
const claudeSdkPackageJson = {
|
|
124340
|
-
version: version$
|
|
124385
|
+
version: version$4
|
|
124386
|
+
};
|
|
124387
|
+
const sdkVersion = "0.3.232";
|
|
124388
|
+
const version$3 = "2.1.232";
|
|
124389
|
+
const artifacts$1 = {
|
|
124390
|
+
"darwin-arm64": {
|
|
124391
|
+
"fileName": "anthropic-ai-claude-agent-sdk-darwin-arm64-0.3.232.tar.zst",
|
|
124392
|
+
"sha256": "09c775adf243d27a5c13e6724b3960409612b0da483c38fa108a1c03be515a5a",
|
|
124393
|
+
"size": 70030420
|
|
124394
|
+
},
|
|
124395
|
+
"darwin-x64": {
|
|
124396
|
+
"fileName": "anthropic-ai-claude-agent-sdk-darwin-x64-0.3.232.tar.zst",
|
|
124397
|
+
"sha256": "68f687528e5d610e14a379ff7ad1e6a60aa7d600b4dc20dc31b4af96fffda570",
|
|
124398
|
+
"size": 74349877
|
|
124399
|
+
},
|
|
124400
|
+
"linux-arm64": {
|
|
124401
|
+
"fileName": "anthropic-ai-claude-agent-sdk-linux-arm64-0.3.232.tar.zst",
|
|
124402
|
+
"sha256": "8c7c75910f5d29c3cf3fe15e4c17abfb05db616db2838b3a764f6b243ad78165",
|
|
124403
|
+
"size": 79104443
|
|
124404
|
+
},
|
|
124405
|
+
"linux-x64": {
|
|
124406
|
+
"fileName": "anthropic-ai-claude-agent-sdk-linux-x64-0.3.232.tar.zst",
|
|
124407
|
+
"sha256": "e0303ad6167b82fad98a80dd6dc3fd23d82562de5181094775c388118951d999",
|
|
124408
|
+
"size": 79732583
|
|
124409
|
+
},
|
|
124410
|
+
"linux-arm64-musl": {
|
|
124411
|
+
"fileName": "anthropic-ai-claude-agent-sdk-linux-arm64-musl-0.3.232.tar.zst",
|
|
124412
|
+
"sha256": "b0dd9da5095baf314160e3a3f6ac1c85a1ef4b4e326c4bde662f92fe8783840b",
|
|
124413
|
+
"size": 77411461
|
|
124414
|
+
},
|
|
124415
|
+
"linux-x64-musl": {
|
|
124416
|
+
"fileName": "anthropic-ai-claude-agent-sdk-linux-x64-musl-0.3.232.tar.zst",
|
|
124417
|
+
"sha256": "989e8148bb5944d038f4ea11595742084ec3b38837e08e5af25229ada27c3730",
|
|
124418
|
+
"size": 77995010
|
|
124419
|
+
},
|
|
124420
|
+
"win32-arm64": {
|
|
124421
|
+
"fileName": "anthropic-ai-claude-agent-sdk-win32-arm64-0.3.232.tar.zst",
|
|
124422
|
+
"sha256": "7cc4f6f2a23fa43993da830e00e3e2ca46b90864a2d38e1f3678f70de9e2f440",
|
|
124423
|
+
"size": 78979373
|
|
124424
|
+
},
|
|
124425
|
+
"win32-x64": {
|
|
124426
|
+
"fileName": "anthropic-ai-claude-agent-sdk-win32-x64-0.3.232.tar.zst",
|
|
124427
|
+
"sha256": "ed09d440d4cf7881439850287485d3198384538c79d8d3e5f0740b1e40b10db3",
|
|
124428
|
+
"size": 82535283
|
|
124429
|
+
}
|
|
124430
|
+
};
|
|
124431
|
+
const claudeRuntimeManifestJson = {
|
|
124432
|
+
sdkVersion,
|
|
124433
|
+
version: version$3,
|
|
124434
|
+
artifacts: artifacts$1
|
|
124435
|
+
};
|
|
124436
|
+
const version$2 = "0.148.0";
|
|
124437
|
+
const artifacts = {
|
|
124438
|
+
"darwin-arm64": {
|
|
124439
|
+
"fileName": "codex-package-aarch64-apple-darwin.tar.zst",
|
|
124440
|
+
"sha256": "dba92ada12f223751f30a9535c81c6a3ac6a2c1b2469d628c92b3e6be38eff66",
|
|
124441
|
+
"size": 76351891
|
|
124442
|
+
},
|
|
124443
|
+
"darwin-x64": {
|
|
124444
|
+
"fileName": "codex-package-x86_64-apple-darwin.tar.zst",
|
|
124445
|
+
"sha256": "ea8a14bca1cfc5a80d2a90e532617cc3c089cb69d2a114a61db645de6d051916",
|
|
124446
|
+
"size": 83818234
|
|
124447
|
+
},
|
|
124448
|
+
"linux-arm64": {
|
|
124449
|
+
"fileName": "codex-package-aarch64-unknown-linux-musl.tar.zst",
|
|
124450
|
+
"sha256": "084e6261fd68bd2a869f319375a022b2294d7d0f4044cbb113b8fa0755b01af9",
|
|
124451
|
+
"size": 79728248
|
|
124452
|
+
},
|
|
124453
|
+
"linux-x64": {
|
|
124454
|
+
"fileName": "codex-package-x86_64-unknown-linux-musl.tar.zst",
|
|
124455
|
+
"sha256": "257701de0d625d46e0e1c0c69db1a8a3fc1265c646a190e9fb965d1f66d54cd2",
|
|
124456
|
+
"size": 85609844
|
|
124457
|
+
},
|
|
124458
|
+
"win32-arm64": {
|
|
124459
|
+
"fileName": "codex-package-aarch64-pc-windows-msvc.tar.zst",
|
|
124460
|
+
"sha256": "e043d518a6ad64271616bf4408737672e2e48b5ce472d2f0a69149434ad0d189",
|
|
124461
|
+
"size": 87165328
|
|
124462
|
+
},
|
|
124463
|
+
"win32-x64": {
|
|
124464
|
+
"fileName": "codex-package-x86_64-pc-windows-msvc.tar.zst",
|
|
124465
|
+
"sha256": "a9fc1afe438a326aa25b11c31ec7586c176f3713d7ee2a0bfd17b869283bd6ff",
|
|
124466
|
+
"size": 93722309
|
|
124467
|
+
}
|
|
124468
|
+
};
|
|
124469
|
+
const codexRuntimeManifestJson = {
|
|
124470
|
+
version: version$2,
|
|
124471
|
+
artifacts
|
|
124341
124472
|
};
|
|
124342
124473
|
const version$1 = "0.37.0-lody.753c83056944";
|
|
124343
124474
|
const minNodeVersion = "22.19.0";
|
|
@@ -124443,14 +124574,19 @@ ${error2.message}` : execaMessage;
|
|
|
124443
124574
|
}
|
|
124444
124575
|
return true;
|
|
124445
124576
|
}
|
|
124446
|
-
const
|
|
124447
|
-
const
|
|
124448
|
-
if (
|
|
124449
|
-
throw new Error(`
|
|
124577
|
+
const CODEX_DEPENDENCY_VERSION = resolveSingleDependencyVersion("@openai/codex", codexPackageJson.dependencies["@openai/codex"]);
|
|
124578
|
+
const CODEX_RUNTIME_VERSION = codexRuntimeManifestJson.version;
|
|
124579
|
+
if (CODEX_RUNTIME_VERSION !== CODEX_DEPENDENCY_VERSION) {
|
|
124580
|
+
throw new Error(`Codex runtime manifest ${CODEX_RUNTIME_VERSION} does not match @openai/codex ${CODEX_DEPENDENCY_VERSION}. Run pnpm mirror:agent-runtimes -- --runtime codex to refresh it.`);
|
|
124581
|
+
}
|
|
124582
|
+
const CLAUDE_DEPENDENCY_VERSION = resolveSingleDependencyVersion("@anthropic-ai/claude-agent-sdk", packageJson.dependencies["@anthropic-ai/claude-agent-sdk"]);
|
|
124583
|
+
const CLAUDE_AGENT_SDK_VERSION = claudeRuntimeManifestJson.sdkVersion;
|
|
124584
|
+
const CLAUDE_CODE_RUNTIME_VERSION = claudeRuntimeManifestJson.version;
|
|
124585
|
+
if (claudeSdkPackageJson.version !== CLAUDE_DEPENDENCY_VERSION || CLAUDE_AGENT_SDK_VERSION !== CLAUDE_DEPENDENCY_VERSION || CLAUDE_CODE_RUNTIME_VERSION !== claudeSdkManifestJson.version) {
|
|
124586
|
+
throw new Error(`Claude runtime manifest ${CLAUDE_AGENT_SDK_VERSION}/${CLAUDE_CODE_RUNTIME_VERSION} does not match @anthropic-ai/claude-agent-sdk ${CLAUDE_DEPENDENCY_VERSION}/${claudeSdkManifestJson.version}. Run pnpm mirror:agent-runtimes -- --runtime claude-code to refresh it.`);
|
|
124450
124587
|
}
|
|
124451
124588
|
const CODEX_ACP_ADAPTER_VERSION = codexPackageJson.version;
|
|
124452
124589
|
const CLAUDE_ACP_ADAPTER_VERSION = packageJson.version;
|
|
124453
|
-
const CLAUDE_CODE_RUNTIME_VERSION = claudeSdkManifestJson.version;
|
|
124454
124590
|
const KIMI_CODE_VERSION = kimiRuntimeManifestJson.version;
|
|
124455
124591
|
const GROK_ACP_ADAPTER_VERSION = grokPackageJson.version;
|
|
124456
124592
|
const GROK_BUILD_RUNTIME_VERSION = runtimeManifest.officialRuntime.version;
|
|
@@ -124459,139 +124595,55 @@ ${error2.message}` : execaMessage;
|
|
|
124459
124595
|
const BUILTIN_CLAUDE_CAPABILITY_SOURCE_VERSION = `builtin-claude-acp:${CLAUDE_ACP_ADAPTER_VERSION}+agent-sdk:${CLAUDE_AGENT_SDK_VERSION}+claude-code:${CLAUDE_CODE_RUNTIME_VERSION}`;
|
|
124460
124596
|
const BUILTIN_KIMI_CAPABILITY_SOURCE_VERSION = `builtin-kimi:${KIMI_CODE_VERSION}`;
|
|
124461
124597
|
const BUILTIN_GROK_CAPABILITY_SOURCE_VERSION = `builtin-grok-acp:${GROK_ACP_ADAPTER_VERSION}+official-grok:${GROK_BUILD_RUNTIME_VERSION}`;
|
|
124598
|
+
function createCodexRuntimeArchive(platform2) {
|
|
124599
|
+
const artifact2 = codexRuntimeManifestJson.artifacts[platform2];
|
|
124600
|
+
return {
|
|
124601
|
+
fileName: artifact2.fileName,
|
|
124602
|
+
sha256: artifact2.sha256,
|
|
124603
|
+
size: artifact2.size,
|
|
124604
|
+
compression: "zstd",
|
|
124605
|
+
cmd: platform2.startsWith("win32-") ? "bin/codex.exe" : "bin/codex"
|
|
124606
|
+
};
|
|
124607
|
+
}
|
|
124608
|
+
function createClaudeRuntimeArchive(platform2) {
|
|
124609
|
+
const artifact2 = claudeRuntimeManifestJson.artifacts[platform2];
|
|
124610
|
+
const executable = claudeSdkManifestJson.platforms[platform2];
|
|
124611
|
+
return {
|
|
124612
|
+
fileName: artifact2.fileName,
|
|
124613
|
+
sha256: artifact2.sha256,
|
|
124614
|
+
size: artifact2.size,
|
|
124615
|
+
compression: "zstd",
|
|
124616
|
+
cmd: platform2.startsWith("win32-") ? "claude.exe" : "claude",
|
|
124617
|
+
stripComponents: 1,
|
|
124618
|
+
executableSha256: executable.checksum,
|
|
124619
|
+
executableSize: executable.size
|
|
124620
|
+
};
|
|
124621
|
+
}
|
|
124462
124622
|
const RUNTIMES = {
|
|
124463
124623
|
codex: {
|
|
124464
124624
|
name: "codex",
|
|
124465
124625
|
version: CODEX_RUNTIME_VERSION,
|
|
124466
124626
|
platforms: {
|
|
124467
|
-
"darwin-arm64":
|
|
124468
|
-
|
|
124469
|
-
|
|
124470
|
-
|
|
124471
|
-
|
|
124472
|
-
|
|
124473
|
-
},
|
|
124474
|
-
"darwin-x64": {
|
|
124475
|
-
fileName: "codex-package-x86_64-apple-darwin.tar.zst",
|
|
124476
|
-
sha256: "373c728c0912b7c65af742bb649f0ff056300f8e8a33a619be0bab62f2afc6ba",
|
|
124477
|
-
size: 85008508,
|
|
124478
|
-
compression: "zstd",
|
|
124479
|
-
cmd: "bin/codex"
|
|
124480
|
-
},
|
|
124481
|
-
"linux-arm64": {
|
|
124482
|
-
fileName: "codex-package-aarch64-unknown-linux-musl.tar.zst",
|
|
124483
|
-
sha256: "692ff5c5d9eb86774c0448d930895e46659eee6a2c12f46b97399da458c1e8b7",
|
|
124484
|
-
size: 80608473,
|
|
124485
|
-
compression: "zstd",
|
|
124486
|
-
cmd: "bin/codex"
|
|
124487
|
-
},
|
|
124488
|
-
"linux-x64": {
|
|
124489
|
-
fileName: "codex-package-x86_64-unknown-linux-musl.tar.zst",
|
|
124490
|
-
sha256: "494368127e27ab625b2a5e759f83447e1d7d00b6ae49a5e2c17df5fd7c4aac1d",
|
|
124491
|
-
size: 86804357,
|
|
124492
|
-
compression: "zstd",
|
|
124493
|
-
cmd: "bin/codex"
|
|
124494
|
-
},
|
|
124495
|
-
"win32-arm64": {
|
|
124496
|
-
fileName: "codex-package-aarch64-pc-windows-msvc.tar.zst",
|
|
124497
|
-
sha256: "0c9d43e1ce013900850c82ab558cbafae9e8b05363689ab68cc0b4c87ac2b267",
|
|
124498
|
-
size: 88080469,
|
|
124499
|
-
compression: "zstd",
|
|
124500
|
-
cmd: "bin/codex.exe"
|
|
124501
|
-
},
|
|
124502
|
-
"win32-x64": {
|
|
124503
|
-
fileName: "codex-package-x86_64-pc-windows-msvc.tar.zst",
|
|
124504
|
-
sha256: "5931e080440a0bff1413d55b62921e26238f5410d82d79e5327202bfef1833a4",
|
|
124505
|
-
size: 95093149,
|
|
124506
|
-
compression: "zstd",
|
|
124507
|
-
cmd: "bin/codex.exe"
|
|
124508
|
-
}
|
|
124627
|
+
"darwin-arm64": createCodexRuntimeArchive("darwin-arm64"),
|
|
124628
|
+
"darwin-x64": createCodexRuntimeArchive("darwin-x64"),
|
|
124629
|
+
"linux-arm64": createCodexRuntimeArchive("linux-arm64"),
|
|
124630
|
+
"linux-x64": createCodexRuntimeArchive("linux-x64"),
|
|
124631
|
+
"win32-arm64": createCodexRuntimeArchive("win32-arm64"),
|
|
124632
|
+
"win32-x64": createCodexRuntimeArchive("win32-x64")
|
|
124509
124633
|
}
|
|
124510
124634
|
},
|
|
124511
124635
|
"claude-code": {
|
|
124512
124636
|
name: "claude-code",
|
|
124513
124637
|
version: CLAUDE_CODE_RUNTIME_VERSION,
|
|
124514
124638
|
platforms: {
|
|
124515
|
-
"darwin-arm64":
|
|
124516
|
-
|
|
124517
|
-
|
|
124518
|
-
|
|
124519
|
-
|
|
124520
|
-
|
|
124521
|
-
|
|
124522
|
-
|
|
124523
|
-
executableSize: claudeSdkManifestJson.platforms["darwin-arm64"].size
|
|
124524
|
-
},
|
|
124525
|
-
"darwin-x64": {
|
|
124526
|
-
fileName: `anthropic-ai-claude-agent-sdk-darwin-x64-${CLAUDE_AGENT_SDK_VERSION}.tar.zst`,
|
|
124527
|
-
sha256: "5c74a294444e69f9b13f4e103247b6b51a7b10c555cfbce9f5434c37e662e9bb",
|
|
124528
|
-
size: 64691464,
|
|
124529
|
-
compression: "zstd",
|
|
124530
|
-
cmd: "claude",
|
|
124531
|
-
stripComponents: 1,
|
|
124532
|
-
executableSha256: claudeSdkManifestJson.platforms["darwin-x64"].checksum,
|
|
124533
|
-
executableSize: claudeSdkManifestJson.platforms["darwin-x64"].size
|
|
124534
|
-
},
|
|
124535
|
-
"linux-arm64": {
|
|
124536
|
-
fileName: `anthropic-ai-claude-agent-sdk-linux-arm64-${CLAUDE_AGENT_SDK_VERSION}.tar.zst`,
|
|
124537
|
-
sha256: "bc41781f1003c2856e3ce0044da3fa752ef279a1cc29a8e23e3ce13c8033650e",
|
|
124538
|
-
size: 69763140,
|
|
124539
|
-
compression: "zstd",
|
|
124540
|
-
cmd: "claude",
|
|
124541
|
-
stripComponents: 1,
|
|
124542
|
-
executableSha256: claudeSdkManifestJson.platforms["linux-arm64"].checksum,
|
|
124543
|
-
executableSize: claudeSdkManifestJson.platforms["linux-arm64"].size
|
|
124544
|
-
},
|
|
124545
|
-
"linux-x64": {
|
|
124546
|
-
fileName: `anthropic-ai-claude-agent-sdk-linux-x64-${CLAUDE_AGENT_SDK_VERSION}.tar.zst`,
|
|
124547
|
-
sha256: "076972a61402e14afffb5d64a40e50ab5074a3a7f3740fed44d64b6cb7839c84",
|
|
124548
|
-
size: 70585519,
|
|
124549
|
-
compression: "zstd",
|
|
124550
|
-
cmd: "claude",
|
|
124551
|
-
stripComponents: 1,
|
|
124552
|
-
executableSha256: claudeSdkManifestJson.platforms["linux-x64"].checksum,
|
|
124553
|
-
executableSize: claudeSdkManifestJson.platforms["linux-x64"].size
|
|
124554
|
-
},
|
|
124555
|
-
"linux-arm64-musl": {
|
|
124556
|
-
fileName: `anthropic-ai-claude-agent-sdk-linux-arm64-musl-${CLAUDE_AGENT_SDK_VERSION}.tar.zst`,
|
|
124557
|
-
sha256: "e9282b3ab96cb89aeb1eecba2bf7ab354486dbd48546ca8c8b0ace0844d88f75",
|
|
124558
|
-
size: 68233742,
|
|
124559
|
-
compression: "zstd",
|
|
124560
|
-
cmd: "claude",
|
|
124561
|
-
stripComponents: 1,
|
|
124562
|
-
executableSha256: claudeSdkManifestJson.platforms["linux-arm64-musl"].checksum,
|
|
124563
|
-
executableSize: claudeSdkManifestJson.platforms["linux-arm64-musl"].size
|
|
124564
|
-
},
|
|
124565
|
-
"linux-x64-musl": {
|
|
124566
|
-
fileName: `anthropic-ai-claude-agent-sdk-linux-x64-musl-${CLAUDE_AGENT_SDK_VERSION}.tar.zst`,
|
|
124567
|
-
sha256: "331f1470a4234ac1636971b7c586f41ae8c76ff987fe8d7e5736214186a93e86",
|
|
124568
|
-
size: 69249229,
|
|
124569
|
-
compression: "zstd",
|
|
124570
|
-
cmd: "claude",
|
|
124571
|
-
stripComponents: 1,
|
|
124572
|
-
executableSha256: claudeSdkManifestJson.platforms["linux-x64-musl"].checksum,
|
|
124573
|
-
executableSize: claudeSdkManifestJson.platforms["linux-x64-musl"].size
|
|
124574
|
-
},
|
|
124575
|
-
"win32-arm64": {
|
|
124576
|
-
fileName: `anthropic-ai-claude-agent-sdk-win32-arm64-${CLAUDE_AGENT_SDK_VERSION}.tar.zst`,
|
|
124577
|
-
sha256: "483e1285703ba75050055cc305a5b47526ac449bc223c2e30acaa3a7ac87560e",
|
|
124578
|
-
size: 69235703,
|
|
124579
|
-
compression: "zstd",
|
|
124580
|
-
cmd: "claude.exe",
|
|
124581
|
-
stripComponents: 1,
|
|
124582
|
-
executableSha256: claudeSdkManifestJson.platforms["win32-arm64"].checksum,
|
|
124583
|
-
executableSize: claudeSdkManifestJson.platforms["win32-arm64"].size
|
|
124584
|
-
},
|
|
124585
|
-
"win32-x64": {
|
|
124586
|
-
fileName: `anthropic-ai-claude-agent-sdk-win32-x64-${CLAUDE_AGENT_SDK_VERSION}.tar.zst`,
|
|
124587
|
-
sha256: "961eeabb2eaf9b3027fdc3caf10417ea738fb3ea64132307a7ae3a1d9f2309b8",
|
|
124588
|
-
size: 71046598,
|
|
124589
|
-
compression: "zstd",
|
|
124590
|
-
cmd: "claude.exe",
|
|
124591
|
-
stripComponents: 1,
|
|
124592
|
-
executableSha256: claudeSdkManifestJson.platforms["win32-x64"].checksum,
|
|
124593
|
-
executableSize: claudeSdkManifestJson.platforms["win32-x64"].size
|
|
124594
|
-
}
|
|
124639
|
+
"darwin-arm64": createClaudeRuntimeArchive("darwin-arm64"),
|
|
124640
|
+
"darwin-x64": createClaudeRuntimeArchive("darwin-x64"),
|
|
124641
|
+
"linux-arm64": createClaudeRuntimeArchive("linux-arm64"),
|
|
124642
|
+
"linux-x64": createClaudeRuntimeArchive("linux-x64"),
|
|
124643
|
+
"linux-arm64-musl": createClaudeRuntimeArchive("linux-arm64-musl"),
|
|
124644
|
+
"linux-x64-musl": createClaudeRuntimeArchive("linux-x64-musl"),
|
|
124645
|
+
"win32-arm64": createClaudeRuntimeArchive("win32-arm64"),
|
|
124646
|
+
"win32-x64": createClaudeRuntimeArchive("win32-x64")
|
|
124595
124647
|
}
|
|
124596
124648
|
},
|
|
124597
124649
|
"kimi-code": {
|
|
@@ -128923,7 +128975,7 @@ main().catch(() => {});
|
|
|
128923
128975
|
}
|
|
128924
128976
|
const readErrorCode = (error2) => error2 && typeof error2 === "object" ? error2.code : void 0;
|
|
128925
128977
|
function mapGitSpawnError(error2, cwd) {
|
|
128926
|
-
if (readErrorCode(error2) === "ENOENT" && fs$
|
|
128978
|
+
if (readErrorCode(error2) === "ENOENT" && fs$1.existsSync(cwd)) {
|
|
128927
128979
|
return new GitExecutableNotFoundError(error2);
|
|
128928
128980
|
}
|
|
128929
128981
|
return error2;
|
|
@@ -154681,11 +154733,11 @@ ${entry.text}`).join("\n\n");
|
|
|
154681
154733
|
return null;
|
|
154682
154734
|
}
|
|
154683
154735
|
try {
|
|
154684
|
-
const stat2 = await
|
|
154736
|
+
const stat2 = await jt.stat(absolutePath);
|
|
154685
154737
|
if (!stat2.isFile() || stat2.size > (options?.maxBytes ?? defaultMaxTextFileBytes)) {
|
|
154686
154738
|
return null;
|
|
154687
154739
|
}
|
|
154688
|
-
const content = await
|
|
154740
|
+
const content = await jt.readFile(absolutePath);
|
|
154689
154741
|
if (content.includes(0)) {
|
|
154690
154742
|
return null;
|
|
154691
154743
|
}
|
|
@@ -160519,18 +160571,18 @@ ${entry.text}`).join("\n\n");
|
|
|
160519
160571
|
};
|
|
160520
160572
|
async function ensureCatalogDir(filePath) {
|
|
160521
160573
|
const dir = path__default$1.dirname(filePath);
|
|
160522
|
-
await fs__default$
|
|
160574
|
+
await fs__default$2.mkdir(dir, {
|
|
160523
160575
|
recursive: true,
|
|
160524
160576
|
mode: 448
|
|
160525
160577
|
});
|
|
160526
160578
|
if (process.platform !== "win32") {
|
|
160527
|
-
await fs__default$
|
|
160579
|
+
await fs__default$2.chmod(dir, 448);
|
|
160528
160580
|
}
|
|
160529
160581
|
}
|
|
160530
160582
|
async function readCatalogFile(filePath) {
|
|
160531
160583
|
let raw2;
|
|
160532
160584
|
try {
|
|
160533
|
-
raw2 = await fs__default$
|
|
160585
|
+
raw2 = await fs__default$2.readFile(filePath, "utf8");
|
|
160534
160586
|
} catch (error2) {
|
|
160535
160587
|
throw mapReadError(filePath, error2);
|
|
160536
160588
|
}
|
|
@@ -160556,21 +160608,21 @@ ${entry.text}`).join("\n\n");
|
|
|
160556
160608
|
const parsed = CatalogSnapshotSchema.parse(snapshot);
|
|
160557
160609
|
await ensureCatalogDir(filePath);
|
|
160558
160610
|
const tempPath = `${filePath}.${process.pid}.${crypto__default.randomUUID()}.tmp`;
|
|
160559
|
-
await fs__default$
|
|
160611
|
+
await fs__default$2.writeFile(tempPath, `${JSON.stringify(parsed, null, 2)}
|
|
160560
160612
|
`, {
|
|
160561
160613
|
mode: 384
|
|
160562
160614
|
});
|
|
160563
160615
|
if (process.platform !== "win32") {
|
|
160564
|
-
await fs__default$
|
|
160616
|
+
await fs__default$2.chmod(tempPath, 384);
|
|
160565
160617
|
}
|
|
160566
|
-
await fs__default$
|
|
160618
|
+
await fs__default$2.rename(tempPath, filePath);
|
|
160567
160619
|
if (process.platform !== "win32") {
|
|
160568
|
-
await fs__default$
|
|
160620
|
+
await fs__default$2.chmod(filePath, 384);
|
|
160569
160621
|
}
|
|
160570
160622
|
}
|
|
160571
160623
|
async function backupCorruptCatalog(filePath) {
|
|
160572
160624
|
const backupPath = `${filePath}.corrupt-${process.pid}-${getServerNow()}`;
|
|
160573
|
-
await fs__default$
|
|
160625
|
+
await fs__default$2.rename(filePath, backupPath);
|
|
160574
160626
|
}
|
|
160575
160627
|
function makeLocalWorkspaceCatalog(options = {}) {
|
|
160576
160628
|
const filePath = options.filePath ?? getLocalWorkspaceCatalogPath();
|
|
@@ -162624,7 +162676,7 @@ ${escapeHtmlScriptContent(VISUAL_ANNOTATION_INSPECTOR_BROWSER_SCRIPT)}
|
|
|
162624
162676
|
const isPreviewRegistryEntry = (value) => typeof value === "object" && value !== null && typeof value.key === "string" && Number.isInteger(value.pid) && typeof value.workspaceId === "string" && typeof value.machineId === "string" && typeof value.sessionId === "string" && typeof value.grantId === "string" && Number.isInteger(value.updatedAt);
|
|
162625
162677
|
const readPreviewRegistryEntries = async () => {
|
|
162626
162678
|
try {
|
|
162627
|
-
const raw2 = await fs__default$
|
|
162679
|
+
const raw2 = await fs__default$2.readFile(PREVIEW_REGISTRY_FILE, "utf8");
|
|
162628
162680
|
const parsed = JSON.parse(raw2);
|
|
162629
162681
|
if (!Array.isArray(parsed)) {
|
|
162630
162682
|
return [];
|
|
@@ -162635,13 +162687,13 @@ ${escapeHtmlScriptContent(VISUAL_ANNOTATION_INSPECTOR_BROWSER_SCRIPT)}
|
|
|
162635
162687
|
}
|
|
162636
162688
|
};
|
|
162637
162689
|
const writePreviewRegistryEntries = async (entries) => {
|
|
162638
|
-
await fs__default$
|
|
162690
|
+
await fs__default$2.mkdir(path__default$1.dirname(PREVIEW_REGISTRY_FILE), {
|
|
162639
162691
|
recursive: true
|
|
162640
162692
|
});
|
|
162641
162693
|
const tmpPath = `${PREVIEW_REGISTRY_FILE}.${process.pid}.tmp`;
|
|
162642
|
-
await fs__default$
|
|
162694
|
+
await fs__default$2.writeFile(tmpPath, `${JSON.stringify(entries)}
|
|
162643
162695
|
`, "utf8");
|
|
162644
|
-
await fs__default$
|
|
162696
|
+
await fs__default$2.rename(tmpPath, PREVIEW_REGISTRY_FILE);
|
|
162645
162697
|
};
|
|
162646
162698
|
const filterLivePreviewRegistryEntries = (entries, now2) => entries.filter((entry) => isProcessAlive$1(entry.pid) && entry.updatedAt <= now2 + PREVIEW_REGISTRY_FUTURE_SKEW_MS);
|
|
162647
162699
|
const classifyPreviewTunnelCloseError = (error2) => {
|
|
@@ -163413,6 +163465,7 @@ ${escapeHtmlScriptContent(VISUAL_ANNOTATION_INSPECTOR_BROWSER_SCRIPT)}
|
|
|
163413
163465
|
}
|
|
163414
163466
|
const ACP_OPERATION_TIMEOUT_MS = 12e4;
|
|
163415
163467
|
const ACP_PROCESS_EXIT_TIMEOUT_MS = 3e3;
|
|
163468
|
+
const LODY_READ_SESSION_HISTORY_METHOD = "_lody/session/history/read";
|
|
163416
163469
|
const MAX_LOCAL_PROJECT_HISTORY_CATALOG_SESSIONS = 100;
|
|
163417
163470
|
function waitForChildProcessExit(child, timeoutMs) {
|
|
163418
163471
|
if (child.exitCode !== null) {
|
|
@@ -163553,7 +163606,7 @@ ${escapeHtmlScriptContent(VISUAL_ANNOTATION_INSPECTOR_BROWSER_SCRIPT)}
|
|
|
163553
163606
|
const resolved = path__default$1.resolve(rootPath);
|
|
163554
163607
|
let real = null;
|
|
163555
163608
|
try {
|
|
163556
|
-
real = await fs$
|
|
163609
|
+
real = await fs$2.realpath(resolved);
|
|
163557
163610
|
} catch {
|
|
163558
163611
|
real = null;
|
|
163559
163612
|
}
|
|
@@ -163565,6 +163618,36 @@ ${escapeHtmlScriptContent(VISUAL_ANNOTATION_INSPECTOR_BROWSER_SCRIPT)}
|
|
|
163565
163618
|
}
|
|
163566
163619
|
return paths;
|
|
163567
163620
|
}
|
|
163621
|
+
function getLodyReadSessionHistoryMethod(initResponse) {
|
|
163622
|
+
const meta = initResponse.agentCapabilities?._meta;
|
|
163623
|
+
if (!meta || typeof meta !== "object" || Array.isArray(meta)) return null;
|
|
163624
|
+
const lody = meta.lody;
|
|
163625
|
+
if (!lody || typeof lody !== "object" || Array.isArray(lody)) return null;
|
|
163626
|
+
const capability = lody.readSessionHistory;
|
|
163627
|
+
if (!capability || typeof capability !== "object" || Array.isArray(capability)) return null;
|
|
163628
|
+
const record2 = capability;
|
|
163629
|
+
return record2.version === 1 && record2.method === LODY_READ_SESSION_HISTORY_METHOD ? LODY_READ_SESSION_HISTORY_METHOD : null;
|
|
163630
|
+
}
|
|
163631
|
+
async function requestHistorySessionReplay(args2) {
|
|
163632
|
+
if (args2.provider.cliType === "builtin" && args2.provider.agentType === "codex") {
|
|
163633
|
+
const method = getLodyReadSessionHistoryMethod(args2.initResponse);
|
|
163634
|
+
if (!method) {
|
|
163635
|
+
throw new Error(`${getProviderLabel$1(args2.provider)} ACP agent does not advertise agentCapabilities._meta.lody.readSessionHistory version 1`);
|
|
163636
|
+
}
|
|
163637
|
+
await withTimeout(args2.connection.request(method, {
|
|
163638
|
+
sessionId: args2.acpSessionId
|
|
163639
|
+
}), `${getProviderLabel$1(args2.provider)} ACP readSessionHistory (${args2.acpSessionId})`);
|
|
163640
|
+
return;
|
|
163641
|
+
}
|
|
163642
|
+
if (!args2.initResponse.agentCapabilities?.loadSession) {
|
|
163643
|
+
throw new Error(`${getProviderLabel$1(args2.provider)} ACP agent does not advertise loadSession`);
|
|
163644
|
+
}
|
|
163645
|
+
await withTimeout(args2.connection.loadSession({
|
|
163646
|
+
sessionId: args2.acpSessionId,
|
|
163647
|
+
cwd: args2.cwd,
|
|
163648
|
+
mcpServers: []
|
|
163649
|
+
}), `${getProviderLabel$1(args2.provider)} ACP loadSession (${args2.acpSessionId})`);
|
|
163650
|
+
}
|
|
163568
163651
|
async function listPaginatedHistorySessions(cwd, listPage, options = {}) {
|
|
163569
163652
|
const sessions = [];
|
|
163570
163653
|
const maxSessions = options.maxSessions ?? Number.POSITIVE_INFINITY;
|
|
@@ -163634,14 +163717,13 @@ ${escapeHtmlScriptContent(VISUAL_ANNOTATION_INSPECTOR_BROWSER_SCRIPT)}
|
|
|
163634
163717
|
logger: args2.logger
|
|
163635
163718
|
});
|
|
163636
163719
|
try {
|
|
163637
|
-
|
|
163638
|
-
|
|
163639
|
-
|
|
163640
|
-
await withTimeout(connection2.loadSession({
|
|
163641
|
-
sessionId: args2.acpSessionId,
|
|
163720
|
+
await requestHistorySessionReplay({
|
|
163721
|
+
provider: args2.provider,
|
|
163722
|
+
acpSessionId: args2.acpSessionId,
|
|
163642
163723
|
cwd,
|
|
163643
|
-
|
|
163644
|
-
|
|
163724
|
+
connection: connection2,
|
|
163725
|
+
initResponse
|
|
163726
|
+
});
|
|
163645
163727
|
return collector.notifications;
|
|
163646
163728
|
} catch (error2) {
|
|
163647
163729
|
const message = `Failed to load ${getProviderLabel$1(args2.provider)} session ${args2.acpSessionId}: ${formatErrorMessage(error2)}`;
|
|
@@ -163982,6 +164064,7 @@ ${escapeHtmlScriptContent(VISUAL_ANNOTATION_INSPECTOR_BROWSER_SCRIPT)}
|
|
|
163982
164064
|
}
|
|
163983
164065
|
function getHistoryCatalogStatus(existing) {
|
|
163984
164066
|
if (!existing) return "available";
|
|
164067
|
+
if (existing.meta.externalHistory?.status === "metadata_only") return "available";
|
|
163985
164068
|
return existing.meta.externalHistory?.status === "sync_conflict" ? "sync_conflict" : "imported";
|
|
163986
164069
|
}
|
|
163987
164070
|
function buildCatalogItem(provider, info, existing) {
|
|
@@ -164025,17 +164108,6 @@ ${escapeHtmlScriptContent(VISUAL_ANNOTATION_INSPECTOR_BROWSER_SCRIPT)}
|
|
|
164025
164108
|
conflictReason: args2.conflictReason
|
|
164026
164109
|
};
|
|
164027
164110
|
}
|
|
164028
|
-
function buildMetadataOnlyExternalHistoryMeta(args2) {
|
|
164029
|
-
return {
|
|
164030
|
-
provider: args2.provider,
|
|
164031
|
-
source: "local-acp-history",
|
|
164032
|
-
sourceAcpSessionId: args2.sourceAcpSessionId,
|
|
164033
|
-
sourceUpdatedAt: args2.sourceUpdatedAt ?? void 0,
|
|
164034
|
-
importedTurnCount: 0,
|
|
164035
|
-
lastSyncAt: getServerNow(),
|
|
164036
|
-
status: "metadata_only"
|
|
164037
|
-
};
|
|
164038
|
-
}
|
|
164039
164111
|
class LocalProjectHistorySyncService {
|
|
164040
164112
|
constructor(manager, logger2, context2, provider) {
|
|
164041
164113
|
this.manager = manager;
|
|
@@ -164123,10 +164195,23 @@ ${escapeHtmlScriptContent(VISUAL_ANNOTATION_INSPECTOR_BROWSER_SCRIPT)}
|
|
|
164123
164195
|
});
|
|
164124
164196
|
const existing = await this.findExistingHistorySession(args2.localProjectId, selectedId) ?? snapshot.existingByImportKey.get(importKey);
|
|
164125
164197
|
if (!existing) {
|
|
164198
|
+
const replayNotifications = await loadHistorySessionReplay({
|
|
164199
|
+
provider: this.provider,
|
|
164200
|
+
rootPath: args2.rootPath,
|
|
164201
|
+
acpSessionId,
|
|
164202
|
+
logger: this.logger
|
|
164203
|
+
});
|
|
164204
|
+
const materialized = materializeReplay({
|
|
164205
|
+
provider: this.provider,
|
|
164206
|
+
acpSessionId,
|
|
164207
|
+
replayNotifications,
|
|
164208
|
+
userId: this.context.userId
|
|
164209
|
+
});
|
|
164126
164210
|
const importedSession = await this.importNewSession({
|
|
164127
164211
|
info,
|
|
164128
164212
|
acpSessionId,
|
|
164129
|
-
project
|
|
164213
|
+
project,
|
|
164214
|
+
materialized
|
|
164130
164215
|
});
|
|
164131
164216
|
snapshot.existingByImportKey.set(importKey, importedSession);
|
|
164132
164217
|
summary2.imported += 1;
|
|
@@ -164146,7 +164231,7 @@ ${escapeHtmlScriptContent(VISUAL_ANNOTATION_INSPECTOR_BROWSER_SCRIPT)}
|
|
|
164146
164231
|
acpSessionId,
|
|
164147
164232
|
message: formatErrorMessage(error2)
|
|
164148
164233
|
});
|
|
164149
|
-
this.logger.
|
|
164234
|
+
this.logger.warn(`[${this.providerKey}-history-sync] Failed to import ${getProviderLabel(this.provider)} session ${acpSessionId}: ${formatErrorMessage(error2)}`);
|
|
164150
164235
|
}
|
|
164151
164236
|
}
|
|
164152
164237
|
const catalog = await this.writeCatalogResult({
|
|
@@ -164401,13 +164486,38 @@ ${escapeHtmlScriptContent(VISUAL_ANNOTATION_INSPECTOR_BROWSER_SCRIPT)}
|
|
|
164401
164486
|
title: resolveSessionTitle(args2.info, this.provider),
|
|
164402
164487
|
titleSource: "draft",
|
|
164403
164488
|
lastMessageAt,
|
|
164404
|
-
externalHistory:
|
|
164489
|
+
externalHistory: buildExternalHistoryMeta({
|
|
164405
164490
|
provider: this.provider,
|
|
164406
164491
|
sourceAcpSessionId: args2.acpSessionId,
|
|
164407
|
-
sourceUpdatedAt: args2.info.updatedAt
|
|
164492
|
+
sourceUpdatedAt: args2.info.updatedAt,
|
|
164493
|
+
materialized: args2.materialized
|
|
164408
164494
|
})
|
|
164409
164495
|
};
|
|
164410
|
-
|
|
164496
|
+
try {
|
|
164497
|
+
const sessionDoc = await this.manager.getOrCreateSessionDoc(sessionId);
|
|
164498
|
+
await sessionDoc.updateHistory(() => args2.materialized.history);
|
|
164499
|
+
await writeSessionImportedTurnHashes(sessionDoc, args2.materialized.turnHashes);
|
|
164500
|
+
await this.manager.repo.upsertDocMeta(roomId, meta);
|
|
164501
|
+
const synced = await sessionDoc.waitUntilSynced();
|
|
164502
|
+
if (!synced) {
|
|
164503
|
+
this.logger.warn(`[${this.providerKey}-history-sync] Imported history for ${sessionId} did not confirm remote sync before unload; it remains locally durable and will retry sync.`);
|
|
164504
|
+
}
|
|
164505
|
+
} catch (error2) {
|
|
164506
|
+
await this.manager.repo.deleteDoc(roomId).catch((cleanupError) => {
|
|
164507
|
+
this.logger.warn(`[${this.providerKey}-history-sync] Failed to delete incomplete imported session ${sessionId}: ${formatErrorMessage(cleanupError)}`);
|
|
164508
|
+
});
|
|
164509
|
+
await this.manager.cleanSessionDoc(sessionId, {
|
|
164510
|
+
preserveStatus: true
|
|
164511
|
+
}).catch((cleanupError) => {
|
|
164512
|
+
this.logger.warn(`[${this.providerKey}-history-sync] Failed to unload incomplete imported session ${sessionId}: ${formatErrorMessage(cleanupError)}`);
|
|
164513
|
+
});
|
|
164514
|
+
throw error2;
|
|
164515
|
+
}
|
|
164516
|
+
await this.manager.cleanSessionDoc(sessionId, {
|
|
164517
|
+
preserveStatus: true
|
|
164518
|
+
}).catch((cleanupError) => {
|
|
164519
|
+
this.logger.warn(`[${this.providerKey}-history-sync] Failed to unload imported session ${sessionId}: ${formatErrorMessage(cleanupError)}`);
|
|
164520
|
+
});
|
|
164411
164521
|
return {
|
|
164412
164522
|
sessionId,
|
|
164413
164523
|
meta
|
|
@@ -164500,7 +164610,7 @@ ${escapeHtmlScriptContent(VISUAL_ANNOTATION_INSPECTOR_BROWSER_SCRIPT)}
|
|
|
164500
164610
|
await this.manager.cleanSessionDoc(args2.existing.sessionId, {
|
|
164501
164611
|
preserveStatus: true
|
|
164502
164612
|
});
|
|
164503
|
-
return suffix.length > 0 ? "refreshed" : "skipped";
|
|
164613
|
+
return externalHistory.status === "metadata_only" || suffix.length > 0 ? "refreshed" : "skipped";
|
|
164504
164614
|
}
|
|
164505
164615
|
async markConflict(sessionId, info, materialized, reason) {
|
|
164506
164616
|
await this.manager.repo.upsertDocMeta(getSessionRoomId(sessionId), {
|
|
@@ -175094,7 +175204,7 @@ export PATH=${toSingleQuotedShellString(ghShimBinDir)}:"$PATH"
|
|
|
175094
175204
|
}
|
|
175095
175205
|
InternalCodec.prototype.encoder = InternalEncoder;
|
|
175096
175206
|
InternalCodec.prototype.decoder = InternalDecoder;
|
|
175097
|
-
var StringDecoder2 = require$$1$
|
|
175207
|
+
var StringDecoder2 = require$$1$3.StringDecoder;
|
|
175098
175208
|
if (!StringDecoder2.prototype.end) StringDecoder2.prototype.end = function() {
|
|
175099
175209
|
};
|
|
175100
175210
|
function InternalDecoder(options, codec) {
|
|
@@ -179203,11 +179313,7 @@ export PATH=${toSingleQuotedShellString(ghShimBinDir)}:"$PATH"
|
|
|
179203
179313
|
async startProcess(params, hooks2) {
|
|
179204
179314
|
const workdir = this.resolveWorkdir(params.cwd);
|
|
179205
179315
|
const env2 = this.buildEnv(params.env);
|
|
179206
|
-
const
|
|
179207
|
-
const processHandle = await this.sandbox.spawn("bash", [
|
|
179208
|
-
"-lc",
|
|
179209
|
-
formattedCommand
|
|
179210
|
-
], {
|
|
179316
|
+
const processHandle = await this.sandbox.spawn(params.command, params.args, {
|
|
179211
179317
|
cwd: workdir,
|
|
179212
179318
|
env: env2,
|
|
179213
179319
|
stdio: [
|
|
@@ -179256,13 +179362,6 @@ export PATH=${toSingleQuotedShellString(ghShimBinDir)}:"$PATH"
|
|
|
179256
179362
|
state2.handle.dispose();
|
|
179257
179363
|
}
|
|
179258
179364
|
}
|
|
179259
|
-
function formatCommand(command2, args2) {
|
|
179260
|
-
if (!args2.length) {
|
|
179261
|
-
return command2;
|
|
179262
|
-
}
|
|
179263
|
-
const serializedArgs = args2.map((arg) => `'${arg.replace(/'/g, `'"'"'`)}'`).join(" ");
|
|
179264
|
-
return `${command2} ${serializedArgs}`;
|
|
179265
|
-
}
|
|
179266
179365
|
function truncateBuffer(buffer2, limit2) {
|
|
179267
179366
|
if (buffer2.length <= limit2) {
|
|
179268
179367
|
return buffer2;
|
|
@@ -179305,7 +179404,7 @@ export PATH=${toSingleQuotedShellString(ghShimBinDir)}:"$PATH"
|
|
|
179305
179404
|
const deps = {
|
|
179306
179405
|
platform: process.platform,
|
|
179307
179406
|
setPriority: os__default$1.setPriority,
|
|
179308
|
-
writeFile: fs$
|
|
179407
|
+
writeFile: fs$2.writeFile,
|
|
179309
179408
|
...options.deps ?? {}
|
|
179310
179409
|
};
|
|
179311
179410
|
if (deps.platform !== "linux") {
|
|
@@ -179357,10 +179456,10 @@ export PATH=${toSingleQuotedShellString(ghShimBinDir)}:"$PATH"
|
|
|
179357
179456
|
const defaultSandboxDeps = () => ({
|
|
179358
179457
|
platform: process.platform,
|
|
179359
179458
|
cgroupMount: DEFAULT_CGROUP_MOUNT,
|
|
179360
|
-
fs: fs$
|
|
179459
|
+
fs: fs$2,
|
|
179361
179460
|
spawnProcess: spawn,
|
|
179362
179461
|
readSelfCgroupPath: async () => {
|
|
179363
|
-
const content = await fs$
|
|
179462
|
+
const content = await fs$2.readFile("/proc/self/cgroup", "utf8");
|
|
179364
179463
|
const line3 = content.split("\n").map((item) => item.trim()).find((item) => item.startsWith("0::"));
|
|
179365
179464
|
if (!line3) {
|
|
179366
179465
|
throw new Error("Unable to determine current cgroup path from /proc/self/cgroup");
|
|
@@ -184389,7 +184488,7 @@ export PATH=${toSingleQuotedShellString(ghShimBinDir)}:"$PATH"
|
|
|
184389
184488
|
async function loadOrCreateLocalIdentity(logger2, options = {}) {
|
|
184390
184489
|
const identityPath = options.filePath ?? getLocalIdentityPath();
|
|
184391
184490
|
try {
|
|
184392
|
-
const raw2 = await fs__default$
|
|
184491
|
+
const raw2 = await fs__default$2.readFile(identityPath, "utf-8");
|
|
184393
184492
|
const parsed = JSON.parse(raw2);
|
|
184394
184493
|
if (typeof parsed.userId === "string" && parsed.userId.startsWith(LOCAL_USER_ID_PREFIX) && typeof parsed.createdAt === "string") {
|
|
184395
184494
|
return {
|
|
@@ -184404,11 +184503,11 @@ export PATH=${toSingleQuotedShellString(ghShimBinDir)}:"$PATH"
|
|
|
184404
184503
|
userId: `${LOCAL_USER_ID_PREFIX}${crypto__default.randomUUID().replaceAll("-", "")}`,
|
|
184405
184504
|
createdAt: new Date(getServerNow()).toISOString()
|
|
184406
184505
|
};
|
|
184407
|
-
await fs__default$
|
|
184506
|
+
await fs__default$2.mkdir(path__default$1.dirname(identityPath), {
|
|
184408
184507
|
recursive: true,
|
|
184409
184508
|
mode: 448
|
|
184410
184509
|
});
|
|
184411
|
-
await fs__default$
|
|
184510
|
+
await fs__default$2.writeFile(identityPath, `${JSON.stringify(identity2, null, 2)}
|
|
184412
184511
|
`, {
|
|
184413
184512
|
mode: 384
|
|
184414
184513
|
});
|
|
@@ -190667,7 +190766,7 @@ Shutting down gracefully${reason}...`);
|
|
|
190667
190766
|
function getUserPipeSuffix() {
|
|
190668
190767
|
if (typeof process.getuid === "function") return String(process.getuid());
|
|
190669
190768
|
const userInfo2 = os__default.userInfo();
|
|
190670
|
-
return
|
|
190769
|
+
return crypto__default$1.createHash("sha256").update(`${userInfo2.uid}:${userInfo2.username}:${os__default.homedir()}`).digest("hex").slice(0, 16);
|
|
190671
190770
|
}
|
|
190672
190771
|
function getLocalCliHostEndpoint(platform2) {
|
|
190673
190772
|
const profile = getInstallationProfile(platform2);
|
|
@@ -190745,7 +190844,7 @@ Shutting down gracefully${reason}...`);
|
|
|
190745
190844
|
function tokensEqual(actual, expected) {
|
|
190746
190845
|
const actualBytes = Buffer.from(actual);
|
|
190747
190846
|
const expectedBytes = Buffer.from(expected);
|
|
190748
|
-
return actualBytes.length === expectedBytes.length &&
|
|
190847
|
+
return actualBytes.length === expectedBytes.length && crypto__default$1.timingSafeEqual(actualBytes, expectedBytes);
|
|
190749
190848
|
}
|
|
190750
190849
|
async function createListeningHost(endpoint, record2, shutdownControl) {
|
|
190751
190850
|
const sockets = /* @__PURE__ */ new Set();
|
|
@@ -191027,7 +191126,7 @@ Shutting down gracefully${reason}...`);
|
|
|
191027
191126
|
});
|
|
191028
191127
|
scrubLocalSupervisorCapabilityEnv();
|
|
191029
191128
|
await traceAsync(logger2, "startup.process_resource_profile", void 0, async () => normalizeCurrentProcessResourceProfile(logger2));
|
|
191030
|
-
for (const diagnostic of getRuntimeDiagnostics(version$
|
|
191129
|
+
for (const diagnostic of getRuntimeDiagnostics(version$9)) {
|
|
191031
191130
|
logger2.info(diagnostic);
|
|
191032
191131
|
}
|
|
191033
191132
|
if (options.heartbeatLog) {
|
|
@@ -192153,7 +192252,7 @@ Shutting down gracefully${reason}...`);
|
|
|
192153
192252
|
const defaultOpts = {
|
|
192154
192253
|
defaultWidth: 0,
|
|
192155
192254
|
output: process.stdout,
|
|
192156
|
-
tty: require$$1$
|
|
192255
|
+
tty: require$$1$2
|
|
192157
192256
|
};
|
|
192158
192257
|
if (!options) {
|
|
192159
192258
|
return defaultOpts;
|
|
@@ -194507,7 +194606,7 @@ Shutting down gracefully${reason}...`);
|
|
|
194507
194606
|
function requireLib$1() {
|
|
194508
194607
|
if (hasRequiredLib$1) return lib$1;
|
|
194509
194608
|
hasRequiredLib$1 = 1;
|
|
194510
|
-
const Stream =
|
|
194609
|
+
const Stream = Zr;
|
|
194511
194610
|
class MuteStream2 extends Stream {
|
|
194512
194611
|
#isTTY = null;
|
|
194513
194612
|
constructor(opts = {}) {
|
|
@@ -200709,7 +200808,7 @@ ${page}${helpTipBottom}${choiceDescription}${error2}${ansiEscapes.cursorHide}`;
|
|
|
200709
200808
|
}
|
|
200710
200809
|
InternalCodec.prototype.encoder = InternalEncoder;
|
|
200711
200810
|
InternalCodec.prototype.decoder = InternalDecoder;
|
|
200712
|
-
var StringDecoder2 = require$$1$
|
|
200811
|
+
var StringDecoder2 = require$$1$3.StringDecoder;
|
|
200713
200812
|
if (!StringDecoder2.prototype.end) StringDecoder2.prototype.end = function() {
|
|
200714
200813
|
};
|
|
200715
200814
|
function InternalDecoder(options, codec) {
|
|
@@ -203985,7 +204084,7 @@ ${page}${helpTipBottom}${choiceDescription}${error2}${ansiEscapes.cursorHide}`;
|
|
|
203985
204084
|
function requireStreams() {
|
|
203986
204085
|
if (hasRequiredStreams) return streams;
|
|
203987
204086
|
hasRequiredStreams = 1;
|
|
203988
|
-
var Buffer2 = require$$0$6.Buffer, Transform2 =
|
|
204087
|
+
var Buffer2 = require$$0$6.Buffer, Transform2 = Zr.Transform;
|
|
203989
204088
|
streams = function(iconv2) {
|
|
203990
204089
|
iconv2.encodeStream = function encodeStream(encoding2, options) {
|
|
203991
204090
|
return new IconvLiteEncoderStream(iconv2.getEncoder(encoding2, options), options);
|
|
@@ -204205,7 +204304,7 @@ ${page}${helpTipBottom}${choiceDescription}${error2}${ansiEscapes.cursorHide}`;
|
|
|
204205
204304
|
return length2;
|
|
204206
204305
|
};
|
|
204207
204306
|
if (iconv2.supportsStreams) {
|
|
204208
|
-
var Readable2 =
|
|
204307
|
+
var Readable2 = Zr.Readable;
|
|
204209
204308
|
original.ReadableSetEncoding = Readable2.prototype.setEncoding;
|
|
204210
204309
|
Readable2.prototype.setEncoding = function setEncoding(enc, options) {
|
|
204211
204310
|
this._readableState.decoder = iconv2.getDecoder(enc, options);
|
|
@@ -204226,7 +204325,7 @@ ${page}${helpTipBottom}${choiceDescription}${error2}${ansiEscapes.cursorHide}`;
|
|
|
204226
204325
|
Buffer2.prototype.toString = original.BufferToString;
|
|
204227
204326
|
Buffer2.prototype.write = original.BufferWrite;
|
|
204228
204327
|
if (iconv2.supportsStreams) {
|
|
204229
|
-
var Readable2 =
|
|
204328
|
+
var Readable2 = Zr.Readable;
|
|
204230
204329
|
Readable2.prototype.setEncoding = original.ReadableSetEncoding;
|
|
204231
204330
|
delete Readable2.prototype.collect;
|
|
204232
204331
|
}
|
|
@@ -204815,7 +204914,7 @@ ${page}${helpTipBottom}${choiceDescription}${error2}${ansiEscapes.cursorHide}`;
|
|
|
204815
204914
|
value: true
|
|
204816
204915
|
});
|
|
204817
204916
|
var chardet_1 = requireChardet();
|
|
204818
|
-
var child_process_1 = require$$1$
|
|
204917
|
+
var child_process_1 = require$$1$8;
|
|
204819
204918
|
var fs_1 = fs__default;
|
|
204820
204919
|
var iconv_lite_1 = requireLib();
|
|
204821
204920
|
var tmp_1 = requireTmp();
|
|
@@ -218628,8 +218727,8 @@ ${page}${helpTipBottom}${choiceDescription}${ansiEscapes.cursorHide}`;
|
|
|
218628
218727
|
const sessionDir = joinExportPath(args2.outputDir, "sessions", sessionDirName);
|
|
218629
218728
|
const summary2 = toExportSessionSummary(args2.session, args2.workspaceId);
|
|
218630
218729
|
const history = await args2.manager.getSessionHistorySnapshot(args2.session.id);
|
|
218631
|
-
const
|
|
218632
|
-
let attachments =
|
|
218730
|
+
const artifacts2 = buildSessionArtifacts(history);
|
|
218731
|
+
let attachments = artifacts2.attachments;
|
|
218633
218732
|
if (args2.downloadImages) {
|
|
218634
218733
|
attachments = await mapWithConcurrency$1(attachments, ATTACHMENT_EXPORT_CONCURRENCY, async (attachment) => {
|
|
218635
218734
|
const downloaded = await downloadSessionAttachment({
|
|
@@ -218652,11 +218751,11 @@ ${page}${helpTipBottom}${choiceDescription}${ansiEscapes.cursorHide}`;
|
|
|
218652
218751
|
}
|
|
218653
218752
|
await writeJson(path__default.join(sessionDir, "transcript.json"), {
|
|
218654
218753
|
session: summary2,
|
|
218655
|
-
turns:
|
|
218754
|
+
turns: artifacts2.transcript
|
|
218656
218755
|
});
|
|
218657
218756
|
await writeText(path__default.join(sessionDir, "transcript.md"), buildTranscriptMarkdown({
|
|
218658
218757
|
session: summary2,
|
|
218659
|
-
turns:
|
|
218758
|
+
turns: artifacts2.transcript,
|
|
218660
218759
|
attachments
|
|
218661
218760
|
}));
|
|
218662
218761
|
await writeJson(path__default.join(sessionDir, "artifacts", "attachments", "index.json"), attachments);
|
|
@@ -218904,7 +219003,7 @@ ${page}${helpTipBottom}${choiceDescription}${ansiEscapes.cursorHide}`;
|
|
|
218904
219003
|
data = createReviewBundleSnapshot(bundle);
|
|
218905
219004
|
}
|
|
218906
219005
|
const { injectReviewSnapshot } = await import("./chunks/index-VoI6Ds2-.js");
|
|
218907
|
-
const { resolveReviewViewerTemplate } = await import("./chunks/review-viewer-
|
|
219006
|
+
const { resolveReviewViewerTemplate } = await import("./chunks/review-viewer-BZC6lRid.js").then(async (m) => {
|
|
218908
219007
|
await m.__tla;
|
|
218909
219008
|
return m;
|
|
218910
219009
|
});
|
|
@@ -220590,9 +220689,9 @@ ${result.stdout ?? ""}`;
|
|
|
220590
220689
|
const passthroughArgs = cmd.args;
|
|
220591
220690
|
captureDaemonEvent("daemon_restart_requested");
|
|
220592
220691
|
const runningProbeHealth = await fetchLocalProbeHealth();
|
|
220593
|
-
const versionMismatchHealth = runningProbeHealth && runningProbeHealth.cliVersion !== version$
|
|
220692
|
+
const versionMismatchHealth = runningProbeHealth && runningProbeHealth.cliVersion !== version$9 ? runningProbeHealth : null;
|
|
220594
220693
|
if (versionMismatchHealth) {
|
|
220595
|
-
console.log(`Running daemon uses lody v${versionMismatchHealth.cliVersion}; current CLI is v${version$
|
|
220694
|
+
console.log(`Running daemon uses lody v${versionMismatchHealth.cliVersion}; current CLI is v${version$9}. Restarting with current CLI.`);
|
|
220596
220695
|
}
|
|
220597
220696
|
const stopResult = await stopDaemonProcess();
|
|
220598
220697
|
captureDaemonEvent("daemon_stop_result", {
|
|
@@ -220799,7 +220898,7 @@ ${result.stdout ?? ""}`;
|
|
|
220799
220898
|
});
|
|
220800
220899
|
logger2.info(`Daemon watchdog started (PID ${process.pid})`);
|
|
220801
220900
|
await normalizeCurrentProcessResourceProfile(logger2);
|
|
220802
|
-
for (const diagnostic of getRuntimeDiagnostics(version$
|
|
220901
|
+
for (const diagnostic of getRuntimeDiagnostics(version$9)) {
|
|
220803
220902
|
logger2.info(diagnostic);
|
|
220804
220903
|
}
|
|
220805
220904
|
const passthroughArgs = cmd.args;
|
|
@@ -239432,7 +239531,7 @@ ${result.stdout ?? ""}`;
|
|
|
239432
239531
|
cliToken: auth.token,
|
|
239433
239532
|
source: "mcp",
|
|
239434
239533
|
feedback: args2.feedback,
|
|
239435
|
-
cliVersion: version$
|
|
239534
|
+
cliVersion: version$9
|
|
239436
239535
|
}));
|
|
239437
239536
|
} catch (error2) {
|
|
239438
239537
|
return mcpErrorResult(error2);
|
|
@@ -241823,7 +241922,7 @@ data:
|
|
|
241823
241922
|
cliToken: auth.token,
|
|
241824
241923
|
source: "cli",
|
|
241825
241924
|
feedback,
|
|
241826
|
-
cliVersion: version$
|
|
241925
|
+
cliVersion: version$9
|
|
241827
241926
|
});
|
|
241828
241927
|
if (options.json) {
|
|
241829
241928
|
printJson(result);
|
|
@@ -242153,7 +242252,7 @@ Other machines will not see it until this machine syncs.`);
|
|
|
242153
242252
|
logger2.warn(`[dns] invalid LODY_DNS_RESULT_ORDER value; expected ipv4first|ipv6first|verbatim|node \u2014 falling back to ipv4first`);
|
|
242154
242253
|
}
|
|
242155
242254
|
try {
|
|
242156
|
-
require$$1$
|
|
242255
|
+
require$$1$7.setDefaultResultOrder(resolution.order);
|
|
242157
242256
|
logger2.debug(`[dns] default DNS result order set to ${resolution.order} (${resolution.reason})`);
|
|
242158
242257
|
} catch (error2) {
|
|
242159
242258
|
logger2.debug(`[dns] failed to set DNS result order: ${error2 instanceof Error ? error2.message : String(error2)}`);
|
|
@@ -242168,7 +242267,7 @@ Other machines will not see it until this machine syncs.`);
|
|
|
242168
242267
|
logger: getLogger("http-transport")
|
|
242169
242268
|
});
|
|
242170
242269
|
program = new Command();
|
|
242171
|
-
program.name("lody").description("Lody Agent CLI tool for managing remote command execution").version(version$
|
|
242270
|
+
program.name("lody").description("Lody Agent CLI tool for managing remote command execution").version(version$9, "-v, --version", "display version number").enablePositionalOptions();
|
|
242172
242271
|
program.addCommand(loginCommand);
|
|
242173
242272
|
program.addCommand(logoutCommand);
|
|
242174
242273
|
program.addCommand(startCommand);
|