@xache/langchain 0.4.0 → 0.6.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/README.md +60 -57
- package/dist/index.d.mts +57 -15
- package/dist/index.d.ts +57 -15
- package/dist/index.js +26 -5
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +26 -5
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
- package/src/chat_history.ts +12 -3
- package/src/collective.ts +12 -3
- package/src/ephemeral.ts +268 -0
- package/src/extraction.ts +12 -3
- package/src/graph.ts +24 -4
- package/src/index.ts +15 -0
- package/src/reputation.ts +12 -3
- package/src/retriever.ts +12 -3
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @xache/langchain
|
|
2
2
|
|
|
3
|
-
LangChain.js integration for [Xache Protocol](https://xache.xyz) - verifiable AI agent memory with cryptographic receipts, collective intelligence, and portable ERC-8004 reputation.
|
|
3
|
+
LangChain.js integration for [Xache Protocol](https://xache.xyz) - verifiable AI agent memory with cryptographic receipts, collective intelligence, ephemeral working memory, knowledge graph, and portable ERC-8004 reputation.
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
@@ -40,8 +40,8 @@ import { XacheMemory } from '@xache/langchain';
|
|
|
40
40
|
const memory = new XacheMemory({
|
|
41
41
|
walletAddress: '0xYourWallet',
|
|
42
42
|
privateKey: '0xYourPrivateKey',
|
|
43
|
-
apiUrl: 'https://api.xache.xyz',
|
|
44
|
-
chain: 'base',
|
|
43
|
+
apiUrl: 'https://api.xache.xyz',
|
|
44
|
+
chain: 'base',
|
|
45
45
|
});
|
|
46
46
|
```
|
|
47
47
|
|
|
@@ -56,7 +56,7 @@ import { RetrievalQAChain } from 'langchain/chains';
|
|
|
56
56
|
const retriever = new XacheRetriever({
|
|
57
57
|
walletAddress: '0x...',
|
|
58
58
|
privateKey: '0x...',
|
|
59
|
-
k: 5,
|
|
59
|
+
k: 5,
|
|
60
60
|
});
|
|
61
61
|
|
|
62
62
|
const qa = RetrievalQAChain.fromLLM(llm, retriever);
|
|
@@ -64,15 +64,12 @@ const qa = RetrievalQAChain.fromLLM(llm, retriever);
|
|
|
64
64
|
|
|
65
65
|
### Collective Intelligence
|
|
66
66
|
|
|
67
|
-
Query and contribute to shared knowledge:
|
|
68
|
-
|
|
69
67
|
```typescript
|
|
70
68
|
import {
|
|
71
69
|
createCollectiveContributeTool,
|
|
72
70
|
createCollectiveQueryTool,
|
|
73
71
|
} from '@xache/langchain';
|
|
74
72
|
|
|
75
|
-
// Add to your agent's tools
|
|
76
73
|
const contributeTool = createCollectiveContributeTool({
|
|
77
74
|
walletAddress: '0x...',
|
|
78
75
|
privateKey: '0x...',
|
|
@@ -82,34 +79,28 @@ const queryTool = createCollectiveQueryTool({
|
|
|
82
79
|
walletAddress: '0x...',
|
|
83
80
|
privateKey: '0x...',
|
|
84
81
|
});
|
|
85
|
-
|
|
86
|
-
const tools = [contributeTool, queryTool];
|
|
87
82
|
```
|
|
88
83
|
|
|
89
84
|
### Memory Extraction
|
|
90
85
|
|
|
91
|
-
Auto-extract memories from conversations:
|
|
92
|
-
|
|
93
86
|
```typescript
|
|
94
87
|
import { XacheExtractor } from '@xache/langchain';
|
|
95
88
|
|
|
96
89
|
const extractor = new XacheExtractor({
|
|
97
90
|
walletAddress: '0x...',
|
|
98
91
|
privateKey: '0x...',
|
|
99
|
-
mode: 'xache-managed',
|
|
92
|
+
mode: 'xache-managed',
|
|
100
93
|
});
|
|
101
94
|
|
|
102
95
|
const result = await extractor.extract(
|
|
103
96
|
'User asked about quantum computing...',
|
|
104
97
|
{ autoStore: true }
|
|
105
98
|
);
|
|
106
|
-
|
|
107
|
-
console.log(`Extracted ${result.count} memories`);
|
|
108
99
|
```
|
|
109
100
|
|
|
110
101
|
### Knowledge Graph
|
|
111
102
|
|
|
112
|
-
Build and query a privacy-preserving knowledge graph
|
|
103
|
+
Build and query a privacy-preserving knowledge graph:
|
|
113
104
|
|
|
114
105
|
```typescript
|
|
115
106
|
import {
|
|
@@ -131,67 +122,81 @@ const config = {
|
|
|
131
122
|
llmApiKey: 'sk-ant-...',
|
|
132
123
|
};
|
|
133
124
|
|
|
134
|
-
// Extract entities from text
|
|
135
125
|
const extractTool = createGraphExtractTool(config);
|
|
136
|
-
|
|
137
|
-
// Query graph around an entity
|
|
138
126
|
const queryTool = createGraphQueryTool(config);
|
|
139
|
-
|
|
140
|
-
// Ask natural language questions
|
|
141
127
|
const askTool = createGraphAskTool(config);
|
|
142
|
-
|
|
143
|
-
// Load the full graph
|
|
144
128
|
const loadTool = createGraphLoadTool(config);
|
|
145
129
|
|
|
146
|
-
//
|
|
147
|
-
const addEntityTool = createGraphAddEntityTool(config);
|
|
148
|
-
const addRelTool = createGraphAddRelationshipTool(config);
|
|
149
|
-
|
|
150
|
-
// Merge duplicate entities
|
|
151
|
-
const mergeTool = createGraphMergeEntitiesTool(config);
|
|
152
|
-
|
|
153
|
-
// View entity version history
|
|
154
|
-
const historyTool = createGraphEntityHistoryTool(config);
|
|
155
|
-
|
|
156
|
-
// Use as a retriever for RAG
|
|
130
|
+
// Use graph as a retriever for RAG
|
|
157
131
|
const graphRetriever = new XacheGraphRetriever({
|
|
158
132
|
walletAddress: '0x...',
|
|
159
133
|
privateKey: '0x...',
|
|
160
134
|
k: 10,
|
|
161
135
|
});
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
### Ephemeral Context (Working Memory)
|
|
162
139
|
|
|
163
|
-
|
|
140
|
+
Short-lived scratch sessions for multi-turn workflows with 6 named slots (`conversation`, `facts`, `tasks`, `cache`, `scratch`, `handoff`):
|
|
141
|
+
|
|
142
|
+
```typescript
|
|
143
|
+
import {
|
|
144
|
+
createEphemeralCreateSessionTool,
|
|
145
|
+
createEphemeralWriteSlotTool,
|
|
146
|
+
createEphemeralReadSlotTool,
|
|
147
|
+
createEphemeralPromoteTool,
|
|
148
|
+
createEphemeralStatusTool,
|
|
149
|
+
} from '@xache/langchain';
|
|
150
|
+
|
|
151
|
+
const config = {
|
|
152
|
+
walletAddress: '0x...',
|
|
153
|
+
privateKey: '0x...',
|
|
154
|
+
};
|
|
155
|
+
|
|
156
|
+
// Create tools for your agent
|
|
157
|
+
const createSessionTool = createEphemeralCreateSessionTool(config);
|
|
158
|
+
const writeSlotTool = createEphemeralWriteSlotTool(config);
|
|
159
|
+
const readSlotTool = createEphemeralReadSlotTool(config);
|
|
160
|
+
const promoteTool = createEphemeralPromoteTool(config);
|
|
161
|
+
const statusTool = createEphemeralStatusTool(config);
|
|
162
|
+
|
|
163
|
+
// Add to agent's toolkit
|
|
164
|
+
const tools = [createSessionTool, writeSlotTool, readSlotTool, promoteTool, statusTool];
|
|
164
165
|
```
|
|
165
166
|
|
|
166
|
-
|
|
167
|
+
Or use class-based wrappers:
|
|
167
168
|
|
|
168
|
-
|
|
169
|
+
```typescript
|
|
170
|
+
import {
|
|
171
|
+
XacheEphemeralCreateSessionTool,
|
|
172
|
+
XacheEphemeralWriteSlotTool,
|
|
173
|
+
XacheEphemeralReadSlotTool,
|
|
174
|
+
XacheEphemeralPromoteTool,
|
|
175
|
+
XacheEphemeralStatusTool,
|
|
176
|
+
} from '@xache/langchain';
|
|
177
|
+
|
|
178
|
+
const createSession = new XacheEphemeralCreateSessionTool(config);
|
|
179
|
+
const tool = createSession.asTool();
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
### Reputation
|
|
169
183
|
|
|
170
184
|
```typescript
|
|
171
185
|
import { createReputationTool, XacheReputationChecker } from '@xache/langchain';
|
|
172
186
|
|
|
173
|
-
// As a tool for your agent
|
|
174
187
|
const repTool = createReputationTool({
|
|
175
188
|
walletAddress: '0x...',
|
|
176
189
|
privateKey: '0x...',
|
|
177
190
|
});
|
|
178
191
|
|
|
179
|
-
// Or check other agents
|
|
180
192
|
const checker = new XacheReputationChecker({
|
|
181
193
|
walletAddress: '0x...',
|
|
182
194
|
privateKey: '0x...',
|
|
183
195
|
});
|
|
184
|
-
|
|
185
|
-
const otherRep = await checker.check('did:agent:evm:0xOtherAgent...');
|
|
186
|
-
if (otherRep.score >= 0.5) {
|
|
187
|
-
console.log('Agent is trustworthy');
|
|
188
|
-
}
|
|
189
196
|
```
|
|
190
197
|
|
|
191
198
|
## Chat History
|
|
192
199
|
|
|
193
|
-
For more control over message history:
|
|
194
|
-
|
|
195
200
|
```typescript
|
|
196
201
|
import { XacheChatMessageHistory } from '@xache/langchain';
|
|
197
202
|
import { BufferMemory } from 'langchain/memory';
|
|
@@ -209,19 +214,17 @@ const memory = new BufferMemory({ chatHistory: history });
|
|
|
209
214
|
|
|
210
215
|
All operations use x402 micropayments (auto-handled):
|
|
211
216
|
|
|
212
|
-
| Operation
|
|
213
|
-
|
|
214
|
-
| Memory Store
|
|
215
|
-
| Memory Retrieve
|
|
216
|
-
| Collective Contribute| $0.002 |
|
|
217
|
-
| Collective Query
|
|
217
|
+
| Operation | Price |
|
|
218
|
+
|-----------|-------|
|
|
219
|
+
| Memory Store | $0.002 |
|
|
220
|
+
| Memory Retrieve | $0.003 |
|
|
221
|
+
| Collective Contribute | $0.002 |
|
|
222
|
+
| Collective Query | $0.011 |
|
|
223
|
+
| Ephemeral Session | $0.005 |
|
|
224
|
+
| Ephemeral Promote | $0.05 |
|
|
218
225
|
| Extraction (managed) | $0.011 |
|
|
219
|
-
| Graph Operations
|
|
220
|
-
| Graph Ask (managed)
|
|
221
|
-
|
|
222
|
-
## ERC-8004 Portable Reputation
|
|
223
|
-
|
|
224
|
-
Xache supports [ERC-8004](https://eips.ethereum.org/EIPS/eip-8004) for portable, on-chain reputation. Enable it to make your agent's reputation verifiable across platforms.
|
|
226
|
+
| Graph Operations | $0.002 |
|
|
227
|
+
| Graph Ask (managed) | $0.011 |
|
|
225
228
|
|
|
226
229
|
## Resources
|
|
227
230
|
|
package/dist/index.d.mts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { BaseMemory, InputValues, MemoryVariables, OutputValues } from '@langchain/core/memory';
|
|
2
2
|
import { BaseListChatMessageHistory } from '@langchain/core/chat_history';
|
|
3
3
|
import { BaseMessage } from '@langchain/core/messages';
|
|
4
|
+
import { XacheSigner, XacheWalletProvider, LLMProvider, LLMApiFormat, SubjectContext } from '@xache/sdk';
|
|
4
5
|
import { BaseRetriever, BaseRetrieverInput } from '@langchain/core/retrievers';
|
|
5
6
|
import { Document } from '@langchain/core/documents';
|
|
6
7
|
import { CallbackManagerForRetrieverRun } from '@langchain/core/callbacks/manager';
|
|
7
|
-
import { LLMProvider, LLMApiFormat, SubjectContext } from '@xache/sdk';
|
|
8
8
|
import { DynamicStructuredTool } from '@langchain/core/tools';
|
|
9
9
|
|
|
10
10
|
/**
|
|
@@ -15,8 +15,14 @@ import { DynamicStructuredTool } from '@langchain/core/tools';
|
|
|
15
15
|
interface XacheChatMessageHistoryConfig {
|
|
16
16
|
/** Wallet address for authentication */
|
|
17
17
|
walletAddress: string;
|
|
18
|
-
/** Private key for signing */
|
|
19
|
-
privateKey
|
|
18
|
+
/** Private key for signing (optional if signer or walletProvider is provided) */
|
|
19
|
+
privateKey?: string;
|
|
20
|
+
/** External signer (alternative to privateKey) */
|
|
21
|
+
signer?: XacheSigner;
|
|
22
|
+
/** Wallet provider for lazy signer resolution */
|
|
23
|
+
walletProvider?: XacheWalletProvider;
|
|
24
|
+
/** Encryption key for use with external signers */
|
|
25
|
+
encryptionKey?: string;
|
|
20
26
|
/** Session ID to group messages */
|
|
21
27
|
sessionId?: string;
|
|
22
28
|
/** API URL (defaults to https://api.xache.xyz) */
|
|
@@ -166,8 +172,14 @@ declare class XacheConversationBufferMemory extends XacheMemory {
|
|
|
166
172
|
interface XacheRetrieverConfig extends BaseRetrieverInput {
|
|
167
173
|
/** Wallet address for authentication */
|
|
168
174
|
walletAddress: string;
|
|
169
|
-
/** Private key for signing */
|
|
170
|
-
privateKey
|
|
175
|
+
/** Private key for signing (optional if signer or walletProvider is provided) */
|
|
176
|
+
privateKey?: string;
|
|
177
|
+
/** External signer (alternative to privateKey) */
|
|
178
|
+
signer?: XacheSigner;
|
|
179
|
+
/** Wallet provider for lazy signer resolution */
|
|
180
|
+
walletProvider?: XacheWalletProvider;
|
|
181
|
+
/** Encryption key for use with external signers */
|
|
182
|
+
encryptionKey?: string;
|
|
171
183
|
/** Number of documents to retrieve */
|
|
172
184
|
k?: number;
|
|
173
185
|
/** Filter by context */
|
|
@@ -238,8 +250,14 @@ interface ExtractionResult {
|
|
|
238
250
|
interface XacheExtractorConfig {
|
|
239
251
|
/** Wallet address for authentication */
|
|
240
252
|
walletAddress: string;
|
|
241
|
-
/** Private key for signing */
|
|
242
|
-
privateKey
|
|
253
|
+
/** Private key for signing (optional if signer or walletProvider is provided) */
|
|
254
|
+
privateKey?: string;
|
|
255
|
+
/** External signer (alternative to privateKey) */
|
|
256
|
+
signer?: XacheSigner;
|
|
257
|
+
/** Wallet provider for lazy signer resolution */
|
|
258
|
+
walletProvider?: XacheWalletProvider;
|
|
259
|
+
/** Encryption key for use with external signers */
|
|
260
|
+
encryptionKey?: string;
|
|
243
261
|
/**
|
|
244
262
|
* Extraction mode:
|
|
245
263
|
* - 'xache-managed': Xache provides the LLM ($0.011)
|
|
@@ -336,8 +354,14 @@ declare class XacheExtractor {
|
|
|
336
354
|
interface CollectiveToolConfig {
|
|
337
355
|
/** Wallet address for authentication */
|
|
338
356
|
walletAddress: string;
|
|
339
|
-
/** Private key for signing */
|
|
340
|
-
privateKey
|
|
357
|
+
/** Private key for signing (optional if signer or walletProvider is provided) */
|
|
358
|
+
privateKey?: string;
|
|
359
|
+
/** External signer (alternative to privateKey) */
|
|
360
|
+
signer?: XacheSigner;
|
|
361
|
+
/** Wallet provider for lazy signer resolution */
|
|
362
|
+
walletProvider?: XacheWalletProvider;
|
|
363
|
+
/** Encryption key for use with external signers */
|
|
364
|
+
encryptionKey?: string;
|
|
341
365
|
/** API URL (defaults to https://api.xache.xyz) */
|
|
342
366
|
apiUrl?: string;
|
|
343
367
|
/** Chain: 'base' or 'solana' */
|
|
@@ -400,8 +424,14 @@ declare class XacheCollectiveQueryTool {
|
|
|
400
424
|
interface ReputationToolConfig {
|
|
401
425
|
/** Wallet address for authentication */
|
|
402
426
|
walletAddress: string;
|
|
403
|
-
/** Private key for signing */
|
|
404
|
-
privateKey
|
|
427
|
+
/** Private key for signing (optional if signer or walletProvider is provided) */
|
|
428
|
+
privateKey?: string;
|
|
429
|
+
/** External signer (alternative to privateKey) */
|
|
430
|
+
signer?: XacheSigner;
|
|
431
|
+
/** Wallet provider for lazy signer resolution */
|
|
432
|
+
walletProvider?: XacheWalletProvider;
|
|
433
|
+
/** Encryption key for use with external signers */
|
|
434
|
+
encryptionKey?: string;
|
|
405
435
|
/** API URL (defaults to https://api.xache.xyz) */
|
|
406
436
|
apiUrl?: string;
|
|
407
437
|
/** Chain: 'base' or 'solana' */
|
|
@@ -484,8 +514,14 @@ declare class XacheReputationChecker {
|
|
|
484
514
|
interface GraphToolConfig {
|
|
485
515
|
/** Wallet address for authentication */
|
|
486
516
|
walletAddress: string;
|
|
487
|
-
/** Private key for signing */
|
|
488
|
-
privateKey
|
|
517
|
+
/** Private key for signing (optional if signer or walletProvider is provided) */
|
|
518
|
+
privateKey?: string;
|
|
519
|
+
/** External signer (alternative to privateKey) */
|
|
520
|
+
signer?: XacheSigner;
|
|
521
|
+
/** Wallet provider for lazy signer resolution */
|
|
522
|
+
walletProvider?: XacheWalletProvider;
|
|
523
|
+
/** Encryption key for use with external signers */
|
|
524
|
+
encryptionKey?: string;
|
|
489
525
|
/** API URL (defaults to https://api.xache.xyz) */
|
|
490
526
|
apiUrl?: string;
|
|
491
527
|
/** Chain: 'base' or 'solana' */
|
|
@@ -598,8 +634,14 @@ declare class XacheGraphEntityHistoryTool {
|
|
|
598
634
|
interface XacheGraphRetrieverConfig extends BaseRetrieverInput {
|
|
599
635
|
/** Wallet address for authentication */
|
|
600
636
|
walletAddress: string;
|
|
601
|
-
/** Private key for signing */
|
|
602
|
-
privateKey
|
|
637
|
+
/** Private key for signing (optional if signer or walletProvider is provided) */
|
|
638
|
+
privateKey?: string;
|
|
639
|
+
/** External signer (alternative to privateKey) */
|
|
640
|
+
signer?: XacheSigner;
|
|
641
|
+
/** Wallet provider for lazy signer resolution */
|
|
642
|
+
walletProvider?: XacheWalletProvider;
|
|
643
|
+
/** Encryption key for use with external signers */
|
|
644
|
+
encryptionKey?: string;
|
|
603
645
|
/** API URL (defaults to https://api.xache.xyz) */
|
|
604
646
|
apiUrl?: string;
|
|
605
647
|
/** Chain: 'base' or 'solana' */
|
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { BaseMemory, InputValues, MemoryVariables, OutputValues } from '@langchain/core/memory';
|
|
2
2
|
import { BaseListChatMessageHistory } from '@langchain/core/chat_history';
|
|
3
3
|
import { BaseMessage } from '@langchain/core/messages';
|
|
4
|
+
import { XacheSigner, XacheWalletProvider, LLMProvider, LLMApiFormat, SubjectContext } from '@xache/sdk';
|
|
4
5
|
import { BaseRetriever, BaseRetrieverInput } from '@langchain/core/retrievers';
|
|
5
6
|
import { Document } from '@langchain/core/documents';
|
|
6
7
|
import { CallbackManagerForRetrieverRun } from '@langchain/core/callbacks/manager';
|
|
7
|
-
import { LLMProvider, LLMApiFormat, SubjectContext } from '@xache/sdk';
|
|
8
8
|
import { DynamicStructuredTool } from '@langchain/core/tools';
|
|
9
9
|
|
|
10
10
|
/**
|
|
@@ -15,8 +15,14 @@ import { DynamicStructuredTool } from '@langchain/core/tools';
|
|
|
15
15
|
interface XacheChatMessageHistoryConfig {
|
|
16
16
|
/** Wallet address for authentication */
|
|
17
17
|
walletAddress: string;
|
|
18
|
-
/** Private key for signing */
|
|
19
|
-
privateKey
|
|
18
|
+
/** Private key for signing (optional if signer or walletProvider is provided) */
|
|
19
|
+
privateKey?: string;
|
|
20
|
+
/** External signer (alternative to privateKey) */
|
|
21
|
+
signer?: XacheSigner;
|
|
22
|
+
/** Wallet provider for lazy signer resolution */
|
|
23
|
+
walletProvider?: XacheWalletProvider;
|
|
24
|
+
/** Encryption key for use with external signers */
|
|
25
|
+
encryptionKey?: string;
|
|
20
26
|
/** Session ID to group messages */
|
|
21
27
|
sessionId?: string;
|
|
22
28
|
/** API URL (defaults to https://api.xache.xyz) */
|
|
@@ -166,8 +172,14 @@ declare class XacheConversationBufferMemory extends XacheMemory {
|
|
|
166
172
|
interface XacheRetrieverConfig extends BaseRetrieverInput {
|
|
167
173
|
/** Wallet address for authentication */
|
|
168
174
|
walletAddress: string;
|
|
169
|
-
/** Private key for signing */
|
|
170
|
-
privateKey
|
|
175
|
+
/** Private key for signing (optional if signer or walletProvider is provided) */
|
|
176
|
+
privateKey?: string;
|
|
177
|
+
/** External signer (alternative to privateKey) */
|
|
178
|
+
signer?: XacheSigner;
|
|
179
|
+
/** Wallet provider for lazy signer resolution */
|
|
180
|
+
walletProvider?: XacheWalletProvider;
|
|
181
|
+
/** Encryption key for use with external signers */
|
|
182
|
+
encryptionKey?: string;
|
|
171
183
|
/** Number of documents to retrieve */
|
|
172
184
|
k?: number;
|
|
173
185
|
/** Filter by context */
|
|
@@ -238,8 +250,14 @@ interface ExtractionResult {
|
|
|
238
250
|
interface XacheExtractorConfig {
|
|
239
251
|
/** Wallet address for authentication */
|
|
240
252
|
walletAddress: string;
|
|
241
|
-
/** Private key for signing */
|
|
242
|
-
privateKey
|
|
253
|
+
/** Private key for signing (optional if signer or walletProvider is provided) */
|
|
254
|
+
privateKey?: string;
|
|
255
|
+
/** External signer (alternative to privateKey) */
|
|
256
|
+
signer?: XacheSigner;
|
|
257
|
+
/** Wallet provider for lazy signer resolution */
|
|
258
|
+
walletProvider?: XacheWalletProvider;
|
|
259
|
+
/** Encryption key for use with external signers */
|
|
260
|
+
encryptionKey?: string;
|
|
243
261
|
/**
|
|
244
262
|
* Extraction mode:
|
|
245
263
|
* - 'xache-managed': Xache provides the LLM ($0.011)
|
|
@@ -336,8 +354,14 @@ declare class XacheExtractor {
|
|
|
336
354
|
interface CollectiveToolConfig {
|
|
337
355
|
/** Wallet address for authentication */
|
|
338
356
|
walletAddress: string;
|
|
339
|
-
/** Private key for signing */
|
|
340
|
-
privateKey
|
|
357
|
+
/** Private key for signing (optional if signer or walletProvider is provided) */
|
|
358
|
+
privateKey?: string;
|
|
359
|
+
/** External signer (alternative to privateKey) */
|
|
360
|
+
signer?: XacheSigner;
|
|
361
|
+
/** Wallet provider for lazy signer resolution */
|
|
362
|
+
walletProvider?: XacheWalletProvider;
|
|
363
|
+
/** Encryption key for use with external signers */
|
|
364
|
+
encryptionKey?: string;
|
|
341
365
|
/** API URL (defaults to https://api.xache.xyz) */
|
|
342
366
|
apiUrl?: string;
|
|
343
367
|
/** Chain: 'base' or 'solana' */
|
|
@@ -400,8 +424,14 @@ declare class XacheCollectiveQueryTool {
|
|
|
400
424
|
interface ReputationToolConfig {
|
|
401
425
|
/** Wallet address for authentication */
|
|
402
426
|
walletAddress: string;
|
|
403
|
-
/** Private key for signing */
|
|
404
|
-
privateKey
|
|
427
|
+
/** Private key for signing (optional if signer or walletProvider is provided) */
|
|
428
|
+
privateKey?: string;
|
|
429
|
+
/** External signer (alternative to privateKey) */
|
|
430
|
+
signer?: XacheSigner;
|
|
431
|
+
/** Wallet provider for lazy signer resolution */
|
|
432
|
+
walletProvider?: XacheWalletProvider;
|
|
433
|
+
/** Encryption key for use with external signers */
|
|
434
|
+
encryptionKey?: string;
|
|
405
435
|
/** API URL (defaults to https://api.xache.xyz) */
|
|
406
436
|
apiUrl?: string;
|
|
407
437
|
/** Chain: 'base' or 'solana' */
|
|
@@ -484,8 +514,14 @@ declare class XacheReputationChecker {
|
|
|
484
514
|
interface GraphToolConfig {
|
|
485
515
|
/** Wallet address for authentication */
|
|
486
516
|
walletAddress: string;
|
|
487
|
-
/** Private key for signing */
|
|
488
|
-
privateKey
|
|
517
|
+
/** Private key for signing (optional if signer or walletProvider is provided) */
|
|
518
|
+
privateKey?: string;
|
|
519
|
+
/** External signer (alternative to privateKey) */
|
|
520
|
+
signer?: XacheSigner;
|
|
521
|
+
/** Wallet provider for lazy signer resolution */
|
|
522
|
+
walletProvider?: XacheWalletProvider;
|
|
523
|
+
/** Encryption key for use with external signers */
|
|
524
|
+
encryptionKey?: string;
|
|
489
525
|
/** API URL (defaults to https://api.xache.xyz) */
|
|
490
526
|
apiUrl?: string;
|
|
491
527
|
/** Chain: 'base' or 'solana' */
|
|
@@ -598,8 +634,14 @@ declare class XacheGraphEntityHistoryTool {
|
|
|
598
634
|
interface XacheGraphRetrieverConfig extends BaseRetrieverInput {
|
|
599
635
|
/** Wallet address for authentication */
|
|
600
636
|
walletAddress: string;
|
|
601
|
-
/** Private key for signing */
|
|
602
|
-
privateKey
|
|
637
|
+
/** Private key for signing (optional if signer or walletProvider is provided) */
|
|
638
|
+
privateKey?: string;
|
|
639
|
+
/** External signer (alternative to privateKey) */
|
|
640
|
+
signer?: XacheSigner;
|
|
641
|
+
/** Wallet provider for lazy signer resolution */
|
|
642
|
+
walletProvider?: XacheWalletProvider;
|
|
643
|
+
/** Encryption key for use with external signers */
|
|
644
|
+
encryptionKey?: string;
|
|
603
645
|
/** API URL (defaults to https://api.xache.xyz) */
|
|
604
646
|
apiUrl?: string;
|
|
605
647
|
/** Chain: 'base' or 'solana' */
|
package/dist/index.js
CHANGED
|
@@ -70,6 +70,9 @@ var XacheChatMessageHistory = class extends import_chat_history.BaseListChatMess
|
|
|
70
70
|
apiUrl: config.apiUrl || "https://api.xache.xyz",
|
|
71
71
|
did,
|
|
72
72
|
privateKey: config.privateKey,
|
|
73
|
+
signer: config.signer,
|
|
74
|
+
walletProvider: config.walletProvider,
|
|
75
|
+
encryptionKey: config.encryptionKey,
|
|
73
76
|
timeout: config.timeout,
|
|
74
77
|
debug: config.debug
|
|
75
78
|
});
|
|
@@ -264,7 +267,10 @@ var XacheRetriever = class extends import_retrievers.BaseRetriever {
|
|
|
264
267
|
this.client = new import_sdk2.XacheClient({
|
|
265
268
|
apiUrl: config.apiUrl || "https://api.xache.xyz",
|
|
266
269
|
did,
|
|
267
|
-
privateKey: config.privateKey
|
|
270
|
+
privateKey: config.privateKey,
|
|
271
|
+
signer: config.signer,
|
|
272
|
+
walletProvider: config.walletProvider,
|
|
273
|
+
encryptionKey: config.encryptionKey
|
|
268
274
|
});
|
|
269
275
|
this.k = config.k ?? 5;
|
|
270
276
|
this.filterContext = config.context;
|
|
@@ -310,6 +316,9 @@ var XacheExtractor = class {
|
|
|
310
316
|
apiUrl: config.apiUrl || "https://api.xache.xyz",
|
|
311
317
|
did,
|
|
312
318
|
privateKey: config.privateKey,
|
|
319
|
+
signer: config.signer,
|
|
320
|
+
walletProvider: config.walletProvider,
|
|
321
|
+
encryptionKey: config.encryptionKey,
|
|
313
322
|
timeout: config.timeout,
|
|
314
323
|
debug: config.debug
|
|
315
324
|
});
|
|
@@ -398,7 +407,10 @@ function createClient(config) {
|
|
|
398
407
|
return new import_sdk4.XacheClient({
|
|
399
408
|
apiUrl: config.apiUrl || "https://api.xache.xyz",
|
|
400
409
|
did,
|
|
401
|
-
privateKey: config.privateKey
|
|
410
|
+
privateKey: config.privateKey,
|
|
411
|
+
signer: config.signer,
|
|
412
|
+
walletProvider: config.walletProvider,
|
|
413
|
+
encryptionKey: config.encryptionKey
|
|
402
414
|
});
|
|
403
415
|
}
|
|
404
416
|
function createCollectiveContributeTool(config) {
|
|
@@ -507,7 +519,10 @@ function createClient2(config) {
|
|
|
507
519
|
return new import_sdk5.XacheClient({
|
|
508
520
|
apiUrl: config.apiUrl || "https://api.xache.xyz",
|
|
509
521
|
did,
|
|
510
|
-
privateKey: config.privateKey
|
|
522
|
+
privateKey: config.privateKey,
|
|
523
|
+
signer: config.signer,
|
|
524
|
+
walletProvider: config.walletProvider,
|
|
525
|
+
encryptionKey: config.encryptionKey
|
|
511
526
|
});
|
|
512
527
|
}
|
|
513
528
|
function createReputationTool(config) {
|
|
@@ -602,7 +617,10 @@ function createClient3(config) {
|
|
|
602
617
|
return new import_sdk6.XacheClient({
|
|
603
618
|
apiUrl: config.apiUrl || "https://api.xache.xyz",
|
|
604
619
|
did,
|
|
605
|
-
privateKey: config.privateKey
|
|
620
|
+
privateKey: config.privateKey,
|
|
621
|
+
signer: config.signer,
|
|
622
|
+
walletProvider: config.walletProvider,
|
|
623
|
+
encryptionKey: config.encryptionKey
|
|
606
624
|
});
|
|
607
625
|
}
|
|
608
626
|
function getSubject(config) {
|
|
@@ -912,7 +930,10 @@ var XacheGraphRetriever = class extends import_retrievers2.BaseRetriever {
|
|
|
912
930
|
this.client = new import_sdk6.XacheClient({
|
|
913
931
|
apiUrl: config.apiUrl || "https://api.xache.xyz",
|
|
914
932
|
did,
|
|
915
|
-
privateKey: config.privateKey
|
|
933
|
+
privateKey: config.privateKey,
|
|
934
|
+
signer: config.signer,
|
|
935
|
+
walletProvider: config.walletProvider,
|
|
936
|
+
encryptionKey: config.encryptionKey
|
|
916
937
|
});
|
|
917
938
|
this.subject = config.subject || { scope: "GLOBAL" };
|
|
918
939
|
this.startEntity = config.startEntity;
|