apcore-a2a 0.6.0 → 0.8.0

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/config.js ADDED
@@ -0,0 +1,71 @@
1
+ /**
2
+ * Config namespace registration and resolution for `apcore-a2a`.
3
+ *
4
+ * Mirrors the Python binding's `apcore_a2a._config`. It lives in its own module
5
+ * rather than in `server/factory.ts` because the CLI has to read the
6
+ * `apcore-a2a.openapi` section *before* it builds a Registry, and therefore long
7
+ * before anything in the server stack is imported — pulling in the factory (and
8
+ * with it express and the whole A2A SDK) just to register a namespace would put
9
+ * the entire server on the startup path of `apcore-a2a serve --help`.
10
+ *
11
+ * Registration must happen from exactly ONE place: apcore's
12
+ * `Config.registerNamespace` throws `ConfigNamespaceDuplicateError` on a second
13
+ * call for the same name, so a second registration site would crash the process
14
+ * at import time rather than being ignored.
15
+ */
16
+ import { Config } from "apcore-js";
17
+ export const A2A_NAMESPACE = "apcore-a2a";
18
+ export const A2A_ENV_PREFIX = "APCORE_A2A";
19
+ /** The registered namespace defaults (stable in apcore-js >= 0.22.0). */
20
+ export const A2A_DEFAULTS = {
21
+ execution_timeout: 300,
22
+ cors_origins: [],
23
+ explorer: false,
24
+ metrics: false,
25
+ push_notifications: false,
26
+ // The OpenAPI backend's section (feature F-12) — {spec, base_url, prefix,
27
+ // include, exclude, include_deprecated, timeout, headers,
28
+ // acknowledge_unapproved_writes}. The first NESTED key in this namespace,
29
+ // whose five siblings are all scalars.
30
+ //
31
+ // `openapi.spec` is also the FIRST path-typed key here, and apcore 0.30.0's
32
+ // protections for path-typed keys do not reach it: `Config.pathTypedKeys()`
33
+ // is a fixed list of apcore's own five keys and never consults a namespace
34
+ // registered through `Config.registerNamespace` (verified against apcore
35
+ // 0.30.0), and the PROTOCOL_SPEC §9.2.1 requirement-5 empty-value discard is
36
+ // gated on that same set — so `APCORE_A2A_OPENAPI_SPEC=` would be treated as
37
+ // an ordinary override to `""`, a legal relative path to every filesystem
38
+ // API. `openapiBackend.resolveSpecLocation` owns the three rules instead.
39
+ openapi: null,
40
+ };
41
+ /**
42
+ * Register the `apcore-a2a` config namespace. Safe to call repeatedly.
43
+ *
44
+ * The already-registered case is detected rather than caught: swallowing every
45
+ * exception here would also swallow a genuine `ConfigEnvPrefixConflictError`
46
+ * from another package claiming `APCORE_A2A`, which is a misconfiguration the
47
+ * operator needs to see.
48
+ */
49
+ export function registerA2aNamespace() {
50
+ if (Config.registeredNamespaces().some((ns) => ns.name === A2A_NAMESPACE))
51
+ return;
52
+ Config.registerNamespace({
53
+ name: A2A_NAMESPACE,
54
+ envPrefix: A2A_ENV_PREFIX,
55
+ defaults: A2A_DEFAULTS,
56
+ });
57
+ }
58
+ /**
59
+ * Resolve one `apcore-a2a` namespace setting through apcore's Config.
60
+ *
61
+ * Delegates to `Config.load` so that values from an apcore config file and
62
+ * `APCORE_A2A_*` environment overrides are applied by apcore itself (namespace
63
+ * mode), exactly like the other apcore bindings. Falls back to `fallback` when
64
+ * the key is unset.
65
+ */
66
+ export function getA2aSetting(key, fallback) {
67
+ registerA2aNamespace();
68
+ const value = Config.load(undefined, { validate: false }).get(`${A2A_NAMESPACE}.${key}`);
69
+ return value === undefined || value === null ? fallback : value;
70
+ }
71
+ //# sourceMappingURL=config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAEnC,MAAM,CAAC,MAAM,aAAa,GAAG,YAAY,CAAC;AAC1C,MAAM,CAAC,MAAM,cAAc,GAAG,YAAY,CAAC;AAE3C,yEAAyE;AACzE,MAAM,CAAC,MAAM,YAAY,GAA4B;IACnD,iBAAiB,EAAE,GAAG;IACtB,YAAY,EAAE,EAAE;IAChB,QAAQ,EAAE,KAAK;IACf,OAAO,EAAE,KAAK;IACd,kBAAkB,EAAE,KAAK;IACzB,0EAA0E;IAC1E,0DAA0D;IAC1D,0EAA0E;IAC1E,uCAAuC;IACvC,EAAE;IACF,4EAA4E;IAC5E,4EAA4E;IAC5E,2EAA2E;IAC3E,yEAAyE;IACzE,6EAA6E;IAC7E,6EAA6E;IAC7E,0EAA0E;IAC1E,0EAA0E;IAC1E,OAAO,EAAE,IAAI;CACd,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,UAAU,oBAAoB;IAClC,IAAI,MAAM,CAAC,oBAAoB,EAAE,CAAC,IAAI,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,IAAI,KAAK,aAAa,CAAC;QAAE,OAAO;IAClF,MAAM,CAAC,iBAAiB,CAAC;QACvB,IAAI,EAAE,aAAa;QACnB,SAAS,EAAE,cAAc;QACzB,QAAQ,EAAE,YAAY;KACvB,CAAC,CAAC;AACL,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,aAAa,CAAC,GAAW,EAAE,QAAkB;IAC3D,oBAAoB,EAAE,CAAC;IACvB,MAAM,KAAK,GAAG,MAAM,CAAC,IAAI,CAAC,SAAS,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC,CAAC,GAAG,CAC3D,GAAG,aAAa,IAAI,GAAG,EAAE,CAC1B,CAAC;IACF,OAAO,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC;AAClE,CAAC"}
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export declare const VERSION = "0.6.0";
1
+ export declare const VERSION = "0.7.0";
2
2
  export { serve, asyncServe } from "./serve.js";
3
3
  export { A2AClient } from "./client/index.js";
4
4
  export { A2AClientError, A2AConnectionError, A2ADiscoveryError, A2AServerError, AccessDeniedError, ApprovalDeniedError, ApprovalTimeoutError, GovernanceRefusedError, TaskNotCancelableError, TaskNotFoundError, } from "./client/index.js";
@@ -13,4 +13,6 @@ export { ErrorMapper } from "./adapters/index.js";
13
13
  export { PartConverter } from "./adapters/index.js";
14
14
  export { A2AServerFactory } from "./server/index.js";
15
15
  export { ApCoreAgentExecutor } from "./server/index.js";
16
+ export { buildOpenapiBackendFromConfig, openapiBackend, projectModuleId, resolveSpecLocation, synthesizeDescription, MODULE_ID_SEGMENT, WRITE_METHODS, } from "./openapi-backend.js";
17
+ export type { GovernanceStateLike, OpenapiBackendLogger, OpenapiBackendOptions, } from "./openapi-backend.js";
16
18
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,OAAO,UAAU,CAAC;AAG/B,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAG/C,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EACL,cAAc,EACd,kBAAkB,EAClB,iBAAiB,EACjB,cAAc,EACd,iBAAiB,EACjB,mBAAmB,EACnB,oBAAoB,EACpB,sBAAsB,EACtB,sBAAsB,EACtB,iBAAiB,GAClB,MAAM,mBAAmB,CAAC;AAG3B,YAAY,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AACnE,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AACvD,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAGrE,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAGpD,O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EACV,mBAAmB,EACnB,oBAAoB,EACpB,qBAAqB,GACtB,MAAM,sBAAsB,CAAC"}
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- export const VERSION = "0.6.0";
1
+ export const VERSION = "0.7.0";
2
2
  // Public API: serve
3
3
  export { serve, asyncServe } from "./serve.js";
4
4
  // Client
@@ -16,4 +16,7 @@ export { PartConverter } from "./adapters/index.js";
16
16
  // Server
17
17
  export { A2AServerFactory } from "./server/index.js";
18
18
  export { ApCoreAgentExecutor } from "./server/index.js";
19
+ // OpenAPI backend (feature F-12) — turn an OpenAPI 3.0/3.1 document into a
20
+ // populated apcore Registry, which `serve` accepts like any other.
21
+ export { buildOpenapiBackendFromConfig, openapiBackend, projectModuleId, resolveSpecLocation, synthesizeDescription, MODULE_ID_SEGMENT, WRITE_METHODS, } from "./openapi-backend.js";
19
22
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,OAAO,GAAG,OAAO,CAAC;AAE/B,oBAAoB;AACpB,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAE/C,SAAS;AACT,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EACL,cAAc,EACd,kBAAkB,EAClB,iBAAiB,EACjB,cAAc,EACd,iBAAiB,EACjB,mBAAmB,EACnB,oBAAoB,EACpB,sBAAsB,EACtB,sBAAsB,EACtB,iBAAiB,GAClB,MAAM,mBAAmB,CAAC;AAI3B,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AACvD,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAErE,WAAW;AACX,OAAO,EAAE,gBAAgB,EAAE,MAAM,q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gB,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAExD,2EAA2E;AAC3E,mEAAmE;AACnE,OAAO,EACL,6BAA6B,EAC7B,cAAc,EACd,eAAe,EACf,mBAAmB,EACnB,qBAAqB,EACrB,iBAAiB,EACjB,aAAa,GACd,MAAM,sBAAsB,CAAC"}
@@ -0,0 +1,208 @@
1
+ /**
2
+ * OpenAPI backend — serve an OpenAPI 3.0/3.1 document as A2A Skills.
3
+ *
4
+ * Pipeline:
5
+ *
6
+ * loadSpec -> OpenAPIScanner.scan -> [repair] -> HTTPProxyRegistryWriter.write -> Registry
7
+ *
8
+ * The scanner and the writer live in apcore-toolkit; this module composes them
9
+ * and adds the two repairs the composition needs, neither of which the toolkit
10
+ * can make on its own:
11
+ *
12
+ * - **FR-OAS-002 module-ID projection.** The toolkit sanitizes a derived ID into
13
+ * `[A-Za-z0-9_.-]`; apcore's registry accepts only
14
+ * `^[a-z][a-z0-9_]*(\.[a-z][a-z0-9_]*)*$`. Without the projection the canonical
15
+ * Swagger Petstore scans cleanly and registers nothing — the server starts and
16
+ * serves an Agent Card with zero skills, and nothing in the path raises.
17
+ * - **FR-OAS-003 description repair.** An operation with neither `summary` nor
18
+ * `description` yields `""`, and `AgentCardBuilder` skips a module whose
19
+ * description is empty — so the operation would vanish from the Agent Card with
20
+ * no diagnostic.
21
+ *
22
+ * See `apcore-a2a/docs/features/openapi-backend.md` for the specification and
23
+ * `conformance/fixtures/openapi_backend.json` for the shared contract.
24
+ */
25
+ import { Registry } from "apcore-js";
26
+ import { type ScannedModule } from "apcore-toolkit";
27
+ /**
28
+ * One dot-separated segment of an apcore-legal module ID. apcore enforces
29
+ * `^[a-z][a-z0-9_]*(\.[a-z][a-z0-9_]*)*$` at `Registry.register` and again at
30
+ * `Executor.call`; a segment may not begin with a digit, which is why some
31
+ * derived IDs cannot be repaired at all.
32
+ */
33
+ export declare const MODULE_ID_SEGMENT: RegExp;
34
+ /** HTTP methods that change state. The population FR-OAS-005 warns about. */
35
+ export declare const WRITE_METHODS: ReadonlySet<string>;
36
+ /**
37
+ * The diagnostics sink.
38
+ *
39
+ * Injectable rather than hard-wired to `console` for two reasons: a host that
40
+ * already owns a logger should not have this module writing past it, and the
41
+ * conformance driver asserts the *text* of the FR-OAS-002 / FR-OAS-003 /
42
+ * FR-OAS-005 diagnostics, which it cannot do against an unaddressable sink.
43
+ */
44
+ export interface OpenapiBackendLogger {
45
+ warn(message: string): void;
46
+ error(message: string): void;
47
+ info(message: string): void;
48
+ }
49
+ /**
50
+ * The fragment of apcore's `GovernanceState` this module reads.
51
+ *
52
+ * Both naming conventions are accepted so a duck-typed object from a test or a
53
+ * host framework works alongside apcore's own camelCase record.
54
+ */
55
+ export interface GovernanceStateLike {
56
+ readonly builtinApprovalGateWired?: boolean;
57
+ readonly builtin_approval_gate_wired?: boolean;
58
+ }
59
+ /** Options for {@link openapiBackend}. */
60
+ export interface OpenapiBackendOptions {
61
+ /** Where proxied requests go. Defaults to the document's `servers[0].url`. */
62
+ baseUrl?: string;
63
+ /** `basePathPrefix` — prepended to every derived module ID. */
64
+ prefix?: string;
65
+ /** Scanner include filter (regex over module IDs). */
66
+ include?: string;
67
+ /** Scanner exclude filter (regex over module IDs). */
68
+ exclude?: string;
69
+ /** When `false`, operations marked `deprecated: true` are skipped. Default `true`. */
70
+ includeDeprecated?: boolean;
71
+ /**
72
+ * Headers for the **spec fetch only**. Never forwarded to proxied calls, and
73
+ * never logged: a document is often public while the API behind it is not.
74
+ */
75
+ headers?: Record<string, string>;
76
+ /**
77
+ * Spec-fetch timeout in **SECONDS** — never the per-call proxy timeout.
78
+ *
79
+ * apcore-toolkit's `loadSpec` takes milliseconds (default `30_000`), so this
80
+ * value is multiplied by 1000 at the call site. The Config Bus key is seconds
81
+ * in all three SDKs; passing it straight through would turn a documented
82
+ * `timeout: 30` into a 30 ms fetch timeout.
83
+ */
84
+ timeout?: number;
85
+ /**
86
+ * Passed to `HTTPProxyRegistryWriter` — the per-request credential hook.
87
+ * apcore-toolkit >= 0.12.0 awaits the return value, so an async factory
88
+ * (e.g. one that refreshes a rotating credential) works without a writer
89
+ * change — matching `HTTPProxyRegistryWriter`'s own widened type.
90
+ */
91
+ authHeaderFactory?: () => Record<string, string> | Promise<Record<string, string>>;
92
+ /** Write into this registry instead of a fresh one. */
93
+ registry?: Registry;
94
+ /** True when an extensions directory (or another source) also populates the registry. */
95
+ hasOtherBackendSource?: boolean;
96
+ /** The base a relative `spec` resolves against (FR-OAS-004 rule 3). */
97
+ projectRoot?: string;
98
+ /** Records an explicit operator decision, suppressing FR-OAS-005's warning. */
99
+ acknowledgeUnapprovedWrites?: boolean;
100
+ /** Consulted only to word FR-OAS-005's warning; never to suppress it. */
101
+ governanceState?: GovernanceStateLike | null;
102
+ /** Scanner hook: patch an operation before extraction. */
103
+ transformOperation?: (p: string, method: string, operation: Record<string, unknown>) => Record<string, unknown> | null;
104
+ /**
105
+ * Caller hook: adjust the finished module. Runs **first**, before the
106
+ * description repair and the ID projection, so the invariants those two hold
107
+ * are unconditional whatever this returns.
108
+ */
109
+ transformModule?: (module: ScannedModule) => ScannedModule | null;
110
+ /** Scanner hook: override the naming algorithm. */
111
+ deriveModuleId?: (p: string, method: string, operation: Record<string, unknown>) => string | null;
112
+ /** Diagnostics sink. Defaults to `console`. */
113
+ logger?: Partial<OpenapiBackendLogger>;
114
+ }
115
+ /**
116
+ * Project a toolkit-derived module ID into apcore's registry alphabet.
117
+ *
118
+ * Lowercase, then `-` -> `_`. Returns `null` when the result still has a segment
119
+ * apcore would reject — such an ID cannot be repaired without *inventing* a
120
+ * character, which is a naming decision belonging to the operator's own hook
121
+ * rather than to a silent default. The module is dropped and reported by the
122
+ * caller.
123
+ */
124
+ export declare function projectModuleId(moduleId: string): string | null;
125
+ /** The minimum surface {@link synthesizeDescription} reads off a scanned module. */
126
+ export interface DescribableModule {
127
+ readonly moduleId?: string;
128
+ readonly metadata?: Record<string, unknown> | null;
129
+ }
130
+ /**
131
+ * Build a `{METHOD} {path}` description for an undocumented operation.
132
+ *
133
+ * Uses the `http_method` / `url_path` metadata keys `HTTPProxyRegistryWriter`
134
+ * already requires, so the value is factual and stable across scans of the same
135
+ * document. Deliberately terse so it reads as a placeholder rather than as
136
+ * documentation.
137
+ */
138
+ export declare function synthesizeDescription(module: DescribableModule): string;
139
+ /**
140
+ * The base a relative `spec` resolves against (FR-OAS-004 rule 3).
141
+ *
142
+ * `Config.projectRoot` is apcore 0.30.0's public accessor. It reports a base and
143
+ * applies nothing, which is exactly the division of labour this key needs: the
144
+ * adapter owns the resolution because `Config.pathTypedKeys()` never reaches a
145
+ * consumer namespace.
146
+ */
147
+ export declare function resolveProjectRoot(explicit?: string | null): string;
148
+ /**
149
+ * Resolve `apcore-a2a.openapi.spec` (FR-OAS-004).
150
+ *
151
+ * apcore 0.30.0 declared the closed set of path-typed configuration keys and the
152
+ * base a relative one resolves against, but `Config.pathTypedKeys()` is a fixed
153
+ * list of apcore's own keys and never consults a namespace registered through
154
+ * `Config.registerNamespace` — verified against apcore 0.30.0. The §9.2.1
155
+ * requirement-5 empty-value discard is gated on that same set, so
156
+ * `APCORE_A2A_OPENAPI_SPEC=` would otherwise become an ordinary override to `""`,
157
+ * a legal relative path to every filesystem API and never the one an operator
158
+ * meant. This binding therefore owns the three rules rather than inheriting them.
159
+ *
160
+ * 1. A value beginning `http://` / `https://` is a URL, used verbatim — never
161
+ * path-resolved, never made absolute.
162
+ * 2. A set-but-empty value is discarded with a WARNING and the caller falls
163
+ * through to the next configuration tier. It is never joined to a base, which
164
+ * would silently yield the project root.
165
+ * 3. A relative path resolves against `Config.projectRoot` — not the process CWD,
166
+ * and not the document's own directory.
167
+ *
168
+ * @returns the URL unchanged, an absolute path, the already-parsed document, or
169
+ * `null` when the value was empty and the caller should fall through.
170
+ */
171
+ export declare function resolveSpecLocation(spec: unknown, options?: {
172
+ projectRoot?: string | null;
173
+ logger?: {
174
+ warn(message: string): void;
175
+ };
176
+ }): unknown;
177
+ /**
178
+ * Build an apcore `Registry` from an OpenAPI 3.0/3.1 document.
179
+ *
180
+ * `spec` is a URL, a filesystem path (resolved per FR-OAS-004), or an
181
+ * already-parsed document object. `timeout` is the **spec-fetch** timeout in
182
+ * seconds, never the per-call proxy timeout — the two are different concerns.
183
+ *
184
+ * Never returns a partially-populated registry: the collision preflight and
185
+ * every validation run before the first write.
186
+ */
187
+ export declare function openapiBackend(spec: unknown, options?: OpenapiBackendOptions): Promise<Registry>;
188
+ /**
189
+ * Build the backend from an `apcore-a2a.openapi` Config Bus section.
190
+ *
191
+ * The raw Config Bus value is a plain object (from `apcore.yaml` or
192
+ * `APCORE_A2A_OPENAPI_*` env vars) in snake_case, not the camelCase options
193
+ * {@link openapiBackend} takes, so this is the one place that translates between
194
+ * them.
195
+ *
196
+ * Returns `null` when the section is absent or falsy, so a caller can treat "no
197
+ * OpenAPI configured" as an ordinary outcome.
198
+ *
199
+ * `authHeaderFactory` is deliberately not read from the section: it is a
200
+ * callable, and a value sourced from YAML/JSON/env can never carry one.
201
+ */
202
+ export declare function buildOpenapiBackendFromConfig(openapiConfig: unknown, options?: {
203
+ registry?: Registry;
204
+ hasOtherBackendSource?: boolean;
205
+ governanceState?: GovernanceStateLike | null;
206
+ logger?: Partial<OpenapiBackendLogger>;
207
+ }): Promise<Registry | null>;
208
+ //# sourceMappingURL=openapi-backend.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"openapi-backend.d.ts","sourceRoot":"","sources":["../src/openapi-backend.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAGH,OAAO,EAAU,QAAQ,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAKL,KAAK,aAAa,EACnB,MAAM,gBAAgB,CAAC;AAExB;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,QAAsB,CAAC;AAErD,6EAA6E;AAC7E,eAAO,MAAM,aAAa,EAAE,WAAW,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