chatroom-cli 1.97.2 → 1.97.3
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/index.js +477 -222
- package/dist/index.js.map +28 -17
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -81827,12 +81827,84 @@ var init_skill = __esm(() => {
|
|
|
81827
81827
|
init_convex_error();
|
|
81828
81828
|
});
|
|
81829
81829
|
|
|
81830
|
+
// src/infrastructure/services/workspace/normalize-working-dir.ts
|
|
81831
|
+
function normalizeWorkingDirForLookup(workingDir) {
|
|
81832
|
+
return workingDir.trim().replace(/[/\\]+$/, "");
|
|
81833
|
+
}
|
|
81834
|
+
|
|
81835
|
+
// src/commands/workspace/file-tree.ts
|
|
81836
|
+
async function createDefaultDeps16() {
|
|
81837
|
+
const client4 = await getConvexClient();
|
|
81838
|
+
return {
|
|
81839
|
+
backend: {
|
|
81840
|
+
mutation: (endpoint, args2) => client4.mutation(endpoint, args2),
|
|
81841
|
+
query: (endpoint, args2) => client4.query(endpoint, args2)
|
|
81842
|
+
},
|
|
81843
|
+
session: { getSessionId }
|
|
81844
|
+
};
|
|
81845
|
+
}
|
|
81846
|
+
async function requireSession3(deps) {
|
|
81847
|
+
const sessionId = await deps.session.getSessionId();
|
|
81848
|
+
if (!sessionId)
|
|
81849
|
+
throw new Error("Not authenticated. Please run: chatroom auth login");
|
|
81850
|
+
return sessionId;
|
|
81851
|
+
}
|
|
81852
|
+
async function requestWorkspaceFileTreeFromCli(machineId, workingDir, options, deps) {
|
|
81853
|
+
const d = deps ?? await createDefaultDeps16();
|
|
81854
|
+
const sessionId = await requireSession3(d);
|
|
81855
|
+
const result = await d.backend.mutation(api.workspaceFiles.requestFileTree, {
|
|
81856
|
+
sessionId,
|
|
81857
|
+
machineId,
|
|
81858
|
+
workingDir,
|
|
81859
|
+
...options.force ? { force: true } : {}
|
|
81860
|
+
});
|
|
81861
|
+
return result;
|
|
81862
|
+
}
|
|
81863
|
+
async function getWorkspaceFileTreeStatusFromCli(machineId, workingDir, deps) {
|
|
81864
|
+
const d = deps ?? await createDefaultDeps16();
|
|
81865
|
+
const sessionId = await requireSession3(d);
|
|
81866
|
+
const [checkpoint, manifest, pendingRequests] = await Promise.all([
|
|
81867
|
+
d.backend.query(api.workspaceFiles.getFileTreeCheckpoint, {
|
|
81868
|
+
sessionId,
|
|
81869
|
+
machineId,
|
|
81870
|
+
workingDir
|
|
81871
|
+
}),
|
|
81872
|
+
d.backend.query(api.workspaceFiles.getFileTreeManifestV3, {
|
|
81873
|
+
sessionId,
|
|
81874
|
+
machineId,
|
|
81875
|
+
workingDir
|
|
81876
|
+
}),
|
|
81877
|
+
d.backend.query(api.workspaceFiles.getPendingFileTreeRequests, {
|
|
81878
|
+
sessionId,
|
|
81879
|
+
machineId
|
|
81880
|
+
})
|
|
81881
|
+
]);
|
|
81882
|
+
const normalized = normalizeWorkingDirForLookup(workingDir);
|
|
81883
|
+
const filtered = Array.isArray(pendingRequests) ? pendingRequests.filter((r) => r && typeof r === "object" && ("workingDir" in r) && normalizeWorkingDirForLookup(String(r.workingDir)) === normalized) : pendingRequests;
|
|
81884
|
+
return { checkpoint, manifest, pendingRequests: filtered };
|
|
81885
|
+
}
|
|
81886
|
+
var init_file_tree = __esm(() => {
|
|
81887
|
+
init_api3();
|
|
81888
|
+
init_storage();
|
|
81889
|
+
init_client2();
|
|
81890
|
+
});
|
|
81891
|
+
|
|
81892
|
+
// src/commands/workspace/index.ts
|
|
81893
|
+
var exports_workspace = {};
|
|
81894
|
+
__export(exports_workspace, {
|
|
81895
|
+
requestWorkspaceFileTreeFromCli: () => requestWorkspaceFileTreeFromCli,
|
|
81896
|
+
getWorkspaceFileTreeStatusFromCli: () => getWorkspaceFileTreeStatusFromCli
|
|
81897
|
+
});
|
|
81898
|
+
var init_workspace = __esm(() => {
|
|
81899
|
+
init_file_tree();
|
|
81900
|
+
});
|
|
81901
|
+
|
|
81830
81902
|
// src/commands/messages/send.ts
|
|
81831
81903
|
var exports_send = {};
|
|
81832
81904
|
__export(exports_send, {
|
|
81833
81905
|
sendUserMessage: () => sendUserMessage
|
|
81834
81906
|
});
|
|
81835
|
-
async function
|
|
81907
|
+
async function createDefaultDeps17() {
|
|
81836
81908
|
const client4 = await getConvexClient();
|
|
81837
81909
|
return {
|
|
81838
81910
|
backend: {
|
|
@@ -81842,7 +81914,7 @@ async function createDefaultDeps16() {
|
|
|
81842
81914
|
session: { getSessionId }
|
|
81843
81915
|
};
|
|
81844
81916
|
}
|
|
81845
|
-
async function
|
|
81917
|
+
async function requireSession4(deps) {
|
|
81846
81918
|
const sessionId = await deps.session.getSessionId();
|
|
81847
81919
|
if (!sessionId)
|
|
81848
81920
|
throw new Error("Not authenticated. Please run: chatroom auth login");
|
|
@@ -81851,8 +81923,8 @@ async function requireSession3(deps) {
|
|
|
81851
81923
|
async function sendUserMessage(chatroomId, options, deps) {
|
|
81852
81924
|
if (!options.content.trim())
|
|
81853
81925
|
throw new Error("Message content cannot be empty");
|
|
81854
|
-
const d = deps ?? await
|
|
81855
|
-
const sessionId = await
|
|
81926
|
+
const d = deps ?? await createDefaultDeps17();
|
|
81927
|
+
const sessionId = await requireSession4(d);
|
|
81856
81928
|
const chatroom = await d.backend.query(api.chatrooms.get, {
|
|
81857
81929
|
sessionId,
|
|
81858
81930
|
chatroomId
|
|
@@ -82350,7 +82422,7 @@ __export(exports_messages, {
|
|
|
82350
82422
|
anchorMessagesEffect: () => anchorMessagesEffect,
|
|
82351
82423
|
anchorMessages: () => anchorMessages
|
|
82352
82424
|
});
|
|
82353
|
-
async function
|
|
82425
|
+
async function createDefaultDeps18() {
|
|
82354
82426
|
const client4 = await getConvexClient();
|
|
82355
82427
|
return {
|
|
82356
82428
|
backend: {
|
|
@@ -82410,12 +82482,12 @@ function handleMessagesError(err) {
|
|
|
82410
82482
|
});
|
|
82411
82483
|
}
|
|
82412
82484
|
async function listBySenderRole(chatroomId, options, deps) {
|
|
82413
|
-
const d = deps ?? await
|
|
82485
|
+
const d = deps ?? await createDefaultDeps18();
|
|
82414
82486
|
const layer = commandServicesLayerFromDeps(d);
|
|
82415
82487
|
await exports_Effect.runPromise(listBySenderRoleEffect(chatroomId, options).pipe(exports_Effect.catchAll((err) => handleMessagesError(err)), exports_Effect.provide(layer)));
|
|
82416
82488
|
}
|
|
82417
82489
|
async function listSinceMessage(chatroomId, options, deps) {
|
|
82418
|
-
const d = deps ?? await
|
|
82490
|
+
const d = deps ?? await createDefaultDeps18();
|
|
82419
82491
|
const layer = commandServicesLayerFromDeps(d);
|
|
82420
82492
|
await exports_Effect.runPromise(listSinceMessageEffect(chatroomId, options).pipe(exports_Effect.catchAll((err) => handleMessagesError(err)), exports_Effect.provide(layer)));
|
|
82421
82493
|
}
|
|
@@ -82541,7 +82613,7 @@ __export(exports_context2, {
|
|
|
82541
82613
|
inspectContextEffect: () => inspectContextEffect,
|
|
82542
82614
|
inspectContext: () => inspectContext
|
|
82543
82615
|
});
|
|
82544
|
-
async function
|
|
82616
|
+
async function createDefaultDeps19() {
|
|
82545
82617
|
return createConvexCommandDeps();
|
|
82546
82618
|
}
|
|
82547
82619
|
function requireAuthenticatedChatroom(chatroomId) {
|
|
@@ -82583,17 +82655,17 @@ function handleContextError(err) {
|
|
|
82583
82655
|
});
|
|
82584
82656
|
}
|
|
82585
82657
|
async function readContext(chatroomId, options, deps) {
|
|
82586
|
-
const d = deps ?? await
|
|
82658
|
+
const d = deps ?? await createDefaultDeps19();
|
|
82587
82659
|
const layer = commandServicesLayerFromDeps(d);
|
|
82588
82660
|
await exports_Effect.runPromise(readContextEffect(chatroomId, options).pipe(exports_Effect.catchAll((err) => handleContextError(err)), exports_Effect.provide(layer)));
|
|
82589
82661
|
}
|
|
82590
82662
|
async function newContext(chatroomId, options, deps) {
|
|
82591
|
-
const d = deps ?? await
|
|
82663
|
+
const d = deps ?? await createDefaultDeps19();
|
|
82592
82664
|
const layer = commandServicesLayerFromDeps(d);
|
|
82593
82665
|
await exports_Effect.runPromise(newContextEffect(chatroomId, options).pipe(exports_Effect.catchAll((err) => handleContextError(err)), exports_Effect.provide(layer)));
|
|
82594
82666
|
}
|
|
82595
82667
|
async function listContexts(chatroomId, options, deps) {
|
|
82596
|
-
const d = deps ?? await
|
|
82668
|
+
const d = deps ?? await createDefaultDeps19();
|
|
82597
82669
|
const layer = commandServicesLayerFromDeps(d);
|
|
82598
82670
|
await exports_Effect.runPromise(listContextsEffect(chatroomId, options).pipe(exports_Effect.catchAll((err) => handleContextError(err)), exports_Effect.provide(layer)));
|
|
82599
82671
|
}
|
|
@@ -82601,7 +82673,7 @@ function viewTemplate() {
|
|
|
82601
82673
|
return getContextViewTemplate();
|
|
82602
82674
|
}
|
|
82603
82675
|
async function inspectContext(chatroomId, options, deps) {
|
|
82604
|
-
const d = deps ?? await
|
|
82676
|
+
const d = deps ?? await createDefaultDeps19();
|
|
82605
82677
|
const layer = commandServicesLayerFromDeps(d);
|
|
82606
82678
|
await exports_Effect.runPromise(inspectContextEffect(chatroomId, options).pipe(exports_Effect.catchAll((err) => handleContextError(err)), exports_Effect.provide(layer)));
|
|
82607
82679
|
}
|
|
@@ -82794,7 +82866,7 @@ __export(exports_guidelines, {
|
|
|
82794
82866
|
listGuidelineTypesEffect: () => listGuidelineTypesEffect,
|
|
82795
82867
|
listGuidelineTypes: () => listGuidelineTypes
|
|
82796
82868
|
});
|
|
82797
|
-
async function
|
|
82869
|
+
async function createDefaultDeps20() {
|
|
82798
82870
|
const client4 = await getConvexClient();
|
|
82799
82871
|
return {
|
|
82800
82872
|
backend: {
|
|
@@ -82835,12 +82907,12 @@ function handleListGuidelineTypesError(err) {
|
|
|
82835
82907
|
});
|
|
82836
82908
|
}
|
|
82837
82909
|
async function viewGuidelines(options, deps) {
|
|
82838
|
-
const d = deps ?? await
|
|
82910
|
+
const d = deps ?? await createDefaultDeps20();
|
|
82839
82911
|
const layer = layerFromDeps7(d);
|
|
82840
82912
|
await exports_Effect.runPromise(viewGuidelinesEffect(options).pipe(exports_Effect.catchAll((err) => handleViewGuidelinesError(err)), exports_Effect.provide(layer)));
|
|
82841
82913
|
}
|
|
82842
82914
|
async function listGuidelineTypes(deps) {
|
|
82843
|
-
const d = deps ?? await
|
|
82915
|
+
const d = deps ?? await createDefaultDeps20();
|
|
82844
82916
|
const layer = layerFromDeps7(d);
|
|
82845
82917
|
await exports_Effect.runPromise(listGuidelineTypesEffect().pipe(exports_Effect.catchAll((err) => handleListGuidelineTypesError(err)), exports_Effect.provide(layer)));
|
|
82846
82918
|
}
|
|
@@ -82910,7 +82982,7 @@ __export(exports_artifact, {
|
|
|
82910
82982
|
createArtifactEffect: () => createArtifactEffect,
|
|
82911
82983
|
createArtifact: () => createArtifact
|
|
82912
82984
|
});
|
|
82913
|
-
async function
|
|
82985
|
+
async function createDefaultDeps21() {
|
|
82914
82986
|
return createConvexCommandDeps();
|
|
82915
82987
|
}
|
|
82916
82988
|
function handleArtifactError(err) {
|
|
@@ -82921,19 +82993,19 @@ function handleArtifactError(err) {
|
|
|
82921
82993
|
});
|
|
82922
82994
|
}
|
|
82923
82995
|
async function createArtifact(chatroomId, options, deps) {
|
|
82924
|
-
const d = deps ?? await
|
|
82996
|
+
const d = deps ?? await createDefaultDeps21();
|
|
82925
82997
|
const layer = commandServicesLayerFromDeps(d);
|
|
82926
82998
|
return exports_Effect.runPromise(createArtifactEffect(chatroomId, options).pipe(exports_Effect.catchAll((err) => handleArtifactError(err).pipe(exports_Effect.map(() => {
|
|
82927
82999
|
return;
|
|
82928
83000
|
}))), exports_Effect.provide(layer)));
|
|
82929
83001
|
}
|
|
82930
83002
|
async function viewArtifact(chatroomId, options, deps) {
|
|
82931
|
-
const d = deps ?? await
|
|
83003
|
+
const d = deps ?? await createDefaultDeps21();
|
|
82932
83004
|
const layer = commandServicesLayerFromDeps(d);
|
|
82933
83005
|
await exports_Effect.runPromise(viewArtifactEffect(chatroomId, options).pipe(exports_Effect.catchAll((err) => handleArtifactError(err)), exports_Effect.provide(layer)));
|
|
82934
83006
|
}
|
|
82935
83007
|
async function viewManyArtifacts(chatroomId, options, deps) {
|
|
82936
|
-
const d = deps ?? await
|
|
83008
|
+
const d = deps ?? await createDefaultDeps21();
|
|
82937
83009
|
const layer = commandServicesLayerFromDeps(d);
|
|
82938
83010
|
await exports_Effect.runPromise(viewManyArtifactsEffect(chatroomId, options).pipe(exports_Effect.catchAll((err) => handleArtifactError(err)), exports_Effect.provide(layer)));
|
|
82939
83011
|
}
|
|
@@ -83282,7 +83354,7 @@ __export(exports_telegram, {
|
|
|
83282
83354
|
sendMessageEffect: () => sendMessageEffect,
|
|
83283
83355
|
sendMessage: () => sendMessage
|
|
83284
83356
|
});
|
|
83285
|
-
async function
|
|
83357
|
+
async function createDefaultDeps22() {
|
|
83286
83358
|
const client4 = await getConvexClient();
|
|
83287
83359
|
return {
|
|
83288
83360
|
backend: {
|
|
@@ -83364,7 +83436,7 @@ ${err.cause.message}`);
|
|
|
83364
83436
|
});
|
|
83365
83437
|
}
|
|
83366
83438
|
async function sendMessage(options, deps) {
|
|
83367
|
-
const d = deps ?? await
|
|
83439
|
+
const d = deps ?? await createDefaultDeps22();
|
|
83368
83440
|
const layer = layerFromDeps8(d);
|
|
83369
83441
|
await exports_Effect.runPromise(sendMessageEffect(options).pipe(exports_Effect.catchAll((err) => handleSendMessageError(err)), exports_Effect.provide(layer)));
|
|
83370
83442
|
}
|
|
@@ -102319,7 +102391,7 @@ async function discoverModelsForHarness(harness, service3) {
|
|
|
102319
102391
|
async function discoverModels(agentServices) {
|
|
102320
102392
|
return exports_Effect.runPromise(discoverModelsEffect(agentServices));
|
|
102321
102393
|
}
|
|
102322
|
-
function
|
|
102394
|
+
function createDefaultDeps23() {
|
|
102323
102395
|
return {
|
|
102324
102396
|
backend: {
|
|
102325
102397
|
mutation: async () => {
|
|
@@ -102665,7 +102737,7 @@ var init_init_daemon = __esm(() => {
|
|
|
102665
102737
|
convexUrl,
|
|
102666
102738
|
agentServices,
|
|
102667
102739
|
cachedModels,
|
|
102668
|
-
deps:
|
|
102740
|
+
deps: createDefaultDeps23()
|
|
102669
102741
|
});
|
|
102670
102742
|
yield* registerEventListenersEffect().pipe(exports_Effect.provide(daemonSessionToLayers(init2)));
|
|
102671
102743
|
yield* logStartupEffect(cachedModels).pipe(exports_Effect.provide(daemonSessionToLayers(init2)));
|
|
@@ -109102,11 +109174,6 @@ var init_file_content_classifier = __esm(() => {
|
|
|
109102
109174
|
]);
|
|
109103
109175
|
});
|
|
109104
109176
|
|
|
109105
|
-
// src/infrastructure/services/workspace/normalize-working-dir.ts
|
|
109106
|
-
function normalizeWorkingDirForLookup(workingDir) {
|
|
109107
|
-
return workingDir.trim().replace(/[/\\]+$/, "");
|
|
109108
|
-
}
|
|
109109
|
-
|
|
109110
109177
|
// src/infrastructure/services/workspace/assert-registered-working-dir.ts
|
|
109111
109178
|
async function assertRegisteredWorkingDir(session2, workingDir) {
|
|
109112
109179
|
const workspaces = await getWorkspacesForMachine({
|
|
@@ -109436,6 +109503,49 @@ var init_file_content_subscription = __esm(() => {
|
|
|
109436
109503
|
init_daemon_services();
|
|
109437
109504
|
});
|
|
109438
109505
|
|
|
109506
|
+
// ../../services/backend/src/domain/workspace-file-tree/types.ts
|
|
109507
|
+
var MAX_TREE_JSON_BYTES;
|
|
109508
|
+
var init_types2 = __esm(() => {
|
|
109509
|
+
MAX_TREE_JSON_BYTES = 900 * 1024;
|
|
109510
|
+
});
|
|
109511
|
+
// ../../services/backend/src/domain/workspace-file-tree/select-strategy.ts
|
|
109512
|
+
function treeJsonByteLength(tree) {
|
|
109513
|
+
return Buffer.byteLength(JSON.stringify(tree), "utf8");
|
|
109514
|
+
}
|
|
109515
|
+
function selectFileTreeSnapshotStrategyId(tree) {
|
|
109516
|
+
return treeJsonByteLength(tree) > MAX_TREE_JSON_BYTES ? "sharded" : "blob";
|
|
109517
|
+
}
|
|
109518
|
+
var init_select_strategy = __esm(() => {
|
|
109519
|
+
init_types2();
|
|
109520
|
+
});
|
|
109521
|
+
|
|
109522
|
+
// ../../services/backend/src/domain/workspace-file-tree/registry.ts
|
|
109523
|
+
var init_registry5 = __esm(() => {
|
|
109524
|
+
init_select_strategy();
|
|
109525
|
+
});
|
|
109526
|
+
// ../../services/backend/src/domain/workspace-file-tree/transport/blob-snapshot.ts
|
|
109527
|
+
function toLegacyBlobSyncArgs(payload) {
|
|
109528
|
+
return { data: payload.data, dataHash: payload.dataHash, scannedAt: payload.scannedAt };
|
|
109529
|
+
}
|
|
109530
|
+
|
|
109531
|
+
// ../../services/backend/src/domain/workspace-file-tree/transport/sharded-snapshot.ts
|
|
109532
|
+
function toLegacyShardBatchItem(shard) {
|
|
109533
|
+
return { ...shard };
|
|
109534
|
+
}
|
|
109535
|
+
function toLegacyManifestSyncArgs(manifest) {
|
|
109536
|
+
return { ...manifest };
|
|
109537
|
+
}
|
|
109538
|
+
// ../../services/backend/src/domain/workspace-file-tree/transport/index.ts
|
|
109539
|
+
var init_transport = () => {};
|
|
109540
|
+
|
|
109541
|
+
// ../../services/backend/src/domain/workspace-file-tree/index.ts
|
|
109542
|
+
var init_workspace_file_tree = __esm(() => {
|
|
109543
|
+
init_types2();
|
|
109544
|
+
init_select_strategy();
|
|
109545
|
+
init_registry5();
|
|
109546
|
+
init_transport();
|
|
109547
|
+
});
|
|
109548
|
+
|
|
109439
109549
|
// src/infrastructure/services/workspace/file-tree-data-hash.ts
|
|
109440
109550
|
import { createHash as createHash6 } from "node:crypto";
|
|
109441
109551
|
function computeFileTreeDataHash(tree) {
|
|
@@ -109443,9 +109553,37 @@ function computeFileTreeDataHash(tree) {
|
|
|
109443
109553
|
}
|
|
109444
109554
|
var init_file_tree_data_hash = () => {};
|
|
109445
109555
|
|
|
109556
|
+
// src/infrastructure/services/workspace/transport/blob-snapshot-publish.ts
|
|
109557
|
+
import { gzipSync as gzipSync2 } from "node:zlib";
|
|
109558
|
+
function buildBlobSnapshotPayload(tree, dataHash) {
|
|
109559
|
+
const compressed = gzipSync2(Buffer.from(JSON.stringify(tree))).toString("base64");
|
|
109560
|
+
return {
|
|
109561
|
+
data: { compression: "gzip", content: compressed },
|
|
109562
|
+
dataHash,
|
|
109563
|
+
scannedAt: tree.scannedAt
|
|
109564
|
+
};
|
|
109565
|
+
}
|
|
109566
|
+
async function publishBlobSnapshot(session2, workingDir, payload) {
|
|
109567
|
+
await session2.backend.mutation(api.workspaceFiles.syncFileTreeV2, {
|
|
109568
|
+
sessionId: session2.sessionId,
|
|
109569
|
+
machineId: session2.machineId,
|
|
109570
|
+
workingDir,
|
|
109571
|
+
...toLegacyBlobSyncArgs(payload)
|
|
109572
|
+
});
|
|
109573
|
+
return {
|
|
109574
|
+
strategyId: "blob",
|
|
109575
|
+
snapshotId: payload.dataHash,
|
|
109576
|
+
scannedAt: payload.scannedAt,
|
|
109577
|
+
entryCount: 0
|
|
109578
|
+
};
|
|
109579
|
+
}
|
|
109580
|
+
var init_blob_snapshot_publish = __esm(() => {
|
|
109581
|
+
init_api3();
|
|
109582
|
+
});
|
|
109583
|
+
|
|
109446
109584
|
// src/infrastructure/services/workspace/file-tree-partition.ts
|
|
109447
109585
|
import { createHash as createHash7 } from "node:crypto";
|
|
109448
|
-
import { gzipSync as
|
|
109586
|
+
import { gzipSync as gzipSync3 } from "node:zlib";
|
|
109449
109587
|
function computeShardDataHash(payload) {
|
|
109450
109588
|
return createHash7("md5").update(JSON.stringify(payload)).digest("hex");
|
|
109451
109589
|
}
|
|
@@ -109453,9 +109591,6 @@ function shardIdForPath(path3) {
|
|
|
109453
109591
|
const slash = path3.indexOf("/");
|
|
109454
109592
|
return slash === -1 ? "__root__" : path3.slice(0, slash);
|
|
109455
109593
|
}
|
|
109456
|
-
function shouldUseV3Upload(tree) {
|
|
109457
|
-
return Buffer.byteLength(JSON.stringify(tree), "utf8") > MAX_TREE_JSON_BYTES;
|
|
109458
|
-
}
|
|
109459
109594
|
function childShardId(path3, parentShardId) {
|
|
109460
109595
|
if (parentShardId === "__root__") {
|
|
109461
109596
|
return shardIdForPath(path3);
|
|
@@ -109482,7 +109617,7 @@ function groupEntriesByShardId(entries2, parentShardId) {
|
|
|
109482
109617
|
return groups;
|
|
109483
109618
|
}
|
|
109484
109619
|
function buildPreparedShard(shardId, payload) {
|
|
109485
|
-
const compressed =
|
|
109620
|
+
const compressed = gzipSync3(Buffer.from(JSON.stringify(payload))).toString("base64");
|
|
109486
109621
|
return {
|
|
109487
109622
|
shardId,
|
|
109488
109623
|
payload,
|
|
@@ -109497,7 +109632,7 @@ function prepareShardGroup(entries2, shardId, tree) {
|
|
|
109497
109632
|
scannedAt: tree.scannedAt,
|
|
109498
109633
|
rootDir: tree.rootDir
|
|
109499
109634
|
};
|
|
109500
|
-
const compressed =
|
|
109635
|
+
const compressed = gzipSync3(Buffer.from(JSON.stringify(payload))).toString("base64");
|
|
109501
109636
|
if (Buffer.byteLength(compressed, "utf8") <= MAX_SHARD_JSON_BYTES) {
|
|
109502
109637
|
return [buildPreparedShard(shardId, payload)];
|
|
109503
109638
|
}
|
|
@@ -109519,49 +109654,59 @@ function partitionFileTree(tree) {
|
|
|
109519
109654
|
}
|
|
109520
109655
|
return shards;
|
|
109521
109656
|
}
|
|
109522
|
-
var
|
|
109657
|
+
var MAX_TREE_JSON_BYTES2, MAX_SHARD_JSON_BYTES, MAX_SHARD_BATCH_SIZE = 8;
|
|
109523
109658
|
var init_file_tree_partition = __esm(() => {
|
|
109524
|
-
|
|
109659
|
+
init_workspace_file_tree();
|
|
109660
|
+
MAX_TREE_JSON_BYTES2 = 900 * 1024;
|
|
109525
109661
|
MAX_SHARD_JSON_BYTES = 800 * 1024;
|
|
109526
109662
|
});
|
|
109527
109663
|
|
|
109528
|
-
// src/infrastructure/services/workspace/
|
|
109529
|
-
async function
|
|
109664
|
+
// src/infrastructure/services/workspace/transport/sharded-snapshot-publish.ts
|
|
109665
|
+
async function publishShardedSnapshot(session2, workingDir, tree, syncGeneration) {
|
|
109530
109666
|
const shards = partitionFileTree(tree);
|
|
109531
109667
|
const shardIds = [];
|
|
109532
109668
|
for (let i2 = 0;i2 < shards.length; i2 += MAX_SHARD_BATCH_SIZE) {
|
|
109533
109669
|
const batch = shards.slice(i2, i2 + MAX_SHARD_BATCH_SIZE);
|
|
109670
|
+
const items = batch.map((s) => ({
|
|
109671
|
+
shardId: s.shardId,
|
|
109672
|
+
data: s.data,
|
|
109673
|
+
dataHash: s.dataHash,
|
|
109674
|
+
scannedAt: tree.scannedAt,
|
|
109675
|
+
entryCount: s.entryCount
|
|
109676
|
+
}));
|
|
109534
109677
|
await session2.backend.mutation(api.workspaceFiles.syncFileTreeShardV3Batch, {
|
|
109535
109678
|
sessionId: session2.sessionId,
|
|
109536
109679
|
machineId: session2.machineId,
|
|
109537
109680
|
workingDir,
|
|
109538
109681
|
syncGeneration,
|
|
109539
|
-
items:
|
|
109540
|
-
shardId: s.shardId,
|
|
109541
|
-
data: s.data,
|
|
109542
|
-
dataHash: s.dataHash,
|
|
109543
|
-
scannedAt: tree.scannedAt,
|
|
109544
|
-
entryCount: s.entryCount
|
|
109545
|
-
}))
|
|
109682
|
+
items: items.map(toLegacyShardBatchItem)
|
|
109546
109683
|
});
|
|
109547
109684
|
for (const s of batch)
|
|
109548
109685
|
shardIds.push(s.shardId);
|
|
109549
109686
|
}
|
|
109550
|
-
|
|
109551
|
-
sessionId: session2.sessionId,
|
|
109552
|
-
machineId: session2.machineId,
|
|
109553
|
-
workingDir,
|
|
109687
|
+
const manifest = {
|
|
109554
109688
|
syncGeneration,
|
|
109555
109689
|
shardIds,
|
|
109556
109690
|
totalEntryCount: tree.entries.length,
|
|
109557
109691
|
complete: true,
|
|
109558
109692
|
scannedAt: tree.scannedAt
|
|
109693
|
+
};
|
|
109694
|
+
await session2.backend.mutation(api.workspaceFiles.syncFileTreeManifestV3, {
|
|
109695
|
+
sessionId: session2.sessionId,
|
|
109696
|
+
machineId: session2.machineId,
|
|
109697
|
+
workingDir,
|
|
109698
|
+
...toLegacyManifestSyncArgs(manifest)
|
|
109559
109699
|
});
|
|
109560
|
-
return {
|
|
109700
|
+
return {
|
|
109701
|
+
strategyId: "sharded",
|
|
109702
|
+
snapshotId: syncGeneration,
|
|
109703
|
+
scannedAt: tree.scannedAt,
|
|
109704
|
+
entryCount: tree.entries.length
|
|
109705
|
+
};
|
|
109561
109706
|
}
|
|
109562
|
-
var
|
|
109563
|
-
init_file_tree_partition();
|
|
109707
|
+
var init_sharded_snapshot_publish = __esm(() => {
|
|
109564
109708
|
init_api3();
|
|
109709
|
+
init_file_tree_partition();
|
|
109565
109710
|
});
|
|
109566
109711
|
|
|
109567
109712
|
// ../../node_modules/.pnpm/ignore@7.0.5/node_modules/ignore/index.js
|
|
@@ -112797,10 +112942,41 @@ var init_workspace_file_tree_coordinator = __esm(() => {
|
|
|
112797
112942
|
|
|
112798
112943
|
// src/daemon/entry/files/file-tree-subscription.ts
|
|
112799
112944
|
import { randomUUID as randomUUID11 } from "node:crypto";
|
|
112800
|
-
import { gzipSync as gzipSync3 } from "node:zlib";
|
|
112801
112945
|
function logSubscriptionWarn(label, err) {
|
|
112802
112946
|
console.warn(`[${formatTimestamp()}] ⚠️ ${label}: ${getErrorMessage(err)}`);
|
|
112803
112947
|
}
|
|
112948
|
+
async function stopCoordinatorForWorkingDir(coordinators, normalized) {
|
|
112949
|
+
const coordinatorPromise = coordinators.get(normalized);
|
|
112950
|
+
if (!coordinatorPromise)
|
|
112951
|
+
return;
|
|
112952
|
+
coordinators.delete(normalized);
|
|
112953
|
+
await coordinatorPromise.then((coordinator2) => coordinator2.stop()).catch(() => {
|
|
112954
|
+
return;
|
|
112955
|
+
});
|
|
112956
|
+
}
|
|
112957
|
+
async function drainPendingFileTreeReleaseRequests(session2, coordinators) {
|
|
112958
|
+
const releases = await session2.backend.query(api.workspaceFiles.getPendingFileTreeReleaseRequests, {
|
|
112959
|
+
sessionId: session2.sessionId,
|
|
112960
|
+
machineId: session2.machineId
|
|
112961
|
+
});
|
|
112962
|
+
if (!releases?.length)
|
|
112963
|
+
return;
|
|
112964
|
+
const releasesByDir = new Set;
|
|
112965
|
+
for (const release of releases) {
|
|
112966
|
+
releasesByDir.add(normalizeWorkingDirForLookup(release.workingDir));
|
|
112967
|
+
}
|
|
112968
|
+
for (const normalized of releasesByDir) {
|
|
112969
|
+
await stopCoordinatorForWorkingDir(coordinators, normalized).then(() => session2.backend.mutation(api.workspaceFiles.fulfillFileTreeReleaseRequest, {
|
|
112970
|
+
sessionId: session2.sessionId,
|
|
112971
|
+
machineId: session2.machineId,
|
|
112972
|
+
workingDir: normalized
|
|
112973
|
+
})).then(() => {
|
|
112974
|
+
console.log(`[${formatTimestamp()}] \uD83C\uDF33 File tree coordinator stopped: ${normalized}`);
|
|
112975
|
+
}).catch((err) => {
|
|
112976
|
+
logSubscriptionWarn(`File tree release failed for ${normalized}`, err);
|
|
112977
|
+
});
|
|
112978
|
+
}
|
|
112979
|
+
}
|
|
112804
112980
|
async function processPendingFileTreeRequests(session2, coordinators, ensureCoordinator, requests) {
|
|
112805
112981
|
if (!requests?.length)
|
|
112806
112982
|
return;
|
|
@@ -112830,21 +113006,12 @@ async function drainPendingFileTreeRequests(session2, coordinators, ensureCoordi
|
|
|
112830
113006
|
await processPendingFileTreeRequests(session2, coordinators, ensureCoordinator, requests);
|
|
112831
113007
|
}
|
|
112832
113008
|
async function syncScannedFileTree(session2, normalizedWorkingDir, tree, dataHash, syncGeneration) {
|
|
112833
|
-
if (
|
|
112834
|
-
await
|
|
112835
|
-
return {
|
|
113009
|
+
if (selectFileTreeSnapshotStrategyId(tree) === "sharded") {
|
|
113010
|
+
const ref2 = await publishShardedSnapshot(session2, normalizedWorkingDir, tree, syncGeneration);
|
|
113011
|
+
return { strategyId: ref2.strategyId, snapshotId: ref2.snapshotId };
|
|
112836
113012
|
}
|
|
112837
|
-
const
|
|
112838
|
-
|
|
112839
|
-
await session2.backend.mutation(api.workspaceFiles.syncFileTreeV2, {
|
|
112840
|
-
sessionId: session2.sessionId,
|
|
112841
|
-
machineId: session2.machineId,
|
|
112842
|
-
workingDir: normalizedWorkingDir,
|
|
112843
|
-
data: { compression: "gzip", content: compressed },
|
|
112844
|
-
dataHash,
|
|
112845
|
-
scannedAt: tree.scannedAt
|
|
112846
|
-
});
|
|
112847
|
-
return { snapshotKind: "v2", snapshotId: dataHash };
|
|
113013
|
+
const ref = await publishBlobSnapshot(session2, normalizedWorkingDir, buildBlobSnapshotPayload(tree, dataHash));
|
|
113014
|
+
return { strategyId: ref.strategyId, snapshotId: ref.snapshotId };
|
|
112848
113015
|
}
|
|
112849
113016
|
function toDeltaOperations(delta) {
|
|
112850
113017
|
return [
|
|
@@ -112930,12 +113097,12 @@ var startFileTreeSubscriptionEffect = () => exports_Effect.gen(function* () {
|
|
|
112930
113097
|
coordinators.set(normalized, coordinatorPromise);
|
|
112931
113098
|
}
|
|
112932
113099
|
return coordinatorPromise.then(async (coordinator2) => {
|
|
112933
|
-
const
|
|
113100
|
+
const checkpoint2 = await session2.backend.query(api.workspaceFiles.getFileTreeCheckpoint, {
|
|
112934
113101
|
sessionId: session2.sessionId,
|
|
112935
113102
|
machineId: session2.machineId,
|
|
112936
113103
|
workingDir: normalized
|
|
112937
113104
|
});
|
|
112938
|
-
if (
|
|
113105
|
+
if (checkpoint2 === null)
|
|
112939
113106
|
await coordinator2.checkpoint();
|
|
112940
113107
|
if (forceReconcile)
|
|
112941
113108
|
await coordinator2.reconcile();
|
|
@@ -112944,6 +113111,7 @@ var startFileTreeSubscriptionEffect = () => exports_Effect.gen(function* () {
|
|
|
112944
113111
|
};
|
|
112945
113112
|
return {
|
|
112946
113113
|
drainPendingFileTreeRequests: () => drainPendingFileTreeRequests(session2, coordinators, ensureCoordinator),
|
|
113114
|
+
drainPendingFileTreeReleaseRequests: () => drainPendingFileTreeReleaseRequests(session2, coordinators),
|
|
112947
113115
|
stop: () => {
|
|
112948
113116
|
Promise.all([...coordinators.values()].map((coordinator2) => coordinator2.then((handle) => handle.stop()).catch(() => {
|
|
112949
113117
|
return;
|
|
@@ -112953,11 +113121,12 @@ var startFileTreeSubscriptionEffect = () => exports_Effect.gen(function* () {
|
|
|
112953
113121
|
};
|
|
112954
113122
|
});
|
|
112955
113123
|
var init_file_tree_subscription = __esm(() => {
|
|
113124
|
+
init_workspace_file_tree();
|
|
112956
113125
|
init_esm();
|
|
112957
113126
|
init_api3();
|
|
112958
113127
|
init_file_tree_data_hash();
|
|
112959
|
-
|
|
112960
|
-
|
|
113128
|
+
init_blob_snapshot_publish();
|
|
113129
|
+
init_sharded_snapshot_publish();
|
|
112961
113130
|
init_workspace_file_tree_coordinator();
|
|
112962
113131
|
init_convex_error();
|
|
112963
113132
|
init_daemon_services();
|
|
@@ -115251,6 +115420,10 @@ function createDaemonRuntime(deps) {
|
|
|
115251
115420
|
if (fileTreeHandle)
|
|
115252
115421
|
await fileTreeHandle.drainPendingFileTreeRequests();
|
|
115253
115422
|
break;
|
|
115423
|
+
case "file-tree.release":
|
|
115424
|
+
if (fileTreeHandle)
|
|
115425
|
+
await fileTreeHandle.drainPendingFileTreeReleaseRequests();
|
|
115426
|
+
break;
|
|
115254
115427
|
case "file-content.request":
|
|
115255
115428
|
await drainPendingFileContentRequests(session2);
|
|
115256
115429
|
break;
|
|
@@ -115449,6 +115622,7 @@ function createFileRouterDeps() {
|
|
|
115449
115622
|
deliverInbound: async (event) => {
|
|
115450
115623
|
switch (event.type) {
|
|
115451
115624
|
case "file-tree.request":
|
|
115625
|
+
case "file-tree.release":
|
|
115452
115626
|
await fulfillFileTreeRequest({ dispatchInbound: dispatchFileInboundEvent }, event);
|
|
115453
115627
|
break;
|
|
115454
115628
|
case "file-content.request":
|
|
@@ -115956,6 +116130,7 @@ async function routeInboundEvent(deps, event) {
|
|
|
115956
116130
|
await handleWorkspaceGitInbound(deps.workspaceGit, event);
|
|
115957
116131
|
break;
|
|
115958
116132
|
case "file-tree.request":
|
|
116133
|
+
case "file-tree.release":
|
|
115959
116134
|
case "file-content.request":
|
|
115960
116135
|
case "file-write.request":
|
|
115961
116136
|
await handleFileInbound(deps.file, event);
|
|
@@ -116623,24 +116798,51 @@ var init_enhancer_job = __esm(() => {
|
|
|
116623
116798
|
init_api3();
|
|
116624
116799
|
});
|
|
116625
116800
|
|
|
116626
|
-
// src/daemon/infrastructure/convex/subscribers/file-
|
|
116627
|
-
function
|
|
116801
|
+
// src/daemon/infrastructure/convex/subscribers/pending-file-request-dedup.ts
|
|
116802
|
+
function pendingConvexId(req) {
|
|
116803
|
+
if (req._id == null)
|
|
116804
|
+
return "unknown";
|
|
116628
116805
|
return typeof req._id === "string" ? req._id : req._id.toString();
|
|
116629
116806
|
}
|
|
116807
|
+
function isPendingRowWithId(req) {
|
|
116808
|
+
return req != null && typeof req === "object" && "_id" in req;
|
|
116809
|
+
}
|
|
116810
|
+
function pruneStaleSnapshotIds(last2, requests) {
|
|
116811
|
+
const active2 = new Set(requests.filter(isPendingRowWithId).map((req) => pendingConvexId(req)));
|
|
116812
|
+
for (const id3 of last2.keys()) {
|
|
116813
|
+
if (!active2.has(id3))
|
|
116814
|
+
last2.delete(id3);
|
|
116815
|
+
}
|
|
116816
|
+
}
|
|
116817
|
+
function drainPendingRequestSnapshotDedup(requests, last2, getSnapshot) {
|
|
116818
|
+
if (!requests?.length) {
|
|
116819
|
+
last2.clear();
|
|
116820
|
+
return [];
|
|
116821
|
+
}
|
|
116822
|
+
const emitted = [];
|
|
116823
|
+
for (const req of requests) {
|
|
116824
|
+
if (!isPendingRowWithId(req))
|
|
116825
|
+
continue;
|
|
116826
|
+
const id3 = pendingConvexId(req);
|
|
116827
|
+
const snapshot = getSnapshot(req);
|
|
116828
|
+
if (last2.get(id3) === snapshot)
|
|
116829
|
+
continue;
|
|
116830
|
+
last2.set(id3, snapshot);
|
|
116831
|
+
emitted.push(id3);
|
|
116832
|
+
}
|
|
116833
|
+
pruneStaleSnapshotIds(last2, requests);
|
|
116834
|
+
return emitted;
|
|
116835
|
+
}
|
|
116836
|
+
|
|
116837
|
+
// src/daemon/infrastructure/convex/subscribers/file-content-request.ts
|
|
116838
|
+
function contentRequestSnapshot(req) {
|
|
116839
|
+
return `${pendingConvexId(req)}:${req.workingDir ?? ""}:${req.filePath ?? ""}:${req.updatedAt ?? 0}`;
|
|
116840
|
+
}
|
|
116630
116841
|
function startFileContentRequestSubscriber(deps, onEvent) {
|
|
116631
|
-
const
|
|
116842
|
+
const last2 = new Map;
|
|
116632
116843
|
const unsub = deps.wsClient.onUpdate(api.workspaceFiles.getPendingFileContentRequests, { sessionId: deps.sessionId, machineId: deps.machineId }, (requests) => {
|
|
116633
|
-
|
|
116634
|
-
return;
|
|
116635
|
-
for (const req of requests) {
|
|
116636
|
-
if (req == null || typeof req !== "object" || !("_id" in req))
|
|
116637
|
-
continue;
|
|
116638
|
-
const id3 = requestId(req);
|
|
116639
|
-
if (seen.has(id3))
|
|
116640
|
-
continue;
|
|
116641
|
-
seen.add(id3);
|
|
116844
|
+
for (const id3 of drainPendingRequestSnapshotDedup(requests, last2, contentRequestSnapshot))
|
|
116642
116845
|
onEvent({ type: "file-content.request", requestId: id3 });
|
|
116643
|
-
}
|
|
116644
116846
|
}, (err) => {
|
|
116645
116847
|
console.warn(`[daemon] file-content-request subscriber error: ${err instanceof Error ? err.message : String(err)}`);
|
|
116646
116848
|
});
|
|
@@ -116654,24 +116856,67 @@ var init_file_content_request = __esm(() => {
|
|
|
116654
116856
|
init_api3();
|
|
116655
116857
|
});
|
|
116656
116858
|
|
|
116859
|
+
// src/daemon/infrastructure/convex/subscribers/file-tree-release-request.ts
|
|
116860
|
+
function requestId(req) {
|
|
116861
|
+
if (req._id == null)
|
|
116862
|
+
return "unknown";
|
|
116863
|
+
return typeof req._id === "string" ? req._id : req._id.toString();
|
|
116864
|
+
}
|
|
116865
|
+
function pendingReleasesSnapshot(requests) {
|
|
116866
|
+
return requests.filter((req) => req != null && typeof req === "object").map((req) => `${requestId(req)}:${req.workingDir ?? ""}:${req.updatedAt ?? 0}`).sort().join("|");
|
|
116867
|
+
}
|
|
116868
|
+
function startFileTreeReleaseRequestSubscriber(deps, onEvent) {
|
|
116869
|
+
let lastSnapshot = "";
|
|
116870
|
+
const unsub = deps.wsClient.onUpdate(api.workspaceFiles.getPendingFileTreeReleaseRequests, { sessionId: deps.sessionId, machineId: deps.machineId }, (requests) => {
|
|
116871
|
+
if (!requests?.length) {
|
|
116872
|
+
lastSnapshot = "";
|
|
116873
|
+
return;
|
|
116874
|
+
}
|
|
116875
|
+
const snapshot = pendingReleasesSnapshot(requests);
|
|
116876
|
+
if (!snapshot || snapshot === lastSnapshot)
|
|
116877
|
+
return;
|
|
116878
|
+
lastSnapshot = snapshot;
|
|
116879
|
+
const first = requests.find((req) => req != null && typeof req === "object");
|
|
116880
|
+
if (!first)
|
|
116881
|
+
return;
|
|
116882
|
+
onEvent({ type: "file-tree.release", requestId: requestId(first) });
|
|
116883
|
+
}, (err) => {
|
|
116884
|
+
console.warn(`[daemon] file-tree-release subscriber error: ${err instanceof Error ? err.message : String(err)}`);
|
|
116885
|
+
});
|
|
116886
|
+
return {
|
|
116887
|
+
async stop() {
|
|
116888
|
+
unsub();
|
|
116889
|
+
}
|
|
116890
|
+
};
|
|
116891
|
+
}
|
|
116892
|
+
var init_file_tree_release_request = __esm(() => {
|
|
116893
|
+
init_api3();
|
|
116894
|
+
});
|
|
116895
|
+
|
|
116657
116896
|
// src/daemon/infrastructure/convex/subscribers/file-tree-request.ts
|
|
116658
116897
|
function requestId2(req) {
|
|
116898
|
+
if (req._id == null)
|
|
116899
|
+
return "unknown";
|
|
116659
116900
|
return typeof req._id === "string" ? req._id : req._id.toString();
|
|
116660
116901
|
}
|
|
116902
|
+
function pendingRequestsSnapshot(requests) {
|
|
116903
|
+
return requests.filter((req) => req != null && typeof req === "object").map((req) => `${requestId2(req)}:${req.workingDir ?? ""}:${req.force ? "1" : "0"}:${req.updatedAt ?? 0}`).sort().join("|");
|
|
116904
|
+
}
|
|
116661
116905
|
function startFileTreeRequestSubscriber(deps, onEvent) {
|
|
116662
|
-
|
|
116906
|
+
let lastSnapshot = "";
|
|
116663
116907
|
const unsub = deps.wsClient.onUpdate(api.workspaceFiles.getPendingFileTreeRequests, { sessionId: deps.sessionId, machineId: deps.machineId }, (requests) => {
|
|
116664
|
-
if (!requests?.length)
|
|
116908
|
+
if (!requests?.length) {
|
|
116909
|
+
lastSnapshot = "";
|
|
116665
116910
|
return;
|
|
116666
|
-
for (const req of requests) {
|
|
116667
|
-
if (req == null || typeof req !== "object" || !("_id" in req))
|
|
116668
|
-
continue;
|
|
116669
|
-
const id3 = requestId2(req);
|
|
116670
|
-
if (seen.has(id3))
|
|
116671
|
-
continue;
|
|
116672
|
-
seen.add(id3);
|
|
116673
|
-
onEvent({ type: "file-tree.request", requestId: id3 });
|
|
116674
116911
|
}
|
|
116912
|
+
const snapshot = pendingRequestsSnapshot(requests);
|
|
116913
|
+
if (!snapshot || snapshot === lastSnapshot)
|
|
116914
|
+
return;
|
|
116915
|
+
lastSnapshot = snapshot;
|
|
116916
|
+
const first = requests.find((req) => req != null && typeof req === "object");
|
|
116917
|
+
if (!first)
|
|
116918
|
+
return;
|
|
116919
|
+
onEvent({ type: "file-tree.request", requestId: requestId2(first) });
|
|
116675
116920
|
}, (err) => {
|
|
116676
116921
|
console.warn(`[daemon] file-tree-request subscriber error: ${err instanceof Error ? err.message : String(err)}`);
|
|
116677
116922
|
});
|
|
@@ -116686,23 +116931,14 @@ var init_file_tree_request = __esm(() => {
|
|
|
116686
116931
|
});
|
|
116687
116932
|
|
|
116688
116933
|
// src/daemon/infrastructure/convex/subscribers/file-write-request.ts
|
|
116689
|
-
function
|
|
116690
|
-
return
|
|
116934
|
+
function writeRequestSnapshot(req) {
|
|
116935
|
+
return `${pendingConvexId(req)}:${req.workingDir ?? ""}:${req.filePath ?? ""}:${req.revision ?? 0}:${req.updatedAt ?? 0}`;
|
|
116691
116936
|
}
|
|
116692
116937
|
function startFileWriteRequestSubscriber(deps, onEvent) {
|
|
116693
|
-
const
|
|
116938
|
+
const last2 = new Map;
|
|
116694
116939
|
const unsub = deps.wsClient.onUpdate(api.workspaceFiles.getPendingFileWriteRequests, { sessionId: deps.sessionId, machineId: deps.machineId }, (requests) => {
|
|
116695
|
-
|
|
116696
|
-
return;
|
|
116697
|
-
for (const req of requests) {
|
|
116698
|
-
if (req == null || typeof req !== "object" || !("_id" in req))
|
|
116699
|
-
continue;
|
|
116700
|
-
const id3 = requestId3(req);
|
|
116701
|
-
if (seen.has(id3))
|
|
116702
|
-
continue;
|
|
116703
|
-
seen.add(id3);
|
|
116940
|
+
for (const id3 of drainPendingRequestSnapshotDedup(requests, last2, writeRequestSnapshot))
|
|
116704
116941
|
onEvent({ type: "file-write.request", requestId: id3 });
|
|
116705
|
-
}
|
|
116706
116942
|
}, (err) => {
|
|
116707
116943
|
console.warn(`[daemon] file-write-request subscriber error: ${err instanceof Error ? err.message : String(err)}`);
|
|
116708
116944
|
});
|
|
@@ -116717,7 +116953,7 @@ var init_file_write_request = __esm(() => {
|
|
|
116717
116953
|
});
|
|
116718
116954
|
|
|
116719
116955
|
// src/daemon/infrastructure/convex/subscribers/git-request.ts
|
|
116720
|
-
function
|
|
116956
|
+
function requestId3(req) {
|
|
116721
116957
|
return typeof req._id === "string" ? req._id : req._id.toString();
|
|
116722
116958
|
}
|
|
116723
116959
|
function startGitRequestSubscriber(deps, onEvent) {
|
|
@@ -116728,7 +116964,7 @@ function startGitRequestSubscriber(deps, onEvent) {
|
|
|
116728
116964
|
for (const req of requests) {
|
|
116729
116965
|
if (req == null || typeof req !== "object" || !("_id" in req))
|
|
116730
116966
|
continue;
|
|
116731
|
-
const id3 =
|
|
116967
|
+
const id3 = requestId3(req);
|
|
116732
116968
|
if (seen.has(id3))
|
|
116733
116969
|
continue;
|
|
116734
116970
|
seen.add(id3);
|
|
@@ -116792,6 +117028,7 @@ function startAllSubscribers(deps) {
|
|
|
116792
117028
|
const workspaceList = startWorkspaceListSubscriber(deps, onEvent);
|
|
116793
117029
|
const gitRequest = startGitRequestSubscriber(deps, onEvent);
|
|
116794
117030
|
const fileTree = startFileTreeRequestSubscriber(deps, onEvent);
|
|
117031
|
+
const fileTreeRelease = startFileTreeReleaseRequestSubscriber(deps, onEvent);
|
|
116795
117032
|
const fileContent = startFileContentRequestSubscriber(deps, onEvent);
|
|
116796
117033
|
const fileWrite = startFileWriteRequestSubscriber(deps, onEvent);
|
|
116797
117034
|
const agenticQuerySession = startAgenticQuerySessionSubscriber(deps, onEvent);
|
|
@@ -116810,6 +117047,7 @@ function startAllSubscribers(deps) {
|
|
|
116810
117047
|
workspaceList.stop(),
|
|
116811
117048
|
gitRequest.stop(),
|
|
116812
117049
|
fileTree.stop(),
|
|
117050
|
+
fileTreeRelease.stop(),
|
|
116813
117051
|
fileContent.stop(),
|
|
116814
117052
|
fileWrite.stop(),
|
|
116815
117053
|
agenticQuerySession.stop(),
|
|
@@ -116832,6 +117070,7 @@ var init_subscriber_registry = __esm(() => {
|
|
|
116832
117070
|
init_direct_harness_session();
|
|
116833
117071
|
init_enhancer_job();
|
|
116834
117072
|
init_file_content_request();
|
|
117073
|
+
init_file_tree_release_request();
|
|
116835
117074
|
init_file_tree_request();
|
|
116836
117075
|
init_file_write_request();
|
|
116837
117076
|
init_git_request();
|
|
@@ -117677,23 +117916,23 @@ var require_accepts = __commonJS((exports, module) => {
|
|
|
117677
117916
|
this.negotiator = new Negotiator(req);
|
|
117678
117917
|
}
|
|
117679
117918
|
Accepts.prototype.type = Accepts.prototype.types = function(types_) {
|
|
117680
|
-
var
|
|
117681
|
-
if (
|
|
117682
|
-
|
|
117683
|
-
for (var i2 = 0;i2 <
|
|
117684
|
-
|
|
117919
|
+
var types3 = types_;
|
|
117920
|
+
if (types3 && !Array.isArray(types3)) {
|
|
117921
|
+
types3 = new Array(arguments.length);
|
|
117922
|
+
for (var i2 = 0;i2 < types3.length; i2++) {
|
|
117923
|
+
types3[i2] = arguments[i2];
|
|
117685
117924
|
}
|
|
117686
117925
|
}
|
|
117687
|
-
if (!
|
|
117926
|
+
if (!types3 || types3.length === 0) {
|
|
117688
117927
|
return this.negotiator.mediaTypes();
|
|
117689
117928
|
}
|
|
117690
117929
|
if (!this.headers.accept) {
|
|
117691
|
-
return
|
|
117930
|
+
return types3[0];
|
|
117692
117931
|
}
|
|
117693
|
-
var mimes =
|
|
117932
|
+
var mimes = types3.map(extToMime);
|
|
117694
117933
|
var accepts = this.negotiator.mediaTypes(mimes.filter(validMime));
|
|
117695
117934
|
var first = accepts[0];
|
|
117696
|
-
return first ?
|
|
117935
|
+
return first ? types3[mimes.indexOf(first)] : false;
|
|
117697
117936
|
};
|
|
117698
117937
|
Accepts.prototype.encoding = Accepts.prototype.encodings = function(encodings_) {
|
|
117699
117938
|
var encodings = encodings_;
|
|
@@ -119051,7 +119290,7 @@ var require_socket = __commonJS((exports) => {
|
|
|
119051
119290
|
debug2("readyState updated from %s to %s", this._readyState, state);
|
|
119052
119291
|
this._readyState = state;
|
|
119053
119292
|
}
|
|
119054
|
-
constructor(id3, server2,
|
|
119293
|
+
constructor(id3, server2, transport2, req, protocol) {
|
|
119055
119294
|
super();
|
|
119056
119295
|
this._readyState = "opening";
|
|
119057
119296
|
this.upgrading = false;
|
|
@@ -119073,7 +119312,7 @@ var require_socket = __commonJS((exports) => {
|
|
|
119073
119312
|
}
|
|
119074
119313
|
this.pingTimeoutTimer = null;
|
|
119075
119314
|
this.pingIntervalTimer = null;
|
|
119076
|
-
this.setTransport(
|
|
119315
|
+
this.setTransport(transport2);
|
|
119077
119316
|
this.onOpen();
|
|
119078
119317
|
}
|
|
119079
119318
|
onOpen() {
|
|
@@ -119151,24 +119390,24 @@ var require_socket = __commonJS((exports) => {
|
|
|
119151
119390
|
this.onClose("ping timeout");
|
|
119152
119391
|
}, this.protocol === 3 ? this.server.opts.pingInterval + this.server.opts.pingTimeout : this.server.opts.pingTimeout);
|
|
119153
119392
|
}
|
|
119154
|
-
setTransport(
|
|
119393
|
+
setTransport(transport2) {
|
|
119155
119394
|
const onError3 = this.onError.bind(this);
|
|
119156
119395
|
const onReady = () => this.flush();
|
|
119157
119396
|
const onPacket = this.onPacket.bind(this);
|
|
119158
119397
|
const onDrain = this.onDrain.bind(this);
|
|
119159
119398
|
const onClose = this.onClose.bind(this, "transport close");
|
|
119160
|
-
this.transport =
|
|
119399
|
+
this.transport = transport2;
|
|
119161
119400
|
this.transport.once("error", onError3);
|
|
119162
119401
|
this.transport.on("ready", onReady);
|
|
119163
119402
|
this.transport.on("packet", onPacket);
|
|
119164
119403
|
this.transport.on("drain", onDrain);
|
|
119165
119404
|
this.transport.once("close", onClose);
|
|
119166
119405
|
this.cleanupFn.push(function() {
|
|
119167
|
-
|
|
119168
|
-
|
|
119169
|
-
|
|
119170
|
-
|
|
119171
|
-
|
|
119406
|
+
transport2.removeListener("error", onError3);
|
|
119407
|
+
transport2.removeListener("ready", onReady);
|
|
119408
|
+
transport2.removeListener("packet", onPacket);
|
|
119409
|
+
transport2.removeListener("drain", onDrain);
|
|
119410
|
+
transport2.removeListener("close", onClose);
|
|
119172
119411
|
});
|
|
119173
119412
|
}
|
|
119174
119413
|
onDrain() {
|
|
@@ -119182,22 +119421,22 @@ var require_socket = __commonJS((exports) => {
|
|
|
119182
119421
|
}
|
|
119183
119422
|
}
|
|
119184
119423
|
}
|
|
119185
|
-
_maybeUpgrade(
|
|
119186
|
-
debug2('might upgrade socket transport from "%s" to "%s"', this.transport.name,
|
|
119424
|
+
_maybeUpgrade(transport2) {
|
|
119425
|
+
debug2('might upgrade socket transport from "%s" to "%s"', this.transport.name, transport2.name);
|
|
119187
119426
|
this.upgrading = true;
|
|
119188
119427
|
const upgradeTimeoutTimer = (0, timers_1.setTimeout)(() => {
|
|
119189
119428
|
debug2("client did not complete upgrade - closing transport");
|
|
119190
119429
|
cleanup();
|
|
119191
|
-
if (
|
|
119192
|
-
|
|
119430
|
+
if (transport2.readyState === "open") {
|
|
119431
|
+
transport2.close();
|
|
119193
119432
|
}
|
|
119194
119433
|
}, this.server.opts.upgradeTimeout);
|
|
119195
119434
|
let checkIntervalTimer;
|
|
119196
119435
|
const onPacket = (packet) => {
|
|
119197
119436
|
if (packet.type === "ping" && packet.data === "probe") {
|
|
119198
119437
|
debug2("got probe ping packet, sending pong");
|
|
119199
|
-
|
|
119200
|
-
this.emit("upgrading",
|
|
119438
|
+
transport2.send([{ type: "pong", data: "probe" }]);
|
|
119439
|
+
this.emit("upgrading", transport2);
|
|
119201
119440
|
clearInterval(checkIntervalTimer);
|
|
119202
119441
|
checkIntervalTimer = setInterval(check4, 100);
|
|
119203
119442
|
} else if (packet.type === "upgrade" && this.readyState !== "closed") {
|
|
@@ -119206,17 +119445,17 @@ var require_socket = __commonJS((exports) => {
|
|
|
119206
119445
|
this.transport.discard();
|
|
119207
119446
|
this.upgraded = true;
|
|
119208
119447
|
this.clearTransport();
|
|
119209
|
-
this.setTransport(
|
|
119210
|
-
this.emit("upgrade",
|
|
119448
|
+
this.setTransport(transport2);
|
|
119449
|
+
this.emit("upgrade", transport2);
|
|
119211
119450
|
this.flush();
|
|
119212
119451
|
if (this.readyState === "closing") {
|
|
119213
|
-
|
|
119452
|
+
transport2.close(() => {
|
|
119214
119453
|
this.onClose("forced close");
|
|
119215
119454
|
});
|
|
119216
119455
|
}
|
|
119217
119456
|
} else {
|
|
119218
119457
|
cleanup();
|
|
119219
|
-
|
|
119458
|
+
transport2.close();
|
|
119220
119459
|
}
|
|
119221
119460
|
};
|
|
119222
119461
|
const check4 = () => {
|
|
@@ -119229,16 +119468,16 @@ var require_socket = __commonJS((exports) => {
|
|
|
119229
119468
|
this.upgrading = false;
|
|
119230
119469
|
clearInterval(checkIntervalTimer);
|
|
119231
119470
|
(0, timers_1.clearTimeout)(upgradeTimeoutTimer);
|
|
119232
|
-
|
|
119233
|
-
|
|
119234
|
-
|
|
119471
|
+
transport2.removeListener("packet", onPacket);
|
|
119472
|
+
transport2.removeListener("close", onTransportClose);
|
|
119473
|
+
transport2.removeListener("error", onError3);
|
|
119235
119474
|
this.removeListener("close", onClose);
|
|
119236
119475
|
};
|
|
119237
119476
|
const onError3 = (err) => {
|
|
119238
119477
|
debug2("client did not complete upgrade - %s", err);
|
|
119239
119478
|
cleanup();
|
|
119240
|
-
|
|
119241
|
-
|
|
119479
|
+
transport2.close();
|
|
119480
|
+
transport2 = null;
|
|
119242
119481
|
};
|
|
119243
119482
|
const onTransportClose = () => {
|
|
119244
119483
|
onError3("transport closed");
|
|
@@ -119246,9 +119485,9 @@ var require_socket = __commonJS((exports) => {
|
|
|
119246
119485
|
const onClose = () => {
|
|
119247
119486
|
onError3("socket closed");
|
|
119248
119487
|
};
|
|
119249
|
-
|
|
119250
|
-
|
|
119251
|
-
|
|
119488
|
+
transport2.on("packet", onPacket);
|
|
119489
|
+
transport2.once("close", onTransportClose);
|
|
119490
|
+
transport2.once("error", onError3);
|
|
119252
119491
|
this.once("close", onClose);
|
|
119253
119492
|
}
|
|
119254
119493
|
clearTransport() {
|
|
@@ -122862,16 +123101,16 @@ var require_server = __commonJS((exports) => {
|
|
|
122862
123101
|
}
|
|
122863
123102
|
return path8;
|
|
122864
123103
|
}
|
|
122865
|
-
upgrades(
|
|
123104
|
+
upgrades(transport2) {
|
|
122866
123105
|
if (!this.opts.allowUpgrades)
|
|
122867
123106
|
return [];
|
|
122868
|
-
return transports_1.default[
|
|
123107
|
+
return transports_1.default[transport2].upgradesTo || [];
|
|
122869
123108
|
}
|
|
122870
123109
|
verify(req, upgrade, fn2) {
|
|
122871
|
-
const
|
|
122872
|
-
if (!~this.opts.transports.indexOf(
|
|
122873
|
-
debug2('unknown transport "%s"',
|
|
122874
|
-
return fn2(Server.errors.UNKNOWN_TRANSPORT, { transport });
|
|
123110
|
+
const transport2 = req._query.transport;
|
|
123111
|
+
if (!~this.opts.transports.indexOf(transport2) || transport2 === "webtransport") {
|
|
123112
|
+
debug2('unknown transport "%s"', transport2);
|
|
123113
|
+
return fn2(Server.errors.UNKNOWN_TRANSPORT, { transport: transport2 });
|
|
122875
123114
|
}
|
|
122876
123115
|
const isOriginInvalid = checkInvalidHeaderChar(req.headers.origin);
|
|
122877
123116
|
if (isOriginInvalid) {
|
|
@@ -122892,11 +123131,11 @@ var require_server = __commonJS((exports) => {
|
|
|
122892
123131
|
});
|
|
122893
123132
|
}
|
|
122894
123133
|
const previousTransport = this.clients[sid].transport.name;
|
|
122895
|
-
if (!upgrade && previousTransport !==
|
|
123134
|
+
if (!upgrade && previousTransport !== transport2) {
|
|
122896
123135
|
debug2("bad request: unexpected transport without upgrade");
|
|
122897
123136
|
return fn2(Server.errors.BAD_REQUEST, {
|
|
122898
123137
|
name: "TRANSPORT_MISMATCH",
|
|
122899
|
-
transport,
|
|
123138
|
+
transport: transport2,
|
|
122900
123139
|
previousTransport
|
|
122901
123140
|
});
|
|
122902
123141
|
}
|
|
@@ -122906,7 +123145,7 @@ var require_server = __commonJS((exports) => {
|
|
|
122906
123145
|
method: req.method
|
|
122907
123146
|
});
|
|
122908
123147
|
}
|
|
122909
|
-
if (
|
|
123148
|
+
if (transport2 === "websocket" && !upgrade) {
|
|
122910
123149
|
debug2("invalid transport upgrade");
|
|
122911
123150
|
return fn2(Server.errors.BAD_REQUEST, {
|
|
122912
123151
|
name: "TRANSPORT_HANDSHAKE_ERROR"
|
|
@@ -122995,12 +123234,12 @@ var require_server = __commonJS((exports) => {
|
|
|
122995
123234
|
}
|
|
122996
123235
|
debug2('handshaking client "%s"', id3);
|
|
122997
123236
|
try {
|
|
122998
|
-
var
|
|
123237
|
+
var transport2 = this.createTransport(transportName, req);
|
|
122999
123238
|
if (transportName === "polling") {
|
|
123000
|
-
|
|
123001
|
-
|
|
123239
|
+
transport2.maxHttpBufferSize = this.opts.maxHttpBufferSize;
|
|
123240
|
+
transport2.httpCompression = this.opts.httpCompression;
|
|
123002
123241
|
} else if (transportName === "websocket") {
|
|
123003
|
-
|
|
123242
|
+
transport2.perMessageDeflate = this.opts.perMessageDeflate;
|
|
123004
123243
|
}
|
|
123005
123244
|
} catch (e) {
|
|
123006
123245
|
debug2('error handshaking to transport "%s"', transportName);
|
|
@@ -123016,8 +123255,8 @@ var require_server = __commonJS((exports) => {
|
|
|
123016
123255
|
closeConnection(Server.errors.BAD_REQUEST);
|
|
123017
123256
|
return;
|
|
123018
123257
|
}
|
|
123019
|
-
const socket = new socket_1.Socket(id3, this,
|
|
123020
|
-
|
|
123258
|
+
const socket = new socket_1.Socket(id3, this, transport2, req, protocol);
|
|
123259
|
+
transport2.on("headers", (headers, req2) => {
|
|
123021
123260
|
const isInitialRequest = !req2._query.sid;
|
|
123022
123261
|
if (isInitialRequest) {
|
|
123023
123262
|
if (this.opts.cookie) {
|
|
@@ -123029,7 +123268,7 @@ var require_server = __commonJS((exports) => {
|
|
|
123029
123268
|
}
|
|
123030
123269
|
this.emit("headers", headers, req2);
|
|
123031
123270
|
});
|
|
123032
|
-
|
|
123271
|
+
transport2.onRequest(req);
|
|
123033
123272
|
this.clients[id3] = socket;
|
|
123034
123273
|
this.clientsCount++;
|
|
123035
123274
|
socket.once("close", () => {
|
|
@@ -123037,7 +123276,7 @@ var require_server = __commonJS((exports) => {
|
|
|
123037
123276
|
this.clientsCount--;
|
|
123038
123277
|
});
|
|
123039
123278
|
this.emit("connection", socket);
|
|
123040
|
-
return
|
|
123279
|
+
return transport2;
|
|
123041
123280
|
}
|
|
123042
123281
|
async onWebTransportSession(session2) {
|
|
123043
123282
|
if (this.middlewares.length > 0) {
|
|
@@ -123079,10 +123318,10 @@ var require_server = __commonJS((exports) => {
|
|
|
123079
123318
|
return closeSession2();
|
|
123080
123319
|
}
|
|
123081
123320
|
if (value.data === undefined) {
|
|
123082
|
-
const
|
|
123321
|
+
const transport2 = new webtransport_1.WebTransport(session2, stream4, reader);
|
|
123083
123322
|
const id3 = base64id.generateId();
|
|
123084
123323
|
debug2('handshaking client "%s" (WebTransport)', id3);
|
|
123085
|
-
const socket = new socket_1.Socket(id3, this,
|
|
123324
|
+
const socket = new socket_1.Socket(id3, this, transport2, null, 4);
|
|
123086
123325
|
this.clients[id3] = socket;
|
|
123087
123326
|
this.clientsCount++;
|
|
123088
123327
|
socket.once("close", () => {
|
|
@@ -123109,8 +123348,8 @@ var require_server = __commonJS((exports) => {
|
|
|
123109
123348
|
return closeSession2();
|
|
123110
123349
|
} else {
|
|
123111
123350
|
debug2("upgrading existing transport");
|
|
123112
|
-
const
|
|
123113
|
-
client4._maybeUpgrade(
|
|
123351
|
+
const transport2 = new webtransport_1.WebTransport(session2, stream4, reader);
|
|
123352
|
+
client4._maybeUpgrade(transport2);
|
|
123114
123353
|
}
|
|
123115
123354
|
}
|
|
123116
123355
|
}
|
|
@@ -123282,9 +123521,9 @@ var require_server = __commonJS((exports) => {
|
|
|
123282
123521
|
} else {
|
|
123283
123522
|
debug2("upgrading existing transport");
|
|
123284
123523
|
websocket.removeListener("error", onUpgradeError);
|
|
123285
|
-
const
|
|
123286
|
-
|
|
123287
|
-
client4._maybeUpgrade(
|
|
123524
|
+
const transport2 = this.createTransport(req._query.transport, req);
|
|
123525
|
+
transport2.perMessageDeflate = this.opts.perMessageDeflate;
|
|
123526
|
+
client4._maybeUpgrade(transport2);
|
|
123288
123527
|
}
|
|
123289
123528
|
} else {
|
|
123290
123529
|
const closeConnection = (errorCode, errorContext) => abortUpgrade(socket, errorCode, errorContext);
|
|
@@ -124030,10 +124269,10 @@ var require_userver = __commonJS((exports) => {
|
|
|
124030
124269
|
maxPayloadLength: this.opts.maxHttpBufferSize,
|
|
124031
124270
|
upgrade: this.handleUpgrade.bind(this),
|
|
124032
124271
|
open: (ws) => {
|
|
124033
|
-
const
|
|
124034
|
-
|
|
124035
|
-
|
|
124036
|
-
|
|
124272
|
+
const transport2 = ws.getUserData().transport;
|
|
124273
|
+
transport2.socket = ws;
|
|
124274
|
+
transport2.writable = true;
|
|
124275
|
+
transport2.emit("ready");
|
|
124037
124276
|
},
|
|
124038
124277
|
message: (ws, message, isBinary) => {
|
|
124039
124278
|
ws.getUserData().transport.onData(isBinary ? message : Buffer.from(message).toString());
|
|
@@ -124100,7 +124339,7 @@ var require_userver = __commonJS((exports) => {
|
|
|
124100
124339
|
return;
|
|
124101
124340
|
}
|
|
124102
124341
|
const id3 = req._query.sid;
|
|
124103
|
-
let
|
|
124342
|
+
let transport2;
|
|
124104
124343
|
if (id3) {
|
|
124105
124344
|
const client4 = this.clients[id3];
|
|
124106
124345
|
if (!client4) {
|
|
@@ -124114,12 +124353,12 @@ var require_userver = __commonJS((exports) => {
|
|
|
124114
124353
|
return res.close();
|
|
124115
124354
|
} else {
|
|
124116
124355
|
debug2("upgrading existing transport");
|
|
124117
|
-
|
|
124118
|
-
client4._maybeUpgrade(
|
|
124356
|
+
transport2 = this.createTransport(req._query.transport, req);
|
|
124357
|
+
client4._maybeUpgrade(transport2);
|
|
124119
124358
|
}
|
|
124120
124359
|
} else {
|
|
124121
|
-
|
|
124122
|
-
if (!
|
|
124360
|
+
transport2 = await this.handshake(req._query.transport, req, (errorCode2, errorContext2) => this.abortRequest(res, errorCode2, errorContext2));
|
|
124361
|
+
if (!transport2) {
|
|
124123
124362
|
return;
|
|
124124
124363
|
}
|
|
124125
124364
|
}
|
|
@@ -124134,7 +124373,7 @@ var require_userver = __commonJS((exports) => {
|
|
|
124134
124373
|
req.res.writeHeader(key, additionalHeaders[key]);
|
|
124135
124374
|
});
|
|
124136
124375
|
res.upgrade({
|
|
124137
|
-
transport
|
|
124376
|
+
transport: transport2
|
|
124138
124377
|
}, req.getHeader("sec-websocket-key"), req.getHeader("sec-websocket-protocol"), req.getHeader("sec-websocket-extensions"), context5);
|
|
124139
124378
|
};
|
|
124140
124379
|
this._applyMiddlewares(req, res, (err) => {
|
|
@@ -126254,19 +126493,19 @@ var require_cluster_adapter = __commonJS((exports) => {
|
|
|
126254
126493
|
}
|
|
126255
126494
|
onResponse(response) {
|
|
126256
126495
|
var _a4, _b2;
|
|
126257
|
-
const
|
|
126258
|
-
debug2("[%s] received response %s to request %s", this.uid, response.type,
|
|
126496
|
+
const requestId4 = response.data.requestId;
|
|
126497
|
+
debug2("[%s] received response %s to request %s", this.uid, response.type, requestId4);
|
|
126259
126498
|
switch (response.type) {
|
|
126260
126499
|
case MessageType.BROADCAST_CLIENT_COUNT: {
|
|
126261
|
-
(_a4 = this.ackRequests.get(
|
|
126500
|
+
(_a4 = this.ackRequests.get(requestId4)) === null || _a4 === undefined || _a4.clientCountCallback(response.data.clientCount);
|
|
126262
126501
|
break;
|
|
126263
126502
|
}
|
|
126264
126503
|
case MessageType.BROADCAST_ACK: {
|
|
126265
|
-
(_b2 = this.ackRequests.get(
|
|
126504
|
+
(_b2 = this.ackRequests.get(requestId4)) === null || _b2 === undefined || _b2.ack(response.data.packet);
|
|
126266
126505
|
break;
|
|
126267
126506
|
}
|
|
126268
126507
|
case MessageType.FETCH_SOCKETS_RESPONSE: {
|
|
126269
|
-
const request2 = this.requests.get(
|
|
126508
|
+
const request2 = this.requests.get(requestId4);
|
|
126270
126509
|
if (!request2) {
|
|
126271
126510
|
return;
|
|
126272
126511
|
}
|
|
@@ -126275,12 +126514,12 @@ var require_cluster_adapter = __commonJS((exports) => {
|
|
|
126275
126514
|
if (request2.current === request2.expected) {
|
|
126276
126515
|
clearTimeout(request2.timeout);
|
|
126277
126516
|
request2.resolve(request2.responses);
|
|
126278
|
-
this.requests.delete(
|
|
126517
|
+
this.requests.delete(requestId4);
|
|
126279
126518
|
}
|
|
126280
126519
|
break;
|
|
126281
126520
|
}
|
|
126282
126521
|
case MessageType.SERVER_SIDE_EMIT_RESPONSE: {
|
|
126283
|
-
const request2 = this.requests.get(
|
|
126522
|
+
const request2 = this.requests.get(requestId4);
|
|
126284
126523
|
if (!request2) {
|
|
126285
126524
|
return;
|
|
126286
126525
|
}
|
|
@@ -126289,7 +126528,7 @@ var require_cluster_adapter = __commonJS((exports) => {
|
|
|
126289
126528
|
if (request2.current === request2.expected) {
|
|
126290
126529
|
clearTimeout(request2.timeout);
|
|
126291
126530
|
request2.resolve(null, request2.responses);
|
|
126292
|
-
this.requests.delete(
|
|
126531
|
+
this.requests.delete(requestId4);
|
|
126293
126532
|
}
|
|
126294
126533
|
break;
|
|
126295
126534
|
}
|
|
@@ -126332,8 +126571,8 @@ var require_cluster_adapter = __commonJS((exports) => {
|
|
|
126332
126571
|
var _a4;
|
|
126333
126572
|
const onlyLocal = (_a4 = opts === null || opts === undefined ? undefined : opts.flags) === null || _a4 === undefined ? undefined : _a4.local;
|
|
126334
126573
|
if (!onlyLocal) {
|
|
126335
|
-
const
|
|
126336
|
-
this.ackRequests.set(
|
|
126574
|
+
const requestId4 = randomId();
|
|
126575
|
+
this.ackRequests.set(requestId4, {
|
|
126337
126576
|
clientCountCallback,
|
|
126338
126577
|
ack
|
|
126339
126578
|
});
|
|
@@ -126341,12 +126580,12 @@ var require_cluster_adapter = __commonJS((exports) => {
|
|
|
126341
126580
|
type: MessageType.BROADCAST,
|
|
126342
126581
|
data: {
|
|
126343
126582
|
packet,
|
|
126344
|
-
requestId:
|
|
126583
|
+
requestId: requestId4,
|
|
126345
126584
|
opts: encodeOptions(opts)
|
|
126346
126585
|
}
|
|
126347
126586
|
});
|
|
126348
126587
|
setTimeout(() => {
|
|
126349
|
-
this.ackRequests.delete(
|
|
126588
|
+
this.ackRequests.delete(requestId4);
|
|
126350
126589
|
}, opts.flags.timeout);
|
|
126351
126590
|
}
|
|
126352
126591
|
super.broadcastWithAck(packet, opts, clientCountCallback, ack);
|
|
@@ -126415,13 +126654,13 @@ var require_cluster_adapter = __commonJS((exports) => {
|
|
|
126415
126654
|
if (((_a4 = opts.flags) === null || _a4 === undefined ? undefined : _a4.local) || expectedResponseCount <= 0) {
|
|
126416
126655
|
return localSockets;
|
|
126417
126656
|
}
|
|
126418
|
-
const
|
|
126657
|
+
const requestId4 = randomId();
|
|
126419
126658
|
return new Promise((resolve8, reject) => {
|
|
126420
126659
|
const timeout3 = setTimeout(() => {
|
|
126421
|
-
const storedRequest2 = this.requests.get(
|
|
126660
|
+
const storedRequest2 = this.requests.get(requestId4);
|
|
126422
126661
|
if (storedRequest2) {
|
|
126423
126662
|
reject(new Error(`timeout reached: only ${storedRequest2.current} responses received out of ${storedRequest2.expected}`));
|
|
126424
|
-
this.requests.delete(
|
|
126663
|
+
this.requests.delete(requestId4);
|
|
126425
126664
|
}
|
|
126426
126665
|
}, opts.flags.timeout || DEFAULT_TIMEOUT);
|
|
126427
126666
|
const storedRequest = {
|
|
@@ -126432,12 +126671,12 @@ var require_cluster_adapter = __commonJS((exports) => {
|
|
|
126432
126671
|
expected: expectedResponseCount,
|
|
126433
126672
|
responses: localSockets
|
|
126434
126673
|
};
|
|
126435
|
-
this.requests.set(
|
|
126674
|
+
this.requests.set(requestId4, storedRequest);
|
|
126436
126675
|
this.publish({
|
|
126437
126676
|
type: MessageType.FETCH_SOCKETS,
|
|
126438
126677
|
data: {
|
|
126439
126678
|
opts: encodeOptions(opts),
|
|
126440
|
-
requestId:
|
|
126679
|
+
requestId: requestId4
|
|
126441
126680
|
}
|
|
126442
126681
|
});
|
|
126443
126682
|
});
|
|
@@ -126458,12 +126697,12 @@ var require_cluster_adapter = __commonJS((exports) => {
|
|
|
126458
126697
|
if (expectedResponseCount <= 0) {
|
|
126459
126698
|
return ack(null, []);
|
|
126460
126699
|
}
|
|
126461
|
-
const
|
|
126700
|
+
const requestId4 = randomId();
|
|
126462
126701
|
const timeout3 = setTimeout(() => {
|
|
126463
|
-
const storedRequest2 = this.requests.get(
|
|
126702
|
+
const storedRequest2 = this.requests.get(requestId4);
|
|
126464
126703
|
if (storedRequest2) {
|
|
126465
126704
|
ack(new Error(`timeout reached: only ${storedRequest2.current} responses received out of ${storedRequest2.expected}`), storedRequest2.responses);
|
|
126466
|
-
this.requests.delete(
|
|
126705
|
+
this.requests.delete(requestId4);
|
|
126467
126706
|
}
|
|
126468
126707
|
}, DEFAULT_TIMEOUT);
|
|
126469
126708
|
const storedRequest = {
|
|
@@ -126474,11 +126713,11 @@ var require_cluster_adapter = __commonJS((exports) => {
|
|
|
126474
126713
|
expected: expectedResponseCount,
|
|
126475
126714
|
responses: []
|
|
126476
126715
|
};
|
|
126477
|
-
this.requests.set(
|
|
126716
|
+
this.requests.set(requestId4, storedRequest);
|
|
126478
126717
|
this.publish({
|
|
126479
126718
|
type: MessageType.SERVER_SIDE_EMIT,
|
|
126480
126719
|
data: {
|
|
126481
|
-
requestId:
|
|
126720
|
+
requestId: requestId4,
|
|
126482
126721
|
packet
|
|
126483
126722
|
}
|
|
126484
126723
|
});
|
|
@@ -126595,12 +126834,12 @@ var require_cluster_adapter = __commonJS((exports) => {
|
|
|
126595
126834
|
if (expectedResponseCount <= 0) {
|
|
126596
126835
|
return ack(null, []);
|
|
126597
126836
|
}
|
|
126598
|
-
const
|
|
126837
|
+
const requestId4 = randomId();
|
|
126599
126838
|
const timeout3 = setTimeout(() => {
|
|
126600
|
-
const storedRequest2 = this.customRequests.get(
|
|
126839
|
+
const storedRequest2 = this.customRequests.get(requestId4);
|
|
126601
126840
|
if (storedRequest2) {
|
|
126602
126841
|
ack(new Error(`timeout reached: missing ${storedRequest2.missingUids.size} responses`), storedRequest2.responses);
|
|
126603
|
-
this.customRequests.delete(
|
|
126842
|
+
this.customRequests.delete(requestId4);
|
|
126604
126843
|
}
|
|
126605
126844
|
}, DEFAULT_TIMEOUT);
|
|
126606
126845
|
const storedRequest = {
|
|
@@ -126610,11 +126849,11 @@ var require_cluster_adapter = __commonJS((exports) => {
|
|
|
126610
126849
|
missingUids: new Set([...this.nodesMap.keys()]),
|
|
126611
126850
|
responses: []
|
|
126612
126851
|
};
|
|
126613
|
-
this.customRequests.set(
|
|
126852
|
+
this.customRequests.set(requestId4, storedRequest);
|
|
126614
126853
|
this.publish({
|
|
126615
126854
|
type: MessageType.SERVER_SIDE_EMIT,
|
|
126616
126855
|
data: {
|
|
126617
|
-
requestId:
|
|
126856
|
+
requestId: requestId4,
|
|
126618
126857
|
packet
|
|
126619
126858
|
}
|
|
126620
126859
|
});
|
|
@@ -126635,13 +126874,13 @@ var require_cluster_adapter = __commonJS((exports) => {
|
|
|
126635
126874
|
if (((_a4 = opts.flags) === null || _a4 === undefined ? undefined : _a4.local) || expectedResponseCount <= 0) {
|
|
126636
126875
|
return localSockets;
|
|
126637
126876
|
}
|
|
126638
|
-
const
|
|
126877
|
+
const requestId4 = randomId();
|
|
126639
126878
|
return new Promise((resolve8, reject) => {
|
|
126640
126879
|
const timeout3 = setTimeout(() => {
|
|
126641
|
-
const storedRequest2 = this.customRequests.get(
|
|
126880
|
+
const storedRequest2 = this.customRequests.get(requestId4);
|
|
126642
126881
|
if (storedRequest2) {
|
|
126643
126882
|
reject(new Error(`timeout reached: missing ${storedRequest2.missingUids.size} responses`));
|
|
126644
|
-
this.customRequests.delete(
|
|
126883
|
+
this.customRequests.delete(requestId4);
|
|
126645
126884
|
}
|
|
126646
126885
|
}, opts.flags.timeout || DEFAULT_TIMEOUT);
|
|
126647
126886
|
const storedRequest = {
|
|
@@ -126651,22 +126890,22 @@ var require_cluster_adapter = __commonJS((exports) => {
|
|
|
126651
126890
|
missingUids: new Set([...this.nodesMap.keys()]),
|
|
126652
126891
|
responses: localSockets
|
|
126653
126892
|
};
|
|
126654
|
-
this.customRequests.set(
|
|
126893
|
+
this.customRequests.set(requestId4, storedRequest);
|
|
126655
126894
|
this.publish({
|
|
126656
126895
|
type: MessageType.FETCH_SOCKETS,
|
|
126657
126896
|
data: {
|
|
126658
126897
|
opts: encodeOptions(opts),
|
|
126659
|
-
requestId:
|
|
126898
|
+
requestId: requestId4
|
|
126660
126899
|
}
|
|
126661
126900
|
});
|
|
126662
126901
|
});
|
|
126663
126902
|
}
|
|
126664
126903
|
onResponse(response) {
|
|
126665
|
-
const
|
|
126666
|
-
debug2("[%s] received response %s to request %s", this.uid, response.type,
|
|
126904
|
+
const requestId4 = response.data.requestId;
|
|
126905
|
+
debug2("[%s] received response %s to request %s", this.uid, response.type, requestId4);
|
|
126667
126906
|
switch (response.type) {
|
|
126668
126907
|
case MessageType.FETCH_SOCKETS_RESPONSE: {
|
|
126669
|
-
const request2 = this.customRequests.get(
|
|
126908
|
+
const request2 = this.customRequests.get(requestId4);
|
|
126670
126909
|
if (!request2) {
|
|
126671
126910
|
return;
|
|
126672
126911
|
}
|
|
@@ -126675,12 +126914,12 @@ var require_cluster_adapter = __commonJS((exports) => {
|
|
|
126675
126914
|
if (request2.missingUids.size === 0) {
|
|
126676
126915
|
clearTimeout(request2.timeout);
|
|
126677
126916
|
request2.resolve(request2.responses);
|
|
126678
|
-
this.customRequests.delete(
|
|
126917
|
+
this.customRequests.delete(requestId4);
|
|
126679
126918
|
}
|
|
126680
126919
|
break;
|
|
126681
126920
|
}
|
|
126682
126921
|
case MessageType.SERVER_SIDE_EMIT_RESPONSE: {
|
|
126683
|
-
const request2 = this.customRequests.get(
|
|
126922
|
+
const request2 = this.customRequests.get(requestId4);
|
|
126684
126923
|
if (!request2) {
|
|
126685
126924
|
return;
|
|
126686
126925
|
}
|
|
@@ -126689,7 +126928,7 @@ var require_cluster_adapter = __commonJS((exports) => {
|
|
|
126689
126928
|
if (request2.missingUids.size === 0) {
|
|
126690
126929
|
clearTimeout(request2.timeout);
|
|
126691
126930
|
request2.resolve(null, request2.responses);
|
|
126692
|
-
this.customRequests.delete(
|
|
126931
|
+
this.customRequests.delete(requestId4);
|
|
126693
126932
|
}
|
|
126694
126933
|
break;
|
|
126695
126934
|
}
|
|
@@ -126698,7 +126937,7 @@ var require_cluster_adapter = __commonJS((exports) => {
|
|
|
126698
126937
|
}
|
|
126699
126938
|
}
|
|
126700
126939
|
removeNode(uid) {
|
|
126701
|
-
this.customRequests.forEach((request2,
|
|
126940
|
+
this.customRequests.forEach((request2, requestId4) => {
|
|
126702
126941
|
request2.missingUids.delete(uid);
|
|
126703
126942
|
if (request2.missingUids.size === 0) {
|
|
126704
126943
|
clearTimeout(request2.timeout);
|
|
@@ -126707,7 +126946,7 @@ var require_cluster_adapter = __commonJS((exports) => {
|
|
|
126707
126946
|
} else if (request2.type === MessageType.SERVER_SIDE_EMIT) {
|
|
126708
126947
|
request2.resolve(null, request2.responses);
|
|
126709
126948
|
}
|
|
126710
|
-
this.customRequests.delete(
|
|
126949
|
+
this.customRequests.delete(requestId4);
|
|
126711
126950
|
}
|
|
126712
126951
|
});
|
|
126713
126952
|
this.nodesMap.delete(uid);
|
|
@@ -128099,7 +128338,7 @@ async function isChatroomInstalledDefault() {
|
|
|
128099
128338
|
return false;
|
|
128100
128339
|
}
|
|
128101
128340
|
}
|
|
128102
|
-
async function
|
|
128341
|
+
async function createDefaultDeps24() {
|
|
128103
128342
|
const client4 = await getConvexClient();
|
|
128104
128343
|
const fs12 = await import("fs/promises");
|
|
128105
128344
|
return {
|
|
@@ -128174,7 +128413,7 @@ After installation, run this command again.`;
|
|
|
128174
128413
|
});
|
|
128175
128414
|
}
|
|
128176
128415
|
async function installTool(options = {}, deps) {
|
|
128177
|
-
const d = deps ?? await
|
|
128416
|
+
const d = deps ?? await createDefaultDeps24();
|
|
128178
128417
|
const layer = layerFromDeps9(d);
|
|
128179
128418
|
return exports_Effect.runPromise(installToolEffect(options).pipe(exports_Effect.catchAll((err) => handleInstallError(err)), exports_Effect.provide(layer)));
|
|
128180
128419
|
}
|
|
@@ -128934,6 +129173,22 @@ skillCommand.command("activate <skill-name>").description("Activate a named skil
|
|
|
128934
129173
|
const { activateSkill: activateSkill2 } = await Promise.resolve().then(() => (init_skill(), exports_skill));
|
|
128935
129174
|
await activateSkill2(options.chatroomId, skillName, { role: options.role });
|
|
128936
129175
|
});
|
|
129176
|
+
var workspaceCommand = program2.command("workspace").description("Workspace file tree debugging and maintenance");
|
|
129177
|
+
var workspaceFileTreeCommand = workspaceCommand.command("file-tree").description("Workspace file tree daemon sync");
|
|
129178
|
+
workspaceFileTreeCommand.command("request").description("Request daemon file tree sync (same mutation as webapp refresh)").requiredOption("--machine-id <id>", "Machine identifier").requiredOption("--working-dir <path>", "Workspace working directory").option("--force", "Force reconciliation walk (explicit recovery)").action(async (options) => {
|
|
129179
|
+
await maybeRequireAuth();
|
|
129180
|
+
const { requestWorkspaceFileTreeFromCli: requestWorkspaceFileTreeFromCli2 } = await Promise.resolve().then(() => (init_workspace(), exports_workspace));
|
|
129181
|
+
const result = await requestWorkspaceFileTreeFromCli2(options.machineId, options.workingDir, {
|
|
129182
|
+
force: options.force
|
|
129183
|
+
});
|
|
129184
|
+
console.log(`✅ File tree request: ${result.status}`);
|
|
129185
|
+
});
|
|
129186
|
+
workspaceFileTreeCommand.command("status").description("Show checkpoint, manifest, and pending daemon requests for debugging").requiredOption("--machine-id <id>", "Machine identifier").requiredOption("--working-dir <path>", "Workspace working directory").action(async (options) => {
|
|
129187
|
+
await maybeRequireAuth();
|
|
129188
|
+
const { getWorkspaceFileTreeStatusFromCli: getWorkspaceFileTreeStatusFromCli2 } = await Promise.resolve().then(() => (init_workspace(), exports_workspace));
|
|
129189
|
+
const status3 = await getWorkspaceFileTreeStatusFromCli2(options.machineId, options.workingDir);
|
|
129190
|
+
console.log(JSON.stringify(status3, null, 2));
|
|
129191
|
+
});
|
|
128937
129192
|
var messagesCommand = program2.command("messages").description("List and filter chatroom messages");
|
|
128938
129193
|
var messageCommand = program2.command("message").description("Send chatroom messages");
|
|
128939
129194
|
messageCommand.command("send").description("Send a user message to a chatroom").requiredOption("--chatroom-id <id>", "Chatroom identifier").requiredOption("--content <text>", "Message content").option("--target-role <role>", "Target role (defaults to team entry point)").action(async (options) => {
|
|
@@ -129154,4 +129409,4 @@ program2.hook("preAction", async (_thisCommand, actionCommand) => {
|
|
|
129154
129409
|
});
|
|
129155
129410
|
program2.parse();
|
|
129156
129411
|
|
|
129157
|
-
//# debugId=
|
|
129412
|
+
//# debugId=104EE59D5601863F64756E2164756E21
|