@openclaw/codex 2026.10.8 → 2026.10.9
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/dist/.setup/{account-usage-runtime-lUj2JqSj.mjs → account-usage-runtime-DAt_3QG0.mjs} +1 -1
- package/dist/.setup/{apply-DjTVE_db.mjs → apply-DmhHTC5c.mjs} +4 -4
- package/dist/.setup/{attempt-client-cleanup-BmPBqnW3.mjs → attempt-client-cleanup-DQBa7iiq.mjs} +4 -4
- package/dist/.setup/{auth-cache-key-8VTsPn2f.mjs → auth-cache-key-KogLtj0t.mjs} +1 -1
- package/dist/.setup/{bounded-turn-DByEneJg.mjs → bounded-turn-B91suzbV.mjs} +7 -7
- package/dist/.setup/{build-state-vxQdf_74.mjs → build-state-CvGKuaeP.mjs} +1 -1
- package/dist/.setup/{client-BTWv2cJe.mjs → client-CafYfF2n.mjs} +306 -19
- package/dist/.setup/{command-dispatch-rxpyy4f6.mjs → command-dispatch-C2tNChTq.mjs} +1 -1
- package/dist/.setup/{command-handlers-D6utyBA8.mjs → command-handlers-yb5vwwrx.mjs} +10 -10
- package/dist/.setup/{command-rpc-CloxIlVK.mjs → command-rpc-CZmpQF4z.mjs} +6 -6
- package/dist/.setup/{compact-CIJFn4Bi.mjs → compact-CeD2d2_k.mjs} +9 -9
- package/dist/.setup/{computer-use-vLGHqSOu.mjs → computer-use-C4HhkAcj.mjs} +4 -4
- package/dist/.setup/{conversation-binding-BUw0IM5Z.mjs → conversation-binding-HX8U8A3K.mjs} +7 -7
- package/dist/.setup/{dynamic-tool-build-OWTT0wP-.mjs → dynamic-tool-build-BPkHfpul.mjs} +1 -1
- package/dist/.setup/{dynamic-tools-CygReZGj.mjs → dynamic-tools-CCezdz5n.mjs} +6 -6
- package/dist/.setup/{effective-mcp-catalog-B_4Dtkdg.mjs → effective-mcp-catalog-SjTJ-F2i.mjs} +4 -4
- package/dist/.setup/{ephemeral-turn-B1Na_xCj.mjs → ephemeral-turn-CgKjGBaW.mjs} +2 -2
- package/dist/.setup/{isolated-completion-DGCmR0Q8.mjs → isolated-completion-C5ifbI0F.mjs} +3 -3
- package/dist/.setup/{mcp-app-session-preparation-DFvoViz9.mjs → mcp-app-session-preparation-hnw_eGnR.mjs} +3 -3
- package/dist/.setup/{model-catalog-CCr0L7T4.mjs → model-catalog-BO573-NN.mjs} +5 -5
- package/dist/.setup/{models-CPdqFOZS.mjs → models-Dw0qUZl3.mjs} +3 -3
- package/dist/.setup/{native-hook-relay-VHeLdZXU.mjs → native-hook-relay-CwkDznGH.mjs} +3 -3
- package/dist/.setup/{native-mcp-app-ly1JuStw.mjs → native-mcp-app-B7N--ols.mjs} +4 -4
- package/dist/.setup/{native-skill-isolation--6M-3BWV.mjs → native-skill-isolation-0pEyxLRX.mjs} +2 -2
- package/dist/.setup/{native-subagent-monitor-CuNglHrq.mjs → native-subagent-monitor-D_tvjJxa.mjs} +6 -6
- package/dist/.setup/{plan-CqI4m0CC.mjs → plan-BE7gWwkn.mjs} +2 -2
- package/dist/.setup/{plugin-approval-roundtrip-DIE4DZ9S.mjs → plugin-approval-roundtrip-ts-2EU8i.mjs} +1 -1
- package/dist/.setup/{provider-CBlKf65x.mjs → provider-D8R-IBhv.mjs} +4 -4
- package/dist/.setup/{provider-capabilities-BIyUe_cz.mjs → provider-capabilities-C4ENlstc.mjs} +1 -1
- package/dist/.setup/{request-6bus8ebp.mjs → request-ufWmJNN1.mjs} +1 -1
- package/dist/.setup/{run-attempt-BcePYT3A.mjs → run-attempt-CGHsrfPB.mjs} +22 -22
- package/dist/.setup/{session-catalog-events-C8i0HBz5.mjs → session-catalog-events-DnLfF9Xo.mjs} +3 -3
- package/dist/.setup/{session-catalog-index-zqaZhwr2.mjs → session-catalog-index-Bbph2EwS.mjs} +4 -4
- package/dist/.setup/{session-catalog-native-projection-C6KOqnIb.mjs → session-catalog-native-projection-CHtG8DwY.mjs} +1 -1
- package/dist/.setup/{session-catalog-projection-DD5m0grG.mjs → session-catalog-projection-BgENBUS2.mjs} +1 -1
- package/dist/.setup/{session-catalog-source-0x1LVwV-.mjs → session-catalog-source-qHe5r9i_.mjs} +1 -1
- package/dist/.setup/{session-retirement-BIFmgIgn.mjs → session-retirement-BdHruV7q.mjs} +5 -5
- package/dist/.setup/{settled-turn-finalizer-9WZ-Hnwo.mjs → settled-turn-finalizer-Ca_Qd_9g.mjs} +3 -3
- package/dist/.setup/{shared-client-Bo9MCCKj.mjs → shared-client-C0gEybHs.mjs} +5 -5
- package/dist/.setup/{side-question-GmfBHNHK.mjs → side-question-Nn6D01tP.mjs} +9 -9
- package/dist/.setup/{source-C4Al9cJx.mjs → source-CgYvv2h-.mjs} +1 -1
- package/dist/.setup/{thread-lifecycle-run-avZbRAjm.mjs → thread-lifecycle-run-BHM-L-56.mjs} +11 -11
- package/dist/.setup/{thread-ownership-C5Hpc-Q1.mjs → thread-ownership-BJpeo5Xk.mjs} +3 -3
- package/dist/.setup/{thread-policy-BFLbIpIt.mjs → thread-policy-BlzkKVno.mjs} +3 -3
- package/dist/.setup/{thread-resume-LBLXiIEh.mjs → thread-resume-BDd8b3E_.mjs} +4 -4
- package/dist/.setup/{turn-router-Ba0-h2NE.mjs → turn-router-8CkGlezp.mjs} +2 -2
- package/dist/.setup/{upstream-session-fork-C34T_h_K.mjs → upstream-session-fork-BW_UbivO.mjs} +8 -8
- package/dist/.setup/{usage-BHTnwsjV.mjs → usage-fX3ctGZb.mjs} +1 -1
- package/dist/.setup/{usage-limit-error-YNy7uINJ.mjs → usage-limit-error-DycN7mED.mjs} +1 -1
- package/dist/.setup/{web-search-provider.runtime-BOqY-zot.mjs → web-search-provider.runtime-DEBVJch2.mjs} +1 -1
- package/dist/.source-module-urls/0560e3825cf513bbe9e095a85951c1215dfced0c1e581c5f32b007a3e759636e.json +1 -0
- package/dist/.source-module-urls/61f8912a558f2bfc87dcddd651d7f5d3cf17ba02e1e5359b050bf670840c0e0e.json +1 -0
- package/dist/catalog-page.worker.js +340 -1
- package/dist/cli-metadata.js +1 -1
- package/dist/harness.js +15 -15
- package/dist/index.js +24 -24
- package/dist/media-understanding-provider.js +2 -2
- package/dist/migration-provider-api.js +1 -1
- package/package.json +4 -4
- package/dist/.setup/client-catalog-response-CEZTmNz3.mjs +0 -310
- package/dist/.source-module-urls/a8ffe2b9525179f031f130700992add0f356b5fe3e562c8e70b2801696da5134.json +0 -1
- package/dist/.setup/{session-cli-B1f7NqXo.mjs → session-cli-CKzNw4c4.mjs} +1 -1
package/dist/index.js
CHANGED
|
@@ -2,7 +2,7 @@ import { registerCodexCliMetadata } from "./cli-metadata.js";
|
|
|
2
2
|
import { A as unwrapNodeInvokePayload, C as readGatewayParams, E as requireOnlyKeys, S as readControlCursor, _ as normalizeLimit, a as CODEX_LOCAL_SESSION_HOST_ID, b as parseTranscriptPage, f as catalogError, g as isInteractiveThreadSource, h as filterCatalogPageByTitle, i as CODEX_CATALOG_TRANSCRIPT_READ_COMMAND, j as CODEX_INTERACTIVE_THREAD_SOURCE_KINDS, l as MAX_TRANSCRIPT_PAGE_BYTES, n as CODEX_APP_SERVER_THREADS_LIST_COMMAND, o as CatalogParamsError, r as CODEX_APP_SERVER_THREAD_TURNS_LIST_COMMAND, s as MAX_CURSOR_LENGTH, t as CODEX_APP_SERVER_THREADS_CAPABILITY, u as NODE_INVOKE_TIMEOUT_MS, v as parseCatalogPage, w as readPageParams, x as readBoundedOptionalString, y as parseJsonParams } from "./.setup/session-catalog-parsing-DmZmgRou.mjs";
|
|
3
3
|
import { i as isJsonObject, n as assertCodexThreadForkParams } from "./.setup/protocol-CANUwXJ3.mjs";
|
|
4
4
|
import { d as readCurrentCodexNativeSubagentSubmissions, f as readCurrentNativePendingAssignments, l as readCurrentCodexAppServerBinding, m as sessionBindingIdentity, n as assertCodexBindingMayBeReplaced, u as readCurrentCodexAppServerBindings } from "./.setup/session-binding-record-O62ZRFhy.mjs";
|
|
5
|
-
import { n as defineCodexBuildState } from "./.setup/build-state-
|
|
5
|
+
import { n as defineCodexBuildState } from "./.setup/build-state-CvGKuaeP.mjs";
|
|
6
6
|
import { createCodexAppServerAgentHarness, createCodexAppServerNativeCompaction } from "./harness.js";
|
|
7
7
|
import { buildCodexMediaUnderstandingProvider } from "./media-understanding-provider.js";
|
|
8
8
|
import codexProviderDiscovery from "./provider-discovery.js";
|
|
@@ -12,7 +12,7 @@ import { d as readCodexPluginConfig } from "./.setup/config-parsing-CVK2Q463.mjs
|
|
|
12
12
|
import { n as resolveCodexAppServerLocalHomeDir, r as resolveCodexAppServerUserHomeDir, t as resolveCodexAppServerHomeDir } from "./.setup/auth-start-options-BPIPeEX8.mjs";
|
|
13
13
|
import { r as createCodexAppServerConfig, t as codexAppServerStartOptionsKey } from "./.setup/config-options-CZmH25Xq.mjs";
|
|
14
14
|
import { o as setManagedCodexPluginRoot } from "./.setup/managed-binary-Boj8_lWV.mjs";
|
|
15
|
-
import { O as createCodexDesktopGenerationService, T as retireSharedCodexAppServerClientsBeforeDesktopGeneration, m as hasActiveSharedCodexAppServerWork, p as getSharedCodexAppServerClientState, s as resolveCodexAppServerFallbackApiKeyCacheKey } from "./.setup/auth-cache-key-
|
|
15
|
+
import { O as createCodexDesktopGenerationService, T as retireSharedCodexAppServerClientsBeforeDesktopGeneration, m as hasActiveSharedCodexAppServerWork, p as getSharedCodexAppServerClientState, s as resolveCodexAppServerFallbackApiKeyCacheKey } from "./.setup/auth-cache-key-KogLtj0t.mjs";
|
|
16
16
|
import { i as CODEX_APP_SERVER_BINDING_NAMESPACE, r as CODEX_APP_SERVER_BINDING_MAX_ENTRIES } from "./.setup/session-binding-meta-Lkm5Lpf4.mjs";
|
|
17
17
|
import { s as createCodexAppServerProcessReaperService } from "./.setup/transport-stdio-BsXQmXll.mjs";
|
|
18
18
|
import { n as codexNativeProfileRecoveryService } from "./.setup/auth-profile-health-B05o5BAm.mjs";
|
|
@@ -20,7 +20,7 @@ import { n as withCodexConversationThreadActivity } from "./.setup/thread-owners
|
|
|
20
20
|
import { a as canMutateCodexHost, r as CODEX_NATIVE_EXECUTION_AUTH_ERROR } from "./.setup/command-authorization-AikPDtcc.mjs";
|
|
21
21
|
import { o as formatCodexDisplayText } from "./.setup/command-formatters-xW9KpoSZ.mjs";
|
|
22
22
|
import { a as readCodexConversationBindingDataRecord, i as readCodexConversationBindingData, o as resolveCodexDefaultWorkspaceDir } from "./.setup/conversation-binding-data-BqzGWkPW.mjs";
|
|
23
|
-
import { t as buildCodexMigrationProvider } from "./.setup/provider-
|
|
23
|
+
import { t as buildCodexMigrationProvider } from "./.setup/provider-D8R-IBhv.mjs";
|
|
24
24
|
import { r as CodexAppServerRpcError, s as isCodexThreadReadMissingError } from "./.setup/rpc-error-C98SHchT.mjs";
|
|
25
25
|
import { t as CODEX_CONTROL_METHODS } from "./.setup/capabilities-DbOzOglY.mjs";
|
|
26
26
|
import { n as filterCodexMarketplacePlugins, t as discoverCodexMarketplacePlugins } from "./.setup/plugin-marketplace-discovery-BNyI1zd_.mjs";
|
|
@@ -35,10 +35,10 @@ import { r as projectCodexUserItemText } from "./.setup/transcript-history-proje
|
|
|
35
35
|
import { r as codexUpstreamContinueResult } from "./.setup/session-upstream-marker-D15C9NHp.mjs";
|
|
36
36
|
import { t as buildCodexAppServerConnectionFingerprint } from "./.setup/plugin-app-cache-key-Bg9DbDI6.mjs";
|
|
37
37
|
import { n as readCodexSessionMeta } from "./.setup/session-catalog-provenance-CmsOE5mh.mjs";
|
|
38
|
-
import { t as codexCatalogResidentHomeKey } from "./.setup/session-catalog-events-
|
|
38
|
+
import { t as codexCatalogResidentHomeKey } from "./.setup/session-catalog-events-DnLfF9Xo.mjs";
|
|
39
39
|
import { a as setCodexCatalogConnectionHomeResolver } from "./.setup/binding-connection-BIo1-hoT.mjs";
|
|
40
40
|
import { n as findCodexAppServerSpawnError } from "./.setup/spawn-error-CL3n6MAa.mjs";
|
|
41
|
-
import { r as requestCodexAppServerJson } from "./.setup/request-
|
|
41
|
+
import { r as requestCodexAppServerJson } from "./.setup/request-ufWmJNN1.mjs";
|
|
42
42
|
import { t as createCodexWebSearchProviderBase } from "./.setup/web-search-provider.shared-BrZmlqyR.mjs";
|
|
43
43
|
import { normalizePluginsConfig, resolveEffectiveEnableState, resolveLivePluginConfigObject, resolvePluginConfigObject } from "openclaw/plugin-sdk/plugin-config-runtime";
|
|
44
44
|
import { definePluginEntry } from "openclaw/plugin-sdk/plugin-entry";
|
|
@@ -70,7 +70,7 @@ import { createLazyRuntimeModule } from "openclaw/plugin-sdk/lazy-runtime";
|
|
|
70
70
|
//#region extensions/codex/src/account-usage.ts
|
|
71
71
|
function registerCodexAccountUsage(api) {
|
|
72
72
|
api.registerGatewayMethod("codex.accountUsage", async (options) => {
|
|
73
|
-
const { handleCodexAccountUsage } = await import("./.setup/account-usage-runtime-
|
|
73
|
+
const { handleCodexAccountUsage } = await import("./.setup/account-usage-runtime-DAt_3QG0.mjs");
|
|
74
74
|
await handleCodexAccountUsage(options);
|
|
75
75
|
}, { scope: "operator.admin" });
|
|
76
76
|
}
|
|
@@ -98,9 +98,9 @@ function createCodexAppServerConnectionHealthService(options) {
|
|
|
98
98
|
return;
|
|
99
99
|
}
|
|
100
100
|
if (runtime.start.transport !== "websocket") return;
|
|
101
|
-
const { getLeasedSharedCodexAppServerClient, releaseLeasedSharedCodexAppServerClient } = await import("./.setup/shared-client-
|
|
101
|
+
const { getLeasedSharedCodexAppServerClient, releaseLeasedSharedCodexAppServerClient } = await import("./.setup/shared-client-C0gEybHs.mjs").then((n) => n.v);
|
|
102
102
|
const { sleepWithAbort } = await import("openclaw/plugin-sdk/runtime-env");
|
|
103
|
-
const { isUnsupportedCodexAppServerVersionError } = await import("./.setup/client-
|
|
103
|
+
const { isUnsupportedCodexAppServerVersionError } = await import("./.setup/client-CafYfF2n.mjs").then((n) => n.n);
|
|
104
104
|
if (signal.aborted) return;
|
|
105
105
|
let leasedClient;
|
|
106
106
|
try {
|
|
@@ -314,7 +314,7 @@ function createCodexCommand(options) {
|
|
|
314
314
|
...ctx,
|
|
315
315
|
gatewayClientScopes: ctx.gatewayClientScopes?.slice()
|
|
316
316
|
};
|
|
317
|
-
const { handleCodexCommand } = await import("./.setup/command-dispatch-
|
|
317
|
+
const { handleCodexCommand } = await import("./.setup/command-dispatch-C2tNChTq.mjs");
|
|
318
318
|
return handleCodexCommand(commandContext, options);
|
|
319
319
|
}
|
|
320
320
|
};
|
|
@@ -385,7 +385,7 @@ async function handleCodexConversationInboundClaim(event, ctx, options) {
|
|
|
385
385
|
});
|
|
386
386
|
if (nativeExecutionBlock) return { text: nativeExecutionBlock };
|
|
387
387
|
const { getSessionBindingService } = await import("openclaw/plugin-sdk/conversation-binding-runtime");
|
|
388
|
-
const { runBoundTurnWithMissingThreadRecovery } = await import("./.setup/conversation-binding-
|
|
388
|
+
const { runBoundTurnWithMissingThreadRecovery } = await import("./.setup/conversation-binding-HX8U8A3K.mjs");
|
|
389
389
|
const current = options.bindingStore.read(identity);
|
|
390
390
|
if (!isCurrentPublicBinding(publicBinding, getSessionBindingService()) || expected && (!current || current.threadId !== expected.threadId || current.conversationStartId !== expected.conversationStartId) || !expected && current && data.start?.id && current.conversationStartId !== data.start.id) return { text: "This Codex conversation was detached or changed before its message could run." };
|
|
391
391
|
return await runBoundTurnWithMissingThreadRecovery({
|
|
@@ -419,7 +419,7 @@ async function handleCodexConversationBindingResolved(event, options) {
|
|
|
419
419
|
const binding = options.bindingStore.read(identity);
|
|
420
420
|
assertCodexBindingMayBeReplaced(binding, "clearing a denied conversation binding");
|
|
421
421
|
if (binding && (!data.start?.id || binding.conversationStartId === data.start.id)) await withCodexConversationThreadActivity(identity.bindingId, async () => {
|
|
422
|
-
const { retireCodexConversationThreadBinding } = await import("./.setup/thread-ownership-
|
|
422
|
+
const { retireCodexConversationThreadBinding } = await import("./.setup/thread-ownership-BJpeo5Xk.mjs").then((n) => n.o);
|
|
423
423
|
return retireCodexConversationThreadBinding({
|
|
424
424
|
bindingStore: options.bindingStore,
|
|
425
425
|
identity,
|
|
@@ -475,7 +475,7 @@ function createCodexPluginsTool(options) {
|
|
|
475
475
|
if (runtimeConfig() !== config || !isDeepStrictEqual(options.getPluginConfig(), pluginConfig) || !isDeepStrictEqual(codexBindingConnectionSelection(readBinding()), selection)) throw new Error("Codex plugin discovery ownership changed; retry the request.");
|
|
476
476
|
};
|
|
477
477
|
const workspaceDir = binding?.cwd?.trim() || options.context.workspaceDir?.trim() || resolveCodexDefaultWorkspaceDir(pluginConfig);
|
|
478
|
-
const request = options.request ?? (await import("./.setup/command-rpc-
|
|
478
|
+
const request = options.request ?? (await import("./.setup/command-rpc-CZmpQF4z.mjs").then((n) => n.n)).codexControlRequest;
|
|
479
479
|
const connection = await resolveCodexBindingAppServerConnection({
|
|
480
480
|
binding,
|
|
481
481
|
pluginConfig,
|
|
@@ -644,7 +644,7 @@ function createCodexThreadsTool(options) {
|
|
|
644
644
|
const threadResult = (response) => jsonResult(mayReadRawTranscripts ? response : redactNativeThreadResponse(response));
|
|
645
645
|
if ((action === "fork" || action === "rename" || action === "archive" || action === "unarchive") && supervision?.enabled === true && supervision.allowWriteControls !== true) throw new Error("Codex native thread mutations are disabled for this codex plugin supervision config.");
|
|
646
646
|
const run = async (archiveAdmission) => {
|
|
647
|
-
const request = options.request ?? (await import("./.setup/command-rpc-
|
|
647
|
+
const request = options.request ?? (await import("./.setup/command-rpc-CZmpQF4z.mjs").then((n) => n.n)).codexControlRequest;
|
|
648
648
|
const { isModelSelectionLocked, ModelSelectionLockedError } = await import("openclaw/plugin-sdk/model-session-runtime");
|
|
649
649
|
const { codexBindingConnectionSelection, resolveCodexBindingAppServerConnection } = await import("./.setup/binding-connection-BIo1-hoT.mjs").then((n) => n.n);
|
|
650
650
|
const { resolveCodexSupervisionAppServerRuntimeOptions } = await import("./.setup/config-runtime-BUH-IDVE.mjs").then((n) => n.t);
|
|
@@ -777,8 +777,8 @@ function createCodexThreadsTool(options) {
|
|
|
777
777
|
const usesSupervisionConnection = binding?.connectionScope === "supervision" || admissionPlugin.appServer?.homeScope !== "user" && supervision?.enabled === true;
|
|
778
778
|
if (attach && usesSupervisionConnection) throw new Error("Supervised Codex forks must stay detached; set attach=false.");
|
|
779
779
|
const forkOptions = await requestOptions();
|
|
780
|
-
const { retainCodexAppServerBindingSubscription, rollbackCodexAppServerBindingSubscription } = await import("./.setup/thread-ownership-
|
|
781
|
-
const { closeCodexStartupClientBestEffort } = await import("./.setup/attempt-client-cleanup-
|
|
780
|
+
const { retainCodexAppServerBindingSubscription, rollbackCodexAppServerBindingSubscription } = await import("./.setup/thread-ownership-BJpeo5Xk.mjs").then((n) => n.o);
|
|
781
|
+
const { closeCodexStartupClientBestEffort } = await import("./.setup/attempt-client-cleanup-DQBa7iiq.mjs").then((n) => n.a);
|
|
782
782
|
if (attach) {
|
|
783
783
|
assertCodexBindingMayBeReplaced(binding, "attaching a different native fork");
|
|
784
784
|
assertThreadIdle(await request(admissionConfig, CODEX_CONTROL_METHODS.readThread, {
|
|
@@ -2488,7 +2488,7 @@ async function requireEligibleCodexThread(params) {
|
|
|
2488
2488
|
remaining();
|
|
2489
2489
|
if (thread.id !== threadId || thread.ephemeral === true || !isInteractiveThreadSource(thread.source)) throw unverified();
|
|
2490
2490
|
if (!root) {
|
|
2491
|
-
const { CODEX_CATALOG_NATIVE_PAGE_LIMIT } = await import("./.setup/session-catalog-native-projection-
|
|
2491
|
+
const { CODEX_CATALOG_NATIVE_PAGE_LIMIT } = await import("./.setup/session-catalog-native-projection-CHtG8DwY.mjs").then((n) => n.a);
|
|
2492
2492
|
const { CODEX_CATALOG_MAX_ROWS } = await import("./.setup/session-catalog-limits-9Ay62KQ0.mjs").then((n) => n.r);
|
|
2493
2493
|
let cursor;
|
|
2494
2494
|
const seenCursors = /* @__PURE__ */ new Set();
|
|
@@ -2941,7 +2941,7 @@ function createCodexSessionCatalogControl(params) {
|
|
|
2941
2941
|
if (closed || generation !== config || residentEpoch !== epoch) throw new Error("Codex catalog configuration changed");
|
|
2942
2942
|
let index = indexes.get(homeId);
|
|
2943
2943
|
if (!index) {
|
|
2944
|
-
const [{ CodexCatalogIndex }, { canReuseCodexCatalogPreview, projectCodexCatalogDeltaPage, projectCodexCatalogPage }] = await Promise.all([import("./.setup/session-catalog-index-
|
|
2944
|
+
const [{ CodexCatalogIndex }, { canReuseCodexCatalogPreview, projectCodexCatalogDeltaPage, projectCodexCatalogPage }] = await Promise.all([import("./.setup/session-catalog-index-Bbph2EwS.mjs"), import("./.setup/session-catalog-projection-BgENBUS2.mjs")]);
|
|
2945
2945
|
source?.assertCurrent();
|
|
2946
2946
|
if (closed || generation !== config || residentEpoch !== epoch) throw new Error("Codex catalog configuration changed");
|
|
2947
2947
|
index = indexes.get(homeId);
|
|
@@ -3066,7 +3066,7 @@ function createCodexSessionCatalogControl(params) {
|
|
|
3066
3066
|
const runtime = source?.appServer ?? resolveRuntimeOptions({ pluginConfig });
|
|
3067
3067
|
const requestOptions = resolveRequestOptions(runtime.start, agentId, source);
|
|
3068
3068
|
return createCodexCatalogRequestSnapshot(runtime.requestTimeoutMs, async (method, requestParams, timeoutMs, assertCurrent, observation) => {
|
|
3069
|
-
const { codexControlRequest } = await import("./.setup/command-rpc-
|
|
3069
|
+
const { codexControlRequest } = await import("./.setup/command-rpc-CZmpQF4z.mjs").then((n) => n.n);
|
|
3070
3070
|
return await codexControlRequest(pluginConfig, method, requestParams, {
|
|
3071
3071
|
...requestOptions,
|
|
3072
3072
|
authProfileId: null,
|
|
@@ -3088,9 +3088,9 @@ function createCodexSessionCatalogControl(params) {
|
|
|
3088
3088
|
const runtime = source?.appServer ?? resolveRuntimeOptions({ pluginConfig });
|
|
3089
3089
|
const { agentDir, config: runtimeConfig, startOptions } = resolveRequestOptions(runtime.start, agentId, source);
|
|
3090
3090
|
let catalogIndex;
|
|
3091
|
-
const { getLeasedSharedCodexAppServerClient, releaseLeasedSharedCodexAppServerClient, retireSharedCodexAppServerClientIfCurrent } = await import("./.setup/shared-client-
|
|
3092
|
-
const { resolveCodexAppServerClientInstanceId } = await import("./.setup/client-
|
|
3093
|
-
const { requestCodexAppServerClientJson } = await import("./.setup/request-
|
|
3091
|
+
const { getLeasedSharedCodexAppServerClient, releaseLeasedSharedCodexAppServerClient, retireSharedCodexAppServerClientIfCurrent } = await import("./.setup/shared-client-C0gEybHs.mjs").then((n) => n.v);
|
|
3092
|
+
const { resolveCodexAppServerClientInstanceId } = await import("./.setup/client-CafYfF2n.mjs").then((n) => n.n);
|
|
3093
|
+
const { requestCodexAppServerClientJson } = await import("./.setup/request-ufWmJNN1.mjs").then((n) => n.i);
|
|
3094
3094
|
const client = await getLeasedSharedCodexAppServerClient({
|
|
3095
3095
|
agentDir,
|
|
3096
3096
|
config: runtimeConfig,
|
|
@@ -3159,7 +3159,7 @@ function createCodexSessionCatalogControl(params) {
|
|
|
3159
3159
|
await Promise.allSettled(residentRequests);
|
|
3160
3160
|
const clients = getSharedCodexAppServerClientState();
|
|
3161
3161
|
if (clients.liveClients.size > 0 || clients.startup.pending.size > 0) {
|
|
3162
|
-
const { clearSharedCodexAppServerClientAndWait } = await import("./.setup/shared-client-
|
|
3162
|
+
const { clearSharedCodexAppServerClientAndWait } = await import("./.setup/shared-client-C0gEybHs.mjs").then((n) => n.v);
|
|
3163
3163
|
await clearSharedCodexAppServerClientAndWait();
|
|
3164
3164
|
}
|
|
3165
3165
|
},
|
|
@@ -4159,7 +4159,7 @@ function createCodexSupervisionTools(options) {
|
|
|
4159
4159
|
}
|
|
4160
4160
|
//#endregion
|
|
4161
4161
|
//#region extensions/codex/src/web-search-provider.ts
|
|
4162
|
-
const loadCodexWebSearchRuntime = createLazyRuntimeModule(() => import("./.setup/web-search-provider.runtime-
|
|
4162
|
+
const loadCodexWebSearchRuntime = createLazyRuntimeModule(() => import("./.setup/web-search-provider.runtime-DEBVJch2.mjs"));
|
|
4163
4163
|
const CodexWebSearchSchema = {
|
|
4164
4164
|
type: "object",
|
|
4165
4165
|
properties: { query: {
|
|
@@ -4425,7 +4425,7 @@ var codex_default = definePluginEntry({
|
|
|
4425
4425
|
if (endedSessionKey && nextSessionKey && nextSessionKey !== endedSessionKey) return;
|
|
4426
4426
|
if (event.nextSessionId?.trim() === event.sessionId.trim()) return;
|
|
4427
4427
|
const config = resolveCurrentConfig();
|
|
4428
|
-
const [{ sessionBindingIdentity }, { retireCodexAppServerSessionGeneration }] = await Promise.all([import("./.setup/session-binding-_RE7vtVN.mjs").then((n) => n.a), import("./.setup/session-retirement-
|
|
4428
|
+
const [{ sessionBindingIdentity }, { retireCodexAppServerSessionGeneration }] = await Promise.all([import("./.setup/session-binding-_RE7vtVN.mjs").then((n) => n.a), import("./.setup/session-retirement-BdHruV7q.mjs")]);
|
|
4429
4429
|
await retireCodexAppServerSessionGeneration({
|
|
4430
4430
|
bindingStore,
|
|
4431
4431
|
identity: sessionBindingIdentity({
|
|
@@ -33,7 +33,7 @@ async function describeCodexImages(req, options) {
|
|
|
33
33
|
const model = req.model.trim();
|
|
34
34
|
if (!model) throw new Error("Codex image understanding requires model id.");
|
|
35
35
|
req.signal?.throwIfAborted();
|
|
36
|
-
const { runBoundedCodexAppServerTurn } = await import("./.setup/bounded-turn-
|
|
36
|
+
const { runBoundedCodexAppServerTurn } = await import("./.setup/bounded-turn-B91suzbV.mjs");
|
|
37
37
|
req.signal?.throwIfAborted();
|
|
38
38
|
const { text } = await runBoundedCodexAppServerTurn({
|
|
39
39
|
config: req.cfg,
|
|
@@ -73,7 +73,7 @@ async function extractCodexStructured(req, options) {
|
|
|
73
73
|
if (req.input.length === 0) throw new Error("Codex structured extraction requires at least one input.");
|
|
74
74
|
if (!req.input.some((entry) => entry.type === "image")) throw new Error("Codex structured extraction requires at least one image input.");
|
|
75
75
|
req.signal?.throwIfAborted();
|
|
76
|
-
const { runBoundedCodexAppServerTurn } = await import("./.setup/bounded-turn-
|
|
76
|
+
const { runBoundedCodexAppServerTurn } = await import("./.setup/bounded-turn-B91suzbV.mjs");
|
|
77
77
|
req.signal?.throwIfAborted();
|
|
78
78
|
const { text } = await runBoundedCodexAppServerTurn({
|
|
79
79
|
config: req.cfg,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { t as buildMigrationProvider } from "./.setup/provider-
|
|
1
|
+
export { t as buildMigrationProvider } from "./.setup/provider-D8R-IBhv.mjs";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openclaw/codex",
|
|
3
|
-
"version": "2026.10.
|
|
3
|
+
"version": "2026.10.9",
|
|
4
4
|
"description": "OpenClaw Codex app-server harness and native session supervision plugin.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -38,10 +38,10 @@
|
|
|
38
38
|
]
|
|
39
39
|
},
|
|
40
40
|
"compat": {
|
|
41
|
-
"pluginApi": ">=2026.10.
|
|
41
|
+
"pluginApi": ">=2026.10.9"
|
|
42
42
|
},
|
|
43
43
|
"build": {
|
|
44
|
-
"openclawVersion": "2026.10.
|
|
44
|
+
"openclawVersion": "2026.10.9",
|
|
45
45
|
"workerEntries": [
|
|
46
46
|
"./catalog-page.worker.ts"
|
|
47
47
|
]
|
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
"assets/activity.svg"
|
|
67
67
|
],
|
|
68
68
|
"peerDependencies": {
|
|
69
|
-
"openclaw": ">=2026.10.
|
|
69
|
+
"openclaw": ">=2026.10.9"
|
|
70
70
|
},
|
|
71
71
|
"peerDependenciesMeta": {
|
|
72
72
|
"openclaw": {
|
|
@@ -1,310 +0,0 @@
|
|
|
1
|
-
import { i as isJsonObject } from "./protocol-CANUwXJ3.mjs";
|
|
2
|
-
import { n as projectCodexCatalogNativeResponse, r as projectCodexCatalogNativeThread } from "./session-catalog-native-projection-C6KOqnIb.mjs";
|
|
3
|
-
import { embeddedAgentLog } from "openclaw/plugin-sdk/agent-harness-registration";
|
|
4
|
-
import { truncateUtf16Safe } from "openclaw/plugin-sdk/text-utility-runtime";
|
|
5
|
-
import { sanitizeTerminalText } from "openclaw/plugin-sdk/text-chunking";
|
|
6
|
-
//#region extensions/codex/src/app-server/protocol-json.ts
|
|
7
|
-
function isRpcResponse(message) {
|
|
8
|
-
return message !== null && typeof message === "object" && "id" in message && (typeof message.id === "number" || typeof message.id === "string") && !("method" in message);
|
|
9
|
-
}
|
|
10
|
-
//#endregion
|
|
11
|
-
//#region extensions/codex/src/app-server/client-line-preview.ts
|
|
12
|
-
const CODEX_APP_SERVER_PARSE_LOG_MAX = 500;
|
|
13
|
-
function redactCodexAppServerLinePreview(value) {
|
|
14
|
-
const redacted = value.replace(/\s+/g, " ").trim().replace(/(Bearer\s+)[A-Za-z0-9._~+/-]+/gi, "$1<redacted>").replace(/("(?:api_?key|authorization|token|access_token|refresh_token)"\s*:\s*")([^"]+)(")/gi, "$1<redacted>$3").replace(/\b([a-z0-9_]*(?:api_?key|authorization|access_token|refresh_token|token))(\s*=\s*)(["']?)[^\s"']+(\3)/gi, "$1$2$3<redacted>$4");
|
|
15
|
-
return redacted.length > CODEX_APP_SERVER_PARSE_LOG_MAX ? `${truncateUtf16Safe(redacted, CODEX_APP_SERVER_PARSE_LOG_MAX)}...` : redacted;
|
|
16
|
-
}
|
|
17
|
-
//#endregion
|
|
18
|
-
//#region extensions/codex/src/app-server/client-message-decoder.ts
|
|
19
|
-
const PARSE_BUFFER_MAX = 8388608;
|
|
20
|
-
const PARSE_BUFFER_MAX_LINES = 1e3;
|
|
21
|
-
const UNICODE_ESCAPE_QUAD = /^[\da-fA-F]{4}$/u;
|
|
22
|
-
/** Recovers the raw newlines observed inside native JSON string values. */
|
|
23
|
-
var CodexAppServerMessageDecoder = class {
|
|
24
|
-
constructor(reportError) {
|
|
25
|
-
this.reportError = reportError;
|
|
26
|
-
}
|
|
27
|
-
clear() {
|
|
28
|
-
this.pending = void 0;
|
|
29
|
-
}
|
|
30
|
-
get hasPending() {
|
|
31
|
-
return this.pending !== void 0;
|
|
32
|
-
}
|
|
33
|
-
parse(line) {
|
|
34
|
-
const rawLine = line.endsWith("\r") ? line.slice(0, -1) : line;
|
|
35
|
-
const pending = this.pending;
|
|
36
|
-
let candidate;
|
|
37
|
-
let withinBounds = true;
|
|
38
|
-
if (pending) {
|
|
39
|
-
pending.fragments.push(rawLine);
|
|
40
|
-
pending.length += 2 + rawLine.length;
|
|
41
|
-
withinBounds = pending.length <= PARSE_BUFFER_MAX && pending.fragments.length <= PARSE_BUFFER_MAX_LINES;
|
|
42
|
-
if (withinBounds && pending.inString && scanJsonString(rawLine, 0) === rawLine.length) return;
|
|
43
|
-
candidate = pending.fragments.join("\\n");
|
|
44
|
-
this.pending = void 0;
|
|
45
|
-
} else {
|
|
46
|
-
candidate = rawLine.trim();
|
|
47
|
-
if (!candidate) return;
|
|
48
|
-
}
|
|
49
|
-
try {
|
|
50
|
-
return JSON.parse(candidate);
|
|
51
|
-
} catch (error) {
|
|
52
|
-
const text = pending ? candidate : rawLine.trimStart();
|
|
53
|
-
const inString = withinBounds ? recoverableJsonStringState(text, error) : void 0;
|
|
54
|
-
if (inString !== void 0) {
|
|
55
|
-
if (pending) pending.inString = inString;
|
|
56
|
-
this.pending = pending ?? {
|
|
57
|
-
fragments: [text],
|
|
58
|
-
length: text.length,
|
|
59
|
-
inString
|
|
60
|
-
};
|
|
61
|
-
} else this.reportError(candidate, error, pending?.fragments.length ?? 1);
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
};
|
|
65
|
-
/** Undefined rejects malformed JSON; false retains a trailing escape for native parsing. */
|
|
66
|
-
function recoverableJsonStringState(value, error) {
|
|
67
|
-
if (!(error instanceof SyntaxError) || !value.startsWith("{") && !value.startsWith("[")) return;
|
|
68
|
-
const closers = [];
|
|
69
|
-
for (let index = 0; index < value.length; index++) {
|
|
70
|
-
const character = value[index];
|
|
71
|
-
if (character === "{" || character === "[") closers.push(character === "{" ? "}" : "]");
|
|
72
|
-
else if (character === "}" || character === "]") closers.pop();
|
|
73
|
-
if (character !== "\"") continue;
|
|
74
|
-
const end = scanJsonString(value, index + 1);
|
|
75
|
-
if (end < 0) return;
|
|
76
|
-
if (end >= value.length) {
|
|
77
|
-
const closing = closers.toReversed().join("");
|
|
78
|
-
for (const suffix of ["\"", "\":null"]) try {
|
|
79
|
-
JSON.parse(`${value}\\n${suffix}${closing}`);
|
|
80
|
-
return end === value.length;
|
|
81
|
-
} catch {}
|
|
82
|
-
return;
|
|
83
|
-
}
|
|
84
|
-
index = end;
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
/** Finds a closing quote; incomplete or invalid escapes require native parsing. */
|
|
88
|
-
function scanJsonString(value, start) {
|
|
89
|
-
for (let index = start; index < value.length; index++) {
|
|
90
|
-
const character = value[index];
|
|
91
|
-
if (character === "\"") return index;
|
|
92
|
-
if (value.charCodeAt(index) < 32) return -1;
|
|
93
|
-
if (character !== "\\") continue;
|
|
94
|
-
const escape = value[++index];
|
|
95
|
-
if (!escape) return value.length + 1;
|
|
96
|
-
else if (escape === "u") {
|
|
97
|
-
if (!UNICODE_ESCAPE_QUAD.test(value.slice(index + 1, index + 5))) return -1;
|
|
98
|
-
index += 4;
|
|
99
|
-
} else if (!"\"\\/bfnrt".includes(escape)) return -1;
|
|
100
|
-
}
|
|
101
|
-
return value.length;
|
|
102
|
-
}
|
|
103
|
-
//#endregion
|
|
104
|
-
//#region extensions/codex/src/app-server/client-message-frames.ts
|
|
105
|
-
function createCodexAppServerMessageWriter(options) {
|
|
106
|
-
return (message, onError, beforeWrite, onWriteResult) => {
|
|
107
|
-
if (options.isClosed()) return;
|
|
108
|
-
const child = options.getTransport();
|
|
109
|
-
const id = "id" in message ? message.id : void 0;
|
|
110
|
-
const method = "method" in message ? message.method : void 0;
|
|
111
|
-
const frame = JSON.stringify(message, (_key, value) => typeof value === "string" ? value.replace(UNPAIRED_SURROGATE_RE, "") : value) ?? "null";
|
|
112
|
-
if (child.maxFrameBytes && Buffer.byteLength(frame) > child.maxFrameBytes) throw new Error("Codex request exceeds the transport frame limit; reduce attached images or context.");
|
|
113
|
-
beforeWrite?.();
|
|
114
|
-
if (method === "command/exec") options.onNativeExecution();
|
|
115
|
-
child.stdin.write(`${frame}\n`, (error) => {
|
|
116
|
-
onWriteResult?.(error);
|
|
117
|
-
if (error) {
|
|
118
|
-
embeddedAgentLog.warn("codex app-server write failed", {
|
|
119
|
-
error,
|
|
120
|
-
id,
|
|
121
|
-
method
|
|
122
|
-
});
|
|
123
|
-
onError?.(error);
|
|
124
|
-
}
|
|
125
|
-
});
|
|
126
|
-
};
|
|
127
|
-
}
|
|
128
|
-
const UNPAIRED_SURROGATE_RE = /[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?<![\uD800-\uDBFF])[\uDC00-\uDFFF]/g;
|
|
129
|
-
/** One byte reader owns framing and stops at an asynchronous page decode. */
|
|
130
|
-
function listenCodexAppServerLines(input, onLine, onError) {
|
|
131
|
-
let fragments = [];
|
|
132
|
-
let length = 0;
|
|
133
|
-
let remainder;
|
|
134
|
-
let waiting = false;
|
|
135
|
-
let ended = false;
|
|
136
|
-
let closed = false;
|
|
137
|
-
const close = () => {
|
|
138
|
-
closed = true;
|
|
139
|
-
fragments = [];
|
|
140
|
-
remainder = void 0;
|
|
141
|
-
input.off("data", onData);
|
|
142
|
-
input.off("end", onEnd);
|
|
143
|
-
input.pause();
|
|
144
|
-
};
|
|
145
|
-
const deliver = (tail) => {
|
|
146
|
-
const line = fragments.length ? Buffer.concat([...fragments, tail], length + tail.length) : tail;
|
|
147
|
-
fragments = [];
|
|
148
|
-
length = 0;
|
|
149
|
-
const completion = onLine(line);
|
|
150
|
-
if (!completion) return true;
|
|
151
|
-
waiting = true;
|
|
152
|
-
input.pause();
|
|
153
|
-
completion.then(() => {
|
|
154
|
-
waiting = false;
|
|
155
|
-
if (!closed) {
|
|
156
|
-
drain();
|
|
157
|
-
if (!waiting && !ended && !closed) input.resume();
|
|
158
|
-
}
|
|
159
|
-
}).catch((error) => {
|
|
160
|
-
close();
|
|
161
|
-
onError(error);
|
|
162
|
-
});
|
|
163
|
-
return false;
|
|
164
|
-
};
|
|
165
|
-
const drain = () => {
|
|
166
|
-
try {
|
|
167
|
-
const chunk = remainder;
|
|
168
|
-
remainder = void 0;
|
|
169
|
-
if (chunk) {
|
|
170
|
-
let start = 0;
|
|
171
|
-
let end;
|
|
172
|
-
while ((end = chunk.indexOf(10, start)) !== -1) {
|
|
173
|
-
if (closed) return;
|
|
174
|
-
remainder = chunk.subarray(end + 1);
|
|
175
|
-
if (!deliver(chunk.subarray(start, end))) return;
|
|
176
|
-
remainder = void 0;
|
|
177
|
-
start = end + 1;
|
|
178
|
-
}
|
|
179
|
-
if (!closed && start < chunk.length) {
|
|
180
|
-
fragments.push(chunk.subarray(start));
|
|
181
|
-
length += chunk.length - start;
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
if (ended && !closed) {
|
|
185
|
-
if (length && !deliver(Buffer.alloc(0))) return;
|
|
186
|
-
close();
|
|
187
|
-
}
|
|
188
|
-
} catch (error) {
|
|
189
|
-
close();
|
|
190
|
-
onError(error);
|
|
191
|
-
}
|
|
192
|
-
};
|
|
193
|
-
const onData = (chunk) => {
|
|
194
|
-
remainder = chunk;
|
|
195
|
-
drain();
|
|
196
|
-
};
|
|
197
|
-
const onEnd = () => {
|
|
198
|
-
ended = true;
|
|
199
|
-
if (!waiting) drain();
|
|
200
|
-
};
|
|
201
|
-
input.on("data", onData);
|
|
202
|
-
input.once("end", onEnd);
|
|
203
|
-
return close;
|
|
204
|
-
}
|
|
205
|
-
function codexCatalogResponseRoute(id) {
|
|
206
|
-
return typeof id === "number" && Number.isSafeInteger(id) && id >= 2 ** 52 ? {
|
|
207
|
-
id,
|
|
208
|
-
kind: id % 2 === 1 ? "list" : "thread"
|
|
209
|
-
} : void 0;
|
|
210
|
-
}
|
|
211
|
-
/** Read bounded envelope keys and IDs; skip native payload strings as bytes. */
|
|
212
|
-
function readCodexCatalogDecodeRoute(line) {
|
|
213
|
-
let depth = 0;
|
|
214
|
-
let route;
|
|
215
|
-
let response = false;
|
|
216
|
-
for (let index = 0; index < line.length; index++) {
|
|
217
|
-
const byte = line[index];
|
|
218
|
-
if (byte === 123 || byte === 91) depth++;
|
|
219
|
-
else if (byte === 125 || byte === 93) depth--;
|
|
220
|
-
else if (byte === 34) {
|
|
221
|
-
const start = index;
|
|
222
|
-
for (;;) {
|
|
223
|
-
index = line.indexOf(34, index + 1);
|
|
224
|
-
if (index < 0) return "unresolved";
|
|
225
|
-
let slash = index - 1;
|
|
226
|
-
while (line[slash] === 92) slash--;
|
|
227
|
-
if ((index - slash) % 2 === 1) break;
|
|
228
|
-
}
|
|
229
|
-
if (depth !== 1 || index - start > 64) continue;
|
|
230
|
-
let colon = index + 1;
|
|
231
|
-
while (line[colon] === 32 || line[colon] === 9 || line[colon] === 13) colon++;
|
|
232
|
-
if (line[colon] !== 58) continue;
|
|
233
|
-
const token = line.toString("utf8", start, index + 1);
|
|
234
|
-
let key = token.slice(1, -1);
|
|
235
|
-
if (token.includes("\\")) try {
|
|
236
|
-
key = JSON.parse(token);
|
|
237
|
-
} catch {
|
|
238
|
-
return "unresolved";
|
|
239
|
-
}
|
|
240
|
-
if (key === "method") return;
|
|
241
|
-
if (key === "result" || key === "error") {
|
|
242
|
-
response = true;
|
|
243
|
-
if (route) return route;
|
|
244
|
-
}
|
|
245
|
-
if (key !== "id") continue;
|
|
246
|
-
const match = /^\s*:\s*(\d+)(?=\s*[,}])/u.exec(line.toString("utf8", index + 1, Math.min(index + 100, line.length)));
|
|
247
|
-
if (!match) continue;
|
|
248
|
-
route = codexCatalogResponseRoute(Number(match[1]));
|
|
249
|
-
if (!route || response) return route;
|
|
250
|
-
}
|
|
251
|
-
}
|
|
252
|
-
return response || route ? "unresolved" : void 0;
|
|
253
|
-
}
|
|
254
|
-
//#endregion
|
|
255
|
-
//#region extensions/codex/src/app-server/client-catalog-response.ts
|
|
256
|
-
/** The worker retains recovery fragments, but never a completed native page. */
|
|
257
|
-
function createCodexCatalogDecoder() {
|
|
258
|
-
let failures = [];
|
|
259
|
-
const decoder = new CodexAppServerMessageDecoder((value, error, fragmentCount) => {
|
|
260
|
-
failures.push({
|
|
261
|
-
value: redactCodexAppServerLinePreview(value),
|
|
262
|
-
error,
|
|
263
|
-
fragmentCount
|
|
264
|
-
});
|
|
265
|
-
});
|
|
266
|
-
return (input) => {
|
|
267
|
-
failures = [];
|
|
268
|
-
const result = projectCodexCatalogMessage(decoder.parse(Buffer.from(input.bytes.buffer, input.bytes.byteOffset, input.bytes.byteLength).toString("utf8")), input);
|
|
269
|
-
result.pending = decoder.hasPending;
|
|
270
|
-
result.failures = failures;
|
|
271
|
-
return result;
|
|
272
|
-
};
|
|
273
|
-
}
|
|
274
|
-
function projectCodexCatalogMessage(parsed, input, cachedPreview) {
|
|
275
|
-
const result = {
|
|
276
|
-
pending: false,
|
|
277
|
-
failures: []
|
|
278
|
-
};
|
|
279
|
-
if (!isJsonObject(parsed)) return result;
|
|
280
|
-
result.message = parsed;
|
|
281
|
-
if (!isRpcResponse(parsed)) return result;
|
|
282
|
-
const message = parsed;
|
|
283
|
-
const route = codexCatalogResponseRoute(message.id);
|
|
284
|
-
if (message.error || !route) return result;
|
|
285
|
-
const remainingRows = input.route === "unresolved" ? input.catalogRows?.has(route.id) ? input.catalogRows.get(route.id) : 0 : input.remainingRows;
|
|
286
|
-
try {
|
|
287
|
-
if (!isJsonObject(message.result)) throw new Error("Codex catalog response contains an invalid result");
|
|
288
|
-
if (route.kind === "list") {
|
|
289
|
-
const raw = message.result;
|
|
290
|
-
message.result = projectCodexCatalogNativeResponse(raw, sanitizeTerminalText, cachedPreview, remainingRows);
|
|
291
|
-
if (!cachedPreview) result.previewStates = Array.isArray(raw.data) ? raw.data.slice(0, Array.isArray(message.result.data) ? message.result.data.length : 0).map((row) => isJsonObject(row) && typeof row.preview === "string" ? Boolean(row.preview) : void 0) : [];
|
|
292
|
-
} else {
|
|
293
|
-
const thread = message.result.thread;
|
|
294
|
-
message.result = { thread: {
|
|
295
|
-
...projectCodexCatalogNativeThread(thread, sanitizeTerminalText),
|
|
296
|
-
...isJsonObject(thread) && typeof thread.cwd === "string" ? { cwd: thread.cwd } : {},
|
|
297
|
-
...isJsonObject(thread) && (thread.historyMode === "paginated" || thread.historyMode === "legacy") ? { historyMode: thread.historyMode } : {}
|
|
298
|
-
} };
|
|
299
|
-
}
|
|
300
|
-
} catch (error) {
|
|
301
|
-
delete result.message;
|
|
302
|
-
result.projectionError = {
|
|
303
|
-
id: route.id,
|
|
304
|
-
error: error instanceof Error ? error : new Error("Codex catalog projection failed", { cause: error })
|
|
305
|
-
};
|
|
306
|
-
}
|
|
307
|
-
return result;
|
|
308
|
-
}
|
|
309
|
-
//#endregion
|
|
310
|
-
export { readCodexCatalogDecodeRoute as a, isRpcResponse as c, listenCodexAppServerLines as i, projectCodexCatalogMessage as n, CodexAppServerMessageDecoder as o, createCodexAppServerMessageWriter as r, redactCodexAppServerLinePreview as s, createCodexCatalogDecoder as t };
|