@agentshouse/mdruntime-adapter 0.1.0-alpha.9 → 0.1.0-c055ce6f0fdd0
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 +186 -34
- package/README.md +32 -0
- package/dist/actions.d.ts +5 -13
- package/dist/actions.d.ts.map +1 -1
- package/dist/actions.js +241 -334
- package/dist/adapter.d.ts.map +1 -1
- package/dist/adapter.js +255 -215
- package/dist/digest.js +1 -5
- package/dist/discovery.d.ts +23 -33
- package/dist/discovery.d.ts.map +1 -1
- package/dist/discovery.js +143 -230
- package/dist/gather.d.ts +3 -0
- package/dist/gather.d.ts.map +1 -0
- package/dist/gather.js +40 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -3
- package/dist/links.d.ts +20 -0
- package/dist/links.d.ts.map +1 -0
- package/dist/links.js +104 -0
- package/dist/map.d.ts +2 -2
- package/dist/map.d.ts.map +1 -1
- package/dist/map.js +6 -7
- package/dist/model.d.ts +7 -18
- package/dist/model.d.ts.map +1 -1
- package/dist/model.js +48 -59
- package/dist/read.d.ts +31 -26
- package/dist/read.d.ts.map +1 -1
- package/dist/read.js +205 -199
- package/dist/refusal.d.ts +3 -1
- package/dist/refusal.d.ts.map +1 -1
- package/dist/refusal.js +27 -62
- package/dist/site.d.ts.map +1 -1
- package/dist/site.js +103 -151
- package/dist/stream.d.ts +16 -6
- package/dist/stream.d.ts.map +1 -1
- package/dist/stream.js +238 -214
- package/dist/transport.d.ts +69 -30
- package/dist/transport.d.ts.map +1 -1
- package/dist/transport.js +2 -3
- package/dist/version.d.ts +2 -0
- package/dist/version.d.ts.map +1 -1
- package/dist/version.js +32 -18
- package/dist/write.d.ts +13 -8
- package/dist/write.d.ts.map +1 -1
- package/dist/write.js +132 -215
- package/package.json +4 -12
- package/dist/actions.js.map +0 -1
- package/dist/adapter.js.map +0 -1
- package/dist/digest.js.map +0 -1
- package/dist/discovery.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/map.js.map +0 -1
- package/dist/model.js.map +0 -1
- package/dist/read.js.map +0 -1
- package/dist/refusal.js.map +0 -1
- package/dist/site.js.map +0 -1
- package/dist/stream.js.map +0 -1
- package/dist/transport.js.map +0 -1
- package/dist/version.js.map +0 -1
- package/dist/write.js.map +0 -1
package/dist/transport.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { ConversationEvent, TurnOperation } from '@agentshouse/mdruntime';
|
|
1
2
|
export declare const DOOR_DISCOVER = "/door/discover";
|
|
2
3
|
export declare const DOOR_BOOTSTRAP = "/door/bootstrap";
|
|
3
4
|
export declare const DOOR_ENUMERATE = "/door/enumerate";
|
|
@@ -7,73 +8,109 @@ export declare const DOOR_REVISIONS = "/door/revisions";
|
|
|
7
8
|
export declare const SITE_DOOR_DISCOVER = "/_house/door/discover";
|
|
8
9
|
export declare const SITE_DOOR_BOOTSTRAP = "/_house/door/bootstrap/";
|
|
9
10
|
export declare const SITE_DOOR_ENUMERATE = "/_house/door/enumerate";
|
|
10
|
-
export declare const
|
|
11
|
+
export declare const SITE_DOOR_SUBMIT = "/_house/door/submit";
|
|
12
|
+
export declare const PRIVATE_LOCATOR = "private";
|
|
11
13
|
export type HouseMode = 'credential' | 'site';
|
|
12
14
|
export type HouseDoorAnswer = {
|
|
13
15
|
status: number;
|
|
14
16
|
body: unknown;
|
|
15
17
|
};
|
|
16
|
-
export type HouseByteAct = '
|
|
18
|
+
export type HouseByteAct = 'local_copy_bundle' | 'authored_batch_upload' | 'conversation_original_upload' | 'original_upload' | 'original_download';
|
|
17
19
|
export type HouseByteBody = string | ArrayBuffer | Uint8Array;
|
|
20
|
+
export type HouseByteAnswer = 'json' | 'bytes';
|
|
18
21
|
export type HouseByteTransfer = {
|
|
19
22
|
act: HouseByteAct;
|
|
20
23
|
method: 'GET' | 'POST';
|
|
21
24
|
url: string;
|
|
25
|
+
answer: HouseByteAnswer;
|
|
22
26
|
body?: HouseByteBody;
|
|
23
27
|
operation?: string;
|
|
24
28
|
};
|
|
25
|
-
export type HouseStreamAuthority = {
|
|
26
|
-
kind: 'room';
|
|
27
|
-
room: string;
|
|
28
|
-
} | {
|
|
29
|
-
kind: 'private';
|
|
30
|
-
} | {
|
|
31
|
-
kind: 'conversation';
|
|
32
|
-
conversation: string;
|
|
33
|
-
};
|
|
34
29
|
export type HouseStreamEntry = {
|
|
35
30
|
path: string;
|
|
36
31
|
kind: 'edited' | 'removed';
|
|
37
32
|
revision?: string;
|
|
33
|
+
sha256?: string;
|
|
38
34
|
text?: string;
|
|
35
|
+
author?: {
|
|
36
|
+
user: string;
|
|
37
|
+
name: string;
|
|
38
|
+
} | {
|
|
39
|
+
site: string;
|
|
40
|
+
name: string;
|
|
41
|
+
};
|
|
42
|
+
created_at?: string;
|
|
43
|
+
};
|
|
44
|
+
type LiveFact<K extends ConversationEvent['kind']> = Extract<ConversationEvent, {
|
|
45
|
+
kind: K;
|
|
46
|
+
}>;
|
|
47
|
+
export type HouseListedConversation = {
|
|
48
|
+
conversation_id: string;
|
|
49
|
+
agent_id: string;
|
|
50
|
+
name: string;
|
|
51
|
+
created_at: string;
|
|
52
|
+
finished_at: string | null;
|
|
53
|
+
outcome: string | null;
|
|
39
54
|
};
|
|
40
55
|
export type HouseStreamFrame = {
|
|
41
56
|
type: 'entries';
|
|
42
57
|
authority: string;
|
|
58
|
+
after: string;
|
|
43
59
|
position: string;
|
|
44
60
|
log_epoch: string;
|
|
45
61
|
entries: readonly HouseStreamEntry[];
|
|
46
62
|
} | {
|
|
47
|
-
type: '
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
63
|
+
type: 'opening';
|
|
64
|
+
expired: readonly string[];
|
|
65
|
+
} | ({
|
|
66
|
+
type: 'turn';
|
|
67
|
+
conversation_id: string;
|
|
68
|
+
turn_id: string;
|
|
69
|
+
} & TurnOperation) | {
|
|
70
|
+
type: 'message';
|
|
71
|
+
conversation_id: string;
|
|
72
|
+
message: unknown;
|
|
51
73
|
} | {
|
|
52
|
-
type: '
|
|
53
|
-
|
|
54
|
-
|
|
74
|
+
type: 'interactions';
|
|
75
|
+
conversation_id: string;
|
|
76
|
+
interactions: readonly unknown[];
|
|
55
77
|
} | {
|
|
56
|
-
type: '
|
|
57
|
-
|
|
58
|
-
|
|
78
|
+
type: 'process';
|
|
79
|
+
conversation_id: string;
|
|
80
|
+
running: boolean;
|
|
59
81
|
} | {
|
|
60
|
-
type: '
|
|
82
|
+
type: 'commands';
|
|
61
83
|
conversation_id: string;
|
|
62
|
-
|
|
63
|
-
turn_id: string;
|
|
64
|
-
text: string;
|
|
84
|
+
commands: LiveFact<'commands'>['commands'];
|
|
65
85
|
} | {
|
|
66
|
-
type: '
|
|
86
|
+
type: 'options';
|
|
67
87
|
conversation_id: string;
|
|
68
|
-
|
|
88
|
+
options: LiveFact<'options'>['options'];
|
|
89
|
+
} | {
|
|
90
|
+
type: 'conversations';
|
|
91
|
+
conversations: readonly HouseListedConversation[];
|
|
92
|
+
} | {
|
|
93
|
+
type: 'conversation';
|
|
94
|
+
conversation: HouseListedConversation;
|
|
69
95
|
} | {
|
|
70
|
-
type: '
|
|
96
|
+
type: 'conversation_deleted';
|
|
71
97
|
conversation_id: string;
|
|
72
|
-
|
|
98
|
+
} | {
|
|
99
|
+
type: 'signal';
|
|
100
|
+
service_mode: string;
|
|
101
|
+
};
|
|
102
|
+
export type HouseHeldRoom = {
|
|
103
|
+
authority: string;
|
|
104
|
+
position: string;
|
|
105
|
+
log_epoch: string;
|
|
106
|
+
};
|
|
107
|
+
export type HouseOpening = {
|
|
108
|
+
hold(rooms: readonly HouseHeldRoom[], runtime: string): void;
|
|
73
109
|
};
|
|
74
110
|
export type HouseStream = {
|
|
75
|
-
subscribe(authorities: readonly HouseStreamAuthority[]): void;
|
|
76
111
|
observe(receive: (frame: HouseStreamFrame) => void): () => void;
|
|
112
|
+
opened(notify: (opening: HouseOpening) => void): () => void;
|
|
113
|
+
closed(notify: (revoked: boolean) => void): () => void;
|
|
77
114
|
};
|
|
78
115
|
export type HouseDoor = {
|
|
79
116
|
door(route: string, body: unknown): Promise<HouseDoorAnswer>;
|
|
@@ -83,6 +120,8 @@ export type HouseTransport = HouseDoor & {
|
|
|
83
120
|
transfer(request: HouseByteTransfer): Promise<HouseDoorAnswer>;
|
|
84
121
|
};
|
|
85
122
|
export type HouseSiteTransport = HouseDoor & {
|
|
123
|
+
online(): boolean;
|
|
86
124
|
read(route: string): Promise<HouseDoorAnswer>;
|
|
87
125
|
};
|
|
126
|
+
export {};
|
|
88
127
|
//# sourceMappingURL=transport.d.ts.map
|
package/dist/transport.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transport.d.ts","sourceRoot":"","sources":["../src/transport.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,aAAa,mBAAmB,CAAC;AAE9C,eAAO,MAAM,cAAc,oBAAoB,CAAC;AAEhD,eAAO,MAAM,cAAc,oBAAoB,CAAC;AAEhD,eAAO,MAAM,UAAU,gBAAgB,CAAC;AAExC,eAAO,MAAM,iBAAiB,uBAAuB,CAAC;AAEtD,eAAO,MAAM,cAAc,oBAAoB,CAAC;AAEhD,eAAO,MAAM,kBAAkB,0BAA0B,CAAC;AAE1D,eAAO,MAAM,mBAAmB,4BAA4B,CAAC;AAE7D,eAAO,MAAM,mBAAmB,2BAA2B,CAAC;AAE5D,eAAO,MAAM,
|
|
1
|
+
{"version":3,"file":"transport.d.ts","sourceRoot":"","sources":["../src/transport.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAE/E,eAAO,MAAM,aAAa,mBAAmB,CAAC;AAE9C,eAAO,MAAM,cAAc,oBAAoB,CAAC;AAEhD,eAAO,MAAM,cAAc,oBAAoB,CAAC;AAEhD,eAAO,MAAM,UAAU,gBAAgB,CAAC;AAExC,eAAO,MAAM,iBAA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S,GAAG;IACtB,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC;IAC7D,MAAM,EAAE,WAAW,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG,SAAS,GAAG;IACvC,QAAQ,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC;CAChE,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG,SAAS,GAAG;IAC3C,MAAM,IAAI,OAAO,CAAC;IAClB,IAAI,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC;CAC/C,CAAC"}
|
package/dist/transport.js
CHANGED
|
@@ -7,6 +7,5 @@ export const DOOR_REVISIONS = '/door/revisions';
|
|
|
7
7
|
export const SITE_DOOR_DISCOVER = '/_house/door/discover';
|
|
8
8
|
export const SITE_DOOR_BOOTSTRAP = '/_house/door/bootstrap/';
|
|
9
9
|
export const SITE_DOOR_ENUMERATE = '/_house/door/enumerate';
|
|
10
|
-
export const
|
|
11
|
-
|
|
12
|
-
//# sourceMappingURL=transport.js.map
|
|
10
|
+
export const SITE_DOOR_SUBMIT = '/_house/door/submit';
|
|
11
|
+
export const PRIVATE_LOCATOR = 'private';
|
package/dist/version.d.ts
CHANGED
|
@@ -11,4 +11,6 @@ export declare function roomVersion(at: LogPosition): string;
|
|
|
11
11
|
export declare function logPosition(version: string): LogPosition | null;
|
|
12
12
|
export declare function readPosition(held: Readonly<Record<string, unknown>>): LogPosition | null;
|
|
13
13
|
export declare function presented(authority: string, at: LogPosition): PresentedPosition;
|
|
14
|
+
export declare function reachedVersion(roomVersion: string, target: string, currentEpoch: string | undefined): boolean;
|
|
15
|
+
export declare function followsVersion(roomVersion: string, next: string): boolean;
|
|
14
16
|
//# sourceMappingURL=version.d.ts.map
|
package/dist/version.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,WAAW,GAAG;IACxB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,wBAAgB,WAAW,CAAC,EAAE,EAAE,WAAW,GAAG,MAAM,CAEnD;AAED,wBAAgB,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,WAAW,GAAG,IAAI,CAI/D;AAED,wBAAgB,YAAY,CAAC,IAAI,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GAAG,WAAW,GAAG,IAAI,CAKxF;AAED,wBAAgB,SAAS,CAAC,SAAS,EAAE,MAAM,EAAE,EAAE,EAAE,WAAW,GAAG,iBAAiB,CAE/E"}
|
|
1
|
+
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,WAAW,GAAG;IACxB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,wBAAgB,WAAW,CAAC,EAAE,EAAE,WAAW,GAAG,MAAM,CAEnD;AAED,wBAAgB,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,WAAW,GAAG,IAAI,CAI/D;AAED,wBAAgB,YAAY,CAAC,IAAI,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GAAG,WAAW,GAAG,IAAI,CAKxF;AAED,wBAAgB,SAAS,CAAC,SAAS,EAAE,MAAM,EAAE,EAAE,EAAE,WAAW,GAAG,iBAAiB,CAE/E;AAID,wBAAgB,cAAc,CAC5B,WAAW,EAAE,MAAM,EACnB,MAAM,EAAE,MAAM,EACd,YAAY,EAAE,MAAM,GAAG,SAAS,GAC/B,OAAO,CAQT;AAED,wBAAgB,cAAc,CAAC,WAAW,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAMzE"}
|
package/dist/version.js
CHANGED
|
@@ -3,27 +3,41 @@ export function roomVersion(at) {
|
|
|
3
3
|
}
|
|
4
4
|
export function logPosition(version) {
|
|
5
5
|
const split = version.lastIndexOf(':');
|
|
6
|
-
if (split < 1 || split === version.length - 1)
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
position: version.slice(split + 1)
|
|
10
|
-
};
|
|
6
|
+
if (split < 1 || split === version.length - 1)
|
|
7
|
+
return null;
|
|
8
|
+
return { logEpoch: version.slice(0, split), position: version.slice(split + 1) };
|
|
11
9
|
}
|
|
12
10
|
export function readPosition(held) {
|
|
13
11
|
const { position, log_epoch: logEpoch } = held;
|
|
14
|
-
if (typeof position !== 'string' || position.length === 0)
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
};
|
|
12
|
+
if (typeof position !== 'string' || position.length === 0)
|
|
13
|
+
return null;
|
|
14
|
+
if (typeof logEpoch !== 'string' || logEpoch.length === 0)
|
|
15
|
+
return null;
|
|
16
|
+
return { position, logEpoch };
|
|
20
17
|
}
|
|
21
18
|
export function presented(authority, at) {
|
|
22
|
-
return {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
19
|
+
return { authority, position: at.position, log_epoch: at.logEpoch };
|
|
20
|
+
}
|
|
21
|
+
const DECIMAL = /^(?:0|[1-9][0-9]*)$/;
|
|
22
|
+
export function reachedVersion(roomVersion, target, currentEpoch) {
|
|
23
|
+
if (roomVersion === target)
|
|
24
|
+
return true;
|
|
25
|
+
const held = logPosition(roomVersion);
|
|
26
|
+
const wanted = logPosition(target);
|
|
27
|
+
if (held === null || wanted === null)
|
|
28
|
+
return false;
|
|
29
|
+
if (!DECIMAL.test(held.position) || !DECIMAL.test(wanted.position))
|
|
30
|
+
return false;
|
|
31
|
+
if (held.logEpoch === wanted.logEpoch)
|
|
32
|
+
return BigInt(held.position) >= BigInt(wanted.position);
|
|
33
|
+
return held.logEpoch === currentEpoch;
|
|
34
|
+
}
|
|
35
|
+
export function followsVersion(roomVersion, next) {
|
|
36
|
+
const held = logPosition(roomVersion);
|
|
37
|
+
const following = logPosition(next);
|
|
38
|
+
if (held === null || following === null || held.logEpoch !== following.logEpoch)
|
|
39
|
+
return false;
|
|
40
|
+
if (!DECIMAL.test(held.position) || !DECIMAL.test(following.position))
|
|
41
|
+
return false;
|
|
42
|
+
return BigInt(following.position) === BigInt(held.position) + 1n;
|
|
27
43
|
}
|
|
28
|
-
|
|
29
|
-
//# sourceMappingURL=version.js.map
|
package/dist/write.d.ts
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import type { ChangeBatch, HistoryResult, MutationResult } from '@agentshouse/mdruntime';
|
|
2
|
-
|
|
3
|
-
export declare const UPLOAD_LINE_BYTES = 37;
|
|
4
|
-
export declare const UPLOAD_BYTES_MAX: number;
|
|
1
|
+
import type { ChangeBatch, HistoryResult, MutationResult, RoomAttachment } from '@agentshouse/mdruntime';
|
|
2
|
+
import type { HouseBounds } from './discovery.js';
|
|
5
3
|
export type HouseOperation = Readonly<Record<string, unknown>>;
|
|
6
4
|
export type ChangeMapping = {
|
|
7
5
|
kind: 'changes';
|
|
@@ -11,7 +9,7 @@ export type ChangeMapping = {
|
|
|
11
9
|
path: string;
|
|
12
10
|
rule: string;
|
|
13
11
|
};
|
|
14
|
-
export declare function houseChanges(batch: ChangeBatch, handle: string
|
|
12
|
+
export declare function houseChanges(batch: ChangeBatch, handle: string): ChangeMapping;
|
|
15
13
|
export type OperationHead = {
|
|
16
14
|
readonly operation_id: string;
|
|
17
15
|
readonly app_ref?: string;
|
|
@@ -21,9 +19,16 @@ export declare function operationHead(batch: ChangeBatch): OperationHead;
|
|
|
21
19
|
export declare function batchPaths(changes: readonly HouseOperation[]): readonly string[];
|
|
22
20
|
export declare function deltaBody(changes: readonly HouseOperation[]): string;
|
|
23
21
|
export declare function deltaBytes(delta: string): number;
|
|
24
|
-
export declare function uploadable(bytes: number): boolean;
|
|
22
|
+
export declare function uploadable(inline: Readonly<Record<string, unknown>>, bytes: number, bounds: Pick<HouseBounds, 'max_inline_body_bytes' | 'max_upload_bytes'>): boolean;
|
|
25
23
|
export declare function deltaDigest(delta: string): Promise<string>;
|
|
26
|
-
export
|
|
24
|
+
export type SubmittedOutcome = Exclude<MutationResult, {
|
|
25
|
+
kind: 'accepted';
|
|
26
|
+
}> | (Extract<MutationResult, {
|
|
27
|
+
kind: 'accepted';
|
|
28
|
+
}> & {
|
|
29
|
+
originals: readonly RoomAttachment[];
|
|
30
|
+
});
|
|
31
|
+
export declare function mutationOutcome(status: number, body: unknown, locator: string, handle: string): SubmittedOutcome;
|
|
27
32
|
export declare function rejectedMapping(mapping: Extract<ChangeMapping, {
|
|
28
33
|
kind: 'unmapped';
|
|
29
34
|
}>): {
|
|
@@ -36,7 +41,7 @@ export declare function rejectedMapping(mapping: Extract<ChangeMapping, {
|
|
|
36
41
|
};
|
|
37
42
|
export declare function revisionBody(input: {
|
|
38
43
|
path: string;
|
|
39
|
-
handle: string
|
|
44
|
+
handle: string;
|
|
40
45
|
revision?: string;
|
|
41
46
|
pageToken?: string;
|
|
42
47
|
}): Record<string, unknown>;
|
package/dist/write.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"write.d.ts","sourceRoot":"","sources":["../src/write.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,WAAW,
|
|
1
|
+
{"version":3,"file":"write.d.ts","sourceRoot":"","sources":["../src/write.ts"],"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