@openclaw/codex 2026.9.6 → 2026.9.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.
Files changed (158) hide show
  1. package/README.md +2 -0
  2. package/assets/icon.png +0 -0
  3. package/dist/.setup/{account-usage-runtime-Eem_WGqY.mjs → account-usage-runtime-DFhbh1zz.mjs} +5 -5
  4. package/dist/.setup/{apply-DDOi8uNx.mjs → apply-D3GcSoSa.mjs} +22 -36
  5. package/dist/.setup/{attempt-client-cleanup-CEv1cKwF.mjs → attempt-client-cleanup-DOP-cW5j.mjs} +128 -37
  6. package/dist/.setup/attempt-workspace-context-C5HigshI.mjs +164 -0
  7. package/dist/.setup/{auth-binding-DhLWa_7K.mjs → auth-binding-BLWz7stm.mjs} +14 -1
  8. package/dist/.setup/{auth-cache-key-B2mpaI9D.mjs → auth-cache-key-Dbvq-QgB.mjs} +36 -34
  9. package/dist/.setup/{auth-profile-WqZtZfXN.mjs → auth-profile-B0okYl2D.mjs} +1 -2
  10. package/dist/.setup/auth-start-options-BPIPeEX8.mjs +44 -0
  11. package/dist/.setup/{binding-connection-ThoatDcb.mjs → binding-connection-DTtN1KrX.mjs} +2 -2
  12. package/dist/.setup/{binding-connection.runtime-yoHrABt-.mjs → binding-connection.runtime-6TpgD1M6.mjs} +4 -4
  13. package/dist/.setup/{bounded-turn-B2HScEgT.mjs → bounded-turn-CbjoN2OW.mjs} +15 -18
  14. package/dist/.setup/bounded-turn-isolation-B8K_ylqk.mjs +14 -0
  15. package/dist/.setup/{build-state-C7EnDVgr.mjs → build-state-Da1_z0kd.mjs} +1 -1
  16. package/dist/.setup/{capabilities-CDXOOFdZ.mjs → capabilities-B3WEZl4e.mjs} +2 -10
  17. package/dist/.setup/{client-Cs08OXVQ.mjs → client-N0JpgSzF.mjs} +138 -399
  18. package/dist/.setup/{client-catalog-response-BMgt_4q4.mjs → client-catalog-response-5HHLdcde.mjs} +1 -1
  19. package/dist/.setup/{command-dispatch-B4JuOsOk.mjs → command-dispatch-BeAoaovI.mjs} +5 -8
  20. package/dist/.setup/{command-formatters-Bmqvr9tO.mjs → command-formatters-R3ckE3Co.mjs} +29 -61
  21. package/dist/.setup/{command-handlers-DW7Lx9oH.mjs → command-handlers-ylTMS00z.mjs} +222 -343
  22. package/dist/.setup/{command-rpc-DixIj3HW.mjs → command-rpc-CGJGUQ6Y.mjs} +15 -18
  23. package/dist/.setup/compact-C2WamavS.mjs +776 -0
  24. package/dist/.setup/{config-BoTP_mrL.mjs → config-DKhXquav.mjs} +26 -28
  25. package/dist/.setup/{config-options-BvaRs51b.mjs → config-options-CzyWLTJt.mjs} +24 -37
  26. package/dist/.setup/{config-parsing-CcB9iPoq.mjs → config-parsing-b088LyhT.mjs} +57 -60
  27. package/dist/.setup/{config-runtime-C8Rw1m1m.mjs → config-runtime-C0NbLms1.mjs} +2 -2
  28. package/dist/.setup/{config-security-BEReZ6go.mjs → config-security-CE-FcGw9.mjs} +32 -111
  29. package/dist/.setup/{config-utils-DujwEnhg.mjs → config-utils-D0CXecki.mjs} +3 -13
  30. package/dist/.setup/context-engine-projection-PezSESth.mjs +387 -0
  31. package/dist/.setup/{conversation-binding-DP-gMrBP.mjs → conversation-binding-3Min8qvP.mjs} +67 -90
  32. package/dist/.setup/{conversation-binding-data-CrcyZk6O.mjs → conversation-binding-data-C746z5Pn.mjs} +8 -12
  33. package/dist/.setup/{conversation-control-uK9Jomlc.mjs → conversation-control-CEP8X5JC.mjs} +8 -8
  34. package/dist/.setup/{cyber-failover-DYwbmf1o.mjs → cyber-failover-XV0nNRZu.mjs} +1 -1
  35. package/dist/.setup/{cyber-failover-notice-e9G3J9-e.mjs → cyber-failover-notice-RNpGpTyP.mjs} +1 -1
  36. package/dist/.setup/{dynamic-tools-BDXl-8Cw.mjs → dynamic-tools-DzlsLUuS.mjs} +2305 -2606
  37. package/dist/.setup/{effective-mcp-catalog-CvnvnGIe.mjs → effective-mcp-catalog-CxUtC-xG.mjs} +8 -17
  38. package/dist/.setup/{ephemeral-turn-poidXgek.mjs → ephemeral-turn-CDsPJOa2.mjs} +3 -3
  39. package/dist/.setup/event-projector-assistant-message-CigreO4K.mjs +69 -0
  40. package/dist/.setup/{event-projector-usage-CnBS8Wa3.mjs → event-projector-usage-03R0I2dM.mjs} +3 -25
  41. package/dist/.setup/event-projector-values-DJSz8BTk.mjs +106 -0
  42. package/dist/.setup/incognito-session-DWYapfwf.mjs +2 -0
  43. package/dist/.setup/{inference-context-D96l9-ew.mjs → inference-context-D-9gWlTR.mjs} +16 -18
  44. package/dist/.setup/inference-dispatch-CMZtjQyz.mjs +359 -0
  45. package/dist/.setup/inference-metadata-CgIf7sOx.mjs +81 -0
  46. package/dist/.setup/{inference-proxy-b-aJMSxm.mjs → inference-proxy-DhcXOgUE.mjs} +174 -214
  47. package/dist/.setup/{isolated-completion-BIZFhTNG.mjs → isolated-completion-Dm3PzxJk.mjs} +9 -12
  48. package/dist/.setup/{managed-binary-BnshlFag.mjs → managed-binary-kiWRhNRE.mjs} +8 -12
  49. package/dist/.setup/{model-catalog-CfXJf9Ay.mjs → model-catalog-PAuZgJC6.mjs} +11 -10
  50. package/dist/.setup/model-runtime-BdqzOMkU.mjs +11 -0
  51. package/dist/.setup/{models-KnqBv0hE.mjs → models-DHXZtVVk.mjs} +9 -18
  52. package/dist/.setup/{native-auth-rWbGbMn3.mjs → native-auth-CuG53tu4.mjs} +4 -4
  53. package/dist/.setup/{native-execution-policy-umd0tgh4.mjs → native-execution-policy-BxZJy5mP.mjs} +5 -30
  54. package/dist/.setup/{native-subagent-monitor-D3filLY2.mjs → native-subagent-monitor-Dpsmf2wz.mjs} +4395 -3609
  55. package/dist/.setup/native-subagent-pending-assignments-DwkCzLvD.mjs +203 -0
  56. package/dist/.setup/native-task-assignments-DMQ0g3hu.mjs +194 -0
  57. package/dist/.setup/{node-cli-sessions-r3avj02l.mjs → node-cli-sessions-HC4W6FLI.mjs} +19 -49
  58. package/dist/.setup/{node-exec-server.runtime-BDwWXVpK.mjs → node-exec-server.runtime-BgBfWQqo.mjs} +3 -6
  59. package/dist/.setup/{plan-CN3VwfNU.mjs → plan-Y-QIvrKB.mjs} +49 -92
  60. package/dist/.setup/{plugin-activation-DT3MNtqj.mjs → plugin-activation-cNHRfaxU.mjs} +8 -36
  61. package/dist/.setup/{plugin-app-cache-key-B2CsSdnV.mjs → plugin-app-cache-key-BL9B5H0L.mjs} +6 -23
  62. package/dist/.setup/{plugin-inventory-BoRei8Z4.mjs → plugin-inventory-Cky2XJUw.mjs} +21 -21
  63. package/dist/.setup/{plugin-marketplace-discovery-CDOi8IFs.mjs → plugin-marketplace-discovery-D_dV9FXa.mjs} +18 -24
  64. package/dist/.setup/{plugin-metadata-cache-Ctmo83k_.mjs → plugin-metadata-cache-DsjsL1dr.mjs} +115 -175
  65. package/dist/.setup/{provider-BOsxQHOM.mjs → provider-DH8NSzGt.mjs} +11 -14
  66. package/dist/.setup/{provider-capabilities-BfE88FZ5.mjs → provider-capabilities-CAxoF-X1.mjs} +13 -18
  67. package/dist/.setup/{rate-limits-CMU3DUD0.mjs → rate-limits-B7-X2TgG.mjs} +9 -31
  68. package/dist/.setup/{request-D2L0zMrq.mjs → request-BHZ1nz8d.mjs} +7 -6
  69. package/dist/.setup/responses-oauth-twnuTaAa.mjs +93 -0
  70. package/dist/.setup/rpc-error-BlD2vuzn.mjs +31 -0
  71. package/dist/.setup/{run-attempt-BHu11r7h.mjs → run-attempt-D8RZUOzY.mjs} +1035 -1023
  72. package/dist/.setup/{run-attempt-lifecycle-B7JbY4-F.mjs → run-attempt-lifecycle-C-6O3Exn.mjs} +10 -24
  73. package/dist/.setup/{runtime-artifact-CLZ8udh-.mjs → runtime-artifact-DDQ-HGXf.mjs} +16 -4
  74. package/dist/.setup/runtime-artifact-connection-D68qQn1m.mjs +78 -0
  75. package/dist/.setup/sandbox-guard-DjCz2eOw.mjs +126 -0
  76. package/dist/.setup/scope-DOC1Xjc8.mjs +6 -0
  77. package/dist/.setup/session-binding-DGCYAfvD.mjs +443 -0
  78. package/dist/.setup/{session-binding-record-BGoz8wOK.mjs → session-binding-record-Oe9L-CNY.mjs} +52 -130
  79. package/dist/.setup/{session-binding-sidecars-BlB5EvIS.mjs → session-binding-sidecars-jo6H8dFr.mjs} +196 -17
  80. package/dist/.setup/{session-catalog-Pno1xGcl.mjs → session-catalog-4sCdv5qx.mjs} +170 -324
  81. package/dist/.setup/{session-catalog-adoption-BI6UTDZT.mjs → session-catalog-adoption-BU_pHWG7.mjs} +7 -6
  82. package/dist/.setup/{session-catalog-archive-lHBqzhaO.mjs → session-catalog-archive-spHfihri.mjs} +6 -6
  83. package/dist/.setup/session-catalog-events-DePDzzjc.mjs +139 -0
  84. package/dist/.setup/session-catalog-home-id-vlih0B_g.mjs +22 -0
  85. package/dist/.setup/{session-catalog-index-B9_VQIUz.mjs → session-catalog-index-CZvDzC6z.mjs} +126 -122
  86. package/dist/.setup/{session-catalog-index-order-hcdz07yN.mjs → session-catalog-index-order-BcQpHks3.mjs} +1 -1
  87. package/dist/.setup/{session-catalog-index-state-Dgh8ORJm.mjs → session-catalog-index-state-TeO7EyO-.mjs} +3 -2
  88. package/dist/.setup/session-catalog-limits-DDxOsQeC.mjs +14 -0
  89. package/dist/.setup/session-catalog-list-request-CvtxrYSe.mjs +170 -0
  90. package/dist/.setup/session-catalog-native-projection-DjhwGL6x.mjs +178 -0
  91. package/dist/.setup/{session-catalog-node-adoption-ITddWx_X.mjs → session-catalog-node-adoption-DgXvSGu0.mjs} +10 -27
  92. package/dist/.setup/{session-catalog-node-continue-6g6qi4A9.mjs → session-catalog-node-continue-DjKXHBbi.mjs} +8 -10
  93. package/dist/.setup/session-catalog-node-lookup-CtAXI5W5.mjs +56 -0
  94. package/dist/.setup/{session-catalog-native-projection-DowriLid.mjs → session-catalog-parsing-CPGaPYr-.mjs} +11 -194
  95. package/dist/.setup/{session-catalog-projection-zK_PUsiE.mjs → session-catalog-projection-Cr5qP5Dj.mjs} +6 -4
  96. package/dist/.setup/session-catalog-provenance-DoAvktcj.mjs +95 -0
  97. package/dist/.setup/{session-cli-irrD-uo7.mjs → session-cli-Cn_nCqfq.mjs} +9 -22
  98. package/dist/.setup/{session-history-BrqhSCf9.mjs → session-history-D83lJWHG.mjs} +4 -6
  99. package/dist/.setup/{session-history-import-D-3wAgOP.mjs → session-history-import-WhX-X33a.mjs} +7 -10
  100. package/dist/.setup/session-history-read-Ov3StuL4.mjs +133 -0
  101. package/dist/.setup/{session-history.worker-CaCh0xF_.mjs → session-history.worker-MnPKncqP.mjs} +9 -5
  102. package/dist/.setup/session-initialization-6aveB9qb.mjs +22 -0
  103. package/dist/.setup/{session-permission-policy-BI1QK_98.mjs → session-permission-policy-Ci_fVX6y.mjs} +4 -8
  104. package/dist/.setup/{session-retirement-BH-S6qkJ.mjs → session-retirement-qMTxkNx2.mjs} +17 -17
  105. package/dist/.setup/{settled-turn-context-fmwouT5I.mjs → settled-turn-context-D4yj4rxf.mjs} +1 -1
  106. package/dist/.setup/{settled-turn-finalizer-DiAi6Kx6.mjs → settled-turn-finalizer-BsvEabkw.mjs} +14 -10
  107. package/dist/.setup/{shared-client-DA4VR4Eb.mjs → shared-client-DqyTMYug.mjs} +783 -412
  108. package/dist/.setup/shared-client-lifecycle-DJIgqgMw.mjs +153 -0
  109. package/dist/.setup/{side-question-BJ1wSDcB.mjs → side-question-C4kCmQy1.mjs} +79 -143
  110. package/dist/.setup/{source-CUzJq5WN.mjs → source-CS_7GFJZ.mjs} +80 -137
  111. package/dist/.setup/{thread-lifecycle-B3mfz1TG.mjs → thread-lifecycle-DPflntEJ.mjs} +294 -737
  112. package/dist/.setup/{incognito-session-uhrBF6wJ.mjs → thread-ownership-queue-Dp24d7-F.mjs} +1 -2
  113. package/dist/.setup/{thread-ownership-DcTtAcXj.mjs → thread-ownership-roNP0l1c.mjs} +45 -10
  114. package/dist/.setup/{thread-policy-DGuQsuFC.mjs → thread-policy-DTd-DtkX.mjs} +46 -7
  115. package/dist/.setup/{thread-requests-BLvGkP2R.mjs → thread-requests-B_bRnMGN.mjs} +199 -302
  116. package/dist/.setup/{thread-resume-DIBXwOpE.mjs → thread-resume-CdDaoc7T.mjs} +6 -6
  117. package/dist/.setup/{timeout-C910MdAB.mjs → timeout-CXOfNoaX.mjs} +1 -35
  118. package/dist/.setup/{transcript-history-projection-ZZpkFkJ_.mjs → transcript-history-projection-DRSifI-1.mjs} +17 -89
  119. package/dist/.setup/{transcript-mirror-attestation-CzM-94NC.mjs → transcript-mirror-attestation-YSegaktH.mjs} +3 -4
  120. package/dist/.setup/{transcript-mirror-BtHDBp1G.mjs → transcript-mirror-kxmCYsuF.mjs} +7 -9
  121. package/dist/.setup/{transport-stdio-h2VHOskC.mjs → transport-stdio-Bdegpn2V.mjs} +5 -22
  122. package/dist/.setup/transport-websocket-BTBE-LD9.mjs +211 -0
  123. package/dist/.setup/{upstream-prompt-provenance-LphB8slG.mjs → upstream-prompt-provenance-fXkKbPVC.mjs} +3 -9
  124. package/dist/.setup/{upstream-session-fork-BUr4OUbC.mjs → upstream-session-fork-CBeVjBpT.mjs} +23 -23
  125. package/dist/.setup/{usage-BML0r-ua.mjs → usage-BMzNxeR_.mjs} +4 -4
  126. package/dist/.setup/{usage-limit-error-DUMbefVY.mjs → usage-limit-error-QXerDo3i.mjs} +4 -19
  127. package/dist/.setup/{web-search-provider.runtime-CDKlN-Rv.mjs → web-search-provider.runtime-P77OUeoo.mjs} +8 -19
  128. package/dist/api.js +9 -11
  129. package/dist/catalog-page.worker.js +1 -1
  130. package/dist/cli-metadata.js +1 -1
  131. package/dist/doctor-contract-api.js +50 -8
  132. package/dist/harness.js +344 -1
  133. package/dist/index.js +193 -245
  134. package/dist/media-understanding-provider.js +9 -22
  135. package/dist/migration-provider-api.js +1 -1
  136. package/dist/provider-discovery.js +1 -1
  137. package/dist/session-history-worker-runtime.js +3 -3
  138. package/dist/session-history.worker.js +1 -1
  139. package/openclaw.plugin.json +14 -2
  140. package/package.json +7 -6
  141. package/dist/.setup/attempt-workspace-context-DUVEn_CS.mjs +0 -331
  142. package/dist/.setup/compact-Du5UvtxA.mjs +0 -680
  143. package/dist/.setup/event-projector-assistant-message-BsruvNrH.mjs +0 -103
  144. package/dist/.setup/event-projector-items-C6L_5ZiT.mjs +0 -234
  145. package/dist/.setup/harness-a_MsE4-_.mjs +0 -355
  146. package/dist/.setup/history-rejection-B4nOXNXF.mjs +0 -13
  147. package/dist/.setup/image-payload-sanitizer-tupAr-2o.mjs +0 -79
  148. package/dist/.setup/local-runtime-attribution-B_2mnqhb.mjs +0 -19
  149. package/dist/.setup/native-subagent-history-0nYYgo0k.mjs +0 -148
  150. package/dist/.setup/native-subagent-task-ids-wb8CKZGN.mjs +0 -441
  151. package/dist/.setup/plugin-approval-roundtrip-C0MZzCuP.mjs +0 -122
  152. package/dist/.setup/rolldown-runtime-8H4AJuhK.mjs +0 -14
  153. package/dist/.setup/sandbox-guard-C2sRMOEY.mjs +0 -166
  154. package/dist/.setup/session-binding-Cm0apEbd.mjs +0 -692
  155. package/dist/.setup/session-catalog-events-Bj6j94E_.mjs +0 -347
  156. package/dist/.setup/session-history-read-B3ZfSUbF.mjs +0 -50
  157. package/dist/.setup/session-initialization-rcgbZiid.mjs +0 -75
  158. package/dist/.setup/thread-history-page-DoVpnHim.mjs +0 -83
@@ -1,103 +0,0 @@
1
- import { g as codexProviderRefusalDetails } from "./event-projector-items-C6L_5ZiT.mjs";
2
- import { t as resolveCodexLocalRuntimeAttribution } from "./local-runtime-attribution-B_2mnqhb.mjs";
3
- import { formatErrorMessage } from "openclaw/plugin-sdk/agent-harness-runtime";
4
- //#region extensions/codex/src/app-server/event-projector-assistant-message.ts
5
- const ZERO_USAGE = {
6
- input: 0,
7
- output: 0,
8
- cacheRead: 0,
9
- cacheWrite: 0,
10
- totalTokens: 0,
11
- cost: {
12
- input: 0,
13
- output: 0,
14
- cacheRead: 0,
15
- cacheWrite: 0,
16
- total: 0
17
- }
18
- };
19
- function createAssistantMessage(params, text, options) {
20
- return createAttributedCodexAssistantMessage({
21
- ...resolveCodexLocalRuntimeAttribution(params),
22
- modelId: params.modelId
23
- }, text, options);
24
- }
25
- /** Creates a Codex assistant row when a bounded call already owns attribution. */
26
- function createAttributedCodexAssistantMessage(attribution, text, options) {
27
- const usage = options.tokenUsage ? {
28
- input: options.tokenUsage.input ?? 0,
29
- output: options.tokenUsage.output ?? 0,
30
- cacheRead: options.tokenUsage.cacheRead ?? 0,
31
- cacheWrite: options.tokenUsage.cacheWrite ?? 0,
32
- ...options.tokenUsage.reasoningTokens !== void 0 ? { reasoningTokens: options.tokenUsage.reasoningTokens } : {},
33
- ...options.tokenUsage.contextUsage ? { contextUsage: options.tokenUsage.contextUsage } : {},
34
- totalTokens: options.tokenUsage.total ?? (options.tokenUsage.input ?? 0) + (options.tokenUsage.output ?? 0) + (options.tokenUsage.cacheRead ?? 0) + (options.tokenUsage.cacheWrite ?? 0),
35
- cost: ZERO_USAGE.cost
36
- } : ZERO_USAGE;
37
- const refusal = options.providerRefusal;
38
- return {
39
- role: "assistant",
40
- content: [{
41
- type: "text",
42
- text
43
- }],
44
- api: attribution.api ?? "openai-chatgpt-responses",
45
- provider: attribution.provider,
46
- model: attribution.modelId,
47
- usage,
48
- stopReason: options.aborted ? "aborted" : options.promptError || refusal ? "error" : "stop",
49
- errorMessage: refusal?.message ?? (options.promptError ? formatErrorMessage(options.promptError) : void 0),
50
- ...refusal ? { diagnostics: [{
51
- type: "provider_refusal",
52
- timestamp: Date.now(),
53
- details: codexProviderRefusalDetails(refusal)
54
- }] } : {},
55
- timestamp: Date.now()
56
- };
57
- }
58
- function createAssistantCommentaryMessage(params, text, itemId, timestamp) {
59
- return {
60
- ...createNonterminalAssistantMessage(params, [{
61
- type: "text",
62
- text
63
- }], timestamp),
64
- openclawStreamFallback: {
65
- replacementText: text,
66
- source: "segment",
67
- itemId
68
- }
69
- };
70
- }
71
- function createAssistantAsyncMessage(params, text, itemId, timestamp, questions) {
72
- return {
73
- ...createNonterminalAssistantMessage(params, [{
74
- type: "text",
75
- text
76
- }], timestamp),
77
- openclawAsyncDelivery: {
78
- itemId,
79
- ...questions ? { questions } : {}
80
- }
81
- };
82
- }
83
- function createAssistantReasoningMessage(params, text) {
84
- return createNonterminalAssistantMessage(params, [{
85
- type: "thinking",
86
- thinking: text
87
- }]);
88
- }
89
- function createNonterminalAssistantMessage(params, content, timestamp) {
90
- const attribution = resolveCodexLocalRuntimeAttribution(params);
91
- return {
92
- role: "assistant",
93
- content,
94
- api: attribution.api ?? "openai-chatgpt-responses",
95
- provider: attribution.provider,
96
- model: params.modelId,
97
- usage: ZERO_USAGE,
98
- stopReason: "stop",
99
- timestamp: timestamp ?? Date.now()
100
- };
101
- }
102
- //#endregion
103
- export { createAttributedCodexAssistantMessage as a, createAssistantReasoningMessage as i, createAssistantCommentaryMessage as n, createAssistantMessage as r, createAssistantAsyncMessage as t };
@@ -1,234 +0,0 @@
1
- import { i as isJsonObject } from "./protocol-CANUwXJ3.mjs";
2
- import { asFiniteNumber, normalizeOptionalString as normalizeOptionalString$1, readStringField } from "openclaw/plugin-sdk/string-coerce-runtime";
3
- import { Buffer } from "node:buffer";
4
- //#region extensions/codex/src/app-server/event-projector-values.ts
5
- const BIO_POLICY_SAFETY_ACCESS_BLOCK_PREFIX = "This content was flagged for possible biological risk.";
6
- /** Decode app-server v2 findings with the Codex UI's UTF-8 limits; never truncate a steer. */
7
- function readCodexMisalignmentReview(value) {
8
- if (!isJsonObject(value)) return;
9
- const explanation = value.detailedExplanation;
10
- if (typeof explanation !== "string" || !explanation.trim() || Buffer.byteLength(explanation, "utf8") > 65536) return;
11
- const message = isJsonObject(value.steer) ? value.steer.message : void 0;
12
- return {
13
- explanation,
14
- ...typeof message === "string" && message.trim() && Buffer.byteLength(message, "utf8") <= 1024 ? { continuation: { message } } : {},
15
- ...typeof value.errorType === "string" && value.errorType.trim() ? { errorType: value.errorType } : {}
16
- };
17
- }
18
- /** Project only Codex's explicit refusal contracts; other policy errors retain their own paths. */
19
- function readCodexProviderRefusal(message, codexErrorInfo, options) {
20
- if (!message) return;
21
- if (codexErrorInfo === "cyberPolicy") return {
22
- category: "cyber",
23
- message
24
- };
25
- if (codexErrorInfo === "misalignmentPolicyViolation") {
26
- const review = readCodexMisalignmentReview(options?.misalignment);
27
- return {
28
- category: "misalignment",
29
- message,
30
- ...review ? { review } : {},
31
- ...options?.nativeThreadId ? { nativeThreadId: options.nativeThreadId } : {},
32
- ...options?.nativeTurnId ? { nativeTurnId: options.nativeTurnId } : {}
33
- };
34
- }
35
- return message.startsWith(BIO_POLICY_SAFETY_ACCESS_BLOCK_PREFIX) ? {
36
- category: "bio",
37
- message
38
- } : void 0;
39
- }
40
- function codexProviderRefusalDetails(refusal) {
41
- return {
42
- provider: "openai",
43
- category: refusal.category,
44
- ...refusal.review ? { review: refusal.review } : {},
45
- ...refusal.nativeThreadId ? { nativeThreadId: refusal.nativeThreadId } : {},
46
- ...refusal.nativeTurnId ? { nativeTurnId: refusal.nativeTurnId } : {}
47
- };
48
- }
49
- function readNonEmptyString(record, key) {
50
- return normalizeOptionalString$1(record[key]);
51
- }
52
- function readNonEmptyStringArray(record, key) {
53
- const value = record[key];
54
- if (!Array.isArray(value)) return [];
55
- const entries = [];
56
- for (const entry of value) {
57
- const normalized = normalizeOptionalString$1(entry);
58
- if (normalized) entries.push(normalized);
59
- }
60
- return entries;
61
- }
62
- function readNullableString(record, key) {
63
- const value = record[key];
64
- if (value === null) return null;
65
- return typeof value === "string" ? value : void 0;
66
- }
67
- function readNonNegativeInteger(record, key) {
68
- const value = asFiniteNumber(record[key]);
69
- return value !== void 0 && Number.isInteger(value) && value >= 0 ? value : void 0;
70
- }
71
- function readCodexErrorNotificationMessage(record) {
72
- const error = record.error;
73
- return isJsonObject(error) ? readStringField(error, "message") : void 0;
74
- }
75
- function readHookOutputEntries(value) {
76
- if (!Array.isArray(value)) return [];
77
- return value.flatMap((entry) => {
78
- if (!isJsonObject(entry)) return [];
79
- const text = readStringField(entry, "text");
80
- if (!text) return [];
81
- const kind = readStringField(entry, "kind");
82
- return [{
83
- ...kind ? { kind } : {},
84
- text
85
- }];
86
- });
87
- }
88
- function splitPlanText(text) {
89
- return text.split(/\r?\n/).map((line) => line.trim().replace(/^[-*]\s+/, "")).filter((line) => line.length > 0);
90
- }
91
- function extractRawAssistantText(item) {
92
- const parts = (Array.isArray(item.content) ? item.content : []).flatMap((entry) => {
93
- if (!isJsonObject(entry)) return [];
94
- const type = readStringField(entry, "type");
95
- if (type !== "output_text" && type !== "text") return [];
96
- const value = readStringField(entry, "text");
97
- return value === void 0 ? [] : [value];
98
- });
99
- return parts.length > 0 ? parts.join("").trim() : void 0;
100
- }
101
- function readItemString(item, key) {
102
- const value = item[key];
103
- return typeof value === "string" ? value : void 0;
104
- }
105
- function readItem(value) {
106
- if (!isJsonObject(value)) return;
107
- const type = typeof value.type === "string" ? value.type : void 0;
108
- const id = typeof value.id === "string" ? value.id : void 0;
109
- if (!type || !id) return;
110
- return value;
111
- }
112
- //#endregion
113
- //#region extensions/codex/src/app-server/event-projector-items.ts
114
- function matchesCodexSnapshotTurn(item, turnId) {
115
- const itemTurnId = readItemString(item, "turnId");
116
- return itemTurnId === void 0 || itemTurnId === turnId;
117
- }
118
- function itemKind(item) {
119
- switch (item.type) {
120
- case "dynamicToolCall":
121
- case "mcpToolCall": return "tool";
122
- case "commandExecution": return "command";
123
- case "fileChange": return "patch";
124
- case "webSearch": return "search";
125
- case "reasoning":
126
- case "contextCompaction": return "analysis";
127
- default: return;
128
- }
129
- }
130
- function itemTitle(item) {
131
- switch (item.type) {
132
- case "commandExecution": return "Command";
133
- case "fileChange": return "File change";
134
- case "mcpToolCall": return "MCP tool";
135
- case "dynamicToolCall": return "Tool";
136
- case "webSearch": return "Web search";
137
- case "contextCompaction": return "Context compaction";
138
- case "reasoning": return "Reasoning";
139
- default: return item.type;
140
- }
141
- }
142
- function itemStatus(item) {
143
- const status = readItemString(item, "status");
144
- if (status === "failed" || status === "error") return "failed";
145
- if (status === "declined") return "blocked";
146
- if (status === "inProgress" || status === "in_progress" || status === "running") return "running";
147
- return "completed";
148
- }
149
- function unknownItemStatus(item) {
150
- const status = readItemString(item, "status");
151
- switch (status) {
152
- case void 0:
153
- case "completed":
154
- case "failed":
155
- case "error":
156
- case "declined":
157
- case "inProgress":
158
- case "in_progress":
159
- case "running": return;
160
- default: return status;
161
- }
162
- }
163
- function auditNativeToolTerminalStatus(item) {
164
- if (item.type === "imageView" || item.type === "sleep") return "completed";
165
- const status = readItemString(item, "status");
166
- if (status === "completed") return "completed";
167
- if (status === "failed" || status === "error") return "failed";
168
- if (status === "declined") return "blocked";
169
- return "unknown";
170
- }
171
- function auditNativeToolUnfinishedStatus(item) {
172
- return item.type === "webSearch" || item.type === "imageGeneration" ? "unknown" : "failed";
173
- }
174
- function isNonSuccessItemStatus(status) {
175
- return status === "failed" || status === "blocked";
176
- }
177
- function itemName(item) {
178
- if (item.type === "dynamicToolCall" && typeof item.tool === "string") return item.tool;
179
- if (item.type === "mcpToolCall" && typeof item.tool === "string") {
180
- const server = typeof item.server === "string" ? item.server : void 0;
181
- return server ? `${server}.${item.tool}` : item.tool;
182
- }
183
- if (item.type === "commandExecution") return "bash";
184
- if (item.type === "fileChange") return "apply_patch";
185
- if (item.type === "webSearch") return "web_search";
186
- }
187
- function auditNativeToolName(item) {
188
- if (item.type === "dynamicToolCall") return;
189
- const progressName = itemName(item);
190
- if (progressName) return progressName;
191
- if (item.type === "collabAgentToolCall") return typeof item.tool === "string" && item.tool.trim() ? `collab.${item.tool.trim()}` : "collab_agent";
192
- if (item.type === "imageGeneration") return "image_generation";
193
- if (item.type === "imageView") return "image_view";
194
- if (item.type === "sleep") return "sleep";
195
- }
196
- function isSideEffectingNativeToolItem(item) {
197
- return itemStatus(item) !== "blocked" && (isMutatingNativeToolItem(item) || item.type === "mcpToolCall");
198
- }
199
- function shouldSynthesizeToolProgressForItem(item) {
200
- switch (item.type) {
201
- case "commandExecution":
202
- case "fileChange":
203
- case "webSearch":
204
- case "mcpToolCall": return true;
205
- default: return false;
206
- }
207
- }
208
- function shouldRecordNativeToolTranscript(item) {
209
- switch (item.type) {
210
- case "commandExecution":
211
- case "fileChange":
212
- case "webSearch":
213
- case "mcpToolCall": return true;
214
- default: return false;
215
- }
216
- }
217
- function isMutatingNativeToolItem(item) {
218
- if (item.type === "commandExecution") return true;
219
- return item.type === "fileChange" || item.type === "collabAgentToolCall" || item.type === "imageGeneration";
220
- }
221
- function shouldClearTerminalPresentationForNativeItem(item) {
222
- switch (item.type) {
223
- case "collabAgentToolCall":
224
- case "commandExecution":
225
- case "fileChange":
226
- case "imageGeneration":
227
- case "imageView":
228
- case "mcpToolCall":
229
- case "webSearch": return true;
230
- default: return false;
231
- }
232
- }
233
- //#endregion
234
- export { readItemString as C, readNullableString as D, readNonNegativeInteger as E, splitPlanText as O, readItem as S, readNonEmptyStringArray as T, extractRawAssistantText as _, isNonSuccessItemStatus as a, readCodexProviderRefusal as b, itemName as c, matchesCodexSnapshotTurn as d, shouldClearTerminalPresentationForNativeItem as f, codexProviderRefusalDetails as g, unknownItemStatus as h, isMutatingNativeToolItem as i, itemStatus as l, shouldSynthesizeToolProgressForItem as m, auditNativeToolTerminalStatus as n, isSideEffectingNativeToolItem as o, shouldRecordNativeToolTranscript as p, auditNativeToolUnfinishedStatus as r, itemKind as s, auditNativeToolName as t, itemTitle as u, normalizeOptionalString$1 as v, readNonEmptyString as w, readHookOutputEntries as x, readCodexErrorNotificationMessage as y };
@@ -1,355 +0,0 @@
1
- import { CODEX_NATIVE_TOOL_REQUIREMENTS } from "../native-tool-policy.js";
2
- import { m as sessionBindingIdentity } from "./session-binding-record-BGoz8wOK.mjs";
3
- import { t as codexBuildSymbol } from "./build-state-C7EnDVgr.mjs";
4
- import { resolvePluginConfigObject } from "openclaw/plugin-sdk/plugin-config-runtime";
5
- import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
6
- //#region extensions/codex/src/app-server/model-runtime.ts
7
- const CODEX_APP_SERVER_RUNTIME_MODEL_PARAM = "codexAppServerRuntimeModel";
8
- function buildCodexRuntimeModelParams(catalogId, runtimeModelId) {
9
- return catalogId === runtimeModelId ? void 0 : { [CODEX_APP_SERVER_RUNTIME_MODEL_PARAM]: runtimeModelId };
10
- }
11
- function readCodexRuntimeModelId(model, fallbackId) {
12
- return normalizeOptionalString(model?.params?.[CODEX_APP_SERVER_RUNTIME_MODEL_PARAM]) ?? model?.id ?? fallbackId;
13
- }
14
- //#endregion
15
- //#region extensions/codex/harness.ts
16
- const DEFAULT_CODEX_HARNESS_PROVIDER_IDS = /* @__PURE__ */ new Set(["codex", "openai"]);
17
- const SHARED_CODEX_APP_SERVER_CLIENT_DISPOSER = codexBuildSymbol("openclaw.codexAppServerClientDisposer");
18
- const CODEX_TOOL_POLICY_SAFE_DENY_NAMES = [
19
- "web_fetch",
20
- "x_search",
21
- "memory_search",
22
- "memory_get",
23
- "dashboard",
24
- "canvas",
25
- "show_widget",
26
- "message",
27
- "heartbeat_respond",
28
- "automations",
29
- "gateway",
30
- "skill_workshop",
31
- "image_generate",
32
- "music_generate",
33
- "video_generate",
34
- "tts"
35
- ];
36
- const CODEX_APP_SERVER_CONTEXT_ENGINE_HOST_CAPABILITIES = [
37
- "bootstrap",
38
- "assemble-before-prompt",
39
- "after-turn",
40
- "maintain",
41
- "compact",
42
- "runtime-llm-complete",
43
- "thread-bootstrap-projection"
44
- ];
45
- async function disposeSharedCodexAppServerClients() {
46
- const dispose = globalThis[SHARED_CODEX_APP_SERVER_CLIENT_DISPOSER];
47
- await dispose?.();
48
- }
49
- /**
50
- * Creates the Codex app-server harness used for attempts, side questions,
51
- * compaction, reset, and disposal.
52
- */
53
- function createCodexAppServerAgentHarness(options) {
54
- const harnessRuntimeId = options?.id ?? "codex";
55
- const normalizedHarnessRuntimeId = harnessRuntimeId.trim().toLowerCase();
56
- const providerIds = new Set([...options?.providerIds ?? DEFAULT_CODEX_HARNESS_PROVIDER_IDS].map((id) => id.trim().toLowerCase()));
57
- const sessionCatalogControlFactory = options.sessionCatalogControlFactory;
58
- const sessionRuntime = options.runtime;
59
- let modelCatalog;
60
- let disposed = false;
61
- const resolveAttemptPluginConfig = (config) => resolvePluginConfigObject(config, "codex") ?? options.resolvePluginConfig?.() ?? options.pluginConfig;
62
- return {
63
- id: harnessRuntimeId,
64
- label: options?.label ?? "Codex agent harness",
65
- autoSelection: { providerIds: [...providerIds] },
66
- cloudPlacement: {
67
- mode: "remote-exec",
68
- devicePlacement: {
69
- requiredNodeCommands: ["codex.exec-server.stdio.v1"],
70
- consumesWorkerSlot: false
71
- }
72
- },
73
- delegatedExecutionPluginIds: ["voice-call"],
74
- contextEngineHostCapabilities: CODEX_APP_SERVER_CONTEXT_ENGINE_HOST_CAPABILITIES,
75
- conversationToolPolicySupport: "exact",
76
- conversationToolPolicySafeDenyTools: CODEX_TOOL_POLICY_SAFE_DENY_NAMES,
77
- conversationToolPolicyNativeTools: CODEX_NATIVE_TOOL_REQUIREMENTS,
78
- deliveryDefaults: { visibleReplies: "message_tool" },
79
- authBootstrap: "harness",
80
- resolveSessionRuntimeOwnership: (params) => {
81
- const assertCurrent = () => {
82
- params.assertCurrent();
83
- if (disposed) throw new Error("Codex agent harness is disposed");
84
- };
85
- assertCurrent();
86
- const identity = sessionBindingIdentity(params);
87
- let binding = options.bindingStore.read(identity);
88
- if (!binding) {
89
- const previousSessionId = params.readPreviousSessionId?.();
90
- binding = previousSessionId ? options.bindingStore.read({
91
- ...identity,
92
- sessionId: previousSessionId
93
- }) : void 0;
94
- }
95
- assertCurrent();
96
- return binding?.preserveNativeModel === true ? {
97
- model: "native",
98
- auth: binding.connectionScope === "supervision" ? "native" : "host",
99
- ...binding.model?.trim() && binding.modelProvider ? { modelRef: {
100
- provider: binding.modelProvider,
101
- model: binding.model
102
- } } : {}
103
- } : void 0;
104
- },
105
- ...sessionCatalogControlFactory && sessionRuntime ? { sessionForkV2: {
106
- executionEnvironment: "host-only",
107
- upstreamKinds: ["codex-app-server"],
108
- fork: async (params) => {
109
- const { forkCodexUpstreamSession } = await import("./upstream-session-fork-BUr4OUbC.mjs");
110
- return await forkCodexUpstreamSession(params, {
111
- bindingStore: options.bindingStore,
112
- controlFactory: sessionCatalogControlFactory,
113
- harnessRuntimeId,
114
- resolveConfig: options.resolveConfig,
115
- runtime: sessionRuntime
116
- });
117
- }
118
- } } : {},
119
- taskHistory: {
120
- taskKinds: ["codex-native"],
121
- read: async (params) => {
122
- const { readCodexNativeSubagentHistory } = await import("./native-subagent-history-0nYYgo0k.mjs");
123
- const assertCurrent = () => {
124
- params.assertCurrent();
125
- if (disposed) throw new Error("Agent harness is disposed");
126
- };
127
- return readCodexNativeSubagentHistory({
128
- ...params,
129
- assertCurrent
130
- }, {
131
- bindingStore: options.bindingStore,
132
- pluginConfig: resolveAttemptPluginConfig(params.cfg)
133
- });
134
- }
135
- },
136
- authBinding: { fingerprint: async (params) => {
137
- const { fingerprintCodexAppServerAuthBinding } = await import("./auth-binding-DhLWa_7K.mjs").then((n) => n.t);
138
- return fingerprintCodexAppServerAuthBinding(params);
139
- } },
140
- runtimeArtifact: { validate: async (binding) => {
141
- const { validateCodexAppServerRuntimeArtifact } = await import("./runtime-artifact-CLZ8udh-.mjs");
142
- return validateCodexAppServerRuntimeArtifact(binding);
143
- } },
144
- fetchUsageSnapshot: async (ctx) => {
145
- const { fetchCodexAppServerUsageSnapshot } = await import("./usage-BML0r-ua.mjs");
146
- return await fetchCodexAppServerUsageSnapshot(ctx, { pluginConfig: options?.resolvePluginConfig?.() ?? options?.pluginConfig });
147
- },
148
- loadModelCatalog: async (params) => {
149
- const { createCodexAppServerModelCatalog } = await import("./model-catalog-CfXJf9Ay.mjs");
150
- if (disposed) return [];
151
- modelCatalog ??= createCodexAppServerModelCatalog(harnessRuntimeId);
152
- return await modelCatalog.load(params, resolveAttemptPluginConfig(params.config));
153
- },
154
- readModelCatalogReadiness: (params) => modelCatalog?.read(params, resolveAttemptPluginConfig(params.config)),
155
- loadMcpToolCatalog: async (params) => {
156
- const { loadCodexEffectiveMcpCatalog } = await import("./effective-mcp-catalog-CvnvnGIe.mjs");
157
- return await loadCodexEffectiveMcpCatalog(params, { bindingStore: options.bindingStore });
158
- },
159
- supports: (ctx) => {
160
- const provider = ctx.provider.trim().toLowerCase();
161
- if (!providerIds.has(provider)) return {
162
- supported: false,
163
- reason: `provider is not one of: ${[...providerIds].toSorted().join(", ")}`
164
- };
165
- if (ctx.modelProvider?.requestTransportOverrides === "present") return {
166
- supported: false,
167
- reason: "Codex cannot reproduce authored request transport overrides",
168
- fallbackRuntime: "openclaw"
169
- };
170
- const preparedAuth = ctx.modelProvider?.preparedAuth;
171
- const runtimePolicy = ctx.modelProvider?.runtimePolicy;
172
- const nativeAccountOwnsUnobservedModel = provider === "openai" && ctx.requestedRuntime === "codex" && Boolean(ctx.modelId?.trim()) && (preparedAuth === void 0 || preparedAuth.source === "harness") && preparedAuth?.mode === void 0 && preparedAuth?.requirement === void 0 && ctx.modelProvider?.api === void 0 && ctx.modelProvider?.baseUrl === void 0 && ctx.modelProvider?.azureApiVersion === void 0 && ctx.modelProvider?.request === void 0;
173
- if (runtimePolicy) {
174
- if (!runtimePolicy.compatibleIds.some((id) => id.trim().toLowerCase() === normalizedHarnessRuntimeId)) return {
175
- supported: false,
176
- reason: "Codex cannot reproduce the prepared provider route"
177
- };
178
- } else if (ctx.modelProvider && provider !== "codex" && !nativeAccountOwnsUnobservedModel) return {
179
- supported: false,
180
- reason: "provider route compatibility with Codex is not declared"
181
- };
182
- if (preparedAuth?.requirement === "subscription") {
183
- if (!(preparedAuth.source === "profile" && (preparedAuth.mode === "oauth" || preparedAuth.mode === "token"))) return {
184
- supported: false,
185
- reason: "Codex subscription auth requires a prepared OAuth or token profile"
186
- };
187
- } else if (preparedAuth?.requirement === "api-key") {
188
- if (!(preparedAuth.source !== "none" && preparedAuth.source !== "harness" && (preparedAuth.mode === "api-key" || preparedAuth.mode === "api_key"))) return {
189
- supported: false,
190
- reason: "Codex Platform auth requires a prepared API key"
191
- };
192
- }
193
- return {
194
- supported: true,
195
- priority: 100
196
- };
197
- },
198
- runAttempt: async (params) => {
199
- const { runCodexAppServerAttempt } = await import("./run-attempt-BHu11r7h.mjs");
200
- const { planCodexCyberEscalation, readCodexCyberAttemptVerdict, recordCodexCyberTargetUnavailable, reserveCodexCyberProbe, resolveCodexCyberFailoverConfig } = await import("./cyber-failover-DYwbmf1o.mjs");
201
- const { emitCodexCyberNotice } = await import("./cyber-failover-notice-e9G3J9-e.mjs");
202
- const pluginConfig = resolveAttemptPluginConfig(params.config);
203
- const attemptModel = readCodexRuntimeModelId(params.model, params.modelId);
204
- const runAttemptOnModel = (model, isRetry = false) => runCodexAppServerAttempt(isRetry ? {
205
- ...params,
206
- suppressNextUserMessagePersistence: true
207
- } : params, {
208
- bindingStore: options.bindingStore,
209
- pluginConfig,
210
- runtime: sessionRuntime,
211
- runtimeModelId: model,
212
- nativeHookRelay: { enabled: true }
213
- });
214
- const cyberFailover = resolveCodexCyberFailoverConfig(pluginConfig);
215
- const workspace = {
216
- agentId: params.agentId,
217
- authProfileId: params.authProfileId
218
- };
219
- const result = await runAttemptOnModel(attemptModel);
220
- const refusal = readCodexCyberAttemptVerdict(result);
221
- if (!refusal.cyberRefused) return result;
222
- const plan = planCodexCyberEscalation({
223
- config: cyberFailover,
224
- currentModel: attemptModel,
225
- replaySafe: refusal.replaySafe,
226
- workspace
227
- });
228
- if (plan.kind !== "escalate") {
229
- if (plan.reason === "target_unavailable") await emitCodexCyberNotice(params, {
230
- state: "unavailable",
231
- model: attemptModel,
232
- fallbackModel: cyberFailover.model
233
- });
234
- return result;
235
- }
236
- const releaseProbe = reserveCodexCyberProbe({
237
- model: plan.model,
238
- workspace
239
- });
240
- let escalated;
241
- try {
242
- escalated = await runAttemptOnModel(plan.model, true);
243
- } finally {
244
- releaseProbe();
245
- }
246
- const outcome = readCodexCyberAttemptVerdict(escalated);
247
- if (outcome.unavailable) recordCodexCyberTargetUnavailable({
248
- model: plan.model,
249
- workspace,
250
- cooloffMs: cyberFailover.cooloffMs
251
- });
252
- if (outcome.answered || outcome.unavailable) await emitCodexCyberNotice(params, {
253
- state: outcome.answered ? "escalated" : "unavailable",
254
- model: attemptModel,
255
- fallbackModel: plan.model
256
- });
257
- if (outcome.unavailable && outcome.replaySafe && escalated.terminal.kind === "failed" && escalated.toolMetas.length === 0) return result;
258
- return escalated;
259
- },
260
- runIsolatedCompletionV2: async (params) => {
261
- if (params.authorization.owner === "host") {
262
- const { runHostPreparedIsolatedCompletion } = await import("openclaw/plugin-sdk/simple-completion-runtime");
263
- return runHostPreparedIsolatedCompletion(params);
264
- }
265
- const { runCodexIsolatedCompletion } = await import("./isolated-completion-BIZFhTNG.mjs");
266
- return runCodexIsolatedCompletion(params, { pluginConfig: options?.resolvePluginConfig?.() ?? options?.pluginConfig });
267
- },
268
- runIsolatedCompletion: async (params) => {
269
- const { runHostPreparedIsolatedCompletion } = await import("openclaw/plugin-sdk/simple-completion-runtime");
270
- return runHostPreparedIsolatedCompletion({
271
- ...params,
272
- authorization: {
273
- owner: "host",
274
- model: params.model,
275
- auth: params.auth,
276
- sourceAuthFingerprint: params.sourceAuthFingerprint
277
- }
278
- });
279
- },
280
- finalizeSettledTurn: async (params) => {
281
- const { runCodexSettledTurnFinalization } = await import("./settled-turn-finalizer-DiAi6Kx6.mjs");
282
- return runCodexSettledTurnFinalization(params, { pluginConfig: options?.resolvePluginConfig?.() ?? options?.pluginConfig });
283
- },
284
- runSideQuestion: async (params) => {
285
- const { runCodexAppServerSideQuestion } = await import("./side-question-BJ1wSDcB.mjs");
286
- return runCodexAppServerSideQuestion(params, {
287
- bindingStore: options.bindingStore,
288
- pluginConfig: options?.resolvePluginConfig?.() ?? options?.pluginConfig,
289
- runtime: sessionRuntime,
290
- runtimeModelId: readCodexRuntimeModelId(params.runtimeModel, params.model),
291
- nativeHookRelay: { enabled: true }
292
- });
293
- },
294
- compact: async (params) => {
295
- const { maybeCompactCodexAppServerSession } = await import("./compact-Du5UvtxA.mjs");
296
- return maybeCompactCodexAppServerSession(params, {
297
- bindingStore: options.bindingStore,
298
- pluginConfig: options?.resolvePluginConfig?.() ?? options?.pluginConfig
299
- });
300
- },
301
- withSessionDeletion: async (params, run) => {
302
- const { withCodexAppServerSessionDeletion } = await import("./session-retirement-BH-S6qkJ.mjs");
303
- params.assertCurrent();
304
- return withCodexAppServerSessionDeletion(options.bindingStore, params, run);
305
- },
306
- withSessionContextReset: async (params, run) => {
307
- const { withCodexAppServerSessionContextReset } = await import("./session-retirement-BH-S6qkJ.mjs");
308
- params.assertCurrent();
309
- return withCodexAppServerSessionContextReset(options.bindingStore, params, run);
310
- },
311
- reset: async (params) => {
312
- if (params.sessionId && params.reason !== "deleted") {
313
- const [{ reclaimCurrentCodexSessionGeneration }, { retireCodexAppServerSessionGeneration }] = await Promise.all([import("./session-binding-Cm0apEbd.mjs").then((n) => n.s), import("./session-retirement-BH-S6qkJ.mjs")]);
314
- const identity = sessionBindingIdentity({
315
- agentId: params.agentId,
316
- sessionId: params.sessionId,
317
- sessionKey: params.sessionKey
318
- });
319
- const resetGeneration = () => retireCodexAppServerSessionGeneration({
320
- bindingStore: options.bindingStore,
321
- identity,
322
- mode: "reset"
323
- });
324
- let reset = await resetGeneration();
325
- if (reset === "conflict") {
326
- if (await reclaimCurrentCodexSessionGeneration({
327
- bindingStore: options.bindingStore,
328
- identity,
329
- config: options.resolveConfig?.()
330
- })) reset = await resetGeneration();
331
- }
332
- if (reset === "conflict") throw new Error(`Codex binding generation changed before session ${params.sessionId} could reset`);
333
- }
334
- },
335
- dispose: async () => {
336
- disposed = true;
337
- modelCatalog?.dispose();
338
- await disposeSharedCodexAppServerClients();
339
- }
340
- };
341
- }
342
- /** Creates the private native-compaction bridge registered in host-owned capability state. */
343
- function createCodexAppServerNativeCompaction(options) {
344
- return async (params) => {
345
- const { maybeCompactCodexAppServerSession } = await import("./compact-Du5UvtxA.mjs");
346
- return maybeCompactCodexAppServerSession(params, {
347
- bindingStore: options.bindingStore,
348
- pluginConfig: options.resolvePluginConfig?.() ?? options.pluginConfig,
349
- allowNonManualNativeRequest: true,
350
- nativeCompactionRequest: params.nativeCompactionRequest
351
- });
352
- };
353
- }
354
- //#endregion
355
- export { createCodexAppServerNativeCompaction as n, buildCodexRuntimeModelParams as r, createCodexAppServerAgentHarness as t };