@excitedjs/agent-runtime-codex 0.2.0-alpha.g2b7e2d09fbdc → 0.2.0-alpha.gc17e7fda283d

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 (67) hide show
  1. package/dist/bin.d.ts +14 -0
  2. package/dist/bin.d.ts.map +1 -0
  3. package/dist/bin.js +18 -0
  4. package/dist/bin.js.map +1 -0
  5. package/dist/codex-home.d.ts +42 -0
  6. package/dist/codex-home.d.ts.map +1 -0
  7. package/dist/codex-home.js +112 -0
  8. package/dist/codex-home.js.map +1 -0
  9. package/dist/config.d.ts +4 -3
  10. package/dist/config.d.ts.map +1 -1
  11. package/dist/config.js +5 -4
  12. package/dist/config.js.map +1 -1
  13. package/dist/diagnostic.d.ts +14 -0
  14. package/dist/diagnostic.d.ts.map +1 -0
  15. package/dist/diagnostic.js +58 -0
  16. package/dist/diagnostic.js.map +1 -0
  17. package/dist/index.d.ts +6 -2
  18. package/dist/index.d.ts.map +1 -1
  19. package/dist/index.js +8 -1
  20. package/dist/index.js.map +1 -1
  21. package/dist/internal/socket.d.ts +18 -9
  22. package/dist/internal/socket.d.ts.map +1 -1
  23. package/dist/internal/socket.js +60 -9
  24. package/dist/internal/socket.js.map +1 -1
  25. package/dist/paths.d.ts +7 -0
  26. package/dist/paths.d.ts.map +1 -0
  27. package/dist/paths.js +26 -0
  28. package/dist/paths.js.map +1 -0
  29. package/dist/provider.d.ts +9 -26
  30. package/dist/provider.d.ts.map +1 -1
  31. package/dist/provider.js +23 -21
  32. package/dist/provider.js.map +1 -1
  33. package/dist/runtime-support.d.ts +10 -9
  34. package/dist/runtime-support.d.ts.map +1 -1
  35. package/dist/runtime-support.js +12 -15
  36. package/dist/runtime-support.js.map +1 -1
  37. package/dist/runtime.d.ts +1 -132
  38. package/dist/runtime.d.ts.map +1 -1
  39. package/dist/runtime.js +13 -147
  40. package/dist/runtime.js.map +1 -1
  41. package/dist/skill-roots.d.ts +14 -0
  42. package/dist/skill-roots.d.ts.map +1 -0
  43. package/dist/skill-roots.js +38 -0
  44. package/dist/skill-roots.js.map +1 -0
  45. package/dist/supervisor.js +1 -1
  46. package/dist/supervisor.js.map +1 -1
  47. package/dist/turn-manager.js +1 -1
  48. package/dist/turn-manager.js.map +1 -1
  49. package/dist/version.d.ts +1 -1
  50. package/dist/version.js +1 -1
  51. package/package.json +3 -2
  52. package/dist/internal/completion-body.d.ts +0 -38
  53. package/dist/internal/completion-body.d.ts.map +0 -1
  54. package/dist/internal/completion-body.js +0 -62
  55. package/dist/internal/completion-body.js.map +0 -1
  56. package/dist/internal/config-validate.d.ts +0 -23
  57. package/dist/internal/config-validate.d.ts.map +0 -1
  58. package/dist/internal/config-validate.js +0 -122
  59. package/dist/internal/config-validate.js.map +0 -1
  60. package/dist/internal/os.d.ts +0 -30
  61. package/dist/internal/os.d.ts.map +0 -1
  62. package/dist/internal/os.js +0 -81
  63. package/dist/internal/os.js.map +0 -1
  64. package/dist/internal/turn-render.d.ts +0 -22
  65. package/dist/internal/turn-render.d.ts.map +0 -1
  66. package/dist/internal/turn-render.js +0 -40
  67. package/dist/internal/turn-render.js.map +0 -1
package/dist/bin.d.ts ADDED
@@ -0,0 +1,14 @@
1
+ import type { DreamuxEnvironment } from '@excitedjs/dreamux-types';
2
+ /**
3
+ * Final codex binary path for one runtime. The `CODEX_HOST_CODEX_BIN`
4
+ * environment variable is a deliberate host-level override that takes precedence
5
+ * over the configured `runtime.config.bin`; otherwise the configured bin
6
+ * (default `"codex"`) is used. `env` defaults to the live process environment
7
+ * for the runtime spawn path; doctor passes the installed service unit's
8
+ * environment so it checks what the service will run.
9
+ *
10
+ * Lives in its own module so both the provider (spawn path) and the diagnostic
11
+ * (doctor path) import it without forming an import cycle.
12
+ */
13
+ export declare function resolveCodexBinPath(configBin: string, env?: DreamuxEnvironment): string;
14
+ //# sourceMappingURL=bin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bin.d.ts","sourceRoot":"","sources":["../src/bin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAEnE;;;;;;;;;;GAUG;AACH,wBAAgB,mBAAmB,CACjC,SAAS,EAAE,MAAM,EACjB,GAAG,GAAE,kBAAgC,GACpC,MAAM,CAIR"}
package/dist/bin.js ADDED
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Final codex binary path for one runtime. The `CODEX_HOST_CODEX_BIN`
3
+ * environment variable is a deliberate host-level override that takes precedence
4
+ * over the configured `runtime.config.bin`; otherwise the configured bin
5
+ * (default `"codex"`) is used. `env` defaults to the live process environment
6
+ * for the runtime spawn path; doctor passes the installed service unit's
7
+ * environment so it checks what the service will run.
8
+ *
9
+ * Lives in its own module so both the provider (spawn path) and the diagnostic
10
+ * (doctor path) import it without forming an import cycle.
11
+ */
12
+ export function resolveCodexBinPath(configBin, env = process.env) {
13
+ const fromEnv = env['CODEX_HOST_CODEX_BIN'];
14
+ if (fromEnv !== undefined && fromEnv.trim() !== '')
15
+ return fromEnv;
16
+ return configBin;
17
+ }
18
+ //# sourceMappingURL=bin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bin.js","sourceRoot":"","sources":["../src/bin.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;GAUG;AACH,MAAM,UAAU,mBAAmB,CACjC,SAAiB,EACjB,MAA0B,OAAO,CAAC,GAAG;IAErC,MAAM,OAAO,GAAG,GAAG,CAAC,sBAAsB,CAAC,CAAC;IAC5C,IAAI,OAAO,KAAK,SAAS,IAAI,OAAO,CAAC,IAAI,EAAE,KAAK,EAAE;QAAE,OAAO,OAAO,CAAC;IACnE,OAAO,SAAS,CAAC;AACnB,CAAC"}
@@ -0,0 +1,42 @@
1
+ import type { DreamuxEnvironment } from '@excitedjs/dreamux-types';
2
+ export declare const DISPATCHER_APP_SERVER_SOCKET_PATH_MAX_BYTES = 103;
3
+ export interface DispatcherCodexHomeDoctorContext {
4
+ dispatcherId: string;
5
+ codexHome: string;
6
+ configPath: string;
7
+ /**
8
+ * The runtime working directory. Optional/empty by default: the validation
9
+ * never reads it, so a caller that does not have it (e.g. doctor) omits it.
10
+ */
11
+ dispatcherCwd: string;
12
+ /**
13
+ * A representative socket allocation (issue #182: sockets are random per
14
+ * start, so this is a sample of the policy, not the path a runtime will
15
+ * bind). Doctor checks placement (never shared /tmp) and the path budget. An
16
+ * empty string skips the socket checks (no host candidate dirs were supplied).
17
+ */
18
+ socketPath: string;
19
+ codexCliArgs: string[];
20
+ }
21
+ export interface DispatcherCodexHomeDoctorResult {
22
+ ok: boolean;
23
+ errors: string[];
24
+ context: DispatcherCodexHomeDoctorContext;
25
+ }
26
+ export type DispatcherCodexHomeDoctor = (context: DispatcherCodexHomeDoctorContext) => void | Promise<void>;
27
+ interface DoctorContextOptions {
28
+ codexCliArgs?: string[];
29
+ dispatcherCwd?: string;
30
+ /** Representative socket sample (from the path context's `runtimeSocketDirs()`). */
31
+ socketPath?: string;
32
+ }
33
+ interface DoctorOptions {
34
+ env?: DreamuxEnvironment;
35
+ codexCliArgs?: string[];
36
+ }
37
+ export declare function dispatcherCodexHomeDoctorContext(dispatcherId: string, options?: DoctorContextOptions): DispatcherCodexHomeDoctorContext;
38
+ export declare function validateDispatcherCodexHome(input: string | DispatcherCodexHomeDoctorContext, options?: DoctorOptions): Promise<DispatcherCodexHomeDoctorResult>;
39
+ export declare function assertDispatcherCodexHomeReady(context: DispatcherCodexHomeDoctorContext): Promise<void>;
40
+ export declare function formatDispatcherCodexHomeErrors(result: DispatcherCodexHomeDoctorResult): string;
41
+ export {};
42
+ //# sourceMappingURL=codex-home.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"codex-home.d.ts","sourceRoot":"","sources":["../src/codex-home.ts"],"names":[],"mappings":"AAsBA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAInE,eAAO,MAAM,2CAA2C,MACpB,CAAC;AAErC,MAAM,WAAW,gCAAgC;IAC/C,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB;;;OAGG;IACH,aAAa,EAAE,MAAM,CAAC;IACtB;;;;;OAKG;IACH,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,EAAE,CAAC;CACxB;AAED,MAAM,WAAW,+BAA+B;IAC9C,EAAE,EAAE,OAAO,CAAC;IACZ,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,OAAO,EAAE,gCAAgC,CAAC;CAC3C;AAED,MAAM,MAAM,yBAAyB,GAAG,CACtC,OAAO,EAAE,gCAAgC,KACtC,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;AAE1B,UAAU,oBAAoB;IAC5B,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IACxB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,oFAAoF;IACpF,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,UAAU,aAAa;IACrB,GAAG,CAAC,EAAE,kBAAkB,CAAC;IACzB,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;CACzB;AAED,wBAAgB,gCAAgC,CAC9C,YAAY,EAAE,MAAM,EACpB,OAAO,GAAE,oBAAyB,GACjC,gCAAgC,CASlC;AAED,wBAAsB,2BAA2B,CAC/C,KAAK,EAAE,MAAM,GAAG,gCAAgC,EAChD,OAAO,GAAE,aAAkB,GAC1B,OAAO,CAAC,+BAA+B,CAAC,CAyD1C;AAED,wBAAsB,8BAA8B,CAClD,OAAO,EAAE,gCAAgC,GACxC,OAAO,CAAC,IAAI,CAAC,CAIf;AAED,wBAAgB,+BAA+B,CAC7C,MAAM,EAAE,+BAA+B,GACtC,MAAM,CAGR"}
@@ -0,0 +1,112 @@
1
+ /**
2
+ * Codex home/auth pre-start validation (issue #209 cleanup — relocated from
3
+ * Dreamux core into the owning package).
4
+ *
5
+ * This is the codex-engine readiness check: it validates that Codex's own global
6
+ * home (`~/.codex`) exists, parses its `config.toml`, carries usable auth, and
7
+ * that the representative app-server socket placement is sane. It is
8
+ * codex-specific and carries NO `~/.dreamux` knowledge — the host's socket
9
+ * placement arrives as a neutral sample (`socketPath`) computed from the path
10
+ * context's `runtimeSocketDirs()`, and `dispatcherCwd` is optional (the
11
+ * validation never reads it).
12
+ */
13
+ import { readFile } from 'node:fs/promises';
14
+ import { join, normalize, sep } from 'node:path';
15
+ import { parse as parseToml, TomlError } from 'smol-toml';
16
+ import { DREAMUX_UNIX_SOCKET_PATH_MAX_BYTES, pathExists, unixSocketPathFitsBudget, } from '@excitedjs/dreamux-utils';
17
+ import { dispatcherCodexConfigPath, dispatcherCodexHome } from './paths.js';
18
+ export const DISPATCHER_APP_SERVER_SOCKET_PATH_MAX_BYTES = DREAMUX_UNIX_SOCKET_PATH_MAX_BYTES;
19
+ export function dispatcherCodexHomeDoctorContext(dispatcherId, options = {}) {
20
+ return {
21
+ dispatcherId,
22
+ codexHome: dispatcherCodexHome(dispatcherId),
23
+ configPath: dispatcherCodexConfigPath(dispatcherId),
24
+ dispatcherCwd: options.dispatcherCwd ?? '',
25
+ socketPath: options.socketPath ?? '',
26
+ codexCliArgs: options.codexCliArgs ?? [],
27
+ };
28
+ }
29
+ export async function validateDispatcherCodexHome(input, options = {}) {
30
+ const context = typeof input === 'string'
31
+ ? dispatcherCodexHomeDoctorContext(input, {
32
+ codexCliArgs: options.codexCliArgs,
33
+ })
34
+ : {
35
+ ...input,
36
+ codexCliArgs: options.codexCliArgs ?? input.codexCliArgs,
37
+ };
38
+ const errors = [];
39
+ const env = options.env ?? process.env;
40
+ if (await pathExists(context.configPath)) {
41
+ try {
42
+ const parsed = parseToml(await readFile(context.configPath, 'utf8'));
43
+ if (!isRecord(parsed)) {
44
+ errors.push(`Codex config must be a TOML table: ${context.configPath}`);
45
+ }
46
+ }
47
+ catch (err) {
48
+ errors.push(formatTomlError(err, context.configPath));
49
+ }
50
+ }
51
+ if (!(await pathExists(context.codexHome))) {
52
+ errors.push(`missing Codex home directory: ${context.codexHome}`);
53
+ }
54
+ // An empty socketPath means no host candidate dirs were supplied — skip the
55
+ // placement/budget checks (a real allocation still fails loud at start time).
56
+ if (context.socketPath !== '') {
57
+ if (isTmpPath(context.socketPath)) {
58
+ errors.push(`dispatcher app-server socket must not be under /tmp: ${context.socketPath}`);
59
+ }
60
+ if (!unixSocketPathFitsBudget(context.socketPath)) {
61
+ const bytes = Buffer.byteLength(context.socketPath, 'utf8');
62
+ errors.push(`dispatcher app-server socket path is too long for Unix sockets (${bytes} bytes > ${DISPATCHER_APP_SERVER_SOCKET_PATH_MAX_BYTES} safe bytes): ${context.socketPath}`);
63
+ }
64
+ }
65
+ // The bundled dispatcher skill is no longer symlinked into the workspace
66
+ // (issue #209 slice 6); core injects it at runtime by role via
67
+ // `skills/extraRoots/set`, so the doctor no longer checks for an on-disk skill.
68
+ if (!(await hasAuth(context.codexHome, env))) {
69
+ errors.push(`missing Codex auth state in ${context.codexHome} or a supported auth environment variable`);
70
+ }
71
+ return {
72
+ ok: errors.length === 0,
73
+ errors,
74
+ context,
75
+ };
76
+ }
77
+ export async function assertDispatcherCodexHomeReady(context) {
78
+ const result = await validateDispatcherCodexHome(context);
79
+ if (result.ok)
80
+ return;
81
+ throw new Error(formatDispatcherCodexHomeErrors(result));
82
+ }
83
+ export function formatDispatcherCodexHomeErrors(result) {
84
+ const header = `dispatcher '${result.context.dispatcherId}' Codex home is not ready`;
85
+ return [header, ...result.errors.map((e) => `- ${e}`)].join('\n');
86
+ }
87
+ function formatTomlError(err, file) {
88
+ if (err instanceof TomlError) {
89
+ const where = typeof err.line === 'number' && typeof err.column === 'number'
90
+ ? `${file}:${err.line}:${err.column}`
91
+ : file;
92
+ return `Codex config parse error at ${where}: ${err.message}`;
93
+ }
94
+ const msg = err instanceof Error ? err.message : String(err);
95
+ return `Codex config parse error in ${file}: ${msg}`;
96
+ }
97
+ async function hasAuth(codexHome, env) {
98
+ if (await pathExists(join(codexHome, 'auth.json')))
99
+ return true;
100
+ return ['OPENAI_API_KEY', 'CODEX_API_KEY', 'CODEX_ACCESS_TOKEN'].some((name) => {
101
+ const value = env[name];
102
+ return value !== undefined && value.trim() !== '';
103
+ });
104
+ }
105
+ function isTmpPath(path) {
106
+ const normalized = normalize(path);
107
+ return normalized === '/tmp' || normalized.startsWith(`/tmp${sep}`);
108
+ }
109
+ function isRecord(value) {
110
+ return value !== null && typeof value === 'object' && !Array.isArray(value);
111
+ }
112
+ //# sourceMappingURL=codex-home.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"codex-home.js","sourceRoot":"","sources":["../src/codex-home.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AAEjD,OAAO,EAAE,KAAK,IAAI,SAAS,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAE1D,OAAO,EACL,kCAAkC,EAClC,UAAU,EACV,wBAAwB,GACzB,MAAM,0BAA0B,CAAC;AAGlC,OAAO,EAAE,yBAAyB,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAE5E,MAAM,CAAC,MAAM,2CAA2C,GACtD,kCAAkC,CAAC;AA2CrC,MAAM,UAAU,gCAAgC,CAC9C,YAAoB,EACpB,UAAgC,EAAE;IAElC,OAAO;QACL,YAAY;QACZ,SAAS,EAAE,mBAAmB,CAAC,YAAY,CAAC;QAC5C,UAAU,EAAE,yBAAyB,CAAC,YAAY,CAAC;QACnD,aAAa,EAAE,OAAO,CAAC,aAAa,IAAI,EAAE;QAC1C,UAAU,EAAE,OAAO,CAAC,UAAU,IAAI,EAAE;QACpC,YAAY,EAAE,OAAO,CAAC,YAAY,IAAI,EAAE;KACzC,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,2BA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AAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAC9E,CAAC"}
package/dist/config.d.ts CHANGED
@@ -3,9 +3,10 @@
3
3
  * the typed accessor.
4
4
  *
5
5
  * Codex runtime config is owned by this package (the `builtin:codex` provider),
6
- * not by the Dreamux host config module. It depends only on vendored neutral
7
- * validation primitives and the package-local provider ref, never on
8
- * `@excitedjs/dreamux` core. The Dreamux host config module re-exports these so
6
+ * not by the Dreamux host config module. It depends only on the shared neutral
7
+ * validation primitives (`@excitedjs/dreamux-utils`) and the package-local
8
+ * provider ref, never on `@excitedjs/dreamux` core. The Dreamux host config
9
+ * module re-exports these so
9
10
  * the non-builtin callers (doctor, daemon, tests) keep their import paths.
10
11
  */
11
12
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAWH;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,WAAW,qBAAqB;IACpC,GAAG,EAAE,MAAM,CAAC;IACZ,eAAe,EAAE,MAAM,CAAC;IACxB,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAClC,qBAAqB,EAAE,MAAM,CAAC;IAC9B,eAAe,EAAE,MAAM,CAAC;CACzB;AAED;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,UAAU,CAAC;AAEzC,4FAA4F;AAC5F,eAAO,MAAM,6BAA6B,QAAS,CAAC;AAEpD;;;;;;GAMG;AACH,eAAO,MAAM,6BAA6B,SAAU,CAAC;AAErD,2EAA2E;AAC3E,eAAO,MAAM,uBAAuB,UAAU,CAAC;AAE/C,wEAAwE;AACxE,eAAO,MAAM,oBAAoB,oBAAoB,CAAC;AAEtD,eAAO,MAAM,yBAAyB,aAKpC,CAAC;AAEH,eAAO,MAAM,qBAAqB,aAIhC,C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AAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACjC,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,MAAM,GACb,qBAAqB,CA0EvB;AAED;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,UAAU,EAAE;IAChD,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,OAAO,CAAA;KAAE,CAAC;CAChD,GAAG,qBAAqB,CAOxB"}
package/dist/config.js CHANGED
@@ -3,13 +3,14 @@
3
3
  * the typed accessor.
4
4
  *
5
5
  * Codex runtime config is owned by this package (the `builtin:codex` provider),
6
- * not by the Dreamux host config module. It depends only on vendored neutral
7
- * validation primitives and the package-local provider ref, never on
8
- * `@excitedjs/dreamux` core. The Dreamux host config module re-exports these so
6
+ * not by the Dreamux host config module. It depends only on the shared neutral
7
+ * validation primitives (`@excitedjs/dreamux-utils`) and the package-local
8
+ * provider ref, never on `@excitedjs/dreamux` core. The Dreamux host config
9
+ * module re-exports these so
9
10
  * the non-builtin callers (doctor, daemon, tests) keep their import paths.
10
11
  */
11
12
  import { BUILTIN_CODEX_PROVIDER_REF } from './provider-ref.js';
12
- import { readOptionalString, rejectUnknownKeys, requirePositiveInt, requireStringArray, requireStringRecord, } from './internal/config-validate.js';
13
+ import { readOptionalString, rejectUnknownKeys, requirePositiveInt, requireStringArray, requireStringRecord, } from '@excitedjs/dreamux-utils';
13
14
  /**
14
15
  * Default `dispatchers[].runtime.config.bin`. The Codex binary path is
15
16
  * dispatcher-local; `CODEX_HOST_CODEX_BIN` is a host-level override above it,
@@ -1 +1 @@
1
- {"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,0BAA0B,EAAE,MAAM,mBAAmB,CAAC;AAC/D,OAAO,EACL,kBAAkB,EAClB,iBAAiB,EACjB,kBAAkB,EAClB,kBAAk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E,sBAAsB,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,OAAO,CAAC,QAAQ,CAAC,wBAAwB,CACtH,CAAC;IACJ,CAAC;IACD,OAAO,UAAU,CAAC,OAAO,CAAC,MAA+B,CAAC;AAC5D,CAAC"}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * The `builtin:codex` self-reported diagnostic surface (issue #146 fold; relocated
3
+ * into the owning package by the issue #209 cleanup).
4
+ *
5
+ * Declares the codex bin check (deduped + executed by Dreamux core) and runs
6
+ * the codex-home validation plus the codex version gate (#147) itself,
7
+ * entirely against the neutral `@excitedjs/dreamux-types` diagnostic context. The
8
+ * representative app-server socket sample is derived from the neutral path
9
+ * context's `runtimeSocketDirs()`, so the package never names `~/.dreamux`.
10
+ */
11
+ import type { AgentRuntimeDiagnostic } from '@excitedjs/dreamux-types';
12
+ import { type DispatcherCodexConfig } from './config.js';
13
+ export declare const codexAgentRuntimeDiagnostic: AgentRuntimeDiagnostic<DispatcherCodexConfig>;
14
+ //# sourceMappingURL=diagnostic.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"diagnostic.d.ts","sourceRoot":"","sources":["../src/diagnostic.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,KAAK,EAEV,sBAAsB,EAIvB,MAAM,0BAA0B,CAAC;AAGlC,OAAO,EAAE,KAAK,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAkCzD,eAAO,MAAM,2BAA2B,EAAE,sBAAsB,CAAC,qBAAqB,CAiCnF,CAAC"}
@@ -0,0 +1,58 @@
1
+ import { codexArgsFromConfig, codexArgsToCli } from './args.js';
2
+ import { dispatcherCodexHomeDoctorContext, validateDispatcherCodexHome, } from './codex-home.js';
3
+ import { representativeCodexSocketPath } from './internal/socket.js';
4
+ import { resolveCodexBinPath } from './bin.js';
5
+ import { MIN_CODEX_VERSION, codexVersionSatisfies } from './version.js';
6
+ function codexBinCheckName(scope) {
7
+ return scope === 'managedService' ? 'managed service Codex binary' : 'codex binary';
8
+ }
9
+ async function checkCodexVersion(context, runner) {
10
+ const bin = resolveCodexBinPath(context.config.bin, context.env);
11
+ let raw;
12
+ try {
13
+ raw = await runner.capture(bin, ['--version'], { env: context.env });
14
+ }
15
+ catch (err) {
16
+ const cause = err instanceof Error ? err.message : String(err);
17
+ return `could not determine Codex version from ${bin}: ${cause}; requires codex >= ${MIN_CODEX_VERSION}`;
18
+ }
19
+ if (codexVersionSatisfies(raw))
20
+ return null;
21
+ return (`Codex at ${bin} reported ${raw.trim() || '<empty>'}; requires codex >= ` +
22
+ `${MIN_CODEX_VERSION} for teammate completion delivery (thread/inject_items)`);
23
+ }
24
+ export const codexAgentRuntimeDiagnostic = {
25
+ binChecks(context) {
26
+ return [
27
+ {
28
+ name: codexBinCheckName(context.scope),
29
+ bin: resolveCodexBinPath(context.config.bin, context.env),
30
+ args: ['--help'],
31
+ },
32
+ ];
33
+ },
34
+ async runDiagnostic(context, runner) {
35
+ const cliArgs = codexArgsToCli(codexArgsFromConfig(context.config));
36
+ const socketDirs = context.paths?.runtimeSocketDirs() ?? [];
37
+ const homeContext = dispatcherCodexHomeDoctorContext(context.runtime_id, {
38
+ codexCliArgs: cliArgs,
39
+ socketPath: representativeCodexSocketPath(socketDirs, context.runtime_id),
40
+ });
41
+ const home = await validateDispatcherCodexHome(homeContext, {
42
+ env: context.env,
43
+ codexCliArgs: cliArgs,
44
+ });
45
+ const errors = [...home.errors];
46
+ const versionError = await checkCodexVersion(context, runner);
47
+ if (versionError !== null)
48
+ errors.push(versionError);
49
+ // Detail mirrors the old printCodexHomeDoctor line (the codex home path);
50
+ // per-problem lines live in `errors`.
51
+ return {
52
+ ok: errors.length === 0,
53
+ detail: homeContext.codexHome,
54
+ errors,
55
+ };
56
+ },
57
+ };
58
+ //# sourceMappingURL=diagnostic.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"diagnostic.js","sourceRoot":"","sources":["../src/diagnostic.ts"],"names":[],"mappings":"AAkBA,OA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
4
4
  * `@excitedjs/dreamux-types` `AgentRuntimeProvider` contract; never imports
5
5
  * `@excitedjs/dreamux` core.
6
6
  */
7
- export { default, createCodexAgentRuntimeProvider, resolveCodexBinPath, codexRuntimeArgsForMcpServers, dispatcherCodexConfig, CODEX_AGENT_RUNTIME_CAPABILITIES, type CodexAgentRuntimeProviderOptions, type CodexProviderFactoryContext, } from './provider.js';
7
+ export { default, createCodexAgentRuntimeProvider, codexRuntimeArgsForMcpServers, dispatcherCodexConfig, CODEX_AGENT_RUNTIME_CAPABILITIES, type CodexAgentRuntimeProviderOptions, type CodexProviderFactoryContext, } from './provider.js';
8
+ export { resolveCodexBinPath } from './bin.js';
8
9
  export { CodexRuntime, type CodexRuntimeDeps, } from './runtime.js';
9
- export { CodexProcess, type CodexProcessOptions, type CodexProcessExit, } from './supervisor.js';
10
+ export { CodexProcess, type CodexProcessOptions, type CodexProcessExit, type CodexProcessExitHandler, } from './supervisor.js';
10
11
  export { CodexWsClient, type CodexWsClientOptions, type NotificationHandler, } from './rpc.js';
11
12
  export type { ServerNotification, ServerRequest, ThreadStartResponse, TurnStartResponse, } from './types.js';
12
13
  export { performInitializeHandshake } from './handshake.js';
@@ -15,4 +16,7 @@ export { parseCodexArgs, codexArgsFromConfig, codexArgsToCli, type ParsedCodexAr
15
16
  export { type DispatcherCodexConfig, readDispatcherCodexConfig, defaultDispatcherCodexConfig, DEFAULT_CODEX_BIN, DEFAULT_INITIALIZE_TIMEOUT_MS, DEFAULT_CODEX_TURN_TIMEOUT_MS, DEFAULT_APPROVAL_POLICY, DEFAULT_SANDBOX_MODE, ALLOWED_APPROVAL_POLICIES, ALLOWED_SANDBOX_MODES, } from './config.js';
16
17
  export { MIN_CODEX_VERSION, parseCodexVersion, codexVersionSatisfies, } from './version.js';
17
18
  export { BUILTIN_CODEX_PROVIDER_REF } from './provider-ref.js';
19
+ export { codexAgentRuntimeDiagnostic } from './diagnostic.js';
20
+ export { DISPATCHER_APP_SERVER_SOCKET_PATH_MAX_BYTES, dispatcherCodexHomeDoctorContext, validateDispatcherCodexHome, assertDispatcherCodexHomeReady, formatDispatcherCodexHomeErrors, type DispatcherCodexHomeDoctor, type DispatcherCodexHomeDoctorContext, type DispatcherCodexHomeDoctorResult, } from './codex-home.js';
21
+ export { operatorCodexHome, dispatcherCodexHome, dispatcherCodexConfigPath, } from './paths.js';
18
22
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EACL,OAAO,EACP,+BAA+B,EAC/B,mBAAmB,EACnB,6BAA6B,EAC7B,qBAAqB,EACrB,gCAAgC,EAChC,KAAK,gCAAgC,EACrC,KAAK,2BAA2B,GACjC,MAAM,eAAe,CAAC;AAEvB,OAAO,EACL,YAAY,EACZ,KAAK,gBAAgB,GACtB,MAAM,cAAc,CAAC;AAEtB,OAAO,EACL,YAAY,EACZ,KAAK,mBAAmB,EACxB,KAAK,gBAAgB,GACtB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EACL,aAAa,EACb,KAAK,oBAAoB,EACzB,KAAK,mBAAmB,GACzB,MAAM,UAAU,CAAC;AAElB,YAAY,EACV,kBAAkB,EAClB,aAAa,EACb,mBAAmB,EACnB,iBAAiB,GAClB,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,0BAA0B,EAAE,MAAM,gBAAgB,CAAC;AAE5D,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAErD,OAAO,EACL,cAAc,EACd,mBAAmB,EACnB,cAAc,EACd,KAAK,eAAe,GACrB,MAAM,WAAW,CAAC;AAEnB,OAAO,EACL,KAAK,qBAAqB,EAC1B,yBAAyB,EACzB,4BAA4B,EAC5B,iBAAiB,EACjB,6BAA6B,EAC7B,6BAA6B,EAC7B,uBAAuB,EACvB,oBAAoB,EACpB,yBAAyB,EACzB,qBAAqB,GACtB,MAAM,aAAa,CA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cAAc,CAAC;AAEtB,OAAO,EAAE,0BAA0B,EAAE,MAAM,mBAAmB,CAAC;AAK/D,OAAO,EAAE,2BAA2B,EAAE,MAAM,iBAAiB,CAAC;AAE9D,OAAO,EACL,2CAA2C,EAC3C,gCAAgC,EAChC,2BAA2B,EAC3B,8BAA8B,EAC9B,+BAA+B,EAC/B,KAAK,yBAAyB,EAC9B,KAAK,gCAAgC,EACrC,KAAK,+BAA+B,GACrC,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EACL,iBAAiB,EACjB,mBAAmB,EACnB,yBAAyB,GAC1B,MAAM,YAAY,CAAC"}
package/dist/index.js CHANGED
@@ -4,7 +4,8 @@
4
4
  * `@excitedjs/dreamux-types` `AgentRuntimeProvider` contract; never imports
5
5
  * `@excitedjs/dreamux` core.
6
6
  */
7
- export { default, createCodexAgentRuntimeProvider, resolveCodexBinPath, codexRuntimeArgsForMcpServers, dispatcherCodexConfig, CODEX_AGENT_RUNTIME_CAPABILITIES, } from './provider.js';
7
+ export { default, createCodexAgentRuntimeProvider, codexRuntimeArgsForMcpServers, dispatcherCodexConfig, CODEX_AGENT_RUNTIME_CAPABILITIES, } from './provider.js';
8
+ export { resolveCodexBinPath } from './bin.js';
8
9
  export { CodexRuntime, } from './runtime.js';
9
10
  export { CodexProcess, } from './supervisor.js';
10
11
  export { CodexWsClient, } from './rpc.js';
@@ -14,4 +15,10 @@ export { parseCodexArgs, codexArgsFromConfig, codexArgsToCli, } from './args.js'
14
15
  export { readDispatcherCodexConfig, defaultDispatcherCodexConfig, DEFAULT_CODEX_BIN, DEFAULT_INITIALIZE_TIMEOUT_MS, DEFAULT_CODEX_TURN_TIMEOUT_MS, DEFAULT_APPROVAL_POLICY, DEFAULT_SANDBOX_MODE, ALLOWED_APPROVAL_POLICIES, ALLOWED_SANDBOX_MODES, } from './config.js';
15
16
  export { MIN_CODEX_VERSION, parseCodexVersion, codexVersionSatisfies, } from './version.js';
16
17
  export { BUILTIN_CODEX_PROVIDER_REF } from './provider-ref.js';
18
+ // The Codex diagnostic surface now lives in this package (issue #209 cleanup):
19
+ // the provider diagnostic, the Codex home/auth validation, and the Codex
20
+ // home/config path resolvers. Core's doctor + onboard consume these directly.
21
+ export { codexAgentRuntimeDiagnostic } from './diagnostic.js';
22
+ export { DISPATCHER_APP_SERVER_SOCKET_PATH_MAX_BYTES, dispatcherCodexHomeDoctorContext, validateDispatcherCodexHome, assertDispatcherCodexHomeReady, formatDispatcherCodexHomeErrors, } from './codex-home.js';
23
+ export { operatorCodexHome, dispatcherCodexHome, dispatcherCodexConfigPath, } from './paths.js';
17
24
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EACL,OAAO,EACP,+BAA+B,EAC/B,mBAAmB,EACnB,6BAA6B,EAC7B,qBAAqB,EACrB,gCAAgC,GAGjC,MAAM,eAAe,CAAC;AAEvB,OAAO,EACL,YAAY,GAEb,MAAM,cAAc,CAAC;AAEtB,OAAO,EACL,YAAY,GAGb,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EACL,aAAa,GAGd,MAAM,UAAU,CAAC;AASlB,OAAO,EAAE,0BAA0B,EAAE,MAAM,gBAAgB,CAAC;AAE5D,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAErD,OAAO,EACL,cAAc,EACd,mBAAmB,EACnB,cAAc,GAEf,MAAM,WAAW,CAAC;AAEnB,OAAO,EAEL,yBAAyB,EACzB,4BAA4B,EAC5B,iBAAiB,EACjB,6BAA6B,EAC7B,6BAA6B,EAC7B,uBAAuB,EACvB,oBAAoB,EACpB,yBAAyB,EACzB,qBAAqB,GACtB,MAAM,aAAa,CAAC;AAErB,OAAO,EACL,iBAAiB,EACjB,iBAAiB,EACjB,qBAAqB,GACtB,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,0BAA0B,EAAE,MAAM,mBAAmB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EACL,OAAO,EACP,+BAA+B,EAC/B,6BAA6B,EAC7B,qBAAqB,EACrB,gCAAgC,GAGjC,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAE/C,OAAO,EACL,YAAY,GAEb,MAAM,cAAc,CAAC;AAEtB,OAAO,EACL,YAAY,GAIb,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EACL,aAAa,GAGd,MAAM,UAAU,CAAC;AASlB,OAAO,EAAE,0BAA0B,EAAE,MAAM,gBAAgB,CAAC;AAE5D,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAErD,OAAO,EACL,cAAc,EACd,mBAAmB,EACnB,cAAc,GAEf,MAAM,WAAW,CAAC;AAEnB,OAAO,EAEL,yBAAyB,EACzB,4BAA4B,EAC5B,iBAAiB,EACjB,6BAA6B,EAC7B,6BAA6B,EAC7B,uBAAuB,EACvB,oBAAoB,EACpB,yBAAyB,EACzB,qBAAqB,GACtB,MAAM,aAAa,CAAC;AAErB,OAAO,EACL,iBAAiB,EACjB,iBAAiB,EACjB,qBAAqB,GACtB,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,0BAA0B,EAAE,MAAM,mBAAmB,CAAC;AAE/D,+EAA+E;AAC/E,yEAAyE;AACzE,8EAA8E;AAC9E,OAAO,EAAE,2BAA2B,EAAE,MAAM,iBAAiB,CAAC;AAE9D,OAAO,EACL,2CAA2C,EAC3C,gCAAgC,EAChC,2BAA2B,EAC3B,8BAA8B,EAC9B,+BAA+B,GAIhC,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EACL,iBAAiB,EACjB,mBAAmB,EACnB,yBAAyB,GAC1B,MAAM,YAAY,CAAC"}
@@ -1,14 +1,23 @@
1
1
  /**
2
- * Standalone default for the volatile rendezvous-socket path, used when no host
3
- * socket allocator is injected (e.g. the bare generic-loader path or external
4
- * standalone use).
5
- *
6
- * This is the PACKAGE's own fallback root — `$XDG_RUNTIME_DIR` when set, else the
7
- * OS temp dir — and is deliberately NOT the Dreamux host socket contract. The
8
- * Dreamux host injects its own allocator (its shared runtime-socket root) through
9
- * the provider adapter, so this fallback never duplicates or drifts that
10
- * contract; it only keeps a loader-constructed runtime runnable on its own. The
2
+ * Standalone default for the volatile socket path, used when no host candidate
3
+ * directories are supplied (the bare generic-loader path or external standalone
4
+ * use). This is the PACKAGE's own fallback root — `$XDG_RUNTIME_DIR` when set,
5
+ * else the OS temp dir — deliberately NOT the Dreamux host socket contract. The
11
6
  * path is random per call and never persisted.
12
7
  */
13
8
  export declare function defaultVolatileSocketPath(id: string): string;
9
+ /**
10
+ * Allocate a fresh Codex app-server socket path inside the first host candidate
11
+ * directory whose full path fits the socket budget. Fails loud (naming `id`)
12
+ * when even the last candidate is over budget. With no candidate directories it
13
+ * uses {@link defaultVolatileSocketPath}.
14
+ */
15
+ export declare function allocateCodexSocketPath(socketDirs: readonly string[], id: string): string;
16
+ /**
17
+ * A representative, NON-throwing socket sample for the doctor: the first
18
+ * candidate whose path fits, else the last candidate (which is then over budget,
19
+ * so the home doctor can REPORT it as an error rather than throwing here). With
20
+ * no candidate directories it uses {@link defaultVolatileSocketPath}.
21
+ */
22
+ export declare function representativeCodexSocketPath(socketDirs: readonly string[], id: string): string;
14
23
  //# sourceMappingURL=socket.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"socket.d.ts","sourceRoot":"","sources":["../../src/internal/socket.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;GAWG;AACH,wBAAgB,yBAAyB,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,CAG5D"}
1
+ {"version":3,"file":"socket.d.ts","sourceRoot":"","sources":["../../src/internal/socket.ts"],"names":[],"mappings":"AA+BA;;;;;;GAMG;AACH,wBAAgB,yBAAyB,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,CAG5D;AAED;;;;;GAKG;AACH,wBAAgB,uBAAuB,CACrC,UAAU,EAAE,SAAS,MAAM,EAAE,EAC7B,EAAE,EAAE,MAAM,GACT,MAAM,CAYR;AAED;;;;;GAKG;AACH,wBAAgB,6BAA6B,CAC3C,UAAU,EAAE,SAAS,MAAM,EAAE,EAC7B,EAAE,EAAE,MAAM,GACT,MAAM,CAQR"}
@@ -1,22 +1,73 @@
1
- import { randomUUID } from 'node:crypto';
1
+ import { randomBytes, randomUUID } from 'node:crypto';
2
2
  import { tmpdir } from 'node:os';
3
3
  import { join } from 'node:path';
4
+ import { assertUnixSocketPathBudget, unixSocketPathFitsBudget, } from '@excitedjs/dreamux-utils';
4
5
  /**
5
- * Standalone default for the volatile rendezvous-socket path, used when no host
6
- * socket allocator is injected (e.g. the bare generic-loader path or external
7
- * standalone use).
6
+ * Volatile rendezvous-socket allocation for the Codex app-server (issue #182,
7
+ * relocated into this package by the issue #209 cleanup).
8
8
  *
9
- * This is the PACKAGE's own fallback root `$XDG_RUNTIME_DIR` when set, else the
10
- * OS temp dir and is deliberately NOT the Dreamux host socket contract. The
11
- * Dreamux host injects its own allocator (its shared runtime-socket root) through
12
- * the provider adapter, so this fallback never duplicates or drifts that
13
- * contract; it only keeps a loader-constructed runtime runnable on its own. The
9
+ * A Codex socket is a pure per-start rendezvous endpoint: dreamux starts
10
+ * `codex app-server --listen unix://<path>` and connects with `ws+unix://<path>`
11
+ * immediately. Nothing resumes from a socket path, so every allocation is a
12
+ * fresh short random name and the path is never persisted.
13
+ *
14
+ * Dreamux core no longer hands this package a socket-allocator FUNCTION. Instead
15
+ * the neutral create/diagnostic context exposes the host's preference-ordered
16
+ * candidate directories (`AgentRuntimePathContext.runtimeSocketDirs()`), and this
17
+ * package owns the allocation policy: pick the first candidate whose full path
18
+ * fits the Unix `sun_path` budget (via `@excitedjs/dreamux-utils`), else fail
19
+ * loud. When the host supplies no candidate directories (the bare generic-loader
20
+ * / standalone path) the package falls back to its own short root.
21
+ */
22
+ function socketName() {
23
+ return `${randomBytes(6).toString('base64url')}.sock`;
24
+ }
25
+ /**
26
+ * Standalone default for the volatile socket path, used when no host candidate
27
+ * directories are supplied (the bare generic-loader path or external standalone
28
+ * use). This is the PACKAGE's own fallback root — `$XDG_RUNTIME_DIR` when set,
29
+ * else the OS temp dir — deliberately NOT the Dreamux host socket contract. The
14
30
  * path is random per call and never persisted.
15
31
  */
16
32
  export function defaultVolatileSocketPath(id) {
17
33
  const root = globalThis.process.env['XDG_RUNTIME_DIR'] ?? tmpdir();
18
34
  return join(root, `arc-${sanitize(id)}-${randomUUID().slice(0, 8)}.sock`);
19
35
  }
36
+ /**
37
+ * Allocate a fresh Codex app-server socket path inside the first host candidate
38
+ * directory whose full path fits the socket budget. Fails loud (naming `id`)
39
+ * when even the last candidate is over budget. With no candidate directories it
40
+ * uses {@link defaultVolatileSocketPath}.
41
+ */
42
+ export function allocateCodexSocketPath(socketDirs, id) {
43
+ if (socketDirs.length === 0)
44
+ return defaultVolatileSocketPath(id);
45
+ const name = socketName();
46
+ for (const dir of socketDirs) {
47
+ const path = join(dir, name);
48
+ if (unixSocketPathFitsBudget(path))
49
+ return path;
50
+ }
51
+ const fallback = socketDirs[socketDirs.length - 1];
52
+ return assertUnixSocketPathBudget(join(fallback, name), `dispatcher '${id}' Codex socket path`);
53
+ }
54
+ /**
55
+ * A representative, NON-throwing socket sample for the doctor: the first
56
+ * candidate whose path fits, else the last candidate (which is then over budget,
57
+ * so the home doctor can REPORT it as an error rather than throwing here). With
58
+ * no candidate directories it uses {@link defaultVolatileSocketPath}.
59
+ */
60
+ export function representativeCodexSocketPath(socketDirs, id) {
61
+ if (socketDirs.length === 0)
62
+ return defaultVolatileSocketPath(id);
63
+ const name = socketName();
64
+ for (const dir of socketDirs) {
65
+ const path = join(dir, name);
66
+ if (unixSocketPathFitsBudget(path))
67
+ return path;
68
+ }
69
+ return join(socketDirs[socketDirs.length - 1], name);
70
+ }
20
71
  function sanitize(id) {
21
72
  return id.replace(/[^A-Za-z0-9._-]/g, '_');
22
73
  }
@@ -1 +1 @@
1
- {"version":3,"file":"socket.js","sourceRoot":"","sources":["../../src/internal/socket.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,yBAAyB,CAAC,EAAU;IAClD,MAAM,IAAI,GAAG,UAAU,CAAC,OAAO,CAAC,GAAG,CAAC,iBAAiB,CAAC,IAAI,MAAM,EAAE,CAAC;IACnE,OAAO,IAAI,CAAC,IAAI,EAAE,OAAO,QAAQ,CAAC,EAAE,CAAC,IAAI,UAAU,EAAE,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC;AAC5E,CAAC;AAED,SAAS,QAAQ,CAAC,EAAU;IAC1B,OAAO,EAAE,CAAC,OAAO,CAAC,kBAAkB,EAAE,GAAG,CAAC,CAAC;AAC7C,CAAC"}
1
+ {"version":3,"file":"socket.js","sourceRoot":"","sources":["../../src/internal/socket.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACtD,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EACL,0BAA0B,EAC1B,wBAAwB,GACzB,MAAM,0BAA0B,CAAC;AAElC;;;;;;;;;;;;;;;;GAgBG;AAEH,SAAS,UAAU;IACjB,OAAO,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,WAAW,CAAC,OAAO,CAAC;AACxD,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,yBAAyB,CAAC,EAAU;IAClD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AAO,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC,MAAM,GAAG,CAAC,CAAW,EAAE,IAAI,CAAC,CAAC;AACjE,CAAC;AAED,SAAS,QAAQ,CAAC,EAAU;IAC1B,OAAO,EAAE,CAAC,OAAO,CAAC,kBAAkB,EAAE,GAAG,CAAC,CAAC;AAC7C,CAAC"}
@@ -0,0 +1,7 @@
1
+ /** The operator's global Codex home (`~/.codex`). */
2
+ export declare function operatorCodexHome(): string;
3
+ /** A runtime's Codex home — the operator's global home (no dispatcher-private home). */
4
+ export declare function dispatcherCodexHome(id: string): string;
5
+ /** A runtime's Codex `config.toml` path, under its (operator-global) Codex home. */
6
+ export declare function dispatcherCodexConfigPath(id: string): string;
7
+ //# sourceMappingURL=paths.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"paths.d.ts","sourceRoot":"","sources":["../src/paths.ts"],"names":[],"mappings":"AAaA,qDAAqD;AACrD,wBAAgB,iBAAiB,IAAI,MAAM,CAE1C;AAED,wFAAwF;AACxF,wBAAgB,mBAAmB,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,CAGtD;AAED,oFAAoF;AACpF,wBAAgB,yBAAyB,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,CAE5D"}
package/dist/paths.js ADDED
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Codex home/config paths (issue #209 cleanup — relocated from Dreamux core).
3
+ *
4
+ * These resolve Codex's OWN global home (`~/.codex`) and config file. They are
5
+ * codex-engine-specific and homedir-only: they carry no `~/.dreamux` knowledge,
6
+ * so they belong to this package, not to Dreamux core. Dreamux does NOT create a
7
+ * dispatcher-private `CODEX_HOME` for the MVP — every runtime follows the
8
+ * operator's global Codex home — so the per-runtime accessors accept an id only
9
+ * for call-site symmetry and ignore it.
10
+ */
11
+ import { homedir } from 'node:os';
12
+ import { join } from 'node:path';
13
+ /** The operator's global Codex home (`~/.codex`). */
14
+ export function operatorCodexHome() {
15
+ return join(homedir(), '.codex');
16
+ }
17
+ /** A runtime's Codex home — the operator's global home (no dispatcher-private home). */
18
+ export function dispatcherCodexHome(id) {
19
+ void id;
20
+ return operatorCodexHome();
21
+ }
22
+ /** A runtime's Codex `config.toml` path, under its (operator-global) Codex home. */
23
+ export function dispatcherCodexConfigPath(id) {
24
+ return join(dispatcherCodexHome(id), 'config.toml');
25
+ }
26
+ //# sourceMappingURL=paths.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"paths.js","sourceRoot":"","sources":["../src/paths.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,qDAAqD;AACrD,MAAM,UAAU,iBAAiB;IAC/B,OAAO,IAAI,CAAC,OAAO,EAAE,EAAE,QAAQ,CAAC,CAAC;AACnC,CAAC;AAED,wFAAwF;AACxF,MAAM,UAAU,mBAAmB,CAAC,EAAU;IAC5C,KAAK,EAAE,CAAC;IACR,OAAO,iBAAiB,EAAE,CAAC;AAC7B,CAAC;AAED,oFAAoF;AACpF,MAAM,UAAU,yBAAyB,CAAC,EAAU;IAClD,OAAO,IAAI,CAAC,mBAAmB,CAAC,EAAE,CAAC,EAAE,aAAa,CAAC,CAAC;AACtD,CAAC"}