memshell-party-cli 0.3.4 → 0.4.0
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.js +833 -131
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +11 -1
- package/dist/index.js +17 -5
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/skills/memshell-party/SKILL.md +173 -1
package/dist/index.d.ts
CHANGED
|
@@ -317,7 +317,12 @@ declare function createMcpServer(client: MemPartyClient): McpServer;
|
|
|
317
317
|
declare function startMcpStdio(client: MemPartyClient): Promise<void>;
|
|
318
318
|
|
|
319
319
|
/** Shared types for the shell connection testers. */
|
|
320
|
-
|
|
320
|
+
/**
|
|
321
|
+
* Shell protocol name. Used to be a hardcoded union of the built-in tools;
|
|
322
|
+
* now a free string — `src/connect/registry.ts` is the source of truth for
|
|
323
|
+
* which protocols actually exist (built-ins + plugins like "mimic").
|
|
324
|
+
*/
|
|
325
|
+
type ConnectTool = string;
|
|
321
326
|
interface ConnectTestResult {
|
|
322
327
|
ok: boolean;
|
|
323
328
|
tool: ConnectTool;
|
|
@@ -364,6 +369,8 @@ interface StoredShell {
|
|
|
364
369
|
headerValue?: string;
|
|
365
370
|
extraHeaders?: Record<string, string>;
|
|
366
371
|
insecure?: boolean;
|
|
372
|
+
/** mimic protocol: site profile name (see 'memparty profile'). */
|
|
373
|
+
profile?: string;
|
|
367
374
|
/** Free-form note for this shell (e.g. "DMZ 跳板机"). */
|
|
368
375
|
remark?: string;
|
|
369
376
|
createdAt: string;
|
|
@@ -406,6 +413,7 @@ interface ConnectionFlags {
|
|
|
406
413
|
headerValue?: string;
|
|
407
414
|
extraHeaders?: Record<string, string>;
|
|
408
415
|
insecure?: boolean;
|
|
416
|
+
profile?: string;
|
|
409
417
|
}
|
|
410
418
|
interface ResolvedConnection {
|
|
411
419
|
url: string;
|
|
@@ -416,6 +424,8 @@ interface ResolvedConnection {
|
|
|
416
424
|
headerValue?: string;
|
|
417
425
|
extraHeaders: Record<string, string>;
|
|
418
426
|
insecure?: boolean;
|
|
427
|
+
/** mimic protocol: site profile name. */
|
|
428
|
+
profile?: string;
|
|
419
429
|
/** Canonical `project/shell` reference, when resolved from the store. */
|
|
420
430
|
targetName?: string;
|
|
421
431
|
}
|
package/dist/index.js
CHANGED
|
@@ -631,15 +631,25 @@ function postRaw(url, body, options = {}) {
|
|
|
631
631
|
if (!isHttps && target.protocol !== "http:") {
|
|
632
632
|
return Promise.reject(new HttpRequestError(`unsupported protocol: ${target.protocol}`, url));
|
|
633
633
|
}
|
|
634
|
+
let proxy = null;
|
|
635
|
+
if (!isHttps && process.env.MEMPARTY_PROXY) {
|
|
636
|
+
try {
|
|
637
|
+
proxy = new URL(process.env.MEMPARTY_PROXY);
|
|
638
|
+
} catch {
|
|
639
|
+
return Promise.reject(
|
|
640
|
+
new HttpRequestError(`invalid MEMPARTY_PROXY: ${process.env.MEMPARTY_PROXY}`, url)
|
|
641
|
+
);
|
|
642
|
+
}
|
|
643
|
+
}
|
|
634
644
|
return new Promise((resolve2, reject) => {
|
|
635
645
|
const started = Date.now();
|
|
636
646
|
const transport = isHttps ? https : http;
|
|
637
647
|
const req = transport.request(
|
|
638
648
|
{
|
|
639
649
|
method: "POST",
|
|
640
|
-
hostname: target.hostname,
|
|
641
|
-
port: target.port || (isHttps ? 443 : 80),
|
|
642
|
-
path: `${target.pathname}${target.search}`,
|
|
650
|
+
hostname: proxy ? proxy.hostname : target.hostname,
|
|
651
|
+
port: proxy ? proxy.port || 8080 : target.port || (isHttps ? 443 : 80),
|
|
652
|
+
path: proxy ? target.toString() : `${target.pathname}${target.search}`,
|
|
643
653
|
// agent:false — never reuse a pooled socket. A shell server may close
|
|
644
654
|
// the connection right after an empty response, and reusing such a
|
|
645
655
|
// socket surfaces as a spurious ECONNRESET on the next probe.
|
|
@@ -1814,7 +1824,8 @@ function autoSaveShell(conn) {
|
|
|
1814
1824
|
headerName: conn.headerName,
|
|
1815
1825
|
headerValue: conn.headerValue,
|
|
1816
1826
|
extraHeaders: Object.keys(conn.extraHeaders).length > 0 ? conn.extraHeaders : void 0,
|
|
1817
|
-
insecure: conn.insecure
|
|
1827
|
+
insecure: conn.insecure,
|
|
1828
|
+
profile: conn.profile
|
|
1818
1829
|
});
|
|
1819
1830
|
return `${projectName}/${shellName}`;
|
|
1820
1831
|
}
|
|
@@ -1856,7 +1867,7 @@ function resolveConnection(ref, flags) {
|
|
|
1856
1867
|
throw new Error("no URL \u2014 pass --url or a saved target name");
|
|
1857
1868
|
}
|
|
1858
1869
|
if (!tool) {
|
|
1859
|
-
throw new Error("--tool is required
|
|
1870
|
+
throw new Error("--tool is required \u2014 see the command's --help for available protocols");
|
|
1860
1871
|
}
|
|
1861
1872
|
return {
|
|
1862
1873
|
url,
|
|
@@ -1867,6 +1878,7 @@ function resolveConnection(ref, flags) {
|
|
|
1867
1878
|
headerValue: flags.headerValue ?? stored?.headerValue,
|
|
1868
1879
|
extraHeaders: { ...stored?.extraHeaders, ...flags.extraHeaders },
|
|
1869
1880
|
insecure: flags.insecure ?? stored?.insecure,
|
|
1881
|
+
profile: flags.profile ?? stored?.profile,
|
|
1870
1882
|
targetName
|
|
1871
1883
|
};
|
|
1872
1884
|
}
|