@deeplake/hivemind 0.7.17 → 0.7.18

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.
@@ -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
- // Skilify worker installed alongside wiki-worker by `hivemind pi install`.
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 PI_SKILIFY_WORKER_PATH = join(homedir(), ".pi", "agent", "hivemind", "skilify-worker.js");
212
- // Auto-pull worker installed alongside wiki-worker / skilify-worker by
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
- // ---------- skilify worker spawn ---------------------------------------------
447
+ // ---------- skillify worker spawn ---------------------------------------------
448
448
  //
449
- // Mirror of src/skilify/spawn-skilify-worker.ts and src/skilify/triggers.ts —
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/skilify/
452
+ // extension-load time). The shared TypeScript modules under src/skillify/
453
453
  // can't be imported from this file.
454
454
  //
455
- // The skilify worker mines the just-finished session for reusable Claude
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/skilify/state.ts deriveProjectKey. */
460
- function deriveSkilifyProjectKey(cwd: string): { key: string; project: string } {
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 spawnPiSkilifyWorker(creds: Creds, sessionId: string, cwd: string): void {
471
- if (!existsSync(PI_SKILIFY_WORKER_PATH)) {
472
- logHm(`spawnPiSkilifyWorker: no worker at ${PI_SKILIFY_WORKER_PATH} — install via 'hivemind pi install' or rebuild`);
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 } = deriveSkilifyProjectKey(cwd);
475
+ const { key: projectKey, project } = deriveSkillifyProjectKey(cwd);
476
476
 
477
477
  // No spawn-side lock: the worker itself acquires `<projectKey>.lock` via
478
- // src/skilify/state.ts:tryAcquireWorkerLock and releases it on exit (with
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-skilify-${projectKey}-${Date.now()}`);
486
+ const tmpDir = join(tmpdir(), `deeplake-skillify-${projectKey}-${Date.now()}`);
487
487
  try { mkdirSync(tmpDir, { recursive: true, mode: 0o700 }); }
488
- catch (e: any) { logHm(`spawnPiSkilifyWorker: mkdir failed: ${e?.message ?? e}`); return; }
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-skilify-worker.ts module writes for the other agents.
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
- skilifyLog: join(homedir(), ".deeplake", "hivemind-pi-skilify.log"),
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(`spawnPiSkilifyWorker: config write failed: ${e?.message ?? e}`); return; }
523
+ catch (e: any) { logHm(`spawnPiSkillifyWorker: config write failed: ${e?.message ?? e}`); return; }
524
524
 
525
- logHm(`spawnPiSkilifyWorker: spawning ${PI_SKILIFY_WORKER_PATH} project=${project} key=${projectKey} session=${sessionId}`);
525
+ logHm(`spawnPiSkillifyWorker: spawning ${PI_SKILLIFY_WORKER_PATH} project=${project} key=${projectKey} session=${sessionId}`);
526
526
  try {
527
- spawn(process.execPath, [PI_SKILIFY_WORKER_PATH, configPath], {
527
+ spawn(process.execPath, [PI_SKILLIFY_WORKER_PATH, configPath], {
528
528
  detached: true,
529
529
  stdio: "ignore",
530
- env: { ...process.env, HIVEMIND_SKILIFY_WORKER: "1", HIVEMIND_CAPTURE: "false" },
530
+ env: { ...process.env, HIVEMIND_SKILLIFY_WORKER: "1", HIVEMIND_CAPTURE: "false" },
531
531
  }).unref();
532
532
  } catch (e: any) {
533
- logHm(`spawnPiSkilifyWorker: spawn failed: ${e?.message ?? e}`);
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 (skilify) — mine + share reusable skills across the org. Run these in a terminal (or via shell if available):
700
- - hivemind skilify — show scope/team/install + per-project state
701
- - hivemind skilify pull — sync project skills from the org table
702
- - hivemind skilify pull --user <email> — only that author's skills
703
- - hivemind skilify pull --users a,b,c — multiple authors (CSV)
704
- - hivemind skilify pull --all-users — explicit "no author filter"
705
- - hivemind skilify pull --to project|global — install location
706
- - hivemind skilify pull --dry-run — preview only
707
- - hivemind skilify pull --force — overwrite local (creates .bak)
708
- - hivemind skilify pull <skill-name> — pull only that skill (combines with --user)
709
- - hivemind skilify unpull — remove every skill previously installed by pull
710
- - hivemind skilify unpull --user <email> — remove only that author's pulls
711
- - hivemind skilify unpull --not-mine — remove all pulls except your own
712
- - hivemind skilify unpull --dry-run — preview without touching disk
713
- - hivemind skilify scope <me|team|org> — sharing scope for new skills
714
- - hivemind skilify install <project|global> — default install location
715
- - hivemind skilify team add|remove|list <name> — manage team list`;
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 skilify worker so this session's prompt+answer
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 { spawnPiSkilifyWorker(creds, sessionId, cwd); }
1016
- catch (e: any) { logHm(`session_shutdown: skilify spawn threw: ${e?.message ?? e}`); }
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.