@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.
@@ -8423,8 +8423,12 @@ var init_client = __esm({
8423
8423
  evictedBytesSinceLastWarn = 0;
8424
8424
  lastStreamBufferWarnAt = 0;
8425
8425
  logger;
8426
+ markAlive() {
8427
+ this.isAlive = true;
8428
+ }
8426
8429
  setupSocketHandlers() {
8427
8430
  this.socket.on("message", (data, isBinary) => {
8431
+ this.markAlive();
8428
8432
  if (isBinary) {
8429
8433
  this.messageHandler?.(data);
8430
8434
  return;
@@ -8443,7 +8447,7 @@ var init_client = __esm({
8443
8447
  this.closeHandler?.();
8444
8448
  });
8445
8449
  this.socket.on("pong", () => {
8446
- this.isAlive = true;
8450
+ this.markAlive();
8447
8451
  });
8448
8452
  }
8449
8453
  /**
@@ -8953,6 +8957,10 @@ var init_hub = __esm({
8953
8957
  */
8954
8958
  pingAll() {
8955
8959
  for (const client of this.clients.values()) {
8960
+ if (!client.alive) {
8961
+ client.close(1011, "keepalive_timeout");
8962
+ continue;
8963
+ }
8956
8964
  client.ping();
8957
8965
  }
8958
8966
  }
@@ -9211,6 +9219,18 @@ var init_workspace_activity = __esm({
9211
9219
  }
9212
9220
  });
9213
9221
 
9222
+ // packages/server/src/commands/connection.ts
9223
+ import { z as z8 } from "zod";
9224
+ var init_connection = __esm({
9225
+ "packages/server/src/commands/connection.ts"() {
9226
+ "use strict";
9227
+ init_dispatch();
9228
+ registerCommand("connection.probe", z8.object({}).default({}), async () => {
9229
+ return { ok: true };
9230
+ });
9231
+ }
9232
+ });
9233
+
9214
9234
  // packages/server/src/provider-runtime/runtime-status.ts
9215
9235
  function canAutoInstall(provider, platform, missingCommands, missingPrerequisites, availableCommands) {
9216
9236
  const strategies = provider.install.strategies[platform] ?? [];
@@ -9305,7 +9325,7 @@ var init_runtime_status = __esm({
9305
9325
  });
9306
9326
 
9307
9327
  // packages/server/src/commands/session.ts
9308
- import { z as z8 } from "zod";
9328
+ import { z as z9 } from "zod";
9309
9329
  function getProviderFromRegistry(providerId, registry) {
9310
9330
  return registry.find((provider) => provider.id === providerId);
9311
9331
  }
@@ -9316,8 +9336,8 @@ var init_session = __esm({
9316
9336
  init_dispatch();
9317
9337
  registerCommand(
9318
9338
  "session.list",
9319
- z8.object({
9320
- workspaceId: z8.string()
9339
+ z9.object({
9340
+ workspaceId: z9.string()
9321
9341
  }),
9322
9342
  async (args, ctx) => {
9323
9343
  return ctx.sessionMgr.getForWorkspace(args.workspaceId);
@@ -9325,10 +9345,10 @@ var init_session = __esm({
9325
9345
  );
9326
9346
  registerCommand(
9327
9347
  "session.create",
9328
- z8.object({
9329
- workspaceId: z8.string(),
9330
- providerId: z8.string(),
9331
- draft: z8.string().optional()
9348
+ z9.object({
9349
+ workspaceId: z9.string(),
9350
+ providerId: z9.string(),
9351
+ draft: z9.string().optional()
9332
9352
  }),
9333
9353
  async (args, ctx) => {
9334
9354
  const workspace = ctx.workspaceMgr.get(args.workspaceId);
@@ -9362,8 +9382,8 @@ var init_session = __esm({
9362
9382
  );
9363
9383
  registerCommand(
9364
9384
  "session.stop",
9365
- z8.object({
9366
- sessionId: z8.string()
9385
+ z9.object({
9386
+ sessionId: z9.string()
9367
9387
  }),
9368
9388
  async (args, ctx) => {
9369
9389
  await ctx.sessionMgr.stop(args.sessionId);
@@ -9371,8 +9391,8 @@ var init_session = __esm({
9371
9391
  );
9372
9392
  registerCommand(
9373
9393
  "session.remove",
9374
- z8.object({
9375
- sessionId: z8.string()
9394
+ z9.object({
9395
+ sessionId: z9.string()
9376
9396
  }),
9377
9397
  async (args, ctx) => {
9378
9398
  const session = ctx.sessionMgr.get(args.sessionId);
@@ -9537,7 +9557,7 @@ var init_tree = __esm({
9537
9557
  });
9538
9558
 
9539
9559
  // packages/server/src/commands/file.ts
9540
- import { z as z9 } from "zod";
9560
+ import { z as z10 } from "zod";
9541
9561
  var init_file = __esm({
9542
9562
  "packages/server/src/commands/file.ts"() {
9543
9563
  "use strict";
@@ -9546,9 +9566,9 @@ var init_file = __esm({
9546
9566
  init_dispatch();
9547
9567
  registerCommand(
9548
9568
  "file.readTree",
9549
- z9.object({
9550
- workspaceId: z9.string(),
9551
- subPath: z9.string().optional()
9569
+ z10.object({
9570
+ workspaceId: z10.string(),
9571
+ subPath: z10.string().optional()
9552
9572
  }),
9553
9573
  async (args, ctx) => {
9554
9574
  const workspace = ctx.workspaceMgr.get(args.workspaceId);
@@ -9560,10 +9580,10 @@ var init_file = __esm({
9560
9580
  );
9561
9581
  registerCommand(
9562
9582
  "file.search",
9563
- z9.object({
9564
- workspaceId: z9.string(),
9565
- query: z9.string(),
9566
- limit: z9.number().int().positive().max(50).optional()
9583
+ z10.object({
9584
+ workspaceId: z10.string(),
9585
+ query: z10.string(),
9586
+ limit: z10.number().int().positive().max(50).optional()
9567
9587
  }),
9568
9588
  async (args, ctx) => {
9569
9589
  const workspace = ctx.workspaceMgr.get(args.workspaceId);
@@ -9575,9 +9595,9 @@ var init_file = __esm({
9575
9595
  );
9576
9596
  registerCommand(
9577
9597
  "file.read",
9578
- z9.object({
9579
- workspaceId: z9.string(),
9580
- path: z9.string()
9598
+ z10.object({
9599
+ workspaceId: z10.string(),
9600
+ path: z10.string()
9581
9601
  }),
9582
9602
  async (args, ctx) => {
9583
9603
  const workspace = ctx.workspaceMgr.get(args.workspaceId);
@@ -9589,9 +9609,9 @@ var init_file = __esm({
9589
9609
  );
9590
9610
  registerCommand(
9591
9611
  "file.create",
9592
- z9.object({
9593
- workspaceId: z9.string(),
9594
- path: z9.string()
9612
+ z10.object({
9613
+ workspaceId: z10.string(),
9614
+ path: z10.string()
9595
9615
  }),
9596
9616
  async (args, ctx) => {
9597
9617
  const workspace = ctx.workspaceMgr.get(args.workspaceId);
@@ -9609,9 +9629,9 @@ var init_file = __esm({
9609
9629
  );
9610
9630
  registerCommand(
9611
9631
  "file.mkdir",
9612
- z9.object({
9613
- workspaceId: z9.string(),
9614
- path: z9.string()
9632
+ z10.object({
9633
+ workspaceId: z10.string(),
9634
+ path: z10.string()
9615
9635
  }),
9616
9636
  async (args, ctx) => {
9617
9637
  const workspace = ctx.workspaceMgr.get(args.workspaceId);
@@ -9629,9 +9649,9 @@ var init_file = __esm({
9629
9649
  );
9630
9650
  registerCommand(
9631
9651
  "file.delete",
9632
- z9.object({
9633
- workspaceId: z9.string(),
9634
- path: z9.string()
9652
+ z10.object({
9653
+ workspaceId: z10.string(),
9654
+ path: z10.string()
9635
9655
  }),
9636
9656
  async (args, ctx) => {
9637
9657
  const workspace = ctx.workspaceMgr.get(args.workspaceId);
@@ -9649,11 +9669,11 @@ var init_file = __esm({
9649
9669
  );
9650
9670
  registerCommand(
9651
9671
  "file.write",
9652
- z9.object({
9653
- workspaceId: z9.string(),
9654
- path: z9.string(),
9655
- content: z9.string(),
9656
- baseHash: z9.string().optional()
9672
+ z10.object({
9673
+ workspaceId: z10.string(),
9674
+ path: z10.string(),
9675
+ content: z10.string(),
9676
+ baseHash: z10.string().optional()
9657
9677
  // For conflict detection
9658
9678
  }),
9659
9679
  async (args, ctx) => {
@@ -9744,7 +9764,7 @@ var init_git_events = __esm({
9744
9764
  });
9745
9765
 
9746
9766
  // packages/server/src/commands/git.ts
9747
- import { z as z10 } from "zod";
9767
+ import { z as z11 } from "zod";
9748
9768
  async function runGitNetworkOperation(ctx, workspaceId, op) {
9749
9769
  if (!ctx.autoFetch?.runExclusive) {
9750
9770
  return op();
@@ -9759,16 +9779,16 @@ var init_git2 = __esm({
9759
9779
  init_diff();
9760
9780
  init_dispatch();
9761
9781
  init_git_events();
9762
- gitHttpAuthSchema = z10.object({
9763
- username: z10.string(),
9764
- password: z10.string()
9782
+ gitHttpAuthSchema = z11.object({
9783
+ username: z11.string(),
9784
+ password: z11.string()
9765
9785
  });
9766
- gitCommitRevisionSchema = z10.string().regex(/^[0-9a-fA-F]{7,64}$/, "Invalid git commit revision");
9786
+ gitCommitRevisionSchema = z11.string().regex(/^[0-9a-fA-F]{7,64}$/, "Invalid git commit revision");
9767
9787
  GIT_BACKGROUND_FETCH_TIMEOUT_MS = 30 * 1e3;
9768
9788
  registerCommand(
9769
9789
  "git.status",
9770
- z10.object({
9771
- workspaceId: z10.string()
9790
+ z11.object({
9791
+ workspaceId: z11.string()
9772
9792
  }),
9773
9793
  async (args, ctx) => {
9774
9794
  const workspace = ctx.workspaceMgr.get(args.workspaceId);
@@ -9780,9 +9800,9 @@ var init_git2 = __esm({
9780
9800
  );
9781
9801
  registerCommand(
9782
9802
  "git.stage",
9783
- z10.object({
9784
- workspaceId: z10.string(),
9785
- paths: z10.array(z10.string())
9803
+ z11.object({
9804
+ workspaceId: z11.string(),
9805
+ paths: z11.array(z11.string())
9786
9806
  }),
9787
9807
  async (args, ctx) => {
9788
9808
  const workspace = ctx.workspaceMgr.get(args.workspaceId);
@@ -9796,10 +9816,10 @@ var init_git2 = __esm({
9796
9816
  );
9797
9817
  registerCommand(
9798
9818
  "git.diff",
9799
- z10.object({
9800
- workspaceId: z10.string(),
9801
- path: z10.string(),
9802
- staged: z10.boolean().optional()
9819
+ z11.object({
9820
+ workspaceId: z11.string(),
9821
+ path: z11.string(),
9822
+ staged: z11.boolean().optional()
9803
9823
  }),
9804
9824
  async (args, ctx) => {
9805
9825
  const workspace = ctx.workspaceMgr.get(args.workspaceId);
@@ -9813,9 +9833,9 @@ var init_git2 = __esm({
9813
9833
  );
9814
9834
  registerCommand(
9815
9835
  "git.log",
9816
- z10.object({
9817
- workspaceId: z10.string(),
9818
- limit: z10.number().int().min(1).max(50).optional()
9836
+ z11.object({
9837
+ workspaceId: z11.string(),
9838
+ limit: z11.number().int().min(1).max(50).optional()
9819
9839
  }),
9820
9840
  async (args, ctx) => {
9821
9841
  const workspace = ctx.workspaceMgr.get(args.workspaceId);
@@ -9829,8 +9849,8 @@ var init_git2 = __esm({
9829
9849
  );
9830
9850
  registerCommand(
9831
9851
  "git.show",
9832
- z10.object({
9833
- workspaceId: z10.string(),
9852
+ z11.object({
9853
+ workspaceId: z11.string(),
9834
9854
  sha: gitCommitRevisionSchema
9835
9855
  }),
9836
9856
  async (args, ctx) => {
@@ -9845,9 +9865,9 @@ var init_git2 = __esm({
9845
9865
  );
9846
9866
  registerCommand(
9847
9867
  "git.unstage",
9848
- z10.object({
9849
- workspaceId: z10.string(),
9850
- paths: z10.array(z10.string())
9868
+ z11.object({
9869
+ workspaceId: z11.string(),
9870
+ paths: z11.array(z11.string())
9851
9871
  }),
9852
9872
  async (args, ctx) => {
9853
9873
  const workspace = ctx.workspaceMgr.get(args.workspaceId);
@@ -9861,9 +9881,9 @@ var init_git2 = __esm({
9861
9881
  );
9862
9882
  registerCommand(
9863
9883
  "git.discard",
9864
- z10.object({
9865
- workspaceId: z10.string(),
9866
- paths: z10.array(z10.string())
9884
+ z11.object({
9885
+ workspaceId: z11.string(),
9886
+ paths: z11.array(z11.string())
9867
9887
  }),
9868
9888
  async (args, ctx) => {
9869
9889
  const workspace = ctx.workspaceMgr.get(args.workspaceId);
@@ -9879,9 +9899,9 @@ var init_git2 = __esm({
9879
9899
  );
9880
9900
  registerCommand(
9881
9901
  "git.commit",
9882
- z10.object({
9883
- workspaceId: z10.string(),
9884
- message: z10.string()
9902
+ z11.object({
9903
+ workspaceId: z11.string(),
9904
+ message: z11.string()
9885
9905
  }),
9886
9906
  async (args, ctx) => {
9887
9907
  const workspace = ctx.workspaceMgr.get(args.workspaceId);
@@ -9898,11 +9918,11 @@ var init_git2 = __esm({
9898
9918
  );
9899
9919
  registerCommand(
9900
9920
  "git.push",
9901
- z10.object({
9902
- workspaceId: z10.string(),
9903
- remote: z10.string().optional(),
9904
- branch: z10.string().optional(),
9905
- force: z10.boolean().optional(),
9921
+ z11.object({
9922
+ workspaceId: z11.string(),
9923
+ remote: z11.string().optional(),
9924
+ branch: z11.string().optional(),
9925
+ force: z11.boolean().optional(),
9906
9926
  auth: gitHttpAuthSchema.optional()
9907
9927
  }),
9908
9928
  async (args, ctx) => {
@@ -9929,10 +9949,10 @@ var init_git2 = __esm({
9929
9949
  );
9930
9950
  registerCommand(
9931
9951
  "git.pull",
9932
- z10.object({
9933
- workspaceId: z10.string(),
9934
- remote: z10.string().optional(),
9935
- branch: z10.string().optional(),
9952
+ z11.object({
9953
+ workspaceId: z11.string(),
9954
+ remote: z11.string().optional(),
9955
+ branch: z11.string().optional(),
9936
9956
  auth: gitHttpAuthSchema.optional()
9937
9957
  }),
9938
9958
  async (args, ctx) => {
@@ -9960,12 +9980,12 @@ var init_git2 = __esm({
9960
9980
  );
9961
9981
  registerCommand(
9962
9982
  "git.fetch",
9963
- z10.object({
9964
- workspaceId: z10.string(),
9965
- remote: z10.string().optional(),
9966
- prune: z10.boolean().optional(),
9983
+ z11.object({
9984
+ workspaceId: z11.string(),
9985
+ remote: z11.string().optional(),
9986
+ prune: z11.boolean().optional(),
9967
9987
  auth: gitHttpAuthSchema.optional(),
9968
- background: z10.boolean().optional()
9988
+ background: z11.boolean().optional()
9969
9989
  }),
9970
9990
  async (args, ctx, clientId) => {
9971
9991
  const workspace = ctx.workspaceMgr.get(args.workspaceId);
@@ -9994,10 +10014,10 @@ var init_git2 = __esm({
9994
10014
  );
9995
10015
  registerCommand(
9996
10016
  "git.checkout",
9997
- z10.object({
9998
- workspaceId: z10.string(),
9999
- ref: z10.string(),
10000
- createBranch: z10.boolean().optional()
10017
+ z11.object({
10018
+ workspaceId: z11.string(),
10019
+ ref: z11.string(),
10020
+ createBranch: z11.boolean().optional()
10001
10021
  }),
10002
10022
  async (args, ctx) => {
10003
10023
  const workspace = ctx.workspaceMgr.get(args.workspaceId);
@@ -10019,10 +10039,10 @@ var init_git2 = __esm({
10019
10039
  );
10020
10040
  registerCommand(
10021
10041
  "git.branch",
10022
- z10.object({
10023
- workspaceId: z10.string(),
10024
- name: z10.string(),
10025
- startPoint: z10.string().optional()
10042
+ z11.object({
10043
+ workspaceId: z11.string(),
10044
+ name: z11.string(),
10045
+ startPoint: z11.string().optional()
10026
10046
  }),
10027
10047
  async (args, ctx) => {
10028
10048
  const workspace = ctx.workspaceMgr.get(args.workspaceId);
@@ -10041,8 +10061,8 @@ var init_git2 = __esm({
10041
10061
  );
10042
10062
  registerCommand(
10043
10063
  "git.branches",
10044
- z10.object({
10045
- workspaceId: z10.string()
10064
+ z11.object({
10065
+ workspaceId: z11.string()
10046
10066
  }),
10047
10067
  async (args, ctx) => {
10048
10068
  const workspace = ctx.workspaceMgr.get(args.workspaceId);
@@ -10136,7 +10156,7 @@ var init_config_io = __esm({
10136
10156
  });
10137
10157
 
10138
10158
  // packages/server/src/commands/settings.ts
10139
- import { z as z11 } from "zod";
10159
+ import { z as z12 } from "zod";
10140
10160
  function flattenSettings(obj, prefix = "") {
10141
10161
  const result = {};
10142
10162
  for (const [key, value] of Object.entries(obj)) {
@@ -10159,27 +10179,28 @@ var init_settings2 = __esm({
10159
10179
  init_provider_config_repo();
10160
10180
  init_settings();
10161
10181
  init_dispatch();
10162
- SettingsSchema = z11.object({
10163
- defaultProviderId: z11.string().optional(),
10164
- notifications: z11.object({
10165
- enabled: z11.boolean().optional(),
10166
- soundEnabled: z11.boolean().optional(),
10182
+ SettingsSchema = z12.object({
10183
+ defaultProviderId: z12.string().optional(),
10184
+ notifications: z12.object({
10185
+ enabled: z12.boolean().optional(),
10186
+ soundEnabled: z12.boolean().optional(),
10167
10187
  // Legacy field — accepted for backward compat with older clients but
10168
10188
  // no longer surfaced in the UI. The web client now picks the channel
10169
10189
  // automatically based on workspace focus + page visibility.
10170
- onlyWhenBackgrounded: z11.boolean().optional()
10190
+ onlyWhenBackgrounded: z12.boolean().optional()
10171
10191
  }).optional(),
10172
- supervisor: z11.object({
10173
- evaluationTimeoutSec: z11.number().int().min(1).max(MAX_SUPERVISOR_EVALUATION_TIMEOUT_SEC).default(DEFAULT_SUPERVISOR_EVALUATION_TIMEOUT_SEC).optional()
10192
+ supervisor: z12.object({
10193
+ evaluationTimeoutSec: z12.number().int().min(1).max(MAX_SUPERVISOR_EVALUATION_TIMEOUT_SEC).default(DEFAULT_SUPERVISOR_EVALUATION_TIMEOUT_SEC).optional()
10174
10194
  }).optional(),
10175
- appearance: z11.object({
10176
- theme: z11.enum(["dark"]).optional(),
10177
- terminalRenderer: z11.enum(["standard", "compatibility"]).optional(),
10178
- locale: z11.enum(["zh", "en"]).optional()
10195
+ appearance: z12.object({
10196
+ theme: z12.enum(["dark"]).optional(),
10197
+ terminalRenderer: z12.enum(["standard", "compatibility"]).optional(),
10198
+ terminalCopyOnSelect: z12.boolean().optional(),
10199
+ locale: z12.enum(["zh", "en"]).optional()
10179
10200
  }).optional(),
10180
10201
  providers: ProviderSettingsSchema.optional()
10181
10202
  });
10182
- registerCommand("settings.get", z11.object({}), async (_args, ctx) => {
10203
+ registerCommand("settings.get", z12.object({}), async (_args, ctx) => {
10183
10204
  const row = ctx.db.prepare("SELECT key, value FROM user_settings").all();
10184
10205
  const settings = {};
10185
10206
  for (const { key, value } of row) {
@@ -10212,7 +10233,7 @@ var init_settings2 = __esm({
10212
10233
  });
10213
10234
  registerCommand(
10214
10235
  "settings.update",
10215
- z11.object({
10236
+ z12.object({
10216
10237
  settings: SettingsSchema
10217
10238
  }),
10218
10239
  async (args, ctx) => {
@@ -10244,10 +10265,10 @@ var init_settings2 = __esm({
10244
10265
  );
10245
10266
  registerCommand(
10246
10267
  "settings.previewCommand",
10247
- z11.object({
10248
- providerId: z11.string(),
10268
+ z12.object({
10269
+ providerId: z12.string(),
10249
10270
  config: ProviderLaunchConfigInputSchema,
10250
- workspacePath: z11.string().optional()
10271
+ workspacePath: z12.string().optional()
10251
10272
  }),
10252
10273
  async (args, ctx) => {
10253
10274
  const provider = ctx.providerRegistry.find((item) => item.id === args.providerId);
@@ -10268,8 +10289,8 @@ var init_settings2 = __esm({
10268
10289
  );
10269
10290
  registerCommand(
10270
10291
  "settings.readConfigFile",
10271
- z11.object({
10272
- configType: z11.enum(["codex", "claude"])
10292
+ z12.object({
10293
+ configType: z12.enum(["codex", "claude"])
10273
10294
  }),
10274
10295
  async (args) => {
10275
10296
  const result = readConfigFile(args.configType);
@@ -10278,9 +10299,9 @@ var init_settings2 = __esm({
10278
10299
  );
10279
10300
  registerCommand(
10280
10301
  "settings.writeConfigFile",
10281
- z11.object({
10282
- configType: z11.enum(["codex", "claude"]),
10283
- content: z11.string()
10302
+ z12.object({
10303
+ configType: z12.enum(["codex", "claude"]),
10304
+ content: z12.string()
10284
10305
  }),
10285
10306
  async (args) => {
10286
10307
  const result = writeConfigFile(args.configType, args.content);
@@ -10291,19 +10312,19 @@ var init_settings2 = __esm({
10291
10312
  });
10292
10313
 
10293
10314
  // packages/server/src/commands/provider.ts
10294
- import { z as z12 } from "zod";
10315
+ import { z as z13 } from "zod";
10295
10316
  var init_provider = __esm({
10296
10317
  "packages/server/src/commands/provider.ts"() {
10297
10318
  "use strict";
10298
10319
  init_runtime_status();
10299
10320
  init_dispatch();
10300
- registerCommand("provider.runtimeStatus", z12.object({}), async (_args, ctx) => {
10321
+ registerCommand("provider.runtimeStatus", z13.object({}), async (_args, ctx) => {
10301
10322
  return buildProviderRuntimeStatus(ctx.providerRegistry, ctx.providerRuntimeDeps);
10302
10323
  });
10303
10324
  registerCommand(
10304
10325
  "provider.install.start",
10305
- z12.object({
10306
- providerId: z12.string()
10326
+ z13.object({
10327
+ providerId: z13.string()
10307
10328
  }),
10308
10329
  async (args, ctx) => {
10309
10330
  if (!ctx.providerInstallMgr) {
@@ -10317,8 +10338,8 @@ var init_provider = __esm({
10317
10338
  );
10318
10339
  registerCommand(
10319
10340
  "provider.install.get",
10320
- z12.object({
10321
- jobId: z12.string()
10341
+ z13.object({
10342
+ jobId: z13.string()
10322
10343
  }),
10323
10344
  async (args, ctx) => {
10324
10345
  if (!ctx.providerInstallMgr) {
@@ -10341,29 +10362,29 @@ var init_provider = __esm({
10341
10362
  });
10342
10363
 
10343
10364
  // packages/server/src/commands/supervisor.ts
10344
- import { z as z13 } from "zod";
10365
+ import { z as z14 } from "zod";
10345
10366
  var supervisorObjectiveSchema, createSupervisorSchema, updateSupervisorSchema, sessionIdSchema, supervisorIdSchema;
10346
10367
  var init_supervisor2 = __esm({
10347
10368
  "packages/server/src/commands/supervisor.ts"() {
10348
10369
  "use strict";
10349
10370
  init_dispatch();
10350
- supervisorObjectiveSchema = z13.string().trim().min(1).max(4e3);
10351
- createSupervisorSchema = z13.object({
10352
- sessionId: z13.string(),
10353
- workspaceId: z13.string(),
10371
+ supervisorObjectiveSchema = z14.string().trim().min(1).max(4e3);
10372
+ createSupervisorSchema = z14.object({
10373
+ sessionId: z14.string(),
10374
+ workspaceId: z14.string(),
10354
10375
  objective: supervisorObjectiveSchema,
10355
- evaluatorProviderId: z13.string()
10376
+ evaluatorProviderId: z14.string()
10356
10377
  }).strict();
10357
- updateSupervisorSchema = z13.object({
10358
- id: z13.string(),
10378
+ updateSupervisorSchema = z14.object({
10379
+ id: z14.string(),
10359
10380
  objective: supervisorObjectiveSchema.optional(),
10360
- evaluatorProviderId: z13.string().optional()
10381
+ evaluatorProviderId: z14.string().optional()
10361
10382
  }).strict().refine(
10362
10383
  (input) => input.objective !== void 0 || input.evaluatorProviderId !== void 0,
10363
10384
  "objective or evaluatorProviderId is required"
10364
10385
  );
10365
- sessionIdSchema = z13.object({ sessionId: z13.string() });
10366
- supervisorIdSchema = z13.object({ id: z13.string() });
10386
+ sessionIdSchema = z14.object({ sessionId: z14.string() });
10387
+ supervisorIdSchema = z14.object({ id: z14.string() });
10367
10388
  registerCommand("supervisor.create", createSupervisorSchema, async (args, ctx) => {
10368
10389
  return {
10369
10390
  supervisor: await ctx.supervisorMgr.create({
@@ -10541,7 +10562,7 @@ var init_worktree = __esm({
10541
10562
 
10542
10563
  // packages/server/src/commands/worktree.ts
10543
10564
  import path9 from "node:path";
10544
- import { z as z14 } from "zod";
10565
+ import { z as z15 } from "zod";
10545
10566
  async function findRelatedWorkspaceIds(ctx, workspacePath) {
10546
10567
  const targetCommonDir = await getGitCommonDirPath(workspacePath);
10547
10568
  const relatedWorkspaceIds = await Promise.all(
@@ -10574,7 +10595,7 @@ var init_worktree2 = __esm({
10574
10595
  init_worktree();
10575
10596
  init_dispatch();
10576
10597
  init_git_events();
10577
- registerCommand("worktree.list", z14.object({ workspaceId: z14.string() }), async (args, ctx) => {
10598
+ registerCommand("worktree.list", z15.object({ workspaceId: z15.string() }), async (args, ctx) => {
10578
10599
  const workspace = ctx.workspaceMgr.get(args.workspaceId);
10579
10600
  if (!workspace) {
10580
10601
  throw { code: "workspace_not_found", message: `Workspace not found: ${args.workspaceId}` };
@@ -10583,7 +10604,7 @@ var init_worktree2 = __esm({
10583
10604
  });
10584
10605
  registerCommand(
10585
10606
  "worktree.status",
10586
- z14.object({ workspaceId: z14.string(), worktreePath: z14.string() }),
10607
+ z15.object({ workspaceId: z15.string(), worktreePath: z15.string() }),
10587
10608
  async (args, ctx) => {
10588
10609
  const workspace = ctx.workspaceMgr.get(args.workspaceId);
10589
10610
  if (!workspace) {
@@ -10595,10 +10616,10 @@ var init_worktree2 = __esm({
10595
10616
  );
10596
10617
  registerCommand(
10597
10618
  "worktree.diff",
10598
- z14.object({
10599
- workspaceId: z14.string(),
10600
- worktreePath: z14.string(),
10601
- staged: z14.boolean().optional().default(false)
10619
+ z15.object({
10620
+ workspaceId: z15.string(),
10621
+ worktreePath: z15.string(),
10622
+ staged: z15.boolean().optional().default(false)
10602
10623
  }),
10603
10624
  async (args, ctx) => {
10604
10625
  const workspace = ctx.workspaceMgr.get(args.workspaceId);
@@ -10611,7 +10632,7 @@ var init_worktree2 = __esm({
10611
10632
  );
10612
10633
  registerCommand(
10613
10634
  "worktree.tree",
10614
- z14.object({ workspaceId: z14.string(), worktreePath: z14.string() }),
10635
+ z15.object({ workspaceId: z15.string(), worktreePath: z15.string() }),
10615
10636
  async (args, ctx) => {
10616
10637
  const workspace = ctx.workspaceMgr.get(args.workspaceId);
10617
10638
  if (!workspace) {
@@ -10623,10 +10644,10 @@ var init_worktree2 = __esm({
10623
10644
  );
10624
10645
  registerCommand(
10625
10646
  "worktree.create",
10626
- z14.object({
10627
- workspaceId: z14.string(),
10628
- branch: z14.string(),
10629
- path: z14.string()
10647
+ z15.object({
10648
+ workspaceId: z15.string(),
10649
+ branch: z15.string(),
10650
+ path: z15.string()
10630
10651
  }),
10631
10652
  async (args, ctx) => {
10632
10653
  const workspace = ctx.workspaceMgr.get(args.workspaceId);
@@ -10641,10 +10662,10 @@ var init_worktree2 = __esm({
10641
10662
  );
10642
10663
  registerCommand(
10643
10664
  "worktree.remove",
10644
- z14.object({
10645
- workspaceId: z14.string(),
10646
- worktreePath: z14.string(),
10647
- force: z14.boolean().optional().default(false)
10665
+ z15.object({
10666
+ workspaceId: z15.string(),
10667
+ worktreePath: z15.string(),
10668
+ force: z15.boolean().optional().default(false)
10648
10669
  }),
10649
10670
  async (args, ctx) => {
10650
10671
  const workspace = ctx.workspaceMgr.get(args.workspaceId);
@@ -10668,7 +10689,7 @@ var init_worktree2 = __esm({
10668
10689
  });
10669
10690
 
10670
10691
  // packages/server/src/commands/fencing.ts
10671
- import { z as z15 } from "zod";
10692
+ import { z as z16 } from "zod";
10672
10693
  function createMockFencingRequest() {
10673
10694
  return {
10674
10695
  ip: "127.0.0.1",
@@ -10681,9 +10702,9 @@ var init_fencing2 = __esm({
10681
10702
  init_dispatch();
10682
10703
  registerCommand(
10683
10704
  "fencing.request",
10684
- z15.object({
10685
- workspaceId: z15.string(),
10686
- tabId: z15.string()
10705
+ z16.object({
10706
+ workspaceId: z16.string(),
10707
+ tabId: z16.string()
10687
10708
  }),
10688
10709
  async (args, ctx, clientId) => {
10689
10710
  return ctx.fencingMgr.requestControl(
@@ -10696,7 +10717,7 @@ var init_fencing2 = __esm({
10696
10717
  );
10697
10718
  registerCommand(
10698
10719
  "fencing.heartbeat",
10699
- z15.object({ workspaceId: z15.string() }),
10720
+ z16.object({ workspaceId: z16.string() }),
10700
10721
  async (args, ctx, clientId) => {
10701
10722
  const success = ctx.fencingMgr.heartbeat(args.workspaceId, clientId);
10702
10723
  return { success };
@@ -10704,13 +10725,13 @@ var init_fencing2 = __esm({
10704
10725
  );
10705
10726
  registerCommand(
10706
10727
  "fencing.release",
10707
- z15.object({ workspaceId: z15.string() }),
10728
+ z16.object({ workspaceId: z16.string() }),
10708
10729
  async (args, ctx, clientId) => {
10709
10730
  ctx.fencingMgr.release(args.workspaceId, clientId);
10710
10731
  return {};
10711
10732
  }
10712
10733
  );
10713
- registerCommand("fencing.status", z15.object({ workspaceId: z15.string() }), async (args, ctx) => {
10734
+ registerCommand("fencing.status", z16.object({ workspaceId: z16.string() }), async (args, ctx) => {
10714
10735
  const controller = ctx.fencingMgr.getController(args.workspaceId);
10715
10736
  const isUnresponsive = ctx.fencingMgr.isControllerUnresponsive(args.workspaceId);
10716
10737
  return {
@@ -10721,9 +10742,9 @@ var init_fencing2 = __esm({
10721
10742
  });
10722
10743
  registerCommand(
10723
10744
  "fencing.takeover",
10724
- z15.object({
10725
- workspaceId: z15.string(),
10726
- tabId: z15.string()
10745
+ z16.object({
10746
+ workspaceId: z16.string(),
10747
+ tabId: z16.string()
10727
10748
  }),
10728
10749
  async (args, ctx, clientId) => {
10729
10750
  return ctx.fencingMgr.forceTakeover(
@@ -10743,6 +10764,7 @@ var init_commands = __esm({
10743
10764
  "use strict";
10744
10765
  init_workspace();
10745
10766
  init_workspace_activity();
10767
+ init_connection();
10746
10768
  init_session();
10747
10769
  init_terminal();
10748
10770
  init_file();
@@ -10911,11 +10933,16 @@ async function createServer(configOverrides) {
10911
10933
  );
10912
10934
  }, STARTUP_GC_DELAY_MS);
10913
10935
  gcTimer.unref();
10936
+ const wsKeepaliveTimer = setInterval(() => {
10937
+ wsHub.pingAll();
10938
+ }, WS_KEEPALIVE_INTERVAL_MS);
10939
+ wsKeepaliveTimer.unref();
10914
10940
  let stopped = false;
10915
10941
  const stopServer = async () => {
10916
10942
  if (stopped) return;
10917
10943
  stopped = true;
10918
10944
  clearTimeout(gcTimer);
10945
+ clearInterval(wsKeepaliveTimer);
10919
10946
  await app.close();
10920
10947
  autoFetch.stop();
10921
10948
  supervisorMgr.stop();
@@ -11031,6 +11058,7 @@ function createSessionDatabase(db) {
11031
11058
  }
11032
11059
  };
11033
11060
  }
11061
+ var WS_KEEPALIVE_INTERVAL_MS;
11034
11062
  var init_server = __esm({
11035
11063
  async "packages/server/src/server.ts"() {
11036
11064
  "use strict";
@@ -11063,6 +11091,7 @@ var init_server = __esm({
11063
11091
  init_fencing();
11064
11092
  init_hub();
11065
11093
  init_commands();
11094
+ WS_KEEPALIVE_INTERVAL_MS = 15e3;
11066
11095
  if (isDirectExecution(import.meta.url)) {
11067
11096
  const server = await createServer();
11068
11097
  process.on("SIGINT", async () => {