@alexein/sdk 0.3.2 → 0.3.4

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.
@@ -2,7 +2,7 @@ import {
2
2
  AlexeinError,
3
3
  Memory,
4
4
  NotFoundError
5
- } from "./chunk-CKBVQNV5.js";
5
+ } from "./chunk-2322CW56.js";
6
6
 
7
7
  // src/integrations/shared.ts
8
8
  var UNAVAILABLE = "Memory is unavailable right now; carry on without it.";
@@ -2,7 +2,7 @@
2
2
 
3
3
 
4
4
 
5
- var _chunkAJGT53UZcjs = require('./chunk-AJGT53UZ.cjs');
5
+ var _chunkAJUBXMERcjs = require('./chunk-AJUBXMER.cjs');
6
6
 
7
7
  // src/integrations/shared.ts
8
8
  var UNAVAILABLE = "Memory is unavailable right now; carry on without it.";
@@ -24,7 +24,7 @@ var LazyClient = class {
24
24
 
25
25
  #client;
26
26
  get client() {
27
- this.#client ??= new (0, _chunkAJGT53UZcjs.Memory)({
27
+ this.#client ??= new (0, _chunkAJUBXMERcjs.Memory)({
28
28
  failOpen: !this.strict,
29
29
  integration: this.integration,
30
30
  timeout: this.timeout
@@ -39,7 +39,7 @@ async function searchFor(user, query, fast) {
39
39
  try {
40
40
  return await user.search(query.slice(-MAX_QUERY), { fast });
41
41
  } catch (error) {
42
- if (error instanceof _chunkAJGT53UZcjs.NotFoundError) return void 0;
42
+ if (error instanceof _chunkAJUBXMERcjs.NotFoundError) return void 0;
43
43
  throw error;
44
44
  }
45
45
  }
@@ -69,7 +69,7 @@ function notFoundAnswer(error) {
69
69
  return /\bref\b/.test(error.detail) ? "Memory holds nothing by that ref." : NOTHING_YET;
70
70
  }
71
71
  function outageAnswer(error, strict) {
72
- if (strict || !(error instanceof _chunkAJGT53UZcjs.AlexeinError) || !error.outage) throw error;
72
+ if (strict || !(error instanceof _chunkAJUBXMERcjs.AlexeinError) || !error.outage) throw error;
73
73
  console.warn(`Alexein is unavailable: ${error.message}`);
74
74
  return UNAVAILABLE;
75
75
  }
@@ -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
- constructor(query: string, answerable: boolean | null, notes: string[], memories: MemoryEntry[], sources: Json[] | null, failed: boolean, raw: Json);
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>`), cut at a whole
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. */
@@ -610,7 +759,11 @@ declare class User {
610
759
  * ```ts
611
760
  * const memory = new Memory(); // ALEXEIN_API_KEY from the environment
612
761
  * const dana = memory.user("dana"); // your own id for one of your app users
613
- * await dana.add("I moved to Lisbon for the job at Acme.");
762
+ * await dana.add("I moved to Lisbon.", {
763
+ * id: "move",
764
+ * author: { name: "Dana", self: true },
765
+ * wait: true,
766
+ * });
614
767
  * console.log((await dana.search("Where does Dana live?")).context());
615
768
  * ```
616
769
  */
@@ -628,8 +781,9 @@ declare class Memory {
628
781
  /** What this key is: its organisation, project, and whether it writes. Names no app user. */
629
782
  me(): Promise<Me>;
630
783
  /**
631
- * The memory of one of your app users, by your own id for them: 1 to 35 letters, digits, `.`,
632
- * `_` and `-`, beginning with a letter or digit. A RangeError otherwise, before any request.
784
+ * The memory of one of your app users, by the id your app already has for them (a UUID, an
785
+ * email): up to 128 characters, no control characters, ASCII only. A RangeError otherwise,
786
+ * before any request.
633
787
  */
634
788
  user(id: string): User;
635
789
  /** The app users of this key's project with memory, a page at a time in id order. */
@@ -642,4 +796,4 @@ declare class Memory {
642
796
  close(): void;
643
797
  }
644
798
 
645
- export { type Versions as $, type AddOptions as A, type Opened as B, type Correction 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, type Origin as N, type OpenItem as O, type PageOptions as P, SearchResult as Q, type Source as R, type SearchOptions as S, type Sources as T, type Statuses as U, type StoredItem as V, type Summary as W, User as X, type UsersPage as Y, type Value as Z, type VersionEntry as _, type AddResult as a, type AddedItem as b, type Adding as c, type AppUser as d, type Author as e, DEFAULT_RETRIES as f, DEFAULT_TIMEOUT_MS as g, type Deleted as h, type Excerpt as i, type ExportPage as j, type ExportRecord as k, type FactsPage as l, type Filters as m, type FollowUp as n, type ForgetOptions as o, type Forgotten as p, type ItemDefaults as q, type ItemStatus as r, type ItemsOptions as s, type ItemsPage as t, type Memories as u, Memory as v, type MemoryEntry as w, type MemoryOptions as x, type OpenItems as y, type OpenItemsOptions as z };
799
+ 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
- constructor(query: string, answerable: boolean | null, notes: string[], memories: MemoryEntry[], sources: Json[] | null, failed: boolean, raw: Json);
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>`), cut at a whole
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. */
@@ -610,7 +759,11 @@ declare class User {
610
759
  * ```ts
611
760
  * const memory = new Memory(); // ALEXEIN_API_KEY from the environment
612
761
  * const dana = memory.user("dana"); // your own id for one of your app users
613
- * await dana.add("I moved to Lisbon for the job at Acme.");
762
+ * await dana.add("I moved to Lisbon.", {
763
+ * id: "move",
764
+ * author: { name: "Dana", self: true },
765
+ * wait: true,
766
+ * });
614
767
  * console.log((await dana.search("Where does Dana live?")).context());
615
768
  * ```
616
769
  */
@@ -628,8 +781,9 @@ declare class Memory {
628
781
  /** What this key is: its organisation, project, and whether it writes. Names no app user. */
629
782
  me(): Promise<Me>;
630
783
  /**
631
- * The memory of one of your app users, by your own id for them: 1 to 35 letters, digits, `.`,
632
- * `_` and `-`, beginning with a letter or digit. A RangeError otherwise, before any request.
784
+ * The memory of one of your app users, by the id your app already has for them (a UUID, an
785
+ * email): up to 128 characters, no control characters, ASCII only. A RangeError otherwise,
786
+ * before any request.
633
787
  */
634
788
  user(id: string): User;
635
789
  /** The app users of this key's project with memory, a page at a time in id order. */
@@ -642,4 +796,4 @@ declare class Memory {
642
796
  close(): void;
643
797
  }
644
798
 
645
- export { type Versions as $, type AddOptions as A, type Opened as B, type Correction 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, type Origin as N, type OpenItem as O, type PageOptions as P, SearchResult as Q, type Source as R, type SearchOptions as S, type Sources as T, type Statuses as U, type StoredItem as V, type Summary as W, User as X, type UsersPage as Y, type Value as Z, type VersionEntry as _, type AddResult as a, type AddedItem as b, type Adding as c, type AppUser as d, type Author as e, DEFAULT_RETRIES as f, DEFAULT_TIMEOUT_MS as g, type Deleted as h, type Excerpt as i, type ExportPage as j, type ExportRecord as k, type FactsPage as l, type Filters as m, type FollowUp as n, type ForgetOptions as o, type Forgotten as p, type ItemDefaults as q, type ItemStatus as r, type ItemsOptions as s, type ItemsPage as t, type Memories as u, Memory as v, type MemoryEntry as w, type MemoryOptions as x, type OpenItems as y, type OpenItemsOptions as z };
799
+ 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 _chunkAJGT53UZcjs = require('./chunk-AJGT53UZ.cjs');
19
+ var _chunkAJUBXMERcjs = require('./chunk-AJUBXMER.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 = _chunkAJGT53UZcjs.APIConnectionError; exports.APITimeoutError = _chunkAJGT53UZcjs.APITimeoutError; exports.AlexeinError = _chunkAJGT53UZcjs.AlexeinError; exports.AuthenticationError = _chunkAJGT53UZcjs.AuthenticationError; exports.DEFAULT_BASE_URL = _chunkAJGT53UZcjs.DEFAULT_BASE_URL; exports.DEFAULT_RETRIES = _chunkAJGT53UZcjs.DEFAULT_RETRIES; exports.DEFAULT_TIMEOUT_MS = _chunkAJGT53UZcjs.DEFAULT_TIMEOUT_MS; exports.InvalidRequestError = _chunkAJGT53UZcjs.InvalidRequestError; exports.Memory = _chunkAJGT53UZcjs.Memory; exports.NotFoundError = _chunkAJGT53UZcjs.NotFoundError; exports.PermissionDeniedError = _chunkAJGT53UZcjs.PermissionDeniedError; exports.QuotaExceededError = _chunkAJGT53UZcjs.QuotaExceededError; exports.RateLimitError = _chunkAJGT53UZcjs.RateLimitError; exports.SearchResult = _chunkAJGT53UZcjs.SearchResult; exports.ServiceUnavailableError = _chunkAJGT53UZcjs.ServiceUnavailableError; exports.User = _chunkAJGT53UZcjs.User; exports.VERSION = _chunkAJGT53UZcjs.VERSION;
38
+ exports.APIConnectionError = _chunkAJUBXMERcjs.APIConnectionError; exports.APITimeoutError = _chunkAJUBXMERcjs.APITimeoutError; exports.AlexeinError = _chunkAJUBXMERcjs.AlexeinError; exports.AuthenticationError = _chunkAJUBXMERcjs.AuthenticationError; exports.DEFAULT_BASE_URL = _chunkAJUBXMERcjs.DEFAULT_BASE_URL; exports.DEFAULT_RETRIES = _chunkAJUBXMERcjs.DEFAULT_RETRIES; exports.DEFAULT_TIMEOUT_MS = _chunkAJUBXMERcjs.DEFAULT_TIMEOUT_MS; exports.InvalidRequestError = _chunkAJUBXMERcjs.InvalidRequestError; exports.Memory = _chunkAJUBXMERcjs.Memory; exports.NotFoundError = _chunkAJUBXMERcjs.NotFoundError; exports.PermissionDeniedError = _chunkAJUBXMERcjs.PermissionDeniedError; exports.QuotaExceededError = _chunkAJUBXMERcjs.QuotaExceededError; exports.RateLimitError = _chunkAJUBXMERcjs.RateLimitError; exports.SearchResult = _chunkAJUBXMERcjs.SearchResult; exports.ServiceUnavailableError = _chunkAJUBXMERcjs.ServiceUnavailableError; exports.User = _chunkAJUBXMERcjs.User; exports.VERSION = _chunkAJUBXMERcjs.VERSION;
package/dist/index.d.cts CHANGED
@@ -1,7 +1,7 @@
1
- import { J as Json } from './client-DJsIRKil.cjs';
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, f as DEFAULT_RETRIES, g as DEFAULT_TIMEOUT_MS, h as Deleted, E as Erased, i as Excerpt, j as ExportPage, k as ExportRecord, F as Fact, l as FactsPage, m as Filters, n as FollowUp, o as ForgetOptions, p as Forgotten, G as GrepOptions, H as History, I as Item, q as ItemDefaults, r as ItemStatus, s as ItemsOptions, t as ItemsPage, K as Known, L as LatestOptions, M as Me, u as Memories, v as Memory, w as MemoryEntry, x as MemoryOptions, O as OpenItem, y as OpenItems, z as OpenItemsOptions, B as Opened, N as Origin, P as PageOptions, S as SearchOptions, Q as SearchResult, R as Source, T as Sources, U as Statuses, V as StoredItem, W as Summary, X as User, Y as UsersPage, Z as Value, _ as VersionEntry, $ as Versions } from './client-DJsIRKil.cjs';
1
+ import { J as Json } from './client-XsmLck0h.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-XsmLck0h.cjs';
3
3
 
4
- declare const VERSION = "0.3.2";
4
+ declare const VERSION = "0.3.4";
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-DJsIRKil.js';
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, f as DEFAULT_RETRIES, g as DEFAULT_TIMEOUT_MS, h as Deleted, E as Erased, i as Excerpt, j as ExportPage, k as ExportRecord, F as Fact, l as FactsPage, m as Filters, n as FollowUp, o as ForgetOptions, p as Forgotten, G as GrepOptions, H as History, I as Item, q as ItemDefaults, r as ItemStatus, s as ItemsOptions, t as ItemsPage, K as Known, L as LatestOptions, M as Me, u as Memories, v as Memory, w as MemoryEntry, x as MemoryOptions, O as OpenItem, y as OpenItems, z as OpenItemsOptions, B as Opened, N as Origin, P as PageOptions, S as SearchOptions, Q as SearchResult, R as Source, T as Sources, U as Statuses, V as StoredItem, W as Summary, X as User, Y as UsersPage, Z as Value, _ as VersionEntry, $ as Versions } from './client-DJsIRKil.js';
1
+ import { J as Json } from './client-XsmLck0h.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-XsmLck0h.js';
3
3
 
4
- declare const VERSION = "0.3.2";
4
+ declare const VERSION = "0.3.4";
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
@@ -16,7 +16,7 @@ import {
16
16
  ServiceUnavailableError,
17
17
  User,
18
18
  VERSION
19
- } from "./chunk-CKBVQNV5.js";
19
+ } from "./chunk-2322CW56.js";
20
20
  export {
21
21
  APIConnectionError,
22
22
  APITimeoutError,