@mindexec/cli 0.2.477 → 0.2.478

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 (145) hide show
  1. package/README.md +323 -323
  2. package/codex-model-catalog.js +202 -202
  3. package/codex-runtime.js +1608 -1608
  4. package/desktop-workspace-state.cjs +120 -120
  5. package/electron/main.cjs +517 -517
  6. package/electron/preload.cjs +17 -17
  7. package/electron/recurring-update-owner-smoke.mjs +55 -55
  8. package/electron/recurring-update-owner.cjs +97 -97
  9. package/electron/source-smoke.mjs +108 -108
  10. package/electron/update-feed-resolver.cjs +79 -79
  11. package/electron/update-feed.json +10 -10
  12. package/electron/update-manager-smoke.mjs +146 -146
  13. package/electron/update-manager.cjs +297 -297
  14. package/electron/windows-package-smoke.mjs +156 -156
  15. package/launch-bridge.cjs +236 -236
  16. package/lzo1x.js +110 -110
  17. package/mode4-atlas-worker.js +440 -440
  18. package/mode4-atlas.js +130 -130
  19. package/package.json +1 -1
  20. package/port-guard.cjs +285 -285
  21. package/remote-fast/osx-arm64/MacScreenCaptureKitH264.swift +339 -339
  22. package/remote-fast/osx-arm64/MacSystemAudioCapture.swift +214 -214
  23. package/remote-fast/osx-arm64/UnixRawCaptureHelper.mjs +80 -80
  24. package/remote-fast/osx-arm64/livedesk-raw-capture-resampler.mjs +73 -73
  25. package/remote-fast/osx-arm64/mindexec-remote-fast.dll +0 -0
  26. package/remote-fast/osx-x64/MacScreenCaptureKitH264.swift +339 -339
  27. package/remote-fast/osx-x64/MacSystemAudioCapture.swift +214 -214
  28. package/remote-fast/osx-x64/UnixRawCaptureHelper.mjs +80 -80
  29. package/remote-fast/osx-x64/livedesk-raw-capture-resampler.mjs +73 -73
  30. package/remote-fast/osx-x64/mindexec-remote-fast.dll +0 -0
  31. package/remote-fast/win-x64/mindexec-remote-fast.dll +0 -0
  32. package/remote-hub.js +3698 -3698
  33. package/scripts/auth-session-smoke.mjs +262 -262
  34. package/scripts/board-render-ownership-smoke.mjs +85 -85
  35. package/scripts/codex-model-catalog-smoke.mjs +150 -150
  36. package/scripts/codex-runtime-home-smoke.mjs +58 -58
  37. package/scripts/codex-sdk-image-live-smoke.mjs +43 -43
  38. package/scripts/codex-sdk-image-runtime-smoke.mjs +122 -122
  39. package/scripts/codex-sdk-runtime-smoke.mjs +89 -89
  40. package/scripts/desktop-update-publisher-smoke.mjs +89 -89
  41. package/scripts/desktop-update-worker-smoke.mjs +72 -72
  42. package/scripts/desktop-workspace-state-smoke.mjs +81 -81
  43. package/scripts/drive-installed-update-smoke.mjs +67 -67
  44. package/scripts/npm-fresh-install-smoke.mjs +216 -216
  45. package/scripts/publish-mindexec-desktop-updates.mjs +224 -224
  46. package/scripts/remote-agent-managed-smoke.mjs +318 -318
  47. package/scripts/remote-agent-package-smoke.mjs +64 -64
  48. package/scripts/remote-agent-ws-smoke.mjs +269 -269
  49. package/scripts/remote-fast-live-rate-smoke.mjs +343 -343
  50. package/scripts/remote-fast-mdm-browser-smoke.mjs +453 -453
  51. package/scripts/remote-fleet-render-smoke.mjs +1350 -1350
  52. package/scripts/remote-frame-ws-smoke.mjs +234 -234
  53. package/scripts/remote-http-smoke.mjs +592 -592
  54. package/scripts/remote-hub-identity-smoke.mjs +146 -146
  55. package/scripts/remote-hub-scale-smoke.mjs +124 -124
  56. package/scripts/remote-hub-smoke.mjs +699 -699
  57. package/scripts/remote-input-ws-smoke.mjs +263 -263
  58. package/scripts/remote-registry-follower-smoke.mjs +815 -815
  59. package/scripts/setup-tree-sitter-grammars.mjs +59 -59
  60. package/server.js +7690 -7690
  61. package/start-bridge.bat +32 -32
  62. package/start-bridge.sh +81 -81
  63. package/wwwroot/_content/MindExecution.Plugins.Admin/css/admin-dashboard.css +546 -546
  64. package/wwwroot/_content/MindExecution.Plugins.YouTube/css/youtube-search.css +251 -251
  65. package/wwwroot/_content/MindExecution.Shared/css/app.css +1 -1
  66. package/wwwroot/_content/MindExecution.Shared/css/mind-map-overrides.css +3789 -3789
  67. package/wwwroot/_content/MindExecution.Shared/js/agent-visualization.js +27 -27
  68. package/wwwroot/_content/MindExecution.Shared/js/background-themes.js +1449 -1449
  69. package/wwwroot/_content/MindExecution.Shared/js/code-master.js +8316 -8316
  70. package/wwwroot/_content/MindExecution.Shared/js/file-system-helper.js +338 -338
  71. package/wwwroot/_content/MindExecution.Shared/js/marked.min.js +69 -69
  72. package/wwwroot/_content/MindExecution.Shared/js/mind-map-animated-image-preview.js +270 -270
  73. package/wwwroot/_content/MindExecution.Shared/js/mind-map-automation-edge-motion.js +170 -170
  74. package/wwwroot/_content/MindExecution.Shared/js/mind-map-board-render-ownership.js +81 -81
  75. package/wwwroot/_content/MindExecution.Shared/js/mind-map-core.js +10506 -10506
  76. package/wwwroot/_content/MindExecution.Shared/js/mind-map-css3d-hotpath.js +902 -902
  77. package/wwwroot/_content/MindExecution.Shared/js/mind-map-css3d-manager.js +24637 -24637
  78. package/wwwroot/_content/MindExecution.Shared/js/mind-map-dev-guards.js +325 -325
  79. package/wwwroot/_content/MindExecution.Shared/js/mind-map-dnd.js +1491 -1491
  80. package/wwwroot/_content/MindExecution.Shared/js/mind-map-glow-shader.js +70 -70
  81. package/wwwroot/_content/MindExecution.Shared/js/mind-map-image-policy.js +218 -218
  82. package/wwwroot/_content/MindExecution.Shared/js/mind-map-interactions.js +7065 -7065
  83. package/wwwroot/_content/MindExecution.Shared/js/mind-map-lod-plan-worker.js +160 -160
  84. package/wwwroot/_content/MindExecution.Shared/js/mind-map-lod-renderer.js +9956 -9956
  85. package/wwwroot/_content/MindExecution.Shared/js/mind-map-lod-video-placeholder.js +107 -107
  86. package/wwwroot/_content/MindExecution.Shared/js/mind-map-logic-workers.js +1004 -1004
  87. package/wwwroot/_content/MindExecution.Shared/js/mind-map-menu-manager.js +1351 -1351
  88. package/wwwroot/_content/MindExecution.Shared/js/mind-map-multi-select.js +865 -865
  89. package/wwwroot/_content/MindExecution.Shared/js/mind-map-node-search-worker.js +554 -554
  90. package/wwwroot/_content/MindExecution.Shared/js/mind-map-nodes.js +4744 -4744
  91. package/wwwroot/_content/MindExecution.Shared/js/mind-map-normal-boundary-optimizer.js +624 -624
  92. package/wwwroot/_content/MindExecution.Shared/js/mind-map-object-manager.js +241 -241
  93. package/wwwroot/_content/MindExecution.Shared/js/mind-map-pipeline.js +2290 -2290
  94. package/wwwroot/_content/MindExecution.Shared/js/mind-map-remote-codecs.js +202 -202
  95. package/wwwroot/_content/MindExecution.Shared/js/mind-map-render-plan.js +1971 -1971
  96. package/wwwroot/_content/MindExecution.Shared/js/mind-map-text-lod-system.js +93 -93
  97. package/wwwroot/_content/MindExecution.Shared/js/mind-map-texture-factory.js +2391 -2391
  98. package/wwwroot/_content/MindExecution.Shared/js/mind-map-video-playback-controls.js +95 -95
  99. package/wwwroot/_content/MindExecution.Shared/js/mind-map-visibility-worker.js +895 -895
  100. package/wwwroot/_content/MindExecution.Shared/js/mindmap-toolbar.js +636 -636
  101. package/wwwroot/_content/MindExecution.Shared/js/native-drop-handler.js +45 -45
  102. package/wwwroot/_content/MindExecution.Shared/js/plan-master.js +117 -117
  103. package/wwwroot/_content/MindExecution.Shared/js/renderers/CSS3DRenderer.js +114 -114
  104. package/wwwroot/_content/MindExecution.Shared/js/texture-worker-manager.js +10 -10
  105. package/wwwroot/_content/MindExecution.Shared/js/three.min.js +6 -6
  106. package/wwwroot/_content/MindExecution.Shared/js/token-manager.js +7 -7
  107. package/wwwroot/_content/MindExecution.Shared/js/troika-bundle.js +6 -6
  108. package/wwwroot/_content/MindExecution.Shared/js/troika-bundle.js.map +2 -2
  109. package/wwwroot/_content/MindExecution.Shared/lib/font-awesome/css/all.min.css +8 -8
  110. package/wwwroot/_content/MindExecution.Shared/models/vocab.txt +30522 -30522
  111. package/wwwroot/_framework/{Google.Protobuf.9h59ukbel7.dll → Google.Protobuf.33g2gb5is0.dll} +0 -0
  112. package/wwwroot/_framework/{MindExecution.Core.ty1xewqp36.dll → MindExecution.Core.z100xo4mg0.dll} +0 -0
  113. package/wwwroot/_framework/{MindExecution.Kernel.h7rqjoo69o.dll → MindExecution.Kernel.i9cldrx8yc.dll} +0 -0
  114. package/wwwroot/_framework/{MindExecution.Plugins.Admin.wrfrcvhjde.dll → MindExecution.Plugins.Admin.48lzqddb0a.dll} +0 -0
  115. package/wwwroot/_framework/{MindExecution.Plugins.Business.csbcyjurdh.dll → MindExecution.Plugins.Business.7m8u1q142p.dll} +0 -0
  116. package/wwwroot/_framework/{MindExecution.Plugins.Concept.buomiysqjn.dll → MindExecution.Plugins.Concept.cl5wmr53od.dll} +0 -0
  117. package/wwwroot/_framework/{MindExecution.Plugins.Directory.7k00i2v769.dll → MindExecution.Plugins.Directory.slipi39041.dll} +0 -0
  118. package/wwwroot/_framework/{MindExecution.Plugins.PlanMaster.85i5ocraro.dll → MindExecution.Plugins.PlanMaster.qfge05l671.dll} +0 -0
  119. package/wwwroot/_framework/{MindExecution.Plugins.YouTube.nbolrfakte.dll → MindExecution.Plugins.YouTube.tn7v29ut77.dll} +0 -0
  120. package/wwwroot/_framework/{MindExecution.Shared.nqh4porv7x.dll → MindExecution.Shared.rjqlf0umjn.dll} +0 -0
  121. package/wwwroot/_framework/{MindExecution.Web.211q3bf4mr.dll → MindExecution.Web.rwawrxxk38.dll} +0 -0
  122. package/wwwroot/_framework/blazor.boot.json +23 -23
  123. package/wwwroot/_headers +40 -40
  124. package/wwwroot/_redirects +1 -1
  125. package/wwwroot/index.html +772 -772
  126. package/wwwroot/js/marketing-tool.js +180 -180
  127. package/wwwroot/manifest.webmanifest +23 -23
  128. package/wwwroot/service-worker-assets.js +78 -106
  129. package/wwwroot/service-worker.js +33 -33
  130. package/tree-sitter-grammars/README.md +0 -18
  131. package/tree-sitter-grammars/tree-sitter-c_sharp.wasm +0 -0
  132. package/tree-sitter-grammars/tree-sitter-go.wasm +0 -0
  133. package/tree-sitter-grammars/tree-sitter-java.wasm +0 -0
  134. package/tree-sitter-grammars/tree-sitter-javascript.wasm +0 -0
  135. package/tree-sitter-grammars/tree-sitter-python.wasm +0 -0
  136. package/tree-sitter-grammars/tree-sitter-rust.wasm +0 -0
  137. package/tree-sitter-grammars/tree-sitter-tsx.wasm +0 -0
  138. package/tree-sitter-grammars/tree-sitter-typescript.wasm +0 -0
  139. package/wwwroot/_content/MindExecution.Plugins.Directory/background.png +0 -0
  140. package/wwwroot/_content/MindExecution.Shared/fonts/NotoSansKR-Bold.ttf +0 -0
  141. package/wwwroot/_content/MindExecution.Shared/fonts/NotoSansKR-Regular.ttf +0 -0
  142. package/wwwroot/_content/MindExecution.Shared/js/mind-map-core.js.backup +0 -1059
  143. package/wwwroot/_content/MindExecution.Shared/js/mind-map-dnd.js.bak +0 -434
  144. package/wwwroot/_content/MindExecution.Shared/js/mind-map-object-manager.js.backup +0 -372
  145. package/wwwroot/_content/MindExecution.Shared/js/mind-map-texture-factory.js.backup +0 -1258
@@ -1,43 +1,43 @@
1
- import assert from 'node:assert/strict';
2
- import path from 'node:path';
3
- import { fileURLToPath } from 'node:url';
4
- import { createCodexRuntime, resolveCodexRuntimeHome } from '../codex-runtime.js';
5
-
6
- if (!process.argv.includes('--live')) {
7
- console.log(JSON.stringify({ ok: true, liveImage: false }));
8
- process.exit(0);
9
- }
10
-
11
- const scriptDir = path.dirname(fileURLToPath(import.meta.url));
12
- const packageRoot = path.resolve(scriptDir, '..');
13
- const workspaceRoot = path.resolve(packageRoot, '..');
14
- const runtime = createCodexRuntime({
15
- packageRoot,
16
- resolveWorkingDirectory: async () => workspaceRoot,
17
- getCurrentRuntime: () => ({}),
18
- getModelCatalog: async () => ({ models: [], source: 'live-smoke', updatedAt: new Date().toISOString() }),
19
- log: () => {}
20
- });
21
-
22
- const result = await runtime.runImage({
23
- prompt: 'Create a clean square test image with one solid blue circle centered on a white background. No text.',
24
- size: '1024x1024',
25
- quality: 'low'
26
- });
27
-
28
- assert.equal(result.success, true, result.error);
29
- assert.equal(result.providerKind, 'TypeScriptSdk');
30
- assert.equal(result.authenticationRequired, false);
31
- assert.equal(result.loginOpened, false, 'The existing Codex login should be reused without opening sign-in.');
32
- assert.ok(result.imageBase64.length > 1000, 'The live SDK image result was unexpectedly small.');
33
- assert.match(result.mimeType, /^image\//);
34
-
35
- console.log(JSON.stringify({
36
- ok: true,
37
- liveImage: true,
38
- providerKind: result.providerKind,
39
- sharedCodexHome: resolveCodexRuntimeHome(),
40
- loginOpened: result.loginOpened,
41
- mimeType: result.mimeType,
42
- imageBytesApprox: Math.floor(result.imageBase64.length * 0.75)
43
- }));
1
+ import assert from 'node:assert/strict';
2
+ import path from 'node:path';
3
+ import { fileURLToPath } from 'node:url';
4
+ import { createCodexRuntime, resolveCodexRuntimeHome } from '../codex-runtime.js';
5
+
6
+ if (!process.argv.includes('--live')) {
7
+ console.log(JSON.stringify({ ok: true, liveImage: false }));
8
+ process.exit(0);
9
+ }
10
+
11
+ const scriptDir = path.dirname(fileURLToPath(import.meta.url));
12
+ const packageRoot = path.resolve(scriptDir, '..');
13
+ const workspaceRoot = path.resolve(packageRoot, '..');
14
+ const runtime = createCodexRuntime({
15
+ packageRoot,
16
+ resolveWorkingDirectory: async () => workspaceRoot,
17
+ getCurrentRuntime: () => ({}),
18
+ getModelCatalog: async () => ({ models: [], source: 'live-smoke', updatedAt: new Date().toISOString() }),
19
+ log: () => {}
20
+ });
21
+
22
+ const result = await runtime.runImage({
23
+ prompt: 'Create a clean square test image with one solid blue circle centered on a white background. No text.',
24
+ size: '1024x1024',
25
+ quality: 'low'
26
+ });
27
+
28
+ assert.equal(result.success, true, result.error);
29
+ assert.equal(result.providerKind, 'TypeScriptSdk');
30
+ assert.equal(result.authenticationRequired, false);
31
+ assert.equal(result.loginOpened, false, 'The existing Codex login should be reused without opening sign-in.');
32
+ assert.ok(result.imageBase64.length > 1000, 'The live SDK image result was unexpectedly small.');
33
+ assert.match(result.mimeType, /^image\//);
34
+
35
+ console.log(JSON.stringify({
36
+ ok: true,
37
+ liveImage: true,
38
+ providerKind: result.providerKind,
39
+ sharedCodexHome: resolveCodexRuntimeHome(),
40
+ loginOpened: result.loginOpened,
41
+ mimeType: result.mimeType,
42
+ imageBytesApprox: Math.floor(result.imageBase64.length * 0.75)
43
+ }));
@@ -1,122 +1,122 @@
1
- import assert from 'node:assert/strict';
2
- import { promises as fs } from 'node:fs';
3
- import os from 'node:os';
4
- import path from 'node:path';
5
- import { fileURLToPath } from 'node:url';
6
- import { createCodexRuntime } from '../codex-runtime.js';
7
-
8
- const scriptDir = path.dirname(fileURLToPath(import.meta.url));
9
- const packageRoot = path.resolve(scriptDir, '..');
10
- const workspaceRoot = path.resolve(packageRoot, '..');
11
- const runtimeHome = await fs.mkdtemp(path.join(os.tmpdir(), 'mindexec-codex-sdk-image-'));
12
- const tinyPngBase64 = 'iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP8/x8AAwMCAO+jX8kAAAAASUVORK5CYII=';
13
-
14
- function imageEvents() {
15
- return (async function* generateEvents() {
16
- yield { type: 'thread.started', thread_id: 'thread-image-smoke' };
17
- yield {
18
- type: 'event_msg',
19
- payload: {
20
- type: 'image_generation_end',
21
- result: `data:image/png;base64,${tinyPngBase64}`
22
- }
23
- };
24
- yield { type: 'turn.completed' };
25
- })();
26
- }
27
-
28
- function createFakeSdk(runStreamed, captures) {
29
- return {
30
- Codex: class FakeCodex {
31
- constructor(options) {
32
- captures.codexOptions.push(options);
33
- }
34
-
35
- startThread(options) {
36
- captures.threadOptions.push(options);
37
- return {
38
- runStreamed: async input => {
39
- captures.inputs.push(input);
40
- return { events: runStreamed() };
41
- }
42
- };
43
- }
44
- }
45
- };
46
- }
47
-
48
- function createRuntime(fakeSdk, loginCodex) {
49
- return createCodexRuntime({
50
- packageRoot,
51
- resolveWorkingDirectory: async () => workspaceRoot,
52
- getCurrentRuntime: () => ({}),
53
- getModelCatalog: async () => ({ models: [], source: 'smoke', updatedAt: new Date().toISOString() }),
54
- loadCodexSdk: async () => fakeSdk,
55
- ensureCodexRuntimeHome: async () => {
56
- await fs.mkdir(path.join(runtimeHome, 'generated_images'), { recursive: true });
57
- return runtimeHome;
58
- },
59
- buildCodexChildEnv: () => ({ CODEX_HOME: runtimeHome }),
60
- loginCodex,
61
- log: () => {}
62
- });
63
- }
64
-
65
- try {
66
- const captures = { codexOptions: [], threadOptions: [], inputs: [] };
67
- const runtime = createRuntime(createFakeSdk(imageEvents, captures), async () => {
68
- throw new Error('Login must not run for an authenticated image request.');
69
- });
70
- const generated = await runtime.runImage({
71
- prompt: 'Create a blue product icon.',
72
- model: 'gpt-5.5',
73
- size: '1024x1024',
74
- quality: 'high',
75
- referenceImages: [{ base64: tinyPngBase64, mimeType: 'image/png', fileName: 'source.png' }]
76
- });
77
-
78
- assert.equal(generated.success, true, generated.error);
79
- assert.equal(generated.providerKind, 'TypeScriptSdk');
80
- assert.equal(generated.imageBase64, tinyPngBase64);
81
- assert.equal(generated.mimeType, 'image/png');
82
- assert.equal(captures.codexOptions[0].config.features.image_generation, true);
83
- assert.deepEqual(captures.codexOptions[0].config.mcp_servers, {});
84
- assert.equal(captures.threadOptions[0].sandboxMode, 'read-only');
85
- assert.equal(captures.inputs[0][0].type, 'text');
86
- assert.equal(captures.inputs[0][1].type, 'local_image');
87
- assert.equal(await fs.stat(captures.inputs[0][1].path).then(() => true).catch(() => false), false);
88
-
89
- let attempts = 0;
90
- let loginCount = 0;
91
- const authCaptures = { codexOptions: [], threadOptions: [], inputs: [] };
92
- const authSdk = createFakeSdk(() => {
93
- attempts += 1;
94
- if (attempts === 1) {
95
- return (async function* invalidAuth() {
96
- throw new Error('401 Unauthorized: invalid_refresh_token. Please log out and sign in again.');
97
- })();
98
- }
99
- return imageEvents();
100
- }, authCaptures);
101
- const authRuntime = createRuntime(authSdk, async () => {
102
- loginCount += 1;
103
- return { success: true, exitCode: 0 };
104
- });
105
- const retried = await authRuntime.runImage({ prompt: 'Create one test image.' });
106
-
107
- assert.equal(loginCount, 1);
108
- assert.equal(attempts, 2);
109
- assert.equal(retried.success, true, retried.error);
110
- assert.equal(retried.loginOpened, true);
111
- assert.equal(retried.authenticationRequired, false);
112
- assert.equal(retried.providerKind, 'TypeScriptSdk');
113
-
114
- console.log(JSON.stringify({
115
- ok: true,
116
- providerKind: generated.providerKind,
117
- referenceAttachment: true,
118
- browserLoginRetry: true
119
- }));
120
- } finally {
121
- await fs.rm(runtimeHome, { recursive: true, force: true });
122
- }
1
+ import assert from 'node:assert/strict';
2
+ import { promises as fs } from 'node:fs';
3
+ import os from 'node:os';
4
+ import path from 'node:path';
5
+ import { fileURLToPath } from 'node:url';
6
+ import { createCodexRuntime } from '../codex-runtime.js';
7
+
8
+ const scriptDir = path.dirname(fileURLToPath(import.meta.url));
9
+ const packageRoot = path.resolve(scriptDir, '..');
10
+ const workspaceRoot = path.resolve(packageRoot, '..');
11
+ const runtimeHome = await fs.mkdtemp(path.join(os.tmpdir(), 'mindexec-codex-sdk-image-'));
12
+ const tinyPngBase64 = 'iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP8/x8AAwMCAO+jX8kAAAAASUVORK5CYII=';
13
+
14
+ function imageEvents() {
15
+ return (async function* generateEvents() {
16
+ yield { type: 'thread.started', thread_id: 'thread-image-smoke' };
17
+ yield {
18
+ type: 'event_msg',
19
+ payload: {
20
+ type: 'image_generation_end',
21
+ result: `data:image/png;base64,${tinyPngBase64}`
22
+ }
23
+ };
24
+ yield { type: 'turn.completed' };
25
+ })();
26
+ }
27
+
28
+ function createFakeSdk(runStreamed, captures) {
29
+ return {
30
+ Codex: class FakeCodex {
31
+ constructor(options) {
32
+ captures.codexOptions.push(options);
33
+ }
34
+
35
+ startThread(options) {
36
+ captures.threadOptions.push(options);
37
+ return {
38
+ runStreamed: async input => {
39
+ captures.inputs.push(input);
40
+ return { events: runStreamed() };
41
+ }
42
+ };
43
+ }
44
+ }
45
+ };
46
+ }
47
+
48
+ function createRuntime(fakeSdk, loginCodex) {
49
+ return createCodexRuntime({
50
+ packageRoot,
51
+ resolveWorkingDirectory: async () => workspaceRoot,
52
+ getCurrentRuntime: () => ({}),
53
+ getModelCatalog: async () => ({ models: [], source: 'smoke', updatedAt: new Date().toISOString() }),
54
+ loadCodexSdk: async () => fakeSdk,
55
+ ensureCodexRuntimeHome: async () => {
56
+ await fs.mkdir(path.join(runtimeHome, 'generated_images'), { recursive: true });
57
+ return runtimeHome;
58
+ },
59
+ buildCodexChildEnv: () => ({ CODEX_HOME: runtimeHome }),
60
+ loginCodex,
61
+ log: () => {}
62
+ });
63
+ }
64
+
65
+ try {
66
+ const captures = { codexOptions: [], threadOptions: [], inputs: [] };
67
+ const runtime = createRuntime(createFakeSdk(imageEvents, captures), async () => {
68
+ throw new Error('Login must not run for an authenticated image request.');
69
+ });
70
+ const generated = await runtime.runImage({
71
+ prompt: 'Create a blue product icon.',
72
+ model: 'gpt-5.5',
73
+ size: '1024x1024',
74
+ quality: 'high',
75
+ referenceImages: [{ base64: tinyPngBase64, mimeType: 'image/png', fileName: 'source.png' }]
76
+ });
77
+
78
+ assert.equal(generated.success, true, generated.error);
79
+ assert.equal(generated.providerKind, 'TypeScriptSdk');
80
+ assert.equal(generated.imageBase64, tinyPngBase64);
81
+ assert.equal(generated.mimeType, 'image/png');
82
+ assert.equal(captures.codexOptions[0].config.features.image_generation, true);
83
+ assert.deepEqual(captures.codexOptions[0].config.mcp_servers, {});
84
+ assert.equal(captures.threadOptions[0].sandboxMode, 'read-only');
85
+ assert.equal(captures.inputs[0][0].type, 'text');
86
+ assert.equal(captures.inputs[0][1].type, 'local_image');
87
+ assert.equal(await fs.stat(captures.inputs[0][1].path).then(() => true).catch(() => false), false);
88
+
89
+ let attempts = 0;
90
+ let loginCount = 0;
91
+ const authCaptures = { codexOptions: [], threadOptions: [], inputs: [] };
92
+ const authSdk = createFakeSdk(() => {
93
+ attempts += 1;
94
+ if (attempts === 1) {
95
+ return (async function* invalidAuth() {
96
+ throw new Error('401 Unauthorized: invalid_refresh_token. Please log out and sign in again.');
97
+ })();
98
+ }
99
+ return imageEvents();
100
+ }, authCaptures);
101
+ const authRuntime = createRuntime(authSdk, async () => {
102
+ loginCount += 1;
103
+ return { success: true, exitCode: 0 };
104
+ });
105
+ const retried = await authRuntime.runImage({ prompt: 'Create one test image.' });
106
+
107
+ assert.equal(loginCount, 1);
108
+ assert.equal(attempts, 2);
109
+ assert.equal(retried.success, true, retried.error);
110
+ assert.equal(retried.loginOpened, true);
111
+ assert.equal(retried.authenticationRequired, false);
112
+ assert.equal(retried.providerKind, 'TypeScriptSdk');
113
+
114
+ console.log(JSON.stringify({
115
+ ok: true,
116
+ providerKind: generated.providerKind,
117
+ referenceAttachment: true,
118
+ browserLoginRetry: true
119
+ }));
120
+ } finally {
121
+ await fs.rm(runtimeHome, { recursive: true, force: true });
122
+ }
@@ -1,89 +1,89 @@
1
- import assert from 'node:assert/strict';
2
- import path from 'node:path';
3
- import { fileURLToPath } from 'node:url';
4
- import { createCodexRuntime } from '../codex-runtime.js';
5
-
6
- const scriptDir = path.dirname(fileURLToPath(import.meta.url));
7
- const packageRoot = path.resolve(scriptDir, '..');
8
- const workspaceRoot = path.resolve(packageRoot, '..');
9
- const runLiveTurn = process.argv.includes('--live');
10
- const runLiveTools = process.argv.includes('--live-tools');
11
-
12
- const runtime = createCodexRuntime({
13
- packageRoot,
14
- resolveWorkingDirectory: async () => workspaceRoot,
15
- getCurrentRuntime: () => ({}),
16
- getModelCatalog: async () => ({
17
- models: [],
18
- source: 'smoke',
19
- updatedAt: new Date().toISOString()
20
- }),
21
- log: () => {}
22
- });
23
-
24
- const capabilities = await runtime.getCapabilities();
25
- const sdkProvider = capabilities.providers.find(provider => provider.kind === 'TypeScriptSdk');
26
- assert.equal(sdkProvider?.available, true, sdkProvider?.error || 'Codex TypeScript SDK must be available.');
27
- assert.equal(capabilities.preferredProviderKind, 'TypeScriptSdk');
28
-
29
- const started = await runtime.startThread({
30
- providerKind: 'TypeScriptSdk',
31
- prompt: 'smoke',
32
- workingDir: workspaceRoot,
33
- sandbox: 'read_only',
34
- approvalPolicy: 'on-request',
35
- networkAccessEnabled: true,
36
- webSearchMode: 'live'
37
- });
38
- assert.equal(started.success, true);
39
- assert.equal(started.providerKind, 'TypeScriptSdk');
40
-
41
- const status = runtime.getThreadStatus(started.threadId);
42
- assert.equal(status.providerKind, 'TypeScriptSdk');
43
- assert.equal(status.options.sandboxMode, 'read_only');
44
- assert.equal(status.options.networkAccessEnabled, true);
45
- assert.equal(status.options.webSearchMode, 'live');
46
-
47
- if (runLiveTurn) {
48
- const marker = `CODEX_SDK_RUNTIME_OK_${Date.now()}`;
49
- const result = await runtime.runThread({
50
- providerKind: 'TypeScriptSdk',
51
- prompt: `Return exactly this marker and nothing else: ${marker}`,
52
- workingDir: workspaceRoot,
53
- sandbox: 'read_only',
54
- approvalPolicy: 'on-request',
55
- networkAccessEnabled: false,
56
- webSearchMode: 'disabled'
57
- });
58
-
59
- assert.equal(result.providerKind, 'TypeScriptSdk');
60
- assert.equal(result.success, true, result.error || 'Codex SDK live turn failed.');
61
- assert.match(result.finalResponse, new RegExp(marker));
62
- }
63
-
64
- if (runLiveTools) {
65
- const result = await runtime.runThread({
66
- providerKind: 'TypeScriptSdk',
67
- prompt: 'Use the built-in web search tool to find the title of the official OpenAI Codex SDK documentation page. Return the title and its source URL.',
68
- workingDir: workspaceRoot,
69
- sandbox: 'read_only',
70
- approvalPolicy: 'on-request',
71
- networkAccessEnabled: true,
72
- webSearchMode: 'live'
73
- });
74
-
75
- assert.equal(result.providerKind, 'TypeScriptSdk');
76
- assert.equal(result.success, true, result.error || 'Codex SDK live tool turn failed.');
77
- assert.equal(
78
- result.toolEvents.some(event => event.type === 'web_search'),
79
- true,
80
- `Expected a web_search tool event, got: ${JSON.stringify(result.toolEvents)}`);
81
- }
82
-
83
- console.log(JSON.stringify({
84
- ok: true,
85
- providerKind: capabilities.preferredProviderKind,
86
- sdkVersion: sdkProvider?.version || null,
87
- liveTurn: runLiveTurn,
88
- liveTools: runLiveTools
89
- }));
1
+ import assert from 'node:assert/strict';
2
+ import path from 'node:path';
3
+ import { fileURLToPath } from 'node:url';
4
+ import { createCodexRuntime } from '../codex-runtime.js';
5
+
6
+ const scriptDir = path.dirname(fileURLToPath(import.meta.url));
7
+ const packageRoot = path.resolve(scriptDir, '..');
8
+ const workspaceRoot = path.resolve(packageRoot, '..');
9
+ const runLiveTurn = process.argv.includes('--live');
10
+ const runLiveTools = process.argv.includes('--live-tools');
11
+
12
+ const runtime = createCodexRuntime({
13
+ packageRoot,
14
+ resolveWorkingDirectory: async () => workspaceRoot,
15
+ getCurrentRuntime: () => ({}),
16
+ getModelCatalog: async () => ({
17
+ models: [],
18
+ source: 'smoke',
19
+ updatedAt: new Date().toISOString()
20
+ }),
21
+ log: () => {}
22
+ });
23
+
24
+ const capabilities = await runtime.getCapabilities();
25
+ const sdkProvider = capabilities.providers.find(provider => provider.kind === 'TypeScriptSdk');
26
+ assert.equal(sdkProvider?.available, true, sdkProvider?.error || 'Codex TypeScript SDK must be available.');
27
+ assert.equal(capabilities.preferredProviderKind, 'TypeScriptSdk');
28
+
29
+ const started = await runtime.startThread({
30
+ providerKind: 'TypeScriptSdk',
31
+ prompt: 'smoke',
32
+ workingDir: workspaceRoot,
33
+ sandbox: 'read_only',
34
+ approvalPolicy: 'on-request',
35
+ networkAccessEnabled: true,
36
+ webSearchMode: 'live'
37
+ });
38
+ assert.equal(started.success, true);
39
+ assert.equal(started.providerKind, 'TypeScriptSdk');
40
+
41
+ const status = runtime.getThreadStatus(started.threadId);
42
+ assert.equal(status.providerKind, 'TypeScriptSdk');
43
+ assert.equal(status.options.sandboxMode, 'read_only');
44
+ assert.equal(status.options.networkAccessEnabled, true);
45
+ assert.equal(status.options.webSearchMode, 'live');
46
+
47
+ if (runLiveTurn) {
48
+ const marker = `CODEX_SDK_RUNTIME_OK_${Date.now()}`;
49
+ const result = await runtime.runThread({
50
+ providerKind: 'TypeScriptSdk',
51
+ prompt: `Return exactly this marker and nothing else: ${marker}`,
52
+ workingDir: workspaceRoot,
53
+ sandbox: 'read_only',
54
+ approvalPolicy: 'on-request',
55
+ networkAccessEnabled: false,
56
+ webSearchMode: 'disabled'
57
+ });
58
+
59
+ assert.equal(result.providerKind, 'TypeScriptSdk');
60
+ assert.equal(result.success, true, result.error || 'Codex SDK live turn failed.');
61
+ assert.match(result.finalResponse, new RegExp(marker));
62
+ }
63
+
64
+ if (runLiveTools) {
65
+ const result = await runtime.runThread({
66
+ providerKind: 'TypeScriptSdk',
67
+ prompt: 'Use the built-in web search tool to find the title of the official OpenAI Codex SDK documentation page. Return the title and its source URL.',
68
+ workingDir: workspaceRoot,
69
+ sandbox: 'read_only',
70
+ approvalPolicy: 'on-request',
71
+ networkAccessEnabled: true,
72
+ webSearchMode: 'live'
73
+ });
74
+
75
+ assert.equal(result.providerKind, 'TypeScriptSdk');
76
+ assert.equal(result.success, true, result.error || 'Codex SDK live tool turn failed.');
77
+ assert.equal(
78
+ result.toolEvents.some(event => event.type === 'web_search'),
79
+ true,
80
+ `Expected a web_search tool event, got: ${JSON.stringify(result.toolEvents)}`);
81
+ }
82
+
83
+ console.log(JSON.stringify({
84
+ ok: true,
85
+ providerKind: capabilities.preferredProviderKind,
86
+ sdkVersion: sdkProvider?.version || null,
87
+ liveTurn: runLiveTurn,
88
+ liveTools: runLiveTools
89
+ }));