@agentshouse/mdruntime-adapter 0.1.0-alpha.9 → 0.1.0-c04b3fdfb64c6
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 +297 -71
- package/README.md +32 -0
- package/dist/actions.d.ts +66 -13
- package/dist/actions.d.ts.map +1 -1
- package/dist/actions.js +279 -354
- package/dist/adapter.d.ts +1 -0
- package/dist/adapter.d.ts.map +1 -1
- package/dist/adapter.js +480 -218
- package/dist/digest.js +1 -5
- package/dist/discovery.d.ts +24 -34
- package/dist/discovery.d.ts.map +1 -1
- package/dist/discovery.js +157 -230
- package/dist/gather.d.ts +4 -0
- package/dist/gather.d.ts.map +1 -0
- package/dist/gather.js +45 -0
- package/dist/handed.d.ts +15 -0
- package/dist/handed.d.ts.map +1 -0
- package/dist/handed.js +38 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -3
- 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 +60 -57
- package/dist/read.d.ts +62 -29
- package/dist/read.d.ts.map +1 -1
- package/dist/read.js +290 -203
- package/dist/referrer.d.ts +7 -0
- package/dist/referrer.d.ts.map +1 -0
- package/dist/referrer.js +35 -0
- package/dist/refusal.d.ts +5 -7
- package/dist/refusal.d.ts.map +1 -1
- package/dist/refusal.js +47 -68
- package/dist/site.d.ts +1 -1
- package/dist/site.d.ts.map +1 -1
- package/dist/site.js +242 -155
- package/dist/stream.d.ts +18 -6
- package/dist/stream.d.ts.map +1 -1
- package/dist/stream.js +532 -212
- package/dist/transport.d.ts +119 -35
- package/dist/transport.d.ts.map +1 -1
- package/dist/transport.js +4 -3
- package/dist/version.d.ts +3 -0
- package/dist/version.d.ts.map +1 -1
- package/dist/version.js +32 -18
- package/dist/write.d.ts +7 -8
- package/dist/write.d.ts.map +1 -1
- package/dist/write.js +201 -207
- package/package.json +4 -13
- 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,152 @@ 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";
|
|
11
12
|
export type HouseMode = 'credential' | 'site';
|
|
12
13
|
export type HouseDoorAnswer = {
|
|
13
14
|
status: number;
|
|
14
15
|
body: unknown;
|
|
15
16
|
};
|
|
16
|
-
export
|
|
17
|
-
export
|
|
17
|
+
export declare const DOOR_FILES_GET = "/door/files/get";
|
|
18
|
+
export declare const SITE_FILES = "/_house/files/";
|
|
19
|
+
export declare const SITE_FILE_RECORD = "record";
|
|
20
|
+
export type HouseByteAct = 'authored_batch_upload' | 'conversation_file_upload' | 'binary_stage';
|
|
21
|
+
export type HouseByteBody = string | ArrayBuffer | Uint8Array | Blob;
|
|
22
|
+
export type HouseBytesAnswer = {
|
|
23
|
+
status: number;
|
|
24
|
+
blob: Blob | null;
|
|
25
|
+
};
|
|
18
26
|
export type HouseByteTransfer = {
|
|
19
27
|
act: HouseByteAct;
|
|
20
|
-
method: 'GET' | 'POST';
|
|
21
28
|
url: string;
|
|
22
|
-
body
|
|
29
|
+
body: HouseByteBody;
|
|
23
30
|
operation?: string;
|
|
24
31
|
};
|
|
25
|
-
export type HouseStreamAuthority = {
|
|
26
|
-
kind: 'room';
|
|
27
|
-
room: string;
|
|
28
|
-
} | {
|
|
29
|
-
kind: 'private';
|
|
30
|
-
} | {
|
|
31
|
-
kind: 'conversation';
|
|
32
|
-
conversation: string;
|
|
33
|
-
};
|
|
34
32
|
export type HouseStreamEntry = {
|
|
35
33
|
path: string;
|
|
36
|
-
kind: 'edited' | 'removed';
|
|
34
|
+
kind: 'edited' | 'removed' | 'piece';
|
|
37
35
|
revision?: string;
|
|
36
|
+
sha256?: string;
|
|
38
37
|
text?: string;
|
|
38
|
+
file?: string;
|
|
39
|
+
bytes?: number;
|
|
40
|
+
media_type?: string;
|
|
41
|
+
author?: {
|
|
42
|
+
user: string;
|
|
43
|
+
name: string;
|
|
44
|
+
} | {
|
|
45
|
+
site: string;
|
|
46
|
+
name: string;
|
|
47
|
+
};
|
|
48
|
+
created_at?: string;
|
|
49
|
+
continued?: true;
|
|
50
|
+
};
|
|
51
|
+
type LiveFact<K extends ConversationEvent['kind']> = Extract<ConversationEvent, {
|
|
52
|
+
kind: K;
|
|
53
|
+
}>;
|
|
54
|
+
export type HouseListedConversation = {
|
|
55
|
+
conversation_id: string;
|
|
56
|
+
agent_id: string;
|
|
57
|
+
name: string;
|
|
58
|
+
created_at: string;
|
|
59
|
+
finished_at: string | null;
|
|
60
|
+
outcome: string | null;
|
|
39
61
|
};
|
|
40
62
|
export type HouseStreamFrame = {
|
|
41
|
-
type: '
|
|
63
|
+
type: 'part';
|
|
42
64
|
authority: string;
|
|
43
|
-
|
|
44
|
-
|
|
65
|
+
carry: string;
|
|
66
|
+
index: number;
|
|
67
|
+
after: string;
|
|
68
|
+
from: string;
|
|
69
|
+
target: string;
|
|
70
|
+
handled: number;
|
|
45
71
|
entries: readonly HouseStreamEntry[];
|
|
46
72
|
} | {
|
|
47
|
-
type: '
|
|
73
|
+
type: 'carried';
|
|
48
74
|
authority: string;
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
code: string;
|
|
75
|
+
carry: string;
|
|
76
|
+
parts: number;
|
|
77
|
+
after: string;
|
|
78
|
+
position: string;
|
|
79
|
+
log_epoch: string;
|
|
55
80
|
} | {
|
|
56
|
-
type: '
|
|
57
|
-
|
|
58
|
-
code?: string;
|
|
81
|
+
type: 'opening';
|
|
82
|
+
expired: readonly string[];
|
|
59
83
|
} | {
|
|
60
|
-
type: '
|
|
84
|
+
type: 'authority_changed';
|
|
85
|
+
rooms: readonly string[];
|
|
86
|
+
} | ({
|
|
87
|
+
type: 'turn';
|
|
61
88
|
conversation_id: string;
|
|
62
|
-
session_id: string;
|
|
63
89
|
turn_id: string;
|
|
64
|
-
|
|
65
|
-
} | {
|
|
90
|
+
} & TurnOperation) | {
|
|
66
91
|
type: 'message';
|
|
67
92
|
conversation_id: string;
|
|
68
93
|
message: unknown;
|
|
69
94
|
} | {
|
|
70
|
-
type: '
|
|
95
|
+
type: 'interactions';
|
|
96
|
+
conversation_id: string;
|
|
97
|
+
interactions: readonly unknown[];
|
|
98
|
+
} | {
|
|
99
|
+
type: 'process';
|
|
71
100
|
conversation_id: string;
|
|
72
|
-
|
|
101
|
+
running: boolean;
|
|
102
|
+
} | {
|
|
103
|
+
type: 'commands';
|
|
104
|
+
conversation_id: string;
|
|
105
|
+
commands: LiveFact<'commands'>['commands'];
|
|
106
|
+
} | {
|
|
107
|
+
type: 'options';
|
|
108
|
+
conversation_id: string;
|
|
109
|
+
options: LiveFact<'options'>['options'];
|
|
110
|
+
} | {
|
|
111
|
+
type: 'conversations';
|
|
112
|
+
conversations: readonly HouseListedConversation[];
|
|
113
|
+
} | {
|
|
114
|
+
type: 'conversation';
|
|
115
|
+
conversation: HouseListedConversation;
|
|
116
|
+
} | {
|
|
117
|
+
type: 'conversation_deleted';
|
|
118
|
+
conversation_id: string;
|
|
119
|
+
} | {
|
|
120
|
+
type: 'signal';
|
|
121
|
+
service_mode: string;
|
|
122
|
+
};
|
|
123
|
+
export type HouseHeldCarry = {
|
|
124
|
+
id: string;
|
|
125
|
+
parts: number;
|
|
126
|
+
from: string;
|
|
127
|
+
target: string;
|
|
128
|
+
handled: number;
|
|
129
|
+
piece?: {
|
|
130
|
+
sha256: string;
|
|
131
|
+
offset: number;
|
|
132
|
+
};
|
|
133
|
+
};
|
|
134
|
+
export type HouseHeldRoom = {
|
|
135
|
+
authority: string;
|
|
136
|
+
position: string;
|
|
137
|
+
log_epoch: string;
|
|
138
|
+
carry?: HouseHeldCarry;
|
|
139
|
+
};
|
|
140
|
+
export type HouseDemand = {
|
|
141
|
+
rooms: readonly string[];
|
|
142
|
+
conversations: boolean;
|
|
143
|
+
};
|
|
144
|
+
export type HouseOpening = {
|
|
145
|
+
hold(rooms: readonly HouseHeldRoom[], runtime: string, demand: HouseDemand | null): void;
|
|
146
|
+
received(authority: string, carry: string, index: number): void;
|
|
147
|
+
close(): void;
|
|
148
|
+
};
|
|
149
|
+
export type HouseClosing = {
|
|
150
|
+
revoked: boolean;
|
|
151
|
+
lost: boolean;
|
|
73
152
|
};
|
|
74
153
|
export type HouseStream = {
|
|
75
|
-
subscribe(authorities: readonly HouseStreamAuthority[]): void;
|
|
76
154
|
observe(receive: (frame: HouseStreamFrame) => void): () => void;
|
|
155
|
+
opened(notify: (opening: HouseOpening) => void): () => void;
|
|
156
|
+
closed(notify: (closing: HouseClosing) => void): () => void;
|
|
77
157
|
};
|
|
78
158
|
export type HouseDoor = {
|
|
79
159
|
door(route: string, body: unknown): Promise<HouseDoorAnswer>;
|
|
@@ -81,8 +161,12 @@ export type HouseDoor = {
|
|
|
81
161
|
};
|
|
82
162
|
export type HouseTransport = HouseDoor & {
|
|
83
163
|
transfer(request: HouseByteTransfer): Promise<HouseDoorAnswer>;
|
|
164
|
+
download(url: string): Promise<HouseBytesAnswer>;
|
|
84
165
|
};
|
|
85
166
|
export type HouseSiteTransport = HouseDoor & {
|
|
167
|
+
online(): boolean;
|
|
86
168
|
read(route: string): Promise<HouseDoorAnswer>;
|
|
169
|
+
download(route: string): Promise<HouseBytesAnswer>;
|
|
87
170
|
};
|
|
171
|
+
export {};
|
|
88
172
|
//# 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,iBAAiB,u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AAG,MAAM,IAAI,CAAC;CAC7D,CAAC;AAEF,MAAM,MAAM,SAAS,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;IAC/D,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC;CAClD,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;IAC9C,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC;CACpD,CAAC"}
|
package/dist/transport.js
CHANGED
|
@@ -7,6 +7,7 @@ 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
|
-
|
|
10
|
+
export const SITE_DOOR_SUBMIT = '/_house/door/submit';
|
|
11
|
+
export const DOOR_FILES_GET = '/door/files/get';
|
|
12
|
+
export const SITE_FILES = '/_house/files/';
|
|
13
|
+
export const SITE_FILE_RECORD = 'record';
|
package/dist/version.d.ts
CHANGED
|
@@ -11,4 +11,7 @@ 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 const DECIMAL: RegExp;
|
|
15
|
+
export declare function reachedVersion(roomVersion: string, target: string, currentEpoch: string | undefined): boolean;
|
|
16
|
+
export declare function followsVersion(roomVersion: string, next: string): boolean;
|
|
14
17
|
//# 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;AAED,eAAO,MAAM,OAAO,QAAwB,CAAC;AAE7C,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
|
+
export 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
|
|
2
|
-
|
|
3
|
-
export declare const UPLOAD_LINE_BYTES = 37;
|
|
4
|
-
export declare const UPLOAD_BYTES_MAX: number;
|
|
1
|
+
import { type ChangeBatch, type HistoryResult, type MutationResult } 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,9 @@ 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 declare function mutationOutcome(status: number, body: unknown, locator: string, handle: string
|
|
24
|
+
export declare function mutationOutcome(status: number, body: unknown, locator: string, handle: string): MutationResult;
|
|
27
25
|
export declare function rejectedMapping(mapping: Extract<ChangeMapping, {
|
|
28
26
|
kind: 'unmapped';
|
|
29
27
|
}>): {
|
|
@@ -33,10 +31,11 @@ export declare function rejectedMapping(mapping: Extract<ChangeMapping, {
|
|
|
33
31
|
fields: {
|
|
34
32
|
path: string;
|
|
35
33
|
};
|
|
34
|
+
retryable: boolean;
|
|
36
35
|
};
|
|
37
36
|
export declare function revisionBody(input: {
|
|
38
37
|
path: string;
|
|
39
|
-
handle: string
|
|
38
|
+
handle: string;
|
|
40
39
|
revision?: string;
|
|
41
40
|
pageToken?: string;
|
|
42
41
|
}): 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,
|
|
1
|
+
{"version":3,"file":"write.d.ts","sourceRoot":"","sources":["../src/write.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,WAAW,EAEhB,KAAK,aAAa,EAElB,KAAK,cAAc,EAEpB,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAOlD,MAAM,MAAM,cAAc,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;AAE/D,MAAM,MAAM,aAAa,GACrB;IAAE,IAAI,EAAE,SAAS,CAAC;IAAC,OAAO,EAAE,SAAS,cAAc,EAAE,CAAA;CAAE,GACvD;IAAE,IAAI,EAAE,UAAU,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AAwHrD,wBAAgB,YAAY,CAAC,KAAK,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,GAAG,aAAa,CAQ9E;AAED,MAAM,MAAM,aAAa,GAAG;IAC1B,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;CAC3B,CAAC;AAEF,wBAAgB,aAAa,CAAC,KAAK,EAAE,WAAW,GAAG,aAAa,CAK/D;AAED,wBAAgB,UAAU,CAAC,OAAO,EAAE,SAAS,cAAc,EAAE,GAAG,SAAS,MAAM,EAAE,CAQhF;AAED,wBAAgB,SAAS,CAAC,OAAO,EAAE,SAAS,cAAc,EAAE,GAAG,MAAM,CAEpE;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAEhD;A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