@deeplake/hivemind 0.7.66 → 0.7.67
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 +15 -36
- package/codex/bundle/capture.js +5 -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 +5 -35
- package/cursor/bundle/capture.js +5 -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-start.js +5 -35
- package/cursor/bundle/shell/deeplake-shell.js +5 -35
- package/hermes/bundle/capture.js +5 -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-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/package.json +1 -1
package/codex/bundle/stop.js
CHANGED
|
@@ -483,9 +483,6 @@ function traceSql(msg) {
|
|
|
483
483
|
log3(msg);
|
|
484
484
|
}
|
|
485
485
|
var _signalledBalanceExhausted = false;
|
|
486
|
-
var _signalledLowBalance = false;
|
|
487
|
-
var LOW_BALANCE_THRESHOLD_CENTS = 200;
|
|
488
|
-
var BALANCE_HEADER = "X-Activeloop-Balance-Cents";
|
|
489
486
|
function maybeSignalBalanceExhausted(status, bodyText) {
|
|
490
487
|
if (status !== 402)
|
|
491
488
|
return;
|
|
@@ -501,40 +498,15 @@ function maybeSignalBalanceExhausted(status, bodyText) {
|
|
|
501
498
|
transient: true,
|
|
502
499
|
title: "Hivemind credits exhausted \u2014 top up to keep capturing",
|
|
503
500
|
body: `Sessions are not being saved and memory recall is returning empty. Top up at ${billingUrl()} to restore capture and recall.`,
|
|
504
|
-
dedupKey: { reason: "balance-zero" }
|
|
501
|
+
dedupKey: { reason: "balance-zero" },
|
|
502
|
+
// User-facing billing notice → user channel only. Never the model's
|
|
503
|
+
// additionalContext: a "top up at <url>" instruction in the agent prompt
|
|
504
|
+
// is a prompt-injection pattern external agents flag.
|
|
505
|
+
userVisibleOnly: true
|
|
505
506
|
}).catch((e) => {
|
|
506
507
|
log3(`enqueue balance-exhausted failed: ${e instanceof Error ? e.message : String(e)}`);
|
|
507
508
|
});
|
|
508
509
|
}
|
|
509
|
-
function signalLowBalanceFromHeader(resp) {
|
|
510
|
-
if (_signalledLowBalance)
|
|
511
|
-
return;
|
|
512
|
-
const raw = resp.headers?.get?.(BALANCE_HEADER);
|
|
513
|
-
if (!raw)
|
|
514
|
-
return;
|
|
515
|
-
if (!/^-?\d+$/.test(raw.trim()))
|
|
516
|
-
return;
|
|
517
|
-
const balance = Number(raw.trim());
|
|
518
|
-
if (!Number.isFinite(balance))
|
|
519
|
-
return;
|
|
520
|
-
if (balance >= LOW_BALANCE_THRESHOLD_CENTS)
|
|
521
|
-
return;
|
|
522
|
-
if (balance <= 0)
|
|
523
|
-
return;
|
|
524
|
-
_signalledLowBalance = true;
|
|
525
|
-
log3(`balance below threshold (${balance}\xA2) \u2014 enqueuing low-balance banner`);
|
|
526
|
-
enqueueNotification({
|
|
527
|
-
id: "low-balance-warning",
|
|
528
|
-
severity: "warn",
|
|
529
|
-
transient: true,
|
|
530
|
-
title: "Your org's Hivemind balance is running low",
|
|
531
|
-
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.`,
|
|
532
|
-
dedupKey: { reason: "low-balance" }
|
|
533
|
-
}).catch((e) => {
|
|
534
|
-
_signalledLowBalance = false;
|
|
535
|
-
log3(`enqueue low-balance failed: ${e instanceof Error ? e.message : String(e)}`);
|
|
536
|
-
});
|
|
537
|
-
}
|
|
538
510
|
function billingUrl() {
|
|
539
511
|
try {
|
|
540
512
|
const c = loadCredentials();
|
|
@@ -660,7 +632,6 @@ var DeeplakeApi = class {
|
|
|
660
632
|
}
|
|
661
633
|
throw lastError;
|
|
662
634
|
}
|
|
663
|
-
signalLowBalanceFromHeader(resp);
|
|
664
635
|
if (resp.ok) {
|
|
665
636
|
const raw = await resp.json();
|
|
666
637
|
if (!raw?.rows || !raw?.columns)
|
|
@@ -821,7 +792,6 @@ var DeeplakeApi = class {
|
|
|
821
792
|
...deeplakeClientHeader()
|
|
822
793
|
}
|
|
823
794
|
});
|
|
824
|
-
signalLowBalanceFromHeader(resp);
|
|
825
795
|
if (resp.ok) {
|
|
826
796
|
const data = await resp.json();
|
|
827
797
|
return {
|
package/cursor/bundle/capture.js
CHANGED
|
@@ -478,9 +478,6 @@ function traceSql(msg) {
|
|
|
478
478
|
log3(msg);
|
|
479
479
|
}
|
|
480
480
|
var _signalledBalanceExhausted = false;
|
|
481
|
-
var _signalledLowBalance = false;
|
|
482
|
-
var LOW_BALANCE_THRESHOLD_CENTS = 200;
|
|
483
|
-
var BALANCE_HEADER = "X-Activeloop-Balance-Cents";
|
|
484
481
|
function maybeSignalBalanceExhausted(status, bodyText) {
|
|
485
482
|
if (status !== 402)
|
|
486
483
|
return;
|
|
@@ -496,40 +493,15 @@ function maybeSignalBalanceExhausted(status, bodyText) {
|
|
|
496
493
|
transient: true,
|
|
497
494
|
title: "Hivemind credits exhausted \u2014 top up to keep capturing",
|
|
498
495
|
body: `Sessions are not being saved and memory recall is returning empty. Top up at ${billingUrl()} to restore capture and recall.`,
|
|
499
|
-
dedupKey: { reason: "balance-zero" }
|
|
496
|
+
dedupKey: { reason: "balance-zero" },
|
|
497
|
+
// User-facing billing notice → user channel only. Never the model's
|
|
498
|
+
// additionalContext: a "top up at <url>" instruction in the agent prompt
|
|
499
|
+
// is a prompt-injection pattern external agents flag.
|
|
500
|
+
userVisibleOnly: true
|
|
500
501
|
}).catch((e) => {
|
|
501
502
|
log3(`enqueue balance-exhausted failed: ${e instanceof Error ? e.message : String(e)}`);
|
|
502
503
|
});
|
|
503
504
|
}
|
|
504
|
-
function signalLowBalanceFromHeader(resp) {
|
|
505
|
-
if (_signalledLowBalance)
|
|
506
|
-
return;
|
|
507
|
-
const raw = resp.headers?.get?.(BALANCE_HEADER);
|
|
508
|
-
if (!raw)
|
|
509
|
-
return;
|
|
510
|
-
if (!/^-?\d+$/.test(raw.trim()))
|
|
511
|
-
return;
|
|
512
|
-
const balance = Number(raw.trim());
|
|
513
|
-
if (!Number.isFinite(balance))
|
|
514
|
-
return;
|
|
515
|
-
if (balance >= LOW_BALANCE_THRESHOLD_CENTS)
|
|
516
|
-
return;
|
|
517
|
-
if (balance <= 0)
|
|
518
|
-
return;
|
|
519
|
-
_signalledLowBalance = true;
|
|
520
|
-
log3(`balance below threshold (${balance}\xA2) \u2014 enqueuing low-balance banner`);
|
|
521
|
-
enqueueNotification({
|
|
522
|
-
id: "low-balance-warning",
|
|
523
|
-
severity: "warn",
|
|
524
|
-
transient: true,
|
|
525
|
-
title: "Your org's Hivemind balance is running low",
|
|
526
|
-
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.`,
|
|
527
|
-
dedupKey: { reason: "low-balance" }
|
|
528
|
-
}).catch((e) => {
|
|
529
|
-
_signalledLowBalance = false;
|
|
530
|
-
log3(`enqueue low-balance failed: ${e instanceof Error ? e.message : String(e)}`);
|
|
531
|
-
});
|
|
532
|
-
}
|
|
533
505
|
function billingUrl() {
|
|
534
506
|
try {
|
|
535
507
|
const c = loadCredentials();
|
|
@@ -655,7 +627,6 @@ var DeeplakeApi = class {
|
|
|
655
627
|
}
|
|
656
628
|
throw lastError;
|
|
657
629
|
}
|
|
658
|
-
signalLowBalanceFromHeader(resp);
|
|
659
630
|
if (resp.ok) {
|
|
660
631
|
const raw = await resp.json();
|
|
661
632
|
if (!raw?.rows || !raw?.columns)
|
|
@@ -816,7 +787,6 @@ var DeeplakeApi = class {
|
|
|
816
787
|
...deeplakeClientHeader()
|
|
817
788
|
}
|
|
818
789
|
});
|
|
819
|
-
signalLowBalanceFromHeader(resp);
|
|
820
790
|
if (resp.ok) {
|
|
821
791
|
const data = await resp.json();
|
|
822
792
|
return {
|
|
@@ -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 {
|
|
@@ -533,9 +533,6 @@ function traceSql(msg) {
|
|
|
533
533
|
log3(msg);
|
|
534
534
|
}
|
|
535
535
|
var _signalledBalanceExhausted = false;
|
|
536
|
-
var _signalledLowBalance = false;
|
|
537
|
-
var LOW_BALANCE_THRESHOLD_CENTS = 200;
|
|
538
|
-
var BALANCE_HEADER = "X-Activeloop-Balance-Cents";
|
|
539
536
|
function maybeSignalBalanceExhausted(status, bodyText) {
|
|
540
537
|
if (status !== 402)
|
|
541
538
|
return;
|
|
@@ -551,40 +548,15 @@ function maybeSignalBalanceExhausted(status, bodyText) {
|
|
|
551
548
|
transient: true,
|
|
552
549
|
title: "Hivemind credits exhausted \u2014 top up to keep capturing",
|
|
553
550
|
body: `Sessions are not being saved and memory recall is returning empty. Top up at ${billingUrl()} to restore capture and recall.`,
|
|
554
|
-
dedupKey: { reason: "balance-zero" }
|
|
551
|
+
dedupKey: { reason: "balance-zero" },
|
|
552
|
+
// User-facing billing notice → user channel only. Never the model's
|
|
553
|
+
// additionalContext: a "top up at <url>" instruction in the agent prompt
|
|
554
|
+
// is a prompt-injection pattern external agents flag.
|
|
555
|
+
userVisibleOnly: true
|
|
555
556
|
}).catch((e) => {
|
|
556
557
|
log3(`enqueue balance-exhausted failed: ${e instanceof Error ? e.message : String(e)}`);
|
|
557
558
|
});
|
|
558
559
|
}
|
|
559
|
-
function signalLowBalanceFromHeader(resp) {
|
|
560
|
-
if (_signalledLowBalance)
|
|
561
|
-
return;
|
|
562
|
-
const raw = resp.headers?.get?.(BALANCE_HEADER);
|
|
563
|
-
if (!raw)
|
|
564
|
-
return;
|
|
565
|
-
if (!/^-?\d+$/.test(raw.trim()))
|
|
566
|
-
return;
|
|
567
|
-
const balance = Number(raw.trim());
|
|
568
|
-
if (!Number.isFinite(balance))
|
|
569
|
-
return;
|
|
570
|
-
if (balance >= LOW_BALANCE_THRESHOLD_CENTS)
|
|
571
|
-
return;
|
|
572
|
-
if (balance <= 0)
|
|
573
|
-
return;
|
|
574
|
-
_signalledLowBalance = true;
|
|
575
|
-
log3(`balance below threshold (${balance}\xA2) \u2014 enqueuing low-balance banner`);
|
|
576
|
-
enqueueNotification({
|
|
577
|
-
id: "low-balance-warning",
|
|
578
|
-
severity: "warn",
|
|
579
|
-
transient: true,
|
|
580
|
-
title: "Your org's Hivemind balance is running low",
|
|
581
|
-
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.`,
|
|
582
|
-
dedupKey: { reason: "low-balance" }
|
|
583
|
-
}).catch((e) => {
|
|
584
|
-
_signalledLowBalance = false;
|
|
585
|
-
log3(`enqueue low-balance failed: ${e instanceof Error ? e.message : String(e)}`);
|
|
586
|
-
});
|
|
587
|
-
}
|
|
588
560
|
function billingUrl() {
|
|
589
561
|
try {
|
|
590
562
|
const c = loadCredentials();
|
|
@@ -710,7 +682,6 @@ var DeeplakeApi = class {
|
|
|
710
682
|
}
|
|
711
683
|
throw lastError;
|
|
712
684
|
}
|
|
713
|
-
signalLowBalanceFromHeader(resp);
|
|
714
685
|
if (resp.ok) {
|
|
715
686
|
const raw = await resp.json();
|
|
716
687
|
if (!raw?.rows || !raw?.columns)
|
|
@@ -871,7 +842,6 @@ var DeeplakeApi = class {
|
|
|
871
842
|
...deeplakeClientHeader()
|
|
872
843
|
}
|
|
873
844
|
});
|
|
874
|
-
signalLowBalanceFromHeader(resp);
|
|
875
845
|
if (resp.ok) {
|
|
876
846
|
const data = await resp.json();
|
|
877
847
|
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/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 {
|
|
@@ -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 {
|