@koed-labs/server 0.0.0-stage → 0.11.1
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.
- package/LICENSE +201 -0
- package/README.md +64 -2
- package/bin/koed.js +7 -0
- package/package.json +26 -4
- package/third-party-notices.json +92 -0
- package/vendor/chunk-2XKSVKQA.js +49 -0
- package/vendor/chunk-4OO6VAU3.js +259 -0
- package/vendor/chunk-53ZFCDHP.js +332 -0
- package/vendor/chunk-6JRWGOQG.js +236 -0
- package/vendor/chunk-6KS67EQE.js +75 -0
- package/vendor/chunk-7EGSY3E4.js +8 -0
- package/vendor/chunk-7FSHVVTZ.js +128 -0
- package/vendor/chunk-7NOQSX4T.js +14 -0
- package/vendor/chunk-7NXKPDF3.js +1586 -0
- package/vendor/chunk-ALJUSOF7.js +175 -0
- package/vendor/chunk-AVQCUFYQ.js +16 -0
- package/vendor/chunk-BGENSONI.js +18 -0
- package/vendor/chunk-BTS4ZTF3.js +43 -0
- package/vendor/chunk-BUIM2M4R.js +22 -0
- package/vendor/chunk-C4V72GXC.js +194 -0
- package/vendor/chunk-C5SNDPAP.js +2472 -0
- package/vendor/chunk-CHMH4LH5.js +2497 -0
- package/vendor/chunk-EA4QDDQA.js +58 -0
- package/vendor/chunk-EDPNYIX5.js +5448 -0
- package/vendor/chunk-FN3HUUO2.js +1974 -0
- package/vendor/chunk-FSNLU46W.js +14548 -0
- package/vendor/chunk-FYYRFX4U.js +4423 -0
- package/vendor/chunk-GFASBPV2.js +42 -0
- package/vendor/chunk-HC76426R.js +48 -0
- package/vendor/chunk-IY2HRXOZ.js +99 -0
- package/vendor/chunk-JBGD4JLR.js +3779 -0
- package/vendor/chunk-JYK6UL6D.js +261 -0
- package/vendor/chunk-LRP66XEY.js +13907 -0
- package/vendor/chunk-NOU7RHYZ.js +26 -0
- package/vendor/chunk-NVTMIAAF.js +113 -0
- package/vendor/chunk-O7DW2VAV.js +14 -0
- package/vendor/chunk-OCILJ737.js +299 -0
- package/vendor/chunk-PL3LWC5C.js +754 -0
- package/vendor/chunk-QRKHHWJJ.js +104 -0
- package/vendor/chunk-QT24SAW6.js +110 -0
- package/vendor/chunk-RCR4XPE3.js +26020 -0
- package/vendor/chunk-SHLRINKO.js +73 -0
- package/vendor/chunk-SNKWETM5.js +35 -0
- package/vendor/chunk-SRKIBFOE.js +242 -0
- package/vendor/chunk-T6UB5PNX.js +124 -0
- package/vendor/chunk-TG26CZGQ.js +23 -0
- package/vendor/chunk-TISYUUEJ.js +188 -0
- package/vendor/chunk-TSAYTRX3.js +89 -0
- package/vendor/chunk-TVYEB2GN.js +343 -0
- package/vendor/chunk-UB6JCVQ3.js +461 -0
- package/vendor/chunk-V67IQB7H.js +153 -0
- package/vendor/chunk-VGIYSDNU.js +522 -0
- package/vendor/chunk-W2HNI6AA.js +75 -0
- package/vendor/chunk-W2OJZZ6X.js +20 -0
- package/vendor/chunk-WDFERJG3.js +2208 -0
- package/vendor/chunk-WPIEF4LY.js +1647 -0
- package/vendor/chunk-XIZVLPHZ.js +18 -0
- package/vendor/chunk-YZLQZU5E.js +46 -0
- package/vendor/chunk-Z5WCAUA6.js +148 -0
- package/vendor/chunk-ZIOKV2X6.js +1589 -0
- package/vendor/chunk-ZOHNXUDY.js +12501 -0
- package/vendor/chunk-ZUDSZGVO.js +11 -0
- package/vendor/cli.js +7 -0
- package/vendor/component-manifest-catalog.js +9 -0
- package/vendor/control-plane.js +28 -0
- package/vendor/package.json +1 -0
- package/vendor/privacy-service-bootstrap.js +6 -0
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { createRequire as createKoedRequire } from "node:module"; const require = createKoedRequire(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
productionNativeRuntimeCatalog
|
|
4
|
+
} from "./chunk-7EGSY3E4.js";
|
|
5
|
+
import {
|
|
6
|
+
external_exports
|
|
7
|
+
} from "./chunk-FSNLU46W.js";
|
|
8
|
+
|
|
9
|
+
// packages/koed-server/dist/native-runtime-catalog.js
|
|
10
|
+
var digest = external_exports.string().regex(/^[a-f0-9]{64}$/);
|
|
11
|
+
var version = external_exports.string().regex(/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)$/).refine((value) => value.split(".").every((part) => Number.isSafeInteger(Number(part))));
|
|
12
|
+
var target = external_exports.object({
|
|
13
|
+
platform: external_exports.literal("linux"),
|
|
14
|
+
architecture: external_exports.literal("x64"),
|
|
15
|
+
libc: external_exports.object({ family: external_exports.literal("glibc"), minimumVersion: external_exports.literal("2.35") }).strict()
|
|
16
|
+
}).strict();
|
|
17
|
+
var llamaCpp = external_exports.object({
|
|
18
|
+
version: external_exports.string().regex(/^b\d+$/),
|
|
19
|
+
revision: external_exports.string().regex(/^[a-f0-9]{40}$/)
|
|
20
|
+
}).strict();
|
|
21
|
+
var contracts = external_exports.object({ layout: external_exports.literal(1), embedding: external_exports.literal(1) }).strict();
|
|
22
|
+
var shared = {
|
|
23
|
+
recipeId: digest,
|
|
24
|
+
runtimeVersion: version,
|
|
25
|
+
url: external_exports.string(),
|
|
26
|
+
sha256: digest,
|
|
27
|
+
manifestSha256: digest,
|
|
28
|
+
target
|
|
29
|
+
};
|
|
30
|
+
var size = (maximum) => external_exports.number().int().positive().max(maximum);
|
|
31
|
+
var retainedUrl = (kind, pin) => {
|
|
32
|
+
const prefix = "https://github.com/koed-labs/koed/releases/download/";
|
|
33
|
+
const [tag, archive, ...extra] = pin.url.slice(prefix.length).split("/");
|
|
34
|
+
return pin.url.startsWith(prefix) && extra.length === 0 && archive === `koed-native-${kind}-${pin.recipeId}-linux-x64.tar.gz` && (tag === `native-${kind}-${pin.recipeId}` || /^v(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)$/.test(tag ?? ""));
|
|
35
|
+
};
|
|
36
|
+
var corePin = external_exports.object({
|
|
37
|
+
...shared,
|
|
38
|
+
archiveBytes: size(5e7),
|
|
39
|
+
expandedBytes: size(1e8),
|
|
40
|
+
contracts: contracts.extend({ postgres: external_exports.literal(1) }),
|
|
41
|
+
components: external_exports.object({
|
|
42
|
+
postgres: external_exports.object({
|
|
43
|
+
major: external_exports.literal(17),
|
|
44
|
+
version: external_exports.string().regex(/^17\.\d+$/)
|
|
45
|
+
}).strict(),
|
|
46
|
+
pgvector: external_exports.object({ version: external_exports.literal("0.8.3") }).strict(),
|
|
47
|
+
llamaCpp
|
|
48
|
+
}).strict()
|
|
49
|
+
}).strict().refine((pin) => retainedUrl("core", pin), "Native core URL does not identify the retained recipe release.");
|
|
50
|
+
var cudaPin = external_exports.object({
|
|
51
|
+
...shared,
|
|
52
|
+
archiveBytes: size(75e7),
|
|
53
|
+
expandedBytes: size(16e8),
|
|
54
|
+
contracts,
|
|
55
|
+
llamaCpp,
|
|
56
|
+
cuda: external_exports.object({
|
|
57
|
+
toolkitVersion: external_exports.literal("12.4"),
|
|
58
|
+
minimumDriverLinux: external_exports.literal("550.54.14"),
|
|
59
|
+
architectures: external_exports.array(external_exports.union([
|
|
60
|
+
external_exports.literal(75),
|
|
61
|
+
external_exports.literal(80),
|
|
62
|
+
external_exports.literal(86),
|
|
63
|
+
external_exports.literal(89),
|
|
64
|
+
external_exports.literal(90)
|
|
65
|
+
])).min(1).max(5).refine((values) => new Set(values).size === values.length)
|
|
66
|
+
}).strict()
|
|
67
|
+
}).strict().refine((pin) => retainedUrl("cuda", pin), "Native CUDA URL does not identify the retained recipe release.");
|
|
68
|
+
var nativeKind = (pin) => "components" in pin ? "core" : "cuda";
|
|
69
|
+
var compatibleCuda = (core, cuda) => core.components.llamaCpp.revision === cuda.llamaCpp.revision && core.components.llamaCpp.version === cuda.llamaCpp.version && core.contracts.layout === cuda.contracts.layout && core.contracts.embedding === cuda.contracts.embedding;
|
|
70
|
+
var compareNativeVersions = (left, right) => {
|
|
71
|
+
const a = version.parse(left).split(".").map(Number);
|
|
72
|
+
const b = version.parse(right).split(".").map(Number);
|
|
73
|
+
for (let index = 0; index < 3; index++) {
|
|
74
|
+
const difference = (a[index] ?? 0) - (b[index] ?? 0);
|
|
75
|
+
if (difference !== 0)
|
|
76
|
+
return Math.sign(difference);
|
|
77
|
+
}
|
|
78
|
+
return 0;
|
|
79
|
+
};
|
|
80
|
+
var catalog = external_exports.object({
|
|
81
|
+
schemaVersion: external_exports.literal(1),
|
|
82
|
+
minimumCoreVersion: version,
|
|
83
|
+
core: corePin,
|
|
84
|
+
cuda: cudaPin.nullable()
|
|
85
|
+
}).strict().refine((value) => !value.cuda || compatibleCuda(value.core, value.cuda), "Pinned CUDA add-on does not match the core revision and contracts.").refine((value) => compareNativeVersions(value.core.runtimeVersion, value.minimumCoreVersion) >= 0, "Pinned native core is below the compiled minimum runtime version.");
|
|
86
|
+
var validateNativeRuntimeCatalog = (value) => {
|
|
87
|
+
const parsed = catalog.safeParse(value);
|
|
88
|
+
if (!parsed.success)
|
|
89
|
+
throw new Error(`Invalid compiled native runtime catalog: ${parsed.error.message}`);
|
|
90
|
+
return parsed.data;
|
|
91
|
+
};
|
|
92
|
+
var getNativeRuntimeCatalog = () => {
|
|
93
|
+
if (productionNativeRuntimeCatalog === null)
|
|
94
|
+
throw new Error("This Control Plane has no reviewed native runtime pin. Use a trusted release with native runtime support.");
|
|
95
|
+
return validateNativeRuntimeCatalog(productionNativeRuntimeCatalog);
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
export {
|
|
99
|
+
nativeKind,
|
|
100
|
+
compatibleCuda,
|
|
101
|
+
compareNativeVersions,
|
|
102
|
+
validateNativeRuntimeCatalog,
|
|
103
|
+
getNativeRuntimeCatalog
|
|
104
|
+
};
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { createRequire as createKoedRequire } from "node:module"; const require = createKoedRequire(import.meta.url);
|
|
2
|
+
|
|
3
|
+
// packages/koed-server/dist/credentials.js
|
|
4
|
+
import { chmodSync, existsSync, lstatSync, mkdirSync, readFileSync, renameSync, unlinkSync, writeFileSync } from "node:fs";
|
|
5
|
+
import { randomUUID } from "node:crypto";
|
|
6
|
+
import { dirname, resolve } from "node:path";
|
|
7
|
+
var usableToken = (value) => {
|
|
8
|
+
const trimmed = value?.trim();
|
|
9
|
+
return trimmed && !trimmed.startsWith("replace_with_") ? trimmed : null;
|
|
10
|
+
};
|
|
11
|
+
var tokenFrom = (values) => {
|
|
12
|
+
for (const value of values) {
|
|
13
|
+
const token = usableToken(value);
|
|
14
|
+
if (token) {
|
|
15
|
+
return token;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
return null;
|
|
19
|
+
};
|
|
20
|
+
var resolveLocalApiToken = (environment, repoEnv) => {
|
|
21
|
+
const envToken = tokenFrom([
|
|
22
|
+
environment.MEMORY_API_TOKEN,
|
|
23
|
+
environment.CODEX_MEMORY_API_TOKEN
|
|
24
|
+
]);
|
|
25
|
+
if (envToken) {
|
|
26
|
+
return { token: envToken, source: "environment" };
|
|
27
|
+
}
|
|
28
|
+
const repoToken = tokenFrom([
|
|
29
|
+
repoEnv.MEMORY_API_TOKEN,
|
|
30
|
+
repoEnv.CODEX_MEMORY_API_TOKEN
|
|
31
|
+
]);
|
|
32
|
+
if (repoToken) {
|
|
33
|
+
return { token: repoToken, source: "repo-env" };
|
|
34
|
+
}
|
|
35
|
+
return null;
|
|
36
|
+
};
|
|
37
|
+
var writeLocalAppCredential = (paths, credential) => {
|
|
38
|
+
const target = resolve(paths.localAppCredentialPath);
|
|
39
|
+
mkdirSync(dirname(target), { recursive: true, mode: 448 });
|
|
40
|
+
try {
|
|
41
|
+
if (lstatSync(target).isSymbolicLink()) {
|
|
42
|
+
throw new Error("Local API Token credential must not be a symbolic link.");
|
|
43
|
+
}
|
|
44
|
+
} catch (error) {
|
|
45
|
+
if (error.code !== "ENOENT")
|
|
46
|
+
throw error;
|
|
47
|
+
}
|
|
48
|
+
const temporary = `${target}.${process.pid}.${randomUUID()}.tmp`;
|
|
49
|
+
try {
|
|
50
|
+
writeFileSync(temporary, `${JSON.stringify(credential, null, 2)}
|
|
51
|
+
`, {
|
|
52
|
+
mode: 384,
|
|
53
|
+
flag: "wx"
|
|
54
|
+
});
|
|
55
|
+
chmodSync(temporary, 384);
|
|
56
|
+
renameSync(temporary, target);
|
|
57
|
+
chmodSync(target, 384);
|
|
58
|
+
} catch (error) {
|
|
59
|
+
try {
|
|
60
|
+
unlinkSync(temporary);
|
|
61
|
+
} catch {
|
|
62
|
+
}
|
|
63
|
+
throw error;
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
var loadLocalAppCredential = (paths) => {
|
|
67
|
+
if (!existsSync(paths.localAppCredentialPath)) {
|
|
68
|
+
return null;
|
|
69
|
+
}
|
|
70
|
+
try {
|
|
71
|
+
const parsed = JSON.parse(readFileSync(paths.localAppCredentialPath, "utf8"));
|
|
72
|
+
if (typeof parsed?.apiToken !== "string" || !parsed.apiToken.trim()) {
|
|
73
|
+
return null;
|
|
74
|
+
}
|
|
75
|
+
return {
|
|
76
|
+
apiToken: parsed.apiToken.trim(),
|
|
77
|
+
provisionedAt: parsed.provisionedAt ?? "unknown",
|
|
78
|
+
source: parsed.source ?? "repo-env"
|
|
79
|
+
};
|
|
80
|
+
} catch {
|
|
81
|
+
return null;
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
var resolveActiveIntegrationApiToken = (paths, environment, repoEnv) => {
|
|
85
|
+
const localAppCredential = loadLocalAppCredential(paths);
|
|
86
|
+
if (environment.KOED_AUTO_PORTS === "1" && localAppCredential?.apiToken) {
|
|
87
|
+
return {
|
|
88
|
+
token: localAppCredential.apiToken,
|
|
89
|
+
source: "local-app-credential"
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
const localToken = resolveLocalApiToken(environment, repoEnv);
|
|
93
|
+
if (localToken) {
|
|
94
|
+
return localToken;
|
|
95
|
+
}
|
|
96
|
+
if (localAppCredential?.apiToken) {
|
|
97
|
+
return {
|
|
98
|
+
token: localAppCredential.apiToken,
|
|
99
|
+
source: "local-app-credential"
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
return null;
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
export {
|
|
106
|
+
resolveLocalApiToken,
|
|
107
|
+
writeLocalAppCredential,
|
|
108
|
+
loadLocalAppCredential,
|
|
109
|
+
resolveActiveIntegrationApiToken
|
|
110
|
+
};
|