@agentshouse/app-bridge 0.1.0-cf304386b60e3 → 0.1.0-cf41e8755eebb
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 +2 -2
- package/dist/index.d.ts +157 -421
- package/dist/mdmodel/body.d.ts +84 -0
- package/dist/mdmodel/built-in.d.ts +3 -0
- package/dist/mdmodel/definition.d.ts +23 -10
- package/dist/mdmodel/document.d.ts +13 -8
- package/dist/mdmodel/event.d.ts +3 -4
- package/dist/mdmodel/fields.d.ts +1 -1
- package/dist/mdmodel/house-model.d.ts +869 -0
- package/dist/mdmodel/house-references/crockford.d.ts +3 -0
- package/dist/mdmodel/house-references/patterns.d.ts +8 -0
- package/dist/mdmodel/index.d.ts +32 -16
- package/dist/mdmodel/indexed.d.ts +8 -0
- package/dist/mdmodel/kinds.d.ts +4 -2
- package/dist/mdmodel/markdown.d.ts +74 -0
- package/dist/mdmodel/media-type.d.ts +71 -0
- package/dist/mdmodel/moment.d.ts +6 -0
- package/dist/mdmodel/not-ready.d.ts +1 -0
- package/dist/mdmodel/paths.d.ts +15 -1
- package/dist/mdmodel/query/language.d.ts +2 -1
- package/dist/mdmodel/query/match.d.ts +1 -1
- package/dist/mdmodel/query/rows.d.ts +1 -1
- package/dist/mdmodel/query/sql.d.ts +5 -1
- package/dist/mdmodel/query/walk.d.ts +62 -0
- package/dist/mdmodel/references.d.ts +2 -2
- package/dist/mdmodel/reserved.d.ts +1 -0
- package/dist/mdmodel/room-types.d.ts +6 -0
- package/dist/mdmodel/types.d.ts +11 -17
- package/dist/mdmodel/validate.d.ts +6 -2
- package/dist/mdmodel/yaml.d.ts +4 -4
- package/dist/mdruntime/actions.d.ts +25 -0
- package/dist/mdruntime/adapter.d.ts +123 -57
- package/dist/mdruntime/attached-model.d.ts +0 -1
- package/dist/mdruntime/authored.d.ts +87 -0
- package/dist/mdruntime/bootstrap.d.ts +1 -1
- package/dist/mdruntime/cell.d.ts +5 -0
- package/dist/mdruntime/change-set.d.ts +4 -0
- package/dist/mdruntime/change.d.ts +4 -0
- package/dist/mdruntime/client.d.ts +25 -22
- package/dist/mdruntime/collection.d.ts +26 -4
- package/dist/mdruntime/compile.d.ts +2 -0
- package/dist/mdruntime/conversation-live.d.ts +151 -0
- package/dist/mdruntime/conversation-row.d.ts +8 -1
- package/dist/mdruntime/conversation.d.ts +57 -45
- package/dist/mdruntime/declaration.d.ts +9 -0
- package/dist/mdruntime/durability.d.ts +14 -0
- package/dist/mdruntime/failure.d.ts +3 -0
- package/dist/mdruntime/figures.d.ts +1 -0
- package/dist/mdruntime/holdings.d.ts +28 -0
- package/dist/mdruntime/house-query.d.ts +14 -0
- package/dist/mdruntime/install.d.ts +59 -0
- package/dist/mdruntime/listing.d.ts +59 -0
- package/dist/mdruntime/live.d.ts +5 -3
- package/dist/mdruntime/media.d.ts +19 -2
- package/dist/mdruntime/messages.d.ts +12 -6
- package/dist/mdruntime/modal.d.ts +1 -0
- package/dist/mdruntime/model.d.ts +4 -3
- package/dist/mdruntime/observation.d.ts +29 -12
- package/dist/mdruntime/opened.d.ts +1 -1
- package/dist/mdruntime/outcome.d.ts +16 -2
- package/dist/mdruntime/overlay.d.ts +6 -2
- package/dist/mdruntime/preparation.d.ts +45 -0
- package/dist/mdruntime/presence.d.ts +57 -0
- package/dist/mdruntime/query.d.ts +0 -1
- package/dist/mdruntime/reach.d.ts +16 -5
- package/dist/mdruntime/readiness.d.ts +20 -5
- package/dist/mdruntime/reads.d.ts +5 -2
- package/dist/mdruntime/recovery.d.ts +4 -1
- package/dist/mdruntime/replica.d.ts +5 -10
- package/dist/mdruntime/retried.d.ts +29 -0
- package/dist/mdruntime/room-draft.d.ts +31 -8
- package/dist/mdruntime/room-drafts.d.ts +7 -12
- package/dist/mdruntime/runtime.d.ts +34 -0
- package/dist/mdruntime/save.d.ts +42 -86
- package/dist/mdruntime/saves.d.ts +8 -70
- package/dist/mdruntime/seed.d.ts +3 -8
- package/dist/mdruntime/socket/lanes.d.ts +27 -0
- package/dist/mdruntime/socket/session.d.ts +40 -0
- package/dist/mdruntime/socket.d.ts +30 -5
- package/dist/mdruntime/source.d.ts +5 -7
- package/dist/mdruntime/store/installs.d.ts +2 -2
- package/dist/mdruntime/store/readiness.d.ts +10 -0
- package/dist/mdruntime/store/records.d.ts +23 -8
- package/dist/mdruntime/store/rooms-shown.d.ts +7 -0
- package/dist/mdruntime/store/space.d.ts +10 -0
- package/dist/mdruntime/store/watchers.d.ts +2 -0
- package/dist/mdruntime/store.d.ts +49 -9
- package/dist/mdruntime/stored.d.ts +33 -15
- package/dist/mdruntime/{connection.d.ts → surface.d.ts} +31 -67
- package/dist/mdruntime/tables.d.ts +28 -59
- package/dist/mdruntime/wire.d.ts +68 -8
- package/dist/session-content/check.d.ts +17 -0
- package/dist/session-content/index.d.ts +6 -0
- package/dist/session-content/parts.d.ts +30 -0
- package/dist/session-content/state.d.ts +59 -0
- package/dist/session-content/turn.d.ts +137 -0
- package/dist/test-host.d.ts +8 -1
- package/dist/test-host.js +44 -1
- package/docs/families.md +61 -33
- package/package.json +2 -2
- package/dist/mdmodel/blocks.d.ts +0 -10
- package/dist/mdmodel/links.d.ts +0 -28
- package/dist/mdmodel/profile.d.ts +0 -5
- package/dist/mdruntime/job.d.ts +0 -32
- package/dist/mdruntime/log.d.ts +0 -5
- package/dist/mdruntime/store/fences.d.ts +0 -15
- package/dist/mdruntime/turn.d.ts +0 -8
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import type { SessionState } from '../session-content/index.js';
|
|
2
|
+
import type { AcceptedMessage, ConversationAction, ConversationHistoryRequest, ConversationStream, ListedAgent, ListedConversation, ProcessCommand, SessionOption } from './adapter.js';
|
|
3
|
+
import { type Cell } from './cell.js';
|
|
4
|
+
import type { ChangeSet } from './change-set.js';
|
|
5
|
+
import type { Asked, ConversationAgent, ConversationEntry, ConversationView, RunningTurn } from './conversation.js';
|
|
6
|
+
import type { CallResult } from './outcome.js';
|
|
7
|
+
import type { Recovery } from './recovery.js';
|
|
8
|
+
import type { Attempt, Retries } from './retried.js';
|
|
9
|
+
import type { ChatDraftRecord, RuntimeStore } from './store.js';
|
|
10
|
+
export type ConversationDependencies = {
|
|
11
|
+
call(name: ConversationAction, input: unknown, attempt?: Attempt): Promise<CallResult>;
|
|
12
|
+
history(request: ConversationHistoryRequest): Promise<CallResult>;
|
|
13
|
+
durably<T>(work: (local: RuntimeStore) => Promise<T>): Promise<T>;
|
|
14
|
+
local(): Promise<RuntimeStore>;
|
|
15
|
+
again(): void;
|
|
16
|
+
settled(): void;
|
|
17
|
+
stream(): ConversationStream | undefined;
|
|
18
|
+
publish(set: ChangeSet): void;
|
|
19
|
+
online(): boolean;
|
|
20
|
+
full(): boolean;
|
|
21
|
+
closed(): boolean;
|
|
22
|
+
unanswered(): void;
|
|
23
|
+
heard(operation: string, lost: boolean): void;
|
|
24
|
+
readonly recovery: Recovery;
|
|
25
|
+
readonly retries: Retries;
|
|
26
|
+
};
|
|
27
|
+
export type Live = {
|
|
28
|
+
turn: RunningTurn | null;
|
|
29
|
+
questions: readonly unknown[];
|
|
30
|
+
process: {
|
|
31
|
+
running: boolean;
|
|
32
|
+
} | null;
|
|
33
|
+
commands: readonly ProcessCommand[];
|
|
34
|
+
options: readonly SessionOption[];
|
|
35
|
+
starting: string | null;
|
|
36
|
+
state: SessionState | null;
|
|
37
|
+
link: {
|
|
38
|
+
connected: boolean;
|
|
39
|
+
} | null;
|
|
40
|
+
deliveryWaiting: readonly string[];
|
|
41
|
+
deliveryUnknown: readonly string[];
|
|
42
|
+
};
|
|
43
|
+
export declare const QUIET: Live;
|
|
44
|
+
export type Fact = Exclude<keyof Live, 'turn'>;
|
|
45
|
+
export declare const FACTS: readonly Fact[];
|
|
46
|
+
type Watcher = {
|
|
47
|
+
readonly notify: (view: ConversationView) => void;
|
|
48
|
+
};
|
|
49
|
+
export type Kept = {
|
|
50
|
+
readonly draft: ChatDraftRecord | null;
|
|
51
|
+
readonly ended: string | null;
|
|
52
|
+
readonly dismissed: string | null;
|
|
53
|
+
readonly pins: readonly string[];
|
|
54
|
+
};
|
|
55
|
+
type HeldWindow = Kept & {
|
|
56
|
+
readonly window: readonly AcceptedMessage[] | null;
|
|
57
|
+
readonly more: boolean;
|
|
58
|
+
readonly total: number | null;
|
|
59
|
+
};
|
|
60
|
+
export type SharedView = {
|
|
61
|
+
readonly conversation: string;
|
|
62
|
+
readonly asked: Asked;
|
|
63
|
+
readonly held: Cell<HeldWindow>;
|
|
64
|
+
ready(): readonly Watcher[];
|
|
65
|
+
join(watcher: Watcher): void;
|
|
66
|
+
admit(watcher: Watcher): boolean;
|
|
67
|
+
leave(watcher: Watcher): boolean;
|
|
68
|
+
empty(): boolean;
|
|
69
|
+
};
|
|
70
|
+
type Listing<T> = (value: T) => void;
|
|
71
|
+
export type Audience<T> = {
|
|
72
|
+
waiting(): boolean;
|
|
73
|
+
told(): boolean;
|
|
74
|
+
join(watcher: Listing<T>): void;
|
|
75
|
+
leave(watcher: Listing<T>): void;
|
|
76
|
+
tell(value: T): void;
|
|
77
|
+
welcome(value: T): void;
|
|
78
|
+
clear(): void;
|
|
79
|
+
};
|
|
80
|
+
type HeldFacts = {
|
|
81
|
+
readonly listKnown: boolean;
|
|
82
|
+
readonly listHeld: boolean;
|
|
83
|
+
readonly openingRead: boolean;
|
|
84
|
+
readonly openingListed: boolean;
|
|
85
|
+
readonly listOwed: boolean;
|
|
86
|
+
readonly listTelling: boolean;
|
|
87
|
+
readonly agentsShown: string | null;
|
|
88
|
+
readonly listedShown: string | null;
|
|
89
|
+
readonly replicated: ReadonlySet<string>;
|
|
90
|
+
readonly handedReplicated: string | undefined;
|
|
91
|
+
};
|
|
92
|
+
export type Dispatch = Cell<{
|
|
93
|
+
readonly answered: boolean;
|
|
94
|
+
}>;
|
|
95
|
+
export type Relisted = {
|
|
96
|
+
readonly conversations: ReadonlyMap<string, ListedConversation>;
|
|
97
|
+
readonly agents: ReadonlyMap<string, ListedAgent>;
|
|
98
|
+
};
|
|
99
|
+
export type LiveConversations = {
|
|
100
|
+
readonly deps: ConversationDependencies;
|
|
101
|
+
readonly held: Cell<HeldFacts>;
|
|
102
|
+
readonly closing: AbortSignal;
|
|
103
|
+
readonly listeners: Audience<readonly ConversationEntry[]>;
|
|
104
|
+
readonly agentListeners: Audience<readonly ConversationAgent[]>;
|
|
105
|
+
readonly listedListeners: Audience<readonly ListedAgent[]>;
|
|
106
|
+
views(): Iterable<SharedView>;
|
|
107
|
+
viewJoined(key: string, conversation: string, asked: Asked, notify: (view: ConversationView) => void): {
|
|
108
|
+
readonly view: SharedView;
|
|
109
|
+
readonly watcher: Watcher;
|
|
110
|
+
};
|
|
111
|
+
viewLeft(key: string, view: SharedView, watcher: Watcher): void;
|
|
112
|
+
liveOf(conversation: string): Live;
|
|
113
|
+
liveHeld(conversation: string): Live | undefined;
|
|
114
|
+
holdLive(conversation: string, next: Live | null): void;
|
|
115
|
+
factsOwed(conversation: string): void;
|
|
116
|
+
factsHeard(conversation: string, facts: readonly Fact[]): void;
|
|
117
|
+
factsTaken(): readonly (readonly [string, ReadonlySet<Fact>])[];
|
|
118
|
+
behind(conversation: string): boolean;
|
|
119
|
+
behindAll(): readonly string[];
|
|
120
|
+
fellBehind(conversation: string): void;
|
|
121
|
+
caughtUpTo(conversation: string): void;
|
|
122
|
+
gapOpened(conversation: string): void;
|
|
123
|
+
generation(conversation: string): number;
|
|
124
|
+
heardAt(conversation: string, change: string): void;
|
|
125
|
+
newestHeard(conversation: string): string | undefined;
|
|
126
|
+
catching(conversation: string): Promise<void> | undefined;
|
|
127
|
+
catchingUntil(conversation: string, ended: Promise<void>): void;
|
|
128
|
+
creating(conversation: string): void;
|
|
129
|
+
created(conversation: string): void;
|
|
130
|
+
isCreating(conversation: string): boolean;
|
|
131
|
+
relisting(): boolean;
|
|
132
|
+
relistBegun(): void;
|
|
133
|
+
relistHeard(entries: readonly ListedConversation[], agents: readonly ListedAgent[]): void;
|
|
134
|
+
relistDropped(conversation: string): void;
|
|
135
|
+
relistTaken(): Relisted | null;
|
|
136
|
+
sendingBegan(operation: string): Dispatch;
|
|
137
|
+
sendingEnded(operation: string, dispatch: Dispatch): void;
|
|
138
|
+
sending(operation: string): boolean;
|
|
139
|
+
rowSoon(tell: () => void): void;
|
|
140
|
+
inOrder(work: () => Promise<void>): void;
|
|
141
|
+
forget(conversation: string): void;
|
|
142
|
+
current(): boolean;
|
|
143
|
+
known(): boolean;
|
|
144
|
+
listHeld(): boolean;
|
|
145
|
+
listed(): boolean;
|
|
146
|
+
reopened(): void;
|
|
147
|
+
lost(): void;
|
|
148
|
+
close(): void;
|
|
149
|
+
};
|
|
150
|
+
export declare function createLiveConversations(deps: ConversationDependencies): LiveConversations;
|
|
151
|
+
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { HeldRow } from './messages.js';
|
|
2
|
-
import { type HouseSource } from './source.js';
|
|
2
|
+
import { type HouseSource, type RequestAnswer } from './source.js';
|
|
3
3
|
export type ConversationLast = {
|
|
4
4
|
readonly text: string;
|
|
5
5
|
readonly by: 'owner' | 'agent' | 'house';
|
|
@@ -10,18 +10,25 @@ export type ConversationStart = Extract<HouseSource, {
|
|
|
10
10
|
}>;
|
|
11
11
|
export type ConversationAsk = {
|
|
12
12
|
readonly who: string;
|
|
13
|
+
readonly fromRoom: boolean;
|
|
13
14
|
readonly agent: string | null;
|
|
14
15
|
readonly room: {
|
|
15
16
|
readonly ref: string;
|
|
17
|
+
readonly handle: string;
|
|
16
18
|
readonly name: string;
|
|
17
19
|
};
|
|
18
20
|
readonly prompt: string;
|
|
21
|
+
readonly agentFunction: string | null;
|
|
22
|
+
readonly answer: RequestAnswer | null;
|
|
23
|
+
readonly instruction: string | null;
|
|
19
24
|
readonly at: string;
|
|
20
25
|
readonly request: string;
|
|
21
26
|
readonly message?: string;
|
|
22
27
|
};
|
|
23
28
|
export type ConversationHeld = {
|
|
24
29
|
readonly last: ConversationLast | null;
|
|
30
|
+
readonly answered: string | null;
|
|
31
|
+
readonly opened: string | null;
|
|
25
32
|
readonly failure: string | null;
|
|
26
33
|
readonly startedBy: ConversationStart | null;
|
|
27
34
|
readonly asks: ConversationAsk | null;
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { type Part, type SessionState } from '../session-content/index.js';
|
|
2
|
+
import type { AgentEnvironment, ConversationEvent, ConversationMessage, ListedAgent, ProcessCommand, SessionOption } from './adapter.js';
|
|
2
3
|
import { type ChangeSet } from './change-set.js';
|
|
4
|
+
import { type LiveConversations } from './conversation-live.js';
|
|
3
5
|
import { type ConversationHeld } from './conversation-row.js';
|
|
4
|
-
import type { OpenJob } from './job.js';
|
|
5
6
|
import type { Open } from './open.js';
|
|
6
|
-
import { type CallResult, type Offline } from './outcome.js';
|
|
7
|
+
import { type BinaryLinkAnswer, type CallResult, type ConversationAttachAnswer, type Offline } from './outcome.js';
|
|
8
|
+
import type { ChatRequest } from './source.js';
|
|
7
9
|
import type { CycleProgress } from './status.js';
|
|
8
10
|
import type { RuntimeStore } from './store.js';
|
|
9
11
|
export type ConversationState = Open<'working' | 'asking' | 'idle'>;
|
|
@@ -12,26 +14,32 @@ export type ConversationEntry = ConversationHeld & {
|
|
|
12
14
|
agent: {
|
|
13
15
|
identity: string;
|
|
14
16
|
name: string;
|
|
17
|
+
retired: boolean;
|
|
15
18
|
};
|
|
16
19
|
name: string;
|
|
17
20
|
created: string;
|
|
18
21
|
finished: string | null;
|
|
19
22
|
outcome: string | null;
|
|
20
23
|
waiting: boolean;
|
|
24
|
+
subject: string | null;
|
|
21
25
|
state: ConversationState;
|
|
22
26
|
started: string | null;
|
|
23
27
|
line: string | null;
|
|
24
28
|
question: string | null;
|
|
29
|
+
asked: string | null;
|
|
25
30
|
};
|
|
26
31
|
export type ConversationAgent = {
|
|
27
32
|
identity: string;
|
|
28
33
|
name: string;
|
|
34
|
+
cli: string;
|
|
35
|
+
model: string | null;
|
|
36
|
+
effort: string | null;
|
|
37
|
+
environment: AgentEnvironment;
|
|
29
38
|
};
|
|
30
39
|
export type RunningTurn = {
|
|
31
40
|
turn: string;
|
|
32
41
|
started: string | null;
|
|
33
|
-
parts: readonly
|
|
34
|
-
context: TurnContext | null;
|
|
42
|
+
parts: readonly Part[];
|
|
35
43
|
};
|
|
36
44
|
export type ChatDraft = {
|
|
37
45
|
text: string;
|
|
@@ -58,26 +66,40 @@ export type ConversationView = {
|
|
|
58
66
|
commands: readonly ProcessCommand[];
|
|
59
67
|
options: readonly SessionOption[];
|
|
60
68
|
starting: string | null;
|
|
61
|
-
|
|
69
|
+
state: SessionState | null;
|
|
62
70
|
link: {
|
|
63
71
|
connected: boolean;
|
|
64
72
|
} | null;
|
|
73
|
+
deliveryWaiting: readonly string[];
|
|
65
74
|
deliveryUnknown: readonly string[];
|
|
66
75
|
chatDraft: (ChatDraft & {
|
|
67
76
|
readonly revision: string;
|
|
68
77
|
}) | null;
|
|
69
|
-
|
|
78
|
+
dismissedSuggestion: string | null;
|
|
79
|
+
pins: readonly string[];
|
|
70
80
|
};
|
|
81
|
+
export type RequestDecision = 'approve' | 'decline';
|
|
71
82
|
export type ConversationSurface = {
|
|
72
83
|
list(): Promise<readonly ConversationEntry[]>;
|
|
73
84
|
read(conversation: string, options?: ConversationRead): Promise<ConversationView>;
|
|
74
85
|
create(input: unknown): Promise<CallResult>;
|
|
75
86
|
send(conversation: string, operation?: string, draft?: ChatDraft): Promise<CallResult | Offline>;
|
|
76
|
-
answer(conversation: string, answer: ConversationAnswer): Promise<CallResult>;
|
|
77
|
-
interrupt(conversation: string): Promise<CallResult>;
|
|
78
|
-
kill(conversation: string): Promise<CallResult>;
|
|
79
|
-
delete(conversation: string): Promise<CallResult>;
|
|
87
|
+
answer(conversation: string, answer: ConversationAnswer, operation: string): Promise<CallResult>;
|
|
88
|
+
interrupt(conversation: string, operation: string): Promise<CallResult>;
|
|
89
|
+
kill(conversation: string, operation: string): Promise<CallResult>;
|
|
90
|
+
delete(conversation: string, operation: string): Promise<CallResult>;
|
|
91
|
+
takeOut(conversation: string, message: string, operation: string): Promise<CallResult>;
|
|
92
|
+
decide(request: ChatRequest, decision: RequestDecision, operation: string): Promise<CallResult>;
|
|
93
|
+
rename(conversation: string, name: string, operation: string): Promise<CallResult>;
|
|
94
|
+
option(conversation: string, option: string, value: string | boolean, operation: string): Promise<CallResult>;
|
|
95
|
+
retry(conversation: string, message: string, operation: string): Promise<CallResult>;
|
|
96
|
+
pin(figures: readonly string[]): Promise<void>;
|
|
97
|
+
openTurn(conversation: string, turn: string): Promise<void>;
|
|
98
|
+
dismissSuggestion(conversation: string, suggestion: string): Promise<void>;
|
|
99
|
+
attach(file: File): Promise<ConversationAttachAnswer>;
|
|
100
|
+
attachment(link: string): Promise<BinaryLinkAnswer>;
|
|
80
101
|
};
|
|
102
|
+
export type ConversationFiles = Pick<ConversationSurface, 'attach' | 'attachment'>;
|
|
81
103
|
export type ConversationAnswer = {
|
|
82
104
|
interaction_id: string;
|
|
83
105
|
response: unknown;
|
|
@@ -85,43 +107,33 @@ export type ConversationAnswer = {
|
|
|
85
107
|
export type ChatDraftSurface = {
|
|
86
108
|
write(conversation: string, draft: ChatDraft, revision?: string): Promise<void>;
|
|
87
109
|
prepend(conversation: string, draft: ChatDraft): Promise<void>;
|
|
110
|
+
append(conversation: string, draft: ChatDraft): Promise<void>;
|
|
88
111
|
discard(conversation: string): Promise<void>;
|
|
89
112
|
};
|
|
90
|
-
export type ConversationDependencies = {
|
|
91
|
-
call(name: ConversationAction, input: unknown): Promise<CallResult>;
|
|
92
|
-
history(request: ConversationHistoryRequest): Promise<CallResult>;
|
|
93
|
-
durably<T>(work: (local: RuntimeStore) => Promise<T>): Promise<T>;
|
|
94
|
-
local(): Promise<RuntimeStore>;
|
|
95
|
-
again(): void;
|
|
96
|
-
settled(): void;
|
|
97
|
-
stream(): ConversationStream | undefined;
|
|
98
|
-
publish(set: ChangeSet): void;
|
|
99
|
-
online(): boolean;
|
|
100
|
-
full(): boolean;
|
|
101
|
-
closed(): boolean;
|
|
102
|
-
unanswered(): void;
|
|
103
|
-
};
|
|
104
|
-
export type ConversationStore = {
|
|
105
|
-
surface: ConversationSurface;
|
|
106
|
-
chatDraft: ChatDraftSurface;
|
|
107
|
-
opened(local: RuntimeStore): Promise<void>;
|
|
108
|
-
reconcile(): Promise<void>;
|
|
109
|
-
catchUp(progress: CycleProgress): Promise<void>;
|
|
110
|
-
resend(progress: CycleProgress): Promise<void>;
|
|
111
|
-
current(): boolean;
|
|
112
|
-
known(): boolean;
|
|
113
|
-
learned(): void;
|
|
114
|
-
reopened(): void;
|
|
115
|
-
lost(): void;
|
|
116
|
-
watch(conversation: string, options: ConversationOptions, deliver: (view: ConversationView) => void): () => void;
|
|
117
|
-
watchList(deliver: (entries: readonly ConversationEntry[]) => void): () => void;
|
|
118
|
-
watchAgents(deliver: (agents: readonly ConversationAgent[]) => void): () => void;
|
|
119
|
-
changed(set: ChangeSet): void;
|
|
120
|
-
receive(event: ConversationEvent): void;
|
|
121
|
-
close(): void;
|
|
122
|
-
};
|
|
123
113
|
export declare function unheldView(conversation: string): ConversationView;
|
|
124
114
|
export declare const SESSION_STARTED = "Session started";
|
|
115
|
+
export declare const CATCHING_UP = "catching-up";
|
|
125
116
|
export declare const HISTORY_CONVERSATIONS = 64;
|
|
126
117
|
export declare function newChat(agent: string): string;
|
|
127
|
-
export
|
|
118
|
+
export type Asked = {
|
|
119
|
+
limit: number;
|
|
120
|
+
after: string | undefined;
|
|
121
|
+
before: readonly [string, string] | null;
|
|
122
|
+
total: boolean;
|
|
123
|
+
};
|
|
124
|
+
export declare function joinedDraft(first: string, second: string): string;
|
|
125
|
+
export declare function conversationsLearned(alive: LiveConversations): void;
|
|
126
|
+
export declare function conversationSurface(alive: LiveConversations, files: ConversationFiles): ConversationSurface;
|
|
127
|
+
export declare function chatDraftSurface(alive: LiveConversations): ChatDraftSurface;
|
|
128
|
+
export declare function conversationsOpened(alive: LiveConversations, local: RuntimeStore): Promise<void>;
|
|
129
|
+
export declare function reconcileOpening(alive: LiveConversations): Promise<void>;
|
|
130
|
+
export declare function reconcileConversations(alive: LiveConversations): Promise<void>;
|
|
131
|
+
export declare function catchUpConversations(alive: LiveConversations, progress: CycleProgress): Promise<void>;
|
|
132
|
+
export declare function holdsSubmission(alive: LiveConversations, operation: string): Promise<boolean>;
|
|
133
|
+
export declare function resendConversations(alive: LiveConversations, progress: CycleProgress): Promise<void>;
|
|
134
|
+
export declare function watchConversation(alive: LiveConversations, conversation: string, options: ConversationOptions, deliver: (view: ConversationView) => void): () => void;
|
|
135
|
+
export declare function watchConversationList(alive: LiveConversations, deliver: (entries: readonly ConversationEntry[]) => void): () => void;
|
|
136
|
+
export declare function watchConversationAgents(alive: LiveConversations, deliver: (agents: readonly ConversationAgent[]) => void): () => void;
|
|
137
|
+
export declare function watchListedAgents(alive: LiveConversations, deliver: (agents: readonly ListedAgent[]) => void): () => void;
|
|
138
|
+
export declare function conversationsChanged(alive: LiveConversations, set: ChangeSet): void;
|
|
139
|
+
export declare function receiveConversationEvent(alive: LiveConversations, event: ConversationEvent): void;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { DiscoveredRoom, OperationScopes, PathRule, RoomDeclaration } from './adapter.js';
|
|
2
|
+
export type WriteRefusal = {
|
|
3
|
+
readonly code: 'room-root' | 'provider-owned-path' | 'invalid-path' | `${keyof OperationScopes}-grant`;
|
|
4
|
+
readonly path: string;
|
|
5
|
+
};
|
|
6
|
+
export type WriteRule = (path: string, needs: readonly (keyof OperationScopes)[]) => WriteRefusal | null;
|
|
7
|
+
export declare function declared({ locator: _locator, roomVersion: _roomVersion, ...declaration }: DiscoveredRoom): RoomDeclaration;
|
|
8
|
+
export declare function sameDeclaration(left: RoomDeclaration, right: RoomDeclaration): boolean;
|
|
9
|
+
export declare function writeRule({ operations, providerOwnedPaths, authoredPaths, }: Pick<RoomDeclaration, 'operations' | 'providerOwnedPaths' | 'authoredPaths'>, pathRule: PathRule, local: boolean): WriteRule;
|
|
@@ -1,17 +1,31 @@
|
|
|
1
1
|
import type { Persistence } from './readiness.js';
|
|
2
|
+
import type { RetriedFailure, Step } from './retried.js';
|
|
2
3
|
export type UnsentKind = 'pending-change' | 'call' | 'room-draft' | 'chat-draft';
|
|
3
4
|
export type UnsentWork = {
|
|
4
5
|
readonly kind: UnsentKind;
|
|
5
6
|
readonly count: number;
|
|
6
7
|
};
|
|
8
|
+
export declare function leftToSend(unsent: readonly UnsentWork[]): boolean;
|
|
9
|
+
export type AppCode = {
|
|
10
|
+
readonly running: number;
|
|
11
|
+
readonly older: number;
|
|
12
|
+
};
|
|
13
|
+
export type HeldCode = {
|
|
14
|
+
readonly house: number | null;
|
|
15
|
+
readonly apps: readonly string[];
|
|
16
|
+
};
|
|
7
17
|
export type RuntimeShell = {
|
|
8
18
|
persistence: Persistence;
|
|
9
19
|
generation: string | null;
|
|
10
20
|
keepGeneration(value: string): void | Promise<void>;
|
|
11
21
|
dropGeneration(): void | Promise<void>;
|
|
12
22
|
cleanUp?(): Promise<number>;
|
|
23
|
+
measure?(measured: (app: string, code: AppCode | null) => void): Promise<HeldCode>;
|
|
13
24
|
reset(): Promise<void>;
|
|
25
|
+
retried?(failure: RetriedFailure): void;
|
|
26
|
+
succeeded?(step: Step): void;
|
|
14
27
|
};
|
|
15
28
|
export declare function refusedForSpace(error: unknown): boolean;
|
|
16
29
|
export declare function detectStorageLoss(stored: string | null, reported: string | null): string | null;
|
|
30
|
+
export declare function lossStated(persistence: Persistence, loss: string | null): string | null;
|
|
17
31
|
export declare function nextGeneration(stored: string | null, reported: string | null): string;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { ProviderRefusal } from './adapter.js';
|
|
1
2
|
export type RuntimeError = Error & {
|
|
2
3
|
readonly code: string;
|
|
3
4
|
readonly retryable: boolean;
|
|
@@ -8,5 +9,7 @@ export type Described = {
|
|
|
8
9
|
retryable: boolean;
|
|
9
10
|
};
|
|
10
11
|
export declare function runtimeError(code: string, message?: string, retryable?: boolean): RuntimeError;
|
|
12
|
+
export declare function refusalError(refusal: ProviderRefusal): RuntimeError;
|
|
11
13
|
export declare function failed(error: unknown): RuntimeError;
|
|
14
|
+
export declare function uncaught(error: unknown): void;
|
|
12
15
|
export declare function described(error: unknown): Described;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { AppCode } from './durability.js';
|
|
2
|
+
import type { GroupTotal, PendingResult } from './query.js';
|
|
3
|
+
import type { Deliver, Fail } from './reach.js';
|
|
4
|
+
import type { Runtime } from './runtime.js';
|
|
5
|
+
import type { OpenedRoom } from './tables.js';
|
|
6
|
+
export type RoomDocuments = {
|
|
7
|
+
readonly room: string;
|
|
8
|
+
readonly documents: GroupTotal;
|
|
9
|
+
};
|
|
10
|
+
export type HeldApp = ({
|
|
11
|
+
readonly app: string;
|
|
12
|
+
readonly state: 'measured';
|
|
13
|
+
} & AppCode) | {
|
|
14
|
+
readonly app: string;
|
|
15
|
+
readonly state: 'asking' | 'unknown';
|
|
16
|
+
};
|
|
17
|
+
export type Holdings = {
|
|
18
|
+
readonly rooms: readonly RoomDocuments[] | PendingResult;
|
|
19
|
+
readonly opened: GroupTotal & {
|
|
20
|
+
readonly rooms: readonly OpenedRoom[];
|
|
21
|
+
};
|
|
22
|
+
readonly apps: readonly HeldApp[];
|
|
23
|
+
readonly house: number | null;
|
|
24
|
+
readonly total: number | null;
|
|
25
|
+
readonly cleanUp: number | null;
|
|
26
|
+
};
|
|
27
|
+
export declare const CLEANED_TOPIC = "cleaned";
|
|
28
|
+
export declare function watchHoldings({ store, figures, shell }: Runtime, deliver: Deliver, fail: Fail): () => void;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { type DocumentQuery, type GroupQuery } from '../mdmodel/index.js';
|
|
2
|
+
import type { HouseQueryGroups, HouseQueryRows, ProviderRefusal } from './adapter.js';
|
|
3
|
+
import { type Failure, type Offline } from './outcome.js';
|
|
4
|
+
import { type PortReach } from './reach.js';
|
|
5
|
+
import type { Runtime } from './runtime.js';
|
|
6
|
+
export type HouseQuery = (DocumentQuery | GroupQuery) & {
|
|
7
|
+
rooms: readonly [string];
|
|
8
|
+
};
|
|
9
|
+
export type HouseQueryResult = HouseQueryRows | HouseQueryGroups | Offline | (ProviderRefusal & {
|
|
10
|
+
kind: 'rejected';
|
|
11
|
+
}) | (ProviderRefusal & {
|
|
12
|
+
kind: 'undeclared';
|
|
13
|
+
}) | Failure;
|
|
14
|
+
export declare function queriedHouse(runtime: Runtime, input: unknown, reach: PortReach | null): Promise<HouseQueryResult>;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import type { AdapterFailure, Authorization, DiscoveredRoom, NotReady, RetryableRefusal } from './adapter.js';
|
|
2
|
+
import { type Reads } from './bootstrap.js';
|
|
3
|
+
import type { Installation, InstallationAmount, RoomCoverage } from './readiness.js';
|
|
4
|
+
import { advancement, type Refresher } from './refresh.js';
|
|
5
|
+
import type { ReplicaRecord } from './replica.js';
|
|
6
|
+
import type { Runtime } from './runtime.js';
|
|
7
|
+
import type { Live } from './socket.js';
|
|
8
|
+
import { type CoveredRoom, type InstallHold, type RuntimeStore, type Store } from './store.js';
|
|
9
|
+
import { type Unconfirmed } from './transfer.js';
|
|
10
|
+
type Standing = {
|
|
11
|
+
readonly key: number | null;
|
|
12
|
+
readonly confirmed: number;
|
|
13
|
+
};
|
|
14
|
+
export type Unheld = {
|
|
15
|
+
readonly staged: boolean;
|
|
16
|
+
};
|
|
17
|
+
export type Withheld = AdapterFailure | RetryableRefusal | NotReady | Unconfirmed;
|
|
18
|
+
type Landing = {
|
|
19
|
+
readonly kind: 'refreshed';
|
|
20
|
+
readonly from: Standing;
|
|
21
|
+
readonly remodelled: boolean;
|
|
22
|
+
} | {
|
|
23
|
+
readonly kind: 'bootstrapped';
|
|
24
|
+
readonly refreshed: boolean;
|
|
25
|
+
readonly from: Standing;
|
|
26
|
+
};
|
|
27
|
+
type Refreshed = {
|
|
28
|
+
kind: 'advanced';
|
|
29
|
+
record: ReplicaRecord;
|
|
30
|
+
from: Standing;
|
|
31
|
+
remodelled: boolean;
|
|
32
|
+
} | Exclude<Awaited<ReturnType<typeof advancement>>, {
|
|
33
|
+
kind: 'advanced';
|
|
34
|
+
}>;
|
|
35
|
+
export declare const ERASE_BATCH = 512;
|
|
36
|
+
export type InstallShare = {
|
|
37
|
+
readonly installing: boolean;
|
|
38
|
+
readonly downloading: boolean;
|
|
39
|
+
readonly bytes: InstallationAmount;
|
|
40
|
+
};
|
|
41
|
+
export declare function installShare(store: Store, { room, state }: RoomCoverage, held: ReadonlyMap<string, CoveredRoom>): InstallShare;
|
|
42
|
+
export declare function installationOf(installing: number, downloading: number, bytes: InstallationAmount): Installation;
|
|
43
|
+
export declare function roomInFlight(store: Store, locator: string): boolean;
|
|
44
|
+
export declare function sweep({ store, socket }: Runtime): void;
|
|
45
|
+
export declare function caughtUpTo(runtime: Runtime, locator: string): void;
|
|
46
|
+
export declare function catching(store: Store, locator: string): void;
|
|
47
|
+
export declare function standingAt(store: Store, locator: string, held: Pick<ReplicaRecord, 'key'> | undefined): Standing;
|
|
48
|
+
export declare function showing(system: Runtime, locator: string, roomVersion: string, held: string | undefined): void;
|
|
49
|
+
export declare function olderThan(system: Runtime, locator: string, roomVersion: string, held: string | undefined): boolean;
|
|
50
|
+
export declare function replaced(store: Store, locators: readonly string[]): void;
|
|
51
|
+
export declare function reachedBy({ store, socket }: Runtime, locator: string, roomVersion: string): Promise<boolean>;
|
|
52
|
+
export declare function behind({ store, socket }: Runtime, room: DiscoveredRoom): Promise<boolean>;
|
|
53
|
+
export declare function writtenAfter({ store, socket }: Runtime, locator: string, roomVersion: string, path: string): Promise<boolean>;
|
|
54
|
+
export declare function pullRefresh(runtime: Runtime, authorized: Authorization, record: ReplicaRecord, liveness: Live, hold: InstallHold, refresh: Refresher): Promise<Refreshed>;
|
|
55
|
+
export declare function pullBootstrap(runtime: Runtime, authorized: Authorization, room: DiscoveredRoom, local: RuntimeStore, liveness: Live, prior: ReplicaRecord | undefined, from?: Reads, unheld?: Unheld): Promise<import("./bootstrap.js").Bootstrapped | NotReady | import("./adapter.js").RevokedAuthorization | import("./adapter.js").RoomNotReadable | import("./adapter.js").TransportUncertainty | Unconfirmed | {
|
|
56
|
+
readonly kind: 'transport-uncertainty';
|
|
57
|
+
} | RetryableRefusal | import("./adapter.js").ScopedRefusal>;
|
|
58
|
+
export declare function publish(runtime: Runtime, local: RuntimeStore, room: DiscoveredRoom, reached: ReplicaRecord, landing: Landing, live: Live): Promise<boolean>;
|
|
59
|
+
export {};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import type { HeldRooms } from '../mdmodel/index.js';
|
|
2
|
+
import type { DiscoveredRoom, HeldRoom, OperationScopes, ProviderRefusal, ReplicaAdmission, RoomDeclaration } from './adapter.js';
|
|
3
|
+
import { type Composition } from './collection.js';
|
|
4
|
+
import type { KeyedChange } from './observation.js';
|
|
5
|
+
import { type MdType, type ModelState, type TypesResult } from './model.js';
|
|
6
|
+
import { type PortReach } from './reach.js';
|
|
7
|
+
import type { ReplicaRecord } from './replica.js';
|
|
8
|
+
import type { Runtime } from './runtime.js';
|
|
9
|
+
import type { Stored } from './store.js';
|
|
10
|
+
type Selection<Model> = {
|
|
11
|
+
roots: readonly string[];
|
|
12
|
+
model: Model;
|
|
13
|
+
};
|
|
14
|
+
type Shown<Model> = {
|
|
15
|
+
name: string;
|
|
16
|
+
locator: string;
|
|
17
|
+
handle: string;
|
|
18
|
+
operations: OperationScopes;
|
|
19
|
+
replica: ReplicaAdmission;
|
|
20
|
+
model: Model;
|
|
21
|
+
typedSelection: Selection<Model> | null;
|
|
22
|
+
providerOwnedPaths: readonly string[];
|
|
23
|
+
authoredPaths: readonly string[];
|
|
24
|
+
roomVersion: string | null;
|
|
25
|
+
documents: number;
|
|
26
|
+
synchronizationAvailable: boolean;
|
|
27
|
+
refusal: ProviderRefusal | null;
|
|
28
|
+
locked: boolean;
|
|
29
|
+
queriesOnly?: true;
|
|
30
|
+
};
|
|
31
|
+
export type AppTypedSelection = Selection<TypesResult>;
|
|
32
|
+
export type AppRoom = Shown<TypesResult>;
|
|
33
|
+
export type ListedRoom = Shown<TypesResult<string>>;
|
|
34
|
+
export type ListedModels = Readonly<Record<string, readonly MdType[]>>;
|
|
35
|
+
export type ListedRooms = {
|
|
36
|
+
readonly rooms: readonly ListedRoom[];
|
|
37
|
+
readonly models: ListedModels;
|
|
38
|
+
};
|
|
39
|
+
export type ListedEntry = Omit<Shown<ModelState>, 'locked'>;
|
|
40
|
+
export type Listing = ReadonlyMap<string, ListedEntry>;
|
|
41
|
+
export type RoomsChange = KeyedChange<string, ListedRoom> & {
|
|
42
|
+
readonly models: ListedModels;
|
|
43
|
+
};
|
|
44
|
+
export declare function modelIn({ socket, presence }: Runtime, locator: string, stored: Stored | undefined): ModelState;
|
|
45
|
+
export declare function compositionFor(runtime: Runtime, record: ReplicaRecord): Composition;
|
|
46
|
+
export declare function declarationOf({ presence }: Runtime, locator: string, stored: Stored | undefined): {
|
|
47
|
+
readonly room: RoomDeclaration;
|
|
48
|
+
readonly available: boolean;
|
|
49
|
+
} | undefined;
|
|
50
|
+
export declare function listedLocators({ presence }: Runtime, held: ReadonlyMap<string, unknown>): string[];
|
|
51
|
+
export declare function listedOrHeld({ presence }: Runtime, held: ReadonlyMap<string, unknown>, locator: string): boolean;
|
|
52
|
+
export declare function listedEntries(runtime: Runtime, touched: readonly string[]): Promise<readonly ListedEntry[] | null>;
|
|
53
|
+
export declare function listingNow(runtime: Runtime): Promise<Listing>;
|
|
54
|
+
export declare function shownRooms(runtime: Runtime, listing: Listing): ListedRooms;
|
|
55
|
+
export declare function shownChange(runtime: Runtime, entries: readonly ListedEntry[]): RoomsChange;
|
|
56
|
+
export declare function roomFacts(runtime: Runtime, reach?: PortReach | null): Promise<HeldRooms>;
|
|
57
|
+
export declare function heldRooms({ store }: Runtime, listed: readonly DiscoveredRoom[]): Promise<HeldRoom[]>;
|
|
58
|
+
export declare function name(runtime: Runtime, locator: string): Promise<void>;
|
|
59
|
+
export {};
|
package/dist/mdruntime/live.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ChangeSet } from './change-set.js';
|
|
2
2
|
import { type KeyedResult, type QueryMessage } from './observation.js';
|
|
3
|
-
import type { PendingResult, Plan, QueryCoverage } from './query.js';
|
|
3
|
+
import type { PendingResult, PendingRoom, Plan, QueryCoverage } from './query.js';
|
|
4
4
|
import type { Fail } from './reach.js';
|
|
5
5
|
import type { QueryRoom } from './tables.js';
|
|
6
6
|
export type Cover = {
|
|
@@ -11,12 +11,14 @@ export type Ran = KeyedResult & {
|
|
|
11
11
|
readonly current: () => boolean;
|
|
12
12
|
};
|
|
13
13
|
export type Run = (plan: Plan, cover: () => Promise<Cover>) => Promise<Ran>;
|
|
14
|
+
export type PendingAt<H> = (held: H, rooms: readonly string[]) => ReadonlyMap<string, PendingRoom | null> | null;
|
|
14
15
|
type Listener = (message: QueryMessage) => void;
|
|
15
16
|
export type LiveQueries<H> = {
|
|
16
17
|
touched(set: ChangeSet): void;
|
|
17
|
-
recover(): void;
|
|
18
|
-
watch(plan: Plan, identity: string, cover: (held: H) => Cover, deliver: Listener, failed: Fail): () => void;
|
|
18
|
+
recover(locators?: readonly string[]): void;
|
|
19
|
+
watch(plan: Plan, identity: string, cover: (held: H) => Cover, pendingAt: PendingAt<H>, deliver: Listener, failed: Fail): () => void;
|
|
19
20
|
close(): void;
|
|
20
21
|
};
|
|
22
|
+
export declare function readerOf(plan: Plan): (locator: string) => boolean;
|
|
21
23
|
export declare function createLiveQueries<H>(run: Run, holding: () => Promise<H>): LiveQueries<H>;
|
|
22
24
|
export {};
|
|
@@ -1,7 +1,24 @@
|
|
|
1
1
|
import type { MdRuntimeClient } from './client.js';
|
|
2
|
-
import { type ShownAnswer } from './outcome.js';
|
|
2
|
+
import { type DownloadAnswer, type ShownAnswer } from './outcome.js';
|
|
3
3
|
export declare const ROOM_MEDIA = "room-media";
|
|
4
|
+
export declare const KEYED_MEDIA = "ahc-attachment";
|
|
5
|
+
export declare const MEDIA = "room-media, ahc-attachment";
|
|
6
|
+
export declare const DIAGRAM = "md-diagram";
|
|
7
|
+
export declare const VIEWING = "ahc-viewer";
|
|
4
8
|
type Show = (room: string, path: string, revision?: string) => Promise<ShownAnswer>;
|
|
9
|
+
export type MediaAt = {
|
|
10
|
+
readonly link: string;
|
|
11
|
+
} | {
|
|
12
|
+
readonly room: string;
|
|
13
|
+
readonly path: string;
|
|
14
|
+
readonly revision: string | undefined;
|
|
15
|
+
};
|
|
5
16
|
export declare function shownBy(show: Show, client: MdRuntimeClient): MdRuntimeClient;
|
|
6
|
-
export declare function
|
|
17
|
+
export declare function mediaAt(media: Element): MediaAt | null;
|
|
18
|
+
export declare function mediaTag(at: MediaAt): string;
|
|
19
|
+
export declare function downloadAt(client: MdRuntimeClient, at: MediaAt): Promise<DownloadAnswer>;
|
|
20
|
+
export declare function rendered(element: Element): boolean;
|
|
21
|
+
export declare function viewable(element: Element): boolean;
|
|
22
|
+
export declare function viewFile(client: MdRuntimeClient, media: Element): void;
|
|
23
|
+
export declare function defineRoomMedia(client: Promise<MdRuntimeClient> | MdRuntimeClient): void;
|
|
7
24
|
export {};
|