@koed-labs/server 1.0.0 → 1.3.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 (44) hide show
  1. package/README.md +3 -3
  2. package/package.json +1 -1
  3. package/vendor/{chunk-W2HNI6AA.js → chunk-26D2DYEJ.js} +12 -2
  4. package/vendor/{chunk-S6HD3MDU.js → chunk-2XVGC6KN.js} +2 -2
  5. package/vendor/chunk-2YCDKSKW.js +45 -0
  6. package/vendor/{chunk-T7OGE5E5.js → chunk-4QETHLFK.js} +3 -3
  7. package/vendor/{chunk-E6YVGIEW.js → chunk-5ZYY6GLX.js} +728 -34
  8. package/vendor/{chunk-BYN6KXNP.js → chunk-AAAVAB5Q.js} +5 -5
  9. package/vendor/{chunk-UCOHFZ77.js → chunk-B25G2HFV.js} +2 -2
  10. package/vendor/{chunk-F77ZTTNS.js → chunk-BRPU557N.js} +3 -3
  11. package/vendor/{chunk-QV3WPU7A.js → chunk-BTBSSNAR.js} +1 -1
  12. package/vendor/{chunk-ILQVLZ2I.js → chunk-BYN4THYX.js} +5 -5
  13. package/vendor/{chunk-64AST7WZ.js → chunk-BYZDN2WK.js} +5 -2
  14. package/vendor/{chunk-XKXSC6YS.js → chunk-CLI4TFKY.js} +21 -13
  15. package/vendor/{chunk-W6632NOX.js → chunk-CZKIP3UJ.js} +4 -3
  16. package/vendor/{chunk-DWWMBGHX.js → chunk-DNHKSXD5.js} +19 -18
  17. package/vendor/{chunk-AOZ3LMTF.js → chunk-F7BTC7UR.js} +3 -2
  18. package/vendor/{chunk-USHFSJT7.js → chunk-FZAIOBQQ.js} +11 -9
  19. package/vendor/{chunk-NGV45YWB.js → chunk-GBQXRSSZ.js} +4 -4
  20. package/vendor/{chunk-7FSHVVTZ.js → chunk-HFGCZ76G.js} +7 -1
  21. package/vendor/{chunk-4DHYSJJT.js → chunk-HN2X7VA2.js} +1 -1
  22. package/vendor/{chunk-54UL4U2E.js → chunk-IHVJNZXT.js} +101 -33
  23. package/vendor/{chunk-EEBIYWTE.js → chunk-JHHI5KG6.js} +19 -18
  24. package/vendor/{chunk-TIBYKMRW.js → chunk-JLYGPZYP.js} +38 -45
  25. package/vendor/{chunk-XCO3RV3Z.js → chunk-K2KUQRHT.js} +1 -1
  26. package/vendor/{chunk-Y6GE52OP.js → chunk-KB3MFZD7.js} +20 -19
  27. package/vendor/{chunk-L4RD3TAZ.js → chunk-LLJV6XQ6.js} +14 -8
  28. package/vendor/{chunk-KG3RANR4.js → chunk-LVUQ5N23.js} +1 -1
  29. package/vendor/{chunk-KRBZZ6GS.js → chunk-O5NAIZP3.js} +9 -9
  30. package/vendor/{chunk-SQZ2OSP6.js → chunk-OFNOMEVX.js} +2 -2
  31. package/vendor/{chunk-273NMYXE.js → chunk-PAPGIBPA.js} +8 -7
  32. package/vendor/{chunk-VLP72QWX.js → chunk-PMDFTON3.js} +116 -64
  33. package/vendor/{chunk-GY5GATZL.js → chunk-RBD4HLDB.js} +7 -2
  34. package/vendor/{chunk-F7AMEDDU.js → chunk-SANHAZJM.js} +4 -4
  35. package/vendor/{chunk-WBMO7YCO.js → chunk-SQNSVJ3W.js} +1 -1
  36. package/vendor/{chunk-VGL5AZN5.js → chunk-TCL6KGG7.js} +1 -1
  37. package/vendor/{chunk-7NOQSX4T.js → chunk-UKBULNBO.js} +5 -3
  38. package/vendor/{chunk-OZU6JFB4.js → chunk-XSNPYCS5.js} +6 -5
  39. package/vendor/{chunk-LHUMBHG7.js → chunk-XYC3MIS6.js} +1 -1
  40. package/vendor/{chunk-UIMUUIH7.js → chunk-YHXEFDZV.js} +14 -14
  41. package/vendor/{chunk-7HLNJ2BI.js → chunk-YLFOTZFU.js} +1 -1
  42. package/vendor/{chunk-ALJUSOF7.js → chunk-YY7NMZGD.js} +79 -1
  43. package/vendor/component-manifest-catalog.js +1 -1
  44. package/vendor/control-plane.js +7 -4
@@ -1,7 +1,7 @@
1
1
  import { createRequire as createKoedRequire } from "node:module"; const require = createKoedRequire(import.meta.url);
2
2
  import {
3
3
  noteAiClientConnectionRevision
4
- } from "./chunk-KG3RANR4.js";
4
+ } from "./chunk-LVUQ5N23.js";
5
5
  import {
6
6
  configureCodexIntegrationForRemoteBackend,
7
7
  grantAiClientConnection,
@@ -17,38 +17,38 @@ import {
17
17
  revokeAiClientConnection,
18
18
  setupClaude,
19
19
  setupPi
20
- } from "./chunk-USHFSJT7.js";
20
+ } from "./chunk-FZAIOBQQ.js";
21
21
  import "./chunk-QT24SAW6.js";
22
22
  import "./chunk-TISYUUEJ.js";
23
23
  import {
24
24
  resolveKoedServerConfig
25
- } from "./chunk-ALJUSOF7.js";
26
- import "./chunk-LHUMBHG7.js";
25
+ } from "./chunk-YY7NMZGD.js";
26
+ import "./chunk-XYC3MIS6.js";
27
27
  import {
28
28
  resolveKoedServerPaths
29
29
  } from "./chunk-TSAYTRX3.js";
30
30
  import "./chunk-YZLQZU5E.js";
31
- import "./chunk-W2HNI6AA.js";
31
+ import "./chunk-26D2DYEJ.js";
32
32
  import {
33
33
  resolveKoedAppRuntime
34
34
  } from "./chunk-OG7G6DIR.js";
35
- import "./chunk-UCOHFZ77.js";
35
+ import "./chunk-B25G2HFV.js";
36
36
  import {
37
37
  isProcessRunning
38
38
  } from "./chunk-T6UB5PNX.js";
39
39
  import {
40
40
  require_proper_lockfile
41
41
  } from "./chunk-7NXKPDF3.js";
42
- import "./chunk-XCO3RV3Z.js";
43
- import "./chunk-7HLNJ2BI.js";
44
- import "./chunk-VGL5AZN5.js";
45
- import "./chunk-QV3WPU7A.js";
42
+ import "./chunk-K2KUQRHT.js";
43
+ import "./chunk-YLFOTZFU.js";
44
+ import "./chunk-TCL6KGG7.js";
45
+ import "./chunk-BTBSSNAR.js";
46
46
  import "./chunk-IY2HRXOZ.js";
47
- import "./chunk-4DHYSJJT.js";
48
- import "./chunk-WBMO7YCO.js";
47
+ import "./chunk-HN2X7VA2.js";
48
+ import "./chunk-SQNSVJ3W.js";
49
49
  import {
50
50
  isTeamMemoryAnswerTaskCapability
51
- } from "./chunk-E6YVGIEW.js";
51
+ } from "./chunk-5ZYY6GLX.js";
52
52
  import {
53
53
  NEVER,
54
54
  ZodIssueCode,
@@ -13890,7 +13890,7 @@ var runRemoteMcpOperation = async (command, input, options) => {
13890
13890
  }
13891
13891
  };
13892
13892
  var runRemoteMcpCommand = async (args, options) => {
13893
- const { runKoedServerCli } = await import("./chunk-64AST7WZ.js");
13893
+ const { runKoedServerCli } = await import("./chunk-BYZDN2WK.js");
13894
13894
  return runKoedServerCli(["remote", ...args], {
13895
13895
  stdout: options.stdout,
13896
13896
  stderr: options.stderr,
@@ -1,7 +1,7 @@
1
1
  import { createRequire as createKoedRequire } from "node:module"; const require = createKoedRequire(import.meta.url);
2
2
  import {
3
3
  nativeKind
4
- } from "./chunk-VGL5AZN5.js";
4
+ } from "./chunk-TCL6KGG7.js";
5
5
  import {
6
6
  lookupManifestPin
7
7
  } from "./chunk-IY2HRXOZ.js";
@@ -1,10 +1,67 @@
1
1
  import { createRequire as createKoedRequire } from "node:module"; const require = createKoedRequire(import.meta.url);
2
+ import {
3
+ external_exports
4
+ } from "./chunk-FSNLU46W.js";
5
+
6
+ // packages/koed-server/dist/performance-schema.js
7
+ var resourceOverridesSchema = external_exports.object({
8
+ backgroundNice: external_exports.number().int().min(0).max(19).optional(),
9
+ embeddingThreads: external_exports.number().int().positive().max(65536).optional(),
10
+ transcriptPollMs: external_exports.number().int().min(1).max(6e4).optional()
11
+ }).strict();
12
+ var performanceChoiceSchema = external_exports.object({
13
+ profile: external_exports.enum(["low", "balanced", "full"]),
14
+ overrides: resourceOverridesSchema,
15
+ expectedRevision: external_exports.string().regex(/^[a-f0-9]{64}$/)
16
+ }).strict();
2
17
 
3
18
  // packages/koed-server/dist/config.js
4
19
  import { existsSync, readFileSync, renameSync, rmSync, writeFileSync } from "node:fs";
5
20
  import { randomUUID } from "node:crypto";
6
21
  import { dirname } from "node:path";
7
22
  import { mkdirSync } from "node:fs";
23
+
24
+ // packages/koed-server/dist/resource-profile.js
25
+ import { cpus } from "node:os";
26
+
27
+ // packages/shared/dist/resource-profiles.js
28
+ var resourceProfileValues = (profile, cpuCount) => ({
29
+ backgroundNice: profile === "low" ? 19 : profile === "full" ? 0 : 10,
30
+ embeddingThreads: Math.max(1, Math.floor(cpuCount / (profile === "low" ? 4 : profile === "balanced" ? 2 : 1))),
31
+ transcriptPollMs: profile === "low" ? 15e3 : 1e3
32
+ });
33
+
34
+ // packages/koed-server/dist/resource-profile.js
35
+ var resourceProfiles = [
36
+ "low",
37
+ "balanced",
38
+ "full"
39
+ ];
40
+ var DEFAULT_RESOURCE_PROFILE = "balanced";
41
+ var isResourceProfile = (value) => typeof value === "string" && resourceProfiles.includes(value);
42
+ var resourceVariables = {
43
+ backgroundNice: ["KOED_BACKGROUND_NICE"],
44
+ embeddingThreads: ["EMBEDDING_LLAMA_N_THREADS", "LLAMA_N_THREADS"],
45
+ transcriptPollMs: ["MEMORY_CODEX_TRANSCRIPT_POLL_MS"]
46
+ };
47
+ var resourceKeys = Object.keys(resourceVariables);
48
+ var applyResourceProfile = (environment, profile, options = {}) => {
49
+ const isExplicit = (key) => resourceVariables[key].some((name) => Boolean(environment[name]?.trim() || options.explicit?.[name]?.trim()));
50
+ const cpuCount = Math.max(1, options.cpuCount ?? (cpus().length || 1));
51
+ const values = profile === "balanced" ? {} : resourceProfileValues(profile, cpuCount);
52
+ const overrides = options.overrides ?? {};
53
+ const output = { ...environment };
54
+ for (const key of resourceKeys) {
55
+ if (isExplicit(key))
56
+ continue;
57
+ const value = overrides[key] ?? values[key];
58
+ if (value !== void 0)
59
+ output[resourceVariables[key][0]] = String(value);
60
+ }
61
+ return output;
62
+ };
63
+
64
+ // packages/koed-server/dist/config.js
8
65
  var defaultKoedServerConfig = {
9
66
  runtimeMode: "local-personal",
10
67
  dependencyMode: "bundled-local",
@@ -12,7 +69,8 @@ var defaultKoedServerConfig = {
12
69
  claudeTranscriptWatcherEnabled: true,
13
70
  piTranscriptWatcherEnabled: true,
14
71
  codexGlobalMemoryGuidanceEnabled: true,
15
- hardwareAcceleration: "auto"
72
+ hardwareAcceleration: "auto",
73
+ resourceProfile: DEFAULT_RESOURCE_PROFILE
16
74
  };
17
75
  var trim = (value) => {
18
76
  const trimmed = value?.trim();
@@ -33,6 +91,20 @@ var booleanSetting = codexTranscriptWatcherSetting;
33
91
  var hardwareAccelerationPreference = (value, source) => value === void 0 ? void 0 : value === "auto" || value === "cpu" ? value : (() => {
34
92
  throw new Error(`${source} must be auto or cpu`);
35
93
  })();
94
+ var resourceProfilePreference = (value, source) => value === void 0 || value === "" ? void 0 : isResourceProfile(value) ? value : (() => {
95
+ throw new Error(`${source} must be low, balanced, or full`);
96
+ })();
97
+ var lenientResourceOverrides = (value) => {
98
+ if (!value || typeof value !== "object" || Array.isArray(value))
99
+ return {};
100
+ const overrides = {};
101
+ for (const key of Object.keys(resourceOverridesSchema.shape)) {
102
+ const parsed = resourceOverridesSchema.shape[key].safeParse(value[key]);
103
+ if (parsed.success && parsed.data !== void 0)
104
+ overrides[key] = parsed.data;
105
+ }
106
+ return overrides;
107
+ };
36
108
  var readConfig = (paths, deps) => {
37
109
  if (!deps.existsSync(paths.serverConfigPath)) {
38
110
  return {};
@@ -71,6 +143,8 @@ var readConfig = (paths, deps) => {
71
143
  if (record.hardwareAcceleration !== void 0) {
72
144
  hardwareAccelerationPreference(record.hardwareAcceleration, "server.json hardwareAcceleration");
73
145
  }
146
+ resourceOverridesSchema.parse(record.resourceOverrides ?? {});
147
+ resourceProfilePreference(record.resourceProfile, "server.json resourceProfile");
74
148
  if (record.external !== void 0 && (!record.external || typeof record.external !== "object" || Array.isArray(record.external))) {
75
149
  throw new Error("external must be an object");
76
150
  }
@@ -130,6 +204,8 @@ var resolveKoedServerConfig = (paths, environment = process.env, deps = {}) => {
130
204
  piTranscriptWatcherEnabled: resolvedPiTranscriptWatcherSetting ?? resolvedRuntimeMode !== "external",
131
205
  codexGlobalMemoryGuidanceEnabled: booleanSetting(environment.KOED_CODEX_GLOBAL_MEMORY_GUIDANCE_ENABLED) ?? booleanSetting(file.codexGlobalMemoryGuidanceEnabled) ?? defaultKoedServerConfig.codexGlobalMemoryGuidanceEnabled,
132
206
  hardwareAcceleration: hardwareAccelerationPreference(environment.KOED_HARDWARE_ACCELERATION, "KOED_HARDWARE_ACCELERATION") ?? hardwareAccelerationPreference(file.hardwareAcceleration, "server.json hardwareAcceleration") ?? defaultKoedServerConfig.hardwareAcceleration,
207
+ resourceOverrides: deps.strict ? resourceOverridesSchema.parse(file.resourceOverrides ?? {}) : lenientResourceOverrides(file.resourceOverrides),
208
+ resourceProfile: resourceProfilePreference(trim(environment.KOED_RESOURCE_PROFILE), "KOED_RESOURCE_PROFILE") ?? (deps.strict ? resourceProfilePreference(file.resourceProfile, "server.json resourceProfile") : isResourceProfile(file.resourceProfile) ? file.resourceProfile : void 0) ?? defaultKoedServerConfig.resourceProfile,
133
209
  external: {
134
210
  databaseUrl: trim(environment.KOED_EXTERNAL_DATABASE_URL) ?? trim(environment.DATABASE_URL) ?? trim(file.external?.databaseUrl),
135
211
  redisUrl: trim(environment.KOED_EXTERNAL_REDIS_URL) ?? trim(environment.REDIS_URL) ?? trim(file.external?.redisUrl),
@@ -170,6 +246,8 @@ var writeCodexGlobalMemoryGuidancePreference = (paths, enabled, deps = {}) => {
170
246
  };
171
247
 
172
248
  export {
249
+ resourceProfileValues,
250
+ applyResourceProfile,
173
251
  resolveKoedServerConfig,
174
252
  writeCodexGlobalMemoryGuidancePreference
175
253
  };
@@ -1,7 +1,7 @@
1
1
  import { createRequire as createKoedRequire } from "node:module"; const require = createKoedRequire(import.meta.url);
2
2
  import {
3
3
  productionComponentManifestCatalog
4
- } from "./chunk-XCO3RV3Z.js";
4
+ } from "./chunk-K2KUQRHT.js";
5
5
  import "./chunk-IY2HRXOZ.js";
6
6
  import "./chunk-BTS4ZTF3.js";
7
7
  export {
@@ -3,20 +3,23 @@ import {
3
3
  isKoedServerCliEntrypoint,
4
4
  runKoedServerCli,
5
5
  shouldExitPackagedSupervisor
6
- } from "./chunk-TIBYKMRW.js";
6
+ } from "./chunk-JLYGPZYP.js";
7
7
  import {
8
8
  startKoedServerDaemon
9
- } from "./chunk-7FSHVVTZ.js";
9
+ } from "./chunk-HFGCZ76G.js";
10
10
  import "./chunk-TSAYTRX3.js";
11
11
  import "./chunk-YZLQZU5E.js";
12
+ import "./chunk-26D2DYEJ.js";
12
13
  import "./chunk-OG7G6DIR.js";
13
14
  import {
14
15
  productionComponentManifestCatalog
15
- } from "./chunk-XCO3RV3Z.js";
16
+ } from "./chunk-K2KUQRHT.js";
16
17
  import {
17
18
  productionNativeRuntimeCatalog
18
- } from "./chunk-QV3WPU7A.js";
19
+ } from "./chunk-BTBSSNAR.js";
19
20
  import "./chunk-IY2HRXOZ.js";
21
+ import "./chunk-5ZYY6GLX.js";
22
+ import "./chunk-FSNLU46W.js";
20
23
  import "./chunk-BTS4ZTF3.js";
21
24
  export {
22
25
  isKoedServerCliEntrypoint,