grok-bot-cli 0.5.0 → 0.6.0
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/CHANGELOG.md +7 -0
- package/README.md +84 -7
- package/dist/.claude-plugin/marketplace.json +1 -1
- package/dist/.claude-plugin/plugin.json +1 -1
- package/dist/.codex-plugin/plugin.json +1 -1
- package/dist/.cursor-plugin/marketplace.json +1 -1
- package/dist/.cursor-plugin/plugin.json +1 -1
- package/dist/INSTALL.md +2 -2
- package/dist/README.md +84 -7
- package/dist/agent-bundle.compile-evidence.json +1 -1
- package/dist/agent-bundle.manifest.json +1 -1
- package/dist/bin/gbot-flight.mjs +2617 -329
- package/dist/bin/gbot.mjs +2987 -303
- package/dist/install.mjs +1 -1
- package/dist/mcp/mcp-grok-bot-b8c2461e-flight.mjs +6763 -2343
- package/dist/mcp/mcp-grok-bot-b8c2461e.mjs +4292 -81
- package/dist/package.json +2 -2
- package/dist/plugin.json +1 -1
- package/dist/scripts/gbot-relay.mjs +61013 -0
- package/dist/skills/talk-to-grok-bot/SKILL.md +67 -5
- package/package.json +2 -2
package/dist/bin/gbot.mjs
CHANGED
|
@@ -5,11 +5,11 @@ import * as __rspack_external_node_child_process_cd435d64 from "node:child_proce
|
|
|
5
5
|
import * as __rspack_external_node_crypto_2e7c4b46 from "node:crypto";
|
|
6
6
|
import * as __rspack_external_node_fs_1b05aee1 from "node:fs";
|
|
7
7
|
import * as __rspack_external_node_fs_promises_3b710708 from "node:fs/promises";
|
|
8
|
-
import * as __rspack_external_node_module_9de3fa2f from "node:module";
|
|
9
8
|
import * as __rspack_external_node_net_5ed819e1 from "node:net";
|
|
10
9
|
import * as __rspack_external_node_os_4f3c9d58 from "node:os";
|
|
11
10
|
import * as __rspack_external_node_path_806ed179 from "node:path";
|
|
12
11
|
import * as __rspack_external_node_readline_d8f53bef from "node:readline";
|
|
12
|
+
import * as __rspack_external_node_string_decoder_69b9bd04 from "node:string_decoder";
|
|
13
13
|
import * as __rspack_external_node_url_3991086a from "node:url";
|
|
14
14
|
import * as __rspack_external_node_worker_threads_28ca7740 from "node:worker_threads";
|
|
15
15
|
import { createRequire as __rspack_createRequire } from "node:module";
|
|
@@ -11456,6 +11456,376 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
11456
11456
|
});
|
|
11457
11457
|
|
|
11458
11458
|
|
|
11459
|
+
},
|
|
11460
|
+
"./src/cli/codex/bridge/respond.tsx"(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
11461
|
+
__webpack_require__.r(__webpack_exports__);
|
|
11462
|
+
/* import */ var react_jsx_runtime__rspack_import_0 = __webpack_require__("./node_modules/react/jsx-runtime.js");
|
|
11463
|
+
/* import */ var _agent_bundle_runtime__rspack_import_3 = __webpack_require__("./node_modules/@agent-bundle/runtime/dist/736.js");
|
|
11464
|
+
/* import */ var _agent_bundle_runtime__rspack_import_4 = __webpack_require__("./node_modules/@agent-bundle/runtime/dist/506.js");
|
|
11465
|
+
/* import */ var _core_relay_routes_js__rspack_import_1 = __webpack_require__("./src/core/relay/routes.ts");
|
|
11466
|
+
/* import */ var _core_codex_contract_js__rspack_import_2 = __webpack_require__("./src/core/codex/contract.js");
|
|
11467
|
+
|
|
11468
|
+
|
|
11469
|
+
|
|
11470
|
+
|
|
11471
|
+
|
|
11472
|
+
const config = {
|
|
11473
|
+
description: 'Managed Grok/Codex bridge respond.',
|
|
11474
|
+
exitCode: 'result',
|
|
11475
|
+
inputJsonSchema: {
|
|
11476
|
+
type: 'object',
|
|
11477
|
+
properties: {
|
|
11478
|
+
interactionId: {
|
|
11479
|
+
type: 'string'
|
|
11480
|
+
},
|
|
11481
|
+
generation: {
|
|
11482
|
+
type: 'string'
|
|
11483
|
+
},
|
|
11484
|
+
threadId: {
|
|
11485
|
+
type: 'string'
|
|
11486
|
+
},
|
|
11487
|
+
turnId: {
|
|
11488
|
+
type: 'string'
|
|
11489
|
+
},
|
|
11490
|
+
bindingId: {
|
|
11491
|
+
type: 'string'
|
|
11492
|
+
},
|
|
11493
|
+
exchangeId: {
|
|
11494
|
+
type: 'string'
|
|
11495
|
+
},
|
|
11496
|
+
decision: {
|
|
11497
|
+
type: 'string',
|
|
11498
|
+
enum: [
|
|
11499
|
+
'accept',
|
|
11500
|
+
'decline',
|
|
11501
|
+
'cancel'
|
|
11502
|
+
]
|
|
11503
|
+
},
|
|
11504
|
+
answersJson: {
|
|
11505
|
+
type: 'string',
|
|
11506
|
+
description: 'JSON object mapping each advertised question ID to {"answers":["answer"]}; exact IDs required.'
|
|
11507
|
+
}
|
|
11508
|
+
},
|
|
11509
|
+
required: [
|
|
11510
|
+
'interactionId',
|
|
11511
|
+
'generation',
|
|
11512
|
+
'threadId',
|
|
11513
|
+
'turnId'
|
|
11514
|
+
],
|
|
11515
|
+
additionalProperties: false
|
|
11516
|
+
}
|
|
11517
|
+
};
|
|
11518
|
+
async function route({ input }) {
|
|
11519
|
+
let out;
|
|
11520
|
+
try {
|
|
11521
|
+
out = {
|
|
11522
|
+
...await (0,_core_relay_routes_js__rspack_import_1/* .bridgeOperation */.n1)('respond', input, await (0,_agent_bundle_runtime__rspack_import_3/* .agent */.MA)()),
|
|
11523
|
+
exitCode: 0
|
|
11524
|
+
};
|
|
11525
|
+
} catch (error) {
|
|
11526
|
+
out = (0,_core_codex_contract_js__rspack_import_2/* .outcomeFromError */.DG)(error);
|
|
11527
|
+
}
|
|
11528
|
+
return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_4/* .Agent.Result */.g6.Result, {
|
|
11529
|
+
value: out,
|
|
11530
|
+
children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_4/* .Agent.Text */.g6.Text, {
|
|
11531
|
+
children: JSON.stringify(out)
|
|
11532
|
+
})
|
|
11533
|
+
});
|
|
11534
|
+
}
|
|
11535
|
+
|
|
11536
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
11537
|
+
"default": () => (route),
|
|
11538
|
+
inputSchema: () => (/* reexport safe */ _core_relay_routes_js__rspack_import_1.v1),
|
|
11539
|
+
resultSchema: () => (/* reexport safe */ _core_relay_routes_js__rspack_import_1.Ax)
|
|
11540
|
+
}, {
|
|
11541
|
+
config: config
|
|
11542
|
+
});
|
|
11543
|
+
|
|
11544
|
+
|
|
11545
|
+
},
|
|
11546
|
+
"./src/cli/codex/bridge/run.tsx"(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
11547
|
+
__webpack_require__.r(__webpack_exports__);
|
|
11548
|
+
/* import */ var react_jsx_runtime__rspack_import_0 = __webpack_require__("./node_modules/react/jsx-runtime.js");
|
|
11549
|
+
/* import */ var _agent_bundle_runtime__rspack_import_4 = __webpack_require__("./node_modules/@agent-bundle/runtime/dist/736.js");
|
|
11550
|
+
/* import */ var _agent_bundle_runtime__rspack_import_5 = __webpack_require__("./node_modules/@agent-bundle/runtime/dist/506.js");
|
|
11551
|
+
/* import */ var node_child_process__rspack_import_1 = __webpack_require__("node:child_process");
|
|
11552
|
+
/* import */ var zod__rspack_import_3 = __webpack_require__("./node_modules/zod/v4/classic/schemas.js");
|
|
11553
|
+
/* import */ var _core_relay_managed_js__rspack_import_2 = __webpack_require__("./src/core/relay/managed.js");
|
|
11554
|
+
|
|
11555
|
+
|
|
11556
|
+
|
|
11557
|
+
|
|
11558
|
+
|
|
11559
|
+
const inputSchema = zod__rspack_import_3/* .object */.Ikc({
|
|
11560
|
+
lifetimeMs: zod__rspack_import_3/* .number */.aig().int().min(100).max(82800000).default(82800000)
|
|
11561
|
+
}).strict();
|
|
11562
|
+
const resultSchema = zod__rspack_import_3/* .object */.Ikc({
|
|
11563
|
+
state: zod__rspack_import_3/* .string */.YjP(),
|
|
11564
|
+
exitCode: zod__rspack_import_3/* .number */.aig()
|
|
11565
|
+
});
|
|
11566
|
+
const config = {
|
|
11567
|
+
description: 'Run a bounded foreground relay (up to 23 hours). Use the packaged gbot-relay.mjs script for unlimited service lifetime.',
|
|
11568
|
+
exitCode: 'result',
|
|
11569
|
+
render: {
|
|
11570
|
+
maxElapsedMs: 86400000
|
|
11571
|
+
},
|
|
11572
|
+
inputJsonSchema: {
|
|
11573
|
+
type: 'object',
|
|
11574
|
+
properties: {
|
|
11575
|
+
lifetimeMs: {
|
|
11576
|
+
type: 'number',
|
|
11577
|
+
description: 'Foreground lifetime in milliseconds (100..82800000; default 23h).'
|
|
11578
|
+
}
|
|
11579
|
+
},
|
|
11580
|
+
additionalProperties: false
|
|
11581
|
+
}
|
|
11582
|
+
};
|
|
11583
|
+
async function route({ signal, input }) {
|
|
11584
|
+
const context = await (0,_agent_bundle_runtime__rspack_import_4/* .agent */.MA)();
|
|
11585
|
+
const script = await (0,_core_relay_managed_js__rspack_import_2/* .resolveRelayWorker */._v)({
|
|
11586
|
+
pluginRoot: context.plugin.state === 'available' ? context.plugin.value.root : undefined
|
|
11587
|
+
});
|
|
11588
|
+
// The renderer may terminate immediately on abort. The separate worker can finish
|
|
11589
|
+
// asynchronous socket/ledger cleanup after the synchronous termination signal.
|
|
11590
|
+
const child = (0,node_child_process__rspack_import_1.spawn)(process.execPath, [
|
|
11591
|
+
script,
|
|
11592
|
+
'--lifetime-ms',
|
|
11593
|
+
String(input.lifetimeMs),
|
|
11594
|
+
'--parent-pid',
|
|
11595
|
+
String(process.pid)
|
|
11596
|
+
], {
|
|
11597
|
+
stdio: [
|
|
11598
|
+
'ignore',
|
|
11599
|
+
'ignore',
|
|
11600
|
+
'inherit'
|
|
11601
|
+
]
|
|
11602
|
+
});
|
|
11603
|
+
const stop = ()=>{
|
|
11604
|
+
child.kill('SIGTERM');
|
|
11605
|
+
};
|
|
11606
|
+
signal.addEventListener('abort', stop, {
|
|
11607
|
+
once: true
|
|
11608
|
+
});
|
|
11609
|
+
if (signal.aborted) stop();
|
|
11610
|
+
let exitCode;
|
|
11611
|
+
try {
|
|
11612
|
+
exitCode = await new Promise((resolve, reject)=>{
|
|
11613
|
+
child.once('error', reject);
|
|
11614
|
+
child.once('exit', (code)=>resolve(code ?? 1));
|
|
11615
|
+
});
|
|
11616
|
+
} finally{
|
|
11617
|
+
signal.removeEventListener('abort', stop);
|
|
11618
|
+
}
|
|
11619
|
+
return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_5/* .Agent.Result */.g6.Result, {
|
|
11620
|
+
value: {
|
|
11621
|
+
state: 'stopped',
|
|
11622
|
+
exitCode
|
|
11623
|
+
},
|
|
11624
|
+
children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_5/* .Agent.Text */.g6.Text, {
|
|
11625
|
+
children: "Relay worker stopped."
|
|
11626
|
+
})
|
|
11627
|
+
});
|
|
11628
|
+
}
|
|
11629
|
+
|
|
11630
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
11631
|
+
"default": () => (route)
|
|
11632
|
+
}, {
|
|
11633
|
+
config: config,
|
|
11634
|
+
inputSchema: inputSchema,
|
|
11635
|
+
resultSchema: resultSchema
|
|
11636
|
+
});
|
|
11637
|
+
|
|
11638
|
+
|
|
11639
|
+
},
|
|
11640
|
+
"./src/cli/codex/bridge/start.tsx"(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
11641
|
+
__webpack_require__.r(__webpack_exports__);
|
|
11642
|
+
/* import */ var react_jsx_runtime__rspack_import_0 = __webpack_require__("./node_modules/react/jsx-runtime.js");
|
|
11643
|
+
/* import */ var _agent_bundle_runtime__rspack_import_3 = __webpack_require__("./node_modules/@agent-bundle/runtime/dist/736.js");
|
|
11644
|
+
/* import */ var _agent_bundle_runtime__rspack_import_4 = __webpack_require__("./node_modules/@agent-bundle/runtime/dist/506.js");
|
|
11645
|
+
/* import */ var _core_relay_routes_js__rspack_import_1 = __webpack_require__("./src/core/relay/routes.ts");
|
|
11646
|
+
/* import */ var _core_codex_contract_js__rspack_import_2 = __webpack_require__("./src/core/codex/contract.js");
|
|
11647
|
+
|
|
11648
|
+
|
|
11649
|
+
|
|
11650
|
+
|
|
11651
|
+
|
|
11652
|
+
const config = {
|
|
11653
|
+
description: 'Managed Grok/Codex bridge start.',
|
|
11654
|
+
exitCode: 'result',
|
|
11655
|
+
positionals: [
|
|
11656
|
+
'grokTarget'
|
|
11657
|
+
],
|
|
11658
|
+
inputJsonSchema: {
|
|
11659
|
+
type: 'object',
|
|
11660
|
+
properties: {
|
|
11661
|
+
grokTarget: {
|
|
11662
|
+
type: 'string'
|
|
11663
|
+
},
|
|
11664
|
+
codexThreadId: {
|
|
11665
|
+
type: 'string'
|
|
11666
|
+
},
|
|
11667
|
+
expectedCwd: {
|
|
11668
|
+
type: 'string'
|
|
11669
|
+
},
|
|
11670
|
+
busyPolicy: {
|
|
11671
|
+
type: 'string',
|
|
11672
|
+
enum: [
|
|
11673
|
+
'steer',
|
|
11674
|
+
'reject'
|
|
11675
|
+
]
|
|
11676
|
+
},
|
|
11677
|
+
requestId: {
|
|
11678
|
+
type: 'string'
|
|
11679
|
+
}
|
|
11680
|
+
},
|
|
11681
|
+
required: [
|
|
11682
|
+
'grokTarget'
|
|
11683
|
+
],
|
|
11684
|
+
additionalProperties: false
|
|
11685
|
+
}
|
|
11686
|
+
};
|
|
11687
|
+
async function route({ input }) {
|
|
11688
|
+
let out;
|
|
11689
|
+
try {
|
|
11690
|
+
out = {
|
|
11691
|
+
...await (0,_core_relay_routes_js__rspack_import_1/* .bridgeOperation */.n1)('startBinding', input, await (0,_agent_bundle_runtime__rspack_import_3/* .agent */.MA)()),
|
|
11692
|
+
exitCode: 0
|
|
11693
|
+
};
|
|
11694
|
+
} catch (error) {
|
|
11695
|
+
out = (0,_core_codex_contract_js__rspack_import_2/* .outcomeFromError */.DG)(error);
|
|
11696
|
+
}
|
|
11697
|
+
return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_4/* .Agent.Result */.g6.Result, {
|
|
11698
|
+
value: out,
|
|
11699
|
+
children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_4/* .Agent.Text */.g6.Text, {
|
|
11700
|
+
children: JSON.stringify(out)
|
|
11701
|
+
})
|
|
11702
|
+
});
|
|
11703
|
+
}
|
|
11704
|
+
|
|
11705
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
11706
|
+
"default": () => (route),
|
|
11707
|
+
inputSchema: () => (/* reexport safe */ _core_relay_routes_js__rspack_import_1.xD),
|
|
11708
|
+
resultSchema: () => (/* reexport safe */ _core_relay_routes_js__rspack_import_1.Ax)
|
|
11709
|
+
}, {
|
|
11710
|
+
config: config
|
|
11711
|
+
});
|
|
11712
|
+
|
|
11713
|
+
|
|
11714
|
+
},
|
|
11715
|
+
"./src/cli/codex/bridge/status.tsx"(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
11716
|
+
__webpack_require__.r(__webpack_exports__);
|
|
11717
|
+
/* import */ var react_jsx_runtime__rspack_import_0 = __webpack_require__("./node_modules/react/jsx-runtime.js");
|
|
11718
|
+
/* import */ var _agent_bundle_runtime__rspack_import_3 = __webpack_require__("./node_modules/@agent-bundle/runtime/dist/736.js");
|
|
11719
|
+
/* import */ var _agent_bundle_runtime__rspack_import_4 = __webpack_require__("./node_modules/@agent-bundle/runtime/dist/506.js");
|
|
11720
|
+
/* import */ var _core_relay_routes_js__rspack_import_1 = __webpack_require__("./src/core/relay/routes.ts");
|
|
11721
|
+
/* import */ var _core_codex_contract_js__rspack_import_2 = __webpack_require__("./src/core/codex/contract.js");
|
|
11722
|
+
|
|
11723
|
+
|
|
11724
|
+
|
|
11725
|
+
|
|
11726
|
+
|
|
11727
|
+
const config = {
|
|
11728
|
+
description: 'Managed Grok/Codex bridge status.',
|
|
11729
|
+
exitCode: 'result',
|
|
11730
|
+
inputJsonSchema: {
|
|
11731
|
+
type: 'object',
|
|
11732
|
+
properties: {
|
|
11733
|
+
bindingId: {
|
|
11734
|
+
type: 'string'
|
|
11735
|
+
},
|
|
11736
|
+
limit: {
|
|
11737
|
+
type: 'number'
|
|
11738
|
+
}
|
|
11739
|
+
},
|
|
11740
|
+
additionalProperties: false
|
|
11741
|
+
}
|
|
11742
|
+
};
|
|
11743
|
+
async function route({ input }) {
|
|
11744
|
+
let out;
|
|
11745
|
+
try {
|
|
11746
|
+
out = {
|
|
11747
|
+
...await (0,_core_relay_routes_js__rspack_import_1/* .bridgeOperation */.n1)('status', input, await (0,_agent_bundle_runtime__rspack_import_3/* .agent */.MA)()),
|
|
11748
|
+
exitCode: 0
|
|
11749
|
+
};
|
|
11750
|
+
} catch (error) {
|
|
11751
|
+
out = (0,_core_codex_contract_js__rspack_import_2/* .outcomeFromError */.DG)(error);
|
|
11752
|
+
}
|
|
11753
|
+
return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_4/* .Agent.Result */.g6.Result, {
|
|
11754
|
+
value: out,
|
|
11755
|
+
children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_4/* .Agent.Text */.g6.Text, {
|
|
11756
|
+
children: JSON.stringify(out)
|
|
11757
|
+
})
|
|
11758
|
+
});
|
|
11759
|
+
}
|
|
11760
|
+
|
|
11761
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
11762
|
+
"default": () => (route),
|
|
11763
|
+
inputSchema: () => (/* reexport safe */ _core_relay_routes_js__rspack_import_1.np),
|
|
11764
|
+
resultSchema: () => (/* reexport safe */ _core_relay_routes_js__rspack_import_1.Ax)
|
|
11765
|
+
}, {
|
|
11766
|
+
config: config
|
|
11767
|
+
});
|
|
11768
|
+
|
|
11769
|
+
|
|
11770
|
+
},
|
|
11771
|
+
"./src/cli/codex/bridge/stop.tsx"(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
11772
|
+
__webpack_require__.r(__webpack_exports__);
|
|
11773
|
+
/* import */ var react_jsx_runtime__rspack_import_0 = __webpack_require__("./node_modules/react/jsx-runtime.js");
|
|
11774
|
+
/* import */ var _agent_bundle_runtime__rspack_import_3 = __webpack_require__("./node_modules/@agent-bundle/runtime/dist/736.js");
|
|
11775
|
+
/* import */ var _agent_bundle_runtime__rspack_import_4 = __webpack_require__("./node_modules/@agent-bundle/runtime/dist/506.js");
|
|
11776
|
+
/* import */ var _core_relay_routes_js__rspack_import_1 = __webpack_require__("./src/core/relay/routes.ts");
|
|
11777
|
+
/* import */ var _core_codex_contract_js__rspack_import_2 = __webpack_require__("./src/core/codex/contract.js");
|
|
11778
|
+
|
|
11779
|
+
|
|
11780
|
+
|
|
11781
|
+
|
|
11782
|
+
|
|
11783
|
+
const config = {
|
|
11784
|
+
description: 'Managed Grok/Codex bridge stop.',
|
|
11785
|
+
exitCode: 'result',
|
|
11786
|
+
inputJsonSchema: {
|
|
11787
|
+
type: 'object',
|
|
11788
|
+
properties: {
|
|
11789
|
+
bindingId: {
|
|
11790
|
+
type: 'string'
|
|
11791
|
+
},
|
|
11792
|
+
all: {
|
|
11793
|
+
type: 'boolean'
|
|
11794
|
+
},
|
|
11795
|
+
worker: {
|
|
11796
|
+
type: 'boolean'
|
|
11797
|
+
}
|
|
11798
|
+
},
|
|
11799
|
+
additionalProperties: false
|
|
11800
|
+
}
|
|
11801
|
+
};
|
|
11802
|
+
async function route({ input }) {
|
|
11803
|
+
let out;
|
|
11804
|
+
try {
|
|
11805
|
+
out = {
|
|
11806
|
+
...await (0,_core_relay_routes_js__rspack_import_1/* .bridgeOperation */.n1)('stop', input, await (0,_agent_bundle_runtime__rspack_import_3/* .agent */.MA)()),
|
|
11807
|
+
exitCode: 0
|
|
11808
|
+
};
|
|
11809
|
+
} catch (error) {
|
|
11810
|
+
out = (0,_core_codex_contract_js__rspack_import_2/* .outcomeFromError */.DG)(error);
|
|
11811
|
+
}
|
|
11812
|
+
return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_4/* .Agent.Result */.g6.Result, {
|
|
11813
|
+
value: out,
|
|
11814
|
+
children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_4/* .Agent.Text */.g6.Text, {
|
|
11815
|
+
children: JSON.stringify(out)
|
|
11816
|
+
})
|
|
11817
|
+
});
|
|
11818
|
+
}
|
|
11819
|
+
|
|
11820
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
11821
|
+
"default": () => (route),
|
|
11822
|
+
inputSchema: () => (/* reexport safe */ _core_relay_routes_js__rspack_import_1.d5),
|
|
11823
|
+
resultSchema: () => (/* reexport safe */ _core_relay_routes_js__rspack_import_1.Ax)
|
|
11824
|
+
}, {
|
|
11825
|
+
config: config
|
|
11826
|
+
});
|
|
11827
|
+
|
|
11828
|
+
|
|
11459
11829
|
},
|
|
11460
11830
|
"./src/cli/codex/desktop-shim.tsx"(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
11461
11831
|
__webpack_require__.r(__webpack_exports__);
|
|
@@ -11766,117 +12136,145 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
11766
12136
|
"./src/cli/codex/send.tsx"(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
11767
12137
|
__webpack_require__.r(__webpack_exports__);
|
|
11768
12138
|
/* import */ var react_jsx_runtime__rspack_import_0 = __webpack_require__("./node_modules/react/jsx-runtime.js");
|
|
11769
|
-
/* import */ var _agent_bundle_runtime__rspack_import_4 = __webpack_require__("./node_modules/@agent-bundle/runtime/dist/
|
|
12139
|
+
/* import */ var _agent_bundle_runtime__rspack_import_4 = __webpack_require__("./node_modules/@agent-bundle/runtime/dist/736.js");
|
|
12140
|
+
/* import */ var _agent_bundle_runtime__rspack_import_5 = __webpack_require__("./node_modules/@agent-bundle/runtime/dist/506.js");
|
|
11770
12141
|
/* import */ var zod__rspack_import_3 = __webpack_require__("./node_modules/zod/v4/classic/schemas.js");
|
|
11771
|
-
/* import */ var
|
|
11772
|
-
/* import */ var
|
|
12142
|
+
/* import */ var _core_codex_routes_js__rspack_import_1 = __webpack_require__("./src/core/codex/routes.ts");
|
|
12143
|
+
/* import */ var _core_relay_routes_js__rspack_import_2 = __webpack_require__("./src/core/relay/routes.ts");
|
|
11773
12144
|
|
|
11774
12145
|
|
|
11775
12146
|
|
|
11776
12147
|
|
|
11777
12148
|
|
|
12149
|
+
const resultSchema = zod__rspack_import_3/* .union */.KCZ([
|
|
12150
|
+
_core_codex_routes_js__rspack_import_1/* .resultSchema */.FD,
|
|
12151
|
+
_core_relay_routes_js__rspack_import_2/* .relayResultSchema */.Ax
|
|
12152
|
+
]);
|
|
12153
|
+
const inputSchema = zod__rspack_import_3/* .object */.Ikc({
|
|
12154
|
+
..._core_codex_routes_js__rspack_import_1/* .sendFields */.at,
|
|
12155
|
+
whenBusy: zod__rspack_import_3/* ["enum"] */.k5n([
|
|
12156
|
+
'reject',
|
|
12157
|
+
'queue',
|
|
12158
|
+
'steer'
|
|
12159
|
+
]).optional(),
|
|
12160
|
+
replyToGrok: zod__rspack_import_3/* .string */.YjP().min(1).optional(),
|
|
12161
|
+
bindingId: zod__rspack_import_3/* .string */.YjP().min(1).optional(),
|
|
12162
|
+
requestId: zod__rspack_import_3/* .string */.YjP().min(1).max(128).optional(),
|
|
12163
|
+
correlationId: zod__rspack_import_3/* .string */.YjP().min(1).optional(),
|
|
12164
|
+
replyTo: zod__rspack_import_3/* .string */.YjP().min(1).optional(),
|
|
12165
|
+
message: zod__rspack_import_3/* .array */.YOg(zod__rspack_import_3/* .string */.YjP()).min(1)
|
|
12166
|
+
}).strict();
|
|
11778
12167
|
const config = {
|
|
11779
|
-
description: 'Send
|
|
12168
|
+
description: 'Send to Codex; acceptance is distinct from completion. Options precede threadId.',
|
|
11780
12169
|
exitCode: 'result',
|
|
12170
|
+
render: {
|
|
12171
|
+
maxElapsedMs: 660000
|
|
12172
|
+
},
|
|
12173
|
+
positionals: [
|
|
12174
|
+
'threadId',
|
|
12175
|
+
'message'
|
|
12176
|
+
],
|
|
11781
12177
|
inputJsonSchema: {
|
|
12178
|
+
type: 'object',
|
|
11782
12179
|
additionalProperties: false,
|
|
11783
12180
|
properties: {
|
|
12181
|
+
replyToGrok: {
|
|
12182
|
+
type: 'string'
|
|
12183
|
+
},
|
|
12184
|
+
bindingId: {
|
|
12185
|
+
type: 'string'
|
|
12186
|
+
},
|
|
12187
|
+
requestId: {
|
|
12188
|
+
type: 'string'
|
|
12189
|
+
},
|
|
12190
|
+
threadId: {
|
|
12191
|
+
type: 'string'
|
|
12192
|
+
},
|
|
12193
|
+
expectedCwd: {
|
|
12194
|
+
type: 'string'
|
|
12195
|
+
},
|
|
12196
|
+
timeoutMs: {
|
|
12197
|
+
type: 'number',
|
|
12198
|
+
description: 'Observation timeout: 1-600000 milliseconds.'
|
|
12199
|
+
},
|
|
11784
12200
|
correlationId: {
|
|
11785
|
-
description: 'Stable correlation id for multi-hop replies',
|
|
11786
12201
|
type: 'string'
|
|
11787
12202
|
},
|
|
11788
12203
|
envelope: {
|
|
11789
|
-
description: 'Prepend the [gbot …] header to the message body',
|
|
11790
12204
|
type: 'boolean'
|
|
11791
12205
|
},
|
|
11792
12206
|
hop: {
|
|
11793
|
-
description: 'Hop count; refused at GROK_BOT_MAX_HOPS',
|
|
11794
12207
|
type: 'number'
|
|
11795
12208
|
},
|
|
11796
|
-
message: {
|
|
11797
|
-
items: {
|
|
11798
|
-
type: 'string'
|
|
11799
|
-
},
|
|
11800
|
-
type: 'array'
|
|
11801
|
-
},
|
|
11802
12209
|
replyTo: {
|
|
11803
|
-
description: 'Prior message id this send replies to',
|
|
11804
12210
|
type: 'string'
|
|
11805
12211
|
},
|
|
11806
|
-
|
|
11807
|
-
type: 'string'
|
|
12212
|
+
expectedTurnId: {
|
|
12213
|
+
type: 'string',
|
|
12214
|
+
description: 'Required active-turn guard for steer; stale guards reject.'
|
|
12215
|
+
},
|
|
12216
|
+
wait: {
|
|
12217
|
+
type: 'boolean'
|
|
12218
|
+
},
|
|
12219
|
+
maxOutputBytes: {
|
|
12220
|
+
type: 'number',
|
|
12221
|
+
description: 'Reply budget: 1-4194304 bytes.'
|
|
11808
12222
|
},
|
|
11809
12223
|
whenBusy: {
|
|
11810
|
-
|
|
12224
|
+
type: 'string',
|
|
11811
12225
|
enum: [
|
|
11812
12226
|
'reject',
|
|
11813
|
-
'queue'
|
|
11814
|
-
|
|
11815
|
-
|
|
12227
|
+
'queue',
|
|
12228
|
+
'steer'
|
|
12229
|
+
]
|
|
12230
|
+
},
|
|
12231
|
+
message: {
|
|
12232
|
+
type: 'array',
|
|
12233
|
+
items: {
|
|
12234
|
+
type: 'string'
|
|
12235
|
+
}
|
|
11816
12236
|
}
|
|
11817
12237
|
},
|
|
11818
12238
|
required: [
|
|
11819
12239
|
'threadId',
|
|
11820
12240
|
'message'
|
|
11821
|
-
]
|
|
11822
|
-
|
|
11823
|
-
},
|
|
11824
|
-
positionals: [
|
|
11825
|
-
'threadId',
|
|
11826
|
-
'message'
|
|
11827
|
-
]
|
|
12241
|
+
]
|
|
12242
|
+
}
|
|
11828
12243
|
};
|
|
11829
|
-
|
|
11830
|
-
|
|
11831
|
-
|
|
11832
|
-
|
|
11833
|
-
|
|
11834
|
-
|
|
11835
|
-
|
|
11836
|
-
|
|
11837
|
-
|
|
11838
|
-
|
|
11839
|
-
|
|
11840
|
-
}
|
|
11841
|
-
|
|
11842
|
-
|
|
11843
|
-
|
|
11844
|
-
'queued',
|
|
11845
|
-
'rejected',
|
|
11846
|
-
'unknown'
|
|
11847
|
-
]),
|
|
11848
|
-
exitCode: zod__rspack_import_3/* .union */.KCZ([
|
|
11849
|
-
zod__rspack_import_3/* .literal */.euz(0),
|
|
11850
|
-
zod__rspack_import_3/* .literal */.euz(1)
|
|
11851
|
-
])
|
|
11852
|
-
}).passthrough();
|
|
11853
|
-
async function codexSend({ input }) {
|
|
11854
|
-
let out;
|
|
11855
|
-
try {
|
|
11856
|
-
const envelope = (0,_core_codex_bridge_js__rspack_import_1/* .buildEnvelope */.nq)({
|
|
11857
|
-
correlationId: input.correlationId,
|
|
11858
|
-
envelope: Boolean(input.envelope),
|
|
11859
|
-
hop: input.hop,
|
|
11860
|
-
replyTo: input.replyTo
|
|
11861
|
-
});
|
|
11862
|
-
out = await (0,_core_codex_bridge_js__rspack_import_1/* .sendToCodexThread */.ZS)(input.threadId, input.message.join(' ').trim(), {
|
|
11863
|
-
envelope,
|
|
11864
|
-
whenBusy: input.whenBusy
|
|
12244
|
+
async function route({ input, signal }) {
|
|
12245
|
+
const context = await (0,_agent_bundle_runtime__rspack_import_4/* .agent */.MA)();
|
|
12246
|
+
if (input.replyToGrok || input.bindingId) {
|
|
12247
|
+
const out = await (0,_core_relay_routes_js__rspack_import_2/* .codexReturnOperation */.lt)({
|
|
12248
|
+
...input,
|
|
12249
|
+
message: input.message.join(' ').trim()
|
|
12250
|
+
}, context);
|
|
12251
|
+
return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_5/* .Agent.Result */.g6.Result, {
|
|
12252
|
+
value: {
|
|
12253
|
+
...out,
|
|
12254
|
+
exitCode: out.delivery === 'rejected' ? 1 : 0
|
|
12255
|
+
},
|
|
12256
|
+
children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_5/* .Agent.Text */.g6.Text, {
|
|
12257
|
+
children: `Delivery ${out.delivery}; terminal answer returns to Grok automatically.`
|
|
12258
|
+
})
|
|
11865
12259
|
});
|
|
11866
|
-
} catch (error) {
|
|
11867
|
-
out = (0,_core_codex_contract_js__rspack_import_2/* .outcomeFromError */.DG)(error);
|
|
11868
12260
|
}
|
|
11869
|
-
const
|
|
11870
|
-
|
|
12261
|
+
const out = await (0,_core_codex_routes_js__rspack_import_1/* .sendOperation */.UP)({
|
|
12262
|
+
...input,
|
|
12263
|
+
whenBusy: input.whenBusy ?? 'reject',
|
|
12264
|
+
message: input.message.join(' ').trim()
|
|
12265
|
+
}, signal, (message)=>context.progress.report({
|
|
12266
|
+
message
|
|
12267
|
+
}), true);
|
|
12268
|
+
return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_5/* .Agent.Result */.g6.Result, {
|
|
11871
12269
|
value: out,
|
|
11872
|
-
children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(
|
|
11873
|
-
children:
|
|
12270
|
+
children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_5/* .Agent.Text */.g6.Text, {
|
|
12271
|
+
children: (0,_core_codex_routes_js__rspack_import_1/* .resultText */.D6)(out)
|
|
11874
12272
|
})
|
|
11875
12273
|
});
|
|
11876
12274
|
}
|
|
11877
12275
|
|
|
11878
12276
|
__webpack_require__.d(__webpack_exports__, {
|
|
11879
|
-
"default": () => (
|
|
12277
|
+
"default": () => (route)
|
|
11880
12278
|
}, {
|
|
11881
12279
|
config: config,
|
|
11882
12280
|
inputSchema: inputSchema,
|
|
@@ -11932,6 +12330,146 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
11932
12330
|
});
|
|
11933
12331
|
|
|
11934
12332
|
|
|
12333
|
+
},
|
|
12334
|
+
"./src/cli/codex/wait.tsx"(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
12335
|
+
__webpack_require__.r(__webpack_exports__);
|
|
12336
|
+
/* import */ var react_jsx_runtime__rspack_import_0 = __webpack_require__("./node_modules/react/jsx-runtime.js");
|
|
12337
|
+
/* import */ var _agent_bundle_runtime__rspack_import_2 = __webpack_require__("./node_modules/@agent-bundle/runtime/dist/736.js");
|
|
12338
|
+
/* import */ var _agent_bundle_runtime__rspack_import_3 = __webpack_require__("./node_modules/@agent-bundle/runtime/dist/506.js");
|
|
12339
|
+
/* import */ var _core_codex_routes_js__rspack_import_1 = __webpack_require__("./src/core/codex/routes.ts");
|
|
12340
|
+
|
|
12341
|
+
|
|
12342
|
+
|
|
12343
|
+
|
|
12344
|
+
const config = {
|
|
12345
|
+
description: 'Bounded Codex wait observation; never interrupts execution.',
|
|
12346
|
+
exitCode: 'result',
|
|
12347
|
+
render: {
|
|
12348
|
+
maxElapsedMs: 660000
|
|
12349
|
+
},
|
|
12350
|
+
positionals: [
|
|
12351
|
+
'threadId',
|
|
12352
|
+
'turnId'
|
|
12353
|
+
],
|
|
12354
|
+
inputJsonSchema: {
|
|
12355
|
+
type: 'object',
|
|
12356
|
+
additionalProperties: false,
|
|
12357
|
+
properties: {
|
|
12358
|
+
"threadId": {
|
|
12359
|
+
"type": "string"
|
|
12360
|
+
},
|
|
12361
|
+
"expectedCwd": {
|
|
12362
|
+
"type": "string"
|
|
12363
|
+
},
|
|
12364
|
+
"timeoutMs": {
|
|
12365
|
+
"type": "number",
|
|
12366
|
+
"description": "Observation timeout: 1-600000 milliseconds."
|
|
12367
|
+
},
|
|
12368
|
+
"turnId": {
|
|
12369
|
+
"type": "string"
|
|
12370
|
+
},
|
|
12371
|
+
"messageId": {
|
|
12372
|
+
"type": "string"
|
|
12373
|
+
},
|
|
12374
|
+
"maxOutputBytes": {
|
|
12375
|
+
"type": "number",
|
|
12376
|
+
"description": "Reply budget: 1-4194304 bytes."
|
|
12377
|
+
}
|
|
12378
|
+
},
|
|
12379
|
+
required: [
|
|
12380
|
+
'threadId',
|
|
12381
|
+
'turnId'
|
|
12382
|
+
]
|
|
12383
|
+
}
|
|
12384
|
+
};
|
|
12385
|
+
async function route({ input, signal }) {
|
|
12386
|
+
const context = await (0,_agent_bundle_runtime__rspack_import_2/* .agent */.MA)();
|
|
12387
|
+
const out = await (0,_core_codex_routes_js__rspack_import_1/* .observeOperation */.gT)('wait', input, signal, (message)=>context.progress.report({
|
|
12388
|
+
message
|
|
12389
|
+
}));
|
|
12390
|
+
return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Result */.g6.Result, {
|
|
12391
|
+
value: out,
|
|
12392
|
+
children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Text */.g6.Text, {
|
|
12393
|
+
children: (0,_core_codex_routes_js__rspack_import_1/* .resultText */.D6)(out)
|
|
12394
|
+
})
|
|
12395
|
+
});
|
|
12396
|
+
}
|
|
12397
|
+
|
|
12398
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
12399
|
+
"default": () => (route),
|
|
12400
|
+
inputSchema: () => (/* reexport safe */ _core_codex_routes_js__rspack_import_1.jS),
|
|
12401
|
+
resultSchema: () => (/* reexport safe */ _core_codex_routes_js__rspack_import_1.FD)
|
|
12402
|
+
}, {
|
|
12403
|
+
config: config
|
|
12404
|
+
});
|
|
12405
|
+
|
|
12406
|
+
|
|
12407
|
+
},
|
|
12408
|
+
"./src/cli/codex/watch.tsx"(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
12409
|
+
__webpack_require__.r(__webpack_exports__);
|
|
12410
|
+
/* import */ var react_jsx_runtime__rspack_import_0 = __webpack_require__("./node_modules/react/jsx-runtime.js");
|
|
12411
|
+
/* import */ var _agent_bundle_runtime__rspack_import_2 = __webpack_require__("./node_modules/@agent-bundle/runtime/dist/736.js");
|
|
12412
|
+
/* import */ var _agent_bundle_runtime__rspack_import_3 = __webpack_require__("./node_modules/@agent-bundle/runtime/dist/506.js");
|
|
12413
|
+
/* import */ var _core_codex_routes_js__rspack_import_1 = __webpack_require__("./src/core/codex/routes.ts");
|
|
12414
|
+
|
|
12415
|
+
|
|
12416
|
+
|
|
12417
|
+
|
|
12418
|
+
const config = {
|
|
12419
|
+
description: 'Bounded Codex watch observation; never interrupts execution.',
|
|
12420
|
+
exitCode: 'result',
|
|
12421
|
+
render: {
|
|
12422
|
+
maxElapsedMs: 660000
|
|
12423
|
+
},
|
|
12424
|
+
positionals: [
|
|
12425
|
+
'threadId'
|
|
12426
|
+
],
|
|
12427
|
+
inputJsonSchema: {
|
|
12428
|
+
type: 'object',
|
|
12429
|
+
additionalProperties: false,
|
|
12430
|
+
properties: {
|
|
12431
|
+
"threadId": {
|
|
12432
|
+
"type": "string"
|
|
12433
|
+
},
|
|
12434
|
+
"expectedCwd": {
|
|
12435
|
+
"type": "string"
|
|
12436
|
+
},
|
|
12437
|
+
"timeoutMs": {
|
|
12438
|
+
"type": "number",
|
|
12439
|
+
"description": "Observation timeout: 1-600000 milliseconds."
|
|
12440
|
+
},
|
|
12441
|
+
"maxEvents": {
|
|
12442
|
+
"type": "number",
|
|
12443
|
+
"description": "Maximum observed events: 1-500."
|
|
12444
|
+
}
|
|
12445
|
+
},
|
|
12446
|
+
required: [
|
|
12447
|
+
'threadId'
|
|
12448
|
+
]
|
|
12449
|
+
}
|
|
12450
|
+
};
|
|
12451
|
+
async function route({ input, signal }) {
|
|
12452
|
+
const context = await (0,_agent_bundle_runtime__rspack_import_2/* .agent */.MA)();
|
|
12453
|
+
const out = await (0,_core_codex_routes_js__rspack_import_1/* .observeOperation */.gT)('watch', input, signal, (message)=>context.progress.report({
|
|
12454
|
+
message
|
|
12455
|
+
}));
|
|
12456
|
+
return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Result */.g6.Result, {
|
|
12457
|
+
value: out,
|
|
12458
|
+
children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Text */.g6.Text, {
|
|
12459
|
+
children: (0,_core_codex_routes_js__rspack_import_1/* .resultText */.D6)(out)
|
|
12460
|
+
})
|
|
12461
|
+
});
|
|
12462
|
+
}
|
|
12463
|
+
|
|
12464
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
12465
|
+
"default": () => (route),
|
|
12466
|
+
inputSchema: () => (/* reexport safe */ _core_codex_routes_js__rspack_import_1.R9),
|
|
12467
|
+
resultSchema: () => (/* reexport safe */ _core_codex_routes_js__rspack_import_1.FD)
|
|
12468
|
+
}, {
|
|
12469
|
+
config: config
|
|
12470
|
+
});
|
|
12471
|
+
|
|
12472
|
+
|
|
11935
12473
|
},
|
|
11936
12474
|
"./src/cli/doctor.tsx"(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
11937
12475
|
__webpack_require__.r(__webpack_exports__);
|
|
@@ -12805,12 +13343,15 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
12805
13343
|
"./src/cli/send.tsx"(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
12806
13344
|
__webpack_require__.r(__webpack_exports__);
|
|
12807
13345
|
/* import */ var react_jsx_runtime__rspack_import_0 = __webpack_require__("./node_modules/react/jsx-runtime.js");
|
|
12808
|
-
/* import */ var
|
|
12809
|
-
/* import */ var
|
|
12810
|
-
/* import */ var
|
|
12811
|
-
/* import */ var
|
|
12812
|
-
/* import */ var
|
|
12813
|
-
/* import */ var
|
|
13346
|
+
/* import */ var _agent_bundle_runtime__rspack_import_7 = __webpack_require__("./node_modules/@agent-bundle/runtime/dist/736.js");
|
|
13347
|
+
/* import */ var _agent_bundle_runtime__rspack_import_8 = __webpack_require__("./node_modules/@agent-bundle/runtime/dist/506.js");
|
|
13348
|
+
/* import */ var zod__rspack_import_6 = __webpack_require__("./node_modules/zod/v4/classic/schemas.js");
|
|
13349
|
+
/* import */ var _core_relay_routes_js__rspack_import_1 = __webpack_require__("./src/core/relay/routes.ts");
|
|
13350
|
+
/* import */ var _core_codex_bridge_js__rspack_import_2 = __webpack_require__("./src/core/codex-bridge.js");
|
|
13351
|
+
/* import */ var _core_codex_contract_js__rspack_import_3 = __webpack_require__("./src/core/codex/contract.js");
|
|
13352
|
+
/* import */ var _core_history_js__rspack_import_4 = __webpack_require__("./src/core/history.js");
|
|
13353
|
+
/* import */ var _shared_js__rspack_import_5 = __webpack_require__("./src/cli/_shared.ts");
|
|
13354
|
+
|
|
12814
13355
|
|
|
12815
13356
|
|
|
12816
13357
|
|
|
@@ -12824,6 +13365,25 @@ const config = {
|
|
|
12824
13365
|
inputJsonSchema: {
|
|
12825
13366
|
additionalProperties: false,
|
|
12826
13367
|
properties: {
|
|
13368
|
+
replyMode: {
|
|
13369
|
+
type: 'string',
|
|
13370
|
+
enum: [
|
|
13371
|
+
'auto',
|
|
13372
|
+
'manual'
|
|
13373
|
+
]
|
|
13374
|
+
},
|
|
13375
|
+
codexThreadId: {
|
|
13376
|
+
type: 'string'
|
|
13377
|
+
},
|
|
13378
|
+
bindingId: {
|
|
13379
|
+
type: 'string'
|
|
13380
|
+
},
|
|
13381
|
+
expectedCwd: {
|
|
13382
|
+
type: 'string'
|
|
13383
|
+
},
|
|
13384
|
+
requestId: {
|
|
13385
|
+
type: 'string'
|
|
13386
|
+
},
|
|
12827
13387
|
correlationId: {
|
|
12828
13388
|
description: 'Stable correlation id for multi-hop replies',
|
|
12829
13389
|
type: 'string'
|
|
@@ -12881,52 +13441,58 @@ const config = {
|
|
|
12881
13441
|
'message'
|
|
12882
13442
|
]
|
|
12883
13443
|
};
|
|
12884
|
-
const inputSchema =
|
|
12885
|
-
|
|
12886
|
-
|
|
12887
|
-
|
|
12888
|
-
|
|
12889
|
-
|
|
12890
|
-
|
|
12891
|
-
|
|
12892
|
-
|
|
13444
|
+
const inputSchema = _shared_js__rspack_import_5/* .backendFlagsSchema.extend */.lK.extend({
|
|
13445
|
+
..._core_relay_routes_js__rspack_import_1/* .routeFields */.zK,
|
|
13446
|
+
replyMode: zod__rspack_import_6/* ["enum"] */.k5n([
|
|
13447
|
+
'auto',
|
|
13448
|
+
'manual'
|
|
13449
|
+
]).optional(),
|
|
13450
|
+
correlationId: zod__rspack_import_6/* .string */.YjP().min(1).optional(),
|
|
13451
|
+
envelope: zod__rspack_import_6/* .boolean */.zMY().default(false),
|
|
13452
|
+
historyDir: zod__rspack_import_6/* .string */.YjP().min(1).optional(),
|
|
13453
|
+
hop: zod__rspack_import_6/* .number */.aig().int().min(0).optional(),
|
|
13454
|
+
message: zod__rspack_import_6/* .array */.YOg(zod__rspack_import_6/* .string */.YjP()).min(1),
|
|
13455
|
+
noHistory: zod__rspack_import_6/* .boolean */.zMY().default(false),
|
|
13456
|
+
replyTo: zod__rspack_import_6/* .string */.YjP().min(1).optional(),
|
|
13457
|
+
target: zod__rspack_import_6/* .string */.YjP().min(1)
|
|
12893
13458
|
}).strict();
|
|
12894
|
-
const receiptSchema =
|
|
12895
|
-
correlationId:
|
|
12896
|
-
delivery:
|
|
13459
|
+
const receiptSchema = zod__rspack_import_6/* .object */.Ikc({
|
|
13460
|
+
correlationId: zod__rspack_import_6/* .string */.YjP(),
|
|
13461
|
+
delivery: zod__rspack_import_6/* ["enum"] */.k5n([
|
|
12897
13462
|
'accepted',
|
|
12898
13463
|
'unknown'
|
|
12899
13464
|
]),
|
|
12900
|
-
envelopeId:
|
|
12901
|
-
exitCode:
|
|
12902
|
-
hop:
|
|
12903
|
-
id:
|
|
12904
|
-
kind:
|
|
13465
|
+
envelopeId: zod__rspack_import_6/* .string */.YjP(),
|
|
13466
|
+
exitCode: zod__rspack_import_6/* .literal */.euz(0),
|
|
13467
|
+
hop: zod__rspack_import_6/* .number */.aig().int().min(0),
|
|
13468
|
+
id: zod__rspack_import_6/* .string */.YjP(),
|
|
13469
|
+
kind: zod__rspack_import_6/* ["enum"] */.k5n([
|
|
12905
13470
|
'bot',
|
|
12906
13471
|
'group'
|
|
12907
13472
|
]),
|
|
12908
|
-
maxHops:
|
|
12909
|
-
messageId:
|
|
12910
|
-
name:
|
|
12911
|
-
replyTo:
|
|
12912
|
-
result:
|
|
13473
|
+
maxHops: zod__rspack_import_6/* .number */.aig().int().min(0),
|
|
13474
|
+
messageId: zod__rspack_import_6/* .string */.YjP().optional(),
|
|
13475
|
+
name: zod__rspack_import_6/* .string */.YjP(),
|
|
13476
|
+
replyTo: zod__rspack_import_6/* .string */.YjP().optional(),
|
|
13477
|
+
result: zod__rspack_import_6/* .record */.g1P(zod__rspack_import_6/* .string */.YjP(), zod__rspack_import_6/* .json */.Pq9())
|
|
12913
13478
|
}).strict();
|
|
12914
13479
|
// Refusals and gateway failures are the same flat document `codex send` emits.
|
|
12915
|
-
const resultSchema =
|
|
13480
|
+
const resultSchema = zod__rspack_import_6/* .union */.KCZ([
|
|
12916
13481
|
receiptSchema,
|
|
12917
|
-
|
|
13482
|
+
_shared_js__rspack_import_5/* .failureDocumentSchema */.R9,
|
|
13483
|
+
_core_relay_routes_js__rspack_import_1/* .relayResultSchema */.Ax
|
|
12918
13484
|
]);
|
|
12919
13485
|
const deliver = async (input)=>{
|
|
12920
|
-
const envelope = (0,
|
|
13486
|
+
const envelope = (0,_core_codex_bridge_js__rspack_import_2/* .buildEnvelope */.nq)({
|
|
12921
13487
|
correlationId: input.correlationId,
|
|
12922
13488
|
envelope: input.envelope,
|
|
12923
13489
|
hop: input.hop,
|
|
12924
13490
|
replyTo: input.replyTo
|
|
12925
13491
|
});
|
|
12926
13492
|
const message = input.message.join(' ').trim();
|
|
12927
|
-
const backend = await (0,
|
|
12928
|
-
const out = await backend.send(input.target, (0,
|
|
12929
|
-
(0,
|
|
13493
|
+
const backend = await (0,_shared_js__rspack_import_5/* .openBackendFromInput */.FS)(input);
|
|
13494
|
+
const out = await backend.send(input.target, (0,_core_codex_bridge_js__rspack_import_2/* .withEnvelopeHeader */.Mr)(message, envelope));
|
|
13495
|
+
(0,_core_history_js__rspack_import_4/* .saveHistory */.QX)(out, {
|
|
12930
13496
|
dir: input.historyDir,
|
|
12931
13497
|
disabled: input.noHistory,
|
|
12932
13498
|
event: 'send',
|
|
@@ -12954,14 +13520,38 @@ const deliver = async (input)=>{
|
|
|
12954
13520
|
async function send({ input }) {
|
|
12955
13521
|
let value;
|
|
12956
13522
|
try {
|
|
13523
|
+
if (input.replyMode === 'auto' || input.codexThreadId || input.bindingId) {
|
|
13524
|
+
(0,_core_relay_routes_js__rspack_import_1/* .assertManagedSendOptions */.MB)(input);
|
|
13525
|
+
if (input.files) throw Error('Automatic routes require the gateway backend');
|
|
13526
|
+
const out = await (0,_core_relay_routes_js__rspack_import_1/* .grokSendOperation */.bv)({
|
|
13527
|
+
target: input.target,
|
|
13528
|
+
message: input.message.join(' ').trim(),
|
|
13529
|
+
replyMode: input.replyMode ?? 'auto',
|
|
13530
|
+
codexThreadId: input.codexThreadId,
|
|
13531
|
+
bindingId: input.bindingId,
|
|
13532
|
+
expectedCwd: input.expectedCwd,
|
|
13533
|
+
requestId: input.requestId,
|
|
13534
|
+
hop: input.hop,
|
|
13535
|
+
correlationId: input.correlationId
|
|
13536
|
+
}, await (0,_agent_bundle_runtime__rspack_import_7/* .agent */.MA)());
|
|
13537
|
+
return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_8/* .Agent.Result */.g6.Result, {
|
|
13538
|
+
value: {
|
|
13539
|
+
...out,
|
|
13540
|
+
exitCode: out.delivery === 'rejected' ? 1 : 0
|
|
13541
|
+
},
|
|
13542
|
+
children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_8/* .Agent.Text */.g6.Text, {
|
|
13543
|
+
children: `Delivery ${out.delivery}; inspect codex bridge status for automatic reply delivery.`
|
|
13544
|
+
})
|
|
13545
|
+
});
|
|
13546
|
+
}
|
|
12957
13547
|
value = await deliver(input);
|
|
12958
13548
|
} catch (error) {
|
|
12959
|
-
value = (0,
|
|
13549
|
+
value = (0,_core_codex_contract_js__rspack_import_3/* .outcomeFromError */.DG)(error);
|
|
12960
13550
|
}
|
|
12961
13551
|
const text = value.exitCode === 0 ? `Sent to ${value.kind} ${value.name} (${value.id})${value.messageId ? ` message ${value.messageId}` : ''}; envelope ${value.envelopeId}` : value.error;
|
|
12962
|
-
return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(
|
|
13552
|
+
return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_8/* .Agent.Result */.g6.Result, {
|
|
12963
13553
|
value: value,
|
|
12964
|
-
children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(
|
|
13554
|
+
children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_8/* .Agent.Text */.g6.Text, {
|
|
12965
13555
|
children: text
|
|
12966
13556
|
})
|
|
12967
13557
|
});
|
|
@@ -13131,6 +13721,411 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
13131
13721
|
});
|
|
13132
13722
|
|
|
13133
13723
|
|
|
13724
|
+
},
|
|
13725
|
+
"./src/core/codex/routes.ts"(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
13726
|
+
/* import */ var zod__rspack_import_3 = __webpack_require__("./node_modules/zod/v4/classic/schemas.js");
|
|
13727
|
+
/* import */ var _codex_bridge_js__rspack_import_0 = __webpack_require__("./src/core/codex-bridge.js");
|
|
13728
|
+
/* import */ var _contract_js__rspack_import_1 = __webpack_require__("./src/core/codex/contract.js");
|
|
13729
|
+
/* import */ var _conversation_js__rspack_import_2 = __webpack_require__("./src/core/codex/conversation.js");
|
|
13730
|
+
|
|
13731
|
+
|
|
13732
|
+
|
|
13733
|
+
|
|
13734
|
+
const id = zod__rspack_import_3/* .string */.YjP().regex(/^[A-Za-z0-9_.:-]{1,128}$/);
|
|
13735
|
+
const observationFields = {
|
|
13736
|
+
expectedCwd: zod__rspack_import_3/* .string */.YjP().min(1).optional(),
|
|
13737
|
+
threadId: id,
|
|
13738
|
+
timeoutMs: zod__rspack_import_3/* .number */.aig().int().min(1).max(600000).optional()
|
|
13739
|
+
};
|
|
13740
|
+
const sendFields = {
|
|
13741
|
+
...observationFields,
|
|
13742
|
+
correlationId: id.optional(),
|
|
13743
|
+
envelope: zod__rspack_import_3/* .boolean */.zMY().optional(),
|
|
13744
|
+
hop: zod__rspack_import_3/* .number */.aig().int().min(0).optional(),
|
|
13745
|
+
replyTo: id.optional(),
|
|
13746
|
+
expectedTurnId: id.optional(),
|
|
13747
|
+
whenBusy: zod__rspack_import_3/* ["enum"] */.k5n([
|
|
13748
|
+
'reject',
|
|
13749
|
+
'queue',
|
|
13750
|
+
'steer'
|
|
13751
|
+
]).default('reject'),
|
|
13752
|
+
wait: zod__rspack_import_3/* .boolean */.zMY().default(false),
|
|
13753
|
+
maxOutputBytes: zod__rspack_import_3/* .number */.aig().int().min(1).max(4194304).optional()
|
|
13754
|
+
};
|
|
13755
|
+
const sendSchema = zod__rspack_import_3/* .object */.Ikc({
|
|
13756
|
+
...sendFields,
|
|
13757
|
+
message: zod__rspack_import_3/* .string */.YjP().min(1).max(4194304)
|
|
13758
|
+
}).strict();
|
|
13759
|
+
const waitSchema = zod__rspack_import_3/* .object */.Ikc({
|
|
13760
|
+
...observationFields,
|
|
13761
|
+
turnId: id,
|
|
13762
|
+
messageId: id.optional(),
|
|
13763
|
+
maxOutputBytes: zod__rspack_import_3/* .number */.aig().int().min(1).max(4194304).optional()
|
|
13764
|
+
}).strict();
|
|
13765
|
+
const watchSchema = zod__rspack_import_3/* .object */.Ikc({
|
|
13766
|
+
...observationFields,
|
|
13767
|
+
maxEvents: zod__rspack_import_3/* .number */.aig().int().min(1).max(500).default(100)
|
|
13768
|
+
}).strict();
|
|
13769
|
+
const threadsSchema = zod__rspack_import_3/* .object */.Ikc({
|
|
13770
|
+
limit: zod__rspack_import_3/* .number */.aig().int().min(1).max(200).default(20),
|
|
13771
|
+
cursor: zod__rspack_import_3/* .string */.YjP().min(1).max(4096).optional()
|
|
13772
|
+
}).strict();
|
|
13773
|
+
const resultSchema = zod__rspack_import_3/* .object */.Ikc({
|
|
13774
|
+
exitCode: zod__rspack_import_3/* .number */.aig().int().min(0).max(1),
|
|
13775
|
+
threadId: zod__rspack_import_3/* .string */.YjP().optional(),
|
|
13776
|
+
turnId: zod__rspack_import_3/* .string */.YjP().optional(),
|
|
13777
|
+
messageId: zod__rspack_import_3/* .string */.YjP().optional(),
|
|
13778
|
+
delivery: zod__rspack_import_3/* ["enum"] */.k5n([
|
|
13779
|
+
'accepted',
|
|
13780
|
+
'queued',
|
|
13781
|
+
'rejected',
|
|
13782
|
+
'unknown'
|
|
13783
|
+
]).optional(),
|
|
13784
|
+
execution: zod__rspack_import_3/* .object */.Ikc({
|
|
13785
|
+
state: zod__rspack_import_3/* ["enum"] */.k5n([
|
|
13786
|
+
'completed',
|
|
13787
|
+
'failed',
|
|
13788
|
+
'interrupted',
|
|
13789
|
+
'waiting-for-input',
|
|
13790
|
+
'timeout',
|
|
13791
|
+
'disconnected',
|
|
13792
|
+
'unknown'
|
|
13793
|
+
]),
|
|
13794
|
+
error: zod__rspack_import_3/* .unknown */.L5J().optional()
|
|
13795
|
+
}).optional(),
|
|
13796
|
+
reply: zod__rspack_import_3/* .object */.Ikc({
|
|
13797
|
+
text: zod__rspack_import_3/* .string */.YjP().max(4194304),
|
|
13798
|
+
items: zod__rspack_import_3/* .array */.YOg(zod__rspack_import_3/* .object */.Ikc({
|
|
13799
|
+
id: zod__rspack_import_3/* .string */.YjP(),
|
|
13800
|
+
type: zod__rspack_import_3/* .literal */.euz('agentMessage'),
|
|
13801
|
+
phase: zod__rspack_import_3/* ["enum"] */.k5n([
|
|
13802
|
+
'final_answer'
|
|
13803
|
+
]).nullable(),
|
|
13804
|
+
text: zod__rspack_import_3/* .string */.YjP().max(4194304)
|
|
13805
|
+
})).max(2000),
|
|
13806
|
+
truncated: zod__rspack_import_3/* .boolean */.zMY()
|
|
13807
|
+
}).optional(),
|
|
13808
|
+
interactions: zod__rspack_import_3/* .array */.YOg(zod__rspack_import_3/* .record */.g1P(zod__rspack_import_3/* .string */.YjP(), zod__rspack_import_3/* .unknown */.L5J())).max(500).optional(),
|
|
13809
|
+
events: zod__rspack_import_3/* .array */.YOg(zod__rspack_import_3/* .record */.g1P(zod__rspack_import_3/* .string */.YjP(), zod__rspack_import_3/* .unknown */.L5J())).max(500).optional(),
|
|
13810
|
+
reason: zod__rspack_import_3/* .string */.YjP().optional(),
|
|
13811
|
+
truncated: zod__rspack_import_3/* .boolean */.zMY().optional()
|
|
13812
|
+
}).passthrough();
|
|
13813
|
+
async function sendOperation(input, signal, progress, oneShot = false) {
|
|
13814
|
+
let envelope;
|
|
13815
|
+
let receipt;
|
|
13816
|
+
try {
|
|
13817
|
+
envelope = (0,_codex_bridge_js__rspack_import_0/* .buildEnvelope */.nq)(input);
|
|
13818
|
+
if (oneShot && !input.wait && input.whenBusy !== 'steer') {
|
|
13819
|
+
return await (0,_codex_bridge_js__rspack_import_0/* .sendToCodexThread */.ZS)(input.threadId, input.message, {
|
|
13820
|
+
envelope,
|
|
13821
|
+
whenBusy: input.whenBusy,
|
|
13822
|
+
expectedCwd: input.expectedCwd,
|
|
13823
|
+
signal
|
|
13824
|
+
});
|
|
13825
|
+
}
|
|
13826
|
+
await progress?.('Opening Codex conversation');
|
|
13827
|
+
const conversation = await (0,_conversation_js__rspack_import_2/* .openCodexConversation */.j)(input.threadId, {
|
|
13828
|
+
expectedCwd: input.expectedCwd,
|
|
13829
|
+
signal
|
|
13830
|
+
});
|
|
13831
|
+
try {
|
|
13832
|
+
receipt = await conversation.send(input.message, {
|
|
13833
|
+
envelope,
|
|
13834
|
+
whenBusy: input.whenBusy,
|
|
13835
|
+
expectedTurnId: input.expectedTurnId
|
|
13836
|
+
});
|
|
13837
|
+
if (!input.wait || receipt.delivery !== 'accepted' || !receipt.turnId) return receipt;
|
|
13838
|
+
await progress?.(`Accepted message ${receipt.messageId}; observing turn ${receipt.turnId}`);
|
|
13839
|
+
const result = await conversation.wait({
|
|
13840
|
+
turnId: receipt.turnId,
|
|
13841
|
+
messageId: receipt.messageId,
|
|
13842
|
+
timeoutMs: input.timeoutMs,
|
|
13843
|
+
maxOutputBytes: input.maxOutputBytes,
|
|
13844
|
+
signal
|
|
13845
|
+
});
|
|
13846
|
+
return {
|
|
13847
|
+
...receipt,
|
|
13848
|
+
execution: result.execution,
|
|
13849
|
+
reply: result.reply,
|
|
13850
|
+
interactions: result.interactions,
|
|
13851
|
+
exitCode: result.execution.state === 'completed' ? 0 : 1
|
|
13852
|
+
};
|
|
13853
|
+
} finally{
|
|
13854
|
+
await conversation.close();
|
|
13855
|
+
}
|
|
13856
|
+
} catch (error) {
|
|
13857
|
+
if (receipt?.delivery === 'accepted') return {
|
|
13858
|
+
...receipt,
|
|
13859
|
+
execution: {
|
|
13860
|
+
state: 'unknown',
|
|
13861
|
+
error: (0,_contract_js__rspack_import_1/* .outcomeFromError */.DG)(error).error
|
|
13862
|
+
},
|
|
13863
|
+
reply: {
|
|
13864
|
+
text: '',
|
|
13865
|
+
items: [],
|
|
13866
|
+
truncated: true
|
|
13867
|
+
},
|
|
13868
|
+
interactions: [],
|
|
13869
|
+
exitCode: 1
|
|
13870
|
+
};
|
|
13871
|
+
return {
|
|
13872
|
+
...(0,_contract_js__rspack_import_1/* .outcomeFromError */.DG)(error),
|
|
13873
|
+
threadId: input.threadId,
|
|
13874
|
+
...envelope ? {
|
|
13875
|
+
messageId: envelope.messageId,
|
|
13876
|
+
correlationId: envelope.correlationId,
|
|
13877
|
+
hop: envelope.hop
|
|
13878
|
+
} : {}
|
|
13879
|
+
};
|
|
13880
|
+
}
|
|
13881
|
+
}
|
|
13882
|
+
async function observeOperation(kind, input, signal, progress) {
|
|
13883
|
+
try {
|
|
13884
|
+
await progress?.(`Observing Codex thread ${input.threadId}`);
|
|
13885
|
+
const conversation = await (0,_conversation_js__rspack_import_2/* .openCodexConversation */.j)(input.threadId, {
|
|
13886
|
+
expectedCwd: input.expectedCwd,
|
|
13887
|
+
signal
|
|
13888
|
+
});
|
|
13889
|
+
try {
|
|
13890
|
+
if (kind === 'wait') {
|
|
13891
|
+
const result = await conversation.wait({
|
|
13892
|
+
...input,
|
|
13893
|
+
signal
|
|
13894
|
+
});
|
|
13895
|
+
return {
|
|
13896
|
+
...result,
|
|
13897
|
+
exitCode: result.execution.state === 'completed' ? 0 : 1
|
|
13898
|
+
};
|
|
13899
|
+
}
|
|
13900
|
+
const result = await conversation.watch({
|
|
13901
|
+
...input,
|
|
13902
|
+
signal
|
|
13903
|
+
});
|
|
13904
|
+
return {
|
|
13905
|
+
...result,
|
|
13906
|
+
exitCode: [
|
|
13907
|
+
'timeout',
|
|
13908
|
+
'event-limit'
|
|
13909
|
+
].includes(result.reason) ? 0 : 1
|
|
13910
|
+
};
|
|
13911
|
+
} finally{
|
|
13912
|
+
await conversation.close();
|
|
13913
|
+
}
|
|
13914
|
+
} catch (error) {
|
|
13915
|
+
return {
|
|
13916
|
+
...(0,_contract_js__rspack_import_1/* .outcomeFromError */.DG)(error),
|
|
13917
|
+
threadId: input.threadId,
|
|
13918
|
+
...'turnId' in input ? {
|
|
13919
|
+
turnId: input.turnId,
|
|
13920
|
+
messageId: input.messageId
|
|
13921
|
+
} : {}
|
|
13922
|
+
};
|
|
13923
|
+
}
|
|
13924
|
+
}
|
|
13925
|
+
async function threadsOperation(input) {
|
|
13926
|
+
try {
|
|
13927
|
+
return {
|
|
13928
|
+
...await listCodexThreads(input),
|
|
13929
|
+
exitCode: 0
|
|
13930
|
+
};
|
|
13931
|
+
} catch (error) {
|
|
13932
|
+
return outcomeFromError(error);
|
|
13933
|
+
}
|
|
13934
|
+
}
|
|
13935
|
+
function resultText(result) {
|
|
13936
|
+
if (result.execution && typeof result.execution === 'object' && 'state' in result.execution) return `Codex turn ${result.turnId}: ${result.execution.state}`;
|
|
13937
|
+
if (result.delivery === 'queued') return `Queued ${result.queuedSubmissionId} on busy Codex thread ${result.threadId}; message ${result.messageId}`;
|
|
13938
|
+
if (result.error) return String(result.error);
|
|
13939
|
+
if (result.delivery === 'accepted') return `Started turn ${result.turnId} (${result.turnStatus}) on Codex thread ${result.threadId}; message ${result.messageId}`;
|
|
13940
|
+
if (result.delivery) return `Codex delivery ${result.delivery} on thread ${result.threadId}`;
|
|
13941
|
+
if (result.reason) return `Codex observation: ${result.reason}`;
|
|
13942
|
+
if (Array.isArray(result.threads)) return `${result.threads.length} Codex threads`;
|
|
13943
|
+
return String(result.error ?? 'Codex observation complete');
|
|
13944
|
+
}
|
|
13945
|
+
|
|
13946
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
13947
|
+
D6: () => (resultText),
|
|
13948
|
+
UP: () => (sendOperation),
|
|
13949
|
+
gT: () => (observeOperation)
|
|
13950
|
+
}, {
|
|
13951
|
+
FD: resultSchema,
|
|
13952
|
+
R9: watchSchema,
|
|
13953
|
+
at: sendFields,
|
|
13954
|
+
jS: waitSchema
|
|
13955
|
+
});
|
|
13956
|
+
|
|
13957
|
+
|
|
13958
|
+
},
|
|
13959
|
+
"./src/core/relay/routes.ts"(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
13960
|
+
/* import */ var _agent_bundle_runtime__rspack_import_4 = __webpack_require__("./node_modules/@agent-bundle/runtime/dist/40.js");
|
|
13961
|
+
/* import */ var zod__rspack_import_3 = __webpack_require__("./node_modules/zod/v4/classic/schemas.js");
|
|
13962
|
+
/* import */ var _managed_js__rspack_import_0 = __webpack_require__("./src/core/relay/managed.js");
|
|
13963
|
+
/* import */ var _gbot_js__rspack_import_1 = __webpack_require__("./src/gbot.ts");
|
|
13964
|
+
/* import */ var _codex_bridge_js__rspack_import_2 = __webpack_require__("./src/core/codex-bridge.js");
|
|
13965
|
+
|
|
13966
|
+
|
|
13967
|
+
|
|
13968
|
+
|
|
13969
|
+
|
|
13970
|
+
const id = zod__rspack_import_3/* .string */.YjP().min(1).max(128);
|
|
13971
|
+
const routeFields = {
|
|
13972
|
+
codexThreadId: id.optional(),
|
|
13973
|
+
expectedCwd: zod__rspack_import_3/* .string */.YjP().min(1).max(4096).optional(),
|
|
13974
|
+
bindingId: zod__rspack_import_3/* .string */.YjP().min(1).max(512).optional(),
|
|
13975
|
+
requestId: id.optional()
|
|
13976
|
+
};
|
|
13977
|
+
const grokSendSchema = zod__rspack_import_3/* .object */.Ikc({
|
|
13978
|
+
target: zod__rspack_import_3/* .string */.YjP().min(1),
|
|
13979
|
+
message: zod__rspack_import_3/* .string */.YjP().min(1),
|
|
13980
|
+
replyMode: zod__rspack_import_3/* ["enum"] */.k5n([
|
|
13981
|
+
"auto",
|
|
13982
|
+
"manual"
|
|
13983
|
+
]).optional(),
|
|
13984
|
+
hop: zod__rspack_import_3/* .number */.aig().int().min(0).optional(),
|
|
13985
|
+
correlationId: id.optional(),
|
|
13986
|
+
...routeFields
|
|
13987
|
+
}).strict();
|
|
13988
|
+
const bridgeStartSchema = zod__rspack_import_3/* .object */.Ikc({
|
|
13989
|
+
grokTarget: zod__rspack_import_3/* .string */.YjP().min(1),
|
|
13990
|
+
codexThreadId: id.optional(),
|
|
13991
|
+
expectedCwd: zod__rspack_import_3/* .string */.YjP().min(1).max(4096).optional(),
|
|
13992
|
+
busyPolicy: zod__rspack_import_3/* ["enum"] */.k5n([
|
|
13993
|
+
"steer",
|
|
13994
|
+
"reject"
|
|
13995
|
+
]).optional(),
|
|
13996
|
+
requestId: id.optional()
|
|
13997
|
+
}).strict();
|
|
13998
|
+
const bridgeStatusSchema = zod__rspack_import_3/* .object */.Ikc({
|
|
13999
|
+
bindingId: zod__rspack_import_3/* .string */.YjP().min(1).max(512).optional(),
|
|
14000
|
+
limit: zod__rspack_import_3/* .number */.aig().int().min(1).max(100).optional()
|
|
14001
|
+
}).strict();
|
|
14002
|
+
const bridgeStopSchema = zod__rspack_import_3/* .object */.Ikc({
|
|
14003
|
+
bindingId: zod__rspack_import_3/* .string */.YjP().min(1).max(512).optional(),
|
|
14004
|
+
all: zod__rspack_import_3/* .boolean */.zMY().optional(),
|
|
14005
|
+
worker: zod__rspack_import_3/* .boolean */.zMY().optional()
|
|
14006
|
+
}).strict().refine((x)=>!!x.bindingId || x.all === true || x.worker === true, "Specify bindingId, all or worker");
|
|
14007
|
+
const respondSchema = zod__rspack_import_3/* .object */.Ikc({
|
|
14008
|
+
interactionId: zod__rspack_import_3/* .string */.YjP().min(1).max(512),
|
|
14009
|
+
generation: id,
|
|
14010
|
+
threadId: id,
|
|
14011
|
+
turnId: id,
|
|
14012
|
+
bindingId: zod__rspack_import_3/* .string */.YjP().min(1).max(512).optional(),
|
|
14013
|
+
exchangeId: zod__rspack_import_3/* .string */.YjP().min(1).max(512).optional(),
|
|
14014
|
+
decision: zod__rspack_import_3/* ["enum"] */.k5n([
|
|
14015
|
+
"accept",
|
|
14016
|
+
"decline",
|
|
14017
|
+
"cancel"
|
|
14018
|
+
]).optional(),
|
|
14019
|
+
answersJson: zod__rspack_import_3/* .string */.YjP().min(2).max(65536).optional()
|
|
14020
|
+
}).strict().refine((x)=>!!x.bindingId || !!x.exchangeId, "Binding or exchange scope required").refine((x)=>!!x.decision !== !!x.answersJson, "Supply decision or answersJson");
|
|
14021
|
+
const answersSchema = zod__rspack_import_3/* .record */.g1P(zod__rspack_import_3/* .string */.YjP().min(1).max(128), zod__rspack_import_3/* .object */.Ikc({
|
|
14022
|
+
answers: zod__rspack_import_3/* .array */.YOg(zod__rspack_import_3/* .string */.YjP().max(8192)).max(20)
|
|
14023
|
+
}).strict());
|
|
14024
|
+
const relayResultSchema = zod__rspack_import_3/* .record */.g1P(zod__rspack_import_3/* .string */.YjP(), zod__rspack_import_3/* .json */.Pq9());
|
|
14025
|
+
function nativeCodexThread(context) {
|
|
14026
|
+
return context.host.state === "available" && (0,_agent_bundle_runtime__rspack_import_4/* .lineageHostFromClient */.bg)(context.host.value.name) === "codex" && context.lineage.state === "available" && context.lineage.source === "native" && context.lineage.value.resolution === "native" ? context.lineage.value.conversation : undefined;
|
|
14027
|
+
}
|
|
14028
|
+
function options(context) {
|
|
14029
|
+
return {
|
|
14030
|
+
pluginRoot: context?.plugin.state === "available" ? context.plugin.value.root : undefined,
|
|
14031
|
+
signal: context?.signal
|
|
14032
|
+
};
|
|
14033
|
+
}
|
|
14034
|
+
function destination(input, context) {
|
|
14035
|
+
const codexThreadId = input.codexThreadId ?? (context ? nativeCodexThread(context) : undefined);
|
|
14036
|
+
// Native workspace evidence belongs to the invocation, not the plugin installation directory.
|
|
14037
|
+
const workspace = context?.workspace;
|
|
14038
|
+
const expectedCwd = input.expectedCwd ?? (workspace?.state === "available" && workspace.source === "native" ? workspace.value.root : undefined);
|
|
14039
|
+
return {
|
|
14040
|
+
codexThreadId,
|
|
14041
|
+
expectedCwd
|
|
14042
|
+
};
|
|
14043
|
+
}
|
|
14044
|
+
async function grokSendOperation(input, context) {
|
|
14045
|
+
const route = destination(input, input.bindingId ? undefined : context);
|
|
14046
|
+
if (input.replyMode !== "manual" && (input.bindingId || route.codexThreadId)) return (0,_gbot_js__rspack_import_1/* .withRedactedErrors */.yF)(()=>(0,_managed_js__rspack_import_0/* .managedOperation */.Bb)("sendToGrok", {
|
|
14047
|
+
grokTarget: input.target,
|
|
14048
|
+
message: input.message,
|
|
14049
|
+
hop: input.hop,
|
|
14050
|
+
correlationId: input.correlationId,
|
|
14051
|
+
...route,
|
|
14052
|
+
...input.bindingId ? {
|
|
14053
|
+
bindingId: input.bindingId
|
|
14054
|
+
} : {},
|
|
14055
|
+
...input.requestId ? {
|
|
14056
|
+
requestId: input.requestId
|
|
14057
|
+
} : {}
|
|
14058
|
+
}, options(context)));
|
|
14059
|
+
if (input.replyMode === "auto") throw Error("Automatic reply delivery requires a native Codex source, codexThreadId or bindingId");
|
|
14060
|
+
const message = input.hop !== undefined || input.correlationId !== undefined ? (0,_codex_bridge_js__rspack_import_2/* .withEnvelopeHeader */.Mr)(input.message, (0,_codex_bridge_js__rspack_import_2/* .buildEnvelope */.nq)(input)) : input.message;
|
|
14061
|
+
const sent = await (0,_gbot_js__rspack_import_1/* .withRedactedErrors */.yF)(async ()=>(0,_gbot_js__rspack_import_1/* .sendPrompt */.LV)(await (0,_gbot_js__rspack_import_1/* .connectGateway */.Vq)(), input.target, message));
|
|
14062
|
+
return {
|
|
14063
|
+
result: sent.result,
|
|
14064
|
+
target: (0,_gbot_js__rspack_import_1/* .summarizeTarget */.rW)(sent.target),
|
|
14065
|
+
delivery: sent.delivery === "accepted" ? "accepted" : "unknown",
|
|
14066
|
+
...sent.delivery === "accepted" && typeof sent.messageId === "string" ? {
|
|
14067
|
+
messageId: sent.messageId
|
|
14068
|
+
} : {},
|
|
14069
|
+
replyRoute: {
|
|
14070
|
+
mode: "manual",
|
|
14071
|
+
reason: input.replyMode === "manual" ? "requested" : "source-unavailable"
|
|
14072
|
+
}
|
|
14073
|
+
};
|
|
14074
|
+
}
|
|
14075
|
+
async function bridgeOperation(method, input, context) {
|
|
14076
|
+
let routed = method === "startBinding" ? {
|
|
14077
|
+
...input,
|
|
14078
|
+
...destination(input, context)
|
|
14079
|
+
} : input;
|
|
14080
|
+
if (method === "respond") {
|
|
14081
|
+
const { decision, answersJson, ...scope } = respondSchema.parse(input);
|
|
14082
|
+
routed = {
|
|
14083
|
+
...scope,
|
|
14084
|
+
result: decision ? {
|
|
14085
|
+
decision
|
|
14086
|
+
} : {
|
|
14087
|
+
answers: answersSchema.parse(JSON.parse(answersJson))
|
|
14088
|
+
}
|
|
14089
|
+
};
|
|
14090
|
+
}
|
|
14091
|
+
if (method === "startBinding" && !routed.codexThreadId) throw Error("Specify codexThreadId when native Codex source identity is unavailable");
|
|
14092
|
+
return (0,_gbot_js__rspack_import_1/* .withRedactedErrors */.yF)(()=>(0,_managed_js__rspack_import_0/* .managedOperation */.Bb)(method, routed, options(context)));
|
|
14093
|
+
}
|
|
14094
|
+
function assertManagedSendOptions(input) {
|
|
14095
|
+
if (input.expectedTurnId !== undefined) throw Error("Managed relay does not support expectedTurnId; omit it to use managed guarded steering, or use a plain Codex send for an explicit turn guard");
|
|
14096
|
+
if (input.replyTo !== undefined || input.envelope === true) throw Error("Managed relay does not support legacy replyTo/envelope options; omit them or use a plain send. Use hop/correlationId for explicit managed chains");
|
|
14097
|
+
}
|
|
14098
|
+
async function codexReturnOperation(input, context) {
|
|
14099
|
+
assertManagedSendOptions(input);
|
|
14100
|
+
if (input.whenBusy === "queue") throw Error("Managed relay supports steer or reject, not experimental queue");
|
|
14101
|
+
return (0,_gbot_js__rspack_import_1/* .withRedactedErrors */.yF)(()=>(0,_managed_js__rspack_import_0/* .managedOperation */.Bb)("sendToCodex", {
|
|
14102
|
+
grokTarget: input.replyToGrok,
|
|
14103
|
+
codexThreadId: input.threadId,
|
|
14104
|
+
expectedCwd: input.expectedCwd,
|
|
14105
|
+
bindingId: input.bindingId,
|
|
14106
|
+
message: input.message,
|
|
14107
|
+
requestId: input.requestId,
|
|
14108
|
+
busyPolicy: input.whenBusy,
|
|
14109
|
+
hop: input.hop,
|
|
14110
|
+
correlationId: input.correlationId
|
|
14111
|
+
}, options(context)));
|
|
14112
|
+
}
|
|
14113
|
+
|
|
14114
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
14115
|
+
MB: () => (assertManagedSendOptions),
|
|
14116
|
+
bv: () => (grokSendOperation),
|
|
14117
|
+
lt: () => (codexReturnOperation),
|
|
14118
|
+
n1: () => (bridgeOperation)
|
|
14119
|
+
}, {
|
|
14120
|
+
Ax: relayResultSchema,
|
|
14121
|
+
d5: bridgeStopSchema,
|
|
14122
|
+
np: bridgeStatusSchema,
|
|
14123
|
+
v1: respondSchema,
|
|
14124
|
+
xD: bridgeStartSchema,
|
|
14125
|
+
zK: routeFields
|
|
14126
|
+
});
|
|
14127
|
+
|
|
14128
|
+
|
|
13134
14129
|
},
|
|
13135
14130
|
"./src/gbot.ts"(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
13136
14131
|
/* import */ var zod__rspack_import_2 = __webpack_require__("./node_modules/zod/v4/classic/schemas.js");
|
|
@@ -13235,7 +14230,10 @@ const transcriptEntries = (transcript)=>{
|
|
|
13235
14230
|
};
|
|
13236
14231
|
|
|
13237
14232
|
__webpack_require__.d(__webpack_exports__, {
|
|
14233
|
+
LV: () => (/* reexport safe */ _core_gateway_js__rspack_import_0.LV),
|
|
14234
|
+
Vq: () => (/* reexport safe */ _core_gateway_js__rspack_import_0.Vq)
|
|
13238
14235
|
}, {
|
|
14236
|
+
rW: summarizeTarget,
|
|
13239
14237
|
yF: withRedactedErrors
|
|
13240
14238
|
});
|
|
13241
14239
|
|
|
@@ -13276,12 +14274,6 @@ module.exports = __rspack_external_node_fs_1b05aee1;
|
|
|
13276
14274
|
module.exports = __rspack_external_node_fs_promises_3b710708;
|
|
13277
14275
|
|
|
13278
14276
|
|
|
13279
|
-
},
|
|
13280
|
-
"node:module"(module) {
|
|
13281
|
-
|
|
13282
|
-
module.exports = __rspack_external_node_module_9de3fa2f;
|
|
13283
|
-
|
|
13284
|
-
|
|
13285
14277
|
},
|
|
13286
14278
|
"node:net"(module) {
|
|
13287
14279
|
|
|
@@ -13306,6 +14298,12 @@ module.exports = __rspack_external_node_path_806ed179;
|
|
|
13306
14298
|
module.exports = __rspack_external_node_readline_d8f53bef;
|
|
13307
14299
|
|
|
13308
14300
|
|
|
14301
|
+
},
|
|
14302
|
+
"node:string_decoder"(module) {
|
|
14303
|
+
|
|
14304
|
+
module.exports = __rspack_external_node_string_decoder_69b9bd04;
|
|
14305
|
+
|
|
14306
|
+
|
|
13309
14307
|
},
|
|
13310
14308
|
"node:url"(module) {
|
|
13311
14309
|
|
|
@@ -14019,6 +15017,195 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
14019
15017
|
});
|
|
14020
15018
|
|
|
14021
15019
|
|
|
15020
|
+
},
|
|
15021
|
+
"./node_modules/@agent-bundle/runtime/dist/40.js"(__unused_rspack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
15022
|
+
/* import */ var node_fs_promises__rspack_import_0 = __webpack_require__("node:fs/promises");
|
|
15023
|
+
|
|
15024
|
+
|
|
15025
|
+
const CODEX_ROLLOUT_HEAD_BYTES = 1048576;
|
|
15026
|
+
const ROLLOUT_BASENAME = /rollout-\d{4}-\d{2}-\d{2}T\d{2}-\d{2}-\d{2}-([0-9a-f]{8}(?:-[0-9a-f]{4}){3}-[0-9a-f]{12})\.jsonl$/iu;
|
|
15027
|
+
const codexThreadFromRolloutPath = (path)=>{
|
|
15028
|
+
if (void 0 === path) return;
|
|
15029
|
+
const match = ROLLOUT_BASENAME.exec(path);
|
|
15030
|
+
return match?.[1]?.toLowerCase();
|
|
15031
|
+
};
|
|
15032
|
+
const record = (value)=>null === value || 'object' != typeof value || Array.isArray(value) ? void 0 : value;
|
|
15033
|
+
const codex_rollout_text = (value)=>'string' == typeof value && '' !== value.trim() ? value : void 0;
|
|
15034
|
+
const parseCodexRolloutMeta = (head)=>{
|
|
15035
|
+
const newline = head.indexOf('\n');
|
|
15036
|
+
const line = (-1 === newline ? head : head.slice(0, newline)).trim();
|
|
15037
|
+
if ('' === line) return;
|
|
15038
|
+
let parsed;
|
|
15039
|
+
try {
|
|
15040
|
+
parsed = JSON.parse(line);
|
|
15041
|
+
} catch {
|
|
15042
|
+
return;
|
|
15043
|
+
}
|
|
15044
|
+
const item = record(parsed);
|
|
15045
|
+
if (item?.['type'] !== 'session_meta') return;
|
|
15046
|
+
const payload = record(item['payload']);
|
|
15047
|
+
const thread = codex_rollout_text(payload?.['id']);
|
|
15048
|
+
if (void 0 === payload || void 0 === thread) return;
|
|
15049
|
+
const root = codex_rollout_text(payload['session_id']);
|
|
15050
|
+
const source = record(payload['source']);
|
|
15051
|
+
const subagent = record(source?.['subagent']);
|
|
15052
|
+
if (void 0 === subagent) {
|
|
15053
|
+
const kind = codex_rollout_text(source?.['subagent']);
|
|
15054
|
+
return {
|
|
15055
|
+
...void 0 === kind ? {} : {
|
|
15056
|
+
subagentKind: kind
|
|
15057
|
+
},
|
|
15058
|
+
...void 0 === root ? {} : {
|
|
15059
|
+
root
|
|
15060
|
+
},
|
|
15061
|
+
thread
|
|
15062
|
+
};
|
|
15063
|
+
}
|
|
15064
|
+
const [subagentKind] = Object.keys(subagent);
|
|
15065
|
+
const spawn = record(subagent['thread_spawn']);
|
|
15066
|
+
const parent = codex_rollout_text(spawn?.['parent_thread_id']) ?? codex_rollout_text(payload['parent_thread_id']);
|
|
15067
|
+
const rawDepth = spawn?.['depth'];
|
|
15068
|
+
const depth = 'number' == typeof rawDepth && Number.isInteger(rawDepth) && rawDepth > 0 ? rawDepth : void 0;
|
|
15069
|
+
const agentPath = codex_rollout_text(spawn?.['agent_path']) ?? codex_rollout_text(payload['agent_path']);
|
|
15070
|
+
return {
|
|
15071
|
+
...void 0 === agentPath ? {} : {
|
|
15072
|
+
agentPath
|
|
15073
|
+
},
|
|
15074
|
+
...void 0 === depth ? {} : {
|
|
15075
|
+
depth
|
|
15076
|
+
},
|
|
15077
|
+
...void 0 === parent ? {} : {
|
|
15078
|
+
parent
|
|
15079
|
+
},
|
|
15080
|
+
...void 0 === root ? {} : {
|
|
15081
|
+
root
|
|
15082
|
+
},
|
|
15083
|
+
...void 0 === subagentKind ? {} : {
|
|
15084
|
+
subagentKind
|
|
15085
|
+
},
|
|
15086
|
+
thread
|
|
15087
|
+
};
|
|
15088
|
+
};
|
|
15089
|
+
const readCodexRolloutHead = async (path)=>{
|
|
15090
|
+
let handle;
|
|
15091
|
+
try {
|
|
15092
|
+
handle = await promises_open(path, 'r');
|
|
15093
|
+
const buffer = Buffer.allocUnsafe(CODEX_ROLLOUT_HEAD_BYTES);
|
|
15094
|
+
let filled = 0;
|
|
15095
|
+
while(filled < buffer.length){
|
|
15096
|
+
const { bytesRead } = await handle.read(buffer, filled, buffer.length - filled, filled);
|
|
15097
|
+
if (0 === bytesRead) break;
|
|
15098
|
+
const newline = buffer.subarray(filled, filled + bytesRead).indexOf(0x0a);
|
|
15099
|
+
if (-1 !== newline) {
|
|
15100
|
+
filled += newline;
|
|
15101
|
+
break;
|
|
15102
|
+
}
|
|
15103
|
+
filled += bytesRead;
|
|
15104
|
+
}
|
|
15105
|
+
return buffer.subarray(0, filled).toString('utf8');
|
|
15106
|
+
} catch {
|
|
15107
|
+
return;
|
|
15108
|
+
} finally{
|
|
15109
|
+
await handle?.close().catch(()=>void 0);
|
|
15110
|
+
}
|
|
15111
|
+
};
|
|
15112
|
+
const readCodexSpawnLineage = async (path, thread, read = readCodexRolloutHead)=>{
|
|
15113
|
+
if (void 0 === path) return;
|
|
15114
|
+
const head = await read(path);
|
|
15115
|
+
if (void 0 === head) return;
|
|
15116
|
+
const meta = parseCodexRolloutMeta(head);
|
|
15117
|
+
if (void 0 === meta || meta.thread !== thread || void 0 === meta.parent || void 0 === meta.depth) return;
|
|
15118
|
+
return {
|
|
15119
|
+
...meta,
|
|
15120
|
+
depth: meta.depth,
|
|
15121
|
+
parent: meta.parent
|
|
15122
|
+
};
|
|
15123
|
+
};
|
|
15124
|
+
const nativeString = (native, key)=>{
|
|
15125
|
+
const value = native[key];
|
|
15126
|
+
return 'string' == typeof value && '' !== value.trim() ? value : void 0;
|
|
15127
|
+
};
|
|
15128
|
+
const lineageHostFromClient = (clientName)=>{
|
|
15129
|
+
if (void 0 === clientName) return;
|
|
15130
|
+
if (clientName.startsWith('claude')) return 'claude';
|
|
15131
|
+
if (clientName.startsWith('codex')) return 'codex';
|
|
15132
|
+
if (clientName.startsWith('cursor')) return 'cursor';
|
|
15133
|
+
};
|
|
15134
|
+
const lineageCarrier = (host, native)=>{
|
|
15135
|
+
switch(host){
|
|
15136
|
+
case 'claude':
|
|
15137
|
+
return {
|
|
15138
|
+
conversation: nativeString(native, 'agent_id') ?? nativeString(native, 'session_id'),
|
|
15139
|
+
generation: nativeString(native, 'prompt_id'),
|
|
15140
|
+
root: nativeString(native, 'session_id')
|
|
15141
|
+
};
|
|
15142
|
+
case 'codex':
|
|
15143
|
+
return {
|
|
15144
|
+
conversation: nativeString(native, 'agent_id') ?? nativeString(native, 'session_id'),
|
|
15145
|
+
generation: nativeString(native, 'turn_id'),
|
|
15146
|
+
root: nativeString(native, 'session_id')
|
|
15147
|
+
};
|
|
15148
|
+
case 'cursor':
|
|
15149
|
+
return {
|
|
15150
|
+
conversation: nativeString(native, 'conversation_id') ?? nativeString(native, 'session_id'),
|
|
15151
|
+
generation: nativeString(native, 'generation_id'),
|
|
15152
|
+
root: void 0
|
|
15153
|
+
};
|
|
15154
|
+
default:
|
|
15155
|
+
{
|
|
15156
|
+
const unreachable = host;
|
|
15157
|
+
throw new Error(`Unhandled lineage host ${String(unreachable)}`);
|
|
15158
|
+
}
|
|
15159
|
+
}
|
|
15160
|
+
};
|
|
15161
|
+
const resolveNativeLineage = (host, native)=>{
|
|
15162
|
+
const carrier = lineageCarrier(host, native);
|
|
15163
|
+
if ('cursor' === host || void 0 === carrier.conversation || void 0 === carrier.root) return unavailable('no-shared-runtime');
|
|
15164
|
+
if (carrier.conversation !== carrier.root) return unavailable('no-shared-runtime');
|
|
15165
|
+
return available({
|
|
15166
|
+
conversation: carrier.root,
|
|
15167
|
+
depth: 0,
|
|
15168
|
+
...void 0 === carrier.generation ? {} : {
|
|
15169
|
+
generation: carrier.generation
|
|
15170
|
+
},
|
|
15171
|
+
resolution: 'native',
|
|
15172
|
+
root: carrier.root
|
|
15173
|
+
}, 'native');
|
|
15174
|
+
};
|
|
15175
|
+
const resolveStandaloneLineage = async (host, native, read)=>{
|
|
15176
|
+
const fromPayload = resolveNativeLineage(host, native);
|
|
15177
|
+
if ('codex' !== host || 'available' === fromPayload.state) return fromPayload;
|
|
15178
|
+
const carrier = lineageCarrier(host, native);
|
|
15179
|
+
if (void 0 === carrier.conversation || void 0 === carrier.root) return fromPayload;
|
|
15180
|
+
const ownRollout = 'SubagentStop' === nativeString(native, 'hook_event_name') ? nativeString(native, "agent_transcript_path") : nativeString(native, "transcript_path");
|
|
15181
|
+
const spawn = await readCodexSpawnLineage(ownRollout, carrier.conversation, read);
|
|
15182
|
+
if (void 0 === spawn) return fromPayload;
|
|
15183
|
+
const type = nativeString(native, 'agent_type');
|
|
15184
|
+
return available({
|
|
15185
|
+
conversation: carrier.conversation,
|
|
15186
|
+
depth: spawn.depth,
|
|
15187
|
+
...void 0 === carrier.generation ? {} : {
|
|
15188
|
+
generation: carrier.generation
|
|
15189
|
+
},
|
|
15190
|
+
parent: spawn.parent,
|
|
15191
|
+
resolution: "transcript",
|
|
15192
|
+
root: carrier.root,
|
|
15193
|
+
subagent: {
|
|
15194
|
+
id: carrier.conversation,
|
|
15195
|
+
...void 0 === type ? {} : {
|
|
15196
|
+
type
|
|
15197
|
+
}
|
|
15198
|
+
}
|
|
15199
|
+
}, 'derived');
|
|
15200
|
+
};
|
|
15201
|
+
|
|
15202
|
+
|
|
15203
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
15204
|
+
}, {
|
|
15205
|
+
bg: lineageHostFromClient
|
|
15206
|
+
});
|
|
15207
|
+
|
|
15208
|
+
|
|
14022
15209
|
},
|
|
14023
15210
|
"./node_modules/@agent-bundle/runtime/dist/49.js"(__unused_rspack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
14024
15211
|
/* import */ var node_crypto__rspack_import_0 = __webpack_require__("node:crypto");
|
|
@@ -14499,6 +15686,7 @@ const providerRequest = ({ notices, state, ...axes })=>Object.freeze({
|
|
|
14499
15686
|
__webpack_require__.d(__webpack_exports__, {
|
|
14500
15687
|
r8: () => (AgentRequestError)
|
|
14501
15688
|
}, {
|
|
15689
|
+
MA: agent,
|
|
14502
15690
|
hU: unavailable,
|
|
14503
15691
|
iC: runAgentRequest,
|
|
14504
15692
|
qC: available
|
|
@@ -74600,6 +75788,7 @@ function preprocess(fn, schema) {
|
|
|
74600
75788
|
__webpack_require__.d(__webpack_exports__, {
|
|
74601
75789
|
Ikc: () => (object),
|
|
74602
75790
|
KCZ: () => (union),
|
|
75791
|
+
L5J: () => (unknown),
|
|
74603
75792
|
Pq9: () => (json),
|
|
74604
75793
|
YOg: () => (array),
|
|
74605
75794
|
YjP: () => (string),
|
|
@@ -82877,9 +84066,9 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
82877
84066
|
__webpack_require__.a(__webpack_module__, async function (__rspack_load_async_deps, __rspack_async_done) { try {
|
|
82878
84067
|
/* import */ var agent_bundle_launch_env_layer__rspack_import_0 = __webpack_require__("./.agent-bundle-virtual/bin-gbot-0.mjs");
|
|
82879
84068
|
/* import */ var agent_bundle_cli_entry__rspack_import_1 = __webpack_require__("./node_modules/agent-bundle/dist/cli-entry.js");
|
|
82880
|
-
/* import */ var
|
|
82881
|
-
/* import */ var
|
|
82882
|
-
/* import */ var
|
|
84069
|
+
/* import */ var _agent_bundle_runtime__rspack_import_34 = __webpack_require__("./node_modules/@agent-bundle/runtime/dist/49.js");
|
|
84070
|
+
/* import */ var _agent_bundle_runtime__rspack_import_35 = __webpack_require__("./node_modules/@agent-bundle/runtime/dist/736.js");
|
|
84071
|
+
/* import */ var _agent_bundle_runtime__rspack_import_36 = __webpack_require__("./node_modules/@agent-bundle/runtime/dist/index.js");
|
|
82883
84072
|
/* import */ var node_url__rspack_import_2 = __webpack_require__("node:url");
|
|
82884
84073
|
/* import */ var node_worker_threads__rspack_import_3 = __webpack_require__("node:worker_threads");
|
|
82885
84074
|
/* import */ var _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_bots_create_tsx__rspack_import_4 = __webpack_require__("./src/cli/bots/create.tsx");
|
|
@@ -82887,24 +84076,31 @@ __webpack_require__.a(__webpack_module__, async function (__rspack_load_async_de
|
|
|
82887
84076
|
/* import */ var _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_bots_get_tsx__rspack_import_6 = __webpack_require__("./src/cli/bots/get.tsx");
|
|
82888
84077
|
/* import */ var _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_bots_list_tsx__rspack_import_7 = __webpack_require__("./src/cli/bots/list.tsx");
|
|
82889
84078
|
/* import */ var _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_bots_update_tsx__rspack_import_8 = __webpack_require__("./src/cli/bots/update.tsx");
|
|
82890
|
-
/* import */ var
|
|
82891
|
-
/* import */ var
|
|
82892
|
-
/* import */ var
|
|
82893
|
-
/* import */ var
|
|
82894
|
-
/* import */ var
|
|
82895
|
-
/* import */ var
|
|
82896
|
-
/* import */ var
|
|
82897
|
-
/* import */ var
|
|
82898
|
-
/* import */ var
|
|
82899
|
-
/* import */ var
|
|
82900
|
-
/* import */ var
|
|
82901
|
-
/* import */ var
|
|
82902
|
-
/* import */ var
|
|
82903
|
-
/* import */ var
|
|
82904
|
-
/* import */ var
|
|
82905
|
-
/* import */ var
|
|
82906
|
-
/* import */ var
|
|
82907
|
-
/* import */ var
|
|
84079
|
+
/* import */ var _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_codex_bridge_respond_tsx__rspack_import_9 = __webpack_require__("./src/cli/codex/bridge/respond.tsx");
|
|
84080
|
+
/* import */ var _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_codex_bridge_run_tsx__rspack_import_10 = __webpack_require__("./src/cli/codex/bridge/run.tsx");
|
|
84081
|
+
/* import */ var _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_codex_bridge_start_tsx__rspack_import_11 = __webpack_require__("./src/cli/codex/bridge/start.tsx");
|
|
84082
|
+
/* import */ var _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_codex_bridge_status_tsx__rspack_import_12 = __webpack_require__("./src/cli/codex/bridge/status.tsx");
|
|
84083
|
+
/* import */ var _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_codex_bridge_stop_tsx__rspack_import_13 = __webpack_require__("./src/cli/codex/bridge/stop.tsx");
|
|
84084
|
+
/* import */ var _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_codex_desktop_shim_tsx__rspack_import_14 = __webpack_require__("./src/cli/codex/desktop-shim.tsx");
|
|
84085
|
+
/* import */ var _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_codex_list_threads_tsx__rspack_import_15 = __webpack_require__("./src/cli/codex/list-threads.tsx");
|
|
84086
|
+
/* import */ var _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_codex_queue_tsx__rspack_import_16 = __webpack_require__("./src/cli/codex/queue.tsx");
|
|
84087
|
+
/* import */ var _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_codex_send_tsx__rspack_import_17 = __webpack_require__("./src/cli/codex/send.tsx");
|
|
84088
|
+
/* import */ var _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_codex_status_tsx__rspack_import_18 = __webpack_require__("./src/cli/codex/status.tsx");
|
|
84089
|
+
/* import */ var _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_codex_wait_tsx__rspack_import_19 = __webpack_require__("./src/cli/codex/wait.tsx");
|
|
84090
|
+
/* import */ var _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_codex_watch_tsx__rspack_import_20 = __webpack_require__("./src/cli/codex/watch.tsx");
|
|
84091
|
+
/* import */ var _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_doctor_tsx__rspack_import_21 = __webpack_require__("./src/cli/doctor.tsx");
|
|
84092
|
+
/* import */ var _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_groups_add_tsx__rspack_import_22 = __webpack_require__("./src/cli/groups/add.tsx");
|
|
84093
|
+
/* import */ var _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_groups_create_tsx__rspack_import_23 = __webpack_require__("./src/cli/groups/create.tsx");
|
|
84094
|
+
/* import */ var _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_groups_delete_tsx__rspack_import_24 = __webpack_require__("./src/cli/groups/delete.tsx");
|
|
84095
|
+
/* import */ var _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_groups_get_tsx__rspack_import_25 = __webpack_require__("./src/cli/groups/get.tsx");
|
|
84096
|
+
/* import */ var _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_groups_list_tsx__rspack_import_26 = __webpack_require__("./src/cli/groups/list.tsx");
|
|
84097
|
+
/* import */ var _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_groups_members_tsx__rspack_import_27 = __webpack_require__("./src/cli/groups/members.tsx");
|
|
84098
|
+
/* import */ var _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_groups_remove_tsx__rspack_import_28 = __webpack_require__("./src/cli/groups/remove.tsx");
|
|
84099
|
+
/* import */ var _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_groups_set_tsx__rspack_import_29 = __webpack_require__("./src/cli/groups/set.tsx");
|
|
84100
|
+
/* import */ var _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_groups_update_tsx__rspack_import_30 = __webpack_require__("./src/cli/groups/update.tsx");
|
|
84101
|
+
/* import */ var _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_history_tsx__rspack_import_31 = __webpack_require__("./src/cli/history.tsx");
|
|
84102
|
+
/* import */ var _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_send_tsx__rspack_import_32 = __webpack_require__("./src/cli/send.tsx");
|
|
84103
|
+
/* import */ var _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_thread_tsx__rspack_import_33 = __webpack_require__("./src/cli/thread.tsx");
|
|
82908
84104
|
|
|
82909
84105
|
|
|
82910
84106
|
|
|
@@ -82921,42 +84117,56 @@ const route3 = Object.assign({}, Reflect.get(_home_runner_work_grok_bot_cli_grok
|
|
|
82921
84117
|
|
|
82922
84118
|
const route4 = Object.assign({}, Reflect.get(_home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_bots_update_tsx__rspack_import_8, 'default'), _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_bots_update_tsx__rspack_import_8);
|
|
82923
84119
|
|
|
82924
|
-
const route5 = Object.assign({}, Reflect.get(
|
|
84120
|
+
const route5 = Object.assign({}, Reflect.get(_home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_codex_bridge_respond_tsx__rspack_import_9, 'default'), _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_codex_bridge_respond_tsx__rspack_import_9);
|
|
84121
|
+
|
|
84122
|
+
const route6 = Object.assign({}, Reflect.get(_home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_codex_bridge_run_tsx__rspack_import_10, 'default'), _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_codex_bridge_run_tsx__rspack_import_10);
|
|
84123
|
+
|
|
84124
|
+
const route7 = Object.assign({}, Reflect.get(_home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_codex_bridge_start_tsx__rspack_import_11, 'default'), _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_codex_bridge_start_tsx__rspack_import_11);
|
|
84125
|
+
|
|
84126
|
+
const route8 = Object.assign({}, Reflect.get(_home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_codex_bridge_status_tsx__rspack_import_12, 'default'), _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_codex_bridge_status_tsx__rspack_import_12);
|
|
84127
|
+
|
|
84128
|
+
const route9 = Object.assign({}, Reflect.get(_home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_codex_bridge_stop_tsx__rspack_import_13, 'default'), _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_codex_bridge_stop_tsx__rspack_import_13);
|
|
82925
84129
|
|
|
82926
|
-
const
|
|
84130
|
+
const route10 = Object.assign({}, Reflect.get(_home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_codex_desktop_shim_tsx__rspack_import_14, 'default'), _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_codex_desktop_shim_tsx__rspack_import_14);
|
|
82927
84131
|
|
|
82928
|
-
const
|
|
84132
|
+
const route11 = Object.assign({}, Reflect.get(_home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_codex_list_threads_tsx__rspack_import_15, 'default'), _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_codex_list_threads_tsx__rspack_import_15);
|
|
82929
84133
|
|
|
82930
|
-
const
|
|
84134
|
+
const route12 = Object.assign({}, Reflect.get(_home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_codex_queue_tsx__rspack_import_16, 'default'), _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_codex_queue_tsx__rspack_import_16);
|
|
82931
84135
|
|
|
82932
|
-
const
|
|
84136
|
+
const route13 = Object.assign({}, Reflect.get(_home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_codex_send_tsx__rspack_import_17, 'default'), _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_codex_send_tsx__rspack_import_17);
|
|
82933
84137
|
|
|
82934
|
-
const
|
|
84138
|
+
const route14 = Object.assign({}, Reflect.get(_home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_codex_status_tsx__rspack_import_18, 'default'), _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_codex_status_tsx__rspack_import_18);
|
|
82935
84139
|
|
|
82936
|
-
const
|
|
84140
|
+
const route15 = Object.assign({}, Reflect.get(_home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_codex_wait_tsx__rspack_import_19, 'default'), _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_codex_wait_tsx__rspack_import_19);
|
|
82937
84141
|
|
|
82938
|
-
const
|
|
84142
|
+
const route16 = Object.assign({}, Reflect.get(_home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_codex_watch_tsx__rspack_import_20, 'default'), _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_codex_watch_tsx__rspack_import_20);
|
|
82939
84143
|
|
|
82940
|
-
const
|
|
84144
|
+
const route17 = Object.assign({}, Reflect.get(_home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_doctor_tsx__rspack_import_21, 'default'), _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_doctor_tsx__rspack_import_21);
|
|
82941
84145
|
|
|
82942
|
-
const
|
|
84146
|
+
const route18 = Object.assign({}, Reflect.get(_home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_groups_add_tsx__rspack_import_22, 'default'), _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_groups_add_tsx__rspack_import_22);
|
|
82943
84147
|
|
|
82944
|
-
const
|
|
84148
|
+
const route19 = Object.assign({}, Reflect.get(_home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_groups_create_tsx__rspack_import_23, 'default'), _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_groups_create_tsx__rspack_import_23);
|
|
82945
84149
|
|
|
82946
|
-
const
|
|
84150
|
+
const route20 = Object.assign({}, Reflect.get(_home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_groups_delete_tsx__rspack_import_24, 'default'), _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_groups_delete_tsx__rspack_import_24);
|
|
82947
84151
|
|
|
82948
|
-
const
|
|
84152
|
+
const route21 = Object.assign({}, Reflect.get(_home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_groups_get_tsx__rspack_import_25, 'default'), _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_groups_get_tsx__rspack_import_25);
|
|
82949
84153
|
|
|
82950
|
-
const
|
|
84154
|
+
const route22 = Object.assign({}, Reflect.get(_home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_groups_list_tsx__rspack_import_26, 'default'), _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_groups_list_tsx__rspack_import_26);
|
|
82951
84155
|
|
|
82952
|
-
const
|
|
84156
|
+
const route23 = Object.assign({}, Reflect.get(_home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_groups_members_tsx__rspack_import_27, 'default'), _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_groups_members_tsx__rspack_import_27);
|
|
82953
84157
|
|
|
82954
|
-
const
|
|
84158
|
+
const route24 = Object.assign({}, Reflect.get(_home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_groups_remove_tsx__rspack_import_28, 'default'), _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_groups_remove_tsx__rspack_import_28);
|
|
82955
84159
|
|
|
82956
|
-
const
|
|
84160
|
+
const route25 = Object.assign({}, Reflect.get(_home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_groups_set_tsx__rspack_import_29, 'default'), _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_groups_set_tsx__rspack_import_29);
|
|
82957
84161
|
|
|
82958
|
-
const
|
|
82959
|
-
|
|
84162
|
+
const route26 = Object.assign({}, Reflect.get(_home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_groups_update_tsx__rspack_import_30, 'default'), _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_groups_update_tsx__rspack_import_30);
|
|
84163
|
+
|
|
84164
|
+
const route27 = Object.assign({}, Reflect.get(_home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_history_tsx__rspack_import_31, 'default'), _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_history_tsx__rspack_import_31);
|
|
84165
|
+
|
|
84166
|
+
const route28 = Object.assign({}, Reflect.get(_home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_send_tsx__rspack_import_32, 'default'), _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_send_tsx__rspack_import_32);
|
|
84167
|
+
|
|
84168
|
+
const route29 = Object.assign({}, Reflect.get(_home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_thread_tsx__rspack_import_33, 'default'), _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_thread_tsx__rspack_import_33);
|
|
84169
|
+
const pluginRoot = (0,_agent_bundle_runtime__rspack_import_34/* .resolvePluginRoot */.E7)({
|
|
82960
84170
|
fallback: (0,node_url__rspack_import_2.fileURLToPath)(new URL('..', import.meta.url)),
|
|
82961
84171
|
stateAnchor: 'user-data'
|
|
82962
84172
|
});
|
|
@@ -82981,59 +84191,80 @@ const routes = Object.freeze({
|
|
|
82981
84191
|
"cli:bots/update": Object.freeze({
|
|
82982
84192
|
module: route4
|
|
82983
84193
|
}),
|
|
82984
|
-
"cli:codex/
|
|
84194
|
+
"cli:codex/bridge/respond": Object.freeze({
|
|
82985
84195
|
module: route5
|
|
82986
84196
|
}),
|
|
82987
|
-
"cli:codex/
|
|
84197
|
+
"cli:codex/bridge/run": Object.freeze({
|
|
82988
84198
|
module: route6
|
|
82989
84199
|
}),
|
|
82990
|
-
"cli:codex/
|
|
84200
|
+
"cli:codex/bridge/start": Object.freeze({
|
|
82991
84201
|
module: route7
|
|
82992
84202
|
}),
|
|
82993
|
-
"cli:codex/
|
|
84203
|
+
"cli:codex/bridge/status": Object.freeze({
|
|
82994
84204
|
module: route8
|
|
82995
84205
|
}),
|
|
82996
|
-
"cli:codex/
|
|
84206
|
+
"cli:codex/bridge/stop": Object.freeze({
|
|
82997
84207
|
module: route9
|
|
82998
84208
|
}),
|
|
82999
|
-
"cli:
|
|
84209
|
+
"cli:codex/desktop-shim": Object.freeze({
|
|
83000
84210
|
module: route10
|
|
83001
84211
|
}),
|
|
83002
|
-
"cli:
|
|
84212
|
+
"cli:codex/list-threads": Object.freeze({
|
|
83003
84213
|
module: route11
|
|
83004
84214
|
}),
|
|
83005
|
-
"cli:
|
|
84215
|
+
"cli:codex/queue": Object.freeze({
|
|
83006
84216
|
module: route12
|
|
83007
84217
|
}),
|
|
83008
|
-
"cli:
|
|
84218
|
+
"cli:codex/send": Object.freeze({
|
|
83009
84219
|
module: route13
|
|
83010
84220
|
}),
|
|
83011
|
-
"cli:
|
|
84221
|
+
"cli:codex/status": Object.freeze({
|
|
83012
84222
|
module: route14
|
|
83013
84223
|
}),
|
|
83014
|
-
"cli:
|
|
84224
|
+
"cli:codex/wait": Object.freeze({
|
|
83015
84225
|
module: route15
|
|
83016
84226
|
}),
|
|
83017
|
-
"cli:
|
|
84227
|
+
"cli:codex/watch": Object.freeze({
|
|
83018
84228
|
module: route16
|
|
83019
84229
|
}),
|
|
83020
|
-
"cli:
|
|
84230
|
+
"cli:doctor": Object.freeze({
|
|
83021
84231
|
module: route17
|
|
83022
84232
|
}),
|
|
83023
|
-
"cli:groups/
|
|
84233
|
+
"cli:groups/add": Object.freeze({
|
|
83024
84234
|
module: route18
|
|
83025
84235
|
}),
|
|
83026
|
-
"cli:groups/
|
|
84236
|
+
"cli:groups/create": Object.freeze({
|
|
83027
84237
|
module: route19
|
|
83028
84238
|
}),
|
|
83029
|
-
"cli:
|
|
84239
|
+
"cli:groups/delete": Object.freeze({
|
|
83030
84240
|
module: route20
|
|
83031
84241
|
}),
|
|
83032
|
-
"cli:
|
|
84242
|
+
"cli:groups/get": Object.freeze({
|
|
83033
84243
|
module: route21
|
|
83034
84244
|
}),
|
|
83035
|
-
"cli:
|
|
84245
|
+
"cli:groups/list": Object.freeze({
|
|
83036
84246
|
module: route22
|
|
84247
|
+
}),
|
|
84248
|
+
"cli:groups/members": Object.freeze({
|
|
84249
|
+
module: route23
|
|
84250
|
+
}),
|
|
84251
|
+
"cli:groups/remove": Object.freeze({
|
|
84252
|
+
module: route24
|
|
84253
|
+
}),
|
|
84254
|
+
"cli:groups/set": Object.freeze({
|
|
84255
|
+
module: route25
|
|
84256
|
+
}),
|
|
84257
|
+
"cli:groups/update": Object.freeze({
|
|
84258
|
+
module: route26
|
|
84259
|
+
}),
|
|
84260
|
+
"cli:history": Object.freeze({
|
|
84261
|
+
module: route27
|
|
84262
|
+
}),
|
|
84263
|
+
"cli:send": Object.freeze({
|
|
84264
|
+
module: route28
|
|
84265
|
+
}),
|
|
84266
|
+
"cli:thread": Object.freeze({
|
|
84267
|
+
module: route29
|
|
83037
84268
|
})
|
|
83038
84269
|
});
|
|
83039
84270
|
const commands = Object.freeze([
|
|
@@ -83333,6 +84564,224 @@ const commands = Object.freeze([
|
|
|
83333
84564
|
"rendered": true,
|
|
83334
84565
|
"routeId": "cli:bots/update"
|
|
83335
84566
|
},
|
|
84567
|
+
{
|
|
84568
|
+
"aliases": [],
|
|
84569
|
+
"description": "Managed Grok/Codex bridge respond.",
|
|
84570
|
+
"exitCode": "result",
|
|
84571
|
+
"options": [
|
|
84572
|
+
{
|
|
84573
|
+
"description": "JSON object mapping each advertised question ID to {\"answers\":[\"answer\"]}; exact IDs required.",
|
|
84574
|
+
"key": "answersJson",
|
|
84575
|
+
"kind": "string",
|
|
84576
|
+
"option": "answers-json",
|
|
84577
|
+
"repeated": false,
|
|
84578
|
+
"required": false
|
|
84579
|
+
},
|
|
84580
|
+
{
|
|
84581
|
+
"key": "bindingId",
|
|
84582
|
+
"kind": "string",
|
|
84583
|
+
"option": "binding-id",
|
|
84584
|
+
"repeated": false,
|
|
84585
|
+
"required": false
|
|
84586
|
+
},
|
|
84587
|
+
{
|
|
84588
|
+
"choices": [
|
|
84589
|
+
"accept",
|
|
84590
|
+
"decline",
|
|
84591
|
+
"cancel"
|
|
84592
|
+
],
|
|
84593
|
+
"key": "decision",
|
|
84594
|
+
"kind": "enum",
|
|
84595
|
+
"option": "decision",
|
|
84596
|
+
"repeated": false,
|
|
84597
|
+
"required": false
|
|
84598
|
+
},
|
|
84599
|
+
{
|
|
84600
|
+
"key": "exchangeId",
|
|
84601
|
+
"kind": "string",
|
|
84602
|
+
"option": "exchange-id",
|
|
84603
|
+
"repeated": false,
|
|
84604
|
+
"required": false
|
|
84605
|
+
},
|
|
84606
|
+
{
|
|
84607
|
+
"key": "generation",
|
|
84608
|
+
"kind": "string",
|
|
84609
|
+
"option": "generation",
|
|
84610
|
+
"repeated": false,
|
|
84611
|
+
"required": true
|
|
84612
|
+
},
|
|
84613
|
+
{
|
|
84614
|
+
"key": "interactionId",
|
|
84615
|
+
"kind": "string",
|
|
84616
|
+
"option": "interaction-id",
|
|
84617
|
+
"repeated": false,
|
|
84618
|
+
"required": true
|
|
84619
|
+
},
|
|
84620
|
+
{
|
|
84621
|
+
"key": "threadId",
|
|
84622
|
+
"kind": "string",
|
|
84623
|
+
"option": "thread-id",
|
|
84624
|
+
"repeated": false,
|
|
84625
|
+
"required": true
|
|
84626
|
+
},
|
|
84627
|
+
{
|
|
84628
|
+
"key": "turnId",
|
|
84629
|
+
"kind": "string",
|
|
84630
|
+
"option": "turn-id",
|
|
84631
|
+
"repeated": false,
|
|
84632
|
+
"required": true
|
|
84633
|
+
}
|
|
84634
|
+
],
|
|
84635
|
+
"path": [
|
|
84636
|
+
"codex",
|
|
84637
|
+
"bridge",
|
|
84638
|
+
"respond"
|
|
84639
|
+
],
|
|
84640
|
+
"rendered": true,
|
|
84641
|
+
"routeId": "cli:codex/bridge/respond"
|
|
84642
|
+
},
|
|
84643
|
+
{
|
|
84644
|
+
"aliases": [],
|
|
84645
|
+
"description": "Run a bounded foreground relay (up to 23 hours). Use the packaged gbot-relay.mjs script for unlimited service lifetime.",
|
|
84646
|
+
"exitCode": "result",
|
|
84647
|
+
"options": [
|
|
84648
|
+
{
|
|
84649
|
+
"description": "Foreground lifetime in milliseconds (100..82800000; default 23h).",
|
|
84650
|
+
"key": "lifetimeMs",
|
|
84651
|
+
"kind": "number",
|
|
84652
|
+
"option": "lifetime-ms",
|
|
84653
|
+
"repeated": false,
|
|
84654
|
+
"required": false
|
|
84655
|
+
}
|
|
84656
|
+
],
|
|
84657
|
+
"path": [
|
|
84658
|
+
"codex",
|
|
84659
|
+
"bridge",
|
|
84660
|
+
"run"
|
|
84661
|
+
],
|
|
84662
|
+
"render": {
|
|
84663
|
+
"maxElapsedMs": 86400000
|
|
84664
|
+
},
|
|
84665
|
+
"rendered": true,
|
|
84666
|
+
"routeId": "cli:codex/bridge/run"
|
|
84667
|
+
},
|
|
84668
|
+
{
|
|
84669
|
+
"aliases": [],
|
|
84670
|
+
"description": "Managed Grok/Codex bridge start.",
|
|
84671
|
+
"exitCode": "result",
|
|
84672
|
+
"options": [
|
|
84673
|
+
{
|
|
84674
|
+
"choices": [
|
|
84675
|
+
"steer",
|
|
84676
|
+
"reject"
|
|
84677
|
+
],
|
|
84678
|
+
"key": "busyPolicy",
|
|
84679
|
+
"kind": "enum",
|
|
84680
|
+
"option": "busy-policy",
|
|
84681
|
+
"repeated": false,
|
|
84682
|
+
"required": false
|
|
84683
|
+
},
|
|
84684
|
+
{
|
|
84685
|
+
"key": "codexThreadId",
|
|
84686
|
+
"kind": "string",
|
|
84687
|
+
"option": "codex-thread-id",
|
|
84688
|
+
"repeated": false,
|
|
84689
|
+
"required": false
|
|
84690
|
+
},
|
|
84691
|
+
{
|
|
84692
|
+
"key": "expectedCwd",
|
|
84693
|
+
"kind": "string",
|
|
84694
|
+
"option": "expected-cwd",
|
|
84695
|
+
"repeated": false,
|
|
84696
|
+
"required": false
|
|
84697
|
+
},
|
|
84698
|
+
{
|
|
84699
|
+
"key": "grokTarget",
|
|
84700
|
+
"kind": "string",
|
|
84701
|
+
"option": "grok-target",
|
|
84702
|
+
"positional": 0,
|
|
84703
|
+
"repeated": false,
|
|
84704
|
+
"required": true
|
|
84705
|
+
},
|
|
84706
|
+
{
|
|
84707
|
+
"key": "requestId",
|
|
84708
|
+
"kind": "string",
|
|
84709
|
+
"option": "request-id",
|
|
84710
|
+
"repeated": false,
|
|
84711
|
+
"required": false
|
|
84712
|
+
}
|
|
84713
|
+
],
|
|
84714
|
+
"path": [
|
|
84715
|
+
"codex",
|
|
84716
|
+
"bridge",
|
|
84717
|
+
"start"
|
|
84718
|
+
],
|
|
84719
|
+
"rendered": true,
|
|
84720
|
+
"routeId": "cli:codex/bridge/start"
|
|
84721
|
+
},
|
|
84722
|
+
{
|
|
84723
|
+
"aliases": [],
|
|
84724
|
+
"description": "Managed Grok/Codex bridge status.",
|
|
84725
|
+
"exitCode": "result",
|
|
84726
|
+
"options": [
|
|
84727
|
+
{
|
|
84728
|
+
"key": "bindingId",
|
|
84729
|
+
"kind": "string",
|
|
84730
|
+
"option": "binding-id",
|
|
84731
|
+
"repeated": false,
|
|
84732
|
+
"required": false
|
|
84733
|
+
},
|
|
84734
|
+
{
|
|
84735
|
+
"key": "limit",
|
|
84736
|
+
"kind": "number",
|
|
84737
|
+
"option": "limit",
|
|
84738
|
+
"repeated": false,
|
|
84739
|
+
"required": false
|
|
84740
|
+
}
|
|
84741
|
+
],
|
|
84742
|
+
"path": [
|
|
84743
|
+
"codex",
|
|
84744
|
+
"bridge",
|
|
84745
|
+
"status"
|
|
84746
|
+
],
|
|
84747
|
+
"rendered": true,
|
|
84748
|
+
"routeId": "cli:codex/bridge/status"
|
|
84749
|
+
},
|
|
84750
|
+
{
|
|
84751
|
+
"aliases": [],
|
|
84752
|
+
"description": "Managed Grok/Codex bridge stop.",
|
|
84753
|
+
"exitCode": "result",
|
|
84754
|
+
"options": [
|
|
84755
|
+
{
|
|
84756
|
+
"key": "all",
|
|
84757
|
+
"kind": "boolean",
|
|
84758
|
+
"option": "all",
|
|
84759
|
+
"repeated": false,
|
|
84760
|
+
"required": false
|
|
84761
|
+
},
|
|
84762
|
+
{
|
|
84763
|
+
"key": "bindingId",
|
|
84764
|
+
"kind": "string",
|
|
84765
|
+
"option": "binding-id",
|
|
84766
|
+
"repeated": false,
|
|
84767
|
+
"required": false
|
|
84768
|
+
},
|
|
84769
|
+
{
|
|
84770
|
+
"key": "worker",
|
|
84771
|
+
"kind": "boolean",
|
|
84772
|
+
"option": "worker",
|
|
84773
|
+
"repeated": false,
|
|
84774
|
+
"required": false
|
|
84775
|
+
}
|
|
84776
|
+
],
|
|
84777
|
+
"path": [
|
|
84778
|
+
"codex",
|
|
84779
|
+
"bridge",
|
|
84780
|
+
"stop"
|
|
84781
|
+
],
|
|
84782
|
+
"rendered": true,
|
|
84783
|
+
"routeId": "cli:codex/bridge/stop"
|
|
84784
|
+
},
|
|
83336
84785
|
{
|
|
83337
84786
|
"aliases": [],
|
|
83338
84787
|
"description": "Install, remove, or check the ChatGPT Desktop shim: a CODEX_CLI_PATH wrapper that bridges Desktop stdio onto the managed Codex daemon (stock app-server proxy hangs). macOS persists via LaunchAgent; always fails open to real Codex.",
|
|
@@ -83413,11 +84862,17 @@ const commands = Object.freeze([
|
|
|
83413
84862
|
},
|
|
83414
84863
|
{
|
|
83415
84864
|
"aliases": [],
|
|
83416
|
-
"description": "Send
|
|
84865
|
+
"description": "Send to Codex; acceptance is distinct from completion. Options precede threadId.",
|
|
83417
84866
|
"exitCode": "result",
|
|
83418
84867
|
"options": [
|
|
83419
84868
|
{
|
|
83420
|
-
"
|
|
84869
|
+
"key": "bindingId",
|
|
84870
|
+
"kind": "string",
|
|
84871
|
+
"option": "binding-id",
|
|
84872
|
+
"repeated": false,
|
|
84873
|
+
"required": false
|
|
84874
|
+
},
|
|
84875
|
+
{
|
|
83421
84876
|
"key": "correlationId",
|
|
83422
84877
|
"kind": "string",
|
|
83423
84878
|
"option": "correlation-id",
|
|
@@ -83425,7 +84880,6 @@ const commands = Object.freeze([
|
|
|
83425
84880
|
"required": false
|
|
83426
84881
|
},
|
|
83427
84882
|
{
|
|
83428
|
-
"description": "Prepend the [gbot …] header to the message body",
|
|
83429
84883
|
"key": "envelope",
|
|
83430
84884
|
"kind": "boolean",
|
|
83431
84885
|
"option": "envelope",
|
|
@@ -83433,13 +84887,35 @@ const commands = Object.freeze([
|
|
|
83433
84887
|
"required": false
|
|
83434
84888
|
},
|
|
83435
84889
|
{
|
|
83436
|
-
"
|
|
84890
|
+
"key": "expectedCwd",
|
|
84891
|
+
"kind": "string",
|
|
84892
|
+
"option": "expected-cwd",
|
|
84893
|
+
"repeated": false,
|
|
84894
|
+
"required": false
|
|
84895
|
+
},
|
|
84896
|
+
{
|
|
84897
|
+
"description": "Required active-turn guard for steer; stale guards reject.",
|
|
84898
|
+
"key": "expectedTurnId",
|
|
84899
|
+
"kind": "string",
|
|
84900
|
+
"option": "expected-turn-id",
|
|
84901
|
+
"repeated": false,
|
|
84902
|
+
"required": false
|
|
84903
|
+
},
|
|
84904
|
+
{
|
|
83437
84905
|
"key": "hop",
|
|
83438
84906
|
"kind": "number",
|
|
83439
84907
|
"option": "hop",
|
|
83440
84908
|
"repeated": false,
|
|
83441
84909
|
"required": false
|
|
83442
84910
|
},
|
|
84911
|
+
{
|
|
84912
|
+
"description": "Reply budget: 1-4194304 bytes.",
|
|
84913
|
+
"key": "maxOutputBytes",
|
|
84914
|
+
"kind": "number",
|
|
84915
|
+
"option": "max-output-bytes",
|
|
84916
|
+
"repeated": false,
|
|
84917
|
+
"required": false
|
|
84918
|
+
},
|
|
83443
84919
|
{
|
|
83444
84920
|
"key": "message",
|
|
83445
84921
|
"kind": "string",
|
|
@@ -83449,13 +84925,26 @@ const commands = Object.freeze([
|
|
|
83449
84925
|
"required": true
|
|
83450
84926
|
},
|
|
83451
84927
|
{
|
|
83452
|
-
"description": "Prior message id this send replies to",
|
|
83453
84928
|
"key": "replyTo",
|
|
83454
84929
|
"kind": "string",
|
|
83455
84930
|
"option": "reply-to",
|
|
83456
84931
|
"repeated": false,
|
|
83457
84932
|
"required": false
|
|
83458
84933
|
},
|
|
84934
|
+
{
|
|
84935
|
+
"key": "replyToGrok",
|
|
84936
|
+
"kind": "string",
|
|
84937
|
+
"option": "reply-to-grok",
|
|
84938
|
+
"repeated": false,
|
|
84939
|
+
"required": false
|
|
84940
|
+
},
|
|
84941
|
+
{
|
|
84942
|
+
"key": "requestId",
|
|
84943
|
+
"kind": "string",
|
|
84944
|
+
"option": "request-id",
|
|
84945
|
+
"repeated": false,
|
|
84946
|
+
"required": false
|
|
84947
|
+
},
|
|
83459
84948
|
{
|
|
83460
84949
|
"key": "threadId",
|
|
83461
84950
|
"kind": "string",
|
|
@@ -83464,12 +84953,27 @@ const commands = Object.freeze([
|
|
|
83464
84953
|
"repeated": false,
|
|
83465
84954
|
"required": true
|
|
83466
84955
|
},
|
|
84956
|
+
{
|
|
84957
|
+
"description": "Observation timeout: 1-600000 milliseconds.",
|
|
84958
|
+
"key": "timeoutMs",
|
|
84959
|
+
"kind": "number",
|
|
84960
|
+
"option": "timeout-ms",
|
|
84961
|
+
"repeated": false,
|
|
84962
|
+
"required": false
|
|
84963
|
+
},
|
|
84964
|
+
{
|
|
84965
|
+
"key": "wait",
|
|
84966
|
+
"kind": "boolean",
|
|
84967
|
+
"option": "wait",
|
|
84968
|
+
"repeated": false,
|
|
84969
|
+
"required": false
|
|
84970
|
+
},
|
|
83467
84971
|
{
|
|
83468
84972
|
"choices": [
|
|
83469
84973
|
"reject",
|
|
83470
|
-
"queue"
|
|
84974
|
+
"queue",
|
|
84975
|
+
"steer"
|
|
83471
84976
|
],
|
|
83472
|
-
"description": "reject (default) or queue (needs GROK_BOT_CODEX_EXPERIMENTAL=1)",
|
|
83473
84977
|
"key": "whenBusy",
|
|
83474
84978
|
"kind": "enum",
|
|
83475
84979
|
"option": "when-busy",
|
|
@@ -83481,6 +84985,9 @@ const commands = Object.freeze([
|
|
|
83481
84985
|
"codex",
|
|
83482
84986
|
"send"
|
|
83483
84987
|
],
|
|
84988
|
+
"render": {
|
|
84989
|
+
"maxElapsedMs": 660000
|
|
84990
|
+
},
|
|
83484
84991
|
"rendered": true,
|
|
83485
84992
|
"routeId": "cli:codex/send"
|
|
83486
84993
|
},
|
|
@@ -83496,6 +85003,115 @@ const commands = Object.freeze([
|
|
|
83496
85003
|
"rendered": true,
|
|
83497
85004
|
"routeId": "cli:codex/status"
|
|
83498
85005
|
},
|
|
85006
|
+
{
|
|
85007
|
+
"aliases": [],
|
|
85008
|
+
"description": "Bounded Codex wait observation; never interrupts execution.",
|
|
85009
|
+
"exitCode": "result",
|
|
85010
|
+
"options": [
|
|
85011
|
+
{
|
|
85012
|
+
"key": "expectedCwd",
|
|
85013
|
+
"kind": "string",
|
|
85014
|
+
"option": "expected-cwd",
|
|
85015
|
+
"repeated": false,
|
|
85016
|
+
"required": false
|
|
85017
|
+
},
|
|
85018
|
+
{
|
|
85019
|
+
"description": "Reply budget: 1-4194304 bytes.",
|
|
85020
|
+
"key": "maxOutputBytes",
|
|
85021
|
+
"kind": "number",
|
|
85022
|
+
"option": "max-output-bytes",
|
|
85023
|
+
"repeated": false,
|
|
85024
|
+
"required": false
|
|
85025
|
+
},
|
|
85026
|
+
{
|
|
85027
|
+
"key": "messageId",
|
|
85028
|
+
"kind": "string",
|
|
85029
|
+
"option": "message-id",
|
|
85030
|
+
"repeated": false,
|
|
85031
|
+
"required": false
|
|
85032
|
+
},
|
|
85033
|
+
{
|
|
85034
|
+
"key": "threadId",
|
|
85035
|
+
"kind": "string",
|
|
85036
|
+
"option": "thread-id",
|
|
85037
|
+
"positional": 0,
|
|
85038
|
+
"repeated": false,
|
|
85039
|
+
"required": true
|
|
85040
|
+
},
|
|
85041
|
+
{
|
|
85042
|
+
"description": "Observation timeout: 1-600000 milliseconds.",
|
|
85043
|
+
"key": "timeoutMs",
|
|
85044
|
+
"kind": "number",
|
|
85045
|
+
"option": "timeout-ms",
|
|
85046
|
+
"repeated": false,
|
|
85047
|
+
"required": false
|
|
85048
|
+
},
|
|
85049
|
+
{
|
|
85050
|
+
"key": "turnId",
|
|
85051
|
+
"kind": "string",
|
|
85052
|
+
"option": "turn-id",
|
|
85053
|
+
"positional": 1,
|
|
85054
|
+
"repeated": false,
|
|
85055
|
+
"required": true
|
|
85056
|
+
}
|
|
85057
|
+
],
|
|
85058
|
+
"path": [
|
|
85059
|
+
"codex",
|
|
85060
|
+
"wait"
|
|
85061
|
+
],
|
|
85062
|
+
"render": {
|
|
85063
|
+
"maxElapsedMs": 660000
|
|
85064
|
+
},
|
|
85065
|
+
"rendered": true,
|
|
85066
|
+
"routeId": "cli:codex/wait"
|
|
85067
|
+
},
|
|
85068
|
+
{
|
|
85069
|
+
"aliases": [],
|
|
85070
|
+
"description": "Bounded Codex watch observation; never interrupts execution.",
|
|
85071
|
+
"exitCode": "result",
|
|
85072
|
+
"options": [
|
|
85073
|
+
{
|
|
85074
|
+
"key": "expectedCwd",
|
|
85075
|
+
"kind": "string",
|
|
85076
|
+
"option": "expected-cwd",
|
|
85077
|
+
"repeated": false,
|
|
85078
|
+
"required": false
|
|
85079
|
+
},
|
|
85080
|
+
{
|
|
85081
|
+
"description": "Maximum observed events: 1-500.",
|
|
85082
|
+
"key": "maxEvents",
|
|
85083
|
+
"kind": "number",
|
|
85084
|
+
"option": "max-events",
|
|
85085
|
+
"repeated": false,
|
|
85086
|
+
"required": false
|
|
85087
|
+
},
|
|
85088
|
+
{
|
|
85089
|
+
"key": "threadId",
|
|
85090
|
+
"kind": "string",
|
|
85091
|
+
"option": "thread-id",
|
|
85092
|
+
"positional": 0,
|
|
85093
|
+
"repeated": false,
|
|
85094
|
+
"required": true
|
|
85095
|
+
},
|
|
85096
|
+
{
|
|
85097
|
+
"description": "Observation timeout: 1-600000 milliseconds.",
|
|
85098
|
+
"key": "timeoutMs",
|
|
85099
|
+
"kind": "number",
|
|
85100
|
+
"option": "timeout-ms",
|
|
85101
|
+
"repeated": false,
|
|
85102
|
+
"required": false
|
|
85103
|
+
}
|
|
85104
|
+
],
|
|
85105
|
+
"path": [
|
|
85106
|
+
"codex",
|
|
85107
|
+
"watch"
|
|
85108
|
+
],
|
|
85109
|
+
"render": {
|
|
85110
|
+
"maxElapsedMs": 660000
|
|
85111
|
+
},
|
|
85112
|
+
"rendered": true,
|
|
85113
|
+
"routeId": "cli:codex/watch"
|
|
85114
|
+
},
|
|
83499
85115
|
{
|
|
83500
85116
|
"aliases": [],
|
|
83501
85117
|
"description": "Show which agents root and auth sources gbot can see.",
|
|
@@ -84100,6 +85716,20 @@ const commands = Object.freeze([
|
|
|
84100
85716
|
"description": "Send a message to a Grok Bot bot or group by name or id.",
|
|
84101
85717
|
"exitCode": "result",
|
|
84102
85718
|
"options": [
|
|
85719
|
+
{
|
|
85720
|
+
"key": "bindingId",
|
|
85721
|
+
"kind": "string",
|
|
85722
|
+
"option": "binding-id",
|
|
85723
|
+
"repeated": false,
|
|
85724
|
+
"required": false
|
|
85725
|
+
},
|
|
85726
|
+
{
|
|
85727
|
+
"key": "codexThreadId",
|
|
85728
|
+
"kind": "string",
|
|
85729
|
+
"option": "codex-thread-id",
|
|
85730
|
+
"repeated": false,
|
|
85731
|
+
"required": false
|
|
85732
|
+
},
|
|
84103
85733
|
{
|
|
84104
85734
|
"description": "Stable correlation id for multi-hop replies",
|
|
84105
85735
|
"key": "correlationId",
|
|
@@ -84124,6 +85754,13 @@ const commands = Object.freeze([
|
|
|
84124
85754
|
"repeated": false,
|
|
84125
85755
|
"required": false
|
|
84126
85756
|
},
|
|
85757
|
+
{
|
|
85758
|
+
"key": "expectedCwd",
|
|
85759
|
+
"kind": "string",
|
|
85760
|
+
"option": "expected-cwd",
|
|
85761
|
+
"repeated": false,
|
|
85762
|
+
"required": false
|
|
85763
|
+
},
|
|
84127
85764
|
{
|
|
84128
85765
|
"description": "Force the on-disk agents store",
|
|
84129
85766
|
"key": "files",
|
|
@@ -84172,6 +85809,17 @@ const commands = Object.freeze([
|
|
|
84172
85809
|
"repeated": false,
|
|
84173
85810
|
"required": false
|
|
84174
85811
|
},
|
|
85812
|
+
{
|
|
85813
|
+
"choices": [
|
|
85814
|
+
"auto",
|
|
85815
|
+
"manual"
|
|
85816
|
+
],
|
|
85817
|
+
"key": "replyMode",
|
|
85818
|
+
"kind": "enum",
|
|
85819
|
+
"option": "reply-mode",
|
|
85820
|
+
"repeated": false,
|
|
85821
|
+
"required": false
|
|
85822
|
+
},
|
|
84175
85823
|
{
|
|
84176
85824
|
"description": "Prior message id this send replies to",
|
|
84177
85825
|
"key": "replyTo",
|
|
@@ -84180,6 +85828,13 @@ const commands = Object.freeze([
|
|
|
84180
85828
|
"repeated": false,
|
|
84181
85829
|
"required": false
|
|
84182
85830
|
},
|
|
85831
|
+
{
|
|
85832
|
+
"key": "requestId",
|
|
85833
|
+
"kind": "string",
|
|
85834
|
+
"option": "request-id",
|
|
85835
|
+
"repeated": false,
|
|
85836
|
+
"required": false
|
|
85837
|
+
},
|
|
84183
85838
|
{
|
|
84184
85839
|
"key": "target",
|
|
84185
85840
|
"kind": "string",
|
|
@@ -84323,27 +85978,27 @@ const execute = async (command, input, context)=>{
|
|
|
84323
85978
|
instanceId: processLifetime.instanceId,
|
|
84324
85979
|
pid: processLifetime.pid
|
|
84325
85980
|
};
|
|
84326
|
-
const result = await (0,
|
|
85981
|
+
const result = await (0,_agent_bundle_runtime__rspack_import_35/* .runAgentRequest */.iC)({
|
|
84327
85982
|
capabilities: {
|
|
84328
|
-
command: (0,
|
|
84329
|
-
filesystem: (0,
|
|
84330
|
-
network: (0,
|
|
84331
|
-
projectRoot: (0,
|
|
85983
|
+
command: (0,_agent_bundle_runtime__rspack_import_35/* .unavailable */.hU)(),
|
|
85984
|
+
filesystem: (0,_agent_bundle_runtime__rspack_import_35/* .unavailable */.hU)(),
|
|
85985
|
+
network: (0,_agent_bundle_runtime__rspack_import_35/* .unavailable */.hU)(),
|
|
85986
|
+
projectRoot: (0,_agent_bundle_runtime__rspack_import_35/* .available */.qC)({
|
|
84332
85987
|
root: cwd
|
|
84333
85988
|
}, 'derived')
|
|
84334
85989
|
},
|
|
84335
|
-
host: (0,
|
|
85990
|
+
host: (0,_agent_bundle_runtime__rspack_import_35/* .unavailable */.hU)('unsupported-surface'),
|
|
84336
85991
|
invocation: {
|
|
84337
85992
|
kind: 'cli',
|
|
84338
85993
|
operationId: command.routeId,
|
|
84339
85994
|
surface: command.path.join(' ')
|
|
84340
85995
|
},
|
|
84341
|
-
lineage: (0,
|
|
85996
|
+
lineage: (0,_agent_bundle_runtime__rspack_import_35/* .unavailable */.hU)('unsupported-surface'),
|
|
84342
85997
|
plugin: pluginRoot.identity,
|
|
84343
85998
|
process: processHit,
|
|
84344
85999
|
signal: context.signal,
|
|
84345
|
-
terminal: (0,
|
|
84346
|
-
workspace: (0,
|
|
86000
|
+
terminal: (0,_agent_bundle_runtime__rspack_import_35/* .available */.qC)(context.terminal, 'native'),
|
|
86001
|
+
workspace: (0,_agent_bundle_runtime__rspack_import_35/* .available */.qC)({
|
|
84347
86002
|
root: cwd
|
|
84348
86003
|
}, 'derived')
|
|
84349
86004
|
}, async ()=>route.module.default({
|
|
@@ -84450,7 +86105,7 @@ const openRenderedSession = ({ invocation, limits, props, request, routeId, sign
|
|
|
84450
86105
|
return stream;
|
|
84451
86106
|
}
|
|
84452
86107
|
});
|
|
84453
|
-
const dispatcher = (0,
|
|
86108
|
+
const dispatcher = (0,_agent_bundle_runtime__rspack_import_36/* .createAgentRenderDispatcher */.jK)(host);
|
|
84454
86109
|
return Object.freeze({
|
|
84455
86110
|
close: async ()=>{
|
|
84456
86111
|
await worker.terminate();
|
|
@@ -84494,11 +86149,11 @@ const render = async (command, input, context)=>{
|
|
|
84494
86149
|
if (import.meta.main) {
|
|
84495
86150
|
await (0,agent_bundle_cli_entry__rspack_import_1/* .runGeneratedCliProcess */.yA)({
|
|
84496
86151
|
commands,
|
|
84497
|
-
description: "Message Grok Bot
|
|
86152
|
+
description: "Message Grok Bot from Codex, Claude Code, and Cursor, with managed automatic replies and explicit Codex conversation links.",
|
|
84498
86153
|
execute,
|
|
84499
86154
|
name: "gbot",
|
|
84500
86155
|
render,
|
|
84501
|
-
version: "0.
|
|
86156
|
+
version: "0.6.0"
|
|
84502
86157
|
});
|
|
84503
86158
|
}
|
|
84504
86159
|
|
|
@@ -84722,6 +86377,7 @@ function inspectGrokBotGatewaySession(options = {}) {
|
|
|
84722
86377
|
__webpack_require__.d(__webpack_exports__, {
|
|
84723
86378
|
Z2: () => (loadGrokBotGatewaySession),
|
|
84724
86379
|
ZN: () => (hasGrokBotGatewaySession),
|
|
86380
|
+
dQ: () => (grokBotGatewayDescriptorPath),
|
|
84725
86381
|
hd: () => (inspectGrokBotGatewaySession)
|
|
84726
86382
|
});
|
|
84727
86383
|
|
|
@@ -84734,7 +86390,7 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
84734
86390
|
/* import */ var node_os__rspack_import_3 = __webpack_require__("node:os");
|
|
84735
86391
|
/* import */ var node_path__rspack_import_4 = __webpack_require__("node:path");
|
|
84736
86392
|
/* import */ var node_child_process__rspack_import_5 = __webpack_require__("node:child_process");
|
|
84737
|
-
/* import */ var
|
|
86393
|
+
/* import */ var _package_json__rspack_import_6 = __webpack_require__("./package.json");
|
|
84738
86394
|
/* import */ var _codex_contract_js__rspack_import_7 = __webpack_require__("./src/core/codex/contract.js");
|
|
84739
86395
|
/* import */ var _desktop_shim_js__rspack_import_8 = __webpack_require__("./src/core/desktop-shim.js");
|
|
84740
86396
|
|
|
@@ -84760,10 +86416,12 @@ const WS_GUID = "258EAFA5-E914-47DA-95CA-C5AB0DC85B11";
|
|
|
84760
86416
|
const WS_MAX_HEADER_BYTES = 16 * 1024;
|
|
84761
86417
|
const WS_MAX_MESSAGE_BYTES = 4 * 1024 * 1024;
|
|
84762
86418
|
const WS_MAX_BUFFER_BYTES = 8 * 1024 * 1024;
|
|
86419
|
+
const WS_MAX_WRITE_BYTES = 8 * 1024 * 1024;
|
|
86420
|
+
const CODEX_MAX_REQUESTS = 128;
|
|
86421
|
+
const CODEX_MAX_LISTENERS = 128;
|
|
84763
86422
|
const textDecoder = new TextDecoder("utf-8", {
|
|
84764
86423
|
fatal: true
|
|
84765
86424
|
});
|
|
84766
|
-
const pkg = (0,node_module__rspack_import_6.createRequire)(import.meta.url)("../../package.json");
|
|
84767
86425
|
function codexSocketPath(env = process.env) {
|
|
84768
86426
|
// Explicit socket wins so status/send/queue agree with a shim-installed or
|
|
84769
86427
|
// operator-exported CODEX_APP_SERVER_SOCK; otherwise derive from CODEX_HOME.
|
|
@@ -84920,7 +86578,7 @@ function attachEnvelope(error, envelope) {
|
|
|
84920
86578
|
"correlationId",
|
|
84921
86579
|
"hop"
|
|
84922
86580
|
]){
|
|
84923
|
-
if (
|
|
86581
|
+
if (envelope?.[key] !== undefined) error[key] = envelope[key];
|
|
84924
86582
|
}
|
|
84925
86583
|
}
|
|
84926
86584
|
/** The route to the app-server is unavailable; `mode` is a stable machine-readable state. */ class CodexRouteError extends Error {
|
|
@@ -84967,16 +86625,44 @@ function isObject(value) {
|
|
|
84967
86625
|
}
|
|
84968
86626
|
/**
|
|
84969
86627
|
* Open a JSON-RPC session to the app-server over its Unix socket (WebSocket framing).
|
|
84970
|
-
* Server
|
|
84971
|
-
*
|
|
84972
|
-
*/ function connectCodexAppServer(path, { timeoutMs = 15000 } = {}) {
|
|
86628
|
+
* Server requests are observed without answering by default. Legacy one-shot
|
|
86629
|
+
* callers arm ownership-scoped refusals; persistent sessions respond explicitly.
|
|
86630
|
+
*/ function connectCodexAppServer(path, { timeoutMs = 15000, signal, onNotification, onServerRequest, onClose } = {}) {
|
|
84973
86631
|
return new Promise((resolve, reject)=>{
|
|
86632
|
+
if (!Number.isInteger(timeoutMs) || timeoutMs < 1 || timeoutMs > 2147483647) {
|
|
86633
|
+
throw new RangeError("timeoutMs must be an integer 1-2147483647");
|
|
86634
|
+
}
|
|
86635
|
+
for (const listener of [
|
|
86636
|
+
onNotification,
|
|
86637
|
+
onServerRequest,
|
|
86638
|
+
onClose
|
|
86639
|
+
]){
|
|
86640
|
+
if (listener !== undefined && typeof listener !== "function") throw new TypeError("Event listener must be a function");
|
|
86641
|
+
}
|
|
86642
|
+
if (signal !== undefined && !(signal instanceof AbortSignal)) throw new TypeError("signal must be an AbortSignal");
|
|
86643
|
+
if (signal?.aborted) throw new Error("Codex connection aborted", {
|
|
86644
|
+
cause: signal.reason
|
|
86645
|
+
});
|
|
84974
86646
|
const socket = (0,node_net__rspack_import_2.createConnection)({
|
|
84975
86647
|
path
|
|
84976
86648
|
});
|
|
84977
86649
|
const key = (0,node_crypto__rspack_import_0.randomBytes)(16).toString("base64");
|
|
84978
86650
|
const pending = new Map();
|
|
84979
86651
|
const refused = [];
|
|
86652
|
+
const serverRequests = new Map();
|
|
86653
|
+
const listeners = {
|
|
86654
|
+
notification: new Set(onNotification ? [
|
|
86655
|
+
onNotification
|
|
86656
|
+
] : []),
|
|
86657
|
+
serverRequest: new Set(onServerRequest ? [
|
|
86658
|
+
onServerRequest
|
|
86659
|
+
] : []),
|
|
86660
|
+
close: new Set(onClose ? [
|
|
86661
|
+
onClose
|
|
86662
|
+
] : [])
|
|
86663
|
+
};
|
|
86664
|
+
let closeError;
|
|
86665
|
+
let writeTimer;
|
|
84980
86666
|
let nextId = 1;
|
|
84981
86667
|
let buf = Buffer.alloc(0);
|
|
84982
86668
|
let upgraded = false;
|
|
@@ -84991,22 +86677,127 @@ function isObject(value) {
|
|
|
84991
86677
|
const failAll = (err)=>{
|
|
84992
86678
|
if (closed) return;
|
|
84993
86679
|
closed = true;
|
|
86680
|
+
closeError = err;
|
|
84994
86681
|
clearTimeout(handshakeTimer);
|
|
86682
|
+
clearTimeout(writeTimer);
|
|
86683
|
+
signal?.removeEventListener("abort", abort);
|
|
84995
86684
|
if (err && err.delivery == null) err.delivery = pending.size ? "unknown" : "rejected";
|
|
84996
86685
|
for (const { reject: rej } of pending.values())rej(err);
|
|
84997
86686
|
pending.clear();
|
|
86687
|
+
serverRequests.clear();
|
|
86688
|
+
client.deferred.length = 0;
|
|
86689
|
+
buf = Buffer.alloc(0);
|
|
86690
|
+
fragParts = [];
|
|
86691
|
+
fragBytes = 0;
|
|
86692
|
+
const closeListeners = [
|
|
86693
|
+
...listeners.close
|
|
86694
|
+
];
|
|
86695
|
+
for (const group of Object.values(listeners))group.clear();
|
|
84998
86696
|
try {
|
|
84999
86697
|
socket.destroy();
|
|
85000
86698
|
} catch {}
|
|
85001
86699
|
reject(err);
|
|
86700
|
+
for (const listener of closeListeners)invoke(listener, err, true);
|
|
85002
86701
|
};
|
|
86702
|
+
// Observers execute synchronously to preserve order, but failures never escape
|
|
86703
|
+
// the socket callback. Rejected async callbacks use the same cleanup path.
|
|
86704
|
+
const invoke = (listener, message, closing = false)=>{
|
|
86705
|
+
const failed = (cause)=>{
|
|
86706
|
+
if (!closing) failAll(new Error("Codex event listener failed", {
|
|
86707
|
+
cause
|
|
86708
|
+
}));
|
|
86709
|
+
};
|
|
86710
|
+
try {
|
|
86711
|
+
const result = listener(message);
|
|
86712
|
+
if (result && typeof result.then === "function") Promise.resolve(result).catch(failed);
|
|
86713
|
+
} catch (err) {
|
|
86714
|
+
failed(err);
|
|
86715
|
+
}
|
|
86716
|
+
};
|
|
86717
|
+
const dispatch = (kind, message)=>{
|
|
86718
|
+
for (const listener of [
|
|
86719
|
+
...listeners[kind]
|
|
86720
|
+
]){
|
|
86721
|
+
if (closed) break;
|
|
86722
|
+
if (listeners[kind].has(listener)) invoke(listener, message);
|
|
86723
|
+
}
|
|
86724
|
+
};
|
|
86725
|
+
const subscribe = (kind, listener)=>{
|
|
86726
|
+
if (typeof listener !== "function") throw new TypeError("Event listener must be a function");
|
|
86727
|
+
if (closed) {
|
|
86728
|
+
if (kind === "close") invoke(listener, closeError, true);
|
|
86729
|
+
return ()=>{};
|
|
86730
|
+
}
|
|
86731
|
+
const group = listeners[kind];
|
|
86732
|
+
if (!group.has(listener) && group.size >= CODEX_MAX_LISTENERS) {
|
|
86733
|
+
const err = new Error("Codex listener limit exceeds " + CODEX_MAX_LISTENERS);
|
|
86734
|
+
failAll(err);
|
|
86735
|
+
throw err;
|
|
86736
|
+
}
|
|
86737
|
+
group.add(listener);
|
|
86738
|
+
return ()=>group.delete(listener);
|
|
86739
|
+
};
|
|
86740
|
+
const abort = ()=>failAll(new Error("Codex connection aborted", {
|
|
86741
|
+
cause: signal.reason
|
|
86742
|
+
}));
|
|
85003
86743
|
const failProtocol = (detail)=>failAll(new Error("Codex app-server violated the WebSocket protocol: " + detail));
|
|
85004
86744
|
const write = (opcode, payload)=>{
|
|
85005
|
-
if (
|
|
86745
|
+
if (closed) throw closeError;
|
|
86746
|
+
const encodedBytes = payload.length + (payload.length < 126 ? 6 : payload.length < 65536 ? 8 : 14);
|
|
86747
|
+
if (socket.destroyed || encodedBytes + socket.writableLength > WS_MAX_WRITE_BYTES) {
|
|
86748
|
+
const err = new Error(socket.destroyed ? "Codex socket closed" : "Codex outbound write budget exceeds " + WS_MAX_WRITE_BYTES + " bytes");
|
|
86749
|
+
failAll(err);
|
|
86750
|
+
throw err;
|
|
86751
|
+
}
|
|
86752
|
+
try {
|
|
86753
|
+
if (!socket.write(encodeFrame(opcode, payload, (0,node_crypto__rspack_import_0.randomBytes)(4))) && !writeTimer) {
|
|
86754
|
+
// One absolute deadline for the whole backpressured interval: more
|
|
86755
|
+
// writes must not keep an unread socket alive indefinitely.
|
|
86756
|
+
writeTimer = setTimeout(()=>failAll(new Error("Codex outbound write did not drain within " + timeoutMs + "ms")), timeoutMs);
|
|
86757
|
+
writeTimer.unref();
|
|
86758
|
+
}
|
|
86759
|
+
} catch (err) {
|
|
86760
|
+
failAll(err);
|
|
86761
|
+
throw err;
|
|
86762
|
+
}
|
|
85006
86763
|
};
|
|
85007
86764
|
const sendJson = (obj)=>write(0x1, Buffer.from(JSON.stringify(obj)));
|
|
86765
|
+
const respondToRequest = (id, payload)=>{
|
|
86766
|
+
if (closed) throw closeError;
|
|
86767
|
+
if (!serverRequests.has(id)) throw new Error("Unknown or resolved server request: " + id);
|
|
86768
|
+
// Consume ownership before JSON.stringify can invoke caller-owned getters
|
|
86769
|
+
// or toJSON hooks. A failed serialization closes rather than restoring it.
|
|
86770
|
+
serverRequests.delete(id);
|
|
86771
|
+
client.deferred = client.deferred.filter((entry)=>entry.id !== id);
|
|
86772
|
+
try {
|
|
86773
|
+
sendJson({
|
|
86774
|
+
jsonrpc: "2.0",
|
|
86775
|
+
id,
|
|
86776
|
+
...payload
|
|
86777
|
+
});
|
|
86778
|
+
} catch (cause) {
|
|
86779
|
+
if (closed) throw closeError;
|
|
86780
|
+
const err = new Error("Codex server response serialization failed", {
|
|
86781
|
+
cause
|
|
86782
|
+
});
|
|
86783
|
+
failAll(err);
|
|
86784
|
+
throw err;
|
|
86785
|
+
}
|
|
86786
|
+
};
|
|
85008
86787
|
const client = {
|
|
85009
86788
|
refused,
|
|
86789
|
+
get closed () {
|
|
86790
|
+
return closed;
|
|
86791
|
+
},
|
|
86792
|
+
onNotification: (listener)=>subscribe("notification", listener),
|
|
86793
|
+
onServerRequest: (listener)=>subscribe("serverRequest", listener),
|
|
86794
|
+
onClose: (listener)=>subscribe("close", listener),
|
|
86795
|
+
respond: (id, result)=>respondToRequest(id, {
|
|
86796
|
+
result
|
|
86797
|
+
}),
|
|
86798
|
+
rejectRequest: (id, error)=>respondToRequest(id, {
|
|
86799
|
+
error
|
|
86800
|
+
}),
|
|
85010
86801
|
// Server-initiated requests are only *answered* once our own turn/start
|
|
85011
86802
|
// is in flight, and then only when they name our own thread/turn:
|
|
85012
86803
|
// anything earlier — or naming another thread or Desktop turn — belongs
|
|
@@ -85031,22 +86822,24 @@ function isObject(value) {
|
|
|
85031
86822
|
const params = entry.params && typeof entry.params === "object" && !Array.isArray(entry.params) ? entry.params : null;
|
|
85032
86823
|
const threadId = params ? params.threadId ?? params.thread_id : null;
|
|
85033
86824
|
const namedTurnId = params ? params.turnId ?? params.turn_id ?? (params.turn && params.turn.id) : null;
|
|
85034
|
-
if (threadId === client.expectedThreadId && namedTurnId === turnId) {
|
|
85035
|
-
entry.
|
|
85036
|
-
|
|
85037
|
-
|
|
85038
|
-
id: entry.id,
|
|
85039
|
-
error: {
|
|
85040
|
-
code: -32601,
|
|
85041
|
-
message: "gbot codex does not answer " + entry.method + "; configure approval_policy on the daemon"
|
|
85042
|
-
}
|
|
86825
|
+
if (threadId === client.expectedThreadId && namedTurnId === turnId && serverRequests.get(entry.id) === entry) {
|
|
86826
|
+
client.rejectRequest(entry.id, {
|
|
86827
|
+
code: -32601,
|
|
86828
|
+
message: "gbot codex does not answer " + entry.method + "; configure approval_policy on the daemon"
|
|
85043
86829
|
});
|
|
86830
|
+
entry.answered = true;
|
|
85044
86831
|
}
|
|
85045
86832
|
}
|
|
85046
86833
|
},
|
|
85047
86834
|
request (method, params) {
|
|
85048
|
-
const id = nextId++;
|
|
85049
86835
|
return new Promise((res, rej)=>{
|
|
86836
|
+
if (closed) return rej(closeError);
|
|
86837
|
+
if (pending.size >= CODEX_MAX_REQUESTS) {
|
|
86838
|
+
const err = new Error("Codex pending request limit exceeds " + CODEX_MAX_REQUESTS);
|
|
86839
|
+
failAll(err);
|
|
86840
|
+
return rej(err);
|
|
86841
|
+
}
|
|
86842
|
+
const id = nextId++;
|
|
85050
86843
|
const timer = setTimeout(()=>{
|
|
85051
86844
|
pending.delete(id);
|
|
85052
86845
|
rej(new Error("Codex app-server did not answer " + method + " within " + timeoutMs + "ms"));
|
|
@@ -85062,12 +86855,18 @@ function isObject(value) {
|
|
|
85062
86855
|
rej(e);
|
|
85063
86856
|
}
|
|
85064
86857
|
});
|
|
85065
|
-
|
|
85066
|
-
|
|
85067
|
-
|
|
85068
|
-
|
|
85069
|
-
|
|
85070
|
-
|
|
86858
|
+
try {
|
|
86859
|
+
sendJson({
|
|
86860
|
+
jsonrpc: "2.0",
|
|
86861
|
+
id,
|
|
86862
|
+
method,
|
|
86863
|
+
params
|
|
86864
|
+
});
|
|
86865
|
+
} catch (err) {
|
|
86866
|
+
const entry = pending.get(id);
|
|
86867
|
+
pending.delete(id);
|
|
86868
|
+
entry?.reject(err);
|
|
86869
|
+
}
|
|
85071
86870
|
});
|
|
85072
86871
|
},
|
|
85073
86872
|
notify (method, params) {
|
|
@@ -85079,34 +86878,34 @@ function isObject(value) {
|
|
|
85079
86878
|
},
|
|
85080
86879
|
close () {
|
|
85081
86880
|
if (closed) return;
|
|
85082
|
-
|
|
85083
|
-
|
|
85084
|
-
|
|
85085
|
-
|
|
85086
|
-
|
|
85087
|
-
|
|
85088
|
-
|
|
85089
|
-
|
|
85090
|
-
0x03,
|
|
85091
|
-
0xe8
|
|
85092
|
-
]));
|
|
85093
|
-
if (socket.destroyed) return;
|
|
85094
|
-
const forceDestroy = setTimeout(()=>{
|
|
85095
|
-
try {
|
|
85096
|
-
socket.destroy();
|
|
85097
|
-
} catch {}
|
|
85098
|
-
}, 1000);
|
|
85099
|
-
if (typeof forceDestroy.unref === "function") forceDestroy.unref();
|
|
85100
|
-
socket.end(()=>{
|
|
85101
|
-
clearTimeout(forceDestroy);
|
|
85102
|
-
try {
|
|
85103
|
-
socket.destroy();
|
|
85104
|
-
} catch {}
|
|
85105
|
-
});
|
|
86881
|
+
// Best effort protocol close; cleanup never depends on the peer reading it.
|
|
86882
|
+
try {
|
|
86883
|
+
if (upgraded) write(0x8, Buffer.from([
|
|
86884
|
+
0x03,
|
|
86885
|
+
0xe8
|
|
86886
|
+
]));
|
|
86887
|
+
} catch {}
|
|
86888
|
+
failAll(new Error("Codex client closed"));
|
|
85106
86889
|
}
|
|
85107
86890
|
};
|
|
86891
|
+
signal?.addEventListener("abort", abort, {
|
|
86892
|
+
once: true
|
|
86893
|
+
});
|
|
85108
86894
|
const onMessage = (msg)=>{
|
|
85109
86895
|
if (msg.id != null && msg.method) {
|
|
86896
|
+
if (serverRequests.has(msg.id)) return failProtocol("duplicate pending server request id");
|
|
86897
|
+
if (serverRequests.size >= CODEX_MAX_REQUESTS || refused.length >= CODEX_MAX_REQUESTS || client.deferred.length >= CODEX_MAX_REQUESTS) {
|
|
86898
|
+
return failAll(new Error("Codex remembered server request limit exceeds " + CODEX_MAX_REQUESTS));
|
|
86899
|
+
}
|
|
86900
|
+
const entry = {
|
|
86901
|
+
id: msg.id,
|
|
86902
|
+
method: msg.method,
|
|
86903
|
+
params: msg.params,
|
|
86904
|
+
answered: false
|
|
86905
|
+
};
|
|
86906
|
+
serverRequests.set(msg.id, entry);
|
|
86907
|
+
dispatch("serverRequest", msg);
|
|
86908
|
+
if (closed) return;
|
|
85110
86909
|
let answered = client.answerServerRequests;
|
|
85111
86910
|
let defer = false;
|
|
85112
86911
|
// Approval ownership: only answer requests for the turn gbot itself
|
|
@@ -85126,28 +86925,30 @@ function isObject(value) {
|
|
|
85126
86925
|
} else if (turnId !== client.expectedTurnId) answered = false;
|
|
85127
86926
|
} else answered = false;
|
|
85128
86927
|
}
|
|
85129
|
-
|
|
85130
|
-
|
|
85131
|
-
|
|
85132
|
-
params: msg.params,
|
|
85133
|
-
answered
|
|
85134
|
-
};
|
|
86928
|
+
answered = answered && serverRequests.has(msg.id);
|
|
86929
|
+
defer = defer && serverRequests.has(msg.id);
|
|
86930
|
+
entry.answered = answered;
|
|
85135
86931
|
refused.push(entry);
|
|
85136
86932
|
if (defer) {
|
|
85137
86933
|
client.deferred.push(entry);
|
|
85138
86934
|
return;
|
|
85139
86935
|
}
|
|
85140
86936
|
if (!answered) return;
|
|
85141
|
-
|
|
85142
|
-
|
|
85143
|
-
|
|
85144
|
-
error: {
|
|
85145
|
-
code: -32601,
|
|
85146
|
-
message: "gbot codex does not answer " + msg.method + "; configure approval_policy on the daemon"
|
|
85147
|
-
}
|
|
86937
|
+
client.rejectRequest(msg.id, {
|
|
86938
|
+
code: -32601,
|
|
86939
|
+
message: "gbot codex does not answer " + msg.method + "; configure approval_policy on the daemon"
|
|
85148
86940
|
});
|
|
85149
86941
|
return;
|
|
85150
86942
|
}
|
|
86943
|
+
if (msg.id == null && msg.method) {
|
|
86944
|
+
if (msg.method === "serverRequest/resolved") {
|
|
86945
|
+
const id = msg.params?.requestId;
|
|
86946
|
+
serverRequests.delete(id);
|
|
86947
|
+
client.deferred = client.deferred.filter((entry)=>entry.id !== id);
|
|
86948
|
+
}
|
|
86949
|
+
dispatch("notification", msg);
|
|
86950
|
+
return;
|
|
86951
|
+
}
|
|
85151
86952
|
if (msg.id == null || !pending.has(msg.id)) return;
|
|
85152
86953
|
const entry = pending.get(msg.id);
|
|
85153
86954
|
pending.delete(msg.id);
|
|
@@ -85173,12 +86974,21 @@ function isObject(value) {
|
|
|
85173
86974
|
failAll(new Error("Codex app-server sent a malformed message"));
|
|
85174
86975
|
return;
|
|
85175
86976
|
}
|
|
85176
|
-
|
|
86977
|
+
try {
|
|
86978
|
+
onMessage(msg);
|
|
86979
|
+
} catch (err) {
|
|
86980
|
+
failAll(err);
|
|
86981
|
+
}
|
|
85177
86982
|
};
|
|
86983
|
+
socket.on("drain", ()=>{
|
|
86984
|
+
clearTimeout(writeTimer);
|
|
86985
|
+
writeTimer = undefined;
|
|
86986
|
+
});
|
|
85178
86987
|
socket.once("error", (err)=>failAll(new Error("Could not connect to Codex app-server at " + path + ": " + err.message)));
|
|
85179
86988
|
socket.once("close", ()=>failAll(new Error("Codex app-server closed the connection")));
|
|
85180
86989
|
socket.once("connect", ()=>socket.write(upgradeRequest(key)));
|
|
85181
86990
|
socket.on("data", (chunk)=>{
|
|
86991
|
+
if (closed) return;
|
|
85182
86992
|
buf = Buffer.concat([
|
|
85183
86993
|
buf,
|
|
85184
86994
|
chunk
|
|
@@ -85198,7 +87008,7 @@ function isObject(value) {
|
|
|
85198
87008
|
clearTimeout(handshakeTimer);
|
|
85199
87009
|
resolve(client);
|
|
85200
87010
|
}
|
|
85201
|
-
|
|
87011
|
+
while(!closed){
|
|
85202
87012
|
const frame = decodeFrame(buf);
|
|
85203
87013
|
if (!frame) {
|
|
85204
87014
|
const claimed = peekFrameLength(buf);
|
|
@@ -85214,10 +87024,18 @@ function isObject(value) {
|
|
|
85214
87024
|
if (frame.masked) return failProtocol("server frames must not be masked");
|
|
85215
87025
|
if (frame.opcode >= 0x8) {
|
|
85216
87026
|
if (!frame.fin || frame.payload.length > 125) return failProtocol("bad control frame");
|
|
85217
|
-
if (frame.opcode === 0x9)
|
|
85218
|
-
|
|
85219
|
-
|
|
85220
|
-
|
|
87027
|
+
if (frame.opcode === 0x9) {
|
|
87028
|
+
try {
|
|
87029
|
+
write(0xa, frame.payload);
|
|
87030
|
+
} catch {
|
|
87031
|
+
return;
|
|
87032
|
+
}
|
|
87033
|
+
} else if (frame.opcode === 0x8) {
|
|
87034
|
+
try {
|
|
87035
|
+
write(0x8, frame.payload);
|
|
87036
|
+
} catch {
|
|
87037
|
+
return;
|
|
87038
|
+
}
|
|
85221
87039
|
failAll(new Error("Codex app-server closed the connection"));
|
|
85222
87040
|
}
|
|
85223
87041
|
continue; // pong and other control frames carry nothing for us
|
|
@@ -85273,12 +87091,12 @@ function appServerVersion(initResult) {
|
|
|
85273
87091
|
}
|
|
85274
87092
|
throw new CodexRouteError(unreachableMessage(path), "socket-absent");
|
|
85275
87093
|
}
|
|
85276
|
-
async function
|
|
87094
|
+
async function openCodexSession(env = process.env, { experimental = false, ...options } = {}) {
|
|
85277
87095
|
const path = codexSocketPath(env);
|
|
85278
87096
|
assertRoute(path);
|
|
85279
87097
|
let client;
|
|
85280
87098
|
try {
|
|
85281
|
-
client = await connectCodexAppServer(path);
|
|
87099
|
+
client = await connectCodexAppServer(path, options);
|
|
85282
87100
|
} catch (err) {
|
|
85283
87101
|
throw connectError(err, path);
|
|
85284
87102
|
}
|
|
@@ -85287,7 +87105,7 @@ async function openSession(env = process.env, { experimental = false } = {}) {
|
|
|
85287
87105
|
init = await client.request("initialize", {
|
|
85288
87106
|
clientInfo: {
|
|
85289
87107
|
name: "gbot",
|
|
85290
|
-
version:
|
|
87108
|
+
version: _package_json__rspack_import_6/* .version */.rE
|
|
85291
87109
|
},
|
|
85292
87110
|
...experimental ? {
|
|
85293
87111
|
capabilities: {
|
|
@@ -85303,13 +87121,19 @@ async function openSession(env = process.env, { experimental = false } = {}) {
|
|
|
85303
87121
|
client.close();
|
|
85304
87122
|
throw new CodexProtocolError("initialize", "result is not an object");
|
|
85305
87123
|
}
|
|
85306
|
-
|
|
87124
|
+
try {
|
|
87125
|
+
client.notify("initialized");
|
|
87126
|
+
} catch (err) {
|
|
87127
|
+
client.close();
|
|
87128
|
+
throw handshakeError(err);
|
|
87129
|
+
}
|
|
85307
87130
|
return {
|
|
85308
87131
|
client,
|
|
85309
87132
|
path,
|
|
85310
87133
|
init
|
|
85311
87134
|
};
|
|
85312
87135
|
}
|
|
87136
|
+
const openSession = openCodexSession;
|
|
85313
87137
|
const CODEX_VERSION_PROBE_TIMEOUT_MS = 3000;
|
|
85314
87138
|
/** Bounded `codex --version` probe: `{ version, probe }` where probe is ok | missing | timeout | error. */ function probeLocalCodexVersion(timeoutMs = CODEX_VERSION_PROBE_TIMEOUT_MS) {
|
|
85315
87139
|
const out = (0,node_child_process__rspack_import_5.spawnSync)("codex", [
|
|
@@ -85657,12 +87481,14 @@ function requireExperimental(env, what) {
|
|
|
85657
87481
|
reason: "experimental-disabled"
|
|
85658
87482
|
});
|
|
85659
87483
|
}
|
|
85660
|
-
function unsupportedOrRpc(err, method, threadId, envelope) {
|
|
87484
|
+
function unsupportedOrRpc(err, method, threadId, envelope, turnId) {
|
|
87485
|
+
const guarded = method === "turn/steer";
|
|
85661
87486
|
if (err instanceof CodexRpcError && err.rpc && err.rpc.code === -32601) {
|
|
85662
|
-
return new CodexSendError("Codex app-server does not offer " + method + " (daemon predates it, or experimentalApi was not granted). " + "Upgrade Codex or send without --when-busy queue.", {
|
|
87487
|
+
return new CodexSendError("Codex app-server does not offer " + method + " (daemon predates it, or experimentalApi was not granted). " + (guarded ? "Upgrade Codex before retrying guarded steering." : "Upgrade Codex or send without --when-busy queue."), {
|
|
85663
87488
|
delivery: "rejected",
|
|
85664
87489
|
reason: "unsupported",
|
|
85665
87490
|
threadId,
|
|
87491
|
+
turnId,
|
|
85666
87492
|
...envelope
|
|
85667
87493
|
});
|
|
85668
87494
|
}
|
|
@@ -85670,12 +87496,14 @@ function unsupportedOrRpc(err, method, threadId, envelope) {
|
|
|
85670
87496
|
delivery: "rejected",
|
|
85671
87497
|
reason: "rejected",
|
|
85672
87498
|
threadId,
|
|
87499
|
+
turnId,
|
|
85673
87500
|
...envelope
|
|
85674
87501
|
});
|
|
85675
|
-
return new CodexSendError("Lost the Codex " + method + " response for thread " + threadId + ": " + (err && err.message || err) + ". Delivery is unknown; list the queue before resending.", {
|
|
87502
|
+
return new CodexSendError("Lost the Codex " + method + " response for thread " + threadId + ": " + (err && err.message || err) + (guarded ? ". Delivery is unknown; check thread " + threadId + " turn " + turnId + " before resending." : ". Delivery is unknown; list the queue before resending."), {
|
|
85676
87503
|
delivery: err && err.delivery || "unknown",
|
|
85677
87504
|
reason: "transport",
|
|
85678
87505
|
threadId,
|
|
87506
|
+
turnId,
|
|
85679
87507
|
...envelope
|
|
85680
87508
|
});
|
|
85681
87509
|
}
|
|
@@ -85714,30 +87542,70 @@ function unsupportedOrRpc(err, method, threadId, envelope) {
|
|
|
85714
87542
|
/**
|
|
85715
87543
|
* @param {string} threadId
|
|
85716
87544
|
* @param {string} text
|
|
85717
|
-
* @param {{ env?: NodeJS.ProcessEnv, envelope?: object, whenBusy?: "reject"|"queue" }} [opts]
|
|
87545
|
+
* @param {{ env?: NodeJS.ProcessEnv, envelope?: object, whenBusy?: "reject"|"queue"|"steer", session?: object, expectedTurnId?: string, expectedCwd?: string, signal?: AbortSignal }} [opts]
|
|
85718
87546
|
*/ async function sendToCodexThread(threadId, text, { env = process.env, envelope = buildEnvelope({
|
|
85719
87547
|
env
|
|
85720
|
-
}), whenBusy = "reject" } = {}) {
|
|
87548
|
+
}), whenBusy = "reject", session, expectedTurnId, expectedCwd, signal } = {}) {
|
|
85721
87549
|
try {
|
|
85722
87550
|
const receipt = await sendToCodexThreadInner(threadId, text, {
|
|
85723
87551
|
env,
|
|
85724
87552
|
envelope,
|
|
85725
|
-
whenBusy
|
|
87553
|
+
whenBusy,
|
|
87554
|
+
session,
|
|
87555
|
+
expectedTurnId,
|
|
87556
|
+
expectedCwd,
|
|
87557
|
+
signal
|
|
85726
87558
|
});
|
|
85727
87559
|
return (0,_codex_contract_js__rspack_import_7/* .outcomeFromReceipt */.Dz)(receipt);
|
|
85728
87560
|
} catch (err) {
|
|
85729
87561
|
// Every receipt names the message, including refusals that never reached the daemon.
|
|
85730
|
-
if (err
|
|
87562
|
+
if (err && typeof err === "object") {
|
|
87563
|
+
attachEnvelope(err, envelope);
|
|
87564
|
+
if (err.threadId === undefined) err.threadId = threadId;
|
|
87565
|
+
}
|
|
85731
87566
|
return (0,_codex_contract_js__rspack_import_7/* .outcomeFromError */.DG)(err);
|
|
85732
87567
|
}
|
|
85733
87568
|
}
|
|
85734
|
-
async function sendToCodexThreadInner(threadId, text, { env, envelope, whenBusy }) {
|
|
85735
|
-
if (
|
|
87569
|
+
async function sendToCodexThreadInner(threadId, text, { env, envelope, whenBusy, session, expectedTurnId, expectedCwd, signal }) {
|
|
87570
|
+
if (![
|
|
87571
|
+
"reject",
|
|
87572
|
+
"queue",
|
|
87573
|
+
...session ? [
|
|
87574
|
+
"steer"
|
|
87575
|
+
] : []
|
|
87576
|
+
].includes(whenBusy)) throw new RangeError("--when-busy must be reject, queue, or persistent steer");
|
|
87577
|
+
if (whenBusy === "steer" && (typeof expectedTurnId !== "string" || !ID_PATTERN.test(expectedTurnId))) throw new RangeError("steer requires expectedTurnId");
|
|
87578
|
+
if (typeof threadId !== "string" || !ID_PATTERN.test(threadId)) throw new RangeError("Invalid threadId");
|
|
87579
|
+
if (typeof text !== "string" || !text.trim() || Buffer.byteLength(text) > WS_MAX_MESSAGE_BYTES) throw new RangeError("Message must contain text within 4 MiB");
|
|
87580
|
+
if (!envelope || typeof envelope.messageId !== "string" || !ID_PATTERN.test(envelope.messageId)) throw new RangeError("Invalid envelope messageId");
|
|
87581
|
+
const validated = buildEnvelope({
|
|
87582
|
+
correlationId: envelope.correlationId,
|
|
87583
|
+
replyTo: envelope.replyTo,
|
|
87584
|
+
hop: envelope.hop,
|
|
87585
|
+
env
|
|
87586
|
+
});
|
|
87587
|
+
envelope = {
|
|
87588
|
+
...validated,
|
|
87589
|
+
messageId: envelope.messageId,
|
|
87590
|
+
header: Boolean(envelope.header)
|
|
87591
|
+
};
|
|
85736
87592
|
assertThreadAllowed(threadId, env);
|
|
85737
87593
|
if (whenBusy === "queue") requireExperimental(env, "--when-busy queue");
|
|
87594
|
+
if (signal !== undefined && !(signal instanceof AbortSignal)) throw new TypeError("signal must be an AbortSignal");
|
|
87595
|
+
const assertNotCancelled = ()=>{
|
|
87596
|
+
if (signal?.aborted) throw new CodexSendError("Codex submission cancelled before delivery", {
|
|
87597
|
+
delivery: "rejected",
|
|
87598
|
+
reason: "cancelled",
|
|
87599
|
+
threadId,
|
|
87600
|
+
turnId: whenBusy === "steer" ? expectedTurnId : undefined,
|
|
87601
|
+
...envelope
|
|
87602
|
+
});
|
|
87603
|
+
};
|
|
87604
|
+
assertNotCancelled();
|
|
85738
87605
|
const body = withEnvelopeHeader(text, envelope, env);
|
|
85739
|
-
const { client } = await openSession(env, {
|
|
85740
|
-
experimental: whenBusy === "queue"
|
|
87606
|
+
const { client } = session ?? await openSession(env, {
|
|
87607
|
+
experimental: whenBusy === "queue",
|
|
87608
|
+
signal
|
|
85741
87609
|
});
|
|
85742
87610
|
try {
|
|
85743
87611
|
let resumed;
|
|
@@ -85747,6 +87615,7 @@ async function sendToCodexThreadInner(threadId, text, { env, envelope, whenBusy
|
|
|
85747
87615
|
excludeTurns: true
|
|
85748
87616
|
});
|
|
85749
87617
|
} catch (err) {
|
|
87618
|
+
assertNotCancelled();
|
|
85750
87619
|
if (err instanceof CodexSendError) throw err;
|
|
85751
87620
|
throw new CodexSendError(explainSendError(err, threadId).message, {
|
|
85752
87621
|
delivery: err instanceof CodexRpcError ? "rejected" : err && err.delivery || "unknown",
|
|
@@ -85755,9 +87624,24 @@ async function sendToCodexThreadInner(threadId, text, { env, envelope, whenBusy
|
|
|
85755
87624
|
...envelope
|
|
85756
87625
|
});
|
|
85757
87626
|
}
|
|
87627
|
+
// A shared session stays connected when this conversation is cancelled.
|
|
87628
|
+
// Recheck after the last awaited preflight, before any submission request.
|
|
87629
|
+
assertNotCancelled();
|
|
85758
87630
|
if (!isObject(resumed) || !isObject(resumed.thread) || typeof resumed.thread.id !== "string") {
|
|
85759
87631
|
throw new CodexProtocolError("thread/resume", "missing `thread.id`");
|
|
85760
87632
|
}
|
|
87633
|
+
if (resumed.thread.id !== threadId) throw new CodexSendError("thread/resume returned a different thread ID", {
|
|
87634
|
+
delivery: "rejected",
|
|
87635
|
+
reason: "bad-response",
|
|
87636
|
+
threadId,
|
|
87637
|
+
...envelope
|
|
87638
|
+
});
|
|
87639
|
+
if (expectedCwd !== undefined && (0,node_fs__rspack_import_1.realpathSync)(resumed.cwd ?? resumed.thread.cwd) !== (0,node_fs__rspack_import_1.realpathSync)(expectedCwd)) throw new CodexSendError("Codex thread cwd does not match expectedCwd", {
|
|
87640
|
+
delivery: "rejected",
|
|
87641
|
+
reason: "cwd-mismatch",
|
|
87642
|
+
threadId,
|
|
87643
|
+
...envelope
|
|
87644
|
+
});
|
|
85761
87645
|
const state = threadState(resumed, threadId);
|
|
85762
87646
|
const receiptBase = {
|
|
85763
87647
|
threadId: resumed.thread.id,
|
|
@@ -85782,6 +87666,38 @@ async function sendToCodexThreadInner(threadId, text, { env, envelope, whenBusy
|
|
|
85782
87666
|
...envelope
|
|
85783
87667
|
});
|
|
85784
87668
|
}
|
|
87669
|
+
if (whenBusy === "steer") {
|
|
87670
|
+
let steered;
|
|
87671
|
+
try {
|
|
87672
|
+
steered = await client.request("turn/steer", {
|
|
87673
|
+
threadId,
|
|
87674
|
+
expectedTurnId,
|
|
87675
|
+
clientUserMessageId: envelope.messageId,
|
|
87676
|
+
input: [
|
|
87677
|
+
{
|
|
87678
|
+
type: "text",
|
|
87679
|
+
text: body
|
|
87680
|
+
}
|
|
87681
|
+
]
|
|
87682
|
+
});
|
|
87683
|
+
} catch (err) {
|
|
87684
|
+
throw unsupportedOrRpc(err, "turn/steer", threadId, envelope, expectedTurnId);
|
|
87685
|
+
}
|
|
87686
|
+
if (typeof steered?.turnId !== "string" || steered.turnId !== expectedTurnId) {
|
|
87687
|
+
throw new CodexSendError("Malformed turn/steer acknowledgment", {
|
|
87688
|
+
delivery: "unknown",
|
|
87689
|
+
reason: "bad-response",
|
|
87690
|
+
threadId,
|
|
87691
|
+
turnId: expectedTurnId,
|
|
87692
|
+
...envelope
|
|
87693
|
+
});
|
|
87694
|
+
}
|
|
87695
|
+
return {
|
|
87696
|
+
delivery: "accepted",
|
|
87697
|
+
...receiptBase,
|
|
87698
|
+
turnId: steered.turnId
|
|
87699
|
+
};
|
|
87700
|
+
}
|
|
85785
87701
|
if (state.busy) {
|
|
85786
87702
|
let queued;
|
|
85787
87703
|
try {
|
|
@@ -85825,9 +87741,11 @@ async function sendToCodexThreadInner(threadId, text, { env, envelope, whenBusy
|
|
|
85825
87741
|
// that arrives before the acknowledgment supplies our turn id wait in
|
|
85826
87742
|
// client.deferred and are adopted only on a match. Requests missing
|
|
85827
87743
|
// thread or turn IDs remain unanswered because ownership is unknown.
|
|
85828
|
-
|
|
85829
|
-
|
|
85830
|
-
|
|
87744
|
+
if (!session) {
|
|
87745
|
+
client.expectedThreadId = threadId;
|
|
87746
|
+
client.expectedTurnId = null;
|
|
87747
|
+
client.answerServerRequests = true;
|
|
87748
|
+
}
|
|
85831
87749
|
let turn;
|
|
85832
87750
|
try {
|
|
85833
87751
|
turn = await client.request("turn/start", {
|
|
@@ -85862,7 +87780,7 @@ async function sendToCodexThreadInner(threadId, text, { env, envelope, whenBusy
|
|
|
85862
87780
|
...envelope
|
|
85863
87781
|
});
|
|
85864
87782
|
}
|
|
85865
|
-
client._adoptTurn(turnId);
|
|
87783
|
+
if (!session) client._adoptTurn(turnId);
|
|
85866
87784
|
const freshRefused = client.refused.slice(seenRefused).filter((r)=>{
|
|
85867
87785
|
if (!r.answered) return false;
|
|
85868
87786
|
const params = r.params && typeof r.params === "object" && !Array.isArray(r.params) ? r.params : null;
|
|
@@ -85891,18 +87809,22 @@ async function sendToCodexThreadInner(threadId, text, { env, envelope, whenBusy
|
|
|
85891
87809
|
turnStatus: turn.turn.status
|
|
85892
87810
|
};
|
|
85893
87811
|
} finally{
|
|
85894
|
-
client.close();
|
|
87812
|
+
if (!session) client.close();
|
|
85895
87813
|
}
|
|
85896
87814
|
}
|
|
85897
87815
|
|
|
85898
87816
|
__webpack_require__.d(__webpack_exports__, {
|
|
87817
|
+
$3: () => (assertThreadAllowed),
|
|
85899
87818
|
Bt: () => (listCodexQueue),
|
|
85900
87819
|
MU: () => (codexStatus),
|
|
85901
87820
|
Mr: () => (withEnvelopeHeader),
|
|
85902
87821
|
X$: () => (listCodexThreads),
|
|
85903
87822
|
ZS: () => (sendToCodexThread),
|
|
87823
|
+
e0: () => (experimentalEnabled),
|
|
87824
|
+
eC: () => (openCodexSession),
|
|
85904
87825
|
nq: () => (buildEnvelope),
|
|
85905
|
-
pF: () => (singleLine)
|
|
87826
|
+
pF: () => (singleLine),
|
|
87827
|
+
ql: () => (codexSocketPath)
|
|
85906
87828
|
});
|
|
85907
87829
|
|
|
85908
87830
|
|
|
@@ -86026,6 +87948,452 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
86026
87948
|
});
|
|
86027
87949
|
|
|
86028
87950
|
|
|
87951
|
+
},
|
|
87952
|
+
"./src/core/codex/conversation.js"(__unused_rspack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
87953
|
+
/* import */ var _contract_js__rspack_import_0 = __webpack_require__("./src/core/codex/contract.js");
|
|
87954
|
+
/* import */ var node_fs__rspack_import_1 = __webpack_require__("node:fs");
|
|
87955
|
+
/* import */ var _codex_bridge_js__rspack_import_2 = __webpack_require__("./src/core/codex-bridge.js");
|
|
87956
|
+
|
|
87957
|
+
|
|
87958
|
+
|
|
87959
|
+
const ID = /^[A-Za-z0-9_.:-]{1,128}$/;
|
|
87960
|
+
const BUDGET = 4 * 1024 * 1024;
|
|
87961
|
+
function conversationId(value, name = 'threadId') {
|
|
87962
|
+
if (typeof value !== 'string' || !ID.test(value)) throw new RangeError(`${name} must be 1-128 identifier characters`);
|
|
87963
|
+
return value;
|
|
87964
|
+
}
|
|
87965
|
+
function boundedInteger(value, max, name) {
|
|
87966
|
+
if (!Number.isInteger(value) || value < 1 || value > max) throw new RangeError(`${name} must be an integer 1-${max}`);
|
|
87967
|
+
return value;
|
|
87968
|
+
}
|
|
87969
|
+
const terminal = (status)=>[
|
|
87970
|
+
'completed',
|
|
87971
|
+
'failed',
|
|
87972
|
+
'interrupted'
|
|
87973
|
+
].includes(status);
|
|
87974
|
+
const namedTurn = (p)=>p?.turnId ?? p?.turn_id ?? p?.turn?.id;
|
|
87975
|
+
/** Bounded traversal; a coverage failure throws and must never be interpreted as not found. */ async function visitCodexHistory(session, threadId, method, params, visit, { signal, stopped = ()=>false } = {}) {
|
|
87976
|
+
if (![
|
|
87977
|
+
'thread/turns/list',
|
|
87978
|
+
'thread/items/list'
|
|
87979
|
+
].includes(method)) throw new RangeError('Unsupported history method');
|
|
87980
|
+
conversationId(threadId);
|
|
87981
|
+
const client = session.client;
|
|
87982
|
+
let cursor;
|
|
87983
|
+
const seen = new Set();
|
|
87984
|
+
for(let page = 0; page < 20; page++){
|
|
87985
|
+
if (stopped() || signal?.aborted) throw new Error('History coverage incomplete: observation cancelled');
|
|
87986
|
+
const result = await client.request(method, {
|
|
87987
|
+
...params,
|
|
87988
|
+
threadId,
|
|
87989
|
+
limit: 100,
|
|
87990
|
+
...cursor ? {
|
|
87991
|
+
cursor
|
|
87992
|
+
} : {}
|
|
87993
|
+
});
|
|
87994
|
+
if (stopped() || signal?.aborted) throw new Error('History coverage incomplete: observation cancelled');
|
|
87995
|
+
if (!Array.isArray(result?.data) || result.data.length > 100 || result.nextCursor != null && (typeof result.nextCursor !== 'string' || !result.nextCursor || result.nextCursor.length > 4096)) throw new Error(`Invalid ${method} page`);
|
|
87996
|
+
if (visit(result.data)) return {
|
|
87997
|
+
complete: false,
|
|
87998
|
+
reason: 'matched',
|
|
87999
|
+
pages: page + 1
|
|
88000
|
+
};
|
|
88001
|
+
if (result.nextCursor == null) return {
|
|
88002
|
+
complete: true,
|
|
88003
|
+
reason: 'exhausted',
|
|
88004
|
+
pages: page + 1
|
|
88005
|
+
};
|
|
88006
|
+
if (seen.has(result.nextCursor)) throw new Error('History coverage incomplete: repeated pagination cursor');
|
|
88007
|
+
seen.add(result.nextCursor);
|
|
88008
|
+
cursor = result.nextCursor;
|
|
88009
|
+
}
|
|
88010
|
+
throw new Error('History coverage incomplete: 20 page limit');
|
|
88011
|
+
}
|
|
88012
|
+
/** A bounded observer. Cancellation ends observation, never the daemon's turn. */ async function openCodexConversation(threadId, options = {}) {
|
|
88013
|
+
conversationId(threadId);
|
|
88014
|
+
const { env = process.env, expectedCwd, signal, onEvent } = options;
|
|
88015
|
+
(0,_codex_bridge_js__rspack_import_2/* .assertThreadAllowed */.$3)(threadId, env);
|
|
88016
|
+
if (signal !== undefined && !(signal instanceof AbortSignal)) throw new TypeError('signal must be an AbortSignal');
|
|
88017
|
+
if (onEvent !== undefined && typeof onEvent !== 'function') throw new TypeError('onEvent must be a function');
|
|
88018
|
+
if (signal?.aborted) throw new Error('Observation cancelled');
|
|
88019
|
+
const expected = expectedCwd === undefined ? undefined : (0,node_fs__rspack_import_1.realpathSync)(expectedCwd);
|
|
88020
|
+
const session = options.session ?? await (0,_codex_bridge_js__rspack_import_2/* .openCodexSession */.eC)(env, {
|
|
88021
|
+
signal,
|
|
88022
|
+
experimental: (0,_codex_bridge_js__rspack_import_2/* .experimentalEnabled */.e0)(env)
|
|
88023
|
+
});
|
|
88024
|
+
const { client } = session;
|
|
88025
|
+
const events = [];
|
|
88026
|
+
const acceptedTurns = new Set();
|
|
88027
|
+
const wake = new Set();
|
|
88028
|
+
let bytes = 0, overflow = false, disconnected = client.closed, closed = false;
|
|
88029
|
+
const record = (event)=>{
|
|
88030
|
+
const size = Buffer.byteLength(JSON.stringify(event));
|
|
88031
|
+
if (size > BUDGET) {
|
|
88032
|
+
overflow = true;
|
|
88033
|
+
} else {
|
|
88034
|
+
while(events.length >= 500 || bytes + size > BUDGET){
|
|
88035
|
+
bytes -= events.shift().bytes;
|
|
88036
|
+
overflow = true;
|
|
88037
|
+
}
|
|
88038
|
+
events.push({
|
|
88039
|
+
event,
|
|
88040
|
+
bytes: size
|
|
88041
|
+
});
|
|
88042
|
+
bytes += size;
|
|
88043
|
+
}
|
|
88044
|
+
for (const listener of [
|
|
88045
|
+
...wake
|
|
88046
|
+
])listener();
|
|
88047
|
+
return onEvent?.(event);
|
|
88048
|
+
};
|
|
88049
|
+
const observe = (kind)=>(message)=>{
|
|
88050
|
+
const p = message.params;
|
|
88051
|
+
if ((p?.threadId ?? p?.thread_id) !== threadId) return;
|
|
88052
|
+
return record({
|
|
88053
|
+
kind,
|
|
88054
|
+
...message
|
|
88055
|
+
});
|
|
88056
|
+
};
|
|
88057
|
+
const unsubs = [
|
|
88058
|
+
client.onNotification(observe('notification')),
|
|
88059
|
+
client.onServerRequest(observe('interaction')),
|
|
88060
|
+
client.onClose((error)=>{
|
|
88061
|
+
disconnected = true;
|
|
88062
|
+
return record({
|
|
88063
|
+
kind: 'disconnect',
|
|
88064
|
+
error: error?.message
|
|
88065
|
+
});
|
|
88066
|
+
})
|
|
88067
|
+
];
|
|
88068
|
+
const close = async ()=>{
|
|
88069
|
+
if (closed) return;
|
|
88070
|
+
closed = true;
|
|
88071
|
+
for (const unsubscribe of unsubs)unsubscribe();
|
|
88072
|
+
for (const listener of wake)listener();
|
|
88073
|
+
if (!options.session) client.close();
|
|
88074
|
+
};
|
|
88075
|
+
let resumed;
|
|
88076
|
+
try {
|
|
88077
|
+
resumed = await client.request('thread/resume', {
|
|
88078
|
+
threadId,
|
|
88079
|
+
excludeTurns: true
|
|
88080
|
+
});
|
|
88081
|
+
if (resumed?.thread?.id !== threadId) throw new Error('thread/resume returned a different thread ID');
|
|
88082
|
+
const cwd = resumed.cwd ?? resumed.thread.cwd;
|
|
88083
|
+
if (expected !== undefined && (typeof cwd !== 'string' || (0,node_fs__rspack_import_1.realpathSync)(cwd) !== expected)) throw new Error('Codex thread cwd does not match expectedCwd');
|
|
88084
|
+
} catch (error) {
|
|
88085
|
+
await close();
|
|
88086
|
+
throw error;
|
|
88087
|
+
}
|
|
88088
|
+
/** @param {{turnId: string, messageId?: string, afterMessageId?: string|string[], timeoutMs?: number, signal?: AbortSignal, maxOutputBytes?: number}} options */ async function wait({ turnId, messageId, afterMessageId, timeoutMs = 120000, signal: waitSignal, maxOutputBytes = 1048576 }) {
|
|
88089
|
+
conversationId(turnId, 'turnId');
|
|
88090
|
+
if (messageId !== undefined) conversationId(messageId, 'messageId');
|
|
88091
|
+
const anchors = afterMessageId === undefined ? [] : Array.isArray(afterMessageId) ? afterMessageId : [
|
|
88092
|
+
afterMessageId
|
|
88093
|
+
];
|
|
88094
|
+
if (afterMessageId !== undefined) boundedInteger(anchors.length, 200, 'afterMessageId count');
|
|
88095
|
+
for (const anchor of anchors)conversationId(anchor, 'afterMessageId');
|
|
88096
|
+
boundedInteger(timeoutMs, 600000, 'timeoutMs');
|
|
88097
|
+
boundedInteger(maxOutputBytes, BUDGET, 'maxOutputBytes');
|
|
88098
|
+
if (waitSignal !== undefined && !(waitSignal instanceof AbortSignal)) throw new TypeError('signal must be an AbortSignal');
|
|
88099
|
+
let done = false, status = acceptedTurns.has(turnId) ? 'inProgress' : undefined, error, historyError, itemBytes = 0, truncated = overflow;
|
|
88100
|
+
const items = new Map();
|
|
88101
|
+
const add = (item)=>{
|
|
88102
|
+
if (!item || typeof item.id !== 'string' || typeof item.type !== 'string') throw new Error('Invalid history item');
|
|
88103
|
+
if (item.type !== 'agentMessage' || typeof item.text !== 'string' || item.phase !== 'final_answer' && item.phase != null) return;
|
|
88104
|
+
const normalized = {
|
|
88105
|
+
id: item.id,
|
|
88106
|
+
type: item.type,
|
|
88107
|
+
phase: item.phase ?? null,
|
|
88108
|
+
text: item.text
|
|
88109
|
+
};
|
|
88110
|
+
const size = Buffer.byteLength(JSON.stringify(normalized));
|
|
88111
|
+
const prior = items.get(item.id);
|
|
88112
|
+
if (itemBytes - (prior?.bytes ?? 0) + size > BUDGET || !prior && items.size >= 2000) {
|
|
88113
|
+
truncated = true;
|
|
88114
|
+
return;
|
|
88115
|
+
}
|
|
88116
|
+
itemBytes += size - (prior?.bytes ?? 0);
|
|
88117
|
+
items.set(item.id, {
|
|
88118
|
+
item: normalized,
|
|
88119
|
+
bytes: size
|
|
88120
|
+
});
|
|
88121
|
+
};
|
|
88122
|
+
const scan = ()=>{
|
|
88123
|
+
const interactions = new Map();
|
|
88124
|
+
for (const { event } of events){
|
|
88125
|
+
const p = event.params;
|
|
88126
|
+
if (event.method === 'serverRequest/resolved') {
|
|
88127
|
+
interactions.delete(p.requestId);
|
|
88128
|
+
continue;
|
|
88129
|
+
}
|
|
88130
|
+
if (namedTurn(p) !== turnId) continue;
|
|
88131
|
+
if (event.kind === 'interaction') interactions.set(event.id, event);
|
|
88132
|
+
if (event.method === 'turn/started' && !terminal(status)) status = p.turn?.status;
|
|
88133
|
+
if (event.method === 'item/completed' && afterMessageId === undefined) add(p.item);
|
|
88134
|
+
if (event.method === 'turn/completed') {
|
|
88135
|
+
status = p.turn?.status;
|
|
88136
|
+
error = p.turn?.error;
|
|
88137
|
+
if (afterMessageId === undefined) for (const item of p.turn?.items ?? [])add(item);
|
|
88138
|
+
}
|
|
88139
|
+
}
|
|
88140
|
+
return [
|
|
88141
|
+
...interactions.values()
|
|
88142
|
+
];
|
|
88143
|
+
};
|
|
88144
|
+
const result = (state, detail)=>{
|
|
88145
|
+
const interactions = scan();
|
|
88146
|
+
const candidates = [
|
|
88147
|
+
...items.values()
|
|
88148
|
+
].map((x)=>x.item);
|
|
88149
|
+
const finals = candidates.filter((i)=>i.phase === 'final_answer');
|
|
88150
|
+
// Old app-servers omit phase; use their completed agent items only at terminal status.
|
|
88151
|
+
const selected = finals.length ? finals : terminal(state) ? candidates : [];
|
|
88152
|
+
const reply = {
|
|
88153
|
+
text: '',
|
|
88154
|
+
items: [],
|
|
88155
|
+
truncated: truncated || overflow
|
|
88156
|
+
};
|
|
88157
|
+
for (const item of selected){
|
|
88158
|
+
const text = reply.text ? `${reply.text}\n${item.text}` : item.text;
|
|
88159
|
+
if (Buffer.byteLength(JSON.stringify({
|
|
88160
|
+
text,
|
|
88161
|
+
items: [
|
|
88162
|
+
...reply.items,
|
|
88163
|
+
item
|
|
88164
|
+
]
|
|
88165
|
+
})) > maxOutputBytes) {
|
|
88166
|
+
reply.truncated = true;
|
|
88167
|
+
break;
|
|
88168
|
+
}
|
|
88169
|
+
reply.text = text;
|
|
88170
|
+
reply.items.push(item);
|
|
88171
|
+
}
|
|
88172
|
+
return {
|
|
88173
|
+
threadId,
|
|
88174
|
+
turnId,
|
|
88175
|
+
...messageId === undefined ? {} : {
|
|
88176
|
+
messageId
|
|
88177
|
+
},
|
|
88178
|
+
execution: {
|
|
88179
|
+
state,
|
|
88180
|
+
...detail ? {
|
|
88181
|
+
error: detail
|
|
88182
|
+
} : {}
|
|
88183
|
+
},
|
|
88184
|
+
reply,
|
|
88185
|
+
interactions
|
|
88186
|
+
};
|
|
88187
|
+
};
|
|
88188
|
+
let timer, notify;
|
|
88189
|
+
const abortSignals = [
|
|
88190
|
+
signal,
|
|
88191
|
+
waitSignal
|
|
88192
|
+
].filter(Boolean);
|
|
88193
|
+
const stopped = new Promise((resolve)=>{
|
|
88194
|
+
notify = ()=>{
|
|
88195
|
+
if (abortSignals.some((s)=>s.aborted) || closed) resolve([
|
|
88196
|
+
'unknown',
|
|
88197
|
+
'Observation cancelled'
|
|
88198
|
+
]);
|
|
88199
|
+
else if (disconnected) resolve([
|
|
88200
|
+
'disconnected',
|
|
88201
|
+
'Codex connection closed'
|
|
88202
|
+
]);
|
|
88203
|
+
};
|
|
88204
|
+
timer = setTimeout(()=>resolve([
|
|
88205
|
+
'timeout',
|
|
88206
|
+
'Observation deadline reached'
|
|
88207
|
+
]), timeoutMs);
|
|
88208
|
+
for (const s of abortSignals)s.addEventListener('abort', notify, {
|
|
88209
|
+
once: true
|
|
88210
|
+
});
|
|
88211
|
+
wake.add(notify);
|
|
88212
|
+
notify();
|
|
88213
|
+
});
|
|
88214
|
+
const collect = async ()=>{
|
|
88215
|
+
scan();
|
|
88216
|
+
try {
|
|
88217
|
+
let found = false, historyTerminal = false, anchorFound = afterMessageId === undefined;
|
|
88218
|
+
const missingAnchors = new Set(anchors);
|
|
88219
|
+
await visitCodexHistory(session, threadId, 'thread/turns/list', {}, (data)=>{
|
|
88220
|
+
for (const turn of data)if (!turn || typeof turn.id !== 'string' || typeof turn.status !== 'string') throw new Error('Invalid turn history');
|
|
88221
|
+
const turn = data.find((t)=>t.id === turnId);
|
|
88222
|
+
if (!turn) return false;
|
|
88223
|
+
found = true;
|
|
88224
|
+
historyTerminal = terminal(turn.status);
|
|
88225
|
+
if (!terminal(status)) {
|
|
88226
|
+
status = turn.status;
|
|
88227
|
+
error = turn.error;
|
|
88228
|
+
}
|
|
88229
|
+
return true;
|
|
88230
|
+
}, {
|
|
88231
|
+
stopped: ()=>done
|
|
88232
|
+
});
|
|
88233
|
+
// Notifications can establish completion while the history response is in flight.
|
|
88234
|
+
scan();
|
|
88235
|
+
if (!found && !status) return [
|
|
88236
|
+
'unknown',
|
|
88237
|
+
'History coverage incomplete: selected turn not found'
|
|
88238
|
+
];
|
|
88239
|
+
await visitCodexHistory(session, threadId, 'thread/items/list', {
|
|
88240
|
+
turnId,
|
|
88241
|
+
sortDirection: 'asc'
|
|
88242
|
+
}, (data)=>{
|
|
88243
|
+
for (const row of data){
|
|
88244
|
+
if (!row || row.turnId !== turnId || !row.item) throw new Error('Invalid thread/items/list wrapper');
|
|
88245
|
+
if (row.item.type === 'userMessage' && anchors.includes(row.item.clientId)) {
|
|
88246
|
+
anchorFound = true;
|
|
88247
|
+
missingAnchors.delete(row.item.clientId);
|
|
88248
|
+
}
|
|
88249
|
+
if (anchorFound) add(row.item);
|
|
88250
|
+
}
|
|
88251
|
+
return false;
|
|
88252
|
+
}, {
|
|
88253
|
+
stopped: ()=>done
|
|
88254
|
+
});
|
|
88255
|
+
if (!anchorFound || missingAnchors.size) {
|
|
88256
|
+
items.clear();
|
|
88257
|
+
return [
|
|
88258
|
+
'unknown',
|
|
88259
|
+
'History coverage incomplete: reply anchor not found'
|
|
88260
|
+
];
|
|
88261
|
+
}
|
|
88262
|
+
if (afterMessageId !== undefined && !historyTerminal) return scan().length ? [
|
|
88263
|
+
'waiting-for-input'
|
|
88264
|
+
] : [
|
|
88265
|
+
'unknown',
|
|
88266
|
+
'Anchored reply awaits terminal history'
|
|
88267
|
+
];
|
|
88268
|
+
} catch (err) {
|
|
88269
|
+
historyError = err.message;
|
|
88270
|
+
truncated = true;
|
|
88271
|
+
}
|
|
88272
|
+
if (afterMessageId !== undefined && historyError) {
|
|
88273
|
+
items.clear();
|
|
88274
|
+
return [
|
|
88275
|
+
'unknown',
|
|
88276
|
+
historyError
|
|
88277
|
+
];
|
|
88278
|
+
}
|
|
88279
|
+
while(!done){
|
|
88280
|
+
const interactions = scan();
|
|
88281
|
+
if (terminal(status)) return [
|
|
88282
|
+
status,
|
|
88283
|
+
error ?? historyError
|
|
88284
|
+
];
|
|
88285
|
+
if (historyError || overflow) return [
|
|
88286
|
+
'unknown',
|
|
88287
|
+
historyError ?? 'Notification coverage overflow'
|
|
88288
|
+
];
|
|
88289
|
+
if (interactions.length) return [
|
|
88290
|
+
'waiting-for-input'
|
|
88291
|
+
];
|
|
88292
|
+
await new Promise((resolve)=>{
|
|
88293
|
+
const listener = ()=>{
|
|
88294
|
+
wake.delete(listener);
|
|
88295
|
+
resolve();
|
|
88296
|
+
};
|
|
88297
|
+
wake.add(listener);
|
|
88298
|
+
});
|
|
88299
|
+
}
|
|
88300
|
+
return [
|
|
88301
|
+
'unknown',
|
|
88302
|
+
'Observation ended'
|
|
88303
|
+
];
|
|
88304
|
+
};
|
|
88305
|
+
try {
|
|
88306
|
+
const [state, detail] = await Promise.race([
|
|
88307
|
+
stopped,
|
|
88308
|
+
collect()
|
|
88309
|
+
]);
|
|
88310
|
+
return result(state, detail);
|
|
88311
|
+
} finally{
|
|
88312
|
+
done = true;
|
|
88313
|
+
clearTimeout(timer);
|
|
88314
|
+
wake.delete(notify);
|
|
88315
|
+
for (const s of abortSignals)s.removeEventListener('abort', notify);
|
|
88316
|
+
for (const listener of [
|
|
88317
|
+
...wake
|
|
88318
|
+
])listener();
|
|
88319
|
+
}
|
|
88320
|
+
}
|
|
88321
|
+
/** @param {{timeoutMs?: number, maxEvents?: number, signal?: AbortSignal}} [options] */ async function watch({ timeoutMs = 30000, maxEvents = 100, signal: watchSignal } = {}) {
|
|
88322
|
+
boundedInteger(timeoutMs, 600000, 'timeoutMs');
|
|
88323
|
+
boundedInteger(maxEvents, 500, 'maxEvents');
|
|
88324
|
+
if (watchSignal !== undefined && !(watchSignal instanceof AbortSignal)) throw new TypeError('signal must be an AbortSignal');
|
|
88325
|
+
const signals = [
|
|
88326
|
+
signal,
|
|
88327
|
+
watchSignal
|
|
88328
|
+
].filter(Boolean);
|
|
88329
|
+
let timer, listener;
|
|
88330
|
+
const reason = await new Promise((resolve)=>{
|
|
88331
|
+
listener = ()=>{
|
|
88332
|
+
if (signals.some((s)=>s.aborted) || closed) resolve('cancelled');
|
|
88333
|
+
else if (disconnected) resolve('disconnected');
|
|
88334
|
+
else if (events.length >= maxEvents) resolve('event-limit');
|
|
88335
|
+
};
|
|
88336
|
+
timer = setTimeout(()=>resolve('timeout'), timeoutMs);
|
|
88337
|
+
wake.add(listener);
|
|
88338
|
+
for (const s of signals)s.addEventListener('abort', listener, {
|
|
88339
|
+
once: true
|
|
88340
|
+
});
|
|
88341
|
+
listener();
|
|
88342
|
+
});
|
|
88343
|
+
clearTimeout(timer);
|
|
88344
|
+
wake.delete(listener);
|
|
88345
|
+
for (const s of signals)s.removeEventListener('abort', listener);
|
|
88346
|
+
return {
|
|
88347
|
+
threadId,
|
|
88348
|
+
events: events.slice(0, maxEvents).map((x)=>x.event),
|
|
88349
|
+
reason,
|
|
88350
|
+
truncated: overflow || events.length > maxEvents
|
|
88351
|
+
};
|
|
88352
|
+
}
|
|
88353
|
+
return {
|
|
88354
|
+
threadId,
|
|
88355
|
+
cwd: resumed.cwd ?? resumed.thread.cwd,
|
|
88356
|
+
wait,
|
|
88357
|
+
watch,
|
|
88358
|
+
close,
|
|
88359
|
+
/** @param {string} text
|
|
88360
|
+
* @param {{envelope?: object, whenBusy?: string, expectedTurnId?: string, signal?: AbortSignal}} [options] */ async send (text, { envelope = (0,_codex_bridge_js__rspack_import_2/* .buildEnvelope */.nq)({
|
|
88361
|
+
env
|
|
88362
|
+
}), whenBusy = 'reject', expectedTurnId, signal: sendSignal } = {}) {
|
|
88363
|
+
if (closed) return (0,_contract_js__rspack_import_0/* .outcomeFromError */.DG)(Object.assign(new Error('Conversation closed'), {
|
|
88364
|
+
delivery: 'rejected',
|
|
88365
|
+
reason: 'closed',
|
|
88366
|
+
threadId,
|
|
88367
|
+
envelope
|
|
88368
|
+
}));
|
|
88369
|
+
if (sendSignal !== undefined && !(sendSignal instanceof AbortSignal)) throw new TypeError('signal must be an AbortSignal');
|
|
88370
|
+
const submissionSignal = signal && sendSignal ? AbortSignal.any([
|
|
88371
|
+
signal,
|
|
88372
|
+
sendSignal
|
|
88373
|
+
]) : sendSignal ?? signal;
|
|
88374
|
+
const receipt = await (0,_codex_bridge_js__rspack_import_2/* .sendToCodexThread */.ZS)(threadId, text, {
|
|
88375
|
+
env,
|
|
88376
|
+
envelope,
|
|
88377
|
+
whenBusy,
|
|
88378
|
+
expectedTurnId,
|
|
88379
|
+
session,
|
|
88380
|
+
expectedCwd,
|
|
88381
|
+
signal: submissionSignal
|
|
88382
|
+
});
|
|
88383
|
+
if (receipt.delivery === 'accepted' && receipt.turnId) {
|
|
88384
|
+
acceptedTurns.add(receipt.turnId);
|
|
88385
|
+
if (acceptedTurns.size > 100) acceptedTurns.delete(acceptedTurns.values().next().value);
|
|
88386
|
+
}
|
|
88387
|
+
return receipt;
|
|
88388
|
+
}
|
|
88389
|
+
};
|
|
88390
|
+
}
|
|
88391
|
+
|
|
88392
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
88393
|
+
j: () => (openCodexConversation)
|
|
88394
|
+
});
|
|
88395
|
+
|
|
88396
|
+
|
|
86029
88397
|
},
|
|
86030
88398
|
"./src/core/commands.js"(__unused_rspack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
86031
88399
|
/* import */ var _store_js__rspack_import_0 = __webpack_require__("./src/core/store.js");
|
|
@@ -86057,7 +88425,7 @@ async function openBackend(opts) {
|
|
|
86057
88425
|
setGroupMembers: (group, members)=>_gateway_js__rspack_import_1/* .setGroupMembers */.Td(session, group, members),
|
|
86058
88426
|
addGroupMember: (group, bot)=>_gateway_js__rspack_import_1/* .addGroupMember */.zr(session, group, bot),
|
|
86059
88427
|
removeGroupMember: (group, bot)=>_gateway_js__rspack_import_1/* .removeGroupMember */.A0(session, group, bot),
|
|
86060
|
-
send: (ref, prompt)=>_gateway_js__rspack_import_1/* .sendPrompt */.LV(session, ref, prompt),
|
|
88428
|
+
send: (ref, prompt, extra)=>_gateway_js__rspack_import_1/* .sendPrompt */.LV(session, ref, prompt, extra),
|
|
86061
88429
|
transcript: (ref, limit)=>_gateway_js__rspack_import_1/* .getTranscriptTail */.bA(session, ref, limit),
|
|
86062
88430
|
thread: (ref, rootId)=>_gateway_js__rspack_import_1/* .getThread */.fG(session, ref, rootId)
|
|
86063
88431
|
};
|
|
@@ -86788,6 +89156,21 @@ class GatewayError extends Error {
|
|
|
86788
89156
|
// ponytail: fixed 30 s deadline and buffered byte cap; upgrade path is per-method budgets plus streaming reads.
|
|
86789
89157
|
const GATEWAY_TIMEOUT_MS = 30000;
|
|
86790
89158
|
const GATEWAY_MAX_RESPONSE_BYTES = 2 * 1024 * 1024;
|
|
89159
|
+
function assertGatewayActive(signal) {
|
|
89160
|
+
if (signal?.aborted) {
|
|
89161
|
+
const error = new GatewayError("Gateway submission cancelled before transmission");
|
|
89162
|
+
error.delivery = "rejected";
|
|
89163
|
+
error.reason = "cancelled";
|
|
89164
|
+
throw error;
|
|
89165
|
+
}
|
|
89166
|
+
}
|
|
89167
|
+
function gatewayDeadline(signal) {
|
|
89168
|
+
const timeout = AbortSignal.timeout(GATEWAY_TIMEOUT_MS);
|
|
89169
|
+
return signal ? AbortSignal.any([
|
|
89170
|
+
signal,
|
|
89171
|
+
timeout
|
|
89172
|
+
]) : timeout;
|
|
89173
|
+
}
|
|
86791
89174
|
function backendBase() {
|
|
86792
89175
|
return (process.env.CURSOR_API_BASE_URL || "https://api2.cursor.sh").replace(/\/$/, "");
|
|
86793
89176
|
}
|
|
@@ -86876,18 +89259,26 @@ function pick(obj, ...keys) {
|
|
|
86876
89259
|
}
|
|
86877
89260
|
return undefined;
|
|
86878
89261
|
}
|
|
86879
|
-
async function ensureSandbox(accessToken) {
|
|
89262
|
+
async function ensureSandbox(accessToken, { signal } = {}) {
|
|
89263
|
+
assertGatewayActive(signal);
|
|
86880
89264
|
const url = (0,_url_policy_js__rspack_import_3/* .assertAllowedCredentialUrl */.Re)(backendBase(), {
|
|
86881
89265
|
kind: "backend"
|
|
86882
89266
|
}) + "/aiserver.v1.GrokBotService/EnsureSandBox";
|
|
86883
|
-
|
|
86884
|
-
|
|
86885
|
-
|
|
86886
|
-
|
|
86887
|
-
|
|
86888
|
-
|
|
86889
|
-
|
|
86890
|
-
|
|
89267
|
+
let res, body;
|
|
89268
|
+
try {
|
|
89269
|
+
res = await fetch(url, {
|
|
89270
|
+
method: "POST",
|
|
89271
|
+
redirect: "error",
|
|
89272
|
+
signal: gatewayDeadline(signal),
|
|
89273
|
+
headers: (0,_headers_js__rspack_import_4/* .ensureSandboxHeaders */._6)(accessToken),
|
|
89274
|
+
body: "{}"
|
|
89275
|
+
});
|
|
89276
|
+
body = await readJson(res);
|
|
89277
|
+
} catch (error) {
|
|
89278
|
+
assertGatewayActive(signal);
|
|
89279
|
+
throw error;
|
|
89280
|
+
}
|
|
89281
|
+
assertGatewayActive(signal);
|
|
86891
89282
|
if (!res.ok) {
|
|
86892
89283
|
const detail = body.message || body.error || body.raw || res.statusText;
|
|
86893
89284
|
throw new GatewayError("EnsureSandBox failed: " + res.status + " " + (0,_url_policy_js__rspack_import_3/* .redactSecrets */.fp)(detail), {
|
|
@@ -86908,7 +89299,8 @@ async function ensureSandbox(accessToken) {
|
|
|
86908
89299
|
gatewayHeaders: (0,_headers_js__rspack_import_4/* .mergeGatewayHeaders */.bQ)((0,_headers_js__rspack_import_4/* .headersFromEnsureSandbox */.Ew)(body), (0,_headers_js__rspack_import_4/* .headersFromEnv */.gx)())
|
|
86909
89300
|
};
|
|
86910
89301
|
}
|
|
86911
|
-
async function connectGateway() {
|
|
89302
|
+
async function connectGateway({ signal } = {}) {
|
|
89303
|
+
assertGatewayActive(signal);
|
|
86912
89304
|
const override = gatewayOverride();
|
|
86913
89305
|
if (override) return override;
|
|
86914
89306
|
const fromApp = sessionFromApp();
|
|
@@ -86917,21 +89309,36 @@ async function connectGateway() {
|
|
|
86917
89309
|
if (!token) {
|
|
86918
89310
|
throw new GatewayError("Set CURSOR_ACCESS_TOKEN, or GROK_BOT_GATEWAY_URL + GROK_BOT_GATEWAY_TOKEN. Do not use a Cursor dashboard API key.");
|
|
86919
89311
|
}
|
|
86920
|
-
return ensureSandbox(token
|
|
89312
|
+
return ensureSandbox(token, {
|
|
89313
|
+
signal
|
|
89314
|
+
});
|
|
86921
89315
|
}
|
|
86922
|
-
async function gatewayCall(session, method, body = {}) {
|
|
89316
|
+
async function gatewayCall(session, method, body = {}, { signal } = {}) {
|
|
89317
|
+
assertGatewayActive(signal);
|
|
86923
89318
|
const base = (0,_url_policy_js__rspack_import_3/* .assertAllowedCredentialUrl */.Re)(session.gatewayUrl, {
|
|
86924
89319
|
kind: "gateway"
|
|
86925
89320
|
});
|
|
86926
89321
|
const url = base + "/api/" + method;
|
|
86927
|
-
|
|
89322
|
+
// Cancellation can abort read/auth preflights. Once a prompt request starts,
|
|
89323
|
+
// observe its actual receipt (or timeout) instead of losing certainty on stop.
|
|
89324
|
+
const prompt = method === "sendPrompt";
|
|
89325
|
+
const options = {
|
|
86928
89326
|
method: "POST",
|
|
86929
89327
|
redirect: "error",
|
|
86930
|
-
signal:
|
|
89328
|
+
signal: gatewayDeadline(prompt ? undefined : signal),
|
|
86931
89329
|
headers: (0,_headers_js__rspack_import_4/* .requestHeaders */.A1)(session),
|
|
86932
89330
|
body: JSON.stringify(body)
|
|
86933
|
-
}
|
|
86934
|
-
|
|
89331
|
+
};
|
|
89332
|
+
assertGatewayActive(signal); // Final synchronous boundary before transmission.
|
|
89333
|
+
let res, data;
|
|
89334
|
+
try {
|
|
89335
|
+
res = await fetch(url, options);
|
|
89336
|
+
data = await readJson(res);
|
|
89337
|
+
} catch (error) {
|
|
89338
|
+
if (!prompt) assertGatewayActive(signal);
|
|
89339
|
+
throw error;
|
|
89340
|
+
}
|
|
89341
|
+
if (!prompt) assertGatewayActive(signal);
|
|
86935
89342
|
if (!res.ok) {
|
|
86936
89343
|
const detail = data.message || data.error || data.raw || res.statusText;
|
|
86937
89344
|
throw new GatewayError(method + " failed: " + res.status + " " + (0,_url_policy_js__rspack_import_3/* .redactSecrets */.fp)(String(detail).slice(0, 300)), {
|
|
@@ -86983,8 +89390,10 @@ function unwrapList(data) {
|
|
|
86983
89390
|
function unwrapOne(data) {
|
|
86984
89391
|
return asRecord(data.agent || data);
|
|
86985
89392
|
}
|
|
86986
|
-
async function listAgents(session) {
|
|
86987
|
-
const data = await gatewayCall(session, "listAgents", {}
|
|
89393
|
+
async function listAgents(session, { signal } = {}) {
|
|
89394
|
+
const data = await gatewayCall(session, "listAgents", {}, {
|
|
89395
|
+
signal
|
|
89396
|
+
});
|
|
86988
89397
|
return unwrapList(data).map(asRecord).filter((r)=>r && r.id);
|
|
86989
89398
|
}
|
|
86990
89399
|
function resolveFromList(records, ref) {
|
|
@@ -86996,8 +89405,10 @@ function resolveFromList(records, ref) {
|
|
|
86996
89405
|
if (matches.length === 0) throw new GatewayError("No bot or group named \"" + ref + "\"");
|
|
86997
89406
|
throw new GatewayError("Ambiguous name \"" + ref + "\"");
|
|
86998
89407
|
}
|
|
86999
|
-
async function resolveRef(session, ref) {
|
|
87000
|
-
return resolveFromList(await listAgents(session
|
|
89408
|
+
async function resolveRef(session, ref, { signal } = {}) {
|
|
89409
|
+
return resolveFromList(await listAgents(session, {
|
|
89410
|
+
signal
|
|
89411
|
+
}), ref);
|
|
87001
89412
|
}
|
|
87002
89413
|
async function createAgent(session, input) {
|
|
87003
89414
|
const data = await gatewayCall(session, "createAgent", {
|
|
@@ -87119,16 +89530,22 @@ async function removeGroupMember(session, groupRef, memberRef) {
|
|
|
87119
89530
|
const next = group.memberIds.filter((id)=>id !== member.id);
|
|
87120
89531
|
return setGroupMembers(session, group.id, next);
|
|
87121
89532
|
}
|
|
87122
|
-
async function sendPrompt(session, ref, prompt) {
|
|
87123
|
-
|
|
89533
|
+
async function sendPrompt(session, ref, prompt, extra = {}) {
|
|
89534
|
+
assertGatewayActive(extra.signal);
|
|
89535
|
+
const rec = await resolveRef(session, ref, {
|
|
89536
|
+
signal: extra.signal
|
|
89537
|
+
});
|
|
87124
89538
|
const body = {
|
|
87125
89539
|
agentId: rec.id,
|
|
87126
89540
|
prompt,
|
|
87127
|
-
clientNonce: (0,node_crypto__rspack_import_0.randomUUID)()
|
|
89541
|
+
clientNonce: extra.clientNonce || (0,node_crypto__rspack_import_0.randomUUID)()
|
|
87128
89542
|
};
|
|
89543
|
+
if (extra.replyToId) body.replyToId = extra.replyToId;
|
|
87129
89544
|
let data;
|
|
87130
89545
|
try {
|
|
87131
|
-
data = await gatewayCall(session, "sendPrompt", body
|
|
89546
|
+
data = await gatewayCall(session, "sendPrompt", body, {
|
|
89547
|
+
signal: extra.signal
|
|
89548
|
+
});
|
|
87132
89549
|
} catch (err) {
|
|
87133
89550
|
// Delivery states: the server answered no (rejected) vs the request may have landed (unknown).
|
|
87134
89551
|
// Never retry an unknown delivery blindly; read the thread first.
|
|
@@ -87380,6 +89797,269 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
87380
89797
|
});
|
|
87381
89798
|
|
|
87382
89799
|
|
|
89800
|
+
},
|
|
89801
|
+
"./src/core/relay/control.js"(__unused_rspack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
89802
|
+
/* import */ var node_string_decoder__rspack_import_0 = __webpack_require__("node:string_decoder");
|
|
89803
|
+
/* import */ var node_net__rspack_import_1 = __webpack_require__("node:net");
|
|
89804
|
+
/* import */ var node_crypto__rspack_import_2 = __webpack_require__("node:crypto");
|
|
89805
|
+
/* import */ var _profile_js__rspack_import_3 = __webpack_require__("./src/core/relay/profile.js");
|
|
89806
|
+
|
|
89807
|
+
|
|
89808
|
+
|
|
89809
|
+
|
|
89810
|
+
const RELAY_PROTOCOL = 1;
|
|
89811
|
+
const CONTROL_BYTES = 1024 * 1024;
|
|
89812
|
+
const CONTROL_TIMEOUT = 45000;
|
|
89813
|
+
function relayRequest(options, method, input = {}, { timeoutMs = CONTROL_TIMEOUT, signal, requestId = (0,node_crypto__rspack_import_2.randomUUID)() } = {}) {
|
|
89814
|
+
const { socketPath, profile } = (0,_profile_js__rspack_import_3/* .relayLocation */.hQ)(options);
|
|
89815
|
+
return new Promise((resolve, reject)=>{
|
|
89816
|
+
const decoder = new node_string_decoder__rspack_import_0.StringDecoder("utf8");
|
|
89817
|
+
let buffer = "", bytes = 0, settled = false, connected = false;
|
|
89818
|
+
const socket = (0,node_net__rspack_import_1.connect)(socketPath);
|
|
89819
|
+
const finish = (error, value)=>{
|
|
89820
|
+
if (settled) return;
|
|
89821
|
+
settled = true;
|
|
89822
|
+
clearTimeout(timer);
|
|
89823
|
+
signal?.removeEventListener("abort", abort);
|
|
89824
|
+
socket.destroy();
|
|
89825
|
+
error ? reject(error) : resolve(value);
|
|
89826
|
+
};
|
|
89827
|
+
const uncertain = ()=>Object.assign(Error(`Relay control connection lost; do not resend with a new requestId (${requestId}). Check bridge status.`), {
|
|
89828
|
+
requestId
|
|
89829
|
+
});
|
|
89830
|
+
const abort = ()=>finish(uncertain());
|
|
89831
|
+
const timer = setTimeout(abort, timeoutMs);
|
|
89832
|
+
signal?.addEventListener("abort", abort, {
|
|
89833
|
+
once: true
|
|
89834
|
+
});
|
|
89835
|
+
if (signal?.aborted) return abort();
|
|
89836
|
+
socket.on("error", (error)=>finish(connected ? uncertain() : error));
|
|
89837
|
+
socket.on("close", ()=>finish(uncertain()));
|
|
89838
|
+
socket.on("connect", ()=>{
|
|
89839
|
+
connected = true;
|
|
89840
|
+
const line = JSON.stringify({
|
|
89841
|
+
version: RELAY_PROTOCOL,
|
|
89842
|
+
profile,
|
|
89843
|
+
requestId,
|
|
89844
|
+
method,
|
|
89845
|
+
input
|
|
89846
|
+
}) + "\n";
|
|
89847
|
+
if (Buffer.byteLength(line) > CONTROL_BYTES) return finish(Error("Relay control request exceeds budget"));
|
|
89848
|
+
socket.write(line);
|
|
89849
|
+
});
|
|
89850
|
+
socket.on("data", (chunk)=>{
|
|
89851
|
+
bytes += chunk.length;
|
|
89852
|
+
if (bytes > CONTROL_BYTES) return finish(Error("Relay control response exceeds budget"));
|
|
89853
|
+
buffer += decoder.write(chunk);
|
|
89854
|
+
const end = buffer.indexOf("\n");
|
|
89855
|
+
if (end < 0) return;
|
|
89856
|
+
try {
|
|
89857
|
+
const reply = JSON.parse(buffer.slice(0, end));
|
|
89858
|
+
if (reply.version !== RELAY_PROTOCOL || reply.requestId !== requestId) throw Error("Relay protocol identity mismatch");
|
|
89859
|
+
if (reply.error) throw Error(reply.error);
|
|
89860
|
+
if (reply.profile !== profile) throw Error("Relay profile mismatch");
|
|
89861
|
+
finish(null, reply.result);
|
|
89862
|
+
} catch (error) {
|
|
89863
|
+
finish(error);
|
|
89864
|
+
}
|
|
89865
|
+
});
|
|
89866
|
+
});
|
|
89867
|
+
}
|
|
89868
|
+
|
|
89869
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
89870
|
+
lJ: () => (relayRequest)
|
|
89871
|
+
});
|
|
89872
|
+
|
|
89873
|
+
|
|
89874
|
+
},
|
|
89875
|
+
"./src/core/relay/managed.js"(__unused_rspack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
89876
|
+
/* import */ var node_child_process__rspack_import_0 = __webpack_require__("node:child_process");
|
|
89877
|
+
/* import */ var node_fs_promises__rspack_import_1 = __webpack_require__("node:fs/promises");
|
|
89878
|
+
/* import */ var node_path__rspack_import_2 = __webpack_require__("node:path");
|
|
89879
|
+
/* import */ var node_url__rspack_import_3 = __webpack_require__("node:url");
|
|
89880
|
+
/* import */ var node_crypto__rspack_import_4 = __webpack_require__("node:crypto");
|
|
89881
|
+
/* import */ var _profile_js__rspack_import_5 = __webpack_require__("./src/core/relay/profile.js");
|
|
89882
|
+
/* import */ var _control_js__rspack_import_6 = __webpack_require__("./src/core/relay/control.js");
|
|
89883
|
+
|
|
89884
|
+
|
|
89885
|
+
|
|
89886
|
+
|
|
89887
|
+
|
|
89888
|
+
|
|
89889
|
+
|
|
89890
|
+
/** @param {{pluginRoot?: string, moduleUrl?: string}} options */ async function resolveRelayWorker({ pluginRoot, moduleUrl = import.meta.url } = {}) {
|
|
89891
|
+
const roots = [];
|
|
89892
|
+
if (pluginRoot) roots.push(pluginRoot);
|
|
89893
|
+
let path = (0,node_path__rspack_import_2.dirname)((0,node_url__rspack_import_3.fileURLToPath)(moduleUrl));
|
|
89894
|
+
for(let i = 0; i < 5; i++){
|
|
89895
|
+
roots.push(path);
|
|
89896
|
+
path = (0,node_path__rspack_import_2.dirname)(path);
|
|
89897
|
+
}
|
|
89898
|
+
for (const candidate of new Set(roots)){
|
|
89899
|
+
let manifest;
|
|
89900
|
+
try {
|
|
89901
|
+
manifest = JSON.parse(await (0,node_fs_promises__rspack_import_1.readFile)((0,node_path__rspack_import_2.join)(candidate, "agent-bundle.manifest.json"), "utf8"));
|
|
89902
|
+
} catch (error) {
|
|
89903
|
+
if (error.code === "ENOENT") continue;
|
|
89904
|
+
throw error;
|
|
89905
|
+
}
|
|
89906
|
+
const relative = "scripts/gbot-relay.mjs";
|
|
89907
|
+
const file = manifest.files?.find((f)=>f.path === relative);
|
|
89908
|
+
if (manifest.application?.name !== "gbot" || !file || !manifest.executables?.scripts?.some((s)=>s.path === relative)) continue;
|
|
89909
|
+
const root = await (0,node_fs_promises__rspack_import_1.realpath)(candidate), worker = (0,node_path__rspack_import_2.join)(root, relative), stat = await (0,node_fs_promises__rspack_import_1.lstat)(worker);
|
|
89910
|
+
if (!stat.isFile() || stat.isSymbolicLink() || await (0,node_fs_promises__rspack_import_1.realpath)(worker) !== worker) throw Error("Relay worker must be a regular packaged script");
|
|
89911
|
+
if (stat.size !== file.bytes || (0,_profile_js__rspack_import_5/* .digest */.br)(await (0,node_fs_promises__rspack_import_1.readFile)(worker)) !== file.sha256) throw Error("Packaged relay worker checksum mismatch");
|
|
89912
|
+
return worker;
|
|
89913
|
+
}
|
|
89914
|
+
throw Error("Packaged relay worker not found; rebuild or reinstall the plugin");
|
|
89915
|
+
}
|
|
89916
|
+
const unavailable = (error)=>[
|
|
89917
|
+
"ENOENT",
|
|
89918
|
+
"ECONNREFUSED"
|
|
89919
|
+
].includes(error.code);
|
|
89920
|
+
async function ensureRelayWorker(options = {}) {
|
|
89921
|
+
const location = (0,_profile_js__rspack_import_5/* .relayLocation */.hQ)(options);
|
|
89922
|
+
try {
|
|
89923
|
+
return await (0,_control_js__rspack_import_6/* .relayRequest */.lJ)(location, "hello", {}, {
|
|
89924
|
+
timeoutMs: 1500
|
|
89925
|
+
});
|
|
89926
|
+
} catch (error) {
|
|
89927
|
+
if (!unavailable(error)) throw error;
|
|
89928
|
+
}
|
|
89929
|
+
const workerPath = await resolveRelayWorker(options);
|
|
89930
|
+
const child = (0,node_child_process__rspack_import_0.spawn)(process.execPath, [
|
|
89931
|
+
workerPath
|
|
89932
|
+
], {
|
|
89933
|
+
detached: true,
|
|
89934
|
+
stdio: "ignore",
|
|
89935
|
+
env: {
|
|
89936
|
+
...location.env,
|
|
89937
|
+
GROK_BOT_RELAY_DIR: location.stateDir
|
|
89938
|
+
},
|
|
89939
|
+
cwd: (0,node_path__rspack_import_2.dirname)(workerPath)
|
|
89940
|
+
});
|
|
89941
|
+
let spawnError;
|
|
89942
|
+
child.on("error", (error)=>{
|
|
89943
|
+
spawnError = error;
|
|
89944
|
+
});
|
|
89945
|
+
child.unref();
|
|
89946
|
+
const end = Date.now() + 10000;
|
|
89947
|
+
while(Date.now() < end){
|
|
89948
|
+
if (spawnError) throw spawnError;
|
|
89949
|
+
if (options.signal?.aborted) throw Error("Relay startup cancelled before submission");
|
|
89950
|
+
try {
|
|
89951
|
+
return await (0,_control_js__rspack_import_6/* .relayRequest */.lJ)(location, "hello", {}, {
|
|
89952
|
+
timeoutMs: 1000,
|
|
89953
|
+
signal: options.signal
|
|
89954
|
+
});
|
|
89955
|
+
} catch (error) {
|
|
89956
|
+
if (!unavailable(error)) throw error;
|
|
89957
|
+
}
|
|
89958
|
+
await new Promise((resolve)=>setTimeout(resolve, 75));
|
|
89959
|
+
}
|
|
89960
|
+
throw Error("Relay worker startup failed or timed out; no untracked send was attempted. Inspect bridge status and the relay owner lock.");
|
|
89961
|
+
}
|
|
89962
|
+
async function managedOperation(method, input, options = {}) {
|
|
89963
|
+
const location = (0,_profile_js__rspack_import_5/* .relayLocation */.hQ)(options);
|
|
89964
|
+
const requestId = input.requestId ?? (0,node_crypto__rspack_import_4.randomUUID)();
|
|
89965
|
+
if (![
|
|
89966
|
+
"status",
|
|
89967
|
+
"stop",
|
|
89968
|
+
"respond"
|
|
89969
|
+
].includes(method)) await ensureRelayWorker(options);
|
|
89970
|
+
try {
|
|
89971
|
+
return await (0,_control_js__rspack_import_6/* .relayRequest */.lJ)(location, method, input, {
|
|
89972
|
+
signal: options.signal,
|
|
89973
|
+
requestId
|
|
89974
|
+
});
|
|
89975
|
+
} catch (error) {
|
|
89976
|
+
if (method === "status" && unavailable(error)) return {
|
|
89977
|
+
worker: {
|
|
89978
|
+
state: "stopped",
|
|
89979
|
+
profile: location.profile,
|
|
89980
|
+
supervised: false
|
|
89981
|
+
},
|
|
89982
|
+
reason: "Worker is not running. Start a route or tracked send to resume saved routes."
|
|
89983
|
+
};
|
|
89984
|
+
// Never retry a disconnected mutation. Its durable request ID is the recovery handle.
|
|
89985
|
+
throw error;
|
|
89986
|
+
}
|
|
89987
|
+
}
|
|
89988
|
+
|
|
89989
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
89990
|
+
Bb: () => (managedOperation),
|
|
89991
|
+
_v: () => (resolveRelayWorker)
|
|
89992
|
+
});
|
|
89993
|
+
|
|
89994
|
+
|
|
89995
|
+
},
|
|
89996
|
+
"./src/core/relay/profile.js"(__unused_rspack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
89997
|
+
/* import */ var node_crypto__rspack_import_0 = __webpack_require__("node:crypto");
|
|
89998
|
+
/* import */ var node_os__rspack_import_1 = __webpack_require__("node:os");
|
|
89999
|
+
/* import */ var node_path__rspack_import_2 = __webpack_require__("node:path");
|
|
90000
|
+
/* import */ var _codex_bridge_js__rspack_import_3 = __webpack_require__("./src/core/codex-bridge.js");
|
|
90001
|
+
/* import */ var _app_session_js__rspack_import_4 = __webpack_require__("./src/core/app-session.js");
|
|
90002
|
+
|
|
90003
|
+
|
|
90004
|
+
|
|
90005
|
+
|
|
90006
|
+
|
|
90007
|
+
const digest = (value)=>(0,node_crypto__rspack_import_0.createHash)("sha256").update(value).digest("hex");
|
|
90008
|
+
// Only explicit overrides are hashed. App-session token refresh retains its source identity.
|
|
90009
|
+
function relayProfile(env = process.env) {
|
|
90010
|
+
const keys = [
|
|
90011
|
+
"GROK_BOT_GATEWAY_URL",
|
|
90012
|
+
"SAND_HOST_GATEWAY_URL",
|
|
90013
|
+
"SAND_HOST_PORT",
|
|
90014
|
+
"GROK_BOT_GATEWAY_TOKEN",
|
|
90015
|
+
"SAND_HOST_GATEWAY_TOKEN",
|
|
90016
|
+
"SAND_GATEWAY_TOKEN",
|
|
90017
|
+
"CURSOR_ACCESS_TOKEN",
|
|
90018
|
+
"GROK_BOT_ACCESS_TOKEN",
|
|
90019
|
+
"SAND_ACCESS_TOKEN",
|
|
90020
|
+
"GROK_BOT_GATEWAY_HEADERS",
|
|
90021
|
+
"SAND_BACKEND_URL",
|
|
90022
|
+
"CURSOR_API_BASE_URL",
|
|
90023
|
+
"SAND_BOX_NAMESPACE",
|
|
90024
|
+
"SAND_CLIENT_VERSION",
|
|
90025
|
+
"GROK_BOT_CODEX_THREADS",
|
|
90026
|
+
"GROK_BOT_MAX_HOPS",
|
|
90027
|
+
"GROK_BOT_CODEX_EXPERIMENTAL",
|
|
90028
|
+
"GROK_BOT_ALLOW_LOCAL_GATEWAY",
|
|
90029
|
+
"GROK_BOT_ALLOW_ANY_GATEWAY",
|
|
90030
|
+
"GROK_BOT_TEST",
|
|
90031
|
+
"NODE_ENV"
|
|
90032
|
+
];
|
|
90033
|
+
return digest(JSON.stringify([
|
|
90034
|
+
(0,node_path__rspack_import_2.resolve)((0,_codex_bridge_js__rspack_import_3/* .codexSocketPath */.ql)(env)),
|
|
90035
|
+
(0,_app_session_js__rspack_import_4/* .grokBotGatewayDescriptorPath */.dQ)((0,node_os__rspack_import_1.homedir)(), process.platform, env),
|
|
90036
|
+
...keys.map((key)=>[
|
|
90037
|
+
key,
|
|
90038
|
+
env[key] ?? ""
|
|
90039
|
+
])
|
|
90040
|
+
]));
|
|
90041
|
+
}
|
|
90042
|
+
function relayLocation({ env = process.env, stateDir, profile = relayProfile(env) } = {}) {
|
|
90043
|
+
if (process.platform === "win32") throw Error("Codex relay requires Unix-domain sockets; Windows is unsupported.");
|
|
90044
|
+
const dir = (0,node_path__rspack_import_2.resolve)(stateDir ?? env.GROK_BOT_RELAY_DIR ?? (0,node_path__rspack_import_2.join)((0,node_os__rspack_import_1.homedir)(), ".grok-bot-cli", "relay", profile.slice(0, 24)));
|
|
90045
|
+
// macOS Unix sockets cannot use arbitrarily long installation/state paths.
|
|
90046
|
+
const socketDir = Buffer.byteLength((0,node_path__rspack_import_2.join)(dir, "control.sock")) < 100 ? dir : (0,node_path__rspack_import_2.join)("/tmp", `gbot-relay-${process.getuid()}`, digest(dir).slice(0, 24));
|
|
90047
|
+
return {
|
|
90048
|
+
stateDir: dir,
|
|
90049
|
+
profile,
|
|
90050
|
+
env,
|
|
90051
|
+
socketDir,
|
|
90052
|
+
socketPath: (0,node_path__rspack_import_2.join)(socketDir, "control.sock")
|
|
90053
|
+
};
|
|
90054
|
+
}
|
|
90055
|
+
|
|
90056
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
90057
|
+
hQ: () => (relayLocation)
|
|
90058
|
+
}, {
|
|
90059
|
+
br: digest
|
|
90060
|
+
});
|
|
90061
|
+
|
|
90062
|
+
|
|
87383
90063
|
},
|
|
87384
90064
|
"./src/core/store.js"(__unused_rspack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
87385
90065
|
/* import */ var node_crypto__rspack_import_0 = __webpack_require__("node:crypto");
|
|
@@ -87944,6 +90624,10 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
87944
90624
|
});
|
|
87945
90625
|
|
|
87946
90626
|
|
|
90627
|
+
},
|
|
90628
|
+
"./package.json"(module) {
|
|
90629
|
+
module.exports = {"rE":"0.6.0"}
|
|
90630
|
+
|
|
87947
90631
|
},
|
|
87948
90632
|
|
|
87949
90633
|
});
|