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.
@@ -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 truncateSessionRpcString(value) {
94
- if (value.length <= SESSION_RPC_MAX_STRING_CHARS) {
95
- return value;
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
- const omittedChars = value.length - SESSION_RPC_MAX_STRING_CHARS;
98
- return `${value.slice(0, SESSION_RPC_MAX_STRING_CHARS)}\n[truncated ${omittedChars} chars for session RPC]`;
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, options = {}) {
107
+ function sanitizeSessionRpcPayload(value) {
101
108
  if (typeof value === "string") {
102
- return options.truncateStrings ? truncateSessionRpcString(value) : value;
109
+ return value;
103
110
  }
104
111
  if (Array.isArray(value)) {
105
- return value.map((entry) => sanitizeSessionRpcPayload(entry, options));
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, options);
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: sanitizeSessionRpcPayload(parsed.payload, { truncateStrings: true }),
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: `[${payloadType} payload omitted for session RPC pagination]`,
156
+ message: buildSessionRpcTruncatedMarker(`${payloadType} payload`, parsed.payload),
150
157
  },
151
158
  });
152
159
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "doer-agent",
3
- "version": "0.5.5",
3
+ "version": "0.5.6",
4
4
  "description": "Reverse-polling agent runtime for doer",
5
5
  "type": "module",
6
6
  "main": "dist/agent.js",