@koed-labs/server 0.10.3 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (56) hide show
  1. package/README.md +3 -3
  2. package/bin/koed.js +1 -1
  3. package/package.json +2 -2
  4. package/vendor/chunk-273NMYXE.js +605 -0
  5. package/vendor/{chunk-VPC5NLZG.js → chunk-4DHYSJJT.js} +1 -1
  6. package/vendor/{chunk-HK2H3MVE.js → chunk-53ZFCDHP.js} +4 -0
  7. package/vendor/{chunk-YCDEMYY6.js → chunk-54UL4U2E.js} +261 -110
  8. package/vendor/{chunk-X6M525ZJ.js → chunk-64AST7WZ.js} +5 -5
  9. package/vendor/{chunk-JKOG52PE.js → chunk-7FSHVVTZ.js} +1 -1
  10. package/vendor/chunk-7HLNJ2BI.js +1669 -0
  11. package/vendor/chunk-ALJUSOF7.js +175 -0
  12. package/vendor/{chunk-A6WMU2GG.js → chunk-AOZ3LMTF.js} +5 -4
  13. package/vendor/{chunk-KUIWH33N.js → chunk-AVQCUFYQ.js} +1 -1
  14. package/vendor/{chunk-JJNLH5GA.js → chunk-BYN6KXNP.js} +21 -19
  15. package/vendor/{chunk-PY5LYLV7.js → chunk-DWWMBGHX.js} +26 -21
  16. package/vendor/chunk-E6YVGIEW.js +12518 -0
  17. package/vendor/{chunk-C3N4N5HR.js → chunk-EEBIYWTE.js} +26 -21
  18. package/vendor/{chunk-YOFI4PCH.js → chunk-F77ZTTNS.js} +7 -1
  19. package/vendor/{chunk-RVYJKKWA.js → chunk-F7AMEDDU.js} +5 -4
  20. package/vendor/{chunk-473OA62O.js → chunk-FSNLU46W.js} +218 -12497
  21. package/vendor/{chunk-2S3OGPUC.js → chunk-GY5GATZL.js} +2 -2
  22. package/vendor/chunk-ILQVLZ2I.js +50 -0
  23. package/vendor/{chunk-QIIKMG3M.js → chunk-IY2HRXOZ.js} +1 -5
  24. package/vendor/{chunk-ZUGNCQZE.js → chunk-JYK6UL6D.js} +22 -8
  25. package/vendor/chunk-KG3RANR4.js +75 -0
  26. package/vendor/{chunk-YJ6XUZT6.js → chunk-KRBZZ6GS.js} +23 -16
  27. package/vendor/{chunk-AFLKCQHF.js → chunk-L4RD3TAZ.js} +2 -2
  28. package/vendor/{chunk-XNFVSVBS.js → chunk-LHUMBHG7.js} +1 -1
  29. package/vendor/{chunk-J2L726BC.js → chunk-NGV45YWB.js} +3 -3
  30. package/vendor/{chunk-A4NKL2PK.js → chunk-OG7G6DIR.js} +1 -1
  31. package/vendor/{chunk-DXTAWHY3.js → chunk-OZU6JFB4.js} +8 -7
  32. package/vendor/chunk-QV3WPU7A.js +8 -0
  33. package/vendor/{chunk-ZXX4ZNJY.js → chunk-S6HD3MDU.js} +3 -2
  34. package/vendor/{chunk-NEWIOOM6.js → chunk-SQZ2OSP6.js} +3 -2
  35. package/vendor/{chunk-G4IIVVJO.js → chunk-T6UB5PNX.js} +70 -2
  36. package/vendor/{chunk-SKVYP7NY.js → chunk-T7OGE5E5.js} +8 -8
  37. package/vendor/{chunk-GELDEJJ2.js → chunk-TIBYKMRW.js} +173 -51
  38. package/vendor/{chunk-HFM6ROJL.js → chunk-TISYUUEJ.js} +1 -1
  39. package/vendor/{chunk-K2EIFEQF.js → chunk-TSAYTRX3.js} +1 -1
  40. package/vendor/{chunk-PT3AUPGE.js → chunk-UB6JCVQ3.js} +3 -1
  41. package/vendor/{chunk-NM5NXCVM.js → chunk-UCOHFZ77.js} +626 -996
  42. package/vendor/{chunk-2BWTLF7A.js → chunk-UIMUUIH7.js} +45 -21
  43. package/vendor/{chunk-HZJK5RWC.js → chunk-USHFSJT7.js} +695 -280
  44. package/vendor/chunk-VGL5AZN5.js +152 -0
  45. package/vendor/{chunk-TSRPHKAC.js → chunk-VLP72QWX.js} +16 -42
  46. package/vendor/chunk-W6632NOX.js +14 -0
  47. package/vendor/{chunk-YJWREXN6.js → chunk-WBMO7YCO.js} +1 -1
  48. package/vendor/chunk-XCO3RV3Z.js +11 -0
  49. package/vendor/chunk-XKXSC6YS.js +373 -0
  50. package/vendor/{chunk-YK4F4VY2.js → chunk-Y6GE52OP.js} +51 -30
  51. package/vendor/{chunk-UI5RLBKQ.js → chunk-YZLQZU5E.js} +17 -1
  52. package/vendor/chunk-ZKKWLLPU.js +18 -0
  53. package/vendor/cli.js +1 -1
  54. package/vendor/component-manifest-catalog.js +2 -1
  55. package/vendor/control-plane.js +11 -6
  56. package/vendor/chunk-2DA7EFZV.js +0 -924
@@ -1,10 +1,10 @@
1
1
  import { createRequire as createKoedRequire } from "node:module"; const require = createKoedRequire(import.meta.url);
2
- import {
3
- resolveKoedControlPlaneVersion
4
- } from "./chunk-A4NKL2PK.js";
5
2
  import {
6
3
  resolveKoedServerPaths
7
- } from "./chunk-K2EIFEQF.js";
4
+ } from "./chunk-TSAYTRX3.js";
5
+ import {
6
+ resolveKoedControlPlaneVersion
7
+ } from "./chunk-OG7G6DIR.js";
8
8
 
9
9
  // packages/koed-server/dist/cli.js
10
10
  import { realpathSync } from "node:fs";
@@ -3543,16 +3543,16 @@ var recoveryCommands = [
3543
3543
  options: ["kit", "passwordFd", "passwordStdin"]
3544
3544
  }
3545
3545
  ];
3546
- var registerPersonalSyncCommands = (program2, dependencies, complete, advanced) => {
3547
- const pair = program2.command("pair").description("Connect this device through Koed Desktop").option("--device-label <name>", "Device display name").option("--detach", "Return after creating the request").option("--json", "Emit JSON progress records");
3546
+ var registerPersonalSyncCommands = (program2, dependencies, complete, advanced, hidden = false) => {
3547
+ const pair = program2.command("pair", { hidden }).description("Connect this device through Koed Desktop").option("--device-label <name>", "Device display name").option("--detach", "Return after creating the request").option("--json", "Emit JSON progress records");
3548
3548
  const pairAction = async (operation, options) => {
3549
3549
  const input = { ...pair.opts(), ...options };
3550
- complete(await withCliService(() => import("./chunk-C3N4N5HR.js"), (service) => service.runPairCommand(operation, input, dependencies), dependencies, input.json));
3550
+ complete(await withCliService(() => import("./chunk-EEBIYWTE.js"), (service) => service.runPairCommand(operation, input, dependencies), dependencies, input.json));
3551
3551
  };
3552
3552
  pair.action(async (options) => pairAction(void 0, options));
3553
3553
  for (const operation of ["status", "cancel"])
3554
3554
  pair.command(operation).description(`${operation} the pending pairing request`).option("--json", "Emit JSON output").action(async (options) => pairAction(operation, options));
3555
- const sync = program2.command("personal-sync").description("Inspect Personal Sync and recovery guidance").option("--advanced", "Show advanced compatibility and recovery commands");
3555
+ const sync = program2.command("personal-sync", { hidden }).description("Inspect Personal Sync and recovery guidance").option("--advanced", "Show advanced compatibility and recovery commands");
3556
3556
  sync.action(() => sync.outputHelp());
3557
3557
  sync.addHelpText("after", "\nConnect this device with koed pair. Create your first group and manage devices in Electron \u2192 Devices.\n\nExamples:\n koed personal-sync status --json\n koed personal-sync --help --advanced");
3558
3558
  const execute = (command, path2, flags) => {
@@ -3569,7 +3569,7 @@ var registerPersonalSyncCommands = (program2, dependencies, complete, advanced)
3569
3569
  const stdout = dependencies.stdout ?? process.stdout;
3570
3570
  const stderr = dependencies.stderr ?? process.stderr;
3571
3571
  try {
3572
- const operation = dependencies.runPersonalSync ?? (await import("./chunk-DXTAWHY3.js")).runPersonalSyncCommand;
3572
+ const operation = dependencies.runPersonalSync ?? (await import("./chunk-OZU6JFB4.js")).runPersonalSyncCommand;
3573
3573
  const result = await operation(args, (dependencies.resolvePaths ?? resolveKoedServerPaths)(), process.env);
3574
3574
  stdout.write(options.json ? `${JSON.stringify(result, null, 2)}
3575
3575
  ` : `${result.message}
@@ -3650,7 +3650,7 @@ var registerRemoteCommands = (program2, dependencies, complete) => {
3650
3650
  }));
3651
3651
  return;
3652
3652
  }
3653
- complete(await withCliService(() => import("./chunk-2BWTLF7A.js"), (service) => service.runRemoteMcpOperation(operation, input, {
3653
+ complete(await withCliService(() => import("./chunk-UIMUUIH7.js"), (service) => service.runRemoteMcpOperation(operation, input, {
3654
3654
  environment: dependencies.remoteEnvironment,
3655
3655
  stdout: dependencies.stdout ?? process.stdout,
3656
3656
  stderr: dependencies.stderr ?? process.stderr
@@ -3686,12 +3686,12 @@ var registerInternalCommands = (program2, dependencies, complete) => {
3686
3686
  complete(1);
3687
3687
  return;
3688
3688
  }
3689
- complete(await withCliService(() => import("./chunk-A6WMU2GG.js"), (service) => service.runSecretProviderCommand(operation, reference, dependencies), dependencies, false));
3689
+ complete(await withCliService(() => import("./chunk-AOZ3LMTF.js"), (service) => service.runSecretProviderCommand(operation, reference, dependencies), dependencies, false));
3690
3690
  });
3691
3691
  const desktop = program2.command("desktop", { hidden: true }).description("Internal Desktop commands");
3692
3692
  desktop.action(() => desktop.outputHelp());
3693
3693
  desktop.command("collaboration-broker").action(async () => {
3694
- complete(await withCliService(() => import("./chunk-JJNLH5GA.js"), async (service) => {
3694
+ complete(await withCliService(() => import("./chunk-BYN6KXNP.js"), async (service) => {
3695
3695
  try {
3696
3696
  await service.runDesktopCollaborationBrokerProcess();
3697
3697
  return 0;
@@ -3743,7 +3743,7 @@ var registerComponentCommands = (program2, dependencies, complete) => {
3743
3743
  command.action(async (options) => {
3744
3744
  let service;
3745
3745
  try {
3746
- service = await import("./chunk-YJ6XUZT6.js");
3746
+ service = await import("./chunk-KRBZZ6GS.js");
3747
3747
  } catch {
3748
3748
  complete(reportMissingCliService(dependencies, options.json));
3749
3749
  return;
@@ -3774,7 +3774,7 @@ var registerIntegrationCommands = (program2, dependencies, complete) => {
3774
3774
  if (operation === "check")
3775
3775
  command.option("--capabilities-refreshed-since <value>", "Minimum capability refresh timestamp").option("--include-status", "Include complete service status in the result");
3776
3776
  command.action(async (options) => {
3777
- complete(await withCliService(() => import("./chunk-YK4F4VY2.js"), (service) => service.runIntegrationCommand(operation, { ...options, client }, dependencies), dependencies, options.json));
3777
+ complete(await withCliService(() => import("./chunk-Y6GE52OP.js"), (service) => service.runIntegrationCommand(operation, { ...options, client }, dependencies), dependencies, options.json));
3778
3778
  });
3779
3779
  }
3780
3780
  }
@@ -3791,7 +3791,7 @@ var registerLifecycleCommands = (program2, dependencies, complete) => {
3791
3791
  };
3792
3792
  const bind = (command, operation, identityAction) => {
3793
3793
  command.option("--json", "Emit JSON output").action(async (options) => {
3794
- complete(await withCliService(() => import("./chunk-PY5LYLV7.js"), (service) => service.runLifecycleCommand(operation, { ...options, identityAction }, dependencies), dependencies, options.json));
3794
+ complete(await withCliService(() => import("./chunk-DWWMBGHX.js"), (service) => service.runLifecycleCommand(operation, { ...options, identityAction }, dependencies), dependencies, options.json));
3795
3795
  });
3796
3796
  };
3797
3797
  for (const operation of Object.keys(descriptions)) {
@@ -3871,10 +3871,10 @@ var registerUpstreamCommands = (program2, dependencies, complete) => {
3871
3871
  const paths = (dependencies.resolvePaths ?? resolveKoedServerPaths)();
3872
3872
  let result;
3873
3873
  if (command === list) {
3874
- const execute = dependencies.listUpstreams ?? (await import("./chunk-NEWIOOM6.js")).listUpstreamBackends;
3874
+ const execute = dependencies.listUpstreams ?? (await import("./chunk-SQZ2OSP6.js")).listUpstreamBackends;
3875
3875
  result = execute(paths);
3876
3876
  } else if (command === register) {
3877
- const execute = dependencies.registerUpstream ?? (await import("./chunk-NEWIOOM6.js")).registerUpstreamBackend;
3877
+ const execute = dependencies.registerUpstream ?? (await import("./chunk-SQZ2OSP6.js")).registerUpstreamBackend;
3878
3878
  result = execute(paths, {
3879
3879
  url: required(options.url, "--url"),
3880
3880
  id: options.id,
@@ -3884,7 +3884,7 @@ var registerUpstreamCommands = (program2, dependencies, complete) => {
3884
3884
  } else {
3885
3885
  const id = required(options.id, "--id");
3886
3886
  if (command === refresh) {
3887
- const execute = dependencies.refreshUpstream ?? (await import("./chunk-NEWIOOM6.js")).refreshUpstreamBackendCapabilities;
3887
+ const execute = dependencies.refreshUpstream ?? (await import("./chunk-SQZ2OSP6.js")).refreshUpstreamBackendCapabilities;
3888
3888
  result = await execute(paths, id);
3889
3889
  } else if (command === policy) {
3890
3890
  const update = {};
@@ -3896,28 +3896,28 @@ var registerUpstreamCommands = (program2, dependencies, complete) => {
3896
3896
  throw new Error(`--${flag} must be enabled or disabled.`);
3897
3897
  update[key] = value;
3898
3898
  }
3899
- const execute = dependencies.updateUpstreamPolicy ?? (await import("./chunk-NEWIOOM6.js")).updateUpstreamBackendRoutePolicy;
3899
+ const execute = dependencies.updateUpstreamPolicy ?? (await import("./chunk-SQZ2OSP6.js")).updateUpstreamBackendRoutePolicy;
3900
3900
  result = execute(paths, id, update);
3901
3901
  } else if (command === activate) {
3902
- const execute = dependencies.activateUpstream ?? (await import("./chunk-NEWIOOM6.js")).setActiveUpstreamBackend;
3902
+ const execute = dependencies.activateUpstream ?? (await import("./chunk-SQZ2OSP6.js")).setActiveUpstreamBackend;
3903
3903
  result = execute(paths, id);
3904
3904
  } else if (command === remove) {
3905
- const execute = dependencies.removeUpstream ?? (await import("./chunk-NEWIOOM6.js")).removeUpstreamBackend;
3905
+ const execute = dependencies.removeUpstream ?? (await import("./chunk-SQZ2OSP6.js")).removeUpstreamBackend;
3906
3906
  result = execute(paths, id);
3907
3907
  } else if (command === disconnect) {
3908
- const execute = dependencies.disconnectUpstream ?? (await import("./chunk-RVYJKKWA.js")).disconnectUpstreamBackendEnrollment;
3908
+ const execute = dependencies.disconnectUpstream ?? (await import("./chunk-F7AMEDDU.js")).disconnectUpstreamBackendEnrollment;
3909
3909
  result = await execute(paths, id);
3910
3910
  } else if (command === start) {
3911
- const execute = dependencies.startUpstreamEnroll ?? (await import("./chunk-RVYJKKWA.js")).startUpstreamEnrollment;
3911
+ const execute = dependencies.startUpstreamEnroll ?? (await import("./chunk-F7AMEDDU.js")).startUpstreamEnrollment;
3912
3912
  result = await execute(paths, id, {
3913
3913
  memoryAnswers: Boolean(options.memoryAnswers || options.enableMemoryAnswers),
3914
3914
  sourceOwnerPrincipalId: required(options.sourceOwnerPrincipalId, "--source-owner-principal-id")
3915
3915
  });
3916
3916
  } else if (command === status) {
3917
- const execute = dependencies.getUpstreamEnrollStatus ?? (await import("./chunk-RVYJKKWA.js")).getUpstreamEnrollmentStatus;
3917
+ const execute = dependencies.getUpstreamEnrollStatus ?? (await import("./chunk-F7AMEDDU.js")).getUpstreamEnrollmentStatus;
3918
3918
  result = await execute(paths, id);
3919
3919
  } else {
3920
- const execute = dependencies.cancelUpstreamEnroll ?? (await import("./chunk-RVYJKKWA.js")).cancelUpstreamEnrollment;
3920
+ const execute = dependencies.cancelUpstreamEnroll ?? (await import("./chunk-F7AMEDDU.js")).cancelUpstreamEnrollment;
3921
3921
  result = await execute(paths, id);
3922
3922
  }
3923
3923
  }
@@ -3978,22 +3978,22 @@ var registerProjectCommands = (program2, dependencies, complete) => {
3978
3978
  const paths = (dependencies.resolvePaths ?? resolveKoedServerPaths)();
3979
3979
  let result;
3980
3980
  if (command === discover) {
3981
- const execute = dependencies.discoverProjectMetadata ?? (await import("./chunk-TSRPHKAC.js")).discoverProjectMetadata;
3981
+ const execute = dependencies.discoverProjectMetadata ?? (await import("./chunk-VLP72QWX.js")).discoverProjectMetadata;
3982
3982
  result = await execute(paths, {
3983
3983
  cwd: options.cwd ?? process.cwd(),
3984
3984
  aiClientSource: options.codex ? "codex" : void 0
3985
3985
  });
3986
3986
  } else if (command === list) {
3987
- const execute = dependencies.listProjectMetadata ?? (await import("./chunk-TSRPHKAC.js")).listProjectMetadata;
3987
+ const execute = dependencies.listProjectMetadata ?? (await import("./chunk-VLP72QWX.js")).listProjectMetadata;
3988
3988
  result = execute(paths);
3989
3989
  } else if (command === show) {
3990
- const execute = dependencies.getProjectMetadataForCwd ?? (await import("./chunk-TSRPHKAC.js")).getProjectMetadataForCwd;
3990
+ const execute = dependencies.getProjectMetadataForCwd ?? (await import("./chunk-VLP72QWX.js")).getProjectMetadataForCwd;
3991
3991
  result = execute(paths, options.cwd ?? process.cwd());
3992
3992
  } else if (command === forget) {
3993
- const execute = dependencies.forgetProjectMetadata ?? (await import("./chunk-TSRPHKAC.js")).forgetProjectMetadata;
3993
+ const execute = dependencies.forgetProjectMetadata ?? (await import("./chunk-VLP72QWX.js")).forgetProjectMetadata;
3994
3994
  result = execute(paths, required2(options.localProjectId, "--local-project-id"));
3995
3995
  } else if (command === anchor) {
3996
- const { setProjectRepositoryAnchor } = await import("./chunk-TSRPHKAC.js");
3996
+ const { setProjectRepositoryAnchor } = await import("./chunk-VLP72QWX.js");
3997
3997
  result = await setProjectRepositoryAnchor(paths, {
3998
3998
  localProjectId: required2(options.localProjectId, "--local-project-id"),
3999
3999
  expectedCheckoutId: required2(options.checkoutId, "--checkout-id"),
@@ -4057,7 +4057,7 @@ var registerPackageCommands = (program2, dependencies, complete) => {
4057
4057
  let result;
4058
4058
  switch (command.name()) {
4059
4059
  case "status": {
4060
- const execute = dependencies.collectPackageStatus ?? (await import("./chunk-YOFI4PCH.js")).collectServerPackageStatus;
4060
+ const execute = dependencies.collectPackageStatus ?? (await import("./chunk-F77ZTTNS.js")).collectServerPackageStatus;
4061
4061
  result = execute(paths);
4062
4062
  break;
4063
4063
  }
@@ -4084,20 +4084,20 @@ var registerPackageCommands = (program2, dependencies, complete) => {
4084
4084
  input.trustPolicy = policy;
4085
4085
  if (options.allowDowngrade)
4086
4086
  input.allowDowngrade = true;
4087
- const execute = dependencies.installPackage ?? (await import("./chunk-YOFI4PCH.js")).installServerPackage;
4087
+ const execute = dependencies.installPackage ?? (await import("./chunk-F77ZTTNS.js")).installServerPackage;
4088
4088
  result = await execute(paths, input);
4089
4089
  break;
4090
4090
  }
4091
4091
  case "activate": {
4092
4092
  const version = required3(options.version, "--version");
4093
- const execute = dependencies.activatePackage ?? (await import("./chunk-YOFI4PCH.js")).activateServerPackage;
4093
+ const execute = dependencies.activatePackage ?? (await import("./chunk-F77ZTTNS.js")).activateServerPackage;
4094
4094
  result = execute(paths, version, {
4095
4095
  allowDowngrade: Boolean(options.allowDowngrade)
4096
4096
  });
4097
4097
  break;
4098
4098
  }
4099
4099
  default: {
4100
- const execute = dependencies.cleanupPackages ?? (await import("./chunk-YOFI4PCH.js")).cleanupServerPackages;
4100
+ const execute = dependencies.cleanupPackages ?? (await import("./chunk-F77ZTTNS.js")).cleanupServerPackages;
4101
4101
  result = execute(paths, Number.parseInt(options.keep ?? "1", 10));
4102
4102
  }
4103
4103
  }
@@ -4122,6 +4122,19 @@ var registerPackageCommands = (program2, dependencies, complete) => {
4122
4122
  var runModelCommand = async (operation, options, dependencies) => {
4123
4123
  const stdout = dependencies.stdout ?? process.stdout;
4124
4124
  const stderr = dependencies.stderr ?? process.stderr;
4125
+ let lastProgressAt = 0;
4126
+ let lastPhase = "";
4127
+ const progress = (event) => {
4128
+ if (!options.progressJson)
4129
+ return;
4130
+ const now = Date.now();
4131
+ if (event.phase === lastPhase && now - lastProgressAt < 250 && event.completedBytes !== event.totalBytes)
4132
+ return;
4133
+ lastProgressAt = now;
4134
+ lastPhase = event.phase;
4135
+ stderr.write(`KOED_MODEL_PROGRESS ${JSON.stringify(event)}
4136
+ `);
4137
+ };
4125
4138
  try {
4126
4139
  if (options.kind !== "embedding" && options.kind !== "privacy")
4127
4140
  throw new Error("--kind must be embedding or privacy.");
@@ -4134,15 +4147,31 @@ var runModelCommand = async (operation, options, dependencies) => {
4134
4147
  let result;
4135
4148
  if (options.kind === "privacy") {
4136
4149
  if (operation === "status") {
4137
- const execute = dependencies.collectPrivacyModelStatus ?? (await import("./chunk-ZXX4ZNJY.js")).collectPrivacyModelStatus;
4150
+ const execute = dependencies.collectPrivacyModelStatus ?? (await import("./chunk-S6HD3MDU.js")).collectPrivacyModelStatus;
4138
4151
  result = await execute(paths);
4139
4152
  } else {
4140
- const execute = dependencies.installPrivacyModel ?? (await import("./chunk-ZXX4ZNJY.js")).installPrivacyModel;
4141
- result = await execute(paths, environment);
4153
+ const execute = dependencies.installPrivacyModel ?? (await import("./chunk-S6HD3MDU.js")).installPrivacyModel;
4154
+ const files = /* @__PURE__ */ new Map();
4155
+ result = options.progressJson ? await execute(paths, environment, void 0, {
4156
+ progress: (event) => {
4157
+ files.set(event.file ?? "current", event.transferredBytes);
4158
+ progress({
4159
+ completedBytes: [...files.values()].reduce((sum, bytes) => sum + bytes, 0),
4160
+ // Remaining Privacy Filter assets may not have known lengths yet.
4161
+ totalBytes: null,
4162
+ phase: event.phase === "model-verify" ? "verifying" : "downloading"
4163
+ });
4164
+ }
4165
+ }) : await execute(paths, environment);
4142
4166
  }
4143
- } else {
4144
- const execute = operation === "status" ? dependencies.collectModelStatus ?? (await import("./chunk-KUIWH33N.js")).collectLocalModelStatus : dependencies.installModel ?? (await import("./chunk-KUIWH33N.js")).installLocalModel;
4167
+ } else if (operation === "status") {
4168
+ const execute = dependencies.collectModelStatus ?? (await import("./chunk-AVQCUFYQ.js")).collectLocalModelStatus;
4145
4169
  result = await execute(paths, options.kind, environment);
4170
+ } else {
4171
+ const execute = dependencies.installModel ?? (await import("./chunk-AVQCUFYQ.js")).installLocalModel;
4172
+ result = options.progressJson ? await execute(paths, options.kind, environment, {
4173
+ onProgress: progress
4174
+ }) : await execute(paths, options.kind, environment);
4146
4175
  }
4147
4176
  stdout.write(options.json ? `${JSON.stringify(result, null, 2)}
4148
4177
  ` : `${result.message}
@@ -4163,42 +4192,98 @@ var registerModelCommands = (program2, dependencies, complete) => {
4163
4192
  const models = program2.command("models").description("Manage embedding and privacy models");
4164
4193
  models.action(() => models.outputHelp());
4165
4194
  for (const operation of ["status", "install"])
4166
- models.command(operation).description(operation === "status" ? "Show model installation status" : "Download and verify a local model").option("--kind <kind>", "Model kind: embedding or privacy", "embedding").option("--json", "Emit JSON output").action(async (options) => {
4195
+ models.command(operation).description(operation === "status" ? "Show model installation status" : "Download and verify a local model").option("--kind <kind>", "Model kind: embedding or privacy", "embedding").option("--json", "Emit JSON output").option("--progress-json", "Stream model download progress to stderr").action(async (options) => {
4167
4196
  complete(await runModelCommand(operation, options, dependencies));
4168
4197
  });
4169
4198
  };
4170
4199
 
4171
4200
  // packages/koed-server/dist/cli-runtime.js
4201
+ async function withRuntimeCancellation(action) {
4202
+ const controller = new AbortController();
4203
+ const cancel = () => controller.abort(new Error("Native runtime operation cancelled."));
4204
+ process.on("SIGINT", cancel);
4205
+ process.on("SIGTERM", cancel);
4206
+ try {
4207
+ return await action(controller.signal);
4208
+ } finally {
4209
+ process.off("SIGINT", cancel);
4210
+ process.off("SIGTERM", cancel);
4211
+ }
4212
+ }
4172
4213
  var runRuntimeCommand = async (operation, options, dependencies) => {
4173
4214
  const stdout = dependencies.stdout ?? process.stdout;
4174
4215
  const stderr = dependencies.stderr ?? process.stderr;
4175
4216
  try {
4176
- if (options.provider !== "homebrew" && options.provider !== "packaged")
4177
- throw new Error("--provider must be homebrew or packaged.");
4217
+ if (options.withCuda && options.withoutCuda)
4218
+ throw new Error("--with-cuda and --without-cuda are mutually exclusive.");
4219
+ if ((options.withCuda || options.withoutCuda) && (operation !== "install" || options.provider !== "release"))
4220
+ throw new Error("CUDA asset flags require runtime install --provider release --dependency-mode bundled-local.");
4221
+ if (options.provider !== "homebrew" && options.provider !== "packaged" && options.provider !== "release")
4222
+ throw new Error("--provider must be homebrew, packaged, or release.");
4178
4223
  if (operation === "install" && options.dependencyMode !== "bundled-local")
4179
4224
  throw new Error("runtime install requires --dependency-mode bundled-local.");
4180
4225
  const paths = (dependencies.resolvePaths ?? resolveKoedServerPaths)();
4181
4226
  const loadEnvironment = dependencies.loadEnvironment ?? (await import("./chunk-7NOQSX4T.js")).loadRepoEnv;
4182
4227
  const environment = {
4183
4228
  ...loadEnvironment(paths.repoRoot),
4184
- ...Object.fromEntries(Object.entries(process.env).filter(([, value]) => value?.trim()))
4229
+ ...Object.fromEntries(
4230
+ // An explicitly empty CUDA mask hides all GPUs.
4231
+ Object.entries(process.env).filter(([key, value]) => key === "CUDA_VISIBLE_DEVICES" || value?.trim())
4232
+ )
4185
4233
  };
4186
4234
  let result;
4187
- if (options.provider === "packaged") {
4188
- const execute = operation === "status" ? dependencies.collectPackagedRuntimeStatus ?? (await import("./chunk-PT3AUPGE.js")).collectPackagedRuntimeStatus : dependencies.installPackagedRuntime ?? (await import("./chunk-PT3AUPGE.js")).installPackagedRuntime;
4235
+ if (options.provider === "release") {
4236
+ if (dependencies.desktopRuntimeCapability)
4237
+ throw new Error("Use Koed Desktop to manage its runtime.");
4238
+ const release = await import("./chunk-273NMYXE.js");
4239
+ if (operation === "validate") {
4240
+ if (!options.runtimeRoot?.trim())
4241
+ throw new Error("Provide a trusted staged runtime directory.");
4242
+ const root = options.runtimeRoot;
4243
+ release.assertReleaseHost();
4244
+ if (process.platform === "darwin")
4245
+ throw new Error("CUDA runtime validation is not supported on macOS.");
4246
+ const { withStoppedRuntime } = await import("./chunk-ILQVLZ2I.js");
4247
+ const { resolveKoedRuntimeOwner } = await import("./chunk-ZKKWLLPU.js");
4248
+ const { validateStagedCuda } = await import("./chunk-W6632NOX.js");
4249
+ result = await withRuntimeCancellation((signal) => withStoppedRuntime(paths, resolveKoedRuntimeOwner(), () => validateStagedCuda(paths, root, environment, {
4250
+ signal,
4251
+ requireModel: options.requireModel === true
4252
+ })));
4253
+ } else if (operation === "status")
4254
+ result = release.collectReleaseRuntimeStatus(paths, environment);
4255
+ else {
4256
+ let last = 0;
4257
+ result = await withRuntimeCancellation((signal) => release.installReleaseRuntime(paths, {
4258
+ signal,
4259
+ cuda: options.withCuda ? "with" : options.withoutCuda ? "without" : "preserve",
4260
+ environment,
4261
+ progress(event) {
4262
+ if (Date.now() - last < 1e3 && event.transferredBytes !== event.totalBytes)
4263
+ return;
4264
+ last = Date.now();
4265
+ stderr.write(`Downloading native runtime asset: ${event.transferredBytes} of ${event.totalBytes ?? "unknown"} bytes
4266
+ `);
4267
+ }
4268
+ }));
4269
+ }
4270
+ } else if (options.provider === "packaged") {
4271
+ const execute = operation === "status" ? dependencies.collectPackagedRuntimeStatus ?? (await import("./chunk-UB6JCVQ3.js")).collectPackagedRuntimeStatus : dependencies.installPackagedRuntime ?? (await import("./chunk-UB6JCVQ3.js")).installPackagedRuntime;
4189
4272
  result = execute(paths, environment);
4190
4273
  } else {
4191
- const execute = operation === "status" ? dependencies.collectRuntimeStatus ?? (await import("./chunk-HK2H3MVE.js")).collectHomebrewRuntimeStatus : dependencies.installRuntime ?? (await import("./chunk-HK2H3MVE.js")).installHomebrewRuntime;
4274
+ const execute = operation === "status" ? dependencies.collectRuntimeStatus ?? (await import("./chunk-53ZFCDHP.js")).collectHomebrewRuntimeStatus : dependencies.installRuntime ?? (await import("./chunk-53ZFCDHP.js")).installHomebrewRuntime;
4192
4275
  result = execute(paths, environment);
4193
4276
  }
4194
4277
  stdout.write(options.json ? `${JSON.stringify(result, null, 2)}
4195
4278
  ` : `${result.message}
4196
- `);
4279
+ ${"executionPolicy" in result ? `Embedding execution policy: ${String(result.executionPolicy)}.
4280
+ ` : ""}`);
4197
4281
  return result.ok ? 0 : 1;
4198
4282
  } catch (error) {
4199
4283
  const message = error instanceof Error ? error.message : String(error);
4284
+ const reason = error instanceof Error && "reason" in error ? error.reason : void 0;
4200
4285
  if (options.json)
4201
- stdout.write(`${JSON.stringify({ ok: false, error: message }, null, 2)}
4286
+ stdout.write(`${JSON.stringify({ ok: false, error: message, reason }, null, 2)}
4202
4287
  `);
4203
4288
  else
4204
4289
  stderr.write(`${message}
@@ -4209,19 +4294,56 @@ var runRuntimeCommand = async (operation, options, dependencies) => {
4209
4294
  var registerRuntimeCommands = (program2, dependencies, complete) => {
4210
4295
  const runtime = program2.command("runtime").description("Manage local runtime dependencies");
4211
4296
  runtime.action(() => runtime.outputHelp());
4297
+ runtime.command("validate").description("Run stopped-runtime CPU/CUDA checks on a trusted, staged Linux runtime").requiredOption("--runtime-root <directory>", "Trusted directory containing llama.cpp/cpu and llama.cpp/cuda; its binaries will execute").option("--require-model", "Require CPU/GPU inference with the already installed embedding model").option("--json", "Emit JSON output").action(async (options) => {
4298
+ complete(await runRuntimeCommand("validate", { ...options, provider: "release" }, dependencies));
4299
+ });
4212
4300
  for (const operation of ["status", "install"]) {
4213
- const command = runtime.command(operation).description(operation === "status" ? "Show runtime installation status" : "Install local runtime dependencies explicitly").option("--provider <provider>", "Runtime provider: homebrew or packaged", "homebrew").option("--dependency-mode <mode>", "Dependency mode; installation requires bundled-local").option("--json", "Emit JSON output").action(async (options) => {
4301
+ const command = runtime.command(operation).description(operation === "status" ? "Show runtime installation status" : "Install local runtime dependencies explicitly").option("--provider <provider>", "Runtime provider: homebrew, packaged, or release", "homebrew").option("--dependency-mode <mode>", "Dependency mode; installation requires bundled-local").option("--json", "Emit JSON output").action(async (options) => {
4214
4302
  complete(await runRuntimeCommand(operation, options, dependencies));
4215
4303
  });
4216
4304
  if (operation === "install")
4217
- command.addHelpText("after", "\nExample:\n koed runtime install --provider homebrew --dependency-mode bundled-local --json");
4305
+ command.option("--with-cuda", "Install the pinned CUDA add-on with its compatible CPU core").option("--without-cuda", "Select CPU only and retain the previous payloads").addHelpText("after", "\nExample:\n koed runtime install --provider homebrew --dependency-mode bundled-local --json");
4218
4306
  }
4219
4307
  };
4220
4308
 
4309
+ // packages/koed-server/dist/personal-device-sync-feature.js
4310
+ var personalDeviceSyncFeatureEnvironmentName = "KOED_PERSONAL_DEVICE_SYNC_ENABLED";
4311
+ var personalDeviceSyncCommandNames = [
4312
+ "pair",
4313
+ "personal-sync"
4314
+ ];
4315
+ var resolvePersonalDeviceSyncEnabled = (environment = process.env) => {
4316
+ const configured = environment[personalDeviceSyncFeatureEnvironmentName];
4317
+ if (configured === void 0 || configured === "")
4318
+ return false;
4319
+ if (configured === "true")
4320
+ return true;
4321
+ if (configured === "false")
4322
+ return false;
4323
+ throw new Error(`${personalDeviceSyncFeatureEnvironmentName} must be exactly "true" or "false"`);
4324
+ };
4325
+
4221
4326
  // packages/koed-server/dist/cli-command-tree.js
4222
4327
  var runCommandTree = async (args, dependencies = {}) => {
4223
4328
  const stdout = dependencies.stdout ?? process.stdout;
4224
4329
  const stderr = dependencies.stderr ?? process.stderr;
4330
+ let personalDeviceSyncEnabled = false;
4331
+ let personalDeviceSyncDisabledMessage = `Personal Device Sync is disabled in this release. Set ${personalDeviceSyncFeatureEnvironmentName}=true to use it.`;
4332
+ try {
4333
+ personalDeviceSyncEnabled = resolvePersonalDeviceSyncEnabled();
4334
+ } catch (error) {
4335
+ personalDeviceSyncDisabledMessage = error instanceof Error ? error.message : String(error);
4336
+ }
4337
+ const requested = args[0] === "help" ? args[1] : args[0];
4338
+ if (!personalDeviceSyncEnabled && personalDeviceSyncCommandNames.includes(requested ?? "")) {
4339
+ if (args.includes("--json"))
4340
+ stdout.write(`${JSON.stringify({ ok: false, error: personalDeviceSyncDisabledMessage }, null, 2)}
4341
+ `);
4342
+ else
4343
+ stderr.write(`${personalDeviceSyncDisabledMessage}
4344
+ `);
4345
+ return 1;
4346
+ }
4225
4347
  let exitCode = 0;
4226
4348
  const program2 = new Command().name("koed").enablePositionalOptions().description("Manage Koed services and AI Client integrations").version(resolveKoedControlPlaneVersion(), "-V, --version", "Print the Koed version").exitOverride().showSuggestionAfterError(false).configureOutput({
4227
4349
  writeOut: (text) => {
@@ -4265,7 +4387,7 @@ var runCommandTree = async (args, dependencies = {}) => {
4265
4387
  });
4266
4388
  registerPersonalSyncCommands(program2, dependencies, (code) => {
4267
4389
  exitCode = code;
4268
- }, args.includes("--advanced"));
4390
+ }, args.includes("--advanced"), !personalDeviceSyncEnabled);
4269
4391
  program2.addHelpText("after", "\nEnvironment:\n KOED_HOME Local configuration, logs, and runtime state\n KOED_REPO_ROOT Checkout path for development builds\n\nRun koed <command> --help for command help.");
4270
4392
  const configureCommand = (command) => {
4271
4393
  if (command.commands.length)
@@ -1,7 +1,7 @@
1
1
  import { createRequire as createKoedRequire } from "node:module"; const require = createKoedRequire(import.meta.url);
2
2
  import {
3
3
  isProcessRunning
4
- } from "./chunk-G4IIVVJO.js";
4
+ } from "./chunk-T6UB5PNX.js";
5
5
  import {
6
6
  require_proper_lockfile
7
7
  } from "./chunk-7NXKPDF3.js";
@@ -2,7 +2,7 @@ import { createRequire as createKoedRequire } from "node:module"; const require
2
2
  import {
3
3
  isPackagedRuntimeMode,
4
4
  resolvePackagedResourcesPath
5
- } from "./chunk-UI5RLBKQ.js";
5
+ } from "./chunk-YZLQZU5E.js";
6
6
 
7
7
  // packages/koed-server/dist/paths.js
8
8
  import { mkdirSync } from "node:fs";
@@ -1,7 +1,8 @@
1
1
  import { createRequire as createKoedRequire } from "node:module"; const require = createKoedRequire(import.meta.url);
2
2
  import {
3
+ assertNoReleaseRuntime,
3
4
  resolvePackagedKoedRuntimeRoot
4
- } from "./chunk-UI5RLBKQ.js";
5
+ } from "./chunk-YZLQZU5E.js";
5
6
  import "./chunk-BTS4ZTF3.js";
6
7
 
7
8
  // packages/koed-server/dist/runtime-packaged.js
@@ -415,6 +416,7 @@ var copyAsset = (paths, root, asset) => {
415
416
  return target;
416
417
  };
417
418
  var installPackagedRuntime = (paths, environment = process.env, dependencies = {}) => {
419
+ assertNoReleaseRuntime(paths);
418
420
  const root = resolvePackagedKoedRuntimeRoot(environment);
419
421
  const platform = dependencies.platform ?? process.platform;
420
422
  const architecture = dependencies.architecture ?? process.arch;