tandem-kit-chat 0.0.0 → 0.1.0
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/LICENSE +21 -0
- package/README.md +38 -1
- package/dist/src/chats.d.ts +27 -0
- package/dist/src/chats.js +108 -0
- package/dist/src/commands.d.ts +22 -0
- package/dist/src/commands.js +43 -0
- package/dist/src/controller.d.ts +143 -0
- package/dist/src/controller.js +600 -0
- package/dist/src/fake.d.ts +59 -0
- package/dist/src/fake.js +98 -0
- package/dist/src/focus.d.ts +29 -0
- package/dist/src/focus.js +61 -0
- package/dist/src/format.d.ts +88 -0
- package/dist/src/format.js +174 -0
- package/dist/src/index.d.ts +13 -0
- package/dist/src/index.js +13 -0
- package/dist/src/labels.d.ts +156 -0
- package/dist/src/labels.js +162 -0
- package/dist/src/locales.d.ts +21 -0
- package/dist/src/locales.js +474 -0
- package/dist/src/queue.d.ts +23 -0
- package/dist/src/queue.js +42 -0
- package/dist/src/reduce.d.ts +5 -0
- package/dist/src/reduce.js +318 -0
- package/dist/src/store.d.ts +10 -0
- package/dist/src/store.js +21 -0
- package/dist/src/tools.d.ts +9 -0
- package/dist/src/tools.js +23 -0
- package/dist/src/transport.d.ts +69 -0
- package/dist/src/transport.js +27 -0
- package/dist/src/types.d.ts +191 -0
- package/dist/src/types.js +1 -0
- package/package.json +40 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Ryan Xu
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,40 @@
|
|
|
1
1
|
# tandem-kit-chat
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
The headless half of the Tandem chat UI. Framework-free TypeScript that runs in the browser and in Node: everything a chat UI needs to know about a `tandem/0` session, with no DOM and no rendering.
|
|
4
|
+
|
|
5
|
+
```ts
|
|
6
|
+
import { ChatController, httpTransport } from 'tandem-kit-chat'
|
|
7
|
+
|
|
8
|
+
const chat = new ChatController({ transport: httpTransport({ baseUrl: 'http://127.0.0.1:8787', token }) })
|
|
9
|
+
chat.subscribe(() => draw(chat.getState()))
|
|
10
|
+
await chat.start() // creates (or reopens) a session, replays its log, follows the stream
|
|
11
|
+
await chat.submit('add milk to the list')
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Pieces
|
|
15
|
+
|
|
16
|
+
| piece | what it is |
|
|
17
|
+
|---|---|
|
|
18
|
+
| `reduce(state, event)` / `foldChat(events)` | pure reducer over `tandem/0` events. Turns the stream into display items: `user`, `assistant`, `steps` (tool calls grouped), `approval`, `question`, `change`, `rejected`, `clash`, `compaction`, `notice`, `turn`, `todos`, `session` and host `app.` events. Session-level state (status, pending prompts, context, usage, settings) is `reduceSession` from `tandem-kit-core`, so it matches `protocol/fixtures/replay.json` exactly. Events at or below the last `seq` are skipped, so a reconnect overlap is harmless. |
|
|
19
|
+
| `ChatController` | owns one session: transport, reducer state, the message queue, the draft, focus and storage. `subscribe`/`getState` fit `useSyncExternalStore`. Reconnects with `after` set to the last folded `seq`. |
|
|
20
|
+
| `MessageQueue` | messages typed while the agent works wait in order and go out one per finished turn. A stopped or failed turn holds them; "send now" stops the turn and sends that one first. |
|
|
21
|
+
| `SlashRegistry` | `/command` registry: parse, suggest by prefix, run. `defaultCommands()` gives `/help /stop /compact /clear /model /effort /mode /plan`; add your own with the `commands` option. |
|
|
22
|
+
| `labels` | `Labels` is every string the UI shows, `createLabels(overrides)` merges. Also the formatters: `stepsSummary`, `usageLabel`, `contextLabel`, `costLabel`, `workingLabel`, `elapsedText`, `noticeText`. |
|
|
23
|
+
| `encodeFocus` / `decodeFocus` | an app-provided focus (`{ label, text? }`) is sent with each message as a `[focus: ...]` preamble line (several are allowed) and shown back as a chip, with no change to the wire protocol. |
|
|
24
|
+
| `ChatDirectory` | chat titles for a session list, newest first whatever order the server lists them (first-seen order is remembered): the first user message names a chat (markdown stripped), `rename` and `remove` are remembered in `storage`. The controller exposes it as `snapshot.chats`, `renameChat(id, title)`, `deleteChat(id)` (a transport with `deleteSession` removes it on the server). |
|
|
25
|
+
| `resolveLocale` / `defineLocale` | locale bundles (`en`, `es`, `fr`, `de`, `ar`, `he`) as `{ code, dir?, labels }`; missing labels fall back to English and `ar`/`he` are right-to-left. `formatTime(at, mode, ...)` gives `time`, `relative` or `datetime` stamps. |
|
|
26
|
+
| `encodeAttachments` / `decodeMessage` | files are appended to the message text as `<attachment name type size [ref]/>` tags (small text files inline as the tag body); `decodeMessage` returns `{ focus, references, attachments, text }` so a UI can show chips. The controller adds `addAttachment`, `addReference`, `retry`, `beginEdit` and `deleteMessage` (hidden in this view only: the protocol has no rewind). |
|
|
27
|
+
| `ChatTransport` | the small interface the controller needs. `httpTransport` implements it with `TandemClient` (server-sent events by default, or `events: 'poll'` with `poll: { waitMs, intervalMs }` to read by request and reply behind a proxy or bridge that cannot stream); give your own for tests or another wire. |
|
|
28
|
+
| `tandem-kit-chat/testing` | `FakeTransport`: an in-memory scripted session for component tests. |
|
|
29
|
+
|
|
30
|
+
## Behaviour worth knowing
|
|
31
|
+
|
|
32
|
+
- A tool call whose approval is pending is hidden (the approval card shows it) and appears again once allowed; a denied call is marked declined, not failed.
|
|
33
|
+
- `AskUserQuestion` and `ExitPlanMode` calls are not shown as steps; their cards replace them.
|
|
34
|
+
- Nothing spins while the thread waits on the person: a steps group is `live` only while a turn is active, nothing is pending and it is the last item.
|
|
35
|
+
- A stopped turn expires open prompts, marks running calls `stopped` and adds a muted "Stopped" item. Limit stops (`turn_finished.limit`) become warn notices.
|
|
36
|
+
- Compaction dims what it summarised (`summarized: true`).
|
|
37
|
+
- `flushMs` batches notifications for ephemeral events (`text_delta`, `usage`, ...) so a fast stream does not redraw per token. Structural events always notify at once.
|
|
38
|
+
- `storage` (anything shaped like `localStorage`) remembers the open session id and the draft.
|
|
39
|
+
|
|
40
|
+
The reducer's item vocabulary is derived from hardbor's `helper-model.js` (`Timeline`, `MessageQueue`, `stepsSummary`) and YouScript's agent `model.js`.
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { SessionSummary } from 'tandem-kit-core';
|
|
2
|
+
import type { Labels } from './labels.js';
|
|
3
|
+
import type { ChatEntry } from './types.js';
|
|
4
|
+
interface Storage {
|
|
5
|
+
getItem(key: string): string | null;
|
|
6
|
+
setItem(key: string, value: string): void;
|
|
7
|
+
removeItem(key: string): void;
|
|
8
|
+
}
|
|
9
|
+
export declare const TITLE_LIMIT = 48;
|
|
10
|
+
export declare function plainText(text: string): string;
|
|
11
|
+
export declare function titleFromText(text: string, limit?: number): string;
|
|
12
|
+
export declare class ChatDirectory {
|
|
13
|
+
private meta;
|
|
14
|
+
private readonly storage;
|
|
15
|
+
private readonly key;
|
|
16
|
+
constructor(storage: Storage | null, key: string);
|
|
17
|
+
private save;
|
|
18
|
+
title(id: string): string | null;
|
|
19
|
+
isCustom(id: string): boolean;
|
|
20
|
+
rename(id: string, title: string): boolean;
|
|
21
|
+
autoTitle(id: string, text: string): boolean;
|
|
22
|
+
remove(id: string): void;
|
|
23
|
+
isRemoved(id: string): boolean;
|
|
24
|
+
entries(sessions: SessionSummary[], activeId: string | null, labels: Labels): ChatEntry[];
|
|
25
|
+
private track;
|
|
26
|
+
}
|
|
27
|
+
export {};
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
export const TITLE_LIMIT = 48;
|
|
2
|
+
export function plainText(text) {
|
|
3
|
+
return text
|
|
4
|
+
.replace(/```[^\n]*\n?/g, ' ')
|
|
5
|
+
.replace(/!\[([^\]]*)\]\([^)]*\)/g, '$1')
|
|
6
|
+
.replace(/\[([^\]]+)\]\([^)]*\)/g, '$1')
|
|
7
|
+
.replace(/`([^`]*)`/g, '$1')
|
|
8
|
+
.replace(/(\*\*|__)(?=\S)(.+?)(?<=\S)\1/g, '$2')
|
|
9
|
+
.replace(/~~(?=\S)(.+?)(?<=\S)~~/g, '$1')
|
|
10
|
+
.replace(/(^|[\s(])([*_])(?=\S)([^*_\n]+?)(?<=\S)\2(?=$|[\s).,!?:;])/g, '$1$3')
|
|
11
|
+
.replace(/^\s{0,3}(#{1,6}|>|[-*+]|\d+[.)])\s+/gm, '')
|
|
12
|
+
.replace(/<\/?[a-z][^>]*>/gi, '');
|
|
13
|
+
}
|
|
14
|
+
export function titleFromText(text, limit = TITLE_LIMIT) {
|
|
15
|
+
const line = plainText(text).replace(/\s+/g, ' ').trim();
|
|
16
|
+
return line.length > limit ? `${line.slice(0, limit - 1).trimEnd()}…` : line;
|
|
17
|
+
}
|
|
18
|
+
export class ChatDirectory {
|
|
19
|
+
meta = { titles: {}, removed: [], order: [] };
|
|
20
|
+
storage;
|
|
21
|
+
key;
|
|
22
|
+
constructor(storage, key) {
|
|
23
|
+
this.storage = storage;
|
|
24
|
+
this.key = key;
|
|
25
|
+
try {
|
|
26
|
+
const raw = storage?.getItem(key);
|
|
27
|
+
if (raw) {
|
|
28
|
+
const parsed = JSON.parse(raw);
|
|
29
|
+
this.meta = { titles: parsed.titles ?? {}, removed: parsed.removed ?? [], order: parsed.order ?? [] };
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
catch {
|
|
33
|
+
/* unreadable metadata starts fresh */
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
save() {
|
|
37
|
+
try {
|
|
38
|
+
this.storage?.setItem(this.key, JSON.stringify(this.meta));
|
|
39
|
+
}
|
|
40
|
+
catch {
|
|
41
|
+
/* storage may be full or blocked */
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
title(id) {
|
|
45
|
+
return this.meta.titles[id]?.title ?? null;
|
|
46
|
+
}
|
|
47
|
+
isCustom(id) {
|
|
48
|
+
return Boolean(this.meta.titles[id]?.custom);
|
|
49
|
+
}
|
|
50
|
+
rename(id, title) {
|
|
51
|
+
const clean = titleFromText(title, 80);
|
|
52
|
+
if (!clean) {
|
|
53
|
+
delete this.meta.titles[id];
|
|
54
|
+
}
|
|
55
|
+
else {
|
|
56
|
+
this.meta.titles[id] = { title: clean, custom: true };
|
|
57
|
+
}
|
|
58
|
+
this.save();
|
|
59
|
+
return Boolean(clean);
|
|
60
|
+
}
|
|
61
|
+
autoTitle(id, text) {
|
|
62
|
+
if (this.meta.titles[id])
|
|
63
|
+
return false;
|
|
64
|
+
const title = titleFromText(text);
|
|
65
|
+
if (!title)
|
|
66
|
+
return false;
|
|
67
|
+
this.meta.titles[id] = { title, custom: false };
|
|
68
|
+
this.save();
|
|
69
|
+
return true;
|
|
70
|
+
}
|
|
71
|
+
remove(id) {
|
|
72
|
+
if (!this.meta.removed.includes(id))
|
|
73
|
+
this.meta.removed.push(id);
|
|
74
|
+
delete this.meta.titles[id];
|
|
75
|
+
this.save();
|
|
76
|
+
}
|
|
77
|
+
isRemoved(id) {
|
|
78
|
+
return this.meta.removed.includes(id);
|
|
79
|
+
}
|
|
80
|
+
entries(sessions, activeId, labels) {
|
|
81
|
+
const visible = sessions.filter((s) => !this.isRemoved(s.id));
|
|
82
|
+
const known = new Set(visible.map((s) => s.id));
|
|
83
|
+
const local = activeId && !known.has(activeId) && !this.isRemoved(activeId);
|
|
84
|
+
this.track(visible.map((s) => s.id));
|
|
85
|
+
const rank = new Map(this.meta.order.map((id, n) => [id, n]));
|
|
86
|
+
const next = this.meta.order.length;
|
|
87
|
+
const all = local ? [...visible, { id: activeId, status: 'idle', pending: [] }] : visible;
|
|
88
|
+
return all
|
|
89
|
+
.map((s) => ({ s, n: rank.get(s.id) ?? next }))
|
|
90
|
+
.sort((a, b) => b.n - a.n)
|
|
91
|
+
.map(({ s, n }) => ({
|
|
92
|
+
id: s.id,
|
|
93
|
+
title: this.title(s.id) ?? labels.chatTitle(n + 1),
|
|
94
|
+
custom: this.isCustom(s.id),
|
|
95
|
+
active: s.id === activeId,
|
|
96
|
+
status: s.status,
|
|
97
|
+
pending: s.pending?.length ?? 0,
|
|
98
|
+
}));
|
|
99
|
+
}
|
|
100
|
+
track(ids) {
|
|
101
|
+
const seen = new Set(this.meta.order);
|
|
102
|
+
const fresh = ids.filter((id) => !seen.has(id));
|
|
103
|
+
if (!fresh.length)
|
|
104
|
+
return;
|
|
105
|
+
this.meta.order.push(...fresh);
|
|
106
|
+
this.save();
|
|
107
|
+
}
|
|
108
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export interface SlashCommand<Ctx> {
|
|
2
|
+
name: string;
|
|
3
|
+
description: string;
|
|
4
|
+
usage?: string;
|
|
5
|
+
hidden?: boolean;
|
|
6
|
+
run(ctx: Ctx, args: string): unknown;
|
|
7
|
+
}
|
|
8
|
+
export interface ParsedCommand {
|
|
9
|
+
name: string;
|
|
10
|
+
args: string;
|
|
11
|
+
}
|
|
12
|
+
export declare function parseCommand(input: string): ParsedCommand | null;
|
|
13
|
+
export declare class SlashRegistry<Ctx> {
|
|
14
|
+
private readonly commands;
|
|
15
|
+
constructor(commands?: SlashCommand<Ctx>[]);
|
|
16
|
+
register(command: SlashCommand<Ctx>): () => void;
|
|
17
|
+
unregister(name: string): void;
|
|
18
|
+
get(name: string): SlashCommand<Ctx> | undefined;
|
|
19
|
+
list(): SlashCommand<Ctx>[];
|
|
20
|
+
suggest(input: string): SlashCommand<Ctx>[];
|
|
21
|
+
run(ctx: Ctx, input: string): Promise<'ran' | 'unknown' | 'none'>;
|
|
22
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
export function parseCommand(input) {
|
|
2
|
+
const match = /^\/([A-Za-z][\w-]*)(?:\s+([\s\S]*))?$/.exec(input.trim());
|
|
3
|
+
if (!match)
|
|
4
|
+
return null;
|
|
5
|
+
return { name: match[1].toLowerCase(), args: (match[2] ?? '').trim() };
|
|
6
|
+
}
|
|
7
|
+
export class SlashRegistry {
|
|
8
|
+
commands = new Map();
|
|
9
|
+
constructor(commands = []) {
|
|
10
|
+
for (const command of commands)
|
|
11
|
+
this.register(command);
|
|
12
|
+
}
|
|
13
|
+
register(command) {
|
|
14
|
+
this.commands.set(command.name.toLowerCase(), command);
|
|
15
|
+
return () => void this.commands.delete(command.name.toLowerCase());
|
|
16
|
+
}
|
|
17
|
+
unregister(name) {
|
|
18
|
+
this.commands.delete(name.toLowerCase());
|
|
19
|
+
}
|
|
20
|
+
get(name) {
|
|
21
|
+
return this.commands.get(name.toLowerCase());
|
|
22
|
+
}
|
|
23
|
+
list() {
|
|
24
|
+
return [...this.commands.values()].filter((command) => !command.hidden).sort((a, b) => a.name.localeCompare(b.name));
|
|
25
|
+
}
|
|
26
|
+
suggest(input) {
|
|
27
|
+
const match = /^\/([\w-]*)$/.exec(input);
|
|
28
|
+
if (!match)
|
|
29
|
+
return [];
|
|
30
|
+
const prefix = match[1].toLowerCase();
|
|
31
|
+
return this.list().filter((command) => command.name.startsWith(prefix));
|
|
32
|
+
}
|
|
33
|
+
async run(ctx, input) {
|
|
34
|
+
const parsed = parseCommand(input);
|
|
35
|
+
if (!parsed)
|
|
36
|
+
return 'none';
|
|
37
|
+
const command = this.get(parsed.name);
|
|
38
|
+
if (!command)
|
|
39
|
+
return 'unknown';
|
|
40
|
+
await command.run(ctx, parsed.args);
|
|
41
|
+
return 'ran';
|
|
42
|
+
}
|
|
43
|
+
}
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import type { ProposalEdit, SessionSummary, TandemEvent } from 'tandem-kit-core';
|
|
2
|
+
import { SlashRegistry, type SlashCommand } from './commands.js';
|
|
3
|
+
import { type Labels } from './labels.js';
|
|
4
|
+
import { MessageQueue, type QueuedMessage } from './queue.js';
|
|
5
|
+
import { Store } from './store.js';
|
|
6
|
+
import type { ChatInfo, ChatSettings, ChatTransport } from './transport.js';
|
|
7
|
+
import type { Attachment, ChatEntry, ChatState, Focus } from './types.js';
|
|
8
|
+
export interface StorageLike {
|
|
9
|
+
getItem(key: string): string | null;
|
|
10
|
+
setItem(key: string, value: string): void;
|
|
11
|
+
removeItem(key: string): void;
|
|
12
|
+
}
|
|
13
|
+
export type Connection = 'idle' | 'connecting' | 'live' | 'reconnecting' | 'closed';
|
|
14
|
+
export interface ChatSnapshot {
|
|
15
|
+
chat: ChatState;
|
|
16
|
+
sessionId: string | null;
|
|
17
|
+
connection: Connection;
|
|
18
|
+
queue: QueuedMessage[];
|
|
19
|
+
steerId: string | null;
|
|
20
|
+
sending: boolean;
|
|
21
|
+
busy: boolean;
|
|
22
|
+
draft: string;
|
|
23
|
+
focus: Focus | null;
|
|
24
|
+
references: Focus[];
|
|
25
|
+
attachments: Attachment[];
|
|
26
|
+
editing: string | null;
|
|
27
|
+
hidden: string[];
|
|
28
|
+
chats: ChatEntry[];
|
|
29
|
+
error: string | null;
|
|
30
|
+
info: ChatInfo | null;
|
|
31
|
+
sessions: SessionSummary[];
|
|
32
|
+
loaded: boolean;
|
|
33
|
+
}
|
|
34
|
+
export interface AttachmentPolicy {
|
|
35
|
+
maxFiles: number;
|
|
36
|
+
maxBytes: number;
|
|
37
|
+
maxInlineBytes: number;
|
|
38
|
+
deliver: 'auto' | 'inline' | 'transport';
|
|
39
|
+
/** `ref` (the default) sends a picture like any other file, as a tag with a reference; `parts` sends it as an image part of the message so the model sees it, when the transport takes images */
|
|
40
|
+
images: 'ref' | 'parts';
|
|
41
|
+
upload?: (attachment: Attachment) => Promise<string | null | undefined>;
|
|
42
|
+
}
|
|
43
|
+
export declare const DEFAULT_ATTACHMENT_POLICY: AttachmentPolicy;
|
|
44
|
+
export interface AttachmentInput {
|
|
45
|
+
name: string;
|
|
46
|
+
type: string;
|
|
47
|
+
size: number;
|
|
48
|
+
text?: string;
|
|
49
|
+
dataUrl?: string;
|
|
50
|
+
}
|
|
51
|
+
export interface ControllerOptions {
|
|
52
|
+
transport: ChatTransport;
|
|
53
|
+
sessionId?: string | null;
|
|
54
|
+
session?: Record<string, unknown>;
|
|
55
|
+
storage?: StorageLike | null;
|
|
56
|
+
storageKey?: string;
|
|
57
|
+
queue?: boolean;
|
|
58
|
+
commands?: boolean | SlashCommand<ChatController>[];
|
|
59
|
+
labels?: Partial<Labels>;
|
|
60
|
+
focus?: Focus | null;
|
|
61
|
+
references?: Focus[];
|
|
62
|
+
attachments?: Partial<AttachmentPolicy> | false;
|
|
63
|
+
flushMs?: number;
|
|
64
|
+
reconnectMs?: number;
|
|
65
|
+
now?: () => number;
|
|
66
|
+
}
|
|
67
|
+
export declare function defaultCommands(): SlashCommand<ChatController>[];
|
|
68
|
+
export declare class ChatController extends Store<ChatSnapshot> {
|
|
69
|
+
readonly transport: ChatTransport;
|
|
70
|
+
readonly commands: SlashRegistry<ChatController>;
|
|
71
|
+
readonly queue: MessageQueue;
|
|
72
|
+
labels: Labels;
|
|
73
|
+
private readonly options;
|
|
74
|
+
private readonly storage;
|
|
75
|
+
private readonly storageKey;
|
|
76
|
+
private readonly clock;
|
|
77
|
+
private readonly directory;
|
|
78
|
+
private readonly policy;
|
|
79
|
+
private attachmentCount;
|
|
80
|
+
private abort;
|
|
81
|
+
private generation;
|
|
82
|
+
private timer;
|
|
83
|
+
private disposed;
|
|
84
|
+
constructor(options: ControllerOptions);
|
|
85
|
+
setLabels(labels: Labels): void;
|
|
86
|
+
get snapshot(): ChatSnapshot;
|
|
87
|
+
private update;
|
|
88
|
+
private publishQueue;
|
|
89
|
+
private remember;
|
|
90
|
+
notify(level: 'info' | 'warn' | 'error', text: string): void;
|
|
91
|
+
private fail;
|
|
92
|
+
start(): Promise<void>;
|
|
93
|
+
private alive;
|
|
94
|
+
private attach;
|
|
95
|
+
private follow;
|
|
96
|
+
receive(event: TandemEvent): void;
|
|
97
|
+
private drain;
|
|
98
|
+
private capture;
|
|
99
|
+
private transportTakesFiles;
|
|
100
|
+
private compose;
|
|
101
|
+
private post;
|
|
102
|
+
submit(input: string): Promise<boolean>;
|
|
103
|
+
appendDraft(text: string): void;
|
|
104
|
+
addReference(reference: Focus): void;
|
|
105
|
+
removeReference(label: string): void;
|
|
106
|
+
setReferences(references: Focus[]): void;
|
|
107
|
+
canAttach(input: Pick<AttachmentInput, 'name' | 'type' | 'size'>): boolean;
|
|
108
|
+
addAttachment(input: AttachmentInput): Attachment | null;
|
|
109
|
+
removeAttachment(id: string): void;
|
|
110
|
+
retry(key?: string): Promise<boolean>;
|
|
111
|
+
beginEdit(key: string): boolean;
|
|
112
|
+
cancelEdit(): void;
|
|
113
|
+
deleteMessage(key: string): void;
|
|
114
|
+
private entries;
|
|
115
|
+
private titleFrom;
|
|
116
|
+
renameChat(id: string, title: string): Promise<void>;
|
|
117
|
+
deleteChat(id: string): Promise<boolean>;
|
|
118
|
+
hydrateTitles(limit?: number): Promise<void>;
|
|
119
|
+
setDraft(draft: string): void;
|
|
120
|
+
setFocus(focus: Focus | null): void;
|
|
121
|
+
removeQueued(id: string): void;
|
|
122
|
+
sendNow(id: string): Promise<void>;
|
|
123
|
+
private call;
|
|
124
|
+
stop(): Promise<boolean>;
|
|
125
|
+
compact(instructions?: string): Promise<boolean>;
|
|
126
|
+
configure(settings: ChatSettings): Promise<boolean>;
|
|
127
|
+
approve(approvalId: string, reply: {
|
|
128
|
+
allow: boolean;
|
|
129
|
+
always?: boolean;
|
|
130
|
+
message?: string;
|
|
131
|
+
mode?: string;
|
|
132
|
+
}): Promise<boolean>;
|
|
133
|
+
answer(questionId: string, answers: Record<string, string> | null): Promise<boolean>;
|
|
134
|
+
resolveClash(doc: string, clashId: string, choice: 'kept' | 'dropped'): Promise<boolean>;
|
|
135
|
+
applyProposal(id: string, options?: {
|
|
136
|
+
edit?: ProposalEdit;
|
|
137
|
+
}): Promise<boolean>;
|
|
138
|
+
discardProposal(id: string): Promise<boolean>;
|
|
139
|
+
listSessions(): Promise<SessionSummary[]>;
|
|
140
|
+
open(id: string): Promise<void>;
|
|
141
|
+
newChat(): Promise<void>;
|
|
142
|
+
dispose(): void;
|
|
143
|
+
}
|