@koed-labs/server 0.11.1 → 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 (45) 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-VGIYSDNU.js → chunk-273NMYXE.js} +115 -32
  5. package/vendor/{chunk-4OO6VAU3.js → chunk-4DHYSJJT.js} +1 -1
  6. package/vendor/{chunk-WDFERJG3.js → chunk-54UL4U2E.js} +42 -23
  7. package/vendor/{chunk-W2OJZZ6X.js → chunk-64AST7WZ.js} +2 -2
  8. package/vendor/{chunk-ZIOKV2X6.js → chunk-7HLNJ2BI.js} +113 -33
  9. package/vendor/{chunk-2XKSVKQA.js → chunk-AOZ3LMTF.js} +2 -2
  10. package/vendor/{chunk-C5SNDPAP.js → chunk-BYN6KXNP.js} +4 -4
  11. package/vendor/{chunk-Z5WCAUA6.js → chunk-DWWMBGHX.js} +16 -16
  12. package/vendor/{chunk-ZOHNXUDY.js → chunk-E6YVGIEW.js} +25 -8
  13. package/vendor/{chunk-NVTMIAAF.js → chunk-EEBIYWTE.js} +16 -16
  14. package/vendor/{chunk-GFASBPV2.js → chunk-F77ZTTNS.js} +3 -3
  15. package/vendor/{chunk-TG26CZGQ.js → chunk-F7AMEDDU.js} +4 -4
  16. package/vendor/{chunk-EA4QDDQA.js → chunk-GY5GATZL.js} +1 -1
  17. package/vendor/{chunk-HC76426R.js → chunk-ILQVLZ2I.js} +7 -5
  18. package/vendor/{chunk-6KS67EQE.js → chunk-KG3RANR4.js} +1 -1
  19. package/vendor/{chunk-OCILJ737.js → chunk-KRBZZ6GS.js} +8 -8
  20. package/vendor/{chunk-SHLRINKO.js → chunk-L4RD3TAZ.js} +1 -1
  21. package/vendor/{chunk-SRKIBFOE.js → chunk-LHUMBHG7.js} +1 -1
  22. package/vendor/{chunk-CHMH4LH5.js → chunk-NGV45YWB.js} +3 -3
  23. package/vendor/{chunk-V67IQB7H.js → chunk-OG7G6DIR.js} +1 -1
  24. package/vendor/{chunk-NOU7RHYZ.js → chunk-OZU6JFB4.js} +4 -4
  25. package/vendor/chunk-QV3WPU7A.js +8 -0
  26. package/vendor/{chunk-BUIM2M4R.js → chunk-S6HD3MDU.js} +2 -2
  27. package/vendor/{chunk-SNKWETM5.js → chunk-SQZ2OSP6.js} +2 -2
  28. package/vendor/{chunk-WPIEF4LY.js → chunk-T7OGE5E5.js} +3 -3
  29. package/vendor/{chunk-FYYRFX4U.js → chunk-TIBYKMRW.js} +74 -38
  30. package/vendor/{chunk-FN3HUUO2.js → chunk-UCOHFZ77.js} +73 -13
  31. package/vendor/{chunk-LRP66XEY.js → chunk-UIMUUIH7.js} +13 -13
  32. package/vendor/{chunk-EDPNYIX5.js → chunk-USHFSJT7.js} +141 -86
  33. package/vendor/{chunk-QRKHHWJJ.js → chunk-VGL5AZN5.js} +51 -3
  34. package/vendor/{chunk-PL3LWC5C.js → chunk-VLP72QWX.js} +1 -1
  35. package/vendor/{chunk-O7DW2VAV.js → chunk-W6632NOX.js} +3 -3
  36. package/vendor/{chunk-RCR4XPE3.js → chunk-WBMO7YCO.js} +1 -1
  37. package/vendor/chunk-XCO3RV3Z.js +11 -0
  38. package/vendor/{chunk-TVYEB2GN.js → chunk-XKXSC6YS.js} +34 -4
  39. package/vendor/{chunk-C4V72GXC.js → chunk-Y6GE52OP.js} +17 -17
  40. package/vendor/{chunk-BGENSONI.js → chunk-ZKKWLLPU.js} +1 -1
  41. package/vendor/cli.js +1 -1
  42. package/vendor/component-manifest-catalog.js +1 -1
  43. package/vendor/control-plane.js +4 -4
  44. package/vendor/chunk-7EGSY3E4.js +0 -8
  45. package/vendor/chunk-ZUDSZGVO.js +0 -11
@@ -1,14 +1,14 @@
1
1
  import { createRequire as createKoedRequire } from "node:module"; const require = createKoedRequire(import.meta.url);
2
2
  import {
3
3
  nativeKind
4
- } from "./chunk-QRKHHWJJ.js";
4
+ } from "./chunk-VGL5AZN5.js";
5
5
  import {
6
6
  lookupManifestPin
7
7
  } from "./chunk-IY2HRXOZ.js";
8
8
 
9
9
  // packages/koed-server/dist/native-payload-admission.js
10
10
  import { createHash as createHash2 } from "node:crypto";
11
- import { closeSync as closeSync2, constants as constants2, fstatSync as fstatSync2, fsyncSync, lstatSync as lstatSync2, openSync as openSync2, readFileSync, readdirSync as readdirSync2, readlinkSync, realpathSync } from "node:fs";
11
+ import { closeSync as closeSync2, constants as constants2, fstatSync as fstatSync2, fsyncSync, lstatSync as lstatSync2, openSync as openSync2, readFileSync, readSync as readSync2, readdirSync as readdirSync2, readlinkSync, realpathSync } from "node:fs";
12
12
  import { dirname, isAbsolute as isAbsolute2, relative as relative2, resolve as resolve2 } from "node:path";
13
13
 
14
14
  // packages/koed-server/dist/artifact-canonical-json.mjs
@@ -227,10 +227,10 @@ function verifyCompatibility(manifest, input) {
227
227
  throw new Error("runtime identity is invalid");
228
228
  const versionMatches = manifest.runtimes.filter((item) => item.kind === input.runtime.kind && satisfies(input.runtime.version, item.runtimeRange) && satisfies(input.runtime.nodeVersion, item.nodeRange));
229
229
  if (!versionMatches.length)
230
- throw new Error("runtime version is incompatible");
230
+ throw new Error("runtime version is incompatible; reinstall components from a release supporting this runtime");
231
231
  const abiMatches = versionMatches.filter((item) => item.modulesAbi === void 0 || item.modulesAbi === input.runtime.modulesAbi);
232
232
  if (!abiMatches.length)
233
- throw new Error("runtime ABI mismatch");
233
+ throw new Error("runtime ABI mismatch; reinstall components from a release supporting this runtime");
234
234
  const compatibility = abiMatches.find((item) => item.minimumNapi === void 0 || input.runtime.napiVersion >= item.minimumNapi);
235
235
  if (!compatibility)
236
236
  throw new Error("runtime N-API version is incompatible");
@@ -544,6 +544,52 @@ function verifyExtractedComponentSync(root, manifest, seams = {}) {
544
544
  }
545
545
  var verifyExtractedComponent = (root, manifest) => Promise.resolve().then(() => verifyExtractedComponentSync(root, manifest));
546
546
 
547
+ // packages/koed-server/dist/native-macos-policy.js
548
+ var executables = new Set(`clusterdb createdb createuser dropdb dropuser ecpg initdb oid2name pg_amcheck pg_archivecleanup pg_basebackup pg_checksums pg_combinebackup pg_config pg_controldata pg_createsubscriber pg_ctl pg_dump pg_dumpall pg_isready pg_receivewal pg_recvlogical pg_resetwal pg_restore pg_rewind pg_test_fsync pg_test_timing pg_upgrade pg_verifybackup pg_waldump pg_walsummary pgbench postgres postmaster psql reindexdb vacuumdb vacuumlo`.split(" "));
549
+ var shareFiles = new Set(`errcodes.txt information_schema.sql pg_hba.conf.sample pg_ident.conf.sample pg_service.conf.sample postgres.bki postgresql.conf.sample psqlrc.sample snowball_create.sql sql_features.txt system_constraints.sql system_functions.sql system_views.sql`.split(" "));
550
+ function permitsMacFilePath(path) {
551
+ if ([
552
+ "native-core-manifest.json",
553
+ "runtime-asset-manifest.json",
554
+ "llama.cpp/llama-server"
555
+ ].includes(path))
556
+ return true;
557
+ if (path.startsWith("postgres/bin/"))
558
+ return executables.has(path.slice("postgres/bin/".length));
559
+ if (path.startsWith("postgres/lib/"))
560
+ return /\.(?:so|dylib)$/i.test(path) || /^postgres\/lib\/(?:postgresql\/)?pkgconfig\/[\w.-]+\.pc$/.test(path) || /^postgres\/lib\/(?:postgresql\/)?pgxs\/config\/(?:install-sh|missing)$/.test(path);
561
+ if (path.startsWith("llama.cpp/metal/"))
562
+ return /^llama\.cpp\/metal\/(?:llama-server|LICENSE|ggml-metal\.metal|[\w.+-]+\.dylib)$/.test(path);
563
+ if (path.startsWith("third-party-licenses/"))
564
+ return /(?:^|\/|__)(?:LICEN[CS]E|NOTICE|COPYING|COPYRIGHT)(?:[._-][\w.-]+)?$/i.test(path);
565
+ if (!path.startsWith("postgres/share/"))
566
+ return false;
567
+ const shared = path.slice("postgres/share/".length).replace(/^postgresql\//, "");
568
+ return shareFiles.has(shared) || /^extension\/[\w.-]+\.(?:sql|control)$/.test(shared) || /^timezone\/[\w.+/-]+$/.test(shared) || /^timezonesets\/(?:Africa|America|Antarctica|Asia|Atlantic|Australia|Default|Etc|Europe|India|Indian|Pacific)(?:\.txt)?$/.test(shared) || /^tsearch_data\/[\w.-]+\.(?:stop|affix|dict|ths|syn|rules)$/.test(shared) || /^man\/man[1-9]\/[\w.+-]+\.[1-9](?:\.gz)?$/.test(shared) || /^locale\/[\w@.-]+\/LC_MESSAGES\/[\w.+-]+\.mo$/.test(shared) || /^doc\/[\w./+-]+\.(?:html|css|png|svg|txt|pdf|example)$/.test(shared);
569
+ }
570
+ function validateMacFile(path, header, mode) {
571
+ const magic = header.subarray(0, 4).toString("hex");
572
+ const arm64 = header.length >= 16 && magic === "cffaedfe" && header.readUInt32LE(4) === 16777228;
573
+ const library = /\.(?:so|dylib)$/i.test(path);
574
+ const validType = arm64 && (library ? [6, 8].includes(header.readUInt32LE(12)) : header.readUInt32LE(12) === 2);
575
+ const binaryPath = path.startsWith("postgres/bin/") && executables.has(path.slice(13)) || path.startsWith("postgres/lib/") && library || path.startsWith("llama.cpp/metal/") && (path === "llama.cpp/metal/llama-server" || /\.dylib$/i.test(path));
576
+ const macho = [
577
+ "cffaedfe",
578
+ "feedfacf",
579
+ "cafebabe",
580
+ "bebafeca",
581
+ "cafebabf",
582
+ "bfbafeca",
583
+ "cefaedfe",
584
+ "feedface"
585
+ ].includes(magic);
586
+ const foreign = magic === "7f454c46" || header.subarray(0, 2).toString() === "MZ" || /\.(?:exe|dll|so\.\d+(?:\.\d+)*)$/i.test(path) || /(?:^|\/)libcu(?:da|blas|dart)/i.test(path);
587
+ const script = (path === "llama.cpp/llama-server" || /^postgres\/lib\/(?:postgresql\/)?pgxs\/config\/(?:install-sh|missing)$/.test(path)) && header.subarray(0, 2).toString() === "#!";
588
+ const timezone = /^postgres\/share\/(?:postgresql\/)?timezone\//.test(path);
589
+ if (!permitsMacFilePath(path) || timezone && magic !== "545a6966" || foreign || macho && (!validType || !binaryPath) || library && !validType || path.startsWith("postgres/bin/") && !validType || (mode & 73) !== 0 && !arm64 && !script)
590
+ throw new Error(`Invalid macOS native file or executable: ${path}`);
591
+ }
592
+
547
593
  // packages/koed-server/dist/native-payload-admission.js
548
594
  var nativeDigest = (value) => createHash2("sha256").update(value).digest("hex");
549
595
  function nativeJsonObject(bytes) {
@@ -585,11 +631,26 @@ function nativeFileDigest(path, bytes, durable = false) {
585
631
  closeSync2(fd);
586
632
  }
587
633
  }
588
- function permitsNativeEntry(kind, path, directory) {
634
+ function checkMacFile(file, path, mode) {
635
+ const fd = openSync2(file, constants2.O_RDONLY | constants2.O_NOFOLLOW | constants2.O_NONBLOCK);
636
+ try {
637
+ const header = Buffer.alloc(16);
638
+ const length = readSync2(fd, header, 0, header.length, 0);
639
+ validateMacFile(path, header.subarray(0, length), mode);
640
+ } finally {
641
+ closeSync2(fd);
642
+ }
643
+ }
644
+ function permitsNativeEntry(kind, path, directory, platform = "linux") {
589
645
  if (path === "")
590
646
  return directory;
591
- if (kind === "core")
592
- return path !== "llama.cpp/cuda" && !path.startsWith("llama.cpp/cuda/");
647
+ if (kind === "core") {
648
+ if (platform === "linux")
649
+ return !["cuda", "metal"].some((backend) => path === `llama.cpp/${backend}` || path.startsWith(`llama.cpp/${backend}/`));
650
+ if (!directory)
651
+ return permitsMacFilePath(path);
652
+ return path === "postgres" || path.startsWith("postgres/") || path === "llama.cpp" || path === "llama.cpp/metal" || path === "third-party-licenses" || path.startsWith("third-party-licenses/");
653
+ }
593
654
  if (path === "llama.cpp" || path === "llama.cpp/cuda")
594
655
  return directory;
595
656
  return path.startsWith("llama.cpp/cuda/") && !/(?:^|\/)libcuda\.so(?:\.\d+)*$/.test(path);
@@ -616,18 +677,43 @@ function verifyNativePayload(root, pin, durable = false) {
616
677
  throw new Error(`Native ${kind} inventory changed at ${entry.path}. Inspect the damaged payload before repair.`);
617
678
  };
618
679
  let expanded = raw.length;
680
+ const required = /* @__PURE__ */ new Set([
681
+ "postgres/bin/postgres",
682
+ "postgres/bin/initdb",
683
+ "postgres/bin/pg_ctl",
684
+ "postgres/bin/psql",
685
+ "postgres/bin/pg_dump",
686
+ "postgres/bin/pg_restore",
687
+ "postgres/lib/vector.so",
688
+ "postgres/lib/pgcrypto.so",
689
+ "llama.cpp/llama-server",
690
+ "llama.cpp/metal/llama-server"
691
+ ]);
619
692
  const walk = (directory) => {
693
+ let files = 0;
620
694
  for (const entry of readdirSync2(directory).sort()) {
621
695
  const path = resolve2(directory, entry), key = relative2(root, path);
622
696
  if (key === name)
623
697
  continue;
624
698
  const stat = lstatSync2(path), mode = stat.mode & 4095;
625
- if (!permitsNativeEntry(kind, key, stat.isDirectory()))
699
+ if (pin.target.platform === "macos" && (mode & 3584) !== 0)
700
+ throw new Error(`Invalid macOS native special permission bits: ${key}`);
701
+ if (!permitsNativeEntry(kind, key, stat.isDirectory(), pin.target.platform))
626
702
  throw new Error(`Unexpected native ${kind} entry: ${key}`);
627
703
  if (stat.isDirectory()) {
704
+ if (pin.target.platform === "macos" && mode !== 493)
705
+ throw new Error(`Invalid macOS native directory mode: ${key}`);
628
706
  check({ path: key, type: "directory", mode });
629
- walk(path);
707
+ const descendants = walk(path);
708
+ if (pin.target.platform === "macos" && descendants === 0)
709
+ throw new Error(`Unexpected native ${kind} empty directory: ${key}`);
710
+ files += descendants;
630
711
  } else if (stat.isFile()) {
712
+ files++;
713
+ if (required.has(key) && (!(key.startsWith("postgres/bin/") || key.endsWith("llama-server")) || (mode & 73) !== 0))
714
+ required.delete(key);
715
+ if (pin.target.platform === "macos")
716
+ checkMacFile(path, key, mode);
631
717
  expanded += stat.size;
632
718
  if (expanded > pin.expandedBytes)
633
719
  throw new Error("Native inventory exceeds its pinned size.");
@@ -643,16 +729,22 @@ function verifyNativePayload(root, pin, durable = false) {
643
729
  const rel = relative2(boundary, dest);
644
730
  if (isAbsolute2(target) || rel.startsWith("../") || rel === ".." || !lstatSync2(dest).isFile() || realpathSync(path) !== resolve2(realpathSync(root), relative2(root, dest)))
645
731
  throw new Error(`Unsafe native library link: ${key}`);
732
+ if (pin.target.platform === "macos")
733
+ checkMacFile(dest, key, lstatSync2(dest).mode & 511);
734
+ files++;
646
735
  check({ path: key, type: "symlink", mode: 511, target });
647
736
  } else
648
737
  throw new Error(`Unsupported native file: ${key}`);
649
738
  }
650
739
  if (durable)
651
740
  syncNativeDirectory(directory);
741
+ return files;
652
742
  };
653
743
  if (durable)
654
744
  nativeFileDigest(file, raw.length, true);
655
745
  walk(root);
746
+ if (pin.target.platform === "macos" && kind === "core" && required.size)
747
+ throw new Error(`Native macOS core is missing required executable or library: ${[...required][0]}`);
656
748
  if (expanded !== pin.expandedBytes || index !== inventory.length)
657
749
  throw new Error(`Native ${kind} inventory changed. Inspect the installed payload before repair.`);
658
750
  }
@@ -685,10 +777,10 @@ var requiredPackageRuntimeFiles = [
685
777
  "mcp-server/dist/cli.js",
686
778
  "mcp-server/dist/capture-hook.js",
687
779
  "mcp-server/dist/prompts/codex-global-agent-guidance.md",
688
- "node_modules/@koed/db/dist/index.js",
689
- "node_modules/@koed/db/dist/connection.js",
690
- "node_modules/@koed/db/dist/user-api-token-repository.js",
691
- "node_modules/@koed/db/drizzle/meta/_journal.json"
780
+ "node_modules/@koed-labs/db/dist/index.js",
781
+ "node_modules/@koed-labs/db/dist/connection.js",
782
+ "node_modules/@koed-labs/db/dist/user-api-token-repository.js",
783
+ "node_modules/@koed-labs/db/drizzle/meta/_journal.json"
692
784
  ];
693
785
  var excludedPackagePatterns = [
694
786
  /^koed-runtime\/explorer-dist(?:\/|$)/,
@@ -704,14 +796,6 @@ var excludedPackagePatterns = [
704
796
  /^koed-runtime\/embedding-service\/requirements\.txt$/,
705
797
  /^koed-runtime\/embedding-service\/pyproject\.toml$/
706
798
  ];
707
- var pnpmWorkspaceSelfSymlinkPattern = /^(?<root>koed-server|koed-runtime\/api|koed-runtime\/worker|koed-runtime\/embedding-service|koed-runtime\/mcp-server)\/node_modules\/\.pnpm\/node_modules\/@koed\/(?<name>[^/]+)$/;
708
- var packageSelfNames = {
709
- "koed-server": "koed-server",
710
- "koed-runtime/api": "api",
711
- "koed-runtime/worker": "worker",
712
- "koed-runtime/embedding-service": "embedding-service",
713
- "koed-runtime/mcp-server": "mcp-server"
714
- };
715
799
  var platformKey = (platform = process.platform) => {
716
800
  if (platform === "darwin")
717
801
  return "macos";
@@ -753,18 +837,9 @@ var packageRoot = (paths) => resolve3(paths.koedHome, "runtime", "koed-server");
753
837
  var packageVersionsDir = (paths) => resolve3(packageRoot(paths), "versions");
754
838
  var packageCacheDir = (paths) => resolve3(paths.cacheDir, "koed-server-packages");
755
839
  var packageCurrentPath = (paths) => resolve3(packageRoot(paths), "current");
756
- var isPnpmWorkspaceSelfSymlink = (path) => {
757
- const match = path.match(pnpmWorkspaceSelfSymlinkPattern);
758
- if (!match?.groups)
759
- return false;
760
- const { name, root } = match.groups;
761
- return Boolean(root && name && name === packageSelfNames[root]);
762
- };
763
840
  var listFiles = (root, dir = root) => readdirSync3(dir, { withFileTypes: true }).flatMap((entry) => {
764
841
  const path = resolve3(dir, entry.name);
765
842
  const relativePath = relative3(root, path).replaceAll("\\", "/");
766
- if (isPnpmWorkspaceSelfSymlink(relativePath))
767
- return [];
768
843
  if (entry.isDirectory())
769
844
  return listFiles(root, path);
770
845
  return [relativePath];
@@ -1332,7 +1407,7 @@ var extractTarGz = async (archivePath, destination, native) => {
1332
1407
  const entryMode = tarNumber2(header, 100, 8);
1333
1408
  if (native) {
1334
1409
  const path = rawPath.replace(/\/$/, "");
1335
- if (!(path === "koed-runtime" || path.startsWith("koed-runtime/")) || !permitsNativeEntry(native.kind, path.slice("koed-runtime/".length), type === "5") || path.split("/").some((part) => !part || part === "." || part === "..") || path.includes("\\") || (entryMode & ~511) !== 0)
1410
+ if (!(path === "koed-runtime" || path.startsWith("koed-runtime/")) || !permitsNativeEntry(native.kind, path.slice("koed-runtime/".length), type === "5", native.platform) || path.split("/").some((part) => !part || part === "." || part === "..") || path.includes("\\") || (entryMode & ~511) !== 0)
1336
1411
  throw new Error("Unsafe native archive path or mode.");
1337
1412
  if (type === "0")
1338
1413
  regularBytes += size;
@@ -1404,9 +1479,14 @@ var extractTarGz = async (archivePath, destination, native) => {
1404
1479
  symlinkSync(link, path);
1405
1480
  }
1406
1481
  };
1407
- var extractNativeArchive = (kind, archive, destination, expandedBytes, signal) => {
1482
+ var extractNativeArchive = (kind, archive, destination, expandedBytes, signal, platform = "linux") => {
1408
1483
  mkdirSync(destination, { mode: 448 });
1409
- return extractTarGz(archive, destination, { kind, expandedBytes, signal });
1484
+ return extractTarGz(archive, destination, {
1485
+ kind,
1486
+ expandedBytes,
1487
+ signal,
1488
+ platform
1489
+ });
1410
1490
  };
1411
1491
  var findExtractedPackageRoot = (extractDir) => {
1412
1492
  const entries = readdirSync3(extractDir, { withFileTypes: true }).filter((entry) => entry.isDirectory());
@@ -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-EA4QDDQA.js";
4
+ } from "./chunk-GY5GATZL.js";
5
5
  import "./chunk-TSAYTRX3.js";
6
6
  import "./chunk-YZLQZU5E.js";
7
- import "./chunk-ZOHNXUDY.js";
7
+ import "./chunk-E6YVGIEW.js";
8
8
  import "./chunk-FSNLU46W.js";
9
9
  import "./chunk-BTS4ZTF3.js";
10
10
 
@@ -8,11 +8,11 @@ import {
8
8
  getUpstreamEnrollmentStatus,
9
9
  readUpstreamEnrollmentBinding,
10
10
  startUpstreamEnrollment
11
- } from "./chunk-WPIEF4LY.js";
11
+ } from "./chunk-T7OGE5E5.js";
12
12
  import {
13
13
  applyPersistedLocalPorts
14
14
  } from "./chunk-TISYUUEJ.js";
15
- import "./chunk-SRKIBFOE.js";
15
+ import "./chunk-LHUMBHG7.js";
16
16
  import {
17
17
  resolveKoedServerPaths
18
18
  } from "./chunk-TSAYTRX3.js";
@@ -40,7 +40,7 @@ import {
40
40
  updateUpstreamBackendRoutePolicy,
41
41
  updateUpstreamDisconnectCleanup,
42
42
  upstreamDisconnectCleanupPending
43
- } from "./chunk-RCR4XPE3.js";
43
+ } from "./chunk-WBMO7YCO.js";
44
44
  import {
45
45
  COLLABORATION_CONTRACT_VERSION,
46
46
  COLLABORATION_RECONNECT_BACKOFF_CAP_MS,
@@ -73,7 +73,7 @@ import {
73
73
  readLocalEdgeClientCredentialAuthorization,
74
74
  storeCollaborationPendingSend,
75
75
  updateCollaborationPendingSendState
76
- } from "./chunk-ZOHNXUDY.js";
76
+ } from "./chunk-E6YVGIEW.js";
77
77
  import {
78
78
  external_exports
79
79
  } from "./chunk-FSNLU46W.js";
@@ -6,33 +6,33 @@ import {
6
6
  persistDoctorVerification,
7
7
  printJson,
8
8
  safeLifecycle
9
- } from "./chunk-WDFERJG3.js";
10
- import "./chunk-SHLRINKO.js";
11
- import "./chunk-CHMH4LH5.js";
12
- import "./chunk-EA4QDDQA.js";
9
+ } from "./chunk-54UL4U2E.js";
10
+ import "./chunk-L4RD3TAZ.js";
11
+ import "./chunk-NGV45YWB.js";
12
+ import "./chunk-GY5GATZL.js";
13
13
  import "./chunk-JYK6UL6D.js";
14
- import "./chunk-WPIEF4LY.js";
15
- import "./chunk-EDPNYIX5.js";
14
+ import "./chunk-T7OGE5E5.js";
15
+ import "./chunk-USHFSJT7.js";
16
16
  import "./chunk-QT24SAW6.js";
17
17
  import "./chunk-TISYUUEJ.js";
18
18
  import "./chunk-ALJUSOF7.js";
19
- import "./chunk-SRKIBFOE.js";
19
+ import "./chunk-LHUMBHG7.js";
20
20
  import "./chunk-7FSHVVTZ.js";
21
21
  import "./chunk-TSAYTRX3.js";
22
22
  import "./chunk-YZLQZU5E.js";
23
23
  import "./chunk-W2HNI6AA.js";
24
- import "./chunk-V67IQB7H.js";
25
- import "./chunk-FN3HUUO2.js";
24
+ import "./chunk-OG7G6DIR.js";
25
+ import "./chunk-UCOHFZ77.js";
26
26
  import "./chunk-T6UB5PNX.js";
27
27
  import "./chunk-7NXKPDF3.js";
28
- import "./chunk-ZUDSZGVO.js";
29
- import "./chunk-ZIOKV2X6.js";
30
- import "./chunk-QRKHHWJJ.js";
31
- import "./chunk-7EGSY3E4.js";
28
+ import "./chunk-XCO3RV3Z.js";
29
+ import "./chunk-7HLNJ2BI.js";
30
+ import "./chunk-VGL5AZN5.js";
31
+ import "./chunk-QV3WPU7A.js";
32
32
  import "./chunk-IY2HRXOZ.js";
33
- import "./chunk-4OO6VAU3.js";
34
- import "./chunk-RCR4XPE3.js";
35
- import "./chunk-ZOHNXUDY.js";
33
+ import "./chunk-4DHYSJJT.js";
34
+ import "./chunk-WBMO7YCO.js";
35
+ import "./chunk-E6YVGIEW.js";
36
36
  import "./chunk-FSNLU46W.js";
37
37
  import "./chunk-BTS4ZTF3.js";
38
38
 
@@ -10552,13 +10552,16 @@ var managedTerminalContextReferenceSchema = external_exports.object({
10552
10552
  }).strict();
10553
10553
 
10554
10554
  // packages/shared/src/ai-client-flow-defaults.ts
10555
- var localAiClientFlowKeys = [
10556
- "conversations",
10555
+ var memoryModelFlowKeys = [
10557
10556
  "mcp_memory_answer",
10558
10557
  "lcm_summary",
10559
10558
  "session_title",
10560
10559
  "curated_memory_review"
10561
10560
  ];
10561
+ var localAiClientFlowKeys = [
10562
+ "conversations",
10563
+ ...memoryModelFlowKeys
10564
+ ];
10562
10565
  var parsedInteger = (raw, fallback) => {
10563
10566
  const parsed = Number.parseInt(raw ?? "", 10);
10564
10567
  return Number.isFinite(parsed) ? parsed : fallback;
@@ -10615,11 +10618,12 @@ var documentDefault = (assignment2) => ({
10615
10618
  reason: assignment2.timeout_ms <= 18e5 && assignment2.max_attempts <= 25 ? null : "Effective runtime default exceeds persisted assignment limits; choose bounded values before saving."
10616
10619
  });
10617
10620
  var isProvider = (value) => value === "codex" || value === "claude" || value === "pi";
10618
- var unavailable = (source2, reason2) => ({
10621
+ var unavailable = (source2, reason2, executionLimits) => ({
10619
10622
  source: source2,
10620
10623
  available: false,
10621
10624
  persistable: false,
10622
10625
  assignment: null,
10626
+ executionLimits,
10623
10627
  reason: reason2
10624
10628
  });
10625
10629
  var environmentDefaultFor = (flowKey, documented, environment) => {
@@ -10638,21 +10642,35 @@ var environmentDefaultFor = (flowKey, documented, environment) => {
10638
10642
  timeoutSuffix,
10639
10643
  "MAX_ATTEMPTS"
10640
10644
  ].some((suffix) => value(suffix) !== void 0);
10645
+ const fallback = base ?? codeDefaultAssignmentFor(flowKey);
10646
+ const executionLimits = {
10647
+ timeout_ms: spec.parseTimeout(value(timeoutSuffix), fallback.timeout_ms),
10648
+ max_attempts: spec.parseAttempts(
10649
+ value("MAX_ATTEMPTS"),
10650
+ fallback.max_attempts
10651
+ )
10652
+ };
10641
10653
  if (!base) {
10642
10654
  return unavailable(
10643
10655
  hasEnvironmentValue ? "environment" : "code",
10644
- "No documented default is available."
10656
+ "No documented default is available.",
10657
+ executionLimits
10645
10658
  );
10646
10659
  }
10647
10660
  const provider = value("PROVIDER")?.toLowerCase() ?? base.provider;
10648
10661
  if (!isProvider(provider)) {
10649
- return unavailable("environment", "Environment provider is unsupported.");
10662
+ return unavailable(
10663
+ "environment",
10664
+ "Environment provider is unsupported.",
10665
+ executionLimits
10666
+ );
10650
10667
  }
10651
10668
  const model = value("MODEL") ?? (provider === "pi" ? null : provider === "claude" ? "haiku" : base.model);
10652
10669
  if (!model) {
10653
10670
  return unavailable(
10654
10671
  "environment",
10655
- "Selected provider requires explicit model."
10672
+ "Selected provider requires explicit model.",
10673
+ executionLimits
10656
10674
  );
10657
10675
  }
10658
10676
  const assignment2 = {
@@ -10661,8 +10679,7 @@ var environmentDefaultFor = (flowKey, documented, environment) => {
10661
10679
  ai_client_instance_id: value("AI_CLIENT_INSTANCE") ?? `${provider}.default`,
10662
10680
  model,
10663
10681
  reasoning_effort: value("REASONING_EFFORT") ?? (provider === "claude" && model === "haiku" ? "none" : base.reasoning_effort),
10664
- timeout_ms: spec.parseTimeout(value(timeoutSuffix), base.timeout_ms),
10665
- max_attempts: spec.parseAttempts(value("MAX_ATTEMPTS"), base.max_attempts)
10682
+ ...executionLimits
10666
10683
  };
10667
10684
  return {
10668
10685
  ...documentDefault(assignment2),
@@ -4,33 +4,33 @@ import {
4
4
  createCliServiceContext,
5
5
  deviceRequestCommand,
6
6
  printJson
7
- } from "./chunk-WDFERJG3.js";
8
- import "./chunk-SHLRINKO.js";
9
- import "./chunk-CHMH4LH5.js";
10
- import "./chunk-EA4QDDQA.js";
7
+ } from "./chunk-54UL4U2E.js";
8
+ import "./chunk-L4RD3TAZ.js";
9
+ import "./chunk-NGV45YWB.js";
10
+ import "./chunk-GY5GATZL.js";
11
11
  import "./chunk-JYK6UL6D.js";
12
- import "./chunk-WPIEF4LY.js";
13
- import "./chunk-EDPNYIX5.js";
12
+ import "./chunk-T7OGE5E5.js";
13
+ import "./chunk-USHFSJT7.js";
14
14
  import "./chunk-QT24SAW6.js";
15
15
  import "./chunk-TISYUUEJ.js";
16
16
  import "./chunk-ALJUSOF7.js";
17
- import "./chunk-SRKIBFOE.js";
17
+ import "./chunk-LHUMBHG7.js";
18
18
  import "./chunk-7FSHVVTZ.js";
19
19
  import "./chunk-TSAYTRX3.js";
20
20
  import "./chunk-YZLQZU5E.js";
21
21
  import "./chunk-W2HNI6AA.js";
22
- import "./chunk-V67IQB7H.js";
23
- import "./chunk-FN3HUUO2.js";
22
+ import "./chunk-OG7G6DIR.js";
23
+ import "./chunk-UCOHFZ77.js";
24
24
  import "./chunk-T6UB5PNX.js";
25
25
  import "./chunk-7NXKPDF3.js";
26
- import "./chunk-ZUDSZGVO.js";
27
- import "./chunk-ZIOKV2X6.js";
28
- import "./chunk-QRKHHWJJ.js";
29
- import "./chunk-7EGSY3E4.js";
26
+ import "./chunk-XCO3RV3Z.js";
27
+ import "./chunk-7HLNJ2BI.js";
28
+ import "./chunk-VGL5AZN5.js";
29
+ import "./chunk-QV3WPU7A.js";
30
30
  import "./chunk-IY2HRXOZ.js";
31
- import "./chunk-4OO6VAU3.js";
32
- import "./chunk-RCR4XPE3.js";
33
- import "./chunk-ZOHNXUDY.js";
31
+ import "./chunk-4DHYSJJT.js";
32
+ import "./chunk-WBMO7YCO.js";
33
+ import "./chunk-E6YVGIEW.js";
34
34
  import "./chunk-FSNLU46W.js";
35
35
  import "./chunk-BTS4ZTF3.js";
36
36
 
@@ -16,9 +16,9 @@ import {
16
16
  standalonePackageKind,
17
17
  standalonePackageSchemaVersion,
18
18
  validateServerPackageRoot
19
- } from "./chunk-ZIOKV2X6.js";
20
- import "./chunk-QRKHHWJJ.js";
21
- import "./chunk-7EGSY3E4.js";
19
+ } from "./chunk-7HLNJ2BI.js";
20
+ import "./chunk-VGL5AZN5.js";
21
+ import "./chunk-QV3WPU7A.js";
22
22
  import "./chunk-IY2HRXOZ.js";
23
23
  import "./chunk-FSNLU46W.js";
24
24
  import "./chunk-BTS4ZTF3.js";
@@ -6,11 +6,11 @@ import {
6
6
  invalidateUpstreamEnrollmentReferences,
7
7
  readUpstreamEnrollmentBinding,
8
8
  startUpstreamEnrollment
9
- } from "./chunk-WPIEF4LY.js";
10
- import "./chunk-SRKIBFOE.js";
9
+ } from "./chunk-T7OGE5E5.js";
10
+ import "./chunk-LHUMBHG7.js";
11
11
  import "./chunk-7NXKPDF3.js";
12
- import "./chunk-RCR4XPE3.js";
13
- import "./chunk-ZOHNXUDY.js";
12
+ import "./chunk-WBMO7YCO.js";
13
+ import "./chunk-E6YVGIEW.js";
14
14
  import "./chunk-FSNLU46W.js";
15
15
  import "./chunk-BTS4ZTF3.js";
16
16
  export {
@@ -4,7 +4,7 @@ import {
4
4
  } from "./chunk-TSAYTRX3.js";
5
5
  import {
6
6
  createPdsApplicationSecretStore
7
- } from "./chunk-ZOHNXUDY.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";
@@ -13,17 +13,18 @@ import {
13
13
  readCurrentRuntimeOwner,
14
14
  readDesktopBundleGeneration,
15
15
  readDesktopGenerationForCapability,
16
+ removeStaleGenerationPin,
16
17
  stageDesktopBundleForRecovery,
17
18
  withLifecycleLock,
18
19
  withSourceNativeStartLock,
19
20
  withStoppedRuntime
20
- } from "./chunk-FN3HUUO2.js";
21
+ } from "./chunk-UCOHFZ77.js";
21
22
  import "./chunk-T6UB5PNX.js";
22
23
  import "./chunk-7NXKPDF3.js";
23
- import "./chunk-ZUDSZGVO.js";
24
- import "./chunk-ZIOKV2X6.js";
25
- import "./chunk-QRKHHWJJ.js";
26
- import "./chunk-7EGSY3E4.js";
24
+ import "./chunk-XCO3RV3Z.js";
25
+ import "./chunk-7HLNJ2BI.js";
26
+ import "./chunk-VGL5AZN5.js";
27
+ import "./chunk-QV3WPU7A.js";
27
28
  import "./chunk-IY2HRXOZ.js";
28
29
  import "./chunk-FSNLU46W.js";
29
30
  import "./chunk-BTS4ZTF3.js";
@@ -41,6 +42,7 @@ export {
41
42
  readCurrentRuntimeOwner,
42
43
  readDesktopBundleGeneration,
43
44
  readDesktopGenerationForCapability,
45
+ removeStaleGenerationPin,
44
46
  stageDesktopBundleForRecovery,
45
47
  withLifecycleLock,
46
48
  withSourceNativeStartLock,
@@ -3,7 +3,7 @@ import {
3
3
  aiClientConnectionRevision,
4
4
  grantAiClientConnection,
5
5
  revokeAiClientConnection
6
- } from "./chunk-EDPNYIX5.js";
6
+ } from "./chunk-USHFSJT7.js";
7
7
 
8
8
  // packages/koed-server/dist/ai-client-authorization.js
9
9
  var clientNames = {
@@ -2,7 +2,7 @@ import { createRequire as createKoedRequire } from "node:module"; const require
2
2
  import {
3
3
  calculateRuntimeRequirements,
4
4
  resolveEffectiveRuntimeConfig
5
- } from "./chunk-SHLRINKO.js";
5
+ } from "./chunk-L4RD3TAZ.js";
6
6
  import "./chunk-ALJUSOF7.js";
7
7
  import {
8
8
  resolveKoedServerPaths
@@ -13,7 +13,7 @@ import {
13
13
  resolveKoedAppRuntimeExecution,
14
14
  resolveKoedControlPlaneVersion,
15
15
  resolveKoedRuntimeOwner
16
- } from "./chunk-V67IQB7H.js";
16
+ } from "./chunk-OG7G6DIR.js";
17
17
  import {
18
18
  activateGeneration,
19
19
  cleanupGenerations,
@@ -28,19 +28,19 @@ import {
28
28
  resolveComponentManifestPinTarget,
29
29
  stageComponent,
30
30
  stageGeneration
31
- } from "./chunk-FN3HUUO2.js";
31
+ } from "./chunk-UCOHFZ77.js";
32
32
  import "./chunk-T6UB5PNX.js";
33
33
  import "./chunk-7NXKPDF3.js";
34
34
  import {
35
35
  productionComponentManifestCatalog
36
- } from "./chunk-ZUDSZGVO.js";
37
- import "./chunk-ZIOKV2X6.js";
38
- import "./chunk-QRKHHWJJ.js";
39
- import "./chunk-7EGSY3E4.js";
36
+ } from "./chunk-XCO3RV3Z.js";
37
+ import "./chunk-7HLNJ2BI.js";
38
+ import "./chunk-VGL5AZN5.js";
39
+ import "./chunk-QV3WPU7A.js";
40
40
  import {
41
41
  validateManifestCatalog
42
42
  } from "./chunk-IY2HRXOZ.js";
43
- import "./chunk-ZOHNXUDY.js";
43
+ import "./chunk-E6YVGIEW.js";
44
44
  import "./chunk-FSNLU46W.js";
45
45
  import "./chunk-BTS4ZTF3.js";
46
46
 
@@ -7,7 +7,7 @@ import {
7
7
  } from "./chunk-W2HNI6AA.js";
8
8
  import {
9
9
  resolveTeamCollaborationEnabled
10
- } from "./chunk-ZOHNXUDY.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-ZOHNXUDY.js";
12
+ } from "./chunk-E6YVGIEW.js";
13
13
  import {
14
14
  __toESM
15
15
  } from "./chunk-BTS4ZTF3.js";