@mindstudio-ai/remy 0.1.163 → 0.1.164
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 +1 -1
- package/dist/headless.js +26 -9
- package/dist/index.js +26 -7
- package/package.json +1 -1
package/dist/headless.d.ts
CHANGED
package/dist/headless.js
CHANGED
|
@@ -4,9 +4,6 @@ var __export = (target, all) => {
|
|
|
4
4
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
5
5
|
};
|
|
6
6
|
|
|
7
|
-
// src/headless/index.ts
|
|
8
|
-
import { createInterface } from "readline";
|
|
9
|
-
|
|
10
7
|
// src/logger.ts
|
|
11
8
|
import fs from "fs";
|
|
12
9
|
var LEVELS = {
|
|
@@ -6666,8 +6663,8 @@ var HeadlessSession = class {
|
|
|
6666
6663
|
pendingBlockUpdates = [];
|
|
6667
6664
|
// Tool lifecycle management — shared across all nesting depths
|
|
6668
6665
|
toolRegistry = new ToolRegistry();
|
|
6669
|
-
// IO
|
|
6670
|
-
|
|
6666
|
+
// IO — accumulates stdin bytes between newline boundaries
|
|
6667
|
+
stdinBuffer = "";
|
|
6671
6668
|
constructor(opts = {}) {
|
|
6672
6669
|
this.opts = opts;
|
|
6673
6670
|
}
|
|
@@ -6698,9 +6695,24 @@ var HeadlessSession = class {
|
|
|
6698
6695
|
}
|
|
6699
6696
|
triggerBrandExtraction(this.config);
|
|
6700
6697
|
this.toolRegistry.onEvent = this.onEvent;
|
|
6701
|
-
|
|
6702
|
-
|
|
6703
|
-
|
|
6698
|
+
process.stdin.setEncoding("utf-8");
|
|
6699
|
+
process.stdin.on("data", (chunk) => {
|
|
6700
|
+
this.stdinBuffer += chunk;
|
|
6701
|
+
let nlIdx;
|
|
6702
|
+
while ((nlIdx = this.stdinBuffer.indexOf("\n")) !== -1) {
|
|
6703
|
+
const endIdx = nlIdx > 0 && this.stdinBuffer[nlIdx - 1] === "\r" ? nlIdx - 1 : nlIdx;
|
|
6704
|
+
const line = this.stdinBuffer.slice(0, endIdx);
|
|
6705
|
+
this.stdinBuffer = this.stdinBuffer.slice(nlIdx + 1);
|
|
6706
|
+
if (line.length > 0) {
|
|
6707
|
+
void this.handleStdinLine(line);
|
|
6708
|
+
}
|
|
6709
|
+
}
|
|
6710
|
+
});
|
|
6711
|
+
process.stdin.on("end", () => {
|
|
6712
|
+
if (this.stdinBuffer.length > 0) {
|
|
6713
|
+
void this.handleStdinLine(this.stdinBuffer);
|
|
6714
|
+
this.stdinBuffer = "";
|
|
6715
|
+
}
|
|
6704
6716
|
this.emit("stopping");
|
|
6705
6717
|
this.emit("stopped");
|
|
6706
6718
|
process.exit(0);
|
|
@@ -7234,7 +7246,12 @@ var HeadlessSession = class {
|
|
|
7234
7246
|
let parsed;
|
|
7235
7247
|
try {
|
|
7236
7248
|
parsed = JSON.parse(line);
|
|
7237
|
-
} catch {
|
|
7249
|
+
} catch (err) {
|
|
7250
|
+
log14.warn("Invalid JSON on stdin", {
|
|
7251
|
+
error: err.message,
|
|
7252
|
+
lineLength: line.length,
|
|
7253
|
+
preview: line.slice(0, 200)
|
|
7254
|
+
});
|
|
7238
7255
|
this.emit("error", { error: "Invalid JSON on stdin" });
|
|
7239
7256
|
return;
|
|
7240
7257
|
}
|
package/dist/index.js
CHANGED
|
@@ -7355,7 +7355,6 @@ var headless_exports = {};
|
|
|
7355
7355
|
__export(headless_exports, {
|
|
7356
7356
|
HeadlessSession: () => HeadlessSession
|
|
7357
7357
|
});
|
|
7358
|
-
import { createInterface } from "readline";
|
|
7359
7358
|
var log14, EXTERNAL_TOOL_TIMEOUT_MS, USER_FACING_TOOLS, HeadlessSession;
|
|
7360
7359
|
var init_headless = __esm({
|
|
7361
7360
|
"src/headless/index.ts"() {
|
|
@@ -7418,8 +7417,8 @@ var init_headless = __esm({
|
|
|
7418
7417
|
pendingBlockUpdates = [];
|
|
7419
7418
|
// Tool lifecycle management — shared across all nesting depths
|
|
7420
7419
|
toolRegistry = new ToolRegistry();
|
|
7421
|
-
// IO
|
|
7422
|
-
|
|
7420
|
+
// IO — accumulates stdin bytes between newline boundaries
|
|
7421
|
+
stdinBuffer = "";
|
|
7423
7422
|
constructor(opts = {}) {
|
|
7424
7423
|
this.opts = opts;
|
|
7425
7424
|
}
|
|
@@ -7450,9 +7449,24 @@ var init_headless = __esm({
|
|
|
7450
7449
|
}
|
|
7451
7450
|
triggerBrandExtraction(this.config);
|
|
7452
7451
|
this.toolRegistry.onEvent = this.onEvent;
|
|
7453
|
-
|
|
7454
|
-
|
|
7455
|
-
|
|
7452
|
+
process.stdin.setEncoding("utf-8");
|
|
7453
|
+
process.stdin.on("data", (chunk) => {
|
|
7454
|
+
this.stdinBuffer += chunk;
|
|
7455
|
+
let nlIdx;
|
|
7456
|
+
while ((nlIdx = this.stdinBuffer.indexOf("\n")) !== -1) {
|
|
7457
|
+
const endIdx = nlIdx > 0 && this.stdinBuffer[nlIdx - 1] === "\r" ? nlIdx - 1 : nlIdx;
|
|
7458
|
+
const line = this.stdinBuffer.slice(0, endIdx);
|
|
7459
|
+
this.stdinBuffer = this.stdinBuffer.slice(nlIdx + 1);
|
|
7460
|
+
if (line.length > 0) {
|
|
7461
|
+
void this.handleStdinLine(line);
|
|
7462
|
+
}
|
|
7463
|
+
}
|
|
7464
|
+
});
|
|
7465
|
+
process.stdin.on("end", () => {
|
|
7466
|
+
if (this.stdinBuffer.length > 0) {
|
|
7467
|
+
void this.handleStdinLine(this.stdinBuffer);
|
|
7468
|
+
this.stdinBuffer = "";
|
|
7469
|
+
}
|
|
7456
7470
|
this.emit("stopping");
|
|
7457
7471
|
this.emit("stopped");
|
|
7458
7472
|
process.exit(0);
|
|
@@ -7986,7 +8000,12 @@ var init_headless = __esm({
|
|
|
7986
8000
|
let parsed;
|
|
7987
8001
|
try {
|
|
7988
8002
|
parsed = JSON.parse(line);
|
|
7989
|
-
} catch {
|
|
8003
|
+
} catch (err) {
|
|
8004
|
+
log14.warn("Invalid JSON on stdin", {
|
|
8005
|
+
error: err.message,
|
|
8006
|
+
lineLength: line.length,
|
|
8007
|
+
preview: line.slice(0, 200)
|
|
8008
|
+
});
|
|
7990
8009
|
this.emit("error", { error: "Invalid JSON on stdin" });
|
|
7991
8010
|
return;
|
|
7992
8011
|
}
|