doer-agent 0.5.5 → 0.5.6
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/agent-session-rpc.js +19 -12
- package/package.json +1 -1
|
@@ -13,7 +13,6 @@ const SESSION_RPC_BLOB_KEYS = new Set([
|
|
|
13
13
|
"bytes",
|
|
14
14
|
"data",
|
|
15
15
|
]);
|
|
16
|
-
const SESSION_RPC_MAX_STRING_CHARS = 512;
|
|
17
16
|
function getSessionsRootPath(workspaceRoot) {
|
|
18
17
|
return path.join(workspaceRoot, ".codex", "sessions");
|
|
19
18
|
}
|
|
@@ -90,19 +89,27 @@ function buildInlineBlobMarker(value) {
|
|
|
90
89
|
}
|
|
91
90
|
return "[inline blob omitted]";
|
|
92
91
|
}
|
|
93
|
-
function
|
|
94
|
-
|
|
95
|
-
|
|
92
|
+
function getSessionRpcPayloadByteLength(value) {
|
|
93
|
+
try {
|
|
94
|
+
const serialized = typeof value === "string" ? value : JSON.stringify(value);
|
|
95
|
+
return typeof serialized === "string" ? Buffer.byteLength(serialized, "utf8") : null;
|
|
96
96
|
}
|
|
97
|
-
|
|
98
|
-
|
|
97
|
+
catch {
|
|
98
|
+
return null;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
function buildSessionRpcTruncatedMarker(label, value) {
|
|
102
|
+
const byteLength = getSessionRpcPayloadByteLength(value);
|
|
103
|
+
return byteLength === null
|
|
104
|
+
? `[${label} truncated for session RPC pagination]`
|
|
105
|
+
: `[${label} truncated for session RPC pagination: ${byteLength} bytes omitted]`;
|
|
99
106
|
}
|
|
100
|
-
function sanitizeSessionRpcPayload(value
|
|
107
|
+
function sanitizeSessionRpcPayload(value) {
|
|
101
108
|
if (typeof value === "string") {
|
|
102
|
-
return
|
|
109
|
+
return value;
|
|
103
110
|
}
|
|
104
111
|
if (Array.isArray(value)) {
|
|
105
|
-
return value.map((entry) => sanitizeSessionRpcPayload(entry
|
|
112
|
+
return value.map((entry) => sanitizeSessionRpcPayload(entry));
|
|
106
113
|
}
|
|
107
114
|
if (!isObjectRecord(value)) {
|
|
108
115
|
return value;
|
|
@@ -113,7 +120,7 @@ function sanitizeSessionRpcPayload(value, options = {}) {
|
|
|
113
120
|
sanitized[key] = buildInlineBlobMarker(entry);
|
|
114
121
|
continue;
|
|
115
122
|
}
|
|
116
|
-
sanitized[key] = sanitizeSessionRpcPayload(entry
|
|
123
|
+
sanitized[key] = sanitizeSessionRpcPayload(entry);
|
|
117
124
|
}
|
|
118
125
|
return sanitized;
|
|
119
126
|
}
|
|
@@ -130,7 +137,7 @@ function sanitizeSessionRpcRawLine(line) {
|
|
|
130
137
|
if (parsed.type === "compacted" || parsed.type === "turn_context" || parsed.type === "session_meta") {
|
|
131
138
|
return JSON.stringify({
|
|
132
139
|
...parsed,
|
|
133
|
-
payload:
|
|
140
|
+
payload: buildSessionRpcTruncatedMarker("payload", parsed.payload),
|
|
134
141
|
});
|
|
135
142
|
}
|
|
136
143
|
if (!isObjectRecord(parsed.payload)) {
|
|
@@ -146,7 +153,7 @@ function sanitizeSessionRpcRawLine(line) {
|
|
|
146
153
|
payload: {
|
|
147
154
|
type: payloadType,
|
|
148
155
|
status: typeof parsed.payload.status === "string" ? parsed.payload.status : "completed",
|
|
149
|
-
message:
|
|
156
|
+
message: buildSessionRpcTruncatedMarker(`${payloadType} payload`, parsed.payload),
|
|
150
157
|
},
|
|
151
158
|
});
|
|
152
159
|
}
|