@agentshouse/mdruntime 0.1.0-alpha.3 → 0.1.0-alpha.5
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/dist/adapter.d.ts +21 -4
- package/dist/adapter.d.ts.map +1 -1
- package/dist/adapter.js.map +1 -1
- package/dist/connection.d.ts +22 -4
- package/dist/connection.d.ts.map +1 -1
- package/dist/connection.js +657 -78
- package/dist/connection.js.map +1 -1
- package/dist/durability.d.ts +4 -0
- package/dist/durability.d.ts.map +1 -0
- package/dist/durability.js +65 -0
- package/dist/durability.js.map +1 -0
- package/dist/index.d.ts +3 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/log.d.ts +5 -0
- package/dist/log.d.ts.map +1 -0
- package/dist/log.js +15 -0
- package/dist/log.js.map +1 -0
- package/dist/memory.js +2 -1
- package/dist/memory.js.map +1 -1
- package/dist/outcome.d.ts +30 -0
- package/dist/outcome.d.ts.map +1 -0
- package/dist/outcome.js +13 -0
- package/dist/outcome.js.map +1 -0
- package/dist/replica.d.ts +1 -0
- package/dist/replica.d.ts.map +1 -1
- package/dist/replica.js +25 -0
- package/dist/replica.js.map +1 -1
- package/dist/status.d.ts +2 -1
- package/dist/status.d.ts.map +1 -1
- package/dist/status.js +6 -4
- package/dist/status.js.map +1 -1
- package/dist/store.d.ts +5 -0
- package/dist/store.d.ts.map +1 -1
- package/dist/store.js +19 -1
- package/dist/store.js.map +1 -1
- package/package.json +1 -1
package/dist/adapter.d.ts
CHANGED
|
@@ -94,26 +94,43 @@ export type MutationRequest = {
|
|
|
94
94
|
export type MutationResult = {
|
|
95
95
|
kind: 'accepted';
|
|
96
96
|
roomVersion: string;
|
|
97
|
+
documents: Readonly<Record<string, string>>;
|
|
98
|
+
revisions: Readonly<Record<string, string>>;
|
|
99
|
+
removals: readonly string[];
|
|
100
|
+
author: string;
|
|
101
|
+
time: string;
|
|
97
102
|
} | {
|
|
98
103
|
kind: 'conflicted';
|
|
99
104
|
roomVersion: string;
|
|
105
|
+
affected: Readonly<Record<string, string>>;
|
|
100
106
|
text: string;
|
|
101
107
|
} | {
|
|
102
108
|
kind: 'rejected';
|
|
109
|
+
affected: Readonly<Record<string, string>>;
|
|
103
110
|
text: string;
|
|
111
|
+
} | {
|
|
112
|
+
kind: 'expired';
|
|
104
113
|
} | AdapterFailure;
|
|
114
|
+
export type HistoryRevision = {
|
|
115
|
+
revision: string;
|
|
116
|
+
author: string;
|
|
117
|
+
time: string;
|
|
118
|
+
};
|
|
105
119
|
export type HistoryRequest = {
|
|
106
120
|
locator: string;
|
|
107
121
|
path: string;
|
|
122
|
+
revision?: string;
|
|
108
123
|
pageToken?: PageToken;
|
|
109
124
|
};
|
|
110
125
|
export type HistoryResult = {
|
|
111
126
|
kind: 'history';
|
|
112
|
-
revisions: readonly
|
|
113
|
-
author: string;
|
|
114
|
-
time: string;
|
|
115
|
-
}[];
|
|
127
|
+
revisions: readonly HistoryRevision[];
|
|
116
128
|
pageToken?: PageToken;
|
|
129
|
+
} | {
|
|
130
|
+
kind: 'revision';
|
|
131
|
+
content: string;
|
|
132
|
+
} | {
|
|
133
|
+
kind: 'no-history';
|
|
117
134
|
} | AdapterFailure;
|
|
118
135
|
export type ActionRequest = {
|
|
119
136
|
name: 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,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,CACV,CAAC;AAEX,MAAM,MAAM,eAAe,GAAG;IAC5B,QAAQ,EAAE,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,CAAC,EAAE,SAAS,CAAC;CACvB,GACD;IACE,IAAI,EAAE,UAAU,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;CACjB,GACD;IAAE,IAAI,EAAE,YAAY,CAAA;CAAE,GACtB,cAAc,CAAC;AAEnB,MAAM,MAAM,aAAa,GAAG;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,OAAO,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,YAAY,GACpB;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,MAAM,EAAE,OAAO,CAAA;CAAE,GACnC;IAAE,IAAI,EAAE,UAAU,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAClC,cAAc,CAAC;AAEnB,MAAM,MAAM,OAAO,GAAG;IACpB,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;CACrF,CAAC"}
|
package/dist/adapter.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/workspace/packages/mdruntime/src/adapter.ts"],"sourcesContent":["import 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 DiscoveredRoom = {\n name: string;\n locator: string;\n roomVersion: string;\n writeGrants: readonly string[];\n providerOwnedPaths: readonly string[];\n};\n\nexport type Capability = {\n name: string;\n limits?: readonly ProviderLimit[];\n actions?: readonly ActionDeclaration[];\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 Retention = {\n history: number;\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 origins: readonly string[];\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 AdapterFailure = TransportUncertainty | RoomNotReadable | RevokedAuthorization;\n\nexport type DiscoverResult = Discovery | TransportUncertainty | RevokedAuthorization;\n\nexport type PageToken = string;\n\nexport type BootstrapRequest = {\n locator: 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 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 MutationResult =\n | {
|
|
1
|
+
{"version":3,"sources":["/workspace/packages/mdruntime/src/adapter.ts"],"sourcesContent":["import 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 DiscoveredRoom = {\n name: string;\n locator: string;\n roomVersion: string;\n writeGrants: readonly string[];\n providerOwnedPaths: readonly string[];\n};\n\nexport type Capability = {\n name: string;\n limits?: readonly ProviderLimit[];\n actions?: readonly ActionDeclaration[];\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 Retention = {\n history: number;\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 origins: readonly string[];\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 AdapterFailure = TransportUncertainty | RoomNotReadable | RevokedAuthorization;\n\nexport type DiscoverResult = Discovery | TransportUncertainty | RevokedAuthorization;\n\nexport type PageToken = string;\n\nexport type BootstrapRequest = {\n locator: 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 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 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 | {\n kind: 'conflicted';\n roomVersion: string;\n affected: Readonly<Record<string, string>>;\n text: string;\n }\n | {\n kind: 'rejected';\n affected: Readonly<Record<string, string>>;\n text: string;\n }\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 | { kind: 'rejected'; text: string }\n | AdapterFailure;\n\nexport type Adapter = {\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};\n"],"names":["ROOM_CONTRACT_VERSION","VERSION_1_CAPABILITIES"],"mappings":"AAIA,OAAO,MAAMA,wBAAwB,EAAE;AAEvC,OAAO,MAAMC,yBAAyB;IACpC;IACA;IACA;IACA;IACA;CACD,CAAU"}
|
package/dist/connection.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { type QueryOptions, type QueryResult } from '@agentshouse/query';
|
|
2
|
-
import { type Adapter, type Authorization } from './adapter.js';
|
|
3
|
-
import type { Change
|
|
2
|
+
import { type ActionResult, type Adapter, type Authorization, type HistoryResult } from './adapter.js';
|
|
3
|
+
import type { Change } from './change.js';
|
|
4
4
|
import { type MdType } from './collection.js';
|
|
5
|
+
import { type QueueEntry, type SubmissionOutcome } from './outcome.js';
|
|
5
6
|
import { type SaveRefusal } from './save.js';
|
|
6
7
|
import { type SyncStatus } from './status.js';
|
|
7
8
|
export type AppRoom = {
|
|
@@ -35,19 +36,36 @@ export type DraftSurface = {
|
|
|
35
36
|
replace(locator: string, path: string, content: unknown): Promise<void>;
|
|
36
37
|
discard(locator: string, path: string): Promise<void>;
|
|
37
38
|
};
|
|
39
|
+
export type QueueSurface = {
|
|
40
|
+
discard(locator: string, identifier: string): Promise<void>;
|
|
41
|
+
};
|
|
42
|
+
export type HistoryQuery = {
|
|
43
|
+
revision?: string;
|
|
44
|
+
pageToken?: string;
|
|
45
|
+
};
|
|
46
|
+
export type CallResult = ActionResult | {
|
|
47
|
+
kind: 'undeclared';
|
|
48
|
+
};
|
|
38
49
|
export type MdRuntime = {
|
|
39
50
|
rooms(): readonly AppRoom[];
|
|
40
51
|
query(options?: QueryOptions): QueryResult;
|
|
41
52
|
types(locator: string): readonly MdType[];
|
|
42
53
|
syncStatus(): SyncStatus;
|
|
43
54
|
draft: DraftSurface;
|
|
44
|
-
save(locator: string, changes: readonly Change[]): Promise<SaveResult>;
|
|
55
|
+
save(locator: string, changes: readonly Change[], replacing?: string): Promise<SaveResult>;
|
|
56
|
+
outcome(identifier: string): SubmissionOutcome | null;
|
|
57
|
+
queue: QueueSurface;
|
|
58
|
+
history(locator: string, path: string, query?: HistoryQuery): Promise<HistoryResult>;
|
|
59
|
+
call(name: string, input: unknown): Promise<CallResult>;
|
|
60
|
+
log(): string;
|
|
61
|
+
storageLoss(): string | null;
|
|
45
62
|
observe: {
|
|
46
63
|
(topic: 'rooms', listener: (rooms: readonly AppRoom[]) => void): () => void;
|
|
47
64
|
(topic: 'connection-refusal', listener: (refusal: ConnectionRefusal | null) => void): () => void;
|
|
65
|
+
(topic: 'storage-loss', listener: (statement: string | null) => void): () => void;
|
|
48
66
|
(topic: 'sync-status', listener: (status: SyncStatus) => void): () => void;
|
|
49
67
|
(topic: 'query', query: QueryOptions, listener: (result: QueryResult) => void): () => void;
|
|
50
|
-
(topic: 'queue', locator: string, listener: (
|
|
68
|
+
(topic: 'queue', locator: string, listener: (entries: readonly QueueEntry[]) => void): () => void;
|
|
51
69
|
};
|
|
52
70
|
reauthorize(): Promise<void>;
|
|
53
71
|
};
|
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,EAEL,KAAK,YAAY,EACjB,KAAK,WAAW,EAEjB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAGL,KAAK,OAAO,EAEZ,KAAK,aAAa,EAGnB,MAAM,cAAc,CAAC;AAEtB,OAAO,KAAK,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"connection.d.ts","sourceRoot":"","sources":["../src/connection.ts"],"names":[],"mappings":"AAAA,OAAO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