@volter/supercode-teams 0.3.108 → 0.3.110
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/codex-startup.mjs +26 -5
- package/package.json +1 -1
- package/terminal-mail.mjs +2 -0
package/codex-startup.mjs
CHANGED
|
@@ -137,6 +137,9 @@ export async function settleCodexHookReview(host, sessionId, { signal, deadlineM
|
|
|
137
137
|
* into one composer entry. */
|
|
138
138
|
export const CODEX_WINDOWS_PASTE_CHARS = 8000;
|
|
139
139
|
|
|
140
|
+
/** The most written characters a Windows Codex paste was measured to take whole (8180 arrived, 8200 did not). */
|
|
141
|
+
const CODEX_WINDOWS_PASTE_MAX = 8180;
|
|
142
|
+
|
|
140
143
|
/** One character as a Windows Codex reads it from its console. Codex drops some BMP characters that arrive as plain
|
|
141
144
|
* text through ConPTY (measured: `—`, `…`, `✓` vanish while `é`, `日`, and astral `🙂` arrive), so every BMP
|
|
142
145
|
* character past ASCII goes as a win32-input-mode key event carrying its UTF-16 unit (VK_PACKET, 231), which ConPTY
|
|
@@ -148,13 +151,31 @@ function codexWindowsCharacter(character) {
|
|
|
148
151
|
}
|
|
149
152
|
|
|
150
153
|
/** Text as the raw writes that paste it into a Windows Codex composer: bracketed pastes of at most
|
|
151
|
-
* CODEX_WINDOWS_PASTE_CHARS characters each
|
|
152
|
-
*
|
|
154
|
+
* CODEX_WINDOWS_PASTE_CHARS written characters each (a key event counts as its whole encoding, so non-ASCII-heavy
|
|
155
|
+
* text takes more, smaller pastes), non-ASCII BMP characters as key events. A piece ends after its last line break
|
|
156
|
+
* when it has one, and never begins with one: a line break arriving first after the gap between pastes could read as
|
|
157
|
+
* Enter and submit part of the text. Line ends are normalized to `\n`. Written as they are (a terminal host turns `\n` into `\r`, which Codex keeps
|
|
158
|
+
* as a line break inside a paste); never submitted here. */
|
|
153
159
|
export function codexWindowsPastes(text) {
|
|
154
|
-
|
|
160
|
+
// Line ends as `\n` only: Codex reads a pasted `\r\n` as two line breaks.
|
|
161
|
+
const encoded = Array.from(String(text).replace(/\r\n?/g, '\n')).map(codexWindowsCharacter);
|
|
155
162
|
const pastes = [];
|
|
156
|
-
for (let
|
|
157
|
-
|
|
163
|
+
for (let start = 0; start < encoded.length;) {
|
|
164
|
+
let end = start, written = 0, lastBreak = -1;
|
|
165
|
+
while (end < encoded.length && (end === start || written + encoded[end].length <= CODEX_WINDOWS_PASTE_CHARS)) {
|
|
166
|
+
written += encoded[end].length;
|
|
167
|
+
if (encoded[end] === '\n') lastBreak = end;
|
|
168
|
+
end += 1;
|
|
169
|
+
}
|
|
170
|
+
// Cut after the piece's last line break when the text goes on; else keep any line breaks that follow the cut
|
|
171
|
+
// with this piece, so the next one does not open with one — but never past CODEX_WINDOWS_PASTE_MAX, beyond which
|
|
172
|
+
// Codex drops the whole paste. Only a run of more blank lines than that margin still opens the next piece.
|
|
173
|
+
if (end < encoded.length) {
|
|
174
|
+
if (lastBreak >= start && lastBreak + 1 < end) end = lastBreak + 1;
|
|
175
|
+
else while (end < encoded.length && encoded[end] === '\n' && written < CODEX_WINDOWS_PASTE_MAX) { written += 1; end += 1; }
|
|
176
|
+
}
|
|
177
|
+
pastes.push(`\u001b[200~${encoded.slice(start, end).join('')}\u001b[201~`);
|
|
178
|
+
start = end;
|
|
158
179
|
}
|
|
159
180
|
return pastes;
|
|
160
181
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@volter/supercode-teams",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.110",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "A machine daemon serving this machine's doors, and a local or remote Teams server for shared session discovery, OpenTelemetry ingestion and access to enrolled machines.",
|
|
6
6
|
"license": "MIT",
|
package/terminal-mail.mjs
CHANGED
|
@@ -40,6 +40,8 @@ function confirmed(batch) {
|
|
|
40
40
|
const text = textOf(content);
|
|
41
41
|
if (text === null || text.length === 0) continue;
|
|
42
42
|
if (text === batch.text) return { fragments: 1 };
|
|
43
|
+
// A Windows Codex is pasted its text with line ends as `\n` (codexWindowsPastes).
|
|
44
|
+
if (batch.kind === 'codex' && text === batch.text.replace(/\r\n?/g, '\n')) return { fragments: 1 };
|
|
43
45
|
// Older mail delivery omitted the paste delimiter, so terminal newlines
|
|
44
46
|
// submitted one envelope as several native user messages. Recover only
|
|
45
47
|
// exact, ordered fragments of the retained bytes, separated by original
|