@mindstudio-ai/remy 0.1.172 → 0.1.174
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/headless.js +21 -2
- package/dist/index.js +21 -2
- package/package.json +1 -1
package/dist/headless.js
CHANGED
|
@@ -6857,7 +6857,14 @@ var HeadlessSession = class {
|
|
|
6857
6857
|
if (requestId) {
|
|
6858
6858
|
payload.requestId = requestId;
|
|
6859
6859
|
}
|
|
6860
|
-
|
|
6860
|
+
const line = JSON.stringify(payload) + "\n";
|
|
6861
|
+
if (event === "history") {
|
|
6862
|
+
log14.info("Wrote history event to stdout", {
|
|
6863
|
+
requestId,
|
|
6864
|
+
bytes: line.length
|
|
6865
|
+
});
|
|
6866
|
+
}
|
|
6867
|
+
process.stdout.write(line);
|
|
6861
6868
|
}
|
|
6862
6869
|
/**
|
|
6863
6870
|
* Emit a `completed` event and mark completedEmitted. Includes
|
|
@@ -7434,8 +7441,20 @@ var HeadlessSession = class {
|
|
|
7434
7441
|
const limit = typeof rawLimit === "number" && Number.isFinite(rawLimit) ? Math.min(Math.max(1, rawLimit | 0), HISTORY_MAX_LIMIT) : HISTORY_DEFAULT_LIMIT;
|
|
7435
7442
|
const rawBefore = parsed.before;
|
|
7436
7443
|
const before = typeof rawBefore === "number" && Number.isFinite(rawBefore) ? Math.max(0, Math.min(rawBefore | 0, total)) : total;
|
|
7437
|
-
|
|
7444
|
+
let startIndex = Math.max(0, before - limit);
|
|
7445
|
+
while (startIndex > 0 && this.state.messages[startIndex].role === "user" && this.state.messages[startIndex].toolCallId) {
|
|
7446
|
+
startIndex--;
|
|
7447
|
+
}
|
|
7438
7448
|
const endIndex = before;
|
|
7449
|
+
log14.info("History response", {
|
|
7450
|
+
requestId,
|
|
7451
|
+
startIndex,
|
|
7452
|
+
endIndex,
|
|
7453
|
+
count: endIndex - startIndex,
|
|
7454
|
+
totalMessageCount: total,
|
|
7455
|
+
beforeParam: rawBefore,
|
|
7456
|
+
limitParam: rawLimit
|
|
7457
|
+
});
|
|
7439
7458
|
this.dispatchSimple(requestId, "history", () => ({
|
|
7440
7459
|
messages: this.state.messages.slice(startIndex, endIndex),
|
|
7441
7460
|
startIndex,
|
package/dist/index.js
CHANGED
|
@@ -7611,7 +7611,14 @@ var init_headless = __esm({
|
|
|
7611
7611
|
if (requestId) {
|
|
7612
7612
|
payload.requestId = requestId;
|
|
7613
7613
|
}
|
|
7614
|
-
|
|
7614
|
+
const line = JSON.stringify(payload) + "\n";
|
|
7615
|
+
if (event === "history") {
|
|
7616
|
+
log14.info("Wrote history event to stdout", {
|
|
7617
|
+
requestId,
|
|
7618
|
+
bytes: line.length
|
|
7619
|
+
});
|
|
7620
|
+
}
|
|
7621
|
+
process.stdout.write(line);
|
|
7615
7622
|
}
|
|
7616
7623
|
/**
|
|
7617
7624
|
* Emit a `completed` event and mark completedEmitted. Includes
|
|
@@ -8188,8 +8195,20 @@ var init_headless = __esm({
|
|
|
8188
8195
|
const limit = typeof rawLimit === "number" && Number.isFinite(rawLimit) ? Math.min(Math.max(1, rawLimit | 0), HISTORY_MAX_LIMIT) : HISTORY_DEFAULT_LIMIT;
|
|
8189
8196
|
const rawBefore = parsed.before;
|
|
8190
8197
|
const before = typeof rawBefore === "number" && Number.isFinite(rawBefore) ? Math.max(0, Math.min(rawBefore | 0, total)) : total;
|
|
8191
|
-
|
|
8198
|
+
let startIndex = Math.max(0, before - limit);
|
|
8199
|
+
while (startIndex > 0 && this.state.messages[startIndex].role === "user" && this.state.messages[startIndex].toolCallId) {
|
|
8200
|
+
startIndex--;
|
|
8201
|
+
}
|
|
8192
8202
|
const endIndex = before;
|
|
8203
|
+
log14.info("History response", {
|
|
8204
|
+
requestId,
|
|
8205
|
+
startIndex,
|
|
8206
|
+
endIndex,
|
|
8207
|
+
count: endIndex - startIndex,
|
|
8208
|
+
totalMessageCount: total,
|
|
8209
|
+
beforeParam: rawBefore,
|
|
8210
|
+
limitParam: rawLimit
|
|
8211
|
+
});
|
|
8193
8212
|
this.dispatchSimple(requestId, "history", () => ({
|
|
8194
8213
|
messages: this.state.messages.slice(startIndex, endIndex),
|
|
8195
8214
|
startIndex,
|