@agentshouse/mdruntime 0.1.0-c0bed82db8d73 → 0.1.0-c0c1e81da9166
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/README.md +3 -2
- package/dist/adapter.d.ts +101 -71
- package/dist/adapter.d.ts.map +1 -1
- package/dist/attached-model.d.ts +4 -10
- package/dist/attached-model.d.ts.map +1 -1
- package/dist/attached-model.js +35 -46
- package/dist/bootstrap.d.ts +16 -15
- package/dist/bootstrap.d.ts.map +1 -1
- package/dist/bootstrap.js +273 -131
- package/dist/chain.d.ts +2 -1
- package/dist/chain.d.ts.map +1 -1
- package/dist/change.d.ts +1 -0
- package/dist/change.d.ts.map +1 -1
- package/dist/chat-types.d.ts +3 -0
- package/dist/chat-types.d.ts.map +1 -0
- package/dist/chat-types.js +2 -0
- package/dist/client.d.ts +15 -9
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +54 -6
- package/dist/collection.d.ts +7 -4
- package/dist/collection.d.ts.map +1 -1
- package/dist/collection.js +24 -19
- package/dist/compile.d.ts +6 -6
- package/dist/compile.d.ts.map +1 -1
- package/dist/compile.js +278 -282
- package/dist/connection.d.ts +16 -11
- package/dist/connection.d.ts.map +1 -1
- package/dist/connection.js +2312 -1988
- package/dist/context.d.ts +2 -0
- package/dist/context.d.ts.map +1 -0
- package/dist/context.js +7 -0
- package/dist/conversation-row.d.ts +33 -0
- package/dist/conversation-row.d.ts.map +1 -0
- package/dist/conversation-row.js +47 -0
- package/dist/conversation.d.ts +27 -18
- package/dist/conversation.d.ts.map +1 -1
- package/dist/conversation.js +489 -260
- package/dist/durability.d.ts +6 -1
- package/dist/durability.d.ts.map +1 -1
- package/dist/entry.d.ts +3 -2
- package/dist/entry.d.ts.map +1 -1
- package/dist/entry.js +18 -8
- package/dist/figures.d.ts +48 -0
- package/dist/figures.d.ts.map +1 -0
- package/dist/figures.js +197 -0
- package/dist/file.d.ts +2 -11
- package/dist/file.d.ts.map +1 -1
- package/dist/file.js +6 -4
- package/dist/host.d.ts +3 -7
- package/dist/host.d.ts.map +1 -1
- package/dist/host.js +26 -29
- package/dist/identity.d.ts +0 -1
- package/dist/identity.d.ts.map +1 -1
- package/dist/identity.js +0 -3
- package/dist/index.d.ts +16 -9
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -1
- package/dist/job.d.ts +33 -0
- package/dist/job.d.ts.map +1 -0
- package/dist/job.js +54 -0
- package/dist/live.d.ts +5 -4
- package/dist/live.d.ts.map +1 -1
- package/dist/live.js +62 -20
- package/dist/media.d.ts +8 -0
- package/dist/media.d.ts.map +1 -0
- package/dist/media.js +218 -0
- package/dist/memory.d.ts +13 -6
- package/dist/memory.d.ts.map +1 -1
- package/dist/memory.js +218 -91
- package/dist/messages.d.ts +27 -3
- package/dist/messages.d.ts.map +1 -1
- package/dist/messages.js +97 -19
- package/dist/model.d.ts +8 -10
- package/dist/model.d.ts.map +1 -1
- package/dist/model.js +6 -18
- package/dist/observation.d.ts +3 -2
- package/dist/observation.d.ts.map +1 -1
- package/dist/observation.js +8 -3
- package/dist/outcome.d.ts +13 -5
- package/dist/outcome.d.ts.map +1 -1
- package/dist/outcome.js +16 -2
- package/dist/overlay.d.ts +1 -0
- package/dist/overlay.d.ts.map +1 -1
- package/dist/overlay.js +11 -0
- package/dist/parts.d.ts +59 -0
- package/dist/parts.d.ts.map +1 -0
- package/dist/parts.js +118 -0
- package/dist/paths.d.ts +1 -0
- package/dist/paths.d.ts.map +1 -1
- package/dist/paths.js +4 -0
- package/dist/query.d.ts +18 -207
- package/dist/query.d.ts.map +1 -1
- package/dist/query.js +3 -505
- package/dist/questions.d.ts +32 -0
- package/dist/questions.d.ts.map +1 -0
- package/dist/questions.js +118 -0
- package/dist/reach.d.ts +18 -11
- package/dist/reach.d.ts.map +1 -1
- package/dist/reach.js +201 -126
- package/dist/react.d.ts +3 -1
- package/dist/react.d.ts.map +1 -1
- package/dist/read.d.ts +7 -0
- package/dist/read.d.ts.map +1 -0
- package/dist/read.js +17 -0
- package/dist/readiness.d.ts +3 -17
- package/dist/readiness.d.ts.map +1 -1
- package/dist/readiness.js +4 -10
- package/dist/recovery.d.ts +1 -0
- package/dist/recovery.d.ts.map +1 -1
- package/dist/recovery.js +35 -1
- package/dist/refresh.d.ts +7 -5
- package/dist/refresh.d.ts.map +1 -1
- package/dist/refresh.js +34 -10
- package/dist/replica.d.ts +10 -9
- package/dist/replica.d.ts.map +1 -1
- package/dist/replica.js +53 -21
- package/dist/room-draft.d.ts +21 -5
- package/dist/room-draft.d.ts.map +1 -1
- package/dist/room-draft.js +98 -51
- package/dist/rows.d.ts +18 -16
- package/dist/rows.d.ts.map +1 -1
- package/dist/rows.js +45 -153
- package/dist/save.d.ts +2 -0
- package/dist/save.d.ts.map +1 -1
- package/dist/save.js +22 -13
- package/dist/search.d.ts +12 -63
- package/dist/search.d.ts.map +1 -1
- package/dist/search.js +9 -52
- package/dist/shared.d.ts +0 -1
- package/dist/shared.d.ts.map +1 -1
- package/dist/shared.js +0 -10
- package/dist/source.d.ts +61 -0
- package/dist/source.d.ts.map +1 -0
- package/dist/source.js +81 -0
- package/dist/status.d.ts +4 -5
- package/dist/status.d.ts.map +1 -1
- package/dist/status.js +3 -7
- package/dist/store.d.ts +104 -62
- package/dist/store.d.ts.map +1 -1
- package/dist/store.js +159 -161
- package/dist/stored.d.ts +66 -55
- package/dist/stored.d.ts.map +1 -1
- package/dist/stored.js +343 -273
- package/dist/tables.d.ts +110 -65
- package/dist/tables.d.ts.map +1 -1
- package/dist/tables.js +188 -99
- package/dist/tallies.d.ts +18 -0
- package/dist/tallies.d.ts.map +1 -0
- package/dist/tallies.js +129 -0
- package/dist/transfer.d.ts +0 -5
- package/dist/transfer.d.ts.map +1 -1
- package/dist/validation.d.ts +3 -4
- package/dist/validation.d.ts.map +1 -1
- package/dist/validation.js +42 -100
- package/dist/windows.d.ts +1 -12
- package/dist/windows.d.ts.map +1 -1
- package/dist/windows.js +2 -75
- package/dist/wire.d.ts +18 -8
- package/dist/wire.d.ts.map +1 -1
- package/dist/wire.js +6 -2
- package/package.json +2 -3
- package/AGENTS.md +0 -312
- package/dist/fence.d.ts +0 -6
- package/dist/fence.d.ts.map +0 -1
- package/dist/fence.js +0 -10
- package/dist/fulltext.d.ts +0 -27
- package/dist/fulltext.d.ts.map +0 -1
- package/dist/fulltext.js +0 -368
- package/dist/reads.d.ts +0 -11
- package/dist/reads.d.ts.map +0 -1
- package/dist/reads.js +0 -100
- package/dist/words.d.ts +0 -19
- package/dist/words.d.ts.map +0 -1
- package/dist/words.js +0 -150
package/dist/save.d.ts
CHANGED
|
@@ -21,6 +21,7 @@ export type SaveInput = {
|
|
|
21
21
|
providerOwnedPaths: readonly string[];
|
|
22
22
|
providerLimits: readonly ProviderLimit[];
|
|
23
23
|
visible: VisibleLayer;
|
|
24
|
+
folders: ReadonlySet<string>;
|
|
24
25
|
handle: string;
|
|
25
26
|
changes: readonly Change[];
|
|
26
27
|
bases: readonly Precondition[];
|
|
@@ -75,6 +76,7 @@ export type MoveSide = {
|
|
|
75
76
|
operations: OperationScopes;
|
|
76
77
|
providerOwnedPaths: readonly string[];
|
|
77
78
|
visible: VisibleLayer;
|
|
79
|
+
folders: ReadonlySet<string>;
|
|
78
80
|
queued: ReadonlySet<string>;
|
|
79
81
|
unmodeled: boolean;
|
|
80
82
|
validate: Validator;
|
package/dist/save.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"save.d.ts","sourceRoot":"","sources":["../src/save.ts"],"names":[],"mappings":"AACA,OAAO,EAkBL,KAAK,UAAU,EAChB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AACnE,OAAO,EAKL,KAAK,MAAM,EACX,KAAK,WAAW,EAChB,KAAK,YAAY,EAEjB,KAAK,SAAS,EACf,MAAM,aAAa,CAAC;AACrB,OAAO,EAKL,KAAK,WAAW,E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,SAAS;QAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IACjE,cAAc,EAAE,SAAS,aAAa,EAAE,CAAC;IACzC,KAAK,EAAE,OAAO,CAAC;IACf,SAAS,CAAC,EAAE,SAAS,CAAC;CACvB,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,OAAO,EAAE,WAAW,CAAC;IAAC,QAAQ,EAAE,WAAW,CAAA;CAAE,GAAG,QAAQ,CAAC;AAoInG,wBAAgB,SAAS,CAAC,KAAK,EAAE,SAAS,GAAG,OAAO,CAAC,UAAU,CAAC,CAE/D;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,SAAS,GAAG,OAAO,CAAC,WAAW,CAAC,CAEjE"}
|
package/dist/save.js
CHANGED
|
@@ -4,7 +4,7 @@ import { immutable, leaving, queuedFile, departure, } from './change.js';
|
|
|
4
4
|
import { collectionOf, documentsOf, governing, } from './collection.js';
|
|
5
5
|
import { changeBatchIdentity } from './identity.js';
|
|
6
6
|
import { overlaying } from './overlay.js';
|
|
7
|
-
import { covered, normalize } from './paths.js';
|
|
7
|
+
import { ancestors, covered, normalize } from './paths.js';
|
|
8
8
|
import { sorting } from './shared.js';
|
|
9
9
|
import { paced, ROW_WEIGHT, stepped } from './turn.js';
|
|
10
10
|
import { validatedCollection } from './validation.js';
|
|
@@ -321,6 +321,8 @@ function* incoming(collection, removed, candidates) {
|
|
|
321
321
|
function affected(change) {
|
|
322
322
|
return change.kind === 'move' ? [change.path, change.to] : [change.path];
|
|
323
323
|
}
|
|
324
|
+
const WRITE = ['write'];
|
|
325
|
+
const MOVE_OUT = ['write', 'erase'];
|
|
324
326
|
function guard(changes, input, removing) {
|
|
325
327
|
const overridden = new Map();
|
|
326
328
|
const existing = {
|
|
@@ -329,6 +331,7 @@ function guard(changes, input, removing) {
|
|
|
329
331
|
add: (path) => void overridden.set(path, true),
|
|
330
332
|
delete: (path) => void overridden.set(path, false),
|
|
331
333
|
};
|
|
334
|
+
const occupied = (path) => input.folders.has(path) ? path : (ancestors(path).find((one) => existing.has(one)) ?? null);
|
|
332
335
|
for (const [index, change] of changes.entries()) {
|
|
333
336
|
for (const path of affected(change)) {
|
|
334
337
|
const normalized = normalize(path);
|
|
@@ -337,13 +340,14 @@ function guard(changes, input, removing) {
|
|
|
337
340
|
if (covered(input.providerOwnedPaths, normalized)) {
|
|
338
341
|
return refuse('provider-owned-path', normalized);
|
|
339
342
|
}
|
|
340
|
-
const operation
|
|
341
|
-
|
|
342
|
-
|
|
343
|
+
for (const operation of change.kind === 'remove' ? removing : WRITE)
|
|
344
|
+
if (!input.local && !covered(input.operations[operation], normalized))
|
|
345
|
+
return refuse(`${operation}-grant`, normalized);
|
|
343
346
|
}
|
|
344
347
|
if (change.kind === 'create' || change.kind === 'arrival') {
|
|
345
|
-
|
|
346
|
-
|
|
348
|
+
const taken = existing.has(change.path) ? change.path : occupied(change.path);
|
|
349
|
+
if (taken !== null)
|
|
350
|
+
return refuse('path-collision', taken);
|
|
347
351
|
existing.add(change.path);
|
|
348
352
|
continue;
|
|
349
353
|
}
|
|
@@ -353,6 +357,9 @@ function guard(changes, input, removing) {
|
|
|
353
357
|
input.bases.some((base) => base.kind === 'absent' && base.path === change.path))) {
|
|
354
358
|
return refuse('path-collision', change.path);
|
|
355
359
|
}
|
|
360
|
+
const taken = occupied(change.path);
|
|
361
|
+
if (taken !== null)
|
|
362
|
+
return refuse('path-collision', taken);
|
|
356
363
|
if (!input.local &&
|
|
357
364
|
existing.has(change.path) &&
|
|
358
365
|
input.visible.revisions[departure(changes, index)] === undefined) {
|
|
@@ -364,8 +371,9 @@ function guard(changes, input, removing) {
|
|
|
364
371
|
if (change.kind === 'move') {
|
|
365
372
|
if (!existing.has(change.path))
|
|
366
373
|
return refuse('path-absent', change.path);
|
|
367
|
-
|
|
368
|
-
|
|
374
|
+
const taken = existing.has(change.to) ? change.to : occupied(change.to);
|
|
375
|
+
if (taken !== null)
|
|
376
|
+
return refuse('path-collision', taken);
|
|
369
377
|
if (unrevised(input, change.path)) {
|
|
370
378
|
return refuse('unknown-revision', change.path);
|
|
371
379
|
}
|
|
@@ -968,7 +976,7 @@ function roomReferencesIn(path, content, composition) {
|
|
|
968
976
|
const parsed = parse(content, path);
|
|
969
977
|
if (!parsed.ok)
|
|
970
978
|
return [];
|
|
971
|
-
return roomReferences(
|
|
979
|
+
return roomReferences(parsed.document, definitionOf(governing(composition, path), parsed.document.type));
|
|
972
980
|
}
|
|
973
981
|
function* admittedRooms(changes, visible, resulting, composition) {
|
|
974
982
|
const from = new Map();
|
|
@@ -1014,7 +1022,7 @@ async function batching(input) {
|
|
|
1014
1022
|
const rewritten = await stepped(rewrites(changes, input.visible));
|
|
1015
1023
|
if (rewritten.kind === 'refused')
|
|
1016
1024
|
return rewritten;
|
|
1017
|
-
const refusal = guard(changes, input,
|
|
1025
|
+
const refusal = guard(changes, input, WRITE);
|
|
1018
1026
|
if (refusal !== null)
|
|
1019
1027
|
return refusal;
|
|
1020
1028
|
const preconditions = await stepped(preconditionsOf(changes, input.visible, input.bases));
|
|
@@ -1063,9 +1071,10 @@ function arrivingText(path, to, source, moved) {
|
|
|
1063
1071
|
return applied.outcome === 'applied' ? serialize(applied.document) : content;
|
|
1064
1072
|
}
|
|
1065
1073
|
function arrivalOf({ path, to }, source, moved) {
|
|
1066
|
-
const { documents, revisions, fileIds, changes, binaries } = source.visible;
|
|
1074
|
+
const { documents, revisions, fileIds, created, changes, binaries } = source.visible;
|
|
1067
1075
|
const kept = {
|
|
1068
1076
|
...(fileIds[path] === undefined ? {} : { fileId: fileIds[path] }),
|
|
1077
|
+
...(created[path] === undefined ? {} : { created: created[path] }),
|
|
1069
1078
|
...(changes[path] === undefined ? {} : { change: changes[path] }),
|
|
1070
1079
|
};
|
|
1071
1080
|
const heads = {
|
|
@@ -1095,7 +1104,7 @@ async function moving(input) {
|
|
|
1095
1104
|
if (moves.length === 0)
|
|
1096
1105
|
return refuse('no-change');
|
|
1097
1106
|
const removals = moves.map(({ path }) => ({ kind: 'remove', path }));
|
|
1098
|
-
const leaves = guard(removals, { ...source, local: input.local, bases: [] },
|
|
1107
|
+
const leaves = guard(removals, { ...source, local: input.local, bases: [] }, MOVE_OUT);
|
|
1099
1108
|
if (leaves !== null)
|
|
1100
1109
|
return leaves;
|
|
1101
1110
|
const uploading = moves.find(({ path }) => source.visible.binaries[path]?.state === 'pending');
|
|
@@ -1103,7 +1112,7 @@ async function moving(input) {
|
|
|
1103
1112
|
return refuse('unknown-revision', uploading.path);
|
|
1104
1113
|
const moved = new Map(moves.map(({ path, to }) => [path, to]));
|
|
1105
1114
|
const arrivals = moves.map((move) => arrivalOf(move, source, moved));
|
|
1106
|
-
const arrives = guard(arrivals, { ...destination, local: input.local, bases: [] },
|
|
1115
|
+
const arrives = guard(arrivals, { ...destination, local: input.local, bases: [] }, WRITE);
|
|
1107
1116
|
if (arrives !== null)
|
|
1108
1117
|
return arrives;
|
|
1109
1118
|
const bound = input.providerLimits.find((limit) => limit.name === MOVE_DOCUMENTS)?.value;
|
package/dist/search.d.ts
CHANGED
|
@@ -1,73 +1,22 @@
|
|
|
1
|
-
import type { ProviderRefusal } from './adapter.js';
|
|
2
|
-
import
|
|
3
|
-
import type { Open } from './open.js';
|
|
4
|
-
export type DocumentPart = Open<'fields' | 'sections' | 'preamble' | 'path'>;
|
|
1
|
+
import type { ProviderRefusal, SearchHit } from './adapter.js';
|
|
2
|
+
import type { Failure, Offline } from './outcome.js';
|
|
5
3
|
export type SearchRequest = {
|
|
6
4
|
text: string;
|
|
7
|
-
|
|
8
|
-
collection?: true;
|
|
9
|
-
conversations?: readonly string[];
|
|
10
|
-
limit?: number;
|
|
11
|
-
after?: string;
|
|
12
|
-
total?: true;
|
|
5
|
+
rooms?: readonly string[];
|
|
13
6
|
};
|
|
14
|
-
export type
|
|
15
|
-
export type
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
at: readonly [number, number];
|
|
19
|
-
};
|
|
20
|
-
export type DocumentHit = {
|
|
21
|
-
room: string;
|
|
22
|
-
path: string;
|
|
23
|
-
type: string;
|
|
24
|
-
score: number;
|
|
25
|
-
matches: Readonly<Record<string, readonly DocumentPart[]>>;
|
|
26
|
-
snippet?: Snippet<DocumentPart>;
|
|
27
|
-
};
|
|
28
|
-
export type MessageHit = {
|
|
29
|
-
conversation: string;
|
|
30
|
-
identity: string;
|
|
31
|
-
score: number;
|
|
32
|
-
matches: Readonly<Record<string, readonly MessagePart[]>>;
|
|
33
|
-
snippet?: Snippet<MessagePart>;
|
|
34
|
-
};
|
|
35
|
-
export type SearchCoverage = {
|
|
36
|
-
rooms: readonly CoveredRoom[];
|
|
37
|
-
conversations: readonly string[];
|
|
38
|
-
overlay: readonly string[];
|
|
7
|
+
export type { SearchHit } from './adapter.js';
|
|
8
|
+
export type SearchFound = {
|
|
9
|
+
kind: 'found';
|
|
10
|
+
documents: readonly SearchHit[];
|
|
39
11
|
};
|
|
40
|
-
export type
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
};
|
|
44
|
-
export type SearchWindow = SearchHits & {
|
|
45
|
-
next?: string;
|
|
46
|
-
total?: {
|
|
47
|
-
documents: number;
|
|
48
|
-
messages: number;
|
|
49
|
-
};
|
|
50
|
-
};
|
|
51
|
-
export type SearchPending = SearchHits & {
|
|
52
|
-
pending: readonly PendingRoom[];
|
|
53
|
-
coverage: SearchCoverage;
|
|
54
|
-
};
|
|
55
|
-
export type SearchUndeclared = ProviderRefusal & {
|
|
12
|
+
export type SearchResult = SearchFound | Offline | (ProviderRefusal & {
|
|
13
|
+
kind: 'rejected';
|
|
14
|
+
}) | (ProviderRefusal & {
|
|
56
15
|
kind: 'undeclared';
|
|
57
|
-
};
|
|
58
|
-
export type SearchResult = (SearchWindow & {
|
|
59
|
-
coverage: SearchCoverage;
|
|
60
|
-
}) | SearchPending | SearchUndeclared;
|
|
61
|
-
export declare function undeclaredSearch(): SearchUndeclared;
|
|
62
|
-
export type HitCursor = readonly [number, string, string] | readonly [] | null;
|
|
16
|
+
}) | Failure;
|
|
63
17
|
export type SearchPlan = {
|
|
64
18
|
text: string;
|
|
65
|
-
|
|
66
|
-
collection: boolean;
|
|
67
|
-
conversations: readonly string[] | null;
|
|
68
|
-
limit: number | null;
|
|
69
|
-
after: readonly [HitCursor, HitCursor] | null;
|
|
70
|
-
total: boolean;
|
|
19
|
+
rooms: readonly string[] | null;
|
|
71
20
|
};
|
|
72
21
|
export declare function searchPlanOf(input: unknown): SearchPlan;
|
|
73
22
|
//# sourceMappingURL=search.d.ts.map
|
package/dist/search.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"search.d.ts","sourceRoot":"","sources":["../src/search.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"search.d.ts","sourceRoot":"","sources":["../src/search.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC/D,OAAO,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAErD,MAAM,MAAM,aAAa,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;CAAE,CAAC;AAExE,YAAY,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAE9C,MAAM,MAAM,WAAW,GAAG;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,SAAS,EAAE,SAAS,SAAS,EAAE,CAAA;CAAE,CAAC;AAE7E,MAAM,MAAM,YAAY,GACpB,WAAW,GACX,OAAO,GACP,CAAC,eAAe,GAAG;IAAE,IAAI,EAAE,UAAU,CAAA;CAAE,CAAC,GACxC,CAAC,eAAe,GAAG;IAAE,IAAI,EAAE,YAAY,CAAA;CAAE,CAAC,GAC1C,OAAO,CAAC;AAEZ,MAAM,MAAM,UAAU,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,SAAS,MAAM,EAAE,GAAG,IAAI,CAAA;CAAE,CAAC;AAE3E,wBAAgB,YAAY,CAAC,KAAK,EAAE,OAAO,GAAG,UAAU,CAYvD"}
|
package/dist/search.js
CHANGED
|
@@ -1,57 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { decodedCursor } from './windows.js';
|
|
3
|
-
export function undeclaredSearch() {
|
|
4
|
-
return {
|
|
5
|
-
kind: 'undeclared',
|
|
6
|
-
code: 'search-undeclared',
|
|
7
|
-
fields: { name: 'local_search' },
|
|
8
|
-
retryable: false,
|
|
9
|
-
};
|
|
10
|
-
}
|
|
11
|
-
function hitCursor(input) {
|
|
12
|
-
if (input === null)
|
|
13
|
-
return null;
|
|
14
|
-
if (!Array.isArray(input))
|
|
15
|
-
return undefined;
|
|
16
|
-
if (input.length === 0)
|
|
17
|
-
return [];
|
|
18
|
-
const [score, first, second] = input;
|
|
19
|
-
return input.length === 3 &&
|
|
20
|
-
typeof score === 'number' &&
|
|
21
|
-
typeof first === 'string' &&
|
|
22
|
-
typeof second === 'string'
|
|
23
|
-
? [score, first, second]
|
|
24
|
-
: undefined;
|
|
25
|
-
}
|
|
26
|
-
function searchAfter(input) {
|
|
27
|
-
if (input === undefined)
|
|
28
|
-
return null;
|
|
29
|
-
const decoded = typeof input === 'string' ? decodedCursor(input) : null;
|
|
30
|
-
const documents = decoded?.length === 2 ? hitCursor(decoded[0]) : undefined;
|
|
31
|
-
const messages = decoded?.length === 2 ? hitCursor(decoded[1]) : undefined;
|
|
32
|
-
if (documents === undefined || messages === undefined) {
|
|
33
|
-
invalid('after', 'expects the next an earlier search returned');
|
|
34
|
-
}
|
|
35
|
-
return [documents, messages];
|
|
36
|
-
}
|
|
1
|
+
import { invalid, known, plain } from '@agentshouse/mdmodel';
|
|
37
2
|
export function searchPlanOf(input) {
|
|
38
3
|
if (!plain(input))
|
|
39
4
|
invalid('search', 'expects a search object');
|
|
40
|
-
known(input, ['text', '
|
|
41
|
-
if (typeof input.text !== 'string')
|
|
42
|
-
invalid('text', 'expects
|
|
43
|
-
const
|
|
44
|
-
if (
|
|
45
|
-
(!Array.isArray(
|
|
46
|
-
invalid('
|
|
5
|
+
known(input, ['text', 'rooms'], '');
|
|
6
|
+
if (typeof input.text !== 'string' || input.text.trim() === '')
|
|
7
|
+
invalid('text', 'expects words');
|
|
8
|
+
const rooms = input.rooms;
|
|
9
|
+
if (rooms !== undefined &&
|
|
10
|
+
(!Array.isArray(rooms) || rooms.some((named) => typeof named !== 'string'))) {
|
|
11
|
+
invalid('rooms', 'expects a list of Rooms');
|
|
47
12
|
}
|
|
48
|
-
return {
|
|
49
|
-
text: input.text,
|
|
50
|
-
documents: input.documents,
|
|
51
|
-
collection: flag(input.collection, 'collection'),
|
|
52
|
-
conversations: conversations ?? null,
|
|
53
|
-
limit: limitOf(input.limit),
|
|
54
|
-
after: searchAfter(input.after),
|
|
55
|
-
total: flag(input.total, 'total'),
|
|
56
|
-
};
|
|
13
|
+
return { text: input.text, rooms: rooms ?? null };
|
|
57
14
|
}
|
package/dist/shared.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
export type Paths<V> = Readonly<Record<string, V>>;
|
|
2
2
|
export declare function entriesIn<V>(map: Paths<V>): Generator<readonly [string, V]>;
|
|
3
|
-
export declare function keysIn(...maps: readonly Paths<unknown>[]): Generator<number, Set<string>, void>;
|
|
4
3
|
export declare function sortedKeys(map: Paths<unknown>): Generator<number, readonly string[], void>;
|
|
5
4
|
export declare function sorting(keys: Iterable<string>): Generator<number, readonly string[], void>;
|
|
6
5
|
export declare function sharing<V>(map: Paths<V>): Generator<number, Paths<V>, void>;
|
package/dist/shared.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../src/shared.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,K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AAC,EAAE,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,GAAG,SAAS,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,CAUxF"}
|
package/dist/shared.js
CHANGED
|
@@ -202,16 +202,6 @@ function* rooted(map) {
|
|
|
202
202
|
}
|
|
203
203
|
return { node, size };
|
|
204
204
|
}
|
|
205
|
-
export function* keysIn(...maps) {
|
|
206
|
-
const keys = new Set();
|
|
207
|
-
for (const map of maps) {
|
|
208
|
-
for (const [key] of entriesIn(map)) {
|
|
209
|
-
keys.add(key);
|
|
210
|
-
yield ROW_WEIGHT;
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
return keys;
|
|
214
|
-
}
|
|
215
205
|
const RUN = 1 << 10;
|
|
216
206
|
function* merged(left, right) {
|
|
217
207
|
const into = [];
|
package/dist/source.d.ts
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
export type HouseSource = {
|
|
2
|
+
readonly kind: 'request';
|
|
3
|
+
readonly request: string;
|
|
4
|
+
readonly agentFunction: RequestAgentFunction | null;
|
|
5
|
+
readonly requester: {
|
|
6
|
+
readonly name: string;
|
|
7
|
+
readonly room: boolean;
|
|
8
|
+
};
|
|
9
|
+
readonly room: {
|
|
10
|
+
readonly ref: string;
|
|
11
|
+
readonly name: string;
|
|
12
|
+
};
|
|
13
|
+
readonly approved: string | null;
|
|
14
|
+
} | {
|
|
15
|
+
readonly kind: 'mail';
|
|
16
|
+
readonly request: string;
|
|
17
|
+
readonly room: string;
|
|
18
|
+
readonly report: boolean;
|
|
19
|
+
readonly agent: string;
|
|
20
|
+
readonly owner: string;
|
|
21
|
+
readonly approved: string | null;
|
|
22
|
+
readonly declined: string | null;
|
|
23
|
+
} | {
|
|
24
|
+
readonly kind: 'trigger';
|
|
25
|
+
readonly customer: boolean;
|
|
26
|
+
readonly trigger: string;
|
|
27
|
+
readonly room: {
|
|
28
|
+
readonly ref: string;
|
|
29
|
+
readonly name: string;
|
|
30
|
+
};
|
|
31
|
+
} | {
|
|
32
|
+
readonly kind: 'conversation';
|
|
33
|
+
readonly conversation: {
|
|
34
|
+
readonly id: string;
|
|
35
|
+
readonly name: string;
|
|
36
|
+
};
|
|
37
|
+
readonly agent: string;
|
|
38
|
+
} | {
|
|
39
|
+
readonly kind: 'declined';
|
|
40
|
+
readonly agent: string;
|
|
41
|
+
readonly owner: string;
|
|
42
|
+
};
|
|
43
|
+
export type ChatRequest = {
|
|
44
|
+
readonly request: string;
|
|
45
|
+
readonly room: string;
|
|
46
|
+
readonly message?: string;
|
|
47
|
+
};
|
|
48
|
+
export type ChatRoomRequest = {
|
|
49
|
+
readonly request: string;
|
|
50
|
+
readonly room: {
|
|
51
|
+
readonly ref: string;
|
|
52
|
+
readonly name: string;
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
type RequestAgentFunction = {
|
|
56
|
+
readonly name: string;
|
|
57
|
+
readonly version: number;
|
|
58
|
+
};
|
|
59
|
+
export declare function sourceOf(value: unknown, sender: string | null): HouseSource | null;
|
|
60
|
+
export {};
|
|
61
|
+
//# sourceMappingURL=source.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"source.d.ts","sourceRoot":"","sources":["../src/source.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,WAAW,GACnB;IACE,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;IACzB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,aAAa,EAAE,oBAAoB,GAAG,IAAI,CAAC;IACpD,QAAQ,CAAC,SAAS,EAAE;QAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAA;KAAE,CAAC;IACtE,QAAQ,CAAC,IAAI,EAAE;QAAE,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,IAAI,EAAE,MAA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tB,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;CAC3B,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC5B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,IAAI,EAAE;QAAE,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC;CAChE,CAAC;AAEF,KAAK,oBAAoB,GAAG;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC;AAoChF,wBAAgB,QAAQ,CAAC,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,GAAG,WAAW,GAAG,IAAI,CA4ClF"}
|
package/dist/source.js
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { record, text } from './read.js';
|
|
2
|
+
function agentFunctionOf(value) {
|
|
3
|
+
if (value === null)
|
|
4
|
+
return null;
|
|
5
|
+
const agentFunction = record(value);
|
|
6
|
+
const name = text(agentFunction, 'name');
|
|
7
|
+
const version = agentFunction.version;
|
|
8
|
+
return name === null || typeof version !== 'number' ? undefined : { name, version };
|
|
9
|
+
}
|
|
10
|
+
function requestOf(source) {
|
|
11
|
+
const request = text(source, 'request');
|
|
12
|
+
const agentFunction = agentFunctionOf(source.agent_function);
|
|
13
|
+
const requester = record(source.requester);
|
|
14
|
+
const by = text(requester, 'name');
|
|
15
|
+
const room = record(source.room);
|
|
16
|
+
const ref = text(room, 'ref');
|
|
17
|
+
const called = text(room, 'name');
|
|
18
|
+
if (request === null ||
|
|
19
|
+
agentFunction === undefined ||
|
|
20
|
+
by === null ||
|
|
21
|
+
ref === null ||
|
|
22
|
+
called === null)
|
|
23
|
+
return null;
|
|
24
|
+
return {
|
|
25
|
+
kind: 'request',
|
|
26
|
+
request,
|
|
27
|
+
agentFunction,
|
|
28
|
+
requester: { name: by, room: text(requester, 'room') !== null },
|
|
29
|
+
room: { ref, name: called },
|
|
30
|
+
approved: text(source, 'approved_at'),
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
export function sourceOf(value, sender) {
|
|
34
|
+
const source = record(value);
|
|
35
|
+
if (source.kind === 'request')
|
|
36
|
+
return requestOf(source);
|
|
37
|
+
if (source.kind === 'trigger') {
|
|
38
|
+
const trigger = text(record(source.trigger), 'description');
|
|
39
|
+
const ref = text(record(source.room), 'ref');
|
|
40
|
+
const room = text(record(source.room), 'name');
|
|
41
|
+
return trigger === null || ref === null || room === null
|
|
42
|
+
? null
|
|
43
|
+
: {
|
|
44
|
+
kind: 'trigger',
|
|
45
|
+
customer: sender === 'customer',
|
|
46
|
+
trigger,
|
|
47
|
+
room: { ref, name: room },
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
if (source.kind === 'conversation') {
|
|
51
|
+
const conversation = record(source.conversation);
|
|
52
|
+
const id = text(conversation, 'id');
|
|
53
|
+
const name = text(conversation, 'name');
|
|
54
|
+
const agent = text(record(source.agent), 'name');
|
|
55
|
+
return id === null || name === null || agent === null
|
|
56
|
+
? null
|
|
57
|
+
: { kind: 'conversation', conversation: { id, name }, agent };
|
|
58
|
+
}
|
|
59
|
+
if (source.kind !== 'mail' && source.kind !== 'declined')
|
|
60
|
+
return null;
|
|
61
|
+
const agent = text(record(source.agent), 'name');
|
|
62
|
+
const owner = text(record(source.owner), 'name');
|
|
63
|
+
if (agent === null || owner === null)
|
|
64
|
+
return null;
|
|
65
|
+
if (source.kind === 'declined')
|
|
66
|
+
return { kind: 'declined', agent, owner };
|
|
67
|
+
const request = text(source, 'request');
|
|
68
|
+
const room = text(source, 'room');
|
|
69
|
+
return request === null || room === null
|
|
70
|
+
? null
|
|
71
|
+
: {
|
|
72
|
+
kind: 'mail',
|
|
73
|
+
request,
|
|
74
|
+
room,
|
|
75
|
+
report: sender === 'report',
|
|
76
|
+
agent,
|
|
77
|
+
owner,
|
|
78
|
+
approved: text(source, 'approved_at'),
|
|
79
|
+
declined: text(source, 'declined_at'),
|
|
80
|
+
};
|
|
81
|
+
}
|
package/dist/status.d.ts
CHANGED
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
import type { Open } from './open.js';
|
|
2
|
-
import type { ProviderRefusal } from './adapter.js';
|
|
3
2
|
import type { ReturnReason } from './room-draft.js';
|
|
4
3
|
export type AttentionEntry = {
|
|
5
4
|
room: string;
|
|
6
5
|
path: string;
|
|
7
6
|
returned: ReturnReason;
|
|
8
|
-
}
|
|
7
|
+
};
|
|
8
|
+
export type UnsentChange = {
|
|
9
9
|
room: string;
|
|
10
|
-
|
|
10
|
+
path: string;
|
|
11
11
|
};
|
|
12
12
|
export type SyncStatus = {
|
|
13
13
|
state: Open<'pending' | 'syncing' | 'synced'>;
|
|
14
14
|
lastCompleted: string | null;
|
|
15
15
|
providerUnreachable: boolean;
|
|
16
16
|
attentionRequired: readonly AttentionEntry[];
|
|
17
|
+
unsent: readonly UnsentChange[];
|
|
17
18
|
reset: string | null;
|
|
18
19
|
};
|
|
19
20
|
export type CycleProgress = {
|
|
@@ -21,7 +22,5 @@ export type CycleProgress = {
|
|
|
21
22
|
reachable: boolean;
|
|
22
23
|
};
|
|
23
24
|
export declare const STARTING: SyncStatus;
|
|
24
|
-
export declare function transferring(status: SyncStatus): SyncStatus;
|
|
25
|
-
export declare function saving(status: SyncStatus): SyncStatus;
|
|
26
25
|
export declare function same(one: SyncStatus, other: SyncStatus): boolean;
|
|
27
26
|
//# sourceMappingURL=status.d.ts.map
|
package/dist/status.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"status.d.ts","sourceRoot":"","sources":["../src/status.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"status.d.ts","sourceRoot":"","sources":["../src/status.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAEpD,MAAM,MAAM,cAAc,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,YAAY,CAAA;CAAE,CAAC;AAEpF,MAAM,MAAM,YAAY,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AAE1D,MAAM,MAAM,UAAU,GAAG;IACvB,KAAK,EAAE,IAAI,CAAC,SAAS,GAAG,SAAS,GAAG,QAAQ,CAAC,CAAC;IAC9C,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,mBAAmB,EAAE,OAAO,CAAC;IAC7B,iBAAiB,EAAE,SAAS,cAAc,EAAE,CAAC;IAC7C,MAAM,EAAE,SAAS,YAAY,EAAE,CAAC;IAChC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;CACtB,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG;IAC1B,QAAQ,EAAE,OAAO,CAAC;IAClB,SAAS,EAAE,OAAO,CAAC;CACpB,CAAC;AAEF,eAAO,MAAM,QAAQ,EAAE,UAOtB,CAAC;AAEF,wBAAgB,IAAI,CAAC,GAAG,EAAE,UAAU,EAAE,KAAK,EAAE,UAAU,GAAG,OAAO,CAShE"}
|
package/dist/status.js
CHANGED
|
@@ -3,18 +3,14 @@ export const STARTING = {
|
|
|
3
3
|
lastCompleted: null,
|
|
4
4
|
providerUnreachable: false,
|
|
5
5
|
attentionRequired: [],
|
|
6
|
+
unsent: [],
|
|
6
7
|
reset: null,
|
|
7
8
|
};
|
|
8
|
-
export function transferring(status) {
|
|
9
|
-
return { ...status, state: 'syncing' };
|
|
10
|
-
}
|
|
11
|
-
export function saving(status) {
|
|
12
|
-
return { ...status, state: 'pending' };
|
|
13
|
-
}
|
|
14
9
|
export function same(one, other) {
|
|
15
10
|
return (one.state === other.state &&
|
|
16
11
|
one.lastCompleted === other.lastCompleted &&
|
|
17
12
|
one.providerUnreachable === other.providerUnreachable &&
|
|
18
13
|
one.reset === other.reset &&
|
|
19
|
-
JSON.stringify(one.attentionRequired) === JSON.stringify(other.attentionRequired)
|
|
14
|
+
JSON.stringify(one.attentionRequired) === JSON.stringify(other.attentionRequired) &&
|
|
15
|
+
JSON.stringify(one.unsent) === JSON.stringify(other.unsent));
|
|
20
16
|
}
|