@agentshouse/mdruntime 0.1.0-alpha.48 → 0.1.0-alpha.49
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 +6 -0
- package/dist/adapter.d.ts +9 -0
- package/dist/adapter.d.ts.map +1 -1
- package/dist/adapter.js.map +1 -1
- package/dist/attachment.d.ts +3 -0
- package/dist/attachment.d.ts.map +1 -0
- package/dist/attachment.js +11 -0
- package/dist/attachment.js.map +1 -0
- package/dist/bootstrap.d.ts.map +1 -1
- package/dist/bootstrap.js +7 -1
- package/dist/bootstrap.js.map +1 -1
- package/dist/connection.d.ts +2 -1
- package/dist/connection.d.ts.map +1 -1
- package/dist/connection.js +2 -0
- package/dist/connection.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/memory.d.ts +2 -1
- package/dist/memory.d.ts.map +1 -1
- package/dist/memory.js +8 -0
- package/dist/memory.js.map +1 -1
- package/dist/refresh.d.ts.map +1 -1
- package/dist/refresh.js +5 -1
- package/dist/refresh.js.map +1 -1
- package/dist/store.d.ts +2 -1
- package/dist/store.d.ts.map +1 -1
- package/dist/store.js +43 -6
- package/dist/store.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type { AcceptedMessage, ActionDeclaration, ActionRequest, ActionResult, Adapter, AdapterFailure, Authorization, BootstrapPage, BootstrapRequest, BootstrapResult, Capability, ChangeAuthor, ContractUnavailable, ConversationAction, ConversationCards, ConversationEvent, ConversationHistories, ConversationHistoryPage, ConversationHistoryRequest, ConversationMessage, ConversationStream, DiscoverResult, DiscoveredRoom, Discovery, HistoryAuthor, HistoryRequest, HistoryResult, HistoryRetention, HistoryRevision, MdModelIdentity, ModelRequest, MutationRequest, MutationResult, PageToken, ProviderLimit, ProviderRefusal, RefreshPage, RefreshRequest, RefreshResult, Retention, RetryableRefusal, RevokedAuthorization, RoomNotReadable, RoomVersionAt, RoomVersionNotification, SelectedRooms, ServiceMode, ServiceModeSignal, TransportUncertainty, TypedSelection, WorkingNote, } from './adapter.js';
|
|
1
|
+
export type { AcceptedMessage, ActionDeclaration, ActionRequest, ActionResult, Adapter, AdapterFailure, Authorization, BootstrapPage, BootstrapRequest, BootstrapResult, Capability, ChangeAuthor, ContractUnavailable, ConversationAction, ConversationCards, ConversationEvent, ConversationHistories, ConversationHistoryPage, ConversationHistoryRequest, ConversationMessage, ConversationStream, DiscoverResult, DiscoveredRoom, Discovery, HistoryAuthor, HistoryRequest, HistoryResult, HistoryRetention, HistoryRevision, MdModelIdentity, ModelRequest, MutationRequest, MutationResult, PageToken, ProviderLimit, ProviderRefusal, RefreshPage, RefreshRequest, RefreshResult, Retention, RetryableRefusal, RevokedAuthorization, RoomAttachment, RoomNotReadable, RoomVersionAt, RoomVersionNotification, SelectedRooms, ServiceMode, ServiceModeSignal, TransportUncertainty, TypedSelection, WorkingNote, } from './adapter.js';
|
|
2
2
|
export type { Change, ChangeBatch, Precondition, WrittenBy } from './change.js';
|
|
3
3
|
export type { ChatDraft, ChatDraftSurface, ConversationEntry, ConversationOptions, ConversationSurface, ConversationView, GrowingText, } from './conversation.js';
|
|
4
4
|
export type { ChatDraftFile, FileDeclaration } from './file.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,iBAAiB,EACjB,iBAAiB,EACjB,qBAAqB,EACrB,uBAAuB,EACvB,0BAA0B,EAC1B,mBAAmB,EACnB,kBAAkB,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ACV,aAAa,EACb,YAAY,GACb,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,YAAY,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AACpD,YAAY,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAC9D,YAAY,EACV,QAAQ,EACR,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"}
|
|
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,iBAAiB,EACjB,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,eAAe,EACf,YAAY,EACZ,eAAe,EACf,cAAc,EACd,SAAS,EACT,aAAa,EACb,eAAe,EACf,WAAW,EACX,cAAc,EACd,aA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B,CAAC;AACpD,YAAY,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAC9D,YAAY,EACV,QAAQ,EACR,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.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/workspace/packages/mdruntime/src/index.ts"],"sourcesContent":["export type {\n AcceptedMessage,\n ActionDeclaration,\n ActionRequest,\n ActionResult,\n Adapter,\n AdapterFailure,\n Authorization,\n BootstrapPage,\n BootstrapRequest,\n BootstrapResult,\n Capability,\n ChangeAuthor,\n ContractUnavailable,\n ConversationAction,\n ConversationCards,\n ConversationEvent,\n ConversationHistories,\n ConversationHistoryPage,\n ConversationHistoryRequest,\n ConversationMessage,\n ConversationStream,\n DiscoverResult,\n DiscoveredRoom,\n Discovery,\n HistoryAuthor,\n HistoryRequest,\n HistoryResult,\n HistoryRetention,\n HistoryRevision,\n MdModelIdentity,\n ModelRequest,\n MutationRequest,\n MutationResult,\n PageToken,\n ProviderLimit,\n ProviderRefusal,\n RefreshPage,\n RefreshRequest,\n RefreshResult,\n Retention,\n RetryableRefusal,\n RevokedAuthorization,\n RoomNotReadable,\n RoomVersionAt,\n RoomVersionNotification,\n SelectedRooms,\n ServiceMode,\n ServiceModeSignal,\n TransportUncertainty,\n TypedSelection,\n WorkingNote,\n} from './adapter.js';\nexport type { Change, ChangeBatch, Precondition, WrittenBy } from './change.js';\nexport type {\n ChatDraft,\n ChatDraftSurface,\n ConversationEntry,\n ConversationOptions,\n ConversationSurface,\n ConversationView,\n GrowingText,\n} from './conversation.js';\nexport type { ChatDraftFile, FileDeclaration } from './file.js';\nexport type {\n AppRoom,\n AppSlot,\n AppSlotEntry,\n AppTypedSelection,\n ConnectionRefusal,\n ConnectionRefusalReason,\n HistoryQuery,\n MdRuntime,\n MdRuntimeOptions,\n PresentationSurface,\n RoomDraftSurface,\n RoomTypes,\n SavedRoomDraft,\n SaveResult,\n} from './connection.js';\nexport type { Observation } from './observation.js';\nexport type {\n AcceptedOutcome,\n AffectedState,\n CallResult,\n QueueEntry,\n Submission,\n SubmissionOutcome,\n} from './outcome.js';\nexport type {\n ChangedPart,\n FieldValue,\n ReturnReason,\n RoomDraft,\n RoomDraftCreation,\n RoomDraftParts,\n RoomDraftWrite,\n} from './room-draft.js';\nexport type { SaveRefusal } from './save.js';\nexport type {\n DocumentHit,\n DocumentPart,\n MessageHit,\n SearchRequest,\n SearchResult,\n} from './search.js';\nexport { changeBatchIdentity } from './identity.js';\nexport { createMdRuntime } from './connection.js';\nexport type { RuntimeShell } from './durability.js';\nexport type { AttentionEntry, SyncStatus } from './status.js';\nexport type {\n Backlink,\n Direction,\n DocumentQuery,\n DocumentResult,\n Filter,\n GroupQuery,\n GroupResult,\n Key,\n LocalQuery,\n OrderOptions,\n Predicate,\n QueryDocument,\n QueryGroup,\n QueryResult,\n Related,\n Select,\n Value,\n Where,\n} from './query.js';\n\nexport type {\n MdType,\n ModelIdentity,\n ModelSnapshot,\n ModelState,\n ModelResult,\n TypesResult,\n ValidationReceipt,\n} from './model.js';\nexport type { OperationScopes, ReplicaAdmission, ScopedRefusal } from './adapter.js';\n"],"names":["changeBatchIdentity","createMdRuntime"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["/workspace/packages/mdruntime/src/index.ts"],"sourcesContent":["export type {\n AcceptedMessage,\n ActionDeclaration,\n ActionRequest,\n ActionResult,\n Adapter,\n AdapterFailure,\n Authorization,\n BootstrapPage,\n BootstrapRequest,\n BootstrapResult,\n Capability,\n ChangeAuthor,\n ContractUnavailable,\n ConversationAction,\n ConversationCards,\n ConversationEvent,\n ConversationHistories,\n ConversationHistoryPage,\n ConversationHistoryRequest,\n ConversationMessage,\n ConversationStream,\n DiscoverResult,\n DiscoveredRoom,\n Discovery,\n HistoryAuthor,\n HistoryRequest,\n HistoryResult,\n HistoryRetention,\n HistoryRevision,\n MdModelIdentity,\n ModelRequest,\n MutationRequest,\n MutationResult,\n PageToken,\n ProviderLimit,\n ProviderRefusal,\n RefreshPage,\n RefreshRequest,\n RefreshResult,\n Retention,\n RetryableRefusal,\n RevokedAuthorization,\n RoomAttachment,\n RoomNotReadable,\n RoomVersionAt,\n RoomVersionNotification,\n SelectedRooms,\n ServiceMode,\n ServiceModeSignal,\n TransportUncertainty,\n TypedSelection,\n WorkingNote,\n} from './adapter.js';\nexport type { Change, ChangeBatch, Precondition, WrittenBy } from './change.js';\nexport type {\n ChatDraft,\n ChatDraftSurface,\n ConversationEntry,\n ConversationOptions,\n ConversationSurface,\n ConversationView,\n GrowingText,\n} from './conversation.js';\nexport type { ChatDraftFile, FileDeclaration } from './file.js';\nexport type {\n AppRoom,\n AppSlot,\n AppSlotEntry,\n AppTypedSelection,\n ConnectionRefusal,\n ConnectionRefusalReason,\n HistoryQuery,\n MdRuntime,\n MdRuntimeOptions,\n PresentationSurface,\n RoomDraftSurface,\n RoomTypes,\n SavedRoomDraft,\n SaveResult,\n} from './connection.js';\nexport type { Observation } from './observation.js';\nexport type {\n AcceptedOutcome,\n AffectedState,\n CallResult,\n QueueEntry,\n Submission,\n SubmissionOutcome,\n} from './outcome.js';\nexport type {\n ChangedPart,\n FieldValue,\n ReturnReason,\n RoomDraft,\n RoomDraftCreation,\n RoomDraftParts,\n RoomDraftWrite,\n} from './room-draft.js';\nexport type { SaveRefusal } from './save.js';\nexport type {\n DocumentHit,\n DocumentPart,\n MessageHit,\n SearchRequest,\n SearchResult,\n} from './search.js';\nexport { changeBatchIdentity } from './identity.js';\nexport { createMdRuntime } from './connection.js';\nexport type { RuntimeShell } from './durability.js';\nexport type { AttentionEntry, SyncStatus } from './status.js';\nexport type {\n Backlink,\n Direction,\n DocumentQuery,\n DocumentResult,\n Filter,\n GroupQuery,\n GroupResult,\n Key,\n LocalQuery,\n OrderOptions,\n Predicate,\n QueryDocument,\n QueryGroup,\n QueryResult,\n Related,\n Select,\n Value,\n Where,\n} from './query.js';\n\nexport type {\n MdType,\n ModelIdentity,\n ModelSnapshot,\n ModelState,\n ModelResult,\n TypesResult,\n ValidationReceipt,\n} from './model.js';\nexport type { OperationScopes, ReplicaAdmission, ScopedRefusal } from './adapter.js';\n"],"names":["changeBatchIdentity","createMdRuntime"],"mappings":"AA2GA,SAASA,mBAAmB,QAAQ,gBAAgB;AACpD,SAASC,eAAe,QAAQ,kBAAkB"}
|
package/dist/memory.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
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 MdModelIdentity, type ProviderLimit, type Retention, type RoomVersionNotification, type ServiceMode } from './adapter.js';
|
|
2
|
+
import { type AcceptedMessage, type ActionResult, type Adapter, type Capability, type ConversationAction, type ConversationEvent, type DiscoveredRoom, type HeadChange, type MdModelIdentity, type ProviderLimit, type Retention, type RoomAttachment, type RoomVersionNotification, type ServiceMode } from './adapter.js';
|
|
3
3
|
export type MemoryRoom = DiscoveredRoom & {
|
|
4
4
|
model?: ModelResult;
|
|
5
5
|
selectionModel?: ModelResult;
|
|
@@ -7,6 +7,7 @@ export type MemoryRoom = DiscoveredRoom & {
|
|
|
7
7
|
revisions?: Readonly<Record<string, string>>;
|
|
8
8
|
changes?: Readonly<Record<string, HeadChange>>;
|
|
9
9
|
binaryTargets?: readonly string[];
|
|
10
|
+
attachments?: readonly RoomAttachment[];
|
|
10
11
|
};
|
|
11
12
|
export type MemoryConversation = {
|
|
12
13
|
conversation: string;
|
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,EAEL,KAAK,eAAe,EAEpB,KAAK,YAAY,EACjB,KAAK,OAAO,EAIZ,KAAK,UAAU,EACf,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,EAItB,KAAK,cAAc,EACnB,KAAK,UAAU,EAGf,KAAK,eAAe,EAGpB,KAAK,aAAa,EAGlB,KAAK,SAAS,EACd,KAAK,uBAAuB,EAC5B,KAAK,WAAW,EACjB,MAAM,cAAc,CAAC;AAmBtB,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,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IAC7C,OAAO,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC,CAAC;IAC/C,aAAa,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;
|
|
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,EAEL,KAAK,eAAe,EAEpB,KAAK,YAAY,EACjB,KAAK,OAAO,EAIZ,KAAK,UAAU,EACf,KAAK,kBAAkB,EACvB,KAAK,iBAAi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AAC,EAAE,SAAS,aAAa,EAAE,CAAC;IAC1C,SAAS,CAAC,EAAE,SAAS,CAAC;CACvB,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG,OAAO,GAAG;IACpC,QAAQ,CAAC,KAAK,EAAE,SAAS,UAAU,EAAE,GAAG,IAAI,CAAC;IAC7C,gBAAgB,CAAC,aAAa,EAAE,SAAS,kBAAkB,EAAE,GAAG,IAAI,CAAC;IACrE,MAAM,CAAC,SAAS,EAAE,MAAM,OAAO,EAAE,MAAM,EAAE,OAAO,GAAG,IAAI,CAAC;IACxD,iBAAiB,CAAC,YAAY,EAAE,uBAAuB,GAAG,IAAI,CAAC;IAC/D,kBAAkB,CAAC,KAAK,EAAE,iBAAiB,GAAG,IAAI,CAAC;IACnD,iBAAiB,CAAC,IAAI,EAAE,WAAW,GAAG,IAAI,CAAC;IAC3C,aAAa,IAAI,SAAS,MAAM,EAAE,CAAC;IACnC,uBAAuB,IAAI,SAAS,MAAM,EAAE,CAAC;CAC9C,CAAC;AA+BF,wBAAgB,mBAAmB,CAAC,OAAO,GAAE,oBAAyB,GAAG,aAAa,CAkZrF"}
|
package/dist/memory.js
CHANGED
|
@@ -117,6 +117,9 @@ export function createMemoryAdapter(options = {}) {
|
|
|
117
117
|
...targets
|
|
118
118
|
]),
|
|
119
119
|
binaryTargets: targets,
|
|
120
|
+
...from === 0 && room.attachments !== undefined ? {
|
|
121
|
+
attachments: room.attachments
|
|
122
|
+
} : {},
|
|
120
123
|
...next < paths.length ? {
|
|
121
124
|
pageToken: String(next)
|
|
122
125
|
} : {}
|
|
@@ -142,6 +145,8 @@ export function createMemoryAdapter(options = {}) {
|
|
|
142
145
|
const targets = opening ? [
|
|
143
146
|
...currentTargets
|
|
144
147
|
].filter((target)=>!previousTargets.has(target) || headMoved(target)) : [];
|
|
148
|
+
const attachments = room.attachments ?? [];
|
|
149
|
+
const declared = opening && JSON.stringify(attachments) !== JSON.stringify(from.attachments ?? []);
|
|
145
150
|
return {
|
|
146
151
|
kind: 'net-advancement',
|
|
147
152
|
roomVersion: room.roomVersion,
|
|
@@ -158,6 +163,9 @@ export function createMemoryAdapter(options = {}) {
|
|
|
158
163
|
...previousTargets
|
|
159
164
|
].filter((target)=>!currentTargets.has(target) && !(target in current))
|
|
160
165
|
].sort() : [],
|
|
166
|
+
...declared ? {
|
|
167
|
+
attachments
|
|
168
|
+
} : {},
|
|
161
169
|
...pageToken === undefined ? {} : {
|
|
162
170
|
pageToken
|
|
163
171
|
}
|
package/dist/memory.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/workspace/packages/mdruntime/src/memory.ts"],"sourcesContent":["import type { ModelResult } from './model.js';\nimport {\n ROOM_CONTRACT_VERSION,\n type AcceptedMessage,\n type ActionRequest,\n type ActionResult,\n type Adapter,\n type Authorization,\n type BootstrapRequest,\n type BootstrapResult,\n type Capability,\n type ConversationAction,\n type ConversationEvent,\n type ConversationHistories,\n type ConversationHistoryPage,\n type DiscoverResult,\n type DiscoveredRoom,\n type HeadChange,\n type HistoryRequest,\n type HistoryResult,\n type MdModelIdentity,\n type MutationRequest,\n type MutationResult,\n type ProviderLimit,\n type RefreshRequest,\n type RefreshResult,\n type Retention,\n type RoomVersionNotification,\n type ServiceMode,\n} from './adapter.js';\nimport { MD_MODEL } from './collection.js';\nimport { sameChange } from './overlay.js';\n\nconst FIXTURE_RETENTION: Retention = {\n history: { kind: 'duration', seconds: 1 },\n outcome: 1,\n refreshHorizon: 1,\n};\n\nfunction declaredRetention(value: Retention | undefined): Retention {\n const retention = value ?? FIXTURE_RETENTION;\n if (retention.history.kind === 'no-declared-time-bound') return retention;\n if (Number.isFinite(retention.history.seconds) && retention.history.seconds > 0) {\n return retention;\n }\n throw new Error('history retention duration must be a finite positive number of seconds');\n}\n\nexport type MemoryRoom = DiscoveredRoom & {\n model?: ModelResult;\n selectionModel?: ModelResult;\n documents?: Readonly<Record<string, string>>;\n revisions?: Readonly<Record<string, string>>;\n changes?: Readonly<Record<string, HeadChange>>;\n binaryTargets?: readonly string[];\n};\n\nexport type MemoryConversation = {\n conversation: string;\n messages?: readonly AcceptedMessage[];\n outcomes?: Partial<Record<ConversationAction, ActionResult>>;\n};\n\nexport type MemoryAdapterOptions = {\n rooms?: readonly MemoryRoom[];\n conversations?: readonly MemoryConversation[];\n historyPageSize?: number;\n pageSize?: number;\n mdModel?: MdModelIdentity;\n supportedVersions?: readonly number[];\n capabilities?: readonly Capability[];\n providerLimits?: readonly ProviderLimit[];\n retention?: Retention;\n};\n\nexport type MemoryAdapter = Adapter & {\n setRooms(rooms: readonly MemoryRoom[]): void;\n setConversations(conversations: readonly MemoryConversation[]): void;\n script(operation: keyof Adapter, answer: unknown): void;\n notifyRoomVersion(notification: RoomVersionNotification): void;\n notifyConversation(event: ConversationEvent): void;\n notifyServiceMode(mode: ServiceMode): void;\n selectedRooms(): readonly string[];\n replicatedConversations(): readonly string[];\n};\n\ntype Script<T, R> = T | ((request: R) => T | Promise<T>);\n\ntype RefreshContinuation = {\n room: MemoryRoom;\n from: MemoryRoom;\n at: number;\n};\n\nfunction named<T>(\n source: Readonly<Record<string, T>>,\n paths: readonly string[],\n): Readonly<Record<string, T>> {\n const taken: Record<string, T> = {};\n for (const path of paths) {\n const value = source[path];\n if (value !== undefined) taken[path] = value;\n }\n return taken;\n}\n\nasync function resolveScript<T, R>(\n answer: Script<T, R> | undefined,\n fallback: () => T | Promise<T>,\n request: R,\n) {\n if (answer === undefined) return fallback();\n return typeof answer === 'function' ? (answer as (value: R) => T | Promise<T>)(request) : answer;\n}\n\nexport function createMemoryAdapter(options: MemoryAdapterOptions = {}): MemoryAdapter {\n let rooms = options.rooms === undefined ? [] : [...options.rooms];\n const mdModel = options.mdModel ?? MD_MODEL;\n const supportedVersions = options.supportedVersions ?? [ROOM_CONTRACT_VERSION];\n const capabilities = options.capabilities ?? [];\n const providerLimits = options.providerLimits ?? [];\n const retention = declaredRetention(options.retention);\n const pageSize = options.pageSize;\n const scripts: Partial<Record<keyof Adapter, unknown>> = {};\n const served = new Map<string, Map<string, MemoryRoom>>();\n const refreshPages = new Map<string, RefreshContinuation>();\n const observers = new Set<(notification: RoomVersionNotification) => void>();\n const listeners = new Set<(event: ConversationEvent) => void>();\n const modeObservers = new Set<(mode: ServiceMode) => void>();\n const scripted = new Map<string, MemoryConversation>();\n const unsealed = new Map<string, string>();\n const sealed = new Set<string>();\n const historyPageSize = options.historyPageSize;\n let selected: readonly string[] = [];\n let replicated: readonly string[] = [];\n let issued = 0;\n\n function scriptConversations(entries: readonly MemoryConversation[]) {\n scripted.clear();\n for (const entry of entries) scripted.set(entry.conversation, entry);\n }\n\n scriptConversations(options.conversations ?? []);\n\n const ordinals = new Map<string, number>();\n\n function note<T>(locator: string, answer: T): T {\n const roomVersion = (answer as { roomVersion?: unknown }).roomVersion;\n const key = `${locator}\\u0000${String(roomVersion)}`;\n if (typeof roomVersion === 'string' && !ordinals.has(key)) ordinals.set(key, ordinals.size);\n return answer;\n }\n\n function reached(locator: string, roomVersion: string, target: string): boolean {\n const scripted = scripts.reached as\n | boolean\n | ((locator: string, roomVersion: string, target: string) => boolean)\n | undefined;\n if (typeof scripted === 'boolean') return scripted;\n if (scripted !== undefined) return scripted(locator, roomVersion, target);\n if (roomVersion === target) return true;\n const held = ordinals.get(`${locator}\\u0000${roomVersion}`);\n const wanted = ordinals.get(`${locator}\\u0000${target}`);\n return held !== undefined && wanted !== undefined && held >= wanted;\n }\n\n function retain(entries: readonly MemoryRoom[]) {\n for (const room of entries) {\n note(room.locator, room);\n const versions = served.get(room.locator) ?? new Map<string, MemoryRoom>();\n versions.set(room.roomVersion, room);\n served.set(room.locator, versions);\n }\n }\n\n retain(rooms);\n\n function declared(room: MemoryRoom): DiscoveredRoom {\n return {\n name: room.name,\n locator: room.locator,\n roomVersion: room.roomVersion,\n operations: room.operations,\n replica: room.replica,\n attachedModel: room.attachedModel,\n ...(room.typedSelection === undefined ? {} : { typedSelection: room.typedSelection }),\n ...(room.untypedFolders === undefined ? {} : { untypedFolders: room.untypedFolders }),\n providerOwnedPaths: room.providerOwnedPaths,\n };\n }\n\n function page(room: MemoryRoom, from: number): BootstrapResult {\n const paths = Object.keys(room.documents ?? {}).sort();\n const size = pageSize ?? paths.length;\n const taken = paths.slice(from, from + size);\n const next = from + taken.length;\n const targets = from === 0 ? (room.binaryTargets ?? []) : [];\n return {\n kind: 'bootstrap',\n roomVersion: room.roomVersion,\n documents: named(room.documents ?? {}, taken),\n revisions: named(room.revisions ?? {}, taken),\n changes: named(room.changes ?? {}, [...taken, ...targets]),\n binaryTargets: targets,\n ...(next < paths.length ? { pageToken: String(next) } : {}),\n };\n }\n\n function advancement(room: MemoryRoom, from: MemoryRoom, at: number): RefreshResult {\n const current = room.documents ?? {};\n const previous = from.documents ?? {};\n const currentTargets = new Set(room.binaryTargets ?? []);\n const previousTargets = new Set(from.binaryTargets ?? []);\n const headMoved = (path: string) =>\n room.revisions?.[path] !== from.revisions?.[path] ||\n !sameChange(room.changes?.[path], from.changes?.[path]);\n const changed = Object.keys(current)\n .filter((path) => current[path] !== previous[path] || headMoved(path))\n .sort();\n const size = pageSize ?? changed.length;\n const taken = changed.slice(at, at + size);\n const next = at + taken.length;\n const opening = at === 0;\n const pageToken = next < changed.length ? `refresh-${refreshPages.size}` : undefined;\n if (pageToken !== undefined) refreshPages.set(pageToken, { room, from, at: next });\n const targets = opening\n ? [...currentTargets].filter((target) => !previousTargets.has(target) || headMoved(target))\n : [];\n return {\n kind: 'net-advancement',\n roomVersion: room.roomVersion,\n documents: named(current, taken),\n revisions: named(room.revisions ?? {}, taken),\n changes: named(room.changes ?? {}, [...taken, ...targets]),\n binaryTargets: targets,\n removals: opening\n ? [\n ...Object.keys(previous).filter(\n (path) => !(path in current) && !currentTargets.has(path),\n ),\n ...[...previousTargets].filter(\n (target) => !currentTargets.has(target) && !(target in current),\n ),\n ].sort()\n : [],\n ...(pageToken === undefined ? {} : { pageToken }),\n };\n }\n\n function pageOf(conversation: MemoryConversation, after: unknown): ConversationHistoryPage {\n const messages = conversation.messages ?? [];\n const first =\n typeof after === 'string' ? messages.findIndex((message) => message.position > after) : 0;\n const from = first === -1 ? messages.length : first;\n const page = messages.slice(from, from + (historyPageSize ?? messages.length));\n const last = page.at(-1);\n return {\n conversation: conversation.conversation,\n messages: page,\n ...(last !== undefined && from + page.length < messages.length\n ? { next: last.position }\n : {}),\n };\n }\n\n function historiesOf(input: unknown): ActionResult {\n const asked = (input as { conversations?: unknown } | null)?.conversations;\n if (!Array.isArray(asked)) return { kind: 'rejected', code: 'invalid_request', fields: {} };\n const histories: ConversationHistoryPage[] = [];\n for (const entry of asked as readonly { conversation?: unknown; after?: unknown }[]) {\n const conversation =\n typeof entry.conversation === 'string' ? scripted.get(entry.conversation) : undefined;\n if (conversation === undefined) continue;\n const outcome = conversation.outcomes?.['conversation.history'];\n if (outcome !== undefined) return outcome;\n histories.push(pageOf(conversation, entry.after));\n }\n const result: ConversationHistories = { histories };\n return { kind: 'action', result };\n }\n\n function conversationAction(request: ActionRequest): ActionResult {\n const name = request.name as ConversationAction;\n const input = (request.input ?? {}) as {\n conversation?: unknown;\n turn?: unknown;\n };\n if (name === 'conversation.history') return historiesOf(request.input);\n if (name === 'conversation.create') {\n issued += 1;\n const conversation = `conversation-${issued}`;\n scripted.set(conversation, { conversation });\n return { kind: 'action', result: { conversation } };\n }\n const named = typeof input.conversation === 'string' ? input.conversation : '';\n const conversation = scripted.get(named);\n if (conversation === undefined) {\n return { kind: 'rejected', code: 'unknown-conversation', fields: { conversation: named } };\n }\n const outcome = conversation.outcomes?.[name];\n if (outcome !== undefined) return outcome;\n if (name === 'conversation.send') {\n issued += 1;\n const turn = `turn-${issued}`;\n unsealed.set(turn, named);\n return { kind: 'action', result: { turn } };\n }\n if (name === 'conversation.cancel') {\n const turn = typeof input.turn === 'string' ? input.turn : '';\n if (sealed.has(turn) || !unsealed.has(turn)) {\n return { kind: 'rejected', code: 'turn-sealed', fields: { turn } };\n }\n unsealed.delete(turn);\n return { kind: 'action', result: { turn, cancelled: true } };\n }\n if (name === 'conversation.delete') scripted.delete(named);\n return { kind: 'action', result: { conversation: named } };\n }\n\n function discovery(): DiscoverResult {\n return {\n kind: 'discovery',\n supportedVersions,\n mdModel,\n rooms: rooms.map(declared),\n capabilities,\n providerLimits,\n retention,\n };\n }\n\n return {\n setRooms(next) {\n rooms = [...next];\n retain(rooms);\n },\n setConversations(next) {\n scriptConversations(next);\n },\n notifyRoomVersion(notification) {\n for (const observer of observers) observer(notification);\n },\n notifyConversation(event) {\n if (event.kind === 'accepted-message') {\n sealed.add(event.message.turn);\n unsealed.delete(event.message.turn);\n }\n for (const listener of listeners) listener(event);\n },\n notifyServiceMode(mode) {\n for (const observer of modeObservers) observer(mode);\n },\n selectedRooms() {\n return selected;\n },\n replicatedConversations() {\n return replicated;\n },\n conversations: {\n replicate(next) {\n replicated = [...next];\n },\n observe(notify) {\n listeners.add(notify);\n return () => {\n listeners.delete(notify);\n };\n },\n },\n serviceMode: {\n observe(notify) {\n modeObservers.add(notify);\n return () => {\n modeObservers.delete(notify);\n };\n },\n },\n roomVersions: {\n select(locators) {\n selected = [...locators];\n },\n observe(notify) {\n observers.add(notify);\n return () => {\n observers.delete(notify);\n };\n },\n },\n script(operation, answer) {\n if (answer === undefined) delete scripts[operation];\n else scripts[operation] = answer;\n },\n async model(_authorization, request) {\n return resolveScript(\n scripts.model as Script<ModelResult, typeof request> | undefined,\n () => {\n const room = rooms.find((entry) => entry.locator === request.locator);\n const answer = request.attached === 'collection' ? room?.model : room?.selectionModel;\n return answer ?? { kind: 'model-unavailable', reason: 'not-readable' };\n },\n request,\n );\n },\n async authorize() {\n return resolveScript<Authorization, void>(\n scripts.authorize as Script<Authorization, void> | undefined,\n () => ({}),\n undefined,\n );\n },\n async discover(_authorization: Authorization) {\n return resolveScript<DiscoverResult, void>(\n scripts.discover as Script<DiscoverResult, void> | undefined,\n discovery,\n undefined,\n ).then((answer) => {\n if (answer.kind === 'discovery') for (const room of answer.rooms) note(room.locator, room);\n return answer;\n });\n },\n reached,\n async bootstrap(_authorization: Authorization, request: BootstrapRequest) {\n return resolveScript<BootstrapResult, BootstrapRequest>(\n scripts.bootstrap as Script<BootstrapResult, BootstrapRequest> | undefined,\n () => {\n const room = rooms.find((entry) => entry.locator === request.locator);\n if (room === undefined) {\n return { kind: 'room-not-readable', locator: request.locator };\n }\n return page(room, request.pageToken === undefined ? 0 : Number(request.pageToken));\n },\n request,\n ).then((answer) => note(request.locator, answer));\n },\n async refresh(_authorization: Authorization, request: RefreshRequest) {\n return resolveScript<RefreshResult, RefreshRequest>(\n scripts.refresh as Script<RefreshResult, RefreshRequest> | undefined,\n () => {\n const room = rooms.find((entry) => entry.locator === request.locator);\n if (room === undefined) {\n return { kind: 'room-not-readable', locator: request.locator };\n }\n if (request.pageToken !== undefined) {\n const continuation = refreshPages.get(request.pageToken);\n if (\n continuation === undefined ||\n continuation.room.locator !== request.locator ||\n continuation.from.roomVersion !== request.fromRoomVersion\n ) {\n throw new Error('Invalid Refresh Page Token');\n }\n return advancement(continuation.room, continuation.from, continuation.at);\n }\n if (\n request.minPosition !== undefined &&\n !reached(room.locator, room.roomVersion, request.minPosition)\n ) {\n return { kind: 'retryable-refusal', code: 'replica_behind', fields: {} };\n }\n if (request.fromRoomVersion === room.roomVersion) {\n return { kind: 'still-current' };\n }\n const from = served.get(room.locator)?.get(request.fromRoomVersion);\n if (from === undefined) return { kind: 'beyond-horizon' };\n return advancement(room, from, 0);\n },\n request,\n ).then((answer) => note(request.locator, answer));\n },\n async mutate(_authorization: Authorization, request: MutationRequest) {\n return resolveScript<MutationResult, MutationRequest>(\n scripts.mutate as Script<MutationResult, MutationRequest> | undefined,\n () => {\n const room = rooms.find((entry) => entry.locator === request.locator);\n if (room === undefined) {\n return { kind: 'room-not-readable', locator: request.locator };\n }\n return { kind: 'rejected', code: 'unscripted-mutation', fields: {}, affected: {} };\n },\n request,\n ).then((answer) => note(request.locator, answer));\n },\n async history(_authorization: Authorization, request: HistoryRequest) {\n return resolveScript<HistoryResult, HistoryRequest>(\n scripts.history as Script<HistoryResult, HistoryRequest> | undefined,\n () => {\n const room = rooms.find((entry) => entry.locator === request.locator);\n if (room === undefined) {\n return { kind: 'room-not-readable', locator: request.locator };\n }\n return {\n kind: 'history',\n revisions: [],\n };\n },\n request,\n );\n },\n async action(_authorization: Authorization, request: ActionRequest) {\n return resolveScript<ActionResult, ActionRequest>(\n scripts.action as Script<ActionResult, ActionRequest> | undefined,\n () => {\n if (request.name.startsWith('conversation.')) return conversationAction(request);\n return { kind: 'rejected', code: 'unscripted-action', fields: {} };\n },\n request,\n ).then((answer) => {\n if (answer.kind === 'action' && answer.at !== undefined) note(answer.at.locator, answer.at);\n return answer;\n });\n },\n };\n}\n"],"names":["ROOM_CONTRACT_VERSION","MD_MODEL","sameChange","FIXTURE_RETENTION","history","kind","seconds","outcome","refreshHorizon","declaredRetention","value","retention","Number","isFinite","Error","named","source","paths","taken","path","undefined","resolveScript","answer","fallback","request","createMemoryAdapter","options","rooms","mdModel","supportedVersions","capabilities","providerLimits","pageSize","scripts","served","Map","refreshPages","observers","Set","listeners","modeObservers","scripted","unsealed","sealed","historyPageSize","selected","replicated","issued","scriptConversations","entries","clear","entry","set","conversation","conversations","ordinals","note","locator","roomVersion","key","String","has","size","reached","target","held","get","wanted","retain","room","versions","declared","name","operations","replica","attachedModel","typedSelection","untypedFolders","providerOwnedPaths","page","from","Object","keys","documents","sort","length","slice","next","targets","binaryTargets","revisions","changes","pageToken","advancement","at","current","previous","currentTargets","previousTargets","headMoved","changed","filter","opening","removals","pageOf","after","messages","first","findIndex","message","position","last","historiesOf","input","asked","Array","isArray","code","fields","histories","outcomes","push","result","conversationAction","turn","delete","cancelled","discovery","map","setRooms","setConversations","notifyRoomVersion","notification","observer","notifyConversation","event","add","listener","notifyServiceMode","mode","selectedRooms","replicatedConversations","replicate","observe","notify","serviceMode","roomVersions","select","locators","script","operation","model","_authorization","find","attached","selectionModel","reason","authorize","discover","then","bootstrap","refresh","continuation","fromRoomVersion","minPosition","mutate","affected","action","startsWith"],"mappings":"AACA,SACEA,qBAAqB,QA2BhB,eAAe;AACtB,SAASC,QAAQ,QAAQ,kBAAkB;AAC3C,SAASC,UAAU,QAAQ,eAAe;AAE1C,MAAMC,oBAA+B;IACnCC,SAAS;QAAEC,MAAM;QAAYC,SAAS;IAAE;IACxCC,SAAS;IACTC,gBAAgB;AAClB;AAEA,SAASC,kBAAkBC,KAA4B;IACrD,MAAMC,YAAYD,SAASP;IAC3B,IAAIQ,UAAUP,OAAO,CAACC,IAAI,KAAK,0BAA0B,OAAOM;IAChE,IAAIC,OAAOC,QAAQ,CAACF,UAAUP,OAAO,CAACE,OAAO,KAAKK,UAAUP,OAAO,CAACE,OAAO,GAAG,GAAG;QAC/E,OAAOK;IACT;IACA,MAAM,IAAIG,MAAM;AAClB;AAgDA,SAASC,MACPC,MAAmC,EACnCC,KAAwB;IAExB,MAAMC,QAA2B,CAAC;IAClC,KAAK,MAAMC,QAAQF,MAAO;QACxB,MAAMP,QAAQM,MAAM,CAACG,KAAK;QAC1B,IAAIT,UAAUU,WAAWF,KAAK,CAACC,KAAK,GAAGT;IACzC;IACA,OAAOQ;AACT;AAEA,eAAeG,cACbC,MAAgC,EAChCC,QAA8B,EAC9BC,OAAU;IAEV,IAAIF,WAAWF,WAAW,OAAOG;IACjC,OAAO,OAAOD,WAAW,aAAa,AAACA,OAAwCE,WAAWF;AAC5F;AAEA,OAAO,SAASG,oBAAoBC,UAAgC,CAAC,CAAC;IACpE,IAAIC,QAAQD,QAAQC,KAAK,KAAKP,YAAY,EAAE,GAAG;WAAIM,QAAQC,KAAK;KAAC;IACjE,MAAMC,UAAUF,QAAQE,OAAO,IAAI3B;IACnC,MAAM4B,oBAAoBH,QAAQG,iBAAiB,IAAI;QAAC7B;KAAsB;IAC9E,MAAM8B,eAAeJ,QAAQI,YAAY,IAAI,EAAE;IAC/C,MAAMC,iBAAiBL,QAAQK,cAAc,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,SAASjC,QAAQiC,OAAO;oBAAC;gBAC/D;gBACA,OAAO;oBAAEpD,MAAM;oBAAYgH,MAAM;oBAAuBC,QAAQ,CAAC;oBAAGgD,UAAU,CAAC;gBAAE;YACnF,GACA9I,SACAuI,IAAI,CAAC,CAACzI,SAAWkC,KAAKhC,QAAQiC,OAAO,EAAEnC;QAC3C;QACA,MAAMlB,SAAQoJ,cAA6B,EAAEhI,OAAuB;YAClE,OAAOH,cACLY,QAAQ7B,OAAO,EACf;gBACE,MAAMiE,OAAO1C,MAAM8H,IAAI,CAAC,CAACtG,QAAUA,MAAMM,OAAO,KAAKjC,QAAQiC,OAAO;gBACpE,IAAIY,SAASjD,WAAW;oBACtB,OAAO;wBAAEf,MAAM;wBAAqBoD,SAASjC,QAAQiC,OAAO;oBAAC;gBAC/D;gBACA,OAAO;oBACLpD,MAAM;oBACNqF,WAAW,EAAE;gBACf;YACF,GACAlE;QAEJ;QACA,MAAM+I,QAAOf,cAA6B,EAAEhI,OAAsB;YAChE,OAAOH,cACLY,QAAQsI,MAAM,EACd;gBACE,IAAI/I,QAAQgD,IAAI,CAACgG,UAAU,CAAC,kBAAkB,OAAO7C,mBAAmBnG;gBACxE,OAAO;oBAAEnB,MAAM;oBAAYgH,MAAM;oBAAqBC,QAAQ,CAAC;gBAAE;YACnE,GACA9F,SACAuI,IAAI,CAAC,CAACzI;gBACN,IAAIA,OAAOjB,IAAI,KAAK,YAAYiB,OAAOwE,EAAE,KAAK1E,WAAWoC,KAAKlC,OAAOwE,EAAE,CAACrC,OAAO,EAAEnC,OAAOwE,EAAE;gBAC1F,OAAOxE;YACT;QACF;IACF;AACF"}
|
|
1
|
+
{"version":3,"sources":["/workspace/packages/mdruntime/src/memory.ts"],"sourcesContent":["import type { ModelResult } from './model.js';\nimport {\n ROOM_CONTRACT_VERSION,\n type AcceptedMessage,\n type ActionRequest,\n type ActionResult,\n type Adapter,\n type Authorization,\n type BootstrapRequest,\n type BootstrapResult,\n type Capability,\n type ConversationAction,\n type ConversationEvent,\n type ConversationHistories,\n type ConversationHistoryPage,\n type DiscoverResult,\n type DiscoveredRoom,\n type HeadChange,\n type HistoryRequest,\n type HistoryResult,\n type MdModelIdentity,\n type MutationRequest,\n type MutationResult,\n type ProviderLimit,\n type RefreshRequest,\n type RefreshResult,\n type Retention,\n type RoomAttachment,\n type RoomVersionNotification,\n type ServiceMode,\n} from './adapter.js';\nimport { MD_MODEL } from './collection.js';\nimport { sameChange } from './overlay.js';\n\nconst FIXTURE_RETENTION: Retention = {\n history: { kind: 'duration', seconds: 1 },\n outcome: 1,\n refreshHorizon: 1,\n};\n\nfunction declaredRetention(value: Retention | undefined): Retention {\n const retention = value ?? FIXTURE_RETENTION;\n if (retention.history.kind === 'no-declared-time-bound') return retention;\n if (Number.isFinite(retention.history.seconds) && retention.history.seconds > 0) {\n return retention;\n }\n throw new Error('history retention duration must be a finite positive number of seconds');\n}\n\nexport type MemoryRoom = DiscoveredRoom & {\n model?: ModelResult;\n selectionModel?: ModelResult;\n documents?: Readonly<Record<string, string>>;\n revisions?: Readonly<Record<string, string>>;\n changes?: Readonly<Record<string, HeadChange>>;\n binaryTargets?: readonly string[];\n attachments?: readonly RoomAttachment[];\n};\n\nexport type MemoryConversation = {\n conversation: string;\n messages?: readonly AcceptedMessage[];\n outcomes?: Partial<Record<ConversationAction, ActionResult>>;\n};\n\nexport type MemoryAdapterOptions = {\n rooms?: readonly MemoryRoom[];\n conversations?: readonly MemoryConversation[];\n historyPageSize?: number;\n pageSize?: number;\n mdModel?: MdModelIdentity;\n supportedVersions?: readonly number[];\n capabilities?: readonly Capability[];\n providerLimits?: readonly ProviderLimit[];\n retention?: Retention;\n};\n\nexport type MemoryAdapter = Adapter & {\n setRooms(rooms: readonly MemoryRoom[]): void;\n setConversations(conversations: readonly MemoryConversation[]): void;\n script(operation: keyof Adapter, answer: unknown): void;\n notifyRoomVersion(notification: RoomVersionNotification): void;\n notifyConversation(event: ConversationEvent): void;\n notifyServiceMode(mode: ServiceMode): void;\n selectedRooms(): readonly string[];\n replicatedConversations(): readonly string[];\n};\n\ntype Script<T, R> = T | ((request: R) => T | Promise<T>);\n\ntype RefreshContinuation = {\n room: MemoryRoom;\n from: MemoryRoom;\n at: number;\n};\n\nfunction named<T>(\n source: Readonly<Record<string, T>>,\n paths: readonly string[],\n): Readonly<Record<string, T>> {\n const taken: Record<string, T> = {};\n for (const path of paths) {\n const value = source[path];\n if (value !== undefined) taken[path] = value;\n }\n return taken;\n}\n\nasync function resolveScript<T, R>(\n answer: Script<T, R> | undefined,\n fallback: () => T | Promise<T>,\n request: R,\n) {\n if (answer === undefined) return fallback();\n return typeof answer === 'function' ? (answer as (value: R) => T | Promise<T>)(request) : answer;\n}\n\nexport function createMemoryAdapter(options: MemoryAdapterOptions = {}): MemoryAdapter {\n let rooms = options.rooms === undefined ? [] : [...options.rooms];\n const mdModel = options.mdModel ?? MD_MODEL;\n const supportedVersions = options.supportedVersions ?? [ROOM_CONTRACT_VERSION];\n const capabilities = options.capabilities ?? [];\n const providerLimits = options.providerLimits ?? [];\n const retention = declaredRetention(options.retention);\n const pageSize = options.pageSize;\n const scripts: Partial<Record<keyof Adapter, unknown>> = {};\n const served = new Map<string, Map<string, MemoryRoom>>();\n const refreshPages = new Map<string, RefreshContinuation>();\n const observers = new Set<(notification: RoomVersionNotification) => void>();\n const listeners = new Set<(event: ConversationEvent) => void>();\n const modeObservers = new Set<(mode: ServiceMode) => void>();\n const scripted = new Map<string, MemoryConversation>();\n const unsealed = new Map<string, string>();\n const sealed = new Set<string>();\n const historyPageSize = options.historyPageSize;\n let selected: readonly string[] = [];\n let replicated: readonly string[] = [];\n let issued = 0;\n\n function scriptConversations(entries: readonly MemoryConversation[]) {\n scripted.clear();\n for (const entry of entries) scripted.set(entry.conversation, entry);\n }\n\n scriptConversations(options.conversations ?? []);\n\n const ordinals = new Map<string, number>();\n\n function note<T>(locator: string, answer: T): T {\n const roomVersion = (answer as { roomVersion?: unknown }).roomVersion;\n const key = `${locator}\\u0000${String(roomVersion)}`;\n if (typeof roomVersion === 'string' && !ordinals.has(key)) ordinals.set(key, ordinals.size);\n return answer;\n }\n\n function reached(locator: string, roomVersion: string, target: string): boolean {\n const scripted = scripts.reached as\n | boolean\n | ((locator: string, roomVersion: string, target: string) => boolean)\n | undefined;\n if (typeof scripted === 'boolean') return scripted;\n if (scripted !== undefined) return scripted(locator, roomVersion, target);\n if (roomVersion === target) return true;\n const held = ordinals.get(`${locator}\\u0000${roomVersion}`);\n const wanted = ordinals.get(`${locator}\\u0000${target}`);\n return held !== undefined && wanted !== undefined && held >= wanted;\n }\n\n function retain(entries: readonly MemoryRoom[]) {\n for (const room of entries) {\n note(room.locator, room);\n const versions = served.get(room.locator) ?? new Map<string, MemoryRoom>();\n versions.set(room.roomVersion, room);\n served.set(room.locator, versions);\n }\n }\n\n retain(rooms);\n\n function declared(room: MemoryRoom): DiscoveredRoom {\n return {\n name: room.name,\n locator: room.locator,\n roomVersion: room.roomVersion,\n operations: room.operations,\n replica: room.replica,\n attachedModel: room.attachedModel,\n ...(room.typedSelection === undefined ? {} : { typedSelection: room.typedSelection }),\n ...(room.untypedFolders === undefined ? {} : { untypedFolders: room.untypedFolders }),\n providerOwnedPaths: room.providerOwnedPaths,\n };\n }\n\n function page(room: MemoryRoom, from: number): BootstrapResult {\n const paths = Object.keys(room.documents ?? {}).sort();\n const size = pageSize ?? paths.length;\n const taken = paths.slice(from, from + size);\n const next = from + taken.length;\n const targets = from === 0 ? (room.binaryTargets ?? []) : [];\n return {\n kind: 'bootstrap',\n roomVersion: room.roomVersion,\n documents: named(room.documents ?? {}, taken),\n revisions: named(room.revisions ?? {}, taken),\n changes: named(room.changes ?? {}, [...taken, ...targets]),\n binaryTargets: targets,\n ...(from === 0 && room.attachments !== undefined ? { attachments: room.attachments } : {}),\n ...(next < paths.length ? { pageToken: String(next) } : {}),\n };\n }\n\n function advancement(room: MemoryRoom, from: MemoryRoom, at: number): RefreshResult {\n const current = room.documents ?? {};\n const previous = from.documents ?? {};\n const currentTargets = new Set(room.binaryTargets ?? []);\n const previousTargets = new Set(from.binaryTargets ?? []);\n const headMoved = (path: string) =>\n room.revisions?.[path] !== from.revisions?.[path] ||\n !sameChange(room.changes?.[path], from.changes?.[path]);\n const changed = Object.keys(current)\n .filter((path) => current[path] !== previous[path] || headMoved(path))\n .sort();\n const size = pageSize ?? changed.length;\n const taken = changed.slice(at, at + size);\n const next = at + taken.length;\n const opening = at === 0;\n const pageToken = next < changed.length ? `refresh-${refreshPages.size}` : undefined;\n if (pageToken !== undefined) refreshPages.set(pageToken, { room, from, at: next });\n const targets = opening\n ? [...currentTargets].filter((target) => !previousTargets.has(target) || headMoved(target))\n : [];\n const attachments = room.attachments ?? [];\n const declared =\n opening && JSON.stringify(attachments) !== JSON.stringify(from.attachments ?? []);\n return {\n kind: 'net-advancement',\n roomVersion: room.roomVersion,\n documents: named(current, taken),\n revisions: named(room.revisions ?? {}, taken),\n changes: named(room.changes ?? {}, [...taken, ...targets]),\n binaryTargets: targets,\n removals: opening\n ? [\n ...Object.keys(previous).filter(\n (path) => !(path in current) && !currentTargets.has(path),\n ),\n ...[...previousTargets].filter(\n (target) => !currentTargets.has(target) && !(target in current),\n ),\n ].sort()\n : [],\n ...(declared ? { attachments } : {}),\n ...(pageToken === undefined ? {} : { pageToken }),\n };\n }\n\n function pageOf(conversation: MemoryConversation, after: unknown): ConversationHistoryPage {\n const messages = conversation.messages ?? [];\n const first =\n typeof after === 'string' ? messages.findIndex((message) => message.position > after) : 0;\n const from = first === -1 ? messages.length : first;\n const page = messages.slice(from, from + (historyPageSize ?? messages.length));\n const last = page.at(-1);\n return {\n conversation: conversation.conversation,\n messages: page,\n ...(last !== undefined && from + page.length < messages.length\n ? { next: last.position }\n : {}),\n };\n }\n\n function historiesOf(input: unknown): ActionResult {\n const asked = (input as { conversations?: unknown } | null)?.conversations;\n if (!Array.isArray(asked)) return { kind: 'rejected', code: 'invalid_request', fields: {} };\n const histories: ConversationHistoryPage[] = [];\n for (const entry of asked as readonly { conversation?: unknown; after?: unknown }[]) {\n const conversation =\n typeof entry.conversation === 'string' ? scripted.get(entry.conversation) : undefined;\n if (conversation === undefined) continue;\n const outcome = conversation.outcomes?.['conversation.history'];\n if (outcome !== undefined) return outcome;\n histories.push(pageOf(conversation, entry.after));\n }\n const result: ConversationHistories = { histories };\n return { kind: 'action', result };\n }\n\n function conversationAction(request: ActionRequest): ActionResult {\n const name = request.name as ConversationAction;\n const input = (request.input ?? {}) as {\n conversation?: unknown;\n turn?: unknown;\n };\n if (name === 'conversation.history') return historiesOf(request.input);\n if (name === 'conversation.create') {\n issued += 1;\n const conversation = `conversation-${issued}`;\n scripted.set(conversation, { conversation });\n return { kind: 'action', result: { conversation } };\n }\n const named = typeof input.conversation === 'string' ? input.conversation : '';\n const conversation = scripted.get(named);\n if (conversation === undefined) {\n return { kind: 'rejected', code: 'unknown-conversation', fields: { conversation: named } };\n }\n const outcome = conversation.outcomes?.[name];\n if (outcome !== undefined) return outcome;\n if (name === 'conversation.send') {\n issued += 1;\n const turn = `turn-${issued}`;\n unsealed.set(turn, named);\n return { kind: 'action', result: { turn } };\n }\n if (name === 'conversation.cancel') {\n const turn = typeof input.turn === 'string' ? input.turn : '';\n if (sealed.has(turn) || !unsealed.has(turn)) {\n return { kind: 'rejected', code: 'turn-sealed', fields: { turn } };\n }\n unsealed.delete(turn);\n return { kind: 'action', result: { turn, cancelled: true } };\n }\n if (name === 'conversation.delete') scripted.delete(named);\n return { kind: 'action', result: { conversation: named } };\n }\n\n function discovery(): DiscoverResult {\n return {\n kind: 'discovery',\n supportedVersions,\n mdModel,\n rooms: rooms.map(declared),\n capabilities,\n providerLimits,\n retention,\n };\n }\n\n return {\n setRooms(next) {\n rooms = [...next];\n retain(rooms);\n },\n setConversations(next) {\n scriptConversations(next);\n },\n notifyRoomVersion(notification) {\n for (const observer of observers) observer(notification);\n },\n notifyConversation(event) {\n if (event.kind === 'accepted-message') {\n sealed.add(event.message.turn);\n unsealed.delete(event.message.turn);\n }\n for (const listener of listeners) listener(event);\n },\n notifyServiceMode(mode) {\n for (const observer of modeObservers) observer(mode);\n },\n selectedRooms() {\n return selected;\n },\n replicatedConversations() {\n return replicated;\n },\n conversations: {\n replicate(next) {\n replicated = [...next];\n },\n observe(notify) {\n listeners.add(notify);\n return () => {\n listeners.delete(notify);\n };\n },\n },\n serviceMode: {\n observe(notify) {\n modeObservers.add(notify);\n return () => {\n modeObservers.delete(notify);\n };\n },\n },\n roomVersions: {\n select(locators) {\n selected = [...locators];\n },\n observe(notify) {\n observers.add(notify);\n return () => {\n observers.delete(notify);\n };\n },\n },\n script(operation, answer) {\n if (answer === undefined) delete scripts[operation];\n else scripts[operation] = answer;\n },\n async model(_authorization, request) {\n return resolveScript(\n scripts.model as Script<ModelResult, typeof request> | undefined,\n () => {\n const room = rooms.find((entry) => entry.locator === request.locator);\n const answer = request.attached === 'collection' ? room?.model : room?.selectionModel;\n return answer ?? { kind: 'model-unavailable', reason: 'not-readable' };\n },\n request,\n );\n },\n async authorize() {\n return resolveScript<Authorization, void>(\n scripts.authorize as Script<Authorization, void> | undefined,\n () => ({}),\n undefined,\n );\n },\n async discover(_authorization: Authorization) {\n return resolveScript<DiscoverResult, void>(\n scripts.discover as Script<DiscoverResult, void> | undefined,\n discovery,\n undefined,\n ).then((answer) => {\n if (answer.kind === 'discovery') for (const room of answer.rooms) note(room.locator, room);\n return answer;\n });\n },\n reached,\n async bootstrap(_authorization: Authorization, request: BootstrapRequest) {\n return resolveScript<BootstrapResult, BootstrapRequest>(\n scripts.bootstrap as Script<BootstrapResult, BootstrapRequest> | undefined,\n () => {\n const room = rooms.find((entry) => entry.locator === request.locator);\n if (room === undefined) {\n return { kind: 'room-not-readable', locator: request.locator };\n }\n return page(room, request.pageToken === undefined ? 0 : Number(request.pageToken));\n },\n request,\n ).then((answer) => note(request.locator, answer));\n },\n async refresh(_authorization: Authorization, request: RefreshRequest) {\n return resolveScript<RefreshResult, RefreshRequest>(\n scripts.refresh as Script<RefreshResult, RefreshRequest> | undefined,\n () => {\n const room = rooms.find((entry) => entry.locator === request.locator);\n if (room === undefined) {\n return { kind: 'room-not-readable', locator: request.locator };\n }\n if (request.pageToken !== undefined) {\n const continuation = refreshPages.get(request.pageToken);\n if (\n continuation === undefined ||\n continuation.room.locator !== request.locator ||\n continuation.from.roomVersion !== request.fromRoomVersion\n ) {\n throw new Error('Invalid Refresh Page Token');\n }\n return advancement(continuation.room, continuation.from, continuation.at);\n }\n if (\n request.minPosition !== undefined &&\n !reached(room.locator, room.roomVersion, request.minPosition)\n ) {\n return { kind: 'retryable-refusal', code: 'replica_behind', fields: {} };\n }\n if (request.fromRoomVersion === room.roomVersion) {\n return { kind: 'still-current' };\n }\n const from = served.get(room.locator)?.get(request.fromRoomVersion);\n if (from === undefined) return { kind: 'beyond-horizon' };\n return advancement(room, from, 0);\n },\n request,\n ).then((answer) => note(request.locator, answer));\n },\n async mutate(_authorization: Authorization, request: MutationRequest) {\n return resolveScript<MutationResult, MutationRequest>(\n scripts.mutate as Script<MutationResult, MutationRequest> | undefined,\n () => {\n const room = rooms.find((entry) => entry.locator === request.locator);\n if (room === undefined) {\n return { kind: 'room-not-readable', locator: request.locator };\n }\n return { kind: 'rejected', code: 'unscripted-mutation', fields: {}, affected: {} };\n },\n request,\n ).then((answer) => note(request.locator, answer));\n },\n async history(_authorization: Authorization, request: HistoryRequest) {\n return resolveScript<HistoryResult, HistoryRequest>(\n scripts.history as Script<HistoryResult, HistoryRequest> | undefined,\n () => {\n const room = rooms.find((entry) => entry.locator === request.locator);\n if (room === undefined) {\n return { kind: 'room-not-readable', locator: request.locator };\n }\n return {\n kind: 'history',\n revisions: [],\n };\n },\n request,\n );\n },\n async action(_authorization: Authorization, request: ActionRequest) {\n return resolveScript<ActionResult, ActionRequest>(\n scripts.action as Script<ActionResult, ActionRequest> | undefined,\n () => {\n if (request.name.startsWith('conversation.')) return conversationAction(request);\n return { kind: 'rejected', code: 'unscripted-action', fields: {} };\n },\n request,\n ).then((answer) => {\n if (answer.kind === 'action' && answer.at !== undefined) note(answer.at.locator, answer.at);\n return answer;\n });\n },\n };\n}\n"],"names":["ROOM_CONTRACT_VERSION","MD_MODEL","sameChange","FIXTURE_RETENTION","history","kind","seconds","outcome","refreshHorizon","declaredRetention","value","retention","Number","isFinite","Error","named","source","paths","taken","path","undefined","resolveScript","answer","fallback","request","createMemoryAdapter","options","rooms","mdModel","supportedVersions","capabilities","providerLimits","pageSize","scripts","served","Map","refreshPages","observers","Set","listeners","modeObservers","scripted","unsealed","sealed","historyPageSize","selected","replicated","issued","scriptConversations","entries","clear","entry","set","conversation","conversations","ordinals","note","locator","roomVersion","key","String","has","size","reached","target","held","get","wanted","retain","room","versions","declared","name","operations","replica","attachedModel","typedSelection","untypedFolders","providerOwnedPaths","page","from","Object","keys","documents","sort","length","slice","next","targets","binaryTargets","revisions","changes","attachments","pageToken","advancement","at","current","previous","currentTargets","previousTargets","headMoved","changed","filter","opening","JSON","stringify","removals","pageOf","after","messages","first","findIndex","message","position","last","historiesOf","input","asked","Array","isArray","code","fields","histories","outcomes","push","result","conversationAction","turn","delete","cancelled","discovery","map","setRooms","setConversations","notifyRoomVersion","notification","observer","notifyConversation","event","add","listener","notifyServiceMode","mode","selectedRooms","replicatedConversations","replicate","observe","notify","serviceMode","roomVersions","select","locators","script","operation","model","_authorization","find","attached","selectionModel","reason","authorize","discover","then","bootstrap","refresh","continuation","fromRoomVersion","minPosition","mutate","affected","action","startsWith"],"mappings":"AACA,SACEA,qBAAqB,QA4BhB,eAAe;AACtB,SAASC,QAAQ,QAAQ,kBAAkB;AAC3C,SAASC,UAAU,QAAQ,eAAe;AAE1C,MAAMC,oBAA+B;IACnCC,SAAS;QAAEC,MAAM;QAAYC,SAAS;IAAE;IACxCC,SAAS;IACTC,gBAAgB;AAClB;AAEA,SAASC,kBAAkBC,KAA4B;IACrD,MAAMC,YAAYD,SAASP;IAC3B,IAAIQ,UAAUP,OAAO,CAACC,IAAI,KA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oBAAEpD,MAAM;oBAAYmH,MAAM;oBAAuBC,QAAQ,CAAC;oBAAGgD,UAAU,CAAC;gBAAE;YACnF,GACAjJ,SACA0I,IAAI,CAAC,CAAC5I,SAAWkC,KAAKhC,QAAQiC,OAAO,EAAEnC;QAC3C;QACA,MAAMlB,SAAQuJ,cAA6B,EAAEnI,OAAuB;YAClE,OAAOH,cACLY,QAAQ7B,OAAO,EACf;gBACE,MAAMiE,OAAO1C,MAAMiI,IAAI,CAAC,CAACzG,QAAUA,MAAMM,OAAO,KAAKjC,QAAQiC,OAAO;gBACpE,IAAIY,SAASjD,WAAW;oBACtB,OAAO;wBAAEf,MAAM;wBAAqBoD,SAASjC,QAAQiC,OAAO;oBAAC;gBAC/D;gBACA,OAAO;oBACLpD,MAAM;oBACNqF,WAAW,EAAE;gBACf;YACF,GACAlE;QAEJ;QACA,MAAMkJ,QAAOf,cAA6B,EAAEnI,OAAsB;YAChE,OAAOH,cACLY,QAAQyI,MAAM,EACd;gBACE,IAAIlJ,QAAQgD,IAAI,CAACmG,UAAU,CAAC,kBAAkB,OAAO7C,mBAAmBtG;gBACxE,OAAO;oBAAEnB,MAAM;oBAAYmH,MAAM;oBAAqBC,QAAQ,CAAC;gBAAE;YACnE,GACAjG,SACA0I,IAAI,CAAC,CAAC5I;gBACN,IAAIA,OAAOjB,IAAI,KAAK,YAAYiB,OAAOyE,EAAE,KAAK3E,WAAWoC,KAAKlC,OAAOyE,EAAE,CAACtC,OAAO,EAAEnC,OAAOyE,EAAE;gBAC1F,OAAOzE;YACT;QACF;IACF;AACF"}
|
package/dist/refresh.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"refresh.d.ts","sourceRoot":"","sources":["../src/refresh.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,OAAO,EACP,cAAc,EACd,aAAa,EAGb,gBAAgB,
|
|
1
|
+
{"version":3,"file":"refresh.d.ts","sourceRoot":"","sources":["../src/refresh.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,OAAO,EACP,cAAc,EACd,aAAa,EAGb,gBAAgB,EAEjB,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAc,KAAK,cAAc,EAAE,MAAM,cAAc,CAAC;AAC/D,OAAO,EAAe,KAAK,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5E,MAAM,MAAM,cAAc,GACtB;IAAE,IAAI,EAAE,eAAe,CAAA;CAAE,GACzB;IAAE,IAAI,EAAE,UAAU,CAAC;IAAC,SAAS,EAAE,cAAc,CAAA;CAAE,GAC/C;IAAE,IAAI,EAAE,gBAAgB,CAAA;CAAE,GAC1B,gBAAgB,GAChB,WAAW,GACX,OAAO,GACP,cAAc,CAAC;AAEnB,wBAAsB,WAAW,CAC/B,OAAO,EAAE,OAAO,EAChB,aAAa,EAAE,aAAa,EAC5B,SAAS,EAAE,cAAc,EACzB,UAAU,EAAE,MAAM,OAAO,EACzB,WAAW,EAAE,MAAM,GAAG,SAAS,GAC9B,OAAO,CAAC,cAAc,CAAC,CAqEzB"}
|
package/dist/refresh.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { declaredAttachments } from './attachment.js';
|
|
1
2
|
import { readStaged } from './replica.js';
|
|
2
3
|
import { unconfirmed } from './transfer.js';
|
|
3
4
|
export async function refreshRoom(adapter, authorization, confirmed, continuing, minPosition) {
|
|
@@ -23,7 +24,9 @@ export async function refreshRoom(adapter, authorization, confirmed, continuing,
|
|
|
23
24
|
...confirmed.record.changes
|
|
24
25
|
};
|
|
25
26
|
const binaryTargets = new Set(confirmed.record.binaryTargets);
|
|
27
|
+
const attachments = [];
|
|
26
28
|
const stage = (page)=>{
|
|
29
|
+
if (page.attachments !== undefined) attachments.push(page.attachments);
|
|
27
30
|
Object.assign(documents, page.documents);
|
|
28
31
|
Object.assign(revisions, page.revisions);
|
|
29
32
|
for (const path of Object.keys(page.documents)){
|
|
@@ -71,7 +74,8 @@ export async function refreshRoom(adapter, authorization, confirmed, continuing,
|
|
|
71
74
|
...binaryTargets
|
|
72
75
|
].sort(),
|
|
73
76
|
revisions,
|
|
74
|
-
changes
|
|
77
|
+
changes,
|
|
78
|
+
attachments: attachments.length === 0 ? confirmed.record.attachments : declaredAttachments(attachments)
|
|
75
79
|
}, confirmed);
|
|
76
80
|
return staged.kind === 'staged' ? {
|
|
77
81
|
kind: 'advanced',
|
package/dist/refresh.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/workspace/packages/mdruntime/src/refresh.ts"],"sourcesContent":["import type {\n Adapter,\n AdapterFailure,\n Authorization,\n HeadChange,\n RefreshPage,\n RetryableRefusal,\n} from './adapter.js';\nimport { readStaged, type ConfirmedLayer } from './replica.js';\nimport { unconfirmed, type Refused, type Unconfirmed } from './transfer.js';\n\nexport type RefreshOutcome =\n | { kind: 'still-current' }\n | { kind: 'advanced'; confirmed: ConfirmedLayer }\n | { kind: 'beyond-horizon' }\n | RetryableRefusal\n | Unconfirmed\n | Refused\n | AdapterFailure;\n\nexport async function refreshRoom(\n adapter: Adapter,\n authorization: Authorization,\n confirmed: ConfirmedLayer,\n continuing: () => boolean,\n minPosition: string | undefined,\n): Promise<RefreshOutcome> {\n const locator = confirmed.record.locator;\n const fromRoomVersion = confirmed.record.roomVersion;\n const first = await adapter.refresh(authorization, {\n locator,\n selection: confirmed.record.replica.selection,\n fromRoomVersion,\n ...(minPosition === undefined ? {} : { minPosition }),\n });\n if (first.kind !== 'net-advancement') return first;\n const roomVersion = first.roomVersion;\n const documents: Record<string, string> = { ...confirmed.record.documents };\n const revisions: Record<string, string> = { ...confirmed.record.revisions };\n const changes: Record<string, HeadChange> = { ...confirmed.record.changes };\n const binaryTargets = new Set(confirmed.record.binaryTargets);\n const stage = (page: RefreshPage) => {\n Object.assign(documents, page.documents);\n Object.assign(revisions, page.revisions);\n for (const path of Object.keys(page.documents)) {\n binaryTargets.delete(path);\n delete changes[path];\n }\n for (const target of page.binaryTargets) {\n delete documents[target];\n delete revisions[target];\n delete changes[target];\n binaryTargets.add(target);\n }\n Object.assign(changes, page.changes);\n for (const path of page.removals) {\n delete documents[path];\n delete revisions[path];\n delete changes[path];\n binaryTargets.delete(path);\n }\n };\n stage(first);\n let pageToken = first.pageToken;\n while (pageToken !== undefined) {\n if (!continuing()) return unconfirmed;\n const page = await adapter.refresh(authorization, {\n locator,\n selection: confirmed.record.replica.selection,\n fromRoomVersion,\n ...(minPosition === undefined ? {} : { minPosition }),\n pageToken,\n });\n if (page.kind === 'still-current' || page.kind === 'beyond-horizon') return unconfirmed;\n if (page.kind !== 'net-advancement') return page;\n if (page.roomVersion !== roomVersion) return unconfirmed;\n stage(page);\n pageToken = page.pageToken;\n }\n const staged = readStaged(\n {\n ...confirmed.record,\n roomVersion,\n documents,\n binaryTargets: [...binaryTargets].sort(),\n revisions,\n changes,\n },\n confirmed,\n );\n return staged.kind === 'staged' ? { kind: 'advanced', confirmed: staged.confirmed } : staged;\n}\n"],"names":["readStaged","unconfirmed","refreshRoom","adapter","authorization","confirmed","continuing","minPosition","locator","record","fromRoomVersion","roomVersion","first","refresh","selection","replica","undefined","kind","documents","revisions","changes","binaryTargets","Set","stage","page","Object","assign","path","keys","delete","target","add","removals","pageToken","staged","sort"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["/workspace/packages/mdruntime/src/refresh.ts"],"sourcesContent":["import type {\n Adapter,\n AdapterFailure,\n Authorization,\n HeadChange,\n RefreshPage,\n RetryableRefusal,\n RoomAttachment,\n} from './adapter.js';\nimport { declaredAttachments } from './attachment.js';\nimport { readStaged, type ConfirmedLayer } from './replica.js';\nimport { unconfirmed, type Refused, type Unconfirmed } from './transfer.js';\n\nexport type RefreshOutcome =\n | { kind: 'still-current' }\n | { kind: 'advanced'; confirmed: ConfirmedLayer }\n | { kind: 'beyond-horizon' }\n | RetryableRefusal\n | Unconfirmed\n | Refused\n | AdapterFailure;\n\nexport async function refreshRoom(\n adapter: Adapter,\n authorization: Authorization,\n confirmed: ConfirmedLayer,\n continuing: () => boolean,\n minPosition: string | undefined,\n): Promise<RefreshOutcome> {\n const locator = confirmed.record.locator;\n const fromRoomVersion = confirmed.record.roomVersion;\n const first = await adapter.refresh(authorization, {\n locator,\n selection: confirmed.record.replica.selection,\n fromRoomVersion,\n ...(minPosition === undefined ? {} : { minPosition }),\n });\n if (first.kind !== 'net-advancement') return first;\n const roomVersion = first.roomVersion;\n const documents: Record<string, string> = { ...confirmed.record.documents };\n const revisions: Record<string, string> = { ...confirmed.record.revisions };\n const changes: Record<string, HeadChange> = { ...confirmed.record.changes };\n const binaryTargets = new Set(confirmed.record.binaryTargets);\n const attachments: (readonly RoomAttachment[])[] = [];\n const stage = (page: RefreshPage) => {\n if (page.attachments !== undefined) attachments.push(page.attachments);\n Object.assign(documents, page.documents);\n Object.assign(revisions, page.revisions);\n for (const path of Object.keys(page.documents)) {\n binaryTargets.delete(path);\n delete changes[path];\n }\n for (const target of page.binaryTargets) {\n delete documents[target];\n delete revisions[target];\n delete changes[target];\n binaryTargets.add(target);\n }\n Object.assign(changes, page.changes);\n for (const path of page.removals) {\n delete documents[path];\n delete revisions[path];\n delete changes[path];\n binaryTargets.delete(path);\n }\n };\n stage(first);\n let pageToken = first.pageToken;\n while (pageToken !== undefined) {\n if (!continuing()) return unconfirmed;\n const page = await adapter.refresh(authorization, {\n locator,\n selection: confirmed.record.replica.selection,\n fromRoomVersion,\n ...(minPosition === undefined ? {} : { minPosition }),\n pageToken,\n });\n if (page.kind === 'still-current' || page.kind === 'beyond-horizon') return unconfirmed;\n if (page.kind !== 'net-advancement') return page;\n if (page.roomVersion !== roomVersion) return unconfirmed;\n stage(page);\n pageToken = page.pageToken;\n }\n const staged = readStaged(\n {\n ...confirmed.record,\n roomVersion,\n documents,\n binaryTargets: [...binaryTargets].sort(),\n revisions,\n changes,\n attachments:\n attachments.length === 0 ? confirmed.record.attachments : declaredAttachments(attachments),\n },\n confirmed,\n );\n return staged.kind === 'staged' ? { kind: 'advanced', confirmed: staged.confirmed } : staged;\n}\n"],"names":["declaredAttachments","readStaged","unconfirmed","refreshRoom","adapter","authorization","confirmed","continuing","minPosition","locator","record","fromRoomVersion","roomVersion","first","refresh","selection","replica","undefined","kind","documents","revisions","changes","binaryTargets","Set","attachments","stage","page","push","Object","assign","path","keys","delete","target","add","removals","pageToken","staged","sort","length"],"mappings":"AASA,SAASA,mBAAmB,QAAQ,kBAAkB;AACtD,SAASC,UAAU,QAA6B,eAAe;AAC/D,SAASC,WAAW,QAAwC,gBAAgB;AAW5E,OAAO,eAAeC,YACpBC,OAAgB,EAChBC,aAA4B,EAC5BC,SAAyB,EACzBC,UAAyB,EACzBC,WAA+B;IAE/B,MAAMC,UAAUH,UAAUI,MAAM,CAACD,OAAO;IACxC,MAAME,kBAAkBL,UAAUI,MAAM,CAACE,WAAW;IACpD,MAAMC,QAAQ,MAAMT,QAAQU,OAAO,CAACT,eAAe;QACjDI;QACAM,WAAWT,UAAUI,MAAM,CAACM,OAAO,CAACD,SAAS;QAC7CJ;QACA,GAAIH,gBAAgBS,YAAY,CAAC,IAAI;YAAET;QAAY,CAAC;IACtD;IACA,IAAIK,MAAMK,IAAI,KAAK,mBAAmB,OAAOL;IAC7C,MAAMD,cAAcC,MAAMD,WAAW;IACrC,MAAMO,YAAoC;QAAE,GAAGb,UAAUI,MAAM,CAACS,SAAS;IAAC;IAC1E,MAAMC,YAAoC;QAAE,GAAGd,UAAUI,MAAM,CAACU,SAAS;IAAC;IAC1E,MAAMC,UAAsC;QAAE,GAAGf,UAAUI,MAAM,CAACW,OAAO;IAAC;IAC1E,MAAMC,gBAAgB,IAAIC,IAAIjB,UAAUI,MAAM,CAACY,aAAa;IAC5D,MAAME,cAA6C,EAAE;IACrD,MAAMC,QAAQ,CAACC;QACb,IAAIA,KAAKF,WAAW,KAAKP,WAAWO,YAAYG,IAAI,CAACD,KAAKF,WAAW;QACrEI,OAAOC,MAAM,CAACV,WAAWO,KAAKP,SAAS;Q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EA,YAAYe,MAAM,KAAK,IAAIjC,UAAUI,MAAM,CAACc,WAAW,GAAGxB,oBAAoBwB;IAClF,GACAlB;IAEF,OAAO+B,OAAOnB,IAAI,KAAK,WAAW;QAAEA,MAAM;QAAYZ,WAAW+B,OAAO/B,SAAS;IAAC,IAAI+B;AACxF"}
|
package/dist/store.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ModelState } from './model.js';
|
|
2
|
-
import type { Capability, Discovery, HeadChange, OperationScopes, ProviderLimit, ReplicaAdmission, TypedSelection } from './adapter.js';
|
|
2
|
+
import type { Capability, Discovery, HeadChange, OperationScopes, ProviderLimit, ReplicaAdmission, RoomAttachment, TypedSelection } from './adapter.js';
|
|
3
3
|
import type { AcceptedMessage } from './adapter.js';
|
|
4
4
|
import type { ChangeBatch } from './change.js';
|
|
5
5
|
import type { ChatDraftFile } from './file.js';
|
|
@@ -21,6 +21,7 @@ export type ReplicaRecord = {
|
|
|
21
21
|
binaryTargets: readonly string[];
|
|
22
22
|
revisions: Readonly<Record<string, string>>;
|
|
23
23
|
changes: Readonly<Record<string, HeadChange>>;
|
|
24
|
+
attachments: readonly RoomAttachment[];
|
|
24
25
|
};
|
|
25
26
|
export type PendingState = {
|
|
26
27
|
readonly drafts: readonly SavedDraft[];
|
package/dist/store.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../src/store.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,KAAK,EACV,UAAU,EACV,SAAS,EACT,UAAU,EACV,eAAe,EACf,aAAa,EACb,gBAAgB,EAChB,cAAc,EACf,MAAM,cAAc,CAAC;AACtB,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE/C,OAAO,KAAK,EAAE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MAAM,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACtD,aAAa,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACnD,aAAa,CAAC,MAAM,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACtD,gBAAgB,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC/D,SAAS,CAAC,QAAQ,EAAE,SAAS,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACtD,UAAU,IAAI,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;IACrC,kBAAkB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACjD,KAAK,IAAI,IAAI,CAAC;CACf,CAAC;AA8EF,wBAAgB,kBAAkB,IAAI,OAAO,CAAC,IAAI,CAAC,CAMlD;AAED,wBAAsB,gBAAgB,IAAI,OAAO,CAAC,YAAY,CAAC,CAiV9D"}
|
package/dist/store.js
CHANGED
|
@@ -3,6 +3,7 @@ const DATABASE = 'mdruntime';
|
|
|
3
3
|
const ROOMS = 'rooms';
|
|
4
4
|
const DOCUMENTS = 'documents';
|
|
5
5
|
const BINARY_TARGETS = 'binaryTargets';
|
|
6
|
+
const ATTACHMENTS = 'attachments';
|
|
6
7
|
const PENDING_CHANGES = 'pendingChanges';
|
|
7
8
|
const OUTCOMES = 'outcomes';
|
|
8
9
|
const DECLARATIONS = 'declarations';
|
|
@@ -12,7 +13,7 @@ const CONVERSATIONS = 'conversations';
|
|
|
12
13
|
const MESSAGES = 'messages';
|
|
13
14
|
const CHAT_DRAFTS = 'chatDrafts';
|
|
14
15
|
const CURRENT = 'current';
|
|
15
|
-
const SCHEMA =
|
|
16
|
+
const SCHEMA = 18;
|
|
16
17
|
function settled(request) {
|
|
17
18
|
return new Promise((resolve, reject)=>{
|
|
18
19
|
request.onsuccess = ()=>resolve(request.result);
|
|
@@ -63,7 +64,7 @@ function amendPending(database, locator, id, amendment) {
|
|
|
63
64
|
return completed(transaction);
|
|
64
65
|
}
|
|
65
66
|
function roomRecord(record, queue) {
|
|
66
|
-
const { documents, binaryTargets, revisions, changes, ...room } = record;
|
|
67
|
+
const { documents, binaryTargets, revisions, changes, attachments, ...room } = record;
|
|
67
68
|
return {
|
|
68
69
|
...room,
|
|
69
70
|
order: queue.map((batch)=>batch.id)
|
|
@@ -106,6 +107,12 @@ export async function openRuntimeStore() {
|
|
|
106
107
|
'path'
|
|
107
108
|
]
|
|
108
109
|
});
|
|
110
|
+
database.createObjectStore(ATTACHMENTS, {
|
|
111
|
+
keyPath: [
|
|
112
|
+
'locator',
|
|
113
|
+
'reference'
|
|
114
|
+
]
|
|
115
|
+
});
|
|
109
116
|
database.createObjectStore(PENDING_CHANGES, {
|
|
110
117
|
keyPath: [
|
|
111
118
|
'locator',
|
|
@@ -146,12 +153,14 @@ export async function openRuntimeStore() {
|
|
|
146
153
|
const transaction = database.transaction([
|
|
147
154
|
ROOMS,
|
|
148
155
|
DOCUMENTS,
|
|
149
|
-
BINARY_TARGETS
|
|
156
|
+
BINARY_TARGETS,
|
|
157
|
+
ATTACHMENTS
|
|
150
158
|
], 'readonly');
|
|
151
|
-
const [rooms, documents, targets] = await Promise.all([
|
|
159
|
+
const [rooms, documents, targets, attachments] = await Promise.all([
|
|
152
160
|
settled(transaction.objectStore(ROOMS).getAll()),
|
|
153
161
|
settled(transaction.objectStore(DOCUMENTS).getAll()),
|
|
154
|
-
settled(transaction.objectStore(BINARY_TARGETS).getAll())
|
|
162
|
+
settled(transaction.objectStore(BINARY_TARGETS).getAll()),
|
|
163
|
+
settled(transaction.objectStore(ATTACHMENTS).getAll())
|
|
155
164
|
]);
|
|
156
165
|
const byRoom = new Map();
|
|
157
166
|
for (const { order, ...room } of rooms){
|
|
@@ -160,7 +169,8 @@ export async function openRuntimeStore() {
|
|
|
160
169
|
documents: {},
|
|
161
170
|
revisions: {},
|
|
162
171
|
changes: {},
|
|
163
|
-
binaryTargets: []
|
|
172
|
+
binaryTargets: [],
|
|
173
|
+
attachments: []
|
|
164
174
|
});
|
|
165
175
|
}
|
|
166
176
|
const head = (room, held)=>{
|
|
@@ -183,6 +193,11 @@ export async function openRuntimeStore() {
|
|
|
183
193
|
room.binaryTargets.push(target.path);
|
|
184
194
|
head(room, target);
|
|
185
195
|
}
|
|
196
|
+
for (const { locator, ...attachment } of attachments){
|
|
197
|
+
const room = byRoom.get(locator);
|
|
198
|
+
if (room === undefined) continue;
|
|
199
|
+
room.attachments.push(attachment);
|
|
200
|
+
}
|
|
186
201
|
return [
|
|
187
202
|
...byRoom.values()
|
|
188
203
|
];
|
|
@@ -192,6 +207,7 @@ export async function openRuntimeStore() {
|
|
|
192
207
|
ROOMS,
|
|
193
208
|
DOCUMENTS,
|
|
194
209
|
BINARY_TARGETS,
|
|
210
|
+
ATTACHMENTS,
|
|
195
211
|
PENDING_CHANGES,
|
|
196
212
|
OUTCOMES,
|
|
197
213
|
ROOM_DRAFTS
|
|
@@ -233,6 +249,25 @@ export async function openRuntimeStore() {
|
|
|
233
249
|
});
|
|
234
250
|
}
|
|
235
251
|
}
|
|
252
|
+
const attachments = transaction.objectStore(ATTACHMENTS);
|
|
253
|
+
const held = new Map((previous?.attachments ?? []).map((attachment)=>[
|
|
254
|
+
attachment.reference,
|
|
255
|
+
attachment
|
|
256
|
+
]));
|
|
257
|
+
const declared = new Set(next.attachments.map((attachment)=>attachment.reference));
|
|
258
|
+
for (const reference of held.keys()){
|
|
259
|
+
if (!declared.has(reference)) attachments.delete([
|
|
260
|
+
next.locator,
|
|
261
|
+
reference
|
|
262
|
+
]);
|
|
263
|
+
}
|
|
264
|
+
for (const attachment of next.attachments){
|
|
265
|
+
if (held.get(attachment.reference) === attachment) continue;
|
|
266
|
+
attachments.put({
|
|
267
|
+
...attachment,
|
|
268
|
+
locator: next.locator
|
|
269
|
+
});
|
|
270
|
+
}
|
|
236
271
|
if (previousQueue !== undefined) {
|
|
237
272
|
const pending = transaction.objectStore(PENDING_CHANGES);
|
|
238
273
|
const before = new Set(previousQueue.map((batch)=>batch.id));
|
|
@@ -477,6 +512,7 @@ export async function openRuntimeStore() {
|
|
|
477
512
|
ROOMS,
|
|
478
513
|
DOCUMENTS,
|
|
479
514
|
BINARY_TARGETS,
|
|
515
|
+
ATTACHMENTS,
|
|
480
516
|
PENDING_CHANGES,
|
|
481
517
|
OUTCOMES,
|
|
482
518
|
ROOM_DRAFTS
|
|
@@ -486,6 +522,7 @@ export async function openRuntimeStore() {
|
|
|
486
522
|
for (const name of [
|
|
487
523
|
DOCUMENTS,
|
|
488
524
|
BINARY_TARGETS,
|
|
525
|
+
ATTACHMENTS,
|
|
489
526
|
PENDING_CHANGES,
|
|
490
527
|
ROOM_DRAFTS
|
|
491
528
|
]){
|