@openclaw/codex 2026.8.1-beta.3 → 2026.8.1
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 +4 -5
- package/dist/{attempt-client-cleanup-URjUlCHg.js → attempt-client-cleanup-CVPvp9dL.js} +47 -5
- package/dist/{auth-binding-B4FfbcCg.js → auth-binding-Ds_QVm-X.js} +18 -3
- package/dist/{binding-connection-DAvZwp96.js → binding-connection-CCQFs8lf.js} +2 -2
- package/dist/{bounded-turn-4BjrZEwW.js → bounded-turn-rq5tiSXk.js} +13 -18
- package/dist/{capabilities-CH3K57v4.js → capabilities-CGm_94eL.js} +1 -1
- package/dist/cli-metadata.js +1 -1
- package/dist/{command-formatters-D0nZ3qtd.js → command-formatters-C54Yg3eA.js} +2 -2
- package/dist/{command-handlers-DC86lgT4.js → command-handlers-BvOAHTrA.js} +89 -62
- package/dist/{compact-COqgBRny.js → compact-Hd7SAc0N.js} +8 -9
- package/dist/{config-CpNeo5AE.js → config-Cxw3Cl3k.js} +346 -286
- package/dist/doctor-contract-api.js +115 -14
- package/dist/{dynamic-tools-fJZhl4CE.js → dynamic-tools-BFoUcRdx.js} +147 -903
- package/dist/{effective-mcp-catalog-4YKn51aG.js → effective-mcp-catalog-BTJHnDSx.js} +2 -2
- package/dist/{event-projector-assistant-message-BwxV4d6N.js → event-projector-assistant-message-C5-Ds8mA.js} +18 -1
- package/dist/{event-projector-usage-CLwNEJqW.js → event-projector-usage-D3PHFFXh.js} +3 -3
- package/dist/{harness-DoKQcF8n.js → harness-DVfUQBlQ.js} +42 -52
- package/dist/harness.js +1 -1
- package/dist/index.js +278 -295
- package/dist/{isolated-completion-DPMtlH9r.js → isolated-completion-Cbbx_5Ed.js} +4 -4
- package/dist/launch-args-sXOAg0SX.js +84 -0
- package/dist/{managed-binary-By4FZC6i.js → managed-binary-ZkGodW19.js} +43 -7
- package/dist/media-understanding-provider.js +1 -1
- package/dist/model-catalog-o6Cgjoss.js +101 -0
- package/dist/{models-CZw1wClT.js → models-DgFWSuxA.js} +25 -28
- package/dist/{native-subagent-monitor-GGq3RnOo.js → native-subagent-monitor-CwFyoylz.js} +207 -30
- package/dist/{node-exec-server.runtime-Bsu1LdFZ.js → node-exec-server.runtime-DXrqpw1c.js} +8 -5
- package/dist/{plugin-approval-roundtrip-C75Yiiwc.js → plugin-approval-roundtrip-D80UZiJ_.js} +1 -1
- package/dist/{plugin-marketplace-discovery-CSWDkMrP.js → plugin-marketplace-discovery-mdmScYOj.js} +30 -39
- package/dist/{plugin-metadata-cache-BXH5NF-4.js → plugin-metadata-cache-CulOABwu.js} +162 -135
- package/dist/{protocol-validators-VAVyEnDp.js → protocol-validators-Bg5rpNxk.js} +148 -5
- package/dist/{rate-limits-BI1dMHDG.js → rate-limits-hFtzt2Up.js} +1 -1
- package/dist/{sandbox-guard-C1qEeZ5C.js → request-CCm4LaED.js} +183 -2
- package/dist/{run-attempt-BV3HzuCf.js → run-attempt-BwNQDH2u.js} +599 -361
- package/dist/{runtime-artifact-BvyT1uyd.js → runtime-artifact-DeBvleJw.js} +1 -1
- package/dist/{session-binding-BTrLf9Qm.js → session-binding-q2WSTVmC.js} +195 -122
- package/dist/{session-catalog-ezP_UcRM.js → session-catalog-C2Tae4rI.js} +229 -122
- package/dist/session-catalog-home-id-DAKUrm3C.js +112 -0
- package/dist/{session-cli-B1hKvfkI.js → session-cli-BuDjm5Ou.js} +1 -1
- package/dist/session-permission-policy-gLm40Vtq.js +160 -0
- package/dist/session-retirement-CdkI0bvb.js +90 -0
- package/dist/{session-upstream-marker-D_2npHlA.js → session-upstream-marker-Bcy33kam.js} +2 -3
- package/dist/{settled-turn-finalizer-Dx1onIqg.js → settled-turn-finalizer-B8JJcxCi.js} +7 -6
- package/dist/{shared-client-Dw-rzii0.js → shared-client-kNkljY-R.js} +1720 -786
- package/dist/{side-question-DbXkJZzg.js → side-question-GwD73tX6.js} +69 -39
- package/dist/{thread-lifecycle-DKdrnTMX.js → thread-lifecycle-Ss-uwnC4.js} +852 -359
- package/dist/{thread-ownership-i2NBwDUL.js → thread-ownership-CeYBqg_4.js} +18 -8
- package/dist/{plugin-app-cache-key-DMNQ8Zi8.js → thread-resume-DF54hagX.js} +52 -6
- package/dist/{transcript-mirror-BU0_LKAL.js → transcript-mirror-CkEQIna-.js} +112 -13
- package/dist/transport-stdio-C7-s9TLG.js +708 -0
- package/dist/{upstream-session-fork-BDVJCLAD.js → upstream-session-fork-BACGlOFa.js} +78 -86
- package/dist/{usage-9dKJCgcy.js → usage-C2l8Mils.js} +3 -3
- package/dist/{web-search-provider.runtime-DCdx4DGu.js → web-search-provider.runtime-B2XgRdFv.js} +3 -3
- package/openclaw.plugin.json +19 -1
- package/package.json +8 -8
- package/dist/app-server-policy-bg5QPSVP.js +0 -25
- package/dist/command-rpc-xUIIonsO.js +0 -90
- package/dist/incognito-session-ET_ufDH-.js +0 -2
- package/dist/model-catalog-CmGoqVKB.js +0 -48
- package/dist/request-DSK0W6YI.js +0 -157
- package/dist/session-catalog-home-id-BNwAJ9D7.js +0 -18
- package/dist/session-retirement-CE4iMiLh.js +0 -36
- package/dist/thread-resume-CdJk2Ehf.js +0 -30
- package/dist/transport-stdio-DhoGy33Z.js +0 -99
|
@@ -1,37 +1,41 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { c as reclaimCurrentCodexSessionGeneration, d as sessionBindingIdentity } from "./session-binding-
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { n as
|
|
7
|
-
import {
|
|
8
|
-
import { t as
|
|
9
|
-
import { r as
|
|
1
|
+
import { F as resolveCodexAppServerLocalHomeDir, I as resolveCodexAppServerUserHomeDir, P as resolveCodexAppServerHomeDir, T as readCodexPluginConfig, i as resolveCodexAppServerRuntimeOptions, s as resolveCodexSupervisionAppServerRuntimeOptions } from "./config-Cxw3Cl3k.js";
|
|
2
|
+
import { $ as CodexAppServerRpcError, Et as withTimeout, Ht as isJsonObject, Lt as resolveCodexAppServerPreparedAuthHandoff, Mt as resolveCodexAppServerAuthProfileId, Pt as resolveCodexAppServerAuthProfileStore, Q as resolveCodexAppServerClientInstanceId, Rt as CODEX_INTERACTIVE_CUSTOM_THREAD_SOURCES, c as getLeasedSharedCodexAppServerClient, h as releaseLeasedSharedCodexAppServerClient, zt as CODEX_INTERACTIVE_THREAD_SOURCE_KINDS } from "./shared-client-kNkljY-R.js";
|
|
3
|
+
import { c as reclaimCurrentCodexSessionGeneration, d as sessionBindingIdentity } from "./session-binding-q2WSTVmC.js";
|
|
4
|
+
import { i as assertCodexThreadForkParams } from "./protocol-validators-Bg5rpNxk.js";
|
|
5
|
+
import { a as closeCodexStartupClientBestEffort } from "./attempt-client-cleanup-CVPvp9dL.js";
|
|
6
|
+
import { n as listCodexAppServerModels } from "./models-DgFWSuxA.js";
|
|
7
|
+
import { a as replaceCodexCatalogConnectionHomes, n as buildCodexAppServerConnectionFingerprint, t as resumeCodexAppServerThread } from "./thread-resume-DF54hagX.js";
|
|
8
|
+
import { n as codexCatalogHomeId, r as isOpenClawManagedCodexThread, t as canonicalCodexCatalogHome } from "./session-catalog-home-id-DAKUrm3C.js";
|
|
9
|
+
import { i as requestCodexAppServerJson, o as withCodexAppServerJsonClient, r as requestCodexAppServerClientJson } from "./request-CCm4LaED.js";
|
|
10
|
+
import { p as projectCodexUserItemText, r as importCodexThreadHistoryToTranscript } from "./transcript-mirror-CkEQIna-.js";
|
|
11
|
+
import { n as describeControlFailure, t as CODEX_CONTROL_METHODS } from "./capabilities-CGm_94eL.js";
|
|
12
|
+
import { r as formatCodexDisplayText } from "./command-formatters-C54Yg3eA.js";
|
|
10
13
|
import { n as createCodexCliNodeConversationBindingData } from "./conversation-binding-data-CW2GuupV.js";
|
|
11
|
-
import { n as
|
|
12
|
-
import { t as
|
|
13
|
-
import { i as createImportedCodexSession, n as codexUpstreamBaseline, r as codexUpstreamContinueResult, t as codexLastTerminalTurnId } from "./session-upstream-marker-D_2npHlA.js";
|
|
14
|
+
import { n as prepareCodexAppServerAuthBinding } from "./auth-binding-Ds_QVm-X.js";
|
|
15
|
+
import { i as createImportedCodexSession, n as codexUpstreamBaseline, r as codexUpstreamContinueResult, t as codexLastTerminalTurnId } from "./session-upstream-marker-Bcy33kam.js";
|
|
14
16
|
import { asFiniteNumber, isRecord, normalizeBoundedOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
15
17
|
import fs from "node:fs/promises";
|
|
16
18
|
import path from "node:path";
|
|
17
19
|
import { timestampMsToIsoString } from "openclaw/plugin-sdk/number-runtime";
|
|
18
20
|
import { resolvePreferredOpenClawTmpDir } from "openclaw/plugin-sdk/temp-path";
|
|
21
|
+
import { prepareAgentRuntimeAuth } from "openclaw/plugin-sdk/agent-harness-runtime";
|
|
19
22
|
import fsSync from "node:fs";
|
|
20
23
|
import os from "node:os";
|
|
21
|
-
import { listAgentIds, resolveAgentDir, resolveAllowedModelRef, resolveDefaultAgentDir, resolveDefaultAgentId, resolveDefaultModelForAgent
|
|
22
|
-
import { pruneMapToMaxSize } from "openclaw/plugin-sdk/collection-runtime";
|
|
24
|
+
import { listAgentIds, resolveAgentDir as resolveAgentDir$1, resolveAgentWorkspaceDir, resolveAllowedModelRef, resolveDefaultAgentDir, resolveDefaultAgentId, resolveDefaultModelForAgent } from "openclaw/plugin-sdk/agent-runtime";
|
|
23
25
|
import { runCommandBuffered } from "openclaw/plugin-sdk/process-runtime";
|
|
26
|
+
import { resolveSessionAgentIdsStrict } from "openclaw/plugin-sdk/agent-scope-runtime";
|
|
24
27
|
import { materializeWindowsSpawnProgram, resolveWindowsSpawnProgram } from "openclaw/plugin-sdk/windows-spawn";
|
|
25
|
-
import { resolveStorePath } from "openclaw/plugin-sdk/session-store-runtime";
|
|
28
|
+
import { getSessionEntry, resolveStorePath } from "openclaw/plugin-sdk/session-store-runtime";
|
|
26
29
|
import { truncateUtf16Safe } from "openclaw/plugin-sdk/text-utility-runtime";
|
|
27
30
|
import { expectDefined } from "openclaw/plugin-sdk/expect-runtime";
|
|
28
31
|
import { sanitizeTerminalText } from "openclaw/plugin-sdk/text-chunking";
|
|
29
32
|
import { parseAgentSessionKey } from "openclaw/plugin-sdk/routing";
|
|
30
|
-
import { root } from "openclaw/plugin-sdk/file-access-runtime";
|
|
31
33
|
import process$1 from "node:process";
|
|
34
|
+
import { resolveSessionModelRef } from "openclaw/plugin-sdk/model-session-runtime";
|
|
35
|
+
import { resolveApiKeyForProvider } from "openclaw/plugin-sdk/provider-auth-runtime";
|
|
32
36
|
import { createSessionCatalogAdoptionCoordinator, listSessionCatalogEntries, sessionCatalogAdoptedSessionKey, sessionCatalogAdoptedSourceKey } from "openclaw/plugin-sdk/session-catalog";
|
|
33
37
|
import { decodeNodePtyResumeParams, resolveNodeHostExecutable, runNodePtyCommand } from "openclaw/plugin-sdk/node-host";
|
|
34
|
-
import {
|
|
38
|
+
import { pruneMapToMaxSize } from "openclaw/plugin-sdk/collection-runtime";
|
|
35
39
|
//#region extensions/codex/src/jsonl-lines.ts
|
|
36
40
|
const JSONL_STREAM_THRESHOLD_BYTES = 4 * 1024 * 1024;
|
|
37
41
|
const JSONL_READ_CHUNK_BYTES = 1024 * 1024;
|
|
@@ -546,6 +550,197 @@ function formatNodeLabel(node) {
|
|
|
546
550
|
].filter(Boolean).join(" / ") || "node";
|
|
547
551
|
}
|
|
548
552
|
//#endregion
|
|
553
|
+
//#region extensions/codex/src/command-rpc.ts
|
|
554
|
+
async function prepareControlAuth(options, startOptions) {
|
|
555
|
+
if (!options.onResponse || !options.config || !options.sessionKey || options.authProfileId === null || startOptions.homeScope === "user") return {
|
|
556
|
+
authProfileId: options.authProfileId ?? void 0,
|
|
557
|
+
clientOptions: { authProfileId: options.authProfileId }
|
|
558
|
+
};
|
|
559
|
+
const config = options.config;
|
|
560
|
+
const { sessionAgentId } = resolveSessionAgentIdsStrict({
|
|
561
|
+
config,
|
|
562
|
+
sessionKey: options.sessionKey,
|
|
563
|
+
agentId: options.agentId
|
|
564
|
+
});
|
|
565
|
+
const agentDir = options.agentDir ?? resolveAgentDir$1(config, sessionAgentId);
|
|
566
|
+
const workspaceDir = resolveAgentWorkspaceDir(config, sessionAgentId);
|
|
567
|
+
const entry = getSessionEntry({
|
|
568
|
+
agentId: sessionAgentId,
|
|
569
|
+
storePath: resolveStorePath(config.session?.store, { agentId: sessionAgentId }),
|
|
570
|
+
sessionKey: options.sessionKey,
|
|
571
|
+
hydrateSkillPromptRefs: false,
|
|
572
|
+
readConsistency: "latest"
|
|
573
|
+
});
|
|
574
|
+
const model = resolveSessionModelRef(config, entry, sessionAgentId);
|
|
575
|
+
const store = resolveCodexAppServerAuthProfileStore({
|
|
576
|
+
agentDir,
|
|
577
|
+
config
|
|
578
|
+
});
|
|
579
|
+
const { plan, attempts } = prepareAgentRuntimeAuth({
|
|
580
|
+
provider: model.provider,
|
|
581
|
+
modelId: model.model,
|
|
582
|
+
config,
|
|
583
|
+
agentDir,
|
|
584
|
+
workspaceDir,
|
|
585
|
+
authProfileStore: store,
|
|
586
|
+
sessionAuthProfileId: entry?.authProfileOverride ?? options.authProfileId,
|
|
587
|
+
sessionAuthProfileSource: entry?.authProfileOverrideSource,
|
|
588
|
+
harnessId: "codex",
|
|
589
|
+
harnessAuthBootstrap: "harness"
|
|
590
|
+
});
|
|
591
|
+
const route = plan.modelRoute;
|
|
592
|
+
const resolvedAuth = route ? await resolveApiKeyForProvider({
|
|
593
|
+
provider: route.provider,
|
|
594
|
+
modelId: route.modelId,
|
|
595
|
+
modelApi: route.api,
|
|
596
|
+
cfg: config,
|
|
597
|
+
agentDir,
|
|
598
|
+
workspaceDir,
|
|
599
|
+
store,
|
|
600
|
+
profileId: attempts[0]?.profileId,
|
|
601
|
+
lockedProfile: plan.forwardedAuthProfileSource === "user",
|
|
602
|
+
allowAuthProfileFallback: attempts[0]?.allowAuthProfileFallback,
|
|
603
|
+
skipSetupProviderFallback: true
|
|
604
|
+
}) : void 0;
|
|
605
|
+
const handoff = await resolveCodexAppServerPreparedAuthHandoff({
|
|
606
|
+
authRequirement: route?.authRequirement,
|
|
607
|
+
resolvedApiKey: resolvedAuth?.apiKey,
|
|
608
|
+
authProfileId: route ? plan.forwardedAuthProfileId : resolveCodexAppServerAuthProfileId({
|
|
609
|
+
authProfileId: plan.forwardedAuthProfileId,
|
|
610
|
+
store,
|
|
611
|
+
config
|
|
612
|
+
}),
|
|
613
|
+
authProfileStore: store,
|
|
614
|
+
agentDir,
|
|
615
|
+
homeScope: startOptions.homeScope ?? "agent",
|
|
616
|
+
config,
|
|
617
|
+
subscriptionProfileRequiredError: "Prepared Codex subscription route requires a forwarded OpenAI OAuth or token profile.",
|
|
618
|
+
subscriptionProfileUnusableError: "Prepared Codex subscription auth profile is unusable."
|
|
619
|
+
});
|
|
620
|
+
const binding = handoff.authProfileId ? await prepareCodexAppServerAuthBinding({
|
|
621
|
+
authProfileId: handoff.authProfileId,
|
|
622
|
+
authProfileStore: store,
|
|
623
|
+
agentDir,
|
|
624
|
+
config
|
|
625
|
+
}) : void 0;
|
|
626
|
+
return {
|
|
627
|
+
authProfileId: handoff.authProfileId,
|
|
628
|
+
clientOptions: {
|
|
629
|
+
...handoff.preparedAuth ? { preparedAuth: handoff.preparedAuth } : { authProfileId: handoff.authProfileId },
|
|
630
|
+
authRequirement: route?.authRequirement,
|
|
631
|
+
authProfileStore: binding?.authProfileStore ?? store,
|
|
632
|
+
authBindingFingerprint: binding?.fingerprint,
|
|
633
|
+
agentDir
|
|
634
|
+
}
|
|
635
|
+
};
|
|
636
|
+
}
|
|
637
|
+
function requestOptions(pluginConfig, limit, config, agentDir) {
|
|
638
|
+
const runtime = resolveCodexAppServerRuntimeOptions({ pluginConfig });
|
|
639
|
+
return {
|
|
640
|
+
limit,
|
|
641
|
+
timeoutMs: runtime.requestTimeoutMs,
|
|
642
|
+
startOptions: runtime.start,
|
|
643
|
+
config,
|
|
644
|
+
agentDir
|
|
645
|
+
};
|
|
646
|
+
}
|
|
647
|
+
async function codexControlRequest(pluginConfig, method, requestParams, options = {}) {
|
|
648
|
+
const runtime = options.startOptions ? resolveCodexSupervisionAppServerRuntimeOptions({ pluginConfig }) : resolveCodexAppServerRuntimeOptions({ pluginConfig });
|
|
649
|
+
const startOptions = options.startOptions ?? runtime.start;
|
|
650
|
+
const auth = await prepareControlAuth(options, startOptions);
|
|
651
|
+
const controlRequestOptions = {
|
|
652
|
+
timeoutMs: options.timeoutMs ?? runtime.requestTimeoutMs,
|
|
653
|
+
startOptions,
|
|
654
|
+
config: options.config,
|
|
655
|
+
sessionKey: options.sessionKey,
|
|
656
|
+
sessionId: options.sessionId,
|
|
657
|
+
agentDir: options.agentDir,
|
|
658
|
+
isolated: options.isolated,
|
|
659
|
+
...auth.clientOptions
|
|
660
|
+
};
|
|
661
|
+
if (options.onResponse || options.beforeRequest) return await withCodexAppServerJsonClient(controlRequestOptions, async (request, client, scope) => {
|
|
662
|
+
await options.beforeRequest?.(request);
|
|
663
|
+
scope.assertCurrent();
|
|
664
|
+
let response;
|
|
665
|
+
if (method === "thread/resume") {
|
|
666
|
+
if (!isJsonObject(requestParams) || typeof requestParams.threadId !== "string") throw new Error("Codex thread/resume requires a thread id.");
|
|
667
|
+
response = await resumeCodexAppServerThread({
|
|
668
|
+
client,
|
|
669
|
+
request: {
|
|
670
|
+
...requestParams,
|
|
671
|
+
threadId: requestParams.threadId
|
|
672
|
+
},
|
|
673
|
+
requestResume: () => request({
|
|
674
|
+
method,
|
|
675
|
+
requestParams
|
|
676
|
+
}),
|
|
677
|
+
abandonClient: () => closeCodexStartupClientBestEffort(client)
|
|
678
|
+
});
|
|
679
|
+
} else response = await request({
|
|
680
|
+
method,
|
|
681
|
+
requestParams
|
|
682
|
+
});
|
|
683
|
+
await options.onResponse?.(response, client, {
|
|
684
|
+
authProfileId: auth.authProfileId,
|
|
685
|
+
assertCurrent: scope.assertCurrent
|
|
686
|
+
});
|
|
687
|
+
scope.assertCurrent();
|
|
688
|
+
return response;
|
|
689
|
+
});
|
|
690
|
+
return await requestCodexAppServerJson({
|
|
691
|
+
method,
|
|
692
|
+
requestParams,
|
|
693
|
+
...controlRequestOptions
|
|
694
|
+
});
|
|
695
|
+
}
|
|
696
|
+
async function safeCodexControlRequest(pluginConfig, method, requestParams, options = {}) {
|
|
697
|
+
return await safeValue(async () => await codexControlRequest(pluginConfig, method, requestParams, options));
|
|
698
|
+
}
|
|
699
|
+
async function safeCodexModelList(pluginConfig, limit, config, agentDir) {
|
|
700
|
+
return await safeValue(async () => await listCodexAppServerModels(requestOptions(pluginConfig, limit, config, agentDir)));
|
|
701
|
+
}
|
|
702
|
+
async function readCodexStatusProbes(pluginConfig, config, agentDir) {
|
|
703
|
+
const [models, account, limits, mcps, skills] = await Promise.all([
|
|
704
|
+
safeCodexModelList(pluginConfig, 20, config, agentDir),
|
|
705
|
+
safeCodexControlRequest(pluginConfig, CODEX_CONTROL_METHODS.account, { refreshToken: false }, {
|
|
706
|
+
config,
|
|
707
|
+
agentDir
|
|
708
|
+
}),
|
|
709
|
+
safeCodexControlRequest(pluginConfig, CODEX_CONTROL_METHODS.rateLimits, void 0, {
|
|
710
|
+
config,
|
|
711
|
+
agentDir
|
|
712
|
+
}),
|
|
713
|
+
safeCodexControlRequest(pluginConfig, CODEX_CONTROL_METHODS.listMcpServers, { limit: 100 }, {
|
|
714
|
+
config,
|
|
715
|
+
agentDir
|
|
716
|
+
}),
|
|
717
|
+
safeCodexControlRequest(pluginConfig, CODEX_CONTROL_METHODS.listSkills, {}, {
|
|
718
|
+
config,
|
|
719
|
+
agentDir
|
|
720
|
+
})
|
|
721
|
+
]);
|
|
722
|
+
return {
|
|
723
|
+
models,
|
|
724
|
+
account,
|
|
725
|
+
limits,
|
|
726
|
+
mcps,
|
|
727
|
+
skills
|
|
728
|
+
};
|
|
729
|
+
}
|
|
730
|
+
async function safeValue(read) {
|
|
731
|
+
try {
|
|
732
|
+
return {
|
|
733
|
+
ok: true,
|
|
734
|
+
value: await read()
|
|
735
|
+
};
|
|
736
|
+
} catch (error) {
|
|
737
|
+
return {
|
|
738
|
+
ok: false,
|
|
739
|
+
error: describeControlFailure(error)
|
|
740
|
+
};
|
|
741
|
+
}
|
|
742
|
+
}
|
|
743
|
+
//#endregion
|
|
549
744
|
//#region extensions/codex/src/app-server/thread-archive-guard.ts
|
|
550
745
|
const DESCENDANT_PAGE_LIMIT = 100;
|
|
551
746
|
const MAX_DESCENDANT_PAGES = 100;
|
|
@@ -821,7 +1016,7 @@ function filterCatalogPageByTitle(page, searchTerm) {
|
|
|
821
1016
|
if (!searchTerm) return page;
|
|
822
1017
|
return {
|
|
823
1018
|
...page,
|
|
824
|
-
sessions: page.sessions.filter((session) => session.name?.toLocaleLowerCase().includes(searchTerm.toLocaleLowerCase()))
|
|
1019
|
+
sessions: page.sessions.filter((session) => (session.name ?? session.fallbackName)?.toLocaleLowerCase().includes(searchTerm.toLocaleLowerCase()))
|
|
825
1020
|
};
|
|
826
1021
|
}
|
|
827
1022
|
function unwrapNodeInvokePayload(value) {
|
|
@@ -997,7 +1192,7 @@ async function createOrReuseNodeAdoptedSession(params) {
|
|
|
997
1192
|
key: nodeAdoptionSessionKey(params.hostId, params.record.threadId),
|
|
998
1193
|
agentId: params.agentId,
|
|
999
1194
|
recoverMatchingInitialEntry: true,
|
|
1000
|
-
|
|
1195
|
+
displayName: params.record.name ?? void 0,
|
|
1001
1196
|
...params.record.cwd?.trim() ? { spawnedCwd: params.record.cwd.trim() } : {},
|
|
1002
1197
|
initialEntry: {
|
|
1003
1198
|
agentHarnessId: "codex",
|
|
@@ -1045,7 +1240,7 @@ const CODEX_TERMINAL_RESUME_COMMAND = "codex.terminal.resume.v1";
|
|
|
1045
1240
|
function resolveCodexCatalogTerminalHome(sources) {
|
|
1046
1241
|
const runtimeConfig = sources.getRuntimeConfig();
|
|
1047
1242
|
if (!runtimeConfig) throw new Error("OpenClaw runtime config is unavailable");
|
|
1048
|
-
const agentDir = sources.source?.agentDir ?? (sources.agentId ? resolveAgentDir(runtimeConfig, sources.agentId) : resolveDefaultAgentDir(runtimeConfig));
|
|
1243
|
+
const agentDir = sources.source?.agentDir ?? (sources.agentId ? resolveAgentDir$1(runtimeConfig, sources.agentId) : resolveDefaultAgentDir(runtimeConfig));
|
|
1049
1244
|
return resolveCodexAppServerLocalHomeDir(sources.source?.appServer.start ?? resolveCodexSupervisionAppServerRuntimeOptions({ pluginConfig: sources.getPluginConfig() }).start, agentDir);
|
|
1050
1245
|
}
|
|
1051
1246
|
function resolveLocalCodexTerminalExecutable(env = process.env) {
|
|
@@ -1377,6 +1572,7 @@ async function createOrReuseAdoptedSession(params) {
|
|
|
1377
1572
|
config: params.config,
|
|
1378
1573
|
key: adoptionSessionKey(params.sourceThread.id, params.sourceHomeId),
|
|
1379
1574
|
agentId: params.agentId,
|
|
1575
|
+
displayName: params.sourceThread.name ?? void 0,
|
|
1380
1576
|
thread: params.sourceThread,
|
|
1381
1577
|
throughTurnId: pendingLastTurnId ?? null,
|
|
1382
1578
|
recoverMatchingInitialEntry: true,
|
|
@@ -1720,6 +1916,7 @@ async function readNodeCodexHistory(params) {
|
|
|
1720
1916
|
id: params.record.threadId,
|
|
1721
1917
|
createdAt: params.record.createdAt ?? 0,
|
|
1722
1918
|
modelProvider: params.record.modelProvider ?? "openai",
|
|
1919
|
+
projectId: null,
|
|
1723
1920
|
turns: page.data.toReversed()
|
|
1724
1921
|
};
|
|
1725
1922
|
return {
|
|
@@ -1783,7 +1980,7 @@ async function continueNodeCodexSessionInner(params) {
|
|
|
1783
1980
|
detachHint: "Start a new chat to leave the paired-node Codex session.",
|
|
1784
1981
|
data: createCodexCliNodeConversationBindingData({
|
|
1785
1982
|
nodeId,
|
|
1786
|
-
sessionId:
|
|
1983
|
+
sessionId: params.threadId,
|
|
1787
1984
|
agentId: adopted.agentId,
|
|
1788
1985
|
cwd: record.cwd
|
|
1789
1986
|
})
|
|
@@ -1799,10 +1996,10 @@ async function continueNodeCodexSession(params) {
|
|
|
1799
1996
|
if (params.clientScopes?.includes("operator.admin") !== true) throw new CatalogParamsError("continuing a paired-node Codex session requires operator.admin");
|
|
1800
1997
|
const nodeId = params.hostId.slice(5).trim();
|
|
1801
1998
|
if (!nodeId || params.hostId !== `node:${nodeId}`) throw new CatalogParamsError("Codex session catalog hostId is invalid");
|
|
1802
|
-
const agentId =
|
|
1999
|
+
const agentId = resolveSessionAgentIdsStrict({
|
|
1803
2000
|
config: params.config,
|
|
1804
2001
|
agentId: params.agentId
|
|
1805
|
-
}).
|
|
2002
|
+
}).sessionAgentId;
|
|
1806
2003
|
const sourceKey = sessionCatalogAdoptedSourceKey(`node:${nodeId}`, params.threadId);
|
|
1807
2004
|
const operationKey = sessionCatalogAdoptedSourceKey(agentId, sourceKey);
|
|
1808
2005
|
return await continueNodeAdoption({
|
|
@@ -1903,7 +2100,7 @@ async function listGatewayHost(params) {
|
|
|
1903
2100
|
}
|
|
1904
2101
|
/** Lists Gateway-local and paired-node Codex sessions with per-host failures. */
|
|
1905
2102
|
async function listCodexSessionCatalog(params) {
|
|
1906
|
-
const agentId =
|
|
2103
|
+
const agentId = resolveSessionAgentIdsStrict({
|
|
1907
2104
|
config: params.config ?? {},
|
|
1908
2105
|
agentId: params.agentId
|
|
1909
2106
|
}).sessionAgentId;
|
|
@@ -1977,7 +2174,7 @@ function createCodexSessionCatalogNodeHostCommands(controlFactory, configSources
|
|
|
1977
2174
|
if (!isRecord(parsed)) throw new CatalogParamsError("Codex session catalog parameters must be an object");
|
|
1978
2175
|
const requestedAgentId = readBoundedOptionalString(parsed, "agentId", 256);
|
|
1979
2176
|
const config = configSources.getRuntimeConfig() ?? {};
|
|
1980
|
-
const agentId =
|
|
2177
|
+
const agentId = resolveSessionAgentIdsStrict({
|
|
1981
2178
|
config,
|
|
1982
2179
|
agentId: requestedAgentId
|
|
1983
2180
|
}).sessionAgentId;
|
|
@@ -2145,7 +2342,7 @@ function toGenericTranscriptItem(item) {
|
|
|
2145
2342
|
const fallback = item.title ?? item.name ?? item.tool ?? item.command ?? item.query ?? void 0;
|
|
2146
2343
|
const resultText = item.aggregatedOutput || (item.result === void 0 ? void 0 : JSON.stringify(item.result, null, 2));
|
|
2147
2344
|
const changesText = Array.isArray(item.changes) ? item.changes.map((change) => `${change.kind}: ${change.path}`).join("\n") || void 0 : void 0;
|
|
2148
|
-
const text = item.text || resultText || changesText || fallback;
|
|
2345
|
+
const text = item.type === "userMessage" ? projectCodexUserItemText(item) : item.text || resultText || changesText || fallback;
|
|
2149
2346
|
return {
|
|
2150
2347
|
id: item.id,
|
|
2151
2348
|
type,
|
|
@@ -2310,7 +2507,7 @@ function existingCatalogHomeCandidates(value, label) {
|
|
|
2310
2507
|
/** Resolves every local Codex store the operator already owns, without path disclosure. */
|
|
2311
2508
|
function resolveCodexCatalogHomes(params) {
|
|
2312
2509
|
const { config, env, ownerAgentId, pluginConfig } = params;
|
|
2313
|
-
const ownerAgentDir = resolveAgentDir(config, ownerAgentId, env);
|
|
2510
|
+
const ownerAgentDir = resolveAgentDir$1(config, ownerAgentId, env);
|
|
2314
2511
|
const configuredHomes = readCodexPluginConfig(pluginConfig).sessionCatalog?.homes ?? [];
|
|
2315
2512
|
const base = resolveCodexSupervisionAppServerRuntimeOptions({
|
|
2316
2513
|
pluginConfig,
|
|
@@ -2333,7 +2530,7 @@ function resolveCodexCatalogHomes(params) {
|
|
|
2333
2530
|
usesProcessHomeFallback: !processHomeConfigured
|
|
2334
2531
|
});
|
|
2335
2532
|
const agentIds = listAgentIds(config).toSorted((left, right) => left === ownerAgentId ? -1 : right === ownerAgentId ? 1 : left.localeCompare(right));
|
|
2336
|
-
candidates.push(...agentIds.flatMap((agentId) => existingCatalogHomeCandidates(resolveCodexAppServerHomeDir(resolveAgentDir(config, agentId, env)), agentId)), ...configuredHomes.flatMap((entry) => {
|
|
2533
|
+
candidates.push(...agentIds.flatMap((agentId) => existingCatalogHomeCandidates(resolveCodexAppServerHomeDir(resolveAgentDir$1(config, agentId, env)), agentId)), ...configuredHomes.flatMap((entry) => {
|
|
2337
2534
|
const { path: home, label } = typeof entry === "string" ? { path: entry } : entry;
|
|
2338
2535
|
return existingCatalogHomeCandidates(home, label);
|
|
2339
2536
|
}));
|
|
@@ -2399,96 +2596,6 @@ function createCodexCatalogHomeResolver(params) {
|
|
|
2399
2596
|
} };
|
|
2400
2597
|
}
|
|
2401
2598
|
//#endregion
|
|
2402
|
-
//#region extensions/codex/src/session-catalog-provenance.ts
|
|
2403
|
-
const MAX_SESSION_META_BYTES = 1024 * 1024;
|
|
2404
|
-
const SESSION_META_READ_CHUNK_BYTES = 64 * 1024;
|
|
2405
|
-
const MAX_PROVENANCE_CACHE_ENTRIES = 2e4;
|
|
2406
|
-
const provenanceByPath = /* @__PURE__ */ new Map();
|
|
2407
|
-
function cacheProvenance(key, value) {
|
|
2408
|
-
provenanceByPath.delete(key);
|
|
2409
|
-
provenanceByPath.set(key, value);
|
|
2410
|
-
while (provenanceByPath.size > MAX_PROVENANCE_CACHE_ENTRIES) {
|
|
2411
|
-
const oldest = provenanceByPath.keys().next().value;
|
|
2412
|
-
if (oldest === void 0) break;
|
|
2413
|
-
provenanceByPath.delete(oldest);
|
|
2414
|
-
}
|
|
2415
|
-
}
|
|
2416
|
-
/** Undefined means the metadata line is not durable enough to cache yet. */
|
|
2417
|
-
async function readOpenClawOriginator(sessionsRoot, rolloutPath, threadId) {
|
|
2418
|
-
let safeRoot;
|
|
2419
|
-
try {
|
|
2420
|
-
safeRoot = await root(sessionsRoot, {
|
|
2421
|
-
hardlinks: "reject",
|
|
2422
|
-
maxBytes: Number.MAX_SAFE_INTEGER,
|
|
2423
|
-
symlinks: "reject"
|
|
2424
|
-
});
|
|
2425
|
-
} catch {
|
|
2426
|
-
return;
|
|
2427
|
-
}
|
|
2428
|
-
const candidates = rolloutPath.endsWith(".zst") ? [rolloutPath, rolloutPath.slice(0, -4)] : [rolloutPath, `${rolloutPath}.zst`];
|
|
2429
|
-
for (const candidate of candidates) {
|
|
2430
|
-
let opened;
|
|
2431
|
-
try {
|
|
2432
|
-
opened = await safeRoot.open(path.relative(sessionsRoot, candidate));
|
|
2433
|
-
} catch {
|
|
2434
|
-
continue;
|
|
2435
|
-
}
|
|
2436
|
-
const input = opened.handle.createReadStream({
|
|
2437
|
-
autoClose: false,
|
|
2438
|
-
highWaterMark: SESSION_META_READ_CHUNK_BYTES
|
|
2439
|
-
});
|
|
2440
|
-
const reader = candidate.endsWith(".zst") ? input.pipe(createZstdDecompress()) : input;
|
|
2441
|
-
try {
|
|
2442
|
-
const chunks = [];
|
|
2443
|
-
let bytesReadTotal = 0;
|
|
2444
|
-
let line;
|
|
2445
|
-
for await (const value of reader) {
|
|
2446
|
-
const chunk = Buffer.isBuffer(value) ? value : Buffer.from(value);
|
|
2447
|
-
const remaining = MAX_SESSION_META_BYTES - bytesReadTotal;
|
|
2448
|
-
if (remaining <= 0) break;
|
|
2449
|
-
const bounded = chunk.subarray(0, remaining);
|
|
2450
|
-
bytesReadTotal += bounded.length;
|
|
2451
|
-
const newline = bounded.indexOf(10);
|
|
2452
|
-
chunks.push(newline >= 0 ? bounded.subarray(0, newline) : bounded);
|
|
2453
|
-
if (newline >= 0) {
|
|
2454
|
-
line = Buffer.concat(chunks).toString("utf8");
|
|
2455
|
-
break;
|
|
2456
|
-
}
|
|
2457
|
-
}
|
|
2458
|
-
if (!line) continue;
|
|
2459
|
-
let parsed;
|
|
2460
|
-
try {
|
|
2461
|
-
parsed = JSON.parse(line);
|
|
2462
|
-
} catch {
|
|
2463
|
-
continue;
|
|
2464
|
-
}
|
|
2465
|
-
if (!isRecord(parsed) || parsed.type !== "session_meta" || !isRecord(parsed.payload)) return false;
|
|
2466
|
-
const payload = parsed.payload;
|
|
2467
|
-
return (payload.id ?? payload.session_id) === threadId && payload.originator === "openclaw";
|
|
2468
|
-
} catch {
|
|
2469
|
-
continue;
|
|
2470
|
-
} finally {
|
|
2471
|
-
reader.destroy();
|
|
2472
|
-
input.destroy();
|
|
2473
|
-
await opened.handle.close().catch(() => void 0);
|
|
2474
|
-
}
|
|
2475
|
-
}
|
|
2476
|
-
}
|
|
2477
|
-
/**
|
|
2478
|
-
* Codex 0.147 reports OpenClaw app-server rollouts as `vscode`, so the rollout's
|
|
2479
|
-
* immutable session metadata is the authoritative historical provenance.
|
|
2480
|
-
*/
|
|
2481
|
-
async function isOpenClawManagedCodexThread(thread, localSessionsRoot) {
|
|
2482
|
-
const rolloutPath = typeof thread.path === "string" ? thread.path.trim() : "";
|
|
2483
|
-
if (!localSessionsRoot || !rolloutPath) return false;
|
|
2484
|
-
const cacheKey = `${localSessionsRoot}\0${rolloutPath}`;
|
|
2485
|
-
const cached = provenanceByPath.get(cacheKey);
|
|
2486
|
-
if (cached !== void 0) return cached;
|
|
2487
|
-
const managed = await readOpenClawOriginator(localSessionsRoot, rolloutPath, thread.id);
|
|
2488
|
-
if (managed !== void 0) cacheProvenance(cacheKey, managed);
|
|
2489
|
-
return managed ?? false;
|
|
2490
|
-
}
|
|
2491
|
-
//#endregion
|
|
2492
2599
|
//#region extensions/codex/src/session-catalog-control.ts
|
|
2493
2600
|
const CODEX_SESSION_CATALOG_LIST_TTL_MS = 32e3;
|
|
2494
2601
|
const CODEX_SESSION_CATALOG_LIST_CACHE_MAX_ENTRIES = 32;
|
|
@@ -2558,7 +2665,7 @@ function createCodexSessionCatalogControlFromRequests(params) {
|
|
|
2558
2665
|
continue;
|
|
2559
2666
|
}
|
|
2560
2667
|
const session = toCatalogSession(thread, false);
|
|
2561
|
-
if (session && (!search || session.name?.toLocaleLowerCase().includes(search))) sessions.push(session);
|
|
2668
|
+
if (session && (!search || (session.name ?? session.fallbackName)?.toLocaleLowerCase().includes(search))) sessions.push(session);
|
|
2562
2669
|
}
|
|
2563
2670
|
nextCursor = readControlCursor(response.nextCursor, "next response");
|
|
2564
2671
|
if (!nextCursor || sessions.length >= limit) break;
|
|
@@ -2605,7 +2712,7 @@ function createCodexSessionCatalogControl(params) {
|
|
|
2605
2712
|
const catalogPagesByConfig = /* @__PURE__ */ new WeakMap();
|
|
2606
2713
|
const resolveRequestOptions = (startOptions, agentId, source) => {
|
|
2607
2714
|
const runtimeConfig = params.getRuntimeConfig();
|
|
2608
|
-
const agentDir = source?.agentDir ?? resolveAgentDir(runtimeConfig ?? {}, agentId);
|
|
2715
|
+
const agentDir = source?.agentDir ?? resolveAgentDir$1(runtimeConfig ?? {}, agentId);
|
|
2609
2716
|
const resolvedStartOptions = source?.appServer.start ?? startOptions;
|
|
2610
2717
|
if (!runtimeConfig) return {
|
|
2611
2718
|
agentDir,
|
|
@@ -2812,7 +2919,7 @@ function registerCodexSessionCatalog(params) {
|
|
|
2812
2919
|
const homes = params.control.homesForAgent(agentId);
|
|
2813
2920
|
return allowProcessHomeFallback === false ? homes.filter((home) => !home.usesProcessHomeFallback) : homes;
|
|
2814
2921
|
};
|
|
2815
|
-
const resolveRequestAgentId = (agentId) =>
|
|
2922
|
+
const resolveRequestAgentId = (agentId) => resolveSessionAgentIdsStrict({
|
|
2816
2923
|
config: params.getRuntimeConfig() ?? params.api.config,
|
|
2817
2924
|
agentId
|
|
2818
2925
|
}).sessionAgentId;
|
|
@@ -2960,4 +3067,4 @@ const codexSessionCatalogRuntime = {
|
|
|
2960
3067
|
archiveLocal: archiveLocalCodexSession
|
|
2961
3068
|
};
|
|
2962
3069
|
//#endregion
|
|
2963
|
-
export { CODEX_LOCAL_SESSION_HOST_ID as a,
|
|
3070
|
+
export { CODEX_LOCAL_SESSION_HOST_ID as a, readCodexStatusProbes as c, createCodexCliSessionNodeHostCommands as d, createCodexCliSessionNodeInvokePolicies as f, resumeCodexCliSessionOnNode as g, resolveCodexCliSessionForBindingOnNode as h, createCodexSessionCatalogNodeHostCommands as i, requestOptions as l, listCodexCliSessionsOnNode as m, createCodexSessionCatalogNodeInvokePolicies as n, assertCodexArchiveDescendantsUnowned as o, formatCodexCliSessions as p, createCodexSessionCatalogControl as r, codexControlRequest as s, codexSessionCatalogRuntime as t, safeCodexControlRequest as u };
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { Ht as isJsonObject } from "./shared-client-kNkljY-R.js";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { createHash } from "node:crypto";
|
|
4
|
+
import fsSync from "node:fs";
|
|
5
|
+
import { root } from "openclaw/plugin-sdk/file-access-runtime";
|
|
6
|
+
import { createZstdDecompress } from "node:zlib";
|
|
7
|
+
//#region extensions/codex/src/session-catalog-provenance.ts
|
|
8
|
+
const MAX_SESSION_META_BYTES = 1024 * 1024;
|
|
9
|
+
const SESSION_META_READ_CHUNK_BYTES = 64 * 1024;
|
|
10
|
+
const MAX_PROVENANCE_CACHE_ENTRIES = 2e4;
|
|
11
|
+
const provenanceByPath = /* @__PURE__ */ new Map();
|
|
12
|
+
function cacheProvenance(key, value) {
|
|
13
|
+
provenanceByPath.delete(key);
|
|
14
|
+
provenanceByPath.set(key, value);
|
|
15
|
+
while (provenanceByPath.size > MAX_PROVENANCE_CACHE_ENTRIES) {
|
|
16
|
+
const oldest = provenanceByPath.keys().next().value;
|
|
17
|
+
if (oldest === void 0) break;
|
|
18
|
+
provenanceByPath.delete(oldest);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
/** Undefined means the metadata line is not durable enough to cache yet. */
|
|
22
|
+
async function readCodexSessionMeta(sessionsRoot, rolloutPath, threadId) {
|
|
23
|
+
let safeRoot;
|
|
24
|
+
try {
|
|
25
|
+
safeRoot = await root(sessionsRoot, {
|
|
26
|
+
hardlinks: "reject",
|
|
27
|
+
maxBytes: Number.MAX_SAFE_INTEGER,
|
|
28
|
+
symlinks: "reject"
|
|
29
|
+
});
|
|
30
|
+
} catch {
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
const candidates = rolloutPath.endsWith(".zst") ? [rolloutPath, rolloutPath.slice(0, -4)] : [rolloutPath, `${rolloutPath}.zst`];
|
|
34
|
+
for (const candidate of candidates) {
|
|
35
|
+
let opened;
|
|
36
|
+
try {
|
|
37
|
+
opened = await safeRoot.open(path.relative(sessionsRoot, candidate));
|
|
38
|
+
} catch {
|
|
39
|
+
continue;
|
|
40
|
+
}
|
|
41
|
+
const input = opened.handle.createReadStream({
|
|
42
|
+
autoClose: false,
|
|
43
|
+
highWaterMark: SESSION_META_READ_CHUNK_BYTES
|
|
44
|
+
});
|
|
45
|
+
const reader = candidate.endsWith(".zst") ? input.pipe(createZstdDecompress()) : input;
|
|
46
|
+
try {
|
|
47
|
+
const chunks = [];
|
|
48
|
+
let bytesReadTotal = 0;
|
|
49
|
+
let line;
|
|
50
|
+
for await (const value of reader) {
|
|
51
|
+
const chunk = Buffer.isBuffer(value) ? value : Buffer.from(value);
|
|
52
|
+
const remaining = MAX_SESSION_META_BYTES - bytesReadTotal;
|
|
53
|
+
if (remaining <= 0) break;
|
|
54
|
+
const bounded = chunk.subarray(0, remaining);
|
|
55
|
+
bytesReadTotal += bounded.length;
|
|
56
|
+
const newline = bounded.indexOf(10);
|
|
57
|
+
chunks.push(newline >= 0 ? bounded.subarray(0, newline) : bounded);
|
|
58
|
+
if (newline >= 0) {
|
|
59
|
+
line = Buffer.concat(chunks).toString("utf8");
|
|
60
|
+
break;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
if (!line) continue;
|
|
64
|
+
let parsed;
|
|
65
|
+
try {
|
|
66
|
+
parsed = JSON.parse(line);
|
|
67
|
+
} catch {
|
|
68
|
+
continue;
|
|
69
|
+
}
|
|
70
|
+
if (!isJsonObject(parsed) || parsed.type !== "session_meta" || !isJsonObject(parsed.payload)) return null;
|
|
71
|
+
const payload = parsed.payload;
|
|
72
|
+
return payload.id === threadId ? payload : null;
|
|
73
|
+
} catch {
|
|
74
|
+
continue;
|
|
75
|
+
} finally {
|
|
76
|
+
reader.destroy();
|
|
77
|
+
input.destroy();
|
|
78
|
+
await opened.handle.close().catch(() => void 0);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Codex 0.147 reports OpenClaw app-server rollouts as `vscode`, so the rollout's
|
|
84
|
+
* immutable session metadata is the authoritative historical provenance.
|
|
85
|
+
*/
|
|
86
|
+
async function isOpenClawManagedCodexThread(thread, localSessionsRoot) {
|
|
87
|
+
const rolloutPath = typeof thread.path === "string" ? thread.path.trim() : "";
|
|
88
|
+
if (!localSessionsRoot || !rolloutPath) return false;
|
|
89
|
+
const cacheKey = `${localSessionsRoot}\0${rolloutPath}`;
|
|
90
|
+
const cached = provenanceByPath.get(cacheKey);
|
|
91
|
+
if (cached !== void 0) return cached;
|
|
92
|
+
const metadata = await readCodexSessionMeta(localSessionsRoot, rolloutPath, thread.id);
|
|
93
|
+
const managed = metadata === void 0 ? void 0 : metadata?.originator === "openclaw";
|
|
94
|
+
if (managed !== void 0) cacheProvenance(cacheKey, managed);
|
|
95
|
+
return managed ?? false;
|
|
96
|
+
}
|
|
97
|
+
//#endregion
|
|
98
|
+
//#region extensions/codex/src/session-catalog-home-id.ts
|
|
99
|
+
function canonicalCodexCatalogHome(value) {
|
|
100
|
+
const resolved = path.resolve(value);
|
|
101
|
+
try {
|
|
102
|
+
return fsSync.realpathSync.native(resolved);
|
|
103
|
+
} catch {
|
|
104
|
+
return resolved;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
/** One canonical identity for catalog discovery and durable ownership rows. */
|
|
108
|
+
function codexCatalogHomeId(codexHome) {
|
|
109
|
+
return createHash("sha256").update("openclaw:codex-session-catalog-home:v1\0").update(canonicalCodexCatalogHome(codexHome)).digest("hex");
|
|
110
|
+
}
|
|
111
|
+
//#endregion
|
|
112
|
+
export { readCodexSessionMeta as i, codexCatalogHomeId as n, isOpenClawManagedCodexThread as r, canonicalCodexCatalogHome as t };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import "./session-catalog-
|
|
1
|
+
import "./session-catalog-C2Tae4rI.js";
|
|
2
2
|
import { isRecord } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
3
3
|
import { truncateUtf16Safe } from "openclaw/plugin-sdk/text-utility-runtime";
|
|
4
4
|
import { sanitizeTerminalText } from "openclaw/plugin-sdk/text-chunking";
|