doer-agent 0.5.3 → 0.5.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/dist/agent-session-rpc.js +10 -16
- package/package.json +1 -1
|
@@ -97,12 +97,12 @@ function truncateSessionRpcString(value) {
|
|
|
97
97
|
const omittedChars = value.length - SESSION_RPC_MAX_STRING_CHARS;
|
|
98
98
|
return `${value.slice(0, SESSION_RPC_MAX_STRING_CHARS)}\n[truncated ${omittedChars} chars for session RPC]`;
|
|
99
99
|
}
|
|
100
|
-
function sanitizeSessionRpcPayload(value) {
|
|
100
|
+
function sanitizeSessionRpcPayload(value, options = {}) {
|
|
101
101
|
if (typeof value === "string") {
|
|
102
|
-
return truncateSessionRpcString(value);
|
|
102
|
+
return options.truncateStrings ? truncateSessionRpcString(value) : value;
|
|
103
103
|
}
|
|
104
104
|
if (Array.isArray(value)) {
|
|
105
|
-
return value.map((entry) => sanitizeSessionRpcPayload(entry));
|
|
105
|
+
return value.map((entry) => sanitizeSessionRpcPayload(entry, options));
|
|
106
106
|
}
|
|
107
107
|
if (!isObjectRecord(value)) {
|
|
108
108
|
return value;
|
|
@@ -113,37 +113,31 @@ function sanitizeSessionRpcPayload(value) {
|
|
|
113
113
|
sanitized[key] = buildInlineBlobMarker(entry);
|
|
114
114
|
continue;
|
|
115
115
|
}
|
|
116
|
-
sanitized[key] = sanitizeSessionRpcPayload(entry);
|
|
116
|
+
sanitized[key] = sanitizeSessionRpcPayload(entry, options);
|
|
117
117
|
}
|
|
118
118
|
return sanitized;
|
|
119
119
|
}
|
|
120
120
|
function sanitizeSessionRpcRawLine(line) {
|
|
121
121
|
const trimmed = line.trim();
|
|
122
122
|
if (!trimmed.startsWith("{")) {
|
|
123
|
-
return
|
|
123
|
+
return line;
|
|
124
124
|
}
|
|
125
125
|
try {
|
|
126
126
|
const parsed = JSON.parse(line);
|
|
127
127
|
if (!isObjectRecord(parsed)) {
|
|
128
|
-
return
|
|
128
|
+
return line;
|
|
129
129
|
}
|
|
130
130
|
if (parsed.type === "compacted" || parsed.type === "turn_context" || parsed.type === "session_meta") {
|
|
131
131
|
return JSON.stringify({
|
|
132
132
|
...parsed,
|
|
133
|
-
payload: sanitizeSessionRpcPayload(parsed.payload),
|
|
133
|
+
payload: sanitizeSessionRpcPayload(parsed.payload, { truncateStrings: true }),
|
|
134
134
|
});
|
|
135
135
|
}
|
|
136
136
|
if (!isObjectRecord(parsed.payload)) {
|
|
137
|
-
return
|
|
138
|
-
...parsed,
|
|
139
|
-
payload: sanitizeSessionRpcPayload(parsed.payload),
|
|
140
|
-
});
|
|
137
|
+
return line;
|
|
141
138
|
}
|
|
142
139
|
if (parsed.type !== "response_item") {
|
|
143
|
-
return
|
|
144
|
-
...parsed,
|
|
145
|
-
payload: sanitizeSessionRpcPayload(parsed.payload),
|
|
146
|
-
});
|
|
140
|
+
return line;
|
|
147
141
|
}
|
|
148
142
|
const payloadType = typeof parsed.payload.type === "string" ? parsed.payload.type : "";
|
|
149
143
|
if (payloadType === "message" || payloadType === "reasoning") {
|
|
@@ -162,7 +156,7 @@ function sanitizeSessionRpcRawLine(line) {
|
|
|
162
156
|
});
|
|
163
157
|
}
|
|
164
158
|
catch {
|
|
165
|
-
return
|
|
159
|
+
return line;
|
|
166
160
|
}
|
|
167
161
|
}
|
|
168
162
|
function toTrimmedStringOrNull(value) {
|