@pyxmate/memory 1.16.0 → 1.16.1
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/cli/pyx-mem.mjs +10 -4
- package/package.json +1 -1
package/dist/cli/pyx-mem.mjs
CHANGED
|
@@ -168,6 +168,7 @@ function getDefaultKeychain() {
|
|
|
168
168
|
}
|
|
169
169
|
|
|
170
170
|
// src/cli/probe.ts
|
|
171
|
+
import { randomUUID } from "crypto";
|
|
171
172
|
var PROBE_PATH = "/api/memory/entries?limit=1";
|
|
172
173
|
var PROBE_TIMEOUT_MS = 8e3;
|
|
173
174
|
async function probeCredentials(args) {
|
|
@@ -175,10 +176,15 @@ async function probeCredentials(args) {
|
|
|
175
176
|
const url = `${args.endpoint}${PROBE_PATH}`;
|
|
176
177
|
const ctl = new AbortController();
|
|
177
178
|
const timer = setTimeout(() => ctl.abort(), PROBE_TIMEOUT_MS);
|
|
179
|
+
const idempotencyKey = `cli-probe-${randomUUID()}`;
|
|
178
180
|
try {
|
|
179
181
|
const res = await fetcher(url, {
|
|
180
182
|
method: "GET",
|
|
181
|
-
headers: {
|
|
183
|
+
headers: {
|
|
184
|
+
Authorization: `Bearer ${args.apiKey}`,
|
|
185
|
+
Accept: "application/json",
|
|
186
|
+
"Idempotency-Key": idempotencyKey
|
|
187
|
+
},
|
|
182
188
|
signal: ctl.signal
|
|
183
189
|
});
|
|
184
190
|
if (res.status === 401 || res.status === 403) return { kind: "invalid", status: res.status };
|
|
@@ -551,7 +557,7 @@ function createReadCredentials(providerFactory) {
|
|
|
551
557
|
}
|
|
552
558
|
|
|
553
559
|
// src/mcp/proxy-server.ts
|
|
554
|
-
import { createHash, randomUUID } from "crypto";
|
|
560
|
+
import { createHash, randomUUID as randomUUID2 } from "crypto";
|
|
555
561
|
import { readFile, stat } from "fs/promises";
|
|
556
562
|
import { basename, isAbsolute, resolve } from "path";
|
|
557
563
|
import { Client as McpClient } from "@modelcontextprotocol/sdk/client/index.js";
|
|
@@ -687,7 +693,7 @@ var LOCAL_UPLOAD_META_KEY = "pyx.dev/local-upload";
|
|
|
687
693
|
|
|
688
694
|
// src/mcp/proxy-server.ts
|
|
689
695
|
var REMOTE_MCP_PATH = "/mcp";
|
|
690
|
-
function createMcpIdempotentFetch(fetchImpl = fetch, sessionNonce =
|
|
696
|
+
function createMcpIdempotentFetch(fetchImpl = fetch, sessionNonce = randomUUID2()) {
|
|
691
697
|
const wrapped = async (input, init) => {
|
|
692
698
|
const upstream = input instanceof Request ? input : new Request(String(input), init);
|
|
693
699
|
const method = init?.method ?? upstream.method;
|
|
@@ -829,7 +835,7 @@ function createProxyServer(client, version, uploadLocalFile) {
|
|
|
829
835
|
return server;
|
|
830
836
|
}
|
|
831
837
|
async function runMcpProxyServer(opts) {
|
|
832
|
-
const version = opts.version ?? (true ? "1.16.
|
|
838
|
+
const version = opts.version ?? (true ? "1.16.1" : "0.0.0-dev");
|
|
833
839
|
const read = await opts.readCredentials();
|
|
834
840
|
if (!read.ok) {
|
|
835
841
|
const text = read.result.content.map((c) => c.type === "text" ? c.text : "").join(" ").trim();
|