@anuma/sdk 1.1.5 → 1.2.0
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/expo/{chunk-IKPPX3GY.mjs → chunk-OZ357R4P.mjs} +75 -40
- package/dist/expo/index.cjs +104 -42
- package/dist/expo/index.d.mts +15 -0
- package/dist/expo/index.d.ts +15 -0
- package/dist/expo/index.mjs +30 -3
- package/dist/expo/{recall-4JTNZBAW.mjs → recall-EMFBX3WU.mjs} +1 -1
- package/dist/index.cjs +1 -0
- package/dist/index.mjs +1 -0
- package/dist/react/{chunk-KQZ4KVYY.mjs → chunk-DC6J5RX5.mjs} +75 -40
- package/dist/react/index.cjs +104 -42
- package/dist/react/index.d.mts +15 -0
- package/dist/react/index.d.ts +15 -0
- package/dist/react/index.mjs +30 -3
- package/dist/react/{recall-Z2HUBS2Y.mjs → recall-RGKS2OIP.mjs} +1 -1
- package/dist/server/{chunk-KLJBJWWI.mjs → chunk-MKRSHU4S.mjs} +1 -1
- package/dist/server/index.cjs +30 -2
- package/dist/server/index.d.mts +15 -0
- package/dist/server/index.d.ts +15 -0
- package/dist/server/index.mjs +31 -3
- package/dist/server/{recall-IF2HX7ZA.mjs → recall-V4763HKS.mjs} +1 -1
- package/dist/tools/index.cjs +412 -58
- package/dist/tools/index.d.mts +14 -3
- package/dist/tools/index.d.ts +14 -3
- package/dist/tools/index.mjs +412 -58
- package/package.json +1 -1
package/dist/react/index.cjs
CHANGED
|
@@ -2468,50 +2468,84 @@ async function getMessagesPageOp(ctx, convId, opts) {
|
|
|
2468
2468
|
)
|
|
2469
2469
|
);
|
|
2470
2470
|
}
|
|
2471
|
-
|
|
2472
|
-
|
|
2473
|
-
|
|
2474
|
-
|
|
2475
|
-
|
|
2476
|
-
|
|
2477
|
-
|
|
2478
|
-
|
|
2479
|
-
|
|
2480
|
-
|
|
2481
|
-
|
|
2482
|
-
|
|
2483
|
-
|
|
2484
|
-
|
|
2485
|
-
|
|
2486
|
-
|
|
2487
|
-
|
|
2488
|
-
|
|
2489
|
-
|
|
2490
|
-
|
|
2491
|
-
|
|
2492
|
-
|
|
2493
|
-
|
|
2471
|
+
function narrowSkeletonRow(raw) {
|
|
2472
|
+
return {
|
|
2473
|
+
id: raw.id,
|
|
2474
|
+
message_id: raw.message_id,
|
|
2475
|
+
conversation_id: raw.conversation_id,
|
|
2476
|
+
role: raw.role,
|
|
2477
|
+
created_at: raw.created_at,
|
|
2478
|
+
parent_message_id: raw.parent_message_id ?? null,
|
|
2479
|
+
model: raw.model ?? null,
|
|
2480
|
+
content: raw.content ?? null
|
|
2481
|
+
};
|
|
2482
|
+
}
|
|
2483
|
+
async function fetchThreadSkeletonRawPaged(collection, convId, pageSize = SKELETON_PAGE_SIZE) {
|
|
2484
|
+
const all = [];
|
|
2485
|
+
let cursor;
|
|
2486
|
+
for (; ; ) {
|
|
2487
|
+
const clauses = [import_watermelondb.Q.where("conversation_id", convId)];
|
|
2488
|
+
if (cursor) {
|
|
2489
|
+
clauses.push(
|
|
2490
|
+
import_watermelondb.Q.or(
|
|
2491
|
+
import_watermelondb.Q.where("message_id", import_watermelondb.Q.gt(cursor.messageId)),
|
|
2492
|
+
import_watermelondb.Q.and(import_watermelondb.Q.where("message_id", cursor.messageId), import_watermelondb.Q.where("id", import_watermelondb.Q.gt(cursor.id)))
|
|
2493
|
+
)
|
|
2494
|
+
);
|
|
2494
2495
|
}
|
|
2496
|
+
const page = await collection.query(...clauses, import_watermelondb.Q.sortBy("message_id", import_watermelondb.Q.asc), import_watermelondb.Q.sortBy("id", import_watermelondb.Q.asc), import_watermelondb.Q.take(pageSize)).unsafeFetchRaw();
|
|
2497
|
+
if (page.length === 0) break;
|
|
2498
|
+
for (const raw of page) all.push(narrowSkeletonRow(raw));
|
|
2499
|
+
if (page.length < pageSize) break;
|
|
2500
|
+
const last = all[all.length - 1];
|
|
2501
|
+
cursor = { messageId: last.message_id, id: last.id };
|
|
2502
|
+
}
|
|
2503
|
+
return all;
|
|
2504
|
+
}
|
|
2505
|
+
function collectArtifactIndices(rows, roleById) {
|
|
2506
|
+
const indices = [];
|
|
2507
|
+
for (let i = 0; i < rows.length; i++) {
|
|
2508
|
+
const row = rows[i];
|
|
2509
|
+
if (row.role !== "user" || !row.parent_message_id) continue;
|
|
2510
|
+
if (roleById.get(row.parent_message_id) === "user") indices.push(i);
|
|
2495
2511
|
}
|
|
2512
|
+
return indices;
|
|
2513
|
+
}
|
|
2514
|
+
async function decryptArtifactContent(skeletons, rows, artifactIndices, ctx) {
|
|
2496
2515
|
const address = ctx.walletAddress;
|
|
2497
|
-
if (artifactIndices.length
|
|
2498
|
-
|
|
2499
|
-
|
|
2500
|
-
|
|
2501
|
-
|
|
2502
|
-
|
|
2503
|
-
|
|
2504
|
-
}
|
|
2505
|
-
|
|
2506
|
-
artifactIndices.map(async (i) => {
|
|
2507
|
-
skeletons[i].content = await decryptField(results[i].content, address);
|
|
2508
|
-
})
|
|
2509
|
-
);
|
|
2510
|
-
} else {
|
|
2511
|
-
for (const i of artifactIndices) {
|
|
2512
|
-
skeletons[i].content = results[i].content;
|
|
2516
|
+
if (artifactIndices.length === 0 || !address) {
|
|
2517
|
+
for (const i of artifactIndices) skeletons[i].content = rows[i].content ?? void 0;
|
|
2518
|
+
return;
|
|
2519
|
+
}
|
|
2520
|
+
if (ctx.signMessage) {
|
|
2521
|
+
try {
|
|
2522
|
+
await requestEncryptionKey(address, ctx.signMessage, ctx.embeddedWalletSigner);
|
|
2523
|
+
} catch (error) {
|
|
2524
|
+
getLogger().warn("Failed to request encryption key for skeleton decryption:", error);
|
|
2513
2525
|
}
|
|
2514
2526
|
}
|
|
2527
|
+
await Promise.all(
|
|
2528
|
+
artifactIndices.map(async (i) => {
|
|
2529
|
+
skeletons[i].content = await decryptField(rows[i].content ?? "", address);
|
|
2530
|
+
})
|
|
2531
|
+
);
|
|
2532
|
+
}
|
|
2533
|
+
async function getMessageSkeletonsOp(ctx, convId) {
|
|
2534
|
+
const rows = await fetchThreadSkeletonRawPaged(ctx.messagesCollection, convId);
|
|
2535
|
+
const roleById = /* @__PURE__ */ new Map();
|
|
2536
|
+
for (const row of rows) roleById.set(row.id, row.role);
|
|
2537
|
+
const skeletons = rows.map((row) => ({
|
|
2538
|
+
uniqueId: row.id,
|
|
2539
|
+
messageId: row.message_id,
|
|
2540
|
+
conversationId: String(row.conversation_id),
|
|
2541
|
+
role: row.role,
|
|
2542
|
+
createdAt: new Date(row.created_at),
|
|
2543
|
+
// WatermelonDB surfaces unset text columns as null at runtime — normalize
|
|
2544
|
+
// to undefined so `parentMessageId ?? undefined` keying works everywhere.
|
|
2545
|
+
parentMessageId: row.parent_message_id ?? void 0,
|
|
2546
|
+
model: row.model ?? void 0
|
|
2547
|
+
}));
|
|
2548
|
+
await decryptArtifactContent(skeletons, rows, collectArtifactIndices(rows, roleById), ctx);
|
|
2515
2549
|
return skeletons;
|
|
2516
2550
|
}
|
|
2517
2551
|
async function clearMessagesOp(ctx, convId) {
|
|
@@ -2902,7 +2936,7 @@ function makeSyntheticStoredConversation(opts, defaultTitle) {
|
|
|
2902
2936
|
isDeleted: false
|
|
2903
2937
|
};
|
|
2904
2938
|
}
|
|
2905
|
-
var import_watermelondb, import_uuid2;
|
|
2939
|
+
var import_watermelondb, import_uuid2, SKELETON_PAGE_SIZE;
|
|
2906
2940
|
var init_operations = __esm({
|
|
2907
2941
|
"src/lib/db/chat/operations.ts"() {
|
|
2908
2942
|
"use strict";
|
|
@@ -2915,6 +2949,7 @@ var init_operations = __esm({
|
|
|
2915
2949
|
init_conversationEncryption();
|
|
2916
2950
|
init_encryption();
|
|
2917
2951
|
init_types2();
|
|
2952
|
+
SKELETON_PAGE_SIZE = 2e3;
|
|
2918
2953
|
}
|
|
2919
2954
|
});
|
|
2920
2955
|
|
|
@@ -19941,6 +19976,7 @@ var DatabaseManager = class {
|
|
|
19941
19976
|
from: this.currentWalletAddress,
|
|
19942
19977
|
to: walletAddress
|
|
19943
19978
|
});
|
|
19979
|
+
void this.disposeAdapter(this.database);
|
|
19944
19980
|
this.database = null;
|
|
19945
19981
|
}
|
|
19946
19982
|
if (this.database) {
|
|
@@ -19970,11 +20006,37 @@ var DatabaseManager = class {
|
|
|
19970
20006
|
async resetDatabase() {
|
|
19971
20007
|
const db = this.database;
|
|
19972
20008
|
if (db) {
|
|
20009
|
+
this.database = null;
|
|
20010
|
+
this.currentWalletAddress = void 0;
|
|
19973
20011
|
await db.write(async () => {
|
|
19974
20012
|
await db.unsafeResetDatabase();
|
|
19975
20013
|
});
|
|
19976
|
-
this.
|
|
19977
|
-
|
|
20014
|
+
await this.disposeAdapter(db);
|
|
20015
|
+
}
|
|
20016
|
+
}
|
|
20017
|
+
/**
|
|
20018
|
+
* Best-effort dispose of the adapter backing a Database, if it exposes one.
|
|
20019
|
+
*
|
|
20020
|
+
* OPFS/SQLite adapters use this to terminate their dedicated worker and release
|
|
20021
|
+
* the exclusive SAHPool (+ WASM heap) they hold. The SDK only sees a generic
|
|
20022
|
+
* `DatabaseAdapter`, so we probe `adapter.underlyingAdapter.dispose` rather than
|
|
20023
|
+
* type it. Client-side implementations are refcounted + idempotent, so calling
|
|
20024
|
+
* this is safe even when the adapter factory also disposes.
|
|
20025
|
+
*
|
|
20026
|
+
* Awaitable and never rejects: a sync throw or async rejection from `dispose`
|
|
20027
|
+
* is caught + logged. Awaited on the async `resetDatabase` path so teardown
|
|
20028
|
+
* completes before the caller reopens; fire-and-forget on the synchronous
|
|
20029
|
+
* `getDatabase` path (which cannot block).
|
|
20030
|
+
*/
|
|
20031
|
+
async disposeAdapter(db) {
|
|
20032
|
+
try {
|
|
20033
|
+
const underlying = db.adapter?.underlyingAdapter;
|
|
20034
|
+
await underlying?.dispose?.();
|
|
20035
|
+
} catch (error) {
|
|
20036
|
+
this.logger.warn?.("Adapter dispose failed", {
|
|
20037
|
+
component: "DatabaseManager",
|
|
20038
|
+
error
|
|
20039
|
+
});
|
|
19978
20040
|
}
|
|
19979
20041
|
}
|
|
19980
20042
|
/**
|
package/dist/react/index.d.mts
CHANGED
|
@@ -8103,6 +8103,21 @@ declare class DatabaseManager {
|
|
|
8103
8103
|
* Reset the current database (useful for logout or testing).
|
|
8104
8104
|
*/
|
|
8105
8105
|
resetDatabase(): Promise<void>;
|
|
8106
|
+
/**
|
|
8107
|
+
* Best-effort dispose of the adapter backing a Database, if it exposes one.
|
|
8108
|
+
*
|
|
8109
|
+
* OPFS/SQLite adapters use this to terminate their dedicated worker and release
|
|
8110
|
+
* the exclusive SAHPool (+ WASM heap) they hold. The SDK only sees a generic
|
|
8111
|
+
* `DatabaseAdapter`, so we probe `adapter.underlyingAdapter.dispose` rather than
|
|
8112
|
+
* type it. Client-side implementations are refcounted + idempotent, so calling
|
|
8113
|
+
* this is safe even when the adapter factory also disposes.
|
|
8114
|
+
*
|
|
8115
|
+
* Awaitable and never rejects: a sync throw or async rejection from `dispose`
|
|
8116
|
+
* is caught + logged. Awaited on the async `resetDatabase` path so teardown
|
|
8117
|
+
* completes before the caller reopens; fire-and-forget on the synchronous
|
|
8118
|
+
* `getDatabase` path (which cannot block).
|
|
8119
|
+
*/
|
|
8120
|
+
private disposeAdapter;
|
|
8106
8121
|
/**
|
|
8107
8122
|
* Check and handle schema migrations for a specific wallet.
|
|
8108
8123
|
* Returns true if a destructive migration is in progress.
|
package/dist/react/index.d.ts
CHANGED
|
@@ -8103,6 +8103,21 @@ declare class DatabaseManager {
|
|
|
8103
8103
|
* Reset the current database (useful for logout or testing).
|
|
8104
8104
|
*/
|
|
8105
8105
|
resetDatabase(): Promise<void>;
|
|
8106
|
+
/**
|
|
8107
|
+
* Best-effort dispose of the adapter backing a Database, if it exposes one.
|
|
8108
|
+
*
|
|
8109
|
+
* OPFS/SQLite adapters use this to terminate their dedicated worker and release
|
|
8110
|
+
* the exclusive SAHPool (+ WASM heap) they hold. The SDK only sees a generic
|
|
8111
|
+
* `DatabaseAdapter`, so we probe `adapter.underlyingAdapter.dispose` rather than
|
|
8112
|
+
* type it. Client-side implementations are refcounted + idempotent, so calling
|
|
8113
|
+
* this is safe even when the adapter factory also disposes.
|
|
8114
|
+
*
|
|
8115
|
+
* Awaitable and never rejects: a sync throw or async rejection from `dispose`
|
|
8116
|
+
* is caught + logged. Awaited on the async `resetDatabase` path so teardown
|
|
8117
|
+
* completes before the caller reopens; fire-and-forget on the synchronous
|
|
8118
|
+
* `getDatabase` path (which cannot block).
|
|
8119
|
+
*/
|
|
8120
|
+
private disposeAdapter;
|
|
8106
8121
|
/**
|
|
8107
8122
|
* Check and handle schema migrations for a specific wallet.
|
|
8108
8123
|
* Returns true if a destructive migration is in progress.
|
package/dist/react/index.mjs
CHANGED
|
@@ -121,7 +121,7 @@ import {
|
|
|
121
121
|
updateVaultMemoryEmbeddingOp,
|
|
122
122
|
updateVaultMemoryOp,
|
|
123
123
|
useEncryption
|
|
124
|
-
} from "./chunk-
|
|
124
|
+
} from "./chunk-DC6J5RX5.mjs";
|
|
125
125
|
import {
|
|
126
126
|
PiiRedactor,
|
|
127
127
|
createStreamingDeAnonymizer,
|
|
@@ -12664,6 +12664,7 @@ var DatabaseManager = class {
|
|
|
12664
12664
|
from: this.currentWalletAddress,
|
|
12665
12665
|
to: walletAddress
|
|
12666
12666
|
});
|
|
12667
|
+
void this.disposeAdapter(this.database);
|
|
12667
12668
|
this.database = null;
|
|
12668
12669
|
}
|
|
12669
12670
|
if (this.database) {
|
|
@@ -12693,11 +12694,37 @@ var DatabaseManager = class {
|
|
|
12693
12694
|
async resetDatabase() {
|
|
12694
12695
|
const db = this.database;
|
|
12695
12696
|
if (db) {
|
|
12697
|
+
this.database = null;
|
|
12698
|
+
this.currentWalletAddress = void 0;
|
|
12696
12699
|
await db.write(async () => {
|
|
12697
12700
|
await db.unsafeResetDatabase();
|
|
12698
12701
|
});
|
|
12699
|
-
this.
|
|
12700
|
-
|
|
12702
|
+
await this.disposeAdapter(db);
|
|
12703
|
+
}
|
|
12704
|
+
}
|
|
12705
|
+
/**
|
|
12706
|
+
* Best-effort dispose of the adapter backing a Database, if it exposes one.
|
|
12707
|
+
*
|
|
12708
|
+
* OPFS/SQLite adapters use this to terminate their dedicated worker and release
|
|
12709
|
+
* the exclusive SAHPool (+ WASM heap) they hold. The SDK only sees a generic
|
|
12710
|
+
* `DatabaseAdapter`, so we probe `adapter.underlyingAdapter.dispose` rather than
|
|
12711
|
+
* type it. Client-side implementations are refcounted + idempotent, so calling
|
|
12712
|
+
* this is safe even when the adapter factory also disposes.
|
|
12713
|
+
*
|
|
12714
|
+
* Awaitable and never rejects: a sync throw or async rejection from `dispose`
|
|
12715
|
+
* is caught + logged. Awaited on the async `resetDatabase` path so teardown
|
|
12716
|
+
* completes before the caller reopens; fire-and-forget on the synchronous
|
|
12717
|
+
* `getDatabase` path (which cannot block).
|
|
12718
|
+
*/
|
|
12719
|
+
async disposeAdapter(db) {
|
|
12720
|
+
try {
|
|
12721
|
+
const underlying = db.adapter?.underlyingAdapter;
|
|
12722
|
+
await underlying?.dispose?.();
|
|
12723
|
+
} catch (error) {
|
|
12724
|
+
this.logger.warn?.("Adapter dispose failed", {
|
|
12725
|
+
component: "DatabaseManager",
|
|
12726
|
+
error
|
|
12727
|
+
});
|
|
12701
12728
|
}
|
|
12702
12729
|
}
|
|
12703
12730
|
/**
|
|
@@ -18838,7 +18838,7 @@ function createMemoryVaultSearchTool(vaultCtx, embeddingOptions, cache, searchOp
|
|
|
18838
18838
|
legacy.map((r) => ({ id: r.uniqueId, content: r.content, score: r.similarity }))
|
|
18839
18839
|
);
|
|
18840
18840
|
}
|
|
18841
|
-
const { recall: recall2 } = await import("./recall-
|
|
18841
|
+
const { recall: recall2 } = await import("./recall-V4763HKS.mjs");
|
|
18842
18842
|
const result = await recall2(
|
|
18843
18843
|
query,
|
|
18844
18844
|
{ vaultCtx, embeddingOptions, vaultCache: cache },
|
package/dist/server/index.cjs
CHANGED
|
@@ -22877,6 +22877,7 @@ var DatabaseManager = class {
|
|
|
22877
22877
|
from: this.currentWalletAddress,
|
|
22878
22878
|
to: walletAddress
|
|
22879
22879
|
});
|
|
22880
|
+
void this.disposeAdapter(this.database);
|
|
22880
22881
|
this.database = null;
|
|
22881
22882
|
}
|
|
22882
22883
|
if (this.database) {
|
|
@@ -22906,11 +22907,37 @@ var DatabaseManager = class {
|
|
|
22906
22907
|
async resetDatabase() {
|
|
22907
22908
|
const db = this.database;
|
|
22908
22909
|
if (db) {
|
|
22910
|
+
this.database = null;
|
|
22911
|
+
this.currentWalletAddress = void 0;
|
|
22909
22912
|
await db.write(async () => {
|
|
22910
22913
|
await db.unsafeResetDatabase();
|
|
22911
22914
|
});
|
|
22912
|
-
this.
|
|
22913
|
-
|
|
22915
|
+
await this.disposeAdapter(db);
|
|
22916
|
+
}
|
|
22917
|
+
}
|
|
22918
|
+
/**
|
|
22919
|
+
* Best-effort dispose of the adapter backing a Database, if it exposes one.
|
|
22920
|
+
*
|
|
22921
|
+
* OPFS/SQLite adapters use this to terminate their dedicated worker and release
|
|
22922
|
+
* the exclusive SAHPool (+ WASM heap) they hold. The SDK only sees a generic
|
|
22923
|
+
* `DatabaseAdapter`, so we probe `adapter.underlyingAdapter.dispose` rather than
|
|
22924
|
+
* type it. Client-side implementations are refcounted + idempotent, so calling
|
|
22925
|
+
* this is safe even when the adapter factory also disposes.
|
|
22926
|
+
*
|
|
22927
|
+
* Awaitable and never rejects: a sync throw or async rejection from `dispose`
|
|
22928
|
+
* is caught + logged. Awaited on the async `resetDatabase` path so teardown
|
|
22929
|
+
* completes before the caller reopens; fire-and-forget on the synchronous
|
|
22930
|
+
* `getDatabase` path (which cannot block).
|
|
22931
|
+
*/
|
|
22932
|
+
async disposeAdapter(db) {
|
|
22933
|
+
try {
|
|
22934
|
+
const underlying = db.adapter?.underlyingAdapter;
|
|
22935
|
+
await underlying?.dispose?.();
|
|
22936
|
+
} catch (error) {
|
|
22937
|
+
this.logger.warn?.("Adapter dispose failed", {
|
|
22938
|
+
component: "DatabaseManager",
|
|
22939
|
+
error
|
|
22940
|
+
});
|
|
22914
22941
|
}
|
|
22915
22942
|
}
|
|
22916
22943
|
/**
|
|
@@ -27162,6 +27189,7 @@ var TOOL_CATALOG = {
|
|
|
27162
27189
|
// Slack (src/tools/slack.ts)
|
|
27163
27190
|
slack_get_me: { label: "Get my Slack profile", provider: "slack", connector: "Slack" },
|
|
27164
27191
|
slack_list_channels: { label: "List channels", provider: "slack", connector: "Slack" },
|
|
27192
|
+
slack_list_dms: { label: "List direct messages", provider: "slack", connector: "Slack" },
|
|
27165
27193
|
slack_search_messages: { label: "Search messages", provider: "slack", connector: "Slack" },
|
|
27166
27194
|
slack_list_users: { label: "List members", provider: "slack", connector: "Slack" },
|
|
27167
27195
|
slack_get_channel_history: {
|
package/dist/server/index.d.mts
CHANGED
|
@@ -274,6 +274,21 @@ declare class DatabaseManager {
|
|
|
274
274
|
* Reset the current database (useful for logout or testing).
|
|
275
275
|
*/
|
|
276
276
|
resetDatabase(): Promise<void>;
|
|
277
|
+
/**
|
|
278
|
+
* Best-effort dispose of the adapter backing a Database, if it exposes one.
|
|
279
|
+
*
|
|
280
|
+
* OPFS/SQLite adapters use this to terminate their dedicated worker and release
|
|
281
|
+
* the exclusive SAHPool (+ WASM heap) they hold. The SDK only sees a generic
|
|
282
|
+
* `DatabaseAdapter`, so we probe `adapter.underlyingAdapter.dispose` rather than
|
|
283
|
+
* type it. Client-side implementations are refcounted + idempotent, so calling
|
|
284
|
+
* this is safe even when the adapter factory also disposes.
|
|
285
|
+
*
|
|
286
|
+
* Awaitable and never rejects: a sync throw or async rejection from `dispose`
|
|
287
|
+
* is caught + logged. Awaited on the async `resetDatabase` path so teardown
|
|
288
|
+
* completes before the caller reopens; fire-and-forget on the synchronous
|
|
289
|
+
* `getDatabase` path (which cannot block).
|
|
290
|
+
*/
|
|
291
|
+
private disposeAdapter;
|
|
277
292
|
/**
|
|
278
293
|
* Check and handle schema migrations for a specific wallet.
|
|
279
294
|
* Returns true if a destructive migration is in progress.
|
package/dist/server/index.d.ts
CHANGED
|
@@ -274,6 +274,21 @@ declare class DatabaseManager {
|
|
|
274
274
|
* Reset the current database (useful for logout or testing).
|
|
275
275
|
*/
|
|
276
276
|
resetDatabase(): Promise<void>;
|
|
277
|
+
/**
|
|
278
|
+
* Best-effort dispose of the adapter backing a Database, if it exposes one.
|
|
279
|
+
*
|
|
280
|
+
* OPFS/SQLite adapters use this to terminate their dedicated worker and release
|
|
281
|
+
* the exclusive SAHPool (+ WASM heap) they hold. The SDK only sees a generic
|
|
282
|
+
* `DatabaseAdapter`, so we probe `adapter.underlyingAdapter.dispose` rather than
|
|
283
|
+
* type it. Client-side implementations are refcounted + idempotent, so calling
|
|
284
|
+
* this is safe even when the adapter factory also disposes.
|
|
285
|
+
*
|
|
286
|
+
* Awaitable and never rejects: a sync throw or async rejection from `dispose`
|
|
287
|
+
* is caught + logged. Awaited on the async `resetDatabase` path so teardown
|
|
288
|
+
* completes before the caller reopens; fire-and-forget on the synchronous
|
|
289
|
+
* `getDatabase` path (which cannot block).
|
|
290
|
+
*/
|
|
291
|
+
private disposeAdapter;
|
|
277
292
|
/**
|
|
278
293
|
* Check and handle schema migrations for a specific wallet.
|
|
279
294
|
* Returns true if a destructive migration is in progress.
|
package/dist/server/index.mjs
CHANGED
|
@@ -95,7 +95,7 @@ import {
|
|
|
95
95
|
updateVaultMemoryEmbeddingOp,
|
|
96
96
|
updateVaultMemoryOp,
|
|
97
97
|
upsertMessageOp
|
|
98
|
-
} from "./chunk-
|
|
98
|
+
} from "./chunk-MKRSHU4S.mjs";
|
|
99
99
|
import {
|
|
100
100
|
createStreamingDeAnonymizer,
|
|
101
101
|
resolvePiiRedactor
|
|
@@ -1984,6 +1984,7 @@ var DatabaseManager = class {
|
|
|
1984
1984
|
from: this.currentWalletAddress,
|
|
1985
1985
|
to: walletAddress
|
|
1986
1986
|
});
|
|
1987
|
+
void this.disposeAdapter(this.database);
|
|
1987
1988
|
this.database = null;
|
|
1988
1989
|
}
|
|
1989
1990
|
if (this.database) {
|
|
@@ -2013,11 +2014,37 @@ var DatabaseManager = class {
|
|
|
2013
2014
|
async resetDatabase() {
|
|
2014
2015
|
const db = this.database;
|
|
2015
2016
|
if (db) {
|
|
2017
|
+
this.database = null;
|
|
2018
|
+
this.currentWalletAddress = void 0;
|
|
2016
2019
|
await db.write(async () => {
|
|
2017
2020
|
await db.unsafeResetDatabase();
|
|
2018
2021
|
});
|
|
2019
|
-
this.
|
|
2020
|
-
|
|
2022
|
+
await this.disposeAdapter(db);
|
|
2023
|
+
}
|
|
2024
|
+
}
|
|
2025
|
+
/**
|
|
2026
|
+
* Best-effort dispose of the adapter backing a Database, if it exposes one.
|
|
2027
|
+
*
|
|
2028
|
+
* OPFS/SQLite adapters use this to terminate their dedicated worker and release
|
|
2029
|
+
* the exclusive SAHPool (+ WASM heap) they hold. The SDK only sees a generic
|
|
2030
|
+
* `DatabaseAdapter`, so we probe `adapter.underlyingAdapter.dispose` rather than
|
|
2031
|
+
* type it. Client-side implementations are refcounted + idempotent, so calling
|
|
2032
|
+
* this is safe even when the adapter factory also disposes.
|
|
2033
|
+
*
|
|
2034
|
+
* Awaitable and never rejects: a sync throw or async rejection from `dispose`
|
|
2035
|
+
* is caught + logged. Awaited on the async `resetDatabase` path so teardown
|
|
2036
|
+
* completes before the caller reopens; fire-and-forget on the synchronous
|
|
2037
|
+
* `getDatabase` path (which cannot block).
|
|
2038
|
+
*/
|
|
2039
|
+
async disposeAdapter(db) {
|
|
2040
|
+
try {
|
|
2041
|
+
const underlying = db.adapter?.underlyingAdapter;
|
|
2042
|
+
await underlying?.dispose?.();
|
|
2043
|
+
} catch (error) {
|
|
2044
|
+
this.logger.warn?.("Adapter dispose failed", {
|
|
2045
|
+
component: "DatabaseManager",
|
|
2046
|
+
error
|
|
2047
|
+
});
|
|
2021
2048
|
}
|
|
2022
2049
|
}
|
|
2023
2050
|
/**
|
|
@@ -6217,6 +6244,7 @@ var TOOL_CATALOG = {
|
|
|
6217
6244
|
// Slack (src/tools/slack.ts)
|
|
6218
6245
|
slack_get_me: { label: "Get my Slack profile", provider: "slack", connector: "Slack" },
|
|
6219
6246
|
slack_list_channels: { label: "List channels", provider: "slack", connector: "Slack" },
|
|
6247
|
+
slack_list_dms: { label: "List direct messages", provider: "slack", connector: "Slack" },
|
|
6220
6248
|
slack_search_messages: { label: "Search messages", provider: "slack", connector: "Slack" },
|
|
6221
6249
|
slack_list_users: { label: "List members", provider: "slack", connector: "Slack" },
|
|
6222
6250
|
slack_get_channel_history: {
|