@openclaw/codex 2026.9.1 → 2026.9.2
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/api.js +6 -6
- package/dist/{attempt-client-cleanup-DYHcRQAa.js → attempt-client-cleanup-Bp1ZOnk2.js} +76 -32
- package/dist/{attempt-context-DmQUNWwT.js → attempt-context-CSazkWns.js} +6 -6
- package/dist/{bounded-turn-wzJrwKKe.js → bounded-turn-DxGJRYbY.js} +46 -45
- package/dist/{capabilities-dIjNVCYH.js → capabilities-B1mgvpP8.js} +2 -1
- package/dist/cli-metadata.js +1 -1
- package/dist/{command-formatters-CLHhEB1Q.js → command-formatters-DSbGMXA0.js} +2 -2
- package/dist/{command-handlers-CTGb2csu.js → command-handlers-DOJvGv6-.js} +146 -74
- package/dist/{compact-_t0HQrUS.js → compact-Y_xBqrHN.js} +83 -48
- package/dist/{config-BhmfC1s6.js → config-CyapYSji.js} +47 -105
- package/dist/config-utils-C57JiJrU.js +69 -0
- package/dist/doctor-contract-api.js +4 -5
- package/dist/{dynamic-tools-BU9tmlYm.js → dynamic-tools-BwpvTxaX.js} +678 -638
- package/dist/{effective-mcp-catalog-DzYBW4h1.js → effective-mcp-catalog-CY9Jn4bA.js} +4 -3
- package/dist/{event-projector-assistant-message-DHRFXKbS.js → event-projector-assistant-message-B9kp6iGC.js} +11 -2
- package/dist/{event-projector-usage-C5mcrGjp.js → event-projector-usage-ZqEVbAEY.js} +30 -13
- package/dist/{harness-DXVZ5II5.js → harness-Czh2Sdoc.js} +36 -13
- package/dist/harness.js +1 -1
- package/dist/{image-payload-sanitizer-CnfoUPCE.js → image-payload-sanitizer-tupAr-2o.js} +29 -15
- package/dist/index.js +68 -84
- package/dist/{isolated-completion-kg9kv4iH.js → isolated-completion-CRh-51AK.js} +9 -21
- package/dist/{managed-binary-4-Vjz5GH.js → managed-binary-DcpnJF9x.js} +105 -73
- package/dist/media-understanding-provider.js +1 -1
- package/dist/{model-catalog-CUM68Hkl.js → model-catalog-DT5vo6qo.js} +5 -5
- package/dist/{models-sYnEc0gd.js → models-CcrgSMQR.js} +4 -4
- package/dist/{native-subagent-monitor-CnH147jH.js → native-subagent-monitor-B3bvQGcg.js} +12 -11
- package/dist/{node-exec-server.runtime-CstNHCmC.js → node-exec-server.runtime-nfbUOtUB.js} +3 -3
- package/dist/{plugin-approval-roundtrip-CNe-Xrjx.js → plugin-approval-roundtrip-aQVdyL5g.js} +1 -1
- package/dist/{plugin-marketplace-discovery-CfFlKqDl.js → plugin-marketplace-discovery-B7gHXJ3d.js} +35 -22
- package/dist/{plugin-metadata-cache-BFrPhb2c.js → plugin-metadata-cache-BwCLTY_U.js} +5 -5
- package/dist/{provider-capabilities-DW5p4k9w.js → provider-capabilities-BpG9Ltc5.js} +2 -2
- package/dist/{rate-limits-CawQJfUS.js → rate-limits-Fx_l4eNa.js} +1 -1
- package/dist/{request-DYAI5FQE.js → request-C8H22rPi.js} +2 -2
- package/dist/{run-attempt-D1hJO4fX.js → run-attempt-BzthFQSM.js} +977 -723
- package/dist/{runtime-artifact-C3jVimFn.js → runtime-artifact-Bh_gf6-t.js} +3 -3
- package/dist/{session-binding-BHuTCRZQ.js → session-binding-4Ki04sW-.js} +94 -282
- package/dist/session-binding-record-CyaXZvTe.js +270 -0
- package/dist/{session-catalog-yyvTWFOw.js → session-catalog-B47uwekb.js} +266 -114
- package/dist/{session-cli-CmFEXMAM.js → session-cli-BjLhpmS1.js} +1 -1
- package/dist/session-history-DWmMqiqW.js +93 -0
- package/dist/session-history-read-LHldwvyh.js +36 -0
- package/dist/session-history-worker-runtime.js +48 -0
- package/dist/{settled-turn-context-D3SNWtUn.js → session-history.worker-zZVcx0ME.js} +30 -31
- package/dist/session-history.worker.js +2 -0
- package/dist/{session-initialization-BeWzjGiR.js → session-initialization-BCFVnLL4.js} +2 -1
- package/dist/{session-permission-policy-DeWVTCMj.js → session-permission-policy-BaueHmSj.js} +1 -1
- package/dist/{session-retirement-BujDjXVF.js → session-retirement-DNdmYdFc.js} +7 -7
- package/dist/{session-upstream-marker-C351-5Qw.js → session-upstream-marker-DReTpGz6.js} +4 -3
- package/dist/settled-turn-context-BOM3Y1pl.js +45 -0
- package/dist/{settled-turn-finalizer-BVJx4yoc.js → settled-turn-finalizer-BI-b1sry.js} +53 -42
- package/dist/{shared-client-DxcfF9KX.js → shared-client-CKhX2kFt.js} +279 -268
- package/dist/{side-question-BTZAII4l.js → side-question-B6DWAw1A.js} +85 -36
- package/dist/{thread-lifecycle-DAcEJ_Om.js → thread-lifecycle-DPK30jad.js} +382 -388
- package/dist/{thread-ownership-zGokd8i1.js → thread-ownership-CbucAmmp.js} +5 -5
- package/dist/thread-policy-CTalhWFy.js +105 -0
- package/dist/{thread-resume-C7pyVKeW.js → thread-resume-BLgqkUc1.js} +7 -7
- package/dist/{transcript-mirror-DTUxFWa_.js → transcript-mirror-_njEB84z.js} +67 -125
- package/dist/transcript-mirror-attestation-Byl34PC-.js +76 -0
- package/dist/{transport-stdio-CyPldczm.js → transport-stdio-CzTngV0j.js} +10 -8
- package/dist/{upstream-session-fork-CYlBIGVt.js → upstream-session-fork-1fwbNKzQ.js} +85 -165
- package/dist/{usage-Bj-rrzkR.js → usage-i9fv5-4m.js} +3 -3
- package/dist/{web-search-provider.runtime-D2FWSK4w.js → web-search-provider.runtime-DKQn67A7.js} +3 -3
- package/package.json +6 -6
- package/dist/binding-connection-E6uDsPlx.js +0 -45
- package/dist/launch-args-RXQwn8zV.js +0 -90
- package/dist/session-history-C5J1AKzG.js +0 -87
- package/dist/thread-policy-g4KbJPzp.js +0 -54
package/dist/index.js
CHANGED
|
@@ -1,50 +1,52 @@
|
|
|
1
1
|
import { registerCodexCliMetadata } from "./cli-metadata.js";
|
|
2
|
-
import { n as createCodexAppServerNativeCompaction, t as createCodexAppServerAgentHarness } from "./harness-
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
2
|
+
import { n as createCodexAppServerNativeCompaction, t as createCodexAppServerAgentHarness } from "./harness-Czh2Sdoc.js";
|
|
3
|
+
import { m as CODEX_PLUGINS_MARKETPLACE_NAME } from "./config-utils-C57JiJrU.js";
|
|
4
|
+
import { l as sessionBindingIdentity, s as readCurrentCodexAppServerBinding } from "./session-binding-record-CyaXZvTe.js";
|
|
5
|
+
import { A as resolveOpenClawExecPolicyForCodexAppServer, B as isJsonObject, L as CODEX_INTERACTIVE_THREAD_SOURCE_KINDS, O as readCodexPluginConfig, c as assertCodexAppServerConnectionSecurity, i as resolveCodexAppServerRuntimeOptions, m as canUseCodexModelBackedApprovalsReviewerForModel, n as codexSandboxPolicyForTurn, s as resolveCodexSupervisionAppServerRuntimeOptions, t as codexAppServerStartOptionsKey, y as readCodexRequirementsToml } from "./config-CyapYSji.js";
|
|
6
|
+
import { B as isCodexAppServerIndeterminateRequestCancellationError, Bt as resolveCodexAppServerAuthAccountCacheKey, C as withLeasedCodexAppServerClientStartSelectionRetry, Dt as isCodexAppServerClientRuntimeLive, Et as hasCodexAppServerLiveThread, G as isUnsupportedCodexAppServerVersionError, H as isCodexAppServerOverloadError, Ht as resolveCodexAppServerAuthProfileIdForAgent, O as createCodexDesktopGenerationService, Ot as isCodexAppServerLiveThreadClaimed, Q as assertCodexThreadAcceptsDirectInput, Wt as resolveCodexAppServerFallbackApiKeyCacheKey, Y as CodexThreadDirectInputError, _ as retainSharedCodexAppServerClientByInstanceId, b as retireSharedCodexAppServerClientsBeforeDesktopGeneration, c as getLeasedSharedCodexAppServerClient, h as releaseLeasedSharedCodexAppServerClient, jt as releaseCodexAppServerLiveThread, m as releaseCodexAppServerClientLease, nt as assertCodexThreadStartResponse, o as clearSharedCodexAppServerClientIfCurrentAndWait, wt as consumeCodexAppServerLiveThread } from "./shared-client-CKhX2kFt.js";
|
|
7
|
+
import { a as setManagedCodexPluginRoot } from "./managed-binary-DcpnJF9x.js";
|
|
6
8
|
import { n as CODEX_APP_SERVER_BINDING_NAMESPACE, t as CODEX_APP_SERVER_BINDING_MAX_ENTRIES } from "./session-binding-meta-B7aEMU7g.js";
|
|
7
|
-
import {
|
|
8
|
-
import { o as createCodexAppServerProcessReaperService } from "./transport-stdio-
|
|
9
|
-
import { a as closeCodexStartupClientBestEffort,
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import { a as rollbackCodexAppServerBindingSubscription, c as withExclusiveCodexAppServerThread, i as retireCodexConversationThreadBinding, l as isIncognitoSessionKey, n as releaseCodexAppServerBindingSubscription, r as retainCodexAppServerBindingSubscription, s as withCodexConversationThreadActivity, t as isSameCodexAppServerThreadOwner } from "./thread-ownership-
|
|
14
|
-
import {
|
|
15
|
-
import { c as
|
|
9
|
+
import { a as isCodexAppServerNativeAuthProfile, n as assertCodexBindingMayBeReplaced, o as normalizeCodexAppServerBindingModelProvider } from "./session-binding-4Ki04sW-.js";
|
|
10
|
+
import { o as createCodexAppServerProcessReaperService } from "./transport-stdio-CzTngV0j.js";
|
|
11
|
+
import { a as closeCodexStartupClientBestEffort, d as unsubscribeCodexThreadBestEffort, h as isCodexNotificationForTurn, l as retireUnsafeCodexTurnClientBestEffort, o as interruptCodexTurnAndWaitBestEffort, p as getCodexAppServerTurnRouter, s as isCodexAppServerUnsafeSubscriptionError } from "./attempt-client-cleanup-Bp1ZOnk2.js";
|
|
12
|
+
import { i as isAssistantCommentaryCompletionNotification } from "./event-projector-usage-ZqEVbAEY.js";
|
|
13
|
+
import { c as defaultCodexAppInventoryCache, i as buildCodexPluginAppCacheKey, t as resumeCodexAppServerThread } from "./thread-resume-BLgqkUc1.js";
|
|
14
|
+
import { E as resolveCodexAppServerRequestModelSelection, Et as mergeCodexThreadConfigs, J as createCodexManagedThreadStore, K as CODEX_MANAGED_THREAD_MAX_ENTRIES, Nt as pluginReadParams, Tt as buildDisabledAppsConfigPatch, jt as isOpenAiCuratedMarketplace, k as buildCodexProjectDocThreadConfig, kt as ensureCodexPluginActivation, q as CODEX_MANAGED_THREAD_NAMESPACE, w as CODEX_NATIVE_PERSONALITY_NONE } from "./thread-lifecycle-DPK30jad.js";
|
|
15
|
+
import { a as rollbackCodexAppServerBindingSubscription, c as withExclusiveCodexAppServerThread, i as retireCodexConversationThreadBinding, l as isIncognitoSessionKey, n as releaseCodexAppServerBindingSubscription, r as retainCodexAppServerBindingSubscription, s as withCodexConversationThreadActivity, t as isSameCodexAppServerThreadOwner } from "./thread-ownership-CbucAmmp.js";
|
|
16
|
+
import { s as resolveCodexBindingAppServerConnection } from "./thread-policy-CTalhWFy.js";
|
|
17
|
+
import { c as projectBoundedCodexVisibleSessionHistory } from "./transcript-mirror-_njEB84z.js";
|
|
18
|
+
import { c as resolveCodexNativeSandboxBlock, i as requestCodexAppServerJson, o as withCodexAppServerJsonClient, s as resolveCodexNativeExecutionBlock } from "./request-C8H22rPi.js";
|
|
16
19
|
import { buildCodexMediaUnderstandingProvider } from "./media-understanding-provider.js";
|
|
17
|
-
import { n as describeControlFailure, t as CODEX_CONTROL_METHODS } from "./capabilities-
|
|
18
|
-
import { a as formatCodexDisplayText } from "./command-formatters-
|
|
19
|
-
import { a as resolveCodexAppServerForModelProvider, i as resolveCodexSessionPermissionCwd, n as applyCodexSessionPermissionPolicy, t as CODEX_SESSION_PERMISSION_EXEC_MODES } from "./session-permission-policy-
|
|
20
|
-
import { f as trackCodexConversationActiveTurn, g as canMutateCodexHost, h as CODEX_NATIVE_EXECUTION_AUTH_ERROR, t as discoverCodexMarketplacePlugins } from "./plugin-marketplace-discovery-
|
|
20
|
+
import { n as describeControlFailure, t as CODEX_CONTROL_METHODS } from "./capabilities-B1mgvpP8.js";
|
|
21
|
+
import { a as formatCodexDisplayText } from "./command-formatters-DSbGMXA0.js";
|
|
22
|
+
import { a as resolveCodexAppServerForModelProvider, i as resolveCodexSessionPermissionCwd, n as applyCodexSessionPermissionPolicy, t as CODEX_SESSION_PERMISSION_EXEC_MODES } from "./session-permission-policy-BaueHmSj.js";
|
|
23
|
+
import { f as trackCodexConversationActiveTurn, g as canMutateCodexHost, h as CODEX_NATIVE_EXECUTION_AUTH_ERROR, t as discoverCodexMarketplacePlugins } from "./plugin-marketplace-discovery-B7gHXJ3d.js";
|
|
21
24
|
import { a as readCodexConversationBindingDataRecord, i as readCodexConversationBindingData, o as resolveCodexDefaultWorkspaceDir, r as createCodexConversationBindingData } from "./conversation-binding-data-BiodpIzq.js";
|
|
22
|
-
import { n as
|
|
23
|
-
import { d as createCodexCliSessionNodeHostCommands, f as createCodexCliSessionNodeInvokePolicies, g as resumeCodexCliSessionOnNode, h as resolveCodexCliSessionForBindingOnNode, i as createCodexSessionCatalogNodeHostCommands, m as listCodexCliSessionsOnNode, n as createCodexSessionCatalogNodeInvokePolicies, o as assertCodexArchiveDescendantsUnowned, r as createCodexSessionCatalogControl, s as codexControlRequest, t as codexSessionCatalogRuntime } from "./session-catalog-yyvTWFOw.js";
|
|
25
|
+
import { d as createCodexCliSessionNodeHostCommands, f as createCodexCliSessionNodeInvokePolicies, g as resumeCodexCliSessionOnNode, h as resolveCodexCliSessionForBindingOnNode, i as createCodexSessionCatalogNodeHostCommands, m as listCodexCliSessionsOnNode, n as createCodexSessionCatalogNodeInvokePolicies, o as assertCodexArchiveDescendantsUnowned, r as createCodexSessionCatalogControl, s as codexControlRequest, t as codexSessionCatalogRuntime } from "./session-catalog-B47uwekb.js";
|
|
24
26
|
import { t as createCodexWebSearchProviderBase } from "./web-search-provider.shared-BrZmlqyR.js";
|
|
25
27
|
import { mutateConfigFile } from "openclaw/plugin-sdk/config-mutation";
|
|
26
28
|
import { normalizePluginsConfig, resolveEffectiveEnableState, resolveLivePluginConfigObject, resolvePluginConfigObject } from "openclaw/plugin-sdk/plugin-config-runtime";
|
|
27
29
|
import { definePluginEntry } from "openclaw/plugin-sdk/plugin-entry";
|
|
28
30
|
import { asBoolean, asOptionalRecord, asSafeIntegerInRange, isRecord, normalizeOptionalString, normalizeSingleOrTrimmedStringList, uniqueStrings } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
31
|
+
import { resolveSessionAgentIdsStrict } from "openclaw/plugin-sdk/agent-scope-runtime";
|
|
32
|
+
import { getSessionEntry, resolveStorePath, resolveTranscriptSessionKeyBySessionId } from "openclaw/plugin-sdk/session-store-runtime";
|
|
33
|
+
import { parseStrictNonNegativeInteger, resolveTimerTimeoutMs } from "openclaw/plugin-sdk/number-runtime";
|
|
29
34
|
import fs from "node:fs/promises";
|
|
30
35
|
import path from "node:path";
|
|
31
|
-
import { parseStrictNonNegativeInteger, resolveTimerTimeoutMs } from "openclaw/plugin-sdk/number-runtime";
|
|
32
36
|
import { embeddedAgentLog, formatErrorMessage, resolveActiveEmbeddedRunSessionId, resolveSandboxContext } from "openclaw/plugin-sdk/agent-harness-runtime";
|
|
33
37
|
import { canonicalPathFromExistingAncestor, isPathInside } from "openclaw/plugin-sdk/file-access-runtime";
|
|
34
38
|
import os from "node:os";
|
|
35
|
-
import { loadAuthProfileStoreWithoutExternalProfiles, resolveAgentConfig, resolveAgentWorkspaceDir, resolveDefaultAgentDir, resolveDefaultAgentId } from "openclaw/plugin-sdk/agent-runtime";
|
|
39
|
+
import { loadAuthProfileStoreWithoutExternalProfiles, resolveAgentConfig as resolveAgentConfig$1, resolveAgentWorkspaceDir, resolveDefaultAgentDir, resolveDefaultAgentId as resolveDefaultAgentId$1 } from "openclaw/plugin-sdk/agent-runtime";
|
|
36
40
|
import { applyAuthProfileConfig, buildApiKeyCredential, buildOauthProviderAuthResult, buildOpenAICodexCredentialExtra, readCodexCliCredentialsCached, resolveOpenAICodexAuthIdentity, resolveOpenAICodexImportProfileName, updateAuthProfileStoreWithLock } from "openclaw/plugin-sdk/provider-auth";
|
|
37
41
|
import { extractErrorCode, pathExists } from "openclaw/plugin-sdk/security-runtime";
|
|
38
|
-
import { resolveSessionAgentIdsStrict } from "openclaw/plugin-sdk/agent-scope-runtime";
|
|
39
42
|
import { loadExecApprovals } from "openclaw/plugin-sdk/exec-approvals-runtime";
|
|
40
|
-
import { getSessionEntry, resolveStorePath, resolveTranscriptSessionKeyBySessionId } from "openclaw/plugin-sdk/session-store-runtime";
|
|
41
43
|
import { coerceErrorMessage } from "openclaw/plugin-sdk/error-runtime";
|
|
42
|
-
import { fileURLToPath } from "node:url";
|
|
43
44
|
import { expectDefined } from "openclaw/plugin-sdk/expect-runtime";
|
|
44
45
|
import { KeyedAsyncQueue } from "openclaw/plugin-sdk/keyed-async-queue";
|
|
45
46
|
import { readVisibleSessionTranscriptMessageEntries } from "openclaw/plugin-sdk/session-transcript-runtime";
|
|
46
47
|
import { getSessionBindingService } from "openclaw/plugin-sdk/conversation-binding-runtime";
|
|
47
48
|
import { ModelSelectionLockedError, isModelSelectionLocked } from "openclaw/plugin-sdk/model-session-runtime";
|
|
49
|
+
import { fileURLToPath } from "node:url";
|
|
48
50
|
import { MIGRATION_REASON_TARGET_EXISTS, applyMigrationManualItem, createMigrationItem, createMigrationManualItem, hasMigrationConfigPatchConflict, markMigrationItemConflict, markMigrationItemError, markMigrationItemSkipped, mergeMigrationConfigValue, readMigrationConfigPath, resolveMigrationConfigRuntime, summarizeMigrationItems, writeMigrationConfigPath } from "openclaw/plugin-sdk/migration";
|
|
49
51
|
import { archiveMigrationItem, copyMemoryMigrationFileItem, copyMigrationFileItem, withCachedMigrationConfigRuntime, writeMigrationReport } from "openclaw/plugin-sdk/migration-runtime";
|
|
50
52
|
import { sleep } from "openclaw/plugin-sdk/runtime-env";
|
|
@@ -177,18 +179,18 @@ function waitForReconnect(delayMs, signal) {
|
|
|
177
179
|
}
|
|
178
180
|
//#endregion
|
|
179
181
|
//#region extensions/codex/src/app-server/session-binding-store.ts
|
|
180
|
-
/**
|
|
182
|
+
/** Keeps lifecycle/auth loading behind mutations while sharing the canonical read codec. */
|
|
181
183
|
function createLazyCodexAppServerBindingStore(state, managedThreadState) {
|
|
182
184
|
let resolved;
|
|
183
|
-
const store = () => resolved ??= import("./session-binding-
|
|
185
|
+
const store = () => resolved ??= import("./session-binding-4Ki04sW-.js").then((n) => n.d).then(({ createCodexAppServerBindingStore }) => createCodexAppServerBindingStore(state));
|
|
184
186
|
const managedThreads = managedThreadState ? createCodexManagedThreadStore(managedThreadState) : void 0;
|
|
185
187
|
return {
|
|
186
188
|
...managedThreads ? { managedThreads } : {},
|
|
187
|
-
read:
|
|
189
|
+
read: (identity) => readCurrentCodexAppServerBinding(state, identity),
|
|
188
190
|
hasOtherThreadOwner: async (threadId, currentIdentity) => (await store()).hasOtherThreadOwner(threadId, currentIdentity),
|
|
189
191
|
mutate: async (identity, mutation, assertCurrent) => (await store()).mutate(identity, mutation, assertCurrent),
|
|
190
192
|
prepareSessionGenerationReclaim: async (identity) => (await store()).prepareSessionGenerationReclaim(identity),
|
|
191
|
-
adoptSessionGeneration: async (identity, previousSessionId) => (await store()).adoptSessionGeneration(identity, previousSessionId),
|
|
193
|
+
adoptSessionGeneration: async (identity, previousSessionId, assertCurrent) => (await store()).adoptSessionGeneration(identity, previousSessionId, assertCurrent),
|
|
192
194
|
resetSessionGeneration: async (identity) => (await store()).resetSessionGeneration(identity),
|
|
193
195
|
retireSessionGeneration: async (identity) => (await store()).retireSessionGeneration(identity),
|
|
194
196
|
withSessionDeletion: async (identity, assertCurrent, run) => (await store()).withSessionDeletion(identity, assertCurrent, run),
|
|
@@ -211,7 +213,7 @@ async function handleCodexCommand(ctx, options) {
|
|
|
211
213
|
}
|
|
212
214
|
}
|
|
213
215
|
async function loadDefaultCodexSubcommandHandler() {
|
|
214
|
-
const { handleCodexSubcommand } = await import("./command-handlers-
|
|
216
|
+
const { handleCodexSubcommand } = await import("./command-handlers-DOJvGv6-.js");
|
|
215
217
|
return handleCodexSubcommand;
|
|
216
218
|
}
|
|
217
219
|
//#endregion
|
|
@@ -502,7 +504,7 @@ async function startCodexConversationThread(params) {
|
|
|
502
504
|
sessionKey: params.sessionKey,
|
|
503
505
|
config: params.config
|
|
504
506
|
});
|
|
505
|
-
const existingBinding =
|
|
507
|
+
const existingBinding = params.bindingStore.read(identity);
|
|
506
508
|
assertCodexBindingMayBeReplaced(existingBinding, "starting a conversation-bound Codex thread");
|
|
507
509
|
const authProfileId = resolveCodexAppServerAuthProfileIdForAgent({
|
|
508
510
|
authProfileId: params.authProfileId ?? existingBinding?.authProfileId,
|
|
@@ -533,7 +535,7 @@ async function startCodexConversationThread(params) {
|
|
|
533
535
|
run: bind
|
|
534
536
|
});
|
|
535
537
|
else await bind();
|
|
536
|
-
const storedBinding =
|
|
538
|
+
const storedBinding = params.bindingStore.read(identity);
|
|
537
539
|
if (!storedBinding) throw new Error("Codex session binding disappeared while starting its conversation thread.");
|
|
538
540
|
return createCodexConversationBindingData({
|
|
539
541
|
source: {
|
|
@@ -602,7 +604,7 @@ async function handleCodexConversationInboundClaim(event, ctx, options) {
|
|
|
602
604
|
const identity = conversationBindingIdentity(data);
|
|
603
605
|
const sessionKey = event.sessionKey ?? ctx.sessionKey;
|
|
604
606
|
const incognito = isIncognitoSessionKey(data.source?.sessionKey ?? (data.legacyBinding ? sessionKey : void 0));
|
|
605
|
-
const
|
|
607
|
+
const expected = options.bindingStore.read(identity);
|
|
606
608
|
return {
|
|
607
609
|
handled: true,
|
|
608
610
|
reply: (await withCodexConversationThreadActivity(data.bindingId, async () => {
|
|
@@ -612,8 +614,7 @@ async function handleCodexConversationInboundClaim(event, ctx, options) {
|
|
|
612
614
|
conversationId: publicBinding.conversationId,
|
|
613
615
|
...publicBinding.parentConversationId ? { parentConversationId: publicBinding.parentConversationId } : {}
|
|
614
616
|
});
|
|
615
|
-
const
|
|
616
|
-
const current = await options.bindingStore.read(identity);
|
|
617
|
+
const current = options.bindingStore.read(identity);
|
|
617
618
|
if (currentPublicBinding?.bindingId !== publicBinding.bindingId || expected && (!current || current.threadId !== expected.threadId || current.conversationStartId !== expected.conversationStartId) || !expected && current && data.start?.id && current.conversationStartId !== data.start.id) return { reply: { text: "This Codex conversation was detached or changed before its message could run." } };
|
|
618
619
|
return await runBoundTurnWithMissingThreadRecovery({
|
|
619
620
|
bindingStore: options.bindingStore,
|
|
@@ -640,7 +641,7 @@ async function handleCodexConversationBindingResolved(event, options) {
|
|
|
640
641
|
const data = readCodexConversationBindingDataRecord(event.request.data ?? {});
|
|
641
642
|
if (!data || data.kind !== "codex-app-server-session") return;
|
|
642
643
|
const identity = conversationBindingIdentity(data);
|
|
643
|
-
const binding =
|
|
644
|
+
const binding = options.bindingStore.read(identity);
|
|
644
645
|
assertCodexBindingMayBeReplaced(binding, "clearing a denied conversation binding");
|
|
645
646
|
if (binding && (!data.start?.id || binding.conversationStartId === data.start.id)) await withCodexConversationThreadActivity(identity.bindingId, () => retireCodexConversationThreadBinding({
|
|
646
647
|
bindingStore: options.bindingStore,
|
|
@@ -721,8 +722,7 @@ function buildConversationThreadRequest(resolved, serviceTier) {
|
|
|
721
722
|
}
|
|
722
723
|
function codexConversationSandboxOrPermissions(runtime, sandbox) {
|
|
723
724
|
const networkProxy = runtime.networkProxy;
|
|
724
|
-
const
|
|
725
|
-
const config = buildCodexProjectDocThreadConfig(mergeCodexThreadConfigs(networkProxy?.configPatch, disabledApps));
|
|
725
|
+
const config = buildCodexProjectDocThreadConfig(mergeCodexThreadConfigs(networkProxy?.configPatch, buildDisabledAppsConfigPatch()));
|
|
726
726
|
return networkProxy ? { config } : {
|
|
727
727
|
sandbox,
|
|
728
728
|
config
|
|
@@ -732,7 +732,7 @@ async function writeThreadBindingFromResponse(params, resolved, client, response
|
|
|
732
732
|
let retained = false;
|
|
733
733
|
let sameOwner = false;
|
|
734
734
|
try {
|
|
735
|
-
const current =
|
|
735
|
+
const current = params.bindingStore.read(params.identity);
|
|
736
736
|
assertCodexBindingMayBeReplaced(current, "storing a conversation-bound Codex thread");
|
|
737
737
|
const trackSubscription = !params.incognito && isCodexAppServerClientRuntimeLive(client);
|
|
738
738
|
sameOwner = isSameCodexAppServerThreadOwner(current, {
|
|
@@ -774,7 +774,7 @@ async function writeThreadBindingFromResponse(params, resolved, client, response
|
|
|
774
774
|
}
|
|
775
775
|
}
|
|
776
776
|
async function bindThread(params, threadId) {
|
|
777
|
-
const current =
|
|
777
|
+
const current = params.bindingStore.read(params.identity);
|
|
778
778
|
assertCodexBindingMayBeReplaced(current, "binding a conversation-bound Codex thread");
|
|
779
779
|
const resolved = await resolveThreadBindingRuntime(params);
|
|
780
780
|
const clientLease = { client: await getLeasedSharedCodexAppServerClient(resolved.clientOptions) };
|
|
@@ -823,14 +823,14 @@ async function runBoundTurn(params) {
|
|
|
823
823
|
config: params.config
|
|
824
824
|
});
|
|
825
825
|
const identity = conversationBindingIdentity(params.data);
|
|
826
|
-
const binding =
|
|
826
|
+
const binding = params.bindingStore.read(identity);
|
|
827
827
|
if (!binding?.threadId) throw new Error("bound Codex conversation has no thread binding");
|
|
828
828
|
return await withExclusiveCodexAppServerThread({
|
|
829
829
|
bindingStore: params.bindingStore,
|
|
830
830
|
identity,
|
|
831
831
|
threadId: binding.threadId,
|
|
832
832
|
run: async () => {
|
|
833
|
-
const current =
|
|
833
|
+
const current = params.bindingStore.read(identity);
|
|
834
834
|
if (!isSameCodexAppServerThreadOwner(current, binding)) throw new Error("Codex conversation binding changed before its turn.");
|
|
835
835
|
assertCodexBindingMayBeReplaced(binding, "running a conversation-bound Codex thread");
|
|
836
836
|
let threadId = binding.threadId;
|
|
@@ -1082,7 +1082,7 @@ async function runBoundTurn(params) {
|
|
|
1082
1082
|
const currentLiveThreadOwnership = liveThreadOwnership?.client === client && liveThreadOwnership.threadId === threadId ? liveThreadOwnership.ownership : void 0;
|
|
1083
1083
|
let retained = false;
|
|
1084
1084
|
if (turnSucceeded) retained = await params.bindingStore.withLease(identity, async () => {
|
|
1085
|
-
const latest =
|
|
1085
|
+
const latest = params.bindingStore.read(identity);
|
|
1086
1086
|
if (latest?.threadId !== threadId || latest.clientId !== client.getInstanceId()) return false;
|
|
1087
1087
|
return await retainCodexAppServerBindingSubscription(client, threadId, currentLiveThreadOwnership);
|
|
1088
1088
|
});
|
|
@@ -1121,9 +1121,9 @@ async function runBoundTurnWithMissingThreadRecovery(params) {
|
|
|
1121
1121
|
}
|
|
1122
1122
|
async function prepareConversationBinding(params, options = {}) {
|
|
1123
1123
|
const identity = conversationBindingIdentity(params.data);
|
|
1124
|
-
const snapshot =
|
|
1124
|
+
const snapshot = params.bindingStore.read(identity);
|
|
1125
1125
|
const run = () => params.bindingStore.withLease(identity, async () => {
|
|
1126
|
-
const current =
|
|
1126
|
+
const current = params.bindingStore.read(identity);
|
|
1127
1127
|
if (current?.threadId !== snapshot?.threadId || current?.clientId !== snapshot?.clientId) throw new Error("Codex conversation binding changed before preparation.");
|
|
1128
1128
|
const requested = params.data.start && current?.conversationStartId !== params.data.start.id ? params.data.start : void 0;
|
|
1129
1129
|
if (current && !requested && !options.forceNew) return;
|
|
@@ -1133,7 +1133,7 @@ async function prepareConversationBinding(params, options = {}) {
|
|
|
1133
1133
|
sessionKey: params.data.source.sessionKey,
|
|
1134
1134
|
config: params.config
|
|
1135
1135
|
}) : void 0;
|
|
1136
|
-
const sourceBinding = sourceIdentity ?
|
|
1136
|
+
const sourceBinding = sourceIdentity ? params.bindingStore.read(sourceIdentity) : void 0;
|
|
1137
1137
|
assertCodexBindingMayBeReplaced(current, "initializing a conversation-bound Codex thread");
|
|
1138
1138
|
assertCodexBindingMayBeReplaced(sourceBinding, "transferring a session into a conversation-bound Codex thread");
|
|
1139
1139
|
const inherited = current ?? sourceBinding;
|
|
@@ -1159,10 +1159,10 @@ async function prepareConversationBinding(params, options = {}) {
|
|
|
1159
1159
|
};
|
|
1160
1160
|
const threadId = requested?.threadId;
|
|
1161
1161
|
await bindThread(bindingParams, options.forceNew ? void 0 : threadId);
|
|
1162
|
-
const stored =
|
|
1162
|
+
const stored = params.bindingStore.read(identity);
|
|
1163
1163
|
if (!stored) throw new Error("Codex conversation binding disappeared while initializing its thread.");
|
|
1164
1164
|
if (sourceIdentity && params.data.source && !current?.conversationSourceTransferComplete) await params.bindingStore.withLease(sourceIdentity, async () => {
|
|
1165
|
-
const source =
|
|
1165
|
+
const source = params.bindingStore.read(sourceIdentity);
|
|
1166
1166
|
if (source && source.threadId === params.data.source?.threadId) {
|
|
1167
1167
|
const sourceSessionKey = sourceIdentity.sessionKey ?? resolveTranscriptSessionKeyBySessionId({
|
|
1168
1168
|
agentId: sourceIdentity.agentId,
|
|
@@ -2130,9 +2130,9 @@ function sanitizePluginName(value) {
|
|
|
2130
2130
|
//#region extensions/codex/src/migration/targets.ts
|
|
2131
2131
|
function resolveCodexMigrationTargets(ctx) {
|
|
2132
2132
|
const cfg = ctx.config;
|
|
2133
|
-
const agentId = ctx.targetAgentId ?? resolveDefaultAgentId(cfg);
|
|
2133
|
+
const agentId = ctx.targetAgentId ?? resolveDefaultAgentId$1(cfg);
|
|
2134
2134
|
const workspaceDir = resolveAgentWorkspaceDir(cfg, agentId);
|
|
2135
|
-
const configuredAgentDir = resolveAgentConfig(cfg, agentId)?.agentDir?.trim();
|
|
2135
|
+
const configuredAgentDir = resolveAgentConfig$1(cfg, agentId)?.agentDir?.trim();
|
|
2136
2136
|
return {
|
|
2137
2137
|
workspaceDir,
|
|
2138
2138
|
agentDir: ctx.runtime?.agent?.resolveAgentDir(cfg, agentId) ?? (configuredAgentDir ? resolveHomePath(configuredAgentDir) : void 0) ?? path.join(ctx.stateDir, "agents", agentId, "agent")
|
|
@@ -2874,7 +2874,7 @@ function createCodexPluginsTool(options) {
|
|
|
2874
2874
|
const marketplace = typeof params.marketplace === "string" ? params.marketplace.trim() : void 0;
|
|
2875
2875
|
const limit = typeof params.limit === "number" && Number.isInteger(params.limit) ? Math.max(1, Math.min(params.limit, 20)) : 12;
|
|
2876
2876
|
const pluginConfig = options.getPluginConfig();
|
|
2877
|
-
const binding = options.context.sessionId ?
|
|
2877
|
+
const binding = options.context.sessionId ? options.bindingStore.read(sessionBindingIdentity({
|
|
2878
2878
|
sessionId: options.context.sessionId,
|
|
2879
2879
|
sessionKey: options.context.sessionKey,
|
|
2880
2880
|
agentId: options.context.agentId,
|
|
@@ -3049,11 +3049,11 @@ function createCodexThreadsTool(options) {
|
|
|
3049
3049
|
agentId: options.context.agentId,
|
|
3050
3050
|
config: runtimeConfig()
|
|
3051
3051
|
});
|
|
3052
|
-
const currentBinding =
|
|
3053
|
-
const requestOptions =
|
|
3052
|
+
const currentBinding = (session) => session ? options.bindingStore.read(currentIdentity(session.sessionId)) : void 0;
|
|
3053
|
+
const requestOptions = (pluginConfig) => {
|
|
3054
3054
|
const plugin = readCodexPluginConfig(pluginConfig);
|
|
3055
3055
|
const session = currentSession();
|
|
3056
|
-
const binding =
|
|
3056
|
+
const binding = currentBinding(session);
|
|
3057
3057
|
if (binding?.connectionScope === "supervision") {
|
|
3058
3058
|
const connection = resolveCodexBindingAppServerConnection({
|
|
3059
3059
|
binding,
|
|
@@ -3114,7 +3114,7 @@ function createCodexThreadsTool(options) {
|
|
|
3114
3114
|
sourceKinds: [...CODEX_INTERACTIVE_THREAD_SOURCE_KINDS],
|
|
3115
3115
|
...cursor ? { cursor } : {},
|
|
3116
3116
|
...searchTerm ? { searchTerm } : {}
|
|
3117
|
-
},
|
|
3117
|
+
}, requestOptions(pluginConfig));
|
|
3118
3118
|
return jsonResult(mayReadRawTranscripts ? response : redactNativeThreadResponse(response));
|
|
3119
3119
|
}
|
|
3120
3120
|
const threadId = readThreadId(params);
|
|
@@ -3124,7 +3124,7 @@ function createCodexThreadsTool(options) {
|
|
|
3124
3124
|
const response = await request(pluginConfig, CODEX_CONTROL_METHODS.readThread, {
|
|
3125
3125
|
threadId,
|
|
3126
3126
|
includeTurns
|
|
3127
|
-
},
|
|
3127
|
+
}, requestOptions(pluginConfig));
|
|
3128
3128
|
return jsonResult(mayReadRawTranscripts ? response : redactNativeThreadResponse(response));
|
|
3129
3129
|
}
|
|
3130
3130
|
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.");
|
|
@@ -3136,7 +3136,7 @@ function createCodexThreadsTool(options) {
|
|
|
3136
3136
|
await request(pluginConfig, CODEX_CONTROL_METHODS.renameThread, {
|
|
3137
3137
|
threadId,
|
|
3138
3138
|
name
|
|
3139
|
-
},
|
|
3139
|
+
}, requestOptions(pluginConfig));
|
|
3140
3140
|
return jsonResult({
|
|
3141
3141
|
action,
|
|
3142
3142
|
threadId,
|
|
@@ -3144,17 +3144,17 @@ function createCodexThreadsTool(options) {
|
|
|
3144
3144
|
});
|
|
3145
3145
|
}
|
|
3146
3146
|
if (action === "unarchive") {
|
|
3147
|
-
const response = await request(pluginConfig, CODEX_CONTROL_METHODS.unarchiveThread, { threadId },
|
|
3147
|
+
const response = await request(pluginConfig, CODEX_CONTROL_METHODS.unarchiveThread, { threadId }, requestOptions(pluginConfig));
|
|
3148
3148
|
return jsonResult(mayReadRawTranscripts ? response : redactNativeThreadResponse(response));
|
|
3149
3149
|
}
|
|
3150
3150
|
const session = currentSession();
|
|
3151
|
-
const binding =
|
|
3151
|
+
const binding = currentBinding(session);
|
|
3152
3152
|
if (action === "archive") {
|
|
3153
3153
|
if (params.confirm !== true) throw new Error("confirm=true is required to archive a native Codex thread");
|
|
3154
3154
|
if (!session) throw new Error("cannot safely archive a native Codex thread without a session identity");
|
|
3155
3155
|
const identity = currentIdentity(session.sessionId);
|
|
3156
3156
|
await options.bindingStore.withThreadArchiveFence(async () => {
|
|
3157
|
-
const archivedBinding =
|
|
3157
|
+
const archivedBinding = currentBinding(session);
|
|
3158
3158
|
if (archivedBinding?.threadId === threadId) {
|
|
3159
3159
|
if (session.modelSelectionLocked) throw new ModelSelectionLockedError();
|
|
3160
3160
|
assertCodexBindingMayBeReplaced(archivedBinding, "archiving its bound native thread");
|
|
@@ -3162,20 +3162,20 @@ function createCodexThreadsTool(options) {
|
|
|
3162
3162
|
assertThreadMayBeArchived(await request(pluginConfig, CODEX_CONTROL_METHODS.readThread, {
|
|
3163
3163
|
threadId,
|
|
3164
3164
|
includeTurns: false
|
|
3165
|
-
},
|
|
3165
|
+
}, requestOptions(pluginConfig)), threadId);
|
|
3166
3166
|
if (await options.bindingStore.hasOtherThreadOwner(threadId, identity)) throw new Error("cannot archive a native Codex thread owned by another OpenClaw session");
|
|
3167
3167
|
await assertCodexArchiveDescendantsUnowned({
|
|
3168
3168
|
bindingStore: options.bindingStore,
|
|
3169
3169
|
threadId,
|
|
3170
|
-
listPage: async (listParams) => await request(pluginConfig, CODEX_CONTROL_METHODS.listThreads, listParams,
|
|
3170
|
+
listPage: async (listParams) => await request(pluginConfig, CODEX_CONTROL_METHODS.listThreads, listParams, requestOptions(pluginConfig)),
|
|
3171
3171
|
assertDescendantIdle: async (descendantThreadId) => {
|
|
3172
3172
|
assertThreadMayBeArchived(await request(pluginConfig, CODEX_CONTROL_METHODS.readThread, {
|
|
3173
3173
|
threadId: descendantThreadId,
|
|
3174
3174
|
includeTurns: false
|
|
3175
|
-
},
|
|
3175
|
+
}, requestOptions(pluginConfig)), descendantThreadId);
|
|
3176
3176
|
}
|
|
3177
3177
|
});
|
|
3178
|
-
await request(pluginConfig, CODEX_CONTROL_METHODS.archiveThread, { threadId },
|
|
3178
|
+
await request(pluginConfig, CODEX_CONTROL_METHODS.archiveThread, { threadId }, requestOptions(pluginConfig));
|
|
3179
3179
|
if (archivedBinding?.threadId === threadId) await options.bindingStore.mutate(identity, {
|
|
3180
3180
|
kind: "clear",
|
|
3181
3181
|
threadId
|
|
@@ -3197,13 +3197,13 @@ function createCodexThreadsTool(options) {
|
|
|
3197
3197
|
assertThreadMayBeForked(await request(pluginConfig, CODEX_CONTROL_METHODS.readThread, {
|
|
3198
3198
|
threadId,
|
|
3199
3199
|
includeTurns: false
|
|
3200
|
-
},
|
|
3200
|
+
}, requestOptions(pluginConfig)), threadId);
|
|
3201
3201
|
}
|
|
3202
3202
|
const response = await request(pluginConfig, CODEX_CONTROL_METHODS.forkThread, {
|
|
3203
3203
|
threadId,
|
|
3204
3204
|
threadSource: "user",
|
|
3205
3205
|
excludeTurns: true
|
|
3206
|
-
},
|
|
3206
|
+
}, requestOptions(pluginConfig));
|
|
3207
3207
|
if (!isJsonObject(response) || !isJsonObject(response.thread)) throw new Error("Codex app-server returned an invalid thread/fork response");
|
|
3208
3208
|
const forkThreadId = typeof response.thread.id === "string" && response.thread.id.trim() ? response.thread.id : void 0;
|
|
3209
3209
|
if (!forkThreadId) throw new Error("Codex app-server thread/fork response did not include a thread id");
|
|
@@ -3277,7 +3277,7 @@ function createCodexNodeExecServerCommand() {
|
|
|
3277
3277
|
try {
|
|
3278
3278
|
if (!context.prepareExecAuthorization) throw new Error("Codex node execution requires node-local exec policy support; update the node.");
|
|
3279
3279
|
const assertExecAuthorized = context.prepareExecAuthorization(request.authorization);
|
|
3280
|
-
const { runCodexNodeExecServer } = await import("./node-exec-server.runtime-
|
|
3280
|
+
const { runCodexNodeExecServer } = await import("./node-exec-server.runtime-nfbUOtUB.js");
|
|
3281
3281
|
return await runCodexNodeExecServer({
|
|
3282
3282
|
workspaceDir: workspace.workspaceDir,
|
|
3283
3283
|
io,
|
|
@@ -4157,7 +4157,7 @@ function createCodexSupervisionTools(options) {
|
|
|
4157
4157
|
}
|
|
4158
4158
|
//#endregion
|
|
4159
4159
|
//#region extensions/codex/src/web-search-provider.ts
|
|
4160
|
-
const loadCodexWebSearchRuntime = createLazyRuntimeModule(() => import("./web-search-provider.runtime-
|
|
4160
|
+
const loadCodexWebSearchRuntime = createLazyRuntimeModule(() => import("./web-search-provider.runtime-DKQn67A7.js"));
|
|
4161
4161
|
const CodexWebSearchSchema = {
|
|
4162
4162
|
type: "object",
|
|
4163
4163
|
properties: { query: {
|
|
@@ -4387,22 +4387,6 @@ var codex_default = definePluginEntry({
|
|
|
4387
4387
|
})
|
|
4388
4388
|
}));
|
|
4389
4389
|
api.onConversationBindingResolved?.((event) => codexConversationBindingRuntime.handleBindingResolved(event, { bindingStore }));
|
|
4390
|
-
api.on("after_compaction", async (event, ctx) => {
|
|
4391
|
-
const previousSessionId = event.previousSessionId?.trim();
|
|
4392
|
-
const sessionId = ctx.sessionId?.trim();
|
|
4393
|
-
if (!previousSessionId || !sessionId || previousSessionId === sessionId) return;
|
|
4394
|
-
const config = resolveCurrentConfig();
|
|
4395
|
-
const sessionKey = ctx.sessionKey?.trim();
|
|
4396
|
-
const { sessionBindingIdentity } = await import("./session-binding-BHuTCRZQ.js").then((n) => n.f);
|
|
4397
|
-
const identity = sessionBindingIdentity({
|
|
4398
|
-
sessionId,
|
|
4399
|
-
...sessionKey ? { sessionKey } : {},
|
|
4400
|
-
...ctx.agentId ? { agentId: ctx.agentId } : {},
|
|
4401
|
-
...config ? { config } : {}
|
|
4402
|
-
});
|
|
4403
|
-
const adopted = await bindingStore.adoptSessionGeneration(identity, previousSessionId);
|
|
4404
|
-
if (adopted === "conflict") api.logger.warn?.(`codex: could not adopt compacted session generation ${sessionId} (${adopted}); secondary native compaction will skip`);
|
|
4405
|
-
});
|
|
4406
4390
|
api.on("session_end", async (event, ctx) => {
|
|
4407
4391
|
if (!event.reason || !ENDED_SESSION_REASONS.has(event.reason)) return;
|
|
4408
4392
|
const sessionKey = event.sessionKey ?? ctx.sessionKey;
|
|
@@ -4411,7 +4395,7 @@ var codex_default = definePluginEntry({
|
|
|
4411
4395
|
if (endedSessionKey && nextSessionKey && nextSessionKey !== endedSessionKey) return;
|
|
4412
4396
|
if (event.nextSessionId?.trim() === event.sessionId.trim()) return;
|
|
4413
4397
|
const config = resolveCurrentConfig();
|
|
4414
|
-
const [{ sessionBindingIdentity }, { retireCodexAppServerSessionGeneration }] = await Promise.all([import("./session-binding-
|
|
4398
|
+
const [{ sessionBindingIdentity }, { retireCodexAppServerSessionGeneration }] = await Promise.all([import("./session-binding-4Ki04sW-.js").then((n) => n.d), import("./session-retirement-DNdmYdFc.js")]);
|
|
4415
4399
|
await retireCodexAppServerSessionGeneration({
|
|
4416
4400
|
bindingStore,
|
|
4417
4401
|
identity: sessionBindingIdentity({
|
|
@@ -1,26 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { t as runBoundedCodexAppServerTurn } from "./bounded-turn-
|
|
4
|
-
import { a as createAttributedCodexAssistantMessage } from "./event-projector-assistant-message-
|
|
1
|
+
import { O as readCodexPluginConfig, r as resolveCodexAppServerHomeScope } from "./config-CyapYSji.js";
|
|
2
|
+
import { Kt as resolveCodexAppServerPreparedAuthHandoff, Z as assertCodexPassiveTurnItems } from "./shared-client-CKhX2kFt.js";
|
|
3
|
+
import { t as runBoundedCodexAppServerTurn } from "./bounded-turn-DxGJRYbY.js";
|
|
4
|
+
import { a as createAttributedCodexAssistantMessage } from "./event-projector-assistant-message-B9kp6iGC.js";
|
|
5
5
|
//#region extensions/codex/src/app-server/isolated-completion.ts
|
|
6
|
-
const ISOLATED_PASSIVE_ITEM_TYPES = /* @__PURE__ */ new Set(["agentMessage", "reasoning"]);
|
|
7
|
-
function assertIsolatedCompletionItems(items, prompt) {
|
|
8
|
-
let promptEchoSeen = false;
|
|
9
|
-
for (const item of items) {
|
|
10
|
-
if (ISOLATED_PASSIVE_ITEM_TYPES.has(item.type)) continue;
|
|
11
|
-
if (item.type === "userMessage" && !promptEchoSeen) {
|
|
12
|
-
const content = Array.isArray(item.content) ? item.content : [];
|
|
13
|
-
const input = content[0];
|
|
14
|
-
if (content.length === 1 && isJsonObject(input) && input.type === "text" && input.text === prompt) {
|
|
15
|
-
promptEchoSeen = true;
|
|
16
|
-
continue;
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
throw new Error(`Codex isolated completion returned unexpected native item: ${item.type}`);
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
6
|
/** Runs prompt-only Codex inference on an ephemeral, ring-zero native thread. */
|
|
23
7
|
async function runCodexIsolatedCompletion(params, options) {
|
|
8
|
+
params.assertCurrent?.();
|
|
24
9
|
const authorization = params.authorization;
|
|
25
10
|
if (authorization.owner !== "harness") throw new Error("Codex native isolated completion requires harness-owned authorization.");
|
|
26
11
|
const pluginConfig = readCodexPluginConfig(options.pluginConfig);
|
|
@@ -35,6 +20,7 @@ async function runCodexIsolatedCompletion(params, options) {
|
|
|
35
20
|
subscriptionProfileRequiredError: "Prepared Codex subscription route requires a scoped native OAuth or token profile.",
|
|
36
21
|
subscriptionProfileUnusableError: `Prepared Codex auth profile "${authorization.plan.forwardedAuthProfileId}" is unusable.`
|
|
37
22
|
});
|
|
23
|
+
params.assertCurrent?.();
|
|
38
24
|
const authSelection = authHandoff.preparedAuth ? { preparedAuth: authHandoff.preparedAuth } : { profile: authHandoff.authProfileId };
|
|
39
25
|
const result = await runBoundedCodexAppServerTurn({
|
|
40
26
|
config: params.config,
|
|
@@ -46,6 +32,7 @@ async function runCodexIsolatedCompletion(params, options) {
|
|
|
46
32
|
authRequirement,
|
|
47
33
|
timeoutMs: params.timeoutMs,
|
|
48
34
|
signal: params.abortSignal,
|
|
35
|
+
assertCurrent: params.assertCurrent,
|
|
49
36
|
agentDir: params.agentDir,
|
|
50
37
|
authProfileStore: authorization.authProfileStore,
|
|
51
38
|
options,
|
|
@@ -60,7 +47,8 @@ async function runCodexIsolatedCompletion(params, options) {
|
|
|
60
47
|
isolation: "configured-transport",
|
|
61
48
|
requireNoExternalCapabilities: true
|
|
62
49
|
});
|
|
63
|
-
|
|
50
|
+
params.assertCurrent?.();
|
|
51
|
+
assertCodexPassiveTurnItems(result.items, params.prompt, "isolated completion");
|
|
64
52
|
return { assistant: createAttributedCodexAssistantMessage({
|
|
65
53
|
api: "openai-chatgpt-responses",
|
|
66
54
|
provider: params.provider,
|