@deeplake/hivemind 0.7.17 → 0.7.19
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/.claude-plugin/marketplace.json +2 -2
- package/.claude-plugin/plugin.json +1 -1
- package/bundle/cli.js +148 -111
- package/codex/bundle/session-start.js +89 -55
- package/codex/bundle/{skilify-worker.js → skillify-worker.js} +65 -30
- package/codex/bundle/stop.js +105 -68
- package/cursor/bundle/capture.js +84 -47
- package/cursor/bundle/session-end.js +82 -45
- package/cursor/bundle/session-start.js +87 -53
- package/cursor/bundle/{skilify-worker.js → skillify-worker.js} +65 -30
- package/hermes/bundle/capture.js +84 -47
- package/hermes/bundle/session-end.js +82 -45
- package/hermes/bundle/session-start.js +87 -53
- package/hermes/bundle/{skilify-worker.js → skillify-worker.js} +65 -30
- package/openclaw/dist/index.js +47 -30
- package/openclaw/dist/{skilify-worker.js → skillify-worker.js} +65 -30
- package/openclaw/openclaw.plugin.json +1 -1
- package/openclaw/package.json +1 -1
- package/openclaw/skills/SKILL.md +19 -19
- package/package.json +1 -1
- package/pi/extension-source/hivemind.ts +43 -43
|
@@ -205,11 +205,11 @@ function tryEmbedOverSocket(text: string, kind: "document" | "query"): Promise<n
|
|
|
205
205
|
|
|
206
206
|
const SUMMARY_STATE_DIR = join(homedir(), ".claude", "hooks", "summary-state");
|
|
207
207
|
const PI_WIKI_WORKER_PATH = join(homedir(), ".pi", "agent", "hivemind", "wiki-worker.js");
|
|
208
|
-
//
|
|
208
|
+
// Skillify worker installed alongside wiki-worker by `hivemind pi install`.
|
|
209
209
|
// Spawned on session_shutdown to mine reusable Claude skills from the just-
|
|
210
210
|
// finished session. Same shared bundle used by CC/Codex/Cursor/Hermes.
|
|
211
|
-
const
|
|
212
|
-
// Auto-pull worker installed alongside wiki-worker /
|
|
211
|
+
const PI_SKILLIFY_WORKER_PATH = join(homedir(), ".pi", "agent", "hivemind", "skillify-worker.js");
|
|
212
|
+
// Auto-pull worker installed alongside wiki-worker / skillify-worker by
|
|
213
213
|
// `hivemind pi install`. Spawned synchronously on session_start to fetch
|
|
214
214
|
// all-author skills from the org table. The worker is a thin wrapper
|
|
215
215
|
// around the shared autoPullSkills() that codex / cursor / hermes call
|
|
@@ -444,20 +444,20 @@ function spawnWikiWorker(
|
|
|
444
444
|
}
|
|
445
445
|
}
|
|
446
446
|
|
|
447
|
-
// ----------
|
|
447
|
+
// ---------- skillify worker spawn ---------------------------------------------
|
|
448
448
|
//
|
|
449
|
-
// Mirror of src/
|
|
449
|
+
// Mirror of src/skillify/spawn-skillify-worker.ts and src/skillify/triggers.ts —
|
|
450
450
|
// inlined here because pi/extension-source/hivemind.ts is shipped as raw .ts
|
|
451
451
|
// with zero non-builtin runtime dependencies (pi compiles + loads it at
|
|
452
|
-
// extension-load time). The shared TypeScript modules under src/
|
|
452
|
+
// extension-load time). The shared TypeScript modules under src/skillify/
|
|
453
453
|
// can't be imported from this file.
|
|
454
454
|
//
|
|
455
|
-
// The
|
|
455
|
+
// The skillify worker mines the just-finished session for reusable Claude
|
|
456
456
|
// skills, gates each cluster via a model call, and writes SKILL.md files +
|
|
457
457
|
// rows in the org's skills Deeplake table.
|
|
458
458
|
|
|
459
|
-
/** Stable project key — sha1(cwd) truncated, mirrors src/
|
|
460
|
-
function
|
|
459
|
+
/** Stable project key — sha1(cwd) truncated, mirrors src/skillify/state.ts deriveProjectKey. */
|
|
460
|
+
function deriveSkillifyProjectKey(cwd: string): { key: string; project: string } {
|
|
461
461
|
const project = (cwd ?? "").split("/").pop() || "unknown";
|
|
462
462
|
// Pi's extension can't easily run `git config` synchronously here; use cwd
|
|
463
463
|
// as the signature. Two checkouts of the same repo at different paths get
|
|
@@ -467,15 +467,15 @@ function deriveSkilifyProjectKey(cwd: string): { key: string; project: string }
|
|
|
467
467
|
return { key, project };
|
|
468
468
|
}
|
|
469
469
|
|
|
470
|
-
function
|
|
471
|
-
if (!existsSync(
|
|
472
|
-
logHm(`
|
|
470
|
+
function spawnPiSkillifyWorker(creds: Creds, sessionId: string, cwd: string): void {
|
|
471
|
+
if (!existsSync(PI_SKILLIFY_WORKER_PATH)) {
|
|
472
|
+
logHm(`spawnPiSkillifyWorker: no worker at ${PI_SKILLIFY_WORKER_PATH} — install via 'hivemind pi install' or rebuild`);
|
|
473
473
|
return;
|
|
474
474
|
}
|
|
475
|
-
const { key: projectKey, project } =
|
|
475
|
+
const { key: projectKey, project } = deriveSkillifyProjectKey(cwd);
|
|
476
476
|
|
|
477
477
|
// No spawn-side lock: the worker itself acquires `<projectKey>.lock` via
|
|
478
|
-
// src/
|
|
478
|
+
// src/skillify/state.ts:tryAcquireWorkerLock and releases it on exit (with
|
|
479
479
|
// a 10-min stale-lock fallback). A spawn-side lock here would create a
|
|
480
480
|
// SECOND lockfile (`<projectKey>.worker.lock`) that nobody releases,
|
|
481
481
|
// permanently blocking subsequent spawns from the same Pi runtime
|
|
@@ -483,12 +483,12 @@ function spawnPiSkilifyWorker(creds: Creds, sessionId: string, cwd: string): voi
|
|
|
483
483
|
// back-to-back spawns where a worker is in flight cost only one extra
|
|
484
484
|
// node cold-start (~50ms) before the worker self-skips on the lock.
|
|
485
485
|
|
|
486
|
-
const tmpDir = join(tmpdir(), `deeplake-
|
|
486
|
+
const tmpDir = join(tmpdir(), `deeplake-skillify-${projectKey}-${Date.now()}`);
|
|
487
487
|
try { mkdirSync(tmpDir, { recursive: true, mode: 0o700 }); }
|
|
488
|
-
catch (e: any) { logHm(`
|
|
488
|
+
catch (e: any) { logHm(`spawnPiSkillifyWorker: mkdir failed: ${e?.message ?? e}`); return; }
|
|
489
489
|
const configPath = join(tmpDir, "config.json");
|
|
490
490
|
|
|
491
|
-
// Same shape the spawn-
|
|
491
|
+
// Same shape the spawn-skillify-worker.ts module writes for the other agents.
|
|
492
492
|
// Defaults match scope-config.ts: scope=me, install=project, no team list.
|
|
493
493
|
// Pi-specific: no per-agent gate binary (`gateBin: null`) — the worker's
|
|
494
494
|
// gate-runner falls back to its agent dispatch which for `agent: "pi"`
|
|
@@ -516,21 +516,21 @@ function spawnPiSkilifyWorker(creds: Creds, sessionId: string, cwd: string): voi
|
|
|
516
516
|
// pi-specific gate args — match wikiWorker config defaults (google + gemini-2.5-flash)
|
|
517
517
|
piProvider: process.env.HIVEMIND_PI_PROVIDER ?? "google",
|
|
518
518
|
piModel: process.env.HIVEMIND_PI_MODEL ?? "gemini-2.5-flash",
|
|
519
|
-
|
|
519
|
+
skillifyLog: join(homedir(), ".deeplake", "hivemind-pi-skillify.log"),
|
|
520
520
|
currentSessionId: sessionId,
|
|
521
521
|
};
|
|
522
522
|
try { writeFileSync(configPath, JSON.stringify(config), { mode: 0o600 }); }
|
|
523
|
-
catch (e: any) { logHm(`
|
|
523
|
+
catch (e: any) { logHm(`spawnPiSkillifyWorker: config write failed: ${e?.message ?? e}`); return; }
|
|
524
524
|
|
|
525
|
-
logHm(`
|
|
525
|
+
logHm(`spawnPiSkillifyWorker: spawning ${PI_SKILLIFY_WORKER_PATH} project=${project} key=${projectKey} session=${sessionId}`);
|
|
526
526
|
try {
|
|
527
|
-
spawn(process.execPath, [
|
|
527
|
+
spawn(process.execPath, [PI_SKILLIFY_WORKER_PATH, configPath], {
|
|
528
528
|
detached: true,
|
|
529
529
|
stdio: "ignore",
|
|
530
|
-
env: { ...process.env,
|
|
530
|
+
env: { ...process.env, HIVEMIND_SKILLIFY_WORKER: "1", HIVEMIND_CAPTURE: "false" },
|
|
531
531
|
}).unref();
|
|
532
532
|
} catch (e: any) {
|
|
533
|
-
logHm(`
|
|
533
|
+
logHm(`spawnPiSkillifyWorker: spawn failed: ${e?.message ?? e}`);
|
|
534
534
|
}
|
|
535
535
|
}
|
|
536
536
|
|
|
@@ -696,23 +696,23 @@ Organization management — each argument is SEPARATE (do NOT quote subcommands
|
|
|
696
696
|
- hivemind members — list members
|
|
697
697
|
- hivemind remove <user-id> — remove member
|
|
698
698
|
|
|
699
|
-
SKILLS (
|
|
700
|
-
- hivemind
|
|
701
|
-
- hivemind
|
|
702
|
-
- hivemind
|
|
703
|
-
- hivemind
|
|
704
|
-
- hivemind
|
|
705
|
-
- hivemind
|
|
706
|
-
- hivemind
|
|
707
|
-
- hivemind
|
|
708
|
-
- hivemind
|
|
709
|
-
- hivemind
|
|
710
|
-
- hivemind
|
|
711
|
-
- hivemind
|
|
712
|
-
- hivemind
|
|
713
|
-
- hivemind
|
|
714
|
-
- hivemind
|
|
715
|
-
- hivemind
|
|
699
|
+
SKILLS (skillify) — mine + share reusable skills across the org. Run these in a terminal (or via shell if available):
|
|
700
|
+
- hivemind skillify — show scope/team/install + per-project state
|
|
701
|
+
- hivemind skillify pull — sync project skills from the org table
|
|
702
|
+
- hivemind skillify pull --user <email> — only that author's skills
|
|
703
|
+
- hivemind skillify pull --users a,b,c — multiple authors (CSV)
|
|
704
|
+
- hivemind skillify pull --all-users — explicit "no author filter"
|
|
705
|
+
- hivemind skillify pull --to project|global — install location
|
|
706
|
+
- hivemind skillify pull --dry-run — preview only
|
|
707
|
+
- hivemind skillify pull --force — overwrite local (creates .bak)
|
|
708
|
+
- hivemind skillify pull <skill-name> — pull only that skill (combines with --user)
|
|
709
|
+
- hivemind skillify unpull — remove every skill previously installed by pull
|
|
710
|
+
- hivemind skillify unpull --user <email> — remove only that author's pulls
|
|
711
|
+
- hivemind skillify unpull --not-mine — remove all pulls except your own
|
|
712
|
+
- hivemind skillify unpull --dry-run — preview without touching disk
|
|
713
|
+
- hivemind skillify scope <me|team|org> — sharing scope for new skills
|
|
714
|
+
- hivemind skillify install <project|global> — default install location
|
|
715
|
+
- hivemind skillify team add|remove|list <name> — manage team list`;
|
|
716
716
|
|
|
717
717
|
export default function hivemindExtension(pi: ExtensionAPI): void {
|
|
718
718
|
const captureEnabled = process.env.HIVEMIND_CAPTURE !== "false";
|
|
@@ -1007,13 +1007,13 @@ export default function hivemindExtension(pi: ExtensionAPI): void {
|
|
|
1007
1007
|
// skips if a periodic worker is mid-flight. Non-fatal either way.
|
|
1008
1008
|
spawnWikiWorker(creds, sessionId, cwd, "final");
|
|
1009
1009
|
|
|
1010
|
-
// Also kick off the
|
|
1010
|
+
// Also kick off the skillify worker so this session's prompt+answer
|
|
1011
1011
|
// pairs become candidates for reusable skills. Lock keyed on
|
|
1012
1012
|
// projectKey, not sessionId — multiple sessions in the same project
|
|
1013
1013
|
// shouldn't race the gate. Non-fatal: failure here only loses the
|
|
1014
1014
|
// mining for this one session, never breaks the wiki summary above.
|
|
1015
|
-
try {
|
|
1016
|
-
catch (e: any) { logHm(`session_shutdown:
|
|
1015
|
+
try { spawnPiSkillifyWorker(creds, sessionId, cwd); }
|
|
1016
|
+
catch (e: any) { logHm(`session_shutdown: skillify spawn threw: ${e?.message ?? e}`); }
|
|
1017
1017
|
});
|
|
1018
1018
|
|
|
1019
1019
|
// Module-load breadcrumb so we know the extension's default export ran at all.
|