@pyxmate/memory 0.21.1 → 0.21.4

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.
@@ -261,29 +261,68 @@ async function doctorCommand(opts = {}) {
261
261
  }
262
262
 
263
263
  // src/cli/prompt.ts
264
- import { createInterface } from "readline";
265
- import { Writable } from "stream";
266
264
  async function readApiKeySecret() {
267
265
  if (process.stdin.isTTY) {
268
- return promptHidden("API key: ");
266
+ return promptMasked("API key: ");
269
267
  }
270
268
  return readSingleLineFromStdin();
271
269
  }
272
- async function promptHidden(label) {
273
- process.stdout.write(label);
274
- const muted = new Writable({
275
- write(_chunk, _enc, cb) {
276
- cb();
277
- }
278
- });
279
- const rl = createInterface({ input: process.stdin, output: muted, terminal: true });
270
+ async function promptMasked(label) {
271
+ const { stdin, stdout } = process;
272
+ stdout.write(label);
273
+ const hadRawMode = typeof stdin.setRawMode === "function";
274
+ if (!hadRawMode) {
275
+ const value = await readSingleLineFromStdin();
276
+ stdout.write(`${"\u2022".repeat(Math.min(value.length, 80))}
277
+ `);
278
+ return value;
279
+ }
280
280
  return new Promise((resolve2, reject) => {
281
- rl.question("", (answer) => {
282
- rl.close();
283
- process.stdout.write("\n");
284
- resolve2(answer.trim());
285
- });
286
- rl.on("error", reject);
281
+ const previousEncoding = stdin.readableEncoding;
282
+ stdin.setEncoding("utf8");
283
+ stdin.setRawMode(true);
284
+ stdin.resume();
285
+ let buf = "";
286
+ const cleanup = () => {
287
+ stdin.removeListener("data", onData);
288
+ stdin.removeListener("error", onError);
289
+ stdin.setRawMode(false);
290
+ stdin.pause();
291
+ if (previousEncoding) stdin.setEncoding(previousEncoding);
292
+ };
293
+ const onData = (chunk) => {
294
+ for (const ch of chunk) {
295
+ if (ch === "\n" || ch === "\r") {
296
+ cleanup();
297
+ stdout.write("\n");
298
+ resolve2(buf.trim());
299
+ return;
300
+ }
301
+ if (ch === "") {
302
+ cleanup();
303
+ stdout.write("\n");
304
+ process.exit(130);
305
+ }
306
+ if (ch === "\x7F" || ch === "\b") {
307
+ if (buf.length > 0) {
308
+ buf = buf.slice(0, -1);
309
+ stdout.write("\b \b");
310
+ }
311
+ continue;
312
+ }
313
+ if (ch < " ") {
314
+ continue;
315
+ }
316
+ buf += ch;
317
+ stdout.write("\u2022");
318
+ }
319
+ };
320
+ const onError = (err) => {
321
+ cleanup();
322
+ reject(err instanceof Error ? err : new Error(String(err)));
323
+ };
324
+ stdin.on("data", onData);
325
+ stdin.on("error", onError);
287
326
  });
288
327
  }
289
328
  async function readSingleLineFromStdin() {
@@ -15440,7 +15479,7 @@ var ALL_TOOL_NAMES = ALL_TOOLS.map((t) => t.name);
15440
15479
  // src/mcp/server.ts
15441
15480
  async function runMcpServer(opts) {
15442
15481
  const fetchImpl = opts.fetchImpl ?? fetch;
15443
- const version2 = opts.version ?? (true ? "0.21.1" : "0.0.0-dev");
15482
+ const version2 = opts.version ?? (true ? "0.21.4" : "0.0.0-dev");
15444
15483
  const server = new McpServer(
15445
15484
  { name: "pyx-memory", version: version2 },
15446
15485
  { instructions: PYX_MEMORY_INSTRUCTIONS, capabilities: { tools: {} } }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pyxmate/memory",
3
- "version": "0.21.1",
3
+ "version": "0.21.4",
4
4
  "type": "module",
5
5
  "description": "SDK for pyx-memory — Memory as a Service for AI agents",
6
6
  "license": "MIT",