@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
@@ -0,0 +1,175 @@
1
+ import { createRequire as createKoedRequire } from "node:module"; const require = createKoedRequire(import.meta.url);
2
+
3
+ // packages/koed-server/dist/config.js
4
+ import { existsSync, readFileSync, renameSync, rmSync, writeFileSync } from "node:fs";
5
+ import { randomUUID } from "node:crypto";
6
+ import { dirname } from "node:path";
7
+ import { mkdirSync } from "node:fs";
8
+ var defaultKoedServerConfig = {
9
+ runtimeMode: "local-personal",
10
+ dependencyMode: "bundled-local",
11
+ codexTranscriptWatcherEnabled: true,
12
+ claudeTranscriptWatcherEnabled: true,
13
+ piTranscriptWatcherEnabled: true,
14
+ codexGlobalMemoryGuidanceEnabled: true,
15
+ hardwareAcceleration: "auto"
16
+ };
17
+ var trim = (value) => {
18
+ const trimmed = value?.trim();
19
+ return trimmed ? trimmed : void 0;
20
+ };
21
+ var runtimeMode = (value) => value === "local-personal" || value === "external" || value === "developer" ? value : void 0;
22
+ var dependencyMode = (value) => value === "external" || value === "bundled-local" ? value : void 0;
23
+ var codexTranscriptWatcherSetting = (value) => {
24
+ if (value === true || value === "true")
25
+ return true;
26
+ if (value === false || value === "false")
27
+ return false;
28
+ return void 0;
29
+ };
30
+ var claudeTranscriptWatcherSetting = codexTranscriptWatcherSetting;
31
+ var piTranscriptWatcherSetting = codexTranscriptWatcherSetting;
32
+ var booleanSetting = codexTranscriptWatcherSetting;
33
+ var hardwareAccelerationPreference = (value, source) => value === void 0 ? void 0 : value === "auto" || value === "cpu" ? value : (() => {
34
+ throw new Error(`${source} must be auto or cpu`);
35
+ })();
36
+ var readConfig = (paths, deps) => {
37
+ if (!deps.existsSync(paths.serverConfigPath)) {
38
+ return {};
39
+ }
40
+ try {
41
+ const parsed = JSON.parse(deps.readFileSync(paths.serverConfigPath, "utf8"));
42
+ if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
43
+ throw new Error("expected a JSON object");
44
+ }
45
+ const record = parsed;
46
+ if (!deps.strict)
47
+ return record;
48
+ const stringFields = ["runtimeMode", "dependencyMode"];
49
+ const booleanFields = [
50
+ "codexTranscriptWatcherEnabled",
51
+ "claudeTranscriptWatcherEnabled",
52
+ "piTranscriptWatcherEnabled",
53
+ "codexGlobalMemoryGuidanceEnabled"
54
+ ];
55
+ for (const field of stringFields) {
56
+ if (record[field] !== void 0 && typeof record[field] !== "string") {
57
+ throw new Error(`${field} must be a string`);
58
+ }
59
+ }
60
+ if (record.runtimeMode !== void 0 && !runtimeMode(record.runtimeMode)) {
61
+ throw new Error("runtimeMode must be local-personal, external, or developer");
62
+ }
63
+ if (record.dependencyMode !== void 0 && !dependencyMode(record.dependencyMode)) {
64
+ throw new Error("dependencyMode must be bundled-local or external");
65
+ }
66
+ for (const field of booleanFields) {
67
+ if (record[field] !== void 0 && typeof record[field] !== "boolean") {
68
+ throw new Error(`${field} must be a boolean`);
69
+ }
70
+ }
71
+ if (record.hardwareAcceleration !== void 0) {
72
+ hardwareAccelerationPreference(record.hardwareAcceleration, "server.json hardwareAcceleration");
73
+ }
74
+ if (record.external !== void 0 && (!record.external || typeof record.external !== "object" || Array.isArray(record.external))) {
75
+ throw new Error("external must be an object");
76
+ }
77
+ if (record.external && typeof record.external === "object") {
78
+ const external = record.external;
79
+ const supportedExternalFields = [
80
+ "databaseUrl",
81
+ "redisUrl",
82
+ "embeddingServiceUrl",
83
+ "privacyServiceUrl"
84
+ ];
85
+ for (const [field, value] of Object.entries(external)) {
86
+ if (!supportedExternalFields.includes(field)) {
87
+ throw new Error(`external.${field} is not supported`);
88
+ }
89
+ if (value !== void 0 && typeof value !== "string") {
90
+ throw new Error(`external.${field} must be a string`);
91
+ }
92
+ }
93
+ }
94
+ return record;
95
+ } catch (error) {
96
+ if (!deps.strict)
97
+ return {};
98
+ const message = error instanceof Error ? error.message : String(error);
99
+ throw new Error(`Cannot read ${paths.serverConfigPath}: ${message}`, {
100
+ cause: error
101
+ });
102
+ }
103
+ };
104
+ var resolveKoedServerConfig = (paths, environment = process.env, deps = {}) => {
105
+ const file = readConfig(paths, {
106
+ existsSync: deps.existsSync ?? existsSync,
107
+ readFileSync: deps.readFileSync ?? readFileSync,
108
+ strict: deps.strict
109
+ });
110
+ if (deps.strict) {
111
+ if (environment.KOED_RUNTIME_MODE !== void 0 && !runtimeMode(environment.KOED_RUNTIME_MODE)) {
112
+ throw new Error("KOED_RUNTIME_MODE must be local-personal, external, or developer");
113
+ }
114
+ if (environment.KOED_DEPENDENCY_MODE !== void 0 && !dependencyMode(environment.KOED_DEPENDENCY_MODE)) {
115
+ throw new Error("KOED_DEPENDENCY_MODE must be bundled-local or external");
116
+ }
117
+ }
118
+ const resolvedRuntimeMode = runtimeMode(environment.KOED_RUNTIME_MODE) ?? runtimeMode(file.runtimeMode) ?? defaultKoedServerConfig.runtimeMode;
119
+ const resolvedTranscriptWatcherSetting = codexTranscriptWatcherSetting(environment.MEMORY_CODEX_TRANSCRIPT_WATCHER_ENABLED) ?? codexTranscriptWatcherSetting(file.codexTranscriptWatcherEnabled);
120
+ const resolvedClaudeTranscriptWatcherSetting = claudeTranscriptWatcherSetting(environment.MEMORY_CLAUDE_TRANSCRIPT_WATCHER_ENABLED) ?? claudeTranscriptWatcherSetting(file.claudeTranscriptWatcherEnabled);
121
+ const resolvedPiTranscriptWatcherSetting = piTranscriptWatcherSetting(environment.MEMORY_PI_TRANSCRIPT_WATCHER_ENABLED) ?? piTranscriptWatcherSetting(file.piTranscriptWatcherEnabled);
122
+ if (resolvedRuntimeMode === "external" && (resolvedTranscriptWatcherSetting === true || resolvedClaudeTranscriptWatcherSetting === true || resolvedPiTranscriptWatcherSetting === true)) {
123
+ throw new Error("Transcript Watchers cannot run in external runtime mode; run capture through a local-personal koed-server.");
124
+ }
125
+ return {
126
+ runtimeMode: resolvedRuntimeMode,
127
+ dependencyMode: dependencyMode(environment.KOED_DEPENDENCY_MODE) ?? dependencyMode(file.dependencyMode) ?? (resolvedRuntimeMode === "local-personal" ? "bundled-local" : "external"),
128
+ codexTranscriptWatcherEnabled: resolvedTranscriptWatcherSetting ?? resolvedRuntimeMode !== "external",
129
+ claudeTranscriptWatcherEnabled: resolvedClaudeTranscriptWatcherSetting ?? resolvedRuntimeMode !== "external",
130
+ piTranscriptWatcherEnabled: resolvedPiTranscriptWatcherSetting ?? resolvedRuntimeMode !== "external",
131
+ codexGlobalMemoryGuidanceEnabled: booleanSetting(environment.KOED_CODEX_GLOBAL_MEMORY_GUIDANCE_ENABLED) ?? booleanSetting(file.codexGlobalMemoryGuidanceEnabled) ?? defaultKoedServerConfig.codexGlobalMemoryGuidanceEnabled,
132
+ hardwareAcceleration: hardwareAccelerationPreference(environment.KOED_HARDWARE_ACCELERATION, "KOED_HARDWARE_ACCELERATION") ?? hardwareAccelerationPreference(file.hardwareAcceleration, "server.json hardwareAcceleration") ?? defaultKoedServerConfig.hardwareAcceleration,
133
+ external: {
134
+ databaseUrl: trim(environment.KOED_EXTERNAL_DATABASE_URL) ?? trim(environment.DATABASE_URL) ?? trim(file.external?.databaseUrl),
135
+ redisUrl: trim(environment.KOED_EXTERNAL_REDIS_URL) ?? trim(environment.REDIS_URL) ?? trim(file.external?.redisUrl),
136
+ embeddingServiceUrl: trim(environment.KOED_EXTERNAL_EMBEDDING_SERVICE_URL) ?? trim(environment.EMBEDDING_SERVICE_URL) ?? trim(file.external?.embeddingServiceUrl),
137
+ privacyServiceUrl: trim(environment.KOED_EXTERNAL_PRIVACY_SERVICE_URL) ?? trim(environment.PRIVACY_SERVICE_URL) ?? trim(file.external?.privacyServiceUrl)
138
+ }
139
+ };
140
+ };
141
+ var writeServerConfigAtomically = (paths, config, deps = {}) => {
142
+ mkdirSync(dirname(paths.serverConfigPath), { recursive: true, mode: 448 });
143
+ const temporary = `${paths.serverConfigPath}.${process.pid}.${randomUUID()}.tmp`;
144
+ try {
145
+ (deps.writeFileSync ?? writeFileSync)(temporary, `${JSON.stringify(config, null, 2)}
146
+ `, { mode: 384 });
147
+ (deps.renameSync ?? renameSync)(temporary, paths.serverConfigPath);
148
+ } catch (error) {
149
+ (deps.rmSync ?? rmSync)(temporary, { force: true });
150
+ throw error;
151
+ }
152
+ };
153
+ var writeCodexGlobalMemoryGuidancePreference = (paths, enabled, deps = {}) => {
154
+ const fileExists = deps.existsSync ?? existsSync;
155
+ const read = deps.readFileSync ?? readFileSync;
156
+ let existing = {};
157
+ if (fileExists(paths.serverConfigPath)) {
158
+ try {
159
+ const parsed = JSON.parse(read(paths.serverConfigPath, "utf8"));
160
+ if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
161
+ throw new Error("expected a JSON object");
162
+ }
163
+ existing = parsed;
164
+ } catch (error) {
165
+ const message = error instanceof Error ? error.message : String(error);
166
+ throw new Error(`Cannot update Codex memory guidance preference because ${paths.serverConfigPath} is malformed: ${message}.`, { cause: error });
167
+ }
168
+ }
169
+ writeServerConfigAtomically(paths, { ...existing, codexGlobalMemoryGuidanceEnabled: enabled }, deps);
170
+ };
171
+
172
+ export {
173
+ resolveKoedServerConfig,
174
+ writeCodexGlobalMemoryGuidancePreference
175
+ };
@@ -1,10 +1,11 @@
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";
5
- import "./chunk-K2EIFEQF.js";
6
- import "./chunk-UI5RLBKQ.js";
7
- import "./chunk-473OA62O.js";
4
+ } from "./chunk-GY5GATZL.js";
5
+ import "./chunk-TSAYTRX3.js";
6
+ import "./chunk-YZLQZU5E.js";
7
+ import "./chunk-E6YVGIEW.js";
8
+ import "./chunk-FSNLU46W.js";
8
9
  import "./chunk-BTS4ZTF3.js";
9
10
 
10
11
  // packages/koed-server/dist/cli-internal-operations.js
@@ -5,7 +5,7 @@ import {
5
5
  localModelKinds,
6
6
  resolveLocalModelManifest,
7
7
  sha256File
8
- } from "./chunk-ZUGNCQZE.js";
8
+ } from "./chunk-JYK6UL6D.js";
9
9
  import "./chunk-BTS4ZTF3.js";
10
10
  export {
11
11
  collectLocalModelStatus,
@@ -1,21 +1,31 @@
1
1
  import { createRequire as createKoedRequire } from "node:module"; const require = createKoedRequire(import.meta.url);
2
+ import {
3
+ removeProjectTeamWorkspaceLinksForBackend,
4
+ removeProjectTeamWorkspaceLinksForMismatchedBinding
5
+ } from "./chunk-6JRWGOQG.js";
2
6
  import {
3
7
  disconnectUpstreamBackendEnrollment,
4
8
  getUpstreamEnrollmentStatus,
5
9
  readUpstreamEnrollmentBinding,
6
10
  startUpstreamEnrollment
7
- } from "./chunk-SKVYP7NY.js";
11
+ } from "./chunk-T7OGE5E5.js";
8
12
  import {
9
13
  applyPersistedLocalPorts
10
- } from "./chunk-HFM6ROJL.js";
14
+ } from "./chunk-TISYUUEJ.js";
15
+ import "./chunk-LHUMBHG7.js";
11
16
  import {
12
- removeProjectTeamWorkspaceLinksForBackend,
13
- removeProjectTeamWorkspaceLinksForMismatchedBinding
14
- } from "./chunk-6JRWGOQG.js";
17
+ resolveKoedServerPaths
18
+ } from "./chunk-TSAYTRX3.js";
19
+ import "./chunk-YZLQZU5E.js";
20
+ import {
21
+ loadRepoEnv,
22
+ resolveApiUrl
23
+ } from "./chunk-W2HNI6AA.js";
15
24
  import {
16
25
  applyActiveRuntimeUrls,
17
26
  readActiveRuntimeState
18
- } from "./chunk-G4IIVVJO.js";
27
+ } from "./chunk-T6UB5PNX.js";
28
+ import "./chunk-7NXKPDF3.js";
19
29
  import {
20
30
  beginUpstreamDisconnectCleanup,
21
31
  completeUpstreamDisconnectCleanup,
@@ -30,17 +40,7 @@ import {
30
40
  updateUpstreamBackendRoutePolicy,
31
41
  updateUpstreamDisconnectCleanup,
32
42
  upstreamDisconnectCleanupPending
33
- } from "./chunk-YJWREXN6.js";
34
- import "./chunk-XNFVSVBS.js";
35
- import "./chunk-7NXKPDF3.js";
36
- import {
37
- resolveKoedServerPaths
38
- } from "./chunk-K2EIFEQF.js";
39
- import "./chunk-UI5RLBKQ.js";
40
- import {
41
- loadRepoEnv,
42
- resolveApiUrl
43
- } from "./chunk-W2HNI6AA.js";
43
+ } from "./chunk-WBMO7YCO.js";
44
44
  import {
45
45
  COLLABORATION_CONTRACT_VERSION,
46
46
  COLLABORATION_RECONNECT_BACKOFF_CAP_MS,
@@ -66,7 +66,6 @@ import {
66
66
  collaborationSnapshotSchema,
67
67
  collaborationSubscriptionSchema,
68
68
  deleteCollaborationPendingSend,
69
- external_exports,
70
69
  isTeamCollaborationSelection,
71
70
  listCollaborationPendingSends,
72
71
  readBoundedJsonObject,
@@ -74,7 +73,10 @@ import {
74
73
  readLocalEdgeClientCredentialAuthorization,
75
74
  storeCollaborationPendingSend,
76
75
  updateCollaborationPendingSendState
77
- } from "./chunk-473OA62O.js";
76
+ } from "./chunk-E6YVGIEW.js";
77
+ import {
78
+ external_exports
79
+ } from "./chunk-FSNLU46W.js";
78
80
  import "./chunk-BTS4ZTF3.js";
79
81
 
80
82
  // packages/koed-server/dist/desktop-collaboration-broker.js
@@ -6,29 +6,34 @@ import {
6
6
  persistDoctorVerification,
7
7
  printJson,
8
8
  safeLifecycle
9
- } from "./chunk-YCDEMYY6.js";
10
- import "./chunk-HZJK5RWC.js";
9
+ } from "./chunk-54UL4U2E.js";
10
+ import "./chunk-L4RD3TAZ.js";
11
+ import "./chunk-NGV45YWB.js";
12
+ import "./chunk-GY5GATZL.js";
13
+ import "./chunk-JYK6UL6D.js";
14
+ import "./chunk-T7OGE5E5.js";
15
+ import "./chunk-USHFSJT7.js";
11
16
  import "./chunk-QT24SAW6.js";
12
- import "./chunk-SKVYP7NY.js";
13
- import "./chunk-HFM6ROJL.js";
14
- import "./chunk-AFLKCQHF.js";
15
- import "./chunk-NM5NXCVM.js";
16
- import "./chunk-G4IIVVJO.js";
17
- import "./chunk-JKOG52PE.js";
18
- import "./chunk-A4NKL2PK.js";
19
- import "./chunk-QIIKMG3M.js";
20
- import "./chunk-2DA7EFZV.js";
21
- import "./chunk-VPC5NLZG.js";
22
- import "./chunk-YJWREXN6.js";
23
- import "./chunk-J2L726BC.js";
24
- import "./chunk-2S3OGPUC.js";
25
- import "./chunk-XNFVSVBS.js";
26
- import "./chunk-7NXKPDF3.js";
27
- import "./chunk-K2EIFEQF.js";
28
- import "./chunk-UI5RLBKQ.js";
17
+ import "./chunk-TISYUUEJ.js";
18
+ import "./chunk-ALJUSOF7.js";
19
+ import "./chunk-LHUMBHG7.js";
20
+ import "./chunk-7FSHVVTZ.js";
21
+ import "./chunk-TSAYTRX3.js";
22
+ import "./chunk-YZLQZU5E.js";
29
23
  import "./chunk-W2HNI6AA.js";
30
- import "./chunk-473OA62O.js";
31
- import "./chunk-ZUGNCQZE.js";
24
+ import "./chunk-OG7G6DIR.js";
25
+ import "./chunk-UCOHFZ77.js";
26
+ import "./chunk-T6UB5PNX.js";
27
+ import "./chunk-7NXKPDF3.js";
28
+ import "./chunk-XCO3RV3Z.js";
29
+ import "./chunk-7HLNJ2BI.js";
30
+ import "./chunk-VGL5AZN5.js";
31
+ import "./chunk-QV3WPU7A.js";
32
+ import "./chunk-IY2HRXOZ.js";
33
+ import "./chunk-4DHYSJJT.js";
34
+ import "./chunk-WBMO7YCO.js";
35
+ import "./chunk-E6YVGIEW.js";
36
+ import "./chunk-FSNLU46W.js";
32
37
  import "./chunk-BTS4ZTF3.js";
33
38
 
34
39
  // packages/koed-server/dist/cli-lifecycle-operations.js