@askexenow/exe-os 0.9.21 → 0.9.23
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/dist/bin/backfill-conversations.js +17 -4
- package/dist/bin/backfill-responses.js +17 -4
- package/dist/bin/backfill-vectors.js +2 -2
- package/dist/bin/cleanup-stale-review-tasks.js +17 -4
- package/dist/bin/cli.js +378 -171
- package/dist/bin/exe-assign.js +17 -4
- package/dist/bin/exe-boot.js +2 -2
- package/dist/bin/exe-dispatch.js +17 -4
- package/dist/bin/exe-doctor.js +2 -2
- package/dist/bin/exe-export-behaviors.js +17 -4
- package/dist/bin/exe-forget.js +17 -4
- package/dist/bin/exe-gateway.js +17 -4
- package/dist/bin/exe-heartbeat.js +17 -4
- package/dist/bin/exe-kill.js +17 -4
- package/dist/bin/exe-launch-agent.js +17 -4
- package/dist/bin/exe-pending-messages.js +17 -4
- package/dist/bin/exe-pending-notifications.js +17 -4
- package/dist/bin/exe-pending-reviews.js +17 -4
- package/dist/bin/exe-review.js +17 -4
- package/dist/bin/exe-search.js +23 -8
- package/dist/bin/exe-session-cleanup.js +17 -4
- package/dist/bin/exe-start-codex.js +209 -32
- package/dist/bin/exe-start-opencode.js +17 -4
- package/dist/bin/exe-status.js +17 -4
- package/dist/bin/exe-team.js +17 -4
- package/dist/bin/git-sweep.js +17 -4
- package/dist/bin/graph-backfill.js +17 -4
- package/dist/bin/graph-export.js +17 -4
- package/dist/bin/install.js +42 -0
- package/dist/bin/intercom-check.js +17 -4
- package/dist/bin/scan-tasks.js +17 -4
- package/dist/bin/shard-migrate.js +17 -4
- package/dist/bin/update.js +187 -42
- package/dist/gateway/index.js +17 -4
- package/dist/hooks/bug-report-worker.js +793 -150
- package/dist/hooks/codex-stop-task-finalizer.js +3020 -2375
- package/dist/hooks/commit-complete.js +156 -6
- package/dist/hooks/error-recall.js +23 -8
- package/dist/hooks/ingest.js +17 -4
- package/dist/hooks/instructions-loaded.js +17 -4
- package/dist/hooks/notification.js +17 -4
- package/dist/hooks/post-compact.js +17 -4
- package/dist/hooks/post-tool-combined.js +23 -8
- package/dist/hooks/pre-compact.js +156 -8
- package/dist/hooks/pre-tool-use.js +21 -12
- package/dist/hooks/prompt-submit.js +23 -8
- package/dist/hooks/session-end.js +156 -8
- package/dist/hooks/session-start.js +23 -8
- package/dist/hooks/stop.js +306 -9
- package/dist/hooks/subagent-stop.js +306 -9
- package/dist/hooks/summary-worker.js +2 -2
- package/dist/index.js +17 -4
- package/dist/lib/exe-daemon.js +37 -14
- package/dist/lib/hybrid-search.js +23 -8
- package/dist/lib/schedules.js +2 -2
- package/dist/lib/store.js +17 -4
- package/dist/mcp/server.js +36 -10
- package/dist/runtime/index.js +17 -4
- package/dist/tui/App.js +17 -4
- package/package.json +1 -1
|
@@ -1540,6 +1540,17 @@ var init_daemon_auth = __esm({
|
|
|
1540
1540
|
});
|
|
1541
1541
|
|
|
1542
1542
|
// src/lib/exe-daemon-client.ts
|
|
1543
|
+
var exe_daemon_client_exports = {};
|
|
1544
|
+
__export(exe_daemon_client_exports, {
|
|
1545
|
+
connectEmbedDaemon: () => connectEmbedDaemon,
|
|
1546
|
+
disconnectClient: () => disconnectClient,
|
|
1547
|
+
embedBatchViaClient: () => embedBatchViaClient,
|
|
1548
|
+
embedViaClient: () => embedViaClient,
|
|
1549
|
+
isClientConnected: () => isClientConnected,
|
|
1550
|
+
pingDaemon: () => pingDaemon,
|
|
1551
|
+
sendDaemonRequest: () => sendDaemonRequest,
|
|
1552
|
+
sendIngestRequest: () => sendIngestRequest
|
|
1553
|
+
});
|
|
1543
1554
|
import net from "net";
|
|
1544
1555
|
import os6 from "os";
|
|
1545
1556
|
import { spawn } from "child_process";
|
|
@@ -1928,6 +1939,15 @@ async function embedViaClient(text, priority = "high") {
|
|
|
1928
1939
|
);
|
|
1929
1940
|
return !result.error && result.vectors?.[0] ? result.vectors[0] : null;
|
|
1930
1941
|
}
|
|
1942
|
+
async function embedBatchViaClient(texts, priority = "high") {
|
|
1943
|
+
if (!_connected && !await connectEmbedDaemon()) return null;
|
|
1944
|
+
_requestCount++;
|
|
1945
|
+
const result = await retryThenRestart(
|
|
1946
|
+
() => sendRequest(texts, priority),
|
|
1947
|
+
"Batch embed"
|
|
1948
|
+
);
|
|
1949
|
+
return !result.error && result.vectors ? result.vectors : null;
|
|
1950
|
+
}
|
|
1931
1951
|
function disconnectClient() {
|
|
1932
1952
|
if (_socket) {
|
|
1933
1953
|
_socket.destroy();
|
|
@@ -1944,6 +1964,17 @@ function disconnectClient() {
|
|
|
1944
1964
|
function isClientConnected() {
|
|
1945
1965
|
return _connected;
|
|
1946
1966
|
}
|
|
1967
|
+
function sendIngestRequest(payload) {
|
|
1968
|
+
if (!_socket || !_connected) return false;
|
|
1969
|
+
try {
|
|
1970
|
+
const id = randomUUID();
|
|
1971
|
+
const token = process.env[DAEMON_TOKEN_ENV] ?? readDaemonToken();
|
|
1972
|
+
_socket.write(JSON.stringify({ id, token, type: "ingest", ...payload }) + "\n");
|
|
1973
|
+
return true;
|
|
1974
|
+
} catch {
|
|
1975
|
+
return false;
|
|
1976
|
+
}
|
|
1977
|
+
}
|
|
1947
1978
|
var SOCKET_PATH, PID_PATH, SPAWN_LOCK_PATH, SPAWN_LOCK_STALE_MS, CONNECT_TIMEOUT_MS, REQUEST_TIMEOUT_MS, DAEMON_TOKEN_ENV, _socket, _connected, _buffer, _requestCount, _consecutiveFailures, HEALTH_CHECK_INTERVAL, MAX_RETRIES_BEFORE_RESTART, RETRY_DELAYS_MS, MIN_DAEMON_AGE_MS, _pending, MAX_BUFFER;
|
|
1948
1979
|
var init_exe_daemon_client = __esm({
|
|
1949
1980
|
"src/lib/exe-daemon-client.ts"() {
|
|
@@ -1972,6 +2003,15 @@ var init_exe_daemon_client = __esm({
|
|
|
1972
2003
|
});
|
|
1973
2004
|
|
|
1974
2005
|
// src/lib/daemon-protocol.ts
|
|
2006
|
+
var daemon_protocol_exports = {};
|
|
2007
|
+
__export(daemon_protocol_exports, {
|
|
2008
|
+
deserializeArgs: () => deserializeArgs,
|
|
2009
|
+
deserializeResultSet: () => deserializeResultSet,
|
|
2010
|
+
deserializeValue: () => deserializeValue,
|
|
2011
|
+
serializeArgs: () => serializeArgs,
|
|
2012
|
+
serializeResultSet: () => serializeResultSet,
|
|
2013
|
+
serializeValue: () => serializeValue
|
|
2014
|
+
});
|
|
1975
2015
|
function serializeValue(v) {
|
|
1976
2016
|
if (v === null || v === void 0) return null;
|
|
1977
2017
|
if (typeof v === "bigint") return Number(v);
|
|
@@ -1996,6 +2036,32 @@ function deserializeValue(v) {
|
|
|
1996
2036
|
}
|
|
1997
2037
|
return v;
|
|
1998
2038
|
}
|
|
2039
|
+
function serializeArgs(args) {
|
|
2040
|
+
return args.map(serializeValue);
|
|
2041
|
+
}
|
|
2042
|
+
function deserializeArgs(args) {
|
|
2043
|
+
return args.map(deserializeValue);
|
|
2044
|
+
}
|
|
2045
|
+
function serializeResultSet(rs) {
|
|
2046
|
+
const rows = [];
|
|
2047
|
+
for (const row of rs.rows) {
|
|
2048
|
+
const obj = {};
|
|
2049
|
+
for (let i = 0; i < rs.columns.length; i++) {
|
|
2050
|
+
const col = rs.columns[i];
|
|
2051
|
+
if (col !== void 0) {
|
|
2052
|
+
obj[col] = serializeValue(row[i]);
|
|
2053
|
+
}
|
|
2054
|
+
}
|
|
2055
|
+
rows.push(obj);
|
|
2056
|
+
}
|
|
2057
|
+
return {
|
|
2058
|
+
columns: [...rs.columns],
|
|
2059
|
+
columnTypes: [...rs.columnTypes ?? []],
|
|
2060
|
+
rows,
|
|
2061
|
+
rowsAffected: typeof rs.rowsAffected === "bigint" ? Number(rs.rowsAffected) : rs.rowsAffected ?? 0,
|
|
2062
|
+
lastInsertRowid: rs.lastInsertRowid != null ? typeof rs.lastInsertRowid === "bigint" ? Number(rs.lastInsertRowid) : rs.lastInsertRowid : null
|
|
2063
|
+
};
|
|
2064
|
+
}
|
|
1999
2065
|
function deserializeResultSet(srs) {
|
|
2000
2066
|
const rows = srs.rows.map((obj) => {
|
|
2001
2067
|
const values = srs.columns.map(
|
|
@@ -6552,8 +6618,8 @@ function getShardClient(projectName) {
|
|
|
6552
6618
|
throw new Error("Shard manager not initialized. Call initShardManager() first.");
|
|
6553
6619
|
}
|
|
6554
6620
|
const safeName = projectName.replace(/[^a-zA-Z0-9_-]/g, "_");
|
|
6555
|
-
if (!safeName) {
|
|
6556
|
-
throw new Error(`Invalid project name for shard: "${projectName}"`);
|
|
6621
|
+
if (!safeName || safeName === "unknown") {
|
|
6622
|
+
throw new Error(`Invalid project name for shard: "${projectName}" (resolved to "${safeName}")`);
|
|
6557
6623
|
}
|
|
6558
6624
|
const cached = _shards.get(safeName);
|
|
6559
6625
|
if (cached) {
|
|
@@ -7422,19 +7488,32 @@ async function flushBatch() {
|
|
|
7422
7488
|
const { isShardingEnabled: isShardingEnabled2, getReadyShardClient: getReadyShardClient2 } = await Promise.resolve().then(() => (init_shard_manager(), shard_manager_exports));
|
|
7423
7489
|
if (isShardingEnabled2()) {
|
|
7424
7490
|
const byProject = /* @__PURE__ */ new Map();
|
|
7491
|
+
let skippedUnknown = 0;
|
|
7425
7492
|
for (const row of batch) {
|
|
7426
|
-
const proj = row.project_name
|
|
7493
|
+
const proj = row.project_name?.trim();
|
|
7494
|
+
if (!proj) {
|
|
7495
|
+
skippedUnknown++;
|
|
7496
|
+
continue;
|
|
7497
|
+
}
|
|
7427
7498
|
if (!byProject.has(proj)) byProject.set(proj, []);
|
|
7428
7499
|
byProject.get(proj).push(row);
|
|
7429
7500
|
}
|
|
7501
|
+
if (skippedUnknown > 0) {
|
|
7502
|
+
process.stderr.write(
|
|
7503
|
+
`[store] Shard skip: ${skippedUnknown} record(s) with empty project_name (kept in main DB only)
|
|
7504
|
+
`
|
|
7505
|
+
);
|
|
7506
|
+
}
|
|
7430
7507
|
for (const [project, rows] of byProject) {
|
|
7431
7508
|
try {
|
|
7432
7509
|
const shardClient = await getReadyShardClient2(project);
|
|
7433
7510
|
const shardStmts = rows.map(buildStmt);
|
|
7434
7511
|
await shardClient.batch(shardStmts, "write");
|
|
7435
7512
|
} catch (err) {
|
|
7513
|
+
const fullError = err instanceof Error ? `${err.name}: ${err.message}${err.stack ? `
|
|
7514
|
+
${err.stack.split("\n").slice(1, 3).join("\n")}` : ""}` : String(err);
|
|
7436
7515
|
process.stderr.write(
|
|
7437
|
-
`[store] Shard write failed for ${project}
|
|
7516
|
+
`[store] Shard write failed for ${project} (${rows.length} records): ${fullError}
|
|
7438
7517
|
`
|
|
7439
7518
|
);
|
|
7440
7519
|
}
|
|
@@ -7673,6 +7752,77 @@ var init_store = __esm({
|
|
|
7673
7752
|
}
|
|
7674
7753
|
});
|
|
7675
7754
|
|
|
7755
|
+
// src/bin/fast-db-init.ts
|
|
7756
|
+
var fast_db_init_exports = {};
|
|
7757
|
+
__export(fast_db_init_exports, {
|
|
7758
|
+
fastDbInit: () => fastDbInit
|
|
7759
|
+
});
|
|
7760
|
+
async function fastDbInit() {
|
|
7761
|
+
const { isInitialized: isInitialized2, getClient: getClient2 } = await Promise.resolve().then(() => (init_database(), database_exports));
|
|
7762
|
+
if (isInitialized2()) {
|
|
7763
|
+
return getClient2();
|
|
7764
|
+
}
|
|
7765
|
+
try {
|
|
7766
|
+
const { connectEmbedDaemon: connectEmbedDaemon2, sendDaemonRequest: sendDaemonRequest2, isClientConnected: isClientConnected2 } = await Promise.resolve().then(() => (init_exe_daemon_client(), exe_daemon_client_exports));
|
|
7767
|
+
const { deserializeResultSet: deserializeResultSet2 } = await Promise.resolve().then(() => (init_daemon_protocol(), daemon_protocol_exports));
|
|
7768
|
+
await connectEmbedDaemon2();
|
|
7769
|
+
if (isClientConnected2()) {
|
|
7770
|
+
const daemonClient = {
|
|
7771
|
+
async execute(stmt) {
|
|
7772
|
+
const sql = typeof stmt === "string" ? stmt : stmt.sql;
|
|
7773
|
+
const args = typeof stmt === "string" ? [] : Array.isArray(stmt.args) ? stmt.args : [];
|
|
7774
|
+
const resp = await sendDaemonRequest2({ type: "db-execute", sql, args });
|
|
7775
|
+
if (resp.error) throw new Error(String(resp.error));
|
|
7776
|
+
if (resp.db) return deserializeResultSet2(resp.db);
|
|
7777
|
+
throw new Error("Unexpected daemon response");
|
|
7778
|
+
},
|
|
7779
|
+
async batch(stmts, mode) {
|
|
7780
|
+
const statements = stmts.map((s) => {
|
|
7781
|
+
const sql = typeof s === "string" ? s : s.sql;
|
|
7782
|
+
const args = typeof s === "string" ? [] : Array.isArray(s.args) ? s.args : [];
|
|
7783
|
+
return { sql, args };
|
|
7784
|
+
});
|
|
7785
|
+
const resp = await sendDaemonRequest2({ type: "db-batch", statements, mode: mode ?? "deferred" });
|
|
7786
|
+
if (resp.error) throw new Error(String(resp.error));
|
|
7787
|
+
const batchResults = resp["db-batch"];
|
|
7788
|
+
if (batchResults) return batchResults.map(deserializeResultSet2);
|
|
7789
|
+
throw new Error("Unexpected daemon batch response");
|
|
7790
|
+
},
|
|
7791
|
+
async transaction(_mode) {
|
|
7792
|
+
throw new Error("Transactions not supported via daemon socket");
|
|
7793
|
+
},
|
|
7794
|
+
async executeMultiple(_sql) {
|
|
7795
|
+
throw new Error("executeMultiple not supported via daemon socket");
|
|
7796
|
+
},
|
|
7797
|
+
async migrate(_stmts) {
|
|
7798
|
+
throw new Error("migrate not supported via daemon socket");
|
|
7799
|
+
},
|
|
7800
|
+
sync() {
|
|
7801
|
+
return Promise.resolve(void 0);
|
|
7802
|
+
},
|
|
7803
|
+
close() {
|
|
7804
|
+
},
|
|
7805
|
+
get closed() {
|
|
7806
|
+
return false;
|
|
7807
|
+
},
|
|
7808
|
+
get protocol() {
|
|
7809
|
+
return "file";
|
|
7810
|
+
}
|
|
7811
|
+
};
|
|
7812
|
+
return daemonClient;
|
|
7813
|
+
}
|
|
7814
|
+
} catch {
|
|
7815
|
+
}
|
|
7816
|
+
const { initStore: initStore2 } = await Promise.resolve().then(() => (init_store(), store_exports));
|
|
7817
|
+
await initStore2({ lightweight: true });
|
|
7818
|
+
return getClient2();
|
|
7819
|
+
}
|
|
7820
|
+
var init_fast_db_init = __esm({
|
|
7821
|
+
"src/bin/fast-db-init.ts"() {
|
|
7822
|
+
"use strict";
|
|
7823
|
+
}
|
|
7824
|
+
});
|
|
7825
|
+
|
|
7676
7826
|
// src/adapters/claude/hooks/commit-complete.ts
|
|
7677
7827
|
import { execSync as execSync8 } from "child_process";
|
|
7678
7828
|
|
|
@@ -7772,8 +7922,8 @@ async function main() {
|
|
|
7772
7922
|
}
|
|
7773
7923
|
const changedFiles = getChangedFiles(commitHash);
|
|
7774
7924
|
try {
|
|
7775
|
-
const {
|
|
7776
|
-
await
|
|
7925
|
+
const { fastDbInit: fastDbInit2 } = await Promise.resolve().then(() => (init_fast_db_init(), fast_db_init_exports));
|
|
7926
|
+
await fastDbInit2();
|
|
7777
7927
|
} catch {
|
|
7778
7928
|
process.stderr.write("[commit-complete] DB init failed \u2014 skipping\n");
|
|
7779
7929
|
return;
|
|
@@ -2914,8 +2914,8 @@ function getShardClient(projectName) {
|
|
|
2914
2914
|
throw new Error("Shard manager not initialized. Call initShardManager() first.");
|
|
2915
2915
|
}
|
|
2916
2916
|
const safeName = projectName.replace(/[^a-zA-Z0-9_-]/g, "_");
|
|
2917
|
-
if (!safeName) {
|
|
2918
|
-
throw new Error(`Invalid project name for shard: "${projectName}"`);
|
|
2917
|
+
if (!safeName || safeName === "unknown") {
|
|
2918
|
+
throw new Error(`Invalid project name for shard: "${projectName}" (resolved to "${safeName}")`);
|
|
2919
2919
|
}
|
|
2920
2920
|
const cached = _shards.get(safeName);
|
|
2921
2921
|
if (cached) {
|
|
@@ -3784,19 +3784,32 @@ async function flushBatch() {
|
|
|
3784
3784
|
const { isShardingEnabled: isShardingEnabled2, getReadyShardClient: getReadyShardClient2 } = await Promise.resolve().then(() => (init_shard_manager(), shard_manager_exports));
|
|
3785
3785
|
if (isShardingEnabled2()) {
|
|
3786
3786
|
const byProject = /* @__PURE__ */ new Map();
|
|
3787
|
+
let skippedUnknown = 0;
|
|
3787
3788
|
for (const row of batch) {
|
|
3788
|
-
const proj = row.project_name
|
|
3789
|
+
const proj = row.project_name?.trim();
|
|
3790
|
+
if (!proj) {
|
|
3791
|
+
skippedUnknown++;
|
|
3792
|
+
continue;
|
|
3793
|
+
}
|
|
3789
3794
|
if (!byProject.has(proj)) byProject.set(proj, []);
|
|
3790
3795
|
byProject.get(proj).push(row);
|
|
3791
3796
|
}
|
|
3797
|
+
if (skippedUnknown > 0) {
|
|
3798
|
+
process.stderr.write(
|
|
3799
|
+
`[store] Shard skip: ${skippedUnknown} record(s) with empty project_name (kept in main DB only)
|
|
3800
|
+
`
|
|
3801
|
+
);
|
|
3802
|
+
}
|
|
3792
3803
|
for (const [project, rows] of byProject) {
|
|
3793
3804
|
try {
|
|
3794
3805
|
const shardClient = await getReadyShardClient2(project);
|
|
3795
3806
|
const shardStmts = rows.map(buildStmt);
|
|
3796
3807
|
await shardClient.batch(shardStmts, "write");
|
|
3797
3808
|
} catch (err) {
|
|
3809
|
+
const fullError = err instanceof Error ? `${err.name}: ${err.message}${err.stack ? `
|
|
3810
|
+
${err.stack.split("\n").slice(1, 3).join("\n")}` : ""}` : String(err);
|
|
3798
3811
|
process.stderr.write(
|
|
3799
|
-
`[store] Shard write failed for ${project}
|
|
3812
|
+
`[store] Shard write failed for ${project} (${rows.length} records): ${fullError}
|
|
3800
3813
|
`
|
|
3801
3814
|
);
|
|
3802
3815
|
}
|
|
@@ -5322,10 +5335,12 @@ async function hybridSearch(queryText, agentId, options) {
|
|
|
5322
5335
|
);
|
|
5323
5336
|
}
|
|
5324
5337
|
let rerankerAvailable = false;
|
|
5325
|
-
|
|
5326
|
-
|
|
5327
|
-
|
|
5328
|
-
|
|
5338
|
+
if (process.env.EXE_IS_DAEMON === "1") {
|
|
5339
|
+
try {
|
|
5340
|
+
const { isRerankerAvailable: isRerankerAvailable2 } = await Promise.resolve().then(() => (init_reranker(), reranker_exports));
|
|
5341
|
+
rerankerAvailable = isRerankerAvailable2();
|
|
5342
|
+
} catch {
|
|
5343
|
+
}
|
|
5329
5344
|
}
|
|
5330
5345
|
const broadFetchTopK = config.scalingRoadmap?.rerankerAutoTrigger?.fetchTopK ?? 150;
|
|
5331
5346
|
const fetchLimit = effectiveIsBroad ? Math.max(limit * 5, broadFetchTopK) : rerankerAvailable ? Math.max(limit * 4, 60) : Math.max(limit * 3, 30);
|
package/dist/hooks/ingest.js
CHANGED
|
@@ -3090,8 +3090,8 @@ function getShardClient(projectName) {
|
|
|
3090
3090
|
throw new Error("Shard manager not initialized. Call initShardManager() first.");
|
|
3091
3091
|
}
|
|
3092
3092
|
const safeName = projectName.replace(/[^a-zA-Z0-9_-]/g, "_");
|
|
3093
|
-
if (!safeName) {
|
|
3094
|
-
throw new Error(`Invalid project name for shard: "${projectName}"`);
|
|
3093
|
+
if (!safeName || safeName === "unknown") {
|
|
3094
|
+
throw new Error(`Invalid project name for shard: "${projectName}" (resolved to "${safeName}")`);
|
|
3095
3095
|
}
|
|
3096
3096
|
const cached = _shards.get(safeName);
|
|
3097
3097
|
if (cached) {
|
|
@@ -3960,19 +3960,32 @@ async function flushBatch() {
|
|
|
3960
3960
|
const { isShardingEnabled: isShardingEnabled2, getReadyShardClient: getReadyShardClient2 } = await Promise.resolve().then(() => (init_shard_manager(), shard_manager_exports));
|
|
3961
3961
|
if (isShardingEnabled2()) {
|
|
3962
3962
|
const byProject = /* @__PURE__ */ new Map();
|
|
3963
|
+
let skippedUnknown = 0;
|
|
3963
3964
|
for (const row of batch) {
|
|
3964
|
-
const proj = row.project_name
|
|
3965
|
+
const proj = row.project_name?.trim();
|
|
3966
|
+
if (!proj) {
|
|
3967
|
+
skippedUnknown++;
|
|
3968
|
+
continue;
|
|
3969
|
+
}
|
|
3965
3970
|
if (!byProject.has(proj)) byProject.set(proj, []);
|
|
3966
3971
|
byProject.get(proj).push(row);
|
|
3967
3972
|
}
|
|
3973
|
+
if (skippedUnknown > 0) {
|
|
3974
|
+
process.stderr.write(
|
|
3975
|
+
`[store] Shard skip: ${skippedUnknown} record(s) with empty project_name (kept in main DB only)
|
|
3976
|
+
`
|
|
3977
|
+
);
|
|
3978
|
+
}
|
|
3968
3979
|
for (const [project, rows] of byProject) {
|
|
3969
3980
|
try {
|
|
3970
3981
|
const shardClient = await getReadyShardClient2(project);
|
|
3971
3982
|
const shardStmts = rows.map(buildStmt);
|
|
3972
3983
|
await shardClient.batch(shardStmts, "write");
|
|
3973
3984
|
} catch (err) {
|
|
3985
|
+
const fullError = err instanceof Error ? `${err.name}: ${err.message}${err.stack ? `
|
|
3986
|
+
${err.stack.split("\n").slice(1, 3).join("\n")}` : ""}` : String(err);
|
|
3974
3987
|
process.stderr.write(
|
|
3975
|
-
`[store] Shard write failed for ${project}
|
|
3988
|
+
`[store] Shard write failed for ${project} (${rows.length} records): ${fullError}
|
|
3976
3989
|
`
|
|
3977
3990
|
);
|
|
3978
3991
|
}
|
|
@@ -2925,8 +2925,8 @@ function getShardClient(projectName) {
|
|
|
2925
2925
|
throw new Error("Shard manager not initialized. Call initShardManager() first.");
|
|
2926
2926
|
}
|
|
2927
2927
|
const safeName = projectName.replace(/[^a-zA-Z0-9_-]/g, "_");
|
|
2928
|
-
if (!safeName) {
|
|
2929
|
-
throw new Error(`Invalid project name for shard: "${projectName}"`);
|
|
2928
|
+
if (!safeName || safeName === "unknown") {
|
|
2929
|
+
throw new Error(`Invalid project name for shard: "${projectName}" (resolved to "${safeName}")`);
|
|
2930
2930
|
}
|
|
2931
2931
|
const cached = _shards.get(safeName);
|
|
2932
2932
|
if (cached) {
|
|
@@ -3795,19 +3795,32 @@ async function flushBatch() {
|
|
|
3795
3795
|
const { isShardingEnabled: isShardingEnabled2, getReadyShardClient: getReadyShardClient2 } = await Promise.resolve().then(() => (init_shard_manager(), shard_manager_exports));
|
|
3796
3796
|
if (isShardingEnabled2()) {
|
|
3797
3797
|
const byProject = /* @__PURE__ */ new Map();
|
|
3798
|
+
let skippedUnknown = 0;
|
|
3798
3799
|
for (const row of batch) {
|
|
3799
|
-
const proj = row.project_name
|
|
3800
|
+
const proj = row.project_name?.trim();
|
|
3801
|
+
if (!proj) {
|
|
3802
|
+
skippedUnknown++;
|
|
3803
|
+
continue;
|
|
3804
|
+
}
|
|
3800
3805
|
if (!byProject.has(proj)) byProject.set(proj, []);
|
|
3801
3806
|
byProject.get(proj).push(row);
|
|
3802
3807
|
}
|
|
3808
|
+
if (skippedUnknown > 0) {
|
|
3809
|
+
process.stderr.write(
|
|
3810
|
+
`[store] Shard skip: ${skippedUnknown} record(s) with empty project_name (kept in main DB only)
|
|
3811
|
+
`
|
|
3812
|
+
);
|
|
3813
|
+
}
|
|
3803
3814
|
for (const [project, rows] of byProject) {
|
|
3804
3815
|
try {
|
|
3805
3816
|
const shardClient = await getReadyShardClient2(project);
|
|
3806
3817
|
const shardStmts = rows.map(buildStmt);
|
|
3807
3818
|
await shardClient.batch(shardStmts, "write");
|
|
3808
3819
|
} catch (err) {
|
|
3820
|
+
const fullError = err instanceof Error ? `${err.name}: ${err.message}${err.stack ? `
|
|
3821
|
+
${err.stack.split("\n").slice(1, 3).join("\n")}` : ""}` : String(err);
|
|
3809
3822
|
process.stderr.write(
|
|
3810
|
-
`[store] Shard write failed for ${project}
|
|
3823
|
+
`[store] Shard write failed for ${project} (${rows.length} records): ${fullError}
|
|
3811
3824
|
`
|
|
3812
3825
|
);
|
|
3813
3826
|
}
|
|
@@ -2925,8 +2925,8 @@ function getShardClient(projectName) {
|
|
|
2925
2925
|
throw new Error("Shard manager not initialized. Call initShardManager() first.");
|
|
2926
2926
|
}
|
|
2927
2927
|
const safeName = projectName.replace(/[^a-zA-Z0-9_-]/g, "_");
|
|
2928
|
-
if (!safeName) {
|
|
2929
|
-
throw new Error(`Invalid project name for shard: "${projectName}"`);
|
|
2928
|
+
if (!safeName || safeName === "unknown") {
|
|
2929
|
+
throw new Error(`Invalid project name for shard: "${projectName}" (resolved to "${safeName}")`);
|
|
2930
2930
|
}
|
|
2931
2931
|
const cached = _shards.get(safeName);
|
|
2932
2932
|
if (cached) {
|
|
@@ -3795,19 +3795,32 @@ async function flushBatch() {
|
|
|
3795
3795
|
const { isShardingEnabled: isShardingEnabled2, getReadyShardClient: getReadyShardClient2 } = await Promise.resolve().then(() => (init_shard_manager(), shard_manager_exports));
|
|
3796
3796
|
if (isShardingEnabled2()) {
|
|
3797
3797
|
const byProject = /* @__PURE__ */ new Map();
|
|
3798
|
+
let skippedUnknown = 0;
|
|
3798
3799
|
for (const row of batch) {
|
|
3799
|
-
const proj = row.project_name
|
|
3800
|
+
const proj = row.project_name?.trim();
|
|
3801
|
+
if (!proj) {
|
|
3802
|
+
skippedUnknown++;
|
|
3803
|
+
continue;
|
|
3804
|
+
}
|
|
3800
3805
|
if (!byProject.has(proj)) byProject.set(proj, []);
|
|
3801
3806
|
byProject.get(proj).push(row);
|
|
3802
3807
|
}
|
|
3808
|
+
if (skippedUnknown > 0) {
|
|
3809
|
+
process.stderr.write(
|
|
3810
|
+
`[store] Shard skip: ${skippedUnknown} record(s) with empty project_name (kept in main DB only)
|
|
3811
|
+
`
|
|
3812
|
+
);
|
|
3813
|
+
}
|
|
3803
3814
|
for (const [project, rows] of byProject) {
|
|
3804
3815
|
try {
|
|
3805
3816
|
const shardClient = await getReadyShardClient2(project);
|
|
3806
3817
|
const shardStmts = rows.map(buildStmt);
|
|
3807
3818
|
await shardClient.batch(shardStmts, "write");
|
|
3808
3819
|
} catch (err) {
|
|
3820
|
+
const fullError = err instanceof Error ? `${err.name}: ${err.message}${err.stack ? `
|
|
3821
|
+
${err.stack.split("\n").slice(1, 3).join("\n")}` : ""}` : String(err);
|
|
3809
3822
|
process.stderr.write(
|
|
3810
|
-
`[store] Shard write failed for ${project}
|
|
3823
|
+
`[store] Shard write failed for ${project} (${rows.length} records): ${fullError}
|
|
3811
3824
|
`
|
|
3812
3825
|
);
|
|
3813
3826
|
}
|
|
@@ -3345,8 +3345,8 @@ function getShardClient(projectName) {
|
|
|
3345
3345
|
throw new Error("Shard manager not initialized. Call initShardManager() first.");
|
|
3346
3346
|
}
|
|
3347
3347
|
const safeName = projectName.replace(/[^a-zA-Z0-9_-]/g, "_");
|
|
3348
|
-
if (!safeName) {
|
|
3349
|
-
throw new Error(`Invalid project name for shard: "${projectName}"`);
|
|
3348
|
+
if (!safeName || safeName === "unknown") {
|
|
3349
|
+
throw new Error(`Invalid project name for shard: "${projectName}" (resolved to "${safeName}")`);
|
|
3350
3350
|
}
|
|
3351
3351
|
const cached = _shards.get(safeName);
|
|
3352
3352
|
if (cached) {
|
|
@@ -4215,19 +4215,32 @@ async function flushBatch() {
|
|
|
4215
4215
|
const { isShardingEnabled: isShardingEnabled2, getReadyShardClient: getReadyShardClient2 } = await Promise.resolve().then(() => (init_shard_manager(), shard_manager_exports));
|
|
4216
4216
|
if (isShardingEnabled2()) {
|
|
4217
4217
|
const byProject = /* @__PURE__ */ new Map();
|
|
4218
|
+
let skippedUnknown = 0;
|
|
4218
4219
|
for (const row of batch) {
|
|
4219
|
-
const proj = row.project_name
|
|
4220
|
+
const proj = row.project_name?.trim();
|
|
4221
|
+
if (!proj) {
|
|
4222
|
+
skippedUnknown++;
|
|
4223
|
+
continue;
|
|
4224
|
+
}
|
|
4220
4225
|
if (!byProject.has(proj)) byProject.set(proj, []);
|
|
4221
4226
|
byProject.get(proj).push(row);
|
|
4222
4227
|
}
|
|
4228
|
+
if (skippedUnknown > 0) {
|
|
4229
|
+
process.stderr.write(
|
|
4230
|
+
`[store] Shard skip: ${skippedUnknown} record(s) with empty project_name (kept in main DB only)
|
|
4231
|
+
`
|
|
4232
|
+
);
|
|
4233
|
+
}
|
|
4223
4234
|
for (const [project, rows] of byProject) {
|
|
4224
4235
|
try {
|
|
4225
4236
|
const shardClient = await getReadyShardClient2(project);
|
|
4226
4237
|
const shardStmts = rows.map(buildStmt);
|
|
4227
4238
|
await shardClient.batch(shardStmts, "write");
|
|
4228
4239
|
} catch (err) {
|
|
4240
|
+
const fullError = err instanceof Error ? `${err.name}: ${err.message}${err.stack ? `
|
|
4241
|
+
${err.stack.split("\n").slice(1, 3).join("\n")}` : ""}` : String(err);
|
|
4229
4242
|
process.stderr.write(
|
|
4230
|
-
`[store] Shard write failed for ${project}
|
|
4243
|
+
`[store] Shard write failed for ${project} (${rows.length} records): ${fullError}
|
|
4231
4244
|
`
|
|
4232
4245
|
);
|
|
4233
4246
|
}
|
|
@@ -3089,8 +3089,8 @@ function getShardClient(projectName) {
|
|
|
3089
3089
|
throw new Error("Shard manager not initialized. Call initShardManager() first.");
|
|
3090
3090
|
}
|
|
3091
3091
|
const safeName = projectName.replace(/[^a-zA-Z0-9_-]/g, "_");
|
|
3092
|
-
if (!safeName) {
|
|
3093
|
-
throw new Error(`Invalid project name for shard: "${projectName}"`);
|
|
3092
|
+
if (!safeName || safeName === "unknown") {
|
|
3093
|
+
throw new Error(`Invalid project name for shard: "${projectName}" (resolved to "${safeName}")`);
|
|
3094
3094
|
}
|
|
3095
3095
|
const cached = _shards.get(safeName);
|
|
3096
3096
|
if (cached) {
|
|
@@ -3959,19 +3959,32 @@ async function flushBatch() {
|
|
|
3959
3959
|
const { isShardingEnabled: isShardingEnabled2, getReadyShardClient: getReadyShardClient2 } = await Promise.resolve().then(() => (init_shard_manager(), shard_manager_exports));
|
|
3960
3960
|
if (isShardingEnabled2()) {
|
|
3961
3961
|
const byProject = /* @__PURE__ */ new Map();
|
|
3962
|
+
let skippedUnknown = 0;
|
|
3962
3963
|
for (const row of batch) {
|
|
3963
|
-
const proj = row.project_name
|
|
3964
|
+
const proj = row.project_name?.trim();
|
|
3965
|
+
if (!proj) {
|
|
3966
|
+
skippedUnknown++;
|
|
3967
|
+
continue;
|
|
3968
|
+
}
|
|
3964
3969
|
if (!byProject.has(proj)) byProject.set(proj, []);
|
|
3965
3970
|
byProject.get(proj).push(row);
|
|
3966
3971
|
}
|
|
3972
|
+
if (skippedUnknown > 0) {
|
|
3973
|
+
process.stderr.write(
|
|
3974
|
+
`[store] Shard skip: ${skippedUnknown} record(s) with empty project_name (kept in main DB only)
|
|
3975
|
+
`
|
|
3976
|
+
);
|
|
3977
|
+
}
|
|
3967
3978
|
for (const [project, rows] of byProject) {
|
|
3968
3979
|
try {
|
|
3969
3980
|
const shardClient = await getReadyShardClient2(project);
|
|
3970
3981
|
const shardStmts = rows.map(buildStmt);
|
|
3971
3982
|
await shardClient.batch(shardStmts, "write");
|
|
3972
3983
|
} catch (err) {
|
|
3984
|
+
const fullError = err instanceof Error ? `${err.name}: ${err.message}${err.stack ? `
|
|
3985
|
+
${err.stack.split("\n").slice(1, 3).join("\n")}` : ""}` : String(err);
|
|
3973
3986
|
process.stderr.write(
|
|
3974
|
-
`[store] Shard write failed for ${project}
|
|
3987
|
+
`[store] Shard write failed for ${project} (${rows.length} records): ${fullError}
|
|
3975
3988
|
`
|
|
3976
3989
|
);
|
|
3977
3990
|
}
|
|
@@ -5393,10 +5406,12 @@ async function hybridSearch(queryText, agentId, options) {
|
|
|
5393
5406
|
);
|
|
5394
5407
|
}
|
|
5395
5408
|
let rerankerAvailable = false;
|
|
5396
|
-
|
|
5397
|
-
|
|
5398
|
-
|
|
5399
|
-
|
|
5409
|
+
if (process.env.EXE_IS_DAEMON === "1") {
|
|
5410
|
+
try {
|
|
5411
|
+
const { isRerankerAvailable: isRerankerAvailable2 } = await Promise.resolve().then(() => (init_reranker(), reranker_exports));
|
|
5412
|
+
rerankerAvailable = isRerankerAvailable2();
|
|
5413
|
+
} catch {
|
|
5414
|
+
}
|
|
5400
5415
|
}
|
|
5401
5416
|
const broadFetchTopK = config.scalingRoadmap?.rerankerAutoTrigger?.fetchTopK ?? 150;
|
|
5402
5417
|
const fetchLimit = effectiveIsBroad ? Math.max(limit * 5, broadFetchTopK) : rerankerAvailable ? Math.max(limit * 4, 60) : Math.max(limit * 3, 30);
|