@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.
Files changed (66) hide show
  1. package/AGENTS.md +297 -71
  2. package/README.md +32 -0
  3. package/dist/actions.d.ts +66 -13
  4. package/dist/actions.d.ts.map +1 -1
  5. package/dist/actions.js +279 -354
  6. package/dist/adapter.d.ts +1 -0
  7. package/dist/adapter.d.ts.map +1 -1
  8. package/dist/adapter.js +480 -218
  9. package/dist/digest.js +1 -5
  10. package/dist/discovery.d.ts +24 -34
  11. package/dist/discovery.d.ts.map +1 -1
  12. package/dist/discovery.js +157 -230
  13. package/dist/gather.d.ts +4 -0
  14. package/dist/gather.d.ts.map +1 -0
  15. package/dist/gather.js +45 -0
  16. package/dist/handed.d.ts +15 -0
  17. package/dist/handed.d.ts.map +1 -0
  18. package/dist/handed.js +38 -0
  19. package/dist/index.d.ts +2 -2
  20. package/dist/index.d.ts.map +1 -1
  21. package/dist/index.js +1 -3
  22. package/dist/map.d.ts +2 -2
  23. package/dist/map.d.ts.map +1 -1
  24. package/dist/map.js +6 -7
  25. package/dist/model.d.ts +7 -18
  26. package/dist/model.d.ts.map +1 -1
  27. package/dist/model.js +60 -57
  28. package/dist/read.d.ts +62 -29
  29. package/dist/read.d.ts.map +1 -1
  30. package/dist/read.js +290 -203
  31. package/dist/referrer.d.ts +7 -0
  32. package/dist/referrer.d.ts.map +1 -0
  33. package/dist/referrer.js +35 -0
  34. package/dist/refusal.d.ts +5 -7
  35. package/dist/refusal.d.ts.map +1 -1
  36. package/dist/refusal.js +47 -68
  37. package/dist/site.d.ts +1 -1
  38. package/dist/site.d.ts.map +1 -1
  39. package/dist/site.js +242 -155
  40. package/dist/stream.d.ts +18 -6
  41. package/dist/stream.d.ts.map +1 -1
  42. package/dist/stream.js +532 -212
  43. package/dist/transport.d.ts +119 -35
  44. package/dist/transport.d.ts.map +1 -1
  45. package/dist/transport.js +4 -3
  46. package/dist/version.d.ts +3 -0
  47. package/dist/version.d.ts.map +1 -1
  48. package/dist/version.js +32 -18
  49. package/dist/write.d.ts +7 -8
  50. package/dist/write.d.ts.map +1 -1
  51. package/dist/write.js +201 -207
  52. package/package.json +4 -13
  53. package/dist/actions.js.map +0 -1
  54. package/dist/adapter.js.map +0 -1
  55. package/dist/digest.js.map +0 -1
  56. package/dist/discovery.js.map +0 -1
  57. package/dist/index.js.map +0 -1
  58. package/dist/map.js.map +0 -1
  59. package/dist/model.js.map +0 -1
  60. package/dist/read.js.map +0 -1
  61. package/dist/refusal.js.map +0 -1
  62. package/dist/site.js.map +0 -1
  63. package/dist/stream.js.map +0 -1
  64. package/dist/transport.js.map +0 -1
  65. package/dist/version.js.map +0 -1
  66. package/dist/write.js.map +0 -1
@@ -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 PRIVATE_AUTHORITY = "private";
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 type HouseByteAct = 'working_copy_bundle' | 'authored_batch_upload' | 'conversation_original_upload';
17
- export type HouseByteBody = string | ArrayBuffer | Uint8Array;
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?: HouseByteBody;
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: 'entries';
63
+ type: 'part';
42
64
  authority: string;
43
- position: string;
44
- log_epoch: string;
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: 'subscribed';
73
+ type: 'carried';
48
74
  authority: string;
49
- position?: string;
50
- log_epoch?: string;
51
- } | {
52
- type: 'refused';
53
- authority: string;
54
- code: string;
75
+ carry: string;
76
+ parts: number;
77
+ after: string;
78
+ position: string;
79
+ log_epoch: string;
55
80
  } | {
56
- type: 'unsubscribed';
57
- authority: string;
58
- code?: string;
81
+ type: 'opening';
82
+ expired: readonly string[];
59
83
  } | {
60
- type: 'draft';
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
- text: string;
65
- } | {
90
+ } & TurnOperation) | {
66
91
  type: 'message';
67
92
  conversation_id: string;
68
93
  message: unknown;
69
94
  } | {
70
- type: 'session';
95
+ type: 'interactions';
96
+ conversation_id: string;
97
+ interactions: readonly unknown[];
98
+ } | {
99
+ type: 'process';
71
100
  conversation_id: string;
72
- summary: unknown;
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
@@ -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,iBAAiB,YAAY,CAAC;AAE3C,MAAM,MAAM,SAAS,GAAG,YAAY,GAAG,MAAM,CAAC;AAE9C,MAAM,MAAM,eAAe,GAAG;IAC5B,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,OAAO,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,YAAY,GACpB,qBAAqB,GACrB,uBAAuB,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AAM,CAAC,MAAM,EAAE,CAAC,OAAO,EAAE,YAAY,KAAK,IAAI,GAAG,MAAM,IAAI,CAAC;IAC5D,MAAM,CAAC,MAAM,EAAE,CAAC,OAAO,EAAE,YAAY,KAAK,IAAI,GAAG,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 PRIVATE_AUTHORITY = 'private';
11
-
12
- //# sourceMappingURL=transport.js.map
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
@@ -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) return null;
7
- return {
8
- logEpoch: version.slice(0, split),
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) return null;
15
- if (typeof logEpoch !== 'string' || logEpoch.length === 0) return null;
16
- return {
17
- position,
18
- logEpoch
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
- authority,
24
- position: at.position,
25
- log_epoch: at.logEpoch
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 { ChangeBatch, HistoryResult, MutationResult } from '@agentshouse/mdruntime';
2
- export declare const INLINE_BODY_LIMIT_BYTES: number;
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 | undefined): ChangeMapping;
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 | undefined): MutationResult;
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 | undefined;
38
+ handle: string;
40
39
  revision?: string;
41
40
  pageToken?: string;
42
41
  }): Record<string, unknown>;
@@ -1 +1 @@
1
- {"version":3,"file":"write.d.ts","sourceRoot":"","sources":["../src/write.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,WAAW,EACX,aAAa,EAEb,cAAc,EAEf,MAAM,wBAAwB,CAAC;AAMhC,eAAO,MAAM,uBAAuB,QAAkB,CAAC;AAEvD,eAAO,MAAM,iBAAiB,KAAK,CAAC;AAEpC,eAAO,MAAM,gBAAgB,QAAuC,CAAC;AAErE,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,UA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