ollanet 0.6.20 → 0.6.22
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/compare.js +3 -8
- package/dist/prompt.d.ts +1 -0
- package/dist/prompt.js +7 -2
- package/package.json +1 -1
package/dist/compare.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { readStdinIfPiped } from "./prompt.js";
|
|
1
2
|
/**
|
|
2
3
|
* Head-to-head: one prompt, 2–5 models on the same host.
|
|
3
4
|
*
|
|
@@ -252,14 +253,8 @@ export async function main() {
|
|
|
252
253
|
// `compare desk other:7b` → alias model vs other on alias host
|
|
253
254
|
models = [alias.model, models[0]];
|
|
254
255
|
}
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
if (!stdinStream.isTTY) {
|
|
258
|
-
const chunks = [];
|
|
259
|
-
for await (const chunk of stdinStream)
|
|
260
|
-
chunks.push(chunk);
|
|
261
|
-
fromStdin = Buffer.concat(chunks).toString("utf8").trim();
|
|
262
|
-
}
|
|
256
|
+
// Same guarded read as prompt: a never-closing pipe (agents, CI) must not hang.
|
|
257
|
+
const fromStdin = await readStdinIfPiped();
|
|
263
258
|
let fileText;
|
|
264
259
|
if (parsed.file) {
|
|
265
260
|
try {
|
package/dist/prompt.d.ts
CHANGED
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
*/
|
|
14
14
|
import { type AppConfig, type GenerateSettings } from "./config.js";
|
|
15
15
|
export declare function helpText(): string;
|
|
16
|
+
export declare function readStdinIfPiped(): Promise<string>;
|
|
16
17
|
export interface PromptRunOptions {
|
|
17
18
|
machine?: string;
|
|
18
19
|
model?: string;
|
package/dist/prompt.js
CHANGED
|
@@ -214,7 +214,7 @@ function parseArgs(argv) {
|
|
|
214
214
|
// via --machine, or a leading discovered-host name peeled in main().
|
|
215
215
|
return { machine, model, promptParts, file, stream, json, save, chatId, settings };
|
|
216
216
|
}
|
|
217
|
-
async function readStdinIfPiped() {
|
|
217
|
+
export async function readStdinIfPiped() {
|
|
218
218
|
if (stdinStream.isTTY)
|
|
219
219
|
return "";
|
|
220
220
|
// Under npm/pnpm/CI, stdin is often a pipe that never gets EOF. Only drain it
|
|
@@ -240,8 +240,13 @@ async function readStdinIfPiped() {
|
|
|
240
240
|
stdinStream.once("end", onEnd);
|
|
241
241
|
const timer = setTimeout(() => done(stdinStream.readableLength > 0), 100);
|
|
242
242
|
});
|
|
243
|
-
if (!hasData)
|
|
243
|
+
if (!hasData) {
|
|
244
|
+
// The readable listener started a read on the pipe; stop it so the open
|
|
245
|
+
// handle doesn't keep the process alive after we're done.
|
|
246
|
+
stdinStream.pause();
|
|
247
|
+
stdinStream.destroy();
|
|
244
248
|
return "";
|
|
249
|
+
}
|
|
245
250
|
const chunks = [];
|
|
246
251
|
for await (const chunk of stdinStream) {
|
|
247
252
|
chunks.push(Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk));
|