@memnexus-ai/mx-agent-cli 0.1.245 → 0.1.247

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 (70) hide show
  1. package/dist/__tests__/codex-agent-gate.test.d.ts +2 -0
  2. package/dist/__tests__/codex-agent-gate.test.d.ts.map +1 -0
  3. package/dist/__tests__/codex-agent-gate.test.js +182 -0
  4. package/dist/__tests__/codex-agent-gate.test.js.map +1 -0
  5. package/dist/__tests__/runtime-claude-adapter.test.d.ts +2 -0
  6. package/dist/__tests__/runtime-claude-adapter.test.d.ts.map +1 -0
  7. package/dist/__tests__/runtime-claude-adapter.test.js +70 -0
  8. package/dist/__tests__/runtime-claude-adapter.test.js.map +1 -0
  9. package/dist/__tests__/runtime-codex-adapter.test.d.ts +2 -0
  10. package/dist/__tests__/runtime-codex-adapter.test.d.ts.map +1 -0
  11. package/dist/__tests__/runtime-codex-adapter.test.js +475 -0
  12. package/dist/__tests__/runtime-codex-adapter.test.js.map +1 -0
  13. package/dist/__tests__/runtime-codex-config.test.d.ts +2 -0
  14. package/dist/__tests__/runtime-codex-config.test.d.ts.map +1 -0
  15. package/dist/__tests__/runtime-codex-config.test.js +523 -0
  16. package/dist/__tests__/runtime-codex-config.test.js.map +1 -0
  17. package/dist/__tests__/runtime-codex-version-pin.test.d.ts +2 -0
  18. package/dist/__tests__/runtime-codex-version-pin.test.d.ts.map +1 -0
  19. package/dist/__tests__/runtime-codex-version-pin.test.js +69 -0
  20. package/dist/__tests__/runtime-codex-version-pin.test.js.map +1 -0
  21. package/dist/__tests__/runtime-resolve.test.d.ts +2 -0
  22. package/dist/__tests__/runtime-resolve.test.d.ts.map +1 -0
  23. package/dist/__tests__/runtime-resolve.test.js +172 -0
  24. package/dist/__tests__/runtime-resolve.test.js.map +1 -0
  25. package/dist/__tests__/start-rebase-never-ran.test.d.ts +25 -0
  26. package/dist/__tests__/start-rebase-never-ran.test.d.ts.map +1 -0
  27. package/dist/__tests__/start-rebase-never-ran.test.js +227 -0
  28. package/dist/__tests__/start-rebase-never-ran.test.js.map +1 -0
  29. package/dist/__tests__/start-runtime-wiring.test.d.ts +31 -0
  30. package/dist/__tests__/start-runtime-wiring.test.d.ts.map +1 -0
  31. package/dist/__tests__/start-runtime-wiring.test.js +498 -0
  32. package/dist/__tests__/start-runtime-wiring.test.js.map +1 -0
  33. package/dist/agent-config/hooks/deploy-verification-reminder.sh +143 -12
  34. package/dist/agent-config/hooks/memory-checkpoint-reminder.sh +20 -2
  35. package/dist/commands/codex-agent-gate.d.ts +23 -0
  36. package/dist/commands/codex-agent-gate.d.ts.map +1 -0
  37. package/dist/commands/codex-agent-gate.js +139 -0
  38. package/dist/commands/codex-agent-gate.js.map +1 -0
  39. package/dist/commands/start.d.ts +21 -0
  40. package/dist/commands/start.d.ts.map +1 -1
  41. package/dist/commands/start.js +190 -25
  42. package/dist/commands/start.js.map +1 -1
  43. package/dist/index.d.ts.map +1 -1
  44. package/dist/index.js +23 -1
  45. package/dist/index.js.map +1 -1
  46. package/dist/lib/claude.d.ts +72 -10
  47. package/dist/lib/claude.d.ts.map +1 -1
  48. package/dist/lib/claude.js +71 -32
  49. package/dist/lib/claude.js.map +1 -1
  50. package/dist/lib/runtime/claude-adapter.d.ts +16 -0
  51. package/dist/lib/runtime/claude-adapter.d.ts.map +1 -0
  52. package/dist/lib/runtime/claude-adapter.js +43 -0
  53. package/dist/lib/runtime/claude-adapter.js.map +1 -0
  54. package/dist/lib/runtime/codex-adapter.d.ts +90 -0
  55. package/dist/lib/runtime/codex-adapter.d.ts.map +1 -0
  56. package/dist/lib/runtime/codex-adapter.js +357 -0
  57. package/dist/lib/runtime/codex-adapter.js.map +1 -0
  58. package/dist/lib/runtime/codex-config.d.ts +254 -0
  59. package/dist/lib/runtime/codex-config.d.ts.map +1 -0
  60. package/dist/lib/runtime/codex-config.js +620 -0
  61. package/dist/lib/runtime/codex-config.js.map +1 -0
  62. package/dist/lib/runtime/resolve.d.ts +46 -0
  63. package/dist/lib/runtime/resolve.d.ts.map +1 -0
  64. package/dist/lib/runtime/resolve.js +113 -0
  65. package/dist/lib/runtime/resolve.js.map +1 -0
  66. package/dist/lib/runtime/types.d.ts +81 -0
  67. package/dist/lib/runtime/types.d.ts.map +1 -0
  68. package/dist/lib/runtime/types.js +39 -0
  69. package/dist/lib/runtime/types.js.map +1 -0
  70. package/package.json +1 -1
@@ -0,0 +1,46 @@
1
+ import { type RuntimeId } from './types.js';
2
+ /** Worktree-local, git-ignored, single-line file holding the runtime id. */
3
+ export declare const RUNTIME_FILENAME = ".mx-runtime";
4
+ /**
5
+ * Cap on the bytes read from `.mx-runtime`. The file is one short token; a large
6
+ * file is corruption or a mistake, and reading it whole is pointless work.
7
+ * Mirrors leader-lock.ts's MAX_LOCK_BYTES rationale.
8
+ */
9
+ export declare const MAX_RUNTIME_FILE_BYTES = 64;
10
+ export declare function runtimeFilePath(worktreePath: string): string;
11
+ export type RuntimeSource = 'flag' | 'persisted' | 'default';
12
+ export interface RuntimeResolution {
13
+ runtime: RuntimeId;
14
+ source: RuntimeSource;
15
+ /** Set when a present-but-unusable `.mx-runtime` was ignored. Advisory only. */
16
+ warning?: string;
17
+ /**
18
+ * True when the caller should write this runtime to `.mx-runtime` — i.e. the flag
19
+ * was passed. The write is the CALLER's to make, deliberately (security review S7):
20
+ * resolution happens early, but persisting must wait until preflight and the launch
21
+ * gate have both passed, or a refused start leaves a persisted runtime that the next
22
+ * flagless start silently adopts.
23
+ */
24
+ shouldPersist: boolean;
25
+ }
26
+ /**
27
+ * Read the persisted runtime. Returns null when absent, unreadable, oversized or
28
+ * not a known runtime id — every one of which resolves to the default.
29
+ */
30
+ export declare function readPersistedRuntime(worktreePath: string): {
31
+ runtime: RuntimeId | null;
32
+ warning?: string;
33
+ };
34
+ /** Write the runtime id to `.mx-runtime`. Best-effort: returns false on failure. */
35
+ export declare function persistRuntime(worktreePath: string, runtime: RuntimeId): boolean;
36
+ /**
37
+ * Resolve the runtime for this start. PURE — reads, never writes.
38
+ *
39
+ * Persistence used to happen here (FR-2), which meant `.mx-runtime` was written before
40
+ * the preflight and the Phase 1 gate had run: a `--runtime codex` start that was then
41
+ * refused still left `codex` on disk, so the next flagless start resolved `codex` from
42
+ * a session that never happened. The caller now performs the write, after both checks,
43
+ * when `shouldPersist` is set (security review S7).
44
+ */
45
+ export declare function resolveRuntime(flag: RuntimeId | undefined, worktreePath: string): RuntimeResolution;
46
+ //# sourceMappingURL=resolve.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolve.d.ts","sourceRoot":"","sources":["../../../src/lib/runtime/resolve.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAgC,KAAK,SAAS,EAAE,MAAM,YAAY,CAAC;AAE1E,4EAA4E;AAC5E,eAAO,MAAM,gBAAgB,gBAAgB,CAAC;AAE9C;;;;GAIG;AACH,eAAO,MAAM,sBAAsB,KAAK,CAAC;AAEzC,wBAAgB,eAAe,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM,CAE5D;AAED,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG,WAAW,GAAG,SAAS,CAAC;AAE7D,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,SAAS,CAAC;IACnB,MAAM,EAAE,aAAa,CAAC;IACtB,gFAAgF;IAChF,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;;;;OAMG;IACH,aAAa,EAAE,OAAO,CAAC;CACxB;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,YAAY,EAAE,MAAM,GAAG;IAAE,OAAO,EAAE,SAAS,GAAG,IAAI,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE,CA4C1G;AAED,oFAAoF;AACpF,wBAAgB,cAAc,CAAC,YAAY,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS,GAAG,OAAO,CAOhF;AAED;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAC5B,IAAI,EAAE,SAAS,GAAG,SAAS,EAC3B,YAAY,EAAE,MAAM,GACnB,iBAAiB,CAUnB"}
@@ -0,0 +1,113 @@
1
+ /**
2
+ * Runtime resolution and per-worktree persistence (#4227 Phase 1, task 1.2).
3
+ *
4
+ * Precedence, per FR-1/FR-2: explicit flag > worktree-persisted file > default
5
+ * `claude`. When the flag is present the resolved value is persisted, so a later
6
+ * `mx-agent start` with no flag keeps the runtime and a later flag overrides and
7
+ * re-persists.
8
+ *
9
+ * `.mx-runtime` is worktree-local runtime state, not product work. It joins
10
+ * `ALWAYS_REGEN` in start.ts alongside `.mx-leader.lock` so the pre-rebase
11
+ * auto-stash and divergence handling never touch it (FR-3).
12
+ *
13
+ * FAILURE MODEL: fail-open to the default. An unreadable or malformed
14
+ * `.mx-runtime` warns and resolves `claude`; it never blocks a start (FR-2 edge
15
+ * case). Persisting is best-effort for the same reason — a read-only worktree
16
+ * must still be able to launch.
17
+ */
18
+ import { readFileSync, statSync, writeFileSync } from 'fs';
19
+ import { join } from 'path';
20
+ import { DEFAULT_RUNTIME, isRuntimeId } from './types.js';
21
+ /** Worktree-local, git-ignored, single-line file holding the runtime id. */
22
+ export const RUNTIME_FILENAME = '.mx-runtime';
23
+ /**
24
+ * Cap on the bytes read from `.mx-runtime`. The file is one short token; a large
25
+ * file is corruption or a mistake, and reading it whole is pointless work.
26
+ * Mirrors leader-lock.ts's MAX_LOCK_BYTES rationale.
27
+ */
28
+ export const MAX_RUNTIME_FILE_BYTES = 64;
29
+ export function runtimeFilePath(worktreePath) {
30
+ return join(worktreePath, RUNTIME_FILENAME);
31
+ }
32
+ /**
33
+ * Read the persisted runtime. Returns null when absent, unreadable, oversized or
34
+ * not a known runtime id — every one of which resolves to the default.
35
+ */
36
+ export function readPersistedRuntime(worktreePath) {
37
+ const path = runtimeFilePath(worktreePath);
38
+ // Size-check via stat BEFORE reading (security review S8), matching
39
+ // leader-lock.ts's MAX_LOCK_BYTES handling, which this function's docblock cites as
40
+ // its model. Reading first and measuring after means a multi-gigabyte or
41
+ // /dev/zero-symlinked `.mx-runtime` is pulled fully into memory before being
42
+ // rejected for being too large — the check has to happen before the read to be one.
43
+ // The stat also replaces the previous existsSync, so absent, unreadable and
44
+ // not-a-regular-file are one code path instead of a TOCTOU gap between two calls.
45
+ let size;
46
+ try {
47
+ const st = statSync(path);
48
+ if (!st.isFile()) {
49
+ return {
50
+ runtime: null,
51
+ warning: `${RUNTIME_FILENAME} is not a regular file — using default runtime '${DEFAULT_RUNTIME}'.`,
52
+ };
53
+ }
54
+ size = st.size;
55
+ }
56
+ catch {
57
+ return { runtime: null }; // absent: the ordinary case, no warning
58
+ }
59
+ if (size > MAX_RUNTIME_FILE_BYTES) {
60
+ return {
61
+ runtime: null,
62
+ warning: `${RUNTIME_FILENAME} is larger than ${MAX_RUNTIME_FILE_BYTES} bytes — using default runtime '${DEFAULT_RUNTIME}'.`,
63
+ };
64
+ }
65
+ let raw;
66
+ try {
67
+ raw = readFileSync(path, 'utf-8');
68
+ }
69
+ catch {
70
+ return { runtime: null, warning: `Could not read ${RUNTIME_FILENAME} — using default runtime '${DEFAULT_RUNTIME}'.` };
71
+ }
72
+ const value = raw.trim();
73
+ if (!isRuntimeId(value)) {
74
+ return {
75
+ runtime: null,
76
+ warning: `${RUNTIME_FILENAME} contains an unrecognized runtime — using default runtime '${DEFAULT_RUNTIME}'.`,
77
+ };
78
+ }
79
+ return { runtime: value };
80
+ }
81
+ /** Write the runtime id to `.mx-runtime`. Best-effort: returns false on failure. */
82
+ export function persistRuntime(worktreePath, runtime) {
83
+ try {
84
+ writeFileSync(runtimeFilePath(worktreePath), `${runtime}\n`);
85
+ return true;
86
+ }
87
+ catch {
88
+ return false;
89
+ }
90
+ }
91
+ /**
92
+ * Resolve the runtime for this start. PURE — reads, never writes.
93
+ *
94
+ * Persistence used to happen here (FR-2), which meant `.mx-runtime` was written before
95
+ * the preflight and the Phase 1 gate had run: a `--runtime codex` start that was then
96
+ * refused still left `codex` on disk, so the next flagless start resolved `codex` from
97
+ * a session that never happened. The caller now performs the write, after both checks,
98
+ * when `shouldPersist` is set (security review S7).
99
+ */
100
+ export function resolveRuntime(flag, worktreePath) {
101
+ if (flag)
102
+ return { runtime: flag, source: 'flag', shouldPersist: true };
103
+ const { runtime, warning } = readPersistedRuntime(worktreePath);
104
+ if (runtime)
105
+ return { runtime, source: 'persisted', shouldPersist: false };
106
+ return {
107
+ runtime: DEFAULT_RUNTIME,
108
+ source: 'default',
109
+ shouldPersist: false,
110
+ ...(warning ? { warning } : {}),
111
+ };
112
+ }
113
+ //# sourceMappingURL=resolve.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolve.js","sourceRoot":"","sources":["../../../src/lib/runtime/resolve.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1,81 @@
1
+ /**
2
+ * Runtime adapter contracts — the seam that lets `mx-agent start` launch a team
3
+ * on something other than Claude Code (#4227, PRD rev 3.1 Phase 1, task 1.1).
4
+ *
5
+ * Everything `runStart` does before the launch (locate worktree, claim the leader
6
+ * lock, rebase, deploy config, build the prompt) is runtime-neutral. The adapter
7
+ * owns exactly four things: which binary to spawn and with what arguments, which
8
+ * config files to deploy, which instruction-override file to write, and which
9
+ * model label to report for the banner and cost attribution.
10
+ *
11
+ * DESIGN PRINCIPLE 1 (non-negotiable, PRD Solution Overview): Claude is the
12
+ * default and is never regressed. `ClaudeAdapter` is a thin wrapper over the
13
+ * existing `launchClaudeSession` — no behavioural change, no new preflight, no
14
+ * extra file writes on the Claude path.
15
+ */
16
+ export type RuntimeId = 'claude' | 'codex';
17
+ /** Every valid `--runtime` value, in the order the error message lists them. */
18
+ export declare const RUNTIME_IDS: readonly RuntimeId[];
19
+ /** Runtime used when neither the flag nor a persisted choice is present (FR-1). */
20
+ export declare const DEFAULT_RUNTIME: RuntimeId;
21
+ export declare function isRuntimeId(value: unknown): value is RuntimeId;
22
+ /**
23
+ * Parse a raw `--runtime` value.
24
+ *
25
+ * Returns undefined when the flag was absent (so resolution falls through to the
26
+ * persisted file, then the default) and throws a user-facing Error on an unknown
27
+ * value — FR-1's edge case requires a non-zero exit with the valid list named.
28
+ * The throw (rather than a process.exit here) keeps the failure testable and
29
+ * leaves exit-code policy with the command.
30
+ */
31
+ export declare function parseRuntimeFlag(value: string | undefined | null): RuntimeId | undefined;
32
+ /** Everything an adapter needs to launch a session. Mirrors launchClaudeSession's opts. */
33
+ export interface LaunchContext {
34
+ worktreePath: string;
35
+ worktreeName: string;
36
+ branch: string | null;
37
+ slot: number;
38
+ initialPrompt: string;
39
+ teamName: string;
40
+ /**
41
+ * Base branch whose remote-tracking ref carries the canonical roleguides (#4707).
42
+ * Forwarded by the Codex adapter to the instruction-file generator so a Codex
43
+ * session resolves the roleguide from the same ref a Claude session does.
44
+ */
45
+ baseBranch: string;
46
+ /** Remote holding the canonical tree. Absent → the generator's `origin` default. */
47
+ gitRemote?: string;
48
+ }
49
+ export interface RuntimeAdapter {
50
+ readonly id: RuntimeId;
51
+ /** Human-facing model label for the start banner and cost attribution. */
52
+ readonly model: string;
53
+ /**
54
+ * Verify the runtime's binary is available and usable; throw a user-facing
55
+ * error if not. Never falls back to another runtime — a silent fallback hides
56
+ * which runtime actually ran (PRD Error states / FR-8).
57
+ */
58
+ preflight(): void;
59
+ /**
60
+ * Throw if this runtime is not authorized to launch yet, BEFORE any side effect.
61
+ *
62
+ * Separate from `preflight` (which asks "is the binary usable?") and from `launch`
63
+ * (which is too late — by then the runtime choice has been persisted and config
64
+ * deployed). `runStart` calls this between preflight and persistence so a refused
65
+ * launch leaves no `.mx-runtime` behind (#4227 security review S7).
66
+ *
67
+ * Takes only the worktree path, not the whole LaunchContext: the gate runs before
68
+ * the initial prompt exists, and a `LaunchContext` satisfies this parameter, so
69
+ * `launch`'s re-check passes its own context unchanged.
70
+ */
71
+ assertLaunchAllowed(ctx: Pick<LaunchContext, 'worktreePath'>): void;
72
+ /** Deploy runtime-specific config into the worktree (idempotent, pre-launch). */
73
+ deployConfig(ctx: LaunchContext): void;
74
+ /**
75
+ * Spawn the session, own the terminal, patch childPid into the leader lock and
76
+ * propagate the child's exit code. Mirrors launchClaudeSession's process
77
+ * contract exactly.
78
+ */
79
+ launch(ctx: LaunchContext): Promise<void>;
80
+ }
81
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/lib/runtime/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,MAAM,MAAM,SAAS,GAAG,QAAQ,GAAG,OAAO,CAAC;AAE3C,gFAAgF;AAChF,eAAO,MAAM,WAAW,EAAE,SAAS,SAAS,EAAiC,CAAC;AAE9E,mFAAmF;AACnF,eAAO,MAAM,eAAe,EAAE,SAAoB,CAAC;AAEnD,wBAAgB,WAAW,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,SAAS,CAE9D;AAED;;;;;;;;GAQG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,GAAG,SAAS,GAAG,SAAS,CAIxF;AAED,2FAA2F;AAC3F,MAAM,WAAW,aAAa;IAC5B,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,MAAM,CAAC;IACrB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,aAAa,EAAE,MAAM,CAAC;IACtB,QAAQ,EAAE,MAAM,CAAC;IACjB;;;;OAIG;IACH,UAAU,EAAE,MAAM,CAAC;IACnB,oFAAoF;IACpF,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,EAAE,EAAE,SAAS,CAAC;IACvB,0EAA0E;IAC1E,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB;;;;OAIG;IACH,SAAS,IAAI,IAAI,CAAC;IAClB;;;;;;;;;;;OAWG;IACH,mBAAmB,CAAC,GAAG,EAAE,IAAI,CAAC,aAAa,EAAE,cAAc,CAAC,GAAG,IAAI,CAAC;IACpE,iFAAiF;IACjF,YAAY,CAAC,GAAG,EAAE,aAAa,GAAG,IAAI,CAAC;IACvC;;;;OAIG;IACH,MAAM,CAAC,GAAG,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC3C"}
@@ -0,0 +1,39 @@
1
+ /**
2
+ * Runtime adapter contracts — the seam that lets `mx-agent start` launch a team
3
+ * on something other than Claude Code (#4227, PRD rev 3.1 Phase 1, task 1.1).
4
+ *
5
+ * Everything `runStart` does before the launch (locate worktree, claim the leader
6
+ * lock, rebase, deploy config, build the prompt) is runtime-neutral. The adapter
7
+ * owns exactly four things: which binary to spawn and with what arguments, which
8
+ * config files to deploy, which instruction-override file to write, and which
9
+ * model label to report for the banner and cost attribution.
10
+ *
11
+ * DESIGN PRINCIPLE 1 (non-negotiable, PRD Solution Overview): Claude is the
12
+ * default and is never regressed. `ClaudeAdapter` is a thin wrapper over the
13
+ * existing `launchClaudeSession` — no behavioural change, no new preflight, no
14
+ * extra file writes on the Claude path.
15
+ */
16
+ /** Every valid `--runtime` value, in the order the error message lists them. */
17
+ export const RUNTIME_IDS = ['claude', 'codex'];
18
+ /** Runtime used when neither the flag nor a persisted choice is present (FR-1). */
19
+ export const DEFAULT_RUNTIME = 'claude';
20
+ export function isRuntimeId(value) {
21
+ return typeof value === 'string' && RUNTIME_IDS.includes(value);
22
+ }
23
+ /**
24
+ * Parse a raw `--runtime` value.
25
+ *
26
+ * Returns undefined when the flag was absent (so resolution falls through to the
27
+ * persisted file, then the default) and throws a user-facing Error on an unknown
28
+ * value — FR-1's edge case requires a non-zero exit with the valid list named.
29
+ * The throw (rather than a process.exit here) keeps the failure testable and
30
+ * leaves exit-code policy with the command.
31
+ */
32
+ export function parseRuntimeFlag(value) {
33
+ if (value === undefined || value === null || value === '')
34
+ return undefined;
35
+ if (isRuntimeId(value))
36
+ return value;
37
+ throw new Error(`unknown runtime '${value}' — valid: ${RUNTIME_IDS.join(', ')}`);
38
+ }
39
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/lib/runtime/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAIH,gFAAgF;AAChF,MAAM,CAAC,MAAM,WAAW,GAAyB,CAAC,QAAQ,EAAE,OAAO,CAAU,CAAC;AAE9E,mFAAmF;AACnF,MAAM,CAAC,MAAM,eAAe,GAAc,QAAQ,CAAC;AAEnD,MAAM,UAAU,WAAW,CAAC,KAAc;IACxC,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAK,WAAiC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;AACzF,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,gBAAgB,CAAC,KAAgC;IAC/D,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,EAAE;QAAE,OAAO,SAAS,CAAC;IAC5E,IAAI,WAAW,CAAC,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC;IACrC,MAAM,IAAI,KAAK,CAAC,oBAAoB,KAAK,cAAc,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AACnF,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@memnexus-ai/mx-agent-cli",
3
- "version": "0.1.245",
3
+ "version": "0.1.247",
4
4
  "description": "CLI for creating and managing AI agent teams",
5
5
  "type": "module",
6
6
  "bin": {