@openclaw/codex 2026.9.2 → 2026.9.4
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/README.md +2 -0
- package/dist/api.js +29 -26
- package/dist/apply-CvT8tW5i.js +356 -0
- package/dist/{attempt-client-cleanup-Bp1ZOnk2.js → attempt-client-cleanup-DKHzbwt5.js} +38 -214
- package/dist/{attempt-context-CSazkWns.js → attempt-context-D44yeDII.js} +9 -7
- package/dist/{event-projector-usage-ZqEVbAEY.js → attempt-notifications-C9XufG6l.js} +3 -106
- package/dist/{auth-binding-Ds_QVm-X.js → auth-binding-CWlKVccJ.js} +2 -2
- package/dist/auth-cache-key-7orQae_j.js +498 -0
- package/dist/auth-profile-CwzO4_RG.js +43 -0
- package/dist/auth-profile-selection-DFu9e167.js +45 -0
- package/dist/binding-connection-D3udKbIE.js +60 -0
- package/dist/{bounded-turn-DxGJRYbY.js → bounded-turn-C_Hneydj.js} +28 -125
- package/dist/build-state-BCmg9-5p.js +19 -0
- package/dist/{capabilities-B1mgvpP8.js → capabilities-8vx68WLH.js} +1 -1
- package/dist/cli-metadata.js +1 -1
- package/dist/client-B57KWPQx.js +4005 -0
- package/dist/command-dispatch-BpduNGVf.js +21 -0
- package/dist/{command-formatters-DSbGMXA0.js → command-formatters-lxlkNZgU.js} +4 -3
- package/dist/{command-handlers-DOJvGv6-.js → command-handlers-tiL9iWj7.js} +788 -135
- package/dist/command-rpc-CR5EOEZX.js +233 -0
- package/dist/{compact-Y_xBqrHN.js → compact-B_H3AOd7.js} +19 -14
- package/dist/config-oIORaQ5T.js +106 -0
- package/dist/{config-CyapYSji.js → config-options-CXMq1T-C.js} +205 -593
- package/dist/config-runtime-D0zGNIHu.js +11 -0
- package/dist/{config-utils-C57JiJrU.js → config-utils-DujwEnhg.js} +2 -4
- package/dist/conversation-binding-DsB4-O7U.js +900 -0
- package/dist/{plugin-marketplace-discovery-B7gHXJ3d.js → conversation-control-CtUu1b3m.js} +11 -143
- package/dist/doctor-contract-api.js +5 -5
- package/dist/{dynamic-tools-BwpvTxaX.js → dynamic-tools-CmN5RAip.js} +133 -76
- package/dist/{effective-mcp-catalog-CY9Jn4bA.js → effective-mcp-catalog-Bd73bqA8.js} +3 -3
- package/dist/{elicitation-input-DMkeki8d.js → elicitation-input-DPoK8F7w.js} +8 -22
- package/dist/ephemeral-turn-D78_VmzO.js +101 -0
- package/dist/{event-projector-assistant-message-B9kp6iGC.js → event-projector-assistant-message-BmBM4qBV.js} +12 -25
- package/dist/event-projector-items-5VhsECCO.js +200 -0
- package/dist/event-projector-usage-BfXmpOec.js +102 -0
- package/dist/{harness-Czh2Sdoc.js → harness-C7rRa7bm.js} +48 -24
- package/dist/harness.js +1 -1
- package/dist/history-rejection-B4nOXNXF.js +13 -0
- package/dist/incognito-session-uhrBF6wJ.js +15 -0
- package/dist/index.js +406 -2915
- package/dist/inference-context-Dr_mzvk4.js +94 -0
- package/dist/inference-proxy-HGXKUIre.js +311 -0
- package/dist/{isolated-completion-CRh-51AK.js → isolated-completion-DWVb5U2J.js} +7 -4
- package/dist/launch-args-RXQwn8zV.js +90 -0
- package/dist/{managed-binary-DcpnJF9x.js → managed-binary-D22rNEcR.js} +13 -103
- package/dist/managed-thread-store-D1t5jh3G.js +66 -0
- package/dist/media-understanding-provider.js +4 -1
- package/dist/migration-provider-api.js +2 -0
- package/dist/{model-catalog-DT5vo6qo.js → model-catalog-Dq2n8f_p.js} +6 -5
- package/dist/{models-CcrgSMQR.js → models-PCKOim-h.js} +3 -3
- package/dist/native-execution-policy-umd0tgh4.js +128 -0
- package/dist/native-subagent-history-DjtPloaU.js +140 -0
- package/dist/native-subagent-history-owner-Pcp7JuVF.js +34 -0
- package/dist/{native-subagent-monitor-B3bvQGcg.js → native-subagent-monitor-fQ7eIXEf.js} +115 -460
- package/dist/native-subagent-task-ids-BzTdT0Uw.js +387 -0
- package/dist/node-cli-sessions-DKaOmVUh.js +527 -0
- package/dist/{node-exec-server.runtime-nfbUOtUB.js → node-exec-server.runtime-Cl2vapEi.js} +55 -24
- package/dist/plan-7uG-Fp36.js +947 -0
- package/dist/plugin-activation-BYQculil.js +138 -0
- package/dist/{thread-resume-BLgqkUc1.js → plugin-app-cache-key-d0eKxy7b.js} +4 -52
- package/dist/{plugin-approval-roundtrip-aQVdyL5g.js → plugin-approval-roundtrip-Bz3FT8W5.js} +1 -1
- package/dist/plugin-inventory-oL4Na1ZG.js +328 -0
- package/dist/plugin-marketplace-discovery-P-Vndfqq.js +137 -0
- package/dist/{plugin-metadata-cache-BwCLTY_U.js → plugin-metadata-cache-ClPJpRio.js} +17 -9
- package/dist/protocol-5bh1G-H7.js +275 -0
- package/dist/provider-MQ8PVkuE.js +50 -0
- package/dist/{provider-capabilities-BpG9Ltc5.js → provider-capabilities-BvCUL69A.js} +2 -2
- package/dist/{rate-limits-Fx_l4eNa.js → rate-limits-CBMmWBr9.js} +1 -1
- package/dist/request-B7hEkBGq.js +212 -0
- package/dist/rpc-error-ttN_QjEm.js +30 -0
- package/dist/{run-attempt-BzthFQSM.js → run-attempt-CvsAAGa0.js} +664 -377
- package/dist/{runtime-artifact-Bh_gf6-t.js → runtime-artifact-BJ0rXBZ_.js} +27 -27
- package/dist/sandbox-guard-BxgyoM8M.js +166 -0
- package/dist/{session-binding-4Ki04sW-.js → session-binding-CI8UuilT.js} +30 -48
- package/dist/{session-binding-record-CyaXZvTe.js → session-binding-record-Bcvslnhf.js} +12 -26
- package/dist/session-catalog-adoption-tcZi1IfX.js +251 -0
- package/dist/session-catalog-archive-CwKg8Xz2.js +56 -0
- package/dist/session-catalog-ct-AH01I.js +1477 -0
- package/dist/session-catalog-home-id-CwhLdC03.js +18 -0
- package/dist/session-catalog-node-adoption-B1tgDW-m.js +182 -0
- package/dist/session-catalog-node-continue-Ci-DXyJP.js +238 -0
- package/dist/session-catalog-provenance-D-dIfRAH.js +96 -0
- package/dist/{session-cli-BjLhpmS1.js → session-cli-DNN_jhGc.js} +3 -2
- package/dist/{session-history-DWmMqiqW.js → session-history-Cz-tOOYj.js} +6 -3
- package/dist/{session-upstream-marker-DReTpGz6.js → session-history-import-DwyijFI6.js} +5 -50
- package/dist/{session-history-read-LHldwvyh.js → session-history-read-cxPUxyVV.js} +21 -7
- package/dist/session-history-worker-runtime.js +18 -6
- package/dist/session-history.worker-BeK1YOyT.js +378 -0
- package/dist/session-history.worker.js +1 -1
- package/dist/{session-initialization-BCFVnLL4.js → session-initialization-Ct0_Hzmg.js} +2 -2
- package/dist/{session-permission-policy-BaueHmSj.js → session-permission-policy-BBmXA8Eg.js} +4 -7
- package/dist/{session-retirement-DNdmYdFc.js → session-retirement-B2YfbAAT.js} +6 -5
- package/dist/session-upstream-marker-D15C9NHp.js +46 -0
- package/dist/{settled-turn-context-BOM3Y1pl.js → settled-turn-context-Du6gdUDd.js} +9 -9
- package/dist/{settled-turn-finalizer-BI-b1sry.js → settled-turn-finalizer-Dn91stmc.js} +8 -7
- package/dist/shared-client-CscigXXL.js +3109 -0
- package/dist/{side-question-B6DWAw1A.js → side-question-BGMJQf4U.js} +65 -170
- package/dist/source-CElXU0Oy.js +518 -0
- package/dist/thread-archive-guard-DfpBr-Sz.js +53 -0
- package/dist/thread-history-page-D0JIp48V.js +361 -0
- package/dist/{thread-lifecycle-DPK30jad.js → thread-lifecycle-DXl1-I6b.js} +187 -639
- package/dist/{thread-ownership-CbucAmmp.js → thread-ownership-BsDRTsyp.js} +13 -15
- package/dist/thread-policy-BuEQfE0g.js +54 -0
- package/dist/thread-resume-DsDOZpFg.js +52 -0
- package/dist/timeout-BVw8aaM1.js +33 -0
- package/dist/transcript-history-projection-v17wXgdK.js +238 -0
- package/dist/{transcript-mirror-_njEB84z.js → transcript-mirror-C5CKgNy6.js} +50 -260
- package/dist/{transcript-mirror-attestation-Byl34PC-.js → transcript-mirror-attestation-DibE0krH.js} +17 -4
- package/dist/{transport-stdio-CzTngV0j.js → transport-stdio-BGjHoYLr.js} +73 -43
- package/dist/{upstream-session-fork-1fwbNKzQ.js → upstream-session-fork-BZerMte_.js} +27 -19
- package/dist/{usage-i9fv5-4m.js → usage-tCk-mg_x.js} +4 -3
- package/dist/version-omm6IPI3.js +12 -0
- package/dist/{web-search-provider.runtime-DKQn67A7.js → web-search-provider.runtime-B7bGbGWq.js} +3 -3
- package/openclaw.plugin.json +23 -1
- package/package.json +4 -4
- package/dist/request-C8H22rPi.js +0 -475
- package/dist/session-catalog-B47uwekb.js +0 -3272
- package/dist/session-history.worker-zZVcx0ME.js +0 -267
- package/dist/shared-client-CKhX2kFt.js +0 -7505
- package/dist/thread-policy-CTalhWFy.js +0 -105
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { o as isJsonObject } from "./protocol-5bh1G-H7.js";
|
|
2
|
+
import { T as readCodexTurnCompletedNotification } from "./client-B57KWPQx.js";
|
|
3
|
+
import { p as getCodexAppServerTurnRouter } from "./attempt-client-cleanup-DKHzbwt5.js";
|
|
4
|
+
import { o as isTerminalTurnStatus, s as readCodexNotificationItem } from "./attempt-notifications-C9XufG6l.js";
|
|
5
|
+
import { t as CodexUsageProjection } from "./event-projector-usage-BfXmpOec.js";
|
|
6
|
+
import { readStringField } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
7
|
+
import { toStringifiedError } from "openclaw/plugin-sdk/error-runtime";
|
|
8
|
+
import { createDeferred } from "openclaw/plugin-sdk/extension-shared";
|
|
9
|
+
//#region extensions/codex/src/app-server/ephemeral-turn.ts
|
|
10
|
+
/** One ephemeral turn; the client router owns correlation, buffering and request lifetime. */
|
|
11
|
+
var CodexEphemeralTurn = class {
|
|
12
|
+
constructor(client, threadId, options) {
|
|
13
|
+
this.options = options;
|
|
14
|
+
this.completion = createDeferred();
|
|
15
|
+
this.usage = new CodexUsageProjection();
|
|
16
|
+
this.items = /* @__PURE__ */ new Map();
|
|
17
|
+
this.assistantItems = /* @__PURE__ */ new Map();
|
|
18
|
+
this.assistantText = "";
|
|
19
|
+
this.route = getCodexAppServerTurnRouter(client).reserveThread({
|
|
20
|
+
threadId,
|
|
21
|
+
...options,
|
|
22
|
+
onNotification: async (notification, scope) => {
|
|
23
|
+
const params = isJsonObject(notification.params) ? notification.params : void 0;
|
|
24
|
+
if (params && scope.turnId) {
|
|
25
|
+
if (notification.method === "item/completed" && options.textMode === "all") {
|
|
26
|
+
const item = readCodexNotificationItem(params);
|
|
27
|
+
if (item) {
|
|
28
|
+
this.items.set(item.id, item);
|
|
29
|
+
if (item.type === "agentMessage" && item.text) this.assistantItems.set(item.id, item.text);
|
|
30
|
+
}
|
|
31
|
+
} else if (notification.method === "item/agentMessage/delta") {
|
|
32
|
+
const delta = readStringField(params, "delta") ?? "";
|
|
33
|
+
const itemId = readStringField(params, "itemId") ?? readStringField(params, "id") ?? "assistant";
|
|
34
|
+
const firstDelta = !this.assistantText && Boolean(delta);
|
|
35
|
+
this.assistantText += delta;
|
|
36
|
+
if (delta && options.textMode === "all") this.assistantItems.set(itemId, `${this.assistantItems.get(itemId) ?? ""}${delta}`);
|
|
37
|
+
if (firstDelta) await options.onAssistantMessageStart?.();
|
|
38
|
+
} else if (notification.method === "rawResponse/completed") this.usage.record(params);
|
|
39
|
+
else if (notification.method === "turn/completed") {
|
|
40
|
+
this.turn = readCodexTurnCompletedNotification(params)?.turn ?? this.turn;
|
|
41
|
+
this.completion.resolve();
|
|
42
|
+
} else if (notification.method === "error") {
|
|
43
|
+
this.usage.invalidateContext();
|
|
44
|
+
if (params.willRetry !== true) {
|
|
45
|
+
this.error = params;
|
|
46
|
+
this.completion.resolve();
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
await options.onNotification?.(notification, scope);
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
this.route.armTurn();
|
|
54
|
+
}
|
|
55
|
+
get completed() {
|
|
56
|
+
return this.turn !== void 0;
|
|
57
|
+
}
|
|
58
|
+
async wait(turn, options) {
|
|
59
|
+
if (isTerminalTurnStatus(turn.status)) {
|
|
60
|
+
this.turn = turn;
|
|
61
|
+
this.completion.resolve();
|
|
62
|
+
}
|
|
63
|
+
const completion = this.route.bindTurn(turn.id, { completed: isTerminalTurnStatus(turn.status) }).then(() => this.completion.promise);
|
|
64
|
+
const signals = [this.route.signal, options.signal];
|
|
65
|
+
const abortError = () => options.signal.aborted ? options.abortError() : toStringifiedError(this.route.signal.reason);
|
|
66
|
+
let timer;
|
|
67
|
+
let abort = () => {};
|
|
68
|
+
try {
|
|
69
|
+
await Promise.race([completion, new Promise((_resolve, reject) => {
|
|
70
|
+
abort = () => {
|
|
71
|
+
if (options.signal.aborted || !this.route.completed) reject(abortError());
|
|
72
|
+
};
|
|
73
|
+
for (const signal of signals) {
|
|
74
|
+
signal.addEventListener("abort", abort, { once: true });
|
|
75
|
+
if (signal.aborted) abort();
|
|
76
|
+
}
|
|
77
|
+
const timeout = options.timeout;
|
|
78
|
+
if (timeout) {
|
|
79
|
+
timer = setTimeout(() => reject(timeout.error), timeout.ms);
|
|
80
|
+
timer.unref?.();
|
|
81
|
+
}
|
|
82
|
+
})]);
|
|
83
|
+
} finally {
|
|
84
|
+
clearTimeout(timer);
|
|
85
|
+
for (const signal of signals) signal.removeEventListener("abort", abort);
|
|
86
|
+
}
|
|
87
|
+
const items = new Map(this.items);
|
|
88
|
+
for (const item of this.turn?.items ?? []) items.set(item.id, item);
|
|
89
|
+
const messages = (this.options.textMode === "last" ? this.turn?.items ?? [] : [...items.values()]).filter((item) => item.type === "agentMessage").map((item) => item.text.trim()).filter(Boolean);
|
|
90
|
+
const text = this.options.textMode === "last" ? messages.at(-1) || this.assistantText : messages.join("\n\n") || [...this.assistantItems.values()].map((message) => message.trim()).filter(Boolean).join("\n\n");
|
|
91
|
+
return {
|
|
92
|
+
turn: this.turn,
|
|
93
|
+
error: this.error,
|
|
94
|
+
items: [...items.values()],
|
|
95
|
+
text: text.trim(),
|
|
96
|
+
usage: this.usage.usage
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
//#endregion
|
|
101
|
+
export { CodexEphemeralTurn as t };
|
|
@@ -58,19 +58,11 @@ function createAttributedCodexAssistantMessage(attribution, text, options) {
|
|
|
58
58
|
};
|
|
59
59
|
}
|
|
60
60
|
function createAssistantCommentaryMessage(params, text, itemId, timestamp) {
|
|
61
|
-
const attribution = resolveCodexLocalRuntimeAttribution(params);
|
|
62
61
|
return {
|
|
63
|
-
|
|
64
|
-
content: [{
|
|
62
|
+
...createNonterminalAssistantMessage(params, [{
|
|
65
63
|
type: "text",
|
|
66
64
|
text
|
|
67
|
-
}],
|
|
68
|
-
api: attribution.api ?? "openai-chatgpt-responses",
|
|
69
|
-
provider: attribution.provider,
|
|
70
|
-
model: params.modelId,
|
|
71
|
-
usage: ZERO_USAGE,
|
|
72
|
-
stopReason: "stop",
|
|
73
|
-
timestamp,
|
|
65
|
+
}], timestamp),
|
|
74
66
|
openclawStreamFallback: {
|
|
75
67
|
replacementText: text,
|
|
76
68
|
source: "segment",
|
|
@@ -79,36 +71,31 @@ function createAssistantCommentaryMessage(params, text, itemId, timestamp) {
|
|
|
79
71
|
};
|
|
80
72
|
}
|
|
81
73
|
function createAssistantAsyncMessage(params, text, itemId, timestamp) {
|
|
82
|
-
const attribution = resolveCodexLocalRuntimeAttribution(params);
|
|
83
74
|
return {
|
|
84
|
-
|
|
85
|
-
content: [{
|
|
75
|
+
...createNonterminalAssistantMessage(params, [{
|
|
86
76
|
type: "text",
|
|
87
77
|
text
|
|
88
|
-
}],
|
|
89
|
-
api: attribution.api ?? "openai-chatgpt-responses",
|
|
90
|
-
provider: attribution.provider,
|
|
91
|
-
model: params.modelId,
|
|
92
|
-
usage: ZERO_USAGE,
|
|
93
|
-
stopReason: "stop",
|
|
94
|
-
timestamp,
|
|
78
|
+
}], timestamp),
|
|
95
79
|
openclawAsyncDelivery: { itemId }
|
|
96
80
|
};
|
|
97
81
|
}
|
|
98
82
|
function createAssistantReasoningMessage(params, text) {
|
|
83
|
+
return createNonterminalAssistantMessage(params, [{
|
|
84
|
+
type: "thinking",
|
|
85
|
+
thinking: text
|
|
86
|
+
}]);
|
|
87
|
+
}
|
|
88
|
+
function createNonterminalAssistantMessage(params, content, timestamp) {
|
|
99
89
|
const attribution = resolveCodexLocalRuntimeAttribution(params);
|
|
100
90
|
return {
|
|
101
91
|
role: "assistant",
|
|
102
|
-
content
|
|
103
|
-
type: "thinking",
|
|
104
|
-
thinking: text
|
|
105
|
-
}],
|
|
92
|
+
content,
|
|
106
93
|
api: attribution.api ?? "openai-chatgpt-responses",
|
|
107
94
|
provider: attribution.provider,
|
|
108
95
|
model: params.modelId,
|
|
109
96
|
usage: ZERO_USAGE,
|
|
110
97
|
stopReason: "stop",
|
|
111
|
-
timestamp: Date.now()
|
|
98
|
+
timestamp: timestamp ?? Date.now()
|
|
112
99
|
};
|
|
113
100
|
}
|
|
114
101
|
//#endregion
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
import { o as isJsonObject } from "./protocol-5bh1G-H7.js";
|
|
2
|
+
import { asFiniteNumber, normalizeOptionalString as normalizeOptionalString$1, readStringField } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
3
|
+
//#region extensions/codex/src/app-server/event-projector-values.ts
|
|
4
|
+
const BIO_POLICY_SAFETY_ACCESS_BLOCK_PREFIX = "This content was flagged for possible biological risk.";
|
|
5
|
+
/** Project only Codex's explicit refusal contracts; other policy errors retain their own paths. */
|
|
6
|
+
function readCodexProviderRefusal(message, codexErrorInfo) {
|
|
7
|
+
if (!message) return;
|
|
8
|
+
if (codexErrorInfo === "cyberPolicy") return {
|
|
9
|
+
category: "cyber",
|
|
10
|
+
message
|
|
11
|
+
};
|
|
12
|
+
if (codexErrorInfo === "misalignmentPolicyViolation") return {
|
|
13
|
+
category: "misalignment",
|
|
14
|
+
message
|
|
15
|
+
};
|
|
16
|
+
return message.startsWith(BIO_POLICY_SAFETY_ACCESS_BLOCK_PREFIX) ? {
|
|
17
|
+
category: "bio",
|
|
18
|
+
message
|
|
19
|
+
} : void 0;
|
|
20
|
+
}
|
|
21
|
+
function readNonEmptyString(record, key) {
|
|
22
|
+
return normalizeOptionalString$1(record[key]);
|
|
23
|
+
}
|
|
24
|
+
function readNonEmptyStringArray(record, key) {
|
|
25
|
+
const value = record[key];
|
|
26
|
+
if (!Array.isArray(value)) return [];
|
|
27
|
+
const entries = [];
|
|
28
|
+
for (const entry of value) {
|
|
29
|
+
const normalized = normalizeOptionalString$1(entry);
|
|
30
|
+
if (normalized) entries.push(normalized);
|
|
31
|
+
}
|
|
32
|
+
return entries;
|
|
33
|
+
}
|
|
34
|
+
function readNullableString(record, key) {
|
|
35
|
+
const value = record[key];
|
|
36
|
+
if (value === null) return null;
|
|
37
|
+
return typeof value === "string" ? value : void 0;
|
|
38
|
+
}
|
|
39
|
+
function readNonNegativeInteger(record, key) {
|
|
40
|
+
const value = asFiniteNumber(record[key]);
|
|
41
|
+
return value !== void 0 && Number.isInteger(value) && value >= 0 ? value : void 0;
|
|
42
|
+
}
|
|
43
|
+
function readCodexErrorNotificationMessage(record) {
|
|
44
|
+
const error = record.error;
|
|
45
|
+
return isJsonObject(error) ? readStringField(error, "message") : void 0;
|
|
46
|
+
}
|
|
47
|
+
function readHookOutputEntries(value) {
|
|
48
|
+
if (!Array.isArray(value)) return [];
|
|
49
|
+
return value.flatMap((entry) => {
|
|
50
|
+
if (!isJsonObject(entry)) return [];
|
|
51
|
+
const text = readStringField(entry, "text");
|
|
52
|
+
if (!text) return [];
|
|
53
|
+
const kind = readStringField(entry, "kind");
|
|
54
|
+
return [{
|
|
55
|
+
...kind ? { kind } : {},
|
|
56
|
+
text
|
|
57
|
+
}];
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
function splitPlanText(text) {
|
|
61
|
+
return text.split(/\r?\n/).map((line) => line.trim().replace(/^[-*]\s+/, "")).filter((line) => line.length > 0);
|
|
62
|
+
}
|
|
63
|
+
function extractRawAssistantText(item) {
|
|
64
|
+
const parts = (Array.isArray(item.content) ? item.content : []).flatMap((entry) => {
|
|
65
|
+
if (!isJsonObject(entry)) return [];
|
|
66
|
+
const type = readStringField(entry, "type");
|
|
67
|
+
if (type !== "output_text" && type !== "text") return [];
|
|
68
|
+
const value = readStringField(entry, "text");
|
|
69
|
+
return value === void 0 ? [] : [value];
|
|
70
|
+
});
|
|
71
|
+
return parts.length > 0 ? parts.join("").trim() : void 0;
|
|
72
|
+
}
|
|
73
|
+
function readItemString(item, key) {
|
|
74
|
+
const value = item[key];
|
|
75
|
+
return typeof value === "string" ? value : void 0;
|
|
76
|
+
}
|
|
77
|
+
function readItem(value) {
|
|
78
|
+
if (!isJsonObject(value)) return;
|
|
79
|
+
const type = typeof value.type === "string" ? value.type : void 0;
|
|
80
|
+
const id = typeof value.id === "string" ? value.id : void 0;
|
|
81
|
+
if (!type || !id) return;
|
|
82
|
+
return value;
|
|
83
|
+
}
|
|
84
|
+
//#endregion
|
|
85
|
+
//#region extensions/codex/src/app-server/event-projector-items.ts
|
|
86
|
+
function matchesCodexSnapshotTurn(item, turnId) {
|
|
87
|
+
const itemTurnId = readItemString(item, "turnId");
|
|
88
|
+
return itemTurnId === void 0 || itemTurnId === turnId;
|
|
89
|
+
}
|
|
90
|
+
function itemKind(item) {
|
|
91
|
+
switch (item.type) {
|
|
92
|
+
case "dynamicToolCall":
|
|
93
|
+
case "mcpToolCall": return "tool";
|
|
94
|
+
case "commandExecution": return "command";
|
|
95
|
+
case "fileChange": return "patch";
|
|
96
|
+
case "webSearch": return "search";
|
|
97
|
+
case "reasoning":
|
|
98
|
+
case "contextCompaction": return "analysis";
|
|
99
|
+
default: return;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
function itemTitle(item) {
|
|
103
|
+
switch (item.type) {
|
|
104
|
+
case "commandExecution": return "Command";
|
|
105
|
+
case "fileChange": return "File change";
|
|
106
|
+
case "mcpToolCall": return "MCP tool";
|
|
107
|
+
case "dynamicToolCall": return "Tool";
|
|
108
|
+
case "webSearch": return "Web search";
|
|
109
|
+
case "contextCompaction": return "Context compaction";
|
|
110
|
+
case "reasoning": return "Reasoning";
|
|
111
|
+
default: return item.type;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
function itemStatus(item) {
|
|
115
|
+
const status = readItemString(item, "status");
|
|
116
|
+
if (status === "failed" || status === "error") return "failed";
|
|
117
|
+
if (status === "declined") return "blocked";
|
|
118
|
+
if (status === "inProgress" || status === "in_progress" || status === "running") return "running";
|
|
119
|
+
return "completed";
|
|
120
|
+
}
|
|
121
|
+
function unknownItemStatus(item) {
|
|
122
|
+
const status = readItemString(item, "status");
|
|
123
|
+
switch (status) {
|
|
124
|
+
case void 0:
|
|
125
|
+
case "completed":
|
|
126
|
+
case "failed":
|
|
127
|
+
case "error":
|
|
128
|
+
case "declined":
|
|
129
|
+
case "inProgress":
|
|
130
|
+
case "in_progress":
|
|
131
|
+
case "running": return;
|
|
132
|
+
default: return status;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
function auditNativeToolTerminalStatus(item) {
|
|
136
|
+
if (item.type === "imageView" || item.type === "sleep") return "completed";
|
|
137
|
+
const status = readItemString(item, "status");
|
|
138
|
+
if (status === "completed") return "completed";
|
|
139
|
+
if (status === "failed" || status === "error") return "failed";
|
|
140
|
+
if (status === "declined") return "blocked";
|
|
141
|
+
return "unknown";
|
|
142
|
+
}
|
|
143
|
+
function auditNativeToolUnfinishedStatus(item) {
|
|
144
|
+
return item.type === "webSearch" || item.type === "imageGeneration" ? "unknown" : "failed";
|
|
145
|
+
}
|
|
146
|
+
function isNonSuccessItemStatus(status) {
|
|
147
|
+
return status === "failed" || status === "blocked";
|
|
148
|
+
}
|
|
149
|
+
function itemName(item) {
|
|
150
|
+
if (item.type === "dynamicToolCall" && typeof item.tool === "string") return item.tool;
|
|
151
|
+
if (item.type === "mcpToolCall" && typeof item.tool === "string") {
|
|
152
|
+
const server = typeof item.server === "string" ? item.server : void 0;
|
|
153
|
+
return server ? `${server}.${item.tool}` : item.tool;
|
|
154
|
+
}
|
|
155
|
+
if (item.type === "commandExecution") return "bash";
|
|
156
|
+
if (item.type === "fileChange") return "apply_patch";
|
|
157
|
+
if (item.type === "webSearch") return "web_search";
|
|
158
|
+
}
|
|
159
|
+
function auditNativeToolName(item) {
|
|
160
|
+
if (item.type === "dynamicToolCall") return;
|
|
161
|
+
const progressName = itemName(item);
|
|
162
|
+
if (progressName) return progressName;
|
|
163
|
+
if (item.type === "collabAgentToolCall") return typeof item.tool === "string" && item.tool.trim() ? `collab.${item.tool.trim()}` : "collab_agent";
|
|
164
|
+
if (item.type === "imageGeneration") return "image_generation";
|
|
165
|
+
if (item.type === "imageView") return "image_view";
|
|
166
|
+
if (item.type === "sleep") return "sleep";
|
|
167
|
+
}
|
|
168
|
+
function isSideEffectingNativeToolItem(item) {
|
|
169
|
+
return itemStatus(item) !== "blocked" && (isMutatingNativeToolItem(item) || item.type === "mcpToolCall");
|
|
170
|
+
}
|
|
171
|
+
function shouldSynthesizeToolProgressForItem(item) {
|
|
172
|
+
switch (item.type) {
|
|
173
|
+
case "commandExecution":
|
|
174
|
+
case "fileChange":
|
|
175
|
+
case "webSearch":
|
|
176
|
+
case "mcpToolCall": return true;
|
|
177
|
+
default: return false;
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
function shouldRecordNativeToolTranscript(item) {
|
|
181
|
+
return shouldSynthesizeToolProgressForItem(item);
|
|
182
|
+
}
|
|
183
|
+
function isMutatingNativeToolItem(item) {
|
|
184
|
+
if (item.type === "commandExecution") return true;
|
|
185
|
+
return item.type === "fileChange" || item.type === "collabAgentToolCall" || item.type === "imageGeneration";
|
|
186
|
+
}
|
|
187
|
+
function shouldClearTerminalPresentationForNativeItem(item) {
|
|
188
|
+
switch (item.type) {
|
|
189
|
+
case "collabAgentToolCall":
|
|
190
|
+
case "commandExecution":
|
|
191
|
+
case "fileChange":
|
|
192
|
+
case "imageGeneration":
|
|
193
|
+
case "imageView":
|
|
194
|
+
case "mcpToolCall":
|
|
195
|
+
case "webSearch": return true;
|
|
196
|
+
default: return false;
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
//#endregion
|
|
200
|
+
export { readNonEmptyString as C, splitPlanText as D, readNullableString as E, readItemString as S, readNonNegativeInteger as T, normalizeOptionalString$1 as _, isNonSuccessItemStatus as a, readHookOutputEntries as b, itemName as c, matchesCodexSnapshotTurn as d, shouldClearTerminalPresentationForNativeItem as f, extractRawAssistantText as g, unknownItemStatus as h, isMutatingNativeToolItem as i, itemStatus as l, shouldSynthesizeToolProgressForItem as m, auditNativeToolTerminalStatus as n, isSideEffectingNativeToolItem as o, shouldRecordNativeToolTranscript as p, auditNativeToolUnfinishedStatus as r, itemKind as s, auditNativeToolName as t, itemTitle as u, readCodexErrorNotificationMessage as v, readNonEmptyStringArray as w, readItem as x, readCodexProviderRefusal as y };
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { o as isJsonObject } from "./protocol-5bh1G-H7.js";
|
|
2
|
+
import { asSafeIntegerInRange, readStringField } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
3
|
+
import { normalizeUsage } from "openclaw/plugin-sdk/agent-harness-runtime";
|
|
4
|
+
//#region extensions/codex/src/app-server/event-projector-usage.ts
|
|
5
|
+
function readTokenCount(record, key) {
|
|
6
|
+
return asSafeIntegerInRange(record[key], { min: 0 });
|
|
7
|
+
}
|
|
8
|
+
function readCodexThreadTokenUsage(params) {
|
|
9
|
+
const tokenUsage = isJsonObject(params.tokenUsage) ? params.tokenUsage : void 0;
|
|
10
|
+
const last = tokenUsage && isJsonObject(tokenUsage.last) ? tokenUsage.last : void 0;
|
|
11
|
+
return last ? normalizeCodexResponseTokenUsage(last) : void 0;
|
|
12
|
+
}
|
|
13
|
+
function readCodexThreadContextSnapshot(params) {
|
|
14
|
+
const tokenUsage = isJsonObject(params.tokenUsage) ? params.tokenUsage : void 0;
|
|
15
|
+
const last = tokenUsage && isJsonObject(tokenUsage.last) ? tokenUsage.last : void 0;
|
|
16
|
+
const modelContextWindow = tokenUsage ? readTokenCount(tokenUsage, "modelContextWindow") : void 0;
|
|
17
|
+
const activeContextTokens = last ? readTokenCount(last, "totalTokens") : void 0;
|
|
18
|
+
const inputTokens = last ? readTokenCount(last, "inputTokens") : void 0;
|
|
19
|
+
const cachedInputTokens = last ? readTokenCount(last, "cachedInputTokens") : void 0;
|
|
20
|
+
const cacheWriteInputTokens = last ? readTokenCount(last, "cacheWriteInputTokens") : void 0;
|
|
21
|
+
const reasoningOutputTokens = last ? readTokenCount(last, "reasoningOutputTokens") : void 0;
|
|
22
|
+
return {
|
|
23
|
+
...activeContextTokens !== void 0 ? { activeContextTokens } : {},
|
|
24
|
+
...cachedInputTokens !== void 0 ? { cachedInputTokens } : {},
|
|
25
|
+
...cacheWriteInputTokens !== void 0 ? { cacheWriteInputTokens } : {},
|
|
26
|
+
...inputTokens !== void 0 ? { inputTokens } : {},
|
|
27
|
+
...modelContextWindow && modelContextWindow > 0 ? { modelContextWindow } : {},
|
|
28
|
+
...inputTokens !== void 0 ? { promptTokens: inputTokens } : {},
|
|
29
|
+
...reasoningOutputTokens !== void 0 ? { reasoningOutputTokens } : {}
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
function normalizeCodexResponseTokenUsage(record) {
|
|
33
|
+
const totalTokens = readTokenCount(record, "totalTokens");
|
|
34
|
+
const inputTokens = readTokenCount(record, "inputTokens");
|
|
35
|
+
const cacheRead = readTokenCount(record, "cachedInputTokens");
|
|
36
|
+
const output = readTokenCount(record, "outputTokens");
|
|
37
|
+
const reasoningTokens = readTokenCount(record, "reasoningOutputTokens");
|
|
38
|
+
const cacheWrite = record.cacheWriteInputTokens === void 0 ? 0 : readTokenCount(record, "cacheWriteInputTokens");
|
|
39
|
+
const hasCoherentInput = inputTokens !== void 0 && cacheRead !== void 0 && cacheWrite !== void 0 && cacheRead + cacheWrite <= inputTokens;
|
|
40
|
+
const hasCoherentContext = hasCoherentInput && totalTokens !== void 0 && output !== void 0 && totalTokens === inputTokens + output;
|
|
41
|
+
const usage = normalizeUsage({
|
|
42
|
+
input: hasCoherentInput ? inputTokens - cacheRead - cacheWrite : void 0,
|
|
43
|
+
output,
|
|
44
|
+
cacheRead,
|
|
45
|
+
cacheWrite,
|
|
46
|
+
reasoningTokens,
|
|
47
|
+
total: totalTokens
|
|
48
|
+
});
|
|
49
|
+
if (!usage) return;
|
|
50
|
+
return {
|
|
51
|
+
...usage,
|
|
52
|
+
contextUsage: hasCoherentContext ? {
|
|
53
|
+
state: "available",
|
|
54
|
+
promptTokens: inputTokens,
|
|
55
|
+
totalTokens
|
|
56
|
+
} : { state: "unavailable" }
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
var CodexUsageProjection = class {
|
|
60
|
+
constructor() {
|
|
61
|
+
this.responseIds = /* @__PURE__ */ new Set();
|
|
62
|
+
}
|
|
63
|
+
get usage() {
|
|
64
|
+
const usage = this.responseUsage ?? this.threadUsage;
|
|
65
|
+
return usage ? {
|
|
66
|
+
...usage,
|
|
67
|
+
contextUsage: this.contextUsage
|
|
68
|
+
} : void 0;
|
|
69
|
+
}
|
|
70
|
+
get modelIterations() {
|
|
71
|
+
return this.responseIds.size;
|
|
72
|
+
}
|
|
73
|
+
invalidateContext() {
|
|
74
|
+
this.contextUsage = { state: "unavailable" };
|
|
75
|
+
}
|
|
76
|
+
recordThread(params) {
|
|
77
|
+
const usage = readCodexThreadTokenUsage(params);
|
|
78
|
+
this.threadUsage = usage ?? this.threadUsage;
|
|
79
|
+
if (!this.responseUsage && usage) this.contextUsage = usage.contextUsage;
|
|
80
|
+
return readCodexThreadContextSnapshot(params);
|
|
81
|
+
}
|
|
82
|
+
record(params, reportOutputTokens) {
|
|
83
|
+
const responseId = readStringField(params, "responseId");
|
|
84
|
+
if (!responseId || this.responseIds.has(responseId)) return;
|
|
85
|
+
this.responseIds.add(responseId);
|
|
86
|
+
const usage = isJsonObject(params.usage) ? normalizeCodexResponseTokenUsage(params.usage) : void 0;
|
|
87
|
+
this.contextUsage = usage?.contextUsage ?? { state: "unavailable" };
|
|
88
|
+
this.responseUsage ??= {};
|
|
89
|
+
for (const field of [
|
|
90
|
+
"input",
|
|
91
|
+
"output",
|
|
92
|
+
"cacheRead",
|
|
93
|
+
"cacheWrite",
|
|
94
|
+
"reasoningTokens",
|
|
95
|
+
"total"
|
|
96
|
+
]) if (usage?.[field] !== void 0) this.responseUsage[field] = (this.responseUsage[field] ?? 0) + usage[field];
|
|
97
|
+
const outputTokens = usage?.output;
|
|
98
|
+
if (outputTokens !== void 0) reportOutputTokens?.(outputTokens);
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
//#endregion
|
|
102
|
+
export { readCodexThreadContextSnapshot as n, CodexUsageProjection as t };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { l as sessionBindingIdentity
|
|
1
|
+
import { l as sessionBindingIdentity } from "./session-binding-record-Bcvslnhf.js";
|
|
2
|
+
import { t as codexBuildSymbol } from "./build-state-BCmg9-5p.js";
|
|
2
3
|
import { resolvePluginConfigObject } from "openclaw/plugin-sdk/plugin-config-runtime";
|
|
3
|
-
import { runHostPreparedIsolatedCompletion } from "openclaw/plugin-sdk/simple-completion-runtime";
|
|
4
4
|
import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
5
5
|
//#region extensions/codex/src/app-server/model-runtime.ts
|
|
6
6
|
const CODEX_APP_SERVER_RUNTIME_MODEL_PARAM = "codexAppServerRuntimeModel";
|
|
@@ -13,7 +13,7 @@ function readCodexRuntimeModelId(model, fallbackId) {
|
|
|
13
13
|
//#endregion
|
|
14
14
|
//#region extensions/codex/harness.ts
|
|
15
15
|
const DEFAULT_CODEX_HARNESS_PROVIDER_IDS = /* @__PURE__ */ new Set(["codex", "openai"]);
|
|
16
|
-
const SHARED_CODEX_APP_SERVER_CLIENT_DISPOSER =
|
|
16
|
+
const SHARED_CODEX_APP_SERVER_CLIENT_DISPOSER = codexBuildSymbol("openclaw.codexAppServerClientDisposer");
|
|
17
17
|
const CODEX_TOOL_POLICY_SAFE_DENY_NAMES = [
|
|
18
18
|
"web_fetch",
|
|
19
19
|
"x_search",
|
|
@@ -81,12 +81,15 @@ function createCodexAppServerAgentHarness(options) {
|
|
|
81
81
|
if (disposed) throw new Error("Codex agent harness is disposed");
|
|
82
82
|
};
|
|
83
83
|
assertCurrent();
|
|
84
|
-
const
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
84
|
+
const identity = sessionBindingIdentity(params);
|
|
85
|
+
let binding = options.bindingStore.read(identity);
|
|
86
|
+
if (!binding) {
|
|
87
|
+
const previousSessionId = params.readPreviousSessionId?.();
|
|
88
|
+
binding = previousSessionId ? options.bindingStore.read({
|
|
89
|
+
...identity,
|
|
90
|
+
sessionId: previousSessionId
|
|
91
|
+
}) : void 0;
|
|
92
|
+
}
|
|
90
93
|
assertCurrent();
|
|
91
94
|
return binding?.preserveNativeModel === true ? {
|
|
92
95
|
model: "native",
|
|
@@ -100,7 +103,7 @@ function createCodexAppServerAgentHarness(options) {
|
|
|
100
103
|
...sessionCatalogControlFactory && sessionRuntime ? { sessionFork: {
|
|
101
104
|
upstreamKinds: ["codex-app-server"],
|
|
102
105
|
fork: async (params) => {
|
|
103
|
-
const { forkCodexUpstreamSession } = await import("./upstream-session-fork-
|
|
106
|
+
const { forkCodexUpstreamSession } = await import("./upstream-session-fork-BZerMte_.js");
|
|
104
107
|
return await forkCodexUpstreamSession(params, {
|
|
105
108
|
bindingStore: options.bindingStore,
|
|
106
109
|
controlFactory: sessionCatalogControlFactory,
|
|
@@ -110,27 +113,44 @@ function createCodexAppServerAgentHarness(options) {
|
|
|
110
113
|
});
|
|
111
114
|
}
|
|
112
115
|
} } : {},
|
|
116
|
+
taskHistory: {
|
|
117
|
+
taskKinds: ["codex-native"],
|
|
118
|
+
read: async (params) => {
|
|
119
|
+
const { readCodexNativeSubagentHistory } = await import("./native-subagent-history-DjtPloaU.js");
|
|
120
|
+
const assertCurrent = () => {
|
|
121
|
+
params.assertCurrent();
|
|
122
|
+
if (disposed) throw new Error("Agent harness is disposed");
|
|
123
|
+
};
|
|
124
|
+
return readCodexNativeSubagentHistory({
|
|
125
|
+
...params,
|
|
126
|
+
assertCurrent
|
|
127
|
+
}, {
|
|
128
|
+
bindingStore: options.bindingStore,
|
|
129
|
+
pluginConfig: resolveAttemptPluginConfig(params.cfg)
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
},
|
|
113
133
|
authBinding: { fingerprint: async (params) => {
|
|
114
|
-
const { fingerprintCodexAppServerAuthBinding } = await import("./auth-binding-
|
|
134
|
+
const { fingerprintCodexAppServerAuthBinding } = await import("./auth-binding-CWlKVccJ.js").then((n) => n.t);
|
|
115
135
|
return fingerprintCodexAppServerAuthBinding(params);
|
|
116
136
|
} },
|
|
117
137
|
runtimeArtifact: { validate: async (binding) => {
|
|
118
|
-
const { validateCodexAppServerRuntimeArtifact } = await import("./runtime-artifact-
|
|
138
|
+
const { validateCodexAppServerRuntimeArtifact } = await import("./runtime-artifact-BJ0rXBZ_.js");
|
|
119
139
|
return validateCodexAppServerRuntimeArtifact(binding);
|
|
120
140
|
} },
|
|
121
141
|
fetchUsageSnapshot: async (ctx) => {
|
|
122
|
-
const { fetchCodexAppServerUsageSnapshot } = await import("./usage-
|
|
142
|
+
const { fetchCodexAppServerUsageSnapshot } = await import("./usage-tCk-mg_x.js");
|
|
123
143
|
return await fetchCodexAppServerUsageSnapshot(ctx, { pluginConfig: options?.resolvePluginConfig?.() ?? options?.pluginConfig });
|
|
124
144
|
},
|
|
125
145
|
loadModelCatalog: async (params) => {
|
|
126
|
-
const { createCodexAppServerModelCatalog } = await import("./model-catalog-
|
|
146
|
+
const { createCodexAppServerModelCatalog } = await import("./model-catalog-Dq2n8f_p.js");
|
|
127
147
|
if (disposed) return [];
|
|
128
148
|
modelCatalog ??= createCodexAppServerModelCatalog(harnessRuntimeId);
|
|
129
149
|
return await modelCatalog.load(params, resolveAttemptPluginConfig(params.config));
|
|
130
150
|
},
|
|
131
151
|
readModelCatalogReadiness: (params) => modelCatalog?.read(params, resolveAttemptPluginConfig(params.config)),
|
|
132
152
|
loadMcpToolCatalog: async (params) => {
|
|
133
|
-
const { loadCodexEffectiveMcpCatalog } = await import("./effective-mcp-catalog-
|
|
153
|
+
const { loadCodexEffectiveMcpCatalog } = await import("./effective-mcp-catalog-Bd73bqA8.js");
|
|
134
154
|
return await loadCodexEffectiveMcpCatalog(params, { bindingStore: options.bindingStore });
|
|
135
155
|
},
|
|
136
156
|
supports: (ctx) => {
|
|
@@ -173,7 +193,7 @@ function createCodexAppServerAgentHarness(options) {
|
|
|
173
193
|
};
|
|
174
194
|
},
|
|
175
195
|
runAttempt: async (params) => {
|
|
176
|
-
const { runCodexAppServerAttempt } = await import("./run-attempt-
|
|
196
|
+
const { runCodexAppServerAttempt } = await import("./run-attempt-CvsAAGa0.js");
|
|
177
197
|
return runCodexAppServerAttempt(params, {
|
|
178
198
|
bindingStore: options.bindingStore,
|
|
179
199
|
pluginConfig: resolveAttemptPluginConfig(params.config),
|
|
@@ -183,11 +203,15 @@ function createCodexAppServerAgentHarness(options) {
|
|
|
183
203
|
});
|
|
184
204
|
},
|
|
185
205
|
runIsolatedCompletionV2: async (params) => {
|
|
186
|
-
if (params.authorization.owner === "host")
|
|
187
|
-
|
|
206
|
+
if (params.authorization.owner === "host") {
|
|
207
|
+
const { runHostPreparedIsolatedCompletion } = await import("openclaw/plugin-sdk/simple-completion-runtime");
|
|
208
|
+
return runHostPreparedIsolatedCompletion(params);
|
|
209
|
+
}
|
|
210
|
+
const { runCodexIsolatedCompletion } = await import("./isolated-completion-DWVb5U2J.js");
|
|
188
211
|
return runCodexIsolatedCompletion(params, { pluginConfig: options?.resolvePluginConfig?.() ?? options?.pluginConfig });
|
|
189
212
|
},
|
|
190
213
|
runIsolatedCompletion: async (params) => {
|
|
214
|
+
const { runHostPreparedIsolatedCompletion } = await import("openclaw/plugin-sdk/simple-completion-runtime");
|
|
191
215
|
return runHostPreparedIsolatedCompletion({
|
|
192
216
|
...params,
|
|
193
217
|
authorization: {
|
|
@@ -199,11 +223,11 @@ function createCodexAppServerAgentHarness(options) {
|
|
|
199
223
|
});
|
|
200
224
|
},
|
|
201
225
|
finalizeSettledTurn: async (params) => {
|
|
202
|
-
const { runCodexSettledTurnFinalization } = await import("./settled-turn-finalizer-
|
|
226
|
+
const { runCodexSettledTurnFinalization } = await import("./settled-turn-finalizer-Dn91stmc.js");
|
|
203
227
|
return runCodexSettledTurnFinalization(params, { pluginConfig: options?.resolvePluginConfig?.() ?? options?.pluginConfig });
|
|
204
228
|
},
|
|
205
229
|
runSideQuestion: async (params) => {
|
|
206
|
-
const { runCodexAppServerSideQuestion } = await import("./side-question-
|
|
230
|
+
const { runCodexAppServerSideQuestion } = await import("./side-question-BGMJQf4U.js");
|
|
207
231
|
return runCodexAppServerSideQuestion(params, {
|
|
208
232
|
bindingStore: options.bindingStore,
|
|
209
233
|
pluginConfig: options?.resolvePluginConfig?.() ?? options?.pluginConfig,
|
|
@@ -213,20 +237,20 @@ function createCodexAppServerAgentHarness(options) {
|
|
|
213
237
|
});
|
|
214
238
|
},
|
|
215
239
|
compact: async (params) => {
|
|
216
|
-
const { maybeCompactCodexAppServerSession } = await import("./compact-
|
|
240
|
+
const { maybeCompactCodexAppServerSession } = await import("./compact-B_H3AOd7.js");
|
|
217
241
|
return maybeCompactCodexAppServerSession(params, {
|
|
218
242
|
bindingStore: options.bindingStore,
|
|
219
243
|
pluginConfig: options?.resolvePluginConfig?.() ?? options?.pluginConfig
|
|
220
244
|
});
|
|
221
245
|
},
|
|
222
246
|
withSessionDeletion: async (params, run) => {
|
|
223
|
-
const { withCodexAppServerSessionDeletion } = await import("./session-retirement-
|
|
247
|
+
const { withCodexAppServerSessionDeletion } = await import("./session-retirement-B2YfbAAT.js");
|
|
224
248
|
params.assertCurrent();
|
|
225
249
|
return withCodexAppServerSessionDeletion(options.bindingStore, params, run);
|
|
226
250
|
},
|
|
227
251
|
reset: async (params) => {
|
|
228
252
|
if (params.sessionId && params.reason !== "deleted") {
|
|
229
|
-
const [{ reclaimCurrentCodexSessionGeneration }, { retireCodexAppServerSessionGeneration }] = await Promise.all([import("./session-binding-
|
|
253
|
+
const [{ reclaimCurrentCodexSessionGeneration }, { retireCodexAppServerSessionGeneration }] = await Promise.all([import("./session-binding-CI8UuilT.js").then((n) => n.c), import("./session-retirement-B2YfbAAT.js")]);
|
|
230
254
|
const identity = sessionBindingIdentity({
|
|
231
255
|
agentId: params.agentId,
|
|
232
256
|
sessionId: params.sessionId,
|
|
@@ -258,7 +282,7 @@ function createCodexAppServerAgentHarness(options) {
|
|
|
258
282
|
/** Creates the private native-compaction bridge registered in host-owned capability state. */
|
|
259
283
|
function createCodexAppServerNativeCompaction(options) {
|
|
260
284
|
return async (params) => {
|
|
261
|
-
const { maybeCompactCodexAppServerSession } = await import("./compact-
|
|
285
|
+
const { maybeCompactCodexAppServerSession } = await import("./compact-B_H3AOd7.js");
|
|
262
286
|
return maybeCompactCodexAppServerSession(params, {
|
|
263
287
|
bindingStore: options.bindingStore,
|
|
264
288
|
pluginConfig: options.resolvePluginConfig?.() ?? options.pluginConfig,
|
package/dist/harness.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as createCodexAppServerNativeCompaction, t as createCodexAppServerAgentHarness } from "./harness-
|
|
1
|
+
import { n as createCodexAppServerNativeCompaction, t as createCodexAppServerAgentHarness } from "./harness-C7rRa7bm.js";
|
|
2
2
|
export { createCodexAppServerAgentHarness, createCodexAppServerNativeCompaction };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
//#region extensions/codex/src/app-server/history-rejection.ts
|
|
2
|
+
/** Only an owning rejection site can supply a diagnostic; exception text is never evidence. */
|
|
3
|
+
var CodexHistoryRejection = class extends Error {
|
|
4
|
+
constructor(reason) {
|
|
5
|
+
super(`Codex history rejected: ${reason}`);
|
|
6
|
+
this.reason = reason;
|
|
7
|
+
}
|
|
8
|
+
};
|
|
9
|
+
function codexHistoryRejectionReason(error) {
|
|
10
|
+
return error instanceof CodexHistoryRejection ? error.reason : "history_read_failed";
|
|
11
|
+
}
|
|
12
|
+
//#endregion
|
|
13
|
+
export { codexHistoryRejectionReason as n, CodexHistoryRejection as t };
|