grok-bot-cli 0.4.5 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +18 -0
- package/README.md +91 -14
- package/dist/.claude-plugin/marketplace.json +1 -1
- package/dist/.claude-plugin/plugin.json +1 -1
- package/dist/.codex-plugin/plugin.json +1 -1
- package/dist/.cursor-plugin/marketplace.json +1 -1
- package/dist/.cursor-plugin/plugin.json +1 -1
- package/dist/INSTALL.md +2 -2
- package/dist/README.md +91 -14
- package/dist/agent-bundle.compile-evidence.json +1 -1
- package/dist/agent-bundle.manifest.json +1 -1
- package/dist/bin/gbot-flight.mjs +2641 -370
- package/dist/bin/gbot.mjs +3019 -354
- package/dist/install.mjs +1 -1
- package/dist/mcp/mcp-grok-bot-b8c2461e-flight.mjs +6811 -2399
- package/dist/mcp/mcp-grok-bot-b8c2461e.mjs +4300 -97
- package/dist/package.json +1 -1
- package/dist/plugin.json +1 -1
- package/dist/scripts/gbot-relay.mjs +61013 -0
- package/dist/skills/talk-to-grok-bot/SKILL.md +70 -6
- package/package.json +1 -1
package/dist/bin/gbot-flight.mjs
CHANGED
|
@@ -2,11 +2,12 @@ import * as __rspack_external_node_async_hooks_4d8b1b4a from "node:async_hooks";
|
|
|
2
2
|
import * as __rspack_external_node_child_process_cd435d64 from "node:child_process";
|
|
3
3
|
import * as __rspack_external_node_crypto_2e7c4b46 from "node:crypto";
|
|
4
4
|
import * as __rspack_external_node_fs_1b05aee1 from "node:fs";
|
|
5
|
-
import * as
|
|
5
|
+
import * as __rspack_external_node_fs_promises_3b710708 from "node:fs/promises";
|
|
6
6
|
import * as __rspack_external_node_net_5ed819e1 from "node:net";
|
|
7
7
|
import * as __rspack_external_node_os_4f3c9d58 from "node:os";
|
|
8
8
|
import * as __rspack_external_node_path_806ed179 from "node:path";
|
|
9
9
|
import * as __rspack_external_node_readline_d8f53bef from "node:readline";
|
|
10
|
+
import * as __rspack_external_node_string_decoder_69b9bd04 from "node:string_decoder";
|
|
10
11
|
import * as __rspack_external_node_url_3991086a from "node:url";
|
|
11
12
|
import * as __rspack_external_node_worker_threads_28ca7740 from "node:worker_threads";
|
|
12
13
|
import { createRequire as __rspack_createRequire } from "node:module";
|
|
@@ -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/
|
|
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
|
|
14200
|
-
/* import */ var
|
|
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
|
|
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: {
|
|
14610
|
+
replyToGrok: {
|
|
14611
|
+
type: 'string'
|
|
14612
|
+
},
|
|
14613
|
+
bindingId: {
|
|
14614
|
+
type: 'string'
|
|
14615
|
+
},
|
|
14616
|
+
requestId: {
|
|
14617
|
+
type: 'string'
|
|
14618
|
+
},
|
|
14619
|
+
threadId: {
|
|
14620
|
+
type: 'string'
|
|
14621
|
+
},
|
|
14622
|
+
expectedCwd: {
|
|
14623
|
+
type: 'string'
|
|
14624
|
+
},
|
|
14625
|
+
timeoutMs: {
|
|
14626
|
+
type: 'number',
|
|
14627
|
+
description: 'Observation timeout: 1-600000 milliseconds.'
|
|
14628
|
+
},
|
|
14212
14629
|
correlationId: {
|
|
14213
|
-
description: 'Stable correlation id for multi-hop replies',
|
|
14214
14630
|
type: 'string'
|
|
14215
14631
|
},
|
|
14216
14632
|
envelope: {
|
|
14217
|
-
description: 'Prepend the [gbot …] header to the message body',
|
|
14218
14633
|
type: 'boolean'
|
|
14219
14634
|
},
|
|
14220
14635
|
hop: {
|
|
14221
|
-
description: 'Hop count; refused at GROK_BOT_MAX_HOPS',
|
|
14222
14636
|
type: 'number'
|
|
14223
14637
|
},
|
|
14224
|
-
message: {
|
|
14225
|
-
items: {
|
|
14226
|
-
type: 'string'
|
|
14227
|
-
},
|
|
14228
|
-
type: 'array'
|
|
14229
|
-
},
|
|
14230
14638
|
replyTo: {
|
|
14231
|
-
description: 'Prior message id this send replies to',
|
|
14232
14639
|
type: 'string'
|
|
14233
14640
|
},
|
|
14234
|
-
|
|
14235
|
-
type: 'string'
|
|
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.'
|
|
14236
14651
|
},
|
|
14237
14652
|
whenBusy: {
|
|
14238
|
-
|
|
14653
|
+
type: 'string',
|
|
14239
14654
|
enum: [
|
|
14240
14655
|
'reject',
|
|
14241
|
-
'queue'
|
|
14242
|
-
|
|
14243
|
-
|
|
14656
|
+
'queue',
|
|
14657
|
+
'steer'
|
|
14658
|
+
]
|
|
14659
|
+
},
|
|
14660
|
+
message: {
|
|
14661
|
+
type: 'array',
|
|
14662
|
+
items: {
|
|
14663
|
+
type: 'string'
|
|
14664
|
+
}
|
|
14244
14665
|
}
|
|
14245
14666
|
},
|
|
14246
14667
|
required: [
|
|
14247
14668
|
'threadId',
|
|
14248
14669
|
'message'
|
|
14249
|
-
]
|
|
14250
|
-
|
|
14251
|
-
|
|
14252
|
-
|
|
14253
|
-
|
|
14254
|
-
|
|
14255
|
-
|
|
14256
|
-
|
|
14257
|
-
|
|
14258
|
-
|
|
14259
|
-
|
|
14260
|
-
|
|
14261
|
-
|
|
14262
|
-
|
|
14263
|
-
|
|
14264
|
-
|
|
14265
|
-
|
|
14266
|
-
|
|
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
|
|
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
|
|
14298
|
-
|
|
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)(
|
|
14301
|
-
children:
|
|
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": () => (
|
|
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
|
|
15237
|
-
/* import */ var
|
|
15238
|
-
/* import */ var
|
|
15239
|
-
/* import */ var
|
|
15240
|
-
/* import */ var
|
|
15241
|
-
/* import */ var
|
|
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 =
|
|
15313
|
-
|
|
15314
|
-
|
|
15315
|
-
|
|
15316
|
-
|
|
15317
|
-
|
|
15318
|
-
|
|
15319
|
-
|
|
15320
|
-
|
|
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 =
|
|
15323
|
-
correlationId:
|
|
15324
|
-
delivery:
|
|
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:
|
|
15329
|
-
exitCode:
|
|
15330
|
-
hop:
|
|
15331
|
-
id:
|
|
15332
|
-
kind:
|
|
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:
|
|
15337
|
-
messageId:
|
|
15338
|
-
name:
|
|
15339
|
-
replyTo:
|
|
15340
|
-
result:
|
|
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 =
|
|
15909
|
+
const resultSchema = zod__rspack_import_6/* .union */.KCZ([
|
|
15344
15910
|
receiptSchema,
|
|
15345
|
-
|
|
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,
|
|
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,
|
|
15356
|
-
const out = await backend.send(input.target, (0,
|
|
15357
|
-
(0,
|
|
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,
|
|
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)(
|
|
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)(
|
|
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
|
});
|
|
@@ -15422,9 +16013,6 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
15422
16013
|
|
|
15423
16014
|
|
|
15424
16015
|
const config = {
|
|
15425
|
-
aliases: [
|
|
15426
|
-
'chat'
|
|
15427
|
-
],
|
|
15428
16016
|
description: 'Read the most recent messages in a Grok Bot bot or group thread.',
|
|
15429
16017
|
inputJsonSchema: {
|
|
15430
16018
|
additionalProperties: false,
|
|
@@ -15562,6 +16150,411 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
15562
16150
|
});
|
|
15563
16151
|
|
|
15564
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
|
+
|
|
15565
16558
|
},
|
|
15566
16559
|
"./src/gbot.ts"(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
15567
16560
|
/* import */ var zod__rspack_import_2 = __webpack_require__("./node_modules/zod/v4/classic/schemas.js");
|
|
@@ -15574,7 +16567,7 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
15574
16567
|
|
|
15575
16568
|
// Hosts and the CLI print thrown error text (and stack), and a fetch or proxy failure can echo
|
|
15576
16569
|
// a credential. Rewrap with a redacted message; keep `name` and own fields such as `reason`,
|
|
15577
|
-
// `delivery`, `mode`, and
|
|
16570
|
+
// `delivery`, `mode`, and correlation ids so outcome documents still classify the failure.
|
|
15578
16571
|
const withRedactedErrors = async (run)=>{
|
|
15579
16572
|
try {
|
|
15580
16573
|
return await run();
|
|
@@ -15666,7 +16659,10 @@ const transcriptEntries = (transcript)=>{
|
|
|
15666
16659
|
};
|
|
15667
16660
|
|
|
15668
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)
|
|
15669
16664
|
}, {
|
|
16665
|
+
rW: summarizeTarget,
|
|
15670
16666
|
yF: withRedactedErrors
|
|
15671
16667
|
});
|
|
15672
16668
|
|
|
@@ -15696,9 +16692,9 @@ module.exports = __rspack_external_node_fs_1b05aee1;
|
|
|
15696
16692
|
|
|
15697
16693
|
|
|
15698
16694
|
},
|
|
15699
|
-
"node:
|
|
16695
|
+
"node:fs/promises"(module) {
|
|
15700
16696
|
|
|
15701
|
-
module.exports =
|
|
16697
|
+
module.exports = __rspack_external_node_fs_promises_3b710708;
|
|
15702
16698
|
|
|
15703
16699
|
|
|
15704
16700
|
},
|
|
@@ -15725,6 +16721,12 @@ module.exports = __rspack_external_node_path_806ed179;
|
|
|
15725
16721
|
module.exports = __rspack_external_node_readline_d8f53bef;
|
|
15726
16722
|
|
|
15727
16723
|
|
|
16724
|
+
},
|
|
16725
|
+
"node:string_decoder"(module) {
|
|
16726
|
+
|
|
16727
|
+
module.exports = __rspack_external_node_string_decoder_69b9bd04;
|
|
16728
|
+
|
|
16729
|
+
|
|
15728
16730
|
},
|
|
15729
16731
|
"node:url"(module) {
|
|
15730
16732
|
|
|
@@ -15741,17 +16743,206 @@ module.exports = __rspack_external_node_worker_threads_28ca7740;
|
|
|
15741
16743
|
"async_hooks"(module) {
|
|
15742
16744
|
module.exports = __rspack_createRequire_require("async_hooks");
|
|
15743
16745
|
|
|
15744
|
-
},
|
|
15745
|
-
"crypto"(module) {
|
|
15746
|
-
module.exports = __rspack_createRequire_require("crypto");
|
|
16746
|
+
},
|
|
16747
|
+
"crypto"(module) {
|
|
16748
|
+
module.exports = __rspack_createRequire_require("crypto");
|
|
16749
|
+
|
|
16750
|
+
},
|
|
16751
|
+
"stream"(module) {
|
|
16752
|
+
module.exports = __rspack_createRequire_require("stream");
|
|
16753
|
+
|
|
16754
|
+
},
|
|
16755
|
+
"util"(module) {
|
|
16756
|
+
module.exports = __rspack_createRequire_require("util");
|
|
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
|
+
|
|
15747
16940
|
|
|
15748
|
-
|
|
15749
|
-
|
|
15750
|
-
|
|
16941
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
16942
|
+
}, {
|
|
16943
|
+
bg: lineageHostFromClient
|
|
16944
|
+
});
|
|
15751
16945
|
|
|
15752
|
-
},
|
|
15753
|
-
"util"(module) {
|
|
15754
|
-
module.exports = __rspack_createRequire_require("util");
|
|
15755
16946
|
|
|
15756
16947
|
},
|
|
15757
16948
|
"./node_modules/@agent-bundle/runtime/dist/49.js"(__unused_rspack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
@@ -16231,6 +17422,7 @@ const providerRequest = ({ notices, state, ...axes })=>Object.freeze({
|
|
|
16231
17422
|
|
|
16232
17423
|
__webpack_require__.d(__webpack_exports__, {
|
|
16233
17424
|
}, {
|
|
17425
|
+
MA: agent,
|
|
16234
17426
|
hU: unavailable,
|
|
16235
17427
|
iC: runAgentRequest,
|
|
16236
17428
|
qC: available
|
|
@@ -17924,6 +19116,7 @@ function preprocess(fn, schema) {
|
|
|
17924
19116
|
__webpack_require__.d(__webpack_exports__, {
|
|
17925
19117
|
Ikc: () => (object),
|
|
17926
19118
|
KCZ: () => (union),
|
|
19119
|
+
L5J: () => (unknown),
|
|
17927
19120
|
Pq9: () => (json),
|
|
17928
19121
|
YOg: () => (array),
|
|
17929
19122
|
YjP: () => (string),
|
|
@@ -26396,6 +27589,7 @@ function inspectGrokBotGatewaySession(options = {}) {
|
|
|
26396
27589
|
__webpack_require__.d(__webpack_exports__, {
|
|
26397
27590
|
Z2: () => (loadGrokBotGatewaySession),
|
|
26398
27591
|
ZN: () => (hasGrokBotGatewaySession),
|
|
27592
|
+
dQ: () => (grokBotGatewayDescriptorPath),
|
|
26399
27593
|
hd: () => (inspectGrokBotGatewaySession)
|
|
26400
27594
|
});
|
|
26401
27595
|
|
|
@@ -26408,7 +27602,7 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
26408
27602
|
/* import */ var node_os__rspack_import_3 = __webpack_require__("node:os");
|
|
26409
27603
|
/* import */ var node_path__rspack_import_4 = __webpack_require__("node:path");
|
|
26410
27604
|
/* import */ var node_child_process__rspack_import_5 = __webpack_require__("node:child_process");
|
|
26411
|
-
/* import */ var
|
|
27605
|
+
/* import */ var _package_json__rspack_import_6 = __webpack_require__("./package.json");
|
|
26412
27606
|
/* import */ var _codex_contract_js__rspack_import_7 = __webpack_require__("./src/core/codex/contract.js");
|
|
26413
27607
|
/* import */ var _desktop_shim_js__rspack_import_8 = __webpack_require__("./src/core/desktop-shim.js");
|
|
26414
27608
|
|
|
@@ -26434,10 +27628,12 @@ const WS_GUID = "258EAFA5-E914-47DA-95CA-C5AB0DC85B11";
|
|
|
26434
27628
|
const WS_MAX_HEADER_BYTES = 16 * 1024;
|
|
26435
27629
|
const WS_MAX_MESSAGE_BYTES = 4 * 1024 * 1024;
|
|
26436
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;
|
|
26437
27634
|
const textDecoder = new TextDecoder("utf-8", {
|
|
26438
27635
|
fatal: true
|
|
26439
27636
|
});
|
|
26440
|
-
const pkg = (0,node_module__rspack_import_6.createRequire)(import.meta.url)("../../package.json");
|
|
26441
27637
|
function codexSocketPath(env = process.env) {
|
|
26442
27638
|
// Explicit socket wins so status/send/queue agree with a shim-installed or
|
|
26443
27639
|
// operator-exported CODEX_APP_SERVER_SOCK; otherwise derive from CODEX_HOME.
|
|
@@ -26574,15 +27770,27 @@ class CodexRpcError extends Error {
|
|
|
26574
27770
|
}
|
|
26575
27771
|
}
|
|
26576
27772
|
class CodexSendError extends Error {
|
|
26577
|
-
constructor(message, { delivery,
|
|
27773
|
+
constructor(message, { correlationId, delivery, hop, messageId, reason, refused, threadId, turnId } = {}){
|
|
26578
27774
|
super(message);
|
|
26579
27775
|
this.name = "CodexSendError";
|
|
26580
27776
|
this.delivery = delivery;
|
|
27777
|
+
if (correlationId !== undefined) this.correlationId = correlationId;
|
|
27778
|
+
if (hop !== undefined) this.hop = hop;
|
|
27779
|
+
if (messageId !== undefined) this.messageId = messageId;
|
|
26581
27780
|
if (reason !== undefined) this.reason = reason;
|
|
27781
|
+
if (refused !== undefined) this.refused = refused;
|
|
26582
27782
|
if (threadId !== undefined) this.threadId = threadId;
|
|
26583
27783
|
if (turnId !== undefined) this.turnId = turnId;
|
|
26584
|
-
|
|
26585
|
-
|
|
27784
|
+
}
|
|
27785
|
+
}
|
|
27786
|
+
function attachEnvelope(error, envelope) {
|
|
27787
|
+
if (!error || typeof error !== "object") return;
|
|
27788
|
+
for (const key of [
|
|
27789
|
+
"messageId",
|
|
27790
|
+
"correlationId",
|
|
27791
|
+
"hop"
|
|
27792
|
+
]){
|
|
27793
|
+
if (envelope?.[key] !== undefined) error[key] = envelope[key];
|
|
26586
27794
|
}
|
|
26587
27795
|
}
|
|
26588
27796
|
/** The route to the app-server is unavailable; `mode` is a stable machine-readable state. */ class CodexRouteError extends Error {
|
|
@@ -26629,16 +27837,44 @@ function isObject(value) {
|
|
|
26629
27837
|
}
|
|
26630
27838
|
/**
|
|
26631
27839
|
* Open a JSON-RPC session to the app-server over its Unix socket (WebSocket framing).
|
|
26632
|
-
* Server
|
|
26633
|
-
*
|
|
26634
|
-
*/ 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 } = {}) {
|
|
26635
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
|
+
});
|
|
26636
27858
|
const socket = (0,node_net__rspack_import_2.createConnection)({
|
|
26637
27859
|
path
|
|
26638
27860
|
});
|
|
26639
27861
|
const key = (0,node_crypto__rspack_import_0.randomBytes)(16).toString("base64");
|
|
26640
27862
|
const pending = new Map();
|
|
26641
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;
|
|
26642
27878
|
let nextId = 1;
|
|
26643
27879
|
let buf = Buffer.alloc(0);
|
|
26644
27880
|
let upgraded = false;
|
|
@@ -26653,22 +27889,127 @@ function isObject(value) {
|
|
|
26653
27889
|
const failAll = (err)=>{
|
|
26654
27890
|
if (closed) return;
|
|
26655
27891
|
closed = true;
|
|
27892
|
+
closeError = err;
|
|
26656
27893
|
clearTimeout(handshakeTimer);
|
|
27894
|
+
clearTimeout(writeTimer);
|
|
27895
|
+
signal?.removeEventListener("abort", abort);
|
|
26657
27896
|
if (err && err.delivery == null) err.delivery = pending.size ? "unknown" : "rejected";
|
|
26658
27897
|
for (const { reject: rej } of pending.values())rej(err);
|
|
26659
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();
|
|
26660
27908
|
try {
|
|
26661
27909
|
socket.destroy();
|
|
26662
27910
|
} catch {}
|
|
26663
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);
|
|
26664
27951
|
};
|
|
27952
|
+
const abort = ()=>failAll(new Error("Codex connection aborted", {
|
|
27953
|
+
cause: signal.reason
|
|
27954
|
+
}));
|
|
26665
27955
|
const failProtocol = (detail)=>failAll(new Error("Codex app-server violated the WebSocket protocol: " + detail));
|
|
26666
27956
|
const write = (opcode, payload)=>{
|
|
26667
|
-
if (
|
|
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
|
+
}
|
|
26668
27975
|
};
|
|
26669
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
|
+
};
|
|
26670
27999
|
const client = {
|
|
26671
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
|
+
}),
|
|
26672
28013
|
// Server-initiated requests are only *answered* once our own turn/start
|
|
26673
28014
|
// is in flight, and then only when they name our own thread/turn:
|
|
26674
28015
|
// anything earlier — or naming another thread or Desktop turn — belongs
|
|
@@ -26693,22 +28034,24 @@ function isObject(value) {
|
|
|
26693
28034
|
const params = entry.params && typeof entry.params === "object" && !Array.isArray(entry.params) ? entry.params : null;
|
|
26694
28035
|
const threadId = params ? params.threadId ?? params.thread_id : null;
|
|
26695
28036
|
const namedTurnId = params ? params.turnId ?? params.turn_id ?? (params.turn && params.turn.id) : null;
|
|
26696
|
-
if (threadId === client.expectedThreadId && namedTurnId === turnId) {
|
|
26697
|
-
entry.
|
|
26698
|
-
|
|
26699
|
-
|
|
26700
|
-
id: entry.id,
|
|
26701
|
-
error: {
|
|
26702
|
-
code: -32601,
|
|
26703
|
-
message: "gbot codex does not answer " + entry.method + "; configure approval_policy on the daemon"
|
|
26704
|
-
}
|
|
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"
|
|
26705
28041
|
});
|
|
28042
|
+
entry.answered = true;
|
|
26706
28043
|
}
|
|
26707
28044
|
}
|
|
26708
28045
|
},
|
|
26709
28046
|
request (method, params) {
|
|
26710
|
-
const id = nextId++;
|
|
26711
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++;
|
|
26712
28055
|
const timer = setTimeout(()=>{
|
|
26713
28056
|
pending.delete(id);
|
|
26714
28057
|
rej(new Error("Codex app-server did not answer " + method + " within " + timeoutMs + "ms"));
|
|
@@ -26724,12 +28067,18 @@ function isObject(value) {
|
|
|
26724
28067
|
rej(e);
|
|
26725
28068
|
}
|
|
26726
28069
|
});
|
|
26727
|
-
|
|
26728
|
-
|
|
26729
|
-
|
|
26730
|
-
|
|
26731
|
-
|
|
26732
|
-
|
|
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
|
+
}
|
|
26733
28082
|
});
|
|
26734
28083
|
},
|
|
26735
28084
|
notify (method, params) {
|
|
@@ -26741,34 +28090,34 @@ function isObject(value) {
|
|
|
26741
28090
|
},
|
|
26742
28091
|
close () {
|
|
26743
28092
|
if (closed) return;
|
|
26744
|
-
|
|
26745
|
-
|
|
26746
|
-
|
|
26747
|
-
|
|
26748
|
-
|
|
26749
|
-
|
|
26750
|
-
|
|
26751
|
-
|
|
26752
|
-
0x03,
|
|
26753
|
-
0xe8
|
|
26754
|
-
]));
|
|
26755
|
-
if (socket.destroyed) return;
|
|
26756
|
-
const forceDestroy = setTimeout(()=>{
|
|
26757
|
-
try {
|
|
26758
|
-
socket.destroy();
|
|
26759
|
-
} catch {}
|
|
26760
|
-
}, 1000);
|
|
26761
|
-
if (typeof forceDestroy.unref === "function") forceDestroy.unref();
|
|
26762
|
-
socket.end(()=>{
|
|
26763
|
-
clearTimeout(forceDestroy);
|
|
26764
|
-
try {
|
|
26765
|
-
socket.destroy();
|
|
26766
|
-
} catch {}
|
|
26767
|
-
});
|
|
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"));
|
|
26768
28101
|
}
|
|
26769
28102
|
};
|
|
28103
|
+
signal?.addEventListener("abort", abort, {
|
|
28104
|
+
once: true
|
|
28105
|
+
});
|
|
26770
28106
|
const onMessage = (msg)=>{
|
|
26771
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;
|
|
26772
28121
|
let answered = client.answerServerRequests;
|
|
26773
28122
|
let defer = false;
|
|
26774
28123
|
// Approval ownership: only answer requests for the turn gbot itself
|
|
@@ -26788,28 +28137,30 @@ function isObject(value) {
|
|
|
26788
28137
|
} else if (turnId !== client.expectedTurnId) answered = false;
|
|
26789
28138
|
} else answered = false;
|
|
26790
28139
|
}
|
|
26791
|
-
|
|
26792
|
-
|
|
26793
|
-
|
|
26794
|
-
params: msg.params,
|
|
26795
|
-
answered
|
|
26796
|
-
};
|
|
28140
|
+
answered = answered && serverRequests.has(msg.id);
|
|
28141
|
+
defer = defer && serverRequests.has(msg.id);
|
|
28142
|
+
entry.answered = answered;
|
|
26797
28143
|
refused.push(entry);
|
|
26798
28144
|
if (defer) {
|
|
26799
28145
|
client.deferred.push(entry);
|
|
26800
28146
|
return;
|
|
26801
28147
|
}
|
|
26802
28148
|
if (!answered) return;
|
|
26803
|
-
|
|
26804
|
-
|
|
26805
|
-
|
|
26806
|
-
error: {
|
|
26807
|
-
code: -32601,
|
|
26808
|
-
message: "gbot codex does not answer " + msg.method + "; configure approval_policy on the daemon"
|
|
26809
|
-
}
|
|
28149
|
+
client.rejectRequest(msg.id, {
|
|
28150
|
+
code: -32601,
|
|
28151
|
+
message: "gbot codex does not answer " + msg.method + "; configure approval_policy on the daemon"
|
|
26810
28152
|
});
|
|
26811
28153
|
return;
|
|
26812
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
|
+
}
|
|
26813
28164
|
if (msg.id == null || !pending.has(msg.id)) return;
|
|
26814
28165
|
const entry = pending.get(msg.id);
|
|
26815
28166
|
pending.delete(msg.id);
|
|
@@ -26835,12 +28186,21 @@ function isObject(value) {
|
|
|
26835
28186
|
failAll(new Error("Codex app-server sent a malformed message"));
|
|
26836
28187
|
return;
|
|
26837
28188
|
}
|
|
26838
|
-
|
|
28189
|
+
try {
|
|
28190
|
+
onMessage(msg);
|
|
28191
|
+
} catch (err) {
|
|
28192
|
+
failAll(err);
|
|
28193
|
+
}
|
|
26839
28194
|
};
|
|
28195
|
+
socket.on("drain", ()=>{
|
|
28196
|
+
clearTimeout(writeTimer);
|
|
28197
|
+
writeTimer = undefined;
|
|
28198
|
+
});
|
|
26840
28199
|
socket.once("error", (err)=>failAll(new Error("Could not connect to Codex app-server at " + path + ": " + err.message)));
|
|
26841
28200
|
socket.once("close", ()=>failAll(new Error("Codex app-server closed the connection")));
|
|
26842
28201
|
socket.once("connect", ()=>socket.write(upgradeRequest(key)));
|
|
26843
28202
|
socket.on("data", (chunk)=>{
|
|
28203
|
+
if (closed) return;
|
|
26844
28204
|
buf = Buffer.concat([
|
|
26845
28205
|
buf,
|
|
26846
28206
|
chunk
|
|
@@ -26860,7 +28220,7 @@ function isObject(value) {
|
|
|
26860
28220
|
clearTimeout(handshakeTimer);
|
|
26861
28221
|
resolve(client);
|
|
26862
28222
|
}
|
|
26863
|
-
|
|
28223
|
+
while(!closed){
|
|
26864
28224
|
const frame = decodeFrame(buf);
|
|
26865
28225
|
if (!frame) {
|
|
26866
28226
|
const claimed = peekFrameLength(buf);
|
|
@@ -26876,10 +28236,18 @@ function isObject(value) {
|
|
|
26876
28236
|
if (frame.masked) return failProtocol("server frames must not be masked");
|
|
26877
28237
|
if (frame.opcode >= 0x8) {
|
|
26878
28238
|
if (!frame.fin || frame.payload.length > 125) return failProtocol("bad control frame");
|
|
26879
|
-
if (frame.opcode === 0x9)
|
|
26880
|
-
|
|
26881
|
-
|
|
26882
|
-
|
|
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
|
+
}
|
|
26883
28251
|
failAll(new Error("Codex app-server closed the connection"));
|
|
26884
28252
|
}
|
|
26885
28253
|
continue; // pong and other control frames carry nothing for us
|
|
@@ -26935,12 +28303,12 @@ function appServerVersion(initResult) {
|
|
|
26935
28303
|
}
|
|
26936
28304
|
throw new CodexRouteError(unreachableMessage(path), "socket-absent");
|
|
26937
28305
|
}
|
|
26938
|
-
async function
|
|
28306
|
+
async function openCodexSession(env = process.env, { experimental = false, ...options } = {}) {
|
|
26939
28307
|
const path = codexSocketPath(env);
|
|
26940
28308
|
assertRoute(path);
|
|
26941
28309
|
let client;
|
|
26942
28310
|
try {
|
|
26943
|
-
client = await connectCodexAppServer(path);
|
|
28311
|
+
client = await connectCodexAppServer(path, options);
|
|
26944
28312
|
} catch (err) {
|
|
26945
28313
|
throw connectError(err, path);
|
|
26946
28314
|
}
|
|
@@ -26949,7 +28317,7 @@ async function openSession(env = process.env, { experimental = false } = {}) {
|
|
|
26949
28317
|
init = await client.request("initialize", {
|
|
26950
28318
|
clientInfo: {
|
|
26951
28319
|
name: "gbot",
|
|
26952
|
-
version:
|
|
28320
|
+
version: _package_json__rspack_import_6/* .version */.rE
|
|
26953
28321
|
},
|
|
26954
28322
|
...experimental ? {
|
|
26955
28323
|
capabilities: {
|
|
@@ -26965,13 +28333,19 @@ async function openSession(env = process.env, { experimental = false } = {}) {
|
|
|
26965
28333
|
client.close();
|
|
26966
28334
|
throw new CodexProtocolError("initialize", "result is not an object");
|
|
26967
28335
|
}
|
|
26968
|
-
|
|
28336
|
+
try {
|
|
28337
|
+
client.notify("initialized");
|
|
28338
|
+
} catch (err) {
|
|
28339
|
+
client.close();
|
|
28340
|
+
throw handshakeError(err);
|
|
28341
|
+
}
|
|
26969
28342
|
return {
|
|
26970
28343
|
client,
|
|
26971
28344
|
path,
|
|
26972
28345
|
init
|
|
26973
28346
|
};
|
|
26974
28347
|
}
|
|
28348
|
+
const openSession = openCodexSession;
|
|
26975
28349
|
const CODEX_VERSION_PROBE_TIMEOUT_MS = 3000;
|
|
26976
28350
|
/** Bounded `codex --version` probe: `{ version, probe }` where probe is ok | missing | timeout | error. */ function probeLocalCodexVersion(timeoutMs = CODEX_VERSION_PROBE_TIMEOUT_MS) {
|
|
26977
28351
|
const out = (0,node_child_process__rspack_import_5.spawnSync)("codex", [
|
|
@@ -27237,7 +28611,7 @@ const ID_PATTERN = /^[A-Za-z0-9_.:-]{1,128}$/;
|
|
|
27237
28611
|
throw new CodexSendError("Refusing to send: hop " + hopCount + " reaches the relay bound " + bound + " (GROK_BOT_MAX_HOPS). " + "This message is an agent-to-agent relay that has already been forwarded too many times.", {
|
|
27238
28612
|
delivery: "rejected",
|
|
27239
28613
|
reason: "hop-limit",
|
|
27240
|
-
|
|
28614
|
+
...out
|
|
27241
28615
|
});
|
|
27242
28616
|
}
|
|
27243
28617
|
return out;
|
|
@@ -27319,26 +28693,30 @@ function requireExperimental(env, what) {
|
|
|
27319
28693
|
reason: "experimental-disabled"
|
|
27320
28694
|
});
|
|
27321
28695
|
}
|
|
27322
|
-
function unsupportedOrRpc(err, method, threadId, envelope) {
|
|
28696
|
+
function unsupportedOrRpc(err, method, threadId, envelope, turnId) {
|
|
28697
|
+
const guarded = method === "turn/steer";
|
|
27323
28698
|
if (err instanceof CodexRpcError && err.rpc && err.rpc.code === -32601) {
|
|
27324
|
-
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."), {
|
|
27325
28700
|
delivery: "rejected",
|
|
27326
28701
|
reason: "unsupported",
|
|
27327
28702
|
threadId,
|
|
27328
|
-
|
|
28703
|
+
turnId,
|
|
28704
|
+
...envelope
|
|
27329
28705
|
});
|
|
27330
28706
|
}
|
|
27331
28707
|
if (err instanceof CodexRpcError) return new CodexSendError(err.message, {
|
|
27332
28708
|
delivery: "rejected",
|
|
27333
28709
|
reason: "rejected",
|
|
27334
28710
|
threadId,
|
|
27335
|
-
|
|
28711
|
+
turnId,
|
|
28712
|
+
...envelope
|
|
27336
28713
|
});
|
|
27337
|
-
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."), {
|
|
27338
28715
|
delivery: err && err.delivery || "unknown",
|
|
27339
28716
|
reason: "transport",
|
|
27340
28717
|
threadId,
|
|
27341
|
-
|
|
28718
|
+
turnId,
|
|
28719
|
+
...envelope
|
|
27342
28720
|
});
|
|
27343
28721
|
}
|
|
27344
28722
|
/** Read the daemon's queue for one thread (experimental `thread/queue/list`). */ async function listCodexQueue(threadId, { env = process.env, limit = 50, cursor } = {}) {
|
|
@@ -27376,30 +28754,70 @@ function unsupportedOrRpc(err, method, threadId, envelope) {
|
|
|
27376
28754
|
/**
|
|
27377
28755
|
* @param {string} threadId
|
|
27378
28756
|
* @param {string} text
|
|
27379
|
-
* @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]
|
|
27380
28758
|
*/ async function sendToCodexThread(threadId, text, { env = process.env, envelope = buildEnvelope({
|
|
27381
28759
|
env
|
|
27382
|
-
}), whenBusy = "reject" } = {}) {
|
|
28760
|
+
}), whenBusy = "reject", session, expectedTurnId, expectedCwd, signal } = {}) {
|
|
27383
28761
|
try {
|
|
27384
28762
|
const receipt = await sendToCodexThreadInner(threadId, text, {
|
|
27385
28763
|
env,
|
|
27386
28764
|
envelope,
|
|
27387
|
-
whenBusy
|
|
28765
|
+
whenBusy,
|
|
28766
|
+
session,
|
|
28767
|
+
expectedTurnId,
|
|
28768
|
+
expectedCwd,
|
|
28769
|
+
signal
|
|
27388
28770
|
});
|
|
27389
28771
|
return (0,_codex_contract_js__rspack_import_7/* .outcomeFromReceipt */.Dz)(receipt);
|
|
27390
28772
|
} catch (err) {
|
|
27391
28773
|
// Every receipt names the message, including refusals that never reached the daemon.
|
|
27392
|
-
if (
|
|
28774
|
+
if (err && typeof err === "object") {
|
|
28775
|
+
attachEnvelope(err, envelope);
|
|
28776
|
+
if (err.threadId === undefined) err.threadId = threadId;
|
|
28777
|
+
}
|
|
27393
28778
|
return (0,_codex_contract_js__rspack_import_7/* .outcomeFromError */.DG)(err);
|
|
27394
28779
|
}
|
|
27395
28780
|
}
|
|
27396
|
-
async function sendToCodexThreadInner(threadId, text, { env, envelope, whenBusy }) {
|
|
27397
|
-
if (
|
|
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
|
+
};
|
|
27398
28804
|
assertThreadAllowed(threadId, env);
|
|
27399
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();
|
|
27400
28817
|
const body = withEnvelopeHeader(text, envelope, env);
|
|
27401
|
-
const { client } = await openSession(env, {
|
|
27402
|
-
experimental: whenBusy === "queue"
|
|
28818
|
+
const { client } = session ?? await openSession(env, {
|
|
28819
|
+
experimental: whenBusy === "queue",
|
|
28820
|
+
signal
|
|
27403
28821
|
});
|
|
27404
28822
|
try {
|
|
27405
28823
|
let resumed;
|
|
@@ -27409,17 +28827,33 @@ async function sendToCodexThreadInner(threadId, text, { env, envelope, whenBusy
|
|
|
27409
28827
|
excludeTurns: true
|
|
27410
28828
|
});
|
|
27411
28829
|
} catch (err) {
|
|
28830
|
+
assertNotCancelled();
|
|
27412
28831
|
if (err instanceof CodexSendError) throw err;
|
|
27413
28832
|
throw new CodexSendError(explainSendError(err, threadId).message, {
|
|
27414
28833
|
delivery: err instanceof CodexRpcError ? "rejected" : err && err.delivery || "unknown",
|
|
27415
28834
|
reason: err instanceof CodexRpcError ? /no rollout found|thread not found/i.test(String(err.rpc && err.rpc.message)) ? "unknown-thread" : /active writer/i.test(String(err.rpc && err.rpc.message)) ? "external-owner" : "rejected" : "transport",
|
|
27416
28835
|
threadId,
|
|
27417
|
-
envelope
|
|
28836
|
+
...envelope
|
|
27418
28837
|
});
|
|
27419
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();
|
|
27420
28842
|
if (!isObject(resumed) || !isObject(resumed.thread) || typeof resumed.thread.id !== "string") {
|
|
27421
28843
|
throw new CodexProtocolError("thread/resume", "missing `thread.id`");
|
|
27422
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
|
+
});
|
|
27423
28857
|
const state = threadState(resumed, threadId);
|
|
27424
28858
|
const receiptBase = {
|
|
27425
28859
|
threadId: resumed.thread.id,
|
|
@@ -27441,9 +28875,41 @@ async function sendToCodexThreadInner(threadId, text, { env, envelope, whenBusy
|
|
|
27441
28875
|
delivery: "rejected",
|
|
27442
28876
|
reason: "busy",
|
|
27443
28877
|
threadId,
|
|
27444
|
-
envelope
|
|
28878
|
+
...envelope
|
|
27445
28879
|
});
|
|
27446
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
|
+
}
|
|
27447
28913
|
if (state.busy) {
|
|
27448
28914
|
let queued;
|
|
27449
28915
|
try {
|
|
@@ -27466,7 +28932,7 @@ async function sendToCodexThreadInner(threadId, text, { env, envelope, whenBusy
|
|
|
27466
28932
|
delivery: "unknown",
|
|
27467
28933
|
reason: "bad-response",
|
|
27468
28934
|
threadId,
|
|
27469
|
-
envelope
|
|
28935
|
+
...envelope
|
|
27470
28936
|
});
|
|
27471
28937
|
}
|
|
27472
28938
|
return {
|
|
@@ -27487,9 +28953,11 @@ async function sendToCodexThreadInner(threadId, text, { env, envelope, whenBusy
|
|
|
27487
28953
|
// that arrives before the acknowledgment supplies our turn id wait in
|
|
27488
28954
|
// client.deferred and are adopted only on a match. Requests missing
|
|
27489
28955
|
// thread or turn IDs remain unanswered because ownership is unknown.
|
|
27490
|
-
|
|
27491
|
-
|
|
27492
|
-
|
|
28956
|
+
if (!session) {
|
|
28957
|
+
client.expectedThreadId = threadId;
|
|
28958
|
+
client.expectedTurnId = null;
|
|
28959
|
+
client.answerServerRequests = true;
|
|
28960
|
+
}
|
|
27493
28961
|
let turn;
|
|
27494
28962
|
try {
|
|
27495
28963
|
turn = await client.request("turn/start", {
|
|
@@ -27512,7 +28980,7 @@ async function sendToCodexThreadInner(threadId, text, { env, envelope, whenBusy
|
|
|
27512
28980
|
delivery,
|
|
27513
28981
|
reason: delivery === "rejected" ? "rejected" : "transport",
|
|
27514
28982
|
threadId,
|
|
27515
|
-
envelope
|
|
28983
|
+
...envelope
|
|
27516
28984
|
});
|
|
27517
28985
|
}
|
|
27518
28986
|
const turnId = turn && turn.turn && typeof turn.turn.id === "string" && turn.turn.id ? turn.turn.id : null;
|
|
@@ -27521,10 +28989,10 @@ async function sendToCodexThreadInner(threadId, text, { env, envelope, whenBusy
|
|
|
27521
28989
|
delivery: "unknown",
|
|
27522
28990
|
reason: "bad-response",
|
|
27523
28991
|
threadId,
|
|
27524
|
-
envelope
|
|
28992
|
+
...envelope
|
|
27525
28993
|
});
|
|
27526
28994
|
}
|
|
27527
|
-
client._adoptTurn(turnId);
|
|
28995
|
+
if (!session) client._adoptTurn(turnId);
|
|
27528
28996
|
const freshRefused = client.refused.slice(seenRefused).filter((r)=>{
|
|
27529
28997
|
if (!r.answered) return false;
|
|
27530
28998
|
const params = r.params && typeof r.params === "object" && !Array.isArray(r.params) ? r.params : null;
|
|
@@ -27543,7 +29011,7 @@ async function sendToCodexThreadInner(threadId, text, { env, envelope, whenBusy
|
|
|
27543
29011
|
threadId,
|
|
27544
29012
|
turnId,
|
|
27545
29013
|
refused: freshRefused.map((r)=>r.method),
|
|
27546
|
-
envelope
|
|
29014
|
+
...envelope
|
|
27547
29015
|
});
|
|
27548
29016
|
}
|
|
27549
29017
|
return {
|
|
@@ -27553,18 +29021,22 @@ async function sendToCodexThreadInner(threadId, text, { env, envelope, whenBusy
|
|
|
27553
29021
|
turnStatus: turn.turn.status
|
|
27554
29022
|
};
|
|
27555
29023
|
} finally{
|
|
27556
|
-
client.close();
|
|
29024
|
+
if (!session) client.close();
|
|
27557
29025
|
}
|
|
27558
29026
|
}
|
|
27559
29027
|
|
|
27560
29028
|
__webpack_require__.d(__webpack_exports__, {
|
|
29029
|
+
$3: () => (assertThreadAllowed),
|
|
27561
29030
|
Bt: () => (listCodexQueue),
|
|
27562
29031
|
MU: () => (codexStatus),
|
|
27563
29032
|
Mr: () => (withEnvelopeHeader),
|
|
27564
29033
|
X$: () => (listCodexThreads),
|
|
27565
29034
|
ZS: () => (sendToCodexThread),
|
|
29035
|
+
e0: () => (experimentalEnabled),
|
|
29036
|
+
eC: () => (openCodexSession),
|
|
27566
29037
|
nq: () => (buildEnvelope),
|
|
27567
|
-
pF: () => (singleLine)
|
|
29038
|
+
pF: () => (singleLine),
|
|
29039
|
+
ql: () => (codexSocketPath)
|
|
27568
29040
|
});
|
|
27569
29041
|
|
|
27570
29042
|
|
|
@@ -27629,8 +29101,6 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
27629
29101
|
}
|
|
27630
29102
|
/**
|
|
27631
29103
|
* Flatten a thrown error into the #46 send/failure document (plus exitCode).
|
|
27632
|
-
* Preserves the legacy failure-document fields, then adds exitCode for the
|
|
27633
|
-
* generated CLI's `exitCode: 'result'` policy.
|
|
27634
29104
|
*
|
|
27635
29105
|
* @param {unknown} error
|
|
27636
29106
|
* @param {{ isUsage?: (err: unknown) => boolean }} [opts]
|
|
@@ -27657,50 +29127,482 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
27657
29127
|
if (error[key] !== undefined) out[key] = error[key];
|
|
27658
29128
|
}
|
|
27659
29129
|
if (out.reason === undefined && isUsage(error)) out.reason = "usage";
|
|
27660
|
-
|
|
27661
|
-
|
|
27662
|
-
|
|
27663
|
-
|
|
27664
|
-
|
|
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;
|
|
27665
29255
|
}
|
|
27666
|
-
|
|
27667
|
-
|
|
27668
|
-
|
|
27669
|
-
|
|
27670
|
-
exitCode: 1
|
|
29256
|
+
for (const listener of [
|
|
29257
|
+
...wake
|
|
29258
|
+
])listener();
|
|
29259
|
+
return onEvent?.(event);
|
|
27671
29260
|
};
|
|
27672
|
-
|
|
27673
|
-
|
|
27674
|
-
|
|
27675
|
-
|
|
27676
|
-
|
|
27677
|
-
|
|
27678
|
-
|
|
27679
|
-
|
|
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();
|
|
27680
29286
|
};
|
|
27681
|
-
|
|
27682
|
-
|
|
27683
|
-
|
|
27684
|
-
|
|
27685
|
-
|
|
27686
|
-
|
|
27687
|
-
if (
|
|
27688
|
-
|
|
27689
|
-
|
|
27690
|
-
|
|
27691
|
-
|
|
27692
|
-
|
|
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
|
+
};
|
|
27693
29564
|
}
|
|
27694
|
-
return
|
|
27695
|
-
|
|
27696
|
-
|
|
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
|
+
}
|
|
27697
29601
|
};
|
|
27698
29602
|
}
|
|
27699
29603
|
|
|
27700
29604
|
__webpack_require__.d(__webpack_exports__, {
|
|
27701
|
-
|
|
27702
|
-
DG: () => (outcomeFromError),
|
|
27703
|
-
Dz: () => (outcomeFromReceipt)
|
|
29605
|
+
j: () => (openCodexConversation)
|
|
27704
29606
|
});
|
|
27705
29607
|
|
|
27706
29608
|
|
|
@@ -28371,7 +30273,7 @@ function formatTranscript(out, { full = false } = {}) {
|
|
|
28371
30273
|
for (const e of entries){
|
|
28372
30274
|
const role = e.role || e.kind || e.sender || e.type || "msg";
|
|
28373
30275
|
const text = (0,_transcript_js__rspack_import_0/* .entryText */.u0)(e);
|
|
28374
|
-
const id = e.id ||
|
|
30276
|
+
const id = e.id || "";
|
|
28375
30277
|
lines.push("[" + role + (id ? " " + id : "") + "] " + (full ? text : truncateCliText(text)));
|
|
28376
30278
|
}
|
|
28377
30279
|
return lines.join("\n");
|
|
@@ -28466,20 +30368,33 @@ class GatewayError extends Error {
|
|
|
28466
30368
|
// ponytail: fixed 30 s deadline and buffered byte cap; upgrade path is per-method budgets plus streaming reads.
|
|
28467
30369
|
const GATEWAY_TIMEOUT_MS = 30000;
|
|
28468
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
|
+
}
|
|
28469
30386
|
function backendBase() {
|
|
28470
|
-
return (process.env.
|
|
30387
|
+
return (process.env.CURSOR_API_BASE_URL || "https://api2.cursor.sh").replace(/\/$/, "");
|
|
28471
30388
|
}
|
|
28472
30389
|
function accessTokenFromEnv() {
|
|
28473
|
-
return (process.env.CURSOR_ACCESS_TOKEN ||
|
|
30390
|
+
return (process.env.CURSOR_ACCESS_TOKEN || "").trim();
|
|
28474
30391
|
}
|
|
28475
30392
|
function gatewayTokenFromEnv() {
|
|
28476
|
-
return (process.env.GROK_BOT_GATEWAY_TOKEN ||
|
|
30393
|
+
return (process.env.GROK_BOT_GATEWAY_TOKEN || "").trim();
|
|
28477
30394
|
}
|
|
28478
30395
|
function gatewayOverride() {
|
|
28479
30396
|
const token = gatewayTokenFromEnv();
|
|
28480
|
-
const
|
|
28481
|
-
const localUrl = token ? "http://127.0.0.1:" + (process.env.SAND_HOST_PORT || "1340") : "";
|
|
28482
|
-
const url = explicitUrl || localUrl;
|
|
30397
|
+
const url = (process.env.GROK_BOT_GATEWAY_URL || "").trim();
|
|
28483
30398
|
if (url && token) {
|
|
28484
30399
|
return {
|
|
28485
30400
|
gatewayUrl: (0,_url_policy_js__rspack_import_3/* .assertAllowedCredentialUrl */.Re)(url.replace(/\/$/, ""), {
|
|
@@ -28556,18 +30471,26 @@ function pick(obj, ...keys) {
|
|
|
28556
30471
|
}
|
|
28557
30472
|
return undefined;
|
|
28558
30473
|
}
|
|
28559
|
-
async function ensureSandbox(accessToken) {
|
|
30474
|
+
async function ensureSandbox(accessToken, { signal } = {}) {
|
|
30475
|
+
assertGatewayActive(signal);
|
|
28560
30476
|
const url = (0,_url_policy_js__rspack_import_3/* .assertAllowedCredentialUrl */.Re)(backendBase(), {
|
|
28561
30477
|
kind: "backend"
|
|
28562
30478
|
}) + "/aiserver.v1.GrokBotService/EnsureSandBox";
|
|
28563
|
-
|
|
28564
|
-
|
|
28565
|
-
|
|
28566
|
-
|
|
28567
|
-
|
|
28568
|
-
|
|
28569
|
-
|
|
28570
|
-
|
|
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);
|
|
28571
30494
|
if (!res.ok) {
|
|
28572
30495
|
const detail = body.message || body.error || body.raw || res.statusText;
|
|
28573
30496
|
throw new GatewayError("EnsureSandBox failed: " + res.status + " " + (0,_url_policy_js__rspack_import_3/* .redactSecrets */.fp)(detail), {
|
|
@@ -28588,7 +30511,8 @@ async function ensureSandbox(accessToken) {
|
|
|
28588
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)())
|
|
28589
30512
|
};
|
|
28590
30513
|
}
|
|
28591
|
-
async function connectGateway() {
|
|
30514
|
+
async function connectGateway({ signal } = {}) {
|
|
30515
|
+
assertGatewayActive(signal);
|
|
28592
30516
|
const override = gatewayOverride();
|
|
28593
30517
|
if (override) return override;
|
|
28594
30518
|
const fromApp = sessionFromApp();
|
|
@@ -28597,21 +30521,36 @@ async function connectGateway() {
|
|
|
28597
30521
|
if (!token) {
|
|
28598
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.");
|
|
28599
30523
|
}
|
|
28600
|
-
return ensureSandbox(token
|
|
30524
|
+
return ensureSandbox(token, {
|
|
30525
|
+
signal
|
|
30526
|
+
});
|
|
28601
30527
|
}
|
|
28602
|
-
async function gatewayCall(session, method, body = {}) {
|
|
30528
|
+
async function gatewayCall(session, method, body = {}, { signal } = {}) {
|
|
30529
|
+
assertGatewayActive(signal);
|
|
28603
30530
|
const base = (0,_url_policy_js__rspack_import_3/* .assertAllowedCredentialUrl */.Re)(session.gatewayUrl, {
|
|
28604
30531
|
kind: "gateway"
|
|
28605
30532
|
});
|
|
28606
30533
|
const url = base + "/api/" + method;
|
|
28607
|
-
|
|
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 = {
|
|
28608
30538
|
method: "POST",
|
|
28609
30539
|
redirect: "error",
|
|
28610
|
-
signal:
|
|
30540
|
+
signal: gatewayDeadline(prompt ? undefined : signal),
|
|
28611
30541
|
headers: (0,_headers_js__rspack_import_4/* .requestHeaders */.A1)(session),
|
|
28612
30542
|
body: JSON.stringify(body)
|
|
28613
|
-
}
|
|
28614
|
-
|
|
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);
|
|
28615
30554
|
if (!res.ok) {
|
|
28616
30555
|
const detail = data.message || data.error || data.raw || res.statusText;
|
|
28617
30556
|
throw new GatewayError(method + " failed: " + res.status + " " + (0,_url_policy_js__rspack_import_3/* .redactSecrets */.fp)(String(detail).slice(0, 300)), {
|
|
@@ -28663,8 +30602,10 @@ function unwrapList(data) {
|
|
|
28663
30602
|
function unwrapOne(data) {
|
|
28664
30603
|
return asRecord(data.agent || data);
|
|
28665
30604
|
}
|
|
28666
|
-
async function listAgents(session) {
|
|
28667
|
-
const data = await gatewayCall(session, "listAgents", {}
|
|
30605
|
+
async function listAgents(session, { signal } = {}) {
|
|
30606
|
+
const data = await gatewayCall(session, "listAgents", {}, {
|
|
30607
|
+
signal
|
|
30608
|
+
});
|
|
28668
30609
|
return unwrapList(data).map(asRecord).filter((r)=>r && r.id);
|
|
28669
30610
|
}
|
|
28670
30611
|
function resolveFromList(records, ref) {
|
|
@@ -28676,8 +30617,10 @@ function resolveFromList(records, ref) {
|
|
|
28676
30617
|
if (matches.length === 0) throw new GatewayError("No bot or group named \"" + ref + "\"");
|
|
28677
30618
|
throw new GatewayError("Ambiguous name \"" + ref + "\"");
|
|
28678
30619
|
}
|
|
28679
|
-
async function resolveRef(session, ref) {
|
|
28680
|
-
return resolveFromList(await listAgents(session
|
|
30620
|
+
async function resolveRef(session, ref, { signal } = {}) {
|
|
30621
|
+
return resolveFromList(await listAgents(session, {
|
|
30622
|
+
signal
|
|
30623
|
+
}), ref);
|
|
28681
30624
|
}
|
|
28682
30625
|
async function createAgent(session, input) {
|
|
28683
30626
|
const data = await gatewayCall(session, "createAgent", {
|
|
@@ -28800,7 +30743,10 @@ async function removeGroupMember(session, groupRef, memberRef) {
|
|
|
28800
30743
|
return setGroupMembers(session, group.id, next);
|
|
28801
30744
|
}
|
|
28802
30745
|
async function sendPrompt(session, ref, prompt, extra = {}) {
|
|
28803
|
-
|
|
30746
|
+
assertGatewayActive(extra.signal);
|
|
30747
|
+
const rec = await resolveRef(session, ref, {
|
|
30748
|
+
signal: extra.signal
|
|
30749
|
+
});
|
|
28804
30750
|
const body = {
|
|
28805
30751
|
agentId: rec.id,
|
|
28806
30752
|
prompt,
|
|
@@ -28809,7 +30755,9 @@ async function sendPrompt(session, ref, prompt, extra = {}) {
|
|
|
28809
30755
|
if (extra.replyToId) body.replyToId = extra.replyToId;
|
|
28810
30756
|
let data;
|
|
28811
30757
|
try {
|
|
28812
|
-
data = await gatewayCall(session, "sendPrompt", body
|
|
30758
|
+
data = await gatewayCall(session, "sendPrompt", body, {
|
|
30759
|
+
signal: extra.signal
|
|
30760
|
+
});
|
|
28813
30761
|
} catch (err) {
|
|
28814
30762
|
// Delivery states: the server answered no (rejected) vs the request may have landed (unknown).
|
|
28815
30763
|
// Never retry an unknown delivery blindly; read the thread first.
|
|
@@ -28983,8 +30931,8 @@ function saveHistory(out, { dir, disabled, event, prompt, rootId } = {}) {
|
|
|
28983
30931
|
rootId
|
|
28984
30932
|
} : {},
|
|
28985
30933
|
role: String(entry.role || entry.kind || entry.sender || entry.type || "msg"),
|
|
28986
|
-
...entry.id
|
|
28987
|
-
messageId: String(entry.id
|
|
30934
|
+
...entry.id ? {
|
|
30935
|
+
messageId: String(entry.id)
|
|
28988
30936
|
} : {},
|
|
28989
30937
|
...entry.timestamp || entry.createdAt ? {
|
|
28990
30938
|
timestamp: String(entry.timestamp || entry.createdAt)
|
|
@@ -29061,6 +31009,269 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
29061
31009
|
});
|
|
29062
31010
|
|
|
29063
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
|
+
|
|
29064
31275
|
},
|
|
29065
31276
|
"./src/core/store.js"(__unused_rspack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
29066
31277
|
/* import */ var node_crypto__rspack_import_0 = __webpack_require__("node:crypto");
|
|
@@ -29128,10 +31339,7 @@ function isUuid(value) {
|
|
|
29128
31339
|
function defaultCandidateRoots() {
|
|
29129
31340
|
const home = (0,node_os__rspack_import_2.homedir)();
|
|
29130
31341
|
const env = [
|
|
29131
|
-
process.env.GROK_BOT_AGENTS_DIR
|
|
29132
|
-
process.env.SAND_AGENTS_DIR,
|
|
29133
|
-
process.env.SAND_DATA_ROOT && (0,node_path__rspack_import_3.join)(process.env.SAND_DATA_ROOT, "agents"),
|
|
29134
|
-
process.env.SAND_DATA_ROOT && (0,node_path__rspack_import_3.join)(process.env.SAND_DATA_ROOT, "agent-data", "agents")
|
|
31342
|
+
process.env.GROK_BOT_AGENTS_DIR
|
|
29135
31343
|
].filter(Boolean);
|
|
29136
31344
|
return [
|
|
29137
31345
|
...env,
|
|
@@ -29410,7 +31618,6 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
29410
31618
|
|
|
29411
31619
|
},
|
|
29412
31620
|
"./src/core/transcript.js"(__unused_rspack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
29413
|
-
// Shared by `gbot thread` and the grok-bot plugin's gbot_thread tool.
|
|
29414
31621
|
/** Coerce anything to a string without throwing (numbers, BigInt, unserializable objects). */ function toSafeText(value) {
|
|
29415
31622
|
if (typeof value === "string") return value;
|
|
29416
31623
|
if (value == null) return "";
|
|
@@ -29448,15 +31655,12 @@ function entryTextRaw(e) {
|
|
|
29448
31655
|
return typeof e.preview === "string" ? e.preview : "";
|
|
29449
31656
|
}
|
|
29450
31657
|
function transcriptEntries(payload) {
|
|
29451
|
-
if (Array.isArray(payload)) return payload;
|
|
29452
31658
|
if (!payload || typeof payload !== "object") return [];
|
|
29453
|
-
|
|
29454
|
-
return Array.isArray(entries) ? entries : [];
|
|
31659
|
+
return Array.isArray(payload.entries) ? payload.entries : [];
|
|
29455
31660
|
}
|
|
29456
31661
|
function sourceEntryId(entry) {
|
|
29457
31662
|
if (!entry || typeof entry !== "object") return "";
|
|
29458
|
-
|
|
29459
|
-
return typeof entry.messageId === "string" ? entry.messageId : "";
|
|
31663
|
+
return typeof entry.id === "string" ? entry.id : "";
|
|
29460
31664
|
}
|
|
29461
31665
|
function lastSourceId(entries, fallback = "") {
|
|
29462
31666
|
for(let index = entries.length - 1; index >= 0; index -= 1){
|
|
@@ -29632,6 +31836,10 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
29632
31836
|
});
|
|
29633
31837
|
|
|
29634
31838
|
|
|
31839
|
+
},
|
|
31840
|
+
"./package.json"(module) {
|
|
31841
|
+
module.exports = {"rE":"0.6.0"}
|
|
31842
|
+
|
|
29635
31843
|
},
|
|
29636
31844
|
|
|
29637
31845
|
});
|
|
@@ -29696,33 +31904,40 @@ __webpack_require__.r = (exports) => {
|
|
|
29696
31904
|
var __webpack_exports__ = {};
|
|
29697
31905
|
/* import */ var node_worker_threads__rspack_import_0 = __webpack_require__("node:worker_threads");
|
|
29698
31906
|
/* import */ var react__rspack_import_1 = __webpack_require__("./node_modules/react/react.react-server.js");
|
|
29699
|
-
/* import */ var
|
|
29700
|
-
/* import */ var
|
|
29701
|
-
/* import */ var
|
|
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");
|
|
29702
31910
|
/* import */ var node_url__rspack_import_2 = __webpack_require__("node:url");
|
|
29703
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");
|
|
29704
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");
|
|
29705
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");
|
|
29706
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");
|
|
29707
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");
|
|
29708
|
-
/* import */ var
|
|
29709
|
-
/* import */ var
|
|
29710
|
-
/* import */ var
|
|
29711
|
-
/* import */ var
|
|
29712
|
-
/* import */ var
|
|
29713
|
-
/* import */ var
|
|
29714
|
-
/* import */ var
|
|
29715
|
-
/* import */ var
|
|
29716
|
-
/* import */ var
|
|
29717
|
-
/* import */ var
|
|
29718
|
-
/* import */ var
|
|
29719
|
-
/* import */ var
|
|
29720
|
-
/* import */ var
|
|
29721
|
-
/* import */ var
|
|
29722
|
-
/* import */ var
|
|
29723
|
-
/* import */ var
|
|
29724
|
-
/* import */ var
|
|
29725
|
-
/* import */ var
|
|
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");
|
|
29726
31941
|
|
|
29727
31942
|
|
|
29728
31943
|
|
|
@@ -29739,42 +31954,56 @@ const route3 = Object.assign({}, Reflect.get(_home_runner_work_grok_bot_cli_grok
|
|
|
29739
31954
|
|
|
29740
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);
|
|
29741
31956
|
|
|
29742
|
-
const route5 = Object.assign({}, Reflect.get(
|
|
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);
|
|
29743
31960
|
|
|
29744
|
-
const
|
|
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);
|
|
29745
31962
|
|
|
29746
|
-
const
|
|
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);
|
|
29747
31964
|
|
|
29748
|
-
const
|
|
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);
|
|
29749
31966
|
|
|
29750
|
-
const
|
|
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);
|
|
29751
31968
|
|
|
29752
|
-
const
|
|
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);
|
|
29753
31970
|
|
|
29754
|
-
const
|
|
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);
|
|
29755
31972
|
|
|
29756
|
-
const
|
|
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);
|
|
29757
31974
|
|
|
29758
|
-
const
|
|
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);
|
|
29759
31976
|
|
|
29760
|
-
const
|
|
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);
|
|
29761
31978
|
|
|
29762
|
-
const
|
|
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);
|
|
29763
31980
|
|
|
29764
|
-
const
|
|
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);
|
|
29765
31982
|
|
|
29766
|
-
const
|
|
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);
|
|
29767
31984
|
|
|
29768
|
-
const
|
|
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);
|
|
29769
31986
|
|
|
29770
|
-
const
|
|
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);
|
|
29771
31988
|
|
|
29772
|
-
const
|
|
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);
|
|
29773
31990
|
|
|
29774
|
-
const
|
|
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);
|
|
29775
31992
|
|
|
29776
|
-
const
|
|
29777
|
-
|
|
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)({
|
|
29778
32007
|
fallback: (0,node_url__rspack_import_2.fileURLToPath)(new URL('..', import.meta.url)),
|
|
29779
32008
|
stateAnchor: 'user-data'
|
|
29780
32009
|
});
|
|
@@ -29822,113 +32051,155 @@ const routes = Object.freeze({
|
|
|
29822
32051
|
name: "bots update",
|
|
29823
32052
|
module: route4
|
|
29824
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
|
+
}),
|
|
29825
32084
|
"cli:codex/desktop-shim": Object.freeze({
|
|
29826
32085
|
id: "cli:codex/desktop-shim",
|
|
29827
32086
|
kind: "cli",
|
|
29828
32087
|
name: "codex desktop-shim",
|
|
29829
|
-
module:
|
|
32088
|
+
module: route10
|
|
29830
32089
|
}),
|
|
29831
32090
|
"cli:codex/list-threads": Object.freeze({
|
|
29832
32091
|
id: "cli:codex/list-threads",
|
|
29833
32092
|
kind: "cli",
|
|
29834
32093
|
name: "codex list-threads",
|
|
29835
|
-
module:
|
|
32094
|
+
module: route11
|
|
29836
32095
|
}),
|
|
29837
32096
|
"cli:codex/queue": Object.freeze({
|
|
29838
32097
|
id: "cli:codex/queue",
|
|
29839
32098
|
kind: "cli",
|
|
29840
32099
|
name: "codex queue",
|
|
29841
|
-
module:
|
|
32100
|
+
module: route12
|
|
29842
32101
|
}),
|
|
29843
32102
|
"cli:codex/send": Object.freeze({
|
|
29844
32103
|
id: "cli:codex/send",
|
|
29845
32104
|
kind: "cli",
|
|
29846
32105
|
name: "codex send",
|
|
29847
|
-
module:
|
|
32106
|
+
module: route13
|
|
29848
32107
|
}),
|
|
29849
32108
|
"cli:codex/status": Object.freeze({
|
|
29850
32109
|
id: "cli:codex/status",
|
|
29851
32110
|
kind: "cli",
|
|
29852
32111
|
name: "codex status",
|
|
29853
|
-
module:
|
|
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
|
|
29854
32125
|
}),
|
|
29855
32126
|
"cli:doctor": Object.freeze({
|
|
29856
32127
|
id: "cli:doctor",
|
|
29857
32128
|
kind: "cli",
|
|
29858
32129
|
name: "doctor",
|
|
29859
|
-
module:
|
|
32130
|
+
module: route17
|
|
29860
32131
|
}),
|
|
29861
32132
|
"cli:groups/add": Object.freeze({
|
|
29862
32133
|
id: "cli:groups/add",
|
|
29863
32134
|
kind: "cli",
|
|
29864
32135
|
name: "groups add",
|
|
29865
|
-
module:
|
|
32136
|
+
module: route18
|
|
29866
32137
|
}),
|
|
29867
32138
|
"cli:groups/create": Object.freeze({
|
|
29868
32139
|
id: "cli:groups/create",
|
|
29869
32140
|
kind: "cli",
|
|
29870
32141
|
name: "groups create",
|
|
29871
|
-
module:
|
|
32142
|
+
module: route19
|
|
29872
32143
|
}),
|
|
29873
32144
|
"cli:groups/delete": Object.freeze({
|
|
29874
32145
|
id: "cli:groups/delete",
|
|
29875
32146
|
kind: "cli",
|
|
29876
32147
|
name: "groups delete",
|
|
29877
|
-
module:
|
|
32148
|
+
module: route20
|
|
29878
32149
|
}),
|
|
29879
32150
|
"cli:groups/get": Object.freeze({
|
|
29880
32151
|
id: "cli:groups/get",
|
|
29881
32152
|
kind: "cli",
|
|
29882
32153
|
name: "groups get",
|
|
29883
|
-
module:
|
|
32154
|
+
module: route21
|
|
29884
32155
|
}),
|
|
29885
32156
|
"cli:groups/list": Object.freeze({
|
|
29886
32157
|
id: "cli:groups/list",
|
|
29887
32158
|
kind: "cli",
|
|
29888
32159
|
name: "groups list",
|
|
29889
|
-
module:
|
|
32160
|
+
module: route22
|
|
29890
32161
|
}),
|
|
29891
32162
|
"cli:groups/members": Object.freeze({
|
|
29892
32163
|
id: "cli:groups/members",
|
|
29893
32164
|
kind: "cli",
|
|
29894
32165
|
name: "groups members",
|
|
29895
|
-
module:
|
|
32166
|
+
module: route23
|
|
29896
32167
|
}),
|
|
29897
32168
|
"cli:groups/remove": Object.freeze({
|
|
29898
32169
|
id: "cli:groups/remove",
|
|
29899
32170
|
kind: "cli",
|
|
29900
32171
|
name: "groups remove",
|
|
29901
|
-
module:
|
|
32172
|
+
module: route24
|
|
29902
32173
|
}),
|
|
29903
32174
|
"cli:groups/set": Object.freeze({
|
|
29904
32175
|
id: "cli:groups/set",
|
|
29905
32176
|
kind: "cli",
|
|
29906
32177
|
name: "groups set",
|
|
29907
|
-
module:
|
|
32178
|
+
module: route25
|
|
29908
32179
|
}),
|
|
29909
32180
|
"cli:groups/update": Object.freeze({
|
|
29910
32181
|
id: "cli:groups/update",
|
|
29911
32182
|
kind: "cli",
|
|
29912
32183
|
name: "groups update",
|
|
29913
|
-
module:
|
|
32184
|
+
module: route26
|
|
29914
32185
|
}),
|
|
29915
32186
|
"cli:history": Object.freeze({
|
|
29916
32187
|
id: "cli:history",
|
|
29917
32188
|
kind: "cli",
|
|
29918
32189
|
name: "history",
|
|
29919
|
-
module:
|
|
32190
|
+
module: route27
|
|
29920
32191
|
}),
|
|
29921
32192
|
"cli:send": Object.freeze({
|
|
29922
32193
|
id: "cli:send",
|
|
29923
32194
|
kind: "cli",
|
|
29924
32195
|
name: "send",
|
|
29925
|
-
module:
|
|
32196
|
+
module: route28
|
|
29926
32197
|
}),
|
|
29927
32198
|
"cli:thread": Object.freeze({
|
|
29928
32199
|
id: "cli:thread",
|
|
29929
32200
|
kind: "cli",
|
|
29930
32201
|
name: "thread",
|
|
29931
|
-
module:
|
|
32202
|
+
module: route29
|
|
29932
32203
|
})
|
|
29933
32204
|
});
|
|
29934
32205
|
const requests = new Map();
|
|
@@ -29963,18 +32234,18 @@ const render = async (message)=>{
|
|
|
29963
32234
|
};
|
|
29964
32235
|
try {
|
|
29965
32236
|
const cwd = process.cwd();
|
|
29966
|
-
await (0,
|
|
32237
|
+
await (0,_agent_bundle_runtime__rspack_import_34/* .runAgentRequest */.iC)({
|
|
29967
32238
|
capabilities: {
|
|
29968
|
-
command: (0,
|
|
29969
|
-
filesystem: (0,
|
|
29970
|
-
network: (0,
|
|
29971
|
-
projectRoot: (0,
|
|
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)({
|
|
29972
32243
|
root: cwd
|
|
29973
32244
|
}, 'derived')
|
|
29974
32245
|
},
|
|
29975
|
-
host: (0,
|
|
32246
|
+
host: (0,_agent_bundle_runtime__rspack_import_34/* .unavailable */.hU)('unsupported-surface'),
|
|
29976
32247
|
invocation: message.request,
|
|
29977
|
-
lineage: (0,
|
|
32248
|
+
lineage: (0,_agent_bundle_runtime__rspack_import_34/* .unavailable */.hU)('unsupported-surface'),
|
|
29978
32249
|
plugin: pluginRoot.identity,
|
|
29979
32250
|
progress: {
|
|
29980
32251
|
report: async (update)=>{
|
|
@@ -29987,8 +32258,8 @@ const render = async (message)=>{
|
|
|
29987
32258
|
},
|
|
29988
32259
|
process: processHit,
|
|
29989
32260
|
signal: controller.signal,
|
|
29990
|
-
terminal: message.terminal === undefined ? (0,
|
|
29991
|
-
workspace: (0,
|
|
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)({
|
|
29992
32263
|
root: cwd
|
|
29993
32264
|
}, 'derived')
|
|
29994
32265
|
}, async ()=>{
|
|
@@ -29997,7 +32268,7 @@ const render = async (message)=>{
|
|
|
29997
32268
|
type: 'observed-render-start'
|
|
29998
32269
|
});
|
|
29999
32270
|
const renderStartedAt = performance.now();
|
|
30000
|
-
const flight = (0,
|
|
32271
|
+
const flight = (0,_agent_bundle_runtime_flight_server__rspack_import_35/* .renderAgentFlight */.y)(composeLayouts(observedRoute, {
|
|
30001
32272
|
...message.props,
|
|
30002
32273
|
signal: controller.signal
|
|
30003
32274
|
}, controller.signal), {
|