@memnexus-ai/typescript-sdk 1.45.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 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,
@@ -2628,6 +2636,34 @@ var MemoriesService = class extends BaseService {
2628
2636
  }
2629
2637
  return this.client.call(request);
2630
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
+ }
2631
2667
  /**
2632
2668
  * Get version history for a named memory
2633
2669
  * Returns the full version chain for a named memory, ordered newest-first.
@@ -5862,6 +5898,87 @@ var digestResponse = import_zod.z.lazy(() => import_zod.z.object({
5862
5898
  /** Source memories used to generate the digest, for traceability */
5863
5899
  sources: import_zod.z.array(digestSource)
5864
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
+ }));
5865
5982
 
5866
5983
  // src/index.ts
5867
5984
  var Memnexus = class {
@@ -6038,6 +6155,14 @@ var index_default = Memnexus;
6038
6155
  batchGetMemoriesRequest,
6039
6156
  batchGetMemoriesResponse,
6040
6157
  billingOverview,
6158
+ buildContextActiveWork,
6159
+ buildContextActivity,
6160
+ buildContextFact,
6161
+ buildContextGotcha,
6162
+ buildContextMeta,
6163
+ buildContextPattern,
6164
+ buildContextRequest,
6165
+ buildContextResponse,
6041
6166
  checkoutSessionResponse,
6042
6167
  community,
6043
6168
  conversation,