@agentshouse/mdruntime 0.1.0-alpha.41 → 0.1.0-alpha.43
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 +12 -5
- package/dist/adapter.d.ts +15 -0
- package/dist/adapter.d.ts.map +1 -1
- package/dist/adapter.js.map +1 -1
- package/dist/bootstrap.d.ts.map +1 -1
- package/dist/bootstrap.js +6 -1
- package/dist/bootstrap.js.map +1 -1
- package/dist/change-set.d.ts.map +1 -1
- package/dist/change-set.js +3 -2
- package/dist/change-set.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 +17 -5
- package/dist/memory.js.map +1 -1
- package/dist/overlay.d.ts +7 -2
- package/dist/overlay.d.ts.map +1 -1
- package/dist/overlay.js +48 -15
- package/dist/overlay.js.map +1 -1
- package/dist/query.d.ts +4 -0
- package/dist/query.d.ts.map +1 -1
- package/dist/query.js +4 -1
- package/dist/query.js.map +1 -1
- package/dist/read-side.d.ts.map +1 -1
- package/dist/read-side.js +6 -0
- package/dist/read-side.js.map +1 -1
- package/dist/refresh.d.ts.map +1 -1
- package/dist/refresh.js +12 -2
- package/dist/refresh.js.map +1 -1
- package/dist/replica.d.ts.map +1 -1
- package/dist/replica.js +9 -0
- package/dist/replica.js.map +1 -1
- package/dist/rows.d.ts +3 -1
- package/dist/rows.d.ts.map +1 -1
- package/dist/rows.js +5 -3
- package/dist/rows.js.map +1 -1
- package/dist/store.d.ts +2 -1
- package/dist/store.d.ts.map +1 -1
- package/dist/store.js +20 -12
- package/dist/store.js.map +1 -1
- package/package.json +2 -2
package/AGENTS.md
CHANGED
|
@@ -73,11 +73,18 @@ data:
|
|
|
73
73
|
`backlinks: { field, types, where, pathPrefix }` keeps Documents that a
|
|
74
74
|
matching Document of the same Room references. Each keeps a Document once.
|
|
75
75
|
- **Parts.** A Document query must `select`: `'all'`, or `fields`, `sections`,
|
|
76
|
-
`preamble`, `markdown` and `
|
|
77
|
-
`'all'` or a list of names. Room and Path always return; a Markdown
|
|
78
|
-
also returns its MD Type. A non-Markdown Document or binary link
|
|
79
|
-
only Room and Path. An unselected part is absent. Select only
|
|
80
|
-
shows: a list that selects the Markdown hears every edit of it.
|
|
76
|
+
`preamble`, `markdown`, `backlinks` and `change`, where `fields` and `sections`
|
|
77
|
+
are `'all'` or a list of names. Room and Path always return; a Markdown
|
|
78
|
+
Document also returns its MD Type. A non-Markdown Document or binary link
|
|
79
|
+
target returns only Room and Path. An unselected part is absent. Select only
|
|
80
|
+
what a screen shows: a list that selects the Markdown hears every edit of it.
|
|
81
|
+
- **Change.** `change` is `{ author, time }` of the Document's head revision as
|
|
82
|
+
the Provider last delivered it: `author` is `{ kind: 'user' | 'site', id, name }`
|
|
83
|
+
or `null` for a write the Provider made itself, and `time` is the Provider's
|
|
84
|
+
ISO 8601 change time. It is `null` where the Provider delivered no time, as at
|
|
85
|
+
a Site. An unsent edit or move keeps it, an unsent creation has none, and a
|
|
86
|
+
saved write takes the Provider's own once it is Accepted and refreshed. A
|
|
87
|
+
Room's last change is its Document with the latest `time`.
|
|
81
88
|
- **Order and groups.** `orderBy` sorts by `room`, `path`, `type` or `{ field }`
|
|
82
89
|
with TanStack DB's own options, and ties end with Room, then Path. `groupBy` by
|
|
83
90
|
`room`, `type` or `{ field }` answers `{ groups: [{ key, count }] }`, counted
|
package/dist/adapter.d.ts
CHANGED
|
@@ -169,6 +169,19 @@ export type ContractUnavailable = ProviderRefusal & {
|
|
|
169
169
|
};
|
|
170
170
|
export type DiscoverResult = Discovery | TransportUncertainty | RevokedAuthorization | ContractUnavailable;
|
|
171
171
|
export type PageToken = string;
|
|
172
|
+
export type ChangeAuthor = {
|
|
173
|
+
kind: 'user';
|
|
174
|
+
id: string;
|
|
175
|
+
name: string;
|
|
176
|
+
} | {
|
|
177
|
+
kind: 'site';
|
|
178
|
+
id: string;
|
|
179
|
+
name: string;
|
|
180
|
+
};
|
|
181
|
+
export type HeadChange = {
|
|
182
|
+
author: ChangeAuthor | null;
|
|
183
|
+
time: string;
|
|
184
|
+
};
|
|
172
185
|
export type BootstrapRequest = {
|
|
173
186
|
locator: string;
|
|
174
187
|
selection: string;
|
|
@@ -179,6 +192,7 @@ export type BootstrapPage = {
|
|
|
179
192
|
roomVersion: string;
|
|
180
193
|
documents: Readonly<Record<string, string>>;
|
|
181
194
|
revisions: Readonly<Record<string, string>>;
|
|
195
|
+
changes: Readonly<Record<string, HeadChange>>;
|
|
182
196
|
binaryTargets: readonly string[];
|
|
183
197
|
pageToken?: PageToken;
|
|
184
198
|
};
|
|
@@ -194,6 +208,7 @@ export type RefreshPage = {
|
|
|
194
208
|
roomVersion: string;
|
|
195
209
|
documents: Readonly<Record<string, string>>;
|
|
196
210
|
revisions: Readonly<Record<string, string>>;
|
|
211
|
+
changes: Readonly<Record<string, HeadChange>>;
|
|
197
212
|
binaryTargets: readonly string[];
|
|
198
213
|
removals: readonly string[];
|
|
199
214
|
pageToken?: PageToken;
|
package/dist/adapter.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../src/adapter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAC7D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE/C,MAAM,MAAM,aAAa,GAAG,MAAM,CAAC;AAEnC,eAAO,MAAM,qBAAqB,IAAI,CAAC;AAEvC,eAAO,MAAM,sBAAsB,YACjC,iBAAiB,EACjB,wBAAwB,EACxB,4BAA4B,EAC5B,cAAc,EACd,kBAAkB,EAClB,yBAAyB,CACjB,CAAC;AAEX,MAAM,MAAM,eAAe,GAAG;IAC5B,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,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aAAa,EAAE,aAAa,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;IAChE,SAAS,CAAC,aAAa,EAAE,aAAa,EAAE,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC;IAC7F,OAAO,CAAC,aAAa,EAAE,aAAa,EAAE,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC;IACvF,MAAM,CACJ,aAAa,EAAE,aAAa,EAC5B,OAAO,EAAE,eAAe,EACxB,IAAI,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,OAAO,CAAC,IAAI,CAAC,GACvC,OAAO,CAAC,cAAc,CAAC,CAAC;IAC3B,OAAO,CAAC,aAAa,EAAE,aAAa,EAAE,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC;IACvF,MAAM,CAAC,aAAa,EAAE,aAAa,EAAE,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;IACpF,YAAY,CAAC,EAAE,aAAa,CAAC;IAC7B,aAAa,CAAC,EAAE,kBAAkB,CAAC;IACnC,WAAW,CAAC,EAAE,iBAAiB,CAAC;CACjC,CAAC"}
|
package/dist/adapter.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/workspace/packages/mdruntime/src/adapter.ts"],"sourcesContent":["import type { ModelIdentity, ModelResult } from './model.js';\nimport type { ChangeBatch } from './change.js';\n\nexport type Authorization = object;\n\nexport const ROOM_CONTRACT_VERSION = 1;\n\nexport const VERSION_1_CAPABILITIES = [\n 'stable-file-ids',\n 'ranked-provider-search',\n 'room-version-notifications',\n 'room-history',\n 'provider-actions',\n 'move-reference-rewrites',\n] as const;\n\nexport type MdModelIdentity = {\n identity: string;\n version: string;\n};\n\nexport type TypedSelection = {\n roots: readonly string[];\n attachedModel: ModelIdentity | null;\n};\n\nexport type OperationScopes = {\n read: readonly string[];\n sync: readonly string[];\n write: readonly string[];\n delete: readonly string[];\n};\nexport type ReplicaAdmission = { selection: string; admission: 'admitted' | 'unavailable' };\n\nexport type DiscoveredRoom = {\n collectionRoot: string;\n name: string;\n locator: string;\n roomVersion: string;\n operations: OperationScopes;\n replica: ReplicaAdmission;\n attachedModel: ModelIdentity | null;\n typedSelection?: TypedSelection;\n providerOwnedPaths: readonly string[];\n};\n\nexport type Capability = {\n name: string;\n limits?: readonly ProviderLimit[];\n actions?: readonly ActionDeclaration[];\n conversationCards?: ConversationCards;\n};\n\nexport type ConversationCards = {\n locator: string;\n type: string;\n identity: string;\n agent: string;\n};\n\nexport type ConversationAction =\n | 'conversation.create'\n | 'conversation.send'\n | 'conversation.answer'\n | 'conversation.interrupt'\n | 'conversation.kill'\n | 'conversation.cancel'\n | 'conversation.delete'\n | 'conversation.history';\n\nexport type ConversationMessage = {\n identity: string;\n turn: string;\n text: string;\n message: unknown;\n};\n\nexport type AcceptedMessage = ConversationMessage & { position: string };\n\nexport type ConversationHistoryRequest = {\n conversation: string;\n after?: string;\n};\n\nexport type ConversationHistoryPage = {\n messages: readonly AcceptedMessage[];\n next?: string;\n};\n\nexport type WorkingNote = { noteId: string; text: string };\n\nexport type ConversationEvent =\n | { kind: 'growing-text'; conversation: string; turn: string; text: string }\n | { kind: 'plan'; conversation: string; turn: string; plan: unknown }\n | { kind: 'working-note'; conversation: string; note: WorkingNote | null }\n | { kind: 'questions'; conversation: string; questions: readonly unknown[] }\n | { kind: 'process'; conversation: string; running: boolean }\n | { kind: 'commands'; conversation: string; commands: readonly unknown[] }\n | { kind: 'options'; conversation: string; options: readonly unknown[] }\n | { kind: 'accepted-message'; conversation: string; message: AcceptedMessage }\n | { kind: 'gap'; conversation: string };\n\nexport type ConversationStream = {\n replicate(conversations: readonly string[]): void;\n observe(notify: (event: ConversationEvent) => void): () => void;\n};\n\nexport type ActionDeclaration = {\n name: string;\n inputShape: unknown;\n resultKind: unknown;\n};\n\nexport type ProviderLimit = {\n name: string;\n value?: number | string;\n};\n\nexport type HistoryRetention =\n | { kind: 'duration'; seconds: number }\n | { kind: 'no-declared-time-bound' };\n\nexport type Retention = {\n history: HistoryRetention;\n outcome: number;\n refreshHorizon: number;\n};\n\nexport type Discovery = {\n kind: 'discovery';\n supportedVersions: readonly number[];\n mdModel: MdModelIdentity;\n rooms: readonly DiscoveredRoom[];\n slots?: readonly {\n slot: string;\n entries: readonly { locator: string; segment: string | null }[];\n }[];\n capabilities: readonly Capability[];\n providerLimits: readonly ProviderLimit[];\n retention: Retention;\n};\n\nexport type TransportUncertainty = { kind: 'transport-uncertainty' };\nexport type RoomNotReadable = { kind: 'room-not-readable'; locator: string };\nexport type RevokedAuthorization = { kind: 'revoked-authorization' };\n\nexport type ProviderRefusal = {\n code: string;\n fields: Readonly<Record<string, unknown>>;\n};\n\nexport type ScopedRefusal = ProviderRefusal & {\n kind: 'scoped-refusal';\n locator: string;\n scope: 'content' | 'sync' | 'model' | 'operation' | 'undisclosed';\n};\nexport type AdapterFailure =\n | TransportUncertainty\n | RoomNotReadable\n | RevokedAuthorization\n | ScopedRefusal;\n\nexport type ContractUnavailable = ProviderRefusal & { kind: 'contract-unavailable' };\n\nexport type DiscoverResult =\n | Discovery\n | TransportUncertainty\n | RevokedAuthorization\n | ContractUnavailable;\n\nexport type PageToken = string;\n\nexport type BootstrapRequest = {\n locator: string;\n selection: string;\n pageToken?: PageToken;\n};\n\nexport type BootstrapPage = {\n kind: 'bootstrap';\n roomVersion: string;\n documents: Readonly<Record<string, string>>;\n revisions: Readonly<Record<string, string>>;\n binaryTargets: readonly string[];\n pageToken?: PageToken;\n};\n\nexport type BootstrapResult = BootstrapPage | AdapterFailure;\n\nexport type RefreshRequest = {\n locator: string;\n selection: string;\n fromRoomVersion: string;\n pageToken?: PageToken;\n};\n\nexport type RefreshPage = {\n kind: 'net-advancement';\n roomVersion: string;\n documents: Readonly<Record<string, string>>;\n revisions: Readonly<Record<string, string>>;\n binaryTargets: readonly string[];\n removals: readonly string[];\n pageToken?: PageToken;\n};\n\nexport type RefreshResult =\n | { kind: 'still-current' }\n | RefreshPage\n | { kind: 'beyond-horizon' }\n | AdapterFailure;\n\nexport type MutationRequest = {\n locator: string;\n changeBatch: ChangeBatch;\n upload?: unknown;\n};\n\nexport type RetryableRefusal = ProviderRefusal & {\n kind: 'retryable-refusal';\n reset?: string;\n};\n\nexport type ServiceMode = 'open' | 'write-halted';\n\nexport type ServiceModeSignal = {\n observe(notify: (mode: ServiceMode) => void): () => void;\n};\n\nexport type MutationResult =\n | {\n kind: 'accepted';\n roomVersion: string;\n documents: Readonly<Record<string, string>>;\n revisions: Readonly<Record<string, string>>;\n removals: readonly string[];\n author?: string;\n time?: string;\n }\n | (ProviderRefusal & {\n kind: 'conflicted';\n roomVersion?: string;\n affected: Readonly<Record<string, string>>;\n })\n | (ProviderRefusal & {\n kind: 'rejected';\n affected: Readonly<Record<string, string>>;\n })\n | RetryableRefusal\n | { kind: 'write-halted' }\n | { kind: 'expired' }\n | AdapterFailure;\n\nexport type HistoryAuthor =\n | { kind: 'user'; id: string }\n | { kind: 'site'; id: string; name: string };\n\nexport type HistoryRevision = {\n revision: string;\n author: HistoryAuthor;\n time: string;\n};\n\nexport type HistoryRequest = {\n locator: string;\n path: string;\n revision?: string;\n pageToken?: PageToken;\n};\n\nexport type HistoryResult =\n | {\n kind: 'history';\n revisions: readonly HistoryRevision[];\n pageToken?: PageToken;\n }\n | {\n kind: 'revision';\n content: string;\n }\n | { kind: 'no-history' }\n | AdapterFailure;\n\nexport type ActionRequest = {\n name: string;\n input: unknown;\n};\n\nexport type ActionResult =\n | { kind: 'action'; result: unknown }\n | (ProviderRefusal & { kind: 'rejected' })\n | AdapterFailure;\n\nexport type ModelRequest =\n | { locator: string; attached: 'collection'; collectionRoot: string; model: ModelIdentity | null }\n | {\n locator: string;\n attached: 'typed-selection';\n roots: readonly string[];\n model: ModelIdentity | null;\n };\n\nexport type RoomVersionNotification = {\n locator: string;\n roomVersion: string;\n modelChanged?: true;\n};\n\nexport type SelectedRooms = {\n select(locators: readonly string[]): void;\n observe(notify: (notification: RoomVersionNotification) => void): () => void;\n};\n\nexport type Adapter = {\n model(authorization: Authorization, request: ModelRequest): Promise<ModelResult>;\n authorize(): Promise<Authorization>;\n discover(authorization: Authorization): Promise<DiscoverResult>;\n bootstrap(authorization: Authorization, request: BootstrapRequest): Promise<BootstrapResult>;\n refresh(authorization: Authorization, request: RefreshRequest): Promise<RefreshResult>;\n mutate(\n authorization: Authorization,\n request: MutationRequest,\n keep: (upload: unknown) => Promise<void>,\n ): Promise<MutationResult>;\n history(authorization: Authorization, request: HistoryRequest): Promise<HistoryResult>;\n action(authorization: Authorization, request: ActionRequest): Promise<ActionResult>;\n roomVersions?: SelectedRooms;\n conversations?: ConversationStream;\n serviceMode?: ServiceModeSignal;\n};\n"],"names":["ROOM_CONTRACT_VERSION","VERSION_1_CAPABILITIES"],"mappings":"AAKA,OAAO,MAAMA,wBAAwB,EAAE;AAEvC,OAAO,MAAMC,yBAAyB;IACpC;IACA;IACA;IACA;IACA;IACA;CACD,CAAU"}
|
|
1
|
+
{"version":3,"sources":["/workspace/packages/mdruntime/src/adapter.ts"],"sourcesContent":["import type { ModelIdentity, ModelResult } from './model.js';\nimport type { ChangeBatch } from './change.js';\n\nexport type Authorization = object;\n\nexport const ROOM_CONTRACT_VERSION = 1;\n\nexport const VERSION_1_CAPABILITIES = [\n 'stable-file-ids',\n 'ranked-provider-search',\n 'room-version-notifications',\n 'room-history',\n 'provider-actions',\n 'move-reference-rewrites',\n] as const;\n\nexport type MdModelIdentity = {\n identity: string;\n version: string;\n};\n\nexport type TypedSelection = {\n roots: readonly string[];\n attachedModel: ModelIdentity | null;\n};\n\nexport type OperationScopes = {\n read: readonly string[];\n sync: readonly string[];\n write: readonly string[];\n delete: readonly string[];\n};\nexport type ReplicaAdmission = { selection: string; admission: 'admitted' | 'unavailable' };\n\nexport type DiscoveredRoom = {\n collectionRoot: string;\n name: string;\n locator: string;\n roomVersion: string;\n operations: OperationScopes;\n replica: ReplicaAdmission;\n attachedModel: ModelIdentity | null;\n typedSelection?: TypedSelection;\n providerOwnedPaths: readonly string[];\n};\n\nexport type Capability = {\n name: string;\n limits?: readonly ProviderLimit[];\n actions?: readonly ActionDeclaration[];\n conversationCards?: ConversationCards;\n};\n\nexport type ConversationCards = {\n locator: string;\n type: string;\n identity: string;\n agent: string;\n};\n\nexport type ConversationAction =\n | 'conversation.create'\n | 'conversation.send'\n | 'conversation.answer'\n | 'conversation.interrupt'\n | 'conversation.kill'\n | 'conversation.cancel'\n | 'conversation.delete'\n | 'conversation.history';\n\nexport type ConversationMessage = {\n identity: string;\n turn: string;\n text: string;\n message: unknown;\n};\n\nexport type AcceptedMessage = ConversationMessage & { position: string };\n\nexport type ConversationHistoryRequest = {\n conversation: string;\n after?: string;\n};\n\nexport type ConversationHistoryPage = {\n messages: readonly AcceptedMessage[];\n next?: string;\n};\n\nexport type WorkingNote = { noteId: string; text: string };\n\nexport type ConversationEvent =\n | { kind: 'growing-text'; conversation: string; turn: string; text: string }\n | { kind: 'plan'; conversation: string; turn: string; plan: unknown }\n | { kind: 'working-note'; conversation: string; note: WorkingNote | null }\n | { kind: 'questions'; conversation: string; questions: readonly unknown[] }\n | { kind: 'process'; conversation: string; running: boolean }\n | { kind: 'commands'; conversation: string; commands: readonly unknown[] }\n | { kind: 'options'; conversation: string; options: readonly unknown[] }\n | { kind: 'accepted-message'; conversation: string; message: AcceptedMessage }\n | { kind: 'gap'; conversation: string };\n\nexport type ConversationStream = {\n replicate(conversations: readonly string[]): void;\n observe(notify: (event: ConversationEvent) => void): () => void;\n};\n\nexport type ActionDeclaration = {\n name: string;\n inputShape: unknown;\n resultKind: unknown;\n};\n\nexport type ProviderLimit = {\n name: string;\n value?: number | string;\n};\n\nexport type HistoryRetention =\n | { kind: 'duration'; seconds: number }\n | { kind: 'no-declared-time-bound' };\n\nexport type Retention = {\n history: HistoryRetention;\n outcome: number;\n refreshHorizon: number;\n};\n\nexport type Discovery = {\n kind: 'discovery';\n supportedVersions: readonly number[];\n mdModel: MdModelIdentity;\n rooms: readonly DiscoveredRoom[];\n slots?: readonly {\n slot: string;\n entries: readonly { locator: string; segment: string | null }[];\n }[];\n capabilities: readonly Capability[];\n providerLimits: readonly ProviderLimit[];\n retention: Retention;\n};\n\nexport type TransportUncertainty = { kind: 'transport-uncertainty' };\nexport type RoomNotReadable = { kind: 'room-not-readable'; locator: string };\nexport type RevokedAuthorization = { kind: 'revoked-authorization' };\n\nexport type ProviderRefusal = {\n code: string;\n fields: Readonly<Record<string, unknown>>;\n};\n\nexport type ScopedRefusal = ProviderRefusal & {\n kind: 'scoped-refusal';\n locator: string;\n scope: 'content' | 'sync' | 'model' | 'operation' | 'undisclosed';\n};\nexport type AdapterFailure =\n | TransportUncertainty\n | RoomNotReadable\n | RevokedAuthorization\n | ScopedRefusal;\n\nexport type ContractUnavailable = ProviderRefusal & { kind: 'contract-unavailable' };\n\nexport type DiscoverResult =\n | Discovery\n | TransportUncertainty\n | RevokedAuthorization\n | ContractUnavailable;\n\nexport type PageToken = string;\n\nexport type ChangeAuthor =\n | { kind: 'user'; id: string; name: string }\n | { kind: 'site'; id: string; name: string };\n\nexport type HeadChange = { author: ChangeAuthor | null; time: string };\n\nexport type BootstrapRequest = {\n locator: string;\n selection: string;\n pageToken?: PageToken;\n};\n\nexport type BootstrapPage = {\n kind: 'bootstrap';\n roomVersion: string;\n documents: Readonly<Record<string, string>>;\n revisions: Readonly<Record<string, string>>;\n changes: Readonly<Record<string, HeadChange>>;\n binaryTargets: readonly string[];\n pageToken?: PageToken;\n};\n\nexport type BootstrapResult = BootstrapPage | AdapterFailure;\n\nexport type RefreshRequest = {\n locator: string;\n selection: string;\n fromRoomVersion: string;\n pageToken?: PageToken;\n};\n\nexport type RefreshPage = {\n kind: 'net-advancement';\n roomVersion: string;\n documents: Readonly<Record<string, string>>;\n revisions: Readonly<Record<string, string>>;\n changes: Readonly<Record<string, HeadChange>>;\n binaryTargets: readonly string[];\n removals: readonly string[];\n pageToken?: PageToken;\n};\n\nexport type RefreshResult =\n | { kind: 'still-current' }\n | RefreshPage\n | { kind: 'beyond-horizon' }\n | AdapterFailure;\n\nexport type MutationRequest = {\n locator: string;\n changeBatch: ChangeBatch;\n upload?: unknown;\n};\n\nexport type RetryableRefusal = ProviderRefusal & {\n kind: 'retryable-refusal';\n reset?: string;\n};\n\nexport type ServiceMode = 'open' | 'write-halted';\n\nexport type ServiceModeSignal = {\n observe(notify: (mode: ServiceMode) => void): () => void;\n};\n\nexport type MutationResult =\n | {\n kind: 'accepted';\n roomVersion: string;\n documents: Readonly<Record<string, string>>;\n revisions: Readonly<Record<string, string>>;\n removals: readonly string[];\n author?: string;\n time?: string;\n }\n | (ProviderRefusal & {\n kind: 'conflicted';\n roomVersion?: string;\n affected: Readonly<Record<string, string>>;\n })\n | (ProviderRefusal & {\n kind: 'rejected';\n affected: Readonly<Record<string, string>>;\n })\n | RetryableRefusal\n | { kind: 'write-halted' }\n | { kind: 'expired' }\n | AdapterFailure;\n\nexport type HistoryAuthor =\n | { kind: 'user'; id: string }\n | { kind: 'site'; id: string; name: string };\n\nexport type HistoryRevision = {\n revision: string;\n author: HistoryAuthor;\n time: string;\n};\n\nexport type HistoryRequest = {\n locator: string;\n path: string;\n revision?: string;\n pageToken?: PageToken;\n};\n\nexport type HistoryResult =\n | {\n kind: 'history';\n revisions: readonly HistoryRevision[];\n pageToken?: PageToken;\n }\n | {\n kind: 'revision';\n content: string;\n }\n | { kind: 'no-history' }\n | AdapterFailure;\n\nexport type ActionRequest = {\n name: string;\n input: unknown;\n};\n\nexport type ActionResult =\n | { kind: 'action'; result: unknown }\n | (ProviderRefusal & { kind: 'rejected' })\n | AdapterFailure;\n\nexport type ModelRequest =\n | { locator: string; attached: 'collection'; collectionRoot: string; model: ModelIdentity | null }\n | {\n locator: string;\n attached: 'typed-selection';\n roots: readonly string[];\n model: ModelIdentity | null;\n };\n\nexport type RoomVersionNotification = {\n locator: string;\n roomVersion: string;\n modelChanged?: true;\n};\n\nexport type SelectedRooms = {\n select(locators: readonly string[]): void;\n observe(notify: (notification: RoomVersionNotification) => void): () => void;\n};\n\nexport type Adapter = {\n model(authorization: Authorization, request: ModelRequest): Promise<ModelResult>;\n authorize(): Promise<Authorization>;\n discover(authorization: Authorization): Promise<DiscoverResult>;\n bootstrap(authorization: Authorization, request: BootstrapRequest): Promise<BootstrapResult>;\n refresh(authorization: Authorization, request: RefreshRequest): Promise<RefreshResult>;\n mutate(\n authorization: Authorization,\n request: MutationRequest,\n keep: (upload: unknown) => Promise<void>,\n ): Promise<MutationResult>;\n history(authorization: Authorization, request: HistoryRequest): Promise<HistoryResult>;\n action(authorization: Authorization, request: ActionRequest): Promise<ActionResult>;\n roomVersions?: SelectedRooms;\n conversations?: ConversationStream;\n serviceMode?: ServiceModeSignal;\n};\n"],"names":["ROOM_CONTRACT_VERSION","VERSION_1_CAPABILITIES"],"mappings":"AAKA,OAAO,MAAMA,wBAAwB,EAAE;AAEvC,OAAO,MAAMC,yBAAyB;IACpC;IACA;IACA;IACA;IACA;IACA;CACD,CAAU"}
|
package/dist/bootstrap.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bootstrap.d.ts","sourceRoot":"","sources":["../src/bootstrap.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"bootstrap.d.ts","sourceRoot":"","sources":["../src/bootstrap.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,KAAK,EACV,OAAO,EACP,cAAc,EACd,aAAa,EACb,cAAc,EAEf,MAAM,cAAc,CAAC;AACtB,OAAO,EAAc,KAAK,MAAM,EAAE,MAAM,cAAc,CAAC;AAGvD,MAAM,MAAM,gBAAgB,GAAG,MAAM,GAAG,cAAc,CAAC;AAEvD,wBAAsB,aAAa,CACjC,OAAO,EAAE,OAAO,EAChB,aAAa,EAAE,aAAa,EAC5B,IAAI,EAAE,cAAc,EACpB,MAAM,EAAE;IAAE,UAAU,EAAE,UAAU,CAAC;IAAC,SAAS,EAAE,UAAU,CAAA;CAAE,EACzD,UAAU,EAAE,MAAM,OAAO,GACxB,OAAO,CAAC,gBAAgB,CAAC,CA4C3B"}
|
package/dist/bootstrap.js
CHANGED
|
@@ -13,6 +13,9 @@ export async function bootstrapRoom(adapter, authorization, room, models, contin
|
|
|
13
13
|
const revisions = {
|
|
14
14
|
...first.revisions
|
|
15
15
|
};
|
|
16
|
+
const changes = {
|
|
17
|
+
...first.changes
|
|
18
|
+
};
|
|
16
19
|
const binaryTargets = new Set(first.binaryTargets);
|
|
17
20
|
let pageToken = first.pageToken;
|
|
18
21
|
while(pageToken !== undefined){
|
|
@@ -26,6 +29,7 @@ export async function bootstrapRoom(adapter, authorization, room, models, contin
|
|
|
26
29
|
if (page.roomVersion !== roomVersion) return unconfirmed;
|
|
27
30
|
Object.assign(documents, page.documents);
|
|
28
31
|
Object.assign(revisions, page.revisions);
|
|
32
|
+
Object.assign(changes, page.changes);
|
|
29
33
|
for (const target of page.binaryTargets)binaryTargets.add(target);
|
|
30
34
|
pageToken = page.pageToken;
|
|
31
35
|
}
|
|
@@ -45,7 +49,8 @@ export async function bootstrapRoom(adapter, authorization, room, models, contin
|
|
|
45
49
|
binaryTargets: [
|
|
46
50
|
...binaryTargets
|
|
47
51
|
].sort(),
|
|
48
|
-
revisions
|
|
52
|
+
revisions,
|
|
53
|
+
changes
|
|
49
54
|
});
|
|
50
55
|
}
|
|
51
56
|
|
package/dist/bootstrap.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/workspace/packages/mdruntime/src/bootstrap.ts"],"sourcesContent":["import type { ModelState } from './model.js';\nimport type {
|
|
1
|
+
{"version":3,"sources":["/workspace/packages/mdruntime/src/bootstrap.ts"],"sourcesContent":["import type { ModelState } from './model.js';\nimport type {\n Adapter,\n AdapterFailure,\n Authorization,\n DiscoveredRoom,\n HeadChange,\n} from './adapter.js';\nimport { readStaged, type Staged } from './replica.js';\nimport { unconfirmed } from './transfer.js';\n\nexport type BootstrapOutcome = Staged | AdapterFailure;\n\nexport async function bootstrapRoom(\n adapter: Adapter,\n authorization: Authorization,\n room: DiscoveredRoom,\n models: { collection: ModelState; selection: ModelState },\n continuing: () => boolean,\n): Promise<BootstrapOutcome> {\n const first = await adapter.bootstrap(authorization, {\n locator: room.locator,\n selection: room.replica.selection,\n });\n if (first.kind !== 'bootstrap') return first;\n const roomVersion = first.roomVersion;\n const documents: Record<string, string> = { ...first.documents };\n const revisions: Record<string, string> = { ...first.revisions };\n const changes: Record<string, HeadChange> = { ...first.changes };\n const binaryTargets = new Set(first.binaryTargets);\n let pageToken = first.pageToken;\n while (pageToken !== undefined) {\n if (!continuing()) return unconfirmed;\n const page = await adapter.bootstrap(authorization, {\n locator: room.locator,\n selection: room.replica.selection,\n pageToken,\n });\n if (page.kind !== 'bootstrap') return page;\n if (page.roomVersion !== roomVersion) return unconfirmed;\n Object.assign(documents, page.documents);\n Object.assign(revisions, page.revisions);\n Object.assign(changes, page.changes);\n for (const target of page.binaryTargets) binaryTargets.add(target);\n pageToken = page.pageToken;\n }\n return readStaged({\n locator: room.locator,\n collectionRoot: room.collectionRoot,\n name: room.name,\n operations: room.operations,\n replica: room.replica,\n attachedModel: room.attachedModel,\n model: models.collection,\n typedSelection: room.typedSelection ?? null,\n selectionModel: models.selection,\n providerOwnedPaths: room.providerOwnedPaths,\n roomVersion,\n documents,\n binaryTargets: [...binaryTargets].sort(),\n revisions,\n changes,\n });\n}\n"],"names":["readStaged","unconfirmed","bootstrapRoom","adapter","authorization","room","models","continuing","first","bootstrap","locator","selection","replica","kind","roomVersion","documents","revisions","changes","binaryTargets","Set","pageToken","undefined","page","Object","assign","target","add","collectionRoot","name","operations","attachedModel","model","collection","typedSelection","selectionModel","providerOwnedPaths","sort"],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nCC,MAAMvB,KAAKuB,IAAI;QACfC,YAAYxB,KAAKwB,UAAU;QAC3BjB,SAASP,KAAKO,OAAO;QACrBkB,eAAezB,KAAKyB,aAAa;QACjCC,OAAOzB,OAAO0B,UAAU;QACxBC,gBAAgB5B,KAAK4B,cAAc,IAAI;QACvCC,gBAAgB5B,OAAOK,SAAS;QAChCwB,oBAAoB9B,KAAK8B,kBAAkB;QAC3CrB;QACAC;QACAG,eAAe;eAAIA;SAAc,CAACkB,IAAI;QACtCpB;QACAC;IACF;AACF"}
|
package/dist/change-set.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"change-set.d.ts","sourceRoot":"","sources":["../src/change-set.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"change-set.d.ts","sourceRoot":"","sources":["../src/change-set.ts"],"names":[],"mappings":"AAEA,OAAO,EAAiB,KAAK,OAAO,EAAE,MAAM,cAAc,CAAC;AAC3D,OAAO,EAAU,KAAK,GAAG,EAAE,MAAM,WAAW,CAAC;AAE7C,MAAM,MAAM,cAAc,GAAG;IAC3B,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,SAAS,GAAG,EAAE,CAAC;IACvB,KAAK,EAAE,SAAS,GAAG,EAAE,CAAC;CACvB,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG;IAAE,YAAY,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,CAAC;AAEvE,MAAM,MAAM,SAAS,GAAG;IACtB,SAAS,EAAE,SAAS,cAAc,EAAE,CAAC;IACrC,MAAM,EAAE,SAAS;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IACrD,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;IACzB,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC;IAC1B,aAAa,EAAE,SAAS,MAAM,EAAE,CAAC;IACjC,QAAQ,EAAE,SAAS,aAAa,EAAE,CAAC;IACnC,aAAa,EAAE,SAAS,MAAM,EAAE,CAAC;CAClC,CAAC;AAmBF,wBAAgB,SAAS,CACvB,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,OAAO,GAAG,IAAI,EACtB,KAAK,EAAE,OAAO,GAAG,IAAI,EACrB,OAAO,GAAE;IACP,MAAM,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC3B,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,YAAY,CAAC,EAAE,MAAM,CAAC;CAClB,GACL,SAAS,CAiDX;AAED,wBAAgB,qBAAqB,CACnC,QAAQ,EAAE,SAAS,aAAa,EAAE,EAClC,aAAa,EAAE,SAAS,MAAM,EAAE,GAC/B,SAAS,CAUX;AAED,wBAAgB,eAAe,CAAC,IAAI,EAAE,SAAS,SAAS,EAAE,GAAG,SAAS,CAUrE"}
|
package/dist/change-set.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { sameChange } from './overlay.js';
|
|
1
2
|
import { beneath } from './paths.js';
|
|
2
3
|
import { compositionOf } from './replica.js';
|
|
3
4
|
import { rowsOf } from './rows.js';
|
|
@@ -5,7 +6,7 @@ function rowsAt(locator, replica, path) {
|
|
|
5
6
|
const document = replica?.visible.collection.documents[path];
|
|
6
7
|
if (replica === null) return [];
|
|
7
8
|
if (document === undefined && !replica.visible.binaryTargets.includes(path)) return [];
|
|
8
|
-
return rowsOf(locator, path, document ?? null, compositionOf(replica.confirmed.record));
|
|
9
|
+
return rowsOf(locator, path, document ?? null, compositionOf(replica.confirmed.record), replica.visible.changes[path] ?? null);
|
|
9
10
|
}
|
|
10
11
|
function modelShape(model) {
|
|
11
12
|
return model.status === 'unavailable' ? 'unavailable' : JSON.stringify(model.types);
|
|
@@ -26,7 +27,7 @@ export function changeSet(locator, before, after, changed = {}) {
|
|
|
26
27
|
const selected = newRoom?.typedSelection?.roots.some((root)=>beneath(root, path)) ?? false;
|
|
27
28
|
const inCollection = newRoom !== undefined && (newRoom.collectionRoot === '' || beneath(newRoom.collectionRoot, path));
|
|
28
29
|
const retyped = selected ? selectionChanged : inCollection && collectionChanged;
|
|
29
|
-
if (before?.visible.documents[path] === after?.visible.documents[path] && before?.visible.binaryTargets.includes(path) === after?.visible.binaryTargets.includes(path) && before?.visible.revisions[path] === after?.visible.revisions[path] && !retyped) continue;
|
|
30
|
+
if (before?.visible.documents[path] === after?.visible.documents[path] && before?.visible.binaryTargets.includes(path) === after?.visible.binaryTargets.includes(path) && before?.visible.revisions[path] === after?.visible.revisions[path] && sameChange(before?.visible.changes[path], after?.visible.changes[path]) && !retyped) continue;
|
|
30
31
|
documents.push({
|
|
31
32
|
locator,
|
|
32
33
|
path,
|
package/dist/change-set.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/workspace/packages/mdruntime/src/change-set.ts"],"sourcesContent":["import { beneath } from './paths.js';\nimport { compositionOf, type Replica } from './replica.js';\nimport { rowsOf, type Row } from './rows.js';\n\nexport type DocumentChange = {\n locator: string;\n path: string;\n before: readonly Row[];\n after: readonly Row[];\n};\n\nexport type MessageChange = { conversation: string; identity: string };\n\nexport type ChangeSet = {\n documents: readonly DocumentChange[];\n drafts: readonly { locator: string; path: string }[];\n rooms: readonly string[];\n queues: readonly string[];\n presentations: readonly string[];\n messages: readonly MessageChange[];\n conversations: readonly string[];\n};\n\nfunction rowsAt(locator: string, replica: Replica | null, path: string): readonly Row[] {\n const document = replica?.visible.collection.documents[path];\n if (replica === null) return [];\n if (document === undefined && !replica.visible.binaryTargets.includes(path)) return [];\n return rowsOf(locator
|
|
1
|
+
{"version":3,"sources":["/workspace/packages/mdruntime/src/change-set.ts"],"sourcesContent":["import { sameChange } from './overlay.js';\nimport { beneath } from './paths.js';\nimport { compositionOf, type Replica } from './replica.js';\nimport { rowsOf, type Row } from './rows.js';\n\nexport type DocumentChange = {\n locator: string;\n path: string;\n before: readonly Row[];\n after: readonly Row[];\n};\n\nexport type MessageChange = { conversation: string; identity: string };\n\nexport type ChangeSet = {\n documents: readonly DocumentChange[];\n drafts: readonly { locator: string; path: string }[];\n rooms: readonly string[];\n queues: readonly string[];\n presentations: readonly string[];\n messages: readonly MessageChange[];\n conversations: readonly string[];\n};\n\nfunction rowsAt(locator: string, replica: Replica | null, path: string): readonly Row[] {\n const document = replica?.visible.collection.documents[path];\n if (replica === null) return [];\n if (document === undefined && !replica.visible.binaryTargets.includes(path)) return [];\n return rowsOf(\n locator,\n path,\n document ?? null,\n compositionOf(replica.confirmed.record),\n replica.visible.changes[path] ?? null,\n );\n}\n\nfunction modelShape(model: Replica['confirmed']['record']['model']): string {\n return model.status === 'unavailable' ? 'unavailable' : JSON.stringify(model.types);\n}\n\nexport function changeSet(\n locator: string,\n before: Replica | null,\n after: Replica | null,\n changed: {\n drafts?: readonly string[];\n room?: boolean;\n queue?: boolean;\n presentation?: string;\n } = {},\n): ChangeSet {\n const paths = new Set([\n ...Object.keys(before?.visible.documents ?? {}),\n ...Object.keys(after?.visible.documents ?? {}),\n ...(before?.visible.binaryTargets ?? []),\n ...(after?.visible.binaryTargets ?? []),\n ]);\n const documents: DocumentChange[] = [];\n const oldRoom = before?.confirmed.record;\n const newRoom = after?.confirmed.record;\n const collectionChanged =\n oldRoom !== undefined &&\n newRoom !== undefined &&\n modelShape(oldRoom.model) !== modelShape(newRoom.model);\n const selectionChanged =\n oldRoom !== undefined &&\n newRoom !== undefined &&\n modelShape(oldRoom.selectionModel) !== modelShape(newRoom.selectionModel);\n for (const path of paths) {\n const selected = newRoom?.typedSelection?.roots.some((root) => beneath(root, path)) ?? false;\n const inCollection =\n newRoom !== undefined &&\n (newRoom.collectionRoot === '' || beneath(newRoom.collectionRoot, path));\n const retyped = selected ? selectionChanged : inCollection && collectionChanged;\n if (\n before?.visible.documents[path] === after?.visible.documents[path] &&\n before?.visible.binaryTargets.includes(path) ===\n after?.visible.binaryTargets.includes(path) &&\n before?.visible.revisions[path] === after?.visible.revisions[path] &&\n sameChange(before?.visible.changes[path], after?.visible.changes[path]) &&\n !retyped\n )\n continue;\n documents.push({\n locator,\n path,\n before: rowsAt(locator, before, path),\n after: rowsAt(locator, after, path),\n });\n }\n return {\n documents,\n drafts: (changed.drafts ?? []).map((path) => ({ locator, path })),\n rooms: changed.room ? [locator] : [],\n queues: changed.queue ? [locator] : [],\n presentations: changed.presentation === undefined ? [] : [changed.presentation],\n messages: [],\n conversations: [],\n };\n}\n\nexport function conversationChangeSet(\n messages: readonly MessageChange[],\n conversations: readonly string[],\n): ChangeSet {\n return {\n documents: [],\n drafts: [],\n rooms: [],\n queues: [],\n presentations: [],\n messages,\n conversations: [...new Set(conversations)],\n };\n}\n\nexport function mergeChangeSets(sets: readonly ChangeSet[]): ChangeSet {\n return {\n documents: sets.flatMap((set) => set.documents),\n drafts: sets.flatMap((set) => set.drafts),\n rooms: [...new Set(sets.flatMap((set) => set.rooms))],\n queues: [...new Set(sets.flatMap((set) => set.queues))],\n presentations: [...new Set(sets.flatMap((set) => set.presentations))],\n messages: sets.flatMap((set) => set.messages),\n conversations: [...new Set(sets.flatMap((set) => set.conversations))],\n };\n}\n"],"names":["sameChange","beneath","compositionOf","rowsOf","rowsAt","locator","replica","path","document","visible","collection","documents","undefined","binaryTargets","includes","confirmed","record","changes","modelShape","model","status","JSON","stringify","types","changeSet","before","after","changed","paths","Set","Object","keys","oldRoom","newRoom","collectionChanged","selectionChanged","selectionModel","selected","typedSelection","roots","some","root","inCollection","collectionRoot","retyped","revisions","push","drafts","map","rooms","room","queues","queue","presentations","presentation","messages","conversations","conversationChangeSet","mergeChangeSets","sets","flatMap","set"],"mappings":"AAAA,SAASA,UAAU,QAAQ,eAAe;AAC1C,SAASC,OAAO,QAAQ,aAAa;AACrC,SAASC,aAAa,QAAsB,eAAe;AAC3D,SAASC,MAAM,QAAkB,YAAY;AAqB7C,SAASC,OAAOC,OAAe,EA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;IAC5C;AACF;AAEA,OAAO,SAASE,gBAAgBC,IAA0B;IACxD,OAAO;QACLhD,WAAWgD,KAAKC,OAAO,CAAC,CAACC,MAAQA,IAAIlD,SAAS;QAC9CoC,QAAQY,KAAKC,OAAO,CAAC,CAACC,MAAQA,IAAId,MAAM;QACxCE,OAAO;eAAI,IAAIpB,IAAI8B,KAAKC,OAAO,CAAC,CAACC,MAAQA,IAAIZ,KAAK;SAAG;QACrDE,QAAQ;eAAI,IAAItB,IAAI8B,KAAKC,OAAO,CAAC,CAACC,MAAQA,IAAIV,MAAM;SAAG;QACvDE,eAAe;eAAI,IAAIxB,IAAI8B,KAAKC,OAAO,CAAC,CAACC,MAAQA,IAAIR,aAAa;SAAG;QACrEE,UAAUI,KAAKC,OAAO,CAAC,CAACC,MAAQA,IAAIN,QAAQ;QAC5CC,eAAe;eAAI,IAAI3B,IAAI8B,KAAKC,OAAO,CAAC,CAACC,MAAQA,IAAIL,aAAa;SAAG;IACvE;AACF"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type { AcceptedMessage, ActionDeclaration, ActionRequest, ActionResult, Adapter, AdapterFailure, Authorization, BootstrapPage, BootstrapRequest, BootstrapResult, Capability, ContractUnavailable, ConversationAction, ConversationCards, ConversationEvent, 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, 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, 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, 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,mBAAmB,EACnB,kBAAkB,EAClB,iBAAiB,EACjB,iBAAiB,EACjB,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,aAAa,EACb,SAAS,EACT,gBAAgB,EAChB,oBAAoB,EACpB,eAAe,EACf,uBAAuB,EACvB,aAAa,EAC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,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,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,aAAa,EACb,SAAS,EACT,gBAAgB,EAChB,oBAAoB,EACpB,eAAe,EACf,uBAAuB,EACvB,aAAa,EACb,WAAW,EACX,iBAAiB,EACjB,oBAAoB,EACpB,cAAc,EACd,WAAW,GACZ,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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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 ContractUnavailable,\n ConversationAction,\n ConversationCards,\n ConversationEvent,\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 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 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 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":"AAwGA,SAASA,mBAAmB,QAAQ,gBAAgB;AACpD,SAASC,eAAe,QAAQ,kBAAkB"}
|
package/dist/memory.d.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
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 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 RoomVersionNotification, 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
|
+
changes?: Readonly<Record<string, HeadChange>>;
|
|
8
9
|
binaryTargets?: readonly string[];
|
|
9
10
|
};
|
|
10
11
|
export type MemoryConversation = {
|
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,EAGtB,KAAK,cAAc,
|
|
1
|
+
{"version":3,"file":"memory.d.ts","sourceRoot":"","sources":["../src/memory.ts"],"names":[],"mappings":"AA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AC1B,iBAAiB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACtC,YAAY,CAAC,EAAE,SAAS,UAAU,EAAE,CAAC;IACrC,cAAc,CAAC,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,CA0VrF"}
|
package/dist/memory.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ROOM_CONTRACT_VERSION } from './adapter.js';
|
|
2
2
|
import { MD_MODEL } from './collection.js';
|
|
3
|
+
import { sameChange } from './overlay.js';
|
|
3
4
|
const FIXTURE_RETENTION = {
|
|
4
5
|
history: {
|
|
5
6
|
kind: 'duration',
|
|
@@ -86,12 +87,17 @@ export function createMemoryAdapter(options = {}) {
|
|
|
86
87
|
const size = pageSize ?? paths.length;
|
|
87
88
|
const taken = paths.slice(from, from + size);
|
|
88
89
|
const next = from + taken.length;
|
|
90
|
+
const targets = from === 0 ? room.binaryTargets ?? [] : [];
|
|
89
91
|
return {
|
|
90
92
|
kind: 'bootstrap',
|
|
91
93
|
roomVersion: room.roomVersion,
|
|
92
94
|
documents: named(room.documents ?? {}, taken),
|
|
93
95
|
revisions: named(room.revisions ?? {}, taken),
|
|
94
|
-
|
|
96
|
+
changes: named(room.changes ?? {}, [
|
|
97
|
+
...taken,
|
|
98
|
+
...targets
|
|
99
|
+
]),
|
|
100
|
+
binaryTargets: targets,
|
|
95
101
|
...next < paths.length ? {
|
|
96
102
|
pageToken: String(next)
|
|
97
103
|
} : {}
|
|
@@ -102,7 +108,8 @@ export function createMemoryAdapter(options = {}) {
|
|
|
102
108
|
const previous = from.documents ?? {};
|
|
103
109
|
const currentTargets = new Set(room.binaryTargets ?? []);
|
|
104
110
|
const previousTargets = new Set(from.binaryTargets ?? []);
|
|
105
|
-
const
|
|
111
|
+
const headMoved = (path)=>room.revisions?.[path] !== from.revisions?.[path] || !sameChange(room.changes?.[path], from.changes?.[path]);
|
|
112
|
+
const changed = Object.keys(current).filter((path)=>current[path] !== previous[path] || headMoved(path)).sort();
|
|
106
113
|
const size = pageSize ?? changed.length;
|
|
107
114
|
const taken = changed.slice(at, at + size);
|
|
108
115
|
const next = at + taken.length;
|
|
@@ -113,14 +120,19 @@ export function createMemoryAdapter(options = {}) {
|
|
|
113
120
|
from,
|
|
114
121
|
at: next
|
|
115
122
|
});
|
|
123
|
+
const targets = opening ? [
|
|
124
|
+
...currentTargets
|
|
125
|
+
].filter((target)=>!previousTargets.has(target) || headMoved(target)) : [];
|
|
116
126
|
return {
|
|
117
127
|
kind: 'net-advancement',
|
|
118
128
|
roomVersion: room.roomVersion,
|
|
119
129
|
documents: named(current, taken),
|
|
120
130
|
revisions: named(room.revisions ?? {}, taken),
|
|
121
|
-
|
|
122
|
-
...
|
|
123
|
-
|
|
131
|
+
changes: named(room.changes ?? {}, [
|
|
132
|
+
...taken,
|
|
133
|
+
...targets
|
|
134
|
+
]),
|
|
135
|
+
binaryTargets: targets,
|
|
124
136
|
removals: opening ? [
|
|
125
137
|
...Object.keys(previous).filter((path)=>!(path in current) && !currentTargets.has(path)),
|
|
126
138
|
...[
|
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 ConversationHistoryPage,\n type DiscoverResult,\n type DiscoveredRoom,\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';\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 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(\n source: Readonly<Record<string, string>>,\n paths: readonly string[],\n): Readonly<Record<string, string>> {\n const taken: Record<string, string> = {};\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 function retain(entries: readonly MemoryRoom[]) {\n for (const room of entries) {\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 collectionRoot: room.collectionRoot,\n roomVersion: room.roomVersion,\n operations: room.operations,\n replica: room.replica,\n attachedModel: room.attachedModel,\n ...(room.typedSelection === undefined ? {} : { typedSelection: room.typedSelection }),\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 return {\n kind: 'bootstrap',\n roomVersion: room.roomVersion,\n documents: named(room.documents ?? {}, taken),\n revisions: named(room.revisions ?? {}, taken),\n binaryTargets: from === 0 ? (room.binaryTargets ?? []) : [],\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 changed = Object.keys(current)\n .filter((path) => current[path] !== previous[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 return {\n kind: 'net-advancement',\n roomVersion: room.roomVersion,\n documents: named(current, taken),\n revisions: named(room.revisions ?? {}, taken),\n binaryTargets: opening\n ? [...currentTargets].filter((target) => !previousTargets.has(target))\n : [],\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 historyOf(conversation: MemoryConversation, after: unknown): ActionResult {\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 const result: ConversationHistoryPage = {\n messages: page,\n ...(last !== undefined && from + page.length < messages.length\n ? { next: last.position }\n : {}),\n };\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 after?: unknown;\n };\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.history') return historyOf(conversation, input.after);\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 );\n },\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 );\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 (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 );\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 );\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 );\n },\n };\n}\n"],"names":["ROOM_CONTRACT_VERSION","MD_MODEL","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","retain","room","versions","get","locator","roomVersion","declared","name","collectionRoot","operations","replica","attachedModel","typedSelection","providerOwnedPaths","page","from","Object","keys","documents","sort","size","length","slice","next","revisions","binaryTargets","pageToken","String","advancement","at","current","previous","currentTargets","previousTargets","changed","filter","opening","target","has","removals","historyOf","after","messages","first","findIndex","message","position","last","result","conversationAction","input","code","fields","outcomes","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","bootstrap","refresh","continuation","fromRoomVersion","mutate","affected","action","startsWith"],"mappings":"AACA,SACEA,qBAAqB,QAyBhB,eAAe;AACtB,SAASC,QAAQ,QAAQ,kBAAkB;AAE3C,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;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oBACLtD,MAAM;oBACN0E,WAAW,EAAE;gBACf;YACF,GACAvD;QAEJ;QACA,MAAM8H,QAAOb,cAA6B,EAAEjH,OAAsB;YAChE,OAAOH,cACLY,QAAQqH,MAAM,EACd;gBACE,IAAI9H,QAAQsC,IAAI,CAACyF,UAAU,CAAC,kBAAkB,OAAO/C,mBAAmBhF;gBACxE,OAAO;oBAAEnB,MAAM;oBAAYqG,MAAM;oBAAqBC,QAAQ,CAAC;gBAAE;YACnE,GACAnF;QAEJ;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 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 function retain(entries: readonly MemoryRoom[]) {\n for (const room of entries) {\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 collectionRoot: room.collectionRoot,\n roomVersion: room.roomVersion,\n operations: room.operations,\n replica: room.replica,\n attachedModel: room.attachedModel,\n ...(room.typedSelection === undefined ? {} : { typedSelection: room.typedSelection }),\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 historyOf(conversation: MemoryConversation, after: unknown): ActionResult {\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 const result: ConversationHistoryPage = {\n messages: page,\n ...(last !== undefined && from + page.length < messages.length\n ? { next: last.position }\n : {}),\n };\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 after?: unknown;\n };\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.history') return historyOf(conversation, input.after);\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 );\n },\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 );\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 (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 );\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 );\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 );\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","retain","room","versions","get","locator","roomVersion","declared","name","collectionRoot","operations","replica","attachedModel","typedSelection","providerOwnedPaths","page","from","Object","keys","documents","sort","size","length","slice","next","targets","binaryTargets","revisions","changes","pageToken","String","advancement","at","current","previous","currentTargets","previousTargets","headMoved","changed","filter","opening","target","has","removals","historyOf","after","messages","first","findIndex","message","position","last","result","conversationAction","input","code","fields","outcomes","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","bootstrap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AYwG,MAAM;oBAAqBC,QAAQ,CAAC;gBAAE;YACnE,GACAtF;QAEJ;IACF;AACF"}
|
package/dist/overlay.d.ts
CHANGED
|
@@ -1,9 +1,14 @@
|
|
|
1
|
+
import type { HeadChange } from './adapter.js';
|
|
1
2
|
import type { ChangeBatch } from './change.js';
|
|
2
|
-
export type
|
|
3
|
+
export type Heads = {
|
|
4
|
+
revisions: Readonly<Record<string, string>>;
|
|
5
|
+
changes: Readonly<Record<string, HeadChange>>;
|
|
6
|
+
};
|
|
7
|
+
export type Layer = Heads & {
|
|
3
8
|
documents: Readonly<Record<string, string>>;
|
|
4
9
|
binaryTargets: readonly string[];
|
|
5
|
-
revisions: Readonly<Record<string, string>>;
|
|
6
10
|
};
|
|
11
|
+
export declare function sameChange(left: HeadChange | undefined, right: HeadChange | undefined): boolean;
|
|
7
12
|
export declare function overlay(base: Layer, queue: readonly ChangeBatch[]): Layer;
|
|
8
13
|
export declare function sameLayerText(left: Layer, right: Layer): boolean;
|
|
9
14
|
export declare function overlayChanged(base: Layer, queue: readonly ChangeBatch[], previousBase: Layer, previousQueue: readonly ChangeBatch[], previousVisible: Layer): Layer;
|
package/dist/overlay.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"overlay.d.ts","sourceRoot":"","sources":["../src/overlay.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAU,WAAW,EAAgB,MAAM,aAAa,CAAC;AAErE,MAAM,MAAM,KAAK,GAAG;IAClB,SAAS,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IAC5C,
|
|
1
|
+
{"version":3,"file":"overlay.d.ts","sourceRoot":"","sources":["../src/overlay.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,KAAK,EAAU,WAAW,EAAgB,MAAM,aAAa,CAAC;AAErE,MAAM,MAAM,KAAK,GAAG;IACl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