oh-my-codex 0.21.1 → 0.21.2

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 (39) hide show
  1. package/Cargo.toml +1 -1
  2. package/README.md +2 -0
  3. package/dist/cli/native-assets.d.ts +2 -1
  4. package/dist/cli/native-assets.d.ts.map +1 -1
  5. package/dist/cli/native-assets.js +7 -7
  6. package/dist/cli/native-assets.js.map +1 -1
  7. package/dist/cli/update-worker.js +9 -0
  8. package/dist/cli/update-worker.js.map +1 -1
  9. package/dist/cli/update.d.ts +1 -0
  10. package/dist/cli/update.d.ts.map +1 -1
  11. package/dist/cli/update.js +9 -0
  12. package/dist/cli/update.js.map +1 -1
  13. package/dist/hud/__tests__/render.test.js +57 -0
  14. package/dist/hud/__tests__/render.test.js.map +1 -1
  15. package/dist/hud/__tests__/state.test.js +94 -2
  16. package/dist/hud/__tests__/state.test.js.map +1 -1
  17. package/dist/hud/__tests__/types.test.js +9 -0
  18. package/dist/hud/__tests__/types.test.js.map +1 -1
  19. package/dist/hud/render.d.ts.map +1 -1
  20. package/dist/hud/render.js +20 -0
  21. package/dist/hud/render.js.map +1 -1
  22. package/dist/hud/state.d.ts +9 -1
  23. package/dist/hud/state.d.ts.map +1 -1
  24. package/dist/hud/state.js +140 -3
  25. package/dist/hud/state.js.map +1 -1
  26. package/dist/hud/types.d.ts +20 -0
  27. package/dist/hud/types.d.ts.map +1 -1
  28. package/dist/hud/types.js +3 -0
  29. package/dist/hud/types.js.map +1 -1
  30. package/dist/scripts/__tests__/postinstall.test.js +26 -0
  31. package/dist/scripts/__tests__/postinstall.test.js.map +1 -1
  32. package/dist/scripts/postinstall.d.ts +7 -0
  33. package/dist/scripts/postinstall.d.ts.map +1 -1
  34. package/dist/scripts/postinstall.js +40 -0
  35. package/dist/scripts/postinstall.js.map +1 -1
  36. package/package.json +1 -1
  37. package/plugins/oh-my-codex/.codex-plugin/plugin.json +1 -1
  38. package/src/scripts/__tests__/postinstall.test.ts +28 -0
  39. package/src/scripts/postinstall.ts +46 -0
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oh-my-codex",
3
- "version": "0.21.1",
3
+ "version": "0.21.2",
4
4
  "description": "Multi-agent orchestration layer for OpenAI Codex CLI",
5
5
  "author": {
6
6
  "name": "Yeachan Heo",
@@ -33,6 +33,7 @@ describe("runPostinstall", () => {
33
33
  const result = await runPostinstall({
34
34
  env: { npm_config_global: "true" },
35
35
  getCurrentVersion: async () => "0.14.1",
36
+ hydrateRuntime: async () => "/cache/omx-runtime",
36
37
  log: (message) => logs.push(message),
37
38
  readStamp: async () => ({
38
39
  installed_version: "0.14.0",
@@ -44,6 +45,7 @@ describe("runPostinstall", () => {
44
45
  });
45
46
 
46
47
  assert.equal(result.status, "hinted");
48
+ assert.match(logs.join("\n"), /Hydrated omx-runtime/);
47
49
  assert.match(logs.join("\n"), /OMX setup is explicit opt-in; run `omx setup` or `omx update` when you're ready/);
48
50
 
49
51
  const stamp = JSON.parse(await readFile(stampPath, "utf-8")) as {
@@ -68,6 +70,7 @@ describe("runPostinstall", () => {
68
70
  const result = await runPostinstall({
69
71
  env: { npm_config_global: "true" },
70
72
  getCurrentVersion: async () => "0.14.1",
73
+ hydrateRuntime: async () => "/cache/omx-runtime",
71
74
  log: (message) => logs.push(message),
72
75
  readStamp: async () => ({
73
76
  installed_version: "0.14.0",
@@ -100,6 +103,7 @@ describe("runPostinstall", () => {
100
103
  npm_config_user_agent: "bun/1.2.0 npm/? node/v22.0.0 linux x64",
101
104
  },
102
105
  getCurrentVersion: async () => "0.14.1",
106
+ hydrateRuntime: async () => "/cache/omx-runtime",
103
107
  readStamp: async () => null,
104
108
  writeStamp: async (stamp) => {
105
109
  writtenStamp = stamp;
@@ -114,15 +118,21 @@ describe("runPostinstall", () => {
114
118
  const result = await runPostinstall({
115
119
  env: { npm_config_global: "false" },
116
120
  getCurrentVersion: async () => "0.14.1",
121
+ hydrateRuntime: async () => "/cache/omx-runtime",
117
122
  });
118
123
 
119
124
  assert.equal(result.status, "noop-local");
120
125
  });
121
126
 
122
127
  it("does not rerun setup when the installed version matches the saved stamp", async () => {
128
+ let hydrated = false;
123
129
  const result = await runPostinstall({
124
130
  env: { npm_config_global: "true" },
125
131
  getCurrentVersion: async () => "0.14.1",
132
+ hydrateRuntime: async () => {
133
+ hydrated = true;
134
+ return "/cache/omx-runtime";
135
+ },
126
136
  readStamp: async () => ({
127
137
  installed_version: "0.14.1",
128
138
  setup_completed_version: "0.14.1",
@@ -131,5 +141,23 @@ describe("runPostinstall", () => {
131
141
  });
132
142
 
133
143
  assert.equal(result.status, "noop-same-version");
144
+ assert.equal(hydrated, true, "same-version reinstalls must repair a missing native runtime cache");
145
+ });
146
+
147
+ it("keeps global installation non-fatal when runtime hydration fails", async () => {
148
+ const logs: string[] = [];
149
+ const result = await runPostinstall({
150
+ env: { npm_config_global: "true" },
151
+ getCurrentVersion: async () => "0.14.1",
152
+ hydrateRuntime: async () => {
153
+ throw new Error("offline");
154
+ },
155
+ log: (message) => logs.push(message),
156
+ readStamp: async () => null,
157
+ writeStamp: async () => {},
158
+ });
159
+
160
+ assert.equal(result.status, "hinted");
161
+ assert.match(logs.join("\n"), /hydration failed non-fatally: offline/);
134
162
  });
135
163
  });
@@ -8,6 +8,7 @@ import {
8
8
  writeUserInstallStamp,
9
9
  } from './postinstall-advisory.js';
10
10
  import { getPackageRoot } from "../utils/package.js";
11
+ import { hydrateNativeBinary } from "../cli/native-assets.js";
11
12
 
12
13
  type PostinstallStatus =
13
14
  | "noop-local"
@@ -24,10 +25,40 @@ interface PostinstallDependencies {
24
25
  env: NodeJS.ProcessEnv;
25
26
  getCurrentVersion: () => Promise<string | null>;
26
27
  log: (message: string) => void;
28
+ hydrateRuntime: () => Promise<string | undefined>;
27
29
  readStamp: () => Promise<UserInstallStamp | null>;
28
30
  writeStamp: (stamp: UserInstallStamp) => Promise<void>;
29
31
  }
30
32
 
33
+ const RUNTIME_HYDRATION_TIMEOUT_MS = 15_000;
34
+
35
+ export async function hydrateOmxRuntimeNonFatal(options: {
36
+ packageRoot?: string;
37
+ env?: NodeJS.ProcessEnv;
38
+ log?: (message: string) => void;
39
+ timeoutMs?: number;
40
+ } = {}): Promise<string | undefined> {
41
+ const log = options.log ?? ((message: string) => console.log(message));
42
+ const controller = new AbortController();
43
+ const timer = setTimeout(() => controller.abort(), options.timeoutMs ?? RUNTIME_HYDRATION_TIMEOUT_MS);
44
+ timer.unref?.();
45
+ try {
46
+ const runtimePath = await hydrateNativeBinary("omx-runtime", {
47
+ packageRoot: options.packageRoot,
48
+ env: options.env,
49
+ signal: controller.signal,
50
+ });
51
+ if (runtimePath) log(`[omx] Hydrated omx-runtime for this platform: ${runtimePath}`);
52
+ else log("[omx] omx-runtime was not available for this platform; native runtime features remain disabled.");
53
+ return runtimePath;
54
+ } catch (error) {
55
+ log(`[omx] omx-runtime hydration failed non-fatally: ${error instanceof Error ? error.message : String(error)}`);
56
+ return undefined;
57
+ } finally {
58
+ clearTimeout(timer);
59
+ }
60
+ }
61
+
31
62
  function stripLeadingV(version: string): string {
32
63
  return version.trim().replace(/^v/i, "");
33
64
  }
@@ -55,6 +86,7 @@ const defaultDependencies: PostinstallDependencies = {
55
86
  env: process.env,
56
87
  getCurrentVersion,
57
88
  log: (message) => console.log(message),
89
+ hydrateRuntime: () => hydrateOmxRuntimeNonFatal(),
58
90
  readStamp: () => readUserInstallStamp(),
59
91
  writeStamp: (stamp) => writeUserInstallStamp(stamp),
60
92
  };
@@ -75,6 +107,20 @@ export async function runPostinstall(
75
107
  }
76
108
 
77
109
  const currentStampVersion = stripLeadingV(currentVersion);
110
+ try {
111
+ const runtimePath = await resolved.hydrateRuntime();
112
+ if (runtimePath) {
113
+ resolved.log(`[omx] Hydrated omx-runtime for this platform: ${runtimePath}`);
114
+ } else {
115
+ resolved.log(
116
+ "[omx] omx-runtime was not available for this platform; native runtime features remain disabled.",
117
+ );
118
+ }
119
+ } catch (error) {
120
+ resolved.log(
121
+ `[omx] omx-runtime hydration failed non-fatally: ${error instanceof Error ? error.message : String(error)}`,
122
+ );
123
+ }
78
124
  const existingStamp = await resolved.readStamp();
79
125
  if (!isInstallVersionBump(currentVersion, existingStamp)) {
80
126
  return { status: "noop-same-version", version: currentStampVersion };