@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
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
import { O as selectGuardianSandbox, _ as parseAllowedSandboxModesFromCodexRequirements, b as selectGuardianApprovalsReviewer, g as parseAllowedApprovalsReviewersFromCodexRequirements, h as parseAllowedApprovalPoliciesFromCodexRequirements, l as resolveCodexAppServerNetworkProxy, p as canUseCodexModelBackedApprovalsReviewerForModel, x as selectUserApprovalsReviewer, y as selectGuardianApprovalPolicy } from "./config-Cxw3Cl3k.js";
|
|
2
|
+
import { hostname } from "node:os";
|
|
3
|
+
import { isPathInside } from "openclaw/plugin-sdk/file-access-runtime";
|
|
4
|
+
//#region extensions/codex/src/app-server/app-server-policy.ts
|
|
5
|
+
function resolveCodexAppServerForModelProvider(params) {
|
|
6
|
+
const explicitProvider = normalizeModelBackedReviewerProvider(params.provider);
|
|
7
|
+
if (!isCodexModelBackedApprovalsReviewer(params.appServer.approvalsReviewer) || canUseCodexModelBackedApprovalsReviewerForModel({
|
|
8
|
+
modelProvider: explicitProvider,
|
|
9
|
+
model: params.model,
|
|
10
|
+
config: params.config,
|
|
11
|
+
env: {
|
|
12
|
+
...params.env ?? process.env,
|
|
13
|
+
...params.appServer.start.env
|
|
14
|
+
},
|
|
15
|
+
agentDir: params.agentDir,
|
|
16
|
+
codexConfigToml: params.codexConfigToml,
|
|
17
|
+
homeScope: params.appServer.start.homeScope,
|
|
18
|
+
codexArgs: params.appServer.start.args
|
|
19
|
+
})) return params.appServer;
|
|
20
|
+
return {
|
|
21
|
+
...params.appServer,
|
|
22
|
+
approvalsReviewer: "user"
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
function isCodexModelBackedApprovalsReviewer(value) {
|
|
26
|
+
return value === "auto_review" || value === "guardian_subagent";
|
|
27
|
+
}
|
|
28
|
+
function normalizeModelBackedReviewerProvider(provider) {
|
|
29
|
+
return provider?.trim().toLowerCase() || void 0;
|
|
30
|
+
}
|
|
31
|
+
//#endregion
|
|
32
|
+
//#region extensions/codex/src/app-server/session-permission-policy.ts
|
|
33
|
+
const CODEX_SESSION_PERMISSION_EXEC_MODES = {
|
|
34
|
+
"read-only": "deny",
|
|
35
|
+
guarded: "ask",
|
|
36
|
+
workspace: "auto",
|
|
37
|
+
full: "full"
|
|
38
|
+
};
|
|
39
|
+
function tupleForMode(mode, canUseAutoReview) {
|
|
40
|
+
switch (mode) {
|
|
41
|
+
case "read-only": return {
|
|
42
|
+
sandbox: "read-only",
|
|
43
|
+
approvalPolicy: "on-request",
|
|
44
|
+
approvalsReviewer: "user"
|
|
45
|
+
};
|
|
46
|
+
case "guarded": return {
|
|
47
|
+
sandbox: "workspace-write",
|
|
48
|
+
approvalPolicy: "on-request",
|
|
49
|
+
approvalsReviewer: "user"
|
|
50
|
+
};
|
|
51
|
+
case "workspace": return {
|
|
52
|
+
sandbox: "workspace-write",
|
|
53
|
+
approvalPolicy: "on-request",
|
|
54
|
+
approvalsReviewer: canUseAutoReview ? "auto_review" : "user"
|
|
55
|
+
};
|
|
56
|
+
case "full": return {
|
|
57
|
+
sandbox: "danger-full-access",
|
|
58
|
+
approvalPolicy: "never",
|
|
59
|
+
approvalsReviewer: "user"
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
return mode;
|
|
63
|
+
}
|
|
64
|
+
function requirementsAllowTuple(tuple, allowed) {
|
|
65
|
+
return (allowed.sandboxes === void 0 || allowed.sandboxes.has(tuple.sandbox)) && (allowed.approvalPolicies === void 0 || allowed.approvalPolicies.has(tuple.approvalPolicy)) && (allowed.reviewers === void 0 || allowed.reviewers.has(tuple.approvalsReviewer));
|
|
66
|
+
}
|
|
67
|
+
function tightenTupleForExecMode(tuple, execMode, requiresPerCommandApproval) {
|
|
68
|
+
switch (execMode) {
|
|
69
|
+
case "deny":
|
|
70
|
+
case "allowlist": return {
|
|
71
|
+
sandbox: "read-only",
|
|
72
|
+
approvalPolicy: "on-request",
|
|
73
|
+
approvalsReviewer: "user"
|
|
74
|
+
};
|
|
75
|
+
case "ask": return {
|
|
76
|
+
...tuple,
|
|
77
|
+
approvalPolicy: requiresPerCommandApproval ? "untrusted" : "on-request",
|
|
78
|
+
approvalsReviewer: "user"
|
|
79
|
+
};
|
|
80
|
+
case "auto":
|
|
81
|
+
case "full":
|
|
82
|
+
case void 0: return tuple;
|
|
83
|
+
}
|
|
84
|
+
return execMode;
|
|
85
|
+
}
|
|
86
|
+
function clampSessionPermissionTuple(params) {
|
|
87
|
+
if (!params.requirementsToml) return params.requested;
|
|
88
|
+
const allowed = {
|
|
89
|
+
sandboxes: parseAllowedSandboxModesFromCodexRequirements(params.requirementsToml, params.hostName ?? hostname()),
|
|
90
|
+
approvalPolicies: parseAllowedApprovalPoliciesFromCodexRequirements(params.requirementsToml),
|
|
91
|
+
reviewers: parseAllowedApprovalsReviewersFromCodexRequirements(params.requirementsToml)
|
|
92
|
+
};
|
|
93
|
+
if (requirementsAllowTuple(params.requested, allowed)) return params.requested;
|
|
94
|
+
if (params.requested.approvalPolicy === "untrusted" && allowed.approvalPolicies?.has("untrusted") === false) throw new Error("tools.exec.ask=always requires Codex app-server per-command approvals");
|
|
95
|
+
const userReviewRequired = params.mode === "read-only" || params.mode === "guarded" || params.mode === "workspace" && !params.canUseAutoReview;
|
|
96
|
+
const sandboxAuthority = {
|
|
97
|
+
"read-only": 0,
|
|
98
|
+
"workspace-write": 1,
|
|
99
|
+
"danger-full-access": 2
|
|
100
|
+
};
|
|
101
|
+
const allowedSandboxes = new Set([
|
|
102
|
+
"read-only",
|
|
103
|
+
"workspace-write",
|
|
104
|
+
"danger-full-access"
|
|
105
|
+
].filter((sandbox) => sandboxAuthority[sandbox] <= sandboxAuthority[params.requested.sandbox] && (allowed.sandboxes === void 0 || allowed.sandboxes.has(sandbox))));
|
|
106
|
+
if (allowedSandboxes.size === 0) throw new Error(`Codex session permission mode=${params.mode} cannot satisfy managed sandbox requirements without widening access`);
|
|
107
|
+
return {
|
|
108
|
+
sandbox: selectGuardianSandbox(allowedSandboxes),
|
|
109
|
+
approvalPolicy: params.requested.approvalPolicy === "untrusted" ? "untrusted" : selectGuardianApprovalPolicy(allowed.approvalPolicies, userReviewRequired ? "ask" : "auto"),
|
|
110
|
+
approvalsReviewer: userReviewRequired ? selectUserApprovalsReviewer(allowed.reviewers) : selectGuardianApprovalsReviewer(allowed.reviewers, "auto")
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
/** Applies one complete session-mode tuple without mixing requirements-clamped fields. */
|
|
114
|
+
function applyCodexSessionPermissionPolicy(params) {
|
|
115
|
+
if (!params.permissionMode) return params.appServer;
|
|
116
|
+
const sessionRoot = params.sessionRoot?.trim() || params.defaultRoot;
|
|
117
|
+
if (params.policyLocked) return {
|
|
118
|
+
...params.appServer,
|
|
119
|
+
sessionRoot
|
|
120
|
+
};
|
|
121
|
+
const requested = tightenTupleForExecMode(tupleForMode(params.permissionMode, params.canUseAutoReview), params.execMode, params.appServer.approvalPolicy === "untrusted");
|
|
122
|
+
const tuple = params.appServer.start.transport === "stdio" ? clampSessionPermissionTuple({
|
|
123
|
+
mode: params.permissionMode,
|
|
124
|
+
requested,
|
|
125
|
+
requirementsToml: params.requirementsToml,
|
|
126
|
+
hostName: params.hostName,
|
|
127
|
+
canUseAutoReview: params.canUseAutoReview
|
|
128
|
+
}) : requested;
|
|
129
|
+
const networkProxy = params.appServer.networkProxy ? resolveCodexAppServerNetworkProxy(params.pluginConfig.appServer?.networkProxy, tuple.sandbox).networkProxy : void 0;
|
|
130
|
+
const resolved = {
|
|
131
|
+
...params.appServer,
|
|
132
|
+
...tuple,
|
|
133
|
+
sessionRoot
|
|
134
|
+
};
|
|
135
|
+
if (networkProxy) resolved.networkProxy = networkProxy;
|
|
136
|
+
else delete resolved.networkProxy;
|
|
137
|
+
return resolved;
|
|
138
|
+
}
|
|
139
|
+
function resolveCodexEffectiveSessionPermissionPolicy(params) {
|
|
140
|
+
if (!params.permissionMode) return;
|
|
141
|
+
const root = params.sessionRoot?.trim() || params.defaultRoot;
|
|
142
|
+
const { sandbox, approvalPolicy, approvalsReviewer } = params.appServer;
|
|
143
|
+
const fullAccess = params.permissionMode === "full" && sandbox === "danger-full-access" && approvalPolicy === "never";
|
|
144
|
+
const guardianReview = params.permissionMode !== "guarded" && sandbox === "workspace-write" && approvalPolicy === "on-request" && approvalsReviewer !== "user";
|
|
145
|
+
const mode = params.permissionMode === "read-only" || sandbox === "read-only" ? "read-only" : fullAccess ? "full" : guardianReview ? "workspace" : "guarded";
|
|
146
|
+
return {
|
|
147
|
+
mode,
|
|
148
|
+
root,
|
|
149
|
+
execMode: CODEX_SESSION_PERMISSION_EXEC_MODES[mode]
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
/** Keeps relative execution inside the prepared root without filesystem rediscovery. */
|
|
153
|
+
function resolveCodexSessionPermissionCwd(params) {
|
|
154
|
+
if (!params.permissionMode) return params.requestedCwd ?? params.fallbackCwd;
|
|
155
|
+
const sessionRoot = params.sessionRoot?.trim() || params.defaultRoot;
|
|
156
|
+
const requestedCwd = params.requestedCwd?.trim();
|
|
157
|
+
return requestedCwd && isPathInside(sessionRoot, requestedCwd) ? requestedCwd : sessionRoot;
|
|
158
|
+
}
|
|
159
|
+
//#endregion
|
|
160
|
+
export { resolveCodexAppServerForModelProvider as a, resolveCodexSessionPermissionCwd as i, applyCodexSessionPermissionPolicy as n, resolveCodexEffectiveSessionPermissionPolicy as r, CODEX_SESSION_PERMISSION_EXEC_MODES as t };
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { St as releaseCodexAppServerLiveThread, _ as retainSharedCodexAppServerClientByInstanceId, bt as isCodexAppServerLiveThreadClaimed, vt as hasCodexAppServerLiveThread } from "./shared-client-kNkljY-R.js";
|
|
2
|
+
import { a as closeCodexStartupClientBestEffort, f as unsubscribeCodexThreadBestEffort, n as CODEX_APP_SERVER_UNSUBSCRIBE_TIMEOUT_MS, r as CodexAppServerUnsafeSubscriptionError } from "./attempt-client-cleanup-CVPvp9dL.js";
|
|
3
|
+
import { l as isIncognitoSessionKey, o as withCodexAppServerThreadMutation } from "./thread-ownership-CeYBqg_4.js";
|
|
4
|
+
import { t as codexNativeSubagentMonitorRuntime } from "./native-subagent-monitor-CwFyoylz.js";
|
|
5
|
+
//#region extensions/codex/src/app-server/session-retirement.ts
|
|
6
|
+
async function releaseSessionSubscription(client, binding, sessionKey, assertCurrent) {
|
|
7
|
+
assertCurrent?.();
|
|
8
|
+
codexNativeSubagentMonitorRuntime.retireParent(client, binding.threadId);
|
|
9
|
+
const released = await releaseCodexAppServerLiveThread(client, binding.threadId, assertCurrent);
|
|
10
|
+
assertCurrent?.();
|
|
11
|
+
if (!released && isIncognitoSessionKey(sessionKey)) {
|
|
12
|
+
const unsubscribed = await unsubscribeCodexThreadBestEffort(client, {
|
|
13
|
+
threadId: binding.threadId,
|
|
14
|
+
timeoutMs: CODEX_APP_SERVER_UNSUBSCRIBE_TIMEOUT_MS,
|
|
15
|
+
assertCurrent
|
|
16
|
+
});
|
|
17
|
+
assertCurrent?.();
|
|
18
|
+
if (!unsubscribed) {
|
|
19
|
+
await closeCodexStartupClientBestEffort(client);
|
|
20
|
+
throw new CodexAppServerUnsafeSubscriptionError(`Codex retired session subscription could not be released: ${binding.threadId}`);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
/** Prepare exact binding deletion before the session owner commits either database. */
|
|
25
|
+
async function withCodexAppServerSessionDeletion(bindingStore, params, run) {
|
|
26
|
+
const { assertCurrent } = params;
|
|
27
|
+
const identity = {
|
|
28
|
+
kind: "session",
|
|
29
|
+
agentId: params.agentId,
|
|
30
|
+
sessionKey: params.sessionKey,
|
|
31
|
+
sessionId: params.sessionId
|
|
32
|
+
};
|
|
33
|
+
return await bindingStore.withSessionDeletion(identity, assertCurrent, async (binding, mutation) => {
|
|
34
|
+
assertCurrent();
|
|
35
|
+
if (binding?.connectionScope === "supervision") throw new Error("Cannot delete a session while its Codex binding is owned by supervision");
|
|
36
|
+
const clientLease = binding?.clientId ? retainSharedCodexAppServerClientByInstanceId(binding.clientId) : void 0;
|
|
37
|
+
const assertUnclaimed = () => {
|
|
38
|
+
assertCurrent();
|
|
39
|
+
if (clientLease && binding && isCodexAppServerLiveThreadClaimed(clientLease.client, binding.threadId)) throw new Error("Cannot delete a session while its Codex thread is claimed by active work");
|
|
40
|
+
};
|
|
41
|
+
let committed = false;
|
|
42
|
+
try {
|
|
43
|
+
assertUnclaimed();
|
|
44
|
+
return await run({
|
|
45
|
+
commit() {
|
|
46
|
+
assertUnclaimed();
|
|
47
|
+
mutation.commit();
|
|
48
|
+
committed = true;
|
|
49
|
+
},
|
|
50
|
+
rollback() {
|
|
51
|
+
mutation.rollback();
|
|
52
|
+
committed = false;
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
} finally {
|
|
56
|
+
try {
|
|
57
|
+
if (committed && binding && clientLease) await withCodexAppServerThreadMutation(binding.threadId, async () => {
|
|
58
|
+
assertCurrent();
|
|
59
|
+
if (!hasCodexAppServerLiveThread(clientLease.client, binding.threadId) && !isIncognitoSessionKey(params.sessionKey)) return;
|
|
60
|
+
if (await bindingStore.hasOtherThreadOwner(binding.threadId)) return;
|
|
61
|
+
await releaseSessionSubscription(clientLease.client, binding, params.sessionKey, assertUnclaimed);
|
|
62
|
+
});
|
|
63
|
+
} finally {
|
|
64
|
+
clientLease?.release();
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
/** Retire binding and native subscription under the same generation/physical-client ownership fence. */
|
|
70
|
+
async function retireCodexAppServerSessionGeneration(params) {
|
|
71
|
+
const retireGeneration = () => params.mode === "reset" ? params.bindingStore.resetSessionGeneration(params.identity) : params.bindingStore.retireSessionGeneration(params.identity);
|
|
72
|
+
const expectedBinding = await params.bindingStore.read(params.identity);
|
|
73
|
+
if (!expectedBinding) return await retireGeneration();
|
|
74
|
+
return await params.bindingStore.withLease(params.identity, async () => {
|
|
75
|
+
const binding = await params.bindingStore.read(params.identity);
|
|
76
|
+
if (binding?.threadId !== expectedBinding.threadId) return "conflict";
|
|
77
|
+
const result = await retireGeneration();
|
|
78
|
+
if (result !== "applied" || !binding?.clientId) return result;
|
|
79
|
+
const clientLease = retainSharedCodexAppServerClientByInstanceId(binding.clientId);
|
|
80
|
+
if (!clientLease) return result;
|
|
81
|
+
try {
|
|
82
|
+
await releaseSessionSubscription(clientLease.client, binding, params.identity.sessionKey);
|
|
83
|
+
} finally {
|
|
84
|
+
clientLease.release();
|
|
85
|
+
}
|
|
86
|
+
return result;
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
//#endregion
|
|
90
|
+
export { retireCodexAppServerSessionGeneration, withCodexAppServerSessionDeletion };
|
|
@@ -1,15 +1,14 @@
|
|
|
1
|
-
import { r as importCodexThreadHistoryToTranscript } from "./transcript-mirror-
|
|
1
|
+
import { r as importCodexThreadHistoryToTranscript } from "./transcript-mirror-CkEQIna-.js";
|
|
2
2
|
import { resolveStorePath } from "openclaw/plugin-sdk/session-store-runtime";
|
|
3
3
|
//#region extensions/codex/src/app-server/session-history-import.ts
|
|
4
4
|
/** Creates a session whose transcript is derived from one verified Codex thread snapshot. */
|
|
5
5
|
async function createImportedCodexSession(params) {
|
|
6
|
-
const label = params.thread.name?.trim() || void 0;
|
|
7
6
|
const spawnedCwd = params.thread.cwd?.trim() || void 0;
|
|
8
7
|
const createParams = {
|
|
9
8
|
cfg: params.config,
|
|
10
9
|
key: params.key,
|
|
11
10
|
agentId: params.agentId,
|
|
12
|
-
...
|
|
11
|
+
...params.displayName !== void 0 ? { displayName: params.displayName } : {},
|
|
13
12
|
...spawnedCwd ? { spawnedCwd } : {},
|
|
14
13
|
initialEntry: params.initialEntry,
|
|
15
14
|
afterCreate: async (entry) => {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Ht as isJsonObject } from "./shared-client-kNkljY-R.js";
|
|
2
2
|
import { i as readUpstreamUserText, r as readMirrorIdentity, t as attachCodexMirrorIdentity } from "./upstream-prompt-provenance-CFmsKwr9.js";
|
|
3
|
-
import { c as
|
|
4
|
-
import { t as runBoundedCodexAppServerTurn } from "./bounded-turn-
|
|
5
|
-
import {
|
|
3
|
+
import { c as fingerprintCodexMirrorSourceMessage, l as readCodexMirrorSourceFingerprint, t as codexTranscriptMirrorRuntime } from "./transcript-mirror-CkEQIna-.js";
|
|
4
|
+
import { t as runBoundedCodexAppServerTurn } from "./bounded-turn-rq5tiSXk.js";
|
|
5
|
+
import { r as createAssistantMessage } from "./event-projector-assistant-message-C5-Ds8mA.js";
|
|
6
6
|
import { isRecord, normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
7
7
|
import { Buffer } from "node:buffer";
|
|
8
8
|
import { isSilentReplyText } from "openclaw/plugin-sdk/reply-runtime";
|
|
@@ -10,7 +10,7 @@ import { isSilentReplyText } from "openclaw/plugin-sdk/reply-runtime";
|
|
|
10
10
|
const MAX_RESPONSE_ITEMS = 200;
|
|
11
11
|
const MAX_PROJECTION_BYTES = 512 * 1024;
|
|
12
12
|
const MAX_TEXT_BYTES = 64 * 1024;
|
|
13
|
-
const TOOL_NAME_PATTERN = /^[a-zA-Z0-
|
|
13
|
+
const TOOL_NAME_PATTERN = /^[a-zA-Z0-9._-]{1,128}$/u;
|
|
14
14
|
const TOOL_ERROR_STATUS_PREFIX = "[Tool result status: error]\n";
|
|
15
15
|
function readBoundedText(value, label, maxBytes = MAX_TEXT_BYTES) {
|
|
16
16
|
if (typeof value !== "string" || !value.trim()) return;
|
|
@@ -32,7 +32,7 @@ function requireCallId(value) {
|
|
|
32
32
|
}
|
|
33
33
|
function requireToolName(value) {
|
|
34
34
|
const name = normalizeOptionalString(value);
|
|
35
|
-
if (!name || !TOOL_NAME_PATTERN.test(name)) throw new Error(
|
|
35
|
+
if (!name || !TOOL_NAME_PATTERN.test(name)) throw new Error(`Codex settled-turn projection found an invalid tool name${name ? `: ${name.slice(0, 64)}` : ""}`);
|
|
36
36
|
return name;
|
|
37
37
|
}
|
|
38
38
|
function serializeToolArguments(value) {
|
|
@@ -308,6 +308,7 @@ async function runCodexSettledTurnFinalization(operation, options) {
|
|
|
308
308
|
mirrorIdentity,
|
|
309
309
|
runId: attempt.runId
|
|
310
310
|
},
|
|
311
|
+
prepareAssistantTranscriptMessage: attempt.prepareAssistantTranscriptMessage,
|
|
311
312
|
config: attempt.config,
|
|
312
313
|
skipBeforeMessageWriteHooks: true
|
|
313
314
|
});
|