hebbrix 2.0.0 → 2.1.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/LICENSE +21 -0
- package/README.md +32 -9
- package/dist/index.d.mts +45 -8
- package/dist/index.d.ts +45 -8
- package/dist/index.js +43 -2
- package/dist/index.mjs +42 -2
- package/package.json +7 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Hebbrix
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -14,6 +14,7 @@ Official TypeScript/JavaScript SDK for the Hebbrix api - **the only memory API w
|
|
|
14
14
|
- ✅ **Procedural Memory** - Store and execute learned skills
|
|
15
15
|
- ✅ **Working Memory** - Short-term context buffer for conversations
|
|
16
16
|
- ✅ **Memory Consolidation** - Automatic compression of episodic memories
|
|
17
|
+
- ✅ **ProofLoop** - Learn from outcomes with automatic, verifiable evidence receipts
|
|
17
18
|
- ✅ **Promise-based** - Native async/await support
|
|
18
19
|
- ✅ **Type-safe** - Complete TypeScript type definitions
|
|
19
20
|
- ✅ **Universal** - Works in Node.js and browsers
|
|
@@ -73,6 +74,28 @@ const main = async () => {
|
|
|
73
74
|
main();
|
|
74
75
|
```
|
|
75
76
|
|
|
77
|
+
## ProofLoop: search → decision → outcome → proof
|
|
78
|
+
|
|
79
|
+
```typescript
|
|
80
|
+
const search = await client.searchWithProof({
|
|
81
|
+
query: 'What should the agent do next?',
|
|
82
|
+
collection_id: 'collection-42',
|
|
83
|
+
user_id: 'customer-7',
|
|
84
|
+
});
|
|
85
|
+
const decision = await client.proofloop.decide({
|
|
86
|
+
policy_key: 'agent.next_action',
|
|
87
|
+
candidates: [{ action_key: 'act' }, { action_key: 'ask' }],
|
|
88
|
+
collection_id: 'collection-42',
|
|
89
|
+
user_id: 'customer-7',
|
|
90
|
+
proof_context: search.proof_context,
|
|
91
|
+
});
|
|
92
|
+
await client.proofloop.recordOutcome(decision.decision_id, {
|
|
93
|
+
success: true,
|
|
94
|
+
idempotency_key: 'run-123-result',
|
|
95
|
+
});
|
|
96
|
+
const proof = await client.proofloop.proof(decision.decision_id);
|
|
97
|
+
```
|
|
98
|
+
|
|
76
99
|
## 📚 Complete API Guide
|
|
77
100
|
|
|
78
101
|
### 1. Authentication
|
|
@@ -554,18 +577,18 @@ await bot.trainOnConversations();
|
|
|
554
577
|
async function buildKnowledgeGraph(client: MemoryClient, collectionId: string) {
|
|
555
578
|
// Add entities and relationships
|
|
556
579
|
await client.temporal.addFact({
|
|
557
|
-
subject: 'GPT-
|
|
580
|
+
subject: 'GPT-5',
|
|
558
581
|
predicate: 'developed_by',
|
|
559
582
|
object: 'OpenAI',
|
|
560
|
-
valid_from: '
|
|
583
|
+
valid_from: '2025-08-01',
|
|
561
584
|
confidence: 1.0,
|
|
562
585
|
});
|
|
563
586
|
|
|
564
587
|
await client.temporal.addFact({
|
|
565
|
-
subject: 'GPT-
|
|
588
|
+
subject: 'GPT-5',
|
|
566
589
|
predicate: 'is_a',
|
|
567
590
|
object: 'Large Language Model',
|
|
568
|
-
valid_from: '
|
|
591
|
+
valid_from: '2025-08-01',
|
|
569
592
|
confidence: 1.0,
|
|
570
593
|
});
|
|
571
594
|
|
|
@@ -579,18 +602,18 @@ async function buildKnowledgeGraph(client: MemoryClient, collectionId: string) {
|
|
|
579
602
|
|
|
580
603
|
// Query relationships
|
|
581
604
|
const facts = await client.temporal.queryFacts({
|
|
582
|
-
subject: 'GPT-
|
|
605
|
+
subject: 'GPT-5',
|
|
583
606
|
});
|
|
584
607
|
|
|
585
|
-
console.log(facts); // All facts about GPT-
|
|
608
|
+
console.log(facts); // All facts about GPT-5
|
|
586
609
|
|
|
587
610
|
// Historical query
|
|
588
611
|
const snapshot = await client.temporal.pointInTime(
|
|
589
|
-
'
|
|
612
|
+
'2025-01-01T00:00:00Z',
|
|
590
613
|
'OpenAI'
|
|
591
614
|
);
|
|
592
615
|
|
|
593
|
-
console.log(snapshot); // OpenAI's state before GPT-
|
|
616
|
+
console.log(snapshot); // OpenAI's state before GPT-5 release
|
|
594
617
|
}
|
|
595
618
|
```
|
|
596
619
|
|
|
@@ -632,7 +655,7 @@ const client = new MemoryClient({
|
|
|
632
655
|
// Required: API key
|
|
633
656
|
apiKey: 'hbx_...',
|
|
634
657
|
|
|
635
|
-
// Optional: Custom base URL (default:
|
|
658
|
+
// Optional: Custom base URL (default: https://api.hebbrix.com)
|
|
636
659
|
baseUrl: 'https://api.yourdomain.com',
|
|
637
660
|
|
|
638
661
|
// Optional: Request timeout in milliseconds (default: 30000)
|
package/dist/index.d.mts
CHANGED
|
@@ -17,7 +17,7 @@ interface User {
|
|
|
17
17
|
full_name: string;
|
|
18
18
|
is_active: boolean;
|
|
19
19
|
is_verified: boolean;
|
|
20
|
-
tier:
|
|
20
|
+
tier: "free" | "starter" | "pro" | "enterprise";
|
|
21
21
|
}
|
|
22
22
|
interface Collection {
|
|
23
23
|
id: string;
|
|
@@ -57,6 +57,30 @@ interface SearchResponse {
|
|
|
57
57
|
total: number;
|
|
58
58
|
search_type: string;
|
|
59
59
|
processing_time_ms: number;
|
|
60
|
+
proof_context?: ProofContext;
|
|
61
|
+
}
|
|
62
|
+
interface ProofContext {
|
|
63
|
+
schema_version: "proofloop-context-v1";
|
|
64
|
+
context_id: string;
|
|
65
|
+
token: string;
|
|
66
|
+
manifest_digest: string;
|
|
67
|
+
evidence_manifest: Record<string, any>;
|
|
68
|
+
trace_id?: string;
|
|
69
|
+
issued_at: string;
|
|
70
|
+
expires_at: string;
|
|
71
|
+
}
|
|
72
|
+
interface ProofLoopCandidate {
|
|
73
|
+
action_key: string;
|
|
74
|
+
description?: string;
|
|
75
|
+
features?: Record<string, any>;
|
|
76
|
+
}
|
|
77
|
+
interface ProofLoopDecisionParams {
|
|
78
|
+
policy_key: string;
|
|
79
|
+
candidates: ProofLoopCandidate[];
|
|
80
|
+
proof_context?: ProofContext | string;
|
|
81
|
+
collection_id?: string;
|
|
82
|
+
user_id?: string;
|
|
83
|
+
[key: string]: any;
|
|
60
84
|
}
|
|
61
85
|
interface ReasoningSource {
|
|
62
86
|
memory_id: string;
|
|
@@ -96,13 +120,14 @@ interface SearchParams {
|
|
|
96
120
|
query: string;
|
|
97
121
|
collection_id?: string;
|
|
98
122
|
limit?: number;
|
|
99
|
-
search_type?:
|
|
123
|
+
search_type?: "hybrid" | "vector" | "bm25" | "graph";
|
|
100
124
|
filters?: Record<string, any>;
|
|
125
|
+
user_id?: string;
|
|
101
126
|
}
|
|
102
127
|
interface ReasonParams {
|
|
103
128
|
query: string;
|
|
104
129
|
collection_id?: string;
|
|
105
|
-
provider?:
|
|
130
|
+
provider?: "gemini" | "openai" | "anthropic";
|
|
106
131
|
include_steps?: boolean;
|
|
107
132
|
}
|
|
108
133
|
interface ListParams {
|
|
@@ -194,6 +219,8 @@ declare class SearchResource extends BaseResource {
|
|
|
194
219
|
* Search memories
|
|
195
220
|
*/
|
|
196
221
|
search(params: SearchParams): Promise<SearchResult[]>;
|
|
222
|
+
/** Search while preserving the automatic ProofLoop evidence context. */
|
|
223
|
+
searchWithProof(params: SearchParams): Promise<SearchResponse>;
|
|
197
224
|
/**
|
|
198
225
|
* Find similar memories
|
|
199
226
|
*/
|
|
@@ -203,6 +230,18 @@ declare class SearchResource extends BaseResource {
|
|
|
203
230
|
*/
|
|
204
231
|
reason(params: ReasonParams): Promise<ReasoningResponse>;
|
|
205
232
|
}
|
|
233
|
+
declare class ProofLoopResource extends BaseResource {
|
|
234
|
+
/** Create a causal decision bound to search/chat evidence automatically. */
|
|
235
|
+
decide(params: ProofLoopDecisionParams): Promise<Record<string, any>>;
|
|
236
|
+
recordOutcome(decisionId: string, body: {
|
|
237
|
+
observations?: Record<string, any>[];
|
|
238
|
+
reward?: number;
|
|
239
|
+
success?: boolean;
|
|
240
|
+
idempotency_key?: string;
|
|
241
|
+
}): Promise<Record<string, any>>;
|
|
242
|
+
proof(decisionId: string): Promise<Record<string, any>>;
|
|
243
|
+
publicKey(): Promise<Record<string, any>>;
|
|
244
|
+
}
|
|
206
245
|
declare class RLResource extends BaseResource {
|
|
207
246
|
/**
|
|
208
247
|
* Train the Memory Manager agent using RL
|
|
@@ -372,10 +411,6 @@ declare class WorldModelResource extends BaseResource {
|
|
|
372
411
|
plan(goal: string, collectionId?: string): Promise<any>;
|
|
373
412
|
}
|
|
374
413
|
|
|
375
|
-
/**
|
|
376
|
-
* Main Hebbrix client
|
|
377
|
-
*/
|
|
378
|
-
|
|
379
414
|
declare class MemoryClient {
|
|
380
415
|
private apiKey?;
|
|
381
416
|
private baseUrl;
|
|
@@ -391,6 +426,7 @@ declare class MemoryClient {
|
|
|
391
426
|
consolidation: ConsolidationResource;
|
|
392
427
|
memoryTools: MemoryToolsResource;
|
|
393
428
|
worldModel: WorldModelResource;
|
|
429
|
+
proofloop: ProofLoopResource;
|
|
394
430
|
constructor(config?: ClientConfig);
|
|
395
431
|
private getHeaders;
|
|
396
432
|
private handleError;
|
|
@@ -400,6 +436,7 @@ declare class MemoryClient {
|
|
|
400
436
|
patch<T = any>(path: string, body?: any): Promise<T>;
|
|
401
437
|
delete<T = any>(path: string): Promise<T>;
|
|
402
438
|
search(params: SearchParams): Promise<SearchResult[]>;
|
|
439
|
+
searchWithProof(params: SearchParams): Promise<SearchResponse>;
|
|
403
440
|
reason(params: ReasonParams): Promise<ReasoningResponse>;
|
|
404
441
|
}
|
|
405
442
|
|
|
@@ -427,4 +464,4 @@ declare class ServerError extends HebbrixError {
|
|
|
427
464
|
constructor(message?: string);
|
|
428
465
|
}
|
|
429
466
|
|
|
430
|
-
export { type APIKeyResponse, AuthResource, type AuthResponse, AuthenticationError, type ClientConfig, type Collection, CollectionsResource, ConsolidationResource, type CreateCollectionParams, type CreateMemoryParams, HebbrixError, type ListParams, MemoriesResource, type Memory, MemoryClient, MemoryToolsResource, type MemoryWithMetadata, NotFoundError, ProceduralResource, RLResource, RateLimitError, type ReasonParams, type ReasoningResponse, type ReasoningSource, type SearchParams, SearchResource, type SearchResponse, type SearchResult, ServerError, TemporalResource, type UpdateCollectionParams, type UpdateMemoryParams, type User, ValidationError, WorkingMemoryResource, WorldModelResource };
|
|
467
|
+
export { type APIKeyResponse, AuthResource, type AuthResponse, AuthenticationError, type ClientConfig, type Collection, CollectionsResource, ConsolidationResource, type CreateCollectionParams, type CreateMemoryParams, HebbrixError, type ListParams, MemoriesResource, type Memory, MemoryClient, MemoryToolsResource, type MemoryWithMetadata, NotFoundError, ProceduralResource, type ProofContext, type ProofLoopCandidate, type ProofLoopDecisionParams, ProofLoopResource, RLResource, RateLimitError, type ReasonParams, type ReasoningResponse, type ReasoningSource, type SearchParams, SearchResource, type SearchResponse, type SearchResult, ServerError, TemporalResource, type UpdateCollectionParams, type UpdateMemoryParams, type User, ValidationError, WorkingMemoryResource, WorldModelResource };
|
package/dist/index.d.ts
CHANGED
|
@@ -17,7 +17,7 @@ interface User {
|
|
|
17
17
|
full_name: string;
|
|
18
18
|
is_active: boolean;
|
|
19
19
|
is_verified: boolean;
|
|
20
|
-
tier:
|
|
20
|
+
tier: "free" | "starter" | "pro" | "enterprise";
|
|
21
21
|
}
|
|
22
22
|
interface Collection {
|
|
23
23
|
id: string;
|
|
@@ -57,6 +57,30 @@ interface SearchResponse {
|
|
|
57
57
|
total: number;
|
|
58
58
|
search_type: string;
|
|
59
59
|
processing_time_ms: number;
|
|
60
|
+
proof_context?: ProofContext;
|
|
61
|
+
}
|
|
62
|
+
interface ProofContext {
|
|
63
|
+
schema_version: "proofloop-context-v1";
|
|
64
|
+
context_id: string;
|
|
65
|
+
token: string;
|
|
66
|
+
manifest_digest: string;
|
|
67
|
+
evidence_manifest: Record<string, any>;
|
|
68
|
+
trace_id?: string;
|
|
69
|
+
issued_at: string;
|
|
70
|
+
expires_at: string;
|
|
71
|
+
}
|
|
72
|
+
interface ProofLoopCandidate {
|
|
73
|
+
action_key: string;
|
|
74
|
+
description?: string;
|
|
75
|
+
features?: Record<string, any>;
|
|
76
|
+
}
|
|
77
|
+
interface ProofLoopDecisionParams {
|
|
78
|
+
policy_key: string;
|
|
79
|
+
candidates: ProofLoopCandidate[];
|
|
80
|
+
proof_context?: ProofContext | string;
|
|
81
|
+
collection_id?: string;
|
|
82
|
+
user_id?: string;
|
|
83
|
+
[key: string]: any;
|
|
60
84
|
}
|
|
61
85
|
interface ReasoningSource {
|
|
62
86
|
memory_id: string;
|
|
@@ -96,13 +120,14 @@ interface SearchParams {
|
|
|
96
120
|
query: string;
|
|
97
121
|
collection_id?: string;
|
|
98
122
|
limit?: number;
|
|
99
|
-
search_type?:
|
|
123
|
+
search_type?: "hybrid" | "vector" | "bm25" | "graph";
|
|
100
124
|
filters?: Record<string, any>;
|
|
125
|
+
user_id?: string;
|
|
101
126
|
}
|
|
102
127
|
interface ReasonParams {
|
|
103
128
|
query: string;
|
|
104
129
|
collection_id?: string;
|
|
105
|
-
provider?:
|
|
130
|
+
provider?: "gemini" | "openai" | "anthropic";
|
|
106
131
|
include_steps?: boolean;
|
|
107
132
|
}
|
|
108
133
|
interface ListParams {
|
|
@@ -194,6 +219,8 @@ declare class SearchResource extends BaseResource {
|
|
|
194
219
|
* Search memories
|
|
195
220
|
*/
|
|
196
221
|
search(params: SearchParams): Promise<SearchResult[]>;
|
|
222
|
+
/** Search while preserving the automatic ProofLoop evidence context. */
|
|
223
|
+
searchWithProof(params: SearchParams): Promise<SearchResponse>;
|
|
197
224
|
/**
|
|
198
225
|
* Find similar memories
|
|
199
226
|
*/
|
|
@@ -203,6 +230,18 @@ declare class SearchResource extends BaseResource {
|
|
|
203
230
|
*/
|
|
204
231
|
reason(params: ReasonParams): Promise<ReasoningResponse>;
|
|
205
232
|
}
|
|
233
|
+
declare class ProofLoopResource extends BaseResource {
|
|
234
|
+
/** Create a causal decision bound to search/chat evidence automatically. */
|
|
235
|
+
decide(params: ProofLoopDecisionParams): Promise<Record<string, any>>;
|
|
236
|
+
recordOutcome(decisionId: string, body: {
|
|
237
|
+
observations?: Record<string, any>[];
|
|
238
|
+
reward?: number;
|
|
239
|
+
success?: boolean;
|
|
240
|
+
idempotency_key?: string;
|
|
241
|
+
}): Promise<Record<string, any>>;
|
|
242
|
+
proof(decisionId: string): Promise<Record<string, any>>;
|
|
243
|
+
publicKey(): Promise<Record<string, any>>;
|
|
244
|
+
}
|
|
206
245
|
declare class RLResource extends BaseResource {
|
|
207
246
|
/**
|
|
208
247
|
* Train the Memory Manager agent using RL
|
|
@@ -372,10 +411,6 @@ declare class WorldModelResource extends BaseResource {
|
|
|
372
411
|
plan(goal: string, collectionId?: string): Promise<any>;
|
|
373
412
|
}
|
|
374
413
|
|
|
375
|
-
/**
|
|
376
|
-
* Main Hebbrix client
|
|
377
|
-
*/
|
|
378
|
-
|
|
379
414
|
declare class MemoryClient {
|
|
380
415
|
private apiKey?;
|
|
381
416
|
private baseUrl;
|
|
@@ -391,6 +426,7 @@ declare class MemoryClient {
|
|
|
391
426
|
consolidation: ConsolidationResource;
|
|
392
427
|
memoryTools: MemoryToolsResource;
|
|
393
428
|
worldModel: WorldModelResource;
|
|
429
|
+
proofloop: ProofLoopResource;
|
|
394
430
|
constructor(config?: ClientConfig);
|
|
395
431
|
private getHeaders;
|
|
396
432
|
private handleError;
|
|
@@ -400,6 +436,7 @@ declare class MemoryClient {
|
|
|
400
436
|
patch<T = any>(path: string, body?: any): Promise<T>;
|
|
401
437
|
delete<T = any>(path: string): Promise<T>;
|
|
402
438
|
search(params: SearchParams): Promise<SearchResult[]>;
|
|
439
|
+
searchWithProof(params: SearchParams): Promise<SearchResponse>;
|
|
403
440
|
reason(params: ReasonParams): Promise<ReasoningResponse>;
|
|
404
441
|
}
|
|
405
442
|
|
|
@@ -427,4 +464,4 @@ declare class ServerError extends HebbrixError {
|
|
|
427
464
|
constructor(message?: string);
|
|
428
465
|
}
|
|
429
466
|
|
|
430
|
-
export { type APIKeyResponse, AuthResource, type AuthResponse, AuthenticationError, type ClientConfig, type Collection, CollectionsResource, ConsolidationResource, type CreateCollectionParams, type CreateMemoryParams, HebbrixError, type ListParams, MemoriesResource, type Memory, MemoryClient, MemoryToolsResource, type MemoryWithMetadata, NotFoundError, ProceduralResource, RLResource, RateLimitError, type ReasonParams, type ReasoningResponse, type ReasoningSource, type SearchParams, SearchResource, type SearchResponse, type SearchResult, ServerError, TemporalResource, type UpdateCollectionParams, type UpdateMemoryParams, type User, ValidationError, WorkingMemoryResource, WorldModelResource };
|
|
467
|
+
export { type APIKeyResponse, AuthResource, type AuthResponse, AuthenticationError, type ClientConfig, type Collection, CollectionsResource, ConsolidationResource, type CreateCollectionParams, type CreateMemoryParams, HebbrixError, type ListParams, MemoriesResource, type Memory, MemoryClient, MemoryToolsResource, type MemoryWithMetadata, NotFoundError, ProceduralResource, type ProofContext, type ProofLoopCandidate, type ProofLoopDecisionParams, ProofLoopResource, RLResource, RateLimitError, type ReasonParams, type ReasoningResponse, type ReasoningSource, type SearchParams, SearchResource, type SearchResponse, type SearchResult, ServerError, TemporalResource, type UpdateCollectionParams, type UpdateMemoryParams, type User, ValidationError, WorkingMemoryResource, WorldModelResource };
|
package/dist/index.js
CHANGED
|
@@ -30,6 +30,7 @@ __export(index_exports, {
|
|
|
30
30
|
MemoryToolsResource: () => MemoryToolsResource,
|
|
31
31
|
NotFoundError: () => NotFoundError,
|
|
32
32
|
ProceduralResource: () => ProceduralResource,
|
|
33
|
+
ProofLoopResource: () => ProofLoopResource,
|
|
33
34
|
RLResource: () => RLResource,
|
|
34
35
|
RateLimitError: () => RateLimitError,
|
|
35
36
|
SearchResource: () => SearchResource,
|
|
@@ -161,6 +162,17 @@ var SearchResource = class extends BaseResource {
|
|
|
161
162
|
});
|
|
162
163
|
return response.results;
|
|
163
164
|
}
|
|
165
|
+
/** Search while preserving the automatic ProofLoop evidence context. */
|
|
166
|
+
async searchWithProof(params) {
|
|
167
|
+
return this.client.post("/v1/search", {
|
|
168
|
+
query: params.query,
|
|
169
|
+
collection_id: params.collection_id,
|
|
170
|
+
user_id: params.user_id,
|
|
171
|
+
limit: params.limit || 10,
|
|
172
|
+
search_type: params.search_type || "hybrid",
|
|
173
|
+
filters: params.filters || {}
|
|
174
|
+
});
|
|
175
|
+
}
|
|
164
176
|
/**
|
|
165
177
|
* Find similar memories
|
|
166
178
|
*/
|
|
@@ -183,6 +195,30 @@ var SearchResource = class extends BaseResource {
|
|
|
183
195
|
});
|
|
184
196
|
}
|
|
185
197
|
};
|
|
198
|
+
var ProofLoopResource = class extends BaseResource {
|
|
199
|
+
/** Create a causal decision bound to search/chat evidence automatically. */
|
|
200
|
+
async decide(params) {
|
|
201
|
+
const context = params.proof_context;
|
|
202
|
+
const token = typeof context === "string" ? context : context?.token;
|
|
203
|
+
const { proof_context: _context, ...body } = params;
|
|
204
|
+
return this.client.post("/v1/learning/decisions", {
|
|
205
|
+
...body,
|
|
206
|
+
...token ? { proof_context_token: token } : {}
|
|
207
|
+
});
|
|
208
|
+
}
|
|
209
|
+
async recordOutcome(decisionId, body) {
|
|
210
|
+
return this.client.post(`/v1/learning/decisions/${decisionId}/outcomes`, {
|
|
211
|
+
observations: [],
|
|
212
|
+
...body
|
|
213
|
+
});
|
|
214
|
+
}
|
|
215
|
+
async proof(decisionId) {
|
|
216
|
+
return this.client.get(`/v1/learning/decisions/${decisionId}/proof`);
|
|
217
|
+
}
|
|
218
|
+
async publicKey() {
|
|
219
|
+
return this.client.get("/v1/learning/proof-key");
|
|
220
|
+
}
|
|
221
|
+
};
|
|
186
222
|
var RLResource = class extends BaseResource {
|
|
187
223
|
/**
|
|
188
224
|
* Train the Memory Manager agent using RL
|
|
@@ -471,7 +507,7 @@ var ServerError = class _ServerError extends HebbrixError {
|
|
|
471
507
|
var MemoryClient = class {
|
|
472
508
|
constructor(config = {}) {
|
|
473
509
|
this.apiKey = config.apiKey;
|
|
474
|
-
this.baseUrl = config.baseUrl || "https://
|
|
510
|
+
this.baseUrl = config.baseUrl || "https://api.hebbrix.com";
|
|
475
511
|
this.timeout = config.timeout || 12e4;
|
|
476
512
|
this.baseUrl = this.baseUrl.replace(/\/$/, "");
|
|
477
513
|
this.auth = new AuthResource(this);
|
|
@@ -485,11 +521,12 @@ var MemoryClient = class {
|
|
|
485
521
|
this.consolidation = new ConsolidationResource(this);
|
|
486
522
|
this.memoryTools = new MemoryToolsResource(this);
|
|
487
523
|
this.worldModel = new WorldModelResource(this);
|
|
524
|
+
this.proofloop = new ProofLoopResource(this);
|
|
488
525
|
}
|
|
489
526
|
getHeaders() {
|
|
490
527
|
const headers = {
|
|
491
528
|
"Content-Type": "application/json",
|
|
492
|
-
"User-Agent": "hebbrix-typescript/2.
|
|
529
|
+
"User-Agent": "hebbrix-typescript/2.1.0"
|
|
493
530
|
};
|
|
494
531
|
if (this.apiKey) {
|
|
495
532
|
headers["Authorization"] = `Bearer ${this.apiKey}`;
|
|
@@ -567,6 +604,9 @@ var MemoryClient = class {
|
|
|
567
604
|
async search(params) {
|
|
568
605
|
return this.searchResource.search(params);
|
|
569
606
|
}
|
|
607
|
+
async searchWithProof(params) {
|
|
608
|
+
return this.searchResource.searchWithProof(params);
|
|
609
|
+
}
|
|
570
610
|
async reason(params) {
|
|
571
611
|
return this.searchResource.reason(params);
|
|
572
612
|
}
|
|
@@ -583,6 +623,7 @@ var MemoryClient = class {
|
|
|
583
623
|
MemoryToolsResource,
|
|
584
624
|
NotFoundError,
|
|
585
625
|
ProceduralResource,
|
|
626
|
+
ProofLoopResource,
|
|
586
627
|
RLResource,
|
|
587
628
|
RateLimitError,
|
|
588
629
|
SearchResource,
|
package/dist/index.mjs
CHANGED
|
@@ -118,6 +118,17 @@ var SearchResource = class extends BaseResource {
|
|
|
118
118
|
});
|
|
119
119
|
return response.results;
|
|
120
120
|
}
|
|
121
|
+
/** Search while preserving the automatic ProofLoop evidence context. */
|
|
122
|
+
async searchWithProof(params) {
|
|
123
|
+
return this.client.post("/v1/search", {
|
|
124
|
+
query: params.query,
|
|
125
|
+
collection_id: params.collection_id,
|
|
126
|
+
user_id: params.user_id,
|
|
127
|
+
limit: params.limit || 10,
|
|
128
|
+
search_type: params.search_type || "hybrid",
|
|
129
|
+
filters: params.filters || {}
|
|
130
|
+
});
|
|
131
|
+
}
|
|
121
132
|
/**
|
|
122
133
|
* Find similar memories
|
|
123
134
|
*/
|
|
@@ -140,6 +151,30 @@ var SearchResource = class extends BaseResource {
|
|
|
140
151
|
});
|
|
141
152
|
}
|
|
142
153
|
};
|
|
154
|
+
var ProofLoopResource = class extends BaseResource {
|
|
155
|
+
/** Create a causal decision bound to search/chat evidence automatically. */
|
|
156
|
+
async decide(params) {
|
|
157
|
+
const context = params.proof_context;
|
|
158
|
+
const token = typeof context === "string" ? context : context?.token;
|
|
159
|
+
const { proof_context: _context, ...body } = params;
|
|
160
|
+
return this.client.post("/v1/learning/decisions", {
|
|
161
|
+
...body,
|
|
162
|
+
...token ? { proof_context_token: token } : {}
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
async recordOutcome(decisionId, body) {
|
|
166
|
+
return this.client.post(`/v1/learning/decisions/${decisionId}/outcomes`, {
|
|
167
|
+
observations: [],
|
|
168
|
+
...body
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
async proof(decisionId) {
|
|
172
|
+
return this.client.get(`/v1/learning/decisions/${decisionId}/proof`);
|
|
173
|
+
}
|
|
174
|
+
async publicKey() {
|
|
175
|
+
return this.client.get("/v1/learning/proof-key");
|
|
176
|
+
}
|
|
177
|
+
};
|
|
143
178
|
var RLResource = class extends BaseResource {
|
|
144
179
|
/**
|
|
145
180
|
* Train the Memory Manager agent using RL
|
|
@@ -428,7 +463,7 @@ var ServerError = class _ServerError extends HebbrixError {
|
|
|
428
463
|
var MemoryClient = class {
|
|
429
464
|
constructor(config = {}) {
|
|
430
465
|
this.apiKey = config.apiKey;
|
|
431
|
-
this.baseUrl = config.baseUrl || "https://
|
|
466
|
+
this.baseUrl = config.baseUrl || "https://api.hebbrix.com";
|
|
432
467
|
this.timeout = config.timeout || 12e4;
|
|
433
468
|
this.baseUrl = this.baseUrl.replace(/\/$/, "");
|
|
434
469
|
this.auth = new AuthResource(this);
|
|
@@ -442,11 +477,12 @@ var MemoryClient = class {
|
|
|
442
477
|
this.consolidation = new ConsolidationResource(this);
|
|
443
478
|
this.memoryTools = new MemoryToolsResource(this);
|
|
444
479
|
this.worldModel = new WorldModelResource(this);
|
|
480
|
+
this.proofloop = new ProofLoopResource(this);
|
|
445
481
|
}
|
|
446
482
|
getHeaders() {
|
|
447
483
|
const headers = {
|
|
448
484
|
"Content-Type": "application/json",
|
|
449
|
-
"User-Agent": "hebbrix-typescript/2.
|
|
485
|
+
"User-Agent": "hebbrix-typescript/2.1.0"
|
|
450
486
|
};
|
|
451
487
|
if (this.apiKey) {
|
|
452
488
|
headers["Authorization"] = `Bearer ${this.apiKey}`;
|
|
@@ -524,6 +560,9 @@ var MemoryClient = class {
|
|
|
524
560
|
async search(params) {
|
|
525
561
|
return this.searchResource.search(params);
|
|
526
562
|
}
|
|
563
|
+
async searchWithProof(params) {
|
|
564
|
+
return this.searchResource.searchWithProof(params);
|
|
565
|
+
}
|
|
527
566
|
async reason(params) {
|
|
528
567
|
return this.searchResource.reason(params);
|
|
529
568
|
}
|
|
@@ -539,6 +578,7 @@ export {
|
|
|
539
578
|
MemoryToolsResource,
|
|
540
579
|
NotFoundError,
|
|
541
580
|
ProceduralResource,
|
|
581
|
+
ProofLoopResource,
|
|
542
582
|
RLResource,
|
|
543
583
|
RateLimitError,
|
|
544
584
|
SearchResource,
|
package/package.json
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "hebbrix",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.1.0",
|
|
4
4
|
"description": "Advanced Memory API for AI Agents with Reinforcement Learning - TypeScript/JavaScript SDK",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
7
7
|
"types": "dist/index.d.ts",
|
|
8
8
|
"exports": {
|
|
9
9
|
".": {
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
10
11
|
"import": "./dist/index.mjs",
|
|
11
|
-
"require": "./dist/index.js"
|
|
12
|
-
"types": "./dist/index.d.ts"
|
|
12
|
+
"require": "./dist/index.js"
|
|
13
13
|
}
|
|
14
14
|
},
|
|
15
15
|
"files": [
|
|
@@ -47,12 +47,15 @@
|
|
|
47
47
|
"license": "MIT",
|
|
48
48
|
"repository": {
|
|
49
49
|
"type": "git",
|
|
50
|
-
"url": "https://github.com/
|
|
50
|
+
"url": "git+https://github.com/Hebbrix/hebbrix-typescript.git"
|
|
51
51
|
},
|
|
52
52
|
"bugs": {
|
|
53
53
|
"url": "https://github.com/hebbrix/hebbrix-typescript/issues"
|
|
54
54
|
},
|
|
55
55
|
"homepage": "https://hebbrix.com",
|
|
56
|
+
"publishConfig": {
|
|
57
|
+
"access": "public"
|
|
58
|
+
},
|
|
56
59
|
"devDependencies": {
|
|
57
60
|
"@types/node": "^20.10.0",
|
|
58
61
|
"@typescript-eslint/eslint-plugin": "^6.15.0",
|