grok-bot-cli 0.5.0 → 0.7.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 +20 -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 +7 -7
- 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/agent-bundle.package-compile-evidence.json +1 -1
- package/dist/bin/gbot-flight.mjs +2966 -453
- package/dist/bin/gbot-install.js +9087 -9084
- package/dist/bin/gbot.mjs +3551 -728
- package/dist/install.mjs +6 -3
- package/dist/mcp/mcp-grok-bot-b8c2461e-flight.mjs +9675 -4968
- package/dist/mcp/mcp-grok-bot-b8c2461e.mjs +5057 -726
- package/dist/package.json +4 -4
- package/dist/plugin.json +1 -1
- package/dist/scripts/gbot-relay.mjs +59091 -0
- package/dist/skills/talk-to-grok-bot/SKILL.md +77 -5
- package/package.json +4 -4
package/dist/bin/gbot-flight.mjs
CHANGED
|
@@ -2,11 +2,12 @@ import * as __rspack_external_node_async_hooks_4d8b1b4a from "node:async_hooks";
|
|
|
2
2
|
import * as __rspack_external_node_child_process_cd435d64 from "node:child_process";
|
|
3
3
|
import * as __rspack_external_node_crypto_2e7c4b46 from "node:crypto";
|
|
4
4
|
import * as __rspack_external_node_fs_1b05aee1 from "node:fs";
|
|
5
|
-
import * as
|
|
5
|
+
import * as __rspack_external_node_fs_promises_3b710708 from "node:fs/promises";
|
|
6
6
|
import * as __rspack_external_node_net_5ed819e1 from "node:net";
|
|
7
7
|
import * as __rspack_external_node_os_4f3c9d58 from "node:os";
|
|
8
8
|
import * as __rspack_external_node_path_806ed179 from "node:path";
|
|
9
9
|
import * as __rspack_external_node_readline_d8f53bef from "node:readline";
|
|
10
|
+
import * as __rspack_external_node_string_decoder_69b9bd04 from "node:string_decoder";
|
|
10
11
|
import * as __rspack_external_node_url_3991086a from "node:url";
|
|
11
12
|
import * as __rspack_external_node_worker_threads_28ca7740 from "node:worker_threads";
|
|
12
13
|
import { createRequire as __rspack_createRequire } from "node:module";
|
|
@@ -13524,6 +13525,113 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
13524
13525
|
});
|
|
13525
13526
|
|
|
13526
13527
|
|
|
13528
|
+
},
|
|
13529
|
+
"./src/cli/approvals/list.tsx"(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
13530
|
+
__webpack_require__.r(__webpack_exports__);
|
|
13531
|
+
/* import */ var react_jsx_runtime__rspack_import_0 = __webpack_require__("./node_modules/react/jsx-runtime.react-server.js");
|
|
13532
|
+
/* import */ var _agent_bundle_runtime__rspack_import_2 = __webpack_require__("./node_modules/@agent-bundle/runtime/dist/506.js");
|
|
13533
|
+
/* import */ var _core_grok_approval_routes_js__rspack_import_1 = __webpack_require__("./src/core/grok-approval-routes.ts");
|
|
13534
|
+
|
|
13535
|
+
|
|
13536
|
+
|
|
13537
|
+
|
|
13538
|
+
const config = {
|
|
13539
|
+
description: 'List current Grok approval cards (latest 200 entries).',
|
|
13540
|
+
positionals: [
|
|
13541
|
+
'target'
|
|
13542
|
+
],
|
|
13543
|
+
inputJsonSchema: {
|
|
13544
|
+
type: 'object',
|
|
13545
|
+
properties: {
|
|
13546
|
+
target: {
|
|
13547
|
+
type: 'string'
|
|
13548
|
+
}
|
|
13549
|
+
},
|
|
13550
|
+
required: [
|
|
13551
|
+
'target'
|
|
13552
|
+
],
|
|
13553
|
+
additionalProperties: false
|
|
13554
|
+
}
|
|
13555
|
+
};
|
|
13556
|
+
async function route({ input }) {
|
|
13557
|
+
const out = await (0,_core_grok_approval_routes_js__rspack_import_1/* .listOperation */.gi)(input);
|
|
13558
|
+
return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_2/* .Agent.Result */.g.Result, {
|
|
13559
|
+
value: out,
|
|
13560
|
+
children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_2/* .Agent.Text */.g.Text, {
|
|
13561
|
+
children: JSON.stringify(out)
|
|
13562
|
+
})
|
|
13563
|
+
});
|
|
13564
|
+
}
|
|
13565
|
+
|
|
13566
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
13567
|
+
"default": () => (route),
|
|
13568
|
+
inputSchema: () => (/* reexport safe */ _core_grok_approval_routes_js__rspack_import_1.cE),
|
|
13569
|
+
resultSchema: () => (/* reexport safe */ _core_grok_approval_routes_js__rspack_import_1.FD)
|
|
13570
|
+
}, {
|
|
13571
|
+
config: config
|
|
13572
|
+
});
|
|
13573
|
+
|
|
13574
|
+
|
|
13575
|
+
},
|
|
13576
|
+
"./src/cli/approvals/respond.tsx"(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
13577
|
+
__webpack_require__.r(__webpack_exports__);
|
|
13578
|
+
/* import */ var react_jsx_runtime__rspack_import_0 = __webpack_require__("./node_modules/react/jsx-runtime.react-server.js");
|
|
13579
|
+
/* import */ var _agent_bundle_runtime__rspack_import_2 = __webpack_require__("./node_modules/@agent-bundle/runtime/dist/506.js");
|
|
13580
|
+
/* import */ var _core_grok_approval_routes_js__rspack_import_1 = __webpack_require__("./src/core/grok-approval-routes.ts");
|
|
13581
|
+
|
|
13582
|
+
|
|
13583
|
+
|
|
13584
|
+
|
|
13585
|
+
const config = {
|
|
13586
|
+
description: 'Explicit user decision: accept a Grok request once or decline; never grant persistent permissions.',
|
|
13587
|
+
inputJsonSchema: {
|
|
13588
|
+
type: 'object',
|
|
13589
|
+
properties: {
|
|
13590
|
+
target: {
|
|
13591
|
+
type: 'string'
|
|
13592
|
+
},
|
|
13593
|
+
entryId: {
|
|
13594
|
+
type: 'string'
|
|
13595
|
+
},
|
|
13596
|
+
requestId: {
|
|
13597
|
+
type: 'string'
|
|
13598
|
+
},
|
|
13599
|
+
decision: {
|
|
13600
|
+
type: 'string',
|
|
13601
|
+
enum: [
|
|
13602
|
+
'accept',
|
|
13603
|
+
'decline'
|
|
13604
|
+
]
|
|
13605
|
+
}
|
|
13606
|
+
},
|
|
13607
|
+
required: [
|
|
13608
|
+
'target',
|
|
13609
|
+
'entryId',
|
|
13610
|
+
'requestId',
|
|
13611
|
+
'decision'
|
|
13612
|
+
],
|
|
13613
|
+
additionalProperties: false
|
|
13614
|
+
}
|
|
13615
|
+
};
|
|
13616
|
+
async function route({ input }) {
|
|
13617
|
+
const out = await (0,_core_grok_approval_routes_js__rspack_import_1/* .respondOperation */.lr)(input);
|
|
13618
|
+
return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_2/* .Agent.Result */.g.Result, {
|
|
13619
|
+
value: out,
|
|
13620
|
+
children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_2/* .Agent.Text */.g.Text, {
|
|
13621
|
+
children: JSON.stringify(out)
|
|
13622
|
+
})
|
|
13623
|
+
});
|
|
13624
|
+
}
|
|
13625
|
+
|
|
13626
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
13627
|
+
"default": () => (route),
|
|
13628
|
+
inputSchema: () => (/* reexport safe */ _core_grok_approval_routes_js__rspack_import_1.v1),
|
|
13629
|
+
resultSchema: () => (/* reexport safe */ _core_grok_approval_routes_js__rspack_import_1.FD)
|
|
13630
|
+
}, {
|
|
13631
|
+
config: config
|
|
13632
|
+
});
|
|
13633
|
+
|
|
13634
|
+
|
|
13527
13635
|
},
|
|
13528
13636
|
"./src/cli/bots/create.tsx"(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
13529
13637
|
__webpack_require__.r(__webpack_exports__);
|
|
@@ -13581,9 +13689,9 @@ async function botsCreate({ input }) {
|
|
|
13581
13689
|
const { dir: _d, files: _f, gateway: _g, ...fields } = input;
|
|
13582
13690
|
const rec = await backend.createAgent((0,_shared_js__rspack_import_1/* .toCreateInput */.cp)(fields));
|
|
13583
13691
|
if (rec == null) throw new Error('createAgent returned no record');
|
|
13584
|
-
return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_2/* .Agent.Result */.
|
|
13692
|
+
return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_2/* .Agent.Result */.g.Result, {
|
|
13585
13693
|
value: (0,_core_format_js__rspack_import_3/* .summarize */.eh)(rec),
|
|
13586
|
-
children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_2/* .Agent.Text */.
|
|
13694
|
+
children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_2/* .Agent.Text */.g.Text, {
|
|
13587
13695
|
children: `Created bot ${rec.name} (${rec.id})`
|
|
13588
13696
|
})
|
|
13589
13697
|
});
|
|
@@ -13649,9 +13757,9 @@ const resultSchema = _shared_js__rspack_import_1/* .agentSummarySchema */.t_;
|
|
|
13649
13757
|
async function botsDelete({ input }) {
|
|
13650
13758
|
const backend = await (0,_shared_js__rspack_import_1/* .openBackendFromInput */.FS)(input);
|
|
13651
13759
|
const rec = await backend.deleteAgent(input.ref);
|
|
13652
|
-
return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Result */.
|
|
13760
|
+
return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Result */.g.Result, {
|
|
13653
13761
|
value: (0,_core_format_js__rspack_import_4/* .summarize */.eh)(rec),
|
|
13654
|
-
children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Text */.
|
|
13762
|
+
children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Text */.g.Text, {
|
|
13655
13763
|
children: `Deleted ${rec.isGroup ? 'group' : 'bot'} ${rec.name} (${rec.id})`
|
|
13656
13764
|
})
|
|
13657
13765
|
});
|
|
@@ -13718,9 +13826,9 @@ async function botsGet({ input }) {
|
|
|
13718
13826
|
const backend = await (0,_shared_js__rspack_import_1/* .openBackendFromInput */.FS)(input);
|
|
13719
13827
|
const rec = await backend.resolve(input.ref);
|
|
13720
13828
|
const all = await backend.list();
|
|
13721
|
-
return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Result */.
|
|
13829
|
+
return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Result */.g.Result, {
|
|
13722
13830
|
value: (0,_core_format_js__rspack_import_4/* .summarize */.eh)(rec),
|
|
13723
|
-
children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Text */.
|
|
13831
|
+
children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Text */.g.Text, {
|
|
13724
13832
|
children: (0,_core_format_js__rspack_import_4/* .formatRecord */.bM)(rec, all)
|
|
13725
13833
|
})
|
|
13726
13834
|
});
|
|
@@ -13777,9 +13885,9 @@ async function botsList({ input }) {
|
|
|
13777
13885
|
const rows = all.filter((r)=>!r.isGroup);
|
|
13778
13886
|
const bots = rows.map(_core_format_js__rspack_import_3/* .summarize */.eh);
|
|
13779
13887
|
const text = rows.length === 0 ? 'No bots.' : rows.map((r)=>(0,_core_format_js__rspack_import_3/* .formatRecord */.bM)(r, all)).join('\n\n');
|
|
13780
|
-
return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_4/* .Agent.Result */.
|
|
13888
|
+
return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_4/* .Agent.Result */.g.Result, {
|
|
13781
13889
|
value: bots,
|
|
13782
|
-
children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_4/* .Agent.Text */.
|
|
13890
|
+
children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_4/* .Agent.Text */.g.Text, {
|
|
13783
13891
|
children: text
|
|
13784
13892
|
})
|
|
13785
13893
|
});
|
|
@@ -13867,9 +13975,9 @@ async function botsUpdate({ input }) {
|
|
|
13867
13975
|
const backend = await (0,_shared_js__rspack_import_1/* .openBackendFromInput */.FS)(input);
|
|
13868
13976
|
const { dir: _d, files: _f, gateway: _g, ref, ...fields } = input;
|
|
13869
13977
|
const rec = await backend.updateAgent(ref, (0,_shared_js__rspack_import_1/* .toUpdatePatch */.li)(fields));
|
|
13870
|
-
return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Result */.
|
|
13978
|
+
return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Result */.g.Result, {
|
|
13871
13979
|
value: (0,_core_format_js__rspack_import_4/* .summarize */.eh)(rec),
|
|
13872
|
-
children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Text */.
|
|
13980
|
+
children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Text */.g.Text, {
|
|
13873
13981
|
children: `Updated ${rec.isGroup ? 'group' : 'bot'} ${rec.name} (${rec.id})`
|
|
13874
13982
|
})
|
|
13875
13983
|
});
|
|
@@ -13884,6 +13992,376 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
13884
13992
|
});
|
|
13885
13993
|
|
|
13886
13994
|
|
|
13995
|
+
},
|
|
13996
|
+
"./src/cli/codex/bridge/respond.tsx"(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
13997
|
+
__webpack_require__.r(__webpack_exports__);
|
|
13998
|
+
/* import */ var react_jsx_runtime__rspack_import_0 = __webpack_require__("./node_modules/react/jsx-runtime.react-server.js");
|
|
13999
|
+
/* import */ var _agent_bundle_runtime__rspack_import_3 = __webpack_require__("./node_modules/@agent-bundle/runtime/dist/736.js");
|
|
14000
|
+
/* import */ var _agent_bundle_runtime__rspack_import_4 = __webpack_require__("./node_modules/@agent-bundle/runtime/dist/506.js");
|
|
14001
|
+
/* import */ var _core_relay_routes_js__rspack_import_1 = __webpack_require__("./src/core/relay/routes.ts");
|
|
14002
|
+
/* import */ var _core_codex_contract_js__rspack_import_2 = __webpack_require__("./src/core/codex/contract.js");
|
|
14003
|
+
|
|
14004
|
+
|
|
14005
|
+
|
|
14006
|
+
|
|
14007
|
+
|
|
14008
|
+
const config = {
|
|
14009
|
+
description: 'Managed Grok/Codex bridge respond.',
|
|
14010
|
+
exitCode: 'result',
|
|
14011
|
+
inputJsonSchema: {
|
|
14012
|
+
type: 'object',
|
|
14013
|
+
properties: {
|
|
14014
|
+
interactionId: {
|
|
14015
|
+
type: 'string'
|
|
14016
|
+
},
|
|
14017
|
+
generation: {
|
|
14018
|
+
type: 'string'
|
|
14019
|
+
},
|
|
14020
|
+
threadId: {
|
|
14021
|
+
type: 'string'
|
|
14022
|
+
},
|
|
14023
|
+
turnId: {
|
|
14024
|
+
type: 'string'
|
|
14025
|
+
},
|
|
14026
|
+
bindingId: {
|
|
14027
|
+
type: 'string'
|
|
14028
|
+
},
|
|
14029
|
+
exchangeId: {
|
|
14030
|
+
type: 'string'
|
|
14031
|
+
},
|
|
14032
|
+
decision: {
|
|
14033
|
+
type: 'string',
|
|
14034
|
+
enum: [
|
|
14035
|
+
'accept',
|
|
14036
|
+
'decline',
|
|
14037
|
+
'cancel'
|
|
14038
|
+
]
|
|
14039
|
+
},
|
|
14040
|
+
answersJson: {
|
|
14041
|
+
type: 'string',
|
|
14042
|
+
description: 'JSON object mapping each advertised question ID to {"answers":["answer"]}; exact IDs required.'
|
|
14043
|
+
}
|
|
14044
|
+
},
|
|
14045
|
+
required: [
|
|
14046
|
+
'interactionId',
|
|
14047
|
+
'generation',
|
|
14048
|
+
'threadId',
|
|
14049
|
+
'turnId'
|
|
14050
|
+
],
|
|
14051
|
+
additionalProperties: false
|
|
14052
|
+
}
|
|
14053
|
+
};
|
|
14054
|
+
async function route({ input }) {
|
|
14055
|
+
let out;
|
|
14056
|
+
try {
|
|
14057
|
+
out = {
|
|
14058
|
+
...await (0,_core_relay_routes_js__rspack_import_1/* .bridgeOperation */.n1)('respond', input, await (0,_agent_bundle_runtime__rspack_import_3/* .agent */.MA)()),
|
|
14059
|
+
exitCode: 0
|
|
14060
|
+
};
|
|
14061
|
+
} catch (error) {
|
|
14062
|
+
out = (0,_core_codex_contract_js__rspack_import_2/* .outcomeFromError */.DG)(error);
|
|
14063
|
+
}
|
|
14064
|
+
return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_4/* .Agent.Result */.g.Result, {
|
|
14065
|
+
value: out,
|
|
14066
|
+
children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_4/* .Agent.Text */.g.Text, {
|
|
14067
|
+
children: JSON.stringify(out)
|
|
14068
|
+
})
|
|
14069
|
+
});
|
|
14070
|
+
}
|
|
14071
|
+
|
|
14072
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
14073
|
+
"default": () => (route),
|
|
14074
|
+
inputSchema: () => (/* reexport safe */ _core_relay_routes_js__rspack_import_1.v1),
|
|
14075
|
+
resultSchema: () => (/* reexport safe */ _core_relay_routes_js__rspack_import_1.Ax)
|
|
14076
|
+
}, {
|
|
14077
|
+
config: config
|
|
14078
|
+
});
|
|
14079
|
+
|
|
14080
|
+
|
|
14081
|
+
},
|
|
14082
|
+
"./src/cli/codex/bridge/run.tsx"(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
14083
|
+
__webpack_require__.r(__webpack_exports__);
|
|
14084
|
+
/* import */ var react_jsx_runtime__rspack_import_0 = __webpack_require__("./node_modules/react/jsx-runtime.react-server.js");
|
|
14085
|
+
/* import */ var _agent_bundle_runtime__rspack_import_4 = __webpack_require__("./node_modules/@agent-bundle/runtime/dist/736.js");
|
|
14086
|
+
/* import */ var _agent_bundle_runtime__rspack_import_5 = __webpack_require__("./node_modules/@agent-bundle/runtime/dist/506.js");
|
|
14087
|
+
/* import */ var node_child_process__rspack_import_1 = __webpack_require__("node:child_process");
|
|
14088
|
+
/* import */ var zod__rspack_import_3 = __webpack_require__("./node_modules/zod/v4/classic/schemas.js");
|
|
14089
|
+
/* import */ var _core_relay_managed_js__rspack_import_2 = __webpack_require__("./src/core/relay/managed.js");
|
|
14090
|
+
|
|
14091
|
+
|
|
14092
|
+
|
|
14093
|
+
|
|
14094
|
+
|
|
14095
|
+
const inputSchema = zod__rspack_import_3/* .object */.Ikc({
|
|
14096
|
+
lifetimeMs: zod__rspack_import_3/* .number */.aig().int().min(100).max(82800000).default(82800000)
|
|
14097
|
+
}).strict();
|
|
14098
|
+
const resultSchema = zod__rspack_import_3/* .object */.Ikc({
|
|
14099
|
+
state: zod__rspack_import_3/* .string */.YjP(),
|
|
14100
|
+
exitCode: zod__rspack_import_3/* .number */.aig()
|
|
14101
|
+
});
|
|
14102
|
+
const config = {
|
|
14103
|
+
description: 'Run a bounded foreground relay (up to 23 hours). Use the packaged gbot-relay.mjs script for unlimited service lifetime.',
|
|
14104
|
+
exitCode: 'result',
|
|
14105
|
+
render: {
|
|
14106
|
+
maxElapsedMs: 86400000
|
|
14107
|
+
},
|
|
14108
|
+
inputJsonSchema: {
|
|
14109
|
+
type: 'object',
|
|
14110
|
+
properties: {
|
|
14111
|
+
lifetimeMs: {
|
|
14112
|
+
type: 'number',
|
|
14113
|
+
description: 'Foreground lifetime in milliseconds (100..82800000; default 23h).'
|
|
14114
|
+
}
|
|
14115
|
+
},
|
|
14116
|
+
additionalProperties: false
|
|
14117
|
+
}
|
|
14118
|
+
};
|
|
14119
|
+
async function route({ signal, input }) {
|
|
14120
|
+
const context = await (0,_agent_bundle_runtime__rspack_import_4/* .agent */.MA)();
|
|
14121
|
+
const script = await (0,_core_relay_managed_js__rspack_import_2/* .resolveRelayWorker */._v)({
|
|
14122
|
+
pluginRoot: context.plugin.state === 'available' ? context.plugin.value.root : undefined
|
|
14123
|
+
});
|
|
14124
|
+
// The renderer may terminate immediately on abort. The separate worker can finish
|
|
14125
|
+
// asynchronous socket/ledger cleanup after the synchronous termination signal.
|
|
14126
|
+
const child = (0,node_child_process__rspack_import_1.spawn)(process.execPath, [
|
|
14127
|
+
script,
|
|
14128
|
+
'--lifetime-ms',
|
|
14129
|
+
String(input.lifetimeMs),
|
|
14130
|
+
'--parent-pid',
|
|
14131
|
+
String(process.pid)
|
|
14132
|
+
], {
|
|
14133
|
+
stdio: [
|
|
14134
|
+
'ignore',
|
|
14135
|
+
'ignore',
|
|
14136
|
+
'inherit'
|
|
14137
|
+
]
|
|
14138
|
+
});
|
|
14139
|
+
const stop = ()=>{
|
|
14140
|
+
child.kill('SIGTERM');
|
|
14141
|
+
};
|
|
14142
|
+
signal.addEventListener('abort', stop, {
|
|
14143
|
+
once: true
|
|
14144
|
+
});
|
|
14145
|
+
if (signal.aborted) stop();
|
|
14146
|
+
let exitCode;
|
|
14147
|
+
try {
|
|
14148
|
+
exitCode = await new Promise((resolve, reject)=>{
|
|
14149
|
+
child.once('error', reject);
|
|
14150
|
+
child.once('exit', (code)=>resolve(code ?? 1));
|
|
14151
|
+
});
|
|
14152
|
+
} finally{
|
|
14153
|
+
signal.removeEventListener('abort', stop);
|
|
14154
|
+
}
|
|
14155
|
+
return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_5/* .Agent.Result */.g.Result, {
|
|
14156
|
+
value: {
|
|
14157
|
+
state: 'stopped',
|
|
14158
|
+
exitCode
|
|
14159
|
+
},
|
|
14160
|
+
children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_5/* .Agent.Text */.g.Text, {
|
|
14161
|
+
children: "Relay worker stopped."
|
|
14162
|
+
})
|
|
14163
|
+
});
|
|
14164
|
+
}
|
|
14165
|
+
|
|
14166
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
14167
|
+
"default": () => (route)
|
|
14168
|
+
}, {
|
|
14169
|
+
config: config,
|
|
14170
|
+
inputSchema: inputSchema,
|
|
14171
|
+
resultSchema: resultSchema
|
|
14172
|
+
});
|
|
14173
|
+
|
|
14174
|
+
|
|
14175
|
+
},
|
|
14176
|
+
"./src/cli/codex/bridge/start.tsx"(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
14177
|
+
__webpack_require__.r(__webpack_exports__);
|
|
14178
|
+
/* import */ var react_jsx_runtime__rspack_import_0 = __webpack_require__("./node_modules/react/jsx-runtime.react-server.js");
|
|
14179
|
+
/* import */ var _agent_bundle_runtime__rspack_import_3 = __webpack_require__("./node_modules/@agent-bundle/runtime/dist/736.js");
|
|
14180
|
+
/* import */ var _agent_bundle_runtime__rspack_import_4 = __webpack_require__("./node_modules/@agent-bundle/runtime/dist/506.js");
|
|
14181
|
+
/* import */ var _core_relay_routes_js__rspack_import_1 = __webpack_require__("./src/core/relay/routes.ts");
|
|
14182
|
+
/* import */ var _core_codex_contract_js__rspack_import_2 = __webpack_require__("./src/core/codex/contract.js");
|
|
14183
|
+
|
|
14184
|
+
|
|
14185
|
+
|
|
14186
|
+
|
|
14187
|
+
|
|
14188
|
+
const config = {
|
|
14189
|
+
description: 'Managed Grok/Codex bridge start.',
|
|
14190
|
+
exitCode: 'result',
|
|
14191
|
+
positionals: [
|
|
14192
|
+
'grokTarget'
|
|
14193
|
+
],
|
|
14194
|
+
inputJsonSchema: {
|
|
14195
|
+
type: 'object',
|
|
14196
|
+
properties: {
|
|
14197
|
+
grokTarget: {
|
|
14198
|
+
type: 'string'
|
|
14199
|
+
},
|
|
14200
|
+
codexThreadId: {
|
|
14201
|
+
type: 'string'
|
|
14202
|
+
},
|
|
14203
|
+
expectedCwd: {
|
|
14204
|
+
type: 'string'
|
|
14205
|
+
},
|
|
14206
|
+
busyPolicy: {
|
|
14207
|
+
type: 'string',
|
|
14208
|
+
enum: [
|
|
14209
|
+
'steer',
|
|
14210
|
+
'reject'
|
|
14211
|
+
]
|
|
14212
|
+
},
|
|
14213
|
+
requestId: {
|
|
14214
|
+
type: 'string'
|
|
14215
|
+
}
|
|
14216
|
+
},
|
|
14217
|
+
required: [
|
|
14218
|
+
'grokTarget'
|
|
14219
|
+
],
|
|
14220
|
+
additionalProperties: false
|
|
14221
|
+
}
|
|
14222
|
+
};
|
|
14223
|
+
async function route({ input }) {
|
|
14224
|
+
let out;
|
|
14225
|
+
try {
|
|
14226
|
+
out = {
|
|
14227
|
+
...await (0,_core_relay_routes_js__rspack_import_1/* .bridgeOperation */.n1)('startBinding', input, await (0,_agent_bundle_runtime__rspack_import_3/* .agent */.MA)()),
|
|
14228
|
+
exitCode: 0
|
|
14229
|
+
};
|
|
14230
|
+
} catch (error) {
|
|
14231
|
+
out = (0,_core_codex_contract_js__rspack_import_2/* .outcomeFromError */.DG)(error);
|
|
14232
|
+
}
|
|
14233
|
+
return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_4/* .Agent.Result */.g.Result, {
|
|
14234
|
+
value: out,
|
|
14235
|
+
children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_4/* .Agent.Text */.g.Text, {
|
|
14236
|
+
children: JSON.stringify(out)
|
|
14237
|
+
})
|
|
14238
|
+
});
|
|
14239
|
+
}
|
|
14240
|
+
|
|
14241
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
14242
|
+
"default": () => (route),
|
|
14243
|
+
inputSchema: () => (/* reexport safe */ _core_relay_routes_js__rspack_import_1.xD),
|
|
14244
|
+
resultSchema: () => (/* reexport safe */ _core_relay_routes_js__rspack_import_1.Ax)
|
|
14245
|
+
}, {
|
|
14246
|
+
config: config
|
|
14247
|
+
});
|
|
14248
|
+
|
|
14249
|
+
|
|
14250
|
+
},
|
|
14251
|
+
"./src/cli/codex/bridge/status.tsx"(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
14252
|
+
__webpack_require__.r(__webpack_exports__);
|
|
14253
|
+
/* import */ var react_jsx_runtime__rspack_import_0 = __webpack_require__("./node_modules/react/jsx-runtime.react-server.js");
|
|
14254
|
+
/* import */ var _agent_bundle_runtime__rspack_import_3 = __webpack_require__("./node_modules/@agent-bundle/runtime/dist/736.js");
|
|
14255
|
+
/* import */ var _agent_bundle_runtime__rspack_import_4 = __webpack_require__("./node_modules/@agent-bundle/runtime/dist/506.js");
|
|
14256
|
+
/* import */ var _core_relay_routes_js__rspack_import_1 = __webpack_require__("./src/core/relay/routes.ts");
|
|
14257
|
+
/* import */ var _core_codex_contract_js__rspack_import_2 = __webpack_require__("./src/core/codex/contract.js");
|
|
14258
|
+
|
|
14259
|
+
|
|
14260
|
+
|
|
14261
|
+
|
|
14262
|
+
|
|
14263
|
+
const config = {
|
|
14264
|
+
description: 'Managed Grok/Codex bridge status.',
|
|
14265
|
+
exitCode: 'result',
|
|
14266
|
+
inputJsonSchema: {
|
|
14267
|
+
type: 'object',
|
|
14268
|
+
properties: {
|
|
14269
|
+
bindingId: {
|
|
14270
|
+
type: 'string'
|
|
14271
|
+
},
|
|
14272
|
+
limit: {
|
|
14273
|
+
type: 'number'
|
|
14274
|
+
}
|
|
14275
|
+
},
|
|
14276
|
+
additionalProperties: false
|
|
14277
|
+
}
|
|
14278
|
+
};
|
|
14279
|
+
async function route({ input }) {
|
|
14280
|
+
let out;
|
|
14281
|
+
try {
|
|
14282
|
+
out = {
|
|
14283
|
+
...await (0,_core_relay_routes_js__rspack_import_1/* .bridgeOperation */.n1)('status', input, await (0,_agent_bundle_runtime__rspack_import_3/* .agent */.MA)()),
|
|
14284
|
+
exitCode: 0
|
|
14285
|
+
};
|
|
14286
|
+
} catch (error) {
|
|
14287
|
+
out = (0,_core_codex_contract_js__rspack_import_2/* .outcomeFromError */.DG)(error);
|
|
14288
|
+
}
|
|
14289
|
+
return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_4/* .Agent.Result */.g.Result, {
|
|
14290
|
+
value: out,
|
|
14291
|
+
children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_4/* .Agent.Text */.g.Text, {
|
|
14292
|
+
children: JSON.stringify(out)
|
|
14293
|
+
})
|
|
14294
|
+
});
|
|
14295
|
+
}
|
|
14296
|
+
|
|
14297
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
14298
|
+
"default": () => (route),
|
|
14299
|
+
inputSchema: () => (/* reexport safe */ _core_relay_routes_js__rspack_import_1.np),
|
|
14300
|
+
resultSchema: () => (/* reexport safe */ _core_relay_routes_js__rspack_import_1.Ax)
|
|
14301
|
+
}, {
|
|
14302
|
+
config: config
|
|
14303
|
+
});
|
|
14304
|
+
|
|
14305
|
+
|
|
14306
|
+
},
|
|
14307
|
+
"./src/cli/codex/bridge/stop.tsx"(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
14308
|
+
__webpack_require__.r(__webpack_exports__);
|
|
14309
|
+
/* import */ var react_jsx_runtime__rspack_import_0 = __webpack_require__("./node_modules/react/jsx-runtime.react-server.js");
|
|
14310
|
+
/* import */ var _agent_bundle_runtime__rspack_import_3 = __webpack_require__("./node_modules/@agent-bundle/runtime/dist/736.js");
|
|
14311
|
+
/* import */ var _agent_bundle_runtime__rspack_import_4 = __webpack_require__("./node_modules/@agent-bundle/runtime/dist/506.js");
|
|
14312
|
+
/* import */ var _core_relay_routes_js__rspack_import_1 = __webpack_require__("./src/core/relay/routes.ts");
|
|
14313
|
+
/* import */ var _core_codex_contract_js__rspack_import_2 = __webpack_require__("./src/core/codex/contract.js");
|
|
14314
|
+
|
|
14315
|
+
|
|
14316
|
+
|
|
14317
|
+
|
|
14318
|
+
|
|
14319
|
+
const config = {
|
|
14320
|
+
description: 'Managed Grok/Codex bridge stop.',
|
|
14321
|
+
exitCode: 'result',
|
|
14322
|
+
inputJsonSchema: {
|
|
14323
|
+
type: 'object',
|
|
14324
|
+
properties: {
|
|
14325
|
+
bindingId: {
|
|
14326
|
+
type: 'string'
|
|
14327
|
+
},
|
|
14328
|
+
all: {
|
|
14329
|
+
type: 'boolean'
|
|
14330
|
+
},
|
|
14331
|
+
worker: {
|
|
14332
|
+
type: 'boolean'
|
|
14333
|
+
}
|
|
14334
|
+
},
|
|
14335
|
+
additionalProperties: false
|
|
14336
|
+
}
|
|
14337
|
+
};
|
|
14338
|
+
async function route({ input }) {
|
|
14339
|
+
let out;
|
|
14340
|
+
try {
|
|
14341
|
+
out = {
|
|
14342
|
+
...await (0,_core_relay_routes_js__rspack_import_1/* .bridgeOperation */.n1)('stop', input, await (0,_agent_bundle_runtime__rspack_import_3/* .agent */.MA)()),
|
|
14343
|
+
exitCode: 0
|
|
14344
|
+
};
|
|
14345
|
+
} catch (error) {
|
|
14346
|
+
out = (0,_core_codex_contract_js__rspack_import_2/* .outcomeFromError */.DG)(error);
|
|
14347
|
+
}
|
|
14348
|
+
return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_4/* .Agent.Result */.g.Result, {
|
|
14349
|
+
value: out,
|
|
14350
|
+
children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_4/* .Agent.Text */.g.Text, {
|
|
14351
|
+
children: JSON.stringify(out)
|
|
14352
|
+
})
|
|
14353
|
+
});
|
|
14354
|
+
}
|
|
14355
|
+
|
|
14356
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
14357
|
+
"default": () => (route),
|
|
14358
|
+
inputSchema: () => (/* reexport safe */ _core_relay_routes_js__rspack_import_1.d5),
|
|
14359
|
+
resultSchema: () => (/* reexport safe */ _core_relay_routes_js__rspack_import_1.Ax)
|
|
14360
|
+
}, {
|
|
14361
|
+
config: config
|
|
14362
|
+
});
|
|
14363
|
+
|
|
14364
|
+
|
|
13887
14365
|
},
|
|
13888
14366
|
"./src/cli/codex/desktop-shim.tsx"(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
13889
14367
|
__webpack_require__.r(__webpack_exports__);
|
|
@@ -13945,21 +14423,21 @@ async function codexDesktopShim({ input }) {
|
|
|
13945
14423
|
out = (0,_core_desktop_shim_js__rspack_import_1/* .installDesktopShim */.B0)();
|
|
13946
14424
|
} catch (error) {
|
|
13947
14425
|
const message = error instanceof Error ? error.message : String(error);
|
|
13948
|
-
return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Result */.
|
|
14426
|
+
return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Result */.g.Result, {
|
|
13949
14427
|
value: {
|
|
13950
14428
|
action: 'install',
|
|
13951
14429
|
error: message,
|
|
13952
14430
|
exitCode: 1
|
|
13953
14431
|
},
|
|
13954
|
-
children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Text */.
|
|
14432
|
+
children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Text */.g.Text, {
|
|
13955
14433
|
children: `Desktop shim install failed: ${message}`
|
|
13956
14434
|
})
|
|
13957
14435
|
});
|
|
13958
14436
|
}
|
|
13959
14437
|
const text = `Installed ChatGPT Desktop shim:\n` + ` wrapper: ${out.wrapperPath}\n` + ` bridge: ${out.bridgePath}\n` + ` login env: ${out.envScriptPath}` + (out.plistPath ? `\n LaunchAgent: ${out.plistPath}` : '\n LaunchAgent: n/a (macOS-only)') + `\nFully quit and relaunch ChatGPT.app so it inherits CODEX_CLI_PATH; ` + `Desktop falls back to stock Codex if the shim is ever removed.` + formatWarnings(out.warnings);
|
|
13960
|
-
return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Result */.
|
|
14438
|
+
return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Result */.g.Result, {
|
|
13961
14439
|
value: out,
|
|
13962
|
-
children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Text */.
|
|
14440
|
+
children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Text */.g.Text, {
|
|
13963
14441
|
children: text
|
|
13964
14442
|
})
|
|
13965
14443
|
});
|
|
@@ -13971,22 +14449,22 @@ async function codexDesktopShim({ input }) {
|
|
|
13971
14449
|
out = (0,_core_desktop_shim_js__rspack_import_1/* .uninstallDesktopShim */.gM)();
|
|
13972
14450
|
} catch (error) {
|
|
13973
14451
|
const message = error instanceof Error ? error.message : String(error);
|
|
13974
|
-
return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Result */.
|
|
14452
|
+
return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Result */.g.Result, {
|
|
13975
14453
|
value: {
|
|
13976
14454
|
action: 'uninstall',
|
|
13977
14455
|
error: message,
|
|
13978
14456
|
exitCode: 1
|
|
13979
14457
|
},
|
|
13980
|
-
children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Text */.
|
|
14458
|
+
children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Text */.g.Text, {
|
|
13981
14459
|
children: `Desktop shim uninstall failed: ${message}`
|
|
13982
14460
|
})
|
|
13983
14461
|
});
|
|
13984
14462
|
}
|
|
13985
14463
|
const removed = out.removed.length === 0 ? '(nothing installed)' : out.removed.join(', ');
|
|
13986
14464
|
const text = `Removed ChatGPT Desktop shim: ${removed}. ` + `Desktop and Codex fall back to stock behavior; relaunch ChatGPT.app to pick it up.` + formatWarnings(out.warnings);
|
|
13987
|
-
return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Result */.
|
|
14465
|
+
return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Result */.g.Result, {
|
|
13988
14466
|
value: out,
|
|
13989
|
-
children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Text */.
|
|
14467
|
+
children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Text */.g.Text, {
|
|
13990
14468
|
children: text
|
|
13991
14469
|
})
|
|
13992
14470
|
});
|
|
@@ -13994,9 +14472,9 @@ async function codexDesktopShim({ input }) {
|
|
|
13994
14472
|
case 'status':
|
|
13995
14473
|
{
|
|
13996
14474
|
const out = (0,_core_desktop_shim_js__rspack_import_1/* .desktopShimStatus */.em)();
|
|
13997
|
-
return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Result */.
|
|
14475
|
+
return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Result */.g.Result, {
|
|
13998
14476
|
value: out,
|
|
13999
|
-
children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Text */.
|
|
14477
|
+
children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Text */.g.Text, {
|
|
14000
14478
|
children: (0,_core_format_js__rspack_import_4/* .formatDesktopShimStatus */.fX)(out)
|
|
14001
14479
|
})
|
|
14002
14480
|
});
|
|
@@ -14076,21 +14554,21 @@ async function codexListThreads({ input }) {
|
|
|
14076
14554
|
});
|
|
14077
14555
|
} catch (error) {
|
|
14078
14556
|
const failure = (0,_core_codex_contract_js__rspack_import_2/* .outcomeFromError */.DG)(error);
|
|
14079
|
-
return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_5/* .Agent.Result */.
|
|
14557
|
+
return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_5/* .Agent.Result */.g.Result, {
|
|
14080
14558
|
value: failure,
|
|
14081
|
-
children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_5/* .Agent.Text */.
|
|
14559
|
+
children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_5/* .Agent.Text */.g.Text, {
|
|
14082
14560
|
children: failure.error
|
|
14083
14561
|
})
|
|
14084
14562
|
});
|
|
14085
14563
|
}
|
|
14086
14564
|
const more = out.nextCursor ? `\n\nmore: --cursor ${JSON.stringify((0,_core_codex_bridge_js__rspack_import_1/* .singleLine */.pF)(out.nextCursor))}` : '';
|
|
14087
14565
|
const text = out.threads.length === 0 ? 'No Codex threads.' : out.threads.map(_core_format_js__rspack_import_6/* .formatCodexThread */.nz).join('\n\n') + more;
|
|
14088
|
-
return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_5/* .Agent.Result */.
|
|
14566
|
+
return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_5/* .Agent.Result */.g.Result, {
|
|
14089
14567
|
value: {
|
|
14090
14568
|
...out,
|
|
14091
14569
|
exitCode: 0
|
|
14092
14570
|
},
|
|
14093
|
-
children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_5/* .Agent.Text */.
|
|
14571
|
+
children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_5/* .Agent.Text */.g.Text, {
|
|
14094
14572
|
children: text
|
|
14095
14573
|
})
|
|
14096
14574
|
});
|
|
@@ -14163,19 +14641,19 @@ async function codexQueue({ input }) {
|
|
|
14163
14641
|
out = await (0,_core_codex_bridge_js__rspack_import_1/* .listCodexQueue */.Bt)(input.threadId);
|
|
14164
14642
|
} catch (error) {
|
|
14165
14643
|
const failure = (0,_core_codex_contract_js__rspack_import_2/* .outcomeFromError */.DG)(error);
|
|
14166
|
-
return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_5/* .Agent.Result */.
|
|
14644
|
+
return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_5/* .Agent.Result */.g.Result, {
|
|
14167
14645
|
value: failure,
|
|
14168
|
-
children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_5/* .Agent.Text */.
|
|
14646
|
+
children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_5/* .Agent.Text */.g.Text, {
|
|
14169
14647
|
children: failure.error
|
|
14170
14648
|
})
|
|
14171
14649
|
});
|
|
14172
14650
|
}
|
|
14173
|
-
return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_5/* .Agent.Result */.
|
|
14651
|
+
return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_5/* .Agent.Result */.g.Result, {
|
|
14174
14652
|
value: {
|
|
14175
14653
|
...out,
|
|
14176
14654
|
exitCode: 0
|
|
14177
14655
|
},
|
|
14178
|
-
children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_5/* .Agent.Text */.
|
|
14656
|
+
children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_5/* .Agent.Text */.g.Text, {
|
|
14179
14657
|
children: (0,_core_format_js__rspack_import_6/* .formatCodexQueue */.e_)(out)
|
|
14180
14658
|
})
|
|
14181
14659
|
});
|
|
@@ -14194,169 +14672,337 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
14194
14672
|
"./src/cli/codex/send.tsx"(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
14195
14673
|
__webpack_require__.r(__webpack_exports__);
|
|
14196
14674
|
/* import */ var react_jsx_runtime__rspack_import_0 = __webpack_require__("./node_modules/react/jsx-runtime.react-server.js");
|
|
14197
|
-
/* import */ var _agent_bundle_runtime__rspack_import_4 = __webpack_require__("./node_modules/@agent-bundle/runtime/dist/
|
|
14675
|
+
/* import */ var _agent_bundle_runtime__rspack_import_4 = __webpack_require__("./node_modules/@agent-bundle/runtime/dist/736.js");
|
|
14676
|
+
/* import */ var _agent_bundle_runtime__rspack_import_5 = __webpack_require__("./node_modules/@agent-bundle/runtime/dist/506.js");
|
|
14198
14677
|
/* import */ var zod__rspack_import_3 = __webpack_require__("./node_modules/zod/v4/classic/schemas.js");
|
|
14199
|
-
/* import */ var
|
|
14200
|
-
/* import */ var
|
|
14678
|
+
/* import */ var _core_codex_routes_js__rspack_import_1 = __webpack_require__("./src/core/codex/routes.ts");
|
|
14679
|
+
/* import */ var _core_relay_routes_js__rspack_import_2 = __webpack_require__("./src/core/relay/routes.ts");
|
|
14201
14680
|
|
|
14202
14681
|
|
|
14203
14682
|
|
|
14204
14683
|
|
|
14205
14684
|
|
|
14685
|
+
const resultSchema = zod__rspack_import_3/* .union */.KCZ([
|
|
14686
|
+
_core_codex_routes_js__rspack_import_1/* .resultSchema */.FD,
|
|
14687
|
+
_core_relay_routes_js__rspack_import_2/* .relayResultSchema */.Ax
|
|
14688
|
+
]);
|
|
14689
|
+
const inputSchema = zod__rspack_import_3/* .object */.Ikc({
|
|
14690
|
+
..._core_codex_routes_js__rspack_import_1/* .sendFields */.at,
|
|
14691
|
+
whenBusy: zod__rspack_import_3/* ["enum"] */.k5n([
|
|
14692
|
+
'reject',
|
|
14693
|
+
'queue',
|
|
14694
|
+
'steer'
|
|
14695
|
+
]).optional(),
|
|
14696
|
+
replyToGrok: zod__rspack_import_3/* .string */.YjP().min(1).optional(),
|
|
14697
|
+
bindingId: zod__rspack_import_3/* .string */.YjP().min(1).optional(),
|
|
14698
|
+
requestId: zod__rspack_import_3/* .string */.YjP().min(1).max(128).optional(),
|
|
14699
|
+
correlationId: zod__rspack_import_3/* .string */.YjP().min(1).optional(),
|
|
14700
|
+
replyTo: zod__rspack_import_3/* .string */.YjP().min(1).optional(),
|
|
14701
|
+
message: zod__rspack_import_3/* .array */.YOg(zod__rspack_import_3/* .string */.YjP()).min(1)
|
|
14702
|
+
}).strict();
|
|
14206
14703
|
const config = {
|
|
14207
|
-
description: 'Send
|
|
14704
|
+
description: 'Send to Codex; acceptance is distinct from completion. Options precede threadId.',
|
|
14208
14705
|
exitCode: 'result',
|
|
14706
|
+
render: {
|
|
14707
|
+
maxElapsedMs: 660000
|
|
14708
|
+
},
|
|
14709
|
+
positionals: [
|
|
14710
|
+
'threadId',
|
|
14711
|
+
'message'
|
|
14712
|
+
],
|
|
14209
14713
|
inputJsonSchema: {
|
|
14714
|
+
type: 'object',
|
|
14210
14715
|
additionalProperties: false,
|
|
14211
14716
|
properties: {
|
|
14717
|
+
replyToGrok: {
|
|
14718
|
+
type: 'string'
|
|
14719
|
+
},
|
|
14720
|
+
bindingId: {
|
|
14721
|
+
type: 'string'
|
|
14722
|
+
},
|
|
14723
|
+
requestId: {
|
|
14724
|
+
type: 'string'
|
|
14725
|
+
},
|
|
14726
|
+
threadId: {
|
|
14727
|
+
type: 'string'
|
|
14728
|
+
},
|
|
14729
|
+
expectedCwd: {
|
|
14730
|
+
type: 'string'
|
|
14731
|
+
},
|
|
14732
|
+
timeoutMs: {
|
|
14733
|
+
type: 'number',
|
|
14734
|
+
description: 'Observation timeout: 1-600000 milliseconds.'
|
|
14735
|
+
},
|
|
14212
14736
|
correlationId: {
|
|
14213
|
-
description: 'Stable correlation id for multi-hop replies',
|
|
14214
14737
|
type: 'string'
|
|
14215
14738
|
},
|
|
14216
14739
|
envelope: {
|
|
14217
|
-
description: 'Prepend the [gbot …] header to the message body',
|
|
14218
14740
|
type: 'boolean'
|
|
14219
14741
|
},
|
|
14220
14742
|
hop: {
|
|
14221
|
-
description: 'Hop count; refused at GROK_BOT_MAX_HOPS',
|
|
14222
14743
|
type: 'number'
|
|
14223
14744
|
},
|
|
14224
|
-
message: {
|
|
14225
|
-
items: {
|
|
14226
|
-
type: 'string'
|
|
14227
|
-
},
|
|
14228
|
-
type: 'array'
|
|
14229
|
-
},
|
|
14230
14745
|
replyTo: {
|
|
14231
|
-
description: 'Prior message id this send replies to',
|
|
14232
14746
|
type: 'string'
|
|
14233
14747
|
},
|
|
14234
|
-
|
|
14235
|
-
type: 'string'
|
|
14748
|
+
expectedTurnId: {
|
|
14749
|
+
type: 'string',
|
|
14750
|
+
description: 'Required active-turn guard for steer; stale guards reject.'
|
|
14751
|
+
},
|
|
14752
|
+
wait: {
|
|
14753
|
+
type: 'boolean'
|
|
14754
|
+
},
|
|
14755
|
+
maxOutputBytes: {
|
|
14756
|
+
type: 'number',
|
|
14757
|
+
description: 'Reply budget: 1-4194304 bytes.'
|
|
14236
14758
|
},
|
|
14237
14759
|
whenBusy: {
|
|
14238
|
-
|
|
14760
|
+
type: 'string',
|
|
14239
14761
|
enum: [
|
|
14240
14762
|
'reject',
|
|
14241
|
-
'queue'
|
|
14242
|
-
|
|
14243
|
-
|
|
14763
|
+
'queue',
|
|
14764
|
+
'steer'
|
|
14765
|
+
]
|
|
14766
|
+
},
|
|
14767
|
+
message: {
|
|
14768
|
+
type: 'array',
|
|
14769
|
+
items: {
|
|
14770
|
+
type: 'string'
|
|
14771
|
+
}
|
|
14244
14772
|
}
|
|
14245
14773
|
},
|
|
14246
14774
|
required: [
|
|
14247
14775
|
'threadId',
|
|
14248
14776
|
'message'
|
|
14249
|
-
]
|
|
14777
|
+
]
|
|
14778
|
+
}
|
|
14779
|
+
};
|
|
14780
|
+
async function route({ input, signal }) {
|
|
14781
|
+
const context = await (0,_agent_bundle_runtime__rspack_import_4/* .agent */.MA)();
|
|
14782
|
+
if (input.replyToGrok || input.bindingId) {
|
|
14783
|
+
const out = await (0,_core_relay_routes_js__rspack_import_2/* .codexReturnOperation */.lt)({
|
|
14784
|
+
...input,
|
|
14785
|
+
message: input.message.join(' ').trim()
|
|
14786
|
+
}, context);
|
|
14787
|
+
return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_5/* .Agent.Result */.g.Result, {
|
|
14788
|
+
value: {
|
|
14789
|
+
...out,
|
|
14790
|
+
exitCode: out.delivery === 'rejected' ? 1 : 0
|
|
14791
|
+
},
|
|
14792
|
+
children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_5/* .Agent.Text */.g.Text, {
|
|
14793
|
+
children: `Delivery ${out.delivery}; terminal answer returns to Grok automatically.`
|
|
14794
|
+
})
|
|
14795
|
+
});
|
|
14796
|
+
}
|
|
14797
|
+
const out = await (0,_core_codex_routes_js__rspack_import_1/* .sendOperation */.UP)({
|
|
14798
|
+
...input,
|
|
14799
|
+
whenBusy: input.whenBusy ?? 'reject',
|
|
14800
|
+
message: input.message.join(' ').trim()
|
|
14801
|
+
}, signal, (message)=>context.progress.report({
|
|
14802
|
+
message
|
|
14803
|
+
}), true);
|
|
14804
|
+
return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_5/* .Agent.Result */.g.Result, {
|
|
14805
|
+
value: out,
|
|
14806
|
+
children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_5/* .Agent.Text */.g.Text, {
|
|
14807
|
+
children: (0,_core_codex_routes_js__rspack_import_1/* .resultText */.D6)(out)
|
|
14808
|
+
})
|
|
14809
|
+
});
|
|
14810
|
+
}
|
|
14811
|
+
|
|
14812
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
14813
|
+
"default": () => (route)
|
|
14814
|
+
}, {
|
|
14815
|
+
config: config,
|
|
14816
|
+
inputSchema: inputSchema,
|
|
14817
|
+
resultSchema: resultSchema
|
|
14818
|
+
});
|
|
14819
|
+
|
|
14820
|
+
|
|
14821
|
+
},
|
|
14822
|
+
"./src/cli/codex/status.tsx"(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
14823
|
+
__webpack_require__.r(__webpack_exports__);
|
|
14824
|
+
/* import */ var react_jsx_runtime__rspack_import_0 = __webpack_require__("./node_modules/react/jsx-runtime.react-server.js");
|
|
14825
|
+
/* import */ var _agent_bundle_runtime__rspack_import_3 = __webpack_require__("./node_modules/@agent-bundle/runtime/dist/506.js");
|
|
14826
|
+
/* import */ var zod__rspack_import_2 = __webpack_require__("./node_modules/zod/v4/classic/schemas.js");
|
|
14827
|
+
/* import */ var _core_codex_bridge_js__rspack_import_1 = __webpack_require__("./src/core/codex-bridge.js");
|
|
14828
|
+
/* import */ var _core_format_js__rspack_import_4 = __webpack_require__("./src/core/format.js");
|
|
14829
|
+
|
|
14830
|
+
|
|
14831
|
+
|
|
14832
|
+
|
|
14833
|
+
|
|
14834
|
+
const config = {
|
|
14835
|
+
description: 'Probe the local Codex app-server daemon. Exit 0 only when it is usable.',
|
|
14836
|
+
exitCode: 'result',
|
|
14837
|
+
inputJsonSchema: {
|
|
14838
|
+
additionalProperties: false,
|
|
14839
|
+
properties: {},
|
|
14250
14840
|
type: 'object'
|
|
14251
|
-
}
|
|
14252
|
-
positionals: [
|
|
14253
|
-
'threadId',
|
|
14254
|
-
'message'
|
|
14255
|
-
]
|
|
14841
|
+
}
|
|
14256
14842
|
};
|
|
14257
|
-
const inputSchema =
|
|
14258
|
-
|
|
14259
|
-
|
|
14260
|
-
|
|
14261
|
-
|
|
14262
|
-
replyTo: zod__rspack_import_3/* .string */.YjP().min(1).optional(),
|
|
14263
|
-
threadId: zod__rspack_import_3/* .string */.YjP().min(1),
|
|
14264
|
-
whenBusy: zod__rspack_import_3/* ["enum"] */.k5n([
|
|
14265
|
-
'reject',
|
|
14266
|
-
'queue'
|
|
14267
|
-
]).default('reject')
|
|
14268
|
-
}).strict();
|
|
14269
|
-
const resultSchema = zod__rspack_import_3/* .object */.Ikc({
|
|
14270
|
-
delivery: zod__rspack_import_3/* ["enum"] */.k5n([
|
|
14271
|
-
'accepted',
|
|
14272
|
-
'queued',
|
|
14273
|
-
'rejected',
|
|
14274
|
-
'unknown'
|
|
14275
|
-
]),
|
|
14276
|
-
exitCode: zod__rspack_import_3/* .union */.KCZ([
|
|
14277
|
-
zod__rspack_import_3/* .literal */.euz(0),
|
|
14278
|
-
zod__rspack_import_3/* .literal */.euz(1)
|
|
14843
|
+
const inputSchema = zod__rspack_import_2/* .object */.Ikc({}).strict();
|
|
14844
|
+
const resultSchema = zod__rspack_import_2/* .object */.Ikc({
|
|
14845
|
+
exitCode: zod__rspack_import_2/* .union */.KCZ([
|
|
14846
|
+
zod__rspack_import_2/* .literal */.euz(0),
|
|
14847
|
+
zod__rspack_import_2/* .literal */.euz(1)
|
|
14279
14848
|
])
|
|
14280
14849
|
}).passthrough();
|
|
14281
|
-
async function
|
|
14282
|
-
|
|
14283
|
-
|
|
14284
|
-
|
|
14285
|
-
|
|
14286
|
-
|
|
14287
|
-
|
|
14288
|
-
|
|
14289
|
-
|
|
14290
|
-
|
|
14291
|
-
|
|
14292
|
-
|
|
14293
|
-
|
|
14294
|
-
|
|
14295
|
-
|
|
14850
|
+
async function codexStatusCmd(_props) {
|
|
14851
|
+
const status = await (0,_core_codex_bridge_js__rspack_import_1/* .codexStatus */.MU)();
|
|
14852
|
+
return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Result */.g.Result, {
|
|
14853
|
+
value: status,
|
|
14854
|
+
children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Text */.g.Text, {
|
|
14855
|
+
children: (0,_core_format_js__rspack_import_4/* .formatCodexStatus */.P2)(status)
|
|
14856
|
+
})
|
|
14857
|
+
});
|
|
14858
|
+
}
|
|
14859
|
+
|
|
14860
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
14861
|
+
"default": () => (codexStatusCmd)
|
|
14862
|
+
}, {
|
|
14863
|
+
config: config,
|
|
14864
|
+
inputSchema: inputSchema,
|
|
14865
|
+
resultSchema: resultSchema
|
|
14866
|
+
});
|
|
14867
|
+
|
|
14868
|
+
|
|
14869
|
+
},
|
|
14870
|
+
"./src/cli/codex/wait.tsx"(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
14871
|
+
__webpack_require__.r(__webpack_exports__);
|
|
14872
|
+
/* import */ var react_jsx_runtime__rspack_import_0 = __webpack_require__("./node_modules/react/jsx-runtime.react-server.js");
|
|
14873
|
+
/* import */ var _agent_bundle_runtime__rspack_import_2 = __webpack_require__("./node_modules/@agent-bundle/runtime/dist/736.js");
|
|
14874
|
+
/* import */ var _agent_bundle_runtime__rspack_import_3 = __webpack_require__("./node_modules/@agent-bundle/runtime/dist/506.js");
|
|
14875
|
+
/* import */ var _core_codex_routes_js__rspack_import_1 = __webpack_require__("./src/core/codex/routes.ts");
|
|
14876
|
+
|
|
14877
|
+
|
|
14878
|
+
|
|
14879
|
+
|
|
14880
|
+
const config = {
|
|
14881
|
+
description: 'Bounded Codex wait observation; never interrupts execution.',
|
|
14882
|
+
exitCode: 'result',
|
|
14883
|
+
render: {
|
|
14884
|
+
maxElapsedMs: 660000
|
|
14885
|
+
},
|
|
14886
|
+
positionals: [
|
|
14887
|
+
'threadId',
|
|
14888
|
+
'turnId'
|
|
14889
|
+
],
|
|
14890
|
+
inputJsonSchema: {
|
|
14891
|
+
type: 'object',
|
|
14892
|
+
additionalProperties: false,
|
|
14893
|
+
properties: {
|
|
14894
|
+
"threadId": {
|
|
14895
|
+
"type": "string"
|
|
14896
|
+
},
|
|
14897
|
+
"expectedCwd": {
|
|
14898
|
+
"type": "string"
|
|
14899
|
+
},
|
|
14900
|
+
"timeoutMs": {
|
|
14901
|
+
"type": "number",
|
|
14902
|
+
"description": "Observation timeout: 1-600000 milliseconds."
|
|
14903
|
+
},
|
|
14904
|
+
"turnId": {
|
|
14905
|
+
"type": "string"
|
|
14906
|
+
},
|
|
14907
|
+
"messageId": {
|
|
14908
|
+
"type": "string"
|
|
14909
|
+
},
|
|
14910
|
+
"maxOutputBytes": {
|
|
14911
|
+
"type": "number",
|
|
14912
|
+
"description": "Reply budget: 1-4194304 bytes."
|
|
14913
|
+
}
|
|
14914
|
+
},
|
|
14915
|
+
required: [
|
|
14916
|
+
'threadId',
|
|
14917
|
+
'turnId'
|
|
14918
|
+
]
|
|
14296
14919
|
}
|
|
14297
|
-
|
|
14298
|
-
|
|
14920
|
+
};
|
|
14921
|
+
async function route({ input, signal }) {
|
|
14922
|
+
const context = await (0,_agent_bundle_runtime__rspack_import_2/* .agent */.MA)();
|
|
14923
|
+
const out = await (0,_core_codex_routes_js__rspack_import_1/* .observeOperation */.gT)('wait', input, signal, (message)=>context.progress.report({
|
|
14924
|
+
message
|
|
14925
|
+
}));
|
|
14926
|
+
return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Result */.g.Result, {
|
|
14299
14927
|
value: out,
|
|
14300
|
-
children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(
|
|
14301
|
-
children:
|
|
14928
|
+
children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Text */.g.Text, {
|
|
14929
|
+
children: (0,_core_codex_routes_js__rspack_import_1/* .resultText */.D6)(out)
|
|
14302
14930
|
})
|
|
14303
14931
|
});
|
|
14304
14932
|
}
|
|
14305
14933
|
|
|
14306
14934
|
__webpack_require__.d(__webpack_exports__, {
|
|
14307
|
-
"default": () => (
|
|
14935
|
+
"default": () => (route),
|
|
14936
|
+
inputSchema: () => (/* reexport safe */ _core_codex_routes_js__rspack_import_1.jS),
|
|
14937
|
+
resultSchema: () => (/* reexport safe */ _core_codex_routes_js__rspack_import_1.FD)
|
|
14308
14938
|
}, {
|
|
14309
|
-
config: config
|
|
14310
|
-
inputSchema: inputSchema,
|
|
14311
|
-
resultSchema: resultSchema
|
|
14939
|
+
config: config
|
|
14312
14940
|
});
|
|
14313
14941
|
|
|
14314
14942
|
|
|
14315
14943
|
},
|
|
14316
|
-
"./src/cli/codex/
|
|
14944
|
+
"./src/cli/codex/watch.tsx"(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
14317
14945
|
__webpack_require__.r(__webpack_exports__);
|
|
14318
14946
|
/* import */ var react_jsx_runtime__rspack_import_0 = __webpack_require__("./node_modules/react/jsx-runtime.react-server.js");
|
|
14947
|
+
/* import */ var _agent_bundle_runtime__rspack_import_2 = __webpack_require__("./node_modules/@agent-bundle/runtime/dist/736.js");
|
|
14319
14948
|
/* import */ var _agent_bundle_runtime__rspack_import_3 = __webpack_require__("./node_modules/@agent-bundle/runtime/dist/506.js");
|
|
14320
|
-
/* import */ var
|
|
14321
|
-
/* import */ var _core_codex_bridge_js__rspack_import_1 = __webpack_require__("./src/core/codex-bridge.js");
|
|
14322
|
-
/* import */ var _core_format_js__rspack_import_4 = __webpack_require__("./src/core/format.js");
|
|
14323
|
-
|
|
14949
|
+
/* import */ var _core_codex_routes_js__rspack_import_1 = __webpack_require__("./src/core/codex/routes.ts");
|
|
14324
14950
|
|
|
14325
14951
|
|
|
14326
14952
|
|
|
14327
14953
|
|
|
14328
14954
|
const config = {
|
|
14329
|
-
description: '
|
|
14955
|
+
description: 'Bounded Codex watch observation; never interrupts execution.',
|
|
14330
14956
|
exitCode: 'result',
|
|
14957
|
+
render: {
|
|
14958
|
+
maxElapsedMs: 660000
|
|
14959
|
+
},
|
|
14960
|
+
positionals: [
|
|
14961
|
+
'threadId'
|
|
14962
|
+
],
|
|
14331
14963
|
inputJsonSchema: {
|
|
14964
|
+
type: 'object',
|
|
14332
14965
|
additionalProperties: false,
|
|
14333
|
-
properties: {
|
|
14334
|
-
|
|
14966
|
+
properties: {
|
|
14967
|
+
"threadId": {
|
|
14968
|
+
"type": "string"
|
|
14969
|
+
},
|
|
14970
|
+
"expectedCwd": {
|
|
14971
|
+
"type": "string"
|
|
14972
|
+
},
|
|
14973
|
+
"timeoutMs": {
|
|
14974
|
+
"type": "number",
|
|
14975
|
+
"description": "Observation timeout: 1-600000 milliseconds."
|
|
14976
|
+
},
|
|
14977
|
+
"maxEvents": {
|
|
14978
|
+
"type": "number",
|
|
14979
|
+
"description": "Maximum observed events: 1-500."
|
|
14980
|
+
}
|
|
14981
|
+
},
|
|
14982
|
+
required: [
|
|
14983
|
+
'threadId'
|
|
14984
|
+
]
|
|
14335
14985
|
}
|
|
14336
14986
|
};
|
|
14337
|
-
|
|
14338
|
-
const
|
|
14339
|
-
|
|
14340
|
-
|
|
14341
|
-
|
|
14342
|
-
|
|
14343
|
-
|
|
14344
|
-
|
|
14345
|
-
|
|
14346
|
-
return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Result */.g6.Result, {
|
|
14347
|
-
value: status,
|
|
14348
|
-
children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Text */.g6.Text, {
|
|
14349
|
-
children: (0,_core_format_js__rspack_import_4/* .formatCodexStatus */.P2)(status)
|
|
14987
|
+
async function route({ input, signal }) {
|
|
14988
|
+
const context = await (0,_agent_bundle_runtime__rspack_import_2/* .agent */.MA)();
|
|
14989
|
+
const out = await (0,_core_codex_routes_js__rspack_import_1/* .observeOperation */.gT)('watch', input, signal, (message)=>context.progress.report({
|
|
14990
|
+
message
|
|
14991
|
+
}));
|
|
14992
|
+
return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Result */.g.Result, {
|
|
14993
|
+
value: out,
|
|
14994
|
+
children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Text */.g.Text, {
|
|
14995
|
+
children: (0,_core_codex_routes_js__rspack_import_1/* .resultText */.D6)(out)
|
|
14350
14996
|
})
|
|
14351
14997
|
});
|
|
14352
14998
|
}
|
|
14353
14999
|
|
|
14354
15000
|
__webpack_require__.d(__webpack_exports__, {
|
|
14355
|
-
"default": () => (
|
|
15001
|
+
"default": () => (route),
|
|
15002
|
+
inputSchema: () => (/* reexport safe */ _core_codex_routes_js__rspack_import_1.R9),
|
|
15003
|
+
resultSchema: () => (/* reexport safe */ _core_codex_routes_js__rspack_import_1.FD)
|
|
14356
15004
|
}, {
|
|
14357
|
-
config: config
|
|
14358
|
-
inputSchema: inputSchema,
|
|
14359
|
-
resultSchema: resultSchema
|
|
15005
|
+
config: config
|
|
14360
15006
|
});
|
|
14361
15007
|
|
|
14362
15008
|
|
|
@@ -14448,9 +15094,9 @@ async function doctor({ input }) {
|
|
|
14448
15094
|
...candidates.map((c)=>` ${c}`),
|
|
14449
15095
|
note
|
|
14450
15096
|
].join('\n');
|
|
14451
|
-
return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_6/* .Agent.Result */.
|
|
15097
|
+
return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_6/* .Agent.Result */.g.Result, {
|
|
14452
15098
|
value: value,
|
|
14453
|
-
children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_6/* .Agent.Text */.
|
|
15099
|
+
children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_6/* .Agent.Text */.g.Text, {
|
|
14454
15100
|
children: text
|
|
14455
15101
|
})
|
|
14456
15102
|
});
|
|
@@ -14521,9 +15167,9 @@ const resultSchema = _shared_js__rspack_import_1/* .agentSummarySchema */.t_;
|
|
|
14521
15167
|
async function groupsAdd({ input }) {
|
|
14522
15168
|
const backend = await (0,_shared_js__rspack_import_1/* .openBackendFromInput */.FS)(input);
|
|
14523
15169
|
const rec = await backend.addGroupMember(input.group, input.bot);
|
|
14524
|
-
return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Result */.
|
|
15170
|
+
return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Result */.g.Result, {
|
|
14525
15171
|
value: (0,_core_format_js__rspack_import_4/* .summarize */.eh)(rec),
|
|
14526
|
-
children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Text */.
|
|
15172
|
+
children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Text */.g.Text, {
|
|
14527
15173
|
children: `Added to ${rec.name}. Members: ${rec.memberIds.length}`
|
|
14528
15174
|
})
|
|
14529
15175
|
});
|
|
@@ -14609,9 +15255,9 @@ async function groupsCreate({ input }) {
|
|
|
14609
15255
|
...(0,_shared_js__rspack_import_1/* .toCreateInput */.cp)(fields),
|
|
14610
15256
|
memberIds: member
|
|
14611
15257
|
});
|
|
14612
|
-
return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Result */.
|
|
15258
|
+
return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Result */.g.Result, {
|
|
14613
15259
|
value: (0,_core_format_js__rspack_import_4/* .summarize */.eh)(rec),
|
|
14614
|
-
children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Text */.
|
|
15260
|
+
children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Text */.g.Text, {
|
|
14615
15261
|
children: `Created group ${rec.name} (${rec.id}) with ${rec.memberIds.length} members`
|
|
14616
15262
|
})
|
|
14617
15263
|
});
|
|
@@ -14679,9 +15325,9 @@ async function groupsDelete({ input }) {
|
|
|
14679
15325
|
const rec = await backend.resolve(input.ref);
|
|
14680
15326
|
if (!rec.isGroup) throw new Error(`"${rec.name}" is a bot, not a group. Use bots delete.`);
|
|
14681
15327
|
const deleted = await backend.deleteAgent(input.ref);
|
|
14682
|
-
return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Result */.
|
|
15328
|
+
return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Result */.g.Result, {
|
|
14683
15329
|
value: (0,_core_format_js__rspack_import_4/* .summarize */.eh)(deleted),
|
|
14684
|
-
children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Text */.
|
|
15330
|
+
children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Text */.g.Text, {
|
|
14685
15331
|
children: `Deleted group ${deleted.name} (${deleted.id})`
|
|
14686
15332
|
})
|
|
14687
15333
|
});
|
|
@@ -14749,9 +15395,9 @@ async function groupsGet({ input }) {
|
|
|
14749
15395
|
const rec = await backend.resolve(input.ref);
|
|
14750
15396
|
if (!rec.isGroup) throw new Error(`"${rec.name}" is a bot, not a group.`);
|
|
14751
15397
|
const all = await backend.list();
|
|
14752
|
-
return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Result */.
|
|
15398
|
+
return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Result */.g.Result, {
|
|
14753
15399
|
value: (0,_core_format_js__rspack_import_4/* .summarize */.eh)(rec),
|
|
14754
|
-
children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Text */.
|
|
15400
|
+
children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Text */.g.Text, {
|
|
14755
15401
|
children: (0,_core_format_js__rspack_import_4/* .formatRecord */.bM)(rec, all)
|
|
14756
15402
|
})
|
|
14757
15403
|
});
|
|
@@ -14808,9 +15454,9 @@ async function groupsList({ input }) {
|
|
|
14808
15454
|
const rows = all.filter((r)=>r.isGroup);
|
|
14809
15455
|
const groups = rows.map(_core_format_js__rspack_import_3/* .summarize */.eh);
|
|
14810
15456
|
const text = rows.length === 0 ? 'No groups.' : rows.map((r)=>(0,_core_format_js__rspack_import_3/* .formatRecord */.bM)(r, all)).join('\n\n');
|
|
14811
|
-
return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_4/* .Agent.Result */.
|
|
15457
|
+
return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_4/* .Agent.Result */.g.Result, {
|
|
14812
15458
|
value: groups,
|
|
14813
|
-
children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_4/* .Agent.Text */.
|
|
15459
|
+
children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_4/* .Agent.Text */.g.Text, {
|
|
14814
15460
|
children: text
|
|
14815
15461
|
})
|
|
14816
15462
|
});
|
|
@@ -14878,9 +15524,9 @@ async function groupsMembers({ input }) {
|
|
|
14878
15524
|
const rec = await backend.resolve(input.ref);
|
|
14879
15525
|
if (!rec.isGroup) throw new Error(`"${rec.name}" is a bot, not a group.`);
|
|
14880
15526
|
const all = await backend.list();
|
|
14881
|
-
return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Result */.
|
|
15527
|
+
return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Result */.g.Result, {
|
|
14882
15528
|
value: (0,_core_format_js__rspack_import_4/* .summarize */.eh)(rec),
|
|
14883
|
-
children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Text */.
|
|
15529
|
+
children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Text */.g.Text, {
|
|
14884
15530
|
children: (0,_core_format_js__rspack_import_4/* .formatRecord */.bM)(rec, all)
|
|
14885
15531
|
})
|
|
14886
15532
|
});
|
|
@@ -14951,9 +15597,9 @@ const resultSchema = _shared_js__rspack_import_1/* .agentSummarySchema */.t_;
|
|
|
14951
15597
|
async function groupsRemove({ input }) {
|
|
14952
15598
|
const backend = await (0,_shared_js__rspack_import_1/* .openBackendFromInput */.FS)(input);
|
|
14953
15599
|
const rec = await backend.removeGroupMember(input.group, input.bot);
|
|
14954
|
-
return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Result */.
|
|
15600
|
+
return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Result */.g.Result, {
|
|
14955
15601
|
value: (0,_core_format_js__rspack_import_4/* .summarize */.eh)(rec),
|
|
14956
|
-
children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Text */.
|
|
15602
|
+
children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Text */.g.Text, {
|
|
14957
15603
|
children: `Removed from ${rec.name}. Members: ${rec.memberIds.length}`
|
|
14958
15604
|
})
|
|
14959
15605
|
});
|
|
@@ -15027,9 +15673,9 @@ const resultSchema = _shared_js__rspack_import_1/* .agentSummarySchema */.t_;
|
|
|
15027
15673
|
async function groupsSet({ input }) {
|
|
15028
15674
|
const backend = await (0,_shared_js__rspack_import_1/* .openBackendFromInput */.FS)(input);
|
|
15029
15675
|
const rec = await backend.setGroupMembers(input.group, input.member);
|
|
15030
|
-
return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Result */.
|
|
15676
|
+
return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Result */.g.Result, {
|
|
15031
15677
|
value: (0,_core_format_js__rspack_import_4/* .summarize */.eh)(rec),
|
|
15032
|
-
children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Text */.
|
|
15678
|
+
children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Text */.g.Text, {
|
|
15033
15679
|
children: `Updated ${rec.name}. Members: ${rec.memberIds.length}`
|
|
15034
15680
|
})
|
|
15035
15681
|
});
|
|
@@ -15119,9 +15765,9 @@ async function groupsUpdate({ input }) {
|
|
|
15119
15765
|
if (!current.isGroup) throw new Error(`"${current.name}" is a bot, not a group. Use bots update.`);
|
|
15120
15766
|
const { dir: _d, files: _f, gateway: _g, ref, ...fields } = input;
|
|
15121
15767
|
const rec = await backend.updateAgent(ref, (0,_shared_js__rspack_import_1/* .toUpdatePatch */.li)(fields));
|
|
15122
|
-
return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Result */.
|
|
15768
|
+
return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Result */.g.Result, {
|
|
15123
15769
|
value: (0,_core_format_js__rspack_import_4/* .summarize */.eh)(rec),
|
|
15124
|
-
children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Text */.
|
|
15770
|
+
children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Text */.g.Text, {
|
|
15125
15771
|
children: `Updated group ${rec.name} (${rec.id})`
|
|
15126
15772
|
})
|
|
15127
15773
|
});
|
|
@@ -15197,11 +15843,11 @@ const resultSchema = zod__rspack_import_2/* .union */.KCZ([
|
|
|
15197
15843
|
async function history({ input }) {
|
|
15198
15844
|
const file = (0,_core_history_js__rspack_import_1/* .historyPath */.ae)(input.historyDir);
|
|
15199
15845
|
if (input.path) {
|
|
15200
|
-
return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Result */.
|
|
15846
|
+
return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Result */.g.Result, {
|
|
15201
15847
|
value: {
|
|
15202
15848
|
path: file
|
|
15203
15849
|
},
|
|
15204
|
-
children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Text */.
|
|
15850
|
+
children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Text */.g.Text, {
|
|
15205
15851
|
children: file
|
|
15206
15852
|
})
|
|
15207
15853
|
});
|
|
@@ -15212,9 +15858,9 @@ async function history({ input }) {
|
|
|
15212
15858
|
search: input.search
|
|
15213
15859
|
});
|
|
15214
15860
|
const text = rows.length ? rows.map((row)=>`[${row.recordedAt}] ${row.target.name} (${row.target.id}) [${row.role}] ${row.text}`).join('\n') : 'No local history.';
|
|
15215
|
-
return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Result */.
|
|
15861
|
+
return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Result */.g.Result, {
|
|
15216
15862
|
value: rows,
|
|
15217
|
-
children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Text */.
|
|
15863
|
+
children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Text */.g.Text, {
|
|
15218
15864
|
children: text
|
|
15219
15865
|
})
|
|
15220
15866
|
});
|
|
@@ -15233,12 +15879,15 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
15233
15879
|
"./src/cli/send.tsx"(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
15234
15880
|
__webpack_require__.r(__webpack_exports__);
|
|
15235
15881
|
/* import */ var react_jsx_runtime__rspack_import_0 = __webpack_require__("./node_modules/react/jsx-runtime.react-server.js");
|
|
15236
|
-
/* import */ var
|
|
15237
|
-
/* import */ var
|
|
15238
|
-
/* import */ var
|
|
15239
|
-
/* import */ var
|
|
15240
|
-
/* import */ var
|
|
15241
|
-
/* import */ var
|
|
15882
|
+
/* import */ var _agent_bundle_runtime__rspack_import_7 = __webpack_require__("./node_modules/@agent-bundle/runtime/dist/736.js");
|
|
15883
|
+
/* import */ var _agent_bundle_runtime__rspack_import_8 = __webpack_require__("./node_modules/@agent-bundle/runtime/dist/506.js");
|
|
15884
|
+
/* import */ var zod__rspack_import_6 = __webpack_require__("./node_modules/zod/v4/classic/schemas.js");
|
|
15885
|
+
/* import */ var _core_relay_routes_js__rspack_import_1 = __webpack_require__("./src/core/relay/routes.ts");
|
|
15886
|
+
/* import */ var _core_codex_bridge_js__rspack_import_2 = __webpack_require__("./src/core/codex-bridge.js");
|
|
15887
|
+
/* import */ var _core_codex_contract_js__rspack_import_3 = __webpack_require__("./src/core/codex/contract.js");
|
|
15888
|
+
/* import */ var _core_history_js__rspack_import_4 = __webpack_require__("./src/core/history.js");
|
|
15889
|
+
/* import */ var _shared_js__rspack_import_5 = __webpack_require__("./src/cli/_shared.ts");
|
|
15890
|
+
|
|
15242
15891
|
|
|
15243
15892
|
|
|
15244
15893
|
|
|
@@ -15252,6 +15901,25 @@ const config = {
|
|
|
15252
15901
|
inputJsonSchema: {
|
|
15253
15902
|
additionalProperties: false,
|
|
15254
15903
|
properties: {
|
|
15904
|
+
replyMode: {
|
|
15905
|
+
type: 'string',
|
|
15906
|
+
enum: [
|
|
15907
|
+
'auto',
|
|
15908
|
+
'manual'
|
|
15909
|
+
]
|
|
15910
|
+
},
|
|
15911
|
+
codexThreadId: {
|
|
15912
|
+
type: 'string'
|
|
15913
|
+
},
|
|
15914
|
+
bindingId: {
|
|
15915
|
+
type: 'string'
|
|
15916
|
+
},
|
|
15917
|
+
expectedCwd: {
|
|
15918
|
+
type: 'string'
|
|
15919
|
+
},
|
|
15920
|
+
requestId: {
|
|
15921
|
+
type: 'string'
|
|
15922
|
+
},
|
|
15255
15923
|
correlationId: {
|
|
15256
15924
|
description: 'Stable correlation id for multi-hop replies',
|
|
15257
15925
|
type: 'string'
|
|
@@ -15309,52 +15977,58 @@ const config = {
|
|
|
15309
15977
|
'message'
|
|
15310
15978
|
]
|
|
15311
15979
|
};
|
|
15312
|
-
const inputSchema =
|
|
15313
|
-
|
|
15314
|
-
|
|
15315
|
-
|
|
15316
|
-
|
|
15317
|
-
|
|
15318
|
-
|
|
15319
|
-
|
|
15320
|
-
|
|
15980
|
+
const inputSchema = _shared_js__rspack_import_5/* .backendFlagsSchema.extend */.lK.extend({
|
|
15981
|
+
..._core_relay_routes_js__rspack_import_1/* .routeFields */.zK,
|
|
15982
|
+
replyMode: zod__rspack_import_6/* ["enum"] */.k5n([
|
|
15983
|
+
'auto',
|
|
15984
|
+
'manual'
|
|
15985
|
+
]).optional(),
|
|
15986
|
+
correlationId: zod__rspack_import_6/* .string */.YjP().min(1).optional(),
|
|
15987
|
+
envelope: zod__rspack_import_6/* .boolean */.zMY().default(false),
|
|
15988
|
+
historyDir: zod__rspack_import_6/* .string */.YjP().min(1).optional(),
|
|
15989
|
+
hop: zod__rspack_import_6/* .number */.aig().int().min(0).optional(),
|
|
15990
|
+
message: zod__rspack_import_6/* .array */.YOg(zod__rspack_import_6/* .string */.YjP()).min(1),
|
|
15991
|
+
noHistory: zod__rspack_import_6/* .boolean */.zMY().default(false),
|
|
15992
|
+
replyTo: zod__rspack_import_6/* .string */.YjP().min(1).optional(),
|
|
15993
|
+
target: zod__rspack_import_6/* .string */.YjP().min(1)
|
|
15321
15994
|
}).strict();
|
|
15322
|
-
const receiptSchema =
|
|
15323
|
-
correlationId:
|
|
15324
|
-
delivery:
|
|
15995
|
+
const receiptSchema = zod__rspack_import_6/* .object */.Ikc({
|
|
15996
|
+
correlationId: zod__rspack_import_6/* .string */.YjP(),
|
|
15997
|
+
delivery: zod__rspack_import_6/* ["enum"] */.k5n([
|
|
15325
15998
|
'accepted',
|
|
15326
15999
|
'unknown'
|
|
15327
16000
|
]),
|
|
15328
|
-
envelopeId:
|
|
15329
|
-
exitCode:
|
|
15330
|
-
hop:
|
|
15331
|
-
id:
|
|
15332
|
-
kind:
|
|
16001
|
+
envelopeId: zod__rspack_import_6/* .string */.YjP(),
|
|
16002
|
+
exitCode: zod__rspack_import_6/* .literal */.euz(0),
|
|
16003
|
+
hop: zod__rspack_import_6/* .number */.aig().int().min(0),
|
|
16004
|
+
id: zod__rspack_import_6/* .string */.YjP(),
|
|
16005
|
+
kind: zod__rspack_import_6/* ["enum"] */.k5n([
|
|
15333
16006
|
'bot',
|
|
15334
16007
|
'group'
|
|
15335
16008
|
]),
|
|
15336
|
-
maxHops:
|
|
15337
|
-
messageId:
|
|
15338
|
-
name:
|
|
15339
|
-
replyTo:
|
|
15340
|
-
result:
|
|
16009
|
+
maxHops: zod__rspack_import_6/* .number */.aig().int().min(0),
|
|
16010
|
+
messageId: zod__rspack_import_6/* .string */.YjP().optional(),
|
|
16011
|
+
name: zod__rspack_import_6/* .string */.YjP(),
|
|
16012
|
+
replyTo: zod__rspack_import_6/* .string */.YjP().optional(),
|
|
16013
|
+
result: zod__rspack_import_6/* .record */.g1P(zod__rspack_import_6/* .string */.YjP(), zod__rspack_import_6/* .json */.Pq9())
|
|
15341
16014
|
}).strict();
|
|
15342
16015
|
// Refusals and gateway failures are the same flat document `codex send` emits.
|
|
15343
|
-
const resultSchema =
|
|
16016
|
+
const resultSchema = zod__rspack_import_6/* .union */.KCZ([
|
|
15344
16017
|
receiptSchema,
|
|
15345
|
-
|
|
16018
|
+
_shared_js__rspack_import_5/* .failureDocumentSchema */.R9,
|
|
16019
|
+
_core_relay_routes_js__rspack_import_1/* .relayResultSchema */.Ax
|
|
15346
16020
|
]);
|
|
15347
16021
|
const deliver = async (input)=>{
|
|
15348
|
-
const envelope = (0,
|
|
16022
|
+
const envelope = (0,_core_codex_bridge_js__rspack_import_2/* .buildEnvelope */.nq)({
|
|
15349
16023
|
correlationId: input.correlationId,
|
|
15350
16024
|
envelope: input.envelope,
|
|
15351
16025
|
hop: input.hop,
|
|
15352
16026
|
replyTo: input.replyTo
|
|
15353
16027
|
});
|
|
15354
16028
|
const message = input.message.join(' ').trim();
|
|
15355
|
-
const backend = await (0,
|
|
15356
|
-
const out = await backend.send(input.target, (0,
|
|
15357
|
-
(0,
|
|
16029
|
+
const backend = await (0,_shared_js__rspack_import_5/* .openBackendFromInput */.FS)(input);
|
|
16030
|
+
const out = await backend.send(input.target, (0,_core_codex_bridge_js__rspack_import_2/* .withEnvelopeHeader */.Mr)(message, envelope));
|
|
16031
|
+
(0,_core_history_js__rspack_import_4/* .saveHistory */.QX)(out, {
|
|
15358
16032
|
dir: input.historyDir,
|
|
15359
16033
|
disabled: input.noHistory,
|
|
15360
16034
|
event: 'send',
|
|
@@ -15382,14 +16056,38 @@ const deliver = async (input)=>{
|
|
|
15382
16056
|
async function send({ input }) {
|
|
15383
16057
|
let value;
|
|
15384
16058
|
try {
|
|
16059
|
+
if (input.replyMode === 'auto' || input.codexThreadId || input.bindingId) {
|
|
16060
|
+
(0,_core_relay_routes_js__rspack_import_1/* .assertManagedSendOptions */.MB)(input);
|
|
16061
|
+
if (input.files) throw Error('Automatic routes require the gateway backend');
|
|
16062
|
+
const out = await (0,_core_relay_routes_js__rspack_import_1/* .grokSendOperation */.bv)({
|
|
16063
|
+
target: input.target,
|
|
16064
|
+
message: input.message.join(' ').trim(),
|
|
16065
|
+
replyMode: input.replyMode ?? 'auto',
|
|
16066
|
+
codexThreadId: input.codexThreadId,
|
|
16067
|
+
bindingId: input.bindingId,
|
|
16068
|
+
expectedCwd: input.expectedCwd,
|
|
16069
|
+
requestId: input.requestId,
|
|
16070
|
+
hop: input.hop,
|
|
16071
|
+
correlationId: input.correlationId
|
|
16072
|
+
}, await (0,_agent_bundle_runtime__rspack_import_7/* .agent */.MA)());
|
|
16073
|
+
return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_8/* .Agent.Result */.g.Result, {
|
|
16074
|
+
value: {
|
|
16075
|
+
...out,
|
|
16076
|
+
exitCode: out.delivery === 'rejected' ? 1 : 0
|
|
16077
|
+
},
|
|
16078
|
+
children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_8/* .Agent.Text */.g.Text, {
|
|
16079
|
+
children: `Delivery ${out.delivery}; inspect codex bridge status for automatic reply delivery.`
|
|
16080
|
+
})
|
|
16081
|
+
});
|
|
16082
|
+
}
|
|
15385
16083
|
value = await deliver(input);
|
|
15386
16084
|
} catch (error) {
|
|
15387
|
-
value = (0,
|
|
16085
|
+
value = (0,_core_codex_contract_js__rspack_import_3/* .outcomeFromError */.DG)(error);
|
|
15388
16086
|
}
|
|
15389
16087
|
const text = value.exitCode === 0 ? `Sent to ${value.kind} ${value.name} (${value.id})${value.messageId ? ` message ${value.messageId}` : ''}; envelope ${value.envelopeId}` : value.error;
|
|
15390
|
-
return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(
|
|
16088
|
+
return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_8/* .Agent.Result */.g.Result, {
|
|
15391
16089
|
value: value,
|
|
15392
|
-
children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(
|
|
16090
|
+
children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_8/* .Agent.Text */.g.Text, {
|
|
15393
16091
|
children: text
|
|
15394
16092
|
})
|
|
15395
16093
|
});
|
|
@@ -15496,9 +16194,9 @@ async function thread({ input }) {
|
|
|
15496
16194
|
event: 'thread',
|
|
15497
16195
|
rootId: input.root
|
|
15498
16196
|
});
|
|
15499
|
-
return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_4/* .Agent.Result */.
|
|
16197
|
+
return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_4/* .Agent.Result */.g.Result, {
|
|
15500
16198
|
value: rooted,
|
|
15501
|
-
children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_4/* .Agent.Text */.
|
|
16199
|
+
children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_4/* .Agent.Text */.g.Text, {
|
|
15502
16200
|
children: (0,_core_format_js__rspack_import_5/* .formatTranscript */.oZ)(rooted, {
|
|
15503
16201
|
full: input.full
|
|
15504
16202
|
})
|
|
@@ -15528,9 +16226,9 @@ async function thread({ input }) {
|
|
|
15528
16226
|
const text = (0,_core_format_js__rspack_import_5/* .formatTranscript */.oZ)(selected, {
|
|
15529
16227
|
full: input.full
|
|
15530
16228
|
});
|
|
15531
|
-
return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_4/* .Agent.Result */.
|
|
16229
|
+
return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_4/* .Agent.Result */.g.Result, {
|
|
15532
16230
|
value: selected,
|
|
15533
|
-
children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_4/* .Agent.Text */.
|
|
16231
|
+
children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_4/* .Agent.Text */.g.Text, {
|
|
15534
16232
|
children: `${text}\n\ncursor: ${delta.cursor}${delta.gapReset ? ' (gap reset)' : ''}`
|
|
15535
16233
|
})
|
|
15536
16234
|
});
|
|
@@ -15540,9 +16238,9 @@ async function thread({ input }) {
|
|
|
15540
16238
|
disabled: input.noHistory,
|
|
15541
16239
|
event: 'thread'
|
|
15542
16240
|
});
|
|
15543
|
-
return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_4/* .Agent.Result */.
|
|
16241
|
+
return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_4/* .Agent.Result */.g.Result, {
|
|
15544
16242
|
value: out,
|
|
15545
|
-
children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_4/* .Agent.Text */.
|
|
16243
|
+
children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_4/* .Agent.Text */.g.Text, {
|
|
15546
16244
|
children: (0,_core_format_js__rspack_import_5/* .formatTranscript */.oZ)(out, {
|
|
15547
16245
|
full: input.full
|
|
15548
16246
|
})
|
|
@@ -15559,6 +16257,442 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
15559
16257
|
});
|
|
15560
16258
|
|
|
15561
16259
|
|
|
16260
|
+
},
|
|
16261
|
+
"./src/core/codex/routes.ts"(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
16262
|
+
/* import */ var zod__rspack_import_3 = __webpack_require__("./node_modules/zod/v4/classic/schemas.js");
|
|
16263
|
+
/* import */ var _codex_bridge_js__rspack_import_0 = __webpack_require__("./src/core/codex-bridge.js");
|
|
16264
|
+
/* import */ var _contract_js__rspack_import_1 = __webpack_require__("./src/core/codex/contract.js");
|
|
16265
|
+
/* import */ var _conversation_js__rspack_import_2 = __webpack_require__("./src/core/codex/conversation.js");
|
|
16266
|
+
|
|
16267
|
+
|
|
16268
|
+
|
|
16269
|
+
|
|
16270
|
+
const id = zod__rspack_import_3/* .string */.YjP().regex(/^[A-Za-z0-9_.:-]{1,128}$/);
|
|
16271
|
+
const observationFields = {
|
|
16272
|
+
expectedCwd: zod__rspack_import_3/* .string */.YjP().min(1).optional(),
|
|
16273
|
+
threadId: id,
|
|
16274
|
+
timeoutMs: zod__rspack_import_3/* .number */.aig().int().min(1).max(600000).optional()
|
|
16275
|
+
};
|
|
16276
|
+
const sendFields = {
|
|
16277
|
+
...observationFields,
|
|
16278
|
+
correlationId: id.optional(),
|
|
16279
|
+
envelope: zod__rspack_import_3/* .boolean */.zMY().optional(),
|
|
16280
|
+
hop: zod__rspack_import_3/* .number */.aig().int().min(0).optional(),
|
|
16281
|
+
replyTo: id.optional(),
|
|
16282
|
+
expectedTurnId: id.optional(),
|
|
16283
|
+
whenBusy: zod__rspack_import_3/* ["enum"] */.k5n([
|
|
16284
|
+
'reject',
|
|
16285
|
+
'queue',
|
|
16286
|
+
'steer'
|
|
16287
|
+
]).default('reject'),
|
|
16288
|
+
wait: zod__rspack_import_3/* .boolean */.zMY().default(false),
|
|
16289
|
+
maxOutputBytes: zod__rspack_import_3/* .number */.aig().int().min(1).max(4194304).optional()
|
|
16290
|
+
};
|
|
16291
|
+
const sendSchema = zod__rspack_import_3/* .object */.Ikc({
|
|
16292
|
+
...sendFields,
|
|
16293
|
+
message: zod__rspack_import_3/* .string */.YjP().min(1).max(4194304)
|
|
16294
|
+
}).strict();
|
|
16295
|
+
const waitSchema = zod__rspack_import_3/* .object */.Ikc({
|
|
16296
|
+
...observationFields,
|
|
16297
|
+
turnId: id,
|
|
16298
|
+
messageId: id.optional(),
|
|
16299
|
+
maxOutputBytes: zod__rspack_import_3/* .number */.aig().int().min(1).max(4194304).optional()
|
|
16300
|
+
}).strict();
|
|
16301
|
+
const watchSchema = zod__rspack_import_3/* .object */.Ikc({
|
|
16302
|
+
...observationFields,
|
|
16303
|
+
maxEvents: zod__rspack_import_3/* .number */.aig().int().min(1).max(500).default(100)
|
|
16304
|
+
}).strict();
|
|
16305
|
+
const threadsSchema = zod__rspack_import_3/* .object */.Ikc({
|
|
16306
|
+
limit: zod__rspack_import_3/* .number */.aig().int().min(1).max(200).default(20),
|
|
16307
|
+
cursor: zod__rspack_import_3/* .string */.YjP().min(1).max(4096).optional()
|
|
16308
|
+
}).strict();
|
|
16309
|
+
const resultSchema = zod__rspack_import_3/* .object */.Ikc({
|
|
16310
|
+
exitCode: zod__rspack_import_3/* .number */.aig().int().min(0).max(1),
|
|
16311
|
+
threadId: zod__rspack_import_3/* .string */.YjP().optional(),
|
|
16312
|
+
turnId: zod__rspack_import_3/* .string */.YjP().optional(),
|
|
16313
|
+
messageId: zod__rspack_import_3/* .string */.YjP().optional(),
|
|
16314
|
+
delivery: zod__rspack_import_3/* ["enum"] */.k5n([
|
|
16315
|
+
'accepted',
|
|
16316
|
+
'queued',
|
|
16317
|
+
'rejected',
|
|
16318
|
+
'unknown'
|
|
16319
|
+
]).optional(),
|
|
16320
|
+
execution: zod__rspack_import_3/* .object */.Ikc({
|
|
16321
|
+
state: zod__rspack_import_3/* ["enum"] */.k5n([
|
|
16322
|
+
'completed',
|
|
16323
|
+
'failed',
|
|
16324
|
+
'interrupted',
|
|
16325
|
+
'waiting-for-input',
|
|
16326
|
+
'timeout',
|
|
16327
|
+
'disconnected',
|
|
16328
|
+
'unknown'
|
|
16329
|
+
]),
|
|
16330
|
+
error: zod__rspack_import_3/* .unknown */.L5J().optional()
|
|
16331
|
+
}).optional(),
|
|
16332
|
+
reply: zod__rspack_import_3/* .object */.Ikc({
|
|
16333
|
+
text: zod__rspack_import_3/* .string */.YjP().max(4194304),
|
|
16334
|
+
items: zod__rspack_import_3/* .array */.YOg(zod__rspack_import_3/* .object */.Ikc({
|
|
16335
|
+
id: zod__rspack_import_3/* .string */.YjP(),
|
|
16336
|
+
type: zod__rspack_import_3/* .literal */.euz('agentMessage'),
|
|
16337
|
+
phase: zod__rspack_import_3/* ["enum"] */.k5n([
|
|
16338
|
+
'final_answer'
|
|
16339
|
+
]).nullable(),
|
|
16340
|
+
text: zod__rspack_import_3/* .string */.YjP().max(4194304)
|
|
16341
|
+
})).max(2000),
|
|
16342
|
+
truncated: zod__rspack_import_3/* .boolean */.zMY()
|
|
16343
|
+
}).optional(),
|
|
16344
|
+
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(),
|
|
16345
|
+
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(),
|
|
16346
|
+
reason: zod__rspack_import_3/* .string */.YjP().optional(),
|
|
16347
|
+
truncated: zod__rspack_import_3/* .boolean */.zMY().optional()
|
|
16348
|
+
}).passthrough();
|
|
16349
|
+
async function sendOperation(input, signal, progress, oneShot = false) {
|
|
16350
|
+
let envelope;
|
|
16351
|
+
let receipt;
|
|
16352
|
+
try {
|
|
16353
|
+
envelope = (0,_codex_bridge_js__rspack_import_0/* .buildEnvelope */.nq)(input);
|
|
16354
|
+
if (oneShot && !input.wait && input.whenBusy !== 'steer') {
|
|
16355
|
+
return await (0,_codex_bridge_js__rspack_import_0/* .sendToCodexThread */.ZS)(input.threadId, input.message, {
|
|
16356
|
+
envelope,
|
|
16357
|
+
whenBusy: input.whenBusy,
|
|
16358
|
+
expectedCwd: input.expectedCwd,
|
|
16359
|
+
signal
|
|
16360
|
+
});
|
|
16361
|
+
}
|
|
16362
|
+
await progress?.('Opening Codex conversation');
|
|
16363
|
+
const conversation = await (0,_conversation_js__rspack_import_2/* .openCodexConversation */.j)(input.threadId, {
|
|
16364
|
+
expectedCwd: input.expectedCwd,
|
|
16365
|
+
signal
|
|
16366
|
+
});
|
|
16367
|
+
try {
|
|
16368
|
+
receipt = await conversation.send(input.message, {
|
|
16369
|
+
envelope,
|
|
16370
|
+
whenBusy: input.whenBusy,
|
|
16371
|
+
expectedTurnId: input.expectedTurnId
|
|
16372
|
+
});
|
|
16373
|
+
if (!input.wait || receipt.delivery !== 'accepted' || !receipt.turnId) return receipt;
|
|
16374
|
+
await progress?.(`Accepted message ${receipt.messageId}; observing turn ${receipt.turnId}`);
|
|
16375
|
+
const result = await conversation.wait({
|
|
16376
|
+
turnId: receipt.turnId,
|
|
16377
|
+
messageId: receipt.messageId,
|
|
16378
|
+
timeoutMs: input.timeoutMs,
|
|
16379
|
+
maxOutputBytes: input.maxOutputBytes,
|
|
16380
|
+
signal
|
|
16381
|
+
});
|
|
16382
|
+
return {
|
|
16383
|
+
...receipt,
|
|
16384
|
+
execution: result.execution,
|
|
16385
|
+
reply: result.reply,
|
|
16386
|
+
interactions: result.interactions,
|
|
16387
|
+
exitCode: result.execution.state === 'completed' ? 0 : 1
|
|
16388
|
+
};
|
|
16389
|
+
} finally{
|
|
16390
|
+
await conversation.close();
|
|
16391
|
+
}
|
|
16392
|
+
} catch (error) {
|
|
16393
|
+
if (receipt?.delivery === 'accepted') return {
|
|
16394
|
+
...receipt,
|
|
16395
|
+
execution: {
|
|
16396
|
+
state: 'unknown',
|
|
16397
|
+
error: (0,_contract_js__rspack_import_1/* .outcomeFromError */.DG)(error).error
|
|
16398
|
+
},
|
|
16399
|
+
reply: {
|
|
16400
|
+
text: '',
|
|
16401
|
+
items: [],
|
|
16402
|
+
truncated: true
|
|
16403
|
+
},
|
|
16404
|
+
interactions: [],
|
|
16405
|
+
exitCode: 1
|
|
16406
|
+
};
|
|
16407
|
+
return {
|
|
16408
|
+
...(0,_contract_js__rspack_import_1/* .outcomeFromError */.DG)(error),
|
|
16409
|
+
threadId: input.threadId,
|
|
16410
|
+
...envelope ? {
|
|
16411
|
+
messageId: envelope.messageId,
|
|
16412
|
+
correlationId: envelope.correlationId,
|
|
16413
|
+
hop: envelope.hop
|
|
16414
|
+
} : {}
|
|
16415
|
+
};
|
|
16416
|
+
}
|
|
16417
|
+
}
|
|
16418
|
+
async function observeOperation(kind, input, signal, progress) {
|
|
16419
|
+
try {
|
|
16420
|
+
await progress?.(`Observing Codex thread ${input.threadId}`);
|
|
16421
|
+
const conversation = await (0,_conversation_js__rspack_import_2/* .openCodexConversation */.j)(input.threadId, {
|
|
16422
|
+
expectedCwd: input.expectedCwd,
|
|
16423
|
+
signal
|
|
16424
|
+
});
|
|
16425
|
+
try {
|
|
16426
|
+
if (kind === 'wait') {
|
|
16427
|
+
const result = await conversation.wait({
|
|
16428
|
+
...input,
|
|
16429
|
+
signal
|
|
16430
|
+
});
|
|
16431
|
+
return {
|
|
16432
|
+
...result,
|
|
16433
|
+
exitCode: result.execution.state === 'completed' ? 0 : 1
|
|
16434
|
+
};
|
|
16435
|
+
}
|
|
16436
|
+
const result = await conversation.watch({
|
|
16437
|
+
...input,
|
|
16438
|
+
signal
|
|
16439
|
+
});
|
|
16440
|
+
return {
|
|
16441
|
+
...result,
|
|
16442
|
+
exitCode: [
|
|
16443
|
+
'timeout',
|
|
16444
|
+
'event-limit'
|
|
16445
|
+
].includes(result.reason) ? 0 : 1
|
|
16446
|
+
};
|
|
16447
|
+
} finally{
|
|
16448
|
+
await conversation.close();
|
|
16449
|
+
}
|
|
16450
|
+
} catch (error) {
|
|
16451
|
+
return {
|
|
16452
|
+
...(0,_contract_js__rspack_import_1/* .outcomeFromError */.DG)(error),
|
|
16453
|
+
threadId: input.threadId,
|
|
16454
|
+
...'turnId' in input ? {
|
|
16455
|
+
turnId: input.turnId,
|
|
16456
|
+
messageId: input.messageId
|
|
16457
|
+
} : {}
|
|
16458
|
+
};
|
|
16459
|
+
}
|
|
16460
|
+
}
|
|
16461
|
+
async function threadsOperation(input) {
|
|
16462
|
+
try {
|
|
16463
|
+
return {
|
|
16464
|
+
...await listCodexThreads(input),
|
|
16465
|
+
exitCode: 0
|
|
16466
|
+
};
|
|
16467
|
+
} catch (error) {
|
|
16468
|
+
return outcomeFromError(error);
|
|
16469
|
+
}
|
|
16470
|
+
}
|
|
16471
|
+
function resultText(result) {
|
|
16472
|
+
if (result.execution && typeof result.execution === 'object' && 'state' in result.execution) return `Codex turn ${result.turnId}: ${result.execution.state}`;
|
|
16473
|
+
if (result.delivery === 'queued') return `Queued ${result.queuedSubmissionId} on busy Codex thread ${result.threadId}; message ${result.messageId}`;
|
|
16474
|
+
if (result.error) return String(result.error);
|
|
16475
|
+
if (result.delivery === 'accepted') return `Started turn ${result.turnId} (${result.turnStatus}) on Codex thread ${result.threadId}; message ${result.messageId}`;
|
|
16476
|
+
if (result.delivery) return `Codex delivery ${result.delivery} on thread ${result.threadId}`;
|
|
16477
|
+
if (result.reason) return `Codex observation: ${result.reason}`;
|
|
16478
|
+
if (Array.isArray(result.threads)) return `${result.threads.length} Codex threads`;
|
|
16479
|
+
return String(result.error ?? 'Codex observation complete');
|
|
16480
|
+
}
|
|
16481
|
+
|
|
16482
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
16483
|
+
D6: () => (resultText),
|
|
16484
|
+
UP: () => (sendOperation),
|
|
16485
|
+
gT: () => (observeOperation)
|
|
16486
|
+
}, {
|
|
16487
|
+
FD: resultSchema,
|
|
16488
|
+
R9: watchSchema,
|
|
16489
|
+
at: sendFields,
|
|
16490
|
+
jS: waitSchema
|
|
16491
|
+
});
|
|
16492
|
+
|
|
16493
|
+
|
|
16494
|
+
},
|
|
16495
|
+
"./src/core/grok-approval-routes.ts"(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
16496
|
+
/* import */ var zod__rspack_import_3 = __webpack_require__("./node_modules/zod/v4/classic/schemas.js");
|
|
16497
|
+
/* import */ var _gateway_js__rspack_import_0 = __webpack_require__("./src/core/gateway.js");
|
|
16498
|
+
/* import */ var _grok_approvals_js__rspack_import_1 = __webpack_require__("./src/core/grok-approvals.js");
|
|
16499
|
+
/* import */ var _gbot_js__rspack_import_2 = __webpack_require__("./src/gbot.ts");
|
|
16500
|
+
|
|
16501
|
+
|
|
16502
|
+
|
|
16503
|
+
|
|
16504
|
+
const listSchema = zod__rspack_import_3/* .strictObject */.rej({
|
|
16505
|
+
target: zod__rspack_import_3/* .string */.YjP().min(1).max(1024)
|
|
16506
|
+
});
|
|
16507
|
+
const respondSchema = _grok_approvals_js__rspack_import_1/* .grokApprovalResponseSchema */.T5;
|
|
16508
|
+
const resultSchema = zod__rspack_import_3/* .record */.g1P(zod__rspack_import_3/* .string */.YjP(), zod__rspack_import_3/* .json */.Pq9());
|
|
16509
|
+
const listOperation = (input)=>(0,_gbot_js__rspack_import_2/* .withRedactedErrors */.yF)(async ()=>(0,_gateway_js__rspack_import_0/* .listGrokApprovals */.MI)(await (0,_gateway_js__rspack_import_0/* .connectGateway */.Vq)(), listSchema.parse(input).target));
|
|
16510
|
+
const respondOperation = (input)=>(0,_gbot_js__rspack_import_2/* .withRedactedErrors */.yF)(async ()=>{
|
|
16511
|
+
const { target, ...response } = respondSchema.parse(input);
|
|
16512
|
+
return (0,_gateway_js__rspack_import_0/* .respondGrokApproval */.OR)(await (0,_gateway_js__rspack_import_0/* .connectGateway */.Vq)(), target, response);
|
|
16513
|
+
});
|
|
16514
|
+
|
|
16515
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
16516
|
+
}, {
|
|
16517
|
+
FD: resultSchema,
|
|
16518
|
+
cE: listSchema,
|
|
16519
|
+
gi: listOperation,
|
|
16520
|
+
lr: respondOperation,
|
|
16521
|
+
v1: respondSchema
|
|
16522
|
+
});
|
|
16523
|
+
|
|
16524
|
+
|
|
16525
|
+
},
|
|
16526
|
+
"./src/core/relay/routes.ts"(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
16527
|
+
/* import */ var _agent_bundle_runtime__rspack_import_4 = __webpack_require__("./node_modules/@agent-bundle/runtime/dist/40.js");
|
|
16528
|
+
/* import */ var zod__rspack_import_3 = __webpack_require__("./node_modules/zod/v4/classic/schemas.js");
|
|
16529
|
+
/* import */ var _managed_js__rspack_import_0 = __webpack_require__("./src/core/relay/managed.js");
|
|
16530
|
+
/* import */ var _gbot_js__rspack_import_1 = __webpack_require__("./src/gbot.ts");
|
|
16531
|
+
/* import */ var _codex_bridge_js__rspack_import_2 = __webpack_require__("./src/core/codex-bridge.js");
|
|
16532
|
+
|
|
16533
|
+
|
|
16534
|
+
|
|
16535
|
+
|
|
16536
|
+
|
|
16537
|
+
const id = zod__rspack_import_3/* .string */.YjP().min(1).max(128);
|
|
16538
|
+
const routeFields = {
|
|
16539
|
+
codexThreadId: id.optional(),
|
|
16540
|
+
expectedCwd: zod__rspack_import_3/* .string */.YjP().min(1).max(4096).optional(),
|
|
16541
|
+
bindingId: zod__rspack_import_3/* .string */.YjP().min(1).max(512).optional(),
|
|
16542
|
+
requestId: id.optional()
|
|
16543
|
+
};
|
|
16544
|
+
const grokSendSchema = zod__rspack_import_3/* .object */.Ikc({
|
|
16545
|
+
target: zod__rspack_import_3/* .string */.YjP().min(1),
|
|
16546
|
+
message: zod__rspack_import_3/* .string */.YjP().min(1),
|
|
16547
|
+
replyMode: zod__rspack_import_3/* ["enum"] */.k5n([
|
|
16548
|
+
"auto",
|
|
16549
|
+
"manual"
|
|
16550
|
+
]).optional(),
|
|
16551
|
+
hop: zod__rspack_import_3/* .number */.aig().int().min(0).optional(),
|
|
16552
|
+
correlationId: id.optional(),
|
|
16553
|
+
...routeFields
|
|
16554
|
+
}).strict();
|
|
16555
|
+
const bridgeStartSchema = zod__rspack_import_3/* .object */.Ikc({
|
|
16556
|
+
grokTarget: zod__rspack_import_3/* .string */.YjP().min(1),
|
|
16557
|
+
codexThreadId: id.optional(),
|
|
16558
|
+
expectedCwd: zod__rspack_import_3/* .string */.YjP().min(1).max(4096).optional(),
|
|
16559
|
+
busyPolicy: zod__rspack_import_3/* ["enum"] */.k5n([
|
|
16560
|
+
"steer",
|
|
16561
|
+
"reject"
|
|
16562
|
+
]).optional(),
|
|
16563
|
+
requestId: id.optional()
|
|
16564
|
+
}).strict();
|
|
16565
|
+
const bridgeStatusSchema = zod__rspack_import_3/* .object */.Ikc({
|
|
16566
|
+
bindingId: zod__rspack_import_3/* .string */.YjP().min(1).max(512).optional(),
|
|
16567
|
+
limit: zod__rspack_import_3/* .number */.aig().int().min(1).max(100).optional()
|
|
16568
|
+
}).strict();
|
|
16569
|
+
const bridgeStopSchema = zod__rspack_import_3/* .object */.Ikc({
|
|
16570
|
+
bindingId: zod__rspack_import_3/* .string */.YjP().min(1).max(512).optional(),
|
|
16571
|
+
all: zod__rspack_import_3/* .boolean */.zMY().optional(),
|
|
16572
|
+
worker: zod__rspack_import_3/* .boolean */.zMY().optional()
|
|
16573
|
+
}).strict().refine((x)=>!!x.bindingId || x.all === true || x.worker === true, "Specify bindingId, all or worker");
|
|
16574
|
+
const respondSchema = zod__rspack_import_3/* .object */.Ikc({
|
|
16575
|
+
interactionId: zod__rspack_import_3/* .string */.YjP().min(1).max(512),
|
|
16576
|
+
generation: id,
|
|
16577
|
+
threadId: id,
|
|
16578
|
+
turnId: id,
|
|
16579
|
+
bindingId: zod__rspack_import_3/* .string */.YjP().min(1).max(512).optional(),
|
|
16580
|
+
exchangeId: zod__rspack_import_3/* .string */.YjP().min(1).max(512).optional(),
|
|
16581
|
+
decision: zod__rspack_import_3/* ["enum"] */.k5n([
|
|
16582
|
+
"accept",
|
|
16583
|
+
"decline",
|
|
16584
|
+
"cancel"
|
|
16585
|
+
]).optional(),
|
|
16586
|
+
answersJson: zod__rspack_import_3/* .string */.YjP().min(2).max(65536).optional()
|
|
16587
|
+
}).strict().refine((x)=>!!x.bindingId || !!x.exchangeId, "Binding or exchange scope required").refine((x)=>!!x.decision !== !!x.answersJson, "Supply decision or answersJson");
|
|
16588
|
+
const answersSchema = zod__rspack_import_3/* .record */.g1P(zod__rspack_import_3/* .string */.YjP().min(1).max(128), zod__rspack_import_3/* .object */.Ikc({
|
|
16589
|
+
answers: zod__rspack_import_3/* .array */.YOg(zod__rspack_import_3/* .string */.YjP().max(8192)).max(20)
|
|
16590
|
+
}).strict());
|
|
16591
|
+
const relayResultSchema = zod__rspack_import_3/* .record */.g1P(zod__rspack_import_3/* .string */.YjP(), zod__rspack_import_3/* .json */.Pq9());
|
|
16592
|
+
function nativeCodexThread(context) {
|
|
16593
|
+
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;
|
|
16594
|
+
}
|
|
16595
|
+
function options(context) {
|
|
16596
|
+
return {
|
|
16597
|
+
pluginRoot: context?.plugin.state === "available" ? context.plugin.value.root : undefined,
|
|
16598
|
+
signal: context?.signal
|
|
16599
|
+
};
|
|
16600
|
+
}
|
|
16601
|
+
function destination(input, context) {
|
|
16602
|
+
const codexThreadId = input.codexThreadId ?? (context ? nativeCodexThread(context) : undefined);
|
|
16603
|
+
// Native workspace evidence belongs to the invocation, not the plugin installation directory.
|
|
16604
|
+
const workspace = context?.workspace;
|
|
16605
|
+
const expectedCwd = input.expectedCwd ?? (workspace?.state === "available" && workspace.source === "native" ? workspace.value.root : undefined);
|
|
16606
|
+
return {
|
|
16607
|
+
codexThreadId,
|
|
16608
|
+
expectedCwd
|
|
16609
|
+
};
|
|
16610
|
+
}
|
|
16611
|
+
async function grokSendOperation(input, context) {
|
|
16612
|
+
const route = destination(input, input.bindingId ? undefined : context);
|
|
16613
|
+
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", {
|
|
16614
|
+
grokTarget: input.target,
|
|
16615
|
+
message: input.message,
|
|
16616
|
+
hop: input.hop,
|
|
16617
|
+
correlationId: input.correlationId,
|
|
16618
|
+
...route,
|
|
16619
|
+
...input.bindingId ? {
|
|
16620
|
+
bindingId: input.bindingId
|
|
16621
|
+
} : {},
|
|
16622
|
+
...input.requestId ? {
|
|
16623
|
+
requestId: input.requestId
|
|
16624
|
+
} : {}
|
|
16625
|
+
}, options(context)));
|
|
16626
|
+
if (input.replyMode === "auto") throw Error("Automatic reply delivery requires a native Codex source, codexThreadId or bindingId");
|
|
16627
|
+
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;
|
|
16628
|
+
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));
|
|
16629
|
+
return {
|
|
16630
|
+
result: sent.result,
|
|
16631
|
+
target: (0,_gbot_js__rspack_import_1/* .summarizeTarget */.rW)(sent.target),
|
|
16632
|
+
delivery: sent.delivery === "accepted" ? "accepted" : "unknown",
|
|
16633
|
+
...sent.delivery === "accepted" && typeof sent.messageId === "string" ? {
|
|
16634
|
+
messageId: sent.messageId
|
|
16635
|
+
} : {},
|
|
16636
|
+
replyRoute: {
|
|
16637
|
+
mode: "manual",
|
|
16638
|
+
reason: input.replyMode === "manual" ? "requested" : "source-unavailable"
|
|
16639
|
+
}
|
|
16640
|
+
};
|
|
16641
|
+
}
|
|
16642
|
+
async function bridgeOperation(method, input, context) {
|
|
16643
|
+
let routed = method === "startBinding" ? {
|
|
16644
|
+
...input,
|
|
16645
|
+
...destination(input, context)
|
|
16646
|
+
} : input;
|
|
16647
|
+
if (method === "respond") {
|
|
16648
|
+
const { decision, answersJson, ...scope } = respondSchema.parse(input);
|
|
16649
|
+
routed = {
|
|
16650
|
+
...scope,
|
|
16651
|
+
result: decision ? {
|
|
16652
|
+
decision
|
|
16653
|
+
} : {
|
|
16654
|
+
answers: answersSchema.parse(JSON.parse(answersJson))
|
|
16655
|
+
}
|
|
16656
|
+
};
|
|
16657
|
+
}
|
|
16658
|
+
if (method === "startBinding" && !routed.codexThreadId) throw Error("Specify codexThreadId when native Codex source identity is unavailable");
|
|
16659
|
+
return (0,_gbot_js__rspack_import_1/* .withRedactedErrors */.yF)(()=>(0,_managed_js__rspack_import_0/* .managedOperation */.Bb)(method, routed, options(context)));
|
|
16660
|
+
}
|
|
16661
|
+
function assertManagedSendOptions(input) {
|
|
16662
|
+
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");
|
|
16663
|
+
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");
|
|
16664
|
+
}
|
|
16665
|
+
async function codexReturnOperation(input, context) {
|
|
16666
|
+
assertManagedSendOptions(input);
|
|
16667
|
+
if (input.whenBusy === "queue") throw Error("Managed relay supports steer or reject, not experimental queue");
|
|
16668
|
+
return (0,_gbot_js__rspack_import_1/* .withRedactedErrors */.yF)(()=>(0,_managed_js__rspack_import_0/* .managedOperation */.Bb)("sendToCodex", {
|
|
16669
|
+
grokTarget: input.replyToGrok,
|
|
16670
|
+
codexThreadId: input.threadId,
|
|
16671
|
+
expectedCwd: input.expectedCwd,
|
|
16672
|
+
bindingId: input.bindingId,
|
|
16673
|
+
message: input.message,
|
|
16674
|
+
requestId: input.requestId,
|
|
16675
|
+
busyPolicy: input.whenBusy,
|
|
16676
|
+
hop: input.hop,
|
|
16677
|
+
correlationId: input.correlationId
|
|
16678
|
+
}, options(context)));
|
|
16679
|
+
}
|
|
16680
|
+
|
|
16681
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
16682
|
+
MB: () => (assertManagedSendOptions),
|
|
16683
|
+
bv: () => (grokSendOperation),
|
|
16684
|
+
lt: () => (codexReturnOperation),
|
|
16685
|
+
n1: () => (bridgeOperation)
|
|
16686
|
+
}, {
|
|
16687
|
+
Ax: relayResultSchema,
|
|
16688
|
+
d5: bridgeStopSchema,
|
|
16689
|
+
np: bridgeStatusSchema,
|
|
16690
|
+
v1: respondSchema,
|
|
16691
|
+
xD: bridgeStartSchema,
|
|
16692
|
+
zK: routeFields
|
|
16693
|
+
});
|
|
16694
|
+
|
|
16695
|
+
|
|
15562
16696
|
},
|
|
15563
16697
|
"./src/gbot.ts"(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
15564
16698
|
/* import */ var zod__rspack_import_2 = __webpack_require__("./node_modules/zod/v4/classic/schemas.js");
|
|
@@ -15663,7 +16797,10 @@ const transcriptEntries = (transcript)=>{
|
|
|
15663
16797
|
};
|
|
15664
16798
|
|
|
15665
16799
|
__webpack_require__.d(__webpack_exports__, {
|
|
16800
|
+
LV: () => (/* reexport safe */ _core_gateway_js__rspack_import_0.LV),
|
|
16801
|
+
Vq: () => (/* reexport safe */ _core_gateway_js__rspack_import_0.Vq)
|
|
15666
16802
|
}, {
|
|
16803
|
+
rW: summarizeTarget,
|
|
15667
16804
|
yF: withRedactedErrors
|
|
15668
16805
|
});
|
|
15669
16806
|
|
|
@@ -15693,9 +16830,9 @@ module.exports = __rspack_external_node_fs_1b05aee1;
|
|
|
15693
16830
|
|
|
15694
16831
|
|
|
15695
16832
|
},
|
|
15696
|
-
"node:
|
|
16833
|
+
"node:fs/promises"(module) {
|
|
15697
16834
|
|
|
15698
|
-
module.exports =
|
|
16835
|
+
module.exports = __rspack_external_node_fs_promises_3b710708;
|
|
15699
16836
|
|
|
15700
16837
|
|
|
15701
16838
|
},
|
|
@@ -15722,6 +16859,12 @@ module.exports = __rspack_external_node_path_806ed179;
|
|
|
15722
16859
|
module.exports = __rspack_external_node_readline_d8f53bef;
|
|
15723
16860
|
|
|
15724
16861
|
|
|
16862
|
+
},
|
|
16863
|
+
"node:string_decoder"(module) {
|
|
16864
|
+
|
|
16865
|
+
module.exports = __rspack_external_node_string_decoder_69b9bd04;
|
|
16866
|
+
|
|
16867
|
+
|
|
15725
16868
|
},
|
|
15726
16869
|
"node:url"(module) {
|
|
15727
16870
|
|
|
@@ -15738,17 +16881,206 @@ module.exports = __rspack_external_node_worker_threads_28ca7740;
|
|
|
15738
16881
|
"async_hooks"(module) {
|
|
15739
16882
|
module.exports = __rspack_createRequire_require("async_hooks");
|
|
15740
16883
|
|
|
15741
|
-
},
|
|
15742
|
-
"crypto"(module) {
|
|
15743
|
-
module.exports = __rspack_createRequire_require("crypto");
|
|
16884
|
+
},
|
|
16885
|
+
"crypto"(module) {
|
|
16886
|
+
module.exports = __rspack_createRequire_require("crypto");
|
|
16887
|
+
|
|
16888
|
+
},
|
|
16889
|
+
"stream"(module) {
|
|
16890
|
+
module.exports = __rspack_createRequire_require("stream");
|
|
16891
|
+
|
|
16892
|
+
},
|
|
16893
|
+
"util"(module) {
|
|
16894
|
+
module.exports = __rspack_createRequire_require("util");
|
|
16895
|
+
|
|
16896
|
+
},
|
|
16897
|
+
"./node_modules/@agent-bundle/runtime/dist/40.js"(__unused_rspack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
16898
|
+
/* import */ var node_fs_promises__rspack_import_0 = __webpack_require__("node:fs/promises");
|
|
16899
|
+
|
|
16900
|
+
|
|
16901
|
+
const CODEX_ROLLOUT_HEAD_BYTES = 1048576;
|
|
16902
|
+
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;
|
|
16903
|
+
const codexThreadFromRolloutPath = (path)=>{
|
|
16904
|
+
if (void 0 === path) return;
|
|
16905
|
+
const match = ROLLOUT_BASENAME.exec(path);
|
|
16906
|
+
return match?.[1]?.toLowerCase();
|
|
16907
|
+
};
|
|
16908
|
+
const record = (value)=>null === value || 'object' != typeof value || Array.isArray(value) ? void 0 : value;
|
|
16909
|
+
const codex_rollout_text = (value)=>'string' == typeof value && '' !== value.trim() ? value : void 0;
|
|
16910
|
+
const parseCodexRolloutMeta = (head)=>{
|
|
16911
|
+
const newline = head.indexOf('\n');
|
|
16912
|
+
const line = (-1 === newline ? head : head.slice(0, newline)).trim();
|
|
16913
|
+
if ('' === line) return;
|
|
16914
|
+
let parsed;
|
|
16915
|
+
try {
|
|
16916
|
+
parsed = JSON.parse(line);
|
|
16917
|
+
} catch {
|
|
16918
|
+
return;
|
|
16919
|
+
}
|
|
16920
|
+
const item = record(parsed);
|
|
16921
|
+
if (item?.['type'] !== 'session_meta') return;
|
|
16922
|
+
const payload = record(item['payload']);
|
|
16923
|
+
const thread = codex_rollout_text(payload?.['id']);
|
|
16924
|
+
if (void 0 === payload || void 0 === thread) return;
|
|
16925
|
+
const root = codex_rollout_text(payload['session_id']);
|
|
16926
|
+
const source = record(payload['source']);
|
|
16927
|
+
const subagent = record(source?.['subagent']);
|
|
16928
|
+
if (void 0 === subagent) {
|
|
16929
|
+
const kind = codex_rollout_text(source?.['subagent']);
|
|
16930
|
+
return {
|
|
16931
|
+
...void 0 === kind ? {} : {
|
|
16932
|
+
subagentKind: kind
|
|
16933
|
+
},
|
|
16934
|
+
...void 0 === root ? {} : {
|
|
16935
|
+
root
|
|
16936
|
+
},
|
|
16937
|
+
thread
|
|
16938
|
+
};
|
|
16939
|
+
}
|
|
16940
|
+
const [subagentKind] = Object.keys(subagent);
|
|
16941
|
+
const spawn = record(subagent['thread_spawn']);
|
|
16942
|
+
const parent = codex_rollout_text(spawn?.['parent_thread_id']) ?? codex_rollout_text(payload['parent_thread_id']);
|
|
16943
|
+
const rawDepth = spawn?.['depth'];
|
|
16944
|
+
const depth = 'number' == typeof rawDepth && Number.isInteger(rawDepth) && rawDepth > 0 ? rawDepth : void 0;
|
|
16945
|
+
const agentPath = codex_rollout_text(spawn?.['agent_path']) ?? codex_rollout_text(payload['agent_path']);
|
|
16946
|
+
return {
|
|
16947
|
+
...void 0 === agentPath ? {} : {
|
|
16948
|
+
agentPath
|
|
16949
|
+
},
|
|
16950
|
+
...void 0 === depth ? {} : {
|
|
16951
|
+
depth
|
|
16952
|
+
},
|
|
16953
|
+
...void 0 === parent ? {} : {
|
|
16954
|
+
parent
|
|
16955
|
+
},
|
|
16956
|
+
...void 0 === root ? {} : {
|
|
16957
|
+
root
|
|
16958
|
+
},
|
|
16959
|
+
...void 0 === subagentKind ? {} : {
|
|
16960
|
+
subagentKind
|
|
16961
|
+
},
|
|
16962
|
+
thread
|
|
16963
|
+
};
|
|
16964
|
+
};
|
|
16965
|
+
const readCodexRolloutHead = async (path)=>{
|
|
16966
|
+
let handle;
|
|
16967
|
+
try {
|
|
16968
|
+
handle = await promises_open(path, 'r');
|
|
16969
|
+
const buffer = Buffer.allocUnsafe(CODEX_ROLLOUT_HEAD_BYTES);
|
|
16970
|
+
let filled = 0;
|
|
16971
|
+
while(filled < buffer.length){
|
|
16972
|
+
const { bytesRead } = await handle.read(buffer, filled, buffer.length - filled, filled);
|
|
16973
|
+
if (0 === bytesRead) break;
|
|
16974
|
+
const newline = buffer.subarray(filled, filled + bytesRead).indexOf(0x0a);
|
|
16975
|
+
if (-1 !== newline) {
|
|
16976
|
+
filled += newline;
|
|
16977
|
+
break;
|
|
16978
|
+
}
|
|
16979
|
+
filled += bytesRead;
|
|
16980
|
+
}
|
|
16981
|
+
return buffer.subarray(0, filled).toString('utf8');
|
|
16982
|
+
} catch {
|
|
16983
|
+
return;
|
|
16984
|
+
} finally{
|
|
16985
|
+
await handle?.close().catch(()=>void 0);
|
|
16986
|
+
}
|
|
16987
|
+
};
|
|
16988
|
+
const readCodexSpawnLineage = async (path, thread, read = readCodexRolloutHead)=>{
|
|
16989
|
+
if (void 0 === path) return;
|
|
16990
|
+
const head = await read(path);
|
|
16991
|
+
if (void 0 === head) return;
|
|
16992
|
+
const meta = parseCodexRolloutMeta(head);
|
|
16993
|
+
if (void 0 === meta || meta.thread !== thread || void 0 === meta.parent || void 0 === meta.depth) return;
|
|
16994
|
+
return {
|
|
16995
|
+
...meta,
|
|
16996
|
+
depth: meta.depth,
|
|
16997
|
+
parent: meta.parent
|
|
16998
|
+
};
|
|
16999
|
+
};
|
|
17000
|
+
const nativeString = (native, key)=>{
|
|
17001
|
+
const value = native[key];
|
|
17002
|
+
return 'string' == typeof value && '' !== value.trim() ? value : void 0;
|
|
17003
|
+
};
|
|
17004
|
+
const lineageHostFromClient = (clientName)=>{
|
|
17005
|
+
if (void 0 === clientName) return;
|
|
17006
|
+
if (clientName.startsWith('claude')) return 'claude';
|
|
17007
|
+
if (clientName.startsWith('codex')) return 'codex';
|
|
17008
|
+
if (clientName.startsWith('cursor')) return 'cursor';
|
|
17009
|
+
};
|
|
17010
|
+
const lineageCarrier = (host, native)=>{
|
|
17011
|
+
switch(host){
|
|
17012
|
+
case 'claude':
|
|
17013
|
+
return {
|
|
17014
|
+
conversation: nativeString(native, 'agent_id') ?? nativeString(native, 'session_id'),
|
|
17015
|
+
generation: nativeString(native, 'prompt_id'),
|
|
17016
|
+
root: nativeString(native, 'session_id')
|
|
17017
|
+
};
|
|
17018
|
+
case 'codex':
|
|
17019
|
+
return {
|
|
17020
|
+
conversation: nativeString(native, 'agent_id') ?? nativeString(native, 'session_id'),
|
|
17021
|
+
generation: nativeString(native, 'turn_id'),
|
|
17022
|
+
root: nativeString(native, 'session_id')
|
|
17023
|
+
};
|
|
17024
|
+
case 'cursor':
|
|
17025
|
+
return {
|
|
17026
|
+
conversation: nativeString(native, 'conversation_id') ?? nativeString(native, 'session_id'),
|
|
17027
|
+
generation: nativeString(native, 'generation_id'),
|
|
17028
|
+
root: void 0
|
|
17029
|
+
};
|
|
17030
|
+
default:
|
|
17031
|
+
{
|
|
17032
|
+
const unreachable = host;
|
|
17033
|
+
throw new Error(`Unhandled lineage host ${String(unreachable)}`);
|
|
17034
|
+
}
|
|
17035
|
+
}
|
|
17036
|
+
};
|
|
17037
|
+
const resolveNativeLineage = (host, native)=>{
|
|
17038
|
+
const carrier = lineageCarrier(host, native);
|
|
17039
|
+
if ('cursor' === host || void 0 === carrier.conversation || void 0 === carrier.root) return unavailable('no-shared-runtime');
|
|
17040
|
+
if (carrier.conversation !== carrier.root) return unavailable('no-shared-runtime');
|
|
17041
|
+
return available({
|
|
17042
|
+
conversation: carrier.root,
|
|
17043
|
+
depth: 0,
|
|
17044
|
+
...void 0 === carrier.generation ? {} : {
|
|
17045
|
+
generation: carrier.generation
|
|
17046
|
+
},
|
|
17047
|
+
resolution: 'native',
|
|
17048
|
+
root: carrier.root
|
|
17049
|
+
}, 'native');
|
|
17050
|
+
};
|
|
17051
|
+
const resolveStandaloneLineage = async (host, native, read)=>{
|
|
17052
|
+
const fromPayload = resolveNativeLineage(host, native);
|
|
17053
|
+
if ('codex' !== host || 'available' === fromPayload.state) return fromPayload;
|
|
17054
|
+
const carrier = lineageCarrier(host, native);
|
|
17055
|
+
if (void 0 === carrier.conversation || void 0 === carrier.root) return fromPayload;
|
|
17056
|
+
const ownRollout = 'SubagentStop' === nativeString(native, 'hook_event_name') ? nativeString(native, "agent_transcript_path") : nativeString(native, "transcript_path");
|
|
17057
|
+
const spawn = await readCodexSpawnLineage(ownRollout, carrier.conversation, read);
|
|
17058
|
+
if (void 0 === spawn) return fromPayload;
|
|
17059
|
+
const type = nativeString(native, 'agent_type');
|
|
17060
|
+
return available({
|
|
17061
|
+
conversation: carrier.conversation,
|
|
17062
|
+
depth: spawn.depth,
|
|
17063
|
+
...void 0 === carrier.generation ? {} : {
|
|
17064
|
+
generation: carrier.generation
|
|
17065
|
+
},
|
|
17066
|
+
parent: spawn.parent,
|
|
17067
|
+
resolution: "transcript",
|
|
17068
|
+
root: carrier.root,
|
|
17069
|
+
subagent: {
|
|
17070
|
+
id: carrier.conversation,
|
|
17071
|
+
...void 0 === type ? {} : {
|
|
17072
|
+
type
|
|
17073
|
+
}
|
|
17074
|
+
}
|
|
17075
|
+
}, 'derived');
|
|
17076
|
+
};
|
|
17077
|
+
|
|
15744
17078
|
|
|
15745
|
-
|
|
15746
|
-
|
|
15747
|
-
|
|
17079
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
17080
|
+
}, {
|
|
17081
|
+
bg: lineageHostFromClient
|
|
17082
|
+
});
|
|
15748
17083
|
|
|
15749
|
-
},
|
|
15750
|
-
"util"(module) {
|
|
15751
|
-
module.exports = __rspack_createRequire_require("util");
|
|
15752
17084
|
|
|
15753
17085
|
},
|
|
15754
17086
|
"./node_modules/@agent-bundle/runtime/dist/49.js"(__unused_rspack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
@@ -15878,50 +17210,11 @@ const Agent = Object.freeze({
|
|
|
15878
17210
|
Result: AgentResult,
|
|
15879
17211
|
Text: AgentText
|
|
15880
17212
|
});
|
|
15881
|
-
const Result = ({ children })=>createElement('agent-hook-result', null, children);
|
|
15882
|
-
const AdditionalContext = ({ children })=>createElement('agent-hook-additional-context', null, children);
|
|
15883
|
-
const Hook = (/* unused pure expression or super */ null && ({
|
|
15884
|
-
AdditionalContext: AdditionalContext,
|
|
15885
|
-
Result: Result
|
|
15886
|
-
}));
|
|
15887
|
-
const McpResult = ({ _meta, children, isError, structuredContent })=>createElement('mcp-result', {
|
|
15888
|
-
_meta,
|
|
15889
|
-
isError,
|
|
15890
|
-
structuredContent
|
|
15891
|
-
}, children);
|
|
15892
|
-
const McpText = ({ children })=>createElement('mcp-text', null, children);
|
|
15893
|
-
const McpImage = ({ data, mimeType })=>createElement('mcp-image', {
|
|
15894
|
-
data,
|
|
15895
|
-
mimeType
|
|
15896
|
-
});
|
|
15897
|
-
const McpAudio = ({ data, mimeType })=>createElement('mcp-audio', {
|
|
15898
|
-
data,
|
|
15899
|
-
mimeType
|
|
15900
|
-
});
|
|
15901
|
-
const McpResourceLink = ({ mimeType, name, uri })=>createElement('mcp-resource-link', {
|
|
15902
|
-
mimeType,
|
|
15903
|
-
name,
|
|
15904
|
-
uri
|
|
15905
|
-
});
|
|
15906
|
-
const McpEmbeddedResource = ({ blob, children, mimeType, text, uri })=>createElement('mcp-embedded-resource', {
|
|
15907
|
-
blob,
|
|
15908
|
-
mimeType,
|
|
15909
|
-
text,
|
|
15910
|
-
uri
|
|
15911
|
-
}, children);
|
|
15912
|
-
const Mcp = (/* unused pure expression or super */ null && ({
|
|
15913
|
-
Audio: McpAudio,
|
|
15914
|
-
EmbeddedResource: McpEmbeddedResource,
|
|
15915
|
-
Image: McpImage,
|
|
15916
|
-
ResourceLink: McpResourceLink,
|
|
15917
|
-
Result: McpResult,
|
|
15918
|
-
Text: McpText
|
|
15919
|
-
}));
|
|
15920
17213
|
|
|
15921
17214
|
|
|
15922
17215
|
__webpack_require__.d(__webpack_exports__, {
|
|
15923
17216
|
}, {
|
|
15924
|
-
|
|
17217
|
+
g: Agent
|
|
15925
17218
|
});
|
|
15926
17219
|
|
|
15927
17220
|
|
|
@@ -16228,6 +17521,7 @@ const providerRequest = ({ notices, state, ...axes })=>Object.freeze({
|
|
|
16228
17521
|
|
|
16229
17522
|
__webpack_require__.d(__webpack_exports__, {
|
|
16230
17523
|
}, {
|
|
17524
|
+
MA: agent,
|
|
16231
17525
|
hU: unavailable,
|
|
16232
17526
|
iC: runAgentRequest,
|
|
16233
17527
|
qC: available
|
|
@@ -17295,7 +18589,7 @@ function strictObject(shape, params) {
|
|
|
17295
18589
|
type: "object",
|
|
17296
18590
|
shape,
|
|
17297
18591
|
catchall: never(),
|
|
17298
|
-
...
|
|
18592
|
+
..._core_index_js__rspack_import_4/* .normalizeParams */.A2(params),
|
|
17299
18593
|
});
|
|
17300
18594
|
}
|
|
17301
18595
|
// looseObject
|
|
@@ -17921,6 +19215,7 @@ function preprocess(fn, schema) {
|
|
|
17921
19215
|
__webpack_require__.d(__webpack_exports__, {
|
|
17922
19216
|
Ikc: () => (object),
|
|
17923
19217
|
KCZ: () => (union),
|
|
19218
|
+
L5J: () => (unknown),
|
|
17924
19219
|
Pq9: () => (json),
|
|
17925
19220
|
YOg: () => (array),
|
|
17926
19221
|
YjP: () => (string),
|
|
@@ -17928,6 +19223,7 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
17928
19223
|
euz: () => (literal),
|
|
17929
19224
|
g1P: () => (record),
|
|
17930
19225
|
k5n: () => (_enum),
|
|
19226
|
+
rej: () => (strictObject),
|
|
17931
19227
|
zMY: () => (boolean)
|
|
17932
19228
|
});
|
|
17933
19229
|
|
|
@@ -26393,6 +27689,7 @@ function inspectGrokBotGatewaySession(options = {}) {
|
|
|
26393
27689
|
__webpack_require__.d(__webpack_exports__, {
|
|
26394
27690
|
Z2: () => (loadGrokBotGatewaySession),
|
|
26395
27691
|
ZN: () => (hasGrokBotGatewaySession),
|
|
27692
|
+
dQ: () => (grokBotGatewayDescriptorPath),
|
|
26396
27693
|
hd: () => (inspectGrokBotGatewaySession)
|
|
26397
27694
|
});
|
|
26398
27695
|
|
|
@@ -26405,7 +27702,7 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
26405
27702
|
/* import */ var node_os__rspack_import_3 = __webpack_require__("node:os");
|
|
26406
27703
|
/* import */ var node_path__rspack_import_4 = __webpack_require__("node:path");
|
|
26407
27704
|
/* import */ var node_child_process__rspack_import_5 = __webpack_require__("node:child_process");
|
|
26408
|
-
/* import */ var
|
|
27705
|
+
/* import */ var _package_json__rspack_import_6 = __webpack_require__("./package.json");
|
|
26409
27706
|
/* import */ var _codex_contract_js__rspack_import_7 = __webpack_require__("./src/core/codex/contract.js");
|
|
26410
27707
|
/* import */ var _desktop_shim_js__rspack_import_8 = __webpack_require__("./src/core/desktop-shim.js");
|
|
26411
27708
|
|
|
@@ -26431,10 +27728,12 @@ const WS_GUID = "258EAFA5-E914-47DA-95CA-C5AB0DC85B11";
|
|
|
26431
27728
|
const WS_MAX_HEADER_BYTES = 16 * 1024;
|
|
26432
27729
|
const WS_MAX_MESSAGE_BYTES = 4 * 1024 * 1024;
|
|
26433
27730
|
const WS_MAX_BUFFER_BYTES = 8 * 1024 * 1024;
|
|
27731
|
+
const WS_MAX_WRITE_BYTES = 8 * 1024 * 1024;
|
|
27732
|
+
const CODEX_MAX_REQUESTS = 128;
|
|
27733
|
+
const CODEX_MAX_LISTENERS = 128;
|
|
26434
27734
|
const textDecoder = new TextDecoder("utf-8", {
|
|
26435
27735
|
fatal: true
|
|
26436
27736
|
});
|
|
26437
|
-
const pkg = (0,node_module__rspack_import_6.createRequire)(import.meta.url)("../../package.json");
|
|
26438
27737
|
function codexSocketPath(env = process.env) {
|
|
26439
27738
|
// Explicit socket wins so status/send/queue agree with a shim-installed or
|
|
26440
27739
|
// operator-exported CODEX_APP_SERVER_SOCK; otherwise derive from CODEX_HOME.
|
|
@@ -26591,7 +27890,7 @@ function attachEnvelope(error, envelope) {
|
|
|
26591
27890
|
"correlationId",
|
|
26592
27891
|
"hop"
|
|
26593
27892
|
]){
|
|
26594
|
-
if (
|
|
27893
|
+
if (envelope?.[key] !== undefined) error[key] = envelope[key];
|
|
26595
27894
|
}
|
|
26596
27895
|
}
|
|
26597
27896
|
/** The route to the app-server is unavailable; `mode` is a stable machine-readable state. */ class CodexRouteError extends Error {
|
|
@@ -26638,16 +27937,44 @@ function isObject(value) {
|
|
|
26638
27937
|
}
|
|
26639
27938
|
/**
|
|
26640
27939
|
* Open a JSON-RPC session to the app-server over its Unix socket (WebSocket framing).
|
|
26641
|
-
* Server
|
|
26642
|
-
*
|
|
26643
|
-
*/ function connectCodexAppServer(path, { timeoutMs = 15000 } = {}) {
|
|
27940
|
+
* Server requests are observed without answering by default. Legacy one-shot
|
|
27941
|
+
* callers arm ownership-scoped refusals; persistent sessions respond explicitly.
|
|
27942
|
+
*/ function connectCodexAppServer(path, { timeoutMs = 15000, signal, onNotification, onServerRequest, onClose } = {}) {
|
|
26644
27943
|
return new Promise((resolve, reject)=>{
|
|
27944
|
+
if (!Number.isInteger(timeoutMs) || timeoutMs < 1 || timeoutMs > 2147483647) {
|
|
27945
|
+
throw new RangeError("timeoutMs must be an integer 1-2147483647");
|
|
27946
|
+
}
|
|
27947
|
+
for (const listener of [
|
|
27948
|
+
onNotification,
|
|
27949
|
+
onServerRequest,
|
|
27950
|
+
onClose
|
|
27951
|
+
]){
|
|
27952
|
+
if (listener !== undefined && typeof listener !== "function") throw new TypeError("Event listener must be a function");
|
|
27953
|
+
}
|
|
27954
|
+
if (signal !== undefined && !(signal instanceof AbortSignal)) throw new TypeError("signal must be an AbortSignal");
|
|
27955
|
+
if (signal?.aborted) throw new Error("Codex connection aborted", {
|
|
27956
|
+
cause: signal.reason
|
|
27957
|
+
});
|
|
26645
27958
|
const socket = (0,node_net__rspack_import_2.createConnection)({
|
|
26646
27959
|
path
|
|
26647
27960
|
});
|
|
26648
27961
|
const key = (0,node_crypto__rspack_import_0.randomBytes)(16).toString("base64");
|
|
26649
27962
|
const pending = new Map();
|
|
26650
27963
|
const refused = [];
|
|
27964
|
+
const serverRequests = new Map();
|
|
27965
|
+
const listeners = {
|
|
27966
|
+
notification: new Set(onNotification ? [
|
|
27967
|
+
onNotification
|
|
27968
|
+
] : []),
|
|
27969
|
+
serverRequest: new Set(onServerRequest ? [
|
|
27970
|
+
onServerRequest
|
|
27971
|
+
] : []),
|
|
27972
|
+
close: new Set(onClose ? [
|
|
27973
|
+
onClose
|
|
27974
|
+
] : [])
|
|
27975
|
+
};
|
|
27976
|
+
let closeError;
|
|
27977
|
+
let writeTimer;
|
|
26651
27978
|
let nextId = 1;
|
|
26652
27979
|
let buf = Buffer.alloc(0);
|
|
26653
27980
|
let upgraded = false;
|
|
@@ -26662,22 +27989,127 @@ function isObject(value) {
|
|
|
26662
27989
|
const failAll = (err)=>{
|
|
26663
27990
|
if (closed) return;
|
|
26664
27991
|
closed = true;
|
|
27992
|
+
closeError = err;
|
|
26665
27993
|
clearTimeout(handshakeTimer);
|
|
27994
|
+
clearTimeout(writeTimer);
|
|
27995
|
+
signal?.removeEventListener("abort", abort);
|
|
26666
27996
|
if (err && err.delivery == null) err.delivery = pending.size ? "unknown" : "rejected";
|
|
26667
27997
|
for (const { reject: rej } of pending.values())rej(err);
|
|
26668
27998
|
pending.clear();
|
|
27999
|
+
serverRequests.clear();
|
|
28000
|
+
client.deferred.length = 0;
|
|
28001
|
+
buf = Buffer.alloc(0);
|
|
28002
|
+
fragParts = [];
|
|
28003
|
+
fragBytes = 0;
|
|
28004
|
+
const closeListeners = [
|
|
28005
|
+
...listeners.close
|
|
28006
|
+
];
|
|
28007
|
+
for (const group of Object.values(listeners))group.clear();
|
|
26669
28008
|
try {
|
|
26670
28009
|
socket.destroy();
|
|
26671
28010
|
} catch {}
|
|
26672
28011
|
reject(err);
|
|
28012
|
+
for (const listener of closeListeners)invoke(listener, err, true);
|
|
28013
|
+
};
|
|
28014
|
+
// Observers execute synchronously to preserve order, but failures never escape
|
|
28015
|
+
// the socket callback. Rejected async callbacks use the same cleanup path.
|
|
28016
|
+
const invoke = (listener, message, closing = false)=>{
|
|
28017
|
+
const failed = (cause)=>{
|
|
28018
|
+
if (!closing) failAll(new Error("Codex event listener failed", {
|
|
28019
|
+
cause
|
|
28020
|
+
}));
|
|
28021
|
+
};
|
|
28022
|
+
try {
|
|
28023
|
+
const result = listener(message);
|
|
28024
|
+
if (result && typeof result.then === "function") Promise.resolve(result).catch(failed);
|
|
28025
|
+
} catch (err) {
|
|
28026
|
+
failed(err);
|
|
28027
|
+
}
|
|
28028
|
+
};
|
|
28029
|
+
const dispatch = (kind, message)=>{
|
|
28030
|
+
for (const listener of [
|
|
28031
|
+
...listeners[kind]
|
|
28032
|
+
]){
|
|
28033
|
+
if (closed) break;
|
|
28034
|
+
if (listeners[kind].has(listener)) invoke(listener, message);
|
|
28035
|
+
}
|
|
28036
|
+
};
|
|
28037
|
+
const subscribe = (kind, listener)=>{
|
|
28038
|
+
if (typeof listener !== "function") throw new TypeError("Event listener must be a function");
|
|
28039
|
+
if (closed) {
|
|
28040
|
+
if (kind === "close") invoke(listener, closeError, true);
|
|
28041
|
+
return ()=>{};
|
|
28042
|
+
}
|
|
28043
|
+
const group = listeners[kind];
|
|
28044
|
+
if (!group.has(listener) && group.size >= CODEX_MAX_LISTENERS) {
|
|
28045
|
+
const err = new Error("Codex listener limit exceeds " + CODEX_MAX_LISTENERS);
|
|
28046
|
+
failAll(err);
|
|
28047
|
+
throw err;
|
|
28048
|
+
}
|
|
28049
|
+
group.add(listener);
|
|
28050
|
+
return ()=>group.delete(listener);
|
|
26673
28051
|
};
|
|
28052
|
+
const abort = ()=>failAll(new Error("Codex connection aborted", {
|
|
28053
|
+
cause: signal.reason
|
|
28054
|
+
}));
|
|
26674
28055
|
const failProtocol = (detail)=>failAll(new Error("Codex app-server violated the WebSocket protocol: " + detail));
|
|
26675
28056
|
const write = (opcode, payload)=>{
|
|
26676
|
-
if (
|
|
28057
|
+
if (closed) throw closeError;
|
|
28058
|
+
const encodedBytes = payload.length + (payload.length < 126 ? 6 : payload.length < 65536 ? 8 : 14);
|
|
28059
|
+
if (socket.destroyed || encodedBytes + socket.writableLength > WS_MAX_WRITE_BYTES) {
|
|
28060
|
+
const err = new Error(socket.destroyed ? "Codex socket closed" : "Codex outbound write budget exceeds " + WS_MAX_WRITE_BYTES + " bytes");
|
|
28061
|
+
failAll(err);
|
|
28062
|
+
throw err;
|
|
28063
|
+
}
|
|
28064
|
+
try {
|
|
28065
|
+
if (!socket.write(encodeFrame(opcode, payload, (0,node_crypto__rspack_import_0.randomBytes)(4))) && !writeTimer) {
|
|
28066
|
+
// One absolute deadline for the whole backpressured interval: more
|
|
28067
|
+
// writes must not keep an unread socket alive indefinitely.
|
|
28068
|
+
writeTimer = setTimeout(()=>failAll(new Error("Codex outbound write did not drain within " + timeoutMs + "ms")), timeoutMs);
|
|
28069
|
+
writeTimer.unref();
|
|
28070
|
+
}
|
|
28071
|
+
} catch (err) {
|
|
28072
|
+
failAll(err);
|
|
28073
|
+
throw err;
|
|
28074
|
+
}
|
|
26677
28075
|
};
|
|
26678
28076
|
const sendJson = (obj)=>write(0x1, Buffer.from(JSON.stringify(obj)));
|
|
28077
|
+
const respondToRequest = (id, payload)=>{
|
|
28078
|
+
if (closed) throw closeError;
|
|
28079
|
+
if (!serverRequests.has(id)) throw new Error("Unknown or resolved server request: " + id);
|
|
28080
|
+
// Consume ownership before JSON.stringify can invoke caller-owned getters
|
|
28081
|
+
// or toJSON hooks. A failed serialization closes rather than restoring it.
|
|
28082
|
+
serverRequests.delete(id);
|
|
28083
|
+
client.deferred = client.deferred.filter((entry)=>entry.id !== id);
|
|
28084
|
+
try {
|
|
28085
|
+
sendJson({
|
|
28086
|
+
jsonrpc: "2.0",
|
|
28087
|
+
id,
|
|
28088
|
+
...payload
|
|
28089
|
+
});
|
|
28090
|
+
} catch (cause) {
|
|
28091
|
+
if (closed) throw closeError;
|
|
28092
|
+
const err = new Error("Codex server response serialization failed", {
|
|
28093
|
+
cause
|
|
28094
|
+
});
|
|
28095
|
+
failAll(err);
|
|
28096
|
+
throw err;
|
|
28097
|
+
}
|
|
28098
|
+
};
|
|
26679
28099
|
const client = {
|
|
26680
28100
|
refused,
|
|
28101
|
+
get closed () {
|
|
28102
|
+
return closed;
|
|
28103
|
+
},
|
|
28104
|
+
onNotification: (listener)=>subscribe("notification", listener),
|
|
28105
|
+
onServerRequest: (listener)=>subscribe("serverRequest", listener),
|
|
28106
|
+
onClose: (listener)=>subscribe("close", listener),
|
|
28107
|
+
respond: (id, result)=>respondToRequest(id, {
|
|
28108
|
+
result
|
|
28109
|
+
}),
|
|
28110
|
+
rejectRequest: (id, error)=>respondToRequest(id, {
|
|
28111
|
+
error
|
|
28112
|
+
}),
|
|
26681
28113
|
// Server-initiated requests are only *answered* once our own turn/start
|
|
26682
28114
|
// is in flight, and then only when they name our own thread/turn:
|
|
26683
28115
|
// anything earlier — or naming another thread or Desktop turn — belongs
|
|
@@ -26702,22 +28134,24 @@ function isObject(value) {
|
|
|
26702
28134
|
const params = entry.params && typeof entry.params === "object" && !Array.isArray(entry.params) ? entry.params : null;
|
|
26703
28135
|
const threadId = params ? params.threadId ?? params.thread_id : null;
|
|
26704
28136
|
const namedTurnId = params ? params.turnId ?? params.turn_id ?? (params.turn && params.turn.id) : null;
|
|
26705
|
-
if (threadId === client.expectedThreadId && namedTurnId === turnId) {
|
|
26706
|
-
entry.
|
|
26707
|
-
|
|
26708
|
-
|
|
26709
|
-
id: entry.id,
|
|
26710
|
-
error: {
|
|
26711
|
-
code: -32601,
|
|
26712
|
-
message: "gbot codex does not answer " + entry.method + "; configure approval_policy on the daemon"
|
|
26713
|
-
}
|
|
28137
|
+
if (threadId === client.expectedThreadId && namedTurnId === turnId && serverRequests.get(entry.id) === entry) {
|
|
28138
|
+
client.rejectRequest(entry.id, {
|
|
28139
|
+
code: -32601,
|
|
28140
|
+
message: "gbot codex does not answer " + entry.method + "; configure approval_policy on the daemon"
|
|
26714
28141
|
});
|
|
28142
|
+
entry.answered = true;
|
|
26715
28143
|
}
|
|
26716
28144
|
}
|
|
26717
28145
|
},
|
|
26718
28146
|
request (method, params) {
|
|
26719
|
-
const id = nextId++;
|
|
26720
28147
|
return new Promise((res, rej)=>{
|
|
28148
|
+
if (closed) return rej(closeError);
|
|
28149
|
+
if (pending.size >= CODEX_MAX_REQUESTS) {
|
|
28150
|
+
const err = new Error("Codex pending request limit exceeds " + CODEX_MAX_REQUESTS);
|
|
28151
|
+
failAll(err);
|
|
28152
|
+
return rej(err);
|
|
28153
|
+
}
|
|
28154
|
+
const id = nextId++;
|
|
26721
28155
|
const timer = setTimeout(()=>{
|
|
26722
28156
|
pending.delete(id);
|
|
26723
28157
|
rej(new Error("Codex app-server did not answer " + method + " within " + timeoutMs + "ms"));
|
|
@@ -26733,12 +28167,18 @@ function isObject(value) {
|
|
|
26733
28167
|
rej(e);
|
|
26734
28168
|
}
|
|
26735
28169
|
});
|
|
26736
|
-
|
|
26737
|
-
|
|
26738
|
-
|
|
26739
|
-
|
|
26740
|
-
|
|
26741
|
-
|
|
28170
|
+
try {
|
|
28171
|
+
sendJson({
|
|
28172
|
+
jsonrpc: "2.0",
|
|
28173
|
+
id,
|
|
28174
|
+
method,
|
|
28175
|
+
params
|
|
28176
|
+
});
|
|
28177
|
+
} catch (err) {
|
|
28178
|
+
const entry = pending.get(id);
|
|
28179
|
+
pending.delete(id);
|
|
28180
|
+
entry?.reject(err);
|
|
28181
|
+
}
|
|
26742
28182
|
});
|
|
26743
28183
|
},
|
|
26744
28184
|
notify (method, params) {
|
|
@@ -26750,34 +28190,34 @@ function isObject(value) {
|
|
|
26750
28190
|
},
|
|
26751
28191
|
close () {
|
|
26752
28192
|
if (closed) return;
|
|
26753
|
-
|
|
26754
|
-
|
|
26755
|
-
|
|
26756
|
-
|
|
26757
|
-
|
|
26758
|
-
|
|
26759
|
-
|
|
26760
|
-
|
|
26761
|
-
0x03,
|
|
26762
|
-
0xe8
|
|
26763
|
-
]));
|
|
26764
|
-
if (socket.destroyed) return;
|
|
26765
|
-
const forceDestroy = setTimeout(()=>{
|
|
26766
|
-
try {
|
|
26767
|
-
socket.destroy();
|
|
26768
|
-
} catch {}
|
|
26769
|
-
}, 1000);
|
|
26770
|
-
if (typeof forceDestroy.unref === "function") forceDestroy.unref();
|
|
26771
|
-
socket.end(()=>{
|
|
26772
|
-
clearTimeout(forceDestroy);
|
|
26773
|
-
try {
|
|
26774
|
-
socket.destroy();
|
|
26775
|
-
} catch {}
|
|
26776
|
-
});
|
|
28193
|
+
// Best effort protocol close; cleanup never depends on the peer reading it.
|
|
28194
|
+
try {
|
|
28195
|
+
if (upgraded) write(0x8, Buffer.from([
|
|
28196
|
+
0x03,
|
|
28197
|
+
0xe8
|
|
28198
|
+
]));
|
|
28199
|
+
} catch {}
|
|
28200
|
+
failAll(new Error("Codex client closed"));
|
|
26777
28201
|
}
|
|
26778
28202
|
};
|
|
28203
|
+
signal?.addEventListener("abort", abort, {
|
|
28204
|
+
once: true
|
|
28205
|
+
});
|
|
26779
28206
|
const onMessage = (msg)=>{
|
|
26780
28207
|
if (msg.id != null && msg.method) {
|
|
28208
|
+
if (serverRequests.has(msg.id)) return failProtocol("duplicate pending server request id");
|
|
28209
|
+
if (serverRequests.size >= CODEX_MAX_REQUESTS || refused.length >= CODEX_MAX_REQUESTS || client.deferred.length >= CODEX_MAX_REQUESTS) {
|
|
28210
|
+
return failAll(new Error("Codex remembered server request limit exceeds " + CODEX_MAX_REQUESTS));
|
|
28211
|
+
}
|
|
28212
|
+
const entry = {
|
|
28213
|
+
id: msg.id,
|
|
28214
|
+
method: msg.method,
|
|
28215
|
+
params: msg.params,
|
|
28216
|
+
answered: false
|
|
28217
|
+
};
|
|
28218
|
+
serverRequests.set(msg.id, entry);
|
|
28219
|
+
dispatch("serverRequest", msg);
|
|
28220
|
+
if (closed) return;
|
|
26781
28221
|
let answered = client.answerServerRequests;
|
|
26782
28222
|
let defer = false;
|
|
26783
28223
|
// Approval ownership: only answer requests for the turn gbot itself
|
|
@@ -26797,28 +28237,30 @@ function isObject(value) {
|
|
|
26797
28237
|
} else if (turnId !== client.expectedTurnId) answered = false;
|
|
26798
28238
|
} else answered = false;
|
|
26799
28239
|
}
|
|
26800
|
-
|
|
26801
|
-
|
|
26802
|
-
|
|
26803
|
-
params: msg.params,
|
|
26804
|
-
answered
|
|
26805
|
-
};
|
|
28240
|
+
answered = answered && serverRequests.has(msg.id);
|
|
28241
|
+
defer = defer && serverRequests.has(msg.id);
|
|
28242
|
+
entry.answered = answered;
|
|
26806
28243
|
refused.push(entry);
|
|
26807
28244
|
if (defer) {
|
|
26808
28245
|
client.deferred.push(entry);
|
|
26809
28246
|
return;
|
|
26810
28247
|
}
|
|
26811
28248
|
if (!answered) return;
|
|
26812
|
-
|
|
26813
|
-
|
|
26814
|
-
|
|
26815
|
-
error: {
|
|
26816
|
-
code: -32601,
|
|
26817
|
-
message: "gbot codex does not answer " + msg.method + "; configure approval_policy on the daemon"
|
|
26818
|
-
}
|
|
28249
|
+
client.rejectRequest(msg.id, {
|
|
28250
|
+
code: -32601,
|
|
28251
|
+
message: "gbot codex does not answer " + msg.method + "; configure approval_policy on the daemon"
|
|
26819
28252
|
});
|
|
26820
28253
|
return;
|
|
26821
28254
|
}
|
|
28255
|
+
if (msg.id == null && msg.method) {
|
|
28256
|
+
if (msg.method === "serverRequest/resolved") {
|
|
28257
|
+
const id = msg.params?.requestId;
|
|
28258
|
+
serverRequests.delete(id);
|
|
28259
|
+
client.deferred = client.deferred.filter((entry)=>entry.id !== id);
|
|
28260
|
+
}
|
|
28261
|
+
dispatch("notification", msg);
|
|
28262
|
+
return;
|
|
28263
|
+
}
|
|
26822
28264
|
if (msg.id == null || !pending.has(msg.id)) return;
|
|
26823
28265
|
const entry = pending.get(msg.id);
|
|
26824
28266
|
pending.delete(msg.id);
|
|
@@ -26844,12 +28286,21 @@ function isObject(value) {
|
|
|
26844
28286
|
failAll(new Error("Codex app-server sent a malformed message"));
|
|
26845
28287
|
return;
|
|
26846
28288
|
}
|
|
26847
|
-
|
|
28289
|
+
try {
|
|
28290
|
+
onMessage(msg);
|
|
28291
|
+
} catch (err) {
|
|
28292
|
+
failAll(err);
|
|
28293
|
+
}
|
|
26848
28294
|
};
|
|
28295
|
+
socket.on("drain", ()=>{
|
|
28296
|
+
clearTimeout(writeTimer);
|
|
28297
|
+
writeTimer = undefined;
|
|
28298
|
+
});
|
|
26849
28299
|
socket.once("error", (err)=>failAll(new Error("Could not connect to Codex app-server at " + path + ": " + err.message)));
|
|
26850
28300
|
socket.once("close", ()=>failAll(new Error("Codex app-server closed the connection")));
|
|
26851
28301
|
socket.once("connect", ()=>socket.write(upgradeRequest(key)));
|
|
26852
28302
|
socket.on("data", (chunk)=>{
|
|
28303
|
+
if (closed) return;
|
|
26853
28304
|
buf = Buffer.concat([
|
|
26854
28305
|
buf,
|
|
26855
28306
|
chunk
|
|
@@ -26869,7 +28320,7 @@ function isObject(value) {
|
|
|
26869
28320
|
clearTimeout(handshakeTimer);
|
|
26870
28321
|
resolve(client);
|
|
26871
28322
|
}
|
|
26872
|
-
|
|
28323
|
+
while(!closed){
|
|
26873
28324
|
const frame = decodeFrame(buf);
|
|
26874
28325
|
if (!frame) {
|
|
26875
28326
|
const claimed = peekFrameLength(buf);
|
|
@@ -26885,10 +28336,18 @@ function isObject(value) {
|
|
|
26885
28336
|
if (frame.masked) return failProtocol("server frames must not be masked");
|
|
26886
28337
|
if (frame.opcode >= 0x8) {
|
|
26887
28338
|
if (!frame.fin || frame.payload.length > 125) return failProtocol("bad control frame");
|
|
26888
|
-
if (frame.opcode === 0x9)
|
|
26889
|
-
|
|
26890
|
-
|
|
26891
|
-
|
|
28339
|
+
if (frame.opcode === 0x9) {
|
|
28340
|
+
try {
|
|
28341
|
+
write(0xa, frame.payload);
|
|
28342
|
+
} catch {
|
|
28343
|
+
return;
|
|
28344
|
+
}
|
|
28345
|
+
} else if (frame.opcode === 0x8) {
|
|
28346
|
+
try {
|
|
28347
|
+
write(0x8, frame.payload);
|
|
28348
|
+
} catch {
|
|
28349
|
+
return;
|
|
28350
|
+
}
|
|
26892
28351
|
failAll(new Error("Codex app-server closed the connection"));
|
|
26893
28352
|
}
|
|
26894
28353
|
continue; // pong and other control frames carry nothing for us
|
|
@@ -26944,12 +28403,12 @@ function appServerVersion(initResult) {
|
|
|
26944
28403
|
}
|
|
26945
28404
|
throw new CodexRouteError(unreachableMessage(path), "socket-absent");
|
|
26946
28405
|
}
|
|
26947
|
-
async function
|
|
28406
|
+
async function openCodexSession(env = process.env, { experimental = false, ...options } = {}) {
|
|
26948
28407
|
const path = codexSocketPath(env);
|
|
26949
28408
|
assertRoute(path);
|
|
26950
28409
|
let client;
|
|
26951
28410
|
try {
|
|
26952
|
-
client = await connectCodexAppServer(path);
|
|
28411
|
+
client = await connectCodexAppServer(path, options);
|
|
26953
28412
|
} catch (err) {
|
|
26954
28413
|
throw connectError(err, path);
|
|
26955
28414
|
}
|
|
@@ -26958,7 +28417,7 @@ async function openSession(env = process.env, { experimental = false } = {}) {
|
|
|
26958
28417
|
init = await client.request("initialize", {
|
|
26959
28418
|
clientInfo: {
|
|
26960
28419
|
name: "gbot",
|
|
26961
|
-
version:
|
|
28420
|
+
version: _package_json__rspack_import_6/* .version */.rE
|
|
26962
28421
|
},
|
|
26963
28422
|
...experimental ? {
|
|
26964
28423
|
capabilities: {
|
|
@@ -26974,13 +28433,19 @@ async function openSession(env = process.env, { experimental = false } = {}) {
|
|
|
26974
28433
|
client.close();
|
|
26975
28434
|
throw new CodexProtocolError("initialize", "result is not an object");
|
|
26976
28435
|
}
|
|
26977
|
-
|
|
28436
|
+
try {
|
|
28437
|
+
client.notify("initialized");
|
|
28438
|
+
} catch (err) {
|
|
28439
|
+
client.close();
|
|
28440
|
+
throw handshakeError(err);
|
|
28441
|
+
}
|
|
26978
28442
|
return {
|
|
26979
28443
|
client,
|
|
26980
28444
|
path,
|
|
26981
28445
|
init
|
|
26982
28446
|
};
|
|
26983
28447
|
}
|
|
28448
|
+
const openSession = openCodexSession;
|
|
26984
28449
|
const CODEX_VERSION_PROBE_TIMEOUT_MS = 3000;
|
|
26985
28450
|
/** Bounded `codex --version` probe: `{ version, probe }` where probe is ok | missing | timeout | error. */ function probeLocalCodexVersion(timeoutMs = CODEX_VERSION_PROBE_TIMEOUT_MS) {
|
|
26986
28451
|
const out = (0,node_child_process__rspack_import_5.spawnSync)("codex", [
|
|
@@ -27042,10 +28507,10 @@ function listDesktopProcesses(timeoutMs = DESKTOP_PROCESS_LIST_TIMEOUT_MS) {
|
|
|
27042
28507
|
const lines = Array.isArray(listProcesses) ? listProcesses : String(listProcesses ?? "").split(/\r?\n/);
|
|
27043
28508
|
for (const line of lines){
|
|
27044
28509
|
if (!/app-server/.test(line)) continue;
|
|
27045
|
-
// Desktop's bundled binary
|
|
28510
|
+
// Desktop's bundled binary only (Mac/Windows separators, optional .exe).
|
|
28511
|
+
// Do NOT match probe shells whose cmdline merely mentions ChatGPT.app +
|
|
28512
|
+
// app-server + codex-app-tools — that false-positives MATCH2 / Scout noise.
|
|
27046
28513
|
if (/ChatGPT\.app[\\/].*Resources[\\/]codex(\.exe)?(["'\s]|$)/.test(line)) return "private-stdio";
|
|
27047
|
-
// Same app-server line owned by ChatGPT.app carrying the app-tools override.
|
|
27048
|
-
if (/ChatGPT\.app/.test(line) && /(codex_app|mcp_servers\.codex_app|codex-app-tools)/.test(line)) return "private-stdio";
|
|
27049
28514
|
}
|
|
27050
28515
|
return "unknown";
|
|
27051
28516
|
}
|
|
@@ -27328,12 +28793,14 @@ function requireExperimental(env, what) {
|
|
|
27328
28793
|
reason: "experimental-disabled"
|
|
27329
28794
|
});
|
|
27330
28795
|
}
|
|
27331
|
-
function unsupportedOrRpc(err, method, threadId, envelope) {
|
|
28796
|
+
function unsupportedOrRpc(err, method, threadId, envelope, turnId) {
|
|
28797
|
+
const guarded = method === "turn/steer";
|
|
27332
28798
|
if (err instanceof CodexRpcError && err.rpc && err.rpc.code === -32601) {
|
|
27333
|
-
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.", {
|
|
28799
|
+
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."), {
|
|
27334
28800
|
delivery: "rejected",
|
|
27335
28801
|
reason: "unsupported",
|
|
27336
28802
|
threadId,
|
|
28803
|
+
turnId,
|
|
27337
28804
|
...envelope
|
|
27338
28805
|
});
|
|
27339
28806
|
}
|
|
@@ -27341,12 +28808,14 @@ function unsupportedOrRpc(err, method, threadId, envelope) {
|
|
|
27341
28808
|
delivery: "rejected",
|
|
27342
28809
|
reason: "rejected",
|
|
27343
28810
|
threadId,
|
|
28811
|
+
turnId,
|
|
27344
28812
|
...envelope
|
|
27345
28813
|
});
|
|
27346
|
-
return new CodexSendError("Lost the Codex " + method + " response for thread " + threadId + ": " + (err && err.message || err) + ". Delivery is unknown; list the queue before resending.", {
|
|
28814
|
+
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."), {
|
|
27347
28815
|
delivery: err && err.delivery || "unknown",
|
|
27348
28816
|
reason: "transport",
|
|
27349
28817
|
threadId,
|
|
28818
|
+
turnId,
|
|
27350
28819
|
...envelope
|
|
27351
28820
|
});
|
|
27352
28821
|
}
|
|
@@ -27385,30 +28854,70 @@ function unsupportedOrRpc(err, method, threadId, envelope) {
|
|
|
27385
28854
|
/**
|
|
27386
28855
|
* @param {string} threadId
|
|
27387
28856
|
* @param {string} text
|
|
27388
|
-
* @param {{ env?: NodeJS.ProcessEnv, envelope?: object, whenBusy?: "reject"|"queue" }} [opts]
|
|
28857
|
+
* @param {{ env?: NodeJS.ProcessEnv, envelope?: object, whenBusy?: "reject"|"queue"|"steer", session?: object, expectedTurnId?: string, expectedCwd?: string, signal?: AbortSignal }} [opts]
|
|
27389
28858
|
*/ async function sendToCodexThread(threadId, text, { env = process.env, envelope = buildEnvelope({
|
|
27390
28859
|
env
|
|
27391
|
-
}), whenBusy = "reject" } = {}) {
|
|
28860
|
+
}), whenBusy = "reject", session, expectedTurnId, expectedCwd, signal } = {}) {
|
|
27392
28861
|
try {
|
|
27393
28862
|
const receipt = await sendToCodexThreadInner(threadId, text, {
|
|
27394
28863
|
env,
|
|
27395
28864
|
envelope,
|
|
27396
|
-
whenBusy
|
|
28865
|
+
whenBusy,
|
|
28866
|
+
session,
|
|
28867
|
+
expectedTurnId,
|
|
28868
|
+
expectedCwd,
|
|
28869
|
+
signal
|
|
27397
28870
|
});
|
|
27398
28871
|
return (0,_codex_contract_js__rspack_import_7/* .outcomeFromReceipt */.Dz)(receipt);
|
|
27399
28872
|
} catch (err) {
|
|
27400
28873
|
// Every receipt names the message, including refusals that never reached the daemon.
|
|
27401
|
-
if (err
|
|
28874
|
+
if (err && typeof err === "object") {
|
|
28875
|
+
attachEnvelope(err, envelope);
|
|
28876
|
+
if (err.threadId === undefined) err.threadId = threadId;
|
|
28877
|
+
}
|
|
27402
28878
|
return (0,_codex_contract_js__rspack_import_7/* .outcomeFromError */.DG)(err);
|
|
27403
28879
|
}
|
|
27404
28880
|
}
|
|
27405
|
-
async function sendToCodexThreadInner(threadId, text, { env, envelope, whenBusy }) {
|
|
27406
|
-
if (
|
|
28881
|
+
async function sendToCodexThreadInner(threadId, text, { env, envelope, whenBusy, session, expectedTurnId, expectedCwd, signal }) {
|
|
28882
|
+
if (![
|
|
28883
|
+
"reject",
|
|
28884
|
+
"queue",
|
|
28885
|
+
...session ? [
|
|
28886
|
+
"steer"
|
|
28887
|
+
] : []
|
|
28888
|
+
].includes(whenBusy)) throw new RangeError("--when-busy must be reject, queue, or persistent steer");
|
|
28889
|
+
if (whenBusy === "steer" && (typeof expectedTurnId !== "string" || !ID_PATTERN.test(expectedTurnId))) throw new RangeError("steer requires expectedTurnId");
|
|
28890
|
+
if (typeof threadId !== "string" || !ID_PATTERN.test(threadId)) throw new RangeError("Invalid threadId");
|
|
28891
|
+
if (typeof text !== "string" || !text.trim() || Buffer.byteLength(text) > WS_MAX_MESSAGE_BYTES) throw new RangeError("Message must contain text within 4 MiB");
|
|
28892
|
+
if (!envelope || typeof envelope.messageId !== "string" || !ID_PATTERN.test(envelope.messageId)) throw new RangeError("Invalid envelope messageId");
|
|
28893
|
+
const validated = buildEnvelope({
|
|
28894
|
+
correlationId: envelope.correlationId,
|
|
28895
|
+
replyTo: envelope.replyTo,
|
|
28896
|
+
hop: envelope.hop,
|
|
28897
|
+
env
|
|
28898
|
+
});
|
|
28899
|
+
envelope = {
|
|
28900
|
+
...validated,
|
|
28901
|
+
messageId: envelope.messageId,
|
|
28902
|
+
header: Boolean(envelope.header)
|
|
28903
|
+
};
|
|
27407
28904
|
assertThreadAllowed(threadId, env);
|
|
27408
28905
|
if (whenBusy === "queue") requireExperimental(env, "--when-busy queue");
|
|
28906
|
+
if (signal !== undefined && !(signal instanceof AbortSignal)) throw new TypeError("signal must be an AbortSignal");
|
|
28907
|
+
const assertNotCancelled = ()=>{
|
|
28908
|
+
if (signal?.aborted) throw new CodexSendError("Codex submission cancelled before delivery", {
|
|
28909
|
+
delivery: "rejected",
|
|
28910
|
+
reason: "cancelled",
|
|
28911
|
+
threadId,
|
|
28912
|
+
turnId: whenBusy === "steer" ? expectedTurnId : undefined,
|
|
28913
|
+
...envelope
|
|
28914
|
+
});
|
|
28915
|
+
};
|
|
28916
|
+
assertNotCancelled();
|
|
27409
28917
|
const body = withEnvelopeHeader(text, envelope, env);
|
|
27410
|
-
const { client } = await openSession(env, {
|
|
27411
|
-
experimental: whenBusy === "queue"
|
|
28918
|
+
const { client } = session ?? await openSession(env, {
|
|
28919
|
+
experimental: whenBusy === "queue",
|
|
28920
|
+
signal
|
|
27412
28921
|
});
|
|
27413
28922
|
try {
|
|
27414
28923
|
let resumed;
|
|
@@ -27418,6 +28927,7 @@ async function sendToCodexThreadInner(threadId, text, { env, envelope, whenBusy
|
|
|
27418
28927
|
excludeTurns: true
|
|
27419
28928
|
});
|
|
27420
28929
|
} catch (err) {
|
|
28930
|
+
assertNotCancelled();
|
|
27421
28931
|
if (err instanceof CodexSendError) throw err;
|
|
27422
28932
|
throw new CodexSendError(explainSendError(err, threadId).message, {
|
|
27423
28933
|
delivery: err instanceof CodexRpcError ? "rejected" : err && err.delivery || "unknown",
|
|
@@ -27426,9 +28936,24 @@ async function sendToCodexThreadInner(threadId, text, { env, envelope, whenBusy
|
|
|
27426
28936
|
...envelope
|
|
27427
28937
|
});
|
|
27428
28938
|
}
|
|
28939
|
+
// A shared session stays connected when this conversation is cancelled.
|
|
28940
|
+
// Recheck after the last awaited preflight, before any submission request.
|
|
28941
|
+
assertNotCancelled();
|
|
27429
28942
|
if (!isObject(resumed) || !isObject(resumed.thread) || typeof resumed.thread.id !== "string") {
|
|
27430
28943
|
throw new CodexProtocolError("thread/resume", "missing `thread.id`");
|
|
27431
28944
|
}
|
|
28945
|
+
if (resumed.thread.id !== threadId) throw new CodexSendError("thread/resume returned a different thread ID", {
|
|
28946
|
+
delivery: "rejected",
|
|
28947
|
+
reason: "bad-response",
|
|
28948
|
+
threadId,
|
|
28949
|
+
...envelope
|
|
28950
|
+
});
|
|
28951
|
+
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", {
|
|
28952
|
+
delivery: "rejected",
|
|
28953
|
+
reason: "cwd-mismatch",
|
|
28954
|
+
threadId,
|
|
28955
|
+
...envelope
|
|
28956
|
+
});
|
|
27432
28957
|
const state = threadState(resumed, threadId);
|
|
27433
28958
|
const receiptBase = {
|
|
27434
28959
|
threadId: resumed.thread.id,
|
|
@@ -27453,6 +28978,38 @@ async function sendToCodexThreadInner(threadId, text, { env, envelope, whenBusy
|
|
|
27453
28978
|
...envelope
|
|
27454
28979
|
});
|
|
27455
28980
|
}
|
|
28981
|
+
if (whenBusy === "steer") {
|
|
28982
|
+
let steered;
|
|
28983
|
+
try {
|
|
28984
|
+
steered = await client.request("turn/steer", {
|
|
28985
|
+
threadId,
|
|
28986
|
+
expectedTurnId,
|
|
28987
|
+
clientUserMessageId: envelope.messageId,
|
|
28988
|
+
input: [
|
|
28989
|
+
{
|
|
28990
|
+
type: "text",
|
|
28991
|
+
text: body
|
|
28992
|
+
}
|
|
28993
|
+
]
|
|
28994
|
+
});
|
|
28995
|
+
} catch (err) {
|
|
28996
|
+
throw unsupportedOrRpc(err, "turn/steer", threadId, envelope, expectedTurnId);
|
|
28997
|
+
}
|
|
28998
|
+
if (typeof steered?.turnId !== "string" || steered.turnId !== expectedTurnId) {
|
|
28999
|
+
throw new CodexSendError("Malformed turn/steer acknowledgment", {
|
|
29000
|
+
delivery: "unknown",
|
|
29001
|
+
reason: "bad-response",
|
|
29002
|
+
threadId,
|
|
29003
|
+
turnId: expectedTurnId,
|
|
29004
|
+
...envelope
|
|
29005
|
+
});
|
|
29006
|
+
}
|
|
29007
|
+
return {
|
|
29008
|
+
delivery: "accepted",
|
|
29009
|
+
...receiptBase,
|
|
29010
|
+
turnId: steered.turnId
|
|
29011
|
+
};
|
|
29012
|
+
}
|
|
27456
29013
|
if (state.busy) {
|
|
27457
29014
|
let queued;
|
|
27458
29015
|
try {
|
|
@@ -27496,9 +29053,11 @@ async function sendToCodexThreadInner(threadId, text, { env, envelope, whenBusy
|
|
|
27496
29053
|
// that arrives before the acknowledgment supplies our turn id wait in
|
|
27497
29054
|
// client.deferred and are adopted only on a match. Requests missing
|
|
27498
29055
|
// thread or turn IDs remain unanswered because ownership is unknown.
|
|
27499
|
-
|
|
27500
|
-
|
|
27501
|
-
|
|
29056
|
+
if (!session) {
|
|
29057
|
+
client.expectedThreadId = threadId;
|
|
29058
|
+
client.expectedTurnId = null;
|
|
29059
|
+
client.answerServerRequests = true;
|
|
29060
|
+
}
|
|
27502
29061
|
let turn;
|
|
27503
29062
|
try {
|
|
27504
29063
|
turn = await client.request("turn/start", {
|
|
@@ -27533,7 +29092,7 @@ async function sendToCodexThreadInner(threadId, text, { env, envelope, whenBusy
|
|
|
27533
29092
|
...envelope
|
|
27534
29093
|
});
|
|
27535
29094
|
}
|
|
27536
|
-
client._adoptTurn(turnId);
|
|
29095
|
+
if (!session) client._adoptTurn(turnId);
|
|
27537
29096
|
const freshRefused = client.refused.slice(seenRefused).filter((r)=>{
|
|
27538
29097
|
if (!r.answered) return false;
|
|
27539
29098
|
const params = r.params && typeof r.params === "object" && !Array.isArray(r.params) ? r.params : null;
|
|
@@ -27562,18 +29121,22 @@ async function sendToCodexThreadInner(threadId, text, { env, envelope, whenBusy
|
|
|
27562
29121
|
turnStatus: turn.turn.status
|
|
27563
29122
|
};
|
|
27564
29123
|
} finally{
|
|
27565
|
-
client.close();
|
|
29124
|
+
if (!session) client.close();
|
|
27566
29125
|
}
|
|
27567
29126
|
}
|
|
27568
29127
|
|
|
27569
29128
|
__webpack_require__.d(__webpack_exports__, {
|
|
29129
|
+
$3: () => (assertThreadAllowed),
|
|
27570
29130
|
Bt: () => (listCodexQueue),
|
|
27571
29131
|
MU: () => (codexStatus),
|
|
27572
29132
|
Mr: () => (withEnvelopeHeader),
|
|
27573
29133
|
X$: () => (listCodexThreads),
|
|
27574
29134
|
ZS: () => (sendToCodexThread),
|
|
29135
|
+
e0: () => (experimentalEnabled),
|
|
29136
|
+
eC: () => (openCodexSession),
|
|
27575
29137
|
nq: () => (buildEnvelope),
|
|
27576
|
-
pF: () => (singleLine)
|
|
29138
|
+
pF: () => (singleLine),
|
|
29139
|
+
ql: () => (codexSocketPath)
|
|
27577
29140
|
});
|
|
27578
29141
|
|
|
27579
29142
|
|
|
@@ -27684,16 +29247,462 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
27684
29247
|
if (exitCode === 1 && base.error === undefined && base.reason === "approval-refused") {
|
|
27685
29248
|
base.error = typeof base.message === "string" ? base.message : "Codex refused one or more approvals.";
|
|
27686
29249
|
}
|
|
27687
|
-
return /** @type {CodexSendOutcome} */ {
|
|
27688
|
-
...base,
|
|
27689
|
-
exitCode
|
|
29250
|
+
return /** @type {CodexSendOutcome} */ {
|
|
29251
|
+
...base,
|
|
29252
|
+
exitCode
|
|
29253
|
+
};
|
|
29254
|
+
}
|
|
29255
|
+
|
|
29256
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
29257
|
+
AQ: () => (withStatusExitCode),
|
|
29258
|
+
DG: () => (outcomeFromError),
|
|
29259
|
+
Dz: () => (outcomeFromReceipt)
|
|
29260
|
+
});
|
|
29261
|
+
|
|
29262
|
+
|
|
29263
|
+
},
|
|
29264
|
+
"./src/core/codex/conversation.js"(__unused_rspack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
29265
|
+
/* import */ var _contract_js__rspack_import_0 = __webpack_require__("./src/core/codex/contract.js");
|
|
29266
|
+
/* import */ var node_fs__rspack_import_1 = __webpack_require__("node:fs");
|
|
29267
|
+
/* import */ var _codex_bridge_js__rspack_import_2 = __webpack_require__("./src/core/codex-bridge.js");
|
|
29268
|
+
|
|
29269
|
+
|
|
29270
|
+
|
|
29271
|
+
const ID = /^[A-Za-z0-9_.:-]{1,128}$/;
|
|
29272
|
+
const BUDGET = 4 * 1024 * 1024;
|
|
29273
|
+
function conversationId(value, name = 'threadId') {
|
|
29274
|
+
if (typeof value !== 'string' || !ID.test(value)) throw new RangeError(`${name} must be 1-128 identifier characters`);
|
|
29275
|
+
return value;
|
|
29276
|
+
}
|
|
29277
|
+
function boundedInteger(value, max, name) {
|
|
29278
|
+
if (!Number.isInteger(value) || value < 1 || value > max) throw new RangeError(`${name} must be an integer 1-${max}`);
|
|
29279
|
+
return value;
|
|
29280
|
+
}
|
|
29281
|
+
const terminal = (status)=>[
|
|
29282
|
+
'completed',
|
|
29283
|
+
'failed',
|
|
29284
|
+
'interrupted'
|
|
29285
|
+
].includes(status);
|
|
29286
|
+
const namedTurn = (p)=>p?.turnId ?? p?.turn_id ?? p?.turn?.id;
|
|
29287
|
+
/** 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 } = {}) {
|
|
29288
|
+
if (![
|
|
29289
|
+
'thread/turns/list',
|
|
29290
|
+
'thread/items/list'
|
|
29291
|
+
].includes(method)) throw new RangeError('Unsupported history method');
|
|
29292
|
+
conversationId(threadId);
|
|
29293
|
+
const client = session.client;
|
|
29294
|
+
let cursor;
|
|
29295
|
+
const seen = new Set();
|
|
29296
|
+
for(let page = 0; page < 20; page++){
|
|
29297
|
+
if (stopped() || signal?.aborted) throw new Error('History coverage incomplete: observation cancelled');
|
|
29298
|
+
const result = await client.request(method, {
|
|
29299
|
+
...params,
|
|
29300
|
+
threadId,
|
|
29301
|
+
limit: 100,
|
|
29302
|
+
...cursor ? {
|
|
29303
|
+
cursor
|
|
29304
|
+
} : {}
|
|
29305
|
+
});
|
|
29306
|
+
if (stopped() || signal?.aborted) throw new Error('History coverage incomplete: observation cancelled');
|
|
29307
|
+
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`);
|
|
29308
|
+
if (visit(result.data)) return {
|
|
29309
|
+
complete: false,
|
|
29310
|
+
reason: 'matched',
|
|
29311
|
+
pages: page + 1
|
|
29312
|
+
};
|
|
29313
|
+
if (result.nextCursor == null) return {
|
|
29314
|
+
complete: true,
|
|
29315
|
+
reason: 'exhausted',
|
|
29316
|
+
pages: page + 1
|
|
29317
|
+
};
|
|
29318
|
+
if (seen.has(result.nextCursor)) throw new Error('History coverage incomplete: repeated pagination cursor');
|
|
29319
|
+
seen.add(result.nextCursor);
|
|
29320
|
+
cursor = result.nextCursor;
|
|
29321
|
+
}
|
|
29322
|
+
throw new Error('History coverage incomplete: 20 page limit');
|
|
29323
|
+
}
|
|
29324
|
+
/** A bounded observer. Cancellation ends observation, never the daemon's turn. */ async function openCodexConversation(threadId, options = {}) {
|
|
29325
|
+
conversationId(threadId);
|
|
29326
|
+
const { env = process.env, expectedCwd, signal, onEvent } = options;
|
|
29327
|
+
(0,_codex_bridge_js__rspack_import_2/* .assertThreadAllowed */.$3)(threadId, env);
|
|
29328
|
+
if (signal !== undefined && !(signal instanceof AbortSignal)) throw new TypeError('signal must be an AbortSignal');
|
|
29329
|
+
if (onEvent !== undefined && typeof onEvent !== 'function') throw new TypeError('onEvent must be a function');
|
|
29330
|
+
if (signal?.aborted) throw new Error('Observation cancelled');
|
|
29331
|
+
const expected = expectedCwd === undefined ? undefined : (0,node_fs__rspack_import_1.realpathSync)(expectedCwd);
|
|
29332
|
+
const session = options.session ?? await (0,_codex_bridge_js__rspack_import_2/* .openCodexSession */.eC)(env, {
|
|
29333
|
+
signal,
|
|
29334
|
+
experimental: (0,_codex_bridge_js__rspack_import_2/* .experimentalEnabled */.e0)(env)
|
|
29335
|
+
});
|
|
29336
|
+
const { client } = session;
|
|
29337
|
+
const events = [];
|
|
29338
|
+
const acceptedTurns = new Set();
|
|
29339
|
+
const wake = new Set();
|
|
29340
|
+
let bytes = 0, overflow = false, disconnected = client.closed, closed = false;
|
|
29341
|
+
const record = (event)=>{
|
|
29342
|
+
const size = Buffer.byteLength(JSON.stringify(event));
|
|
29343
|
+
if (size > BUDGET) {
|
|
29344
|
+
overflow = true;
|
|
29345
|
+
} else {
|
|
29346
|
+
while(events.length >= 500 || bytes + size > BUDGET){
|
|
29347
|
+
bytes -= events.shift().bytes;
|
|
29348
|
+
overflow = true;
|
|
29349
|
+
}
|
|
29350
|
+
events.push({
|
|
29351
|
+
event,
|
|
29352
|
+
bytes: size
|
|
29353
|
+
});
|
|
29354
|
+
bytes += size;
|
|
29355
|
+
}
|
|
29356
|
+
for (const listener of [
|
|
29357
|
+
...wake
|
|
29358
|
+
])listener();
|
|
29359
|
+
return onEvent?.(event);
|
|
29360
|
+
};
|
|
29361
|
+
const observe = (kind)=>(message)=>{
|
|
29362
|
+
const p = message.params;
|
|
29363
|
+
if ((p?.threadId ?? p?.thread_id) !== threadId) return;
|
|
29364
|
+
return record({
|
|
29365
|
+
kind,
|
|
29366
|
+
...message
|
|
29367
|
+
});
|
|
29368
|
+
};
|
|
29369
|
+
const unsubs = [
|
|
29370
|
+
client.onNotification(observe('notification')),
|
|
29371
|
+
client.onServerRequest(observe('interaction')),
|
|
29372
|
+
client.onClose((error)=>{
|
|
29373
|
+
disconnected = true;
|
|
29374
|
+
return record({
|
|
29375
|
+
kind: 'disconnect',
|
|
29376
|
+
error: error?.message
|
|
29377
|
+
});
|
|
29378
|
+
})
|
|
29379
|
+
];
|
|
29380
|
+
const close = async ()=>{
|
|
29381
|
+
if (closed) return;
|
|
29382
|
+
closed = true;
|
|
29383
|
+
for (const unsubscribe of unsubs)unsubscribe();
|
|
29384
|
+
for (const listener of wake)listener();
|
|
29385
|
+
if (!options.session) client.close();
|
|
29386
|
+
};
|
|
29387
|
+
let resumed;
|
|
29388
|
+
try {
|
|
29389
|
+
resumed = await client.request('thread/resume', {
|
|
29390
|
+
threadId,
|
|
29391
|
+
excludeTurns: true
|
|
29392
|
+
});
|
|
29393
|
+
if (resumed?.thread?.id !== threadId) throw new Error('thread/resume returned a different thread ID');
|
|
29394
|
+
const cwd = resumed.cwd ?? resumed.thread.cwd;
|
|
29395
|
+
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');
|
|
29396
|
+
} catch (error) {
|
|
29397
|
+
await close();
|
|
29398
|
+
throw error;
|
|
29399
|
+
}
|
|
29400
|
+
/** @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 }) {
|
|
29401
|
+
conversationId(turnId, 'turnId');
|
|
29402
|
+
if (messageId !== undefined) conversationId(messageId, 'messageId');
|
|
29403
|
+
const anchors = afterMessageId === undefined ? [] : Array.isArray(afterMessageId) ? afterMessageId : [
|
|
29404
|
+
afterMessageId
|
|
29405
|
+
];
|
|
29406
|
+
if (afterMessageId !== undefined) boundedInteger(anchors.length, 200, 'afterMessageId count');
|
|
29407
|
+
for (const anchor of anchors)conversationId(anchor, 'afterMessageId');
|
|
29408
|
+
boundedInteger(timeoutMs, 600000, 'timeoutMs');
|
|
29409
|
+
boundedInteger(maxOutputBytes, BUDGET, 'maxOutputBytes');
|
|
29410
|
+
if (waitSignal !== undefined && !(waitSignal instanceof AbortSignal)) throw new TypeError('signal must be an AbortSignal');
|
|
29411
|
+
let done = false, status = acceptedTurns.has(turnId) ? 'inProgress' : undefined, error, historyError, itemBytes = 0, truncated = overflow;
|
|
29412
|
+
const items = new Map();
|
|
29413
|
+
const add = (item)=>{
|
|
29414
|
+
if (!item || typeof item.id !== 'string' || typeof item.type !== 'string') throw new Error('Invalid history item');
|
|
29415
|
+
if (item.type !== 'agentMessage' || typeof item.text !== 'string' || item.phase !== 'final_answer' && item.phase != null) return;
|
|
29416
|
+
const normalized = {
|
|
29417
|
+
id: item.id,
|
|
29418
|
+
type: item.type,
|
|
29419
|
+
phase: item.phase ?? null,
|
|
29420
|
+
text: item.text
|
|
29421
|
+
};
|
|
29422
|
+
const size = Buffer.byteLength(JSON.stringify(normalized));
|
|
29423
|
+
const prior = items.get(item.id);
|
|
29424
|
+
if (itemBytes - (prior?.bytes ?? 0) + size > BUDGET || !prior && items.size >= 2000) {
|
|
29425
|
+
truncated = true;
|
|
29426
|
+
return;
|
|
29427
|
+
}
|
|
29428
|
+
itemBytes += size - (prior?.bytes ?? 0);
|
|
29429
|
+
items.set(item.id, {
|
|
29430
|
+
item: normalized,
|
|
29431
|
+
bytes: size
|
|
29432
|
+
});
|
|
29433
|
+
};
|
|
29434
|
+
const scan = ()=>{
|
|
29435
|
+
const interactions = new Map();
|
|
29436
|
+
for (const { event } of events){
|
|
29437
|
+
const p = event.params;
|
|
29438
|
+
if (event.method === 'serverRequest/resolved') {
|
|
29439
|
+
interactions.delete(p.requestId);
|
|
29440
|
+
continue;
|
|
29441
|
+
}
|
|
29442
|
+
if (namedTurn(p) !== turnId) continue;
|
|
29443
|
+
if (event.kind === 'interaction') interactions.set(event.id, event);
|
|
29444
|
+
if (event.method === 'turn/started' && !terminal(status)) status = p.turn?.status;
|
|
29445
|
+
if (event.method === 'item/completed' && afterMessageId === undefined) add(p.item);
|
|
29446
|
+
if (event.method === 'turn/completed') {
|
|
29447
|
+
status = p.turn?.status;
|
|
29448
|
+
error = p.turn?.error;
|
|
29449
|
+
if (afterMessageId === undefined) for (const item of p.turn?.items ?? [])add(item);
|
|
29450
|
+
}
|
|
29451
|
+
}
|
|
29452
|
+
return [
|
|
29453
|
+
...interactions.values()
|
|
29454
|
+
];
|
|
29455
|
+
};
|
|
29456
|
+
const result = (state, detail)=>{
|
|
29457
|
+
const interactions = scan();
|
|
29458
|
+
const candidates = [
|
|
29459
|
+
...items.values()
|
|
29460
|
+
].map((x)=>x.item);
|
|
29461
|
+
const finals = candidates.filter((i)=>i.phase === 'final_answer');
|
|
29462
|
+
// Old app-servers omit phase; use their completed agent items only at terminal status.
|
|
29463
|
+
const selected = finals.length ? finals : terminal(state) ? candidates : [];
|
|
29464
|
+
const reply = {
|
|
29465
|
+
text: '',
|
|
29466
|
+
items: [],
|
|
29467
|
+
truncated: truncated || overflow
|
|
29468
|
+
};
|
|
29469
|
+
for (const item of selected){
|
|
29470
|
+
const text = reply.text ? `${reply.text}\n${item.text}` : item.text;
|
|
29471
|
+
if (Buffer.byteLength(JSON.stringify({
|
|
29472
|
+
text,
|
|
29473
|
+
items: [
|
|
29474
|
+
...reply.items,
|
|
29475
|
+
item
|
|
29476
|
+
]
|
|
29477
|
+
})) > maxOutputBytes) {
|
|
29478
|
+
reply.truncated = true;
|
|
29479
|
+
break;
|
|
29480
|
+
}
|
|
29481
|
+
reply.text = text;
|
|
29482
|
+
reply.items.push(item);
|
|
29483
|
+
}
|
|
29484
|
+
return {
|
|
29485
|
+
threadId,
|
|
29486
|
+
turnId,
|
|
29487
|
+
...messageId === undefined ? {} : {
|
|
29488
|
+
messageId
|
|
29489
|
+
},
|
|
29490
|
+
execution: {
|
|
29491
|
+
state,
|
|
29492
|
+
...detail ? {
|
|
29493
|
+
error: detail
|
|
29494
|
+
} : {}
|
|
29495
|
+
},
|
|
29496
|
+
reply,
|
|
29497
|
+
interactions
|
|
29498
|
+
};
|
|
29499
|
+
};
|
|
29500
|
+
let timer, notify;
|
|
29501
|
+
const abortSignals = [
|
|
29502
|
+
signal,
|
|
29503
|
+
waitSignal
|
|
29504
|
+
].filter(Boolean);
|
|
29505
|
+
const stopped = new Promise((resolve)=>{
|
|
29506
|
+
notify = ()=>{
|
|
29507
|
+
if (abortSignals.some((s)=>s.aborted) || closed) resolve([
|
|
29508
|
+
'unknown',
|
|
29509
|
+
'Observation cancelled'
|
|
29510
|
+
]);
|
|
29511
|
+
else if (disconnected) resolve([
|
|
29512
|
+
'disconnected',
|
|
29513
|
+
'Codex connection closed'
|
|
29514
|
+
]);
|
|
29515
|
+
};
|
|
29516
|
+
timer = setTimeout(()=>resolve([
|
|
29517
|
+
'timeout',
|
|
29518
|
+
'Observation deadline reached'
|
|
29519
|
+
]), timeoutMs);
|
|
29520
|
+
for (const s of abortSignals)s.addEventListener('abort', notify, {
|
|
29521
|
+
once: true
|
|
29522
|
+
});
|
|
29523
|
+
wake.add(notify);
|
|
29524
|
+
notify();
|
|
29525
|
+
});
|
|
29526
|
+
const collect = async ()=>{
|
|
29527
|
+
scan();
|
|
29528
|
+
try {
|
|
29529
|
+
let found = false, historyTerminal = false, anchorFound = afterMessageId === undefined;
|
|
29530
|
+
const missingAnchors = new Set(anchors);
|
|
29531
|
+
await visitCodexHistory(session, threadId, 'thread/turns/list', {}, (data)=>{
|
|
29532
|
+
for (const turn of data)if (!turn || typeof turn.id !== 'string' || typeof turn.status !== 'string') throw new Error('Invalid turn history');
|
|
29533
|
+
const turn = data.find((t)=>t.id === turnId);
|
|
29534
|
+
if (!turn) return false;
|
|
29535
|
+
found = true;
|
|
29536
|
+
historyTerminal = terminal(turn.status);
|
|
29537
|
+
if (!terminal(status)) {
|
|
29538
|
+
status = turn.status;
|
|
29539
|
+
error = turn.error;
|
|
29540
|
+
}
|
|
29541
|
+
return true;
|
|
29542
|
+
}, {
|
|
29543
|
+
stopped: ()=>done
|
|
29544
|
+
});
|
|
29545
|
+
// Notifications can establish completion while the history response is in flight.
|
|
29546
|
+
scan();
|
|
29547
|
+
if (!found && !status) return [
|
|
29548
|
+
'unknown',
|
|
29549
|
+
'History coverage incomplete: selected turn not found'
|
|
29550
|
+
];
|
|
29551
|
+
await visitCodexHistory(session, threadId, 'thread/items/list', {
|
|
29552
|
+
turnId,
|
|
29553
|
+
sortDirection: 'asc'
|
|
29554
|
+
}, (data)=>{
|
|
29555
|
+
for (const row of data){
|
|
29556
|
+
if (!row || row.turnId !== turnId || !row.item) throw new Error('Invalid thread/items/list wrapper');
|
|
29557
|
+
if (row.item.type === 'userMessage' && anchors.includes(row.item.clientId)) {
|
|
29558
|
+
anchorFound = true;
|
|
29559
|
+
missingAnchors.delete(row.item.clientId);
|
|
29560
|
+
}
|
|
29561
|
+
if (anchorFound) add(row.item);
|
|
29562
|
+
}
|
|
29563
|
+
return false;
|
|
29564
|
+
}, {
|
|
29565
|
+
stopped: ()=>done
|
|
29566
|
+
});
|
|
29567
|
+
if (!anchorFound || missingAnchors.size) {
|
|
29568
|
+
items.clear();
|
|
29569
|
+
return [
|
|
29570
|
+
'unknown',
|
|
29571
|
+
'History coverage incomplete: reply anchor not found'
|
|
29572
|
+
];
|
|
29573
|
+
}
|
|
29574
|
+
if (afterMessageId !== undefined && !historyTerminal) return scan().length ? [
|
|
29575
|
+
'waiting-for-input'
|
|
29576
|
+
] : [
|
|
29577
|
+
'unknown',
|
|
29578
|
+
'Anchored reply awaits terminal history'
|
|
29579
|
+
];
|
|
29580
|
+
} catch (err) {
|
|
29581
|
+
historyError = err.message;
|
|
29582
|
+
truncated = true;
|
|
29583
|
+
}
|
|
29584
|
+
if (afterMessageId !== undefined && historyError) {
|
|
29585
|
+
items.clear();
|
|
29586
|
+
return [
|
|
29587
|
+
'unknown',
|
|
29588
|
+
historyError
|
|
29589
|
+
];
|
|
29590
|
+
}
|
|
29591
|
+
while(!done){
|
|
29592
|
+
const interactions = scan();
|
|
29593
|
+
if (terminal(status)) return [
|
|
29594
|
+
status,
|
|
29595
|
+
error ?? historyError
|
|
29596
|
+
];
|
|
29597
|
+
if (historyError || overflow) return [
|
|
29598
|
+
'unknown',
|
|
29599
|
+
historyError ?? 'Notification coverage overflow'
|
|
29600
|
+
];
|
|
29601
|
+
if (interactions.length) return [
|
|
29602
|
+
'waiting-for-input'
|
|
29603
|
+
];
|
|
29604
|
+
await new Promise((resolve)=>{
|
|
29605
|
+
const listener = ()=>{
|
|
29606
|
+
wake.delete(listener);
|
|
29607
|
+
resolve();
|
|
29608
|
+
};
|
|
29609
|
+
wake.add(listener);
|
|
29610
|
+
});
|
|
29611
|
+
}
|
|
29612
|
+
return [
|
|
29613
|
+
'unknown',
|
|
29614
|
+
'Observation ended'
|
|
29615
|
+
];
|
|
29616
|
+
};
|
|
29617
|
+
try {
|
|
29618
|
+
const [state, detail] = await Promise.race([
|
|
29619
|
+
stopped,
|
|
29620
|
+
collect()
|
|
29621
|
+
]);
|
|
29622
|
+
return result(state, detail);
|
|
29623
|
+
} finally{
|
|
29624
|
+
done = true;
|
|
29625
|
+
clearTimeout(timer);
|
|
29626
|
+
wake.delete(notify);
|
|
29627
|
+
for (const s of abortSignals)s.removeEventListener('abort', notify);
|
|
29628
|
+
for (const listener of [
|
|
29629
|
+
...wake
|
|
29630
|
+
])listener();
|
|
29631
|
+
}
|
|
29632
|
+
}
|
|
29633
|
+
/** @param {{timeoutMs?: number, maxEvents?: number, signal?: AbortSignal}} [options] */ async function watch({ timeoutMs = 30000, maxEvents = 100, signal: watchSignal } = {}) {
|
|
29634
|
+
boundedInteger(timeoutMs, 600000, 'timeoutMs');
|
|
29635
|
+
boundedInteger(maxEvents, 500, 'maxEvents');
|
|
29636
|
+
if (watchSignal !== undefined && !(watchSignal instanceof AbortSignal)) throw new TypeError('signal must be an AbortSignal');
|
|
29637
|
+
const signals = [
|
|
29638
|
+
signal,
|
|
29639
|
+
watchSignal
|
|
29640
|
+
].filter(Boolean);
|
|
29641
|
+
let timer, listener;
|
|
29642
|
+
const reason = await new Promise((resolve)=>{
|
|
29643
|
+
listener = ()=>{
|
|
29644
|
+
if (signals.some((s)=>s.aborted) || closed) resolve('cancelled');
|
|
29645
|
+
else if (disconnected) resolve('disconnected');
|
|
29646
|
+
else if (events.length >= maxEvents) resolve('event-limit');
|
|
29647
|
+
};
|
|
29648
|
+
timer = setTimeout(()=>resolve('timeout'), timeoutMs);
|
|
29649
|
+
wake.add(listener);
|
|
29650
|
+
for (const s of signals)s.addEventListener('abort', listener, {
|
|
29651
|
+
once: true
|
|
29652
|
+
});
|
|
29653
|
+
listener();
|
|
29654
|
+
});
|
|
29655
|
+
clearTimeout(timer);
|
|
29656
|
+
wake.delete(listener);
|
|
29657
|
+
for (const s of signals)s.removeEventListener('abort', listener);
|
|
29658
|
+
return {
|
|
29659
|
+
threadId,
|
|
29660
|
+
events: events.slice(0, maxEvents).map((x)=>x.event),
|
|
29661
|
+
reason,
|
|
29662
|
+
truncated: overflow || events.length > maxEvents
|
|
29663
|
+
};
|
|
29664
|
+
}
|
|
29665
|
+
return {
|
|
29666
|
+
threadId,
|
|
29667
|
+
cwd: resumed.cwd ?? resumed.thread.cwd,
|
|
29668
|
+
wait,
|
|
29669
|
+
watch,
|
|
29670
|
+
close,
|
|
29671
|
+
/** @param {string} text
|
|
29672
|
+
* @param {{envelope?: object, whenBusy?: string, expectedTurnId?: string, signal?: AbortSignal}} [options] */ async send (text, { envelope = (0,_codex_bridge_js__rspack_import_2/* .buildEnvelope */.nq)({
|
|
29673
|
+
env
|
|
29674
|
+
}), whenBusy = 'reject', expectedTurnId, signal: sendSignal } = {}) {
|
|
29675
|
+
if (closed) return (0,_contract_js__rspack_import_0/* .outcomeFromError */.DG)(Object.assign(new Error('Conversation closed'), {
|
|
29676
|
+
delivery: 'rejected',
|
|
29677
|
+
reason: 'closed',
|
|
29678
|
+
threadId,
|
|
29679
|
+
envelope
|
|
29680
|
+
}));
|
|
29681
|
+
if (sendSignal !== undefined && !(sendSignal instanceof AbortSignal)) throw new TypeError('signal must be an AbortSignal');
|
|
29682
|
+
const submissionSignal = signal && sendSignal ? AbortSignal.any([
|
|
29683
|
+
signal,
|
|
29684
|
+
sendSignal
|
|
29685
|
+
]) : sendSignal ?? signal;
|
|
29686
|
+
const receipt = await (0,_codex_bridge_js__rspack_import_2/* .sendToCodexThread */.ZS)(threadId, text, {
|
|
29687
|
+
env,
|
|
29688
|
+
envelope,
|
|
29689
|
+
whenBusy,
|
|
29690
|
+
expectedTurnId,
|
|
29691
|
+
session,
|
|
29692
|
+
expectedCwd,
|
|
29693
|
+
signal: submissionSignal
|
|
29694
|
+
});
|
|
29695
|
+
if (receipt.delivery === 'accepted' && receipt.turnId) {
|
|
29696
|
+
acceptedTurns.add(receipt.turnId);
|
|
29697
|
+
if (acceptedTurns.size > 100) acceptedTurns.delete(acceptedTurns.values().next().value);
|
|
29698
|
+
}
|
|
29699
|
+
return receipt;
|
|
29700
|
+
}
|
|
27690
29701
|
};
|
|
27691
29702
|
}
|
|
27692
29703
|
|
|
27693
29704
|
__webpack_require__.d(__webpack_exports__, {
|
|
27694
|
-
|
|
27695
|
-
DG: () => (outcomeFromError),
|
|
27696
|
-
Dz: () => (outcomeFromReceipt)
|
|
29705
|
+
j: () => (openCodexConversation)
|
|
27697
29706
|
});
|
|
27698
29707
|
|
|
27699
29708
|
|
|
@@ -27728,7 +29737,7 @@ async function openBackend(opts) {
|
|
|
27728
29737
|
setGroupMembers: (group, members)=>_gateway_js__rspack_import_1/* .setGroupMembers */.Td(session, group, members),
|
|
27729
29738
|
addGroupMember: (group, bot)=>_gateway_js__rspack_import_1/* .addGroupMember */.zr(session, group, bot),
|
|
27730
29739
|
removeGroupMember: (group, bot)=>_gateway_js__rspack_import_1/* .removeGroupMember */.A0(session, group, bot),
|
|
27731
|
-
send: (ref, prompt)=>_gateway_js__rspack_import_1/* .sendPrompt */.LV(session, ref, prompt),
|
|
29740
|
+
send: (ref, prompt, extra)=>_gateway_js__rspack_import_1/* .sendPrompt */.LV(session, ref, prompt, extra),
|
|
27732
29741
|
transcript: (ref, limit)=>_gateway_js__rspack_import_1/* .getTranscriptTail */.bA(session, ref, limit),
|
|
27733
29742
|
thread: (ref, rootId)=>_gateway_js__rspack_import_1/* .getThread */.fG(session, ref, rootId)
|
|
27734
29743
|
};
|
|
@@ -28439,10 +30448,12 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
28439
30448
|
},
|
|
28440
30449
|
"./src/core/gateway.js"(__unused_rspack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
28441
30450
|
/* import */ var node_crypto__rspack_import_0 = __webpack_require__("node:crypto");
|
|
28442
|
-
/* import */ var
|
|
30451
|
+
/* import */ var _headers_js__rspack_import_5 = __webpack_require__("./src/core/headers.js");
|
|
28443
30452
|
/* import */ var _app_session_js__rspack_import_1 = __webpack_require__("./src/core/app-session.js");
|
|
28444
30453
|
/* import */ var _store_js__rspack_import_2 = __webpack_require__("./src/core/store.js");
|
|
28445
30454
|
/* import */ var _url_policy_js__rspack_import_3 = __webpack_require__("./src/core/url-policy.js");
|
|
30455
|
+
/* import */ var _grok_approvals_js__rspack_import_4 = __webpack_require__("./src/core/grok-approvals.js");
|
|
30456
|
+
|
|
28446
30457
|
|
|
28447
30458
|
|
|
28448
30459
|
|
|
@@ -28459,6 +30470,21 @@ class GatewayError extends Error {
|
|
|
28459
30470
|
// ponytail: fixed 30 s deadline and buffered byte cap; upgrade path is per-method budgets plus streaming reads.
|
|
28460
30471
|
const GATEWAY_TIMEOUT_MS = 30000;
|
|
28461
30472
|
const GATEWAY_MAX_RESPONSE_BYTES = 2 * 1024 * 1024;
|
|
30473
|
+
function assertGatewayActive(signal) {
|
|
30474
|
+
if (signal?.aborted) {
|
|
30475
|
+
const error = new GatewayError("Gateway submission cancelled before transmission");
|
|
30476
|
+
error.delivery = "rejected";
|
|
30477
|
+
error.reason = "cancelled";
|
|
30478
|
+
throw error;
|
|
30479
|
+
}
|
|
30480
|
+
}
|
|
30481
|
+
function gatewayDeadline(signal) {
|
|
30482
|
+
const timeout = AbortSignal.timeout(GATEWAY_TIMEOUT_MS);
|
|
30483
|
+
return signal ? AbortSignal.any([
|
|
30484
|
+
signal,
|
|
30485
|
+
timeout
|
|
30486
|
+
]) : timeout;
|
|
30487
|
+
}
|
|
28462
30488
|
function backendBase() {
|
|
28463
30489
|
return (process.env.CURSOR_API_BASE_URL || "https://api2.cursor.sh").replace(/\/$/, "");
|
|
28464
30490
|
}
|
|
@@ -28477,7 +30503,7 @@ function gatewayOverride() {
|
|
|
28477
30503
|
kind: "gateway"
|
|
28478
30504
|
}),
|
|
28479
30505
|
gatewayToken: token,
|
|
28480
|
-
gatewayHeaders: (0,
|
|
30506
|
+
gatewayHeaders: (0,_headers_js__rspack_import_5/* .headersFromEnv */.gx)()
|
|
28481
30507
|
};
|
|
28482
30508
|
}
|
|
28483
30509
|
return null;
|
|
@@ -28498,7 +30524,7 @@ function sessionFromApp() {
|
|
|
28498
30524
|
kind: "gateway"
|
|
28499
30525
|
}),
|
|
28500
30526
|
gatewayToken: loaded.gatewayToken,
|
|
28501
|
-
gatewayHeaders: (0,
|
|
30527
|
+
gatewayHeaders: (0,_headers_js__rspack_import_5/* .mergeGatewayHeaders */.bQ)((0,_headers_js__rspack_import_5/* .normalizeHeaderMap */.dk)(loaded.headers), (0,_headers_js__rspack_import_5/* .headersFromEnv */.gx)())
|
|
28502
30528
|
};
|
|
28503
30529
|
}
|
|
28504
30530
|
function hasGatewayAuth() {
|
|
@@ -28547,18 +30573,26 @@ function pick(obj, ...keys) {
|
|
|
28547
30573
|
}
|
|
28548
30574
|
return undefined;
|
|
28549
30575
|
}
|
|
28550
|
-
async function ensureSandbox(accessToken) {
|
|
30576
|
+
async function ensureSandbox(accessToken, { signal } = {}) {
|
|
30577
|
+
assertGatewayActive(signal);
|
|
28551
30578
|
const url = (0,_url_policy_js__rspack_import_3/* .assertAllowedCredentialUrl */.Re)(backendBase(), {
|
|
28552
30579
|
kind: "backend"
|
|
28553
30580
|
}) + "/aiserver.v1.GrokBotService/EnsureSandBox";
|
|
28554
|
-
|
|
28555
|
-
|
|
28556
|
-
|
|
28557
|
-
|
|
28558
|
-
|
|
28559
|
-
|
|
28560
|
-
|
|
28561
|
-
|
|
30581
|
+
let res, body;
|
|
30582
|
+
try {
|
|
30583
|
+
res = await fetch(url, {
|
|
30584
|
+
method: "POST",
|
|
30585
|
+
redirect: "error",
|
|
30586
|
+
signal: gatewayDeadline(signal),
|
|
30587
|
+
headers: (0,_headers_js__rspack_import_5/* .ensureSandboxHeaders */._6)(accessToken),
|
|
30588
|
+
body: "{}"
|
|
30589
|
+
});
|
|
30590
|
+
body = await readJson(res);
|
|
30591
|
+
} catch (error) {
|
|
30592
|
+
assertGatewayActive(signal);
|
|
30593
|
+
throw error;
|
|
30594
|
+
}
|
|
30595
|
+
assertGatewayActive(signal);
|
|
28562
30596
|
if (!res.ok) {
|
|
28563
30597
|
const detail = body.message || body.error || body.raw || res.statusText;
|
|
28564
30598
|
throw new GatewayError("EnsureSandBox failed: " + res.status + " " + (0,_url_policy_js__rspack_import_3/* .redactSecrets */.fp)(detail), {
|
|
@@ -28576,10 +30610,11 @@ async function ensureSandbox(accessToken) {
|
|
|
28576
30610
|
kind: "gateway"
|
|
28577
30611
|
}),
|
|
28578
30612
|
gatewayToken: String(gatewayToken),
|
|
28579
|
-
gatewayHeaders: (0,
|
|
30613
|
+
gatewayHeaders: (0,_headers_js__rspack_import_5/* .mergeGatewayHeaders */.bQ)((0,_headers_js__rspack_import_5/* .headersFromEnsureSandbox */.Ew)(body), (0,_headers_js__rspack_import_5/* .headersFromEnv */.gx)())
|
|
28580
30614
|
};
|
|
28581
30615
|
}
|
|
28582
|
-
async function connectGateway() {
|
|
30616
|
+
async function connectGateway({ signal } = {}) {
|
|
30617
|
+
assertGatewayActive(signal);
|
|
28583
30618
|
const override = gatewayOverride();
|
|
28584
30619
|
if (override) return override;
|
|
28585
30620
|
const fromApp = sessionFromApp();
|
|
@@ -28588,21 +30623,36 @@ async function connectGateway() {
|
|
|
28588
30623
|
if (!token) {
|
|
28589
30624
|
throw new GatewayError("Set CURSOR_ACCESS_TOKEN, or GROK_BOT_GATEWAY_URL + GROK_BOT_GATEWAY_TOKEN. Do not use a Cursor dashboard API key.");
|
|
28590
30625
|
}
|
|
28591
|
-
return ensureSandbox(token
|
|
30626
|
+
return ensureSandbox(token, {
|
|
30627
|
+
signal
|
|
30628
|
+
});
|
|
28592
30629
|
}
|
|
28593
|
-
async function gatewayCall(session, method, body = {}) {
|
|
30630
|
+
async function gatewayCall(session, method, body = {}, { signal } = {}) {
|
|
30631
|
+
assertGatewayActive(signal);
|
|
28594
30632
|
const base = (0,_url_policy_js__rspack_import_3/* .assertAllowedCredentialUrl */.Re)(session.gatewayUrl, {
|
|
28595
30633
|
kind: "gateway"
|
|
28596
30634
|
});
|
|
28597
30635
|
const url = base + "/api/" + method;
|
|
28598
|
-
|
|
30636
|
+
// Cancellation can abort read/auth preflights. Once a prompt request starts,
|
|
30637
|
+
// observe its actual receipt (or timeout) instead of losing certainty on stop.
|
|
30638
|
+
const prompt = method === "sendPrompt";
|
|
30639
|
+
const options = {
|
|
28599
30640
|
method: "POST",
|
|
28600
30641
|
redirect: "error",
|
|
28601
|
-
signal:
|
|
28602
|
-
headers: (0,
|
|
30642
|
+
signal: gatewayDeadline(prompt ? undefined : signal),
|
|
30643
|
+
headers: (0,_headers_js__rspack_import_5/* .requestHeaders */.A1)(session),
|
|
28603
30644
|
body: JSON.stringify(body)
|
|
28604
|
-
}
|
|
28605
|
-
|
|
30645
|
+
};
|
|
30646
|
+
assertGatewayActive(signal); // Final synchronous boundary before transmission.
|
|
30647
|
+
let res, data;
|
|
30648
|
+
try {
|
|
30649
|
+
res = await fetch(url, options);
|
|
30650
|
+
data = await readJson(res);
|
|
30651
|
+
} catch (error) {
|
|
30652
|
+
if (!prompt) assertGatewayActive(signal);
|
|
30653
|
+
throw error;
|
|
30654
|
+
}
|
|
30655
|
+
if (!prompt) assertGatewayActive(signal);
|
|
28606
30656
|
if (!res.ok) {
|
|
28607
30657
|
const detail = data.message || data.error || data.raw || res.statusText;
|
|
28608
30658
|
throw new GatewayError(method + " failed: " + res.status + " " + (0,_url_policy_js__rspack_import_3/* .redactSecrets */.fp)(String(detail).slice(0, 300)), {
|
|
@@ -28654,8 +30704,10 @@ function unwrapList(data) {
|
|
|
28654
30704
|
function unwrapOne(data) {
|
|
28655
30705
|
return asRecord(data.agent || data);
|
|
28656
30706
|
}
|
|
28657
|
-
async function listAgents(session) {
|
|
28658
|
-
const data = await gatewayCall(session, "listAgents", {}
|
|
30707
|
+
async function listAgents(session, { signal } = {}) {
|
|
30708
|
+
const data = await gatewayCall(session, "listAgents", {}, {
|
|
30709
|
+
signal
|
|
30710
|
+
});
|
|
28659
30711
|
return unwrapList(data).map(asRecord).filter((r)=>r && r.id);
|
|
28660
30712
|
}
|
|
28661
30713
|
function resolveFromList(records, ref) {
|
|
@@ -28667,8 +30719,10 @@ function resolveFromList(records, ref) {
|
|
|
28667
30719
|
if (matches.length === 0) throw new GatewayError("No bot or group named \"" + ref + "\"");
|
|
28668
30720
|
throw new GatewayError("Ambiguous name \"" + ref + "\"");
|
|
28669
30721
|
}
|
|
28670
|
-
async function resolveRef(session, ref) {
|
|
28671
|
-
return resolveFromList(await listAgents(session
|
|
30722
|
+
async function resolveRef(session, ref, { signal } = {}) {
|
|
30723
|
+
return resolveFromList(await listAgents(session, {
|
|
30724
|
+
signal
|
|
30725
|
+
}), ref);
|
|
28672
30726
|
}
|
|
28673
30727
|
async function createAgent(session, input) {
|
|
28674
30728
|
const data = await gatewayCall(session, "createAgent", {
|
|
@@ -28790,16 +30844,22 @@ async function removeGroupMember(session, groupRef, memberRef) {
|
|
|
28790
30844
|
const next = group.memberIds.filter((id)=>id !== member.id);
|
|
28791
30845
|
return setGroupMembers(session, group.id, next);
|
|
28792
30846
|
}
|
|
28793
|
-
async function sendPrompt(session, ref, prompt) {
|
|
28794
|
-
|
|
30847
|
+
async function sendPrompt(session, ref, prompt, extra = {}) {
|
|
30848
|
+
assertGatewayActive(extra.signal);
|
|
30849
|
+
const rec = await resolveRef(session, ref, {
|
|
30850
|
+
signal: extra.signal
|
|
30851
|
+
});
|
|
28795
30852
|
const body = {
|
|
28796
30853
|
agentId: rec.id,
|
|
28797
30854
|
prompt,
|
|
28798
|
-
clientNonce: (0,node_crypto__rspack_import_0.randomUUID)()
|
|
30855
|
+
clientNonce: extra.clientNonce || (0,node_crypto__rspack_import_0.randomUUID)()
|
|
28799
30856
|
};
|
|
30857
|
+
if (extra.replyToId) body.replyToId = extra.replyToId;
|
|
28800
30858
|
let data;
|
|
28801
30859
|
try {
|
|
28802
|
-
data = await gatewayCall(session, "sendPrompt", body
|
|
30860
|
+
data = await gatewayCall(session, "sendPrompt", body, {
|
|
30861
|
+
signal: extra.signal
|
|
30862
|
+
});
|
|
28803
30863
|
} catch (err) {
|
|
28804
30864
|
// Delivery states: the server answered no (rejected) vs the request may have landed (unknown).
|
|
28805
30865
|
// Never retry an unknown delivery blindly; read the thread first.
|
|
@@ -28847,10 +30907,49 @@ async function getThread(session, ref, rootId) {
|
|
|
28847
30907
|
thread: data
|
|
28848
30908
|
};
|
|
28849
30909
|
}
|
|
30910
|
+
async function listGrokApprovals(session, ref) {
|
|
30911
|
+
const { target, transcript } = await getTranscriptTail(session, ref, 200);
|
|
30912
|
+
if (!Array.isArray(transcript?.entries) || transcript.entries.length > 200) throw new GatewayError("Invalid approval transcript coverage");
|
|
30913
|
+
return {
|
|
30914
|
+
target: {
|
|
30915
|
+
id: target.id,
|
|
30916
|
+
name: target.name
|
|
30917
|
+
},
|
|
30918
|
+
approvals: transcript.entries.map(_grok_approvals_js__rspack_import_4/* .grokApproval */.Ny).filter(Boolean),
|
|
30919
|
+
coverage: "Latest 200 transcript entries only; older requests require the owning Grok UI."
|
|
30920
|
+
};
|
|
30921
|
+
}
|
|
30922
|
+
async function respondGrokApproval(session, ref, input) {
|
|
30923
|
+
const { entryId, requestId, decision } = _grok_approvals_js__rspack_import_4/* .grokApprovalResponseSchema.parse */.T5.parse({
|
|
30924
|
+
...input,
|
|
30925
|
+
target: ref
|
|
30926
|
+
});
|
|
30927
|
+
const { target, approvals } = await listGrokApprovals(session, ref);
|
|
30928
|
+
const matches = approvals.filter((card)=>card.entryId === entryId && card.requestId === requestId);
|
|
30929
|
+
if (matches.length !== 1) throw new GatewayError("Stale, foreign or unsupported Grok approval; refresh pending requests or use the owning Grok UI");
|
|
30930
|
+
const approval = matches[0];
|
|
30931
|
+
if (decision === "accept" && approval.truncated) throw new GatewayError("Approval details are truncated; acceptance requires the owning Grok UI");
|
|
30932
|
+
const local = approval.type === "local-tool-permission";
|
|
30933
|
+
await gatewayCall(session, local ? "resolveLocalToolPermission" : "resolveAutoReviewApproval", {
|
|
30934
|
+
agentId: target.id,
|
|
30935
|
+
entryId,
|
|
30936
|
+
requestId,
|
|
30937
|
+
resolution: local ? decision === "accept" ? "allow-once" : "deny" : decision === "accept" ? "approved" : "denied"
|
|
30938
|
+
});
|
|
30939
|
+
return {
|
|
30940
|
+
target,
|
|
30941
|
+
entryId,
|
|
30942
|
+
requestId,
|
|
30943
|
+
decision,
|
|
30944
|
+
delivery: "accepted"
|
|
30945
|
+
};
|
|
30946
|
+
}
|
|
28850
30947
|
|
|
28851
30948
|
__webpack_require__.d(__webpack_exports__, {
|
|
28852
30949
|
A0: () => (removeGroupMember),
|
|
28853
30950
|
LV: () => (sendPrompt),
|
|
30951
|
+
MI: () => (listGrokApprovals),
|
|
30952
|
+
OR: () => (respondGrokApproval),
|
|
28854
30953
|
RB: () => (deleteAgent),
|
|
28855
30954
|
Sn: () => (createAgent),
|
|
28856
30955
|
Td: () => (setGroupMembers),
|
|
@@ -28866,6 +30965,68 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
28866
30965
|
});
|
|
28867
30966
|
|
|
28868
30967
|
|
|
30968
|
+
},
|
|
30969
|
+
"./src/core/grok-approvals.js"(__unused_rspack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
30970
|
+
/* import */ var zod__rspack_import_1 = __webpack_require__("./node_modules/zod/v4/classic/schemas.js");
|
|
30971
|
+
/* import */ var _url_policy_js__rspack_import_0 = __webpack_require__("./src/core/url-policy.js");
|
|
30972
|
+
|
|
30973
|
+
|
|
30974
|
+
const id = zod__rspack_import_1/* .string */.YjP().min(1).max(1024);
|
|
30975
|
+
const grokApprovalResponseSchema = zod__rspack_import_1/* .strictObject */.rej({
|
|
30976
|
+
target: id,
|
|
30977
|
+
entryId: id,
|
|
30978
|
+
requestId: id,
|
|
30979
|
+
decision: zod__rspack_import_1/* ["enum"] */.k5n([
|
|
30980
|
+
"accept",
|
|
30981
|
+
"decline"
|
|
30982
|
+
])
|
|
30983
|
+
});
|
|
30984
|
+
function grokApproval(entry) {
|
|
30985
|
+
if (entry?.kind !== "send-message") return null;
|
|
30986
|
+
const type = entry.message?.type;
|
|
30987
|
+
const card = type === "auto-review-approval" ? entry.message.approval : type === "local-tool-permission" ? entry.message.ask : null;
|
|
30988
|
+
if (card?.status !== "pending" || !id.safeParse(card.requestId).success || !id.safeParse(entry.id).success) return null;
|
|
30989
|
+
const details = {};
|
|
30990
|
+
let truncated = false;
|
|
30991
|
+
for (const key of [
|
|
30992
|
+
"reason",
|
|
30993
|
+
"command",
|
|
30994
|
+
"summary",
|
|
30995
|
+
"action",
|
|
30996
|
+
"description",
|
|
30997
|
+
"target",
|
|
30998
|
+
"machineId",
|
|
30999
|
+
"surface",
|
|
31000
|
+
"workingDirectory"
|
|
31001
|
+
]){
|
|
31002
|
+
if (typeof card[key] !== "string") continue;
|
|
31003
|
+
const text = (0,_url_policy_js__rspack_import_0/* .redactSecrets */.fp)(card[key]);
|
|
31004
|
+
truncated ||= text.length > 2048;
|
|
31005
|
+
details[key] = text.slice(0, 2048);
|
|
31006
|
+
}
|
|
31007
|
+
return {
|
|
31008
|
+
entryId: entry.id,
|
|
31009
|
+
requestId: card.requestId,
|
|
31010
|
+
type,
|
|
31011
|
+
...details,
|
|
31012
|
+
truncated
|
|
31013
|
+
};
|
|
31014
|
+
}
|
|
31015
|
+
function grokApprovalNotice(entry, target) {
|
|
31016
|
+
const approval = grokApproval(entry);
|
|
31017
|
+
return approval ? `Grok approval pending. Requires an explicit user decision; never approve automatically.\n${JSON.stringify({
|
|
31018
|
+
botTarget: target,
|
|
31019
|
+
...approval
|
|
31020
|
+
})}\nUse gbot_grok_respond with target=${JSON.stringify(target)}, entryId, requestId and decision accept (once) or decline.${approval.truncated ? " Details are truncated; acceptance requires the owning Grok UI." : ""} A chat reply is not authorization.` : null;
|
|
31021
|
+
}
|
|
31022
|
+
|
|
31023
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
31024
|
+
Ny: () => (grokApproval)
|
|
31025
|
+
}, {
|
|
31026
|
+
T5: grokApprovalResponseSchema
|
|
31027
|
+
});
|
|
31028
|
+
|
|
31029
|
+
|
|
28869
31030
|
},
|
|
28870
31031
|
"./src/core/headers.js"(__unused_rspack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
28871
31032
|
function normalizeHeaderMap(obj) {
|
|
@@ -29051,6 +31212,272 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
29051
31212
|
});
|
|
29052
31213
|
|
|
29053
31214
|
|
|
31215
|
+
},
|
|
31216
|
+
"./src/core/relay/control.js"(__unused_rspack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
31217
|
+
/* import */ var node_string_decoder__rspack_import_0 = __webpack_require__("node:string_decoder");
|
|
31218
|
+
/* import */ var node_net__rspack_import_1 = __webpack_require__("node:net");
|
|
31219
|
+
/* import */ var node_crypto__rspack_import_2 = __webpack_require__("node:crypto");
|
|
31220
|
+
/* import */ var _profile_js__rspack_import_3 = __webpack_require__("./src/core/relay/profile.js");
|
|
31221
|
+
|
|
31222
|
+
|
|
31223
|
+
|
|
31224
|
+
|
|
31225
|
+
const RELAY_PROTOCOL = 1;
|
|
31226
|
+
const CONTROL_BYTES = 1024 * 1024;
|
|
31227
|
+
const CONTROL_TIMEOUT = 45000;
|
|
31228
|
+
function relayRequest(options, method, input = {}, { timeoutMs = CONTROL_TIMEOUT, signal, requestId = (0,node_crypto__rspack_import_2.randomUUID)() } = {}) {
|
|
31229
|
+
const { socketPath, profile } = (0,_profile_js__rspack_import_3/* .relayLocation */.hQ)(options);
|
|
31230
|
+
return new Promise((resolve, reject)=>{
|
|
31231
|
+
const decoder = new node_string_decoder__rspack_import_0.StringDecoder("utf8");
|
|
31232
|
+
let buffer = "", bytes = 0, settled = false, connected = false;
|
|
31233
|
+
const socket = (0,node_net__rspack_import_1.connect)(socketPath);
|
|
31234
|
+
const finish = (error, value)=>{
|
|
31235
|
+
if (settled) return;
|
|
31236
|
+
settled = true;
|
|
31237
|
+
clearTimeout(timer);
|
|
31238
|
+
signal?.removeEventListener("abort", abort);
|
|
31239
|
+
socket.destroy();
|
|
31240
|
+
error ? reject(error) : resolve(value);
|
|
31241
|
+
};
|
|
31242
|
+
const uncertain = ()=>Object.assign(Error(`Relay control connection lost; do not resend with a new requestId (${requestId}). Check bridge status.`), {
|
|
31243
|
+
requestId
|
|
31244
|
+
});
|
|
31245
|
+
const abort = ()=>finish(uncertain());
|
|
31246
|
+
const timer = setTimeout(abort, timeoutMs);
|
|
31247
|
+
signal?.addEventListener("abort", abort, {
|
|
31248
|
+
once: true
|
|
31249
|
+
});
|
|
31250
|
+
if (signal?.aborted) return abort();
|
|
31251
|
+
socket.on("error", (error)=>finish(connected ? uncertain() : error));
|
|
31252
|
+
socket.on("close", ()=>finish(uncertain()));
|
|
31253
|
+
socket.on("connect", ()=>{
|
|
31254
|
+
connected = true;
|
|
31255
|
+
const line = JSON.stringify({
|
|
31256
|
+
version: RELAY_PROTOCOL,
|
|
31257
|
+
profile,
|
|
31258
|
+
requestId,
|
|
31259
|
+
method,
|
|
31260
|
+
input
|
|
31261
|
+
}) + "\n";
|
|
31262
|
+
if (Buffer.byteLength(line) > CONTROL_BYTES) return finish(Error("Relay control request exceeds budget"));
|
|
31263
|
+
socket.write(line);
|
|
31264
|
+
});
|
|
31265
|
+
socket.on("data", (chunk)=>{
|
|
31266
|
+
bytes += chunk.length;
|
|
31267
|
+
if (bytes > CONTROL_BYTES) return finish(Error("Relay control response exceeds budget"));
|
|
31268
|
+
buffer += decoder.write(chunk);
|
|
31269
|
+
const end = buffer.indexOf("\n");
|
|
31270
|
+
if (end < 0) return;
|
|
31271
|
+
try {
|
|
31272
|
+
const reply = JSON.parse(buffer.slice(0, end));
|
|
31273
|
+
if (reply.version !== RELAY_PROTOCOL || reply.requestId !== requestId) throw Error("Relay protocol identity mismatch");
|
|
31274
|
+
if (reply.error) throw Error(reply.error);
|
|
31275
|
+
if (reply.profile !== profile) throw Error("Relay profile mismatch");
|
|
31276
|
+
finish(null, reply.result);
|
|
31277
|
+
} catch (error) {
|
|
31278
|
+
finish(error);
|
|
31279
|
+
}
|
|
31280
|
+
});
|
|
31281
|
+
});
|
|
31282
|
+
}
|
|
31283
|
+
|
|
31284
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
31285
|
+
lJ: () => (relayRequest)
|
|
31286
|
+
});
|
|
31287
|
+
|
|
31288
|
+
|
|
31289
|
+
},
|
|
31290
|
+
"./src/core/relay/managed.js"(__unused_rspack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
31291
|
+
/* import */ var node_child_process__rspack_import_0 = __webpack_require__("node:child_process");
|
|
31292
|
+
/* import */ var node_fs_promises__rspack_import_1 = __webpack_require__("node:fs/promises");
|
|
31293
|
+
/* import */ var node_path__rspack_import_2 = __webpack_require__("node:path");
|
|
31294
|
+
/* import */ var node_url__rspack_import_3 = __webpack_require__("node:url");
|
|
31295
|
+
/* import */ var node_crypto__rspack_import_4 = __webpack_require__("node:crypto");
|
|
31296
|
+
/* import */ var _profile_js__rspack_import_5 = __webpack_require__("./src/core/relay/profile.js");
|
|
31297
|
+
/* import */ var _control_js__rspack_import_6 = __webpack_require__("./src/core/relay/control.js");
|
|
31298
|
+
|
|
31299
|
+
|
|
31300
|
+
|
|
31301
|
+
|
|
31302
|
+
|
|
31303
|
+
|
|
31304
|
+
|
|
31305
|
+
/** @param {{pluginRoot?: string, moduleUrl?: string}} options */ async function resolveRelayWorker({ pluginRoot, moduleUrl = import.meta.url } = {}) {
|
|
31306
|
+
const roots = [];
|
|
31307
|
+
if (pluginRoot) roots.push(pluginRoot);
|
|
31308
|
+
let path = (0,node_path__rspack_import_2.dirname)((0,node_url__rspack_import_3.fileURLToPath)(moduleUrl));
|
|
31309
|
+
for(let i = 0; i < 5; i++){
|
|
31310
|
+
roots.push(path);
|
|
31311
|
+
path = (0,node_path__rspack_import_2.dirname)(path);
|
|
31312
|
+
}
|
|
31313
|
+
for (const candidate of new Set(roots)){
|
|
31314
|
+
let manifest;
|
|
31315
|
+
try {
|
|
31316
|
+
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"));
|
|
31317
|
+
} catch (error) {
|
|
31318
|
+
if (error.code === "ENOENT") continue;
|
|
31319
|
+
throw error;
|
|
31320
|
+
}
|
|
31321
|
+
const relative = "scripts/gbot-relay.mjs";
|
|
31322
|
+
const file = manifest.files?.find((f)=>f.path === relative);
|
|
31323
|
+
if (manifest.application?.name !== "gbot" || !file || !manifest.executables?.scripts?.some((s)=>s.path === relative)) continue;
|
|
31324
|
+
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);
|
|
31325
|
+
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");
|
|
31326
|
+
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");
|
|
31327
|
+
return worker;
|
|
31328
|
+
}
|
|
31329
|
+
throw Error("Packaged relay worker not found; rebuild or reinstall the plugin");
|
|
31330
|
+
}
|
|
31331
|
+
const unavailable = (error)=>[
|
|
31332
|
+
"ENOENT",
|
|
31333
|
+
"ECONNREFUSED"
|
|
31334
|
+
].includes(error.code);
|
|
31335
|
+
async function ensureRelayWorker(options = {}) {
|
|
31336
|
+
const location = (0,_profile_js__rspack_import_5/* .relayLocation */.hQ)(options);
|
|
31337
|
+
try {
|
|
31338
|
+
return await (0,_control_js__rspack_import_6/* .relayRequest */.lJ)(location, "hello", {}, {
|
|
31339
|
+
timeoutMs: 1500
|
|
31340
|
+
});
|
|
31341
|
+
} catch (error) {
|
|
31342
|
+
if (!unavailable(error)) throw error;
|
|
31343
|
+
}
|
|
31344
|
+
const workerPath = await resolveRelayWorker(options);
|
|
31345
|
+
const child = (0,node_child_process__rspack_import_0.spawn)(process.execPath, [
|
|
31346
|
+
workerPath
|
|
31347
|
+
], {
|
|
31348
|
+
detached: true,
|
|
31349
|
+
stdio: "ignore",
|
|
31350
|
+
env: {
|
|
31351
|
+
...location.env,
|
|
31352
|
+
GROK_BOT_RELAY_DIR: location.stateDir
|
|
31353
|
+
},
|
|
31354
|
+
cwd: (0,node_path__rspack_import_2.dirname)(workerPath)
|
|
31355
|
+
});
|
|
31356
|
+
let spawnError;
|
|
31357
|
+
child.on("error", (error)=>{
|
|
31358
|
+
spawnError = error;
|
|
31359
|
+
});
|
|
31360
|
+
child.unref();
|
|
31361
|
+
const end = Date.now() + 10000;
|
|
31362
|
+
while(Date.now() < end){
|
|
31363
|
+
if (spawnError) throw spawnError;
|
|
31364
|
+
if (options.signal?.aborted) throw Error("Relay startup cancelled before submission");
|
|
31365
|
+
try {
|
|
31366
|
+
return await (0,_control_js__rspack_import_6/* .relayRequest */.lJ)(location, "hello", {}, {
|
|
31367
|
+
timeoutMs: 1000,
|
|
31368
|
+
signal: options.signal
|
|
31369
|
+
});
|
|
31370
|
+
} catch (error) {
|
|
31371
|
+
if (!unavailable(error)) throw error;
|
|
31372
|
+
}
|
|
31373
|
+
await new Promise((resolve)=>setTimeout(resolve, 75));
|
|
31374
|
+
}
|
|
31375
|
+
throw Error("Relay worker startup failed or timed out; no untracked send was attempted. Inspect bridge status and the relay owner lock.");
|
|
31376
|
+
}
|
|
31377
|
+
async function managedOperation(method, input, options = {}) {
|
|
31378
|
+
const location = (0,_profile_js__rspack_import_5/* .relayLocation */.hQ)(options);
|
|
31379
|
+
const requestId = input.requestId ?? (0,node_crypto__rspack_import_4.randomUUID)();
|
|
31380
|
+
if (![
|
|
31381
|
+
"status",
|
|
31382
|
+
"stop",
|
|
31383
|
+
"respond"
|
|
31384
|
+
].includes(method)) await ensureRelayWorker(options);
|
|
31385
|
+
try {
|
|
31386
|
+
return await (0,_control_js__rspack_import_6/* .relayRequest */.lJ)(location, method, input, {
|
|
31387
|
+
signal: options.signal,
|
|
31388
|
+
requestId
|
|
31389
|
+
});
|
|
31390
|
+
} catch (error) {
|
|
31391
|
+
if (method === "status" && unavailable(error)) return {
|
|
31392
|
+
worker: {
|
|
31393
|
+
state: "stopped",
|
|
31394
|
+
profile: location.profile,
|
|
31395
|
+
supervised: false
|
|
31396
|
+
},
|
|
31397
|
+
reason: "Worker is not running. Start a route or tracked send to resume saved routes."
|
|
31398
|
+
};
|
|
31399
|
+
// Never retry a disconnected mutation. Its durable request ID is the recovery handle.
|
|
31400
|
+
throw error;
|
|
31401
|
+
}
|
|
31402
|
+
}
|
|
31403
|
+
|
|
31404
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
31405
|
+
Bb: () => (managedOperation),
|
|
31406
|
+
_v: () => (resolveRelayWorker)
|
|
31407
|
+
});
|
|
31408
|
+
|
|
31409
|
+
|
|
31410
|
+
},
|
|
31411
|
+
"./src/core/relay/profile.js"(__unused_rspack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
31412
|
+
/* import */ var node_crypto__rspack_import_0 = __webpack_require__("node:crypto");
|
|
31413
|
+
/* import */ var node_os__rspack_import_1 = __webpack_require__("node:os");
|
|
31414
|
+
/* import */ var node_path__rspack_import_2 = __webpack_require__("node:path");
|
|
31415
|
+
/* import */ var _codex_bridge_js__rspack_import_3 = __webpack_require__("./src/core/codex-bridge.js");
|
|
31416
|
+
/* import */ var _app_session_js__rspack_import_4 = __webpack_require__("./src/core/app-session.js");
|
|
31417
|
+
|
|
31418
|
+
|
|
31419
|
+
|
|
31420
|
+
|
|
31421
|
+
|
|
31422
|
+
const digest = (value)=>(0,node_crypto__rspack_import_0.createHash)("sha256").update(value).digest("hex");
|
|
31423
|
+
// Only explicit overrides are hashed. App-session token refresh retains its source identity.
|
|
31424
|
+
function relayProfile(env = process.env) {
|
|
31425
|
+
const keys = [
|
|
31426
|
+
"GROK_BOT_GATEWAY_URL",
|
|
31427
|
+
"SAND_HOST_GATEWAY_URL",
|
|
31428
|
+
"SAND_HOST_PORT",
|
|
31429
|
+
"GROK_BOT_GATEWAY_TOKEN",
|
|
31430
|
+
"SAND_HOST_GATEWAY_TOKEN",
|
|
31431
|
+
"SAND_GATEWAY_TOKEN",
|
|
31432
|
+
"CURSOR_ACCESS_TOKEN",
|
|
31433
|
+
"GROK_BOT_ACCESS_TOKEN",
|
|
31434
|
+
"SAND_ACCESS_TOKEN",
|
|
31435
|
+
"GROK_BOT_GATEWAY_HEADERS",
|
|
31436
|
+
"SAND_BACKEND_URL",
|
|
31437
|
+
"CURSOR_API_BASE_URL",
|
|
31438
|
+
"SAND_BOX_NAMESPACE",
|
|
31439
|
+
"SAND_CLIENT_VERSION",
|
|
31440
|
+
"GROK_BOT_CODEX_THREADS",
|
|
31441
|
+
"GROK_BOT_MAX_HOPS",
|
|
31442
|
+
"GROK_BOT_CODEX_EXPERIMENTAL",
|
|
31443
|
+
"GROK_BOT_ALLOW_LOCAL_GATEWAY",
|
|
31444
|
+
"GROK_BOT_ALLOW_ANY_GATEWAY",
|
|
31445
|
+
"GROK_BOT_TEST",
|
|
31446
|
+
"NODE_ENV",
|
|
31447
|
+
// Secret Service credentials depend on the caller's desktop session.
|
|
31448
|
+
"DBUS_SESSION_BUS_ADDRESS",
|
|
31449
|
+
"DISPLAY"
|
|
31450
|
+
];
|
|
31451
|
+
return digest(JSON.stringify([
|
|
31452
|
+
(0,node_path__rspack_import_2.resolve)((0,_codex_bridge_js__rspack_import_3/* .codexSocketPath */.ql)(env)),
|
|
31453
|
+
(0,_app_session_js__rspack_import_4/* .grokBotGatewayDescriptorPath */.dQ)((0,node_os__rspack_import_1.homedir)(), process.platform, env),
|
|
31454
|
+
...keys.map((key)=>[
|
|
31455
|
+
key,
|
|
31456
|
+
env[key] ?? ""
|
|
31457
|
+
])
|
|
31458
|
+
]));
|
|
31459
|
+
}
|
|
31460
|
+
function relayLocation({ env = process.env, stateDir, profile = relayProfile(env) } = {}) {
|
|
31461
|
+
if (process.platform === "win32") throw Error("Codex relay requires Unix-domain sockets; Windows is unsupported.");
|
|
31462
|
+
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)));
|
|
31463
|
+
// macOS Unix sockets cannot use arbitrarily long installation/state paths.
|
|
31464
|
+
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));
|
|
31465
|
+
return {
|
|
31466
|
+
stateDir: dir,
|
|
31467
|
+
profile,
|
|
31468
|
+
env,
|
|
31469
|
+
socketDir,
|
|
31470
|
+
socketPath: (0,node_path__rspack_import_2.join)(socketDir, "control.sock")
|
|
31471
|
+
};
|
|
31472
|
+
}
|
|
31473
|
+
|
|
31474
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
31475
|
+
hQ: () => (relayLocation)
|
|
31476
|
+
}, {
|
|
31477
|
+
br: digest
|
|
31478
|
+
});
|
|
31479
|
+
|
|
31480
|
+
|
|
29054
31481
|
},
|
|
29055
31482
|
"./src/core/store.js"(__unused_rspack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
29056
31483
|
/* import */ var node_crypto__rspack_import_0 = __webpack_require__("node:crypto");
|
|
@@ -29615,6 +32042,10 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
29615
32042
|
});
|
|
29616
32043
|
|
|
29617
32044
|
|
|
32045
|
+
},
|
|
32046
|
+
"./package.json"(module) {
|
|
32047
|
+
module.exports = {"rE":"0.7.0"}
|
|
32048
|
+
|
|
29618
32049
|
},
|
|
29619
32050
|
|
|
29620
32051
|
});
|
|
@@ -29679,85 +32110,112 @@ __webpack_require__.r = (exports) => {
|
|
|
29679
32110
|
var __webpack_exports__ = {};
|
|
29680
32111
|
/* import */ var node_worker_threads__rspack_import_0 = __webpack_require__("node:worker_threads");
|
|
29681
32112
|
/* import */ var react__rspack_import_1 = __webpack_require__("./node_modules/react/react.react-server.js");
|
|
29682
|
-
/* import */ var
|
|
29683
|
-
/* import */ var
|
|
29684
|
-
/* import */ var
|
|
32113
|
+
/* import */ var _agent_bundle_runtime_flight_server__rspack_import_37 = __webpack_require__("./node_modules/@agent-bundle/runtime/dist/flight/server.js");
|
|
32114
|
+
/* import */ var _agent_bundle_runtime__rspack_import_35 = __webpack_require__("./node_modules/@agent-bundle/runtime/dist/49.js");
|
|
32115
|
+
/* import */ var _agent_bundle_runtime__rspack_import_36 = __webpack_require__("./node_modules/@agent-bundle/runtime/dist/736.js");
|
|
29685
32116
|
/* import */ var node_url__rspack_import_2 = __webpack_require__("node:url");
|
|
29686
|
-
/* import */ var
|
|
29687
|
-
/* import */ var
|
|
29688
|
-
/* import */ var
|
|
29689
|
-
/* import */ var
|
|
29690
|
-
/* import */ var
|
|
29691
|
-
/* import */ var
|
|
29692
|
-
/* import */ var
|
|
29693
|
-
/* import */ var
|
|
29694
|
-
/* import */ var
|
|
29695
|
-
/* import */ var
|
|
29696
|
-
/* import */ var
|
|
29697
|
-
/* import */ var
|
|
29698
|
-
/* import */ var
|
|
29699
|
-
/* import */ var
|
|
29700
|
-
/* import */ var
|
|
29701
|
-
/* import */ var
|
|
29702
|
-
/* import */ var
|
|
29703
|
-
/* import */ var
|
|
29704
|
-
/* import */ var
|
|
29705
|
-
/* import */ var
|
|
29706
|
-
/* import */ var
|
|
29707
|
-
/* import */ var
|
|
29708
|
-
/* import */ var
|
|
32117
|
+
/* import */ var _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_approvals_list_tsx__rspack_import_3 = __webpack_require__("./src/cli/approvals/list.tsx");
|
|
32118
|
+
/* import */ var _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_approvals_respond_tsx__rspack_import_4 = __webpack_require__("./src/cli/approvals/respond.tsx");
|
|
32119
|
+
/* import */ var _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_bots_create_tsx__rspack_import_5 = __webpack_require__("./src/cli/bots/create.tsx");
|
|
32120
|
+
/* import */ var _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_bots_delete_tsx__rspack_import_6 = __webpack_require__("./src/cli/bots/delete.tsx");
|
|
32121
|
+
/* import */ var _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_bots_get_tsx__rspack_import_7 = __webpack_require__("./src/cli/bots/get.tsx");
|
|
32122
|
+
/* import */ var _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_bots_list_tsx__rspack_import_8 = __webpack_require__("./src/cli/bots/list.tsx");
|
|
32123
|
+
/* import */ var _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_bots_update_tsx__rspack_import_9 = __webpack_require__("./src/cli/bots/update.tsx");
|
|
32124
|
+
/* import */ var _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_codex_bridge_respond_tsx__rspack_import_10 = __webpack_require__("./src/cli/codex/bridge/respond.tsx");
|
|
32125
|
+
/* import */ var _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_codex_bridge_run_tsx__rspack_import_11 = __webpack_require__("./src/cli/codex/bridge/run.tsx");
|
|
32126
|
+
/* import */ var _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_codex_bridge_start_tsx__rspack_import_12 = __webpack_require__("./src/cli/codex/bridge/start.tsx");
|
|
32127
|
+
/* import */ var _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_codex_bridge_status_tsx__rspack_import_13 = __webpack_require__("./src/cli/codex/bridge/status.tsx");
|
|
32128
|
+
/* import */ var _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_codex_bridge_stop_tsx__rspack_import_14 = __webpack_require__("./src/cli/codex/bridge/stop.tsx");
|
|
32129
|
+
/* import */ var _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_codex_desktop_shim_tsx__rspack_import_15 = __webpack_require__("./src/cli/codex/desktop-shim.tsx");
|
|
32130
|
+
/* import */ var _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_codex_list_threads_tsx__rspack_import_16 = __webpack_require__("./src/cli/codex/list-threads.tsx");
|
|
32131
|
+
/* import */ var _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_codex_queue_tsx__rspack_import_17 = __webpack_require__("./src/cli/codex/queue.tsx");
|
|
32132
|
+
/* import */ var _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_codex_send_tsx__rspack_import_18 = __webpack_require__("./src/cli/codex/send.tsx");
|
|
32133
|
+
/* import */ var _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_codex_status_tsx__rspack_import_19 = __webpack_require__("./src/cli/codex/status.tsx");
|
|
32134
|
+
/* import */ var _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_codex_wait_tsx__rspack_import_20 = __webpack_require__("./src/cli/codex/wait.tsx");
|
|
32135
|
+
/* import */ var _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_codex_watch_tsx__rspack_import_21 = __webpack_require__("./src/cli/codex/watch.tsx");
|
|
32136
|
+
/* import */ var _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_doctor_tsx__rspack_import_22 = __webpack_require__("./src/cli/doctor.tsx");
|
|
32137
|
+
/* import */ var _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_groups_add_tsx__rspack_import_23 = __webpack_require__("./src/cli/groups/add.tsx");
|
|
32138
|
+
/* import */ var _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_groups_create_tsx__rspack_import_24 = __webpack_require__("./src/cli/groups/create.tsx");
|
|
32139
|
+
/* import */ var _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_groups_delete_tsx__rspack_import_25 = __webpack_require__("./src/cli/groups/delete.tsx");
|
|
32140
|
+
/* import */ var _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_groups_get_tsx__rspack_import_26 = __webpack_require__("./src/cli/groups/get.tsx");
|
|
32141
|
+
/* import */ var _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_groups_list_tsx__rspack_import_27 = __webpack_require__("./src/cli/groups/list.tsx");
|
|
32142
|
+
/* import */ var _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_groups_members_tsx__rspack_import_28 = __webpack_require__("./src/cli/groups/members.tsx");
|
|
32143
|
+
/* import */ var _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_groups_remove_tsx__rspack_import_29 = __webpack_require__("./src/cli/groups/remove.tsx");
|
|
32144
|
+
/* import */ var _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_groups_set_tsx__rspack_import_30 = __webpack_require__("./src/cli/groups/set.tsx");
|
|
32145
|
+
/* import */ var _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_groups_update_tsx__rspack_import_31 = __webpack_require__("./src/cli/groups/update.tsx");
|
|
32146
|
+
/* import */ var _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_history_tsx__rspack_import_32 = __webpack_require__("./src/cli/history.tsx");
|
|
32147
|
+
/* import */ var _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_send_tsx__rspack_import_33 = __webpack_require__("./src/cli/send.tsx");
|
|
32148
|
+
/* import */ var _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_thread_tsx__rspack_import_34 = __webpack_require__("./src/cli/thread.tsx");
|
|
32149
|
+
|
|
32150
|
+
|
|
32151
|
+
|
|
32152
|
+
|
|
32153
|
+
|
|
32154
|
+
|
|
32155
|
+
const route0 = Object.assign({}, Reflect.get(_home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_approvals_list_tsx__rspack_import_3, 'default'), _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_approvals_list_tsx__rspack_import_3);
|
|
32156
|
+
|
|
32157
|
+
const route1 = Object.assign({}, Reflect.get(_home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_approvals_respond_tsx__rspack_import_4, 'default'), _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_approvals_respond_tsx__rspack_import_4);
|
|
32158
|
+
|
|
32159
|
+
const route2 = Object.assign({}, Reflect.get(_home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_bots_create_tsx__rspack_import_5, 'default'), _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_bots_create_tsx__rspack_import_5);
|
|
32160
|
+
|
|
32161
|
+
const route3 = Object.assign({}, Reflect.get(_home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_bots_delete_tsx__rspack_import_6, 'default'), _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_bots_delete_tsx__rspack_import_6);
|
|
29709
32162
|
|
|
32163
|
+
const route4 = Object.assign({}, Reflect.get(_home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_bots_get_tsx__rspack_import_7, 'default'), _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_bots_get_tsx__rspack_import_7);
|
|
29710
32164
|
|
|
32165
|
+
const route5 = Object.assign({}, Reflect.get(_home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_bots_list_tsx__rspack_import_8, 'default'), _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_bots_list_tsx__rspack_import_8);
|
|
29711
32166
|
|
|
32167
|
+
const route6 = Object.assign({}, Reflect.get(_home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_bots_update_tsx__rspack_import_9, 'default'), _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_bots_update_tsx__rspack_import_9);
|
|
29712
32168
|
|
|
32169
|
+
const route7 = Object.assign({}, Reflect.get(_home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_codex_bridge_respond_tsx__rspack_import_10, 'default'), _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_codex_bridge_respond_tsx__rspack_import_10);
|
|
29713
32170
|
|
|
32171
|
+
const route8 = Object.assign({}, Reflect.get(_home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_codex_bridge_run_tsx__rspack_import_11, 'default'), _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_codex_bridge_run_tsx__rspack_import_11);
|
|
29714
32172
|
|
|
29715
|
-
const
|
|
32173
|
+
const route9 = Object.assign({}, Reflect.get(_home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_codex_bridge_start_tsx__rspack_import_12, 'default'), _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_codex_bridge_start_tsx__rspack_import_12);
|
|
29716
32174
|
|
|
29717
|
-
const
|
|
32175
|
+
const route10 = Object.assign({}, Reflect.get(_home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_codex_bridge_status_tsx__rspack_import_13, 'default'), _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_codex_bridge_status_tsx__rspack_import_13);
|
|
29718
32176
|
|
|
29719
|
-
const
|
|
32177
|
+
const route11 = Object.assign({}, Reflect.get(_home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_codex_bridge_stop_tsx__rspack_import_14, 'default'), _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_codex_bridge_stop_tsx__rspack_import_14);
|
|
29720
32178
|
|
|
29721
|
-
const
|
|
32179
|
+
const route12 = Object.assign({}, Reflect.get(_home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_codex_desktop_shim_tsx__rspack_import_15, 'default'), _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_codex_desktop_shim_tsx__rspack_import_15);
|
|
29722
32180
|
|
|
29723
|
-
const
|
|
32181
|
+
const route13 = Object.assign({}, Reflect.get(_home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_codex_list_threads_tsx__rspack_import_16, 'default'), _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_codex_list_threads_tsx__rspack_import_16);
|
|
29724
32182
|
|
|
29725
|
-
const
|
|
32183
|
+
const route14 = Object.assign({}, Reflect.get(_home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_codex_queue_tsx__rspack_import_17, 'default'), _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_codex_queue_tsx__rspack_import_17);
|
|
29726
32184
|
|
|
29727
|
-
const
|
|
32185
|
+
const route15 = Object.assign({}, Reflect.get(_home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_codex_send_tsx__rspack_import_18, 'default'), _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_codex_send_tsx__rspack_import_18);
|
|
29728
32186
|
|
|
29729
|
-
const
|
|
32187
|
+
const route16 = Object.assign({}, Reflect.get(_home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_codex_status_tsx__rspack_import_19, 'default'), _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_codex_status_tsx__rspack_import_19);
|
|
29730
32188
|
|
|
29731
|
-
const
|
|
32189
|
+
const route17 = Object.assign({}, Reflect.get(_home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_codex_wait_tsx__rspack_import_20, 'default'), _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_codex_wait_tsx__rspack_import_20);
|
|
29732
32190
|
|
|
29733
|
-
const
|
|
32191
|
+
const route18 = Object.assign({}, Reflect.get(_home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_codex_watch_tsx__rspack_import_21, 'default'), _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_codex_watch_tsx__rspack_import_21);
|
|
29734
32192
|
|
|
29735
|
-
const
|
|
32193
|
+
const route19 = Object.assign({}, Reflect.get(_home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_doctor_tsx__rspack_import_22, 'default'), _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_doctor_tsx__rspack_import_22);
|
|
29736
32194
|
|
|
29737
|
-
const
|
|
32195
|
+
const route20 = Object.assign({}, Reflect.get(_home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_groups_add_tsx__rspack_import_23, 'default'), _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_groups_add_tsx__rspack_import_23);
|
|
29738
32196
|
|
|
29739
|
-
const
|
|
32197
|
+
const route21 = Object.assign({}, Reflect.get(_home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_groups_create_tsx__rspack_import_24, 'default'), _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_groups_create_tsx__rspack_import_24);
|
|
29740
32198
|
|
|
29741
|
-
const
|
|
32199
|
+
const route22 = Object.assign({}, Reflect.get(_home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_groups_delete_tsx__rspack_import_25, 'default'), _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_groups_delete_tsx__rspack_import_25);
|
|
29742
32200
|
|
|
29743
|
-
const
|
|
32201
|
+
const route23 = Object.assign({}, Reflect.get(_home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_groups_get_tsx__rspack_import_26, 'default'), _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_groups_get_tsx__rspack_import_26);
|
|
29744
32202
|
|
|
29745
|
-
const
|
|
32203
|
+
const route24 = Object.assign({}, Reflect.get(_home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_groups_list_tsx__rspack_import_27, 'default'), _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_groups_list_tsx__rspack_import_27);
|
|
29746
32204
|
|
|
29747
|
-
const
|
|
32205
|
+
const route25 = Object.assign({}, Reflect.get(_home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_groups_members_tsx__rspack_import_28, 'default'), _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_groups_members_tsx__rspack_import_28);
|
|
29748
32206
|
|
|
29749
|
-
const
|
|
32207
|
+
const route26 = Object.assign({}, Reflect.get(_home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_groups_remove_tsx__rspack_import_29, 'default'), _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_groups_remove_tsx__rspack_import_29);
|
|
29750
32208
|
|
|
29751
|
-
const
|
|
32209
|
+
const route27 = Object.assign({}, Reflect.get(_home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_groups_set_tsx__rspack_import_30, 'default'), _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_groups_set_tsx__rspack_import_30);
|
|
29752
32210
|
|
|
29753
|
-
const
|
|
32211
|
+
const route28 = Object.assign({}, Reflect.get(_home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_groups_update_tsx__rspack_import_31, 'default'), _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_groups_update_tsx__rspack_import_31);
|
|
29754
32212
|
|
|
29755
|
-
const
|
|
32213
|
+
const route29 = Object.assign({}, Reflect.get(_home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_history_tsx__rspack_import_32, 'default'), _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_history_tsx__rspack_import_32);
|
|
29756
32214
|
|
|
29757
|
-
const
|
|
32215
|
+
const route30 = Object.assign({}, Reflect.get(_home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_send_tsx__rspack_import_33, 'default'), _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_send_tsx__rspack_import_33);
|
|
29758
32216
|
|
|
29759
|
-
const
|
|
29760
|
-
const pluginRoot = (0,
|
|
32217
|
+
const route31 = Object.assign({}, Reflect.get(_home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_thread_tsx__rspack_import_34, 'default'), _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_thread_tsx__rspack_import_34);
|
|
32218
|
+
const pluginRoot = (0,_agent_bundle_runtime__rspack_import_35/* .resolvePluginRoot */.E7)({
|
|
29761
32219
|
fallback: (0,node_url__rspack_import_2.fileURLToPath)(new URL('..', import.meta.url)),
|
|
29762
32220
|
stateAnchor: 'user-data'
|
|
29763
32221
|
});
|
|
@@ -29775,143 +32233,197 @@ const processLifetime = {
|
|
|
29775
32233
|
};
|
|
29776
32234
|
const composeLayouts = (route, props)=>/*#__PURE__*/ (0,react__rspack_import_1.createElement)(route.module.default, props);
|
|
29777
32235
|
const routes = Object.freeze({
|
|
32236
|
+
"cli:approvals/list": Object.freeze({
|
|
32237
|
+
id: "cli:approvals/list",
|
|
32238
|
+
kind: "cli",
|
|
32239
|
+
name: "approvals list",
|
|
32240
|
+
module: route0
|
|
32241
|
+
}),
|
|
32242
|
+
"cli:approvals/respond": Object.freeze({
|
|
32243
|
+
id: "cli:approvals/respond",
|
|
32244
|
+
kind: "cli",
|
|
32245
|
+
name: "approvals respond",
|
|
32246
|
+
module: route1
|
|
32247
|
+
}),
|
|
29778
32248
|
"cli:bots/create": Object.freeze({
|
|
29779
32249
|
id: "cli:bots/create",
|
|
29780
32250
|
kind: "cli",
|
|
29781
32251
|
name: "bots create",
|
|
29782
|
-
module:
|
|
32252
|
+
module: route2
|
|
29783
32253
|
}),
|
|
29784
32254
|
"cli:bots/delete": Object.freeze({
|
|
29785
32255
|
id: "cli:bots/delete",
|
|
29786
32256
|
kind: "cli",
|
|
29787
32257
|
name: "bots delete",
|
|
29788
|
-
module:
|
|
32258
|
+
module: route3
|
|
29789
32259
|
}),
|
|
29790
32260
|
"cli:bots/get": Object.freeze({
|
|
29791
32261
|
id: "cli:bots/get",
|
|
29792
32262
|
kind: "cli",
|
|
29793
32263
|
name: "bots get",
|
|
29794
|
-
module:
|
|
32264
|
+
module: route4
|
|
29795
32265
|
}),
|
|
29796
32266
|
"cli:bots/list": Object.freeze({
|
|
29797
32267
|
id: "cli:bots/list",
|
|
29798
32268
|
kind: "cli",
|
|
29799
32269
|
name: "bots list",
|
|
29800
|
-
module:
|
|
32270
|
+
module: route5
|
|
29801
32271
|
}),
|
|
29802
32272
|
"cli:bots/update": Object.freeze({
|
|
29803
32273
|
id: "cli:bots/update",
|
|
29804
32274
|
kind: "cli",
|
|
29805
32275
|
name: "bots update",
|
|
29806
|
-
module:
|
|
32276
|
+
module: route6
|
|
32277
|
+
}),
|
|
32278
|
+
"cli:codex/bridge/respond": Object.freeze({
|
|
32279
|
+
id: "cli:codex/bridge/respond",
|
|
32280
|
+
kind: "cli",
|
|
32281
|
+
name: "codex bridge respond",
|
|
32282
|
+
module: route7
|
|
32283
|
+
}),
|
|
32284
|
+
"cli:codex/bridge/run": Object.freeze({
|
|
32285
|
+
id: "cli:codex/bridge/run",
|
|
32286
|
+
kind: "cli",
|
|
32287
|
+
name: "codex bridge run",
|
|
32288
|
+
module: route8
|
|
32289
|
+
}),
|
|
32290
|
+
"cli:codex/bridge/start": Object.freeze({
|
|
32291
|
+
id: "cli:codex/bridge/start",
|
|
32292
|
+
kind: "cli",
|
|
32293
|
+
name: "codex bridge start",
|
|
32294
|
+
module: route9
|
|
32295
|
+
}),
|
|
32296
|
+
"cli:codex/bridge/status": Object.freeze({
|
|
32297
|
+
id: "cli:codex/bridge/status",
|
|
32298
|
+
kind: "cli",
|
|
32299
|
+
name: "codex bridge status",
|
|
32300
|
+
module: route10
|
|
32301
|
+
}),
|
|
32302
|
+
"cli:codex/bridge/stop": Object.freeze({
|
|
32303
|
+
id: "cli:codex/bridge/stop",
|
|
32304
|
+
kind: "cli",
|
|
32305
|
+
name: "codex bridge stop",
|
|
32306
|
+
module: route11
|
|
29807
32307
|
}),
|
|
29808
32308
|
"cli:codex/desktop-shim": Object.freeze({
|
|
29809
32309
|
id: "cli:codex/desktop-shim",
|
|
29810
32310
|
kind: "cli",
|
|
29811
32311
|
name: "codex desktop-shim",
|
|
29812
|
-
module:
|
|
32312
|
+
module: route12
|
|
29813
32313
|
}),
|
|
29814
32314
|
"cli:codex/list-threads": Object.freeze({
|
|
29815
32315
|
id: "cli:codex/list-threads",
|
|
29816
32316
|
kind: "cli",
|
|
29817
32317
|
name: "codex list-threads",
|
|
29818
|
-
module:
|
|
32318
|
+
module: route13
|
|
29819
32319
|
}),
|
|
29820
32320
|
"cli:codex/queue": Object.freeze({
|
|
29821
32321
|
id: "cli:codex/queue",
|
|
29822
32322
|
kind: "cli",
|
|
29823
32323
|
name: "codex queue",
|
|
29824
|
-
module:
|
|
32324
|
+
module: route14
|
|
29825
32325
|
}),
|
|
29826
32326
|
"cli:codex/send": Object.freeze({
|
|
29827
32327
|
id: "cli:codex/send",
|
|
29828
32328
|
kind: "cli",
|
|
29829
32329
|
name: "codex send",
|
|
29830
|
-
module:
|
|
32330
|
+
module: route15
|
|
29831
32331
|
}),
|
|
29832
32332
|
"cli:codex/status": Object.freeze({
|
|
29833
32333
|
id: "cli:codex/status",
|
|
29834
32334
|
kind: "cli",
|
|
29835
32335
|
name: "codex status",
|
|
29836
|
-
module:
|
|
32336
|
+
module: route16
|
|
32337
|
+
}),
|
|
32338
|
+
"cli:codex/wait": Object.freeze({
|
|
32339
|
+
id: "cli:codex/wait",
|
|
32340
|
+
kind: "cli",
|
|
32341
|
+
name: "codex wait",
|
|
32342
|
+
module: route17
|
|
32343
|
+
}),
|
|
32344
|
+
"cli:codex/watch": Object.freeze({
|
|
32345
|
+
id: "cli:codex/watch",
|
|
32346
|
+
kind: "cli",
|
|
32347
|
+
name: "codex watch",
|
|
32348
|
+
module: route18
|
|
29837
32349
|
}),
|
|
29838
32350
|
"cli:doctor": Object.freeze({
|
|
29839
32351
|
id: "cli:doctor",
|
|
29840
32352
|
kind: "cli",
|
|
29841
32353
|
name: "doctor",
|
|
29842
|
-
module:
|
|
32354
|
+
module: route19
|
|
29843
32355
|
}),
|
|
29844
32356
|
"cli:groups/add": Object.freeze({
|
|
29845
32357
|
id: "cli:groups/add",
|
|
29846
32358
|
kind: "cli",
|
|
29847
32359
|
name: "groups add",
|
|
29848
|
-
module:
|
|
32360
|
+
module: route20
|
|
29849
32361
|
}),
|
|
29850
32362
|
"cli:groups/create": Object.freeze({
|
|
29851
32363
|
id: "cli:groups/create",
|
|
29852
32364
|
kind: "cli",
|
|
29853
32365
|
name: "groups create",
|
|
29854
|
-
module:
|
|
32366
|
+
module: route21
|
|
29855
32367
|
}),
|
|
29856
32368
|
"cli:groups/delete": Object.freeze({
|
|
29857
32369
|
id: "cli:groups/delete",
|
|
29858
32370
|
kind: "cli",
|
|
29859
32371
|
name: "groups delete",
|
|
29860
|
-
module:
|
|
32372
|
+
module: route22
|
|
29861
32373
|
}),
|
|
29862
32374
|
"cli:groups/get": Object.freeze({
|
|
29863
32375
|
id: "cli:groups/get",
|
|
29864
32376
|
kind: "cli",
|
|
29865
32377
|
name: "groups get",
|
|
29866
|
-
module:
|
|
32378
|
+
module: route23
|
|
29867
32379
|
}),
|
|
29868
32380
|
"cli:groups/list": Object.freeze({
|
|
29869
32381
|
id: "cli:groups/list",
|
|
29870
32382
|
kind: "cli",
|
|
29871
32383
|
name: "groups list",
|
|
29872
|
-
module:
|
|
32384
|
+
module: route24
|
|
29873
32385
|
}),
|
|
29874
32386
|
"cli:groups/members": Object.freeze({
|
|
29875
32387
|
id: "cli:groups/members",
|
|
29876
32388
|
kind: "cli",
|
|
29877
32389
|
name: "groups members",
|
|
29878
|
-
module:
|
|
32390
|
+
module: route25
|
|
29879
32391
|
}),
|
|
29880
32392
|
"cli:groups/remove": Object.freeze({
|
|
29881
32393
|
id: "cli:groups/remove",
|
|
29882
32394
|
kind: "cli",
|
|
29883
32395
|
name: "groups remove",
|
|
29884
|
-
module:
|
|
32396
|
+
module: route26
|
|
29885
32397
|
}),
|
|
29886
32398
|
"cli:groups/set": Object.freeze({
|
|
29887
32399
|
id: "cli:groups/set",
|
|
29888
32400
|
kind: "cli",
|
|
29889
32401
|
name: "groups set",
|
|
29890
|
-
module:
|
|
32402
|
+
module: route27
|
|
29891
32403
|
}),
|
|
29892
32404
|
"cli:groups/update": Object.freeze({
|
|
29893
32405
|
id: "cli:groups/update",
|
|
29894
32406
|
kind: "cli",
|
|
29895
32407
|
name: "groups update",
|
|
29896
|
-
module:
|
|
32408
|
+
module: route28
|
|
29897
32409
|
}),
|
|
29898
32410
|
"cli:history": Object.freeze({
|
|
29899
32411
|
id: "cli:history",
|
|
29900
32412
|
kind: "cli",
|
|
29901
32413
|
name: "history",
|
|
29902
|
-
module:
|
|
32414
|
+
module: route29
|
|
29903
32415
|
}),
|
|
29904
32416
|
"cli:send": Object.freeze({
|
|
29905
32417
|
id: "cli:send",
|
|
29906
32418
|
kind: "cli",
|
|
29907
32419
|
name: "send",
|
|
29908
|
-
module:
|
|
32420
|
+
module: route30
|
|
29909
32421
|
}),
|
|
29910
32422
|
"cli:thread": Object.freeze({
|
|
29911
32423
|
id: "cli:thread",
|
|
29912
32424
|
kind: "cli",
|
|
29913
32425
|
name: "thread",
|
|
29914
|
-
module:
|
|
32426
|
+
module: route31
|
|
29915
32427
|
})
|
|
29916
32428
|
});
|
|
29917
32429
|
const requests = new Map();
|
|
@@ -29946,18 +32458,18 @@ const render = async (message)=>{
|
|
|
29946
32458
|
};
|
|
29947
32459
|
try {
|
|
29948
32460
|
const cwd = process.cwd();
|
|
29949
|
-
await (0,
|
|
32461
|
+
await (0,_agent_bundle_runtime__rspack_import_36/* .runAgentRequest */.iC)({
|
|
29950
32462
|
capabilities: {
|
|
29951
|
-
command: (0,
|
|
29952
|
-
filesystem: (0,
|
|
29953
|
-
network: (0,
|
|
29954
|
-
projectRoot: (0,
|
|
32463
|
+
command: (0,_agent_bundle_runtime__rspack_import_36/* .unavailable */.hU)(),
|
|
32464
|
+
filesystem: (0,_agent_bundle_runtime__rspack_import_36/* .unavailable */.hU)(),
|
|
32465
|
+
network: (0,_agent_bundle_runtime__rspack_import_36/* .unavailable */.hU)(),
|
|
32466
|
+
projectRoot: (0,_agent_bundle_runtime__rspack_import_36/* .available */.qC)({
|
|
29955
32467
|
root: cwd
|
|
29956
32468
|
}, 'derived')
|
|
29957
32469
|
},
|
|
29958
|
-
host: (0,
|
|
32470
|
+
host: (0,_agent_bundle_runtime__rspack_import_36/* .unavailable */.hU)('unsupported-surface'),
|
|
29959
32471
|
invocation: message.request,
|
|
29960
|
-
lineage: (0,
|
|
32472
|
+
lineage: (0,_agent_bundle_runtime__rspack_import_36/* .unavailable */.hU)('unsupported-surface'),
|
|
29961
32473
|
plugin: pluginRoot.identity,
|
|
29962
32474
|
progress: {
|
|
29963
32475
|
report: async (update)=>{
|
|
@@ -29970,8 +32482,8 @@ const render = async (message)=>{
|
|
|
29970
32482
|
},
|
|
29971
32483
|
process: processHit,
|
|
29972
32484
|
signal: controller.signal,
|
|
29973
|
-
terminal: message.terminal === undefined ? (0,
|
|
29974
|
-
workspace: (0,
|
|
32485
|
+
terminal: message.terminal === undefined ? (0,_agent_bundle_runtime__rspack_import_36/* .unavailable */.hU)('not-provided') : (0,_agent_bundle_runtime__rspack_import_36/* .available */.qC)(message.terminal, 'native'),
|
|
32486
|
+
workspace: (0,_agent_bundle_runtime__rspack_import_36/* .available */.qC)({
|
|
29975
32487
|
root: cwd
|
|
29976
32488
|
}, 'derived')
|
|
29977
32489
|
}, async ()=>{
|
|
@@ -29980,10 +32492,11 @@ const render = async (message)=>{
|
|
|
29980
32492
|
type: 'observed-render-start'
|
|
29981
32493
|
});
|
|
29982
32494
|
const renderStartedAt = performance.now();
|
|
29983
|
-
const flight = (0,
|
|
32495
|
+
const flight = (0,_agent_bundle_runtime_flight_server__rspack_import_37/* .renderAgentFlight */.y)(composeLayouts(observedRoute, {
|
|
29984
32496
|
...message.props,
|
|
29985
32497
|
signal: controller.signal
|
|
29986
32498
|
}, controller.signal), {
|
|
32499
|
+
onError: ()=>undefined,
|
|
29987
32500
|
signal: controller.signal
|
|
29988
32501
|
});
|
|
29989
32502
|
const reader = flight.getReader();
|