@agentshouse/mdruntime 0.1.0-ca7c26c6bc27e → 0.1.0-ca9afacd5aebd
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 +144 -41
- package/README.md +21 -11
- package/dist/adapter.d.ts +71 -20
- package/dist/adapter.d.ts.map +1 -1
- package/dist/adapter.js +1 -9
- 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/binary.d.ts +23 -0
- package/dist/binary.d.ts.map +1 -0
- package/dist/binary.js +8 -0
- package/dist/bootstrap.d.ts +17 -5
- package/dist/bootstrap.d.ts.map +1 -1
- package/dist/bootstrap.js +89 -38
- package/dist/change-set.d.ts.map +1 -1
- package/dist/change-set.js +19 -12
- package/dist/change.d.ts +15 -0
- package/dist/change.d.ts.map +1 -1
- package/dist/change.js +26 -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/context.d.ts +3 -0
- package/dist/chat/context.d.ts.map +1 -0
- package/dist/chat/context.js +10 -0
- package/dist/chat/input.d.ts +9 -0
- package/dist/chat/input.d.ts.map +1 -0
- package/dist/chat/input.js +99 -0
- package/dist/chat/kit.d.ts +60 -0
- package/dist/chat/kit.d.ts.map +1 -0
- package/dist/chat/kit.js +123 -0
- package/dist/chat/lasting.d.ts +6 -0
- package/dist/chat/lasting.d.ts.map +1 -0
- package/dist/chat/lasting.js +19 -0
- package/dist/chat/list.d.ts +20 -0
- package/dist/chat/list.d.ts.map +1 -0
- package/dist/chat/list.js +59 -0
- package/dist/chat/markdown.d.ts +19 -0
- package/dist/chat/markdown.d.ts.map +1 -0
- package/dist/chat/markdown.js +187 -0
- package/dist/chat/message.d.ts +6 -0
- package/dist/chat/message.d.ts.map +1 -0
- package/dist/chat/message.js +192 -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/name.d.ts +6 -0
- package/dist/chat/name.d.ts.map +1 -0
- package/dist/chat/name.js +37 -0
- package/dist/chat/opened.d.ts +11 -0
- package/dist/chat/opened.d.ts.map +1 -0
- package/dist/chat/opened.js +17 -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 +63 -0
- package/dist/chat/provider.d.ts.map +1 -0
- package/dist/chat/provider.js +645 -0
- package/dist/chat/question.d.ts +9 -0
- package/dist/chat/question.d.ts.map +1 -0
- package/dist/chat/question.js +80 -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/ready.d.ts +33 -0
- package/dist/chat/ready.d.ts.map +1 -0
- package/dist/chat/ready.js +91 -0
- package/dist/chat/style.d.ts +4 -0
- package/dist/chat/style.d.ts.map +1 -0
- package/dist/chat/style.js +302 -0
- package/dist/chat.d.ts +14 -0
- package/dist/chat.d.ts.map +1 -0
- package/dist/chat.js +8 -0
- package/dist/client.d.ts +17 -7
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +68 -25
- 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 +25 -12
- package/dist/connection.d.ts.map +1 -1
- package/dist/connection.js +492 -185
- package/dist/conversation.d.ts +27 -8
- package/dist/conversation.d.ts.map +1 -1
- package/dist/conversation.js +210 -81
- 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 +12 -19
- package/dist/identity.d.ts +3 -0
- package/dist/identity.d.ts.map +1 -1
- package/dist/identity.js +13 -1
- package/dist/index.d.ts +9 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -0
- package/dist/memory.d.ts +5 -5
- package/dist/memory.d.ts.map +1 -1
- package/dist/memory.js +73 -27
- package/dist/model.d.ts +13 -8
- package/dist/model.d.ts.map +1 -1
- package/dist/model.js +6 -3
- 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 +28 -3
- package/dist/outcome.d.ts.map +1 -1
- package/dist/outcome.js +41 -1
- package/dist/overlay.d.ts +14 -3
- package/dist/overlay.d.ts.map +1 -1
- package/dist/overlay.js +75 -37
- package/dist/paths.d.ts +0 -1
- package/dist/paths.d.ts.map +1 -1
- package/dist/paths.js +0 -16
- package/dist/query.d.ts +5 -1
- package/dist/query.d.ts.map +1 -1
- package/dist/query.js +74 -33
- package/dist/reach.d.ts +2 -0
- package/dist/reach.d.ts.map +1 -1
- package/dist/reach.js +51 -34
- package/dist/react.d.ts +41 -0
- package/dist/react.d.ts.map +1 -0
- package/dist/react.js +64 -0
- package/dist/read-side.d.ts.map +1 -1
- package/dist/read-side.js +111 -48
- package/dist/refresh.d.ts +10 -0
- package/dist/refresh.d.ts.map +1 -1
- package/dist/refresh.js +42 -38
- package/dist/replica.d.ts +9 -7
- package/dist/replica.d.ts.map +1 -1
- package/dist/replica.js +90 -64
- package/dist/room-draft.d.ts +26 -9
- package/dist/room-draft.d.ts.map +1 -1
- package/dist/room-draft.js +132 -23
- package/dist/rows.d.ts +7 -2
- package/dist/rows.d.ts.map +1 -1
- package/dist/rows.js +85 -40
- package/dist/save.d.ts +28 -3
- package/dist/save.d.ts.map +1 -1
- package/dist/save.js +429 -80
- 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 +34 -9
- package/dist/store.d.ts.map +1 -1
- package/dist/store.js +273 -164
- package/dist/wire.d.ts +8 -15
- package/dist/wire.d.ts.map +1 -1
- package/dist/wire.js +16 -17
- package/package.json +23 -3
- package/dist/attachment.d.ts +0 -3
- package/dist/attachment.d.ts.map +0 -1
- package/dist/attachment.js +0 -8
package/dist/host.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { composeRuntime, } from './connection.js';
|
|
2
|
+
import { described } from './failure.js';
|
|
2
3
|
import { removeRuntimeStore } from './store.js';
|
|
3
|
-
import { AUTHORIZATION_ENDED,
|
|
4
|
+
import { AUTHORIZATION_ENDED, request, WIRE_REACH, } from './wire.js';
|
|
4
5
|
const NARROWED = new Set(['within', 'whole']);
|
|
5
6
|
function answered(md, app, writtenBy, member, input) {
|
|
6
7
|
switch (member) {
|
|
@@ -16,6 +17,10 @@ function answered(md, app, writtenBy, member, input) {
|
|
|
16
17
|
return md.save(input[0], input[1], writtenBy);
|
|
17
18
|
case 'history':
|
|
18
19
|
return md.history(input[0], input[1], input[2]);
|
|
20
|
+
case 'binaryFile.read':
|
|
21
|
+
return md.binaryFile.read(input[0], input[1], input[2]);
|
|
22
|
+
case 'binaryFile.readReference':
|
|
23
|
+
return md.binaryFile.readReference(input[0]);
|
|
19
24
|
case 'call':
|
|
20
25
|
return md.call(input[0], input[1]);
|
|
21
26
|
case 'reached':
|
|
@@ -57,7 +62,7 @@ function answered(md, app, writtenBy, member, input) {
|
|
|
57
62
|
case 'conversation.delete':
|
|
58
63
|
return md.conversation.delete(input[0]);
|
|
59
64
|
case 'chatDraft.write':
|
|
60
|
-
return md.chatDraft.write(input[0], input[1]);
|
|
65
|
+
return md.chatDraft.write(input[0], input[1], input[2]);
|
|
61
66
|
case 'chatDraft.discard':
|
|
62
67
|
return md.chatDraft.discard(input[0]);
|
|
63
68
|
}
|
|
@@ -87,7 +92,7 @@ export function serveMdRuntime(options) {
|
|
|
87
92
|
const observations = new Map();
|
|
88
93
|
let serving = true;
|
|
89
94
|
const send = (message) => {
|
|
90
|
-
port.postMessage(
|
|
95
|
+
port.postMessage(message);
|
|
91
96
|
};
|
|
92
97
|
const detach = () => {
|
|
93
98
|
if (!serving)
|
|
@@ -131,27 +136,14 @@ export function serveMdRuntime(options) {
|
|
|
131
136
|
send({ kind: 'result', id: message.id, value });
|
|
132
137
|
}
|
|
133
138
|
catch (error) {
|
|
134
|
-
if (serving)
|
|
135
|
-
send({
|
|
136
|
-
kind: 'failure',
|
|
137
|
-
id: message.id,
|
|
138
|
-
message: error instanceof Error ? error.message : String(error),
|
|
139
|
-
});
|
|
140
|
-
}
|
|
139
|
+
if (serving)
|
|
140
|
+
send({ kind: 'failure', id: message.id, ...described(error) });
|
|
141
141
|
}
|
|
142
142
|
};
|
|
143
143
|
port.addEventListener('message', (event) => {
|
|
144
144
|
if (!serving)
|
|
145
145
|
return;
|
|
146
|
-
const
|
|
147
|
-
if (wire === null)
|
|
148
|
-
return;
|
|
149
|
-
if (!wire.matching) {
|
|
150
|
-
send({ kind: 'refusal', refusal: PROTOCOL_MISMATCH });
|
|
151
|
-
detach();
|
|
152
|
-
return;
|
|
153
|
-
}
|
|
154
|
-
const message = request(wire.message);
|
|
146
|
+
const message = request(event.data);
|
|
155
147
|
if (message === null)
|
|
156
148
|
return;
|
|
157
149
|
void serve(message);
|
|
@@ -184,3 +176,4 @@ export function serveMdRuntime(options) {
|
|
|
184
176
|
},
|
|
185
177
|
};
|
|
186
178
|
}
|
|
179
|
+
export { AUTHORED_SCHEMA, STORE_SCHEMA } from './store.js';
|
package/dist/identity.d.ts
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
1
|
export declare function changeBatchIdentity(at?: number): string;
|
|
2
2
|
export declare function roomDraftRevision(): string;
|
|
3
|
+
export declare function chatDraftRevision(): string;
|
|
4
|
+
export declare function transferIdentity(): string;
|
|
5
|
+
export declare function binaryLocalId(): string;
|
|
3
6
|
//# sourceMappingURL=identity.d.ts.map
|
package/dist/identity.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"identity.d.ts","sourceRoot":"","sources":["../src/identity.ts"],"names":[],"mappings":"AAAA,wBAAgB,mBAAmB,CAAC,EAAE,GAAE,MAAmB,GAAG,MAAM,CAWnE;AAED,wBAAgB,iBAAiB,IAAI,MAAM,
|
|
1
|
+
{"version":3,"file":"identity.d.ts","sourceRoot":"","sources":["../src/identity.ts"],"names":[],"mappings":"AAAA,wBAAgB,mBAAmB,CAAC,EAAE,GAAE,MAAmB,GAAG,MAAM,CAWnE;AAQD,wBAAgB,iBAAiB,IAAI,MAAM,CAE1C;AAED,wBAAgB,iBAAiB,IAAI,MAAM,CAE1C;AAED,wBAAgB,gBAAgB,IAAI,MAAM,CAEzC;AAED,wBAAgB,aAAa,IAAI,MAAM,CAEtC"}
|
package/dist/identity.js
CHANGED
|
@@ -10,8 +10,20 @@ export function changeBatchIdentity(at = Date.now()) {
|
|
|
10
10
|
const hex = [...bytes].map((byte) => byte.toString(16).padStart(2, '0')).join('');
|
|
11
11
|
return `${hex.slice(0, 8)}-${hex.slice(8, 12)}-${hex.slice(12, 16)}-${hex.slice(16, 20)}-${hex.slice(20)}`;
|
|
12
12
|
}
|
|
13
|
-
|
|
13
|
+
function randomIdentity() {
|
|
14
14
|
const bytes = new Uint8Array(16);
|
|
15
15
|
crypto.getRandomValues(bytes);
|
|
16
16
|
return [...bytes].map((byte) => byte.toString(16).padStart(2, '0')).join('');
|
|
17
17
|
}
|
|
18
|
+
export function roomDraftRevision() {
|
|
19
|
+
return randomIdentity();
|
|
20
|
+
}
|
|
21
|
+
export function chatDraftRevision() {
|
|
22
|
+
return randomIdentity();
|
|
23
|
+
}
|
|
24
|
+
export function transferIdentity() {
|
|
25
|
+
return randomIdentity();
|
|
26
|
+
}
|
|
27
|
+
export function binaryLocalId() {
|
|
28
|
+
return randomIdentity();
|
|
29
|
+
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,14 +1,19 @@
|
|
|
1
|
-
export type { AcceptedMessage, ActionDeclaration, ActionRequest, ActionResult, Adapter, AdapterFailure, Authorization, BootstrapPage, BootstrapRequest, BootstrapResult, Capability, ChangeAuthor, ContractUnavailable, ConversationAction,
|
|
1
|
+
export type { AcceptedMessage, ActionDeclaration, ActionRequest, ActionResult, Adapter, AdapterFailure, Authorization, BinaryFile, BinaryRequest, BinaryResult, ReferrerScope, BootstrapPage, BootstrapRequest, BootstrapResult, Capability, ChangeAuthor, ContractUnavailable, ConversationAction, ConversationAgents, ConversationEvent, ConversationHistories, ConversationHistoryPage, ConversationHistoryRequest, ConversationMessage, ConversationStream, DiscoverResult, DiscoveredRoom, Discovery, HistoryAuthor, HistoryRequest, HistoryResult, HistoryRetention, HistoryRevision, HeldRoom, ListedConversation, MdModelIdentity, Member, MutationRequest, MutationResult, PageToken, ProviderLimit, ProviderRefusal, RefreshPage, RefreshRequest, RefreshResult, Retention, RetryableRefusal, RevokedAuthorization, RoomModels, RoomNotReadable, RoomStream, RoomStreamEvent, RoomVersionAt, ServiceMode, ServiceModeSignal, TransportUncertainty, TurnContext, TurnOperation, TypedSelection, } from './adapter.js';
|
|
2
2
|
export type { Change, ChangeBatch, Precondition, WrittenBy } from './change.js';
|
|
3
|
-
export type { ChatDraft, ChatDraftSurface, ConversationEntry, ConversationOptions, ConversationSurface, ConversationView, RunningTurn, } from './conversation.js';
|
|
3
|
+
export type { ChatDraft, ChatDraftSurface, ConversationAgent, ConversationEntry, ConversationOptions, ConversationState, ConversationSurface, ConversationView, RunningTurn, } from './conversation.js';
|
|
4
4
|
export type { ChatDraftFile, FileDeclaration } from './file.js';
|
|
5
|
-
export type { AppRoom, AppTypedSelection, ConnectionRefusal,
|
|
5
|
+
export type { AppRoom, AppTypedSelection, BinaryFileSurface, ConnectionRefusal, ConnectionRefusalCode, HistoryQuery, MdRuntime, MdRuntimeOptions, PresentationSurface, RoomDraftSurface, RoomSchemas, SavedRoomDraft, SaveResult, } from './connection.js';
|
|
6
6
|
export type { Observation } from './observation.js';
|
|
7
|
-
export type { CallResult, QueueEntry, Submission } from './outcome.js';
|
|
7
|
+
export type { BinaryAnswer, CallResult, Failure, HistoryAnswer, QueueEntry, Submission, } from './outcome.js';
|
|
8
|
+
export type { BinaryFileRecord, BinaryReference } from './binary.js';
|
|
9
|
+
export type { RuntimeError } from './failure.js';
|
|
8
10
|
export type { ChangedPart, FieldValue, ReturnReason, RoomDraft, RoomDraftCreation, RoomDraftParts, RoomDraftWrite, } from './room-draft.js';
|
|
9
11
|
export type { SaveRefusal } from './save.js';
|
|
10
12
|
export type { DocumentHit, DocumentPart, MessageHit, SearchRequest, SearchResult, } from './search.js';
|
|
13
|
+
export { departure } from './change.js';
|
|
11
14
|
export { changeBatchIdentity } from './identity.js';
|
|
15
|
+
export { attempts, identities, intentOf, type Answered, type Attempt, type Attempts, type Identities, } from './attempt.js';
|
|
16
|
+
export { expectedList, expecting, type ExpectedOf, type Expecting } from './expectation.js';
|
|
12
17
|
export type { RuntimeShell } from './durability.js';
|
|
13
18
|
export type { AttentionEntry, SyncStatus } from './status.js';
|
|
14
19
|
export type { Backlink, Direction, DocumentQuery, DocumentResult, Filter, GroupQuery, GroupResult, Key, LocalQuery, OrderOptions, Predicate, QueryDocument, QueryGroup, QueryResult, Related, Select, Value, Where, } from './query.js';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,eAAe,EACf,iBAAiB,EACjB,aAAa,EACb,YAAY,EACZ,OAAO,EACP,cAAc,EACd,aAAa,EACb,aAAa,EACb,gBAAgB,EAChB,eAAe,EACf,UAAU,EACV,YAAY,EACZ,mBAAmB,EACnB,kBAAkB,EAClB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,eAAe,EACf,iBAAiB,EACjB,aAAa,EACb,YAAY,EACZ,OAAO,EACP,cAAc,EACd,aAAa,EACb,UAAU,EACV,aAAa,EACb,YAAY,EACZ,aAAa,EACb,aAAa,EACb,gBAAgB,EAChB,eAAe,EACf,UAAU,EACV,YAAY,EACZ,mBAAmB,EACnB,kBAAkB,EAClB,kBAAkB,EAClB,iBAAiB,EACjB,qBAAqB,EACrB,uBAAuB,EACvB,0BAA0B,EAC1B,mBAAmB,EACnB,kBAAkB,EAClB,cAAc,EACd,cAAc,EACd,SAAS,EACT,aAAa,EACb,cAAc,EACd,aAAa,EACb,gBAAgB,EAChB,eAAe,EACf,QAAQ,EACR,kBAAkB,EAClB,eAAe,EACf,MAAM,EACN,eAAe,EACf,cAAc,EACd,SAAS,EACT,aAAa,EACb,eAAe,EACf,WAAW,EACX,cAAc,EACd,aAAa,EACb,SAAS,EACT,gBAAgB,EAChB,oBAAoB,EACpB,UAAU,EACV,eAAe,EACf,UAAU,EACV,eAAe,EACf,aAAa,EACb,WAAW,EACX,iBAAiB,EACjB,oBAAoB,EACpB,WAAW,EACX,aAAa,EACb,cAAc,GACf,MAAM,cAAc,CAAC;AACtB,YAAY,EAAE,MAAM,EAAE,WAAW,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAChF,YAAY,EACV,SAAS,EACT,gBAAgB,EAChB,iBAAiB,EACjB,iBAAiB,EACjB,mBAAmB,EACnB,iBAAiB,EACjB,mBAAmB,EACnB,gBAAgB,EAChB,WAAW,GACZ,MAAM,mBAAmB,CAAC;AAC3B,YAAY,EAAE,aAAa,EAAE,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ACR,SAAS,EACT,aAAa,EACb,cAAc,EACd,MAAM,EACN,UAAU,EACV,WAAW,EACX,GAAG,EACH,UAAU,EACV,YAAY,EACZ,SAAS,EACT,aAAa,EACb,UAAU,EACV,WAAW,EACX,OAAO,EACP,MAAM,EACN,KAAK,EACL,KAAK,GACN,MAAM,YAAY,CAAC;AAEpB,YAAY,EACV,MAAM,EACN,aAAa,EACb,aAAa,EACb,UAAU,EACV,WAAW,EACX,WAAW,EACX,iBAAiB,GAClB,MAAM,YAAY,CAAC;AACpB,YAAY,EAAE,eAAe,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC"}
|
package/dist/index.js
CHANGED
package/dist/memory.d.ts
CHANGED
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
import type { ModelResult } from './model.js';
|
|
2
|
-
import { type AcceptedMessage, type ActionResult, type Adapter, type Capability, type ConversationAction, type ConversationEvent, type DiscoveredRoom, type HeadChange, type
|
|
2
|
+
import { type AcceptedMessage, type ActionResult, type Adapter, type BinaryFile, type Capability, type ConversationAction, type ConversationEvent, type DiscoveredRoom, type HeadChange, type ListedConversation, type Member, type ProviderLimit, type Retention, type ServiceMode } from './adapter.js';
|
|
3
3
|
export type MemoryRoom = DiscoveredRoom & {
|
|
4
4
|
model?: ModelResult;
|
|
5
5
|
selectionModel?: ModelResult;
|
|
6
6
|
documents?: Readonly<Record<string, string>>;
|
|
7
7
|
revisions?: Readonly<Record<string, string>>;
|
|
8
8
|
changes?: Readonly<Record<string, HeadChange>>;
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
binaryFiles?: Readonly<Record<string, BinaryFile>>;
|
|
10
|
+
blobs?: Readonly<Record<string, Blob>>;
|
|
11
11
|
};
|
|
12
12
|
export type MemoryConversation = {
|
|
13
13
|
conversation: string;
|
|
14
|
+
listed?: Omit<ListedConversation, 'conversation'>;
|
|
14
15
|
messages?: readonly AcceptedMessage[];
|
|
15
16
|
outcomes?: Partial<Record<ConversationAction, ActionResult>>;
|
|
16
17
|
};
|
|
@@ -19,11 +20,10 @@ export type MemoryAdapterOptions = {
|
|
|
19
20
|
conversations?: readonly MemoryConversation[];
|
|
20
21
|
historyPageSize?: number;
|
|
21
22
|
pageSize?: number;
|
|
22
|
-
mdModel?: MdModelIdentity;
|
|
23
|
-
supportedVersions?: readonly number[];
|
|
24
23
|
capabilities?: readonly Capability[];
|
|
25
24
|
providerLimits?: readonly ProviderLimit[];
|
|
26
25
|
retention?: Retention;
|
|
26
|
+
member?: Member;
|
|
27
27
|
unopened?: boolean;
|
|
28
28
|
};
|
|
29
29
|
export type MemoryAdapter = Adapter & {
|
package/dist/memory.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"memory.d.ts","sourceRoot":"","sources":["../src/memory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,
|
|
1
|
+
{"version":3,"file":"memory.d.ts","sourceRoot":"","sources":["../src/memory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,EACL,KAAK,eAAe,EAEpB,KAAK,YAAY,EACjB,KAAK,OAAO,EAEZ,KAAK,UAAU,EAKf,KAAK,UAAU,EACf,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,EAItB,KAAK,cAAc,EACnB,KAAK,UAAU,EAGf,KAAK,kBAAkB,EACvB,KAAK,MAAM,EAGX,KAAK,aAAa,EAIlB,KAAK,SAAS,EAGd,KAAK,WAAW,EACjB,MAAM,cAAc,CAAC;AAkBtB,MAAM,MAAM,UAAU,GAAG,cAAc,GAAG;IACxC,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB,cAAc,CAAC,EAAE,WAAW,CAAC;IAC7B,SAAS,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IAC7C,SAAS,CAAC,EAA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AAM,CAAC,SAAS,EAAE,MAAM,OAAO,EAAE,MAAM,EAAE,OAAO,GAAG,IAAI,CAAC;IACxD,IAAI,IAAI,IAAI,CAAC;IACb,KAAK,CAAC,OAAO,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;IAC/B,MAAM,CAAC,QAAQ,EAAE,SAAS,MAAM,EAAE,GAAG,IAAI,CAAC;IAC1C,iBAAiB,CAAC,YAAY,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;IAChF,kBAAkB,CAAC,KAAK,EAAE,iBAAiB,GAAG,IAAI,CAAC;IACnD,iBAAiB,CAAC,IAAI,EAAE,WAAW,GAAG,IAAI,CAAC;IAC3C,SAAS,IAAI,SAAS,MAAM,EAAE,CAAC;IAC/B,uBAAuB,IAAI,SAAS,MAAM,EAAE,CAAC;CAC9C,CAAC;AA+CF,wBAAgB,mBAAmB,CAAC,OAAO,GAAE,oBAAyB,GAAG,aAAa,CA0drF"}
|
package/dist/memory.js
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { ROOM_CONTRACT_VERSION, } from './adapter.js';
|
|
2
|
-
import { MD_MODEL } from './collection.js';
|
|
3
1
|
import { sameChange } from './overlay.js';
|
|
4
2
|
const FIXTURE_RETENTION = {
|
|
5
3
|
history: { kind: 'duration', seconds: 1 },
|
|
@@ -44,8 +42,6 @@ async function resolveScript(answer, fallback, request) {
|
|
|
44
42
|
}
|
|
45
43
|
export function createMemoryAdapter(options = {}) {
|
|
46
44
|
let rooms = options.rooms === undefined ? [] : [...options.rooms];
|
|
47
|
-
const mdModel = options.mdModel ?? MD_MODEL;
|
|
48
|
-
const supportedVersions = options.supportedVersions ?? [ROOM_CONTRACT_VERSION];
|
|
49
45
|
const capabilities = options.capabilities ?? [];
|
|
50
46
|
const providerLimits = options.providerLimits ?? [];
|
|
51
47
|
const retention = declaredRetention(options.retention);
|
|
@@ -103,6 +99,7 @@ export function createMemoryAdapter(options = {}) {
|
|
|
103
99
|
return {
|
|
104
100
|
name: room.name,
|
|
105
101
|
locator: room.locator,
|
|
102
|
+
handle: room.handle,
|
|
106
103
|
roomVersion: room.roomVersion,
|
|
107
104
|
operations: room.operations,
|
|
108
105
|
replica: room.replica,
|
|
@@ -110,29 +107,30 @@ export function createMemoryAdapter(options = {}) {
|
|
|
110
107
|
providerOwnedPaths: room.providerOwnedPaths,
|
|
111
108
|
};
|
|
112
109
|
}
|
|
113
|
-
function page(room,
|
|
110
|
+
function page(room, after) {
|
|
114
111
|
const paths = Object.keys(room.documents ?? {}).sort();
|
|
112
|
+
const opening = after === undefined;
|
|
113
|
+
const from = opening ? 0 : paths.filter((path) => path <= after).length;
|
|
115
114
|
const size = pageSize ?? paths.length;
|
|
116
115
|
const taken = paths.slice(from, from + size);
|
|
117
116
|
const next = from + taken.length;
|
|
118
|
-
const targets =
|
|
117
|
+
const targets = opening ? Object.keys(room.binaryFiles ?? {}) : [];
|
|
119
118
|
return {
|
|
120
119
|
kind: 'bootstrap',
|
|
121
120
|
roomVersion: room.roomVersion,
|
|
122
|
-
...(
|
|
121
|
+
...(opening ? { models: modelsOf(room) } : {}),
|
|
123
122
|
documents: named(room.documents ?? {}, taken),
|
|
124
|
-
revisions: named(room.revisions ?? {}, taken),
|
|
123
|
+
revisions: named(room.revisions ?? {}, [...taken, ...targets]),
|
|
125
124
|
changes: named(room.changes ?? {}, [...taken, ...targets]),
|
|
126
|
-
|
|
127
|
-
...(
|
|
128
|
-
...(next < paths.length ? { pageToken: String(next) } : {}),
|
|
125
|
+
binaryFiles: named(room.binaryFiles ?? {}, targets),
|
|
126
|
+
...(next < paths.length ? { pageToken: taken.at(-1) } : {}),
|
|
129
127
|
};
|
|
130
128
|
}
|
|
131
129
|
function advancement(room, from, at) {
|
|
132
130
|
const current = room.documents ?? {};
|
|
133
131
|
const previous = from.documents ?? {};
|
|
134
|
-
const currentTargets = new Set(room.
|
|
135
|
-
const previousTargets = new Set(from.
|
|
132
|
+
const currentTargets = new Set(Object.keys(room.binaryFiles ?? {}));
|
|
133
|
+
const previousTargets = new Set(Object.keys(from.binaryFiles ?? {}));
|
|
136
134
|
const headMoved = (path) => room.revisions?.[path] !== from.revisions?.[path] ||
|
|
137
135
|
!sameChange(room.changes?.[path], from.changes?.[path]);
|
|
138
136
|
const changed = Object.keys(current)
|
|
@@ -148,24 +146,21 @@ export function createMemoryAdapter(options = {}) {
|
|
|
148
146
|
const targets = opening
|
|
149
147
|
? [...currentTargets].filter((target) => !previousTargets.has(target) || headMoved(target))
|
|
150
148
|
: [];
|
|
151
|
-
const attachments = room.attachments ?? [];
|
|
152
|
-
const declared = opening && JSON.stringify(attachments) !== JSON.stringify(from.attachments ?? []);
|
|
153
149
|
const models = opening ? changedModels(room, from) : undefined;
|
|
154
150
|
return {
|
|
155
151
|
kind: 'net-advancement',
|
|
156
152
|
roomVersion: room.roomVersion,
|
|
157
153
|
...(models === undefined ? {} : { models }),
|
|
158
154
|
documents: named(current, taken),
|
|
159
|
-
revisions: named(room.revisions ?? {}, taken),
|
|
155
|
+
revisions: named(room.revisions ?? {}, [...taken, ...targets]),
|
|
160
156
|
changes: named(room.changes ?? {}, [...taken, ...targets]),
|
|
161
|
-
|
|
157
|
+
binaryFiles: named(room.binaryFiles ?? {}, targets),
|
|
162
158
|
removals: opening
|
|
163
159
|
? [
|
|
164
160
|
...Object.keys(previous).filter((path) => !(path in current) && !currentTargets.has(path)),
|
|
165
161
|
...[...previousTargets].filter((target) => !currentTargets.has(target) && !(target in current)),
|
|
166
162
|
].sort()
|
|
167
163
|
: [],
|
|
168
|
-
...(declared ? { attachments } : {}),
|
|
169
164
|
...(pageToken === undefined ? {} : { pageToken }),
|
|
170
165
|
};
|
|
171
166
|
}
|
|
@@ -186,7 +181,7 @@ export function createMemoryAdapter(options = {}) {
|
|
|
186
181
|
function historiesOf(input) {
|
|
187
182
|
const asked = input?.conversations;
|
|
188
183
|
if (!Array.isArray(asked))
|
|
189
|
-
return { kind: 'rejected', code: 'invalid_request', fields: {} };
|
|
184
|
+
return { kind: 'rejected', code: 'invalid_request', fields: {}, retryable: false };
|
|
190
185
|
const histories = [];
|
|
191
186
|
for (const entry of asked) {
|
|
192
187
|
const conversation = typeof entry.conversation === 'string' ? scripted.get(entry.conversation) : undefined;
|
|
@@ -214,7 +209,12 @@ export function createMemoryAdapter(options = {}) {
|
|
|
214
209
|
const named = typeof input.conversation === 'string' ? input.conversation : '';
|
|
215
210
|
const conversation = scripted.get(named);
|
|
216
211
|
if (conversation === undefined) {
|
|
217
|
-
return {
|
|
212
|
+
return {
|
|
213
|
+
kind: 'rejected',
|
|
214
|
+
code: 'unknown-conversation',
|
|
215
|
+
fields: { conversation: named },
|
|
216
|
+
retryable: false,
|
|
217
|
+
};
|
|
218
218
|
}
|
|
219
219
|
const outcome = conversation.outcomes?.[name];
|
|
220
220
|
if (outcome !== undefined)
|
|
@@ -228,7 +228,7 @@ export function createMemoryAdapter(options = {}) {
|
|
|
228
228
|
if (name === 'conversation.cancel') {
|
|
229
229
|
const turn = typeof input.turn === 'string' ? input.turn : '';
|
|
230
230
|
if (sealed.has(turn) || !unsealed.has(turn)) {
|
|
231
|
-
return { kind: 'rejected', code: 'turn-sealed', fields: { turn } };
|
|
231
|
+
return { kind: 'rejected', code: 'turn-sealed', fields: { turn }, retryable: false };
|
|
232
232
|
}
|
|
233
233
|
unsealed.delete(turn);
|
|
234
234
|
return { kind: 'action', result: { turn, cancelled: true } };
|
|
@@ -237,15 +237,19 @@ export function createMemoryAdapter(options = {}) {
|
|
|
237
237
|
scripted.delete(named);
|
|
238
238
|
return { kind: 'action', result: { conversation: named } };
|
|
239
239
|
}
|
|
240
|
+
function announceList() {
|
|
241
|
+
const entries = [...scripted.values()].flatMap(({ conversation, listed }) => listed === undefined ? [] : [{ conversation, ...listed }]);
|
|
242
|
+
for (const listener of listeners)
|
|
243
|
+
listener({ kind: 'list', entries });
|
|
244
|
+
}
|
|
240
245
|
function discovery() {
|
|
241
246
|
return {
|
|
242
247
|
kind: 'discovery',
|
|
243
|
-
supportedVersions,
|
|
244
|
-
mdModel,
|
|
245
248
|
rooms: rooms.map(declared),
|
|
246
249
|
capabilities,
|
|
247
250
|
providerLimits,
|
|
248
251
|
retention,
|
|
252
|
+
...(options.member === undefined ? {} : { member: options.member }),
|
|
249
253
|
};
|
|
250
254
|
}
|
|
251
255
|
return {
|
|
@@ -257,6 +261,7 @@ export function createMemoryAdapter(options = {}) {
|
|
|
257
261
|
scriptConversations(next);
|
|
258
262
|
},
|
|
259
263
|
open() {
|
|
264
|
+
announceList();
|
|
260
265
|
for (const observer of observers)
|
|
261
266
|
observer({ kind: 'opened' });
|
|
262
267
|
},
|
|
@@ -329,12 +334,23 @@ export function createMemoryAdapter(options = {}) {
|
|
|
329
334
|
}
|
|
330
335
|
});
|
|
331
336
|
},
|
|
337
|
+
reopen() {
|
|
338
|
+
queueMicrotask(() => {
|
|
339
|
+
for (const observer of observers)
|
|
340
|
+
observer({ kind: 'closed', revoked: false });
|
|
341
|
+
});
|
|
342
|
+
},
|
|
332
343
|
observe(notify) {
|
|
333
344
|
observers.add(notify);
|
|
334
345
|
queueMicrotask(() => {
|
|
335
346
|
if (!observers.has(notify))
|
|
336
347
|
return;
|
|
337
|
-
|
|
348
|
+
if (options.unopened === true) {
|
|
349
|
+
notify({ kind: 'closed', revoked: false });
|
|
350
|
+
return;
|
|
351
|
+
}
|
|
352
|
+
announceList();
|
|
353
|
+
notify({ kind: 'opened' });
|
|
338
354
|
});
|
|
339
355
|
return () => {
|
|
340
356
|
observers.delete(notify);
|
|
@@ -373,7 +389,7 @@ export function createMemoryAdapter(options = {}) {
|
|
|
373
389
|
if (room === undefined) {
|
|
374
390
|
return { kind: 'room-not-readable', locator: request.locator };
|
|
375
391
|
}
|
|
376
|
-
return page(room, request.pageToken
|
|
392
|
+
return page(room, request.pageToken);
|
|
377
393
|
}, request).then((answer) => note(request.locator, answer));
|
|
378
394
|
},
|
|
379
395
|
async refresh(_authorization, request) {
|
|
@@ -406,7 +422,13 @@ export function createMemoryAdapter(options = {}) {
|
|
|
406
422
|
if (room === undefined) {
|
|
407
423
|
return { kind: 'room-not-readable', locator: request.locator };
|
|
408
424
|
}
|
|
409
|
-
return {
|
|
425
|
+
return {
|
|
426
|
+
kind: 'rejected',
|
|
427
|
+
code: 'unscripted-mutation',
|
|
428
|
+
fields: {},
|
|
429
|
+
retryable: false,
|
|
430
|
+
affected: {},
|
|
431
|
+
};
|
|
410
432
|
}, request).then((answer) => note(request.locator, answer));
|
|
411
433
|
},
|
|
412
434
|
async history(_authorization, request) {
|
|
@@ -421,11 +443,35 @@ export function createMemoryAdapter(options = {}) {
|
|
|
421
443
|
};
|
|
422
444
|
}, request);
|
|
423
445
|
},
|
|
446
|
+
async binary(_authorization, request) {
|
|
447
|
+
return resolveScript(scripts.binary, () => {
|
|
448
|
+
if (request.kind === 'reference') {
|
|
449
|
+
return { kind: 'rejected', code: 'unscripted-binary', fields: {}, retryable: false };
|
|
450
|
+
}
|
|
451
|
+
const room = rooms.find((entry) => entry.locator === request.locator);
|
|
452
|
+
if (room === undefined)
|
|
453
|
+
return { kind: 'room-not-readable', locator: request.locator };
|
|
454
|
+
const blob = room.blobs?.[request.path];
|
|
455
|
+
return blob === undefined
|
|
456
|
+
? { kind: 'rejected', code: 'file_not_found', fields: {}, retryable: false }
|
|
457
|
+
: { kind: 'binary', blob };
|
|
458
|
+
}, request);
|
|
459
|
+
},
|
|
460
|
+
referrerScope(referrer) {
|
|
461
|
+
if (typeof referrer !== 'object' || referrer === null)
|
|
462
|
+
return null;
|
|
463
|
+
const { room, path, message } = referrer;
|
|
464
|
+
if (typeof message === 'string')
|
|
465
|
+
return { kind: 'conversations' };
|
|
466
|
+
if (typeof room !== 'string')
|
|
467
|
+
return null;
|
|
468
|
+
return { kind: 'room', locator: room, ...(typeof path === 'string' ? { path } : {}) };
|
|
469
|
+
},
|
|
424
470
|
async action(_authorization, request) {
|
|
425
471
|
return resolveScript(scripts.action, () => {
|
|
426
472
|
if (request.name.startsWith('conversation.'))
|
|
427
473
|
return conversationAction(request);
|
|
428
|
-
return { kind: 'rejected', code: 'unscripted-action', fields: {} };
|
|
474
|
+
return { kind: 'rejected', code: 'unscripted-action', fields: {}, retryable: false };
|
|
429
475
|
}, request).then((answer) => {
|
|
430
476
|
if (answer.kind === 'action' && answer.at !== undefined)
|
|
431
477
|
note(answer.at.locator, answer.at);
|
package/dist/model.d.ts
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
import type { Definition,
|
|
1
|
+
import type { Definition, ValueFacts, VerifiedModel } from '@agentshouse/mdmodel';
|
|
2
|
+
import type { Open } from './open.js';
|
|
2
3
|
export type ModelIdentity = {
|
|
3
4
|
identity: string;
|
|
4
5
|
version: string;
|
|
5
6
|
};
|
|
6
7
|
export type ModelSnapshot = ModelIdentity & {
|
|
7
8
|
schema: string | null;
|
|
9
|
+
revision: string | null;
|
|
8
10
|
};
|
|
9
|
-
export type ModelUnavailableReason = 'not-readable' | 'revoked' | 'not-acquired' | 'invalid'
|
|
11
|
+
export type ModelUnavailableReason = Open<'not-readable' | 'revoked' | 'not-acquired' | 'invalid'>;
|
|
10
12
|
export type ModelResult = {
|
|
11
13
|
kind: 'model';
|
|
12
14
|
snapshot: ModelSnapshot;
|
|
@@ -14,14 +16,12 @@ export type ModelResult = {
|
|
|
14
16
|
kind: 'model-unavailable';
|
|
15
17
|
reason: ModelUnavailableReason;
|
|
16
18
|
};
|
|
17
|
-
export type MdType =
|
|
18
|
-
name: string;
|
|
19
|
-
fields: Readonly<Record<string, FieldSpec>>;
|
|
20
|
-
sections: Readonly<Record<string, SectionSpec>>;
|
|
21
|
-
};
|
|
19
|
+
export type MdType = Definition;
|
|
22
20
|
export type ModelState = {
|
|
23
21
|
status: 'unavailable';
|
|
24
22
|
reason: ModelUnavailableReason;
|
|
23
|
+
schema?: string | null;
|
|
24
|
+
revision?: string | null;
|
|
25
25
|
} | {
|
|
26
26
|
status: 'current' | 'cached';
|
|
27
27
|
snapshot: ModelSnapshot;
|
|
@@ -31,21 +31,26 @@ export type ModelState = {
|
|
|
31
31
|
export type TypesResult = {
|
|
32
32
|
status: 'unavailable';
|
|
33
33
|
reason: ModelUnavailableReason;
|
|
34
|
+
schema?: string | null;
|
|
35
|
+
revision?: string | null;
|
|
34
36
|
} | {
|
|
35
37
|
status: 'current' | 'cached';
|
|
36
38
|
identity: string;
|
|
37
39
|
version: string;
|
|
38
40
|
verifiedWith: ModelIdentity;
|
|
39
41
|
types: readonly MdType[];
|
|
42
|
+
schema: string | null;
|
|
43
|
+
revision: string | null;
|
|
40
44
|
};
|
|
41
45
|
export type ValidationReceipt = {
|
|
42
46
|
identity: string;
|
|
43
47
|
version: string;
|
|
44
|
-
source: 'current' | 'cached'
|
|
48
|
+
source: Open<'current' | 'cached'>;
|
|
45
49
|
};
|
|
46
50
|
export declare const NO_MODEL: ModelState;
|
|
47
51
|
export declare function definitionOf(state: ModelState, type: string | undefined): Definition | undefined;
|
|
48
52
|
export declare function modelTypes(state: ModelState): TypesResult;
|
|
49
53
|
export declare function cached(state: ModelState): ModelState;
|
|
50
54
|
export declare function sameModel(left: ModelIdentity, right: ModelIdentity): boolean;
|
|
55
|
+
export declare function referenceField(facts: ValueFacts | undefined): boolean;
|
|
51
56
|
//# sourceMappingURL=model.d.ts.map
|
package/dist/model.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../src/model.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,
|
|
1
|
+
{"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../src/model.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAClF,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEtC,MAAM,MAAM,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AY,EAAE,aAAa,CAAC;IAC5B,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;IACzB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;CACzB,CAAC;AACN,MAAM,MAAM,iBAAiB,GAAG;IAC9B,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC,CAAC;CACpC,CAAC;AACF,eAAO,MAAM,QAAQ,EAAE,UAA8D,CAAC;AACtF,wBAAgB,YAAY,CAAC,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,UAAU,GAAG,SAAS,CAGhG;AACD,wBAAgB,UAAU,CAAC,KAAK,EAAE,UAAU,GAAG,WAAW,CAgBzD;AACD,wBAAgB,MAAM,CAAC,KAAK,EAAE,UAAU,GAAG,UAAU,CAEpD;AACD,wBAAgB,SAAS,CAAC,IAAI,EAAE,aAAa,EAAE,KAAK,EAAE,aAAa,GAAG,OAAO,CAE5E;AACD,wBAAgB,cAAc,CAAC,KAAK,EAAE,UAAU,GAAG,SAAS,GAAG,OAAO,CAErE"}
|
package/dist/model.js
CHANGED
|
@@ -12,9 +12,9 @@ export function modelTypes(state) {
|
|
|
12
12
|
identity: state.snapshot.identity,
|
|
13
13
|
version: state.snapshot.version,
|
|
14
14
|
verifiedWith: { ...state.verifiedWith },
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
schema: state.snapshot.schema,
|
|
16
|
+
revision: state.snapshot.revision,
|
|
17
|
+
types: structuredClone(Object.values(state.types).sort((left, right) => left.name < right.name ? -1 : left.name > right.name ? 1 : 0)),
|
|
18
18
|
};
|
|
19
19
|
}
|
|
20
20
|
export function cached(state) {
|
|
@@ -23,3 +23,6 @@ export function cached(state) {
|
|
|
23
23
|
export function sameModel(left, right) {
|
|
24
24
|
return left.identity === right.identity && left.version === right.version;
|
|
25
25
|
}
|
|
26
|
+
export function referenceField(facts) {
|
|
27
|
+
return facts?.reference !== undefined || facts?.items?.reference !== undefined;
|
|
28
|
+
}
|
package/dist/open.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"open.d.ts","sourceRoot":"","sources":["../src/open.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,IAAI,CAAC,KAAK,SAAS,MAAM,IAAI,KAAK,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC"}
|
package/dist/open.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/outcome.d.ts
CHANGED
|
@@ -1,8 +1,30 @@
|
|
|
1
|
-
import type { ActionResult } from './adapter.js';
|
|
1
|
+
import type { ActionResult, AdapterFailure, BinaryResult, HistoryResult, ProviderRefusal, RoomVersionAt, ScopedRefusal } from './adapter.js';
|
|
2
2
|
import type { ChangeBatch } from './change.js';
|
|
3
|
-
|
|
4
|
-
kind:
|
|
3
|
+
type Refused<Kind extends string> = ProviderRefusal & {
|
|
4
|
+
kind: Kind;
|
|
5
5
|
};
|
|
6
|
+
export type Failure = Refused<'transport-uncertainty'> | Refused<'revoked-authorization'> | (Refused<'room-not-readable'> & {
|
|
7
|
+
locator: string;
|
|
8
|
+
}) | ScopedRefusal;
|
|
9
|
+
export type CallResult = {
|
|
10
|
+
kind: 'action';
|
|
11
|
+
result: unknown;
|
|
12
|
+
at?: RoomVersionAt;
|
|
13
|
+
} | Refused<'rejected'> | Refused<'undeclared'> | Failure;
|
|
14
|
+
export type HistoryAnswer = Exclude<HistoryResult, {
|
|
15
|
+
kind: Failure['kind'];
|
|
16
|
+
}> | Failure;
|
|
17
|
+
export type BinaryAnswer = {
|
|
18
|
+
kind: 'binary';
|
|
19
|
+
blob: Blob;
|
|
20
|
+
} | Refused<'rejected'> | Refused<'absent'> | Failure;
|
|
21
|
+
export declare function absentBinary(path: string): BinaryAnswer;
|
|
22
|
+
export declare function binaryAnswer(result: BinaryResult): BinaryAnswer;
|
|
23
|
+
export declare const UNCERTAIN: Failure;
|
|
24
|
+
export declare function undeclared(name: string): CallResult;
|
|
25
|
+
export declare function failure(result: AdapterFailure): Failure;
|
|
26
|
+
export declare function calledResult(result: ActionResult): CallResult;
|
|
27
|
+
export declare function historyAnswer(result: HistoryResult): HistoryAnswer;
|
|
6
28
|
export type Submission = {
|
|
7
29
|
readonly state: 'waiting' | 'submitted';
|
|
8
30
|
} | {
|
|
@@ -12,7 +34,10 @@ export type Submission = {
|
|
|
12
34
|
export type QueueEntry = {
|
|
13
35
|
readonly batch: ChangeBatch;
|
|
14
36
|
} & (Submission | {
|
|
37
|
+
readonly state: 'local';
|
|
38
|
+
} | {
|
|
15
39
|
readonly state: 'accepted';
|
|
16
40
|
readonly roomVersion: string;
|
|
17
41
|
});
|
|
42
|
+
export {};
|
|
18
43
|
//# sourceMappingURL=outcome.d.ts.map
|
package/dist/outcome.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"outcome.d.ts","sourceRoot":"","sources":["../src/outcome.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"outcome.d.ts","sourceRoot":"","sources":["../src/outcome.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,YAAY,EACZ,cAAc,EACd,YAAY,EACZ,aAAa,EACb,eAAe,EACf,aAAa,EACb,aAAa,EACd,MAAM,cAAc,CAAC;AACtB,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE/C,KAAK,OAAO,CAAC,IAAI,SAAS,MAAM,IAAI,eAAe,GAAG;IAAE,IAAI,EAAE,IAAI,CAAA;CAAE,CAAC;AAErE,MAAM,MAAM,OAAO,GACf,OAAO,CAAC,uBAAuB,CAAC,GAChC,OAAO,CAAC,uBAAuB,CAAC,GAChC,CAAC,OAAO,CAAC,mBAAmB,CAAC,GAAG;IAAE,OA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