@agentshouse/mdruntime 0.1.0-alpha.13 → 0.1.0-alpha.15
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 +2 -1
- package/dist/adapter.d.ts +1 -1
- package/dist/adapter.d.ts.map +1 -1
- package/dist/adapter.js +2 -1
- package/dist/adapter.js.map +1 -1
- package/dist/connection.d.ts.map +1 -1
- package/dist/connection.js +74 -23
- package/dist/connection.js.map +1 -1
- package/dist/replica.d.ts +2 -1
- package/dist/replica.d.ts.map +1 -1
- package/dist/replica.js +23 -2
- package/dist/replica.js.map +1 -1
- package/dist/save.d.ts +3 -0
- package/dist/save.d.ts.map +1 -1
- package/dist/save.js +26 -5
- package/dist/save.js.map +1 -1
- package/dist/store.d.ts +3 -1
- package/dist/store.d.ts.map +1 -1
- package/dist/store.js +27 -1
- package/dist/store.js.map +1 -1
- package/package.json +1 -1
package/AGENTS.md
CHANGED
|
@@ -22,7 +22,8 @@ ships in no bundle.
|
|
|
22
22
|
|
|
23
23
|
## Draft, Save, and outcome rules
|
|
24
24
|
|
|
25
|
-
A Draft is durable: it survives reload and navigation.
|
|
25
|
+
A Draft is durable: it survives reload and navigation. A Room that Discovery
|
|
26
|
+
stops listing takes its Drafts, its queue and their outcomes with it. Save takes structured
|
|
26
27
|
changes, validates locally, and on success appends one Change Batch to that
|
|
27
28
|
Room's queue. A local validation failure leaves the Draft and creates
|
|
28
29
|
nothing.
|
package/dist/adapter.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import type { ModelIdentity, ModelResult } from './model.js';
|
|
|
2
2
|
import type { ChangeBatch } from './change.js';
|
|
3
3
|
export type Authorization = object;
|
|
4
4
|
export declare const ROOM_CONTRACT_VERSION = 1;
|
|
5
|
-
export declare const VERSION_1_CAPABILITIES: readonly ['stable-file-ids', 'ranked-provider-search', 'room-version-notifications', 'room-history', 'provider-actions'];
|
|
5
|
+
export declare const VERSION_1_CAPABILITIES: readonly ['stable-file-ids', 'ranked-provider-search', 'room-version-notifications', 'room-history', 'provider-actions', 'move-reference-rewrites'];
|
|
6
6
|
export type MdModelIdentity = {
|
|
7
7
|
identity: string;
|
|
8
8
|
version: string;
|
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,
|
|
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,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG;IAC3B,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;IACzB,aAAa,EAAE,aAAa,GAAG,IAAI,CAAC;CACrC,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IA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AO,GAAG;IACpB,KAAK,CAAC,aAAa,EAAE,aAAa,EAAE,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;IACjF,SAAS,IAAI,OAAO,CAAC,aAAa,CAAC,CAAC;IACpC,QAAQ,CAAC,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,CAAC,aAAa,EAAE,aAAa,EAAE,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;IACxF,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,mBAAmB,CAAC;CACrC,CAAC"}
|
package/dist/adapter.js
CHANGED
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] 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 turn: string;\n message: unknown;\n};\n\nexport type ConversationEvent =\n | { kind: 'growing-text'; conversation: string; turn: string; text: string }\n | { kind: 'accepted-message'; conversation: string; message: ConversationMessage }\n | { kind: 'session-summary'; conversation: string; summary: unknown };\n\nexport type ViewedConversations = {\n view(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 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};\n\nexport type RetryableRefusal = ProviderRefusal & {\n kind: 'retryable-refusal';\n reset?: string;\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: 'expired' }\n | AdapterFailure;\n\nexport type HistoryRevision = {\n revision: string;\n author: string;\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};\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(authorization: Authorization, request: MutationRequest): Promise<MutationResult>;\n history(authorization: Authorization, request: HistoryRequest): Promise<HistoryResult>;\n action(authorization: Authorization, request: ActionRequest): Promise<ActionResult>;\n roomVersions?: SelectedRooms;\n conversations?: ViewedConversations;\n};\n"],"names":["ROOM_CONTRACT_VERSION","VERSION_1_CAPABILITIES"],"mappings":"AAKA,OAAO,MAAMA,wBAAwB,EAAE;AAEvC,OAAO,MAAMC,yBAAyB;IACpC;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 turn: string;\n message: unknown;\n};\n\nexport type ConversationEvent =\n | { kind: 'growing-text'; conversation: string; turn: string; text: string }\n | { kind: 'accepted-message'; conversation: string; message: ConversationMessage }\n | { kind: 'session-summary'; conversation: string; summary: unknown };\n\nexport type ViewedConversations = {\n view(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 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};\n\nexport type RetryableRefusal = ProviderRefusal & {\n kind: 'retryable-refusal';\n reset?: string;\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: 'expired' }\n | AdapterFailure;\n\nexport type HistoryRevision = {\n revision: string;\n author: string;\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};\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(authorization: Authorization, request: MutationRequest): Promise<MutationResult>;\n history(authorization: Authorization, request: HistoryRequest): Promise<HistoryResult>;\n action(authorization: Authorization, request: ActionRequest): Promise<ActionResult>;\n roomVersions?: SelectedRooms;\n conversations?: ViewedConversations;\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/connection.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connection.d.ts","sourceRoot":"","sources":["../src/connection.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,KAAK,YAAY,EAAmB,MAAM,YAAY,CAAC;AAC1E,OAAO,EAKL,KAAK,oBAAoB,EAEzB,KAAK,WAAW,EACjB,MAAM,YAAY,CAAC;AACpB,OAAO,EAEL,KAAK,YAAY,EACjB,KAAK,WAAW,EAEjB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAIL,KAAK,OAAO,EAEZ,KAAK,aAAa,EAGlB,KAAK,aAAa,EAKlB,KAAK,eAAe,EAErB,MAAM,cAAc,CAAC;AAEtB,OAAO,EAGL,KAAK,mBAAmB,EACxB,KAAK,gBAAgB,EACtB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EAAE,MAAM,EAAe,MAAM,aAAa,CAAC;AAGvD,OAAO,EAKL,KAAK,UAAU,EACf,KAAK,UAAU,EAEf,KAAK,iBAAiB,EACvB,MAAM,cAAc,CAAC;AAEtB,OAAO,
|
|
1
|
+
{"version":3,"file":"connection.d.ts","sourceRoot":"","sources":["../src/connection.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,KAAK,YAAY,EAAmB,MAAM,YAAY,CAAC;AAC1E,OAAO,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AAM,IAAI,CAAC;QACd,CAAC,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,CAAC,MAAM,EAAE,SAAS,UAAU,EAAE,KAAK,IAAI,GAAG,MAAM,IAAI,CAAC;QACjF,CAAC,KAAK,EAAE,cAAc,EAAE,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,GAAG,MAAM,IAAI,CAAC;QACrF,CACE,KAAK,EAAE,cAAc,EACrB,YAAY,EAAE,MAAM,EACpB,QAAQ,EAAE,CAAC,IAAI,EAAE,gBAAgB,KAAK,IAAI,GACzC,MAAM,IAAI,CAAC;KACf,CAAC;IACF,WAAW,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CAC9B,CAAC;AAyBF,wBAAgB,eAAe,CAAC,OAAO,EAAE,gBAAgB,GAAG,SAAS,CAoyDpE"}
|
package/dist/connection.js
CHANGED
|
@@ -40,8 +40,13 @@ export function createMdRuntime(options) {
|
|
|
40
40
|
const drafts = new Map();
|
|
41
41
|
const presentations = new Map();
|
|
42
42
|
const outcomes = new Map();
|
|
43
|
+
const acceptedIn = new Map();
|
|
43
44
|
let limits = [];
|
|
44
45
|
let capabilities = [];
|
|
46
|
+
let capabilityNames = [];
|
|
47
|
+
function rewriting() {
|
|
48
|
+
return capabilityNames.includes('move-reference-rewrites') ? 'provider' : 'runtime';
|
|
49
|
+
}
|
|
45
50
|
const rooms = new Map();
|
|
46
51
|
const unreadable = new Set();
|
|
47
52
|
const models = new Map();
|
|
@@ -371,11 +376,12 @@ export function createMdRuntime(options) {
|
|
|
371
376
|
refusal: scopedRefusals.get(room.locator) ?? null
|
|
372
377
|
});
|
|
373
378
|
}
|
|
374
|
-
function applyDiscovery(listed) {
|
|
379
|
+
async function applyDiscovery(listed, local) {
|
|
375
380
|
const listedLocators = new Set(listed.map((room)=>room.locator));
|
|
376
381
|
for (const locator of listedLocators)scopedRefusals.delete(locator);
|
|
377
382
|
discovered.clear();
|
|
378
383
|
for (const room of listed)discovered.set(room.locator, room);
|
|
384
|
+
await dropUnlisted(listedLocators, local);
|
|
379
385
|
for (const room of listed){
|
|
380
386
|
const held = replicas.get(room.locator)?.confirmed.record;
|
|
381
387
|
if (held !== undefined && held.replica.selection !== room.replica.selection) {
|
|
@@ -384,15 +390,54 @@ export function createMdRuntime(options) {
|
|
|
384
390
|
}
|
|
385
391
|
list(room, room.replica.admission === 'admitted' && !unreadable.has(room.locator));
|
|
386
392
|
}
|
|
387
|
-
for (const [locator, room] of rooms){
|
|
388
|
-
if (listedLocators.has(locator)) continue;
|
|
389
|
-
rooms.set(locator, {
|
|
390
|
-
...room,
|
|
391
|
-
synchronizationAvailable: false
|
|
392
|
-
});
|
|
393
|
-
}
|
|
394
393
|
emitRooms();
|
|
395
|
-
|
|
394
|
+
}
|
|
395
|
+
function unlistedHeld(listed) {
|
|
396
|
+
return [
|
|
397
|
+
...new Set([
|
|
398
|
+
...rooms.keys(),
|
|
399
|
+
...drafts.keys()
|
|
400
|
+
])
|
|
401
|
+
].filter((locator)=>!listed.has(locator));
|
|
402
|
+
}
|
|
403
|
+
async function dropUnlisted(listed, local) {
|
|
404
|
+
if (unlistedHeld(listed).length === 0) return;
|
|
405
|
+
await exclusive(async ()=>{
|
|
406
|
+
await hydrate(local);
|
|
407
|
+
const unlisted = unlistedHeld(listed);
|
|
408
|
+
await local.dropRooms(unlisted);
|
|
409
|
+
for (const [batch, locator] of acceptedIn){
|
|
410
|
+
if (listed.has(locator)) continue;
|
|
411
|
+
acceptedIn.delete(batch);
|
|
412
|
+
outcomes.delete(batch);
|
|
413
|
+
}
|
|
414
|
+
for (const locator of unlisted){
|
|
415
|
+
for (const batch of replicas.get(locator)?.queue ?? [])outcomes.delete(batch.id);
|
|
416
|
+
replicas.delete(locator);
|
|
417
|
+
rooms.delete(locator);
|
|
418
|
+
drafts.delete(locator);
|
|
419
|
+
unreadable.delete(locator);
|
|
420
|
+
scopedRefusals.delete(locator);
|
|
421
|
+
for (const attached of [
|
|
422
|
+
'collection',
|
|
423
|
+
'typed-selection'
|
|
424
|
+
]){
|
|
425
|
+
const key = modelKey(locator, attached);
|
|
426
|
+
models.delete(key);
|
|
427
|
+
liveModels.delete(key);
|
|
428
|
+
invalidModels.delete(key);
|
|
429
|
+
modelEpoch.delete(key);
|
|
430
|
+
}
|
|
431
|
+
journal.record(`room unlisted ${locator}`);
|
|
432
|
+
}
|
|
433
|
+
emitVisible();
|
|
434
|
+
for (const locator of unlisted)emitQueue(locator);
|
|
435
|
+
emitDrafts();
|
|
436
|
+
moveTo({
|
|
437
|
+
...status,
|
|
438
|
+
...attention()
|
|
439
|
+
});
|
|
440
|
+
});
|
|
396
441
|
}
|
|
397
442
|
function restored(key, persisted) {
|
|
398
443
|
const prior = models.get(key);
|
|
@@ -409,7 +454,7 @@ export function createMdRuntime(options) {
|
|
|
409
454
|
return model;
|
|
410
455
|
}
|
|
411
456
|
async function hydrate(opened) {
|
|
412
|
-
const [records, queues, kept, presented, cached, unsent, lastCompleted, declared] = await Promise.all([
|
|
457
|
+
const [records, queues, kept, presented, cached, unsent, lastCompleted, declared, named] = await Promise.all([
|
|
413
458
|
opened.all(),
|
|
414
459
|
opened.queues(),
|
|
415
460
|
opened.drafts(),
|
|
@@ -417,9 +462,11 @@ export function createMdRuntime(options) {
|
|
|
417
462
|
opened.conversations(),
|
|
418
463
|
opened.instructions(),
|
|
419
464
|
opened.lastCompleted(),
|
|
420
|
-
opened.providerLimits()
|
|
465
|
+
opened.providerLimits(),
|
|
466
|
+
opened.capabilities()
|
|
421
467
|
]);
|
|
422
468
|
limits = declared;
|
|
469
|
+
capabilityNames = named;
|
|
423
470
|
drafts.clear();
|
|
424
471
|
for (const draft of kept)rememberDraft(draft.locator, draft.path, draft.content);
|
|
425
472
|
presentations.clear();
|
|
@@ -444,7 +491,7 @@ export function createMdRuntime(options) {
|
|
|
444
491
|
selectionModel
|
|
445
492
|
});
|
|
446
493
|
if (confirmed === null) continue;
|
|
447
|
-
replicas.set(record.locator, replicaOf(confirmed, queuedBatches.get(record.locator) ?? []));
|
|
494
|
+
replicas.set(record.locator, replicaOf(confirmed, queuedBatches.get(record.locator) ?? [], rewriting()));
|
|
448
495
|
const existing = rooms.get(record.locator);
|
|
449
496
|
if (existing === undefined) list(record, false);
|
|
450
497
|
else {
|
|
@@ -532,7 +579,7 @@ export function createMdRuntime(options) {
|
|
|
532
579
|
if (retained !== null) {
|
|
533
580
|
await local.publish(retained.record);
|
|
534
581
|
unreadable.delete(room.locator);
|
|
535
|
-
replicas.set(room.locator, replicaOf(retained, replicas.get(room.locator)?.queue ?? []));
|
|
582
|
+
replicas.set(room.locator, replicaOf(retained, replicas.get(room.locator)?.queue ?? [], rewriting()));
|
|
536
583
|
}
|
|
537
584
|
list(room, true);
|
|
538
585
|
emitRooms();
|
|
@@ -558,6 +605,7 @@ export function createMdRuntime(options) {
|
|
|
558
605
|
binding: options.modelBinding,
|
|
559
606
|
providerOwnedPaths: room.providerOwnedPaths,
|
|
560
607
|
providerLimits: limits,
|
|
608
|
+
rewriting: rewriting(),
|
|
561
609
|
visible: replica.visible,
|
|
562
610
|
changes
|
|
563
611
|
});
|
|
@@ -598,7 +646,7 @@ export function createMdRuntime(options) {
|
|
|
598
646
|
}
|
|
599
647
|
if (replacing !== undefined) outcomes.delete(replacing);
|
|
600
648
|
for (const path of consumed)forgetDraft(locator, path);
|
|
601
|
-
replicas.set(locator, replicaOf(replica.confirmed, batches));
|
|
649
|
+
replicas.set(locator, replicaOf(replica.confirmed, batches, rewriting()));
|
|
602
650
|
emitQueue(locator);
|
|
603
651
|
emitVisible();
|
|
604
652
|
emitDrafts();
|
|
@@ -623,7 +671,7 @@ export function createMdRuntime(options) {
|
|
|
623
671
|
const batches = replica.queue.slice(1);
|
|
624
672
|
outcomes.delete(identifier);
|
|
625
673
|
await persistQueue(local, locator, batches);
|
|
626
|
-
replicas.set(locator, replicaOf(replica.confirmed, batches));
|
|
674
|
+
replicas.set(locator, replicaOf(replica.confirmed, batches, rewriting()));
|
|
627
675
|
emitQueue(locator);
|
|
628
676
|
emitVisible();
|
|
629
677
|
moveTo({
|
|
@@ -836,6 +884,7 @@ export function createMdRuntime(options) {
|
|
|
836
884
|
if (applied === null) return false;
|
|
837
885
|
await local.publish(applied.record);
|
|
838
886
|
await persistQueue(local, room.locator, remaining);
|
|
887
|
+
acceptedIn.set(submitted.id, room.locator);
|
|
839
888
|
outcomes.set(submitted.id, {
|
|
840
889
|
kind: 'accepted',
|
|
841
890
|
roomVersion: accepted.roomVersion,
|
|
@@ -847,7 +896,7 @@ export function createMdRuntime(options) {
|
|
|
847
896
|
}
|
|
848
897
|
});
|
|
849
898
|
unreadable.delete(room.locator);
|
|
850
|
-
replicas.set(room.locator, replicaOf(applied, remaining));
|
|
899
|
+
replicas.set(room.locator, replicaOf(applied, remaining, rewriting()));
|
|
851
900
|
list(room, true);
|
|
852
901
|
emitRooms();
|
|
853
902
|
emitQueue(room.locator);
|
|
@@ -1036,7 +1085,7 @@ export function createMdRuntime(options) {
|
|
|
1036
1085
|
};
|
|
1037
1086
|
await local.publish(record);
|
|
1038
1087
|
const confirmed = readConfirmed(record);
|
|
1039
|
-
if (confirmed !== null) replicas.set(room.locator, replicaOf(confirmed, held.queue));
|
|
1088
|
+
if (confirmed !== null) replicas.set(room.locator, replicaOf(confirmed, held.queue, rewriting()));
|
|
1040
1089
|
}
|
|
1041
1090
|
models.set(key, next);
|
|
1042
1091
|
if (next.status === 'current') {
|
|
@@ -1317,15 +1366,17 @@ export function createMdRuntime(options) {
|
|
|
1317
1366
|
notifyReady();
|
|
1318
1367
|
if (declared.has('room-version-notifications')) observeRoomVersions();
|
|
1319
1368
|
if (declared.has('provider-actions')) observeConversations();
|
|
1320
|
-
|
|
1369
|
+
const names = [
|
|
1370
|
+
...declared
|
|
1371
|
+
].sort();
|
|
1372
|
+
if (JSON.stringify(result.providerLimits) !== JSON.stringify(limits) || JSON.stringify(names) !== JSON.stringify(capabilityNames)) {
|
|
1321
1373
|
limits = result.providerLimits;
|
|
1322
|
-
|
|
1374
|
+
capabilityNames = names;
|
|
1375
|
+
await local.declare(limits, capabilityNames);
|
|
1323
1376
|
}
|
|
1324
|
-
|
|
1377
|
+
await applyDiscovery(result.rooms, local);
|
|
1325
1378
|
handSelected(result.rooms.filter((room)=>room.replica.admission === 'admitted').map((room)=>room.locator).sort());
|
|
1326
|
-
progress.complete =
|
|
1327
|
-
...replicas.keys()
|
|
1328
|
-
].every((locator)=>listedLocators.has(locator));
|
|
1379
|
+
progress.complete = true;
|
|
1329
1380
|
await synchronize(result.rooms, local, progress);
|
|
1330
1381
|
}
|
|
1331
1382
|
async function ensureAuthorization() {
|