flockbay 0.10.49 → 0.10.52
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 +60 -60
- package/bin/flockbay-mcp.mjs +62 -62
- package/bin/flockbay.mjs +95 -95
- package/dist/{index-r3VTdgFI.cjs → index-IntvnrmZ.cjs} +71 -14
- package/dist/{index-D8AeVbvv.mjs → index-wkeSi0iC.mjs} +70 -13
- package/dist/index.cjs +2 -2
- package/dist/index.mjs +2 -2
- package/dist/lib.cjs +1 -1
- package/dist/lib.mjs +1 -1
- package/dist/{migratePlugin-CEvGPul8.mjs → migratePlugin-C71hAoc5.mjs} +12 -2
- package/dist/{migratePlugin-wFK-k3Wk.cjs → migratePlugin-D1XjjWFq.cjs} +12 -2
- package/dist/{runCodex-DuyuYqoB.cjs → runCodex-B7i_ICoQ.cjs} +34 -23
- package/dist/{runCodex-ZfUyhHF6.mjs → runCodex-BSx-hCu6.mjs} +34 -23
- package/dist/{runGemini-DBU1mMdp.mjs → runGemini-Dwyh7_WI.mjs} +2 -2
- package/dist/{runGemini-D7j5Y5TF.cjs → runGemini-gBKR3rdL.cjs} +2 -2
- package/dist/{types-DNr0xwSy.cjs → types-5z8UADAi.cjs} +224 -15
- package/dist/{types-BRJuZQj_.mjs → types-Bgzap7qR.mjs} +224 -16
- package/package.json +131 -131
- package/scripts/claude_local_launcher.cjs +72 -72
- package/scripts/claude_remote_launcher.cjs +15 -15
- package/scripts/claude_version_utils.cjs +445 -445
- package/scripts/ripgrep_launcher.cjs +32 -32
- package/scripts/run-with-root-env.mjs +37 -32
- package/scripts/session_hook_forwarder.cjs +49 -49
- package/scripts/test-codex-abort-history.mjs +77 -77
- package/scripts/unpack-tools.cjs +244 -244
- package/tools/licenses/difftastic-LICENSE +21 -21
- package/tools/licenses/ripgrep-LICENSE +3 -3
- package/tools/unreal-mcp/UPSTREAM_VERSION.md +8 -8
- package/tools/unreal-mcp/upstream/Docs/README.md +8 -8
- package/tools/unreal-mcp/upstream/Docs/Tools/README.md +6 -6
- package/tools/unreal-mcp/upstream/Docs/Tools/actor_tools.md +183 -183
- package/tools/unreal-mcp/upstream/Docs/Tools/blueprint_tools.md +268 -268
- package/tools/unreal-mcp/upstream/Docs/Tools/editor_tools.md +104 -104
- package/tools/unreal-mcp/upstream/Docs/Tools/node_tools.md +274 -274
- package/tools/unreal-mcp/upstream/MCPGameProject/Plugins/FlockbayMCP/Config/FilterPlugin.ini +8 -8
- package/tools/unreal-mcp/upstream/MCPGameProject/Plugins/FlockbayMCP/FlockbayMCP.uplugin +36 -36
- package/tools/unreal-mcp/upstream/MCPGameProject/Plugins/FlockbayMCP/Source/FlockbayMCP/FlockbayMCP.Build.cs +82 -82
- package/tools/unreal-mcp/upstream/MCPGameProject/Plugins/FlockbayMCP/Source/FlockbayMCP/Private/Commands/UnrealMCPBlueprintCommands.cpp +1364 -1364
- package/tools/unreal-mcp/upstream/MCPGameProject/Plugins/FlockbayMCP/Source/FlockbayMCP/Private/Commands/UnrealMCPBlueprintNodeCommands.cpp +1310 -1310
- package/tools/unreal-mcp/upstream/MCPGameProject/Plugins/FlockbayMCP/Source/FlockbayMCP/Private/Commands/UnrealMCPCommandSchema.cpp +756 -756
- package/tools/unreal-mcp/upstream/MCPGameProject/Plugins/FlockbayMCP/Source/FlockbayMCP/Private/Commands/UnrealMCPCommonUtils.cpp +1177 -1177
- package/tools/unreal-mcp/upstream/MCPGameProject/Plugins/FlockbayMCP/Source/FlockbayMCP/Private/Commands/UnrealMCPEditorCommands.cpp +2618 -2618
- package/tools/unreal-mcp/upstream/MCPGameProject/Plugins/FlockbayMCP/Source/FlockbayMCP/Private/Commands/UnrealMCPProjectCommands.cpp +71 -71
- package/tools/unreal-mcp/upstream/MCPGameProject/Plugins/FlockbayMCP/Source/FlockbayMCP/Private/Commands/UnrealMCPUMGCommands.cpp +543 -543
- package/tools/unreal-mcp/upstream/MCPGameProject/Plugins/FlockbayMCP/Source/FlockbayMCP/Private/MCPServerRunnable.cpp +372 -372
- package/tools/unreal-mcp/upstream/MCPGameProject/Plugins/FlockbayMCP/Source/FlockbayMCP/Private/UnrealMCPBridge.cpp +457 -457
- package/tools/unreal-mcp/upstream/MCPGameProject/Plugins/FlockbayMCP/Source/FlockbayMCP/Private/UnrealMCPModule.cpp +21 -21
- package/tools/unreal-mcp/upstream/MCPGameProject/Plugins/FlockbayMCP/Source/FlockbayMCP/Public/Commands/UnrealMCPBlueprintCommands.h +35 -35
- package/tools/unreal-mcp/upstream/MCPGameProject/Plugins/FlockbayMCP/Source/FlockbayMCP/Public/Commands/UnrealMCPBlueprintNodeCommands.h +30 -30
- package/tools/unreal-mcp/upstream/MCPGameProject/Plugins/FlockbayMCP/Source/FlockbayMCP/Public/Commands/UnrealMCPCommandSchema.h +41 -41
- package/tools/unreal-mcp/upstream/MCPGameProject/Plugins/FlockbayMCP/Source/FlockbayMCP/Public/Commands/UnrealMCPCommonUtils.h +59 -59
- package/tools/unreal-mcp/upstream/MCPGameProject/Plugins/FlockbayMCP/Source/FlockbayMCP/Public/Commands/UnrealMCPEditorCommands.h +61 -61
- package/tools/unreal-mcp/upstream/MCPGameProject/Plugins/FlockbayMCP/Source/FlockbayMCP/Public/Commands/UnrealMCPProjectCommands.h +20 -20
- package/tools/unreal-mcp/upstream/MCPGameProject/Plugins/FlockbayMCP/Source/FlockbayMCP/Public/Commands/UnrealMCPUMGCommands.h +82 -82
- package/tools/unreal-mcp/upstream/MCPGameProject/Plugins/FlockbayMCP/Source/FlockbayMCP/Public/MCPServerRunnable.h +33 -33
- package/tools/unreal-mcp/upstream/MCPGameProject/Plugins/FlockbayMCP/Source/FlockbayMCP/Public/UnrealMCPBridge.h +64 -64
- package/tools/unreal-mcp/upstream/MCPGameProject/Plugins/FlockbayMCP/Source/FlockbayMCP/Public/UnrealMCPModule.h +22 -22
- package/tools/unreal-mcp/upstream/Python/README.md +39 -39
- package/tools/unreal-mcp/upstream/Python/pyproject.toml +22 -22
- package/tools/unreal-mcp/upstream/Python/scripts/actors/test_cube.py +202 -202
- package/tools/unreal-mcp/upstream/Python/scripts/blueprints/test_create_and_spawn_blueprints_with_different_components.py +496 -496
- package/tools/unreal-mcp/upstream/Python/scripts/blueprints/test_create_and_spawn_cube_blueprint.py +193 -193
- package/tools/unreal-mcp/upstream/Python/scripts/node/test_component_reference.py +266 -266
- package/tools/unreal-mcp/upstream/Python/scripts/node/test_create_bird_blueprint_with_input_and_camera.py +617 -617
- package/tools/unreal-mcp/upstream/Python/scripts/node/test_input_mapping.py +365 -365
- package/tools/unreal-mcp/upstream/Python/scripts/node/test_physics_variables.py +389 -389
- package/tools/unreal-mcp/upstream/Python/tools/blueprint_tools.py +419 -419
- package/tools/unreal-mcp/upstream/Python/tools/editor_tools.py +369 -369
- package/tools/unreal-mcp/upstream/Python/tools/node_tools.py +429 -429
- package/tools/unreal-mcp/upstream/Python/tools/project_tools.py +63 -63
- package/tools/unreal-mcp/upstream/Python/tools/umg_tools.py +332 -332
- package/tools/unreal-mcp/upstream/Python/unreal_mcp_server.py +398 -398
- package/tools/unreal-mcp/upstream/Python/uv.lock +521 -521
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Ripgrep runner - executed as a subprocess to run the native module
|
|
5
|
-
* This file is intentionally written in CommonJS to avoid ESM complexities
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
const path = require('path');
|
|
9
|
-
|
|
10
|
-
// Load the native module from unpacked directory
|
|
11
|
-
const modulePath = path.join(__dirname, '..', 'tools', 'unpacked', 'ripgrep.node');
|
|
12
|
-
const ripgrepNative = require(modulePath);
|
|
13
|
-
|
|
14
|
-
// Get arguments from command line (skip node and script name)
|
|
15
|
-
const args = process.argv.slice(2);
|
|
16
|
-
|
|
17
|
-
// Parse the JSON-encoded arguments
|
|
18
|
-
let parsedArgs;
|
|
19
|
-
try {
|
|
20
|
-
parsedArgs = JSON.parse(args[0]);
|
|
21
|
-
} catch (error) {
|
|
22
|
-
console.error('Failed to parse arguments:', error.message);
|
|
23
|
-
process.exit(1);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
// Run ripgrep
|
|
27
|
-
try {
|
|
28
|
-
const exitCode = ripgrepNative.ripgrepMain(parsedArgs);
|
|
29
|
-
process.exit(exitCode);
|
|
30
|
-
} catch (error) {
|
|
31
|
-
console.error('Ripgrep error:', error.message);
|
|
32
|
-
process.exit(1);
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Ripgrep runner - executed as a subprocess to run the native module
|
|
5
|
+
* This file is intentionally written in CommonJS to avoid ESM complexities
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
const path = require('path');
|
|
9
|
+
|
|
10
|
+
// Load the native module from unpacked directory
|
|
11
|
+
const modulePath = path.join(__dirname, '..', 'tools', 'unpacked', 'ripgrep.node');
|
|
12
|
+
const ripgrepNative = require(modulePath);
|
|
13
|
+
|
|
14
|
+
// Get arguments from command line (skip node and script name)
|
|
15
|
+
const args = process.argv.slice(2);
|
|
16
|
+
|
|
17
|
+
// Parse the JSON-encoded arguments
|
|
18
|
+
let parsedArgs;
|
|
19
|
+
try {
|
|
20
|
+
parsedArgs = JSON.parse(args[0]);
|
|
21
|
+
} catch (error) {
|
|
22
|
+
console.error('Failed to parse arguments:', error.message);
|
|
23
|
+
process.exit(1);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
// Run ripgrep
|
|
27
|
+
try {
|
|
28
|
+
const exitCode = ripgrepNative.ripgrepMain(parsedArgs);
|
|
29
|
+
process.exit(exitCode);
|
|
30
|
+
} catch (error) {
|
|
31
|
+
console.error('Ripgrep error:', error.message);
|
|
32
|
+
process.exit(1);
|
|
33
33
|
}
|
|
@@ -1,36 +1,36 @@
|
|
|
1
|
-
import { spawn } from 'node:child_process';
|
|
2
1
|
import fs from 'node:fs';
|
|
3
2
|
import path from 'node:path';
|
|
4
3
|
import process from 'node:process';
|
|
4
|
+
import spawn from 'cross-spawn';
|
|
5
5
|
import dotenv from 'dotenv';
|
|
6
|
-
|
|
7
|
-
function loadRootEnv() {
|
|
8
|
-
const rootEnvPath = path.resolve(process.cwd(), '..', '.env.local');
|
|
9
|
-
if (!fs.existsSync(rootEnvPath)) return;
|
|
10
|
-
|
|
11
|
-
const parsed = dotenv.parse(fs.readFileSync(rootEnvPath));
|
|
12
|
-
for (const [key, value] of Object.entries(parsed)) {
|
|
13
|
-
if (process.env[key] == null || process.env[key] === '') process.env[key] = value;
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
function requireEnv(name) {
|
|
18
|
-
const v = process.env[name];
|
|
19
|
-
if (typeof v !== 'string' || v.trim() === '') {
|
|
20
|
-
console.error(`[run-with-root-env] Missing required env var: ${name}`);
|
|
21
|
-
console.error('[run-with-root-env] Expected it in your shell env or in ../.env.local.');
|
|
22
|
-
process.exit(1);
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
function main() {
|
|
27
|
-
const [, , command, ...args] = process.argv;
|
|
28
|
-
if (!command) {
|
|
29
|
-
console.error('Usage: node scripts/run-with-root-env.mjs <command> [...args]');
|
|
30
|
-
process.exit(2);
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
loadRootEnv();
|
|
6
|
+
|
|
7
|
+
function loadRootEnv() {
|
|
8
|
+
const rootEnvPath = path.resolve(process.cwd(), '..', '.env.local');
|
|
9
|
+
if (!fs.existsSync(rootEnvPath)) return;
|
|
10
|
+
|
|
11
|
+
const parsed = dotenv.parse(fs.readFileSync(rootEnvPath));
|
|
12
|
+
for (const [key, value] of Object.entries(parsed)) {
|
|
13
|
+
if (process.env[key] == null || process.env[key] === '') process.env[key] = value;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function requireEnv(name) {
|
|
18
|
+
const v = process.env[name];
|
|
19
|
+
if (typeof v !== 'string' || v.trim() === '') {
|
|
20
|
+
console.error(`[run-with-root-env] Missing required env var: ${name}`);
|
|
21
|
+
console.error('[run-with-root-env] Expected it in your shell env or in ../.env.local.');
|
|
22
|
+
process.exit(1);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function main() {
|
|
27
|
+
const [, , command, ...args] = process.argv;
|
|
28
|
+
if (!command) {
|
|
29
|
+
console.error('Usage: node scripts/run-with-root-env.mjs <command> [...args]');
|
|
30
|
+
process.exit(2);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
loadRootEnv();
|
|
34
34
|
requireEnv('NODE_AUTH_TOKEN');
|
|
35
35
|
|
|
36
36
|
const child = spawn(command, args, {
|
|
@@ -38,11 +38,16 @@ function main() {
|
|
|
38
38
|
env: process.env,
|
|
39
39
|
});
|
|
40
40
|
|
|
41
|
+
child.on('error', (err) => {
|
|
42
|
+
console.error(`[run-with-root-env] Failed to spawn "${command}": ${err?.message ?? String(err)}`);
|
|
43
|
+
process.exit(1);
|
|
44
|
+
});
|
|
45
|
+
|
|
41
46
|
child.on('exit', (code, signal) => {
|
|
42
47
|
if (typeof code === 'number') process.exit(code);
|
|
43
48
|
process.exit(signal ? 1 : 0);
|
|
44
49
|
});
|
|
45
50
|
}
|
|
46
|
-
|
|
47
|
-
main();
|
|
48
|
-
|
|
51
|
+
|
|
52
|
+
main();
|
|
53
|
+
|
|
@@ -1,49 +1,49 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
/**
|
|
3
|
-
* Session Hook Forwarder
|
|
4
|
-
*
|
|
5
|
-
* This script is executed by Claude's SessionStart hook.
|
|
6
|
-
* It reads JSON data from stdin and forwards it to Flockbay's hook server.
|
|
7
|
-
*
|
|
8
|
-
* Usage: echo '{"session_id":"..."}' | node session_hook_forwarder.cjs <port>
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
const http = require('http');
|
|
12
|
-
|
|
13
|
-
const port = parseInt(process.argv[2], 10);
|
|
14
|
-
|
|
15
|
-
if (!port || isNaN(port)) {
|
|
16
|
-
process.exit(1);
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
const chunks = [];
|
|
20
|
-
|
|
21
|
-
process.stdin.on('data', (chunk) => {
|
|
22
|
-
chunks.push(chunk);
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
process.stdin.on('end', () => {
|
|
26
|
-
const body = Buffer.concat(chunks);
|
|
27
|
-
|
|
28
|
-
const req = http.request({
|
|
29
|
-
host: '127.0.0.1',
|
|
30
|
-
port: port,
|
|
31
|
-
method: 'POST',
|
|
32
|
-
path: '/hook/session-start',
|
|
33
|
-
headers: {
|
|
34
|
-
'Content-Type': 'application/json',
|
|
35
|
-
'Content-Length': body.length
|
|
36
|
-
}
|
|
37
|
-
}, (res) => {
|
|
38
|
-
res.resume(); // Drain response
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
req.on('error', (error) => {
|
|
42
|
-
// Don't throw (this runs inside Claude hooks), but don't mask failures either.
|
|
43
|
-
console.error('[session_hook_forwarder] Failed to forward session-start hook:', error?.message || error);
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
req.end(body);
|
|
47
|
-
});
|
|
48
|
-
|
|
49
|
-
process.stdin.resume();
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Session Hook Forwarder
|
|
4
|
+
*
|
|
5
|
+
* This script is executed by Claude's SessionStart hook.
|
|
6
|
+
* It reads JSON data from stdin and forwards it to Flockbay's hook server.
|
|
7
|
+
*
|
|
8
|
+
* Usage: echo '{"session_id":"..."}' | node session_hook_forwarder.cjs <port>
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
const http = require('http');
|
|
12
|
+
|
|
13
|
+
const port = parseInt(process.argv[2], 10);
|
|
14
|
+
|
|
15
|
+
if (!port || isNaN(port)) {
|
|
16
|
+
process.exit(1);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const chunks = [];
|
|
20
|
+
|
|
21
|
+
process.stdin.on('data', (chunk) => {
|
|
22
|
+
chunks.push(chunk);
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
process.stdin.on('end', () => {
|
|
26
|
+
const body = Buffer.concat(chunks);
|
|
27
|
+
|
|
28
|
+
const req = http.request({
|
|
29
|
+
host: '127.0.0.1',
|
|
30
|
+
port: port,
|
|
31
|
+
method: 'POST',
|
|
32
|
+
path: '/hook/session-start',
|
|
33
|
+
headers: {
|
|
34
|
+
'Content-Type': 'application/json',
|
|
35
|
+
'Content-Length': body.length
|
|
36
|
+
}
|
|
37
|
+
}, (res) => {
|
|
38
|
+
res.resume(); // Drain response
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
req.on('error', (error) => {
|
|
42
|
+
// Don't throw (this runs inside Claude hooks), but don't mask failures either.
|
|
43
|
+
console.error('[session_hook_forwarder] Failed to forward session-start hook:', error?.message || error);
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
req.end(body);
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
process.stdin.resume();
|
|
@@ -1,77 +1,77 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import { randomUUID } from 'node:crypto';
|
|
3
|
-
import { setTimeout as delay } from 'node:timers/promises';
|
|
4
|
-
|
|
5
|
-
// Minimal, optional integration check (uses local `codex` CLI via MCP).
|
|
6
|
-
// Goal: verify that an abort does NOT force a new Codex session / lose context.
|
|
7
|
-
//
|
|
8
|
-
// Usage:
|
|
9
|
-
// node flockbay-cli/scripts/test-codex-abort-history.mjs
|
|
10
|
-
// ABORT_DELAY_MS=50 node flockbay-cli/scripts/test-codex-abort-history.mjs
|
|
11
|
-
//
|
|
12
|
-
// Exits:
|
|
13
|
-
// 0 on pass
|
|
14
|
-
// 1 on fail
|
|
15
|
-
|
|
16
|
-
const ABORT_DELAY_MS = Number(process.env.ABORT_DELAY_MS || 50);
|
|
17
|
-
|
|
18
|
-
function extractText(res) {
|
|
19
|
-
const items = Array.isArray(res?.content) ? res.content : [];
|
|
20
|
-
return items
|
|
21
|
-
.map((x) => (x && x.type === 'text' ? x.text : ''))
|
|
22
|
-
.filter(Boolean)
|
|
23
|
-
.join('\n');
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
async function main() {
|
|
27
|
-
const { CodexMcpClient } = await import('../dist/codex/codexMcpClient.cjs');
|
|
28
|
-
|
|
29
|
-
const client = new CodexMcpClient();
|
|
30
|
-
await client.connect();
|
|
31
|
-
|
|
32
|
-
const seed = `Remember these three items for this chat, and respond with ONLY the word: ack\n- green apple\n- red horse\n- purple giraffe\n\nRun id: ${randomUUID()}`;
|
|
33
|
-
await client.startSession({
|
|
34
|
-
prompt: seed,
|
|
35
|
-
sandbox: 'workspace-write',
|
|
36
|
-
'approval-policy': 'untrusted',
|
|
37
|
-
config: {},
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
// Fire a request and abort it quickly (tries to exercise the abort path).
|
|
41
|
-
const abortController = new AbortController();
|
|
42
|
-
const inflight = client.continueSession(
|
|
43
|
-
`Write 2000 words about the three items (this is intentionally long).`,
|
|
44
|
-
{ signal: abortController.signal },
|
|
45
|
-
);
|
|
46
|
-
|
|
47
|
-
await delay(ABORT_DELAY_MS);
|
|
48
|
-
abortController.abort();
|
|
49
|
-
|
|
50
|
-
try {
|
|
51
|
-
await inflight;
|
|
52
|
-
} catch {
|
|
53
|
-
// Expected: abort cancels the in-flight request.
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
const recall = await client.startSession({
|
|
57
|
-
prompt: `List the three items you were asked to remember. Reply in 3 bullet points only.`,
|
|
58
|
-
config: {},
|
|
59
|
-
});
|
|
60
|
-
|
|
61
|
-
const text = extractText(recall).toLowerCase();
|
|
62
|
-
const ok = text.includes('green') && text.includes('red') && text.includes('purple');
|
|
63
|
-
if (!ok) {
|
|
64
|
-
console.error('FAIL: missing expected recall terms');
|
|
65
|
-
console.error(text);
|
|
66
|
-
process.exit(1);
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
console.log('PASS');
|
|
70
|
-
process.exit(0);
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
main().catch((err) => {
|
|
74
|
-
console.error('FAIL:', err?.stack || err?.message || String(err));
|
|
75
|
-
process.exit(1);
|
|
76
|
-
});
|
|
77
|
-
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { randomUUID } from 'node:crypto';
|
|
3
|
+
import { setTimeout as delay } from 'node:timers/promises';
|
|
4
|
+
|
|
5
|
+
// Minimal, optional integration check (uses local `codex` CLI via MCP).
|
|
6
|
+
// Goal: verify that an abort does NOT force a new Codex session / lose context.
|
|
7
|
+
//
|
|
8
|
+
// Usage:
|
|
9
|
+
// node flockbay-cli/scripts/test-codex-abort-history.mjs
|
|
10
|
+
// ABORT_DELAY_MS=50 node flockbay-cli/scripts/test-codex-abort-history.mjs
|
|
11
|
+
//
|
|
12
|
+
// Exits:
|
|
13
|
+
// 0 on pass
|
|
14
|
+
// 1 on fail
|
|
15
|
+
|
|
16
|
+
const ABORT_DELAY_MS = Number(process.env.ABORT_DELAY_MS || 50);
|
|
17
|
+
|
|
18
|
+
function extractText(res) {
|
|
19
|
+
const items = Array.isArray(res?.content) ? res.content : [];
|
|
20
|
+
return items
|
|
21
|
+
.map((x) => (x && x.type === 'text' ? x.text : ''))
|
|
22
|
+
.filter(Boolean)
|
|
23
|
+
.join('\n');
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
async function main() {
|
|
27
|
+
const { CodexMcpClient } = await import('../dist/codex/codexMcpClient.cjs');
|
|
28
|
+
|
|
29
|
+
const client = new CodexMcpClient();
|
|
30
|
+
await client.connect();
|
|
31
|
+
|
|
32
|
+
const seed = `Remember these three items for this chat, and respond with ONLY the word: ack\n- green apple\n- red horse\n- purple giraffe\n\nRun id: ${randomUUID()}`;
|
|
33
|
+
await client.startSession({
|
|
34
|
+
prompt: seed,
|
|
35
|
+
sandbox: 'workspace-write',
|
|
36
|
+
'approval-policy': 'untrusted',
|
|
37
|
+
config: {},
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
// Fire a request and abort it quickly (tries to exercise the abort path).
|
|
41
|
+
const abortController = new AbortController();
|
|
42
|
+
const inflight = client.continueSession(
|
|
43
|
+
`Write 2000 words about the three items (this is intentionally long).`,
|
|
44
|
+
{ signal: abortController.signal },
|
|
45
|
+
);
|
|
46
|
+
|
|
47
|
+
await delay(ABORT_DELAY_MS);
|
|
48
|
+
abortController.abort();
|
|
49
|
+
|
|
50
|
+
try {
|
|
51
|
+
await inflight;
|
|
52
|
+
} catch {
|
|
53
|
+
// Expected: abort cancels the in-flight request.
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
const recall = await client.startSession({
|
|
57
|
+
prompt: `List the three items you were asked to remember. Reply in 3 bullet points only.`,
|
|
58
|
+
config: {},
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
const text = extractText(recall).toLowerCase();
|
|
62
|
+
const ok = text.includes('green') && text.includes('red') && text.includes('purple');
|
|
63
|
+
if (!ok) {
|
|
64
|
+
console.error('FAIL: missing expected recall terms');
|
|
65
|
+
console.error(text);
|
|
66
|
+
process.exit(1);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
console.log('PASS');
|
|
70
|
+
process.exit(0);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
main().catch((err) => {
|
|
74
|
+
console.error('FAIL:', err?.stack || err?.message || String(err));
|
|
75
|
+
process.exit(1);
|
|
76
|
+
});
|
|
77
|
+
|