@alexein/sdk 0.3.2 → 0.3.3
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/CHANGELOG.md +14 -0
- package/README.md +19 -3
- package/dist/{chunk-AJGT53UZ.cjs → chunk-34W2JJVD.cjs} +152 -8
- package/dist/{chunk-CKBVQNV5.js → chunk-5YIOYX3J.js} +152 -8
- package/dist/{chunk-5Y43EWDD.js → chunk-HDNKPJS2.js} +1 -1
- package/dist/{chunk-VNLJZ26C.cjs → chunk-LWBADF3F.cjs} +4 -4
- package/dist/{client-DJsIRKil.d.cts → client-Bz10lVYG.d.cts} +153 -4
- package/dist/{client-DJsIRKil.d.ts → client-Bz10lVYG.d.ts} +153 -4
- package/dist/index.cjs +2 -2
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +1 -1
- package/dist/langgraph.cjs +15 -15
- package/dist/langgraph.d.cts +1 -1
- package/dist/langgraph.d.ts +1 -1
- package/dist/langgraph.js +2 -2
- package/dist/openai-agents.cjs +18 -18
- package/dist/openai-agents.d.cts +1 -1
- package/dist/openai-agents.d.ts +1 -1
- package/dist/openai-agents.js +2 -2
- package/package.json +1 -1
|
@@ -187,6 +187,11 @@ interface ItemDefaults {
|
|
|
187
187
|
}
|
|
188
188
|
/** Options `add` takes besides the items. */
|
|
189
189
|
interface AddOptions extends ItemDefaults {
|
|
190
|
+
/**
|
|
191
|
+
* The id of the one item added, so the same id again edits it. With several items, give each
|
|
192
|
+
* its own `id`: here it is a RangeError, since one id would make them edits of one another.
|
|
193
|
+
*/
|
|
194
|
+
id?: string;
|
|
190
195
|
/** Answer once the items are searchable (briefly waited for). */
|
|
191
196
|
wait?: boolean;
|
|
192
197
|
/** Replace phone numbers, cards, keys and the like with their kind before memory keeps them. */
|
|
@@ -283,7 +288,8 @@ interface Me {
|
|
|
283
288
|
* What memory holds for a question. `memories` come in order: known lines, then facts, then
|
|
284
289
|
* excerpts. `answerable` is false when memory does not seem to hold the answer, and null when it
|
|
285
290
|
* was not checked. `failed` is true when a `failOpen` client could not reach memory, and the
|
|
286
|
-
* result is empty for that reason.
|
|
291
|
+
* result is empty for that reason. `searchId` is what `feedback()` takes to say how the search
|
|
292
|
+
* went (null when failed).
|
|
287
293
|
*/
|
|
288
294
|
declare class SearchResult {
|
|
289
295
|
readonly query: string;
|
|
@@ -293,7 +299,8 @@ declare class SearchResult {
|
|
|
293
299
|
readonly sources: Json[] | null;
|
|
294
300
|
readonly failed: boolean;
|
|
295
301
|
readonly raw: Json;
|
|
296
|
-
|
|
302
|
+
readonly searchId: string | null;
|
|
303
|
+
constructor(query: string, answerable: boolean | null, notes: string[], memories: MemoryEntry[], sources: Json[] | null, failed: boolean, raw: Json, searchId?: string | null);
|
|
297
304
|
static parse(value: unknown): SearchResult;
|
|
298
305
|
/** What a `failOpen` client answers when memory could not be reached. */
|
|
299
306
|
static unavailable(query: string): SearchResult;
|
|
@@ -304,13 +311,100 @@ declare class SearchResult {
|
|
|
304
311
|
get refs(): string[];
|
|
305
312
|
/**
|
|
306
313
|
* The text to paste into a prompt: each note on its own line, a blank line, then each memory on
|
|
307
|
-
* its own line as `- <text>` (an excerpt with a date as `- <YYYY-MM-DD>: <text
|
|
314
|
+
* its own line as `- <text>` (an excerpt with a date as `- <YYYY-MM-DD>: <text>`; a memory's
|
|
315
|
+
* own line breaks made spaces), cut at a whole
|
|
308
316
|
* memory so it is never longer than `maxChars`. Empty when there are no memories, or when not
|
|
309
317
|
* even the first fits. The Python client and the n8n node write the same text.
|
|
310
318
|
*/
|
|
311
319
|
context(maxChars?: number): string;
|
|
312
320
|
}
|
|
313
321
|
|
|
322
|
+
/**
|
|
323
|
+
* What the routes about people and things answer: one subject whole, what a memory links to, how
|
|
324
|
+
* the person works, and the lessons they taught assistants. Each keeps its JSON in `raw`.
|
|
325
|
+
*/
|
|
326
|
+
|
|
327
|
+
/**
|
|
328
|
+
* How one person or thing relates to another, in words (`link`): the day it was said, the ref of
|
|
329
|
+
* the fact that says it, and the ref of the excerpt that fact was learned from (null when unknown,
|
|
330
|
+
* and on `subject()` links).
|
|
331
|
+
*/
|
|
332
|
+
interface Link {
|
|
333
|
+
readonly link: string;
|
|
334
|
+
readonly ref: string;
|
|
335
|
+
readonly date: string | null;
|
|
336
|
+
readonly source: string | null;
|
|
337
|
+
readonly raw: Json;
|
|
338
|
+
}
|
|
339
|
+
/**
|
|
340
|
+
* A line for a model, with the refs of the facts it rests on: a subject's `about`, and a
|
|
341
|
+
* conversation about it (whose one ref is an excerpt of that conversation).
|
|
342
|
+
*/
|
|
343
|
+
interface Line {
|
|
344
|
+
readonly text: string;
|
|
345
|
+
readonly refs: string[];
|
|
346
|
+
readonly date: string | null;
|
|
347
|
+
readonly raw: Json;
|
|
348
|
+
}
|
|
349
|
+
/**
|
|
350
|
+
* One person or thing by name, whole: `about`, a few lines on how it went; `values`, each
|
|
351
|
+
* property's newest value; `timeline`, its facts oldest first; `conversations` about it; `links`
|
|
352
|
+
* to other people and things. `facts` is 0 when memory holds nothing by that name, and then
|
|
353
|
+
* `suggestions` names the nearest it does.
|
|
354
|
+
*/
|
|
355
|
+
interface Subject {
|
|
356
|
+
readonly name: string;
|
|
357
|
+
readonly facts: number;
|
|
358
|
+
readonly about: Line[];
|
|
359
|
+
readonly values: Value[];
|
|
360
|
+
readonly timeline: Fact[];
|
|
361
|
+
readonly conversations: Line[];
|
|
362
|
+
readonly links: Link[];
|
|
363
|
+
readonly suggestions: string[] | null;
|
|
364
|
+
readonly raw: Json;
|
|
365
|
+
}
|
|
366
|
+
/** What the people and things one memory names link to, newest said first. Iterable. */
|
|
367
|
+
interface Related extends Iterable<Link> {
|
|
368
|
+
readonly links: Link[];
|
|
369
|
+
readonly raw: Json;
|
|
370
|
+
}
|
|
371
|
+
/**
|
|
372
|
+
* A plain line for a model, and the refs of the facts it cites. `kind` says what it is: `routine`
|
|
373
|
+
* or `style` from `howTheyWork()` (`surface` names where a style is for), `lesson` from
|
|
374
|
+
* `lessons()` (`from` says what it came from: `correction`, `feedback` or `said`), or `strategy`,
|
|
375
|
+
* `failure` or `workflow` among a `Lessons`' `lessons`. The counts a card rests on are in `raw`.
|
|
376
|
+
*/
|
|
377
|
+
interface Card {
|
|
378
|
+
readonly kind: string;
|
|
379
|
+
readonly text: string;
|
|
380
|
+
readonly refs: string[];
|
|
381
|
+
readonly surface: string | null;
|
|
382
|
+
readonly from: string[];
|
|
383
|
+
readonly raw: Json;
|
|
384
|
+
}
|
|
385
|
+
/**
|
|
386
|
+
* How someone works: `cards`, each a routine or a writing style; `procedures`, each routine's
|
|
387
|
+
* counts written out for a model; `voice`, how they write, or null when memory has too few of
|
|
388
|
+
* their messages to say.
|
|
389
|
+
*/
|
|
390
|
+
interface Ways {
|
|
391
|
+
readonly who: string;
|
|
392
|
+
readonly cards: Card[];
|
|
393
|
+
readonly procedures: string[];
|
|
394
|
+
readonly voice: string | null;
|
|
395
|
+
readonly raw: Json;
|
|
396
|
+
}
|
|
397
|
+
/**
|
|
398
|
+
* What an assistant should know before a task like `task`: `cards`, the lessons the person taught,
|
|
399
|
+
* most like it first; `lessons`, what earlier attempts at similar tasks taught.
|
|
400
|
+
*/
|
|
401
|
+
interface Lessons {
|
|
402
|
+
readonly task: string;
|
|
403
|
+
readonly cards: Card[];
|
|
404
|
+
readonly lessons: Card[];
|
|
405
|
+
readonly raw: Json;
|
|
406
|
+
}
|
|
407
|
+
|
|
314
408
|
/** The client's settings: from its options, else the environment, else the defaults. */
|
|
315
409
|
declare const DEFAULT_BASE_URL = "https://api.alexein.ai";
|
|
316
410
|
/** Long enough for the slowest search and an add that waits; a caller that cannot wait sets less. */
|
|
@@ -460,6 +554,21 @@ interface Deleted {
|
|
|
460
554
|
readonly deleted: boolean;
|
|
461
555
|
readonly raw: Json;
|
|
462
556
|
}
|
|
557
|
+
/**
|
|
558
|
+
* Feedback on one search, kept as a note of this app user's memory: the search id and verdict as
|
|
559
|
+
* sent, and the note's `status`, `queued` or `stored` as an add answers it.
|
|
560
|
+
*/
|
|
561
|
+
interface Feedback {
|
|
562
|
+
readonly searchId: string;
|
|
563
|
+
readonly verdict: string;
|
|
564
|
+
readonly status: string;
|
|
565
|
+
readonly raw: Json;
|
|
566
|
+
}
|
|
567
|
+
/** A refresh asked for: `queued`, or `already_queued` when one was already waiting or under way. */
|
|
568
|
+
interface Refreshed {
|
|
569
|
+
readonly status: string;
|
|
570
|
+
readonly raw: Json;
|
|
571
|
+
}
|
|
463
572
|
|
|
464
573
|
/**
|
|
465
574
|
* Each route as the request it is: path, body and how to read the answer. Written once here and
|
|
@@ -514,6 +623,14 @@ interface PageOptions {
|
|
|
514
623
|
interface ItemsOptions extends PageOptions {
|
|
515
624
|
filters?: Filters;
|
|
516
625
|
}
|
|
626
|
+
interface HowTheyWorkOptions {
|
|
627
|
+
/** Someone in this memory, by name; absent, the person. */
|
|
628
|
+
who?: string;
|
|
629
|
+
/** Where the writing is for, such as a channel or a repository; absent, where they write most. */
|
|
630
|
+
surface?: string;
|
|
631
|
+
}
|
|
632
|
+
/** How a search went: wrong, the answer missing from it, or fine. */
|
|
633
|
+
type Verdict = "wrong" | "missing" | "ok";
|
|
517
634
|
interface ForgetOptions {
|
|
518
635
|
items?: string[];
|
|
519
636
|
sessions?: string[];
|
|
@@ -551,6 +668,25 @@ declare class User {
|
|
|
551
668
|
}): Promise<Memories>;
|
|
552
669
|
/** One memory by its ref, whole: an excerpt, or a fact with the excerpts it came from. */
|
|
553
670
|
open(ref: string): Promise<Opened>;
|
|
671
|
+
/**
|
|
672
|
+
* One person or thing by name, whole: how it went, its values now, its facts in the order they
|
|
673
|
+
* were said, the conversations about it, and how it relates to others.
|
|
674
|
+
*/
|
|
675
|
+
subject(name: string, options?: {
|
|
676
|
+
limit?: number;
|
|
677
|
+
}): Promise<Subject>;
|
|
678
|
+
/** What the people and things one fact or excerpt names link to, by its ref. */
|
|
679
|
+
related(ref: string): Promise<Related>;
|
|
680
|
+
/**
|
|
681
|
+
* How the person works - their routines before an action and how they write on each `surface` -
|
|
682
|
+
* for an agent about to act or write for them. `who` names someone else.
|
|
683
|
+
*/
|
|
684
|
+
howTheyWork(options?: HowTheyWorkOptions): Promise<Ways>;
|
|
685
|
+
/**
|
|
686
|
+
* What an assistant should know before `task`: how the person corrected assistants and the notes
|
|
687
|
+
* they left on answers, most like it first.
|
|
688
|
+
*/
|
|
689
|
+
lessons(task: string): Promise<Lessons>;
|
|
554
690
|
/** Every value a subject was stated to have, by attribute, oldest first. */
|
|
555
691
|
history(subject: string, options?: {
|
|
556
692
|
attribute?: string;
|
|
@@ -582,6 +718,19 @@ declare class User {
|
|
|
582
718
|
forget(named: ForgetOptions): Promise<Forgotten>;
|
|
583
719
|
/** Retract one fact for good, by its ref; a `replacement` is kept as a note. */
|
|
584
720
|
correct(ref: string, replacement?: string): Promise<Correction>;
|
|
721
|
+
/**
|
|
722
|
+
* Say how a search went - `wrong`, `missing` or `ok` - by its result or its `searchId`, and
|
|
723
|
+
* optionally what was true, so memory answers questions like it better. Kept as a note of this
|
|
724
|
+
* memory. Takes a key that writes.
|
|
725
|
+
*/
|
|
726
|
+
feedback(search: SearchResult | string, verdict: Verdict, options?: {
|
|
727
|
+
note?: string;
|
|
728
|
+
}): Promise<Feedback>;
|
|
729
|
+
/**
|
|
730
|
+
* Ask memory to bring what it has gathered of this app user up to date soon - after a large
|
|
731
|
+
* import, say. Once an hour per app user. Takes a key that writes.
|
|
732
|
+
*/
|
|
733
|
+
refresh(): Promise<Refreshed>;
|
|
585
734
|
/** Every version of one added item, oldest first. Takes a key that writes. */
|
|
586
735
|
versions(itemId: string): Promise<Versions>;
|
|
587
736
|
/** Everything memory holds for this app user, a page at a time. */
|
|
@@ -642,4 +791,4 @@ declare class Memory {
|
|
|
642
791
|
close(): void;
|
|
643
792
|
}
|
|
644
793
|
|
|
645
|
-
export { type
|
|
794
|
+
export { type Sources as $, type AddOptions as A, type Memories as B, type Card as C, DEFAULT_BASE_URL as D, type Erased as E, type Fact as F, type GrepOptions as G, type History as H, type Item as I, type Json as J, type Known as K, type LatestOptions as L, type Me as M, Memory as N, type MemoryEntry as O, type MemoryOptions as P, type OpenItem as Q, type OpenItems as R, type OpenItemsOptions as S, type Opened as T, type Origin as U, type PageOptions as V, type Refreshed as W, type Related as X, type SearchOptions as Y, SearchResult as Z, type Source as _, type AddResult as a, type Statuses as a0, type StoredItem as a1, type Subject as a2, type Summary as a3, User as a4, type UsersPage as a5, type Value as a6, type Verdict as a7, type VersionEntry as a8, type Versions as a9, type Ways as aa, type AddedItem as b, type Adding as c, type AppUser as d, type Author as e, type Correction as f, DEFAULT_RETRIES as g, DEFAULT_TIMEOUT_MS as h, type Deleted as i, type Excerpt as j, type ExportPage as k, type ExportRecord as l, type FactsPage as m, type Feedback as n, type Filters as o, type FollowUp as p, type ForgetOptions as q, type Forgotten as r, type HowTheyWorkOptions as s, type ItemDefaults as t, type ItemStatus as u, type ItemsOptions as v, type ItemsPage as w, type Lessons as x, type Line as y, type Link as z };
|
|
@@ -187,6 +187,11 @@ interface ItemDefaults {
|
|
|
187
187
|
}
|
|
188
188
|
/** Options `add` takes besides the items. */
|
|
189
189
|
interface AddOptions extends ItemDefaults {
|
|
190
|
+
/**
|
|
191
|
+
* The id of the one item added, so the same id again edits it. With several items, give each
|
|
192
|
+
* its own `id`: here it is a RangeError, since one id would make them edits of one another.
|
|
193
|
+
*/
|
|
194
|
+
id?: string;
|
|
190
195
|
/** Answer once the items are searchable (briefly waited for). */
|
|
191
196
|
wait?: boolean;
|
|
192
197
|
/** Replace phone numbers, cards, keys and the like with their kind before memory keeps them. */
|
|
@@ -283,7 +288,8 @@ interface Me {
|
|
|
283
288
|
* What memory holds for a question. `memories` come in order: known lines, then facts, then
|
|
284
289
|
* excerpts. `answerable` is false when memory does not seem to hold the answer, and null when it
|
|
285
290
|
* was not checked. `failed` is true when a `failOpen` client could not reach memory, and the
|
|
286
|
-
* result is empty for that reason.
|
|
291
|
+
* result is empty for that reason. `searchId` is what `feedback()` takes to say how the search
|
|
292
|
+
* went (null when failed).
|
|
287
293
|
*/
|
|
288
294
|
declare class SearchResult {
|
|
289
295
|
readonly query: string;
|
|
@@ -293,7 +299,8 @@ declare class SearchResult {
|
|
|
293
299
|
readonly sources: Json[] | null;
|
|
294
300
|
readonly failed: boolean;
|
|
295
301
|
readonly raw: Json;
|
|
296
|
-
|
|
302
|
+
readonly searchId: string | null;
|
|
303
|
+
constructor(query: string, answerable: boolean | null, notes: string[], memories: MemoryEntry[], sources: Json[] | null, failed: boolean, raw: Json, searchId?: string | null);
|
|
297
304
|
static parse(value: unknown): SearchResult;
|
|
298
305
|
/** What a `failOpen` client answers when memory could not be reached. */
|
|
299
306
|
static unavailable(query: string): SearchResult;
|
|
@@ -304,13 +311,100 @@ declare class SearchResult {
|
|
|
304
311
|
get refs(): string[];
|
|
305
312
|
/**
|
|
306
313
|
* The text to paste into a prompt: each note on its own line, a blank line, then each memory on
|
|
307
|
-
* its own line as `- <text>` (an excerpt with a date as `- <YYYY-MM-DD>: <text
|
|
314
|
+
* its own line as `- <text>` (an excerpt with a date as `- <YYYY-MM-DD>: <text>`; a memory's
|
|
315
|
+
* own line breaks made spaces), cut at a whole
|
|
308
316
|
* memory so it is never longer than `maxChars`. Empty when there are no memories, or when not
|
|
309
317
|
* even the first fits. The Python client and the n8n node write the same text.
|
|
310
318
|
*/
|
|
311
319
|
context(maxChars?: number): string;
|
|
312
320
|
}
|
|
313
321
|
|
|
322
|
+
/**
|
|
323
|
+
* What the routes about people and things answer: one subject whole, what a memory links to, how
|
|
324
|
+
* the person works, and the lessons they taught assistants. Each keeps its JSON in `raw`.
|
|
325
|
+
*/
|
|
326
|
+
|
|
327
|
+
/**
|
|
328
|
+
* How one person or thing relates to another, in words (`link`): the day it was said, the ref of
|
|
329
|
+
* the fact that says it, and the ref of the excerpt that fact was learned from (null when unknown,
|
|
330
|
+
* and on `subject()` links).
|
|
331
|
+
*/
|
|
332
|
+
interface Link {
|
|
333
|
+
readonly link: string;
|
|
334
|
+
readonly ref: string;
|
|
335
|
+
readonly date: string | null;
|
|
336
|
+
readonly source: string | null;
|
|
337
|
+
readonly raw: Json;
|
|
338
|
+
}
|
|
339
|
+
/**
|
|
340
|
+
* A line for a model, with the refs of the facts it rests on: a subject's `about`, and a
|
|
341
|
+
* conversation about it (whose one ref is an excerpt of that conversation).
|
|
342
|
+
*/
|
|
343
|
+
interface Line {
|
|
344
|
+
readonly text: string;
|
|
345
|
+
readonly refs: string[];
|
|
346
|
+
readonly date: string | null;
|
|
347
|
+
readonly raw: Json;
|
|
348
|
+
}
|
|
349
|
+
/**
|
|
350
|
+
* One person or thing by name, whole: `about`, a few lines on how it went; `values`, each
|
|
351
|
+
* property's newest value; `timeline`, its facts oldest first; `conversations` about it; `links`
|
|
352
|
+
* to other people and things. `facts` is 0 when memory holds nothing by that name, and then
|
|
353
|
+
* `suggestions` names the nearest it does.
|
|
354
|
+
*/
|
|
355
|
+
interface Subject {
|
|
356
|
+
readonly name: string;
|
|
357
|
+
readonly facts: number;
|
|
358
|
+
readonly about: Line[];
|
|
359
|
+
readonly values: Value[];
|
|
360
|
+
readonly timeline: Fact[];
|
|
361
|
+
readonly conversations: Line[];
|
|
362
|
+
readonly links: Link[];
|
|
363
|
+
readonly suggestions: string[] | null;
|
|
364
|
+
readonly raw: Json;
|
|
365
|
+
}
|
|
366
|
+
/** What the people and things one memory names link to, newest said first. Iterable. */
|
|
367
|
+
interface Related extends Iterable<Link> {
|
|
368
|
+
readonly links: Link[];
|
|
369
|
+
readonly raw: Json;
|
|
370
|
+
}
|
|
371
|
+
/**
|
|
372
|
+
* A plain line for a model, and the refs of the facts it cites. `kind` says what it is: `routine`
|
|
373
|
+
* or `style` from `howTheyWork()` (`surface` names where a style is for), `lesson` from
|
|
374
|
+
* `lessons()` (`from` says what it came from: `correction`, `feedback` or `said`), or `strategy`,
|
|
375
|
+
* `failure` or `workflow` among a `Lessons`' `lessons`. The counts a card rests on are in `raw`.
|
|
376
|
+
*/
|
|
377
|
+
interface Card {
|
|
378
|
+
readonly kind: string;
|
|
379
|
+
readonly text: string;
|
|
380
|
+
readonly refs: string[];
|
|
381
|
+
readonly surface: string | null;
|
|
382
|
+
readonly from: string[];
|
|
383
|
+
readonly raw: Json;
|
|
384
|
+
}
|
|
385
|
+
/**
|
|
386
|
+
* How someone works: `cards`, each a routine or a writing style; `procedures`, each routine's
|
|
387
|
+
* counts written out for a model; `voice`, how they write, or null when memory has too few of
|
|
388
|
+
* their messages to say.
|
|
389
|
+
*/
|
|
390
|
+
interface Ways {
|
|
391
|
+
readonly who: string;
|
|
392
|
+
readonly cards: Card[];
|
|
393
|
+
readonly procedures: string[];
|
|
394
|
+
readonly voice: string | null;
|
|
395
|
+
readonly raw: Json;
|
|
396
|
+
}
|
|
397
|
+
/**
|
|
398
|
+
* What an assistant should know before a task like `task`: `cards`, the lessons the person taught,
|
|
399
|
+
* most like it first; `lessons`, what earlier attempts at similar tasks taught.
|
|
400
|
+
*/
|
|
401
|
+
interface Lessons {
|
|
402
|
+
readonly task: string;
|
|
403
|
+
readonly cards: Card[];
|
|
404
|
+
readonly lessons: Card[];
|
|
405
|
+
readonly raw: Json;
|
|
406
|
+
}
|
|
407
|
+
|
|
314
408
|
/** The client's settings: from its options, else the environment, else the defaults. */
|
|
315
409
|
declare const DEFAULT_BASE_URL = "https://api.alexein.ai";
|
|
316
410
|
/** Long enough for the slowest search and an add that waits; a caller that cannot wait sets less. */
|
|
@@ -460,6 +554,21 @@ interface Deleted {
|
|
|
460
554
|
readonly deleted: boolean;
|
|
461
555
|
readonly raw: Json;
|
|
462
556
|
}
|
|
557
|
+
/**
|
|
558
|
+
* Feedback on one search, kept as a note of this app user's memory: the search id and verdict as
|
|
559
|
+
* sent, and the note's `status`, `queued` or `stored` as an add answers it.
|
|
560
|
+
*/
|
|
561
|
+
interface Feedback {
|
|
562
|
+
readonly searchId: string;
|
|
563
|
+
readonly verdict: string;
|
|
564
|
+
readonly status: string;
|
|
565
|
+
readonly raw: Json;
|
|
566
|
+
}
|
|
567
|
+
/** A refresh asked for: `queued`, or `already_queued` when one was already waiting or under way. */
|
|
568
|
+
interface Refreshed {
|
|
569
|
+
readonly status: string;
|
|
570
|
+
readonly raw: Json;
|
|
571
|
+
}
|
|
463
572
|
|
|
464
573
|
/**
|
|
465
574
|
* Each route as the request it is: path, body and how to read the answer. Written once here and
|
|
@@ -514,6 +623,14 @@ interface PageOptions {
|
|
|
514
623
|
interface ItemsOptions extends PageOptions {
|
|
515
624
|
filters?: Filters;
|
|
516
625
|
}
|
|
626
|
+
interface HowTheyWorkOptions {
|
|
627
|
+
/** Someone in this memory, by name; absent, the person. */
|
|
628
|
+
who?: string;
|
|
629
|
+
/** Where the writing is for, such as a channel or a repository; absent, where they write most. */
|
|
630
|
+
surface?: string;
|
|
631
|
+
}
|
|
632
|
+
/** How a search went: wrong, the answer missing from it, or fine. */
|
|
633
|
+
type Verdict = "wrong" | "missing" | "ok";
|
|
517
634
|
interface ForgetOptions {
|
|
518
635
|
items?: string[];
|
|
519
636
|
sessions?: string[];
|
|
@@ -551,6 +668,25 @@ declare class User {
|
|
|
551
668
|
}): Promise<Memories>;
|
|
552
669
|
/** One memory by its ref, whole: an excerpt, or a fact with the excerpts it came from. */
|
|
553
670
|
open(ref: string): Promise<Opened>;
|
|
671
|
+
/**
|
|
672
|
+
* One person or thing by name, whole: how it went, its values now, its facts in the order they
|
|
673
|
+
* were said, the conversations about it, and how it relates to others.
|
|
674
|
+
*/
|
|
675
|
+
subject(name: string, options?: {
|
|
676
|
+
limit?: number;
|
|
677
|
+
}): Promise<Subject>;
|
|
678
|
+
/** What the people and things one fact or excerpt names link to, by its ref. */
|
|
679
|
+
related(ref: string): Promise<Related>;
|
|
680
|
+
/**
|
|
681
|
+
* How the person works - their routines before an action and how they write on each `surface` -
|
|
682
|
+
* for an agent about to act or write for them. `who` names someone else.
|
|
683
|
+
*/
|
|
684
|
+
howTheyWork(options?: HowTheyWorkOptions): Promise<Ways>;
|
|
685
|
+
/**
|
|
686
|
+
* What an assistant should know before `task`: how the person corrected assistants and the notes
|
|
687
|
+
* they left on answers, most like it first.
|
|
688
|
+
*/
|
|
689
|
+
lessons(task: string): Promise<Lessons>;
|
|
554
690
|
/** Every value a subject was stated to have, by attribute, oldest first. */
|
|
555
691
|
history(subject: string, options?: {
|
|
556
692
|
attribute?: string;
|
|
@@ -582,6 +718,19 @@ declare class User {
|
|
|
582
718
|
forget(named: ForgetOptions): Promise<Forgotten>;
|
|
583
719
|
/** Retract one fact for good, by its ref; a `replacement` is kept as a note. */
|
|
584
720
|
correct(ref: string, replacement?: string): Promise<Correction>;
|
|
721
|
+
/**
|
|
722
|
+
* Say how a search went - `wrong`, `missing` or `ok` - by its result or its `searchId`, and
|
|
723
|
+
* optionally what was true, so memory answers questions like it better. Kept as a note of this
|
|
724
|
+
* memory. Takes a key that writes.
|
|
725
|
+
*/
|
|
726
|
+
feedback(search: SearchResult | string, verdict: Verdict, options?: {
|
|
727
|
+
note?: string;
|
|
728
|
+
}): Promise<Feedback>;
|
|
729
|
+
/**
|
|
730
|
+
* Ask memory to bring what it has gathered of this app user up to date soon - after a large
|
|
731
|
+
* import, say. Once an hour per app user. Takes a key that writes.
|
|
732
|
+
*/
|
|
733
|
+
refresh(): Promise<Refreshed>;
|
|
585
734
|
/** Every version of one added item, oldest first. Takes a key that writes. */
|
|
586
735
|
versions(itemId: string): Promise<Versions>;
|
|
587
736
|
/** Everything memory holds for this app user, a page at a time. */
|
|
@@ -642,4 +791,4 @@ declare class Memory {
|
|
|
642
791
|
close(): void;
|
|
643
792
|
}
|
|
644
793
|
|
|
645
|
-
export { type
|
|
794
|
+
export { type Sources as $, type AddOptions as A, type Memories as B, type Card as C, DEFAULT_BASE_URL as D, type Erased as E, type Fact as F, type GrepOptions as G, type History as H, type Item as I, type Json as J, type Known as K, type LatestOptions as L, type Me as M, Memory as N, type MemoryEntry as O, type MemoryOptions as P, type OpenItem as Q, type OpenItems as R, type OpenItemsOptions as S, type Opened as T, type Origin as U, type PageOptions as V, type Refreshed as W, type Related as X, type SearchOptions as Y, SearchResult as Z, type Source as _, type AddResult as a, type Statuses as a0, type StoredItem as a1, type Subject as a2, type Summary as a3, User as a4, type UsersPage as a5, type Value as a6, type Verdict as a7, type VersionEntry as a8, type Versions as a9, type Ways as aa, type AddedItem as b, type Adding as c, type AppUser as d, type Author as e, type Correction as f, DEFAULT_RETRIES as g, DEFAULT_TIMEOUT_MS as h, type Deleted as i, type Excerpt as j, type ExportPage as k, type ExportRecord as l, type FactsPage as m, type Feedback as n, type Filters as o, type FollowUp as p, type ForgetOptions as q, type Forgotten as r, type HowTheyWorkOptions as s, type ItemDefaults as t, type ItemStatus as u, type ItemsOptions as v, type ItemsPage as w, type Lessons as x, type Line as y, type Link as z };
|
package/dist/index.cjs
CHANGED
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
|
|
17
17
|
|
|
18
18
|
|
|
19
|
-
var
|
|
19
|
+
var _chunk34W2JJVDcjs = require('./chunk-34W2JJVD.cjs');
|
|
20
20
|
|
|
21
21
|
|
|
22
22
|
|
|
@@ -35,4 +35,4 @@ var _chunkAJGT53UZcjs = require('./chunk-AJGT53UZ.cjs');
|
|
|
35
35
|
|
|
36
36
|
|
|
37
37
|
|
|
38
|
-
exports.APIConnectionError =
|
|
38
|
+
exports.APIConnectionError = _chunk34W2JJVDcjs.APIConnectionError; exports.APITimeoutError = _chunk34W2JJVDcjs.APITimeoutError; exports.AlexeinError = _chunk34W2JJVDcjs.AlexeinError; exports.AuthenticationError = _chunk34W2JJVDcjs.AuthenticationError; exports.DEFAULT_BASE_URL = _chunk34W2JJVDcjs.DEFAULT_BASE_URL; exports.DEFAULT_RETRIES = _chunk34W2JJVDcjs.DEFAULT_RETRIES; exports.DEFAULT_TIMEOUT_MS = _chunk34W2JJVDcjs.DEFAULT_TIMEOUT_MS; exports.InvalidRequestError = _chunk34W2JJVDcjs.InvalidRequestError; exports.Memory = _chunk34W2JJVDcjs.Memory; exports.NotFoundError = _chunk34W2JJVDcjs.NotFoundError; exports.PermissionDeniedError = _chunk34W2JJVDcjs.PermissionDeniedError; exports.QuotaExceededError = _chunk34W2JJVDcjs.QuotaExceededError; exports.RateLimitError = _chunk34W2JJVDcjs.RateLimitError; exports.SearchResult = _chunk34W2JJVDcjs.SearchResult; exports.ServiceUnavailableError = _chunk34W2JJVDcjs.ServiceUnavailableError; exports.User = _chunk34W2JJVDcjs.User; exports.VERSION = _chunk34W2JJVDcjs.VERSION;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { J as Json } from './client-
|
|
2
|
-
export { A as AddOptions, a as AddResult, b as AddedItem, c as Adding, d as AppUser, e as Author, C as Correction, D as DEFAULT_BASE_URL,
|
|
1
|
+
import { J as Json } from './client-Bz10lVYG.cjs';
|
|
2
|
+
export { A as AddOptions, a as AddResult, b as AddedItem, c as Adding, d as AppUser, e as Author, C as Card, f as Correction, D as DEFAULT_BASE_URL, g as DEFAULT_RETRIES, h as DEFAULT_TIMEOUT_MS, i as Deleted, E as Erased, j as Excerpt, k as ExportPage, l as ExportRecord, F as Fact, m as FactsPage, n as Feedback, o as Filters, p as FollowUp, q as ForgetOptions, r as Forgotten, G as GrepOptions, H as History, s as HowTheyWorkOptions, I as Item, t as ItemDefaults, u as ItemStatus, v as ItemsOptions, w as ItemsPage, K as Known, L as LatestOptions, x as Lessons, y as Line, z as Link, M as Me, B as Memories, N as Memory, O as MemoryEntry, P as MemoryOptions, Q as OpenItem, R as OpenItems, S as OpenItemsOptions, T as Opened, U as Origin, V as PageOptions, W as Refreshed, X as Related, Y as SearchOptions, Z as SearchResult, _ as Source, $ as Sources, a0 as Statuses, a1 as StoredItem, a2 as Subject, a3 as Summary, a4 as User, a5 as UsersPage, a6 as Value, a7 as Verdict, a8 as VersionEntry, a9 as Versions, aa as Ways } from './client-Bz10lVYG.cjs';
|
|
3
3
|
|
|
4
|
-
declare const VERSION = "0.3.
|
|
4
|
+
declare const VERSION = "0.3.3";
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* What can go wrong, one class per thing a caller would handle differently: the same classes as
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { J as Json } from './client-
|
|
2
|
-
export { A as AddOptions, a as AddResult, b as AddedItem, c as Adding, d as AppUser, e as Author, C as Correction, D as DEFAULT_BASE_URL,
|
|
1
|
+
import { J as Json } from './client-Bz10lVYG.js';
|
|
2
|
+
export { A as AddOptions, a as AddResult, b as AddedItem, c as Adding, d as AppUser, e as Author, C as Card, f as Correction, D as DEFAULT_BASE_URL, g as DEFAULT_RETRIES, h as DEFAULT_TIMEOUT_MS, i as Deleted, E as Erased, j as Excerpt, k as ExportPage, l as ExportRecord, F as Fact, m as FactsPage, n as Feedback, o as Filters, p as FollowUp, q as ForgetOptions, r as Forgotten, G as GrepOptions, H as History, s as HowTheyWorkOptions, I as Item, t as ItemDefaults, u as ItemStatus, v as ItemsOptions, w as ItemsPage, K as Known, L as LatestOptions, x as Lessons, y as Line, z as Link, M as Me, B as Memories, N as Memory, O as MemoryEntry, P as MemoryOptions, Q as OpenItem, R as OpenItems, S as OpenItemsOptions, T as Opened, U as Origin, V as PageOptions, W as Refreshed, X as Related, Y as SearchOptions, Z as SearchResult, _ as Source, $ as Sources, a0 as Statuses, a1 as StoredItem, a2 as Subject, a3 as Summary, a4 as User, a5 as UsersPage, a6 as Value, a7 as Verdict, a8 as VersionEntry, a9 as Versions, aa as Ways } from './client-Bz10lVYG.js';
|
|
3
3
|
|
|
4
|
-
declare const VERSION = "0.3.
|
|
4
|
+
declare const VERSION = "0.3.3";
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* What can go wrong, one class per thing a caller would handle differently: the same classes as
|
package/dist/index.js
CHANGED
package/dist/langgraph.cjs
CHANGED
|
@@ -12,10 +12,10 @@
|
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
|
|
15
|
-
var
|
|
15
|
+
var _chunkLWBADF3Fcjs = require('./chunk-LWBADF3F.cjs');
|
|
16
16
|
|
|
17
17
|
|
|
18
|
-
var
|
|
18
|
+
var _chunk34W2JJVDcjs = require('./chunk-34W2JJVD.cjs');
|
|
19
19
|
|
|
20
20
|
// src/langgraph/index.ts
|
|
21
21
|
var _messages = require('@langchain/core/messages');
|
|
@@ -58,12 +58,12 @@ var AlexeinMemory = (_class = class {
|
|
|
58
58
|
#client;
|
|
59
59
|
/** `client` defaults to one made on first use: fail-open unless strict, a 10 s timeout. */
|
|
60
60
|
constructor(client, options = {}) {;_class.prototype.__init.call(this);_class.prototype.__init2.call(this);_class.prototype.__init3.call(this);
|
|
61
|
-
const given =
|
|
62
|
-
const settings =
|
|
61
|
+
const given = _chunkLWBADF3Fcjs.isClient.call(void 0, client) ? client : void 0;
|
|
62
|
+
const settings = _chunkLWBADF3Fcjs.isClient.call(void 0, client) ? options : { ...client, ...options };
|
|
63
63
|
this.fast = _nullishCoalesce(settings.fast, () => ( false));
|
|
64
64
|
this.maxChars = _nullishCoalesce(settings.maxChars, () => ( 4e3));
|
|
65
65
|
this.strict = _nullishCoalesce(settings.strict, () => ( false));
|
|
66
|
-
this.#client = new (0,
|
|
66
|
+
this.#client = new (0, _chunkLWBADF3Fcjs.LazyClient)(given, "langgraph", this.strict, settings.timeout);
|
|
67
67
|
}
|
|
68
68
|
get client() {
|
|
69
69
|
return this.#client.client;
|
|
@@ -76,7 +76,7 @@ var AlexeinMemory = (_class = class {
|
|
|
76
76
|
const asked = _optionalChain([lastHuman, 'call', _16 => _16(state.messages), 'optionalAccess', _17 => _17.text, 'access', _18 => _18.trim, 'call', _19 => _19()]);
|
|
77
77
|
const user = this.user(config);
|
|
78
78
|
if (!asked) return { memory: "" };
|
|
79
|
-
const found = await
|
|
79
|
+
const found = await _chunkLWBADF3Fcjs.searchFor.call(void 0, user, asked, this.fast);
|
|
80
80
|
return { memory: _nullishCoalesce(_optionalChain([found, 'optionalAccess', _20 => _20.context, 'call', _21 => _21(this.maxChars)]), () => ( "")) };
|
|
81
81
|
}}
|
|
82
82
|
/**
|
|
@@ -96,7 +96,7 @@ var AlexeinMemory = (_class = class {
|
|
|
96
96
|
return {};
|
|
97
97
|
}}
|
|
98
98
|
/** What `recall` found, as a block for your system prompt; empty when it found nothing. */
|
|
99
|
-
__init3() {this.prompt = (state) =>
|
|
99
|
+
__init3() {this.prompt = (state) => _chunkLWBADF3Fcjs.promptBlock.call(void 0, _nullishCoalesce(state.memory, () => ( "")))}
|
|
100
100
|
/**
|
|
101
101
|
* Tools the model calls when it decides to: `memory_search` and `memory_open`, and with
|
|
102
102
|
* `write`, `memory_add`. The user comes from the run, which a model never sees.
|
|
@@ -108,8 +108,8 @@ var AlexeinMemory = (_class = class {
|
|
|
108
108
|
searchTool() {
|
|
109
109
|
return _tools.tool.call(void 0,
|
|
110
110
|
async ({ query }, config) => {
|
|
111
|
-
const found = await
|
|
112
|
-
return
|
|
111
|
+
const found = await _chunkLWBADF3Fcjs.searchFor.call(void 0, this.user(config), query, this.fast);
|
|
112
|
+
return _chunkLWBADF3Fcjs.searchAnswer.call(void 0, found, this.maxChars);
|
|
113
113
|
},
|
|
114
114
|
{
|
|
115
115
|
name: "memory_search",
|
|
@@ -123,10 +123,10 @@ var AlexeinMemory = (_class = class {
|
|
|
123
123
|
async ({ ref }, config) => {
|
|
124
124
|
const user = this.user(config);
|
|
125
125
|
try {
|
|
126
|
-
return
|
|
126
|
+
return _chunkLWBADF3Fcjs.openAnswer.call(void 0, await user.open(ref));
|
|
127
127
|
} catch (error) {
|
|
128
|
-
if (error instanceof
|
|
129
|
-
return
|
|
128
|
+
if (error instanceof _chunk34W2JJVDcjs.NotFoundError) return _chunkLWBADF3Fcjs.notFoundAnswer.call(void 0, error);
|
|
129
|
+
return _chunkLWBADF3Fcjs.outageAnswer.call(void 0, error, this.strict);
|
|
130
130
|
}
|
|
131
131
|
},
|
|
132
132
|
{
|
|
@@ -143,7 +143,7 @@ var AlexeinMemory = (_class = class {
|
|
|
143
143
|
kind: "note",
|
|
144
144
|
session: threadOf(config)
|
|
145
145
|
});
|
|
146
|
-
return saved.failed ?
|
|
146
|
+
return saved.failed ? _chunkLWBADF3Fcjs.UNAVAILABLE : _chunkLWBADF3Fcjs.SAVED;
|
|
147
147
|
},
|
|
148
148
|
{
|
|
149
149
|
name: "memory_add",
|
|
@@ -156,7 +156,7 @@ var AlexeinMemory = (_class = class {
|
|
|
156
156
|
async function item(message, role, thread) {
|
|
157
157
|
const text = _optionalChain([message, 'optionalAccess', _22 => _22.text]);
|
|
158
158
|
if (!_optionalChain([text, 'optionalAccess', _23 => _23.trim, 'call', _24 => _24()])) return void 0;
|
|
159
|
-
const id = await _asyncNullishCoalesce(await _asyncOptionalChain([message, 'optionalAccess', async _25 => _25.id]), async () => ( await
|
|
159
|
+
const id = await _asyncNullishCoalesce(await _asyncOptionalChain([message, 'optionalAccess', async _25 => _25.id]), async () => ( await _chunkLWBADF3Fcjs.stableId.call(void 0, thread, role, text)));
|
|
160
160
|
return { id, role, text };
|
|
161
161
|
}
|
|
162
162
|
var fallback;
|
|
@@ -182,4 +182,4 @@ var memoryTools = (options = {}) => defaultMemory().tools(options);
|
|
|
182
182
|
|
|
183
183
|
|
|
184
184
|
|
|
185
|
-
exports.AlexeinMemory = AlexeinMemory; exports.MemoryAnnotation = MemoryAnnotation; exports.MemoryContext = MemoryContext; exports.MemoryState = MemoryState; exports.NOTHING_FOUND =
|
|
185
|
+
exports.AlexeinMemory = AlexeinMemory; exports.MemoryAnnotation = MemoryAnnotation; exports.MemoryContext = MemoryContext; exports.MemoryState = MemoryState; exports.NOTHING_FOUND = _chunkLWBADF3Fcjs.NOTHING_FOUND; exports.NOTHING_YET = _chunkLWBADF3Fcjs.NOTHING_YET; exports.UNAVAILABLE = _chunkLWBADF3Fcjs.UNAVAILABLE; exports.defaultMemory = defaultMemory; exports.memoryPrompt = memoryPrompt; exports.memoryTools = memoryTools; exports.recall = recall; exports.remember = remember; exports.userIdOf = userIdOf;
|
package/dist/langgraph.d.cts
CHANGED
|
@@ -4,7 +4,7 @@ import * as _langchain_langgraph from '@langchain/langgraph';
|
|
|
4
4
|
import { StateSchema } from '@langchain/langgraph';
|
|
5
5
|
import { StructuredToolInterface } from '@langchain/core/tools';
|
|
6
6
|
import { z } from 'zod';
|
|
7
|
-
import {
|
|
7
|
+
import { N as Memory } from './client-Bz10lVYG.cjs';
|
|
8
8
|
import { I as IntegrationOptions } from './shared-Btg8LbKC.cjs';
|
|
9
9
|
export { N as NOTHING_FOUND, a as NOTHING_YET, U as UNAVAILABLE } from './shared-Btg8LbKC.cjs';
|
|
10
10
|
|
package/dist/langgraph.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import * as _langchain_langgraph from '@langchain/langgraph';
|
|
|
4
4
|
import { StateSchema } from '@langchain/langgraph';
|
|
5
5
|
import { StructuredToolInterface } from '@langchain/core/tools';
|
|
6
6
|
import { z } from 'zod';
|
|
7
|
-
import {
|
|
7
|
+
import { N as Memory } from './client-Bz10lVYG.js';
|
|
8
8
|
import { I as IntegrationOptions } from './shared-Btg8LbKC.js';
|
|
9
9
|
export { N as NOTHING_FOUND, a as NOTHING_YET, U as UNAVAILABLE } from './shared-Btg8LbKC.js';
|
|
10
10
|
|
package/dist/langgraph.js
CHANGED
|
@@ -12,10 +12,10 @@ import {
|
|
|
12
12
|
searchAnswer,
|
|
13
13
|
searchFor,
|
|
14
14
|
stableId
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-HDNKPJS2.js";
|
|
16
16
|
import {
|
|
17
17
|
NotFoundError
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-5YIOYX3J.js";
|
|
19
19
|
|
|
20
20
|
// src/langgraph/index.ts
|
|
21
21
|
import { AIMessage, HumanMessage } from "@langchain/core/messages";
|