@deeplake/hivemind 0.7.32 → 0.7.34
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 +332 -189
- package/codex/bundle/capture.js +365 -332
- package/codex/bundle/commands/auth-login.js +163 -30
- package/codex/bundle/pre-tool-use.js +334 -301
- package/codex/bundle/session-start-setup.js +193 -60
- package/codex/bundle/session-start.js +229 -87
- package/codex/bundle/shell/deeplake-shell.js +328 -295
- package/codex/bundle/skillify-worker.js +26 -18
- package/codex/bundle/stop.js +450 -394
- package/codex/bundle/wiki-worker.js +174 -292
- package/cursor/bundle/capture.js +448 -392
- package/cursor/bundle/commands/auth-login.js +163 -30
- package/cursor/bundle/pre-tool-use.js +324 -291
- package/cursor/bundle/session-end.js +43 -20
- package/cursor/bundle/session-start.js +272 -130
- package/cursor/bundle/shell/deeplake-shell.js +328 -295
- package/cursor/bundle/skillify-worker.js +26 -18
- package/cursor/bundle/wiki-worker.js +174 -292
- package/hermes/bundle/capture.js +448 -392
- package/hermes/bundle/commands/auth-login.js +163 -30
- package/hermes/bundle/pre-tool-use.js +324 -291
- package/hermes/bundle/session-end.js +43 -20
- package/hermes/bundle/session-start.js +269 -127
- package/hermes/bundle/shell/deeplake-shell.js +328 -295
- package/hermes/bundle/skillify-worker.js +26 -18
- package/hermes/bundle/wiki-worker.js +174 -292
- package/mcp/bundle/server.js +190 -57
- package/openclaw/dist/index.js +160 -32
- package/openclaw/dist/skillify-worker.js +26 -18
- package/openclaw/openclaw.plugin.json +1 -1
- package/openclaw/package.json +1 -1
- package/package.json +1 -1
package/mcp/bundle/server.js
CHANGED
|
@@ -2983,7 +2983,7 @@ var require_compile = __commonJS({
|
|
|
2983
2983
|
const schOrFunc = root.refs[ref];
|
|
2984
2984
|
if (schOrFunc)
|
|
2985
2985
|
return schOrFunc;
|
|
2986
|
-
let _sch =
|
|
2986
|
+
let _sch = resolve2.call(this, root, ref);
|
|
2987
2987
|
if (_sch === void 0) {
|
|
2988
2988
|
const schema = (_a2 = root.localRefs) === null || _a2 === void 0 ? void 0 : _a2[ref];
|
|
2989
2989
|
const { schemaId } = this.opts;
|
|
@@ -3010,7 +3010,7 @@ var require_compile = __commonJS({
|
|
|
3010
3010
|
function sameSchemaEnv(s1, s2) {
|
|
3011
3011
|
return s1.schema === s2.schema && s1.root === s2.root && s1.baseId === s2.baseId;
|
|
3012
3012
|
}
|
|
3013
|
-
function
|
|
3013
|
+
function resolve2(root, ref) {
|
|
3014
3014
|
let sch;
|
|
3015
3015
|
while (typeof (sch = this.refs[ref]) == "string")
|
|
3016
3016
|
ref = sch;
|
|
@@ -3585,7 +3585,7 @@ var require_fast_uri = __commonJS({
|
|
|
3585
3585
|
}
|
|
3586
3586
|
return uri;
|
|
3587
3587
|
}
|
|
3588
|
-
function
|
|
3588
|
+
function resolve2(baseURI, relativeURI, options) {
|
|
3589
3589
|
const schemelessOptions = options ? Object.assign({ scheme: "null" }, options) : { scheme: "null" };
|
|
3590
3590
|
const resolved = resolveComponent(parse3(baseURI, schemelessOptions), parse3(relativeURI, schemelessOptions), schemelessOptions, true);
|
|
3591
3591
|
schemelessOptions.skipEscape = true;
|
|
@@ -3812,7 +3812,7 @@ var require_fast_uri = __commonJS({
|
|
|
3812
3812
|
var fastUri = {
|
|
3813
3813
|
SCHEMES,
|
|
3814
3814
|
normalize,
|
|
3815
|
-
resolve,
|
|
3815
|
+
resolve: resolve2,
|
|
3816
3816
|
resolveComponent,
|
|
3817
3817
|
equal,
|
|
3818
3818
|
serialize,
|
|
@@ -4316,11 +4316,11 @@ var require_core = __commonJS({
|
|
|
4316
4316
|
Ajv2.ValidationError = validation_error_1.default;
|
|
4317
4317
|
Ajv2.MissingRefError = ref_error_1.default;
|
|
4318
4318
|
exports.default = Ajv2;
|
|
4319
|
-
function checkOptions(checkOpts, options, msg,
|
|
4319
|
+
function checkOptions(checkOpts, options, msg, log4 = "error") {
|
|
4320
4320
|
for (const key in checkOpts) {
|
|
4321
4321
|
const opt = key;
|
|
4322
4322
|
if (opt in options)
|
|
4323
|
-
this.logger[
|
|
4323
|
+
this.logger[log4](`${msg}: option ${key}. ${checkOpts[opt]}`);
|
|
4324
4324
|
}
|
|
4325
4325
|
}
|
|
4326
4326
|
function getSchEnv(keyRef) {
|
|
@@ -6809,21 +6809,21 @@ __export(index_marker_store_exports, {
|
|
|
6809
6809
|
hasFreshIndexMarker: () => hasFreshIndexMarker,
|
|
6810
6810
|
writeIndexMarker: () => writeIndexMarker
|
|
6811
6811
|
});
|
|
6812
|
-
import { existsSync as existsSync2, mkdirSync as
|
|
6813
|
-
import { join as
|
|
6812
|
+
import { existsSync as existsSync2, mkdirSync as mkdirSync3, readFileSync as readFileSync4, writeFileSync as writeFileSync3 } from "node:fs";
|
|
6813
|
+
import { join as join5 } from "node:path";
|
|
6814
6814
|
import { tmpdir } from "node:os";
|
|
6815
6815
|
function getIndexMarkerDir() {
|
|
6816
|
-
return process.env.HIVEMIND_INDEX_MARKER_DIR ??
|
|
6816
|
+
return process.env.HIVEMIND_INDEX_MARKER_DIR ?? join5(tmpdir(), "hivemind-deeplake-indexes");
|
|
6817
6817
|
}
|
|
6818
6818
|
function buildIndexMarkerPath(workspaceId, orgId, table, suffix) {
|
|
6819
6819
|
const markerKey = [workspaceId, orgId, table, suffix].join("__").replace(/[^a-zA-Z0-9_.-]/g, "_");
|
|
6820
|
-
return
|
|
6820
|
+
return join5(getIndexMarkerDir(), `${markerKey}.json`);
|
|
6821
6821
|
}
|
|
6822
6822
|
function hasFreshIndexMarker(markerPath) {
|
|
6823
6823
|
if (!existsSync2(markerPath))
|
|
6824
6824
|
return false;
|
|
6825
6825
|
try {
|
|
6826
|
-
const raw = JSON.parse(
|
|
6826
|
+
const raw = JSON.parse(readFileSync4(markerPath, "utf-8"));
|
|
6827
6827
|
const updatedAt = raw.updatedAt ? new Date(raw.updatedAt).getTime() : NaN;
|
|
6828
6828
|
if (!Number.isFinite(updatedAt) || Date.now() - updatedAt > INDEX_MARKER_TTL_MS)
|
|
6829
6829
|
return false;
|
|
@@ -6833,8 +6833,8 @@ function hasFreshIndexMarker(markerPath) {
|
|
|
6833
6833
|
}
|
|
6834
6834
|
}
|
|
6835
6835
|
function writeIndexMarker(markerPath) {
|
|
6836
|
-
|
|
6837
|
-
|
|
6836
|
+
mkdirSync3(getIndexMarkerDir(), { recursive: true });
|
|
6837
|
+
writeFileSync3(markerPath, JSON.stringify({ updatedAt: (/* @__PURE__ */ new Date()).toISOString() }), "utf-8");
|
|
6838
6838
|
}
|
|
6839
6839
|
var INDEX_MARKER_TTL_MS;
|
|
6840
6840
|
var init_index_marker_store = __esm({
|
|
@@ -21144,7 +21144,7 @@ var Protocol = class {
|
|
|
21144
21144
|
return;
|
|
21145
21145
|
}
|
|
21146
21146
|
const pollInterval = task2.pollInterval ?? this._options?.defaultTaskPollInterval ?? 1e3;
|
|
21147
|
-
await new Promise((
|
|
21147
|
+
await new Promise((resolve2) => setTimeout(resolve2, pollInterval));
|
|
21148
21148
|
options?.signal?.throwIfAborted();
|
|
21149
21149
|
}
|
|
21150
21150
|
} catch (error2) {
|
|
@@ -21161,7 +21161,7 @@ var Protocol = class {
|
|
|
21161
21161
|
*/
|
|
21162
21162
|
request(request, resultSchema, options) {
|
|
21163
21163
|
const { relatedRequestId, resumptionToken, onresumptiontoken, task, relatedTask } = options ?? {};
|
|
21164
|
-
return new Promise((
|
|
21164
|
+
return new Promise((resolve2, reject) => {
|
|
21165
21165
|
const earlyReject = (error2) => {
|
|
21166
21166
|
reject(error2);
|
|
21167
21167
|
};
|
|
@@ -21239,7 +21239,7 @@ var Protocol = class {
|
|
|
21239
21239
|
if (!parseResult.success) {
|
|
21240
21240
|
reject(parseResult.error);
|
|
21241
21241
|
} else {
|
|
21242
|
-
|
|
21242
|
+
resolve2(parseResult.data);
|
|
21243
21243
|
}
|
|
21244
21244
|
} catch (error2) {
|
|
21245
21245
|
reject(error2);
|
|
@@ -21500,12 +21500,12 @@ var Protocol = class {
|
|
|
21500
21500
|
}
|
|
21501
21501
|
} catch {
|
|
21502
21502
|
}
|
|
21503
|
-
return new Promise((
|
|
21503
|
+
return new Promise((resolve2, reject) => {
|
|
21504
21504
|
if (signal.aborted) {
|
|
21505
21505
|
reject(new McpError(ErrorCode.InvalidRequest, "Request cancelled"));
|
|
21506
21506
|
return;
|
|
21507
21507
|
}
|
|
21508
|
-
const timeoutId = setTimeout(
|
|
21508
|
+
const timeoutId = setTimeout(resolve2, interval);
|
|
21509
21509
|
signal.addEventListener("abort", () => {
|
|
21510
21510
|
clearTimeout(timeoutId);
|
|
21511
21511
|
reject(new McpError(ErrorCode.InvalidRequest, "Request cancelled"));
|
|
@@ -22605,7 +22605,7 @@ var McpServer = class {
|
|
|
22605
22605
|
let task = createTaskResult.task;
|
|
22606
22606
|
const pollInterval = task.pollInterval ?? 5e3;
|
|
22607
22607
|
while (task.status !== "completed" && task.status !== "failed" && task.status !== "cancelled") {
|
|
22608
|
-
await new Promise((
|
|
22608
|
+
await new Promise((resolve2) => setTimeout(resolve2, pollInterval));
|
|
22609
22609
|
const updatedTask = await extra.taskStore.getTask(taskId);
|
|
22610
22610
|
if (!updatedTask) {
|
|
22611
22611
|
throw new McpError(ErrorCode.InternalError, `Task ${taskId} not found during polling`);
|
|
@@ -23254,12 +23254,12 @@ var StdioServerTransport = class {
|
|
|
23254
23254
|
this.onclose?.();
|
|
23255
23255
|
}
|
|
23256
23256
|
send(message) {
|
|
23257
|
-
return new Promise((
|
|
23257
|
+
return new Promise((resolve2) => {
|
|
23258
23258
|
const json2 = serializeMessage(message);
|
|
23259
23259
|
if (this._stdout.write(json2)) {
|
|
23260
|
-
|
|
23260
|
+
resolve2();
|
|
23261
23261
|
} else {
|
|
23262
|
-
this._stdout.once("drain",
|
|
23262
|
+
this._stdout.once("drain", resolve2);
|
|
23263
23263
|
}
|
|
23264
23264
|
});
|
|
23265
23265
|
}
|
|
@@ -23364,6 +23364,107 @@ function sqlIdent(name) {
|
|
|
23364
23364
|
var SUMMARY_EMBEDDING_COL = "summary_embedding";
|
|
23365
23365
|
var MESSAGE_EMBEDDING_COL = "message_embedding";
|
|
23366
23366
|
|
|
23367
|
+
// dist/src/notifications/queue.js
|
|
23368
|
+
import { readFileSync as readFileSync3, writeFileSync as writeFileSync2, renameSync, mkdirSync as mkdirSync2, openSync, closeSync, unlinkSync as unlinkSync2, statSync } from "node:fs";
|
|
23369
|
+
import { join as join4, resolve } from "node:path";
|
|
23370
|
+
import { homedir as homedir4 } from "node:os";
|
|
23371
|
+
import { setTimeout as sleep } from "node:timers/promises";
|
|
23372
|
+
var log2 = (msg) => log("notifications-queue", msg);
|
|
23373
|
+
var LOCK_RETRY_MAX = 50;
|
|
23374
|
+
var LOCK_RETRY_BASE_MS = 5;
|
|
23375
|
+
var LOCK_STALE_MS = 5e3;
|
|
23376
|
+
function queuePath() {
|
|
23377
|
+
return join4(homedir4(), ".deeplake", "notifications-queue.json");
|
|
23378
|
+
}
|
|
23379
|
+
function lockPath() {
|
|
23380
|
+
return `${queuePath()}.lock`;
|
|
23381
|
+
}
|
|
23382
|
+
function readQueue() {
|
|
23383
|
+
try {
|
|
23384
|
+
const raw = readFileSync3(queuePath(), "utf-8");
|
|
23385
|
+
const parsed = JSON.parse(raw);
|
|
23386
|
+
if (!parsed || !Array.isArray(parsed.queue)) {
|
|
23387
|
+
log2(`queue malformed \u2192 treating as empty`);
|
|
23388
|
+
return { queue: [] };
|
|
23389
|
+
}
|
|
23390
|
+
return { queue: parsed.queue };
|
|
23391
|
+
} catch {
|
|
23392
|
+
return { queue: [] };
|
|
23393
|
+
}
|
|
23394
|
+
}
|
|
23395
|
+
function _isQueuePathInsideHome(path, home) {
|
|
23396
|
+
const r = resolve(path);
|
|
23397
|
+
const h = resolve(home);
|
|
23398
|
+
return r.startsWith(h + "/") || r === h;
|
|
23399
|
+
}
|
|
23400
|
+
function writeQueue(q) {
|
|
23401
|
+
const path = queuePath();
|
|
23402
|
+
const home = resolve(homedir4());
|
|
23403
|
+
if (!_isQueuePathInsideHome(path, home)) {
|
|
23404
|
+
throw new Error(`notifications-queue write blocked: ${path} is outside ${home}`);
|
|
23405
|
+
}
|
|
23406
|
+
mkdirSync2(join4(home, ".deeplake"), { recursive: true, mode: 448 });
|
|
23407
|
+
const tmp = `${path}.${process.pid}.tmp`;
|
|
23408
|
+
writeFileSync2(tmp, JSON.stringify(q, null, 2), { mode: 384 });
|
|
23409
|
+
renameSync(tmp, path);
|
|
23410
|
+
}
|
|
23411
|
+
async function withQueueLock(fn) {
|
|
23412
|
+
const path = lockPath();
|
|
23413
|
+
mkdirSync2(join4(homedir4(), ".deeplake"), { recursive: true, mode: 448 });
|
|
23414
|
+
let fd = null;
|
|
23415
|
+
for (let attempt = 0; attempt < LOCK_RETRY_MAX; attempt++) {
|
|
23416
|
+
try {
|
|
23417
|
+
fd = openSync(path, "wx", 384);
|
|
23418
|
+
break;
|
|
23419
|
+
} catch (e) {
|
|
23420
|
+
const code = e.code;
|
|
23421
|
+
if (code !== "EEXIST")
|
|
23422
|
+
throw e;
|
|
23423
|
+
try {
|
|
23424
|
+
const age = Date.now() - statSync(path).mtimeMs;
|
|
23425
|
+
if (age > LOCK_STALE_MS) {
|
|
23426
|
+
unlinkSync2(path);
|
|
23427
|
+
continue;
|
|
23428
|
+
}
|
|
23429
|
+
} catch {
|
|
23430
|
+
}
|
|
23431
|
+
const delay = LOCK_RETRY_BASE_MS * (attempt + 1);
|
|
23432
|
+
await sleep(delay);
|
|
23433
|
+
}
|
|
23434
|
+
}
|
|
23435
|
+
if (fd === null) {
|
|
23436
|
+
log2(`lock acquisition gave up after ${LOCK_RETRY_MAX} attempts \u2014 proceeding unlocked (last-writer-wins)`);
|
|
23437
|
+
return fn();
|
|
23438
|
+
}
|
|
23439
|
+
try {
|
|
23440
|
+
return fn();
|
|
23441
|
+
} finally {
|
|
23442
|
+
try {
|
|
23443
|
+
closeSync(fd);
|
|
23444
|
+
} catch {
|
|
23445
|
+
}
|
|
23446
|
+
try {
|
|
23447
|
+
unlinkSync2(path);
|
|
23448
|
+
} catch {
|
|
23449
|
+
}
|
|
23450
|
+
}
|
|
23451
|
+
}
|
|
23452
|
+
function sameDedupKey(a, b) {
|
|
23453
|
+
if (a.id !== b.id)
|
|
23454
|
+
return false;
|
|
23455
|
+
return JSON.stringify(a.dedupKey) === JSON.stringify(b.dedupKey);
|
|
23456
|
+
}
|
|
23457
|
+
async function enqueueNotification(n) {
|
|
23458
|
+
await withQueueLock(() => {
|
|
23459
|
+
const q = readQueue();
|
|
23460
|
+
if (q.queue.some((existing) => sameDedupKey(existing, n))) {
|
|
23461
|
+
return;
|
|
23462
|
+
}
|
|
23463
|
+
q.queue.push(n);
|
|
23464
|
+
writeQueue(q);
|
|
23465
|
+
});
|
|
23466
|
+
}
|
|
23467
|
+
|
|
23367
23468
|
// dist/src/deeplake-api.js
|
|
23368
23469
|
var indexMarkerStorePromise = null;
|
|
23369
23470
|
function getIndexMarkerStore() {
|
|
@@ -23371,7 +23472,7 @@ function getIndexMarkerStore() {
|
|
|
23371
23472
|
indexMarkerStorePromise = Promise.resolve().then(() => (init_index_marker_store(), index_marker_store_exports));
|
|
23372
23473
|
return indexMarkerStorePromise;
|
|
23373
23474
|
}
|
|
23374
|
-
var
|
|
23475
|
+
var log3 = (msg) => log("sdk", msg);
|
|
23375
23476
|
function summarizeSql(sql, maxLen = 220) {
|
|
23376
23477
|
const compact = sql.replace(/\s+/g, " ").trim();
|
|
23377
23478
|
return compact.length > maxLen ? `${compact.slice(0, maxLen)}...` : compact;
|
|
@@ -23383,7 +23484,38 @@ function traceSql(msg) {
|
|
|
23383
23484
|
process.stderr.write(`[deeplake-sql] ${msg}
|
|
23384
23485
|
`);
|
|
23385
23486
|
if (process.env.HIVEMIND_DEBUG === "1")
|
|
23386
|
-
|
|
23487
|
+
log3(msg);
|
|
23488
|
+
}
|
|
23489
|
+
var _signalledBalanceExhausted = false;
|
|
23490
|
+
function maybeSignalBalanceExhausted(status, bodyText) {
|
|
23491
|
+
if (status !== 402)
|
|
23492
|
+
return;
|
|
23493
|
+
if (!bodyText.includes("balance_cents"))
|
|
23494
|
+
return;
|
|
23495
|
+
if (_signalledBalanceExhausted)
|
|
23496
|
+
return;
|
|
23497
|
+
_signalledBalanceExhausted = true;
|
|
23498
|
+
log3(`balance exhausted \u2014 enqueuing session-start banner (body=${bodyText.slice(0, 120)})`);
|
|
23499
|
+
enqueueNotification({
|
|
23500
|
+
id: "balance-exhausted",
|
|
23501
|
+
severity: "warn",
|
|
23502
|
+
transient: true,
|
|
23503
|
+
title: "Hivemind credits exhausted \u2014 top up to keep capturing",
|
|
23504
|
+
body: `Sessions are not being saved and memory recall is returning empty. Top up at ${billingUrl()} to restore capture and recall.`,
|
|
23505
|
+
dedupKey: { reason: "balance-zero" }
|
|
23506
|
+
}).catch((e) => {
|
|
23507
|
+
log3(`enqueue balance-exhausted failed: ${e instanceof Error ? e.message : String(e)}`);
|
|
23508
|
+
});
|
|
23509
|
+
}
|
|
23510
|
+
function billingUrl() {
|
|
23511
|
+
try {
|
|
23512
|
+
const c = loadCredentials();
|
|
23513
|
+
if (c?.orgName && c?.workspaceId) {
|
|
23514
|
+
return `https://deeplake.ai/${encodeURIComponent(c.orgName)}/workspace/${encodeURIComponent(c.workspaceId)}/billing`;
|
|
23515
|
+
}
|
|
23516
|
+
} catch {
|
|
23517
|
+
}
|
|
23518
|
+
return "https://deeplake.ai";
|
|
23387
23519
|
}
|
|
23388
23520
|
var RETRYABLE_CODES = /* @__PURE__ */ new Set([429, 500, 502, 503, 504]);
|
|
23389
23521
|
var MAX_RETRIES = 3;
|
|
@@ -23392,8 +23524,8 @@ var MAX_CONCURRENCY = 5;
|
|
|
23392
23524
|
function getQueryTimeoutMs() {
|
|
23393
23525
|
return Number(process.env.HIVEMIND_QUERY_TIMEOUT_MS ?? 1e4);
|
|
23394
23526
|
}
|
|
23395
|
-
function
|
|
23396
|
-
return new Promise((
|
|
23527
|
+
function sleep2(ms) {
|
|
23528
|
+
return new Promise((resolve2) => setTimeout(resolve2, ms));
|
|
23397
23529
|
}
|
|
23398
23530
|
function isTimeoutError(error2) {
|
|
23399
23531
|
const name = error2 instanceof Error ? error2.name.toLowerCase() : "";
|
|
@@ -23423,7 +23555,7 @@ var Semaphore = class {
|
|
|
23423
23555
|
this.active++;
|
|
23424
23556
|
return;
|
|
23425
23557
|
}
|
|
23426
|
-
await new Promise((
|
|
23558
|
+
await new Promise((resolve2) => this.waiting.push(resolve2));
|
|
23427
23559
|
}
|
|
23428
23560
|
release() {
|
|
23429
23561
|
this.active--;
|
|
@@ -23494,8 +23626,8 @@ var DeeplakeApi = class {
|
|
|
23494
23626
|
lastError = e instanceof Error ? e : new Error(String(e));
|
|
23495
23627
|
if (attempt < MAX_RETRIES) {
|
|
23496
23628
|
const delay = BASE_DELAY_MS * Math.pow(2, attempt) + Math.random() * 200;
|
|
23497
|
-
|
|
23498
|
-
await
|
|
23629
|
+
log3(`query retry ${attempt + 1}/${MAX_RETRIES} (fetch error: ${lastError.message}) in ${delay.toFixed(0)}ms`);
|
|
23630
|
+
await sleep2(delay);
|
|
23499
23631
|
continue;
|
|
23500
23632
|
}
|
|
23501
23633
|
throw lastError;
|
|
@@ -23511,10 +23643,11 @@ var DeeplakeApi = class {
|
|
|
23511
23643
|
const alreadyExists = resp.status === 500 && isDuplicateIndexError(text);
|
|
23512
23644
|
if (!alreadyExists && attempt < MAX_RETRIES && (RETRYABLE_CODES.has(resp.status) || retryable403)) {
|
|
23513
23645
|
const delay = BASE_DELAY_MS * Math.pow(2, attempt) + Math.random() * 200;
|
|
23514
|
-
|
|
23515
|
-
await
|
|
23646
|
+
log3(`query retry ${attempt + 1}/${MAX_RETRIES} (${resp.status}) in ${delay.toFixed(0)}ms`);
|
|
23647
|
+
await sleep2(delay);
|
|
23516
23648
|
continue;
|
|
23517
23649
|
}
|
|
23650
|
+
maybeSignalBalanceExhausted(resp.status, text);
|
|
23518
23651
|
throw new Error(`Query failed: ${resp.status}: ${text.slice(0, 200)}`);
|
|
23519
23652
|
}
|
|
23520
23653
|
throw lastError ?? new Error("Query failed: max retries exceeded");
|
|
@@ -23535,7 +23668,7 @@ var DeeplakeApi = class {
|
|
|
23535
23668
|
const chunk = rows.slice(i, i + CONCURRENCY);
|
|
23536
23669
|
await Promise.allSettled(chunk.map((r) => this.upsertRowSql(r)));
|
|
23537
23670
|
}
|
|
23538
|
-
|
|
23671
|
+
log3(`commit: ${rows.length} rows`);
|
|
23539
23672
|
}
|
|
23540
23673
|
async upsertRowSql(row) {
|
|
23541
23674
|
const ts = (/* @__PURE__ */ new Date()).toISOString();
|
|
@@ -23591,7 +23724,7 @@ var DeeplakeApi = class {
|
|
|
23591
23724
|
markers.writeIndexMarker(markerPath);
|
|
23592
23725
|
return;
|
|
23593
23726
|
}
|
|
23594
|
-
|
|
23727
|
+
log3(`index "${indexName}" skipped: ${e.message}`);
|
|
23595
23728
|
}
|
|
23596
23729
|
}
|
|
23597
23730
|
/**
|
|
@@ -23681,13 +23814,13 @@ var DeeplakeApi = class {
|
|
|
23681
23814
|
};
|
|
23682
23815
|
}
|
|
23683
23816
|
if (attempt < MAX_RETRIES && RETRYABLE_CODES.has(resp.status)) {
|
|
23684
|
-
await
|
|
23817
|
+
await sleep2(BASE_DELAY_MS * Math.pow(2, attempt) + Math.random() * 200);
|
|
23685
23818
|
continue;
|
|
23686
23819
|
}
|
|
23687
23820
|
return { tables: [], cacheable: false };
|
|
23688
23821
|
} catch {
|
|
23689
23822
|
if (attempt < MAX_RETRIES) {
|
|
23690
|
-
await
|
|
23823
|
+
await sleep2(BASE_DELAY_MS * Math.pow(2, attempt));
|
|
23691
23824
|
continue;
|
|
23692
23825
|
}
|
|
23693
23826
|
return { tables: [], cacheable: false };
|
|
@@ -23715,9 +23848,9 @@ var DeeplakeApi = class {
|
|
|
23715
23848
|
} catch (err) {
|
|
23716
23849
|
lastErr = err;
|
|
23717
23850
|
const msg = err instanceof Error ? err.message : String(err);
|
|
23718
|
-
|
|
23851
|
+
log3(`CREATE TABLE "${label}" attempt ${attempt + 1}/${OUTER_BACKOFFS_MS.length + 1} failed: ${msg}`);
|
|
23719
23852
|
if (attempt < OUTER_BACKOFFS_MS.length) {
|
|
23720
|
-
await
|
|
23853
|
+
await sleep2(OUTER_BACKOFFS_MS[attempt]);
|
|
23721
23854
|
}
|
|
23722
23855
|
}
|
|
23723
23856
|
}
|
|
@@ -23728,9 +23861,9 @@ var DeeplakeApi = class {
|
|
|
23728
23861
|
const tbl = sqlIdent(name ?? this.tableName);
|
|
23729
23862
|
const tables = await this.listTables();
|
|
23730
23863
|
if (!tables.includes(tbl)) {
|
|
23731
|
-
|
|
23864
|
+
log3(`table "${tbl}" not found, creating`);
|
|
23732
23865
|
await this.createTableWithRetry(`CREATE TABLE IF NOT EXISTS "${tbl}" (id TEXT NOT NULL DEFAULT '', path TEXT NOT NULL DEFAULT '', filename TEXT NOT NULL DEFAULT '', summary TEXT NOT NULL DEFAULT '', summary_embedding FLOAT4[], author TEXT NOT NULL DEFAULT '', mime_type TEXT NOT NULL DEFAULT 'text/plain', size_bytes BIGINT NOT NULL DEFAULT 0, project TEXT NOT NULL DEFAULT '', description TEXT NOT NULL DEFAULT '', agent TEXT NOT NULL DEFAULT '', plugin_version TEXT NOT NULL DEFAULT '', creation_date TEXT NOT NULL DEFAULT '', last_update_date TEXT NOT NULL DEFAULT '') USING deeplake`, tbl);
|
|
23733
|
-
|
|
23866
|
+
log3(`table "${tbl}" created`);
|
|
23734
23867
|
if (!tables.includes(tbl))
|
|
23735
23868
|
this._tablesCache = [...tables, tbl];
|
|
23736
23869
|
}
|
|
@@ -23743,9 +23876,9 @@ var DeeplakeApi = class {
|
|
|
23743
23876
|
const safe = sqlIdent(name);
|
|
23744
23877
|
const tables = await this.listTables();
|
|
23745
23878
|
if (!tables.includes(safe)) {
|
|
23746
|
-
|
|
23879
|
+
log3(`table "${safe}" not found, creating`);
|
|
23747
23880
|
await this.createTableWithRetry(`CREATE TABLE IF NOT EXISTS "${safe}" (id TEXT NOT NULL DEFAULT '', path TEXT NOT NULL DEFAULT '', filename TEXT NOT NULL DEFAULT '', message JSONB, message_embedding FLOAT4[], author TEXT NOT NULL DEFAULT '', mime_type TEXT NOT NULL DEFAULT 'application/json', size_bytes BIGINT NOT NULL DEFAULT 0, project TEXT NOT NULL DEFAULT '', description TEXT NOT NULL DEFAULT '', agent TEXT NOT NULL DEFAULT '', plugin_version TEXT NOT NULL DEFAULT '', creation_date TEXT NOT NULL DEFAULT '', last_update_date TEXT NOT NULL DEFAULT '') USING deeplake`, safe);
|
|
23748
|
-
|
|
23881
|
+
log3(`table "${safe}" created`);
|
|
23749
23882
|
if (!tables.includes(safe))
|
|
23750
23883
|
this._tablesCache = [...tables, safe];
|
|
23751
23884
|
}
|
|
@@ -23768,9 +23901,9 @@ var DeeplakeApi = class {
|
|
|
23768
23901
|
const safe = sqlIdent(name);
|
|
23769
23902
|
const tables = await this.listTables();
|
|
23770
23903
|
if (!tables.includes(safe)) {
|
|
23771
|
-
|
|
23904
|
+
log3(`table "${safe}" not found, creating`);
|
|
23772
23905
|
await this.createTableWithRetry(`CREATE TABLE IF NOT EXISTS "${safe}" (id TEXT NOT NULL DEFAULT '', name TEXT NOT NULL DEFAULT '', project TEXT NOT NULL DEFAULT '', project_key TEXT NOT NULL DEFAULT '', local_path TEXT NOT NULL DEFAULT '', install TEXT NOT NULL DEFAULT 'project', source_sessions TEXT NOT NULL DEFAULT '[]', source_agent TEXT NOT NULL DEFAULT '', scope TEXT NOT NULL DEFAULT 'me', author TEXT NOT NULL DEFAULT '', description TEXT NOT NULL DEFAULT '', trigger_text TEXT NOT NULL DEFAULT '', body TEXT NOT NULL DEFAULT '', version BIGINT NOT NULL DEFAULT 1, created_at TEXT NOT NULL DEFAULT '', updated_at TEXT NOT NULL DEFAULT '') USING deeplake`, safe);
|
|
23773
|
-
|
|
23906
|
+
log3(`table "${safe}" created`);
|
|
23774
23907
|
if (!tables.includes(safe))
|
|
23775
23908
|
this._tablesCache = [...tables, safe];
|
|
23776
23909
|
}
|
|
@@ -24153,20 +24286,20 @@ function buildContentFilter(column, likeOp, patterns) {
|
|
|
24153
24286
|
}
|
|
24154
24287
|
|
|
24155
24288
|
// dist/src/cli/version.js
|
|
24156
|
-
import { readFileSync as
|
|
24157
|
-
import { join as
|
|
24289
|
+
import { readFileSync as readFileSync6 } from "node:fs";
|
|
24290
|
+
import { join as join7 } from "node:path";
|
|
24158
24291
|
|
|
24159
24292
|
// dist/src/cli/util.js
|
|
24160
|
-
import { existsSync as existsSync3, mkdirSync as
|
|
24161
|
-
import { join as
|
|
24162
|
-
import { homedir as
|
|
24293
|
+
import { existsSync as existsSync3, mkdirSync as mkdirSync4, readFileSync as readFileSync5, writeFileSync as writeFileSync4, cpSync, symlinkSync, unlinkSync as unlinkSync3, lstatSync } from "node:fs";
|
|
24294
|
+
import { join as join6, dirname } from "node:path";
|
|
24295
|
+
import { homedir as homedir5 } from "node:os";
|
|
24163
24296
|
import { fileURLToPath } from "node:url";
|
|
24164
|
-
var HOME =
|
|
24297
|
+
var HOME = homedir5();
|
|
24165
24298
|
function pkgRoot() {
|
|
24166
24299
|
let dir = fileURLToPath(new URL(".", import.meta.url));
|
|
24167
24300
|
for (let i = 0; i < 8; i++) {
|
|
24168
24301
|
try {
|
|
24169
|
-
const pkg = JSON.parse(
|
|
24302
|
+
const pkg = JSON.parse(readFileSync5(join6(dir, "package.json"), "utf-8"));
|
|
24170
24303
|
if (pkg.name === "@deeplake/hivemind" || pkg.name === "hivemind")
|
|
24171
24304
|
return dir;
|
|
24172
24305
|
} catch {
|
|
@@ -24179,21 +24312,21 @@ function pkgRoot() {
|
|
|
24179
24312
|
return fileURLToPath(new URL("..", import.meta.url));
|
|
24180
24313
|
}
|
|
24181
24314
|
var PLATFORM_MARKERS = [
|
|
24182
|
-
{ id: "claude", markerDir:
|
|
24183
|
-
{ id: "codex", markerDir:
|
|
24184
|
-
{ id: "claw", markerDir:
|
|
24185
|
-
{ id: "cursor", markerDir:
|
|
24186
|
-
{ id: "hermes", markerDir:
|
|
24315
|
+
{ id: "claude", markerDir: join6(HOME, ".claude") },
|
|
24316
|
+
{ id: "codex", markerDir: join6(HOME, ".codex") },
|
|
24317
|
+
{ id: "claw", markerDir: join6(HOME, ".openclaw") },
|
|
24318
|
+
{ id: "cursor", markerDir: join6(HOME, ".cursor") },
|
|
24319
|
+
{ id: "hermes", markerDir: join6(HOME, ".hermes") },
|
|
24187
24320
|
// pi (badlogic/pi-mono coding-agent) — config at ~/.pi/agent/. pi exposes
|
|
24188
24321
|
// a rich extension event API (session_start / input / tool_call /
|
|
24189
24322
|
// tool_result / message_end / session_shutdown / etc.) — Tier 1 capable.
|
|
24190
|
-
{ id: "pi", markerDir:
|
|
24323
|
+
{ id: "pi", markerDir: join6(HOME, ".pi") }
|
|
24191
24324
|
];
|
|
24192
24325
|
|
|
24193
24326
|
// dist/src/cli/version.js
|
|
24194
24327
|
function getVersion() {
|
|
24195
24328
|
try {
|
|
24196
|
-
const pkg = JSON.parse(
|
|
24329
|
+
const pkg = JSON.parse(readFileSync6(join7(pkgRoot(), "package.json"), "utf-8"));
|
|
24197
24330
|
return pkg.version ?? "0.0.0";
|
|
24198
24331
|
} catch {
|
|
24199
24332
|
return "0.0.0";
|