@mindstudio-ai/remy 0.1.171 → 0.1.172
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.d.ts +8 -0
- package/dist/headless.js +13 -1
- package/dist/index.js +14 -2
- package/package.json +1 -1
package/dist/headless.d.ts
CHANGED
|
@@ -12,6 +12,14 @@
|
|
|
12
12
|
* - Every command ends with exactly one `completed` event:
|
|
13
13
|
* {event:"completed", requestId, success:true|false, error?:string}
|
|
14
14
|
* - `tool_result` is fire-and-forget (resolves an in-flight promise, no completed event).
|
|
15
|
+
*
|
|
16
|
+
* `get_history` is paginated. Request: {action:"get_history", before?:number,
|
|
17
|
+
* limit?:number, requestId}. `before` is an exclusive upper bound on message
|
|
18
|
+
* index (defaults to end of array — the most recent messages); `limit` caps
|
|
19
|
+
* page size (default 500, hard cap 2000). Response: {event:"history",
|
|
20
|
+
* messages, startIndex, endIndex, totalMessageCount, ...}. Walk backward by
|
|
21
|
+
* passing the previous response's `startIndex` as the next `before`. When
|
|
22
|
+
* `startIndex === 0`, no older messages remain.
|
|
15
23
|
*/
|
|
16
24
|
interface HeadlessOptions {
|
|
17
25
|
apiKey?: string;
|
package/dist/headless.js
CHANGED
|
@@ -6731,6 +6731,8 @@ var USER_FACING_TOOLS = /* @__PURE__ */ new Set([
|
|
|
6731
6731
|
"presentPublishPlan"
|
|
6732
6732
|
]);
|
|
6733
6733
|
var FORCED_COMPACTION_THRESHOLD_TOKENS = 85e4;
|
|
6734
|
+
var HISTORY_DEFAULT_LIMIT = 500;
|
|
6735
|
+
var HISTORY_MAX_LIMIT = 2e3;
|
|
6734
6736
|
var HeadlessSession = class {
|
|
6735
6737
|
// Configuration
|
|
6736
6738
|
opts;
|
|
@@ -7427,8 +7429,18 @@ var HeadlessSession = class {
|
|
|
7427
7429
|
}
|
|
7428
7430
|
if (action === "get_history") {
|
|
7429
7431
|
this.applyPendingBlockUpdates();
|
|
7432
|
+
const total = this.state.messages.length;
|
|
7433
|
+
const rawLimit = parsed.limit;
|
|
7434
|
+
const limit = typeof rawLimit === "number" && Number.isFinite(rawLimit) ? Math.min(Math.max(1, rawLimit | 0), HISTORY_MAX_LIMIT) : HISTORY_DEFAULT_LIMIT;
|
|
7435
|
+
const rawBefore = parsed.before;
|
|
7436
|
+
const before = typeof rawBefore === "number" && Number.isFinite(rawBefore) ? Math.max(0, Math.min(rawBefore | 0, total)) : total;
|
|
7437
|
+
const startIndex = Math.max(0, before - limit);
|
|
7438
|
+
const endIndex = before;
|
|
7430
7439
|
this.dispatchSimple(requestId, "history", () => ({
|
|
7431
|
-
messages: this.state.messages,
|
|
7440
|
+
messages: this.state.messages.slice(startIndex, endIndex),
|
|
7441
|
+
startIndex,
|
|
7442
|
+
endIndex,
|
|
7443
|
+
totalMessageCount: total,
|
|
7432
7444
|
running: this.running,
|
|
7433
7445
|
...this.running && this.currentRequestId ? { currentRequestId: this.currentRequestId } : {},
|
|
7434
7446
|
...this.queueFields()
|
package/dist/index.js
CHANGED
|
@@ -7457,7 +7457,7 @@ var headless_exports = {};
|
|
|
7457
7457
|
__export(headless_exports, {
|
|
7458
7458
|
HeadlessSession: () => HeadlessSession
|
|
7459
7459
|
});
|
|
7460
|
-
var log14, EXTERNAL_TOOL_TIMEOUT_MS, USER_FACING_TOOLS, FORCED_COMPACTION_THRESHOLD_TOKENS, HeadlessSession;
|
|
7460
|
+
var log14, EXTERNAL_TOOL_TIMEOUT_MS, USER_FACING_TOOLS, FORCED_COMPACTION_THRESHOLD_TOKENS, HISTORY_DEFAULT_LIMIT, HISTORY_MAX_LIMIT, HeadlessSession;
|
|
7461
7461
|
var init_headless = __esm({
|
|
7462
7462
|
"src/headless/index.ts"() {
|
|
7463
7463
|
"use strict";
|
|
@@ -7485,6 +7485,8 @@ var init_headless = __esm({
|
|
|
7485
7485
|
"presentPublishPlan"
|
|
7486
7486
|
]);
|
|
7487
7487
|
FORCED_COMPACTION_THRESHOLD_TOKENS = 85e4;
|
|
7488
|
+
HISTORY_DEFAULT_LIMIT = 500;
|
|
7489
|
+
HISTORY_MAX_LIMIT = 2e3;
|
|
7488
7490
|
HeadlessSession = class {
|
|
7489
7491
|
// Configuration
|
|
7490
7492
|
opts;
|
|
@@ -8181,8 +8183,18 @@ var init_headless = __esm({
|
|
|
8181
8183
|
}
|
|
8182
8184
|
if (action === "get_history") {
|
|
8183
8185
|
this.applyPendingBlockUpdates();
|
|
8186
|
+
const total = this.state.messages.length;
|
|
8187
|
+
const rawLimit = parsed.limit;
|
|
8188
|
+
const limit = typeof rawLimit === "number" && Number.isFinite(rawLimit) ? Math.min(Math.max(1, rawLimit | 0), HISTORY_MAX_LIMIT) : HISTORY_DEFAULT_LIMIT;
|
|
8189
|
+
const rawBefore = parsed.before;
|
|
8190
|
+
const before = typeof rawBefore === "number" && Number.isFinite(rawBefore) ? Math.max(0, Math.min(rawBefore | 0, total)) : total;
|
|
8191
|
+
const startIndex = Math.max(0, before - limit);
|
|
8192
|
+
const endIndex = before;
|
|
8184
8193
|
this.dispatchSimple(requestId, "history", () => ({
|
|
8185
|
-
messages: this.state.messages,
|
|
8194
|
+
messages: this.state.messages.slice(startIndex, endIndex),
|
|
8195
|
+
startIndex,
|
|
8196
|
+
endIndex,
|
|
8197
|
+
totalMessageCount: total,
|
|
8186
8198
|
running: this.running,
|
|
8187
8199
|
...this.running && this.currentRequestId ? { currentRequestId: this.currentRequestId } : {},
|
|
8188
8200
|
...this.queueFields()
|