@ccpocket/bridge 1.88.2 → 1.88.3
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/codex-process.js +45 -1
- package/dist/codex-process.js.map +1 -1
- package/dist/performance-mode.js +4 -2
- package/dist/performance-mode.js.map +1 -1
- package/dist/sdk-process.d.ts +1 -0
- package/dist/sdk-process.js +50 -29
- package/dist/sdk-process.js.map +1 -1
- package/dist/session.d.ts +1 -0
- package/dist/session.js +3 -0
- package/dist/session.js.map +1 -1
- package/dist/websocket.js +1 -0
- package/dist/websocket.js.map +1 -1
- package/package.json +1 -1
package/dist/codex-process.js
CHANGED
|
@@ -938,7 +938,7 @@ export class CodexProcess extends EventEmitter {
|
|
|
938
938
|
this.pendingUserInputs.delete(pending.toolUseId);
|
|
939
939
|
this.forgetPendingRequest(pending.toolUseId);
|
|
940
940
|
this.respondToServerRequest(pending.requestId, buildUserInputResponse(pending, result));
|
|
941
|
-
this.emitToolResult(pending.toolUseId,
|
|
941
|
+
this.emitToolResult(pending.toolUseId, questionAnswerResultForHistory(pending, result), "answered");
|
|
942
942
|
if (this.pendingApprovals.size === 0 &&
|
|
943
943
|
!this.hasBlockingUserInput() &&
|
|
944
944
|
!this.pendingPlanCompletion) {
|
|
@@ -2020,6 +2020,7 @@ export class CodexProcess extends EventEmitter {
|
|
|
2020
2020
|
questions: questions.map((q) => ({
|
|
2021
2021
|
id: q.id,
|
|
2022
2022
|
question: q.question,
|
|
2023
|
+
isSecret: q.isSecret,
|
|
2023
2024
|
})),
|
|
2024
2025
|
input,
|
|
2025
2026
|
kind: "questions",
|
|
@@ -3059,6 +3060,49 @@ function buildUserInputResponse(pending, rawResult) {
|
|
|
3059
3060
|
}
|
|
3060
3061
|
return buildElicitationResponse(pending, rawResult);
|
|
3061
3062
|
}
|
|
3063
|
+
/** Keep secret question values out of the replayable transcript. */
|
|
3064
|
+
function questionAnswerResultForHistory(pending, rawResult) {
|
|
3065
|
+
if (pending.kind !== "questions" ||
|
|
3066
|
+
!pending.questions.some((question) => question.isSecret)) {
|
|
3067
|
+
return rawResult;
|
|
3068
|
+
}
|
|
3069
|
+
const parsed = parseResultObject(rawResult);
|
|
3070
|
+
const structuredResult = isJsonObjectOrArray(rawResult);
|
|
3071
|
+
const answers = {};
|
|
3072
|
+
for (const [index, question] of pending.questions.entries()) {
|
|
3073
|
+
const candidate = parsed.byId[question.id] ?? parsed.byQuestion[question.question];
|
|
3074
|
+
const fallback = index === 0 && candidate === undefined && !structuredResult
|
|
3075
|
+
? plainAnswerValue(rawResult)
|
|
3076
|
+
: null;
|
|
3077
|
+
const values = normalizeAnswerValues(candidate ?? fallback);
|
|
3078
|
+
if (question.isSecret) {
|
|
3079
|
+
if (values.length > 0)
|
|
3080
|
+
answers[question.id] = { redacted: true };
|
|
3081
|
+
}
|
|
3082
|
+
else if (values.length > 0) {
|
|
3083
|
+
answers[question.id] = values;
|
|
3084
|
+
}
|
|
3085
|
+
}
|
|
3086
|
+
return JSON.stringify({ answers });
|
|
3087
|
+
}
|
|
3088
|
+
function isJsonObjectOrArray(value) {
|
|
3089
|
+
try {
|
|
3090
|
+
const parsed = JSON.parse(value);
|
|
3091
|
+
return parsed !== null && typeof parsed === "object";
|
|
3092
|
+
}
|
|
3093
|
+
catch {
|
|
3094
|
+
return false;
|
|
3095
|
+
}
|
|
3096
|
+
}
|
|
3097
|
+
function plainAnswerValue(value) {
|
|
3098
|
+
try {
|
|
3099
|
+
const parsed = JSON.parse(value);
|
|
3100
|
+
return typeof parsed === "string" ? parsed : null;
|
|
3101
|
+
}
|
|
3102
|
+
catch {
|
|
3103
|
+
return value;
|
|
3104
|
+
}
|
|
3105
|
+
}
|
|
3062
3106
|
function resolveUserInputRejectResult(pending, fallback) {
|
|
3063
3107
|
if (pending.kind !== "elicitation_approval")
|
|
3064
3108
|
return fallback;
|