@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.
- package/README.md +323 -323
- package/codex-model-catalog.js +202 -202
- package/codex-runtime.js +1608 -1608
- package/desktop-workspace-state.cjs +120 -120
- package/electron/main.cjs +517 -517
- package/electron/preload.cjs +17 -17
- package/electron/recurring-update-owner-smoke.mjs +55 -55
- package/electron/recurring-update-owner.cjs +97 -97
- package/electron/source-smoke.mjs +108 -108
- package/electron/update-feed-resolver.cjs +79 -79
- package/electron/update-feed.json +10 -10
- package/electron/update-manager-smoke.mjs +146 -146
- package/electron/update-manager.cjs +297 -297
- package/electron/windows-package-smoke.mjs +156 -156
- package/launch-bridge.cjs +236 -236
- package/lzo1x.js +110 -110
- package/mode4-atlas-worker.js +440 -440
- package/mode4-atlas.js +130 -130
- package/package.json +1 -1
- package/port-guard.cjs +285 -285
- package/remote-fast/osx-arm64/MacScreenCaptureKitH264.swift +339 -339
- package/remote-fast/osx-arm64/MacSystemAudioCapture.swift +214 -214
- package/remote-fast/osx-arm64/UnixRawCaptureHelper.mjs +80 -80
- package/remote-fast/osx-arm64/livedesk-raw-capture-resampler.mjs +73 -73
- package/remote-fast/osx-arm64/mindexec-remote-fast.dll +0 -0
- package/remote-fast/osx-x64/MacScreenCaptureKitH264.swift +339 -339
- package/remote-fast/osx-x64/MacSystemAudioCapture.swift +214 -214
- package/remote-fast/osx-x64/UnixRawCaptureHelper.mjs +80 -80
- package/remote-fast/osx-x64/livedesk-raw-capture-resampler.mjs +73 -73
- package/remote-fast/osx-x64/mindexec-remote-fast.dll +0 -0
- package/remote-fast/win-x64/mindexec-remote-fast.dll +0 -0
- package/remote-hub.js +3698 -3698
- package/scripts/auth-session-smoke.mjs +262 -262
- package/scripts/board-render-ownership-smoke.mjs +85 -85
- package/scripts/codex-model-catalog-smoke.mjs +150 -150
- package/scripts/codex-runtime-home-smoke.mjs +58 -58
- package/scripts/codex-sdk-image-live-smoke.mjs +43 -43
- package/scripts/codex-sdk-image-runtime-smoke.mjs +122 -122
- package/scripts/codex-sdk-runtime-smoke.mjs +89 -89
- package/scripts/desktop-update-publisher-smoke.mjs +89 -89
- package/scripts/desktop-update-worker-smoke.mjs +72 -72
- package/scripts/desktop-workspace-state-smoke.mjs +81 -81
- package/scripts/drive-installed-update-smoke.mjs +67 -67
- package/scripts/npm-fresh-install-smoke.mjs +216 -216
- package/scripts/publish-mindexec-desktop-updates.mjs +224 -224
- package/scripts/remote-agent-managed-smoke.mjs +318 -318
- package/scripts/remote-agent-package-smoke.mjs +64 -64
- package/scripts/remote-agent-ws-smoke.mjs +269 -269
- package/scripts/remote-fast-live-rate-smoke.mjs +343 -343
- package/scripts/remote-fast-mdm-browser-smoke.mjs +453 -453
- package/scripts/remote-fleet-render-smoke.mjs +1350 -1350
- package/scripts/remote-frame-ws-smoke.mjs +234 -234
- package/scripts/remote-http-smoke.mjs +592 -592
- package/scripts/remote-hub-identity-smoke.mjs +146 -146
- package/scripts/remote-hub-scale-smoke.mjs +124 -124
- package/scripts/remote-hub-smoke.mjs +699 -699
- package/scripts/remote-input-ws-smoke.mjs +263 -263
- package/scripts/remote-registry-follower-smoke.mjs +815 -815
- package/scripts/setup-tree-sitter-grammars.mjs +59 -59
- package/server.js +7690 -7690
- package/start-bridge.bat +32 -32
- package/start-bridge.sh +81 -81
- package/wwwroot/_content/MindExecution.Plugins.Admin/css/admin-dashboard.css +546 -546
- package/wwwroot/_content/MindExecution.Plugins.YouTube/css/youtube-search.css +251 -251
- package/wwwroot/_content/MindExecution.Shared/css/app.css +1 -1
- package/wwwroot/_content/MindExecution.Shared/css/mind-map-overrides.css +3789 -3789
- package/wwwroot/_content/MindExecution.Shared/js/agent-visualization.js +27 -27
- package/wwwroot/_content/MindExecution.Shared/js/background-themes.js +1449 -1449
- package/wwwroot/_content/MindExecution.Shared/js/code-master.js +8316 -8316
- package/wwwroot/_content/MindExecution.Shared/js/file-system-helper.js +338 -338
- package/wwwroot/_content/MindExecution.Shared/js/marked.min.js +69 -69
- package/wwwroot/_content/MindExecution.Shared/js/mind-map-animated-image-preview.js +270 -270
- package/wwwroot/_content/MindExecution.Shared/js/mind-map-automation-edge-motion.js +170 -170
- package/wwwroot/_content/MindExecution.Shared/js/mind-map-board-render-ownership.js +81 -81
- package/wwwroot/_content/MindExecution.Shared/js/mind-map-core.js +10506 -10506
- package/wwwroot/_content/MindExecution.Shared/js/mind-map-css3d-hotpath.js +902 -902
- package/wwwroot/_content/MindExecution.Shared/js/mind-map-css3d-manager.js +24637 -24637
- package/wwwroot/_content/MindExecution.Shared/js/mind-map-dev-guards.js +325 -325
- package/wwwroot/_content/MindExecution.Shared/js/mind-map-dnd.js +1491 -1491
- package/wwwroot/_content/MindExecution.Shared/js/mind-map-glow-shader.js +70 -70
- package/wwwroot/_content/MindExecution.Shared/js/mind-map-image-policy.js +218 -218
- package/wwwroot/_content/MindExecution.Shared/js/mind-map-interactions.js +7065 -7065
- package/wwwroot/_content/MindExecution.Shared/js/mind-map-lod-plan-worker.js +160 -160
- package/wwwroot/_content/MindExecution.Shared/js/mind-map-lod-renderer.js +9956 -9956
- package/wwwroot/_content/MindExecution.Shared/js/mind-map-lod-video-placeholder.js +107 -107
- package/wwwroot/_content/MindExecution.Shared/js/mind-map-logic-workers.js +1004 -1004
- package/wwwroot/_content/MindExecution.Shared/js/mind-map-menu-manager.js +1351 -1351
- package/wwwroot/_content/MindExecution.Shared/js/mind-map-multi-select.js +865 -865
- package/wwwroot/_content/MindExecution.Shared/js/mind-map-node-search-worker.js +554 -554
- package/wwwroot/_content/MindExecution.Shared/js/mind-map-nodes.js +4744 -4744
- package/wwwroot/_content/MindExecution.Shared/js/mind-map-normal-boundary-optimizer.js +624 -624
- package/wwwroot/_content/MindExecution.Shared/js/mind-map-object-manager.js +241 -241
- package/wwwroot/_content/MindExecution.Shared/js/mind-map-pipeline.js +2290 -2290
- package/wwwroot/_content/MindExecution.Shared/js/mind-map-remote-codecs.js +202 -202
- package/wwwroot/_content/MindExecution.Shared/js/mind-map-render-plan.js +1971 -1971
- package/wwwroot/_content/MindExecution.Shared/js/mind-map-text-lod-system.js +93 -93
- package/wwwroot/_content/MindExecution.Shared/js/mind-map-texture-factory.js +2391 -2391
- package/wwwroot/_content/MindExecution.Shared/js/mind-map-video-playback-controls.js +95 -95
- package/wwwroot/_content/MindExecution.Shared/js/mind-map-visibility-worker.js +895 -895
- package/wwwroot/_content/MindExecution.Shared/js/mindmap-toolbar.js +636 -636
- package/wwwroot/_content/MindExecution.Shared/js/native-drop-handler.js +45 -45
- package/wwwroot/_content/MindExecution.Shared/js/plan-master.js +117 -117
- package/wwwroot/_content/MindExecution.Shared/js/renderers/CSS3DRenderer.js +114 -114
- package/wwwroot/_content/MindExecution.Shared/js/texture-worker-manager.js +10 -10
- package/wwwroot/_content/MindExecution.Shared/js/three.min.js +6 -6
- package/wwwroot/_content/MindExecution.Shared/js/token-manager.js +7 -7
- package/wwwroot/_content/MindExecution.Shared/js/troika-bundle.js +6 -6
- package/wwwroot/_content/MindExecution.Shared/js/troika-bundle.js.map +2 -2
- package/wwwroot/_content/MindExecution.Shared/lib/font-awesome/css/all.min.css +8 -8
- package/wwwroot/_content/MindExecution.Shared/models/vocab.txt +30522 -30522
- package/wwwroot/_framework/{Google.Protobuf.9h59ukbel7.dll → Google.Protobuf.33g2gb5is0.dll} +0 -0
- package/wwwroot/_framework/{MindExecution.Core.ty1xewqp36.dll → MindExecution.Core.z100xo4mg0.dll} +0 -0
- package/wwwroot/_framework/{MindExecution.Kernel.h7rqjoo69o.dll → MindExecution.Kernel.i9cldrx8yc.dll} +0 -0
- package/wwwroot/_framework/{MindExecution.Plugins.Admin.wrfrcvhjde.dll → MindExecution.Plugins.Admin.48lzqddb0a.dll} +0 -0
- package/wwwroot/_framework/{MindExecution.Plugins.Business.csbcyjurdh.dll → MindExecution.Plugins.Business.7m8u1q142p.dll} +0 -0
- package/wwwroot/_framework/{MindExecution.Plugins.Concept.buomiysqjn.dll → MindExecution.Plugins.Concept.cl5wmr53od.dll} +0 -0
- package/wwwroot/_framework/{MindExecution.Plugins.Directory.7k00i2v769.dll → MindExecution.Plugins.Directory.slipi39041.dll} +0 -0
- package/wwwroot/_framework/{MindExecution.Plugins.PlanMaster.85i5ocraro.dll → MindExecution.Plugins.PlanMaster.qfge05l671.dll} +0 -0
- package/wwwroot/_framework/{MindExecution.Plugins.YouTube.nbolrfakte.dll → MindExecution.Plugins.YouTube.tn7v29ut77.dll} +0 -0
- package/wwwroot/_framework/{MindExecution.Shared.nqh4porv7x.dll → MindExecution.Shared.rjqlf0umjn.dll} +0 -0
- package/wwwroot/_framework/{MindExecution.Web.211q3bf4mr.dll → MindExecution.Web.rwawrxxk38.dll} +0 -0
- package/wwwroot/_framework/blazor.boot.json +23 -23
- package/wwwroot/_headers +40 -40
- package/wwwroot/_redirects +1 -1
- package/wwwroot/index.html +772 -772
- package/wwwroot/js/marketing-tool.js +180 -180
- package/wwwroot/manifest.webmanifest +23 -23
- package/wwwroot/service-worker-assets.js +78 -106
- package/wwwroot/service-worker.js +33 -33
- package/tree-sitter-grammars/README.md +0 -18
- package/tree-sitter-grammars/tree-sitter-c_sharp.wasm +0 -0
- package/tree-sitter-grammars/tree-sitter-go.wasm +0 -0
- package/tree-sitter-grammars/tree-sitter-java.wasm +0 -0
- package/tree-sitter-grammars/tree-sitter-javascript.wasm +0 -0
- package/tree-sitter-grammars/tree-sitter-python.wasm +0 -0
- package/tree-sitter-grammars/tree-sitter-rust.wasm +0 -0
- package/tree-sitter-grammars/tree-sitter-tsx.wasm +0 -0
- package/tree-sitter-grammars/tree-sitter-typescript.wasm +0 -0
- package/wwwroot/_content/MindExecution.Plugins.Directory/background.png +0 -0
- package/wwwroot/_content/MindExecution.Shared/fonts/NotoSansKR-Bold.ttf +0 -0
- package/wwwroot/_content/MindExecution.Shared/fonts/NotoSansKR-Regular.ttf +0 -0
- package/wwwroot/_content/MindExecution.Shared/js/mind-map-core.js.backup +0 -1059
- package/wwwroot/_content/MindExecution.Shared/js/mind-map-dnd.js.bak +0 -434
- package/wwwroot/_content/MindExecution.Shared/js/mind-map-object-manager.js.backup +0 -372
- 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
|
+
}));
|