grok-bot-cli 0.5.0 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -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 __rspack_external_node_module_9de3fa2f from "node:module";
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";
@@ -13884,6 +13885,376 @@ __webpack_require__.d(__webpack_exports__, {
13884
13885
  });
13885
13886
 
13886
13887
 
13888
+ },
13889
+ "./src/cli/codex/bridge/respond.tsx"(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
13890
+ __webpack_require__.r(__webpack_exports__);
13891
+ /* import */ var react_jsx_runtime__rspack_import_0 = __webpack_require__("./node_modules/react/jsx-runtime.react-server.js");
13892
+ /* import */ var _agent_bundle_runtime__rspack_import_3 = __webpack_require__("./node_modules/@agent-bundle/runtime/dist/736.js");
13893
+ /* import */ var _agent_bundle_runtime__rspack_import_4 = __webpack_require__("./node_modules/@agent-bundle/runtime/dist/506.js");
13894
+ /* import */ var _core_relay_routes_js__rspack_import_1 = __webpack_require__("./src/core/relay/routes.ts");
13895
+ /* import */ var _core_codex_contract_js__rspack_import_2 = __webpack_require__("./src/core/codex/contract.js");
13896
+
13897
+
13898
+
13899
+
13900
+
13901
+ const config = {
13902
+ description: 'Managed Grok/Codex bridge respond.',
13903
+ exitCode: 'result',
13904
+ inputJsonSchema: {
13905
+ type: 'object',
13906
+ properties: {
13907
+ interactionId: {
13908
+ type: 'string'
13909
+ },
13910
+ generation: {
13911
+ type: 'string'
13912
+ },
13913
+ threadId: {
13914
+ type: 'string'
13915
+ },
13916
+ turnId: {
13917
+ type: 'string'
13918
+ },
13919
+ bindingId: {
13920
+ type: 'string'
13921
+ },
13922
+ exchangeId: {
13923
+ type: 'string'
13924
+ },
13925
+ decision: {
13926
+ type: 'string',
13927
+ enum: [
13928
+ 'accept',
13929
+ 'decline',
13930
+ 'cancel'
13931
+ ]
13932
+ },
13933
+ answersJson: {
13934
+ type: 'string',
13935
+ description: 'JSON object mapping each advertised question ID to {"answers":["answer"]}; exact IDs required.'
13936
+ }
13937
+ },
13938
+ required: [
13939
+ 'interactionId',
13940
+ 'generation',
13941
+ 'threadId',
13942
+ 'turnId'
13943
+ ],
13944
+ additionalProperties: false
13945
+ }
13946
+ };
13947
+ async function route({ input }) {
13948
+ let out;
13949
+ try {
13950
+ out = {
13951
+ ...await (0,_core_relay_routes_js__rspack_import_1/* .bridgeOperation */.n1)('respond', input, await (0,_agent_bundle_runtime__rspack_import_3/* .agent */.MA)()),
13952
+ exitCode: 0
13953
+ };
13954
+ } catch (error) {
13955
+ out = (0,_core_codex_contract_js__rspack_import_2/* .outcomeFromError */.DG)(error);
13956
+ }
13957
+ return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_4/* .Agent.Result */.g6.Result, {
13958
+ value: out,
13959
+ children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_4/* .Agent.Text */.g6.Text, {
13960
+ children: JSON.stringify(out)
13961
+ })
13962
+ });
13963
+ }
13964
+
13965
+ __webpack_require__.d(__webpack_exports__, {
13966
+ "default": () => (route),
13967
+ inputSchema: () => (/* reexport safe */ _core_relay_routes_js__rspack_import_1.v1),
13968
+ resultSchema: () => (/* reexport safe */ _core_relay_routes_js__rspack_import_1.Ax)
13969
+ }, {
13970
+ config: config
13971
+ });
13972
+
13973
+
13974
+ },
13975
+ "./src/cli/codex/bridge/run.tsx"(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
13976
+ __webpack_require__.r(__webpack_exports__);
13977
+ /* import */ var react_jsx_runtime__rspack_import_0 = __webpack_require__("./node_modules/react/jsx-runtime.react-server.js");
13978
+ /* import */ var _agent_bundle_runtime__rspack_import_4 = __webpack_require__("./node_modules/@agent-bundle/runtime/dist/736.js");
13979
+ /* import */ var _agent_bundle_runtime__rspack_import_5 = __webpack_require__("./node_modules/@agent-bundle/runtime/dist/506.js");
13980
+ /* import */ var node_child_process__rspack_import_1 = __webpack_require__("node:child_process");
13981
+ /* import */ var zod__rspack_import_3 = __webpack_require__("./node_modules/zod/v4/classic/schemas.js");
13982
+ /* import */ var _core_relay_managed_js__rspack_import_2 = __webpack_require__("./src/core/relay/managed.js");
13983
+
13984
+
13985
+
13986
+
13987
+
13988
+ const inputSchema = zod__rspack_import_3/* .object */.Ikc({
13989
+ lifetimeMs: zod__rspack_import_3/* .number */.aig().int().min(100).max(82800000).default(82800000)
13990
+ }).strict();
13991
+ const resultSchema = zod__rspack_import_3/* .object */.Ikc({
13992
+ state: zod__rspack_import_3/* .string */.YjP(),
13993
+ exitCode: zod__rspack_import_3/* .number */.aig()
13994
+ });
13995
+ const config = {
13996
+ description: 'Run a bounded foreground relay (up to 23 hours). Use the packaged gbot-relay.mjs script for unlimited service lifetime.',
13997
+ exitCode: 'result',
13998
+ render: {
13999
+ maxElapsedMs: 86400000
14000
+ },
14001
+ inputJsonSchema: {
14002
+ type: 'object',
14003
+ properties: {
14004
+ lifetimeMs: {
14005
+ type: 'number',
14006
+ description: 'Foreground lifetime in milliseconds (100..82800000; default 23h).'
14007
+ }
14008
+ },
14009
+ additionalProperties: false
14010
+ }
14011
+ };
14012
+ async function route({ signal, input }) {
14013
+ const context = await (0,_agent_bundle_runtime__rspack_import_4/* .agent */.MA)();
14014
+ const script = await (0,_core_relay_managed_js__rspack_import_2/* .resolveRelayWorker */._v)({
14015
+ pluginRoot: context.plugin.state === 'available' ? context.plugin.value.root : undefined
14016
+ });
14017
+ // The renderer may terminate immediately on abort. The separate worker can finish
14018
+ // asynchronous socket/ledger cleanup after the synchronous termination signal.
14019
+ const child = (0,node_child_process__rspack_import_1.spawn)(process.execPath, [
14020
+ script,
14021
+ '--lifetime-ms',
14022
+ String(input.lifetimeMs),
14023
+ '--parent-pid',
14024
+ String(process.pid)
14025
+ ], {
14026
+ stdio: [
14027
+ 'ignore',
14028
+ 'ignore',
14029
+ 'inherit'
14030
+ ]
14031
+ });
14032
+ const stop = ()=>{
14033
+ child.kill('SIGTERM');
14034
+ };
14035
+ signal.addEventListener('abort', stop, {
14036
+ once: true
14037
+ });
14038
+ if (signal.aborted) stop();
14039
+ let exitCode;
14040
+ try {
14041
+ exitCode = await new Promise((resolve, reject)=>{
14042
+ child.once('error', reject);
14043
+ child.once('exit', (code)=>resolve(code ?? 1));
14044
+ });
14045
+ } finally{
14046
+ signal.removeEventListener('abort', stop);
14047
+ }
14048
+ return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_5/* .Agent.Result */.g6.Result, {
14049
+ value: {
14050
+ state: 'stopped',
14051
+ exitCode
14052
+ },
14053
+ children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_5/* .Agent.Text */.g6.Text, {
14054
+ children: "Relay worker stopped."
14055
+ })
14056
+ });
14057
+ }
14058
+
14059
+ __webpack_require__.d(__webpack_exports__, {
14060
+ "default": () => (route)
14061
+ }, {
14062
+ config: config,
14063
+ inputSchema: inputSchema,
14064
+ resultSchema: resultSchema
14065
+ });
14066
+
14067
+
14068
+ },
14069
+ "./src/cli/codex/bridge/start.tsx"(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
14070
+ __webpack_require__.r(__webpack_exports__);
14071
+ /* import */ var react_jsx_runtime__rspack_import_0 = __webpack_require__("./node_modules/react/jsx-runtime.react-server.js");
14072
+ /* import */ var _agent_bundle_runtime__rspack_import_3 = __webpack_require__("./node_modules/@agent-bundle/runtime/dist/736.js");
14073
+ /* import */ var _agent_bundle_runtime__rspack_import_4 = __webpack_require__("./node_modules/@agent-bundle/runtime/dist/506.js");
14074
+ /* import */ var _core_relay_routes_js__rspack_import_1 = __webpack_require__("./src/core/relay/routes.ts");
14075
+ /* import */ var _core_codex_contract_js__rspack_import_2 = __webpack_require__("./src/core/codex/contract.js");
14076
+
14077
+
14078
+
14079
+
14080
+
14081
+ const config = {
14082
+ description: 'Managed Grok/Codex bridge start.',
14083
+ exitCode: 'result',
14084
+ positionals: [
14085
+ 'grokTarget'
14086
+ ],
14087
+ inputJsonSchema: {
14088
+ type: 'object',
14089
+ properties: {
14090
+ grokTarget: {
14091
+ type: 'string'
14092
+ },
14093
+ codexThreadId: {
14094
+ type: 'string'
14095
+ },
14096
+ expectedCwd: {
14097
+ type: 'string'
14098
+ },
14099
+ busyPolicy: {
14100
+ type: 'string',
14101
+ enum: [
14102
+ 'steer',
14103
+ 'reject'
14104
+ ]
14105
+ },
14106
+ requestId: {
14107
+ type: 'string'
14108
+ }
14109
+ },
14110
+ required: [
14111
+ 'grokTarget'
14112
+ ],
14113
+ additionalProperties: false
14114
+ }
14115
+ };
14116
+ async function route({ input }) {
14117
+ let out;
14118
+ try {
14119
+ out = {
14120
+ ...await (0,_core_relay_routes_js__rspack_import_1/* .bridgeOperation */.n1)('startBinding', input, await (0,_agent_bundle_runtime__rspack_import_3/* .agent */.MA)()),
14121
+ exitCode: 0
14122
+ };
14123
+ } catch (error) {
14124
+ out = (0,_core_codex_contract_js__rspack_import_2/* .outcomeFromError */.DG)(error);
14125
+ }
14126
+ return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_4/* .Agent.Result */.g6.Result, {
14127
+ value: out,
14128
+ children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_4/* .Agent.Text */.g6.Text, {
14129
+ children: JSON.stringify(out)
14130
+ })
14131
+ });
14132
+ }
14133
+
14134
+ __webpack_require__.d(__webpack_exports__, {
14135
+ "default": () => (route),
14136
+ inputSchema: () => (/* reexport safe */ _core_relay_routes_js__rspack_import_1.xD),
14137
+ resultSchema: () => (/* reexport safe */ _core_relay_routes_js__rspack_import_1.Ax)
14138
+ }, {
14139
+ config: config
14140
+ });
14141
+
14142
+
14143
+ },
14144
+ "./src/cli/codex/bridge/status.tsx"(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
14145
+ __webpack_require__.r(__webpack_exports__);
14146
+ /* import */ var react_jsx_runtime__rspack_import_0 = __webpack_require__("./node_modules/react/jsx-runtime.react-server.js");
14147
+ /* import */ var _agent_bundle_runtime__rspack_import_3 = __webpack_require__("./node_modules/@agent-bundle/runtime/dist/736.js");
14148
+ /* import */ var _agent_bundle_runtime__rspack_import_4 = __webpack_require__("./node_modules/@agent-bundle/runtime/dist/506.js");
14149
+ /* import */ var _core_relay_routes_js__rspack_import_1 = __webpack_require__("./src/core/relay/routes.ts");
14150
+ /* import */ var _core_codex_contract_js__rspack_import_2 = __webpack_require__("./src/core/codex/contract.js");
14151
+
14152
+
14153
+
14154
+
14155
+
14156
+ const config = {
14157
+ description: 'Managed Grok/Codex bridge status.',
14158
+ exitCode: 'result',
14159
+ inputJsonSchema: {
14160
+ type: 'object',
14161
+ properties: {
14162
+ bindingId: {
14163
+ type: 'string'
14164
+ },
14165
+ limit: {
14166
+ type: 'number'
14167
+ }
14168
+ },
14169
+ additionalProperties: false
14170
+ }
14171
+ };
14172
+ async function route({ input }) {
14173
+ let out;
14174
+ try {
14175
+ out = {
14176
+ ...await (0,_core_relay_routes_js__rspack_import_1/* .bridgeOperation */.n1)('status', input, await (0,_agent_bundle_runtime__rspack_import_3/* .agent */.MA)()),
14177
+ exitCode: 0
14178
+ };
14179
+ } catch (error) {
14180
+ out = (0,_core_codex_contract_js__rspack_import_2/* .outcomeFromError */.DG)(error);
14181
+ }
14182
+ return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_4/* .Agent.Result */.g6.Result, {
14183
+ value: out,
14184
+ children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_4/* .Agent.Text */.g6.Text, {
14185
+ children: JSON.stringify(out)
14186
+ })
14187
+ });
14188
+ }
14189
+
14190
+ __webpack_require__.d(__webpack_exports__, {
14191
+ "default": () => (route),
14192
+ inputSchema: () => (/* reexport safe */ _core_relay_routes_js__rspack_import_1.np),
14193
+ resultSchema: () => (/* reexport safe */ _core_relay_routes_js__rspack_import_1.Ax)
14194
+ }, {
14195
+ config: config
14196
+ });
14197
+
14198
+
14199
+ },
14200
+ "./src/cli/codex/bridge/stop.tsx"(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
14201
+ __webpack_require__.r(__webpack_exports__);
14202
+ /* import */ var react_jsx_runtime__rspack_import_0 = __webpack_require__("./node_modules/react/jsx-runtime.react-server.js");
14203
+ /* import */ var _agent_bundle_runtime__rspack_import_3 = __webpack_require__("./node_modules/@agent-bundle/runtime/dist/736.js");
14204
+ /* import */ var _agent_bundle_runtime__rspack_import_4 = __webpack_require__("./node_modules/@agent-bundle/runtime/dist/506.js");
14205
+ /* import */ var _core_relay_routes_js__rspack_import_1 = __webpack_require__("./src/core/relay/routes.ts");
14206
+ /* import */ var _core_codex_contract_js__rspack_import_2 = __webpack_require__("./src/core/codex/contract.js");
14207
+
14208
+
14209
+
14210
+
14211
+
14212
+ const config = {
14213
+ description: 'Managed Grok/Codex bridge stop.',
14214
+ exitCode: 'result',
14215
+ inputJsonSchema: {
14216
+ type: 'object',
14217
+ properties: {
14218
+ bindingId: {
14219
+ type: 'string'
14220
+ },
14221
+ all: {
14222
+ type: 'boolean'
14223
+ },
14224
+ worker: {
14225
+ type: 'boolean'
14226
+ }
14227
+ },
14228
+ additionalProperties: false
14229
+ }
14230
+ };
14231
+ async function route({ input }) {
14232
+ let out;
14233
+ try {
14234
+ out = {
14235
+ ...await (0,_core_relay_routes_js__rspack_import_1/* .bridgeOperation */.n1)('stop', input, await (0,_agent_bundle_runtime__rspack_import_3/* .agent */.MA)()),
14236
+ exitCode: 0
14237
+ };
14238
+ } catch (error) {
14239
+ out = (0,_core_codex_contract_js__rspack_import_2/* .outcomeFromError */.DG)(error);
14240
+ }
14241
+ return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_4/* .Agent.Result */.g6.Result, {
14242
+ value: out,
14243
+ children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_4/* .Agent.Text */.g6.Text, {
14244
+ children: JSON.stringify(out)
14245
+ })
14246
+ });
14247
+ }
14248
+
14249
+ __webpack_require__.d(__webpack_exports__, {
14250
+ "default": () => (route),
14251
+ inputSchema: () => (/* reexport safe */ _core_relay_routes_js__rspack_import_1.d5),
14252
+ resultSchema: () => (/* reexport safe */ _core_relay_routes_js__rspack_import_1.Ax)
14253
+ }, {
14254
+ config: config
14255
+ });
14256
+
14257
+
13887
14258
  },
13888
14259
  "./src/cli/codex/desktop-shim.tsx"(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
13889
14260
  __webpack_require__.r(__webpack_exports__);
@@ -14194,117 +14565,145 @@ __webpack_require__.d(__webpack_exports__, {
14194
14565
  "./src/cli/codex/send.tsx"(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
14195
14566
  __webpack_require__.r(__webpack_exports__);
14196
14567
  /* 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/506.js");
14568
+ /* import */ var _agent_bundle_runtime__rspack_import_4 = __webpack_require__("./node_modules/@agent-bundle/runtime/dist/736.js");
14569
+ /* import */ var _agent_bundle_runtime__rspack_import_5 = __webpack_require__("./node_modules/@agent-bundle/runtime/dist/506.js");
14198
14570
  /* import */ var zod__rspack_import_3 = __webpack_require__("./node_modules/zod/v4/classic/schemas.js");
14199
- /* import */ var _core_codex_bridge_js__rspack_import_1 = __webpack_require__("./src/core/codex-bridge.js");
14200
- /* import */ var _core_codex_contract_js__rspack_import_2 = __webpack_require__("./src/core/codex/contract.js");
14571
+ /* import */ var _core_codex_routes_js__rspack_import_1 = __webpack_require__("./src/core/codex/routes.ts");
14572
+ /* import */ var _core_relay_routes_js__rspack_import_2 = __webpack_require__("./src/core/relay/routes.ts");
14201
14573
 
14202
14574
 
14203
14575
 
14204
14576
 
14205
14577
 
14578
+ const resultSchema = zod__rspack_import_3/* .union */.KCZ([
14579
+ _core_codex_routes_js__rspack_import_1/* .resultSchema */.FD,
14580
+ _core_relay_routes_js__rspack_import_2/* .relayResultSchema */.Ax
14581
+ ]);
14582
+ const inputSchema = zod__rspack_import_3/* .object */.Ikc({
14583
+ ..._core_codex_routes_js__rspack_import_1/* .sendFields */.at,
14584
+ whenBusy: zod__rspack_import_3/* ["enum"] */.k5n([
14585
+ 'reject',
14586
+ 'queue',
14587
+ 'steer'
14588
+ ]).optional(),
14589
+ replyToGrok: zod__rspack_import_3/* .string */.YjP().min(1).optional(),
14590
+ bindingId: zod__rspack_import_3/* .string */.YjP().min(1).optional(),
14591
+ requestId: zod__rspack_import_3/* .string */.YjP().min(1).max(128).optional(),
14592
+ correlationId: zod__rspack_import_3/* .string */.YjP().min(1).optional(),
14593
+ replyTo: zod__rspack_import_3/* .string */.YjP().min(1).optional(),
14594
+ message: zod__rspack_import_3/* .array */.YOg(zod__rspack_import_3/* .string */.YjP()).min(1)
14595
+ }).strict();
14206
14596
  const config = {
14207
- description: 'Send a message to a Codex thread. Options go before <threadId>; `--` protects flag-like text.',
14597
+ description: 'Send to Codex; acceptance is distinct from completion. Options precede threadId.',
14208
14598
  exitCode: 'result',
14599
+ render: {
14600
+ maxElapsedMs: 660000
14601
+ },
14602
+ positionals: [
14603
+ 'threadId',
14604
+ 'message'
14605
+ ],
14209
14606
  inputJsonSchema: {
14607
+ type: 'object',
14210
14608
  additionalProperties: false,
14211
14609
  properties: {
14212
- correlationId: {
14213
- description: 'Stable correlation id for multi-hop replies',
14610
+ replyToGrok: {
14214
14611
  type: 'string'
14215
14612
  },
14216
- envelope: {
14217
- description: 'Prepend the [gbot …] header to the message body',
14218
- type: 'boolean'
14219
- },
14220
- hop: {
14221
- description: 'Hop count; refused at GROK_BOT_MAX_HOPS',
14222
- type: 'number'
14223
- },
14224
- message: {
14225
- items: {
14226
- type: 'string'
14227
- },
14228
- type: 'array'
14613
+ bindingId: {
14614
+ type: 'string'
14229
14615
  },
14230
- replyTo: {
14231
- description: 'Prior message id this send replies to',
14616
+ requestId: {
14232
14617
  type: 'string'
14233
14618
  },
14234
14619
  threadId: {
14235
14620
  type: 'string'
14236
14621
  },
14237
- whenBusy: {
14238
- description: 'reject (default) or queue (needs GROK_BOT_CODEX_EXPERIMENTAL=1)',
14239
- enum: [
14240
- 'reject',
14241
- 'queue'
14242
- ],
14622
+ expectedCwd: {
14243
14623
  type: 'string'
14244
- }
14245
- },
14246
- required: [
14247
- 'threadId',
14248
- 'message'
14249
- ],
14250
- type: 'object'
14251
- },
14252
- positionals: [
14253
- 'threadId',
14254
- 'message'
14255
- ]
14256
- };
14257
- const inputSchema = zod__rspack_import_3/* .object */.Ikc({
14258
- correlationId: zod__rspack_import_3/* .string */.YjP().min(1).optional(),
14259
- envelope: zod__rspack_import_3/* .boolean */.zMY().optional(),
14260
- hop: zod__rspack_import_3/* .number */.aig().int().min(0).optional(),
14261
- message: zod__rspack_import_3/* .array */.YOg(zod__rspack_import_3/* .string */.YjP()).min(1),
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)
14279
- ])
14280
- }).passthrough();
14281
- async function codexSend({ input }) {
14282
- let out;
14283
- try {
14284
- const envelope = (0,_core_codex_bridge_js__rspack_import_1/* .buildEnvelope */.nq)({
14285
- correlationId: input.correlationId,
14286
- envelope: Boolean(input.envelope),
14287
- hop: input.hop,
14288
- replyTo: input.replyTo
14289
- });
14290
- out = await (0,_core_codex_bridge_js__rspack_import_1/* .sendToCodexThread */.ZS)(input.threadId, input.message.join(' ').trim(), {
14291
- envelope,
14292
- whenBusy: input.whenBusy
14624
+ },
14625
+ timeoutMs: {
14626
+ type: 'number',
14627
+ description: 'Observation timeout: 1-600000 milliseconds.'
14628
+ },
14629
+ correlationId: {
14630
+ type: 'string'
14631
+ },
14632
+ envelope: {
14633
+ type: 'boolean'
14634
+ },
14635
+ hop: {
14636
+ type: 'number'
14637
+ },
14638
+ replyTo: {
14639
+ type: 'string'
14640
+ },
14641
+ expectedTurnId: {
14642
+ type: 'string',
14643
+ description: 'Required active-turn guard for steer; stale guards reject.'
14644
+ },
14645
+ wait: {
14646
+ type: 'boolean'
14647
+ },
14648
+ maxOutputBytes: {
14649
+ type: 'number',
14650
+ description: 'Reply budget: 1-4194304 bytes.'
14651
+ },
14652
+ whenBusy: {
14653
+ type: 'string',
14654
+ enum: [
14655
+ 'reject',
14656
+ 'queue',
14657
+ 'steer'
14658
+ ]
14659
+ },
14660
+ message: {
14661
+ type: 'array',
14662
+ items: {
14663
+ type: 'string'
14664
+ }
14665
+ }
14666
+ },
14667
+ required: [
14668
+ 'threadId',
14669
+ 'message'
14670
+ ]
14671
+ }
14672
+ };
14673
+ async function route({ input, signal }) {
14674
+ const context = await (0,_agent_bundle_runtime__rspack_import_4/* .agent */.MA)();
14675
+ if (input.replyToGrok || input.bindingId) {
14676
+ const out = await (0,_core_relay_routes_js__rspack_import_2/* .codexReturnOperation */.lt)({
14677
+ ...input,
14678
+ message: input.message.join(' ').trim()
14679
+ }, context);
14680
+ return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_5/* .Agent.Result */.g6.Result, {
14681
+ value: {
14682
+ ...out,
14683
+ exitCode: out.delivery === 'rejected' ? 1 : 0
14684
+ },
14685
+ children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_5/* .Agent.Text */.g6.Text, {
14686
+ children: `Delivery ${out.delivery}; terminal answer returns to Grok automatically.`
14687
+ })
14293
14688
  });
14294
- } catch (error) {
14295
- out = (0,_core_codex_contract_js__rspack_import_2/* .outcomeFromError */.DG)(error);
14296
14689
  }
14297
- const text = out.delivery === 'queued' && typeof out.queuedSubmissionId === 'string' ? `Queued ${out.queuedSubmissionId} on busy Codex thread ${out.threadId}; message ${out.messageId}` : out.exitCode === 0 ? `Started turn ${out.turnId} (${out.turnStatus}) on Codex thread ${out.threadId}; message ${out.messageId}` : typeof out.error === 'string' ? out.error : `Codex delivery ${out.delivery} on thread ${out.threadId}`;
14298
- return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_4/* .Agent.Result */.g6.Result, {
14690
+ const out = await (0,_core_codex_routes_js__rspack_import_1/* .sendOperation */.UP)({
14691
+ ...input,
14692
+ whenBusy: input.whenBusy ?? 'reject',
14693
+ message: input.message.join(' ').trim()
14694
+ }, signal, (message)=>context.progress.report({
14695
+ message
14696
+ }), true);
14697
+ return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_5/* .Agent.Result */.g6.Result, {
14299
14698
  value: out,
14300
- children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_4/* .Agent.Text */.g6.Text, {
14301
- children: text
14699
+ children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_5/* .Agent.Text */.g6.Text, {
14700
+ children: (0,_core_codex_routes_js__rspack_import_1/* .resultText */.D6)(out)
14302
14701
  })
14303
14702
  });
14304
14703
  }
14305
14704
 
14306
14705
  __webpack_require__.d(__webpack_exports__, {
14307
- "default": () => (codexSend)
14706
+ "default": () => (route)
14308
14707
  }, {
14309
14708
  config: config,
14310
14709
  inputSchema: inputSchema,
@@ -14360,6 +14759,146 @@ __webpack_require__.d(__webpack_exports__, {
14360
14759
  });
14361
14760
 
14362
14761
 
14762
+ },
14763
+ "./src/cli/codex/wait.tsx"(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
14764
+ __webpack_require__.r(__webpack_exports__);
14765
+ /* import */ var react_jsx_runtime__rspack_import_0 = __webpack_require__("./node_modules/react/jsx-runtime.react-server.js");
14766
+ /* import */ var _agent_bundle_runtime__rspack_import_2 = __webpack_require__("./node_modules/@agent-bundle/runtime/dist/736.js");
14767
+ /* import */ var _agent_bundle_runtime__rspack_import_3 = __webpack_require__("./node_modules/@agent-bundle/runtime/dist/506.js");
14768
+ /* import */ var _core_codex_routes_js__rspack_import_1 = __webpack_require__("./src/core/codex/routes.ts");
14769
+
14770
+
14771
+
14772
+
14773
+ const config = {
14774
+ description: 'Bounded Codex wait observation; never interrupts execution.',
14775
+ exitCode: 'result',
14776
+ render: {
14777
+ maxElapsedMs: 660000
14778
+ },
14779
+ positionals: [
14780
+ 'threadId',
14781
+ 'turnId'
14782
+ ],
14783
+ inputJsonSchema: {
14784
+ type: 'object',
14785
+ additionalProperties: false,
14786
+ properties: {
14787
+ "threadId": {
14788
+ "type": "string"
14789
+ },
14790
+ "expectedCwd": {
14791
+ "type": "string"
14792
+ },
14793
+ "timeoutMs": {
14794
+ "type": "number",
14795
+ "description": "Observation timeout: 1-600000 milliseconds."
14796
+ },
14797
+ "turnId": {
14798
+ "type": "string"
14799
+ },
14800
+ "messageId": {
14801
+ "type": "string"
14802
+ },
14803
+ "maxOutputBytes": {
14804
+ "type": "number",
14805
+ "description": "Reply budget: 1-4194304 bytes."
14806
+ }
14807
+ },
14808
+ required: [
14809
+ 'threadId',
14810
+ 'turnId'
14811
+ ]
14812
+ }
14813
+ };
14814
+ async function route({ input, signal }) {
14815
+ const context = await (0,_agent_bundle_runtime__rspack_import_2/* .agent */.MA)();
14816
+ const out = await (0,_core_codex_routes_js__rspack_import_1/* .observeOperation */.gT)('wait', input, signal, (message)=>context.progress.report({
14817
+ message
14818
+ }));
14819
+ return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Result */.g6.Result, {
14820
+ value: out,
14821
+ children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Text */.g6.Text, {
14822
+ children: (0,_core_codex_routes_js__rspack_import_1/* .resultText */.D6)(out)
14823
+ })
14824
+ });
14825
+ }
14826
+
14827
+ __webpack_require__.d(__webpack_exports__, {
14828
+ "default": () => (route),
14829
+ inputSchema: () => (/* reexport safe */ _core_codex_routes_js__rspack_import_1.jS),
14830
+ resultSchema: () => (/* reexport safe */ _core_codex_routes_js__rspack_import_1.FD)
14831
+ }, {
14832
+ config: config
14833
+ });
14834
+
14835
+
14836
+ },
14837
+ "./src/cli/codex/watch.tsx"(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
14838
+ __webpack_require__.r(__webpack_exports__);
14839
+ /* import */ var react_jsx_runtime__rspack_import_0 = __webpack_require__("./node_modules/react/jsx-runtime.react-server.js");
14840
+ /* import */ var _agent_bundle_runtime__rspack_import_2 = __webpack_require__("./node_modules/@agent-bundle/runtime/dist/736.js");
14841
+ /* import */ var _agent_bundle_runtime__rspack_import_3 = __webpack_require__("./node_modules/@agent-bundle/runtime/dist/506.js");
14842
+ /* import */ var _core_codex_routes_js__rspack_import_1 = __webpack_require__("./src/core/codex/routes.ts");
14843
+
14844
+
14845
+
14846
+
14847
+ const config = {
14848
+ description: 'Bounded Codex watch observation; never interrupts execution.',
14849
+ exitCode: 'result',
14850
+ render: {
14851
+ maxElapsedMs: 660000
14852
+ },
14853
+ positionals: [
14854
+ 'threadId'
14855
+ ],
14856
+ inputJsonSchema: {
14857
+ type: 'object',
14858
+ additionalProperties: false,
14859
+ properties: {
14860
+ "threadId": {
14861
+ "type": "string"
14862
+ },
14863
+ "expectedCwd": {
14864
+ "type": "string"
14865
+ },
14866
+ "timeoutMs": {
14867
+ "type": "number",
14868
+ "description": "Observation timeout: 1-600000 milliseconds."
14869
+ },
14870
+ "maxEvents": {
14871
+ "type": "number",
14872
+ "description": "Maximum observed events: 1-500."
14873
+ }
14874
+ },
14875
+ required: [
14876
+ 'threadId'
14877
+ ]
14878
+ }
14879
+ };
14880
+ async function route({ input, signal }) {
14881
+ const context = await (0,_agent_bundle_runtime__rspack_import_2/* .agent */.MA)();
14882
+ const out = await (0,_core_codex_routes_js__rspack_import_1/* .observeOperation */.gT)('watch', input, signal, (message)=>context.progress.report({
14883
+ message
14884
+ }));
14885
+ return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Result */.g6.Result, {
14886
+ value: out,
14887
+ children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_3/* .Agent.Text */.g6.Text, {
14888
+ children: (0,_core_codex_routes_js__rspack_import_1/* .resultText */.D6)(out)
14889
+ })
14890
+ });
14891
+ }
14892
+
14893
+ __webpack_require__.d(__webpack_exports__, {
14894
+ "default": () => (route),
14895
+ inputSchema: () => (/* reexport safe */ _core_codex_routes_js__rspack_import_1.R9),
14896
+ resultSchema: () => (/* reexport safe */ _core_codex_routes_js__rspack_import_1.FD)
14897
+ }, {
14898
+ config: config
14899
+ });
14900
+
14901
+
14363
14902
  },
14364
14903
  "./src/cli/doctor.tsx"(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
14365
14904
  __webpack_require__.r(__webpack_exports__);
@@ -15233,12 +15772,15 @@ __webpack_require__.d(__webpack_exports__, {
15233
15772
  "./src/cli/send.tsx"(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
15234
15773
  __webpack_require__.r(__webpack_exports__);
15235
15774
  /* import */ var react_jsx_runtime__rspack_import_0 = __webpack_require__("./node_modules/react/jsx-runtime.react-server.js");
15236
- /* import */ var _agent_bundle_runtime__rspack_import_6 = __webpack_require__("./node_modules/@agent-bundle/runtime/dist/506.js");
15237
- /* import */ var zod__rspack_import_5 = __webpack_require__("./node_modules/zod/v4/classic/schemas.js");
15238
- /* import */ var _core_codex_bridge_js__rspack_import_1 = __webpack_require__("./src/core/codex-bridge.js");
15239
- /* import */ var _core_codex_contract_js__rspack_import_2 = __webpack_require__("./src/core/codex/contract.js");
15240
- /* import */ var _core_history_js__rspack_import_3 = __webpack_require__("./src/core/history.js");
15241
- /* import */ var _shared_js__rspack_import_4 = __webpack_require__("./src/cli/_shared.ts");
15775
+ /* import */ var _agent_bundle_runtime__rspack_import_7 = __webpack_require__("./node_modules/@agent-bundle/runtime/dist/736.js");
15776
+ /* import */ var _agent_bundle_runtime__rspack_import_8 = __webpack_require__("./node_modules/@agent-bundle/runtime/dist/506.js");
15777
+ /* import */ var zod__rspack_import_6 = __webpack_require__("./node_modules/zod/v4/classic/schemas.js");
15778
+ /* import */ var _core_relay_routes_js__rspack_import_1 = __webpack_require__("./src/core/relay/routes.ts");
15779
+ /* import */ var _core_codex_bridge_js__rspack_import_2 = __webpack_require__("./src/core/codex-bridge.js");
15780
+ /* import */ var _core_codex_contract_js__rspack_import_3 = __webpack_require__("./src/core/codex/contract.js");
15781
+ /* import */ var _core_history_js__rspack_import_4 = __webpack_require__("./src/core/history.js");
15782
+ /* import */ var _shared_js__rspack_import_5 = __webpack_require__("./src/cli/_shared.ts");
15783
+
15242
15784
 
15243
15785
 
15244
15786
 
@@ -15252,6 +15794,25 @@ const config = {
15252
15794
  inputJsonSchema: {
15253
15795
  additionalProperties: false,
15254
15796
  properties: {
15797
+ replyMode: {
15798
+ type: 'string',
15799
+ enum: [
15800
+ 'auto',
15801
+ 'manual'
15802
+ ]
15803
+ },
15804
+ codexThreadId: {
15805
+ type: 'string'
15806
+ },
15807
+ bindingId: {
15808
+ type: 'string'
15809
+ },
15810
+ expectedCwd: {
15811
+ type: 'string'
15812
+ },
15813
+ requestId: {
15814
+ type: 'string'
15815
+ },
15255
15816
  correlationId: {
15256
15817
  description: 'Stable correlation id for multi-hop replies',
15257
15818
  type: 'string'
@@ -15309,52 +15870,58 @@ const config = {
15309
15870
  'message'
15310
15871
  ]
15311
15872
  };
15312
- const inputSchema = _shared_js__rspack_import_4/* .backendFlagsSchema.extend */.lK.extend({
15313
- correlationId: zod__rspack_import_5/* .string */.YjP().min(1).optional(),
15314
- envelope: zod__rspack_import_5/* .boolean */.zMY().default(false),
15315
- historyDir: zod__rspack_import_5/* .string */.YjP().min(1).optional(),
15316
- hop: zod__rspack_import_5/* .number */.aig().int().min(0).optional(),
15317
- message: zod__rspack_import_5/* .array */.YOg(zod__rspack_import_5/* .string */.YjP()).min(1),
15318
- noHistory: zod__rspack_import_5/* .boolean */.zMY().default(false),
15319
- replyTo: zod__rspack_import_5/* .string */.YjP().min(1).optional(),
15320
- target: zod__rspack_import_5/* .string */.YjP().min(1)
15873
+ const inputSchema = _shared_js__rspack_import_5/* .backendFlagsSchema.extend */.lK.extend({
15874
+ ..._core_relay_routes_js__rspack_import_1/* .routeFields */.zK,
15875
+ replyMode: zod__rspack_import_6/* ["enum"] */.k5n([
15876
+ 'auto',
15877
+ 'manual'
15878
+ ]).optional(),
15879
+ correlationId: zod__rspack_import_6/* .string */.YjP().min(1).optional(),
15880
+ envelope: zod__rspack_import_6/* .boolean */.zMY().default(false),
15881
+ historyDir: zod__rspack_import_6/* .string */.YjP().min(1).optional(),
15882
+ hop: zod__rspack_import_6/* .number */.aig().int().min(0).optional(),
15883
+ message: zod__rspack_import_6/* .array */.YOg(zod__rspack_import_6/* .string */.YjP()).min(1),
15884
+ noHistory: zod__rspack_import_6/* .boolean */.zMY().default(false),
15885
+ replyTo: zod__rspack_import_6/* .string */.YjP().min(1).optional(),
15886
+ target: zod__rspack_import_6/* .string */.YjP().min(1)
15321
15887
  }).strict();
15322
- const receiptSchema = zod__rspack_import_5/* .object */.Ikc({
15323
- correlationId: zod__rspack_import_5/* .string */.YjP(),
15324
- delivery: zod__rspack_import_5/* ["enum"] */.k5n([
15888
+ const receiptSchema = zod__rspack_import_6/* .object */.Ikc({
15889
+ correlationId: zod__rspack_import_6/* .string */.YjP(),
15890
+ delivery: zod__rspack_import_6/* ["enum"] */.k5n([
15325
15891
  'accepted',
15326
15892
  'unknown'
15327
15893
  ]),
15328
- envelopeId: zod__rspack_import_5/* .string */.YjP(),
15329
- exitCode: zod__rspack_import_5/* .literal */.euz(0),
15330
- hop: zod__rspack_import_5/* .number */.aig().int().min(0),
15331
- id: zod__rspack_import_5/* .string */.YjP(),
15332
- kind: zod__rspack_import_5/* ["enum"] */.k5n([
15894
+ envelopeId: zod__rspack_import_6/* .string */.YjP(),
15895
+ exitCode: zod__rspack_import_6/* .literal */.euz(0),
15896
+ hop: zod__rspack_import_6/* .number */.aig().int().min(0),
15897
+ id: zod__rspack_import_6/* .string */.YjP(),
15898
+ kind: zod__rspack_import_6/* ["enum"] */.k5n([
15333
15899
  'bot',
15334
15900
  'group'
15335
15901
  ]),
15336
- maxHops: zod__rspack_import_5/* .number */.aig().int().min(0),
15337
- messageId: zod__rspack_import_5/* .string */.YjP().optional(),
15338
- name: zod__rspack_import_5/* .string */.YjP(),
15339
- replyTo: zod__rspack_import_5/* .string */.YjP().optional(),
15340
- result: zod__rspack_import_5/* .record */.g1P(zod__rspack_import_5/* .string */.YjP(), zod__rspack_import_5/* .json */.Pq9())
15902
+ maxHops: zod__rspack_import_6/* .number */.aig().int().min(0),
15903
+ messageId: zod__rspack_import_6/* .string */.YjP().optional(),
15904
+ name: zod__rspack_import_6/* .string */.YjP(),
15905
+ replyTo: zod__rspack_import_6/* .string */.YjP().optional(),
15906
+ result: zod__rspack_import_6/* .record */.g1P(zod__rspack_import_6/* .string */.YjP(), zod__rspack_import_6/* .json */.Pq9())
15341
15907
  }).strict();
15342
15908
  // Refusals and gateway failures are the same flat document `codex send` emits.
15343
- const resultSchema = zod__rspack_import_5/* .union */.KCZ([
15909
+ const resultSchema = zod__rspack_import_6/* .union */.KCZ([
15344
15910
  receiptSchema,
15345
- _shared_js__rspack_import_4/* .failureDocumentSchema */.R9
15911
+ _shared_js__rspack_import_5/* .failureDocumentSchema */.R9,
15912
+ _core_relay_routes_js__rspack_import_1/* .relayResultSchema */.Ax
15346
15913
  ]);
15347
15914
  const deliver = async (input)=>{
15348
- const envelope = (0,_core_codex_bridge_js__rspack_import_1/* .buildEnvelope */.nq)({
15915
+ const envelope = (0,_core_codex_bridge_js__rspack_import_2/* .buildEnvelope */.nq)({
15349
15916
  correlationId: input.correlationId,
15350
15917
  envelope: input.envelope,
15351
15918
  hop: input.hop,
15352
15919
  replyTo: input.replyTo
15353
15920
  });
15354
15921
  const message = input.message.join(' ').trim();
15355
- const backend = await (0,_shared_js__rspack_import_4/* .openBackendFromInput */.FS)(input);
15356
- const out = await backend.send(input.target, (0,_core_codex_bridge_js__rspack_import_1/* .withEnvelopeHeader */.Mr)(message, envelope));
15357
- (0,_core_history_js__rspack_import_3/* .saveHistory */.QX)(out, {
15922
+ const backend = await (0,_shared_js__rspack_import_5/* .openBackendFromInput */.FS)(input);
15923
+ const out = await backend.send(input.target, (0,_core_codex_bridge_js__rspack_import_2/* .withEnvelopeHeader */.Mr)(message, envelope));
15924
+ (0,_core_history_js__rspack_import_4/* .saveHistory */.QX)(out, {
15358
15925
  dir: input.historyDir,
15359
15926
  disabled: input.noHistory,
15360
15927
  event: 'send',
@@ -15382,14 +15949,38 @@ const deliver = async (input)=>{
15382
15949
  async function send({ input }) {
15383
15950
  let value;
15384
15951
  try {
15952
+ if (input.replyMode === 'auto' || input.codexThreadId || input.bindingId) {
15953
+ (0,_core_relay_routes_js__rspack_import_1/* .assertManagedSendOptions */.MB)(input);
15954
+ if (input.files) throw Error('Automatic routes require the gateway backend');
15955
+ const out = await (0,_core_relay_routes_js__rspack_import_1/* .grokSendOperation */.bv)({
15956
+ target: input.target,
15957
+ message: input.message.join(' ').trim(),
15958
+ replyMode: input.replyMode ?? 'auto',
15959
+ codexThreadId: input.codexThreadId,
15960
+ bindingId: input.bindingId,
15961
+ expectedCwd: input.expectedCwd,
15962
+ requestId: input.requestId,
15963
+ hop: input.hop,
15964
+ correlationId: input.correlationId
15965
+ }, await (0,_agent_bundle_runtime__rspack_import_7/* .agent */.MA)());
15966
+ return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_8/* .Agent.Result */.g6.Result, {
15967
+ value: {
15968
+ ...out,
15969
+ exitCode: out.delivery === 'rejected' ? 1 : 0
15970
+ },
15971
+ children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_8/* .Agent.Text */.g6.Text, {
15972
+ children: `Delivery ${out.delivery}; inspect codex bridge status for automatic reply delivery.`
15973
+ })
15974
+ });
15975
+ }
15385
15976
  value = await deliver(input);
15386
15977
  } catch (error) {
15387
- value = (0,_core_codex_contract_js__rspack_import_2/* .outcomeFromError */.DG)(error);
15978
+ value = (0,_core_codex_contract_js__rspack_import_3/* .outcomeFromError */.DG)(error);
15388
15979
  }
15389
15980
  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)(_agent_bundle_runtime__rspack_import_6/* .Agent.Result */.g6.Result, {
15981
+ return /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_8/* .Agent.Result */.g6.Result, {
15391
15982
  value: value,
15392
- children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_6/* .Agent.Text */.g6.Text, {
15983
+ children: /*#__PURE__*/ (0,react_jsx_runtime__rspack_import_0.jsx)(_agent_bundle_runtime__rspack_import_8/* .Agent.Text */.g6.Text, {
15393
15984
  children: text
15394
15985
  })
15395
15986
  });
@@ -15559,6 +16150,411 @@ __webpack_require__.d(__webpack_exports__, {
15559
16150
  });
15560
16151
 
15561
16152
 
16153
+ },
16154
+ "./src/core/codex/routes.ts"(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
16155
+ /* import */ var zod__rspack_import_3 = __webpack_require__("./node_modules/zod/v4/classic/schemas.js");
16156
+ /* import */ var _codex_bridge_js__rspack_import_0 = __webpack_require__("./src/core/codex-bridge.js");
16157
+ /* import */ var _contract_js__rspack_import_1 = __webpack_require__("./src/core/codex/contract.js");
16158
+ /* import */ var _conversation_js__rspack_import_2 = __webpack_require__("./src/core/codex/conversation.js");
16159
+
16160
+
16161
+
16162
+
16163
+ const id = zod__rspack_import_3/* .string */.YjP().regex(/^[A-Za-z0-9_.:-]{1,128}$/);
16164
+ const observationFields = {
16165
+ expectedCwd: zod__rspack_import_3/* .string */.YjP().min(1).optional(),
16166
+ threadId: id,
16167
+ timeoutMs: zod__rspack_import_3/* .number */.aig().int().min(1).max(600000).optional()
16168
+ };
16169
+ const sendFields = {
16170
+ ...observationFields,
16171
+ correlationId: id.optional(),
16172
+ envelope: zod__rspack_import_3/* .boolean */.zMY().optional(),
16173
+ hop: zod__rspack_import_3/* .number */.aig().int().min(0).optional(),
16174
+ replyTo: id.optional(),
16175
+ expectedTurnId: id.optional(),
16176
+ whenBusy: zod__rspack_import_3/* ["enum"] */.k5n([
16177
+ 'reject',
16178
+ 'queue',
16179
+ 'steer'
16180
+ ]).default('reject'),
16181
+ wait: zod__rspack_import_3/* .boolean */.zMY().default(false),
16182
+ maxOutputBytes: zod__rspack_import_3/* .number */.aig().int().min(1).max(4194304).optional()
16183
+ };
16184
+ const sendSchema = zod__rspack_import_3/* .object */.Ikc({
16185
+ ...sendFields,
16186
+ message: zod__rspack_import_3/* .string */.YjP().min(1).max(4194304)
16187
+ }).strict();
16188
+ const waitSchema = zod__rspack_import_3/* .object */.Ikc({
16189
+ ...observationFields,
16190
+ turnId: id,
16191
+ messageId: id.optional(),
16192
+ maxOutputBytes: zod__rspack_import_3/* .number */.aig().int().min(1).max(4194304).optional()
16193
+ }).strict();
16194
+ const watchSchema = zod__rspack_import_3/* .object */.Ikc({
16195
+ ...observationFields,
16196
+ maxEvents: zod__rspack_import_3/* .number */.aig().int().min(1).max(500).default(100)
16197
+ }).strict();
16198
+ const threadsSchema = zod__rspack_import_3/* .object */.Ikc({
16199
+ limit: zod__rspack_import_3/* .number */.aig().int().min(1).max(200).default(20),
16200
+ cursor: zod__rspack_import_3/* .string */.YjP().min(1).max(4096).optional()
16201
+ }).strict();
16202
+ const resultSchema = zod__rspack_import_3/* .object */.Ikc({
16203
+ exitCode: zod__rspack_import_3/* .number */.aig().int().min(0).max(1),
16204
+ threadId: zod__rspack_import_3/* .string */.YjP().optional(),
16205
+ turnId: zod__rspack_import_3/* .string */.YjP().optional(),
16206
+ messageId: zod__rspack_import_3/* .string */.YjP().optional(),
16207
+ delivery: zod__rspack_import_3/* ["enum"] */.k5n([
16208
+ 'accepted',
16209
+ 'queued',
16210
+ 'rejected',
16211
+ 'unknown'
16212
+ ]).optional(),
16213
+ execution: zod__rspack_import_3/* .object */.Ikc({
16214
+ state: zod__rspack_import_3/* ["enum"] */.k5n([
16215
+ 'completed',
16216
+ 'failed',
16217
+ 'interrupted',
16218
+ 'waiting-for-input',
16219
+ 'timeout',
16220
+ 'disconnected',
16221
+ 'unknown'
16222
+ ]),
16223
+ error: zod__rspack_import_3/* .unknown */.L5J().optional()
16224
+ }).optional(),
16225
+ reply: zod__rspack_import_3/* .object */.Ikc({
16226
+ text: zod__rspack_import_3/* .string */.YjP().max(4194304),
16227
+ items: zod__rspack_import_3/* .array */.YOg(zod__rspack_import_3/* .object */.Ikc({
16228
+ id: zod__rspack_import_3/* .string */.YjP(),
16229
+ type: zod__rspack_import_3/* .literal */.euz('agentMessage'),
16230
+ phase: zod__rspack_import_3/* ["enum"] */.k5n([
16231
+ 'final_answer'
16232
+ ]).nullable(),
16233
+ text: zod__rspack_import_3/* .string */.YjP().max(4194304)
16234
+ })).max(2000),
16235
+ truncated: zod__rspack_import_3/* .boolean */.zMY()
16236
+ }).optional(),
16237
+ 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(),
16238
+ 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(),
16239
+ reason: zod__rspack_import_3/* .string */.YjP().optional(),
16240
+ truncated: zod__rspack_import_3/* .boolean */.zMY().optional()
16241
+ }).passthrough();
16242
+ async function sendOperation(input, signal, progress, oneShot = false) {
16243
+ let envelope;
16244
+ let receipt;
16245
+ try {
16246
+ envelope = (0,_codex_bridge_js__rspack_import_0/* .buildEnvelope */.nq)(input);
16247
+ if (oneShot && !input.wait && input.whenBusy !== 'steer') {
16248
+ return await (0,_codex_bridge_js__rspack_import_0/* .sendToCodexThread */.ZS)(input.threadId, input.message, {
16249
+ envelope,
16250
+ whenBusy: input.whenBusy,
16251
+ expectedCwd: input.expectedCwd,
16252
+ signal
16253
+ });
16254
+ }
16255
+ await progress?.('Opening Codex conversation');
16256
+ const conversation = await (0,_conversation_js__rspack_import_2/* .openCodexConversation */.j)(input.threadId, {
16257
+ expectedCwd: input.expectedCwd,
16258
+ signal
16259
+ });
16260
+ try {
16261
+ receipt = await conversation.send(input.message, {
16262
+ envelope,
16263
+ whenBusy: input.whenBusy,
16264
+ expectedTurnId: input.expectedTurnId
16265
+ });
16266
+ if (!input.wait || receipt.delivery !== 'accepted' || !receipt.turnId) return receipt;
16267
+ await progress?.(`Accepted message ${receipt.messageId}; observing turn ${receipt.turnId}`);
16268
+ const result = await conversation.wait({
16269
+ turnId: receipt.turnId,
16270
+ messageId: receipt.messageId,
16271
+ timeoutMs: input.timeoutMs,
16272
+ maxOutputBytes: input.maxOutputBytes,
16273
+ signal
16274
+ });
16275
+ return {
16276
+ ...receipt,
16277
+ execution: result.execution,
16278
+ reply: result.reply,
16279
+ interactions: result.interactions,
16280
+ exitCode: result.execution.state === 'completed' ? 0 : 1
16281
+ };
16282
+ } finally{
16283
+ await conversation.close();
16284
+ }
16285
+ } catch (error) {
16286
+ if (receipt?.delivery === 'accepted') return {
16287
+ ...receipt,
16288
+ execution: {
16289
+ state: 'unknown',
16290
+ error: (0,_contract_js__rspack_import_1/* .outcomeFromError */.DG)(error).error
16291
+ },
16292
+ reply: {
16293
+ text: '',
16294
+ items: [],
16295
+ truncated: true
16296
+ },
16297
+ interactions: [],
16298
+ exitCode: 1
16299
+ };
16300
+ return {
16301
+ ...(0,_contract_js__rspack_import_1/* .outcomeFromError */.DG)(error),
16302
+ threadId: input.threadId,
16303
+ ...envelope ? {
16304
+ messageId: envelope.messageId,
16305
+ correlationId: envelope.correlationId,
16306
+ hop: envelope.hop
16307
+ } : {}
16308
+ };
16309
+ }
16310
+ }
16311
+ async function observeOperation(kind, input, signal, progress) {
16312
+ try {
16313
+ await progress?.(`Observing Codex thread ${input.threadId}`);
16314
+ const conversation = await (0,_conversation_js__rspack_import_2/* .openCodexConversation */.j)(input.threadId, {
16315
+ expectedCwd: input.expectedCwd,
16316
+ signal
16317
+ });
16318
+ try {
16319
+ if (kind === 'wait') {
16320
+ const result = await conversation.wait({
16321
+ ...input,
16322
+ signal
16323
+ });
16324
+ return {
16325
+ ...result,
16326
+ exitCode: result.execution.state === 'completed' ? 0 : 1
16327
+ };
16328
+ }
16329
+ const result = await conversation.watch({
16330
+ ...input,
16331
+ signal
16332
+ });
16333
+ return {
16334
+ ...result,
16335
+ exitCode: [
16336
+ 'timeout',
16337
+ 'event-limit'
16338
+ ].includes(result.reason) ? 0 : 1
16339
+ };
16340
+ } finally{
16341
+ await conversation.close();
16342
+ }
16343
+ } catch (error) {
16344
+ return {
16345
+ ...(0,_contract_js__rspack_import_1/* .outcomeFromError */.DG)(error),
16346
+ threadId: input.threadId,
16347
+ ...'turnId' in input ? {
16348
+ turnId: input.turnId,
16349
+ messageId: input.messageId
16350
+ } : {}
16351
+ };
16352
+ }
16353
+ }
16354
+ async function threadsOperation(input) {
16355
+ try {
16356
+ return {
16357
+ ...await listCodexThreads(input),
16358
+ exitCode: 0
16359
+ };
16360
+ } catch (error) {
16361
+ return outcomeFromError(error);
16362
+ }
16363
+ }
16364
+ function resultText(result) {
16365
+ if (result.execution && typeof result.execution === 'object' && 'state' in result.execution) return `Codex turn ${result.turnId}: ${result.execution.state}`;
16366
+ if (result.delivery === 'queued') return `Queued ${result.queuedSubmissionId} on busy Codex thread ${result.threadId}; message ${result.messageId}`;
16367
+ if (result.error) return String(result.error);
16368
+ if (result.delivery === 'accepted') return `Started turn ${result.turnId} (${result.turnStatus}) on Codex thread ${result.threadId}; message ${result.messageId}`;
16369
+ if (result.delivery) return `Codex delivery ${result.delivery} on thread ${result.threadId}`;
16370
+ if (result.reason) return `Codex observation: ${result.reason}`;
16371
+ if (Array.isArray(result.threads)) return `${result.threads.length} Codex threads`;
16372
+ return String(result.error ?? 'Codex observation complete');
16373
+ }
16374
+
16375
+ __webpack_require__.d(__webpack_exports__, {
16376
+ D6: () => (resultText),
16377
+ UP: () => (sendOperation),
16378
+ gT: () => (observeOperation)
16379
+ }, {
16380
+ FD: resultSchema,
16381
+ R9: watchSchema,
16382
+ at: sendFields,
16383
+ jS: waitSchema
16384
+ });
16385
+
16386
+
16387
+ },
16388
+ "./src/core/relay/routes.ts"(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
16389
+ /* import */ var _agent_bundle_runtime__rspack_import_4 = __webpack_require__("./node_modules/@agent-bundle/runtime/dist/40.js");
16390
+ /* import */ var zod__rspack_import_3 = __webpack_require__("./node_modules/zod/v4/classic/schemas.js");
16391
+ /* import */ var _managed_js__rspack_import_0 = __webpack_require__("./src/core/relay/managed.js");
16392
+ /* import */ var _gbot_js__rspack_import_1 = __webpack_require__("./src/gbot.ts");
16393
+ /* import */ var _codex_bridge_js__rspack_import_2 = __webpack_require__("./src/core/codex-bridge.js");
16394
+
16395
+
16396
+
16397
+
16398
+
16399
+ const id = zod__rspack_import_3/* .string */.YjP().min(1).max(128);
16400
+ const routeFields = {
16401
+ codexThreadId: id.optional(),
16402
+ expectedCwd: zod__rspack_import_3/* .string */.YjP().min(1).max(4096).optional(),
16403
+ bindingId: zod__rspack_import_3/* .string */.YjP().min(1).max(512).optional(),
16404
+ requestId: id.optional()
16405
+ };
16406
+ const grokSendSchema = zod__rspack_import_3/* .object */.Ikc({
16407
+ target: zod__rspack_import_3/* .string */.YjP().min(1),
16408
+ message: zod__rspack_import_3/* .string */.YjP().min(1),
16409
+ replyMode: zod__rspack_import_3/* ["enum"] */.k5n([
16410
+ "auto",
16411
+ "manual"
16412
+ ]).optional(),
16413
+ hop: zod__rspack_import_3/* .number */.aig().int().min(0).optional(),
16414
+ correlationId: id.optional(),
16415
+ ...routeFields
16416
+ }).strict();
16417
+ const bridgeStartSchema = zod__rspack_import_3/* .object */.Ikc({
16418
+ grokTarget: zod__rspack_import_3/* .string */.YjP().min(1),
16419
+ codexThreadId: id.optional(),
16420
+ expectedCwd: zod__rspack_import_3/* .string */.YjP().min(1).max(4096).optional(),
16421
+ busyPolicy: zod__rspack_import_3/* ["enum"] */.k5n([
16422
+ "steer",
16423
+ "reject"
16424
+ ]).optional(),
16425
+ requestId: id.optional()
16426
+ }).strict();
16427
+ const bridgeStatusSchema = zod__rspack_import_3/* .object */.Ikc({
16428
+ bindingId: zod__rspack_import_3/* .string */.YjP().min(1).max(512).optional(),
16429
+ limit: zod__rspack_import_3/* .number */.aig().int().min(1).max(100).optional()
16430
+ }).strict();
16431
+ const bridgeStopSchema = zod__rspack_import_3/* .object */.Ikc({
16432
+ bindingId: zod__rspack_import_3/* .string */.YjP().min(1).max(512).optional(),
16433
+ all: zod__rspack_import_3/* .boolean */.zMY().optional(),
16434
+ worker: zod__rspack_import_3/* .boolean */.zMY().optional()
16435
+ }).strict().refine((x)=>!!x.bindingId || x.all === true || x.worker === true, "Specify bindingId, all or worker");
16436
+ const respondSchema = zod__rspack_import_3/* .object */.Ikc({
16437
+ interactionId: zod__rspack_import_3/* .string */.YjP().min(1).max(512),
16438
+ generation: id,
16439
+ threadId: id,
16440
+ turnId: id,
16441
+ bindingId: zod__rspack_import_3/* .string */.YjP().min(1).max(512).optional(),
16442
+ exchangeId: zod__rspack_import_3/* .string */.YjP().min(1).max(512).optional(),
16443
+ decision: zod__rspack_import_3/* ["enum"] */.k5n([
16444
+ "accept",
16445
+ "decline",
16446
+ "cancel"
16447
+ ]).optional(),
16448
+ answersJson: zod__rspack_import_3/* .string */.YjP().min(2).max(65536).optional()
16449
+ }).strict().refine((x)=>!!x.bindingId || !!x.exchangeId, "Binding or exchange scope required").refine((x)=>!!x.decision !== !!x.answersJson, "Supply decision or answersJson");
16450
+ const answersSchema = zod__rspack_import_3/* .record */.g1P(zod__rspack_import_3/* .string */.YjP().min(1).max(128), zod__rspack_import_3/* .object */.Ikc({
16451
+ answers: zod__rspack_import_3/* .array */.YOg(zod__rspack_import_3/* .string */.YjP().max(8192)).max(20)
16452
+ }).strict());
16453
+ const relayResultSchema = zod__rspack_import_3/* .record */.g1P(zod__rspack_import_3/* .string */.YjP(), zod__rspack_import_3/* .json */.Pq9());
16454
+ function nativeCodexThread(context) {
16455
+ 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;
16456
+ }
16457
+ function options(context) {
16458
+ return {
16459
+ pluginRoot: context?.plugin.state === "available" ? context.plugin.value.root : undefined,
16460
+ signal: context?.signal
16461
+ };
16462
+ }
16463
+ function destination(input, context) {
16464
+ const codexThreadId = input.codexThreadId ?? (context ? nativeCodexThread(context) : undefined);
16465
+ // Native workspace evidence belongs to the invocation, not the plugin installation directory.
16466
+ const workspace = context?.workspace;
16467
+ const expectedCwd = input.expectedCwd ?? (workspace?.state === "available" && workspace.source === "native" ? workspace.value.root : undefined);
16468
+ return {
16469
+ codexThreadId,
16470
+ expectedCwd
16471
+ };
16472
+ }
16473
+ async function grokSendOperation(input, context) {
16474
+ const route = destination(input, input.bindingId ? undefined : context);
16475
+ 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", {
16476
+ grokTarget: input.target,
16477
+ message: input.message,
16478
+ hop: input.hop,
16479
+ correlationId: input.correlationId,
16480
+ ...route,
16481
+ ...input.bindingId ? {
16482
+ bindingId: input.bindingId
16483
+ } : {},
16484
+ ...input.requestId ? {
16485
+ requestId: input.requestId
16486
+ } : {}
16487
+ }, options(context)));
16488
+ if (input.replyMode === "auto") throw Error("Automatic reply delivery requires a native Codex source, codexThreadId or bindingId");
16489
+ 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;
16490
+ 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));
16491
+ return {
16492
+ result: sent.result,
16493
+ target: (0,_gbot_js__rspack_import_1/* .summarizeTarget */.rW)(sent.target),
16494
+ delivery: sent.delivery === "accepted" ? "accepted" : "unknown",
16495
+ ...sent.delivery === "accepted" && typeof sent.messageId === "string" ? {
16496
+ messageId: sent.messageId
16497
+ } : {},
16498
+ replyRoute: {
16499
+ mode: "manual",
16500
+ reason: input.replyMode === "manual" ? "requested" : "source-unavailable"
16501
+ }
16502
+ };
16503
+ }
16504
+ async function bridgeOperation(method, input, context) {
16505
+ let routed = method === "startBinding" ? {
16506
+ ...input,
16507
+ ...destination(input, context)
16508
+ } : input;
16509
+ if (method === "respond") {
16510
+ const { decision, answersJson, ...scope } = respondSchema.parse(input);
16511
+ routed = {
16512
+ ...scope,
16513
+ result: decision ? {
16514
+ decision
16515
+ } : {
16516
+ answers: answersSchema.parse(JSON.parse(answersJson))
16517
+ }
16518
+ };
16519
+ }
16520
+ if (method === "startBinding" && !routed.codexThreadId) throw Error("Specify codexThreadId when native Codex source identity is unavailable");
16521
+ return (0,_gbot_js__rspack_import_1/* .withRedactedErrors */.yF)(()=>(0,_managed_js__rspack_import_0/* .managedOperation */.Bb)(method, routed, options(context)));
16522
+ }
16523
+ function assertManagedSendOptions(input) {
16524
+ 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");
16525
+ 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");
16526
+ }
16527
+ async function codexReturnOperation(input, context) {
16528
+ assertManagedSendOptions(input);
16529
+ if (input.whenBusy === "queue") throw Error("Managed relay supports steer or reject, not experimental queue");
16530
+ return (0,_gbot_js__rspack_import_1/* .withRedactedErrors */.yF)(()=>(0,_managed_js__rspack_import_0/* .managedOperation */.Bb)("sendToCodex", {
16531
+ grokTarget: input.replyToGrok,
16532
+ codexThreadId: input.threadId,
16533
+ expectedCwd: input.expectedCwd,
16534
+ bindingId: input.bindingId,
16535
+ message: input.message,
16536
+ requestId: input.requestId,
16537
+ busyPolicy: input.whenBusy,
16538
+ hop: input.hop,
16539
+ correlationId: input.correlationId
16540
+ }, options(context)));
16541
+ }
16542
+
16543
+ __webpack_require__.d(__webpack_exports__, {
16544
+ MB: () => (assertManagedSendOptions),
16545
+ bv: () => (grokSendOperation),
16546
+ lt: () => (codexReturnOperation),
16547
+ n1: () => (bridgeOperation)
16548
+ }, {
16549
+ Ax: relayResultSchema,
16550
+ d5: bridgeStopSchema,
16551
+ np: bridgeStatusSchema,
16552
+ v1: respondSchema,
16553
+ xD: bridgeStartSchema,
16554
+ zK: routeFields
16555
+ });
16556
+
16557
+
15562
16558
  },
15563
16559
  "./src/gbot.ts"(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
15564
16560
  /* import */ var zod__rspack_import_2 = __webpack_require__("./node_modules/zod/v4/classic/schemas.js");
@@ -15663,7 +16659,10 @@ const transcriptEntries = (transcript)=>{
15663
16659
  };
15664
16660
 
15665
16661
  __webpack_require__.d(__webpack_exports__, {
16662
+ LV: () => (/* reexport safe */ _core_gateway_js__rspack_import_0.LV),
16663
+ Vq: () => (/* reexport safe */ _core_gateway_js__rspack_import_0.Vq)
15666
16664
  }, {
16665
+ rW: summarizeTarget,
15667
16666
  yF: withRedactedErrors
15668
16667
  });
15669
16668
 
@@ -15693,9 +16692,9 @@ module.exports = __rspack_external_node_fs_1b05aee1;
15693
16692
 
15694
16693
 
15695
16694
  },
15696
- "node:module"(module) {
16695
+ "node:fs/promises"(module) {
15697
16696
 
15698
- module.exports = __rspack_external_node_module_9de3fa2f;
16697
+ module.exports = __rspack_external_node_fs_promises_3b710708;
15699
16698
 
15700
16699
 
15701
16700
  },
@@ -15717,9 +16716,15 @@ module.exports = __rspack_external_node_path_806ed179;
15717
16716
 
15718
16717
 
15719
16718
  },
15720
- "node:readline"(module) {
16719
+ "node:readline"(module) {
16720
+
16721
+ module.exports = __rspack_external_node_readline_d8f53bef;
16722
+
16723
+
16724
+ },
16725
+ "node:string_decoder"(module) {
15721
16726
 
15722
- module.exports = __rspack_external_node_readline_d8f53bef;
16727
+ module.exports = __rspack_external_node_string_decoder_69b9bd04;
15723
16728
 
15724
16729
 
15725
16730
  },
@@ -15750,6 +16755,195 @@ module.exports = __rspack_createRequire_require("stream");
15750
16755
  "util"(module) {
15751
16756
  module.exports = __rspack_createRequire_require("util");
15752
16757
 
16758
+ },
16759
+ "./node_modules/@agent-bundle/runtime/dist/40.js"(__unused_rspack___webpack_module__, __webpack_exports__, __webpack_require__) {
16760
+ /* import */ var node_fs_promises__rspack_import_0 = __webpack_require__("node:fs/promises");
16761
+
16762
+
16763
+ const CODEX_ROLLOUT_HEAD_BYTES = 1048576;
16764
+ 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;
16765
+ const codexThreadFromRolloutPath = (path)=>{
16766
+ if (void 0 === path) return;
16767
+ const match = ROLLOUT_BASENAME.exec(path);
16768
+ return match?.[1]?.toLowerCase();
16769
+ };
16770
+ const record = (value)=>null === value || 'object' != typeof value || Array.isArray(value) ? void 0 : value;
16771
+ const codex_rollout_text = (value)=>'string' == typeof value && '' !== value.trim() ? value : void 0;
16772
+ const parseCodexRolloutMeta = (head)=>{
16773
+ const newline = head.indexOf('\n');
16774
+ const line = (-1 === newline ? head : head.slice(0, newline)).trim();
16775
+ if ('' === line) return;
16776
+ let parsed;
16777
+ try {
16778
+ parsed = JSON.parse(line);
16779
+ } catch {
16780
+ return;
16781
+ }
16782
+ const item = record(parsed);
16783
+ if (item?.['type'] !== 'session_meta') return;
16784
+ const payload = record(item['payload']);
16785
+ const thread = codex_rollout_text(payload?.['id']);
16786
+ if (void 0 === payload || void 0 === thread) return;
16787
+ const root = codex_rollout_text(payload['session_id']);
16788
+ const source = record(payload['source']);
16789
+ const subagent = record(source?.['subagent']);
16790
+ if (void 0 === subagent) {
16791
+ const kind = codex_rollout_text(source?.['subagent']);
16792
+ return {
16793
+ ...void 0 === kind ? {} : {
16794
+ subagentKind: kind
16795
+ },
16796
+ ...void 0 === root ? {} : {
16797
+ root
16798
+ },
16799
+ thread
16800
+ };
16801
+ }
16802
+ const [subagentKind] = Object.keys(subagent);
16803
+ const spawn = record(subagent['thread_spawn']);
16804
+ const parent = codex_rollout_text(spawn?.['parent_thread_id']) ?? codex_rollout_text(payload['parent_thread_id']);
16805
+ const rawDepth = spawn?.['depth'];
16806
+ const depth = 'number' == typeof rawDepth && Number.isInteger(rawDepth) && rawDepth > 0 ? rawDepth : void 0;
16807
+ const agentPath = codex_rollout_text(spawn?.['agent_path']) ?? codex_rollout_text(payload['agent_path']);
16808
+ return {
16809
+ ...void 0 === agentPath ? {} : {
16810
+ agentPath
16811
+ },
16812
+ ...void 0 === depth ? {} : {
16813
+ depth
16814
+ },
16815
+ ...void 0 === parent ? {} : {
16816
+ parent
16817
+ },
16818
+ ...void 0 === root ? {} : {
16819
+ root
16820
+ },
16821
+ ...void 0 === subagentKind ? {} : {
16822
+ subagentKind
16823
+ },
16824
+ thread
16825
+ };
16826
+ };
16827
+ const readCodexRolloutHead = async (path)=>{
16828
+ let handle;
16829
+ try {
16830
+ handle = await promises_open(path, 'r');
16831
+ const buffer = Buffer.allocUnsafe(CODEX_ROLLOUT_HEAD_BYTES);
16832
+ let filled = 0;
16833
+ while(filled < buffer.length){
16834
+ const { bytesRead } = await handle.read(buffer, filled, buffer.length - filled, filled);
16835
+ if (0 === bytesRead) break;
16836
+ const newline = buffer.subarray(filled, filled + bytesRead).indexOf(0x0a);
16837
+ if (-1 !== newline) {
16838
+ filled += newline;
16839
+ break;
16840
+ }
16841
+ filled += bytesRead;
16842
+ }
16843
+ return buffer.subarray(0, filled).toString('utf8');
16844
+ } catch {
16845
+ return;
16846
+ } finally{
16847
+ await handle?.close().catch(()=>void 0);
16848
+ }
16849
+ };
16850
+ const readCodexSpawnLineage = async (path, thread, read = readCodexRolloutHead)=>{
16851
+ if (void 0 === path) return;
16852
+ const head = await read(path);
16853
+ if (void 0 === head) return;
16854
+ const meta = parseCodexRolloutMeta(head);
16855
+ if (void 0 === meta || meta.thread !== thread || void 0 === meta.parent || void 0 === meta.depth) return;
16856
+ return {
16857
+ ...meta,
16858
+ depth: meta.depth,
16859
+ parent: meta.parent
16860
+ };
16861
+ };
16862
+ const nativeString = (native, key)=>{
16863
+ const value = native[key];
16864
+ return 'string' == typeof value && '' !== value.trim() ? value : void 0;
16865
+ };
16866
+ const lineageHostFromClient = (clientName)=>{
16867
+ if (void 0 === clientName) return;
16868
+ if (clientName.startsWith('claude')) return 'claude';
16869
+ if (clientName.startsWith('codex')) return 'codex';
16870
+ if (clientName.startsWith('cursor')) return 'cursor';
16871
+ };
16872
+ const lineageCarrier = (host, native)=>{
16873
+ switch(host){
16874
+ case 'claude':
16875
+ return {
16876
+ conversation: nativeString(native, 'agent_id') ?? nativeString(native, 'session_id'),
16877
+ generation: nativeString(native, 'prompt_id'),
16878
+ root: nativeString(native, 'session_id')
16879
+ };
16880
+ case 'codex':
16881
+ return {
16882
+ conversation: nativeString(native, 'agent_id') ?? nativeString(native, 'session_id'),
16883
+ generation: nativeString(native, 'turn_id'),
16884
+ root: nativeString(native, 'session_id')
16885
+ };
16886
+ case 'cursor':
16887
+ return {
16888
+ conversation: nativeString(native, 'conversation_id') ?? nativeString(native, 'session_id'),
16889
+ generation: nativeString(native, 'generation_id'),
16890
+ root: void 0
16891
+ };
16892
+ default:
16893
+ {
16894
+ const unreachable = host;
16895
+ throw new Error(`Unhandled lineage host ${String(unreachable)}`);
16896
+ }
16897
+ }
16898
+ };
16899
+ const resolveNativeLineage = (host, native)=>{
16900
+ const carrier = lineageCarrier(host, native);
16901
+ if ('cursor' === host || void 0 === carrier.conversation || void 0 === carrier.root) return unavailable('no-shared-runtime');
16902
+ if (carrier.conversation !== carrier.root) return unavailable('no-shared-runtime');
16903
+ return available({
16904
+ conversation: carrier.root,
16905
+ depth: 0,
16906
+ ...void 0 === carrier.generation ? {} : {
16907
+ generation: carrier.generation
16908
+ },
16909
+ resolution: 'native',
16910
+ root: carrier.root
16911
+ }, 'native');
16912
+ };
16913
+ const resolveStandaloneLineage = async (host, native, read)=>{
16914
+ const fromPayload = resolveNativeLineage(host, native);
16915
+ if ('codex' !== host || 'available' === fromPayload.state) return fromPayload;
16916
+ const carrier = lineageCarrier(host, native);
16917
+ if (void 0 === carrier.conversation || void 0 === carrier.root) return fromPayload;
16918
+ const ownRollout = 'SubagentStop' === nativeString(native, 'hook_event_name') ? nativeString(native, "agent_transcript_path") : nativeString(native, "transcript_path");
16919
+ const spawn = await readCodexSpawnLineage(ownRollout, carrier.conversation, read);
16920
+ if (void 0 === spawn) return fromPayload;
16921
+ const type = nativeString(native, 'agent_type');
16922
+ return available({
16923
+ conversation: carrier.conversation,
16924
+ depth: spawn.depth,
16925
+ ...void 0 === carrier.generation ? {} : {
16926
+ generation: carrier.generation
16927
+ },
16928
+ parent: spawn.parent,
16929
+ resolution: "transcript",
16930
+ root: carrier.root,
16931
+ subagent: {
16932
+ id: carrier.conversation,
16933
+ ...void 0 === type ? {} : {
16934
+ type
16935
+ }
16936
+ }
16937
+ }, 'derived');
16938
+ };
16939
+
16940
+
16941
+ __webpack_require__.d(__webpack_exports__, {
16942
+ }, {
16943
+ bg: lineageHostFromClient
16944
+ });
16945
+
16946
+
15753
16947
  },
15754
16948
  "./node_modules/@agent-bundle/runtime/dist/49.js"(__unused_rspack___webpack_module__, __webpack_exports__, __webpack_require__) {
15755
16949
  /* import */ var node_crypto__rspack_import_0 = __webpack_require__("node:crypto");
@@ -16228,6 +17422,7 @@ const providerRequest = ({ notices, state, ...axes })=>Object.freeze({
16228
17422
 
16229
17423
  __webpack_require__.d(__webpack_exports__, {
16230
17424
  }, {
17425
+ MA: agent,
16231
17426
  hU: unavailable,
16232
17427
  iC: runAgentRequest,
16233
17428
  qC: available
@@ -17921,6 +19116,7 @@ function preprocess(fn, schema) {
17921
19116
  __webpack_require__.d(__webpack_exports__, {
17922
19117
  Ikc: () => (object),
17923
19118
  KCZ: () => (union),
19119
+ L5J: () => (unknown),
17924
19120
  Pq9: () => (json),
17925
19121
  YOg: () => (array),
17926
19122
  YjP: () => (string),
@@ -26393,6 +27589,7 @@ function inspectGrokBotGatewaySession(options = {}) {
26393
27589
  __webpack_require__.d(__webpack_exports__, {
26394
27590
  Z2: () => (loadGrokBotGatewaySession),
26395
27591
  ZN: () => (hasGrokBotGatewaySession),
27592
+ dQ: () => (grokBotGatewayDescriptorPath),
26396
27593
  hd: () => (inspectGrokBotGatewaySession)
26397
27594
  });
26398
27595
 
@@ -26405,7 +27602,7 @@ __webpack_require__.d(__webpack_exports__, {
26405
27602
  /* import */ var node_os__rspack_import_3 = __webpack_require__("node:os");
26406
27603
  /* import */ var node_path__rspack_import_4 = __webpack_require__("node:path");
26407
27604
  /* import */ var node_child_process__rspack_import_5 = __webpack_require__("node:child_process");
26408
- /* import */ var node_module__rspack_import_6 = __webpack_require__("node:module");
27605
+ /* import */ var _package_json__rspack_import_6 = __webpack_require__("./package.json");
26409
27606
  /* import */ var _codex_contract_js__rspack_import_7 = __webpack_require__("./src/core/codex/contract.js");
26410
27607
  /* import */ var _desktop_shim_js__rspack_import_8 = __webpack_require__("./src/core/desktop-shim.js");
26411
27608
 
@@ -26431,10 +27628,12 @@ const WS_GUID = "258EAFA5-E914-47DA-95CA-C5AB0DC85B11";
26431
27628
  const WS_MAX_HEADER_BYTES = 16 * 1024;
26432
27629
  const WS_MAX_MESSAGE_BYTES = 4 * 1024 * 1024;
26433
27630
  const WS_MAX_BUFFER_BYTES = 8 * 1024 * 1024;
27631
+ const WS_MAX_WRITE_BYTES = 8 * 1024 * 1024;
27632
+ const CODEX_MAX_REQUESTS = 128;
27633
+ const CODEX_MAX_LISTENERS = 128;
26434
27634
  const textDecoder = new TextDecoder("utf-8", {
26435
27635
  fatal: true
26436
27636
  });
26437
- const pkg = (0,node_module__rspack_import_6.createRequire)(import.meta.url)("../../package.json");
26438
27637
  function codexSocketPath(env = process.env) {
26439
27638
  // Explicit socket wins so status/send/queue agree with a shim-installed or
26440
27639
  // operator-exported CODEX_APP_SERVER_SOCK; otherwise derive from CODEX_HOME.
@@ -26591,7 +27790,7 @@ function attachEnvelope(error, envelope) {
26591
27790
  "correlationId",
26592
27791
  "hop"
26593
27792
  ]){
26594
- if (error[key] === undefined && envelope[key] !== undefined) error[key] = envelope[key];
27793
+ if (envelope?.[key] !== undefined) error[key] = envelope[key];
26595
27794
  }
26596
27795
  }
26597
27796
  /** The route to the app-server is unavailable; `mode` is a stable machine-readable state. */ class CodexRouteError extends Error {
@@ -26638,16 +27837,44 @@ function isObject(value) {
26638
27837
  }
26639
27838
  /**
26640
27839
  * Open a JSON-RPC session to the app-server over its Unix socket (WebSocket framing).
26641
- * Server-initiated requests (approvals, user input) are refused with a JSON-RPC error
26642
- * and recorded in `refused`; gbot never approves on the user's behalf.
26643
- */ function connectCodexAppServer(path, { timeoutMs = 15000 } = {}) {
27840
+ * Server requests are observed without answering by default. Legacy one-shot
27841
+ * callers arm ownership-scoped refusals; persistent sessions respond explicitly.
27842
+ */ function connectCodexAppServer(path, { timeoutMs = 15000, signal, onNotification, onServerRequest, onClose } = {}) {
26644
27843
  return new Promise((resolve, reject)=>{
27844
+ if (!Number.isInteger(timeoutMs) || timeoutMs < 1 || timeoutMs > 2147483647) {
27845
+ throw new RangeError("timeoutMs must be an integer 1-2147483647");
27846
+ }
27847
+ for (const listener of [
27848
+ onNotification,
27849
+ onServerRequest,
27850
+ onClose
27851
+ ]){
27852
+ if (listener !== undefined && typeof listener !== "function") throw new TypeError("Event listener must be a function");
27853
+ }
27854
+ if (signal !== undefined && !(signal instanceof AbortSignal)) throw new TypeError("signal must be an AbortSignal");
27855
+ if (signal?.aborted) throw new Error("Codex connection aborted", {
27856
+ cause: signal.reason
27857
+ });
26645
27858
  const socket = (0,node_net__rspack_import_2.createConnection)({
26646
27859
  path
26647
27860
  });
26648
27861
  const key = (0,node_crypto__rspack_import_0.randomBytes)(16).toString("base64");
26649
27862
  const pending = new Map();
26650
27863
  const refused = [];
27864
+ const serverRequests = new Map();
27865
+ const listeners = {
27866
+ notification: new Set(onNotification ? [
27867
+ onNotification
27868
+ ] : []),
27869
+ serverRequest: new Set(onServerRequest ? [
27870
+ onServerRequest
27871
+ ] : []),
27872
+ close: new Set(onClose ? [
27873
+ onClose
27874
+ ] : [])
27875
+ };
27876
+ let closeError;
27877
+ let writeTimer;
26651
27878
  let nextId = 1;
26652
27879
  let buf = Buffer.alloc(0);
26653
27880
  let upgraded = false;
@@ -26662,22 +27889,127 @@ function isObject(value) {
26662
27889
  const failAll = (err)=>{
26663
27890
  if (closed) return;
26664
27891
  closed = true;
27892
+ closeError = err;
26665
27893
  clearTimeout(handshakeTimer);
27894
+ clearTimeout(writeTimer);
27895
+ signal?.removeEventListener("abort", abort);
26666
27896
  if (err && err.delivery == null) err.delivery = pending.size ? "unknown" : "rejected";
26667
27897
  for (const { reject: rej } of pending.values())rej(err);
26668
27898
  pending.clear();
27899
+ serverRequests.clear();
27900
+ client.deferred.length = 0;
27901
+ buf = Buffer.alloc(0);
27902
+ fragParts = [];
27903
+ fragBytes = 0;
27904
+ const closeListeners = [
27905
+ ...listeners.close
27906
+ ];
27907
+ for (const group of Object.values(listeners))group.clear();
26669
27908
  try {
26670
27909
  socket.destroy();
26671
27910
  } catch {}
26672
27911
  reject(err);
27912
+ for (const listener of closeListeners)invoke(listener, err, true);
27913
+ };
27914
+ // Observers execute synchronously to preserve order, but failures never escape
27915
+ // the socket callback. Rejected async callbacks use the same cleanup path.
27916
+ const invoke = (listener, message, closing = false)=>{
27917
+ const failed = (cause)=>{
27918
+ if (!closing) failAll(new Error("Codex event listener failed", {
27919
+ cause
27920
+ }));
27921
+ };
27922
+ try {
27923
+ const result = listener(message);
27924
+ if (result && typeof result.then === "function") Promise.resolve(result).catch(failed);
27925
+ } catch (err) {
27926
+ failed(err);
27927
+ }
27928
+ };
27929
+ const dispatch = (kind, message)=>{
27930
+ for (const listener of [
27931
+ ...listeners[kind]
27932
+ ]){
27933
+ if (closed) break;
27934
+ if (listeners[kind].has(listener)) invoke(listener, message);
27935
+ }
27936
+ };
27937
+ const subscribe = (kind, listener)=>{
27938
+ if (typeof listener !== "function") throw new TypeError("Event listener must be a function");
27939
+ if (closed) {
27940
+ if (kind === "close") invoke(listener, closeError, true);
27941
+ return ()=>{};
27942
+ }
27943
+ const group = listeners[kind];
27944
+ if (!group.has(listener) && group.size >= CODEX_MAX_LISTENERS) {
27945
+ const err = new Error("Codex listener limit exceeds " + CODEX_MAX_LISTENERS);
27946
+ failAll(err);
27947
+ throw err;
27948
+ }
27949
+ group.add(listener);
27950
+ return ()=>group.delete(listener);
26673
27951
  };
27952
+ const abort = ()=>failAll(new Error("Codex connection aborted", {
27953
+ cause: signal.reason
27954
+ }));
26674
27955
  const failProtocol = (detail)=>failAll(new Error("Codex app-server violated the WebSocket protocol: " + detail));
26675
27956
  const write = (opcode, payload)=>{
26676
- if (!socket.destroyed) socket.write(encodeFrame(opcode, payload, (0,node_crypto__rspack_import_0.randomBytes)(4)));
27957
+ if (closed) throw closeError;
27958
+ const encodedBytes = payload.length + (payload.length < 126 ? 6 : payload.length < 65536 ? 8 : 14);
27959
+ if (socket.destroyed || encodedBytes + socket.writableLength > WS_MAX_WRITE_BYTES) {
27960
+ const err = new Error(socket.destroyed ? "Codex socket closed" : "Codex outbound write budget exceeds " + WS_MAX_WRITE_BYTES + " bytes");
27961
+ failAll(err);
27962
+ throw err;
27963
+ }
27964
+ try {
27965
+ if (!socket.write(encodeFrame(opcode, payload, (0,node_crypto__rspack_import_0.randomBytes)(4))) && !writeTimer) {
27966
+ // One absolute deadline for the whole backpressured interval: more
27967
+ // writes must not keep an unread socket alive indefinitely.
27968
+ writeTimer = setTimeout(()=>failAll(new Error("Codex outbound write did not drain within " + timeoutMs + "ms")), timeoutMs);
27969
+ writeTimer.unref();
27970
+ }
27971
+ } catch (err) {
27972
+ failAll(err);
27973
+ throw err;
27974
+ }
26677
27975
  };
26678
27976
  const sendJson = (obj)=>write(0x1, Buffer.from(JSON.stringify(obj)));
27977
+ const respondToRequest = (id, payload)=>{
27978
+ if (closed) throw closeError;
27979
+ if (!serverRequests.has(id)) throw new Error("Unknown or resolved server request: " + id);
27980
+ // Consume ownership before JSON.stringify can invoke caller-owned getters
27981
+ // or toJSON hooks. A failed serialization closes rather than restoring it.
27982
+ serverRequests.delete(id);
27983
+ client.deferred = client.deferred.filter((entry)=>entry.id !== id);
27984
+ try {
27985
+ sendJson({
27986
+ jsonrpc: "2.0",
27987
+ id,
27988
+ ...payload
27989
+ });
27990
+ } catch (cause) {
27991
+ if (closed) throw closeError;
27992
+ const err = new Error("Codex server response serialization failed", {
27993
+ cause
27994
+ });
27995
+ failAll(err);
27996
+ throw err;
27997
+ }
27998
+ };
26679
27999
  const client = {
26680
28000
  refused,
28001
+ get closed () {
28002
+ return closed;
28003
+ },
28004
+ onNotification: (listener)=>subscribe("notification", listener),
28005
+ onServerRequest: (listener)=>subscribe("serverRequest", listener),
28006
+ onClose: (listener)=>subscribe("close", listener),
28007
+ respond: (id, result)=>respondToRequest(id, {
28008
+ result
28009
+ }),
28010
+ rejectRequest: (id, error)=>respondToRequest(id, {
28011
+ error
28012
+ }),
26681
28013
  // Server-initiated requests are only *answered* once our own turn/start
26682
28014
  // is in flight, and then only when they name our own thread/turn:
26683
28015
  // anything earlier — or naming another thread or Desktop turn — belongs
@@ -26702,22 +28034,24 @@ function isObject(value) {
26702
28034
  const params = entry.params && typeof entry.params === "object" && !Array.isArray(entry.params) ? entry.params : null;
26703
28035
  const threadId = params ? params.threadId ?? params.thread_id : null;
26704
28036
  const namedTurnId = params ? params.turnId ?? params.turn_id ?? (params.turn && params.turn.id) : null;
26705
- if (threadId === client.expectedThreadId && namedTurnId === turnId) {
26706
- entry.answered = true;
26707
- sendJson({
26708
- jsonrpc: "2.0",
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
- }
28037
+ if (threadId === client.expectedThreadId && namedTurnId === turnId && serverRequests.get(entry.id) === entry) {
28038
+ client.rejectRequest(entry.id, {
28039
+ code: -32601,
28040
+ message: "gbot codex does not answer " + entry.method + "; configure approval_policy on the daemon"
26714
28041
  });
28042
+ entry.answered = true;
26715
28043
  }
26716
28044
  }
26717
28045
  },
26718
28046
  request (method, params) {
26719
- const id = nextId++;
26720
28047
  return new Promise((res, rej)=>{
28048
+ if (closed) return rej(closeError);
28049
+ if (pending.size >= CODEX_MAX_REQUESTS) {
28050
+ const err = new Error("Codex pending request limit exceeds " + CODEX_MAX_REQUESTS);
28051
+ failAll(err);
28052
+ return rej(err);
28053
+ }
28054
+ const id = nextId++;
26721
28055
  const timer = setTimeout(()=>{
26722
28056
  pending.delete(id);
26723
28057
  rej(new Error("Codex app-server did not answer " + method + " within " + timeoutMs + "ms"));
@@ -26733,12 +28067,18 @@ function isObject(value) {
26733
28067
  rej(e);
26734
28068
  }
26735
28069
  });
26736
- sendJson({
26737
- jsonrpc: "2.0",
26738
- id,
26739
- method,
26740
- params
26741
- });
28070
+ try {
28071
+ sendJson({
28072
+ jsonrpc: "2.0",
28073
+ id,
28074
+ method,
28075
+ params
28076
+ });
28077
+ } catch (err) {
28078
+ const entry = pending.get(id);
28079
+ pending.delete(id);
28080
+ entry?.reject(err);
28081
+ }
26742
28082
  });
26743
28083
  },
26744
28084
  notify (method, params) {
@@ -26750,34 +28090,34 @@ function isObject(value) {
26750
28090
  },
26751
28091
  close () {
26752
28092
  if (closed) return;
26753
- closed = true;
26754
- clearTimeout(handshakeTimer);
26755
- const err = new Error("Codex client closed");
26756
- err.delivery = pending.size ? "unknown" : "rejected";
26757
- for (const { reject: rej } of pending.values())rej(err);
26758
- pending.clear();
26759
- // Best-effort close frame, then guaranteed destruction so no path leaks the socket.
26760
- if (!socket.destroyed && upgraded) write(0x8, Buffer.from([
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
- });
28093
+ // Best effort protocol close; cleanup never depends on the peer reading it.
28094
+ try {
28095
+ if (upgraded) write(0x8, Buffer.from([
28096
+ 0x03,
28097
+ 0xe8
28098
+ ]));
28099
+ } catch {}
28100
+ failAll(new Error("Codex client closed"));
26777
28101
  }
26778
28102
  };
28103
+ signal?.addEventListener("abort", abort, {
28104
+ once: true
28105
+ });
26779
28106
  const onMessage = (msg)=>{
26780
28107
  if (msg.id != null && msg.method) {
28108
+ if (serverRequests.has(msg.id)) return failProtocol("duplicate pending server request id");
28109
+ if (serverRequests.size >= CODEX_MAX_REQUESTS || refused.length >= CODEX_MAX_REQUESTS || client.deferred.length >= CODEX_MAX_REQUESTS) {
28110
+ return failAll(new Error("Codex remembered server request limit exceeds " + CODEX_MAX_REQUESTS));
28111
+ }
28112
+ const entry = {
28113
+ id: msg.id,
28114
+ method: msg.method,
28115
+ params: msg.params,
28116
+ answered: false
28117
+ };
28118
+ serverRequests.set(msg.id, entry);
28119
+ dispatch("serverRequest", msg);
28120
+ if (closed) return;
26781
28121
  let answered = client.answerServerRequests;
26782
28122
  let defer = false;
26783
28123
  // Approval ownership: only answer requests for the turn gbot itself
@@ -26797,28 +28137,30 @@ function isObject(value) {
26797
28137
  } else if (turnId !== client.expectedTurnId) answered = false;
26798
28138
  } else answered = false;
26799
28139
  }
26800
- const entry = {
26801
- id: msg.id,
26802
- method: msg.method,
26803
- params: msg.params,
26804
- answered
26805
- };
28140
+ answered = answered && serverRequests.has(msg.id);
28141
+ defer = defer && serverRequests.has(msg.id);
28142
+ entry.answered = answered;
26806
28143
  refused.push(entry);
26807
28144
  if (defer) {
26808
28145
  client.deferred.push(entry);
26809
28146
  return;
26810
28147
  }
26811
28148
  if (!answered) return;
26812
- sendJson({
26813
- jsonrpc: "2.0",
26814
- id: msg.id,
26815
- error: {
26816
- code: -32601,
26817
- message: "gbot codex does not answer " + msg.method + "; configure approval_policy on the daemon"
26818
- }
28149
+ client.rejectRequest(msg.id, {
28150
+ code: -32601,
28151
+ message: "gbot codex does not answer " + msg.method + "; configure approval_policy on the daemon"
26819
28152
  });
26820
28153
  return;
26821
28154
  }
28155
+ if (msg.id == null && msg.method) {
28156
+ if (msg.method === "serverRequest/resolved") {
28157
+ const id = msg.params?.requestId;
28158
+ serverRequests.delete(id);
28159
+ client.deferred = client.deferred.filter((entry)=>entry.id !== id);
28160
+ }
28161
+ dispatch("notification", msg);
28162
+ return;
28163
+ }
26822
28164
  if (msg.id == null || !pending.has(msg.id)) return;
26823
28165
  const entry = pending.get(msg.id);
26824
28166
  pending.delete(msg.id);
@@ -26844,12 +28186,21 @@ function isObject(value) {
26844
28186
  failAll(new Error("Codex app-server sent a malformed message"));
26845
28187
  return;
26846
28188
  }
26847
- onMessage(msg);
28189
+ try {
28190
+ onMessage(msg);
28191
+ } catch (err) {
28192
+ failAll(err);
28193
+ }
26848
28194
  };
28195
+ socket.on("drain", ()=>{
28196
+ clearTimeout(writeTimer);
28197
+ writeTimer = undefined;
28198
+ });
26849
28199
  socket.once("error", (err)=>failAll(new Error("Could not connect to Codex app-server at " + path + ": " + err.message)));
26850
28200
  socket.once("close", ()=>failAll(new Error("Codex app-server closed the connection")));
26851
28201
  socket.once("connect", ()=>socket.write(upgradeRequest(key)));
26852
28202
  socket.on("data", (chunk)=>{
28203
+ if (closed) return;
26853
28204
  buf = Buffer.concat([
26854
28205
  buf,
26855
28206
  chunk
@@ -26869,7 +28220,7 @@ function isObject(value) {
26869
28220
  clearTimeout(handshakeTimer);
26870
28221
  resolve(client);
26871
28222
  }
26872
- for(;;){
28223
+ while(!closed){
26873
28224
  const frame = decodeFrame(buf);
26874
28225
  if (!frame) {
26875
28226
  const claimed = peekFrameLength(buf);
@@ -26885,10 +28236,18 @@ function isObject(value) {
26885
28236
  if (frame.masked) return failProtocol("server frames must not be masked");
26886
28237
  if (frame.opcode >= 0x8) {
26887
28238
  if (!frame.fin || frame.payload.length > 125) return failProtocol("bad control frame");
26888
- if (frame.opcode === 0x9) write(0xa, frame.payload);
26889
- else if (frame.opcode === 0x8) {
26890
- write(0x8, frame.payload);
26891
- socket.end();
28239
+ if (frame.opcode === 0x9) {
28240
+ try {
28241
+ write(0xa, frame.payload);
28242
+ } catch {
28243
+ return;
28244
+ }
28245
+ } else if (frame.opcode === 0x8) {
28246
+ try {
28247
+ write(0x8, frame.payload);
28248
+ } catch {
28249
+ return;
28250
+ }
26892
28251
  failAll(new Error("Codex app-server closed the connection"));
26893
28252
  }
26894
28253
  continue; // pong and other control frames carry nothing for us
@@ -26944,12 +28303,12 @@ function appServerVersion(initResult) {
26944
28303
  }
26945
28304
  throw new CodexRouteError(unreachableMessage(path), "socket-absent");
26946
28305
  }
26947
- async function openSession(env = process.env, { experimental = false } = {}) {
28306
+ async function openCodexSession(env = process.env, { experimental = false, ...options } = {}) {
26948
28307
  const path = codexSocketPath(env);
26949
28308
  assertRoute(path);
26950
28309
  let client;
26951
28310
  try {
26952
- client = await connectCodexAppServer(path);
28311
+ client = await connectCodexAppServer(path, options);
26953
28312
  } catch (err) {
26954
28313
  throw connectError(err, path);
26955
28314
  }
@@ -26958,7 +28317,7 @@ async function openSession(env = process.env, { experimental = false } = {}) {
26958
28317
  init = await client.request("initialize", {
26959
28318
  clientInfo: {
26960
28319
  name: "gbot",
26961
- version: pkg.version
28320
+ version: _package_json__rspack_import_6/* .version */.rE
26962
28321
  },
26963
28322
  ...experimental ? {
26964
28323
  capabilities: {
@@ -26974,13 +28333,19 @@ async function openSession(env = process.env, { experimental = false } = {}) {
26974
28333
  client.close();
26975
28334
  throw new CodexProtocolError("initialize", "result is not an object");
26976
28335
  }
26977
- client.notify("initialized");
28336
+ try {
28337
+ client.notify("initialized");
28338
+ } catch (err) {
28339
+ client.close();
28340
+ throw handshakeError(err);
28341
+ }
26978
28342
  return {
26979
28343
  client,
26980
28344
  path,
26981
28345
  init
26982
28346
  };
26983
28347
  }
28348
+ const openSession = openCodexSession;
26984
28349
  const CODEX_VERSION_PROBE_TIMEOUT_MS = 3000;
26985
28350
  /** Bounded `codex --version` probe: `{ version, probe }` where probe is ok | missing | timeout | error. */ function probeLocalCodexVersion(timeoutMs = CODEX_VERSION_PROBE_TIMEOUT_MS) {
26986
28351
  const out = (0,node_child_process__rspack_import_5.spawnSync)("codex", [
@@ -27328,12 +28693,14 @@ function requireExperimental(env, what) {
27328
28693
  reason: "experimental-disabled"
27329
28694
  });
27330
28695
  }
27331
- function unsupportedOrRpc(err, method, threadId, envelope) {
28696
+ function unsupportedOrRpc(err, method, threadId, envelope, turnId) {
28697
+ const guarded = method === "turn/steer";
27332
28698
  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.", {
28699
+ 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
28700
  delivery: "rejected",
27335
28701
  reason: "unsupported",
27336
28702
  threadId,
28703
+ turnId,
27337
28704
  ...envelope
27338
28705
  });
27339
28706
  }
@@ -27341,12 +28708,14 @@ function unsupportedOrRpc(err, method, threadId, envelope) {
27341
28708
  delivery: "rejected",
27342
28709
  reason: "rejected",
27343
28710
  threadId,
28711
+ turnId,
27344
28712
  ...envelope
27345
28713
  });
27346
- return new CodexSendError("Lost the Codex " + method + " response for thread " + threadId + ": " + (err && err.message || err) + ". Delivery is unknown; list the queue before resending.", {
28714
+ 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
28715
  delivery: err && err.delivery || "unknown",
27348
28716
  reason: "transport",
27349
28717
  threadId,
28718
+ turnId,
27350
28719
  ...envelope
27351
28720
  });
27352
28721
  }
@@ -27385,30 +28754,70 @@ function unsupportedOrRpc(err, method, threadId, envelope) {
27385
28754
  /**
27386
28755
  * @param {string} threadId
27387
28756
  * @param {string} text
27388
- * @param {{ env?: NodeJS.ProcessEnv, envelope?: object, whenBusy?: "reject"|"queue" }} [opts]
28757
+ * @param {{ env?: NodeJS.ProcessEnv, envelope?: object, whenBusy?: "reject"|"queue"|"steer", session?: object, expectedTurnId?: string, expectedCwd?: string, signal?: AbortSignal }} [opts]
27389
28758
  */ async function sendToCodexThread(threadId, text, { env = process.env, envelope = buildEnvelope({
27390
28759
  env
27391
- }), whenBusy = "reject" } = {}) {
28760
+ }), whenBusy = "reject", session, expectedTurnId, expectedCwd, signal } = {}) {
27392
28761
  try {
27393
28762
  const receipt = await sendToCodexThreadInner(threadId, text, {
27394
28763
  env,
27395
28764
  envelope,
27396
- whenBusy
28765
+ whenBusy,
28766
+ session,
28767
+ expectedTurnId,
28768
+ expectedCwd,
28769
+ signal
27397
28770
  });
27398
28771
  return (0,_codex_contract_js__rspack_import_7/* .outcomeFromReceipt */.Dz)(receipt);
27399
28772
  } catch (err) {
27400
28773
  // Every receipt names the message, including refusals that never reached the daemon.
27401
- if (err instanceof CodexSendError || err instanceof CodexRouteError || err instanceof CodexProtocolError) attachEnvelope(err, envelope);
28774
+ if (err && typeof err === "object") {
28775
+ attachEnvelope(err, envelope);
28776
+ if (err.threadId === undefined) err.threadId = threadId;
28777
+ }
27402
28778
  return (0,_codex_contract_js__rspack_import_7/* .outcomeFromError */.DG)(err);
27403
28779
  }
27404
28780
  }
27405
- async function sendToCodexThreadInner(threadId, text, { env, envelope, whenBusy }) {
27406
- if (whenBusy !== "reject" && whenBusy !== "queue") throw new RangeError("--when-busy must be reject or queue");
28781
+ async function sendToCodexThreadInner(threadId, text, { env, envelope, whenBusy, session, expectedTurnId, expectedCwd, signal }) {
28782
+ if (![
28783
+ "reject",
28784
+ "queue",
28785
+ ...session ? [
28786
+ "steer"
28787
+ ] : []
28788
+ ].includes(whenBusy)) throw new RangeError("--when-busy must be reject, queue, or persistent steer");
28789
+ if (whenBusy === "steer" && (typeof expectedTurnId !== "string" || !ID_PATTERN.test(expectedTurnId))) throw new RangeError("steer requires expectedTurnId");
28790
+ if (typeof threadId !== "string" || !ID_PATTERN.test(threadId)) throw new RangeError("Invalid threadId");
28791
+ if (typeof text !== "string" || !text.trim() || Buffer.byteLength(text) > WS_MAX_MESSAGE_BYTES) throw new RangeError("Message must contain text within 4 MiB");
28792
+ if (!envelope || typeof envelope.messageId !== "string" || !ID_PATTERN.test(envelope.messageId)) throw new RangeError("Invalid envelope messageId");
28793
+ const validated = buildEnvelope({
28794
+ correlationId: envelope.correlationId,
28795
+ replyTo: envelope.replyTo,
28796
+ hop: envelope.hop,
28797
+ env
28798
+ });
28799
+ envelope = {
28800
+ ...validated,
28801
+ messageId: envelope.messageId,
28802
+ header: Boolean(envelope.header)
28803
+ };
27407
28804
  assertThreadAllowed(threadId, env);
27408
28805
  if (whenBusy === "queue") requireExperimental(env, "--when-busy queue");
28806
+ if (signal !== undefined && !(signal instanceof AbortSignal)) throw new TypeError("signal must be an AbortSignal");
28807
+ const assertNotCancelled = ()=>{
28808
+ if (signal?.aborted) throw new CodexSendError("Codex submission cancelled before delivery", {
28809
+ delivery: "rejected",
28810
+ reason: "cancelled",
28811
+ threadId,
28812
+ turnId: whenBusy === "steer" ? expectedTurnId : undefined,
28813
+ ...envelope
28814
+ });
28815
+ };
28816
+ assertNotCancelled();
27409
28817
  const body = withEnvelopeHeader(text, envelope, env);
27410
- const { client } = await openSession(env, {
27411
- experimental: whenBusy === "queue"
28818
+ const { client } = session ?? await openSession(env, {
28819
+ experimental: whenBusy === "queue",
28820
+ signal
27412
28821
  });
27413
28822
  try {
27414
28823
  let resumed;
@@ -27418,6 +28827,7 @@ async function sendToCodexThreadInner(threadId, text, { env, envelope, whenBusy
27418
28827
  excludeTurns: true
27419
28828
  });
27420
28829
  } catch (err) {
28830
+ assertNotCancelled();
27421
28831
  if (err instanceof CodexSendError) throw err;
27422
28832
  throw new CodexSendError(explainSendError(err, threadId).message, {
27423
28833
  delivery: err instanceof CodexRpcError ? "rejected" : err && err.delivery || "unknown",
@@ -27426,9 +28836,24 @@ async function sendToCodexThreadInner(threadId, text, { env, envelope, whenBusy
27426
28836
  ...envelope
27427
28837
  });
27428
28838
  }
28839
+ // A shared session stays connected when this conversation is cancelled.
28840
+ // Recheck after the last awaited preflight, before any submission request.
28841
+ assertNotCancelled();
27429
28842
  if (!isObject(resumed) || !isObject(resumed.thread) || typeof resumed.thread.id !== "string") {
27430
28843
  throw new CodexProtocolError("thread/resume", "missing `thread.id`");
27431
28844
  }
28845
+ if (resumed.thread.id !== threadId) throw new CodexSendError("thread/resume returned a different thread ID", {
28846
+ delivery: "rejected",
28847
+ reason: "bad-response",
28848
+ threadId,
28849
+ ...envelope
28850
+ });
28851
+ 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", {
28852
+ delivery: "rejected",
28853
+ reason: "cwd-mismatch",
28854
+ threadId,
28855
+ ...envelope
28856
+ });
27432
28857
  const state = threadState(resumed, threadId);
27433
28858
  const receiptBase = {
27434
28859
  threadId: resumed.thread.id,
@@ -27453,6 +28878,38 @@ async function sendToCodexThreadInner(threadId, text, { env, envelope, whenBusy
27453
28878
  ...envelope
27454
28879
  });
27455
28880
  }
28881
+ if (whenBusy === "steer") {
28882
+ let steered;
28883
+ try {
28884
+ steered = await client.request("turn/steer", {
28885
+ threadId,
28886
+ expectedTurnId,
28887
+ clientUserMessageId: envelope.messageId,
28888
+ input: [
28889
+ {
28890
+ type: "text",
28891
+ text: body
28892
+ }
28893
+ ]
28894
+ });
28895
+ } catch (err) {
28896
+ throw unsupportedOrRpc(err, "turn/steer", threadId, envelope, expectedTurnId);
28897
+ }
28898
+ if (typeof steered?.turnId !== "string" || steered.turnId !== expectedTurnId) {
28899
+ throw new CodexSendError("Malformed turn/steer acknowledgment", {
28900
+ delivery: "unknown",
28901
+ reason: "bad-response",
28902
+ threadId,
28903
+ turnId: expectedTurnId,
28904
+ ...envelope
28905
+ });
28906
+ }
28907
+ return {
28908
+ delivery: "accepted",
28909
+ ...receiptBase,
28910
+ turnId: steered.turnId
28911
+ };
28912
+ }
27456
28913
  if (state.busy) {
27457
28914
  let queued;
27458
28915
  try {
@@ -27496,9 +28953,11 @@ async function sendToCodexThreadInner(threadId, text, { env, envelope, whenBusy
27496
28953
  // that arrives before the acknowledgment supplies our turn id wait in
27497
28954
  // client.deferred and are adopted only on a match. Requests missing
27498
28955
  // thread or turn IDs remain unanswered because ownership is unknown.
27499
- client.expectedThreadId = threadId;
27500
- client.expectedTurnId = null;
27501
- client.answerServerRequests = true;
28956
+ if (!session) {
28957
+ client.expectedThreadId = threadId;
28958
+ client.expectedTurnId = null;
28959
+ client.answerServerRequests = true;
28960
+ }
27502
28961
  let turn;
27503
28962
  try {
27504
28963
  turn = await client.request("turn/start", {
@@ -27533,7 +28992,7 @@ async function sendToCodexThreadInner(threadId, text, { env, envelope, whenBusy
27533
28992
  ...envelope
27534
28993
  });
27535
28994
  }
27536
- client._adoptTurn(turnId);
28995
+ if (!session) client._adoptTurn(turnId);
27537
28996
  const freshRefused = client.refused.slice(seenRefused).filter((r)=>{
27538
28997
  if (!r.answered) return false;
27539
28998
  const params = r.params && typeof r.params === "object" && !Array.isArray(r.params) ? r.params : null;
@@ -27562,18 +29021,22 @@ async function sendToCodexThreadInner(threadId, text, { env, envelope, whenBusy
27562
29021
  turnStatus: turn.turn.status
27563
29022
  };
27564
29023
  } finally{
27565
- client.close();
29024
+ if (!session) client.close();
27566
29025
  }
27567
29026
  }
27568
29027
 
27569
29028
  __webpack_require__.d(__webpack_exports__, {
29029
+ $3: () => (assertThreadAllowed),
27570
29030
  Bt: () => (listCodexQueue),
27571
29031
  MU: () => (codexStatus),
27572
29032
  Mr: () => (withEnvelopeHeader),
27573
29033
  X$: () => (listCodexThreads),
27574
29034
  ZS: () => (sendToCodexThread),
29035
+ e0: () => (experimentalEnabled),
29036
+ eC: () => (openCodexSession),
27575
29037
  nq: () => (buildEnvelope),
27576
- pF: () => (singleLine)
29038
+ pF: () => (singleLine),
29039
+ ql: () => (codexSocketPath)
27577
29040
  });
27578
29041
 
27579
29042
 
@@ -27663,37 +29126,483 @@ __webpack_require__.d(__webpack_exports__, {
27663
29126
  ]){
27664
29127
  if (error[key] !== undefined) out[key] = error[key];
27665
29128
  }
27666
- if (out.reason === undefined && isUsage(error)) out.reason = "usage";
27667
- }
27668
- if (out.delivery === undefined) out.delivery = "rejected";
27669
- return /** @type {CodexSendOutcome & { error: string, exitCode: 1 }} */ {
27670
- ...out,
27671
- exitCode: 1
29129
+ if (out.reason === undefined && isUsage(error)) out.reason = "usage";
29130
+ }
29131
+ if (out.delivery === undefined) out.delivery = "rejected";
29132
+ return /** @type {CodexSendOutcome & { error: string, exitCode: 1 }} */ {
29133
+ ...out,
29134
+ exitCode: 1
29135
+ };
29136
+ }
29137
+ /**
29138
+ * Normalize a successful send receipt into a document with exitCode.
29139
+ * @param {Record<string, unknown>} receipt
29140
+ * @returns {CodexSendOutcome}
29141
+ */ function outcomeFromReceipt(receipt) {
29142
+ const base = {
29143
+ ...receipt
29144
+ };
29145
+ if (base.delivery === undefined) base.delivery = "accepted";
29146
+ const exitCode = sendExitCode(/** @type {{ delivery: CodexDelivery, reason?: string, error?: string }} */ base);
29147
+ if (exitCode === 1 && base.error === undefined && base.reason === "approval-refused") {
29148
+ base.error = typeof base.message === "string" ? base.message : "Codex refused one or more approvals.";
29149
+ }
29150
+ return /** @type {CodexSendOutcome} */ {
29151
+ ...base,
29152
+ exitCode
29153
+ };
29154
+ }
29155
+
29156
+ __webpack_require__.d(__webpack_exports__, {
29157
+ AQ: () => (withStatusExitCode),
29158
+ DG: () => (outcomeFromError),
29159
+ Dz: () => (outcomeFromReceipt)
29160
+ });
29161
+
29162
+
29163
+ },
29164
+ "./src/core/codex/conversation.js"(__unused_rspack___webpack_module__, __webpack_exports__, __webpack_require__) {
29165
+ /* import */ var _contract_js__rspack_import_0 = __webpack_require__("./src/core/codex/contract.js");
29166
+ /* import */ var node_fs__rspack_import_1 = __webpack_require__("node:fs");
29167
+ /* import */ var _codex_bridge_js__rspack_import_2 = __webpack_require__("./src/core/codex-bridge.js");
29168
+
29169
+
29170
+
29171
+ const ID = /^[A-Za-z0-9_.:-]{1,128}$/;
29172
+ const BUDGET = 4 * 1024 * 1024;
29173
+ function conversationId(value, name = 'threadId') {
29174
+ if (typeof value !== 'string' || !ID.test(value)) throw new RangeError(`${name} must be 1-128 identifier characters`);
29175
+ return value;
29176
+ }
29177
+ function boundedInteger(value, max, name) {
29178
+ if (!Number.isInteger(value) || value < 1 || value > max) throw new RangeError(`${name} must be an integer 1-${max}`);
29179
+ return value;
29180
+ }
29181
+ const terminal = (status)=>[
29182
+ 'completed',
29183
+ 'failed',
29184
+ 'interrupted'
29185
+ ].includes(status);
29186
+ const namedTurn = (p)=>p?.turnId ?? p?.turn_id ?? p?.turn?.id;
29187
+ /** 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 } = {}) {
29188
+ if (![
29189
+ 'thread/turns/list',
29190
+ 'thread/items/list'
29191
+ ].includes(method)) throw new RangeError('Unsupported history method');
29192
+ conversationId(threadId);
29193
+ const client = session.client;
29194
+ let cursor;
29195
+ const seen = new Set();
29196
+ for(let page = 0; page < 20; page++){
29197
+ if (stopped() || signal?.aborted) throw new Error('History coverage incomplete: observation cancelled');
29198
+ const result = await client.request(method, {
29199
+ ...params,
29200
+ threadId,
29201
+ limit: 100,
29202
+ ...cursor ? {
29203
+ cursor
29204
+ } : {}
29205
+ });
29206
+ if (stopped() || signal?.aborted) throw new Error('History coverage incomplete: observation cancelled');
29207
+ 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`);
29208
+ if (visit(result.data)) return {
29209
+ complete: false,
29210
+ reason: 'matched',
29211
+ pages: page + 1
29212
+ };
29213
+ if (result.nextCursor == null) return {
29214
+ complete: true,
29215
+ reason: 'exhausted',
29216
+ pages: page + 1
29217
+ };
29218
+ if (seen.has(result.nextCursor)) throw new Error('History coverage incomplete: repeated pagination cursor');
29219
+ seen.add(result.nextCursor);
29220
+ cursor = result.nextCursor;
29221
+ }
29222
+ throw new Error('History coverage incomplete: 20 page limit');
29223
+ }
29224
+ /** A bounded observer. Cancellation ends observation, never the daemon's turn. */ async function openCodexConversation(threadId, options = {}) {
29225
+ conversationId(threadId);
29226
+ const { env = process.env, expectedCwd, signal, onEvent } = options;
29227
+ (0,_codex_bridge_js__rspack_import_2/* .assertThreadAllowed */.$3)(threadId, env);
29228
+ if (signal !== undefined && !(signal instanceof AbortSignal)) throw new TypeError('signal must be an AbortSignal');
29229
+ if (onEvent !== undefined && typeof onEvent !== 'function') throw new TypeError('onEvent must be a function');
29230
+ if (signal?.aborted) throw new Error('Observation cancelled');
29231
+ const expected = expectedCwd === undefined ? undefined : (0,node_fs__rspack_import_1.realpathSync)(expectedCwd);
29232
+ const session = options.session ?? await (0,_codex_bridge_js__rspack_import_2/* .openCodexSession */.eC)(env, {
29233
+ signal,
29234
+ experimental: (0,_codex_bridge_js__rspack_import_2/* .experimentalEnabled */.e0)(env)
29235
+ });
29236
+ const { client } = session;
29237
+ const events = [];
29238
+ const acceptedTurns = new Set();
29239
+ const wake = new Set();
29240
+ let bytes = 0, overflow = false, disconnected = client.closed, closed = false;
29241
+ const record = (event)=>{
29242
+ const size = Buffer.byteLength(JSON.stringify(event));
29243
+ if (size > BUDGET) {
29244
+ overflow = true;
29245
+ } else {
29246
+ while(events.length >= 500 || bytes + size > BUDGET){
29247
+ bytes -= events.shift().bytes;
29248
+ overflow = true;
29249
+ }
29250
+ events.push({
29251
+ event,
29252
+ bytes: size
29253
+ });
29254
+ bytes += size;
29255
+ }
29256
+ for (const listener of [
29257
+ ...wake
29258
+ ])listener();
29259
+ return onEvent?.(event);
27672
29260
  };
27673
- }
27674
- /**
27675
- * Normalize a successful send receipt into a document with exitCode.
27676
- * @param {Record<string, unknown>} receipt
27677
- * @returns {CodexSendOutcome}
27678
- */ function outcomeFromReceipt(receipt) {
27679
- const base = {
27680
- ...receipt
29261
+ const observe = (kind)=>(message)=>{
29262
+ const p = message.params;
29263
+ if ((p?.threadId ?? p?.thread_id) !== threadId) return;
29264
+ return record({
29265
+ kind,
29266
+ ...message
29267
+ });
29268
+ };
29269
+ const unsubs = [
29270
+ client.onNotification(observe('notification')),
29271
+ client.onServerRequest(observe('interaction')),
29272
+ client.onClose((error)=>{
29273
+ disconnected = true;
29274
+ return record({
29275
+ kind: 'disconnect',
29276
+ error: error?.message
29277
+ });
29278
+ })
29279
+ ];
29280
+ const close = async ()=>{
29281
+ if (closed) return;
29282
+ closed = true;
29283
+ for (const unsubscribe of unsubs)unsubscribe();
29284
+ for (const listener of wake)listener();
29285
+ if (!options.session) client.close();
27681
29286
  };
27682
- if (base.delivery === undefined) base.delivery = "accepted";
27683
- const exitCode = sendExitCode(/** @type {{ delivery: CodexDelivery, reason?: string, error?: string }} */ base);
27684
- if (exitCode === 1 && base.error === undefined && base.reason === "approval-refused") {
27685
- base.error = typeof base.message === "string" ? base.message : "Codex refused one or more approvals.";
29287
+ let resumed;
29288
+ try {
29289
+ resumed = await client.request('thread/resume', {
29290
+ threadId,
29291
+ excludeTurns: true
29292
+ });
29293
+ if (resumed?.thread?.id !== threadId) throw new Error('thread/resume returned a different thread ID');
29294
+ const cwd = resumed.cwd ?? resumed.thread.cwd;
29295
+ 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');
29296
+ } catch (error) {
29297
+ await close();
29298
+ throw error;
29299
+ }
29300
+ /** @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 }) {
29301
+ conversationId(turnId, 'turnId');
29302
+ if (messageId !== undefined) conversationId(messageId, 'messageId');
29303
+ const anchors = afterMessageId === undefined ? [] : Array.isArray(afterMessageId) ? afterMessageId : [
29304
+ afterMessageId
29305
+ ];
29306
+ if (afterMessageId !== undefined) boundedInteger(anchors.length, 200, 'afterMessageId count');
29307
+ for (const anchor of anchors)conversationId(anchor, 'afterMessageId');
29308
+ boundedInteger(timeoutMs, 600000, 'timeoutMs');
29309
+ boundedInteger(maxOutputBytes, BUDGET, 'maxOutputBytes');
29310
+ if (waitSignal !== undefined && !(waitSignal instanceof AbortSignal)) throw new TypeError('signal must be an AbortSignal');
29311
+ let done = false, status = acceptedTurns.has(turnId) ? 'inProgress' : undefined, error, historyError, itemBytes = 0, truncated = overflow;
29312
+ const items = new Map();
29313
+ const add = (item)=>{
29314
+ if (!item || typeof item.id !== 'string' || typeof item.type !== 'string') throw new Error('Invalid history item');
29315
+ if (item.type !== 'agentMessage' || typeof item.text !== 'string' || item.phase !== 'final_answer' && item.phase != null) return;
29316
+ const normalized = {
29317
+ id: item.id,
29318
+ type: item.type,
29319
+ phase: item.phase ?? null,
29320
+ text: item.text
29321
+ };
29322
+ const size = Buffer.byteLength(JSON.stringify(normalized));
29323
+ const prior = items.get(item.id);
29324
+ if (itemBytes - (prior?.bytes ?? 0) + size > BUDGET || !prior && items.size >= 2000) {
29325
+ truncated = true;
29326
+ return;
29327
+ }
29328
+ itemBytes += size - (prior?.bytes ?? 0);
29329
+ items.set(item.id, {
29330
+ item: normalized,
29331
+ bytes: size
29332
+ });
29333
+ };
29334
+ const scan = ()=>{
29335
+ const interactions = new Map();
29336
+ for (const { event } of events){
29337
+ const p = event.params;
29338
+ if (event.method === 'serverRequest/resolved') {
29339
+ interactions.delete(p.requestId);
29340
+ continue;
29341
+ }
29342
+ if (namedTurn(p) !== turnId) continue;
29343
+ if (event.kind === 'interaction') interactions.set(event.id, event);
29344
+ if (event.method === 'turn/started' && !terminal(status)) status = p.turn?.status;
29345
+ if (event.method === 'item/completed' && afterMessageId === undefined) add(p.item);
29346
+ if (event.method === 'turn/completed') {
29347
+ status = p.turn?.status;
29348
+ error = p.turn?.error;
29349
+ if (afterMessageId === undefined) for (const item of p.turn?.items ?? [])add(item);
29350
+ }
29351
+ }
29352
+ return [
29353
+ ...interactions.values()
29354
+ ];
29355
+ };
29356
+ const result = (state, detail)=>{
29357
+ const interactions = scan();
29358
+ const candidates = [
29359
+ ...items.values()
29360
+ ].map((x)=>x.item);
29361
+ const finals = candidates.filter((i)=>i.phase === 'final_answer');
29362
+ // Old app-servers omit phase; use their completed agent items only at terminal status.
29363
+ const selected = finals.length ? finals : terminal(state) ? candidates : [];
29364
+ const reply = {
29365
+ text: '',
29366
+ items: [],
29367
+ truncated: truncated || overflow
29368
+ };
29369
+ for (const item of selected){
29370
+ const text = reply.text ? `${reply.text}\n${item.text}` : item.text;
29371
+ if (Buffer.byteLength(JSON.stringify({
29372
+ text,
29373
+ items: [
29374
+ ...reply.items,
29375
+ item
29376
+ ]
29377
+ })) > maxOutputBytes) {
29378
+ reply.truncated = true;
29379
+ break;
29380
+ }
29381
+ reply.text = text;
29382
+ reply.items.push(item);
29383
+ }
29384
+ return {
29385
+ threadId,
29386
+ turnId,
29387
+ ...messageId === undefined ? {} : {
29388
+ messageId
29389
+ },
29390
+ execution: {
29391
+ state,
29392
+ ...detail ? {
29393
+ error: detail
29394
+ } : {}
29395
+ },
29396
+ reply,
29397
+ interactions
29398
+ };
29399
+ };
29400
+ let timer, notify;
29401
+ const abortSignals = [
29402
+ signal,
29403
+ waitSignal
29404
+ ].filter(Boolean);
29405
+ const stopped = new Promise((resolve)=>{
29406
+ notify = ()=>{
29407
+ if (abortSignals.some((s)=>s.aborted) || closed) resolve([
29408
+ 'unknown',
29409
+ 'Observation cancelled'
29410
+ ]);
29411
+ else if (disconnected) resolve([
29412
+ 'disconnected',
29413
+ 'Codex connection closed'
29414
+ ]);
29415
+ };
29416
+ timer = setTimeout(()=>resolve([
29417
+ 'timeout',
29418
+ 'Observation deadline reached'
29419
+ ]), timeoutMs);
29420
+ for (const s of abortSignals)s.addEventListener('abort', notify, {
29421
+ once: true
29422
+ });
29423
+ wake.add(notify);
29424
+ notify();
29425
+ });
29426
+ const collect = async ()=>{
29427
+ scan();
29428
+ try {
29429
+ let found = false, historyTerminal = false, anchorFound = afterMessageId === undefined;
29430
+ const missingAnchors = new Set(anchors);
29431
+ await visitCodexHistory(session, threadId, 'thread/turns/list', {}, (data)=>{
29432
+ for (const turn of data)if (!turn || typeof turn.id !== 'string' || typeof turn.status !== 'string') throw new Error('Invalid turn history');
29433
+ const turn = data.find((t)=>t.id === turnId);
29434
+ if (!turn) return false;
29435
+ found = true;
29436
+ historyTerminal = terminal(turn.status);
29437
+ if (!terminal(status)) {
29438
+ status = turn.status;
29439
+ error = turn.error;
29440
+ }
29441
+ return true;
29442
+ }, {
29443
+ stopped: ()=>done
29444
+ });
29445
+ // Notifications can establish completion while the history response is in flight.
29446
+ scan();
29447
+ if (!found && !status) return [
29448
+ 'unknown',
29449
+ 'History coverage incomplete: selected turn not found'
29450
+ ];
29451
+ await visitCodexHistory(session, threadId, 'thread/items/list', {
29452
+ turnId,
29453
+ sortDirection: 'asc'
29454
+ }, (data)=>{
29455
+ for (const row of data){
29456
+ if (!row || row.turnId !== turnId || !row.item) throw new Error('Invalid thread/items/list wrapper');
29457
+ if (row.item.type === 'userMessage' && anchors.includes(row.item.clientId)) {
29458
+ anchorFound = true;
29459
+ missingAnchors.delete(row.item.clientId);
29460
+ }
29461
+ if (anchorFound) add(row.item);
29462
+ }
29463
+ return false;
29464
+ }, {
29465
+ stopped: ()=>done
29466
+ });
29467
+ if (!anchorFound || missingAnchors.size) {
29468
+ items.clear();
29469
+ return [
29470
+ 'unknown',
29471
+ 'History coverage incomplete: reply anchor not found'
29472
+ ];
29473
+ }
29474
+ if (afterMessageId !== undefined && !historyTerminal) return scan().length ? [
29475
+ 'waiting-for-input'
29476
+ ] : [
29477
+ 'unknown',
29478
+ 'Anchored reply awaits terminal history'
29479
+ ];
29480
+ } catch (err) {
29481
+ historyError = err.message;
29482
+ truncated = true;
29483
+ }
29484
+ if (afterMessageId !== undefined && historyError) {
29485
+ items.clear();
29486
+ return [
29487
+ 'unknown',
29488
+ historyError
29489
+ ];
29490
+ }
29491
+ while(!done){
29492
+ const interactions = scan();
29493
+ if (terminal(status)) return [
29494
+ status,
29495
+ error ?? historyError
29496
+ ];
29497
+ if (historyError || overflow) return [
29498
+ 'unknown',
29499
+ historyError ?? 'Notification coverage overflow'
29500
+ ];
29501
+ if (interactions.length) return [
29502
+ 'waiting-for-input'
29503
+ ];
29504
+ await new Promise((resolve)=>{
29505
+ const listener = ()=>{
29506
+ wake.delete(listener);
29507
+ resolve();
29508
+ };
29509
+ wake.add(listener);
29510
+ });
29511
+ }
29512
+ return [
29513
+ 'unknown',
29514
+ 'Observation ended'
29515
+ ];
29516
+ };
29517
+ try {
29518
+ const [state, detail] = await Promise.race([
29519
+ stopped,
29520
+ collect()
29521
+ ]);
29522
+ return result(state, detail);
29523
+ } finally{
29524
+ done = true;
29525
+ clearTimeout(timer);
29526
+ wake.delete(notify);
29527
+ for (const s of abortSignals)s.removeEventListener('abort', notify);
29528
+ for (const listener of [
29529
+ ...wake
29530
+ ])listener();
29531
+ }
29532
+ }
29533
+ /** @param {{timeoutMs?: number, maxEvents?: number, signal?: AbortSignal}} [options] */ async function watch({ timeoutMs = 30000, maxEvents = 100, signal: watchSignal } = {}) {
29534
+ boundedInteger(timeoutMs, 600000, 'timeoutMs');
29535
+ boundedInteger(maxEvents, 500, 'maxEvents');
29536
+ if (watchSignal !== undefined && !(watchSignal instanceof AbortSignal)) throw new TypeError('signal must be an AbortSignal');
29537
+ const signals = [
29538
+ signal,
29539
+ watchSignal
29540
+ ].filter(Boolean);
29541
+ let timer, listener;
29542
+ const reason = await new Promise((resolve)=>{
29543
+ listener = ()=>{
29544
+ if (signals.some((s)=>s.aborted) || closed) resolve('cancelled');
29545
+ else if (disconnected) resolve('disconnected');
29546
+ else if (events.length >= maxEvents) resolve('event-limit');
29547
+ };
29548
+ timer = setTimeout(()=>resolve('timeout'), timeoutMs);
29549
+ wake.add(listener);
29550
+ for (const s of signals)s.addEventListener('abort', listener, {
29551
+ once: true
29552
+ });
29553
+ listener();
29554
+ });
29555
+ clearTimeout(timer);
29556
+ wake.delete(listener);
29557
+ for (const s of signals)s.removeEventListener('abort', listener);
29558
+ return {
29559
+ threadId,
29560
+ events: events.slice(0, maxEvents).map((x)=>x.event),
29561
+ reason,
29562
+ truncated: overflow || events.length > maxEvents
29563
+ };
27686
29564
  }
27687
- return /** @type {CodexSendOutcome} */ {
27688
- ...base,
27689
- exitCode
29565
+ return {
29566
+ threadId,
29567
+ cwd: resumed.cwd ?? resumed.thread.cwd,
29568
+ wait,
29569
+ watch,
29570
+ close,
29571
+ /** @param {string} text
29572
+ * @param {{envelope?: object, whenBusy?: string, expectedTurnId?: string, signal?: AbortSignal}} [options] */ async send (text, { envelope = (0,_codex_bridge_js__rspack_import_2/* .buildEnvelope */.nq)({
29573
+ env
29574
+ }), whenBusy = 'reject', expectedTurnId, signal: sendSignal } = {}) {
29575
+ if (closed) return (0,_contract_js__rspack_import_0/* .outcomeFromError */.DG)(Object.assign(new Error('Conversation closed'), {
29576
+ delivery: 'rejected',
29577
+ reason: 'closed',
29578
+ threadId,
29579
+ envelope
29580
+ }));
29581
+ if (sendSignal !== undefined && !(sendSignal instanceof AbortSignal)) throw new TypeError('signal must be an AbortSignal');
29582
+ const submissionSignal = signal && sendSignal ? AbortSignal.any([
29583
+ signal,
29584
+ sendSignal
29585
+ ]) : sendSignal ?? signal;
29586
+ const receipt = await (0,_codex_bridge_js__rspack_import_2/* .sendToCodexThread */.ZS)(threadId, text, {
29587
+ env,
29588
+ envelope,
29589
+ whenBusy,
29590
+ expectedTurnId,
29591
+ session,
29592
+ expectedCwd,
29593
+ signal: submissionSignal
29594
+ });
29595
+ if (receipt.delivery === 'accepted' && receipt.turnId) {
29596
+ acceptedTurns.add(receipt.turnId);
29597
+ if (acceptedTurns.size > 100) acceptedTurns.delete(acceptedTurns.values().next().value);
29598
+ }
29599
+ return receipt;
29600
+ }
27690
29601
  };
27691
29602
  }
27692
29603
 
27693
29604
  __webpack_require__.d(__webpack_exports__, {
27694
- AQ: () => (withStatusExitCode),
27695
- DG: () => (outcomeFromError),
27696
- Dz: () => (outcomeFromReceipt)
29605
+ j: () => (openCodexConversation)
27697
29606
  });
27698
29607
 
27699
29608
 
@@ -27728,7 +29637,7 @@ async function openBackend(opts) {
27728
29637
  setGroupMembers: (group, members)=>_gateway_js__rspack_import_1/* .setGroupMembers */.Td(session, group, members),
27729
29638
  addGroupMember: (group, bot)=>_gateway_js__rspack_import_1/* .addGroupMember */.zr(session, group, bot),
27730
29639
  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),
29640
+ send: (ref, prompt, extra)=>_gateway_js__rspack_import_1/* .sendPrompt */.LV(session, ref, prompt, extra),
27732
29641
  transcript: (ref, limit)=>_gateway_js__rspack_import_1/* .getTranscriptTail */.bA(session, ref, limit),
27733
29642
  thread: (ref, rootId)=>_gateway_js__rspack_import_1/* .getThread */.fG(session, ref, rootId)
27734
29643
  };
@@ -28459,6 +30368,21 @@ class GatewayError extends Error {
28459
30368
  // ponytail: fixed 30 s deadline and buffered byte cap; upgrade path is per-method budgets plus streaming reads.
28460
30369
  const GATEWAY_TIMEOUT_MS = 30000;
28461
30370
  const GATEWAY_MAX_RESPONSE_BYTES = 2 * 1024 * 1024;
30371
+ function assertGatewayActive(signal) {
30372
+ if (signal?.aborted) {
30373
+ const error = new GatewayError("Gateway submission cancelled before transmission");
30374
+ error.delivery = "rejected";
30375
+ error.reason = "cancelled";
30376
+ throw error;
30377
+ }
30378
+ }
30379
+ function gatewayDeadline(signal) {
30380
+ const timeout = AbortSignal.timeout(GATEWAY_TIMEOUT_MS);
30381
+ return signal ? AbortSignal.any([
30382
+ signal,
30383
+ timeout
30384
+ ]) : timeout;
30385
+ }
28462
30386
  function backendBase() {
28463
30387
  return (process.env.CURSOR_API_BASE_URL || "https://api2.cursor.sh").replace(/\/$/, "");
28464
30388
  }
@@ -28547,18 +30471,26 @@ function pick(obj, ...keys) {
28547
30471
  }
28548
30472
  return undefined;
28549
30473
  }
28550
- async function ensureSandbox(accessToken) {
30474
+ async function ensureSandbox(accessToken, { signal } = {}) {
30475
+ assertGatewayActive(signal);
28551
30476
  const url = (0,_url_policy_js__rspack_import_3/* .assertAllowedCredentialUrl */.Re)(backendBase(), {
28552
30477
  kind: "backend"
28553
30478
  }) + "/aiserver.v1.GrokBotService/EnsureSandBox";
28554
- const res = await fetch(url, {
28555
- method: "POST",
28556
- redirect: "error",
28557
- signal: AbortSignal.timeout(GATEWAY_TIMEOUT_MS),
28558
- headers: (0,_headers_js__rspack_import_4/* .ensureSandboxHeaders */._6)(accessToken),
28559
- body: "{}"
28560
- });
28561
- const body = await readJson(res);
30479
+ let res, body;
30480
+ try {
30481
+ res = await fetch(url, {
30482
+ method: "POST",
30483
+ redirect: "error",
30484
+ signal: gatewayDeadline(signal),
30485
+ headers: (0,_headers_js__rspack_import_4/* .ensureSandboxHeaders */._6)(accessToken),
30486
+ body: "{}"
30487
+ });
30488
+ body = await readJson(res);
30489
+ } catch (error) {
30490
+ assertGatewayActive(signal);
30491
+ throw error;
30492
+ }
30493
+ assertGatewayActive(signal);
28562
30494
  if (!res.ok) {
28563
30495
  const detail = body.message || body.error || body.raw || res.statusText;
28564
30496
  throw new GatewayError("EnsureSandBox failed: " + res.status + " " + (0,_url_policy_js__rspack_import_3/* .redactSecrets */.fp)(detail), {
@@ -28579,7 +30511,8 @@ async function ensureSandbox(accessToken) {
28579
30511
  gatewayHeaders: (0,_headers_js__rspack_import_4/* .mergeGatewayHeaders */.bQ)((0,_headers_js__rspack_import_4/* .headersFromEnsureSandbox */.Ew)(body), (0,_headers_js__rspack_import_4/* .headersFromEnv */.gx)())
28580
30512
  };
28581
30513
  }
28582
- async function connectGateway() {
30514
+ async function connectGateway({ signal } = {}) {
30515
+ assertGatewayActive(signal);
28583
30516
  const override = gatewayOverride();
28584
30517
  if (override) return override;
28585
30518
  const fromApp = sessionFromApp();
@@ -28588,21 +30521,36 @@ async function connectGateway() {
28588
30521
  if (!token) {
28589
30522
  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
30523
  }
28591
- return ensureSandbox(token);
30524
+ return ensureSandbox(token, {
30525
+ signal
30526
+ });
28592
30527
  }
28593
- async function gatewayCall(session, method, body = {}) {
30528
+ async function gatewayCall(session, method, body = {}, { signal } = {}) {
30529
+ assertGatewayActive(signal);
28594
30530
  const base = (0,_url_policy_js__rspack_import_3/* .assertAllowedCredentialUrl */.Re)(session.gatewayUrl, {
28595
30531
  kind: "gateway"
28596
30532
  });
28597
30533
  const url = base + "/api/" + method;
28598
- const res = await fetch(url, {
30534
+ // Cancellation can abort read/auth preflights. Once a prompt request starts,
30535
+ // observe its actual receipt (or timeout) instead of losing certainty on stop.
30536
+ const prompt = method === "sendPrompt";
30537
+ const options = {
28599
30538
  method: "POST",
28600
30539
  redirect: "error",
28601
- signal: AbortSignal.timeout(GATEWAY_TIMEOUT_MS),
30540
+ signal: gatewayDeadline(prompt ? undefined : signal),
28602
30541
  headers: (0,_headers_js__rspack_import_4/* .requestHeaders */.A1)(session),
28603
30542
  body: JSON.stringify(body)
28604
- });
28605
- const data = await readJson(res);
30543
+ };
30544
+ assertGatewayActive(signal); // Final synchronous boundary before transmission.
30545
+ let res, data;
30546
+ try {
30547
+ res = await fetch(url, options);
30548
+ data = await readJson(res);
30549
+ } catch (error) {
30550
+ if (!prompt) assertGatewayActive(signal);
30551
+ throw error;
30552
+ }
30553
+ if (!prompt) assertGatewayActive(signal);
28606
30554
  if (!res.ok) {
28607
30555
  const detail = data.message || data.error || data.raw || res.statusText;
28608
30556
  throw new GatewayError(method + " failed: " + res.status + " " + (0,_url_policy_js__rspack_import_3/* .redactSecrets */.fp)(String(detail).slice(0, 300)), {
@@ -28654,8 +30602,10 @@ function unwrapList(data) {
28654
30602
  function unwrapOne(data) {
28655
30603
  return asRecord(data.agent || data);
28656
30604
  }
28657
- async function listAgents(session) {
28658
- const data = await gatewayCall(session, "listAgents", {});
30605
+ async function listAgents(session, { signal } = {}) {
30606
+ const data = await gatewayCall(session, "listAgents", {}, {
30607
+ signal
30608
+ });
28659
30609
  return unwrapList(data).map(asRecord).filter((r)=>r && r.id);
28660
30610
  }
28661
30611
  function resolveFromList(records, ref) {
@@ -28667,8 +30617,10 @@ function resolveFromList(records, ref) {
28667
30617
  if (matches.length === 0) throw new GatewayError("No bot or group named \"" + ref + "\"");
28668
30618
  throw new GatewayError("Ambiguous name \"" + ref + "\"");
28669
30619
  }
28670
- async function resolveRef(session, ref) {
28671
- return resolveFromList(await listAgents(session), ref);
30620
+ async function resolveRef(session, ref, { signal } = {}) {
30621
+ return resolveFromList(await listAgents(session, {
30622
+ signal
30623
+ }), ref);
28672
30624
  }
28673
30625
  async function createAgent(session, input) {
28674
30626
  const data = await gatewayCall(session, "createAgent", {
@@ -28790,16 +30742,22 @@ async function removeGroupMember(session, groupRef, memberRef) {
28790
30742
  const next = group.memberIds.filter((id)=>id !== member.id);
28791
30743
  return setGroupMembers(session, group.id, next);
28792
30744
  }
28793
- async function sendPrompt(session, ref, prompt) {
28794
- const rec = await resolveRef(session, ref);
30745
+ async function sendPrompt(session, ref, prompt, extra = {}) {
30746
+ assertGatewayActive(extra.signal);
30747
+ const rec = await resolveRef(session, ref, {
30748
+ signal: extra.signal
30749
+ });
28795
30750
  const body = {
28796
30751
  agentId: rec.id,
28797
30752
  prompt,
28798
- clientNonce: (0,node_crypto__rspack_import_0.randomUUID)()
30753
+ clientNonce: extra.clientNonce || (0,node_crypto__rspack_import_0.randomUUID)()
28799
30754
  };
30755
+ if (extra.replyToId) body.replyToId = extra.replyToId;
28800
30756
  let data;
28801
30757
  try {
28802
- data = await gatewayCall(session, "sendPrompt", body);
30758
+ data = await gatewayCall(session, "sendPrompt", body, {
30759
+ signal: extra.signal
30760
+ });
28803
30761
  } catch (err) {
28804
30762
  // Delivery states: the server answered no (rejected) vs the request may have landed (unknown).
28805
30763
  // Never retry an unknown delivery blindly; read the thread first.
@@ -29051,6 +31009,269 @@ __webpack_require__.d(__webpack_exports__, {
29051
31009
  });
29052
31010
 
29053
31011
 
31012
+ },
31013
+ "./src/core/relay/control.js"(__unused_rspack___webpack_module__, __webpack_exports__, __webpack_require__) {
31014
+ /* import */ var node_string_decoder__rspack_import_0 = __webpack_require__("node:string_decoder");
31015
+ /* import */ var node_net__rspack_import_1 = __webpack_require__("node:net");
31016
+ /* import */ var node_crypto__rspack_import_2 = __webpack_require__("node:crypto");
31017
+ /* import */ var _profile_js__rspack_import_3 = __webpack_require__("./src/core/relay/profile.js");
31018
+
31019
+
31020
+
31021
+
31022
+ const RELAY_PROTOCOL = 1;
31023
+ const CONTROL_BYTES = 1024 * 1024;
31024
+ const CONTROL_TIMEOUT = 45000;
31025
+ function relayRequest(options, method, input = {}, { timeoutMs = CONTROL_TIMEOUT, signal, requestId = (0,node_crypto__rspack_import_2.randomUUID)() } = {}) {
31026
+ const { socketPath, profile } = (0,_profile_js__rspack_import_3/* .relayLocation */.hQ)(options);
31027
+ return new Promise((resolve, reject)=>{
31028
+ const decoder = new node_string_decoder__rspack_import_0.StringDecoder("utf8");
31029
+ let buffer = "", bytes = 0, settled = false, connected = false;
31030
+ const socket = (0,node_net__rspack_import_1.connect)(socketPath);
31031
+ const finish = (error, value)=>{
31032
+ if (settled) return;
31033
+ settled = true;
31034
+ clearTimeout(timer);
31035
+ signal?.removeEventListener("abort", abort);
31036
+ socket.destroy();
31037
+ error ? reject(error) : resolve(value);
31038
+ };
31039
+ const uncertain = ()=>Object.assign(Error(`Relay control connection lost; do not resend with a new requestId (${requestId}). Check bridge status.`), {
31040
+ requestId
31041
+ });
31042
+ const abort = ()=>finish(uncertain());
31043
+ const timer = setTimeout(abort, timeoutMs);
31044
+ signal?.addEventListener("abort", abort, {
31045
+ once: true
31046
+ });
31047
+ if (signal?.aborted) return abort();
31048
+ socket.on("error", (error)=>finish(connected ? uncertain() : error));
31049
+ socket.on("close", ()=>finish(uncertain()));
31050
+ socket.on("connect", ()=>{
31051
+ connected = true;
31052
+ const line = JSON.stringify({
31053
+ version: RELAY_PROTOCOL,
31054
+ profile,
31055
+ requestId,
31056
+ method,
31057
+ input
31058
+ }) + "\n";
31059
+ if (Buffer.byteLength(line) > CONTROL_BYTES) return finish(Error("Relay control request exceeds budget"));
31060
+ socket.write(line);
31061
+ });
31062
+ socket.on("data", (chunk)=>{
31063
+ bytes += chunk.length;
31064
+ if (bytes > CONTROL_BYTES) return finish(Error("Relay control response exceeds budget"));
31065
+ buffer += decoder.write(chunk);
31066
+ const end = buffer.indexOf("\n");
31067
+ if (end < 0) return;
31068
+ try {
31069
+ const reply = JSON.parse(buffer.slice(0, end));
31070
+ if (reply.version !== RELAY_PROTOCOL || reply.requestId !== requestId) throw Error("Relay protocol identity mismatch");
31071
+ if (reply.error) throw Error(reply.error);
31072
+ if (reply.profile !== profile) throw Error("Relay profile mismatch");
31073
+ finish(null, reply.result);
31074
+ } catch (error) {
31075
+ finish(error);
31076
+ }
31077
+ });
31078
+ });
31079
+ }
31080
+
31081
+ __webpack_require__.d(__webpack_exports__, {
31082
+ lJ: () => (relayRequest)
31083
+ });
31084
+
31085
+
31086
+ },
31087
+ "./src/core/relay/managed.js"(__unused_rspack___webpack_module__, __webpack_exports__, __webpack_require__) {
31088
+ /* import */ var node_child_process__rspack_import_0 = __webpack_require__("node:child_process");
31089
+ /* import */ var node_fs_promises__rspack_import_1 = __webpack_require__("node:fs/promises");
31090
+ /* import */ var node_path__rspack_import_2 = __webpack_require__("node:path");
31091
+ /* import */ var node_url__rspack_import_3 = __webpack_require__("node:url");
31092
+ /* import */ var node_crypto__rspack_import_4 = __webpack_require__("node:crypto");
31093
+ /* import */ var _profile_js__rspack_import_5 = __webpack_require__("./src/core/relay/profile.js");
31094
+ /* import */ var _control_js__rspack_import_6 = __webpack_require__("./src/core/relay/control.js");
31095
+
31096
+
31097
+
31098
+
31099
+
31100
+
31101
+
31102
+ /** @param {{pluginRoot?: string, moduleUrl?: string}} options */ async function resolveRelayWorker({ pluginRoot, moduleUrl = import.meta.url } = {}) {
31103
+ const roots = [];
31104
+ if (pluginRoot) roots.push(pluginRoot);
31105
+ let path = (0,node_path__rspack_import_2.dirname)((0,node_url__rspack_import_3.fileURLToPath)(moduleUrl));
31106
+ for(let i = 0; i < 5; i++){
31107
+ roots.push(path);
31108
+ path = (0,node_path__rspack_import_2.dirname)(path);
31109
+ }
31110
+ for (const candidate of new Set(roots)){
31111
+ let manifest;
31112
+ try {
31113
+ 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"));
31114
+ } catch (error) {
31115
+ if (error.code === "ENOENT") continue;
31116
+ throw error;
31117
+ }
31118
+ const relative = "scripts/gbot-relay.mjs";
31119
+ const file = manifest.files?.find((f)=>f.path === relative);
31120
+ if (manifest.application?.name !== "gbot" || !file || !manifest.executables?.scripts?.some((s)=>s.path === relative)) continue;
31121
+ 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);
31122
+ 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");
31123
+ 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");
31124
+ return worker;
31125
+ }
31126
+ throw Error("Packaged relay worker not found; rebuild or reinstall the plugin");
31127
+ }
31128
+ const unavailable = (error)=>[
31129
+ "ENOENT",
31130
+ "ECONNREFUSED"
31131
+ ].includes(error.code);
31132
+ async function ensureRelayWorker(options = {}) {
31133
+ const location = (0,_profile_js__rspack_import_5/* .relayLocation */.hQ)(options);
31134
+ try {
31135
+ return await (0,_control_js__rspack_import_6/* .relayRequest */.lJ)(location, "hello", {}, {
31136
+ timeoutMs: 1500
31137
+ });
31138
+ } catch (error) {
31139
+ if (!unavailable(error)) throw error;
31140
+ }
31141
+ const workerPath = await resolveRelayWorker(options);
31142
+ const child = (0,node_child_process__rspack_import_0.spawn)(process.execPath, [
31143
+ workerPath
31144
+ ], {
31145
+ detached: true,
31146
+ stdio: "ignore",
31147
+ env: {
31148
+ ...location.env,
31149
+ GROK_BOT_RELAY_DIR: location.stateDir
31150
+ },
31151
+ cwd: (0,node_path__rspack_import_2.dirname)(workerPath)
31152
+ });
31153
+ let spawnError;
31154
+ child.on("error", (error)=>{
31155
+ spawnError = error;
31156
+ });
31157
+ child.unref();
31158
+ const end = Date.now() + 10000;
31159
+ while(Date.now() < end){
31160
+ if (spawnError) throw spawnError;
31161
+ if (options.signal?.aborted) throw Error("Relay startup cancelled before submission");
31162
+ try {
31163
+ return await (0,_control_js__rspack_import_6/* .relayRequest */.lJ)(location, "hello", {}, {
31164
+ timeoutMs: 1000,
31165
+ signal: options.signal
31166
+ });
31167
+ } catch (error) {
31168
+ if (!unavailable(error)) throw error;
31169
+ }
31170
+ await new Promise((resolve)=>setTimeout(resolve, 75));
31171
+ }
31172
+ throw Error("Relay worker startup failed or timed out; no untracked send was attempted. Inspect bridge status and the relay owner lock.");
31173
+ }
31174
+ async function managedOperation(method, input, options = {}) {
31175
+ const location = (0,_profile_js__rspack_import_5/* .relayLocation */.hQ)(options);
31176
+ const requestId = input.requestId ?? (0,node_crypto__rspack_import_4.randomUUID)();
31177
+ if (![
31178
+ "status",
31179
+ "stop",
31180
+ "respond"
31181
+ ].includes(method)) await ensureRelayWorker(options);
31182
+ try {
31183
+ return await (0,_control_js__rspack_import_6/* .relayRequest */.lJ)(location, method, input, {
31184
+ signal: options.signal,
31185
+ requestId
31186
+ });
31187
+ } catch (error) {
31188
+ if (method === "status" && unavailable(error)) return {
31189
+ worker: {
31190
+ state: "stopped",
31191
+ profile: location.profile,
31192
+ supervised: false
31193
+ },
31194
+ reason: "Worker is not running. Start a route or tracked send to resume saved routes."
31195
+ };
31196
+ // Never retry a disconnected mutation. Its durable request ID is the recovery handle.
31197
+ throw error;
31198
+ }
31199
+ }
31200
+
31201
+ __webpack_require__.d(__webpack_exports__, {
31202
+ Bb: () => (managedOperation),
31203
+ _v: () => (resolveRelayWorker)
31204
+ });
31205
+
31206
+
31207
+ },
31208
+ "./src/core/relay/profile.js"(__unused_rspack___webpack_module__, __webpack_exports__, __webpack_require__) {
31209
+ /* import */ var node_crypto__rspack_import_0 = __webpack_require__("node:crypto");
31210
+ /* import */ var node_os__rspack_import_1 = __webpack_require__("node:os");
31211
+ /* import */ var node_path__rspack_import_2 = __webpack_require__("node:path");
31212
+ /* import */ var _codex_bridge_js__rspack_import_3 = __webpack_require__("./src/core/codex-bridge.js");
31213
+ /* import */ var _app_session_js__rspack_import_4 = __webpack_require__("./src/core/app-session.js");
31214
+
31215
+
31216
+
31217
+
31218
+
31219
+ const digest = (value)=>(0,node_crypto__rspack_import_0.createHash)("sha256").update(value).digest("hex");
31220
+ // Only explicit overrides are hashed. App-session token refresh retains its source identity.
31221
+ function relayProfile(env = process.env) {
31222
+ const keys = [
31223
+ "GROK_BOT_GATEWAY_URL",
31224
+ "SAND_HOST_GATEWAY_URL",
31225
+ "SAND_HOST_PORT",
31226
+ "GROK_BOT_GATEWAY_TOKEN",
31227
+ "SAND_HOST_GATEWAY_TOKEN",
31228
+ "SAND_GATEWAY_TOKEN",
31229
+ "CURSOR_ACCESS_TOKEN",
31230
+ "GROK_BOT_ACCESS_TOKEN",
31231
+ "SAND_ACCESS_TOKEN",
31232
+ "GROK_BOT_GATEWAY_HEADERS",
31233
+ "SAND_BACKEND_URL",
31234
+ "CURSOR_API_BASE_URL",
31235
+ "SAND_BOX_NAMESPACE",
31236
+ "SAND_CLIENT_VERSION",
31237
+ "GROK_BOT_CODEX_THREADS",
31238
+ "GROK_BOT_MAX_HOPS",
31239
+ "GROK_BOT_CODEX_EXPERIMENTAL",
31240
+ "GROK_BOT_ALLOW_LOCAL_GATEWAY",
31241
+ "GROK_BOT_ALLOW_ANY_GATEWAY",
31242
+ "GROK_BOT_TEST",
31243
+ "NODE_ENV"
31244
+ ];
31245
+ return digest(JSON.stringify([
31246
+ (0,node_path__rspack_import_2.resolve)((0,_codex_bridge_js__rspack_import_3/* .codexSocketPath */.ql)(env)),
31247
+ (0,_app_session_js__rspack_import_4/* .grokBotGatewayDescriptorPath */.dQ)((0,node_os__rspack_import_1.homedir)(), process.platform, env),
31248
+ ...keys.map((key)=>[
31249
+ key,
31250
+ env[key] ?? ""
31251
+ ])
31252
+ ]));
31253
+ }
31254
+ function relayLocation({ env = process.env, stateDir, profile = relayProfile(env) } = {}) {
31255
+ if (process.platform === "win32") throw Error("Codex relay requires Unix-domain sockets; Windows is unsupported.");
31256
+ 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)));
31257
+ // macOS Unix sockets cannot use arbitrarily long installation/state paths.
31258
+ 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));
31259
+ return {
31260
+ stateDir: dir,
31261
+ profile,
31262
+ env,
31263
+ socketDir,
31264
+ socketPath: (0,node_path__rspack_import_2.join)(socketDir, "control.sock")
31265
+ };
31266
+ }
31267
+
31268
+ __webpack_require__.d(__webpack_exports__, {
31269
+ hQ: () => (relayLocation)
31270
+ }, {
31271
+ br: digest
31272
+ });
31273
+
31274
+
29054
31275
  },
29055
31276
  "./src/core/store.js"(__unused_rspack___webpack_module__, __webpack_exports__, __webpack_require__) {
29056
31277
  /* import */ var node_crypto__rspack_import_0 = __webpack_require__("node:crypto");
@@ -29615,6 +31836,10 @@ __webpack_require__.d(__webpack_exports__, {
29615
31836
  });
29616
31837
 
29617
31838
 
31839
+ },
31840
+ "./package.json"(module) {
31841
+ module.exports = {"rE":"0.6.0"}
31842
+
29618
31843
  },
29619
31844
 
29620
31845
  });
@@ -29679,33 +31904,40 @@ __webpack_require__.r = (exports) => {
29679
31904
  var __webpack_exports__ = {};
29680
31905
  /* import */ var node_worker_threads__rspack_import_0 = __webpack_require__("node:worker_threads");
29681
31906
  /* import */ var react__rspack_import_1 = __webpack_require__("./node_modules/react/react.react-server.js");
29682
- /* import */ var _agent_bundle_runtime_flight_server__rspack_import_28 = __webpack_require__("./node_modules/@agent-bundle/runtime/dist/flight/server.js");
29683
- /* import */ var _agent_bundle_runtime__rspack_import_26 = __webpack_require__("./node_modules/@agent-bundle/runtime/dist/49.js");
29684
- /* import */ var _agent_bundle_runtime__rspack_import_27 = __webpack_require__("./node_modules/@agent-bundle/runtime/dist/736.js");
31907
+ /* import */ var _agent_bundle_runtime_flight_server__rspack_import_35 = __webpack_require__("./node_modules/@agent-bundle/runtime/dist/flight/server.js");
31908
+ /* import */ var _agent_bundle_runtime__rspack_import_33 = __webpack_require__("./node_modules/@agent-bundle/runtime/dist/49.js");
31909
+ /* import */ var _agent_bundle_runtime__rspack_import_34 = __webpack_require__("./node_modules/@agent-bundle/runtime/dist/736.js");
29685
31910
  /* import */ var node_url__rspack_import_2 = __webpack_require__("node:url");
29686
31911
  /* import */ var _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_bots_create_tsx__rspack_import_3 = __webpack_require__("./src/cli/bots/create.tsx");
29687
31912
  /* import */ var _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_bots_delete_tsx__rspack_import_4 = __webpack_require__("./src/cli/bots/delete.tsx");
29688
31913
  /* import */ var _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_bots_get_tsx__rspack_import_5 = __webpack_require__("./src/cli/bots/get.tsx");
29689
31914
  /* import */ var _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_bots_list_tsx__rspack_import_6 = __webpack_require__("./src/cli/bots/list.tsx");
29690
31915
  /* import */ var _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_bots_update_tsx__rspack_import_7 = __webpack_require__("./src/cli/bots/update.tsx");
29691
- /* import */ var _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_codex_desktop_shim_tsx__rspack_import_8 = __webpack_require__("./src/cli/codex/desktop-shim.tsx");
29692
- /* import */ var _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_codex_list_threads_tsx__rspack_import_9 = __webpack_require__("./src/cli/codex/list-threads.tsx");
29693
- /* import */ var _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_codex_queue_tsx__rspack_import_10 = __webpack_require__("./src/cli/codex/queue.tsx");
29694
- /* import */ var _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_codex_send_tsx__rspack_import_11 = __webpack_require__("./src/cli/codex/send.tsx");
29695
- /* import */ var _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_codex_status_tsx__rspack_import_12 = __webpack_require__("./src/cli/codex/status.tsx");
29696
- /* import */ var _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_doctor_tsx__rspack_import_13 = __webpack_require__("./src/cli/doctor.tsx");
29697
- /* import */ var _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_groups_add_tsx__rspack_import_14 = __webpack_require__("./src/cli/groups/add.tsx");
29698
- /* import */ var _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_groups_create_tsx__rspack_import_15 = __webpack_require__("./src/cli/groups/create.tsx");
29699
- /* import */ var _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_groups_delete_tsx__rspack_import_16 = __webpack_require__("./src/cli/groups/delete.tsx");
29700
- /* import */ var _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_groups_get_tsx__rspack_import_17 = __webpack_require__("./src/cli/groups/get.tsx");
29701
- /* import */ var _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_groups_list_tsx__rspack_import_18 = __webpack_require__("./src/cli/groups/list.tsx");
29702
- /* import */ var _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_groups_members_tsx__rspack_import_19 = __webpack_require__("./src/cli/groups/members.tsx");
29703
- /* import */ var _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_groups_remove_tsx__rspack_import_20 = __webpack_require__("./src/cli/groups/remove.tsx");
29704
- /* import */ var _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_groups_set_tsx__rspack_import_21 = __webpack_require__("./src/cli/groups/set.tsx");
29705
- /* import */ var _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_groups_update_tsx__rspack_import_22 = __webpack_require__("./src/cli/groups/update.tsx");
29706
- /* import */ var _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_history_tsx__rspack_import_23 = __webpack_require__("./src/cli/history.tsx");
29707
- /* import */ var _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_send_tsx__rspack_import_24 = __webpack_require__("./src/cli/send.tsx");
29708
- /* import */ var _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_thread_tsx__rspack_import_25 = __webpack_require__("./src/cli/thread.tsx");
31916
+ /* import */ var _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_codex_bridge_respond_tsx__rspack_import_8 = __webpack_require__("./src/cli/codex/bridge/respond.tsx");
31917
+ /* import */ var _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_codex_bridge_run_tsx__rspack_import_9 = __webpack_require__("./src/cli/codex/bridge/run.tsx");
31918
+ /* import */ var _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_codex_bridge_start_tsx__rspack_import_10 = __webpack_require__("./src/cli/codex/bridge/start.tsx");
31919
+ /* import */ var _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_codex_bridge_status_tsx__rspack_import_11 = __webpack_require__("./src/cli/codex/bridge/status.tsx");
31920
+ /* import */ var _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_codex_bridge_stop_tsx__rspack_import_12 = __webpack_require__("./src/cli/codex/bridge/stop.tsx");
31921
+ /* import */ var _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_codex_desktop_shim_tsx__rspack_import_13 = __webpack_require__("./src/cli/codex/desktop-shim.tsx");
31922
+ /* import */ var _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_codex_list_threads_tsx__rspack_import_14 = __webpack_require__("./src/cli/codex/list-threads.tsx");
31923
+ /* import */ var _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_codex_queue_tsx__rspack_import_15 = __webpack_require__("./src/cli/codex/queue.tsx");
31924
+ /* import */ var _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_codex_send_tsx__rspack_import_16 = __webpack_require__("./src/cli/codex/send.tsx");
31925
+ /* import */ var _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_codex_status_tsx__rspack_import_17 = __webpack_require__("./src/cli/codex/status.tsx");
31926
+ /* import */ var _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_codex_wait_tsx__rspack_import_18 = __webpack_require__("./src/cli/codex/wait.tsx");
31927
+ /* import */ var _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_codex_watch_tsx__rspack_import_19 = __webpack_require__("./src/cli/codex/watch.tsx");
31928
+ /* import */ var _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_doctor_tsx__rspack_import_20 = __webpack_require__("./src/cli/doctor.tsx");
31929
+ /* import */ var _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_groups_add_tsx__rspack_import_21 = __webpack_require__("./src/cli/groups/add.tsx");
31930
+ /* import */ var _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_groups_create_tsx__rspack_import_22 = __webpack_require__("./src/cli/groups/create.tsx");
31931
+ /* import */ var _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_groups_delete_tsx__rspack_import_23 = __webpack_require__("./src/cli/groups/delete.tsx");
31932
+ /* import */ var _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_groups_get_tsx__rspack_import_24 = __webpack_require__("./src/cli/groups/get.tsx");
31933
+ /* import */ var _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_groups_list_tsx__rspack_import_25 = __webpack_require__("./src/cli/groups/list.tsx");
31934
+ /* import */ var _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_groups_members_tsx__rspack_import_26 = __webpack_require__("./src/cli/groups/members.tsx");
31935
+ /* import */ var _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_groups_remove_tsx__rspack_import_27 = __webpack_require__("./src/cli/groups/remove.tsx");
31936
+ /* import */ var _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_groups_set_tsx__rspack_import_28 = __webpack_require__("./src/cli/groups/set.tsx");
31937
+ /* import */ var _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_groups_update_tsx__rspack_import_29 = __webpack_require__("./src/cli/groups/update.tsx");
31938
+ /* import */ var _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_history_tsx__rspack_import_30 = __webpack_require__("./src/cli/history.tsx");
31939
+ /* import */ var _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_send_tsx__rspack_import_31 = __webpack_require__("./src/cli/send.tsx");
31940
+ /* import */ var _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_thread_tsx__rspack_import_32 = __webpack_require__("./src/cli/thread.tsx");
29709
31941
 
29710
31942
 
29711
31943
 
@@ -29722,42 +31954,56 @@ const route3 = Object.assign({}, Reflect.get(_home_runner_work_grok_bot_cli_grok
29722
31954
 
29723
31955
  const route4 = Object.assign({}, Reflect.get(_home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_bots_update_tsx__rspack_import_7, 'default'), _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_bots_update_tsx__rspack_import_7);
29724
31956
 
29725
- const route5 = Object.assign({}, Reflect.get(_home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_codex_desktop_shim_tsx__rspack_import_8, 'default'), _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_codex_desktop_shim_tsx__rspack_import_8);
31957
+ const route5 = Object.assign({}, Reflect.get(_home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_codex_bridge_respond_tsx__rspack_import_8, 'default'), _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_codex_bridge_respond_tsx__rspack_import_8);
31958
+
31959
+ const route6 = Object.assign({}, Reflect.get(_home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_codex_bridge_run_tsx__rspack_import_9, 'default'), _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_codex_bridge_run_tsx__rspack_import_9);
29726
31960
 
29727
- const route6 = Object.assign({}, Reflect.get(_home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_codex_list_threads_tsx__rspack_import_9, 'default'), _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_codex_list_threads_tsx__rspack_import_9);
31961
+ const route7 = Object.assign({}, Reflect.get(_home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_codex_bridge_start_tsx__rspack_import_10, 'default'), _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_codex_bridge_start_tsx__rspack_import_10);
29728
31962
 
29729
- const route7 = Object.assign({}, Reflect.get(_home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_codex_queue_tsx__rspack_import_10, 'default'), _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_codex_queue_tsx__rspack_import_10);
31963
+ const route8 = Object.assign({}, Reflect.get(_home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_codex_bridge_status_tsx__rspack_import_11, 'default'), _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_codex_bridge_status_tsx__rspack_import_11);
29730
31964
 
29731
- const route8 = Object.assign({}, Reflect.get(_home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_codex_send_tsx__rspack_import_11, 'default'), _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_codex_send_tsx__rspack_import_11);
31965
+ const route9 = Object.assign({}, Reflect.get(_home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_codex_bridge_stop_tsx__rspack_import_12, 'default'), _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_codex_bridge_stop_tsx__rspack_import_12);
29732
31966
 
29733
- const route9 = Object.assign({}, Reflect.get(_home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_codex_status_tsx__rspack_import_12, 'default'), _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_codex_status_tsx__rspack_import_12);
31967
+ const route10 = Object.assign({}, Reflect.get(_home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_codex_desktop_shim_tsx__rspack_import_13, 'default'), _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_codex_desktop_shim_tsx__rspack_import_13);
29734
31968
 
29735
- const route10 = Object.assign({}, Reflect.get(_home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_doctor_tsx__rspack_import_13, 'default'), _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_doctor_tsx__rspack_import_13);
31969
+ const route11 = Object.assign({}, Reflect.get(_home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_codex_list_threads_tsx__rspack_import_14, 'default'), _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_codex_list_threads_tsx__rspack_import_14);
29736
31970
 
29737
- const route11 = Object.assign({}, Reflect.get(_home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_groups_add_tsx__rspack_import_14, 'default'), _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_groups_add_tsx__rspack_import_14);
31971
+ const route12 = Object.assign({}, Reflect.get(_home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_codex_queue_tsx__rspack_import_15, 'default'), _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_codex_queue_tsx__rspack_import_15);
29738
31972
 
29739
- const route12 = Object.assign({}, Reflect.get(_home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_groups_create_tsx__rspack_import_15, 'default'), _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_groups_create_tsx__rspack_import_15);
31973
+ const route13 = Object.assign({}, Reflect.get(_home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_codex_send_tsx__rspack_import_16, 'default'), _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_codex_send_tsx__rspack_import_16);
29740
31974
 
29741
- const route13 = Object.assign({}, Reflect.get(_home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_groups_delete_tsx__rspack_import_16, 'default'), _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_groups_delete_tsx__rspack_import_16);
31975
+ const route14 = Object.assign({}, Reflect.get(_home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_codex_status_tsx__rspack_import_17, 'default'), _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_codex_status_tsx__rspack_import_17);
29742
31976
 
29743
- const route14 = Object.assign({}, Reflect.get(_home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_groups_get_tsx__rspack_import_17, 'default'), _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_groups_get_tsx__rspack_import_17);
31977
+ const route15 = Object.assign({}, Reflect.get(_home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_codex_wait_tsx__rspack_import_18, 'default'), _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_codex_wait_tsx__rspack_import_18);
29744
31978
 
29745
- const route15 = Object.assign({}, Reflect.get(_home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_groups_list_tsx__rspack_import_18, 'default'), _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_groups_list_tsx__rspack_import_18);
31979
+ const route16 = Object.assign({}, Reflect.get(_home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_codex_watch_tsx__rspack_import_19, 'default'), _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_codex_watch_tsx__rspack_import_19);
29746
31980
 
29747
- const route16 = Object.assign({}, Reflect.get(_home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_groups_members_tsx__rspack_import_19, 'default'), _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_groups_members_tsx__rspack_import_19);
31981
+ const route17 = Object.assign({}, Reflect.get(_home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_doctor_tsx__rspack_import_20, 'default'), _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_doctor_tsx__rspack_import_20);
29748
31982
 
29749
- const route17 = Object.assign({}, Reflect.get(_home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_groups_remove_tsx__rspack_import_20, 'default'), _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_groups_remove_tsx__rspack_import_20);
31983
+ const route18 = Object.assign({}, Reflect.get(_home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_groups_add_tsx__rspack_import_21, 'default'), _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_groups_add_tsx__rspack_import_21);
29750
31984
 
29751
- const route18 = Object.assign({}, Reflect.get(_home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_groups_set_tsx__rspack_import_21, 'default'), _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_groups_set_tsx__rspack_import_21);
31985
+ const route19 = Object.assign({}, Reflect.get(_home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_groups_create_tsx__rspack_import_22, 'default'), _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_groups_create_tsx__rspack_import_22);
29752
31986
 
29753
- const route19 = Object.assign({}, Reflect.get(_home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_groups_update_tsx__rspack_import_22, 'default'), _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_groups_update_tsx__rspack_import_22);
31987
+ const route20 = Object.assign({}, Reflect.get(_home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_groups_delete_tsx__rspack_import_23, 'default'), _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_groups_delete_tsx__rspack_import_23);
29754
31988
 
29755
- const route20 = Object.assign({}, Reflect.get(_home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_history_tsx__rspack_import_23, 'default'), _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_history_tsx__rspack_import_23);
31989
+ const route21 = Object.assign({}, Reflect.get(_home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_groups_get_tsx__rspack_import_24, 'default'), _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_groups_get_tsx__rspack_import_24);
29756
31990
 
29757
- const route21 = Object.assign({}, Reflect.get(_home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_send_tsx__rspack_import_24, 'default'), _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_send_tsx__rspack_import_24);
31991
+ const route22 = Object.assign({}, Reflect.get(_home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_groups_list_tsx__rspack_import_25, 'default'), _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_groups_list_tsx__rspack_import_25);
29758
31992
 
29759
- const route22 = Object.assign({}, Reflect.get(_home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_thread_tsx__rspack_import_25, 'default'), _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_thread_tsx__rspack_import_25);
29760
- const pluginRoot = (0,_agent_bundle_runtime__rspack_import_26/* .resolvePluginRoot */.E7)({
31993
+ const route23 = Object.assign({}, Reflect.get(_home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_groups_members_tsx__rspack_import_26, 'default'), _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_groups_members_tsx__rspack_import_26);
31994
+
31995
+ const route24 = Object.assign({}, Reflect.get(_home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_groups_remove_tsx__rspack_import_27, 'default'), _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_groups_remove_tsx__rspack_import_27);
31996
+
31997
+ const route25 = Object.assign({}, Reflect.get(_home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_groups_set_tsx__rspack_import_28, 'default'), _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_groups_set_tsx__rspack_import_28);
31998
+
31999
+ const route26 = Object.assign({}, Reflect.get(_home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_groups_update_tsx__rspack_import_29, 'default'), _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_groups_update_tsx__rspack_import_29);
32000
+
32001
+ const route27 = Object.assign({}, Reflect.get(_home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_history_tsx__rspack_import_30, 'default'), _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_history_tsx__rspack_import_30);
32002
+
32003
+ const route28 = Object.assign({}, Reflect.get(_home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_send_tsx__rspack_import_31, 'default'), _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_send_tsx__rspack_import_31);
32004
+
32005
+ const route29 = Object.assign({}, Reflect.get(_home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_thread_tsx__rspack_import_32, 'default'), _home_runner_work_grok_bot_cli_grok_bot_cli_src_cli_thread_tsx__rspack_import_32);
32006
+ const pluginRoot = (0,_agent_bundle_runtime__rspack_import_33/* .resolvePluginRoot */.E7)({
29761
32007
  fallback: (0,node_url__rspack_import_2.fileURLToPath)(new URL('..', import.meta.url)),
29762
32008
  stateAnchor: 'user-data'
29763
32009
  });
@@ -29805,113 +32051,155 @@ const routes = Object.freeze({
29805
32051
  name: "bots update",
29806
32052
  module: route4
29807
32053
  }),
32054
+ "cli:codex/bridge/respond": Object.freeze({
32055
+ id: "cli:codex/bridge/respond",
32056
+ kind: "cli",
32057
+ name: "codex bridge respond",
32058
+ module: route5
32059
+ }),
32060
+ "cli:codex/bridge/run": Object.freeze({
32061
+ id: "cli:codex/bridge/run",
32062
+ kind: "cli",
32063
+ name: "codex bridge run",
32064
+ module: route6
32065
+ }),
32066
+ "cli:codex/bridge/start": Object.freeze({
32067
+ id: "cli:codex/bridge/start",
32068
+ kind: "cli",
32069
+ name: "codex bridge start",
32070
+ module: route7
32071
+ }),
32072
+ "cli:codex/bridge/status": Object.freeze({
32073
+ id: "cli:codex/bridge/status",
32074
+ kind: "cli",
32075
+ name: "codex bridge status",
32076
+ module: route8
32077
+ }),
32078
+ "cli:codex/bridge/stop": Object.freeze({
32079
+ id: "cli:codex/bridge/stop",
32080
+ kind: "cli",
32081
+ name: "codex bridge stop",
32082
+ module: route9
32083
+ }),
29808
32084
  "cli:codex/desktop-shim": Object.freeze({
29809
32085
  id: "cli:codex/desktop-shim",
29810
32086
  kind: "cli",
29811
32087
  name: "codex desktop-shim",
29812
- module: route5
32088
+ module: route10
29813
32089
  }),
29814
32090
  "cli:codex/list-threads": Object.freeze({
29815
32091
  id: "cli:codex/list-threads",
29816
32092
  kind: "cli",
29817
32093
  name: "codex list-threads",
29818
- module: route6
32094
+ module: route11
29819
32095
  }),
29820
32096
  "cli:codex/queue": Object.freeze({
29821
32097
  id: "cli:codex/queue",
29822
32098
  kind: "cli",
29823
32099
  name: "codex queue",
29824
- module: route7
32100
+ module: route12
29825
32101
  }),
29826
32102
  "cli:codex/send": Object.freeze({
29827
32103
  id: "cli:codex/send",
29828
32104
  kind: "cli",
29829
32105
  name: "codex send",
29830
- module: route8
32106
+ module: route13
29831
32107
  }),
29832
32108
  "cli:codex/status": Object.freeze({
29833
32109
  id: "cli:codex/status",
29834
32110
  kind: "cli",
29835
32111
  name: "codex status",
29836
- module: route9
32112
+ module: route14
32113
+ }),
32114
+ "cli:codex/wait": Object.freeze({
32115
+ id: "cli:codex/wait",
32116
+ kind: "cli",
32117
+ name: "codex wait",
32118
+ module: route15
32119
+ }),
32120
+ "cli:codex/watch": Object.freeze({
32121
+ id: "cli:codex/watch",
32122
+ kind: "cli",
32123
+ name: "codex watch",
32124
+ module: route16
29837
32125
  }),
29838
32126
  "cli:doctor": Object.freeze({
29839
32127
  id: "cli:doctor",
29840
32128
  kind: "cli",
29841
32129
  name: "doctor",
29842
- module: route10
32130
+ module: route17
29843
32131
  }),
29844
32132
  "cli:groups/add": Object.freeze({
29845
32133
  id: "cli:groups/add",
29846
32134
  kind: "cli",
29847
32135
  name: "groups add",
29848
- module: route11
32136
+ module: route18
29849
32137
  }),
29850
32138
  "cli:groups/create": Object.freeze({
29851
32139
  id: "cli:groups/create",
29852
32140
  kind: "cli",
29853
32141
  name: "groups create",
29854
- module: route12
32142
+ module: route19
29855
32143
  }),
29856
32144
  "cli:groups/delete": Object.freeze({
29857
32145
  id: "cli:groups/delete",
29858
32146
  kind: "cli",
29859
32147
  name: "groups delete",
29860
- module: route13
32148
+ module: route20
29861
32149
  }),
29862
32150
  "cli:groups/get": Object.freeze({
29863
32151
  id: "cli:groups/get",
29864
32152
  kind: "cli",
29865
32153
  name: "groups get",
29866
- module: route14
32154
+ module: route21
29867
32155
  }),
29868
32156
  "cli:groups/list": Object.freeze({
29869
32157
  id: "cli:groups/list",
29870
32158
  kind: "cli",
29871
32159
  name: "groups list",
29872
- module: route15
32160
+ module: route22
29873
32161
  }),
29874
32162
  "cli:groups/members": Object.freeze({
29875
32163
  id: "cli:groups/members",
29876
32164
  kind: "cli",
29877
32165
  name: "groups members",
29878
- module: route16
32166
+ module: route23
29879
32167
  }),
29880
32168
  "cli:groups/remove": Object.freeze({
29881
32169
  id: "cli:groups/remove",
29882
32170
  kind: "cli",
29883
32171
  name: "groups remove",
29884
- module: route17
32172
+ module: route24
29885
32173
  }),
29886
32174
  "cli:groups/set": Object.freeze({
29887
32175
  id: "cli:groups/set",
29888
32176
  kind: "cli",
29889
32177
  name: "groups set",
29890
- module: route18
32178
+ module: route25
29891
32179
  }),
29892
32180
  "cli:groups/update": Object.freeze({
29893
32181
  id: "cli:groups/update",
29894
32182
  kind: "cli",
29895
32183
  name: "groups update",
29896
- module: route19
32184
+ module: route26
29897
32185
  }),
29898
32186
  "cli:history": Object.freeze({
29899
32187
  id: "cli:history",
29900
32188
  kind: "cli",
29901
32189
  name: "history",
29902
- module: route20
32190
+ module: route27
29903
32191
  }),
29904
32192
  "cli:send": Object.freeze({
29905
32193
  id: "cli:send",
29906
32194
  kind: "cli",
29907
32195
  name: "send",
29908
- module: route21
32196
+ module: route28
29909
32197
  }),
29910
32198
  "cli:thread": Object.freeze({
29911
32199
  id: "cli:thread",
29912
32200
  kind: "cli",
29913
32201
  name: "thread",
29914
- module: route22
32202
+ module: route29
29915
32203
  })
29916
32204
  });
29917
32205
  const requests = new Map();
@@ -29946,18 +32234,18 @@ const render = async (message)=>{
29946
32234
  };
29947
32235
  try {
29948
32236
  const cwd = process.cwd();
29949
- await (0,_agent_bundle_runtime__rspack_import_27/* .runAgentRequest */.iC)({
32237
+ await (0,_agent_bundle_runtime__rspack_import_34/* .runAgentRequest */.iC)({
29950
32238
  capabilities: {
29951
- command: (0,_agent_bundle_runtime__rspack_import_27/* .unavailable */.hU)(),
29952
- filesystem: (0,_agent_bundle_runtime__rspack_import_27/* .unavailable */.hU)(),
29953
- network: (0,_agent_bundle_runtime__rspack_import_27/* .unavailable */.hU)(),
29954
- projectRoot: (0,_agent_bundle_runtime__rspack_import_27/* .available */.qC)({
32239
+ command: (0,_agent_bundle_runtime__rspack_import_34/* .unavailable */.hU)(),
32240
+ filesystem: (0,_agent_bundle_runtime__rspack_import_34/* .unavailable */.hU)(),
32241
+ network: (0,_agent_bundle_runtime__rspack_import_34/* .unavailable */.hU)(),
32242
+ projectRoot: (0,_agent_bundle_runtime__rspack_import_34/* .available */.qC)({
29955
32243
  root: cwd
29956
32244
  }, 'derived')
29957
32245
  },
29958
- host: (0,_agent_bundle_runtime__rspack_import_27/* .unavailable */.hU)('unsupported-surface'),
32246
+ host: (0,_agent_bundle_runtime__rspack_import_34/* .unavailable */.hU)('unsupported-surface'),
29959
32247
  invocation: message.request,
29960
- lineage: (0,_agent_bundle_runtime__rspack_import_27/* .unavailable */.hU)('unsupported-surface'),
32248
+ lineage: (0,_agent_bundle_runtime__rspack_import_34/* .unavailable */.hU)('unsupported-surface'),
29961
32249
  plugin: pluginRoot.identity,
29962
32250
  progress: {
29963
32251
  report: async (update)=>{
@@ -29970,8 +32258,8 @@ const render = async (message)=>{
29970
32258
  },
29971
32259
  process: processHit,
29972
32260
  signal: controller.signal,
29973
- terminal: message.terminal === undefined ? (0,_agent_bundle_runtime__rspack_import_27/* .unavailable */.hU)('not-provided') : (0,_agent_bundle_runtime__rspack_import_27/* .available */.qC)(message.terminal, 'native'),
29974
- workspace: (0,_agent_bundle_runtime__rspack_import_27/* .available */.qC)({
32261
+ terminal: message.terminal === undefined ? (0,_agent_bundle_runtime__rspack_import_34/* .unavailable */.hU)('not-provided') : (0,_agent_bundle_runtime__rspack_import_34/* .available */.qC)(message.terminal, 'native'),
32262
+ workspace: (0,_agent_bundle_runtime__rspack_import_34/* .available */.qC)({
29975
32263
  root: cwd
29976
32264
  }, 'derived')
29977
32265
  }, async ()=>{
@@ -29980,7 +32268,7 @@ const render = async (message)=>{
29980
32268
  type: 'observed-render-start'
29981
32269
  });
29982
32270
  const renderStartedAt = performance.now();
29983
- const flight = (0,_agent_bundle_runtime_flight_server__rspack_import_28/* .renderAgentFlight */.y)(composeLayouts(observedRoute, {
32271
+ const flight = (0,_agent_bundle_runtime_flight_server__rspack_import_35/* .renderAgentFlight */.y)(composeLayouts(observedRoute, {
29984
32272
  ...message.props,
29985
32273
  signal: controller.signal
29986
32274
  }, controller.signal), {