@spencer-kit/coder-studio 0.3.4 → 0.3.5
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/CHANGELOG.md +6 -0
- package/dist/esm/bin.mjs +184 -155
- package/dist/esm/bin.mjs.map +4 -4
- package/dist/esm/server-runner.mjs +184 -155
- package/dist/esm/server-runner.mjs.map +4 -4
- package/dist/web/assets/index-B3PO5hz_.js +111 -0
- package/dist/web/assets/index-B3PO5hz_.js.map +1 -0
- package/dist/web/assets/{index-gL8kTxHV.css → index-BbpuXQCm.css} +1 -1
- package/dist/web/index.html +2 -2
- package/package.json +1 -1
- package/dist/web/assets/index-xgtwbfqN.js +0 -111
- package/dist/web/assets/index-xgtwbfqN.js.map +0 -1
package/dist/esm/bin.mjs
CHANGED
|
@@ -8445,8 +8445,12 @@ var init_client = __esm({
|
|
|
8445
8445
|
evictedBytesSinceLastWarn = 0;
|
|
8446
8446
|
lastStreamBufferWarnAt = 0;
|
|
8447
8447
|
logger;
|
|
8448
|
+
markAlive() {
|
|
8449
|
+
this.isAlive = true;
|
|
8450
|
+
}
|
|
8448
8451
|
setupSocketHandlers() {
|
|
8449
8452
|
this.socket.on("message", (data, isBinary) => {
|
|
8453
|
+
this.markAlive();
|
|
8450
8454
|
if (isBinary) {
|
|
8451
8455
|
this.messageHandler?.(data);
|
|
8452
8456
|
return;
|
|
@@ -8465,7 +8469,7 @@ var init_client = __esm({
|
|
|
8465
8469
|
this.closeHandler?.();
|
|
8466
8470
|
});
|
|
8467
8471
|
this.socket.on("pong", () => {
|
|
8468
|
-
this.
|
|
8472
|
+
this.markAlive();
|
|
8469
8473
|
});
|
|
8470
8474
|
}
|
|
8471
8475
|
/**
|
|
@@ -8975,6 +8979,10 @@ var init_hub = __esm({
|
|
|
8975
8979
|
*/
|
|
8976
8980
|
pingAll() {
|
|
8977
8981
|
for (const client of this.clients.values()) {
|
|
8982
|
+
if (!client.alive) {
|
|
8983
|
+
client.close(1011, "keepalive_timeout");
|
|
8984
|
+
continue;
|
|
8985
|
+
}
|
|
8978
8986
|
client.ping();
|
|
8979
8987
|
}
|
|
8980
8988
|
}
|
|
@@ -9233,6 +9241,18 @@ var init_workspace_activity = __esm({
|
|
|
9233
9241
|
}
|
|
9234
9242
|
});
|
|
9235
9243
|
|
|
9244
|
+
// packages/server/src/commands/connection.ts
|
|
9245
|
+
import { z as z8 } from "zod";
|
|
9246
|
+
var init_connection = __esm({
|
|
9247
|
+
"packages/server/src/commands/connection.ts"() {
|
|
9248
|
+
"use strict";
|
|
9249
|
+
init_dispatch();
|
|
9250
|
+
registerCommand("connection.probe", z8.object({}).default({}), async () => {
|
|
9251
|
+
return { ok: true };
|
|
9252
|
+
});
|
|
9253
|
+
}
|
|
9254
|
+
});
|
|
9255
|
+
|
|
9236
9256
|
// packages/server/src/provider-runtime/runtime-status.ts
|
|
9237
9257
|
function canAutoInstall(provider, platform, missingCommands, missingPrerequisites, availableCommands) {
|
|
9238
9258
|
const strategies = provider.install.strategies[platform] ?? [];
|
|
@@ -9327,7 +9347,7 @@ var init_runtime_status = __esm({
|
|
|
9327
9347
|
});
|
|
9328
9348
|
|
|
9329
9349
|
// packages/server/src/commands/session.ts
|
|
9330
|
-
import { z as
|
|
9350
|
+
import { z as z9 } from "zod";
|
|
9331
9351
|
function getProviderFromRegistry(providerId, registry) {
|
|
9332
9352
|
return registry.find((provider) => provider.id === providerId);
|
|
9333
9353
|
}
|
|
@@ -9338,8 +9358,8 @@ var init_session = __esm({
|
|
|
9338
9358
|
init_dispatch();
|
|
9339
9359
|
registerCommand(
|
|
9340
9360
|
"session.list",
|
|
9341
|
-
|
|
9342
|
-
workspaceId:
|
|
9361
|
+
z9.object({
|
|
9362
|
+
workspaceId: z9.string()
|
|
9343
9363
|
}),
|
|
9344
9364
|
async (args, ctx) => {
|
|
9345
9365
|
return ctx.sessionMgr.getForWorkspace(args.workspaceId);
|
|
@@ -9347,10 +9367,10 @@ var init_session = __esm({
|
|
|
9347
9367
|
);
|
|
9348
9368
|
registerCommand(
|
|
9349
9369
|
"session.create",
|
|
9350
|
-
|
|
9351
|
-
workspaceId:
|
|
9352
|
-
providerId:
|
|
9353
|
-
draft:
|
|
9370
|
+
z9.object({
|
|
9371
|
+
workspaceId: z9.string(),
|
|
9372
|
+
providerId: z9.string(),
|
|
9373
|
+
draft: z9.string().optional()
|
|
9354
9374
|
}),
|
|
9355
9375
|
async (args, ctx) => {
|
|
9356
9376
|
const workspace = ctx.workspaceMgr.get(args.workspaceId);
|
|
@@ -9384,8 +9404,8 @@ var init_session = __esm({
|
|
|
9384
9404
|
);
|
|
9385
9405
|
registerCommand(
|
|
9386
9406
|
"session.stop",
|
|
9387
|
-
|
|
9388
|
-
sessionId:
|
|
9407
|
+
z9.object({
|
|
9408
|
+
sessionId: z9.string()
|
|
9389
9409
|
}),
|
|
9390
9410
|
async (args, ctx) => {
|
|
9391
9411
|
await ctx.sessionMgr.stop(args.sessionId);
|
|
@@ -9393,8 +9413,8 @@ var init_session = __esm({
|
|
|
9393
9413
|
);
|
|
9394
9414
|
registerCommand(
|
|
9395
9415
|
"session.remove",
|
|
9396
|
-
|
|
9397
|
-
sessionId:
|
|
9416
|
+
z9.object({
|
|
9417
|
+
sessionId: z9.string()
|
|
9398
9418
|
}),
|
|
9399
9419
|
async (args, ctx) => {
|
|
9400
9420
|
const session = ctx.sessionMgr.get(args.sessionId);
|
|
@@ -9559,7 +9579,7 @@ var init_tree = __esm({
|
|
|
9559
9579
|
});
|
|
9560
9580
|
|
|
9561
9581
|
// packages/server/src/commands/file.ts
|
|
9562
|
-
import { z as
|
|
9582
|
+
import { z as z10 } from "zod";
|
|
9563
9583
|
var init_file = __esm({
|
|
9564
9584
|
"packages/server/src/commands/file.ts"() {
|
|
9565
9585
|
"use strict";
|
|
@@ -9568,9 +9588,9 @@ var init_file = __esm({
|
|
|
9568
9588
|
init_dispatch();
|
|
9569
9589
|
registerCommand(
|
|
9570
9590
|
"file.readTree",
|
|
9571
|
-
|
|
9572
|
-
workspaceId:
|
|
9573
|
-
subPath:
|
|
9591
|
+
z10.object({
|
|
9592
|
+
workspaceId: z10.string(),
|
|
9593
|
+
subPath: z10.string().optional()
|
|
9574
9594
|
}),
|
|
9575
9595
|
async (args, ctx) => {
|
|
9576
9596
|
const workspace = ctx.workspaceMgr.get(args.workspaceId);
|
|
@@ -9582,10 +9602,10 @@ var init_file = __esm({
|
|
|
9582
9602
|
);
|
|
9583
9603
|
registerCommand(
|
|
9584
9604
|
"file.search",
|
|
9585
|
-
|
|
9586
|
-
workspaceId:
|
|
9587
|
-
query:
|
|
9588
|
-
limit:
|
|
9605
|
+
z10.object({
|
|
9606
|
+
workspaceId: z10.string(),
|
|
9607
|
+
query: z10.string(),
|
|
9608
|
+
limit: z10.number().int().positive().max(50).optional()
|
|
9589
9609
|
}),
|
|
9590
9610
|
async (args, ctx) => {
|
|
9591
9611
|
const workspace = ctx.workspaceMgr.get(args.workspaceId);
|
|
@@ -9597,9 +9617,9 @@ var init_file = __esm({
|
|
|
9597
9617
|
);
|
|
9598
9618
|
registerCommand(
|
|
9599
9619
|
"file.read",
|
|
9600
|
-
|
|
9601
|
-
workspaceId:
|
|
9602
|
-
path:
|
|
9620
|
+
z10.object({
|
|
9621
|
+
workspaceId: z10.string(),
|
|
9622
|
+
path: z10.string()
|
|
9603
9623
|
}),
|
|
9604
9624
|
async (args, ctx) => {
|
|
9605
9625
|
const workspace = ctx.workspaceMgr.get(args.workspaceId);
|
|
@@ -9611,9 +9631,9 @@ var init_file = __esm({
|
|
|
9611
9631
|
);
|
|
9612
9632
|
registerCommand(
|
|
9613
9633
|
"file.create",
|
|
9614
|
-
|
|
9615
|
-
workspaceId:
|
|
9616
|
-
path:
|
|
9634
|
+
z10.object({
|
|
9635
|
+
workspaceId: z10.string(),
|
|
9636
|
+
path: z10.string()
|
|
9617
9637
|
}),
|
|
9618
9638
|
async (args, ctx) => {
|
|
9619
9639
|
const workspace = ctx.workspaceMgr.get(args.workspaceId);
|
|
@@ -9631,9 +9651,9 @@ var init_file = __esm({
|
|
|
9631
9651
|
);
|
|
9632
9652
|
registerCommand(
|
|
9633
9653
|
"file.mkdir",
|
|
9634
|
-
|
|
9635
|
-
workspaceId:
|
|
9636
|
-
path:
|
|
9654
|
+
z10.object({
|
|
9655
|
+
workspaceId: z10.string(),
|
|
9656
|
+
path: z10.string()
|
|
9637
9657
|
}),
|
|
9638
9658
|
async (args, ctx) => {
|
|
9639
9659
|
const workspace = ctx.workspaceMgr.get(args.workspaceId);
|
|
@@ -9651,9 +9671,9 @@ var init_file = __esm({
|
|
|
9651
9671
|
);
|
|
9652
9672
|
registerCommand(
|
|
9653
9673
|
"file.delete",
|
|
9654
|
-
|
|
9655
|
-
workspaceId:
|
|
9656
|
-
path:
|
|
9674
|
+
z10.object({
|
|
9675
|
+
workspaceId: z10.string(),
|
|
9676
|
+
path: z10.string()
|
|
9657
9677
|
}),
|
|
9658
9678
|
async (args, ctx) => {
|
|
9659
9679
|
const workspace = ctx.workspaceMgr.get(args.workspaceId);
|
|
@@ -9671,11 +9691,11 @@ var init_file = __esm({
|
|
|
9671
9691
|
);
|
|
9672
9692
|
registerCommand(
|
|
9673
9693
|
"file.write",
|
|
9674
|
-
|
|
9675
|
-
workspaceId:
|
|
9676
|
-
path:
|
|
9677
|
-
content:
|
|
9678
|
-
baseHash:
|
|
9694
|
+
z10.object({
|
|
9695
|
+
workspaceId: z10.string(),
|
|
9696
|
+
path: z10.string(),
|
|
9697
|
+
content: z10.string(),
|
|
9698
|
+
baseHash: z10.string().optional()
|
|
9679
9699
|
// For conflict detection
|
|
9680
9700
|
}),
|
|
9681
9701
|
async (args, ctx) => {
|
|
@@ -9766,7 +9786,7 @@ var init_git_events = __esm({
|
|
|
9766
9786
|
});
|
|
9767
9787
|
|
|
9768
9788
|
// packages/server/src/commands/git.ts
|
|
9769
|
-
import { z as
|
|
9789
|
+
import { z as z11 } from "zod";
|
|
9770
9790
|
async function runGitNetworkOperation(ctx, workspaceId, op) {
|
|
9771
9791
|
if (!ctx.autoFetch?.runExclusive) {
|
|
9772
9792
|
return op();
|
|
@@ -9781,16 +9801,16 @@ var init_git2 = __esm({
|
|
|
9781
9801
|
init_diff();
|
|
9782
9802
|
init_dispatch();
|
|
9783
9803
|
init_git_events();
|
|
9784
|
-
gitHttpAuthSchema =
|
|
9785
|
-
username:
|
|
9786
|
-
password:
|
|
9804
|
+
gitHttpAuthSchema = z11.object({
|
|
9805
|
+
username: z11.string(),
|
|
9806
|
+
password: z11.string()
|
|
9787
9807
|
});
|
|
9788
|
-
gitCommitRevisionSchema =
|
|
9808
|
+
gitCommitRevisionSchema = z11.string().regex(/^[0-9a-fA-F]{7,64}$/, "Invalid git commit revision");
|
|
9789
9809
|
GIT_BACKGROUND_FETCH_TIMEOUT_MS = 30 * 1e3;
|
|
9790
9810
|
registerCommand(
|
|
9791
9811
|
"git.status",
|
|
9792
|
-
|
|
9793
|
-
workspaceId:
|
|
9812
|
+
z11.object({
|
|
9813
|
+
workspaceId: z11.string()
|
|
9794
9814
|
}),
|
|
9795
9815
|
async (args, ctx) => {
|
|
9796
9816
|
const workspace = ctx.workspaceMgr.get(args.workspaceId);
|
|
@@ -9802,9 +9822,9 @@ var init_git2 = __esm({
|
|
|
9802
9822
|
);
|
|
9803
9823
|
registerCommand(
|
|
9804
9824
|
"git.stage",
|
|
9805
|
-
|
|
9806
|
-
workspaceId:
|
|
9807
|
-
paths:
|
|
9825
|
+
z11.object({
|
|
9826
|
+
workspaceId: z11.string(),
|
|
9827
|
+
paths: z11.array(z11.string())
|
|
9808
9828
|
}),
|
|
9809
9829
|
async (args, ctx) => {
|
|
9810
9830
|
const workspace = ctx.workspaceMgr.get(args.workspaceId);
|
|
@@ -9818,10 +9838,10 @@ var init_git2 = __esm({
|
|
|
9818
9838
|
);
|
|
9819
9839
|
registerCommand(
|
|
9820
9840
|
"git.diff",
|
|
9821
|
-
|
|
9822
|
-
workspaceId:
|
|
9823
|
-
path:
|
|
9824
|
-
staged:
|
|
9841
|
+
z11.object({
|
|
9842
|
+
workspaceId: z11.string(),
|
|
9843
|
+
path: z11.string(),
|
|
9844
|
+
staged: z11.boolean().optional()
|
|
9825
9845
|
}),
|
|
9826
9846
|
async (args, ctx) => {
|
|
9827
9847
|
const workspace = ctx.workspaceMgr.get(args.workspaceId);
|
|
@@ -9835,9 +9855,9 @@ var init_git2 = __esm({
|
|
|
9835
9855
|
);
|
|
9836
9856
|
registerCommand(
|
|
9837
9857
|
"git.log",
|
|
9838
|
-
|
|
9839
|
-
workspaceId:
|
|
9840
|
-
limit:
|
|
9858
|
+
z11.object({
|
|
9859
|
+
workspaceId: z11.string(),
|
|
9860
|
+
limit: z11.number().int().min(1).max(50).optional()
|
|
9841
9861
|
}),
|
|
9842
9862
|
async (args, ctx) => {
|
|
9843
9863
|
const workspace = ctx.workspaceMgr.get(args.workspaceId);
|
|
@@ -9851,8 +9871,8 @@ var init_git2 = __esm({
|
|
|
9851
9871
|
);
|
|
9852
9872
|
registerCommand(
|
|
9853
9873
|
"git.show",
|
|
9854
|
-
|
|
9855
|
-
workspaceId:
|
|
9874
|
+
z11.object({
|
|
9875
|
+
workspaceId: z11.string(),
|
|
9856
9876
|
sha: gitCommitRevisionSchema
|
|
9857
9877
|
}),
|
|
9858
9878
|
async (args, ctx) => {
|
|
@@ -9867,9 +9887,9 @@ var init_git2 = __esm({
|
|
|
9867
9887
|
);
|
|
9868
9888
|
registerCommand(
|
|
9869
9889
|
"git.unstage",
|
|
9870
|
-
|
|
9871
|
-
workspaceId:
|
|
9872
|
-
paths:
|
|
9890
|
+
z11.object({
|
|
9891
|
+
workspaceId: z11.string(),
|
|
9892
|
+
paths: z11.array(z11.string())
|
|
9873
9893
|
}),
|
|
9874
9894
|
async (args, ctx) => {
|
|
9875
9895
|
const workspace = ctx.workspaceMgr.get(args.workspaceId);
|
|
@@ -9883,9 +9903,9 @@ var init_git2 = __esm({
|
|
|
9883
9903
|
);
|
|
9884
9904
|
registerCommand(
|
|
9885
9905
|
"git.discard",
|
|
9886
|
-
|
|
9887
|
-
workspaceId:
|
|
9888
|
-
paths:
|
|
9906
|
+
z11.object({
|
|
9907
|
+
workspaceId: z11.string(),
|
|
9908
|
+
paths: z11.array(z11.string())
|
|
9889
9909
|
}),
|
|
9890
9910
|
async (args, ctx) => {
|
|
9891
9911
|
const workspace = ctx.workspaceMgr.get(args.workspaceId);
|
|
@@ -9901,9 +9921,9 @@ var init_git2 = __esm({
|
|
|
9901
9921
|
);
|
|
9902
9922
|
registerCommand(
|
|
9903
9923
|
"git.commit",
|
|
9904
|
-
|
|
9905
|
-
workspaceId:
|
|
9906
|
-
message:
|
|
9924
|
+
z11.object({
|
|
9925
|
+
workspaceId: z11.string(),
|
|
9926
|
+
message: z11.string()
|
|
9907
9927
|
}),
|
|
9908
9928
|
async (args, ctx) => {
|
|
9909
9929
|
const workspace = ctx.workspaceMgr.get(args.workspaceId);
|
|
@@ -9920,11 +9940,11 @@ var init_git2 = __esm({
|
|
|
9920
9940
|
);
|
|
9921
9941
|
registerCommand(
|
|
9922
9942
|
"git.push",
|
|
9923
|
-
|
|
9924
|
-
workspaceId:
|
|
9925
|
-
remote:
|
|
9926
|
-
branch:
|
|
9927
|
-
force:
|
|
9943
|
+
z11.object({
|
|
9944
|
+
workspaceId: z11.string(),
|
|
9945
|
+
remote: z11.string().optional(),
|
|
9946
|
+
branch: z11.string().optional(),
|
|
9947
|
+
force: z11.boolean().optional(),
|
|
9928
9948
|
auth: gitHttpAuthSchema.optional()
|
|
9929
9949
|
}),
|
|
9930
9950
|
async (args, ctx) => {
|
|
@@ -9951,10 +9971,10 @@ var init_git2 = __esm({
|
|
|
9951
9971
|
);
|
|
9952
9972
|
registerCommand(
|
|
9953
9973
|
"git.pull",
|
|
9954
|
-
|
|
9955
|
-
workspaceId:
|
|
9956
|
-
remote:
|
|
9957
|
-
branch:
|
|
9974
|
+
z11.object({
|
|
9975
|
+
workspaceId: z11.string(),
|
|
9976
|
+
remote: z11.string().optional(),
|
|
9977
|
+
branch: z11.string().optional(),
|
|
9958
9978
|
auth: gitHttpAuthSchema.optional()
|
|
9959
9979
|
}),
|
|
9960
9980
|
async (args, ctx) => {
|
|
@@ -9982,12 +10002,12 @@ var init_git2 = __esm({
|
|
|
9982
10002
|
);
|
|
9983
10003
|
registerCommand(
|
|
9984
10004
|
"git.fetch",
|
|
9985
|
-
|
|
9986
|
-
workspaceId:
|
|
9987
|
-
remote:
|
|
9988
|
-
prune:
|
|
10005
|
+
z11.object({
|
|
10006
|
+
workspaceId: z11.string(),
|
|
10007
|
+
remote: z11.string().optional(),
|
|
10008
|
+
prune: z11.boolean().optional(),
|
|
9989
10009
|
auth: gitHttpAuthSchema.optional(),
|
|
9990
|
-
background:
|
|
10010
|
+
background: z11.boolean().optional()
|
|
9991
10011
|
}),
|
|
9992
10012
|
async (args, ctx, clientId) => {
|
|
9993
10013
|
const workspace = ctx.workspaceMgr.get(args.workspaceId);
|
|
@@ -10016,10 +10036,10 @@ var init_git2 = __esm({
|
|
|
10016
10036
|
);
|
|
10017
10037
|
registerCommand(
|
|
10018
10038
|
"git.checkout",
|
|
10019
|
-
|
|
10020
|
-
workspaceId:
|
|
10021
|
-
ref:
|
|
10022
|
-
createBranch:
|
|
10039
|
+
z11.object({
|
|
10040
|
+
workspaceId: z11.string(),
|
|
10041
|
+
ref: z11.string(),
|
|
10042
|
+
createBranch: z11.boolean().optional()
|
|
10023
10043
|
}),
|
|
10024
10044
|
async (args, ctx) => {
|
|
10025
10045
|
const workspace = ctx.workspaceMgr.get(args.workspaceId);
|
|
@@ -10041,10 +10061,10 @@ var init_git2 = __esm({
|
|
|
10041
10061
|
);
|
|
10042
10062
|
registerCommand(
|
|
10043
10063
|
"git.branch",
|
|
10044
|
-
|
|
10045
|
-
workspaceId:
|
|
10046
|
-
name:
|
|
10047
|
-
startPoint:
|
|
10064
|
+
z11.object({
|
|
10065
|
+
workspaceId: z11.string(),
|
|
10066
|
+
name: z11.string(),
|
|
10067
|
+
startPoint: z11.string().optional()
|
|
10048
10068
|
}),
|
|
10049
10069
|
async (args, ctx) => {
|
|
10050
10070
|
const workspace = ctx.workspaceMgr.get(args.workspaceId);
|
|
@@ -10063,8 +10083,8 @@ var init_git2 = __esm({
|
|
|
10063
10083
|
);
|
|
10064
10084
|
registerCommand(
|
|
10065
10085
|
"git.branches",
|
|
10066
|
-
|
|
10067
|
-
workspaceId:
|
|
10086
|
+
z11.object({
|
|
10087
|
+
workspaceId: z11.string()
|
|
10068
10088
|
}),
|
|
10069
10089
|
async (args, ctx) => {
|
|
10070
10090
|
const workspace = ctx.workspaceMgr.get(args.workspaceId);
|
|
@@ -10158,7 +10178,7 @@ var init_config_io = __esm({
|
|
|
10158
10178
|
});
|
|
10159
10179
|
|
|
10160
10180
|
// packages/server/src/commands/settings.ts
|
|
10161
|
-
import { z as
|
|
10181
|
+
import { z as z12 } from "zod";
|
|
10162
10182
|
function flattenSettings(obj, prefix = "") {
|
|
10163
10183
|
const result = {};
|
|
10164
10184
|
for (const [key, value] of Object.entries(obj)) {
|
|
@@ -10181,27 +10201,28 @@ var init_settings2 = __esm({
|
|
|
10181
10201
|
init_provider_config_repo();
|
|
10182
10202
|
init_settings();
|
|
10183
10203
|
init_dispatch();
|
|
10184
|
-
SettingsSchema =
|
|
10185
|
-
defaultProviderId:
|
|
10186
|
-
notifications:
|
|
10187
|
-
enabled:
|
|
10188
|
-
soundEnabled:
|
|
10204
|
+
SettingsSchema = z12.object({
|
|
10205
|
+
defaultProviderId: z12.string().optional(),
|
|
10206
|
+
notifications: z12.object({
|
|
10207
|
+
enabled: z12.boolean().optional(),
|
|
10208
|
+
soundEnabled: z12.boolean().optional(),
|
|
10189
10209
|
// Legacy field — accepted for backward compat with older clients but
|
|
10190
10210
|
// no longer surfaced in the UI. The web client now picks the channel
|
|
10191
10211
|
// automatically based on workspace focus + page visibility.
|
|
10192
|
-
onlyWhenBackgrounded:
|
|
10212
|
+
onlyWhenBackgrounded: z12.boolean().optional()
|
|
10193
10213
|
}).optional(),
|
|
10194
|
-
supervisor:
|
|
10195
|
-
evaluationTimeoutSec:
|
|
10214
|
+
supervisor: z12.object({
|
|
10215
|
+
evaluationTimeoutSec: z12.number().int().min(1).max(MAX_SUPERVISOR_EVALUATION_TIMEOUT_SEC).default(DEFAULT_SUPERVISOR_EVALUATION_TIMEOUT_SEC).optional()
|
|
10196
10216
|
}).optional(),
|
|
10197
|
-
appearance:
|
|
10198
|
-
theme:
|
|
10199
|
-
terminalRenderer:
|
|
10200
|
-
|
|
10217
|
+
appearance: z12.object({
|
|
10218
|
+
theme: z12.enum(["dark"]).optional(),
|
|
10219
|
+
terminalRenderer: z12.enum(["standard", "compatibility"]).optional(),
|
|
10220
|
+
terminalCopyOnSelect: z12.boolean().optional(),
|
|
10221
|
+
locale: z12.enum(["zh", "en"]).optional()
|
|
10201
10222
|
}).optional(),
|
|
10202
10223
|
providers: ProviderSettingsSchema.optional()
|
|
10203
10224
|
});
|
|
10204
|
-
registerCommand("settings.get",
|
|
10225
|
+
registerCommand("settings.get", z12.object({}), async (_args, ctx) => {
|
|
10205
10226
|
const row = ctx.db.prepare("SELECT key, value FROM user_settings").all();
|
|
10206
10227
|
const settings = {};
|
|
10207
10228
|
for (const { key, value } of row) {
|
|
@@ -10234,7 +10255,7 @@ var init_settings2 = __esm({
|
|
|
10234
10255
|
});
|
|
10235
10256
|
registerCommand(
|
|
10236
10257
|
"settings.update",
|
|
10237
|
-
|
|
10258
|
+
z12.object({
|
|
10238
10259
|
settings: SettingsSchema
|
|
10239
10260
|
}),
|
|
10240
10261
|
async (args, ctx) => {
|
|
@@ -10266,10 +10287,10 @@ var init_settings2 = __esm({
|
|
|
10266
10287
|
);
|
|
10267
10288
|
registerCommand(
|
|
10268
10289
|
"settings.previewCommand",
|
|
10269
|
-
|
|
10270
|
-
providerId:
|
|
10290
|
+
z12.object({
|
|
10291
|
+
providerId: z12.string(),
|
|
10271
10292
|
config: ProviderLaunchConfigInputSchema,
|
|
10272
|
-
workspacePath:
|
|
10293
|
+
workspacePath: z12.string().optional()
|
|
10273
10294
|
}),
|
|
10274
10295
|
async (args, ctx) => {
|
|
10275
10296
|
const provider = ctx.providerRegistry.find((item) => item.id === args.providerId);
|
|
@@ -10290,8 +10311,8 @@ var init_settings2 = __esm({
|
|
|
10290
10311
|
);
|
|
10291
10312
|
registerCommand(
|
|
10292
10313
|
"settings.readConfigFile",
|
|
10293
|
-
|
|
10294
|
-
configType:
|
|
10314
|
+
z12.object({
|
|
10315
|
+
configType: z12.enum(["codex", "claude"])
|
|
10295
10316
|
}),
|
|
10296
10317
|
async (args) => {
|
|
10297
10318
|
const result = readConfigFile(args.configType);
|
|
@@ -10300,9 +10321,9 @@ var init_settings2 = __esm({
|
|
|
10300
10321
|
);
|
|
10301
10322
|
registerCommand(
|
|
10302
10323
|
"settings.writeConfigFile",
|
|
10303
|
-
|
|
10304
|
-
configType:
|
|
10305
|
-
content:
|
|
10324
|
+
z12.object({
|
|
10325
|
+
configType: z12.enum(["codex", "claude"]),
|
|
10326
|
+
content: z12.string()
|
|
10306
10327
|
}),
|
|
10307
10328
|
async (args) => {
|
|
10308
10329
|
const result = writeConfigFile(args.configType, args.content);
|
|
@@ -10313,19 +10334,19 @@ var init_settings2 = __esm({
|
|
|
10313
10334
|
});
|
|
10314
10335
|
|
|
10315
10336
|
// packages/server/src/commands/provider.ts
|
|
10316
|
-
import { z as
|
|
10337
|
+
import { z as z13 } from "zod";
|
|
10317
10338
|
var init_provider = __esm({
|
|
10318
10339
|
"packages/server/src/commands/provider.ts"() {
|
|
10319
10340
|
"use strict";
|
|
10320
10341
|
init_runtime_status();
|
|
10321
10342
|
init_dispatch();
|
|
10322
|
-
registerCommand("provider.runtimeStatus",
|
|
10343
|
+
registerCommand("provider.runtimeStatus", z13.object({}), async (_args, ctx) => {
|
|
10323
10344
|
return buildProviderRuntimeStatus(ctx.providerRegistry, ctx.providerRuntimeDeps);
|
|
10324
10345
|
});
|
|
10325
10346
|
registerCommand(
|
|
10326
10347
|
"provider.install.start",
|
|
10327
|
-
|
|
10328
|
-
providerId:
|
|
10348
|
+
z13.object({
|
|
10349
|
+
providerId: z13.string()
|
|
10329
10350
|
}),
|
|
10330
10351
|
async (args, ctx) => {
|
|
10331
10352
|
if (!ctx.providerInstallMgr) {
|
|
@@ -10339,8 +10360,8 @@ var init_provider = __esm({
|
|
|
10339
10360
|
);
|
|
10340
10361
|
registerCommand(
|
|
10341
10362
|
"provider.install.get",
|
|
10342
|
-
|
|
10343
|
-
jobId:
|
|
10363
|
+
z13.object({
|
|
10364
|
+
jobId: z13.string()
|
|
10344
10365
|
}),
|
|
10345
10366
|
async (args, ctx) => {
|
|
10346
10367
|
if (!ctx.providerInstallMgr) {
|
|
@@ -10363,29 +10384,29 @@ var init_provider = __esm({
|
|
|
10363
10384
|
});
|
|
10364
10385
|
|
|
10365
10386
|
// packages/server/src/commands/supervisor.ts
|
|
10366
|
-
import { z as
|
|
10387
|
+
import { z as z14 } from "zod";
|
|
10367
10388
|
var supervisorObjectiveSchema, createSupervisorSchema, updateSupervisorSchema, sessionIdSchema, supervisorIdSchema;
|
|
10368
10389
|
var init_supervisor2 = __esm({
|
|
10369
10390
|
"packages/server/src/commands/supervisor.ts"() {
|
|
10370
10391
|
"use strict";
|
|
10371
10392
|
init_dispatch();
|
|
10372
|
-
supervisorObjectiveSchema =
|
|
10373
|
-
createSupervisorSchema =
|
|
10374
|
-
sessionId:
|
|
10375
|
-
workspaceId:
|
|
10393
|
+
supervisorObjectiveSchema = z14.string().trim().min(1).max(4e3);
|
|
10394
|
+
createSupervisorSchema = z14.object({
|
|
10395
|
+
sessionId: z14.string(),
|
|
10396
|
+
workspaceId: z14.string(),
|
|
10376
10397
|
objective: supervisorObjectiveSchema,
|
|
10377
|
-
evaluatorProviderId:
|
|
10398
|
+
evaluatorProviderId: z14.string()
|
|
10378
10399
|
}).strict();
|
|
10379
|
-
updateSupervisorSchema =
|
|
10380
|
-
id:
|
|
10400
|
+
updateSupervisorSchema = z14.object({
|
|
10401
|
+
id: z14.string(),
|
|
10381
10402
|
objective: supervisorObjectiveSchema.optional(),
|
|
10382
|
-
evaluatorProviderId:
|
|
10403
|
+
evaluatorProviderId: z14.string().optional()
|
|
10383
10404
|
}).strict().refine(
|
|
10384
10405
|
(input2) => input2.objective !== void 0 || input2.evaluatorProviderId !== void 0,
|
|
10385
10406
|
"objective or evaluatorProviderId is required"
|
|
10386
10407
|
);
|
|
10387
|
-
sessionIdSchema =
|
|
10388
|
-
supervisorIdSchema =
|
|
10408
|
+
sessionIdSchema = z14.object({ sessionId: z14.string() });
|
|
10409
|
+
supervisorIdSchema = z14.object({ id: z14.string() });
|
|
10389
10410
|
registerCommand("supervisor.create", createSupervisorSchema, async (args, ctx) => {
|
|
10390
10411
|
return {
|
|
10391
10412
|
supervisor: await ctx.supervisorMgr.create({
|
|
@@ -10563,7 +10584,7 @@ var init_worktree = __esm({
|
|
|
10563
10584
|
|
|
10564
10585
|
// packages/server/src/commands/worktree.ts
|
|
10565
10586
|
import path9 from "node:path";
|
|
10566
|
-
import { z as
|
|
10587
|
+
import { z as z15 } from "zod";
|
|
10567
10588
|
async function findRelatedWorkspaceIds(ctx, workspacePath) {
|
|
10568
10589
|
const targetCommonDir = await getGitCommonDirPath(workspacePath);
|
|
10569
10590
|
const relatedWorkspaceIds = await Promise.all(
|
|
@@ -10596,7 +10617,7 @@ var init_worktree2 = __esm({
|
|
|
10596
10617
|
init_worktree();
|
|
10597
10618
|
init_dispatch();
|
|
10598
10619
|
init_git_events();
|
|
10599
|
-
registerCommand("worktree.list",
|
|
10620
|
+
registerCommand("worktree.list", z15.object({ workspaceId: z15.string() }), async (args, ctx) => {
|
|
10600
10621
|
const workspace = ctx.workspaceMgr.get(args.workspaceId);
|
|
10601
10622
|
if (!workspace) {
|
|
10602
10623
|
throw { code: "workspace_not_found", message: `Workspace not found: ${args.workspaceId}` };
|
|
@@ -10605,7 +10626,7 @@ var init_worktree2 = __esm({
|
|
|
10605
10626
|
});
|
|
10606
10627
|
registerCommand(
|
|
10607
10628
|
"worktree.status",
|
|
10608
|
-
|
|
10629
|
+
z15.object({ workspaceId: z15.string(), worktreePath: z15.string() }),
|
|
10609
10630
|
async (args, ctx) => {
|
|
10610
10631
|
const workspace = ctx.workspaceMgr.get(args.workspaceId);
|
|
10611
10632
|
if (!workspace) {
|
|
@@ -10617,10 +10638,10 @@ var init_worktree2 = __esm({
|
|
|
10617
10638
|
);
|
|
10618
10639
|
registerCommand(
|
|
10619
10640
|
"worktree.diff",
|
|
10620
|
-
|
|
10621
|
-
workspaceId:
|
|
10622
|
-
worktreePath:
|
|
10623
|
-
staged:
|
|
10641
|
+
z15.object({
|
|
10642
|
+
workspaceId: z15.string(),
|
|
10643
|
+
worktreePath: z15.string(),
|
|
10644
|
+
staged: z15.boolean().optional().default(false)
|
|
10624
10645
|
}),
|
|
10625
10646
|
async (args, ctx) => {
|
|
10626
10647
|
const workspace = ctx.workspaceMgr.get(args.workspaceId);
|
|
@@ -10633,7 +10654,7 @@ var init_worktree2 = __esm({
|
|
|
10633
10654
|
);
|
|
10634
10655
|
registerCommand(
|
|
10635
10656
|
"worktree.tree",
|
|
10636
|
-
|
|
10657
|
+
z15.object({ workspaceId: z15.string(), worktreePath: z15.string() }),
|
|
10637
10658
|
async (args, ctx) => {
|
|
10638
10659
|
const workspace = ctx.workspaceMgr.get(args.workspaceId);
|
|
10639
10660
|
if (!workspace) {
|
|
@@ -10645,10 +10666,10 @@ var init_worktree2 = __esm({
|
|
|
10645
10666
|
);
|
|
10646
10667
|
registerCommand(
|
|
10647
10668
|
"worktree.create",
|
|
10648
|
-
|
|
10649
|
-
workspaceId:
|
|
10650
|
-
branch:
|
|
10651
|
-
path:
|
|
10669
|
+
z15.object({
|
|
10670
|
+
workspaceId: z15.string(),
|
|
10671
|
+
branch: z15.string(),
|
|
10672
|
+
path: z15.string()
|
|
10652
10673
|
}),
|
|
10653
10674
|
async (args, ctx) => {
|
|
10654
10675
|
const workspace = ctx.workspaceMgr.get(args.workspaceId);
|
|
@@ -10663,10 +10684,10 @@ var init_worktree2 = __esm({
|
|
|
10663
10684
|
);
|
|
10664
10685
|
registerCommand(
|
|
10665
10686
|
"worktree.remove",
|
|
10666
|
-
|
|
10667
|
-
workspaceId:
|
|
10668
|
-
worktreePath:
|
|
10669
|
-
force:
|
|
10687
|
+
z15.object({
|
|
10688
|
+
workspaceId: z15.string(),
|
|
10689
|
+
worktreePath: z15.string(),
|
|
10690
|
+
force: z15.boolean().optional().default(false)
|
|
10670
10691
|
}),
|
|
10671
10692
|
async (args, ctx) => {
|
|
10672
10693
|
const workspace = ctx.workspaceMgr.get(args.workspaceId);
|
|
@@ -10690,7 +10711,7 @@ var init_worktree2 = __esm({
|
|
|
10690
10711
|
});
|
|
10691
10712
|
|
|
10692
10713
|
// packages/server/src/commands/fencing.ts
|
|
10693
|
-
import { z as
|
|
10714
|
+
import { z as z16 } from "zod";
|
|
10694
10715
|
function createMockFencingRequest() {
|
|
10695
10716
|
return {
|
|
10696
10717
|
ip: "127.0.0.1",
|
|
@@ -10703,9 +10724,9 @@ var init_fencing2 = __esm({
|
|
|
10703
10724
|
init_dispatch();
|
|
10704
10725
|
registerCommand(
|
|
10705
10726
|
"fencing.request",
|
|
10706
|
-
|
|
10707
|
-
workspaceId:
|
|
10708
|
-
tabId:
|
|
10727
|
+
z16.object({
|
|
10728
|
+
workspaceId: z16.string(),
|
|
10729
|
+
tabId: z16.string()
|
|
10709
10730
|
}),
|
|
10710
10731
|
async (args, ctx, clientId) => {
|
|
10711
10732
|
return ctx.fencingMgr.requestControl(
|
|
@@ -10718,7 +10739,7 @@ var init_fencing2 = __esm({
|
|
|
10718
10739
|
);
|
|
10719
10740
|
registerCommand(
|
|
10720
10741
|
"fencing.heartbeat",
|
|
10721
|
-
|
|
10742
|
+
z16.object({ workspaceId: z16.string() }),
|
|
10722
10743
|
async (args, ctx, clientId) => {
|
|
10723
10744
|
const success = ctx.fencingMgr.heartbeat(args.workspaceId, clientId);
|
|
10724
10745
|
return { success };
|
|
@@ -10726,13 +10747,13 @@ var init_fencing2 = __esm({
|
|
|
10726
10747
|
);
|
|
10727
10748
|
registerCommand(
|
|
10728
10749
|
"fencing.release",
|
|
10729
|
-
|
|
10750
|
+
z16.object({ workspaceId: z16.string() }),
|
|
10730
10751
|
async (args, ctx, clientId) => {
|
|
10731
10752
|
ctx.fencingMgr.release(args.workspaceId, clientId);
|
|
10732
10753
|
return {};
|
|
10733
10754
|
}
|
|
10734
10755
|
);
|
|
10735
|
-
registerCommand("fencing.status",
|
|
10756
|
+
registerCommand("fencing.status", z16.object({ workspaceId: z16.string() }), async (args, ctx) => {
|
|
10736
10757
|
const controller = ctx.fencingMgr.getController(args.workspaceId);
|
|
10737
10758
|
const isUnresponsive = ctx.fencingMgr.isControllerUnresponsive(args.workspaceId);
|
|
10738
10759
|
return {
|
|
@@ -10743,9 +10764,9 @@ var init_fencing2 = __esm({
|
|
|
10743
10764
|
});
|
|
10744
10765
|
registerCommand(
|
|
10745
10766
|
"fencing.takeover",
|
|
10746
|
-
|
|
10747
|
-
workspaceId:
|
|
10748
|
-
tabId:
|
|
10767
|
+
z16.object({
|
|
10768
|
+
workspaceId: z16.string(),
|
|
10769
|
+
tabId: z16.string()
|
|
10749
10770
|
}),
|
|
10750
10771
|
async (args, ctx, clientId) => {
|
|
10751
10772
|
return ctx.fencingMgr.forceTakeover(
|
|
@@ -10765,6 +10786,7 @@ var init_commands = __esm({
|
|
|
10765
10786
|
"use strict";
|
|
10766
10787
|
init_workspace();
|
|
10767
10788
|
init_workspace_activity();
|
|
10789
|
+
init_connection();
|
|
10768
10790
|
init_session();
|
|
10769
10791
|
init_terminal();
|
|
10770
10792
|
init_file();
|
|
@@ -10933,11 +10955,16 @@ async function createServer(configOverrides) {
|
|
|
10933
10955
|
);
|
|
10934
10956
|
}, STARTUP_GC_DELAY_MS);
|
|
10935
10957
|
gcTimer.unref();
|
|
10958
|
+
const wsKeepaliveTimer = setInterval(() => {
|
|
10959
|
+
wsHub.pingAll();
|
|
10960
|
+
}, WS_KEEPALIVE_INTERVAL_MS);
|
|
10961
|
+
wsKeepaliveTimer.unref();
|
|
10936
10962
|
let stopped = false;
|
|
10937
10963
|
const stopServer = async () => {
|
|
10938
10964
|
if (stopped) return;
|
|
10939
10965
|
stopped = true;
|
|
10940
10966
|
clearTimeout(gcTimer);
|
|
10967
|
+
clearInterval(wsKeepaliveTimer);
|
|
10941
10968
|
await app.close();
|
|
10942
10969
|
autoFetch.stop();
|
|
10943
10970
|
supervisorMgr.stop();
|
|
@@ -11053,6 +11080,7 @@ function createSessionDatabase(db) {
|
|
|
11053
11080
|
}
|
|
11054
11081
|
};
|
|
11055
11082
|
}
|
|
11083
|
+
var WS_KEEPALIVE_INTERVAL_MS;
|
|
11056
11084
|
var init_server = __esm({
|
|
11057
11085
|
async "packages/server/src/server.ts"() {
|
|
11058
11086
|
"use strict";
|
|
@@ -11085,6 +11113,7 @@ var init_server = __esm({
|
|
|
11085
11113
|
init_fencing();
|
|
11086
11114
|
init_hub();
|
|
11087
11115
|
init_commands();
|
|
11116
|
+
WS_KEEPALIVE_INTERVAL_MS = 15e3;
|
|
11088
11117
|
if (isDirectExecution(import.meta.url)) {
|
|
11089
11118
|
const server = await createServer();
|
|
11090
11119
|
process.on("SIGINT", async () => {
|