@agentshouse/mdruntime 0.1.0-cebcd51f70ed1 → 0.1.0-cf24798931067
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 +58 -12
- package/README.md +3 -2
- package/dist/adapter.d.ts +13 -3
- package/dist/adapter.d.ts.map +1 -1
- package/dist/attached-model.d.ts.map +1 -1
- package/dist/attached-model.js +15 -2
- package/dist/attempt.d.ts +16 -0
- package/dist/attempt.d.ts.map +1 -0
- package/dist/attempt.js +57 -0
- package/dist/bootstrap.d.ts +17 -5
- package/dist/bootstrap.d.ts.map +1 -1
- package/dist/bootstrap.js +88 -35
- package/dist/change-set.d.ts.map +1 -1
- package/dist/change-set.js +13 -7
- package/dist/change.d.ts +4 -0
- package/dist/change.d.ts.map +1 -1
- package/dist/chat/acts.d.ts +34 -0
- package/dist/chat/acts.d.ts.map +1 -0
- package/dist/chat/acts.js +36 -0
- package/dist/chat/messages.d.ts +21 -0
- package/dist/chat/messages.d.ts.map +1 -0
- package/dist/chat/messages.js +151 -0
- package/dist/chat/overlay.d.ts +31 -0
- package/dist/chat/overlay.d.ts.map +1 -0
- package/dist/chat/overlay.js +97 -0
- package/dist/chat/parts.d.ts +57 -0
- package/dist/chat/parts.d.ts.map +1 -0
- package/dist/chat/parts.js +119 -0
- package/dist/chat/process.d.ts +20 -0
- package/dist/chat/process.d.ts.map +1 -0
- package/dist/chat/process.js +32 -0
- package/dist/chat/provider.d.ts +57 -0
- package/dist/chat/provider.d.ts.map +1 -0
- package/dist/chat/provider.js +637 -0
- package/dist/chat/questions.d.ts +31 -0
- package/dist/chat/questions.d.ts.map +1 -0
- package/dist/chat/questions.js +111 -0
- package/dist/chat/read.d.ts +5 -0
- package/dist/chat/read.d.ts.map +1 -0
- package/dist/chat/read.js +13 -0
- package/dist/chat.d.ts +7 -0
- package/dist/chat.d.ts.map +1 -0
- package/dist/chat.js +2 -0
- package/dist/client.d.ts +8 -5
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +55 -15
- package/dist/collection.d.ts +6 -11
- package/dist/collection.d.ts.map +1 -1
- package/dist/collection.js +56 -19
- package/dist/connection.d.ts +14 -7
- package/dist/connection.d.ts.map +1 -1
- package/dist/connection.js +239 -102
- package/dist/conversation.d.ts +11 -3
- package/dist/conversation.d.ts.map +1 -1
- package/dist/conversation.js +47 -7
- package/dist/expectation.d.ts +21 -0
- package/dist/expectation.d.ts.map +1 -0
- package/dist/expectation.js +70 -0
- package/dist/failure.d.ts +13 -0
- package/dist/failure.d.ts.map +1 -0
- package/dist/failure.js +19 -0
- package/dist/host.d.ts +1 -0
- package/dist/host.d.ts.map +1 -1
- package/dist/host.js +5 -8
- package/dist/identity.d.ts +2 -0
- package/dist/identity.d.ts.map +1 -1
- package/dist/identity.js +10 -1
- package/dist/index.d.ts +7 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/memory.d.ts +2 -1
- package/dist/memory.d.ts.map +1 -1
- package/dist/memory.js +31 -11
- package/dist/model.d.ts +10 -2
- package/dist/model.d.ts.map +1 -1
- package/dist/model.js +2 -0
- package/dist/open.d.ts +2 -0
- package/dist/open.d.ts.map +1 -0
- package/dist/open.js +1 -0
- package/dist/outcome.d.ts +22 -3
- package/dist/outcome.d.ts.map +1 -1
- package/dist/outcome.js +35 -1
- package/dist/overlay.d.ts +1 -1
- package/dist/overlay.d.ts.map +1 -1
- package/dist/overlay.js +19 -15
- package/dist/query.d.ts +2 -0
- package/dist/query.d.ts.map +1 -1
- package/dist/query.js +5 -31
- package/dist/reach.d.ts.map +1 -1
- package/dist/reach.js +21 -19
- package/dist/react.d.ts +25 -16
- package/dist/react.d.ts.map +1 -1
- package/dist/react.js +8 -6
- package/dist/refresh.d.ts +10 -0
- package/dist/refresh.d.ts.map +1 -1
- package/dist/refresh.js +33 -24
- package/dist/replica.d.ts +5 -5
- package/dist/replica.d.ts.map +1 -1
- package/dist/replica.js +44 -29
- package/dist/room-draft.d.ts +8 -8
- package/dist/room-draft.d.ts.map +1 -1
- package/dist/room-draft.js +13 -22
- package/dist/rows.d.ts +2 -0
- package/dist/rows.d.ts.map +1 -1
- package/dist/rows.js +7 -1
- package/dist/save.d.ts +3 -1
- package/dist/save.d.ts.map +1 -1
- package/dist/save.js +38 -21
- package/dist/search.d.ts +3 -2
- package/dist/search.d.ts.map +1 -1
- package/dist/status.d.ts +2 -2
- package/dist/status.d.ts.map +1 -1
- package/dist/status.js +0 -8
- package/dist/store.d.ts +25 -1
- package/dist/store.d.ts.map +1 -1
- package/dist/store.js +206 -90
- package/dist/wire.d.ts +5 -3
- package/dist/wire.d.ts.map +1 -1
- package/dist/wire.js +13 -2
- package/package.json +7 -7
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { list, record, text } from './read.js';
|
|
2
|
+
const OPTION = 'optionId';
|
|
3
|
+
function choicesOf(schema) {
|
|
4
|
+
const items = record(schema.items);
|
|
5
|
+
const listed = [schema.oneOf, schema.enum, items.anyOf, items.enum].find(Array.isArray) ?? [];
|
|
6
|
+
return listed.flatMap((one) => {
|
|
7
|
+
if (typeof one === 'string')
|
|
8
|
+
return [{ value: one, label: one, about: null }];
|
|
9
|
+
const value = text(record(one), 'const');
|
|
10
|
+
return value === null
|
|
11
|
+
? []
|
|
12
|
+
: [
|
|
13
|
+
{
|
|
14
|
+
value,
|
|
15
|
+
label: text(record(one), 'title') ?? value,
|
|
16
|
+
about: text(record(one), 'description'),
|
|
17
|
+
},
|
|
18
|
+
];
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
function fieldOf(name, schema) {
|
|
22
|
+
const type = text(schema, 'type');
|
|
23
|
+
const kind = type === 'boolean' || type === 'number' || type === 'integer'
|
|
24
|
+
? type
|
|
25
|
+
: type === 'array'
|
|
26
|
+
? 'multi-select'
|
|
27
|
+
: 'string';
|
|
28
|
+
return {
|
|
29
|
+
name,
|
|
30
|
+
kind,
|
|
31
|
+
prompt: text(schema, 'title') ?? name,
|
|
32
|
+
about: text(schema, 'description'),
|
|
33
|
+
choices: kind === 'boolean' ? [] : choicesOf(schema),
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
export function entered(field) {
|
|
37
|
+
return field.kind !== 'boolean' && field.choices.length === 0;
|
|
38
|
+
}
|
|
39
|
+
function valueOf(field, raw) {
|
|
40
|
+
return field.kind === 'number' || field.kind === 'integer' ? Number(raw) : raw;
|
|
41
|
+
}
|
|
42
|
+
function typed(fields, answer) {
|
|
43
|
+
return Object.fromEntries(Object.entries(answer).map(([name, value]) => {
|
|
44
|
+
const field = fields.find((one) => one.name === name);
|
|
45
|
+
return [
|
|
46
|
+
name,
|
|
47
|
+
field !== undefined && entered(field) && typeof value === 'string'
|
|
48
|
+
? valueOf(field, value)
|
|
49
|
+
: value,
|
|
50
|
+
];
|
|
51
|
+
}));
|
|
52
|
+
}
|
|
53
|
+
function askedOf(request) {
|
|
54
|
+
const params = record(request.params);
|
|
55
|
+
const method = text(request, 'method');
|
|
56
|
+
if (method === 'session/request_permission') {
|
|
57
|
+
return {
|
|
58
|
+
message: '',
|
|
59
|
+
fields: [
|
|
60
|
+
{
|
|
61
|
+
name: OPTION,
|
|
62
|
+
kind: 'string',
|
|
63
|
+
prompt: text(record(params.toolCall), 'title') ?? '',
|
|
64
|
+
about: null,
|
|
65
|
+
choices: list(params, 'options').flatMap((entry) => {
|
|
66
|
+
const one = record(entry);
|
|
67
|
+
const value = text(one, OPTION);
|
|
68
|
+
return value === null
|
|
69
|
+
? []
|
|
70
|
+
: [{ value, label: text(one, 'name') ?? value, about: null }];
|
|
71
|
+
}),
|
|
72
|
+
},
|
|
73
|
+
],
|
|
74
|
+
accept: (answer) => ({ outcome: { outcome: 'selected', optionId: answer[OPTION] } }),
|
|
75
|
+
decline: null,
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
if (method !== 'elicitation/create')
|
|
79
|
+
return null;
|
|
80
|
+
const fields = Object.entries(record(record(params.requestedSchema).properties)).map(([name, schema]) => fieldOf(name, record(schema)));
|
|
81
|
+
return {
|
|
82
|
+
message: text(params, 'message') ?? '',
|
|
83
|
+
fields,
|
|
84
|
+
accept: (answer) => ({ action: 'accept', content: typed(fields, answer) }),
|
|
85
|
+
decline: { action: 'decline' },
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
export function questionsOf(view) {
|
|
89
|
+
return (view?.questions ?? []).flatMap((entry) => {
|
|
90
|
+
const one = record(entry);
|
|
91
|
+
const interaction = text(one, 'interaction_id');
|
|
92
|
+
const asked = askedOf(record(one.request));
|
|
93
|
+
return asked === null || interaction === null
|
|
94
|
+
? []
|
|
95
|
+
: [
|
|
96
|
+
{
|
|
97
|
+
interaction,
|
|
98
|
+
secret: one.secret === true,
|
|
99
|
+
undelivered: one.telegram_undelivered === true,
|
|
100
|
+
...asked,
|
|
101
|
+
},
|
|
102
|
+
];
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
export function loneOf(questions) {
|
|
106
|
+
const asked = questions.length === 1 && !questions[0]?.secret ? questions[0] : undefined;
|
|
107
|
+
const only = asked?.fields.length === 1 ? asked.fields[0] : undefined;
|
|
108
|
+
return asked !== undefined && only !== undefined && entered(only)
|
|
109
|
+
? { question: asked, field: only }
|
|
110
|
+
: null;
|
|
111
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export type Fields = Readonly<Record<string, unknown>>;
|
|
2
|
+
export declare function record(entry: unknown): Fields;
|
|
3
|
+
export declare function text(fields: Fields, name: string): string | null;
|
|
4
|
+
export declare function list(fields: Fields, name: string): readonly unknown[];
|
|
5
|
+
//# sourceMappingURL=read.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"read.d.ts","sourceRoot":"","sources":["../../src/chat/read.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,MAAM,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;AAEvD,wBAAgB,MAAM,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAI7C;AAED,wBAAgB,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAGhE;AAED,wBAAgB,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,SAAS,OAAO,EAAE,CAGrE"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export function record(entry) {
|
|
2
|
+
return typeof entry === 'object' && entry !== null && !Array.isArray(entry)
|
|
3
|
+
? entry
|
|
4
|
+
: {};
|
|
5
|
+
}
|
|
6
|
+
export function text(fields, name) {
|
|
7
|
+
const value = fields[name];
|
|
8
|
+
return typeof value === 'string' && value !== '' ? value : null;
|
|
9
|
+
}
|
|
10
|
+
export function list(fields, name) {
|
|
11
|
+
const value = fields[name];
|
|
12
|
+
return Array.isArray(value) ? value : [];
|
|
13
|
+
}
|
package/dist/chat.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { ChatProvider, useChat, type ChatActing, type ChatOpened, type ChatProviderProps, type ChatQueued, type ChatState, } from './chat/provider.js';
|
|
2
|
+
export { chatMessages } from './chat/messages.js';
|
|
3
|
+
export type { ChatOutcome } from './chat/acts.js';
|
|
4
|
+
export type { ChatWork } from './chat/parts.js';
|
|
5
|
+
export type { ChatCommand, ChatOption, ChatOptionValue } from './chat/process.js';
|
|
6
|
+
export type { ChatAnswer, ChatChoice, ChatField, ChatLone, ChatQuestion, } from './chat/questions.js';
|
|
7
|
+
//# sourceMappingURL=chat.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chat.d.ts","sourceRoot":"","sources":["../src/chat.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,OAAO,EACP,KAAK,UAAU,EACf,KAAK,UAAU,EACf,KAAK,iBAAiB,EACtB,KAAK,UAAU,EACf,KAAK,SAAS,GACf,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,YAAY,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAClD,YAAY,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAChD,YAAY,EAAE,WAAW,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAClF,YAAY,EACV,UAAU,EACV,UAAU,EACV,SAAS,EACT,QAAQ,EACR,YAAY,GACb,MAAM,qBAAqB,CAAC"}
|
package/dist/chat.js
ADDED
package/dist/client.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { AppRoom, ConnectionRefusal, HistoryQuery, RoomSchemas, SavedRoomDraft, SaveResult } from './connection.js';
|
|
2
|
-
import type {
|
|
3
|
-
import type { ChatDraft, ConversationEntry, ConversationOptions, ConversationView } from './conversation.js';
|
|
2
|
+
import type { Member, ServiceMode } from './adapter.js';
|
|
3
|
+
import type { ChatDraft, ConversationAgent, ConversationEntry, ConversationOptions, ConversationView } from './conversation.js';
|
|
4
4
|
import { type Observation } from './observation.js';
|
|
5
|
-
import type { CallResult, QueueEntry } from './outcome.js';
|
|
5
|
+
import type { CallResult, HistoryAnswer, QueueEntry } from './outcome.js';
|
|
6
6
|
import type { DocumentQuery, DocumentResult, GroupQuery, GroupResult } from './query.js';
|
|
7
7
|
import type { RoomDraft, RoomDraftParts, RoomDraftWrite } from './room-draft.js';
|
|
8
8
|
import type { SearchRequest, SearchResult } from './search.js';
|
|
@@ -39,10 +39,10 @@ export type MdRuntimeClient = {
|
|
|
39
39
|
delete(conversation: string): Promise<CallResult>;
|
|
40
40
|
};
|
|
41
41
|
chatDraft: {
|
|
42
|
-
write(conversation: string, draft: ChatDraft): Promise<void>;
|
|
42
|
+
write(conversation: string, draft: ChatDraft, revision?: string): Promise<void>;
|
|
43
43
|
discard(conversation: string): Promise<void>;
|
|
44
44
|
};
|
|
45
|
-
history(locator: string, path: string, query?: HistoryQuery): Promise<
|
|
45
|
+
history(locator: string, path: string, query?: HistoryQuery): Promise<HistoryAnswer>;
|
|
46
46
|
call(name: string, input: unknown): Promise<CallResult>;
|
|
47
47
|
reached(locator: string, roomVersion: string, path?: string): Promise<boolean>;
|
|
48
48
|
log(): Promise<string>;
|
|
@@ -54,6 +54,7 @@ export type MdRuntimeClient = {
|
|
|
54
54
|
(topic: 'storage-loss'): Promise<Observation<string | null>>;
|
|
55
55
|
(topic: 'sync-status'): Promise<Observation<SyncStatus>>;
|
|
56
56
|
(topic: 'service-mode'): Promise<Observation<ServiceMode>>;
|
|
57
|
+
(topic: 'member'): Promise<Observation<Member | null>>;
|
|
57
58
|
(topic: 'query', query: DocumentQuery): Promise<Observation<DocumentResult>>;
|
|
58
59
|
(topic: 'query', query: GroupQuery): Promise<Observation<GroupResult>>;
|
|
59
60
|
(topic: 'queue', locator: string): Promise<Observation<readonly QueueEntry[]>>;
|
|
@@ -61,8 +62,10 @@ export type MdRuntimeClient = {
|
|
|
61
62
|
(topic: 'presentation'): Promise<Observation<unknown>>;
|
|
62
63
|
(topic: 'conversation', conversation: string, options: ConversationOptions): Promise<Observation<ConversationView>>;
|
|
63
64
|
(topic: 'conversations'): Promise<Observation<readonly ConversationEntry[]>>;
|
|
65
|
+
(topic: 'agents'): Promise<Observation<readonly ConversationAgent[]>>;
|
|
64
66
|
};
|
|
65
67
|
reauthorize(): Promise<void>;
|
|
68
|
+
settled(): Promise<void>;
|
|
66
69
|
};
|
|
67
70
|
export declare function connectMdRuntime(port: RuntimePort): MdRuntimeClient;
|
|
68
71
|
export type { Observation } from './observation.js';
|
package/dist/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,OAAO,EACP,iBAAiB,EACjB,YAAY,EACZ,WAAW,EACX,cAAc,EACd,UAAU,EACX,MAAM,iBAA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AAW,CAAC,SAAS,iBAAiB,EAAE,CAAC,CAAC,CAAC;KACvE,CAAC;IACF,WAAW,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAC7B,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CAC1B,CAAC;AAMF,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,WAAW,GAAG,eAAe,CA6MnE;AAED,YAAY,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACpD,YAAY,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC"}
|
package/dist/client.js
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import { observed } from './observation.js';
|
|
2
|
+
import { runtimeError } from './failure.js';
|
|
2
3
|
import { answer, AUTHORIZATION_ENDED, PORT_CLOSED, } from './wire.js';
|
|
4
|
+
function refused(refusal) {
|
|
5
|
+
return runtimeError(refusal.code, refusal.code, refusal.retryable);
|
|
6
|
+
}
|
|
3
7
|
export function connectMdRuntime(port) {
|
|
4
8
|
let sequence = 0;
|
|
5
9
|
let refusal = null;
|
|
@@ -7,6 +11,8 @@ export function connectMdRuntime(port) {
|
|
|
7
11
|
const calls = new Map();
|
|
8
12
|
const opening = new Map();
|
|
9
13
|
const observations = new Map();
|
|
14
|
+
let drawing = null;
|
|
15
|
+
let settling = null;
|
|
10
16
|
const send = (message) => {
|
|
11
17
|
port.postMessage(message);
|
|
12
18
|
};
|
|
@@ -25,7 +31,7 @@ export function connectMdRuntime(port) {
|
|
|
25
31
|
if (topic === 'connection-refusal')
|
|
26
32
|
handle.receive(reported);
|
|
27
33
|
}
|
|
28
|
-
const failure =
|
|
34
|
+
const failure = refused(reported);
|
|
29
35
|
for (const [id, waiting] of opening) {
|
|
30
36
|
if (waiting.topic === 'connection-refusal')
|
|
31
37
|
waiting.settle(begin(id, waiting.topic, reported));
|
|
@@ -36,12 +42,12 @@ export function connectMdRuntime(port) {
|
|
|
36
42
|
for (const waiting of calls.values())
|
|
37
43
|
waiting.fail(failure);
|
|
38
44
|
calls.clear();
|
|
45
|
+
drawing?.();
|
|
39
46
|
}
|
|
40
|
-
function end(
|
|
47
|
+
function end(failure) {
|
|
41
48
|
if (ended !== null)
|
|
42
49
|
return;
|
|
43
|
-
ended =
|
|
44
|
-
const failure = new Error(reason);
|
|
50
|
+
ended = failure;
|
|
45
51
|
for (const waiting of opening.values())
|
|
46
52
|
waiting.fail(failure);
|
|
47
53
|
opening.clear();
|
|
@@ -51,6 +57,7 @@ export function connectMdRuntime(port) {
|
|
|
51
57
|
for (const { handle } of observations.values())
|
|
52
58
|
handle.end();
|
|
53
59
|
observations.clear();
|
|
60
|
+
drawing?.();
|
|
54
61
|
}
|
|
55
62
|
port.addEventListener('message', (event) => {
|
|
56
63
|
const message = answer(event.data);
|
|
@@ -61,7 +68,11 @@ export function connectMdRuntime(port) {
|
|
|
61
68
|
return;
|
|
62
69
|
}
|
|
63
70
|
if (message.kind === 'ended') {
|
|
64
|
-
|
|
71
|
+
for (const { topic, handle } of observations.values()) {
|
|
72
|
+
if (topic === 'member')
|
|
73
|
+
handle.receive(null);
|
|
74
|
+
}
|
|
75
|
+
end(runtimeError('authorization-ended', AUTHORIZATION_ENDED));
|
|
65
76
|
return;
|
|
66
77
|
}
|
|
67
78
|
if (message.kind === 'event') {
|
|
@@ -71,31 +82,34 @@ export function connectMdRuntime(port) {
|
|
|
71
82
|
const waiting = opening.get(message.id);
|
|
72
83
|
if (waiting !== undefined) {
|
|
73
84
|
opening.delete(message.id);
|
|
74
|
-
if (message.kind === 'failure')
|
|
75
|
-
waiting.fail(
|
|
85
|
+
if (message.kind === 'failure') {
|
|
86
|
+
waiting.fail(runtimeError(message.code, message.message, message.retryable));
|
|
87
|
+
}
|
|
76
88
|
else
|
|
77
89
|
waiting.settle(begin(message.id, waiting.topic, message.value));
|
|
90
|
+
drawing?.();
|
|
78
91
|
return;
|
|
79
92
|
}
|
|
80
93
|
const called = calls.get(message.id);
|
|
81
94
|
if (called === undefined)
|
|
82
95
|
return;
|
|
83
96
|
calls.delete(message.id);
|
|
84
|
-
if (message.kind === 'failure')
|
|
85
|
-
called.fail(
|
|
97
|
+
if (message.kind === 'failure') {
|
|
98
|
+
called.fail(runtimeError(message.code, message.message, message.retryable));
|
|
99
|
+
}
|
|
86
100
|
else
|
|
87
101
|
called.settle(message.value);
|
|
88
102
|
});
|
|
89
103
|
port.addEventListener('close', () => {
|
|
90
|
-
end(PORT_CLOSED);
|
|
104
|
+
end(runtimeError('port-closed', PORT_CLOSED));
|
|
91
105
|
});
|
|
92
106
|
port.start();
|
|
93
107
|
send({ kind: 'hello' });
|
|
94
108
|
function ask(member, input) {
|
|
95
109
|
if (ended !== null)
|
|
96
|
-
return Promise.reject(
|
|
110
|
+
return Promise.reject(ended);
|
|
97
111
|
if (refusal !== null)
|
|
98
|
-
return Promise.reject(
|
|
112
|
+
return Promise.reject(refused(refusal));
|
|
99
113
|
const id = (sequence += 1);
|
|
100
114
|
return new Promise((settle, fail) => {
|
|
101
115
|
calls.set(id, { settle: settle, fail });
|
|
@@ -104,17 +118,42 @@ export function connectMdRuntime(port) {
|
|
|
104
118
|
}
|
|
105
119
|
function watch(topic, input) {
|
|
106
120
|
if (ended !== null)
|
|
107
|
-
return Promise.reject(
|
|
121
|
+
return Promise.reject(ended);
|
|
108
122
|
const id = (sequence += 1);
|
|
109
123
|
if (refusal !== null) {
|
|
110
124
|
return topic === 'connection-refusal'
|
|
111
125
|
? Promise.resolve(begin(id, topic, refusal))
|
|
112
|
-
: Promise.reject(
|
|
126
|
+
: Promise.reject(refused(refusal));
|
|
113
127
|
}
|
|
114
128
|
return new Promise((settle, fail) => {
|
|
115
129
|
opening.set(id, { topic, settle, fail });
|
|
116
130
|
send({ kind: 'observe', id, topic, input });
|
|
131
|
+
drawing?.();
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
function settled() {
|
|
135
|
+
if (settling !== null)
|
|
136
|
+
return settling;
|
|
137
|
+
settling = new Promise((resolve) => {
|
|
138
|
+
let moved = 0;
|
|
139
|
+
const check = () => {
|
|
140
|
+
moved += 1;
|
|
141
|
+
if (opening.size > 0)
|
|
142
|
+
return;
|
|
143
|
+
const at = moved;
|
|
144
|
+
requestAnimationFrame(() => {
|
|
145
|
+
requestAnimationFrame(() => {
|
|
146
|
+
if (moved !== at || opening.size > 0)
|
|
147
|
+
return;
|
|
148
|
+
drawing = null;
|
|
149
|
+
resolve();
|
|
150
|
+
});
|
|
151
|
+
});
|
|
152
|
+
};
|
|
153
|
+
drawing = check;
|
|
154
|
+
check();
|
|
117
155
|
});
|
|
156
|
+
return settling;
|
|
118
157
|
}
|
|
119
158
|
return {
|
|
120
159
|
rooms: () => ask('rooms', []),
|
|
@@ -144,7 +183,7 @@ export function connectMdRuntime(port) {
|
|
|
144
183
|
delete: (conversation) => ask('conversation.delete', [conversation]),
|
|
145
184
|
},
|
|
146
185
|
chatDraft: {
|
|
147
|
-
write: (conversation, draft) => ask('chatDraft.write', [conversation, draft]),
|
|
186
|
+
write: (conversation, draft, revision) => ask('chatDraft.write', [conversation, draft, revision]),
|
|
148
187
|
discard: (conversation) => ask('chatDraft.discard', [conversation]),
|
|
149
188
|
},
|
|
150
189
|
history: (locator, path, query) => ask('history', [locator, path, query]),
|
|
@@ -154,5 +193,6 @@ export function connectMdRuntime(port) {
|
|
|
154
193
|
persistence: () => ask('persistence', []),
|
|
155
194
|
observe: ((topic, ...input) => watch(topic, input)),
|
|
156
195
|
reauthorize: () => ask('reauthorize', []),
|
|
196
|
+
settled,
|
|
157
197
|
};
|
|
158
198
|
}
|
package/dist/collection.d.ts
CHANGED
|
@@ -4,8 +4,9 @@ import type { MdModelIdentity } from './adapter.js';
|
|
|
4
4
|
import type { Refused } from './transfer.js';
|
|
5
5
|
export declare const MD_MODEL: MdModelIdentity;
|
|
6
6
|
export type Collection = {
|
|
7
|
-
|
|
7
|
+
text: Readonly<Record<string, string>>;
|
|
8
8
|
composition: Composition;
|
|
9
|
+
document(path: string): Document | undefined;
|
|
9
10
|
};
|
|
10
11
|
export type Composition = {
|
|
11
12
|
model: ModelState;
|
|
@@ -15,16 +16,10 @@ export type Composition = {
|
|
|
15
16
|
} | null;
|
|
16
17
|
};
|
|
17
18
|
export declare function governing(composition: Composition, path: string): ModelState;
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
export declare function parseCollection(text: Readonly<Record<string, string>>, composition: Composition, previous?: Previous): Collection;
|
|
23
|
-
export declare function readCollection(text: Readonly<Record<string, string>>, composition: Composition, previous?: Previous): {
|
|
24
|
-
kind: 'read';
|
|
25
|
-
collection: Collection;
|
|
26
|
-
} | Refused;
|
|
19
|
+
export declare function collectionOf(text: Readonly<Record<string, string>>, composition: Composition, previous?: Collection): Collection;
|
|
20
|
+
export declare function passingDocument(collection: Collection, path: string): Document | undefined;
|
|
21
|
+
export declare function documentsOf(collection: Collection): Generator<readonly [string, Document]>;
|
|
22
|
+
export declare function unreadable(text: Readonly<Record<string, string>>, previous?: Readonly<Record<string, string>>): Refused | null;
|
|
27
23
|
export declare function validRoot(root: unknown): root is string;
|
|
28
24
|
export declare function validateCollection(text: Readonly<Record<string, string>>, binaryTargets: readonly string[], composition: Composition): Validation;
|
|
29
|
-
export {};
|
|
30
25
|
//# sourceMappingURL=collection.d.ts.map
|
package/dist/collection.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"collection.d.ts","sourceRoot":"","sources":["../src/collection.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,QAAQ,
|
|
1
|
+
{"version":3,"file":"collection.d.ts","sourceRoot":"","sources":["../src/collection.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,QAAQ,EACb,KAAK,UAAU,EAEhB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,K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AAM,CAEvD;AAwBD,wBAAgB,kBAAkB,CAChC,IAAI,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,EACtC,aAAa,EAAE,SAAS,MAAM,EAAE,EAChC,WAAW,EAAE,WAAW,GACvB,UAAU,CA0BZ"}
|
package/dist/collection.js
CHANGED
|
@@ -11,30 +11,67 @@ export function governing(composition, path) {
|
|
|
11
11
|
? composition.selection.model
|
|
12
12
|
: composition.model;
|
|
13
13
|
}
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
14
|
+
const parsedIn = new WeakMap();
|
|
15
|
+
export function collectionOf(text, composition, previous) {
|
|
16
|
+
const parsed = new Map();
|
|
17
|
+
if (previous !== undefined) {
|
|
18
|
+
for (const [path, held] of parsedIn.get(previous) ?? []) {
|
|
19
|
+
if (previous.text[path] === text[path])
|
|
20
|
+
parsed.set(path, held);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
const collection = {
|
|
24
|
+
text,
|
|
25
|
+
composition,
|
|
26
|
+
document(path) {
|
|
27
|
+
const held = parsed.get(path);
|
|
28
|
+
if (held !== undefined)
|
|
29
|
+
return held ?? undefined;
|
|
30
|
+
const content = text[path];
|
|
31
|
+
if (content === undefined)
|
|
32
|
+
return undefined;
|
|
33
|
+
const read = parse(content, path);
|
|
34
|
+
parsed.set(path, read.ok ? read.document : null);
|
|
35
|
+
return read.ok ? read.document : undefined;
|
|
36
|
+
},
|
|
37
|
+
};
|
|
38
|
+
parsedIn.set(collection, parsed);
|
|
39
|
+
return collection;
|
|
19
40
|
}
|
|
20
|
-
export function
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
41
|
+
export function passingDocument(collection, path) {
|
|
42
|
+
const held = parsedIn.get(collection)?.get(path);
|
|
43
|
+
if (held !== undefined)
|
|
44
|
+
return held ?? undefined;
|
|
45
|
+
const content = collection.text[path];
|
|
46
|
+
if (content === undefined)
|
|
47
|
+
return undefined;
|
|
48
|
+
const read = parse(content, path);
|
|
49
|
+
return read.ok ? read.document : undefined;
|
|
50
|
+
}
|
|
51
|
+
export function* documentsOf(collection) {
|
|
52
|
+
const parsed = parsedIn.get(collection);
|
|
53
|
+
for (const path of Object.keys(collection.text).sort()) {
|
|
54
|
+
const held = parsed?.get(path);
|
|
55
|
+
if (held === null)
|
|
56
|
+
continue;
|
|
57
|
+
if (held !== undefined) {
|
|
58
|
+
yield [path, held];
|
|
59
|
+
continue;
|
|
60
|
+
}
|
|
61
|
+
const read = parse(collection.text[path], path);
|
|
62
|
+
if (read.ok)
|
|
63
|
+
yield [path, read.document];
|
|
26
64
|
}
|
|
27
|
-
return { documents, composition };
|
|
28
65
|
}
|
|
29
|
-
export function
|
|
30
|
-
const documents = {};
|
|
66
|
+
export function unreadable(text, previous) {
|
|
31
67
|
for (const path of Object.keys(text).sort()) {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
68
|
+
if (previous?.[path] === text[path])
|
|
69
|
+
continue;
|
|
70
|
+
const read = parse(text[path], path);
|
|
71
|
+
if (!read.ok)
|
|
72
|
+
return { kind: 'refused', refusal: read.refusal };
|
|
36
73
|
}
|
|
37
|
-
return
|
|
74
|
+
return null;
|
|
38
75
|
}
|
|
39
76
|
export function validRoot(root) {
|
|
40
77
|
return typeof root === 'string' && normalize(root) === root;
|
package/dist/connection.d.ts
CHANGED
|
@@ -2,10 +2,11 @@ import { type TypesResult } from './model.js';
|
|
|
2
2
|
import { type Observation } from './observation.js';
|
|
3
3
|
import { type DocumentQuery, type DocumentResult, type GroupQuery, type GroupResult } from './query.js';
|
|
4
4
|
import { type SearchRequest, type SearchResult } from './search.js';
|
|
5
|
-
import { type Adapter, type Authorization, type
|
|
6
|
-
import { type ChatDraftSurface, type ConversationEntry, type ConversationOptions, type ConversationSurface, type ConversationView } from './conversation.js';
|
|
5
|
+
import { type Adapter, type Authorization, type Member, type RoomAttachment, type ProviderRefusal, type ServiceMode } from './adapter.js';
|
|
6
|
+
import { type ChatDraftSurface, type ConversationAgent, type ConversationEntry, type ConversationOptions, type ConversationSurface, type ConversationView } from './conversation.js';
|
|
7
7
|
import type { WrittenBy } from './change.js';
|
|
8
|
-
import type {
|
|
8
|
+
import type { Open } from './open.js';
|
|
9
|
+
import { type CallResult, type HistoryAnswer, type QueueEntry } from './outcome.js';
|
|
9
10
|
import { type SaveRefusal } from './save.js';
|
|
10
11
|
import { type RoomDraft, type RoomDraftWrite } from './room-draft.js';
|
|
11
12
|
import { type SyncStatus } from './status.js';
|
|
@@ -26,6 +27,7 @@ export type AppRoom = {
|
|
|
26
27
|
providerOwnedPaths: readonly string[];
|
|
27
28
|
roomVersion: string | null;
|
|
28
29
|
attachments: readonly RoomAttachment[];
|
|
30
|
+
documents: number;
|
|
29
31
|
synchronizationAvailable: boolean;
|
|
30
32
|
refusal: ProviderRefusal | null;
|
|
31
33
|
};
|
|
@@ -33,9 +35,11 @@ export type RoomSchemas = {
|
|
|
33
35
|
collection: TypesResult;
|
|
34
36
|
typedSelection: TypesResult | null;
|
|
35
37
|
};
|
|
36
|
-
|
|
38
|
+
type RefusalReason = 'missing-required-guarantee' | 'revoked-authorization';
|
|
39
|
+
export type ConnectionRefusalCode = Open<RefusalReason>;
|
|
37
40
|
export type ConnectionRefusal = {
|
|
38
|
-
|
|
41
|
+
code: ConnectionRefusalCode;
|
|
42
|
+
retryable: boolean;
|
|
39
43
|
reauthorizationOffered: boolean;
|
|
40
44
|
refusal: ProviderRefusal | null;
|
|
41
45
|
};
|
|
@@ -83,7 +87,7 @@ export type MdRuntime = {
|
|
|
83
87
|
chatDraft: ChatDraftSurface;
|
|
84
88
|
presentation: PresentationSurface;
|
|
85
89
|
save(room: string, roomDrafts: readonly SavedRoomDraft[], writtenBy?: WrittenBy): Promise<SaveResult>;
|
|
86
|
-
history(locator: string, path: string, query?: HistoryQuery): Promise<
|
|
90
|
+
history(locator: string, path: string, query?: HistoryQuery): Promise<HistoryAnswer>;
|
|
87
91
|
call(name: string, input: unknown): Promise<CallResult>;
|
|
88
92
|
reached(locator: string, roomVersion: string, path?: string): boolean;
|
|
89
93
|
log(): string;
|
|
@@ -94,6 +98,7 @@ export type MdRuntime = {
|
|
|
94
98
|
(topic: 'storage-loss'): Promise<Observation<string | null>>;
|
|
95
99
|
(topic: 'sync-status'): Promise<Observation<SyncStatus>>;
|
|
96
100
|
(topic: 'service-mode'): Promise<Observation<ServiceMode>>;
|
|
101
|
+
(topic: 'member'): Promise<Observation<Member | null>>;
|
|
97
102
|
(topic: 'query', query: DocumentQuery): Promise<Observation<DocumentResult>>;
|
|
98
103
|
(topic: 'query', query: GroupQuery): Promise<Observation<GroupResult>>;
|
|
99
104
|
(topic: 'queue', locator: string): Promise<Observation<readonly QueueEntry[]>>;
|
|
@@ -101,13 +106,15 @@ export type MdRuntime = {
|
|
|
101
106
|
(topic: 'presentation', app: string): Promise<Observation<unknown>>;
|
|
102
107
|
(topic: 'conversation', conversation: string, options: ConversationOptions): Promise<Observation<ConversationView>>;
|
|
103
108
|
(topic: 'conversations'): Promise<Observation<readonly ConversationEntry[]>>;
|
|
109
|
+
(topic: 'agents'): Promise<Observation<readonly ConversationAgent[]>>;
|
|
104
110
|
};
|
|
105
111
|
reauthorize(): Promise<void>;
|
|
106
112
|
};
|
|
107
|
-
export type RuntimeTopic = 'rooms' | 'connection-refusal' | 'storage-loss' | 'sync-status' | 'service-mode' | 'query' | 'queue' | 'room-drafts' | 'presentation' | 'conversation' | 'conversations';
|
|
113
|
+
export type RuntimeTopic = 'rooms' | 'connection-refusal' | 'storage-loss' | 'sync-status' | 'service-mode' | 'member' | 'query' | 'queue' | 'room-drafts' | 'presentation' | 'conversation' | 'conversations' | 'agents';
|
|
108
114
|
export type ComposedRuntime = RuntimeView & {
|
|
109
115
|
stop(): Promise<void>;
|
|
110
116
|
within(reach: PortReach | null): NarrowedView;
|
|
111
117
|
};
|
|
112
118
|
export declare function composeRuntime(options: MdRuntimeOptions): ComposedRuntime;
|
|
119
|
+
export {};
|
|
113
120
|
//# sourceMappingURL=connection.d.ts.map
|
package/dist/connection.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connection.d.ts","sourceRoot":"","sources":["../src/connection.ts"],"names":[],"mappings":"AACA,OAAO,EAML,KAAK,WAAW,EACjB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAa,KAAK,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/D,OAAO,EAIL,KAAK,aAAa,EAClB,KAAK,cAAc,EACnB,KAAK,UAAU,EACf,KAAK,WAAW,EAGjB,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"connection.d.ts","sourceRoot":"","sources":["../src/connection.ts"],"names":[],"mappings":"AACA,OAAO,EAML,KAAK,WAAW,EACjB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAa,KAAK,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/D,OAAO,EAIL,KAAK,aAAa,EAClB,KAAK,cAAc,EACnB,KAAK,UAAU,EACf,KAAK,WAAW,EAGjB,MAAM,YAAY,CAAC;AAGpB,OAAO,EAGL,KAAK,aAAa,EAClB,KAAK,YAAY,EAClB,MAAM,aAAa,CAAC;AACrB,OAAO,EAEL,KAAK,OAAO,EAEZ,KAAK,aAAa,EAIlB,KAAK,MAAM,EAIX,KAAK,cAAc,EAKnB,KAAK,eAAe,EAGpB,KAAK,WAAW,EAEjB,MAAM,cAAc,CAAC;AAGtB,OAAO,EAEL,KAAK,gBAAgB,EACrB,KAAK,iBAAiB,EACtB,KAAK,iBAAiB,EACtB,KAAK,mBAAmB,EAExB,KAAK,mBAAmB,EACxB,KAAK,gBAAgB,EACtB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EAAe,SAAS,EAAE,MAAM,aAAa,CAAC;AAG1D,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEtC,OA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