@covro/covro 0.8.1-dev.5 → 0.8.1-dev.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -9
- package/README.zh-CN.md +9 -9
- package/dist/backups/manager.js +21 -1
- package/dist/backups/manager.js.map +2 -2
- package/dist/cli/backup.js +33 -2
- package/dist/cli/backup.js.map +2 -2
- package/dist/cli/daemon.js +84 -18
- package/dist/cli/daemon.js.map +2 -2
- package/dist/cli/logs.js +141 -0
- package/dist/cli/logs.js.map +7 -0
- package/dist/cli/main.js +33 -10
- package/dist/cli/main.js.map +2 -2
- package/dist/cli/paths.js +9 -1
- package/dist/cli/paths.js.map +2 -2
- package/dist/codex/adapter.js +135 -18
- package/dist/codex/adapter.js.map +3 -3
- package/dist/codex/permissions.js.map +1 -1
- package/dist/codex/thread-titles.js +143 -21
- package/dist/codex/thread-titles.js.map +2 -2
- package/dist/codex/transport.js +32 -2
- package/dist/codex/transport.js.map +2 -2
- package/dist/logging/bootstrap.js +25 -0
- package/dist/logging/bootstrap.js.map +7 -0
- package/dist/logging/config.js +38 -0
- package/dist/logging/config.js.map +7 -0
- package/dist/logging/context.js +11 -0
- package/dist/logging/context.js.map +7 -0
- package/dist/logging/fields.js +82 -0
- package/dist/logging/fields.js.map +7 -0
- package/dist/logging/lifecycle.js +14 -0
- package/dist/logging/lifecycle.js.map +7 -0
- package/dist/logging/logger.js +216 -0
- package/dist/logging/logger.js.map +7 -0
- package/dist/logging/retention.js +62 -0
- package/dist/logging/retention.js.map +7 -0
- package/dist/server/capacity-retry.js +26 -1
- package/dist/server/capacity-retry.js.map +2 -2
- package/dist/server/db/operations.js +69 -13
- package/dist/server/db/operations.js.map +3 -3
- package/dist/server/db/question-tracking.js +29 -3
- package/dist/server/db/question-tracking.js.map +2 -2
- package/dist/server/file-references.js +66 -0
- package/dist/server/file-references.js.map +7 -0
- package/dist/server/http.js +50 -2
- package/dist/server/http.js.map +3 -3
- package/dist/server/main.js +57 -10
- package/dist/server/main.js.map +2 -2
- package/dist/server/mcp/server.js +17 -3
- package/dist/server/mcp/server.js.map +2 -2
- package/dist/server/project-clones.js +19 -1
- package/dist/server/project-clones.js.map +2 -2
- package/dist/server/projects.js +6 -0
- package/dist/server/projects.js.map +2 -2
- package/dist/server/service.js +130 -12
- package/dist/server/service.js.map +2 -2
- package/dist/server/websocket.js +24 -4
- package/dist/server/websocket.js.map +2 -2
- package/dist/shared/file-references.js +17 -0
- package/dist/shared/file-references.js.map +7 -0
- package/dist/shared/validation.js +23 -1
- package/dist/shared/validation.js.map +2 -2
- package/dist/update-worker.cjs +17027 -299
- package/dist/updates/manager.js +32 -5
- package/dist/updates/manager.js.map +2 -2
- package/dist/updates/worker.js +37 -4
- package/dist/updates/worker.js.map +2 -2
- package/dist/web/assets/{abnfDiagram-WEYOIA3C-BO_RQeXN.js → abnfDiagram-WEYOIA3C-C_Sk7t78.js} +1 -1
- package/dist/web/assets/{arc-BrbjGKnJ.js → arc-B7fhzjrW.js} +1 -1
- package/dist/web/assets/{architecture-WOLXFQ4H-CO5JiNWc.js → architecture-WOLXFQ4H-DvtXEB8r.js} +1 -1
- package/dist/web/assets/{architectureDiagram-ZHVYKT53-VZ--7mt8.js → architectureDiagram-ZHVYKT53-qAhYJ66U.js} +1 -1
- package/dist/web/assets/{blockDiagram-RJAE7QA3-CFd3y32z.js → blockDiagram-RJAE7QA3-BMfuVXgv.js} +1 -1
- package/dist/web/assets/{c4Diagram-XDPPPE54-DAavEe0D.js → c4Diagram-XDPPPE54-ChdFg4eh.js} +1 -1
- package/dist/web/assets/channel-C6FErhe0.js +1 -0
- package/dist/web/assets/{chunk-2E7WHVMD-DmIDdy_2.js → chunk-2E7WHVMD-2254qq_b.js} +1 -1
- package/dist/web/assets/{chunk-4EMNKR2T-Co0NPOlt.js → chunk-4EMNKR2T-Btdfe8a5.js} +1 -1
- package/dist/web/assets/{chunk-55XCU76K-Z9vyXWlz.js → chunk-55XCU76K-hLv-2Klf.js} +1 -1
- package/dist/web/assets/{chunk-7S6XSTFO-FtT06ZAY.js → chunk-7S6XSTFO-CuVWLL5t.js} +1 -1
- package/dist/web/assets/{chunk-AQDTSKZB-6ECeFeD7.js → chunk-AQDTSKZB-ClcdhAcX.js} +1 -1
- package/dist/web/assets/{chunk-DSNLSHJZ-BwB4BSUm.js → chunk-DSNLSHJZ-DEnLBCCf.js} +1 -1
- package/dist/web/assets/{chunk-HAGFOTED-DuK_RKqo.js → chunk-HAGFOTED-CRPL1-GG.js} +1 -1
- package/dist/web/assets/{chunk-HNE4Q36P-BGD3LccE.js → chunk-HNE4Q36P-rD1kJp06.js} +1 -1
- package/dist/web/assets/{chunk-NQOKRVIF-d9_InO8B.js → chunk-NQOKRVIF-CyASuGCR.js} +1 -1
- package/dist/web/assets/{chunk-UHW7PFBP-oyw-rnut.js → chunk-UHW7PFBP-4ya9RmmM.js} +1 -1
- package/dist/web/assets/{chunk-VQ5W62QI-CBtXwUMd.js → chunk-VQ5W62QI-CPdxzKpk.js} +1 -1
- package/dist/web/assets/{chunk-WQQL4CDK-C0yGAD8U.js → chunk-WQQL4CDK-BnQt-9E2.js} +1 -1
- package/dist/web/assets/{chunk-XXDRQBXY-CJoPDXBk.js → chunk-XXDRQBXY-DrcyNGDJ.js} +1 -1
- package/dist/web/assets/{chunk-YZO67HFG-ClQ0H3pB.js → chunk-YZO67HFG-CoMbVgDo.js} +1 -1
- package/dist/web/assets/{chunk-ZAUX2LTX-Djwp7USo.js → chunk-ZAUX2LTX-8Cogs47O.js} +1 -1
- package/dist/web/assets/{chunk-ZCHMQSOR-B_XXu_RK.js → chunk-ZCHMQSOR-CL9qHytJ.js} +1 -1
- package/dist/web/assets/{classDiagram-v2-4MYWR3UA-DTykvZXI.js → classDiagram-v2-4MYWR3UA-CczNsQz8.js} +1 -1
- package/dist/web/assets/{cose-bilkent-JH36ORCC-C3noGEk8.js → cose-bilkent-JH36ORCC-DIN3sKoH.js} +1 -1
- package/dist/web/assets/{cynefin-EF2NZ3EQ-Cu3p3KzN.js → cynefin-EF2NZ3EQ-DRzCk374.js} +1 -1
- package/dist/web/assets/{cynefinDiagram-WF24UDRP-CMJtiF5O.js → cynefinDiagram-WF24UDRP-C5a5aAFu.js} +1 -1
- package/dist/web/assets/{dagre-NK4GIZVX-_gQW4c3R.js → dagre-NK4GIZVX-9MUbUNbg.js} +1 -1
- package/dist/web/assets/{diagram-CBK3MWTC-DQMdH7AV.js → diagram-CBK3MWTC-ly2ORVWq.js} +1 -1
- package/dist/web/assets/{diagram-I5XIIV2D-YBBLWFnG.js → diagram-I5XIIV2D-Cwbptpw7.js} +1 -1
- package/dist/web/assets/{diagram-ODIL2UCW-CHXIVRf1.js → diagram-ODIL2UCW-C3s7b-u8.js} +1 -1
- package/dist/web/assets/{diagram-PFBEJUXE-DDrYQuSn.js → diagram-PFBEJUXE-BjlCGRjf.js} +1 -1
- package/dist/web/assets/{diagram-RJA3I4VV-T_QHVlBo.js → diagram-RJA3I4VV-DP1a6Mzo.js} +1 -1
- package/dist/web/assets/{diagram-TYUNFSNR-CrttYzid.js → diagram-TYUNFSNR-DSz6ip6J.js} +1 -1
- package/dist/web/assets/{dist-sxTkLBEW.js → dist-DOLJVqQr.js} +1 -1
- package/dist/web/assets/{ebnfDiagram-V4P3TTPT-D5socIPN.js → ebnfDiagram-V4P3TTPT-C1d9eRxH.js} +1 -1
- package/dist/web/assets/{elk-QONTBCTQ-BnCDU5t4.js → elk-QONTBCTQ-C9g1LS-p.js} +1 -1
- package/dist/web/assets/{erDiagram-KYQIGQAA-BneSJl0f.js → erDiagram-KYQIGQAA-dxkp2bJZ.js} +1 -1
- package/dist/web/assets/{eventmodeling-K75KTNOO-DAa58bfp.js → eventmodeling-K75KTNOO-VwADn86w.js} +1 -1
- package/dist/web/assets/flowDiagram-IUGLLWBU-DyjwVt7W.js +1 -0
- package/dist/web/assets/{ganttDiagram-R7GPNTJY-CbT7Vvh8.js → ganttDiagram-R7GPNTJY-3GbViMJK.js} +1 -1
- package/dist/web/assets/{gitGraph-VSP46ZUC-DImhgnA-.js → gitGraph-VSP46ZUC-GJjAtt_a.js} +1 -1
- package/dist/web/assets/{gitGraphDiagram-PDYL7XHY-BCIhQSnt.js → gitGraphDiagram-PDYL7XHY-zsxQdGsc.js} +1 -1
- package/dist/web/assets/{index-CJhiAWU_.css → index-DsTjqvUr.css} +1 -1
- package/dist/web/assets/index-U534hj4k.js +164 -0
- package/dist/web/assets/{info-OHQRW6UA-Ca1dcpLj.js → info-OHQRW6UA-CwnUsM1e.js} +1 -1
- package/dist/web/assets/{infoDiagram-MVDRKAX5-CZwqwKIn.js → infoDiagram-MVDRKAX5-BxjMvrog.js} +1 -1
- package/dist/web/assets/{ishikawaDiagram-HPEHV2GE-K78USkcr.js → ishikawaDiagram-HPEHV2GE-DFnmkvoA.js} +1 -1
- package/dist/web/assets/{journeyDiagram-BOSHW7O7-CInG1mSi.js → journeyDiagram-BOSHW7O7-C64DJ862.js} +1 -1
- package/dist/web/assets/{kanban-definition-FNSA4HC5-BnUr2xEF.js → kanban-definition-FNSA4HC5-Boh6Iitf.js} +1 -1
- package/dist/web/assets/{line-DzMtguNw.js → line-rdP4ipIJ.js} +1 -1
- package/dist/web/assets/{linear-CNySZw0C.js → linear-DSMIEOwe.js} +1 -1
- package/dist/web/assets/{mermaid-parser.core-BjNrmgSz.js → mermaid-parser.core-CCp9eot8.js} +3 -3
- package/dist/web/assets/{mermaid.core-opaDzh2t.js → mermaid.core-DjIok1BV.js} +4 -4
- package/dist/web/assets/{mindmap-definition-6OY57UG3-BfQCchDX.js → mindmap-definition-6OY57UG3-BzJR8se0.js} +1 -1
- package/dist/web/assets/{packet-JDAUHWVQ-d61w6Aq3.js → packet-JDAUHWVQ-DMmKjELh.js} +1 -1
- package/dist/web/assets/{pegDiagram-ECIUJNBX-C4qbCufd.js → pegDiagram-ECIUJNBX-KC3oILsA.js} +1 -1
- package/dist/web/assets/{pie-XZMESJXO-Bwb-SDtc.js → pie-XZMESJXO-Df--bbSa.js} +1 -1
- package/dist/web/assets/{pieDiagram-GNMPY74T-DGajqL2R.js → pieDiagram-GNMPY74T-BMZfiPGv.js} +1 -1
- package/dist/web/assets/{quadrantDiagram-D57K4MC3-DwCmnGz-.js → quadrantDiagram-D57K4MC3-DXnNWG5F.js} +1 -1
- package/dist/web/assets/{radar-ABXABTNO-CSV3Ys_t.js → radar-ABXABTNO-TzHTEemc.js} +1 -1
- package/dist/web/assets/{railroad-I3PHUGI6-B53NZiRX.js → railroad-I3PHUGI6-C27Kcuho.js} +1 -1
- package/dist/web/assets/{railroad-abnf-LNEFI6M7-AZHHU_Eu.js → railroad-abnf-LNEFI6M7-BKk57xcr.js} +1 -1
- package/dist/web/assets/{railroad-ebnf-DWYD2UWJ-CfHUzG_e.js → railroad-ebnf-DWYD2UWJ-BvaRzQQW.js} +1 -1
- package/dist/web/assets/{railroad-peg-JR7BVNR7-BFMwCv49.js → railroad-peg-JR7BVNR7-CfLsYmww.js} +1 -1
- package/dist/web/assets/{railroadDiagram-Y72NRBL7-JGBjh6gS.js → railroadDiagram-Y72NRBL7-BQ_k45oS.js} +1 -1
- package/dist/web/assets/{requirementDiagram-EQYSW5RA-H89IE7Aj.js → requirementDiagram-EQYSW5RA-CwXsnupD.js} +1 -1
- package/dist/web/assets/{sankeyDiagram-SY24JHO5-BW1h5GMG.js → sankeyDiagram-SY24JHO5-sAHZCcw7.js} +1 -1
- package/dist/web/assets/{sequenceDiagram-BLEHNHQU-DW1LCcm2.js → sequenceDiagram-BLEHNHQU-DZ9UcJYF.js} +1 -1
- package/dist/web/assets/{src-qKGv1ENI.js → src-C0lp0upm.js} +1 -1
- package/dist/web/assets/{stateDiagram-v2-A6IESKWZ-B1LYrPov.js → stateDiagram-v2-A6IESKWZ-kAOy9VMW.js} +1 -1
- package/dist/web/assets/{swimlanes-B3ENRKFQ-DTZ07PM6.js → swimlanes-B3ENRKFQ-Cy-Kpx4-.js} +1 -1
- package/dist/web/assets/swimlanesDiagram-AYQRV4AK-BJTyt_U0.js +8 -0
- package/dist/web/assets/{timeline-definition-JXYKGLGB-BE1obc2i.js → timeline-definition-JXYKGLGB-BTuyBK6b.js} +1 -1
- package/dist/web/assets/{treeView-D4JQ5SDB-B5wK9RCF.js → treeView-D4JQ5SDB-Dbd_GUqT.js} +1 -1
- package/dist/web/assets/{treemap-SAJKECNS-Cfy-_3AL.js → treemap-SAJKECNS-BnoQOlaS.js} +1 -1
- package/dist/web/assets/{usecaseDiagram-WPOLBNNX-xz4Our_C.js → usecaseDiagram-WPOLBNNX-BwtNMDaH.js} +1 -1
- package/dist/web/assets/{vennDiagram-Q3Y3IDCW-DPiMvNxK.js → vennDiagram-Q3Y3IDCW-P8nADf8v.js} +1 -1
- package/dist/web/assets/{wardley-7MLQ67FV-By9tOblG.js → wardley-7MLQ67FV-CR_jX6KD.js} +1 -1
- package/dist/web/assets/{wardleyDiagram-IVAIDKWA-CEXsZftZ.js → wardleyDiagram-IVAIDKWA-BdII6XrZ.js} +1 -1
- package/dist/web/assets/{xychartDiagram-4URNHDU4-CpvteEDM.js → xychartDiagram-4URNHDU4-Cu4707Wp.js} +1 -1
- package/dist/web/index.html +2 -2
- package/package.json +7 -5
- package/dist/web/assets/channel-B6wPa8oJ.js +0 -1
- package/dist/web/assets/flowDiagram-IUGLLWBU-D5Kfq1wD.js +0 -1
- package/dist/web/assets/index-B5qrF3YQ.js +0 -164
- package/dist/web/assets/swimlanesDiagram-AYQRV4AK-CmXIvE2p.js +0 -8
package/dist/codex/adapter.js
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import { questionAnswers } from "../shared/question-resolution.js";
|
|
2
|
+
import { nullLogger } from "../logging/logger.js";
|
|
3
|
+
import { errorFields } from "../logging/fields.js";
|
|
4
|
+
import { logContext, withLogContext } from "../logging/context.js";
|
|
2
5
|
import { CODEX_COMPATIBILITY } from "./compatibility.js";
|
|
3
6
|
import { AccountUsageReader } from "./account-usage.js";
|
|
4
7
|
import { SHELL_TIMEOUT_MS, SHELL_OUTPUT_BYTES } from "../shared/shell.js";
|
|
@@ -47,7 +50,7 @@ import {
|
|
|
47
50
|
} from "./transport.js";
|
|
48
51
|
import { CodexError as CodexError2 } from "./transport.js";
|
|
49
52
|
const VERIFIED_CODEX_VERSION = CODEX_COMPATIBILITY.recommended;
|
|
50
|
-
const LIVE_SETTINGS_CODEX_VERSION = "0.
|
|
53
|
+
const LIVE_SETTINGS_CODEX_VERSION = "0.167.0";
|
|
51
54
|
const CAPABILITIES = [
|
|
52
55
|
"command/exec",
|
|
53
56
|
"command/exec/terminate",
|
|
@@ -73,6 +76,7 @@ const CAPABILITIES = [
|
|
|
73
76
|
"turn/interrupt",
|
|
74
77
|
"model/list",
|
|
75
78
|
"skills/list",
|
|
79
|
+
"fuzzyFileSearch",
|
|
76
80
|
"config/read",
|
|
77
81
|
"config/batchWrite",
|
|
78
82
|
"configRequirements/read",
|
|
@@ -103,6 +107,7 @@ function permissionPathLabel(path) {
|
|
|
103
107
|
class CodexAdapter {
|
|
104
108
|
constructor(options) {
|
|
105
109
|
this.options = options;
|
|
110
|
+
this.logger = (options.logger ?? nullLogger).child({ component: "codex" });
|
|
106
111
|
}
|
|
107
112
|
options;
|
|
108
113
|
accountUsage = new AccountUsageReader({
|
|
@@ -154,6 +159,7 @@ class CodexAdapter {
|
|
|
154
159
|
models: [],
|
|
155
160
|
capabilities: []
|
|
156
161
|
};
|
|
162
|
+
logger;
|
|
157
163
|
get pid() {
|
|
158
164
|
return this.child?.pid;
|
|
159
165
|
}
|
|
@@ -210,6 +216,7 @@ class CodexAdapter {
|
|
|
210
216
|
});
|
|
211
217
|
const version = stdout.trim().replace(/^codex-cli\s+/, "");
|
|
212
218
|
this.state.codexVersion = version;
|
|
219
|
+
this.logger.info("codex.starting", { codexEpoch: this.epoch, codexVersion: version });
|
|
213
220
|
this.permissionState.clear();
|
|
214
221
|
this.liveCapabilities.clear();
|
|
215
222
|
this.denials.clear();
|
|
@@ -225,10 +232,15 @@ class CodexAdapter {
|
|
|
225
232
|
this.child = child;
|
|
226
233
|
const rpc = new RpcTransport(child.stdin, child.stdout, {
|
|
227
234
|
timeoutMs: this.options.requestTimeoutMs,
|
|
228
|
-
maxLineBytes: this.options.maxLineBytes
|
|
235
|
+
maxLineBytes: this.options.maxLineBytes,
|
|
236
|
+
logger: this.logger.child({ codexEpoch: this.epoch, component: "codex.rpc" })
|
|
229
237
|
});
|
|
230
238
|
this.rpc = rpc;
|
|
231
|
-
this.titles = new ThreadTitles(
|
|
239
|
+
this.titles = new ThreadTitles(
|
|
240
|
+
rpc,
|
|
241
|
+
this.options.titleTimeoutMs,
|
|
242
|
+
this.logger.child({ codexEpoch: this.epoch, component: "codex.titles" })
|
|
243
|
+
);
|
|
232
244
|
child.stderr.on("data", (chunk) => {
|
|
233
245
|
const max = this.options.maxStderrBytes ?? 64 * 1024;
|
|
234
246
|
this.stderrTail = Buffer.concat([this.stderrTail, chunk.subarray(-max)]).subarray(-max);
|
|
@@ -238,6 +250,12 @@ class CodexAdapter {
|
|
|
238
250
|
(error) => rpc.fail(new CodexError("CODEX_UNAVAILABLE", `Cannot start Codex: ${error.message}`, true))
|
|
239
251
|
);
|
|
240
252
|
child.on("exit", (code, signal) => {
|
|
253
|
+
this.logger[this.stopped ? "info" : "error"]("codex.exited", {
|
|
254
|
+
codexEpoch: this.epoch,
|
|
255
|
+
exitCode: code,
|
|
256
|
+
signal,
|
|
257
|
+
receivedBytes: this.stderrTail.length
|
|
258
|
+
});
|
|
241
259
|
rpc.fail(
|
|
242
260
|
new CodexError(
|
|
243
261
|
"CODEX_UNAVAILABLE",
|
|
@@ -276,22 +294,24 @@ class CodexAdapter {
|
|
|
276
294
|
kill.unref();
|
|
277
295
|
child.once("exit", () => clearTimeout(kill));
|
|
278
296
|
if (wasReady && !this.stopped) {
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
...error
|
|
297
|
+
this.logger.error("codex.connection_failed", {
|
|
298
|
+
codexEpoch: this.epoch,
|
|
299
|
+
...errorFields(error)
|
|
282
300
|
});
|
|
283
301
|
this.scheduleRestart();
|
|
284
302
|
}
|
|
285
303
|
});
|
|
304
|
+
const capabilities = {
|
|
305
|
+
experimentalApi: true,
|
|
306
|
+
requiredHumanApproval: true,
|
|
307
|
+
requestAttestation: false,
|
|
308
|
+
explicitGatewayOauth: true
|
|
309
|
+
};
|
|
286
310
|
const initialized = await this.call(
|
|
287
311
|
"initialize",
|
|
288
312
|
{
|
|
289
313
|
clientInfo: { name: "codex_web_ui", title: "Codex Web UI", version: "0.1.0" },
|
|
290
|
-
capabilities
|
|
291
|
-
experimentalApi: true,
|
|
292
|
-
requestAttestation: false,
|
|
293
|
-
explicitGatewayOauth: true
|
|
294
|
-
}
|
|
314
|
+
capabilities
|
|
295
315
|
},
|
|
296
316
|
true
|
|
297
317
|
);
|
|
@@ -348,11 +368,16 @@ class CodexAdapter {
|
|
|
348
368
|
);
|
|
349
369
|
this.state.ready = true;
|
|
350
370
|
this.state.connection = "ready";
|
|
371
|
+
this.logger.info("codex.ready", {
|
|
372
|
+
codexEpoch: this.epoch,
|
|
373
|
+
codexVersion: this.state.codexVersion
|
|
374
|
+
});
|
|
351
375
|
this.state.capabilities = CAPABILITIES.filter((method) => !this.disabled.has(method));
|
|
352
376
|
this.publishRuntime();
|
|
353
377
|
void this.refreshAccountUsage();
|
|
354
378
|
} catch (error) {
|
|
355
379
|
const failure = asCodexError(error);
|
|
380
|
+
this.logger.error("codex.start_failed", { codexEpoch: this.epoch, ...errorFields(failure) });
|
|
356
381
|
this.state.ready = false;
|
|
357
382
|
this.state.connection = "unavailable";
|
|
358
383
|
this.state.error = failure.message;
|
|
@@ -456,6 +481,7 @@ class CodexAdapter {
|
|
|
456
481
|
cursor,
|
|
457
482
|
limit: 30,
|
|
458
483
|
archived,
|
|
484
|
+
modelProviders: [],
|
|
459
485
|
sourceKinds: ["cli", "appServer", "vscode"],
|
|
460
486
|
sortKey: "updated_at",
|
|
461
487
|
sortDirection: "desc"
|
|
@@ -488,6 +514,7 @@ class CodexAdapter {
|
|
|
488
514
|
const page = await this.call("thread/list", {
|
|
489
515
|
archived: true,
|
|
490
516
|
cwd: thread.cwd,
|
|
517
|
+
modelProviders: [],
|
|
491
518
|
cursor,
|
|
492
519
|
limit: 100,
|
|
493
520
|
sourceKinds: [
|
|
@@ -905,6 +932,59 @@ class CodexAdapter {
|
|
|
905
932
|
);
|
|
906
933
|
}
|
|
907
934
|
}
|
|
935
|
+
fileSearches = 0;
|
|
936
|
+
async searchFiles(cwd, query, signal) {
|
|
937
|
+
signal.throwIfAborted();
|
|
938
|
+
if (this.fileSearches >= 4)
|
|
939
|
+
throw new AppError("FILE_SEARCH_BUSY", "File search is busy; retry shortly", 429);
|
|
940
|
+
const cancellationToken = crypto.randomUUID();
|
|
941
|
+
const epoch = this.epoch;
|
|
942
|
+
const { requestId, operationId, threadId, sourceThreadId, turnId } = logContext();
|
|
943
|
+
const context = {
|
|
944
|
+
requestId,
|
|
945
|
+
operationId,
|
|
946
|
+
threadId,
|
|
947
|
+
sourceThreadId,
|
|
948
|
+
turnId,
|
|
949
|
+
jobId: cancellationToken,
|
|
950
|
+
codexEpoch: epoch
|
|
951
|
+
};
|
|
952
|
+
const logger = this.logger.child({ ...context, component: "file_search" });
|
|
953
|
+
const started = performance.now();
|
|
954
|
+
this.fileSearches++;
|
|
955
|
+
const pending = withLogContext(
|
|
956
|
+
context,
|
|
957
|
+
() => this.call("fuzzyFileSearch", { query, roots: [cwd], cancellationToken }, false, 6500)
|
|
958
|
+
).finally(() => {
|
|
959
|
+
this.fileSearches--;
|
|
960
|
+
});
|
|
961
|
+
let abort = () => {
|
|
962
|
+
};
|
|
963
|
+
const cancelled = new Promise((_, reject) => {
|
|
964
|
+
abort = () => withLogContext(context, () => {
|
|
965
|
+
if (this.ready && this.epoch === epoch)
|
|
966
|
+
void this.call(
|
|
967
|
+
"fuzzyFileSearch",
|
|
968
|
+
{ query: "", roots: [], cancellationToken },
|
|
969
|
+
false,
|
|
970
|
+
1500
|
|
971
|
+
).catch(() => {
|
|
972
|
+
});
|
|
973
|
+
logger.debug("file_search.cancelled", {
|
|
974
|
+
reason: signal.reason instanceof DOMException && signal.reason.name === "TimeoutError" ? "timeout" : "aborted",
|
|
975
|
+
durationMs: Math.round(performance.now() - started)
|
|
976
|
+
});
|
|
977
|
+
reject(signal.reason);
|
|
978
|
+
});
|
|
979
|
+
signal.addEventListener("abort", abort, { once: true });
|
|
980
|
+
if (signal.aborted) abort();
|
|
981
|
+
});
|
|
982
|
+
try {
|
|
983
|
+
return await Promise.race([pending, cancelled]);
|
|
984
|
+
} finally {
|
|
985
|
+
signal.removeEventListener("abort", abort);
|
|
986
|
+
}
|
|
987
|
+
}
|
|
908
988
|
async listSkills(cwd, forceReload = false) {
|
|
909
989
|
const result = await this.call("skills/list", { cwds: [cwd], forceReload });
|
|
910
990
|
const entries = result.data.filter((entry) => entry.cwd === cwd);
|
|
@@ -919,6 +999,7 @@ class CodexAdapter {
|
|
|
919
999
|
async startTurn(id, cwd, text, settings, images, skills, clientUserMessageId) {
|
|
920
1000
|
this.validateSettings(settings, this.permissionState.get(id));
|
|
921
1001
|
await this.validatePermissionSettings(cwd, settings, id);
|
|
1002
|
+
this.titles?.trackUserInput(id);
|
|
922
1003
|
const turn = mapTurn(
|
|
923
1004
|
id,
|
|
924
1005
|
(await this.call("turn/start", {
|
|
@@ -1165,6 +1246,15 @@ class CodexAdapter {
|
|
|
1165
1246
|
...totalTokens !== void 0 ? { totalTokens } : {}
|
|
1166
1247
|
}
|
|
1167
1248
|
});
|
|
1249
|
+
this.logger.info(event.method === "turn/completed" ? "turn.completed" : "turn.started", {
|
|
1250
|
+
threadId,
|
|
1251
|
+
turnId: turn.id,
|
|
1252
|
+
codexEpoch: this.epoch,
|
|
1253
|
+
outcome: turn.status,
|
|
1254
|
+
...turn.error ? {
|
|
1255
|
+
errorCode: turn.error.codexErrorInfo && typeof turn.error.codexErrorInfo === "string" ? turn.error.codexErrorInfo : "TURN_FAILED"
|
|
1256
|
+
} : {}
|
|
1257
|
+
});
|
|
1168
1258
|
if (event.method === "turn/completed")
|
|
1169
1259
|
this.expireActions(event.params.threadId, event.params.turn.id);
|
|
1170
1260
|
break;
|
|
@@ -1267,6 +1357,8 @@ class CodexAdapter {
|
|
|
1267
1357
|
case "serverRequest/resolved": {
|
|
1268
1358
|
const actionId = this.actionIds.get(event.params.requestId);
|
|
1269
1359
|
if (actionId) {
|
|
1360
|
+
const action = this.actions.get(actionId)?.action;
|
|
1361
|
+
if (action) this.actionLogger(action).info("action.resolved");
|
|
1270
1362
|
this.emit({ type: "actionResolved", actionId });
|
|
1271
1363
|
this.actions.delete(actionId);
|
|
1272
1364
|
this.actionIds.delete(event.params.requestId);
|
|
@@ -1288,6 +1380,12 @@ class CodexAdapter {
|
|
|
1288
1380
|
}
|
|
1289
1381
|
}
|
|
1290
1382
|
async serverRequest(message) {
|
|
1383
|
+
const existingId = this.actionIds.get(message.id);
|
|
1384
|
+
if (existingId) {
|
|
1385
|
+
const action2 = this.actions.get(existingId)?.action;
|
|
1386
|
+
if (action2) this.actionLogger(action2).debug("action.replayed", { replayed: true });
|
|
1387
|
+
return;
|
|
1388
|
+
}
|
|
1291
1389
|
if (isRecord(message.params) && this.titles?.isInternal(message.params.threadId)) {
|
|
1292
1390
|
await this.rpc?.reject(
|
|
1293
1391
|
message.id,
|
|
@@ -1311,18 +1409,21 @@ class CodexAdapter {
|
|
|
1311
1409
|
};
|
|
1312
1410
|
const decisions = /* @__PURE__ */ new Map();
|
|
1313
1411
|
if (request.method === "item/commandExecution/requestApproval" || request.method === "item/fileChange/requestApproval") {
|
|
1412
|
+
const humanCommand = request.method === "item/commandExecution/requestApproval" && params.kind === "humanCommand";
|
|
1314
1413
|
for (const [id, label] of [
|
|
1315
1414
|
["accept", "\u5141\u8BB8\u672C\u6B21"],
|
|
1316
1415
|
["acceptForSession", "\u672C\u4F1A\u8BDD\u5141\u8BB8"],
|
|
1317
1416
|
["decline", "\u62D2\u7EDD"],
|
|
1318
1417
|
["cancel", "\u53D6\u6D88\u5F53\u524D\u4EFB\u52A1"]
|
|
1319
1418
|
]) {
|
|
1419
|
+
if (humanCommand && id === "acceptForSession") continue;
|
|
1320
1420
|
action.options.push({ id, label });
|
|
1321
1421
|
decisions.set(id, id);
|
|
1322
1422
|
}
|
|
1323
1423
|
action.reason = request.params.reason ?? void 0;
|
|
1324
1424
|
if (request.method === "item/commandExecution/requestApproval") {
|
|
1325
1425
|
const p = request.params;
|
|
1426
|
+
if (humanCommand) action.requiresHumanApproval = true;
|
|
1326
1427
|
action.kind = p.networkApprovalContext ? "network" : "command";
|
|
1327
1428
|
action.title = p.networkApprovalContext ? `\u7F51\u7EDC\u6743\u9650\uFF1A${p.networkApprovalContext.protocol}://${p.networkApprovalContext.host}` : "\u547D\u4EE4\u5BA1\u6279";
|
|
1328
1429
|
action.command = p.command ?? void 0;
|
|
@@ -1332,7 +1433,7 @@ class CodexAdapter {
|
|
|
1332
1433
|
network: p.networkApprovalContext,
|
|
1333
1434
|
commandActions: p.commandActions
|
|
1334
1435
|
};
|
|
1335
|
-
if (p.proposedExecpolicyAmendment) {
|
|
1436
|
+
if (!humanCommand && p.proposedExecpolicyAmendment) {
|
|
1336
1437
|
action.options.push({
|
|
1337
1438
|
id: "acceptWithRule",
|
|
1338
1439
|
label: `\u5141\u8BB8\u5E76\u8BB0\u4F4F\u547D\u4EE4\u89C4\u5219\uFF1A${p.proposedExecpolicyAmendment.join(" ")}`
|
|
@@ -1341,13 +1442,14 @@ class CodexAdapter {
|
|
|
1341
1442
|
acceptWithExecpolicyAmendment: { execpolicy_amendment: p.proposedExecpolicyAmendment }
|
|
1342
1443
|
});
|
|
1343
1444
|
}
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1445
|
+
if (!humanCommand)
|
|
1446
|
+
p.proposedNetworkPolicyAmendments?.forEach((amendment, index) => {
|
|
1447
|
+
const id = `networkRule:${index}`;
|
|
1448
|
+
action.options.push({ id, label: `\u5E94\u7528\u7F51\u7EDC\u89C4\u5219\uFF1A${JSON.stringify(amendment)}` });
|
|
1449
|
+
decisions.set(id, {
|
|
1450
|
+
applyNetworkPolicyAmendment: { network_policy_amendment: amendment }
|
|
1451
|
+
});
|
|
1349
1452
|
});
|
|
1350
|
-
});
|
|
1351
1453
|
} else {
|
|
1352
1454
|
action.kind = "file";
|
|
1353
1455
|
action.title = "\u6587\u4EF6\u53D8\u66F4\u5BA1\u6279";
|
|
@@ -1424,6 +1526,7 @@ class CodexAdapter {
|
|
|
1424
1526
|
}
|
|
1425
1527
|
this.actions.set(action.actionId, { action, request, decisions, responding: false });
|
|
1426
1528
|
this.actionIds.set(message.id, action.actionId);
|
|
1529
|
+
this.actionLogger(action).info("action.requested");
|
|
1427
1530
|
this.emit({ type: "action", action: structuredClone(action) });
|
|
1428
1531
|
}
|
|
1429
1532
|
async respond(actionId, resolution) {
|
|
@@ -1462,15 +1565,29 @@ class CodexAdapter {
|
|
|
1462
1565
|
context.responding = true;
|
|
1463
1566
|
try {
|
|
1464
1567
|
await this.rpc.respond(context.action.rpcId, response);
|
|
1568
|
+
this.actionLogger(context.action).info("action.reply_sent");
|
|
1465
1569
|
} catch (error) {
|
|
1570
|
+
this.actionLogger(context.action).warn("action.reply_failed", errorFields(error));
|
|
1466
1571
|
if (error instanceof CodexError && !error.uncertain) context.responding = false;
|
|
1467
1572
|
throw error;
|
|
1468
1573
|
}
|
|
1469
1574
|
}
|
|
1575
|
+
actionLogger(action) {
|
|
1576
|
+
return this.logger.child({
|
|
1577
|
+
actionId: action.actionId,
|
|
1578
|
+
rpcId: action.rpcId,
|
|
1579
|
+
codexEpoch: action.codexEpoch,
|
|
1580
|
+
threadId: action.threadId,
|
|
1581
|
+
turnId: action.turnId,
|
|
1582
|
+
kind: action.kind,
|
|
1583
|
+
reason: action.requiresHumanApproval ? "human_command" : void 0
|
|
1584
|
+
});
|
|
1585
|
+
}
|
|
1470
1586
|
expireActions(threadId, turnId) {
|
|
1471
1587
|
for (const [id, context] of this.actions) {
|
|
1472
1588
|
if (threadId && context.action.threadId !== threadId) continue;
|
|
1473
1589
|
if (turnId && context.action.turnId !== turnId) continue;
|
|
1590
|
+
this.actionLogger(context.action).info("action.expired");
|
|
1474
1591
|
this.emit({ type: "action", action: { ...context.action, status: "expired" } });
|
|
1475
1592
|
this.actions.delete(id);
|
|
1476
1593
|
this.actionIds.delete(context.action.rpcId);
|