@agentshouse/mdruntime 0.1.0-c2aaa9c0e3ca4 → 0.1.0-c2c52158b7381
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/AGENTS.md +285 -276
- package/README.md +9 -8
- package/dist/adapter.d.ts +80 -21
- package/dist/adapter.d.ts.map +1 -1
- package/dist/attached-model.d.ts +4 -1
- package/dist/attached-model.d.ts.map +1 -1
- package/dist/attached-model.js +13 -3
- package/dist/attempt.d.ts.map +1 -1
- package/dist/attempt.js +14 -1
- package/dist/bootstrap.d.ts +3 -2
- package/dist/bootstrap.d.ts.map +1 -1
- package/dist/bootstrap.js +83 -26
- package/dist/change-set.d.ts +7 -2
- package/dist/change-set.d.ts.map +1 -1
- package/dist/change-set.js +37 -10
- package/dist/change.d.ts +31 -1
- package/dist/change.d.ts.map +1 -1
- package/dist/change.js +10 -1
- package/dist/chat/acts.d.ts +3 -4
- package/dist/chat/acts.d.ts.map +1 -1
- package/dist/chat/acts.js +10 -10
- package/dist/chat/earlier.d.ts +10 -0
- package/dist/chat/earlier.d.ts.map +1 -0
- package/dist/chat/earlier.js +54 -0
- package/dist/chat/house.d.ts +25 -0
- package/dist/chat/house.d.ts.map +1 -0
- package/dist/chat/house.js +38 -0
- package/dist/chat/input.d.ts +3 -1
- package/dist/chat/input.d.ts.map +1 -1
- package/dist/chat/input.js +11 -18
- package/dist/chat/kit.d.ts +2 -1
- package/dist/chat/kit.d.ts.map +1 -1
- package/dist/chat/kit.js +3 -3
- package/dist/chat/list.d.ts +9 -1
- package/dist/chat/list.d.ts.map +1 -1
- package/dist/chat/list.js +53 -9
- package/dist/chat/markdown.d.ts +3 -1
- package/dist/chat/markdown.d.ts.map +1 -1
- package/dist/chat/markdown.js +85 -26
- package/dist/chat/message.d.ts +1 -0
- package/dist/chat/message.d.ts.map +1 -1
- package/dist/chat/message.js +57 -12
- package/dist/chat/messages.d.ts +9 -1
- package/dist/chat/messages.d.ts.map +1 -1
- package/dist/chat/messages.js +67 -28
- package/dist/chat/name.d.ts +1 -0
- package/dist/chat/name.d.ts.map +1 -1
- package/dist/chat/name.js +1 -1
- package/dist/chat/opened.d.ts +1 -0
- package/dist/chat/opened.d.ts.map +1 -1
- package/dist/chat/opened.js +2 -0
- package/dist/chat/overlay.d.ts +1 -0
- package/dist/chat/overlay.d.ts.map +1 -1
- package/dist/chat/overlay.js +11 -5
- package/dist/chat/parts.d.ts +1 -0
- package/dist/chat/parts.d.ts.map +1 -1
- package/dist/chat/parts.js +3 -2
- package/dist/chat/pieces.d.ts +62 -0
- package/dist/chat/pieces.d.ts.map +1 -0
- package/dist/chat/pieces.js +1110 -0
- package/dist/chat/provider.d.ts +7 -2
- package/dist/chat/provider.d.ts.map +1 -1
- package/dist/chat/provider.js +129 -155
- package/dist/chat/question.d.ts +1 -1
- package/dist/chat/question.d.ts.map +1 -1
- package/dist/chat/question.js +7 -18
- package/dist/chat/ready.d.ts +5 -1
- package/dist/chat/ready.d.ts.map +1 -1
- package/dist/chat/ready.js +9 -7
- package/dist/chat/room-file.d.ts +8 -0
- package/dist/chat/room-file.d.ts.map +1 -0
- package/dist/chat/room-file.js +72 -0
- package/dist/chat/steady.d.ts +3 -0
- package/dist/chat/steady.d.ts.map +1 -0
- package/dist/chat/steady.js +26 -0
- package/dist/chat/style.d.ts.map +1 -1
- package/dist/chat/style.js +8 -4
- package/dist/chat.d.ts +3 -2
- package/dist/chat.d.ts.map +1 -1
- package/dist/chat.js +2 -2
- package/dist/client.d.ts +21 -9
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +47 -8
- package/dist/collection.d.ts +21 -6
- package/dist/collection.d.ts.map +1 -1
- package/dist/collection.js +332 -40
- package/dist/connection.d.ts +39 -11
- package/dist/connection.d.ts.map +1 -1
- package/dist/connection.js +2294 -492
- package/dist/conversation.d.ts +28 -9
- package/dist/conversation.d.ts.map +1 -1
- package/dist/conversation.js +500 -165
- package/dist/digest.d.ts +7 -0
- package/dist/digest.d.ts.map +1 -0
- package/dist/digest.js +113 -0
- package/dist/durability.d.ts +8 -1
- package/dist/durability.d.ts.map +1 -1
- package/dist/entry.d.ts +18 -0
- package/dist/entry.d.ts.map +1 -0
- package/dist/entry.js +157 -0
- package/dist/fence.d.ts +6 -0
- package/dist/fence.d.ts.map +1 -0
- package/dist/fence.js +10 -0
- package/dist/file.d.ts +2 -10
- package/dist/file.d.ts.map +1 -1
- package/dist/file.js +3 -120
- package/dist/host.d.ts +15 -3
- package/dist/host.d.ts.map +1 -1
- package/dist/host.js +103 -13
- package/dist/identity.d.ts +2 -0
- package/dist/identity.d.ts.map +1 -1
- package/dist/identity.js +6 -0
- package/dist/index.d.ts +15 -9
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -0
- package/dist/memory.d.ts +8 -2
- package/dist/memory.d.ts.map +1 -1
- package/dist/memory.js +43 -12
- package/dist/model.d.ts +4 -2
- package/dist/model.d.ts.map +1 -1
- package/dist/model.js +10 -1
- package/dist/name.d.ts +4 -0
- package/dist/name.d.ts.map +1 -0
- package/dist/name.js +122 -0
- package/dist/observation.d.ts +7 -2
- package/dist/observation.d.ts.map +1 -1
- package/dist/observation.js +29 -12
- package/dist/opened.d.ts +22 -0
- package/dist/opened.d.ts.map +1 -0
- package/dist/opened.js +107 -0
- package/dist/outcome.d.ts +39 -4
- package/dist/outcome.d.ts.map +1 -1
- package/dist/outcome.js +29 -0
- package/dist/overlay.d.ts +6 -4
- package/dist/overlay.d.ts.map +1 -1
- package/dist/overlay.js +229 -161
- package/dist/query.d.ts +57 -4
- package/dist/query.d.ts.map +1 -1
- package/dist/query.js +37 -7
- package/dist/reach.d.ts +11 -4
- package/dist/reach.d.ts.map +1 -1
- package/dist/reach.js +192 -41
- package/dist/react.d.ts +8 -6
- package/dist/react.d.ts.map +1 -1
- package/dist/react.js +7 -17
- package/dist/read-side.d.ts +18 -9
- package/dist/read-side.d.ts.map +1 -1
- package/dist/read-side.js +894 -155
- package/dist/readiness.d.ts +53 -0
- package/dist/readiness.d.ts.map +1 -0
- package/dist/readiness.js +33 -0
- package/dist/reads.d.ts +11 -0
- package/dist/reads.d.ts.map +1 -0
- package/dist/reads.js +98 -0
- package/dist/recovery.d.ts +25 -0
- package/dist/recovery.d.ts.map +1 -0
- package/dist/recovery.js +198 -0
- package/dist/refresh.d.ts +4 -4
- package/dist/refresh.d.ts.map +1 -1
- package/dist/refresh.js +46 -20
- package/dist/replica.d.ts +12 -7
- package/dist/replica.d.ts.map +1 -1
- package/dist/replica.js +151 -64
- package/dist/room-draft.d.ts +16 -2
- package/dist/room-draft.d.ts.map +1 -1
- package/dist/room-draft.js +32 -25
- package/dist/rows.d.ts +6 -13
- package/dist/rows.d.ts.map +1 -1
- package/dist/rows.js +10 -13
- package/dist/save.d.ts +52 -10
- package/dist/save.d.ts.map +1 -1
- package/dist/save.js +519 -159
- package/dist/search.d.ts +49 -6
- package/dist/search.d.ts.map +1 -1
- package/dist/search.js +242 -46
- package/dist/seed.d.ts +16 -0
- package/dist/seed.d.ts.map +1 -0
- package/dist/seed.js +75 -0
- package/dist/shared.d.ts +19 -0
- package/dist/shared.d.ts.map +1 -0
- package/dist/shared.js +461 -0
- package/dist/status.d.ts +4 -0
- package/dist/status.d.ts.map +1 -1
- package/dist/store.d.ts +61 -17
- package/dist/store.d.ts.map +1 -1
- package/dist/store.js +581 -310
- package/dist/tables.d.ts +242 -0
- package/dist/tables.d.ts.map +1 -0
- package/dist/tables.js +406 -0
- package/dist/turn.d.ts +9 -0
- package/dist/turn.d.ts.map +1 -0
- package/dist/turn.js +67 -0
- package/dist/windows.d.ts +21 -0
- package/dist/windows.d.ts.map +1 -0
- package/dist/windows.js +84 -0
- package/dist/wire.d.ts +168 -32
- package/dist/wire.d.ts.map +1 -1
- package/dist/wire.js +56 -31
- package/package.json +10 -2
package/dist/change-set.d.ts
CHANGED
|
@@ -9,6 +9,7 @@ export type DocumentChange = {
|
|
|
9
9
|
export type MessageChange = {
|
|
10
10
|
conversation: string;
|
|
11
11
|
identity: string;
|
|
12
|
+
text: string | null;
|
|
12
13
|
};
|
|
13
14
|
export type ChangeSet = {
|
|
14
15
|
documents: readonly DocumentChange[];
|
|
@@ -22,12 +23,16 @@ export type ChangeSet = {
|
|
|
22
23
|
messages: readonly MessageChange[];
|
|
23
24
|
conversations: readonly string[];
|
|
24
25
|
};
|
|
25
|
-
|
|
26
|
+
type Changed = {
|
|
26
27
|
drafts?: readonly string[];
|
|
27
28
|
room?: boolean;
|
|
28
29
|
queue?: boolean;
|
|
29
30
|
presentation?: string;
|
|
30
|
-
}
|
|
31
|
+
};
|
|
32
|
+
export declare function changeSet(locator: string, before: Replica | null, after: Replica | null, changed?: Changed): ChangeSet;
|
|
33
|
+
export declare function changing(locator: string, before: Replica | null, after: Replica | null, changed?: Changed): Generator<number, ChangeSet, void>;
|
|
34
|
+
export declare function entering(locator: string, replica: Replica, paths: readonly string[]): ChangeSet;
|
|
31
35
|
export declare function conversationChangeSet(messages: readonly MessageChange[], conversations: readonly string[]): ChangeSet;
|
|
32
36
|
export declare function mergeChangeSets(sets: readonly ChangeSet[]): ChangeSet;
|
|
37
|
+
export {};
|
|
33
38
|
//# sourceMappingURL=change-set.d.ts.map
|
package/dist/change-set.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"change-set.d.ts","sourceRoot":"","sources":["../src/change-set.ts"],"names":[],"mappings":"AAIA,OAAO,EAAiC,KAAK,OAAO,EAAE,MAAM,cAAc,CAAC;AAC3E,OAAO,EAAwB,KAAK,GAAG,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"change-set.d.ts","sourceRoot":"","sources":["../src/change-set.ts"],"names":[],"mappings":"AAIA,OAAO,EAAiC,KAAK,OAAO,EAAE,MAAM,cAAc,CAAC;AAC3E,OAAO,EAAwB,KAAK,GAAG,EAAE,MAAM,WAAW,CAAC;AAI3D,MAAM,MAAM,cAAc,GAAG;IAC3B,OAAO,EAAE,MAA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AAED,wBAAgB,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,CAiB/F;AAED,wBAAgB,qBAAqB,CACnC,QAAQ,EAAE,SAAS,aAAa,EAAE,EAClC,aAAa,EAAE,SAAS,MAAM,EAAE,GAC/B,SAAS,CAUX;AAED,wBAAgB,eAAe,CAAC,IAAI,EAAE,SAAS,SAAS,EAAE,GAAG,SAAS,CAUrE"}
|
package/dist/change-set.js
CHANGED
|
@@ -1,30 +1,29 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { passingFrontmatter } from './collection.js';
|
|
2
2
|
import { binaryRecord } from './binary.js';
|
|
3
|
-
import { sameBinary, sameChange } from './overlay.js';
|
|
3
|
+
import { changedPaths, sameBinary, sameChange } from './overlay.js';
|
|
4
4
|
import { beneath } from './paths.js';
|
|
5
5
|
import { compositionOf, sameMembership } from './replica.js';
|
|
6
6
|
import { markdownPath, rowsOf } from './rows.js';
|
|
7
|
+
import { keysIn } from './shared.js';
|
|
8
|
+
import { finished, ROW_WEIGHT } from './turn.js';
|
|
7
9
|
function rowsAt(locator, replica, path) {
|
|
8
10
|
if (replica === null)
|
|
9
11
|
return [];
|
|
10
12
|
const visible = replica.visible;
|
|
11
|
-
const document = markdownPath(path) ?
|
|
13
|
+
const document = markdownPath(path) ? passingFrontmatter(visible.collection, path) : null;
|
|
12
14
|
const held = visible.documents[path] !== undefined && document !== undefined;
|
|
13
15
|
const binary = visible.binaries[path];
|
|
14
16
|
if (!held && binary === undefined)
|
|
15
17
|
return [];
|
|
16
|
-
return rowsOf(locator, path, document ?? null, compositionOf(replica.confirmed.record), visible.changes[path] ?? null, binary === undefined ? null : binaryRecord(path, binary, visible.revisions[path]));
|
|
18
|
+
return rowsOf(locator, path, document ?? null, compositionOf(replica.confirmed.record), visible.changes[path] ?? null, visible.fileIds[path] ?? null, binary === undefined ? null : binaryRecord(path, binary, visible.revisions[path]));
|
|
17
19
|
}
|
|
18
20
|
function modelShape(model) {
|
|
19
21
|
return model.status === 'unavailable' ? 'unavailable' : JSON.stringify(model.types);
|
|
20
22
|
}
|
|
21
23
|
export function changeSet(locator, before, after, changed = {}) {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
...Object.keys(before?.visible.binaries ?? {}),
|
|
26
|
-
...Object.keys(after?.visible.binaries ?? {}),
|
|
27
|
-
]);
|
|
24
|
+
return finished(changing(locator, before, after, changed));
|
|
25
|
+
}
|
|
26
|
+
export function* changing(locator, before, after, changed = {}) {
|
|
28
27
|
const documents = [];
|
|
29
28
|
const oldRoom = before?.confirmed.record;
|
|
30
29
|
const newRoom = after?.confirmed.record;
|
|
@@ -35,12 +34,22 @@ export function changeSet(locator, before, after, changed = {}) {
|
|
|
35
34
|
newRoom !== undefined &&
|
|
36
35
|
modelShape(oldRoom.selectionModel) !== modelShape(newRoom.selectionModel);
|
|
37
36
|
const reclassified = oldRoom !== undefined && newRoom !== undefined && !sameMembership(oldRoom, newRoom);
|
|
37
|
+
const paths = before === null || after === null || collectionChanged || selectionChanged || reclassified
|
|
38
|
+
? yield* keysIn(...[before, after].flatMap((replica) => replica === null ? [] : [replica.visible.documents, replica.visible.binaries]))
|
|
39
|
+
: yield* changedPaths(before.visible, after.visible);
|
|
38
40
|
for (const path of paths) {
|
|
41
|
+
yield ROW_WEIGHT;
|
|
42
|
+
if (after?.visible.documents[path] === undefined &&
|
|
43
|
+
after?.visible.binaries[path] === undefined &&
|
|
44
|
+
before?.visible.documents[path] === undefined &&
|
|
45
|
+
before?.visible.binaries[path] === undefined)
|
|
46
|
+
continue;
|
|
39
47
|
const selected = newRoom?.typedSelection?.roots.some((root) => beneath(root, path)) ?? false;
|
|
40
48
|
const retyped = selected ? selectionChanged : collectionChanged;
|
|
41
49
|
if (before?.visible.documents[path] === after?.visible.documents[path] &&
|
|
42
50
|
sameBinary(before?.visible.binaries[path], after?.visible.binaries[path]) &&
|
|
43
51
|
before?.visible.revisions[path] === after?.visible.revisions[path] &&
|
|
52
|
+
before?.visible.fileIds[path] === after?.visible.fileIds[path] &&
|
|
44
53
|
sameChange(before?.visible.changes[path], after?.visible.changes[path]) &&
|
|
45
54
|
!retyped &&
|
|
46
55
|
!reclassified)
|
|
@@ -66,6 +75,24 @@ export function changeSet(locator, before, after, changed = {}) {
|
|
|
66
75
|
conversations: [],
|
|
67
76
|
};
|
|
68
77
|
}
|
|
78
|
+
export function entering(locator, replica, paths) {
|
|
79
|
+
return {
|
|
80
|
+
documents: paths.map((path) => ({
|
|
81
|
+
locator,
|
|
82
|
+
path,
|
|
83
|
+
before: [],
|
|
84
|
+
get after() {
|
|
85
|
+
return rowsAt(locator, replica, path);
|
|
86
|
+
},
|
|
87
|
+
})),
|
|
88
|
+
drafts: [],
|
|
89
|
+
rooms: [],
|
|
90
|
+
queues: [],
|
|
91
|
+
presentations: [],
|
|
92
|
+
messages: [],
|
|
93
|
+
conversations: [],
|
|
94
|
+
};
|
|
95
|
+
}
|
|
69
96
|
export function conversationChangeSet(messages, conversations) {
|
|
70
97
|
return {
|
|
71
98
|
documents: [],
|
package/dist/change.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { BinaryFile, HeadChange } from './adapter.js';
|
|
1
2
|
export type Change = {
|
|
2
3
|
readonly kind: 'field';
|
|
3
4
|
readonly path: string;
|
|
@@ -29,7 +30,6 @@ export type Change = {
|
|
|
29
30
|
readonly kind: 'binary';
|
|
30
31
|
readonly path: string;
|
|
31
32
|
readonly localId: string;
|
|
32
|
-
readonly blob: Blob;
|
|
33
33
|
readonly byteLength: number;
|
|
34
34
|
readonly mediaType: string;
|
|
35
35
|
readonly sha256: string;
|
|
@@ -40,6 +40,32 @@ export type Change = {
|
|
|
40
40
|
} | {
|
|
41
41
|
readonly kind: 'remove';
|
|
42
42
|
readonly path: string;
|
|
43
|
+
} | (Arriving & {
|
|
44
|
+
readonly content: string;
|
|
45
|
+
}) | (Arriving & {
|
|
46
|
+
readonly binary: BinaryFile;
|
|
47
|
+
});
|
|
48
|
+
type Arriving = {
|
|
49
|
+
readonly kind: 'arrival';
|
|
50
|
+
readonly path: string;
|
|
51
|
+
readonly revision?: string;
|
|
52
|
+
readonly fileId?: string;
|
|
53
|
+
readonly change?: HeadChange;
|
|
54
|
+
};
|
|
55
|
+
export type RoomMove = {
|
|
56
|
+
readonly source: {
|
|
57
|
+
readonly room: string;
|
|
58
|
+
readonly baseRoomVersion: string;
|
|
59
|
+
};
|
|
60
|
+
readonly destination: {
|
|
61
|
+
readonly room: string;
|
|
62
|
+
readonly baseRoomVersion: string;
|
|
63
|
+
readonly handle: string;
|
|
64
|
+
};
|
|
65
|
+
readonly moves: readonly {
|
|
66
|
+
readonly path: string;
|
|
67
|
+
readonly to: string;
|
|
68
|
+
}[];
|
|
43
69
|
};
|
|
44
70
|
export type Precondition = {
|
|
45
71
|
readonly kind: 'field';
|
|
@@ -81,9 +107,13 @@ export type ChangeBatch = {
|
|
|
81
107
|
readonly changes: readonly Change[];
|
|
82
108
|
readonly preconditions: readonly Precondition[];
|
|
83
109
|
readonly writtenBy?: WrittenBy;
|
|
110
|
+
readonly between?: RoomMove;
|
|
84
111
|
};
|
|
85
112
|
export declare function immutable(batch: ChangeBatch): ChangeBatch;
|
|
113
|
+
export declare function partnerOf(batch: ChangeBatch, locator: string): string | null;
|
|
114
|
+
export declare function leaving(batch: ChangeBatch, locator: string): boolean;
|
|
86
115
|
export declare function landing(changes: readonly Change[], index: number, path: string): string | null;
|
|
87
116
|
export declare function departure(changes: readonly Change[], index: number): string;
|
|
88
117
|
export declare function queuedFile(batch: ChangeBatch, path: string, localId: string): number;
|
|
118
|
+
export {};
|
|
89
119
|
//# sourceMappingURL=change.d.ts.map
|
package/dist/change.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"change.d.ts","sourceRoot":"","sources":["../src/change.ts"],"names":[],"mappings":"AAAA,MAAM,MA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
2
|
if (Array.isArray(value))
|
|
3
3
|
return Object.freeze(value.map((item) => frozen(item)));
|
|
4
|
-
if (value === null || typeof value !== 'object'
|
|
4
|
+
if (value === null || typeof value !== 'object')
|
|
5
5
|
return value;
|
|
6
6
|
const copy = {};
|
|
7
7
|
for (const [name, item] of Object.entries(value))
|
|
@@ -11,6 +11,15 @@ function frozen(value) {
|
|
|
11
11
|
export function immutable(batch) {
|
|
12
12
|
return frozen(batch);
|
|
13
13
|
}
|
|
14
|
+
export function partnerOf(batch, locator) {
|
|
15
|
+
const between = batch.between;
|
|
16
|
+
if (between === undefined)
|
|
17
|
+
return null;
|
|
18
|
+
return between.source.room === locator ? between.destination.room : between.source.room;
|
|
19
|
+
}
|
|
20
|
+
export function leaving(batch, locator) {
|
|
21
|
+
return batch.between?.source.room === locator;
|
|
22
|
+
}
|
|
14
23
|
export function landing(changes, index, path) {
|
|
15
24
|
let at = path;
|
|
16
25
|
for (const change of changes.slice(index + 1)) {
|
package/dist/chat/acts.d.ts
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import { type Answered } from '../attempt.js';
|
|
2
|
-
import { type CallResult } from '../outcome.js';
|
|
2
|
+
import { type CallResult, type Offline } from '../outcome.js';
|
|
3
3
|
import type { Expected } from './overlay.js';
|
|
4
|
-
export type ChatResult = CallResult |
|
|
5
|
-
readonly kind: 'offline';
|
|
6
|
-
};
|
|
4
|
+
export type ChatResult = CallResult | Offline;
|
|
7
5
|
export type ChatOutcome = {
|
|
8
6
|
readonly state: 'sending';
|
|
9
7
|
} | {
|
|
@@ -20,6 +18,7 @@ export declare function outcomeOf(result: ChatResult): ChatOutcome | null;
|
|
|
20
18
|
export declare function answeredOf(result: ChatResult): Answered;
|
|
21
19
|
export type Sender = {
|
|
22
20
|
carried(name: string, about: unknown, sending: (operation: string) => Promise<CallResult>): Promise<ChatResult>;
|
|
21
|
+
numbered(name: string, about: unknown, sending: (operation: string) => Promise<ChatResult>): Promise<ChatResult>;
|
|
23
22
|
expect(expected: Expected): void;
|
|
24
23
|
draw(expected: Expected): void;
|
|
25
24
|
};
|
package/dist/chat/acts.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"acts.d.ts","sourceRoot":"","sources":["../../src/chat/acts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,KAAK,QAAQ,EAAE,MAAM,eAAe,CAAC;AACxD,OAAO,EAAa,KAAK,UAAU,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"acts.d.ts","sourceRoot":"","sources":["../../src/chat/acts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,KAAK,QAAQ,EAAE,MAAM,eAAe,CAAC;AACxD,OAAO,EAAa,KAAK,UAAU,EAAE,KAAK,OAAO,EAAE,MAAM,eAAe,CAAC;AACzE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAE7C,MAAM,MAAM,UAAU,GAAG,UAAU,GAAG,OAAO,CAAC;AAE9C,MAAM,MAAM,WAAW,GACnB;IAAE,QAAQ,CAAC,KAAK,EAAE,SAAS,CAAA;CAAE,GAC7B;IAAE,QAAQ,CAAC,KAAK,EAAE,SAAS,CAAA;CAAE,GAC7B;IAAE,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,UAAU,CAAA;CAAE,CAAC;AAE9D,wBAAgB,QAAQ,CACtB,MAAM,EAAE,UAAU,GACjB,MAAM,IAAI,OAAO,CAAC,UAAU,EAAE;IAAE,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAA;CAAE,CAAC,CAE5D;AAED,wBAAgB,UAAU,CAAC,MAAM,EAAE,UAAU,GAAG,OAAO,CAEtD;AAED,wBAAgB,SAAS,CAAC,MAAM,EAAE,UAAU,GAAG,WAAW,GAAG,IAAI,CAGhE;AAED,wBAAgB,UAAU,CAAC,MAAM,EAAE,UAAU,GAAG,QAAQ,CAIvD;AAED,MAAM,MAAM,MAAM,GAAG;IACnB,OAAO,CACL,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,OAAO,EACd,OAAO,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,OAAO,CAAC,UAAU,CAAC,GAClD,OAAO,CAAC,UAAU,CAAC,CAAC;IACvB,QAAQ,CACN,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,OAAO,EACd,OAAO,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,OAAO,CAAC,UAAU,CAAC,GAClD,OAAO,CAAC,UAAU,CAAC,CAAC;IACvB,MAAM,CAAC,QAAQ,EAAE,QAAQ,GAAG,IAAI,CAAC;IACjC,IAAI,CAAC,QAAQ,EAAE,QAAQ,GAAG,IAAI,CAAC;CAChC,CAAC;AAEF,KAAK,OAAO,GAAG;IACb,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;IACzB,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC;IACjC,MAAM,CAAC,QAAQ,EAAE,QAAQ,GAAG,IAAI,CAAC;IACjC,IAAI,CAAC,QAAQ,EAAE,QAAQ,GAAG,IAAI,CAAC;CAChC,CAAC;AAEF,wBAAgB,MAAM,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,OAAO,GAAG,MAAM,CAe1E"}
|
package/dist/chat/acts.js
CHANGED
|
@@ -19,17 +19,17 @@ export function answeredOf(result) {
|
|
|
19
19
|
return unanswered(result) ? 'unanswered' : 'refused';
|
|
20
20
|
}
|
|
21
21
|
export function sender({ online, identity, expect, draw }) {
|
|
22
|
+
const numbered = async (name, about, sending) => {
|
|
23
|
+
try {
|
|
24
|
+
return await sending(identity(intentOf(name, about)));
|
|
25
|
+
}
|
|
26
|
+
catch {
|
|
27
|
+
return UNCERTAIN;
|
|
28
|
+
}
|
|
29
|
+
};
|
|
22
30
|
return {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
return { kind: 'offline' };
|
|
26
|
-
try {
|
|
27
|
-
return await sending(identity(intentOf(name, about)));
|
|
28
|
-
}
|
|
29
|
-
catch {
|
|
30
|
-
return UNCERTAIN;
|
|
31
|
-
}
|
|
32
|
-
},
|
|
31
|
+
carried: (name, about, sending) => online ? numbered(name, about, sending) : Promise.resolve({ kind: 'offline' }),
|
|
32
|
+
numbered,
|
|
33
33
|
expect,
|
|
34
34
|
draw,
|
|
35
35
|
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { MdRuntimeClient } from '../client.js';
|
|
2
|
+
import type { ConversationView } from '../conversation.js';
|
|
3
|
+
export declare const CHAT_WINDOW = 50;
|
|
4
|
+
export type Paged = {
|
|
5
|
+
readonly view: ConversationView | null;
|
|
6
|
+
readonly hasEarlier: boolean;
|
|
7
|
+
loadEarlier(): Promise<void>;
|
|
8
|
+
};
|
|
9
|
+
export declare function useEarlier(client: MdRuntimeClient, thread: string | null, held: ConversationView | null): Paged;
|
|
10
|
+
//# sourceMappingURL=earlier.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"earlier.d.ts","sourceRoot":"","sources":["../../src/chat/earlier.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAE3D,eAAO,MAAM,WAAW,KAAK,CAAC;AAU9B,MAAM,MAAM,KAAK,GAAG;IAClB,QAAQ,CAAC,IAAI,EAAE,gBAAgB,GAAG,IAAI,CAAC;IACvC,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC;IAC7B,WAAW,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CAC9B,CAAC;AAuBF,wBAAgB,UAAU,CACxB,MAAM,EAAE,eAAe,EACvB,MAAM,EAAE,MAAM,GAAG,IAAI,EACrB,IAAI,EAAE,gBAAgB,GAAG,IAAI,GAC5B,KAAK,CA8BP"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { useCallback, useMemo, useState } from 'react';
|
|
2
|
+
export const CHAT_WINDOW = 50;
|
|
3
|
+
function slidOut(before, after) {
|
|
4
|
+
if (before === null || before.conversation !== after.conversation)
|
|
5
|
+
return [];
|
|
6
|
+
const kept = new Set(after.messages.map((one) => one.identity));
|
|
7
|
+
const left = [];
|
|
8
|
+
for (const message of before.messages) {
|
|
9
|
+
if (kept.has(message.identity))
|
|
10
|
+
break;
|
|
11
|
+
left.push(message);
|
|
12
|
+
}
|
|
13
|
+
return left;
|
|
14
|
+
}
|
|
15
|
+
function joined(held, earlier) {
|
|
16
|
+
const { next: _live, ...view } = held;
|
|
17
|
+
const live = new Set(held.messages.map((one) => one.identity));
|
|
18
|
+
return {
|
|
19
|
+
...view,
|
|
20
|
+
messages: [...earlier.messages.filter((one) => !live.has(one.identity)), ...held.messages],
|
|
21
|
+
...(earlier.next === undefined ? {} : { next: earlier.next }),
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
export function useEarlier(client, thread, held) {
|
|
25
|
+
const [earlier, setEarlier] = useState(null);
|
|
26
|
+
const [seen, setSeen] = useState(held);
|
|
27
|
+
const whole = held !== null && held.next === undefined;
|
|
28
|
+
let current = earlier !== null && earlier.thread === thread && !whole ? earlier : null;
|
|
29
|
+
if (current !== earlier)
|
|
30
|
+
setEarlier(current);
|
|
31
|
+
if (seen !== held) {
|
|
32
|
+
setSeen(held);
|
|
33
|
+
const carried = held === null ? [] : slidOut(seen, held);
|
|
34
|
+
if (thread !== null && carried.length > 0) {
|
|
35
|
+
const base = current ?? { thread, messages: [], next: seen?.next };
|
|
36
|
+
current = { ...base, messages: [...base.messages, ...carried] };
|
|
37
|
+
setEarlier(current);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
const view = useMemo(() => (held === null || current === null ? held : joined(held, current)), [held, current]);
|
|
41
|
+
const next = current === null ? held?.next : current.next;
|
|
42
|
+
const loadEarlier = useCallback(async () => {
|
|
43
|
+
if (thread === null || next === undefined)
|
|
44
|
+
return;
|
|
45
|
+
const older = await client.conversation.read(thread, { limit: CHAT_WINDOW, after: next });
|
|
46
|
+
setEarlier((now) => {
|
|
47
|
+
const base = now !== null && now.thread === thread ? now : { thread, messages: [], next };
|
|
48
|
+
if (base.next !== next)
|
|
49
|
+
return now;
|
|
50
|
+
return { thread, messages: [...older.messages, ...base.messages], next: older.next };
|
|
51
|
+
});
|
|
52
|
+
}, [client, thread, next]);
|
|
53
|
+
return { view, hasEarlier: next !== undefined, loadEarlier };
|
|
54
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export type HouseSource = {
|
|
2
|
+
readonly kind: 'request';
|
|
3
|
+
readonly request: string;
|
|
4
|
+
readonly routine: string;
|
|
5
|
+
readonly version: number;
|
|
6
|
+
readonly requester: {
|
|
7
|
+
readonly name: string;
|
|
8
|
+
readonly room: boolean;
|
|
9
|
+
};
|
|
10
|
+
readonly room: {
|
|
11
|
+
readonly ref: string;
|
|
12
|
+
readonly name: string;
|
|
13
|
+
};
|
|
14
|
+
readonly approved: string | null;
|
|
15
|
+
} | {
|
|
16
|
+
readonly kind: 'mail';
|
|
17
|
+
readonly agent: string;
|
|
18
|
+
readonly owner: string;
|
|
19
|
+
};
|
|
20
|
+
export type ChatRequest = {
|
|
21
|
+
readonly request: string;
|
|
22
|
+
readonly room: string;
|
|
23
|
+
};
|
|
24
|
+
export declare function sourceOf(value: unknown): HouseSource | null;
|
|
25
|
+
//# sourceMappingURL=house.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"house.d.ts","sourceRoot":"","sources":["../../src/chat/house.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,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,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,MAAM,CAAA;KAAE,CAAC;IAC/D,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;CAClC,GACD;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAE9E,MAAM,MAAM,WAAW,GAAG;IAAE,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AAgC9E,wBAAgB,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,WAAW,GAAG,IAAI,CAO3D"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { record, text } from './read.js';
|
|
2
|
+
function requestOf(source) {
|
|
3
|
+
const request = text(source, 'request');
|
|
4
|
+
const routine = record(source.routine);
|
|
5
|
+
const name = text(routine, 'name');
|
|
6
|
+
const version = routine.version;
|
|
7
|
+
const requester = record(source.requester);
|
|
8
|
+
const by = text(requester, 'name');
|
|
9
|
+
const room = record(source.room);
|
|
10
|
+
const ref = text(room, 'ref');
|
|
11
|
+
const called = text(room, 'name');
|
|
12
|
+
if (request === null ||
|
|
13
|
+
name === null ||
|
|
14
|
+
typeof version !== 'number' ||
|
|
15
|
+
by === null ||
|
|
16
|
+
ref === null ||
|
|
17
|
+
called === null)
|
|
18
|
+
return null;
|
|
19
|
+
return {
|
|
20
|
+
kind: 'request',
|
|
21
|
+
request,
|
|
22
|
+
routine: name,
|
|
23
|
+
version,
|
|
24
|
+
requester: { name: by, room: text(requester, 'room') !== null },
|
|
25
|
+
room: { ref, name: called },
|
|
26
|
+
approved: text(source, 'approved_at'),
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
export function sourceOf(value) {
|
|
30
|
+
const source = record(value);
|
|
31
|
+
if (source.kind === 'request')
|
|
32
|
+
return requestOf(source);
|
|
33
|
+
if (source.kind !== 'mail')
|
|
34
|
+
return null;
|
|
35
|
+
const agent = text(record(source.agent), 'name');
|
|
36
|
+
const owner = text(record(source.owner), 'name');
|
|
37
|
+
return agent === null || owner === null ? null : { kind: 'mail', agent, owner };
|
|
38
|
+
}
|
package/dist/chat/input.d.ts
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { type ReactElement, type ReactNode } from 'react';
|
|
2
|
+
import type { ChatRequest } from './house.js';
|
|
2
3
|
import { type ChatNoteProps } from './kit.js';
|
|
3
4
|
export type ChatInputProps = {
|
|
4
5
|
readonly messageLength?: number;
|
|
5
6
|
readonly note?: (note: ChatNoteProps) => ReactNode;
|
|
6
7
|
readonly autoFocus?: boolean;
|
|
8
|
+
readonly decision?: (request: ChatRequest) => ReactNode;
|
|
7
9
|
};
|
|
8
|
-
export declare function ChatInput({ messageLength, note, autoFocus, }: ChatInputProps): ReactElement;
|
|
10
|
+
export declare function ChatInput({ messageLength, note, autoFocus, decision, }: ChatInputProps): ReactElement;
|
|
9
11
|
//# sourceMappingURL=input.d.ts.map
|
package/dist/chat/input.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"input.d.ts","sourceRoot":"","sources":["../../src/chat/input.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA0C,KAAK,YAAY,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"input.d.ts","sourceRoot":"","sources":["../../src/chat/input.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA0C,KAAK,YAAY,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAmBlG,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,EAAsD,KAAK,aAAa,EAAE,MAAM,UAAU,CAAC;AAMlG,MAAM,MAAM,cAAc,GAAG;IAC3B,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,EAAE,aAAa,KAAK,SAAS,CAAC;IACnD,QAAQ,CAAC,SAAS,CAAC,EAAE,OAAO,CAAC;IAC7B,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC,OAAO,EAAE,WAAW,KAAK,SAAS,CAAC;CACzD,CAAC;AAgFF,wBAAgB,SAAS,CAAC,EACxB,aAAa,EACb,IAAY,EACZ,SAAiB,EACjB,QAAQ,GACT,EAAE,cAAc,GAAG,YAAY,CA4K/B"}
|
package/dist/chat/input.js
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useContext, useEffect, useMemo, useRef } from 'react';
|
|
3
|
-
import { ComposerPrimitive,
|
|
3
|
+
import { ComposerPrimitive, useAuiState, } from '@assistant-ui/react';
|
|
4
4
|
import { DropdownMenu } from 'radix-ui';
|
|
5
5
|
import ArrowUp from 'lucide-react/dist/esm/icons/arrow-up.mjs';
|
|
6
6
|
import Check from 'lucide-react/dist/esm/icons/check.mjs';
|
|
7
7
|
import ChevronDown from 'lucide-react/dist/esm/icons/chevron-down.mjs';
|
|
8
8
|
import CornerDownRight from 'lucide-react/dist/esm/icons/corner-down-right.mjs';
|
|
9
9
|
import ListEnd from 'lucide-react/dist/esm/icons/list-end.mjs';
|
|
10
|
-
import Paperclip from 'lucide-react/dist/esm/icons/paperclip.mjs';
|
|
11
10
|
import Pencil from 'lucide-react/dist/esm/icons/pencil.mjs';
|
|
12
11
|
import Plus from 'lucide-react/dist/esm/icons/plus.mjs';
|
|
13
12
|
import Square from 'lucide-react/dist/esm/icons/square.mjs';
|
|
@@ -42,10 +41,6 @@ function commandsFound(commands, query) {
|
|
|
42
41
|
const within = commands.filter((one) => !named.includes(one) && one.name.toLowerCase().includes(asked));
|
|
43
42
|
return [...named, ...within].map(commandItem);
|
|
44
43
|
}
|
|
45
|
-
function Attached({ id, name }) {
|
|
46
|
-
const aui = useAui();
|
|
47
|
-
return (_jsxs("span", { className: "ahc-chip ahc-chip--removable", children: [_jsx(Paperclip, { "aria-hidden": "true" }), _jsx(Name, { text: name }), _jsx(IconButton, { label: `Remove ${name}`, compact: true, onClick: () => void aui.composer().attachment({ id }).remove(), children: _jsx(X, { "aria-hidden": "true" }) })] }));
|
|
48
|
-
}
|
|
49
44
|
function Picker({ option, choose, }) {
|
|
50
45
|
const container = useContext(Portal);
|
|
51
46
|
return (_jsxs(DropdownMenu.Root, { modal: false, children: [_jsxs(DropdownMenu.Trigger, { className: "ahc-btn ahc-picker", "aria-label": option.name, title: option.name, children: [_jsx(Name, { text: option.values.find((one) => one.value === option.value)?.name ?? option.value }), _jsx(ChevronDown, { "aria-hidden": "true" })] }), _jsx(DropdownMenu.Portal, { container: container, children: _jsxs(DropdownMenu.Content, { className: "ahc-menu", side: "top", align: "start", children: [_jsx(DropdownMenu.Label, { className: "ahc-menu__heading", children: option.name }), _jsx(DropdownMenu.RadioGroup, { value: option.value, onValueChange: (value) => {
|
|
@@ -56,10 +51,10 @@ function Picker({ option, choose, }) {
|
|
|
56
51
|
function noted(note) {
|
|
57
52
|
return _jsx(ChatNote, { ...note });
|
|
58
53
|
}
|
|
59
|
-
export function ChatInput({ messageLength, note = noted, autoFocus = false, }) {
|
|
54
|
+
export function ChatInput({ messageLength, note = noted, autoFocus = false, decision, }) {
|
|
60
55
|
const chat = useChat();
|
|
56
|
+
const { attach } = chat;
|
|
61
57
|
const { client } = useChatScope();
|
|
62
|
-
const aui = useAui();
|
|
63
58
|
const opened = useOpened();
|
|
64
59
|
const { lone, commands, context, queued, running } = opened;
|
|
65
60
|
const conversation = chat.conversation ?? '';
|
|
@@ -71,7 +66,6 @@ export function ChatInput({ messageLength, note = noted, autoFocus = false, }) {
|
|
|
71
66
|
input.current?.focus();
|
|
72
67
|
}, [autoFocus, thread]);
|
|
73
68
|
const typed = useAuiState((s) => s.composer.text);
|
|
74
|
-
const attached = useAuiState((s) => s.composer.attachments.length > 0);
|
|
75
69
|
const fault = messageLength !== undefined && typed.length > messageLength
|
|
76
70
|
? `Keep it to ${messageLength} characters.`
|
|
77
71
|
: null;
|
|
@@ -88,12 +82,11 @@ export function ChatInput({ messageLength, note = noted, autoFocus = false, }) {
|
|
|
88
82
|
chat.edit(id);
|
|
89
83
|
input.current?.focus();
|
|
90
84
|
};
|
|
91
|
-
const drafted = typed.trim() !== ''
|
|
92
|
-
const readOnly = opened.deleted;
|
|
93
|
-
return (_jsx(Scoped, { children: _jsxs("div", { className: "ahc-input-area", children: [readOnly || queued.length === 0 ? null : (_jsxs("div", { role: "group", "aria-label": "Queued messages", className: "ahc-queue", children: [_jsxs("div", { className: "ahc-queue__head", children: [_jsx(ListEnd, { "aria-hidden": "true" }), _jsx("span", { className: "ahc-queue__said", children: `${queued.length} ${queued.length === 1 ? 'message waits' : 'messages wait'} for ${opened.name} to finish` }), running ? (_jsx(Button, { variant: "outline", compact: true, onClick: interrupt, children: "Send now" })) : null] }), queued.map((item) => (_jsxs("div", { className: "ahc-queue-row", children: [_jsx(CornerDownRight, { "aria-hidden": "true", className: "ahc-muted" }), _jsx("span", { className: "ahc-queue-row__text", children: item.text }), _jsx(IconButton, { label: "Edit queued message", compact: true, onClick: () => edit(item.id), children: _jsx(Pencil, { "aria-hidden": "true" }) }), _jsx(IconButton, { label: "Remove queued message", compact: true, onClick: () => chat.unqueue(item.id), children: _jsx(X, { "aria-hidden": "true" }) })] }, item.id)))] })), readOnly ? null : (_jsx(ComposerPrimitive.Root, { className: "ahc-composer", children: _jsxs(ComposerPrimitive.Unstable_TriggerPopoverRoot, { children: [commands.length === 0 ? null : (_jsxs(ComposerPrimitive.Unstable_TriggerPopover, { char: COMMAND, matcher: atStart, adapter: listed, "aria-label": "Commands", className: "ahc-menu ahc-commands", children: [_jsx(ComposerPrimitive.Unstable_TriggerPopover.Directive, { formatter: commanded }), _jsx(ComposerPrimitive.Unstable_TriggerPopoverItems, { children: (items) => items.map((item, index) => (_jsx(ComposerPrimitive.Unstable_TriggerPopoverItem, { item: item, index: index, className: "ahc-row ahc-row--two", children: _jsxs("span", { className: "ahc-row__label", children: [_jsx("span", { className: "ahc-row__title ahc-mono", children: item.label }), _jsx("span", { className: "ahc-row__sub", children: item.description })] }) }, item.id))) })] })),
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
} }), opened.options.map((option) => (_jsx(Picker, { option: option, choose: chat.choose }, option.id))), _jsx("span", { className: "ahc-spacer" }), context === null ? null : (_jsx("span", { title: "Context in use", className: "ahc-meta", children: contextText(context) })), running ? (_jsx("button", { type: "button", className: `ahc-btn ahc-btn--icon ${drafted ? 'ahc-btn--outline' : 'ahc-btn--ink'}`, "aria-label": "Stop", title: "Stop", onClick: interrupt, children: _jsx(Square, { "aria-hidden": "true" }) })) : null, running && !drafted ? null : (_jsx(ComposerPrimitive.Send, { className: "ahc-btn ahc-btn--icon ahc-btn--ink", "aria-label": running ? 'Queue message' : 'Send', disabled: fault !== null, children: _jsx(ArrowUp, { size: 20, "aria-hidden": "true" }) }))] })] }) })), fault === null ? null : (_jsx("p", { className: "ahc-note", role: "status", "data-state": "refused", children: fault })), note({ outcome: chat.acting.outcome }), note({ outcome: chat.sending.outcome, again: chat.sending.again ?? undefined })] }) }));
|
|
85
|
+
const drafted = typed.trim() !== '';
|
|
86
|
+
const readOnly = opened.deleted || opened.waits;
|
|
87
|
+
return (_jsx(Scoped, { children: _jsxs("div", { className: "ahc-input-area", children: [readOnly || queued.length === 0 ? null : (_jsxs("div", { role: "group", "aria-label": "Queued messages", className: "ahc-queue", children: [_jsxs("div", { className: "ahc-queue__head", children: [_jsx(ListEnd, { "aria-hidden": "true" }), _jsx("span", { className: "ahc-queue__said", children: `${queued.length} ${queued.length === 1 ? 'message waits' : 'messages wait'} for ${opened.name} to finish` }), running ? (_jsx(Button, { variant: "outline", compact: true, onClick: interrupt, children: "Send now" })) : null] }), queued.map((item) => (_jsxs("div", { className: "ahc-queue-row", children: [_jsx(CornerDownRight, { "aria-hidden": "true", className: "ahc-muted" }), _jsx("span", { className: "ahc-queue-row__text", children: item.text }), _jsx(IconButton, { label: "Edit queued message", compact: true, onClick: () => edit(item.id), children: _jsx(Pencil, { "aria-hidden": "true" }) }), _jsx(IconButton, { label: "Remove queued message", compact: true, onClick: () => chat.unqueue(item.id), children: _jsx(X, { "aria-hidden": "true" }) })] }, item.id)))] })), readOnly ? null : (_jsx(ComposerPrimitive.Root, { className: "ahc-composer", children: _jsxs(ComposerPrimitive.Unstable_TriggerPopoverRoot, { children: [commands.length === 0 ? null : (_jsxs(ComposerPrimitive.Unstable_TriggerPopover, { char: COMMAND, matcher: atStart, adapter: listed, "aria-label": "Commands", className: "ahc-menu ahc-commands", children: [_jsx(ComposerPrimitive.Unstable_TriggerPopover.Directive, { formatter: commanded }), _jsx(ComposerPrimitive.Unstable_TriggerPopoverItems, { children: (items) => items.map((item, index) => (_jsx(ComposerPrimitive.Unstable_TriggerPopoverItem, { item: item, index: index, className: "ahc-row ahc-row--two", children: _jsxs("span", { className: "ahc-row__label", children: [_jsx("span", { className: "ahc-row__title ahc-mono", children: item.label }), _jsx("span", { className: "ahc-row__sub", children: item.description })] }) }, item.id))) })] })), _jsx(ComposerPrimitive.Input, { asChild: true, "aria-label": "Message", placeholder: lone === null ? `Message ${opened.name}` : lone.field.prompt, submitMode: fault === null ? 'enter' : 'none', children: _jsx("textarea", { ref: input, className: "ahc-composer__input", rows: 1 }) }), _jsxs("div", { className: "ahc-composer__bar", children: [attach === null ? null : (_jsxs(_Fragment, { children: [_jsx(IconButton, { label: "Add files", onClick: () => picker.current?.click(), children: _jsx(Plus, { size: 20, "aria-hidden": "true" }) }), _jsx("input", { ref: picker, type: "file", multiple: true, hidden: true, onChange: (event) => {
|
|
88
|
+
const chosen = [...(event.target.files ?? [])];
|
|
89
|
+
event.target.value = '';
|
|
90
|
+
void attach(chosen);
|
|
91
|
+
} })] })), opened.options.map((option) => (_jsx(Picker, { option: option, choose: chat.choose }, option.id))), _jsx("span", { className: "ahc-spacer" }), context === null ? null : (_jsx("span", { title: "Context in use", className: "ahc-meta", children: contextText(context) })), running ? (_jsx("button", { type: "button", className: `ahc-btn ahc-btn--icon ${drafted ? 'ahc-btn--outline' : 'ahc-btn--ink'}`, "aria-label": "Stop", title: "Stop", onClick: interrupt, children: _jsx(Square, { "aria-hidden": "true" }) })) : null, running && !drafted ? null : (_jsx(ComposerPrimitive.Send, { className: "ahc-btn ahc-btn--icon ahc-btn--ink", "aria-label": running ? 'Queue message' : 'Send', disabled: fault !== null, children: _jsx(ArrowUp, { size: 20, "aria-hidden": "true" }) }))] })] }) })), opened.deleted || opened.waiting === null ? null : decision?.(opened.waiting), fault === null ? null : (_jsx("p", { className: "ahc-note", role: "status", "data-state": "refused", children: fault })), note({ outcome: chat.acting.outcome }), note({ outcome: chat.sending.outcome, again: chat.sending.again ?? undefined })] }) }));
|
|
99
92
|
}
|
package/dist/chat/kit.d.ts
CHANGED
|
@@ -48,7 +48,8 @@ export declare function ItemRow({ lead, title, sub, trailing, }: {
|
|
|
48
48
|
sub: ReactNode;
|
|
49
49
|
trailing: ReactNode;
|
|
50
50
|
}): ReactElement;
|
|
51
|
-
export declare function Working({ step }: {
|
|
51
|
+
export declare function Working({ label, step, }: {
|
|
52
|
+
label?: string;
|
|
52
53
|
step?: string | undefined;
|
|
53
54
|
}): ReactElement;
|
|
54
55
|
export type ChatNoteProps = {
|
package/dist/chat/k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f;AASD,MAAM,MAAM,aAAa,GAAG;IAC1B,QAAQ,CAAC,OAAO,EAAE,WAAW,GAAG,IAAI,CAAC;IACrC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC,MAAM,IAAI,CAAC,GAAG,SAAS,CAAC;CAC3C,CAAC;AAEF,wBAAgB,QAAQ,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,aAAa,GAAG,YAAY,GAAG,IAAI,CAuB/E"}
|
package/dist/chat/kit.js
CHANGED
|
@@ -94,7 +94,7 @@ export function ItemRow({ lead, title, sub, trailing, }) {
|
|
|
94
94
|
function elapsed(seconds) {
|
|
95
95
|
return seconds >= 60 ? `${Math.floor(seconds / 60)}m ${seconds % 60}s` : `${seconds}s`;
|
|
96
96
|
}
|
|
97
|
-
export function Working({ step }) {
|
|
97
|
+
export function Working({ label = 'Working', step, }) {
|
|
98
98
|
const [from] = useState(() => Date.now());
|
|
99
99
|
const [now, setNow] = useState(from);
|
|
100
100
|
useEffect(() => {
|
|
@@ -102,11 +102,11 @@ export function Working({ step }) {
|
|
|
102
102
|
const tick = setInterval(() => setNow(Date.now()), 1000);
|
|
103
103
|
return () => clearInterval(tick);
|
|
104
104
|
}, []);
|
|
105
|
-
return (_jsxs("div", { className: "ahc-toolline ahc-working", role: "status", children: [_jsx("span", { className: "ahc-shimmer", children:
|
|
105
|
+
return (_jsxs("div", { className: "ahc-toolline ahc-working", role: "status", children: [_jsx("span", { className: "ahc-shimmer", children: label }), _jsx("span", { className: "ahc-figure", "aria-hidden": "true", children: elapsed(Math.floor((now - from) / 1000)) }), step === undefined ? null : _jsx("span", { children: step })] }));
|
|
106
106
|
}
|
|
107
107
|
const SAID = {
|
|
108
108
|
sending: 'Sending…',
|
|
109
|
-
offline: '
|
|
109
|
+
offline: 'House can’t be reached. Nothing was sent.',
|
|
110
110
|
};
|
|
111
111
|
const UNANSWERED = 'House did not answer.';
|
|
112
112
|
export function ChatNote({ outcome, again }) {
|
package/dist/chat/list.d.ts
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
import { type ComponentType, type ReactElement, type ReactNode } from 'react';
|
|
2
|
+
import type { ChatState } from './provider.js';
|
|
2
3
|
export type AgentLook = {
|
|
4
|
+
readonly AgentLink?: ComponentType<{
|
|
5
|
+
agent: string;
|
|
6
|
+
className: string;
|
|
7
|
+
children: ReactNode;
|
|
8
|
+
'aria-current': 'true' | undefined;
|
|
9
|
+
}> | undefined;
|
|
3
10
|
readonly agentMark?: ((agent: string, size: number) => ReactNode) | undefined;
|
|
4
11
|
readonly agentDetail?: ((agent: string) => string) | undefined;
|
|
5
12
|
};
|
|
@@ -11,9 +18,10 @@ export type ChatMessageListProps = {
|
|
|
11
18
|
};
|
|
12
19
|
readonly onLink?: (href: string) => void;
|
|
13
20
|
readonly footer?: ReactNode;
|
|
21
|
+
readonly waiting?: (chat: ChatState) => string | null;
|
|
14
22
|
readonly children?: ReactNode;
|
|
15
23
|
};
|
|
16
|
-
export declare function ChatMessageList({ components, onLink, footer, children, }: ChatMessageListProps): ReactElement;
|
|
24
|
+
export declare function ChatMessageList({ components, onLink, footer, waiting, children, }: ChatMessageListProps): ReactElement;
|
|
17
25
|
export declare function ChatList({ onChoose }: {
|
|
18
26
|
onChoose: () => void;
|
|
19
27
|
}): ReactElement;
|
package/dist/chat/list.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../src/chat/list.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../src/chat/list.tsx"],"names":[],"mappings":"AAAA,OAAO,EAKL,KAAK,aAAa,EAClB,KAAK,YAAY,EACjB,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAUf,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAG/C,MAAM,MAAM,SAAS,GAAG;IACtB,QAAQ,CAAC,SAAS,CAAC,EAC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