@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
2
  import {
3
3
  resolveKoedHome
4
- } from "./chunk-K2EIFEQF.js";
4
+ } from "./chunk-TSAYTRX3.js";
5
5
  import {
6
6
  createPdsApplicationSecretStore
7
- } from "./chunk-473OA62O.js";
7
+ } from "./chunk-E6YVGIEW.js";
8
8
 
9
9
  // packages/koed-server/dist/application-secret-provider.js
10
10
  import { existsSync } from "node:fs";
@@ -0,0 +1,50 @@
1
+ import { createRequire as createKoedRequire } from "node:module"; const require = createKoedRequire(import.meta.url);
2
+ import {
3
+ activateGeneration,
4
+ assertDirectoryChain,
5
+ cleanupGenerations,
6
+ pinDesktopBundleGenerationForStart,
7
+ pinGenerationForStart,
8
+ readCurrentDesktopGeneration,
9
+ readCurrentDesktopGenerationOrderingEvidence,
10
+ readCurrentGeneration,
11
+ readCurrentGenerationForOwner,
12
+ readCurrentGenerationOrderingEvidence,
13
+ readCurrentRuntimeOwner,
14
+ readDesktopBundleGeneration,
15
+ readDesktopGenerationForCapability,
16
+ removeStaleGenerationPin,
17
+ stageDesktopBundleForRecovery,
18
+ withLifecycleLock,
19
+ withSourceNativeStartLock,
20
+ withStoppedRuntime
21
+ } from "./chunk-UCOHFZ77.js";
22
+ import "./chunk-T6UB5PNX.js";
23
+ import "./chunk-7NXKPDF3.js";
24
+ import "./chunk-XCO3RV3Z.js";
25
+ import "./chunk-7HLNJ2BI.js";
26
+ import "./chunk-VGL5AZN5.js";
27
+ import "./chunk-QV3WPU7A.js";
28
+ import "./chunk-IY2HRXOZ.js";
29
+ import "./chunk-FSNLU46W.js";
30
+ import "./chunk-BTS4ZTF3.js";
31
+ export {
32
+ activateGeneration,
33
+ assertDirectoryChain,
34
+ cleanupGenerations,
35
+ pinDesktopBundleGenerationForStart,
36
+ pinGenerationForStart,
37
+ readCurrentDesktopGeneration,
38
+ readCurrentDesktopGenerationOrderingEvidence,
39
+ readCurrentGeneration,
40
+ readCurrentGenerationForOwner,
41
+ readCurrentGenerationOrderingEvidence,
42
+ readCurrentRuntimeOwner,
43
+ readDesktopBundleGeneration,
44
+ readDesktopGenerationForCapability,
45
+ removeStaleGenerationPin,
46
+ stageDesktopBundleForRecovery,
47
+ withLifecycleLock,
48
+ withSourceNativeStartLock,
49
+ withStoppedRuntime
50
+ };
@@ -93,11 +93,7 @@ function lookupManifestPin(catalog, identity) {
93
93
  return entry.manifestSha256;
94
94
  }
95
95
 
96
- // packages/koed-server/dist/component-manifest-catalog-data.js
97
- var productionComponentManifestCatalog = validateManifestCatalog({ "schemaVersion": 2, "productVersion": "0.10.3", "entries": [{ "component": "base", "manifestSha256": "cfa106faf481eb5a62e5dbe9c90a7447037adbee1996ddca7cd614b142364000", "target": { "platform": "linux", "architecture": "x64", "libc": { "family": "glibc", "minimumVersion": "2.35" } } }, { "component": "base", "manifestSha256": "c4c9052f81cbcd51285c0e35afedffa7e4db976f9e6a2fb45c9658004e84214c", "target": { "platform": "macos", "architecture": "arm64" } }, { "component": "privacy", "variant": "cpu", "manifestSha256": "ae4188f582c5bc6018f76f8e4c830b3cf2ea8baccaa2fb9bc850efc4fd0bd328", "target": { "platform": "linux", "architecture": "x64", "libc": { "family": "glibc", "minimumVersion": "2.35" } } }, { "component": "privacy", "variant": "cuda", "manifestSha256": "6d93a1e8d30643b5afa365a2cd48e3b6554e930b2ca0e71caa9b2fcc1a6f1819", "target": { "platform": "linux", "architecture": "x64", "libc": { "family": "glibc", "minimumVersion": "2.35" } } }, { "component": "privacy", "manifestSha256": "cf6f8fd24cfc42519fcbcd8ff072fc89aa1166aa37acd54add46fdce1f460857", "target": { "platform": "macos", "architecture": "arm64" } }] });
98
-
99
96
  export {
100
97
  validateManifestCatalog,
101
- lookupManifestPin,
102
- productionComponentManifestCatalog
98
+ lookupManifestPin
103
99
  };
@@ -2,7 +2,8 @@ import { createRequire as createKoedRequire } from "node:module"; const require
2
2
 
3
3
  // packages/koed-server/dist/local-models-runtime.js
4
4
  import { createHash } from "node:crypto";
5
- import { createReadStream, createWriteStream, existsSync, mkdirSync, renameSync, rmSync, statSync } from "node:fs";
5
+ import { constants, lstatSync, createWriteStream, mkdirSync, renameSync, rmSync, statSync } from "node:fs";
6
+ import { open } from "node:fs/promises";
6
7
  import { Readable, Transform } from "node:stream";
7
8
  import { pipeline } from "node:stream/promises";
8
9
  import { basename, dirname, resolve } from "node:path";
@@ -57,24 +58,37 @@ var resolveLocalModelManifest = (paths, kind = "embedding", environment = proces
57
58
  defaultSha256: definition.defaultSha256
58
59
  };
59
60
  };
60
- var sha256File = async (path) => {
61
+ var sha256File = async (path, signal) => {
61
62
  const hash = createHash("sha256");
62
- await pipeline(createReadStream(path), hash);
63
+ const file = await open(path, constants.O_RDONLY | constants.O_NONBLOCK);
64
+ try {
65
+ if (!(await file.stat()).isFile())
66
+ throw new Error("The model must be a regular file.");
67
+ await pipeline(file.createReadStream(), hash, { signal });
68
+ } finally {
69
+ await file.close();
70
+ }
63
71
  return hash.digest("hex");
64
72
  };
65
- var collectLocalModelStatus = async (paths, kind = "embedding", environment = process.env) => {
73
+ var collectLocalModelStatus = async (paths, kind = "embedding", environment = process.env, signal) => {
66
74
  const manifest = resolveLocalModelManifest(paths, kind, environment);
67
75
  const mode = dependencyMode(environment);
68
- if (!existsSync(manifest.modelPath)) {
76
+ const file = statSync(manifest.modelPath, { throwIfNoEntry: false });
77
+ if (!file) {
78
+ const dangling = lstatSync(manifest.modelPath, {
79
+ throwIfNoEntry: false
80
+ })?.isSymbolicLink();
69
81
  return {
70
82
  state: "missing",
71
- message: `${manifest.key} model is not installed at ${manifest.modelPath}.`,
83
+ message: dangling ? `${manifest.key} model link at ${manifest.modelPath} points to a missing file.` : `${manifest.key} model is not installed at ${manifest.modelPath}.`,
72
84
  action: mode === "external" ? modelDownloadBlockedAction(manifest) : `Run koed models install --kind ${kind}. Override ${manifest.urlEnv} and ${manifest.sha256Env} only when using a custom model artifact.`,
73
85
  modelPath: manifest.modelPath,
74
86
  manifest
75
87
  };
76
88
  }
77
- const sizeBytes = statSync(manifest.modelPath).size;
89
+ if (!file.isFile())
90
+ throw new Error("The installed model must be a regular file.");
91
+ const sizeBytes = file.size;
78
92
  if (!manifest.sha256) {
79
93
  return {
80
94
  state: "not_configured",
@@ -85,7 +99,7 @@ var collectLocalModelStatus = async (paths, kind = "embedding", environment = pr
85
99
  manifest
86
100
  };
87
101
  }
88
- const actual = await sha256File(manifest.modelPath);
102
+ const actual = await sha256File(manifest.modelPath, signal);
89
103
  if (actual !== manifest.sha256) {
90
104
  return {
91
105
  state: "checksum_mismatch",
@@ -0,0 +1,75 @@
1
+ import { createRequire as createKoedRequire } from "node:module"; const require = createKoedRequire(import.meta.url);
2
+ import {
3
+ aiClientConnectionRevision,
4
+ grantAiClientConnection,
5
+ revokeAiClientConnection
6
+ } from "./chunk-USHFSJT7.js";
7
+
8
+ // packages/koed-server/dist/ai-client-authorization.js
9
+ var clientNames = {
10
+ codex: "Codex",
11
+ claude: "Claude Code",
12
+ pi: "Pi"
13
+ };
14
+ var failed = (result, error) => ({
15
+ ...result,
16
+ ok: false,
17
+ error
18
+ });
19
+ var noteAiClientConnectionRevision = (koedHome, client) => {
20
+ try {
21
+ return aiClientConnectionRevision(koedHome, client);
22
+ } catch {
23
+ revokeAiClientConnection(koedHome, client);
24
+ return aiClientConnectionRevision(koedHome, client);
25
+ }
26
+ };
27
+ var connectAiClientAfterSetup = async ({ client, koedHome, run, verify }) => {
28
+ const name = clientNames[client];
29
+ const revision = noteAiClientConnectionRevision(koedHome, client);
30
+ const result = await run();
31
+ if (!result.ok)
32
+ return result;
33
+ if (result.koedHome !== koedHome)
34
+ return failed(result, `${name} was set up for a different KOED_HOME; capture stays off.`);
35
+ let verified = false;
36
+ try {
37
+ verified = await verify(koedHome);
38
+ } catch {
39
+ verified = false;
40
+ }
41
+ if (!verified)
42
+ return failed(result, `Could not verify the ${name} integration for this KOED_HOME; capture stays off.`);
43
+ let granted = false;
44
+ try {
45
+ granted = grantAiClientConnection(koedHome, client, revision);
46
+ } catch (error) {
47
+ return failed(result, `${name} could not be connected; capture stays off. ${error instanceof Error ? error.message : String(error)}`);
48
+ }
49
+ return granted ? result : failed(result, `${name} changed while setup ran (for example, it was removed); capture stays off. Set it up again to connect it.`);
50
+ };
51
+ var disconnectAiClientThenRemove = ({ client, koedHome, remove }) => {
52
+ let revocationError = null;
53
+ try {
54
+ revokeAiClientConnection(koedHome, client);
55
+ } catch (error) {
56
+ revocationError = error instanceof Error ? error.message : String(error);
57
+ }
58
+ const result = remove();
59
+ if (revocationError !== null)
60
+ return failed(result, `${clientNames[client]} could not be disconnected; Koed may still read its conversations. ${revocationError}`);
61
+ return result;
62
+ };
63
+ var verifyAiClientIntegration = async (client, koedHome, environment, collectStatus, dependencies = {}) => {
64
+ const status = await collectStatus({ ...environment, KOED_HOME: koedHome }, { ...dependencies, revokeAiClientConnection: () => false });
65
+ const inspected = client === "codex" ? status.codex : client === "claude" ? status.claudeCode : status.pi;
66
+ const details = inspected?.details;
67
+ return status.koedHome === koedHome && inspected?.configured === true && (client !== "codex" || details?.configuredKoedHome === koedHome && typeof details.mcpAdapter === "string");
68
+ };
69
+
70
+ export {
71
+ noteAiClientConnectionRevision,
72
+ connectAiClientAfterSetup,
73
+ disconnectAiClientThenRemove,
74
+ verifyAiClientIntegration
75
+ };
@@ -2,7 +2,18 @@ import { createRequire as createKoedRequire } from "node:module"; const require
2
2
  import {
3
3
  calculateRuntimeRequirements,
4
4
  resolveEffectiveRuntimeConfig
5
- } from "./chunk-AFLKCQHF.js";
5
+ } from "./chunk-L4RD3TAZ.js";
6
+ import "./chunk-ALJUSOF7.js";
7
+ import {
8
+ resolveKoedServerPaths
9
+ } from "./chunk-TSAYTRX3.js";
10
+ import "./chunk-YZLQZU5E.js";
11
+ import "./chunk-W2HNI6AA.js";
12
+ import {
13
+ resolveKoedAppRuntimeExecution,
14
+ resolveKoedControlPlaneVersion,
15
+ resolveKoedRuntimeOwner
16
+ } from "./chunk-OG7G6DIR.js";
6
17
  import {
7
18
  activateGeneration,
8
19
  cleanupGenerations,
@@ -17,24 +28,20 @@ import {
17
28
  resolveComponentManifestPinTarget,
18
29
  stageComponent,
19
30
  stageGeneration
20
- } from "./chunk-NM5NXCVM.js";
21
- import "./chunk-G4IIVVJO.js";
31
+ } from "./chunk-UCOHFZ77.js";
32
+ import "./chunk-T6UB5PNX.js";
33
+ import "./chunk-7NXKPDF3.js";
22
34
  import {
23
- resolveKoedAppRuntimeExecution,
24
- resolveKoedControlPlaneVersion,
25
- resolveKoedRuntimeOwner
26
- } from "./chunk-A4NKL2PK.js";
35
+ productionComponentManifestCatalog
36
+ } from "./chunk-XCO3RV3Z.js";
37
+ import "./chunk-7HLNJ2BI.js";
38
+ import "./chunk-VGL5AZN5.js";
39
+ import "./chunk-QV3WPU7A.js";
27
40
  import {
28
- productionComponentManifestCatalog,
29
41
  validateManifestCatalog
30
- } from "./chunk-QIIKMG3M.js";
31
- import "./chunk-2DA7EFZV.js";
32
- import {
33
- resolveKoedServerPaths
34
- } from "./chunk-K2EIFEQF.js";
35
- import "./chunk-UI5RLBKQ.js";
36
- import "./chunk-W2HNI6AA.js";
37
- import "./chunk-473OA62O.js";
42
+ } from "./chunk-IY2HRXOZ.js";
43
+ import "./chunk-E6YVGIEW.js";
44
+ import "./chunk-FSNLU46W.js";
38
45
  import "./chunk-BTS4ZTF3.js";
39
46
 
40
47
  // packages/koed-server/dist/cli-component-operations.js
@@ -1,13 +1,13 @@
1
1
  import { createRequire as createKoedRequire } from "node:module"; const require = createKoedRequire(import.meta.url);
2
2
  import {
3
3
  resolveKoedServerConfig
4
- } from "./chunk-NM5NXCVM.js";
4
+ } from "./chunk-ALJUSOF7.js";
5
5
  import {
6
6
  parseEnvFile
7
7
  } from "./chunk-W2HNI6AA.js";
8
8
  import {
9
9
  resolveTeamCollaborationEnabled
10
- } from "./chunk-473OA62O.js";
10
+ } from "./chunk-E6YVGIEW.js";
11
11
 
12
12
  // packages/koed-server/dist/effective-runtime-config.js
13
13
  import { existsSync, readFileSync } from "node:fs";
@@ -9,7 +9,7 @@ import {
9
9
  hostProofReferenceFor,
10
10
  inspectDeviceIdentity,
11
11
  serializeHostProof
12
- } from "./chunk-473OA62O.js";
12
+ } from "./chunk-E6YVGIEW.js";
13
13
  import {
14
14
  __toESM
15
15
  } from "./chunk-BTS4ZTF3.js";
@@ -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-2S3OGPUC.js";
4
+ } from "./chunk-GY5GATZL.js";
5
5
  import {
6
6
  ensureDeviceIdentity
7
- } from "./chunk-XNFVSVBS.js";
7
+ } from "./chunk-LHUMBHG7.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-473OA62O.js";
30
+ } from "./chunk-E6YVGIEW.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";
@@ -74,7 +74,7 @@ var packagedRuntime = (selection, requirements, exists) => {
74
74
  const mcpCli = resolve(root, "mcp-server/dist/cli.js");
75
75
  const localAiRuntime = resolve(root, "mcp-server/dist/local-runtime-cli.js");
76
76
  const captureHook = resolve(root, "mcp-server/dist/capture-hook.js");
77
- const dbPackageRoot = resolve(root, "node_modules/@koed/db");
77
+ const dbPackageRoot = resolve(root, "node_modules/@koed-labs/db");
78
78
  const required = [
79
79
  ...selection ? [] : ["authenticated base generation"],
80
80
  ...requirements.processes.includes("api") ? [apiEntry] : [],
@@ -6,14 +6,15 @@ import {
6
6
  personalSyncProviderEnvironment,
7
7
  redeemPairingLink,
8
8
  runPersonalSyncCommand
9
- } from "./chunk-J2L726BC.js";
10
- import "./chunk-2S3OGPUC.js";
11
- import "./chunk-XNFVSVBS.js";
12
- import "./chunk-7NXKPDF3.js";
13
- import "./chunk-K2EIFEQF.js";
14
- import "./chunk-UI5RLBKQ.js";
9
+ } from "./chunk-NGV45YWB.js";
10
+ import "./chunk-GY5GATZL.js";
11
+ import "./chunk-LHUMBHG7.js";
12
+ import "./chunk-TSAYTRX3.js";
13
+ import "./chunk-YZLQZU5E.js";
15
14
  import "./chunk-W2HNI6AA.js";
16
- import "./chunk-473OA62O.js";
15
+ import "./chunk-7NXKPDF3.js";
16
+ import "./chunk-E6YVGIEW.js";
17
+ import "./chunk-FSNLU46W.js";
17
18
  import "./chunk-BTS4ZTF3.js";
18
19
  export {
19
20
  decryptRecoveryKit,
@@ -0,0 +1,8 @@
1
+ import { createRequire as createKoedRequire } from "node:module"; const require = createKoedRequire(import.meta.url);
2
+
3
+ // packages/koed-server/dist/native-runtime-catalog-data.mjs
4
+ var productionNativeRuntimeCatalog = { "schemaVersion": 2, "linux": { "schemaVersion": 1, "minimumCoreVersion": "0.10.3", "core": { "recipeId": "f4ff165a91e23eae1278c93ee7a72376cc4e7418eea30c16ee6561cde66690e6", "runtimeVersion": "1.0.0", "url": "https://github.com/koed-labs/koed/releases/download/v1.0.0/koed-native-core-f4ff165a91e23eae1278c93ee7a72376cc4e7418eea30c16ee6561cde66690e6-linux-x64.tar.gz", "sha256": "1e46555a37e69f20838fc7a78340e8519146fa20e8eb269261e638291dcbd98e", "manifestSha256": "4a6d8968f6505e6338d66f9bc039635fcc5a42c0ac39494f07be17fc6f43bc7d", "target": { "platform": "linux", "architecture": "x64", "libc": { "family": "glibc", "minimumVersion": "2.35" } }, "archiveBytes": 23988967, "expandedBytes": 56990678, "contracts": { "layout": 1, "embedding": 1, "postgres": 1 }, "components": { "postgres": { "major": 17, "version": "17.6" }, "pgvector": { "version": "0.8.3" }, "llamaCpp": { "version": "b10514", "revision": "7221e24f579efbb5fd2a2ced1fffaef1aff2fe0d" } } }, "cuda": { "recipeId": "16722edc4647561a6615063cd1ad29bcf4da8ec9bc2666847069441f592a7f93", "runtimeVersion": "1.0.0", "url": "https://github.com/koed-labs/koed/releases/download/v1.0.0/koed-native-cuda-16722edc4647561a6615063cd1ad29bcf4da8ec9bc2666847069441f592a7f93-linux-x64.tar.gz", "sha256": "b63eca8bb05e1ef37e38bcd3d70edda3edb9b0fe984a35e9f18aa77fb4b07188", "manifestSha256": "47de6e6876ead9bf052477249f0a7ccaffba615de5daf9506a87ef9c4055eba6", "target": { "platform": "linux", "architecture": "x64", "libc": { "family": "glibc", "minimumVersion": "2.35" } }, "archiveBytes": 711354383, "expandedBytes": 1467990043, "contracts": { "layout": 1, "embedding": 1 }, "llamaCpp": { "version": "b10514", "revision": "7221e24f579efbb5fd2a2ced1fffaef1aff2fe0d" }, "cuda": { "toolkitVersion": "12.4", "minimumDriverLinux": "550.54.14", "architectures": [75, 80, 86, 89, 90] } } }, "macos": { "schemaVersion": 1, "minimumCoreVersion": "1.0.0", "core": { "recipeId": "ec948b5a248b7077990175488b0c0165998a0ebbd11f37339433f44b4d68c8ff", "runtimeVersion": "1.0.0", "url": "https://github.com/koed-labs/koed/releases/download/v1.0.0/koed-native-core-ec948b5a248b7077990175488b0c0165998a0ebbd11f37339433f44b4d68c8ff-macos-arm64.tar.gz", "sha256": "9e7ee080a41caeee6513b866bb1ef446de2cc4aedfd2d5ef010b1377f2673390", "manifestSha256": "71a86c5cb72abd432250bb28c7523e44865289c9d6de7f8ab1ad7bf416d8d415", "target": { "platform": "macos", "architecture": "arm64", "minimumVersion": "14.0" }, "archiveBytes": 35071036, "expandedBytes": 76669484, "contracts": { "layout": 1, "embedding": 1, "postgres": 1 }, "components": { "postgres": { "major": 17, "version": "17.6" }, "pgvector": { "version": "0.8.3" }, "llamaCpp": { "version": "b10514" } } }, "cuda": null } };
5
+
6
+ export {
7
+ productionNativeRuntimeCatalog
8
+ };
@@ -7,8 +7,9 @@ import {
7
7
  installPrivacyModel,
8
8
  materializePrivacyModelCacheEntry,
9
9
  resolvePrivacyModelPaths
10
- } from "./chunk-VPC5NLZG.js";
11
- import "./chunk-473OA62O.js";
10
+ } from "./chunk-4DHYSJJT.js";
11
+ import "./chunk-E6YVGIEW.js";
12
+ import "./chunk-FSNLU46W.js";
12
13
  import "./chunk-BTS4ZTF3.js";
13
14
  export {
14
15
  PRIVACY_MODEL_FILES,
@@ -12,10 +12,11 @@ import {
12
12
  updateUpstreamBackendRoutePolicy,
13
13
  upstreamBackendAdvertisesCapability,
14
14
  upstreamBackendSupportsTeamMemoryAnswerTasks
15
- } from "./chunk-YJWREXN6.js";
15
+ } from "./chunk-WBMO7YCO.js";
16
16
  import {
17
17
  isTeamMemoryAnswerTaskCapability
18
- } from "./chunk-473OA62O.js";
18
+ } from "./chunk-E6YVGIEW.js";
19
+ import "./chunk-FSNLU46W.js";
19
20
  import "./chunk-BTS4ZTF3.js";
20
21
  export {
21
22
  clearUpstreamBackendCapabilities,
@@ -1,7 +1,39 @@
1
1
  import { createRequire as createKoedRequire } from "node:module"; const require = createKoedRequire(import.meta.url);
2
+ import {
3
+ require_proper_lockfile
4
+ } from "./chunk-7NXKPDF3.js";
5
+ import {
6
+ __toESM
7
+ } from "./chunk-BTS4ZTF3.js";
8
+
9
+ // packages/koed-server/dist/file-lock.js
10
+ var import_proper_lockfile = __toESM(require_proper_lockfile(), 1);
11
+ import { mkdirSync } from "node:fs";
12
+ import { dirname } from "node:path";
13
+ var withFileLock = (file, operation) => {
14
+ mkdirSync(dirname(file), { recursive: true, mode: 448 });
15
+ const deadline = Date.now() + 5e3;
16
+ let release;
17
+ while (true) {
18
+ try {
19
+ release = import_proper_lockfile.default.lockSync(file, { realpath: false, stale: 3e4 });
20
+ break;
21
+ } catch (error) {
22
+ if (error.code !== "ELOCKED" || Date.now() >= deadline)
23
+ throw error;
24
+ Atomics.wait(new Int32Array(new SharedArrayBuffer(4)), 0, 0, 10);
25
+ }
26
+ }
27
+ try {
28
+ return operation();
29
+ } finally {
30
+ release();
31
+ }
32
+ };
2
33
 
3
34
  // packages/koed-server/dist/runtime-state.js
4
- import { readFileSync as nodeReadFileSync } from "node:fs";
35
+ import { randomUUID } from "node:crypto";
36
+ import { readFileSync as nodeReadFileSync, renameSync, rmSync, writeFileSync } from "node:fs";
5
37
 
6
38
  // packages/koed-server/dist/process-liveness.js
7
39
  var isProcessRunning = (pid) => {
@@ -25,15 +57,48 @@ var validHttpUrl = (value) => {
25
57
  }
26
58
  };
27
59
  var validProcessMap = (value) => value === void 0 || isRecord(value) && Object.values(value).every((pid) => typeof pid === "number" && Number.isInteger(pid) && pid >= 0);
60
+ var validIdentityMap = (value) => value === void 0 || isRecord(value) && Object.values(value).every((identity) => typeof identity === "string" && identity.length > 0);
28
61
  var validRuntimeState = (value) => {
29
62
  if (!isRecord(value))
30
63
  return false;
31
64
  const validRuntimeMode = value.runtimeMode === void 0 || value.runtimeMode === "local-personal" || value.runtimeMode === "external" || value.runtimeMode === "developer";
32
65
  const validDependencyMode = value.dependencyMode === void 0 || value.dependencyMode === "bundled-local" || value.dependencyMode === "external";
33
66
  const validAutomaticPorts = value.automaticPorts === void 0 || typeof value.automaticPorts === "boolean";
34
- return typeof value.pid === "number" && Number.isInteger(value.pid) && value.pid > 0 && typeof value.startedAt === "string" && !Number.isNaN(Date.parse(value.startedAt)) && typeof value.repoRoot === "string" && Boolean(value.repoRoot.trim()) && validHttpUrl(value.apiUrl) && Array.isArray(value.services) && value.services.every((service) => typeof service === "string") && validRuntimeMode && validDependencyMode && validAutomaticPorts && validProcessMap(value.processes);
67
+ return typeof value.pid === "number" && Number.isInteger(value.pid) && value.pid > 0 && typeof value.startedAt === "string" && !Number.isNaN(Date.parse(value.startedAt)) && typeof value.repoRoot === "string" && Boolean(value.repoRoot.trim()) && validHttpUrl(value.apiUrl) && Array.isArray(value.services) && value.services.every((service) => typeof service === "string") && validRuntimeMode && validDependencyMode && validAutomaticPorts && validProcessMap(value.processes) && validIdentityMap(value.processIdentities);
35
68
  };
36
69
  var isRuntimeGenerationState = (value) => isRecord(value) && (Object.keys(value).length === 7 || Object.keys(value).length === 8 && ["manifest-pinned-store", "signed-store", "desktop-bundle"].includes(String(value.source))) && value.schemaVersion === 1 && typeof value.generationId === "string" && /^[a-f0-9]{64}$/.test(value.generationId) && typeof value.pid === "number" && Number.isInteger(value.pid) && value.pid > 0 && typeof value.processIdentity === "string" && value.processIdentity.length > 0 && typeof value.startedAt === "string" && !Number.isNaN(Date.parse(value.startedAt)) && isRecord(value.owner) && Object.keys(value.owner).length === 2 && ["cli", "desktop", "standalone"].includes(String(value.owner.kind)) && typeof value.owner.installationId === "string" && /^[A-Za-z0-9._-]{1,128}$/.test(value.owner.installationId) && typeof value.pinToken === "string" && /^[a-f0-9]{64}$/.test(value.pinToken);
70
+ function writeRuntimeState(path, state) {
71
+ withFileLock(path, () => {
72
+ const temporary = `${path}.${randomUUID()}.tmp`;
73
+ try {
74
+ writeFileSync(temporary, `${JSON.stringify(state, null, 2)}
75
+ `, {
76
+ flag: "wx",
77
+ mode: 384
78
+ });
79
+ renameSync(temporary, path);
80
+ } finally {
81
+ rmSync(temporary, { force: true });
82
+ }
83
+ });
84
+ }
85
+ function removeOwnedRuntimeState(path, owner, read = nodeReadFileSync, remove = rmSync) {
86
+ return withFileLock(path, () => {
87
+ let contents;
88
+ try {
89
+ contents = read(path, "utf8");
90
+ } catch (error) {
91
+ if (error.code === "ENOENT")
92
+ return true;
93
+ throw error;
94
+ }
95
+ const state = JSON.parse(contents);
96
+ if (!isRecord(state) || state.pid !== owner.pid || state.startedAt !== owner.startedAt)
97
+ return false;
98
+ remove(path, { force: true });
99
+ return true;
100
+ });
101
+ }
37
102
  var readActiveRuntimeState = (path, readFileSync = nodeReadFileSync, checkPid = isProcessRunning) => {
38
103
  try {
39
104
  const parsed = JSON.parse(String(readFileSync(path, "utf8")));
@@ -50,7 +115,10 @@ var applyActiveRuntimeUrls = (environment, runtime) => ({
50
115
 
51
116
  export {
52
117
  isProcessRunning,
118
+ withFileLock,
53
119
  isRuntimeGenerationState,
120
+ writeRuntimeState,
121
+ removeOwnedRuntimeState,
54
122
  readActiveRuntimeState,
55
123
  applyActiveRuntimeUrls
56
124
  };
@@ -1,4 +1,10 @@
1
1
  import { createRequire as createKoedRequire } from "node:module"; const require = createKoedRequire(import.meta.url);
2
+ import {
3
+ ensureDeviceIdentity
4
+ } from "./chunk-LHUMBHG7.js";
5
+ import {
6
+ require_proper_lockfile
7
+ } from "./chunk-7NXKPDF3.js";
2
8
  import {
3
9
  beginUpstreamDisconnectCleanup,
4
10
  clearUpstreamBackendCapabilities,
@@ -13,13 +19,7 @@ import {
13
19
  upstreamBackendAdvertisesCapability,
14
20
  upstreamBackendSupportsTeamMemoryAnswerTasks,
15
21
  upstreamDisconnectCleanupPending
16
- } from "./chunk-YJWREXN6.js";
17
- import {
18
- ensureDeviceIdentity
19
- } from "./chunk-XNFVSVBS.js";
20
- import {
21
- require_proper_lockfile
22
- } from "./chunk-7NXKPDF3.js";
22
+ } from "./chunk-WBMO7YCO.js";
23
23
  import {
24
24
  assertSecureHttpTransport,
25
25
  deleteLocalEdgeClientCredential,
@@ -30,7 +30,7 @@ import {
30
30
  storeLocalEdgeClientCredential,
31
31
  storeUpstreamCredentialSecret,
32
32
  upstreamCredentialReferenceFor
33
- } from "./chunk-473OA62O.js";
33
+ } from "./chunk-E6YVGIEW.js";
34
34
  import {
35
35
  __toESM
36
36
  } from "./chunk-BTS4ZTF3.js";