@deeplake/hivemind 0.7.23 → 0.7.25
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.
|
@@ -6,13 +6,13 @@
|
|
|
6
6
|
},
|
|
7
7
|
"metadata": {
|
|
8
8
|
"description": "Cloud-backed persistent shared memory for AI agents powered by Deeplake",
|
|
9
|
-
"version": "0.7.
|
|
9
|
+
"version": "0.7.25"
|
|
10
10
|
},
|
|
11
11
|
"plugins": [
|
|
12
12
|
{
|
|
13
13
|
"name": "hivemind",
|
|
14
14
|
"description": "Persistent shared memory powered by Deeplake — captures all session activity and provides cross-session, cross-agent memory search",
|
|
15
|
-
"version": "0.7.
|
|
15
|
+
"version": "0.7.25",
|
|
16
16
|
"source": "./claude-code",
|
|
17
17
|
"homepage": "https://github.com/activeloopai/hivemind"
|
|
18
18
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "hivemind",
|
|
3
3
|
"description": "Cloud-backed persistent memory powered by Deeplake — read, write, and share memory across Claude Code sessions and agents",
|
|
4
|
-
"version": "0.7.
|
|
4
|
+
"version": "0.7.25",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Activeloop",
|
|
7
7
|
"url": "https://deeplake.ai"
|
package/bundle/cli.js
CHANGED
|
@@ -17,21 +17,21 @@ __export(index_marker_store_exports, {
|
|
|
17
17
|
hasFreshIndexMarker: () => hasFreshIndexMarker,
|
|
18
18
|
writeIndexMarker: () => writeIndexMarker
|
|
19
19
|
});
|
|
20
|
-
import { existsSync as
|
|
21
|
-
import { join as
|
|
20
|
+
import { existsSync as existsSync12, mkdirSync as mkdirSync3, readFileSync as readFileSync9, writeFileSync as writeFileSync6 } from "node:fs";
|
|
21
|
+
import { join as join15 } from "node:path";
|
|
22
22
|
import { tmpdir } from "node:os";
|
|
23
23
|
function getIndexMarkerDir() {
|
|
24
|
-
return process.env.HIVEMIND_INDEX_MARKER_DIR ??
|
|
24
|
+
return process.env.HIVEMIND_INDEX_MARKER_DIR ?? join15(tmpdir(), "hivemind-deeplake-indexes");
|
|
25
25
|
}
|
|
26
26
|
function buildIndexMarkerPath(workspaceId, orgId, table, suffix) {
|
|
27
27
|
const markerKey = [workspaceId, orgId, table, suffix].join("__").replace(/[^a-zA-Z0-9_.-]/g, "_");
|
|
28
|
-
return
|
|
28
|
+
return join15(getIndexMarkerDir(), `${markerKey}.json`);
|
|
29
29
|
}
|
|
30
30
|
function hasFreshIndexMarker(markerPath) {
|
|
31
|
-
if (!
|
|
31
|
+
if (!existsSync12(markerPath))
|
|
32
32
|
return false;
|
|
33
33
|
try {
|
|
34
|
-
const raw = JSON.parse(
|
|
34
|
+
const raw = JSON.parse(readFileSync9(markerPath, "utf-8"));
|
|
35
35
|
const updatedAt = raw.updatedAt ? new Date(raw.updatedAt).getTime() : NaN;
|
|
36
36
|
if (!Number.isFinite(updatedAt) || Date.now() - updatedAt > INDEX_MARKER_TTL_MS)
|
|
37
37
|
return false;
|
|
@@ -42,7 +42,7 @@ function hasFreshIndexMarker(markerPath) {
|
|
|
42
42
|
}
|
|
43
43
|
function writeIndexMarker(markerPath) {
|
|
44
44
|
mkdirSync3(getIndexMarkerDir(), { recursive: true });
|
|
45
|
-
|
|
45
|
+
writeFileSync6(markerPath, JSON.stringify({ updatedAt: (/* @__PURE__ */ new Date()).toISOString() }), "utf-8");
|
|
46
46
|
}
|
|
47
47
|
var INDEX_MARKER_TTL_MS;
|
|
48
48
|
var init_index_marker_store = __esm({
|
|
@@ -54,6 +54,9 @@ var init_index_marker_store = __esm({
|
|
|
54
54
|
|
|
55
55
|
// dist/src/cli/install-claude.js
|
|
56
56
|
import { execFileSync } from "node:child_process";
|
|
57
|
+
import { existsSync as existsSync2, readFileSync as readFileSync2, writeFileSync as writeFileSync2 } from "node:fs";
|
|
58
|
+
import { homedir as homedir2 } from "node:os";
|
|
59
|
+
import { join as join2 } from "node:path";
|
|
57
60
|
|
|
58
61
|
// dist/src/cli/util.js
|
|
59
62
|
import { existsSync, mkdirSync, readFileSync, writeFileSync, cpSync, symlinkSync, unlinkSync, lstatSync } from "node:fs";
|
|
@@ -178,6 +181,75 @@ function pluginAlreadyInstalled() {
|
|
|
178
181
|
return r.stdout.includes(PLUGIN_KEY);
|
|
179
182
|
}
|
|
180
183
|
var PLUGIN_SCOPES = ["user", "project", "local", "managed"];
|
|
184
|
+
function resolvePluginRoot() {
|
|
185
|
+
return join2(homedir2(), ".claude", "plugins", "hivemind");
|
|
186
|
+
}
|
|
187
|
+
function marketplaceHooksJsonPath() {
|
|
188
|
+
return join2(homedir2(), ".claude", "plugins", "marketplaces", "hivemind", "claude-code", "hooks", "hooks.json");
|
|
189
|
+
}
|
|
190
|
+
function settingsJsonPath() {
|
|
191
|
+
return join2(homedir2(), ".claude", "settings.json");
|
|
192
|
+
}
|
|
193
|
+
function resolveCommand(command, pluginRoot) {
|
|
194
|
+
return command.replace(/\$\{CLAUDE_PLUGIN_ROOT\}/g, pluginRoot);
|
|
195
|
+
}
|
|
196
|
+
function isHivemindMatcher(matcher) {
|
|
197
|
+
return matcher.hooks?.some((h) => {
|
|
198
|
+
if (typeof h.command !== "string")
|
|
199
|
+
return false;
|
|
200
|
+
const normalized = h.command.replace(/\\/g, "/");
|
|
201
|
+
return normalized.includes("plugins/hivemind/bundle/");
|
|
202
|
+
}) ?? false;
|
|
203
|
+
}
|
|
204
|
+
function syncHivemindHooksToSettings() {
|
|
205
|
+
const hooksPath = marketplaceHooksJsonPath();
|
|
206
|
+
const settingsPath = settingsJsonPath();
|
|
207
|
+
if (!existsSync2(hooksPath))
|
|
208
|
+
return { changed: false, events: [] };
|
|
209
|
+
let canonical;
|
|
210
|
+
try {
|
|
211
|
+
canonical = JSON.parse(readFileSync2(hooksPath, "utf-8"));
|
|
212
|
+
} catch {
|
|
213
|
+
return { changed: false, events: [] };
|
|
214
|
+
}
|
|
215
|
+
if (!canonical.hooks)
|
|
216
|
+
return { changed: false, events: [] };
|
|
217
|
+
let settings = {};
|
|
218
|
+
if (existsSync2(settingsPath)) {
|
|
219
|
+
try {
|
|
220
|
+
settings = JSON.parse(readFileSync2(settingsPath, "utf-8"));
|
|
221
|
+
} catch {
|
|
222
|
+
return { changed: false, events: [] };
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
settings.hooks = settings.hooks ?? {};
|
|
226
|
+
const pluginRoot = resolvePluginRoot();
|
|
227
|
+
const changedEvents = [];
|
|
228
|
+
let changed = false;
|
|
229
|
+
for (const [event, matchers] of Object.entries(canonical.hooks)) {
|
|
230
|
+
const resolvedMatchers = matchers.map((m) => ({
|
|
231
|
+
...m.matcher !== void 0 ? { matcher: m.matcher } : {},
|
|
232
|
+
hooks: m.hooks.map((h) => ({
|
|
233
|
+
...h.type !== void 0 ? { type: h.type } : {},
|
|
234
|
+
...h.command !== void 0 ? { command: resolveCommand(h.command, pluginRoot) } : {},
|
|
235
|
+
...h.timeout !== void 0 ? { timeout: h.timeout } : {},
|
|
236
|
+
...h.async !== void 0 ? { async: h.async } : {}
|
|
237
|
+
}))
|
|
238
|
+
}));
|
|
239
|
+
const existing = settings.hooks[event] ?? [];
|
|
240
|
+
const preserved = existing.filter((m) => !isHivemindMatcher(m));
|
|
241
|
+
const next = [...preserved, ...resolvedMatchers];
|
|
242
|
+
if (JSON.stringify(next) !== JSON.stringify(existing)) {
|
|
243
|
+
settings.hooks[event] = next;
|
|
244
|
+
changedEvents.push(event);
|
|
245
|
+
changed = true;
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
if (changed) {
|
|
249
|
+
writeFileSync2(settingsPath, JSON.stringify(settings, null, 2) + "\n", "utf-8");
|
|
250
|
+
}
|
|
251
|
+
return { changed, events: changedEvents };
|
|
252
|
+
}
|
|
181
253
|
function installClaude() {
|
|
182
254
|
requireClaudeCli();
|
|
183
255
|
if (!marketplaceAlreadyAdded()) {
|
|
@@ -200,6 +272,14 @@ function installClaude() {
|
|
|
200
272
|
log(` Claude Code refreshed via marketplace ${MARKETPLACE_SOURCE}`);
|
|
201
273
|
}
|
|
202
274
|
runClaude(["plugin", "enable", PLUGIN_KEY]);
|
|
275
|
+
try {
|
|
276
|
+
const sync = syncHivemindHooksToSettings();
|
|
277
|
+
if (sync.changed) {
|
|
278
|
+
log(` Claude Code settings.json hooks synced (${sync.events.join(", ")})`);
|
|
279
|
+
}
|
|
280
|
+
} catch (e) {
|
|
281
|
+
log(` Claude Code settings.json sync skipped: ${e?.message ?? String(e)}`);
|
|
282
|
+
}
|
|
203
283
|
}
|
|
204
284
|
function uninstallClaude() {
|
|
205
285
|
try {
|
|
@@ -214,16 +294,16 @@ function uninstallClaude() {
|
|
|
214
294
|
}
|
|
215
295
|
|
|
216
296
|
// dist/src/cli/install-codex.js
|
|
217
|
-
import { existsSync as
|
|
297
|
+
import { existsSync as existsSync3, readFileSync as readFileSync4, unlinkSync as unlinkSync2 } from "node:fs";
|
|
218
298
|
import { execFileSync as execFileSync2 } from "node:child_process";
|
|
219
|
-
import { join as
|
|
299
|
+
import { join as join4 } from "node:path";
|
|
220
300
|
|
|
221
301
|
// dist/src/cli/version.js
|
|
222
|
-
import { readFileSync as
|
|
223
|
-
import { join as
|
|
302
|
+
import { readFileSync as readFileSync3 } from "node:fs";
|
|
303
|
+
import { join as join3 } from "node:path";
|
|
224
304
|
function getVersion() {
|
|
225
305
|
try {
|
|
226
|
-
const pkg = JSON.parse(
|
|
306
|
+
const pkg = JSON.parse(readFileSync3(join3(pkgRoot(), "package.json"), "utf-8"));
|
|
227
307
|
return pkg.version ?? "0.0.0";
|
|
228
308
|
} catch {
|
|
229
309
|
return "0.0.0";
|
|
@@ -231,16 +311,16 @@ function getVersion() {
|
|
|
231
311
|
}
|
|
232
312
|
|
|
233
313
|
// dist/src/cli/install-codex.js
|
|
234
|
-
var CODEX_HOME =
|
|
235
|
-
var PLUGIN_DIR =
|
|
236
|
-
var HOOKS_PATH =
|
|
237
|
-
var AGENTS_SKILLS_DIR =
|
|
238
|
-
var SKILL_LINK =
|
|
314
|
+
var CODEX_HOME = join4(HOME, ".codex");
|
|
315
|
+
var PLUGIN_DIR = join4(CODEX_HOME, "hivemind");
|
|
316
|
+
var HOOKS_PATH = join4(CODEX_HOME, "hooks.json");
|
|
317
|
+
var AGENTS_SKILLS_DIR = join4(HOME, ".agents", "skills");
|
|
318
|
+
var SKILL_LINK = join4(AGENTS_SKILLS_DIR, "hivemind-memory");
|
|
239
319
|
function hookCmd(bundleFile, timeout, matcher) {
|
|
240
320
|
const block = {
|
|
241
321
|
hooks: [{
|
|
242
322
|
type: "command",
|
|
243
|
-
command: `node "${
|
|
323
|
+
command: `node "${join4(PLUGIN_DIR, "bundle", bundleFile)}"`,
|
|
244
324
|
timeout
|
|
245
325
|
}]
|
|
246
326
|
};
|
|
@@ -314,8 +394,8 @@ function mergeHooks(existing, ours, pluginDir = PLUGIN_DIR) {
|
|
|
314
394
|
function mergeHooksJson(ours) {
|
|
315
395
|
let existing = {};
|
|
316
396
|
try {
|
|
317
|
-
if (
|
|
318
|
-
const parsed = JSON.parse(
|
|
397
|
+
if (existsSync3(HOOKS_PATH)) {
|
|
398
|
+
const parsed = JSON.parse(readFileSync4(HOOKS_PATH, "utf-8"));
|
|
319
399
|
if (parsed && typeof parsed === "object")
|
|
320
400
|
existing = parsed;
|
|
321
401
|
}
|
|
@@ -354,20 +434,20 @@ function tryEnableCodexHooks() {
|
|
|
354
434
|
}
|
|
355
435
|
}
|
|
356
436
|
function installCodex() {
|
|
357
|
-
const srcBundle =
|
|
358
|
-
const srcSkills =
|
|
359
|
-
if (!
|
|
437
|
+
const srcBundle = join4(pkgRoot(), "codex", "bundle");
|
|
438
|
+
const srcSkills = join4(pkgRoot(), "codex", "skills");
|
|
439
|
+
if (!existsSync3(srcBundle)) {
|
|
360
440
|
throw new Error(`Codex bundle missing at ${srcBundle}. Run 'npm run build' first.`);
|
|
361
441
|
}
|
|
362
442
|
ensureDir(PLUGIN_DIR);
|
|
363
|
-
copyDir(srcBundle,
|
|
364
|
-
if (
|
|
365
|
-
copyDir(srcSkills,
|
|
443
|
+
copyDir(srcBundle, join4(PLUGIN_DIR, "bundle"));
|
|
444
|
+
if (existsSync3(srcSkills))
|
|
445
|
+
copyDir(srcSkills, join4(PLUGIN_DIR, "skills"));
|
|
366
446
|
tryEnableCodexHooks();
|
|
367
447
|
writeJson(HOOKS_PATH, mergeHooksJson(buildHooksJson()));
|
|
368
448
|
ensureDir(AGENTS_SKILLS_DIR);
|
|
369
|
-
const skillTarget =
|
|
370
|
-
if (
|
|
449
|
+
const skillTarget = join4(PLUGIN_DIR, "skills", "deeplake-memory");
|
|
450
|
+
if (existsSync3(skillTarget)) {
|
|
371
451
|
symlinkForce(skillTarget, SKILL_LINK);
|
|
372
452
|
} else {
|
|
373
453
|
warn(` Codex skill source missing at ${skillTarget}; skipping symlink`);
|
|
@@ -376,10 +456,10 @@ function installCodex() {
|
|
|
376
456
|
log(` Codex installed -> ${PLUGIN_DIR}`);
|
|
377
457
|
}
|
|
378
458
|
function uninstallCodex() {
|
|
379
|
-
if (
|
|
459
|
+
if (existsSync3(HOOKS_PATH)) {
|
|
380
460
|
let existing = {};
|
|
381
461
|
try {
|
|
382
|
-
const raw = JSON.parse(
|
|
462
|
+
const raw = JSON.parse(readFileSync4(HOOKS_PATH, "utf-8"));
|
|
383
463
|
if (raw && typeof raw === "object")
|
|
384
464
|
existing = raw;
|
|
385
465
|
} catch {
|
|
@@ -400,7 +480,7 @@ function uninstallCodex() {
|
|
|
400
480
|
}
|
|
401
481
|
}
|
|
402
482
|
}
|
|
403
|
-
if (
|
|
483
|
+
if (existsSync3(SKILL_LINK)) {
|
|
404
484
|
unlinkSync2(SKILL_LINK);
|
|
405
485
|
log(` Codex removed ${SKILL_LINK}`);
|
|
406
486
|
}
|
|
@@ -408,30 +488,30 @@ function uninstallCodex() {
|
|
|
408
488
|
}
|
|
409
489
|
|
|
410
490
|
// dist/src/cli/install-openclaw.js
|
|
411
|
-
import { existsSync as
|
|
412
|
-
import { join as
|
|
413
|
-
var PLUGIN_DIR2 =
|
|
491
|
+
import { existsSync as existsSync4, copyFileSync, rmSync } from "node:fs";
|
|
492
|
+
import { join as join5 } from "node:path";
|
|
493
|
+
var PLUGIN_DIR2 = join5(HOME, ".openclaw", "extensions", "hivemind");
|
|
414
494
|
function installOpenclaw() {
|
|
415
|
-
const srcDist =
|
|
416
|
-
const srcManifest =
|
|
417
|
-
const srcPkg =
|
|
418
|
-
const srcSkills =
|
|
419
|
-
if (!
|
|
495
|
+
const srcDist = join5(pkgRoot(), "openclaw", "dist");
|
|
496
|
+
const srcManifest = join5(pkgRoot(), "openclaw", "openclaw.plugin.json");
|
|
497
|
+
const srcPkg = join5(pkgRoot(), "openclaw", "package.json");
|
|
498
|
+
const srcSkills = join5(pkgRoot(), "openclaw", "skills");
|
|
499
|
+
if (!existsSync4(srcDist)) {
|
|
420
500
|
throw new Error(`OpenClaw bundle missing at ${srcDist}. Run 'npm run build' first.`);
|
|
421
501
|
}
|
|
422
502
|
ensureDir(PLUGIN_DIR2);
|
|
423
|
-
copyDir(srcDist,
|
|
424
|
-
if (
|
|
425
|
-
copyFileSync(srcManifest,
|
|
426
|
-
if (
|
|
427
|
-
copyFileSync(srcPkg,
|
|
428
|
-
if (
|
|
429
|
-
copyDir(srcSkills,
|
|
503
|
+
copyDir(srcDist, join5(PLUGIN_DIR2, "dist"));
|
|
504
|
+
if (existsSync4(srcManifest))
|
|
505
|
+
copyFileSync(srcManifest, join5(PLUGIN_DIR2, "openclaw.plugin.json"));
|
|
506
|
+
if (existsSync4(srcPkg))
|
|
507
|
+
copyFileSync(srcPkg, join5(PLUGIN_DIR2, "package.json"));
|
|
508
|
+
if (existsSync4(srcSkills))
|
|
509
|
+
copyDir(srcSkills, join5(PLUGIN_DIR2, "skills"));
|
|
430
510
|
writeVersionStamp(PLUGIN_DIR2, getVersion());
|
|
431
511
|
log(` OpenClaw installed -> ${PLUGIN_DIR2}`);
|
|
432
512
|
}
|
|
433
513
|
function uninstallOpenclaw() {
|
|
434
|
-
if (
|
|
514
|
+
if (existsSync4(PLUGIN_DIR2)) {
|
|
435
515
|
rmSync(PLUGIN_DIR2, { recursive: true, force: true });
|
|
436
516
|
log(` OpenClaw removed ${PLUGIN_DIR2}`);
|
|
437
517
|
} else {
|
|
@@ -440,23 +520,23 @@ function uninstallOpenclaw() {
|
|
|
440
520
|
}
|
|
441
521
|
|
|
442
522
|
// dist/src/cli/install-cursor.js
|
|
443
|
-
import { existsSync as
|
|
444
|
-
import { join as
|
|
445
|
-
var CURSOR_HOME =
|
|
446
|
-
var PLUGIN_DIR3 =
|
|
447
|
-
var HOOKS_PATH2 =
|
|
523
|
+
import { existsSync as existsSync5, unlinkSync as unlinkSync3 } from "node:fs";
|
|
524
|
+
import { join as join6 } from "node:path";
|
|
525
|
+
var CURSOR_HOME = join6(HOME, ".cursor");
|
|
526
|
+
var PLUGIN_DIR3 = join6(CURSOR_HOME, "hivemind");
|
|
527
|
+
var HOOKS_PATH2 = join6(CURSOR_HOME, "hooks.json");
|
|
448
528
|
var HIVEMIND_MARKER_KEY = "_hivemindManaged";
|
|
449
529
|
function buildHookCmd(bundleFile, timeout) {
|
|
450
530
|
return {
|
|
451
531
|
type: "command",
|
|
452
|
-
command: `node "${
|
|
532
|
+
command: `node "${join6(PLUGIN_DIR3, "bundle", bundleFile)}"`,
|
|
453
533
|
timeout
|
|
454
534
|
};
|
|
455
535
|
}
|
|
456
536
|
function buildHookCmdShellMatcher(bundleFile, timeout) {
|
|
457
537
|
return {
|
|
458
538
|
type: "command",
|
|
459
|
-
command: `node "${
|
|
539
|
+
command: `node "${join6(PLUGIN_DIR3, "bundle", bundleFile)}"`,
|
|
460
540
|
timeout,
|
|
461
541
|
matcher: "Shell"
|
|
462
542
|
};
|
|
@@ -512,12 +592,12 @@ function stripHooksFromConfig(existing) {
|
|
|
512
592
|
return existing;
|
|
513
593
|
}
|
|
514
594
|
function installCursor() {
|
|
515
|
-
const srcBundle =
|
|
516
|
-
if (!
|
|
595
|
+
const srcBundle = join6(pkgRoot(), "cursor", "bundle");
|
|
596
|
+
if (!existsSync5(srcBundle)) {
|
|
517
597
|
throw new Error(`Cursor bundle missing at ${srcBundle}. Run 'npm run build' first.`);
|
|
518
598
|
}
|
|
519
599
|
ensureDir(PLUGIN_DIR3);
|
|
520
|
-
copyDir(srcBundle,
|
|
600
|
+
copyDir(srcBundle, join6(PLUGIN_DIR3, "bundle"));
|
|
521
601
|
const existing = readJson(HOOKS_PATH2);
|
|
522
602
|
const merged = mergeHooks2(existing);
|
|
523
603
|
writeJson(HOOKS_PATH2, merged);
|
|
@@ -533,7 +613,7 @@ function uninstallCursor() {
|
|
|
533
613
|
const stripped = stripHooksFromConfig(existing);
|
|
534
614
|
const meaningfulKeys = stripped ? Object.keys(stripped).filter((k) => k !== "version").length : 0;
|
|
535
615
|
if (!stripped || meaningfulKeys === 0) {
|
|
536
|
-
if (
|
|
616
|
+
if (existsSync5(HOOKS_PATH2))
|
|
537
617
|
unlinkSync3(HOOKS_PATH2);
|
|
538
618
|
} else {
|
|
539
619
|
writeJson(HOOKS_PATH2, stripped);
|
|
@@ -542,8 +622,8 @@ function uninstallCursor() {
|
|
|
542
622
|
}
|
|
543
623
|
|
|
544
624
|
// dist/src/cli/install-hermes.js
|
|
545
|
-
import { existsSync as
|
|
546
|
-
import { join as
|
|
625
|
+
import { existsSync as existsSync7, writeFileSync as writeFileSync3, readFileSync as readFileSync5, rmSync as rmSync2, unlinkSync as unlinkSync4 } from "node:fs";
|
|
626
|
+
import { join as join8 } from "node:path";
|
|
547
627
|
|
|
548
628
|
// node_modules/js-yaml/dist/js-yaml.mjs
|
|
549
629
|
function isNothing(subject) {
|
|
@@ -3132,15 +3212,15 @@ var safeLoadAll = renamed("safeLoadAll", "loadAll");
|
|
|
3132
3212
|
var safeDump = renamed("safeDump", "dump");
|
|
3133
3213
|
|
|
3134
3214
|
// dist/src/cli/install-mcp-shared.js
|
|
3135
|
-
import { existsSync as
|
|
3136
|
-
import { join as
|
|
3137
|
-
var HIVEMIND_DIR =
|
|
3138
|
-
var MCP_DIR =
|
|
3139
|
-
var MCP_SERVER_PATH =
|
|
3140
|
-
var MCP_PACKAGE_JSON =
|
|
3215
|
+
import { existsSync as existsSync6 } from "node:fs";
|
|
3216
|
+
import { join as join7 } from "node:path";
|
|
3217
|
+
var HIVEMIND_DIR = join7(HOME, ".hivemind");
|
|
3218
|
+
var MCP_DIR = join7(HIVEMIND_DIR, "mcp");
|
|
3219
|
+
var MCP_SERVER_PATH = join7(MCP_DIR, "server.js");
|
|
3220
|
+
var MCP_PACKAGE_JSON = join7(MCP_DIR, "package.json");
|
|
3141
3221
|
function ensureMcpServerInstalled() {
|
|
3142
|
-
const srcDir =
|
|
3143
|
-
if (!
|
|
3222
|
+
const srcDir = join7(pkgRoot(), "mcp", "bundle");
|
|
3223
|
+
if (!existsSync6(srcDir)) {
|
|
3144
3224
|
throw new Error(`MCP server bundle missing at ${srcDir}. Run 'npm run build' to produce it before installing Tier B consumers.`);
|
|
3145
3225
|
}
|
|
3146
3226
|
ensureDir(MCP_DIR);
|
|
@@ -3150,11 +3230,11 @@ function ensureMcpServerInstalled() {
|
|
|
3150
3230
|
}
|
|
3151
3231
|
|
|
3152
3232
|
// dist/src/cli/install-hermes.js
|
|
3153
|
-
var HERMES_HOME =
|
|
3154
|
-
var SKILLS_DIR =
|
|
3155
|
-
var HIVEMIND_DIR2 =
|
|
3156
|
-
var BUNDLE_DIR =
|
|
3157
|
-
var CONFIG_PATH =
|
|
3233
|
+
var HERMES_HOME = join8(HOME, ".hermes");
|
|
3234
|
+
var SKILLS_DIR = join8(HERMES_HOME, "skills", "hivemind-memory");
|
|
3235
|
+
var HIVEMIND_DIR2 = join8(HERMES_HOME, "hivemind");
|
|
3236
|
+
var BUNDLE_DIR = join8(HIVEMIND_DIR2, "bundle");
|
|
3237
|
+
var CONFIG_PATH = join8(HERMES_HOME, "config.yaml");
|
|
3158
3238
|
var SERVER_KEY = "hivemind";
|
|
3159
3239
|
var SKILL_BODY = `---
|
|
3160
3240
|
name: hivemind-memory
|
|
@@ -3212,7 +3292,7 @@ function isHivemindHook(entry) {
|
|
|
3212
3292
|
}
|
|
3213
3293
|
function buildHookEntry(bundleFile, timeout, matcher) {
|
|
3214
3294
|
const entry = {
|
|
3215
|
-
command: `node ${
|
|
3295
|
+
command: `node ${join8(BUNDLE_DIR, bundleFile)}`,
|
|
3216
3296
|
timeout
|
|
3217
3297
|
};
|
|
3218
3298
|
if (matcher)
|
|
@@ -3256,10 +3336,10 @@ function stripHivemindHooks(existing) {
|
|
|
3256
3336
|
return Object.keys(out).length > 0 ? out : void 0;
|
|
3257
3337
|
}
|
|
3258
3338
|
function readConfig() {
|
|
3259
|
-
if (!
|
|
3339
|
+
if (!existsSync7(CONFIG_PATH))
|
|
3260
3340
|
return {};
|
|
3261
3341
|
try {
|
|
3262
|
-
const raw =
|
|
3342
|
+
const raw = readFileSync5(CONFIG_PATH, "utf-8");
|
|
3263
3343
|
const parsed = load(raw);
|
|
3264
3344
|
if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) {
|
|
3265
3345
|
return parsed;
|
|
@@ -3272,15 +3352,15 @@ function readConfig() {
|
|
|
3272
3352
|
function writeConfig(cfg) {
|
|
3273
3353
|
ensureDir(HERMES_HOME);
|
|
3274
3354
|
const dumped = dump(cfg, { lineWidth: 100, noRefs: true });
|
|
3275
|
-
|
|
3355
|
+
writeFileSync3(CONFIG_PATH, dumped);
|
|
3276
3356
|
}
|
|
3277
3357
|
function installHermes() {
|
|
3278
3358
|
ensureDir(SKILLS_DIR);
|
|
3279
|
-
|
|
3359
|
+
writeFileSync3(join8(SKILLS_DIR, "SKILL.md"), SKILL_BODY);
|
|
3280
3360
|
writeVersionStamp(SKILLS_DIR, getVersion());
|
|
3281
3361
|
log(` Hermes skill installed -> ${SKILLS_DIR}`);
|
|
3282
|
-
const srcBundle =
|
|
3283
|
-
if (!
|
|
3362
|
+
const srcBundle = join8(pkgRoot(), "hermes", "bundle");
|
|
3363
|
+
if (!existsSync7(srcBundle)) {
|
|
3284
3364
|
throw new Error(`Hermes bundle missing at ${srcBundle}. Run 'npm run build' first.`);
|
|
3285
3365
|
}
|
|
3286
3366
|
ensureDir(HIVEMIND_DIR2);
|
|
@@ -3301,15 +3381,15 @@ function installHermes() {
|
|
|
3301
3381
|
log(` Hermes config updated -> ${CONFIG_PATH} (mcp_servers + hooks + hooks_auto_accept)`);
|
|
3302
3382
|
}
|
|
3303
3383
|
function uninstallHermes() {
|
|
3304
|
-
if (
|
|
3384
|
+
if (existsSync7(SKILLS_DIR)) {
|
|
3305
3385
|
rmSync2(SKILLS_DIR, { recursive: true, force: true });
|
|
3306
3386
|
log(` Hermes removed ${SKILLS_DIR}`);
|
|
3307
3387
|
}
|
|
3308
|
-
if (
|
|
3388
|
+
if (existsSync7(HIVEMIND_DIR2)) {
|
|
3309
3389
|
rmSync2(HIVEMIND_DIR2, { recursive: true, force: true });
|
|
3310
3390
|
log(` Hermes removed ${HIVEMIND_DIR2}`);
|
|
3311
3391
|
}
|
|
3312
|
-
if (
|
|
3392
|
+
if (existsSync7(CONFIG_PATH)) {
|
|
3313
3393
|
const cfg = readConfig();
|
|
3314
3394
|
let touched = false;
|
|
3315
3395
|
if (cfg.mcp_servers && typeof cfg.mcp_servers === "object" && SERVER_KEY in cfg.mcp_servers) {
|
|
@@ -3342,18 +3422,18 @@ function uninstallHermes() {
|
|
|
3342
3422
|
}
|
|
3343
3423
|
|
|
3344
3424
|
// dist/src/cli/install-pi.js
|
|
3345
|
-
import { existsSync as
|
|
3346
|
-
import { join as
|
|
3347
|
-
var PI_AGENT_DIR =
|
|
3348
|
-
var AGENTS_MD =
|
|
3349
|
-
var LEGACY_SKILL_DIR =
|
|
3350
|
-
var EXTENSIONS_DIR =
|
|
3351
|
-
var EXTENSION_PATH =
|
|
3352
|
-
var VERSION_DIR =
|
|
3353
|
-
var WIKI_WORKER_DIR =
|
|
3354
|
-
var WIKI_WORKER_PATH =
|
|
3355
|
-
var SKILLIFY_WORKER_PATH =
|
|
3356
|
-
var AUTOPULL_WORKER_PATH =
|
|
3425
|
+
import { existsSync as existsSync8, writeFileSync as writeFileSync4, rmSync as rmSync3, readFileSync as readFileSync6, copyFileSync as copyFileSync2 } from "node:fs";
|
|
3426
|
+
import { join as join9 } from "node:path";
|
|
3427
|
+
var PI_AGENT_DIR = join9(HOME, ".pi", "agent");
|
|
3428
|
+
var AGENTS_MD = join9(PI_AGENT_DIR, "AGENTS.md");
|
|
3429
|
+
var LEGACY_SKILL_DIR = join9(PI_AGENT_DIR, "skills", "hivemind-memory");
|
|
3430
|
+
var EXTENSIONS_DIR = join9(PI_AGENT_DIR, "extensions");
|
|
3431
|
+
var EXTENSION_PATH = join9(EXTENSIONS_DIR, "hivemind.ts");
|
|
3432
|
+
var VERSION_DIR = join9(PI_AGENT_DIR, ".hivemind");
|
|
3433
|
+
var WIKI_WORKER_DIR = join9(PI_AGENT_DIR, "hivemind");
|
|
3434
|
+
var WIKI_WORKER_PATH = join9(WIKI_WORKER_DIR, "wiki-worker.js");
|
|
3435
|
+
var SKILLIFY_WORKER_PATH = join9(WIKI_WORKER_DIR, "skillify-worker.js");
|
|
3436
|
+
var AUTOPULL_WORKER_PATH = join9(WIKI_WORKER_DIR, "autopull-worker.js");
|
|
3357
3437
|
var HIVEMIND_BLOCK_START = "<!-- BEGIN hivemind-memory -->";
|
|
3358
3438
|
var HIVEMIND_BLOCK_END = "<!-- END hivemind-memory -->";
|
|
3359
3439
|
var HIVEMIND_BLOCK_BODY = `${HIVEMIND_BLOCK_START}
|
|
@@ -3421,30 +3501,30 @@ ${after}`;
|
|
|
3421
3501
|
}
|
|
3422
3502
|
function installPi() {
|
|
3423
3503
|
ensureDir(PI_AGENT_DIR);
|
|
3424
|
-
if (
|
|
3504
|
+
if (existsSync8(LEGACY_SKILL_DIR)) {
|
|
3425
3505
|
rmSync3(LEGACY_SKILL_DIR, { recursive: true, force: true });
|
|
3426
3506
|
}
|
|
3427
|
-
const prior =
|
|
3507
|
+
const prior = existsSync8(AGENTS_MD) ? readFileSync6(AGENTS_MD, "utf-8") : null;
|
|
3428
3508
|
const next = upsertHivemindBlock(prior);
|
|
3429
|
-
|
|
3430
|
-
const srcExtension =
|
|
3431
|
-
if (!
|
|
3509
|
+
writeFileSync4(AGENTS_MD, next);
|
|
3510
|
+
const srcExtension = join9(pkgRoot(), "pi", "extension-source", "hivemind.ts");
|
|
3511
|
+
if (!existsSync8(srcExtension)) {
|
|
3432
3512
|
throw new Error(`pi extension source missing at ${srcExtension}. Reinstall the @deeplake/hivemind package.`);
|
|
3433
3513
|
}
|
|
3434
3514
|
ensureDir(EXTENSIONS_DIR);
|
|
3435
3515
|
copyFileSync2(srcExtension, EXTENSION_PATH);
|
|
3436
|
-
const srcWorker =
|
|
3437
|
-
if (
|
|
3516
|
+
const srcWorker = join9(pkgRoot(), "pi", "bundle", "wiki-worker.js");
|
|
3517
|
+
if (existsSync8(srcWorker)) {
|
|
3438
3518
|
ensureDir(WIKI_WORKER_DIR);
|
|
3439
3519
|
copyFileSync2(srcWorker, WIKI_WORKER_PATH);
|
|
3440
3520
|
}
|
|
3441
|
-
const srcSkillifyWorker =
|
|
3442
|
-
if (
|
|
3521
|
+
const srcSkillifyWorker = join9(pkgRoot(), "pi", "bundle", "skillify-worker.js");
|
|
3522
|
+
if (existsSync8(srcSkillifyWorker)) {
|
|
3443
3523
|
ensureDir(WIKI_WORKER_DIR);
|
|
3444
3524
|
copyFileSync2(srcSkillifyWorker, SKILLIFY_WORKER_PATH);
|
|
3445
3525
|
}
|
|
3446
|
-
const srcAutopullWorker =
|
|
3447
|
-
if (
|
|
3526
|
+
const srcAutopullWorker = join9(pkgRoot(), "pi", "bundle", "autopull-worker.js");
|
|
3527
|
+
if (existsSync8(srcAutopullWorker)) {
|
|
3448
3528
|
ensureDir(WIKI_WORKER_DIR);
|
|
3449
3529
|
copyFileSync2(srcAutopullWorker, AUTOPULL_WORKER_PATH);
|
|
3450
3530
|
}
|
|
@@ -3452,82 +3532,82 @@ function installPi() {
|
|
|
3452
3532
|
writeVersionStamp(VERSION_DIR, getVersion());
|
|
3453
3533
|
log(` pi AGENTS.md updated -> ${AGENTS_MD}`);
|
|
3454
3534
|
log(` pi extension installed -> ${EXTENSION_PATH}`);
|
|
3455
|
-
if (
|
|
3535
|
+
if (existsSync8(WIKI_WORKER_PATH)) {
|
|
3456
3536
|
log(` pi wiki-worker installed -> ${WIKI_WORKER_PATH}`);
|
|
3457
3537
|
}
|
|
3458
|
-
if (
|
|
3538
|
+
if (existsSync8(SKILLIFY_WORKER_PATH)) {
|
|
3459
3539
|
log(` pi skillify-worker installed -> ${SKILLIFY_WORKER_PATH}`);
|
|
3460
3540
|
}
|
|
3461
|
-
if (
|
|
3541
|
+
if (existsSync8(AUTOPULL_WORKER_PATH)) {
|
|
3462
3542
|
log(` pi autopull-worker installed -> ${AUTOPULL_WORKER_PATH}`);
|
|
3463
3543
|
}
|
|
3464
3544
|
}
|
|
3465
3545
|
function uninstallPi() {
|
|
3466
|
-
if (
|
|
3546
|
+
if (existsSync8(LEGACY_SKILL_DIR)) {
|
|
3467
3547
|
rmSync3(LEGACY_SKILL_DIR, { recursive: true, force: true });
|
|
3468
3548
|
log(` pi removed ${LEGACY_SKILL_DIR}`);
|
|
3469
3549
|
}
|
|
3470
|
-
if (
|
|
3550
|
+
if (existsSync8(EXTENSION_PATH)) {
|
|
3471
3551
|
rmSync3(EXTENSION_PATH, { force: true });
|
|
3472
3552
|
log(` pi removed extension ${EXTENSION_PATH}`);
|
|
3473
3553
|
}
|
|
3474
|
-
if (
|
|
3554
|
+
if (existsSync8(WIKI_WORKER_DIR)) {
|
|
3475
3555
|
rmSync3(WIKI_WORKER_DIR, { recursive: true, force: true });
|
|
3476
3556
|
log(` pi removed wiki-worker dir ${WIKI_WORKER_DIR}`);
|
|
3477
3557
|
}
|
|
3478
|
-
if (
|
|
3479
|
-
const prior =
|
|
3558
|
+
if (existsSync8(AGENTS_MD)) {
|
|
3559
|
+
const prior = readFileSync6(AGENTS_MD, "utf-8");
|
|
3480
3560
|
const stripped = stripHivemindBlock(prior);
|
|
3481
3561
|
if (stripped.trim().length === 0) {
|
|
3482
3562
|
rmSync3(AGENTS_MD, { force: true });
|
|
3483
3563
|
log(` pi removed empty ${AGENTS_MD}`);
|
|
3484
3564
|
} else {
|
|
3485
|
-
|
|
3565
|
+
writeFileSync4(AGENTS_MD, stripped);
|
|
3486
3566
|
log(` pi stripped hivemind block from ${AGENTS_MD}`);
|
|
3487
3567
|
}
|
|
3488
3568
|
}
|
|
3489
|
-
if (
|
|
3569
|
+
if (existsSync8(VERSION_DIR)) {
|
|
3490
3570
|
rmSync3(VERSION_DIR, { recursive: true, force: true });
|
|
3491
3571
|
}
|
|
3492
3572
|
}
|
|
3493
3573
|
|
|
3494
3574
|
// dist/src/cli/embeddings.js
|
|
3495
|
-
import { copyFileSync as copyFileSync3, chmodSync, existsSync as
|
|
3575
|
+
import { copyFileSync as copyFileSync3, chmodSync, existsSync as existsSync9, lstatSync as lstatSync2, readdirSync, readlinkSync, rmSync as rmSync4, statSync, unlinkSync as unlinkSync5 } from "node:fs";
|
|
3496
3576
|
import { execFileSync as execFileSync3 } from "node:child_process";
|
|
3497
|
-
import { join as
|
|
3498
|
-
var SHARED_DIR =
|
|
3499
|
-
var SHARED_NODE_MODULES =
|
|
3500
|
-
var SHARED_DAEMON_PATH =
|
|
3577
|
+
import { join as join10 } from "node:path";
|
|
3578
|
+
var SHARED_DIR = join10(HOME, ".hivemind", "embed-deps");
|
|
3579
|
+
var SHARED_NODE_MODULES = join10(SHARED_DIR, "node_modules");
|
|
3580
|
+
var SHARED_DAEMON_PATH = join10(SHARED_DIR, "embed-daemon.js");
|
|
3501
3581
|
var TRANSFORMERS_PKG = "@huggingface/transformers";
|
|
3502
3582
|
var TRANSFORMERS_RANGE = "^3.0.0";
|
|
3503
3583
|
function findHivemindInstalls(home = HOME) {
|
|
3504
3584
|
const out = [];
|
|
3505
3585
|
const fixed = [
|
|
3506
|
-
{ id: "codex", pluginDir:
|
|
3507
|
-
{ id: "cursor", pluginDir:
|
|
3508
|
-
{ id: "hermes", pluginDir:
|
|
3586
|
+
{ id: "codex", pluginDir: join10(home, ".codex", "hivemind") },
|
|
3587
|
+
{ id: "cursor", pluginDir: join10(home, ".cursor", "hivemind") },
|
|
3588
|
+
{ id: "hermes", pluginDir: join10(home, ".hermes", "hivemind") }
|
|
3509
3589
|
];
|
|
3510
3590
|
for (const inst of fixed) {
|
|
3511
|
-
if (
|
|
3591
|
+
if (existsSync9(join10(inst.pluginDir, "bundle")))
|
|
3512
3592
|
out.push(inst);
|
|
3513
3593
|
}
|
|
3514
|
-
const ccCache =
|
|
3515
|
-
if (
|
|
3594
|
+
const ccCache = join10(home, ".claude", "plugins", "cache", "hivemind", "hivemind");
|
|
3595
|
+
if (existsSync9(ccCache)) {
|
|
3516
3596
|
let entries = [];
|
|
3517
3597
|
try {
|
|
3518
3598
|
entries = readdirSync(ccCache);
|
|
3519
3599
|
} catch {
|
|
3520
3600
|
}
|
|
3521
3601
|
for (const ver of entries) {
|
|
3522
|
-
const dir =
|
|
3602
|
+
const dir = join10(ccCache, ver);
|
|
3523
3603
|
try {
|
|
3524
3604
|
if (!statSync(dir).isDirectory())
|
|
3525
3605
|
continue;
|
|
3526
3606
|
} catch {
|
|
3527
3607
|
continue;
|
|
3528
3608
|
}
|
|
3529
|
-
const candidates = [
|
|
3530
|
-
if (candidates.some((p) =>
|
|
3609
|
+
const candidates = [join10(dir, "bundle"), join10(dir, "claude-code", "bundle")];
|
|
3610
|
+
if (candidates.some((p) => existsSync9(p))) {
|
|
3531
3611
|
out.push({ id: `claude (${ver})`, pluginDir: dir });
|
|
3532
3612
|
}
|
|
3533
3613
|
}
|
|
@@ -3535,10 +3615,10 @@ function findHivemindInstalls(home = HOME) {
|
|
|
3535
3615
|
return out;
|
|
3536
3616
|
}
|
|
3537
3617
|
function isSharedDepsInstalled(sharedNodeModules = SHARED_NODE_MODULES) {
|
|
3538
|
-
return
|
|
3618
|
+
return existsSync9(join10(sharedNodeModules, TRANSFORMERS_PKG));
|
|
3539
3619
|
}
|
|
3540
3620
|
function isSymlinkToSharedDeps(linkPath, sharedNodeModules) {
|
|
3541
|
-
if (!
|
|
3621
|
+
if (!existsSync9(linkPath))
|
|
3542
3622
|
return false;
|
|
3543
3623
|
try {
|
|
3544
3624
|
if (!lstatSync2(linkPath).isSymbolicLink())
|
|
@@ -3549,8 +3629,8 @@ function isSymlinkToSharedDeps(linkPath, sharedNodeModules) {
|
|
|
3549
3629
|
}
|
|
3550
3630
|
}
|
|
3551
3631
|
function linkStateFor(install, sharedNodeModules = SHARED_NODE_MODULES) {
|
|
3552
|
-
const link =
|
|
3553
|
-
if (!
|
|
3632
|
+
const link = join10(install.pluginDir, "node_modules");
|
|
3633
|
+
if (!existsSync9(link) && !isSymbolicLink(link))
|
|
3554
3634
|
return { kind: "no-node-modules" };
|
|
3555
3635
|
try {
|
|
3556
3636
|
if (lstatSync2(link).isSymbolicLink()) {
|
|
@@ -3574,7 +3654,7 @@ function ensureSharedDeps() {
|
|
|
3574
3654
|
log(` Embeddings installing ${TRANSFORMERS_PKG}@${TRANSFORMERS_RANGE} into ${SHARED_DIR}`);
|
|
3575
3655
|
log(` (~600 MB; first install only \u2014 every agent will share this)`);
|
|
3576
3656
|
ensureDir(SHARED_DIR);
|
|
3577
|
-
writeJson(
|
|
3657
|
+
writeJson(join10(SHARED_DIR, "package.json"), {
|
|
3578
3658
|
name: "hivemind-embed-deps",
|
|
3579
3659
|
version: "1.0.0",
|
|
3580
3660
|
private: true,
|
|
@@ -3588,8 +3668,8 @@ function ensureSharedDeps() {
|
|
|
3588
3668
|
log(` Embeddings shared deps already present at ${SHARED_DIR}`);
|
|
3589
3669
|
}
|
|
3590
3670
|
ensureDir(SHARED_DIR);
|
|
3591
|
-
const src =
|
|
3592
|
-
if (
|
|
3671
|
+
const src = join10(pkgRoot(), "embeddings", "embed-daemon.js");
|
|
3672
|
+
if (existsSync9(src)) {
|
|
3593
3673
|
copyFileSync3(src, SHARED_DAEMON_PATH);
|
|
3594
3674
|
chmodSync(SHARED_DAEMON_PATH, 493);
|
|
3595
3675
|
} else {
|
|
@@ -3597,7 +3677,7 @@ function ensureSharedDeps() {
|
|
|
3597
3677
|
}
|
|
3598
3678
|
}
|
|
3599
3679
|
function linkAgent(install) {
|
|
3600
|
-
const link =
|
|
3680
|
+
const link = join10(install.pluginDir, "node_modules");
|
|
3601
3681
|
symlinkForce(SHARED_NODE_MODULES, link);
|
|
3602
3682
|
log(` Embeddings linked ${install.id.padEnd(20)} -> shared deps`);
|
|
3603
3683
|
}
|
|
@@ -3616,13 +3696,13 @@ function enableEmbeddings() {
|
|
|
3616
3696
|
function disableEmbeddings(opts) {
|
|
3617
3697
|
const installs = findHivemindInstalls();
|
|
3618
3698
|
for (const inst of installs) {
|
|
3619
|
-
const link =
|
|
3699
|
+
const link = join10(inst.pluginDir, "node_modules");
|
|
3620
3700
|
if (isSymlinkToSharedDeps(link, SHARED_NODE_MODULES)) {
|
|
3621
3701
|
unlinkSync5(link);
|
|
3622
3702
|
log(` Embeddings unlinked ${inst.id}`);
|
|
3623
3703
|
}
|
|
3624
3704
|
}
|
|
3625
|
-
if (opts?.prune &&
|
|
3705
|
+
if (opts?.prune && existsSync9(SHARED_DIR)) {
|
|
3626
3706
|
rmSync4(SHARED_DIR, { recursive: true, force: true });
|
|
3627
3707
|
log(` Embeddings pruned ${SHARED_DIR}`);
|
|
3628
3708
|
}
|
|
@@ -3630,7 +3710,7 @@ function disableEmbeddings(opts) {
|
|
|
3630
3710
|
function statusEmbeddings() {
|
|
3631
3711
|
log(`Shared deps: ${SHARED_DIR}`);
|
|
3632
3712
|
log(`Installed: ${isSharedDepsInstalled() ? "yes" : "no"}`);
|
|
3633
|
-
log(`Daemon: ${
|
|
3713
|
+
log(`Daemon: ${existsSync9(SHARED_DAEMON_PATH) ? SHARED_DAEMON_PATH : "(not present)"}`);
|
|
3634
3714
|
log("");
|
|
3635
3715
|
log(`Agent installs:`);
|
|
3636
3716
|
const installs = findHivemindInstalls();
|
|
@@ -3661,8 +3741,8 @@ function statusEmbeddings() {
|
|
|
3661
3741
|
}
|
|
3662
3742
|
|
|
3663
3743
|
// dist/src/cli/auth.js
|
|
3664
|
-
import { existsSync as
|
|
3665
|
-
import { join as
|
|
3744
|
+
import { existsSync as existsSync10 } from "node:fs";
|
|
3745
|
+
import { join as join12 } from "node:path";
|
|
3666
3746
|
|
|
3667
3747
|
// dist/src/commands/auth.js
|
|
3668
3748
|
import { execSync } from "node:child_process";
|
|
@@ -3677,25 +3757,25 @@ function deeplakeClientHeader() {
|
|
|
3677
3757
|
}
|
|
3678
3758
|
|
|
3679
3759
|
// dist/src/commands/auth-creds.js
|
|
3680
|
-
import { readFileSync as
|
|
3681
|
-
import { join as
|
|
3682
|
-
import { homedir as
|
|
3760
|
+
import { readFileSync as readFileSync7, writeFileSync as writeFileSync5, mkdirSync as mkdirSync2, unlinkSync as unlinkSync6 } from "node:fs";
|
|
3761
|
+
import { join as join11 } from "node:path";
|
|
3762
|
+
import { homedir as homedir3 } from "node:os";
|
|
3683
3763
|
function configDir() {
|
|
3684
|
-
return
|
|
3764
|
+
return join11(homedir3(), ".deeplake");
|
|
3685
3765
|
}
|
|
3686
3766
|
function credsPath() {
|
|
3687
|
-
return
|
|
3767
|
+
return join11(configDir(), "credentials.json");
|
|
3688
3768
|
}
|
|
3689
3769
|
function loadCredentials() {
|
|
3690
3770
|
try {
|
|
3691
|
-
return JSON.parse(
|
|
3771
|
+
return JSON.parse(readFileSync7(credsPath(), "utf-8"));
|
|
3692
3772
|
} catch {
|
|
3693
3773
|
return null;
|
|
3694
3774
|
}
|
|
3695
3775
|
}
|
|
3696
3776
|
function saveCredentials(creds) {
|
|
3697
3777
|
mkdirSync2(configDir(), { recursive: true, mode: 448 });
|
|
3698
|
-
|
|
3778
|
+
writeFileSync5(credsPath(), JSON.stringify({ ...creds, savedAt: (/* @__PURE__ */ new Date()).toISOString() }, null, 2), { mode: 384 });
|
|
3699
3779
|
}
|
|
3700
3780
|
function deleteCredentials() {
|
|
3701
3781
|
try {
|
|
@@ -3884,9 +3964,9 @@ Using: ${orgName}
|
|
|
3884
3964
|
}
|
|
3885
3965
|
|
|
3886
3966
|
// dist/src/cli/auth.js
|
|
3887
|
-
var CREDS_PATH =
|
|
3967
|
+
var CREDS_PATH = join12(HOME, ".deeplake", "credentials.json");
|
|
3888
3968
|
function isLoggedIn() {
|
|
3889
|
-
return
|
|
3969
|
+
return existsSync10(CREDS_PATH) && loadCredentials() !== null;
|
|
3890
3970
|
}
|
|
3891
3971
|
async function ensureLoggedIn() {
|
|
3892
3972
|
if (isLoggedIn())
|
|
@@ -3919,16 +3999,16 @@ async function maybeShowOrgChoice() {
|
|
|
3919
3999
|
}
|
|
3920
4000
|
|
|
3921
4001
|
// dist/src/config.js
|
|
3922
|
-
import { readFileSync as
|
|
3923
|
-
import { join as
|
|
3924
|
-
import { homedir as
|
|
4002
|
+
import { readFileSync as readFileSync8, existsSync as existsSync11 } from "node:fs";
|
|
4003
|
+
import { join as join13 } from "node:path";
|
|
4004
|
+
import { homedir as homedir4, userInfo } from "node:os";
|
|
3925
4005
|
function loadConfig() {
|
|
3926
|
-
const home =
|
|
3927
|
-
const credPath =
|
|
4006
|
+
const home = homedir4();
|
|
4007
|
+
const credPath = join13(home, ".deeplake", "credentials.json");
|
|
3928
4008
|
let creds = null;
|
|
3929
|
-
if (
|
|
4009
|
+
if (existsSync11(credPath)) {
|
|
3930
4010
|
try {
|
|
3931
|
-
creds = JSON.parse(
|
|
4011
|
+
creds = JSON.parse(readFileSync8(credPath, "utf-8"));
|
|
3932
4012
|
} catch {
|
|
3933
4013
|
return null;
|
|
3934
4014
|
}
|
|
@@ -3947,7 +4027,7 @@ function loadConfig() {
|
|
|
3947
4027
|
tableName: process.env.HIVEMIND_TABLE ?? "memory",
|
|
3948
4028
|
sessionsTableName: process.env.HIVEMIND_SESSIONS_TABLE ?? "sessions",
|
|
3949
4029
|
skillsTableName: process.env.HIVEMIND_SKILLS_TABLE ?? "skills",
|
|
3950
|
-
memoryPath: process.env.HIVEMIND_MEMORY_PATH ??
|
|
4030
|
+
memoryPath: process.env.HIVEMIND_MEMORY_PATH ?? join13(home, ".deeplake", "memory")
|
|
3951
4031
|
};
|
|
3952
4032
|
}
|
|
3953
4033
|
|
|
@@ -3956,10 +4036,10 @@ import { randomUUID } from "node:crypto";
|
|
|
3956
4036
|
|
|
3957
4037
|
// dist/src/utils/debug.js
|
|
3958
4038
|
import { appendFileSync } from "node:fs";
|
|
3959
|
-
import { join as
|
|
3960
|
-
import { homedir as
|
|
4039
|
+
import { join as join14 } from "node:path";
|
|
4040
|
+
import { homedir as homedir5 } from "node:os";
|
|
3961
4041
|
var DEBUG = process.env.HIVEMIND_DEBUG === "1";
|
|
3962
|
-
var LOG =
|
|
4042
|
+
var LOG = join14(homedir5(), ".deeplake", "hook-debug.log");
|
|
3963
4043
|
function log2(tag, msg) {
|
|
3964
4044
|
if (!DEBUG)
|
|
3965
4045
|
return;
|
|
@@ -4721,31 +4801,31 @@ if (process.argv[1] && process.argv[1].endsWith("auth-login.js")) {
|
|
|
4721
4801
|
}
|
|
4722
4802
|
|
|
4723
4803
|
// dist/src/commands/skillify.js
|
|
4724
|
-
import { readdirSync as readdirSync4, existsSync as
|
|
4725
|
-
import { homedir as
|
|
4726
|
-
import { dirname as dirname4, join as
|
|
4804
|
+
import { readdirSync as readdirSync4, existsSync as existsSync20, readFileSync as readFileSync14, mkdirSync as mkdirSync8, renameSync as renameSync4 } from "node:fs";
|
|
4805
|
+
import { homedir as homedir13 } from "node:os";
|
|
4806
|
+
import { dirname as dirname4, join as join23 } from "node:path";
|
|
4727
4807
|
|
|
4728
4808
|
// dist/src/skillify/scope-config.js
|
|
4729
|
-
import { existsSync as
|
|
4730
|
-
import { homedir as
|
|
4731
|
-
import { join as
|
|
4809
|
+
import { existsSync as existsSync14, mkdirSync as mkdirSync4, readFileSync as readFileSync10, writeFileSync as writeFileSync7 } from "node:fs";
|
|
4810
|
+
import { homedir as homedir7 } from "node:os";
|
|
4811
|
+
import { join as join17 } from "node:path";
|
|
4732
4812
|
|
|
4733
4813
|
// dist/src/skillify/legacy-migration.js
|
|
4734
|
-
import { existsSync as
|
|
4735
|
-
import { homedir as
|
|
4736
|
-
import { join as
|
|
4814
|
+
import { existsSync as existsSync13, renameSync } from "node:fs";
|
|
4815
|
+
import { homedir as homedir6 } from "node:os";
|
|
4816
|
+
import { join as join16 } from "node:path";
|
|
4737
4817
|
var dlog = (msg) => log2("skillify-migrate", msg);
|
|
4738
4818
|
var attempted = false;
|
|
4739
4819
|
function migrateLegacyStateDir() {
|
|
4740
4820
|
if (attempted)
|
|
4741
4821
|
return;
|
|
4742
4822
|
attempted = true;
|
|
4743
|
-
const root =
|
|
4744
|
-
const legacy =
|
|
4745
|
-
const current =
|
|
4746
|
-
if (!
|
|
4823
|
+
const root = join16(homedir6(), ".deeplake", "state");
|
|
4824
|
+
const legacy = join16(root, "skilify");
|
|
4825
|
+
const current = join16(root, "skillify");
|
|
4826
|
+
if (!existsSync13(legacy))
|
|
4747
4827
|
return;
|
|
4748
|
-
if (
|
|
4828
|
+
if (existsSync13(current))
|
|
4749
4829
|
return;
|
|
4750
4830
|
try {
|
|
4751
4831
|
renameSync(legacy, current);
|
|
@@ -4761,15 +4841,15 @@ function migrateLegacyStateDir() {
|
|
|
4761
4841
|
}
|
|
4762
4842
|
|
|
4763
4843
|
// dist/src/skillify/scope-config.js
|
|
4764
|
-
var STATE_DIR =
|
|
4765
|
-
var CONFIG_PATH2 =
|
|
4844
|
+
var STATE_DIR = join17(homedir7(), ".deeplake", "state", "skillify");
|
|
4845
|
+
var CONFIG_PATH2 = join17(STATE_DIR, "config.json");
|
|
4766
4846
|
var DEFAULT = { scope: "me", team: [], install: "project" };
|
|
4767
4847
|
function loadScopeConfig() {
|
|
4768
4848
|
migrateLegacyStateDir();
|
|
4769
|
-
if (!
|
|
4849
|
+
if (!existsSync14(CONFIG_PATH2))
|
|
4770
4850
|
return DEFAULT;
|
|
4771
4851
|
try {
|
|
4772
|
-
const raw = JSON.parse(
|
|
4852
|
+
const raw = JSON.parse(readFileSync10(CONFIG_PATH2, "utf-8"));
|
|
4773
4853
|
const scope = raw.scope === "team" ? "team" : raw.scope === "org" ? "team" : "me";
|
|
4774
4854
|
const team = Array.isArray(raw.team) ? raw.team.filter((s) => typeof s === "string") : [];
|
|
4775
4855
|
const install = raw.install === "global" ? "global" : "project";
|
|
@@ -4781,18 +4861,18 @@ function loadScopeConfig() {
|
|
|
4781
4861
|
function saveScopeConfig(cfg) {
|
|
4782
4862
|
migrateLegacyStateDir();
|
|
4783
4863
|
mkdirSync4(STATE_DIR, { recursive: true });
|
|
4784
|
-
|
|
4864
|
+
writeFileSync7(CONFIG_PATH2, JSON.stringify(cfg, null, 2));
|
|
4785
4865
|
}
|
|
4786
4866
|
|
|
4787
4867
|
// dist/src/skillify/pull.js
|
|
4788
|
-
import { existsSync as
|
|
4789
|
-
import { homedir as
|
|
4790
|
-
import { dirname as dirname3, join as
|
|
4868
|
+
import { existsSync as existsSync18, readFileSync as readFileSync13, writeFileSync as writeFileSync10, mkdirSync as mkdirSync7, renameSync as renameSync3, lstatSync as lstatSync4, readlinkSync as readlinkSync2, symlinkSync as symlinkSync2, unlinkSync as unlinkSync8 } from "node:fs";
|
|
4869
|
+
import { homedir as homedir11 } from "node:os";
|
|
4870
|
+
import { dirname as dirname3, join as join21 } from "node:path";
|
|
4791
4871
|
|
|
4792
4872
|
// dist/src/skillify/skill-writer.js
|
|
4793
|
-
import { existsSync as
|
|
4794
|
-
import { homedir as
|
|
4795
|
-
import { join as
|
|
4873
|
+
import { existsSync as existsSync15, mkdirSync as mkdirSync5, readFileSync as readFileSync11, readdirSync as readdirSync2, statSync as statSync2, writeFileSync as writeFileSync8 } from "node:fs";
|
|
4874
|
+
import { homedir as homedir8 } from "node:os";
|
|
4875
|
+
import { join as join18 } from "node:path";
|
|
4796
4876
|
function assertValidSkillName(name) {
|
|
4797
4877
|
if (typeof name !== "string" || name.length === 0) {
|
|
4798
4878
|
throw new Error(`invalid skill name: empty or non-string`);
|
|
@@ -4858,22 +4938,22 @@ function parseFrontmatter(text) {
|
|
|
4858
4938
|
}
|
|
4859
4939
|
|
|
4860
4940
|
// dist/src/skillify/manifest.js
|
|
4861
|
-
import { existsSync as
|
|
4862
|
-
import { homedir as
|
|
4863
|
-
import { dirname as dirname2, join as
|
|
4941
|
+
import { existsSync as existsSync16, lstatSync as lstatSync3, mkdirSync as mkdirSync6, readFileSync as readFileSync12, renameSync as renameSync2, unlinkSync as unlinkSync7, writeFileSync as writeFileSync9 } from "node:fs";
|
|
4942
|
+
import { homedir as homedir9 } from "node:os";
|
|
4943
|
+
import { dirname as dirname2, join as join19 } from "node:path";
|
|
4864
4944
|
function emptyManifest() {
|
|
4865
4945
|
return { version: 1, entries: [] };
|
|
4866
4946
|
}
|
|
4867
4947
|
function manifestPath() {
|
|
4868
|
-
return
|
|
4948
|
+
return join19(homedir9(), ".deeplake", "state", "skillify", "pulled.json");
|
|
4869
4949
|
}
|
|
4870
4950
|
function loadManifest(path = manifestPath()) {
|
|
4871
4951
|
migrateLegacyStateDir();
|
|
4872
|
-
if (!
|
|
4952
|
+
if (!existsSync16(path))
|
|
4873
4953
|
return emptyManifest();
|
|
4874
4954
|
let raw;
|
|
4875
4955
|
try {
|
|
4876
|
-
raw =
|
|
4956
|
+
raw = readFileSync12(path, "utf-8");
|
|
4877
4957
|
} catch {
|
|
4878
4958
|
return emptyManifest();
|
|
4879
4959
|
}
|
|
@@ -4922,7 +5002,7 @@ function saveManifest(m, path = manifestPath()) {
|
|
|
4922
5002
|
migrateLegacyStateDir();
|
|
4923
5003
|
mkdirSync6(dirname2(path), { recursive: true });
|
|
4924
5004
|
const tmp = `${path}.tmp`;
|
|
4925
|
-
|
|
5005
|
+
writeFileSync9(tmp, JSON.stringify(m, null, 2) + "\n", { mode: 384 });
|
|
4926
5006
|
renameSync2(tmp, path);
|
|
4927
5007
|
}
|
|
4928
5008
|
function recordPull(entry, path = manifestPath()) {
|
|
@@ -4965,7 +5045,7 @@ function pruneOrphanedEntries(path = manifestPath()) {
|
|
|
4965
5045
|
const live = [];
|
|
4966
5046
|
let pruned = 0;
|
|
4967
5047
|
for (const e of m.entries) {
|
|
4968
|
-
if (
|
|
5048
|
+
if (existsSync16(join19(e.installRoot, e.dirName))) {
|
|
4969
5049
|
live.push(e);
|
|
4970
5050
|
continue;
|
|
4971
5051
|
}
|
|
@@ -4978,26 +5058,26 @@ function pruneOrphanedEntries(path = manifestPath()) {
|
|
|
4978
5058
|
}
|
|
4979
5059
|
|
|
4980
5060
|
// dist/src/skillify/agent-roots.js
|
|
4981
|
-
import { existsSync as
|
|
4982
|
-
import { homedir as
|
|
4983
|
-
import { join as
|
|
5061
|
+
import { existsSync as existsSync17 } from "node:fs";
|
|
5062
|
+
import { homedir as homedir10 } from "node:os";
|
|
5063
|
+
import { join as join20 } from "node:path";
|
|
4984
5064
|
function resolveDetected(home) {
|
|
4985
5065
|
const out = [];
|
|
4986
|
-
const codexInstalled =
|
|
4987
|
-
const piInstalled =
|
|
4988
|
-
const hermesInstalled =
|
|
5066
|
+
const codexInstalled = existsSync17(join20(home, ".codex"));
|
|
5067
|
+
const piInstalled = existsSync17(join20(home, ".pi", "agent"));
|
|
5068
|
+
const hermesInstalled = existsSync17(join20(home, ".hermes"));
|
|
4989
5069
|
if (codexInstalled || piInstalled) {
|
|
4990
|
-
out.push(
|
|
5070
|
+
out.push(join20(home, ".agents", "skills"));
|
|
4991
5071
|
}
|
|
4992
5072
|
if (hermesInstalled) {
|
|
4993
|
-
out.push(
|
|
5073
|
+
out.push(join20(home, ".hermes", "skills"));
|
|
4994
5074
|
}
|
|
4995
5075
|
if (piInstalled) {
|
|
4996
|
-
out.push(
|
|
5076
|
+
out.push(join20(home, ".pi", "agent", "skills"));
|
|
4997
5077
|
}
|
|
4998
5078
|
return out;
|
|
4999
5079
|
}
|
|
5000
|
-
function detectAgentSkillsRoots(canonicalRoot, home =
|
|
5080
|
+
function detectAgentSkillsRoots(canonicalRoot, home = homedir10()) {
|
|
5001
5081
|
return resolveDetected(home).filter((p) => p !== canonicalRoot);
|
|
5002
5082
|
}
|
|
5003
5083
|
|
|
@@ -5041,15 +5121,15 @@ function isMissingTableError(message) {
|
|
|
5041
5121
|
}
|
|
5042
5122
|
function resolvePullDestination(install, cwd) {
|
|
5043
5123
|
if (install === "global")
|
|
5044
|
-
return
|
|
5124
|
+
return join21(homedir11(), ".claude", "skills");
|
|
5045
5125
|
if (!cwd)
|
|
5046
5126
|
throw new Error("install=project requires a cwd");
|
|
5047
|
-
return
|
|
5127
|
+
return join21(cwd, ".claude", "skills");
|
|
5048
5128
|
}
|
|
5049
5129
|
function fanOutSymlinks(canonicalDir, dirName, agentRoots) {
|
|
5050
5130
|
const out = [];
|
|
5051
5131
|
for (const root of agentRoots) {
|
|
5052
|
-
const link =
|
|
5132
|
+
const link = join21(root, dirName);
|
|
5053
5133
|
let existing;
|
|
5054
5134
|
try {
|
|
5055
5135
|
existing = lstatSync4(link);
|
|
@@ -5092,8 +5172,8 @@ function backfillSymlinks(installRoot) {
|
|
|
5092
5172
|
return;
|
|
5093
5173
|
const detected = detectAgentSkillsRoots(installRoot);
|
|
5094
5174
|
for (const entry of entries) {
|
|
5095
|
-
const canonical =
|
|
5096
|
-
if (!
|
|
5175
|
+
const canonical = join21(entry.installRoot, entry.dirName);
|
|
5176
|
+
if (!existsSync18(canonical))
|
|
5097
5177
|
continue;
|
|
5098
5178
|
const fresh = fanOutSymlinks(canonical, entry.dirName, detected);
|
|
5099
5179
|
if (sameSorted(fresh, entry.symlinks))
|
|
@@ -5203,10 +5283,10 @@ function renderFrontmatter(fm) {
|
|
|
5203
5283
|
return lines.join("\n");
|
|
5204
5284
|
}
|
|
5205
5285
|
function readLocalVersion(path) {
|
|
5206
|
-
if (!
|
|
5286
|
+
if (!existsSync18(path))
|
|
5207
5287
|
return null;
|
|
5208
5288
|
try {
|
|
5209
|
-
const text =
|
|
5289
|
+
const text = readFileSync13(path, "utf-8");
|
|
5210
5290
|
const parsed = parseFrontmatter(text);
|
|
5211
5291
|
if (!parsed)
|
|
5212
5292
|
return null;
|
|
@@ -5301,8 +5381,8 @@ async function runPull(opts) {
|
|
|
5301
5381
|
summary.skipped++;
|
|
5302
5382
|
continue;
|
|
5303
5383
|
}
|
|
5304
|
-
const skillDir =
|
|
5305
|
-
const skillFile =
|
|
5384
|
+
const skillDir = join21(root, dirName);
|
|
5385
|
+
const skillFile = join21(skillDir, "SKILL.md");
|
|
5306
5386
|
const remoteVersion = Number(row.version ?? 1);
|
|
5307
5387
|
const localVersion = readLocalVersion(skillFile);
|
|
5308
5388
|
const action = decideAction({
|
|
@@ -5314,13 +5394,13 @@ async function runPull(opts) {
|
|
|
5314
5394
|
let manifestError;
|
|
5315
5395
|
if (action === "wrote") {
|
|
5316
5396
|
mkdirSync7(skillDir, { recursive: true });
|
|
5317
|
-
if (
|
|
5397
|
+
if (existsSync18(skillFile)) {
|
|
5318
5398
|
try {
|
|
5319
5399
|
renameSync3(skillFile, `${skillFile}.bak`);
|
|
5320
5400
|
} catch {
|
|
5321
5401
|
}
|
|
5322
5402
|
}
|
|
5323
|
-
|
|
5403
|
+
writeFileSync10(skillFile, renderSkillFile(row));
|
|
5324
5404
|
const symlinks = opts.install === "global" ? fanOutSymlinks(skillDir, dirName, detectAgentSkillsRoots(root)) : [];
|
|
5325
5405
|
try {
|
|
5326
5406
|
recordPull({
|
|
@@ -5362,15 +5442,15 @@ async function runPull(opts) {
|
|
|
5362
5442
|
}
|
|
5363
5443
|
|
|
5364
5444
|
// dist/src/skillify/unpull.js
|
|
5365
|
-
import { existsSync as
|
|
5366
|
-
import { homedir as
|
|
5367
|
-
import { join as
|
|
5445
|
+
import { existsSync as existsSync19, readdirSync as readdirSync3, rmSync as rmSync5, statSync as statSync3 } from "node:fs";
|
|
5446
|
+
import { homedir as homedir12 } from "node:os";
|
|
5447
|
+
import { join as join22 } from "node:path";
|
|
5368
5448
|
function resolveUnpullRoot(install, cwd) {
|
|
5369
5449
|
if (install === "global")
|
|
5370
|
-
return
|
|
5450
|
+
return join22(homedir12(), ".claude", "skills");
|
|
5371
5451
|
if (!cwd)
|
|
5372
5452
|
throw new Error("cwd required when install === 'project'");
|
|
5373
|
-
return
|
|
5453
|
+
return join22(cwd, ".claude", "skills");
|
|
5374
5454
|
}
|
|
5375
5455
|
function runUnpull(opts) {
|
|
5376
5456
|
const root = resolveUnpullRoot(opts.install, opts.cwd);
|
|
@@ -5393,8 +5473,8 @@ function runUnpull(opts) {
|
|
|
5393
5473
|
const entries = entriesForRoot(manifest, opts.install, root);
|
|
5394
5474
|
for (const entry of entries) {
|
|
5395
5475
|
summary.scanned++;
|
|
5396
|
-
const path =
|
|
5397
|
-
if (!
|
|
5476
|
+
const path = join22(root, entry.dirName);
|
|
5477
|
+
if (!existsSync19(path)) {
|
|
5398
5478
|
if (!opts.dryRun) {
|
|
5399
5479
|
unlinkSymlinks(entry.symlinks);
|
|
5400
5480
|
removePullEntry(opts.install, entry.installRoot, entry.dirName);
|
|
@@ -5447,12 +5527,12 @@ function runUnpull(opts) {
|
|
|
5447
5527
|
}
|
|
5448
5528
|
summary.entries.push(result);
|
|
5449
5529
|
}
|
|
5450
|
-
if (
|
|
5530
|
+
if (existsSync19(root) && (opts.all || opts.legacyCleanup)) {
|
|
5451
5531
|
const manifestDirNames = new Set(entries.map((e) => e.dirName));
|
|
5452
5532
|
for (const dirName of readdirSync3(root)) {
|
|
5453
5533
|
if (manifestDirNames.has(dirName))
|
|
5454
5534
|
continue;
|
|
5455
|
-
const path =
|
|
5535
|
+
const path = join22(root, dirName);
|
|
5456
5536
|
let st;
|
|
5457
5537
|
try {
|
|
5458
5538
|
st = statSync3(path);
|
|
@@ -5531,7 +5611,7 @@ function decideTargetForManifestEntry(entry, opts, userFilter, haveUserFilter) {
|
|
|
5531
5611
|
|
|
5532
5612
|
// dist/src/commands/skillify.js
|
|
5533
5613
|
function stateDir() {
|
|
5534
|
-
return
|
|
5614
|
+
return join23(homedir13(), ".deeplake", "state", "skillify");
|
|
5535
5615
|
}
|
|
5536
5616
|
function showStatus() {
|
|
5537
5617
|
const cfg = loadScopeConfig();
|
|
@@ -5539,7 +5619,7 @@ function showStatus() {
|
|
|
5539
5619
|
console.log(`team: ${cfg.team.length === 0 ? "(empty)" : cfg.team.join(", ")}`);
|
|
5540
5620
|
console.log(`install: ${cfg.install} (${cfg.install === "global" ? "~/.claude/skills/" : "<project>/.claude/skills/"})`);
|
|
5541
5621
|
const dir = stateDir();
|
|
5542
|
-
if (!
|
|
5622
|
+
if (!existsSync20(dir)) {
|
|
5543
5623
|
console.log(`state: (no projects tracked yet)`);
|
|
5544
5624
|
return;
|
|
5545
5625
|
}
|
|
@@ -5551,7 +5631,7 @@ function showStatus() {
|
|
|
5551
5631
|
console.log(`state: ${files.length} project(s) tracked`);
|
|
5552
5632
|
for (const f of files) {
|
|
5553
5633
|
try {
|
|
5554
|
-
const s = JSON.parse(
|
|
5634
|
+
const s = JSON.parse(readFileSync14(join23(dir, f), "utf-8"));
|
|
5555
5635
|
const last = typeof s.updatedAt === "number" ? new Date(s.updatedAt).toISOString() : s.lastDate ?? "never";
|
|
5556
5636
|
const skills = Array.isArray(s.skillsGenerated) && s.skillsGenerated.length > 0 ? s.skillsGenerated.join(", ") : "none";
|
|
5557
5637
|
console.log(` - ${s.project} (counter=${s.counter}, last=${last}, skills=${skills})`);
|
|
@@ -5578,7 +5658,7 @@ function setInstall(loc) {
|
|
|
5578
5658
|
}
|
|
5579
5659
|
const cfg = loadScopeConfig();
|
|
5580
5660
|
saveScopeConfig({ ...cfg, install: loc });
|
|
5581
|
-
const path = loc === "global" ?
|
|
5661
|
+
const path = loc === "global" ? join23(homedir13(), ".claude", "skills") : "<cwd>/.claude/skills";
|
|
5582
5662
|
console.log(`Install location set to '${loc}'. New skills will be written to ${path}/<name>/SKILL.md.`);
|
|
5583
5663
|
}
|
|
5584
5664
|
function promoteSkill(name, cwd) {
|
|
@@ -5586,13 +5666,13 @@ function promoteSkill(name, cwd) {
|
|
|
5586
5666
|
console.error("Usage: hivemind skillify promote <skill-name>");
|
|
5587
5667
|
process.exit(1);
|
|
5588
5668
|
}
|
|
5589
|
-
const projectPath =
|
|
5590
|
-
const globalPath =
|
|
5591
|
-
if (!
|
|
5669
|
+
const projectPath = join23(cwd, ".claude", "skills", name);
|
|
5670
|
+
const globalPath = join23(homedir13(), ".claude", "skills", name);
|
|
5671
|
+
if (!existsSync20(join23(projectPath, "SKILL.md"))) {
|
|
5592
5672
|
console.error(`Skill '${name}' not found at ${projectPath}/SKILL.md`);
|
|
5593
5673
|
process.exit(1);
|
|
5594
5674
|
}
|
|
5595
|
-
if (
|
|
5675
|
+
if (existsSync20(join23(globalPath, "SKILL.md"))) {
|
|
5596
5676
|
console.error(`Skill '${name}' already exists at ${globalPath}/SKILL.md \u2014 refusing to overwrite. Remove it first or rename the project skill.`);
|
|
5597
5677
|
process.exit(1);
|
|
5598
5678
|
}
|
|
@@ -5727,7 +5807,7 @@ async function pullSkills(args) {
|
|
|
5727
5807
|
console.error(`pull failed: ${e?.message ?? e}`);
|
|
5728
5808
|
process.exit(1);
|
|
5729
5809
|
}
|
|
5730
|
-
const dest = toRaw === "global" ?
|
|
5810
|
+
const dest = toRaw === "global" ? join23(homedir13(), ".claude", "skills") : `${process.cwd()}/.claude/skills`;
|
|
5731
5811
|
const filterDesc = users.length === 0 ? "all users" : users.join(", ");
|
|
5732
5812
|
console.log(`Destination: ${dest}`);
|
|
5733
5813
|
console.log(`Filter: ${filterDesc}${skillName ? ` \xB7 skill='${skillName}'` : ""}${dryRun ? " \xB7 dry-run" : ""}${force ? " \xB7 force" : ""}`);
|
|
@@ -5777,7 +5857,7 @@ async function unpullSkills(args) {
|
|
|
5777
5857
|
all,
|
|
5778
5858
|
legacyCleanup
|
|
5779
5859
|
});
|
|
5780
|
-
const dest = toRaw === "global" ?
|
|
5860
|
+
const dest = toRaw === "global" ? join23(homedir13(), ".claude", "skills") : `${process.cwd()}/.claude/skills`;
|
|
5781
5861
|
const filterParts = [];
|
|
5782
5862
|
if (users.length > 0)
|
|
5783
5863
|
filterParts.push(`users=${users.join(",")}`);
|
|
@@ -5866,13 +5946,13 @@ if (process.argv[1] && process.argv[1].endsWith("skillify.js")) {
|
|
|
5866
5946
|
|
|
5867
5947
|
// dist/src/cli/update.js
|
|
5868
5948
|
import { execFileSync as execFileSync4 } from "node:child_process";
|
|
5869
|
-
import { existsSync as
|
|
5949
|
+
import { existsSync as existsSync21, readFileSync as readFileSync16, realpathSync } from "node:fs";
|
|
5870
5950
|
import { dirname as dirname6, sep } from "node:path";
|
|
5871
5951
|
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
5872
5952
|
|
|
5873
5953
|
// dist/src/utils/version-check.js
|
|
5874
|
-
import { readFileSync as
|
|
5875
|
-
import { dirname as dirname5, join as
|
|
5954
|
+
import { readFileSync as readFileSync15 } from "node:fs";
|
|
5955
|
+
import { dirname as dirname5, join as join24 } from "node:path";
|
|
5876
5956
|
function isNewer(latest, current) {
|
|
5877
5957
|
const parse = (v) => v.split(".").map(Number);
|
|
5878
5958
|
const [la, lb, lc] = parse(latest);
|
|
@@ -5896,7 +5976,7 @@ function detectInstallKind(argv1) {
|
|
|
5896
5976
|
for (let i = 0; i < 10; i++) {
|
|
5897
5977
|
const pkgPath = `${dir}${sep}package.json`;
|
|
5898
5978
|
try {
|
|
5899
|
-
const pkg = JSON.parse(
|
|
5979
|
+
const pkg = JSON.parse(readFileSync16(pkgPath, "utf-8"));
|
|
5900
5980
|
if (pkg.name === PKG_NAME || pkg.name === "hivemind") {
|
|
5901
5981
|
installDir = dir;
|
|
5902
5982
|
break;
|
|
@@ -5917,7 +5997,7 @@ function detectInstallKind(argv1) {
|
|
|
5917
5997
|
}
|
|
5918
5998
|
let gitDir = installDir;
|
|
5919
5999
|
for (let i = 0; i < 6; i++) {
|
|
5920
|
-
if (
|
|
6000
|
+
if (existsSync21(`${gitDir}${sep}.git`)) {
|
|
5921
6001
|
return { kind: "local-dev", installDir };
|
|
5922
6002
|
}
|
|
5923
6003
|
const parent = dirname6(gitDir);
|
package/openclaw/dist/index.js
CHANGED
|
@@ -1073,7 +1073,7 @@ function extractLatestVersion(body) {
|
|
|
1073
1073
|
return typeof v === "string" && v.length > 0 ? v : null;
|
|
1074
1074
|
}
|
|
1075
1075
|
function getInstalledVersion() {
|
|
1076
|
-
return "0.7.
|
|
1076
|
+
return "0.7.25".length > 0 ? "0.7.25" : null;
|
|
1077
1077
|
}
|
|
1078
1078
|
function isNewer(latest, current) {
|
|
1079
1079
|
const parse = (v) => v.replace(/-.*$/, "").split(".").map(Number);
|
package/openclaw/package.json
CHANGED