@koed-labs/server 1.0.0 → 1.2.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 (41) hide show
  1. package/README.md +3 -3
  2. package/package.json +1 -1
  3. package/vendor/chunk-2YCDKSKW.js +45 -0
  4. package/vendor/{chunk-F7AMEDDU.js → chunk-355BP3MF.js} +4 -4
  5. package/vendor/{chunk-WBMO7YCO.js → chunk-3VNLZCMB.js} +1 -1
  6. package/vendor/{chunk-EEBIYWTE.js → chunk-7YXEB2CR.js} +17 -16
  7. package/vendor/{chunk-LHUMBHG7.js → chunk-A2TMTAAS.js} +1 -1
  8. package/vendor/{chunk-VLP72QWX.js → chunk-AJPFOTVX.js} +1 -1
  9. package/vendor/{chunk-W6632NOX.js → chunk-BDJR6CKS.js} +4 -3
  10. package/vendor/{chunk-DWWMBGHX.js → chunk-BMHMNUNK.js} +17 -16
  11. package/vendor/{chunk-BYN6KXNP.js → chunk-CSDTMMRL.js} +4 -4
  12. package/vendor/{chunk-TIBYKMRW.js → chunk-CX73L6YS.js} +36 -43
  13. package/vendor/{chunk-273NMYXE.js → chunk-D4XZTNLU.js} +8 -7
  14. package/vendor/{chunk-64AST7WZ.js → chunk-DQ5SIGZZ.js} +3 -1
  15. package/vendor/{chunk-4DHYSJJT.js → chunk-G54Q5W6M.js} +1 -1
  16. package/vendor/{chunk-GY5GATZL.js → chunk-GEIN6UIL.js} +7 -2
  17. package/vendor/{chunk-VGL5AZN5.js → chunk-H7ETSD25.js} +1 -1
  18. package/vendor/{chunk-OZU6JFB4.js → chunk-HG47LAWW.js} +5 -4
  19. package/vendor/{chunk-Y6GE52OP.js → chunk-HXL36SED.js} +18 -17
  20. package/vendor/{chunk-UCOHFZ77.js → chunk-I5XO5FL4.js} +2 -2
  21. package/vendor/{chunk-XKXSC6YS.js → chunk-J7LW6JFY.js} +21 -13
  22. package/vendor/{chunk-KRBZZ6GS.js → chunk-JG7OELJM.js} +8 -8
  23. package/vendor/{chunk-KG3RANR4.js → chunk-KBECHDUE.js} +1 -1
  24. package/vendor/{chunk-AOZ3LMTF.js → chunk-KH4UBONI.js} +3 -2
  25. package/vendor/{chunk-7HLNJ2BI.js → chunk-MFPPURFE.js} +1 -1
  26. package/vendor/{chunk-F77ZTTNS.js → chunk-MHFYPBCL.js} +3 -3
  27. package/vendor/{chunk-54UL4U2E.js → chunk-TAQWNZVD.js} +77 -20
  28. package/vendor/{chunk-ILQVLZ2I.js → chunk-TMCW2P6G.js} +5 -5
  29. package/vendor/{chunk-QV3WPU7A.js → chunk-ULLAURFV.js} +1 -1
  30. package/vendor/{chunk-T7OGE5E5.js → chunk-ULUSFNAE.js} +3 -3
  31. package/vendor/{chunk-E6YVGIEW.js → chunk-VWB3VEOL.js} +468 -12
  32. package/vendor/{chunk-UIMUUIH7.js → chunk-XPSPPLX5.js} +13 -13
  33. package/vendor/{chunk-L4RD3TAZ.js → chunk-XSOQ2U5H.js} +2 -2
  34. package/vendor/{chunk-USHFSJT7.js → chunk-XTQYFCVY.js} +10 -8
  35. package/vendor/{chunk-NGV45YWB.js → chunk-XW7AXRDI.js} +3 -3
  36. package/vendor/{chunk-SQZ2OSP6.js → chunk-Y5OJXAUF.js} +2 -2
  37. package/vendor/{chunk-XCO3RV3Z.js → chunk-YDZEMIAH.js} +1 -1
  38. package/vendor/{chunk-S6HD3MDU.js → chunk-YOMK7KMB.js} +2 -2
  39. package/vendor/{chunk-ALJUSOF7.js → chunk-YY7NMZGD.js} +79 -1
  40. package/vendor/component-manifest-catalog.js +1 -1
  41. package/vendor/control-plane.js +5 -3
@@ -11,10 +11,10 @@ import {
11
11
  import {
12
12
  resolveKoedServerConfig,
13
13
  writeCodexGlobalMemoryGuidancePreference
14
- } from "./chunk-ALJUSOF7.js";
14
+ } from "./chunk-YY7NMZGD.js";
15
15
  import {
16
16
  inspectDeviceIdentityStatus
17
- } from "./chunk-LHUMBHG7.js";
17
+ } from "./chunk-A2TMTAAS.js";
18
18
  import {
19
19
  ensureKoedHome,
20
20
  resolveKoedServerPaths
@@ -43,7 +43,7 @@ import {
43
43
  readDesktopBundleGeneration,
44
44
  resolveDesktopRuntimeOwner,
45
45
  validateDesktopRuntimeCapability
46
- } from "./chunk-UCOHFZ77.js";
46
+ } from "./chunk-I5XO5FL4.js";
47
47
  import {
48
48
  applyActiveRuntimeUrls,
49
49
  isProcessRunning,
@@ -55,10 +55,10 @@ import {
55
55
  import {
56
56
  collectPrivacyModelStatus,
57
57
  resolvePrivacyModelPaths
58
- } from "./chunk-4DHYSJJT.js";
58
+ } from "./chunk-G54Q5W6M.js";
59
59
  import {
60
60
  collectUpstreamRegistryStatus
61
- } from "./chunk-WBMO7YCO.js";
61
+ } from "./chunk-3VNLZCMB.js";
62
62
  import {
63
63
  DESKTOP_LOCAL_CREDENTIAL_OPERATION_FAMILIES,
64
64
  LOCAL_PERSONAL_USER_EMAIL,
@@ -74,7 +74,7 @@ import {
74
74
  storeDesktopLocalCredential,
75
75
  summarizeHistoricalIngestionState,
76
76
  upgradeDesktopLocalCredential
77
- } from "./chunk-E6YVGIEW.js";
77
+ } from "./chunk-VWB3VEOL.js";
78
78
  import {
79
79
  __toESM
80
80
  } from "./chunk-BTS4ZTF3.js";
@@ -572,6 +572,7 @@ var collectLocalEmbeddingRuntimeStatus = async (paths, environment = process.env
572
572
  };
573
573
  }
574
574
  };
575
+ var embeddingServiceLeadsProcessGroup = (paths, platform = process.platform) => Boolean(paths.nativeSelectionRoot) || platform !== "win32";
575
576
  var startLocalEmbeddingRuntime = (paths, environment = process.env, dependencies = {}) => {
576
577
  const exists = dependencies.existsSync ?? existsSync3;
577
578
  const spawn = dependencies.spawn ?? nodeSpawn;
@@ -587,8 +588,8 @@ var startLocalEmbeddingRuntime = (paths, environment = process.env, dependencies
587
588
  }
588
589
  const child = spawn(process.execPath, [runtime.serviceEntry], {
589
590
  cwd: runtime.appDir,
590
- // The release supervisor can stop its owned llama-server descendants together.
591
- ...paths.nativeSelectionRoot ? { detached: true } : {},
591
+ // koed-server stops its owned llama-server descendants with the group.
592
+ ...embeddingServiceLeadsProcessGroup(paths) ? { detached: true } : {},
592
593
  env,
593
594
  stdio: "inherit"
594
595
  });
@@ -5490,6 +5491,7 @@ export {
5490
5491
  grantAiClientConnection,
5491
5492
  revokeAiClientConnection,
5492
5493
  nativeLlamaServerOverride,
5494
+ embeddingServiceLeadsProcessGroup,
5493
5495
  startLocalEmbeddingRuntime,
5494
5496
  startLocalPrivacyRuntime,
5495
5497
  inspectPi,
@@ -1,10 +1,10 @@
1
1
  import { createRequire as createKoedRequire } from "node:module"; const require = createKoedRequire(import.meta.url);
2
2
  import {
3
3
  runApplicationSecretProvider
4
- } from "./chunk-GY5GATZL.js";
4
+ } from "./chunk-GEIN6UIL.js";
5
5
  import {
6
6
  ensureDeviceIdentity
7
- } from "./chunk-LHUMBHG7.js";
7
+ } from "./chunk-A2TMTAAS.js";
8
8
  import {
9
9
  loadRepoEnv,
10
10
  resolveApiUrl
@@ -27,7 +27,7 @@ import {
27
27
  signPdsRecord,
28
28
  validatePdsGroupStatement,
29
29
  validatePdsKeyBundle
30
- } from "./chunk-E6YVGIEW.js";
30
+ } from "./chunk-VWB3VEOL.js";
31
31
 
32
32
  // packages/koed-server/dist/personal-sync.js
33
33
  import { createCipheriv as createCipheriv2, createDecipheriv as createDecipheriv2, createHash as createHash2, generateKeyPairSync, randomBytes as randomBytes2, randomUUID as randomUUID2, scryptSync, sign } from "node:crypto";
@@ -12,10 +12,10 @@ import {
12
12
  updateUpstreamBackendRoutePolicy,
13
13
  upstreamBackendAdvertisesCapability,
14
14
  upstreamBackendSupportsTeamMemoryAnswerTasks
15
- } from "./chunk-WBMO7YCO.js";
15
+ } from "./chunk-3VNLZCMB.js";
16
16
  import {
17
17
  isTeamMemoryAnswerTaskCapability
18
- } from "./chunk-E6YVGIEW.js";
18
+ } from "./chunk-VWB3VEOL.js";
19
19
  import "./chunk-FSNLU46W.js";
20
20
  import "./chunk-BTS4ZTF3.js";
21
21
  export {
@@ -4,7 +4,7 @@ import {
4
4
  } from "./chunk-IY2HRXOZ.js";
5
5
 
6
6
  // packages/koed-server/dist/component-manifest-catalog-data.js
7
- var productionComponentManifestCatalog = validateManifestCatalog({ "schemaVersion": 2, "productVersion": "1.0.0", "entries": [{ "component": "base", "manifestSha256": "0cf17d418882012bbcc43df60e2856e88b477f01f970b588658d40f7542d42d3", "target": { "platform": "linux", "architecture": "x64", "libc": { "family": "glibc", "minimumVersion": "2.35" } } }, { "component": "base", "manifestSha256": "eda39274ee6e865716b2e7ae21bc77bdc23e9c6ccaf15342f1a084e1c11fae00", "target": { "platform": "macos", "architecture": "arm64" } }, { "component": "privacy", "variant": "cpu", "manifestSha256": "c5d623196ed957adf7eb9cc5b9a9b75e1e51a393b4878288a46bc40b13ef8602", "target": { "platform": "linux", "architecture": "x64", "libc": { "family": "glibc", "minimumVersion": "2.35" } } }, { "component": "privacy", "variant": "cuda", "manifestSha256": "7b487834eccc09a12d516c6da63db691214cac4d52c72484afe9461e11759bbf", "target": { "platform": "linux", "architecture": "x64", "libc": { "family": "glibc", "minimumVersion": "2.35" } } }, { "component": "privacy", "manifestSha256": "832b587bd1f17047519031d6a5e56e4406c2ac322bea4fdeff7f98fbc7d5a51f", "target": { "platform": "macos", "architecture": "arm64" } }] });
7
+ var productionComponentManifestCatalog = validateManifestCatalog({ "schemaVersion": 2, "productVersion": "1.2.0", "entries": [{ "component": "base", "manifestSha256": "4ef8f77745b76f102c40465d5be451ec12108d0ed511ed0d2dfe53e0b8880508", "target": { "platform": "linux", "architecture": "x64", "libc": { "family": "glibc", "minimumVersion": "2.35" } } }, { "component": "base", "manifestSha256": "164d6e7c0791b218cc885f5e2d01719f242574e1ab7721fa704b08e558524d4d", "target": { "platform": "macos", "architecture": "arm64" } }, { "component": "privacy", "variant": "cpu", "manifestSha256": "1c19d70c442fce3b9305e63eeed7c9558d38d349dfff8d198fcdaff40044e254", "target": { "platform": "linux", "architecture": "x64", "libc": { "family": "glibc", "minimumVersion": "2.35" } } }, { "component": "privacy", "variant": "cuda", "manifestSha256": "dd5d2ca420974e284d84a0f152e3883d52a4d936672539c5b05697bce0779cde", "target": { "platform": "linux", "architecture": "x64", "libc": { "family": "glibc", "minimumVersion": "2.35" } } }, { "component": "privacy", "manifestSha256": "d8b3fabe90ecb4aa8c179f4628793dd6e775795ec38c4484201b12a3a720787f", "target": { "platform": "macos", "architecture": "arm64" } }] });
8
8
 
9
9
  export {
10
10
  productionComponentManifestCatalog
@@ -7,8 +7,8 @@ import {
7
7
  installPrivacyModel,
8
8
  materializePrivacyModelCacheEntry,
9
9
  resolvePrivacyModelPaths
10
- } from "./chunk-4DHYSJJT.js";
11
- import "./chunk-E6YVGIEW.js";
10
+ } from "./chunk-G54Q5W6M.js";
11
+ import "./chunk-VWB3VEOL.js";
12
12
  import "./chunk-FSNLU46W.js";
13
13
  import "./chunk-BTS4ZTF3.js";
14
14
  export {
@@ -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-YDZEMIAH.js";
5
5
  import "./chunk-IY2HRXOZ.js";
6
6
  import "./chunk-BTS4ZTF3.js";
7
7
  export {
@@ -3,7 +3,7 @@ import {
3
3
  isKoedServerCliEntrypoint,
4
4
  runKoedServerCli,
5
5
  shouldExitPackagedSupervisor
6
- } from "./chunk-TIBYKMRW.js";
6
+ } from "./chunk-CX73L6YS.js";
7
7
  import {
8
8
  startKoedServerDaemon
9
9
  } from "./chunk-7FSHVVTZ.js";
@@ -12,11 +12,13 @@ import "./chunk-YZLQZU5E.js";
12
12
  import "./chunk-OG7G6DIR.js";
13
13
  import {
14
14
  productionComponentManifestCatalog
15
- } from "./chunk-XCO3RV3Z.js";
15
+ } from "./chunk-YDZEMIAH.js";
16
16
  import {
17
17
  productionNativeRuntimeCatalog
18
- } from "./chunk-QV3WPU7A.js";
18
+ } from "./chunk-ULLAURFV.js";
19
19
  import "./chunk-IY2HRXOZ.js";
20
+ import "./chunk-VWB3VEOL.js";
21
+ import "./chunk-FSNLU46W.js";
20
22
  import "./chunk-BTS4ZTF3.js";
21
23
  export {
22
24
  isKoedServerCliEntrypoint,