@deeplake/hivemind 0.7.66 → 0.7.68
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 +3 -3
- package/.claude-plugin/plugin.json +1 -1
- package/bundle/cli.js +83 -41
- package/codex/bundle/capture.js +8 -35
- package/codex/bundle/commands/auth-login.js +5 -35
- package/codex/bundle/graph-pull-worker.js +5 -35
- package/codex/bundle/pre-tool-use.js +5 -35
- package/codex/bundle/session-start-setup.js +5 -35
- package/codex/bundle/session-start.js +5 -35
- package/codex/bundle/shell/deeplake-shell.js +5 -35
- package/codex/bundle/stop.js +8 -35
- package/codex/skills/hivemind-goals/SKILL.md +30 -0
- package/cursor/bundle/capture.js +8 -35
- package/cursor/bundle/commands/auth-login.js +5 -35
- package/cursor/bundle/graph-pull-worker.js +5 -35
- package/cursor/bundle/pre-tool-use.js +5 -35
- package/cursor/bundle/session-end.js +3 -0
- package/cursor/bundle/session-start.js +5 -35
- package/cursor/bundle/shell/deeplake-shell.js +5 -35
- package/hermes/bundle/capture.js +8 -35
- package/hermes/bundle/commands/auth-login.js +5 -35
- package/hermes/bundle/graph-pull-worker.js +5 -35
- package/hermes/bundle/pre-tool-use.js +5 -35
- package/hermes/bundle/session-end.js +3 -0
- package/hermes/bundle/session-start.js +5 -35
- package/hermes/bundle/shell/deeplake-shell.js +5 -35
- package/mcp/bundle/server.js +5 -35
- package/openclaw/dist/index.js +6 -30
- package/openclaw/openclaw.plugin.json +1 -1
- package/openclaw/package.json +1 -1
- package/openclaw/skills/hivemind-goals/SKILL.md +25 -0
- package/package.json +1 -1
package/hermes/bundle/capture.js
CHANGED
|
@@ -477,9 +477,6 @@ function traceSql(msg) {
|
|
|
477
477
|
log3(msg);
|
|
478
478
|
}
|
|
479
479
|
var _signalledBalanceExhausted = false;
|
|
480
|
-
var _signalledLowBalance = false;
|
|
481
|
-
var LOW_BALANCE_THRESHOLD_CENTS = 200;
|
|
482
|
-
var BALANCE_HEADER = "X-Activeloop-Balance-Cents";
|
|
483
480
|
function maybeSignalBalanceExhausted(status, bodyText) {
|
|
484
481
|
if (status !== 402)
|
|
485
482
|
return;
|
|
@@ -495,40 +492,15 @@ function maybeSignalBalanceExhausted(status, bodyText) {
|
|
|
495
492
|
transient: true,
|
|
496
493
|
title: "Hivemind credits exhausted \u2014 top up to keep capturing",
|
|
497
494
|
body: `Sessions are not being saved and memory recall is returning empty. Top up at ${billingUrl()} to restore capture and recall.`,
|
|
498
|
-
dedupKey: { reason: "balance-zero" }
|
|
495
|
+
dedupKey: { reason: "balance-zero" },
|
|
496
|
+
// User-facing billing notice → user channel only. Never the model's
|
|
497
|
+
// additionalContext: a "top up at <url>" instruction in the agent prompt
|
|
498
|
+
// is a prompt-injection pattern external agents flag.
|
|
499
|
+
userVisibleOnly: true
|
|
499
500
|
}).catch((e) => {
|
|
500
501
|
log3(`enqueue balance-exhausted failed: ${e instanceof Error ? e.message : String(e)}`);
|
|
501
502
|
});
|
|
502
503
|
}
|
|
503
|
-
function signalLowBalanceFromHeader(resp) {
|
|
504
|
-
if (_signalledLowBalance)
|
|
505
|
-
return;
|
|
506
|
-
const raw = resp.headers?.get?.(BALANCE_HEADER);
|
|
507
|
-
if (!raw)
|
|
508
|
-
return;
|
|
509
|
-
if (!/^-?\d+$/.test(raw.trim()))
|
|
510
|
-
return;
|
|
511
|
-
const balance = Number(raw.trim());
|
|
512
|
-
if (!Number.isFinite(balance))
|
|
513
|
-
return;
|
|
514
|
-
if (balance >= LOW_BALANCE_THRESHOLD_CENTS)
|
|
515
|
-
return;
|
|
516
|
-
if (balance <= 0)
|
|
517
|
-
return;
|
|
518
|
-
_signalledLowBalance = true;
|
|
519
|
-
log3(`balance below threshold (${balance}\xA2) \u2014 enqueuing low-balance banner`);
|
|
520
|
-
enqueueNotification({
|
|
521
|
-
id: "low-balance-warning",
|
|
522
|
-
severity: "warn",
|
|
523
|
-
transient: true,
|
|
524
|
-
title: "Your org's Hivemind balance is running low",
|
|
525
|
-
body: `Only $${(balance / 100).toFixed(2)} of prepaid balance remains. Admins can top up at ${billingUrl()}; otherwise ask an org admin to top up before requests start failing.`,
|
|
526
|
-
dedupKey: { reason: "low-balance" }
|
|
527
|
-
}).catch((e) => {
|
|
528
|
-
_signalledLowBalance = false;
|
|
529
|
-
log3(`enqueue low-balance failed: ${e instanceof Error ? e.message : String(e)}`);
|
|
530
|
-
});
|
|
531
|
-
}
|
|
532
504
|
function billingUrl() {
|
|
533
505
|
try {
|
|
534
506
|
const c = loadCredentials();
|
|
@@ -654,7 +626,6 @@ var DeeplakeApi = class {
|
|
|
654
626
|
}
|
|
655
627
|
throw lastError;
|
|
656
628
|
}
|
|
657
|
-
signalLowBalanceFromHeader(resp);
|
|
658
629
|
if (resp.ok) {
|
|
659
630
|
const raw = await resp.json();
|
|
660
631
|
if (!raw?.rows || !raw?.columns)
|
|
@@ -815,7 +786,6 @@ var DeeplakeApi = class {
|
|
|
815
786
|
...deeplakeClientHeader()
|
|
816
787
|
}
|
|
817
788
|
});
|
|
818
|
-
signalLowBalanceFromHeader(resp);
|
|
819
789
|
if (resp.ok) {
|
|
820
790
|
const data = await resp.json();
|
|
821
791
|
return {
|
|
@@ -1872,6 +1842,9 @@ Format: **entity** (type) \u2014 what was done with it, its current state>
|
|
|
1872
1842
|
## Open Questions / TODO
|
|
1873
1843
|
<Anything unresolved, blocked, or explicitly deferred>
|
|
1874
1844
|
|
|
1845
|
+
## Next Steps
|
|
1846
|
+
<The single concrete next action to resume with, as one imperative line (e.g. "Wire the resume-brief Next Steps fallback and run the tests"). If the session reached a clean stopping point with nothing pending, write exactly: none>
|
|
1847
|
+
|
|
1875
1848
|
IMPORTANT: Be exhaustive. Extract EVERY entity, decision, and fact.
|
|
1876
1849
|
PRIVACY: Never include absolute filesystem paths in the summary.
|
|
1877
1850
|
LENGTH LIMIT: Keep the total summary under 4000 characters.`;
|
|
@@ -741,9 +741,6 @@ function traceSql(msg) {
|
|
|
741
741
|
log3(msg);
|
|
742
742
|
}
|
|
743
743
|
var _signalledBalanceExhausted = false;
|
|
744
|
-
var _signalledLowBalance = false;
|
|
745
|
-
var LOW_BALANCE_THRESHOLD_CENTS = 200;
|
|
746
|
-
var BALANCE_HEADER = "X-Activeloop-Balance-Cents";
|
|
747
744
|
function maybeSignalBalanceExhausted(status, bodyText) {
|
|
748
745
|
if (status !== 402)
|
|
749
746
|
return;
|
|
@@ -759,40 +756,15 @@ function maybeSignalBalanceExhausted(status, bodyText) {
|
|
|
759
756
|
transient: true,
|
|
760
757
|
title: "Hivemind credits exhausted \u2014 top up to keep capturing",
|
|
761
758
|
body: `Sessions are not being saved and memory recall is returning empty. Top up at ${billingUrl()} to restore capture and recall.`,
|
|
762
|
-
dedupKey: { reason: "balance-zero" }
|
|
759
|
+
dedupKey: { reason: "balance-zero" },
|
|
760
|
+
// User-facing billing notice → user channel only. Never the model's
|
|
761
|
+
// additionalContext: a "top up at <url>" instruction in the agent prompt
|
|
762
|
+
// is a prompt-injection pattern external agents flag.
|
|
763
|
+
userVisibleOnly: true
|
|
763
764
|
}).catch((e) => {
|
|
764
765
|
log3(`enqueue balance-exhausted failed: ${e instanceof Error ? e.message : String(e)}`);
|
|
765
766
|
});
|
|
766
767
|
}
|
|
767
|
-
function signalLowBalanceFromHeader(resp) {
|
|
768
|
-
if (_signalledLowBalance)
|
|
769
|
-
return;
|
|
770
|
-
const raw = resp.headers?.get?.(BALANCE_HEADER);
|
|
771
|
-
if (!raw)
|
|
772
|
-
return;
|
|
773
|
-
if (!/^-?\d+$/.test(raw.trim()))
|
|
774
|
-
return;
|
|
775
|
-
const balance = Number(raw.trim());
|
|
776
|
-
if (!Number.isFinite(balance))
|
|
777
|
-
return;
|
|
778
|
-
if (balance >= LOW_BALANCE_THRESHOLD_CENTS)
|
|
779
|
-
return;
|
|
780
|
-
if (balance <= 0)
|
|
781
|
-
return;
|
|
782
|
-
_signalledLowBalance = true;
|
|
783
|
-
log3(`balance below threshold (${balance}\xA2) \u2014 enqueuing low-balance banner`);
|
|
784
|
-
enqueueNotification({
|
|
785
|
-
id: "low-balance-warning",
|
|
786
|
-
severity: "warn",
|
|
787
|
-
transient: true,
|
|
788
|
-
title: "Your org's Hivemind balance is running low",
|
|
789
|
-
body: `Only $${(balance / 100).toFixed(2)} of prepaid balance remains. Admins can top up at ${billingUrl()}; otherwise ask an org admin to top up before requests start failing.`,
|
|
790
|
-
dedupKey: { reason: "low-balance" }
|
|
791
|
-
}).catch((e) => {
|
|
792
|
-
_signalledLowBalance = false;
|
|
793
|
-
log3(`enqueue low-balance failed: ${e instanceof Error ? e.message : String(e)}`);
|
|
794
|
-
});
|
|
795
|
-
}
|
|
796
768
|
function billingUrl() {
|
|
797
769
|
try {
|
|
798
770
|
const c = loadCredentials();
|
|
@@ -918,7 +890,6 @@ var DeeplakeApi = class {
|
|
|
918
890
|
}
|
|
919
891
|
throw lastError;
|
|
920
892
|
}
|
|
921
|
-
signalLowBalanceFromHeader(resp);
|
|
922
893
|
if (resp.ok) {
|
|
923
894
|
const raw = await resp.json();
|
|
924
895
|
if (!raw?.rows || !raw?.columns)
|
|
@@ -1079,7 +1050,6 @@ var DeeplakeApi = class {
|
|
|
1079
1050
|
...deeplakeClientHeader()
|
|
1080
1051
|
}
|
|
1081
1052
|
});
|
|
1082
|
-
signalLowBalanceFromHeader(resp);
|
|
1083
1053
|
if (resp.ok) {
|
|
1084
1054
|
const data = await resp.json();
|
|
1085
1055
|
return {
|
|
@@ -468,9 +468,6 @@ function traceSql(msg) {
|
|
|
468
468
|
log3(msg);
|
|
469
469
|
}
|
|
470
470
|
var _signalledBalanceExhausted = false;
|
|
471
|
-
var _signalledLowBalance = false;
|
|
472
|
-
var LOW_BALANCE_THRESHOLD_CENTS = 200;
|
|
473
|
-
var BALANCE_HEADER = "X-Activeloop-Balance-Cents";
|
|
474
471
|
function maybeSignalBalanceExhausted(status, bodyText) {
|
|
475
472
|
if (status !== 402)
|
|
476
473
|
return;
|
|
@@ -486,40 +483,15 @@ function maybeSignalBalanceExhausted(status, bodyText) {
|
|
|
486
483
|
transient: true,
|
|
487
484
|
title: "Hivemind credits exhausted \u2014 top up to keep capturing",
|
|
488
485
|
body: `Sessions are not being saved and memory recall is returning empty. Top up at ${billingUrl()} to restore capture and recall.`,
|
|
489
|
-
dedupKey: { reason: "balance-zero" }
|
|
486
|
+
dedupKey: { reason: "balance-zero" },
|
|
487
|
+
// User-facing billing notice → user channel only. Never the model's
|
|
488
|
+
// additionalContext: a "top up at <url>" instruction in the agent prompt
|
|
489
|
+
// is a prompt-injection pattern external agents flag.
|
|
490
|
+
userVisibleOnly: true
|
|
490
491
|
}).catch((e) => {
|
|
491
492
|
log3(`enqueue balance-exhausted failed: ${e instanceof Error ? e.message : String(e)}`);
|
|
492
493
|
});
|
|
493
494
|
}
|
|
494
|
-
function signalLowBalanceFromHeader(resp) {
|
|
495
|
-
if (_signalledLowBalance)
|
|
496
|
-
return;
|
|
497
|
-
const raw = resp.headers?.get?.(BALANCE_HEADER);
|
|
498
|
-
if (!raw)
|
|
499
|
-
return;
|
|
500
|
-
if (!/^-?\d+$/.test(raw.trim()))
|
|
501
|
-
return;
|
|
502
|
-
const balance = Number(raw.trim());
|
|
503
|
-
if (!Number.isFinite(balance))
|
|
504
|
-
return;
|
|
505
|
-
if (balance >= LOW_BALANCE_THRESHOLD_CENTS)
|
|
506
|
-
return;
|
|
507
|
-
if (balance <= 0)
|
|
508
|
-
return;
|
|
509
|
-
_signalledLowBalance = true;
|
|
510
|
-
log3(`balance below threshold (${balance}\xA2) \u2014 enqueuing low-balance banner`);
|
|
511
|
-
enqueueNotification({
|
|
512
|
-
id: "low-balance-warning",
|
|
513
|
-
severity: "warn",
|
|
514
|
-
transient: true,
|
|
515
|
-
title: "Your org's Hivemind balance is running low",
|
|
516
|
-
body: `Only $${(balance / 100).toFixed(2)} of prepaid balance remains. Admins can top up at ${billingUrl()}; otherwise ask an org admin to top up before requests start failing.`,
|
|
517
|
-
dedupKey: { reason: "low-balance" }
|
|
518
|
-
}).catch((e) => {
|
|
519
|
-
_signalledLowBalance = false;
|
|
520
|
-
log3(`enqueue low-balance failed: ${e instanceof Error ? e.message : String(e)}`);
|
|
521
|
-
});
|
|
522
|
-
}
|
|
523
495
|
function billingUrl() {
|
|
524
496
|
try {
|
|
525
497
|
const c = loadCredentials();
|
|
@@ -645,7 +617,6 @@ var DeeplakeApi = class {
|
|
|
645
617
|
}
|
|
646
618
|
throw lastError;
|
|
647
619
|
}
|
|
648
|
-
signalLowBalanceFromHeader(resp);
|
|
649
620
|
if (resp.ok) {
|
|
650
621
|
const raw = await resp.json();
|
|
651
622
|
if (!raw?.rows || !raw?.columns)
|
|
@@ -806,7 +777,6 @@ var DeeplakeApi = class {
|
|
|
806
777
|
...deeplakeClientHeader()
|
|
807
778
|
}
|
|
808
779
|
});
|
|
809
|
-
signalLowBalanceFromHeader(resp);
|
|
810
780
|
if (resp.ok) {
|
|
811
781
|
const data = await resp.json();
|
|
812
782
|
return {
|
|
@@ -477,9 +477,6 @@ function traceSql(msg) {
|
|
|
477
477
|
log3(msg);
|
|
478
478
|
}
|
|
479
479
|
var _signalledBalanceExhausted = false;
|
|
480
|
-
var _signalledLowBalance = false;
|
|
481
|
-
var LOW_BALANCE_THRESHOLD_CENTS = 200;
|
|
482
|
-
var BALANCE_HEADER = "X-Activeloop-Balance-Cents";
|
|
483
480
|
function maybeSignalBalanceExhausted(status, bodyText) {
|
|
484
481
|
if (status !== 402)
|
|
485
482
|
return;
|
|
@@ -495,40 +492,15 @@ function maybeSignalBalanceExhausted(status, bodyText) {
|
|
|
495
492
|
transient: true,
|
|
496
493
|
title: "Hivemind credits exhausted \u2014 top up to keep capturing",
|
|
497
494
|
body: `Sessions are not being saved and memory recall is returning empty. Top up at ${billingUrl()} to restore capture and recall.`,
|
|
498
|
-
dedupKey: { reason: "balance-zero" }
|
|
495
|
+
dedupKey: { reason: "balance-zero" },
|
|
496
|
+
// User-facing billing notice → user channel only. Never the model's
|
|
497
|
+
// additionalContext: a "top up at <url>" instruction in the agent prompt
|
|
498
|
+
// is a prompt-injection pattern external agents flag.
|
|
499
|
+
userVisibleOnly: true
|
|
499
500
|
}).catch((e) => {
|
|
500
501
|
log3(`enqueue balance-exhausted failed: ${e instanceof Error ? e.message : String(e)}`);
|
|
501
502
|
});
|
|
502
503
|
}
|
|
503
|
-
function signalLowBalanceFromHeader(resp) {
|
|
504
|
-
if (_signalledLowBalance)
|
|
505
|
-
return;
|
|
506
|
-
const raw = resp.headers?.get?.(BALANCE_HEADER);
|
|
507
|
-
if (!raw)
|
|
508
|
-
return;
|
|
509
|
-
if (!/^-?\d+$/.test(raw.trim()))
|
|
510
|
-
return;
|
|
511
|
-
const balance = Number(raw.trim());
|
|
512
|
-
if (!Number.isFinite(balance))
|
|
513
|
-
return;
|
|
514
|
-
if (balance >= LOW_BALANCE_THRESHOLD_CENTS)
|
|
515
|
-
return;
|
|
516
|
-
if (balance <= 0)
|
|
517
|
-
return;
|
|
518
|
-
_signalledLowBalance = true;
|
|
519
|
-
log3(`balance below threshold (${balance}\xA2) \u2014 enqueuing low-balance banner`);
|
|
520
|
-
enqueueNotification({
|
|
521
|
-
id: "low-balance-warning",
|
|
522
|
-
severity: "warn",
|
|
523
|
-
transient: true,
|
|
524
|
-
title: "Your org's Hivemind balance is running low",
|
|
525
|
-
body: `Only $${(balance / 100).toFixed(2)} of prepaid balance remains. Admins can top up at ${billingUrl()}; otherwise ask an org admin to top up before requests start failing.`,
|
|
526
|
-
dedupKey: { reason: "low-balance" }
|
|
527
|
-
}).catch((e) => {
|
|
528
|
-
_signalledLowBalance = false;
|
|
529
|
-
log3(`enqueue low-balance failed: ${e instanceof Error ? e.message : String(e)}`);
|
|
530
|
-
});
|
|
531
|
-
}
|
|
532
504
|
function billingUrl() {
|
|
533
505
|
try {
|
|
534
506
|
const c = loadCredentials();
|
|
@@ -654,7 +626,6 @@ var DeeplakeApi = class {
|
|
|
654
626
|
}
|
|
655
627
|
throw lastError;
|
|
656
628
|
}
|
|
657
|
-
signalLowBalanceFromHeader(resp);
|
|
658
629
|
if (resp.ok) {
|
|
659
630
|
const raw = await resp.json();
|
|
660
631
|
if (!raw?.rows || !raw?.columns)
|
|
@@ -815,7 +786,6 @@ var DeeplakeApi = class {
|
|
|
815
786
|
...deeplakeClientHeader()
|
|
816
787
|
}
|
|
817
788
|
});
|
|
818
|
-
signalLowBalanceFromHeader(resp);
|
|
819
789
|
if (resp.ok) {
|
|
820
790
|
const data = await resp.json();
|
|
821
791
|
return {
|
|
@@ -266,6 +266,9 @@ Format: **entity** (type) \u2014 what was done with it, its current state>
|
|
|
266
266
|
## Open Questions / TODO
|
|
267
267
|
<Anything unresolved, blocked, or explicitly deferred>
|
|
268
268
|
|
|
269
|
+
## Next Steps
|
|
270
|
+
<The single concrete next action to resume with, as one imperative line (e.g. "Wire the resume-brief Next Steps fallback and run the tests"). If the session reached a clean stopping point with nothing pending, write exactly: none>
|
|
271
|
+
|
|
269
272
|
IMPORTANT: Be exhaustive. Extract EVERY entity, decision, and fact.
|
|
270
273
|
PRIVACY: Never include absolute filesystem paths in the summary.
|
|
271
274
|
LENGTH LIMIT: Keep the total summary under 4000 characters.`;
|
|
@@ -532,9 +532,6 @@ function traceSql(msg) {
|
|
|
532
532
|
log3(msg);
|
|
533
533
|
}
|
|
534
534
|
var _signalledBalanceExhausted = false;
|
|
535
|
-
var _signalledLowBalance = false;
|
|
536
|
-
var LOW_BALANCE_THRESHOLD_CENTS = 200;
|
|
537
|
-
var BALANCE_HEADER = "X-Activeloop-Balance-Cents";
|
|
538
535
|
function maybeSignalBalanceExhausted(status, bodyText) {
|
|
539
536
|
if (status !== 402)
|
|
540
537
|
return;
|
|
@@ -550,40 +547,15 @@ function maybeSignalBalanceExhausted(status, bodyText) {
|
|
|
550
547
|
transient: true,
|
|
551
548
|
title: "Hivemind credits exhausted \u2014 top up to keep capturing",
|
|
552
549
|
body: `Sessions are not being saved and memory recall is returning empty. Top up at ${billingUrl()} to restore capture and recall.`,
|
|
553
|
-
dedupKey: { reason: "balance-zero" }
|
|
550
|
+
dedupKey: { reason: "balance-zero" },
|
|
551
|
+
// User-facing billing notice → user channel only. Never the model's
|
|
552
|
+
// additionalContext: a "top up at <url>" instruction in the agent prompt
|
|
553
|
+
// is a prompt-injection pattern external agents flag.
|
|
554
|
+
userVisibleOnly: true
|
|
554
555
|
}).catch((e) => {
|
|
555
556
|
log3(`enqueue balance-exhausted failed: ${e instanceof Error ? e.message : String(e)}`);
|
|
556
557
|
});
|
|
557
558
|
}
|
|
558
|
-
function signalLowBalanceFromHeader(resp) {
|
|
559
|
-
if (_signalledLowBalance)
|
|
560
|
-
return;
|
|
561
|
-
const raw = resp.headers?.get?.(BALANCE_HEADER);
|
|
562
|
-
if (!raw)
|
|
563
|
-
return;
|
|
564
|
-
if (!/^-?\d+$/.test(raw.trim()))
|
|
565
|
-
return;
|
|
566
|
-
const balance = Number(raw.trim());
|
|
567
|
-
if (!Number.isFinite(balance))
|
|
568
|
-
return;
|
|
569
|
-
if (balance >= LOW_BALANCE_THRESHOLD_CENTS)
|
|
570
|
-
return;
|
|
571
|
-
if (balance <= 0)
|
|
572
|
-
return;
|
|
573
|
-
_signalledLowBalance = true;
|
|
574
|
-
log3(`balance below threshold (${balance}\xA2) \u2014 enqueuing low-balance banner`);
|
|
575
|
-
enqueueNotification({
|
|
576
|
-
id: "low-balance-warning",
|
|
577
|
-
severity: "warn",
|
|
578
|
-
transient: true,
|
|
579
|
-
title: "Your org's Hivemind balance is running low",
|
|
580
|
-
body: `Only $${(balance / 100).toFixed(2)} of prepaid balance remains. Admins can top up at ${billingUrl()}; otherwise ask an org admin to top up before requests start failing.`,
|
|
581
|
-
dedupKey: { reason: "low-balance" }
|
|
582
|
-
}).catch((e) => {
|
|
583
|
-
_signalledLowBalance = false;
|
|
584
|
-
log3(`enqueue low-balance failed: ${e instanceof Error ? e.message : String(e)}`);
|
|
585
|
-
});
|
|
586
|
-
}
|
|
587
559
|
function billingUrl() {
|
|
588
560
|
try {
|
|
589
561
|
const c = loadCredentials();
|
|
@@ -709,7 +681,6 @@ var DeeplakeApi = class {
|
|
|
709
681
|
}
|
|
710
682
|
throw lastError;
|
|
711
683
|
}
|
|
712
|
-
signalLowBalanceFromHeader(resp);
|
|
713
684
|
if (resp.ok) {
|
|
714
685
|
const raw = await resp.json();
|
|
715
686
|
if (!raw?.rows || !raw?.columns)
|
|
@@ -870,7 +841,6 @@ var DeeplakeApi = class {
|
|
|
870
841
|
...deeplakeClientHeader()
|
|
871
842
|
}
|
|
872
843
|
});
|
|
873
|
-
signalLowBalanceFromHeader(resp);
|
|
874
844
|
if (resp.ok) {
|
|
875
845
|
const data = await resp.json();
|
|
876
846
|
return {
|
|
@@ -67172,9 +67172,6 @@ function traceSql(msg) {
|
|
|
67172
67172
|
log3(msg);
|
|
67173
67173
|
}
|
|
67174
67174
|
var _signalledBalanceExhausted = false;
|
|
67175
|
-
var _signalledLowBalance = false;
|
|
67176
|
-
var LOW_BALANCE_THRESHOLD_CENTS = 200;
|
|
67177
|
-
var BALANCE_HEADER = "X-Activeloop-Balance-Cents";
|
|
67178
67175
|
function maybeSignalBalanceExhausted(status, bodyText) {
|
|
67179
67176
|
if (status !== 402)
|
|
67180
67177
|
return;
|
|
@@ -67190,40 +67187,15 @@ function maybeSignalBalanceExhausted(status, bodyText) {
|
|
|
67190
67187
|
transient: true,
|
|
67191
67188
|
title: "Hivemind credits exhausted \u2014 top up to keep capturing",
|
|
67192
67189
|
body: `Sessions are not being saved and memory recall is returning empty. Top up at ${billingUrl()} to restore capture and recall.`,
|
|
67193
|
-
dedupKey: { reason: "balance-zero" }
|
|
67190
|
+
dedupKey: { reason: "balance-zero" },
|
|
67191
|
+
// User-facing billing notice → user channel only. Never the model's
|
|
67192
|
+
// additionalContext: a "top up at <url>" instruction in the agent prompt
|
|
67193
|
+
// is a prompt-injection pattern external agents flag.
|
|
67194
|
+
userVisibleOnly: true
|
|
67194
67195
|
}).catch((e6) => {
|
|
67195
67196
|
log3(`enqueue balance-exhausted failed: ${e6 instanceof Error ? e6.message : String(e6)}`);
|
|
67196
67197
|
});
|
|
67197
67198
|
}
|
|
67198
|
-
function signalLowBalanceFromHeader(resp) {
|
|
67199
|
-
if (_signalledLowBalance)
|
|
67200
|
-
return;
|
|
67201
|
-
const raw = resp.headers?.get?.(BALANCE_HEADER);
|
|
67202
|
-
if (!raw)
|
|
67203
|
-
return;
|
|
67204
|
-
if (!/^-?\d+$/.test(raw.trim()))
|
|
67205
|
-
return;
|
|
67206
|
-
const balance = Number(raw.trim());
|
|
67207
|
-
if (!Number.isFinite(balance))
|
|
67208
|
-
return;
|
|
67209
|
-
if (balance >= LOW_BALANCE_THRESHOLD_CENTS)
|
|
67210
|
-
return;
|
|
67211
|
-
if (balance <= 0)
|
|
67212
|
-
return;
|
|
67213
|
-
_signalledLowBalance = true;
|
|
67214
|
-
log3(`balance below threshold (${balance}\xA2) \u2014 enqueuing low-balance banner`);
|
|
67215
|
-
enqueueNotification({
|
|
67216
|
-
id: "low-balance-warning",
|
|
67217
|
-
severity: "warn",
|
|
67218
|
-
transient: true,
|
|
67219
|
-
title: "Your org's Hivemind balance is running low",
|
|
67220
|
-
body: `Only $${(balance / 100).toFixed(2)} of prepaid balance remains. Admins can top up at ${billingUrl()}; otherwise ask an org admin to top up before requests start failing.`,
|
|
67221
|
-
dedupKey: { reason: "low-balance" }
|
|
67222
|
-
}).catch((e6) => {
|
|
67223
|
-
_signalledLowBalance = false;
|
|
67224
|
-
log3(`enqueue low-balance failed: ${e6 instanceof Error ? e6.message : String(e6)}`);
|
|
67225
|
-
});
|
|
67226
|
-
}
|
|
67227
67199
|
function billingUrl() {
|
|
67228
67200
|
try {
|
|
67229
67201
|
const c15 = loadCredentials();
|
|
@@ -67349,7 +67321,6 @@ var DeeplakeApi = class {
|
|
|
67349
67321
|
}
|
|
67350
67322
|
throw lastError;
|
|
67351
67323
|
}
|
|
67352
|
-
signalLowBalanceFromHeader(resp);
|
|
67353
67324
|
if (resp.ok) {
|
|
67354
67325
|
const raw = await resp.json();
|
|
67355
67326
|
if (!raw?.rows || !raw?.columns)
|
|
@@ -67510,7 +67481,6 @@ var DeeplakeApi = class {
|
|
|
67510
67481
|
...deeplakeClientHeader()
|
|
67511
67482
|
}
|
|
67512
67483
|
});
|
|
67513
|
-
signalLowBalanceFromHeader(resp);
|
|
67514
67484
|
if (resp.ok) {
|
|
67515
67485
|
const data = await resp.json();
|
|
67516
67486
|
return {
|
package/mcp/bundle/server.js
CHANGED
|
@@ -23683,9 +23683,6 @@ function traceSql(msg) {
|
|
|
23683
23683
|
log3(msg);
|
|
23684
23684
|
}
|
|
23685
23685
|
var _signalledBalanceExhausted = false;
|
|
23686
|
-
var _signalledLowBalance = false;
|
|
23687
|
-
var LOW_BALANCE_THRESHOLD_CENTS = 200;
|
|
23688
|
-
var BALANCE_HEADER = "X-Activeloop-Balance-Cents";
|
|
23689
23686
|
function maybeSignalBalanceExhausted(status, bodyText) {
|
|
23690
23687
|
if (status !== 402)
|
|
23691
23688
|
return;
|
|
@@ -23701,40 +23698,15 @@ function maybeSignalBalanceExhausted(status, bodyText) {
|
|
|
23701
23698
|
transient: true,
|
|
23702
23699
|
title: "Hivemind credits exhausted \u2014 top up to keep capturing",
|
|
23703
23700
|
body: `Sessions are not being saved and memory recall is returning empty. Top up at ${billingUrl()} to restore capture and recall.`,
|
|
23704
|
-
dedupKey: { reason: "balance-zero" }
|
|
23701
|
+
dedupKey: { reason: "balance-zero" },
|
|
23702
|
+
// User-facing billing notice → user channel only. Never the model's
|
|
23703
|
+
// additionalContext: a "top up at <url>" instruction in the agent prompt
|
|
23704
|
+
// is a prompt-injection pattern external agents flag.
|
|
23705
|
+
userVisibleOnly: true
|
|
23705
23706
|
}).catch((e) => {
|
|
23706
23707
|
log3(`enqueue balance-exhausted failed: ${e instanceof Error ? e.message : String(e)}`);
|
|
23707
23708
|
});
|
|
23708
23709
|
}
|
|
23709
|
-
function signalLowBalanceFromHeader(resp) {
|
|
23710
|
-
if (_signalledLowBalance)
|
|
23711
|
-
return;
|
|
23712
|
-
const raw = resp.headers?.get?.(BALANCE_HEADER);
|
|
23713
|
-
if (!raw)
|
|
23714
|
-
return;
|
|
23715
|
-
if (!/^-?\d+$/.test(raw.trim()))
|
|
23716
|
-
return;
|
|
23717
|
-
const balance = Number(raw.trim());
|
|
23718
|
-
if (!Number.isFinite(balance))
|
|
23719
|
-
return;
|
|
23720
|
-
if (balance >= LOW_BALANCE_THRESHOLD_CENTS)
|
|
23721
|
-
return;
|
|
23722
|
-
if (balance <= 0)
|
|
23723
|
-
return;
|
|
23724
|
-
_signalledLowBalance = true;
|
|
23725
|
-
log3(`balance below threshold (${balance}\xA2) \u2014 enqueuing low-balance banner`);
|
|
23726
|
-
enqueueNotification({
|
|
23727
|
-
id: "low-balance-warning",
|
|
23728
|
-
severity: "warn",
|
|
23729
|
-
transient: true,
|
|
23730
|
-
title: "Your org's Hivemind balance is running low",
|
|
23731
|
-
body: `Only $${(balance / 100).toFixed(2)} of prepaid balance remains. Admins can top up at ${billingUrl()}; otherwise ask an org admin to top up before requests start failing.`,
|
|
23732
|
-
dedupKey: { reason: "low-balance" }
|
|
23733
|
-
}).catch((e) => {
|
|
23734
|
-
_signalledLowBalance = false;
|
|
23735
|
-
log3(`enqueue low-balance failed: ${e instanceof Error ? e.message : String(e)}`);
|
|
23736
|
-
});
|
|
23737
|
-
}
|
|
23738
23710
|
function billingUrl() {
|
|
23739
23711
|
try {
|
|
23740
23712
|
const c = loadCredentials();
|
|
@@ -23860,7 +23832,6 @@ var DeeplakeApi = class {
|
|
|
23860
23832
|
}
|
|
23861
23833
|
throw lastError;
|
|
23862
23834
|
}
|
|
23863
|
-
signalLowBalanceFromHeader(resp);
|
|
23864
23835
|
if (resp.ok) {
|
|
23865
23836
|
const raw = await resp.json();
|
|
23866
23837
|
if (!raw?.rows || !raw?.columns)
|
|
@@ -24021,7 +23992,6 @@ var DeeplakeApi = class {
|
|
|
24021
23992
|
...deeplakeClientHeader()
|
|
24022
23993
|
}
|
|
24023
23994
|
});
|
|
24024
|
-
signalLowBalanceFromHeader(resp);
|
|
24025
23995
|
if (resp.ok) {
|
|
24026
23996
|
const data = await resp.json();
|
|
24027
23997
|
return {
|
package/openclaw/dist/index.js
CHANGED
|
@@ -494,9 +494,6 @@ function traceSql(msg) {
|
|
|
494
494
|
if (globalThis.__hivemind_tuning__.HIVEMIND_DEBUG === "1") log3(msg);
|
|
495
495
|
}
|
|
496
496
|
var _signalledBalanceExhausted = false;
|
|
497
|
-
var _signalledLowBalance = false;
|
|
498
|
-
var LOW_BALANCE_THRESHOLD_CENTS = 200;
|
|
499
|
-
var BALANCE_HEADER = "X-Activeloop-Balance-Cents";
|
|
500
497
|
function maybeSignalBalanceExhausted(status, bodyText) {
|
|
501
498
|
if (status !== 402) return;
|
|
502
499
|
if (!bodyText.includes("balance_cents")) return;
|
|
@@ -509,34 +506,15 @@ function maybeSignalBalanceExhausted(status, bodyText) {
|
|
|
509
506
|
transient: true,
|
|
510
507
|
title: "Hivemind credits exhausted \u2014 top up to keep capturing",
|
|
511
508
|
body: `Sessions are not being saved and memory recall is returning empty. Top up at ${billingUrl()} to restore capture and recall.`,
|
|
512
|
-
dedupKey: { reason: "balance-zero" }
|
|
509
|
+
dedupKey: { reason: "balance-zero" },
|
|
510
|
+
// User-facing billing notice → user channel only. Never the model's
|
|
511
|
+
// additionalContext: a "top up at <url>" instruction in the agent prompt
|
|
512
|
+
// is a prompt-injection pattern external agents flag.
|
|
513
|
+
userVisibleOnly: true
|
|
513
514
|
}).catch((e) => {
|
|
514
515
|
log3(`enqueue balance-exhausted failed: ${e instanceof Error ? e.message : String(e)}`);
|
|
515
516
|
});
|
|
516
517
|
}
|
|
517
|
-
function signalLowBalanceFromHeader(resp) {
|
|
518
|
-
if (_signalledLowBalance) return;
|
|
519
|
-
const raw = resp.headers?.get?.(BALANCE_HEADER);
|
|
520
|
-
if (!raw) return;
|
|
521
|
-
if (!/^-?\d+$/.test(raw.trim())) return;
|
|
522
|
-
const balance = Number(raw.trim());
|
|
523
|
-
if (!Number.isFinite(balance)) return;
|
|
524
|
-
if (balance >= LOW_BALANCE_THRESHOLD_CENTS) return;
|
|
525
|
-
if (balance <= 0) return;
|
|
526
|
-
_signalledLowBalance = true;
|
|
527
|
-
log3(`balance below threshold (${balance}\xA2) \u2014 enqueuing low-balance banner`);
|
|
528
|
-
enqueueNotification({
|
|
529
|
-
id: "low-balance-warning",
|
|
530
|
-
severity: "warn",
|
|
531
|
-
transient: true,
|
|
532
|
-
title: "Your org's Hivemind balance is running low",
|
|
533
|
-
body: `Only $${(balance / 100).toFixed(2)} of prepaid balance remains. Admins can top up at ${billingUrl()}; otherwise ask an org admin to top up before requests start failing.`,
|
|
534
|
-
dedupKey: { reason: "low-balance" }
|
|
535
|
-
}).catch((e) => {
|
|
536
|
-
_signalledLowBalance = false;
|
|
537
|
-
log3(`enqueue low-balance failed: ${e instanceof Error ? e.message : String(e)}`);
|
|
538
|
-
});
|
|
539
|
-
}
|
|
540
518
|
function billingUrl() {
|
|
541
519
|
try {
|
|
542
520
|
const c = loadCredentials();
|
|
@@ -662,7 +640,6 @@ var DeeplakeApi = class {
|
|
|
662
640
|
}
|
|
663
641
|
throw lastError;
|
|
664
642
|
}
|
|
665
|
-
signalLowBalanceFromHeader(resp);
|
|
666
643
|
if (resp.ok) {
|
|
667
644
|
const raw = await resp.json();
|
|
668
645
|
if (!raw?.rows || !raw?.columns) return [];
|
|
@@ -824,7 +801,6 @@ var DeeplakeApi = class {
|
|
|
824
801
|
...deeplakeClientHeader()
|
|
825
802
|
}
|
|
826
803
|
});
|
|
827
|
-
signalLowBalanceFromHeader(resp);
|
|
828
804
|
if (resp.ok) {
|
|
829
805
|
const data = await resp.json();
|
|
830
806
|
return {
|
|
@@ -1823,7 +1799,7 @@ function extractLatestVersion(body) {
|
|
|
1823
1799
|
return typeof v === "string" && v.length > 0 ? v : null;
|
|
1824
1800
|
}
|
|
1825
1801
|
function getInstalledVersion() {
|
|
1826
|
-
return "0.7.
|
|
1802
|
+
return "0.7.68".length > 0 ? "0.7.68" : null;
|
|
1827
1803
|
}
|
|
1828
1804
|
function isNewer(latest, current) {
|
|
1829
1805
|
const parse = (v) => v.replace(/-.*$/, "").split(".").map(Number);
|
package/openclaw/package.json
CHANGED
|
@@ -23,6 +23,31 @@ OpenClaw exposes purpose-built tools for goals + KPIs. Use them directly — do
|
|
|
23
23
|
3. ONLY if the user asks for KPIs: `hivemind_kpi_add` once per KPI with `goal_id` + `kpi_id` (short slug like `k-prs`) + `target` (positive int) + `unit`.
|
|
24
24
|
4. Confirm to the user with the goal_id and that the goal is team-visible.
|
|
25
25
|
|
|
26
|
+
## Capture a task for later (with resumable context)
|
|
27
|
+
|
|
28
|
+
When the user **parks a tangential task** mid-session — "save this for later", "remind me to …", "don't let me forget …", "let's do X later" — store enough **context to resume cold** later, not just a one-liner. Put the full package in the `text` of `hivemind_goal_add`:
|
|
29
|
+
|
|
30
|
+
```
|
|
31
|
+
hivemind_goal_add({ text:
|
|
32
|
+
"Add rate-limiting to the webhook handler\n\n" +
|
|
33
|
+
"Start here: add a per-IP token bucket on the handler entry path\n" +
|
|
34
|
+
"Files: src/webhook/handler.ts:120-160, src/webhook/limits.ts\n" +
|
|
35
|
+
"Branch: feat/webhook-hardening\n" +
|
|
36
|
+
"Run: pnpm test webhook\n" +
|
|
37
|
+
"Why: bursty clients hammer the endpoint; defer until retry-backoff lands" })
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
Line 1 is the label. Fill `Start here / Files / Branch / Run / Why` from the conversation; `Start here:` (the concrete first action) matters most. (OpenClaw's `hivemind_goal_add` has no provenance flag, so the row is tagged `manual` — that's fine; the context is what matters.)
|
|
41
|
+
|
|
42
|
+
## Resume a parked task (automatic context transfer)
|
|
43
|
+
|
|
44
|
+
When the user says "let's work on that task / goal" or "pick up the `<X>` task":
|
|
45
|
+
|
|
46
|
+
1. `hivemind_search({ query: "<topic>" })` or `hivemind_index({})` to locate the parked goal, then `hivemind_read({ path: "memory/goal/<owner>/opened/<goal_id>.md" })` to pull the **full** context package back.
|
|
47
|
+
2. Read it as your working context and begin from `Start here:` using the `Files` / `Branch` / `Run` lines — continue as if the context was never lost.
|
|
48
|
+
|
|
49
|
+
(Status-move tools aren't exposed on OpenClaw, so leave the goal where it is and just resume the work.)
|
|
50
|
+
|
|
26
51
|
## What NOT to do
|
|
27
52
|
|
|
28
53
|
- Do NOT write files anywhere under `~/.deeplake/memory/`. OpenClaw's runtime does not route filesystem writes to the Deeplake tables — only the `hivemind_*` tools above do.
|