svamp-cli 0.2.80 → 0.2.82
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/{agentCommands-CcNJ1dcR.mjs → agentCommands-BPpgoGxT.mjs} +2 -2
- package/dist/cli.mjs +103 -57
- package/dist/{commands-iCbgYseB.mjs → commands-AzYDzCjE.mjs} +5 -5
- package/dist/{commands-C6lrExeN.mjs → commands-BSfZg4aa.mjs} +1 -1
- package/dist/{commands-GMLad6_u.mjs → commands-BXwzw3Mu.mjs} +23 -127
- package/dist/{commands-BKJNCTjq.mjs → commands-DHOxmh4o.mjs} +2 -2
- package/dist/{fleet-BdWjugcV.mjs → fleet-DDYoKg0Q.mjs} +1 -1
- package/dist/{frpc-j60b46eU.mjs → frpc-DPfGAdlj.mjs} +19 -3
- package/dist/index.mjs +1 -1
- package/dist/{package-C4KoS6-F.mjs → package-BmFZfykH.mjs} +1 -1
- package/dist/{run-W8JZkXIf.mjs → run-BvocESxe.mjs} +296 -48
- package/dist/{run-DamsNf6r.mjs → run-CrOw9-WG.mjs} +1 -1
- package/dist/{serveCommands-DEik3hcu.mjs → serveCommands-DJUhkyLk.mjs} +5 -5
- package/dist/{serveManager-DTR_TDIp.mjs → serveManager-bhh_rQ5M.mjs} +7 -3
- package/package.json +1 -1
|
@@ -1,129 +1,24 @@
|
|
|
1
1
|
import os from 'os';
|
|
2
2
|
import fs__default from 'fs';
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
function parseFrontmatter(content) {
|
|
25
|
-
const match = content.match(/^---\s*\n([\s\S]*?)\n---/);
|
|
26
|
-
if (!match) return null;
|
|
27
|
-
const yaml = match[1];
|
|
28
|
-
const result = {};
|
|
29
|
-
let currentKey = null;
|
|
30
|
-
let nestedObj = null;
|
|
31
|
-
for (const line of yaml.split("\n")) {
|
|
32
|
-
if (!line.trim() || line.trim().startsWith("#")) continue;
|
|
33
|
-
const indentMatch = line.match(/^(\s*)/);
|
|
34
|
-
const indent = indentMatch ? indentMatch[1].length : 0;
|
|
35
|
-
if (indent > 0 && currentKey && nestedObj !== null) {
|
|
36
|
-
const kvMatch2 = line.trim().match(/^([^:]+):\s*(.*)$/);
|
|
37
|
-
if (kvMatch2) {
|
|
38
|
-
nestedObj[kvMatch2[1].trim()] = kvMatch2[2].trim().replace(/^["']|["']$/g, "");
|
|
39
|
-
}
|
|
40
|
-
continue;
|
|
41
|
-
}
|
|
42
|
-
if (nestedObj !== null && currentKey) {
|
|
43
|
-
result[currentKey] = nestedObj;
|
|
44
|
-
nestedObj = null;
|
|
45
|
-
currentKey = null;
|
|
46
|
-
}
|
|
47
|
-
const kvMatch = line.match(/^([^:]+):\s*(.*)$/);
|
|
48
|
-
if (!kvMatch) continue;
|
|
49
|
-
const key = kvMatch[1].trim();
|
|
50
|
-
const value = kvMatch[2].trim();
|
|
51
|
-
if (!value) {
|
|
52
|
-
currentKey = key;
|
|
53
|
-
nestedObj = {};
|
|
54
|
-
} else {
|
|
55
|
-
result[key] = value.replace(/^["']|["']$/g, "");
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
if (nestedObj !== null && currentKey) {
|
|
59
|
-
result[currentKey] = nestedObj;
|
|
60
|
-
}
|
|
61
|
-
if (!result.name || typeof result.name !== "string") return null;
|
|
62
|
-
if (!result.description || typeof result.description !== "string") return null;
|
|
63
|
-
return result;
|
|
64
|
-
}
|
|
65
|
-
async function searchSkills(query) {
|
|
66
|
-
const base = getArtifactBaseUrl();
|
|
67
|
-
const filters = encodeURIComponent(JSON.stringify({ type: "skill" }));
|
|
68
|
-
const url = `${base}/${SKILLS_COLLECTION}/children?keywords=${encodeURIComponent(query)}&filters=${filters}&limit=50`;
|
|
69
|
-
const resp = await fetchWithTimeout(url);
|
|
70
|
-
if (!resp.ok) {
|
|
71
|
-
if (resp.status === 404) return [];
|
|
72
|
-
throw new Error(`Search failed: ${resp.status} ${resp.statusText}`);
|
|
73
|
-
}
|
|
74
|
-
const data = await resp.json();
|
|
75
|
-
return normalizeSkillList(Array.isArray(data) ? data : data.items || []);
|
|
76
|
-
}
|
|
77
|
-
async function getSkillInfo(skillAlias) {
|
|
78
|
-
const base = getArtifactBaseUrl();
|
|
79
|
-
const url = `${base}/${skillAlias}`;
|
|
80
|
-
const resp = await fetchWithTimeout(url);
|
|
81
|
-
if (!resp.ok) {
|
|
82
|
-
if (resp.status === 404) return null;
|
|
83
|
-
throw new Error(`Get skill failed: ${resp.status} ${resp.statusText}`);
|
|
84
|
-
}
|
|
85
|
-
const data = await resp.json();
|
|
86
|
-
return normalizeSkill(data);
|
|
87
|
-
}
|
|
88
|
-
async function listSkillFiles(skillAlias, dir = "") {
|
|
89
|
-
const base = getArtifactBaseUrl();
|
|
90
|
-
const pathPart = dir ? `/${dir}/` : "/";
|
|
91
|
-
const url = `${base}/${skillAlias}/files${pathPart}`;
|
|
92
|
-
const resp = await fetchWithTimeout(url);
|
|
93
|
-
if (!resp.ok) {
|
|
94
|
-
throw new Error(`List files failed: ${resp.status} ${resp.statusText}`);
|
|
95
|
-
}
|
|
96
|
-
const data = await resp.json();
|
|
97
|
-
return Array.isArray(data) ? data : data.items || [];
|
|
98
|
-
}
|
|
99
|
-
async function downloadSkillFile(skillAlias, filePath) {
|
|
100
|
-
const base = getArtifactBaseUrl();
|
|
101
|
-
const url = `${base}/${skillAlias}/files/${filePath}`;
|
|
102
|
-
const resp = await fetchWithTimeout(url, { redirect: "follow" }, 6e4);
|
|
103
|
-
if (!resp.ok) {
|
|
104
|
-
throw new Error(`Download failed for ${filePath}: ${resp.status} ${resp.statusText}`);
|
|
105
|
-
}
|
|
106
|
-
return await resp.text();
|
|
107
|
-
}
|
|
108
|
-
function normalizeSkillList(items) {
|
|
109
|
-
return items.map(normalizeSkill).filter((s) => s !== null);
|
|
110
|
-
}
|
|
111
|
-
function normalizeSkill(item) {
|
|
112
|
-
if (!item) return null;
|
|
113
|
-
const manifest = item.manifest || {};
|
|
114
|
-
return {
|
|
115
|
-
alias: item.alias || manifest.name || item.id || "unknown",
|
|
116
|
-
name: manifest.name || item.alias || "unknown",
|
|
117
|
-
description: manifest.description || "",
|
|
118
|
-
author: manifest.metadata?.author || manifest.author,
|
|
119
|
-
version: manifest.metadata?.version || manifest.version,
|
|
120
|
-
tags: manifest.tags,
|
|
121
|
-
created_at: item.created_at,
|
|
122
|
-
last_modified: item.last_modified,
|
|
123
|
-
versions: item.versions,
|
|
124
|
-
git_url: item.git_url
|
|
125
|
-
};
|
|
126
|
-
}
|
|
3
|
+
import { resolve, join, relative } from 'path';
|
|
4
|
+
import { p as parseFrontmatter, j as getSkillsServer, k as SKILLS_WORKSPACE, l as SKILLS_COLLECTION, m as fetchWithTimeout, n as searchSkills, o as SKILLS_DIR, q as getSkillInfo, t as downloadSkillFile, u as listSkillFiles } from './run-BvocESxe.mjs';
|
|
5
|
+
import 'fs/promises';
|
|
6
|
+
import 'url';
|
|
7
|
+
import 'child_process';
|
|
8
|
+
import 'crypto';
|
|
9
|
+
import 'node:fs';
|
|
10
|
+
import 'util';
|
|
11
|
+
import 'node:crypto';
|
|
12
|
+
import 'node:path';
|
|
13
|
+
import 'node:child_process';
|
|
14
|
+
import '@agentclientprotocol/sdk';
|
|
15
|
+
import 'node:os';
|
|
16
|
+
import '@modelcontextprotocol/sdk/client/index.js';
|
|
17
|
+
import '@modelcontextprotocol/sdk/client/stdio.js';
|
|
18
|
+
import '@modelcontextprotocol/sdk/types.js';
|
|
19
|
+
import 'zod';
|
|
20
|
+
import 'node:fs/promises';
|
|
21
|
+
import 'node:util';
|
|
127
22
|
|
|
128
23
|
const SVAMP_HOME = process.env.SVAMP_HOME || join(os.homedir(), ".svamp");
|
|
129
24
|
const ENV_FILE = join(SVAMP_HOME, ".env");
|
|
@@ -373,7 +268,7 @@ async function skillsPublish(skillPath, opts) {
|
|
|
373
268
|
console.error('Not logged in. Run "svamp login <url>" first.');
|
|
374
269
|
process.exit(1);
|
|
375
270
|
}
|
|
376
|
-
const serverUrl = process.env.HYPHA_SERVER_URL ||
|
|
271
|
+
const serverUrl = process.env.HYPHA_SERVER_URL || getSkillsServer();
|
|
377
272
|
let server;
|
|
378
273
|
try {
|
|
379
274
|
const mod = await import('hypha-rpc');
|
|
@@ -503,9 +398,10 @@ async function skillsPublish(skillPath, opts) {
|
|
|
503
398
|
await server.disconnect();
|
|
504
399
|
process.exit(1);
|
|
505
400
|
}
|
|
401
|
+
const skillsServer = getSkillsServer();
|
|
506
402
|
console.log(`Published "${manifest.name}" (${uploaded} files)${versionTag ? ` as ${versionTag}` : ""}`);
|
|
507
|
-
console.log(` View: ${
|
|
508
|
-
const gitUrl = `${
|
|
403
|
+
console.log(` View: ${skillsServer}/${SKILLS_WORKSPACE}/artifacts/${manifest.name}`);
|
|
404
|
+
const gitUrl = `${skillsServer}/${SKILLS_WORKSPACE}/git/${manifest.name}`;
|
|
509
405
|
console.log(` Git: ${gitUrl}`);
|
|
510
406
|
if (isUpdate) {
|
|
511
407
|
console.log(` Tip: Use --version <tag> to publish a named version.`);
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { writeFileSync, readFileSync } from 'fs';
|
|
2
2
|
import { resolve } from 'path';
|
|
3
|
-
import { connectAndGetMachine } from './commands-
|
|
3
|
+
import { connectAndGetMachine } from './commands-BSfZg4aa.mjs';
|
|
4
4
|
import 'node:fs';
|
|
5
5
|
import 'node:child_process';
|
|
6
6
|
import 'node:path';
|
|
7
7
|
import 'node:os';
|
|
8
|
-
import './run-
|
|
8
|
+
import './run-BvocESxe.mjs';
|
|
9
9
|
import 'os';
|
|
10
10
|
import 'fs/promises';
|
|
11
11
|
import 'url';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { existsSync, readFileSync } from 'node:fs';
|
|
2
2
|
import { join } from 'node:path';
|
|
3
3
|
import os from 'node:os';
|
|
4
|
-
import { c as connectToHypha } from './run-
|
|
4
|
+
import { c as connectToHypha } from './run-BvocESxe.mjs';
|
|
5
5
|
import { PINNED_CLAUDE_CODE_VERSION } from './pinnedClaudeCode-HydRNEt7.mjs';
|
|
6
6
|
import 'os';
|
|
7
7
|
import 'fs/promises';
|
|
@@ -3,6 +3,22 @@ import { mkdirSync, writeFileSync, unlinkSync, existsSync, chmodSync, readFileSy
|
|
|
3
3
|
import { join } from 'path';
|
|
4
4
|
import { homedir, platform, arch } from 'os';
|
|
5
5
|
import { createHash, randomUUID } from 'crypto';
|
|
6
|
+
import { e as getFrpsSubdomainHost, f as getFrpsServerAddr } from './run-BvocESxe.mjs';
|
|
7
|
+
import 'fs/promises';
|
|
8
|
+
import 'url';
|
|
9
|
+
import 'node:fs';
|
|
10
|
+
import 'util';
|
|
11
|
+
import 'node:crypto';
|
|
12
|
+
import 'node:path';
|
|
13
|
+
import 'node:child_process';
|
|
14
|
+
import '@agentclientprotocol/sdk';
|
|
15
|
+
import 'node:os';
|
|
16
|
+
import '@modelcontextprotocol/sdk/client/index.js';
|
|
17
|
+
import '@modelcontextprotocol/sdk/client/stdio.js';
|
|
18
|
+
import '@modelcontextprotocol/sdk/types.js';
|
|
19
|
+
import 'zod';
|
|
20
|
+
import 'node:fs/promises';
|
|
21
|
+
import 'node:util';
|
|
6
22
|
|
|
7
23
|
function getMachineFingerprint() {
|
|
8
24
|
const idFile = join(homedir(), ".svamp", "machine-id");
|
|
@@ -25,7 +41,7 @@ const FRPC_BIN = join(BIN_DIR, platform() === "win32" ? "frpc.exe" : "frpc");
|
|
|
25
41
|
function isInCluster() {
|
|
26
42
|
return !!(process.env.KUBERNETES_SERVICE_HOST || process.env.SANDBOX_ID);
|
|
27
43
|
}
|
|
28
|
-
const
|
|
44
|
+
const FRPS_CLUSTER_ADDR = "frps.hypha.svc.cluster.local";
|
|
29
45
|
const DEFAULT_FRPS_PORT = isInCluster() ? 7e3 : 443;
|
|
30
46
|
const FRPS_PUBLIC_TOKEN = "hypha-frps-public";
|
|
31
47
|
function getFrpcDownloadUrl() {
|
|
@@ -212,11 +228,11 @@ class FrpcTunnel {
|
|
|
212
228
|
this.log = options.log || ((msg) => console.log(`[FRPC] ${msg}`));
|
|
213
229
|
const hyphaToken = options.serverConfig?.hyphaToken || process.env.HYPHA_TOKEN || "";
|
|
214
230
|
this.serverConfig = {
|
|
215
|
-
serverAddr: options.serverConfig?.serverAddr || process.env.FRPS_SERVER_ADDR ||
|
|
231
|
+
serverAddr: options.serverConfig?.serverAddr || process.env.FRPS_SERVER_ADDR || (isInCluster() ? FRPS_CLUSTER_ADDR : getFrpsServerAddr()),
|
|
216
232
|
serverPort: options.serverConfig?.serverPort || parseInt(process.env.FRPS_SERVER_PORT || "", 10) || DEFAULT_FRPS_PORT,
|
|
217
233
|
authToken: options.serverConfig?.authToken || process.env.FRPS_AUTH_TOKEN || FRPS_PUBLIC_TOKEN,
|
|
218
234
|
hyphaToken,
|
|
219
|
-
subDomainHost: options.serverConfig?.subDomainHost || process.env.FRPS_SUBDOMAIN_HOST ||
|
|
235
|
+
subDomainHost: options.serverConfig?.subDomainHost || process.env.FRPS_SUBDOMAIN_HOST || getFrpsSubdomainHost()
|
|
220
236
|
};
|
|
221
237
|
if (!this.serverConfig.hyphaToken) {
|
|
222
238
|
throw new Error(
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { c as connectToHypha, d as daemonStatus, g as getHyphaServerUrl, r as registerMachineService, a as registerSessionService, s as startDaemon, b as stopDaemon } from './run-
|
|
1
|
+
export { c as connectToHypha, d as daemonStatus, g as getHyphaServerUrl, r as registerMachineService, a as registerSessionService, s as startDaemon, b as stopDaemon } from './run-BvocESxe.mjs';
|
|
2
2
|
import 'os';
|
|
3
3
|
import 'fs/promises';
|
|
4
4
|
import 'fs';
|