@memnexus-ai/typescript-sdk 1.44.0 → 1.46.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/index.cjs +167 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +411 -5
- package/dist/index.d.ts +411 -5
- package/dist/index.js +159 -8
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -49,6 +49,14 @@ __export(index_exports, {
|
|
|
49
49
|
batchGetMemoriesRequest: () => batchGetMemoriesRequest,
|
|
50
50
|
batchGetMemoriesResponse: () => batchGetMemoriesResponse,
|
|
51
51
|
billingOverview: () => billingOverview,
|
|
52
|
+
buildContextActiveWork: () => buildContextActiveWork,
|
|
53
|
+
buildContextActivity: () => buildContextActivity,
|
|
54
|
+
buildContextFact: () => buildContextFact,
|
|
55
|
+
buildContextGotcha: () => buildContextGotcha,
|
|
56
|
+
buildContextMeta: () => buildContextMeta,
|
|
57
|
+
buildContextPattern: () => buildContextPattern,
|
|
58
|
+
buildContextRequest: () => buildContextRequest,
|
|
59
|
+
buildContextResponse: () => buildContextResponse,
|
|
52
60
|
checkoutSessionResponse: () => checkoutSessionResponse,
|
|
53
61
|
community: () => community,
|
|
54
62
|
conversation: () => conversation,
|
|
@@ -1818,11 +1826,18 @@ var MonitoringService = class extends BaseService {
|
|
|
1818
1826
|
// src/services/memories-service.ts
|
|
1819
1827
|
var MemoriesService = class extends BaseService {
|
|
1820
1828
|
/**
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1829
|
+
* Get memory by ID
|
|
1830
|
+
* Retrieve a specific memory by its ID with configurable detail level.
|
|
1831
|
+
|
|
1832
|
+
**Detail levels:**
|
|
1833
|
+
- `minimal` — raw memory only, no extra queries
|
|
1834
|
+
- `standard` (default) — adds userTopics, extractedTopics, entities, facts, relationships
|
|
1835
|
+
- `full` — adds conversationContext (title, memoryCount, position) and relationship target previews
|
|
1836
|
+
|
|
1837
|
+
* @param id - The memory ID
|
|
1838
|
+
* @param detail - Detail level: minimal (raw memory), standard (default, + topics/entities/facts/relationships), full (+ conversation context and relationship previews)
|
|
1839
|
+
*/
|
|
1840
|
+
async getMemoryById(id, options) {
|
|
1826
1841
|
const request = new Request({
|
|
1827
1842
|
baseUrl: this.config.baseUrl || "http://localhost:3000",
|
|
1828
1843
|
method: "GET",
|
|
@@ -1846,6 +1861,18 @@ var MemoriesService = class extends BaseService {
|
|
|
1846
1861
|
isOffset: false,
|
|
1847
1862
|
isCursor: false
|
|
1848
1863
|
});
|
|
1864
|
+
if (options?.detail !== void 0) {
|
|
1865
|
+
request.addQueryParam("detail", {
|
|
1866
|
+
key: "detail",
|
|
1867
|
+
value: options.detail,
|
|
1868
|
+
explode: false,
|
|
1869
|
+
encode: true,
|
|
1870
|
+
style: "form",
|
|
1871
|
+
isLimit: false,
|
|
1872
|
+
isOffset: false,
|
|
1873
|
+
isCursor: false
|
|
1874
|
+
});
|
|
1875
|
+
}
|
|
1849
1876
|
return this.client.call(request);
|
|
1850
1877
|
}
|
|
1851
1878
|
/**
|
|
@@ -2609,6 +2636,34 @@ var MemoriesService = class extends BaseService {
|
|
|
2609
2636
|
}
|
|
2610
2637
|
return this.client.call(request);
|
|
2611
2638
|
}
|
|
2639
|
+
/**
|
|
2640
|
+
* Build a context briefing
|
|
2641
|
+
* Answers "What should I know before working on X?" by combining active work
|
|
2642
|
+
detection, fact retrieval, gotcha detection, recent activity, and pattern
|
|
2643
|
+
matching into a single call. Eliminates the 5+ round-trip pattern agents
|
|
2644
|
+
use today.
|
|
2645
|
+
|
|
2646
|
+
* @param body - Request body
|
|
2647
|
+
*/
|
|
2648
|
+
async buildContext(body) {
|
|
2649
|
+
const request = new Request({
|
|
2650
|
+
baseUrl: this.config.baseUrl || "http://localhost:3000",
|
|
2651
|
+
method: "POST",
|
|
2652
|
+
path: "/api/memories/build-context",
|
|
2653
|
+
config: this.config,
|
|
2654
|
+
retry: {
|
|
2655
|
+
attempts: 3,
|
|
2656
|
+
delayMs: 150,
|
|
2657
|
+
maxDelayMs: 5e3,
|
|
2658
|
+
jitterMs: 50,
|
|
2659
|
+
backoffFactor: 2
|
|
2660
|
+
}
|
|
2661
|
+
});
|
|
2662
|
+
if (body !== void 0) {
|
|
2663
|
+
request.addBody(body);
|
|
2664
|
+
}
|
|
2665
|
+
return this.client.call(request);
|
|
2666
|
+
}
|
|
2612
2667
|
/**
|
|
2613
2668
|
* Get version history for a named memory
|
|
2614
2669
|
* Returns the full version chain for a named memory, ordered newest-first.
|
|
@@ -2645,11 +2700,12 @@ var MemoriesService = class extends BaseService {
|
|
|
2645
2700
|
/**
|
|
2646
2701
|
* Get a memory by name
|
|
2647
2702
|
* Retrieve the current HEAD version of a named memory by its user-assigned name.
|
|
2648
|
-
|
|
2703
|
+
Supports the same detail levels as GET /api/memories/{id}.
|
|
2649
2704
|
|
|
2650
2705
|
* @param name - Memory name (kebab-case, 2-64 chars)
|
|
2706
|
+
* @param detail - Detail level: minimal (raw memory), standard (default, + topics/entities/facts/relationships), full (+ conversation context and relationship previews)
|
|
2651
2707
|
*/
|
|
2652
|
-
async getMemoryByName(name) {
|
|
2708
|
+
async getMemoryByName(name, options) {
|
|
2653
2709
|
const request = new Request({
|
|
2654
2710
|
baseUrl: this.config.baseUrl || "http://localhost:3000",
|
|
2655
2711
|
method: "GET",
|
|
@@ -2673,6 +2729,18 @@ var MemoriesService = class extends BaseService {
|
|
|
2673
2729
|
isOffset: false,
|
|
2674
2730
|
isCursor: false
|
|
2675
2731
|
});
|
|
2732
|
+
if (options?.detail !== void 0) {
|
|
2733
|
+
request.addQueryParam("detail", {
|
|
2734
|
+
key: "detail",
|
|
2735
|
+
value: options.detail,
|
|
2736
|
+
explode: false,
|
|
2737
|
+
encode: true,
|
|
2738
|
+
style: "form",
|
|
2739
|
+
isLimit: false,
|
|
2740
|
+
isOffset: false,
|
|
2741
|
+
isCursor: false
|
|
2742
|
+
});
|
|
2743
|
+
}
|
|
2676
2744
|
return this.client.call(request);
|
|
2677
2745
|
}
|
|
2678
2746
|
/**
|
|
@@ -4948,7 +5016,9 @@ var namedMemoryHistoryResponse = import_zod.z.object({
|
|
|
4948
5016
|
});
|
|
4949
5017
|
var batchGetMemoriesRequest = import_zod.z.object({
|
|
4950
5018
|
/** Array of memory IDs to retrieve */
|
|
4951
|
-
ids: import_zod.z.array(import_zod.z.string().uuid()).min(1).max(100)
|
|
5019
|
+
ids: import_zod.z.array(import_zod.z.string().uuid()).min(1).max(100),
|
|
5020
|
+
/** Detail level for each memory. 'minimal' returns raw memory only (default, backward compatible). 'standard' adds topics, entities, facts, and relationships. */
|
|
5021
|
+
detail: import_zod.z.enum(["minimal", "standard"]).optional()
|
|
4952
5022
|
});
|
|
4953
5023
|
var batchGetMemoriesMeta = import_zod.z.object({
|
|
4954
5024
|
/** Number of IDs requested */
|
|
@@ -5828,6 +5898,87 @@ var digestResponse = import_zod.z.lazy(() => import_zod.z.object({
|
|
|
5828
5898
|
/** Source memories used to generate the digest, for traceability */
|
|
5829
5899
|
sources: import_zod.z.array(digestSource)
|
|
5830
5900
|
}));
|
|
5901
|
+
var buildContextRequest = import_zod.z.object({
|
|
5902
|
+
/** What you are about to work on */
|
|
5903
|
+
context: import_zod.z.string().min(1).max(2e3),
|
|
5904
|
+
/** File paths you will be touching */
|
|
5905
|
+
files: import_zod.z.array(import_zod.z.string()).optional(),
|
|
5906
|
+
/** How far back to look for recent activity (hours, default 24) */
|
|
5907
|
+
recentHours: import_zod.z.number().min(1).max(720).optional()
|
|
5908
|
+
});
|
|
5909
|
+
var buildContextActiveWork = import_zod.z.object({
|
|
5910
|
+
/** Conversation ID */
|
|
5911
|
+
conversationId: import_zod.z.string(),
|
|
5912
|
+
/** Conversation title */
|
|
5913
|
+
title: import_zod.z.string().nullable(),
|
|
5914
|
+
/** ISO 8601 timestamp of last activity */
|
|
5915
|
+
lastActivity: import_zod.z.string(),
|
|
5916
|
+
/** Most recent memory in this conversation */
|
|
5917
|
+
lastMemory: import_zod.z.object({
|
|
5918
|
+
/** Memory ID */
|
|
5919
|
+
id: import_zod.z.string(),
|
|
5920
|
+
/** Truncated content summary */
|
|
5921
|
+
summary: import_zod.z.string()
|
|
5922
|
+
})
|
|
5923
|
+
}).nullable();
|
|
5924
|
+
var buildContextFact = import_zod.z.object({
|
|
5925
|
+
/** Fact subject */
|
|
5926
|
+
subject: import_zod.z.string(),
|
|
5927
|
+
/** Fact predicate */
|
|
5928
|
+
predicate: import_zod.z.string(),
|
|
5929
|
+
/** Fact object */
|
|
5930
|
+
object: import_zod.z.string(),
|
|
5931
|
+
/** Confidence score (0-1) */
|
|
5932
|
+
confidence: import_zod.z.number(),
|
|
5933
|
+
/** Memory this fact was extracted from */
|
|
5934
|
+
sourceMemoryId: import_zod.z.string()
|
|
5935
|
+
});
|
|
5936
|
+
var buildContextGotcha = import_zod.z.object({
|
|
5937
|
+
/** The gotcha fact text */
|
|
5938
|
+
fact: import_zod.z.string(),
|
|
5939
|
+
/** Number of distinct source memories mentioning this */
|
|
5940
|
+
sourceCount: import_zod.z.number(),
|
|
5941
|
+
/** Source memory IDs */
|
|
5942
|
+
sourceMemories: import_zod.z.array(import_zod.z.string()),
|
|
5943
|
+
/** ISO 8601 timestamp of most recent source */
|
|
5944
|
+
lastSeen: import_zod.z.string()
|
|
5945
|
+
});
|
|
5946
|
+
var buildContextActivity = import_zod.z.object({
|
|
5947
|
+
/** Memory ID */
|
|
5948
|
+
id: import_zod.z.string(),
|
|
5949
|
+
/** Truncated content summary (max 200 chars) */
|
|
5950
|
+
summary: import_zod.z.string(),
|
|
5951
|
+
/** ISO 8601 timestamp */
|
|
5952
|
+
date: import_zod.z.string(),
|
|
5953
|
+
/** Conversation ID */
|
|
5954
|
+
conversationId: import_zod.z.string().nullable()
|
|
5955
|
+
});
|
|
5956
|
+
var buildContextPattern = import_zod.z.object({
|
|
5957
|
+
/** Pattern description */
|
|
5958
|
+
pattern: import_zod.z.string(),
|
|
5959
|
+
/** Confidence score (0-1) */
|
|
5960
|
+
confidence: import_zod.z.number()
|
|
5961
|
+
});
|
|
5962
|
+
var buildContextMeta = import_zod.z.object({
|
|
5963
|
+
/** Search terms extracted from the context and files */
|
|
5964
|
+
contextTerms: import_zod.z.array(import_zod.z.string()),
|
|
5965
|
+
/** Hours window used for recent activity */
|
|
5966
|
+
recentHours: import_zod.z.number()
|
|
5967
|
+
});
|
|
5968
|
+
var buildContextResponse = import_zod.z.lazy(() => import_zod.z.object({
|
|
5969
|
+
/** Most relevant active conversation, or null if none found */
|
|
5970
|
+
activeWork: buildContextActiveWork,
|
|
5971
|
+
/** Facts related to the context terms */
|
|
5972
|
+
relevantFacts: import_zod.z.array(buildContextFact),
|
|
5973
|
+
/** Gotchas — facts appearing in 2+ source memories */
|
|
5974
|
+
gotchas: import_zod.z.array(buildContextGotcha),
|
|
5975
|
+
/** Recent relevant memories within the time window */
|
|
5976
|
+
recentActivity: import_zod.z.array(buildContextActivity),
|
|
5977
|
+
/** Behavioral patterns related to the context */
|
|
5978
|
+
relatedPatterns: import_zod.z.array(buildContextPattern),
|
|
5979
|
+
/** Request metadata for transparency */
|
|
5980
|
+
meta: buildContextMeta
|
|
5981
|
+
}));
|
|
5831
5982
|
|
|
5832
5983
|
// src/index.ts
|
|
5833
5984
|
var Memnexus = class {
|
|
@@ -6004,6 +6155,14 @@ var index_default = Memnexus;
|
|
|
6004
6155
|
batchGetMemoriesRequest,
|
|
6005
6156
|
batchGetMemoriesResponse,
|
|
6006
6157
|
billingOverview,
|
|
6158
|
+
buildContextActiveWork,
|
|
6159
|
+
buildContextActivity,
|
|
6160
|
+
buildContextFact,
|
|
6161
|
+
buildContextGotcha,
|
|
6162
|
+
buildContextMeta,
|
|
6163
|
+
buildContextPattern,
|
|
6164
|
+
buildContextRequest,
|
|
6165
|
+
buildContextResponse,
|
|
6007
6166
|
checkoutSessionResponse,
|
|
6008
6167
|
community,
|
|
6009
6168
|
conversation,
|