@alexein/sdk 0.3.1 → 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 +23 -0
- package/README.md +30 -13
- package/dist/{chunk-BIGISYZR.cjs → chunk-34W2JJVD.cjs} +177 -17
- package/dist/{chunk-DADXKQLZ.js → chunk-5YIOYX3J.js} +176 -16
- package/dist/{chunk-3LJEU4WL.js → chunk-HDNKPJS2.js} +1 -1
- package/dist/{chunk-PSATR3NL.cjs → chunk-LWBADF3F.cjs} +4 -4
- package/dist/{client-YKZ4fkK-.d.cts → client-Bz10lVYG.d.cts} +158 -5
- package/dist/{client-YKZ4fkK-.d.ts → client-Bz10lVYG.d.ts} +158 -5
- package/dist/index.cjs +4 -2
- package/dist/index.d.cts +20 -4
- package/dist/index.d.ts +20 -4
- package/dist/index.js +3 -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
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,28 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.3.3 - 2026-11-20
|
|
4
|
+
|
|
5
|
+
The same version as `alexein` on PyPI, which has the same changes.
|
|
6
|
+
|
|
7
|
+
- `add(text, { id: "diet" })` is typed now, and names the one item added. With several items it is a
|
|
8
|
+
`RangeError`: before, every item was sent with the same id, so they were edits of one another.
|
|
9
|
+
- `SearchResult.searchId`, and `user.feedback(resultOrSearchId, "wrong" | "missing" | "ok", { note })` to
|
|
10
|
+
say how a search went.
|
|
11
|
+
- The API's other routes: `user.subject(name, { limit })`, `user.related(ref)`,
|
|
12
|
+
`user.howTheyWork({ who, surface })`, `user.lessons(task)` and `user.refresh()`, answering `Subject`,
|
|
13
|
+
`Related`, `Ways`, `Lessons` and `Refreshed`.
|
|
14
|
+
- `context()` keeps each memory on one line: an excerpt's text is its header, a blank line, then what was
|
|
15
|
+
said, so its line breaks are made spaces. The memory itself keeps them.
|
|
16
|
+
|
|
17
|
+
## 0.3.2 - 2026-11-17
|
|
18
|
+
|
|
19
|
+
- `QuotaExceededError`: a 402, when the organisation has used this month's events (on an add) or retrievals
|
|
20
|
+
(on a search; every other read is free). Never retried, and not an outage, so a `failOpen` client throws
|
|
21
|
+
it too. Carries `limit`, `used`, `included`, `resetsAt` and `upgrade`. A 403 is also an organisation that is closed.
|
|
22
|
+
- A list line from `grep` or `latest` with no `type` is an excerpt, and one with no `roles` is `["other"]`:
|
|
23
|
+
the API sends `roles` only when the person or an assistant spoke. Before, such a line was skipped, so
|
|
24
|
+
both reads could come back empty.
|
|
25
|
+
|
|
3
26
|
## 0.3.1 - 2026-11-04
|
|
4
27
|
|
|
5
28
|
- Published through npm's trusted publishing from GitHub Actions, with no token: the provenance on npm is
|
package/README.md
CHANGED
|
@@ -52,7 +52,7 @@ for any other, before a request is made.
|
|
|
52
52
|
The base URL is the API's host: `http://localhost:8210`, `http://localhost:8210/` and
|
|
53
53
|
`http://localhost:8210/v2` all mean the same. The environment is read where there is a
|
|
54
54
|
`process.env`; elsewhere, pass the options. `integration` adds one lowercase word to the
|
|
55
|
-
`User-Agent` (`alexein-js/0.3.
|
|
55
|
+
`User-Agent` (`alexein-js/0.3.3 langgraph`), so the console's request logs show where requests came
|
|
56
56
|
from.
|
|
57
57
|
|
|
58
58
|
Run it on your server: a key in a browser bundle can be copied, and it speaks for every user of the
|
|
@@ -71,10 +71,12 @@ await dana.add(
|
|
|
71
71
|
{ session: "trip-may" },
|
|
72
72
|
);
|
|
73
73
|
await dana.add("Moving house on 1 December.", { kind: "note", expires: "2026-12-31" });
|
|
74
|
+
await dana.add("Vegetarian, allergic to peanuts.", { id: "diet", kind: "note" }); // the one item's id
|
|
74
75
|
```
|
|
75
76
|
|
|
76
77
|
The item fields are `text` (required), `kind`, `id`, `session`, `role`, `author`, `title`, `about`,
|
|
77
|
-
`at`, `expires` and `metadata`. The same `id` again is an edit
|
|
78
|
+
`at`, `expires` and `metadata`. The same `id` again is an edit; as an option, `id` names the one item
|
|
79
|
+
added, and with several items it is a `RangeError`. `wait: true` answers once the items
|
|
78
80
|
are searchable; `redact: true` replaces phone numbers, cards, keys and the like before memory keeps
|
|
79
81
|
them. More than 500 items go as several requests, each with an `Idempotency-Key` its retries send
|
|
80
82
|
again, so a retry never saves an item twice.
|
|
@@ -91,6 +93,12 @@ result.context(4000); // notes, then one memory per line, never longer than 4000
|
|
|
91
93
|
for (const ref of result.refs) await dana.open(ref); // each memory whole
|
|
92
94
|
```
|
|
93
95
|
|
|
96
|
+
`context()` puts each memory on one line: a memory's own line breaks become spaces.
|
|
97
|
+
|
|
98
|
+
When an answer from memory turns out wrong or incomplete, say so with `dana.feedback(result, "wrong",
|
|
99
|
+
{ note: "Dana moved to Porto in October." })` (or `"missing"`, `"ok"`): memory answers questions like it
|
|
100
|
+
better. It takes the result or its `result.searchId`, and needs a key that writes.
|
|
101
|
+
|
|
94
102
|
`fast: true` answers sooner, a little less precisely, and is free. `before` and `after` (ISO dates),
|
|
95
103
|
`filters`, and `provider`, `source` and `kind` narrow a search.
|
|
96
104
|
|
|
@@ -104,6 +112,10 @@ for (const ref of result.refs) await dana.open(ref); // each memory whole
|
|
|
104
112
|
| `user.latest({ k, place, after, before, filters, ... })` | `latest` |
|
|
105
113
|
| `user.around(ref, { width })` | `around` |
|
|
106
114
|
| `user.open(ref)` | `open` |
|
|
115
|
+
| `user.subject(name, { limit })` | `subject` |
|
|
116
|
+
| `user.related(ref)` | `related` |
|
|
117
|
+
| `user.howTheyWork({ who, surface })` | `how_they_work` |
|
|
118
|
+
| `user.lessons(task)` | `lessons` |
|
|
107
119
|
| `user.history(subject, { attribute })` | `history` |
|
|
108
120
|
| `user.summary()` | `summary` |
|
|
109
121
|
| `user.facts({ limit, cursor })`, `user.iterFacts()` | `facts` |
|
|
@@ -114,12 +126,16 @@ for (const ref of result.refs) await dana.open(ref); // each memory whole
|
|
|
114
126
|
| `user.status(ids)` | `status` |
|
|
115
127
|
| `user.forget({ items, sessions, refs })` | `forget` |
|
|
116
128
|
| `user.correct(ref, replacement?)` | `correct` |
|
|
129
|
+
| `user.feedback(search, verdict, { note })` | `feedback` |
|
|
130
|
+
| `user.refresh()` | `refresh` |
|
|
117
131
|
| `user.versions(itemId)` | `versions` |
|
|
118
132
|
| `user.export({ limit, cursor })`, `user.iterExport()` | `export` |
|
|
119
133
|
| `user.delete()` | `users/delete` |
|
|
120
134
|
|
|
121
135
|
Every route but `me` is `POST /v2/memory/<route>`. Results are plain objects with camelCase fields
|
|
122
|
-
(`addedAt`, `followUps`, `lastWrite`); each keeps the JSON the API sent as `.raw`.
|
|
136
|
+
(`addedAt`, `followUps`, `lastWrite`); each keeps the JSON the API sent as `.raw`. A read of an app
|
|
137
|
+
user nothing was ever added for throws `NotFoundError`, `item()` included; `item()` answers null for
|
|
138
|
+
an id an app user's memory does not hold. The `iter*`
|
|
123
139
|
methods are async iterables that follow `next` from page to page:
|
|
124
140
|
|
|
125
141
|
```ts
|
|
@@ -132,16 +148,17 @@ Every error is an `AlexeinError` with `status` (null when no answer came), `deta
|
|
|
132
148
|
words), `errors` (on a 422, each field as `{ field, message }`), `requestId` (the response's
|
|
133
149
|
`X-Request-Id`: quote it when you ask for help) and `outage`.
|
|
134
150
|
|
|
135
|
-
| Error | When
|
|
136
|
-
| ------------------------- |
|
|
137
|
-
| `AuthenticationError` | 401: no key, or one the service did not issue
|
|
138
|
-
| `
|
|
139
|
-
| `
|
|
140
|
-
| `
|
|
141
|
-
| `
|
|
142
|
-
| `
|
|
143
|
-
| `
|
|
144
|
-
| `
|
|
151
|
+
| Error | When |
|
|
152
|
+
| ------------------------- | ---------------------------------------------------------------------------------------------------------------------------- |
|
|
153
|
+
| `AuthenticationError` | 401: no key, or one the service did not issue |
|
|
154
|
+
| `QuotaExceededError` | 402: the month's events (on an add) or retrievals (on a search) are used; `limit`, `used`, `included`, `resetsAt`, `upgrade` |
|
|
155
|
+
| `PermissionDeniedError` | 403: the key reads, and the call writes; or the organisation is closed |
|
|
156
|
+
| `NotFoundError` | 404: nothing added for this app user, or no such ref |
|
|
157
|
+
| `InvalidRequestError` | 400, 413, 422 and any other 4xx: the request is wrong |
|
|
158
|
+
| `RateLimitError` | 429, after retries |
|
|
159
|
+
| `ServiceUnavailableError` | 5xx, after retries |
|
|
160
|
+
| `APIConnectionError` | the service could not be reached, after retries |
|
|
161
|
+
| `APITimeoutError` | an `APIConnectionError`: no answer in time |
|
|
145
162
|
|
|
146
163
|
429 and 503, a timeout and a failed connection are tried up to `maxRetries` more times: after the
|
|
147
164
|
`Retry-After` header's seconds when it says 60 or fewer (more, and the error is thrown at once),
|
|
@@ -36,7 +36,7 @@ function parseExcerpt(value) {
|
|
|
36
36
|
date: maybe(raw.date),
|
|
37
37
|
addedAt: maybe(raw.added_at),
|
|
38
38
|
session: maybe(raw.session),
|
|
39
|
-
roles: strings(raw.roles),
|
|
39
|
+
roles: raw.roles === void 0 ? ["other"] : strings(raw.roles),
|
|
40
40
|
raw
|
|
41
41
|
};
|
|
42
42
|
}
|
|
@@ -44,7 +44,7 @@ function parseMemory(value) {
|
|
|
44
44
|
const raw = object(value);
|
|
45
45
|
if (raw.type === "known") return { type: "known", text: text(raw.text), raw };
|
|
46
46
|
if (raw.type === "fact") return parseFact(raw);
|
|
47
|
-
if (raw.type === "excerpt") return parseExcerpt(raw);
|
|
47
|
+
if (raw.type === "excerpt" || raw.type === void 0) return parseExcerpt(raw);
|
|
48
48
|
return void 0;
|
|
49
49
|
}
|
|
50
50
|
function parseMemories(value) {
|
|
@@ -60,12 +60,13 @@ function refsOf(memories) {
|
|
|
60
60
|
}
|
|
61
61
|
|
|
62
62
|
// src/search.ts
|
|
63
|
+
var BREAK = /\s*[\r\n]\s*/g;
|
|
63
64
|
function line(memory) {
|
|
64
65
|
const dated = memory.type === "excerpt" && memory.date ? `${memory.date.slice(0, 10)}: ` : "";
|
|
65
|
-
return `- ${dated}${memory.text}`;
|
|
66
|
+
return `- ${dated}${memory.text.trim().replace(BREAK, " ")}`;
|
|
66
67
|
}
|
|
67
68
|
var SearchResult = class _SearchResult {
|
|
68
|
-
constructor(query, answerable, notes, memories, sources2, failed, raw) {
|
|
69
|
+
constructor(query, answerable, notes, memories, sources2, failed, raw, searchId = null) {
|
|
69
70
|
this.query = query;
|
|
70
71
|
this.answerable = answerable;
|
|
71
72
|
this.notes = notes;
|
|
@@ -73,6 +74,7 @@ var SearchResult = class _SearchResult {
|
|
|
73
74
|
this.sources = sources2;
|
|
74
75
|
this.failed = failed;
|
|
75
76
|
this.raw = raw;
|
|
77
|
+
this.searchId = searchId;
|
|
76
78
|
}
|
|
77
79
|
|
|
78
80
|
|
|
@@ -81,6 +83,7 @@ var SearchResult = class _SearchResult {
|
|
|
81
83
|
|
|
82
84
|
|
|
83
85
|
|
|
86
|
+
|
|
84
87
|
static parse(value) {
|
|
85
88
|
const raw = object(value);
|
|
86
89
|
return new _SearchResult(
|
|
@@ -90,7 +93,8 @@ var SearchResult = class _SearchResult {
|
|
|
90
93
|
parseMemories(raw.memories),
|
|
91
94
|
Array.isArray(raw.sources) ? list(raw.sources).map(object) : null,
|
|
92
95
|
false,
|
|
93
|
-
raw
|
|
96
|
+
raw,
|
|
97
|
+
maybe(raw.search_id)
|
|
94
98
|
);
|
|
95
99
|
}
|
|
96
100
|
/** What a `failOpen` client answers when memory could not be reached. */
|
|
@@ -112,7 +116,8 @@ var SearchResult = class _SearchResult {
|
|
|
112
116
|
}
|
|
113
117
|
/**
|
|
114
118
|
* The text to paste into a prompt: each note on its own line, a blank line, then each memory on
|
|
115
|
-
* its own line as `- <text>` (an excerpt with a date as `- <YYYY-MM-DD>: <text
|
|
119
|
+
* its own line as `- <text>` (an excerpt with a date as `- <YYYY-MM-DD>: <text>`; a memory's
|
|
120
|
+
* own line breaks made spaces), cut at a whole
|
|
116
121
|
* memory so it is never longer than `maxChars`. Empty when there are no memories, or when not
|
|
117
122
|
* even the first fits. The Python client and the n8n node write the same text.
|
|
118
123
|
*/
|
|
@@ -168,6 +173,21 @@ var NotFoundError = class extends AlexeinError {
|
|
|
168
173
|
};
|
|
169
174
|
var InvalidRequestError = class extends AlexeinError {
|
|
170
175
|
};
|
|
176
|
+
var QuotaExceededError = class extends AlexeinError {
|
|
177
|
+
|
|
178
|
+
|
|
179
|
+
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
constructor(message, fields = {}, body = {}) {
|
|
183
|
+
super(message, fields);
|
|
184
|
+
this.limit = maybe(body.limit);
|
|
185
|
+
this.used = maybeCount(body.used);
|
|
186
|
+
this.included = maybeCount(body.included);
|
|
187
|
+
this.resetsAt = maybe(body.resets_at);
|
|
188
|
+
this.upgrade = maybe(body.upgrade);
|
|
189
|
+
}
|
|
190
|
+
};
|
|
171
191
|
var RateLimitError = class extends AlexeinError {
|
|
172
192
|
};
|
|
173
193
|
var ServiceUnavailableError = class extends AlexeinError {
|
|
@@ -181,6 +201,7 @@ var APITimeoutError = class extends APIConnectionError {
|
|
|
181
201
|
};
|
|
182
202
|
function kindOf(status2) {
|
|
183
203
|
if (status2 === 401) return AuthenticationError;
|
|
204
|
+
if (status2 === 402) return QuotaExceededError;
|
|
184
205
|
if (status2 === 403) return PermissionDeniedError;
|
|
185
206
|
if (status2 === 404) return NotFoundError;
|
|
186
207
|
if (status2 === 429) return RateLimitError;
|
|
@@ -202,12 +223,11 @@ function errorFor(status2, body, requestId2) {
|
|
|
202
223
|
const errors = fieldErrors(_nullishCoalesce(body.errors, () => ( (Array.isArray(body.detail) ? body.detail : []))));
|
|
203
224
|
const detail = typeof body.detail === "string" ? body.detail : errors.map((e) => e.field ? `${e.field}: ${e.message}` : e.message).join("; ");
|
|
204
225
|
const Kind = kindOf(status2);
|
|
205
|
-
return new Kind(
|
|
206
|
-
|
|
207
|
-
detail,
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
});
|
|
226
|
+
return new Kind(
|
|
227
|
+
detail ? `${status2}: ${detail}` : String(status2),
|
|
228
|
+
{ status: status2, detail, errors, requestId: requestId2 },
|
|
229
|
+
body
|
|
230
|
+
);
|
|
211
231
|
}
|
|
212
232
|
function unreached(error, requestId2 = null) {
|
|
213
233
|
const name = error instanceof Error ? error.name : "";
|
|
@@ -225,7 +245,7 @@ function unreached(error, requestId2 = null) {
|
|
|
225
245
|
}
|
|
226
246
|
|
|
227
247
|
// src/version.ts
|
|
228
|
-
var VERSION = "0.3.
|
|
248
|
+
var VERSION = "0.3.3";
|
|
229
249
|
|
|
230
250
|
// src/settings.ts
|
|
231
251
|
var DEFAULT_BASE_URL = "https://api.alexein.ai";
|
|
@@ -450,6 +470,77 @@ async function* paged(page, entries) {
|
|
|
450
470
|
} while (cursor);
|
|
451
471
|
}
|
|
452
472
|
|
|
473
|
+
// src/subjects.ts
|
|
474
|
+
var parseLink = (raw) => ({
|
|
475
|
+
link: text(raw.link),
|
|
476
|
+
ref: text(raw.ref),
|
|
477
|
+
date: maybe(raw.date),
|
|
478
|
+
source: maybe(raw.source),
|
|
479
|
+
raw
|
|
480
|
+
});
|
|
481
|
+
function parseSubject(value) {
|
|
482
|
+
const raw = object(value);
|
|
483
|
+
return {
|
|
484
|
+
name: text(raw.name),
|
|
485
|
+
facts: count(raw.facts),
|
|
486
|
+
about: objects(raw.about).map((a) => ({
|
|
487
|
+
text: text(a.text),
|
|
488
|
+
refs: strings(a.refs),
|
|
489
|
+
date: null,
|
|
490
|
+
raw: a
|
|
491
|
+
})),
|
|
492
|
+
values: objects(raw.values).map((v) => ({
|
|
493
|
+
attribute: text(v.attribute),
|
|
494
|
+
value: text(v.value),
|
|
495
|
+
since: maybe(v.since),
|
|
496
|
+
negated: v.negated === true,
|
|
497
|
+
raw: v
|
|
498
|
+
})),
|
|
499
|
+
timeline: objects(raw.timeline).map(parseFact),
|
|
500
|
+
conversations: objects(raw.conversations).map((c) => ({
|
|
501
|
+
text: text(c.text),
|
|
502
|
+
refs: c.ref ? [text(c.ref)] : [],
|
|
503
|
+
date: maybe(c.date),
|
|
504
|
+
raw: c
|
|
505
|
+
})),
|
|
506
|
+
links: objects(raw.links).map(parseLink),
|
|
507
|
+
suggestions: maybeStrings(raw.suggestions),
|
|
508
|
+
raw
|
|
509
|
+
};
|
|
510
|
+
}
|
|
511
|
+
function parseRelated(value) {
|
|
512
|
+
const raw = object(value);
|
|
513
|
+
const links = objects(raw.links).map(parseLink);
|
|
514
|
+
return { links, raw, [Symbol.iterator]: () => links[Symbol.iterator]() };
|
|
515
|
+
}
|
|
516
|
+
var parseCard = (raw) => ({
|
|
517
|
+
kind: text(raw.kind),
|
|
518
|
+
text: text(raw.text),
|
|
519
|
+
refs: strings(raw.refs),
|
|
520
|
+
surface: maybe(raw.surface),
|
|
521
|
+
from: strings(raw.from),
|
|
522
|
+
raw
|
|
523
|
+
});
|
|
524
|
+
function parseWays(value) {
|
|
525
|
+
const raw = object(value);
|
|
526
|
+
return {
|
|
527
|
+
who: text(raw.who),
|
|
528
|
+
cards: objects(raw.cards).map(parseCard),
|
|
529
|
+
procedures: strings(raw.procedures),
|
|
530
|
+
voice: maybe(raw.voice),
|
|
531
|
+
raw
|
|
532
|
+
};
|
|
533
|
+
}
|
|
534
|
+
function parseLessons(value) {
|
|
535
|
+
const raw = object(value);
|
|
536
|
+
return {
|
|
537
|
+
task: text(raw.task),
|
|
538
|
+
cards: objects(raw.cards).map(parseCard),
|
|
539
|
+
lessons: objects(raw.lessons).map(parseCard),
|
|
540
|
+
raw
|
|
541
|
+
};
|
|
542
|
+
}
|
|
543
|
+
|
|
453
544
|
// src/writes.ts
|
|
454
545
|
function addResult(items2, waiting, failed, raw) {
|
|
455
546
|
return { items: items2, waiting, failed, ids: items2.map((i) => i.id), raw };
|
|
@@ -525,6 +616,19 @@ function parseDeleted(value) {
|
|
|
525
616
|
const raw = object(value);
|
|
526
617
|
return { user: text(raw.user), deleted: bool(raw.deleted), raw };
|
|
527
618
|
}
|
|
619
|
+
function parseFeedback(value) {
|
|
620
|
+
const raw = object(value);
|
|
621
|
+
return {
|
|
622
|
+
searchId: text(raw.search_id),
|
|
623
|
+
verdict: text(raw.verdict),
|
|
624
|
+
status: text(raw.status),
|
|
625
|
+
raw
|
|
626
|
+
};
|
|
627
|
+
}
|
|
628
|
+
function parseRefreshed(value) {
|
|
629
|
+
const raw = object(value);
|
|
630
|
+
return { status: text(raw.status), raw };
|
|
631
|
+
}
|
|
528
632
|
|
|
529
633
|
// src/calls.ts
|
|
530
634
|
var kinds = (kind) => kind === void 0 ? void 0 : Array.isArray(kind) ? kind : [kind];
|
|
@@ -570,7 +674,11 @@ var latest = (o) => post("latest", parseMemoriesResult, {
|
|
|
570
674
|
});
|
|
571
675
|
var around = (ref, width) => post("around", parseMemoriesResult, { ref, width });
|
|
572
676
|
var open = (ref) => post("open", parseOpened, { ref });
|
|
573
|
-
var
|
|
677
|
+
var subject = (name, limit) => post("subject", parseSubject, { name, limit });
|
|
678
|
+
var related = (ref) => post("related", parseRelated, { ref });
|
|
679
|
+
var howTheyWork = (o) => post("how_they_work", parseWays, { who: o.who, surface: o.surface });
|
|
680
|
+
var lessons = (task) => post("lessons", parseLessons, { task });
|
|
681
|
+
var history = (subject2, attribute) => post("history", parseHistory, { subject: subject2, attribute });
|
|
574
682
|
var summary = () => post("summary", parseSummary);
|
|
575
683
|
var facts = (o) => post("facts", parseFactsPage, { limit: o.limit, cursor: o.cursor });
|
|
576
684
|
var openItems = (o) => post("open_items", parseOpenItems, {
|
|
@@ -597,6 +705,11 @@ function forget(named) {
|
|
|
597
705
|
return post("forget", parseForgotten, body);
|
|
598
706
|
}
|
|
599
707
|
var correct = (ref, replacement) => post("correct", parseCorrection, { ref, replacement });
|
|
708
|
+
function feedback(searchId, verdict, note) {
|
|
709
|
+
if (!searchId) throw new RangeError("feedback needs the searchId a search answered with");
|
|
710
|
+
return post("feedback", parseFeedback, { search_id: searchId, verdict, note });
|
|
711
|
+
}
|
|
712
|
+
var refresh = () => post("refresh", parseRefreshed);
|
|
600
713
|
var versions = (id) => post("versions", parseVersions, { id });
|
|
601
714
|
var exportPage = (o) => post("export", parseExportPage, { limit: o.limit, cursor: o.cursor });
|
|
602
715
|
|
|
@@ -614,6 +727,11 @@ function batches(items2, options) {
|
|
|
614
727
|
const { wait, redact, ...fields } = options;
|
|
615
728
|
const defaults = compact(fields);
|
|
616
729
|
const given = typeof items2 === "string" || !Array.isArray(items2) ? [items2] : items2;
|
|
730
|
+
if (fields.id !== void 0 && fields.id !== null && given.length > 1) {
|
|
731
|
+
throw new RangeError(
|
|
732
|
+
"id names one item, and this add has several: give each item its own id instead"
|
|
733
|
+
);
|
|
734
|
+
}
|
|
617
735
|
const shaped = given.map((item2) => shape(item2, defaults));
|
|
618
736
|
if (!shaped.length) return [];
|
|
619
737
|
const call = crypto.randomUUID();
|
|
@@ -684,9 +802,34 @@ var User = class {
|
|
|
684
802
|
open(ref) {
|
|
685
803
|
return this.send(open(ref));
|
|
686
804
|
}
|
|
805
|
+
/**
|
|
806
|
+
* One person or thing by name, whole: how it went, its values now, its facts in the order they
|
|
807
|
+
* were said, the conversations about it, and how it relates to others.
|
|
808
|
+
*/
|
|
809
|
+
subject(name, options = {}) {
|
|
810
|
+
return this.send(subject(name, options.limit));
|
|
811
|
+
}
|
|
812
|
+
/** What the people and things one fact or excerpt names link to, by its ref. */
|
|
813
|
+
related(ref) {
|
|
814
|
+
return this.send(related(ref));
|
|
815
|
+
}
|
|
816
|
+
/**
|
|
817
|
+
* How the person works - their routines before an action and how they write on each `surface` -
|
|
818
|
+
* for an agent about to act or write for them. `who` names someone else.
|
|
819
|
+
*/
|
|
820
|
+
howTheyWork(options = {}) {
|
|
821
|
+
return this.send(howTheyWork(options));
|
|
822
|
+
}
|
|
823
|
+
/**
|
|
824
|
+
* What an assistant should know before `task`: how the person corrected assistants and the notes
|
|
825
|
+
* they left on answers, most like it first.
|
|
826
|
+
*/
|
|
827
|
+
lessons(task) {
|
|
828
|
+
return this.send(lessons(task));
|
|
829
|
+
}
|
|
687
830
|
/** Every value a subject was stated to have, by attribute, oldest first. */
|
|
688
|
-
history(
|
|
689
|
-
return this.send(history(
|
|
831
|
+
history(subject2, options = {}) {
|
|
832
|
+
return this.send(history(subject2, options.attribute));
|
|
690
833
|
}
|
|
691
834
|
/** This memory in brief: its items, their span, the connected sources and the known lines. */
|
|
692
835
|
summary() {
|
|
@@ -738,6 +881,22 @@ var User = class {
|
|
|
738
881
|
correct(ref, replacement) {
|
|
739
882
|
return this.send(correct(ref, replacement));
|
|
740
883
|
}
|
|
884
|
+
/**
|
|
885
|
+
* Say how a search went - `wrong`, `missing` or `ok` - by its result or its `searchId`, and
|
|
886
|
+
* optionally what was true, so memory answers questions like it better. Kept as a note of this
|
|
887
|
+
* memory. Takes a key that writes.
|
|
888
|
+
*/
|
|
889
|
+
async feedback(search2, verdict, options = {}) {
|
|
890
|
+
const searchId = typeof search2 === "string" ? search2 : search2.searchId;
|
|
891
|
+
return this.send(feedback(searchId, verdict, options.note));
|
|
892
|
+
}
|
|
893
|
+
/**
|
|
894
|
+
* Ask memory to bring what it has gathered of this app user up to date soon - after a large
|
|
895
|
+
* import, say. Once an hour per app user. Takes a key that writes.
|
|
896
|
+
*/
|
|
897
|
+
refresh() {
|
|
898
|
+
return this.send(refresh());
|
|
899
|
+
}
|
|
741
900
|
/** Every version of one added item, oldest first. Takes a key that writes. */
|
|
742
901
|
versions(itemId) {
|
|
743
902
|
return this.send(versions(itemId));
|
|
@@ -917,4 +1076,5 @@ var Memory = class {
|
|
|
917
1076
|
|
|
918
1077
|
|
|
919
1078
|
|
|
920
|
-
|
|
1079
|
+
|
|
1080
|
+
exports.SearchResult = SearchResult; exports.AlexeinError = AlexeinError; exports.AuthenticationError = AuthenticationError; exports.PermissionDeniedError = PermissionDeniedError; exports.NotFoundError = NotFoundError; exports.InvalidRequestError = InvalidRequestError; exports.QuotaExceededError = QuotaExceededError; exports.RateLimitError = RateLimitError; exports.ServiceUnavailableError = ServiceUnavailableError; exports.APIConnectionError = APIConnectionError; exports.APITimeoutError = APITimeoutError; exports.VERSION = VERSION; exports.DEFAULT_BASE_URL = DEFAULT_BASE_URL; exports.DEFAULT_TIMEOUT_MS = DEFAULT_TIMEOUT_MS; exports.DEFAULT_RETRIES = DEFAULT_RETRIES; exports.User = User; exports.Memory = Memory;
|