@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.
- package/README.md +3 -3
- package/bin/koed.js +1 -1
- package/package.json +2 -2
- package/vendor/{chunk-VGIYSDNU.js → chunk-273NMYXE.js} +115 -32
- package/vendor/{chunk-4OO6VAU3.js → chunk-4DHYSJJT.js} +1 -1
- package/vendor/{chunk-WDFERJG3.js → chunk-54UL4U2E.js} +42 -23
- package/vendor/{chunk-W2OJZZ6X.js → chunk-64AST7WZ.js} +2 -2
- package/vendor/{chunk-ZIOKV2X6.js → chunk-7HLNJ2BI.js} +113 -33
- package/vendor/{chunk-2XKSVKQA.js → chunk-AOZ3LMTF.js} +2 -2
- package/vendor/{chunk-C5SNDPAP.js → chunk-BYN6KXNP.js} +4 -4
- package/vendor/{chunk-Z5WCAUA6.js → chunk-DWWMBGHX.js} +16 -16
- package/vendor/{chunk-ZOHNXUDY.js → chunk-E6YVGIEW.js} +25 -8
- package/vendor/{chunk-NVTMIAAF.js → chunk-EEBIYWTE.js} +16 -16
- package/vendor/{chunk-GFASBPV2.js → chunk-F77ZTTNS.js} +3 -3
- package/vendor/{chunk-TG26CZGQ.js → chunk-F7AMEDDU.js} +4 -4
- package/vendor/{chunk-EA4QDDQA.js → chunk-GY5GATZL.js} +1 -1
- package/vendor/{chunk-HC76426R.js → chunk-ILQVLZ2I.js} +7 -5
- package/vendor/{chunk-6KS67EQE.js → chunk-KG3RANR4.js} +1 -1
- package/vendor/{chunk-OCILJ737.js → chunk-KRBZZ6GS.js} +8 -8
- package/vendor/{chunk-SHLRINKO.js → chunk-L4RD3TAZ.js} +1 -1
- package/vendor/{chunk-SRKIBFOE.js → chunk-LHUMBHG7.js} +1 -1
- package/vendor/{chunk-CHMH4LH5.js → chunk-NGV45YWB.js} +3 -3
- package/vendor/{chunk-V67IQB7H.js → chunk-OG7G6DIR.js} +1 -1
- package/vendor/{chunk-NOU7RHYZ.js → chunk-OZU6JFB4.js} +4 -4
- package/vendor/chunk-QV3WPU7A.js +8 -0
- package/vendor/{chunk-BUIM2M4R.js → chunk-S6HD3MDU.js} +2 -2
- package/vendor/{chunk-SNKWETM5.js → chunk-SQZ2OSP6.js} +2 -2
- package/vendor/{chunk-WPIEF4LY.js → chunk-T7OGE5E5.js} +3 -3
- package/vendor/{chunk-FYYRFX4U.js → chunk-TIBYKMRW.js} +74 -38
- package/vendor/{chunk-FN3HUUO2.js → chunk-UCOHFZ77.js} +73 -13
- package/vendor/{chunk-LRP66XEY.js → chunk-UIMUUIH7.js} +13 -13
- package/vendor/{chunk-EDPNYIX5.js → chunk-USHFSJT7.js} +141 -86
- package/vendor/{chunk-QRKHHWJJ.js → chunk-VGL5AZN5.js} +51 -3
- package/vendor/{chunk-PL3LWC5C.js → chunk-VLP72QWX.js} +1 -1
- package/vendor/{chunk-O7DW2VAV.js → chunk-W6632NOX.js} +3 -3
- package/vendor/{chunk-RCR4XPE3.js → chunk-WBMO7YCO.js} +1 -1
- package/vendor/chunk-XCO3RV3Z.js +11 -0
- package/vendor/{chunk-TVYEB2GN.js → chunk-XKXSC6YS.js} +34 -4
- package/vendor/{chunk-C4V72GXC.js → chunk-Y6GE52OP.js} +17 -17
- package/vendor/{chunk-BGENSONI.js → chunk-ZKKWLLPU.js} +1 -1
- package/vendor/cli.js +1 -1
- package/vendor/component-manifest-catalog.js +1 -1
- package/vendor/control-plane.js +4 -4
- package/vendor/chunk-7EGSY3E4.js +0 -8
- package/vendor/chunk-ZUDSZGVO.js +0 -11
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createRequire as createKoedRequire } from "node:module"; const require = createKoedRequire(import.meta.url);
|
|
2
2
|
import {
|
|
3
3
|
noteAiClientConnectionRevision
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-KG3RANR4.js";
|
|
5
5
|
import {
|
|
6
6
|
configureCodexIntegrationForRemoteBackend,
|
|
7
7
|
grantAiClientConnection,
|
|
@@ -17,13 +17,13 @@ import {
|
|
|
17
17
|
revokeAiClientConnection,
|
|
18
18
|
setupClaude,
|
|
19
19
|
setupPi
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-USHFSJT7.js";
|
|
21
21
|
import "./chunk-QT24SAW6.js";
|
|
22
22
|
import "./chunk-TISYUUEJ.js";
|
|
23
23
|
import {
|
|
24
24
|
resolveKoedServerConfig
|
|
25
25
|
} from "./chunk-ALJUSOF7.js";
|
|
26
|
-
import "./chunk-
|
|
26
|
+
import "./chunk-LHUMBHG7.js";
|
|
27
27
|
import {
|
|
28
28
|
resolveKoedServerPaths
|
|
29
29
|
} from "./chunk-TSAYTRX3.js";
|
|
@@ -31,24 +31,24 @@ import "./chunk-YZLQZU5E.js";
|
|
|
31
31
|
import "./chunk-W2HNI6AA.js";
|
|
32
32
|
import {
|
|
33
33
|
resolveKoedAppRuntime
|
|
34
|
-
} from "./chunk-
|
|
35
|
-
import "./chunk-
|
|
34
|
+
} from "./chunk-OG7G6DIR.js";
|
|
35
|
+
import "./chunk-UCOHFZ77.js";
|
|
36
36
|
import {
|
|
37
37
|
isProcessRunning
|
|
38
38
|
} from "./chunk-T6UB5PNX.js";
|
|
39
39
|
import {
|
|
40
40
|
require_proper_lockfile
|
|
41
41
|
} from "./chunk-7NXKPDF3.js";
|
|
42
|
-
import "./chunk-
|
|
43
|
-
import "./chunk-
|
|
44
|
-
import "./chunk-
|
|
45
|
-
import "./chunk-
|
|
42
|
+
import "./chunk-XCO3RV3Z.js";
|
|
43
|
+
import "./chunk-7HLNJ2BI.js";
|
|
44
|
+
import "./chunk-VGL5AZN5.js";
|
|
45
|
+
import "./chunk-QV3WPU7A.js";
|
|
46
46
|
import "./chunk-IY2HRXOZ.js";
|
|
47
|
-
import "./chunk-
|
|
48
|
-
import "./chunk-
|
|
47
|
+
import "./chunk-4DHYSJJT.js";
|
|
48
|
+
import "./chunk-WBMO7YCO.js";
|
|
49
49
|
import {
|
|
50
50
|
isTeamMemoryAnswerTaskCapability
|
|
51
|
-
} from "./chunk-
|
|
51
|
+
} from "./chunk-E6YVGIEW.js";
|
|
52
52
|
import {
|
|
53
53
|
NEVER,
|
|
54
54
|
ZodIssueCode,
|
|
@@ -13890,7 +13890,7 @@ var runRemoteMcpOperation = async (command, input, options) => {
|
|
|
13890
13890
|
}
|
|
13891
13891
|
};
|
|
13892
13892
|
var runRemoteMcpCommand = async (args, options) => {
|
|
13893
|
-
const { runKoedServerCli } = await import("./chunk-
|
|
13893
|
+
const { runKoedServerCli } = await import("./chunk-64AST7WZ.js");
|
|
13894
13894
|
return runKoedServerCli(["remote", ...args], {
|
|
13895
13895
|
stdout: options.stdout,
|
|
13896
13896
|
stderr: options.stderr,
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
} from "./chunk-ALJUSOF7.js";
|
|
15
15
|
import {
|
|
16
16
|
inspectDeviceIdentityStatus
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-LHUMBHG7.js";
|
|
18
18
|
import {
|
|
19
19
|
ensureKoedHome,
|
|
20
20
|
resolveKoedServerPaths
|
|
@@ -34,7 +34,7 @@ import {
|
|
|
34
34
|
resolveKoedAppRuntimeForExecution,
|
|
35
35
|
resolveKoedControlPlaneVersion,
|
|
36
36
|
resolveKoedRuntimeOwner
|
|
37
|
-
} from "./chunk-
|
|
37
|
+
} from "./chunk-OG7G6DIR.js";
|
|
38
38
|
import {
|
|
39
39
|
pinDesktopBundleGenerationForStart,
|
|
40
40
|
pinGenerationForStart,
|
|
@@ -43,7 +43,7 @@ import {
|
|
|
43
43
|
readDesktopBundleGeneration,
|
|
44
44
|
resolveDesktopRuntimeOwner,
|
|
45
45
|
validateDesktopRuntimeCapability
|
|
46
|
-
} from "./chunk-
|
|
46
|
+
} from "./chunk-UCOHFZ77.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-
|
|
58
|
+
} from "./chunk-4DHYSJJT.js";
|
|
59
59
|
import {
|
|
60
60
|
collectUpstreamRegistryStatus
|
|
61
|
-
} from "./chunk-
|
|
61
|
+
} from "./chunk-WBMO7YCO.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-
|
|
77
|
+
} from "./chunk-E6YVGIEW.js";
|
|
78
78
|
import {
|
|
79
79
|
__toESM
|
|
80
80
|
} from "./chunk-BTS4ZTF3.js";
|
|
@@ -443,6 +443,9 @@ var resolveLocalEmbeddingRuntimePaths = (paths, environment = process.env, exist
|
|
|
443
443
|
const llama = llamaOverride ? {
|
|
444
444
|
path: resolve(llamaOverride),
|
|
445
445
|
artifactSource: "explicit-override"
|
|
446
|
+
} : paths.nativeSelectionRoot ? {
|
|
447
|
+
path: koedRuntimeLlamaServer,
|
|
448
|
+
artifactSource: "koed-home-runtime"
|
|
446
449
|
} : chooseRuntimePath([
|
|
447
450
|
{
|
|
448
451
|
path: koedRuntimeLlamaServer,
|
|
@@ -832,7 +835,7 @@ var resolvePostgresBinDir = (paths, environment = process.env, exists = existsSy
|
|
|
832
835
|
return { binDir: resolve4(override), artifactSource: "explicit-override" };
|
|
833
836
|
}
|
|
834
837
|
const koedRuntimeDir = resolve4(paths.nativeSelectionRoot ?? resolve4(paths.koedHome, "runtime"), "postgres", "bin");
|
|
835
|
-
if (hasAnyPostgresBinary(koedRuntimeDir, exists)) {
|
|
838
|
+
if (paths.nativeSelectionRoot || hasAnyPostgresBinary(koedRuntimeDir, exists)) {
|
|
836
839
|
return { binDir: koedRuntimeDir, artifactSource: "koed-home-runtime" };
|
|
837
840
|
}
|
|
838
841
|
const packagedRuntimeRoot = resolvePackagedKoedRuntimeRoot(environment);
|
|
@@ -1775,7 +1778,7 @@ var setupPi = async (environment = process.env, spawnSync = nodeSpawnSync2, opti
|
|
|
1775
1778
|
models: []
|
|
1776
1779
|
}, void 0, options.desktopRuntimeCapability) : resolveKoedAppRuntime(paths, environment);
|
|
1777
1780
|
const sourceCandidates = runtime.kind === "source" ? [resolve7(runtime.root, "packages/mcp-server/integrations/pi")] : [
|
|
1778
|
-
resolve7(runtime.root, "node_modules/@koed/mcp-server/integrations/pi"),
|
|
1781
|
+
resolve7(runtime.root, "node_modules/@koed-labs/mcp-server/integrations/pi"),
|
|
1779
1782
|
resolve7(runtime.root, "mcp-server/integrations/pi")
|
|
1780
1783
|
];
|
|
1781
1784
|
const source = sourceCandidates.find(existsSync8);
|
|
@@ -3460,7 +3463,7 @@ var inspectMcp = async (environment, paths, deps) => {
|
|
|
3460
3463
|
const cliPath = appRuntime.mcpCli;
|
|
3461
3464
|
if (!deps.existsSync(cliPath)) {
|
|
3462
3465
|
const authenticatedGenerationMissing = appRuntime.missing.some((entry) => entry.startsWith("authenticated "));
|
|
3463
|
-
return notConfigured(authenticatedGenerationMissing ? "No active authenticated Koed app-runtime generation is available." : appRuntime.kind === "packaged" ? "Packaged MCP Server artifact was not found." : "MCP Server build output was not found.", authenticatedGenerationMissing ? "Install and activate a compatible signed Koed app-runtime generation; status does not install or activate components." : appRuntime.kind === "packaged" ? "Install a compatible signed Koed app-runtime generation containing MCP Server and Supported Capture Hook artifacts." : "Run pnpm --filter @koed/mcp-server build or koed setup core --json.", {
|
|
3466
|
+
return notConfigured(authenticatedGenerationMissing ? "No active authenticated Koed app-runtime generation is available." : appRuntime.kind === "packaged" ? "Packaged MCP Server artifact was not found." : "MCP Server build output was not found.", authenticatedGenerationMissing ? "Install and activate a compatible signed Koed app-runtime generation; status does not install or activate components." : appRuntime.kind === "packaged" ? "Install a compatible signed Koed app-runtime generation containing MCP Server and Supported Capture Hook artifacts." : "Run pnpm --filter @koed-labs/mcp-server build or koed setup core --json.", {
|
|
3464
3467
|
artifactSource: appRuntime.artifactSource,
|
|
3465
3468
|
runtimeRoot: appRuntime.root,
|
|
3466
3469
|
missing: appRuntime.missing
|
|
@@ -4512,11 +4515,122 @@ var collectKoedServerDoctor = async (environment = process.env, dependencies = {
|
|
|
4512
4515
|
};
|
|
4513
4516
|
};
|
|
4514
4517
|
|
|
4518
|
+
// packages/koed-server/dist/codex-config-block.mjs
|
|
4519
|
+
import { basename as basename2, dirname as dirname10, isAbsolute as isAbsolute3, join as join4 } from "node:path";
|
|
4520
|
+
function codexConfigSections({ nodeCommand, mcpName, mcpCliPath, captureHookPath, koedHome }) {
|
|
4521
|
+
const hookCommand = [
|
|
4522
|
+
nodeCommand,
|
|
4523
|
+
captureHookPath,
|
|
4524
|
+
"--koed-home",
|
|
4525
|
+
koedHome,
|
|
4526
|
+
"--memory-tool",
|
|
4527
|
+
`mcp__${mcpName}__memory_answer`
|
|
4528
|
+
].map((value) => JSON.stringify(value)).join(" ");
|
|
4529
|
+
const hookEvents = [
|
|
4530
|
+
["PreToolUse", 10],
|
|
4531
|
+
["SessionStart", 10],
|
|
4532
|
+
["UserPromptSubmit", 10],
|
|
4533
|
+
["PostToolUse", 10],
|
|
4534
|
+
["Stop", 30],
|
|
4535
|
+
["SubagentStart", 10],
|
|
4536
|
+
["SubagentStop", 30]
|
|
4537
|
+
];
|
|
4538
|
+
const hookBlocks = hookEvents.map(([eventName, timeout]) => `[[hooks.${eventName}]]
|
|
4539
|
+
${eventName === "PreToolUse" ? `matcher = ${JSON.stringify(`mcp__${mcpName}__memory_answer`)}
|
|
4540
|
+
` : ""}[[hooks.${eventName}.hooks]]
|
|
4541
|
+
type = "command"
|
|
4542
|
+
command = ${JSON.stringify(hookCommand)}
|
|
4543
|
+
timeout = ${timeout}`).join("\n\n");
|
|
4544
|
+
const header = `mcp_servers.${mcpName}`;
|
|
4545
|
+
const tables = [
|
|
4546
|
+
`[${header}]
|
|
4547
|
+
command = ${JSON.stringify(nodeCommand)}
|
|
4548
|
+
args = [${JSON.stringify(mcpCliPath)}]
|
|
4549
|
+
enabled = true`,
|
|
4550
|
+
...[
|
|
4551
|
+
"memory_answer",
|
|
4552
|
+
"memory_answer_result",
|
|
4553
|
+
"memory_answer_cancel",
|
|
4554
|
+
"memory_workspaces"
|
|
4555
|
+
].map((tool) => `[${header}.tools.${tool}]
|
|
4556
|
+
approval_mode = "approve"`),
|
|
4557
|
+
`[${header}.env]
|
|
4558
|
+
KOED_HOME = ${JSON.stringify(koedHome)}`
|
|
4559
|
+
];
|
|
4560
|
+
return { tables, hooks: hookBlocks };
|
|
4561
|
+
}
|
|
4562
|
+
function renderCodexBlock(config) {
|
|
4563
|
+
const { tables, hooks } = codexConfigSections(config);
|
|
4564
|
+
return `# >>> koed
|
|
4565
|
+
${tables.join("\n\n")}
|
|
4566
|
+
|
|
4567
|
+
${hooks}
|
|
4568
|
+
# <<< koed
|
|
4569
|
+
`;
|
|
4570
|
+
}
|
|
4571
|
+
function stripReorderedCodexBlock(content, config) {
|
|
4572
|
+
if (!content.trimEnd().endsWith("# <<< koed") || /^\s*# >>> koed\s*$/m.test(content))
|
|
4573
|
+
return content;
|
|
4574
|
+
if ((content.match(/^[\t ]*# <<< koed[\t ]*\r?$/gm) ?? []).length !== 1 || /"""|'''/.test(content))
|
|
4575
|
+
return content;
|
|
4576
|
+
const header = `[mcp_servers.${config.mcpName}]`;
|
|
4577
|
+
const tables = content.split(/(?=^\[)/m);
|
|
4578
|
+
const server = tables.find((table) => table.split(/\r?\n/, 1)[0] === header);
|
|
4579
|
+
if (!server)
|
|
4580
|
+
return content;
|
|
4581
|
+
let cli;
|
|
4582
|
+
let command;
|
|
4583
|
+
try {
|
|
4584
|
+
const args = JSON.parse(/^args = (.+)$/m.exec(server)?.[1] ?? "");
|
|
4585
|
+
command = JSON.parse(/^command = (.+)$/m.exec(server)?.[1] ?? "");
|
|
4586
|
+
if (!Array.isArray(args) || args.length !== 1 || typeof command !== "string")
|
|
4587
|
+
return content;
|
|
4588
|
+
cli = args[0];
|
|
4589
|
+
} catch {
|
|
4590
|
+
return content;
|
|
4591
|
+
}
|
|
4592
|
+
if (typeof cli !== "string" || !isAbsolute3(cli) || basename2(cli) !== "cli.js" || basename2(dirname10(cli)) !== "dist" || basename2(dirname10(dirname10(cli))) !== "mcp-server")
|
|
4593
|
+
return content;
|
|
4594
|
+
const captureHookPath = join4(dirname10(cli), "capture-hook.js");
|
|
4595
|
+
const expected = codexConfigSections({
|
|
4596
|
+
...config,
|
|
4597
|
+
nodeCommand: command,
|
|
4598
|
+
mcpCliPath: cli,
|
|
4599
|
+
captureHookPath
|
|
4600
|
+
});
|
|
4601
|
+
const newline = server.includes("\r\n") ? "\r\n" : "\n";
|
|
4602
|
+
const hooks = (expected.hooks + "\n# <<< koed").replaceAll("\n", newline);
|
|
4603
|
+
const trimmed = content.trimEnd();
|
|
4604
|
+
if (!trimmed.endsWith(newline + hooks))
|
|
4605
|
+
return content;
|
|
4606
|
+
const beforeHooks = content.slice(0, trimmed.length - hooks.length);
|
|
4607
|
+
if (beforeHooks.includes(captureHookPath))
|
|
4608
|
+
return content;
|
|
4609
|
+
const expectedTables = new Map(expected.tables.map((table) => [table.split("\n", 1)[0], table]));
|
|
4610
|
+
const retained = [];
|
|
4611
|
+
for (const table of beforeHooks.split(/(?=^\[)/m)) {
|
|
4612
|
+
const name = table.split(/\r?\n/, 1)[0];
|
|
4613
|
+
if (name !== header && !name.startsWith(header.slice(0, -1) + ".")) {
|
|
4614
|
+
retained.push(table);
|
|
4615
|
+
continue;
|
|
4616
|
+
}
|
|
4617
|
+
const expectedTable = expectedTables.get(name);
|
|
4618
|
+
const actual = table.trimEnd().replaceAll("\r\n", "\n");
|
|
4619
|
+
if (!expectedTable)
|
|
4620
|
+
return content;
|
|
4621
|
+
const matchesImplicitEnabled = name === header && actual === expectedTable.replace("\nenabled = true", "");
|
|
4622
|
+
if (actual !== expectedTable && !matchesImplicitEnabled)
|
|
4623
|
+
return content;
|
|
4624
|
+
expectedTables.delete(name);
|
|
4625
|
+
}
|
|
4626
|
+
return expectedTables.size === 0 ? retained.join("") : content;
|
|
4627
|
+
}
|
|
4628
|
+
|
|
4515
4629
|
// packages/koed-server/dist/setup.js
|
|
4516
4630
|
import { spawnSync as nodeSpawnSync5 } from "node:child_process";
|
|
4517
4631
|
import { chmodSync as nodeChmodSync, existsSync as nodeExistsSync, mkdirSync as nodeMkdirSync, readFileSync as nodeReadFileSync, statSync as nodeStatSync, unlinkSync as nodeUnlinkSync, writeFileSync as nodeWriteFileSync } from "node:fs";
|
|
4518
4632
|
import { homedir as homedir5 } from "node:os";
|
|
4519
|
-
import { dirname as
|
|
4633
|
+
import { dirname as dirname11, resolve as resolve15 } from "node:path";
|
|
4520
4634
|
|
|
4521
4635
|
// packages/koed-server/dist/local-service-secrets.js
|
|
4522
4636
|
import { randomBytes } from "node:crypto";
|
|
@@ -4731,7 +4845,7 @@ var restoreManagedFile = (path2, snapshot, existsSync13, writeFileSync8, mkdirSy
|
|
|
4731
4845
|
nodeUnlinkSync(path2);
|
|
4732
4846
|
return;
|
|
4733
4847
|
}
|
|
4734
|
-
mkdirSync8(
|
|
4848
|
+
mkdirSync8(dirname11(path2), { recursive: true, mode: 448 });
|
|
4735
4849
|
writeFileSync8(path2, snapshot.content, { mode: snapshot.mode ?? 384 });
|
|
4736
4850
|
if (snapshot.mode !== null)
|
|
4737
4851
|
nodeChmodSync(path2, snapshot.mode);
|
|
@@ -4749,7 +4863,6 @@ var configureCodexIntegration = ({ paths, environment, apiUrl, readFileSync: rea
|
|
|
4749
4863
|
const codexConfigPath = resolve15(environment.CODEX_CONFIG_PATH ?? `${environment.CODEX_HOME ?? `${homedir5()}/.codex`}/config.toml`);
|
|
4750
4864
|
const codexInstructionsPath = resolveCodexGlobalInstructionsPath(environment);
|
|
4751
4865
|
const existing = existsSync13(codexConfigPath) ? String(readFileSync8(codexConfigPath, "utf8")) : "";
|
|
4752
|
-
const withoutPrevious = stripCodexOwnershipBlock(existing);
|
|
4753
4866
|
if (!/^[A-Za-z0-9_-]+$/.test(mcpName))
|
|
4754
4867
|
throw new Error("MEMORY_MCP_NAME must be a TOML bare server name.");
|
|
4755
4868
|
const guidancePath = resolveCodexGuidancePath(runtime.mcpCli);
|
|
@@ -4764,60 +4877,20 @@ var configureCodexIntegration = ({ paths, environment, apiUrl, readFileSync: rea
|
|
|
4764
4877
|
} else {
|
|
4765
4878
|
nextInstructions = removeManagedCodexGuidance(existingInstructions);
|
|
4766
4879
|
}
|
|
4767
|
-
const
|
|
4768
|
-
const markerEnd = "# <<< koed";
|
|
4769
|
-
const hookCommand = [
|
|
4880
|
+
const config = {
|
|
4770
4881
|
nodeCommand,
|
|
4771
|
-
|
|
4772
|
-
|
|
4773
|
-
|
|
4774
|
-
|
|
4775
|
-
|
|
4776
|
-
|
|
4777
|
-
const
|
|
4778
|
-
|
|
4779
|
-
["SessionStart", 10],
|
|
4780
|
-
["UserPromptSubmit", 10],
|
|
4781
|
-
["PostToolUse", 10],
|
|
4782
|
-
["Stop", 30],
|
|
4783
|
-
["SubagentStart", 10],
|
|
4784
|
-
["SubagentStop", 30]
|
|
4785
|
-
];
|
|
4786
|
-
const hookBlocks = hookEvents.map(([eventName, timeout]) => `[[hooks.${eventName}]]
|
|
4787
|
-
${eventName === "PreToolUse" ? `matcher = ${tomlString(`mcp__${mcpName}__memory_answer`)}
|
|
4788
|
-
` : ""}[[hooks.${eventName}.hooks]]
|
|
4789
|
-
type = "command"
|
|
4790
|
-
command = ${tomlString(hookCommand)}
|
|
4791
|
-
timeout = ${timeout}`).join("\n\n");
|
|
4792
|
-
const koedBlock = `${markerStart}
|
|
4793
|
-
[mcp_servers.${mcpName}]
|
|
4794
|
-
command = ${tomlString(nodeCommand)}
|
|
4795
|
-
args = [${tomlString(runtime.mcpCli)}]
|
|
4796
|
-
enabled = true
|
|
4797
|
-
|
|
4798
|
-
[mcp_servers.${mcpName}.tools.memory_answer]
|
|
4799
|
-
approval_mode = "approve"
|
|
4800
|
-
|
|
4801
|
-
[mcp_servers.${mcpName}.tools.memory_answer_result]
|
|
4802
|
-
approval_mode = "approve"
|
|
4803
|
-
|
|
4804
|
-
[mcp_servers.${mcpName}.tools.memory_answer_cancel]
|
|
4805
|
-
approval_mode = "approve"
|
|
4806
|
-
|
|
4807
|
-
[mcp_servers.${mcpName}.tools.memory_workspaces]
|
|
4808
|
-
approval_mode = "approve"
|
|
4809
|
-
|
|
4810
|
-
[mcp_servers.${mcpName}.env]
|
|
4811
|
-
KOED_HOME = ${tomlString(paths.koedHome)}
|
|
4812
|
-
|
|
4813
|
-
${hookBlocks}
|
|
4814
|
-
${markerEnd}
|
|
4815
|
-
`;
|
|
4816
|
-
mkdirSync8(dirname10(codexConfigPath), { recursive: true, mode: 448 });
|
|
4882
|
+
mcpName,
|
|
4883
|
+
mcpCliPath: runtime.mcpCli,
|
|
4884
|
+
captureHookPath: runtime.captureHook,
|
|
4885
|
+
koedHome: paths.koedHome
|
|
4886
|
+
};
|
|
4887
|
+
const withoutPrevious = stripCodexOwnershipBlock(stripReorderedCodexBlock(existing, config));
|
|
4888
|
+
const koedBlock = renderCodexBlock(config);
|
|
4889
|
+
mkdirSync8(dirname11(codexConfigPath), { recursive: true, mode: 448 });
|
|
4817
4890
|
writeFileSync8(codexConfigPath, `${withoutPrevious.trimEnd()}
|
|
4818
4891
|
|
|
4819
4892
|
${koedBlock}`);
|
|
4820
|
-
mkdirSync8(
|
|
4893
|
+
mkdirSync8(dirname11(codexInstructionsPath), { recursive: true, mode: 448 });
|
|
4821
4894
|
if (nextInstructions !== existingInstructions) {
|
|
4822
4895
|
writeFileSync8(codexInstructionsPath, nextInstructions, { mode: 384 });
|
|
4823
4896
|
}
|
|
@@ -4886,13 +4959,13 @@ var removeCodexIntegration = ({ environment = process.env, readFileSync: readFil
|
|
|
4886
4959
|
}
|
|
4887
4960
|
const nextInstructions = instructionsSnapshot.content === null ? null : removeManagedCodexGuidance(instructionsSnapshot.content);
|
|
4888
4961
|
if (nextConfig !== configSnapshot.content && nextConfig !== null) {
|
|
4889
|
-
mkdirSync8(
|
|
4962
|
+
mkdirSync8(dirname11(codexConfigPath), { recursive: true, mode: 448 });
|
|
4890
4963
|
writeFileSync8(codexConfigPath, nextConfig, {
|
|
4891
4964
|
mode: configSnapshot.mode ?? 384
|
|
4892
4965
|
});
|
|
4893
4966
|
}
|
|
4894
4967
|
if (nextInstructions !== instructionsSnapshot.content && nextInstructions !== null) {
|
|
4895
|
-
mkdirSync8(
|
|
4968
|
+
mkdirSync8(dirname11(codexInstructionsPath), {
|
|
4896
4969
|
recursive: true,
|
|
4897
4970
|
mode: 448
|
|
4898
4971
|
});
|
|
@@ -5034,7 +5107,6 @@ var configureCodexProfile = ({ environment = process.env, readFileSync: readFile
|
|
|
5034
5107
|
stdout: result.stdout,
|
|
5035
5108
|
action: "Restart Codex and trust updated hooks if prompted. New sessions will be captured after Codex reloads this config."
|
|
5036
5109
|
};
|
|
5037
|
-
writeSetupVerification(paths, repaired, writeFileSync8);
|
|
5038
5110
|
return repaired;
|
|
5039
5111
|
} catch (error) {
|
|
5040
5112
|
const failures = [error instanceof Error ? error.message : String(error)];
|
|
@@ -5069,7 +5141,6 @@ var configureCodexProfile = ({ environment = process.env, readFileSync: readFile
|
|
|
5069
5141
|
error: failures.join(" "),
|
|
5070
5142
|
action: "Review the reported failure, fix the Codex integration artifacts, then run the Codex-specific repair action again."
|
|
5071
5143
|
};
|
|
5072
|
-
writeSetupVerification(paths, failed, writeFileSync8);
|
|
5073
5144
|
return failed;
|
|
5074
5145
|
}
|
|
5075
5146
|
};
|
|
@@ -5238,18 +5309,10 @@ var runSetupBootstrap = (context, spawnSync) => {
|
|
|
5238
5309
|
...output,
|
|
5239
5310
|
ok: false,
|
|
5240
5311
|
state: "needs_attention",
|
|
5241
|
-
error: `Codex setup failed with exit code ${result.status ?? 1}.`,
|
|
5312
|
+
error: output.stderr?.includes("Codex Koed ownership markers are duplicated or incomplete.") ? "Codex config.toml has incomplete or duplicate Koed markers. Review the Koed MCP Server and Capture Hook entries before retrying." : `Codex setup failed with exit code ${result.status ?? 1}.`,
|
|
5242
5313
|
action: "Review stdout/stderr, fix the reported client setup failure, then rerun koed setup codex --json."
|
|
5243
5314
|
};
|
|
5244
5315
|
};
|
|
5245
|
-
var writeSetupVerification = (paths, result, writeFileSync8, successMessage = "Koed core setup completed.") => {
|
|
5246
|
-
writeFileSync8(paths.lastVerificationPath, `${JSON.stringify({
|
|
5247
|
-
ok: result.ok,
|
|
5248
|
-
checkedAt: result.checkedAt,
|
|
5249
|
-
message: result.ok ? successMessage : result.error
|
|
5250
|
-
}, null, 2)}
|
|
5251
|
-
`, { mode: 384 });
|
|
5252
|
-
};
|
|
5253
5316
|
var setupCore = async (options = {}) => {
|
|
5254
5317
|
const environment = options.environment ?? process.env;
|
|
5255
5318
|
const prepared = prepareSetupCodex(environment, options, "core");
|
|
@@ -5301,11 +5364,8 @@ var setupCore = async (options = {}) => {
|
|
|
5301
5364
|
var setupCodex = async (options = {}) => {
|
|
5302
5365
|
const core = await setupCore(options);
|
|
5303
5366
|
const writeFileSync8 = options.writeFileSync ?? nodeWriteFileSync;
|
|
5304
|
-
if (!core.ok)
|
|
5305
|
-
const paths2 = resolveKoedServerPaths(options.environment ?? process.env);
|
|
5306
|
-
writeSetupVerification(paths2, core, writeFileSync8, "Codex setup completed.");
|
|
5367
|
+
if (!core.ok)
|
|
5307
5368
|
return core;
|
|
5308
|
-
}
|
|
5309
5369
|
const environment = options.environment ?? process.env;
|
|
5310
5370
|
const paths = resolveKoedServerPaths(environment);
|
|
5311
5371
|
if (environment.KOED_CODEX_GLOBAL_MEMORY_GUIDANCE_ENABLED === "true" || environment.KOED_CODEX_GLOBAL_MEMORY_GUIDANCE_ENABLED === "false") {
|
|
@@ -5342,10 +5402,8 @@ var setupCodex = async (options = {}) => {
|
|
|
5342
5402
|
});
|
|
5343
5403
|
}
|
|
5344
5404
|
const prepared = prepareSetupCodex(environment, options);
|
|
5345
|
-
if (!prepared.ok)
|
|
5346
|
-
writeSetupVerification(prepared.paths, prepared.result, writeFileSync8);
|
|
5405
|
+
if (!prepared.ok)
|
|
5347
5406
|
return prepared.result;
|
|
5348
|
-
}
|
|
5349
5407
|
const { context } = prepared;
|
|
5350
5408
|
try {
|
|
5351
5409
|
assertAiClientRegistryWritable(context.childEnv);
|
|
@@ -5360,7 +5418,6 @@ var setupCodex = async (options = {}) => {
|
|
|
5360
5418
|
error: error instanceof Error ? error.message : String(error),
|
|
5361
5419
|
action: "Fix malformed AI Client registry, then rerun Codex setup."
|
|
5362
5420
|
};
|
|
5363
|
-
writeSetupVerification(context.paths, failed, writeFileSync8, "Codex setup completed.");
|
|
5364
5421
|
return failed;
|
|
5365
5422
|
}
|
|
5366
5423
|
let codexExecutablePath;
|
|
@@ -5377,7 +5434,6 @@ var setupCodex = async (options = {}) => {
|
|
|
5377
5434
|
error: error instanceof Error ? error.message : String(error),
|
|
5378
5435
|
action: "Install Codex or set MEMORY_CODEX_APP_SERVER_BINARY, then rerun Codex setup."
|
|
5379
5436
|
};
|
|
5380
|
-
writeSetupVerification(context.paths, failed, writeFileSync8, "Codex setup completed.");
|
|
5381
5437
|
return failed;
|
|
5382
5438
|
}
|
|
5383
5439
|
persistSetupApiToken(context);
|
|
@@ -5402,11 +5458,9 @@ var setupCodex = async (options = {}) => {
|
|
|
5402
5458
|
error: error instanceof Error ? error.message : String(error),
|
|
5403
5459
|
action: "Fix the Codex-specific registration, then rerun koed setup codex --json."
|
|
5404
5460
|
};
|
|
5405
|
-
writeSetupVerification(context.paths, failed, writeFileSync8, "Codex setup completed.");
|
|
5406
5461
|
return failed;
|
|
5407
5462
|
}
|
|
5408
5463
|
}
|
|
5409
|
-
writeSetupVerification(context.paths, result, writeFileSync8, "Codex setup completed.");
|
|
5410
5464
|
return result;
|
|
5411
5465
|
};
|
|
5412
5466
|
|
|
@@ -5414,6 +5468,7 @@ export {
|
|
|
5414
5468
|
hasCompletePostgresOverride,
|
|
5415
5469
|
stopLocalPostgresRuntime,
|
|
5416
5470
|
startLocalPostgresRuntime,
|
|
5471
|
+
localServiceSecretsPath,
|
|
5417
5472
|
ensurePackagedLocalServiceSecrets,
|
|
5418
5473
|
pinAndResolvePackagedRuntime,
|
|
5419
5474
|
resolveCodexExecutablePath,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createRequire as createKoedRequire } from "node:module"; const require = createKoedRequire(import.meta.url);
|
|
2
2
|
import {
|
|
3
3
|
productionNativeRuntimeCatalog
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-QV3WPU7A.js";
|
|
5
5
|
import {
|
|
6
6
|
external_exports
|
|
7
7
|
} from "./chunk-FSNLU46W.js";
|
|
@@ -66,7 +66,7 @@ var cudaPin = external_exports.object({
|
|
|
66
66
|
}).strict()
|
|
67
67
|
}).strict().refine((pin) => retainedUrl("cuda", pin), "Native CUDA URL does not identify the retained recipe release.");
|
|
68
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;
|
|
69
|
+
var compatibleCuda = (core, cuda) => core.target.platform === "linux" && "revision" in core.components.llamaCpp && 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
70
|
var compareNativeVersions = (left, right) => {
|
|
71
71
|
const a = version.parse(left).split(".").map(Number);
|
|
72
72
|
const b = version.parse(right).split(".").map(Number);
|
|
@@ -83,6 +83,53 @@ var catalog = external_exports.object({
|
|
|
83
83
|
core: corePin,
|
|
84
84
|
cuda: cudaPin.nullable()
|
|
85
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 macCorePin = external_exports.object({
|
|
87
|
+
...corePin.shape,
|
|
88
|
+
target: external_exports.object({
|
|
89
|
+
platform: external_exports.literal("macos"),
|
|
90
|
+
architecture: external_exports.literal("arm64"),
|
|
91
|
+
minimumVersion: external_exports.literal("14.0")
|
|
92
|
+
}).strict(),
|
|
93
|
+
components: external_exports.object({
|
|
94
|
+
postgres: external_exports.object({
|
|
95
|
+
major: external_exports.literal(17),
|
|
96
|
+
version: external_exports.string().regex(/^17\.\d+$/)
|
|
97
|
+
}).strict(),
|
|
98
|
+
pgvector: external_exports.object({ version: external_exports.literal("0.8.3") }).strict(),
|
|
99
|
+
llamaCpp: external_exports.object({ version: external_exports.string().regex(/^b\d+$/) }).strict()
|
|
100
|
+
}).strict()
|
|
101
|
+
}).strict().refine((pin) => {
|
|
102
|
+
const prefix = "https://github.com/koed-labs/koed/releases/download/";
|
|
103
|
+
const [tag, archive, ...extra] = pin.url.slice(prefix.length).split("/");
|
|
104
|
+
return pin.url.startsWith(prefix) && extra.length === 0 && archive === `koed-native-core-${pin.recipeId}-macos-arm64.tar.gz` && (tag === `native-core-${pin.recipeId}` || /^v(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)$/.test(tag ?? ""));
|
|
105
|
+
}, "Native macOS core URL does not identify the retained recipe release.");
|
|
106
|
+
var macCatalog = external_exports.object({
|
|
107
|
+
schemaVersion: external_exports.literal(1),
|
|
108
|
+
minimumCoreVersion: version,
|
|
109
|
+
core: macCorePin,
|
|
110
|
+
cuda: external_exports.null()
|
|
111
|
+
}).strict().refine((value) => compareNativeVersions(value.core.runtimeVersion, value.minimumCoreVersion) >= 0);
|
|
112
|
+
var compiledCatalog = external_exports.object({
|
|
113
|
+
schemaVersion: external_exports.literal(2),
|
|
114
|
+
linux: catalog.nullable(),
|
|
115
|
+
macos: macCatalog.nullable()
|
|
116
|
+
}).strict();
|
|
117
|
+
function validateCompiledNativeRuntimeCatalog(value) {
|
|
118
|
+
const result = compiledCatalog.safeParse(value);
|
|
119
|
+
if (!result.success)
|
|
120
|
+
throw new Error(`Invalid compiled native runtime catalog: ${result.error.message}`);
|
|
121
|
+
return result.data;
|
|
122
|
+
}
|
|
123
|
+
function selectNativeRuntimeCatalog(value, platform, architecture) {
|
|
124
|
+
if (!(platform === "linux" && architecture === "x64" || platform === "darwin" && architecture === "arm64"))
|
|
125
|
+
throw new Error("Unsupported release runtime host. Requires Linux x64 or macOS arm64.");
|
|
126
|
+
const isLegacy = typeof value === "object" && value !== null && "schemaVersion" in value && value.schemaVersion === 1;
|
|
127
|
+
const compiled = isLegacy ? { linux: validateNativeRuntimeCatalog(value), macos: null } : validateCompiledNativeRuntimeCatalog(value);
|
|
128
|
+
const selected = platform === "linux" ? compiled.linux : compiled.macos;
|
|
129
|
+
if (!selected)
|
|
130
|
+
throw new Error("This Control Plane has no reviewed native runtime pin for this host. Use a trusted release with native runtime support.");
|
|
131
|
+
return selected;
|
|
132
|
+
}
|
|
86
133
|
var validateNativeRuntimeCatalog = (value) => {
|
|
87
134
|
const parsed = catalog.safeParse(value);
|
|
88
135
|
if (!parsed.success)
|
|
@@ -92,13 +139,14 @@ var validateNativeRuntimeCatalog = (value) => {
|
|
|
92
139
|
var getNativeRuntimeCatalog = () => {
|
|
93
140
|
if (productionNativeRuntimeCatalog === null)
|
|
94
141
|
throw new Error("This Control Plane has no reviewed native runtime pin. Use a trusted release with native runtime support.");
|
|
95
|
-
return
|
|
142
|
+
return selectNativeRuntimeCatalog(productionNativeRuntimeCatalog, process.platform, process.arch);
|
|
96
143
|
};
|
|
97
144
|
|
|
98
145
|
export {
|
|
99
146
|
nativeKind,
|
|
100
147
|
compatibleCuda,
|
|
101
148
|
compareNativeVersions,
|
|
149
|
+
selectNativeRuntimeCatalog,
|
|
102
150
|
validateNativeRuntimeCatalog,
|
|
103
151
|
getNativeRuntimeCatalog
|
|
104
152
|
};
|
|
@@ -2,10 +2,10 @@ import { createRequire as createKoedRequire } from "node:module"; const require
|
|
|
2
2
|
import {
|
|
3
3
|
checkCudaHost,
|
|
4
4
|
validateStagedCuda
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-XKXSC6YS.js";
|
|
6
6
|
import "./chunk-JYK6UL6D.js";
|
|
7
|
-
import "./chunk-
|
|
8
|
-
import "./chunk-
|
|
7
|
+
import "./chunk-VGL5AZN5.js";
|
|
8
|
+
import "./chunk-QV3WPU7A.js";
|
|
9
9
|
import "./chunk-FSNLU46W.js";
|
|
10
10
|
import "./chunk-BTS4ZTF3.js";
|
|
11
11
|
export {
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { createRequire as createKoedRequire } from "node:module"; const require = createKoedRequire(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
validateManifestCatalog
|
|
4
|
+
} from "./chunk-IY2HRXOZ.js";
|
|
5
|
+
|
|
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" } }] });
|
|
8
|
+
|
|
9
|
+
export {
|
|
10
|
+
productionComponentManifestCatalog
|
|
11
|
+
};
|